@castlabs/prestoplay 6.32.0-beta.3 → 6.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +18 -18
  5. package/cjs/cl.cast.js +126 -126
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +604 -604
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +101 -101
  10. package/cjs/cl.externs.js +1 -29
  11. package/cjs/cl.freewheel.js +26 -26
  12. package/cjs/cl.hls.js +77 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +26 -26
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +352 -352
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -4
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +25 -25
  25. package/cjs/cl.tizen.js +71 -71
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +38 -38
  33. package/cjs/polyfill.min.js +2 -2
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +14 -14
  37. package/cl.cast.js +100 -100
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +488 -487
  40. package/cl.crypto.js +8 -8
  41. package/cl.dash.js +75 -75
  42. package/cl.externs.js +1 -25
  43. package/cl.freewheel.js +20 -20
  44. package/cl.hls.js +65 -65
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +19 -19
  48. package/cl.mediatailor.js +2 -2
  49. package/cl.mse.js +200 -200
  50. package/cl.muxdata.js +12 -12
  51. package/cl.onboard.js +3 -3
  52. package/cl.persistent.js +8 -8
  53. package/cl.playlist.js +4 -4
  54. package/cl.simid.js +2 -2
  55. package/cl.smooth.js +47 -47
  56. package/cl.thumbnails.js +12 -12
  57. package/cl.tizen.js +41 -41
  58. package/cl.ttml.js +10 -10
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +3 -3
  62. package/cl.vtt.js +11 -11
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +27 -27
  65. package/package.json +1 -1
  66. package/typings.d.ts +6 -22
  67. package/cjs/cl.cdn.js +0 -13
  68. package/cl.cdn.js +0 -7
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 rU=function(a){a=_.oi(a);const b=new Uint32Array(4);for(let c=0;4>c;c++)b[c]=a.getUint32(4*c);return b},tU=function(a,b){return c=>_.w(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 sU(a,b,c.data,d.keyInfo,e)}return c})},sU=function(a,b,c,d,e){return _.w(function*(){let f=new ArrayBuffer(0);try{f=yield uU(a,b,d.url)}catch(g){return a.g.warn("Could not fetch AES key",
2
- g),b.onError(new _.I(1,7,7104,null,g)),c}try{const g=a.f?new vU:new wU;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 _.I(1,3,3103,null,g)),c}})},uU=function(a,b,c){return _.w(function*(){const d=_.zk(c),e=(new _.um(c)).a.hostname.endsWith(".drmtoday.com");if(e){var f=b.getConfiguration();_.Bp(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;return a.a[f]=
3
- g.data}catch(g){throw e&&1001===g.code&&412===g.data.status&&a.g.warn("Wrong DRMtoday credentials, server responded with 412."),g;}})},wU=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=null;{const c=
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var qU=function(a){a=_.ki(a);const b=new Uint32Array(4);for(let c=0;4>c;c++)b[c]=a.getUint32(4*c);return b},sU=function(a,b){return c=>_.w(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 rU(a,b,c.data,d.keyInfo,e)}return c})},rU=function(a,b,c,d,e){return _.w(function*(){let f=new ArrayBuffer(0);try{f=yield tU(a,b,d.url)}catch(g){return a.g.warn("Could not fetch AES key",
2
+ g),b.onError(new _.I(1,7,7104,null,g)),c}try{const g=a.f?new uU:new vU;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 _.I(1,3,3103,null,g)),c}})},tU=function(a,b,c){return _.w(function*(){const d=_.vk(c),e=(new _.qm(c)).a.hostname.endsWith(".drmtoday.com");if(e){var f=b.getConfiguration();_.up(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;return a.a[f]=
3
+ g.data}catch(g){throw e&&1001===g.code&&412===g.data.status&&a.g.warn("Wrong DRMtoday credentials, server responded with 412."),g;}})},vU=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=null;{const c=
4
4
  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 v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^v&255^99;c[n]=v;d[v]=n;const y=m[n],A=m[y],E=m[A];let F=257*m[v]^16843008*v;e[n]=F<<24|F>>>8;f[n]=F<<16|F>>>16;g[n]=F<<8|F>>>24;a[n]=F;F=16843009*E^65537*A^257*y^16843008*n;h[v]=F<<24|F>>>8;k[v]=F<<16|F>>>16;l[v]=F<<8|F>>>24;b[v]=F;n?(n=y^m[m[m[E^y]]],
5
- p^=m[m[p]]):n=p=1}}}importKey(a){a=rU(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>>>24]<<24|b[l>>>
6
- 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=rU(b);b=m[0];let n=m[1],p=
7
- m[2];m=m[3];a=_.ni(a);const u=new Int32Array(a.length);let v,y,A;let E,F,C,ja,Ca,Xa,Jb,vb,fc;const gc=this.F.bind(this);for(;c<a.length;){ja=gc(a[c]);Ca=gc(a[c+1]);Xa=gc(a[c+2]);Jb=gc(a[c+3]);E=ja^e[0];F=Jb^e[1];C=Xa^e[2];var Kb=Ca^e[3];vb=4;for(fc=1;fc<d;fc++)v=h[E>>>24]^k[F>>16&255]^l[C>>8&255]^g[Kb&255]^e[vb],y=h[F>>>24]^k[C>>16&255]^l[Kb>>8&255]^g[E&255]^e[vb+1],A=h[C>>>24]^k[Kb>>16&255]^l[E>>8&255]^g[F&255]^e[vb+2],Kb=h[Kb>>>24]^k[E>>16&255]^l[F>>8&255]^g[C&255]^e[vb+3],E=v,F=y,C=A,vb+=4;v=f[E>>>
8
- 24]<<24^f[F>>16&255]<<16^f[C>>8&255]<<8^f[Kb&255]^e[vb];y=f[F>>>24]<<24^f[C>>16&255]<<16^f[Kb>>8&255]<<8^f[E&255]^e[vb+1];A=f[C>>>24]<<24^f[Kb>>16&255]<<16^f[E>>8&255]<<8^f[F&255]^e[vb+2];Kb=f[Kb>>>24]<<24^f[E>>16&255]<<16^f[F>>8&255]<<8^f[C&255]^e[vb+3];vb+=3;u[c]=gc(v^b);u[c+1]=gc(Kb^n);u[c+2]=gc(A^p);u[c+3]=gc(y^m);b=ja;n=Ca;p=Xa;m=Jb;c+=4}return new Promise(kb=>{{var ya=u.buffer;const yb=ya.byteLength,xc=yb&&(new DataView(ya)).getUint8(yb-1);ya=xc?ya.slice(0,yb-xc):ya}kb(ya)})}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 vU=class{constructor(){this.a=null}importKey(a){const b=this;return _.w(function*(){b.a=yield crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"])})}decrypt(a,b){const c=this;return _.w(function*(){return yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a)})}destroy(){this.a=null;return new Promise(a=>a())}};_.x("clpp.crypto.CryptoComponent",class extends _.Ev{constructor(){super();this.a={};this.f=!1;this.g=new _.T("clpp.crypto")}install(){if(window.crypto&&crypto.subtle){var a=crypto.subtle.decrypt;a=typeof crypto.subtle.importKey===_.ae&&typeof a===_.ae}else a=!1;(this.f=a)||this.g.warn("No WebCrypto APIs found. Will fallback to software AES")}playerConstructed(a){const b=tU(this,a);a.getNetworkEngine().Sc(b)}uninstall(){this.a={}}id(){return"crypto"}});};f.call(g, window);
5
+ p^=m[m[p]]):n=p=1}}}importKey(a){a=qU(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>>>24]<<24|b[l>>>
6
+ 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=qU(b);b=m[0];let n=m[1],p=
7
+ m[2];m=m[3];a=_.ji(a);const u=new Int32Array(a.length);let v,y,A;let E,F,C,ja,Ca,Xa,Ib,ub,fc;const gc=this.F.bind(this);for(;c<a.length;){ja=gc(a[c]);Ca=gc(a[c+1]);Xa=gc(a[c+2]);Ib=gc(a[c+3]);E=ja^e[0];F=Ib^e[1];C=Xa^e[2];var Jb=Ca^e[3];ub=4;for(fc=1;fc<d;fc++)v=h[E>>>24]^k[F>>16&255]^l[C>>8&255]^g[Jb&255]^e[ub],y=h[F>>>24]^k[C>>16&255]^l[Jb>>8&255]^g[E&255]^e[ub+1],A=h[C>>>24]^k[Jb>>16&255]^l[E>>8&255]^g[F&255]^e[ub+2],Jb=h[Jb>>>24]^k[E>>16&255]^l[F>>8&255]^g[C&255]^e[ub+3],E=v,F=y,C=A,ub+=4;v=f[E>>>
8
+ 24]<<24^f[F>>16&255]<<16^f[C>>8&255]<<8^f[Jb&255]^e[ub];y=f[F>>>24]<<24^f[C>>16&255]<<16^f[Jb>>8&255]<<8^f[E&255]^e[ub+1];A=f[C>>>24]<<24^f[Jb>>16&255]<<16^f[E>>8&255]<<8^f[F&255]^e[ub+2];Jb=f[Jb>>>24]<<24^f[E>>16&255]<<16^f[F>>8&255]<<8^f[C&255]^e[ub+3];ub+=3;u[c]=gc(v^b);u[c+1]=gc(Jb^n);u[c+2]=gc(A^p);u[c+3]=gc(y^m);b=ja;n=Ca;p=Xa;m=Ib;c+=4}return new Promise(jb=>{{var xa=u.buffer;const xb=xa.byteLength,wc=xb&&(new DataView(xa)).getUint8(xb-1);xa=wc?xa.slice(0,xb-wc):xa}jb(xa)})}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 uU=class{constructor(){this.a=null}importKey(a){const b=this;return _.w(function*(){b.a=yield crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"])})}decrypt(a,b){const c=this;return _.w(function*(){return yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a)})}destroy(){this.a=null;return new Promise(a=>a())}};_.x("clpp.crypto.CryptoComponent",class extends _.Ev{constructor(){super();this.a={};this.f=!1;this.g=new _.T("clpp.crypto")}install(){if(window.crypto&&crypto.subtle){var a=crypto.subtle.decrypt;a=typeof crypto.subtle.importKey===_.be&&typeof a===_.be}else a=!1;(this.f=a)||this.g.warn("No WebCrypto APIs found. Will fallback to software AES")}playerConstructed(a){const b=sU(this,a);a.getNetworkEngine().vd(b)}uninstall(){this.a={}}id(){return"crypto"}});};f.call(g, window);
package/cl.dash.js CHANGED
@@ -1,91 +1,91 @@
1
1
  import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var eM="\x3cms:pro/\x3e lacks content",fM="BaseURL",gM="Channel parsing failure! Ignoring scheme and value",hM="ContentProtection",iM="Empty period duration.",jM="EssentialProperty",kM="Failed to parse UTCTiming tags.",lM="Location",mM="Missing \x3cms:pro/\x3e node in ContentProtection element",nM="No UTCTiming elements found.",oM="SegmentBase does not contain sufficient segment information:",pM="SegmentList does not contain sufficient segment information:",qM="SegmentTemplate does not contain sufficient segment information:",
2
2
  rM="SegmentTimeline",sM="Source is empty. Skipping fit.",tM='The last "S" element cannot have a negative repeat',uM="application",vM="duration",wM="http://dashif.org/guidelines/trickmode",xM="http://www.w3.org/1999/xlink",yM='ignoring the last "S" element.',zM='ignoring the remaining "S" elements.',AM="parse.xml",BM="presentationTimeOffset",CM="schemeIdUri",DM="static",EM="timescale",FM="urn:microsoft:playready",GM="urn:mpeg:cenc:2013",HM="urn:mpeg:dash:utc:http-head:2014",IM="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",
3
- JM="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",KM=function(a,b){return _.Yg[a]=b},LM=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()}},MM=function(a,b,c){const d=new _.Kl;let e=()=>{d.reject(new _.I(_.D,7,7001));return a.abort()};a.V.then(f=>{a.a?d.reject(new _.I(_.D,7,7001)):b?e=LM(b,f,d):d.resolve(f)},f=>{c?e=LM(c,f,d):d.reject(f)});return new _.Rs(d,
4
- ()=>e())},NM=function(a){return new _.Rs(Promise.reject(a),()=>Promise.resolve())},OM=function(a){return new _.Rs(Promise.all(a.map(b=>b.V)),()=>Promise.all(a.map(b=>b.abort())))},PM=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},QM=function(a){return a===_.q||a===_.t},RM=function(a){return 1>=a?0:Math.floor(Math.random()*a)},SM=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:
3
+ JM="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",KM=function(a,b){return _.Ug[a]=b},LM=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()}},MM=function(a,b,c){const d=new _.Gl;let e=()=>{d.reject(new _.I(_.D,7,7001));return a.abort()};a.V.then(f=>{a.a?d.reject(new _.I(_.D,7,7001)):b?e=LM(b,f,d):d.resolve(f)},f=>{c?e=LM(c,f,d):d.reject(f)});return new _.Ms(d,
4
+ ()=>e())},NM=function(a){return new _.Ms(Promise.reject(a),()=>Promise.resolve())},OM=function(a){return new _.Ms(Promise.all(a.map(b=>b.V)),()=>Promise.all(a.map(b=>b.abort())))},PM=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},QM=function(a){return a===_.q||a===_.t},RM=function(a){return 1>=a?0:Math.floor(Math.random()*a)},SM=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
5
  Math.floor(a/1E3)},TM=function(a){if(!a)return null;const b=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(a);if(!b)return _.B("Invalid duration string:",a),null;a=31536E3*Number(b[1]||null)+2592E3*Number(b[2]||null)+86400*Number(b[3]||null)+3600*Number(b[4]||null)+60*Number(b[5]||null)+Number(b[6]||null);return isFinite(a)?a:null},UM=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
