@castlabs/prestoplay 6.2.7 → 6.2.8

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 (58) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +101 -101
  6. package/cjs/cl.conviva.js +31 -31
  7. package/cjs/cl.core.js +367 -366
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +68 -67
  10. package/cjs/cl.externs.js +30 -30
  11. package/cjs/cl.freewheel.js +23 -23
  12. package/cjs/cl.hls.js +44 -43
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +21 -21
  16. package/cjs/cl.mse.js +249 -249
  17. package/cjs/cl.muxdata.js +11 -11
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +5 -5
  21. package/cjs/cl.smooth.js +68 -68
  22. package/cjs/cl.thumbnails.js +22 -22
  23. package/cjs/cl.tizen.js +68 -68
  24. package/cjs/cl.ttml.js +26 -26
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +11 -11
  27. package/cjs/cl.vr.js +18 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +15 -15
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +81 -81
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +326 -323
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +64 -62
  38. package/cl.externs.js +30 -30
  39. package/cl.freewheel.js +17 -17
  40. package/cl.hls.js +37 -36
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +24 -24
  43. package/cl.ima.js +14 -14
  44. package/cl.mse.js +218 -218
  45. package/cl.muxdata.js +9 -9
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +4 -4
  49. package/cl.smooth.js +57 -57
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +21 -21
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +13 -13
  58. package/package.json +1 -1
