@castlabs/prestoplay 6.13.0 → 6.14.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 (62) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -6
  5. package/cjs/cl.cast.js +111 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +528 -518
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +60 -58
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -67
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +265 -274
  17. package/cjs/cl.muxdata.js +15 -14
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +71 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +70 -70
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +88 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +441 -431
  37. package/cl.crypto.js +8 -8
  38. package/cl.dash.js +68 -68
  39. package/cl.externs.js +60 -58
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -69
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +236 -239
  46. package/cl.muxdata.js +13 -12
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +14 -14
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/clpp.styles.css +2 -0
  61. package/package.json +4 -4
  62. package/typings.d.ts +93 -50
package/cl.muxdata.js CHANGED
@@ -1,12 +1,13 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Yw=function(a){switch(a.type){case 1:return Vw;case 2:return Ww;case 3:return Xw}},$w=function(a){const b=Object.keys(a).find(c=>Zw.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},bx=function(a){let b={debug:!0,data:ax(a)};a.f&&a.f.muxOptionsOverride&&_.xg(a.f.muxOptionsOverride)&&(b=_.tg(b,a.f.muxOptionsOverride));b=_.tg(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.h.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager();const f=
2
- a.m.getSurface();var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.bl(c.url);e.video_source_url=_.Li(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ia(),
3
- c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.h.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.oa())&&d.language&&(e.player_language_code=d.language)}return e}});a.h.debug("Mux SDK options",b);return b},cx=function(a){_.Tg(a.a);a.j.Bd(a.F);a.j.rf(a.C)},dx=function(a,b,c){a.h.debug(`Event: ${b}`);a.A.emit(a.B,b,c)},ax=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.pa,player_software_name:_.pa,
4
- player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.da};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},ex=function(a){a.a.on(a.m,_.Bf,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};dx(a,_.Bf,b)});a.a.on(a.m,_.Ie,()=>dx(a,_.Ie));a.a.on(a.m,_.Jc,a.G.bind(a));a.a.on(a.m,_.rf,a.I.bind(a));a.a.on(a.m,_.Kf,()=>dx(a,_.kf));a.a.on(a.m,_.Jf,()=>dx(a,_.jf));a.a.on(a.m,_.Nd,a.H.bind(a));a.a.on(a.m,_.Wb,()=>dx(a,
5
- "adbreakstart"));a.a.on(a.m,_.Xb,()=>dx(a,"adbreakend"));a.a.on(a.m,_.jc,()=>{dx(a,"adplay");dx(a,"adplaying")});a.a.on(a.m,_.fc,()=>dx(a,"adpause"));a.a.on(a.m,_.hc,()=>{dx(a,"adplay");dx(a,"adplaying")});a.a.on(a.m,_.kc,()=>dx(a,"adended"));a.a.on(a.m,_.bc,()=>dx(a,"adfirstquartile"));a.a.on(a.m,_.ec,()=>dx(a,"admidpoint"));a.a.on(a.m,_.lc,()=>dx(a,"adthirdquartile"));a.j.Gc(a.F);a.j.Ce(a.C);a.a.on(a.m,_.Nd,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===
6
- c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;var d=new _.bl(b.uris[b.uriIndex]);b={request_start:c,request_type:Yw(b),request_hostname:d.a};a.h.debug("onRequestCanceled()","Track event: requestcanceled",b);dx(a,"requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.bl(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:Yw(c),request_hostname:f.a,request_error:`${Yw(c)}${"LoadError"}`,
7
- request_error_code:e,request_error_text:b.toString()};a.h.debug("onRequestFailed()","Track event: requestfailed",b);dx(a,"requestfailed",b)}}}})},fx=function(a){return!_.B(a)&&typeof a.init===_.Pd&&typeof a.emit===_.Pd},Vw="manifest",Ww="media",Xw="encryption",Zw=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var gx=class{constructor(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.hr;this.h=b;this.w=this.l=this.g=!1;this.A=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.A=c;if(!this.g){try{this.g=!0,this.A.init(this.B,bx(this))}catch(d){throw this.g=!1,cx(this),new _.H(1,9,9302,null,d);}dx(this,"playerready")}this.l&&!this.w&&(a=ax(this),dx(this,"videochange",
8
- a),this.l=!1);ex(this)}release(){this.h.debug("release()");this.l?this.h.debug(_.ia):(cx(this),this.l=!0,this.o=this.f=null)}destroy(){this.h.debug(_.xd);this.w?this.h.debug(_.ha):(this.w=!0,dx(this,"destroy"))}G(a){this.h.debug(_.ve);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ja())&&a.bandwidth&&(b+=a.bandwidth),dx(this,"renditionchange",{video_source_bitrate:b}))}I(a){this.h.debug(_.ze);switch(a.detail.currentState){case _.on:this.m.getConfiguration().autoplay&&
9
- dx(this,_.Ie);break;case _.qn:dx(this,_.Pe);break;case _.pn:dx(this,_.Ee);break;case _.en:dx(this,_.Md)}}H(a){this.h.debug(_.we);if(this.g&&(a=a.detail||null))if(10003===a.code)dx(this,"aderror");else if(a.severity===_.G){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;dx(this,_.Nd,{player_error_code:a.code,
10
- player_error_message:b})}}J(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.bl(b.uris[b.uriIndex]);a={request_start:g,request_type:Yw(b),request_hostname:d.a,request_id:$w(e),request_bytes_loaded:f,request_response_start:h,request_response_end:a,request_response_headers:e,
11
- request_media_duration:c,request_url:_.Li(d)};this.h.debug("onRequestCompleted()","Track event: requestcompleted",a);dx(this,"requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var hx=class extends _.jt{constructor(){super();this.f=null;this.a=!1;this.h=new _.R("clpp.muxdata")}onPlayerCreated(a){this.f=new gx(a,this.h)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.ug(c.muxdata);try{var d=[];typeof c===_.ue&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.B(f.muxdata)&&typeof f.muxdata===_.ue){const g=f.muxdata;d=fx(g.muxLib)?g.muxLib:window.mux;if(!fx(d)){this.h.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.H(1,9,9301);this.U(a,h)}}else this.h.warn("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,this.U(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}U(a,b){a.trigger(new _.F(_.Nd,{detail:b}))}};_.z("clpp.muxdata.MuxDataPlugin",hx);hx.Id="mux";_.ro(new class{create(){return new hx}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var wx=function(a){switch(a.type){case 1:return tx;case 2:return ux;case 3:return vx}},yx=function(a){const b=Object.keys(a).find(c=>xx.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},Ax=function(a){let b={debug:!0,data:zx(a)};a.f&&a.f.muxOptionsOverride&&_.Bg(a.f.muxOptionsOverride)&&(b=_.xg(b,a.f.muxOptionsOverride));b=_.xg(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.h.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager();const f=
2
+ a.m.getSurface();var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.ql(c.url);e.video_source_url=_.Ri(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ka(),
3
+ c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.h.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.ja())&&d.language&&(e.player_language_code=d.language)}return e}});a.h.debug("Mux SDK options",b);return b},Bx=function(a){_.Xg(a.a);a.j.yd(a.F);a.j.tf(a.C)},zx=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.pa,player_software_name:_.pa,player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
+ player_mux_plugin_version:_.da};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},Cx=function(a){a.a.on(a.m,_.Ff,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Ff,b)});a.a.on(a.m,_.Me,()=>a.emit(_.Me));a.a.on(a.m,_.Lc,a.G.bind(a));a.a.on(a.m,_.vf,a.I.bind(a));a.a.on(a.m,_.Pf,()=>a.emit(_.of));a.a.on(a.m,_.Of,()=>a.emit(_.nf));a.a.on(a.m,_.Qd,a.H.bind(a));a.a.on(a.m,_.Xb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Zb,()=>a.emit("adbreakend"));a.a.on(a.m,_.kc,()=>
5
+ {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.gc,()=>a.emit("adpause"));a.a.on(a.m,_.ic,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.lc,()=>a.emit("adended"));a.a.on(a.m,_.cc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.fc,()=>a.emit("admidpoint"));a.a.on(a.m,_.mc,()=>a.emit("adthirdquartile"));a.j.Hc(a.F);a.j.Be(a.C);a.a.on(a.m,_.Qd,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
6
+ var d=new _.ql(b.uris[b.uriIndex]);b={request_start:c,request_type:wx(b),request_hostname:d.a};a.h.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.ql(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:wx(c),request_hostname:f.a,request_error:`${wx(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
+ a.h.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},Dx=function(a){return!_.z(a)&&typeof a.init===_.Td&&typeof a.emit===_.Td},tx="manifest",ux="media",vx="encryption",xx=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var Ex=class{constructor(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.Er;this.h=b;this.A=this.l=this.g=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.g){try{this.g=!0,this.w.init(this.B,Ax(this))}catch(d){throw this.g=!1,Bx(this),new _.H(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=zx(this),this.emit("videochange",
8
+ a),this.l=!1);Cx(this)}release(){this.h.debug("release()");this.l?this.h.debug(_.ia):(Bx(this),this.l=!0,this.o=this.f=null)}destroy(){this.h.debug(_.zd);this.A?this.h.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.H(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.h.debug(_.ze);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ka())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.h.debug(_.De);
9
+ switch(a.detail.currentState){case _.Dn:this.m.getConfiguration().autoplay&&this.emit(_.Me);break;case _.Fn:this.emit(_.Te);break;case _.En:this.emit(_.Ie);break;case _.un:this.emit(_.Pd)}}H(a){this.h.debug(_.Ae);if(this.g&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.F){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
10
+ this.emit(_.Qd,{player_error_code:a.code,player_error_message:b})}}J(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.ql(b.uris[b.uriIndex]);a={request_start:g,request_type:wx(b),request_hostname:d.a,request_id:yx(e),request_bytes_loaded:f,request_response_start:h,
11
+ request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Ri(d)};this.h.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var Fx=class extends _.It{constructor(){super();this.f=this.m=null;this.a=!1;this.h=new _.R("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new Ex(a,this.h)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.yg(c.muxdata);try{var d=[];typeof c===_.ye&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.z(f.muxdata)&&typeof f.muxdata===_.ye){const g=f.muxdata;d=Dx(g.muxLib)?g.muxLib:window.mux;if(!Dx(d)){this.h.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.H(1,9,9301);this.T(a,h)}}else this.h.warn("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,this.T(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.m=this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}emit(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.T(this.m,c),c;}}T(a,b){a.trigger(new _.C(_.Qd,{detail:b}))}};
13
+ _.x("clpp.muxdata.MuxDataPlugin",Fx);Fx.prototype.emit=Fx.prototype.emit;Fx.Id="mux";_.Ho(new class{create(){return new Fx}});};f.call(g, window);
package/cl.onboard.js CHANGED
@@ -1,4 +1,4 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Uw=function(a,b){let c=b.baseUrl;_.Yh(c,"/")||(c+="/");const d=g=>g&&(_.Xh(g,"https://")||_.Xh(g,"http://")||_.Xh(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.$r(a);a.Na(_.rd,{licenseUrl:e,videoRobustness:[_.zb,void 0],audioRobustness:[_.yb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.rl,licenseResponse:_.sl}});a.Na(_.nd,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.ul,licenseResponse:_.vl,extractContentId:_.wl,certificateRequest:_.Al}});a.Na(_.pd,{licenseUrl:f,modifiers:{licenseRequest:_.rl}});_.Gk(a)};
3
- _.z("clpp.onboard.OnboardComponent",class extends _.Js{constructor(){super();this.h=new _.R("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Fk[a];this.j.clear()}g(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.h.info(`Registering the DRMtoday Onboard environment, name='${b}'`),Uw(b,a),this.j.add(b))}id(){return"onboard"}});
4
- _.z("clpp.onboard.register",Uw);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var sx=function(a,b){let c=b.baseUrl;_.di(c,"/")||(c+="/");const d=g=>g&&(_.ci(g,"https://")||_.ci(g,"http://")||_.ci(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.vs(a);a.Ma(_.ud,{licenseUrl:e,videoRobustness:[_.Ab,void 0],audioRobustness:[_.zb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Il,licenseResponse:_.Jl}});a.Ma(_.pd,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.Ll,licenseResponse:_.Ml,extractContentId:_.Nl,certificateRequest:_.Ol}});a.Ma(_.sd,{licenseUrl:f,modifiers:{licenseRequest:_.Il}});_.Uk(a)};
3
+ _.x("clpp.onboard.OnboardComponent",class extends _.ht{constructor(){super();this.h=new _.R("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Tk[a];this.j.clear()}g(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.h.info(`Registering the DRMtoday Onboard environment, name='${b}'`),sx(b,a),this.j.add(b))}id(){return"onboard"}});
4
+ _.x("clpp.onboard.register",sx);};f.call(g, window);
package/cl.persistent.js CHANGED
@@ -1,11 +1,11 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ew="A persistent DRM session already exists for: ",Fw="No DRM configuration.",Gw="clpp.persistent",Hw="clpp.persistent.SimpleSessionStorage",Iw=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},Kw=function(a,b){a.H=Jw;a.I=[];a.C=!0;return _.sm(a,b)},Mw=function(a,b,c,d,e,f){a.H=Lw;const g=new Map,h=_.dm(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Be,persistentState:_.ff,sessionTypes:[_.Ge],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,
2
- distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.rm(a,g)},Nw=function(a,b){return _.x(function*(){const c=yield _.Im(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.ob=new _.vm,d.push(e.ob));a.h.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.h.debug("Ignoring attempt to remove missing session",b)})},Ow=function(a){a=a.f.keys();a=Iw(a,b=>b.sessionId);return Array.from(a)},
3
- Pw=function(a,b){const c=_.Ik(a),d=_.ok({drm:a});d.drm=a;a=new _.zn({Ab:b,onError:()=>{},ke:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,wc:()=>null});a.g=c;return a},Sw=function(a,b,c){return _.x(function*(){const d=Qw;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Rw.debug(Ew,e);else{var g=Pw(a,c);try{yield Kw(g,b);yield _.Gm(g);yield _.Jm(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.hj(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));
4
- f={sessionIds:Ow(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Rw.error(`Error while persisting DRM session ${e}`),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Rw.debug(Fw)})},Jw=1,Lw=2,Tw=class{constructor(){this.h=new _.R(Hw)}store(a,b){return _.x(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):
5
- null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.x(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),
6
- f=JSON.parse(e.sessionIds),g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.h.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.x(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.x(function*(){window.localStorage.clear()})}getName(){return Hw}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.yg(a.store)||c.push("store"),_.yg(a.get)||c.push("get"),_.yg(a.delete)||c.push("delete"),_.yg(a.clear)||c.push("clear"),_.yg(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Rw.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});Qw=a});
7
- _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=Qw,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.tn(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Fw);var g=b.offlineId;if(typeof g!==_.uf||!g.length)throw e("Missing offline id.");if(yield d.get(g))Rw.debug(Ew,g);else{var h=_.ok();d=new _.oo;g=[];for(var k of c){const l=new k;_.rk(l.id())||(l.f(),_.tk(l),g.push(l))}k=null;try{k=yield _.pq(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.G,4,4014));const m=_.nq(l.periods);yield Sw(b,m,d)}catch(l){if(l instanceof _.H&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.qk.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
- _.z("clpp.persistent.removeLicense",function(a){return _.x(function*(){var b=Qw;if(_.Ag(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.oo,c=Pw(e.drmConfig,d),yield Mw(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Gm(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield Nw(c,f);Rw.debug("successfully removed session with id",f)}))),yield b.delete(a)):Rw.debug("No persistent DRM session found")}catch(e){throw Rw.error("Failed to remove session"),
10
- new _.H(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else Rw.warn("Invalid offlineId")})});var Qw=new Tw,Rw=new _.R(Gw);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Js{constructor(){super();this.h=new _.R(Gw)}id(){return _.Fe}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.h.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Sw(d,b,e),a.trigger(new _.F(_.Gd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.h.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.h.debug(`Getting EME session IDs for ${a}`);
11
- const c=Qw;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.h.debug(`No offline session found for ${a}`);return[]}catch(d){return b.h.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cx="A persistent DRM session already exists for: ",dx="No DRM configuration.",ex="clpp.persistent",fx="clpp.persistent.SimpleSessionStorage",gx=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},ix=function(a,b){a.I=hx;a.J=[];a.C=!0;return _.Hm(a,b)},kx=function(a,b,c,d,e,f){a.I=jx;const g=new Map,h=_.rm(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Fe,persistentState:_.kf,sessionTypes:[_.Ke],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,
2
+ distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Gm(a,g)},lx=function(a,b){return _.w(function*(){const c=yield _.Xm(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.ob=new _.Km,d.push(e.ob));a.h.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.h.debug("Ignoring attempt to remove missing session",b)})},mx=function(a){a=a.f.keys();a=gx(a,b=>b.sessionId);return Array.from(a)},
3
+ nx=function(a,b){const c=_.Wk(a),d=_.Ck({drm:a});d.drm=a;a=new _.On({mb:b,onError:()=>{},ke:()=>{},je:()=>{},onEvent:()=>{},getConfiguration:()=>d,xc:()=>null});a.g=c;return a},qx=function(a,b,c){return _.w(function*(){const d=ox;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)px.debug(cx,e);else{var g=nx(a,c);try{yield ix(g,b);yield _.Vm(g);yield _.Ym(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.uj(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:mx(g),
4
+ keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw px.error(`Error while persisting DRM session ${e}`),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else px.debug(dx)})},hx=1,jx=2,rx=class{constructor(){this.h=new _.R(fx)}store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
5
+ const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.w(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),
6
+ g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.h.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return fx}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.Cg(a.store)||c.push("store"),_.Cg(a.get)||c.push("get"),_.Cg(a.delete)||c.push("delete"),_.Cg(a.clear)||c.push("clear"),_.Cg(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw px.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});ox=a});
7
+ _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=ox,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.In(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(dx);var g=b.offlineId;if(typeof g!==_.yf||!g.length)throw e("Missing offline id.");if(yield d.get(g))px.debug(cx,g);else{var h=_.Ck();d=new _.Eo;g=[];for(var k of c){const l=new k;_.Fk(l.id())||(l.f(),_.Hk(l),g.push(l))}k=null;try{k=yield _.Kq(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
+ const l=yield k.start(f.url,{networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.F,4,4014));const m=_.Iq(l.periods);yield qx(b,m,d)}catch(l){if(l instanceof _.H&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.Ek.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
+ _.x("clpp.persistent.removeLicense",function(a){return _.w(function*(){var b=ox;if(_.Eg(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Eo,c=nx(e.drmConfig,d),yield kx(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Vm(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield lx(c,f);px.debug("successfully removed session with id",f)}))),yield b.delete(a)):px.debug("No persistent DRM session found")}catch(e){throw px.error("Failed to remove session"),
10
+ new _.H(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else px.warn("Invalid offlineId")})});var ox=new rx,px=new _.R(ex);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.ht{constructor(){super();this.h=new _.R(ex)}id(){return _.Je}l(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.h.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield qx(d,b,e),a.trigger(new _.C(_.Id,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.h.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.w(function*(){b.h.debug(`Getting EME session IDs for ${a}`);
11
+ const c=ox;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.h.debug(`No offline session found for ${a}`);return[]}catch(d){return b.h.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
package/cl.playlist.js CHANGED
@@ -1,5 +1,5 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Bw=function(a,b){return 0<=b&&b<a.a.length},Cw=function(a){a.trigger(new _.F(_.Re))},Dw=class extends _.Vr{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.g=!1;this.j=this.gc.bind(this)}getPosition(){return this.f}og(){return this.a}Oc(){return 0<this.a.length&&Bw(this,this.f)?this.a[this.f]:null}pg(){const a=this.f+1;return 0<
2
- this.a.length&&Bw(this,a)?this.a[a]:null}vg(){return this.g}start(){this.g||(this.g=!0,this.m.on(_.Md,this.j),this.sd(this.f,!0))}stop(){this.g=!1;this.m.off(_.Md,this.j)}gc(){this.next()}next(){const a=this;return _.x(function*(){yield a.sd(Math.min(a.a.length-1,a.f+1))})}Mg(){const a=this;return _.x(function*(){yield a.sd(Math.max(0,a.f-1))})}sd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&Bw(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Oc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
- c.trigger(new _.F(_.Qe,{item:d})))}})}append(a){this.a.push(a);Cw(this)}ug(a,b){if(0<=b&&b<=this.a.length){const c=this.Oc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Cw(this)}}remove(a){if(0<this.a.length&&Bw(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Cw(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;Cw(this)}};_.z("clpp.Playlist",Dw);Dw.prototype.clear=Dw.prototype.clear;Dw.prototype.remove=Dw.prototype.remove;Dw.prototype.insert=Dw.prototype.ug;
4
- Dw.prototype.append=Dw.prototype.append;Dw.prototype.goTo=Dw.prototype.sd;Dw.prototype.previous=Dw.prototype.Mg;Dw.prototype.next=Dw.prototype.next;Dw.prototype.onEnded=Dw.prototype.gc;Dw.prototype.stop=Dw.prototype.stop;Dw.prototype.start=Dw.prototype.start;Dw.prototype.isStarted=Dw.prototype.vg;Dw.prototype.getUpcoming=Dw.prototype.pg;Dw.prototype.getCurrent=Dw.prototype.Oc;Dw.prototype.getQueue=Dw.prototype.og;Dw.prototype.getPosition=Dw.prototype.getPosition;Dw.prototype.off=Dw.prototype.off;
5
- Dw.prototype.one=Dw.prototype.one;Dw.prototype.on=Dw.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var $w=function(a,b){return 0<=b&&b<a.a.length},ax=function(a){a.trigger(new _.C(_.Ve))},bx=class extends _.qs{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.g=!1;this.j=this.fc.bind(this)}getPosition(){return this.f}ng(){return this.a}Pc(){return 0<this.a.length&&$w(this,this.f)?this.a[this.f]:null}og(){const a=this.f+1;return 0<
2
+ this.a.length&&$w(this,a)?this.a[a]:null}ug(){return this.g}start(){this.g||(this.g=!0,this.m.on(_.Pd,this.j),this.rd(this.f,!0))}stop(){this.g=!1;this.m.off(_.Pd,this.j)}fc(){this.next()}next(){const a=this;return _.w(function*(){yield a.rd(Math.min(a.a.length-1,a.f+1))})}Lg(){const a=this;return _.w(function*(){yield a.rd(Math.max(0,a.f-1))})}rd(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&$w(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Pc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
+ c.trigger(new _.C(_.Ue,{item:d})))}})}append(a){this.a.push(a);ax(this)}tg(a,b){if(0<=b&&b<=this.a.length){const c=this.Pc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));ax(this)}}remove(a){if(0<this.a.length&&$w(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);ax(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;ax(this)}};_.x("clpp.Playlist",bx);bx.prototype.clear=bx.prototype.clear;bx.prototype.remove=bx.prototype.remove;bx.prototype.insert=bx.prototype.tg;
4
+ bx.prototype.append=bx.prototype.append;bx.prototype.goTo=bx.prototype.rd;bx.prototype.previous=bx.prototype.Lg;bx.prototype.next=bx.prototype.next;bx.prototype.onEnded=bx.prototype.fc;bx.prototype.stop=bx.prototype.stop;bx.prototype.start=bx.prototype.start;bx.prototype.isStarted=bx.prototype.ug;bx.prototype.getUpcoming=bx.prototype.og;bx.prototype.getCurrent=bx.prototype.Pc;bx.prototype.getQueue=bx.prototype.ng;bx.prototype.getPosition=bx.prototype.getPosition;bx.prototype.off=bx.prototype.off;
5
+ bx.prototype.one=bx.prototype.one;bx.prototype.on=bx.prototype.on;};f.call(g, window);
package/cl.simid.js CHANGED
@@ -1,13 +1,13 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var kw="No surface found. Can not attach frame!",lw="SIMID:Media:timeupdate",mw="Starting creative",nw=function(a,b,c){return{type:b,sessionId:a.g,messageId:a.l++,timestamp:Date.now(),args:c}},qw=function(a,b){return new Promise((c,d)=>{new ow(a.j,c,d,b);pw(a,b)})},rw=function(a){const b=nw(a,"SIMID:Player:startCreative",void 0);qw(a,b).then(()=>{var c=a.f;c.h.info(mw);c.m.trigger(new _.F(_.mf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.h.error("Error while starting creative",
2
- c)})},tw=function(a,b){_.x(function*(){a.g=b.sessionId;sw(a,b);try{{var c=a.f;const f=c.getSurface(),g=c.getContainer();var d={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:c.m.isMuted()||
3
- !1,volume:c.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:c.f.duration},creativeData:{adParameters:c.f.adParameters||"",clickThruUri:"",clickThruUrl:""}}}{const f=nw(a,"SIMID:Player:init",d);var e=qw(a,f)}yield e;a.h.info("Player Init acknowledged");a.f.h.info("SIMID Player initialized")}catch(f){a.h.error("Error while initializing",f),a.f.h.error("Error while initializing SIMID player: ",f),a.unload()}})},sw=function(a,b){pw(a,nw(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},pw=function(a,b){a.g?(b.type!==lw&&a.h.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.h.warn(`WARNING: no session available to send message '${b.type}'`)},uw=function(a,b,c){return new ResizeObserver(()=>{if(a.a.g){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};
5
- e=nw(d,"SIMID:Player:resize",e);pw(d,e)}})},vw=function(a,b){a.h.info("SIMID Session created");a.a=b},ww=function(a){a.h.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
- "";a.g=!1;a.m.trigger(new _.F(_.nf))},xw=function(a,b){var c=a.getContainer();a=c.clientWidth;c=c.clientHeight;return{top:`${b.y/c*100}%`,left:`${b.x/a*100}%`,width:`${b.width/a*100}%`,height:`${b.height/c*100}%`}},yw=class{constructor(a){this.f=a;this.g="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.te;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
- _.te;this.a.style.overflow=_.Rd;this.a.classList.add(_.Xc);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.uf?JSON.parse(b):b:null))if(b.type)switch(this.h.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":tw(this,b);break;case "resolve":b=b.args;var c=this.j.get(b.messageId);c&&c.resolve(b);break;case "reject":b=b.args;(c=this.j.get(b.messageId))&&c.reject(b);break;case "SIMID:Creative:requestResize":c=this.f;var d=b.args;c.h.info("Creative requested resize",
8
- d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.g?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.g=!0);const e=xw(c,d.mediaDimensions);c.m.getSurface().getMedia().style.left=e.left;c.m.getSurface().getMedia().style.top=e.top;c.m.getSurface().getMedia().style.width=e.width;c.m.getSurface().getMedia().style.height=e.height}d.creativeDimensions&&(d=xw(c,d.creativeDimensions),c.a.a.style.left=
9
- d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);sw(this,b)}else this.h.warn("WARNING: received message without 'type' property")};this.h=new _.R("clpp.simid.SimidPlayer");vw(this.f,this)}load(a){window.addEventListener(_.le,this.o);this.g="";this.l=0;const b=this.f.url();this.h.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.h.info("Attaching iFrame");a.appendChild(this.a)}unload(){ww(this.f);this.g=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.le,
10
- this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},ow=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.g=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.j(a)}};var Aw=class extends _.jt{constructor(){super();this.h=new _.R("clpp.simid.Plugin");this.g=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.h.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.g&&this.g.release();this.g=new zw(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.h.info(`Setting up SIMID plugin for ${this.l.length} creatives`),
11
- b=this.m.getSurface()){this.h.info("Creating new session");this.a=new yw(this.g);var c=b.getContainer();this.j=uw(this,c,b);this.j.observe(c);a.on(_.Bf,this.w)}else this.h.warn(kw)}A(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b];const d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(rw(this.a),this.o=!0,this.h.info(mw)),
12
- c&&(c=this.a,pw(c,nw(c,lw,{currentTime:a-b}))))):((a=this.m.getSurface())||this.h.warn(kw),a=a.getContainer(),this.f=b,this.o=!1,this.h.info("Loading session"),this.g.f=b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)}onPlayerWillRelease(a){super.onPlayerWillRelease(a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.Bf,this.w),this.f&&(this.a.unload(),this.f=this.g.f=null))}},zw=class{constructor(a){this.m=a;this.a=null;this.h=new _.R("clpp.simid.Loader");
13
- this.g=!1;this.f=null}release(){this.h.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.h.error("No player container found. Can not create SIMID init data"),new _.H(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.h.error("No player surface found. Can not create SIMID init data"),new _.H(1,10,10100,"No surface");return a}url(){return this.f?this.f.url:""}};_.ro(new class{create(){return new Aw}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Jw="No surface found. Can not attach frame!",Kw="SIMID:Media:timeupdate",Lw="Starting creative",Mw=function(a,b,c){return{type:b,sessionId:a.g,messageId:a.l++,timestamp:Date.now(),args:c}},Pw=function(a,b){return new Promise((c,d)=>{new Nw(a.j,c,d,b);Ow(a,b)})},Qw=function(a){const b=Mw(a,"SIMID:Player:startCreative",void 0);Pw(a,b).then(()=>{var c=a.f;c.h.info(Lw);c.m.trigger(new _.C(_.qf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.h.error("Error while starting creative",
2
+ c)})},Sw=function(a,b){_.w(function*(){a.g=b.sessionId;Rw(a,b);try{{var c=a.f;const f=c.getSurface(),g=c.getContainer();var d={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:c.m.isMuted()||
3
+ !1,volume:c.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:c.f.duration},creativeData:{adParameters:c.f.adParameters||"",clickThruUri:"",clickThruUrl:""}}}{const f=Mw(a,"SIMID:Player:init",d);var e=Pw(a,f)}yield e;a.h.info("Player Init acknowledged");a.f.h.info("SIMID Player initialized")}catch(f){a.h.error("Error while initializing",f),a.f.h.error("Error while initializing SIMID player: ",f),a.unload()}})},Rw=function(a,b){Ow(a,Mw(a,"resolve",{messageId:b.messageId,
4
+ value:void 0}))},Ow=function(a,b){a.g?(b.type!==Kw&&a.h.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.h.warn(`WARNING: no session available to send message '${b.type}'`)},Tw=function(a,b,c){return new ResizeObserver(()=>{if(a.a.g){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};
5
+ e=Mw(d,"SIMID:Player:resize",e);Ow(d,e)}})},Uw=function(a,b){a.h.info("SIMID Session created");a.a=b},Vw=function(a){a.h.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
+ "";a.g=!1;a.m.trigger(new _.C(_.rf))},Ww=function(a,b){var c=a.getContainer();a=c.clientWidth;c=c.clientHeight;return{top:`${b.y/c*100}%`,left:`${b.x/a*100}%`,width:`${b.width/a*100}%`,height:`${b.height/c*100}%`}},Xw=class{constructor(a){this.f=a;this.g="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.xe;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
+ _.xe;this.a.style.overflow=_.Vd;this.a.classList.add(_.Zc);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.yf?JSON.parse(b):b:null))if(b.type)switch(this.h.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":Sw(this,b);break;case "resolve":b=b.args;var c=this.j.get(b.messageId);c&&c.resolve(b);break;case "reject":b=b.args;(c=this.j.get(b.messageId))&&c.reject(b);break;case "SIMID:Creative:requestResize":c=this.f;var d=b.args;c.h.info("Creative requested resize",
8
+ d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.g?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.g=!0);const e=Ww(c,d.mediaDimensions);c.m.getSurface().getMedia().style.left=e.left;c.m.getSurface().getMedia().style.top=e.top;c.m.getSurface().getMedia().style.width=e.width;c.m.getSurface().getMedia().style.height=e.height}d.creativeDimensions&&(d=Ww(c,d.creativeDimensions),c.a.a.style.left=
9
+ d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);Rw(this,b)}else this.h.warn("WARNING: received message without 'type' property")};this.h=new _.R("clpp.simid.SimidPlayer");Uw(this.f,this)}load(a){window.addEventListener(_.qe,this.o);this.g="";this.l=0;const b=this.f.url();this.h.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.h.info("Attaching iFrame");a.appendChild(this.a)}unload(){Vw(this.f);this.g=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.qe,
10
+ this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},Nw=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.g=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.j(a)}};var Zw=class extends _.It{constructor(){super();this.h=new _.R("clpp.simid.Plugin");this.g=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.h.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.g&&this.g.release();this.g=new Yw(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.h.info(`Setting up SIMID plugin for ${this.l.length} creatives`),
11
+ b=this.m.getSurface()){this.h.info("Creating new session");this.a=new Xw(this.g);var c=b.getContainer();this.j=Tw(this,c,b);this.j.observe(c);a.on(_.Ff,this.w)}else this.h.warn(Jw)}A(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b];const d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(Qw(this.a),this.o=!0,this.h.info(Lw)),
12
+ c&&(c=this.a,Ow(c,Mw(c,Kw,{currentTime:a-b}))))):((a=this.m.getSurface())||this.h.warn(Jw),a=a.getContainer(),this.f=b,this.o=!1,this.h.info("Loading session"),this.g.f=b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)}onPlayerWillRelease(a){super.onPlayerWillRelease(a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.Ff,this.w),this.f&&(this.a.unload(),this.f=this.g.f=null))}},Yw=class{constructor(a){this.m=a;this.a=null;this.h=new _.R("clpp.simid.Loader");
13
+ this.g=!1;this.f=null}release(){this.h.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.h.error("No player container found. Can not create SIMID init data"),new _.H(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.h.error("No player surface found. Can not create SIMID init data"),new _.H(1,10,10100,"No surface");return a}url(){return this.f?this.f.url:""}};_.Ho(new class{create(){return new Zw}});};f.call(g, window);
package/cl.smooth.js CHANGED
@@ -1,59 +1,59 @@
1
- import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var vK="Full MP4 box must have flags defined",wK="clpp.smooth.SmoothMP4Processor",xK="codecPrivateData",yK=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.N(a,c);_.N(a,b)},zK=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Lk()}},AK=function(a,b){zK(a,b>>16&255);zK(a,b>>8&255);zK(a,b&255)},BK=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.Lk()}},CK=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.Lk()}},DK=function(a,b){try{a.f.setInt16(a.a,
2
- b,a.g),a.a+=2}catch(c){_.Lk()}},EK=function(a,b){if(void 0!=b){var c=new Uint8Array(b);const d=Math.min(a.length,b);let e=0;for(;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}b=new Uint8Array(a.length);for(c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b},FK=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},GK=function(a,b,c,d){c=b.Te[c];b=b.fh;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
3
- String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.by([a],[b])[0]},HK=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",xK,"fourCC"]:a.type===_.p&&(c=["bitrate",xK,"channels","bitsPerSample","samplingRate","fourCC"]);return _.Cg(a,b,c,["id","segmentIndex"])},IK=function(a,b,c){const d=c.kd.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Oa:null,Qb:null,width:NaN,height:NaN,Jb:null,Yc:NaN,
4
- sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.Oa=[_.gi(d[1])];a.Qb=[_.gi(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Jb=_.gi(c.kd),a.sampleSize=c.Rf||16,a.Yc=c.Yc,a.channelCount=c.Le}return a},JK=function(a,b){return a.filter(c=>c.type===b)},KK=function(a,b){a=a.exec(b);return null==a||""==a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},RK=function(a,b,c){var d=null;if(LK.test(a)){{a=LK.exec(a);d=Number(a[1]);const e=
5
- Number(a[2]);let f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}}else MK.test(a)?d=KK(MK,a):NK.test(a)?d=KK(NK,a):OK.test(a)?(a=OK.exec(a),d=Number(a[1])/c.frameRate):PK.test(a)?(a=PK.exec(a),d=Number(a[1])/c.a):QK.test(a)&&(d=KK(QK,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},SK=function(a){let b=
6
- 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.gl(b)},ZK=function(a,b,c){a:{var d=[_.rd,_.pd];for(e of d)if((d=c.qd(e))&&d.keyId){var e=d.keyId;break a}_.C(wK,"Could not get default Key ID for DRM init data!");e=null}c=new TK("xxxx");a.type===_.w?c=new UK(a.width,a.height):c=new VK(a.channelCount,a.sampleSize,a.Yc);a=new WK;a.g=1;a.j=8;a.o=e||"00000000000000000000000000000000";a=(new TK("schi")).append([a]);b=(new TK(_.of)).append([new XK(b),new YK(_.Sc,65536),a]);c.append([b]);return c},
7
- BL=function(a,b){var c=b.vd(),d=new $K(a.timescale,a.duration,a.id),e=(new aL).append([new bL(a.id)]),f=new cL(a.id,a.duration,a.timescale,a.width,a.height),g=new dL(a.timescale,a.duration);const h=new eL(a.type);var k=null,l=new fL;l.entries=[new gL];var m=new hL;switch(a.type){case _.w:k=new iL(a.Oa,a.Qb);c?(a=ZK(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new jL(a.width,a.height)).append([k]),m.entries=[a]);k=new kL;break;case _.p:k=new lL(a.Jb),c?(a=ZK(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
- (a=(new mL(a.channelCount,a.sampleSize,a.Yc)).append([k]),m.entries=[a]),k=new nL}m=(new oL).append([m,new pL,new qL,new rL,new sL]);l=(new tL).append([l]);l=(new uL).append([k,l,m]);g=(new vL).append([g,h,l]);f=(new wL).append([f,g]);d=(new xL).append([d,f,e]);e=new yL("dash",0,["iso6","mp41","avc1"]);c&&(c=b.qd(_.pd),b=b.qd(_.rd),c&&d.append([new zL("pssh",c.initData,8)]),b&&d.append([new zL("pssh",b.initData,8)]),c||b||_.C(wK,"Could not get PSSH init data!"));b=new AL([e,d]);return _.J(b.write())},
9
- LL=function(a,b){let c,d,e,f,g,h;(new _.el).L("moof",_.Xk).$("mfhd",k=>{{const l=new CL;l.g=_.P(k.reader);c=l}}).L("traf",_.Xk).$("tfhd",k=>{{const l=k.reader.Ca();if(null===k.flags)throw new _.H(_.G,3,3019,vK);const m=new DL(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.Sk(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.B=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.l=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.w=_.P(k.reader));
10
- 0<l-k.reader.getPosition()&&k.flags&32&&(m.o=_.P(k.reader));d=m}}).$("trun",k=>{{var l=k.reader.Ca();if(null===k.flags)throw new _.H(_.G,3,3019,vK);const m=new EL(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.l=_.Rk(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.o=_.P(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.w.push(_.P(k.reader)),k.flags&512&&m.sampleSize.push(_.P(k.reader)),k.flags&1024&&m.B.push(_.P(k.reader)),k.flags&
11
- 2048&&(0===k.version?m.j.push(_.P(k.reader)):m.j.push(_.Rk(k.reader)));e=m}}).$("sdtp",k=>{{const l=_.Uk(k.reader,k.reader.Ca());f=new FL("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.Uk(k.reader,16);if(_.ii(l,GL)){l=_.P(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new HL(k.version,k.flags);l.j=_.P(k.reader);k.flags&1&&(l.l=_.Pk(k.reader));for(let m=0;m<l.j;m++){const n={cf:_.Uk(k.reader,8),Fc:0,ve:[]};if(k.flags&2){n.Fc=_.Qk(k.reader);for(let q=0;q<n.Fc;q++){const t={Je:0,Ke:0};
12
- t.Je=_.Qk(k.reader);t.Ke=_.P(k.reader);n.ve.push(t)}}l.g.push(n)}g=l}}).L(_.je,k=>{{const l=new IL;0<k.reader.Ca()?l.g=_.Uk(k.reader,k.reader.Ca()):(_.C(wK,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new JL).append([d,e]);f&&a.append([f]);b.vd()&&g&&a.append([g]);b=(new KL).append([c,a]);return new AL([b,h])},QL=function(a,b,c,d){var e=d.vd(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=LL(b,d);if(null===g)return a.request.contentType===_.u?a.data:
13
- g;d=g.get(_.je);if(a.request.contentType===_.u){e=d.g.buffer;if(c){e=_.Th(e);if((e=(new DOMParser).parseFromString(e,_.Af))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new ML(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");for(let t=0,v=f.length;t<v;t++){h=f[t];a=c;b=d;g=["begin",_.Ld];for(let y=0,A=g.length;y<
14
- A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const D=l.length;for(;n<D;n++){var q=l[n].name;if(q=q.match(m)){k=k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[y],RK(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.Uh(e).buffer}else c=e;return c}h=new KL;a=g.get("mfhd");b=new JL;k=g.get("tfhd");m=new NL(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");k.g=1;k.flags&=16777214;k.flags|=131072;b.append([k,
15
- m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.j;m++)k.push(10+6*c.g[m].Fc);else g=8;b.append([c,new OL,new PL(g,k,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new AL([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},RL=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
- periodId:null}},SL=function(a){return{initData:_.Sx(_.Ql(a)),initDataType:_.Sc,keyId:a,periodId:null}},TL=function(a,b,c){a=_.Yl(a);c&&a.version!==c&&(a=_.Ux(a,c));return{initData:_.Sx(a),initDataType:_.Sc,keyId:b,periodId:null}},UL=function(a,b){return _.x(function*(){var c=_.ti(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;
17
- c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.l=c.uri;return c})},bM=function(a,b){let c=null;try{{const ea=new DOMParser;let bb,Oa;try{const hb=_.Th(b);Oa=ea.parseFromString(hb.trim(),_.Af)}catch(hb){throw hb;}Oa&&Oa.documentElement.tagName==_.Db&&(bb=Oa.documentElement);c=bb&&0<bb.getElementsByTagName("parsererror").length?null:bb}}catch(ea){}if(!c)throw a.h.error("Unable to parse manifest"),new _.H(_.G,4,4033,a.l);const d=+VL(a,c,"MajorVersion"),e=+VL(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
- 1E7;let g=+VL(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.Kl(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.h.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.G,4,4036,a.l);h?(WL(a,XL),a.A=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):WL(a,YL);a.a={startTime:0,delay:0,duration:g/f,Od:l/f,Sc:0};if(m){{var n=a.f.playreadyVersion;
19
- const ea=[],bb=_.Kl(m,"ProtectionHeader")[0],Oa=_.fi(_.Ml(bb)||""),hb=_.Yl(Oa).a;ea.push(RL(_.rd,SL(hb),[hb]));ea.push(RL(_.pd,TL(Oa,hb,n),[hb]));var q=ea}a.o=q}{const ea=[],bb=_.Kl(c,"StreamIndex");if(!bb.length)throw a.h.error("No streams found!"),new _.H(_.G,4,4034,a.l);for(let Oa=0;Oa<bb.length;Oa++){{var t=a,v=bb[Oa];const hb=VL(t,v,"Type"),xc=+v.getAttribute("Chunks"),mh=v.getAttribute("Subtype"),ae=v.getAttribute("Language")||_.Ef,be=_.Dh(ae),nh=v.getAttribute("Name")||"",Uf=+v.getAttribute(_.db),
20
- Vf=+v.getAttribute(_.cb),xl=VL(t,v,"Url"),lP=+v.getAttribute("TimeScale")||null;{const yc=[],Ri=_.Kl(v,_.sb);for(let ce=0;ce<Ri.length;ce++){{let zc,La,sd;var y=t,A=Ri[ce],D=hb;const Si=+A.getAttribute("Index"),Wf=+VL(y,A,"Bitrate");let Zb=NaN,Xf=NaN,yl=NaN,Rq=NaN,OB=NaN,PB=NaN,QB=NaN;const RB=A.getAttribute("FourCC");switch(D){case _.w:Zb=+VL(y,A,_.cb);Xf=+VL(y,A,_.db);break;case _.p:Rq=+A.getAttribute("Channels")||2,yl=+VL(y,A,"SamplingRate"),PB=+VL(y,A,"AudioTag"),OB=+VL(y,A,"BitsPerSample"),QB=
21
- +VL(y,A,"PacketSize")}let Sq=String(A.getAttribute("CodecPrivateData"));if(D===_.p&&!Sq){{var E=Rq;const SB={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},zl=SB[yl];if("AACH"===RB){La=new Uint8Array(4);const TB=SB[2*yl];La[0]=40|zl>>1;La[1]=zl<<7|E<<3|TB>>1;La[2]=TB<<7|8;La[3]=0;zc=new Uint16Array(2);zc[0]=(La[0]<<8)+La[1];zc[1]=(La[2]<<8)+La[3];sd=zc[0].toString(16)+zc[1].toString(16)}else La=new Uint8Array(2),La[0]=16|zl>>1,La[1]=zl<<7|E<<3,zc=
22
- new Uint16Array(1),zc[0]=(La[0]<<8)+La[1],sd=zc[0].toString(16);Sq=sd.toUpperCase()}}var O={id:y.W++,type:D,index:Si,bitrate:Wf,kd:Sq,maxHeight:Zb,maxWidth:Xf,Yc:yl,Le:Rq,nh:PB,Rf:OB,zh:QB,hg:RB,segmentIndex:null}}yc.push(O)}var tb=yc}{const yc=[],Ri=_.Kl(v,"c");for(let ce=0;ce<Ri.length;ce++){const zc=Ri[ce];let La=parseInt(zc.getAttribute("t"),10),sd=parseInt(zc.getAttribute("d"),10),Si=parseInt(zc.getAttribute("r"),10),Wf=0;if(isNaN(La)&&isNaN(sd))throw t.h.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
- new _.H(_.G,4,4037,t.l);0===ce&&isNaN(La)&&(Wf=La=0);if(0<ce){const Zb=yc[yc.length-1];Wf=Zb.n+1;Zb.d||(Zb.d=La-Zb.t);La||(La=Zb.t+Zb.d);sd||(sd=La-Zb.t)}yc.push({n:Wf,d:sd,t:La});if(Si){Si--;for(let Zb=0;Zb<Si;Zb++){const Xf=yc[yc.length-1];Wf=Xf.n+1;La=Xf.t+Xf.d;sd=Xf.d;yc.push({n:Wf,d:sd,t:La})}}}t.C()||yc.length===xc||t.h.warn("Number of fragments ("+xc+") differs from number of chunks ("+yc.length+").");var Nb=yc}var Zc={type:hb,qh:xc,Yg:mh,language:be,Rc:ae,name:nh,maxWidth:Uf,maxHeight:Vf,
24
- fh:xl,tracks:tb,Te:Nb,timescale:lP}}ea.push(Zc)}var Qf=ea}const Va={yh:d,ef:e,timescale:f,duration:g,isLive:h,xh:k,Od:l,Vd:!1,streams:Qf};if(a.g&&a.w)return ZL(a,Va),Promise.resolve();a.G.clear();{const ea=Va.timescale,bb=Va.duration,Oa=JK(Va.streams,_.p),hb=JK(Va.streams,_.w),xc=JK(Va.streams,_.u),mh=[];let ae=$L(a,bb,ea,Oa),be=$L(a,bb,ea,hb);const nh=$L(a,bb,ea,xc);ae.length||(ae=[null]);be.length||(be=[null]);for(let Uf=0;Uf<be.length;Uf++)for(let Vf=0;Vf<ae.length;Vf++)mh.push(aM(a,be[Uf],ae[Vf]));
25
- var Yd={startTime:0,variants:mh,textStreams:nh,thumbStreams:[]}}{var uc=Va.streams;let ea=a.a.startTime,bb=a.a.delay;const Oa=a.I;let hb=Math.min(a.a.duration||Infinity,Oa);const xc=a.C(),mh=a.a.Od,ae=a.a.Sc,be=a.H,nh=isFinite(a.F)?a.F:0;if(xc)hb=Infinity,ea=Date.now()/1E3-ae,a.a.startTime=ea,bb=3*be;else{const Uf=isFinite(Oa)?Oa:a.a.duration;for(const Vf of uc)for(const xl of Vf.tracks)xl.segmentIndex.offset(-nh),_.By(xl.segmentIndex,Uf)}a.B=new _.wD(ea,bb,!xc,!0);a.B.f=hb;_.Ky(a.B,be);a.B.w=mh;
26
- xc||a.B.offset(-nh)}a.D.filterAllPeriods([Yd]);a.g={presentationTimeline:a.B,periods:[Yd],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.Gc(a.M),a.K=!0);a.w=Va;return Promise.resolve()},cM=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Bb.bind(a),b))},VL=function(a,b,c){if(b=b.getAttribute(c))return b;a.h.error("required attribute not provided: "+c);throw new _.H(_.G,4,4038,a.l,c);},WL=function(a,b){const c=b===YL;if(a.g&&a.g.presentationTimeline){var d=
27
- a.g.presentationTimeline;d.j=c;d.l=c}c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.R=b},ZL=function(a,b){for(let e=0;e<a.w.streams.length;e++){const f=b.streams[e];for(const g of a.w.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){HK(g,c)||a.h.warn("The current stream is updated with a stream that seems to have different base properties!");var d=dM(a,a.w.timescale,f,c);c=g.segmentIndex;_.Uy(c,d);(d=a.a.Od)&&_.Vy(c,_.Sy(c)-d).forEach(h=>{h.La().forEach(k=>
28
- {a.G.delete(k)})})}else a.h.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},dM=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.Te.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.F=Math.min(a.F,h)):h=f[k-1].endTime;const m=h+l,n=GK(a.l,c,k,d);a.H=Math.max(a.H,l);f.push(new _.Ty(k,h,m,()=>[n],0,null,0,null,!0,g));a.G.set(n,h);e+=l});if(c.type===_.w||c.type===_.p)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Sc?a.a.Sc=b.endTime:a.a.Sc=
29
- Math.min(a.a.Sc,b.endTime);return f},$L=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=dM(a,c,k,h);const O=new _.xD(l);var m=null;k.type!==_.u&&(m=eM(a,b,c,k,h));h.segmentIndex=O;l=a.N++;var n=Promise.resolve.bind(Promise),q=O.f.bind(O),t=O.get.bind(O),v=O.g.bind(O),y=O.getDuration.bind(O),A=fM[k.type];var D="";switch(k.type){case _.w:D=h.kd;var E=/00000001[0-9]7/.exec(D);D="avc1."+(E&&E[0]?D.substr(D.indexOf(E[0])+10,6):"42c00c");a.h.debug("VIDEO CODECS: ",
30
- D);break;case _.p:D=h.kd,E=2,"AACH"===h.hg?E=5:D&&(E=(parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+E,a.h.debug("AUDIO CODECS: ",D)}E=k.type===_.u?gM[k.Yg]:void 0;h={id:l,originalId:null,Bh:null,createSegmentIndex:n,findSegmentPosition:q,getSegmentReference:t,adjustSegmentDurations:v,getDuration:y,segmentIndex:O,segmentLookupStrategy:_.Dx,initSegmentReference:m,mimeType:A,codecs:D,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:E,encrypted:a.J(),keyId:null,
31
- language:k.language,originalLanguage:k.Rc,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.Le||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},aM=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Ef;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},eM=function(a,b,c,d,e){b=IK(b,d.timescale||c,e);c={isLive:a.C.bind(a),
32
- vd:a.J.bind(a),mg:()=>1,qd:a.T.bind(a)};d=new Uint8Array(0);try{d=BL(b,c)}catch(g){throw a.h.error("Failed to generate initialization segment."),new _.H(_.G,3,4035,g);}const f="data:text/plain;base64,"+_.ei(d);return new _.tD(()=>[f],0,null,null,!0)},TK=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]}append(a=[]){for(let b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.f.length;b++){if(this.f[b].type===
33
- a)return this.f[b];{const c=this.f[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.N(a,1):_.N(a,this.size);_.Mk(a,EK(this.type));this.size>b&&yK(a,this.size);"uuid"===this.type&&_.Mk(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),
34
- this.f[b].a(),a.getPosition()}},hM=class extends TK{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);zK(a,this.version);AK(a,this.flags)}},zL=class extends TK{constructor(a,b,c){super(a);this.g=b;this.offset=c}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.Mk(a,this.g,this.offset);a.getPosition()}},FL=class extends hM{constructor(a,b,c,d,e){super(a,b,c);this.g=d;this.offset=e}a(){return this.g.byteLength+super.a()-
35
- this.offset}write(a){super.write(a);_.Mk(a,this.g,this.offset);a.getPosition()}},yL=class extends TK{constructor(a,b,c){super("ftyp");this.j=a;this.ef=b;this.g=c}a(){let a=this.j.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.Mk(a,EK(this.j));_.N(a,this.ef);_.Mk(a,EK(this.g.join("")));a.getPosition()}},xL=class extends TK{constructor(){super(_.pe)}},wL=class extends TK{constructor(){super(_.Cf)}},$K=class extends hM{constructor(a,b,c){super("mvhd",1,0);this.timescale=
36
- a;this.duration=b;this.volume=256;this.j=c+1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.g.length;return a+=super.a()}write(a){super.write(a);1===this.version?(yK(a,0),yK(a,0),_.N(a,this.timescale),yK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));_.N(a,65536);BK(a,this.volume);BK(a,0);_.N(a,0);_.N(a,0);for(let b=0;b<this.g.length;b++)zK(a,this.g[b]);
37
- _.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,this.j);a.getPosition()}},aL=class extends TK{constructor(){super("mvex")}},bL=class extends hM{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.N(a,this.g);_.N(a,1);_.N(a,0);_.N(a,0);_.N(a,0);a.getPosition()}},cL=class extends hM{constructor(a,b,c,d,e){super("tkhd",1,7);this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
38
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(yK(a,0),yK(a,0),_.N(a,this.j),_.N(a,0),yK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.j),_.N(a,0),_.N(a,this.duration*this.timescale));_.N(a,0);_.N(a,0);BK(a,0);BK(a,0);BK(a,this.volume);BK(a,0);for(let b=0;b<this.g.length;b++)zK(a,this.g[b]);BK(a,this.width);BK(a,0);BK(a,this.height);BK(a,0);a.getPosition()}},dL=class extends hM{constructor(a,
39
- b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);1===this.version?(yK(a,0),yK(a,0),_.N(a,this.timescale),yK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));BK(a,this.language);BK(a,0);a.getPosition()}},eL=class extends hM{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.N(a,0);this.g===
40
- _.w?_.Mk(a,EK("vide")):_.Mk(a,EK("soun"));_.N(a,0);_.N(a,0);_.N(a,0);this.g===_.w?_.Mk(a,EK("VideoHandler\x00")):_.Mk(a,EK("SoundHandler\x00"));a.getPosition()}},kL=class extends hM{constructor(){super("vmhd",0,1);this.g=new Uint8Array([0,0,0,0,0,0])}a(){return 2+this.g.byteLength+super.a()}write(a){super.write(a);BK(a,0);_.Mk(a,this.g);a.getPosition()}},iM=class extends TK{constructor(a){super(a);this.A=!0}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);BK(a,0);BK(a,1)}},jM=class extends iM{constructor(a){super(a);
41
- this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);BK(a,0);BK(a,0);_.N(a,0);_.N(a,0);_.N(a,0);BK(a,this.width);BK(a,this.height);_.N(a,4718592);_.N(a,4718592);_.N(a,0);BK(a,1);zK(a,10);_.Mk(a,EK("AVC Coding",31));BK(a,this.depth);DK(a,-1)}},kM=class extends iM{constructor(a,b,c,d){super(a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d}a(){return 20+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);BK(a,this.channelCount);BK(a,this.sampleSize);DK(a,0);
42
- BK(a,0);BK(a,this.sampleRate);BK(a,0)}},jL=class extends jM{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},UK=class extends jL{constructor(a,b){super(a,b);this.type="encv"}},mL=class extends kM{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},VK=class extends mL{constructor(a,b,c){super(a,b,c);this.type="enca"}},
43
- iL=class extends TK{constructor(a,b){super("avcC");this.Oa=a;this.Qb=b;this.version=1;this.g=this.Oa[0][1];this.j=this.Oa[0][2];this.level=this.Oa[0][3]}a(){let a=7;for(var b=0;b<this.Oa.length;b++)a+=2,a+=this.Oa[b].byteLength;for(b=0;b<this.Oa.length;b++)a+=2,a+=this.Qb[b].byteLength;return a+super.a()}write(a){super.write(a);zK(a,this.version);zK(a,this.g);zK(a,this.j);zK(a,this.level);zK(a,255);zK(a,224|this.Oa.length);for(var b=0;b<this.Oa.length;b++)BK(a,this.Oa[b].length),_.Mk(a,this.Oa[b]);
44
- zK(a,this.Qb.length);for(b=0;b<this.Qb.length;b++)BK(a,this.Qb[b].length),_.Mk(a,this.Qb[b]);a.getPosition()}},lL=class extends hM{constructor(a){super("esds",0,0);this.Jb=a}a(){return 22+(this.Jb.byteLength+3)+super.a()}write(a){super.write(a);zK(a,3);zK(a,23+this.Jb.byteLength);BK(a,1);zK(a,0);zK(a,4);zK(a,15+this.Jb.byteLength);zK(a,64);zK(a,21);AK(a,0);_.N(a,0);_.N(a,0);zK(a,5);zK(a,this.Jb.byteLength);_.Mk(a,this.Jb);_.Mk(a,new Uint8Array([6,1,2]));a.getPosition()}},gL=class extends hM{constructor(a=
45
- ""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.Mk(a,EK(this.location));a.getPosition()}},fL=class extends hM{constructor(){super("dref",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},oL=class extends TK{constructor(){super(_.tf)}},hL=class extends hM{constructor(){super(_.vf,
46
- 0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},pL=class extends hM{constructor(){super("stts",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
47
- qL=class extends hM{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},sL=class extends hM{constructor(){super("stco",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
48
- a.getPosition()}},rL=class extends hM{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);a.getPosition()}},nL=class extends hM{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);DK(a,0);BK(a,0);a.getPosition()}},tL=class extends TK{constructor(){super("dinf")}},uL=class extends TK{constructor(){super(_.oe)}},vL=class extends TK{constructor(){super(_.ke)}},NL=class extends hM{constructor(a,b){super("tfdt",a,0);this.g=b}a(){let a=
49
- 0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);1===this.version?yK(a,this.g):_.N(a,this.g);a.getPosition()}},CL=class extends hM{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.N(a,this.g);a.getPosition()}},EL=class extends hM{constructor(a,b){super("trun",a,b);this.o=this.l=this.g=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]}a(){let a=4;this.flags&lM&&(a+=4);this.flags&mM&&(a+=4);for(let b=0;b<this.g;b++)this.flags&nM&&(a+=
50
- 4),this.flags&oM&&(a+=4),this.flags&pM&&(a+=4),this.flags&qM&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.g);this.flags&lM&&(a.getPosition(),CK(a,this.l));this.flags&mM&&_.N(a,this.o);for(let b=0;b<this.g;b++)this.flags&nM&&_.N(a,this.w[b]),this.flags&oM&&_.N(a,this.sampleSize[b]),this.flags&pM&&_.N(a,this.B[b]),this.flags&qM&&(0===this.version?_.N(a,this.j[b]):CK(a,this.j[b]));a.getPosition()}},lM=1,mM=4,nM=256,oM=512,pM=1024,qM=2048,DL=class extends hM{constructor(a,b){super("tfhd",
51
- a,b);this.g=255;this.o=this.w=this.l=this.B=this.j=0}a(){let a=4;this.flags&rM&&(a+=8);this.flags&sM&&(a+=4);this.flags&tM&&(a+=4);this.flags&uM&&(a+=4);this.flags&vM&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.g);this.flags&rM&&yK(a,this.j);this.flags&sM&&_.N(a,this.B);this.flags&tM&&_.N(a,this.l);this.flags&uM&&_.N(a,this.w);this.flags&vM&&_.N(a,this.o);a.getPosition()}},rM=1,sM=2,tM=8,uM=16,vM=32,JL=class extends TK{constructor(){super("traf")}},KL=class extends TK{constructor(){super("moof")}},
52
- IL=class extends TK{constructor(){super(_.je);this.g=new Uint8Array(0)}a(){return this.g.byteLength+super.a()}write(a){super.write(a);0<this.g.byteLength&&_.Mk(a,this.g)}},WK=class extends hM{constructor(){super("tenc",0,0);this.g=1;this.j=8;this.o="";this.l=[]}a(){let a;a=20;1===this.g&&0===this.j&&(a=a+1+this.l.length);return a+super.a()}write(a){super.write(a);zK(a,0);0===this.version?zK(a,0):zK(a,0);zK(a,this.g);zK(a,this.j);_.Mk(a,_.gi(this.o));if(1===this.g&&0===this.j){zK(a,0);for(let b=0;b<
53
- this.l.length;b++)zK(a,this.l[b])}a.getPosition()}},YK=class extends hM{constructor(a,b){super("schm",0,0);this.g=a;this.j=b;this.Db=""}a(){let a=8;this.flags&1&&(a+=EK(this.Db).byteLength);return a+super.a()}write(a){super.write(a);_.Mk(a,EK(this.g));_.N(a,this.j);this.flags&1&&_.Mk(a,EK(this.Db));a.getPosition()}},XK=class extends TK{constructor(a){super("frma");this.g=a}a(){return EK(this.g).byteLength+super.a()}write(a){super.write(a);_.Mk(a,EK(this.g));a.getPosition()}},OL=class extends hM{constructor(){super("saio",
54
- 0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,0),_.N(a,0));_.N(a,1);for(let b=0;1>b;b++)0===this.version?_.N(a,this.offset[b]):yK(a,this.offset[b]);a.getPosition()}},PL=class extends hM{constructor(a,b,c){super("saiz",0,0);this.g=a;this.l=b;this.j=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.g&&(a+=this.l.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,
55
- 0),_.N(a,0));zK(a,this.g);_.N(a,this.j);if(0===this.g)for(let b=0;b<this.j;b++)zK(a,this.l[b]);a.getPosition()}},HL=class extends hM{constructor(a,b){super("senc",a,b);this.j=0;this.l=8;this.g=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.j;b++)if(a+=this.g[b].cf.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].Fc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.N(a,this.j);this.flags&1&&zK(a,this.l);for(let b=0;b<this.j;b++)if(_.Mk(a,this.g[b].cf),this.flags&2){BK(a,this.g[b].Fc);
56
- for(let c=0;c<this.g[b].Fc;c++)BK(a,this.g[b].ve[c].Je),_.N(a,this.g[b].ve[c].Ke)}a.getPosition()}};var ML=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0==this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))}},LK=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,MK=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,NK=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,OK=/^(\d*\.?\d*)f$/,PK=/^(\d*\.?\d*)t$/,QK=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var AL=class{constructor(a){this.a=a;this.f=SK(this)}get(a){for(let b=0;b<this.a.length;b++){const c=this.a[b].get(a);if(c)return c}return null}write(){this.f=SK(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var GL=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var wM=class{constructor(){this.w=this.g=this.f=this.D=null;this.N=1;this.W=0;this.l="";this.B=this.a=null;this.h=new _.R("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.R=YL;this.H=0;this.F=this.I=Infinity;this.o=[];this.M=this.V.bind(this);this.G=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,FK(a)])];return UL(this,a).then(c=>bM(this,c.data).then(()=>{cM(this,this.A);return this.g}))}stop(){this.D&&this.D.networkingEngine.Bd(this.M);this.A=this.w=this.g=this.f=
57
- this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.C())return UL(this,[this.l]).then(a=>bM(this,a.data).then(()=>this.g)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}Bb(){this.h.debug(_.ux);this.D&&(this.j=null,this.update().then(()=>{cM(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&cM(this,100))}))}C(){return this.R===XL}J(){return 0<this.o.length}T(a){let b=
58
- null;if(this.o.length)for(let c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}V(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.C.bind(this),vd:this.J.bind(this),mg:()=>1,qd:this.T.bind(this)};let d=!1;const e=new _.H(_.G,3,4035,null);let f=null;try{const g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.h.debug(`Using base media decode time ${g} instead of `+
59
- `segment reference time ${a.request.startTime}`);f=QL(a,b,g,c)}catch(g){d=!0,e.data=g,3E3===g.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)}},fM={video:_.Pf,audio:_.Gc,text:_.Ac},YL=_.vx,XL="LIVE",gM={hh:_.Ax,kh:_.Nx};_.z("clpp.smooth.SmoothComponent",class extends _.Js{f(){_.sq.ism=wM;_.qq[_.Bc]=wM}a(){_.$y("ism");_.az(_.Bc)}id(){return"smooth"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var UK="Full MP4 box must have flags defined",VK="clpp.smooth.SmoothMP4Processor",WK="codecPrivateData",XK=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.N(a,c);_.N(a,b)},YK=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Zk()}},ZK=function(a,b){YK(a,b>>16&255);YK(a,b>>8&255);YK(a,b&255)},$K=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.Zk()}},aL=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.Zk()}},bL=function(a,b){try{a.f.setInt16(a.a,
2
+ b,a.g),a.a+=2}catch(c){_.Zk()}},cL=function(a,b){if(void 0!=b){var c=new Uint8Array(b);const d=Math.min(a.length,b);let e=0;for(;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}b=new Uint8Array(a.length);for(c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b},dL=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},eL=function(a,b,c,d){c=b.Se[c];b=b.eh;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
3
+ String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.zy([a],[b])[0]},fL=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.u?c=["maxWidth","maxHeight","bitrate",WK,"fourCC"]:a.type===_.p&&(c=["bitrate",WK,"channels","bitsPerSample","samplingRate","fourCC"]);return _.Gg(a,b,c,["id","segmentIndex"])},gL=function(a,b,c){const d=c.kd.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Na:null,Nb:null,width:NaN,height:NaN,Gb:null,Zc:NaN,
4
+ sampleSize:NaN,channelCount:NaN};switch(c.type){case _.u:a.Na=[_.mi(d[1])];a.Nb=[_.mi(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Gb=_.mi(c.kd),a.sampleSize=c.Rf||16,a.Zc=c.Zc,a.channelCount=c.Ke}return a},hL=function(a,b){return a.filter(c=>c.type===b)},iL=function(a,b){a=a.exec(b);return null==a||""==a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},pL=function(a,b,c){var d=null;if(jL.test(a)){{a=jL.exec(a);d=Number(a[1]);const e=
5
+ Number(a[2]);let f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}}else kL.test(a)?d=iL(kL,a):lL.test(a)?d=iL(lL,a):mL.test(a)?(a=mL.exec(a),d=Number(a[1])/c.frameRate):nL.test(a)?(a=nL.exec(a),d=Number(a[1])/c.a):oL.test(a)&&(d=iL(oL,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},qL=function(a){let b=
6
+ 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.ul(b)},xL=function(a,b,c){a:{var d=[_.ud,_.sd];for(e of d)if((d=c.qd(e))&&d.keyId){var e=d.keyId;break a}_.B(VK,"Could not get default Key ID for DRM init data!");e=null}c=new rL("xxxx");a.type===_.u?c=new sL(a.width,a.height):c=new tL(a.channelCount,a.sampleSize,a.Zc);a=new uL;a.g=1;a.j=8;a.o=e||"00000000000000000000000000000000";a=(new rL("schi")).append([a]);b=(new rL(_.sf)).append([new vL(b),new wL(_.Uc,65536),a]);c.append([b]);return c},
7
+ $L=function(a,b){var c=b.ud(),d=new yL(a.timescale,a.duration,a.id),e=(new zL).append([new AL(a.id)]),f=new BL(a.id,a.duration,a.timescale,a.width,a.height),g=new CL(a.timescale,a.duration);const h=new DL(a.type);var k=null,l=new EL;l.entries=[new FL];var m=new GL;switch(a.type){case _.u:k=new HL(a.Na,a.Nb);c?(a=xL(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new IL(a.width,a.height)).append([k]),m.entries=[a]);k=new JL;break;case _.p:k=new KL(a.Gb),c?(a=xL(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
+ (a=(new LL(a.channelCount,a.sampleSize,a.Zc)).append([k]),m.entries=[a]),k=new ML}m=(new NL).append([m,new OL,new PL,new QL,new RL]);l=(new SL).append([l]);l=(new TL).append([k,l,m]);g=(new UL).append([g,h,l]);f=(new VL).append([f,g]);d=(new WL).append([d,f,e]);e=new XL("dash",0,["iso6","mp41","avc1"]);c&&(c=b.qd(_.sd),b=b.qd(_.ud),c&&d.append([new YL("pssh",c.initData,8)]),b&&d.append([new YL("pssh",b.initData,8)]),c||b||_.B(VK,"Could not get PSSH init data!"));b=new ZL([e,d]);return _.J(b.write())},
9
+ jM=function(a,b){let c,d,e,f,g,h;(new _.sl).L("moof",_.ll).$("mfhd",k=>{{const l=new aM;l.g=_.P(k.reader);c=l}}).L("traf",_.ll).$("tfhd",k=>{{const l=k.reader.Ca();if(null===k.flags)throw new _.H(_.F,3,3019,UK);const m=new bM(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.gl(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.B=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.l=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.w=_.P(k.reader));
10
+ 0<l-k.reader.getPosition()&&k.flags&32&&(m.o=_.P(k.reader));d=m}}).$("trun",k=>{{var l=k.reader.Ca();if(null===k.flags)throw new _.H(_.F,3,3019,UK);const m=new cM(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.l=_.fl(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.o=_.P(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.w.push(_.P(k.reader)),k.flags&512&&m.sampleSize.push(_.P(k.reader)),k.flags&1024&&m.B.push(_.P(k.reader)),k.flags&
11
+ 2048&&(0===k.version?m.j.push(_.P(k.reader)):m.j.push(_.fl(k.reader)));e=m}}).$("sdtp",k=>{{const l=_.il(k.reader,k.reader.Ca());f=new dM("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.il(k.reader,16);if(_.oi(l,eM)){l=_.P(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new fM(k.version,k.flags);l.j=_.P(k.reader);k.flags&1&&(l.l=_.dl(k.reader));for(let m=0;m<l.j;m++){const n={cf:_.il(k.reader,8),Gc:0,ue:[]};if(k.flags&2){n.Gc=_.el(k.reader);for(let q=0;q<n.Gc;q++){const t={Ie:0,Je:0};
12
+ t.Ie=_.el(k.reader);t.Je=_.P(k.reader);n.ue.push(t)}}l.g.push(n)}g=l}}).L(_.oe,k=>{{const l=new gM;0<k.reader.Ca()?l.g=_.il(k.reader,k.reader.Ca()):(_.B(VK,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new hM).append([d,e]);f&&a.append([f]);b.ud()&&g&&a.append([g]);b=(new iM).append([c,a]);return new ZL([b,h])},oM=function(a,b,c,d){var e=d.ud(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=jM(b,d);if(null===g)return a.request.contentType===_.G?a.data:
13
+ g;d=g.get(_.oe);if(a.request.contentType===_.G){e=d.g.buffer;if(c){e=_.Zh(e);if((e=(new DOMParser).parseFromString(e,_.Ef))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new kM(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");for(let t=0,v=f.length;t<v;t++){h=f[t];a=c;b=d;g=["begin",_.Od];for(let y=0,A=g.length;y<
14
+ A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const D=l.length;for(;n<D;n++){var q=l[n].name;if(q=q.match(m)){k=k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[y],pL(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.$h(e).buffer}else c=e;return c}h=new iM;a=g.get("mfhd");b=new hM;k=g.get("tfhd");m=new lM(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");k.g=1;k.flags&=16777214;k.flags|=131072;b.append([k,
15
+ m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.j;m++)k.push(10+6*c.g[m].Gc);else g=8;b.append([c,new mM,new nM(g,k,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new ZL([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},pM=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
+ periodId:null}},qM=function(a){return{initData:_.py(_.dm(a)),initDataType:_.Uc,keyId:a,periodId:null}},rM=function(a,b,c){a=_.lm(a);c&&a.version!==c&&(a=_.ry(a,c));return{initData:_.py(a),initDataType:_.Uc,keyId:b,periodId:null}},sM=function(a,b){return _.w(function*(){var c=_.zi(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;
17
+ c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.l=c.uri;return c})},AM=function(a,b){let c=null;try{{const ea=new DOMParser;let Za,Ma;try{const hb=_.Zh(b);Ma=ea.parseFromString(hb.trim(),_.Ef)}catch(hb){throw hb;}Ma&&Ma.documentElement.tagName==_.Eb&&(Za=Ma.documentElement);c=Za&&0<Za.getElementsByTagName("parsererror").length?null:Za}}catch(ea){}if(!c)throw a.h.error("Unable to parse manifest"),new _.H(_.F,4,4033,a.l);const d=+tM(a,c,"MajorVersion"),e=+tM(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
+ 1E7;let g=+tM(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.Yl(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.h.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.F,4,4036,a.l);h?(uM(a,vM),a.A=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):uM(a,wM);a.a={startTime:0,delay:0,duration:g/f,Md:l/f,Tc:0};if(m){{var n=a.f.playreadyVersion;
19
+ const ea=[],Za=_.Yl(m,"ProtectionHeader")[0],Ma=_.li(_.$l(Za)||""),hb=_.lm(Ma).a;ea.push(pM(_.ud,qM(hb),[hb]));ea.push(pM(_.sd,rM(Ma,hb,n),[hb]));var q=ea}a.o=q}{const ea=[],Za=_.Yl(c,"StreamIndex");if(!Za.length)throw a.h.error("No streams found!"),new _.H(_.F,4,4034,a.l);for(let Ma=0;Ma<Za.length;Ma++){{var t=a,v=Za[Ma];const hb=tM(t,v,"Type"),Bc=+v.getAttribute("Chunks"),mh=v.getAttribute("Subtype"),$d=v.getAttribute("Language")||_.If,ae=_.Jh($d),nh=v.getAttribute("Name")||"",Rf=+v.getAttribute(_.eb),
20
+ Sf=+v.getAttribute(_.db),Dl=tM(t,v,"Url"),KP=+v.getAttribute("TimeScale")||null;{const Cc=[],Ui=_.Yl(v,_.ub);for(let be=0;be<Ui.length;be++){{let Dc,Ia,rd;var y=t,A=Ui[be],D=hb;const Vi=+A.getAttribute("Index"),Tf=+tM(y,A,"Bitrate");let Yb=NaN,Uf=NaN,El=NaN,Yq=NaN,dC=NaN,eC=NaN,fC=NaN;const gC=A.getAttribute("FourCC");switch(D){case _.u:Yb=+tM(y,A,_.db);Uf=+tM(y,A,_.eb);break;case _.p:Yq=+A.getAttribute("Channels")||2,El=+tM(y,A,"SamplingRate"),eC=+tM(y,A,"AudioTag"),dC=+tM(y,A,"BitsPerSample"),fC=
21
+ +tM(y,A,"PacketSize")}let Zq=String(A.getAttribute("CodecPrivateData"));if(D===_.p&&!Zq){{var E=Yq;const hC={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Fl=hC[El];if("AACH"===gC){Ia=new Uint8Array(4);const iC=hC[2*El];Ia[0]=40|Fl>>1;Ia[1]=Fl<<7|E<<3|iC>>1;Ia[2]=iC<<7|8;Ia[3]=0;Dc=new Uint16Array(2);Dc[0]=(Ia[0]<<8)+Ia[1];Dc[1]=(Ia[2]<<8)+Ia[3];rd=Dc[0].toString(16)+Dc[1].toString(16)}else Ia=new Uint8Array(2),Ia[0]=16|Fl>>1,Ia[1]=Fl<<7|E<<3,Dc=
22
+ new Uint16Array(1),Dc[0]=(Ia[0]<<8)+Ia[1],rd=Dc[0].toString(16);Zq=rd.toUpperCase()}}var O={id:y.W++,type:D,index:Vi,bitrate:Tf,kd:Zq,maxHeight:Yb,maxWidth:Uf,Zc:El,Ke:Yq,mh:eC,Rf:dC,yh:fC,hg:gC,segmentIndex:null}}Cc.push(O)}var bb=Cc}{const Cc=[],Ui=_.Yl(v,"c");for(let be=0;be<Ui.length;be++){const Dc=Ui[be];let Ia=parseInt(Dc.getAttribute("t"),10),rd=parseInt(Dc.getAttribute("d"),10),Vi=parseInt(Dc.getAttribute("r"),10),Tf=0;if(isNaN(Ia)&&isNaN(rd))throw t.h.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
+ new _.H(_.F,4,4037,t.l);0===be&&isNaN(Ia)&&(Tf=Ia=0);if(0<be){const Yb=Cc[Cc.length-1];Tf=Yb.n+1;Yb.d||(Yb.d=Ia-Yb.t);Ia||(Ia=Yb.t+Yb.d);rd||(rd=Ia-Yb.t)}Cc.push({n:Tf,d:rd,t:Ia});if(Vi){Vi--;for(let Yb=0;Yb<Vi;Yb++){const Uf=Cc[Cc.length-1];Tf=Uf.n+1;Ia=Uf.t+Uf.d;rd=Uf.d;Cc.push({n:Tf,d:rd,t:Ia})}}}t.C()||Cc.length===Bc||t.h.warn("Number of fragments ("+Bc+") differs from number of chunks ("+Cc.length+").");var Lb=Cc}var bd={type:hb,ph:Bc,Xg:mh,language:ae,Sc:$d,name:nh,maxWidth:Rf,maxHeight:Sf,
24
+ eh:Dl,tracks:bb,Se:Lb,timescale:KP}}ea.push(bd)}var Nf=ea}const Ua={xh:d,ef:e,timescale:f,duration:g,isLive:h,wh:k,Md:l,Td:!1,streams:Nf};if(a.g&&a.w)return xM(a,Ua),Promise.resolve();a.G.clear();{const ea=Ua.timescale,Za=Ua.duration,Ma=hL(Ua.streams,_.p),hb=hL(Ua.streams,_.u),Bc=hL(Ua.streams,_.G),mh=[];let $d=yM(a,Za,ea,Ma),ae=yM(a,Za,ea,hb);const nh=yM(a,Za,ea,Bc);$d.length||($d=[null]);ae.length||(ae=[null]);for(let Rf=0;Rf<ae.length;Rf++)for(let Sf=0;Sf<$d.length;Sf++)mh.push(zM(a,ae[Rf],$d[Sf]));
25
+ var Xd={startTime:0,endTime:Za,variants:mh,textStreams:nh,thumbStreams:[]}}{var xc=Ua.streams;let ea=a.a.startTime,Za=a.a.delay;const Ma=a.I;let hb=Math.min(a.a.duration||Infinity,Ma);const Bc=a.C(),mh=a.a.Md,$d=a.a.Tc,ae=a.H,nh=isFinite(a.F)?a.F:0;if(Bc)hb=Infinity,ea=Date.now()/1E3-$d,a.a.startTime=ea,Za=3*ae;else{const Rf=isFinite(Ma)?Ma:a.a.duration;for(const Sf of xc)for(const Dl of Sf.tracks)Dl.segmentIndex.offset(-nh),_.Vy(Dl.segmentIndex,Rf)}a.B=new _.UD(a.f.timeline||{},ea,Za,!Bc,!0);a.B.g=
26
+ hb;_.hz(a.B,ae);a.B.w=mh;Bc||a.B.offset(-nh)}a.D.filterAllPeriods([Xd]);a.g={presentationTimeline:a.B,periods:[Xd],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.Hc(a.M),a.K=!0);a.w=Ua;return Promise.resolve()},BM=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Bb.bind(a),b))},tM=function(a,b,c){if(b=b.getAttribute(c))return b;a.h.error("required attribute not provided: "+c);throw new _.H(_.F,4,4038,a.l,c);},uM=function(a,b){const c=b===wM;a.g&&a.g.presentationTimeline&&
27
+ _.cz(a.g.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.O=b},xM=function(a,b){for(let e=0;e<a.w.streams.length;e++){const f=b.streams[e];for(const g of a.w.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){fL(g,c)||a.h.warn("The current stream is updated with a stream that seems to have different base properties!");var d=CM(a,a.w.timescale,f,c);c=g.segmentIndex;_.qz(c,d);(d=a.a.Md)&&_.rz(c,_.oz(c)-d).forEach(h=>{h.La().forEach(k=>
28
+ {a.G.delete(k)})})}else a.h.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},CM=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.Se.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.F=Math.min(a.F,h)):h=f[k-1].endTime;const m=h+l,n=eL(a.l,c,k,d);a.H=Math.max(a.H,l);f.push(new _.pz(k,h,m,()=>[n],0,null,0,null,!0,g));a.G.set(n,h);e+=l});if(c.type===_.u||c.type===_.p)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Tc?a.a.Tc=b.endTime:a.a.Tc=
29
+ Math.min(a.a.Tc,b.endTime);return f},yM=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=CM(a,c,k,h);const O=new _.VD(l);var m=null;k.type!==_.G&&(m=DM(a,b,c,k,h));h.segmentIndex=O;l=_.WD++;var n=Promise.resolve.bind(Promise),q=O.f.bind(O),t=O.get.bind(O),v=O.g.bind(O),y=O.getDuration.bind(O),A=EM[k.type];var D="";switch(k.type){case _.u:D=h.kd;var E=/00000001[0-9]7/.exec(D);D="avc1."+(E&&E[0]?D.substr(D.indexOf(E[0])+10,6):"42c00c");a.h.debug("VIDEO CODECS: ",
30
+ D);break;case _.p:D=h.kd,E=2,"AACH"===h.hg?E=5:D&&(E=(parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+E,a.h.debug("AUDIO CODECS: ",D)}E=k.type===_.G?FM[k.Xg]:void 0;h={id:l,originalId:null,Ah:null,createSegmentIndex:n,findSegmentPosition:q,getSegmentReference:t,adjustSegmentDurations:v,getDuration:y,segmentIndex:O,segmentLookupStrategy:_.ay,initSegmentReference:m,mimeType:A,codecs:D,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:E,encrypted:a.J(),keyId:null,
31
+ language:k.language,originalLanguage:k.Sc,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.Ke||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},zM=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.If;return c||b?{id:a.U++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},DM=function(a,b,c,d,e){b=gL(b,d.timescale||c,e);c={isLive:a.C.bind(a),
32
+ ud:a.J.bind(a),mg:()=>1,qd:a.R.bind(a)};d=new Uint8Array(0);try{d=$L(b,c)}catch(g){throw a.h.error("Failed to generate initialization segment."),new _.H(_.F,3,4035,g);}const f="data:text/plain;base64,"+_.ki(d);return new _.RD(()=>[f],0,null,null,!0)},rL=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]}append(a=[]){for(let b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.f.length;b++){if(this.f[b].type===
33
+ a)return this.f[b];{const c=this.f[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.N(a,1):_.N(a,this.size);_.$k(a,cL(this.type));this.size>b&&XK(a,this.size);"uuid"===this.type&&_.$k(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),
34
+ this.f[b].a(),a.getPosition()}},GM=class extends rL{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);YK(a,this.version);ZK(a,this.flags)}},YL=class extends rL{constructor(a,b,c){super(a);this.g=b;this.offset=c}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.$k(a,this.g,this.offset);a.getPosition()}},dM=class extends GM{constructor(a,b,c,d,e){super(a,b,c);this.g=d;this.offset=e}a(){return this.g.byteLength+super.a()-
35
+ this.offset}write(a){super.write(a);_.$k(a,this.g,this.offset);a.getPosition()}},XL=class extends rL{constructor(a,b,c){super("ftyp");this.j=a;this.ef=b;this.g=c}a(){let a=this.j.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.$k(a,cL(this.j));_.N(a,this.ef);_.$k(a,cL(this.g.join("")));a.getPosition()}},WL=class extends rL{constructor(){super(_.ue)}},VL=class extends rL{constructor(){super(_.Gf)}},yL=class extends GM{constructor(a,b,c){super("mvhd",1,0);this.timescale=
36
+ a;this.duration=b;this.volume=256;this.j=c+1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.g.length;return a+=super.a()}write(a){super.write(a);1===this.version?(XK(a,0),XK(a,0),_.N(a,this.timescale),XK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));_.N(a,65536);$K(a,this.volume);$K(a,0);_.N(a,0);_.N(a,0);for(let b=0;b<this.g.length;b++)YK(a,this.g[b]);
37
+ _.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,this.j);a.getPosition()}},zL=class extends rL{constructor(){super("mvex")}},AL=class extends GM{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.N(a,this.g);_.N(a,1);_.N(a,0);_.N(a,0);_.N(a,0);a.getPosition()}},BL=class extends GM{constructor(a,b,c,d,e){super("tkhd",1,7);this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
38
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(XK(a,0),XK(a,0),_.N(a,this.j),_.N(a,0),XK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.j),_.N(a,0),_.N(a,this.duration*this.timescale));_.N(a,0);_.N(a,0);$K(a,0);$K(a,0);$K(a,this.volume);$K(a,0);for(let b=0;b<this.g.length;b++)YK(a,this.g[b]);$K(a,this.width);$K(a,0);$K(a,this.height);$K(a,0);a.getPosition()}},CL=class extends GM{constructor(a,
39
+ b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);1===this.version?(XK(a,0),XK(a,0),_.N(a,this.timescale),XK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));$K(a,this.language);$K(a,0);a.getPosition()}},DL=class extends GM{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.N(a,0);this.g===
40
+ _.u?_.$k(a,cL("vide")):_.$k(a,cL("soun"));_.N(a,0);_.N(a,0);_.N(a,0);this.g===_.u?_.$k(a,cL("VideoHandler\x00")):_.$k(a,cL("SoundHandler\x00"));a.getPosition()}},JL=class extends GM{constructor(){super("vmhd",0,1);this.g=new Uint8Array([0,0,0,0,0,0])}a(){return 2+this.g.byteLength+super.a()}write(a){super.write(a);$K(a,0);_.$k(a,this.g);a.getPosition()}},HM=class extends rL{constructor(a){super(a);this.A=!0}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);$K(a,0);$K(a,1)}},IM=class extends HM{constructor(a){super(a);
41
+ this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);$K(a,0);$K(a,0);_.N(a,0);_.N(a,0);_.N(a,0);$K(a,this.width);$K(a,this.height);_.N(a,4718592);_.N(a,4718592);_.N(a,0);$K(a,1);YK(a,10);_.$k(a,cL("AVC Coding",31));$K(a,this.depth);bL(a,-1)}},JM=class extends HM{constructor(a,b,c,d){super(a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d}a(){return 20+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);$K(a,this.channelCount);$K(a,this.sampleSize);bL(a,0);
42
+ $K(a,0);$K(a,this.sampleRate);$K(a,0)}},IL=class extends IM{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},sL=class extends IL{constructor(a,b){super(a,b);this.type="encv"}},LL=class extends JM{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},tL=class extends LL{constructor(a,b,c){super(a,b,c);this.type="enca"}},
43
+ HL=class extends rL{constructor(a,b){super("avcC");this.Na=a;this.Nb=b;this.version=1;this.g=this.Na[0][1];this.j=this.Na[0][2];this.level=this.Na[0][3]}a(){let a=7;for(var b=0;b<this.Na.length;b++)a+=2,a+=this.Na[b].byteLength;for(b=0;b<this.Na.length;b++)a+=2,a+=this.Nb[b].byteLength;return a+super.a()}write(a){super.write(a);YK(a,this.version);YK(a,this.g);YK(a,this.j);YK(a,this.level);YK(a,255);YK(a,224|this.Na.length);for(var b=0;b<this.Na.length;b++)$K(a,this.Na[b].length),_.$k(a,this.Na[b]);
44
+ YK(a,this.Nb.length);for(b=0;b<this.Nb.length;b++)$K(a,this.Nb[b].length),_.$k(a,this.Nb[b]);a.getPosition()}},KL=class extends GM{constructor(a){super("esds",0,0);this.Gb=a}a(){return 22+(this.Gb.byteLength+3)+super.a()}write(a){super.write(a);YK(a,3);YK(a,23+this.Gb.byteLength);$K(a,1);YK(a,0);YK(a,4);YK(a,15+this.Gb.byteLength);YK(a,64);YK(a,21);ZK(a,0);_.N(a,0);_.N(a,0);YK(a,5);YK(a,this.Gb.byteLength);_.$k(a,this.Gb);_.$k(a,new Uint8Array([6,1,2]));a.getPosition()}},FL=class extends GM{constructor(a=
45
+ ""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.$k(a,cL(this.location));a.getPosition()}},EL=class extends GM{constructor(){super("dref",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},NL=class extends rL{constructor(){super(_.xf)}},GL=class extends GM{constructor(){super(_.zf,
46
+ 0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},OL=class extends GM{constructor(){super("stts",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
47
+ PL=class extends GM{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},RL=class extends GM{constructor(){super("stco",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
48
+ a.getPosition()}},QL=class extends GM{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);a.getPosition()}},ML=class extends GM{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);bL(a,0);$K(a,0);a.getPosition()}},SL=class extends rL{constructor(){super("dinf")}},TL=class extends rL{constructor(){super(_.te)}},UL=class extends rL{constructor(){super(_.pe)}},lM=class extends GM{constructor(a,b){super("tfdt",a,0);this.g=b}a(){let a=
49
+ 0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);1===this.version?XK(a,this.g):_.N(a,this.g);a.getPosition()}},aM=class extends GM{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.N(a,this.g);a.getPosition()}},cM=class extends GM{constructor(a,b){super("trun",a,b);this.o=this.l=this.g=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]}a(){let a=4;this.flags&KM&&(a+=4);this.flags&LM&&(a+=4);for(let b=0;b<this.g;b++)this.flags&MM&&(a+=
50
+ 4),this.flags&NM&&(a+=4),this.flags&OM&&(a+=4),this.flags&PM&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.g);this.flags&KM&&(a.getPosition(),aL(a,this.l));this.flags&LM&&_.N(a,this.o);for(let b=0;b<this.g;b++)this.flags&MM&&_.N(a,this.w[b]),this.flags&NM&&_.N(a,this.sampleSize[b]),this.flags&OM&&_.N(a,this.B[b]),this.flags&PM&&(0===this.version?_.N(a,this.j[b]):aL(a,this.j[b]));a.getPosition()}},KM=1,LM=4,MM=256,NM=512,OM=1024,PM=2048,bM=class extends GM{constructor(a,b){super("tfhd",
51
+ a,b);this.g=255;this.o=this.w=this.l=this.B=this.j=0}a(){let a=4;this.flags&QM&&(a+=8);this.flags&RM&&(a+=4);this.flags&SM&&(a+=4);this.flags&TM&&(a+=4);this.flags&UM&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.g);this.flags&QM&&XK(a,this.j);this.flags&RM&&_.N(a,this.B);this.flags&SM&&_.N(a,this.l);this.flags&TM&&_.N(a,this.w);this.flags&UM&&_.N(a,this.o);a.getPosition()}},QM=1,RM=2,SM=8,TM=16,UM=32,hM=class extends rL{constructor(){super("traf")}},iM=class extends rL{constructor(){super("moof")}},
52
+ gM=class extends rL{constructor(){super(_.oe);this.g=new Uint8Array(0)}a(){return this.g.byteLength+super.a()}write(a){super.write(a);0<this.g.byteLength&&_.$k(a,this.g)}},uL=class extends GM{constructor(){super("tenc",0,0);this.g=1;this.j=8;this.o="";this.l=[]}a(){let a;a=20;1===this.g&&0===this.j&&(a=a+1+this.l.length);return a+super.a()}write(a){super.write(a);YK(a,0);0===this.version?YK(a,0):YK(a,0);YK(a,this.g);YK(a,this.j);_.$k(a,_.mi(this.o));if(1===this.g&&0===this.j){YK(a,0);for(let b=0;b<
53
+ this.l.length;b++)YK(a,this.l[b])}a.getPosition()}},wL=class extends GM{constructor(a,b){super("schm",0,0);this.g=a;this.j=b;this.Db=""}a(){let a=8;this.flags&1&&(a+=cL(this.Db).byteLength);return a+super.a()}write(a){super.write(a);_.$k(a,cL(this.g));_.N(a,this.j);this.flags&1&&_.$k(a,cL(this.Db));a.getPosition()}},vL=class extends rL{constructor(a){super("frma");this.g=a}a(){return cL(this.g).byteLength+super.a()}write(a){super.write(a);_.$k(a,cL(this.g));a.getPosition()}},mM=class extends GM{constructor(){super("saio",
54
+ 0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,0),_.N(a,0));_.N(a,1);for(let b=0;1>b;b++)0===this.version?_.N(a,this.offset[b]):XK(a,this.offset[b]);a.getPosition()}},nM=class extends GM{constructor(a,b,c){super("saiz",0,0);this.g=a;this.l=b;this.j=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.g&&(a+=this.l.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,
55
+ 0),_.N(a,0));YK(a,this.g);_.N(a,this.j);if(0===this.g)for(let b=0;b<this.j;b++)YK(a,this.l[b]);a.getPosition()}},fM=class extends GM{constructor(a,b){super("senc",a,b);this.j=0;this.l=8;this.g=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.j;b++)if(a+=this.g[b].cf.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].Gc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.N(a,this.j);this.flags&1&&YK(a,this.l);for(let b=0;b<this.j;b++)if(_.$k(a,this.g[b].cf),this.flags&2){$K(a,this.g[b].Gc);
56
+ for(let c=0;c<this.g[b].Gc;c++)$K(a,this.g[b].ue[c].Ie),_.N(a,this.g[b].ue[c].Je)}a.getPosition()}};var kM=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0==this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))}},jL=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,kL=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,lL=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,mL=/^(\d*\.?\d*)f$/,nL=/^(\d*\.?\d*)t$/,oL=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var ZL=class{constructor(a){this.a=a;this.f=qL(this)}get(a){for(let b=0;b<this.a.length;b++){const c=this.a[b].get(a);if(c)return c}return null}write(){this.f=qL(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var eM=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var VM=class{constructor(){this.w=this.g=this.f=this.D=null;this.U=1;this.W=0;this.l="";this.B=this.a=null;this.h=new _.R("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.O=wM;this.H=0;this.F=this.I=Infinity;this.o=[];this.M=this.V.bind(this);this.G=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,dL(a)])];return sM(this,a).then(c=>AM(this,c.data).then(()=>{BM(this,this.A);return this.g}))}stop(){this.D&&this.D.networkingEngine.yd(this.M);this.A=this.w=this.g=this.f=
57
+ this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.C())return sM(this,[this.l]).then(a=>AM(this,a.data).then(()=>this.g)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}Bb(){this.h.debug(_.Sx);this.D&&(this.j=null,this.update().then(()=>{BM(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&BM(this,100))}))}C(){return this.O===vM}J(){return 0<this.o.length}R(a){let b=null;if(this.o.length)for(let c=
58
+ 0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}V(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.C.bind(this),ud:this.J.bind(this),mg:()=>1,qd:this.R.bind(this)};let d=!1;const e=new _.H(_.F,3,4035,null);let f=null;try{const g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.h.debug(`Using base media decode time ${g} instead of `+
59
+ `segment reference time ${a.request.startTime}`);f=oM(a,b,g,c)}catch(g){d=!0,e.data=g,3E3===g.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)}},EM={video:_.Yf,audio:_.Hc,text:_.yc},wM=_.Tx,vM="LIVE",FM={hh:_.Yx,jh:_.ky};_.x("clpp.smooth.SmoothComponent",class extends _.ht{f(){_.Nq.ism=VM;_.Lq[_.zc]=VM}a(){_.wz("ism");_.xz(_.zc)}id(){return"smooth"}});};f.call(g, window);