@castlabs/prestoplay 6.6.0 → 6.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +17 -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 +110 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +406 -406
  8. package/cjs/cl.crypto.js +8 -8
  9. package/cjs/cl.dash.js +71 -71
  10. package/cjs/cl.externs.js +17 -6
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +49 -48
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +256 -257
  17. package/cjs/cl.muxdata.js +12 -12
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +71 -70
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  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 +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +357 -356
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +66 -66
  38. package/cl.externs.js +17 -6
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +40 -40
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +16 -16
  44. package/cl.mse.js +199 -200
  45. package/cl.muxdata.js +8 -8
  46. package/cl.onboard.js +2 -2
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +4 -4
  49. package/cl.smooth.js +59 -58
  50. package/cl.thumbnails.js +16 -16
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +12 -12
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +13 -13
  56. package/cl.vtt.js +11 -11
  57. package/cl.youbora.js +15 -15
  58. package/package.json +5 -1
  59. package/typings.d.ts +100 -96
package/cjs/cl.mse.js CHANGED
@@ -1,268 +1,267 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Su,Tu,Uu,Vu,Wu,Xu,Yu,Zu,$u,av,dv,ev,gv,hv,iv,jv,kv,lv,nv,pv,qv,rv,sv,uv,wv,xv,yv,Dv,Ev,Fv,Gv,Iv,Lv,Mv,Nv,Ov,Qv,Sv,Uv,Wv,Xv,Yv,Zv,$v,hw,lw,ow,nw,pw,qw,rw,sw,ww,zw,yw,Aw,Bw,Ew,Fw,Gw,Hw,Jw,Lw,Nw,Mw,Ow,Rw,Pw,Tw,Uw,Vw,Xw,Ww,Yw,$w,ax,cx,bx,Zw,dx,fx,ex,lx,ix,gx,jx,kx,mx,nx,qx,px,rx,sx,tx,hx,ux,wx,ox,xx,yx,zx,Ax,Bx,Cx,Dx,Ex,Gx,Hx,Fx,Px,Ox,Qx,Rx,Sx,Ux,Vx,Xx,Wx,Yx,ay,Zx,$x,cy,by,dy,ey,hy,jy,iy,ky,ly,my,ny,py,qy,ry,oy,ty,sy,xy,yy,Ay,wy,vy,By,uy,zy,Fy,Hy,Ey,Iy,Dy,Gy,Cy,Ky,Jy,My,Oy,Qy,Ry,Wy,Zy,az,fz,iz,cz,
3
- kz,Uy,lz,Sy,jz,oz,mz,dz,hz,rz,qz,nz,Bz,xz,yz,sz,Cz,tz,vz,Fz,Ez,wz,Dz,Gz,Ty,bz,uz,gz,Vy,Xy,Yy,Hz,Iz,zz,ez,Az,Lz,Mz,Nz,Tz,Rz,Qz,Pz,Sz,Vz,Zz,fA,qA,Yz,kA,lA,mA,gA,nA,dA,tA,Lx,Jx,Mx,Kx,Nx,Ix,yA,wA,iA,eA,pA,zA,xA,BA,oA,rA,Uz,hA,CA,cA,sA,FA,jA,bA,EA,DA,Wz,AA,vA,HA,$z,uA,GA,IA,Xz,JA,KA,LA,MA,NA,OA,PA,QA,RA,zv;Su=" buffer";Tu=" is being or has been set up";Uu="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";Vu="\x3c/LA_URL\x3e";Wu="\x3cLA_URL\x3e";Xu='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
4
- Yu="Choosing new streams after key status change";Zu="IterateSegmentReference";$u="Jumping forward";av="MediaSource threw QuotaExceededError:";_.bv="No stream with id";_.cv="Player is in ERROR state and can not switch to ";dv="PrestoPlay TextTrack";ev="Removing audio from variant - audio not compatible with platform";_.fv="Updating manifest...";gv="bufferBehind\x3d";hv="bufferedBehind\x3d";iv="calling onCanSwitch()...";jv="cannot find segment";kv="clpp.mse.Player";lv="currentPeriod.startTime\x3d";
5
- _.mv="getSegmentNextReference";nv="key-restriction";_.ov="onChooseStreams_";pv="presentationTime:";qv="presentationTime\x3d";rv="reference.endTime\x3d";sv="reference.position\x3d";uv="reference.startTime\x3d";_.vv="subtitles";wv="switch: Stream ";xv=function(a,b){for(var c in a.a)b(c,a.a[c])};yv=function(a){for(var b=a.a;_.Fk(a)&&0!==a.f.getUint8(a.a);)a.a+=1;b=a.f.buffer.slice(b,a.a);a.a+=1;return _.vh(b)};
6
- _.Av=function(a){var b=new Uint8Array(zv),c=4+b.byteLength+a.h.byteLength+4+a.f.byteLength,d=new _.Bk(c,!1);_.T(d,c);_.Dk(d,b);_.Dk(d,a.h);_.T(d,a.f.byteLength);_.Dk(d,a.f);return _.N(d.buffer)};
7
- _.Bv=function(a,b,c,d){var e=_.lk(b);if(8!==e.byteLength)e="";else{var f=_.Ll(e);e=_.ik(f);b:switch(f=f.byteLength,_.Sf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[Xu+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?Wu+d+Vu:"",Uu].join("");break b;case "4.1.0.0":e=[Xu+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
8
- c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?Wu+d+Vu:"",Uu].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[Xu+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?Wu+d+Vu:"",Uu].join("");break b;default:_.G("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Sf("New payload",e);e=_.N(_.Ah(e,!0));return new _.Il(_.Ml,
9
- b,d||null,e,a,c)};_.Cv=function(a,b){return b===a.version?a:_.Bv(b,a.a,a.j||void 0,a.g||void 0)};Dv=function(a,b){a:{if(b){var c=_.u(a.g.keys());for(var d=c.next();!d.done;d=c.next()){d=a.g.get(d.value);for(var e=0;e<d.cb.length;e++)if(d.cb[e]===b){c=d;break a}}}c=null}return c?c.za:null};Ev=function(a,b){return _.Ui("Edge/")?!0:a.N.has(b)};Fv=function(a,b){var c=a.m.get(b);return!(!c||c!==_.Td&&c!==_.od)};
10
- Gv=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!Ev(a,_.Oi(c.mimeType,c.codecs))||d&&d.encrypted&&!Ev(a,_.Oi(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};_.Hv=function(a,b){return a.concat(b)};Iv=function(){};
11
- _.Jv=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Lg(d)});return a.map(function(d){return new _.Lg(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.Hv,[]).map(function(d){return d.toString()})};_.Kv=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
12
- Lv=function(a,b){for(var c in b)if(b[c]===a)return c;return""};Mv=function(a,b){for(var c=0,d=_.u(a),e=d.next();!e.done;e=d.next())c+=b(e.value)?1:0;return c};Nv=function(a,b){a=_.Ki(a);b=_.Ki(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};Ov=function(a){return a.language?_.Ki(a.language):a.audio&&a.audio.language?_.Ki(a.audio.language):a.video&&a.video.language?_.Ki(a.video.language):_.Ie};
13
- _.Pv=function(a,b){for(var c=_.Ki(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.Ki(f.value));e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,f==c)return f;e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,Nv(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.Ki(g);h=_.Ki(h);g=g.split("-");h=h.split("-");if(2==g.length&&2==h.length&&g[0]==h[0])return f}d=_.u(d);for(f=d.next();!f.done;f=d.next())if(e=f.value,Nv(c,e))return e;return null};
14
- Qv=function(a){var b=[a.mimeType];_.Aq.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};_.Rv=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};Sv=function(a,b){for(var c=new _.Qj(void 0,void 0===b?"total":b),d=_.u(a),e=d.next();!e.done;e=d.next())c.a.push(e.value);c.length=a.length;return c};
15
- _.Tv=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={},f=0;f<b.length;e={Oc:e.Oc},f++)if(a[d].keySystem===b[f].keySystem&&a[d].periodId===b[f].periodId){var g=a[d];f=b[f];var h=[];h=h.concat(g.initData||[]);h=h.concat(f.initData||[]);e.Oc=_.mf(g.keyIds||[]).concat();f.keyIds&&f.keyIds.length&&f.keyIds.forEach(function(l){return function(m){l.Oc.includes(m)||l.Oc.push(m)}}(e));c.push({keySystem:g.keySystem,licenseServerUri:g.licenseServerUri||f.licenseServerUri,
16
- distinctiveIdentifierRequired:g.distinctiveIdentifierRequired||f.distinctiveIdentifierRequired,persistentStateRequired:g.persistentStateRequired||f.persistentStateRequired,videoRobustness:g.videoRobustness||f.videoRobustness,audioRobustness:g.audioRobustness||f.audioRobustness,serverCertificate:g.serverCertificate||f.serverCertificate,initData:h,keyIds:e.Oc,periodId:g.periodId});break}return c};Uv=function(a,b){return a.start-b.start};
17
- _.Vv=function(a){this.m=a;this.log=new _.H("clpp.renditions");this.f=[];this.j=this.a=null;this.h=!1};Wv=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}})};Xv=function(a){a.a&&a.a.trigger(new _.J(_.pc))};
18
- Yv=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(_.Fe,a.g,a),a.h=!0):!b&&a.h&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.Fe,a.g),a.h=!1)}};Zv=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 _.J(_.Ue))};
19
- $v=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,b>=e.startTime&&(c=e);return c};_.aw=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.bw=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)};_.cw=function(a){return a.a/(1-Math.pow(a.g,a.f))};
20
- _.dw=function(a,b,c,d,e,f,g,h){a=_.Oh(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);h&&(a.timescale=h);return a};_.ew=function(a,b,c,d,e){this.Ha=a;this.Qa=b;this.Ea=c;this.keyInfo=d||null;this.Zb=_.K.S(e)?!1:!!e};
21
- _.fw=function(a,b,c,d,e,f,g,h,l,m,n,p,q,r){m=void 0===m?null:m;n=void 0===n?null:n;p=void 0===p?null:p;q=void 0===q?null:q;r=void 0===r?[]:r;this.position=a;this.startTime=b;this.endTime=c;this.Aa=g;this.Ha=d;this.Qa=e;this.Ea=f;this.keyInfo=h||null;this.Zb=_.K.S(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q;this.a=r||[];this.g=!1};
22
- _.gw=function(a,b,c,d){var e=void 0===e?!1:e;this.o=a;this.Re=b;this.ic=this.g=Infinity;this.a=1;this.w=0;this.f=this.h=null;this.A=0;this.m=this.j=c;this.F=void 0===d?!0:d;this.B=new _.H("clpp.media.PresentationTimeline");this.D=e};hw=function(a){return a.j?a.g:a.m?a.f:null};
23
- _.jw=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.iw(a,b[0].startTime+c);a.a=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.a);a.f=Math.max(a.f||0,d);null!=a.o&&a.F&&(a.o=(Date.now()+a.A)/1E3-a.f-a.a);a.B.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.iw=function(a,b){a.h=null==a.h?b:Math.min(a.h,b)};_.kw=function(a,b){a.a=Math.max(a.a,b);a.B.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
24
- _.mw=function(a){return Infinity==a.ic?0:Math.max(0,lw(a)-a.ic)};lw=function(a){if(a.j)a=a.g;else if(a.m)a=a.f||0;else{var b=(Date.now()+a.A)/1E3;a=Math.min(a.D?Math.max(0,b-(a.a-a.w)-a.o):Math.max(0,b-a.a-a.o),a.g)}return a};ow=function(a,b){var c=Math.max(a.h,0);return Infinity==a.ic?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(lw(a)-a.ic+b,nw(a)))};nw=function(a){return Math.max(0,lw(a)-(a.j||a.m?0:a.Re))};pw=function(){this.f=function(){};this.a=new Set};qw=function(a,b){a.f=b};
25
- rw=function(a,b,c){this.g=a;this.a=b;this.f=c;new _.H("clpp.media.SegmentIterator")};sw=function(a){var b=a.g.get(a.a);if(!b)return null;0<b.a.length&&b.Ha().length&&a.f>=b.a.length&&(a.a+=1,a.f=0,b=a.g.get(a.a));return b&&0<b.a.length?b.a[a.f]||null:b};_.tw=function(a){this.a=a;this.f=new _.H("clpp.media.SegmentIndex")};_.uw=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.vw=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=[]};
26
- ww=function(a,b){var c=a.Bc(b);c=null===c?-1:c-1;var d=a.get(c+1),e=-1;if(d&&0<d.a.length)for(var f=d.a.length-1;0<=f;--f){var g=d.a[f];if(b>=g.startTime&&b<g.endTime){for(;f&&!g.g;)--f,g=d.a[f];if(!g.g)break;c+=1;e=f-1;break}}return new rw(a,c,e)};
27
- _.xw=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 _.fw(c.position,c.startTime,b,c.Ha,c.Qa,c.Ea,c.Aa,c.keyInfo,c.Zb,c.timescale,c.horizontalTiles,c.verticalTiles,c.durationPerTile))}};zw=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.Ri(function(){yw(b,!1)})).bb(.25)};yw=function(a,b){for(var c=_.u(a.a),d=c.next();!d.done;d=c.next())d.value.m(a.f.currentTime,b)};
28
- Aw=function(a){var b=this;this.j=a;this.h=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.o=[{oc:null,nc:2,cc:function(c,d){return b.a(c,d)}},{oc:1,nc:2,cc:function(c,d){return b.a(c,d)}},{oc:3,nc:2,cc:function(c,d){return b.a(c,d)}},{oc:2,nc:1,cc:function(c,d){return b.f(c,d)}},{oc:2,nc:3,cc:function(c,d){return b.f(c,d)}},{oc:1,nc:3,cc:function(c,d){return b.g(c,d)}},{oc:3,nc:1,cc:function(c,d){return b.g(c,d)}}]};Bw=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
29
- _.Cw=function(a){_.Fp[a]&&delete _.Fp[a]};_.Dw=function(a){_.Dp[a]&&delete _.Dp[a]};Ew=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};
30
- Fw=function(a,b,c,d){return Promise.resolve().then(function(){if(a.o&&a.g)if(null==c||null==d)a.o.parseInit(_.N(b));else{var e={periodStart:a.w,segmentStart:c,segmentEnd:d};e=a.o.parseMedia(_.N(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)}})};
31
- Gw=function(a,b,c){a.A=b;if(b=a.m.get(b))for(var d=_.u(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,[])};
32
- Hw=function(a,b,c,d,e){var f=c+" "+d,g=new Map;b=_.u(b);for(var h=b.next();!h.done;h=b.next()){var l=h.value;h=l.stream;g.has(h)||g.set(h,new Map);g.get(h).has(f)||g.get(h).set(f,[]);l.startTime+=e;l.endTime+=e;l.startTime>=a.h&&l.startTime<a.j&&(l=new _.zg(l.startTime,l.endTime,l.text),g.get(h).get(f).push(l),h==a.A&&a.g.append([l],[]))}e=_.u(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=_.u(g.get(f).keys()),h=b.next();!h.done;h=b.next())h=h.value,l=g.get(f).get(h),
33
- a.m.get(f).set(h,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))};_.Iw=function(a){a=a.toLowerCase();return _.$p[a]||window.muxjs&&a==_.bc?!0:!1};Jw=function(){this.a=new muxjs.mp4.CaptionParser;this.j=[];this.h={}};_.Kw=function(){};Lw=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))};
34
- Nw=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?MediaSource.isTypeSupported(Mw(b,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Fd)):MediaSource.isTypeSupported(Mw(_.jc,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Fd))||MediaSource.isTypeSupported(Mw(_.Re,a))};
35
- Mw=function(a,b){var c=b.replace(/mp2t/i,_.Fd);a==_.jc&&(c=c.replace(_.Re,_.jc));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};Ow=function(a,b){a.h=!0;a.f=new _.Th;a.m=[];a.j=[];a.g=[];var c=_.N(b);a.a.push(c);a.a.flush();a.h&&a.f.reject(new _.L(_.M,3,3018));return a.f};
36
- _.Qw=function(a,b,c,d,e){this.j=a;this.A=c;this.f={};this.K=!1;this.g=null;this.h={};this.o=new _.eg;this.J=!1;this.w={};this.F=b;this.B=d;this.L=e;this.N=this.L.streaming.maxSegmentToMediaOffset||1;this.I=new _.Th;this.D={};this.m=Pw(this,this.I);this.a=new _.H("clpp.mse.MediaSourceEngine")};Rw=function(a){var b=_.Oi(a.mimeType,a.codecs),c=Qv(a);return _.Iw(b)||MediaSource.isTypeSupported(c)||Nw(b,a.type)};
37
- Pw=function(a,b){var c=new MediaSource,d=Sw(c);a.o.one(c,"sourceopen",function(){URL.revokeObjectURL(d);b.resolve()});a.j.src=d;return c};Tw=function(a,b){b.forEach(function(c,d){var e=a.m.addSourceBuffer(c);a.o.on(e,_.hd,a.U.bind(a,d));a.o.on(e,"updateend",a.Kc.bind(a,d));a.f[d]=e;a.h[d]=[];a.D[d]=!1});a.K=b.has(_.jc)&&b.has(_.Re)};Uw=function(a,b){a.g||(a.g=new Ew(a.L,a.A));var c=a.g;if(b!=_.bc){var d=_.$p[b];if(!d)throw new _.L(_.M,2,2012,"Text parser is unavailable for "+b);c.o=new d(c.B)}};
38
- Vw=function(a){return a.m?a.m.readyState==_.gd:!0};Xw=function(a){var b={};b.total=new _.Qj(a.j.buffered,"total");b.audio=Ww(a,_.jc);b.video=Ww(a,_.Re);var c=[];a.g&&(c=[{start:a.g.rb(),end:a.g.xa()}]);b.text=Sv(c,_.Ce);return b};Ww=function(a,b){try{return new _.Qj(a.f[b].buffered,b)}catch(c){return b in a.f&&a.a.error("failed to get buffered range for "+b,c),null}};
39
- Yw=function(a,b){if(!a.f[b])return"";var c=Ww(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};
40
- $w=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l=a.f[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.Re&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.Ce?c=Fw(a.g,c,d,e):a.w[b]?c=Ow(a.w[b],c).then(function(p){p.captions&&0<p.captions.length&&(a.g||Uw(a,_.De),Hw(a.g,p.captions,d,e,a.f.video.timestampOffset));var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(Zw(a,_.jc,a.me.bind(a,_.jc,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(Zw(a,_.Re,a.me.bind(a,_.Re,p.video.buffer)));
41
- return Promise.all(q)}):(f&&window.muxjs&&(a.g||Uw(a,_.De),null==d&&null==e?a.F.init(c):a.F.g(c,function(p){p.length&&Hw(a.g,p,d,e,a.f.video.timestampOffset)})),c=Zw(a,b,a.me.bind(a,b,c)));return c.then(function(){if(b===_.Re&&null!==d&&null!==e&&!h)a.B.append(d,e,g),null!==d&&null!==e&&a.a.debug("Appended video segment ",d,e,"Buffer:",Yw(a,b));else if(b===_.jc&&null!==d&&null!==e)Xv(a.B),null!==d&&null!==e&&a.a.debug("Appended audio segment ",d,e,"Buffer:",Yw(a,b));else if(b===_.Re&&null!==d&&null!==
42
- e&&h){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.D[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var r=d-p;if(Math.abs(r)>a.N&&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=Zw(a,b,function(){a.vg(b,r)}),q=Zw(a,b,a.Jf.bind(a,b,!1)),Promise.all([p,
43
- q])}null!==d&&null!==e&&(a.D[b]=!0)})["catch"](function(p){throw p;})};ax=function(a,b){var c=a.xa(_.Re)||0;Gw(a.g,b,c)};cx=function(a,b,c,d,e){if(b==_.Ce)return a.g.w=c,a=a.g,a.h=d,a.j=e,Promise.resolve();b=bx(a,b,c,d,e);a.K&&(b=b.concat(bx(a,_.jc,c,d,e)));return Promise.all(b)};bx=function(a,b,c,d,e){return[Zw(a,b,a.Fg.bind(a,b)),Zw(a,b,a.vg.bind(a,b,c)),Zw(a,b,a.Lj.bind(a,b,d,e))]};
44
- Zw=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.Th};a.h[b].push(c);1===a.h[b].length&&dx(a,b);return c.p};dx=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 _.L(_.M,3,3017,{type:b})):c.p.reject(new _.L(_.M,3,3015,{mediaError:d})),ex(a,b)}else a.a.debug("No more scheduled operations for "+b)};
45
- fx=function(a,b){if(a.J)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.Th,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 h=Promise.reject(new _.L(_.M,3,3015,{mediaError:m}))}for(var l in a.f)ex(a,l);return h},function(){for(var g in a.f)a.h[g].length&&a.h[g].shift();return Promise.reject()})};ex=function(a,b){a.h[b].shift();dx(a,b)};
46
- lx=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=gx(e,b,c);e=hx(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=_.u(a.periods);for(var g=c.next();!g.done;g=c.next()){d=new Set;g=_.u(g.value.variants);for(var h=g.next();!h.done;h=g.next())h=h.value,null!==h.audio&&d.add(f(h.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<b.length;c={Xd:c.Xd},d++)c.Xd=b[d],l=new Set(_.mf(l).concat().filter(function(n){return function(p){return n.Xd.has(p)}}(c)));
47
- 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=ix(e);var m=jx(e);a=_.u(a.periods);for(e=a.next();!e.done;e=a.next())e=e.value,e.variants=e.variants.filter(function(n){if(kx(n)===m)return!0;_.Sf("Dropping Variant (better codec available)",n);return!1})};ix=function(a){var b=new _.bg;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=kx(c);b.push(d,c)}return b};
48
- gx=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={be:d.be},e=b.next())if(d.be=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.be)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={Vd:d.Vd},b=c.next())if(d.Vd=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.Vd)}}(d)),b.length){a=b;break}return a};
49
- jx=function(a){var b="",c=Infinity;xv(a,function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.Sf(_.Mc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};kx=function(a){var b="";a.video&&(b=_.Rv(a.video.codecs)[0]);var c="";a.audio&&(c=_.Rv(a.audio.codecs)[0]);return b+"-"+c};
50
- mx=function(a,b,c){function d(f,g,h){return f>=g&&f<=h}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};nx=function(a,b,c){var d=!1;a=_.u(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=mx(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
51
- qx=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.$&&!Gv(a,m))return _.Sf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!Rw(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Sf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),Rw(n)?_.Rf("Using AC-3 instead of EC-3 for",ox(n)):(n.codecs=q,_.Rf(ev,ox(n)),m.audio=null,e=!0,n=null)):(_.Rf(ev,ox(n)),m.audio=null,e=!0,n=null)}return p&&!Rw(p)?(_.Rf("Dropping variant - video not compatible with platform",
52
- ox(p)),!1):n&&b&&!px(n,b)?(_.Rf("Dropping variant - not compatible with active audio","active audio",ox(b),"variant.audio",ox(n)),!1):p&&c&&!px(p,c)?(_.Rf("Dropping variant - not compatible with active video","active video",ox(c),"variant.video",ox(p)),!1):!0});if(e){for(var f=!1,g=!1,h=_.u(d.variants),l=h.next();!l.done;l=h.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?(_.Rf("Dropping variant - not compatible with video + audio",
53
- "variant.video",ox(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.Iw(_.Oi(m.mimeType,m.codecs));n||_.Sf("Dropping text stream. Is not supported by the platform.",m);return n})};px=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
54
- rx=function(a){var b=a.audio,c=a.video,d=b?b.codecs:null,e=c?c.codecs:null,f=[];e&&f.push(e);d&&f.push(d);var g=c&&c.mimeType||null,h=b&&b.mimeType||null,l=[];b&&l.push(b.kind);c&&l.push(c.kind);l=l[0]||null;var m=new Set,n=new Set;if(b)for(var p=_.u(b.roles),q=p.next();!q.done;q=p.next())n.add(q.value);if(c)for(p=_.u(c.roles),q=p.next();!q.done;q=p.next())m.add(q.value);q=[c,b].map(function(r){return r?r.accessibility||[]:[]}).reduce(function(r,w){return r.concat(w)},[]);a={id:a.id,active:!1,type:"variant",
2
+ var f=function(window){var Tu,Uu,Vu,Wu,Xu,Yu,Zu,$u,av,bv,ev,fv,hv,iv,jv,kv,lv,mv,ov,qv,rv,sv,uv,vv,xv,yv,zv,Ev,Fv,Gv,Hv,Jv,Mv,Nv,Ov,Pv,Rv,Tv,Vv,Xv,Yv,Zv,$v,aw,iw,mw,pw,ow,qw,rw,sw,tw,xw,Aw,zw,Bw,Cw,Fw,Gw,Hw,Iw,Kw,Mw,Ow,Nw,Pw,Sw,Qw,Uw,Vw,Ww,Yw,Xw,Zw,ax,bx,dx,cx,$w,ex,gx,fx,mx,jx,hx,kx,lx,nx,ox,rx,qx,sx,tx,ux,ix,vx,xx,px,yx,zx,Ax,Bx,Cx,Dx,Ex,Fx,Hx,Ix,Gx,Qx,Px,Rx,Sx,Tx,Vx,Wx,Yx,Xx,Zx,by,$x,ay,dy,cy,ey,fy,iy,ky,jy,ly,my,ny,oy,qy,ry,sy,py,uy,ty,yy,zy,By,xy,wy,Cy,vy,Ay,Gy,Iy,Fy,Jy,Ey,Hy,Dy,Ly,Ky,Ny,Py,Ry,Sy,Xy,$y,bz,gz,jz,dz,
3
+ lz,Vy,mz,Ty,kz,pz,nz,ez,iz,sz,rz,oz,Cz,yz,zz,tz,Dz,uz,wz,Gz,Fz,xz,Ez,Hz,Uy,cz,vz,hz,Wy,Yy,Zy,Iz,Jz,Az,fz,Bz,Mz,Nz,Oz,Uz,Sz,Rz,Qz,Tz,Wz,$z,gA,rA,Zz,lA,mA,nA,hA,oA,eA,uA,Mx,Kx,Nx,Lx,Ox,Jx,zA,xA,jA,fA,qA,AA,yA,CA,pA,sA,Vz,iA,DA,dA,tA,GA,kA,cA,FA,EA,Xz,BA,wA,IA,aA,vA,HA,JA,Yz,KA,LA,MA,NA,OA,PA,QA,RA,SA,Av;Tu=" buffer";Uu=" is being or has been set up";Vu="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";Wu="\x3c/LA_URL\x3e";Xu="\x3cLA_URL\x3e";Yu='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
4
+ Zu="Choosing new streams after key status change";$u="IterateSegmentReference";av="Jumping forward";bv="MediaSource threw QuotaExceededError:";_.cv="No stream with id";_.dv="Player is in ERROR state and can not switch to ";ev="PrestoPlay TextTrack";fv="Removing audio from variant - audio not compatible with platform";_.gv="Updating manifest...";hv="bufferBehind\x3d";iv="bufferedBehind\x3d";jv="calling onCanSwitch()...";kv="cannot find segment";lv="clpp.mse.Player";mv="currentPeriod.startTime\x3d";
5
+ _.nv="getSegmentNextReference";ov="key-restriction";_.pv="onChooseStreams_";qv="presentationTime:";rv="presentationTime\x3d";sv="reference.endTime\x3d";uv="reference.position\x3d";vv="reference.startTime\x3d";_.wv="subtitles";xv="switch: Stream ";yv=function(a,b){for(var c in a.a)b(c,a.a[c])};zv=function(a){for(var b=a.a;_.Gk(a)&&0!==a.f.getUint8(a.a);)a.a+=1;b=a.f.buffer.slice(b,a.a);a.a+=1;return _.vh(b)};
6
+ _.Bv=function(a){var b=new Uint8Array(Av),c=4+b.byteLength+a.h.byteLength+4+a.f.byteLength,d=new _.Ck(c,!1);_.T(d,c);_.Ek(d,b);_.Ek(d,a.h);_.T(d,a.f.byteLength);_.Ek(d,a.f);return _.N(d.buffer)};
7
+ _.Cv=function(a,b,c,d){var e=_.mk(b);if(8!==e.byteLength)e="";else{var f=_.Ml(e);e=_.jk(f);b:switch(f=f.byteLength,_.Sf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[Yu+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?Xu+d+Wu:"",Vu].join("");break b;case "4.1.0.0":e=[Yu+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
8
+ c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?Xu+d+Wu:"",Vu].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[Yu+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?Xu+d+Wu:"",Vu].join("");break b;default:_.G("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Sf("New payload",e);e=_.N(_.Ah(e,!0));return new _.Jl(_.Nl,
9
+ b,d||null,e,a,c)};_.Dv=function(a,b){return b===a.version?a:_.Cv(b,a.a,a.j||void 0,a.g||void 0)};Ev=function(a,b){a:{if(b){var c=_.u(a.g.keys());for(var d=c.next();!d.done;d=c.next()){d=a.g.get(d.value);for(var e=0;e<d.bb.length;e++)if(d.bb[e]===b){c=d;break a}}}c=null}return c?c.Aa:null};Fv=function(a,b){return _.Vi("Edge/")?!0:a.M.has(b)};Gv=function(a,b){var c=a.m.get(b);return!(!c||c!==_.Ud&&c!==_.pd)};
10
+ Hv=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!Fv(a,_.Pi(c.mimeType,c.codecs))||d&&d.encrypted&&!Fv(a,_.Pi(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};_.Iv=function(a,b){return a.concat(b)};Jv=function(){};
11
+ _.Kv=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Lg(d)});return a.map(function(d){return new _.Lg(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.Iv,[]).map(function(d){return d.toString()})};_.Lv=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
12
+ Mv=function(a,b){for(var c in b)if(b[c]===a)return c;return""};Nv=function(a,b){for(var c=0,d=_.u(a),e=d.next();!e.done;e=d.next())c+=b(e.value)?1:0;return c};Ov=function(a,b){a=_.Ji(a);b=_.Ji(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};Pv=function(a){return a.language?_.Ji(a.language):a.audio&&a.audio.language?_.Ji(a.audio.language):a.video&&a.video.language?_.Ji(a.video.language):_.Ie};
13
+ _.Qv=function(a,b){for(var c=_.Ji(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.Ji(f.value));e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,f==c)return f;e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,Ov(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.Ji(g);h=_.Ji(h);g=g.split("-");h=h.split("-");if(2==g.length&&2==h.length&&g[0]==h[0])return f}d=_.u(d);for(f=d.next();!f.done;f=d.next())if(e=f.value,Ov(c,e))return e;return null};
14
+ Rv=function(a){var b=[a.mimeType];_.Bq.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};_.Sv=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};Tv=function(a,b){for(var c=new _.Rj(void 0,void 0===b?"total":b),d=_.u(a),e=d.next();!e.done;e=d.next())c.a.push(e.value);c.length=a.length;return c};
15
+ _.Uv=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={},f=0;f<b.length;e={Nc:e.Nc},f++)if(a[d].keySystem===b[f].keySystem&&a[d].periodId===b[f].periodId){var g=a[d];f=b[f];var h=[];h=h.concat(g.initData||[]);h=h.concat(f.initData||[]);e.Nc=_.mf(g.keyIds||[]).concat();f.keyIds&&f.keyIds.length&&f.keyIds.forEach(function(l){return function(m){l.Nc.includes(m)||l.Nc.push(m)}}(e));c.push({keySystem:g.keySystem,licenseServerUri:g.licenseServerUri||f.licenseServerUri,
16
+ distinctiveIdentifierRequired:g.distinctiveIdentifierRequired||f.distinctiveIdentifierRequired,persistentStateRequired:g.persistentStateRequired||f.persistentStateRequired,videoRobustness:g.videoRobustness||f.videoRobustness,audioRobustness:g.audioRobustness||f.audioRobustness,serverCertificate:g.serverCertificate||f.serverCertificate,initData:h,keyIds:e.Nc,periodId:g.periodId});break}return c};Vv=function(a,b){return a.start-b.start};
17
+ _.Wv=function(a){this.j=a;this.log=new _.H("clpp.renditions");this.X=[];this.h=this.a=null;this.g=!1};Xv=function(a){return a.X.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};Yv=function(a){a.a&&a.a.trigger(new _.J(_.rc))};
18
+ Zv=function(a){if(a.a){for(var b=!1,c={},d=0;d<a.X.length;d++){var e=a.X[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.g?(a.log.debug("Tracking timeupdates"),a.a.on(_.Fe,a.f,a),a.g=!0):!b&&a.g&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.Fe,a.f),a.g=!1)}};$v=function(a,b,c){a.X=a.X.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 _.J(_.Ue))};
19
+ aw=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,b>=e.startTime&&(c=e);return c};_.bw=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.cw=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)};_.dw=function(a){return a.a/(1-Math.pow(a.g,a.f))};
20
+ _.ew=function(a,b,c,d,e,f,g,h){a=_.Nh(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);h&&(a.timescale=h);return a};_.fw=function(a,b,c,d,e){this.Ga=a;this.$a=b;this.Oa=c;this.keyInfo=d||null;this.Bc=_.K.R(e)?!1:!!e};
21
+ _.gw=function(a,b,c,d,e,f,g,h,l,m,n,p,q,r){m=void 0===m?null:m;n=void 0===n?null:n;p=void 0===p?null:p;q=void 0===q?null:q;r=void 0===r?[]:r;this.position=a;this.startTime=b;this.endTime=c;this.Ja=g;this.Ga=d;this.$a=e;this.Oa=f;this.keyInfo=h||null;this.Bc=_.K.R(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q;this.a=r||[];this.g=!1};
22
+ _.hw=function(a,b,c,d){var e=void 0===e?!1:e;this.o=a;this.Qe=b;this.gc=this.g=Infinity;this.a=1;this.w=0;this.f=this.h=null;this.A=0;this.m=this.j=c;this.F=void 0===d?!0:d;this.B=new _.H("clpp.media.PresentationTimeline");this.D=e};iw=function(a){return a.j?a.g:a.m?a.f:null};
23
+ _.kw=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.jw(a,b[0].startTime+c);a.a=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.a);a.f=Math.max(a.f||0,d);null!=a.o&&a.F&&(a.o=(Date.now()+a.A)/1E3-a.f-a.a);a.B.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.jw=function(a,b){a.h=null==a.h?b:Math.min(a.h,b)};_.lw=function(a,b){a.a=Math.max(a.a,b);a.B.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
24
+ _.nw=function(a){return Infinity==a.gc?0:Math.max(0,mw(a)-a.gc)};mw=function(a){if(a.j)a=a.g;else if(a.m)a=a.f||0;else{var b=(Date.now()+a.A)/1E3;a=Math.min(a.D?Math.max(0,b-(a.a-a.w)-a.o):Math.max(0,b-a.a-a.o),a.g)}return a};pw=function(a,b){var c=Math.max(a.h,0);return Infinity==a.gc?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(mw(a)-a.gc+b,ow(a)))};ow=function(a){return Math.max(0,mw(a)-(a.j||a.m?0:a.Qe))};qw=function(){this.f=function(){};this.a=new Set};rw=function(a,b){a.f=b};
25
+ sw=function(a,b,c){this.g=a;this.a=b;this.f=c;new _.H("clpp.media.SegmentIterator")};tw=function(a){var b=a.g.get(a.a);if(!b)return null;0<b.a.length&&b.Ga().length&&a.f>=b.a.length&&(a.a+=1,a.f=0,b=a.g.get(a.a));return b&&0<b.a.length?b.a[a.f]||null:b};_.uw=function(a){this.a=a;this.f=new _.H("clpp.media.SegmentIndex")};_.vw=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.ww=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c};
26
+ xw=function(a,b){var c=a.zc(b);c=null===c?-1:c-1;var d=a.get(c+1),e=-1;if(d&&0<d.a.length)for(var f=d.a.length-1;0<=f;--f){var g=d.a[f];if(b>=g.startTime&&b<g.endTime){for(;f&&!g.g;)--f,g=d.a[f];if(!g.g)break;c+=1;e=f-1;break}}return new sw(a,c,e)};_.yw=function(a,b){for(;a.a.length;)if(0>=a.a[0].endTime)a.a.shift();else break;0==a.a.length||a.a[a.a.length-1].startTime>=b||(a.a[a.a.length-1].endTime=b)};Aw=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.Si(function(){zw(b,!1)})).ab(.25)};
27
+ zw=function(a,b){for(var c=_.u(a.a),d=c.next();!d.done;d=c.next())d.value.m(a.f.currentTime,b)};
28
+ Bw=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,ac:function(c,d){return b.a(c,d)}},{mc:1,lc:2,ac:function(c,d){return b.a(c,d)}},{mc:3,lc:2,ac:function(c,d){return b.a(c,d)}},{mc:2,lc:1,ac:function(c,d){return b.f(c,d)}},{mc:2,lc:3,ac:function(c,d){return b.f(c,d)}},{mc:1,lc:3,ac:function(c,d){return b.g(c,d)}},{mc:3,lc:1,ac:function(c,d){return b.g(c,d)}}]};Cw=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
29
+ _.Dw=function(a){_.Gp[a]&&delete _.Gp[a]};_.Ew=function(a){_.Ep[a]&&delete _.Ep[a]};Fw=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};
30
+ Gw=function(a,b,c,d){return Promise.resolve().then(function(){if(a.o&&a.g)if(null==c||null==d)a.o.parseInit(_.N(b));else{var e={periodStart:a.w,segmentStart:c,segmentEnd:d};e=a.o.parseMedia(_.N(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)}})};
31
+ Hw=function(a,b,c){a.A=b;if(b=a.m.get(b))for(var d=_.u(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,[])};
32
+ Iw=function(a,b,c,d,e){var f=c+" "+d,g=new Map;b=_.u(b);for(var h=b.next();!h.done;h=b.next()){var l=h.value;h=l.stream;g.has(h)||g.set(h,new Map);g.get(h).has(f)||g.get(h).set(f,[]);l.startTime+=e;l.endTime+=e;l.startTime>=a.h&&l.startTime<a.j&&(l=new _.zg(l.startTime,l.endTime,l.text),g.get(h).get(f).push(l),h==a.A&&a.g.append([l],[]))}e=_.u(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=_.u(g.get(f).keys()),h=b.next();!h.done;h=b.next())h=h.value,l=g.get(f).get(h),
33
+ a.m.get(f).set(h,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))};_.Jw=function(a){a=a.toLowerCase();return _.aq[a]||window.muxjs&&a==_.cc?!0:!1};Kw=function(){this.a=new muxjs.mp4.CaptionParser;this.j=[];this.h={}};_.Lw=function(){};Mw=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))};
34
+ Ow=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?MediaSource.isTypeSupported(Nw(b,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Hd)):MediaSource.isTypeSupported(Nw(_.kc,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Hd))||MediaSource.isTypeSupported(Nw(_.Re,a))};
35
+ Nw=function(a,b){var c=b.replace(/mp2t/i,_.Hd);a==_.kc&&(c=c.replace(_.Re,_.kc));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};Pw=function(a,b){a.h=!0;a.f=new _.Sh;a.m=[];a.j=[];a.g=[];var c=_.N(b);a.a.push(c);a.a.flush();a.h&&a.f.reject(new _.L(_.M,3,3018));return a.f};
36
+ _.Rw=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 _.eg;this.I=!1;this.w={};this.F=b;this.B=d;this.K=e;this.M=this.K.streaming.maxSegmentToMediaOffset||1;this.H=new _.Sh;this.D={};this.m=Qw(this,this.H);this.a=new _.H("clpp.mse.MediaSourceEngine")};Sw=function(a){var b=_.Pi(a.mimeType,a.codecs),c=Rv(a);return _.Jw(b)||MediaSource.isTypeSupported(c)||Ow(b,a.type)};
37
+ Qw=function(a,b){var c=new MediaSource,d=Tw(c);a.o.one(c,"sourceopen",function(){URL.revokeObjectURL(d);b.resolve()});a.j.src=d;return c};Uw=function(a,b){b.forEach(function(c,d){var e=a.m.addSourceBuffer(c);a.o.on(e,_.jd,a.T.bind(a,d));a.o.on(e,"updateend",a.Jc.bind(a,d));a.f[d]=e;a.h[d]=[];a.D[d]=!1});a.J=b.has(_.kc)&&b.has(_.Re)};Vw=function(a,b){a.g||(a.g=new Fw(a.K,a.A));var c=a.g;if(b!=_.cc){var d=_.aq[b];if(!d)throw new _.L(_.M,2,2012,"Text parser is unavailable for "+b);c.o=new d(c.B)}};
38
+ Ww=function(a){return a.m?a.m.readyState==_.id:!0};Yw=function(a){var b={};b.total=new _.Rj(a.j.buffered,"total");b.audio=Xw(a,_.kc);b.video=Xw(a,_.Re);var c=[];a.g&&(c=[{start:a.g.qb(),end:a.g.ya()}]);b.text=Tv(c,_.Ce);return b};Xw=function(a,b){try{return new _.Rj(a.f[b].buffered,b)}catch(c){return b in a.f&&a.a.error("failed to get buffered range for "+b,c),null}};Zw=function(a,b){if(!a.f[b])return"";var c=Xw(a,b);return c?c.toString():""};
39
+ ax=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l=a.f[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.Re&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.Ce?c=Gw(a.g,c,d,e):a.w[b]?c=Pw(a.w[b],c).then(function(p){p.captions&&0<p.captions.length&&(a.g||Vw(a,_.De),Iw(a.g,p.captions,d,e,a.f.video.timestampOffset));var q=[];0<p.audio.byteLength&&a.f.audio&&q.push($w(a,_.kc,a.me.bind(a,_.kc,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push($w(a,_.Re,a.me.bind(a,_.Re,p.video.buffer)));
40
+ return Promise.all(q)}):(f&&window.muxjs&&(a.g||Vw(a,_.De),null==d&&null==e?a.F.init(c):a.F.g(c,function(p){p.length&&Iw(a.g,p,d,e,a.f.video.timestampOffset)})),c=$w(a,b,a.me.bind(a,b,c)));return c.then(function(){if(b===_.Re&&null!==d&&null!==e&&!h)a.B.append(d,e,g),null!==d&&null!==e&&a.a.debug("Appended video segment ",d,e,"Buffer:",Zw(a,b));else if(b===_.kc&&null!==d&&null!==e)Yv(a.B),null!==d&&null!==e&&a.a.debug("Appended audio segment ",d,e,"Buffer:",Zw(a,b));else if(b===_.Re&&null!==d&&null!==
41
+ e&&h){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.D[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=$w(a,b,function(){a.tg(b,r)}),q=$w(a,b,a.If.bind(a,b,!1)),Promise.all([p,
42
+ q])}null!==d&&null!==e&&(a.D[b]=!0)})["catch"](function(p){throw p;})};bx=function(a,b){var c=a.ya(_.Re)||0;Hw(a.g,b,c)};dx=function(a,b,c,d,e){if(b==_.Ce)return a.g.w=c,a=a.g,a.h=d,a.j=e,Promise.resolve();b=cx(a,b,c,d,e);a.J&&(b=b.concat(cx(a,_.kc,c,d,e)));return Promise.all(b)};cx=function(a,b,c,d,e){return[$w(a,b,a.Dg.bind(a,b)),$w(a,b,a.tg.bind(a,b,c)),$w(a,b,a.Hj.bind(a,b,d,e))]};
43
+ $w=function(a,b,c){if(a.I)return Promise.reject();c={start:c,p:new _.Sh};a.h[b].push(c);1===a.h[b].length&&ex(a,b);return c.p};ex=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 _.L(_.M,3,3017,{type:b})):c.p.reject(new _.L(_.M,3,3015,{mediaError:d})),fx(a,b)}else a.a.debug("No more scheduled operations for "+b)};
44
+ gx=function(a,b){if(a.I)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.Sh,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 h=Promise.reject(new _.L(_.M,3,3015,{mediaError:m}))}for(var l in a.f)fx(a,l);return h},function(){for(var g in a.f)a.h[g].length&&a.h[g].shift();return Promise.reject()})};fx=function(a,b){a.h[b].shift();ex(a,b)};
45
+ mx=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=hx(e,b,c);e=ix(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=_.u(a.periods);for(var g=c.next();!g.done;g=c.next()){d=new Set;g=_.u(g.value.variants);for(var h=g.next();!h.done;h=g.next())h=h.value,null!==h.audio&&d.add(f(h.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<b.length;c={Wd:c.Wd},d++)c.Wd=b[d],l=new Set(_.mf(l).concat().filter(function(n){return function(p){return n.Wd.has(p)}}(c)));
46
+ 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=jx(e);var m=kx(e);a=_.u(a.periods);for(e=a.next();!e.done;e=a.next())e=e.value,e.variants=e.variants.filter(function(n){if(lx(n)===m)return!0;_.Sf("Dropping Variant (better codec available)",n);return!1})};jx=function(a){var b=new _.bg;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=lx(c);b.push(d,c)}return b};
47
+ hx=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={ae:d.ae},e=b.next())if(d.ae=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.ae)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={Ud:d.Ud},b=c.next())if(d.Ud=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.Ud)}}(d)),b.length){a=b;break}return a};
48
+ kx=function(a){var b="",c=Infinity;yv(a,function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.Sf(_.Oc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};lx=function(a){var b="";a.video&&(b=_.Sv(a.video.codecs)[0]);var c="";a.audio&&(c=_.Sv(a.audio.codecs)[0]);return b+"-"+c};
49
+ nx=function(a,b,c){function d(f,g,h){return f>=g&&f<=h}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};ox=function(a,b,c){var d=!1;a=_.u(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=nx(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
50
+ rx=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.$&&!Hv(a,m))return _.Sf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!Sw(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Sf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),Sw(n)?_.Rf("Using AC-3 instead of EC-3 for",px(n)):(n.codecs=q,_.Rf(fv,px(n)),m.audio=null,e=!0,n=null)):(_.Rf(fv,px(n)),m.audio=null,e=!0,n=null)}return p&&!Sw(p)?(_.Rf("Dropping variant - video not compatible with platform",
51
+ px(p)),!1):n&&b&&!qx(n,b)?(_.Rf("Dropping variant - not compatible with active audio","active audio",px(b),"variant.audio",px(n)),!1):p&&c&&!qx(p,c)?(_.Rf("Dropping variant - not compatible with active video","active video",px(c),"variant.video",px(p)),!1):!0});if(e){for(var f=!1,g=!1,h=_.u(d.variants),l=h.next();!l.done;l=h.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?(_.Rf("Dropping variant - not compatible with video + audio",
52
+ "variant.video",px(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.Jw(_.Pi(m.mimeType,m.codecs));n||_.Sf("Dropping text stream. Is not supported by the platform.",m);return n})};qx=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
53
+ sx=function(a){var b=a.audio,c=a.video,d=b?b.codecs:null,e=c?c.codecs:null,f=[];e&&f.push(e);d&&f.push(d);var g=c&&c.mimeType||null,h=b&&b.mimeType||null,l=[];b&&l.push(b.kind);c&&l.push(c.kind);l=l[0]||null;var m=new Set,n=new Set;if(b)for(var p=_.u(b.roles),q=p.next();!q.done;q=p.next())n.add(q.value);if(c)for(p=_.u(c.roles),q=p.next();!q.done;q=p.next())m.add(q.value);q=[c,b].map(function(r){return r?r.accessibility||[]:[]}).reduce(function(r,w){return r.concat(w)},[]);a={id:a.id,active:!1,type:"variant",
55
54
  bandwidth:a.bandwidth,language:a.language,label:null,kind:l,width:null,height:null,frameRate:null,mimeType:g,audioMimeType:h,codecs:f.join(", "),audioCodec:d,videoCodec:e,primary:a.primary,roles:Array.from(m),audioRoles:Array.from(n),videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,accessibility:q,keyId:c?c.keyId:b?b.keyId:null};c&&(a.videoId=c.id,a.originalVideoId=c.originalId,a.width=c.width||null,
56
55
  a.height=c.height||null,a.frameRate=c.frameRate||null,a.videoBandwidth=c.bandwidth||null);b&&(a.audioId=b.id,a.originalAudioId=b.originalId,a.channelsCount=b.channelsCount,a.audioBandwidth=b.bandwidth||null,a.label=b.label,a.audioRoles=b.roles);return a};
57
- sx=function(a){return{id:a.id,active:!1,type:_.Ce,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,accessibility:a.accessibility,keyId:null}};
58
- tx=function(a){return a.allowedByApplication&&a.allowedByKeySystem};hx=function(a,b){var c=a.filter(function(g){return g.audio&&g.audio.channelsCount}),d=new Map;c=_.u(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
- _.vx=function(a,b,c){b=_.Fg(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 h=_.Pv(_.Ki(g),a.map(function(l){return l.language}));return h?(d=a.filter(function(l){return _.Ki(l.language)===h}),!0):!1});if(c){b=ux(d,c);if(b.length)return b;_.G("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(_.Hv,
60
- []);return b.length?ux(d,b[0]):d};ux=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};wx=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
- ox=function(a){var b=Qv(a);return a.type===_.jc?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.Re?"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
- xx=function(a,b){var c=String(_.mi++);c=new _.hi(c,a);c.mimeType=_.ii(b.mimeType);if(a===_.P||a===_.Q)c.label=_.ii(b.label),c.language=_.ii(b.language);a===_.ji?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.Q?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.ii(b.audioMimeType)):(c.kind=_.ii(b.kind),c.roles=b.roles);c.accessibility=a===_.ji||a===_.Q?(b.accessibility||[]).filter(function(d){return d.type===a}):b.accessibility||[];return c};
63
- yx=function(a,b,c){var d=new _.pi(a===_.ji?""+b.videoId:a===_.Q?""+b.audioId:""+b.id,c);switch(a){case _.ji:d.codec=_.ii(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;d.drm={keyId:b.keyId||void 0};break;case _.Q:d.codec=_.ii(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.ii(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.K.va(e,
64
- d,null,["id","track"])}))||c.renditions.push(d);return a||d};zx=function(a,b){var c=a.reduce(function(d,e){b===_.ji?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.Q&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};Ax=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
- Bx=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};Cx=function(){this.g=new _.H("cl.api.mse.TrackManager");this.l=null;this.h=[];this.a=new Map;this.f=new Map};Dx=function(a,b){return a.h.filter(function(c){return c.type===b})};Ex=function(a,b){var c=a.a.get(b)||null;return c&&c.track};Gx=function(a,b,c){c&&Ex(a,c.type)===c&&!a.l.ja()||Fx(a,b,c&&c.renditions[0])};
66
- Hx=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
- Fx=function(a,b,c,d){d=void 0===d?!1:d;if(a.l&&((a.a.get(b)||null)!==c||a.l.ja())){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===_.P){var f=e.ha().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),Hx(a,c),e.trigger(new _.J(_.Lj)),Ix(e,!0).then(function(){Jx(e,f)})["catch"](function(n){a.g.warn("Error while activating track",n)}))}else if(b===
68
- _.Q)a.f.set(b,c),Kx(e,parseInt(c.id,10));else if(b===_.ji){var g=a.a.get(_.Q)||null;if(g){var h=Lx(e).filter(function(n){return n.videoId==c.id});var l=h.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=h.find(function(n){return m.find(function(p){return p==n.audioId})})}}else l=Lx(e).find(function(n){return n.videoId==c.id});l?(a.f.set(b,
69
- c),Mx(e,l,d)):a.g.warn("Cannot find matching variant")}}else a.g.debug(_.Ea+b),Ex(a,b)&&(b===_.P?Ix(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.J(_.Lj))})["catch"](function(n){a.g.warn("Error while de-activating text tracks",n)}):b===_.Q?a.g.info("Enabling ABR for audio is not supported"):Mx(e,null,d))}};
70
- Px=function(a){if(a.l){a.g.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.zq)),d=c.next();!d.done;d=c.next())d=d.value,a.a.set(d,null),a.f.set(d,null);c={};d=_.u(a.l.ha());for(var e=d.next();!e.done;c={Vb:c.Vb},e=d.next()){e=e.value;c.Vb=xx(_.P,e);var f=b.find(function(h){return function(l){return h.Vb.va(l)}}(c));c.Vb=f||c.Vb;var g=yx(_.P,e,c.Vb);e.active&&a.a.set(_.P,g);f||b.push(c.Vb)}Nx(a.l)||a.a.set(_.P,null);c=Lx(a.l);Ox(a,b,c,_.ji);Ox(a,b,c,_.Q);
71
- a.h=b}};Ox=function(a,b,c,d){var e=zx(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Wb:c.Wb},f=e.next()){f=f.value;c.Wb=xx(d,f);var g=b.find(function(l){return function(m){return l.Wb.va(m)}}(c));c.Wb=g||c.Wb;var h=yx(d,f,c.Wb);f.active&&a.a.set(d,h);g||b.push(c.Wb)}};
72
- Qx=function(a,b,c){if(b){a.h.length||Px(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(Dx(a,d)),h=g.next();!h.done&&!(f=h.value.renditions.find(function(l){return l.id==b.id}));h=g.next());f&&e!==f&&(Hx(a,f),d===_.Q?a.l.trigger(new _.J(_.Kj)):d===_.ji&&a.l.trigger(new _.J(_.Ve,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};Rx=function(){this.f=new _.aw(2);this.g=new _.aw(5);this.a=0};Sx=function(a,b){return 128E3>a.a?b:Math.min(_.cw(a.f),_.cw(a.g))};
73
- _.Tx=function(){this.f=new _.H("clpp.abr");this.w=null;this.j=!1;this.g=new Rx;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.h=null};Ux=function(a,b){a&&(b=b.filter(function(c){return mx(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};Vx=function(){this.a=new Map};Xx=function(a,b){a.a.has(b)||a.a.set(b,new Wx);return a.a.get(b)};Wx=function(){this.text=this.variant=null};
74
- Yx=function(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.add(d.value)};ay=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&&Zx(c,d)&&$x(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(Zx(c,d)&&$x(c.roles,d.roles)));return c?!1:!0};
75
- Zx=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.Rv(f)[0]}),d=b.codecs.split(",").map(function(f){return _.Rv(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};$x=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=_.u(c);for(var e=c.next();!e.done;e=c.next())if(!d.has(e.value))return!1;return!0};
76
- cy=function(a){this.a=a;this.f=new by(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};by=function(a,b,c){this.g=_.Fg(a);this.a=b;this.f=c};dy=function(a,b){var c=null;b.some(function(d){c=_.Pv(_.Ki(d),a.map(function(e){return Ov(e)}));return!!c});return c?a.filter(function(d){return c===Ov(d)}):[]};ey=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
- hy=function(a,b){this.a=fy;this.f=(new Map).set(fy,b).set(gy,a)};
78
- jy=function(a){var b=this;this.C=a;this.a=a.getConfiguration().streaming;this.g=new _.eg;this.f=new _.H("clpp.mse.media.LiveEdgeObserver");iy(this)&&(a=this.C.getSurface().getMedia(),this.g.on(a,_.Fe,function(){var c=b.C.getPosition(),d=b.C.getSeekRange().end;c=d-c;var e=b.C.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.f.debug("Too far from edge, jump to beginning."),b.C.setPlaybackRate(1),b.C.seek(d)):1===e&&c>=b.a.startChasingAt?(b.f.debug("Not on live edge, increase playback rate."),
56
+ tx=function(a){return{id:a.id,active:!1,type:_.Ce,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,accessibility:a.accessibility,keyId:null}};
57
+ ux=function(a){return a.allowedByApplication&&a.allowedByKeySystem};ix=function(a,b){var c=a.filter(function(g){return g.audio&&g.audio.channelsCount}),d=new Map;c=_.u(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))};
58
+ _.wx=function(a,b,c){b=_.Fg(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 h=_.Qv(_.Ji(g),a.map(function(l){return l.language}));return h?(d=a.filter(function(l){return _.Ji(l.language)===h}),!0):!1});if(c){b=vx(d,c);if(b.length)return b;_.G("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(_.Iv,
59
+ []);return b.length?vx(d,b[0]):d};vx=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};xx=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};
60
+ px=function(a){var b=Rv(a);return a.type===_.kc?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.Re?"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"};
61
+ yx=function(a,b){var c=String(_.li++);c=new _.gi(c,a);c.mimeType=_.hi(b.mimeType);if(a===_.P||a===_.Q)c.label=_.hi(b.label),c.language=_.hi(b.language);a===_.ii?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.Q?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.hi(b.audioMimeType)):(c.kind=_.hi(b.kind),c.roles=b.roles);c.accessibility=a===_.ii||a===_.Q?(b.accessibility||[]).filter(function(d){return d.type===a}):b.accessibility||[];return c};
62
+ zx=function(a,b,c){var d=new _.oi(a===_.ii?""+b.videoId:a===_.Q?""+b.audioId:""+b.id,c);switch(a){case _.ii:d.codec=_.hi(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;d.drm={keyId:b.keyId||void 0};break;case _.Q:d.codec=_.hi(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.hi(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.K.va(e,
63
+ d,null,["id","track"])}))||c.renditions.push(d);return a||d};Ax=function(a,b){var c=a.reduce(function(d,e){b===_.ii?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.Q&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};Bx=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};
64
+ Cx=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};Dx=function(){this.g=new _.H("cl.api.mse.TrackManager");this.l=null;this.h=[];this.a=new Map;this.f=new Map};Ex=function(a,b){return a.h.filter(function(c){return c.type===b})};Fx=function(a,b){var c=a.a.get(b)||null;return c&&c.track};Hx=function(a,b,c){c&&Fx(a,c.type)===c&&!a.l.ka()||Gx(a,b,c&&c.renditions[0])};
65
+ Ix=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)};
66
+ Gx=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===_.P){var f=e.ia().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),Ix(a,c),e.trigger(new _.J(_.Mj)),Jx(e,!0).then(function(){Kx(e,f)})["catch"](function(n){a.g.warn("Error while activating track",n)}))}else if(b===
67
+ _.Q)a.f.set(b,c),Lx(e,parseInt(c.id,10));else if(b===_.ii){var g=a.a.get(_.Q)||null;if(g){var h=Mx(e).filter(function(n){return n.videoId==c.id});var l=h.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=h.find(function(n){return m.find(function(p){return p==n.audioId})})}}else l=Mx(e).find(function(n){return n.videoId==c.id});l?(a.f.set(b,
68
+ c),Nx(e,l,d)):a.g.warn("Cannot find matching variant")}}else a.g.debug(_.Ea+b),Fx(a,b)&&(b===_.P?Jx(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.J(_.Mj))})["catch"](function(n){a.g.warn("Error while de-activating text tracks",n)}):b===_.Q?a.g.info("Enabling ABR for audio is not supported"):Nx(e,null,d))}};
69
+ Qx=function(a){if(a.l){a.g.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.Aq)),d=c.next();!d.done;d=c.next())d=d.value,a.a.set(d,null),a.f.set(d,null);c={};d=_.u(a.l.ia());for(var e=d.next();!e.done;c={Ub:c.Ub},e=d.next()){e=e.value;c.Ub=yx(_.P,e);var f=b.find(function(h){return function(l){return h.Ub.va(l)}}(c));c.Ub=f||c.Ub;var g=zx(_.P,e,c.Ub);e.active&&a.a.set(_.P,g);f||b.push(c.Ub)}Ox(a.l)||a.a.set(_.P,null);c=Mx(a.l);Px(a,b,c,_.ii);Px(a,b,c,_.Q);
70
+ a.h=b}};Px=function(a,b,c,d){var e=Ax(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Vb:c.Vb},f=e.next()){f=f.value;c.Vb=yx(d,f);var g=b.find(function(l){return function(m){return l.Vb.va(m)}}(c));c.Vb=g||c.Vb;var h=zx(d,f,c.Vb);f.active&&a.a.set(d,h);g||b.push(c.Vb)}};
71
+ Rx=function(a,b,c){if(b){a.h.length||Qx(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(Ex(a,d)),h=g.next();!h.done&&!(f=h.value.renditions.find(function(l){return l.id==b.id}));h=g.next());f&&e!==f&&(Ix(a,f),d===_.Q?a.l.trigger(new _.J(_.Lj)):d===_.ii&&a.l.trigger(new _.J(_.Ve,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};Sx=function(){this.f=new _.bw(2);this.g=new _.bw(5);this.a=0};Tx=function(a,b){return 128E3>a.a?b:Math.min(_.dw(a.f),_.dw(a.g))};
72
+ _.Ux=function(){this.f=new _.H("clpp.abr");this.w=null;this.j=!1;this.g=new Sx;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.h=null};Vx=function(a,b){a&&(b=b.filter(function(c){return nx(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};Wx=function(){this.a=new Map};Yx=function(a,b){a.a.has(b)||a.a.set(b,new Xx);return a.a.get(b)};Xx=function(){this.text=this.variant=null};
73
+ Zx=function(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.add(d.value)};by=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&&$x(c,d)&&ay(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!($x(c,d)&&ay(c.roles,d.roles)));return c?!1:!0};
74
+ $x=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.Sv(f)[0]}),d=b.codecs.split(",").map(function(f){return _.Sv(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};ay=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=_.u(c);for(var e=c.next();!e.done;e=c.next())if(!d.has(e.value))return!1;return!0};
75
+ dy=function(a){this.a=a;this.f=new cy(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};cy=function(a,b,c){this.g=_.Fg(a);this.a=b;this.f=c};ey=function(a,b){var c=null;b.some(function(d){c=_.Qv(_.Ji(d),a.map(function(e){return Pv(e)}));return!!c});return c?a.filter(function(d){return c===Pv(d)}):[]};fy=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)})};
76
+ iy=function(a,b){this.a=gy;this.f=(new Map).set(gy,b).set(hy,a)};
77
+ ky=function(a){var b=this;this.C=a;this.a=a.getConfiguration().streaming;this.g=new _.eg;this.f=new _.H("clpp.mse.media.LiveEdgeObserver");jy(this)&&(a=this.C.getSurface().getMedia(),this.g.on(a,_.Fe,function(){var c=b.C.getPosition(),d=b.C.getSeekRange().end;c=d-c;var e=b.C.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.f.debug("Too far from edge, jump to beginning."),b.C.setPlaybackRate(1),b.C.seek(d)):1===e&&c>=b.a.startChasingAt?(b.f.debug("Not on live edge, increase playback rate."),
79
78
  b.C.setPlaybackRate(b.a.chasingRate)):1<e&&c<=f&&(b.f.debug("On live edge, reduce playback rate."),b.C.setPlaybackRate(1))}))};
80
- iy=function(a){return 1>=a.a.chasingRate?(a.f.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.f.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.f.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.f.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};ky=function(a){this.g=a;this.a=null;this.f=function(){}};ly=function(a,b){a.f=b};
81
- my=function(a){var b=this;this.a=a;this.h=!1;this.g=this.a.te();this.f=new _.Ri(function(){b.a.Hi(.25*b.g)})};ny=function(a){a.f.stop();var b=a.h?0:a.g;0<=b?a.a.te()!=b&&a.a.ug(b):(a.f.bb(.25),0!=a.a.te()&&a.a.ug(0))};py=function(a,b){this.g=a;this.j=oy(a);this.a=a.a.currentTime;this.h=Date.now()/1E3;this.m=b;this.f=function(){}};qy=function(a,b){a.f=b};ry=function(a){this.a=a};
82
- oy=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};ty=function(a,b,c,d,e){var f=this;this.a=a;this.D=b;this.j=c;this.B=e;this.g=new _.eg;this.A=!1;this.I=a.readyState;this.h=!1;this.f=d;this.m=this.F=this.w=!1;this.g.on(a,_.Ze,function(){return sy(f)});this.o=(new _.Ri(function(){sy(f)})).bb(.25)};
83
- sy=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.I&&(a.h=!1,a.I=a.a.readyState);var b=a.j.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.Qj(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=oy(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.F&&(f=d.start(e),!(f>=nw(a.D)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.h){a.h=!0;var l=new _.J("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.B(l);a.j.jumpLargeGaps&&!l.defaultPrevented?h=!0:_.Rf("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.Rf($u,g,"seconds because of gap before start time of",f):_.Rf($u,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
85
- xy=function(a,b,c,d){this.a=a;this.h=b;this.m=d;this.w=c;this.j=!1;this.f=new _.eg;this.g=new uy(a);this.o=!1;0<a.readyState?vy(this,c):wy(this,c)};yy=function(a){return a.j?a.a.currentTime:a.w};Ay=function(a,b){0<a.a.readyState?zy(a.g,b):wy(a,b)};wy=function(a,b){a.w=b;a.f.off(a.a,_.wd);a.f.one(a.a,_.wd,function(){vy(a,b)})};vy=function(a,b){a.o||(a.o=!0,a.m&&a.m());.001>Math.abs(a.a.currentTime-b)?By(a):(a.f.one(a.a,_.le,function(){By(a)}),zy(a.g,0==a.a.currentTime?b:a.a.currentTime))};
86
- By=function(a){_.Wi()&&!a.j&&a.h();a.j=!0;a.f.on(a.a,_.le,function(){return a.h()})};uy=function(a){var b=this;this.f=a;this.m=10;this.j=this.g=this.h=0;this.a=new _.Ri(function(){0>=b.h?(_.G(["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--)})};zy=function(a,b){a.g=a.f.currentTime;a.j=b;a.h=a.m;a.f.currentTime=b;a.a.bb(.1)};
87
- Fy=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 ty(a,b.presentationTimeline,c,Cy(this,a,c),f);this.g=new xy(a,function(){a:{var h=g.j;h.A=!0;h.w=!1;h.h=!1;h=yy(g.g);var l=Dy(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;Ay(g.g,l);h=void 0;break a}}g.f.debug("Seek to "+h);g.A();h=void 0}return h},Ey(this,d),function(){g.j.F=!0});this.o=(new _.Ri(function(){if(0!=g.h.readyState&&
88
- !g.h.paused){var h=yy(g.g),l=ow(g.a,0),m=nw(g.a);3>m-l&&(l=m-3);h<l&&(l=Dy(g,h),g.f.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.h.currentTime=l)}})).bb(.25);this.f=new _.H("clpp.mse.Playhead")};Hy=function(a){var b=yy(a.g);return 0<a.h.readyState&&!a.h.paused?Gy(a,b):b};Ey=function(a,b){null==b?b=Infinity>a.a.getDuration()?ow(a.a,0):nw(a.a):0>b&&(b=nw(a.a)+b);return Iy(a,Gy(a,b))};Iy=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
89
- Dy=function(a,b){var c=new _.Qj(a.h.buffered);c=c.ec.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=ow(a.a,0),g=nw(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=ow(a.a,d),m=ow(a.a,e);d=ow(a.a,d+e);if(b>=h)return a.f.debug("Playhead past duration."),Iy(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};Gy=function(a,b){var c=ow(a.a,0);if(b<c)return c;c=nw(a.a);return b>c?c:b};
91
- Cy=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new py(new ry(b),c.stallThreshold);qy(c,function(f,g){a.f.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.Qj(b.buffered),l;if(l=_.Ui("Edge/")||_.Ui("Trident/")||_.$h()||_.Wi())a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){l=h.start(l+1)-h.end(l)>=d;break a}l=!1}if(l){a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){h=
79
+ jy=function(a){return 1>=a.a.chasingRate?(a.f.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.f.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.f.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.f.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};ly=function(a){this.g=a;this.a=null;this.f=function(){}};my=function(a,b){a.f=b};
80
+ ny=function(a){var b=this;this.a=a;this.h=!1;this.g=this.a.te();this.f=new _.Si(function(){b.a.Di(.25*b.g)})};oy=function(a){a.f.stop();var b=a.h?0:a.g;0<=b?a.a.te()!=b&&a.a.sg(b):(a.f.ab(.25),0!=a.a.te()&&a.a.sg(0))};qy=function(a,b){this.g=a;this.j=py(a);this.a=a.a.currentTime;this.h=Date.now()/1E3;this.m=b;this.f=function(){}};ry=function(a,b){a.f=b};sy=function(a){this.a=a};
81
+ py=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};uy=function(a,b,c,d,e){var f=this;this.a=a;this.D=b;this.j=c;this.B=e;this.g=new _.eg;this.A=!1;this.H=a.readyState;this.h=!1;this.f=d;this.m=this.F=this.w=!1;this.g.on(a,_.Ze,function(){return ty(f)});this.o=(new _.Si(function(){ty(f)})).ab(.25)};
82
+ ty=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.H&&(a.h=!1,a.H=a.a.readyState);var b=a.j.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.Rj(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=py(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.j!=c)a.h=
83
+ 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.F&&(f=d.start(e),!(f>=ow(a.D)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.h){a.h=!0;var l=new _.J("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.B(l);a.j.jumpLargeGaps&&!l.defaultPrevented?h=!0:_.Rf("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.Rf(av,g,"seconds because of gap before start time of",f):_.Rf(av,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
84
+ yy=function(a,b,c,d){this.a=a;this.h=b;this.m=d;this.w=c;this.j=!1;this.f=new _.eg;this.g=new vy(a);this.o=!1;0<a.readyState?wy(this,c):xy(this,c)};zy=function(a){return a.j?a.a.currentTime:a.w};By=function(a,b){0<a.a.readyState?Ay(a.g,b):xy(a,b)};xy=function(a,b){a.w=b;a.f.off(a.a,_.xd);a.f.one(a.a,_.xd,function(){wy(a,b)})};wy=function(a,b){a.o||(a.o=!0,a.m&&a.m());.001>Math.abs(a.a.currentTime-b)?Cy(a):(a.f.one(a.a,_.me,function(){Cy(a)}),Ay(a.g,0==a.a.currentTime?b:a.a.currentTime))};
85
+ Cy=function(a){_.Xi()&&!a.j&&a.h();a.j=!0;a.f.on(a.a,_.me,function(){return a.h()})};vy=function(a){var b=this;this.f=a;this.m=10;this.j=this.g=this.h=0;this.a=new _.Si(function(){0>=b.h?(_.G(["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--)})};Ay=function(a,b){a.g=a.f.currentTime;a.j=b;a.h=a.m;a.f.currentTime=b;a.a.ab(.1)};
86
+ Gy=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 uy(a,b.presentationTimeline,c,Dy(this,a,c),f);this.g=new yy(a,function(){a:{var h=g.j;h.A=!0;h.w=!1;h.h=!1;h=zy(g.g);var l=Ey(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;By(g.g,l);h=void 0;break a}}g.f.debug("Seek to "+h);g.A();h=void 0}return h},Fy(this,d),function(){g.j.F=!0});this.o=(new _.Si(function(){if(0!=g.h.readyState&&
87
+ !g.h.paused){var h=zy(g.g),l=pw(g.a,0),m=ow(g.a);3>m-l&&(l=m-3);h<l&&(l=Ey(g,h),g.f.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.h.currentTime=l)}})).ab(.25);this.f=new _.H("clpp.mse.Playhead")};Iy=function(a){var b=zy(a.g);return 0<a.h.readyState&&!a.h.paused?Hy(a,b):b};Fy=function(a,b){null==b?b=Infinity>a.a.getDuration()?pw(a.a,0):ow(a.a):0>b&&(b=ow(a.a)+b);return Jy(a,Hy(a,b))};Jy=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
88
+ Ey=function(a,b){var c=new _.Rj(a.h.buffered);c=c.cc.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=pw(a.a,0),g=ow(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=pw(a.a,d),m=pw(a.a,e);d=pw(a.a,d+e);if(b>=h)return a.f.debug("Playhead past duration."),Jy(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."),
89
+ b;a.f.debug("Playhead outside safe region \x26 in unbuffered region.");return d};Hy=function(a,b){var c=pw(a.a,0);if(b<c)return c;c=ow(a.a);return b>c?c:b};
90
+ Dy=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new qy(new sy(b),c.stallThreshold);ry(c,function(f,g){a.f.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.Rj(b.buffered),l;if(l=_.Vi("Edge/")||_.Vi("Trident/")||_.Zh()||_.Xi())a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){l=h.start(l+1)-h.end(l)>=d;break a}l=!1}if(l){a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){h=
92
91
  h.start(l+1)-f;break a}h=null}h&&(e=Math.min(h+.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
- Ky=function(a){function b(){d=!0}function c(m){f.push(m);_.Ok(m)}a=_.N(a);var d=!1,e,f=[],g=[];(new _.Nk).M(_.Ed,c).M(_.Ge,c).M(_.zd,c).M(_.Dd,c).M(_.ue,c).W(_.we,function(m){e=m;f.push(m);_.Pk(m)}).W("encv",b).W("enca",b).W("avc1",function(m){g.push({M:m,Jc:1701733238})}).W("avc3",function(m){g.push({M:m,Jc:1701733238})}).W("ac-3",function(m){g.push({M:m,Jc:1701733217})}).W("ec-3",function(m){g.push({M:m,Jc:1701733217})}).W("mp4a",function(m){g.push({M:m,Jc:1701733217})}).parse(a);if(d)return _.Rf("Init segment already indicates encryption."),
94
- a;if(0===g.length||!e)throw _.Tf("Failed to find boxes needed to fake encryption!"),_.Tf("Failed init segment (hex):",_.mk(a)),new _.L(_.M,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.Rf('Inserting "'+_.Sk(l.Jc)+'" box into init segment.'),a=Jy(a,e,l.M,f,l.Jc);return a};
95
- Jy=function(a,b,c,d,e){var f=Ly.value(),g=a.subarray(c.start,c.start+c.size),h=_.sh(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.sh(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);My(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.Ui("Xbox One")||_.Ti()?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=_.u(d);for(d=a.next();!d.done;d=a.next())d=d.value,My(e,d.start,d.size+l.byteLength);l=_.sh(e,
96
- b.start);b=_.Tk(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};My=function(a,b,c){a=_.sh(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.Ny=function(a,b){this.C=b;this.g=a;this.j=null;this.w=1;this.F=Promise.resolve();this.m=[];this.o=new Map;this.f=new Map;this.J=this.h=this.A=this.B=!1;this.I=0;this.a=new _.H("clpp.mse.Streaming");this.D=!1};
97
- Oy=function(a){var b=a.f.get(_.Re);return b?a.g.periods[b.zb]:(b=a.f.get(_.jc))?a.g.periods[b.zb]:null};Qy=function(a){return _.Py(a,_.jc)};Ry=function(a){return _.Py(a,_.Re)};_.Py=function(a,b){var c=a.f.get(b);return c?c.Rb||c.stream:null};
98
- Wy=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.B(function(q){switch(q.a){case 1:return c=_.vn,_.x(q,a.C.X.clear(c.TEXT),2);case 2:return a.I++,a.J=!1,d=a.I,e=a.C.X,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.x(q,e.init(f,!1),3);case 3:return a.h?q["return"]():_.x(q,Sy(a,g),4);case 4:if(a.h)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.j.alwaysStreamText;a.I!=d||a.f.has(c.TEXT)||a.J||!l||(m=a.C.wb(),n=Ty(a,m),p=Uy(b,n,0),a.f.set(c.TEXT,p),Vy(a,p,0));_.z(q)}})};
99
- Zy=function(a){a.J=!0;var b=a.f.get(_.Ce);b&&(Xy(b),Yy(b)["catch"](function(){}),a.f["delete"](_.Ce))};az=function(a,b,c,d){b.video&&_.$y(a,b.video,c,d);b.audio&&_.$y(a,b.audio,c,d)};
100
- _.$y=function(a,b,c,d){var e=a.f.get(b.type);if(!e&&b.type==_.Ce&&a.j.ignoreTextStreamFailures)Wy(a,b);else if(e){var f=bz(a,b);if(c&&f!=e.zb)for(a.a.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),b=_.u(a.f.values()),c=b.next();!c.done;c=b.next())cz(a,c.value);else{e.Rb&&(a.a.debug("switch during trick play mode",b),b.trickModeVideo?(e.Rb=b,b=b.trickModeVideo,a.a.debug("switch found trick play stream",b)):(e.Rb=null,a.a.debug("switch found no special trick play stream")));
101
- var g=a.m[f];if(g&&g.Mc&&(g=a.o.get(b.id))&&g.Mc)if(e.stream!=b){g=a.g.presentationTimeline.getDuration();var h=a.C.wb();h=dz(a,e,h);!c&&(e.endOfStream||h>=g)?a.a.debug(wv+ez(e)+" already buffered to the end. Not switching."):(b.type==_.Ce&&Uw(a.C.X,_.Oi(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.jd=!0,a.a.debug("switch: switching to Stream "+ez(e)),fz(a,e,f)&&(a.a.info("Aborting current segment request to switch."),e.Cb.abort()),c&&(e.Xb?e.Td=!0:e.Ya?(e.Fb=!0,e.vd=d,e.Td=!0):
102
- (Xy(e),gz(a,e,!0,d)["catch"](function(l){if(a.C)a.C.onError(l)}))))}else a.a.debug(wv+ez(e)+" already active")}}};fz=function(a,b,c){if(!b.Cb)return!1;var d=a.C.wb(),e=a.C.X.xa(b.type);c=(c=hz(a,b,d,e,c))?c.Ea?c.Ea-c.Qa:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.Ea?f.Ea-f.Qa:null)||0);f=a.C.re().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.g.minBufferTime||0,a.j.rebufferingGoal))return!0;a=b.Cb;a=a.h?a.h.bytesRemaining:-1;return 0>a||a>c?!0:!1};
103
- iz=function(a){function b(l){return a.C.X.ec(l,c,0)}var c=a.C.wb(),d=!1,e=Ty(a,c);if(_.gh(a.f.values(),function(l){return l.zb==e}))for(var f=_.u(a.f.keys()),g=f.next();!g.done;g=f.next()){g=g.value;var h=a.f.get(g);h.stream.segmentIterator=null;b(g)||(cz(a,h),d=!0)}else if(!_.gh(a.f.keys(),b)){a.a.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.f.values());for(f=d.next();!f.done;f=d.next())cz(a,f.value);d=!0}d||a.a.debug("(all): seeked: buffered seek: presentationTime\x3d"+
104
- c)};cz=function(a,b){var c=ez(b);b.Xb?a.a.debug(c,"clear: already clearing the buffer"):b.Fb?a.a.debug(c,"clear: already waiting"):b.Ya?(a.a.debug(c,"clear: currently updating"),b.Fb=!0,b.vd=0):null==a.C.X.rb(b.type)?(a.a.debug(c,"clear: nothing buffered"),null==b.qb&&Vy(a,b,0)):(a.a.debug(c,"clear: handling right now"),Xy(b),gz(a,b,!1,0)["catch"](function(d){if(a.C)a.C.onError(d)}))};
105
- kz=function(a,b,c,d,e){var f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a)return f=a.C.wb(),g=Ty(a,f),h=_.vn,l=new Map,m=new Set,b&&(l.set(h.AUDIO,b),m.add(b)),c&&(l.set(h.VIDEO,c),m.add(c)),d&&(l.set(h.TEXT,d),m.add(d)),n=a.C.X,p=a.j.forceNativeTS,_.x(q,n.init(l,p),2);if(3!=q.a){if(a.h)return q["return"]();jz(a);return _.x(q,Sy(a,m),3)}if(a.h)return q["return"]();l.forEach(function(r,w){if(!a.f.has(w)){var y=Uy(r,g,e);a.f.set(w,y);Vy(a,y,0)}});_.z(q)})};
106
- Uy=function(a,b,c){return{stream:a,type:a.type,Ob:null,segmentIterator:null,oa:null,Rb:null,jd:!0,zb:b,endOfStream:!1,Ya:!1,qb:null,Fb:!1,vd:0,Td:!1,Xb:!1,Te:!1,Hc:!1,sg:c||0,Cb:null,yd:!1,Tf:0}};
107
- lz=function(a,b){var c=a.m[b];if(c)return a.a.debug("(all) Period "+b+Tu),c.P;a.a.debug("(all) setting up Period "+b);c={P:new _.Th,Mc:!1};a.m[b]=c;for(var d=new Set,e=_.u(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=_.u(a.g.periods[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.F=a.F.then(function(){return a.h?null:Sy(a,d)}).then(function(){a.h||
108
- (a.m[b].P.resolve(),a.m[b].Mc=!0,a.a.debug("(all) setup Period "+b))})["catch"](function(g){a.h||(a.m[b].P["catch"](function(){}),a.m[b].P.reject(),delete a.m[b],a.a.warn("(all) failed to setup Period "+b),a.C.onError(g))});return c.P};
109
- Sy=function(a,b){var c,d,e,f,g,h,l,m,n,p,q;return _.B(function(r){switch(r.a){case 1:c=[];d=_.u(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.o.get(f.id))?(a.a.debug("(all) Stream "+f.id+Tu),c.push(g.P)):(a.a.debug("(all) setting up Stream "+f.id),a.o.set(f.id,{P:new _.Th,Mc:!1}),c.push(f.createSegmentIndex()));_.zf(r,2);return _.x(r,Promise.all(c),4);case 4:if(a.h)return r["return"]();_.Af(r,3);break;case 2:h=_.Bf(r);if(a.h)return r["return"]();l=_.u(b);for(e=l.next();!e.done;e=l.next())m=
110
- e.value,a.o.get(m.id).P["catch"](function(){}),a.o.get(m.id).P.reject(),a.o["delete"](m.id);throw h;case 3:n=_.u(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.o.get(p.id),q.Mc||(q.P.resolve(),q.Mc=!0,a.a.debug("(all) setup Stream "+p.id));_.z(r)}})};jz=function(a){var b=a.g.presentationTimeline.getDuration();Infinity>b?a.C.X.Tb(b):a.C.X.Tb(Math.pow(2,32))};
111
- oz=function(a,b){function c(p){return p.type==_.Ce&&p.stream.mimeType==_.bc}if(c(b))return ax(a.C.X,b.stream.originalId||""),null;var d=ez(b),e=a.C.wb(),f=dz(a,b,e);a.a.debug(d,"timeNeeded\x3d"+f);var g=bz(a,b.stream),h=Ty(a,f),l=a.C.X.Da(b.type,e);a.a.debug(d,"update_:",qv+e,"bufferedAhead\x3d"+l);var m=Math.max(a.g.minBufferTime||0,a.j.rebufferingGoal,a.j.bufferingGoal)*a.w,n=hw(a.g.presentationTimeline);if(null!=n&&f>=n&&!b.yd)return mz(a,b),null;b.endOfStream=!1;b.zb=h;if(h!=g)return a.a.debug(d,
112
- "need Period "+h,qv+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.a.debug(d,"buffering goal met"),a.j.bufferLimitUpdateInterval||.5;h=a.C.X.xa(b.type);h=hz(a,b,e,h,g);if(!h)return a.g.presentationTimeline.isLive()||b.type===_.Ce?a.j.bufferLimitUpdateInterval||1:(a.a.debug("Media state "+d+": no next segment found. Assuming EOS."),mz(a,b),null);d=Infinity;l=_.u(a.f.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=dz(a,m,e),d=Math.min(d,m));if(f>=d+a.g.presentationTimeline.a)return a.j.bufferLimitUpdateInterval||
113
- 1;b.sg=0;nz(a,b,e,g,h)["catch"](function(){});return null};mz=function(a,b){a.a.debug(ez(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.Re){var c=a.f.get(_.Ce);c&&c.stream.mimeType==_.bc&&(c.endOfStream=!0)}};dz=function(a,b,c){if(!b.Ob||!b.oa)return Math.max(c,b.sg);c=bz(a,b.Ob);return a.g.periods[c].startTime+b.oa.endTime};
114
- hz=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===_.pz)b.stream.segmentIterator?a=sw(b.stream.segmentIterator):b.oa||d?(e=b.oa?b.oa.endTime:d,a.a.info(Zu,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=ww(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.a.warn(Zu,jv,"endTime:",e,b.oa)),a=d):(e=Math.max(c,0),a.a.info(Zu,"looking up segment","lookupTime:",e,pv,c),d=null,d||(b.stream.segmentIterator=ww(b.stream.segmentIndex,
115
- c),d=b.stream.segmentIterator.next().value),null===d&&a.a.warn(Zu,jv,"lookupTime:",e,pv,c),a=d);else{var f=ez(b);b.oa&&b.stream==b.Ob?(d=b.oa.position+1,a.a.debug(f,"next position known:","position\x3d"+d),a=qz(a,b,e,d)):(b.oa?(a.a.debug(f,"next position unknown: another Stream buffered"),c=bz(a,b.Ob),c=rz(a,b,a.g.periods[c].startTime+b.oa.endTime,e)):(a.a.debug(f,"next position unknown: nothing buffered"),c=rz(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.j&&a.j.ignoreDrift||(f=qz(a,b,e,
116
- Math.max(0,c-1))),a=f||qz(a,b,e,c)))}return a};rz=function(a,b,c,d){var e=ez(b);d=a.g.periods[d];a.a.debug(e,"looking up segment:","lastSegment.endTime\x3d"+c,lv+d.startTime);c=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(c);null==b&&a.a.warn(e,"cannot find segment:",lv+d.startTime,"lookupTime\x3d"+c);return b};
117
- qz=function(a,b,c,d){var e=ez(b);c=a.g.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.a.debug(e,"segment does not exist:",lv+c.startTime,"position\x3d"+d),null;var g=a.g.presentationTimeline;d=_.mw(g);g=lw(g);return!b.yd&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.a.debug(e,"segment is not available:",lv+c.startTime,uv+f.startTime,rv+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
118
- nz=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,r,w,y,A,E;return _.B(function(F){f=_.vn;g=ez(b);h=a.g.periods[d];a.a.debug(g,"fetchAndAppend_:",qv+c,lv+h.startTime,sv+e.position,uv+e.startTime,rv+e.endTime);l=b.stream;m=b.stream.segmentIterator;n=a.g.presentationTimeline.getDuration();p=a.g.periods[d+1];q=Math.max(0,h.startTime-.1);r=p?p.startTime+.01:n;w=sz(a,b,d,q,r,e);b.Ya=!0;b.jd=!1;a.a.debug(g,"fetching segment");y=!1;A=function(D,I){if(a.h||a.A)return null;y=!0;return tz(a,b,c,h,l,e,D,I)};E=a.C.X.xa(b.type)||
119
- 0;w.then(function(){return a.h||a.A?null:uz(a,b,e,!1,function(D){return A(D.data,!0)})}).then(function(D){return a.h||a.A?null:y||null===D?(vz(a,b,E,e,l),null):A(D,!1)}).then(function(){if(!a.h&&!a.A){vz(a,b,E,e,l);b.Ya=!1;b.Te=!1;b.Fb||a.C.Pd();if(m){var D=m.next().value;D&&a.a.debug("New iterated segment",D)}Vy(a,b,0);wz(a,b,l);a.a.debug(g,"finished fetch and append")}})["catch"](function(D){return _.B(function(I){if(a.h||a.A)return I["return"]();b.Ya=!1;if(b.type==f.TEXT&&a.j.ignoreTextStreamFailures)return 1001==
120
- D.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."),a.f["delete"](f.TEXT),I.H(0);if(7001==D.code)return b.Ya=!1,b.qb=null,Vy(a,b,0),I.H(0);if(3017===D.code)return xz(a,b,D),I.H(0);if(1001===D.code&&D.data&&404===D.data[1])return a.a.warn(g,"request for segment failed","segment not available on server",sv+e.position,uv+e.startTime,rv+e.endTime,"error\x3d"+D),b.Ya=!1,b.qb=null,Vy(a,b,1),I.H(0);if(b.type===f.TEXT)return D instanceof
121
- _.L&&D.a(1),Xy(b),a.C.onError(new _.L(1,2,2010,D)),I.H(0);if(1001<=D.code&&1003>=D.code)return _.x(I,yz(a,b,h,D),0);a.a.error(g,"failed fetch and append: code\x3d"+D.code);b.Hc=!0;D instanceof _.L&&D.a(_.M);return _.x(I,zz(a,D),0)})});_.z(F)})};
122
- Bz=function(a,b){b=void 0===b?!1:b;if(a.h)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=_.u(a.f.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=ez(d);if(d.Hc||b&&Az(d))a.a.info(e,"Retrying after failure..."),d.Hc=!1,Vy(a,d,.1)}};
123
- xz=function(a,b,c){var d=ez(b);if(Array.from(a.f.values()).some(function(f){return f!=b&&f.Te}))a.a.debug(d,av,"waiting for another stream to recover...");else{var e=Math.round(100*a.w);if(20<e)a.w-=.2;else if(4<e)a.w-=.04;else{a.a.error(d,"MediaSource threw QuotaExceededError too many times");b.Hc=!0;a.A=!0;a.C.onError(c);return}a.a.warn(d,av,"reducing buffering goals by "+(100-Math.round(100*a.w))+"%");b.Te=!0}Vy(a,b,4)};
124
- yz=function(a,b,c,d){var e,f;return _.B(function(g){e=1001===d.code&&500<=d.data.status;f=!0;e||(f=!a.C.fe(b.stream,c));if(!f)return g.H(0);b.Hc=!0;d.a(_.M);return _.x(g,zz(a,d),0)})};
125
- sz=function(a,b,c,d,e,f){c=a.g.periods[c].startTime-f.Aa;if(!b.jd&&c===b.Tf)return Promise.resolve();b.Tf=c;var g=ez(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=cx(a.C.X,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.jd)return d;a.a.debug(g,"fetching init segment");e=uz(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.h)return null;a.a.debug(g,"appending init segment");return Cz(a,
126
- h,b).then(function(){return $w(a.C.X,b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.jd=!0;return Promise.reject(h)});return Promise.all([d,e])};Cz=function(a,b,c){var d;return _.B(function(e){if(!a.j.patchEdgeWhenMixedContent||!_.Ti())return e.H(0);d=Ky(b);return _.x(e,$w(a.C.X,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
127
- tz=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,r,w,y,A;return _.B(function(E){switch(E.a){case 1:l=ez(b);if(!(e&&e.keyId&&a.C.bd)){E.H(2);break}m=Dv(a.C.bd,e.keyId);if(!m){a.a.warn("Unable to find DRM session for "+e.keyId);E.H(2);break}_.zf(E,4);return _.x(E,m,6);case 6:_.Af(E,2);break;case 4:n=_.Bf(E),a.a.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.C.bd&&Fv(a.C.bd,e.keyId))){E.H(7);break}Xy(b);p=bz(a,e);q=Dz(a,p);if(!q){E.H(8);break}return _.x(E,q,8);case 8:return r=
128
- a.C.fe(e,d,nv),w=f.startTime+d.startTime,y=f.endTime+d.startTime,a.a.warn(l,"Blocked append for "+w+" - "+y+": "+r+". Stream with Key ID "+(e.keyId+" has restrictions.")),E["return"](Promise.resolve());case 7:return A=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Nk).W("emsg",a.xj.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),E["return"](Ez(a,b,c).then(function(){if(a.h)return null;var F=f.startTime+d.startTime,D=f.endTime+d.startTime;a.a.debug(l,
129
- "Appending segment with "+(F.toFixed(3)+" - "+D.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.Gh(e.bandwidth)+" Fragment: ")+h);return $w(a.C.X,b.type,g,F,D,A,e.id,h)}).then(function(){a.h||(a.a.debug(l,"appended media segment"),b.Ob=e,b.oa=f)}))}})};
130
- vz=function(a,b,c,d,e){if(!a.g.presentationTimeline.isLive()&&b.type!==_.Ce){var f=ez(b);c=(a.C.X.xa(b.type)||0)-c;var g=d.endTime-d.startTime,h=c-g;Math.abs(h)>=Math.min(.01,g)&&Math.abs(h)<=Math.min(1,g)&&(a.a.debug(f,"Adjusted segment",d.position,"with real duration",c,"and accounted for",h,"delta between segment duration and real duration"),b.yd=!0,e.adjustSegmentDurations(d.position,h))}};
131
- Fz=function(a,b,c){(new _.Nk).M(_.Ed,_.Ok).M(_.Ge,_.Ok).M(_.zd,_.Ok).M(_.Dd,_.Ok).M(_.ue,_.Ok).W(_.we,_.Pk).M("encv",function(d){d.G.skip(78);_.Ok(d)}).M(_.oe,_.Ok).M("schi",_.Ok).M("tenc",function(d){d.G.skip(6);if(_.Hk(d.G)){d.G.skip(1);var e=_.mk(_.Mk(d.G,16));e!==b.stream.keyId&&(a.a.debug(ez(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.Xa.stop()}).parse(c)};
132
- Ez=function(a,b,c){if(a.h)return Promise.resolve();var d=ez(b);a.a.debug(d,"checking buffer length");var e=Math.max(a.j.bufferBehind,a.g.presentationTimeline.a),f=a.C.X.rb(b.type);if(null==f)return a.a.debug(d,"buffer behind okay because nothing buffered:",qv+c,gv+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.a.debug(d,"buffer behind okay:",qv+c,hv+g,gv+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.a.debug(d,"buffer behind too large:",qv+c,hv+g,gv+e,"overflow\x3d"+h);return a.C.X.remove(b.type,
133
- f,f+h).then(function(){a.h||a.a.debug(d,"evicted "+h+" seconds")})};wz=function(a,b,c){if(!a.B){b=ez(b);var d=Array.from(a.f.values());1!=d.length||d[0].type!=_.Ce?a.B=d.every(function(e){return e.type==_.Ce||a.D?!0:!e.Fb&&!e.Xb&&e.oa}):a.D&&(a.B=!0);a.B&&(a.a.debug(b,"startup complete"),c=bz(a,c),Dz(a,c))}};
134
- Dz=function(a,b){var c=null;a.m[b]||(c=lz(a,b).then(function(){a.h||(a.a.debug(iv),a.C.Ie())})["catch"](Iv));for(var d=0;d<a.g.periods.length;++d)lz(a,d)["catch"](Iv);a.C.uj&&(a.a.debug("calling onStartupComplete()..."),a.C.uj());return c};
135
- Gz=function(a,b){var c=ez(b),d=bz(a,b.stream);if(b.zb!=d){var e=b.zb,f=Array.from(a.f.values());f.every(function(g){return g.zb==e})?f.every(Az)?(a.a.debug(c,"all need Period "+e),lz(a,e).then(function(){if(!a.h)if(f.every(function(n){var p=Az(n),q=bz(a,n.stream);return p&&n.zb==e&&q!=e})){var g=a.g.periods[e];a.a.debug(c,"calling onChooseStreams()...");var h=a.C.Je(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.Re,h.variant.video);h.variant&&h.variant.audio&&l.set(_.jc,
136
- h.variant.audio);h.text&&l.set(_.Ce,h.text);var m=_.u(a.f.keys());for(h=m.next();!h.done;h=m.next())if(h=h.value,!l.has(h)&&h!=_.Ce){a.a.error(c,"invalid Streams chosen: missing "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}m=_.u(Array.from(l.keys()));for(h=m.next();!h.done;h=m.next())if(h=h.value,!a.f.has(h))if(h==_.Ce)kz(a,null,null,l.get(_.Ce),g.startTime),l["delete"](h);else{a.a.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}g=_.u(Array.from(a.f.keys()));
137
- for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.$y(a,m,!1,0),Vy(a,a.f.get(h),0)):a.f["delete"](h);a.a.debug(c,iv);a.C.Ie()}else a.a.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](Iv)):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)}};Ty=function(a,b){var c=$v(a.g.periods,b+_.xq);return c?a.g.periods.indexOf(c):0};
138
- bz=function(a,b){for(var c=a.g.periods,d=0;d<c.length;d++){for(var e=c[d],f=new Set,g=_.u(e.variants),h=g.next();!h.done;h=g.next())h=h.value,h.audio&&f.add(h.audio),h.video&&f.add(h.video),h.video&&h.video.trickModeVideo&&f.add(h.video.trickModeVideo);e=_.u(e.textStreams);for(g=e.next();!g.done;g=e.next())f.add(g.value);if(f.has(b))return d}return-1};
139
- uz=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.dw(c.Ha(),c.Qa,c.Ea,a.j.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Zb?null:e;f.disableFragmentSupport=c.Zb||a.j.disableFragmentSupport;f.disableMergedFragments=a.j.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){Fz(a,b,g.data)}),b.type===_.Re&&a.j.overridePasp&&f.responseModifiers.push(a.Wj.bind(a)));a.a.debug("fetching: reference\x3d",
140
- c);c=a.C.Ab.fetch(f);b.Cb=c;return c.P.then(function(g){var h=a.C.re(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.Cb=null;return g.data})};
141
- gz=function(a,b,c,d){var e,f,g,h;return _.B(function(l){if(1==l.a)return e=ez(b),b.Fb=!1,b.Td=!1,b.vd=0,b.Xb=!0,b.stream.segmentIterator=null,a.a.debug(e,"clearing buffer"),d?(g=a.C.wb(),h=a.C.X.getDuration(),f=a.C.X.remove(b.type,g+d,h)):f=a.C.X.clear(b.type).then(function(){return!a.h&&c?a.C.X.flush(b.type):null}),_.x(l,f,2);if(a.h)return l["return"]();a.a.debug(e,"cleared buffer");b.Ob=null;b.oa=null;b.Xb=!1;b.endOfStream=!1;b.yd=!1;Vy(a,b,0);_.z(l)})};
142
- Vy=function(a,b,c){a.a.debug(ez(b),"updating in "+c+" seconds");b.qb=(new _.Pi(function(){var d;return _.B(function(e){if(1==e.a)return _.zf(e,2),_.x(e,a.Bb(b),4);if(2!=e.a)return _.Af(e,0);d=_.Bf(e);if(a.C)a.C.onError(d);_.z(e)})})).Z(c)};Xy=function(a){null!=a.qb&&(a.qb.stop(),a.qb=null)};Yy=function(a){return _.B(function(b){return a.Cb?_.x(b,a.Cb.abort(),0):b.H(0)})};
143
- Hz=function(a){var b,c,d,e;return _.B(function(f){b=[];c=_.u(a.f.values());for(d=c.next();!d.done;d=c.next())e=d.value,Xy(e),e.Ya&&e.Cb&&(e.Ya=!1,b.push(e.Cb.abort())),e.Fb&&b.push(gz(a,e,!0,0));return _.x(f,Promise.all(b),0)})};Iz=function(a,b,c){(a=a.f.get(b))&&c&&(Xy(a),a.stream=c,a.Ob=c,a.oa&&(a.oa=c.getSegmentReference(a.oa.position)),a.oa||(a.Ob=null))};
144
- zz=function(a,b){var c;return _.B(function(d){switch(d.a){case 1:if(a.h)return d["return"]();if(!a.C.wg){d.H(2);break}_.zf(d,3);return _.x(d,a.C.wg(b),5);case 5:_.Af(d,2);break;case 3:c=_.Bf(d),c.cause=b,b=c;case 2:if(!b.f)a.C.onError(b);_.z(d)}})};ez=function(a){return"("+a.type+":"+a.stream.id+")"};Az=function(a){return!a.Ya&&null==a.qb&&!a.Fb&&!a.Xb};
145
- Lz=function(a){_.bk.call(this,kv);var b=this;this.D=Jz;this.h=this.Pb=this.V=null;this.Ce=0;this.Zf=2;this.Yc=null;this.Ae=!1;this.m=new _.eg;this.Ma=this.Dd=this.xc=this.pc=this.w=this.J=this.j=null;this.Tc=!1;this.g=this.f=this.A=this.a=this.uc=this.F=null;this.tg=1E9;this.Jd=new Set;this.T=!0;this.ba=null;this.og=!1;this.mg=0;this.$=null;this.N=new Vx;this.pg={width:Infinity,height:Infinity};this.I=null;this.aa=_.Wm;this.vc=new by(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
146
- this.configuration.preferredAudioChannelCount);this.fa=this.configuration.preferredTextLanguage;this.R=this.wc=null;this.yc=new Map;this.da=null;this.tc=this.configuration.preferredTextRole;a&&a(this);this.Be=null;this.m.on(window,"online",function(){b.D===Kz&&Bz(b.a)})};
147
- Mz=function(a){return new _.Vv(function(b){if(void 0===b||null===b)return null;var c=a.getTrackManager(),d=[];if(c){c=_.u(c.getVideoTracks());for(var e=c.next();!e.done;e=c.next())d.push.apply(d,_.mf(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
148
- Nz=function(a,b){if(a.aa!==b)if(a.aa===_.gn&&b!==_.Wm)a.log.info(_.cv+Lv(b,_.en));else{var c=a.Ce;c=0===c?0:Date.now()-c;var d=a.aa;a.aa=b;a.Ce=Date.now();a.I&&_.Mm(a.I.a,a.aa);b===_.an&&(a.Zf=a.ze?1:2);var e=a.Zf,f={currentState:a.aa,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.an||d===_.an?e:void 0};a.log.info(_.gb+Lv(d,_.en)+" -\x3e "+(Lv(b,_.en)+(b!==_.an?"":"["+Lv(e,_.dn)+"]")));a.trigger(new _.J(_.se,{detail:f}));(b===_.cn||b===_.gn)&&a.Ma&&a.Ma.stop();b===_.an?a.trigger(new _.J(_.uc,
149
- {detail:{bufferedTimeMS:-1,reason:e}})):d===_.an&&a.trigger(new _.J(_.tc,{detail:{bufferedTimeMS:c,reason:e}}))}};Tz=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.B(function(e){switch(e.a){case 1:return a.D===Oz?e["return"](Promise.reject(new _.L(_.M,7,7E3))):_.x(e,Pz(a),2);case 2:return _.x(e,Qz(a),3);case 3:c=_.$h(4)||_.$h(5);if(!b&&!c){e.H(0);break}d=a.getSurface().getMedia();return _.x(e,Rz(a,d),5);case 5:return _.x(e,Sz(a,d),0)}})};
150
- Rz=function(a,b){a.h||(a.m.on(b,_.hd,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 _.L(_.M,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()};Qz=function(a){a.h&&(a.m.off(a.h,_.hd),a.h=null);return Promise.resolve()};
151
- Pz=function(a){var b;return _.B(function(c){switch(c.a){case 1:a.D!==Oz&&(a.D=Jz);if(b=a.h)a.m.off(b,_.vd),a.m.off(b,_.Zd),a.m.off(b,_.Ud),a.m.off(b,_.gd),a.m.off(b,_.de),a.m.off(b,_.be);a.pc&&(a.pc.release(),a.pc=null);a.Ma&&(a.Ma.stop(),a.Ma=null);if(!a.A){c.H(2);break}return _.x(c,a.A.stop(),3);case 3:a.A=null;case 2:if(!a.g){c.H(4);break}return _.x(c,a.g.stop(),4);case 4:if(!a.a){c.H(6);break}return _.x(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.w&&(a.w.release(),a.w=null);if(!a.J){c.H(8);break}return _.x(c,
152
- a.J.destroy(),9);case 9:a.J=null;case 8:a.Dd&&(a.Dd.release(),a.Dd=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.j){c.H(10);break}return _.x(c,a.j.destroy(),11);case 11:a.j=null;case 10:a.N.clear(),a.F=null,a.Jd.clear(),a.f=null,a.I=null,a.T=!0,a.yc.clear(),a.Tc=!1,Uz(a),_.z(c)}})};
153
- Sz=function(a,b){var c,d,e;return _.B(function(f){if(1==f.a)return c=window.muxjs?new Jw:new _.Kw,d=_.Km(a.configuration,["html","single-native"]),a.K=d.create(a),a.Yc=Mz(a),a.Yc.track(a),e=new _.Qw(b,c,a.K,a.Yc,a.configuration),_.x(f,e.I,2);a.J=e;_.z(f)})};Vz=function(a,b){var c,d;return _.B(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.x(e,_.Cp(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d.A=e.f;a.A.configure(a.configuration.manifest);_.z(e)})};
154
- Zz=function(a,b){var c;return _.B(function(d){a.uc=new pw;qw(a.uc,function(e){Wz(a,_.pg,e)});c=new _.Uh(Promise.resolve().then(function(){var e,f,g;return _.B(function(h){switch(h.a){case 1:if(a.f){h.H(3);break}_.zf(h,4);e=a;return _.x(h,a.A.start(b.url,Xz(a)),6);case 6:e.f=h.f;_.Af(h,1);break;case 4:f=_.Bf(h);if(!a.Sa)throw f;return _.x(h,a.Sa(b.url,f),8);case 8:if(g=h.f)b.url=g;else throw f;h.H(1);break;case 3:!a.f.presentationTimeline||a.configuration.manifest.hlsLowLatency||_.K.S(a.configuration.suggestedPresentationDelay)||
155
- isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.Re=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.D=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.L(_.M,4,4014);Yz(a.f.periods);_.z(h)}})}),function(){a.log.info("Aborting parser step...");return a.A.stop()});return _.x(d,c.P,0)})};
156
- fA=function(a){var b,c,d,e,f;return _.B(function(g){switch(g.a){case 1:a.j=new _.Sl({Ab:a.getNetworkEngine(),onError:function(h){return a.onError(h)},Le:function(h){if(a.a){var l=$z(a),m=!1,n=Object.keys(h);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.");
157
- if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],w=_.u(r.variants),y=w.next();!y.done;y=w.next()){y=y.value;var A=[];y.audio&&A.push(y.audio);y.video&&A.push(y.video);A=_.u(A);for(var E=A.next();!E.done;E=A.next()){E=E.value;var F=y.allowedByKeySystem;if(E.keyId){var D=h[p?"00":E.keyId];D=!!D&&!aA.includes(D);y.allowedByKeySystem=D}F!==y.allowedByKeySystem&&(D=E.type,E.type===_.Re&&(D="video "+E.width+"x"+E.height+"@"+_.Gh(E.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
158
- (E.keyId+"'. Applying restrictions to "+D)));r===l&&F!==y.allowedByKeySystem&&(m=!0)}}}if(h=Oy(a.a))if(p=Qy(a.a),n=Ry(a.a),p=wx(p,n,h.variants),!p||p.allowedByKeySystem)a.log.info(Yu),bA(a),cA(a,h.variants);m&&h!==l&&(a.log.info(Yu),bA(a),cA(a,l.variants))}},onExpirationUpdated:function(h,l){if(a.A&&a.A.onExpirationUpdated)a.A.onExpirationUpdated(h,l);a.trigger(new _.J(_.Yc,{expirationTime:l}))},onEvent:function(h){return a.le(h)},getConfiguration:function(){return a.getConfiguration()},Gc:function(){return a.Gc()}});
159
- dA(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.vp(a.f.periods);if(!c){g.H(2);break}f=_.dk(_.Vd);if(!f){g.H(2);break}return _.x(g,f.zj(b,e,a.getNetworkEngine()),4);case 4:return _.x(g,f.mi(c),5);case 5:d=g.f;case 2:return _.x(g,_.Xl(a.j,e,d),6);case 6:a.f&&eA(a,a.f.periods),_.z(g)}})};
160
- qA=function(a){var b,c,d,e,f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a)return b=a.h,c=function(r){a.h&&a.F&&(r.type===_.le&&a.Ld?(a.F.a=gy,Uz(a)):r.type===_.Ze&&a.getState()===_.kn&&.1>a.getBufferInfo().Da(a.getPosition())?(a.F.a=gy,Uz(a)):a.F&&gA(a));hA(a)},d=function(){if(a.h){var r=a.h.playbackRate;0!=r&&a.xc.set(r)}},a.m.on(b,_.Zd,c),a.m.on(b,_.Ud,c),a.m.on(b,_.gd,c),a.m.on(b,_.le,c),a.m.on(b,_.ke,c),a.m.on(b,_.be,c),a.m.on(b,_.Ze,c),a.m.on(b,_.de,d),a.g||(a.g=new _.Tx,a.g.configure(a.configuration.abr)),
161
- iA(a,a.f.periods),a.vc=new by(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.fa=a.configuration.preferredTextLanguage,a.tc=a.configuration.preferredTextRole,_.x(q,_.jm(a.j,b),2);if(3!=q.a){if(!a.j)throw new _.L(_.M,7,7001);a.g.init(function(r,w,y){!a.T&&jA(a,r,w,y)});a.w=kA(a,a.configuration.startTime);a.pc=lA(a);a.xc=new my({te:function(){return b.playbackRate},ug:function(r){b.playbackRate=r},Hi:function(r){b.currentTime+=
162
- r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Dd=new jy(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);mA(a,e);lx(a.f,_.Fg(a.configuration.preferredVideoCodec),_.Fg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=nA(a);a.a.j=a.configuration.streaming;a.D=Kz;return _.x(q,a.a.start(),3)}if(!a.a)throw new _.L(_.M,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=Hy(a.w),g=oA(a,f),Ay(a.w.g,g));h=_.u(a.f.periods);for(l=
163
- h.next();!l.done;l=h.next())m=l.value,pA(a,m);bA(a);n=$z(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");cA(a,n.variants);a.m.one(b,_.vd,function(){a.I.w=Date.now()/1E3-(null===a.Be?0:a.Be)});_.z(q)})};
164
- Yz=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)})){_.Sf("Found variant with audio and video content, so filtering out audio-only content in all periods.");a=_.u(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c.variants=c.variants.filter(b)}};kA=function(a,b){return new Fy(a.h,a.f,a.configuration.streaming,b,function(){a.pc&&yw(a.pc,!0);a.a&&iz(a.a)},function(c){return a.dispatchEvent(c)})};
165
- lA=function(a){var b=new ky(a.f);ly(b,function(){bA(a)});var c=new Aw(a.uc);Bw(c,function(e){e.Od&&e.Od();Wz(a,_.rg,e)},function(e){e.Ke&&e.Ke();Wz(a,_.sg,e)},function(e,f){f||(e.Od&&e.Od(),Wz(a,_.rg,e),e.Ke&&e.Ke(),Wz(a,_.sg,e))});var d=new zw(a.h);d.a.add(b);d.a.add(c);return d};mA=function(a,b){a.F=new hy(b,Math.min(.5,b/2));a.F.a=gy;Uz(a);a.Ma=(new _.Ri(function(){gA(a)})).bb(.25)};
166
- gA=function(a){switch(a.D){case Kz:a:if(a.h.ended||Vw(a.J))var b=!0;else{if(a.isLive()){b=lw(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.xa(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}c=0;if(a.J){var d=Xw(a.J),e=d.video;d=d.audio;var f=a.h.currentTime;if(e||d)c=e&&d?Math.min(e.Da(f),d.Da(f)):e?e.Da(f):d.Da(f)}if(e=a.F){e=a.F;d=c;f=b;var g=e.f.get(e.a);c=e.a;d=f||d>=g?fy:gy;e.a=d;e=c!=d}c=e;e=rA(a);c||a.getState()===_.an&&!e?(a.log.debug("Buffering state changed. Is buffering",
167
- e,"buffered to end",b,"state",a.getState()),Uz(a)):a.Tc&&hA(a)};nA=function(a){var b={wb:function(){return Hy(a.w)},X:a.J,Ab:a.getNetworkEngine(),Je:a.Ah.bind(a),Ie:a.zh.bind(a),onError:a.onError.bind(a),cg:a.cj.bind(a),onEvent:a.le.bind(a),hg:a.Bh.bind(a),Pd:a.pj.bind(a),re:function(){return a.g},fe:a.Lg.bind(a),wg:a.Rj.bind(a),bd:a.j};return new _.Ny(a.f,b)};dA=function(a){var b=_.wk(a.configuration.drm);a.j.h=b};
168
- tA=function(a){a.A&&a.A.configure(a.configuration.manifest);a.j&&dA(a);if(a.a){a.a.j=a.configuration.streaming;try{for(var b=_.u(a.f.periods),c=b.next();!c.done;c=b.next())pA(a,c.value)}catch(e){a.onError(e)}c=Qy(a.a);var d=Ry(a.a);b=$z(a)||a.f.periods[0];c=wx(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?cA(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),sA(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.T?a.g.enable():
169
- a.g.disable())};Lx=function(a){if(a.f&&a.w){var b=uA(a),c=[];a=_.u(vA(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=rx(d);e.active=d==b;c.push(e)}return c}return[]};Jx=function(a,b){if(a.f&&a.a){var c=$z(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(wA(a,c,d,!1),xA(a,d),a.fa=d.language):a.log.error(_.bv,b.id)}};
170
- Mx=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=$z(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.R=null;c=cA(a,e.variants);null!=a.da&&(a.vc=a.da,a.da=null);null==c||a.T||jA(a,c);return}if(b){a.R=b.id;var f=e.variants.find(function(g){return g.id==
171
- b.id});f?(a.R=f.video.id,tx(f)?(yA(a,e,f,!1),zA(a,f,c,d),null==a.da&&(a.da=a.vc),a.vc=new cy(f),cA(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.R=null,null!=a.da&&(a.vc=a.da,a.da=null),c=cA(a,e.variants),null==c||a.T||jA(a,c)}};
172
- Kx=function(a,b){if(a.a&&(a.f||a.w)){var c=Ry(a.a),d=Qy(a.a),e=$v(a.f.periods,Hy(a.w)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id==b&&tx(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 h=a.getTrackManager().Ia();if(h){var l=h.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]===
173
- e.audio.codecs.split(".")[0]){d=e.audio;a.wc=d.id;a.g.setVariants(f);f=$z(a);yA(a,f,e,!1);g||a.T?zA(a,e,!0,0):_.$y(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()};Nx=function(a){var b=a.Ae;return a.f?a.J.getTextDisplayer().isTextVisible():b};
174
- Ix=function(a,b){var c,d,e,f;return _.B(function(g){c=a.Ae;d=b;if(c==d)return g["return"]();a.Ae=d;if(a.D!==Kz)return g.H(0);a.J.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.H(0);if(!b)return Zy(a.a),g.H(0);e=$z(a);f=_.vx(e.textStreams,a.fa,a.tc);return 0<f.length?_.x(g,Wy(a.a,f[0]),0):g.H(0)})};
175
- yA=function(a,b,c,d){var e=a.getTrackManager();a.A.setCurrentVariant(c);if(e){var f=a.I.A;if(c.video){Qx(e,c.video,d);var g=e.ga();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&&(Qx(e,c.audio,d),e=e.Fa(),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})))}Xx(a.N,
176
- b).variant=c};wA=function(a,b,c,d){Xx(a.N,b).text=c;if(b=a.getTrackManager())Qx(b,c,d),c=b.Ga(),a=a.I.A,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}))};
177
- iA=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.u(d.variants),g=f.next();!g.done;g=f.next())if(g=g.value,g.video&&g.video.closedCaptions){g=g.video;for(var h=_.u(g.closedCaptions.keys()),l=h.next();!l.done;l=h.next())if(l=l.value,!e.has(l)){var m={id:a.tg++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,Aa:0,mimeType:_.bc,codecs:"",kind:"caption",
92
+ Ly=function(a){function b(){d=!0}function c(m){f.push(m);_.Pk(m)}a=_.N(a);var d=!1,e,f=[],g=[];(new _.Ok).L(_.Fd,c).L(_.Ge,c).L(_.Ad,c).L(_.Ed,c).L(_.ue,c).V(_.we,function(m){e=m;f.push(m);_.Qk(m)}).V("encv",b).V("enca",b).V("avc1",function(m){g.push({L:m,Ic:1701733238})}).V("avc3",function(m){g.push({L:m,Ic:1701733238})}).V("ac-3",function(m){g.push({L:m,Ic:1701733217})}).V("ec-3",function(m){g.push({L:m,Ic:1701733217})}).V("mp4a",function(m){g.push({L:m,Ic:1701733217})}).parse(a);if(d)return _.Rf("Init segment already indicates encryption."),
93
+ a;if(0===g.length||!e)throw _.Tf("Failed to find boxes needed to fake encryption!"),_.Tf("Failed init segment (hex):",_.nk(a)),new _.L(_.M,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.Rf('Inserting "'+_.Tk(l.Ic)+'" box into init segment.'),a=Ky(a,e,l.L,f,l.Ic);return a};
94
+ Ky=function(a,b,c,d,e){var f=My.value(),g=a.subarray(c.start,c.start+c.size),h=_.sh(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.sh(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);Ny(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.Vi("Xbox One")||_.Ui()?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=_.u(d);for(d=a.next();!d.done;d=a.next())d=d.value,Ny(e,d.start,d.size+l.byteLength);l=_.sh(e,
95
+ b.start);b=_.Uk(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};Ny=function(a,b,c){a=_.sh(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.Oy=function(a,b){this.C=b;this.g=a;this.j=null;this.w=1;this.F=Promise.resolve();this.m=[];this.o=new Map;this.f=new Map;this.I=this.h=this.A=this.B=!1;this.H=0;this.a=new _.H("clpp.mse.Streaming");this.D=!1};
96
+ Py=function(a){var b=a.f.get(_.Re);return b?a.g.periods[b.yb]:(b=a.f.get(_.kc))?a.g.periods[b.yb]:null};Ry=function(a){return _.Qy(a,_.kc)};Sy=function(a){return _.Qy(a,_.Re)};_.Qy=function(a,b){var c=a.f.get(b);return c?c.Qb||c.stream:null};
97
+ Xy=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.A(function(q){switch(q.a){case 1:return c=_.wn,_.x(q,a.C.W.clear(c.TEXT),2);case 2:return a.H++,a.I=!1,d=a.H,e=a.C.W,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.x(q,e.init(f,!1),3);case 3:return a.h?q["return"]():_.x(q,Ty(a,g),4);case 4:if(a.h)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.j.alwaysStreamText;a.H!=d||a.f.has(c.TEXT)||a.I||!l||(m=a.C.vb(),n=Uy(a,m),p=Vy(b,n,0),a.f.set(c.TEXT,p),Wy(a,p,0));_.y(q)}})};
98
+ $y=function(a){a.I=!0;var b=a.f.get(_.Ce);b&&(Yy(b),Zy(b)["catch"](function(){}),a.f["delete"](_.Ce))};bz=function(a,b,c,d){b.video&&_.az(a,b.video,c,d);b.audio&&_.az(a,b.audio,c,d)};
99
+ _.az=function(a,b,c,d){var e=a.f.get(b.type);if(!e&&b.type==_.Ce&&a.j.ignoreTextStreamFailures)Xy(a,b);else if(e){var f=cz(a,b);if(c&&f!=e.yb)for(a.a.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),b=_.u(a.f.values()),c=b.next();!c.done;c=b.next())dz(a,c.value);else{e.Qb&&(a.a.debug("switch during trick play mode",b),b.trickModeVideo?(e.Qb=b,b=b.trickModeVideo,a.a.debug("switch found trick play stream",b)):(e.Qb=null,a.a.debug("switch found no special trick play stream")));
100
+ var g=a.m[f];if(g&&g.Lc&&(g=a.o.get(b.id))&&g.Lc)if(e.stream!=b){g=a.g.presentationTimeline.getDuration();var h=a.C.vb();h=ez(a,e,h);!c&&(e.endOfStream||h>=g)?a.a.debug(xv+fz(e)+" already buffered to the end. Not switching."):(b.type==_.Ce&&Vw(a.C.W,_.Pi(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.hd=!0,a.a.debug("switch: switching to Stream "+fz(e)),gz(a,e,f)&&(a.a.info("Aborting current segment request to switch."),e.Bb.abort()),c&&(e.Wb?e.Sd=!0:e.Wa?(e.Eb=!0,e.vd=d,e.Sd=!0):
101
+ (Yy(e),hz(a,e,!0,d)["catch"](function(l){if(a.C)a.C.onError(l)}))))}else a.a.debug(xv+fz(e)+" already active")}}};gz=function(a,b,c){if(!b.Bb)return!1;var d=a.C.vb(),e=a.C.W.ya(b.type);c=(c=iz(a,b,d,e,c))?c.Oa?c.Oa-c.$a+1:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.Oa?f.Oa-f.$a+1:null)||0);f=a.C.re().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.g.minBufferTime||0,a.j.rebufferingGoal))return!0;a=b.Bb;a=a.h?a.h.bytesRemaining:-1;return 0>a||a>c?!0:!1};
102
+ jz=function(a){function b(l){return a.C.W.cc(l,c,0)}var c=a.C.vb(),d=!1,e=Uy(a,c);if(_.fh(a.f.values(),function(l){return l.yb==e}))for(var f=_.u(a.f.keys()),g=f.next();!g.done;g=f.next()){g=g.value;var h=a.f.get(g);h.stream.segmentIterator=null;b(g)||(dz(a,h),d=!0)}else if(!_.fh(a.f.keys(),b)){a.a.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.f.values());for(f=d.next();!f.done;f=d.next())dz(a,f.value);d=!0}d||a.a.debug("(all): seeked: buffered seek: presentationTime\x3d"+
103
+ c)};dz=function(a,b){var c=fz(b);b.Wb?a.a.debug(c,"clear: already clearing the buffer"):b.Eb?a.a.debug(c,"clear: already waiting"):b.Wa?(a.a.debug(c,"clear: currently updating"),b.Eb=!0,b.vd=0):null==a.C.W.qb(b.type)?(a.a.debug(c,"clear: nothing buffered"),null==b.pb&&Wy(a,b,0)):(a.a.debug(c,"clear: handling right now"),Yy(b),hz(a,b,!1,0)["catch"](function(d){if(a.C)a.C.onError(d)}))};
104
+ lz=function(a,b,c,d,e){var f,g,h,l,m,n,p;return _.A(function(q){if(1==q.a)return f=a.C.vb(),g=Uy(a,f),h=_.wn,l=new Map,m=new Set,b&&(l.set(h.AUDIO,b),m.add(b)),c&&(l.set(h.VIDEO,c),m.add(c)),d&&(l.set(h.TEXT,d),m.add(d)),n=a.C.W,p=a.j.forceNativeTS,_.x(q,n.init(l,p),2);if(3!=q.a){if(a.h)return q["return"]();kz(a);return _.x(q,Ty(a,m),3)}if(a.h)return q["return"]();l.forEach(function(r,w){if(!a.f.has(w)){var z=Vy(r,g,e);a.f.set(w,z);Wy(a,z,0)}});_.y(q)})};
105
+ Vy=function(a,b,c){return{stream:a,type:a.type,Nb:null,segmentIterator:null,pa:null,Qb:null,hd:!0,yb:b,endOfStream:!1,Wa:!1,pb:null,Eb:!1,vd:0,Sd:!1,Wb:!1,Se:!1,Gc:!1,qg:c||0,Bb:null,yd:!1,Sf:0}};
106
+ mz=function(a,b){var c=a.m[b];if(c)return a.a.debug("(all) Period "+b+Uu),c.O;a.a.debug("(all) setting up Period "+b);c={O:new _.Sh,Lc:!1};a.m[b]=c;for(var d=new Set,e=_.u(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=_.u(a.g.periods[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.F=a.F.then(function(){return a.h?null:Ty(a,d)}).then(function(){a.h||
107
+ (a.m[b].O.resolve(),a.m[b].Lc=!0,a.a.debug("(all) setup Period "+b))})["catch"](function(g){a.h||(a.m[b].O["catch"](function(){}),a.m[b].O.reject(),delete a.m[b],a.a.warn("(all) failed to setup Period "+b),a.C.onError(g))});return c.O};
108
+ Ty=function(a,b){var c,d,e,f,g,h,l,m,n,p,q;return _.A(function(r){switch(r.a){case 1:c=[];d=_.u(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.o.get(f.id))?(a.a.debug("(all) Stream "+f.id+Uu),c.push(g.O)):(a.a.debug("(all) setting up Stream "+f.id),a.o.set(f.id,{O:new _.Sh,Lc:!1}),c.push(f.createSegmentIndex()));_.zf(r,2);return _.x(r,Promise.all(c),4);case 4:if(a.h)return r["return"]();_.Af(r,3);break;case 2:h=_.Bf(r);if(a.h)return r["return"]();l=_.u(b);for(e=l.next();!e.done;e=l.next())m=
109
+ e.value,a.o.get(m.id).O["catch"](function(){}),a.o.get(m.id).O.reject(),a.o["delete"](m.id);throw h;case 3:n=_.u(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.o.get(p.id),q.Lc||(q.O.resolve(),q.Lc=!0,a.a.debug("(all) setup Stream "+p.id));_.y(r)}})};kz=function(a){var b=a.g.presentationTimeline.getDuration();Infinity>b?a.C.W.Sb(b):a.C.W.Sb(Math.pow(2,32))};
110
+ pz=function(a,b){function c(p){return p.type==_.Ce&&p.stream.mimeType==_.cc}if(c(b))return bx(a.C.W,b.stream.originalId||""),null;var d=fz(b),e=a.C.vb(),f=ez(a,b,e);a.a.debug(d,"timeNeeded\x3d"+f);var g=cz(a,b.stream),h=Uy(a,f),l=a.C.W.Da(b.type,e);a.a.debug(d,"update_:",rv+e,"bufferedAhead\x3d"+l);var m=Math.max(a.g.minBufferTime||0,a.j.rebufferingGoal,a.j.bufferingGoal)*a.w,n=iw(a.g.presentationTimeline);if(null!=n&&f>=n&&!b.yd)return nz(a,b),null;b.endOfStream=!1;b.yb=h;if(h!=g)return a.a.debug(d,
111
+ "need Period "+h,rv+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.a.debug(d,"buffering goal met"),a.j.bufferLimitUpdateInterval||.5;h=a.C.W.ya(b.type);h=iz(a,b,e,h,g);if(!h)return a.g.presentationTimeline.isLive()||b.type===_.Ce?a.j.bufferLimitUpdateInterval||1:(a.a.debug("Media state "+d+": no next segment found. Assuming EOS."),nz(a,b),null);d=Infinity;l=_.u(a.f.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=ez(a,m,e),d=Math.min(d,m));if(f>=d+a.g.presentationTimeline.a)return a.j.bufferLimitUpdateInterval||
112
+ 1;b.qg=0;oz(a,b,e,g,h)["catch"](function(){});return null};nz=function(a,b){a.a.debug(fz(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.Re){var c=a.f.get(_.Ce);c&&c.stream.mimeType==_.cc&&(c.endOfStream=!0)}};ez=function(a,b,c){if(!b.Nb||!b.pa)return Math.max(c,b.qg);c=cz(a,b.Nb);return a.g.periods[c].startTime+b.pa.endTime};
113
+ iz=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===_.qz)b.stream.segmentIterator?a=tw(b.stream.segmentIterator):b.pa||d?(e=b.pa?b.pa.endTime:d,a.a.info($u,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=xw(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.a.warn($u,kv,"endTime:",e,b.pa)),a=d):(e=Math.max(c,0),a.a.info($u,"looking up segment","lookupTime:",e,qv,c),d=null,d||(b.stream.segmentIterator=xw(b.stream.segmentIndex,
114
+ c),d=b.stream.segmentIterator.next().value),null===d&&a.a.warn($u,kv,"lookupTime:",e,qv,c),a=d);else{var f=fz(b);b.pa&&b.stream==b.Nb?(d=b.pa.position+1,a.a.debug(f,"next position known:","position\x3d"+d),a=rz(a,b,e,d)):(b.pa?(a.a.debug(f,"next position unknown: another Stream buffered"),c=cz(a,b.Nb),c=sz(a,b,a.g.periods[c].startTime+b.pa.endTime,e)):(a.a.debug(f,"next position unknown: nothing buffered"),c=sz(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.j&&a.j.ignoreDrift||(f=rz(a,b,e,
115
+ Math.max(0,c-1))),a=f||rz(a,b,e,c)))}return a};sz=function(a,b,c,d){var e=fz(b);d=a.g.periods[d];var f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.a.debug(e,"Looked up segment:",rv+c,"lookupTime\x3d"+f,mv+d.startTime,"Result: segment position\x3d"+b);null==b&&a.a.warn(e,"cannot find segment:",mv+d.startTime,"lookupTime\x3d"+f);return b};
116
+ rz=function(a,b,c,d){var e=fz(b);c=a.g.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.a.debug(e,"segment does not exist:",mv+c.startTime,"position\x3d"+d),null;var g=a.g.presentationTimeline;d=_.nw(g);g=mw(g);return!b.yd&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.a.debug(e,"segment is not available:",mv+c.startTime,vv+f.startTime,sv+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
117
+ oz=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,r,w,z,C,E;return _.A(function(F){f=_.wn;g=fz(b);h=a.g.periods[d];a.a.debug(g,"fetchAndAppend_:",rv+c,mv+h.startTime,uv+e.position,vv+e.startTime,sv+e.endTime);l=b.stream;m=b.stream.segmentIterator;n=a.g.presentationTimeline.getDuration();p=a.g.periods[d+1];q=Math.max(0,h.startTime-.1);r=p?p.startTime+.01:n;w=tz(a,b,d,q,r,e);b.Wa=!0;b.hd=!1;a.a.debug(g,"fetching segment");z=!1;C=function(B,I){if(a.h||a.A)return null;z=!0;return uz(a,b,c,h,l,e,B,I)};E=a.C.W.ya(b.type)||
118
+ 0;w.then(function(){return a.h||a.A?null:vz(a,b,e,!1,function(B){return C(B.data,!0)})}).then(function(B){return a.h||a.A?null:z||null===B?(wz(a,b,E,e,l),null):C(B,!1)}).then(function(){if(!a.h&&!a.A){wz(a,b,E,e,l);b.Wa=!1;b.Se=!1;b.Eb||a.C.Pd();if(m){var B=m.next().value;B&&a.a.debug("New iterated segment",B)}Wy(a,b,0);xz(a,b,l);a.a.debug(g,"finished fetch and append")}})["catch"](function(B){return _.A(function(I){if(a.h||a.A)return I["return"]();b.Wa=!1;if(b.type==f.TEXT&&a.j.ignoreTextStreamFailures)return 1001==
119
+ B.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."),a.f["delete"](f.TEXT),I.G(0);if(7001==B.code)return b.Wa=!1,b.pb=null,Wy(a,b,0),I.G(0);if(3017===B.code)return yz(a,b,B),I.G(0);if(1001===B.code&&B.data&&404===B.data[1])return a.a.warn(g,"request for segment failed","segment not available on server",uv+e.position,vv+e.startTime,sv+e.endTime,"error\x3d"+B),b.Wa=!1,b.pb=null,Wy(a,b,1),I.G(0);if(b.type===f.TEXT)return B instanceof
120
+ _.L&&B.a(1),Yy(b),a.C.onError(new _.L(1,2,2010,B)),I.G(0);if(1001<=B.code&&1003>=B.code)return _.x(I,zz(a,b,h,B),0);a.a.error(g,"failed fetch and append: code\x3d"+B.code);b.Gc=!0;B instanceof _.L&&B.a(_.M);return _.x(I,Az(a,B),0)})});_.y(F)})};
121
+ Cz=function(a,b){b=void 0===b?!1:b;if(a.h)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=_.u(a.f.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=fz(d);if(d.Gc||b&&Bz(d))a.a.info(e,"Retrying after failure..."),d.Gc=!1,Wy(a,d,.1)}};
122
+ yz=function(a,b,c){var d=fz(b);if(Array.from(a.f.values()).some(function(f){return f!=b&&f.Se}))a.a.debug(d,bv,"waiting for another stream to recover...");else{var e=Math.round(100*a.w);if(20<e)a.w-=.2;else if(4<e)a.w-=.04;else{a.a.error(d,"MediaSource threw QuotaExceededError too many times");b.Gc=!0;a.A=!0;a.C.onError(c);return}a.a.warn(d,bv,"reducing buffering goals by "+(100-Math.round(100*a.w))+"%");b.Se=!0}Wy(a,b,4)};
123
+ zz=function(a,b,c,d){var e,f;return _.A(function(g){e=1001===d.code&&500<=d.data.status;f=!0;e||(f=!a.C.ee(b.stream,c));if(!f)return g.G(0);b.Gc=!0;d.a(_.M);return _.x(g,Az(a,d),0)})};
124
+ tz=function(a,b,c,d,e,f){c=a.g.periods[c].startTime-f.Ja;if(!b.hd&&c===b.Sf)return Promise.resolve();b.Sf=c;var g=fz(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=dx(a.C.W,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.hd)return d;a.a.debug(g,"fetching init segment");e=vz(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.h)return null;a.a.debug(g,"appending init segment");return Dz(a,
125
+ h,b).then(function(){return ax(a.C.W,b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.hd=!0;return Promise.reject(h)});return Promise.all([d,e])};Dz=function(a,b,c){var d;return _.A(function(e){if(!a.j.patchEdgeWhenMixedContent||!_.Ui())return e.G(0);d=Ly(b);return _.x(e,ax(a.C.W,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
126
+ uz=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,r,w,z,C;return _.A(function(E){switch(E.a){case 1:l=fz(b);if(!(e&&e.keyId&&a.C.$c)){E.G(2);break}m=Ev(a.C.$c,e.keyId);if(!m){a.a.warn("Unable to find DRM session for "+e.keyId);E.G(2);break}_.zf(E,4);return _.x(E,m,6);case 6:_.Af(E,2);break;case 4:n=_.Bf(E),a.a.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.C.$c&&Gv(a.C.$c,e.keyId))){E.G(7);break}Yy(b);p=cz(a,e);q=Ez(a,p);if(!q){E.G(8);break}return _.x(E,q,8);case 8:return r=
127
+ a.C.ee(e,d,ov),w=f.startTime+d.startTime,z=f.endTime+d.startTime,a.a.warn(l,"Blocked append for "+w+" - "+z+": "+r+". Stream with Key ID "+(e.keyId+" has restrictions.")),E["return"](Promise.resolve());case 7:return C=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Ok).V("emsg",a.tj.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),E["return"](Fz(a,b,c).then(function(){if(a.h)return null;var F=f.startTime+d.startTime,B=f.endTime+d.startTime;a.a.debug(l,
128
+ "Appending segment with "+(F.toFixed(3)+" - "+B.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.Gh(e.bandwidth)+" Fragment: ")+h);return ax(a.C.W,b.type,g,F,B,C,e.id,h)}).then(function(){a.h||(a.a.debug(l,"appended media segment"),b.Nb=e,b.pa=f)}))}})};
129
+ wz=function(a,b,c,d,e){if(!a.g.presentationTimeline.isLive()&&b.type!==_.Ce){var f=fz(b);c=(a.C.W.ya(b.type)||0)-c;var g=d.endTime-d.startTime,h=c-g;Math.abs(h)>=Math.min(.01,g)&&Math.abs(h)<=Math.min(1,g)&&(a.a.debug(f,"Adjusted segment",d.position,"with real duration",c,"and accounted for",h,"delta between segment duration and real duration"),b.yd=!0,e.adjustSegmentDurations(d.position,h))}};
130
+ Gz=function(a,b,c){(new _.Ok).L(_.Fd,_.Pk).L(_.Ge,_.Pk).L(_.Ad,_.Pk).L(_.Ed,_.Pk).L(_.ue,_.Pk).V(_.we,_.Qk).L("encv",function(d){d.reader.skip(78);_.Pk(d)}).L(_.oe,_.Pk).L("schi",_.Pk).L("tenc",function(d){d.reader.skip(6);if(_.Ik(d.reader)){d.reader.skip(1);var e=_.nk(_.Nk(d.reader,16));e!==b.stream.keyId&&(a.a.debug(fz(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.parser.stop()}).parse(c)};
131
+ Fz=function(a,b,c){if(a.h)return Promise.resolve();var d=fz(b);a.a.debug(d,"checking buffer length");var e=Math.max(a.j.bufferBehind,a.g.presentationTimeline.a),f=a.C.W.qb(b.type);if(null==f)return a.a.debug(d,"buffer behind okay because nothing buffered:",rv+c,hv+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.a.debug(d,"buffer behind okay:",rv+c,iv+g,hv+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.a.debug(d,"buffer behind too large:",rv+c,iv+g,hv+e,"overflow\x3d"+h);return a.C.W.remove(b.type,
132
+ f,f+h).then(function(){a.h||a.a.debug(d,"evicted "+h+" seconds")})};xz=function(a,b,c){if(!a.B){b=fz(b);var d=Array.from(a.f.values());1!=d.length||d[0].type!=_.Ce?a.B=d.every(function(e){return e.type==_.Ce||a.D?!0:!e.Eb&&!e.Wb&&e.pa}):a.D&&(a.B=!0);a.B&&(a.a.debug(b,"startup complete"),c=cz(a,c),Ez(a,c))}};
133
+ Ez=function(a,b){var c=null;a.m[b]||(c=mz(a,b).then(function(){a.h||(a.a.debug(jv),a.C.He())})["catch"](Jv));for(var d=0;d<a.g.periods.length;++d)mz(a,d)["catch"](Jv);a.C.qj&&(a.a.debug("calling onStartupComplete()..."),a.C.qj());return c};
134
+ Hz=function(a,b){var c=fz(b),d=cz(a,b.stream);if(b.yb!=d){var e=b.yb,f=Array.from(a.f.values());f.every(function(g){return g.yb==e})?f.every(Bz)?(a.a.debug(c,"all need Period "+e),mz(a,e).then(function(){if(!a.h)if(f.every(function(n){var p=Bz(n),q=cz(a,n.stream);return p&&n.yb==e&&q!=e})){var g=a.g.periods[e];a.a.debug(c,"calling onChooseStreams()...");var h=a.C.Ie(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.Re,h.variant.video);h.variant&&h.variant.audio&&l.set(_.kc,
135
+ h.variant.audio);h.text&&l.set(_.Ce,h.text);var m=_.u(a.f.keys());for(h=m.next();!h.done;h=m.next())if(h=h.value,!l.has(h)&&h!=_.Ce){a.a.error(c,"invalid Streams chosen: missing "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}m=_.u(Array.from(l.keys()));for(h=m.next();!h.done;h=m.next())if(h=h.value,!a.f.has(h))if(h==_.Ce)lz(a,null,null,l.get(_.Ce),g.startTime),l["delete"](h);else{a.a.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}g=_.u(Array.from(a.f.keys()));
136
+ for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.az(a,m,!1,0),Wy(a,a.f.get(h),0)):a.f["delete"](h);a.a.debug(c,jv);a.C.He()}else a.a.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](Jv)):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)}};Uy=function(a,b){var c=aw(a.g.periods,b+_.yq);return c?a.g.periods.indexOf(c):0};
137
+ cz=function(a,b){for(var c=a.g.periods,d=0;d<c.length;d++){for(var e=c[d],f=new Set,g=_.u(e.variants),h=g.next();!h.done;h=g.next())h=h.value,h.audio&&f.add(h.audio),h.video&&f.add(h.video),h.video&&h.video.trickModeVideo&&f.add(h.video.trickModeVideo);e=_.u(e.textStreams);for(g=e.next();!g.done;g=e.next())f.add(g.value);if(f.has(b))return d}return-1};
138
+ vz=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.ew(c.Ga(),c.$a,c.Oa,a.j.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Bc?null:e;f.disableFragmentSupport=c.Bc||a.j.disableFragmentSupport;f.disableMergedFragments=a.j.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){Gz(a,b,g.data)}),b.type===_.Re&&a.j.overridePasp&&f.responseModifiers.push(a.Sj.bind(a)));a.a.debug("fetching: reference\x3d",
139
+ c);c=a.C.zb.fetch(f);b.Bb=c;return c.O.then(function(g){var h=a.C.re(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.Bb=null;return g.data})};
140
+ hz=function(a,b,c,d){var e,f,g,h;return _.A(function(l){if(1==l.a)return e=fz(b),b.Eb=!1,b.Sd=!1,b.vd=0,b.Wb=!0,b.stream.segmentIterator=null,a.a.debug(e,"clearing buffer"),d?(g=a.C.vb(),h=a.C.W.getDuration(),f=a.C.W.remove(b.type,g+d,h)):f=a.C.W.clear(b.type).then(function(){return!a.h&&c?a.C.W.flush(b.type):null}),_.x(l,f,2);if(a.h)return l["return"]();a.a.debug(e,"cleared buffer");b.Nb=null;b.pa=null;b.Wb=!1;b.endOfStream=!1;b.yd=!1;Wy(a,b,0);_.y(l)})};
141
+ Wy=function(a,b,c){a.a.debug(fz(b),"updating in "+c+" seconds");b.pb=(new _.Qi(function(){var d;return _.A(function(e){if(1==e.a)return _.zf(e,2),_.x(e,a.Ab(b),4);if(2!=e.a)return _.Af(e,0);d=_.Bf(e);if(a.C)a.C.onError(d);_.y(e)})})).Z(c)};Yy=function(a){null!=a.pb&&(a.pb.stop(),a.pb=null)};Zy=function(a){return _.A(function(b){return a.Bb?_.x(b,a.Bb.abort(),0):b.G(0)})};
142
+ Iz=function(a){var b,c,d,e;return _.A(function(f){b=[];c=_.u(a.f.values());for(d=c.next();!d.done;d=c.next())e=d.value,Yy(e),e.Wa&&e.Bb&&(e.Wa=!1,b.push(e.Bb.abort())),e.Eb&&b.push(hz(a,e,!0,0));return _.x(f,Promise.all(b),0)})};Jz=function(a,b,c){(a=a.f.get(b))&&c&&(Yy(a),a.stream=c,a.Nb=c,a.pa&&(a.pa=c.getSegmentReference(a.pa.position)),a.pa||(a.Nb=null))};
143
+ Az=function(a,b){var c;return _.A(function(d){switch(d.a){case 1:if(a.h)return d["return"]();if(!a.C.ug){d.G(2);break}_.zf(d,3);return _.x(d,a.C.ug(b),5);case 5:_.Af(d,2);break;case 3:c=_.Bf(d),c.cause=b,b=c;case 2:if(!b.f)a.C.onError(b);_.y(d)}})};fz=function(a){return"("+a.type+":"+a.stream.id+")"};Bz=function(a){return!a.Wa&&null==a.pb&&!a.Eb&&!a.Wb};
144
+ Mz=function(a){_.ck.call(this,lv);var b=this;this.D=Kz;this.h=this.Ob=this.U=null;this.Be=0;this.Yf=2;this.Xc=null;this.ze=!1;this.m=new _.eg;this.ua=this.Dd=this.vc=this.nc=this.w=this.I=this.j=null;this.Sc=!1;this.g=this.f=this.A=this.a=this.sc=this.F=null;this.rg=1E9;this.Jd=new Set;this.S=!0;this.ba=null;this.mg=!1;this.lg=0;this.$=null;this.M=new Wx;this.ng={width:Infinity,height:Infinity};this.H=null;this.aa=_.Xm;this.tc=new cy(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
145
+ this.configuration.preferredAudioChannelCount);this.ga=this.configuration.preferredTextLanguage;this.P=this.uc=null;this.wc=new Map;this.da=null;this.rc=this.configuration.preferredTextRole;a&&a(this);this.Ae=null;this.m.on(window,"online",function(){b.D===Lz&&Cz(b.a)})};
146
+ Nz=function(a){return new _.Wv(function(b){if(void 0===b||null===b)return null;var c=a.getTrackManager(),d=[];if(c){c=_.u(c.getVideoTracks());for(var e=c.next();!e.done;e=c.next())d.push.apply(d,_.mf(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
147
+ Oz=function(a,b){if(a.aa!==b)if(a.aa===_.hn&&b!==_.Xm)a.log.info(_.dv+Mv(b,_.fn));else{var c=a.Be;c=0===c?0:Date.now()-c;var d=a.aa;a.aa=b;a.Be=Date.now();a.H&&_.Nm(a.H.a,a.aa);b===_.bn&&(a.Yf=a.ye?1:2);var e=a.Yf,f={currentState:a.aa,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.bn||d===_.bn?e:void 0};a.log.info(_.fb+Mv(d,_.fn)+" -\x3e "+(Mv(b,_.fn)+(b!==_.bn?"":"["+Mv(e,_.en)+"]")));a.trigger(new _.J(_.se,{detail:f}));(b===_.dn||b===_.hn)&&a.ua&&a.ua.stop();b===_.bn?a.trigger(new _.J(_.wc,
148
+ {detail:{bufferedTimeMS:-1,reason:e}})):d===_.bn&&a.trigger(new _.J(_.vc,{detail:{bufferedTimeMS:c,reason:e}}))}};Uz=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.A(function(e){switch(e.a){case 1:return a.D===Pz?e["return"](Promise.reject(new _.L(_.M,7,7E3))):_.x(e,Qz(a),2);case 2:return _.x(e,Rz(a),3);case 3:c=_.Zh(4)||_.Zh(5);if(!b&&!c){e.G(0);break}d=a.getSurface().getMedia();return _.x(e,Sz(a,d),5);case 5:return _.x(e,Tz(a,d),0)}})};
149
+ Sz=function(a,b){a.h||(a.m.on(b,_.jd,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 _.L(_.M,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()};Rz=function(a){a.h&&(a.m.off(a.h,_.jd),a.h=null);return Promise.resolve()};
150
+ Qz=function(a){var b;return _.A(function(c){switch(c.a){case 1:a.D!==Pz&&(a.D=Kz);if(b=a.h)a.m.off(b,_.wd),a.m.off(b,_.$d),a.m.off(b,_.Vd),a.m.off(b,_.id),a.m.off(b,_.ee),a.m.off(b,_.ce);a.nc&&(a.nc.release(),a.nc=null);a.ua&&(a.ua.stop(),a.ua=null);if(!a.A){c.G(2);break}return _.x(c,a.A.stop(),3);case 3:a.A=null;case 2:if(!a.g){c.G(4);break}return _.x(c,a.g.stop(),4);case 4:if(!a.a){c.G(6);break}return _.x(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.w&&(a.w.release(),a.w=null);if(!a.I){c.G(8);break}return _.x(c,
151
+ a.I.destroy(),9);case 9:a.I=null;case 8:a.Dd&&(a.Dd.release(),a.Dd=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.j){c.G(10);break}return _.x(c,a.j.destroy(),11);case 11:a.j=null;case 10:a.M.clear(),a.F=null,a.Jd.clear(),a.f=null,a.H=null,a.S=!0,a.wc.clear(),a.Sc=!1,Vz(a),_.y(c)}})};
152
+ Tz=function(a,b){var c,d,e;return _.A(function(f){if(1==f.a)return c=window.muxjs?new Kw:new _.Lw,d=_.Lm(a.configuration,["html","single-native"]),a.J=d.create(a),a.Xc=Nz(a),a.Xc.track(a),e=new _.Rw(b,c,a.J,a.Xc,a.configuration),_.x(f,e.H,2);a.I=e;_.y(f)})};Wz=function(a,b){var c,d;return _.A(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.x(e,_.Dp(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d.A=e.f;a.A.configure(a.configuration.manifest);_.y(e)})};
153
+ $z=function(a,b){var c;return _.A(function(d){a.sc=new qw;rw(a.sc,function(e){Xz(a,_.pg,e)});c=new _.Th(Promise.resolve().then(function(){var e,f,g;return _.A(function(h){switch(h.a){case 1:if(a.f){h.G(3);break}_.zf(h,4);e=a;return _.x(h,a.A.start(b.url,Yz(a)),6);case 6:e.f=h.f;_.Af(h,1);break;case 4:f=_.Bf(h);if(!a.Ra)throw f;return _.x(h,a.Ra(b.url,f),8);case 8:if(g=h.f)b.url=g;else throw f;h.G(1);break;case 3:!a.f.presentationTimeline||a.configuration.manifest.hlsLowLatency||_.K.R(a.configuration.suggestedPresentationDelay)||
154
+ isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.Qe=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.D=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.L(_.M,4,4014);Zz(a.f.periods);_.y(h)}})}),function(){a.log.info("Aborting parser step...");return a.A.stop()});return _.x(d,c.O,0)})};
155
+ gA=function(a){var b,c,d,e,f;return _.A(function(g){switch(g.a){case 1:a.j=new _.Tl({zb:a.getNetworkEngine(),onError:function(h){return a.onError(h)},Ke:function(h){if(a.a){var l=aA(a),m=!1,n=Object.keys(h);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.");
156
+ if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],w=_.u(r.variants),z=w.next();!z.done;z=w.next()){z=z.value;var C=[];z.audio&&C.push(z.audio);z.video&&C.push(z.video);C=_.u(C);for(var E=C.next();!E.done;E=C.next()){E=E.value;var F=z.allowedByKeySystem;if(E.keyId){var B=h[p?"00":E.keyId];B=!!B&&!bA.includes(B);z.allowedByKeySystem=B}F!==z.allowedByKeySystem&&(B=E.type,E.type===_.Re&&(B="video "+E.width+"x"+E.height+"@"+_.Gh(E.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
157
+ (E.keyId+"'. Applying restrictions to "+B)));r===l&&F!==z.allowedByKeySystem&&(m=!0)}}}if(h=Py(a.a))if(p=Ry(a.a),n=Sy(a.a),p=xx(p,n,h.variants),!p||p.allowedByKeySystem)a.log.info(Zu),cA(a),dA(a,h.variants);m&&h!==l&&(a.log.info(Zu),cA(a),dA(a,l.variants))}},onExpirationUpdated:function(h,l){if(a.A&&a.A.onExpirationUpdated)a.A.onExpirationUpdated(h,l);a.trigger(new _.J(_.$c,{expirationTime:l}))},onEvent:function(h){return a.le(h)},getConfiguration:function(){return a.getConfiguration()},Fc:function(){return a.Fc()}});
158
+ eA(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.wp(a.f.periods);if(!c){g.G(2);break}f=_.ek(_.Wd);if(!f){g.G(2);break}return _.x(g,f.vj(b,e,a.getNetworkEngine()),4);case 4:return _.x(g,f.ji(c),5);case 5:d=g.f;case 2:return _.x(g,_.Yl(a.j,e,d),6);case 6:a.f&&fA(a,a.f.periods),_.y(g)}})};
159
+ rA=function(a){var b,c,d,e,f,g,h,l,m,n,p;return _.A(function(q){if(1==q.a)return b=a.h,c=function(r){a.h&&a.F&&(r.type===_.me&&a.Ld?(a.F.a=hy,Vz(a)):r.type===_.Ze&&a.getState()===_.ln&&.1>a.getBufferInfo().Da(a.getPosition())?(a.F.a=hy,Vz(a)):a.F&&hA(a));iA(a)},d=function(){if(a.h){var r=a.h.playbackRate;0!=r&&a.vc.set(r)}},a.m.on(b,_.$d,c),a.m.on(b,_.Vd,c),a.m.on(b,_.id,c),a.m.on(b,_.me,c),a.m.on(b,_.le,c),a.m.on(b,_.ce,c),a.m.on(b,_.Ze,c),a.m.on(b,_.ee,d),a.g||(a.g=new _.Ux,a.g.configure(a.configuration.abr)),
160
+ jA(a,a.f.periods),a.tc=new cy(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.ga=a.configuration.preferredTextLanguage,a.rc=a.configuration.preferredTextRole,_.x(q,_.km(a.j,b),2);if(3!=q.a){if(!a.j)throw new _.L(_.M,7,7001);a.g.init(function(r,w,z){!a.S&&kA(a,r,w,z)});a.w=lA(a,a.configuration.startTime);a.nc=mA(a);a.vc=new ny({te:function(){return b.playbackRate},sg:function(r){b.playbackRate=r},Di:function(r){b.currentTime+=
161
+ r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Dd=new ky(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);nA(a,e);mx(a.f,_.Fg(a.configuration.preferredVideoCodec),_.Fg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=oA(a);a.a.j=a.configuration.streaming;a.D=Lz;return _.x(q,a.a.start(),3)}if(!a.a)throw new _.L(_.M,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=Iy(a.w),g=pA(a,f),By(a.w.g,g));h=_.u(a.f.periods);for(l=
162
+ h.next();!l.done;l=h.next())m=l.value,qA(a,m);cA(a);n=aA(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");dA(a,n.variants);a.m.one(b,_.wd,function(){a.H.w=Date.now()/1E3-(null===a.Ae?0:a.Ae)});_.y(q)})};
163
+ Zz=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)})){_.Sf("Found variant with audio and video content, so filtering out audio-only content in all periods.");a=_.u(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c.variants=c.variants.filter(b)}};lA=function(a,b){return new Gy(a.h,a.f,a.configuration.streaming,b,function(){a.nc&&zw(a.nc,!0);a.a&&jz(a.a)},function(c){return a.dispatchEvent(c)})};
164
+ mA=function(a){var b=new ly(a.f);my(b,function(){cA(a)});var c=new Bw(a.sc);Cw(c,function(e){e.Od&&e.Od();Xz(a,_.rg,e)},function(e){e.Je&&e.Je();Xz(a,_.sg,e)},function(e,f){f||(e.Od&&e.Od(),Xz(a,_.rg,e),e.Je&&e.Je(),Xz(a,_.sg,e))});var d=new Aw(a.h);d.a.add(b);d.a.add(c);return d};nA=function(a,b){a.F=new iy(b,Math.min(.5,b/2));a.F.a=hy;Vz(a);a.ua=(new _.Si(function(){hA(a)})).ab(.25)};
165
+ hA=function(a){switch(a.D){case Lz:a:if(a.h.ended||Ww(a.I))var b=!0;else{if(a.isLive()){b=mw(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.ya(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.I){var d=Yw(a.I);c=d.video;d=d.audio;var e=a.h.currentTime;c&&d?(c=c.Da(e),d=d.Da(e),c=Math.min(c,d)):c=c?c.Da(e):d?d.Da(e):0}else c=0;if(d=a.F){d=a.F;var f=b,g=d.f.get(d.a);e=d.a;c=f||c>=g?gy:hy;d.a=c;d=e!=c}c=d;d=sA(a);c||a.getState()===_.bn&&!d?(a.log.debug("Buffering state changed. Is buffering",
166
+ d,"buffered to end",b,"state",a.getState()),Vz(a)):a.Sc&&iA(a)};oA=function(a){var b={vb:function(){return Iy(a.w)},W:a.I,zb:a.getNetworkEngine(),Ie:a.xh.bind(a),He:a.wh.bind(a),onError:a.onError.bind(a),bg:a.Zi.bind(a),onEvent:a.le.bind(a),gg:a.yh.bind(a),Pd:a.lj.bind(a),re:function(){return a.g},ee:a.Jg.bind(a),ug:a.Nj.bind(a),$c:a.j};return new _.Oy(a.f,b)};eA=function(a){var b=_.xk(a.configuration.drm);a.j.h=b};
167
+ uA=function(a){a.A&&a.A.configure(a.configuration.manifest);a.j&&eA(a);if(a.a){a.a.j=a.configuration.streaming;try{for(var b=_.u(a.f.periods),c=b.next();!c.done;c=b.next())qA(a,c.value)}catch(e){a.onError(e)}c=Ry(a.a);var d=Sy(a.a);b=aA(a)||a.f.periods[0];c=xx(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?dA(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),tA(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.S?a.g.enable():
168
+ a.g.disable())};Mx=function(a){if(a.f&&a.w){var b=vA(a),c=[];a=_.u(wA(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=sx(d);e.active=d==b;c.push(e)}return c}return[]};Kx=function(a,b){if(a.f&&a.a){var c=aA(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(xA(a,c,d,!1),yA(a,d),a.ga=d.language):a.log.error(_.cv,b.id)}};
169
+ Nx=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=aA(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.P=null;c=dA(a,e.variants);null!=a.da&&(a.tc=a.da,a.da=null);null==c||a.S||kA(a,c);return}if(b){a.P=b.id;var f=e.variants.find(function(g){return g.id==
170
+ b.id});f?(a.P=f.video.id,ux(f)?(zA(a,e,f,!1),AA(a,f,c,d),null==a.da&&(a.da=a.tc),a.tc=new dy(f),dA(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.P=null,null!=a.da&&(a.tc=a.da,a.da=null),c=dA(a,e.variants),null==c||a.S||kA(a,c)}};
171
+ Lx=function(a,b){if(a.a&&(a.f||a.w)){var c=Sy(a.a),d=Ry(a.a),e=aw(a.f.periods,Iy(a.w)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id==b&&ux(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 h=a.getTrackManager().Ha();if(h){var l=h.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.uc=d.id;a.g.setVariants(f);f=aA(a);zA(a,f,e,!1);g||a.S?AA(a,e,!0,0):_.az(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()};Ox=function(a){var b=a.ze;return a.f?a.I.getTextDisplayer().isTextVisible():b};
173
+ Jx=function(a,b){var c,d,e,f;return _.A(function(g){c=a.ze;d=b;if(c==d)return g["return"]();a.ze=d;if(a.D!==Lz)return g.G(0);a.I.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.G(0);if(!b)return $y(a.a),g.G(0);e=aA(a);f=_.wx(e.textStreams,a.ga,a.rc);return 0<f.length?_.x(g,Xy(a.a,f[0]),0):g.G(0)})};
174
+ zA=function(a,b,c,d){var e=a.getTrackManager();a.A.setCurrentVariant(c);if(e){var f=a.H.A;if(c.video){Rx(e,c.video,d);var g=e.ha();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&&(Rx(e,c.audio,d),e=e.Ea(),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})))}Yx(a.M,
175
+ b).variant=c};xA=function(a,b,c,d){Yx(a.M,b).text=c;if(b=a.getTrackManager())Rx(b,c,d),c=b.Fa(),a=a.H.A,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
+ jA=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.u(d.variants),g=f.next();!g.done;g=f.next())if(g=g.value,g.video&&g.video.closedCaptions){g=g.video;for(var h=_.u(g.closedCaptions.keys()),l=h.next();!l.done;l=h.next())if(l=l.value,!e.has(l)){var m={id:a.rg++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,Ja:0,mimeType:_.cc,codecs:"",kind:"caption",
178
177
  encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.Ce,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(l,m)}}e=_.u(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
179
- eA=function(a,b){for(var c=a.a?Qy(a.a):null,d=a.a?Ry(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())qx(a.j,c,d,f.value);c=Mv(b,function(g){return g.variants.some(tx)});if(0==c)throw new _.L(_.M,4,4032);if(c<b.length)throw new _.L(_.M,4,4011);c=_.u(b);for(d=c.next();!d.done;d=c.next())d=d.value,nx(d.variants,a.configuration.restrictions,a.pg)&&a.a&&$z(a)==d&&bA(a),AA(a,d.variants)};
180
- pA=function(a,b){var c=a.a?Qy(a.a):null,d=a.a?Ry(a.a):null;qx(a.j,c,d,b);d=b.variants;if(!d.some(tx))throw new _.L(_.M,4,4011);AA(a,b.variants);nx(d,a.configuration.restrictions,a.pg)&&a.a&&$z(a)==b&&bA(a);if(!_.$h(2)&&(c=a.j?a.j.getDrmInfo():null)){d=_.u(d);for(var e=d.next();!e.done;e=d.next()){e=_.u(e.value.drmInfos);for(var f=e.next();!f.done;f=e.next())if(f=f.value,f.keySystem===c.keySystem){f=_.u(f.initData||[]);for(var g=f.next();!g.done;g=f.next())g=g.value,_.mm(a.j,g.keyId,g.initData)||_.dm(a.j,
181
- g.initDataType,g.initData,g.keyId)}}}};zA=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.T?(a.ba=b,a.og=c,a.mg=d):az(a.a,b,c,d)};xA=function(a,b){a.T?a.$=b:_.$y(a.a,b,!0,0)};BA=function(a){if(a.a&&a.f){var b=Oy(a.a),c=$z(a);null!=b&&b==c&&(Qy(a.a),Ry(a.a),_.Py(a.a,_.Ce),Xx(a.N,c),Xx(a.N,c))}};
182
- oA=function(a,b){function c(g,h){if(!g)return null;var l=g.findSegmentPosition(h-f.startTime);return null==l?null:(l=g.getSegmentReference(l))?l.startTime+f.startTime:null}var d=Qy(a.a),e=Ry(a.a),f=$z(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};rA=function(a){return a.j&&a.j.D?!0:a.F?a.F.getState()===gy:!1};Uz=function(a){if(a.I&&a.F&&a.w){var b=CA(a)===_.an,c=a.xc;c.h=b;ny(c);a.w.j.m=b;hA(a)}};hA=function(a){Nz(a,CA(a))};
183
- CA=function(a){var b=a.getDuration(),c=a.getPosition();return a.h&&a.h.ended||(a.Tc||a.aa===_.cn)&&1>=Math.abs(b-c)?_.cn:rA(a)||a.Ld?_.an:a.h&&a.h.paused?_.jn:_.kn};
184
- cA=function(a,b){try{AA(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return tx(e)});c=Ax(c,a.wc);var d=a.vc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.R&&null!==a.wc&&(d=d.find(function(e){return e.video.id==a.R&&e.audio.id==a.wc}),a.R=null,d))return d;if(a.configuration.abr.enabled||null===a.R)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.R});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
185
- a.g.chooseVariant())};sA=function(a,b,c){c=void 0===c?!0:c;var d=cA(a,b.variants);a.wc=d&&d.audio&&d.audio.id;d&&(yA(a,b,d,!0),zA(a,d,c));(c=_.vx(b.textStreams,a.fa,a.tc)[0]||null)&&(a.configuration.streaming.alwaysStreamText||Nx(a))&&(wA(a,b,c,!0),xA(a,c))};
186
- FA=function(a,b){a.T=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=cA(a,b.variants),d=_.vx(b.textStreams,a.fa,a.tc)[0]||null;a.ba&&(b.variants.includes(a.ba)&&(c=a.ba),a.ba=null);a.$&&(b.textStreams.includes(a.$)&&(d=a.$),a.$=null);c&&DA(a,b,function(){return yA(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||Nx(a))&&DA(a,b,function(){return wA(a,b,d,!0)});b===$z(a)&&EA(a);return a.configuration.streaming.alwaysStreamText||Nx(a)?{variant:c,text:d}:{variant:c,
187
- text:null}};jA=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=GA(a,b);DA(a,e,function(){return yA(a,e,b,!0)});e===$z(a)&&EA(a);a.a&&az(a.a,b,c,d)}};bA=function(a){var b=a.getTrackManager();b&&a.D!==Oz&&(b.l&&(Px(b),b.l.trigger(new _.J(_.Bq))),EA(a))};EA=function(a){var b=$z(a);if(b){var c=a.yc.get(b)||[];for(a.yc["delete"](b);c.length;)c.shift()()}};DA=function(a,b,c){a.yc.has(b)||a.yc.set(b,[]);a.yc.get(b).push(c)};
188
- Wz=function(a,b,c){a.trigger(new _.J(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
189
- AA=function(a,b){var c=a.j?_.K.kf(a.j.da):{},d=Object.keys(c);d=d.length&&"00"==d[0];for(var e=!1,f=!1,g=[],h=[],l=_.u(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=_.u(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?aA.includes(q)&&(h.includes(q)||h.push(q)):g.includes(p.keyId)||g.push(p.keyId)}m.allowedByApplication?m.allowedByKeySystem&&(e=!0):f=!0}if(!e)throw new _.L(_.M,4,4012,{hasAppRestrictions:f,
190
- missingKeys:g,restrictedKeyStatuses:h});};vA=function(a){var b=$z(a);if(null==b)return[];BA(a);return b.variants.filter(function(c){return tx(c)})};HA=function(a){var b=$z(a);if(null==b)return[];BA(a);return b.textStreams.filter(function(c){return!a.Jd.has(c)})};$z=function(a){var b=Hy(a.w),c=null;a=_.u(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c};uA=function(a){var b=$z(a);return b&&Xx(a.N,b).variant};
191
- GA=function(a,b){for(var c=_.u(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.includes(b))return d;return null};
192
- IA=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,r,w,y,A,E,F,D,I,O;return _.B(function(S){switch(S.a){case 1:return d=_.vn,_.zf(S,2),_.x(S,_.Cp(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=S.f,e.configure(a.configuration.manifest),_.x(S,e.start(b.url,Xz(a)),5);case 5:f=S.f;Yz(f.periods);if(!f.periods.length)throw new _.L(_.M,4,4014);return _.x(S,a.A.stop(),6);case 6:a.A=e;g=c.audio&&c.audio.id;h=c.video&&c.video.id;a.f.periods=f.periods;l=$v(f.periods,
193
- Hy(a.w))||f.periods[0];lx(a.f,_.Fg(a.configuration.preferredVideoCodec),_.Fg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=Bx(g,h,l.variants);n=_.vx(l.textStreams,a.fa,a.tc)[0]||null;cA(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];w=new Set;y=_.u(l.variants);for(A=y.next();!A.done;A=y.next())E=A.value,E.video&&w.add(E.video),E.audio&&w.add(E.audio);F=_.u(_.mf(w).concat(_.mf(l.textStreams)));for(D=F.next();!D.done;D=F.next())I=D.value,r.push(I.createSegmentIndex());
194
- return _.x(S,Promise.all(r),7);case 7:Iz(a.a,d.AUDIO,q);Iz(a.a,d.VIDEO,p);Iz(a.a,d.TEXT,n);m&&yA(a,l,m,!1);a.log.info("Switch CDN successful.");_.Af(S,0);break;case 2:O=_.Bf(S);if(!e){S.H(8);break}return _.x(S,e.stop(),8);case 8:throw O;}})};
195
- Xz=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return pA(a,b)},filterAllPeriods:function(b){return eA(a,b)},onTimelineCueAdded:function(b){var c=a.uc;a:{var d=_.u(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.le(b)},onError:function(b){return a.onError(b)}}};JA=function(){};
196
- KA=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}};LA=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};MA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
197
- NA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.Rv(b)[0]&&a(b)}};
198
- OA=function(){var a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(c){var d=c.split(/ *; */),e=d.shift(),f={};d=_.u(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 h=!1,l=!1;c=d.split(",").filter(function(n){b.test(n)&&(l=!0);/^(hev|hvc)1\.2/.test(n)&&(h=!0);return!0});l&&(h=!1);f.codecs=c.join(",");h&&(f.eotf="smpte2084");for(var m in f)e+="; "+m+'\x3d"'+f[m]+'"';return cast.__platform__.canDisplayType(e)}};
199
- PA=function(a){_.jq.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=_.Wc;c.label===dv&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.vv,dv));this.a.mode=_.ld};QA=function(a,b){var c=a.mode;a.mode=c==_.ne?_.ne:_.ld;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};RA=function(){};zv=[112,115,115,104,0,0,0,0];
200
- _.TA=function SA(a){var c,d,e,f,g,h;return _.Hf(SA,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.u(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.H(0):_.x(l,{Kd:c,Bj:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{Kd:c,item:e,Bj:d,next:h},5):l.H(5)}c++;d=e;e=h;g=f.next();return l.H(2)})};_.Vv.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.ie,this.g),this.h&&this.a.off(_.Fe,this.g)),this.a=null);a&&(this.a=a,this.a.on(_.ie,this.g,this))};
201
- _.Vv.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=_.u(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=
202
- b);this.f.push(c);this.f.sort(Uv)}Yv(this);this.g();this.a&&this.a.trigger(new _.J(_.Ue))};_.Vv.prototype.clear=function(){this.f=[];Yv(this);this.a&&(this.a.trigger(new _.J(_.Ue)),this.a.trigger(new _.J(_.pc)))};
203
- _.Vv.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 _.J(_.rc,
204
- {detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.ew.prototype.f=function(){return this.keyInfo};_.fw.prototype.getPosition=function(){return this.position};_.fw.prototype.f=function(){return this.keyInfo};_.t=_.gw.prototype;_.t.getDuration=function(){return this.g};_.t.Tb=function(a){this.g=a};_.t.getPresentationStartTime=function(){return this.o};_.t.offset=function(a){null!=this.h&&(this.h+=a);null!=this.f&&(this.f+=a)};
205
- _.t.isLive=function(){return Infinity==this.g&&!this.j};pw.prototype.release=function(){this.f=function(){};this.a.clear()};pw.prototype.cues=function(){return this.a};rw.prototype.next=function(){var a=this.g.get(this.a);a&&0<a.a.length?(this.f+=1,a.Ha().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=sw(this);return{value:a,done:!a}};_.t=_.tw.prototype;_.t.destroy=function(){this.a=[];return Promise.resolve()};
206
- _.t.Bc=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};
207
- _.t.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]};_.t.offset=function(a){this.f.info("Apply offset"+a+" to segment index");for(var b=_.u(this.a),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.Aa-=a};
208
- _.t.Qc=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};_.t.getDuration=function(){return this.a[this.a.length-1].endTime-this.a[0].startTime};
209
- _.t.Wa=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 _.fw(f.position,g.startTime,g.endTime,g.Ha,g.Qa,g.Ea,g.Aa,g.keyInfo,g.Zb,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=
210
- b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.fw(d++,f.startTime,f.endTime,f.Ha,f.Qa,f.Ea,f.Aa,f.keyInfo,f.Zb,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=_.u(c);for(f=c.next();!f.done;f=c.next())f=f.value,a.push(new _.fw(e-d--,f.startTime,f.endTime,f.Ha,f.Qa,f.Ea,f.Aa,f.keyInfo,f.Zb,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile));b=_.u(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=
211
- a};_.t.replace=function(a){this.a=a};zw.prototype.release=function(){this.g.stop();for(var a=_.u(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};Aw.prototype.release=function(){this.j=null;this.h.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
212
- Aw.prototype.m=function(a,b){for(var c={},d=_.u(this.j.cues()),e=d.next();!e.done;c={$d:c.$d,pd:c.pd},e=d.next()){e=e.value;c.$d=this.h.get(e)||null;c.pd=a<e.startTime?1:a>e.endTime?3:2;this.h.set(e,c.pd);var f=this.o.find(function(g){return function(h){return h.oc===g.$d&&h.nc===g.pd}}(c));f&&f.cc(e,b)}};_.t=Ew.prototype;_.t.destroy=function(){this.g=this.o=null;this.m.clear();return Promise.resolve()};
213
- _.t.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))})};_.t.rb=function(){return this.a};_.t.xa=function(){return this.f};_.t.ec=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.t.Da=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
214
- Jw.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.N(a);this.j=b.videoTrackIds(a);this.h=b.timescale(a);this.a.init()};Jw.prototype.g=function(a,b){var c=_.N(a);(c=this.a.parse(c,this.j,this.h))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};Jw.prototype.f=function(){this.a.resetCaptionStream()};_.Kw.prototype.init=function(){};_.Kw.prototype.g=function(){};_.Kw.prototype.f=function(){};Lw.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};Lw.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===_.Re?this.m.push(b):a.type===_.jc&&this.j.push(b)};Lw.prototype.o=function(){var a={video:_.ok.apply(_.hk,_.mf(this.m)),captions:this.g,audio:_.ok.apply(_.hk,_.mf(this.j))};this.f.resolve(a);this.h=!1};_.t=_.Qw.prototype;
215
- _.t.destroy=function(){var a=this;this.J=!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"](Iv));for(e=1;e<d.length;++e)d[e].p["catch"](Iv),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.D={};a.F=null;a.K=
178
+ fA=function(a,b){for(var c=a.a?Ry(a.a):null,d=a.a?Sy(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())rx(a.j,c,d,f.value);c=Nv(b,function(g){return g.variants.some(ux)});if(0==c)throw new _.L(_.M,4,4032);if(c<b.length)throw new _.L(_.M,4,4011);c=_.u(b);for(d=c.next();!d.done;d=c.next())d=d.value,ox(d.variants,a.configuration.restrictions,a.ng)&&a.a&&aA(a)==d&&cA(a),BA(a,d.variants)};
179
+ qA=function(a,b){var c=a.a?Ry(a.a):null,d=a.a?Sy(a.a):null;rx(a.j,c,d,b);d=b.variants;if(!d.some(ux))throw new _.L(_.M,4,4011);BA(a,b.variants);ox(d,a.configuration.restrictions,a.ng)&&a.a&&aA(a)==b&&cA(a);if(!_.Zh(2)&&(c=a.j?a.j.getDrmInfo():null)){d=_.u(d);for(var e=d.next();!e.done;e=d.next()){e=_.u(e.value.drmInfos);for(var f=e.next();!f.done;f=e.next())if(f=f.value,f.keySystem===c.keySystem){f=_.u(f.initData||[]);for(var g=f.next();!g.done;g=f.next())g=g.value,_.nm(a.j,g.keyId,g.initData)||_.em(a.j,
180
+ g.initDataType,g.initData,g.keyId)}}}};AA=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.S?(a.ba=b,a.mg=c,a.lg=d):bz(a.a,b,c,d)};yA=function(a,b){a.S?a.$=b:_.az(a.a,b,!0,0)};CA=function(a){if(a.a&&a.f){var b=Py(a.a),c=aA(a);null!=b&&b==c&&(Ry(a.a),Sy(a.a),_.Qy(a.a,_.Ce),Yx(a.M,c),Yx(a.M,c))}};
181
+ pA=function(a,b){function c(g,h){if(!g)return null;var l=g.findSegmentPosition(h-f.startTime);return null==l?null:(l=g.getSegmentReference(l))?l.startTime+f.startTime:null}var d=Ry(a.a),e=Sy(a.a),f=aA(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};sA=function(a){return a.j&&a.j.D?!0:a.F?a.F.getState()===hy:!1};Vz=function(a){if(a.H&&a.F&&a.w){var b=DA(a)===_.bn,c=a.vc;c.h=b;oy(c);a.w.j.m=b;iA(a)}};iA=function(a){Oz(a,DA(a))};
182
+ DA=function(a){var b=a.getDuration(),c=a.getPosition();return a.h&&a.h.ended||(a.Sc||a.aa===_.dn)&&1>=Math.abs(b-c)?_.dn:sA(a)||a.Ld?_.bn:a.h&&a.h.paused?_.kn:_.ln};
183
+ dA=function(a,b){try{BA(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return ux(e)});c=Bx(c,a.uc);var d=a.tc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.P&&null!==a.uc&&(d=d.find(function(e){return e.video.id==a.P&&e.audio.id==a.uc}),a.P=null,d))return d;if(a.configuration.abr.enabled||null===a.P)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.P});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
184
+ a.g.chooseVariant())};tA=function(a,b,c){c=void 0===c?!0:c;var d=dA(a,b.variants);a.uc=d&&d.audio&&d.audio.id;d&&(zA(a,b,d,!0),AA(a,d,c));(c=_.wx(b.textStreams,a.ga,a.rc)[0]||null)&&(a.configuration.streaming.alwaysStreamText||Ox(a))&&(xA(a,b,c,!0),yA(a,c))};
185
+ GA=function(a,b){a.S=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=dA(a,b.variants),d=_.wx(b.textStreams,a.ga,a.rc)[0]||null;a.ba&&(b.variants.includes(a.ba)&&(c=a.ba),a.ba=null);a.$&&(b.textStreams.includes(a.$)&&(d=a.$),a.$=null);c&&EA(a,b,function(){return zA(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||Ox(a))&&EA(a,b,function(){return xA(a,b,d,!0)});b===aA(a)&&FA(a);return a.configuration.streaming.alwaysStreamText||Ox(a)?{variant:c,text:d}:{variant:c,
186
+ text:null}};kA=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=HA(a,b);EA(a,e,function(){return zA(a,e,b,!0)});e===aA(a)&&FA(a);a.a&&bz(a.a,b,c,d)}};cA=function(a){var b=a.getTrackManager();b&&a.D!==Pz&&(b.l&&(Qx(b),b.l.trigger(new _.J(_.Cq))),FA(a))};FA=function(a){var b=aA(a);if(b){var c=a.wc.get(b)||[];for(a.wc["delete"](b);c.length;)c.shift()()}};EA=function(a,b,c){a.wc.has(b)||a.wc.set(b,[]);a.wc.get(b).push(c)};
187
+ Xz=function(a,b,c){a.trigger(new _.J(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
188
+ BA=function(a,b){var c=a.j?_.K.jf(a.j.da):{},d=Object.keys(c);d=d.length&&"00"==d[0];for(var e=!1,f=!1,g=[],h=[],l=_.u(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=_.u(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?bA.includes(q)&&(h.includes(q)||h.push(q)):g.includes(p.keyId)||g.push(p.keyId)}m.allowedByApplication?m.allowedByKeySystem&&(e=!0):f=!0}if(!e)throw new _.L(_.M,4,4012,{hasAppRestrictions:f,
189
+ missingKeys:g,restrictedKeyStatuses:h});};wA=function(a){var b=aA(a);if(null==b)return[];CA(a);return b.variants.filter(function(c){return ux(c)})};IA=function(a){var b=aA(a);if(null==b)return[];CA(a);return b.textStreams.filter(function(c){return!a.Jd.has(c)})};aA=function(a){var b=Iy(a.w),c=null;a=_.u(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c};vA=function(a){var b=aA(a);return b&&Yx(a.M,b).variant};
190
+ HA=function(a,b){for(var c=_.u(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.includes(b))return d;return null};
191
+ JA=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,r,w,z,C,E,F,B,I,O;return _.A(function(S){switch(S.a){case 1:return d=_.wn,_.zf(S,2),_.x(S,_.Dp(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=S.f,e.configure(a.configuration.manifest),_.x(S,e.start(b.url,Yz(a)),5);case 5:f=S.f;Zz(f.periods);if(!f.periods.length)throw new _.L(_.M,4,4014);return _.x(S,a.A.stop(),6);case 6:a.A=e;g=c.audio&&c.audio.id;h=c.video&&c.video.id;a.f.periods=f.periods;l=aw(f.periods,
192
+ Iy(a.w))||f.periods[0];mx(a.f,_.Fg(a.configuration.preferredVideoCodec),_.Fg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=Cx(g,h,l.variants);n=_.wx(l.textStreams,a.ga,a.rc)[0]||null;dA(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];w=new Set;z=_.u(l.variants);for(C=z.next();!C.done;C=z.next())E=C.value,E.video&&w.add(E.video),E.audio&&w.add(E.audio);F=_.u(_.mf(w).concat(_.mf(l.textStreams)));for(B=F.next();!B.done;B=F.next())I=B.value,r.push(I.createSegmentIndex());
193
+ return _.x(S,Promise.all(r),7);case 7:Jz(a.a,d.AUDIO,q);Jz(a.a,d.VIDEO,p);Jz(a.a,d.TEXT,n);m&&zA(a,l,m,!1);a.log.info("Switch CDN successful.");_.Af(S,0);break;case 2:O=_.Bf(S);if(!e){S.G(8);break}return _.x(S,e.stop(),8);case 8:throw O;}})};
194
+ Yz=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return qA(a,b)},filterAllPeriods:function(b){return fA(a,b)},onTimelineCueAdded:function(b){var c=a.sc;a:{var d=_.u(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.le(b)},onError:function(b){return a.onError(b)}}};KA=function(){};
195
+ LA=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}};MA=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};NA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
196
+ OA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.Sv(b)[0]&&a(b)}};
197
+ PA=function(){var a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(c){var d=c.split(/ *; */),e=d.shift(),f={};d=_.u(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 h=!1,l=!1;c=d.split(",").filter(function(n){b.test(n)&&(l=!0);/^(hev|hvc)1\.2/.test(n)&&(h=!0);return!0});l&&(h=!1);f.codecs=c.join(",");h&&(f.eotf="smpte2084");for(var m in f)e+="; "+m+'\x3d"'+f[m]+'"';return cast.__platform__.canDisplayType(e)}};
198
+ QA=function(a){_.kq.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=_.Yc;c.label===ev&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.wv,ev));this.a.mode=_.nd};RA=function(a,b){var c=a.mode;a.mode=c==_.ne?_.ne:_.nd;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};SA=function(){};Av=[112,115,115,104,0,0,0,0];
199
+ _.UA=function TA(a){var c,d,e,f,g,h;return _.Hf(TA,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.u(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.G(0):_.x(l,{Kd:c,xj:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{Kd:c,item:e,xj:d,next:h},5):l.G(5)}c++;d=e;e=h;g=f.next();return l.G(2)})};_.Wv.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.je,this.f),this.g&&this.a.off(_.Fe,this.f)),this.a=null);a&&(this.a=a,this.a.on(_.je,this.f,this))};
200
+ _.Wv.prototype.append=function(a,b,c){var d=this.j?this.j(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.X.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=_.u(this.X);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.X.push(c);this.X.sort(Vv)}Zv(this);this.f();this.a&&this.a.trigger(new _.J(_.Ue))};_.Wv.prototype.clear=function(){this.X=[];Zv(this);this.a&&(this.a.trigger(new _.J(_.Ue)),this.a.trigger(new _.J(_.rc)))};
202
+ _.Wv.prototype.f=function(){if(this.a){var a=this.a.getPosition();if(0<=a){a:{for(var b=this.X.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.X[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.X[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.X[0].rendition:null}if(a&&this.h!==a&&(this.h=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 _.J(_.tc,
203
+ {detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.fw.prototype.f=function(){return this.keyInfo};_.gw.prototype.getPosition=function(){return this.position};_.gw.prototype.f=function(){return this.keyInfo};_.t=_.hw.prototype;_.t.getDuration=function(){return this.g};_.t.Sb=function(a){this.g=a};_.t.getPresentationStartTime=function(){return this.o};_.t.offset=function(a){null!=this.h&&(this.h+=a);null!=this.f&&(this.f+=a)};
204
+ _.t.isLive=function(){return Infinity==this.g&&!this.j};qw.prototype.release=function(){this.f=function(){};this.a.clear()};qw.prototype.cues=function(){return this.a};sw.prototype.next=function(){var a=this.g.get(this.a);a&&0<a.a.length?(this.f+=1,a.Ga().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=tw(this);return{value:a,done:!a}};_.t=_.uw.prototype;_.t.destroy=function(){this.a=[];return Promise.resolve()};
205
+ _.t.zc=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
+ _.t.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]};_.t.offset=function(a){this.f.info("Apply offset"+a+" to segment index");for(var b=_.u(this.a),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.Ja-=a};
207
+ _.t.Pc=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};_.t.getDuration=function(){return this.a[this.a.length-1].endTime-this.a[0].startTime};
208
+ _.t.Va=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 _.gw(f.position,g.startTime,g.endTime,g.Ga,g.$a,g.Oa,g.Ja,g.keyInfo,g.Bc,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 _.gw(d++,f.startTime,f.endTime,f.Ga,f.$a,f.Oa,f.Ja,f.keyInfo,f.Bc,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=_.u(c);for(f=c.next();!f.done;f=c.next())f=f.value,a.push(new _.gw(e-d--,f.startTime,f.endTime,f.Ga,f.$a,f.Oa,f.Ja,f.keyInfo,f.Bc,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile));b=_.u(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=
210
+ a};_.t.replace=function(a){this.a=a};Aw.prototype.release=function(){this.g.stop();for(var a=_.u(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};Bw.prototype.release=function(){this.j=null;this.h.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
211
+ Bw.prototype.m=function(a,b){for(var c={},d=_.u(this.j.cues()),e=d.next();!e.done;c={Zd:c.Zd,pd:c.pd},e=d.next()){e=e.value;c.Zd=this.h.get(e)||null;c.pd=a<e.startTime?1:a>e.endTime?3:2;this.h.set(e,c.pd);var f=this.o.find(function(g){return function(h){return h.mc===g.Zd&&h.lc===g.pd}}(c));f&&f.ac(e,b)}};_.t=Fw.prototype;_.t.destroy=function(){this.g=this.o=null;this.m.clear();return Promise.resolve()};
212
+ _.t.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))})};_.t.qb=function(){return this.a};_.t.ya=function(){return this.f};_.t.cc=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.t.Da=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
213
+ Kw.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.N(a);this.j=b.videoTrackIds(a);this.h=b.timescale(a);this.a.init()};Kw.prototype.g=function(a,b){var c=_.N(a);(c=this.a.parse(c,this.j,this.h))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};Kw.prototype.f=function(){this.a.resetCaptionStream()};_.Lw.prototype.init=function(){};_.Lw.prototype.g=function(){};_.Lw.prototype.f=function(){};Mw.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};Mw.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===_.Re?this.m.push(b):a.type===_.kc&&this.j.push(b)};Mw.prototype.o=function(){var a={video:_.pk.apply(_.ik,_.mf(this.m)),captions:this.g,audio:_.pk.apply(_.ik,_.mf(this.j))};this.f.resolve(a);this.h=!1};_.t=_.Rw.prototype;
214
+ _.t.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"](Jv));for(e=1;e<d.length;++e)d[e].p["catch"](Jv),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.D={};a.F=null;a.J=
216
215
  !1;for(var g in a.h);a.h={}})};
217
- _.t.init=function(a,b){var c=this,d;return _.B(function(e){if(1==e.a)return d=_.vn,_.x(e,c.I,2);a.forEach(function(f,g){var h=_.Oi(f.mimeType,f.codecs);if(g==d.TEXT)Uw(c,h);else{var l=new Map;l.set(g,h);if((!MediaSource.isTypeSupported(h)||!b||f.keyInfo)&&Nw(h,g)){c.w[g]=new Lw;h="aac"==h.toLowerCase().split(";")[0].split("/")[1]?h.replace(/aac/i,_.Fd):Mw(g,h);var m=new Map;m.set(g,h);try{var n=h.match(/"(.*?)"/)[0].replace(/"/g,"").split(","),p=new Map;if(1<n.length)for(var q=_.u(n),r=q.next();!r.done;r=
218
- q.next()){var w=r.value;w.startsWith("avc")?p.set(_.Re,'video/mp4;codecs\x3d"'+w+'"'):w.startsWith("mp4a")&&p.set(_.jc,'audio/mp4;codecs\x3d"'+w+'"')}l=0<p.size?p:m}catch(y){l=m}}Tw(c,l)}});_.z(e)})};_.t.rb=function(a){return a===_.Ce?this.g.rb():(a=Ww(this,a))?a.rb():null};_.t.xa=function(a){return a===_.Ce?this.g.xa():(a=Ww(this,a))?a.xa():null};_.t.ec=function(a,b,c){return a===_.Ce?this.g.ec(b):(a=Ww(this,a))?a.ec(b,!1,c):!1};
219
- _.t.Da=function(a,b){if(a===_.Ce)return this.g.Da(b);var c=Ww(this,a);return c?c.Da(b):0};_.t.remove=function(a,b,c){var d=this;return a===_.Ce?this.g.remove(b,c):Zw(this,a,this.qg.bind(this,a,b,c)).then(function(){if(a===_.Re){var e=d.rb(a),f=d.xa(a);null!==e&&null!==f&&Zv(d.B,e,f)}else a===_.jc&&(e=d.B,e.a&&e.a.trigger(new _.J(_.pc)))})};_.t.clear=function(a){if(a==_.Ce){if(!this.g)return Promise.resolve();this.F.f();return this.g.remove(0,Infinity)}return Zw(this,a,this.qg.bind(this,a,0,this.m.duration))};
220
- _.t.flush=function(a){return a==_.Ce?Promise.resolve():Zw(this,a,this.Jf.bind(this,a))};_.t.endOfStream=function(a){var b=this;return fx(this,function(){Vw(b)||(a?b.m.endOfStream(a):b.m.endOfStream())})};_.t.Tb=function(a){var b=this;fx(this,function(){b.m.duration=a})};_.t.getDuration=function(){return this.m.duration};
221
- _.t.me=function(a,b){this.a.debug("Appending data to "+a+Su);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+Su)};_.t.qg=function(a,b,c){if(c<=b)this.Kc(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)}};
222
- _.t.Fg=function(a){try{this.a.debug("Aborting operations for "+a+Su);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+Su,d),d;}this.a.debug("Done Aborting operations for "+a+Su);this.Kc(a)};
223
- _.t.Jf=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.Kc(a)};
224
- _.t.vg=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.Kc(a)};
225
- _.t.Lj=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.Kc(a)};_.t.U=function(a){this.h[a][0].p.reject(new _.L(_.M,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
226
- _.t.Kc=function(a){var b=this.h[a][0];b&&(b.p.resolve(),this.a.debug("Update-End received for "+a),ex(this,a))};_.t.getTextDisplayer=function(){return this.A};var Sw=window.URL.createObjectURL;_.v(Cx,_.R);_.t=Cx.prototype;_.t.initialize=function(a){this.l=a};_.t.release=function(){this.h=[];this.a.clear();this.f.clear()};_.t.load=function(){};_.t.destroy=function(){this.release();this.l=null};_.t.getVideoTracks=function(){return Dx(this,_.ji)};_.t.getAudioTracks=function(){return Dx(this,_.Q)};_.t.ha=function(){return Dx(this,_.P)};_.t.ga=function(){return this.a.get(_.ji)||null};_.t.Fa=function(){return this.a.get(_.Q)||null};_.t.Ga=function(){return this.a.get(_.P)||null};
227
- _.t.Ua=function(){return this.f.get(_.ji)||null};_.t.fb=function(){return this.f.get(_.Q)||null};_.t.gb=function(){return this.f.get(_.P)||null};_.t.Ia=function(){return Ex(this,_.ji)};_.t.ma=function(){return Ex(this,_.Q)};_.t.na=function(){return Ex(this,_.P)};_.t.ab=function(a){Gx(this,_.ji,a)};_.t.sa=function(a){Gx(this,_.Q,a)};_.t.Ba=function(a){Gx(this,_.P,a)};_.t.$a=function(a,b){Fx(this,_.ji,a,void 0===b?!1:b)};_.t.mb=function(a,b){Fx(this,_.Q,a,void 0===b?!1:b)};
228
- _.t.nb=function(a,b){Fx(this,_.P,a,void 0===b?!1:b)};_.t.addTextTrack=function(a){var b=this;return _.B(function(c){return b.l?_.x(c,b.l.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.H(0)})};_.t.ja=function(){return!!this.l&&this.l.ja()};Cx.prototype.isAbrEnabled=Cx.prototype.ja;Cx.prototype.addTextTrack=Cx.prototype.addTextTrack;Cx.prototype.setTextRendition=Cx.prototype.nb;Cx.prototype.setAudioRendition=Cx.prototype.mb;Cx.prototype.setVideoRendition=Cx.prototype.$a;
229
- Cx.prototype.setTextTrack=Cx.prototype.Ba;Cx.prototype.setAudioTrack=Cx.prototype.sa;Cx.prototype.setVideoTrack=Cx.prototype.ab;Cx.prototype.getTextTrack=Cx.prototype.na;Cx.prototype.getAudioTrack=Cx.prototype.ma;Cx.prototype.getVideoTrack=Cx.prototype.Ia;Cx.prototype.getLoadingTextRendition=Cx.prototype.gb;Cx.prototype.getLoadingAudioRendition=Cx.prototype.fb;Cx.prototype.getLoadingVideoRendition=Cx.prototype.Ua;Cx.prototype.getTextRendition=Cx.prototype.Ga;Cx.prototype.getAudioRendition=Cx.prototype.Fa;
230
- Cx.prototype.getVideoRendition=Cx.prototype.ga;Cx.prototype.getTextTracks=Cx.prototype.ha;Cx.prototype.getAudioTracks=Cx.prototype.getAudioTracks;Cx.prototype.getVideoTracks=Cx.prototype.getVideoTracks;_.t=_.Tx.prototype;_.t.stop=function(){this.w=null;this.j=!1;this.o=[];this.m=1;this.h=null;this.B=!1};_.t.init=function(a){this.w=a};
231
- _.t.chooseVariant=function(){var a=Ux(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=Sx(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=Ux(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.u(_.TA(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,h=g/this.a.bandwidthDowngradeTarget;
216
+ _.t.init=function(a,b){var c=this,d;return _.A(function(e){if(1==e.a)return d=_.wn,_.x(e,c.H,2);a.forEach(function(f,g){var h=_.Pi(f.mimeType,f.codecs);if(g==d.TEXT)Vw(c,h);else{var l=new Map;l.set(g,h);if((!MediaSource.isTypeSupported(h)||!b||f.keyInfo)&&Ow(h,g)){c.w[g]=new Mw;h="aac"==h.toLowerCase().split(";")[0].split("/")[1]?h.replace(/aac/i,_.Hd):Nw(g,h);var m=new Map;m.set(g,h);try{var n=h.match(/"(.*?)"/)[0].replace(/"/g,"").split(","),p=new Map;if(1<n.length)for(var q=_.u(n),r=q.next();!r.done;r=
217
+ q.next()){var w=r.value;w.startsWith("avc")?p.set(_.Re,'video/mp4;codecs\x3d"'+w+'"'):w.startsWith("mp4a")&&p.set(_.kc,'audio/mp4;codecs\x3d"'+w+'"')}l=0<p.size?p:m}catch(z){l=m}}Uw(c,l)}});_.y(e)})};_.t.qb=function(a){return a===_.Ce?this.g.qb():(a=Xw(this,a))?a.qb():null};_.t.ya=function(a){return a===_.Ce?this.g.ya():(a=Xw(this,a))?a.ya():null};_.t.cc=function(a,b,c){return a===_.Ce?this.g.cc(b):(a=Xw(this,a))?a.cc(b,!1,c):!1};
218
+ _.t.Da=function(a,b){if(a===_.Ce)return this.g.Da(b);var c=Xw(this,a);return c?c.Da(b):0};_.t.remove=function(a,b,c){var d=this;return a===_.Ce?this.g.remove(b,c):$w(this,a,this.og.bind(this,a,b,c)).then(function(){if(a===_.Re){var e=d.qb(a),f=d.ya(a);null!==e&&null!==f&&$v(d.B,e,f)}else a===_.kc&&(e=d.B,e.a&&e.a.trigger(new _.J(_.rc)))})};_.t.clear=function(a){if(a==_.Ce){if(!this.g)return Promise.resolve();this.F.f();return this.g.remove(0,Infinity)}return $w(this,a,this.og.bind(this,a,0,this.m.duration))};
219
+ _.t.flush=function(a){return a==_.Ce?Promise.resolve():$w(this,a,this.If.bind(this,a))};_.t.endOfStream=function(a){var b=this;return gx(this,function(){Ww(b)||(a?b.m.endOfStream(a):b.m.endOfStream())})};_.t.Sb=function(a){var b=this;gx(this,function(){b.m.duration=a})};_.t.getDuration=function(){return this.m.duration};
220
+ _.t.me=function(a,b){this.a.debug("Appending data to "+a+Tu);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+Tu)};_.t.og=function(a,b,c){if(c<=b)this.Jc(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
+ _.t.Dg=function(a){try{this.a.debug("Aborting operations for "+a+Tu);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+Tu,d),d;}this.a.debug("Done Aborting operations for "+a+Tu);this.Jc(a)};
222
+ _.t.If=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.Jc(a)};
223
+ _.t.tg=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.Jc(a)};
224
+ _.t.Hj=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.Jc(a)};_.t.T=function(a){this.h[a][0].p.reject(new _.L(_.M,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
225
+ _.t.Jc=function(a){var b=this.h[a][0];b&&(b.p.resolve(),this.a.debug("Update-End received for "+a),fx(this,a))};_.t.getTextDisplayer=function(){return this.A};var Tw=window.URL.createObjectURL;_.v(Dx,_.R);_.t=Dx.prototype;_.t.initialize=function(a){this.l=a};_.t.release=function(){this.h=[];this.a.clear();this.f.clear()};_.t.load=function(){};_.t.destroy=function(){this.release();this.l=null};_.t.getVideoTracks=function(){return Ex(this,_.ii)};_.t.getAudioTracks=function(){return Ex(this,_.Q)};_.t.ia=function(){return Ex(this,_.P)};_.t.ha=function(){return this.a.get(_.ii)||null};_.t.Ea=function(){return this.a.get(_.Q)||null};_.t.Fa=function(){return this.a.get(_.P)||null};
226
+ _.t.Ta=function(){return this.f.get(_.ii)||null};_.t.eb=function(){return this.f.get(_.Q)||null};_.t.fb=function(){return this.f.get(_.P)||null};_.t.Ha=function(){return Fx(this,_.ii)};_.t.na=function(){return Fx(this,_.Q)};_.t.oa=function(){return Fx(this,_.P)};_.t.Za=function(a){Hx(this,_.ii,a)};_.t.sa=function(a){Hx(this,_.Q,a)};_.t.Ba=function(a){Hx(this,_.P,a)};_.t.Ya=function(a,b){Gx(this,_.ii,a,void 0===b?!1:b)};_.t.lb=function(a,b){Gx(this,_.Q,a,void 0===b?!1:b)};
227
+ _.t.mb=function(a,b){Gx(this,_.P,a,void 0===b?!1:b)};_.t.addTextTrack=function(a){var b=this;return _.A(function(c){return b.l?_.x(c,b.l.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.G(0)})};_.t.ka=function(){return!!this.l&&this.l.ka()};Dx.prototype.isAbrEnabled=Dx.prototype.ka;Dx.prototype.addTextTrack=Dx.prototype.addTextTrack;Dx.prototype.setTextRendition=Dx.prototype.mb;Dx.prototype.setAudioRendition=Dx.prototype.lb;Dx.prototype.setVideoRendition=Dx.prototype.Ya;
228
+ Dx.prototype.setTextTrack=Dx.prototype.Ba;Dx.prototype.setAudioTrack=Dx.prototype.sa;Dx.prototype.setVideoTrack=Dx.prototype.Za;Dx.prototype.getTextTrack=Dx.prototype.oa;Dx.prototype.getAudioTrack=Dx.prototype.na;Dx.prototype.getVideoTrack=Dx.prototype.Ha;Dx.prototype.getLoadingTextRendition=Dx.prototype.fb;Dx.prototype.getLoadingAudioRendition=Dx.prototype.eb;Dx.prototype.getLoadingVideoRendition=Dx.prototype.Ta;Dx.prototype.getTextRendition=Dx.prototype.Fa;Dx.prototype.getAudioRendition=Dx.prototype.Ea;
229
+ Dx.prototype.getVideoRendition=Dx.prototype.ha;Dx.prototype.getTextTracks=Dx.prototype.ia;Dx.prototype.getAudioTracks=Dx.prototype.getAudioTracks;Dx.prototype.getVideoTracks=Dx.prototype.getVideoTracks;_.t=_.Ux.prototype;_.t.stop=function(){this.w=null;this.j=!1;this.o=[];this.m=1;this.h=null;this.B=!1};_.t.init=function(a){this.w=a};
230
+ _.t.chooseVariant=function(){var a=Vx(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=Tx(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=Vx(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.u(_.UA(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,h=g/this.a.bandwidthDowngradeTarget;
232
231
  e=f*(e.next||{bandwidth:Infinity}).bandwidth/this.a.bandwidthUpgradeTarget;this.f.debug("Bandwidth ranges:",(g/1E6).toFixed(3),(h/1E6).toFixed(3),(e/1E6).toFixed(3));b>=h&&b<=e&&(c=d)}this.h=Date.now();this.B=!0;return c};_.t.enable=function(){this.j=!0};_.t.disable=function(){this.j=!1};
233
- _.t.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;_.bw(c.f,e,d);_.bw(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...");
234
- 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(Sx(this.g,this.a.defaultBandwidthEstimate)/1E3)+" kbps");this.w(c)}};_.t.playbackRateChanged=function(a){this.m=a};_.t.getBandwidthEstimate=function(){return Sx(this.g,this.a.defaultBandwidthEstimate)};_.t.setVariants=function(a){this.o=a};_.t.configure=function(a){this.a=a};
235
- _.t.reset=function(){this.A=!1;this.g=new Rx;var a=this.chooseVariant();a&&this.w(a)};Vx.prototype.clear=function(){this.a.clear()};Yx.prototype.add=function(a){if(ay(this.f,a))return this.a.add(a),!0;_.G("Rejecting variant - not compatible with root.");return!1};Yx.prototype.values=function(){return this.a.values()};cy.prototype.create=function(a){var b=this,c=a.filter(function(d){return ay(b.a,d)});return c.length?new Yx(c[0],c):this.f.create(a)};
236
- by.prototype.create=function(a){var b=dy(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){var c=ey(a,this.a);0<c.length?(a=c,b=!0):_.G("No exact match for preferred variant role could be found. Role: "+this.a)}b||(b=a.filter(function(d){return d.primary}),0<b.length&&(a=b));this.f&&(b=hx(a,this.f),b.length?a=b:_.G("No exact match for the channel count could be found."));b=new Yx(a[0]);a=_.u(a);for(c=a.next();!c.done;c=a.next())c=c.value,ay(b.f,c)&&b.add(c);return b};hy.prototype.getState=function(){return this.a};var gy=0,fy=1;jy.prototype.release=function(){this.g.release()};ky.prototype.release=function(){this.a=this.g=null;this.f=function(){}};ky.prototype.m=function(a){var b=this.a,c=this.g.periods;a=$v(c,a)||c[0];b!=a&&this.f(a);this.a=a};my.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};my.prototype.set=function(a){this.g=a;ny(this)};py.prototype.release=function(){this.g=null;this.f=function(){}};ty.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.D=this.B=null;this.m=!1};ty.prototype.Pd=function(){this.w=!0;sy(this)};xy.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};uy.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};Fy.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 Ly=new _.Tm(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])});_.t=_.Ny.prototype;_.t.destroy=function(){var a=this,b,c,d,e;return _.B(function(f){if(1==f.a){b=[];c=_.u(a.f.values());for(d=c.next();!d.done;d=c.next())e=d.value,Xy(e),b.push(Yy(e));return _.x(f,Promise.all(b),2)}a.f.clear();a.o.clear();a.C=null;a.g=null;a.F=null;a.m=null;a.j=null;a.h=!0;_.z(f)})};
237
- _.t.start=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){b=a.C.wb();c=Ty(a,b);d=a.C.Je(a.g.periods[c]);if(!d.variant&&!d.text)throw a.a.error("init: no Streams chosen"),new _.L(_.M,5,5005);a.D=!d.variant&&!!d.text;return _.x(e,kz(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.h)return e["return"]();a.a.debug("init: completed initial Stream setup");a.C&&a.C.ej&&(a.a.debug("init: calling onInitialStreamsSetup()..."),a.C.ej());_.z(e)})};
238
- _.t.Bb=function(a){var b=this,c,d,e,f;return _.B(function(g){switch(g.a){case 1:if(b.h)return g["return"]();c=ez(a);if(a.Ya||null==a.qb||a.Xb)return g["return"]();a.qb=null;if(!a.Fb){g.H(2);break}b.a.debug(c,"skipping update and clearing the buffer");return _.x(g,gz(b,a,a.Td,a.vd),3);case 3:return g["return"]();case 2:_.zf(g,4);d=oz(b,a);null!=d&&(Vy(b,a,d),a.Hc=!1);_.Af(g,5);break;case 4:return e=_.Bf(g),_.x(g,zz(b,e),6);case 6:return g["return"]();case 5:f=Array.from(b.f.values()),Gz(b,a),b.B&&
239
- f.every(function(h){return h.endOfStream})&&(b.a.debug(c,"calling endOfStream()..."),b.C.X.endOfStream().then(function(){if(!b.h){var h=b.C.X.getDuration();h<b.g.presentationTimeline.getDuration()&&b.g.presentationTimeline.Tb(h)}}).then(function(){b.C.cg()})),_.z(g)}})};
240
- _.t.xj=function(a,b,c,d){var e=yv(d.G),f=yv(d.G),g=_.U(d.G),h=_.U(d.G),l=_.U(d.G),m=_.U(d.G);d=_.Mk(d.G,d.G.ya()-d.G.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.C.hg();else this.C.onEvent(new _.J("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
241
- _.t.Wj=function(a){var b=this,c=!1,d=0;(new _.Nk).M(_.Ed,_.Ok).M(_.Ge,_.Ok).M(_.zd,_.Ok).M(_.Dd,_.Ok).M(_.ue,_.Ok).W(_.we,_.Pk).M("encv",function(e){e.G.skip(78);_.Ok(e)}).M("pasp",function(e){d=e.start+e.ve;var f=_.U(e.G),g=_.U(e.G);c=f!==g;b.a.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.Xa.stop()}).parse(a.data);c&&(a=new _.Bk(new DataView(a.data)),a.seek(d),_.T(a,1),_.T(a,1))};_.pz="iterateSegmentReference";_.v(Lz,_.bk);_.t=Lz.prototype;_.t.init=function(a,b){var c=a.getMedia();_.bk.prototype.init.call(this,a,b);Rz(this,c)};_.t.namespace=function(){return kv};_.t.Df=function(){return new Cx};_.t.getState=function(){return this.aa};_.t.getDrmInfo=function(){return this.j?this.j.getDrmInfo():null};
242
- _.t.unload=function(){var a=this;Ix(this,!1);this.Tc=!1;if(this.o){var b=this.getTrackManager();b&&b.release();return this.D===Oz?Promise.resolve():Tz(this).then(function(){a.log.debug(_.kb,a.o);a.o=null;a.Ce=0;a.wc=null;a.R=null})}return Promise.resolve()};
243
- _.t.release=function(){var a=this;return _.B(function(b){if(a.V)return b["return"](a.V);a.V=new Promise(function(c,d){try{var e=a.Pb;a.Pb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.bk.prototype.release.call(a)}):f=_.bk.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){Nz(a,_.Wm);a.V=null;c()})["catch"](function(g){a.V=null;d(g)})}catch(g){a.V=null,d(g)}});return b["return"](a.V)})};
244
- _.t.getBufferInfo=function(a){if(this.J){var b=Xw(this.J),c=new _.Qj(void 0,a);switch(a){case _.ji:return b.video?b.video:c;case _.Q:return b.audio?b.audio:c;case _.P:return b.text?b.text:c}return b.total?b.total:c}return this.Yc?(b=Wv(this.Yc),Sv(b,a)):_.bk.prototype.getBufferInfo.call(this,a)};_.t.getPosition=function(){return this.w?Hy(this.w):_.bk.prototype.getPosition.call(this)};_.t.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};
245
- _.t.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a)return _.x(b,_.bk.prototype.destroy.call(a),2);if(3!=b.a){if(a.D===Oz)return b["return"]();a.log.debug("Destroying player...");a.D=Oz;return _.x(b,Qz(a),3)}a.m&&(a.m.release(),a.m=null);a.g=null;_.z(b)})};
246
- _.t.load=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(b.D===Oz)return n["return"](Promise.reject(new _.L(_.M,7,7E3)));c=new _.Th;d=function(){return b.Pb!==c};e=function(){b.log.info("Aborting current load");throw new _.L(_.M,7,7E3);};b.Pb=c;_.zf(n,2);d()&&e();if(!b.V){n.H(4);break}_.zf(n,5);return _.x(n,b.V,7);case 7:_.Af(n,6,2);break;case 5:_.Bf(n,2);case 6:d()&&e();case 4:return b.I=new _.Rm,b.Be=Date.now()/1E3,Nz(b,_.hn),b.o=_.on(a),_.ak(a)&&(b.configuration=
247
- _.Zj(b.zd,a)),b.log.info(_.Ua,b.configuration),b.log.info(_.fb,b.o),(f=b.getTrackManager())&&f.load(),g=b.getSurface().getMedia(),g.loop=!!b.configuration.loop,_.K.S(b.configuration.volume)||b.setVolume(b.configuration.volume),_.K.S(b.configuration.muted)||b.setMuted(b.configuration.muted),tA(b),h=b.o[b.getSourceIndex()],d()&&e(),_.x(n,Rz(b,g),8);case 8:return d()&&e(),_.x(n,Sz(b,g),9);case 9:return d()&&e(),_.x(n,Vz(b,h),10);case 10:return d()&&e(),_.x(n,Zz(b,h),11);case 11:return d()&&e(),_.x(n,
248
- fA(b),12);case 12:return d()&&e(),_.x(n,qA(b),13);case 13:d()&&e();c.resolve();_.Af(n,0);break;case 2:throw m=l=_.Bf(n),d()&&(m=new _.L(_.M,7,7E3)),c.reject(m),b.onError(m),m;}})};_.t.isLive=function(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!=a.g&&!a.j):a=!1;return a};_.t.lg=function(){this.log.debug("User seeking finished");this.F&&gA(this);hA(this)};
249
- _.t.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:ow(a,0),end:nw(a)}}return{start:0,end:0}};_.t.getPlaybackRate=function(){if(this.xc){var a=this.xc;a=a.h?0:a.g}else a=0;return a};
250
- _.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.D===Kz){this.xc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.f.get(_.Re)){var d=a.stream;if(d)if(b.a.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Rb&&(b.a.debug("Engaging trick mode stream",c),_.$y(b,c,!1,0),a.Rb=d);else if(d=a.Rb)b.a.debug("Restoring non-trick-mode stream",d),a.Rb=null,_.$y(b,d,!0,0)}}};
251
- _.t.ha=function(){if(this.f&&this.w){var a=$z(this);if(null==a)a=null;else{if(!Xx(this.N,a).text){var b=_.vx(a.textStreams,this.fa,this.tc);b.length&&(b=b[0],Xx(this.N,a).text=b)}a=Xx(this.N,a).text}b=[];for(var c=_.u(HA(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=sx(d);e.active=d==a;b.push(e)}return b}return[]};_.t.getPeriods=function(){return this.f.periods};
252
- _.t.getStats=function(){if(this.D!==Kz)return _.Sm();hA(this);var a=this.h;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.I,c=Number(a.totalVideoFrames);b.j=Number(a.droppedVideoFrames);b.h=c}if(this.D===Kz){if(a=uA(this))this.I.m=a.bandwidth;a&&a.video&&(b=this.I,c=a.video.height||NaN,b.o=a.video.width||NaN,b.g=c);a=this.g.getBandwidthEstimate();this.I.f=a}return this.I.getStats()};
253
- _.t.getTimelineCues=function(){return this.uc?_.mf(this.uc.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}}):[]};_.t.resetAbr=function(){this.g&&this.g.reset()};
254
- _.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,w,y;return _.B(function(A){if(1==A.a){if(g.D!==Kz)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=$z(g);l=_.vn;m=g.f.periods.indexOf(h);n=m+1;p=n>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[n].startTime;q=p-h.startTime;if(Infinity==q)throw new _.L(1,4,4040);r=new _.fw(1,0,q,function(){return[a]},0,null,0);w={id:g.tg++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
255
- findSegmentPosition:function(){return 1},getSegmentReference:function(E){return 1==E?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.mv,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.Jd.add(w);h.textStreams.push(w);return _.x(A,Wy(g.a,w),2)}if(y=_.Py(g.a,_.Ce))Xx(g.N,h).text=
256
- y;g.Jd["delete"](w);g.log.debug("Choosing new streams after adding a text stream");sA(g,h);bA(g);return A["return"](sx(w))})};_.t.Ah=function(a){this.log.debug(_.ov,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=FA(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}}};
257
- _.t.zh=function(){this.log.debug("canSwitch_");this.T=!1;this.configuration.abr.enabled&&this.g.enable();this.ba&&(az(this.a,this.ba,this.og,this.mg),this.ba=null);this.$&&(_.$y(this.a,this.$,!0,0),this.$=null)};_.t.Bh=function(){this.A&&this.A.update&&this.A.update()};_.t.pj=function(){this.w&&this.w.j.Pd()};
258
- _.t.Lg=function(a,b,c){if((void 0===c?"":c)===nv)return bA(this),this.ja()||(this.configuration.abr.enabled=!0,this.g.enable()),sA(this,b,!1),!0;if(c=b.variants.some(function(g){var h=!1,l=g[a.type];l&&(h=g.allowedByApplication&&l.id!==a.id,a.type===_.jc&&(h=h&&l.language===a.language));return h})&&this.ja()){for(var d=_.u(b.variants),e=d.next();!e.done;e=d.next()){e=e.value;var f=e[a.type];f&&f.id===a.id&&(e.allowedByApplication=!1)}bA(this);this.ja()||(this.configuration.abr.enabled=!0,this.g.enable());
259
- sA(this,b)}return c};_.t.cj=function(){this.log.debug("endOfStream called by streaming engine");this.Tc=!0};_.t.onError=function(a){if(this.D!==Oz&&7001!==a.code&&7E3!==a.code){var b=new _.J(_.hd,{detail:a});a.severity===_.M&&Nz(this,_.gn);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.t.le=function(a){a.type===_.bd?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.$e?Uz(this):"emsg"!==a.type&&(a instanceof _.J?this.dispatchEvent(a):this.log.debug(_.yb,a.type)))};_.t.ja=function(){return this.configuration.abr.enabled};
260
- _.t.Rj=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(!b.Sa)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ja();return _.x(n,b.Sa(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.K.Wa(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.x(n,Hz(b.a),3);case 3:g=uA(b);case 4:return h=!1,_.zf(n,7),b.log.info("Switching CDN to "+f.url+"."),_.x(n,IA(b,f,g),9);case 9:_.Af(n,6);break;case 7:return l=_.Bf(n),b.log.info("Switch failed"),
261
- _.x(n,b.Sa(f.url,a),10);case 10:if(m=n.f)f.url=m,h=!0;else throw l;case 6:h?n.H(4):(d&&b.g.enable(),Bz(b.a,!0),b.o[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.J(_.zc,{newManifest:f.url})),_.z(n))}})};var Oz=0,Jz=1,Kz=2,aA=[_.Td,_.od];JA.prototype.a=function(){return kv};
262
- JA.prototype.canPlay=function(a,b){if(_.Xi())return 0;var c=a.type||"",d=window.MediaSource&&MediaSource.isTypeSupported?!0:!1,e=window.MediaSource&&MediaSource.isTypeSupported?c in _.Dp||_.Ep(a.url)in _.Fp?!0:!1:!1;if(d&&e){if(_.$h(2))return 1;if(_.Yi()&&c===_.Bj){if(b.streaming.preferNativeHlsOnSafari)return 1;_.G("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};JA.prototype.create=function(){return new Lz};_.ag(new JA);_.$n(function(){_.Sf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Rf("Patching Chromecast MSE bugs."),OA();else if(_.Yi()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;MA();10>=a?(_.Rf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Rf("Patching Safari 11 \x26 12 MSE bugs."),KA(),LA()):(_.Rf("Patching Safari 13 MSE bugs."),KA())}else _.$h(2)||_.$h(3)||
263
- _.$h(4)?NA():_.Rf("Using native MSE as-is.");else _.Rf("No MSE implementation available.")});_.v(PA,_.jq);_.t=PA.prototype;
264
- _.t.append=function(a){function b(e){if(e.startTime>=e.endTime)_.G("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.Ih(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.Bc}catch(g){f.align="middle"}e.writingMode===_.Pe?f.vertical="lr":e.writingMode===_.Qe&&(f.vertical="rl");e=f}e&&c.push(e)}var c=[],d=_.u(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?
265
- e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.u(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.t.remove=function(a,b){if(!this.a)return!1;QA(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.t.isTextVisible=function(){return this.a.mode==_.ne};_.t.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.ne:_.ld)};_.t.destroy=function(){this.a&&QA(this.a,function(){return!0});this.a=null;return Promise.resolve()};RA.prototype.ca=function(){return!0};RA.prototype.create=function(a){return new PA(a)};_.Jm("single-native",new RA);};
232
+ _.t.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;_.cw(c.f,e,d);_.cw(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(Tx(this.g,this.a.defaultBandwidthEstimate)/1E3)+" kbps");this.w(c)}};_.t.playbackRateChanged=function(a){this.m=a};_.t.getBandwidthEstimate=function(){return Tx(this.g,this.a.defaultBandwidthEstimate)};_.t.setVariants=function(a){this.o=a};_.t.configure=function(a){this.a=a};
234
+ _.t.reset=function(){this.A=!1;this.g=new Sx;var a=this.chooseVariant();a&&this.w(a)};Wx.prototype.clear=function(){this.a.clear()};Zx.prototype.add=function(a){if(by(this.f,a))return this.a.add(a),!0;_.G("Rejecting variant - not compatible with root.");return!1};Zx.prototype.values=function(){return this.a.values()};dy.prototype.create=function(a){var b=this,c=a.filter(function(d){return by(b.a,d)});return c.length?new Zx(c[0],c):this.f.create(a)};
235
+ cy.prototype.create=function(a){var b=ey(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){var c=fy(a,this.a);0<c.length?(a=c,b=!0):_.G("No exact match for preferred variant role could be found. Role: "+this.a)}b||(b=a.filter(function(d){return d.primary}),0<b.length&&(a=b));this.f&&(b=ix(a,this.f),b.length?a=b:_.G("No exact match for the channel count could be found."));b=new Zx(a[0]);a=_.u(a);for(c=a.next();!c.done;c=a.next())c=c.value,by(b.f,c)&&b.add(c);return b};iy.prototype.getState=function(){return this.a};var hy=0,gy=1;ky.prototype.release=function(){this.g.release()};ly.prototype.release=function(){this.a=this.g=null;this.f=function(){}};ly.prototype.m=function(a){var b=this.a,c=this.g.periods;a=aw(c,a)||c[0];b!=a&&this.f(a);this.a=a};ny.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};ny.prototype.set=function(a){this.g=a;oy(this)};qy.prototype.release=function(){this.g=null;this.f=function(){}};uy.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.D=this.B=null;this.m=!1};uy.prototype.Pd=function(){this.w=!0;ty(this)};yy.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};vy.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};Gy.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 My=new _.Um(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])});_.t=_.Oy.prototype;_.t.destroy=function(){var a=this,b,c,d,e;return _.A(function(f){if(1==f.a){b=[];c=_.u(a.f.values());for(d=c.next();!d.done;d=c.next())e=d.value,Yy(e),b.push(Zy(e));return _.x(f,Promise.all(b),2)}a.f.clear();a.o.clear();a.C=null;a.g=null;a.F=null;a.m=null;a.j=null;a.h=!0;_.y(f)})};
236
+ _.t.start=function(){var a=this,b,c,d;return _.A(function(e){if(1==e.a){b=a.C.vb();c=Uy(a,b);d=a.C.Ie(a.g.periods[c]);if(!d.variant&&!d.text)throw a.a.error("init: no Streams chosen"),new _.L(_.M,5,5005);a.D=!d.variant&&!!d.text;return _.x(e,lz(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.h)return e["return"]();a.a.debug("init: completed initial Stream setup");a.C&&a.C.aj&&(a.a.debug("init: calling onInitialStreamsSetup()..."),a.C.aj());_.y(e)})};
237
+ _.t.Ab=function(a){var b=this,c,d,e,f;return _.A(function(g){switch(g.a){case 1:if(b.h)return g["return"]();c=fz(a);if(a.Wa||null==a.pb||a.Wb)return g["return"]();a.pb=null;if(!a.Eb){g.G(2);break}b.a.debug(c,"skipping update and clearing the buffer");return _.x(g,hz(b,a,a.Sd,a.vd),3);case 3:return g["return"]();case 2:_.zf(g,4);d=pz(b,a);null!=d&&(Wy(b,a,d),a.Gc=!1);_.Af(g,5);break;case 4:return e=_.Bf(g),_.x(g,Az(b,e),6);case 6:return g["return"]();case 5:f=Array.from(b.f.values()),Hz(b,a),b.B&&
238
+ f.every(function(h){return h.endOfStream})&&(b.a.debug(c,"calling endOfStream()..."),b.C.W.endOfStream().then(function(){if(!b.h){var h=b.C.W.getDuration();h<b.g.presentationTimeline.getDuration()&&b.g.presentationTimeline.Sb(h)}}).then(function(){b.C.bg()})),_.y(g)}})};
239
+ _.t.tj=function(a,b,c,d){var e=zv(d.reader),f=zv(d.reader),g=_.U(d.reader),h=_.U(d.reader),l=_.U(d.reader),m=_.U(d.reader);d=_.Nk(d.reader,d.reader.za()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.C.gg();else this.C.onEvent(new _.J("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
240
+ _.t.Sj=function(a){var b=this,c=!1,d=0;(new _.Ok).L(_.Fd,_.Pk).L(_.Ge,_.Pk).L(_.Ad,_.Pk).L(_.Ed,_.Pk).L(_.ue,_.Pk).V(_.we,_.Qk).L("encv",function(e){e.reader.skip(78);_.Pk(e)}).L("pasp",function(e){d=e.start+e.headerSize;var f=_.U(e.reader),g=_.U(e.reader);c=f!==g;b.a.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.parser.stop()}).parse(a.data);c&&(a=new _.Ck(new DataView(a.data)),a.seek(d),_.T(a,1),_.T(a,1))};_.qz="iterateSegmentReference";_.v(Mz,_.ck);_.t=Mz.prototype;_.t.init=function(a,b){var c=a.getMedia();_.ck.prototype.init.call(this,a,b);Sz(this,c)};_.t.namespace=function(){return lv};_.t.Cf=function(){return new Dx};_.t.getState=function(){return this.aa};_.t.getDrmInfo=function(){return this.j?this.j.getDrmInfo():null};
241
+ _.t.unload=function(){var a=this;Jx(this,!1);this.Sc=!1;if(this.o){var b=this.getTrackManager();b&&b.release();return this.D===Pz?Promise.resolve():Uz(this).then(function(){a.log.debug(_.jb,a.o);a.o=null;a.Be=0;a.uc=null;a.P=null})}return Promise.resolve()};
242
+ _.t.release=function(){var a=this;return _.A(function(b){if(a.U)return b["return"](a.U);a.U=new Promise(function(c,d){try{var e=a.Ob;a.Ob=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.ck.prototype.release.call(a)}):f=_.ck.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){Oz(a,_.Xm);a.U=null;c()})["catch"](function(g){a.U=null;d(g)})}catch(g){a.U=null,d(g)}});return b["return"](a.U)})};
243
+ _.t.getBufferInfo=function(a){if(this.I){var b=Yw(this.I),c=new _.Rj(void 0,a);switch(a){case _.ii:return b.video?b.video:c;case _.Q:return b.audio?b.audio:c;case _.P:return b.text?b.text:c}return b.total?b.total:c}return this.Xc?(b=Xv(this.Xc),Tv(b,a)):_.ck.prototype.getBufferInfo.call(this,a)};_.t.getPosition=function(){return this.w?Iy(this.w):_.ck.prototype.getPosition.call(this)};_.t.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};
244
+ _.t.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.t.destroy=function(){var a=this;return _.A(function(b){if(1==b.a)return _.x(b,_.ck.prototype.destroy.call(a),2);if(3!=b.a){if(a.D===Pz)return b["return"]();a.log.debug("Destroying player...");a.D=Pz;return _.x(b,Rz(a),3)}a.m&&(a.m.release(),a.m=null);a.g=null;_.y(b)})};
245
+ _.t.load=function(a){var b=this,c,d,e,f,g,h,l,m;return _.A(function(n){switch(n.a){case 1:if(b.D===Pz)return n["return"](Promise.reject(new _.L(_.M,7,7E3)));c=new _.Sh;d=function(){return b.Ob!==c};e=function(){b.log.info("Aborting current load");throw new _.L(_.M,7,7E3);};b.Ob=c;_.zf(n,2);d()&&e();if(!b.U){n.G(4);break}_.zf(n,5);return _.x(n,b.U,7);case 7:_.Af(n,6,2);break;case 5:_.Bf(n,2);case 6:d()&&e();case 4:return b.H=new _.Sm,b.Ae=Date.now()/1E3,Oz(b,_.jn),b.o=_.pn(a),_.bk(a)&&(b.configuration=
246
+ _.ak(b.zd,a)),b.log.info(_.Ua,b.configuration),b.log.info(_.eb,b.o),(f=b.getTrackManager())&&f.load(),g=b.getSurface().getMedia(),g.loop=!!b.configuration.loop,_.K.R(b.configuration.volume)||b.setVolume(b.configuration.volume),_.K.R(b.configuration.muted)||b.setMuted(b.configuration.muted),uA(b),h=b.o[b.getSourceIndex()],d()&&e(),_.x(n,Sz(b,g),8);case 8:return d()&&e(),_.x(n,Tz(b,g),9);case 9:return d()&&e(),_.x(n,Wz(b,h),10);case 10:return d()&&e(),_.x(n,$z(b,h),11);case 11:return d()&&e(),_.x(n,
247
+ gA(b),12);case 12:return d()&&e(),_.x(n,rA(b),13);case 13:d()&&e();c.resolve();_.Af(n,0);break;case 2:throw m=l=_.Bf(n),d()&&(m=new _.L(_.M,7,7E3)),c.reject(m),b.onError(m),m;}})};_.t.isLive=function(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!=a.g&&!a.j):a=!1;return a};_.t.kg=function(){this.log.debug("User seeking finished");this.F&&hA(this);iA(this)};
248
+ _.t.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:pw(a,0),end:ow(a)}}return{start:0,end:0}};_.t.getPlaybackRate=function(){if(this.vc){var a=this.vc;a=a.h?0:a.g}else a=0;return a};
249
+ _.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.D===Lz){this.vc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.f.get(_.Re)){var d=a.stream;if(d)if(b.a.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Qb&&(b.a.debug("Engaging trick mode stream",c),_.az(b,c,!1,0),a.Qb=d);else if(d=a.Qb)b.a.debug("Restoring non-trick-mode stream",d),a.Qb=null,_.az(b,d,!0,0)}}};
250
+ _.t.ia=function(){if(this.f&&this.w){var a=aA(this);if(null==a)a=null;else{if(!Yx(this.M,a).text){var b=_.wx(a.textStreams,this.ga,this.rc);b.length&&(b=b[0],Yx(this.M,a).text=b)}a=Yx(this.M,a).text}b=[];for(var c=_.u(IA(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=tx(d);e.active=d==a;b.push(e)}return b}return[]};_.t.getPeriods=function(){return this.f.periods};
251
+ _.t.getStats=function(){if(this.D!==Lz)return _.Tm();iA(this);var a=this.h;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.H,c=Number(a.totalVideoFrames);b.j=Number(a.droppedVideoFrames);b.h=c}if(this.D===Lz){if(a=vA(this))this.H.m=a.bandwidth;a&&a.video&&(b=this.H,c=a.video.height||NaN,b.o=a.video.width||NaN,b.g=c);a=this.g.getBandwidthEstimate();this.H.f=a}return this.H.getStats()};
252
+ _.t.getTimelineCues=function(){return this.sc?_.mf(this.sc.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}}):[]};_.t.resetAbr=function(){this.g&&this.g.reset()};
253
+ _.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,w,z;return _.A(function(C){if(1==C.a){if(g.D!==Lz)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=aA(g);l=_.wn;m=g.f.periods.indexOf(h);n=m+1;p=n>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[n].startTime;q=p-h.startTime;if(Infinity==q)throw new _.L(1,4,4040);r=new _.gw(1,0,q,function(){return[a]},0,null,0);w={id:g.rg++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
254
+ findSegmentPosition:function(){return 1},getSegmentReference:function(E){return 1==E?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.nv,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.Jd.add(w);h.textStreams.push(w);return _.x(C,Xy(g.a,w),2)}if(z=_.Qy(g.a,_.Ce))Yx(g.M,h).text=
255
+ z;g.Jd["delete"](w);g.log.debug("Choosing new streams after adding a text stream");tA(g,h);cA(g);return C["return"](tx(w))})};_.t.xh=function(a){this.log.debug(_.pv,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=GA(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}}};
256
+ _.t.wh=function(){this.log.debug("canSwitch_");this.S=!1;this.configuration.abr.enabled&&this.g.enable();this.ba&&(bz(this.a,this.ba,this.mg,this.lg),this.ba=null);this.$&&(_.az(this.a,this.$,!0,0),this.$=null)};_.t.yh=function(){this.A&&this.A.update&&this.A.update()};_.t.lj=function(){this.w&&this.w.j.Pd()};
257
+ _.t.Jg=function(a,b,c){if((void 0===c?"":c)===ov)return cA(this),this.ka()||(this.configuration.abr.enabled=!0,this.g.enable()),tA(this,b,!1),!0;if(c=b.variants.some(function(g){var h=!1,l=g[a.type];l&&(h=g.allowedByApplication&&l.id!==a.id,a.type===_.kc&&(h=h&&l.language===a.language));return h})&&this.ka()){for(var d=_.u(b.variants),e=d.next();!e.done;e=d.next()){e=e.value;var f=e[a.type];f&&f.id===a.id&&(e.allowedByApplication=!1)}cA(this);this.ka()||(this.configuration.abr.enabled=!0,this.g.enable());
258
+ tA(this,b)}return c};_.t.Zi=function(){this.log.debug("endOfStream called by streaming engine");this.Sc=!0};_.t.onError=function(a){if(this.D!==Pz&&7001!==a.code&&7E3!==a.code){var b=new _.J(_.jd,{detail:a});a.severity===_.M&&Oz(this,_.hn);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.t.le=function(a){a.type===_.dd?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.$e?Vz(this):"emsg"!==a.type&&(a instanceof _.J?this.dispatchEvent(a):this.log.debug(_.wb,a.type)))};_.t.ka=function(){return this.configuration.abr.enabled};
259
+ _.t.Nj=function(a){var b=this,c,d,e,f,g,h,l,m;return _.A(function(n){switch(n.a){case 1:if(!b.Ra)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ka();return _.x(n,b.Ra(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.K.Va(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.x(n,Iz(b.a),3);case 3:g=vA(b);case 4:return h=!1,_.zf(n,7),b.log.info("Switching CDN to "+f.url+"."),_.x(n,JA(b,f,g),9);case 9:_.Af(n,6);break;case 7:return l=_.Bf(n),b.log.info("Switch failed"),
260
+ _.x(n,b.Ra(f.url,a),10);case 10:if(m=n.f)f.url=m,h=!0;else throw l;case 6:h?n.G(4):(d&&b.g.enable(),Cz(b.a,!0),b.o[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.J(_.Bc,{newManifest:f.url})),_.y(n))}})};var Pz=0,Kz=1,Lz=2,bA=[_.Ud,_.pd];KA.prototype.a=function(){return lv};
261
+ KA.prototype.canPlay=function(a,b){if(_.Yi())return 0;var c=a.type||"",d=window.MediaSource&&MediaSource.isTypeSupported?!0:!1,e=window.MediaSource&&MediaSource.isTypeSupported?c in _.Ep||_.Fp(a.url)in _.Gp?!0:!1:!1;if(d&&e){if(_.Zh(2))return 1;if(_.Zi()&&c===_.Cj){if(b.streaming.preferNativeHlsOnSafari)return 1;_.G("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};KA.prototype.create=function(){return new Mz};_.ag(new KA);_.ao(function(){_.Sf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Rf("Patching Chromecast MSE bugs."),PA();else if(_.Zi()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;NA();10>=a?(_.Rf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Rf("Patching Safari 11 \x26 12 MSE bugs."),LA(),MA()):(_.Rf("Patching Safari 13 MSE bugs."),LA())}else _.Zh(2)||_.Zh(3)||
262
+ _.Zh(4)?OA():_.Rf("Using native MSE as-is.");else _.Rf("No MSE implementation available.")});_.v(QA,_.kq);_.t=QA.prototype;
263
+ _.t.append=function(a){function b(e){if(e.startTime>=e.endTime)_.G("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.Ih(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.Dc}catch(g){f.align="middle"}e.writingMode===_.Pe?f.vertical="lr":e.writingMode===_.Qe&&(f.vertical="rl");e=f}e&&c.push(e)}var c=[],d=_.u(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?
264
+ e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.u(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.t.remove=function(a,b){if(!this.a)return!1;RA(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.t.isTextVisible=function(){return this.a.mode==_.ne};_.t.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.ne:_.nd)};_.t.destroy=function(){this.a&&RA(this.a,function(){return!0});this.a=null;return Promise.resolve()};SA.prototype.ca=function(){return!0};SA.prototype.create=function(a){return new QA(a)};_.Km("single-native",new SA);};
266
265
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
267
266
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
268
267
  else{_=this.clpp._;(f.call(g,this));}