@castlabs/prestoplay 6.25.2 → 6.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +5 -5
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +7 -7
  6. package/cjs/cl.cast.js +112 -112
  7. package/cjs/cl.conviva.js +32 -32
  8. package/cjs/cl.core.js +601 -600
  9. package/cjs/cl.crypto.js +9 -9
  10. package/cjs/cl.dash.js +89 -88
  11. package/cjs/cl.externs.js +37 -31
  12. package/cjs/cl.freewheel.js +24 -24
  13. package/cjs/cl.hls.js +77 -77
  14. package/cjs/cl.hlssmpte.js +6 -6
  15. package/cjs/cl.htmlcue.js +30 -30
  16. package/cjs/cl.ima.js +23 -23
  17. package/cjs/cl.mediatailor.js +3 -3
  18. package/cjs/cl.mse.js +341 -334
  19. package/cjs/cl.muxdata.js +15 -15
  20. package/cjs/cl.onboard.js +3 -3
  21. package/cjs/cl.persistent.js +14 -14
  22. package/cjs/cl.playlist.js +6 -6
  23. package/cjs/cl.sessions.js +16 -16
  24. package/cjs/cl.simid.js +17 -17
  25. package/cjs/cl.smooth.js +72 -72
  26. package/cjs/cl.thumbnails.js +26 -26
  27. package/cjs/cl.tizen.js +71 -71
  28. package/cjs/cl.ttml.js +29 -29
  29. package/cjs/cl.verimatrix.js +5 -5
  30. package/cjs/cl.vimond.js +12 -12
  31. package/cjs/cl.vr.js +19 -19
  32. package/cjs/cl.vtt.js +14 -14
  33. package/cjs/cl.yospace.js +4 -4
  34. package/cjs/cl.youbora.js +38 -36
  35. package/cl.adobe.js +3 -3
  36. package/cl.airplay.js +3 -3
  37. package/cl.broadpeak.js +5 -5
  38. package/cl.cast.js +87 -87
  39. package/cl.conviva.js +27 -27
  40. package/cl.core.js +489 -488
  41. package/cl.crypto.js +9 -9
  42. package/cl.dash.js +82 -82
  43. package/cl.externs.js +37 -31
  44. package/cl.freewheel.js +19 -19
  45. package/cl.hls.js +79 -80
  46. package/cl.hlssmpte.js +5 -5
  47. package/cl.htmlcue.js +26 -26
  48. package/cl.ima.js +17 -17
  49. package/cl.mediatailor.js +3 -3
  50. package/cl.mse.js +299 -292
  51. package/cl.muxdata.js +13 -13
  52. package/cl.onboard.js +4 -4
  53. package/cl.persistent.js +10 -10
  54. package/cl.playlist.js +5 -5
  55. package/cl.sessions.js +10 -10
  56. package/cl.simid.js +14 -14
  57. package/cl.smooth.js +60 -60
  58. package/cl.thumbnails.js +19 -19
  59. package/cl.tizen.js +57 -57
  60. package/cl.ttml.js +22 -22
  61. package/cl.verimatrix.js +4 -4
  62. package/cl.vimond.js +8 -8
  63. package/cl.vr.js +14 -14
  64. package/cl.vtt.js +12 -12
  65. package/cl.yospace.js +3 -3
  66. package/cl.youbora.js +28 -27
  67. package/package.json +3 -3
  68. package/typings.d.ts +41 -3