6
  Number(b[2]);return isFinite(b)?{start:a,end:b}:null},VM=function(a){a=Number(a);return 0===a%1?a:null},WM=function(a){a=Number(a);return 0===a%1&&0<a?a:null},XM=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},YM=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},ZM=function(a){return a?"true"===a.toLowerCase():!1},$M=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()},aN=function(a,b){b-=a.l;return 0>b||b>=a.j?null:b},bN=function(a){let b=0;for(const c of a)!(0>=c.count)&&c.duration>b&&(b=c.duration);return b},cN=function(a,b){if(0>b||b>=a.a)throw new _.tl(`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.te+f.count-1;if(b<f.te)d=e-1;else if(b>g)c=e+1;else{c=e;break a}}c=-1}if(0>c)throw new _.tl(`SegmentTimelineIndex: index not found: ${b}/${a.a}`);
8
- a=c=a.f[c];b-=c.te;c=a.startTime+b*a.duration;return{startTime:c,endTime:b===a.count-1&&null!=a.Dd?a.Dd:c+a.duration,qj:a.pj+b*a.oj}},dN=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.Dd?c.Dd: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.te+b},eN=function(a,
7
+ b?a.subarray(0,b):a).toString()},aN=function(a,b){b-=a.l;return 0>b||b>=a.j?null:b},bN=function(a){let b=0;for(const c of a)!(0>=c.count)&&c.duration>b&&(b=c.duration);return b},cN=function(a,b){if(0>b||b>=a.a)throw new _.pl(`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.qe+f.count-1;if(b<f.qe)d=e-1;else if(b>g)c=e+1;else{c=e;break a}}c=-1}if(0>c)throw new _.pl(`SegmentTimelineIndex: index not found: ${b}/${a.a}`);
8
+ a=c=a.f[c];b-=c.qe;c=a.startTime+b*a.duration;return{startTime:c,endTime:b===a.count-1&&null!=a.Dd?a.Dd:c+a.duration,lj:a.kj+b*a.jj}},dN=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.Dd?c.Dd: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.qe+b},eN=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 _.B("URL template does not have an available substitution ","for identifier",'"'+h+'":',a),g;"RepresentationID"===h&&k&&(_.B("URL template should not contain a width specifier for identifier",'"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})},iN=function(a,b){var c=fN(a,b,EM);let d=1;c&&(d=WM(c)||1);c=fN(a,b,vM);(c=WM(c||""))&&(c/=d);let e=Number(fN(a,b,BM))||0,f=e/d||0;a.wi&&null!=a.Rd&&a.Rd!==f&&(_.B("The stream is non-compliant with the DASH spec. The value of `presentationTimeOffset` has changed during the transition from dynamic to static manifest, which is not allowed. The last "+
11
- `value will be ignored. (Period ID: ${a.Ja.id}, `+`Representation ID: ${a.O.id})`),e=a.Rd*d,f=a.Rd);var g=fN(a,b,"startNumber");let h=XM(g||"");if(null==g||null==h)h=1;g=fN(a,b,"endNumber");g=null!==g?XM(g||""):null;var k=gN(a,b,rM),l=null;if(k){{l=d;var m=e,n=a.Za.duration||Infinity;const y=_.O;k=y.a(k,"S");const A=[];var p=0;let E=0;for(let F=0;F<k.length;++F){const C=k[F];var u=y.aa(C,"t",XM);const ja=y.aa(C,"d",XM);var v=y.aa(C,"r",VM);null!=u&&(u-=m);if(!ja){_.B('"S" element must have a duration:',
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})},iN=function(a,b){var c=fN(a,b,EM);let d=1;c&&(d=WM(c)||1);c=fN(a,b,vM);(c=WM(c||""))&&(c/=d);let e=Number(fN(a,b,BM))||0,f=e/d||0;a.oi&&null!=a.Rd&&a.Rd!==f&&(_.B("The stream is non-compliant with the DASH spec. The value of `presentationTimeOffset` has changed during the transition from dynamic to static manifest, which is not allowed. The last "+
11
+ `value will be ignored. (Period ID: ${a.Ia.id}, `+`Representation ID: ${a.O.id})`),e=a.Rd*d,f=a.Rd);var g=fN(a,b,"startNumber");let h=XM(g||"");if(null==g||null==h)h=1;g=fN(a,b,"endNumber");g=null!==g?XM(g||""):null;var k=gN(a,b,rM),l=null;if(k){{l=d;var m=e,n=a.Ya.duration||Infinity;const y=_.O;k=y.a(k,"S");const A=[];var p=0;let E=0;for(let F=0;F<k.length;++F){const C=k[F];var u=y.aa(C,"t",XM);const ja=y.aa(C,"d",XM);var v=y.aa(C,"r",VM);null!=u&&(u-=m);if(!ja){_.B('"S" element must have a duration:',
12
12
  zM,C);break}u=null!=u?u:p;v=v||0;if(0>v)if(F+1<k.length){v=y.aa(k[F+1],"t",XM);if(null==v){_.B('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:',zM,C);break}else if(u>=v){_.B('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',zM,C);break}v=Math.ceil((v-u)/ja)-1}else{if(Infinity===n){_.B(tM,"if the Period has an infinite duration:",yM,C);break}else if(u/l>=n){_.B(tM,"if its start time exceeds the Period's duration:",
13
- yM,C);break}v=Math.ceil((n*l-u)/ja)-1}0<A.length&&u!==p&&(Math.abs((u-p)/l)>=_.ou&&_.B("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",C),A[A.length-1].Dd=u/l);p=v+1;A.push({te:E,count:p,startTime:u/l,duration:ja/l,pj:u,oj:ja,Dd:null});E+=p;p=u+p*ja}l=new hN(A)}}a=fN(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,$a:c,Pc:h,cf:g,Sb:f,Rf:e,wa:l,We:b}},fN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ja)].filter(_.Nm).map(d=>
14
- d.getAttribute(c)).reduce((d,e)=>d||e)},gN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ja)].filter(_.Nm).map(d=>_.O.h(d,c)).reduce((d,e)=>d||e)},kN=function(a,b,c,d,e,f){const g=_.O,h=g.getAttributeNS(a,xM,"href"),k=g.getAttributeNS(a,xM,"actuate")||"onRequest";g.Ke(a,xM);if(5<=f)return NM(new _.I(_.D,4,4028));if("onLoad"!==k)return NM(new _.I(_.D,4,4027));const l=_.qB([d],[h]);d=_.zk(l,b);d.type=1;return MM(e.fetch(d),m=>{m=_.ri(m.data);m=g.j(m,a.tagName);if(!m)return NM(new _.I(_.D,4,4001,{uri:h}));
15
- g.Je(a);g.Ae(m,a);g.ze(m,a);return jN(a,b,c,l[0],e,f+1)})},jN=function(a,b,c,d,e,f){f=void 0===f?0:f;var g=_.O;if(g.getAttributeNS(a,xM,"href"))return g=kN(a,b,c,d,e,f),c&&(g=MM(g,void 0,()=>jN(a,b,c,d,e,f))),g;const h=[],k=g.ve(a);for(const l of k)"urn:mpeg:dash:resolve-to-zero:2013"===g.getAttributeNS(l,xM,"href")?g.removeChild(a,l):l.tagName!==rM&&h.push(jN(l,b,c,d,e,f));return MM(OM(h),()=>a)},lN=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.Jg||_.kC(a.presentationTimeline,{pc:b.pc+c,ac:b.ac+c,bc:b.bc},"notifySegmentSummary")},mN=function(a){return""===a.id?`${a.schemeIdUri}:${a.startTime}:${a.endTime}`:a.id},nN=function(a,b,c,d,e){return _.w(function*(){const f=_.ZB(a,b,c,e);f.type=2;return(yield _.tm(d,f,{objectType:"i"}).V).data})},oN=function(a,b){b-=a.h;return 0>b||b>=a.f?null:b},qN=function(a,b,c,d){let e;var f=(new _.np).fa("sidx",g=>{e=pN(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=
17
- c[0];a=_.G(a);_.Dh('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.I(_.D,3,3004,{url:g,Bj:f,size:a.byteLength,Rj:$M(a)});}},pN=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.N(d.reader);if(0===f)throw _.Dh("Invalid timescale."),new _.I(_.D,3,3005);if(0===d.version){var g=_.N(d.reader);var h=_.N(d.reader)}else g=_.bp(d.reader),h=_.bp(d.reader);d.reader.skip(2);const k=_.$o(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.N(d.reader);const m=(l&2147483648)>>>
18
- 31;l&=2147483647;const n=_.N(d.reader);d.reader.skip(4);if(1===m)throw _.Dh("Hierarchical SIDXs are not supported."),new _.I(_.D,3,3006);e.push(new _.rI(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},rN=function(a){var b=_.Zo(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.I(_.D,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Zo(a.a);return d},uN=function(a){var b=rN(a);if(7<b.length)throw new _.I(_.D,3,3002);var c=0;for(var d=0;d<b.length;d++)c=
19
- 256*c+b[d];b=c;c=rN(a);a:{for(e of sN)if(_.hm(c,new Uint8Array(e))){var e=!0;break a}e=!1}if(e)c=a.f.byteLength-a.a.getPosition();else{if(8===c.length&&c[1]&224)throw new _.I(_.D,3,3001);e=c[0]&(1<<8-c.length)-1;for(d=1;d<c.length;d++)e=256*e+c[d];c=e}c=a.a.getPosition()+c<=a.f.byteLength?c:a.f.byteLength-a.a.getPosition();e=new DataView(a.f.buffer,a.f.byteOffset+a.a.getPosition(),c);a.a.skip(c);return new tN(b,e)},vN=function(a){if(8<a.a.byteLength)throw new _.I(_.D,3,3002);if(8===a.a.byteLength&&
20
- a.a.getUint8(0)&224)throw new _.I(_.D,3,3001);let b=0;for(let c=0;c<a.a.byteLength;c++){const d=a.a.getUint8(c);b=256*b+d}return b},yN=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new wN(a.a);let k=null,l=null;for(;_.Xo(a.a);){var m=uN(a);if(187===m.id){var n=xN(m);n&&(m=c*n.rj,n=b+n.Ti,null!=k&&g.push(new _.rI(g.length,k-f,m-f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.rI(g.length,k-f,d-f,h,l,null,f));return g},xN=function(a){var b=new wN(a.a);a=uN(b);if(179!==a.id)throw _.B("Not a CueTime element."),
21
- new _.I(_.D,3,3013);a=vN(a);b=uN(b);if(183!==b.id)throw _.B("Not a CueTrackPositions element."),new _.I(_.D,3,3012);b=new wN(b.a);let c=0;for(;_.Xo(b.a);){const d=uN(b);if(241===d.id){c=vN(d);break}}return{rj:a,Ti:c}},zN=function(a,b){var c=gN(a,b,"Initialization");if(!c)return null;let d=a.O.qa;b=()=>"";const e=c.getAttribute("sourceURL")||void 0;e&&(d=_.qB(a.O.qa,[e]),b=()=>e);let f=0,g=null;if(c=_.O.aa(c,"range",UM))f=c.start,g=c.end;return new _.qI(()=>d,f,g,null,null,b,a.O.Ha)},AN=function(a){return a.Zd},
22
- CN=function(a,b,c,d,e,f,g){const h=a.presentationTimeline,k=!a.bf||!a.Za.si,l=a.Za.start,m=a.Za.duration;let n=null;return{createSegmentIndex:function(p,u){return _.w(function*(){var v=[nN(c,d,e,p,u),"webm"===f?nN(b.Da(),b.na,b.ja,p,u):null];v=yield Promise.all(v);var y=v[0];const A=v[1]||null;y="mp4"===f?qN(y,d,c,g):(new BN).parse(y,A,c,g);QM(a.O.contentType)&&_.lC(h,y,l);n=new _.vI(y);k&&_.VB(n,m);return v})},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}},DN=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}},EN=function(a,b){var c,d=a.a.B(b);if(!d)throw new _.tl(`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.qe:g.position===e&&(f+=g.qe);e=c;
13
+ yM,C);break}v=Math.ceil((n*l-u)/ja)-1}0<A.length&&u!==p&&(Math.abs((u-p)/l)>=_.ju&&_.B("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",C),A[A.length-1].Dd=u/l);p=v+1;A.push({qe:E,count:p,startTime:u/l,duration:ja/l,kj:u,jj:ja,Dd:null});E+=p;p=u+p*ja}l=new hN(A)}}a=fN(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,Za:c,Pc:h,Ye:g,Sb:f,Lf:e,wa:l,Re:b}},fN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ia)].filter(_.Jm).map(d=>
14
+ d.getAttribute(c)).reduce((d,e)=>d||e)},gN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ia)].filter(_.Jm).map(d=>_.O.h(d,c)).reduce((d,e)=>d||e)},kN=function(a,b,c,d,e,f){const g=_.O,h=g.getAttributeNS(a,xM,"href"),k=g.getAttributeNS(a,xM,"actuate")||"onRequest";g.He(a,xM);if(5<=f)return NM(new _.I(_.D,4,4028));if("onLoad"!==k)return NM(new _.I(_.D,4,4027));const l=_.qB([d],[h]);d=_.vk(l,b);d.type=1;return MM(e.fetch(d),m=>{m=_.ni(m.data);m=g.j(m,a.tagName);if(!m)return NM(new _.I(_.D,4,4001,{uri:h}));
15
+ g.Ge(a);g.xe(m,a);g.we(m,a);return jN(a,b,c,l[0],e,f+1)})},jN=function(a,b,c,d,e,f){f=void 0===f?0:f;var g=_.O;if(g.getAttributeNS(a,xM,"href"))return g=kN(a,b,c,d,e,f),c&&(g=MM(g,void 0,()=>jN(a,b,c,d,e,f))),g;const h=[],k=g.se(a);for(const l of k)"urn:mpeg:dash:resolve-to-zero:2013"===g.getAttributeNS(l,xM,"href")?g.removeChild(a,l):l.tagName!==rM&&h.push(jN(l,b,c,d,e,f));return MM(OM(h),()=>a)},lN=function(a,b){const c=a.Ya.start;var d=a.presentationTimeline;d.o||(d.I=Math.floor(Math.max(d.I||
16
+ 0,b.ac+c)));a.Eg||_.kC(a.presentationTimeline,{pc:b.pc+c,ac:b.ac+c,bc:b.bc},"notifySegmentSummary")},mN=function(a){return""===a.id?`${a.schemeIdUri}:${a.startTime}:${a.endTime}`:a.id},nN=function(a,b,c,d,e){return _.w(function*(){const f=_.ZB(a,b,c,e);f.type=2;return(yield _.pm(d,f,{objectType:"i"}).V).data})},oN=function(a,b){b-=a.h;return 0>b||b>=a.f?null:b},qN=function(a,b,c,d){let e;var f=(new _.ip).fa("sidx",g=>{e=pN(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=
17
+ c[0];a=_.G(a);_.zh('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.I(_.D,3,3004,{url:g,xj:f,size:a.byteLength,Nj:$M(a)});}},pN=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.N(d.reader);if(0===f)throw _.zh("Invalid timescale."),new _.I(_.D,3,3005);if(0===d.version){var g=_.N(d.reader);var h=_.N(d.reader)}else g=_.Xo(d.reader),h=_.Xo(d.reader);d.reader.skip(2);const k=_.Vo(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.N(d.reader);const m=(l&2147483648)>>>
18
+ 31;l&=2147483647;const n=_.N(d.reader);d.reader.skip(4);if(1===m)throw _.zh("Hierarchical SIDXs are not supported."),new _.I(_.D,3,3006);e.push(new _.rI(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},rN=function(a){var b=_.Uo(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.I(_.D,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Uo(a.a);return d},uN=function(a){var b=rN(a);if(7<b.length)throw new _.I(_.D,3,3002);var c=0;for(var d=0;d<b.length;d++)c=
19
+ 256*c+b[d];b=c;c=rN(a);a:{for(e of sN)if(_.dm(c,new Uint8Array(e))){var e=!0;break a}e=!1}if(e)c=a.f.byteLength-a.a.getPosition();else{if(8===c.length&&c[1]&224)throw new _.I(_.D,3,3001);e=c[0]&(1<<8-c.length)-1;for(d=1;d<c.length;d++)e=256*e+c[d];c=e}c=a.a.getPosition()+c<=a.f.byteLength?c:a.f.byteLength-a.a.getPosition();e=new DataView(a.f.buffer,a.f.byteOffset+a.a.getPosition(),c);a.a.skip(c);return new tN(b,e)},vN=function(a){if(8<a.a.byteLength)throw new _.I(_.D,3,3002);if(8===a.a.byteLength&&
20
+ a.a.getUint8(0)&224)throw new _.I(_.D,3,3001);let b=0;for(let c=0;c<a.a.byteLength;c++){const d=a.a.getUint8(c);b=256*b+d}return b},yN=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new wN(a.a);let k=null,l=null;for(;_.So(a.a);){var m=uN(a);if(187===m.id){var n=xN(m);n&&(m=c*n.mj,n=b+n.Oi,null!=k&&g.push(new _.rI(g.length,k-f,m-f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.rI(g.length,k-f,d-f,h,l,null,f));return g},xN=function(a){var b=new wN(a.a);a=uN(b);if(179!==a.id)throw _.B("Not a CueTime element."),
21
+ new _.I(_.D,3,3013);a=vN(a);b=uN(b);if(183!==b.id)throw _.B("Not a CueTrackPositions element."),new _.I(_.D,3,3012);b=new wN(b.a);let c=0;for(;_.So(b.a);){const d=uN(b);if(241===d.id){c=vN(d);break}}return{mj:a,Oi:c}},zN=function(a,b){var c=gN(a,b,"Initialization");if(!c)return null;let d=a.O.qa;b=()=>"";const e=c.getAttribute("sourceURL")||void 0;e&&(d=_.qB(a.O.qa,[e]),b=()=>e);let f=0,g=null;if(c=_.O.aa(c,"range",UM))f=c.start,g=c.end;return new _.qI(()=>d,f,g,null,null,b,a.O.Ga)},AN=function(a){return a.Yd},
22
+ CN=function(a,b,c,d,e,f,g){const h=a.presentationTimeline,k=!a.Xe||!a.Ya.mi,l=a.Ya.start,m=a.Ya.duration;let n=null;return{createSegmentIndex:function(p,u){return _.w(function*(){var v=[nN(c,d,e,p,u),"webm"===f?nN(b.Da(),b.na,b.ja,p,u):null];v=yield Promise.all(v);var y=v[0];const A=v[1]||null;y="mp4"===f?qN(y,d,c,g):(new BN).parse(y,A,c,g);QM(a.O.contentType)&&_.lC(h,y,l);n=new _.vI(y);k&&_.VB(n,m);return v})},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}},DN=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}},EN=function(a,b){var c,d=a.a.B(b);if(!d)throw new _.pl(`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.ne:g.position===e&&(f+=g.ne);e=c;
24
24
  c=f;f=d.startTime+e;d=d.endTime+e+c;e=DN(a);a.j&&b===e.Zb&&(d+=a.j);return{startTime:f,endTime:d}},FN=function(a,b){return(a=DN(a))?b>=a.Kb&&b<=a.Zb:!1},GN=function(a){var b=DN(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=EN(a,b.Kb);b=EN(a,b.Zb);return(a=a.a.C())?{pc:c.startTime,ac:b.endTime,bc:a.bc}:null},HN=function(a,b){if(null===b||Infinity===b)a.g.warn(`Period duration is ${b}. Skipping fit.`);else{var c=DN(a);c?(c=a.a.B(c.Zb),c.startTime>=b||(a.j=
25
25
  b-c.endTime)):a.g.warn(sM)}},IN=function(a,b){var c=DN(a);if(c){var d=c.Kb;c=c.Zb;for(var e=c+1;d<=c;d++)if(EN(a,d).endTime>b){e=d;break}a.l=e}else a.g.warn(sM)},JN=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},KN=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=JN(a,b);if(null!=d)a.f=d;else throw a.g.error("Segments could not be updated, overlapping position not found."),new _.I(_.D,4,4014);c()}},MN=function(a,b,c){const d=a.Za.duration;if(!a.bf)return a=new LN(b),IN(a,0),HN(a,d),a;{var e=a.Ja;const f=a.O;e=e&&e.id&&f&&f.id?`${e.id},${f.id}`:null}if(!a.Jg||null==c[e])return a=new LN(b),IN(a,0),HN(a,d),c[e]=a;c=c[e];KN(c,b);IN(c,_.oC(a.presentationTimeline)-
27
- a.Za.start);HN(c,d);return c},ON=function(a){const b=fN(a,NN,"initialization");if(!b)return null;const c=a.O.id,d=a.bandwidth||null,e=a.O.qa,f=()=>eN(b,c,null,d,null);return new _.qI(function(){const g=f();return _.qB(e,[g])},0,null,null,null,f,a.O.Ha)},PN=function(a,b){const c=b.kf,d=a.Za.duration,e=b.$a,f=b.Pc,g=b.cf,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 v=p*e;let y=v+e;d&&(y=Math.min(y,d));if(0>y||d&&v>=d)return null;const A=()=>eN(c,l,u,k,v*h);return new _.rI(p,v,y,function(){const E=A();return _.qB(m,[E])},0,null,b.Sb,null,null,null,null,null,null,null,null,A,n)},adjustSegmentDurations:()=>{},getDuration:()=>d,getLastSegmentEndTime:()=>d}},NN=function(a){return a.uc},QN=function(a){return a.tc},RN=function(a){return[a.O.tc,a.xa.tc,a.Ja.tc].filter(_.Nm).map(b=>_.O.a(b,
29
- "SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.ff&&(a.ff=!0,_.B("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate."));const c=b.getAttribute("media");b=_.O.aa(b,"mediaRange",UM,{start:0,end:null});return{Lg:c,start:b.start,end:b.end}})},TN=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(CM),value:e.getAttribute(_.vg)}));const d=a.a.clockSyncUri;
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=JN(a,b);if(null!=d)a.f=d;else throw a.g.error("Segments could not be updated, overlapping position not found."),new _.I(_.D,4,4014);c()}},MN=function(a,b,c){const d=a.Ya.duration;if(!a.Xe)return a=new LN(b),IN(a,0),HN(a,d),a;{var e=a.Ia;const f=a.O;e=e&&e.id&&f&&f.id?`${e.id},${f.id}`:null}if(!a.Eg||null==c[e])return a=new LN(b),IN(a,0),HN(a,d),c[e]=a;c=c[e];KN(c,b);IN(c,_.oC(a.presentationTimeline)-
27
+ a.Ya.start);HN(c,d);return c},ON=function(a){const b=fN(a,NN,"initialization");if(!b)return null;const c=a.O.id,d=a.bandwidth||null,e=a.O.qa,f=()=>eN(b,c,null,d,null);return new _.qI(function(){const g=f();return _.qB(e,[g])},0,null,null,null,f,a.O.Ga)},PN=function(a,b){const c=b.ef,d=a.Ya.duration,e=b.Za,f=b.Pc,g=b.Ye,h=b.timescale,k=a.bandwidth||null,l=a.O.id,m=a.O.qa,n=a.O.Ga;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 v=p*e;let y=v+e;d&&(y=Math.min(y,d));if(0>y||d&&v>=d)return null;const A=()=>eN(c,l,u,k,v*h);return new _.rI(p,v,y,function(){const E=A();return _.qB(m,[E])},0,null,b.Sb,null,null,null,null,null,null,null,null,A,n)},adjustSegmentDurations:()=>{},getDuration:()=>d,getLastSegmentEndTime:()=>d}},NN=function(a){return a.uc},QN=function(a){return a.tc},RN=function(a){return[a.O.tc,a.xa.tc,a.Ia.tc].filter(_.Jm).map(b=>_.O.a(b,
29
+ "SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.af&&(a.af=!0,_.B("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate."));const c=b.getAttribute("media");b=_.O.aa(b,"mediaRange",UM,{start:0,end:null});return{Gg:c,start:b.start,end:b.end}})},TN=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(CM),value:e.getAttribute(_.vg)}));const d=a.a.clockSyncUri;
30
30
  !c.length&&d&&(a.g.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),c.push({scheme:HM,value:d}));return 0===c.length?(a.g.warn(nM),Promise.reject(Error(nM))):PM(c,e=>{const f=e.scheme;e=e.value;switch(f){case HM:case "urn:mpeg:dash:utc:http-head:2012":return SN(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 SN(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
32
  {a.g.warn(kM);return Promise.reject(Error(kM))})},UN=function(a,b,c,d){return _.w(function*(){const e=_.O.a(b,"UTCTiming");try{const f=yield TN(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})},SN=function(a,b,c,d){return _.w(function*(){var e=_.qB(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=_.ri(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()})},WN=function(a,b){return a.find(c=>VN.get(c.fc)===b)},YN=function(a){const b=_.O;var c=b.Wb(a.node,FM,"pro");if(!c)return XN.warn(mM,a),null;c=b.f(c);if(!c)return XN.warn(eM,a),null;a=_.em(c);a=_.rq(a);a=_.jq(a.a);return{keyId:null,fc:JM,node:b.Vc(),init:[{initData:_.dB(a),
34
- initDataType:_.Wc,keyId:null}]}},ZN=function(a,b){b=void 0===b?"4.0.0.0":b;const c=_.O;a=c.Wb(a.node,GM,"pssh");if(!a)return null;a=c.f(a);if(!a)return null;a=_.em(a);a=_.lq(a);return a?(b=_.eB(b,a.a))?{keyId:null,fc:IM,node:c.Vc(),init:[{initData:_.dB(b),initDataType:_.Wc,keyId:null}]}:null:(_.B("Unable to parse WV PSSH data. Can not create PR data!"),null)},$N=function(a,b){const c=_.O;var d=c.Wb(a.node,FM,"pro");if(!d)return _.B(mM,a),null;d=c.f(d);if(!d)return _.B(eM,a),null;a=_.em(d);a=_.rq(a);
35
- return a.version!==b&&(_.Ch(`Parsing from ${a.version} to ${b}.`),a=_.fB(a,b))?{keyId:null,fc:IM,node:c.Vc(),init:[{initData:_.dB(a),initDataType:_.Wc,keyId:null}]}:null},cO=function(a,b,c,d){const e=aO(a);let f=null;a=[];let g=[];const h=WN(e,_.wd),k=WN(e,_.ud);if(k&&d){var l=$N(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=YN(k))&&e.push(l);h&&!k&&(d=ZN(h,d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.I(_.D,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"===
36
- m.fc?(f=m.init||f,!1):!0),g.length&&(a=bO(f,g,c),0===a.length&&(a=[_.rB(_.He,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of VN.values())m!==_.Re&&a.push(_.rB(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{zd:b,Ej:f,drmInfos:a,ug:!0}},aO=function(a){const b=[];for(const c of a)(a=dO(c))&&b.push(a);return b},bO=function(a,b,c){const d=[];for(const f of b){var e=VN.get(f.fc);if(e){b=_.rB(e,f.init||a,c);if(e=eO.get(e))(e=e(f))?(b.licenseServerUri=
37
- e.licenseUrl,b.licenseServerUriOrigin=e.origin):b.licenseServerUri="";d.push(b)}}return d},fO=function(a,b,c,d,e){const f=cO(a,c,d,e);if(b.ug){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.zd=f.zd||b.zd;b.ug=!1}else if(0<f.drmInfos.length&&(b.drmInfos=b.drmInfos.filter(g=>f.drmInfos.some(h=>h.keySystem===g.keySystem)),0===b.drmInfos.length))throw new _.I(_.D,4,4008);return f.zd||b.zd},gO=function(a){const b=_.O;a=
38
- b.Ec(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[RM(a.length)]},dO=function(a){const b=_.O;let c=a.getAttribute(CM),d=b.getAttributeNS(a,GM,"default_KID");const e=b.Ec(a,GM,"pssh").map(b.f),f=b.Wb(a,FM,"pro");if(!c)return _.Dh("Missing required schemeIdUri attribute on","ContentProtection element",a),null;c=c.toLowerCase();if(d&&(d=d.replace(/-/g,"").toLowerCase(),d.includes(" ")))throw new _.I(_.D,4,4009);let g=[];try{if(g=
39
- e.map(h=>({initDataType:_.Wc,initData:_.em(h),keyId:null})),0===g.length&&f&&b.f(f))try{const h=b.f(f),k=_.em(h),l=_.rq(k);g.push({initDataType:_.Wc,initData:_.dB(l),keyId:null})}catch(h){_.B("Unable to parse ms:pro payload",h),g=[]}}catch(h){throw new _.I(_.D,4,4007);}return{node:a,fc:c,keyId:d,init:0<g.length?g:null}},hO=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=_.O.f(e);f&&e&&d.push({serviceLocationId:f,uri:e,params:{}})});if(d.length)return a=new _.zI(c,d),b.push(a),a}return null},jO=function(a,b){a=iO(a).filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime());0<a.length&&(a=Math.min(...a),_.jC(b.presentationTimeline,a+b.Za.start))},kO=function(a,b){return _.$B(_.Xm(a,b))?_.K:a.split("/")[0]},iO=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)},mO=function(a){return _.w(function*(){var b=a.w?a.w.getBaseUriCollectionById(lM):null;var c=[];b&&(c=_.TC(b,""));0===c.length&&(c=a.o);var d=_.zk(c,a.a.attemptParameters);d.type=1;c=Date.now();d=a.D.networkingEngine.fetch(d);_.Jl(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 lO(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;_.XB(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.nj){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.H(_.Fe))}return b})},nO=function(a,b){0>a.l||a.B.la(Math.max(3,a.l-b,_.YB(a.I)))},lO=function(a,b,c){return _.w(function*(){var d=_.ri(b);_.zm(AM);d=_.O.j(d,"MPD");
43
- _.zm("parse.xml.end");_.Bm(AM,AM,"parse.xml.end");if(!d)throw new _.I(_.D,4,4001,c);d=jN(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.Jl(a.A,d);d=yield d.V;return oO(a,d,c)})},oO=function(a,b,c){return _.w(function*(){var d=_.O;const e=[];var f=[c],g=d.a(b,lM),h=g.map(d.f).filter(_.Nm);0<h.length&&(f=_.qB(f,h),a.o=f,hO(g,e,lM));g=d.a(b,fM);h=g.map(d.f);var k=_.qB(f,h);hO(g,e,fM);f=b.getAttribute("type")||DM;a.l=d.aa(b,"minimumUpdatePeriod",TM,-1);f===DM&&0<=a.l&&(a.g.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),
33
+ "expected date header"),Error("Date HTTP header missing.");e=e.headers.date}else e=_.ni(e.data);e=Date.parse(e);if(isNaN(e))throw a.g.warn("Unable to parse date from UTC timing response"),Error("Date value invalid.");return e-Date.now()})},WN=function(a,b){return a.find(c=>VN.get(c.fc)===b)},YN=function(a){const b=_.O;var c=b.Wb(a.node,FM,"pro");if(!c)return XN.warn(mM,a),null;c=b.f(c);if(!c)return XN.warn(eM,a),null;a=_.am(c);a=_.hq(a);a=_.$p(a.a);return{keyId:null,fc:JM,node:b.Uc(),init:[{initData:_.dB(a),
34
+ initDataType:_.Xc,keyId:null}]}},ZN=function(a,b){b=void 0===b?"4.0.0.0":b;const c=_.O;a=c.Wb(a.node,GM,"pssh");if(!a)return null;a=c.f(a);if(!a)return null;a=_.am(a);a=_.bq(a);return a?(b=_.eB(b,a.a))?{keyId:null,fc:IM,node:c.Uc(),init:[{initData:_.dB(b),initDataType:_.Xc,keyId:null}]}:null:(_.B("Unable to parse WV PSSH data. Can not create PR data!"),null)},$N=function(a,b){const c=_.O;var d=c.Wb(a.node,FM,"pro");if(!d)return _.B(mM,a),null;d=c.f(d);if(!d)return _.B(eM,a),null;a=_.am(d);a=_.hq(a);
35
+ return a.version!==b&&(_.yh(`Parsing from ${a.version} to ${b}.`),a=_.fB(a,b))?{keyId:null,fc:IM,node:c.Uc(),init:[{initData:_.dB(a),initDataType:_.Xc,keyId:null}]}:null},cO=function(a,b,c,d){const e=aO(a);let f=null;a=[];let g=[];const h=WN(e,_.xd),k=WN(e,_.vd);if(k&&d){var l=$N(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=YN(k))&&e.push(l);h&&!k&&(d=ZN(h,d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.I(_.D,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"===
36
+ m.fc?(f=m.init||f,!1):!0),g.length&&(a=bO(f,g,c),0===a.length&&(a=[_.rB(_.He,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of VN.values())m!==_.Re&&a.push(_.rB(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{zd:b,Aj:f,drmInfos:a,pg:!0}},aO=function(a){const b=[];for(const c of a)(a=dO(c))&&b.push(a);return b},bO=function(a,b,c){const d=[];for(const f of b){var e=VN.get(f.fc);if(e){b=_.rB(e,f.init||a,c);if(e=eO.get(e))(e=e(f))?(b.licenseServerUri=
37
+ e.licenseUrl,b.licenseServerUriOrigin=e.origin):b.licenseServerUri="";d.push(b)}}return d},fO=function(a,b,c,d,e){const f=cO(a,c,d,e);if(b.pg){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.zd=f.zd||b.zd;b.pg=!1}else if(0<f.drmInfos.length&&(b.drmInfos=b.drmInfos.filter(g=>f.drmInfos.some(h=>h.keySystem===g.keySystem)),0===b.drmInfos.length))throw new _.I(_.D,4,4008);return f.zd||b.zd},gO=function(a){const b=_.O;a=
38
+ b.Ec(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[RM(a.length)]},dO=function(a){const b=_.O;let c=a.getAttribute(CM),d=b.getAttributeNS(a,GM,"default_KID");const e=b.Ec(a,GM,"pssh").map(b.f),f=b.Wb(a,FM,"pro");if(!c)return _.zh("Missing required schemeIdUri attribute on","ContentProtection element",a),null;c=c.toLowerCase();if(d&&(d=d.replace(/-/g,"").toLowerCase(),d.includes(" ")))throw new _.I(_.D,4,4009);let g=[];try{if(g=
39
+ e.map(h=>({initDataType:_.Xc,initData:_.am(h),keyId:null})),0===g.length&&f&&b.f(f))try{const h=b.f(f),k=_.am(h),l=_.hq(k);g.push({initDataType:_.Xc,initData:_.dB(l),keyId:null})}catch(h){_.B("Unable to parse ms:pro payload",h),g=[]}}catch(h){throw new _.I(_.D,4,4007);}return{node:a,fc:c,keyId:d,init:0<g.length?g:null}},hO=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=_.O.f(e);f&&e&&d.push({serviceLocationId:f,uri:e,params:{}})});if(d.length)return a=new _.zI(c,d),b.push(a),a}return null},jO=function(a,b){a=iO(a).filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime());0<a.length&&(a=Math.min(...a),_.jC(b.presentationTimeline,a+b.Ya.start))},kO=function(a,b){return _.$B(_.Tm(a,b))?_.K:a.split("/")[0]},iO=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)},mO=function(a){return _.w(function*(){var b=a.w?a.w.getBaseUriCollectionById(lM):null;var c=[];b&&(c=_.TC(b,""));0===c.length&&(c=a.o);var d=_.vk(c,a.a.attemptParameters);d.type=1;c=Date.now();d=a.D.networkingEngine.fetch(d);_.Fl(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 lO(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;_.XB(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.ij){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.H(_.Fe))}return b})},nO=function(a,b){0>a.l||a.B.la(Math.max(3,a.l-b,_.YB(a.I)))},lO=function(a,b,c){return _.w(function*(){var d=_.ni(b);_.vm(AM);d=_.O.j(d,"MPD");
43
+ _.vm("parse.xml.end");_.xm(AM,AM,"parse.xml.end");if(!d)throw new _.I(_.D,4,4001,c);d=jN(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.Fl(a.A,d);d=yield d.V;return oO(a,d,c)})},oO=function(a,b,c){return _.w(function*(){var d=_.O;const e=[];var f=[c],g=d.a(b,lM),h=g.map(d.f).filter(_.Jm);0<h.length&&(f=_.qB(f,h),a.o=f,hO(g,e,lM));g=d.a(b,fM);h=g.map(d.f);var k=_.qB(f,h);hO(g,e,fM);f=b.getAttribute("type")||DM;a.l=d.aa(b,"minimumUpdatePeriod",TM,-1);f===DM&&0<=a.l&&(a.g.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),
44
44
  a.l=-1,a.B.stop());g=d.aa(b,"maxSegmentDuration",TM);if(d=f===DM&&"dynamic"===a.C)a.g.info("MPD dynamic to static transition."),f="dynamic";h=f===DM;var l="dynamic"===f;if(a.f)var m=a.f.presentationTimeline;else{var n=_.O;m=a.a.timeline||{};var p=n.aa(b,"suggestedPresentationDelay",TM),u=n.aa(b,"minBufferTime",TM,0);p=null!=a.a.suggestedPresentationDelay?a.a.suggestedPresentationDelay:a.a.lowLatencyMode?0:null!=p?p:3*u;n=n.aa(b,"availabilityStartTime",SM);m=new _.uI(m,n,p,h,!!a.a.autoCorrectDrift,
45
- !!a.a.lowLatencyMode);m=h?m:UN(a.J,b,k,m)}m=yield m;n=_.O.aa(b,"timeShiftBufferDepth",TM);n=l&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)?a.a.availabilityWindowOverride:null===n?Infinity:n;m.A=n;if(!a.D)throw new _.I(_.D,7,7001);n={bf:l,Jg:null!=a.f,presentationTimeline:m,Ja:null,Za:null,xa:null,O:null,bandwidth:0,ff:!1,wi:d,hc:null,Rd:null};k=pO(a,n,k,e,b);p=k.duration;l=k.periods;d&&(jO(l,n),m.C=!0);if(h||!d&&!k.rg)m.f=p||Infinity;if(2===a.a.timeline.version){h=p;n=l[0].startTime;
45
+ !!a.a.lowLatencyMode);m=h?m:UN(a.J,b,k,m)}m=yield m;n=_.O.aa(b,"timeShiftBufferDepth",TM);n=l&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)?a.a.availabilityWindowOverride:null===n?Infinity:n;m.A=n;if(!a.D)throw new _.I(_.D,7,7001);n={Xe:l,Eg:null!=a.f,presentationTimeline:m,Ia:null,Ya:null,xa:null,O:null,bandwidth:0,af:!1,oi:d,hc:null,Rd:null};k=pO(a,n,k,e,b);p=k.duration;l=k.periods;d&&(jO(l,n),m.C=!0);if(h||!d&&!k.mg)m.f=p||Infinity;if(2===a.a.timeline.version){h=p;n=l[0].startTime;
46
46
  if(null==h||Infinity===h)h=qO(l);p=m.a;_.dC(p,n,n+h);d&&(p.f=!0)}_.mC(m,g||1);m.isLive()||Infinity!==m.f&&!m.o||2===m.j.version&&m.a.getDuration();if(!a.f){a.f={presentationTimeline:m,periods:l,minBufferTime:0,cues:[]};a:{l=_.O;if(m=l.h(b,"ContentSteering"))if(g=m.getAttribute("defaultServiceLocation")||"",h=l.f(m)){l=l.aa(m,"queryBeforeStart",ZM,!1);g={manifestType:_.vc,contentSteeringServerUri:h,defaultServiceLocation:g,queryBeforeStart:l||!1,baseUriCollections:[]};break a}g=null}g&&(a.f.contentSteering=
47
- g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,nj:d}})},pO=function(a,b,c,d,e){const f=_.O,g=f.aa(e,"mediaPresentationDuration",TM),h=a.f?a.f.periods[a.f.periods.length-1]||null:null;var k=[];const l=[];var m=0;e=f.a(e,"Period");for(let v=0;v<e.length;v++){var n=e[v];m=f.aa(n,_.Qf,TM,m);var p=f.aa(n,vM,TM);let y=null;if(v!==e.length-1){var u=f.aa(e[v+1],_.Qf,TM);null!=u&&(y=u-m)}else null!=g&&(y=g-m);u=_.ou;y&&p&&Math.abs(y-p)>u&&a.g.warn("There is a gap/overlap between Periods",
48
- n);null==y&&(y=p);n=rO(a,b,c,d,{start:m,duration:y,node:n,si:null==y||v===e.length-1});p=n.Ja;l.push(p);k=k.concat(n.cues);a.G.includes(p.id)||(a.G.push(p.id),a.f&&(a.D.filterNewPeriod(p),a.f.periods.push(p)));if(null==y){v!==e.length-1&&a.g.warn("Skipping Period",v+1,"and any subsequent Periods:","Period",v+1,"does not have a valid start time.",l[v+1]);m=null;break}m+=y}null==a.f&&a.D.filterAllPeriods(l);h&&(b=l.find(v=>v.id===h.id))&&(h.endTime=b.endTime);k=sO(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,rg:!1,cues:k}):{periods:l,duration:m,rg:!0,cues:k}},qO=function(a){return a.map(b=>b.variants[0].video||b.variants[0].audio).reduce((b,c)=>c?c.getDuration():0+b,0)},rO=function(a,b,c,d,e){var f=_.O;b.Ja=tO(a,e.node,null,c,d);b.Za=e;c=b.Ja.id||`__clpp_period_${e.start}`;b.Ja.id||(a.g.info("No Period ID given for Period with start time "+e.start+`, Assigning a default: ${c}.`),b.Ja.id=c);d=f.a(e.node,"EventStream").flatMap(A=>uO(a,e.start,e.duration,A));f=f.a(e.node,
50
- _.fa).map(A=>vO(a,b,A)).filter(_.Nm);if(b.bf){var g=[];for(var h of f)for(var k of h.Vi)g.push(k);if(g.length!==(new Set(g)).size)throw new _.I(_.D,4,4018);}h=f.filter(A=>!A.Pf);k=f.filter(A=>A.Pf);for(var l of k){l.streams.forEach(A=>{A.trickPlay=!0});k=l.streams[0];g=l.Pf;for(var m of h)if(g.includes(m.id))for(var n of m.streams)n.trickModeVideo=k}m=wO(f,_.t);n=wO(h,_.q);if(!m.length&&!n.length)throw new _.I(_.D,4,4004);n.length||(n=[null]);m.length||(m=[null]);l=[];for(var p of n)for(var u of m)xO(a,
51
- p,u,l);u=[...wO(h,_.K),...wO(h,_.VA)];p=[];for(var v of u)p.push.apply(p,v.streams);u=wO(h,_.he);v=[];for(var y of u)v.push.apply(v,y.streams);y=yO(e,h);return{Ja:{id:c,configurationId:a.D.configurationId,startTime:e.start,endTime:y,textStreams:p,thumbStreams:v,variants:l},cues:d}},sO=function(a,b){const c=new Set(b.map(mN));a.j.forEach((d,e)=>{c.has(e)||a.j.delete(e)});b.forEach(d=>{const e=mN(d);a.j.has(e)||a.j.set(e,d)});return Array.from(a.j.values())},tO=function(a,b,c,d,e){const f=_.O;c=c||
52
- {contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,lf:null,Ha:e?e.find(u=>u.id===fM)||null:null};d=d||c.qa;var g=f.a(b,fM);const h=g.map(f.f);e=e?hO(g,e,b.getAttribute("id")||void 0):null;g=b.getAttribute("contentType")||c.contentType;const k=b.getAttribute(_.Ce)||c.mimeType,l=b.getAttribute(_.pd)||c.codecs,m=f.aa(b,"frameRate",YM)||c.frameRate,n=zO(f.a(b,"InbandEventStream"),c.emsgSchemeIdUris),p=f.a(b,"AudioChannelConfiguration");a=AO(a,p)||c.lf;g||(g=kO(k,l));return{qa:_.qB(d,
53
- h),Ha:e||c.Ha,Zd:f.h(b,"SegmentBase")||c.Zd,tc:f.h(b,"SegmentList")||c.tc,uc:f.h(b,"SegmentTemplate")||c.uc,width:f.aa(b,_.Ng,XM)||c.width,height:f.aa(b,_.be,XM)||c.height,contentType:g,mimeType:k,codecs:l,frameRate:m,emsgSchemeIdUris:n,id:b.getAttribute("id")||"",lf:a}},uO=function(a,b,c,d){const e=_.O,f=d.getAttribute(CM)||"",g=d.getAttribute(_.vg)||"",h=e.aa(d,EM,XM)||1,k=e.aa(d,BM,XM)||0,l=[];for(const n of e.a(d,"Event")){d=e.aa(n,"presentationTime",XM)||0;var m=e.aa(n,vM,XM)||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=_.mg;f.startsWith(_.og)?p=_.Hf:"urn:mpeg:dash:event:callback:2015"===f&&(p=_.Ge);const u={configurationId:a.D.configurationId,schemeIdUri:f,value:g,startTime:d,endTime:m,id:n.getAttribute("id")||"",type:p,eventElement:e.be(n)};u.type===_.Ge&&(u.De=()=>{if(u.eventElement){var v=u.eventElement.getAttribute("messageData")||"";v&&v.startsWith("http")&&(v=_.zk(v),v.type=_.yk,a.D.networkingEngine.fetch(v))}});l.push(u)}return l},vO=function(a,
55
- b,c){var d=_.O;b.xa=tO(a,c,b.Ja,null,null);var e=b.xa.contentType===_.K;const f=BO(c),{kind:g,Td:h,roles:k}=CO(c,e);let l=null;try{l=DO(c)}catch(y){return null}const m=d.a(c,"Accessibility"),n=EO(m);var p=d.a(c,hM);const u=cO(p,a.a.ignoreDrmInfo,b.Ja.id,a.a.playreadyVersion||null),v=c.getAttribute("lang")||_.lg;p=_.Kn(v);d=d.a(c,_.nb);c=d.map(y=>FO(a,b,u,g,v,f||"",h,k,n,y)).filter(_.Nm);if(0===c.length){if(e)return null;throw new _.I(_.D,4,4003);}if(!b.xa.contentType||b.xa.contentType===uM){b.xa.contentType=
56
- kO(c[0].mimeType,c[0].codecs);for(const y of c)y.type=b.xa.contentType}for(const y of c)for(const A of u.drmInfos)y.keyId&&!A.keyIds.includes(y.keyId)&&A.keyIds.push(y.keyId);c=GO(c,b.xa.contentType,m);e=d.map(y=>y.getAttribute("id")).filter(_.Nm);return{id:b.xa.id||"__fake__"+a.h++,contentType:b.xa.contentType,language:p,originalLanguage:v,Td:h,streams:c,drmInfos:u.drmInfos,Pf:l,Vi:e}},wO=function(a,b){return a.filter(c=>c.contentType===b)},xO=function(a,b,c,d){if(b||c)if(b&&c){if(_.KB(b.drmInfos,
47
+ g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,ij:d}})},pO=function(a,b,c,d,e){const f=_.O,g=f.aa(e,"mediaPresentationDuration",TM),h=a.f?a.f.periods[a.f.periods.length-1]||null:null;var k=[];const l=[];var m=0;e=f.a(e,"Period");for(let v=0;v<e.length;v++){var n=e[v];m=f.aa(n,_.Qf,TM,m);var p=f.aa(n,vM,TM);let y=null;if(v!==e.length-1){var u=f.aa(e[v+1],_.Qf,TM);null!=u&&(y=u-m)}else null!=g&&(y=g-m);u=_.ju;y&&p&&Math.abs(y-p)>u&&a.g.warn("There is a gap/overlap between Periods",
48
+ n);null==y&&(y=p);n=rO(a,b,c,d,{start:m,duration:y,node:n,mi:null==y||v===e.length-1});p=n.Ia;l.push(p);k=k.concat(n.cues);a.G.includes(p.id)||(a.G.push(p.id),a.f&&(a.D.filterNewPeriod(p),a.f.periods.push(p)));if(null==y){v!==e.length-1&&a.g.warn("Skipping Period",v+1,"and any subsequent Periods:","Period",v+1,"does not have a valid start time.",l[v+1]);m=null;break}m+=y}null==a.f&&a.D.filterAllPeriods(l);h&&(b=l.find(v=>v.id===h.id))&&(h.endTime=b.endTime);k=sO(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,mg:!1,cues:k}):{periods:l,duration:m,mg:!0,cues:k}},qO=function(a){return a.map(b=>b.variants[0].video||b.variants[0].audio).reduce((b,c)=>c?c.getDuration():0+b,0)},rO=function(a,b,c,d,e){var f=_.O;b.Ia=tO(a,e.node,null,c,d);b.Ya=e;c=b.Ia.id||`__clpp_period_${e.start}`;b.Ia.id||(a.g.info("No Period ID given for Period with start time "+e.start+`, Assigning a default: ${c}.`),b.Ia.id=c);d=f.a(e.node,"EventStream").flatMap(A=>uO(a,e.start,e.duration,A));f=f.a(e.node,
50
+ _.fa).map(A=>vO(a,b,A)).filter(_.Jm);if(b.Xe){var g=[];for(var h of f)for(var k of h.Qi)g.push(k);if(g.length!==(new Set(g)).size)throw new _.I(_.D,4,4018);}h=f.filter(A=>!A.Jf);k=f.filter(A=>A.Jf);for(var l of k){l.streams.forEach(A=>{A.trickPlay=!0});k=l.streams[0];g=l.Jf;for(var m of h)if(g.includes(m.id))for(var n of m.streams)n.trickModeVideo=k}m=wO(f,_.t);n=wO(h,_.q);if(!m.length&&!n.length)throw new _.I(_.D,4,4004);n.length||(n=[null]);m.length||(m=[null]);l=[];for(var p of n)for(var u of m)xO(a,
51
+ p,u,l);u=[...wO(h,_.K),...wO(h,_.VA)];p=[];for(var v of u)p.push.apply(p,v.streams);u=wO(h,_.he);v=[];for(var y of u)v.push.apply(v,y.streams);y=yO(e,h);return{Ia:{id:c,configurationId:a.D.configurationId,startTime:e.start,endTime:y,textStreams:p,thumbStreams:v,variants:l},cues:d}},sO=function(a,b){const c=new Set(b.map(mN));a.j.forEach((d,e)=>{c.has(e)||a.j.delete(e)});b.forEach(d=>{const e=mN(d);a.j.has(e)||a.j.set(e,d)});return Array.from(a.j.values())},tO=function(a,b,c,d,e){const f=_.O;c=c||
52
+ {contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,ff:null,Ga:e?e.find(u=>u.id===fM)||null:null};d=d||c.qa;var g=f.a(b,fM);const h=g.map(f.f);e=e?hO(g,e,b.getAttribute("id")||void 0):null;g=b.getAttribute("contentType")||c.contentType;const k=b.getAttribute(_.Ce)||c.mimeType,l=b.getAttribute(_.qd)||c.codecs,m=f.aa(b,"frameRate",YM)||c.frameRate,n=zO(f.a(b,"InbandEventStream"),c.emsgSchemeIdUris),p=f.a(b,"AudioChannelConfiguration");a=AO(a,p)||c.ff;g||(g=kO(k,l));return{qa:_.qB(d,
53
+ h),Ga:e||c.Ga,Yd:f.h(b,"SegmentBase")||c.Yd,tc:f.h(b,"SegmentList")||c.tc,uc:f.h(b,"SegmentTemplate")||c.uc,width:f.aa(b,_.Ng,XM)||c.width,height:f.aa(b,_.ce,XM)||c.height,contentType:g,mimeType:k,codecs:l,frameRate:m,emsgSchemeIdUris:n,id:b.getAttribute("id")||"",ff:a}},uO=function(a,b,c,d){const e=_.O,f=d.getAttribute(CM)||"",g=d.getAttribute(_.vg)||"",h=e.aa(d,EM,XM)||1,k=e.aa(d,BM,XM)||0,l=[];for(const n of e.a(d,"Event")){d=e.aa(n,"presentationTime",XM)||0;var m=e.aa(n,vM,XM)||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=_.mg;f.startsWith(_.og)?p=_.Hf:"urn:mpeg:dash:event:callback:2015"===f&&(p=_.Ge);const u={configurationId:a.D.configurationId,schemeIdUri:f,value:g,startTime:d,endTime:m,id:n.getAttribute("id")||"",type:p,eventElement:e.ae(n)};u.type===_.Ge&&(u.Ae=()=>{if(u.eventElement){var v=u.eventElement.getAttribute("messageData")||"";v&&v.startsWith("http")&&(v=_.vk(v),v.type=_.uk,a.D.networkingEngine.fetch(v))}});l.push(u)}return l},vO=function(a,
55
+ b,c){var d=_.O;b.xa=tO(a,c,b.Ia,null,null);var e=b.xa.contentType===_.K;const f=BO(c),{kind:g,Td:h,roles:k}=CO(c,e);let l=null;try{l=DO(c)}catch(y){return null}const m=d.a(c,"Accessibility"),n=EO(m);var p=d.a(c,hM);const u=cO(p,a.a.ignoreDrmInfo,b.Ia.id,a.a.playreadyVersion||null),v=c.getAttribute("lang")||_.lg;p=_.Gn(v);d=d.a(c,_.nb);c=d.map(y=>FO(a,b,u,g,v,f||"",h,k,n,y)).filter(_.Jm);if(0===c.length){if(e)return null;throw new _.I(_.D,4,4003);}if(!b.xa.contentType||b.xa.contentType===uM){b.xa.contentType=
56
+ kO(c[0].mimeType,c[0].codecs);for(const y of c)y.type=b.xa.contentType}for(const y of c)for(const A of u.drmInfos)y.keyId&&!A.keyIds.includes(y.keyId)&&A.keyIds.push(y.keyId);c=GO(c,b.xa.contentType,m);e=d.map(y=>y.getAttribute("id")).filter(_.Jm);return{id:b.xa.id||"__fake__"+a.h++,contentType:b.xa.contentType,language:p,originalLanguage:v,Td:h,streams:c,drmInfos:u.drmInfos,Jf:l,Qi:e}},wO=function(a,b){return a.filter(c=>c.contentType===b)},xO=function(a,b,c,d){if(b||c)if(b&&c){if(_.KB(b.drmInfos,
57
57
  c.drmInfos)){var e=_.JB(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.Td||c.Td,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||_.lg,primary:f.Td,audio:b?e:null,video:c?e:null,bandwidth:g,drmInfos:f.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(g)}},
58
- yO=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},BO=function(a){let b=null;const c=_.O.a(a,"Label").map(_.O.f).filter(_.Nm);c&&0<c.length&&(b=c[c.length-1]);null==b&&(b=a.getAttribute("label"));return b},CO=function(a,b){let c=!1;const d=_.O.a(a,"Role");a=d.map(f=>f.getAttribute(_.vg)).filter(_.Nm);let e=
59
- void 0;b&&(e=_.VA);for(const f of d)if(b=f.getAttribute(CM),null==b||"urn:mpeg:dash:role:2011"===b||"urn:mpeg:dash:role"===b)switch(b=f.getAttribute(_.vg),b){case _.ue:c=!0;break;case _.GA:case _.VA:e=b;break;case "forced-subtitle":case "forced_subtitle":case _.Zd:e=_.Zd}return{Td:c,roles:a,kind:e}},DO=function(a){var b=_.O.a(a,jM);a=null;for(const c of b){b=c.getAttribute(CM)||"";const d=c.getAttribute(_.vg);if(b!==wM&&!HO.includes(b)||void 0===d)throw new _.tl("Unrecognized essential property");
60
- b===wM&&(a=d.split(" "))}return a},EO=function(a){const b=new Map;for(const e of a)if(a=e.getAttribute(CM),"urn:scte:dash:cc:cea-608:2015"===a||"urn:scte:dash:cc:cea-708:2015"===a){a=1;var c=e.getAttribute(_.vg);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,_.Kn(d))}else b.set("CC1",_.lg)}return b},FO=function(a,b,c,d,e,f,g,h,k,l){const m=_.O,n=_.Kn(e);
61
- b.O=tO(a,l,b.xa,null,null);if(!IO(a,b.O))return a.g.warn("Skipping Representation",b.O),null;b.hc=`${b.Ja.id} ${b.O.id}`;b.Rd=a.F.get(b.hc);b.bandwidth=m.aa(l,"bandwidth",WM)||0;const p=JO(a,b);if(!p)return null;a.F.set(b.hc,p.Ka);var u=m.a(l,hM);a=fO(u,c,a.a.ignoreDrmInfo,b.Ja.id,a.a.playreadyVersion||null);u=!1;m.a(l,"SupplementalProperty").some(v=>"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===v.getAttribute(CM)&&"JOC"===v.getAttribute(_.vg))&&(b.O.mimeType="audio/eac3-joc",u=!0);l=KO(b,l);
58
+ yO=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},BO=function(a){let b=null;const c=_.O.a(a,"Label").map(_.O.f).filter(_.Jm);c&&0<c.length&&(b=c[c.length-1]);null==b&&(b=a.getAttribute("label"));return b},CO=function(a,b){let c=!1;const d=_.O.a(a,"Role");a=d.map(f=>f.getAttribute(_.vg)).filter(_.Jm);let e=
59
+ void 0;b&&(e=_.VA);for(const f of d)if(b=f.getAttribute(CM),null==b||"urn:mpeg:dash:role:2011"===b||"urn:mpeg:dash:role"===b)switch(b=f.getAttribute(_.vg),b){case _.ue:c=!0;break;case _.GA:case _.VA:e=b;break;case "forced-subtitle":case "forced_subtitle":case _.$d:e=_.$d}return{Td:c,roles:a,kind:e}},DO=function(a){var b=_.O.a(a,jM);a=null;for(const c of b){b=c.getAttribute(CM)||"";const d=c.getAttribute(_.vg);if(b!==wM&&!HO.includes(b)||void 0===d)throw new _.pl("Unrecognized essential property");
60
+ b===wM&&(a=d.split(" "))}return a},EO=function(a){const b=new Map;for(const e of a)if(a=e.getAttribute(CM),"urn:scte:dash:cc:cea-608:2015"===a||"urn:scte:dash:cc:cea-708:2015"===a){a=1;var c=e.getAttribute(_.vg);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,_.Gn(d))}else b.set("CC1",_.lg)}return b},FO=function(a,b,c,d,e,f,g,h,k,l){const m=_.O,n=_.Gn(e);
61
+ b.O=tO(a,l,b.xa,null,null);if(!IO(a,b.O))return a.g.warn("Skipping Representation",b.O),null;b.hc=`${b.Ia.id} ${b.O.id}`;b.Rd=a.F.get(b.hc);b.bandwidth=m.aa(l,"bandwidth",WM)||0;const p=JO(a,b);if(!p)return null;a.F.set(b.hc,p.Ja);var u=m.a(l,hM);a=fO(u,c,a.a.ignoreDrmInfo,b.Ia.id,a.a.playreadyVersion||null);u=!1;m.a(l,"SupplementalProperty").some(v=>"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===v.getAttribute(CM)&&"JOC"===v.getAttribute(_.vg))&&(b.O.mimeType="audio/eac3-joc",u=!0);l=KO(b,l);
62
62
  return{id:_.pI++,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:_.LA,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.lf,spatialAudio:u,closedCaptions:k,horizontalTiles:l.horizontalTiles,verticalTiles:l.verticalTiles,durationPerTile:l.durationPerTile}},GO=function(a,b,c){const d=b===_.VA?_.K:b;b=c.map(e=>({scheme:e.getAttribute(CM)||"",id:e.getAttribute("id")||void 0,value:e.getAttribute(_.vg)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=
64
- b;return a},IO=function(a,b){let c;c=b.Zd?1:0;c+=b.tc?1:0;c+=b.uc?1:0;if(0===c){if(b.contentType===_.K||b.contentType===uM)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.Zd?(a.g.info("Using SegmentBase by default."),b.tc=null):a.g.info("Using SegmentList by default."),b.uc=null);return!0},JO=function(a,b){var c=b.O.contentType;c=c===_.K||c===uM;try{if(b.O.Zd){{const E=Number(fN(b,AN,BM))||0,F=fN(b,AN,EM);var d=1;F&&(d=WM(F)||1);var e=E/d||0,f=zN(b,AN);{d=f;var g=e;const C=b.O.mimeType.split("/")[1];if(b.O.contentType!==_.K&&"mp4"!==C&&"webm"!==C)throw _.Dh("SegmentBase specifies an unsupported container type.",b.O),new _.I(_.D,4,4006);if("webm"===C&&!d)throw _.Dh(oM,
66
- "the SegmentBase uses a WebM container,","but does not contain an Initialization element.",b.O),new _.I(_.D,4,4005);const ja=gN(b,AN,"RepresentationIndex"),Ca=fN(b,AN,"indexRange");let Xa=b.O.qa,Jb=UM(Ca||"");if(ja){const vb=ja.getAttribute("sourceURL");vb&&(Xa=_.qB(b.O.qa,[vb]));Jb=_.O.aa(ja,"range",UM,Jb)}if(!Jb)throw _.Dh(oM,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",b.O),new _.I(_.D,4,4002);QM(b.O.contentType)&&(b.presentationTimeline.B=null);var h=CN(b,
67
- d,Xa,Jb.start,Jb.end,C,g)}var k={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:f,getLastSegmentEndTime:h.getLastSegmentEndTime,Ka:e}}}else{if(b.O.tc){{var l=a.H;const E=zN(b,QN);{const ja=RN(b),Ca=iN(b,QN);let Xa=Ca.Pc;0===Xa&&(_.B("SegmentList@startNumber must be \x3e 0"),Xa=1);h=0;Ca.$a?h=Ca.$a*(Xa-1):Ca.wa&&0<Ca.wa.a&&(h=Ca.wa.j);
68
- var m={$a:Ca.$a,startTime:h,Pc:Xa,Sb:Ca.Sb,wa:Ca.wa,Nc:ja}}if(!m.$a&&!m.wa&&1<m.Nc.length)throw _.B(pM,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",b.O),new _.I(_.D,4,4002);if(!m.$a&&!b.Za.duration&&!m.wa&&1===m.Nc.length)throw _.B(pM,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",b.O),new _.I(_.D,4,4002);if(m.wa&&0===m.wa.a)throw _.B(pM,"the SegmentList has an empty timeline.",
69
- b.O),new _.I(_.D,4,4002);{let ja=m.Nc.length;m.wa&&m.wa.a!==m.Nc.length&&(ja=Math.min(m.wa.a,m.Nc.length),_.B("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",m.Nc.length,"to",ja));var n=ja}const F=new LO(m,b.O.qa,b.O.Ha,b.Za.duration,n),C=MN(b,F,l);if(QM(b.O.contentType)){const ja=GN(C);ja&&lN(b,ja)}d={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:C.findSegmentPosition.bind(C),getSegmentReference:C.getSegmentReference.bind(C),
70
- adjustSegmentDurations:C.adjustSegmentDurations.bind(C),getDuration:C.getDuration.bind(C),initSegmentReference:E,getLastSegmentEndTime:C.getLastSegmentEndTime.bind(C),Ka:m.Sb}}}else{if(b.O.uc){{var p=a.H,u=!!a.f;const E=ON(b);{const C=iN(b,NN),ja=fN(b,NN,"media"),Ca=fN(b,NN,"index");e={$a:C.$a,timescale:C.timescale,Pc:C.Pc,cf:C.cf,Sb:C.Sb,Rf:C.Rf,wa:C.wa,kf:ja,Od:Ca,We:C.We}}{let C;C=e.Od?1:0;C+=e.wa?1:0;C+=e.$a?1:0;if(0===C)throw _.Dh("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 _.I(_.D,4,4002);1!==C&&(_.B("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",b.O),e.Od?(_.Bh("Using the index URL template by default."),e.wa=null):_.Bh("Using the SegmentTimeline by default."),e.$a=null);if(!e.Od&&!e.kf)throw _.Dh(qM,"the SegmentTemplate's media URL template is missing.",b.O),new _.I(_.D,4,4002);}const F=
72
- QM(b.O.contentType);h=null;if(e.Od){F&&(b.presentationTimeline.B=null);{f=E;const C=b.O.mimeType.split("/")[1];if("mp4"!==C&&"webm"!==C)throw _.Dh("SegmentTemplate specifies an unsupported container type.",b.O),new _.I(_.D,4,4006);if("webm"===C&&!f)throw _.Dh(qM,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",b.O),new _.I(_.D,4,4005);const ja=eN(e.Od,b.O.id,null,b.bandwidth||null,null),Ca=_.qB(b.O.qa,[ja]);h=CN(b,f,Ca,0,null,C,e.Sb)}}else if(e.$a){if(!u&&
73
- F){b.presentationTimeline.B=null;var v=b.presentationTimeline;v.G=Math.max(v.G,e.We);v.g.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+v.G);_.mC(b.presentationTimeline,e.$a);var y=b.presentationTimeline,A=b.Za.start;y.l=null==y.l?A:Math.min(y.l,A)}h=PN(b,e)}else{const C=MN(b,new MO(e,b.O.id,b.bandwidth||null,b.O.qa,b.O.Ha),p);if(F){const ja=GN(C);ja&&lN(b,ja)}h={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:C.findSegmentPosition.bind(C),getSegmentReference:C.getSegmentReference.bind(C),
74
- adjustSegmentDurations:C.adjustSegmentDurations.bind(C),getDuration:C.getDuration.bind(C),getLastSegmentEndTime:C.getLastSegmentEndTime.bind(C)}}g={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:E,getLastSegmentEndTime:h.getLastSegmentEndTime,Ka:e.Sb}}}else g=NO(b);d=g}k=d}return k}catch(E){if(c&&4002===E.code)return a.g.debug("Ignoring DASH_NO_SEGMENT_INFO error in a text stream",
75
- E),null;throw E;}},KO=function(a,b){const c={};if(a.O.contentType===_.he){var d=(b=_.O.h(b,jM))&&b.getAttribute(CM);d=d||"";OO.includes(d)&&(b=_.DB(b.getAttribute(_.vg)||""))&&(c.horizontalTiles=b.Ld,c.verticalTiles=b.de,a.xa.uc&&(d=_.O.aa(a.xa.uc,vM,XM)||0,a=_.O.aa(a.xa.uc,EM,XM)||1,a=d/a))&&(c.durationPerTile=a/b.jj)}return c},NO=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=>1!==
76
- e?null:new _.rI(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,Ka:0}},zO=function(a,b){b=b.slice();for(const c of a)(a=c.getAttribute(CM))&&!b.includes(a)&&b.push(a);return b},AO=function(a,b){for(const d of b){b=d.getAttribute(CM);if(!b)continue;const e=d.getAttribute(_.vg);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(gM,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(gM,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};_.hv.prototype.be=KM(19,function(a){return a});
78
- _.HB.prototype.be=KM(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}/>`,_.ag).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.be(d))});return c});
79
- _.hv.prototype.Ke=KM(17,function(a,b){Array.from(a.attributes).forEach(c=>{c.namespaceURI===b&&a.removeAttributeNS(c.namespaceURI,c.localName)})});_.HB.prototype.Ke=KM(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]})}});_.hv.prototype.ze=KM(15,function(a,b){for(const c of a.attributes)b.setAttributeNS(c.namespaceURI,c.nodeName,c.value)});
80
- _.HB.prototype.ze=KM(14,function(a,b){Object.keys(a.attributes).forEach(c=>{b.attributes[c]=a.attributes[c]})});_.hv.prototype.Ae=KM(13,function(a,b){Array.from(a.childNodes).forEach(c=>{a.removeChild(c);b.appendChild(c)})});_.HB.prototype.Ae=KM(12,function(a,b){b.childNodes.push(...a.childNodes);a.childNodes=[]});_.hv.prototype.Je=KM(11,function(a){Array.from(a.childNodes).forEach(b=>{a.removeChild(b)})});_.HB.prototype.Je=KM(10,function(a){a.childNodes=[]});_.hv.prototype.Vc=KM(9,function(){return document.createElement("null")});
81
- _.HB.prototype.Vc=KM(8,function(){return new _.FB("NULL",null,{},[],null,null,new Map)});_.hv.prototype.ve=KM(7,function(a){return Array.from(a.childNodes).filter(b=>b instanceof Element)});_.HB.prototype.ve=KM(6,function(a){return a.childNodes});_.hv.prototype.aa=KM(5,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});_.HB.prototype.aa=KM(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
- _.hv.prototype.Ec=KM(3,function(a,b,c){return Array.from(a.childNodes).filter(d=>d instanceof Element&&d.localName===c&&d.namespaceURI===b)});_.HB.prototype.Ec=KM(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)});_.hv.prototype.Wb=KM(1,function(a,b,c){a=this.Ec(a,b,c);return 1!==a.length?null:a[0]});_.HB.prototype.Wb=KM(0,function(a,b,c){a=this.Ec(a,b,c);return 1!==a.length?null:a[0]});var LO=class{constructor(a,b,c,d,e){this.l=a.Pc;this.j=e;this.I=a.Nc;this.a=a.startTime;this.h=a.$a;this.f=a.wa;this.H=a.Sb;this.G=b;this.F=c;this.A=d;this.g=new _.T("clpp.dash.SegmentListSource")}o(){return this.j}w(){return this.l}B(a){a=aN(this,a);return null==a?null:null!=this.h?(a=this.a+a*this.h,{startTime:a,endTime:a+this.h}):this.f?(a=cN(this.f,a),{startTime:a.startTime,endTime:a.endTime}):null==this.A?(this.g.warn(iM),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=dN(this.f,a),null==a?null:this.l+a):null==this.A?(this.g.warn(iM),null):a<this.a+this.A?this.l:null:null}getSegmentReference(a,b){const c=aN(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=_.qB(this.G,[d.Lg]);return new _.rI(b,a.startTime,a.endTime,()=>e,d.start,d.end,this.H,null,null,null,null,null,null,null,null,()=>d.Lg,this.F)}C(){return 0<
84
- this.j?null!=this.h?{pc:this.a,ac:this.a+this.j*this.h,bc:this.h}:this.f?{pc:cN(this.f,0).startTime,ac:cN(this.f,this.j-1).endTime,bc:this.f.h}:null==this.A?null:{pc:this.a,ac:this.a+this.A,bc:this.A}:null}};var hN=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=bN(a)}};var OO=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],HO=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var MO=class{constructor(a,b,c,d,e){const f=a.wa;this.h=a.Pc;this.f=f.a;this.a=f;this.G=a.kf;this.H=b;this.j=c;this.A=d;this.l=e;this.F=a.Sb;this.I=a.Rf}o(){return this.f}w(){return this.h}B(a){a=oN(this,a);if(null==a)return null;a=cN(this.a,a);return{startTime:a.startTime,endTime:a.endTime}}findSegmentPosition(a){if(!(0<this.f))return null;a=dN(this.a,a);return null==a?null:this.h+a}getSegmentReference(a,b){var c=oN(this,a);if(null==c)return null;b=null==b?a:b;c=cN(this.a,c);const d=c.qj+this.I,
85
- e=()=>eN(this.G,this.H,a,this.j,d);return new _.rI(b,c.startTime,c.endTime,()=>{const f=e();return _.qB(this.A,[f])},0,null,this.F,null,null,null,null,null,null,null,null,e,this.l)}C(){return 0<this.f?{pc:cN(this.a,0).startTime,ac:cN(this.a,this.f-1).endTime,bc:this.a.h}:null}};var wN=class{constructor(a){this.f=a;this.a=new _.kq(a,!1)}},sN=[[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]],tN=class{constructor(a,b){this.id=a;this.a=b}};var BN=class{parse(a,b,c,d){var e;b=new wN(new DataView(b));if(440786851!==uN(b).id)throw _.Dh("Not an EBML element."),new _.I(_.D,3,3008);var f=uN(b);if(408125543!==f.id)throw _.Dh("Not a Segment element."),new _.I(_.D,3,3009);b=f.a.byteOffset;f=new wN(f.a);for(e=null;_.Xo(f.a);){var g=uN(f);if(357149030===g.id){e=g;break}}if(!e)throw _.Dh("Not an Info element."),new _.I(_.D,3,3010);e=new wN(e.a);g=1E6;for(f=null;_.Xo(e.a);){const h=uN(e);if(2807729===h.id)g=vN(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 _.I(_.D,3,3003);}if(null==f)throw new _.I(_.D,3,3011);e=g/=1E9;f*=g;a=uN(new wN(new DataView(a)));if(475249515!==a.id)throw _.Dh("Not a Cues element."),new _.I(_.D,3,3007);return yN(a,b,e,f,c,d)}};var LN=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 _.T("clpp.dash.SegmentSourceAdapter")}findSegmentPosition(a){const b=DN(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=EN(this,c);if(a>=d.startTime&&a<d.endTime)return c+this.f}c=EN(this,b.Kb);return a<c.startTime?b.Kb+this.f:null}getSegmentReference(a){var b=a-
87
- this.f;if(!FN(this,b))return null;a=this.a.getSegmentReference(b,a);if(!a)return null;b=EN(this,b);return new _.rI(a.position,b.startTime,b.endTime,a.Da,a.na,a.ja,a.Ka,a.keyInfo,a.Xc,a.timescale,a.horizontalTiles,a.verticalTiles,a.durationPerTile,a.a,a.initSegment,a.cd,a.Ha)}adjustSegmentDurations(a,b){if(FN(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.qe+=b:this.h.push({position:a,qe:b})}}getDuration(){const a=DN(this);if(!a)return 0;
88
- const b=EN(this,a.Kb);return EN(this,a.Zb).endTime-b.startTime}getLastSegmentEndTime(){const a=DN(this);return a?EN(this,a.Zb).endTime:0}};var PO=class{constructor(a,b){this.g=a;this.f=b;this.a={clockSyncUri:void 0}}};var VN=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Re).set(JM,_.wd).set(IM,_.ud).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.ud).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.sd).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.rd),eO=(new Map).set(_.wd,function(a){const b=gO(a);if(b)return{licenseUrl:b,origin:_.JA};if(a=_.O.Wb(a.node,"urn:microsoft","laurl"))if(a=a.getAttribute("licenseUrl"))return{licenseUrl:a,origin:"ms:laurl"};return null}).set(_.ud,
89
- function(a){var b=_.O;const c=gO(a);if(c)return{licenseUrl:c,origin:_.JA};a=b.Wb(a.node,FM,"pro");if(!a)return null;b=b.f(a);if(!b)return null;b=_.em(b);return(b=_.rq(b).h)?{licenseUrl:b,origin:"mspr:pro"}:null}),XN=new _.T("clpp.dash.ContentProtection");var QO=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 _.sI(5);this.B=new _.Pi(()=>{this.dc()});this.A=new _.ju;this.j=new Map;this.g=new _.T("clpp.dash.DashParser");this.C=null;this.J=new PO(this.g,(a,b)=>{a=_.zk(a,this.a.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.Jl(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=
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.ff,spatialAudio:u,closedCaptions:k,horizontalTiles:l.horizontalTiles,verticalTiles:l.verticalTiles,durationPerTile:l.durationPerTile}},GO=function(a,b,c){const d=b===_.VA?_.K:b;b=c.map(e=>({scheme:e.getAttribute(CM)||"",id:e.getAttribute("id")||void 0,value:e.getAttribute(_.vg)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=
64
+ b;return a},IO=function(a,b){let c;c=b.Yd?1:0;c+=b.tc?1:0;c+=b.uc?1:0;if(0===c){if(b.contentType===_.K||b.contentType===uM)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.Yd?(a.g.info("Using SegmentBase by default."),b.tc=null):a.g.info("Using SegmentList by default."),b.uc=null);return!0},JO=function(a,b){var c=b.O.contentType;c=c===_.K||c===uM;try{if(b.O.Yd){{const E=Number(fN(b,AN,BM))||0,F=fN(b,AN,EM);var d=1;F&&(d=WM(F)||1);var e=E/d||0,f=zN(b,AN);{d=f;var g=e;const C=b.O.mimeType.split("/")[1];if(b.O.contentType!==_.K&&"mp4"!==C&&"webm"!==C)throw _.zh("SegmentBase specifies an unsupported container type.",b.O),new _.I(_.D,4,4006);if("webm"===C&&!d)throw _.zh(oM,
66
+ "the SegmentBase uses a WebM container,","but does not contain an Initialization element.",b.O),new _.I(_.D,4,4005);const ja=gN(b,AN,"RepresentationIndex"),Ca=fN(b,AN,"indexRange");let Xa=b.O.qa,Ib=UM(Ca||"");if(ja){const ub=ja.getAttribute("sourceURL");ub&&(Xa=_.qB(b.O.qa,[ub]));Ib=_.O.aa(ja,"range",UM,Ib)}if(!Ib)throw _.zh(oM,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",b.O),new _.I(_.D,4,4002);QM(b.O.contentType)&&(b.presentationTimeline.B=null);var h=CN(b,
67
+ d,Xa,Ib.start,Ib.end,C,g)}var k={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:f,getLastSegmentEndTime:h.getLastSegmentEndTime,Ja:e}}}else{if(b.O.tc){{var l=a.H;const E=zN(b,QN);{const ja=RN(b),Ca=iN(b,QN);let Xa=Ca.Pc;0===Xa&&(_.B("SegmentList@startNumber must be \x3e 0"),Xa=1);h=0;Ca.Za?h=Ca.Za*(Xa-1):Ca.wa&&0<Ca.wa.a&&(h=Ca.wa.j);
68
+ var m={Za:Ca.Za,startTime:h,Pc:Xa,Sb:Ca.Sb,wa:Ca.wa,Nc:ja}}if(!m.Za&&!m.wa&&1<m.Nc.length)throw _.B(pM,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",b.O),new _.I(_.D,4,4002);if(!m.Za&&!b.Ya.duration&&!m.wa&&1===m.Nc.length)throw _.B(pM,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",b.O),new _.I(_.D,4,4002);if(m.wa&&0===m.wa.a)throw _.B(pM,"the SegmentList has an empty timeline.",
69
+ b.O),new _.I(_.D,4,4002);{let ja=m.Nc.length;m.wa&&m.wa.a!==m.Nc.length&&(ja=Math.min(m.wa.a,m.Nc.length),_.B("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",m.Nc.length,"to",ja));var n=ja}const F=new LO(m,b.O.qa,b.O.Ga,b.Ya.duration,n),C=MN(b,F,l);if(QM(b.O.contentType)){const ja=GN(C);ja&&lN(b,ja)}d={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:C.findSegmentPosition.bind(C),getSegmentReference:C.getSegmentReference.bind(C),
70
+ adjustSegmentDurations:C.adjustSegmentDurations.bind(C),getDuration:C.getDuration.bind(C),initSegmentReference:E,getLastSegmentEndTime:C.getLastSegmentEndTime.bind(C),Ja:m.Sb}}}else{if(b.O.uc){{var p=a.H,u=!!a.f;const E=ON(b);{const C=iN(b,NN),ja=fN(b,NN,"media"),Ca=fN(b,NN,"index");e={Za:C.Za,timescale:C.timescale,Pc:C.Pc,Ye:C.Ye,Sb:C.Sb,Lf:C.Lf,wa:C.wa,ef:ja,Od:Ca,Re:C.Re}}{let C;C=e.Od?1:0;C+=e.wa?1:0;C+=e.Za?1:0;if(0===C)throw _.zh("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 _.I(_.D,4,4002);1!==C&&(_.B("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",b.O),e.Od?(_.xh("Using the index URL template by default."),e.wa=null):_.xh("Using the SegmentTimeline by default."),e.Za=null);if(!e.Od&&!e.ef)throw _.zh(qM,"the SegmentTemplate's media URL template is missing.",b.O),new _.I(_.D,4,4002);}const F=
72
+ QM(b.O.contentType);h=null;if(e.Od){F&&(b.presentationTimeline.B=null);{f=E;const C=b.O.mimeType.split("/")[1];if("mp4"!==C&&"webm"!==C)throw _.zh("SegmentTemplate specifies an unsupported container type.",b.O),new _.I(_.D,4,4006);if("webm"===C&&!f)throw _.zh(qM,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",b.O),new _.I(_.D,4,4005);const ja=eN(e.Od,b.O.id,null,b.bandwidth||null,null),Ca=_.qB(b.O.qa,[ja]);h=CN(b,f,Ca,0,null,C,e.Sb)}}else if(e.Za){if(!u&&
73
+ F){b.presentationTimeline.B=null;var v=b.presentationTimeline;v.G=Math.max(v.G,e.Re);v.g.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+v.G);_.mC(b.presentationTimeline,e.Za);var y=b.presentationTimeline,A=b.Ya.start;y.l=null==y.l?A:Math.min(y.l,A)}h=PN(b,e)}else{const C=MN(b,new MO(e,b.O.id,b.bandwidth||null,b.O.qa,b.O.Ga),p);if(F){const ja=GN(C);ja&&lN(b,ja)}h={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:C.findSegmentPosition.bind(C),getSegmentReference:C.getSegmentReference.bind(C),
74
+ adjustSegmentDurations:C.adjustSegmentDurations.bind(C),getDuration:C.getDuration.bind(C),getLastSegmentEndTime:C.getLastSegmentEndTime.bind(C)}}g={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:E,getLastSegmentEndTime:h.getLastSegmentEndTime,Ja:e.Sb}}}else g=NO(b);d=g}k=d}return k}catch(E){if(c&&4002===E.code)return a.g.debug("Ignoring DASH_NO_SEGMENT_INFO error in a text stream",
75
+ E),null;throw E;}},KO=function(a,b){const c={};if(a.O.contentType===_.he){var d=(b=_.O.h(b,jM))&&b.getAttribute(CM);d=d||"";OO.includes(d)&&(b=_.DB(b.getAttribute(_.vg)||""))&&(c.horizontalTiles=b.Ld,c.verticalTiles=b.ce,a.xa.uc&&(d=_.O.aa(a.xa.uc,vM,XM)||0,a=_.O.aa(a.xa.uc,EM,XM)||1,a=d/a))&&(c.durationPerTile=a/b.ej)}return c},NO=function(a){const b=a.O.qa,c=a.Ya.duration||0,d=()=>c;return{createSegmentIndex:()=>Promise.resolve(),findSegmentPosition:e=>0<=e&&e<c?1:null,getSegmentReference:e=>1!==
76
+ e?null:new _.rI(1,0,c,()=>b,0,null,0,null,null,null,null,null,null,null,null,()=>"",a.O.Ga),adjustSegmentDurations:()=>{},getDuration:d,getLastSegmentEndTime:d,verticalTiles:void 0,horizontalTiles:void 0,initSegmentReference:null,Ja:0}},zO=function(a,b){b=b.slice();for(const c of a)(a=c.getAttribute(CM))&&!b.includes(a)&&b.push(a);return b},AO=function(a,b){for(const d of b){b=d.getAttribute(CM);if(!b)continue;const e=d.getAttribute(_.vg);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(gM,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(gM,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};_.hv.prototype.ae=KM(19,function(a){return a});
78
+ _.HB.prototype.ae=KM(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}/>`,_.ag).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.ae(d))});return c});
79
+ _.hv.prototype.He=KM(17,function(a,b){Array.from(a.attributes).forEach(c=>{c.namespaceURI===b&&a.removeAttributeNS(c.namespaceURI,c.localName)})});_.HB.prototype.He=KM(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]})}});_.hv.prototype.we=KM(15,function(a,b){for(const c of a.attributes)b.setAttributeNS(c.namespaceURI,c.nodeName,c.value)});
80
+ _.HB.prototype.we=KM(14,function(a,b){Object.keys(a.attributes).forEach(c=>{b.attributes[c]=a.attributes[c]})});_.hv.prototype.xe=KM(13,function(a,b){Array.from(a.childNodes).forEach(c=>{a.removeChild(c);b.appendChild(c)})});_.HB.prototype.xe=KM(12,function(a,b){b.childNodes.push(...a.childNodes);a.childNodes=[]});_.hv.prototype.Ge=KM(11,function(a){Array.from(a.childNodes).forEach(b=>{a.removeChild(b)})});_.HB.prototype.Ge=KM(10,function(a){a.childNodes=[]});_.hv.prototype.Uc=KM(9,function(){return document.createElement("null")});
81
+ _.HB.prototype.Uc=KM(8,function(){return new _.FB("NULL",null,{},[],null,null,new Map)});_.hv.prototype.se=KM(7,function(a){return Array.from(a.childNodes).filter(b=>b instanceof Element)});_.HB.prototype.se=KM(6,function(a){return a.childNodes});_.hv.prototype.aa=KM(5,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});_.HB.prototype.aa=KM(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
+ _.hv.prototype.Ec=KM(3,function(a,b,c){return Array.from(a.childNodes).filter(d=>d instanceof Element&&d.localName===c&&d.namespaceURI===b)});_.HB.prototype.Ec=KM(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)});_.hv.prototype.Wb=KM(1,function(a,b,c){a=this.Ec(a,b,c);return 1!==a.length?null:a[0]});_.HB.prototype.Wb=KM(0,function(a,b,c){a=this.Ec(a,b,c);return 1!==a.length?null:a[0]});var LO=class{constructor(a,b,c,d,e){this.l=a.Pc;this.j=e;this.I=a.Nc;this.a=a.startTime;this.h=a.Za;this.f=a.wa;this.H=a.Sb;this.G=b;this.F=c;this.A=d;this.g=new _.T("clpp.dash.SegmentListSource")}o(){return this.j}w(){return this.l}B(a){a=aN(this,a);return null==a?null:null!=this.h?(a=this.a+a*this.h,{startTime:a,endTime:a+this.h}):this.f?(a=cN(this.f,a),{startTime:a.startTime,endTime:a.endTime}):null==this.A?(this.g.warn(iM),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=dN(this.f,a),null==a?null:this.l+a):null==this.A?(this.g.warn(iM),null):a<this.a+this.A?this.l:null:null}getSegmentReference(a,b){const c=aN(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=_.qB(this.G,[d.Gg]);return new _.rI(b,a.startTime,a.endTime,()=>e,d.start,d.end,this.H,null,null,null,null,null,null,null,null,()=>d.Gg,this.F)}C(){return 0<
84
+ this.j?null!=this.h?{pc:this.a,ac:this.a+this.j*this.h,bc:this.h}:this.f?{pc:cN(this.f,0).startTime,ac:cN(this.f,this.j-1).endTime,bc:this.f.h}:null==this.A?null:{pc:this.a,ac:this.a+this.A,bc:this.A}:null}};var hN=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=bN(a)}};var OO=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],HO=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var MO=class{constructor(a,b,c,d,e){const f=a.wa;this.h=a.Pc;this.f=f.a;this.a=f;this.G=a.ef;this.H=b;this.j=c;this.A=d;this.l=e;this.F=a.Sb;this.I=a.Lf}o(){return this.f}w(){return this.h}B(a){a=oN(this,a);if(null==a)return null;a=cN(this.a,a);return{startTime:a.startTime,endTime:a.endTime}}findSegmentPosition(a){if(!(0<this.f))return null;a=dN(this.a,a);return null==a?null:this.h+a}getSegmentReference(a,b){var c=oN(this,a);if(null==c)return null;b=null==b?a:b;c=cN(this.a,c);const d=c.lj+this.I,
85
+ e=()=>eN(this.G,this.H,a,this.j,d);return new _.rI(b,c.startTime,c.endTime,()=>{const f=e();return _.qB(this.A,[f])},0,null,this.F,null,null,null,null,null,null,null,null,e,this.l)}C(){return 0<this.f?{pc:cN(this.a,0).startTime,ac:cN(this.a,this.f-1).endTime,bc:this.a.h}:null}};var wN=class{constructor(a){this.f=a;this.a=new _.aq(a,!1)}},sN=[[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]],tN=class{constructor(a,b){this.id=a;this.a=b}};var BN=class{parse(a,b,c,d){var e;b=new wN(new DataView(b));if(440786851!==uN(b).id)throw _.zh("Not an EBML element."),new _.I(_.D,3,3008);var f=uN(b);if(408125543!==f.id)throw _.zh("Not a Segment element."),new _.I(_.D,3,3009);b=f.a.byteOffset;f=new wN(f.a);for(e=null;_.So(f.a);){var g=uN(f);if(357149030===g.id){e=g;break}}if(!e)throw _.zh("Not an Info element."),new _.I(_.D,3,3010);f=new wN(e.a);g=1E6;for(e=null;_.So(f.a);){const h=uN(f);if(2807729===h.id)g=vN(h);else if(17545===h.id)if(e=h,4===
86
+ e.a.byteLength)e=e.a.getFloat32(0);else if(8===e.a.byteLength)e=e.a.getFloat64(0);else throw new _.I(_.D,3,3003);}if(null==e)throw new _.I(_.D,3,3011);f=g/=1E9;e*=g;a=uN(new wN(new DataView(a)));if(475249515!==a.id)throw _.zh("Not a Cues element."),new _.I(_.D,3,3007);return yN(a,b,f,e,c,d)}};var LN=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 _.T("clpp.dash.SegmentSourceAdapter")}findSegmentPosition(a){const b=DN(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=EN(this,c);if(a>=d.startTime&&a<d.endTime)return c+this.f}c=EN(this,b.Kb);return a<c.startTime?b.Kb+this.f:null}getSegmentReference(a){var b=a-
87
+ this.f;if(!FN(this,b))return null;a=this.a.getSegmentReference(b,a);if(!a)return null;b=EN(this,b);return new _.rI(a.position,b.startTime,b.endTime,a.Da,a.na,a.ja,a.Ja,a.keyInfo,a.Xc,a.timescale,a.horizontalTiles,a.verticalTiles,a.durationPerTile,a.a,a.initSegment,a.cd,a.Ga)}adjustSegmentDurations(a,b){if(FN(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.ne+=b:this.h.push({position:a,ne:b})}}getDuration(){const a=DN(this);if(!a)return 0;
88
+ const b=EN(this,a.Kb);return EN(this,a.Zb).endTime-b.startTime}getLastSegmentEndTime(){const a=DN(this);return a?EN(this,a.Zb).endTime:0}};var PO=class{constructor(a,b){this.g=a;this.f=b;this.a={clockSyncUri:void 0}}};var VN=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Re).set(JM,_.xd).set(IM,_.vd).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.vd).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.td).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.sd),eO=(new Map).set(_.xd,function(a){const b=gO(a);if(b)return{licenseUrl:b,origin:_.JA};if(a=_.O.Wb(a.node,"urn:microsoft","laurl"))if(a=a.getAttribute("licenseUrl"))return{licenseUrl:a,origin:"ms:laurl"};return null}).set(_.vd,
89
+ function(a){var b=_.O;const c=gO(a);if(c)return{licenseUrl:c,origin:_.JA};a=b.Wb(a.node,FM,"pro");if(!a)return null;b=b.f(a);if(!b)return null;b=_.am(b);return(b=_.hq(b).h)?{licenseUrl:b,origin:"mspr:pro"}:null}),XN=new _.T("clpp.dash.ContentProtection");var QO=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 _.sI(5);this.B=new _.Li(()=>{this.dc()});this.A=new _.eu;this.j=new Map;this.g=new _.T("clpp.dash.DashParser");this.C=null;this.J=new PO(this.g,(a,b)=>{a=_.vk(a,this.a.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.Fl(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
90
  this;return _.w(function*(){c.o=[a];c.D=b;const d=yield mO(c);c.D&&nO(c,d);if(!c.D)throw new _.I(_.D,7,7001);return c.f})}requestStop(){this.K=!0}stop(){this.a=this.D=null;this.o=[];this.f=null;this.G=[];this.H={};this.C=null;this.l=-1;this.B.stop();this.F.clear();this.j.clear();return this.A.destroy()}update(){mO(this).catch(a=>{if(this.D&&a)this.D.onError(a)})}setCurrentVariant(){}dc(){const a=this;return _.w(function*(){a.g.debug(_.BA);let b=0;try{b=yield mO(a)}catch(c){if(a.D&&c.a&&(a.D.onError(c),
91
- c.severity===_.D))return}a.D&&(a.K?yield a.stop():nO(a,b))})}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(function*(){let d;const e=c.f.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.tl(`Could not load text stream with id: ${a}`);return d})}};_.x("clpp.dash.DashComponent",class extends _.Ev{install(){_.Pt.mpd=QO;_.Ot[_.vc]=QO}uninstall(){_.QC("mpd");_.RC(_.vc)}id(){return"dash"}});};f.call(g, window);
91
+ c.severity===_.D))return}a.D&&(a.K?yield a.stop():nO(a,b))})}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(function*(){let d;const e=c.f.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.pl(`Could not load text stream with id: ${a}`);return d})}};_.x("clpp.dash.DashComponent",class extends _.Ev{install(){_.Kt.mpd=QO;_.Jt[_.vc]=QO}uninstall(){_.QC("mpd");_.RC(_.vc)}id(){return"dash"}});};f.call(g, window);
package/cl.externs.js CHANGED
@@ -2029,14 +2029,6 @@ clpp.cast.playlist.CastPlaylist.prototype.start = function() {
2029
2029
  */
2030
2030
  clpp.cast.playlist.CastPlaylist.prototype.toggleCast = function() {
2031
2031
  };
2032
- clpp.cdn;
2033
- /**
2034
- * @extends {clpp.AbstractComponent}
2035
- * @implements {cl.api.IComponent}
2036
- * @constructor
2037
- */
2038
- clpp.cdn.CdnChallengeComponent = function() {
2039
- };
2040
2032
  /**
2041
2033
  * @param {{companionSdk: (undefined|{name: string, version: string})}} configuration
2042
2034
  * @return {undefined}
@@ -2097,15 +2089,6 @@ clpp.drm.DrmToday = function() {
2097
2089
  clpp.drm.DrmToday.Environment = {PRODUCTION:1, STAGING:2, DEMO:3, TEST:4};
2098
2090
  /** @enum {string} */
2099
2091
  clpp.drm.DrmToday.WidevineCertificates = {V1_PROD:1, V1_STAGING:2, V2:3};
2100
- /**
2101
- * @param {string} name
2102
- * @param {string} baseUrl
2103
- * @param {!Object<string,string>=} opt_urls
2104
- * @return {undefined}
2105
- * @this {(typeof clpp.drm.DrmToday)}
2106
- */
2107
- clpp.drm.DrmToday.registerCustom = function(name, baseUrl, opt_urls) {
2108
- };
2109
2092
  /**
2110
2093
  * @param {string} wvLicenseUrl
2111
2094
  * @param {string} prLicenseUrl
@@ -2180,14 +2163,6 @@ clpp.drm.eme.EmeFactory = function() {
2180
2163
  };
2181
2164
  /** @enum {string} */
2182
2165
  clpp.drm.eme.EmeFactory.Apis = {STANDARD:1, APPLE:2, WEBKIT:3, NOP:4};
2183
- /**
2184
- * @param {string} name
2185
- * @param {string} baseUrl
2186
- * @param {!Object<string,string>=} opt_urls
2187
- * @return {undefined}
2188
- */
2189
- clpp.drm.registerCustomDrmToday = function(name, baseUrl, opt_urls) {
2190
- };
2191
2166
  /**
2192
2167
  * @param {!clpp.drm.DrmEnvironment} env
2193
2168
  * @return {undefined}
@@ -2269,6 +2244,7 @@ clpp.events.TIMELINE_CUE_ADDED;
2269
2244
  clpp.events.TIMELINE_CUE_ENTER;
2270
2245
  clpp.events.TIMELINE_CUE_EXIT;
2271
2246
  clpp.events.TRACKS_ADDED;
2247
+ clpp.events.TRACKS_REMOVED;
2272
2248
  clpp.events.USER_SEEKED;
2273
2249
  clpp.events.USER_SEEKING;
2274
2250
  clpp.events.VIDEO_BUFFER_CHANGED;
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 dU="clpp-freewheel",eU="clpp.freewheel.AdsManagerFactory",fU="freewheel",gU=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},hU=function(a){const b=[];typeof a.networkId!==_.r&&b.push("networkId");typeof a.serverUrl!==_.Uf&&b.push("serverUrl");typeof a.profileId!==_.Uf&&b.push("profileId");typeof a.videoAssetId!==_.Uf&&typeof a.videoAssetId!==_.r&&b.push("videoAssetId");
2
- if(b.length)throw new _.I(1,9,12001,{missingKeys:b.join(", ")});},iU=function(){return _.w(function*(){var a=new _.Kv;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})},jU=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,a.X.bind(a));a.l.on(a.a,
3
- 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,_.gg,a.R.bind(a));a.l.on(a.m,_.Rf,a.P.bind(a))},kU=function(a){const b=a.m.Gd(fU).$c();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},lU=function(a){const b=a.m.Gd(fU).$c();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(dU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},mU=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||
4
- 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))},nU=class extends _.Uv{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Fi(_.Fd,{id:dU}),this.f=_.Fi(_.t,{"class":_.ad}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.I(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),
5
- this.f=this.a=null)}id(){return fU}$c(){return this.a}ai(){return this.f}};_.x("clpp.freewheel.FreeWheelPlugin",nU);nU.prototype.getAdVideo=nU.prototype.ai;nU.prototype.getAdContainer=nU.prototype.$c;nU.Id=fU;nU.AD_CONTAINER_ID=dU;var oU=class{create(){return new nU}};var X=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}eb(){return"FreeWheel AdManager SDK"}fb(){return tv.freewheel.SDK.version}hb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Uf?a:""}zb(){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}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 2;default:return 1}}getPodIndex(){switch(this.Ca()){case 0:return 0;case 2: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 2:return-1;default:return this.f.getTimePosition()}}gb(){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[]}Ab(){return null}};
8
- X.prototype.getVideoElement=X.prototype.Ab;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.gb;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.Ua;X.prototype.getMediaWidth=X.prototype.Va;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Ra;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.zb;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.hb;X.prototype.getAdManagerVersion=X.prototype.fb;X.prototype.getAdManagerName=X.prototype.eb;var pU=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
- pU.prototype.hasPostroll=pU.prototype.Pb;pU.prototype.hasPreroll=pU.prototype.Qb;pU.prototype.getCuePoints=pU.prototype.getCuePoints;var qU=class{constructor(a){this.g=new _.T("clpp.freewheel.AdsManager");this.m=a;this.l=new _.Vt;this.K=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.M=[];this.I=[];this.L=[];this.H=new _.Kl;this.B=null;this.C=!1;this.G=1;this.J=!1;this.F=!0}load(){const a=this;return _.w(function*(){const b=a.m.getConfiguration().freewheel||{};try{hU(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!==_.Uf&&typeof b.siteSectionId!==_.r||a.a.setSiteSection(b.siteSectionId);const c=yield iU();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,gU(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ie&&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);jU(a);a.a.submitRequest();return a.H})}j(){if(this.M.length){lU(this);this.f=this.M.shift();this.f.play();var a=!1}else this.f?(this.f.resume(),a=!1):(kU(this),a=!0);return a}A(){}jb(){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}qb(){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.jb()}resume(){this.j()}w(){return!0}o(){const a=this;return _.w(function*(){a.l.release();a.B&&(a.B.stop(),a.B=null);kU(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(_.qc,{adsTimeline:new pU(this.a)})),this.B=new _.Iv(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.Gd(fU).f);else this.m.onError(new _.I(1,9,10003,{errorType:0},void 0));this.H.resolve()}X(a){mU(this,_.Ub,a);this.B.start()}W(a){this.f=null;a=a.slot;mU(this,_.Vb);this.B.stop();kU(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;mU(this,_.mc,a);mU(this,_.cc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:mU(this,_.nc,a);this.F=this.J=!1;break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:mU(this,_.Zb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:mU(this,_.ec,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:mU(this,
17
- _.oc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:mU(this,_.Yb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:mU(this,_.Xb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:this.F=!0;mU(this,_.hc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:this.F=!1;mU(this,_.kc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:mU(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:mU(this,_.Wb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:mU(this,_.jc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.I(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();lU(this);this.f.play()}}}P(a){if((a=a.detail)&&this.a)switch(a.currentState){case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;
19
- case 4:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 5:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.L.length?(lU(this),this.f=this.L.shift(),this.f.play()):kU(this);break;case _.Hs:case _.As:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};qU.prototype.resume=qU.prototype.resume;qU.prototype.pause=qU.prototype.pause;qU.prototype.getVolume=qU.prototype.getVolume;qU.prototype.setVolume=qU.prototype.setVolume;qU.prototype.getPosition=qU.prototype.getPosition;
20
- qU.prototype.skip=qU.prototype.skip;_.Kh(new class{constructor(){this.Ya=new _.T(eU)}name(){return eU}a(a,b){return a.namespace()!==_.hd&&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 qU(a)}});_.Tn(new oU);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cU="clpp-freewheel",dU="clpp.freewheel.AdsManagerFactory",eU="freewheel",fU=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},gU=function(a){const b=[];typeof a.networkId!==_.r&&b.push("networkId");typeof a.serverUrl!==_.Uf&&b.push("serverUrl");typeof a.profileId!==_.Uf&&b.push("profileId");typeof a.videoAssetId!==_.Uf&&typeof a.videoAssetId!==_.r&&b.push("videoAssetId");
2
+ if(b.length)throw new _.I(1,9,12001,{missingKeys:b.join(", ")});},hU=function(){return _.w(function*(){var a=new _.Kv;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})},iU=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,a.X.bind(a));a.l.on(a.a,
3
+ 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,_.gg,a.R.bind(a));a.l.on(a.m,_.Rf,a.P.bind(a))},jU=function(a){const b=a.m.Gd(eU).$c();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},kU=function(a){const b=a.m.Gd(eU).$c();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(cU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},lU=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||
4
+ 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))},mU=class extends _.Uv{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Bi(_.Gd,{id:cU}),this.f=_.Bi(_.t,{"class":_.bd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.I(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),
5
+ this.f=this.a=null)}id(){return eU}$c(){return this.a}Wh(){return this.f}};_.x("clpp.freewheel.FreeWheelPlugin",mU);mU.prototype.getAdVideo=mU.prototype.Wh;mU.prototype.getAdContainer=mU.prototype.$c;mU.Id=eU;mU.AD_CONTAINER_ID=cU;var nU=class{create(){return new mU}};var X=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}cb(){return"FreeWheel AdManager SDK"}eb(){return tv.freewheel.SDK.version}gb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Uf?a:""}zb(){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}Qa(){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():""}Ua(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}Ta(){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 2;default:return 1}}getPodIndex(){switch(this.Ca()){case 0:return 0;case 2: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 2:return-1;default:return this.f.getTimePosition()}}fb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}Va(){return this.f.getAdCount()}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Ab(){return null}};
8
+ X.prototype.getVideoElement=X.prototype.Ab;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.Va;X.prototype.getPositionInSequence=X.prototype.fb;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.Ta;X.prototype.getMediaWidth=X.prototype.Ua;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Qa;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.zb;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.gb;X.prototype.getAdManagerVersion=X.prototype.eb;X.prototype.getAdManagerName=X.prototype.cb;var oU=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
+ oU.prototype.hasPostroll=oU.prototype.Pb;oU.prototype.hasPreroll=oU.prototype.Qb;oU.prototype.getCuePoints=oU.prototype.getCuePoints;var pU=class{constructor(a){this.g=new _.T("clpp.freewheel.AdsManager");this.m=a;this.l=new _.Qt;this.K=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.M=[];this.I=[];this.L=[];this.H=new _.Gl;this.B=null;this.C=!1;this.G=1;this.J=!1;this.F=!0}load(){const a=this;return _.w(function*(){const b=a.m.getConfiguration().freewheel||{};try{gU(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!==_.Uf&&typeof b.siteSectionId!==_.r||a.a.setSiteSection(b.siteSectionId);const c=yield hU();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,fU(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ie&&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);iU(a);a.a.submitRequest();return a.H})}j(){if(this.M.length){kU(this);this.f=this.M.shift();this.f.play();var a=!1}else this.f?(this.f.resume(),a=!1):(jU(this),a=!0);return a}A(){}ib(){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}qb(){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.ib()}resume(){this.j()}w(){return!0}o(){const a=this;return _.w(function*(){a.l.release();a.B&&(a.B.stop(),a.B=null);jU(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(_.qc,{adsTimeline:new oU(this.a)})),this.B=new _.Iv(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.Gd(eU).f);else this.m.onError(new _.I(1,9,10003,{errorType:0},void 0));this.H.resolve()}X(a){lU(this,_.Ub,a);this.B.start()}W(a){this.f=null;a=a.slot;lU(this,_.Vb);this.B.stop();jU(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;lU(this,_.mc,a);lU(this,_.cc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:lU(this,_.nc,a);this.F=this.J=!1;break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:lU(this,_.Zb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:lU(this,_.ec,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:lU(this,
17
+ _.oc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:lU(this,_.Yb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:lU(this,_.Xb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:this.F=!0;lU(this,_.hc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:this.F=!1;lU(this,_.kc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:lU(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:lU(this,_.Wb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:lU(this,_.jc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.I(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();kU(this);this.f.play()}}}P(a){if((a=a.detail)&&this.a)switch(a.currentState){case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;
19
+ case 4:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 5:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.L.length?(kU(this),this.f=this.L.shift(),this.f.play()):jU(this);break;case _.Fs:case _.vs:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};pU.prototype.resume=pU.prototype.resume;pU.prototype.pause=pU.prototype.pause;pU.prototype.getVolume=pU.prototype.getVolume;pU.prototype.setVolume=pU.prototype.setVolume;pU.prototype.getPosition=pU.prototype.getPosition;
20
+ pU.prototype.skip=pU.prototype.skip;_.Gh(new class{constructor(){this.Xa=new _.T(dU)}name(){return dU}a(a,b){return a.namespace()!==_.id&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Xa.warn("FreeWheel SDK is not loaded."),!1):!1}create(a){return new pU(a)}});_.Pn(new nU);};f.call(g, window);