package/cjs/cl.mse.js CHANGED
@@ -1,265 +1,265 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var yt,zt,At,Bt,Ct,Dt,Et,Ft,It,Jt,Lt,Mt,Nt,Ot,Pt,Rt,St,Tt,Vt,Wt,Zt,$t,au,bu,cu,du,fu,hu,iu,ju,mu,pu,ru,su,tu,uu,zu,Cu,Fu,Gu,Lu,Wu,Zu,Yu,$u,av,fv,ev,gv,hv,kv,lv,mv,nv,pv,rv,uv,sv,vv,yv,wv,Av,Bv,Cv,Ev,Dv,Fv,Hv,Iv,Kv,Jv,Gv,Lv,Nv,Mv,Tv,Qv,Ov,Rv,Sv,Uv,Vv,Yv,Xv,Zv,$v,Pv,aw,cw,Wv,dw,ew,fw,gw,hw,iw,jw,kw,mw,nw,lw,ww,vw,tw,xw,yw,zw,Bw,Cw,Ew,Dw,Fw,Iw,Gw,Hw,Kw,Jw,Lw,Mw,Pw,Rw,Qw,Sw,Tw,Uw,Vw,Xw,Yw,Zw,Ww,ax,$w,ex,fx,hx,dx,cx,ix,bx,gx,mx,ox,lx,px,kx,nx,jx,rx,qx,tx,wx,xx,Cx,Ex,Mx,Gx,Ox,Ax,Px,yx,Nx,Tx,Qx,Ux,Hx,Jx,
3
- Xx,Wx,Vx,ey,cy,Zx,fy,Yx,ay,hy,gy,by,Sx,zx,Fx,$x,Lx,Bx,Kx,iy,jy,Rx,Ix,dy,my,ny,oy,uy,sy,ry,qy,ty,wy,Ay,Iy,Ty,zy,Ny,Oy,Py,Jy,Qy,Gy,Vy,rw,pw,sw,qw,uw,ow,$y,Yy,Ly,Hy,Sy,az,Zy,cz,Ry,Uy,vy,Ky,dz,Fy,Dy,gz,My,Ey,fz,ez,xy,bz,Xy,iz,By,Wy,hz,jz,yy,kz,lz,mz,nz,oz,pz,qz,rz,sz;yt=" buffer";zt=" is being or has been set up";At="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";Bt="\x3c/LA_URL\x3e";Ct="\x3cLA_URL\x3e";Dt='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';Et="Jumping forward";
4
- Ft="MediaSource threw QuotaExceededError:";_.Gt="No stream with id";_.Ht="Player is in ERROR state and can not switch to ";It="PrestoPlay TextTrack";Jt="Removing audio from variant - audio not compatible with platform";_.Kt="Updating manifest...";Lt="bufferBehind\x3d";Mt="bufferedBehind\x3d";Nt="calling onCanSwitch()...";Ot="clpp.mse.Player";Pt="currentPeriod.startTime\x3d";_.Qt="onChooseStreams_";Rt="presentationTime\x3d";St="reference.endTime\x3d";Tt="reference.startTime\x3d";_.Ut="subtitles";
5
- Vt="switch: Stream ";Wt=function(a,b){for(var c in a.a)b(c,a.a[c])};_.Xt=function(a){try{var b=a.f.getUint8(a.a);a.a+=1;return b}catch(c){_.Cj()}};_.Yt=function(a){if(1>a.a)throw _.Cj();--a.a};Zt=function(a){for(var b=a.a;_.Bj(a)&&0!==a.f.getUint8(a.a);)a.a+=1;b=a.f.buffer.slice(b,a.a);a.a+=1;return _.Rg(b)};$t=function(a,b){return _.oi("Edge/")?!0:a.L.has(b)};
6
- au=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!$t(a,_.vh(c.mimeType,c.codecs))||d&&d.encrypted&&!$t(a,_.vh(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};bu=function(a,b){for(var c in b)if(b[c]===a)return c;return""};cu=function(a,b){a=_.sh(a);b=_.sh(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};
7
- du=function(a){return a.language?_.sh(a.language):a.audio&&a.audio.language?_.sh(a.audio.language):a.video&&a.video.language?_.sh(a.video.language):_.ye};
8
- _.eu=function(a,b){for(var c=_.sh(a),d=new Set,e=_.t(b),f=e.next();!f.done;f=e.next())d.add(_.sh(f.value));e=_.t(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,f==c)return f;e=_.t(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,cu(f,c))return f;e=_.t(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,k=c;g=_.sh(g);k=_.sh(k);g=g.split("-");k=k.split("-");if(2==g.length&&2==k.length&&g[0]==k[0])return f}d=_.t(d);for(f=d.next();!f.done;f=d.next())if(e=f.value,cu(c,e))return e;return null};
9
- fu=function(a){var b=[a.mimeType];_.cp.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};_.gu=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};hu=function(a,b){if(a===b)return!0;if(!a||!b||a.length!==b.length)return!1;for(var c=0;c<a.length;++c)if(a[c]!==b[c])return!1;return!0};iu=function(a,b){for(var c=new _.Mh(void 0,void 0===b?"total":b),d=_.t(a),e=d.next();!e.done;e=d.next())c.a.push(e.value);c.length=a.length;return c};
10
- ju=function(a,b){for(var c=0,d=_.t(a),e=d.next();!e.done;e=d.next())c+=b(e.value)?1:0;return c};
11
- _.ku=function(a,b){if(!a.length)return b;if(!b.length)return a;for(var c=[],d=0;d<a.length;d++)for(var e=0;e<b.length;e++)if(a[d].keySystem===b[e].keySystem&&a[d].periodId===b[e].periodId){var f=a[d];e=b[e];var g=[];g=g.concat(f.initData||[]);g=g.concat(e.initData||[]);var k=[];k=k.concat(f.keyIds);k=k.concat(e.keyIds);c.push({keySystem:f.keySystem,licenseServerUri:f.licenseServerUri||e.licenseServerUri,distinctiveIdentifierRequired:f.distinctiveIdentifierRequired||e.distinctiveIdentifierRequired,
12
- persistentStateRequired:f.persistentStateRequired||e.persistentStateRequired,videoRobustness:f.videoRobustness||e.videoRobustness,audioRobustness:f.audioRobustness||e.audioRobustness,serverCertificate:f.serverCertificate||e.serverCertificate,initData:g,keyIds:k,periodId:f.periodId});break}return c};_.lu=function(a,b){return a.concat(b)};mu=function(){};
13
- _.nu=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Uh(d)});return a.map(function(d){return new _.Uh(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.lu,[]).map(function(d){return d.toString()})};_.ou=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};pu=function(a,b){return a.start-b.start};
14
- _.qu=function(a){this.m=a;this.log=new _.D("clpp.renditions");this.f=[];this.j=this.a=null;this.h=!1};ru=function(a){return a.f.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};su=function(a){a.a&&a.a.trigger(new _.E(_.dc))};
15
- tu=function(a){if(a.a){for(var b=!1,c={},d=0;d<a.f.length;d++){var e=a.f[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.h?(a.log.debug("Tracking timeupdates"),a.a.on(_.ve,a.g,a),a.h=!0):!b&&a.h&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.ve,a.g),a.h=!1)}};uu=function(a,b,c){a.f=a.f.filter(function(d){if(d.end<=b||d.start>=c)return!1;d.start=Math.max(d.start,b);d.end=Math.min(d.end,c);return!0});a.a&&a.a.trigger(new _.E(_.Ke))};
16
- _.vu=function(a,b){return Array.prototype.filter.call(a.childNodes,function(c){return c instanceof Element&&c.tagName==b})};_.wu=function(a,b){var c=_.vu(a,b);return 1!=c.length?null:c[0]};_.xu=function(a){return Array.prototype.every.call(a.childNodes,function(b){return b.nodeType==Node.TEXT_NODE||b.nodeType==Node.CDATA_SECTION_NODE})?a.textContent.trim():null};
17
- _.yu=function(a,b){var c=new DOMParser,d=null,e=null;try{e=c.parseFromString(a,_.ue)}catch(f){}e&&e.documentElement.tagName==b&&(d=e.documentElement);return d&&0<d.getElementsByTagName("parsererror").length?null:d};zu=function(a,b,c){this.h=new Uint8Array(a);this.a=b;this.f=c};_.Bu=function(a){var b=new Uint8Array(Au),c=4+b.byteLength+a.h.byteLength+4+a.f.byteLength,d=new _.xj(c,!1);_.R(d,c);_.zj(d,b);_.zj(d,a.h);_.R(d,a.f.byteLength);_.zj(d,a.f);return _.Q(d.buffer)};
18
- Cu=function(){zu.apply(this,arguments)};_.Eu=function(a){var b=_.hj(a);b=parseInt(b.byteLength,10).toString(16);b=_.hj("12"+b+a);return new Cu(Du,a,b)};Fu=function(a){var b=[];b.push(a[3]);b.push(a[2]);b.push(a[1]);b.push(a[0]);b.push(a[5]);b.push(a[4]);b.push(a[7]);b.push(a[6]);a=_.Q(a);a.set(b,0);return a};Gu=function(a,b,c,d,e,f){f=void 0===f?null:f;zu.call(this,a,b,d);this.version=e;this.g=c;this.j=f};_.Iu=function(a,b){return b===a.version?a:_.Hu(b,a.a,a.j||void 0,a.g||void 0)};
19
- _.Hu=function(a,b,c,d){var e=_.hj(b);var f=Fu(e);e=_.ej(f);a:switch(f=f.byteLength,_.Jf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[Dt+a+'"\x3e',"\x3cDATA\x3e\x3cPROTECTINFO\x3e","\x3cKEYLEN\x3e"+f+"\x3c/KEYLEN\x3e","\x3cALGID\x3eAESCTR\x3c/ALGID\x3e\x3c/PROTECTINFO\x3e","\x3cKID\x3e"+e+"\x3c/KID\x3e",c?"\x3cCHECKSUM\x3e"+c+"\x3c/CHECKSUM\x3e":"",d?Ct+d+Bt:"",At].join("");break a;case "4.1.0.0":e=[Dt+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
20
- c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?Ct+d+Bt:"",At].join("");break a;case "4.2.0.0":case "4.3.0.0":e=[Dt+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKIDS\x3e\x3cKID ALGID\x3d"AESCTR" ',c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?Ct+d+Bt:"",At].join("");break a;default:_.B("Cannot create PlayReady header in version",a),e=""}_.Jf("New payload",e);e=_.Q(_.Wg(e,!0));return new Gu(Ju,b,d||null,
2
+ var f=function(window){var Ht,It,Jt,Kt,Lt,Mt,Nt,Ot,Rt,St,Ut,Vt,Wt,Xt,Yt,$t,au,bu,du,eu,gu,hu,iu,ju,ku,lu,nu,pu,qu,ru,uu,xu,zu,Au,Bu,Cu,Hu,Ku,Nu,Ou,Tu,dv,gv,fv,hv,iv,nv,mv,ov,pv,sv,uv,vv,wv,yv,Av,Cv,Bv,Dv,Gv,Ev,Iv,Jv,Kv,Mv,Lv,Nv,Pv,Qv,Sv,Rv,Ov,Tv,Vv,Uv,aw,Yv,Wv,Zv,$v,bw,cw,fw,ew,gw,hw,Xv,iw,kw,dw,lw,mw,nw,ow,pw,qw,rw,sw,uw,vw,tw,Ew,Dw,Bw,Fw,Gw,Hw,Jw,Kw,Mw,Lw,Nw,Qw,Ow,Pw,Sw,Rw,Tw,Uw,Xw,Zw,Yw,$w,ax,bx,cx,ex,fx,gx,dx,ix,hx,mx,nx,px,lx,kx,qx,jx,ox,ux,wx,tx,xx,sx,vx,rx,zx,yx,Bx,Ex,Fx,Kx,Mx,Ux,Ox,Wx,Ix,Xx,Gx,Vx,ay,Yx,by,Px,Rx,
3
+ ey,dy,cy,my,ky,gy,ny,fy,iy,py,oy,jy,$x,Hx,Nx,hy,Tx,Jx,Sx,qy,ry,Zx,Qx,ly,uy,vy,wy,Cy,Ay,zy,yy,By,Ey,Iy,Qy,az,Hy,Vy,Wy,Xy,Ry,Yy,Oy,cz,zw,xw,Aw,yw,Cw,ww,hz,fz,Ty,Py,$y,iz,gz,kz,Zy,bz,Dy,Sy,lz,Ny,Ly,oz,Uy,My,nz,mz,Fy,jz,ez,qz,Jy,dz,pz,rz,Gy,sz,tz,uz,vz,wz,xz,yz,zz,Az;Ht=" buffer";It=" is being or has been set up";Jt="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";Kt="\x3c/LA_URL\x3e";Lt="\x3cLA_URL\x3e";Mt='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';Nt="Jumping forward";
4
+ Ot="MediaSource threw QuotaExceededError:";_.Pt="No stream with id";_.Qt="Player is in ERROR state and can not switch to ";Rt="PrestoPlay TextTrack";St="Removing audio from variant - audio not compatible with platform";_.Tt="Updating manifest...";Ut="bufferBehind\x3d";Vt="bufferedBehind\x3d";Wt="calling onCanSwitch()...";Xt="clpp.mse.Player";Yt="currentPeriod.startTime\x3d";_.Zt="onChooseStreams_";$t="presentationTime\x3d";au="reference.endTime\x3d";bu="reference.startTime\x3d";_.cu="subtitles";
5
+ du="switch: Stream ";eu=function(a,b){for(var c in a.a)b(c,a.a[c])};_.fu=function(a){if(1>a.a)throw _.Hj();--a.a};gu=function(a){for(var b=a.a;_.Gj(a)&&0!==a.f.getUint8(a.a);)a.a+=1;b=a.f.buffer.slice(b,a.a);a.a+=1;return _.Tg(b)};hu=function(a,b){return _.si("Edge/")?!0:a.M.has(b)};
6
+ iu=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!hu(a,_.xh(c.mimeType,c.codecs))||d&&d.encrypted&&!hu(a,_.xh(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};ju=function(a,b){for(var c in b)if(b[c]===a)return c;return""};ku=function(a,b){a=_.uh(a);b=_.uh(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};
7
+ lu=function(a){return a.language?_.uh(a.language):a.audio&&a.audio.language?_.uh(a.audio.language):a.video&&a.video.language?_.uh(a.video.language):_.ze};
8
+ _.mu=function(a,b){for(var c=_.uh(a),d=new Set,e=_.t(b),f=e.next();!f.done;f=e.next())d.add(_.uh(f.value));e=_.t(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,f==c)return f;e=_.t(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,ku(f,c))return f;e=_.t(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,k=c;g=_.uh(g);k=_.uh(k);g=g.split("-");k=k.split("-");if(2==g.length&&2==k.length&&g[0]==k[0])return f}d=_.t(d);for(f=d.next();!f.done;f=d.next())if(e=f.value,ku(c,e))return e;return null};
9
+ nu=function(a){var b=[a.mimeType];_.kp.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};_.ou=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};pu=function(a,b){if(a===b)return!0;if(!a||!b||a.length!==b.length)return!1;for(var c=0;c<a.length;++c)if(a[c]!==b[c])return!1;return!0};qu=function(a,b){for(var c=new _.Oh(void 0,void 0===b?"total":b),d=_.t(a),e=d.next();!e.done;e=d.next())c.a.push(e.value);c.length=a.length;return c};
10
+ ru=function(a,b){for(var c=0,d=_.t(a),e=d.next();!e.done;e=d.next())c+=b(e.value)?1:0;return c};
11
+ _.su=function(a,b){if(!a.length)return b;if(!b.length)return a;for(var c=[],d=0;d<a.length;d++)for(var e=0;e<b.length;e++)if(a[d].keySystem===b[e].keySystem&&a[d].periodId===b[e].periodId){var f=a[d];e=b[e];var g=[];g=g.concat(f.initData||[]);g=g.concat(e.initData||[]);var k=[];k=k.concat(f.keyIds);k=k.concat(e.keyIds);c.push({keySystem:f.keySystem,licenseServerUri:f.licenseServerUri||e.licenseServerUri,distinctiveIdentifierRequired:f.distinctiveIdentifierRequired||e.distinctiveIdentifierRequired,
12
+ persistentStateRequired:f.persistentStateRequired||e.persistentStateRequired,videoRobustness:f.videoRobustness||e.videoRobustness,audioRobustness:f.audioRobustness||e.audioRobustness,serverCertificate:f.serverCertificate||e.serverCertificate,initData:g,keyIds:k,periodId:f.periodId});break}return c};_.tu=function(a,b){return a.concat(b)};uu=function(){};
13
+ _.vu=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Wh(d)});return a.map(function(d){return new _.Wh(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.tu,[]).map(function(d){return d.toString()})};_.wu=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};xu=function(a,b){return a.start-b.start};
14
+ _.yu=function(a){this.m=a;this.log=new _.D("clpp.renditions");this.f=[];this.j=this.a=null;this.h=!1};zu=function(a){return a.f.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};Au=function(a){a.a&&a.a.trigger(new _.E(_.ec))};
15
+ Bu=function(a){if(a.a){for(var b=!1,c={},d=0;d<a.f.length;d++){var e=a.f[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.h?(a.log.debug("Tracking timeupdates"),a.a.on(_.we,a.g,a),a.h=!0):!b&&a.h&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.we,a.g),a.h=!1)}};Cu=function(a,b,c){a.f=a.f.filter(function(d){if(d.end<=b||d.start>=c)return!1;d.start=Math.max(d.start,b);d.end=Math.min(d.end,c);return!0});a.a&&a.a.trigger(new _.E(_.Le))};
16
+ _.Du=function(a,b){return Array.prototype.filter.call(a.childNodes,function(c){return c instanceof Element&&c.tagName==b})};_.Eu=function(a,b){var c=_.Du(a,b);return 1!=c.length?null:c[0]};_.Fu=function(a){return Array.prototype.every.call(a.childNodes,function(b){return b.nodeType==Node.TEXT_NODE||b.nodeType==Node.CDATA_SECTION_NODE})?a.textContent.trim():null};
17
+ _.Gu=function(a,b){var c=new DOMParser,d=null,e=null;try{e=c.parseFromString(a,_.ve)}catch(f){}e&&e.documentElement.tagName==b&&(d=e.documentElement);return d&&0<d.getElementsByTagName("parsererror").length?null:d};Hu=function(a,b,c){this.h=new Uint8Array(a);this.a=b;this.f=c};_.Ju=function(a){var b=new Uint8Array(Iu),c=4+b.byteLength+a.h.byteLength+4+a.f.byteLength,d=new _.Cj(c,!1);_.R(d,c);_.Ej(d,b);_.Ej(d,a.h);_.R(d,a.f.byteLength);_.Ej(d,a.f);return _.Q(d.buffer)};
18
+ Ku=function(){Hu.apply(this,arguments)};_.Mu=function(a){var b=_.mj(a);b=parseInt(b.byteLength,10).toString(16);b=_.mj("12"+b+a);return new Ku(Lu,a,b)};Nu=function(a){var b=[];b.push(a[3]);b.push(a[2]);b.push(a[1]);b.push(a[0]);b.push(a[5]);b.push(a[4]);b.push(a[7]);b.push(a[6]);a=_.Q(a);a.set(b,0);return a};Ou=function(a,b,c,d,e,f){f=void 0===f?null:f;Hu.call(this,a,b,d);this.version=e;this.g=c;this.j=f};_.Qu=function(a,b){return b===a.version?a:_.Pu(b,a.a,a.j||void 0,a.g||void 0)};
19
+ _.Pu=function(a,b,c,d){var e=_.mj(b);var f=Nu(e);e=_.jj(f);a:switch(f=f.byteLength,_.Kf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[Mt+a+'"\x3e',"\x3cDATA\x3e\x3cPROTECTINFO\x3e","\x3cKEYLEN\x3e"+f+"\x3c/KEYLEN\x3e","\x3cALGID\x3eAESCTR\x3c/ALGID\x3e\x3c/PROTECTINFO\x3e","\x3cKID\x3e"+e+"\x3c/KID\x3e",c?"\x3cCHECKSUM\x3e"+c+"\x3c/CHECKSUM\x3e":"",d?Lt+d+Kt:"",Jt].join("");break a;case "4.1.0.0":e=[Mt+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
20
+ c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?Lt+d+Kt:"",Jt].join("");break a;case "4.2.0.0":case "4.3.0.0":e=[Mt+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKIDS\x3e\x3cKID ALGID\x3d"AESCTR" ',c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?Lt+d+Kt:"",Jt].join("");break a;default:_.B("Cannot create PlayReady header in version",a),e=""}_.Kf("New payload",e);e=_.Q(_.Yg(e,!0));return new Ou(Ru,b,d||null,
21
21
  e,a,c)};
22
- _.Ku=function(a){a:{a=new _.Aj(new DataView(a.buffer),!0);_.Ej(a);for(_.Dj(a);_.Bj(a);)if(1===_.Dj(a)){var b=_.Dj(a);a=_.Hj(a,b);break a}a=null}b=_.Tg(a,!0);var c=_.yu(b,"WRMHEADER");b=c.getAttribute("version");var d=_.wu(c,"DATA");c=(c=_.wu(d,"LA_URL"))?_.xu(c):"";var e="",f=_.wu(d,"KID");if(f){e=_.xu(f)||"";var g=f.getAttribute("CHECKSUM")}else if((f=_.wu(d,"PROTECTINFO"))&&(f=_.wu(f,"KIDS"))&&(e=_.wu(f,"KID").getAttribute("VALUE")||""),d=_.wu(d,"CHECKSUM"))g=d.textContent;d=_.gj(e);d=Fu(d);d=_.ij(d);
23
- return new Gu(Ju,d,c,a,b,g)};Lu=function(a,b){for(var c=null,d=_.t(a),e=d.next();!e.done;e=d.next())e=e.value,b>=e.startTime&&(c=e);return c};_.Mu=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.Nu=function(a,b,c){var d=Math.pow(a.g,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.Ou=function(a){return a.a/(1-Math.pow(a.g,a.f))};
24
- _.Pu=function(a,b,c,d,e,f,g,k){a=_.gh(a);a.timeout=d.timeout;a.maxAttempts=d.maxAttempts;a.baseDelay=d.baseDelay;a.fuzzFactor=d.fuzzFactor;a.backoffFactor=d.backoffFactor;if(0!=b||null!=c)a.headers.Range=c?"bytes\x3d"+b+"-"+c:"bytes\x3d"+b+"-";e&&(a.startTime=e);f&&(a.endTime=f);g&&(a.contentType=g);k&&(a.timescale=k);return a};_.Qu=function(a,b,c,d,e){this.Ra=a;this.Ka=b;this.za=c;this.keyInfo=d||null;this.Wb=_.H.R(e)?!1:!!e};
25
- _.Ru=function(a,b,c,d,e,f,g,k,l,m,n,p,q){m=void 0===m?null:m;n=void 0===n?null:n;p=void 0===p?null:p;q=void 0===q?null:q;this.position=a;this.startTime=b;this.endTime=c;this.xb=g;this.Ra=d;this.Ka=e;this.za=f;this.keyInfo=k||null;this.Wb=_.H.R(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q};
26
- _.Su=function(a,b,c){var d=void 0===d?!1:d;this.m=a;this.Ie=b;this.hc=this.h=Infinity;this.a=1;this.o=0;this.g=this.j=null;this.w=0;this.f=!0;this.B=!1;this.D=void 0===c?!0:c;this.A=new _.D("clpp.media.PresentationTimeline");this.C=d};
27
- _.Uu=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.Tu(a,b[0].startTime+c);a.a=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.a);a.g=Math.max(a.g,d);null!=a.m&&a.D&&(a.m=(Date.now()+a.w)/1E3-a.g-a.a);a.A.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.Tu=function(a,b){a.j=null==a.j?b:Math.min(a.j,b)};_.Vu=function(a,b){a.a=Math.max(a.a,b);a.A.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
28
- _.Xu=function(a){if(Infinity==a.hc)return 0;a=Wu(a)-a.hc;return Math.max(0,a)};Wu=function(a){if(a.dc())a=a.g;else if(a.isLive()||Infinity!=a.h&&!a.f){var b=(Date.now()+a.w)/1E3;a=Math.min(a.C?Math.max(0,b-(a.a-a.o)-a.m):Math.max(0,b-a.a-a.m),a.h)}else a=a.h;return a};Zu=function(a,b){var c=Math.max(a.j,0);if(Infinity==a.hc)return Math.ceil(1E3*c)/1E3;var d=Wu(a)-a.hc;d=Math.min(d+b,Yu(a));return Math.max(c,d)};
29
- Yu=function(a){var b=a.dc()||!a.isLive()&&(Infinity==a.h||a.f)?0:a.Ie;return Math.max(0,Wu(a)-b)};$u=function(){this.f=function(){};this.a=new Set};av=function(a,b){a.f=b};_.bv=function(a){this.a=a;this.f=new _.D("clpp.media.SegmentIndex")};_.cv=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b){a.a.splice(0,c);return}a.a=[]};
30
- _.dv=function(a,b){for(;a.a.length;)if(0>=a.a[0].endTime)a.a.shift();else break;if(0!=a.a.length){var c=a.a[a.a.length-1];c.startTime>=b||(a.a[a.a.length-1]=new _.Ru(c.position,c.startTime,b,c.Ra,c.Ka,c.za,c.xb,c.keyInfo,c.Wb,c.timescale,c.horizontalTiles,c.verticalTiles,c.durationPerTile))}};fv=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.oh(function(){ev(b,!1)})).Xa(.25)};ev=function(a,b){for(var c=_.t(a.a),d=c.next();!d.done;d=c.next())d.value.m(a.f.currentTime,b)};
31
- gv=function(a){var b=this;this.j=a;this.h=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.o=[{mc:null,lc:2,$b:function(c,d){return b.a(c,d)}},{mc:1,lc:2,$b:function(c,d){return b.a(c,d)}},{mc:3,lc:2,$b:function(c,d){return b.a(c,d)}},{mc:2,lc:1,$b:function(c,d){return b.f(c,d)}},{mc:2,lc:3,$b:function(c,d){return b.f(c,d)}},{mc:1,lc:3,$b:function(c,d){return b.g(c,d)}},{mc:3,lc:1,$b:function(c,d){return b.g(c,d)}}]};hv=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
32
- _.iv=function(a){_.lo[a]&&delete _.lo[a]};_.jv=function(a){_.jo[a]&&delete _.jo[a]};kv=function(a,b){this.o=null;this.B=a;this.g=b;this.h=this.w=0;this.j=Infinity;this.f=this.a=null;this.A="";this.m=new Map};
33
- lv=function(a,b,c,d){return Promise.resolve().then(function(){if(a.o&&a.g)if(null==c||null==d)a.o.parseInit(_.Q(b));else{var e={periodStart:a.w,segmentStart:c,segmentEnd:d};e=a.o.parseMedia(_.Q(b),e);var f=e.cues.filter(function(g){return g.startTime>=a.h&&g.startTime<a.j});a.g.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.h));a.f=Math.min(d,a.j)}})};
34
- mv=function(a,b,c){a.A=b;if(b=a.m.get(b))for(var d=_.t(b.keys()),e=d.next();!e.done;e=d.next())if(e=b.get(e.value))e=e.filter(function(f){return f.endTime<=c}),a.g.append(e,[])};
35
- nv=function(a,b,c,d,e){var f=c+" "+d,g=new Map;b=_.t(b);for(var k=b.next();!k.done;k=b.next()){var l=k.value;k=l.stream;g.has(k)||g.set(k,new Map);g.get(k).has(f)||g.get(k).set(f,[]);l.startTime+=e;l.endTime+=e;l.startTime>=a.h&&l.startTime<a.j&&(l=new _.qg(l.startTime,l.endTime,l.text),g.get(k).get(f).push(l),k==a.A&&a.g.append([l],[]))}e=_.t(g.keys());for(f=e.next();!f.done;f=e.next())for(f=f.value,a.m.has(f)||a.m.set(f,new Map),b=_.t(g.get(f).keys()),k=b.next();!k.done;k=b.next())k=k.value,l=g.get(f).get(k),
36
- a.m.get(f).set(k,l);a.a=null==a.a?Math.max(c,a.h):Math.min(a.a,Math.max(c,a.h));a.f=Math.max(a.f,Math.min(d,a.j))};_.ov=function(a){a=a.toLowerCase();return _.Go[a]||window.muxjs&&a==_.Qb?!0:!1};pv=function(){this.a=new muxjs.mp4.CaptionParser;this.j=[];this.h={}};_.qv=function(){};rv=function(){this.a=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0,remux:!1});this.f=null;this.m=[];this.j=[];this.g=[];this.h=!1;this.a.on("data",this.w.bind(this));this.a.on("done",this.o.bind(this))};
37
- uv=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?MediaSource.isTypeSupported(sv(b,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.sd)):MediaSource.isTypeSupported(sv(_.Zb,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.sd))||MediaSource.isTypeSupported(sv(_.He,a))};
38
- sv=function(a,b){var c=b.replace(/mp2t/i,_.sd);a==_.Zb&&(c=c.replace(_.He,_.Zb));var d=/avc1\.(66|77|100)\.(\d+)/.exec(c);if(d){var e="avc1.",f=d[1],g=Number(d[2]);e=("66"==f?e+"4200":"77"==f?e+"4d00":e+"6400")+(g>>4).toString(16);e+=(g&15).toString(16);c=c.replace(d[0],e)}return c};vv=function(a,b){a.h=!0;a.f=new _.Oh;a.m=[];a.j=[];a.g=[];var c=_.Q(b);a.a.push(c);a.a.flush();a.h&&a.f.reject(new _.J(_.K,3,3018));return a.f};
39
- _.xv=function(a,b,c,d,e){this.j=a;this.A=c;this.f={};this.J=!1;this.g=null;this.h={};this.o=new _.Tf;this.I=!1;this.w={};this.D=b;this.B=d;this.K=e;this.L=this.K.streaming.maxSegmentToMediaOffset||1;this.G=new _.Oh;this.C={};this.m=wv(this,this.G);this.a=new _.D("clpp.mse.MediaSourceEngine")};yv=function(a){var b=_.vh(a.mimeType,a.codecs),c=fu(a);return _.ov(b)||MediaSource.isTypeSupported(c)||uv(b,a.type)};
40
- wv=function(a,b){var c=new MediaSource,d=zv(c);a.o.one(c,"sourceopen",function(){URL.revokeObjectURL(d);b.resolve()});a.j.src=d;return c};Av=function(a,b){b.forEach(function(c,d){var e=a.m.addSourceBuffer(c);a.o.on(e,_.Vc,a.S.bind(a,d));a.o.on(e,"updateend",a.Gc.bind(a,d));a.f[d]=e;a.h[d]=[];a.C[d]=!1});a.J=b.has(_.Zb)&&b.has(_.He)};Bv=function(a,b){a.g||(a.g=new kv(a.K,a.A));var c=a.g;if(b!=_.Qb){var d=_.Go[b];if(!d)throw new _.J(_.K,2,2012,"Text parser is unavailable for "+b);c.o=new d(c.B)}};
41
- Cv=function(a){return a.m?a.m.readyState==_.Uc:!0};Ev=function(a){var b={};b.total=new _.Mh(a.j.buffered,"total");b.audio=Dv(a,_.Zb);b.video=Dv(a,_.He);var c=[];a.g&&(c=[{start:a.g.lb(),end:a.g.ra()}]);b.text=iu(c,_.se);return b};Dv=function(a,b){try{return new _.Mh(a.f[b].buffered,b)}catch(c){return b in a.f&&a.a.error("failed to get buffered range for "+b,c),null}};
42
- Fv=function(a,b){if(!a.f[b])return"";var c=Dv(a,b);if(null===c)return"";for(var d="",e=0;e<c.length;e++)0<e&&(d+=" "),d+=c.start(e).toFixed(3)+"-"+c.end(e).toFixed(3);return d};
43
- Hv=function(a,b,c,d,e,f,g,k){k=void 0===k?!1:k;var l=a.f[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.He&&null!==d&&null!==e&&k&&(m=0<n?l.buffered.end(n-1):-1);b==_.se?c=lv(a.g,c,d,e):a.w[b]?c=vv(a.w[b],c).then(function(p){a.g||Bv(a,_.te);p.captions&&p.captions.length&&nv(a.g,p.captions,d,e,a.f.video.timestampOffset);var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(Gv(a,_.Zb,a.ae.bind(a,_.Zb,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(Gv(a,_.He,a.ae.bind(a,_.He,p.video.buffer)));
44
- return Promise.all(q)}):(f&&window.muxjs&&(a.g||Bv(a,_.te),null==d&&null==e?a.D.init(c):a.D.g(c,function(p){p.length&&nv(a.g,p,d,e,a.f.video.timestampOffset)})),c=Gv(a,b,a.ae.bind(a,b,c)));return c.then(function(){if(b===_.He&&null!==d&&null!==e&&!k)a.B.append(d,e,g),null!==d&&null!==e&&a.a.debug("Appended video segment ",d,e,"Buffer:",Fv(a,b));else if(b===_.Zb&&null!==d&&null!==e)su(a.B),null!==d&&null!==e&&a.a.debug("Appended audio segment ",d,e,"Buffer:",Fv(a,b));else if(b===_.He&&null!==d&&null!==
45
- e&&k){var p=l.buffered.length,q=0<p?l.buffered.end(p-1):-1;0>m&&0<p&&(m=l.buffered.start(0));0<=m&&0<q&&a.B.append(m,q,g)}if(!a.C[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var r=d-p;if(Math.abs(r)>a.L&&0===l.timestampOffset)return a.a.warn("Detected a delta of "+r+" between media times and segment times for "+(b+". The segment start time is ")+(d+" and the media start time is ")+(p+". Adjusting timestampOffset.")),p=Gv(a,b,function(){a.gg(b,r)}),q=Gv(a,b,a.yf.bind(a,b,!1)),Promise.all([p,
46
- q])}null!==d&&null!==e&&(a.C[b]=!0)})["catch"](function(p){throw p;})};Iv=function(a,b){var c=a.ra(_.He)||0;mv(a.g,b,c)};Kv=function(a,b,c,d,e){if(b==_.se)return a.g.w=c,a=a.g,a.h=d,a.j=e,Promise.resolve();b=Jv(a,b,c,d,e);a.J&&(b=b.concat(Jv(a,_.Zb,c,d,e)));return Promise.all(b)};Jv=function(a,b,c,d,e){return[Gv(a,b,a.rg.bind(a,b)),Gv(a,b,a.gg.bind(a,b,c)),Gv(a,b,a.Cj.bind(a,b,d,e))]};
47
- Gv=function(a,b,c){if(a.I)return Promise.reject();c={start:c,p:new _.Oh};a.h[b].push(c);1===a.h[b].length&&Lv(a,b);return c.p};Lv=function(a,b){var c=a.h[b][0];if(c)try{a.a.debug("Starting next operation for "+b),c.start()}catch(d){"QuotaExceededError"==d.name?c.p.reject(new _.J(_.K,3,3017,{type:b})):c.p.reject(new _.J(_.K,3,3015,{mediaError:d})),Mv(a,b)}else a.a.debug("No more scheduled operations for "+b)};
48
- Nv=function(a,b){if(a.I)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.Oh,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.h[d].push(f);c.push(e);1==a.h[d].length&&f.start()}return Promise.all(c).then(function(){for(var g in a.f);try{b()}catch(m){var k=Promise.reject(new _.J(_.K,3,3015,{mediaError:m}))}for(var l in a.f)Mv(a,l);return k},function(){for(var g in a.f)a.h[g].length&&a.h[g].shift();return Promise.reject()})};Mv=function(a,b){a.h[b].shift();Lv(a,b)};
49
- Tv=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=Ov(e,b,c);e=Pv(e,d);if(1<a.periods.length){var f=function(n){n=n.split(".");var p=n[0];1<n.length&&(p+="."+n[1]);return p.toLowerCase()};b=[];c=_.t(a.periods);for(var g=c.next();!g.done;g=c.next()){d=new Set;g=_.t(g.value.variants);for(var k=g.next();!k.done;k=g.next())k=k.value,null!==k.audio&&d.add(f(k.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<b.length;c={Nd:c.Nd},d++)c.Nd=b[d],l=new Set(_.af(l).concat().filter(function(n){return function(p){return n.Nd.has(p)}}(c)));
50
- e=e.filter(function(n){return 0===l.size&&null===n.audio?!0:0<l.size&&null===n.audio?!1:l.has(f(n.audio.codecs))})}e=Qv(e);var m=Rv(e);a=_.t(a.periods);for(e=a.next();!e.done;e=a.next())e=e.value,e.variants=e.variants.filter(function(n){if(Sv(n)===m)return!0;_.Jf("Dropping Variant (better codec available)",n);return!1})};Qv=function(a){var b=new _.Qf;a=_.t(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Sv(c);b.push(d,c)}return b};
51
- Ov=function(a,b,c){var d={};b=_.t(b);for(var e=b.next();!e.done;d={Sd:d.Sd},e=b.next())if(d.Sd=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.Sd)}}(d)),e.length){a=e;break}d={};c=_.t(c);for(b=c.next();!b.done;d={Ld:d.Ld},b=c.next())if(d.Ld=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.Ld)}}(d)),b.length){a=b;break}return a};
52
- Rv=function(a){var b="",c=Infinity;Wt(a,function(d,e){var f=e.reduce(function(g,k){return g+k.bandwidth||0},0)/e.length;_.Jf(_.Ac,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};Sv=function(a){var b="";a.video&&(b=_.gu(a.video.codecs)[0]);var c="";a.audio&&(c=_.gu(a.audio.codecs)[0]);return b+"-"+c};
53
- Uv=function(a,b,c){function d(f,g,k){return f>=g&&f<=k}var e=a.video;return e&&e.width&&e.height&&!(d(e.width,b.minWidth,Math.min(b.maxWidth,c.width))&&d(e.height,b.minHeight,Math.min(b.maxHeight,c.height))&&d(e.width*e.height,b.minPixels,b.maxPixels))||!d(a.bandwidth,b.minBandwidth,b.maxBandwidth)?!1:!0};Vv=function(a,b,c){var d=!1;a=_.t(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=Uv(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
54
- Yv=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.Y&&!au(a,m))return _.Jf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!yv(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Jf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),yv(n)?_.If("Using AC-3 instead of EC-3 for",Wv(n)):(n.codecs=q,_.If(Jt,Wv(n)),m.audio=null,e=!0,n=null)):(_.If(Jt,Wv(n)),m.audio=null,e=!0,n=null)}return p&&!yv(p)?(_.If("Dropping variant - video not compatible with platform",
55
- Wv(p)),!1):n&&b&&!Xv(n,b)?(_.If("Dropping variant - not compatible with active audio","active audio",Wv(b),"variant.audio",Wv(n)),!1):p&&c&&!Xv(p,c)?(_.If("Dropping variant - not compatible with active video","active video",Wv(c),"variant.video",Wv(p)),!1):!0});if(e){for(var f=!1,g=!1,k=_.t(d.variants),l=k.next();!l.done;l=k.next())l=l.value,!f&&l.video&&l.audio&&(f=!0),g||l.audio||!l.video||(g=!0);f&&g&&(d.variants=d.variants.filter(function(m){return m.video&&!m.audio?(_.If("Dropping variant - not compatible with video + audio",
56
- "variant.video",Wv(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.ov(_.vh(m.mimeType,m.codecs));n||_.Jf("Dropping text stream. Is not supported by the platform.",m);return n})};Xv=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
57
- Zv=function(a){return{id:a.id,active:!1,type:_.se,bandwidth:0,language:a.language,label:a.label,kind:a.kind||null,width:null,height:null,frameRate:null,mimeType:a.mimeType,audioMimeType:null,codecs:a.codecs||null,audioCodec:null,videoCodec:null,primary:a.primary,roles:a.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:a.originalId}};$v=function(a){return a.allowedByApplication&&a.allowedByKeySystem};
58
- Pv=function(a,b){var c=a.filter(function(g){return g.audio&&g.audio.channelsCount}),d=new Map;c=_.t(c);for(var e=c.next();!e.done;e=c.next()){e=e.value;var f=e.audio.channelsCount;d.has(f)||d.set(f,[]);d.get(f).push(e)}c=Array.from(d.keys());if(0===c.length)return a;e=c.filter(function(g){return g<=b});return e.length?d.get(Math.max.apply(null,e)):d.get(Math.min.apply(null,c))};
59
- _.bw=function(a,b,c){b=_.wh(b);var d=a,e=a.filter(function(g){return g.primary});e.length&&(d=e);var f=d.length?d[0].language:"";d=d.filter(function(g){return g.language===f});b.some(function(g){var k=_.eu(_.sh(g),a.map(function(l){return l.language}));return k?(d=a.filter(function(l){return _.sh(l.language)===k}),!0):!1});if(c){b=aw(d,c);if(b.length)return b;_.B("No exact match for the text role could be found.")}else if(b=d.filter(function(g){return 0===g.roles.length}),b.length)return b;b=d.map(function(g){return g.roles}).reduce(_.lu,
60
- []);return b.length?aw(d,b[0]):d};aw=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};cw=function(a,b,c){for(var d=0;d<c.length;d++)if(c[d].audio===a&&c[d].video===b)return c[d];return null};
61
- Wv=function(a){var b=fu(a);return a.type===_.Zb?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.He?"type\x3dvideo mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" frameRate\x3d"+a.frameRate+" width\x3d"+a.width+" height\x3d"+a.height:"unexpected stream type"};
62
- dw=function(a,b){var c=String(_.Cg++);c=new _.xg(c,a);c.mimeType=_.yg(b.mimeType);if(a===_.L||a===_.N)c.label=_.yg(b.label),c.language=_.yg(b.language);a===_.zg?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.N?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.yg(b.audioMimeType)):(c.kind=_.yg(b.kind),c.roles=b.roles);return c};
63
- ew=function(a,b,c){var d=new _.Eg(a===_.zg?""+b.videoId:a===_.N?""+b.audioId:""+b.id,c);switch(a){case _.zg:d.codec=_.yg(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;break;case _.N:d.codec=_.yg(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;break;default:d.codec=_.yg(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.H.Oa(e,d,null,["id","track"])}))||c.renditions.push(d);
64
- return a||d};fw=function(a,b){var c=a.reduce(function(d,e){b===_.zg?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.N&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};gw=function(a,b){if(void 0!==b&&null!==b){var c=a.filter(function(d){return d.audio&&d.audio.id===b});if(0<c.length)return c}return a};
65
- hw=function(a,b,c){function d(f,g){return null==f?null==g:g.id==f}for(var e=0;e<c.length;e++)if(d(a,c[e].audio)&&d(b,c[e].video))return c[e];return null};iw=function(){this.g=new _.D("cl.api.mse.TrackManager");this.l=null;this.h=[];this.a=new Map;this.f=new Map};jw=function(a,b){return a.h.filter(function(c){return c.type===b})};kw=function(a,b){var c=a.a.get(b)||null;return c&&c.track};mw=function(a,b,c){c&&kw(a,c.type)===c&&!a.l.ka()||lw(a,b,c&&c.renditions[0])};
66
- nw=function(a,b){a.a.set(b.track.type,b);b===(a.f.get(b.track.type)||null)&&a.f.set(b.track.type,null)};
67
- lw=function(a,b,c,d){d=void 0===d?!1:d;if(a.l&&((a.a.get(b)||null)!==c||a.l.ka())){var e=a.l;if(c){if(0>a.h.indexOf(c.track))throw Error("Unknown rendition with ID "+c.id);if(b!==c.track.type)throw Error("Types mismatch");a.g.debug("Activate rendition type\n "+b+" with ID: "+c.id);if(b===_.L){var f=e.ea().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),nw(a,c),e.trigger(new _.E(_.Ih)),ow(e,!0).then(function(){pw(e,f)})["catch"](function(n){a.g.warn("Error while activating track",n)}))}else if(b===
68
- _.N)a.f.set(b,c),qw(e,parseInt(c.id,10));else if(b===_.zg){var g=a.a.get(_.N)||null;if(g){var k=rw(e).filter(function(n){return n.videoId==c.id});var l=k.find(function(n){return n.audioId==g.id});if(!l){a.g.debug("Unable to find exact variant. Searching for equivalent");var m=g.track.renditions.map(function(n){return n.id}).filter(function(n){return n!==g.id});l=k.find(function(n){return m.find(function(p){return p==n.audioId})})}}else l=rw(e).find(function(n){return n.videoId==c.id});l?(a.f.set(b,
69
- c),sw(e,l,d)):a.g.warn("Cannot find matching variant")}}else a.g.debug(_.wa+b),kw(a,b)&&(b===_.L?ow(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.E(_.Ih))})["catch"](function(n){a.g.warn("Error while de-activating text tracks",n)}):b===_.N?a.g.info("Enabling ABR for audio is not supported"):sw(e,null,d))}};
70
- ww=function(a){if(a.l){a.g.debug("Track list change detected, updating track list");for(var b=[],c=_.t(Object.values(_.ap)),d=c.next();!d.done;d=c.next())d=d.value,a.a.set(d,null),a.f.set(d,null);c={};d=_.t(a.l.ea());for(var e=d.next();!e.done;c={Sb:c.Sb},e=d.next()){e=e.value;c.Sb=dw(_.L,e);var f=b.find(function(k){return function(l){return tw(l,k.Sb)}}(c));c.Sb=f||c.Sb;var g=ew(_.L,e,c.Sb);e.active&&a.a.set(_.L,g);f||b.push(c.Sb)}uw(a.l)||a.a.set(_.L,null);c=rw(a.l);vw(a,b,c,_.zg);vw(a,b,c,_.N);
71
- a.h=b}};vw=function(a,b,c,d){var e=fw(c,d);c={};e=_.t(e);for(var f=e.next();!f.done;c={Tb:c.Tb},f=e.next()){f=f.value;c.Tb=dw(d,f);var g=b.find(function(l){return function(m){return tw(m,l.Tb)}}(c));c.Tb=g||c.Tb;var k=ew(d,f,c.Tb);f.active&&a.a.set(d,k);g||b.push(c.Tb)}};tw=function(a,b){return a.type===b.type&&a.channelsCount===b.channelsCount&&a.frameRate===b.frameRate&&a.kind===b.kind&&a.label===b.label&&a.language===b.language&&a.mimeType===b.mimeType&&hu(a.roles,b.roles)};
72
- xw=function(a,b,c){if(b){a.h.length||ww(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.t(jw(a,d)),k=g.next();!k.done&&!(f=k.value.renditions.find(function(l){return l.id==b.id}));k=g.next());f&&e!==f&&(nw(a,f),d===_.N?a.l.trigger(new _.E(_.Hh)):d===_.zg&&a.l.trigger(new _.E(_.Le,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};yw=function(){this.f=new _.Mu(2);this.g=new _.Mu(5);this.a=0};zw=function(a,b){return 128E3>a.a?b:Math.min(_.Ou(a.f),_.Ou(a.g))};
73
- _.Aw=function(){this.f=new _.D("clpp.abr");this.w=null;this.j=!1;this.g=new yw;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.h=null};Bw=function(a,b){a&&(b=b.filter(function(c){return Uv(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};Cw=function(){this.a=new Map};Ew=function(a,b){a.a.has(b)||a.a.set(b,new Dw);return a.a.get(b)};Dw=function(){this.text=this.variant=null};
74
- Fw=function(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(var c=_.t(b),d=c.next();!d.done;d=c.next())this.add(d.value)};Iw=function(a,b){var c;if(!(c=!!a.audio!=!!b.audio||!!a.video!=!!b.video||a.language!=b.language)&&(c=a.audio&&b.audio)){c=a.audio;var d=b.audio;c=!(c.channelsCount==d.channelsCount&&Gw(c,d)&&Hw(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(Gw(c,d)&&Hw(c.roles,d.roles)));return c?!1:!0};
75
- Gw=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.gu(f)[0]}),d=b.codecs.split(",").map(function(f){return _.gu(f)[0]});if(c.length!=d.length)return!1;c.sort();d.sort();for(var e=0;e<c.length;e++)if(c[e]!=d[e])return!1;return!0};Hw=function(a,b){var c=new Set(a),d=new Set(b);c["delete"]("main");d["delete"]("main");if(c.size!=d.size)return!1;c=_.t(c);for(var e=c.next();!e.done;e=c.next())if(!d.has(e.value))return!1;return!0};
76
- Kw=function(a){this.a=a;this.f=new Jw(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};Jw=function(a,b,c){this.g=a;this.f=b;this.a=c};Lw=function(a,b){b=_.wh(b);var c=null;b.some(function(d){c=_.eu(_.sh(d),a.map(function(e){return du(e)}));return!!c});return c?a.filter(function(d){return c===du(d)}):[]};Mw=function(a,b){return a.filter(function(c){var d=c.audio;c=c.video;return d&&0<=d.roles.indexOf(b)||c&&0<=c.roles.indexOf(b)})};
77
- Pw=function(a,b){this.a=Nw;this.f=(new Map).set(Nw,b).set(Ow,a)};
78
- Rw=function(a){var b=this;this.f=a;this.a=a.getConfiguration().streaming;this.h=new _.Tf;this.g=new _.D("clpp.mse.media.LiveEdgeObserver");Qw(this)&&(a=this.f.getSurface().getMedia(),this.h.on(a,_.ve,function(){var c=b.f.getPosition(),d=b.f.getSeekRange().end;c=d-c;var e=b.f.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.g.debug("Too far from edge, jump to beginning."),b.f.setPlaybackRate(1),b.f.seek(d)):1===e&&c>=b.a.startChasingAt?(b.g.debug("Not on live edge, increase playback rate."),
22
+ _.Su=function(a){a:{a=new _.Fj(new DataView(a.buffer),!0);_.Kj(a);for(_.Jj(a);_.Gj(a);)if(1===_.Jj(a)){var b=_.Jj(a);a=_.Nj(a,b);break a}a=null}b=_.Vg(a,!0);var c=_.Gu(b,"WRMHEADER");b=c.getAttribute("version");var d=_.Eu(c,"DATA");c=(c=_.Eu(d,"LA_URL"))?_.Fu(c):"";var e="",f=_.Eu(d,"KID");if(f){e=_.Fu(f)||"";var g=f.getAttribute("CHECKSUM")}else if((f=_.Eu(d,"PROTECTINFO"))&&(f=_.Eu(f,"KIDS"))&&(e=_.Eu(f,"KID").getAttribute("VALUE")||""),d=_.Eu(d,"CHECKSUM"))g=d.textContent;d=_.lj(e);d=Nu(d);d=_.nj(d);
23
+ return new Ou(Ru,d,c,a,b,g)};Tu=function(a,b){for(var c=null,d=_.t(a),e=d.next();!e.done;e=d.next())e=e.value,b>=e.startTime&&(c=e);return c};_.Uu=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.Vu=function(a,b,c){var d=Math.pow(a.g,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.Wu=function(a){return a.a/(1-Math.pow(a.g,a.f))};
24
+ _.Xu=function(a,b,c,d,e,f,g,k){a=_.ih(a);a.timeout=d.timeout;a.maxAttempts=d.maxAttempts;a.baseDelay=d.baseDelay;a.fuzzFactor=d.fuzzFactor;a.backoffFactor=d.backoffFactor;if(0!=b||null!=c)a.headers.Range=c?"bytes\x3d"+b+"-"+c:"bytes\x3d"+b+"-";e&&(a.startTime=e);f&&(a.endTime=f);g&&(a.contentType=g);k&&(a.timescale=k);return a};_.Yu=function(a,b,c,d,e){this.Ra=a;this.La=b;this.za=c;this.keyInfo=d||null;this.Vb=_.H.R(e)?!1:!!e};
25
+ _.Zu=function(a,b,c,d,e,f,g,k,l,m,n,p,q){m=void 0===m?null:m;n=void 0===n?null:n;p=void 0===p?null:p;q=void 0===q?null:q;this.position=a;this.startTime=b;this.endTime=c;this.xb=g;this.Ra=d;this.La=e;this.za=f;this.keyInfo=k||null;this.Vb=_.H.R(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q};
26
+ _.$u=function(a,b,c){var d=void 0===d?!1:d;this.m=a;this.Ie=b;this.gc=this.g=Infinity;this.a=1;this.o=0;this.h=this.j=null;this.w=0;this.f=!0;this.B=!1;this.D=void 0===c?!0:c;this.A=new _.D("clpp.media.PresentationTimeline");this.C=d};
27
+ _.bv=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.av(a,b[0].startTime+c);a.a=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.a);a.h=Math.max(a.h,d);null!=a.m&&a.D&&(a.m=(Date.now()+a.w)/1E3-a.h-a.a);a.A.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.av=function(a,b){a.j=null==a.j?b:Math.min(a.j,b)};_.cv=function(a,b){a.a=Math.max(a.a,b);a.A.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
28
+ _.ev=function(a){if(Infinity==a.gc)return 0;a=dv(a)-a.gc;return Math.max(0,a)};dv=function(a){if(a.cc())a=a.h;else if(a.isLive()||Infinity!=a.g&&!a.f){var b=(Date.now()+a.w)/1E3;a=Math.min(a.C?Math.max(0,b-(a.a-a.o)-a.m):Math.max(0,b-a.a-a.m),a.g)}else a=a.g;return a};gv=function(a,b){var c=Math.max(a.j,0);if(Infinity==a.gc)return Math.ceil(1E3*c)/1E3;var d=dv(a)-a.gc;d=Math.min(d+b,fv(a));return Math.max(c,d)};
29
+ fv=function(a){var b=a.cc()||!a.isLive()&&(Infinity==a.g||a.f)?0:a.Ie;return Math.max(0,dv(a)-b)};hv=function(){this.f=function(){};this.a=new Set};iv=function(a,b){a.f=b};_.jv=function(a){this.a=a;this.f=new _.D("clpp.media.SegmentIndex")};_.kv=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b){a.a.splice(0,c);return}a.a=[]};
30
+ _.lv=function(a,b){for(;a.a.length;)if(0>=a.a[0].endTime)a.a.shift();else break;if(0!=a.a.length){var c=a.a[a.a.length-1];c.startTime>=b||(a.a[a.a.length-1]=new _.Zu(c.position,c.startTime,b,c.Ra,c.La,c.za,c.xb,c.keyInfo,c.Vb,c.timescale,c.horizontalTiles,c.verticalTiles,c.durationPerTile))}};nv=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.qh(function(){mv(b,!1)})).Ya(.25)};mv=function(a,b){for(var c=_.t(a.a),d=c.next();!d.done;d=c.next())d.value.m(a.f.currentTime,b)};
31
+ ov=function(a){var b=this;this.j=a;this.h=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.o=[{lc:null,kc:2,Zb:function(c,d){return b.a(c,d)}},{lc:1,kc:2,Zb:function(c,d){return b.a(c,d)}},{lc:3,kc:2,Zb:function(c,d){return b.a(c,d)}},{lc:2,kc:1,Zb:function(c,d){return b.f(c,d)}},{lc:2,kc:3,Zb:function(c,d){return b.f(c,d)}},{lc:1,kc:3,Zb:function(c,d){return b.g(c,d)}},{lc:3,kc:1,Zb:function(c,d){return b.g(c,d)}}]};pv=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
32
+ _.qv=function(a){_.to[a]&&delete _.to[a]};_.rv=function(a){_.ro[a]&&delete _.ro[a]};sv=function(a,b){this.o=null;this.B=a;this.g=b;this.h=this.w=0;this.j=Infinity;this.f=this.a=null;this.A="";this.m=new Map};
33
+ uv=function(a,b,c,d){return Promise.resolve().then(function(){if(a.o&&a.g)if(null==c||null==d)a.o.parseInit(_.Q(b));else{var e={periodStart:a.w,segmentStart:c,segmentEnd:d};e=a.o.parseMedia(_.Q(b),e);var f=e.cues.filter(function(g){return g.startTime>=a.h&&g.startTime<a.j});a.g.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.h));a.f=Math.min(d,a.j)}})};
34
+ vv=function(a,b,c){a.A=b;if(b=a.m.get(b))for(var d=_.t(b.keys()),e=d.next();!e.done;e=d.next())if(e=b.get(e.value))e=e.filter(function(f){return f.endTime<=c}),a.g.append(e,[])};
35
+ wv=function(a,b,c,d,e){var f=c+" "+d,g=new Map;b=_.t(b);for(var k=b.next();!k.done;k=b.next()){var l=k.value;k=l.stream;g.has(k)||g.set(k,new Map);g.get(k).has(f)||g.get(k).set(f,[]);l.startTime+=e;l.endTime+=e;l.startTime>=a.h&&l.startTime<a.j&&(l=new _.sg(l.startTime,l.endTime,l.text),g.get(k).get(f).push(l),k==a.A&&a.g.append([l],[]))}e=_.t(g.keys());for(f=e.next();!f.done;f=e.next())for(f=f.value,a.m.has(f)||a.m.set(f,new Map),b=_.t(g.get(f).keys()),k=b.next();!k.done;k=b.next())k=k.value,l=g.get(f).get(k),
36
+ a.m.get(f).set(k,l);a.a=null==a.a?Math.max(c,a.h):Math.min(a.a,Math.max(c,a.h));a.f=Math.max(a.f,Math.min(d,a.j))};_.xv=function(a){a=a.toLowerCase();return _.Oo[a]||window.muxjs&&a==_.Rb?!0:!1};yv=function(){this.a=new muxjs.mp4.CaptionParser;this.j=[];this.h={}};_.zv=function(){};Av=function(){this.a=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0,remux:!1});this.f=null;this.m=[];this.j=[];this.g=[];this.h=!1;this.a.on("data",this.w.bind(this));this.a.on("done",this.o.bind(this))};
37
+ Cv=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?MediaSource.isTypeSupported(Bv(b,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.td)):MediaSource.isTypeSupported(Bv(_.$b,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.td))||MediaSource.isTypeSupported(Bv(_.Ie,a))};
38
+ Bv=function(a,b){var c=b.replace(/mp2t/i,_.td);a==_.$b&&(c=c.replace(_.Ie,_.$b));var d=/avc1\.(66|77|100)\.(\d+)/.exec(c);if(d){var e="avc1.",f=d[1],g=Number(d[2]);e=("66"==f?e+"4200":"77"==f?e+"4d00":e+"6400")+(g>>4).toString(16);e+=(g&15).toString(16);c=c.replace(d[0],e)}return c};Dv=function(a,b){a.h=!0;a.f=new _.Qh;a.m=[];a.j=[];a.g=[];var c=_.Q(b);a.a.push(c);a.a.flush();a.h&&a.f.reject(new _.J(_.K,3,3018));return a.f};
39
+ _.Fv=function(a,b,c,d,e){this.j=a;this.A=c;this.f={};this.J=!1;this.g=null;this.h={};this.o=new _.Yf;this.I=!1;this.w={};this.D=b;this.B=d;this.K=e;this.M=this.K.streaming.maxSegmentToMediaOffset||1;this.G=new _.Qh;this.C={};this.m=Ev(this,this.G);this.a=new _.D("clpp.mse.MediaSourceEngine")};Gv=function(a){var b=_.xh(a.mimeType,a.codecs),c=nu(a);return _.xv(b)||MediaSource.isTypeSupported(c)||Cv(b,a.type)};
40
+ Ev=function(a,b){var c=new MediaSource,d=Hv(c);a.o.one(c,"sourceopen",function(){URL.revokeObjectURL(d);b.resolve()});a.j.src=d;return c};Iv=function(a,b){b.forEach(function(c,d){var e=a.m.addSourceBuffer(c);a.o.on(e,_.Xc,a.S.bind(a,d));a.o.on(e,"updateend",a.Fc.bind(a,d));a.f[d]=e;a.h[d]=[];a.C[d]=!1});a.J=b.has(_.$b)&&b.has(_.Ie)};Jv=function(a,b){a.g||(a.g=new sv(a.K,a.A));var c=a.g;if(b!=_.Rb){var d=_.Oo[b];if(!d)throw new _.J(_.K,2,2012,"Text parser is unavailable for "+b);c.o=new d(c.B)}};
41
+ Kv=function(a){return a.m?a.m.readyState==_.Wc:!0};Mv=function(a){var b={};b.total=new _.Oh(a.j.buffered,"total");b.audio=Lv(a,_.$b);b.video=Lv(a,_.Ie);var c=[];a.g&&(c=[{start:a.g.lb(),end:a.g.ra()}]);b.text=qu(c,_.te);return b};Lv=function(a,b){try{return new _.Oh(a.f[b].buffered,b)}catch(c){return b in a.f&&a.a.error("failed to get buffered range for "+b,c),null}};
42
+ Nv=function(a,b){if(!a.f[b])return"";var c=Lv(a,b);if(null===c)return"";for(var d="",e=0;e<c.length;e++)0<e&&(d+=" "),d+=c.start(e).toFixed(3)+"-"+c.end(e).toFixed(3);return d};
43
+ Pv=function(a,b,c,d,e,f,g,k){k=void 0===k?!1:k;var l=a.f[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.Ie&&null!==d&&null!==e&&k&&(m=0<n?l.buffered.end(n-1):-1);b==_.te?c=uv(a.g,c,d,e):a.w[b]?c=Dv(a.w[b],c).then(function(p){a.g||Jv(a,_.ue);p.captions&&p.captions.length&&wv(a.g,p.captions,d,e,a.f.video.timestampOffset);var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(Ov(a,_.$b,a.ae.bind(a,_.$b,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(Ov(a,_.Ie,a.ae.bind(a,_.Ie,p.video.buffer)));
44
+ return Promise.all(q)}):(f&&window.muxjs&&(a.g||Jv(a,_.ue),null==d&&null==e?a.D.init(c):a.D.g(c,function(p){p.length&&wv(a.g,p,d,e,a.f.video.timestampOffset)})),c=Ov(a,b,a.ae.bind(a,b,c)));return c.then(function(){if(b===_.Ie&&null!==d&&null!==e&&!k)a.B.append(d,e,g),null!==d&&null!==e&&a.a.debug("Appended video segment ",d,e,"Buffer:",Nv(a,b));else if(b===_.$b&&null!==d&&null!==e)Au(a.B),null!==d&&null!==e&&a.a.debug("Appended audio segment ",d,e,"Buffer:",Nv(a,b));else if(b===_.Ie&&null!==d&&null!==
45
+ e&&k){var p=l.buffered.length,q=0<p?l.buffered.end(p-1):-1;0>m&&0<p&&(m=l.buffered.start(0));0<=m&&0<q&&a.B.append(m,q,g)}if(!a.C[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var r=d-p;if(Math.abs(r)>a.M&&0===l.timestampOffset)return a.a.warn("Detected a delta of "+r+" between media times and segment times for "+(b+". The segment start time is ")+(d+" and the media start time is ")+(p+". Adjusting timestampOffset.")),p=Ov(a,b,function(){a.gg(b,r)}),q=Ov(a,b,a.yf.bind(a,b,!1)),Promise.all([p,
46
+ q])}null!==d&&null!==e&&(a.C[b]=!0)})["catch"](function(p){throw p;})};Qv=function(a,b){var c=a.ra(_.Ie)||0;vv(a.g,b,c)};Sv=function(a,b,c,d,e){if(b==_.te)return a.g.w=c,a=a.g,a.h=d,a.j=e,Promise.resolve();b=Rv(a,b,c,d,e);a.J&&(b=b.concat(Rv(a,_.$b,c,d,e)));return Promise.all(b)};Rv=function(a,b,c,d,e){return[Ov(a,b,a.rg.bind(a,b)),Ov(a,b,a.gg.bind(a,b,c)),Ov(a,b,a.Cj.bind(a,b,d,e))]};
47
+ Ov=function(a,b,c){if(a.I)return Promise.reject();c={start:c,p:new _.Qh};a.h[b].push(c);1===a.h[b].length&&Tv(a,b);return c.p};Tv=function(a,b){var c=a.h[b][0];if(c)try{a.a.debug("Starting next operation for "+b),c.start()}catch(d){"QuotaExceededError"==d.name?c.p.reject(new _.J(_.K,3,3017,{type:b})):c.p.reject(new _.J(_.K,3,3015,{mediaError:d})),Uv(a,b)}else a.a.debug("No more scheduled operations for "+b)};
48
+ Vv=function(a,b){if(a.I)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.Qh,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.h[d].push(f);c.push(e);1==a.h[d].length&&f.start()}return Promise.all(c).then(function(){for(var g in a.f);try{b()}catch(m){var k=Promise.reject(new _.J(_.K,3,3015,{mediaError:m}))}for(var l in a.f)Uv(a,l);return k},function(){for(var g in a.f)a.h[g].length&&a.h[g].shift();return Promise.reject()})};Uv=function(a,b){a.h[b].shift();Tv(a,b)};
49
+ aw=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=Wv(e,b,c);e=Xv(e,d);if(1<a.periods.length){var f=function(n){n=n.split(".");var p=n[0];1<n.length&&(p+="."+n[1]);return p.toLowerCase()};b=[];c=_.t(a.periods);for(var g=c.next();!g.done;g=c.next()){d=new Set;g=_.t(g.value.variants);for(var k=g.next();!k.done;k=g.next())k=k.value,null!==k.audio&&d.add(f(k.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<b.length;c={Nd:c.Nd},d++)c.Nd=b[d],l=new Set(_.df(l).concat().filter(function(n){return function(p){return n.Nd.has(p)}}(c)));
50
+ e=e.filter(function(n){return 0===l.size&&null===n.audio?!0:0<l.size&&null===n.audio?!1:l.has(f(n.audio.codecs))})}e=Yv(e);var m=Zv(e);a=_.t(a.periods);for(e=a.next();!e.done;e=a.next())e=e.value,e.variants=e.variants.filter(function(n){if($v(n)===m)return!0;_.Kf("Dropping Variant (better codec available)",n);return!1})};Yv=function(a){var b=new _.Rf;a=_.t(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=$v(c);b.push(d,c)}return b};
51
+ Wv=function(a,b,c){var d={};b=_.t(b);for(var e=b.next();!e.done;d={Sd:d.Sd},e=b.next())if(d.Sd=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.Sd)}}(d)),e.length){a=e;break}d={};c=_.t(c);for(b=c.next();!b.done;d={Ld:d.Ld},b=c.next())if(d.Ld=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.Ld)}}(d)),b.length){a=b;break}return a};
52
+ Zv=function(a){var b="",c=Infinity;eu(a,function(d,e){var f=e.reduce(function(g,k){return g+k.bandwidth||0},0)/e.length;_.Kf(_.Bc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};$v=function(a){var b="";a.video&&(b=_.ou(a.video.codecs)[0]);var c="";a.audio&&(c=_.ou(a.audio.codecs)[0]);return b+"-"+c};
53
+ bw=function(a,b,c){function d(f,g,k){return f>=g&&f<=k}var e=a.video;return e&&e.width&&e.height&&!(d(e.width,b.minWidth,Math.min(b.maxWidth,c.width))&&d(e.height,b.minHeight,Math.min(b.maxHeight,c.height))&&d(e.width*e.height,b.minPixels,b.maxPixels))||!d(a.bandwidth,b.minBandwidth,b.maxBandwidth)?!1:!0};cw=function(a,b,c){var d=!1;a=_.t(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=bw(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
54
+ fw=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.Y&&!iu(a,m))return _.Kf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!Gv(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Kf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),Gv(n)?_.Jf("Using AC-3 instead of EC-3 for",dw(n)):(n.codecs=q,_.Jf(St,dw(n)),m.audio=null,e=!0,n=null)):(_.Jf(St,dw(n)),m.audio=null,e=!0,n=null)}return p&&!Gv(p)?(_.Jf("Dropping variant - video not compatible with platform",
55
+ dw(p)),!1):n&&b&&!ew(n,b)?(_.Jf("Dropping variant - not compatible with active audio","active audio",dw(b),"variant.audio",dw(n)),!1):p&&c&&!ew(p,c)?(_.Jf("Dropping variant - not compatible with active video","active video",dw(c),"variant.video",dw(p)),!1):!0});if(e){for(var f=!1,g=!1,k=_.t(d.variants),l=k.next();!l.done;l=k.next())l=l.value,!f&&l.video&&l.audio&&(f=!0),g||l.audio||!l.video||(g=!0);f&&g&&(d.variants=d.variants.filter(function(m){return m.video&&!m.audio?(_.Jf("Dropping variant - not compatible with video + audio",
56
+ "variant.video",dw(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.xv(_.xh(m.mimeType,m.codecs));n||_.Kf("Dropping text stream. Is not supported by the platform.",m);return n})};ew=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
57
+ gw=function(a){return{id:a.id,active:!1,type:_.te,bandwidth:0,language:a.language,label:a.label,kind:a.kind||null,width:null,height:null,frameRate:null,mimeType:a.mimeType,audioMimeType:null,codecs:a.codecs||null,audioCodec:null,videoCodec:null,primary:a.primary,roles:a.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:a.originalId}};hw=function(a){return a.allowedByApplication&&a.allowedByKeySystem};
58
+ Xv=function(a,b){var c=a.filter(function(g){return g.audio&&g.audio.channelsCount}),d=new Map;c=_.t(c);for(var e=c.next();!e.done;e=c.next()){e=e.value;var f=e.audio.channelsCount;d.has(f)||d.set(f,[]);d.get(f).push(e)}c=Array.from(d.keys());if(0===c.length)return a;e=c.filter(function(g){return g<=b});return e.length?d.get(Math.max.apply(null,e)):d.get(Math.min.apply(null,c))};
59
+ _.jw=function(a,b,c){b=_.yh(b);var d=a,e=a.filter(function(g){return g.primary});e.length&&(d=e);var f=d.length?d[0].language:"";d=d.filter(function(g){return g.language===f});b.some(function(g){var k=_.mu(_.uh(g),a.map(function(l){return l.language}));return k?(d=a.filter(function(l){return _.uh(l.language)===k}),!0):!1});if(c){b=iw(d,c);if(b.length)return b;_.B("No exact match for the text role could be found.")}else if(b=d.filter(function(g){return 0===g.roles.length}),b.length)return b;b=d.map(function(g){return g.roles}).reduce(_.tu,
60
+ []);return b.length?iw(d,b[0]):d};iw=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};kw=function(a,b,c){for(var d=0;d<c.length;d++)if(c[d].audio===a&&c[d].video===b)return c[d];return null};
61
+ dw=function(a){var b=nu(a);return a.type===_.$b?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.Ie?"type\x3dvideo mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" frameRate\x3d"+a.frameRate+" width\x3d"+a.width+" height\x3d"+a.height:"unexpected stream type"};
62
+ lw=function(a,b){var c=String(_.Eg++);c=new _.zg(c,a);c.mimeType=_.Ag(b.mimeType);if(a===_.L||a===_.N)c.label=_.Ag(b.label),c.language=_.Ag(b.language);a===_.Bg?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.N?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.Ag(b.audioMimeType)):(c.kind=_.Ag(b.kind),c.roles=b.roles);return c};
63
+ mw=function(a,b,c){var d=new _.Gg(a===_.Bg?""+b.videoId:a===_.N?""+b.audioId:""+b.id,c);switch(a){case _.Bg:d.codec=_.Ag(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;break;case _.N:d.codec=_.Ag(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;break;default:d.codec=_.Ag(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.H.Ja(e,d,null,["id","track"])}))||c.renditions.push(d);
64
+ return a||d};nw=function(a,b){var c=a.reduce(function(d,e){b===_.Bg?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.N&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};ow=function(a,b){if(void 0!==b&&null!==b){var c=a.filter(function(d){return d.audio&&d.audio.id===b});if(0<c.length)return c}return a};
65
+ pw=function(a,b,c){function d(f,g){return null==f?null==g:g.id==f}for(var e=0;e<c.length;e++)if(d(a,c[e].audio)&&d(b,c[e].video))return c[e];return null};qw=function(){this.g=new _.D("cl.api.mse.TrackManager");this.l=null;this.h=[];this.a=new Map;this.f=new Map};rw=function(a,b){return a.h.filter(function(c){return c.type===b})};sw=function(a,b){var c=a.a.get(b)||null;return c&&c.track};uw=function(a,b,c){c&&sw(a,c.type)===c&&!a.l.ka()||tw(a,b,c&&c.renditions[0])};
66
+ vw=function(a,b){a.a.set(b.track.type,b);b===(a.f.get(b.track.type)||null)&&a.f.set(b.track.type,null)};
67
+ tw=function(a,b,c,d){d=void 0===d?!1:d;if(a.l&&((a.a.get(b)||null)!==c||a.l.ka())){var e=a.l;if(c){if(0>a.h.indexOf(c.track))throw Error("Unknown rendition with ID "+c.id);if(b!==c.track.type)throw Error("Types mismatch");a.g.debug("Activate rendition type\n "+b+" with ID: "+c.id);if(b===_.L){var f=e.ea().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),vw(a,c),e.trigger(new _.E(_.Kh)),ww(e,!0).then(function(){xw(e,f)})["catch"](function(n){a.g.warn("Error while activating track",n)}))}else if(b===
68
+ _.N)a.f.set(b,c),yw(e,parseInt(c.id,10));else if(b===_.Bg){var g=a.a.get(_.N)||null;if(g){var k=zw(e).filter(function(n){return n.videoId==c.id});var l=k.find(function(n){return n.audioId==g.id});if(!l){a.g.debug("Unable to find exact variant. Searching for equivalent");var m=g.track.renditions.map(function(n){return n.id}).filter(function(n){return n!==g.id});l=k.find(function(n){return m.find(function(p){return p==n.audioId})})}}else l=zw(e).find(function(n){return n.videoId==c.id});l?(a.f.set(b,
69
+ c),Aw(e,l,d)):a.g.warn("Cannot find matching variant")}}else a.g.debug(_.ya+b),sw(a,b)&&(b===_.L?ww(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.E(_.Kh))})["catch"](function(n){a.g.warn("Error while de-activating text tracks",n)}):b===_.N?a.g.info("Enabling ABR for audio is not supported"):Aw(e,null,d))}};
70
+ Ew=function(a){if(a.l){a.g.debug("Track list change detected, updating track list");for(var b=[],c=_.t(Object.values(_.ip)),d=c.next();!d.done;d=c.next())d=d.value,a.a.set(d,null),a.f.set(d,null);c={};d=_.t(a.l.ea());for(var e=d.next();!e.done;c={Rb:c.Rb},e=d.next()){e=e.value;c.Rb=lw(_.L,e);var f=b.find(function(k){return function(l){return Bw(l,k.Rb)}}(c));c.Rb=f||c.Rb;var g=mw(_.L,e,c.Rb);e.active&&a.a.set(_.L,g);f||b.push(c.Rb)}Cw(a.l)||a.a.set(_.L,null);c=zw(a.l);Dw(a,b,c,_.Bg);Dw(a,b,c,_.N);
71
+ a.h=b}};Dw=function(a,b,c,d){var e=nw(c,d);c={};e=_.t(e);for(var f=e.next();!f.done;c={Sb:c.Sb},f=e.next()){f=f.value;c.Sb=lw(d,f);var g=b.find(function(l){return function(m){return Bw(m,l.Sb)}}(c));c.Sb=g||c.Sb;var k=mw(d,f,c.Sb);f.active&&a.a.set(d,k);g||b.push(c.Sb)}};Bw=function(a,b){return a.type===b.type&&a.channelsCount===b.channelsCount&&a.frameRate===b.frameRate&&a.kind===b.kind&&a.label===b.label&&a.language===b.language&&a.mimeType===b.mimeType&&pu(a.roles,b.roles)};
72
+ Fw=function(a,b,c){if(b){a.h.length||Ew(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.t(rw(a,d)),k=g.next();!k.done&&!(f=k.value.renditions.find(function(l){return l.id==b.id}));k=g.next());f&&e!==f&&(vw(a,f),d===_.N?a.l.trigger(new _.E(_.Jh)):d===_.Bg&&a.l.trigger(new _.E(_.Me,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};Gw=function(){this.f=new _.Uu(2);this.g=new _.Uu(5);this.a=0};Hw=function(a,b){return 128E3>a.a?b:Math.min(_.Wu(a.f),_.Wu(a.g))};
73
+ _.Iw=function(){this.f=new _.D("clpp.abr");this.w=null;this.j=!1;this.g=new Gw;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.h=null};Jw=function(a,b){a&&(b=b.filter(function(c){return bw(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};Kw=function(){this.a=new Map};Mw=function(a,b){a.a.has(b)||a.a.set(b,new Lw);return a.a.get(b)};Lw=function(){this.text=this.variant=null};
74
+ Nw=function(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(var c=_.t(b),d=c.next();!d.done;d=c.next())this.add(d.value)};Qw=function(a,b){var c;if(!(c=!!a.audio!=!!b.audio||!!a.video!=!!b.video||a.language!=b.language)&&(c=a.audio&&b.audio)){c=a.audio;var d=b.audio;c=!(c.channelsCount==d.channelsCount&&Ow(c,d)&&Pw(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(Ow(c,d)&&Pw(c.roles,d.roles)));return c?!1:!0};
75
+ Ow=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.ou(f)[0]}),d=b.codecs.split(",").map(function(f){return _.ou(f)[0]});if(c.length!=d.length)return!1;c.sort();d.sort();for(var e=0;e<c.length;e++)if(c[e]!=d[e])return!1;return!0};Pw=function(a,b){var c=new Set(a),d=new Set(b);c["delete"]("main");d["delete"]("main");if(c.size!=d.size)return!1;c=_.t(c);for(var e=c.next();!e.done;e=c.next())if(!d.has(e.value))return!1;return!0};
76
+ Sw=function(a){this.a=a;this.f=new Rw(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};Rw=function(a,b,c){this.g=a;this.f=b;this.a=c};Tw=function(a,b){b=_.yh(b);var c=null;b.some(function(d){c=_.mu(_.uh(d),a.map(function(e){return lu(e)}));return!!c});return c?a.filter(function(d){return c===lu(d)}):[]};Uw=function(a,b){return a.filter(function(c){var d=c.audio;c=c.video;return d&&0<=d.roles.indexOf(b)||c&&0<=c.roles.indexOf(b)})};
77
+ Xw=function(a,b){this.a=Vw;this.f=(new Map).set(Vw,b).set(Ww,a)};
78
+ Zw=function(a){var b=this;this.f=a;this.a=a.getConfiguration().streaming;this.h=new _.Yf;this.g=new _.D("clpp.mse.media.LiveEdgeObserver");Yw(this)&&(a=this.f.getSurface().getMedia(),this.h.on(a,_.we,function(){var c=b.f.getPosition(),d=b.f.getSeekRange().end;c=d-c;var e=b.f.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.g.debug("Too far from edge, jump to beginning."),b.f.setPlaybackRate(1),b.f.seek(d)):1===e&&c>=b.a.startChasingAt?(b.g.debug("Not on live edge, increase playback rate."),
79
79
  b.f.setPlaybackRate(b.a.chasingRate)):1<e&&c<=f&&(b.g.debug("On live edge, reduce playback rate."),b.f.setPlaybackRate(1))}))};
80
- Qw=function(a){return 1>=a.a.chasingRate?(a.g.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.g.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.g.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.g.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};Sw=function(a){this.g=a;this.a=null;this.f=function(){}};Tw=function(a,b){a.f=b};
81
- Uw=function(a){var b=this;this.a=a;this.h=!1;this.g=this.a.je();this.f=new _.oh(function(){b.a.xi(.25*b.g)})};Vw=function(a){a.f.stop();var b=a.h?0:a.g;0<=b?a.a.je()!=b&&a.a.fg(b):(a.f.Xa(.25),0!=a.a.je()&&a.a.fg(0))};Xw=function(a,b){this.g=a;this.j=Ww(a);this.a=a.a.currentTime;this.h=Date.now()/1E3;this.m=b;this.f=function(){}};Yw=function(a,b){a.f=b};Zw=function(a){this.a=a};
82
- Ww=function(a){if(a.a.paused||0==a.a.playbackRate||0===a.a.buffered.length)var b=!1;else a:{b=a.a.buffered;a=a.a.currentTime;for(var c=0;c<b.length;c++){var d=b.start(c),e=b.end(c);if(!(a<d-.1||a>e-(c+1===b.length?.5:.1))){b=!0;break a}}b=!1}return b};ax=function(a,b,c,d,e){var f=this;this.a=a;this.C=b;this.j=c;this.B=e;this.g=new _.Tf;this.A=!1;this.G=a.readyState;this.h=!1;this.f=d;this.m=this.D=this.w=!1;this.g.on(a,_.Pe,function(){return $w(f)});this.o=(new _.oh(function(){$w(f)})).Xa(.25)};
83
- $w=function(a){if(0!=a.a.readyState){if(a.a.seeking){if(!a.A)return}else a.A=!1;if(!a.a.paused&&!a.m){a.a.readyState!=a.G&&(a.h=!1,a.G=a.a.readyState);var b=a.j.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.Mh(d);var f=a.j.gapDetectionThreshold;if(e.length&&!(1===e.length&&1E-6>e.end(0)-e.start(0)))for(var g=0;g<e.length;g++)if(e.start(g)>c&&(0===g||e.end(g-1)-c<=f)){e=g;break a}e=null}if(null==e){if(a.f){a=a.f;d=a.g;c=Ww(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.j!=c)a.h=
84
- b,a.a=d,a.j=c;d=b-a.h;d>=a.m&&c&&a.f(a.a,d)}}else if((0!=e||a.w)&&a.D&&(f=d.start(e),g=Yu(a.C),!(f>=g))){g=f-c;b=g<=b;var k=!1;if(!(.001>g)){if(!b&&!a.h){a.h=!0;var l=new _.E("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.B(l);a.j.jumpLargeGaps&&!l.defaultPrevented?k=!0:_.If("Ignoring large gap at",c,"size",g)}if(b||k)0==e?_.If(Et,g,"seconds because of gap before start time of",f):_.If(Et,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
85
- ex=function(a,b,c,d){this.a=a;this.h=b;this.m=d;this.w=c;this.j=!1;this.f=new _.Tf;this.g=new bx(a);this.o=!1;0<a.readyState?cx(this,c):dx(this,c)};fx=function(a){return a.j?a.a.currentTime:a.w};hx=function(a,b){0<a.a.readyState?gx(a.g,b):dx(a,b)};dx=function(a,b){a.w=b;a.f.off(a.a,_.jd);a.f.one(a.a,_.jd,function(){cx(a,b)})};cx=function(a,b){a.o||(a.o=!0,a.m&&a.m());.001>Math.abs(a.a.currentTime-b)?ix(a):(a.f.one(a.a,_.ce,function(){ix(a)}),gx(a.g,0==a.a.currentTime?b:a.a.currentTime))};
86
- ix=function(a){_.qi()&&!a.j&&a.h();a.j=!0;a.f.on(a.a,_.ce,function(){return a.h()})};bx=function(a){var b=this;this.f=a;this.m=10;this.j=this.g=this.h=0;this.a=new _.oh(function(){0>=b.h?(_.B(["Failed to move playhead from",b.g,"to",b.j].join(" ")),b.a.stop()):b.f.currentTime!=b.g?b.a.stop():(b.f.currentTime=b.j,b.h--)})};gx=function(a,b){a.g=a.f.currentTime;a.j=b;a.h=a.m;a.f.currentTime=b;a.a.Xa(.1)};
87
- mx=function(a,b,c,d,e,f){var g=this;this.h=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.m=c;this.A=e;this.w=null;this.j=new ax(a,b.presentationTimeline,c,jx(this,a,c),f);this.g=new ex(a,function(){a:{var k=g.j;k.A=!0;k.w=!1;k.h=!1;k=fx(g.g);var l=kx(g,k);if(.001<Math.abs(l-k)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;hx(g.g,l);k=void 0;break a}}g.f.debug("Seek to "+k);g.A();k=void 0}return k},lx(this,d),function(){g.j.D=!0});this.o=(new _.oh(function(){if(0!=g.h.readyState&&
88
- !g.h.paused){var k=fx(g.g),l=Zu(g.a,0),m=Yu(g.a);3>m-l&&(l=m-3);k<l&&(l=kx(g,k),g.f.info("Jumping forward "+(l-k)+" seconds to catch up with the seek range."),g.h.currentTime=l)}})).Xa(.25);this.f=new _.D("clpp.mse.Playhead")};ox=function(a){var b=fx(a.g);return 0<a.h.readyState&&!a.h.paused?nx(a,b):b};lx=function(a,b){null==b?b=Infinity>a.a.getDuration()?Zu(a.a,0):Yu(a.a):0>b&&(b=Yu(a.a)+b);return px(a,nx(a,b))};px=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
89
- kx=function(a,b){var c=new _.Mh(a.h.buffered);c=c.bc.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=Zu(a.a,0),g=Yu(a.a),k=a.a.getDuration();3>g-f&&(f=g-3);var l=Zu(a.a,d),m=Zu(a.a,e);d=Zu(a.a,d+e);if(b>=k)return a.f.debug("Playhead past duration."),px(a,b);if(b>g)return a.f.debug("Playhead past end."),g;if(b<f){if(c(m))return a.f.debug("Playhead before start \x26 start is buffered"),m;a.f.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=l||c(b))return a.f.debug("Playhead in safe region or in buffered region."),
90
- b;a.f.debug("Playhead outside safe region \x26 in unbuffered region.");return d};nx=function(a,b){var c=Zu(a.a,0);if(b<c)return c;c=Yu(a.a);return b>c?c:b};
91
- jx=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new Xw(new Zw(b),c.stallThreshold);Yw(c,function(f,g){a.f.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var k=new _.Mh(b.buffered),l;if(l=_.oi("Edge/")||_.oi("Trident/")||_.fi()||_.qi())a:{if(k.length&&!(1>=k.length))for(l=0;l<k.length-1;l++)if(f>k.start(l)&&f<k.end(l)){l=k.start(l+1)-k.end(l)>=d;break a}l=!1}if(l){a:{if(k.length&&!(1>=k.length))for(l=0;l<k.length-1;l++)if(f>k.start(l)&&f<k.end(l)){k=
80
+ Yw=function(a){return 1>=a.a.chasingRate?(a.g.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.g.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.g.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.g.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};$w=function(a){this.g=a;this.a=null;this.f=function(){}};ax=function(a,b){a.f=b};
81
+ bx=function(a){var b=this;this.a=a;this.h=!1;this.g=this.a.je();this.f=new _.qh(function(){b.a.xi(.25*b.g)})};cx=function(a){a.f.stop();var b=a.h?0:a.g;0<=b?a.a.je()!=b&&a.a.fg(b):(a.f.Ya(.25),0!=a.a.je()&&a.a.fg(0))};ex=function(a,b){this.g=a;this.j=dx(a);this.a=a.a.currentTime;this.h=Date.now()/1E3;this.m=b;this.f=function(){}};fx=function(a,b){a.f=b};gx=function(a){this.a=a};
82
+ dx=function(a){if(a.a.paused||0==a.a.playbackRate||0===a.a.buffered.length)var b=!1;else a:{b=a.a.buffered;a=a.a.currentTime;for(var c=0;c<b.length;c++){var d=b.start(c),e=b.end(c);if(!(a<d-.1||a>e-(c+1===b.length?.5:.1))){b=!0;break a}}b=!1}return b};ix=function(a,b,c,d,e){var f=this;this.a=a;this.C=b;this.j=c;this.B=e;this.g=new _.Yf;this.A=!1;this.G=a.readyState;this.h=!1;this.f=d;this.m=this.D=this.w=!1;this.g.on(a,_.Qe,function(){return hx(f)});this.o=(new _.qh(function(){hx(f)})).Ya(.25)};
83
+ hx=function(a){if(0!=a.a.readyState){if(a.a.seeking){if(!a.A)return}else a.A=!1;if(!a.a.paused&&!a.m){a.a.readyState!=a.G&&(a.h=!1,a.G=a.a.readyState);var b=a.j.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.Oh(d);var f=a.j.gapDetectionThreshold;if(e.length&&!(1===e.length&&1E-6>e.end(0)-e.start(0)))for(var g=0;g<e.length;g++)if(e.start(g)>c&&(0===g||e.end(g-1)-c<=f)){e=g;break a}e=null}if(null==e){if(a.f){a=a.f;d=a.g;c=dx(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.j!=c)a.h=
84
+ b,a.a=d,a.j=c;d=b-a.h;d>=a.m&&c&&a.f(a.a,d)}}else if((0!=e||a.w)&&a.D&&(f=d.start(e),g=fv(a.C),!(f>=g))){g=f-c;b=g<=b;var k=!1;if(!(.001>g)){if(!b&&!a.h){a.h=!0;var l=new _.E("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.B(l);a.j.jumpLargeGaps&&!l.defaultPrevented?k=!0:_.Jf("Ignoring large gap at",c,"size",g)}if(b||k)0==e?_.Jf(Nt,g,"seconds because of gap before start time of",f):_.Jf(Nt,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
85
+ mx=function(a,b,c,d){this.a=a;this.h=b;this.m=d;this.w=c;this.j=!1;this.f=new _.Yf;this.g=new jx(a);this.o=!1;0<a.readyState?kx(this,c):lx(this,c)};nx=function(a){return a.j?a.a.currentTime:a.w};px=function(a,b){0<a.a.readyState?ox(a.g,b):lx(a,b)};lx=function(a,b){a.w=b;a.f.off(a.a,_.kd);a.f.one(a.a,_.kd,function(){kx(a,b)})};kx=function(a,b){a.o||(a.o=!0,a.m&&a.m());.001>Math.abs(a.a.currentTime-b)?qx(a):(a.f.one(a.a,_.ce,function(){qx(a)}),ox(a.g,0==a.a.currentTime?b:a.a.currentTime))};
86
+ qx=function(a){_.ui()&&!a.j&&a.h();a.j=!0;a.f.on(a.a,_.ce,function(){return a.h()})};jx=function(a){var b=this;this.f=a;this.m=10;this.j=this.g=this.h=0;this.a=new _.qh(function(){0>=b.h?(_.B(["Failed to move playhead from",b.g,"to",b.j].join(" ")),b.a.stop()):b.f.currentTime!=b.g?b.a.stop():(b.f.currentTime=b.j,b.h--)})};ox=function(a,b){a.g=a.f.currentTime;a.j=b;a.h=a.m;a.f.currentTime=b;a.a.Ya(.1)};
87
+ ux=function(a,b,c,d,e,f){var g=this;this.h=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.m=c;this.A=e;this.w=null;this.j=new ix(a,b.presentationTimeline,c,rx(this,a,c),f);this.g=new mx(a,function(){a:{var k=g.j;k.A=!0;k.w=!1;k.h=!1;k=nx(g.g);var l=sx(g,k);if(.001<Math.abs(l-k)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;px(g.g,l);k=void 0;break a}}g.f.debug("Seek to "+k);g.A();k=void 0}return k},tx(this,d),function(){g.j.D=!0});this.o=(new _.qh(function(){if(0!=g.h.readyState&&
88
+ !g.h.paused){var k=nx(g.g),l=gv(g.a,0),m=fv(g.a);3>m-l&&(l=m-3);k<l&&(l=sx(g,k),g.f.info("Jumping forward "+(l-k)+" seconds to catch up with the seek range."),g.h.currentTime=l)}})).Ya(.25);this.f=new _.D("clpp.mse.Playhead")};wx=function(a){var b=nx(a.g);return 0<a.h.readyState&&!a.h.paused?vx(a,b):b};tx=function(a,b){null==b?b=Infinity>a.a.getDuration()?gv(a.a,0):fv(a.a):0>b&&(b=fv(a.a)+b);return xx(a,vx(a,b))};xx=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
89
+ sx=function(a,b){var c=new _.Oh(a.h.buffered);c=c.ac.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=gv(a.a,0),g=fv(a.a),k=a.a.getDuration();3>g-f&&(f=g-3);var l=gv(a.a,d),m=gv(a.a,e);d=gv(a.a,d+e);if(b>=k)return a.f.debug("Playhead past duration."),xx(a,b);if(b>g)return a.f.debug("Playhead past end."),g;if(b<f){if(c(m))return a.f.debug("Playhead before start \x26 start is buffered"),m;a.f.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=l||c(b))return a.f.debug("Playhead in safe region or in buffered region."),
90
+ b;a.f.debug("Playhead outside safe region \x26 in unbuffered region.");return d};vx=function(a,b){var c=gv(a.a,0);if(b<c)return c;c=fv(a.a);return b>c?c:b};
91
+ rx=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new ex(new gx(b),c.stallThreshold);fx(c,function(f,g){a.f.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var k=new _.Oh(b.buffered),l;if(l=_.si("Edge/")||_.si("Trident/")||_.hi()||_.ui())a:{if(k.length&&!(1>=k.length))for(l=0;l<k.length-1;l++)if(f>k.start(l)&&f<k.end(l)){l=k.start(l+1)-k.end(l)>=d;break a}l=!1}if(l){a:{if(k.length&&!(1>=k.length))for(l=0;l<k.length-1;l++)if(f>k.start(l)&&f<k.end(l)){k=
92
92
  k.start(l+1)-f;break a}k=null}k&&(e=Math.min(k+.1,e))}a.f.warn("Seeking forward "+e+" seconds to break stall.");b.currentTime+=e}else a.f.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};
93
- rx=function(a){function b(){d=!0}function c(m){f.push(m);_.rk(m)}a=_.Q(a);var d=!1,e,f=[],g=[];(new _.qk).M(_.rd,c).M(_.we,c).M(_.md,c).M(_.qd,c).M(_.je,c).V(_.me,function(m){e=m;f.push(m);_.sk(m)}).V("encv",b).V("enca",b).V("avc1",function(m){g.push({M:m,Fc:1701733238})}).V("avc3",function(m){g.push({M:m,Fc:1701733238})}).V("ac-3",function(m){g.push({M:m,Fc:1701733217})}).V("ec-3",function(m){g.push({M:m,Fc:1701733217})}).V("mp4a",function(m){g.push({M:m,Fc:1701733217})}).parse(a);if(d)return _.If("Init segment already indicates encryption."),
94
- a;if(0===g.length||!e)throw _.Kf("Failed to find boxes needed to fake encryption!"),_.Kf("Failed init segment (hex):",_.ij(a)),new _.J(_.K,3,14E3);g.reverse();for(var k=_.t(g),l=k.next();!l.done;l=k.next())l=l.value,_.If('Inserting "'+_.vk(l.Fc)+'" box into init segment.'),a=qx(a,e,l.M,f,l.Fc);return a};
95
- qx=function(a,b,c,d,e){var f=sx.value(),g=a.subarray(c.start,c.start+c.size),k=_.Og(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.Og(l);g.setUint32(4,e);l.set(f,c.size);e=k.getUint32(4);g.setUint32(c.size+16,e);tx(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.oi("Xbox One")||_.ni()?c.start:c.start+c.size;f=a.subarray(c);e.set(a.subarray(0,c));e.set(l,c);e.set(f,c+l.byteLength);a=_.t(d);for(d=a.next();!d.done;d=a.next())d=d.value,tx(e,d.start,d.size+l.byteLength);l=_.Og(e,
96
- b.start);b=_.wk(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};tx=function(a,b,c){a=_.Og(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.ux=function(a,b){this.f=b;this.g=a;this.m=null;this.B=1;this.I=Promise.resolve();this.o=[];this.w=new Map;this.h=new Map;this.K=this.j=this.A=this.C=!1;this.J=0;this.a=new _.D("clpp.mse.Streaming");this.G=!1;this.D=[]};wx=function(a){return _.vx(a,_.Zb)};xx=function(a){return _.vx(a,_.He)};
97
- _.vx=function(a,b){var c=a.h.get(b);return c?c.Mb||c.stream:null};
98
- Cx=function(a,b){var c,d,e,f,g,k,l,m,n,p;return _.z(function(q){switch(q.a){case 1:return c=_.Yl,_.v(q,a.f.X.clear(c.TEXT),2);case 2:return a.J++,a.K=!1,d=a.J,e=a.f.X,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.v(q,e.init(f,!1),3);case 3:return a.j?q["return"]():_.v(q,yx(a,g),4);case 4:if(a.j)return q["return"]();l=(k=e.getTextDisplayer().isTextVisible())||a.m.alwaysStreamText;a.J!=d||a.h.has(c.TEXT)||a.K||!l||(m=a.f.qb(),n=zx(a,m),p=Ax(b,n,0),a.h.set(c.TEXT,p),Bx(a,p,0));_.w(q)}})};
99
- Ex=function(a,b,c,d){b.video&&_.Dx(a,b.video,c,d);b.audio&&_.Dx(a,b.audio,c,d)};
100
- _.Dx=function(a,b,c,d){var e=a.h.get(b.type);if(!e&&b.type==_.se&&a.m.ignoreTextStreamFailures)Cx(a,b);else if(e){var f=Fx(a,b);if(c&&f!=e.vb)for(a.a.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),c=_.t(a.h.values()),d=c.next();!d.done;d=c.next())Gx(a,d.value);else{e.Mb&&(a.a.debug("switch during trick play mode",b),b.trickModeVideo?(e.Mb=b,b=b.trickModeVideo,a.a.debug("switch found trick play stream",b)):(e.Mb=null,a.a.debug("switch found no special trick play stream")));
101
- var g=a.o[f];if(g&&g.Ic&&(g=a.w.get(b.id))&&g.Ic)if(e.stream!=b){g=a.g.presentationTimeline.getDuration();var k=a.f.qb();k=Hx(a,e,k);!c&&(e.endOfStream||k>=g)?a.a.debug(Vt+Ix(e)+" already buffered to the end. Not switching."):(b.type==_.se&&Bv(a.f.X,_.vh(b.mimeType,b.codecs)),e.stream=b,e.Yc=!0,a.a.debug("switch: switching to Stream "+Ix(e)),e.fc?(b=a.f.qb(),g=a.f.X.ra(e.type),f=(f=Jx(a,e,b,g,f))?f.za?f.za-f.Ka:null:null,null==f?f=!1:((k=e.stream.initSegmentReference)&&(f+=(k.za?k.za-k.Ka:null)||
102
- 0),k=a.f.fe().getBandwidthEstimate(),8*f/k<(null===g?0:g-b)-Math.max(a.g.minBufferTime||0,a.m.rebufferingGoal)?f=!0:(b=e.fc,b=b.h?b.h.bytesRemaining:-1,f=0>b||b>f?!0:!1))):f=!1,f&&(a.a.info("Aborting current segment request to switch."),e.fc.abort()),c&&(e.Ub?e.Kd=!0:e.eb?(e.Bb=!0,e.ld=d,e.Kd=!0):(Kx(e),Lx(a,e,!0,d))))}else a.a.debug(Vt+Ix(e)+" already active")}}};
103
- Mx=function(a){function b(k){return a.f.X.bc(k,c,0)}var c=a.f.qb(),d=!1,e=zx(a,c);if(_.Fg(a.h.values(),function(k){return k.vb==e}))for(var f=_.t(a.h.keys()),g=f.next();!g.done;g=f.next())g=g.value,b(g)||(Gx(a,a.h.get(g)),d=!0);else if(!_.Fg(a.h.keys(),b)){a.a.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.t(a.h.values());for(f=d.next();!f.done;f=d.next())Gx(a,f.value);d=!0}d||a.a.debug("(all): seeked: buffered seek: presentationTime\x3d"+c)};
104
- Gx=function(a,b){var c=Ix(b);b.Ub?a.a.debug(c,"clear: already clearing the buffer"):b.Bb?a.a.debug(c,"clear: already waiting"):b.eb?(a.a.debug(c,"clear: currently updating"),b.Bb=!0,b.ld=0):null==a.f.X.lb(b.type)?(a.a.debug(c,"clear: nothing buffered"),null==b.zb&&Bx(a,b,0)):(a.a.debug(c,"clear: handling right now"),Kx(b),Lx(a,b,!1,0))};
105
- Ox=function(a,b,c,d,e){var f,g,k,l,m,n,p;return _.z(function(q){if(1==q.a)return f=a.f.qb(),g=zx(a,f),k=_.Yl,l=new Map,m=new Set,b&&(l.set(k.AUDIO,b),m.add(b)),c&&(l.set(k.VIDEO,c),m.add(c)),d&&(l.set(k.TEXT,d),m.add(d)),n=a.f.X,p=a.m.forceNativeTS,_.v(q,n.init(l,p),2);if(3!=q.a){if(a.j)return q["return"]();Nx(a);return _.v(q,yx(a,m),3)}if(a.j)return q["return"]();l.forEach(function(r,x){if(!a.h.has(x)){var y=Ax(r,g,e);a.h.set(x,y);Bx(a,y,0)}});_.w(q)})};
106
- Ax=function(a,b,c){return{stream:a,type:a.type,ub:null,sa:null,Mb:null,Yc:!0,vb:b,endOfStream:!1,eb:!1,zb:null,Bb:!1,ld:0,Kd:!1,Ub:!1,Je:!1,Dc:!1,dg:c||0,fc:null,pd:!1,Hf:0}};
107
- Px=function(a,b){var c=a.o[b];if(c)return a.a.debug("(all) Period "+b+zt),c.N;a.a.debug("(all) setting up Period "+b);c={N:new _.Oh,Ic:!1};a.o[b]=c;for(var d=new Set,e=_.t(a.g.periods[b].variants),f=e.next();!f.done;f=e.next())f=f.value,f.video&&d.add(f.video),f.video&&f.video.trickModeVideo&&d.add(f.video.trickModeVideo),f.audio&&d.add(f.audio);e=_.t(a.g.periods[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.I=a.I.then(function(){return a.j?null:yx(a,d)}).then(function(){a.j||
108
- (a.o[b].N.resolve(),a.o[b].Ic=!0,a.a.debug("(all) setup Period "+b))})["catch"](function(g){a.j||(a.o[b].N["catch"](function(){}),a.o[b].N.reject(),delete a.o[b],a.a.warn("(all) failed to setup Period "+b),a.f.onError(g))});return c.N};
109
- yx=function(a,b){var c,d,e,f,g,k,l,m,n,p,q;return _.z(function(r){switch(r.a){case 1:c=[];d=_.t(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.w.get(f.id))?(a.a.debug("(all) Stream "+f.id+zt),c.push(g.N)):(a.a.debug("(all) setting up Stream "+f.id),a.w.set(f.id,{N:new _.Oh,Ic:!1}),c.push(f.createSegmentIndex()));_.qf(r,2);return _.v(r,Promise.all(c),4);case 4:if(a.j)return r["return"]();_.rf(r,3);break;case 2:k=_.sf(r);if(a.j)return r["return"]();l=_.t(b);for(e=l.next();!e.done;e=l.next())m=
110
- e.value,a.w.get(m.id).N["catch"](function(){}),a.w.get(m.id).N.reject(),a.w["delete"](m.id);throw k;case 3:n=_.t(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.w.get(p.id),q.Ic||(q.N.resolve(),q.Ic=!0,a.a.debug("(all) setup Stream "+p.id));_.w(r)}})};Nx=function(a){var b=a.g.presentationTimeline.getDuration();Infinity>b?a.f.X.Pb(b):a.f.X.Pb(Math.pow(2,32))};
111
- Tx=function(a,b){if(!a.j){var c=Ix(b);if(!b.eb&&null!=b.zb&&!b.Ub)if(b.zb=null,b.Bb)a.a.debug(c,"skipping update and clearing the buffer"),Lx(a,b,b.Kd,b.ld);else{try{var d=Qx(a,b);null!=d&&(Bx(a,b,d),b.Dc=!1)}catch(e){Rx(a,e);return}d=Array.from(a.h.values());Sx(a,b);a.C&&d.every(function(e){return e.endOfStream})&&(a.a.debug(c,"calling endOfStream()..."),a.f.X.endOfStream().then(function(){if(!a.j&&!a.g.presentationTimeline.dc()){var e=a.f.X.getDuration();e<a.g.presentationTimeline.getDuration()&&
93
+ zx=function(a){function b(){d=!0}function c(m){f.push(m);_.Pj(m)}a=_.Q(a);var d=!1,e,f=[],g=[];(new _.Oj).L(_.sd,c).L(_.xe,c).L(_.nd,c).L(_.rd,c).L(_.le,c).V(_.ne,function(m){e=m;f.push(m);_.Qj(m)}).V("encv",b).V("enca",b).V("avc1",function(m){g.push({L:m,Ec:1701733238})}).V("avc3",function(m){g.push({L:m,Ec:1701733238})}).V("ac-3",function(m){g.push({L:m,Ec:1701733217})}).V("ec-3",function(m){g.push({L:m,Ec:1701733217})}).V("mp4a",function(m){g.push({L:m,Ec:1701733217})}).parse(a);if(d)return _.Jf("Init segment already indicates encryption."),
94
+ a;if(0===g.length||!e)throw _.Lf("Failed to find boxes needed to fake encryption!"),_.Lf("Failed init segment (hex):",_.nj(a)),new _.J(_.K,3,14E3);g.reverse();for(var k=_.t(g),l=k.next();!l.done;l=k.next())l=l.value,_.Jf('Inserting "'+_.Tj(l.Ec)+'" box into init segment.'),a=yx(a,e,l.L,f,l.Ec);return a};
95
+ yx=function(a,b,c,d,e){var f=Ax.value(),g=a.subarray(c.start,c.start+c.size),k=_.Qg(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.Qg(l);g.setUint32(4,e);l.set(f,c.size);e=k.getUint32(4);g.setUint32(c.size+16,e);Bx(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.si("Xbox One")||_.ri()?c.start:c.start+c.size;f=a.subarray(c);e.set(a.subarray(0,c));e.set(l,c);e.set(f,c+l.byteLength);a=_.t(d);for(d=a.next();!d.done;d=a.next())d=d.value,Bx(e,d.start,d.size+l.byteLength);l=_.Qg(e,
96
+ b.start);b=_.Uj(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};Bx=function(a,b,c){a=_.Qg(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.Cx=function(a,b){this.f=b;this.g=a;this.m=null;this.B=1;this.I=Promise.resolve();this.o=[];this.w=new Map;this.h=new Map;this.K=this.j=this.A=this.C=!1;this.J=0;this.a=new _.D("clpp.mse.Streaming");this.G=!1;this.D=[]};Ex=function(a){return _.Dx(a,_.$b)};Fx=function(a){return _.Dx(a,_.Ie)};
97
+ _.Dx=function(a,b){var c=a.h.get(b);return c?c.Mb||c.stream:null};
98
+ Kx=function(a,b){var c,d,e,f,g,k,l,m,n,p;return _.z(function(q){switch(q.a){case 1:return c=_.fm,_.v(q,a.f.X.clear(c.TEXT),2);case 2:return a.J++,a.K=!1,d=a.J,e=a.f.X,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.v(q,e.init(f,!1),3);case 3:return a.j?q["return"]():_.v(q,Gx(a,g),4);case 4:if(a.j)return q["return"]();l=(k=e.getTextDisplayer().isTextVisible())||a.m.alwaysStreamText;a.J!=d||a.h.has(c.TEXT)||a.K||!l||(m=a.f.qb(),n=Hx(a,m),p=Ix(b,n,0),a.h.set(c.TEXT,p),Jx(a,p,0));_.w(q)}})};
99
+ Mx=function(a,b,c,d){b.video&&_.Lx(a,b.video,c,d);b.audio&&_.Lx(a,b.audio,c,d)};
100
+ _.Lx=function(a,b,c,d){var e=a.h.get(b.type);if(!e&&b.type==_.te&&a.m.ignoreTextStreamFailures)Kx(a,b);else if(e){var f=Nx(a,b);if(c&&f!=e.vb)for(a.a.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),c=_.t(a.h.values()),d=c.next();!d.done;d=c.next())Ox(a,d.value);else{e.Mb&&(a.a.debug("switch during trick play mode",b),b.trickModeVideo?(e.Mb=b,b=b.trickModeVideo,a.a.debug("switch found trick play stream",b)):(e.Mb=null,a.a.debug("switch found no special trick play stream")));
101
+ var g=a.o[f];if(g&&g.Hc&&(g=a.w.get(b.id))&&g.Hc)if(e.stream!=b){g=a.g.presentationTimeline.getDuration();var k=a.f.qb();k=Px(a,e,k);!c&&(e.endOfStream||k>=g)?a.a.debug(du+Qx(e)+" already buffered to the end. Not switching."):(b.type==_.te&&Jv(a.f.X,_.xh(b.mimeType,b.codecs)),e.stream=b,e.Yc=!0,a.a.debug("switch: switching to Stream "+Qx(e)),e.ec?(b=a.f.qb(),g=a.f.X.ra(e.type),f=(f=Rx(a,e,b,g,f))?f.za?f.za-f.La:null:null,null==f?f=!1:((k=e.stream.initSegmentReference)&&(f+=(k.za?k.za-k.La:null)||
102
+ 0),k=a.f.fe().getBandwidthEstimate(),8*f/k<(null===g?0:g-b)-Math.max(a.g.minBufferTime||0,a.m.rebufferingGoal)?f=!0:(b=e.ec,b=b.h?b.h.bytesRemaining:-1,f=0>b||b>f?!0:!1))):f=!1,f&&(a.a.info("Aborting current segment request to switch."),e.ec.abort()),c&&(e.Tb?e.Kd=!0:e.eb?(e.Bb=!0,e.ld=d,e.Kd=!0):(Sx(e),Tx(a,e,!0,d))))}else a.a.debug(du+Qx(e)+" already active")}}};
103
+ Ux=function(a){function b(k){return a.f.X.ac(k,c,0)}var c=a.f.qb(),d=!1,e=Hx(a,c);if(_.Hg(a.h.values(),function(k){return k.vb==e}))for(var f=_.t(a.h.keys()),g=f.next();!g.done;g=f.next())g=g.value,b(g)||(Ox(a,a.h.get(g)),d=!0);else if(!_.Hg(a.h.keys(),b)){a.a.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.t(a.h.values());for(f=d.next();!f.done;f=d.next())Ox(a,f.value);d=!0}d||a.a.debug("(all): seeked: buffered seek: presentationTime\x3d"+c)};
104
+ Ox=function(a,b){var c=Qx(b);b.Tb?a.a.debug(c,"clear: already clearing the buffer"):b.Bb?a.a.debug(c,"clear: already waiting"):b.eb?(a.a.debug(c,"clear: currently updating"),b.Bb=!0,b.ld=0):null==a.f.X.lb(b.type)?(a.a.debug(c,"clear: nothing buffered"),null==b.zb&&Jx(a,b,0)):(a.a.debug(c,"clear: handling right now"),Sx(b),Tx(a,b,!1,0))};
105
+ Wx=function(a,b,c,d,e){var f,g,k,l,m,n,p;return _.z(function(q){if(1==q.a)return f=a.f.qb(),g=Hx(a,f),k=_.fm,l=new Map,m=new Set,b&&(l.set(k.AUDIO,b),m.add(b)),c&&(l.set(k.VIDEO,c),m.add(c)),d&&(l.set(k.TEXT,d),m.add(d)),n=a.f.X,p=a.m.forceNativeTS,_.v(q,n.init(l,p),2);if(3!=q.a){if(a.j)return q["return"]();Vx(a);return _.v(q,Gx(a,m),3)}if(a.j)return q["return"]();l.forEach(function(r,x){if(!a.h.has(x)){var y=Ix(r,g,e);a.h.set(x,y);Jx(a,y,0)}});_.w(q)})};
106
+ Ix=function(a,b,c){return{stream:a,type:a.type,ub:null,sa:null,Mb:null,Yc:!0,vb:b,endOfStream:!1,eb:!1,zb:null,Bb:!1,ld:0,Kd:!1,Tb:!1,Je:!1,Cc:!1,dg:c||0,ec:null,pd:!1,Hf:0}};
107
+ Xx=function(a,b){var c=a.o[b];if(c)return a.a.debug("(all) Period "+b+It),c.N;a.a.debug("(all) setting up Period "+b);c={N:new _.Qh,Hc:!1};a.o[b]=c;for(var d=new Set,e=_.t(a.g.periods[b].variants),f=e.next();!f.done;f=e.next())f=f.value,f.video&&d.add(f.video),f.video&&f.video.trickModeVideo&&d.add(f.video.trickModeVideo),f.audio&&d.add(f.audio);e=_.t(a.g.periods[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.I=a.I.then(function(){return a.j?null:Gx(a,d)}).then(function(){a.j||
108
+ (a.o[b].N.resolve(),a.o[b].Hc=!0,a.a.debug("(all) setup Period "+b))})["catch"](function(g){a.j||(a.o[b].N["catch"](function(){}),a.o[b].N.reject(),delete a.o[b],a.a.warn("(all) failed to setup Period "+b),a.f.onError(g))});return c.N};
109
+ Gx=function(a,b){var c,d,e,f,g,k,l,m,n,p,q;return _.z(function(r){switch(r.a){case 1:c=[];d=_.t(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.w.get(f.id))?(a.a.debug("(all) Stream "+f.id+It),c.push(g.N)):(a.a.debug("(all) setting up Stream "+f.id),a.w.set(f.id,{N:new _.Qh,Hc:!1}),c.push(f.createSegmentIndex()));_.rf(r,2);return _.v(r,Promise.all(c),4);case 4:if(a.j)return r["return"]();_.sf(r,3);break;case 2:k=_.tf(r);if(a.j)return r["return"]();l=_.t(b);for(e=l.next();!e.done;e=l.next())m=
110
+ e.value,a.w.get(m.id).N["catch"](function(){}),a.w.get(m.id).N.reject(),a.w["delete"](m.id);throw k;case 3:n=_.t(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.w.get(p.id),q.Hc||(q.N.resolve(),q.Hc=!0,a.a.debug("(all) setup Stream "+p.id));_.w(r)}})};Vx=function(a){var b=a.g.presentationTimeline.getDuration();Infinity>b?a.f.X.Pb(b):a.f.X.Pb(Math.pow(2,32))};
111
+ ay=function(a,b){if(!a.j){var c=Qx(b);if(!b.eb&&null!=b.zb&&!b.Tb)if(b.zb=null,b.Bb)a.a.debug(c,"skipping update and clearing the buffer"),Tx(a,b,b.Kd,b.ld);else{try{var d=Yx(a,b);null!=d&&(Jx(a,b,d),b.Cc=!1)}catch(e){Zx(a,e);return}d=Array.from(a.h.values());$x(a,b);a.C&&d.every(function(e){return e.endOfStream})&&(a.a.debug(c,"calling endOfStream()..."),a.f.X.endOfStream().then(function(){if(!a.j&&!a.g.presentationTimeline.cc()){var e=a.f.X.getDuration();e<a.g.presentationTimeline.getDuration()&&
112
112
  a.g.presentationTimeline.Pb(e)}}).then(function(){a.f.Of()}))}}};
113
- Qx=function(a,b){function c(p){return p.type==_.se&&p.stream.mimeType==_.Qb}if(c(b))return Iv(a.f.X,b.stream.originalId||""),null;var d=Ix(b),e=a.f.qb(),f=Hx(a,b,e);a.a.debug(d,"timeNeeded\x3d"+f);var g=Fx(a,b.stream),k=zx(a,f),l=a.f.X.xa(b.type,e);a.a.debug(d,"update_:",Rt+e,"bufferedAhead\x3d"+l);var m=Math.max(a.g.minBufferTime||0,a.m.rebufferingGoal,a.m.bufferingGoal)*a.B,n=a.g.presentationTimeline.dc()?Wu(a.g.presentationTimeline):a.g.presentationTimeline.getDuration();if(f>=n&&!b.pd)return Ux(a,
114
- b),null;b.endOfStream=!1;b.vb=k;if(k!=g)return a.a.debug(d,"need Period "+k,Rt+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.a.debug(d,"buffering goal met"),a.m.bufferLimitUpdateInterval||.5;k=a.f.X.ra(b.type);k=Jx(a,b,e,k,g);if(!k)return a.g.presentationTimeline.isLive()||b.type===_.se?a.m.bufferLimitUpdateInterval||1:(a.a.debug("Media state "+d+": no next segment found. Assuming EOS."),Ux(a,b),null);d=Infinity;l=_.t(a.h.values());for(m=l.next();!m.done;m=l.next())m=m.value,
115
- c(m)||(m=Hx(a,m,e),d=Math.min(d,m));if(f>=d+a.g.presentationTimeline.a)return a.m.bufferLimitUpdateInterval||1;b.dg=0;Vx(a,b,e,g,k);return null};Ux=function(a,b){a.a.debug(Ix(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.He){var c=a.h.get(_.se);c&&c.stream.mimeType==_.Qb&&(c.endOfStream=!0)}};Hx=function(a,b,c){if(!b.ub||!b.sa)return Math.max(c,b.dg);c=Fx(a,b.ub);return a.g.periods[c].startTime+b.sa.endTime};
116
- Jx=function(a,b,c,d,e){var f=Ix(b);if(b.sa&&b.stream==b.ub)return d=b.sa.position+1,a.a.debug(f,"next position known:","position\x3d"+d),Wx(a,b,e,d);b.sa?(a.a.debug(f,"next position unknown: another Stream buffered"),f=Fx(a,b.ub),f=Xx(a,b,a.g.periods[f].startTime+b.sa.endTime,e)):(a.a.debug(f,"next position unknown: nothing buffered"),f=Xx(a,b,d||c,e));if(null==f)return null;c=null;null!=d||null!==a.m&&a.m.ignoreDrift||(c=Wx(a,b,e,Math.max(0,f-1)));return c||Wx(a,b,e,f)};
117
- Xx=function(a,b,c,d){var e=Ix(b);d=a.g.periods[d];a.a.debug(e,"looking up segment:","lastSegment.endTime\x3d"+c,Pt+d.startTime);c=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(c);null==b&&a.a.warn(e,"cannot find segment:",Pt+d.startTime,"lookupTime\x3d"+c);return b};
118
- Wx=function(a,b,c,d){var e=Ix(b);c=a.g.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.a.debug(e,"segment does not exist:",Pt+c.startTime,"position\x3d"+d),null;var g=a.g.presentationTimeline;d=_.Xu(g);g=Wu(g);return!b.pd&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.a.debug(e,"segment is not available:",Pt+c.startTime,Tt+f.startTime,St+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
119
- Vx=function(a,b,c,d,e){function f(r,x){if(a.j||a.A)return null;p=!0;return Yx(a,b,c,k,l,e,r,x)}var g=Ix(b),k=a.g.periods[d];a.a.debug(g,"fetchAndAppend_:",Rt+c,Pt+k.startTime,"reference.position\x3d"+e.position,Tt+e.startTime,St+e.endTime);var l=b.stream,m=a.g.presentationTimeline.getDuration(),n=a.g.periods[d+1];d=Zx(a,b,d,Math.max(0,k.startTime-.1),n?n.startTime+.01:m,e);b.eb=!0;b.Yc=!1;a.a.debug(g,"fetching segment");var p=!1,q=a.f.X.ra(b.type)||0;d.then(function(){return a.j||a.A?null:$x(a,b,
120
- e,!1,function(r){return f(r.data,!0)})}).then(function(r){return p||a.j||a.A||null===r?(a.j||a.A||ay(a,b,q,e,l),null):f(r,!1)}).then(function(){a.j||a.A||(ay(a,b,q,e,l),b.eb=!1,b.Je=!1,b.Bb||a.f.Ed(),Bx(a,b,0),by(a,b,l),a.a.debug(g,"finished fetch and append"))})["catch"](function(r){if(!a.j&&!a.A)if(b.eb=!1,b.type==_.se&&a.m.ignoreTextStreamFailures)1001==r.code?a.a.warn(g,"Text stream failed to download. Proceeding without it."):a.a.warn(g,"Text stream failed to parse. Proceeding without it."),
121
- a.h["delete"](_.se);else if(7001==r.code)b.eb=!1,b.zb=null,Bx(a,b,0);else if(3017==r.code)cy(a,b,r);else if(b.type===_.se)r instanceof _.J&&r.a(1),Kx(b),a.f.onError(new _.J(1,2,2010,r));else if(1001<=r.code&&1003>=r.code){var x=!0;1001===r.code&&500<=r.data.status||(x=typeof a.f.Xd===_.Yc&&!a.f.Xd(b.stream));x&&(b.Dc=!0,r.a(_.K),Rx(a,r))}else a.a.error(g,"failed fetch and append: code\x3d"+r.code),b.Dc=!0,r instanceof _.J&&r.a(_.K),Rx(a,r)})};
122
- ey=function(a,b){b=void 0===b?!1:b;if(a.j)a.a.error("Unable to retry after StreamingEngine is destroyed!");else if(a.A)a.a.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(var c=_.t(a.h.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=Ix(d);if(d.Dc||b&&dy(d))a.a.info(e,"Retrying after failure..."),d.Dc=!1,Bx(a,d,.1)}};
123
- cy=function(a,b,c){var d=Ix(b);if(Array.from(a.h.values()).some(function(f){return f!=b&&f.Je}))a.a.debug(d,Ft,"waiting for another stream to recover...");else{var e=Math.round(100*a.B);if(20<e)a.B-=.2;else if(4<e)a.B-=.04;else{a.a.error(d,"MediaSource threw QuotaExceededError too many times");b.Dc=!0;a.A=!0;a.f.onError(c);return}a.a.warn(d,Ft,"reducing buffering goals by "+(100-Math.round(100*a.B))+"%");b.Je=!0}Bx(a,b,4)};
124
- Zx=function(a,b,c,d,e,f){c=a.g.periods[c].startTime-f.xb;if(!b.Yc&&c===b.Hf)return Promise.resolve();b.Hf=c;var g=Ix(b);a.a.debug(g,"setting timestamp offset to "+c);a.a.debug(g,"setting append window start to "+d);a.a.debug(g,"setting append window end to "+e);d=Kv(a.f.X,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.Yc)return d;a.a.debug(g,"fetching init segment");e=$x(a,b,b.stream.initSegmentReference,!0).then(function(k){if(a.j)return null;a.a.debug(g,"appending init segment");return fy(a,
125
- k,b).then(function(){return Hv(a.f.X,b.type,k,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(k){b.Yc=!0;return Promise.reject(k)});return Promise.all([d,e])};fy=function(a,b,c){var d;return _.z(function(e){if(!a.m.patchEdgeWhenMixedContent||!_.ni())return e.H(0);d=rx(b);return _.v(e,Hv(a.f.X,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
126
- Yx=function(a,b,c,d,e,f,g,k){k=void 0===k?!1:k;var l=Ix(b);if(e.encrypted&&e.keyId&&a.D.length&&!a.D.includes(e.keyId))return a.a.warn(l,"Stream has key restrictions. Blocking."),Kx(b),b.ub=e,b.sa=f,a.f.Xd(e,!0),Promise.resolve();var m=e.closedCaptions&&0<e.closedCaptions.size;null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.qk).V("emsg",a.L.bind(a,d,f,e.emsgSchemeIdUris)).parse(g);return gy(a,b,c).then(function(){if(a.j)return null;a.a.debug(l,"appending media segment");return Hv(a.f.X,
113
+ Yx=function(a,b){function c(p){return p.type==_.te&&p.stream.mimeType==_.Rb}if(c(b))return Qv(a.f.X,b.stream.originalId||""),null;var d=Qx(b),e=a.f.qb(),f=Px(a,b,e);a.a.debug(d,"timeNeeded\x3d"+f);var g=Nx(a,b.stream),k=Hx(a,f),l=a.f.X.xa(b.type,e);a.a.debug(d,"update_:",$t+e,"bufferedAhead\x3d"+l);var m=Math.max(a.g.minBufferTime||0,a.m.rebufferingGoal,a.m.bufferingGoal)*a.B,n=a.g.presentationTimeline.cc()?dv(a.g.presentationTimeline):a.g.presentationTimeline.getDuration();if(f>=n&&!b.pd)return by(a,
114
+ b),null;b.endOfStream=!1;b.vb=k;if(k!=g)return a.a.debug(d,"need Period "+k,$t+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.a.debug(d,"buffering goal met"),a.m.bufferLimitUpdateInterval||.5;k=a.f.X.ra(b.type);k=Rx(a,b,e,k,g);if(!k)return a.g.presentationTimeline.isLive()||b.type===_.te?a.m.bufferLimitUpdateInterval||1:(a.a.debug("Media state "+d+": no next segment found. Assuming EOS."),by(a,b),null);d=Infinity;l=_.t(a.h.values());for(m=l.next();!m.done;m=l.next())m=m.value,
115
+ c(m)||(m=Px(a,m,e),d=Math.min(d,m));if(f>=d+a.g.presentationTimeline.a)return a.m.bufferLimitUpdateInterval||1;b.dg=0;cy(a,b,e,g,k);return null};by=function(a,b){a.a.debug(Qx(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.Ie){var c=a.h.get(_.te);c&&c.stream.mimeType==_.Rb&&(c.endOfStream=!0)}};Px=function(a,b,c){if(!b.ub||!b.sa)return Math.max(c,b.dg);c=Nx(a,b.ub);return a.g.periods[c].startTime+b.sa.endTime};
116
+ Rx=function(a,b,c,d,e){var f=Qx(b);if(b.sa&&b.stream==b.ub)return d=b.sa.position+1,a.a.debug(f,"next position known:","position\x3d"+d),dy(a,b,e,d);b.sa?(a.a.debug(f,"next position unknown: another Stream buffered"),f=Nx(a,b.ub),f=ey(a,b,a.g.periods[f].startTime+b.sa.endTime,e)):(a.a.debug(f,"next position unknown: nothing buffered"),f=ey(a,b,d||c,e));if(null==f)return null;c=null;null!=d||null!==a.m&&a.m.ignoreDrift||(c=dy(a,b,e,Math.max(0,f-1)));return c||dy(a,b,e,f)};
117
+ ey=function(a,b,c,d){var e=Qx(b);d=a.g.periods[d];a.a.debug(e,"looking up segment:","lastSegment.endTime\x3d"+c,Yt+d.startTime);c=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(c);null==b&&a.a.warn(e,"cannot find segment:",Yt+d.startTime,"lookupTime\x3d"+c);return b};
118
+ dy=function(a,b,c,d){var e=Qx(b);c=a.g.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.a.debug(e,"segment does not exist:",Yt+c.startTime,"position\x3d"+d),null;var g=a.g.presentationTimeline;d=_.ev(g);g=dv(g);return!b.pd&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.a.debug(e,"segment is not available:",Yt+c.startTime,bu+f.startTime,au+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
119
+ cy=function(a,b,c,d,e){function f(r,x){if(a.j||a.A)return null;p=!0;return fy(a,b,c,k,l,e,r,x)}var g=Qx(b),k=a.g.periods[d];a.a.debug(g,"fetchAndAppend_:",$t+c,Yt+k.startTime,"reference.position\x3d"+e.position,bu+e.startTime,au+e.endTime);var l=b.stream,m=a.g.presentationTimeline.getDuration(),n=a.g.periods[d+1];d=gy(a,b,d,Math.max(0,k.startTime-.1),n?n.startTime+.01:m,e);b.eb=!0;b.Yc=!1;a.a.debug(g,"fetching segment");var p=!1,q=a.f.X.ra(b.type)||0;d.then(function(){return a.j||a.A?null:hy(a,b,
120
+ e,!1,function(r){return f(r.data,!0)})}).then(function(r){return p||a.j||a.A||null===r?(a.j||a.A||iy(a,b,q,e,l),null):f(r,!1)}).then(function(){a.j||a.A||(iy(a,b,q,e,l),b.eb=!1,b.Je=!1,b.Bb||a.f.Ed(),Jx(a,b,0),jy(a,b,l),a.a.debug(g,"finished fetch and append"))})["catch"](function(r){if(!a.j&&!a.A)if(b.eb=!1,b.type==_.te&&a.m.ignoreTextStreamFailures)1001==r.code?a.a.warn(g,"Text stream failed to download. Proceeding without it."):a.a.warn(g,"Text stream failed to parse. Proceeding without it."),
121
+ a.h["delete"](_.te);else if(7001==r.code)b.eb=!1,b.zb=null,Jx(a,b,0);else if(3017==r.code)ky(a,b,r);else if(b.type===_.te)r instanceof _.J&&r.a(1),Sx(b),a.f.onError(new _.J(1,2,2010,r));else if(1001<=r.code&&1003>=r.code){var x=!0;1001===r.code&&500<=r.data.status||(x=typeof a.f.Xd===_.Zc&&!a.f.Xd(b.stream));x&&(b.Cc=!0,r.a(_.K),Zx(a,r))}else a.a.error(g,"failed fetch and append: code\x3d"+r.code),b.Cc=!0,r instanceof _.J&&r.a(_.K),Zx(a,r)})};
122
+ my=function(a,b){b=void 0===b?!1:b;if(a.j)a.a.error("Unable to retry after StreamingEngine is destroyed!");else if(a.A)a.a.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(var c=_.t(a.h.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=Qx(d);if(d.Cc||b&&ly(d))a.a.info(e,"Retrying after failure..."),d.Cc=!1,Jx(a,d,.1)}};
123
+ ky=function(a,b,c){var d=Qx(b);if(Array.from(a.h.values()).some(function(f){return f!=b&&f.Je}))a.a.debug(d,Ot,"waiting for another stream to recover...");else{var e=Math.round(100*a.B);if(20<e)a.B-=.2;else if(4<e)a.B-=.04;else{a.a.error(d,"MediaSource threw QuotaExceededError too many times");b.Cc=!0;a.A=!0;a.f.onError(c);return}a.a.warn(d,Ot,"reducing buffering goals by "+(100-Math.round(100*a.B))+"%");b.Je=!0}Jx(a,b,4)};
124
+ gy=function(a,b,c,d,e,f){c=a.g.periods[c].startTime-f.xb;if(!b.Yc&&c===b.Hf)return Promise.resolve();b.Hf=c;var g=Qx(b);a.a.debug(g,"setting timestamp offset to "+c);a.a.debug(g,"setting append window start to "+d);a.a.debug(g,"setting append window end to "+e);d=Sv(a.f.X,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.Yc)return d;a.a.debug(g,"fetching init segment");e=hy(a,b,b.stream.initSegmentReference,!0).then(function(k){if(a.j)return null;a.a.debug(g,"appending init segment");return ny(a,
125
+ k,b).then(function(){return Pv(a.f.X,b.type,k,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(k){b.Yc=!0;return Promise.reject(k)});return Promise.all([d,e])};ny=function(a,b,c){var d;return _.z(function(e){if(!a.m.patchEdgeWhenMixedContent||!_.ri())return e.H(0);d=zx(b);return _.v(e,Pv(a.f.X,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
126
+ fy=function(a,b,c,d,e,f,g,k){k=void 0===k?!1:k;var l=Qx(b);if(e.encrypted&&e.keyId&&a.D.length&&!a.D.includes(e.keyId))return a.a.warn(l,"Stream has key restrictions. Blocking."),Sx(b),b.ub=e,b.sa=f,a.f.Xd(e,!0),Promise.resolve();var m=e.closedCaptions&&0<e.closedCaptions.size;null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Oj).V("emsg",a.M.bind(a,d,f,e.emsgSchemeIdUris)).parse(g);return oy(a,b,c).then(function(){if(a.j)return null;a.a.debug(l,"appending media segment");return Pv(a.f.X,
127
127
  b.type,g,f.startTime+d.startTime,f.endTime+d.startTime,m,e.id,k)}).then(function(){a.j||(a.a.debug(l,"appended media segment"),b.ub=e,b.sa=f)})};
128
- ay=function(a,b,c,d,e){if(!a.g.presentationTimeline.isLive()&&b.type!==_.se){var f=Ix(b);c=(a.f.X.ra(b.type)||0)-c;var g=d.endTime-d.startTime,k=c-g;Math.abs(k)>=Math.min(.01,g)&&Math.abs(k)<=Math.min(1,g)&&(a.a.debug(f,"Adjusted segment",d.position,"with real duration",c,"and accounted for",k,"delta between segment duration and real duration"),b.pd=!0,e.adjustSegmentDurations(d.position,k))}};
129
- hy=function(a,b,c){(new _.qk).M(_.rd,_.rk).M(_.we,_.rk).M(_.md,_.rk).M(_.qd,_.rk).M(_.je,_.rk).V(_.me,_.sk).M("encv",function(d){d.F.skip(78);_.rk(d)}).M("sinf",_.rk).M("schi",_.rk).M("tenc",function(d){d.F.skip(6);if(_.Xt(d.F)){d.F.skip(1);var e=_.ij(_.Hj(d.F,16));e!==b.stream.keyId&&(a.a.debug(Ix(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.cb.stop()}).parse(c)};
130
- gy=function(a,b,c){if(a.j)return Promise.resolve();var d=Ix(b);a.a.debug(d,"checking buffer length");var e=Math.max(a.m.bufferBehind,a.g.presentationTimeline.a),f=a.f.X.lb(b.type);if(null==f)return a.a.debug(d,"buffer behind okay because nothing buffered:",Rt+c,Lt+e),Promise.resolve();var g=c-f,k=g-e;if(.01>=k)return a.a.debug(d,"buffer behind okay:",Rt+c,Mt+g,Lt+e,"underflow\x3d"+Math.abs(k)),Promise.resolve();a.a.debug(d,"buffer behind too large:",Rt+c,Mt+g,Lt+e,"overflow\x3d"+k);return a.f.X.remove(b.type,
131
- f,f+k).then(function(){a.j||a.a.debug(d,"evicted "+k+" seconds")})};by=function(a,b,c){if(!a.C){var d=Ix(b);b=Array.from(a.h.values());1!=b.length||b[0].type!=_.se?a.C=b.every(function(e){return e.type==_.se||a.G?!0:!e.Bb&&!e.Ub&&e.sa}):a.G&&(a.C=!0);if(a.C){a.a.debug(d,"startup complete");c=Fx(a,c);a.o[c]||Px(a,c).then(function(){a.j||(a.a.debug(d,Nt),a.f.ze())})["catch"](mu);for(c=0;c<a.g.periods.length;++c)Px(a,c)["catch"](mu);a.f.mj&&(a.a.debug(d,"calling onStartupComplete()..."),a.f.mj())}}};
132
- Sx=function(a,b){var c=Ix(b),d=Fx(a,b.stream);if(b.vb!=d){var e=b.vb,f=Array.from(a.h.values());f.every(function(g){return g.vb==e})?f.every(dy)?(a.a.debug(c,"all need Period "+e),Px(a,e).then(function(){if(!a.j)if(f.every(function(n){var p=dy(n),q=Fx(a,n.stream);return p&&n.vb==e&&q!=e})){var g=a.g.periods[e];a.a.debug(c,"calling onChooseStreams()...");var k=a.f.Ae(g);a.G=!k.variant&&!!k.text;var l=new Map;k.variant&&k.variant.video&&l.set(_.He,k.variant.video);k.variant&&k.variant.audio&&l.set(_.Zb,
133
- k.variant.audio);k.text&&l.set(_.se,k.text);var m=_.t(a.h.keys());for(k=m.next();!k.done;k=m.next())if(k=k.value,!l.has(k)&&k!=_.se){a.a.error(c,"invalid Streams chosen: missing "+k+" Stream");a.f.onError(new _.J(_.K,5,5005));return}m=_.t(Array.from(l.keys()));for(k=m.next();!k.done;k=m.next())if(k=k.value,!a.h.has(k))if(k==_.se)Ox(a,null,null,l.get(_.se),g.startTime),l["delete"](k);else{a.a.error(c,"invalid Streams chosen: unusable "+k+" Stream");a.f.onError(new _.J(_.K,5,5005));return}g=_.t(Array.from(a.h.keys()));
134
- for(k=g.next();!k.done;k=g.next())k=k.value,(m=l.get(k))?(_.Dx(a,m,!1,0),Bx(a,a.h.get(k),0)):a.h["delete"](k);a.a.debug(c,Nt);a.f.ze()}else a.a.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](mu)):a.a.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.a.debug(c,"not all MediaStates need Period "+e)}};zx=function(a,b){var c=Lu(a.g.periods,b+_.up);return c?a.g.periods.indexOf(c):0};
135
- Fx=function(a,b){for(var c=a.g.periods,d=0;d<c.length;d++){for(var e=c[d],f=new Set,g=_.t(e.variants),k=g.next();!k.done;k=g.next())k=k.value,k.audio&&f.add(k.audio),k.video&&f.add(k.video),k.video&&k.video.trickModeVideo&&f.add(k.video.trickModeVideo);e=_.t(e.textStreams);for(g=e.next();!g.done;g=e.next())f.add(g.value);if(f.has(b))return d}return-1};
136
- $x=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.Pu(c.Ra(),c.Ka,c.za,a.m.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Wb?null:e;f.disableFragmentSupport=c.Wb||a.m.disableFragmentSupport;f.disableMergedFragments=a.m.disableMergedFragments;if(e=c.a())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){hy(a,b,g.data)}),b.type===_.He&&a.m.overridePasp&&f.responseModifiers.push(a.O.bind(a)));a.a.debug("fetching: reference\x3d",
137
- c);c=a.f.wb.fetch(f);b.fc=c;return c.N.then(function(g){var k=a.f.fe(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&k.segmentDownloaded(l,m);b.fc=null;return g.data})};
138
- Lx=function(a,b,c,d){var e,f,g,k;return _.z(function(l){if(1==l.a)return e=Ix(b),b.Bb=!1,b.Kd=!1,b.ld=0,b.Ub=!0,a.a.debug(e,"clearing buffer"),d?(g=a.f.qb(),k=a.f.X.getDuration(),f=a.f.X.remove(b.type,g+d,k)):f=a.f.X.clear(b.type).then(function(){return!a.j&&c?a.f.X.flush(b.type):null}),_.v(l,f,2);if(a.j)return l["return"]();a.a.debug(e,"cleared buffer");b.ub=null;b.sa=null;b.Ub=!1;b.endOfStream=!1;b.pd=!1;Bx(a,b,0);_.w(l)})};
139
- Bx=function(a,b,c){a.a.debug(Ix(b),"updating in "+c+" seconds");b.zb=(new _.lh(function(){Tx(a,b)})).$(c)};Kx=function(a){null!=a.zb&&(a.zb.stop(),a.zb=null)};iy=function(a){var b,c,d,e;return _.z(function(f){b=[];c=_.t(a.h.values());for(d=c.next();!d.done;d=c.next())e=d.value,Kx(e),e.eb&&e.fc&&(e.eb=!1,b.push(e.fc.abort())),e.Bb&&b.push(Lx(a,e,!0,0));return _.v(f,Promise.all(b),0)})};
140
- jy=function(a,b,c){(a=a.h.get(b))&&c&&(Kx(a),a.stream=c,a.ub=c,a.sa&&(a.sa=c.getSegmentReference(a.sa.position)),a.sa||(a.ub=null))};Rx=function(a,b){var c;_.z(function(d){switch(d.a){case 1:if(a.j)return d["return"]();if(!a.f.hg){d.H(2);break}_.qf(d,3);return _.v(d,a.f.hg(b),5);case 5:_.rf(d,2);break;case 3:c=_.sf(d),c.cause=b,b=c;case 2:if(!b.f)a.f.onError(b);_.w(d)}})};Ix=function(a){return"("+a.type+":"+a.stream.id+")"};dy=function(a){return!a.eb&&null==a.zb&&!a.Bb&&!a.Ub};
141
- my=function(a){_.Wi.call(this,Ot);var b=this;this.C=ky;this.h=this.td=this.U=null;this.we=0;this.Yf=2;this.Mc=null;this.re=!1;this.j=new _.Tf;this.Ha=this.xd=this.uc=this.nc=this.w=this.I=this.m=null;this.Lc=!1;this.g=this.f=this.B=this.a=this.rc=this.D=null;this.ig=1E9;this.yd=new Set;this.T=!0;this.ca=null;this.ag=!1;this.$f=0;this.Y=null;this.L=new Cw;this.eg={width:Infinity,height:Infinity};this.G=null;this.aa=_.zl;this.sc=new Jw(this.configuration.preferredAudioLanguage,this.configuration.preferredAudioRole,
142
- this.configuration.preferredAudioChannelCount);this.wa=this.configuration.preferredTextLanguage;this.O=this.tc=null;this.vc=new Map;this.ga=null;this.kb=this.configuration.preferredTextRole;a&&a(this);this.se=null;this.j.on(window,"online",function(){b.C===ly&&ey(b.a)})};
143
- ny=function(a){return new _.qu(function(b){if(void 0===b||null===b)return null;var c=a.getTrackManager(),d=[];if(c){c=_.t(c.getVideoTracks());for(var e=c.next();!e.done;e=c.next())d.push.apply(d,_.af(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
144
- oy=function(a,b){if(a.aa!==b)if(a.aa===_.Kl&&b!==_.zl)a.log.info(_.Ht+bu(b,_.Il));else{var c=a.we;c=0===c?0:Date.now()-c;var d=a.aa;a.aa=b;a.we=Date.now();a.G&&_.pl(a.G.a,a.aa);b===_.El&&(a.Yf=a.qe?1:2);var e=a.Yf,f={currentState:a.aa,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.El||d===_.El?e:void 0};a.log.info(_.Za+bu(d,_.Il)+" -\x3e "+(bu(b,_.Il)+(b!==_.El?"":"["+bu(e,_.Hl)+"]")));a.trigger(new _.E(_.he,{detail:f}));(b===_.Gl||b===_.Kl)&&a.Ha&&a.Ha.stop();b===_.El?a.trigger(new _.E(_.jc,
145
- {detail:{bufferedTimeMS:-1,reason:e}})):d===_.El&&a.trigger(new _.E(_.ic,{detail:{bufferedTimeMS:c,reason:e}}))}};uy=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.z(function(e){switch(e.a){case 1:return a.C===py?e["return"](Promise.reject(new _.J(_.K,7,7E3))):_.v(e,qy(a),2);case 2:return _.v(e,ry(a),3);case 3:c=_.fi(4)||_.fi(5);if(!b&&!c){e.H(0);break}d=a.getSurface().getMedia();return _.v(e,sy(a,d),5);case 5:return _.v(e,ty(a,d),0)}})};
146
- sy=function(a,b){a.h||(a.j.on(b,_.Vc,function(){if(a.h.error){var c=a.h.error.code;if(1==c)c=null;else{var d=a.h.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.J(_.K,3,3016,{code:c,extendedError:d,message:a.h.error.message})}}else c=null;if(c)a.onError(c)}),a.h=b);return Promise.resolve()};ry=function(a){a.h&&(a.j.off(a.h,_.Vc),a.h=null);return Promise.resolve()};
147
- qy=function(a){var b;return _.z(function(c){switch(c.a){case 1:a.C!==py&&(a.C=ky);if(b=a.h)a.j.off(b,_.id),a.j.off(b,_.Qd),a.j.off(b,_.Ld),a.j.off(b,_.Uc),a.j.off(b,_.Vd),a.j.off(b,_.Td);a.nc&&(a.nc.release(),a.nc=null);a.Ha&&(a.Ha.stop(),a.Ha=null);if(!a.B){c.H(2);break}return _.v(c,a.B.stop(),3);case 3:a.B=null;case 2:if(!a.g){c.H(4);break}return _.v(c,a.g.stop(),4);case 4:if(!a.a){c.H(6);break}return _.v(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.w&&(a.w.release(),a.w=null);if(!a.I){c.H(8);break}return _.v(c,
148
- a.I.destroy(),9);case 9:a.I=null;case 8:a.xd&&(a.xd.release(),a.xd=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.m){c.H(10);break}return _.v(c,a.m.destroy(),11);case 11:a.m=null;case 10:a.L.clear(),a.D=null,a.yd.clear(),a.f=null,a.G=null,a.T=!0,a.vc.clear(),a.Lc=!1,vy(a),_.w(c)}})};
149
- ty=function(a,b){var c,d,e;return _.z(function(f){if(1==f.a)return c=window.muxjs?new pv:new _.qv,d=_.ml(a.configuration,["html",_.ee]),a.J=d.create(a),a.Mc=ny(a),a.Mc.track(a),e=new _.xv(b,c,a.J,a.Mc,a.configuration),_.v(f,e.G,2);a.I=e;_.w(f)})};wy=function(a,b){var c,d;return _.z(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.v(e,_.io(b.url,c,a.configuration.manifest.attemptParameters,b.type),2);d.B=e.f;a.B.configure(a.configuration.manifest);_.w(e)})};
150
- Ay=function(a,b){var c;return _.z(function(d){a.rc=new $u;av(a.rc,function(e){xy(a,_.gg,e)});c=new _.Ph(Promise.resolve().then(function(){var e,f,g;return _.z(function(k){switch(k.a){case 1:if(a.f){k.H(3);break}_.qf(k,4);e=a;return _.v(k,a.B.start(b.url,yy(a)),6);case 6:e.f=k.f;_.rf(k,1);break;case 4:f=_.sf(k);if(!a.Ma)throw f;return _.v(k,a.Ma(b.url,f),8);case 8:if(g=k.f)b.url=g;else throw f;k.H(1);break;case 3:!a.f.presentationTimeline||_.H.R(a.configuration.suggestedPresentationDelay)||isNaN(a.configuration.suggestedPresentationDelay)||
151
- (a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.Ie=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.C=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.J(_.K,4,4014);zy(a.f.periods);_.w(k)}})}),function(){a.log.info("Aborting parser step...");return a.B.stop()});return _.v(d,c.N,0)})};
152
- Iy=function(a){var b,c,d,e,f;return _.z(function(g){switch(g.a){case 1:a.m=new _.Bk({wb:a.getNetworkEngine(),onError:function(k){return a.onError(k)},Ce:function(k){if(a.a){var l=By(a),m=!1,n=Object.keys(k);0==n.length&&a.log.warn("Got a key status event without any key statuses, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");var p=1==n.length&&"00"==n[0];p&&a.log.warn("Got a synthetic key status event, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");
153
- if(n.length){n=_.t(l.variants);for(var q=n.next();!q.done;q=n.next()){q=q.value;var r=[];q.audio&&r.push(q.audio);q.video&&r.push(q.video);r=_.t(r);for(var x=r.next();!x.done;x=r.next()){var y=x.value;x=q.allowedByKeySystem;y.keyId&&(y=k[p?"00":y.keyId],q.allowedByKeySystem=!!y&&!Cy.includes(y));x!=q.allowedByKeySystem&&(m=!0)}}}n=[];if(!p)for(var C in k)Cy.includes(k[C])||n.push(C);a.log.debug("allowedKeyIds",n);a.a.D=n;k=wx(a.a);p=xx(a.a);(k=cw(k,p,l.variants))&&!k.allowedByKeySystem&&(a.log.debug("Choosing new streams after key status changed"),
154
- Dy(a,l));m&&(Ey(a),Fy(a,l.variants))}},onExpirationUpdated:function(k,l){if(a.B&&a.B.onExpirationUpdated)a.B.onExpirationUpdated(k,l);a.trigger(new _.E(_.Mc,{expirationTime:l}))},onEvent:function(k){return a.$d(k)},getConfiguration:function(){return a.getConfiguration()},Cc:function(){return a.Cc()}});Gy(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.ao(a.f.periods);if(!c){g.H(2);break}f=_.$i(_.Md);if(!f){g.H(2);break}return _.v(g,f.pj(b,e,a.getNetworkEngine()),4);case 4:return _.v(g,f.ji(c),
155
- 5);case 5:d=g.f;case 2:return _.v(g,_.Gk(a.m,e,d),6);case 6:a.f&&Hy(a,a.f.periods),_.w(g)}})};
156
- Ty=function(a){var b,c,d,e,f,g,k,l,m,n,p;return _.z(function(q){if(1==q.a)return b=a.h,c=function(r){a.h&&a.D&&(r.type===_.ce&&a.Bd?(a.D.a=Ow,vy(a)):r.type===_.Pe&&a.getState()===_.Nl&&.1>a.getBufferInfo().xa(a.getPosition())?(a.D.a=Ow,vy(a)):a.D&&Jy(a));Ky(a)},d=function(){if(a.h){var r=a.h.playbackRate;0!=r&&a.uc.set(r)}},a.j.on(b,_.Qd,c),a.j.on(b,_.Ld,c),a.j.on(b,_.Uc,c),a.j.on(b,_.ce,c),a.j.on(b,_.be,c),a.j.on(b,_.Td,c),a.j.on(b,_.Pe,c),a.j.on(b,_.Vd,d),a.g||(a.g=new _.Aw,a.g.configure(a.configuration.abr)),
157
- Ly(a,a.f.periods),a.sc=new Jw(a.configuration.preferredAudioLanguage,a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.wa=a.configuration.preferredTextLanguage,a.kb=a.configuration.preferredTextRole,_.v(q,_.Tk(a.m,b),2);if(3!=q.a){if(!a.m)throw new _.J(_.K,7,7001);a.g.init(function(r,x,y){!a.T&&My(a,r,x,y)});a.w=Ny(a,a.configuration.startTime);a.nc=Oy(a);a.uc=new Uw({je:function(){return b.playbackRate},fg:function(r){b.playbackRate=r},xi:function(r){b.currentTime+=
158
- r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.xd=new Rw(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);Py(a,e);Tv(a.f,_.wh(a.configuration.preferredVideoCodec),_.wh(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=Qy(a);a.a.m=a.configuration.streaming;a.C=ly;return _.v(q,a.a.start(),3)}if(!a.a)throw new _.J(_.K,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=ox(a.w),g=Ry(a,f),hx(a.w.g,g));k=_.t(a.f.periods);for(l=
159
- k.next();!l.done;l=k.next())m=l.value,Sy(a,m);Ey(a);n=By(a)||a.f.periods[0];p=n.variants.some(function(r){return r.primary});a.configuration.preferredAudioLanguage||p||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");Fy(a,n.variants);a.j.one(b,_.id,function(){a.G.o=Date.now()/1E3-(null===a.se?0:a.se)});_.w(q)})};
160
- zy=function(a){function b(d){return d.video&&d.audio||d.video&&d.video.codecs.includes(",")}if(a.some(function(d){return d.variants.some(b)})){_.Jf("Found variant with audio and video content, so filtering out audio-only content in all periods.");a=_.t(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c.variants=c.variants.filter(b)}};Ny=function(a,b){return new mx(a.h,a.f,a.configuration.streaming,b,function(){a.nc&&ev(a.nc,!0);a.a&&Mx(a.a)},function(c){return a.dispatchEvent(c)})};
161
- Oy=function(a){var b=new Sw(a.f);Tw(b,function(){Ey(a)});var c=new gv(a.rc);hv(c,function(e){e.Dd&&e.Dd();xy(a,_.ig,e)},function(e){e.Be&&e.Be();xy(a,_.jg,e)},function(e,f){f||(e.Dd&&e.Dd(),xy(a,_.ig,e),e.Be&&e.Be(),xy(a,_.jg,e))});var d=new fv(a.h);d.a.add(b);d.a.add(c);return d};Py=function(a,b){a.D=new Pw(b,Math.min(.5,b/2));a.D.a=Ow;vy(a);a.Ha=(new _.oh(function(){Jy(a)})).Xa(.25)};
162
- Jy=function(a){switch(a.C){case ly:a:if(a.h.ended||Cv(a.I))var b=!0;else{if(a.f.presentationTimeline.isLive()){b=Wu(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.ra(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}c=0;if(a.I){var d=Ev(a.I),e=d.video;d=d.audio;var f=a.h.currentTime;if(e||d)c=e&&d?Math.min(e.xa(f),d.xa(f)):e?e.xa(f):d.xa(f)}if(e=a.D){e=a.D;d=c;f=b;var g=e.f.get(e.a);c=e.a;d=f||d>=g?Nw:Ow;e.a=d;e=c!=d}c=e;e=Uy(a);c||a.getState()===_.El&&!e?(a.log.debug("Buffering state changed. Is buffering",
163
- e,"buffered to end",b,"state",a.getState()),vy(a)):a.Lc&&Ky(a)};Qy=function(a){var b={qb:function(){return ox(a.w)},X:a.I,wb:a.getNetworkEngine(),Ae:a.vh.bind(a),ze:a.uh.bind(a),onError:a.onError.bind(a),Of:a.Ui.bind(a),onEvent:a.$d.bind(a),Tf:a.wh.bind(a),Ed:a.hj.bind(a),fe:function(){return a.g},Xd:a.Fg.bind(a),hg:a.Jj.bind(a)};return new _.ux(a.f,b)};Gy=function(a){var b=_.sj(a.configuration.drm);a.m.h=b};
164
- Vy=function(a){a.B&&a.B.configure(a.configuration.manifest);a.m&&Gy(a);if(a.a){a.a.m=a.configuration.streaming;try{for(var b=_.t(a.f.periods),c=b.next();!c.done;c=b.next())Sy(a,c.value)}catch(e){a.onError(e)}c=wx(a.a);var d=xx(a.a);b=By(a)||a.f.periods[0];c=cw(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?Fy(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),Dy(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.T?a.g.enable():
128
+ iy=function(a,b,c,d,e){if(!a.g.presentationTimeline.isLive()&&b.type!==_.te){var f=Qx(b);c=(a.f.X.ra(b.type)||0)-c;var g=d.endTime-d.startTime,k=c-g;Math.abs(k)>=Math.min(.01,g)&&Math.abs(k)<=Math.min(1,g)&&(a.a.debug(f,"Adjusted segment",d.position,"with real duration",c,"and accounted for",k,"delta between segment duration and real duration"),b.pd=!0,e.adjustSegmentDurations(d.position,k))}};
129
+ py=function(a,b,c){(new _.Oj).L(_.sd,_.Pj).L(_.xe,_.Pj).L(_.nd,_.Pj).L(_.rd,_.Pj).L(_.le,_.Pj).V(_.ne,_.Qj).L("encv",function(d){d.F.skip(78);_.Pj(d)}).L(_.ee,_.Pj).L("schi",_.Pj).L("tenc",function(d){d.F.skip(6);if(_.Ij(d.F)){d.F.skip(1);var e=_.nj(_.Nj(d.F,16));e!==b.stream.keyId&&(a.a.debug(Qx(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.Ta.stop()}).parse(c)};
130
+ oy=function(a,b,c){if(a.j)return Promise.resolve();var d=Qx(b);a.a.debug(d,"checking buffer length");var e=Math.max(a.m.bufferBehind,a.g.presentationTimeline.a),f=a.f.X.lb(b.type);if(null==f)return a.a.debug(d,"buffer behind okay because nothing buffered:",$t+c,Ut+e),Promise.resolve();var g=c-f,k=g-e;if(.01>=k)return a.a.debug(d,"buffer behind okay:",$t+c,Vt+g,Ut+e,"underflow\x3d"+Math.abs(k)),Promise.resolve();a.a.debug(d,"buffer behind too large:",$t+c,Vt+g,Ut+e,"overflow\x3d"+k);return a.f.X.remove(b.type,
131
+ f,f+k).then(function(){a.j||a.a.debug(d,"evicted "+k+" seconds")})};jy=function(a,b,c){if(!a.C){var d=Qx(b);b=Array.from(a.h.values());1!=b.length||b[0].type!=_.te?a.C=b.every(function(e){return e.type==_.te||a.G?!0:!e.Bb&&!e.Tb&&e.sa}):a.G&&(a.C=!0);if(a.C){a.a.debug(d,"startup complete");c=Nx(a,c);a.o[c]||Xx(a,c).then(function(){a.j||(a.a.debug(d,Wt),a.f.ze())})["catch"](uu);for(c=0;c<a.g.periods.length;++c)Xx(a,c)["catch"](uu);a.f.mj&&(a.a.debug(d,"calling onStartupComplete()..."),a.f.mj())}}};
132
+ $x=function(a,b){var c=Qx(b),d=Nx(a,b.stream);if(b.vb!=d){var e=b.vb,f=Array.from(a.h.values());f.every(function(g){return g.vb==e})?f.every(ly)?(a.a.debug(c,"all need Period "+e),Xx(a,e).then(function(){if(!a.j)if(f.every(function(n){var p=ly(n),q=Nx(a,n.stream);return p&&n.vb==e&&q!=e})){var g=a.g.periods[e];a.a.debug(c,"calling onChooseStreams()...");var k=a.f.Ae(g);a.G=!k.variant&&!!k.text;var l=new Map;k.variant&&k.variant.video&&l.set(_.Ie,k.variant.video);k.variant&&k.variant.audio&&l.set(_.$b,
133
+ k.variant.audio);k.text&&l.set(_.te,k.text);var m=_.t(a.h.keys());for(k=m.next();!k.done;k=m.next())if(k=k.value,!l.has(k)&&k!=_.te){a.a.error(c,"invalid Streams chosen: missing "+k+" Stream");a.f.onError(new _.J(_.K,5,5005));return}m=_.t(Array.from(l.keys()));for(k=m.next();!k.done;k=m.next())if(k=k.value,!a.h.has(k))if(k==_.te)Wx(a,null,null,l.get(_.te),g.startTime),l["delete"](k);else{a.a.error(c,"invalid Streams chosen: unusable "+k+" Stream");a.f.onError(new _.J(_.K,5,5005));return}g=_.t(Array.from(a.h.keys()));
134
+ for(k=g.next();!k.done;k=g.next())k=k.value,(m=l.get(k))?(_.Lx(a,m,!1,0),Jx(a,a.h.get(k),0)):a.h["delete"](k);a.a.debug(c,Wt);a.f.ze()}else a.a.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](uu)):a.a.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.a.debug(c,"not all MediaStates need Period "+e)}};Hx=function(a,b){var c=Tu(a.g.periods,b+_.Cp);return c?a.g.periods.indexOf(c):0};
135
+ Nx=function(a,b){for(var c=a.g.periods,d=0;d<c.length;d++){for(var e=c[d],f=new Set,g=_.t(e.variants),k=g.next();!k.done;k=g.next())k=k.value,k.audio&&f.add(k.audio),k.video&&f.add(k.video),k.video&&k.video.trickModeVideo&&f.add(k.video.trickModeVideo);e=_.t(e.textStreams);for(g=e.next();!g.done;g=e.next())f.add(g.value);if(f.has(b))return d}return-1};
136
+ hy=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.Xu(c.Ra(),c.La,c.za,a.m.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Vb?null:e;f.disableFragmentSupport=c.Vb||a.m.disableFragmentSupport;f.disableMergedFragments=a.m.disableMergedFragments;if(e=c.a())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){py(a,b,g.data)}),b.type===_.Ie&&a.m.overridePasp&&f.responseModifiers.push(a.O.bind(a)));a.a.debug("fetching: reference\x3d",
137
+ c);c=a.f.wb.fetch(f);b.ec=c;return c.N.then(function(g){var k=a.f.fe(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&k.segmentDownloaded(l,m);b.ec=null;return g.data})};
138
+ Tx=function(a,b,c,d){var e,f,g,k;return _.z(function(l){if(1==l.a)return e=Qx(b),b.Bb=!1,b.Kd=!1,b.ld=0,b.Tb=!0,a.a.debug(e,"clearing buffer"),d?(g=a.f.qb(),k=a.f.X.getDuration(),f=a.f.X.remove(b.type,g+d,k)):f=a.f.X.clear(b.type).then(function(){return!a.j&&c?a.f.X.flush(b.type):null}),_.v(l,f,2);if(a.j)return l["return"]();a.a.debug(e,"cleared buffer");b.ub=null;b.sa=null;b.Tb=!1;b.endOfStream=!1;b.pd=!1;Jx(a,b,0);_.w(l)})};
139
+ Jx=function(a,b,c){a.a.debug(Qx(b),"updating in "+c+" seconds");b.zb=(new _.oh(function(){ay(a,b)})).$(c)};Sx=function(a){null!=a.zb&&(a.zb.stop(),a.zb=null)};qy=function(a){var b,c,d,e;return _.z(function(f){b=[];c=_.t(a.h.values());for(d=c.next();!d.done;d=c.next())e=d.value,Sx(e),e.eb&&e.ec&&(e.eb=!1,b.push(e.ec.abort())),e.Bb&&b.push(Tx(a,e,!0,0));return _.v(f,Promise.all(b),0)})};
140
+ ry=function(a,b,c){(a=a.h.get(b))&&c&&(Sx(a),a.stream=c,a.ub=c,a.sa&&(a.sa=c.getSegmentReference(a.sa.position)),a.sa||(a.ub=null))};Zx=function(a,b){var c;_.z(function(d){switch(d.a){case 1:if(a.j)return d["return"]();if(!a.f.hg){d.H(2);break}_.rf(d,3);return _.v(d,a.f.hg(b),5);case 5:_.sf(d,2);break;case 3:c=_.tf(d),c.cause=b,b=c;case 2:if(!b.f)a.f.onError(b);_.w(d)}})};Qx=function(a){return"("+a.type+":"+a.stream.id+")"};ly=function(a){return!a.eb&&null==a.zb&&!a.Bb&&!a.Tb};
141
+ uy=function(a){_.cj.call(this,Xt);var b=this;this.C=sy;this.h=this.td=this.U=null;this.we=0;this.Yf=2;this.Mc=null;this.re=!1;this.j=new _.Yf;this.Ha=this.xd=this.tc=this.mc=this.w=this.I=this.m=null;this.Lc=!1;this.g=this.f=this.B=this.a=this.qc=this.D=null;this.ig=1E9;this.yd=new Set;this.T=!0;this.ca=null;this.ag=!1;this.$f=0;this.Y=null;this.M=new Kw;this.eg={width:Infinity,height:Infinity};this.G=null;this.aa=_.Hl;this.rc=new Rw(this.configuration.preferredAudioLanguage,this.configuration.preferredAudioRole,
142
+ this.configuration.preferredAudioChannelCount);this.wa=this.configuration.preferredTextLanguage;this.O=this.sc=null;this.uc=new Map;this.ga=null;this.kb=this.configuration.preferredTextRole;a&&a(this);this.se=null;this.j.on(window,"online",function(){b.C===ty&&my(b.a)})};
143
+ vy=function(a){return new _.yu(function(b){if(void 0===b||null===b)return null;var c=a.getTrackManager(),d=[];if(c){c=_.t(c.getVideoTracks());for(var e=c.next();!e.done;e=c.next())d.push.apply(d,_.df(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
144
+ wy=function(a,b){if(a.aa!==b)if(a.aa===_.Sl&&b!==_.Hl)a.log.info(_.Qt+ju(b,_.Ql));else{var c=a.we;c=0===c?0:Date.now()-c;var d=a.aa;a.aa=b;a.we=Date.now();a.G&&_.xl(a.G.a,a.aa);b===_.Ml&&(a.Yf=a.qe?1:2);var e=a.Yf,f={currentState:a.aa,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.Ml||d===_.Ml?e:void 0};a.log.info(_.bb+ju(d,_.Ql)+" -\x3e "+(ju(b,_.Ql)+(b!==_.Ml?"":"["+ju(e,_.Pl)+"]")));a.trigger(new _.E(_.ie,{detail:f}));(b===_.Ol||b===_.Sl)&&a.Ha&&a.Ha.stop();b===_.Ml?a.trigger(new _.E(_.kc,
145
+ {detail:{bufferedTimeMS:-1,reason:e}})):d===_.Ml&&a.trigger(new _.E(_.jc,{detail:{bufferedTimeMS:c,reason:e}}))}};Cy=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.z(function(e){switch(e.a){case 1:return a.C===xy?e["return"](Promise.reject(new _.J(_.K,7,7E3))):_.v(e,yy(a),2);case 2:return _.v(e,zy(a),3);case 3:c=_.hi(4)||_.hi(5);if(!b&&!c){e.H(0);break}d=a.getSurface().getMedia();return _.v(e,Ay(a,d),5);case 5:return _.v(e,By(a,d),0)}})};
146
+ Ay=function(a,b){a.h||(a.j.on(b,_.Xc,function(){if(a.h.error){var c=a.h.error.code;if(1==c)c=null;else{var d=a.h.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.J(_.K,3,3016,{code:c,extendedError:d,message:a.h.error.message})}}else c=null;if(c)a.onError(c)}),a.h=b);return Promise.resolve()};zy=function(a){a.h&&(a.j.off(a.h,_.Xc),a.h=null);return Promise.resolve()};
147
+ yy=function(a){var b;return _.z(function(c){switch(c.a){case 1:a.C!==xy&&(a.C=sy);if(b=a.h)a.j.off(b,_.jd),a.j.off(b,_.Qd),a.j.off(b,_.Ld),a.j.off(b,_.Wc),a.j.off(b,_.Vd),a.j.off(b,_.Td);a.mc&&(a.mc.release(),a.mc=null);a.Ha&&(a.Ha.stop(),a.Ha=null);if(!a.B){c.H(2);break}return _.v(c,a.B.stop(),3);case 3:a.B=null;case 2:if(!a.g){c.H(4);break}return _.v(c,a.g.stop(),4);case 4:if(!a.a){c.H(6);break}return _.v(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.w&&(a.w.release(),a.w=null);if(!a.I){c.H(8);break}return _.v(c,
148
+ a.I.destroy(),9);case 9:a.I=null;case 8:a.xd&&(a.xd.release(),a.xd=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.m){c.H(10);break}return _.v(c,a.m.destroy(),11);case 11:a.m=null;case 10:a.M.clear(),a.D=null,a.yd.clear(),a.f=null,a.G=null,a.T=!0,a.uc.clear(),a.Lc=!1,Dy(a),_.w(c)}})};
149
+ By=function(a,b){var c,d,e;return _.z(function(f){if(1==f.a)return c=window.muxjs?new yv:new _.zv,d=_.ul(a.configuration,["html",_.fe]),a.J=d.create(a),a.Mc=vy(a),a.Mc.track(a),e=new _.Fv(b,c,a.J,a.Mc,a.configuration),_.v(f,e.G,2);a.I=e;_.w(f)})};Ey=function(a,b){var c,d;return _.z(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.v(e,_.qo(b.url,c,a.configuration.manifest.attemptParameters,b.type),2);d.B=e.f;a.B.configure(a.configuration.manifest);_.w(e)})};
150
+ Iy=function(a,b){var c;return _.z(function(d){a.qc=new hv;iv(a.qc,function(e){Fy(a,_.ig,e)});c=new _.Rh(Promise.resolve().then(function(){var e,f,g;return _.z(function(k){switch(k.a){case 1:if(a.f){k.H(3);break}_.rf(k,4);e=a;return _.v(k,a.B.start(b.url,Gy(a)),6);case 6:e.f=k.f;_.sf(k,1);break;case 4:f=_.tf(k);if(!a.Na)throw f;return _.v(k,a.Na(b.url,f),8);case 8:if(g=k.f)b.url=g;else throw f;k.H(1);break;case 3:!a.f.presentationTimeline||_.H.R(a.configuration.suggestedPresentationDelay)||isNaN(a.configuration.suggestedPresentationDelay)||
151
+ (a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.Ie=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.C=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.J(_.K,4,4014);Hy(a.f.periods);_.w(k)}})}),function(){a.log.info("Aborting parser step...");return a.B.stop()});return _.v(d,c.N,0)})};
152
+ Qy=function(a){var b,c,d,e,f;return _.z(function(g){switch(g.a){case 1:a.m=new _.Ik({wb:a.getNetworkEngine(),onError:function(k){return a.onError(k)},Ce:function(k){if(a.a){var l=Jy(a),m=!1,n=Object.keys(k);0==n.length&&a.log.warn("Got a key status event without any key statuses, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");var p=1==n.length&&"00"==n[0];p&&a.log.warn("Got a synthetic key status event, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");
153
+ if(n.length){n=_.t(l.variants);for(var q=n.next();!q.done;q=n.next()){q=q.value;var r=[];q.audio&&r.push(q.audio);q.video&&r.push(q.video);r=_.t(r);for(var x=r.next();!x.done;x=r.next()){var y=x.value;x=q.allowedByKeySystem;y.keyId&&(y=k[p?"00":y.keyId],q.allowedByKeySystem=!!y&&!Ky.includes(y));x!=q.allowedByKeySystem&&(m=!0)}}}n=[];if(!p)for(var C in k)Ky.includes(k[C])||n.push(C);a.log.debug("allowedKeyIds",n);a.a.D=n;k=Ex(a.a);p=Fx(a.a);(k=kw(k,p,l.variants))&&!k.allowedByKeySystem&&(a.log.debug("Choosing new streams after key status changed"),
154
+ Ly(a,l));m&&(My(a),Ny(a,l.variants))}},onExpirationUpdated:function(k,l){if(a.B&&a.B.onExpirationUpdated)a.B.onExpirationUpdated(k,l);a.trigger(new _.E(_.Nc,{expirationTime:l}))},onEvent:function(k){return a.$d(k)},getConfiguration:function(){return a.getConfiguration()},Bc:function(){return a.Bc()}});Oy(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.jo(a.f.periods);if(!c){g.H(2);break}f=_.ej(_.Md);if(!f){g.H(2);break}return _.v(g,f.pj(b,e,a.getNetworkEngine()),4);case 4:return _.v(g,f.ji(c),
155
+ 5);case 5:d=g.f;case 2:return _.v(g,_.Nk(a.m,e,d),6);case 6:a.f&&Py(a,a.f.periods),_.w(g)}})};
156
+ az=function(a){var b,c,d,e,f,g,k,l,m,n,p;return _.z(function(q){if(1==q.a)return b=a.h,c=function(r){a.h&&a.D&&(r.type===_.ce&&a.Bd?(a.D.a=Ww,Dy(a)):r.type===_.Qe&&a.getState()===_.Vl&&.1>a.getBufferInfo().xa(a.getPosition())?(a.D.a=Ww,Dy(a)):a.D&&Ry(a));Sy(a)},d=function(){if(a.h){var r=a.h.playbackRate;0!=r&&a.tc.set(r)}},a.j.on(b,_.Qd,c),a.j.on(b,_.Ld,c),a.j.on(b,_.Wc,c),a.j.on(b,_.ce,c),a.j.on(b,_.be,c),a.j.on(b,_.Td,c),a.j.on(b,_.Qe,c),a.j.on(b,_.Vd,d),a.g||(a.g=new _.Iw,a.g.configure(a.configuration.abr)),
157
+ Ty(a,a.f.periods),a.rc=new Rw(a.configuration.preferredAudioLanguage,a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.wa=a.configuration.preferredTextLanguage,a.kb=a.configuration.preferredTextRole,_.v(q,_.$k(a.m,b),2);if(3!=q.a){if(!a.m)throw new _.J(_.K,7,7001);a.g.init(function(r,x,y){!a.T&&Uy(a,r,x,y)});a.w=Vy(a,a.configuration.startTime);a.mc=Wy(a);a.tc=new bx({je:function(){return b.playbackRate},fg:function(r){b.playbackRate=r},xi:function(r){b.currentTime+=
158
+ r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.xd=new Zw(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);Xy(a,e);aw(a.f,_.yh(a.configuration.preferredVideoCodec),_.yh(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=Yy(a);a.a.m=a.configuration.streaming;a.C=ty;return _.v(q,a.a.start(),3)}if(!a.a)throw new _.J(_.K,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=wx(a.w),g=Zy(a,f),px(a.w.g,g));k=_.t(a.f.periods);for(l=
159
+ k.next();!l.done;l=k.next())m=l.value,$y(a,m);My(a);n=Jy(a)||a.f.periods[0];p=n.variants.some(function(r){return r.primary});a.configuration.preferredAudioLanguage||p||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");Ny(a,n.variants);a.j.one(b,_.jd,function(){a.G.o=Date.now()/1E3-(null===a.se?0:a.se)});_.w(q)})};
160
+ Hy=function(a){function b(d){return d.video&&d.audio||d.video&&d.video.codecs.includes(",")}if(a.some(function(d){return d.variants.some(b)})){_.Kf("Found variant with audio and video content, so filtering out audio-only content in all periods.");a=_.t(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c.variants=c.variants.filter(b)}};Vy=function(a,b){return new ux(a.h,a.f,a.configuration.streaming,b,function(){a.mc&&mv(a.mc,!0);a.a&&Ux(a.a)},function(c){return a.dispatchEvent(c)})};
161
+ Wy=function(a){var b=new $w(a.f);ax(b,function(){My(a)});var c=new ov(a.qc);pv(c,function(e){e.Dd&&e.Dd();Fy(a,_.kg,e)},function(e){e.Be&&e.Be();Fy(a,_.lg,e)},function(e,f){f||(e.Dd&&e.Dd(),Fy(a,_.kg,e),e.Be&&e.Be(),Fy(a,_.lg,e))});var d=new nv(a.h);d.a.add(b);d.a.add(c);return d};Xy=function(a,b){a.D=new Xw(b,Math.min(.5,b/2));a.D.a=Ww;Dy(a);a.Ha=(new _.qh(function(){Ry(a)})).Ya(.25)};
162
+ Ry=function(a){switch(a.C){case ty:a:if(a.h.ended||Kv(a.I))var b=!0;else{if(a.f.presentationTimeline.isLive()){b=dv(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.ra(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}c=0;if(a.I){var d=Mv(a.I),e=d.video;d=d.audio;var f=a.h.currentTime;if(e||d)c=e&&d?Math.min(e.xa(f),d.xa(f)):e?e.xa(f):d.xa(f)}if(e=a.D){e=a.D;d=c;f=b;var g=e.f.get(e.a);c=e.a;d=f||d>=g?Vw:Ww;e.a=d;e=c!=d}c=e;e=bz(a);c||a.getState()===_.Ml&&!e?(a.log.debug("Buffering state changed. Is buffering",
163
+ e,"buffered to end",b,"state",a.getState()),Dy(a)):a.Lc&&Sy(a)};Yy=function(a){var b={qb:function(){return wx(a.w)},X:a.I,wb:a.getNetworkEngine(),Ae:a.vh.bind(a),ze:a.uh.bind(a),onError:a.onError.bind(a),Of:a.Ui.bind(a),onEvent:a.$d.bind(a),Tf:a.wh.bind(a),Ed:a.hj.bind(a),fe:function(){return a.g},Xd:a.Fg.bind(a),hg:a.Jj.bind(a)};return new _.Cx(a.f,b)};Oy=function(a){var b=_.xj(a.configuration.drm);a.m.h=b};
164
+ cz=function(a){a.B&&a.B.configure(a.configuration.manifest);a.m&&Oy(a);if(a.a){a.a.m=a.configuration.streaming;try{for(var b=_.t(a.f.periods),c=b.next();!c.done;c=b.next())$y(a,c.value)}catch(e){a.onError(e)}c=Ex(a.a);var d=Fx(a.a);b=Jy(a)||a.f.periods[0];c=kw(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?Ny(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),Ly(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.T?a.g.enable():
165
165
  a.g.disable())};
166
- rw=function(a){if(a.f&&a.w){var b=Wy(a),c=[];a=_.t(Xy(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=d.audio,f=d.video,g=e?e.codecs:null,k=f?f.codecs:null,l=[];k&&l.push(k);g&&l.push(g);var m=f&&f.mimeType||null,n=e&&e.mimeType||null,p=[];e&&p.push(e.kind);f&&p.push(f.kind);p=p[0]||null;var q=new Set,r=new Set;if(e)for(var x=_.t(e.roles),y=x.next();!y.done;y=x.next())r.add(y.value);if(f)for(x=_.t(f.roles),y=x.next();!y.done;y=x.next())q.add(y.value);g={id:d.id,active:!1,type:"variant",
166
+ zw=function(a){if(a.f&&a.w){var b=dz(a),c=[];a=_.t(ez(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=d.audio,f=d.video,g=e?e.codecs:null,k=f?f.codecs:null,l=[];k&&l.push(k);g&&l.push(g);var m=f&&f.mimeType||null,n=e&&e.mimeType||null,p=[];e&&p.push(e.kind);f&&p.push(f.kind);p=p[0]||null;var q=new Set,r=new Set;if(e)for(var x=_.t(e.roles),y=x.next();!y.done;y=x.next())r.add(y.value);if(f)for(x=_.t(f.roles),y=x.next();!y.done;y=x.next())q.add(y.value);g={id:d.id,active:!1,type:"variant",
167
167
  bandwidth:d.bandwidth,language:d.language,label:null,kind:p,width:null,height:null,frameRate:null,mimeType:m,audioMimeType:n,codecs:l.join(", "),audioCodec:g,videoCodec:k,primary:d.primary,roles:Array.from(q),audioRoles:Array.from(r),videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null};f&&(g.videoId=f.id,g.originalVideoId=f.originalId,g.width=f.width||null,g.height=f.height||null,g.frameRate=f.frameRate||
168
- null,g.videoBandwidth=f.bandwidth||null);e&&(g.audioId=e.id,g.originalAudioId=e.originalId,g.channelsCount=e.channelsCount,g.audioBandwidth=e.bandwidth||null,g.label=e.label,g.audioRoles=e.roles);e=g;e.active=d==b;c.push(e)}return c}return[]};pw=function(a,b){if(a.f&&a.a){var c=By(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(Yy(a,c,d,!1),Zy(a,d),a.wa=d.language):a.log.error(_.Gt,b.id)}};
169
- sw=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=By(a);if(a.configuration.abr.enabled&&b)a.log.info("Disable ABR and enable manual track selection to select "+(b.width+"x"+b.height+"@"+b.bandwidth)),a.configuration.abr.enabled=!1,a.g.disable();else if(!a.configuration.abr.enabled&&!b){a.log.info("Enable ABR Selection");a.configuration.abr.enabled=!0;a.g.enable();a.O=null;c=Fy(a,e.variants);null!=a.ga&&(a.sc=a.ga,a.ga=null);null==c||a.T||My(a,c);return}if(b){a.O=b.id;var f=e.variants.find(function(g){return g.id==
170
- b.id});f?(a.O=f.video.id,$v(f)?($y(a,e,f,!1),az(a,f,c,d),null==a.ga&&(a.ga=a.sc),a.sc=new Kw(f),Fy(a,e.variants)):a.log.error("Unable to switch to restricted track",b.id)):a.log.error("No variant with id",b.id)}else a.O=null,null!=a.ga&&(a.sc=a.ga,a.ga=null),c=Fy(a,e.variants),null==c||a.T||My(a,c)}};
171
- qw=function(a,b){if(a.a&&(a.f||a.w)){var c=xx(a.a),d=wx(a.a),e=Lu(a.f.periods,ox(a.w)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id==b&&$v(m)});e=f.find(function(m){return m.video.id==c.id});var g=!1;if(!e){a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId");g=!0;var k=a.getTrackManager().Da();if(k){var l=k.renditions.map(function(m){return m.id});e=f.find(function(m){return l.find(function(n){return n==m.video.id})})}}if(e){if(d.codecs.split(".")[0]===
172
- e.audio.codecs.split(".")[0]){d=e.audio;a.tc=d.id;a.g.setVariants(f);f=By(a);$y(a,f,e,!1);g||a.T?az(a,e,!0,0):_.Dx(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()};uw=function(a){var b=a.re;return a.f?a.I.getTextDisplayer().isTextVisible():b};
173
- ow=function(a,b){var c,d,e,f;return _.z(function(g){c=a.re;d=b;if(c==d)return g["return"]();a.re=d;if(a.C!==ly)return g.H(0);a.I.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.H(0);if(!b){var k=a.a;k.K=!0;var l=k.h.get(_.se);l&&(Kx(l),k.h["delete"](_.se));return g.H(0)}e=By(a);f=_.bw(e.textStreams,a.wa,a.kb);return 0<f.length?_.v(g,Cx(a.a,f[0]),0):g.H(0)})};
174
- $y=function(a,b,c,d){var e=a.getTrackManager();if(e){var f=a.G.w;if(c.video){xw(e,c.video,d);var g=e.fa();f.h!==g&&(f.h=g,f.a.push({timestamp:Date.now()/1E3,id:g.id,trackId:g.track.id,type:g.track.type,fromAdaptation:d,width:g.width,height:g.height,bandwidth:g.bandwidth}))}c.audio&&(xw(e,c.audio,d),e=e.Aa(),f.f!==e&&(f.f=e,f.a.push({timestamp:Date.now()/1E3,id:e.id,trackId:e.track.id,type:e.track.type,fromAdaptation:d,width:null,height:null,bandwidth:e.bandwidth})))}Ew(a.L,b).variant=c};
175
- Yy=function(a,b,c,d){Ew(a.L,b).text=c;if(b=a.getTrackManager())xw(b,c,d),c=b.Ca(),a=a.G.w,a.g!==c&&(a.g=c,a.a.push({timestamp:Date.now()/1E3,id:c.id,trackId:c.track.id,type:c.track.type,fromAdaptation:d,width:null,height:null,bandwidth:null}))};
176
- Ly=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.t(d.variants),g=f.next();!g.done;g=f.next())if(g=g.value,g.video&&g.video.closedCaptions){g=g.video;for(var k=_.t(g.closedCaptions.keys()),l=k.next();!l.done;l=k.next())if(l=l.value,!e.has(l)){var m={id:a.ig++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,xb:0,mimeType:_.Qb,codecs:"",kind:"caption",
177
- encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.se,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(l,m)}}e=_.t(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
178
- Hy=function(a,b){for(var c=a.a?wx(a.a):null,d=a.a?xx(a.a):null,e=_.t(b),f=e.next();!f.done;f=e.next())Yv(a.m,c,d,f.value);c=ju(b,function(g){return g.variants.some($v)});if(0==c)throw new _.J(_.K,4,4032);if(c<b.length)throw new _.J(_.K,4,4011);c=_.t(b);for(d=c.next();!d.done;d=c.next())d=d.value,Vv(d.variants,a.configuration.restrictions,a.eg)&&a.a&&By(a)==d&&Ey(a),bz(a,d.variants)};
179
- Sy=function(a,b){var c=a.a?wx(a.a):null,d=a.a?xx(a.a):null;Yv(a.m,c,d,b);d=b.variants;if(!d.some($v))throw new _.J(_.K,4,4011);bz(a,b.variants);Vv(d,a.configuration.restrictions,a.eg)&&a.a&&By(a)==b&&Ey(a);if(!_.fi(2)&&(c=a.m?a.m.getDrmInfo():null)){d=_.t(d);for(var e=d.next();!e.done;e=d.next()){e=_.t(e.value.drmInfos);for(var f=e.next();!f.done;f=e.next())if(f=f.value,f.keySystem==c.keySystem){f=_.t(f.initData||[]);for(var g=f.next();!g.done;g=f.next())g=g.value,_.Nk(a.m,g.initDataType,g.initData)}}}};
180
- az=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.T?(a.ca=b,a.ag=c,a.$f=d):Ex(a.a,b,c,d)};Zy=function(a,b){a.T?a.Y=b:_.Dx(a.a,b,!0,0)};cz=function(a){if(a.a&&a.f){var b=a.a;var c=b.h.get(_.He);b=c?b.g.periods[c.vb]:(c=b.h.get(_.Zb))?b.g.periods[c.vb]:null;c=By(a);null!=b&&b==c&&(wx(a.a),xx(a.a),_.vx(a.a,_.se),Ew(a.L,c),Ew(a.L,c))}};
181
- Ry=function(a,b){function c(g,k){if(!g)return null;var l=g.findSegmentPosition(k-f.startTime);return null==l?null:(l=g.getSegmentReference(l))?l.startTime+f.startTime:null}var d=wx(a.a),e=xx(a.a),f=By(a);d=c(d,b);e=c(e,b);return null!=e&&null!=d?Math.max(e,d):null!=e?e:null!=d?d:b};Uy=function(a){return a.m&&a.m.C?!0:a.D?a.D.getState()===Ow:!1};vy=function(a){if(a.G&&a.D&&a.w){var b=dz(a)===_.El,c=a.uc;c.h=b;Vw(c);a.w.j.m=b;Ky(a)}};Ky=function(a){oy(a,dz(a))};
182
- dz=function(a){var b=a.getDuration(),c=a.getPosition();return a.h&&a.h.ended||(a.Lc||a.aa===_.Gl)&&1>=Math.abs(b-c)?_.Gl:Uy(a)||a.Bd?_.El:a.h&&a.h.paused?_.Ml:_.Nl};
183
- Fy=function(a,b){try{bz(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return $v(e)});c=gw(c,a.tc);var d=a.sc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.O&&null!==a.tc&&(d=d.find(function(e){return e.video.id==a.O&&e.audio.id==a.tc}),a.O=null,d))return d;if(a.configuration.abr.enabled||null===a.O)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.O});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
184
- a.g.chooseVariant())};Dy=function(a,b){var c=Fy(a,b.variants);a.tc=c&&c.audio&&c.audio.id;c&&($y(a,b,c,!0),az(a,c,!0));(c=_.bw(b.textStreams,a.wa,a.kb)[0]||null)&&(a.configuration.streaming.alwaysStreamText||uw(a))&&(Yy(a,b,c,!0),Zy(a,c))};
185
- gz=function(a,b){a.T=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=Fy(a,b.variants),d=_.bw(b.textStreams,a.wa,a.kb)[0]||null;a.ca&&(b.variants.includes(a.ca)&&(c=a.ca),a.ca=null);a.Y&&(b.textStreams.includes(a.Y)&&(d=a.Y),a.Y=null);c&&ez(a,b,function(){return $y(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||uw(a))&&ez(a,b,function(){return Yy(a,b,d,!0)});b===By(a)&&fz(a);return a.configuration.streaming.alwaysStreamText||uw(a)?{variant:c,text:d}:{variant:c,
186
- text:null}};My=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;if(a.configuration.abr.enabled){a.log.debug("switch_");var e=hz(a,b);ez(a,e,function(){return $y(a,e,b,!0)});e===By(a)&&fz(a);a.a&&Ex(a.a,b,c,d)}};Ey=function(a){var b=a.getTrackManager();b&&a.C!==py&&(b.l&&(ww(b),b.l.trigger(new _.E(_.dp))),fz(a))};fz=function(a){var b=By(a);if(b){var c=a.vc.get(b)||[];for(a.vc["delete"](b);c.length;)c.shift()()}};ez=function(a,b,c){a.vc.has(b)||a.vc.set(b,[]);a.vc.get(b).push(c)};
187
- xy=function(a,b,c){a.trigger(new _.E(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
188
- bz=function(a,b){var c=a.m?_.H.Ze(a.m.ga):{},d=Object.keys(c);d=d.length&&"00"==d[0];for(var e=!1,f=!1,g=[],k=[],l=_.t(b),m=l.next();!m.done;m=l.next()){m=m.value;var n=[];m.audio&&n.push(m.audio);m.video&&n.push(m.video);n=_.t(n);for(var p=n.next();!p.done;p=n.next())if(p=p.value,p.keyId){var q=c[d?"00":p.keyId];q?Cy.includes(q)&&(k.includes(q)||k.push(q)):g.includes(p.keyId)||g.push(p.keyId)}m.allowedByApplication?m.allowedByKeySystem&&(e=!0):f=!0}if(!e)throw new _.J(_.K,4,4012,{hasAppRestrictions:f,
189
- missingKeys:g,restrictedKeyStatuses:k});};Xy=function(a){var b=By(a);if(null==b)return[];cz(a);return b.variants.filter(function(c){return $v(c)})};iz=function(a){var b=By(a);if(null==b)return[];cz(a);return b.textStreams.filter(function(c){return!a.yd.has(c)})};By=function(a){var b=ox(a.w),c=null;a=_.t(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c};Wy=function(a){var b=By(a);return b&&Ew(a.L,b).variant};
190
- hz=function(a,b){for(var c=_.t(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.includes(b))return d;return null};
191
- jz=function(a,b,c){var d,e,f,g,k,l,m,n,p,q,r,x,y,C,I,F,G,M,O;return _.z(function(T){switch(T.a){case 1:return d=_.Yl,_.qf(T,2),_.v(T,_.io(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type),4);case 4:return e=T.f,e.configure(a.configuration.manifest),_.v(T,e.start(b.url,yy(a)),5);case 5:f=T.f;zy(f.periods);if(!f.periods.length)throw new _.J(_.K,4,4014);return _.v(T,a.B.stop(),6);case 6:a.B=e;g=c.audio&&c.audio.id;k=c.video&&c.video.id;a.f.periods=f.periods;l=Lu(f.periods,
192
- ox(a.w))||f.periods[0];Tv(a.f,_.wh(a.configuration.preferredVideoCodec),_.wh(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=hw(g,k,l.variants);n=_.bw(l.textStreams,a.wa,a.kb)[0]||null;Fy(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];x=new Set;y=_.t(l.variants);for(C=y.next();!C.done;C=y.next())I=C.value,I.video&&x.add(I.video),I.audio&&x.add(I.audio);F=_.t(_.af(x).concat(_.af(l.textStreams)));for(G=F.next();!G.done;G=F.next())M=G.value,r.push(M.createSegmentIndex());
193
- return _.v(T,Promise.all(r),7);case 7:jy(a.a,d.AUDIO,q);jy(a.a,d.VIDEO,p);jy(a.a,d.TEXT,n);m&&$y(a,l,m,!1);a.log.info("Switch CDN successful.");_.rf(T,0);break;case 2:O=_.sf(T);if(!e){T.H(8);break}return _.v(T,e.stop(),8);case 8:throw O;}})};
194
- yy=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return Sy(a,b)},filterAllPeriods:function(b){return Hy(a,b)},onTimelineCueAdded:function(b){var c=a.rc;a:{var d=_.t(c.a);for(var e=d.next();!e.done;e=d.next())if(e=e.value,e.schemeIdUri===b.schemeIdUri&&e.startTime===b.startTime&&e.endTime===b.endTime){d=e;break a}d=null}null==d&&(c.a.add(b),c.f(b))},onEvent:function(b){return a.$d(b)},onError:function(b){return a.onError(b)}}};kz=function(){};
195
- lz=function(){var a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];c=a.apply(this,c);c.abort=function(){};return c}};mz=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};nz=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
196
- oz=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.gu(b)[0]&&a(b)}};
197
- pz=function(){var a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(c){var d=c.split(/ *; */),e=d.shift(),f={};d=_.t(d);for(var g=d.next();!g.done;g=d.next())g=g.value.split("\x3d"),f[g[0]]=g[1].replace(/"(.*)"/,"$1");d=f.codecs;if(!d)return a(c);var k=!1,l=!1;c=d.split(",").filter(function(n){b.test(n)&&(l=!0);/^(hev|hvc)1\.2/.test(n)&&(k=!0);return!0});l&&(k=!1);f.codecs=c.join(",");k&&(f.eotf="smpte2084");for(var m in f)e+="; "+m+'\x3d"'+f[m]+'"';return cast.__platform__.canDisplayType(e)}};
198
- qz=function(a){_.Ro.call(this,a);a=a.getSurface().getMedia();this.a=null;for(var b=0;b<a.textTracks.length;++b){var c=a.textTracks[b];c.mode=_.Kc;c.label===It&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.Ut,It));this.a.mode=_.$c};rz=function(a,b){var c=a.mode;a.mode=c==_.de?_.de:_.$c;for(var d=a.cues,e=d.length-1;0<=e;e--){var f=d[e];f&&b(f)&&a.removeCue(f)}a.mode=c};sz=function(){};
199
- _.uz=function tz(a){var c,d,e,f,g,k;return _.yf(tz,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.t(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.H(0):_.v(l,{me:c,rj:d,item:e,next:void 0},0);k=g.value;return 0<=c?_.v(l,{me:c,item:e,rj:d,next:k},5):l.H(5)}c++;d=e;e=k;g=f.next();return l.H(2)})};_.qu.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.$d,this.g),this.h&&this.a.off(_.ve,this.g)),this.a=null);a&&(this.a=a,this.a.on(_.$d,this.g,this))};
200
- _.qu.prototype.append=function(a,b,c){var d=this.m?this.m(c):null;d||this.log.debug("Unable to resolve rendition for id",c);c={start:a,end:b,rendition:d,width:d?d.width:0,height:d?d.height:0,bandwidth:d?d.bandwidth:0};var e=this.f.find(function(f){return f.start>=a&&f.end<=b});if(e)e.rendition=d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{d=_.t(this.f);for(e=d.next();!e.done;e=d.next())e=e.value,a>=e.start&&a<e.end?e.end=a:b>=e.start&&b<e.end&&(e.start=
201
- b);this.f.push(c);this.f.sort(pu)}tu(this);this.g();this.a&&this.a.trigger(new _.E(_.Ke))};_.qu.prototype.clear=function(){this.f=[];tu(this);this.a&&(this.a.trigger(new _.E(_.Ke)),this.a.trigger(new _.E(_.dc)))};
202
- _.qu.prototype.g=function(){if(this.a){var a=this.a.getPosition();if(0<=a){a:{for(var b=this.f.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.f[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.f[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.f[0].rendition:null}if(a&&this.j!==a&&(this.j=a,this.a)){c=b=-1;if(a)b=a.width||-1,c=a.height||-1;else if(d=this.a.getSurface().getMedia())b=d.videoWidth,c=d.videoHeight;this.a.trigger(new _.E(_.fc,
203
- {detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};var Ju=[154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149],Du=[237,239,139,169,121,214,74,206,163,200,39,220,213,29,33,237],Au=[112,115,115,104,0,0,0,0];_.u(Cu,zu);_.u(Gu,zu);_.Qu.prototype.a=function(){return this.keyInfo};_.Ru.prototype.getPosition=function(){return this.position};_.Ru.prototype.a=function(){return this.keyInfo};_.h=_.Su.prototype;_.h.getDuration=function(){return this.h};
204
- _.h.Pb=function(a){this.h=a};_.h.getPresentationStartTime=function(){return this.m};_.h.dc=function(){return this.B};_.h.offset=function(a){null!=this.j&&(this.j+=a);null!=this.g&&(this.g+=a)};_.h.isLive=function(){return Infinity==this.h&&!this.f};$u.prototype.release=function(){this.f=function(){};this.a.clear()};$u.prototype.cues=function(){return this.a};_.h=_.bv.prototype;_.h.destroy=function(){this.a=[];return Promise.resolve()};
168
+ null,g.videoBandwidth=f.bandwidth||null);e&&(g.audioId=e.id,g.originalAudioId=e.originalId,g.channelsCount=e.channelsCount,g.audioBandwidth=e.bandwidth||null,g.label=e.label,g.audioRoles=e.roles);e=g;e.active=d==b;c.push(e)}return c}return[]};xw=function(a,b){if(a.f&&a.a){var c=Jy(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(fz(a,c,d,!1),gz(a,d),a.wa=d.language):a.log.error(_.Pt,b.id)}};
169
+ Aw=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=Jy(a);if(a.configuration.abr.enabled&&b)a.log.info("Disable ABR and enable manual track selection to select "+(b.width+"x"+b.height+"@"+b.bandwidth)),a.configuration.abr.enabled=!1,a.g.disable();else if(!a.configuration.abr.enabled&&!b){a.log.info("Enable ABR Selection");a.configuration.abr.enabled=!0;a.g.enable();a.O=null;c=Ny(a,e.variants);null!=a.ga&&(a.rc=a.ga,a.ga=null);null==c||a.T||Uy(a,c);return}if(b){a.O=b.id;var f=e.variants.find(function(g){return g.id==
170
+ b.id});f?(a.O=f.video.id,hw(f)?(hz(a,e,f,!1),iz(a,f,c,d),null==a.ga&&(a.ga=a.rc),a.rc=new Sw(f),Ny(a,e.variants)):a.log.error("Unable to switch to restricted track",b.id)):a.log.error("No variant with id",b.id)}else a.O=null,null!=a.ga&&(a.rc=a.ga,a.ga=null),c=Ny(a,e.variants),null==c||a.T||Uy(a,c)}};
171
+ yw=function(a,b){if(a.a&&(a.f||a.w)){var c=Fx(a.a),d=Ex(a.a),e=Tu(a.f.periods,wx(a.w)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id==b&&hw(m)});e=f.find(function(m){return m.video.id==c.id});var g=!1;if(!e){a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId");g=!0;var k=a.getTrackManager().Da();if(k){var l=k.renditions.map(function(m){return m.id});e=f.find(function(m){return l.find(function(n){return n==m.video.id})})}}if(e){if(d.codecs.split(".")[0]===
172
+ e.audio.codecs.split(".")[0]){d=e.audio;a.sc=d.id;a.g.setVariants(f);f=Jy(a);hz(a,f,e,!1);g||a.T?iz(a,e,!0,0):_.Lx(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()};Cw=function(a){var b=a.re;return a.f?a.I.getTextDisplayer().isTextVisible():b};
173
+ ww=function(a,b){var c,d,e,f;return _.z(function(g){c=a.re;d=b;if(c==d)return g["return"]();a.re=d;if(a.C!==ty)return g.H(0);a.I.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.H(0);if(!b){var k=a.a;k.K=!0;var l=k.h.get(_.te);l&&(Sx(l),k.h["delete"](_.te));return g.H(0)}e=Jy(a);f=_.jw(e.textStreams,a.wa,a.kb);return 0<f.length?_.v(g,Kx(a.a,f[0]),0):g.H(0)})};
174
+ hz=function(a,b,c,d){var e=a.getTrackManager();if(e){var f=a.G.w;if(c.video){Fw(e,c.video,d);var g=e.fa();f.h!==g&&(f.h=g,f.a.push({timestamp:Date.now()/1E3,id:g.id,trackId:g.track.id,type:g.track.type,fromAdaptation:d,width:g.width,height:g.height,bandwidth:g.bandwidth}))}c.audio&&(Fw(e,c.audio,d),e=e.Aa(),f.f!==e&&(f.f=e,f.a.push({timestamp:Date.now()/1E3,id:e.id,trackId:e.track.id,type:e.track.type,fromAdaptation:d,width:null,height:null,bandwidth:e.bandwidth})))}Mw(a.M,b).variant=c};
175
+ fz=function(a,b,c,d){Mw(a.M,b).text=c;if(b=a.getTrackManager())Fw(b,c,d),c=b.Ca(),a=a.G.w,a.g!==c&&(a.g=c,a.a.push({timestamp:Date.now()/1E3,id:c.id,trackId:c.track.id,type:c.track.type,fromAdaptation:d,width:null,height:null,bandwidth:null}))};
176
+ Ty=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.t(d.variants),g=f.next();!g.done;g=f.next())if(g=g.value,g.video&&g.video.closedCaptions){g=g.video;for(var k=_.t(g.closedCaptions.keys()),l=k.next();!l.done;l=k.next())if(l=l.value,!e.has(l)){var m={id:a.ig++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,xb:0,mimeType:_.Rb,codecs:"",kind:"caption",
177
+ encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.te,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(l,m)}}e=_.t(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
178
+ Py=function(a,b){for(var c=a.a?Ex(a.a):null,d=a.a?Fx(a.a):null,e=_.t(b),f=e.next();!f.done;f=e.next())fw(a.m,c,d,f.value);c=ru(b,function(g){return g.variants.some(hw)});if(0==c)throw new _.J(_.K,4,4032);if(c<b.length)throw new _.J(_.K,4,4011);c=_.t(b);for(d=c.next();!d.done;d=c.next())d=d.value,cw(d.variants,a.configuration.restrictions,a.eg)&&a.a&&Jy(a)==d&&My(a),jz(a,d.variants)};
179
+ $y=function(a,b){var c=a.a?Ex(a.a):null,d=a.a?Fx(a.a):null;fw(a.m,c,d,b);d=b.variants;if(!d.some(hw))throw new _.J(_.K,4,4011);jz(a,b.variants);cw(d,a.configuration.restrictions,a.eg)&&a.a&&Jy(a)==b&&My(a);if(!_.hi(2)&&(c=a.m?a.m.getDrmInfo():null)){d=_.t(d);for(var e=d.next();!e.done;e=d.next()){e=_.t(e.value.drmInfos);for(var f=e.next();!f.done;f=e.next())if(f=f.value,f.keySystem==c.keySystem){f=_.t(f.initData||[]);for(var g=f.next();!g.done;g=f.next())g=g.value,_.Uk(a.m,g.initDataType,g.initData)}}}};
180
+ iz=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.T?(a.ca=b,a.ag=c,a.$f=d):Mx(a.a,b,c,d)};gz=function(a,b){a.T?a.Y=b:_.Lx(a.a,b,!0,0)};kz=function(a){if(a.a&&a.f){var b=a.a;var c=b.h.get(_.Ie);b=c?b.g.periods[c.vb]:(c=b.h.get(_.$b))?b.g.periods[c.vb]:null;c=Jy(a);null!=b&&b==c&&(Ex(a.a),Fx(a.a),_.Dx(a.a,_.te),Mw(a.M,c),Mw(a.M,c))}};
181
+ Zy=function(a,b){function c(g,k){if(!g)return null;var l=g.findSegmentPosition(k-f.startTime);return null==l?null:(l=g.getSegmentReference(l))?l.startTime+f.startTime:null}var d=Ex(a.a),e=Fx(a.a),f=Jy(a);d=c(d,b);e=c(e,b);return null!=e&&null!=d?Math.max(e,d):null!=e?e:null!=d?d:b};bz=function(a){return a.m&&a.m.C?!0:a.D?a.D.getState()===Ww:!1};Dy=function(a){if(a.G&&a.D&&a.w){var b=lz(a)===_.Ml,c=a.tc;c.h=b;cx(c);a.w.j.m=b;Sy(a)}};Sy=function(a){wy(a,lz(a))};
182
+ lz=function(a){var b=a.getDuration(),c=a.getPosition();return a.h&&a.h.ended||(a.Lc||a.aa===_.Ol)&&1>=Math.abs(b-c)?_.Ol:bz(a)||a.Bd?_.Ml:a.h&&a.h.paused?_.Ul:_.Vl};
183
+ Ny=function(a,b){try{jz(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return hw(e)});c=ow(c,a.sc);var d=a.rc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.O&&null!==a.sc&&(d=d.find(function(e){return e.video.id==a.O&&e.audio.id==a.sc}),a.O=null,d))return d;if(a.configuration.abr.enabled||null===a.O)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.O});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
184
+ a.g.chooseVariant())};Ly=function(a,b){var c=Ny(a,b.variants);a.sc=c&&c.audio&&c.audio.id;c&&(hz(a,b,c,!0),iz(a,c,!0));(c=_.jw(b.textStreams,a.wa,a.kb)[0]||null)&&(a.configuration.streaming.alwaysStreamText||Cw(a))&&(fz(a,b,c,!0),gz(a,c))};
185
+ oz=function(a,b){a.T=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=Ny(a,b.variants),d=_.jw(b.textStreams,a.wa,a.kb)[0]||null;a.ca&&(b.variants.includes(a.ca)&&(c=a.ca),a.ca=null);a.Y&&(b.textStreams.includes(a.Y)&&(d=a.Y),a.Y=null);c&&mz(a,b,function(){return hz(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||Cw(a))&&mz(a,b,function(){return fz(a,b,d,!0)});b===Jy(a)&&nz(a);return a.configuration.streaming.alwaysStreamText||Cw(a)?{variant:c,text:d}:{variant:c,
186
+ text:null}};Uy=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;if(a.configuration.abr.enabled){a.log.debug("switch_");var e=pz(a,b);mz(a,e,function(){return hz(a,e,b,!0)});e===Jy(a)&&nz(a);a.a&&Mx(a.a,b,c,d)}};My=function(a){var b=a.getTrackManager();b&&a.C!==xy&&(b.l&&(Ew(b),b.l.trigger(new _.E(_.lp))),nz(a))};nz=function(a){var b=Jy(a);if(b){var c=a.uc.get(b)||[];for(a.uc["delete"](b);c.length;)c.shift()()}};mz=function(a,b,c){a.uc.has(b)||a.uc.set(b,[]);a.uc.get(b).push(c)};
187
+ Fy=function(a,b,c){a.trigger(new _.E(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
188
+ jz=function(a,b){var c=a.m?_.H.Ze(a.m.ga):{},d=Object.keys(c);d=d.length&&"00"==d[0];for(var e=!1,f=!1,g=[],k=[],l=_.t(b),m=l.next();!m.done;m=l.next()){m=m.value;var n=[];m.audio&&n.push(m.audio);m.video&&n.push(m.video);n=_.t(n);for(var p=n.next();!p.done;p=n.next())if(p=p.value,p.keyId){var q=c[d?"00":p.keyId];q?Ky.includes(q)&&(k.includes(q)||k.push(q)):g.includes(p.keyId)||g.push(p.keyId)}m.allowedByApplication?m.allowedByKeySystem&&(e=!0):f=!0}if(!e)throw new _.J(_.K,4,4012,{hasAppRestrictions:f,
189
+ missingKeys:g,restrictedKeyStatuses:k});};ez=function(a){var b=Jy(a);if(null==b)return[];kz(a);return b.variants.filter(function(c){return hw(c)})};qz=function(a){var b=Jy(a);if(null==b)return[];kz(a);return b.textStreams.filter(function(c){return!a.yd.has(c)})};Jy=function(a){var b=wx(a.w),c=null;a=_.t(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c};dz=function(a){var b=Jy(a);return b&&Mw(a.M,b).variant};
190
+ pz=function(a,b){for(var c=_.t(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.includes(b))return d;return null};
191
+ rz=function(a,b,c){var d,e,f,g,k,l,m,n,p,q,r,x,y,C,I,F,G,M,O;return _.z(function(T){switch(T.a){case 1:return d=_.fm,_.rf(T,2),_.v(T,_.qo(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type),4);case 4:return e=T.f,e.configure(a.configuration.manifest),_.v(T,e.start(b.url,Gy(a)),5);case 5:f=T.f;Hy(f.periods);if(!f.periods.length)throw new _.J(_.K,4,4014);return _.v(T,a.B.stop(),6);case 6:a.B=e;g=c.audio&&c.audio.id;k=c.video&&c.video.id;a.f.periods=f.periods;l=Tu(f.periods,
192
+ wx(a.w))||f.periods[0];aw(a.f,_.yh(a.configuration.preferredVideoCodec),_.yh(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=pw(g,k,l.variants);n=_.jw(l.textStreams,a.wa,a.kb)[0]||null;Ny(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];x=new Set;y=_.t(l.variants);for(C=y.next();!C.done;C=y.next())I=C.value,I.video&&x.add(I.video),I.audio&&x.add(I.audio);F=_.t(_.df(x).concat(_.df(l.textStreams)));for(G=F.next();!G.done;G=F.next())M=G.value,r.push(M.createSegmentIndex());
193
+ return _.v(T,Promise.all(r),7);case 7:ry(a.a,d.AUDIO,q);ry(a.a,d.VIDEO,p);ry(a.a,d.TEXT,n);m&&hz(a,l,m,!1);a.log.info("Switch CDN successful.");_.sf(T,0);break;case 2:O=_.tf(T);if(!e){T.H(8);break}return _.v(T,e.stop(),8);case 8:throw O;}})};
194
+ Gy=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return $y(a,b)},filterAllPeriods:function(b){return Py(a,b)},onTimelineCueAdded:function(b){var c=a.qc;a:{var d=_.t(c.a);for(var e=d.next();!e.done;e=d.next())if(e=e.value,e.schemeIdUri===b.schemeIdUri&&e.startTime===b.startTime&&e.endTime===b.endTime){d=e;break a}d=null}null==d&&(c.a.add(b),c.f(b))},onEvent:function(b){return a.$d(b)},onError:function(b){return a.onError(b)}}};sz=function(){};
195
+ tz=function(){var a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];c=a.apply(this,c);c.abort=function(){};return c}};uz=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};vz=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
196
+ wz=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.ou(b)[0]&&a(b)}};
197
+ xz=function(){var a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(c){var d=c.split(/ *; */),e=d.shift(),f={};d=_.t(d);for(var g=d.next();!g.done;g=d.next())g=g.value.split("\x3d"),f[g[0]]=g[1].replace(/"(.*)"/,"$1");d=f.codecs;if(!d)return a(c);var k=!1,l=!1;c=d.split(",").filter(function(n){b.test(n)&&(l=!0);/^(hev|hvc)1\.2/.test(n)&&(k=!0);return!0});l&&(k=!1);f.codecs=c.join(",");k&&(f.eotf="smpte2084");for(var m in f)e+="; "+m+'\x3d"'+f[m]+'"';return cast.__platform__.canDisplayType(e)}};
198
+ yz=function(a){_.Zo.call(this,a);a=a.getSurface().getMedia();this.a=null;for(var b=0;b<a.textTracks.length;++b){var c=a.textTracks[b];c.mode=_.Lc;c.label===Rt&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.cu,Rt));this.a.mode=_.ad};zz=function(a,b){var c=a.mode;a.mode=c==_.de?_.de:_.ad;for(var d=a.cues,e=d.length-1;0<=e;e--){var f=d[e];f&&b(f)&&a.removeCue(f)}a.mode=c};Az=function(){};
199
+ _.Cz=function Bz(a){var c,d,e,f,g,k;return _.zf(Bz,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.t(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.H(0):_.v(l,{me:c,rj:d,item:e,next:void 0},0);k=g.value;return 0<=c?_.v(l,{me:c,item:e,rj:d,next:k},5):l.H(5)}c++;d=e;e=k;g=f.next();return l.H(2)})};_.yu.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.$d,this.g),this.h&&this.a.off(_.we,this.g)),this.a=null);a&&(this.a=a,this.a.on(_.$d,this.g,this))};
200
+ _.yu.prototype.append=function(a,b,c){var d=this.m?this.m(c):null;d||this.log.debug("Unable to resolve rendition for id",c);c={start:a,end:b,rendition:d,width:d?d.width:0,height:d?d.height:0,bandwidth:d?d.bandwidth:0};var e=this.f.find(function(f){return f.start>=a&&f.end<=b});if(e)e.rendition=d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{d=_.t(this.f);for(e=d.next();!e.done;e=d.next())e=e.value,a>=e.start&&a<e.end?e.end=a:b>=e.start&&b<e.end&&(e.start=
201
+ b);this.f.push(c);this.f.sort(xu)}Bu(this);this.g();this.a&&this.a.trigger(new _.E(_.Le))};_.yu.prototype.clear=function(){this.f=[];Bu(this);this.a&&(this.a.trigger(new _.E(_.Le)),this.a.trigger(new _.E(_.ec)))};
202
+ _.yu.prototype.g=function(){if(this.a){var a=this.a.getPosition();if(0<=a){a:{for(var b=this.f.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.f[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.f[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.f[0].rendition:null}if(a&&this.j!==a&&(this.j=a,this.a)){c=b=-1;if(a)b=a.width||-1,c=a.height||-1;else if(d=this.a.getSurface().getMedia())b=d.videoWidth,c=d.videoHeight;this.a.trigger(new _.E(_.hc,
203
+ {detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};var Ru=[154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149],Lu=[237,239,139,169,121,214,74,206,163,200,39,220,213,29,33,237],Iu=[112,115,115,104,0,0,0,0];_.u(Ku,Hu);_.u(Ou,Hu);_.Yu.prototype.a=function(){return this.keyInfo};_.Zu.prototype.getPosition=function(){return this.position};_.Zu.prototype.a=function(){return this.keyInfo};_.h=_.$u.prototype;_.h.getDuration=function(){return this.g};
204
+ _.h.Pb=function(a){this.g=a};_.h.getPresentationStartTime=function(){return this.m};_.h.cc=function(){return this.B};_.h.offset=function(a){null!=this.j&&(this.j+=a);null!=this.h&&(this.h+=a)};_.h.isLive=function(){return Infinity==this.g&&!this.f};hv.prototype.release=function(){this.f=function(){};this.a.clear()};hv.prototype.cues=function(){return this.a};_.h=_.jv.prototype;_.h.destroy=function(){this.a=[];return Promise.resolve()};
205
205
  _.h.Qc=function(a){for(var b=this.a.length-1;0<=b;--b){var c=this.a[b];if(a>=c.startTime&&a<c.endTime)return c.position}if(this.a.length&&a<this.a[0].startTime)return this.a[0].position;this.f.warn("No Segment found for "+a+". We have "+this.a.length+" references");for(a=0;a<this.a.length;a++)b=this.a[a],this.f.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+b.position);return null};
206
206
  _.h.get=function(a){if(0==this.a.length)return null;a-=this.a[0].position;return 0>a||a>=this.a.length?null:this.a[a]};_.h.offset=function(a){this.f.info("Apply offset"+a+" to segment index");for(var b=_.t(this.a),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.xb-=a};
207
207
  _.h.Kc=function(a,b){var c=a-this.a[0].position;if(0<=c&&c<this.a.length)for(this.f.warn("Accounting for segment duration drift",b,"at",c),this.a[c].endTime+=b,c+=1;c<this.a.length;++c)this.a[c].startTime+=b,this.a[c].endTime+=b};_.h.getDuration=function(){return this.a[this.a.length-1].endTime-this.a[0].startTime};
208
- _.h.Sa=function(a){for(var b=[],c=[],d=0,e=0;d<this.a.length&&e<a.length;){var f=this.a[d],g=a[e];f.startTime<g.startTime?(b.push(f),d++):(f.startTime>g.startTime?0===d?c.push(g):this.f.warn("Refusing to rewrite original references on update!"):(.1<Math.abs(f.endTime-g.endTime)?(f=new _.Ru(f.position,g.startTime,g.endTime,g.Ra,g.Ka,g.za,g.xb,g.keyInfo,g.Wb,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile),b.push(f)):b.push(f),d++),e++)}for(;d<this.a.length;)b.push(this.a[d++]);if(b.length)for(d=
209
- b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.Ru(d++,f.startTime,f.endTime,f.Ra,f.Ka,f.za,f.xb,f.keyInfo,f.Wb,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile),b.push(f);else b=a;a=b;if(c.length&&b.length){a=[];e=b[0].position;d=c.length;c=_.t(c);for(f=c.next();!f.done;f=c.next())f=f.value,a.push(new _.Ru(e-d--,f.startTime,f.endTime,f.Ra,f.Ka,f.za,f.xb,f.keyInfo,f.Wb,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile));b=_.t(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=
210
- a};_.h.replace=function(a){this.a=a};fv.prototype.release=function(){this.g.stop();for(var a=_.t(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};gv.prototype.release=function(){this.j=null;this.h.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
211
- gv.prototype.m=function(a,b){for(var c={},d=_.t(this.j.cues()),e=d.next();!e.done;c={Qd:c.Qd,ed:c.ed},e=d.next()){e=e.value;c.Qd=this.h.get(e)||null;c.ed=a<e.startTime?1:a>e.endTime?3:2;this.h.set(e,c.ed);var f=this.o.find(function(g){return function(k){return k.mc===g.Qd&&k.lc===g.ed}}(c));f&&f.$b(e,b)}};_.h=kv.prototype;_.h.destroy=function(){this.g=this.o=null;this.m.clear();return Promise.resolve()};
212
- _.h.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.g||!c.g.remove(a,b)||null==c.a||b<=c.a||a>=c.f||(a<=c.a&&b>=c.f?c.a=c.f=null:a<=c.a&&b<c.f?c.a=b:a>c.a&&b>=c.f&&(c.f=a))})};_.h.lb=function(){return this.a};_.h.ra=function(){return this.f};_.h.bc=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.h.xa=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
213
- pv.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.Q(a);this.j=b.videoTrackIds(a);this.h=b.timescale(a);this.a.init()};pv.prototype.g=function(a,b){var c=_.Q(a);(c=this.a.parse(c,this.j,this.h))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};pv.prototype.f=function(){this.a.resetCaptionStream()};_.qv.prototype.init=function(){};_.qv.prototype.g=function(){};_.qv.prototype.f=function(){};rv.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};rv.prototype.w=function(a){this.g=a.captions;var b=new Uint8Array(a.data.byteLength+a.initSegment.byteLength);b.set(a.initSegment,0);b.set(a.data,a.initSegment.byteLength);a.type===_.He?this.m.push(b):a.type===_.Zb&&this.j.push(b)};rv.prototype.o=function(){var a={video:_.kj.apply(_.dj,_.af(this.m)),captions:this.g,audio:_.kj.apply(_.dj,_.af(this.j))};this.f.resolve(a);this.h=!1};_.h=_.xv.prototype;
214
- _.h.destroy=function(){var a=this;this.I=!0;var b=[],c;for(c in this.h){var d=this.h[c],e=d[0];this.h[c]=d.slice(0,1);e&&b.push(e.p["catch"](mu));for(e=1;e<d.length;++e)d[e].p["catch"](mu),d[e].p.reject()}this.g&&b.push(this.g.destroy());this.A&&b.push(this.A.destroy());for(var f in this.w)b.push(this.w[f].destroy());return Promise.all(b).then(function(){a.o&&(a.o.release(),a.o=null);a.j&&(a.j.removeAttribute("src"),a.j.load(),a.j=null);a.m=null;a.g=null;a.A=null;a.f={};a.w={};a.C={};a.D=null;a.J=
208
+ _.h.Sa=function(a){for(var b=[],c=[],d=0,e=0;d<this.a.length&&e<a.length;){var f=this.a[d],g=a[e];f.startTime<g.startTime?(b.push(f),d++):(f.startTime>g.startTime?0===d?c.push(g):this.f.info("Refusing to rewrite original references on update!"):(.1<Math.abs(f.endTime-g.endTime)?(f=new _.Zu(f.position,g.startTime,g.endTime,g.Ra,g.La,g.za,g.xb,g.keyInfo,g.Vb,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile),b.push(f)):b.push(f),d++),e++)}for(;d<this.a.length;)b.push(this.a[d++]);if(b.length)for(d=
209
+ b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.Zu(d++,f.startTime,f.endTime,f.Ra,f.La,f.za,f.xb,f.keyInfo,f.Vb,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile),b.push(f);else b=a;a=b;if(c.length&&b.length){a=[];e=b[0].position;d=c.length;c=_.t(c);for(f=c.next();!f.done;f=c.next())f=f.value,a.push(new _.Zu(e-d--,f.startTime,f.endTime,f.Ra,f.La,f.za,f.xb,f.keyInfo,f.Vb,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile));b=_.t(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=
210
+ a};_.h.replace=function(a){this.a=a};nv.prototype.release=function(){this.g.stop();for(var a=_.t(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};ov.prototype.release=function(){this.j=null;this.h.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
211
+ ov.prototype.m=function(a,b){for(var c={},d=_.t(this.j.cues()),e=d.next();!e.done;c={Qd:c.Qd,ed:c.ed},e=d.next()){e=e.value;c.Qd=this.h.get(e)||null;c.ed=a<e.startTime?1:a>e.endTime?3:2;this.h.set(e,c.ed);var f=this.o.find(function(g){return function(k){return k.lc===g.Qd&&k.kc===g.ed}}(c));f&&f.Zb(e,b)}};_.h=sv.prototype;_.h.destroy=function(){this.g=this.o=null;this.m.clear();return Promise.resolve()};
212
+ _.h.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.g||!c.g.remove(a,b)||null==c.a||b<=c.a||a>=c.f||(a<=c.a&&b>=c.f?c.a=c.f=null:a<=c.a&&b<c.f?c.a=b:a>c.a&&b>=c.f&&(c.f=a))})};_.h.lb=function(){return this.a};_.h.ra=function(){return this.f};_.h.ac=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.h.xa=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
213
+ yv.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.Q(a);this.j=b.videoTrackIds(a);this.h=b.timescale(a);this.a.init()};yv.prototype.g=function(a,b){var c=_.Q(a);(c=this.a.parse(c,this.j,this.h))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};yv.prototype.f=function(){this.a.resetCaptionStream()};_.zv.prototype.init=function(){};_.zv.prototype.g=function(){};_.zv.prototype.f=function(){};Av.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};Av.prototype.w=function(a){this.g=a.captions;var b=new Uint8Array(a.data.byteLength+a.initSegment.byteLength);b.set(a.initSegment,0);b.set(a.data,a.initSegment.byteLength);a.type===_.Ie?this.m.push(b):a.type===_.$b&&this.j.push(b)};Av.prototype.o=function(){var a={video:_.pj.apply(_.ij,_.df(this.m)),captions:this.g,audio:_.pj.apply(_.ij,_.df(this.j))};this.f.resolve(a);this.h=!1};_.h=_.Fv.prototype;
214
+ _.h.destroy=function(){var a=this;this.I=!0;var b=[],c;for(c in this.h){var d=this.h[c],e=d[0];this.h[c]=d.slice(0,1);e&&b.push(e.p["catch"](uu));for(e=1;e<d.length;++e)d[e].p["catch"](uu),d[e].p.reject()}this.g&&b.push(this.g.destroy());this.A&&b.push(this.A.destroy());for(var f in this.w)b.push(this.w[f].destroy());return Promise.all(b).then(function(){a.o&&(a.o.release(),a.o=null);a.j&&(a.j.removeAttribute("src"),a.j.load(),a.j=null);a.m=null;a.g=null;a.A=null;a.f={};a.w={};a.C={};a.D=null;a.J=
215
215
  !1;for(var g in a.h);a.h={}})};
216
- _.h.init=function(a,b){var c=this,d;return _.z(function(e){if(1==e.a)return d=_.Yl,_.v(e,c.G,2);a.forEach(function(f,g){var k=_.vh(f.mimeType,f.codecs);if(g==d.TEXT)Bv(c,k);else{var l=new Map;l.set(g,k);if((!MediaSource.isTypeSupported(k)||!b||f.keyInfo)&&uv(k,g)){c.w[g]=new rv;k="aac"==k.toLowerCase().split(";")[0].split("/")[1]?k.replace(/aac/i,_.sd):sv(g,k);var m=new Map;m.set(g,k);try{var n=k.match(/"(.*?)"/)[0].replace(/"/g,"").split(","),p=new Map;if(1<n.length)for(var q=_.t(n),r=q.next();!r.done;r=
217
- q.next()){var x=r.value;x.startsWith("avc")?p.set(_.He,'video/mp4;codecs\x3d"'+x+'"'):x.startsWith("mp4a")&&p.set(_.Zb,'audio/mp4;codecs\x3d"'+x+'"')}l=0<p.size?p:m}catch(y){l=m}}Av(c,l)}});_.w(e)})};_.h.lb=function(a){return a===_.se?this.g.lb():(a=Dv(this,a))?a.lb():null};_.h.ra=function(a){return a===_.se?this.g.ra():(a=Dv(this,a))?a.ra():null};_.h.bc=function(a,b,c){return a===_.se?this.g.bc(b):(a=Dv(this,a))?a.bc(b,!1,c):!1};
218
- _.h.xa=function(a,b){if(a===_.se)return this.g.xa(b);var c=Dv(this,a);return c?c.xa(b):0};_.h.remove=function(a,b,c){var d=this;return a===_.se?this.g.remove(b,c):Gv(this,a,this.bg.bind(this,a,b,c)).then(function(){if(a===_.He){var e=d.lb(a),f=d.ra(a);null!==e&&null!==f&&uu(d.B,e,f)}else a===_.Zb&&(e=d.B,e.a&&e.a.trigger(new _.E(_.dc)))})};_.h.clear=function(a){if(a==_.se){if(!this.g)return Promise.resolve();this.D.f();return this.g.remove(0,Infinity)}return Gv(this,a,this.bg.bind(this,a,0,this.m.duration))};
219
- _.h.flush=function(a){return a==_.se?Promise.resolve():Gv(this,a,this.yf.bind(this,a))};_.h.endOfStream=function(a){var b=this;return Nv(this,function(){Cv(b)||(a?b.m.endOfStream(a):b.m.endOfStream())})};_.h.Pb=function(a){var b=this;Nv(this,function(){b.m.duration=a})};_.h.getDuration=function(){return this.m.duration};
220
- _.h.ae=function(a,b){this.a.debug("Appending data to "+a+yt);try{this.f[a].appendBuffer(b)}catch(c){throw this.a.warn("Failed to append data for "+a,c),c;}this.a.debug("Done Appending data to "+a+yt)};_.h.bg=function(a,b,c){if(c<=b)this.Gc(a);else{this.a.debug("Removing data from "+a+" range:",b,c);try{this.f[a].remove(b,c)}catch(d){throw this.a.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.a.debug("Done Removing data from "+a+" range:",b,c)}};
221
- _.h.rg=function(a){try{this.a.debug("Aborting operations for "+a+yt);var b=this.f[a].appendWindowStart,c=this.f[a].appendWindowEnd;this.f[a].abort();this.f[a].appendWindowStart=b;this.f[a].appendWindowEnd=c}catch(d){throw this.a.warn("Failed to abort operations for "+a+yt,d),d;}this.a.debug("Done Aborting operations for "+a+yt);this.Gc(a)};
222
- _.h.yf=function(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.a.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.a.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.a.warn("Failed to flush buffer for "+a,b),b;}this.a.debug("Done Flushing buffer for "+a);this.Gc(a)};
223
- _.h.gg=function(a,b){0>b&&(b+=.001);try{this.a.debug("Setting timestamp offset for "+a,b),this.f[a].timestampOffset=b}catch(c){throw this.a.warn("Failed to set timestamp offset for "+a,b,c),c;}this.a.debug("Done Setting timestamp offset for "+a,b);this.Gc(a)};
224
- _.h.Cj=function(a,b,c){try{this.a.debug("Setting append window for "+a,b,c),this.f[a].appendWindowStart=0,this.f[a].appendWindowEnd=c,this.f[a].appendWindowStart=b}catch(d){throw this.a.warn("Failed to set append window for "+a,b,c,d),d;}this.a.debug("Done Setting append window for "+a,b,c);this.Gc(a)};_.h.S=function(a){this.h[a][0].p.reject(new _.J(_.K,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
225
- _.h.Gc=function(a){var b=this.h[a][0];b&&(b.p.resolve(),this.a.debug("Update-End received for "+a),Mv(this,a))};_.h.getTextDisplayer=function(){return this.A};var zv=window.URL.createObjectURL;_.u(iw,_.P);_.h=iw.prototype;_.h.Fb=function(a){this.l=a};_.h.release=function(){this.h=[];this.a.clear();this.f.clear()};_.h.load=function(){};_.h.destroy=function(){this.release();this.l=null};_.h.getVideoTracks=function(){return jw(this,_.zg)};_.h.getAudioTracks=function(){return jw(this,_.N)};_.h.ea=function(){return jw(this,_.L)};_.h.fa=function(){return this.a.get(_.zg)||null};_.h.Aa=function(){return this.a.get(_.N)||null};_.h.Ca=function(){return this.a.get(_.L)||null};
226
- _.h.Pa=function(){return this.f.get(_.zg)||null};_.h.Ya=function(){return this.f.get(_.N)||null};_.h.Za=function(){return this.f.get(_.L)||null};_.h.Da=function(){return kw(this,_.zg)};_.h.ia=function(){return kw(this,_.N)};_.h.ja=function(){return kw(this,_.L)};_.h.Va=function(a){mw(this,_.zg,a)};_.h.na=function(a){mw(this,_.N,a)};_.h.ua=function(a){mw(this,_.L,a)};_.h.Ua=function(a,b){lw(this,_.zg,a,void 0===b?!1:b)};_.h.gb=function(a,b){lw(this,_.N,a,void 0===b?!1:b)};
227
- _.h.hb=function(a,b){lw(this,_.L,a,void 0===b?!1:b)};_.h.addTextTrack=function(a){var b=this;return _.z(function(c){return b.l?_.v(c,b.l.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.H(0)})};_.h.ka=function(){return!!this.l&&this.l.ka()};iw.prototype.isAbrEnabled=iw.prototype.ka;iw.prototype.addTextTrack=iw.prototype.addTextTrack;iw.prototype.setTextRendition=iw.prototype.hb;iw.prototype.setAudioRendition=iw.prototype.gb;iw.prototype.setVideoRendition=iw.prototype.Ua;
228
- iw.prototype.setTextTrack=iw.prototype.ua;iw.prototype.setAudioTrack=iw.prototype.na;iw.prototype.setVideoTrack=iw.prototype.Va;iw.prototype.getTextTrack=iw.prototype.ja;iw.prototype.getAudioTrack=iw.prototype.ia;iw.prototype.getVideoTrack=iw.prototype.Da;iw.prototype.getLoadingTextRendition=iw.prototype.Za;iw.prototype.getLoadingAudioRendition=iw.prototype.Ya;iw.prototype.getLoadingVideoRendition=iw.prototype.Pa;iw.prototype.getTextRendition=iw.prototype.Ca;iw.prototype.getAudioRendition=iw.prototype.Aa;
229
- iw.prototype.getVideoRendition=iw.prototype.fa;iw.prototype.getTextTracks=iw.prototype.ea;iw.prototype.getAudioTracks=iw.prototype.getAudioTracks;iw.prototype.getVideoTracks=iw.prototype.getVideoTracks;_.h=_.Aw.prototype;_.h.stop=function(){this.w=null;this.j=!1;this.o=[];this.m=1;this.h=null;this.B=!1};_.h.init=function(a){this.w=a};
230
- _.h.chooseVariant=function(){var a=Bw(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=zw(this.g,this.a.defaultBandwidthEstimate);this.o.length&&!a.length&&(this.f.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=Bw(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.t(_.uz(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.item;var f=isNaN(this.m)||0===this.m?1:Math.abs(this.m),g=f*d.bandwidth,k=g/this.a.bandwidthDowngradeTarget;
216
+ _.h.init=function(a,b){var c=this,d;return _.z(function(e){if(1==e.a)return d=_.fm,_.v(e,c.G,2);a.forEach(function(f,g){var k=_.xh(f.mimeType,f.codecs);if(g==d.TEXT)Jv(c,k);else{var l=new Map;l.set(g,k);if((!MediaSource.isTypeSupported(k)||!b||f.keyInfo)&&Cv(k,g)){c.w[g]=new Av;k="aac"==k.toLowerCase().split(";")[0].split("/")[1]?k.replace(/aac/i,_.td):Bv(g,k);var m=new Map;m.set(g,k);try{var n=k.match(/"(.*?)"/)[0].replace(/"/g,"").split(","),p=new Map;if(1<n.length)for(var q=_.t(n),r=q.next();!r.done;r=
217
+ q.next()){var x=r.value;x.startsWith("avc")?p.set(_.Ie,'video/mp4;codecs\x3d"'+x+'"'):x.startsWith("mp4a")&&p.set(_.$b,'audio/mp4;codecs\x3d"'+x+'"')}l=0<p.size?p:m}catch(y){l=m}}Iv(c,l)}});_.w(e)})};_.h.lb=function(a){return a===_.te?this.g.lb():(a=Lv(this,a))?a.lb():null};_.h.ra=function(a){return a===_.te?this.g.ra():(a=Lv(this,a))?a.ra():null};_.h.ac=function(a,b,c){return a===_.te?this.g.ac(b):(a=Lv(this,a))?a.ac(b,!1,c):!1};
218
+ _.h.xa=function(a,b){if(a===_.te)return this.g.xa(b);var c=Lv(this,a);return c?c.xa(b):0};_.h.remove=function(a,b,c){var d=this;return a===_.te?this.g.remove(b,c):Ov(this,a,this.bg.bind(this,a,b,c)).then(function(){if(a===_.Ie){var e=d.lb(a),f=d.ra(a);null!==e&&null!==f&&Cu(d.B,e,f)}else a===_.$b&&(e=d.B,e.a&&e.a.trigger(new _.E(_.ec)))})};_.h.clear=function(a){if(a==_.te){if(!this.g)return Promise.resolve();this.D.f();return this.g.remove(0,Infinity)}return Ov(this,a,this.bg.bind(this,a,0,this.m.duration))};
219
+ _.h.flush=function(a){return a==_.te?Promise.resolve():Ov(this,a,this.yf.bind(this,a))};_.h.endOfStream=function(a){var b=this;return Vv(this,function(){Kv(b)||(a?b.m.endOfStream(a):b.m.endOfStream())})};_.h.Pb=function(a){var b=this;Vv(this,function(){b.m.duration=a})};_.h.getDuration=function(){return this.m.duration};
220
+ _.h.ae=function(a,b){this.a.debug("Appending data to "+a+Ht);try{this.f[a].appendBuffer(b)}catch(c){throw this.a.warn("Failed to append data for "+a,c),c;}this.a.debug("Done Appending data to "+a+Ht)};_.h.bg=function(a,b,c){if(c<=b)this.Fc(a);else{this.a.debug("Removing data from "+a+" range:",b,c);try{this.f[a].remove(b,c)}catch(d){throw this.a.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.a.debug("Done Removing data from "+a+" range:",b,c)}};
221
+ _.h.rg=function(a){try{this.a.debug("Aborting operations for "+a+Ht);var b=this.f[a].appendWindowStart,c=this.f[a].appendWindowEnd;this.f[a].abort();this.f[a].appendWindowStart=b;this.f[a].appendWindowEnd=c}catch(d){throw this.a.warn("Failed to abort operations for "+a+Ht,d),d;}this.a.debug("Done Aborting operations for "+a+Ht);this.Fc(a)};
222
+ _.h.yf=function(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.a.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.a.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.a.warn("Failed to flush buffer for "+a,b),b;}this.a.debug("Done Flushing buffer for "+a);this.Fc(a)};
223
+ _.h.gg=function(a,b){0>b&&(b+=.001);try{this.a.debug("Setting timestamp offset for "+a,b),this.f[a].timestampOffset=b}catch(c){throw this.a.warn("Failed to set timestamp offset for "+a,b,c),c;}this.a.debug("Done Setting timestamp offset for "+a,b);this.Fc(a)};
224
+ _.h.Cj=function(a,b,c){try{this.a.debug("Setting append window for "+a,b,c),this.f[a].appendWindowStart=0,this.f[a].appendWindowEnd=c,this.f[a].appendWindowStart=b}catch(d){throw this.a.warn("Failed to set append window for "+a,b,c,d),d;}this.a.debug("Done Setting append window for "+a,b,c);this.Fc(a)};_.h.S=function(a){this.h[a][0].p.reject(new _.J(_.K,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
225
+ _.h.Fc=function(a){var b=this.h[a][0];b&&(b.p.resolve(),this.a.debug("Update-End received for "+a),Uv(this,a))};_.h.getTextDisplayer=function(){return this.A};var Hv=window.URL.createObjectURL;_.u(qw,_.P);_.h=qw.prototype;_.h.Fb=function(a){this.l=a};_.h.release=function(){this.h=[];this.a.clear();this.f.clear()};_.h.load=function(){};_.h.destroy=function(){this.release();this.l=null};_.h.getVideoTracks=function(){return rw(this,_.Bg)};_.h.getAudioTracks=function(){return rw(this,_.N)};_.h.ea=function(){return rw(this,_.L)};_.h.fa=function(){return this.a.get(_.Bg)||null};_.h.Aa=function(){return this.a.get(_.N)||null};_.h.Ca=function(){return this.a.get(_.L)||null};
226
+ _.h.Pa=function(){return this.f.get(_.Bg)||null};_.h.Za=function(){return this.f.get(_.N)||null};_.h.$a=function(){return this.f.get(_.L)||null};_.h.Da=function(){return sw(this,_.Bg)};_.h.ia=function(){return sw(this,_.N)};_.h.ja=function(){return sw(this,_.L)};_.h.Wa=function(a){uw(this,_.Bg,a)};_.h.na=function(a){uw(this,_.N,a)};_.h.ua=function(a){uw(this,_.L,a)};_.h.Va=function(a,b){tw(this,_.Bg,a,void 0===b?!1:b)};_.h.gb=function(a,b){tw(this,_.N,a,void 0===b?!1:b)};
227
+ _.h.hb=function(a,b){tw(this,_.L,a,void 0===b?!1:b)};_.h.addTextTrack=function(a){var b=this;return _.z(function(c){return b.l?_.v(c,b.l.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.H(0)})};_.h.ka=function(){return!!this.l&&this.l.ka()};qw.prototype.isAbrEnabled=qw.prototype.ka;qw.prototype.addTextTrack=qw.prototype.addTextTrack;qw.prototype.setTextRendition=qw.prototype.hb;qw.prototype.setAudioRendition=qw.prototype.gb;qw.prototype.setVideoRendition=qw.prototype.Va;
228
+ qw.prototype.setTextTrack=qw.prototype.ua;qw.prototype.setAudioTrack=qw.prototype.na;qw.prototype.setVideoTrack=qw.prototype.Wa;qw.prototype.getTextTrack=qw.prototype.ja;qw.prototype.getAudioTrack=qw.prototype.ia;qw.prototype.getVideoTrack=qw.prototype.Da;qw.prototype.getLoadingTextRendition=qw.prototype.$a;qw.prototype.getLoadingAudioRendition=qw.prototype.Za;qw.prototype.getLoadingVideoRendition=qw.prototype.Pa;qw.prototype.getTextRendition=qw.prototype.Ca;qw.prototype.getAudioRendition=qw.prototype.Aa;
229
+ qw.prototype.getVideoRendition=qw.prototype.fa;qw.prototype.getTextTracks=qw.prototype.ea;qw.prototype.getAudioTracks=qw.prototype.getAudioTracks;qw.prototype.getVideoTracks=qw.prototype.getVideoTracks;_.h=_.Iw.prototype;_.h.stop=function(){this.w=null;this.j=!1;this.o=[];this.m=1;this.h=null;this.B=!1};_.h.init=function(a){this.w=a};
230
+ _.h.chooseVariant=function(){var a=Jw(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=Hw(this.g,this.a.defaultBandwidthEstimate);this.o.length&&!a.length&&(this.f.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=Jw(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.t(_.Cz(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.item;var f=isNaN(this.m)||0===this.m?1:Math.abs(this.m),g=f*d.bandwidth,k=g/this.a.bandwidthDowngradeTarget;
231
231
  e=f*(e.next||{bandwidth:Infinity}).bandwidth/this.a.bandwidthUpgradeTarget;this.f.debug("Bandwidth ranges:",(g/1E6).toFixed(3),(k/1E6).toFixed(3),(e/1E6).toFixed(3));b>=k&&b<=e&&(c=d)}this.h=Date.now();this.B=!0;return c};_.h.enable=function(){this.j=!0};_.h.disable=function(){this.j=!1};
232
- _.h.segmentDownloaded=function(a,b){this.f.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.j);var c=this.g;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.Nu(c.f,e,d);_.Nu(c.g,e,d)}if(null!=this.h&&this.j)a:{this.f.debug("Suggesting Streams...");if(!this.A){if(!(128E3<=this.g.a)){this.f.debug("Still waiting for a good estimate...");break a}this.A=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Skipping initial estimation switch due to switch interval...");
233
- break a}}else if(Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Still within switch interval...");break a}c=this.chooseVariant();this.f.debug("Calling switch_(), bandwidth\x3d"+Math.round(zw(this.g,this.a.defaultBandwidthEstimate)/1E3)+" kbps");this.w(c)}};_.h.playbackRateChanged=function(a){this.m=a};_.h.getBandwidthEstimate=function(){return zw(this.g,this.a.defaultBandwidthEstimate)};_.h.setVariants=function(a){this.o=a};_.h.configure=function(a){this.a=a};
234
- _.h.reset=function(){this.A=!1;this.g=new yw;var a=this.chooseVariant();a&&this.w(a)};Cw.prototype.clear=function(){this.a.clear()};Fw.prototype.add=function(a){if(Iw(this.f,a))return this.a.add(a),!0;_.B("Rejecting variant - not compatible with root.");return!1};Fw.prototype.values=function(){return this.a.values()};Kw.prototype.create=function(a){var b=this,c=a.filter(function(d){return Iw(b.a,d)});return c.length?new Fw(c[0],c):this.f.create(a)};
235
- Jw.prototype.create=function(a){var b=[];b=Lw(a,this.g);var c=a.filter(function(d){return d.primary});b=b.length?b:c.length?c:a;this.f&&(a=Mw(b,this.f),a.length?b=a:_.B("No exact match for variant role could be found."));this.a&&(a=Pv(b,this.a),a.length?b=a:_.B("No exact match for the channel count could be found."));a=new Fw(b[0]);b=_.t(b);for(c=b.next();!c.done;c=b.next())c=c.value,Iw(a.f,c)&&a.add(c);return a};Pw.prototype.getState=function(){return this.a};var Ow=0,Nw=1;Rw.prototype.release=function(){this.h.release()};Sw.prototype.release=function(){this.a=this.g=null;this.f=function(){}};Sw.prototype.m=function(a){var b=this.a,c=this.g.periods;a=Lu(c,a)||c[0];b!=a&&this.f(a);this.a=a};Uw.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};Uw.prototype.set=function(a){this.g=a;Vw(this)};Xw.prototype.release=function(){this.g=null;this.f=function(){}};ax.prototype.release=function(){this.g&&(this.g.release(),this.g=null);null!=this.o&&(this.o.stop(),this.o=null);this.f&&(this.f.release(),this.f=null);this.a=this.C=this.B=null;this.m=!1};ax.prototype.Ed=function(){this.w=!0;$w(this)};ex.prototype.release=function(){this.f&&(this.f.release(),this.f=null);null!=this.g&&(this.g.release(),this.g=null);this.h=function(){};this.a=null;this.m=function(){};this.o=!1};bx.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};mx.prototype.release=function(){this.g&&(this.g.release(),this.g=null);this.j&&(this.j.release(),this.j=null);this.o&&(this.o.stop(),this.o=null);this.h=this.g=this.a=this.m=null;this.A=function(){}};var sx=new _.wl(function(){return new Uint8Array([0,0,0,80,115,105,110,102,0,0,0,12,102,114,109,97,0,0,0,0,0,0,0,20,115,99,104,109,0,0,0,0,99,101,110,99,0,1,0,0,0,0,0,40,115,99,104,105,0,0,0,32,116,101,110,99,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])});_.ux.prototype.destroy=function(){for(var a=_.t(this.h.values()),b=a.next();!b.done;b=a.next())Kx(b.value);this.h.clear();this.w.clear();this.m=this.o=this.I=this.g=this.f=null;this.D=[];this.j=!0;return Promise.resolve()};
236
- _.ux.prototype.start=function(){var a=this,b,c,d;return _.z(function(e){if(1==e.a){b=a.f.qb();c=zx(a,b);d=a.f.Ae(a.g.periods[c]);if(!d.variant&&!d.text)throw a.a.error("init: no Streams chosen"),new _.J(_.K,5,5005);a.G=!d.variant&&!!d.text;return _.v(e,Ox(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.j)return e["return"]();a.a.debug("init: completed initial Stream setup");a.f&&a.f.Wi&&(a.a.debug("init: calling onInitialStreamsSetup()..."),a.f.Wi());_.w(e)})};
237
- _.ux.prototype.L=function(a,b,c,d){var e=Zt(d.F),f=Zt(d.F),g=_.Ej(d.F),k=_.Ej(d.F),l=_.Ej(d.F),m=_.Ej(d.F);d=_.Hj(d.F,d.F.Ba()-d.F.getPosition());a=a.startTime+b.startTime+k/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.f.Tf();else this.f.onEvent(new _.E("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:k,eventDuration:l,id:m,messageData:d}}))};
238
- _.ux.prototype.O=function(a){var b=this,c=!1,d=0;(new _.qk).M(_.rd,_.rk).M(_.we,_.rk).M(_.md,_.rk).M(_.qd,_.rk).M(_.je,_.rk).V(_.me,_.sk).M("encv",function(e){e.F.skip(78);_.rk(e)}).M("pasp",function(e){d=e.start+e.le;var f=_.Ej(e.F),g=_.Ej(e.F);c=f!==g;b.a.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.cb.stop()}).parse(a.data);c&&(a=new _.xj(new DataView(a.data)),a.seek(d),_.R(a,1),_.R(a,1))};_.u(my,_.Wi);_.h=my.prototype;_.h.init=function(a,b){var c=a.getMedia();_.Wi.prototype.init.call(this,a,b);sy(this,c)};_.h.namespace=function(){return Ot};_.h.rf=function(){return new iw};_.h.getState=function(){return this.aa};_.h.getDrmInfo=function(){return this.m?this.m.getDrmInfo():null};
239
- _.h.unload=function(){var a=this;ow(this,!1);this.Lc=!1;if(this.o){var b=this.getTrackManager();b&&b.release();return this.C===py?Promise.resolve():uy(this).then(function(){a.log.debug(_.bb,a.o);a.o=null;a.we=0;a.tc=null;a.O=null})}return Promise.resolve()};
240
- _.h.release=function(){var a=this;return _.z(function(b){if(a.U)return b["return"](a.U);a.U=new Promise(function(c,d){try{var e=a.td;a.td=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.Wi.prototype.release.call(a)}):f=_.Wi.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){oy(a,_.zl);a.U=null;c()})["catch"](function(g){a.U=null;d(g)})}catch(g){a.U=null,d(g)}});return b["return"](a.U)})};
241
- _.h.getBufferInfo=function(a){if(this.I){var b=Ev(this.I),c=new _.Mh(void 0,a);switch(a){case _.zg:return b.video?b.video:c;case _.N:return b.audio?b.audio:c;case _.L:return b.text?b.text:c}return b.total?b.total:c}return this.Mc?(b=ru(this.Mc),iu(b,a)):_.Wi.prototype.getBufferInfo.call(this,a)};_.h.getPosition=function(){return this.w?ox(this.w):_.Wi.prototype.getPosition.call(this)};_.h.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime()||0:0};
242
- _.h.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.h.destroy=function(){var a=this;return _.z(function(b){if(1==b.a)return _.v(b,_.Wi.prototype.destroy.call(a),2);if(3!=b.a){if(a.C===py)return b["return"]();a.log.debug("Destroying player...");a.C=py;return _.v(b,ry(a),3)}a.j&&(a.j.release(),a.j=null);a.g=null;_.w(b)})};
243
- _.h.load=function(a){var b=this,c,d,e,f,g,k,l,m;return _.z(function(n){switch(n.a){case 1:if(b.C===py)return n["return"](Promise.reject(new _.J(_.K,7,7E3)));c=new _.Oh;d=function(){return b.td!==c};e=function(){b.log.info("Aborting current load");throw new _.J(_.K,7,7E3);};b.td=c;_.qf(n,2);d()&&e();if(!b.U){n.H(4);break}_.qf(n,5);return _.v(n,b.U,7);case 7:_.rf(n,6,2);break;case 5:_.sf(n,2);case 6:d()&&e();case 4:return b.G=new _.ul,b.se=Date.now()/1E3,oy(b,_.Ll),b.o=_.Rl(a),_.Vi(a)&&(b.configuration=
244
- _.Ui(b.od,a)),b.log.info(_.La,b.configuration),b.log.info(_.Ya,b.o),(f=b.getTrackManager())&&f.load(),g=b.getSurface().getMedia(),g.loop=!!b.configuration.loop,_.H.R(b.configuration.volume)||b.setVolume(b.configuration.volume),_.H.R(b.configuration.muted)||b.setMuted(b.configuration.muted),Vy(b),k=b.o[b.getSourceIndex()],d()&&e(),_.v(n,sy(b,g),8);case 8:return d()&&e(),_.v(n,ty(b,g),9);case 9:return d()&&e(),_.v(n,wy(b,k),10);case 10:return d()&&e(),_.v(n,Ay(b,k),11);case 11:return d()&&e(),_.v(n,
245
- Iy(b),12);case 12:return d()&&e(),_.v(n,Ty(b),13);case 13:d()&&e();c.resolve();_.rf(n,0);break;case 2:throw m=l=_.sf(n),d()&&(m=new _.J(_.K,7,7E3)),c.reject(m),b.onError(m),m;}})};_.h.isLive=function(){return this.f?this.f.presentationTimeline.isLive():!1};_.h.Xf=function(){this.log.debug("User seeking finished");this.D&&Jy(this);Ky(this)};_.h.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:Zu(a,0),end:Yu(a)}}return{start:0,end:0}};
246
- _.h.getPlaybackRate=function(){if(this.uc){var a=this.uc;a=a.h?0:a.g}else a=0;return a};
247
- _.h.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.C===ly){this.uc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.h.get(_.He)){var d=a.stream;if(d)if(b.a.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Mb&&(b.a.debug("Engaging trick mode stream",c),_.Dx(b,c,!1,0),a.Mb=d);else if(d=a.Mb)b.a.debug("Restoring non-trick-mode stream",d),a.Mb=null,_.Dx(b,d,!0,0)}}};
248
- _.h.ea=function(){if(this.f&&this.w){var a=By(this);if(null==a)a=null;else{if(!Ew(this.L,a).text){var b=_.bw(a.textStreams,this.wa,this.kb);b.length&&(b=b[0],Ew(this.L,a).text=b)}a=Ew(this.L,a).text}b=[];for(var c=_.t(iz(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=Zv(d);e.active=d==a;b.push(e)}return b}return[]};_.h.getPeriods=function(){return this.f.periods};
249
- _.h.getStats=function(){if(this.C!==ly)return _.vl();Ky(this);var a=this.h;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.G,c=Number(a.totalVideoFrames);b.h=Number(a.droppedVideoFrames);b.g=c}if(this.C===ly){if(a=Wy(this))this.G.A=a.bandwidth;a&&a.video&&(b=this.G,c=a.video.height||NaN,b.j=a.video.width||NaN,b.f=c);a=this.g.getBandwidthEstimate();this.G.m=a}return this.G.getStats()};
250
- _.h.getTimelineCues=function(){return this.rc?_.af(this.rc.cues()).concat().map(function(a){return{schemeIdUri:a.schemeIdUri,value:a.value,startTime:a.startTime,endTime:a.endTime,id:a.id,eventElement:a.eventElement,type:a.type}}):[]};_.h.resetAbr=function(){this.g&&this.g.reset()};
251
- _.h.addTextTrack=function(a,b,c,d,e,f){var g=this,k,l,m,n,p,q,r,x,y;return _.z(function(C){if(1==C.a){if(g.C!==ly)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");k=By(g);l=_.Yl;m=g.f.periods.indexOf(k);n=m+1;p=n>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[n].startTime;q=p-k.startTime;if(Infinity==q)throw new _.J(1,4,4040);r=new _.Ru(1,0,q,function(){return[a]},0,null,0);x={id:g.ig++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
252
- findSegmentPosition:function(){return 1},getSegmentReference:function(I){return 1==I?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,label:f||null,type:l.TEXT,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,closedCaptions:null};g.yd.add(x);k.textStreams.push(x);return _.v(C,Cx(g.a,x),2)}if(y=_.vx(g.a,_.se))Ew(g.L,k).text=y;g.yd["delete"](x);g.log.debug("Choosing new streams after adding a text stream");
253
- Dy(g,k);Ey(g);return C["return"](Zv(x))})};_.h.vh=function(a){this.log.debug(_.Qt,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=gz(this,a);this.log.debug("onChooseStreams_, chose variant ",b.variant);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(c){return this.onError(c),{variant:null,text:null}}};
254
- _.h.uh=function(){this.log.debug("canSwitch_");this.T=!1;this.configuration.abr.enabled&&this.g.enable();this.ca&&(Ex(this.a,this.ca,this.ag,this.$f),this.ca=null);this.Y&&(_.Dx(this.a,this.Y,!0,0),this.Y=null)};_.h.wh=function(){this.B&&this.B.update&&this.B.update()};_.h.hj=function(){this.w&&this.w.j.Ed()};
255
- _.h.Fg=function(a,b){b=void 0===b?!1:b;var c=By(this),d=c.variants.some(function(k){var l=!1,m=k[a.type];m&&(l=k.allowedByApplication&&m.id!==a.id,a.type===_.Zb&&(l=l&&m.language===a.language));return l})&&(this.ka()||b);if(d){for(var e=_.t(c.variants),f=e.next();!f.done;f=e.next()){f=f.value;var g=f[a.type];g&&g.id===a.id&&(f.allowedByApplication=!1)}Ey(this);!this.ka()&&b&&(this.configuration.abr.enabled=!0,this.g.enable());Dy(this,c)}return d};
256
- _.h.Ui=function(){this.log.debug("endOfStream called by streaming engine");this.Lc=!0};_.h.onError=function(a){if(this.C!==py&&7001!==a.code&&7E3!==a.code){var b=new _.E(_.Vc,{detail:a});a.severity===_.K&&oy(this,_.Kl);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.h.$d=function(a){a.type===_.Pc?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Qe?vy(this):"emsg"!==a.type&&(a instanceof _.E?this.dispatchEvent(a):this.log.debug("Unhandled/ignored event",a.type)))};_.h.ka=function(){return this.configuration.abr.enabled};
257
- _.h.Jj=function(a){var b=this,c,d,e,f,g,k,l,m;return _.z(function(n){switch(n.a){case 1:if(!b.Ma)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ka();return _.v(n,b.Ma(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.H.Sa(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.v(n,iy(b.a),3);case 3:g=Wy(b);case 4:return k=!1,_.qf(n,7),b.log.info("Switching CDN to "+f.url+"."),_.v(n,jz(b,f,g),9);case 9:_.rf(n,6);break;case 7:return l=_.sf(n),b.log.info("Switch failed"),
258
- _.v(n,b.Ma(f.url,a),10);case 10:if(m=n.f)f.url=m,k=!0;else throw l;case 6:k?n.H(4):(d&&b.g.enable(),ey(b.a,!0),b.o[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.E(_.oc,{newManifest:f.url})),_.w(n))}})};var py=0,ky=1,ly=2,Cy=[_.Kd,_.bd];kz.prototype.a=function(){return Ot};
259
- kz.prototype.canPlay=function(a,b){if(_.ri())return 0;var c=a.type||"",d=window.MediaSource&&MediaSource.isTypeSupported?!0:!1,e=window.MediaSource&&MediaSource.isTypeSupported?c in _.jo||_.ko(a.url)in _.lo?!0:!1:!1;if(d&&e){if(_.fi(2))return 1;if(_.si()&&c===_.Xb){if(b.streaming.preferNativeHlsOnSafari)return 1;_.B("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};kz.prototype.create=function(){return new my};_.Pf(new kz);_.Em(function(){_.Jf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.If("Patching Chromecast MSE bugs."),pz();else if(_.si()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;nz();10>=a?(_.If("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.If("Patching Safari 11 \x26 12 MSE bugs."),lz(),mz()):(_.If("Patching Safari 13 MSE bugs."),lz())}else _.fi(2)||_.fi(3)||
260
- _.fi(4)?oz():_.If("Using native MSE as-is.");else _.If("No MSE implementation available.")});_.u(qz,_.Ro);_.h=qz.prototype;
261
- _.h.append=function(a){function b(e){if(e.startTime>=e.endTime)_.B("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.ch(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.qc}catch(g){f.align="middle"}e.writingMode===_.Fe?f.vertical="lr":e.writingMode===_.Ge&&(f.vertical="rl");e=f}e&&c.push(e)}var c=[],d=_.t(a);for(a=d.next();!a.done;a=d.next())b(a.value);a=c.slice().sort(function(e,f){return e.startTime!==f.startTime?
262
- e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.t(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.h.remove=function(a,b){if(!this.a)return!1;rz(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.h.isTextVisible=function(){return this.a.mode==_.de};_.h.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.de:_.$c)};_.h.destroy=function(){this.a&&rz(this.a,function(){return!0});this.a=null;return Promise.resolve()};sz.prototype.W=function(){return!0};sz.prototype.create=function(a){return new qz(a)};sz.prototype.create=sz.prototype.create;sz.prototype.isSupported=sz.prototype.W;_.ll(_.ee,new sz);};
232
+ _.h.segmentDownloaded=function(a,b){this.f.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.j);var c=this.g;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.Vu(c.f,e,d);_.Vu(c.g,e,d)}if(null!=this.h&&this.j)a:{this.f.debug("Suggesting Streams...");if(!this.A){if(!(128E3<=this.g.a)){this.f.debug("Still waiting for a good estimate...");break a}this.A=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Skipping initial estimation switch due to switch interval...");
233
+ break a}}else if(Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Still within switch interval...");break a}c=this.chooseVariant();this.f.debug("Calling switch_(), bandwidth\x3d"+Math.round(Hw(this.g,this.a.defaultBandwidthEstimate)/1E3)+" kbps");this.w(c)}};_.h.playbackRateChanged=function(a){this.m=a};_.h.getBandwidthEstimate=function(){return Hw(this.g,this.a.defaultBandwidthEstimate)};_.h.setVariants=function(a){this.o=a};_.h.configure=function(a){this.a=a};
234
+ _.h.reset=function(){this.A=!1;this.g=new Gw;var a=this.chooseVariant();a&&this.w(a)};Kw.prototype.clear=function(){this.a.clear()};Nw.prototype.add=function(a){if(Qw(this.f,a))return this.a.add(a),!0;_.B("Rejecting variant - not compatible with root.");return!1};Nw.prototype.values=function(){return this.a.values()};Sw.prototype.create=function(a){var b=this,c=a.filter(function(d){return Qw(b.a,d)});return c.length?new Nw(c[0],c):this.f.create(a)};
235
+ Rw.prototype.create=function(a){var b=[];b=Tw(a,this.g);var c=a.filter(function(d){return d.primary});b=b.length?b:c.length?c:a;this.f&&(a=Uw(b,this.f),a.length?b=a:_.B("No exact match for variant role could be found."));this.a&&(a=Xv(b,this.a),a.length?b=a:_.B("No exact match for the channel count could be found."));a=new Nw(b[0]);b=_.t(b);for(c=b.next();!c.done;c=b.next())c=c.value,Qw(a.f,c)&&a.add(c);return a};Xw.prototype.getState=function(){return this.a};var Ww=0,Vw=1;Zw.prototype.release=function(){this.h.release()};$w.prototype.release=function(){this.a=this.g=null;this.f=function(){}};$w.prototype.m=function(a){var b=this.a,c=this.g.periods;a=Tu(c,a)||c[0];b!=a&&this.f(a);this.a=a};bx.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};bx.prototype.set=function(a){this.g=a;cx(this)};ex.prototype.release=function(){this.g=null;this.f=function(){}};ix.prototype.release=function(){this.g&&(this.g.release(),this.g=null);null!=this.o&&(this.o.stop(),this.o=null);this.f&&(this.f.release(),this.f=null);this.a=this.C=this.B=null;this.m=!1};ix.prototype.Ed=function(){this.w=!0;hx(this)};mx.prototype.release=function(){this.f&&(this.f.release(),this.f=null);null!=this.g&&(this.g.release(),this.g=null);this.h=function(){};this.a=null;this.m=function(){};this.o=!1};jx.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};ux.prototype.release=function(){this.g&&(this.g.release(),this.g=null);this.j&&(this.j.release(),this.j=null);this.o&&(this.o.stop(),this.o=null);this.h=this.g=this.a=this.m=null;this.A=function(){}};var Ax=new _.El(function(){return new Uint8Array([0,0,0,80,115,105,110,102,0,0,0,12,102,114,109,97,0,0,0,0,0,0,0,20,115,99,104,109,0,0,0,0,99,101,110,99,0,1,0,0,0,0,0,40,115,99,104,105,0,0,0,32,116,101,110,99,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])});_.Cx.prototype.destroy=function(){for(var a=_.t(this.h.values()),b=a.next();!b.done;b=a.next())Sx(b.value);this.h.clear();this.w.clear();this.m=this.o=this.I=this.g=this.f=null;this.D=[];this.j=!0;return Promise.resolve()};
236
+ _.Cx.prototype.start=function(){var a=this,b,c,d;return _.z(function(e){if(1==e.a){b=a.f.qb();c=Hx(a,b);d=a.f.Ae(a.g.periods[c]);if(!d.variant&&!d.text)throw a.a.error("init: no Streams chosen"),new _.J(_.K,5,5005);a.G=!d.variant&&!!d.text;return _.v(e,Wx(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.j)return e["return"]();a.a.debug("init: completed initial Stream setup");a.f&&a.f.Wi&&(a.a.debug("init: calling onInitialStreamsSetup()..."),a.f.Wi());_.w(e)})};
237
+ _.Cx.prototype.M=function(a,b,c,d){var e=gu(d.F),f=gu(d.F),g=_.Kj(d.F),k=_.Kj(d.F),l=_.Kj(d.F),m=_.Kj(d.F);d=_.Nj(d.F,d.F.Ba()-d.F.getPosition());a=a.startTime+b.startTime+k/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.f.Tf();else this.f.onEvent(new _.E("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:k,eventDuration:l,id:m,messageData:d}}))};
238
+ _.Cx.prototype.O=function(a){var b=this,c=!1,d=0;(new _.Oj).L(_.sd,_.Pj).L(_.xe,_.Pj).L(_.nd,_.Pj).L(_.rd,_.Pj).L(_.le,_.Pj).V(_.ne,_.Qj).L("encv",function(e){e.F.skip(78);_.Pj(e)}).L("pasp",function(e){d=e.start+e.le;var f=_.Kj(e.F),g=_.Kj(e.F);c=f!==g;b.a.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.Ta.stop()}).parse(a.data);c&&(a=new _.Cj(new DataView(a.data)),a.seek(d),_.R(a,1),_.R(a,1))};_.u(uy,_.cj);_.h=uy.prototype;_.h.init=function(a,b){var c=a.getMedia();_.cj.prototype.init.call(this,a,b);Ay(this,c)};_.h.namespace=function(){return Xt};_.h.rf=function(){return new qw};_.h.getState=function(){return this.aa};_.h.getDrmInfo=function(){return this.m?this.m.getDrmInfo():null};
239
+ _.h.unload=function(){var a=this;ww(this,!1);this.Lc=!1;if(this.o){var b=this.getTrackManager();b&&b.release();return this.C===xy?Promise.resolve():Cy(this).then(function(){a.log.debug(_.eb,a.o);a.o=null;a.we=0;a.sc=null;a.O=null})}return Promise.resolve()};
240
+ _.h.release=function(){var a=this;return _.z(function(b){if(a.U)return b["return"](a.U);a.U=new Promise(function(c,d){try{var e=a.td;a.td=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.cj.prototype.release.call(a)}):f=_.cj.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){wy(a,_.Hl);a.U=null;c()})["catch"](function(g){a.U=null;d(g)})}catch(g){a.U=null,d(g)}});return b["return"](a.U)})};
241
+ _.h.getBufferInfo=function(a){if(this.I){var b=Mv(this.I),c=new _.Oh(void 0,a);switch(a){case _.Bg:return b.video?b.video:c;case _.N:return b.audio?b.audio:c;case _.L:return b.text?b.text:c}return b.total?b.total:c}return this.Mc?(b=zu(this.Mc),qu(b,a)):_.cj.prototype.getBufferInfo.call(this,a)};_.h.getPosition=function(){return this.w?wx(this.w):_.cj.prototype.getPosition.call(this)};_.h.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime()||0:0};
242
+ _.h.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.h.destroy=function(){var a=this;return _.z(function(b){if(1==b.a)return _.v(b,_.cj.prototype.destroy.call(a),2);if(3!=b.a){if(a.C===xy)return b["return"]();a.log.debug("Destroying player...");a.C=xy;return _.v(b,zy(a),3)}a.j&&(a.j.release(),a.j=null);a.g=null;_.w(b)})};
243
+ _.h.load=function(a){var b=this,c,d,e,f,g,k,l,m;return _.z(function(n){switch(n.a){case 1:if(b.C===xy)return n["return"](Promise.reject(new _.J(_.K,7,7E3)));c=new _.Qh;d=function(){return b.td!==c};e=function(){b.log.info("Aborting current load");throw new _.J(_.K,7,7E3);};b.td=c;_.rf(n,2);d()&&e();if(!b.U){n.H(4);break}_.rf(n,5);return _.v(n,b.U,7);case 7:_.sf(n,6,2);break;case 5:_.tf(n,2);case 6:d()&&e();case 4:return b.G=new _.Cl,b.se=Date.now()/1E3,wy(b,_.Tl),b.o=_.Zl(a),_.bj(a)&&(b.configuration=
244
+ _.aj(b.od,a)),b.log.info(_.Na,b.configuration),b.log.info(_.$a,b.o),(f=b.getTrackManager())&&f.load(),g=b.getSurface().getMedia(),g.loop=!!b.configuration.loop,_.H.R(b.configuration.volume)||b.setVolume(b.configuration.volume),_.H.R(b.configuration.muted)||b.setMuted(b.configuration.muted),cz(b),k=b.o[b.getSourceIndex()],d()&&e(),_.v(n,Ay(b,g),8);case 8:return d()&&e(),_.v(n,By(b,g),9);case 9:return d()&&e(),_.v(n,Ey(b,k),10);case 10:return d()&&e(),_.v(n,Iy(b,k),11);case 11:return d()&&e(),_.v(n,
245
+ Qy(b),12);case 12:return d()&&e(),_.v(n,az(b),13);case 13:d()&&e();c.resolve();_.sf(n,0);break;case 2:throw m=l=_.tf(n),d()&&(m=new _.J(_.K,7,7E3)),c.reject(m),b.onError(m),m;}})};_.h.isLive=function(){return this.f?this.f.presentationTimeline.isLive():!1};_.h.Xf=function(){this.log.debug("User seeking finished");this.D&&Ry(this);Sy(this)};_.h.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:gv(a,0),end:fv(a)}}return{start:0,end:0}};
246
+ _.h.getPlaybackRate=function(){if(this.tc){var a=this.tc;a=a.h?0:a.g}else a=0;return a};
247
+ _.h.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.C===ty){this.tc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.h.get(_.Ie)){var d=a.stream;if(d)if(b.a.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Mb&&(b.a.debug("Engaging trick mode stream",c),_.Lx(b,c,!1,0),a.Mb=d);else if(d=a.Mb)b.a.debug("Restoring non-trick-mode stream",d),a.Mb=null,_.Lx(b,d,!0,0)}}};
248
+ _.h.ea=function(){if(this.f&&this.w){var a=Jy(this);if(null==a)a=null;else{if(!Mw(this.M,a).text){var b=_.jw(a.textStreams,this.wa,this.kb);b.length&&(b=b[0],Mw(this.M,a).text=b)}a=Mw(this.M,a).text}b=[];for(var c=_.t(qz(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=gw(d);e.active=d==a;b.push(e)}return b}return[]};_.h.getPeriods=function(){return this.f.periods};
249
+ _.h.getStats=function(){if(this.C!==ty)return _.Dl();Sy(this);var a=this.h;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.G,c=Number(a.totalVideoFrames);b.h=Number(a.droppedVideoFrames);b.g=c}if(this.C===ty){if(a=dz(this))this.G.A=a.bandwidth;a&&a.video&&(b=this.G,c=a.video.height||NaN,b.j=a.video.width||NaN,b.f=c);a=this.g.getBandwidthEstimate();this.G.m=a}return this.G.getStats()};
250
+ _.h.getTimelineCues=function(){return this.qc?_.df(this.qc.cues()).concat().map(function(a){return{schemeIdUri:a.schemeIdUri,value:a.value,startTime:a.startTime,endTime:a.endTime,id:a.id,eventElement:a.eventElement,type:a.type}}):[]};_.h.resetAbr=function(){this.g&&this.g.reset()};
251
+ _.h.addTextTrack=function(a,b,c,d,e,f){var g=this,k,l,m,n,p,q,r,x,y;return _.z(function(C){if(1==C.a){if(g.C!==ty)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");k=Jy(g);l=_.fm;m=g.f.periods.indexOf(k);n=m+1;p=n>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[n].startTime;q=p-k.startTime;if(Infinity==q)throw new _.J(1,4,4040);r=new _.Zu(1,0,q,function(){return[a]},0,null,0);x={id:g.ig++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
252
+ findSegmentPosition:function(){return 1},getSegmentReference:function(I){return 1==I?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,label:f||null,type:l.TEXT,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,closedCaptions:null};g.yd.add(x);k.textStreams.push(x);return _.v(C,Kx(g.a,x),2)}if(y=_.Dx(g.a,_.te))Mw(g.M,k).text=y;g.yd["delete"](x);g.log.debug("Choosing new streams after adding a text stream");
253
+ Ly(g,k);My(g);return C["return"](gw(x))})};_.h.vh=function(a){this.log.debug(_.Zt,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=oz(this,a);this.log.debug("onChooseStreams_, chose variant ",b.variant);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(c){return this.onError(c),{variant:null,text:null}}};
254
+ _.h.uh=function(){this.log.debug("canSwitch_");this.T=!1;this.configuration.abr.enabled&&this.g.enable();this.ca&&(Mx(this.a,this.ca,this.ag,this.$f),this.ca=null);this.Y&&(_.Lx(this.a,this.Y,!0,0),this.Y=null)};_.h.wh=function(){this.B&&this.B.update&&this.B.update()};_.h.hj=function(){this.w&&this.w.j.Ed()};
255
+ _.h.Fg=function(a,b){b=void 0===b?!1:b;var c=Jy(this),d=c.variants.some(function(k){var l=!1,m=k[a.type];m&&(l=k.allowedByApplication&&m.id!==a.id,a.type===_.$b&&(l=l&&m.language===a.language));return l})&&(this.ka()||b);if(d){for(var e=_.t(c.variants),f=e.next();!f.done;f=e.next()){f=f.value;var g=f[a.type];g&&g.id===a.id&&(f.allowedByApplication=!1)}My(this);!this.ka()&&b&&(this.configuration.abr.enabled=!0,this.g.enable());Ly(this,c)}return d};
256
+ _.h.Ui=function(){this.log.debug("endOfStream called by streaming engine");this.Lc=!0};_.h.onError=function(a){if(this.C!==xy&&7001!==a.code&&7E3!==a.code){var b=new _.E(_.Xc,{detail:a});a.severity===_.K&&wy(this,_.Sl);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.h.$d=function(a){a.type===_.Qc?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Re?Dy(this):"emsg"!==a.type&&(a instanceof _.E?this.dispatchEvent(a):this.log.debug("Unhandled/ignored event",a.type)))};_.h.ka=function(){return this.configuration.abr.enabled};
257
+ _.h.Jj=function(a){var b=this,c,d,e,f,g,k,l,m;return _.z(function(n){switch(n.a){case 1:if(!b.Na)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ka();return _.v(n,b.Na(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.H.Sa(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.v(n,qy(b.a),3);case 3:g=dz(b);case 4:return k=!1,_.rf(n,7),b.log.info("Switching CDN to "+f.url+"."),_.v(n,rz(b,f,g),9);case 9:_.sf(n,6);break;case 7:return l=_.tf(n),b.log.info("Switch failed"),
258
+ _.v(n,b.Na(f.url,a),10);case 10:if(m=n.f)f.url=m,k=!0;else throw l;case 6:k?n.H(4):(d&&b.g.enable(),my(b.a,!0),b.o[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.E(_.pc,{newManifest:f.url})),_.w(n))}})};var xy=0,sy=1,ty=2,Ky=[_.Kd,_.cd];sz.prototype.a=function(){return Xt};
259
+ sz.prototype.canPlay=function(a,b){if(_.vi())return 0;var c=a.type||"",d=window.MediaSource&&MediaSource.isTypeSupported?!0:!1,e=window.MediaSource&&MediaSource.isTypeSupported?c in _.ro||_.so(a.url)in _.to?!0:!1:!1;if(d&&e){if(_.hi(2))return 1;if(_.wi()&&c===_.Yb){if(b.streaming.preferNativeHlsOnSafari)return 1;_.B("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};sz.prototype.create=function(){return new uy};_.Qf(new sz);_.Mm(function(){_.Kf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Jf("Patching Chromecast MSE bugs."),xz();else if(_.wi()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;vz();10>=a?(_.Jf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Jf("Patching Safari 11 \x26 12 MSE bugs."),tz(),uz()):(_.Jf("Patching Safari 13 MSE bugs."),tz())}else _.hi(2)||_.hi(3)||
260
+ _.hi(4)?wz():_.Jf("Using native MSE as-is.");else _.Jf("No MSE implementation available.")});_.u(yz,_.Zo);_.h=yz.prototype;
261
+ _.h.append=function(a){function b(e){if(e.startTime>=e.endTime)_.B("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.eh(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.rc}catch(g){f.align="middle"}e.writingMode===_.Ge?f.vertical="lr":e.writingMode===_.He&&(f.vertical="rl");e=f}e&&c.push(e)}var c=[],d=_.t(a);for(a=d.next();!a.done;a=d.next())b(a.value);a=c.slice().sort(function(e,f){return e.startTime!==f.startTime?
262
+ e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.t(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.h.remove=function(a,b){if(!this.a)return!1;zz(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.h.isTextVisible=function(){return this.a.mode==_.de};_.h.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.de:_.ad)};_.h.destroy=function(){this.a&&zz(this.a,function(){return!0});this.a=null;return Promise.resolve()};Az.prototype.W=function(){return!0};Az.prototype.create=function(a){return new yz(a)};Az.prototype.create=Az.prototype.create;Az.prototype.isSupported=Az.prototype.W;_.tl(_.fe,new Az);};
263
263
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
264
264
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
265
265
  else{_=this.clpp._;(f.call(g,this));}