package/cl.muxdata.js CHANGED
@@ -1,13 +1,13 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var eB=function(a){switch(a.type){case 1:return bB;case 2:return cB;case 3:return dB}},gB=function(a){const b=Object.keys(a).find(c=>fB.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},iB=function(a){let b={debug:!0,data:hB(a)};a.f&&a.f.muxOptionsOverride&&_.$g(a.f.muxOptionsOverride)&&(b=_.Wg(b,a.f.muxOptionsOverride));b=_.Wg(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.g.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 _.mm(c.url);e.video_source_url=_.Kj(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().na(),
3
- c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.qa())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},jB=function(a){_.Dh(a.a);a.j.xd(a.F);a.j.me(a.C)},hB=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.qa,player_software_name:_.qa,player_software_version:_.ea,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
- player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},kB=function(a){a.a.on(a.m,_.Zf,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Zf,b)});a.a.on(a.m,_.Re,()=>a.emit(_.Re));a.a.on(a.m,_.Kc,a.G.bind(a));a.a.on(a.m,_.Kf,a.I.bind(a));a.a.on(a.m,_.jg,()=>a.emit(_.Cf));a.a.on(a.m,_.ig,()=>a.emit(_.Bf));a.a.on(a.m,_.q,a.H.bind(a));a.a.on(a.m,_.Rb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Sb,()=>a.emit("adbreakend"));a.a.on(a.m,_.jc,()=>{a.emit("adplay");
5
- a.emit("adplaying")});a.a.on(a.m,_.cc,()=>a.emit("adpause"));a.a.on(a.m,_.ec,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.lc,()=>a.emit("adended"));a.a.on(a.m,_.Wb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.bc,()=>a.emit("admidpoint"));a.a.on(a.m,_.mc,()=>a.emit("adthirdquartile"));a.j.Gc(a.F);a.j.Jd(a.C);a.a.on(a.m,_.q,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 _.mm(b.uris[b.uriIndex]);b={request_start:c,request_type:eB(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.mm(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:eB(c),request_hostname:f.a,request_error:`${eB(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
- a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},lB=function(a,b){a.trigger(new _.F(_.q,{detail:b}))},mB=function(a){return!_.B(a)&&typeof a.init===_.Yd&&typeof a.emit===_.Yd},bB="manifest",cB="media",dB="encryption",fB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var nB=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 _.Nt;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.K.bind(this);this.C=this.J.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,iB(this))}catch(d){throw this.h=!1,jB(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=hB(this),this.emit("videochange",
8
- a),this.l=!1);kB(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(jB(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Ad);this.A?this.g.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.I(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.De);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ma())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ie);
9
- switch(a.detail.currentState){case _.Uo:this.m.getConfiguration().autoplay&&this.emit(_.Re);break;case _.Wo:this.emit(_.bf);break;case _.Vo:this.emit(_.Ne);break;case _.Lo:this.emit(_.Sd)}}H(a){this.g.debug(_.Fe);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("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)}`;
10
- this.emit(_.q,{player_error_code:a.code,player_error_message:b})}}K(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 _.mm(b.uris[b.uriIndex]);a={request_start:g,request_type:eB(b),request_hostname:d.a,request_id:gB(e),request_bytes_loaded:f,request_response_start:h,
11
- request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Kj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var oB=class extends _.Pv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.S("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new nB(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Xg(c.muxdata);try{var d=[];typeof c===_.Ce&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.I(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.B(f.muxdata)&&typeof f.muxdata===_.Ce){const g=f.muxdata;d=mB(g.muxLib)?g.muxLib:window.mux;if(!mB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.I(1,9,9301);lB(a,h)}}else this.g.debug("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,lB(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&&lB(this.m,c),c;}}};_.z("clpp.muxdata.MuxDataPlugin",oB);oB.prototype.emit=oB.prototype.emit;
13
- oB.Id="mux";_.Ir(new class{create(){return new oB}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var hB=function(a){switch(a.type){case 1:return eB;case 2:return fB;case 3:return gB}},jB=function(a){const b=Object.keys(a).find(c=>iB.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},lB=function(a){let b={debug:!0,data:kB(a)};a.f&&a.f.muxOptionsOverride&&_.bh(a.f.muxOptionsOverride)&&(b=_.Yg(b,a.f.muxOptionsOverride));b=_.Yg(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.g.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 _.rm(c.url);e.video_source_url=_.fj(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().qa(),
3
+ c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.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.g.debug("Mux SDK options",b);return b},mB=function(a){_.Fh(a.a);a.j.Cd(a.F);a.j.af(a.C)},kB=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.ra,player_software_name:_.ra,player_software_version:_.ea,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
+ player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},nB=function(a){a.a.on(a.m,_.ag,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.ag,b)});a.a.on(a.m,_.Te,()=>a.emit(_.Te));a.a.on(a.m,_.Lc,a.G.bind(a));a.a.on(a.m,_.Mf,a.I.bind(a));a.a.on(a.m,_.lg,()=>a.emit(_.Ef));a.a.on(a.m,_.kg,()=>a.emit(_.Df));a.a.on(a.m,_.r,a.H.bind(a));a.a.on(a.m,_.Sb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Tb,()=>a.emit("adbreakend"));a.a.on(a.m,_.hc,()=>{a.emit("adplay");
5
+ a.emit("adplaying")});a.a.on(a.m,_.dc,()=>a.emit("adpause"));a.a.on(a.m,_.fc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.lc,()=>a.emit("adended"));a.a.on(a.m,_.Xb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.cc,()=>a.emit("admidpoint"));a.a.on(a.m,_.nc,()=>a.emit("adthirdquartile"));a.j.Gc(a.F);a.j.ue(a.C);a.a.on(a.m,_.r,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 _.rm(b.uris[b.uriIndex]);b={request_start:c,request_type:hB(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.rm(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:hB(c),request_hostname:f.a,request_error:`${hB(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
+ a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},oB=function(a,b){a.trigger(new _.F(_.r,{detail:b}))},pB=function(a){return!_.B(a)&&typeof a.init===_.Wd&&typeof a.emit===_.Wd},eB="manifest",fB="media",gB="encryption",iB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var qB=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 _.Rt;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.K.bind(this);this.C=this.J.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,lB(this))}catch(d){throw this.h=!1,mB(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=kB(this),this.emit("videochange",
8
+ a),this.l=!1);nB(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(mB(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Ad);this.A?this.g.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.I(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.Fe);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Oa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ke);
9
+ switch(a.detail.currentState){case _.Xo:this.m.getConfiguration().autoplay&&this.emit(_.Te);break;case _.Zo:this.emit(_.df);break;case _.Yo:this.emit(_.Pe);break;case _.Oo:this.emit(_.Sd)}}H(a){this.g.debug(_.He);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("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)}`;
10
+ this.emit(_.r,{player_error_code:a.code,player_error_message:b})}}K(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 _.rm(b.uris[b.uriIndex]);a={request_start:g,request_type:hB(b),request_hostname:d.a,request_id:jB(e),request_bytes_loaded:f,request_response_start:h,
11
+ request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.fj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var rB=class extends _.Sv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.T("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new qB(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Zg(c.muxdata);try{var d=[];typeof c===_.Ee&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.I(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.B(f.muxdata)&&typeof f.muxdata===_.Ee){const g=f.muxdata;d=pB(g.muxLib)?g.muxLib:window.mux;if(!pB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.I(1,9,9301);oB(a,h)}}else this.g.debug("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,oB(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&&oB(this.m,c),c;}}};_.z("clpp.muxdata.MuxDataPlugin",rB);rB.prototype.emit=rB.prototype.emit;
13
+ rB.Id="mux";_.Mr(new class{create(){return new rB}});};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 aB=function(a,b){let c=b.baseUrl;_.bj(c,"/")||(c+="/");const d=g=>g&&(_.aj(g,"https://")||_.aj(g,"http://")||_.aj(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.yu(a);a.$a(_.td,{licenseUrl:e,videoRobustness:[_.nb,void 0],audioRobustness:[_.mb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Bm,licenseResponse:_.Cm}});a.$a(_.pd,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.Em,licenseResponse:_.Fm,extractContentId:_.Gm,certificateRequest:_.Hm}});a.$a(_.rd,{licenseUrl:f,modifiers:{licenseRequest:_.Bm}});_.Rl(a)};
3
- _.z("clpp.onboard.OnboardComponent",class extends _.Av{constructor(){super();this.g=new _.S("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Ql[a];this.j.clear()}h(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.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),aB(b,a),this.j.add(b))}id(){return"onboard"}});
4
- _.z("clpp.onboard.register",aB);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var dB=function(a,b){let c=b.baseUrl;_.$i(c,"/")||(c+="/");const d=g=>g&&(_.Zi(g,_.be)||_.Zi(g,"http://")||_.Zi(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Bu(a);a.$a(_.td,{licenseUrl:e,videoRobustness:[_.ob,void 0],audioRobustness:[_.nb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Gm,licenseResponse:_.Hm}});a.$a(_.pd,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.Jm,licenseResponse:_.Km,extractContentId:_.Lm,certificateRequest:_.Pm}});a.$a(_.rd,{licenseUrl:f,modifiers:{licenseRequest:_.Gm}});_.Wl(a)};
3
+ _.z("clpp.onboard.OnboardComponent",class extends _.Dv{constructor(){super();this.g=new _.T("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Vl[a];this.j.clear()}h(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.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),dB(b,a),this.j.add(b))}id(){return"onboard"}});
4
+ _.z("clpp.onboard.register",dB);};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 LA="A persistent DRM session already exists for: ",MA="No DRM configuration.",NA="clpp.persistent",OA="clpp.persistent.SimpleSessionStorage",PA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},RA=function(a,b,c,d,e,f){a.K=QA;const g=new Map,h=_.An(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Ke,persistentState:_.uf,sessionTypes:[_.Pe],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
- audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Sn(a,g)},TA=function(a,b){a.K=SA;a.L=[];a.G=!0;return _.Tn(a,b)},UA=function(a,b){return _.x(function*(){const c=yield _.ko(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.ic=new _.bn,d.push(e.ic));a.g.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.g.debug("Ignoring attempt to remove missing session",b)})},VA=function(a){a=a.h.keys();a=PA(a,b=>b.sessionId);return Array.from(a)},
3
- WA=function(a,b){const c=_.Tl(a),d=_.tl({drm:a});d.drm=a;a=new _.cp({vb:b,onError:()=>{},Se:()=>{},Re:()=>{},onEvent:()=>{},getConfiguration:()=>d,Qc:()=>null});a.f=c;return a},ZA=function(a,b,c){return _.x(function*(){const d=XA;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)YA.debug(LA,e);else{var g=WA(a,c);try{yield TA(g,b);yield _.io(g);yield _.lo(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.mk(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:VA(g),
4
- keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw YA.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else YA.debug(MA)})},SA=1,QA=2,$A=class{constructor(){this.g=new _.S(OA)}store(a,b){return _.x(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var OA="A persistent DRM session already exists for: ",PA="No DRM configuration.",QA="clpp.persistent",RA="clpp.persistent.SimpleSessionStorage",SA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},UA=function(a,b,c,d,e,f){a.K=TA;const g=new Map,h=_.Dn(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Me,persistentState:_.wf,sessionTypes:[_.Re],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
+ audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Vn(a,g)},WA=function(a,b){a.K=VA;a.L=[];a.G=!0;return _.Wn(a,b)},XA=function(a,b){return _.x(function*(){const c=yield _.no(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.jc=new _.Ij,d.push(e.jc));a.g.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.g.debug("Ignoring attempt to remove missing session",b)})},YA=function(a){a=a.h.keys();a=SA(a,b=>b.sessionId);return Array.from(a)},
3
+ ZA=function(a,b){const c=_.Yl(a),d=_.yl({drm:a});d.drm=a;a=new _.fp({vb:b,onError:()=>{},Te:()=>{},Se:()=>{},onEvent:()=>{},getConfiguration:()=>d,Qc:()=>null});a.f=c;return a},bB=function(a,b,c){return _.x(function*(){const d=$A;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)aB.debug(OA,e);else{var g=ZA(a,c);try{yield WA(g,b);yield _.lo(g);yield _.oo(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.rk(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:YA(g),
4
+ keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw aB.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else aB.debug(PA)})},VA=1,TA=2,cB=class{constructor(){this.g=new _.T(RA)}store(a,b){return _.x(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
5
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 _.x(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.g.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 OA}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.ah(a.store)||c.push("store"),_.ah(a.get)||c.push("get"),_.ah(a.delete)||c.push("delete"),_.ah(a.clear)||c.push("clear"),_.ah(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw YA.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});XA=a});
7
- _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=XA,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.Zo(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(MA);var g=b.offlineId;if(typeof g!==_.Nf||!g.length)throw e("Missing offline id.");if(yield d.get(g))YA.debug(LA,g);else{var h=_.tl();d=new _.zr;g=[];for(var k of c){const l=new k;_.wl(l.id())||(l.f(),_.yl(l),g.push(l))}k=null;try{k=yield _.Xs(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.G,4,4014));const m=_.Vs(l.periods);yield ZA(b,m,d)}catch(l){if(l instanceof _.I&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.vl.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=XA;if(_.ch(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.zr,c=WA(e.drmConfig,d),yield RA(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.io(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield UA(c,f);YA.debug("successfully removed session with id",f)}))),yield b.delete(a)):YA.debug("No persistent DRM session found")}catch(e){throw YA.error("Failed to remove session"),
10
- new _.I(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else YA.warn("Invalid offlineId")})});_.z("clpp.persistent.getSessionStorage",function(){return XA});var XA=new $A,YA=new _.S(NA);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Av{constructor(){super();this.g=new _.S(NA)}id(){return _.Oe}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield ZA(d,b,e),a.trigger(new _.F(_.Ld,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
- const c=XA;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.g.debug(`No offline session found for ${a}`);return[]}catch(d){return b.g.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
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.g.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 RA}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.ch(a.store)||c.push("store"),_.ch(a.get)||c.push("get"),_.ch(a.delete)||c.push("delete"),_.ch(a.clear)||c.push("clear"),_.ch(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw aB.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});$A=a});
7
+ _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=$A,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.bp(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(PA);var g=b.offlineId;if(typeof g!==_.Pf||!g.length)throw e("Missing offline id.");if(yield d.get(g))aB.debug(OA,g);else{var h=_.yl();d=new _.Dr;g=[];for(var k of c){const l=new k;_.Bl(l.id())||(l.f(),_.Dl(l),g.push(l))}k=null;try{k=yield _.at(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
+ const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.G,4,4014));const m=_.Zs(l.periods);yield bB(b,m,d)}catch(l){if(l instanceof _.I&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.Al.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=$A;if(_.eh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Dr,c=ZA(e.drmConfig,d),yield UA(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.lo(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield XA(c,f);aB.debug("successfully removed session with id",f)}))),yield b.delete(a)):aB.debug("No persistent DRM session found")}catch(e){throw aB.error("Failed to remove session"),
10
+ new _.I(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else aB.warn("Invalid offlineId")})});_.z("clpp.persistent.getSessionStorage",function(){return $A});var $A=new cB,aB=new _.T(QA);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Dv{constructor(){super();this.g=new _.T(QA)}id(){return _.Qe}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield bB(d,b,e),a.trigger(new _.F(_.Ld,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
+ const c=$A;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.g.debug(`No offline session found for ${a}`);return[]}catch(d){return b.g.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 IA=function(a,b){return 0<=b&&b<a.a.length},JA=function(a){a.trigger(new _.F(_.df))},KA=class extends _.su{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.h=!1;this.j=this.Aa.bind(this)}getPosition(){return this.f}Eh(){return this.a}hd(){return 0<this.a.length&&IA(this,this.f)?this.a[this.f]:null}Fh(){const a=this.f+1;return 0<
2
- this.a.length&&IA(this,a)?this.a[a]:null}Rh(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Sd,this.j),this.Td(this.f,!0))}stop(){this.h=!1;this.m.off(_.Sd,this.j)}Aa(){this.next()}next(){const a=this;return _.x(function*(){yield a.Td(Math.min(a.a.length-1,a.f+1))})}ji(){const a=this;return _.x(function*(){yield a.Td(Math.max(0,a.f-1))})}Td(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&IA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.hd();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
- c.trigger(new _.F(_.cf,{item:d})))}})}append(a){this.a.push(a);JA(this)}Ph(a,b){if(0<=b&&b<=this.a.length){const c=this.hd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));JA(this)}}remove(a){if(0<this.a.length&&IA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);JA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;JA(this)}};_.z("clpp.Playlist",KA);KA.prototype.clear=KA.prototype.clear;KA.prototype.remove=KA.prototype.remove;KA.prototype.insert=KA.prototype.Ph;
4
- KA.prototype.append=KA.prototype.append;KA.prototype.goTo=KA.prototype.Td;KA.prototype.previous=KA.prototype.ji;KA.prototype.next=KA.prototype.next;KA.prototype.onEnded=KA.prototype.Aa;KA.prototype.stop=KA.prototype.stop;KA.prototype.start=KA.prototype.start;KA.prototype.isStarted=KA.prototype.Rh;KA.prototype.getUpcoming=KA.prototype.Fh;KA.prototype.getCurrent=KA.prototype.hd;KA.prototype.getQueue=KA.prototype.Eh;KA.prototype.getPosition=KA.prototype.getPosition;KA.prototype.off=KA.prototype.off;
5
- KA.prototype.one=KA.prototype.one;KA.prototype.on=KA.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var LA=function(a,b){return 0<=b&&b<a.a.length},MA=function(a){a.trigger(new _.F(_.ff))},NA=class extends _.vu{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.h=!1;this.j=this.Aa.bind(this)}getPosition(){return this.f}Fh(){return this.a}jd(){return 0<this.a.length&&LA(this,this.f)?this.a[this.f]:null}Gh(){const a=this.f+1;return 0<
2
+ this.a.length&&LA(this,a)?this.a[a]:null}Sh(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Sd,this.j),this.Wd(this.f,!0))}stop(){this.h=!1;this.m.off(_.Sd,this.j)}Aa(){this.next()}next(){const a=this;return _.x(function*(){yield a.Wd(Math.min(a.a.length-1,a.f+1))})}ki(){const a=this;return _.x(function*(){yield a.Wd(Math.max(0,a.f-1))})}Wd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&LA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.jd();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
+ c.trigger(new _.F(_.ef,{item:d})))}})}append(a){this.a.push(a);MA(this)}Qh(a,b){if(0<=b&&b<=this.a.length){const c=this.jd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));MA(this)}}remove(a){if(0<this.a.length&&LA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);MA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;MA(this)}};_.z("clpp.Playlist",NA);NA.prototype.clear=NA.prototype.clear;NA.prototype.remove=NA.prototype.remove;NA.prototype.insert=NA.prototype.Qh;
4
+ NA.prototype.append=NA.prototype.append;NA.prototype.goTo=NA.prototype.Wd;NA.prototype.previous=NA.prototype.ki;NA.prototype.next=NA.prototype.next;NA.prototype.onEnded=NA.prototype.Aa;NA.prototype.stop=NA.prototype.stop;NA.prototype.start=NA.prototype.start;NA.prototype.isStarted=NA.prototype.Sh;NA.prototype.getUpcoming=NA.prototype.Gh;NA.prototype.getCurrent=NA.prototype.jd;NA.prototype.getQueue=NA.prototype.Fh;NA.prototype.getPosition=NA.prototype.getPosition;NA.prototype.off=NA.prototype.off;
5
+ NA.prototype.one=NA.prototype.one;NA.prototype.on=NA.prototype.on;};f.call(g, window);
package/cl.sessions.js CHANGED
@@ -1,10 +1,10 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Dz="apiUrl config is missing",Ez=function(a,b){a.j=a.j.filter(c=>c!==b)},Fz=function(a){let b=0>a;a=Math.abs(a);let c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},Kz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Nf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){Gz(a,b<<3|2);b=new Hz;for(let e=0;e<c.length;e++)d(b,c[e]);Iz(a,b.length());Jz(a,b.end())}else Gz(a,
2
- b<<3|0),d(a,c)},Iz=function(a,b){if(0<=b)Gz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Lz=function(a,b,c){Kz(a,b,c,(d,e)=>{Iz(d,e)})},Gz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Nz=function(a,b,c){Kz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=Fz(e);Mz(d,f,g)}}else{{const [f,g]=Fz(e);Mz(d,f,g)}}})},Oz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Nf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
- 0;e<c.length;e++){Gz(a,b<<3|2);const f=new Hz;d(f,c[e]);Iz(a,f.length());Jz(a,f.end())}else Gz(a,b<<3|2),b=new Hz,d(b,c),Iz(a,b.length()),Jz(a,b.end())},Pz=function(a,b,c){Oz(a,b,c,(d,e)=>{for(let f=0;f<e.length;f++){let g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){let h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|
4
- 128),d.a.push(g&63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},Jz=function(a,b){a.a.push.apply(a.a,b)},Qz=function(a,b,c){Oz(a,b,c,(d,e)=>{Jz(d,e.a())})},Rz=function(a,b,c){Oz(a,b,c,(d,e)=>{Jz(d,e)})},Mz=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},Tz=function(a){const b=new Sz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},Xz=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&Uz(a,new Vz);var b=()=>
5
- {};a.f=new Promise(c=>{b=c});try{const c=new Wz;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.cb,headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())});if(e.ok)a.a=a.a.filter(f=>!d.includes(f));else throw Error("An error occurred while sending telemetry events to the API, "+`status='${e.status}' statusText='${e.statusText}'`);}finally{b(),a.f=null}}})},$z=function(a,b,c,d,e,f,g){const h=new Yz;h.headers=[new Zz("CL-BROWSER-NAME",b),new Zz("CL-BROWSER-VERSION",
6
- c),new Zz("CL-OS-FAMILY",d),new Zz("CL-OS-VERSION",e),new Zz("CL-SDK-NAME",f),new Zz("CL-SDK-NAME",f),new Zz("CL-SDK-VERSION",g)];Uz(a,h)},Uz=function(a,b){if(!a.j){var c=new aA(a.w);c.sessionId=a.A;{var d=Date.now();const e=new bA;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;d=e}c.time=d;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},cA=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield Xz(a),a.a=[]);a.j=!0})},dA=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
7
- _.Dh(a.a);a.Z=!1;const b=a.m.getNetworkEngine();b.me(a.l);b.xd(a.h);Ez(b,a.h);a.f&&(yield cA(a.f),a.f=null)})},lA=function(a){switch(a){case _.To:return eA;case _.Uo:return fA;case _.Po:return gA;case _.Wo:return hA;case _.Vo:return iA;case _.Lo:return jA;case _.Mo:return kA;default:return null}},mA=function(a,b){a.g.debug("Sending event",b);Uz(a.f,b)},uA=function(a,b){switch(a){case 1:return nA;case 2:return b===_.w?oA:b===_.p?pA:b===_.H?qA:b===_.be?rA:sA;case 3:return tA;default:return sA}};var Hz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var vA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Hz;Qz(a,1,this.downloadId);Lz(a,2,this.h);Qz(a,3,this.duration);Lz(a,4,this.j);Qz(a,5,this.f);return a.end()}getId(){return 4}};var wA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Hz;Lz(a,1,this.f);Qz(a,2,this.downloadId);Pz(a,3,this.url);Qz(a,4,this.headers);Pz(a,5,null);Qz(a,6,null);Qz(a,7,this.duration);Nz(a,8,this.size);return a.end()}getId(){return 2}};var xA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Hz;Lz(a,1,this.h);Rz(a,2,this.f);return a.end()}};var yA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Hz;Lz(a,1,this.errorCode);Lz(a,2,this.severity);Pz(a,3,this.message);Pz(a,4,this.f);Qz(a,5,this.cause);return a.end()}getId(){return 7}};var Zz=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Hz;Pz(a,1,this.key);Pz(a,2,this.value);return a.end()}};var zA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Hz;Lz(a,1,this.code);Lz(a,2,this.severity);Qz(a,3,this.cause);return a.end()}getId(){return 12}};var AA=class{constructor(){this.data=null}a(){const a=new Hz;Rz(a,1,this.data);return a.end()}};var BA=class extends AA{constructor(){super();var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&63|128;this.data=a}toString(){const a=[];for(let b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]}};var Yz=class{constructor(){this.headers=[]}a(){const a=new Hz;Qz(a,1,this.headers);return a.end()}getId(){return 1}};var Vz=class{constructor(){}a(){return(new Hz).end()}getId(){return 6}};var aA=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Hz;Qz(a,1,this.j);Qz(a,2,this.sessionId);Qz(a,3,this.time);Nz(a,4,null);Pz(a,5,null);Lz(a,6,this.h);Rz(a,7,this.f);return a.end()}};var Wz=class{constructor(){this.f=null;this.events=[]}a(){const a=new Hz;Rz(a,1,this.f);Qz(a,2,this.events);return a.end()}};var bA=class{constructor(){this.f=this.h=null}a(){const a=new Hz;Nz(a,1,this.h);Lz(a,2,this.f);return a.end()}};var Sz=class{constructor(){this.f=this.h=null}a(){const a=new Hz;Nz(a,1,this.h);Lz(a,2,this.f);return a.end()}};var CA=class{constructor(a,b,c,d,e,f,g,h,k){k=void 0===k?2500:k;this.o=a;this.l=h;this.w=new BA;this.A=new BA;this.a=[];this.h=setInterval(()=>Xz(this),k);this.f=null;this.j=!1;$z(this,b,c,d,e,f,g)}};var DA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Hz;Lz(a,1,this.previousState);Lz(a,2,this.currentState);Lz(a,3,this.reason);Qz(a,4,null);Qz(a,5,null);Qz(a,6,null);return a.end()}getId(){return 5}};var HA=class extends _.Pv{constructor(){super();this.m=null;this.Z=this.j=!1;this.a=new _.Nt;this.f=null;this.g=new _.S("clpp.sessions.SessionsPlugin");this.l=this.F.bind(this);this.h=this.C.bind(this)}onPlayerCreated(a){this.m=a}onContentWillLoad(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Ce))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.j=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.ra),this.g.info("Create a session and start sending events."),
8
- a=_.Tk(),this.f=new CA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.a.on(this.m,_.Kf,this.B.bind(this)),this.a.on(this.m,_.Cf,this.A.bind(this)),this.a.on(this.m,_.Bf,this.w.bind(this)),this.a.on(this.m,_.q,this.o.bind(this)),a=this.m.getNetworkEngine(),a.Jd(this.l),a.Gc(this.h),a.j.push(this.h)):(this.g.warn(Dz),a.onError(new _.I(1,9,15E3,Dz)))}onPlayerWillRelease(){dA(this)}id(){return"sessions"}B(a){if(!this.Z){a=a.detail;var b=a.currentState,
9
- c=new DA;c.previousState=lA(a.previousState);c.currentState=lA(b);mA(this,c)}}A(){if(!this.Z){var a=new DA;a.previousState=lA(this.m.getState());a.currentState=EA;mA(this,a);this.Z=!0}}w(){if(this.Z){var a=new DA;a.previousState=EA;a.currentState=lA(this.m.getState());mA(this,a);this.Z=!1}}o(a){a=a.detail;var b=new zA;b=new yA(new xA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.G?FA:GA;mA(this,b)}F(a){const b=new BA;a.downloadId=b;
10
- const c=new wA(uA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new Zz(d,a.headers[d]));mA(this,c)}C(a){var b=a.request.downloadId;b?(b=new vA(b,a.data.byteLength,Tz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new Zz(c,a.headers[c])),mA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.Ir(new class{create(){return new HA}});var GA=1,FA=2;var eA=0,fA=2,kA=3,EA=5,gA=6,hA=8,iA=10,jA=11;var nA=0,oA=1,pA=2,qA=3,rA=4,tA=5,sA=9;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Gz="apiUrl config is missing",Hz=function(a,b){a.l=a.l.filter(c=>c!==b)},Iz=function(a){let b=0>a;a=Math.abs(a);let c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},Nz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){Jz(a,b<<3|2);b=new Kz;for(let e=0;e<c.length;e++)d(b,c[e]);Lz(a,b.length());Mz(a,b.end())}else Jz(a,
2
+ b<<3|0),d(a,c)},Lz=function(a,b){if(0<=b)Jz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Oz=function(a,b,c){Nz(a,b,c,(d,e)=>{Lz(d,e)})},Jz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Qz=function(a,b,c){Nz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=Iz(e);Pz(d,f,g)}}else{{const [f,g]=Iz(e);Pz(d,f,g)}}})},Rz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
+ 0;e<c.length;e++){Jz(a,b<<3|2);const f=new Kz;d(f,c[e]);Lz(a,f.length());Mz(a,f.end())}else Jz(a,b<<3|2),b=new Kz,d(b,c),Lz(a,b.length()),Mz(a,b.end())},Sz=function(a,b,c){Rz(a,b,c,(d,e)=>{for(let f=0;f<e.length;f++){let g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){let h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|
4
+ 128),d.a.push(g&63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},Mz=function(a,b){a.a.push.apply(a.a,b)},Tz=function(a,b,c){Rz(a,b,c,(d,e)=>{Mz(d,e.a())})},Uz=function(a,b,c){Rz(a,b,c,(d,e)=>{Mz(d,e)})},Pz=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},Wz=function(a){const b=new Vz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},$z=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&Xz(a,new Yz);var b=()=>
5
+ {};a.f=new Promise(c=>{b=c});try{const c=new Zz;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.db,headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())});if(e.ok)a.a=a.a.filter(f=>!d.includes(f));else throw Error("An error occurred while sending telemetry events to the API, "+`status='${e.status}' statusText='${e.statusText}'`);}finally{b(),a.f=null}}})},cA=function(a,b,c,d,e,f,g){const h=new aA;h.headers=[new bA("CL-BROWSER-NAME",b),new bA("CL-BROWSER-VERSION",
6
+ c),new bA("CL-OS-FAMILY",d),new bA("CL-OS-VERSION",e),new bA("CL-SDK-NAME",f),new bA("CL-SDK-NAME",f),new bA("CL-SDK-VERSION",g)];Xz(a,h)},Xz=function(a,b){if(!a.j){var c=new dA(a.w);c.sessionId=a.A;{var d=Date.now();const e=new eA;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;d=e}c.time=d;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},fA=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield $z(a),a.a=[]);a.j=!0})},gA=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
7
+ _.Fh(a.a);a.Z=!1;const b=a.m.getNetworkEngine();b.af(a.l);b.Cd(a.h);Hz(b,a.h);a.f&&(yield fA(a.f),a.f=null)})},oA=function(a){switch(a){case _.Wo:return hA;case _.Xo:return iA;case _.So:return jA;case _.Zo:return kA;case _.Yo:return lA;case _.Oo:return mA;case _.Po:return nA;default:return null}},pA=function(a,b){a.g.debug("Sending event",b);Xz(a.f,b)},xA=function(a,b){switch(a){case 1:return qA;case 2:return b===_.w?rA:b===_.p?sA:b===_.H?tA:b===_.ce?uA:vA;case 3:return wA;default:return vA}};var Kz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var yA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Kz;Tz(a,1,this.downloadId);Oz(a,2,this.h);Tz(a,3,this.duration);Oz(a,4,this.j);Tz(a,5,this.f);return a.end()}getId(){return 4}};var zA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Kz;Oz(a,1,this.f);Tz(a,2,this.downloadId);Sz(a,3,this.url);Tz(a,4,this.headers);Sz(a,5,null);Tz(a,6,null);Tz(a,7,this.duration);Qz(a,8,this.size);return a.end()}getId(){return 2}};var AA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Kz;Oz(a,1,this.h);Uz(a,2,this.f);return a.end()}};var BA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Kz;Oz(a,1,this.errorCode);Oz(a,2,this.severity);Sz(a,3,this.message);Sz(a,4,this.f);Tz(a,5,this.cause);return a.end()}getId(){return 7}};var bA=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Kz;Sz(a,1,this.key);Sz(a,2,this.value);return a.end()}};var CA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Kz;Oz(a,1,this.code);Oz(a,2,this.severity);Tz(a,3,this.cause);return a.end()}getId(){return 12}};var DA=class{constructor(){this.data=null}a(){const a=new Kz;Uz(a,1,this.data);return a.end()}};var EA=class extends DA{constructor(){super();var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&63|128;this.data=a}toString(){const a=[];for(let b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]}};var aA=class{constructor(){this.headers=[]}a(){const a=new Kz;Tz(a,1,this.headers);return a.end()}getId(){return 1}};var Yz=class{constructor(){}a(){return(new Kz).end()}getId(){return 6}};var dA=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Kz;Tz(a,1,this.j);Tz(a,2,this.sessionId);Tz(a,3,this.time);Qz(a,4,null);Sz(a,5,null);Oz(a,6,this.h);Uz(a,7,this.f);return a.end()}};var Zz=class{constructor(){this.f=null;this.events=[]}a(){const a=new Kz;Uz(a,1,this.f);Tz(a,2,this.events);return a.end()}};var eA=class{constructor(){this.f=this.h=null}a(){const a=new Kz;Qz(a,1,this.h);Oz(a,2,this.f);return a.end()}};var Vz=class{constructor(){this.f=this.h=null}a(){const a=new Kz;Qz(a,1,this.h);Oz(a,2,this.f);return a.end()}};var FA=class{constructor(a,b,c,d,e,f,g,h,k){k=void 0===k?2500:k;this.o=a;this.l=h;this.w=new EA;this.A=new EA;this.a=[];this.h=setInterval(()=>$z(this),k);this.f=null;this.j=!1;cA(this,b,c,d,e,f,g)}};var GA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Kz;Oz(a,1,this.previousState);Oz(a,2,this.currentState);Oz(a,3,this.reason);Tz(a,4,null);Tz(a,5,null);Tz(a,6,null);return a.end()}getId(){return 5}};var KA=class extends _.Sv{constructor(){super();this.m=null;this.Z=this.j=!1;this.a=new _.Rt;this.f=null;this.g=new _.T("clpp.sessions.SessionsPlugin");this.l=this.F.bind(this);this.h=this.C.bind(this)}onPlayerCreated(a){this.m=a}onContentWillLoad(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Ee))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.j=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.sa),this.g.info("Create a session and start sending events."),
8
+ a=_.Yk(),this.f=new FA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.a.on(this.m,_.Mf,this.B.bind(this)),this.a.on(this.m,_.Ef,this.A.bind(this)),this.a.on(this.m,_.Df,this.w.bind(this)),this.a.on(this.m,_.r,this.o.bind(this)),a=this.m.getNetworkEngine(),a.ue(this.l),a.Gc(this.h),a.l.push(this.h)):(this.g.warn(Gz),a.onError(new _.I(1,9,15E3,Gz)))}onPlayerWillRelease(){gA(this)}id(){return"sessions"}B(a){if(!this.Z){a=a.detail;var b=a.currentState,
9
+ c=new GA;c.previousState=oA(a.previousState);c.currentState=oA(b);pA(this,c)}}A(){if(!this.Z){var a=new GA;a.previousState=oA(this.m.getState());a.currentState=HA;pA(this,a);this.Z=!0}}w(){if(this.Z){var a=new GA;a.previousState=HA;a.currentState=oA(this.m.getState());pA(this,a);this.Z=!1}}o(a){a=a.detail;var b=new CA;b=new BA(new AA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.G?IA:JA;pA(this,b)}F(a){const b=new EA;a.downloadId=b;
10
+ const c=new zA(xA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new bA(d,a.headers[d]));pA(this,c)}C(a){var b=a.request.downloadId;b?(b=new yA(b,a.data.byteLength,Wz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new bA(c,a.headers[c])),pA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.Mr(new class{create(){return new KA}});var JA=1,IA=2;var hA=0,iA=2,nA=3,HA=5,jA=6,kA=8,lA=10,mA=11;var qA=0,rA=1,sA=2,tA=3,uA=4,wA=5,vA=9;};f.call(g, window);
package/cl.simid.js CHANGED
@@ -1,14 +1,14 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var mz="No surface found. Can not attach frame!",nz="SIMID:Media:timeupdate",oz="Starting creative",pz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},sz=function(a,b){return new Promise((c,d)=>{new qz(a.j,c,d,b);rz(a,b)})},tz=function(a){const b=pz(a,"SIMID:Player:startCreative",void 0);sz(a,b).then(()=>{var c=a.f;c.g.info(oz);c.m.trigger(new _.F(_.Ef));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
- c)})},vz=function(a,b){_.x(function*(){a.h=b.sessionId;uz(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=pz(a,"SIMID:Player:init",d);var e=sz(a,f)}yield e;a.g.info("Player Init acknowledged");a.f.g.info("SIMID Player initialized")}catch(f){a.g.error("Error while initializing",f),a.f.g.error("Error while initializing SIMID player: ",f),a.unload()}})},uz=function(a,b){rz(a,pz(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},rz=function(a,b){a.h?(b.type!==nz&&a.g.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn(`WARNING: no session available to send message '${b.type}'`)},wz=function(a,b,c){return new ResizeObserver(()=>{if(a.a.h){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=pz(d,"SIMID:Player:resize",e);rz(d,e)}})},xz=function(a,b){a.g.info("SIMID Session created");a.a=b},yz=function(a){a.g.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.h=!1;a.m.trigger(new _.F(_.Ff))},zz=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}%`}},Az=class{constructor(a,b){this.f=a;this.w=b;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";a=this.w.style;a.className?this.a.classList.add(a.className):(this.a.style.border=_.Be,this.a.style.backgroundColor="transparent",this.a.style.transition=
7
- "opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.Be,this.a.style.overflow=_.$d);this.a.classList.add(_.Yc);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Nf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":vz(this,c);break;case "resolve":c=c.args;var d=this.j.get(c.messageId);d&&d.resolve(c);break;case "reject":c=c.args;(d=this.j.get(c.messageId))&&d.reject(c);
8
- break;case "SIMID:Creative:requestResize":d=this.f;var e=c.args;d.g.info("Creative requested resize",e);if(d.m&&d.m.getSurface()&&d.m.getSurface().getMedia()&&e.mediaDimensions){d.h?d.m.getSurface().getMedia().style.transition="":(d.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",d.h=!0);const f=zz(d,e.mediaDimensions);d.m.getSurface().getMedia().style.left=f.left;d.m.getSurface().getMedia().style.top=f.top;d.m.getSurface().getMedia().style.width=f.width;d.m.getSurface().getMedia().style.height=
9
- f.height}e.creativeDimensions&&(e=zz(d,e.creativeDimensions),d.a.a.style.left=e.left,d.a.a.style.top=e.top,d.a.a.style.width=e.width,d.a.a.style.height=e.height);uz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.S("clpp.simid.SimidPlayer");xz(this.f,this)}load(a){window.addEventListener(_.re,this.o);this.h="";this.l=0;const b=this.f.url();this.g.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)}unload(){yz(this.f);
10
- this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.re,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},qz=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.h=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.h.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);
11
- this.j(a)}};var Cz=class extends _.Pv{constructor(){super();this.g=new _.S("clpp.simid.Plugin");this.h=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.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new Bz(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length){this.l=b.simid.creatives;this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`);
12
- var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new Az(this.h,b.simid),b=c.getContainer(),this.j=wz(this,b,c),this.j.observe(b),a.on(_.Zf,this.w)):this.g.warn(mz)}}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&&(tz(this.a),this.o=!0,this.g.info(oz)),
13
- c&&(c=this.a,rz(c,pz(c,nz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(mz),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.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(_.Zf,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Bz=class{constructor(a){this.m=a;this.a=null;this.g=new _.S("clpp.simid.Loader");
14
- this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.I(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.I(1,10,10100,"No surface");return a}bg(){return this.a}url(){return this.f?this.f.url:""}};_.Ir(new class{create(){return new Cz}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var pz="No surface found. Can not attach frame!",qz="SIMID:Media:timeupdate",rz="Starting creative",sz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},vz=function(a,b){return new Promise((c,d)=>{new tz(a.j,c,d,b);uz(a,b)})},wz=function(a){const b=sz(a,"SIMID:Player:startCreative",void 0);vz(a,b).then(()=>{var c=a.f;c.g.info(rz);c.m.trigger(new _.F(_.Gf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
+ c)})},yz=function(a,b){_.x(function*(){a.h=b.sessionId;xz(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=sz(a,"SIMID:Player:init",d);var e=vz(a,f)}yield e;a.g.info("Player Init acknowledged");a.f.g.info("SIMID Player initialized")}catch(f){a.g.error("Error while initializing",f),a.f.g.error("Error while initializing SIMID player: ",f),a.unload()}})},xz=function(a,b){uz(a,sz(a,"resolve",{messageId:b.messageId,
4
+ value:void 0}))},uz=function(a,b){a.h?(b.type!==qz&&a.g.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn(`WARNING: no session available to send message '${b.type}'`)},zz=function(a,b,c){return new ResizeObserver(()=>{if(a.a.h){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=sz(d,"SIMID:Player:resize",e);uz(d,e)}})},Az=function(a,b){a.g.info("SIMID Session created");a.a=b},Bz=function(a){a.g.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.h=!1;a.m.trigger(new _.F(_.Hf))},Cz=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}%`}},Dz=class{constructor(a,b){this.f=a;this.w=b;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";a=this.w.style;a.className?this.a.classList.add(a.className):(this.a.style.border=_.De,this.a.style.backgroundColor="transparent",this.a.style.transition=
7
+ "opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.De,this.a.style.overflow=_.$d);this.a.classList.add(_.Zc);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Pf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":yz(this,c);break;case "resolve":c=c.args;var d=this.j.get(c.messageId);d&&d.resolve(c);break;case "reject":c=c.args;(d=this.j.get(c.messageId))&&d.reject(c);
8
+ break;case "SIMID:Creative:requestResize":d=this.f;var e=c.args;d.g.info("Creative requested resize",e);if(d.m&&d.m.getSurface()&&d.m.getSurface().getMedia()&&e.mediaDimensions){d.h?d.m.getSurface().getMedia().style.transition="":(d.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",d.h=!0);const f=Cz(d,e.mediaDimensions);d.m.getSurface().getMedia().style.left=f.left;d.m.getSurface().getMedia().style.top=f.top;d.m.getSurface().getMedia().style.width=f.width;d.m.getSurface().getMedia().style.height=
9
+ f.height}e.creativeDimensions&&(e=Cz(d,e.creativeDimensions),d.a.a.style.left=e.left,d.a.a.style.top=e.top,d.a.a.style.width=e.width,d.a.a.style.height=e.height);xz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.T("clpp.simid.SimidPlayer");Az(this.f,this)}load(a){window.addEventListener(_.se,this.o);this.h="";this.l=0;const b=this.f.url();this.g.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)}unload(){Bz(this.f);
10
+ this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.se,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},tz=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.h=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.h.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);
11
+ this.j(a)}};var Fz=class extends _.Sv{constructor(){super();this.g=new _.T("clpp.simid.Plugin");this.h=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.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new Ez(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length){this.l=b.simid.creatives;this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`);
12
+ var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new Dz(this.h,b.simid),b=c.getContainer(),this.j=zz(this,b,c),this.j.observe(b),a.on(_.ag,this.w)):this.g.warn(pz)}}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&&(wz(this.a),this.o=!0,this.g.info(rz)),
13
+ c&&(c=this.a,uz(c,sz(c,qz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(pz),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.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(_.ag,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Ez=class{constructor(a){this.m=a;this.a=null;this.g=new _.T("clpp.simid.Loader");
14
+ this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.I(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.I(1,10,10100,"No surface");return a}cg(){return this.a}url(){return this.f?this.f.url:""}};_.Mr(new class{create(){return new Fz}});};f.call(g, window);