@castlabs/prestoplay 6.34.0 → 6.35.0-beta.1

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 (61) hide show
  1. package/cjs/cl.adobe.js +3 -3
  2. package/cjs/cl.airplay.js +3 -3
  3. package/cjs/cl.broadpeak.js +18 -18
  4. package/cjs/cl.cast.js +125 -125
  5. package/cjs/cl.conviva.js +31 -31
  6. package/cjs/cl.core.js +579 -577
  7. package/cjs/cl.crypto.js +9 -9
  8. package/cjs/cl.dash.js +100 -100
  9. package/cjs/cl.freewheel.js +26 -26
  10. package/cjs/cl.hls.js +76 -76
  11. package/cjs/cl.hlssmpte.js +6 -6
  12. package/cjs/cl.htmlcue.js +30 -30
  13. package/cjs/cl.ima.js +25 -25
  14. package/cjs/cl.mediatailor.js +3 -3
  15. package/cjs/cl.mse.js +345 -345
  16. package/cjs/cl.muxdata.js +13 -13
  17. package/cjs/cl.onboard.js +4 -4
  18. package/cjs/cl.persistent.js +14 -14
  19. package/cjs/cl.playlist.js +5 -5
  20. package/cjs/cl.simid.js +16 -16
  21. package/cjs/cl.smooth.js +70 -70
  22. package/cjs/cl.thumbnails.js +25 -25
  23. package/cjs/cl.tizen.js +67 -67
  24. package/cjs/cl.ttml.js +29 -29
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +8 -8
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.yospace.js +3 -3
  30. package/cjs/cl.youbora.js +38 -38
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +14 -14
  34. package/cl.cast.js +97 -97
  35. package/cl.conviva.js +28 -27
  36. package/cl.core.js +463 -462
  37. package/cl.crypto.js +8 -8
  38. package/cl.dash.js +89 -89
  39. package/cl.freewheel.js +20 -20
  40. package/cl.hls.js +82 -82
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +26 -26
  43. package/cl.ima.js +19 -19
  44. package/cl.mediatailor.js +2 -2
  45. package/cl.mse.js +299 -299
  46. package/cl.muxdata.js +11 -11
  47. package/cl.onboard.js +5 -5
  48. package/cl.persistent.js +10 -10
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +14 -14
  51. package/cl.smooth.js +60 -60
  52. package/cl.thumbnails.js +17 -17
  53. package/cl.tizen.js +55 -55
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +7 -7
  57. package/cl.vr.js +14 -14
  58. package/cl.vtt.js +12 -12
  59. package/cl.yospace.js +3 -3
  60. package/cl.youbora.js +31 -31
  61. package/package.json +1 -1
