@castlabs/prestoplay 6.9.0 → 6.11.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 (60) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +112 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +467 -432
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +143 -45
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +78 -73
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -31
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +276 -275
  17. package/cjs/cl.muxdata.js +14 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +71 -71
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +29 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +396 -365
  36. package/cl.crypto.js +9 -9
  37. package/cl.dash.js +68 -67
  38. package/cl.externs.js +139 -45
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +64 -61
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +26 -25
  43. package/cl.ima.js +17 -17
  44. package/cl.mse.js +240 -242
  45. package/cl.muxdata.js +12 -12
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +11 -11
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +59 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -15
  58. package/clpp.styles.css +15 -0
  59. package/package.json +1 -1
  60. package/typings.d.ts +249 -21
package/cl.muxdata.js CHANGED
@@ -1,12 +1,12 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tt=function(a){switch(a.type){case 1:return qt;case 2:return rt;case 3:return st}},vt=function(a){const b=Object.keys(a).find(c=>ut.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},xt=function(a){let b={debug:!0,data:wt(a)};a.g&&a.g.muxOptionsOverride&&_.mf(a.g.muxOptionsOverride)&&(b=_.jf(b,a.g.muxOptionsOverride));b=_.jf(b,{getPlayheadTime:()=>1E3*a.l.getPosition(),getStateData:()=>{{a.f.debug("getStateData()");var c=a.l.getLoadedSource(),d=a.l.getTrackManager();const f=
2
- a.l.getSurface();var e={player_is_paused:a.l.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.l.getDuration(),player_autoplay_on:!!a.l.getConfiguration().autoplay};if(c){const k=new _.Jj(c.url);e.video_source_url=_.zh(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.l.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.l.getTrackManager().ia(),
3
- c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.f.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.na())&&d.language&&(e.player_language_code=d.language)}return e}});a.f.debug("Mux SDK options",b);return b},yt=function(a){_.Mf(a.a);a.j.jd(a.G);a.j.Te(a.F)},zt=function(a,b,c){a.f.debug(`Event: ${b}`);a.B.emit(a.C,b,c)},wt=function(a){const b={env_key:a.g.envKey,video_title:a.o&&a.o.name||"",player_name:_.ma,player_software_name:_.ma,
4
- player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.da};(a=a.l.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},At=function(a){a.a.on(a.l,_.ue,()=>{const b={player_playhead_time:1E3*a.l.getPosition()};zt(a,_.ue,b)});a.a.on(a.l,_.Rd,()=>zt(a,_.Rd));a.a.on(a.l,_.ec,a.H.bind(a));a.a.on(a.l,_.je,a.J.bind(a));a.a.on(a.l,_.Ce,()=>zt(a,_.ee));a.a.on(a.l,_.Be,()=>zt(a,_.de));a.a.on(a.l,_.Yc,a.I.bind(a));a.a.on(a.l,_.ub,()=>zt(a,
5
- "adbreakstart"));a.a.on(a.l,_.vb,()=>zt(a,"adbreakend"));a.a.on(a.l,_.Hb,()=>{zt(a,"adplay");zt(a,"adplaying")});a.a.on(a.l,_.Db,()=>zt(a,"adpause"));a.a.on(a.l,_.Fb,()=>{zt(a,"adplay");zt(a,"adplaying")});a.a.on(a.l,_.Ib,()=>zt(a,"adended"));a.a.on(a.l,_.zb,()=>zt(a,"adfirstquartile"));a.a.on(a.l,_.Cb,()=>zt(a,"admidpoint"));a.a.on(a.l,_.Jb,()=>zt(a,"adthirdquartile"));a.j.Rc(a.G);a.j.me(a.F);a.a.on(a.l,_.Yc,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 _.Jj(b.uris[b.uriIndex]);b={request_start:c,request_type:tt(b),request_hostname:d.a};a.f.debug("onRequestCanceled()","Track event: requestcanceled",b);zt(a,"requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Jj(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:tt(c),request_hostname:f.a,request_error:`${tt(c)}${"LoadError"}`,
7
- request_error_code:e,request_error_text:b.toString()};a.f.debug("onRequestFailed()","Track event: requestfailed",b);zt(a,"requestfailed",b)}}}})},qt="manifest",rt="media",st="encryption",ut=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var Bt=class{constructor(a,b){this.l=a;this.o=this.g=null;this.C=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.jo;this.f=b;this.w=this.m=this.h=this.A=!1;this.B=null;this.j=a.getNetworkEngine();this.G=this.K.bind(this);this.F=this.M.bind(this)}initialize(a,b,c){this.g=a;this.o=b;this.B=c;this.A=!1;if(!this.h){try{this.h=!0,this.B.init(this.C,xt(this))}catch(d){throw this.h=!1,yt(this),new _.H(1,9,9302,null,d);}zt(this,"playerready")}this.m&&!this.w&&(a=wt(this),
8
- zt(this,"videochange",a),this.m=!1);At(this)}release(){this.f.debug("release()");this.m?this.f.debug(_.ha):(yt(this),this.m=!0,this.o=this.g=null)}destroy(){this.f.debug(_.Mc);this.w?this.f.debug(_.fa):(this.w=!0,this.h&&this.A&&zt(this,"viewend"),zt(this,"destroy"))}H(a){this.f.debug(_.Cd);var b=a.detail;a=this.l.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Fa())&&a.bandwidth&&(b+=a.bandwidth),zt(this,"renditionchange",{video_source_bitrate:b}))}J(a){this.f.debug(_.Gd);switch(a.detail.currentState){case _.Fl:this.l.getConfiguration().autoplay&&
9
- zt(this,_.Rd);break;case _.Hl:zt(this,_.Sd);break;case _.Gl:zt(this,_.Ld);break;case _.wl:this.A=!0,zt(this,_.Xc)}}I(a){this.f.debug(_.Dd);if(this.h&&(a=a.detail||null))if(10003===a.code)zt(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)}`;zt(this,_.Yc,{player_error_code:a.code,
10
- 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 _.Jj(b.uris[b.uriIndex]);a={request_start:g,request_type:tt(b),request_hostname:d.a,request_id:vt(e),request_bytes_loaded:f,request_response_start:h,request_response_end:a,request_response_headers:e,
11
- request_media_duration:c,request_url:_.zh(d)};this.f.debug("onRequestCompleted()","Track event: requestcompleted",a);zt(this,"requestcompleted",a)}}}M(a){a.requestStartTimestamp=Date.now()}};var Ct=class extends _.$p{constructor(){super();this.f=null;this.a=!1;this.g=new _.O("clpp.muxdata")}onPlayerCreated(a){this.f=new Bt(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();var d=null;(this.a=!_.C(c.muxdata)&&typeof c.muxdata===_.Bd)?(c=c.muxdata,d=c.muxLib,d="undefined"!==typeof d&&typeof d.init===_.$c&&typeof d.emit===_.$c?c.muxLib:window.mux,"undefined"===d&&(this.g.warn("Mux SDK is not loaded. Will do nothing."),this.a=!1,c=new _.H(1,9,9301),this.U(a,c))):this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");
12
- if(this.a){c=a.getConfiguration();c=_.kf(c.muxdata||{});try{{const e=[];typeof c===_.Bd&&(c.envKey||e.push("envKey"));if(0<e.length)throw new _.H(1,9,9300,{missingKeys:e});}this.f.initialize(c,b,d)}catch(e){this.a=!1,this.U(a,e)}}}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(_.Yc,{detail:b}))}};_.z("clpp.muxdata.MuxDataPlugin",Ct);Ct.Id="mux";_.Hm(new class{create(){return new Ct}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Nu=function(a){switch(a.type){case 1:return Ku;case 2:return Lu;case 3:return Mu}},Pu=function(a){const b=Object.keys(a).find(c=>Ou.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},Ru=function(a){let b={debug:!0,data:Qu(a)};a.f&&a.f.muxOptionsOverride&&_.Kf(a.f.muxOptionsOverride)&&(b=_.Gf(b,a.f.muxOptionsOverride));b=_.Gf(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 _.rk(c.url);e.video_source_url=_.ai(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},Su=function(a){_.jg(a.a);a.j.qd(a.B);a.j.bf(a.F)},Tu=function(a,b,c){a.h.debug(`Event: ${b}`);a.A.emit(a.C,b,c)},Qu=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.na,player_software_name:_.na,
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},Uu=function(a){a.a.on(a.m,_.Se,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};Tu(a,_.Se,b)});a.a.on(a.m,_.ee,()=>Tu(a,_.ee));a.a.on(a.m,_.mc,a.G.bind(a));a.a.on(a.m,_.Ge,a.I.bind(a));a.a.on(a.m,_.af,()=>Tu(a,_.Be));a.a.on(a.m,_.$e,()=>Tu(a,_.Ae));a.a.on(a.m,_.ld,a.H.bind(a));a.a.on(a.m,_.Cb,()=>Tu(a,
5
+ "adbreakstart"));a.a.on(a.m,_.Db,()=>Tu(a,"adbreakend"));a.a.on(a.m,_.Pb,()=>{Tu(a,"adplay");Tu(a,"adplaying")});a.a.on(a.m,_.Lb,()=>Tu(a,"adpause"));a.a.on(a.m,_.Nb,()=>{Tu(a,"adplay");Tu(a,"adplaying")});a.a.on(a.m,_.Qb,()=>Tu(a,"adended"));a.a.on(a.m,_.Hb,()=>Tu(a,"adfirstquartile"));a.a.on(a.m,_.Kb,()=>Tu(a,"admidpoint"));a.a.on(a.m,_.Rb,()=>Tu(a,"adthirdquartile"));a.j.zc(a.B);a.j.te(a.F);a.a.on(a.m,_.ld,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 _.rk(b.uris[b.uriIndex]);b={request_start:c,request_type:Nu(b),request_hostname:d.a};a.h.debug("onRequestCanceled()","Track event: requestcanceled",b);Tu(a,"requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.rk(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:Nu(c),request_hostname:f.a,request_error:`${Nu(c)}${"LoadError"}`,
7
+ request_error_code:e,request_error_text:b.toString()};a.h.debug("onRequestFailed()","Track event: requestfailed",b);Tu(a,"requestfailed",b)}}}})},Vu=function(a){return!_.B(a)&&typeof a.init===_.od&&typeof a.emit===_.od},Ku="manifest",Lu="media",Mu="encryption",Ou=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var Wu=class{constructor(a,b){this.m=a;this.o=this.f=null;this.C=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.vp;this.h=b;this.w=this.l=this.g=!1;this.A=null;this.j=a.getNetworkEngine();this.B=this.J.bind(this);this.F=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.C,Ru(this))}catch(d){throw this.g=!1,Su(this),new _.H(1,9,9302,null,d);}Tu(this,"playerready")}this.l&&!this.w&&(a=Qu(this),Tu(this,"videochange",
8
+ a),this.l=!1);Uu(this)}release(){this.h.debug("release()");this.l?this.h.debug(_.ha):(Su(this),this.l=!0,this.o=this.f=null)}destroy(){this.h.debug(_.Wc);this.w?this.h.debug(_.fa):(this.w=!0,Tu(this,"destroy"))}G(a){this.h.debug(_.Pd);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ha())&&a.bandwidth&&(b+=a.bandwidth),Tu(this,"renditionchange",{video_source_bitrate:b}))}I(a){this.h.debug(_.Td);switch(a.detail.currentState){case _.Bm:this.m.getConfiguration().autoplay&&
9
+ Tu(this,_.ee);break;case _.Dm:Tu(this,_.le);break;case _.Cm:Tu(this,_.ae);break;case _.sm:Tu(this,_.kd)}}H(a){this.h.debug(_.Qd);if(this.g&&(a=a.detail||null))if(10003===a.code)Tu(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)}`;Tu(this,_.ld,{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 _.rk(b.uris[b.uriIndex]);a={request_start:g,request_type:Nu(b),request_hostname:d.a,request_id:Pu(e),request_bytes_loaded:f,request_response_start:h,request_response_end:a,request_response_headers:e,
11
+ request_media_duration:c,request_url:_.ai(d)};this.h.debug("onRequestCompleted()","Track event: requestcompleted",a);Tu(this,"requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var Xu=class extends _.rr{constructor(){super();this.f=null;this.a=!1;this.h=new _.R("clpp.muxdata")}onPlayerCreated(a){this.f=new Wu(a,this.h)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Hf(c.muxdata);try{var d=[];typeof c===_.Od&&(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===_.Od){const g=f.muxdata;d=Vu(g.muxLib)?g.muxLib:window.mux;if(!Vu(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(_.ld,{detail:b}))}};_.z("clpp.muxdata.MuxDataPlugin",Xu);Xu.Id="mux";_.En(new class{create(){return new Xu}});};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 pt=function(a,b){let c=b.baseUrl;_.Mg(c,"/")||(c+="/");const d=g=>g&&(_.Lg(g,"https://")||_.Lg(g,"http://")||_.Lg(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Xo(a);a.Ja(_.Ic,{licenseUrl:e,videoRobustness:[_.db,void 0],audioRobustness:[_.cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Xj,licenseResponse:_.Yj}});a.Ja(_.Gc,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.ak,licenseResponse:_.bk,extractContentId:_.ck,certificateRequest:_.dk}});a.Ja(_.Hc,{licenseUrl:f,modifiers:{licenseRequest:_.Xj}});_.mj(a)};
3
- _.z("clpp.onboard.OnboardComponent",class extends _.zp{constructor(){super();this.l=null;this.h=new _.O("clpp.onboard")}f(a){this.l=a}a(){this.l=null}g(){var a=this.l.getConfiguration().drm,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}'`),pt(b,a))}release(){}id(){return"onboard"}});
4
- _.z("clpp.onboard.register",pt);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ju=function(a,b){let c=b.baseUrl;_.oh(c,"/")||(c+="/");const d=g=>g&&(_.nh(g,"https://")||_.nh(g,"http://")||_.nh(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.iq(a);a.La(_.Sc,{licenseUrl:e,videoRobustness:[_.jb,void 0],audioRobustness:[_.ib,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Gk,licenseResponse:_.Hk}});a.La(_.Pc,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.Jk,licenseResponse:_.Kk,extractContentId:_.Lk,certificateRequest:_.Mk}});a.La(_.Qc,{licenseUrl:f,modifiers:{licenseRequest:_.Gk}});_.Vj(a)};
3
+ _.z("clpp.onboard.OnboardComponent",class extends _.Pq{constructor(){super();this.h=new _.R("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Uj[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}'`),Ju(b,a),this.j.add(b))}id(){return"onboard"}});
4
+ _.z("clpp.onboard.register",Ju);};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 at="A persistent DRM session already exists for: ",bt="No DRM configuration.",ct="clpp.persistent",dt=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},ft=function(a,b){a.H=et;a.I=[];a.C=!0;return _.Gk(a,b)},ht=function(a,b,c,d,e,f){a.H=gt;const g=new Map,h=_.uk(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Id,persistentState:_.ae,sessionTypes:[_.Nd],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
- audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Fk(a,g)},it=function(a,b){return _.y(function*(){const c=yield _.Zk(a,b);if(c){var d=[],e=a.g.get(c);e&&a.A&&(e.mb=new _.Mk,d.push(e.mb));a.a.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.a.debug("Ignoring attempt to remove missing session",b)})},jt=function(a){a=a.g.keys();a=dt(a,b=>b.sessionId);return Array.from(a)},kt=function(a,b){const c=_.oj(a),d=_.bj({drm:a});
3
- d.drm=a;a=new _.Ql({xb:b,onError:()=>{},Ud:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,sc:()=>null});a.h=c;return a},nt=function(a,b,c){return _.y(function*(){const d=lt;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)mt.debug(at,e);else{var g=kt(a,c);try{yield ft(g,b);yield _.Xk(g);yield _.$k(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Uh(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:jt(g),keySystem:h.keySystem,
4
- licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw mt.error("Error while persisting DRM session"),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else mt.debug(bt)})},et=1,gt=2,ot=class{store(a,b){return _.y(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
5
- 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){return _.y(function*(){var b=window.localStorage.getItem(encodeURIComponent(a));if(b){{b=JSON.parse(atob(b));const c=JSON.parse(b.sessionIds),d=JSON.parse(b.audioCapabilities),e=JSON.parse(b.videoCapabilities),
6
- f=JSON.parse(b.serverCertificate),g=JSON.parse(b.drmConfig);b={sessionIds:c,keySystem:b.keySystem,licenseServerUri:decodeURIComponent(b.licenseServerUri),serverCertificate:f?new Uint8Array(f):null,audioCapabilities:d,videoCapabilities:e,drmConfig:g}}}else b=null;return b})}delete(a){return _.y(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.y(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.C(a)||(_.nf(a.store)||c.push("store"),_.nf(a.get)||c.push("get"),_.nf(a.delete)||c.push("delete"),_.nf(a.clear)||c.push("clear"),_.nf(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw mt.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});lt=a});
7
- _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.y(function*(){var d=lt,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Kl(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(bt);var g=b.offlineId;if(typeof g!==_.me||!g.length)throw e("Missing offline id.");if(yield d.get(g))mt.debug(at,g);else{var h=_.bj();d=new _.Em;g=[];for(var k of c){const l=new k;_.ej(l.id())||(l.f(null),_.gj(l),g.push(l))}k=null;try{k=yield _.wn(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=_.un(l.periods);yield nt(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(),_.dj.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 _.y(function*(){var b=lt;if(_.pf(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Em,c=kt(e.drmConfig,d),yield ht(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Xk(c),yield Promise.all(e.sessionIds.map(f=>_.y(function*(){yield it(c,f);mt.debug("successfully removed session with id",f)}))),yield b.delete(a)):mt.debug("No persistent DRM session found")}catch(e){throw mt.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 mt.warn("Invalid offlineId")})});var lt=new ot,mt=new _.O(ct);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.zp{constructor(){super();this.l=null;this.j=lt;this.h=new _.O(ct)}f(a){this.l=a}a(){this.l=null}release(){}g(){this.j=lt}id(){return _.Md}o(a,b,c){const d=this;return _.y(function*(){if(a)try{yield nt(a,b,c),d.l.trigger(new _.F(_.Rc,{offlineId:a.offlineId}))}catch(e){d.l.onError(e)}else d.h.debug("No DRM configuration found for loaded source.")})}m(a){const b=this;return _.y(function*(){try{const c=yield b.j.get(a);if(c)return c.sessionIds;
11
- b.h.debug(`No offline session found for ${a}`);return[]}catch(c){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 tu="A persistent DRM session already exists for: ",uu="No DRM configuration.",vu="clpp.persistent",wu="clpp.persistent.SimpleSessionStorage",xu=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},zu=function(a,b){a.H=yu;a.I=[];a.C=!0;return _.Gl(a,b)},Bu=function(a,b,c,d,e,f){a.H=Au;const g=new Map,h=_.rl(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Yd,persistentState:_.xe,sessionTypes:[_.ce],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,
2
+ distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Fl(a,g)},Cu=function(a,b){return _.x(function*(){const c=yield _.Wl(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.mb=new _.Jl,d.push(e.mb));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)})},Du=function(a){a=a.f.keys();a=xu(a,b=>b.sessionId);return Array.from(a)},
3
+ Eu=function(a,b){const c=_.Xj(a),d=_.Dj({drm:a});d.drm=a;a=new _.Mm({xb:b,onError:()=>{},ae:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,qc:()=>null});a.g=c;return a},Hu=function(a,b,c){return _.x(function*(){const d=Fu;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Gu.debug(tu,e);else{var g=Eu(a,c);try{yield zu(g,b);yield _.Ul(g);yield _.Xl(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.vi(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));
4
+ f={sessionIds:Du(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Gu.error(`Error while persisting DRM session ${e}`),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Gu.debug(uu)})},yu=1,Au=2,Iu=class{constructor(){this.h=new _.R(wu)}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 wu}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.Lf(a.store)||c.push("store"),_.Lf(a.get)||c.push("get"),_.Lf(a.delete)||c.push("delete"),_.Lf(a.clear)||c.push("clear"),_.Lf(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Gu.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});Fu=a});
7
+ _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=Fu,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Gm(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(uu);var g=b.offlineId;if(typeof g!==_.Je||!g.length)throw e("Missing offline id.");if(yield d.get(g))Gu.debug(tu,g);else{var h=_.Dj();d=new _.Bn;g=[];for(var k of c){const l=new k;_.Gj(l.id())||(l.f(),_.Ij(l),g.push(l))}k=null;try{k=yield _.Io(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=_.Go(l.periods);yield Hu(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(),_.Fj.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=Fu;if(_.Rf(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Bn,c=Eu(e.drmConfig,d),yield Bu(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Ul(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield Cu(c,f);Gu.debug("successfully removed session with id",f)}))),yield b.delete(a)):Gu.debug("No persistent DRM session found")}catch(e){throw Gu.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 Gu.warn("Invalid offlineId")})});var Fu=new Iu,Gu=new _.R(vu);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Pq{constructor(){super();this.h=new _.R(vu)}id(){return _.be}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 Hu(d,b,e),a.trigger(new _.F(_.ed,{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=Fu;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 Ys=function(a,b){return 0<=b&&b<a.a.length},Zs=function(a){a.trigger(new _.F(_.Ud))},$s=class extends _.So{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.l=a;this.j=b;this.f=0;this.a=[];this.g=!1;this.h=this.Ke.bind(this)}getPosition(){return this.f}Lf(){return this.a}zd(){return 0<this.a.length&&Ys(this,this.f)?this.a[this.f]:null}Mf(){const a=this.f+1;return 0<
2
- this.a.length&&Ys(this,a)?this.a[a]:null}Sf(){return this.g}start(){this.g||(this.g=!0,this.l.on(_.Xc,this.h),this.bd(this.f,!0))}stop(){this.g=!1;this.l.off(_.Xc,this.h)}Ke(){this.next()}next(){const a=this;return _.y(function*(){yield a.bd(Math.min(a.a.length-1,a.f+1))})}dg(){const a=this;return _.y(function*(){yield a.bd(Math.max(0,a.f-1))})}bd(a,b){b=void 0===b?!1:b;const c=this;return _.y(function*(){if(0<c.a.length&&Ys(c,a)&&(b||c.f!==a)){c.f=a;var d=c.zd();d&&(yield c.j(d),yield c.l.load(d.configuration),
3
- c.trigger(new _.F(_.Td,{item:d})))}})}append(a){this.a.push(a);Zs(this)}Rf(a,b){if(0<=b&&b<=this.a.length){const c=this.zd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Zs(this)}}remove(a){if(0<this.a.length&&Ys(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Zs(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;Zs(this)}};_.z("clpp.Playlist",$s);$s.prototype.clear=$s.prototype.clear;$s.prototype.remove=$s.prototype.remove;$s.prototype.insert=$s.prototype.Rf;
4
- $s.prototype.append=$s.prototype.append;$s.prototype.goTo=$s.prototype.bd;$s.prototype.previous=$s.prototype.dg;$s.prototype.next=$s.prototype.next;$s.prototype.onEnded=$s.prototype.Ke;$s.prototype.stop=$s.prototype.stop;$s.prototype.start=$s.prototype.start;$s.prototype.isStarted=$s.prototype.Sf;$s.prototype.getUpcoming=$s.prototype.Mf;$s.prototype.getCurrent=$s.prototype.zd;$s.prototype.getQueue=$s.prototype.Lf;$s.prototype.getPosition=$s.prototype.getPosition;$s.prototype.off=$s.prototype.off;
5
- $s.prototype.one=$s.prototype.one;$s.prototype.on=$s.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var qu=function(a,b){return 0<=b&&b<a.a.length},ru=function(a){a.trigger(new _.F(_.ne))},su=class extends _.dq{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.Ve.bind(this)}getPosition(){return this.f}bg(){return this.a}Gc(){return 0<this.a.length&&qu(this,this.f)?this.a[this.f]:null}cg(){const a=this.f+1;return 0<
2
+ this.a.length&&qu(this,a)?this.a[a]:null}ig(){return this.g}start(){this.g||(this.g=!0,this.m.on(_.kd,this.j),this.gd(this.f,!0))}stop(){this.g=!1;this.m.off(_.kd,this.j)}Ve(){this.next()}next(){const a=this;return _.x(function*(){yield a.gd(Math.min(a.a.length-1,a.f+1))})}xg(){const a=this;return _.x(function*(){yield a.gd(Math.max(0,a.f-1))})}gd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&qu(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Gc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
+ c.trigger(new _.F(_.me,{item:d})))}})}append(a){this.a.push(a);ru(this)}hg(a,b){if(0<=b&&b<=this.a.length){const c=this.Gc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));ru(this)}}remove(a){if(0<this.a.length&&qu(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);ru(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;ru(this)}};_.z("clpp.Playlist",su);su.prototype.clear=su.prototype.clear;su.prototype.remove=su.prototype.remove;su.prototype.insert=su.prototype.hg;
4
+ su.prototype.append=su.prototype.append;su.prototype.goTo=su.prototype.gd;su.prototype.previous=su.prototype.xg;su.prototype.next=su.prototype.next;su.prototype.onEnded=su.prototype.Ve;su.prototype.stop=su.prototype.stop;su.prototype.start=su.prototype.start;su.prototype.isStarted=su.prototype.ig;su.prototype.getUpcoming=su.prototype.cg;su.prototype.getCurrent=su.prototype.Gc;su.prototype.getQueue=su.prototype.bg;su.prototype.getPosition=su.prototype.getPosition;su.prototype.off=su.prototype.off;
5
+ su.prototype.one=su.prototype.one;su.prototype.on=su.prototype.on;};f.call(g, window);
package/cl.smooth.js CHANGED
@@ -1,58 +1,59 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var KG="Full MP4 box must have flags defined",LG="clpp.smooth.SmoothMP4Processor",MG="codecPrivateData",NG=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.M(a,c);_.M(a,b)},OG=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.sj()}},PG=function(a,b){OG(a,b>>16&255);OG(a,b>>8&255);OG(a,b&255)},QG=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.sj()}},RG=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.sj()}},SG=function(a,b){try{a.f.setInt16(a.a,
2
- b,a.g),a.a+=2}catch(c){_.sj()}},TG=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},UG=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},VG=function(a,b,c,d){c=b.ze[c];b=b.sg;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 _.tu([a],[b])[0]},WG=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",MG,"fourCC"]:a.type===_.p&&(c=["bitrate",MG,"channels","bitsPerSample","samplingRate","fourCC"]);return _.rf(a,b,c,["id","segmentIndex"])},XG=function(a,b,c){const d=c.Wc.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ka:null,Mb:null,width:NaN,height:NaN,Fb:null,Nc:NaN,
4
- sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.Ka=[_.Vg(d[1])];a.Mb=[_.Vg(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Fb=_.Vg(c.Wc),a.sampleSize=c.nf||16,a.Nc=c.Nc,a.channelCount=c.te}return a},YG=function(a,b){return a.filter(c=>c.type===b)},ZG=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)},fH=function(a,b,c){var d=null;if($G.test(a)){{a=$G.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 aH.test(a)?d=ZG(aH,a):bH.test(a)?d=ZG(bH,a):cH.test(a)?(a=cH.exec(a),d=Number(a[1])/c.frameRate):dH.test(a)?(a=dH.exec(a),d=Number(a[1])/c.a):eH.test(a)&&(d=ZG(eH,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},gH=function(a){let b=
6
- 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Nj(b)},nH=function(a,b,c){a:{var d=[_.Ic,_.Hc];for(e of d)if((d=c.Zc(e))&&d.keyId){var e=d.keyId;break a}_.D(LG,"Could not get default Key ID for DRM init data!");e=null}c=new hH("xxxx");a.type===_.w?c=new iH(a.width,a.height):c=new jH(a.channelCount,a.sampleSize,a.Nc);a=new kH;a.g=1;a.h=8;a.m=e||"00000000000000000000000000000000";a=(new hH("schi")).append([a]);b=(new hH(_.ge)).append([new lH(b),new mH(_.rc,65536),a]);c.append([b]);return c},
7
- QH=function(a,b){var c=b.dd(),d=new oH(a.timescale,a.duration,a.id),e=(new pH).append([new qH(a.id)]),f=new rH(a.id,a.duration,a.timescale,a.width,a.height),g=new sH(a.timescale,a.duration);const h=new tH(a.type);var k=null,l=new uH;l.entries=[new vH];var m=new wH;switch(a.type){case _.w:k=new xH(a.Ka,a.Mb);c?(a=nH(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new yH(a.width,a.height)).append([k]),m.entries=[a]);k=new zH;break;case _.p:k=new AH(a.Fb),c?(a=nH(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
- (a=(new BH(a.channelCount,a.sampleSize,a.Nc)).append([k]),m.entries=[a]),k=new CH}m=(new DH).append([m,new EH,new FH,new GH,new HH]);l=(new IH).append([l]);l=(new JH).append([k,l,m]);g=(new KH).append([g,h,l]);f=(new LH).append([f,g]);d=(new MH).append([d,f,e]);e=new NH("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Zc(_.Hc),b=b.Zc(_.Ic),c&&d.append([new OH("pssh",c.initData,8)]),b&&d.append([new OH("pssh",b.initData,8)]),c||b||_.D(LG,"Could not get PSSH init data!"));b=new PH([e,d]);return _.I(b.write())},
9
- $H=function(a,b){let c,d,e,f,g,h;(new _.Lj).L("moof",_.Ej).Z("mfhd",k=>{{const l=new RH;l.g=_.N(k.reader);c=l}}).L("traf",_.Ej).Z("tfhd",k=>{{const l=k.reader.Ba();if(null===k.flags)throw new _.H(_.G,3,3019,KG);const m=new SH(k.version||0,k.flags||0);m.g=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.Aj(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.j=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.N(k.reader));
10
- 0<l-k.reader.getPosition()&&k.flags&32&&(m.m=_.N(k.reader));d=m}}).Z("trun",k=>{{var l=k.reader.Ba();if(null===k.flags)throw new _.H(_.G,3,3019,KG);const m=new TH(k.version||0,k.flags||0);m.g=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.yj(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.m=_.N(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.o.push(_.N(k.reader)),k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&
11
- 2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.yj(k.reader)));e=m}}).Z("sdtp",k=>{{const l=_.Bj(k.reader,k.reader.Ba());f=new UH("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.Bj(k.reader,16);if(_.Zg(l,VH)){l=_.N(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new WH(k.version,k.flags);l.h=_.N(k.reader);k.flags&1&&(l.j=_.wj(k.reader));for(let m=0;m<l.h;m++){const n={De:_.Bj(k.reader,8),zc:0,de:[]};if(k.flags&2){n.zc=_.xj(k.reader);for(let q=0;q<n.zc;q++){const t={re:0,se:0};
12
- t.re=_.xj(k.reader);t.se=_.N(k.reader);n.de.push(t)}}l.g.push(n)}g=l}}).L(_.qd,k=>{{const l=new XH;0<k.reader.Ba()?l.g=_.Bj(k.reader,k.reader.Ba()):(_.D(LG,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new YH).append([d,e]);f&&a.append([f]);b.dd()&&g&&a.append([g]);b=(new ZH).append([c,a]);return new PH([b,h])},eI=function(a,b,c,d){var e=d.dd(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=$H(b,d);if(null===g)return a.request.contentType===_.v?a.data:
13
- g;d=g.get(_.qd);if(a.request.contentType===_.v){e=d.g.buffer;if(c){e=_.Hg(e);if((e=(new DOMParser).parseFromString(e,_.te))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new aI(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,u=f.length;t<u;t++){h=f[t];a=c;b=d;g=["begin",_.Wc];for(let x=0,A=g.length;x<
14
- A;x++){b:{var k=h;var l=g[x],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const E=l.length;for(;n<E;n++){var q=l[n].name;if(q=q.match(m)){k=k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[x],fH(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.Ig(e).buffer}else c=e;return c}h=new ZH;a=g.get("mfhd");b=new YH;k=g.get("tfhd");m=new bI(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.h;m++)k.push(10+6*c.g[m].zc);else g=8;b.append([c,new cI,new dI(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new PH([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},fI=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
- periodId:null}},gI=function(a){return{initData:_.mu(_.pk(a)),initDataType:_.rc,keyId:a,periodId:null}},hI=function(a,b,c){a=_.Wu(a);c&&a.version!==c&&(a=_.Tu(a,c));return{initData:_.mu(a),initDataType:_.rc,keyId:b,periodId:null}},iI=function(a,b){return _.y(function*(){var c=_.jh(b);c.timeout=a.g.attemptParameters.timeout;c.maxAttempts=Math.max(a.g.attemptParameters.maxAttempts,b.length);c.baseDelay=a.g.attemptParameters.baseDelay;c.backoffFactor=a.g.attemptParameters.backoffFactor;c.fuzzFactor=a.g.attemptParameters.fuzzFactor;
17
- c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.m=c.uri;return c})},qI=function(a,b){let c=null;try{{const ya=new DOMParser;let hb,Na;try{const ab=_.Hg(b);Na=ya.parseFromString(ab.trim(),_.te)}catch(ab){throw ab;}Na&&Na.documentElement.tagName==_.ib&&(hb=Na.documentElement);c=hb&&0<hb.getElementsByTagName("parsererror").length?null:hb}}catch(ya){}if(!c)throw a.a.error("Unable to parse manifest"),new _.H(_.G,4,4033,a.m);const d=+jI(a,c,"MajorVersion"),e=+jI(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
- 1E7;let g=+jI(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.Lu(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.a.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.G,4,4036,a.m);h?(kI(a,lI),a.A=typeof a.g.liveRefreshPeriod===_.r?1E3*a.g.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):kI(a,mI);a.f={startTime:0,delay:0,duration:g/f,vd:l/f,Ic:0};if(m){{var n=a.g.playreadyVersion;
19
- const ya=[],hb=_.Lu(m,"ProtectionHeader")[0],Na=_.Ug(_.Nu(hb)||""),ab=_.Wu(Na).a;ya.push(fI(_.Ic,gI(ab),[ab]));ya.push(fI(_.Hc,hI(Na,ab,n),[ab]));var q=ya}a.o=q}{const ya=[],hb=_.Lu(c,"StreamIndex");if(!hb.length)throw a.a.error("No streams found!"),new _.H(_.G,4,4034,a.m);for(let Na=0;Na<hb.length;Na++){{var t=a,u=hb[Na];const ab=jI(t,u,"Type"),jc=+u.getAttribute("Chunks"),Wg=u.getAttribute("Subtype"),Ie=_.rg(u.getAttribute("Language")||_.xe),Pd=u.getAttribute("Name")||"",Xg=+u.getAttribute(_.La),
20
- Cf=+u.getAttribute(_.Ka),Df=jI(t,u,"Url"),Jk=+u.getAttribute("TimeScale")||null;{const kc=[],ui=_.Lu(u,_.Xa);for(let Qd=0;Qd<ui.length;Qd++){{let lc,Ja,id;var x=t,A=ui[Qd],E=ab;const vi=+A.getAttribute("Index"),Ef=+jI(x,A,"Bitrate");let Pb=NaN,Ff=NaN,Kk=NaN,Kp=NaN,vz=NaN,wz=NaN,xz=NaN;const yz=A.getAttribute("FourCC");switch(E){case _.w:Pb=+jI(x,A,_.Ka);Ff=+jI(x,A,_.La);break;case _.p:Kp=+A.getAttribute("Channels")||2,Kk=+jI(x,A,"SamplingRate"),wz=+jI(x,A,"AudioTag"),vz=+jI(x,A,"BitsPerSample"),xz=
21
- +jI(x,A,"PacketSize")}let Lp=String(A.getAttribute("CodecPrivateData"));if(E===_.p&&!Lp){{var B=Kp;const zz={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},Lk=zz[Kk];if("AACH"===yz){Ja=new Uint8Array(4);const Az=zz[2*Kk];Ja[0]=40|Lk>>1;Ja[1]=Lk<<7|B<<3|Az>>1;Ja[2]=Az<<7|8;Ja[3]=0;lc=new Uint16Array(2);lc[0]=(Ja[0]<<8)+Ja[1];lc[1]=(Ja[2]<<8)+Ja[3];id=lc[0].toString(16)+lc[1].toString(16)}else Ja=new Uint8Array(2),Ja[0]=16|Lk>>1,Ja[1]=Lk<<7|B<<3,lc=
22
- new Uint16Array(1),lc[0]=(Ja[0]<<8)+Ja[1],id=lc[0].toString(16);Lp=id.toUpperCase()}}var T={id:x.W++,type:E,index:vi,bitrate:Ef,Wc:Lp,maxHeight:Pb,maxWidth:Ff,Nc:Kk,te:Kp,Bg:wz,nf:vz,Mg:xz,Ef:yz,segmentIndex:null}}kc.push(T)}var Ha=kc}{const kc=[],ui=_.Lu(u,"c");for(let Qd=0;Qd<ui.length;Qd++){const lc=ui[Qd];let Ja=parseInt(lc.getAttribute("t"),10),id=parseInt(lc.getAttribute("d"),10),vi=parseInt(lc.getAttribute("r"),10),Ef=0;if(isNaN(Ja)&&isNaN(id))throw t.a.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
- new _.H(_.G,4,4037,t.m);0===Qd&&isNaN(Ja)&&(Ef=Ja=0);if(0<Qd){const Pb=kc[kc.length-1];Ef=Pb.n+1;Pb.d||(Pb.d=Ja-Pb.t);Ja||(Ja=Pb.t+Pb.d);id||(id=Ja-Pb.t)}kc.push({n:Ef,d:id,t:Ja});if(vi){vi--;for(let Pb=0;Pb<vi;Pb++){const Ff=kc[kc.length-1];Ef=Ff.n+1;Ja=Ff.t+Ff.d;id=Ff.d;kc.push({n:Ef,d:id,t:Ja})}}}t.C()||kc.length===jc||t.a.warn("Number of fragments ("+jc+") differs from number of chunks ("+kc.length+").");var Nb=kc}var gd={type:ab,Eg:jc,mg:Wg,language:Ie,name:Pd,maxWidth:Xg,maxHeight:Cf,sg:Df,
24
- tracks:Ha,ze:Nb,timescale:Jk}}ya.push(gd)}var gc=ya}const sa={Lg:d,Ge:e,timescale:f,duration:g,isLive:h,Kg:k,vd:l,Gd:!1,streams:gc};if(a.h&&a.w)return nI(a,sa),Promise.resolve();a.G.clear();{const ya=sa.timescale,hb=sa.duration,Na=YG(sa.streams,_.p),ab=YG(sa.streams,_.w),jc=YG(sa.streams,_.v),Wg=[];let Ie=oI(a,hb,ya,Na),Pd=oI(a,hb,ya,ab);const Xg=oI(a,hb,ya,jc);Ie.length||(Ie=[null]);Pd.length||(Pd=[null]);for(let Cf=0;Cf<Pd.length;Cf++)for(let Df=0;Df<Ie.length;Df++)Wg.push(pI(a,Pd[Cf],Ie[Df]));
25
- var Ge={startTime:0,variants:Wg,textStreams:Xg,thumbStreams:[]}}{var jd=sa.streams;let ya=a.f.startTime,hb=a.f.delay;const Na=a.I;let ab=Math.min(a.f.duration||Infinity,Na);const jc=a.C(),Wg=a.f.vd,Ie=a.f.Ic,Pd=a.H,Xg=isFinite(a.F)?a.F:0;if(jc)ab=Infinity,ya=Date.now()/1E3-Ie,a.f.startTime=ya,hb=3*Pd;else{const Cf=isFinite(Na)?Na:a.f.duration;for(const Df of jd)for(const Jk of Df.tracks)Jk.segmentIndex.offset(-Xg),_.ev(Jk.segmentIndex,Cf)}a.B=new _.Vz(ya,hb,!jc,!0);a.B.f=ab;_.nv(a.B,Pd);a.B.j=Wg;
26
- jc||a.B.offset(-Xg)}a.D.filterAllPeriods([Ge]);a.h={presentationTimeline:a.B,periods:[Ge],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.Rc(a.M),a.K=!0);a.w=sa;return Promise.resolve()},rI=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.yb.bind(a),b))},jI=function(a,b,c){if(b=b.getAttribute(c))return b;a.a.error("required attribute not provided: "+c);throw new _.H(_.G,4,4038,a.m,c);},kI=function(a,b){const c=b===mI;a.h&&a.h.presentationTimeline&&_.jv(a.h.presentationTimeline,
27
- c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.R=b},nI=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){WG(g,c)||a.a.warn("The current stream is updated with a stream that seems to have different base properties!");var d=sI(a,a.w.timescale,f,c);c=g.segmentIndex;_.xv(c,d);(d=a.f.vd)&&_.yv(c,_.vv(c)-d).forEach(h=>{h.Ha().forEach(k=>{a.G.delete(k)})})}else a.a.warn(`Cannot find satisfying update for ${g.type} `+
28
- `track with bitrate ${g.bitrate}. Skipping update.`)}}},sI=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.ze.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=VG(a.m,c,k,d);a.H=Math.max(a.H,l);f.push(new _.wv(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.f.Ic?a.f.Ic=b.endTime:a.f.Ic=Math.min(a.f.Ic,b.endTime);return f},oI=function(a,b,c,d){let e=[];for(let f=0;f<
29
- d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=sI(a,c,k,h);const T=new _.Wz(l);var m=null;k.type!==_.v&&(m=tI(a,b,c,k,h));h.segmentIndex=T;l=a.N++;var n=Promise.resolve.bind(Promise),q=T.f.bind(T),t=T.get.bind(T),u=T.g.bind(T),x=T.getDuration.bind(T),A=uI[k.type];var E="";switch(k.type){case _.w:E=h.Wc;var B=/00000001[0-9]7/.exec(E);E="avc1."+(B&&B[0]?E.substr(E.indexOf(B[0])+10,6):"42c00c");a.a.debug("VIDEO CODECS: ",E);break;case _.p:E=h.Wc,B=2,"AACH"===h.Ef?B=5:E&&(B=(parseInt(E.substr(0,
30
- 2),16)&248)>>3),E="mp4a.40."+B,a.a.debug("AUDIO CODECS: ",E)}B=k.type===_.v?vI[k.mg]:void 0;h={id:l,originalId:null,Og:null,createSegmentIndex:n,findSegmentPosition:q,getSegmentReference:t,adjustSegmentDurations:u,getDuration:x,segmentIndex:T,segmentLookupStrategy:_.Xt,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:B,encrypted:a.J(),keyId:null,language:k.language,label:k.name,type:k.type,primary:!1,trickModeVideo:null,
31
- emsgSchemeIdUris:null,roles:[],channelsCount:h.te||null,closedCaptions:null}}return h});e=e.concat(g)}return e},pI=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.xe;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},tI=function(a,b,c,d,e){b=XG(b,d.timescale||c,e);c={isLive:a.C.bind(a),dd:a.J.bind(a),Jf:()=>1,Zc:a.T.bind(a)};d=new Uint8Array(0);try{d=QH(b,c)}catch(g){throw a.a.error("Failed to generate initialization segment."),
32
- new _.H(_.G,3,4035,g);}const f="data:text/plain;base64,"+_.Tg(d);return new _.Sz(()=>[f],0,null,null,!0)},hH=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!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===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;
33
- 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?_.M(a,1):_.M(a,this.size);_.tj(a,TG(this.type));this.size>b&&NG(a,this.size);"uuid"===this.type&&_.tj(a,null);if(0<this.f.length&&!this.w)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()}},wI=class extends hH{constructor(a,b,c){super(a);
34
- this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);OG(a,this.version);PG(a,this.flags)}},OH=class extends hH{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);_.tj(a,this.g,this.offset);a.getPosition()}},UH=class extends wI{constructor(a,b,c,d,e){super(a,b,c);this.g=d;this.offset=e}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.tj(a,this.g,this.offset);a.getPosition()}},
35
- NH=class extends hH{constructor(a,b,c){super("ftyp");this.h=a;this.Ge=b;this.g=c}a(){let a=this.h.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.tj(a,TG(this.h));_.M(a,this.Ge);_.tj(a,TG(this.g.join("")));a.getPosition()}},MH=class extends hH{constructor(){super(_.wd)}},LH=class extends hH{constructor(){super(_.ve)}},oH=class extends wI{constructor(a,b,c){super("mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,
36
- 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?(NG(a,0),NG(a,0),_.M(a,this.timescale),NG(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));_.M(a,65536);QG(a,this.volume);QG(a,0);_.M(a,0);_.M(a,0);for(let b=0;b<this.g.length;b++)OG(a,this.g[b]);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,this.h);a.getPosition()}},
37
- pH=class extends hH{constructor(){super("mvex")}},qH=class extends wI{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.M(a,this.g);_.M(a,1);_.M(a,0);_.M(a,0);_.M(a,0);a.getPosition()}},rH=class extends wI{constructor(a,b,c,d,e){super("tkhd",1,7);this.h=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,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+
38
- this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(NG(a,0),NG(a,0),_.M(a,this.h),_.M(a,0),NG(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.h),_.M(a,0),_.M(a,this.duration*this.timescale));_.M(a,0);_.M(a,0);QG(a,0);QG(a,0);QG(a,this.volume);QG(a,0);for(let b=0;b<this.g.length;b++)OG(a,this.g[b]);QG(a,this.width);QG(a,0);QG(a,this.height);QG(a,0);a.getPosition()}},sH=class extends wI{constructor(a,b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=
39
- 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?(NG(a,0),NG(a,0),_.M(a,this.timescale),NG(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));QG(a,this.language);QG(a,0);a.getPosition()}},tH=class extends wI{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.M(a,0);this.g===_.w?_.tj(a,TG("vide")):_.tj(a,TG("soun"));_.M(a,0);_.M(a,0);_.M(a,
40
- 0);this.g===_.w?_.tj(a,TG("VideoHandler\x00")):_.tj(a,TG("SoundHandler\x00"));a.getPosition()}},zH=class extends wI{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);QG(a,0);_.tj(a,this.g);a.getPosition()}},xI=class extends hH{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);QG(a,0);QG(a,1)}},yI=class extends xI{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+
41
- super.a()}write(a){super.write(a);QG(a,0);QG(a,0);_.M(a,0);_.M(a,0);_.M(a,0);QG(a,this.width);QG(a,this.height);_.M(a,4718592);_.M(a,4718592);_.M(a,0);QG(a,1);OG(a,10);_.tj(a,TG("AVC Coding",31));QG(a,this.depth);SG(a,-1)}},zI=class extends xI{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);_.M(a,0);_.M(a,0);QG(a,this.channelCount);QG(a,this.sampleSize);SG(a,0);QG(a,0);QG(a,this.sampleRate);QG(a,0)}},yH=class extends yI{constructor(a,
42
- 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()}},iH=class extends yH{constructor(a,b){super(a,b);this.type="encv"}},BH=class extends zI{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()}},jH=class extends BH{constructor(a,b,c){super(a,b,c);this.type="enca"}},xH=class extends hH{constructor(a,b){super("avcC");this.Ka=a;this.Mb=b;this.version=
43
- 1;this.g=this.Ka[0][1];this.h=this.Ka[0][2];this.level=this.Ka[0][3]}a(){let a=7;for(var b=0;b<this.Ka.length;b++)a+=2,a+=this.Ka[b].byteLength;for(b=0;b<this.Ka.length;b++)a+=2,a+=this.Mb[b].byteLength;return a+super.a()}write(a){super.write(a);OG(a,this.version);OG(a,this.g);OG(a,this.h);OG(a,this.level);OG(a,255);OG(a,224|this.Ka.length);for(var b=0;b<this.Ka.length;b++)QG(a,this.Ka[b].length),_.tj(a,this.Ka[b]);OG(a,this.Mb.length);for(b=0;b<this.Mb.length;b++)QG(a,this.Mb[b].length),_.tj(a,this.Mb[b]);
44
- a.getPosition()}},AH=class extends wI{constructor(a){super("esds",0,0);this.Fb=a}a(){return 22+(this.Fb.byteLength+3)+super.a()}write(a){super.write(a);OG(a,3);OG(a,23+this.Fb.byteLength);QG(a,1);OG(a,0);OG(a,4);OG(a,15+this.Fb.byteLength);OG(a,64);OG(a,21);PG(a,0);_.M(a,0);_.M(a,0);OG(a,5);OG(a,this.Fb.byteLength);_.tj(a,this.Fb);_.tj(a,new Uint8Array([6,1,2]));a.getPosition()}},vH=class extends wI{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);
45
- 0<this.location.length&&_.tj(a,TG(this.location));a.getPosition()}},uH=class extends wI{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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},DH=class extends hH{constructor(){super(_.le)}},wH=class extends wI{constructor(){super(_.ne,0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();
46
- return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},EH=class extends wI{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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},FH=class extends wI{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=
47
- 0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},HH=class extends wI{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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},GH=class extends wI{constructor(){super("stsz",
48
- 0,0)}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);a.getPosition()}},CH=class extends wI{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);SG(a,0);QG(a,0);a.getPosition()}},IH=class extends hH{constructor(){super("dinf")}},JH=class extends hH{constructor(){super(_.vd)}},KH=class extends hH{constructor(){super(_.rd)}},bI=class extends wI{constructor(a,b){super("tfdt",a,0);this.g=b}a(){let a=0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);
49
- 1===this.version?NG(a,this.g):_.M(a,this.g);a.getPosition()}},RH=class extends wI{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.M(a,this.g);a.getPosition()}},TH=class extends wI{constructor(a,b){super("trun",a,b);this.m=this.j=this.g=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&AI&&(a+=4);this.flags&BI&&(a+=4);for(let b=0;b<this.g;b++)this.flags&CI&&(a+=4),this.flags&DI&&(a+=4),this.flags&EI&&(a+=4),this.flags&FI&&(a+=4);return a+
50
- super.a()}write(a){super.write(a);_.M(a,this.g);this.flags&AI&&(a.getPosition(),RG(a,this.j));this.flags&BI&&_.M(a,this.m);for(let b=0;b<this.g;b++)this.flags&CI&&_.M(a,this.o[b]),this.flags&DI&&_.M(a,this.sampleSize[b]),this.flags&EI&&_.M(a,this.A[b]),this.flags&FI&&(0===this.version?_.M(a,this.h[b]):RG(a,this.h[b]));a.getPosition()}},AI=1,BI=4,CI=256,DI=512,EI=1024,FI=2048,SH=class extends wI{constructor(a,b){super("tfhd",a,b);this.g=255;this.m=this.o=this.j=this.A=this.h=0}a(){let a=4;this.flags&
51
- GI&&(a+=8);this.flags&HI&&(a+=4);this.flags&II&&(a+=4);this.flags&JI&&(a+=4);this.flags&KI&&(a+=4);return a+super.a()}write(a){super.write(a);_.M(a,this.g);this.flags&GI&&NG(a,this.h);this.flags&HI&&_.M(a,this.A);this.flags&II&&_.M(a,this.j);this.flags&JI&&_.M(a,this.o);this.flags&KI&&_.M(a,this.m);a.getPosition()}},GI=1,HI=2,II=8,JI=16,KI=32,YH=class extends hH{constructor(){super("traf")}},ZH=class extends hH{constructor(){super("moof")}},XH=class extends hH{constructor(){super(_.qd);this.g=new Uint8Array(0)}a(){return this.g.byteLength+
52
- super.a()}write(a){super.write(a);0<this.g.byteLength&&_.tj(a,this.g)}},kH=class extends wI{constructor(){super("tenc",0,0);this.g=1;this.h=8;this.m="";this.j=[]}a(){let a;a=20;1===this.g&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);OG(a,0);0===this.version?OG(a,0):OG(a,0);OG(a,this.g);OG(a,this.h);_.tj(a,_.Vg(this.m));if(1===this.g&&0===this.h){OG(a,0);for(let b=0;b<this.j.length;b++)OG(a,this.j[b])}a.getPosition()}},mH=class extends wI{constructor(a,b){super("schm",
53
- 0,0);this.g=a;this.h=b;this.Ab=""}a(){let a=8;this.flags&1&&(a+=TG(this.Ab).byteLength);return a+super.a()}write(a){super.write(a);_.tj(a,TG(this.g));_.M(a,this.h);this.flags&1&&_.tj(a,TG(this.Ab));a.getPosition()}},lH=class extends hH{constructor(a){super("frma");this.g=a}a(){return TG(this.g).byteLength+super.a()}write(a){super.write(a);_.tj(a,TG(this.g));a.getPosition()}},cI=class extends wI{constructor(){super("saio",0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=
54
- 0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));_.M(a,1);for(let b=0;1>b;b++)0===this.version?_.M(a,this.offset[b]):NG(a,this.offset[b]);a.getPosition()}},dI=class extends wI{constructor(a,b,c){super("saiz",0,0);this.g=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.g&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));OG(a,this.g);_.M(a,this.h);if(0===this.g)for(let b=0;b<this.h;b++)OG(a,
55
- this.j[b]);a.getPosition()}},WH=class extends wI{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.g=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.g[b].De.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].zc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&OG(a,this.j);for(let b=0;b<this.h;b++)if(_.tj(a,this.g[b].De),this.flags&2){QG(a,this.g[b].zc);for(let c=0;c<this.g[b].zc;c++)QG(a,this.g[b].de[c].re),_.M(a,this.g[b].de[c].se)}a.getPosition()}};var aI=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))}},$G=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,aH=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,bH=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,cH=/^(\d*\.?\d*)f$/,dH=/^(\d*\.?\d*)t$/,eH=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var PH=class{constructor(a){this.a=a;this.f=gH(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=gH(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var VH=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var LI=class{constructor(){this.w=this.h=this.g=this.D=null;this.N=1;this.W=0;this.m="";this.B=this.f=null;this.a=new _.O("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.R=mI;this.H=0;this.F=this.I=Infinity;this.o=[];this.M=this.V.bind(this);this.G=new Map}configure(a){this.g=a}start(a,b){this.D=b;a=[...new Set([a,UG(a)])];return iI(this,a).then(c=>qI(this,c.data).then(()=>{rI(this,this.A);return this.h}))}stop(){this.D&&this.D.networkingEngine.jd(this.M);this.A=this.w=this.h=this.g=
56
- 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 iI(this,[this.m]).then(a=>qI(this,a.data).then(()=>this.h)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}yb(){this.a.debug(_.Pt);this.D&&(this.j=null,this.update().then(()=>{rI(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&rI(this,100))}))}C(){return this.R===lI}J(){return 0<this.o.length}T(a){let b=
57
- 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),dd:this.J.bind(this),Jf:()=>1,Zc: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.a.debug(`Using base media decode time ${g} instead of `+
58
- `segment reference time ${a.request.startTime}`);f=eI(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)}},uI={video:_.Je,audio:_.bc,text:_.Wb},mI=_.Qt,lI="LIVE",vI={xg:"caption",yg:_.eu};_.z("clpp.smooth.SmoothComponent",class extends _.zp{constructor(){super()}f(){_.zn.ism=LI;_.xn[_.Xb]=LI}a(){_.Dv("ism");_.Ev(_.Xb)}id(){return"smooth"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var iI="Full MP4 box must have flags defined",jI="clpp.smooth.SmoothMP4Processor",kI="codecPrivateData",lI=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.O(a,c);_.O(a,b)},mI=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.ak()}},nI=function(a,b){mI(a,b>>16&255);mI(a,b>>8&255);mI(a,b&255)},oI=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.ak()}},pI=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.ak()}},qI=function(a,b){try{a.f.setInt16(a.a,
2
+ b,a.g),a.a+=2}catch(c){_.ak()}},rI=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},sI=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},tI=function(a,b,c,d){c=b.Ie[c];b=b.Pg;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 _.Rv([a],[b])[0]},uI=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",kI,"fourCC"]:a.type===_.p&&(c=["bitrate",kI,"channels","bitsPerSample","samplingRate","fourCC"]);return _.Tf(a,b,c,["id","segmentIndex"])},vI=function(a,b,c){const d=c.Zc.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ma:null,Nb:null,width:NaN,height:NaN,Gb:null,Pc:NaN,
4
+ sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.Ma=[_.xh(d[1])];a.Nb=[_.xh(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Gb=_.xh(c.Zc),a.sampleSize=c.Df||16,a.Pc=c.Pc,a.channelCount=c.Be}return a},wI=function(a,b){return a.filter(c=>c.type===b)},xI=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)},EI=function(a,b,c){var d=null;if(yI.test(a)){{a=yI.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 zI.test(a)?d=xI(zI,a):AI.test(a)?d=xI(AI,a):BI.test(a)?(a=BI.exec(a),d=Number(a[1])/c.frameRate):CI.test(a)?(a=CI.exec(a),d=Number(a[1])/c.a):DI.test(a)&&(d=xI(DI,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},FI=function(a){let b=
6
+ 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.vk(b)},MI=function(a,b,c){a:{var d=[_.Sc,_.Qc];for(e of d)if((d=c.ed(e))&&d.keyId){var e=d.keyId;break a}_.C(jI,"Could not get default Key ID for DRM init data!");e=null}c=new GI("xxxx");a.type===_.w?c=new HI(a.width,a.height):c=new II(a.channelCount,a.sampleSize,a.Pc);a=new JI;a.g=1;a.j=8;a.o=e||"00000000000000000000000000000000";a=(new GI("schi")).append([a]);b=(new GI(_.De)).append([new KI(b),new LI(_.yc,65536),a]);c.append([b]);return c},
7
+ oJ=function(a,b){var c=b.ld(),d=new NI(a.timescale,a.duration,a.id),e=(new OI).append([new PI(a.id)]),f=new QI(a.id,a.duration,a.timescale,a.width,a.height),g=new RI(a.timescale,a.duration);const h=new SI(a.type);var k=null,l=new TI;l.entries=[new UI];var m=new VI;switch(a.type){case _.w:k=new WI(a.Ma,a.Nb);c?(a=MI(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new XI(a.width,a.height)).append([k]),m.entries=[a]);k=new YI;break;case _.p:k=new ZI(a.Gb),c?(a=MI(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
+ (a=(new $I(a.channelCount,a.sampleSize,a.Pc)).append([k]),m.entries=[a]),k=new aJ}m=(new bJ).append([m,new cJ,new dJ,new eJ,new fJ]);l=(new gJ).append([l]);l=(new hJ).append([k,l,m]);g=(new iJ).append([g,h,l]);f=(new jJ).append([f,g]);d=(new kJ).append([d,f,e]);e=new lJ("dash",0,["iso6","mp41","avc1"]);c&&(c=b.ed(_.Qc),b=b.ed(_.Sc),c&&d.append([new mJ("pssh",c.initData,8)]),b&&d.append([new mJ("pssh",b.initData,8)]),c||b||_.C(jI,"Could not get PSSH init data!"));b=new nJ([e,d]);return _.J(b.write())},
9
+ yJ=function(a,b){let c,d,e,f,g,h;(new _.tk).L("moof",_.mk).Z("mfhd",k=>{{const l=new pJ;l.g=_.P(k.reader);c=l}}).L("traf",_.mk).Z("tfhd",k=>{{const l=k.reader.Ba();if(null===k.flags)throw new _.H(_.G,3,3019,iI);const m=new qJ(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.hk(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}}).Z("trun",k=>{{var l=k.reader.Ba();if(null===k.flags)throw new _.H(_.G,3,3019,iI);const m=new rJ(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.l=_.gk(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(_.gk(k.reader)));e=m}}).Z("sdtp",k=>{{const l=_.jk(k.reader,k.reader.Ba());f=new sJ("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.jk(k.reader,16);if(_.zh(l,tJ)){l=_.P(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new uJ(k.version,k.flags);l.j=_.P(k.reader);k.flags&1&&(l.l=_.ek(k.reader));for(let m=0;m<l.j;m++){const n={Qe:_.jk(k.reader,8),yc:0,me:[]};if(k.flags&2){n.yc=_.fk(k.reader);for(let q=0;q<n.yc;q++){const u={ze:0,Ae:0};
12
+ u.ze=_.fk(k.reader);u.Ae=_.P(k.reader);n.me.push(u)}}l.g.push(n)}g=l}}).L(_.Dd,k=>{{const l=new vJ;0<k.reader.Ba()?l.g=_.jk(k.reader,k.reader.Ba()):(_.C(jI,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new wJ).append([d,e]);f&&a.append([f]);b.ld()&&g&&a.append([g]);b=(new xJ).append([c,a]);return new nJ([b,h])},DJ=function(a,b,c,d){var e=d.ld(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=yJ(b,d);if(null===g)return a.request.contentType===_.t?a.data:
13
+ g;d=g.get(_.Dd);if(a.request.contentType===_.t){e=d.g.buffer;if(c){e=_.jh(e);if((e=(new DOMParser).parseFromString(e,_.Re))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new zJ(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 u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.jd];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],EI(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.kh(e).buffer}else c=e;return c}h=new xJ;a=g.get("mfhd");b=new wJ;k=g.get("tfhd");m=new AJ(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].yc);else g=8;b.append([c,new BJ,new CJ(g,k,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new nJ([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},EJ=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
+ periodId:null}},FJ=function(a){return{initData:_.Hv(_.fl(a)),initDataType:_.yc,keyId:a,periodId:null}},GJ=function(a,b,c){a=_.nl(a);c&&a.version!==c&&(a=_.Jv(a,c));return{initData:_.Hv(a),initDataType:_.yc,keyId:b,periodId:null}},HJ=function(a,b){return _.x(function*(){var c=_.Kh(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})},PJ=function(a,b){let c=null;try{{const sa=new DOMParser;let lb,Na;try{const eb=_.jh(b);Na=sa.parseFromString(eb.trim(),_.Re)}catch(eb){throw eb;}Na&&Na.documentElement.tagName==_.ob&&(lb=Na.documentElement);c=lb&&0<lb.getElementsByTagName("parsererror").length?null:lb}}catch(sa){}if(!c)throw a.h.error("Unable to parse manifest"),new _.H(_.G,4,4033,a.l);const d=+IJ(a,c,"MajorVersion"),e=+IJ(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
+ 1E7;let g=+IJ(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.Wk(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?(JJ(a,KJ),a.A=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):JJ(a,LJ);a.a={startTime:0,delay:0,duration:g/f,Dd:l/f,Kc:0};if(m){{var n=a.f.playreadyVersion;
19
+ const sa=[],lb=_.Wk(m,"ProtectionHeader")[0],Na=_.wh(_.Yk(lb)||""),eb=_.nl(Na).a;sa.push(EJ(_.Sc,FJ(eb),[eb]));sa.push(EJ(_.Qc,GJ(Na,eb,n),[eb]));var q=sa}a.o=q}{const sa=[],lb=_.Wk(c,"StreamIndex");if(!lb.length)throw a.h.error("No streams found!"),new _.H(_.G,4,4034,a.l);for(let Na=0;Na<lb.length;Na++){{var u=a,v=lb[Na];const eb=IJ(u,v,"Type"),pc=+v.getAttribute("Chunks"),ch=v.getAttribute("Subtype"),Vd=v.getAttribute("Language")||_.Ve,Wd=_.Sg(Vd),dh=v.getAttribute("Name")||"",Nf=+v.getAttribute(_.Ma),
20
+ Of=+v.getAttribute(_.La),$k=IJ(u,v,"Url"),ZM=+v.getAttribute("TimeScale")||null;{const qc=[],Ai=_.Wk(v,_.bb);for(let Xd=0;Xd<Ai.length;Xd++){{let rc,Ja,nd;var y=u,A=Ai[Xd],D=eb;const Bi=+A.getAttribute("Index"),Pf=+IJ(y,A,"Bitrate");let Ub=NaN,Qf=NaN,al=NaN,kq=NaN,vA=NaN,wA=NaN,xA=NaN;const yA=A.getAttribute("FourCC");switch(D){case _.w:Ub=+IJ(y,A,_.La);Qf=+IJ(y,A,_.Ma);break;case _.p:kq=+A.getAttribute("Channels")||2,al=+IJ(y,A,"SamplingRate"),wA=+IJ(y,A,"AudioTag"),vA=+IJ(y,A,"BitsPerSample"),xA=
21
+ +IJ(y,A,"PacketSize")}let lq=String(A.getAttribute("CodecPrivateData"));if(D===_.p&&!lq){{var E=kq;const zA={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},bl=zA[al];if("AACH"===yA){Ja=new Uint8Array(4);const AA=zA[2*al];Ja[0]=40|bl>>1;Ja[1]=bl<<7|E<<3|AA>>1;Ja[2]=AA<<7|8;Ja[3]=0;rc=new Uint16Array(2);rc[0]=(Ja[0]<<8)+Ja[1];rc[1]=(Ja[2]<<8)+Ja[3];nd=rc[0].toString(16)+rc[1].toString(16)}else Ja=new Uint8Array(2),Ja[0]=16|bl>>1,Ja[1]=bl<<7|E<<3,rc=
22
+ new Uint16Array(1),rc[0]=(Ja[0]<<8)+Ja[1],nd=rc[0].toString(16);lq=nd.toUpperCase()}}var N={id:y.W++,type:D,index:Bi,bitrate:Pf,Zc:lq,maxHeight:Ub,maxWidth:Qf,Pc:al,Be:kq,Wg:wA,Df:vA,hh:xA,Tf:yA,segmentIndex:null}}qc.push(N)}var sb=qc}{const qc=[],Ai=_.Wk(v,"c");for(let Xd=0;Xd<Ai.length;Xd++){const rc=Ai[Xd];let Ja=parseInt(rc.getAttribute("t"),10),nd=parseInt(rc.getAttribute("d"),10),Bi=parseInt(rc.getAttribute("r"),10),Pf=0;if(isNaN(Ja)&&isNaN(nd))throw u.h.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
+ new _.H(_.G,4,4037,u.l);0===Xd&&isNaN(Ja)&&(Pf=Ja=0);if(0<Xd){const Ub=qc[qc.length-1];Pf=Ub.n+1;Ub.d||(Ub.d=Ja-Ub.t);Ja||(Ja=Ub.t+Ub.d);nd||(nd=Ja-Ub.t)}qc.push({n:Pf,d:nd,t:Ja});if(Bi){Bi--;for(let Ub=0;Ub<Bi;Ub++){const Qf=qc[qc.length-1];Pf=Qf.n+1;Ja=Qf.t+Qf.d;nd=Qf.d;qc.push({n:Pf,d:nd,t:Ja})}}}u.C()||qc.length===pc||u.h.warn("Number of fragments ("+pc+") differs from number of chunks ("+qc.length+").");var Sb=qc}var Jf={type:eb,Zg:pc,Jg:ch,language:Wd,Jc:Vd,name:dh,maxWidth:Nf,maxHeight:Of,
24
+ Pg:$k,tracks:sb,Ie:Sb,timescale:ZM}}sa.push(Jf)}var Me=sa}const Sa={gh:d,Te:e,timescale:f,duration:g,isLive:h,fh:k,Dd:l,Md:!1,streams:Me};if(a.g&&a.w)return MJ(a,Sa),Promise.resolve();a.G.clear();{const sa=Sa.timescale,lb=Sa.duration,Na=wI(Sa.streams,_.p),eb=wI(Sa.streams,_.w),pc=wI(Sa.streams,_.t),ch=[];let Vd=NJ(a,lb,sa,Na),Wd=NJ(a,lb,sa,eb);const dh=NJ(a,lb,sa,pc);Vd.length||(Vd=[null]);Wd.length||(Wd=[null]);for(let Nf=0;Nf<Wd.length;Nf++)for(let Of=0;Of<Vd.length;Of++)ch.push(OJ(a,Wd[Nf],Vd[Of]));
25
+ var Ne={startTime:0,variants:ch,textStreams:dh,thumbStreams:[]}}{var db=Sa.streams;let sa=a.a.startTime,lb=a.a.delay;const Na=a.I;let eb=Math.min(a.a.duration||Infinity,Na);const pc=a.C(),ch=a.a.Dd,Vd=a.a.Kc,Wd=a.H,dh=isFinite(a.F)?a.F:0;if(pc)eb=Infinity,sa=Date.now()/1E3-Vd,a.a.startTime=sa,lb=3*Wd;else{const Nf=isFinite(Na)?Na:a.a.duration;for(const Of of db)for(const $k of Of.tracks)$k.segmentIndex.offset(-dh),_.qw($k.segmentIndex,Nf)}a.B=new _.fB(sa,lb,!pc,!0);a.B.f=eb;_.yw(a.B,Wd);a.B.w=ch;
26
+ pc||a.B.offset(-dh)}a.D.filterAllPeriods([Ne]);a.g={presentationTimeline:a.B,periods:[Ne],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.zc(a.M),a.K=!0);a.w=Sa;return Promise.resolve()},QJ=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.yb.bind(a),b))},IJ=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);},JJ=function(a,b){const c=b===LJ;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},MJ=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){uI(g,c)||a.h.warn("The current stream is updated with a stream that seems to have different base properties!");var d=RJ(a,a.w.timescale,f,c);c=g.segmentIndex;_.Hw(c,d);(d=a.a.Dd)&&_.Iw(c,_.Fw(c)-d).forEach(h=>{h.Ja().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.`)}}},RJ=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.Ie.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=tI(a.l,c,k,d);a.H=Math.max(a.H,l);f.push(new _.Gw(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.Kc?a.a.Kc=b.endTime:a.a.Kc=
29
+ Math.min(a.a.Kc,b.endTime);return f},NJ=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=RJ(a,c,k,h);const N=new _.gB(l);var m=null;k.type!==_.t&&(m=SJ(a,b,c,k,h));h.segmentIndex=N;l=a.N++;var n=Promise.resolve.bind(Promise),q=N.f.bind(N),u=N.get.bind(N),v=N.g.bind(N),y=N.getDuration.bind(N),A=TJ[k.type];var D="";switch(k.type){case _.w:D=h.Zc;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.Zc,E=2,"AACH"===h.Tf?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===_.t?UJ[k.Jg]:void 0;h={id:l,originalId:null,jh:null,createSegmentIndex:n,findSegmentPosition:q,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:N,segmentLookupStrategy:_.rv,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.Jc,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.Be||null,closedCaptions:null}}return h});e=e.concat(g)}return e},OJ=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Ve;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},SJ=function(a,b,c,d,e){b=vI(b,d.timescale||c,e);c={isLive:a.C.bind(a),
32
+ ld:a.J.bind(a),Zf:()=>1,ed:a.S.bind(a)};d=new Uint8Array(0);try{d=oJ(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,"+_.vh(d);return new _.cB(()=>[f],0,null,null,!0)},GI=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?_.O(a,1):_.O(a,this.size);_.bk(a,rI(this.type));this.size>b&&lI(a,this.size);"uuid"===this.type&&_.bk(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()}},VJ=class extends GI{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);mI(a,this.version);nI(a,this.flags)}},mJ=class extends GI{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);_.bk(a,this.g,this.offset);a.getPosition()}},sJ=class extends VJ{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);_.bk(a,this.g,this.offset);a.getPosition()}},lJ=class extends GI{constructor(a,b,c){super("ftyp");this.j=a;this.Te=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);_.bk(a,rI(this.j));_.O(a,this.Te);_.bk(a,rI(this.g.join("")));a.getPosition()}},kJ=class extends GI{constructor(){super(_.Jd)}},jJ=class extends GI{constructor(){super(_.Te)}},NI=class extends VJ{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?(lI(a,0),lI(a,0),_.O(a,this.timescale),lI(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));_.O(a,65536);oI(a,this.volume);oI(a,0);_.O(a,0);_.O(a,0);for(let b=0;b<this.g.length;b++)mI(a,this.g[b]);
37
+ _.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,this.j);a.getPosition()}},OI=class extends GI{constructor(){super("mvex")}},PI=class extends VJ{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.O(a,this.g);_.O(a,1);_.O(a,0);_.O(a,0);_.O(a,0);a.getPosition()}},QI=class extends VJ{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?(lI(a,0),lI(a,0),_.O(a,this.j),_.O(a,0),lI(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.j),_.O(a,0),_.O(a,this.duration*this.timescale));_.O(a,0);_.O(a,0);oI(a,0);oI(a,0);oI(a,this.volume);oI(a,0);for(let b=0;b<this.g.length;b++)mI(a,this.g[b]);oI(a,this.width);oI(a,0);oI(a,this.height);oI(a,0);a.getPosition()}},RI=class extends VJ{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?(lI(a,0),lI(a,0),_.O(a,this.timescale),lI(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));oI(a,this.language);oI(a,0);a.getPosition()}},SI=class extends VJ{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.O(a,0);this.g===
40
+ _.w?_.bk(a,rI("vide")):_.bk(a,rI("soun"));_.O(a,0);_.O(a,0);_.O(a,0);this.g===_.w?_.bk(a,rI("VideoHandler\x00")):_.bk(a,rI("SoundHandler\x00"));a.getPosition()}},YI=class extends VJ{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);oI(a,0);_.bk(a,this.g);a.getPosition()}},WJ=class extends GI{constructor(a){super(a);this.A=!0}a(){return 8+super.a()}write(a){super.write(a);_.O(a,0);oI(a,0);oI(a,1)}},XJ=class extends WJ{constructor(a){super(a);
41
+ this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);oI(a,0);oI(a,0);_.O(a,0);_.O(a,0);_.O(a,0);oI(a,this.width);oI(a,this.height);_.O(a,4718592);_.O(a,4718592);_.O(a,0);oI(a,1);mI(a,10);_.bk(a,rI("AVC Coding",31));oI(a,this.depth);qI(a,-1)}},YJ=class extends WJ{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);_.O(a,0);_.O(a,0);oI(a,this.channelCount);oI(a,this.sampleSize);qI(a,0);
42
+ oI(a,0);oI(a,this.sampleRate);oI(a,0)}},XI=class extends XJ{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()}},HI=class extends XI{constructor(a,b){super(a,b);this.type="encv"}},$I=class extends YJ{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()}},II=class extends $I{constructor(a,b,c){super(a,b,c);this.type="enca"}},
43
+ WI=class extends GI{constructor(a,b){super("avcC");this.Ma=a;this.Nb=b;this.version=1;this.g=this.Ma[0][1];this.j=this.Ma[0][2];this.level=this.Ma[0][3]}a(){let a=7;for(var b=0;b<this.Ma.length;b++)a+=2,a+=this.Ma[b].byteLength;for(b=0;b<this.Ma.length;b++)a+=2,a+=this.Nb[b].byteLength;return a+super.a()}write(a){super.write(a);mI(a,this.version);mI(a,this.g);mI(a,this.j);mI(a,this.level);mI(a,255);mI(a,224|this.Ma.length);for(var b=0;b<this.Ma.length;b++)oI(a,this.Ma[b].length),_.bk(a,this.Ma[b]);
44
+ mI(a,this.Nb.length);for(b=0;b<this.Nb.length;b++)oI(a,this.Nb[b].length),_.bk(a,this.Nb[b]);a.getPosition()}},ZI=class extends VJ{constructor(a){super("esds",0,0);this.Gb=a}a(){return 22+(this.Gb.byteLength+3)+super.a()}write(a){super.write(a);mI(a,3);mI(a,23+this.Gb.byteLength);oI(a,1);mI(a,0);mI(a,4);mI(a,15+this.Gb.byteLength);mI(a,64);mI(a,21);nI(a,0);_.O(a,0);_.O(a,0);mI(a,5);mI(a,this.Gb.byteLength);_.bk(a,this.Gb);_.bk(a,new Uint8Array([6,1,2]));a.getPosition()}},UI=class extends VJ{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&&_.bk(a,rI(this.location));a.getPosition()}},TI=class extends VJ{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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},bJ=class extends GI{constructor(){super(_.Ie)}},VI=class extends VJ{constructor(){super(_.Ke,
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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},cJ=class extends VJ{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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
47
+ dJ=class extends VJ{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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},fJ=class extends VJ{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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
48
+ a.getPosition()}},eJ=class extends VJ{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.O(a,0);_.O(a,0);a.getPosition()}},aJ=class extends VJ{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);qI(a,0);oI(a,0);a.getPosition()}},gJ=class extends GI{constructor(){super("dinf")}},hJ=class extends GI{constructor(){super(_.Id)}},iJ=class extends GI{constructor(){super(_.Ed)}},AJ=class extends VJ{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?lI(a,this.g):_.O(a,this.g);a.getPosition()}},pJ=class extends VJ{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.O(a,this.g);a.getPosition()}},rJ=class extends VJ{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&ZJ&&(a+=4);this.flags&$J&&(a+=4);for(let b=0;b<this.g;b++)this.flags&aK&&(a+=
50
+ 4),this.flags&bK&&(a+=4),this.flags&cK&&(a+=4),this.flags&dK&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.g);this.flags&ZJ&&(a.getPosition(),pI(a,this.l));this.flags&$J&&_.O(a,this.o);for(let b=0;b<this.g;b++)this.flags&aK&&_.O(a,this.w[b]),this.flags&bK&&_.O(a,this.sampleSize[b]),this.flags&cK&&_.O(a,this.B[b]),this.flags&dK&&(0===this.version?_.O(a,this.j[b]):pI(a,this.j[b]));a.getPosition()}},ZJ=1,$J=4,aK=256,bK=512,cK=1024,dK=2048,qJ=class extends VJ{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&eK&&(a+=8);this.flags&fK&&(a+=4);this.flags&gK&&(a+=4);this.flags&hK&&(a+=4);this.flags&iK&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.g);this.flags&eK&&lI(a,this.j);this.flags&fK&&_.O(a,this.B);this.flags&gK&&_.O(a,this.l);this.flags&hK&&_.O(a,this.w);this.flags&iK&&_.O(a,this.o);a.getPosition()}},eK=1,fK=2,gK=8,hK=16,iK=32,wJ=class extends GI{constructor(){super("traf")}},xJ=class extends GI{constructor(){super("moof")}},
52
+ vJ=class extends GI{constructor(){super(_.Dd);this.g=new Uint8Array(0)}a(){return this.g.byteLength+super.a()}write(a){super.write(a);0<this.g.byteLength&&_.bk(a,this.g)}},JI=class extends VJ{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);mI(a,0);0===this.version?mI(a,0):mI(a,0);mI(a,this.g);mI(a,this.j);_.bk(a,_.xh(this.o));if(1===this.g&&0===this.j){mI(a,0);for(let b=0;b<
53
+ this.l.length;b++)mI(a,this.l[b])}a.getPosition()}},LI=class extends VJ{constructor(a,b){super("schm",0,0);this.g=a;this.j=b;this.Ab=""}a(){let a=8;this.flags&1&&(a+=rI(this.Ab).byteLength);return a+super.a()}write(a){super.write(a);_.bk(a,rI(this.g));_.O(a,this.j);this.flags&1&&_.bk(a,rI(this.Ab));a.getPosition()}},KI=class extends GI{constructor(a){super("frma");this.g=a}a(){return rI(this.g).byteLength+super.a()}write(a){super.write(a);_.bk(a,rI(this.g));a.getPosition()}},BJ=class extends VJ{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&&(_.O(a,0),_.O(a,0));_.O(a,1);for(let b=0;1>b;b++)0===this.version?_.O(a,this.offset[b]):lI(a,this.offset[b]);a.getPosition()}},CJ=class extends VJ{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&&(_.O(a,
55
+ 0),_.O(a,0));mI(a,this.g);_.O(a,this.j);if(0===this.g)for(let b=0;b<this.j;b++)mI(a,this.l[b]);a.getPosition()}},uJ=class extends VJ{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].Qe.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].yc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.O(a,this.j);this.flags&1&&mI(a,this.l);for(let b=0;b<this.j;b++)if(_.bk(a,this.g[b].Qe),this.flags&2){oI(a,this.g[b].yc);
56
+ for(let c=0;c<this.g[b].yc;c++)oI(a,this.g[b].me[c].ze),_.O(a,this.g[b].me[c].Ae)}a.getPosition()}};var zJ=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))}},yI=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,zI=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,AI=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,BI=/^(\d*\.?\d*)f$/,CI=/^(\d*\.?\d*)t$/,DI=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var nJ=class{constructor(a){this.a=a;this.f=FI(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=FI(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var tJ=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var jK=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=LJ;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,sI(a)])];return HJ(this,a).then(c=>PJ(this,c.data).then(()=>{QJ(this,this.A);return this.g}))}stop(){this.D&&this.D.networkingEngine.qd(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 HJ(this,[this.l]).then(a=>PJ(this,a.data).then(()=>this.g)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}yb(){this.h.debug(_.iv);this.D&&(this.j=null,this.update().then(()=>{QJ(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&QJ(this,100))}))}C(){return this.R===KJ}J(){return 0<this.o.length}S(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),ld:this.J.bind(this),Zf:()=>1,ed:this.S.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=DJ(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)}},TJ={video:_.ff,audio:_.jc,text:_.dc},LJ=_.jv,KJ="LIVE",UJ={Rg:_.ov,Tg:_.Cv};_.z("clpp.smooth.SmoothComponent",class extends _.Pq{f(){_.Lo.ism=jK;_.Jo[_.ec]=jK}a(){_.Nw("ism");_.Ow(_.ec)}id(){return"smooth"}});};f.call(g, window);
package/cl.thumbnails.js CHANGED
@@ -1,17 +1,17 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ys="No thumbnail duration or URL specified",zs="No thumbnail found for position ",As="Position is out of range: ",Bs="Thumbnail URL is mandatory",Cs="Wrong gridSize format",Ds="clpp.thumbnails",Fs=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Bd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Es(a,0,e,!!f))},Promise.resolve())},Es=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Gs(a,d).then(()=>a.a[b].load()).then(()=>Es(a,e,
2
- c,d))},Gs=function(a,b){return new Promise(c=>{if(b||a.g.getState()!==_.zl)c();else a.g.one(_.hc,()=>{c()})})},Hs=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.Fe.resolve()})},Ks=function(a,b){return Is(a,b).then(c=>new Js(c,b.time,b.duration))},Is=function(a,b){return b.load().then(()=>{const c=_.I(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.Sg(c)})},Ls=function(a){a=a.split(/\.|:/).map(parseFloat);let b=0,c;const d={3:.001,2:1,1:60,0:3600};for(c=a.length-
3
- 1;0<=c;c--)b+=a[c]*d[c];return b},Ms=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},Ns=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Gc:c,le:d,Ce:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Os=function(a){return a.some(b=>0<b.thumbStreams.length)},Ps=function(a){if(!a)return null;a=new _.Jj(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":
4
- a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null};var Qs=class{constructor(){this.log=new _.O(Ds);this.g=null;this.a=[];this.w=!1}init(a,b){this.g=a;a.one(_.Zd,()=>{this.w=!0});a.isLive()||this.m().then(()=>{b&&b.preload&&Fs(this,b.preload)})}};var Js=class{constructor(a,b,c,d=0,e=0,f=0,g=0,h=1,k=1,l=0,m=0,n=new Image){this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ka=n;this.uf=h;this.hg=k;this.Nf=l;this.Of=m;this.ra=null}raw(){return this.ka.cloneNode(!1)}element(a,b){let c=this.width,d=this.height;const e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));a=document.createElement(_.Oc);a.style.width=
5
- c+_.Wd;a.style.height=d+_.Wd;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.ka.naturalWidth||this.ka.width))}px ${Math.ceil(d/this.height*(this.ka.naturalHeight||this.ka.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*c+_.Wd;a.style.backgroundPositionY="-"+b*d+_.Wd;return a}load(){this.ra||(this.ra=new Promise((a,b)=>{const c=()=>{this.width||
6
- (this.width=(this.ka.naturalWidth||this.ka.width)/this.uf);this.height||(this.height=(this.ka.naturalHeight||this.ka.height)/this.hg);this.x||(this.x=this.width*this.Nf);this.y||(this.y=this.height*this.Of)};if(this.ka.src&&this.ka.complete)c(),a(this);else{var d=null,e=()=>{c();this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.Yc,d);a(this)};d=()=>{this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.Yc,d);b()};this.ka.addEventListener("load",e);this.ka.addEventListener(_.Yc,
7
- d);this.ka.src=this.src}}));return this.ra}};_.z("clpp.thumbnails.Thumbnail",Js);Js.prototype.load=Js.prototype.load;Js.prototype.element=Js.prototype.element;Js.prototype.raw=Js.prototype.raw;var Rs=class extends Qs{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Bs);if("GRID"===b.mode&&!b.gridSize)throw new _.H(_.G,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.H(_.G,7,7100,"Duration is mandatory");this.f=b;const c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(ys,c,d),new _.H(_.G,7,7100,ys);this.j=c;if(this.f.gridSize)try{const e=this.f.gridSize.split(/x/).map(f=>parseInt(f,10)).filter(f=>
8
- 0<f);if(2===e.length)this.h=e[0],this.o=e[1];else throw new _.H(_.G,7,7100,Cs);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.H(_.G,7,7100,Cs);}super.init(a,b)}get(a){const b=this.g.getDuration();if(void 0===this.f.duration)return Promise.reject("Duration configuration not defined");const c=Math.floor(a/this.f.duration);if(0>a||a>b)return Promise.reject(As+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(zs+a+" at index "+c)}m(){if(0<this.a.length)return Promise.resolve();
9
- var a=this.g.getDuration();const b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);const c=this.f.templateKey||"$index$";for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new Js(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f))}return Promise.resolve()}};var Ss=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Fe=new _.Mk}load(){return this.Fe}},Us=class{constructor(){this.g=new _.O(Ds);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Mk}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Bs);const c=b.url;b=_.jh(c);b.type=_.ih;a.getNetworkEngine().fetch(b).P.then(d=>{{var e=d.data;d=_.I(this.f);e=_.I(e);const f=d.byteLength+e.byteLength,g=new ArrayBuffer(f),h=new DataView(g);let k=0;for(let l=0,m=d.byteLength;l<m;l++)h.setUint8(k,
10
- d[l]),k+=1;for(let l=0,m=e.byteLength;l<m;l++)h.setUint8(k,e[l]),k+=1;this.f=g;this.g.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`)}}).then(()=>{{var d=this.f,e=_.I(d),f=String.fromCharCode.apply(null,Ts),g=Array.prototype.slice.call(e,0,8);e=64;let k=0;var h=!1;if(f===String.fromCharCode.apply(null,g))for(d=new DataView(d,16,20),d=d.getUint32(0,!0),0===d&&(d=1E3);!h;){k+=1;g=d;f=new DataView(this.f,e);h=f.getUint32(0,!0);g=h*g/1E3;f=f.getUint32(4,!0);f=new Ss(g,f);if(g=this.a.length)g=
11
- this.a[g-1],g.length=f.offset-g.offset,g.duration=f.time-g.time;this.a.push(f);e+=8;(h=4294967295===h)&&this.h.resolve();if(1E5<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");}}).then(()=>{Hs(this)}).catch(d=>{this.g.error(`[BIF] Error while loading thumbnails '
12
- + 'URL: ${c}`,d);a.onError(new _.H(1,7,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){return 0>a?Promise.reject(As+a):this.h.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return Ks(this,c).then(d=>d.load().then(()=>d))}return Promise.reject(zs+a)})}},Ts=[137,66,73,70,13,10,26,10];var Vs=class extends Qs{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Bs);const c=b.url,d=_.jh(c);d.type=_.ih;this.f=a.getNetworkEngine().fetch(d).P.then(e=>{if(e=e.data){e=_.Eg(e).split(/\n/);for(let m=0;m<e.length;m++){var f=e[m],g=f.split(" --\x3e ");if(2===g.length){f=e[++m];var h=f.indexOf("\x3d");var k=h=0>h?[]:f.substr(h+1).split(/,/).map(parseFloat);h=k[0];const n=k[1],q=k[2];k=k[3];var l=f.indexOf("#");f=0>l?f:f.substr(0,l);f.match(/^http|^\/\//)||(f=
13
- c.substr(0,c.lastIndexOf("/"))+"/"+f);l=Ls(g[0]);g=Ls(g[1])-l;this.a.push(new Js(f,l,g,h,n,q,k,0,0))}}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnails "+`URL: ${c}`,e);a.onError(new _.H(1,7,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){return 0>a?Promise.reject(As+a):this.f.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return c.load().then(()=>c)}return Promise.reject(zs+a)})}m(){return this.f}};var Ws=class extends Qs{get(a){if(0>a)return this.log.error("Position must be greater than 0 but is "+a),Promise.reject();var b=this.g.getPeriods();b=Ms(b,a);if(!b)return this.log.error("Could not find period for specified position",a),Promise.reject();var c=b.thumbStreams.sort(this.f)[0];if(!c)return this.log.error("Could not find thumb stream for specified position",a),Promise.reject();b=c.findSegmentPosition(a-b.startTime);if(null===b||void 0===b)return this.log.error("Could not find segment index for specified position",
14
- a),Promise.reject();var d=c.getSegmentReference(b);if(d){const e=Ns(d,c);a=Math.floor((a-d.startTime)/e.durationPerTile);let f;if(0<this.a.length)d=c.findSegmentPosition(0),null!==d&&(f=this.a[(b-d)*e.Ce+a]);else if((c=d.Ha())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.Ce&&(g=a%e.Gc,h=Math.floor(a/e.Gc),d+=a*e.durationPerTile);f=new Js(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Gc,e.le,g,h)}if(f)return f.load().then(()=>f)}this.log.error("segment reference for specified segment index does not exist",
15
- b);return Promise.reject()}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}m(){if(0<this.a.length)return Promise.resolve();var a=this.g.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.C(d=a.getSegmentReference(c++));){const e=Ns(d,a),f=d.Ha()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.le;++k)for(let l=0;l<e.Gc;++l)this.a.push(new Js(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Gc,
16
- e.le,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var Xs=class{constructor(){this.f=new _.O(Ds);this.a=this.l=null}onPlayerCreated(a){this.l=a}onPlayerWillDestroy(){this.l=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){var b=a.getConfiguration();if(b.thumbnails){var c=b.thumbnails;c&&(void 0===c.enabled||c.enabled)&&((b=c.mode)||(b=Ps(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new Rs:"WEBVTT"===b?this.a=new Vs:"BIF"===b&&(this.a=new Us)),this.a&&(this.f.info("Loading thumbs configuration",c),this.l.one(_.od,()=>{this.f.info("Initialize thumbnails provider");
17
- this.a.init(a,c)})))}else this.a=null}onContentLoaded(a){if(!this.a){var b=a.getConfiguration();b=b&&b.thumbnails;if(!b||void 0===b.enabled||b.enabled){var c=a.getPeriods();Os(c)&&(this.a=new Ws,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.z("clpp.thumbnails.ThumbnailsPlugin",Xs);Xs.prototype.get=Xs.prototype.get;Xs.Id="thumbnails";_.Hm(new class{create(){return new Xs}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Rt="No thumbnail duration or URL specified",St="No thumbnail found for position ",Tt="Position is out of range: ",Ut="Thumbnail URL is mandatory",Vt="Wrong gridSize format",Wt="clpp.thumbnails",Yt=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Od&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Xt(a,0,e,!!f))},Promise.resolve())},Xt=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Zt(a,d).then(()=>a.a[b].load()).then(()=>Xt(a,e,
2
+ c,d))},Zt=function(a,b){return new Promise(c=>{if(b||a.player.getState()!==_.vm)c();else a.player.one(_.oc,()=>{c()})})},$t=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.Se.resolve()})},cu=function(a,b){return au(a,b).then(c=>new bu(c,b.time,b.duration))},au=function(a,b){return b.load().then(()=>{const c=_.J(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.uh(c)})},du=function(a){a=a.split(/\.|:/).map(parseFloat);let b=0,c;const d={3:.001,2:1,1:60,0:3600};for(c=
3
+ a.length-1;0<=c;c--)b+=a[c]*d[c];return b},eu=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},fu=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Hc:c,se:d,Pe:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},gu=function(a){return a.some(b=>0<b.thumbStreams.length)},hu=function(a){if(!a)return null;a=new _.rk(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?
4
+ "BIF":a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null};var iu=class{constructor(){this.log=new _.R(Wt);this.player=null;this.a=[];this.w=!1}init(a,b){this.player=a;a.one(_.ve,()=>{this.w=!0});a.isLive()||this.l().then(()=>{b&&b.preload&&Yt(this,b.preload)})}};var bu=class{constructor(a,b,c,d=0,e=0,f=0,g=0,h=1,k=1,l=0,m=0,n=new Image){this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ka=n;this.Jf=h;this.Cg=k;this.dg=l;this.eg=m;this.ma=null}raw(){return this.ka.cloneNode(!1)}element(a,b){let c=this.width,d=this.height;const e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));a=document.createElement(_.Yc);a.style.width=
5
+ c+_.se;a.style.height=d+_.se;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.ka.naturalWidth||this.ka.width))}px ${Math.ceil(d/this.height*(this.ka.naturalHeight||this.ka.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*c+_.se;a.style.backgroundPositionY="-"+b*d+_.se;return a}load(){this.ma||(this.ma=new Promise((a,b)=>{const c=()=>{this.width||
6
+ (this.width=(this.ka.naturalWidth||this.ka.width)/this.Jf);this.height||(this.height=(this.ka.naturalHeight||this.ka.height)/this.Cg);this.x||(this.x=this.width*this.dg);this.y||(this.y=this.height*this.eg)};if(this.ka.src&&this.ka.complete)c(),a(this);else{var d=null,e=()=>{c();this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.ld,d);a(this)};d=()=>{this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.ld,d);b()};this.ka.addEventListener("load",e);this.ka.addEventListener(_.ld,
7
+ d);this.ka.src=this.src}}));return this.ma}};_.z("clpp.thumbnails.Thumbnail",bu);bu.prototype.load=bu.prototype.load;bu.prototype.element=bu.prototype.element;bu.prototype.raw=bu.prototype.raw;var ju=class extends iu{constructor(){super();this.f=null;this.o=this.g=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Ut);if("GRID"===b.mode&&!b.gridSize)throw new _.H(_.G,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.H(_.G,7,7100,"Duration is mandatory");this.f=b;const c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(Rt,c,d),new _.H(_.G,7,7100,Rt);this.j=c;if(this.f.gridSize)try{const e=this.f.gridSize.split(/x/).map(f=>parseInt(f,10)).filter(f=>
8
+ 0<f);if(2===e.length)this.g=e[0],this.o=e[1];else throw new _.H(_.G,7,7100,Vt);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.H(_.G,7,7100,Vt);}super.init(a,b)}get(a){const b=this.player.getDuration();if(void 0===this.f.duration)return Promise.reject("Duration configuration not defined");const c=Math.floor(a/this.f.duration);if(0>a||a>b)return Promise.reject(Tt+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(St+a+" at index "+c)}l(){if(0<this.a.length)return Promise.resolve();
9
+ var a=this.player.getDuration();const b=this.g*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);const c=this.f.templateKey||"$index$";for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new bu(e,this.j*(d*b+g),this.j,0,0,0,0,this.g,this.o,g%this.g,Math.floor(g/this.g),f))}return Promise.resolve()}};var ku=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Se=new _.Jl}load(){return this.Se}},mu=class{constructor(){this.h=new _.R(Wt);this.f=new ArrayBuffer(0);this.a=[];this.g=new _.Jl}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Ut);const c=b.url;b=_.Kh(c);b.type=_.Jh;a.getNetworkEngine().fetch(b).P.then(d=>{{var e=d.data;d=_.J(this.f);e=_.J(e);const f=d.byteLength+e.byteLength,g=new ArrayBuffer(f),h=new DataView(g);let k=0;for(let l=0,m=d.byteLength;l<m;l++)h.setUint8(k,
10
+ d[l]),k+=1;for(let l=0,m=e.byteLength;l<m;l++)h.setUint8(k,e[l]),k+=1;this.f=g;this.h.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`)}}).then(()=>{{var d=this.f,e=_.J(d),f=String.fromCharCode.apply(null,lu),g=Array.prototype.slice.call(e,0,8);e=64;let k=0;var h=!1;if(f===String.fromCharCode.apply(null,g))for(d=new DataView(d,16,20),d=d.getUint32(0,!0),0===d&&(d=1E3);!h;){k+=1;g=d;f=new DataView(this.f,e);h=f.getUint32(0,!0);g=h*g/1E3;f=f.getUint32(4,!0);f=new ku(g,f);if(g=this.a.length)g=
11
+ this.a[g-1],g.length=f.offset-g.offset,g.duration=f.time-g.time;this.a.push(f);e+=8;(h=4294967295===h)&&this.g.resolve();if(1E5<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");}}).then(()=>{$t(this)}).catch(d=>{this.h.error(`[BIF] Error while loading thumbnails '
12
+ + 'URL: ${c}`,d);a.onError(new _.H(1,7,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){return 0>a?Promise.reject(Tt+a):this.g.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return cu(this,c).then(d=>d.load().then(()=>d))}return Promise.reject(St+a)})}},lu=[137,66,73,70,13,10,26,10];var nu=class extends iu{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Ut);const c=b.url,d=_.Kh(c);d.type=_.Jh;this.f=a.getNetworkEngine().fetch(d).P.then(e=>{if(e=e.data){e=_.gh(e).split(/\n/);for(let m=0;m<e.length;m++){var f=e[m],g=f.split(" --\x3e ");if(2===g.length){f=e[++m];var h=f.indexOf("\x3d");var k=h=0>h?[]:f.substr(h+1).split(/,/).map(parseFloat);h=k[0];const n=k[1],q=k[2];k=k[3];var l=f.indexOf("#");f=0>l?f:f.substr(0,l);f.match(/^http|^\/\//)||(f=
13
+ c.substr(0,c.lastIndexOf("/"))+"/"+f);l=du(g[0]);g=du(g[1])-l;this.a.push(new bu(f,l,g,h,n,q,k,0,0))}}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnails "+`URL: ${c}`,e);a.onError(new _.H(1,7,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){return 0>a?Promise.reject(Tt+a):this.f.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return c.load().then(()=>c)}return Promise.reject(St+a)})}l(){return this.f}};var ou=class extends iu{get(a){if(0>a)return this.log.error("Position must be greater than 0 but is "+a),Promise.reject();var b=this.player.getPeriods();b=eu(b,a);if(!b)return this.log.error("Could not find period for specified position",a),Promise.reject();var c=b.thumbStreams.sort(this.f)[0];if(!c)return this.log.error("Could not find thumb stream for specified position",a),Promise.reject();b=c.findSegmentPosition(a-b.startTime);if(null===b||void 0===b)return this.log.error("Could not find segment index for specified position",
14
+ a),Promise.reject();var d=c.getSegmentReference(b);if(d){const e=fu(d,c);a=Math.floor((a-d.startTime)/e.durationPerTile);let f;if(0<this.a.length)d=c.findSegmentPosition(0),null!==d&&(f=this.a[(b-d)*e.Pe+a]);else if((c=d.Ja())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.Pe&&(g=a%e.Hc,h=Math.floor(a/e.Hc),d+=a*e.durationPerTile);f=new bu(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Hc,e.se,g,h)}if(f)return f.load().then(()=>f)}this.log.error("segment reference for specified segment index does not exist",
15
+ b);return Promise.reject()}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}l(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.B(d=a.getSegmentReference(c++));){const e=fu(d,a),f=d.Ja()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.se;++k)for(let l=0;l<e.Hc;++l)this.a.push(new bu(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,
16
+ e.Hc,e.se,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var pu=class{constructor(){this.h=new _.R(Wt);this.a=this.m=null}onPlayerCreated(a){this.m=a}onPlayerWillDestroy(){this.m=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){var b=a.getConfiguration();if(b.thumbnails){var c=b.thumbnails;c&&(void 0===c.enabled||c.enabled)&&((b=c.mode)||(b=hu(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new ju:"WEBVTT"===b?this.a=new nu:"BIF"===b&&(this.a=new mu)),this.a&&(this.h.info("Loading thumbs configuration",c),this.m.one(_.Bd,()=>{this.h.info("Initialize thumbnails provider");
17
+ this.a.init(a,c)})))}else this.a=null}onContentLoaded(a){if(!this.a){var b=a.getConfiguration();b=b&&b.thumbnails;if(!b||void 0===b.enabled||b.enabled){var c=a.getPeriods();gu(c)&&(this.a=new ou,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.z("clpp.thumbnails.ThumbnailsPlugin",pu);pu.prototype.get=pu.prototype.get;pu.Id="thumbnails";_.En(new class{create(){return new pu}});};f.call(g, window);