package/cl.crypto.js CHANGED
@@ -1,9 +1,9 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var AU=function(a){a=_.si(a);const b=new Uint32Array(4);for(let c=0;4>c;c++)b[c]=a.getUint32(4*c);return b},CU=function(a,b){return c=>_.v(function*(){const d=c.request||null;if(d&&2===d.type&&d.keyInfo&&c.data){const e=d.uris[0];a.g.debug("Decrypting AES-128-encrypted video segment",e);c.data=yield BU(a,b,c.data,d.keyInfo,e)}return c})},BU=function(a,b,c,d,e){return _.v(function*(){let f=new ArrayBuffer(0);try{f=yield DU(a,b,d.url)}catch(g){return a.g.warn("Could not fetch AES key",
2
- g),b.onError(new _.J(1,7,7104,null,g,g.svtaCode||3E3)),c}try{const g=a.f?new EU:new FU;yield g.importKey(f);return yield g.decrypt(c,d.iv)}catch(g){return a.g.warn("Could not decrypt segment data!",e,g),b.onError(new _.J(1,3,3103,null,g)),c}})},DU=function(a,b,c){return _.v(function*(){const d=_.ek(c),e=(new _.Dj(c)).a.hostname.endsWith(".drmtoday.com");if(e){var f=b.getConfiguration();_.en(d,f)}f=c+JSON.stringify(d.headers);if(a.a[f])return a.a[f];try{const g=yield b.getNetworkEngine().fetch(d).V;
3
- return a.a[f]=g.data}catch(g){throw e&&1001===g.code&&412===g.data.status&&a.g.warn("Wrong DRMtoday credentials, server responded with 412."),g;}})},FU=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.h=this.a=this.j=this.f=
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var BU=function(a){a=_.ti(a);const b=new Uint32Array(4);for(let c=0;4>c;c++)b[c]=a.getUint32(4*c);return b},DU=function(a,b){return c=>_.v(function*(){const d=c.request||null;if(d&&2===d.type&&d.keyInfo&&c.data){const e=d.uris[0];a.g.debug("Decrypting AES-128-encrypted video segment",e);c.data=yield CU(a,b,c.data,d.keyInfo,e)}return c})},CU=function(a,b,c,d,e){return _.v(function*(){let f=new ArrayBuffer(0);try{f=yield EU(a,b,d.url)}catch(g){return a.g.warn("Could not fetch AES key",
2
+ g),b.onError(new _.J(1,7,7104,null,g,g.svtaCode||3E3)),c}try{const g=a.f?new FU:new GU;yield g.importKey(f);return yield g.decrypt(c,d.iv)}catch(g){return a.g.warn("Could not decrypt segment data!",e,g),b.onError(new _.J(1,3,3103,null,g)),c}})},EU=function(a,b,c){return _.v(function*(){const d=_.fk(c),e=(new _.Ej(c)).a.hostname.endsWith(".drmtoday.com");if(e){var f=b.getConfiguration();_.fn(d,f)}f=c+JSON.stringify(d.headers);if(a.a[f])return a.a[f];try{const g=yield b.getNetworkEngine().fetch(d).V;
3
+ return a.a[f]=g.data}catch(g){throw e&&1001===g.code&&412===g.data.status&&a.g.warn("Wrong DRMtoday credentials, server responded with 412."),g;}})},GU=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.h=this.a=this.j=this.f=
4
4
  null;{const c=this.A,d=this.o;var a=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,p=0,u;for(u=0;256>u;u++)m[u]=128>u?u<<1:u<<1^283;for(u=0;256>u;u++){let x=p^p<<1^p<<2^p<<3^p<<4;x=x>>>8^x&255^99;c[n]=x;d[x]=n;const y=m[n],B=m[y],F=m[B];let G=257*m[x]^16843008*x;e[n]=G<<24|G>>>8;f[n]=G<<16|G>>>16;g[n]=G<<8|G>>>24;a[n]=G;G=16843009*F^65537*B^257*y^16843008*n;h[x]=G<<24|G>>>8;k[x]=G<<16|G>>>16;l[x]=G<<8|G>>>24;b[x]=G;n?(n=
5
- y^m[m[m[F^y]]],p^=m[m[p]]):n=p=1}}}importKey(a){a=AU(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.h=4*(this.a+7);this.f=new Uint32Array(this.h);this.j=new Uint32Array(this.h);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.h;e++)e<this.a?k=this.f[e]=a[e]:(l=k,0===e%this.a?(l=l<<8|l>>>24,l=b[l>>>
6
- 24]<<24|b[l>>>16&255]<<16|b[l>>>8&255]<<8|b[l&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.h;a++)e=this.h-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=AU(b);b=m[0];
7
- let n=m[1],p=m[2];m=m[3];a=_.ri(a);const u=new Int32Array(a.length);let x,y,B;let F,G,D,ka,Da,Xa,Hb,tb,gc;const hc=this.F.bind(this);for(;c<a.length;){ka=hc(a[c]);Da=hc(a[c+1]);Xa=hc(a[c+2]);Hb=hc(a[c+3]);F=ka^e[0];G=Hb^e[1];D=Xa^e[2];var Ib=Da^e[3];tb=4;for(gc=1;gc<d;gc++)x=h[F>>>24]^k[G>>16&255]^l[D>>8&255]^g[Ib&255]^e[tb],y=h[G>>>24]^k[D>>16&255]^l[Ib>>8&255]^g[F&255]^e[tb+1],B=h[D>>>24]^k[Ib>>16&255]^l[F>>8&255]^g[G&255]^e[tb+2],Ib=h[Ib>>>24]^k[F>>16&255]^l[G>>8&255]^g[D&255]^e[tb+3],F=x,G=y,
8
- D=B,tb+=4;x=f[F>>>24]<<24^f[G>>16&255]<<16^f[D>>8&255]<<8^f[Ib&255]^e[tb];y=f[G>>>24]<<24^f[D>>16&255]<<16^f[Ib>>8&255]<<8^f[F&255]^e[tb+1];B=f[D>>>24]<<24^f[Ib>>16&255]<<16^f[F>>8&255]<<8^f[G&255]^e[tb+2];Ib=f[Ib>>>24]<<24^f[F>>16&255]<<16^f[G>>8&255]<<8^f[D&255]^e[tb+3];tb+=3;u[c]=hc(x^b);u[c+1]=hc(Ib^n);u[c+2]=hc(B^p);u[c+3]=hc(y^m);b=ka;n=Da;p=Xa;m=Hb;c+=4}return new Promise(jb=>{{var za=u.buffer;const wb=za.byteLength,vc=wb&&(new DataView(za)).getUint8(wb-1);za=vc?za.slice(0,wb-vc):za}jb(za)})}destroy(){this.B=
9
- this.j=this.f=this.l=this.C=this.o=this.A=this.h=this.a=this.w=null;return new Promise(a=>a())}F(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24}};var EU=class{constructor(){this.a=null}importKey(a){const b=this;return _.v(function*(){b.a=yield crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"])})}decrypt(a,b){const c=this;return _.v(function*(){return yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a)})}destroy(){this.a=null;return new Promise(a=>a())}};_.w("clpp.crypto.CryptoComponent",class extends _.Ev{constructor(){super();this.a={};this.f=!1;this.g=new _.S("clpp.crypto")}install(){if(window.crypto&&crypto.subtle){var a=crypto.subtle.decrypt;a=typeof crypto.subtle.importKey===_.Wd&&typeof a===_.Wd}else a=!1;(this.f=a)||this.g.warn("No WebCrypto APIs found. Will fallback to software AES")}playerConstructed(a){const b=CU(this,a);a.getNetworkEngine().td(b)}uninstall(){this.a={}}id(){return"crypto"}});};f.call(g, window);
5
+ y^m[m[m[F^y]]],p^=m[m[p]]):n=p=1}}}importKey(a){a=BU(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.h=4*(this.a+7);this.f=new Uint32Array(this.h);this.j=new Uint32Array(this.h);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.h;e++)e<this.a?k=this.f[e]=a[e]:(l=k,0===e%this.a?(l=l<<8|l>>>24,l=b[l>>>
6
+ 24]<<24|b[l>>>16&255]<<16|b[l>>>8&255]<<8|b[l&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.h;a++)e=this.h-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=BU(b);b=m[0];
7
+ let n=m[1],p=m[2];m=m[3];a=_.si(a);const u=new Int32Array(a.length);let x,y,B;let F,G,D,ka,Da,Xa,Hb,sb,hc;const ic=this.F.bind(this);for(;c<a.length;){ka=ic(a[c]);Da=ic(a[c+1]);Xa=ic(a[c+2]);Hb=ic(a[c+3]);F=ka^e[0];G=Hb^e[1];D=Xa^e[2];var Ib=Da^e[3];sb=4;for(hc=1;hc<d;hc++)x=h[F>>>24]^k[G>>16&255]^l[D>>8&255]^g[Ib&255]^e[sb],y=h[G>>>24]^k[D>>16&255]^l[Ib>>8&255]^g[F&255]^e[sb+1],B=h[D>>>24]^k[Ib>>16&255]^l[F>>8&255]^g[G&255]^e[sb+2],Ib=h[Ib>>>24]^k[F>>16&255]^l[G>>8&255]^g[D&255]^e[sb+3],F=x,G=y,
8
+ D=B,sb+=4;x=f[F>>>24]<<24^f[G>>16&255]<<16^f[D>>8&255]<<8^f[Ib&255]^e[sb];y=f[G>>>24]<<24^f[D>>16&255]<<16^f[Ib>>8&255]<<8^f[F&255]^e[sb+1];B=f[D>>>24]<<24^f[Ib>>16&255]<<16^f[F>>8&255]<<8^f[G&255]^e[sb+2];Ib=f[Ib>>>24]<<24^f[F>>16&255]<<16^f[G>>8&255]<<8^f[D&255]^e[sb+3];sb+=3;u[c]=ic(x^b);u[c+1]=ic(Ib^n);u[c+2]=ic(B^p);u[c+3]=ic(y^m);b=ka;n=Da;p=Xa;m=Hb;c+=4}return new Promise(jb=>{{var za=u.buffer;const vb=za.byteLength,xc=vb&&(new DataView(za)).getUint8(vb-1);za=xc?za.slice(0,vb-xc):za}jb(za)})}destroy(){this.B=
9
+ this.j=this.f=this.l=this.C=this.o=this.A=this.h=this.a=this.w=null;return new Promise(a=>a())}F(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24}};var FU=class{constructor(){this.a=null}importKey(a){const b=this;return _.v(function*(){b.a=yield crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"])})}decrypt(a,b){const c=this;return _.v(function*(){return yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a)})}destroy(){this.a=null;return new Promise(a=>a())}};_.w("clpp.crypto.CryptoComponent",class extends _.Fv{constructor(){super();this.a={};this.f=!1;this.g=new _.S("clpp.crypto")}install(){if(window.crypto&&crypto.subtle){var a=crypto.subtle.decrypt;a=typeof crypto.subtle.importKey===_.Wd&&typeof a===_.Wd}else a=!1;(this.f=a)||this.g.warn("No WebCrypto APIs found. Will fallback to software AES")}playerConstructed(a){const b=DU(this,a);a.getNetworkEngine().td(b)}uninstall(){this.a={}}id(){return"crypto"}});};f.call(g, window);
package/cl.dash.js CHANGED
@@ -1,91 +1,91 @@
1
- import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var qM="\x3cms:pro/\x3e lacks content",rM="BaseURL",sM="Channel parsing failure! Ignoring scheme and value",tM="ContentProtection",uM="Empty period duration.",vM="EssentialProperty",wM="Failed to parse UTCTiming tags.",xM="Location",yM="Missing \x3cms:pro/\x3e node in ContentProtection element",zM="No UTCTiming elements found.",AM="SegmentBase does not contain sufficient segment information:",BM="SegmentList does not contain sufficient segment information:",CM="SegmentTemplate does not contain sufficient segment information:",
2
- DM="SegmentTimeline",EM="Source is empty. Skipping fit.",FM='The last "S" element cannot have a negative repeat',GM="application",HM="duration",IM="http://dashif.org/guidelines/trickmode",JM="http://www.w3.org/1999/xlink",KM='ignoring the last "S" element.',LM='ignoring the remaining "S" elements.',MM="parse.xml",NM="presentationTimeOffset",OM="schemeIdUri",PM="static",QM="timescale",RM="urn:microsoft:playready",SM="urn:mpeg:cenc:2013",TM="urn:mpeg:dash:utc:http-head:2014",UM="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",
3
- VM="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",WM=function(a,b){return _.Ng[a]=b},XM=function(a,b,c){try{const d=a(b);if(d&&d.V&&d.abort)return c.resolve(d.V),()=>d.abort();c.resolve(d);return()=>Promise.resolve(d).then(()=>{}).catch(()=>{})}catch(d){return c.reject(d),()=>Promise.resolve()}},YM=function(a,b,c){const d=new _.wk;let e=()=>{d.reject(new _.J(_.C,7,7001));return a.abort()};a.V.then(f=>{a.a?d.reject(new _.J(_.C,7,7001)):b?e=XM(b,f,d):d.resolve(f)},f=>{c?e=XM(c,f,d):d.reject(f)});return new _.jp(d,
4
- ()=>e())},ZM=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},$M=function(a){return a===_.q||a===_.t},aN=function(a){return new _.jp(Promise.reject(a),()=>Promise.resolve())},bN=function(a){return new _.jp(Promise.all(a.map(b=>b.V)),()=>Promise.all(a.map(b=>b.abort())))},cN=function(a){return 1>=a?0:Math.floor(Math.random()*a)},dN=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:
5
- Math.floor(a/1E3)},eN=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 _.A("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},fN=function(a){var b=/([0-9]+)-([0-9]+)/.exec(a);if(!b)return null;a=Number(b[1]);if(!isFinite(a))return null;b=
6
- Number(b[2]);return isFinite(b)?{start:a,end:b}:null},gN=function(a){a=Number(a);return 0===a%1?a:null},hN=function(a){a=Number(a);return 0===a%1&&0<a?a:null},iN=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},jN=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},kN=function(a){return a?"true"===a.toLowerCase():!1},lN=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>
7
- b?a.subarray(0,b):a).toString()},mN=function(a,b){b-=a.l;return 0>b||b>=a.j?null:b},nN=function(a){let b=0;for(const c of a)!(0>=c.count)&&c.duration>b&&(b=c.duration);return b},oN=function(a,b){if(0>b||b>=a.a)throw new _.vj(`SegmentTimelineIndex: out of bounds: ${b}/${a.a}`);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.ne+f.count-1;if(b<f.ne)d=e-1;else if(b>g)c=e+1;else{c=e;break a}}c=-1}if(0>c)throw new _.vj(`SegmentTimelineIndex: index not found: ${b}/${a.a}`);
8
- a=c=a.f[c];b-=c.ne;c=a.startTime+b*a.duration;return{startTime:c,endTime:b===a.count-1&&null!=a.Bd?a.Bd:c+a.duration,kj:a.jj+b*a.ij}},pN=function(a,b){if(0===a.a)return null;if(b<a.j)return 0;var c=a.f[a.f.length-1];if(b>=(null!=c.Bd?c.Bd:c.startTime+c.count*c.duration))return null;{c=0;let d=a.f.length-1,e=0;for(;c<=d;){const f=Math.floor((c+d)/2);b<a.f[f].startTime?d=f-1:(e=f,c=f+1)}c=e}a=a.f[c];b=Math.floor((b-a.startTime)/a.duration);0>b?b=0:b>=a.count&&(b=a.count-1);return a.ne+b},qN=function(a,
1
+ import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var rM="\x3cms:pro/\x3e lacks content",sM="BaseURL",tM="Channel parsing failure! Ignoring scheme and value",uM="ContentProtection",vM="Empty period duration.",wM="EssentialProperty",xM="Failed to parse UTCTiming tags.",yM="Location",zM="Missing \x3cms:pro/\x3e node in ContentProtection element",AM="No UTCTiming elements found.",BM="SegmentBase does not contain sufficient segment information:",CM="SegmentList does not contain sufficient segment information:",DM="SegmentTemplate does not contain sufficient segment information:",
2
+ EM="SegmentTimeline",FM="Source is empty. Skipping fit.",GM='The last "S" element cannot have a negative repeat',HM="application",IM="duration",JM="http://dashif.org/guidelines/trickmode",KM="http://www.w3.org/1999/xlink",LM='ignoring the last "S" element.',MM='ignoring the remaining "S" elements.',NM="parse.xml",OM="presentationTimeOffset",PM="schemeIdUri",QM="static",RM="timescale",SM="urn:microsoft:playready",TM="urn:mpeg:cenc:2013",UM="urn:mpeg:dash:utc:http-head:2014",VM="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",
3
+ WM="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",XM=function(a,b){return _.Ng[a]=b},YM=function(a,b,c){try{const d=a(b);if(d&&d.V&&d.abort)return c.resolve(d.V),()=>d.abort();c.resolve(d);return()=>Promise.resolve(d).then(()=>{}).catch(()=>{})}catch(d){return c.reject(d),()=>Promise.resolve()}},ZM=function(a,b,c){const d=new _.xk;let e=()=>{d.reject(new _.J(_.C,7,7001));return a.abort()};a.V.then(f=>{a.a?d.reject(new _.J(_.C,7,7001)):b?e=YM(b,f,d):d.resolve(f)},f=>{c?e=YM(c,f,d):d.reject(f)});return new _.kp(d,
4
+ ()=>e())},$M=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},aN=function(a){return a===_.q||a===_.t},bN=function(a){return new _.kp(Promise.reject(a),()=>Promise.resolve())},cN=function(a){return new _.kp(Promise.all(a.map(b=>b.V)),()=>Promise.all(a.map(b=>b.abort())))},dN=function(a){return 1>=a?0:Math.floor(Math.random()*a)},eN=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:
5
+ Math.floor(a/1E3)},fN=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 _.A("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},gN=function(a){var b=/([0-9]+)-([0-9]+)/.exec(a);if(!b)return null;a=Number(b[1]);if(!isFinite(a))return null;b=
6
+ Number(b[2]);return isFinite(b)?{start:a,end:b}:null},hN=function(a){a=Number(a);return 0===a%1?a:null},iN=function(a){a=Number(a);return 0===a%1&&0<a?a:null},jN=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},kN=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},lN=function(a){return a?"true"===a.toLowerCase():!1},mN=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>
7
+ b?a.subarray(0,b):a).toString()},nN=function(a,b){b-=a.l;return 0>b||b>=a.j?null:b},oN=function(a){let b=0;for(const c of a)!(0>=c.count)&&c.duration>b&&(b=c.duration);return b},pN=function(a,b){if(0>b||b>=a.a)throw new _.wj(`SegmentTimelineIndex: out of bounds: ${b}/${a.a}`);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.ne+f.count-1;if(b<f.ne)d=e-1;else if(b>g)c=e+1;else{c=e;break a}}c=-1}if(0>c)throw new _.wj(`SegmentTimelineIndex: index not found: ${b}/${a.a}`);
8
+ a=c=a.f[c];b-=c.ne;c=a.startTime+b*a.duration;return{startTime:c,endTime:b===a.count-1&&null!=a.Bd?a.Bd:c+a.duration,kj:a.jj+b*a.ij}},qN=function(a,b){if(0===a.a)return null;if(b<a.j)return 0;var c=a.f[a.f.length-1];if(b>=(null!=c.Bd?c.Bd:c.startTime+c.count*c.duration))return null;{c=0;let d=a.f.length-1,e=0;for(;c<=d;){const f=Math.floor((c+d)/2);b<a.f[f].startTime?d=f-1:(e=f,c=f+1)}c=e}a=a.f[c];b=Math.floor((b-a.startTime)/a.duration);0>b?b=0:b>=a.count&&(b=a.count-1);return a.ne+b},rN=function(a,
9
9
  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 _.A("URL template does not have an available substitution ","for identifier",'"'+h+'":',a),g;"RepresentationID"===h&&k&&(_.A("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=
10
- 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})},uN=function(a,b){var c=rN(a,b,QM);let d=1;c&&(d=hN(c)||1);c=rN(a,b,HM);(c=hN(c||""))&&(c/=d);let e=Number(rN(a,b,NM))||0,f=e/d||0;a.ki&&null!=a.Pd&&a.Pd!==f&&(_.A("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 "+
11
- `value will be ignored. (Period ID: ${a.Ka.id}, `+`Representation ID: ${a.O.id})`),e=a.Pd*d,f=a.Pd);var g=rN(a,b,"startNumber");let h=iN(g||"");if(null==g||null==h)h=1;g=rN(a,b,"endNumber");g=null!==g?iN(g||""):null;var k=sN(a,b,DM),l=null;if(k){{l=d;var m=e,n=a.Za.duration||Infinity;const y=_.Fn;k=y.a(k,"S");const B=[];var p=0;let F=0;for(let G=0;G<k.length;++G){const D=k[G];var u=y.aa(D,"t",iN);const ka=y.aa(D,"d",iN);var x=y.aa(D,"r",gN);null!=u&&(u-=m);if(!ka){_.A('"S" element must have a duration:',
12
- LM,D);break}u=null!=u?u:p;x=x||0;if(0>x)if(G+1<k.length){x=y.aa(k[G+1],"t",iN);if(null==x){_.A('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:',LM,D);break}else if(u>=x){_.A('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',LM,D);break}x=Math.ceil((x-u)/ka)-1}else{if(Infinity===n){_.A(FM,"if the Period has an infinite duration:",KM,D);break}else if(u/l>=n){_.A(FM,"if its start time exceeds the Period's duration:",
13
- KM,D);break}x=Math.ceil((n*l-u)/ka)-1}0<B.length&&u!==p&&(Math.abs((u-p)/l)>=_.mu&&_.A("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",D),B[B.length-1].Bd=u/l);p=x+1;B.push({ne:F,count:p,startTime:u/l,duration:ka/l,jj:u,ij:ka,Bd:null});F+=p;p=u+p*ka}l=new tN(B)}}a=rN(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,$a:c,Nc:h,Ve:g,Tb:f,Jf:e,wa:l,Oe:b}},rN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ka)].filter(_.uj).map(d=>
14
- d.getAttribute(c)).reduce((d,e)=>d||e)},sN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ka)].filter(_.uj).map(d=>_.Fn.h(d,c)).reduce((d,e)=>d||e)},wN=function(a,b,c,d,e,f){const g=_.Fn,h=g.getAttributeNS(a,JM,"href"),k=g.getAttributeNS(a,JM,"actuate")||"onRequest";g.Ee(a,JM);if(5<=f)return aN(new _.J(_.C,4,4028));if("onLoad"!==k)return aN(new _.J(_.C,4,4027));const l=_.wB([d],[h]);d=_.ek(l,b);d.type=1;return YM(e.fetch(d),m=>{m=_.vi(m.data);m=g.j(m,a.tagName);if(!m)return aN(new _.J(_.C,4,4001,{uri:h}));
15
- g.De(a);g.ue(m,a);g.te(m,a);return vN(a,b,c,l[0],e,f+1)})},vN=function(a,b,c,d,e,f){f=void 0===f?0:f;var g=_.Fn;if(g.getAttributeNS(a,JM,"href"))return g=wN(a,b,c,d,e,f),c&&(g=YM(g,void 0,()=>vN(a,b,c,d,e,f))),g;const h=[],k=g.pe(a);for(const l of k)"urn:mpeg:dash:resolve-to-zero:2013"===g.getAttributeNS(l,JM,"href")?g.removeChild(a,l):l.tagName!==DM&&h.push(vN(l,b,c,d,e,f));return YM(bN(h),()=>a)},xN=function(a,b){const c=a.Za.start;var d=a.presentationTimeline;d.o||(d.I=Math.floor(Math.max(d.I||
16
- 0,b.ac+c)));a.zg||_.rC(a.presentationTimeline,{nc:b.nc+c,ac:b.ac+c,bc:b.bc},"notifySegmentSummary")},yN=function(a){return""===a.id?`${a.schemeIdUri}:${a.startTime}:${a.endTime}`:a.id},zN=function(a,b,c,d,e){return _.v(function*(){const f=_.fC(a,b,c,e);f.type=2;return(yield _.gl(d,f,{objectType:"i"}).V).data})},AN=function(a,b){b-=a.h;return 0>b||b>=a.f?null:b},CN=function(a,b,c,d){let e;var f=(new _.Vm).fa("sidx",g=>{e=BN(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=
17
- c[0];a=_.E(a);_.sh('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.J(_.C,3,3004,{url:g,yj:f,size:a.byteLength,Oj:lN(a)});}},BN=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.P(d.reader);if(0===f)throw _.sh("Invalid timescale."),new _.J(_.C,3,3005);if(0===d.version){var g=_.P(d.reader);var h=_.P(d.reader)}else g=_.Gm(d.reader),h=_.Gm(d.reader);d.reader.skip(2);const k=_.Em(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.P(d.reader);const m=(l&2147483648)>>>
18
- 31;l&=2147483647;const n=_.P(d.reader);d.reader.skip(4);if(1===m)throw _.sh("Hierarchical SIDXs are not supported."),new _.J(_.C,3,3006);e.push(new _.BI(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},DN=function(a){var b=_.Dm(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.J(_.C,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Dm(a.a);return d},GN=function(a){var b=DN(a);if(7<b.length)throw new _.J(_.C,3,3002);var c=0;for(var d=0;d<b.length;d++)c=
19
- 256*c+b[d];b=c;c=DN(a);a:{for(e of EN)if(_.Rk(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 _.J(_.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 FN(b,e)},HN=function(a){if(8<a.a.byteLength)throw new _.J(_.C,3,3002);if(8===a.a.byteLength&&
20
- a.a.getUint8(0)&224)throw new _.J(_.C,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},KN=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new IN(a.a);let k=null,l=null;for(;_.Bm(a.a);){var m=GN(a);if(187===m.id){var n=JN(m);n&&(m=c*n.lj,n=b+n.Mi,null!=k&&g.push(new _.BI(g.length,k-f,m-f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.BI(g.length,k-f,d-f,h,l,null,f));return g},JN=function(a){var b=new IN(a.a);a=GN(b);if(179!==a.id)throw _.A("Not a CueTime element."),
21
- new _.J(_.C,3,3013);a=HN(a);b=GN(b);if(183!==b.id)throw _.A("Not a CueTrackPositions element."),new _.J(_.C,3,3012);b=new IN(b.a);let c=0;for(;_.Bm(b.a);){const d=GN(b);if(241===d.id){c=HN(d);break}}return{lj:a,Mi:c}},LN=function(a,b){var c=sN(a,b,"Initialization");if(!c)return null;let d=a.O.qa;b=()=>"";const e=c.getAttribute("sourceURL")||void 0;e&&(d=_.wB(a.O.qa,[e]),b=()=>e);let f=0,g=null;if(c=_.Fn.aa(c,"range",fN))f=c.start,g=c.end;return new _.AI(()=>d,f,g,null,null,b,a.O.Ha)},MN=function(a){return a.Wd},
22
- ON=function(a,b,c,d,e,f,g){const h=a.presentationTimeline,k=!a.Ue||!a.Za.ii,l=a.Za.start,m=a.Za.duration;let n=null;return{createSegmentIndex:function(p,u){return _.v(function*(){var x=[zN(c,d,e,p,u),"webm"===f?zN(b.Da(),b.na,b.ka,p,u):null];x=yield Promise.all(x);var y=x[0];const B=x[1]||null;y="mp4"===f?CN(y,d,c,g):(new NN).parse(y,B,c,g);$M(a.O.contentType)&&_.sC(h,y,l);n=new _.GI(y);k&&_.bC(n,m);return x})},findSegmentPosition:function(p){return n.f(p)},getSegmentReference:function(p){return n.get(p)},
23
- adjustSegmentDurations:function(p,u){return n.h(p,u)},getDuration:function(){return null!=m?m:n.getDuration()},getLastSegmentEndTime:()=>m}},PN=function(a){var b=a.a.o();if(0===b)return null;const c=a.a.w();b=c+b-1;a=Math.max(a.l,c);return a>b?null:{Kb:a,Zb:b}},QN=function(a,b){var c,d=a.a.B(b);if(!d)throw new _.vj(`Cannot get segment timing for source position ${b}`);if(!(0<a.h.length||null!=a.j))return d;var e=b+a.f;var f=c=0;for(const g of a.h)g.position<e?c+=g.ke:g.position===e&&(f+=g.ke);e=c;
24
- c=f;f=d.startTime+e;d=d.endTime+e+c;e=PN(a);a.j&&b===e.Zb&&(d+=a.j);return{startTime:f,endTime:d}},RN=function(a,b){return(a=PN(a))?b>=a.Kb&&b<=a.Zb:!1},SN=function(a){var b=PN(a);if(!b)return null;var c=b.Kb===a.a.w();if(!(0<a.h.length||null!=a.j)&&c)return a.a.C();c=QN(a,b.Kb);b=QN(a,b.Zb);return(a=a.a.C())?{nc:c.startTime,ac:b.endTime,bc:a.bc}:null},TN=function(a,b){if(null===b||Infinity===b)a.g.warn(`Period duration is ${b}. Skipping fit.`);else{var c=PN(a);c?(c=a.a.B(c.Zb),c.startTime>=b||(a.j=
25
- b-c.endTime)):a.g.warn(EM)}},UN=function(a,b){var c=PN(a);if(c){var d=c.Kb;c=c.Zb;for(var e=c+1;d<=c;d++)if(QN(a,d).endTime>b){e=d;break}a.l=e}else a.g.warn(EM)},VN=function(a,b){const c=a.a.o(),d=b.o();if(0===c||0===d)return null;const e=a.a.w(),f=b.w();let g=0,h=0;for(;g<c&&h<d;){const k=e+g,l=f+h,m=a.a.B(k),n=b.B(l);if(!m||!n)break;const p=Math.abs(m.endTime-n.endTime);if(.1>=Math.abs(m.startTime-n.startTime)||.1>=p)return k-l+a.f;m.startTime<n.startTime?g++:h++}return null},WN=function(a,b){if(0===
26
- b.o())a.g.warn("Source is empty. Skipping update.");else{var c=()=>{a.a=b;a.l=b.w();a.h=[];a.j=null};0===a.a.o()&&c();var d=VN(a,b);if(null!=d)a.f=d;else throw a.g.error("Segments could not be updated, overlapping position not found."),new _.J(_.C,4,4014);c()}},YN=function(a,b,c){const d=a.Za.duration;if(!a.Ue)return a=new XN(b),UN(a,0),TN(a,d),a;{var e=a.Ka;const f=a.O;e=e&&e.id&&f&&f.id?`${e.id},${f.id}`:null}if(!a.zg||null==c[e])return a=new XN(b),UN(a,0),TN(a,d),c[e]=a;c=c[e];WN(c,b);UN(c,_.vC(a.presentationTimeline)-
27
- a.Za.start);TN(c,d);return c},$N=function(a){const b=rN(a,ZN,"initialization");if(!b)return null;const c=a.O.id,d=a.bandwidth||null,e=a.O.qa,f=()=>qN(b,c,null,d,null);return new _.AI(function(){const g=f();return _.wB(e,[g])},0,null,null,null,f,a.O.Ha)},aO=function(a,b){const c=b.bf,d=a.Za.duration,e=b.$a,f=b.Nc,g=b.Ve,h=b.timescale,k=a.bandwidth||null,l=a.O.id,m=a.O.qa,n=a.O.Ha;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(p){return 0>p||d&&p>=d?null:Math.floor(p/
28
- e)},getSegmentReference:function(p){const u=p+f;if(null!==g&&u>g)return null;const x=p*e;let y=x+e;d&&(y=Math.min(y,d));if(0>y||d&&x>=d)return null;const B=()=>qN(c,l,u,k,x*h);return new _.BI(p,x,y,function(){const F=B();return _.wB(m,[F])},0,null,b.Tb,null,null,null,null,null,null,null,null,B,n)},adjustSegmentDurations:()=>{},getDuration:()=>d,getLastSegmentEndTime:()=>d}},ZN=function(a){return a.sc},bO=function(a){return a.rc},cO=function(a){return[a.O.rc,a.xa.rc,a.Ka.rc].filter(_.uj).map(b=>_.Fn.a(b,
29
- "SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Ye&&(a.Ye=!0,_.A("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=_.Fn.aa(b,"mediaRange",fN,{start:0,end:null});return{Bg:c,start:b.start,end:b.end}})},eO=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(OM),value:e.getAttribute(_.lg)}));const d=a.a.clockSyncUri;
30
- !c.length&&d&&(a.g.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),c.push({scheme:TM,value:d}));return 0===c.length?(a.g.warn(zM),Promise.reject(Error(zM))):ZM(c,e=>{const f=e.scheme;e=e.value;switch(f){case TM:case "urn:mpeg:dash:utc:http-head:2012":return dO(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 dO(a,
10
+ 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})},vN=function(a,b){var c=sN(a,b,RM);let d=1;c&&(d=iN(c)||1);c=sN(a,b,IM);(c=iN(c||""))&&(c/=d);let e=Number(sN(a,b,OM))||0,f=e/d||0;a.ki&&null!=a.Pd&&a.Pd!==f&&(_.A("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 "+
11
+ `value will be ignored. (Period ID: ${a.Ma.id}, `+`Representation ID: ${a.O.id})`),e=a.Pd*d,f=a.Pd);var g=sN(a,b,"startNumber");let h=jN(g||"");if(null==g||null==h)h=1;g=sN(a,b,"endNumber");g=null!==g?jN(g||""):null;var k=tN(a,b,EM),l=null;if(k){{l=d;var m=e,n=a.$a.duration||Infinity;const y=_.Gn;k=y.a(k,"S");const B=[];var p=0;let F=0;for(let G=0;G<k.length;++G){const D=k[G];var u=y.aa(D,"t",jN);const ka=y.aa(D,"d",jN);var x=y.aa(D,"r",hN);null!=u&&(u-=m);if(!ka){_.A('"S" element must have a duration:',
12
+ MM,D);break}u=null!=u?u:p;x=x||0;if(0>x)if(G+1<k.length){x=y.aa(k[G+1],"t",jN);if(null==x){_.A('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:',MM,D);break}else if(u>=x){_.A('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',MM,D);break}x=Math.ceil((x-u)/ka)-1}else{if(Infinity===n){_.A(GM,"if the Period has an infinite duration:",LM,D);break}else if(u/l>=n){_.A(GM,"if its start time exceeds the Period's duration:",
13
+ LM,D);break}x=Math.ceil((n*l-u)/ka)-1}0<B.length&&u!==p&&(Math.abs((u-p)/l)>=_.nu&&_.A("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",D),B[B.length-1].Bd=u/l);p=x+1;B.push({ne:F,count:p,startTime:u/l,duration:ka/l,jj:u,ij:ka,Bd:null});F+=p;p=u+p*ka}l=new uN(B)}}a=sN(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,ab:c,Nc:h,Ve:g,Ub:f,Jf:e,wa:l,Oe:b}},sN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ma)].filter(_.vj).map(d=>
14
+ d.getAttribute(c)).reduce((d,e)=>d||e)},tN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ma)].filter(_.vj).map(d=>_.Gn.h(d,c)).reduce((d,e)=>d||e)},xN=function(a,b,c,d,e,f){const g=_.Gn,h=g.getAttributeNS(a,KM,"href"),k=g.getAttributeNS(a,KM,"actuate")||"onRequest";g.Ee(a,KM);if(5<=f)return bN(new _.J(_.C,4,4028));if("onLoad"!==k)return bN(new _.J(_.C,4,4027));const l=_.xB([d],[h]);d=_.fk(l,b);d.type=1;return ZM(e.fetch(d),m=>{m=_.wi(m.data);m=g.j(m,a.tagName);if(!m)return bN(new _.J(_.C,4,4001,{uri:h}));
15
+ g.De(a);g.ue(m,a);g.te(m,a);return wN(a,b,c,l[0],e,f+1)})},wN=function(a,b,c,d,e,f){f=void 0===f?0:f;var g=_.Gn;if(g.getAttributeNS(a,KM,"href"))return g=xN(a,b,c,d,e,f),c&&(g=ZM(g,void 0,()=>wN(a,b,c,d,e,f))),g;const h=[],k=g.pe(a);for(const l of k)"urn:mpeg:dash:resolve-to-zero:2013"===g.getAttributeNS(l,KM,"href")?g.removeChild(a,l):l.tagName!==EM&&h.push(wN(l,b,c,d,e,f));return ZM(cN(h),()=>a)},yN=function(a,b){const c=a.$a.start;var d=a.presentationTimeline;d.o||(d.I=Math.floor(Math.max(d.I||
16
+ 0,b.bc+c)));a.zg||_.sC(a.presentationTimeline,{oc:b.oc+c,bc:b.bc+c,cc:b.cc},"notifySegmentSummary")},zN=function(a){return""===a.id?`${a.schemeIdUri}:${a.startTime}:${a.endTime}`:a.id},AN=function(a,b,c,d,e){return _.v(function*(){const f=_.gC(a,b,c,e);f.type=2;return(yield _.hl(d,f,{objectType:"i"}).V).data})},BN=function(a,b){b-=a.h;return 0>b||b>=a.f?null:b},DN=function(a,b,c,d){let e;var f=(new _.Wm).fa("sidx",g=>{e=CN(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=
17
+ c[0];a=_.E(a);_.sh('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.J(_.C,3,3004,{url:g,yj:f,size:a.byteLength,Oj:mN(a)});}},CN=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.P(d.reader);if(0===f)throw _.sh("Invalid timescale."),new _.J(_.C,3,3005);if(0===d.version){var g=_.P(d.reader);var h=_.P(d.reader)}else g=_.Hm(d.reader),h=_.Hm(d.reader);d.reader.skip(2);const k=_.Fm(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.P(d.reader);const m=(l&2147483648)>>>
18
+ 31;l&=2147483647;const n=_.P(d.reader);d.reader.skip(4);if(1===m)throw _.sh("Hierarchical SIDXs are not supported."),new _.J(_.C,3,3006);e.push(new _.CI(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},EN=function(a){var b=_.Em(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.J(_.C,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Em(a.a);return d},HN=function(a){var b=EN(a);if(7<b.length)throw new _.J(_.C,3,3002);var c=0;for(var d=0;d<b.length;d++)c=
19
+ 256*c+b[d];b=c;c=EN(a);a:{for(e of FN)if(_.Sk(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 _.J(_.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 GN(b,e)},IN=function(a){if(8<a.a.byteLength)throw new _.J(_.C,3,3002);if(8===a.a.byteLength&&
20
+ a.a.getUint8(0)&224)throw new _.J(_.C,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},LN=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new JN(a.a);let k=null,l=null;for(;_.Cm(a.a);){var m=HN(a);if(187===m.id){var n=KN(m);n&&(m=c*n.lj,n=b+n.Mi,null!=k&&g.push(new _.CI(g.length,k-f,m-f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.CI(g.length,k-f,d-f,h,l,null,f));return g},KN=function(a){var b=new JN(a.a);a=HN(b);if(179!==a.id)throw _.A("Not a CueTime element."),
21
+ new _.J(_.C,3,3013);a=IN(a);b=HN(b);if(183!==b.id)throw _.A("Not a CueTrackPositions element."),new _.J(_.C,3,3012);b=new JN(b.a);let c=0;for(;_.Cm(b.a);){const d=HN(b);if(241===d.id){c=IN(d);break}}return{lj:a,Mi:c}},MN=function(a,b){var c=tN(a,b,"Initialization");if(!c)return null;let d=a.O.qa;b=()=>"";const e=c.getAttribute("sourceURL")||void 0;e&&(d=_.xB(a.O.qa,[e]),b=()=>e);let f=0,g=null;if(c=_.Gn.aa(c,"range",gN))f=c.start,g=c.end;return new _.BI(()=>d,f,g,null,null,b,a.O.Ia)},NN=function(a){return a.Wd},
22
+ PN=function(a,b,c,d,e,f,g){const h=a.presentationTimeline,k=!a.Ue||!a.$a.ii,l=a.$a.start,m=a.$a.duration;let n=null;return{createSegmentIndex:function(p,u){return _.v(function*(){var x=[AN(c,d,e,p,u),"webm"===f?AN(b.Da(),b.na,b.ka,p,u):null];x=yield Promise.all(x);var y=x[0];const B=x[1]||null;y="mp4"===f?DN(y,d,c,g):(new ON).parse(y,B,c,g);aN(a.O.contentType)&&_.tC(h,y,l);n=new _.HI(y);k&&_.cC(n,m);return x})},findSegmentPosition:function(p){return n.f(p)},getSegmentReference:function(p){return n.get(p)},
23
+ adjustSegmentDurations:function(p,u){return n.h(p,u)},getDuration:function(){return null!=m?m:n.getDuration()},getLastSegmentEndTime:()=>m}},QN=function(a){var b=a.a.o();if(0===b)return null;const c=a.a.w();b=c+b-1;a=Math.max(a.l,c);return a>b?null:{Lb:a,$b:b}},RN=function(a,b){var c,d=a.a.B(b);if(!d)throw new _.wj(`Cannot get segment timing for source position ${b}`);if(!(0<a.h.length||null!=a.j))return d;var e=b+a.f;var f=c=0;for(const g of a.h)g.position<e?c+=g.ke:g.position===e&&(f+=g.ke);e=c;
24
+ c=f;f=d.startTime+e;d=d.endTime+e+c;e=QN(a);a.j&&b===e.$b&&(d+=a.j);return{startTime:f,endTime:d}},SN=function(a,b){return(a=QN(a))?b>=a.Lb&&b<=a.$b:!1},TN=function(a){var b=QN(a);if(!b)return null;var c=b.Lb===a.a.w();if(!(0<a.h.length||null!=a.j)&&c)return a.a.C();c=RN(a,b.Lb);b=RN(a,b.$b);return(a=a.a.C())?{oc:c.startTime,bc:b.endTime,cc:a.cc}:null},UN=function(a,b){if(null===b||Infinity===b)a.g.warn(`Period duration is ${b}. Skipping fit.`);else{var c=QN(a);c?(c=a.a.B(c.$b),c.startTime>=b||(a.j=
25
+ b-c.endTime)):a.g.warn(FM)}},VN=function(a,b){var c=QN(a);if(c){var d=c.Lb;c=c.$b;for(var e=c+1;d<=c;d++)if(RN(a,d).endTime>b){e=d;break}a.l=e}else a.g.warn(FM)},WN=function(a,b){const c=a.a.o(),d=b.o();if(0===c||0===d)return null;const e=a.a.w(),f=b.w();let g=0,h=0;for(;g<c&&h<d;){const k=e+g,l=f+h,m=a.a.B(k),n=b.B(l);if(!m||!n)break;const p=Math.abs(m.endTime-n.endTime);if(.1>=Math.abs(m.startTime-n.startTime)||.1>=p)return k-l+a.f;m.startTime<n.startTime?g++:h++}return null},XN=function(a,b){if(0===
26
+ b.o())a.g.warn("Source is empty. Skipping update.");else{var c=()=>{a.a=b;a.l=b.w();a.h=[];a.j=null};0===a.a.o()&&c();var d=WN(a,b);if(null!=d)a.f=d;else throw a.g.error("Segments could not be updated, overlapping position not found."),new _.J(_.C,4,4014);c()}},ZN=function(a,b,c){const d=a.$a.duration;if(!a.Ue)return a=new YN(b),VN(a,0),UN(a,d),a;{var e=a.Ma;const f=a.O;e=e&&e.id&&f&&f.id?`${e.id},${f.id}`:null}if(!a.zg||null==c[e])return a=new YN(b),VN(a,0),UN(a,d),c[e]=a;c=c[e];XN(c,b);VN(c,_.wC(a.presentationTimeline)-
27
+ a.$a.start);UN(c,d);return c},aO=function(a){const b=sN(a,$N,"initialization");if(!b)return null;const c=a.O.id,d=a.bandwidth||null,e=a.O.qa,f=()=>rN(b,c,null,d,null);return new _.BI(function(){const g=f();return _.xB(e,[g])},0,null,null,null,f,a.O.Ia)},bO=function(a,b){const c=b.bf,d=a.$a.duration,e=b.ab,f=b.Nc,g=b.Ve,h=b.timescale,k=a.bandwidth||null,l=a.O.id,m=a.O.qa,n=a.O.Ia;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(p){return 0>p||d&&p>=d?null:Math.floor(p/
28
+ e)},getSegmentReference:function(p){const u=p+f;if(null!==g&&u>g)return null;const x=p*e;let y=x+e;d&&(y=Math.min(y,d));if(0>y||d&&x>=d)return null;const B=()=>rN(c,l,u,k,x*h);return new _.CI(p,x,y,function(){const F=B();return _.xB(m,[F])},0,null,b.Ub,null,null,null,null,null,null,null,null,B,n)},adjustSegmentDurations:()=>{},getDuration:()=>d,getLastSegmentEndTime:()=>d}},$N=function(a){return a.tc},cO=function(a){return a.sc},dO=function(a){return[a.O.sc,a.xa.sc,a.Ma.sc].filter(_.vj).map(b=>_.Gn.a(b,
29
+ "SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Ye&&(a.Ye=!0,_.A("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=_.Gn.aa(b,"mediaRange",gN,{start:0,end:null});return{Bg:c,start:b.start,end:b.end}})},fO=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(PM),value:e.getAttribute(_.lg)}));const d=a.a.clockSyncUri;
30
+ !c.length&&d&&(a.g.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),c.push({scheme:UM,value:d}));return 0===c.length?(a.g.warn(AM),Promise.reject(Error(AM))):$M(c,e=>{const f=e.scheme;e=e.value;switch(f){case UM:case "urn:mpeg:dash:utc:http-head:2012":return eO(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 eO(a,
31
31
  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(()=>
32
- {a.g.warn(wM);return Promise.reject(Error(wM))})},fO=function(a,b,c,d){return _.v(function*(){const e=_.Fn.a(b,"UTCTiming");try{const f=yield eO(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})},dO=function(a,b,c,d){return _.v(function*(){var e=_.wB(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",
33
- "expected date header"),Error("Date HTTP header missing.");e=e.headers.date}else e=_.vi(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()})},hO=function(a,b){return a.find(c=>gO.get(c.ec)===b)},jO=function(a){const b=_.Fn;var c=b.Wb(a.node,RM,"pro");if(!c)return iO.warn(yM,a),null;c=b.f(c);if(!c)return iO.warn(qM,a),null;a=_.Ok(c);a=_.Kn(a);a=_.Bn(a.a);return{keyId:null,ec:VM,node:b.Sc(),init:[{initData:_.kB(a),
34
- initDataType:_.Vc,keyId:null}]}},kO=function(a,b){b=void 0===b?"4.0.0.0":b;const c=_.Fn;a=c.Wb(a.node,SM,"pssh");if(!a)return null;a=c.f(a);if(!a)return null;a=_.Ok(a);a=_.Dn(a);return a?(b=_.lB(b,a.a))?{keyId:null,ec:UM,node:c.Sc(),init:[{initData:_.kB(b),initDataType:_.Vc,keyId:null}]}:null:(_.A("Unable to parse WV PSSH data. Can not create PR data!"),null)},lO=function(a,b){const c=_.Fn;var d=c.Wb(a.node,RM,"pro");if(!d)return _.A(yM,a),null;d=c.f(d);if(!d)return _.A(qM,a),null;a=_.Ok(d);a=_.Kn(a);
35
- return a.version!==b&&(_.rh(`Parsing from ${a.version} to ${b}.`),a=_.mB(a,b))?{keyId:null,ec:UM,node:c.Sc(),init:[{initData:_.kB(a),initDataType:_.Vc,keyId:null}]}:null},oO=function(a,b,c,d){const e=mO(a);let f=null;a=[];let g=[];const h=hO(e,_.td),k=hO(e,_.rd);if(k&&d){var l=lO(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=jO(k))&&e.push(l);h&&!k&&(d=kO(h,d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.J(_.C,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"===
36
- m.ec?(f=m.init||f,!1):!0),g.length&&(a=nO(f,g,c),0===a.length&&(a=[_.xB(_.Be,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of gO.values())m!==_.Le&&a.push(_.xB(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{xd:b,Bj:f,drmInfos:a,kg:!0}},mO=function(a){const b=[];for(const c of a)(a=pO(c))&&b.push(a);return b},nO=function(a,b,c){const d=[];for(const f of b){var e=gO.get(f.ec);if(e){b=_.xB(e,f.init||a,c);if(e=qO.get(e))(e=e(f))?(b.licenseServerUri=
37
- e.licenseUrl,b.licenseServerUriOrigin=e.origin):b.licenseServerUri="";d.push(b)}}return d},rO=function(a,b,c,d,e){const f=oO(a,c,d,e);if(b.kg){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.xd=f.xd||b.xd;b.kg=!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 _.J(_.C,4,4008);return f.xd||b.xd},sO=function(a){const b=_.Fn;a=
38
- b.Cc(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[cN(a.length)]},pO=function(a){const b=_.Fn;let c=a.getAttribute(OM),d=b.getAttributeNS(a,SM,"default_KID");const e=b.Cc(a,SM,"pssh").map(b.f),f=b.Wb(a,RM,"pro");if(!c)return _.sh("Missing required schemeIdUri attribute on","ContentProtection element",a),null;c=c.toLowerCase();if(d&&(d=d.replace(/-/g,"").toLowerCase(),d.includes(" ")))throw new _.J(_.C,4,4009);let g=[];try{if(g=
39
- e.map(h=>({initDataType:_.Vc,initData:_.Ok(h),keyId:null})),0===g.length&&f&&b.f(f))try{const h=b.f(f),k=_.Ok(h),l=_.Kn(k);g.push({initDataType:_.Vc,initData:_.kB(l),keyId:null})}catch(h){_.A("Unable to parse ms:pro payload",h),g=[]}}catch(h){throw new _.J(_.C,4,4007);}return{node:a,ec:c,keyId:d,init:0<g.length?g:null}},tO=function(a,b,c){if(a.length){c=c||`${"__clpp_baseUriCollection_"}
40
- ${b.length}`;const d=[];a.forEach(e=>{const f=e.getAttribute("serviceLocation");e=_.Fn.f(e);f&&e&&d.push({serviceLocationId:f,uri:e,params:{}})});if(d.length)return a=new _.KI(c,d),b.push(a),a}return null},vO=function(a,b){a=uO(a).filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime());0<a.length&&(a=Math.min(...a),_.qC(b.presentationTimeline,a+b.Za.start))},wO=function(a,b){return _.gC(_.Jl(a,b))?_.I:a.split("/")[0]},uO=function(a){const b=new Set;a.forEach(c=>{c.variants.forEach(d=>
41
- {d.audio&&b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},yO=function(a){return _.v(function*(){var b=a.w?a.w.getBaseUriCollectionById(xM):null;var c=[];b&&(c=_.$C(b,""));0===c.length&&(c=a.o);var d=_.ek(c,a.a.attemptParameters);d.type=1;c=Date.now();d=a.D.networkingEngine.fetch(d);_.vk(a.A,d);var e=yield d.V;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 xO(a,e.data,e.uri);f.manifest.contentSteering&&(a.w=yield a.D.onContentSteeringInfoFound(f.manifest.contentSteering));
42
- if(a.w&&b){0!==e.request.uriIndex&&a.w.banLocation(b.qa[0].serviceLocationId);var g=e.request,h=e.timeMs;e=e.data.byteLength;h&&e&&a.w.notifyThroughput(b.qa[g.uriIndex].serviceLocationId,h,e)}b=(Date.now()-c)/1E3;_.dC(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.hj){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.H(_.ve))}return b})},zO=function(a,b){0>a.l||a.B.la(Math.max(3,a.l-b,_.eC(a.I)))},xO=function(a,b,c){return _.v(function*(){var d=_.vi(b);_.Mn(MM);d=_.Fn.j(d,"MPD");
43
- _.Mn("parse.xml.end");_.On(MM,MM,"parse.xml.end");if(!d)throw new _.J(_.C,4,4001,c);d=vN(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.vk(a.A,d);d=yield d.V;return AO(a,d,c)})},AO=function(a,b,c){return _.v(function*(){var d=_.Fn;const e=[];var f=[c],g=d.a(b,xM),h=g.map(d.f).filter(_.uj);0<h.length&&(f=_.wB(f,h),a.o=f,tO(g,e,xM));g=d.a(b,rM);h=g.map(d.f);var k=_.wB(f,h);tO(g,e,rM);f=b.getAttribute("type")||PM;a.l=d.aa(b,"minimumUpdatePeriod",eN,-1);f===PM&&0<=a.l&&(a.g.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),
44
- a.l=-1,a.B.stop());g=d.aa(b,"maxSegmentDuration",eN);if(d=f===PM&&"dynamic"===a.C)a.g.info("MPD dynamic to static transition."),f="dynamic";h=f===PM;var l="dynamic"===f;if(a.f)var m=a.f.presentationTimeline;else{var n=_.Fn;m=a.a.timeline||{};var p=n.aa(b,"suggestedPresentationDelay",eN),u=n.aa(b,"minBufferTime",eN,0);p=null!=a.a.suggestedPresentationDelay?a.a.suggestedPresentationDelay:a.a.lowLatencyMode?0:null!=p?p:3*u;n=n.aa(b,"availabilityStartTime",dN);m=new _.FI(m,n,p,h,!!a.a.autoCorrectDrift,
45
- !!a.a.lowLatencyMode);m=h?m:fO(a.J,b,k,m)}m=yield m;n=_.Fn.aa(b,"timeShiftBufferDepth",eN);n=l&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)?a.a.availabilityWindowOverride:null===n?Infinity:n;m.A=n;if(!a.D)throw new _.J(_.C,7,7001);n={Ue:l,zg:null!=a.f,presentationTimeline:m,Ka:null,Za:null,xa:null,O:null,bandwidth:0,Ye:!1,ki:d,gc:null,Pd:null};k=BO(a,n,k,e,b);p=k.duration;l=k.periods;d&&(vO(l,n),m.C=!0);if(h||!d&&!k.hg)m.f=p||Infinity;if(2===a.a.timeline.version){h=p;n=
46
- l[0].startTime;if(null==h||Infinity===h)h=CO(l);p=m.a;_.kC(p,n,n+h);d&&(p.f=!0)}_.tC(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=_.Fn;if(m=l.h(b,"ContentSteering"))if(g=m.getAttribute("defaultServiceLocation")||"",h=l.f(m)){l=l.aa(m,"queryBeforeStart",kN,!1);g={manifestType:_.tc,contentSteeringServerUri:h,defaultServiceLocation:g,queryBeforeStart:l||!1,baseUriCollections:[]};break a}g=null}g&&
47
- (a.f.contentSteering=g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,hj:d}})},BO=function(a,b,c,d,e){const f=_.Fn,g=f.aa(e,"mediaPresentationDuration",eN),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 x=0;x<e.length;x++){var n=e[x];m=f.aa(n,_.Kf,eN,m);var p=f.aa(n,HM,eN);let y=null;if(x!==e.length-1){var u=f.aa(e[x+1],_.Kf,eN);null!=u&&(y=u-m)}else null!=g&&(y=g-m);u=_.mu;y&&p&&Math.abs(y-p)>u&&a.g.warn("There is a gap/overlap between Periods",
48
- n);null==y&&(y=p);n=DO(a,b,c,d,{start:m,duration:y,node:n,ii:null==y||x===e.length-1});p=n.Ka;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){x!==e.length-1&&a.g.warn("Skipping Period",x+1,"and any subsequent Periods:","Period",x+1,"does not have a valid start time.",l[x+1]);m=null;break}m+=y}null==a.f&&a.D.filterAllPeriods(l);h&&(b=l.find(x=>x.id===h.id))&&(h.endTime=b.endTime);k=EO(a,k);return null!=g?(m!==g&&a.g.warn("@mediaPresentationDuration does not match the total duration of ",
49
- "all Periods."),{periods:l,duration:g,hg:!1,cues:k}):{periods:l,duration:m,hg:!0,cues:k}},CO=function(a){return a.map(b=>b.variants[0].video||b.variants[0].audio).reduce((b,c)=>c?c.getDuration():0+b,0)},DO=function(a,b,c,d,e){var f=_.Fn;b.Ka=FO(a,e.node,null,c,d);b.Za=e;c=b.Ka.id||`__clpp_period_${e.start}`;b.Ka.id||(a.g.info("No Period ID given for Period with start time "+e.start+`, Assigning a default: ${c}.`),b.Ka.id=c);d=f.a(e.node,"EventStream").flatMap(B=>GO(a,e.start,e.duration,B));f=f.a(e.node,
50
- _.ha).map(B=>HO(a,b,B)).filter(_.uj);if(b.Ue){var g=[];for(var h of f)for(var k of h.Oi)g.push(k);if(g.length!==(new Set(g)).size)throw new _.J(_.C,4,4018);}h=f.filter(B=>!B.Hf);k=f.filter(B=>B.Hf);for(var l of k){l.streams.forEach(B=>{B.trickPlay=!0});k=l.streams[0];g=l.Hf;for(var m of h)if(g.includes(m.id))for(var n of m.streams)n.trickModeVideo=k}m=IO(f,_.t);n=IO(h,_.q);if(!m.length&&!n.length)throw new _.J(_.C,4,4004);n.length||(n=[null]);m.length||(m=[null]);l=[];for(var p of n)for(var u of m)JO(a,
51
- p,u,l);u=[...IO(h,_.I),...IO(h,_.dB)];p=[];for(var x of u)p.push.apply(p,x.streams);u=IO(h,_.ae);x=[];for(var y of u)x.push.apply(x,y.streams);y=KO(e,h);return{Ka:{id:c,configurationId:a.D.configurationId,startTime:e.start,endTime:y,textStreams:p,thumbStreams:x,variants:l},cues:d}},EO=function(a,b){const c=new Set(b.map(yN));a.j.forEach((d,e)=>{c.has(e)||a.j.delete(e)});b.forEach(d=>{const e=yN(d);a.j.has(e)||a.j.set(e,d)});return Array.from(a.j.values())},FO=function(a,b,c,d,e){const f=_.Fn;c=c||
52
- {contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,cf:null,Ha:e?e.find(u=>u.id===rM)||null:null};d=d||c.qa;var g=f.a(b,rM);const h=g.map(f.f);e=e?tO(g,e,b.getAttribute("id")||void 0):null;g=b.getAttribute("contentType")||c.contentType;const k=b.getAttribute(_.se)||c.mimeType,l=b.getAttribute(_.md)||c.codecs,m=f.aa(b,"frameRate",jN)||c.frameRate,n=LO(f.a(b,"InbandEventStream"),c.emsgSchemeIdUris),p=f.a(b,"AudioChannelConfiguration");a=MO(a,p)||c.cf;g||(g=wO(k,l));return{qa:_.wB(d,
53
- h),Ha:e||c.Ha,Wd:f.h(b,"SegmentBase")||c.Wd,rc:f.h(b,"SegmentList")||c.rc,sc:f.h(b,"SegmentTemplate")||c.sc,width:f.aa(b,_.Gg,iN)||c.width,height:f.aa(b,_.Xd,iN)||c.height,contentType:g,mimeType:k,codecs:l,frameRate:m,emsgSchemeIdUris:n,id:b.getAttribute("id")||"",cf:a}},GO=function(a,b,c,d){const e=_.Fn,f=d.getAttribute(OM)||"",g=d.getAttribute(_.lg)||"",h=e.aa(d,QM,iN)||1,k=e.aa(d,NM,iN)||0,l=[];for(const n of e.a(d,"Event")){d=e.aa(n,"presentationTime",iN)||0;var m=e.aa(n,HM,iN)||0;d=b+d/h-k/h;
54
- m=d+m/h;null!=c&&(d=Math.min(d,b+c),m=Math.min(m,b+c));let p=_.fg;f.startsWith(_.hg)?p=_.bj:"urn:mpeg:dash:event:callback:2015"===f&&(p=_.we);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===_.we&&(u.xe=()=>{if(u.eventElement){var x=u.eventElement.getAttribute("messageData")||"";x&&x.startsWith("http")&&(x=_.ek(x),x.type=_.dk,a.D.networkingEngine.fetch(x))}});l.push(u)}return l},HO=function(a,
55
- b,c){var d=_.Fn;b.xa=FO(a,c,b.Ka,null,null);var e=b.xa.contentType===_.I;const f=NO(c),{kind:g,Rd:h,roles:k}=OO(c,e);let l=null;try{l=PO(c)}catch(y){return null}const m=d.a(c,"Accessibility"),n=QO(m);var p=d.a(c,tM);const u=oO(p,a.a.ignoreDrmInfo,b.Ka.id,a.a.playreadyVersion||null),x=c.getAttribute("lang")||_.eg;p=_.Tj(x);d=d.a(c,_.kb);c=d.map(y=>RO(a,b,u,g,x,f||"",h,k,n,y)).filter(_.uj);if(0===c.length){if(e)return null;throw new _.J(_.C,4,4003);}if(!b.xa.contentType||b.xa.contentType===GM){b.xa.contentType=
56
- wO(c[0].mimeType,c[0].codecs);for(const y of c)y.type=b.xa.contentType}for(const y of c)for(const B of u.drmInfos)y.keyId&&!B.keyIds.includes(y.keyId)&&B.keyIds.push(y.keyId);c=SO(c,b.xa.contentType,m);e=d.map(y=>y.getAttribute("id")).filter(_.uj);return{id:b.xa.id||"__fake__"+a.h++,contentType:b.xa.contentType,language:p,originalLanguage:x,Rd:h,streams:c,drmInfos:u.drmInfos,Hf:l,Oi:e}},IO=function(a,b){return a.filter(c=>c.contentType===b)},JO=function(a,b,c,d){if(b||c)if(b&&c){if(_.BB(b.drmInfos,
57
- 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.Rd||c.Rd,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||_.eg,primary:f.Rd,audio:b?e:null,video:c?e:null,bandwidth:g,drmInfos:f.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(g)}},
58
- KO=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},NO=function(a){let b=null;const c=_.Fn.a(a,"Label").map(_.Fn.f).filter(_.uj);c&&0<c.length&&(b=c[c.length-1]);null==b&&(b=a.getAttribute("label"));return b},OO=function(a,b){let c=!1;const d=_.Fn.a(a,"Role");a=d.map(f=>f.getAttribute(_.lg)).filter(_.uj);
59
- let e=void 0;b&&(e=_.dB);for(const f of d)if(b=f.getAttribute(OM),null==b||"urn:mpeg:dash:role:2011"===b||"urn:mpeg:dash:role"===b)switch(b=f.getAttribute(_.lg),b){case _.ne:c=!0;break;case _.MA:case _.dB:e=b;break;case "forced-subtitle":case "forced_subtitle":case _.Ud:e=_.Ud}return{Rd:c,roles:a,kind:e}},PO=function(a){var b=_.Fn.a(a,vM);a=null;for(const c of b){b=c.getAttribute(OM)||"";const d=c.getAttribute(_.lg);if(b!==IM&&!TO.includes(b)||void 0===d)throw new _.vj("Unrecognized essential property");
60
- b===IM&&(a=d.split(" "))}return a},QO=function(a){const b=new Map;for(const e of a)if(a=e.getAttribute(OM),"urn:scte:dash:cc:cea-608:2015"===a||"urn:scte:dash:cc:cea-708:2015"===a){a=1;var c=e.getAttribute(_.lg);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,_.Tj(d))}else b.set("CC1",_.eg)}return b},RO=function(a,b,c,d,e,f,g,h,k,l){const m=_.Fn,n=_.Tj(e);
61
- b.O=FO(a,l,b.xa,null,null);if(!UO(a,b.O))return a.g.warn("Skipping Representation",b.O),null;b.gc=`${b.Ka.id} ${b.O.id}`;b.Pd=a.F.get(b.gc);b.bandwidth=m.aa(l,"bandwidth",hN)||0;const p=VO(a,b);if(!p)return null;a.F.set(b.gc,p.La);var u=m.a(l,tM);a=rO(u,c,a.a.ignoreDrmInfo,b.Ka.id,a.a.playreadyVersion||null);u=!1;m.a(l,"SupplementalProperty").some(x=>"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===x.getAttribute(OM)&&"JOC"===x.getAttribute(_.lg))&&(b.O.mimeType="audio/eac3-joc",u=!0);l=WO(b,l);
62
- return{id:_.CI++,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:_.TA,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,
63
- 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.cf,spatialAudio:u,closedCaptions:k,horizontalTiles:l.horizontalTiles,verticalTiles:l.verticalTiles,durationPerTile:l.durationPerTile}},SO=function(a,b,c){const d=b===_.dB?_.I:b;b=c.map(e=>({scheme:e.getAttribute(OM)||"",id:e.getAttribute("id")||void 0,value:e.getAttribute(_.lg)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=
64
- b;return a},UO=function(a,b){let c;c=b.Wd?1:0;c+=b.rc?1:0;c+=b.sc?1:0;if(0===c){if(b.contentType===_.I||b.contentType===GM)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.",
65
- b),b.Wd?(a.g.info("Using SegmentBase by default."),b.rc=null):a.g.info("Using SegmentList by default."),b.sc=null);return!0},VO=function(a,b){var c=b.O.contentType;c=c===_.I||c===GM;try{if(b.O.Wd){{const F=Number(rN(b,MN,NM))||0,G=rN(b,MN,QM);var d=1;G&&(d=hN(G)||1);var e=F/d||0,f=LN(b,MN);{d=f;var g=e;const D=b.O.mimeType.split("/")[1];if(b.O.contentType!==_.I&&"mp4"!==D&&"webm"!==D)throw _.sh("SegmentBase specifies an unsupported container type.",b.O),new _.J(_.C,4,4006);if("webm"===D&&!d)throw _.sh(AM,
66
- "the SegmentBase uses a WebM container,","but does not contain an Initialization element.",b.O),new _.J(_.C,4,4005);const ka=sN(b,MN,"RepresentationIndex"),Da=rN(b,MN,"indexRange");let Xa=b.O.qa,Hb=fN(Da||"");if(ka){const tb=ka.getAttribute("sourceURL");tb&&(Xa=_.wB(b.O.qa,[tb]));Hb=_.Fn.aa(ka,"range",fN,Hb)}if(!Hb)throw _.sh(AM,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",b.O),new _.J(_.C,4,4002);$M(b.O.contentType)&&(b.presentationTimeline.B=null);var h=ON(b,
67
- d,Xa,Hb.start,Hb.end,D,g)}var k={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:f,getLastSegmentEndTime:h.getLastSegmentEndTime,La:e}}}else{if(b.O.rc){{var l=a.H;const F=LN(b,bO);{const ka=cO(b),Da=uN(b,bO);let Xa=Da.Nc;0===Xa&&(_.A("SegmentList@startNumber must be \x3e 0"),Xa=1);h=0;Da.$a?h=Da.$a*(Xa-1):Da.wa&&0<Da.wa.a&&(h=Da.wa.j);
68
- var m={$a:Da.$a,startTime:h,Nc:Xa,Tb:Da.Tb,wa:Da.wa,Lc:ka}}if(!m.$a&&!m.wa&&1<m.Lc.length)throw _.A(BM,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",b.O),new _.J(_.C,4,4002);if(!m.$a&&!b.Za.duration&&!m.wa&&1===m.Lc.length)throw _.A(BM,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",b.O),new _.J(_.C,4,4002);if(m.wa&&0===m.wa.a)throw _.A(BM,"the SegmentList has an empty timeline.",
69
- b.O),new _.J(_.C,4,4002);{let ka=m.Lc.length;m.wa&&m.wa.a!==m.Lc.length&&(ka=Math.min(m.wa.a,m.Lc.length),_.A("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",m.Lc.length,"to",ka));var n=ka}const G=new XO(m,b.O.qa,b.O.Ha,b.Za.duration,n),D=YN(b,G,l);if($M(b.O.contentType)){const ka=SN(D);ka&&xN(b,ka)}d={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:D.findSegmentPosition.bind(D),getSegmentReference:D.getSegmentReference.bind(D),
70
- adjustSegmentDurations:D.adjustSegmentDurations.bind(D),getDuration:D.getDuration.bind(D),initSegmentReference:F,getLastSegmentEndTime:D.getLastSegmentEndTime.bind(D),La:m.Tb}}}else{if(b.O.sc){{var p=a.H,u=!!a.f;const F=$N(b);{const D=uN(b,ZN),ka=rN(b,ZN,"media"),Da=rN(b,ZN,"index");e={$a:D.$a,timescale:D.timescale,Nc:D.Nc,Ve:D.Ve,Tb:D.Tb,Jf:D.Jf,wa:D.wa,bf:ka,Md:Da,Oe:D.Oe}}{let D;D=e.Md?1:0;D+=e.wa?1:0;D+=e.$a?1:0;if(0===D)throw _.sh("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template",
71
- "a SegmentTimeline, or a segment duration.",b.O),new _.J(_.C,4,4002);1!==D&&(_.A("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",b.O),e.Md?(_.qh("Using the index URL template by default."),e.wa=null):_.qh("Using the SegmentTimeline by default."),e.$a=null);if(!e.Md&&!e.bf)throw _.sh(CM,"the SegmentTemplate's media URL template is missing.",b.O),new _.J(_.C,4,4002);}const G=
72
- $M(b.O.contentType);h=null;if(e.Md){G&&(b.presentationTimeline.B=null);{f=F;const D=b.O.mimeType.split("/")[1];if("mp4"!==D&&"webm"!==D)throw _.sh("SegmentTemplate specifies an unsupported container type.",b.O),new _.J(_.C,4,4006);if("webm"===D&&!f)throw _.sh(CM,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",b.O),new _.J(_.C,4,4005);const ka=qN(e.Md,b.O.id,null,b.bandwidth||null,null),Da=_.wB(b.O.qa,[ka]);h=ON(b,f,Da,0,null,D,e.Tb)}}else if(e.$a){if(!u&&
73
- G){b.presentationTimeline.B=null;var x=b.presentationTimeline;x.G=Math.max(x.G,e.Oe);x.g.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+x.G);_.tC(b.presentationTimeline,e.$a);var y=b.presentationTimeline,B=b.Za.start;y.l=null==y.l?B:Math.min(y.l,B)}h=aO(b,e)}else{const D=YN(b,new YO(e,b.O.id,b.bandwidth||null,b.O.qa,b.O.Ha),p);if(G){const ka=SN(D);ka&&xN(b,ka)}h={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:D.findSegmentPosition.bind(D),getSegmentReference:D.getSegmentReference.bind(D),
74
- adjustSegmentDurations:D.adjustSegmentDurations.bind(D),getDuration:D.getDuration.bind(D),getLastSegmentEndTime:D.getLastSegmentEndTime.bind(D)}}g={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:F,getLastSegmentEndTime:h.getLastSegmentEndTime,La:e.Tb}}}else g=ZO(b);d=g}k=d}return k}catch(F){if(c&&4002===F.code)return a.g.debug("Ignoring DASH_NO_SEGMENT_INFO error in a text stream",
75
- F),null;throw F;}},WO=function(a,b){const c={};if(a.O.contentType===_.ae){var d=(b=_.Fn.h(b,vM))&&b.getAttribute(OM);d=d||"";$O.includes(d)&&(b=_.zB(b.getAttribute(_.lg)||""))&&(c.horizontalTiles=b.Jd,c.verticalTiles=b.ae,a.xa.sc&&(d=_.Fn.aa(a.xa.sc,HM,iN)||0,a=_.Fn.aa(a.xa.sc,QM,iN)||1,a=d/a))&&(c.durationPerTile=a/b.dj)}return c},ZO=function(a){const b=a.O.qa,c=a.Za.duration||0,d=()=>c;return{createSegmentIndex:()=>Promise.resolve(),findSegmentPosition:e=>0<=e&&e<c?1:null,getSegmentReference:e=>
76
- 1!==e?null:new _.BI(1,0,c,()=>b,0,null,0,null,null,null,null,null,null,null,null,()=>"",a.O.Ha),adjustSegmentDurations:()=>{},getDuration:d,getLastSegmentEndTime:d,verticalTiles:void 0,horizontalTiles:void 0,initSegmentReference:null,La:0}},LO=function(a,b){b=b.slice();for(const c of a)(a=c.getAttribute(OM))&&!b.includes(a)&&b.push(a);return b},MO=function(a,b){for(const d of b){b=d.getAttribute(OM);if(!b)continue;const e=d.getAttribute(_.lg);if(e)switch(b){case "urn:mpeg:dash:outputChannelPositionList:2012":return e.trim().split(/ +/).length;
77
- 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(sM,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(sM,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};_.ev.prototype.Zd=WM(19,function(a){return a});
78
- _.QB.prototype.Zd=WM(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}/>`,_.Uf).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});
79
- _.ev.prototype.Ee=WM(17,function(a,b){Array.from(a.attributes).forEach(c=>{c.namespaceURI===b&&a.removeAttributeNS(c.namespaceURI,c.localName)})});_.QB.prototype.Ee=WM(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]})}});_.ev.prototype.te=WM(15,function(a,b){for(const c of a.attributes)b.setAttributeNS(c.namespaceURI,c.nodeName,c.value)});
80
- _.QB.prototype.te=WM(14,function(a,b){Object.keys(a.attributes).forEach(c=>{b.attributes[c]=a.attributes[c]})});_.ev.prototype.ue=WM(13,function(a,b){Array.from(a.childNodes).forEach(c=>{a.removeChild(c);b.appendChild(c)})});_.QB.prototype.ue=WM(12,function(a,b){b.childNodes.push(...a.childNodes);a.childNodes=[]});_.ev.prototype.De=WM(11,function(a){Array.from(a.childNodes).forEach(b=>{a.removeChild(b)})});_.QB.prototype.De=WM(10,function(a){a.childNodes=[]});_.ev.prototype.Sc=WM(9,function(){return document.createElement("null")});
81
- _.QB.prototype.Sc=WM(8,function(){return new _.OB("NULL",null,{},[],null,null,new Map)});_.ev.prototype.pe=WM(7,function(a){return Array.from(a.childNodes).filter(b=>b instanceof Element)});_.QB.prototype.pe=WM(6,function(a){return a.childNodes});_.ev.prototype.aa=WM(5,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});_.QB.prototype.aa=WM(4,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});
82
- _.ev.prototype.Cc=WM(3,function(a,b,c){return Array.from(a.childNodes).filter(d=>d instanceof Element&&d.localName===c&&d.namespaceURI===b)});_.QB.prototype.Cc=WM(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)});_.ev.prototype.Wb=WM(1,function(a,b,c){a=this.Cc(a,b,c);return 1!==a.length?null:a[0]});_.QB.prototype.Wb=WM(0,function(a,b,c){a=this.Cc(a,b,c);return 1!==a.length?null:a[0]});var XO=class{constructor(a,b,c,d,e){this.l=a.Nc;this.j=e;this.I=a.Lc;this.a=a.startTime;this.h=a.$a;this.f=a.wa;this.H=a.Tb;this.G=b;this.F=c;this.A=d;this.g=new _.S("clpp.dash.SegmentListSource")}o(){return this.j}w(){return this.l}B(a){a=mN(this,a);return null==a?null:null!=this.h?(a=this.a+a*this.h,{startTime:a,endTime:a+this.h}):this.f?(a=oN(this.f,a),{startTime:a.startTime,endTime:a.endTime}):null==this.A?(this.g.warn(uM),null):{startTime:this.a,endTime:this.a+this.A}}findSegmentPosition(a){return 0<
83
- this.j?a<this.a?this.l:null!=this.h?(a=this.l+Math.floor((a-this.a)/this.h),a>this.l+this.j-1?null:a):this.f?(a=pN(this.f,a),null==a?null:this.l+a):null==this.A?(this.g.warn(uM),null):a<this.a+this.A?this.l:null:null}getSegmentReference(a,b){const c=mN(this,a);if(null==c)return null;b=null==b?a:b;a=this.B(a);if(null==a)return null;const d=this.I[c],e=_.wB(this.G,[d.Bg]);return new _.BI(b,a.startTime,a.endTime,()=>e,d.start,d.end,this.H,null,null,null,null,null,null,null,null,()=>d.Bg,this.F)}C(){return 0<
84
- this.j?null!=this.h?{nc:this.a,ac:this.a+this.j*this.h,bc:this.h}:this.f?{nc:oN(this.f,0).startTime,ac:oN(this.f,this.j-1).endTime,bc:this.f.h}:null==this.A?null:{nc:this.a,ac:this.a+this.A,bc:this.A}:null}};var tN=class{constructor(a){this.f=a;this.a=a.reduce((b,c)=>b+c.count,0);this.j=0<this.a?a[0].startTime:0;this.h=nN(a)}};var $O=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],TO=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var YO=class{constructor(a,b,c,d,e){const f=a.wa;this.h=a.Nc;this.f=f.a;this.a=f;this.G=a.bf;this.H=b;this.j=c;this.A=d;this.l=e;this.F=a.Tb;this.I=a.Jf}o(){return this.f}w(){return this.h}B(a){a=AN(this,a);if(null==a)return null;a=oN(this.a,a);return{startTime:a.startTime,endTime:a.endTime}}findSegmentPosition(a){if(!(0<this.f))return null;a=pN(this.a,a);return null==a?null:this.h+a}getSegmentReference(a,b){var c=AN(this,a);if(null==c)return null;b=null==b?a:b;c=oN(this.a,c);const d=c.kj+this.I,
85
- e=()=>qN(this.G,this.H,a,this.j,d);return new _.BI(b,c.startTime,c.endTime,()=>{const f=e();return _.wB(this.A,[f])},0,null,this.F,null,null,null,null,null,null,null,null,e,this.l)}C(){return 0<this.f?{nc:oN(this.a,0).startTime,ac:oN(this.a,this.f-1).endTime,bc:this.a.h}:null}};var IN=class{constructor(a){this.f=a;this.a=new _.Cn(a,!1)}},EN=[[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]],FN=class{constructor(a,b){this.id=a;this.a=b}};var NN=class{parse(a,b,c,d){var e;b=new IN(new DataView(b));if(440786851!==GN(b).id)throw _.sh("Not an EBML element."),new _.J(_.C,3,3008);var f=GN(b);if(408125543!==f.id)throw _.sh("Not a Segment element."),new _.J(_.C,3,3009);b=f.a.byteOffset;f=new IN(f.a);for(e=null;_.Bm(f.a);){var g=GN(f);if(357149030===g.id){e=g;break}}if(!e)throw _.sh("Not an Info element."),new _.J(_.C,3,3010);e=new IN(e.a);g=1E6;for(f=null;_.Bm(e.a);){const h=GN(e);if(2807729===h.id)g=HN(h);else if(17545===h.id)if(f=h,4===
86
- f.a.byteLength)f=f.a.getFloat32(0);else if(8===f.a.byteLength)f=f.a.getFloat64(0);else throw new _.J(_.C,3,3003);}if(null==f)throw new _.J(_.C,3,3011);e=g/=1E9;f*=g;a=GN(new IN(new DataView(a)));if(475249515!==a.id)throw _.sh("Not a Cues element."),new _.J(_.C,3,3007);return KN(a,b,e,f,c,d)}};var XN=class{constructor(a){this.a=a;this.f=0;this.l=0<a.o()?a.w():0;this.h=[];this.j=null;this.g=new _.S("clpp.dash.SegmentSourceAdapter")}findSegmentPosition(a){const b=PN(this);if(!b)return null;if(!(0<this.h.length||null!=this.j))return a=this.a.findSegmentPosition(a),null==a||a>b.Zb?null:a<b.Kb?b.Kb+this.f:a+this.f;for(var c=b.Zb;c>=b.Kb;c--){const d=QN(this,c);if(a>=d.startTime&&a<d.endTime)return c+this.f}c=QN(this,b.Kb);return a<c.startTime?b.Kb+this.f:null}getSegmentReference(a){var b=a-
87
- this.f;if(!RN(this,b))return null;a=this.a.getSegmentReference(b,a);if(!a)return null;b=QN(this,b);return new _.BI(a.position,b.startTime,b.endTime,a.Da,a.na,a.ka,a.La,a.keyInfo,a.Vc,a.timescale,a.horizontalTiles,a.verticalTiles,a.durationPerTile,a.a,a.initSegment,a.$c,a.Ha)}adjustSegmentDurations(a,b){if(RN(this,a-this.f)){this.g.warn(`Adjusting segment duration by drift ${b} at ${a}`);var c=this.h.find(d=>d.position===a);c?c.ke+=b:this.h.push({position:a,ke:b})}}getDuration(){const a=PN(this);if(!a)return 0;
88
- const b=QN(this,a.Kb);return QN(this,a.Zb).endTime-b.startTime}getLastSegmentEndTime(){const a=PN(this);return a?QN(this,a.Zb).endTime:0}};var aP=class{constructor(a,b){this.g=a;this.f=b;this.a={clockSyncUri:void 0}}};var gO=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Le).set(VM,_.td).set(UM,_.rd).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.rd).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.pd).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.od),qO=(new Map).set(_.td,function(a){const b=sO(a);if(b)return{licenseUrl:b,origin:_.RA};if(a=_.Fn.Wb(a.node,"urn:microsoft","laurl"))if(a=a.getAttribute("licenseUrl"))return{licenseUrl:a,origin:"ms:laurl"};return null}).set(_.rd,
89
- function(a){var b=_.Fn;const c=sO(a);if(c)return{licenseUrl:c,origin:_.RA};a=b.Wb(a.node,RM,"pro");if(!a)return null;b=b.f(a);if(!b)return null;b=_.Ok(b);return(b=_.Kn(b).h)?{licenseUrl:b,origin:"mspr:pro"}:null}),iO=new _.S("clpp.dash.ContentProtection");var bP=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 _.DI(5);this.B=new _.Jh(()=>{this.dc()});this.A=new _.qu;this.j=new Map;this.g=new _.S("clpp.dash.DashParser");this.C=null;this.J=new aP(this.g,(a,b)=>{a=_.ek(a,this.a.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.vk(this.A,b);return b.V});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=
90
- this;return _.v(function*(){c.o=[a];c.D=b;const d=yield yO(c);c.D&&zO(c,d);if(!c.D)throw new _.J(_.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(){yO(this).catch(a=>{if(this.D&&a)this.D.onError(a)})}setCurrentVariant(){}dc(){const a=this;return _.v(function*(){a.g.debug(_.HA);let b=0;try{b=yield yO(a)}catch(c){if(a.D&&c.a&&(a.D.onError(c),
91
- c.severity===_.C))return}a.D&&(a.K?yield a.stop():zO(a,b))})}loadVariant(a){return _.v(function*(){return a})}loadTextStream(a,b){const c=this;return _.v(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 _.vj(`Could not load text stream with id: ${a}`);return d})}};_.w("clpp.dash.DashComponent",class extends _.Ev{install(){_.Mt.mpd=bP;_.Lt[_.tc]=bP}uninstall(){_.XC("mpd");_.YC(_.tc)}id(){return"dash"}});};f.call(g, window);
32
+ {a.g.warn(xM);return Promise.reject(Error(xM))})},gO=function(a,b,c,d){return _.v(function*(){const e=_.Gn.a(b,"UTCTiming");try{const f=yield fO(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})},eO=function(a,b,c,d){return _.v(function*(){var e=_.xB(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",
33
+ "expected date header"),Error("Date HTTP header missing.");e=e.headers.date}else e=_.wi(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()})},iO=function(a,b){return a.find(c=>hO.get(c.fc)===b)},kO=function(a){const b=_.Gn;var c=b.Xb(a.node,SM,"pro");if(!c)return jO.warn(zM,a),null;c=b.f(c);if(!c)return jO.warn(rM,a),null;a=_.Pk(c);a=_.Ln(a);a=_.Cn(a.a);return{keyId:null,fc:WM,node:b.Sc(),init:[{initData:_.lB(a),
34
+ initDataType:_.Vc,keyId:null}]}},lO=function(a,b){b=void 0===b?"4.0.0.0":b;const c=_.Gn;a=c.Xb(a.node,TM,"pssh");if(!a)return null;a=c.f(a);if(!a)return null;a=_.Pk(a);a=_.En(a);return a?(b=_.mB(b,a.a))?{keyId:null,fc:VM,node:c.Sc(),init:[{initData:_.lB(b),initDataType:_.Vc,keyId:null}]}:null:(_.A("Unable to parse WV PSSH data. Can not create PR data!"),null)},mO=function(a,b){const c=_.Gn;var d=c.Xb(a.node,SM,"pro");if(!d)return _.A(zM,a),null;d=c.f(d);if(!d)return _.A(rM,a),null;a=_.Pk(d);a=_.Ln(a);
35
+ return a.version!==b&&(_.rh(`Parsing from ${a.version} to ${b}.`),a=_.nB(a,b))?{keyId:null,fc:VM,node:c.Sc(),init:[{initData:_.lB(a),initDataType:_.Vc,keyId:null}]}:null},pO=function(a,b,c,d){const e=nO(a);let f=null;a=[];let g=[];const h=iO(e,_.td),k=iO(e,_.rd);if(k&&d){var l=mO(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=kO(k))&&e.push(l);h&&!k&&(d=lO(h,d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.J(_.C,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"===
36
+ m.fc?(f=m.init||f,!1):!0),g.length&&(a=oO(f,g,c),0===a.length&&(a=[_.yB(_.Be,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of hO.values())m!==_.Le&&a.push(_.yB(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{xd:b,Bj:f,drmInfos:a,kg:!0}},nO=function(a){const b=[];for(const c of a)(a=qO(c))&&b.push(a);return b},oO=function(a,b,c){const d=[];for(const f of b){var e=hO.get(f.fc);if(e){b=_.yB(e,f.init||a,c);if(e=rO.get(e))(e=e(f))?(b.licenseServerUri=
37
+ e.licenseUrl,b.licenseServerUriOrigin=e.origin):b.licenseServerUri="";d.push(b)}}return d},sO=function(a,b,c,d,e){const f=pO(a,c,d,e);if(b.kg){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.xd=f.xd||b.xd;b.kg=!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 _.J(_.C,4,4008);return f.xd||b.xd},tO=function(a){const b=_.Gn;a=
38
+ b.Dc(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[dN(a.length)]},qO=function(a){const b=_.Gn;let c=a.getAttribute(PM),d=b.getAttributeNS(a,TM,"default_KID");const e=b.Dc(a,TM,"pssh").map(b.f),f=b.Xb(a,SM,"pro");if(!c)return _.sh("Missing required schemeIdUri attribute on","ContentProtection element",a),null;c=c.toLowerCase();if(d&&(d=d.replace(/-/g,"").toLowerCase(),d.includes(" ")))throw new _.J(_.C,4,4009);let g=[];try{if(g=
39
+ e.map(h=>({initDataType:_.Vc,initData:_.Pk(h),keyId:null})),0===g.length&&f&&b.f(f))try{const h=b.f(f),k=_.Pk(h),l=_.Ln(k);g.push({initDataType:_.Vc,initData:_.lB(l),keyId:null})}catch(h){_.A("Unable to parse ms:pro payload",h),g=[]}}catch(h){throw new _.J(_.C,4,4007);}return{node:a,fc:c,keyId:d,init:0<g.length?g:null}},uO=function(a,b,c){if(a.length){c=c||`${"__clpp_baseUriCollection_"}
40
+ ${b.length}`;const d=[];a.forEach(e=>{const f=e.getAttribute("serviceLocation");e=_.Gn.f(e);f&&e&&d.push({serviceLocationId:f,uri:e,params:{}})});if(d.length)return a=new _.LI(c,d),b.push(a),a}return null},wO=function(a,b){a=vO(a).filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime());0<a.length&&(a=Math.min(...a),_.rC(b.presentationTimeline,a+b.$a.start))},xO=function(a,b){return _.hC(_.Kl(a,b))?_.I:a.split("/")[0]},vO=function(a){const b=new Set;a.forEach(c=>{c.variants.forEach(d=>
41
+ {d.audio&&b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},zO=function(a){return _.v(function*(){var b=a.w?a.w.getBaseUriCollectionById(yM):null;var c=[];b&&(c=_.aD(b,""));0===c.length&&(c=a.o);var d=_.fk(c,a.a.attemptParameters);d.type=1;c=Date.now();d=a.D.networkingEngine.fetch(d);_.wk(a.A,d);var e=yield d.V;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 yO(a,e.data,e.uri);f.manifest.contentSteering&&(a.w=yield a.D.onContentSteeringInfoFound(f.manifest.contentSteering));
42
+ if(a.w&&b){0!==e.request.uriIndex&&a.w.banLocation(b.qa[0].serviceLocationId);var g=e.request,h=e.timeMs;e=e.data.byteLength;h&&e&&a.w.notifyThroughput(b.qa[g.uriIndex].serviceLocationId,h,e)}b=(Date.now()-c)/1E3;_.eC(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.hj){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.H(_.ve))}return b})},AO=function(a,b){0>a.l||a.B.la(Math.max(3,a.l-b,_.fC(a.I)))},yO=function(a,b,c){return _.v(function*(){var d=_.wi(b);_.Nn(NM);d=_.Gn.j(d,"MPD");
43
+ _.Nn("parse.xml.end");_.Pn(NM,NM,"parse.xml.end");if(!d)throw new _.J(_.C,4,4001,c);d=wN(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.wk(a.A,d);d=yield d.V;return BO(a,d,c)})},BO=function(a,b,c){return _.v(function*(){var d=_.Gn;const e=[];var f=[c],g=d.a(b,yM),h=g.map(d.f).filter(_.vj);0<h.length&&(f=_.xB(f,h),a.o=f,uO(g,e,yM));g=d.a(b,sM);h=g.map(d.f);var k=_.xB(f,h);uO(g,e,sM);f=b.getAttribute("type")||QM;a.l=d.aa(b,"minimumUpdatePeriod",fN,-1);f===QM&&0<=a.l&&(a.g.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),
44
+ a.l=-1,a.B.stop());g=d.aa(b,"maxSegmentDuration",fN);if(d=f===QM&&"dynamic"===a.C)a.g.info("MPD dynamic to static transition."),f="dynamic";h=f===QM;var l="dynamic"===f;if(a.f)var m=a.f.presentationTimeline;else{var n=_.Gn;m=a.a.timeline||{};var p=n.aa(b,"suggestedPresentationDelay",fN),u=n.aa(b,"minBufferTime",fN,0);p=null!=a.a.suggestedPresentationDelay?a.a.suggestedPresentationDelay:a.a.lowLatencyMode?0:null!=p?p:3*u;n=n.aa(b,"availabilityStartTime",eN);m=new _.GI(m,n,p,h,!!a.a.autoCorrectDrift,
45
+ !!a.a.lowLatencyMode);m=h?m:gO(a.J,b,k,m)}m=yield m;n=_.Gn.aa(b,"timeShiftBufferDepth",fN);n=l&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)?a.a.availabilityWindowOverride:null===n?Infinity:n;m.A=n;if(!a.D)throw new _.J(_.C,7,7001);n={Ue:l,zg:null!=a.f,presentationTimeline:m,Ma:null,$a:null,xa:null,O:null,bandwidth:0,Ye:!1,ki:d,hc:null,Pd:null};k=CO(a,n,k,e,b);p=k.duration;l=k.periods;d&&(wO(l,n),m.C=!0);if(h||!d&&!k.hg)m.f=p||Infinity;if(2===a.a.timeline.version){h=p;n=
46
+ l[0].startTime;if(null==h||Infinity===h)h=DO(l);p=m.a;_.lC(p,n,n+h);d&&(p.f=!0)}_.uC(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=_.Gn;if(m=l.h(b,"ContentSteering"))if(g=m.getAttribute("defaultServiceLocation")||"",h=l.f(m)){l=l.aa(m,"queryBeforeStart",lN,!1);g={manifestType:_.tc,contentSteeringServerUri:h,defaultServiceLocation:g,queryBeforeStart:l||!1,baseUriCollections:[]};break a}g=null}g&&
47
+ (a.f.contentSteering=g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,hj:d}})},CO=function(a,b,c,d,e){const f=_.Gn,g=f.aa(e,"mediaPresentationDuration",fN),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 x=0;x<e.length;x++){var n=e[x];m=f.aa(n,_.Kf,fN,m);var p=f.aa(n,IM,fN);let y=null;if(x!==e.length-1){var u=f.aa(e[x+1],_.Kf,fN);null!=u&&(y=u-m)}else null!=g&&(y=g-m);u=_.nu;y&&p&&Math.abs(y-p)>u&&a.g.warn("There is a gap/overlap between Periods",
48
+ n);null==y&&(y=p);n=EO(a,b,c,d,{start:m,duration:y,node:n,ii:null==y||x===e.length-1});p=n.Ma;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){x!==e.length-1&&a.g.warn("Skipping Period",x+1,"and any subsequent Periods:","Period",x+1,"does not have a valid start time.",l[x+1]);m=null;break}m+=y}null==a.f&&a.D.filterAllPeriods(l);h&&(b=l.find(x=>x.id===h.id))&&(h.endTime=b.endTime);k=FO(a,k);return null!=g?(m!==g&&a.g.warn("@mediaPresentationDuration does not match the total duration of ",
49
+ "all Periods."),{periods:l,duration:g,hg:!1,cues:k}):{periods:l,duration:m,hg:!0,cues:k}},DO=function(a){return a.map(b=>b.variants[0].video||b.variants[0].audio).reduce((b,c)=>c?c.getDuration():0+b,0)},EO=function(a,b,c,d,e){var f=_.Gn;b.Ma=GO(a,e.node,null,c,d);b.$a=e;c=b.Ma.id||`__clpp_period_${e.start}`;b.Ma.id||(a.g.info("No Period ID given for Period with start time "+e.start+`, Assigning a default: ${c}.`),b.Ma.id=c);d=f.a(e.node,"EventStream").flatMap(B=>HO(a,e.start,e.duration,B));f=f.a(e.node,
50
+ _.ha).map(B=>IO(a,b,B)).filter(_.vj);if(b.Ue){var g=[];for(var h of f)for(var k of h.Oi)g.push(k);if(g.length!==(new Set(g)).size)throw new _.J(_.C,4,4018);}h=f.filter(B=>!B.Hf);k=f.filter(B=>B.Hf);for(var l of k){l.streams.forEach(B=>{B.trickPlay=!0});k=l.streams[0];g=l.Hf;for(var m of h)if(g.includes(m.id))for(var n of m.streams)n.trickModeVideo=k}m=JO(f,_.t);n=JO(h,_.q);if(!m.length&&!n.length)throw new _.J(_.C,4,4004);n.length||(n=[null]);m.length||(m=[null]);l=[];for(var p of n)for(var u of m)KO(a,
51
+ p,u,l);u=[...JO(h,_.I),...JO(h,_.eB)];p=[];for(var x of u)p.push.apply(p,x.streams);u=JO(h,_.ae);x=[];for(var y of u)x.push.apply(x,y.streams);y=LO(e,h);return{Ma:{id:c,configurationId:a.D.configurationId,startTime:e.start,endTime:y,textStreams:p,thumbStreams:x,variants:l},cues:d}},FO=function(a,b){const c=new Set(b.map(zN));a.j.forEach((d,e)=>{c.has(e)||a.j.delete(e)});b.forEach(d=>{const e=zN(d);a.j.has(e)||a.j.set(e,d)});return Array.from(a.j.values())},GO=function(a,b,c,d,e){const f=_.Gn;c=c||
52
+ {contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,cf:null,Ia:e?e.find(u=>u.id===sM)||null:null};d=d||c.qa;var g=f.a(b,sM);const h=g.map(f.f);e=e?uO(g,e,b.getAttribute("id")||void 0):null;g=b.getAttribute("contentType")||c.contentType;const k=b.getAttribute(_.se)||c.mimeType,l=b.getAttribute(_.md)||c.codecs,m=f.aa(b,"frameRate",kN)||c.frameRate,n=MO(f.a(b,"InbandEventStream"),c.emsgSchemeIdUris),p=f.a(b,"AudioChannelConfiguration");a=NO(a,p)||c.cf;g||(g=xO(k,l));return{qa:_.xB(d,
53
+ h),Ia:e||c.Ia,Wd:f.h(b,"SegmentBase")||c.Wd,sc:f.h(b,"SegmentList")||c.sc,tc:f.h(b,"SegmentTemplate")||c.tc,width:f.aa(b,_.Gg,jN)||c.width,height:f.aa(b,_.Xd,jN)||c.height,contentType:g,mimeType:k,codecs:l,frameRate:m,emsgSchemeIdUris:n,id:b.getAttribute("id")||"",cf:a}},HO=function(a,b,c,d){const e=_.Gn,f=d.getAttribute(PM)||"",g=d.getAttribute(_.lg)||"",h=e.aa(d,RM,jN)||1,k=e.aa(d,OM,jN)||0,l=[];for(const n of e.a(d,"Event")){d=e.aa(n,"presentationTime",jN)||0;var m=e.aa(n,IM,jN)||0;d=b+d/h-k/h;
54
+ m=d+m/h;null!=c&&(d=Math.min(d,b+c),m=Math.min(m,b+c));let p=_.fg;f.startsWith(_.hg)?p=_.cj:"urn:mpeg:dash:event:callback:2015"===f&&(p=_.we);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===_.we&&(u.xe=()=>{if(u.eventElement){var x=u.eventElement.getAttribute("messageData")||"";x&&x.startsWith("http")&&(x=_.fk(x),x.type=_.ek,a.D.networkingEngine.fetch(x))}});l.push(u)}return l},IO=function(a,
55
+ b,c){var d=_.Gn;b.xa=GO(a,c,b.Ma,null,null);var e=b.xa.contentType===_.I;const f=OO(c),{kind:g,Rd:h,roles:k}=PO(c,e);let l=null;try{l=QO(c)}catch(y){return null}const m=d.a(c,"Accessibility"),n=RO(m);var p=d.a(c,uM);const u=pO(p,a.a.ignoreDrmInfo,b.Ma.id,a.a.playreadyVersion||null),x=c.getAttribute("lang")||_.eg;p=_.Uj(x);d=d.a(c,_.kb);c=d.map(y=>SO(a,b,u,g,x,f||"",h,k,n,y)).filter(_.vj);if(0===c.length){if(e)return null;throw new _.J(_.C,4,4003);}if(!b.xa.contentType||b.xa.contentType===HM){b.xa.contentType=
56
+ xO(c[0].mimeType,c[0].codecs);for(const y of c)y.type=b.xa.contentType}for(const y of c)for(const B of u.drmInfos)y.keyId&&!B.keyIds.includes(y.keyId)&&B.keyIds.push(y.keyId);c=TO(c,b.xa.contentType,m);e=d.map(y=>y.getAttribute("id")).filter(_.vj);return{id:b.xa.id||"__fake__"+a.h++,contentType:b.xa.contentType,language:p,originalLanguage:x,Rd:h,streams:c,drmInfos:u.drmInfos,Hf:l,Oi:e}},JO=function(a,b){return a.filter(c=>c.contentType===b)},KO=function(a,b,c,d){if(b||c)if(b&&c){if(_.CB(b.drmInfos,
57
+ c.drmInfos)){var e=_.BB(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.Rd||c.Rd,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||_.eg,primary:f.Rd,audio:b?e:null,video:c?e:null,bandwidth:g,drmInfos:f.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(g)}},
58
+ LO=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},OO=function(a){let b=null;const c=_.Gn.a(a,"Label").map(_.Gn.f).filter(_.vj);c&&0<c.length&&(b=c[c.length-1]);null==b&&(b=a.getAttribute("label"));return b},PO=function(a,b){let c=!1;const d=_.Gn.a(a,"Role");a=d.map(f=>f.getAttribute(_.lg)).filter(_.vj);
59
+ let e=void 0;b&&(e=_.eB);for(const f of d)if(b=f.getAttribute(PM),null==b||"urn:mpeg:dash:role:2011"===b||"urn:mpeg:dash:role"===b)switch(b=f.getAttribute(_.lg),b){case _.ne:c=!0;break;case _.NA:case _.eB:e=b;break;case "forced-subtitle":case "forced_subtitle":case _.Ud:e=_.Ud}return{Rd:c,roles:a,kind:e}},QO=function(a){var b=_.Gn.a(a,wM);a=null;for(const c of b){b=c.getAttribute(PM)||"";const d=c.getAttribute(_.lg);if(b!==JM&&!UO.includes(b)||void 0===d)throw new _.wj("Unrecognized essential property");
60
+ b===JM&&(a=d.split(" "))}return a},RO=function(a){const b=new Map;for(const e of a)if(a=e.getAttribute(PM),"urn:scte:dash:cc:cea-608:2015"===a||"urn:scte:dash:cc:cea-708:2015"===a){a=1;var c=e.getAttribute(_.lg);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,_.Uj(d))}else b.set("CC1",_.eg)}return b},SO=function(a,b,c,d,e,f,g,h,k,l){const m=_.Gn,n=_.Uj(e);
61
+ b.O=GO(a,l,b.xa,null,null);if(!VO(a,b.O))return a.g.warn("Skipping Representation",b.O),null;b.hc=`${b.Ma.id} ${b.O.id}`;b.Pd=a.F.get(b.hc);b.bandwidth=m.aa(l,"bandwidth",iN)||0;const p=WO(a,b);if(!p)return null;a.F.set(b.hc,p.Na);var u=m.a(l,uM);a=sO(u,c,a.a.ignoreDrmInfo,b.Ma.id,a.a.playreadyVersion||null);u=!1;m.a(l,"SupplementalProperty").some(x=>"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===x.getAttribute(PM)&&"JOC"===x.getAttribute(_.lg))&&(b.O.mimeType="audio/eac3-joc",u=!0);l=XO(b,l);
62
+ return{id:_.DI++,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:_.UA,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,
63
+ 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.cf,spatialAudio:u,closedCaptions:k,horizontalTiles:l.horizontalTiles,verticalTiles:l.verticalTiles,durationPerTile:l.durationPerTile}},TO=function(a,b,c){const d=b===_.eB?_.I:b;b=c.map(e=>({scheme:e.getAttribute(PM)||"",id:e.getAttribute("id")||void 0,value:e.getAttribute(_.lg)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=
64
+ b;return a},VO=function(a,b){let c;c=b.Wd?1:0;c+=b.sc?1:0;c+=b.tc?1:0;if(0===c){if(b.contentType===_.I||b.contentType===HM)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.",
65
+ b),b.Wd?(a.g.info("Using SegmentBase by default."),b.sc=null):a.g.info("Using SegmentList by default."),b.tc=null);return!0},WO=function(a,b){var c=b.O.contentType;c=c===_.I||c===HM;try{if(b.O.Wd){{const F=Number(sN(b,NN,OM))||0,G=sN(b,NN,RM);var d=1;G&&(d=iN(G)||1);var e=F/d||0,f=MN(b,NN);{d=f;var g=e;const D=b.O.mimeType.split("/")[1];if(b.O.contentType!==_.I&&"mp4"!==D&&"webm"!==D)throw _.sh("SegmentBase specifies an unsupported container type.",b.O),new _.J(_.C,4,4006);if("webm"===D&&!d)throw _.sh(BM,
66
+ "the SegmentBase uses a WebM container,","but does not contain an Initialization element.",b.O),new _.J(_.C,4,4005);const ka=tN(b,NN,"RepresentationIndex"),Da=sN(b,NN,"indexRange");let Xa=b.O.qa,Hb=gN(Da||"");if(ka){const sb=ka.getAttribute("sourceURL");sb&&(Xa=_.xB(b.O.qa,[sb]));Hb=_.Gn.aa(ka,"range",gN,Hb)}if(!Hb)throw _.sh(BM,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",b.O),new _.J(_.C,4,4002);aN(b.O.contentType)&&(b.presentationTimeline.B=null);var h=PN(b,
67
+ d,Xa,Hb.start,Hb.end,D,g)}var k={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:f,getLastSegmentEndTime:h.getLastSegmentEndTime,Na:e}}}else{if(b.O.sc){{var l=a.H;const F=MN(b,cO);{const ka=dO(b),Da=vN(b,cO);let Xa=Da.Nc;0===Xa&&(_.A("SegmentList@startNumber must be \x3e 0"),Xa=1);h=0;Da.ab?h=Da.ab*(Xa-1):Da.wa&&0<Da.wa.a&&(h=Da.wa.j);
68
+ var m={ab:Da.ab,startTime:h,Nc:Xa,Ub:Da.Ub,wa:Da.wa,Lc:ka}}if(!m.ab&&!m.wa&&1<m.Lc.length)throw _.A(CM,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",b.O),new _.J(_.C,4,4002);if(!m.ab&&!b.$a.duration&&!m.wa&&1===m.Lc.length)throw _.A(CM,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",b.O),new _.J(_.C,4,4002);if(m.wa&&0===m.wa.a)throw _.A(CM,"the SegmentList has an empty timeline.",
69
+ b.O),new _.J(_.C,4,4002);{let ka=m.Lc.length;m.wa&&m.wa.a!==m.Lc.length&&(ka=Math.min(m.wa.a,m.Lc.length),_.A("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",m.Lc.length,"to",ka));var n=ka}const G=new YO(m,b.O.qa,b.O.Ia,b.$a.duration,n),D=ZN(b,G,l);if(aN(b.O.contentType)){const ka=TN(D);ka&&yN(b,ka)}d={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:D.findSegmentPosition.bind(D),getSegmentReference:D.getSegmentReference.bind(D),
70
+ adjustSegmentDurations:D.adjustSegmentDurations.bind(D),getDuration:D.getDuration.bind(D),initSegmentReference:F,getLastSegmentEndTime:D.getLastSegmentEndTime.bind(D),Na:m.Ub}}}else{if(b.O.tc){{var p=a.H,u=!!a.f;const F=aO(b);{const D=vN(b,$N),ka=sN(b,$N,"media"),Da=sN(b,$N,"index");e={ab:D.ab,timescale:D.timescale,Nc:D.Nc,Ve:D.Ve,Ub:D.Ub,Jf:D.Jf,wa:D.wa,bf:ka,Md:Da,Oe:D.Oe}}{let D;D=e.Md?1:0;D+=e.wa?1:0;D+=e.ab?1:0;if(0===D)throw _.sh("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template",
71
+ "a SegmentTimeline, or a segment duration.",b.O),new _.J(_.C,4,4002);1!==D&&(_.A("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",b.O),e.Md?(_.qh("Using the index URL template by default."),e.wa=null):_.qh("Using the SegmentTimeline by default."),e.ab=null);if(!e.Md&&!e.bf)throw _.sh(DM,"the SegmentTemplate's media URL template is missing.",b.O),new _.J(_.C,4,4002);}const G=
72
+ aN(b.O.contentType);h=null;if(e.Md){G&&(b.presentationTimeline.B=null);{f=F;const D=b.O.mimeType.split("/")[1];if("mp4"!==D&&"webm"!==D)throw _.sh("SegmentTemplate specifies an unsupported container type.",b.O),new _.J(_.C,4,4006);if("webm"===D&&!f)throw _.sh(DM,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",b.O),new _.J(_.C,4,4005);const ka=rN(e.Md,b.O.id,null,b.bandwidth||null,null),Da=_.xB(b.O.qa,[ka]);h=PN(b,f,Da,0,null,D,e.Ub)}}else if(e.ab){if(!u&&
73
+ G){b.presentationTimeline.B=null;var x=b.presentationTimeline;x.G=Math.max(x.G,e.Oe);x.g.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+x.G);_.uC(b.presentationTimeline,e.ab);var y=b.presentationTimeline,B=b.$a.start;y.l=null==y.l?B:Math.min(y.l,B)}h=bO(b,e)}else{const D=ZN(b,new ZO(e,b.O.id,b.bandwidth||null,b.O.qa,b.O.Ia),p);if(G){const ka=TN(D);ka&&yN(b,ka)}h={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:D.findSegmentPosition.bind(D),getSegmentReference:D.getSegmentReference.bind(D),
74
+ adjustSegmentDurations:D.adjustSegmentDurations.bind(D),getDuration:D.getDuration.bind(D),getLastSegmentEndTime:D.getLastSegmentEndTime.bind(D)}}g={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:F,getLastSegmentEndTime:h.getLastSegmentEndTime,Na:e.Ub}}}else g=$O(b);d=g}k=d}return k}catch(F){if(c&&4002===F.code)return a.g.debug("Ignoring DASH_NO_SEGMENT_INFO error in a text stream",
75
+ F),null;throw F;}},XO=function(a,b){const c={};if(a.O.contentType===_.ae){var d=(b=_.Gn.h(b,wM))&&b.getAttribute(PM);d=d||"";aP.includes(d)&&(b=_.AB(b.getAttribute(_.lg)||""))&&(c.horizontalTiles=b.Jd,c.verticalTiles=b.ae,a.xa.tc&&(d=_.Gn.aa(a.xa.tc,IM,jN)||0,a=_.Gn.aa(a.xa.tc,RM,jN)||1,a=d/a))&&(c.durationPerTile=a/b.dj)}return c},$O=function(a){const b=a.O.qa,c=a.$a.duration||0,d=()=>c;return{createSegmentIndex:()=>Promise.resolve(),findSegmentPosition:e=>0<=e&&e<c?1:null,getSegmentReference:e=>
76
+ 1!==e?null:new _.CI(1,0,c,()=>b,0,null,0,null,null,null,null,null,null,null,null,()=>"",a.O.Ia),adjustSegmentDurations:()=>{},getDuration:d,getLastSegmentEndTime:d,verticalTiles:void 0,horizontalTiles:void 0,initSegmentReference:null,Na:0}},MO=function(a,b){b=b.slice();for(const c of a)(a=c.getAttribute(PM))&&!b.includes(a)&&b.push(a);return b},NO=function(a,b){for(const d of b){b=d.getAttribute(PM);if(!b)continue;const e=d.getAttribute(_.lg);if(e)switch(b){case "urn:mpeg:dash:outputChannelPositionList:2012":return e.trim().split(/ +/).length;
77
+ 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(tM,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(tM,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};_.fv.prototype.Zd=XM(19,function(a){return a});
78
+ _.RB.prototype.Zd=XM(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}/>`,_.Uf).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});
79
+ _.fv.prototype.Ee=XM(17,function(a,b){Array.from(a.attributes).forEach(c=>{c.namespaceURI===b&&a.removeAttributeNS(c.namespaceURI,c.localName)})});_.RB.prototype.Ee=XM(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]})}});_.fv.prototype.te=XM(15,function(a,b){for(const c of a.attributes)b.setAttributeNS(c.namespaceURI,c.nodeName,c.value)});
80
+ _.RB.prototype.te=XM(14,function(a,b){Object.keys(a.attributes).forEach(c=>{b.attributes[c]=a.attributes[c]})});_.fv.prototype.ue=XM(13,function(a,b){Array.from(a.childNodes).forEach(c=>{a.removeChild(c);b.appendChild(c)})});_.RB.prototype.ue=XM(12,function(a,b){b.childNodes.push(...a.childNodes);a.childNodes=[]});_.fv.prototype.De=XM(11,function(a){Array.from(a.childNodes).forEach(b=>{a.removeChild(b)})});_.RB.prototype.De=XM(10,function(a){a.childNodes=[]});_.fv.prototype.Sc=XM(9,function(){return document.createElement("null")});
81
+ _.RB.prototype.Sc=XM(8,function(){return new _.PB("NULL",null,{},[],null,null,new Map)});_.fv.prototype.pe=XM(7,function(a){return Array.from(a.childNodes).filter(b=>b instanceof Element)});_.RB.prototype.pe=XM(6,function(a){return a.childNodes});_.fv.prototype.aa=XM(5,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});_.RB.prototype.aa=XM(4,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});
82
+ _.fv.prototype.Dc=XM(3,function(a,b,c){return Array.from(a.childNodes).filter(d=>d instanceof Element&&d.localName===c&&d.namespaceURI===b)});_.RB.prototype.Dc=XM(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)});_.fv.prototype.Xb=XM(1,function(a,b,c){a=this.Dc(a,b,c);return 1!==a.length?null:a[0]});_.RB.prototype.Xb=XM(0,function(a,b,c){a=this.Dc(a,b,c);return 1!==a.length?null:a[0]});var YO=class{constructor(a,b,c,d,e){this.l=a.Nc;this.j=e;this.I=a.Lc;this.a=a.startTime;this.h=a.ab;this.f=a.wa;this.H=a.Ub;this.G=b;this.F=c;this.A=d;this.g=new _.S("clpp.dash.SegmentListSource")}o(){return this.j}w(){return this.l}B(a){a=nN(this,a);return null==a?null:null!=this.h?(a=this.a+a*this.h,{startTime:a,endTime:a+this.h}):this.f?(a=pN(this.f,a),{startTime:a.startTime,endTime:a.endTime}):null==this.A?(this.g.warn(vM),null):{startTime:this.a,endTime:this.a+this.A}}findSegmentPosition(a){return 0<
83
+ this.j?a<this.a?this.l:null!=this.h?(a=this.l+Math.floor((a-this.a)/this.h),a>this.l+this.j-1?null:a):this.f?(a=qN(this.f,a),null==a?null:this.l+a):null==this.A?(this.g.warn(vM),null):a<this.a+this.A?this.l:null:null}getSegmentReference(a,b){const c=nN(this,a);if(null==c)return null;b=null==b?a:b;a=this.B(a);if(null==a)return null;const d=this.I[c],e=_.xB(this.G,[d.Bg]);return new _.CI(b,a.startTime,a.endTime,()=>e,d.start,d.end,this.H,null,null,null,null,null,null,null,null,()=>d.Bg,this.F)}C(){return 0<
84
+ this.j?null!=this.h?{oc:this.a,bc:this.a+this.j*this.h,cc:this.h}:this.f?{oc:pN(this.f,0).startTime,bc:pN(this.f,this.j-1).endTime,cc:this.f.h}:null==this.A?null:{oc:this.a,bc:this.a+this.A,cc:this.A}:null}};var uN=class{constructor(a){this.f=a;this.a=a.reduce((b,c)=>b+c.count,0);this.j=0<this.a?a[0].startTime:0;this.h=oN(a)}};var aP=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],UO=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var ZO=class{constructor(a,b,c,d,e){const f=a.wa;this.h=a.Nc;this.f=f.a;this.a=f;this.G=a.bf;this.H=b;this.j=c;this.A=d;this.l=e;this.F=a.Ub;this.I=a.Jf}o(){return this.f}w(){return this.h}B(a){a=BN(this,a);if(null==a)return null;a=pN(this.a,a);return{startTime:a.startTime,endTime:a.endTime}}findSegmentPosition(a){if(!(0<this.f))return null;a=qN(this.a,a);return null==a?null:this.h+a}getSegmentReference(a,b){var c=BN(this,a);if(null==c)return null;b=null==b?a:b;c=pN(this.a,c);const d=c.kj+this.I,
85
+ e=()=>rN(this.G,this.H,a,this.j,d);return new _.CI(b,c.startTime,c.endTime,()=>{const f=e();return _.xB(this.A,[f])},0,null,this.F,null,null,null,null,null,null,null,null,e,this.l)}C(){return 0<this.f?{oc:pN(this.a,0).startTime,bc:pN(this.a,this.f-1).endTime,cc:this.a.h}:null}};var JN=class{constructor(a){this.f=a;this.a=new _.Dn(a,!1)}},FN=[[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]],GN=class{constructor(a,b){this.id=a;this.a=b}};var ON=class{parse(a,b,c,d){var e;b=new JN(new DataView(b));if(440786851!==HN(b).id)throw _.sh("Not an EBML element."),new _.J(_.C,3,3008);var f=HN(b);if(408125543!==f.id)throw _.sh("Not a Segment element."),new _.J(_.C,3,3009);b=f.a.byteOffset;f=new JN(f.a);for(e=null;_.Cm(f.a);){var g=HN(f);if(357149030===g.id){e=g;break}}if(!e)throw _.sh("Not an Info element."),new _.J(_.C,3,3010);e=new JN(e.a);g=1E6;for(f=null;_.Cm(e.a);){const h=HN(e);if(2807729===h.id)g=IN(h);else if(17545===h.id)if(f=h,4===
86
+ f.a.byteLength)f=f.a.getFloat32(0);else if(8===f.a.byteLength)f=f.a.getFloat64(0);else throw new _.J(_.C,3,3003);}if(null==f)throw new _.J(_.C,3,3011);e=g/=1E9;f*=g;a=HN(new JN(new DataView(a)));if(475249515!==a.id)throw _.sh("Not a Cues element."),new _.J(_.C,3,3007);return LN(a,b,e,f,c,d)}};var YN=class{constructor(a){this.a=a;this.f=0;this.l=0<a.o()?a.w():0;this.h=[];this.j=null;this.g=new _.S("clpp.dash.SegmentSourceAdapter")}findSegmentPosition(a){const b=QN(this);if(!b)return null;if(!(0<this.h.length||null!=this.j))return a=this.a.findSegmentPosition(a),null==a||a>b.$b?null:a<b.Lb?b.Lb+this.f:a+this.f;for(var c=b.$b;c>=b.Lb;c--){const d=RN(this,c);if(a>=d.startTime&&a<d.endTime)return c+this.f}c=RN(this,b.Lb);return a<c.startTime?b.Lb+this.f:null}getSegmentReference(a){var b=a-
87
+ this.f;if(!SN(this,b))return null;a=this.a.getSegmentReference(b,a);if(!a)return null;b=RN(this,b);return new _.CI(a.position,b.startTime,b.endTime,a.Da,a.na,a.ka,a.Na,a.keyInfo,a.Vc,a.timescale,a.horizontalTiles,a.verticalTiles,a.durationPerTile,a.a,a.initSegment,a.$c,a.Ia)}adjustSegmentDurations(a,b){if(SN(this,a-this.f)){this.g.warn(`Adjusting segment duration by drift ${b} at ${a}`);var c=this.h.find(d=>d.position===a);c?c.ke+=b:this.h.push({position:a,ke:b})}}getDuration(){const a=QN(this);if(!a)return 0;
88
+ const b=RN(this,a.Lb);return RN(this,a.$b).endTime-b.startTime}getLastSegmentEndTime(){const a=QN(this);return a?RN(this,a.$b).endTime:0}};var bP=class{constructor(a,b){this.g=a;this.f=b;this.a={clockSyncUri:void 0}}};var hO=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Le).set(WM,_.td).set(VM,_.rd).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.rd).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.pd).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.od),rO=(new Map).set(_.td,function(a){const b=tO(a);if(b)return{licenseUrl:b,origin:_.SA};if(a=_.Gn.Xb(a.node,"urn:microsoft","laurl"))if(a=a.getAttribute("licenseUrl"))return{licenseUrl:a,origin:"ms:laurl"};return null}).set(_.rd,
89
+ function(a){var b=_.Gn;const c=tO(a);if(c)return{licenseUrl:c,origin:_.SA};a=b.Xb(a.node,SM,"pro");if(!a)return null;b=b.f(a);if(!b)return null;b=_.Pk(b);return(b=_.Ln(b).h)?{licenseUrl:b,origin:"mspr:pro"}:null}),jO=new _.S("clpp.dash.ContentProtection");var cP=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 _.EI(5);this.B=new _.Kh(()=>{this.ec()});this.A=new _.ru;this.j=new Map;this.g=new _.S("clpp.dash.DashParser");this.C=null;this.J=new bP(this.g,(a,b)=>{a=_.fk(a,this.a.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.wk(this.A,b);return b.V});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=
90
+ this;return _.v(function*(){c.o=[a];c.D=b;const d=yield zO(c);c.D&&AO(c,d);if(!c.D)throw new _.J(_.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(){zO(this).catch(a=>{if(this.D&&a)this.D.onError(a)})}setCurrentVariant(){}ec(){const a=this;return _.v(function*(){a.g.debug(_.IA);let b=0;try{b=yield zO(a)}catch(c){if(a.D&&c.a&&(a.D.onError(c),
91
+ c.severity===_.C))return}a.D&&(a.K?yield a.stop():AO(a,b))})}loadVariant(a){return _.v(function*(){return a})}loadTextStream(a,b){const c=this;return _.v(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 _.wj(`Could not load text stream with id: ${a}`);return d})}};_.w("clpp.dash.DashComponent",class extends _.Fv{install(){_.Nt.mpd=cP;_.Mt[_.tc]=cP}uninstall(){_.YC("mpd");_.ZC(_.tc)}id(){return"dash"}});};f.call(g, window);
package/cl.freewheel.js CHANGED
@@ -1,20 +1,20 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var mU="clpp-freewheel",nU="clpp.freewheel.AdsManagerFactory",oU="freewheel",pU=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case _.Pj:return tv.freewheel.SDK.ADUNIT_MIDROLL;case _.Mj:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},qU=function(a){const b=[];typeof a.networkId!==_.r&&b.push("networkId");typeof a.serverUrl!==_.Of&&b.push("serverUrl");typeof a.profileId!==_.Of&&b.push("profileId");typeof a.videoAssetId!==_.Of&&typeof a.videoAssetId!==_.r&&
2
- b.push("videoAssetId");if(b.length)throw new _.J(1,9,12001,{missingKeys:b.join(", ")});},rU=function(){return _.v(function*(){var a=new _.Pv;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},sU=function(a){a.l.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.U.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,
3
- a.Z.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.W.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_AD,a.S.bind(a));a.l.on(a.m,_.$f,a.R.bind(a));a.l.on(a.m,_.bf,a.P.bind(a))},tU=function(a){const b=a.m.Ed(oU).Yc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},uU=function(a){const b=a.m.Ed(oU).Yc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(mU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},vU=function(a,b,c){var d=
4
- null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new X(a.a,c,d)});a.m.trigger(new _.H(b,d))},wU=class extends _.Zv{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Dp(_.Ad,{id:mU}),this.f=_.Dp(_.t,{"class":_.bd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.J(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),
5
- this.f=this.a=null)}id(){return oU}Yc(){return this.a}Sh(){return this.f}};_.w("clpp.freewheel.FreeWheelPlugin",wU);wU.prototype.getAdVideo=wU.prototype.Sh;wU.prototype.getAdContainer=wU.prototype.Yc;wU.Id=oU;wU.AD_CONTAINER_ID=mU;var xU=class{create(){return new wU}};var X=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}fb(){return"FreeWheel AdManager SDK"}gb(){return tv.freewheel.SDK.version}ib(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Of?a:""}yb(){return""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
6
- 0}getPosition(){return 0}getSkipTimeOffset(){return 0}Ab(){return!1}Ra(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}Va(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}Ua(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}Ba(){return 0}Ca(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;
7
- case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return _.Mj;default:return _.Pj}}getPodIndex(){switch(this.Ca()){case 0:return 0;case _.Mj:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}ob(){switch(this.Ca()){case 0:return 0;case _.Mj:return-1;default:return this.f.getTimePosition()}}hb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}Wa(){return this.f.getAdCount()}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}zb(){return null}};
8
- X.prototype.getVideoElement=X.prototype.zb;X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;X.prototype.canSeek=X.prototype.canSeek;X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.Wa;X.prototype.getPositionInSequence=X.prototype.hb;X.prototype.getPodTimeOffset=X.prototype.ob;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ca;
9
- X.prototype.getMediaBitrate=X.prototype.Ba;X.prototype.getMediaHeight=X.prototype.Ua;X.prototype.getMediaWidth=X.prototype.Va;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Ra;X.prototype.isBumper=X.prototype.Ab;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getPosition=X.prototype.getPosition;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;
10
- X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getSourceId=X.prototype.yb;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.ib;X.prototype.getAdManagerVersion=X.prototype.gb;X.prototype.getAdManagerName=X.prototype.fb;var yU=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(a=>{switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})}Qb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}Pb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
11
- yU.prototype.hasPostroll=yU.prototype.Pb;yU.prototype.hasPreroll=yU.prototype.Qb;yU.prototype.getCuePoints=yU.prototype.getCuePoints;var zU=class{constructor(a){this.g=new _.S("clpp.freewheel.AdsManager");this.m=a;this.l=new _.Ut;this.K=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.M=[];this.I=[];this.L=[];this.H=new _.wk;this.B=null;this.C=!1;this.G=1;this.J=!1;this.F=!0}load(){const a=this;return _.v(function*(){const b=a.m.getConfiguration().freewheel||{};try{qU(b)}catch(d){return a.m.onError(d),a.H.resolve(),a.H}a.K.setNetwork(b.networkId);a.K.setServer(b.serverUrl);a.a=a.K.newContext();a.a.setProfile(b.profileId);
12
- typeof b.siteSectionId!==_.Of&&typeof b.siteSectionId!==_.r||a.a.setSiteSection(b.siteSectionId);const c=yield rU();a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,pU(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ce&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,
13
- !1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);sU(a);a.a.submitRequest();return a.H})}j(){if(this.M.length){uU(this);this.f=this.M.shift();this.f.play();var a=!1}else this.f?(this.f.resume(),a=!1):(tU(this),a=!0);return a}A(){}Ja(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getAdVolume(){return!this.a||this.C?this.G:this.a.getAdVolume()}h(a){this.G=a;this.C||this.a&&this.a.setAdVolume(a)}setMuted(a){this.C=
14
- a;this.a&&(a?this.a.setAdVolume(0):this.a.setAdVolume(this.G))}isMuted(){return this.C}pb(){return this.J}isPaused(){return this.F}getPosition(){return this.f?this.f.getPlayheadTime():-1}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.Ja()}resume(){this.j()}w(){return!0}o(){const a=this;return _.v(function*(){a.l.release();a.B&&(a.B.stop(),a.B=null);tU(a);a.a&&(a.a.dispose(),a.a=null)})}U(a){if(a.success)this.M=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),
15
- this.I=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.L=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.H(_.oc,{adsTimeline:new yU(this.a)})),this.B=new _.Nv(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.Ed(oU).f);else this.m.onError(new _.J(1,9,10003,{errorType:0},void 0));this.H.resolve()}Z(a){vU(this,_.Sb,a);this.B.start()}W(a){this.f=null;a=a.slot;vU(this,_.Tb);this.B.stop();tU(this);a&&a.getTimePositionClass()===
16
- tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL||this.m.play()}S(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:this.setMuted(this.C);this.h(this.G);this.J=!0;this.F=!1;vU(this,_.kc,a);vU(this,_.ac,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:vU(this,_.lc,a);this.F=this.J=!1;break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:vU(this,_.Xb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:vU(this,_.cc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:vU(this,
17
- _.mc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:vU(this,_.Wb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:vU(this,_.Vb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:this.F=!0;vU(this,_.dc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:this.F=!1;vU(this,_.fc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:vU(this,_.ic,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:vU(this,_.Ub,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:vU(this,_.ec,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.J(1,
18
- 9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}R(){if(!this.f){var a=this.m.getPosition();if(this.f=this.I.find(b=>.5>Math.abs(a-b.getTimePosition()))||null){const b=this.I.findIndex(c=>c===this.f);this.I.splice(b,1);this.m.pause();uU(this);this.f.play()}}}P(a){if((a=a.detail)&&this.a)switch(a.currentState){case 8:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;
19
- case 10:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 11:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.L.length?(uU(this),this.f=this.L.shift(),this.f.play()):tU(this);break;case 0:case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};zU.prototype.resume=zU.prototype.resume;zU.prototype.pause=zU.prototype.pause;zU.prototype.getVolume=zU.prototype.getVolume;zU.prototype.setVolume=zU.prototype.setVolume;zU.prototype.getPosition=zU.prototype.getPosition;
20
- zU.prototype.skip=zU.prototype.skip;_.pp(new class{constructor(){this.Ya=new _.S(nU)}name(){return nU}a(a,b){return a.namespace()!==_.gd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Ya.warn("FreeWheel SDK is not loaded."),!1):!1}create(a){return new zU(a)}});_.Sr(new xU);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var nU="clpp-freewheel",oU="clpp.freewheel.AdsManagerFactory",pU="freewheel",qU=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case _.Qj:return tv.freewheel.SDK.ADUNIT_MIDROLL;case _.Nj:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},rU=function(a){const b=[];typeof a.networkId!==_.r&&b.push("networkId");typeof a.serverUrl!==_.Of&&b.push("serverUrl");typeof a.profileId!==_.Of&&b.push("profileId");typeof a.videoAssetId!==_.Of&&typeof a.videoAssetId!==_.r&&
2
+ b.push("videoAssetId");if(b.length)throw new _.J(1,9,12001,{missingKeys:b.join(", ")});},sU=function(){return _.v(function*(){var a=new _.Qv;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},tU=function(a){a.l.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.U.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,
3
+ a.Z.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.W.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_AD,a.S.bind(a));a.l.on(a.m,_.$f,a.R.bind(a));a.l.on(a.m,_.bf,a.P.bind(a))},uU=function(a){const b=a.m.Ed(pU).Yc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},vU=function(a){const b=a.m.Ed(pU).Yc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(nU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},wU=function(a,b,c){var d=
4
+ null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new X(a.a,c,d)});a.m.trigger(new _.H(b,d))},xU=class extends _.$v{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Ep(_.Ad,{id:nU}),this.f=_.Ep(_.t,{"class":_.$c}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.J(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),
5
+ this.f=this.a=null)}id(){return pU}Yc(){return this.a}Sh(){return this.f}};_.w("clpp.freewheel.FreeWheelPlugin",xU);xU.prototype.getAdVideo=xU.prototype.Sh;xU.prototype.getAdContainer=xU.prototype.Yc;xU.Id=pU;xU.AD_CONTAINER_ID=nU;var yU=class{create(){return new xU}};var X=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}gb(){return"FreeWheel AdManager SDK"}hb(){return tv.freewheel.SDK.version}jb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Of?a:""}yb(){return""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
6
+ 0}getPosition(){return 0}getSkipTimeOffset(){return 0}Bb(){return!1}Ta(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}Xa(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}Wa(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}Ba(){return 0}Ca(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;
7
+ case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return _.Nj;default:return _.Qj}}getPodIndex(){switch(this.Ca()){case 0:return 0;case _.Nj:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}pb(){switch(this.Ca()){case 0:return 0;case _.Nj:return-1;default:return this.f.getTimePosition()}}ib(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}Ya(){return this.f.getAdCount()}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}zb(){return null}};
8
+ X.prototype.getVideoElement=X.prototype.zb;X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;X.prototype.canSeek=X.prototype.canSeek;X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.Ya;X.prototype.getPositionInSequence=X.prototype.ib;X.prototype.getPodTimeOffset=X.prototype.pb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ca;
9
+ X.prototype.getMediaBitrate=X.prototype.Ba;X.prototype.getMediaHeight=X.prototype.Wa;X.prototype.getMediaWidth=X.prototype.Xa;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Ta;X.prototype.isBumper=X.prototype.Bb;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getPosition=X.prototype.getPosition;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;
10
+ X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getSourceId=X.prototype.yb;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.jb;X.prototype.getAdManagerVersion=X.prototype.hb;X.prototype.getAdManagerName=X.prototype.gb;var zU=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(a=>{switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})}Qb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}Ab(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
11
+ zU.prototype.hasPostroll=zU.prototype.Ab;zU.prototype.hasPreroll=zU.prototype.Qb;zU.prototype.getCuePoints=zU.prototype.getCuePoints;var AU=class{constructor(a){this.g=new _.S("clpp.freewheel.AdsManager");this.m=a;this.l=new _.Ut;this.K=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.M=[];this.I=[];this.L=[];this.H=new _.xk;this.B=null;this.C=!1;this.G=1;this.J=!1;this.F=!0}load(){const a=this;return _.v(function*(){const b=a.m.getConfiguration().freewheel||{};try{rU(b)}catch(d){return a.m.onError(d),a.H.resolve(),a.H}a.K.setNetwork(b.networkId);a.K.setServer(b.serverUrl);a.a=a.K.newContext();a.a.setProfile(b.profileId);
12
+ typeof b.siteSectionId!==_.Of&&typeof b.siteSectionId!==_.r||a.a.setSiteSection(b.siteSectionId);const c=yield sU();a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,qU(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ce&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,
13
+ !1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);tU(a);a.a.submitRequest();return a.H})}j(){if(this.M.length){vU(this);this.f=this.M.shift();this.f.play();var a=!1}else this.f?(this.f.resume(),a=!1):(uU(this),a=!0);return a}A(){}La(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getAdVolume(){return!this.a||this.C?this.G:this.a.getAdVolume()}h(a){this.G=a;this.C||this.a&&this.a.setAdVolume(a)}setMuted(a){this.C=
14
+ a;this.a&&(a?this.a.setAdVolume(0):this.a.setAdVolume(this.G))}isMuted(){return this.C}Ka(){return this.J}isPaused(){return this.F}getPosition(){return this.f?this.f.getPlayheadTime():-1}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.La()}resume(){this.j()}w(){return!0}o(){const a=this;return _.v(function*(){a.l.release();a.B&&(a.B.stop(),a.B=null);uU(a);a.a&&(a.a.dispose(),a.a=null)})}U(a){if(a.success)this.M=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),
15
+ this.I=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.L=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.H(_.oc,{adsTimeline:new zU(this.a)})),this.B=new _.Ov(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.Ed(pU).f);else this.m.onError(new _.J(1,9,10003,{errorType:0},void 0));this.H.resolve()}Z(a){wU(this,_.Sb,a);this.B.start()}W(a){this.f=null;a=a.slot;wU(this,_.Tb);this.B.stop();uU(this);a&&a.getTimePositionClass()===
16
+ tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL||this.m.play()}S(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:this.setMuted(this.C);this.h(this.G);this.J=!0;this.F=!1;wU(this,_.jc,a);wU(this,_.ac,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:wU(this,_.lc,a);this.F=this.J=!1;break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:wU(this,_.Xb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:wU(this,_.cc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:wU(this,
17
+ _.mc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:wU(this,_.Wb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:wU(this,_.Vb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:this.F=!0;wU(this,_.dc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:this.F=!1;wU(this,_.fc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:wU(this,_.gc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:wU(this,_.Ub,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:wU(this,_.ec,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.J(1,
18
+ 9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}R(){if(!this.f){var a=this.m.getPosition();if(this.f=this.I.find(b=>.5>Math.abs(a-b.getTimePosition()))||null){const b=this.I.findIndex(c=>c===this.f);this.I.splice(b,1);this.m.pause();vU(this);this.f.play()}}}P(a){if((a=a.detail)&&this.a)switch(a.currentState){case 8:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;
19
+ case 10:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 11:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.L.length?(vU(this),this.f=this.L.shift(),this.f.play()):uU(this);break;case 0:case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};AU.prototype.resume=AU.prototype.resume;AU.prototype.pause=AU.prototype.pause;AU.prototype.getVolume=AU.prototype.getVolume;AU.prototype.setVolume=AU.prototype.setVolume;AU.prototype.getPosition=AU.prototype.getPosition;
20
+ AU.prototype.skip=AU.prototype.skip;_.qp(new class{constructor(){this.Ea=new _.S(oU)}name(){return oU}a(a,b){return a.namespace()!==_.gd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Ea.warn("FreeWheel SDK is not loaded."),!1):!1}create(a){return new AU(a)}});_.Tr(new yU);};f.call(g, window);