@castlabs/prestoplay 6.6.0 → 6.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +110 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +406 -406
  8. package/cjs/cl.crypto.js +8 -8
  9. package/cjs/cl.dash.js +71 -71
  10. package/cjs/cl.externs.js +17 -6
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +49 -48
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +256 -257
  17. package/cjs/cl.muxdata.js +12 -12
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +71 -70
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +357 -356
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +66 -66
  38. package/cl.externs.js +17 -6
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +40 -40
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +16 -16
  44. package/cl.mse.js +199 -200
  45. package/cl.muxdata.js +8 -8
  46. package/cl.onboard.js +2 -2
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +4 -4
  49. package/cl.smooth.js +59 -58
  50. package/cl.thumbnails.js +16 -16
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +12 -12
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +13 -13
  56. package/cl.vtt.js +11 -11
  57. package/cl.youbora.js +15 -15
  58. package/package.json +5 -1
  59. package/typings.d.ts +100 -96
package/cl.muxdata.js CHANGED
@@ -1,8 +1,8 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Bt=function(a){let b={debug:!0,data:At(a)};a.g&&a.g.muxOptionsOverride&&_.mf(a.g.muxOptionsOverride)&&(b=_.jf(b,a.g.muxOptionsOverride,{getPlayheadTime:()=>1E3*a.l.getPosition(),getStateData:()=>{{a.f.debug("getStateData()");var c=a.l.getLoadedSource(),d=a.l.getTrackManager();const f=a.l.getSurface(),g=d.fa();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};
2
- if(c){const h=new _.Lj(c.url);e.video_source_url=_.sh(h);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;g&&g.height&&g.width&&(e.video_source_height=g.height,e.video_source_width=g.width);(d=d.ka())&&d.language&&(e.player_language_code=d.language)}return e}}));a.f.debug("Mux SDK options",b);return b},Ct=function(a,b,c){a.f.debug(`Event: ${b}`);mux.emit(a.A,b,c)},At=function(a){const b={env_key:a.g.envKey,
3
- video_title:a.m&&a.m.name||"",player_name:_.pa,player_software_name:_.pa,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},Dt=function(a){a.a.on(a.l,_.ve,()=>{Ct(a,_.ve,{player_playhead_time:1E3*a.l.getPosition()})});a.a.on(a.l,_.Sd,()=>Ct(a,_.Sd));a.a.on(a.l,_.fc,a.B.bind(a));a.a.on(a.l,_.ke,a.F.bind(a));a.a.on(a.l,_.De,()=>Ct(a,_.fe));a.a.on(a.l,_.Ce,()=>Ct(a,
4
- _.ee));a.a.on(a.l,_.Yc,a.C.bind(a));a.a.on(a.l,_.vb,()=>Ct(a,"adbreakstart"));a.a.on(a.l,_.wb,()=>Ct(a,"adbreakend"));a.a.on(a.l,_.Ib,()=>{Ct(a,"adplay");Ct(a,"adplaying")});a.a.on(a.l,_.Eb,()=>Ct(a,"adpause"));a.a.on(a.l,_.Gb,()=>{Ct(a,"adplay");Ct(a,"adplaying")});a.a.on(a.l,_.Jb,()=>Ct(a,"adended"));a.a.on(a.l,_.Ab,()=>Ct(a,"adfirstquartile"));a.a.on(a.l,_.Db,()=>Ct(a,"admidpoint"));a.a.on(a.l,_.Kb,()=>Ct(a,"adthirdquartile"))},Et=class{constructor(a,b){this.l=a;this.m=this.g=null;this.A=("000000"+
5
- (Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.vo;this.f=b;this.o=this.j=this.h=this.w=!1}initialize(a,b){this.g=a;this.m=b;this.w=!1;if(!this.h){try{this.h=!0,mux.init(this.A,Bt(this))}catch(c){throw this.h=!1,_.Pf(this.a),new _.H(1,9,9302,null,c);}Ct(this,"playerready")}this.j&&!this.o&&(Ct(this,"videochange",At(this)),this.j=!1);Dt(this)}release(){this.f.debug("release()");this.j?this.f.debug(_.ha):(_.Pf(this.a),this.j=!0,this.m=this.g=null)}destroy(){this.f.debug(_.Mc);
6
- this.o?this.f.debug(_.fa):(this.o=!0,this.h&&this.w&&Ct(this,"viewend"),Ct(this,"destroy"))}B(a){this.f.debug(_.Dd);var b=a.detail;a=this.l.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ca())&&a.bandwidth&&(b+=a.bandwidth),Ct(this,"renditionchange",{video_source_bitrate:b}))}F(a){this.f.debug(_.Hd);switch(a.detail.currentState){case _.Rl:this.l.getConfiguration().autoplay&&Ct(this,_.Sd);break;case _.Tl:Ct(this,_.Td);break;case _.Sl:Ct(this,_.Od);break;case _.Il:this.w=!0,Ct(this,_.Xc)}}C(a){this.f.debug(_.Ed);
7
- if(this.h&&(a=a.detail||null))if(10003===a.code)Ct(this,"aderror");else if(a.severity===_.F){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;Ct(this,_.Yc,{player_error_code:a.code,player_error_message:b})}}};var Ft=class extends _.jq{constructor(){super();this.f=null;this.a=!1;this.g=new _.O("clpp.muxdata")}onPlayerCreated(a){this.f=new Et(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();if(this.a=!_.z(c.muxdata)&&typeof c.muxdata===_.Cd){var d=c.muxdata;if(c="undefined"===typeof window.mux)c=d.muxLib,d="undefined"!==typeof c&&typeof c.init===_.$c&&typeof c.emit===_.$c,window.mux=c,c=d,c=!c;c&&(this.g.warn("Mux SDK is not loaded. Will do nothing."),this.a=!1,c=new _.H(1,9,9301),this.U(a,c))}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");
8
- if(this.a){c=a.getConfiguration();c=_.kf(c.muxdata||{});try{d=[];typeof c===_.Cd&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});this.f.initialize(c,b)}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 _.C(_.Yc,{detail:b}))}};_.x("clpp.muxdata.MuxDataPlugin",Ft);Ft.Id="mux";_.Tm(new class{create(){return new Ft}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Bt=function(a){let b={debug:!0,data:At(a)};a.g&&a.g.muxOptionsOverride&&_.mf(a.g.muxOptionsOverride)&&(b=_.jf(b,a.g.muxOptionsOverride,{getPlayheadTime:()=>1E3*a.l.getPosition(),getStateData:()=>{{a.f.debug("getStateData()");var c=a.l.getLoadedSource(),d=a.l.getTrackManager();const f=a.l.getSurface(),g=d.ga();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};
2
+ if(c){const h=new _.Kj(c.url);e.video_source_url=_.rh(h);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;g&&g.height&&g.width&&(e.video_source_height=g.height,e.video_source_width=g.width);(d=d.la())&&d.language&&(e.player_language_code=d.language)}return e}}));a.f.debug("Mux SDK options",b);return b},Ct=function(a,b,c){a.f.debug(`Event: ${b}`);mux.emit(a.A,b,c)},At=function(a){const b={env_key:a.g.envKey,
3
+ video_title:a.m&&a.m.name||"",player_name:_.oa,player_software_name:_.oa,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},Dt=function(a){a.a.on(a.l,_.ve,()=>{Ct(a,_.ve,{player_playhead_time:1E3*a.l.getPosition()})});a.a.on(a.l,_.Sd,()=>Ct(a,_.Sd));a.a.on(a.l,_.hc,a.B.bind(a));a.a.on(a.l,_.ke,a.F.bind(a));a.a.on(a.l,_.Ee,()=>Ct(a,_.fe));a.a.on(a.l,_.Ce,()=>Ct(a,
4
+ _.ee));a.a.on(a.l,_.$c,a.C.bind(a));a.a.on(a.l,_.wb,()=>Ct(a,"adbreakstart"));a.a.on(a.l,_.xb,()=>Ct(a,"adbreakend"));a.a.on(a.l,_.Kb,()=>{Ct(a,"adplay");Ct(a,"adplaying")});a.a.on(a.l,_.Gb,()=>Ct(a,"adpause"));a.a.on(a.l,_.Ib,()=>{Ct(a,"adplay");Ct(a,"adplaying")});a.a.on(a.l,_.Lb,()=>Ct(a,"adended"));a.a.on(a.l,_.Cb,()=>Ct(a,"adfirstquartile"));a.a.on(a.l,_.Fb,()=>Ct(a,"admidpoint"));a.a.on(a.l,_.Mb,()=>Ct(a,"adthirdquartile"))},Et=class{constructor(a,b){this.l=a;this.m=this.g=null;this.A=("000000"+
5
+ (Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.uo;this.f=b;this.o=this.j=this.h=this.w=!1}initialize(a,b){this.g=a;this.m=b;this.w=!1;if(!this.h){try{this.h=!0,mux.init(this.A,Bt(this))}catch(c){throw this.h=!1,_.Of(this.a),new _.G(1,9,9302,null,c);}Ct(this,"playerready")}this.j&&!this.o&&(Ct(this,"videochange",At(this)),this.j=!1);Dt(this)}release(){this.f.debug("release()");this.j?this.f.debug(_.ia):(_.Of(this.a),this.j=!0,this.m=this.g=null)}destroy(){this.f.debug(_.Oc);
6
+ this.o?this.f.debug(_.fa):(this.o=!0,this.h&&this.w&&Ct(this,"viewend"),Ct(this,"destroy"))}B(a){this.f.debug(_.Cd);var b=a.detail;a=this.l.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Aa())&&a.bandwidth&&(b+=a.bandwidth),Ct(this,"renditionchange",{video_source_bitrate:b}))}F(a){this.f.debug(_.Gd);switch(a.detail.currentState){case _.Ql:this.l.getConfiguration().autoplay&&Ct(this,_.Sd);break;case _.Sl:Ct(this,_.Td);break;case _.Rl:Ct(this,_.Od);break;case _.Hl:this.w=!0,Ct(this,_.Zc)}}C(a){this.f.debug(_.Dd);
7
+ if(this.h&&(a=a.detail||null))if(10003===a.code)Ct(this,"aderror");else if(a.severity===_.F){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;Ct(this,_.$c,{player_error_code:a.code,player_error_message:b})}}};var Ft=class extends _.jq{constructor(){super();this.f=null;this.a=!1;this.g=new _.O("clpp.muxdata")}onPlayerCreated(a){this.f=new Et(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();if(this.a=!_.z(c.muxdata)&&typeof c.muxdata===_.Bd){var d=c.muxdata;if(c="undefined"===typeof window.mux)c=d.muxLib,d="undefined"!==typeof c&&typeof c.init===_.bd&&typeof c.emit===_.bd,window.mux=c,c=d,c=!c;c&&(this.g.warn("Mux SDK is not loaded. Will do nothing."),this.a=!1,c=new _.G(1,9,9301),this.T(a,c))}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");
8
+ if(this.a){c=a.getConfiguration();c=_.kf(c.muxdata||{});try{d=[];typeof c===_.Bd&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.G(1,9,9300,{missingKeys:d});this.f.initialize(c,b)}catch(e){this.a=!1,this.T(a,e)}}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}T(a,b){a.trigger(new _.C(_.$c,{detail:b}))}};_.x("clpp.muxdata.MuxDataPlugin",Ft);Ft.Id="mux";_.Sm(new class{create(){return new Ft}});};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 zt=function(a,b){let c=b.baseUrl;_.Ng(c,"/")||(c+="/");const d=g=>g&&(_.Mg(g,"https://")||_.Mg(g,"http://")||_.Mg(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.gp(a);a.Ga(_.Ic,{licenseUrl:e,videoRobustness:[_.fb,void 0],audioRobustness:[_.eb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Zj,licenseResponse:_.ak}});a.Ga(_.Gc,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.ck,licenseResponse:_.dk,extractContentId:_.ek,certificateRequest:_.fk}});a.Ga(_.Hc,{licenseUrl:f,modifiers:{licenseRequest:_.Zj}});_.pj(a)};
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var zt=function(a,b){let c=b.baseUrl;_.Qg(c,"/")||(c+="/");const d=g=>g&&(_.Pg(g,"https://")||_.Pg(g,"http://")||_.Pg(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.gp(a);a.Fa(_.Kc,{licenseUrl:e,videoRobustness:[_.eb,void 0],audioRobustness:[_.db,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Yj,licenseResponse:_.Zj}});a.Fa(_.Ic,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.bk,licenseResponse:_.ck,extractContentId:_.dk,certificateRequest:_.ek}});a.Fa(_.Jc,{licenseUrl:f,modifiers:{licenseRequest:_.Yj}});_.oj(a)};
3
3
  _.x("clpp.onboard.OnboardComponent",class extends _.Lp{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}'`),zt(b,a))}release(){}id(){return"onboard"}});
4
4
  _.x("clpp.onboard.register",zt);};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 kt="A persistent DRM session already exists for: ",lt="No DRM configuration.",mt="clpp.persistent",nt=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},pt=function(a,b){a.I=ot;a.J=[];a.C=!0;return _.Vk(a,b)},rt=function(a,b,c,d,e,f){a.I=qt;const g=new Map,h=_.Jk(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Jd,persistentState:_.be,sessionTypes:[_.Qd],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
- audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Uk(a,g)},st=function(a,b){return _.w(function*(){const c=yield _.ll(a,b);if(c){var d=[],e=a.g.get(c);e&&a.A&&(e.kb=new _.Yk,d.push(e.kb));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)})},tt=function(a){a=a.g.keys();a=nt(a,b=>b.sessionId);return Array.from(a)},ut=function(a,b){const c=_.rj(a),d=_.Yi({drm:a});
3
- d.drm=a;a=new _.bm({vb:b,onError:()=>{},Md:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,oc:()=>null});a.h=c;return a},xt=function(a,b,c){return _.w(function*(){const d=vt;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)wt.debug(kt,e);else{var g=ut(a,c);try{yield pt(g,b);yield _.jl(g);yield _.ml(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Qh(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:tt(g),keySystem:h.keySystem,
4
- licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw wt.error("Error while persisting DRM session"),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else wt.debug(lt)})},ot=1,qt=2,yt=class{store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var kt="A persistent DRM session already exists for: ",lt="No DRM configuration.",mt="clpp.persistent",nt=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},pt=function(a,b){a.H=ot;a.I=[];a.C=!0;return _.Uk(a,b)},rt=function(a,b,c,d,e,f){a.H=qt;const g=new Map,h=_.Ik(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Jd,persistentState:_.be,sessionTypes:[_.Qd],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
+ audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Tk(a,g)},st=function(a,b){return _.w(function*(){const c=yield _.kl(a,b);if(c){var d=[],e=a.g.get(c);e&&a.A&&(e.jb=new _.Xk,d.push(e.jb));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)})},tt=function(a){a=a.g.keys();a=nt(a,b=>b.sessionId);return Array.from(a)},ut=function(a,b){const c=_.qj(a),d=_.Xi({drm:a});
3
+ d.drm=a;a=new _.am({ub:b,onError:()=>{},Kd:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,nc:()=>null});a.h=c;return a},xt=function(a,b,c){return _.w(function*(){const d=vt;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)wt.debug(kt,e);else{var g=ut(a,c);try{yield pt(g,b);yield _.il(g);yield _.ll(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Ph(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:tt(g),keySystem:h.keySystem,
4
+ licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw wt.error("Error while persisting DRM session"),new _.G(1,6,6200,null,h);}finally{yield g.destroy()}}}}else wt.debug(lt)})},ot=1,qt=2,yt=class{store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
5
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 _.w(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 _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(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 wt.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});vt=a});
7
- _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=vt,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Wl(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(lt);var g=b.offlineId;if(typeof g!==_.ne||!g.length)throw e("Missing offline id.");if(yield d.get(g))wt.debug(kt,g);else{var h=_.Yi();d=new _.Qm;g=[];for(var k of c){const l=new k;_.aj(l.id())||(l.f(null),_.cj(l),g.push(l))}k=null;try{k=yield _.In(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.F,4,4014));const m=_.Gn(l.periods);yield xt(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(),_.$i.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
- _.x("clpp.persistent.removeLicense",function(a){return _.w(function*(){var b=vt;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 _.Qm,c=ut(e.drmConfig,d),yield rt(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.jl(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield st(c,f);wt.debug("successfully removed session with id",f)}))),yield b.delete(a)):wt.debug("No persistent DRM session found")}catch(e){throw wt.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 wt.warn("Invalid offlineId")})});var vt=new yt,wt=new _.O(mt);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.Lp{constructor(){super();this.l=null;this.j=vt;this.h=new _.O(mt)}f(a){this.l=a}a(){this.l=null}release(){}g(){this.j=vt}id(){return _.Pd}o(a,b,c){const d=this;return _.w(function*(){if(a)try{yield xt(a,b,c),d.l.trigger(new _.C(_.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 _.w(function*(){try{const c=yield b.j.get(a);if(c)return c.sessionIds;
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 _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(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 wt.warn("Invalid session storage implementation"),new _.G(1,6,6202,{missingMethods:b});vt=a});
7
+ _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=vt,e=(l,m)=>new _.G(1,6,6200,l,m);const f=_.Vl(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(lt);var g=b.offlineId;if(typeof g!==_.ne||!g.length)throw e("Missing offline id.");if(yield d.get(g))wt.debug(kt,g);else{var h=_.Xi();d=new _.Pm;g=[];for(var k of c){const l=new k;_.$i(l.id())||(l.f(null),_.bj(l),g.push(l))}k=null;try{k=yield _.Hn(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 _.G(_.F,4,4014));const m=_.Fn(l.periods);yield xt(b,m,d)}catch(l){if(l instanceof _.G&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.Zi.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
+ _.x("clpp.persistent.removeLicense",function(a){return _.w(function*(){var b=vt;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 _.Pm,c=ut(e.drmConfig,d),yield rt(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.il(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield st(c,f);wt.debug("successfully removed session with id",f)}))),yield b.delete(a)):wt.debug("No persistent DRM session found")}catch(e){throw wt.error("Failed to remove session"),
10
+ new _.G(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else wt.warn("Invalid offlineId")})});var vt=new yt,wt=new _.O(mt);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.Lp{constructor(){super();this.l=null;this.j=vt;this.h=new _.O(mt)}f(a){this.l=a}a(){this.l=null}release(){}g(){this.j=vt}id(){return _.Pd}o(a,b,c){const d=this;return _.w(function*(){if(a)try{yield xt(a,b,c),d.l.trigger(new _.C(_.Tc,{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 _.w(function*(){try{const c=yield b.j.get(a);if(c)return c.sessionIds;
11
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);
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 ht=function(a,b){return 0<=b&&b<a.a.length},it=function(a){a.trigger(new _.C(_.Vd))},jt=class extends _.ap{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.Be.bind(this)}getPosition(){return this.f}yf(){return this.a}rd(){return 0<this.a.length&&ht(this,this.f)?this.a[this.f]:null}zf(){const a=this.f+1;return 0<
2
- this.a.length&&ht(this,a)?this.a[a]:null}Ef(){return this.g}start(){this.g||(this.g=!0,this.l.on(_.Xc,this.h),this.Uc(this.f,!0))}stop(){this.g=!1;this.l.off(_.Xc,this.h)}Be(){this.next()}next(){const a=this;return _.w(function*(){yield a.Uc(Math.min(a.a.length-1,a.f+1))})}Of(){const a=this;return _.w(function*(){yield a.Uc(Math.max(0,a.f-1))})}Uc(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&ht(c,a)&&(b||c.f!==a)){c.f=a;var d=c.rd();d&&(yield c.j(d),yield c.l.load(d.configuration),
3
- c.trigger(new _.C(_.Ud,{item:d})))}})}append(a){this.a.push(a);it(this)}Df(a,b){if(0<=b&&b<=this.a.length){const c=this.rd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));it(this)}}remove(a){if(0<this.a.length&&ht(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);it(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;it(this)}};_.x("clpp.Playlist",jt);jt.prototype.clear=jt.prototype.clear;jt.prototype.remove=jt.prototype.remove;jt.prototype.insert=jt.prototype.Df;
4
- jt.prototype.append=jt.prototype.append;jt.prototype.goTo=jt.prototype.Uc;jt.prototype.previous=jt.prototype.Of;jt.prototype.next=jt.prototype.next;jt.prototype.onEnded=jt.prototype.Be;jt.prototype.stop=jt.prototype.stop;jt.prototype.start=jt.prototype.start;jt.prototype.isStarted=jt.prototype.Ef;jt.prototype.getUpcoming=jt.prototype.zf;jt.prototype.getCurrent=jt.prototype.rd;jt.prototype.getQueue=jt.prototype.yf;jt.prototype.getPosition=jt.prototype.getPosition;jt.prototype.off=jt.prototype.off;
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ht=function(a,b){return 0<=b&&b<a.a.length},it=function(a){a.trigger(new _.C(_.Vd))},jt=class extends _.ap{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.ze.bind(this)}getPosition(){return this.f}uf(){return this.a}qd(){return 0<this.a.length&&ht(this,this.f)?this.a[this.f]:null}vf(){const a=this.f+1;return 0<
2
+ this.a.length&&ht(this,a)?this.a[a]:null}zf(){return this.g}start(){this.g||(this.g=!0,this.l.on(_.Zc,this.h),this.Uc(this.f,!0))}stop(){this.g=!1;this.l.off(_.Zc,this.h)}ze(){this.next()}next(){const a=this;return _.w(function*(){yield a.Uc(Math.min(a.a.length-1,a.f+1))})}Jf(){const a=this;return _.w(function*(){yield a.Uc(Math.max(0,a.f-1))})}Uc(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&ht(c,a)&&(b||c.f!==a)){c.f=a;var d=c.qd();d&&(yield c.j(d),yield c.l.load(d.configuration),
3
+ c.trigger(new _.C(_.Ud,{item:d})))}})}append(a){this.a.push(a);it(this)}yf(a,b){if(0<=b&&b<=this.a.length){const c=this.qd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));it(this)}}remove(a){if(0<this.a.length&&ht(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);it(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;it(this)}};_.x("clpp.Playlist",jt);jt.prototype.clear=jt.prototype.clear;jt.prototype.remove=jt.prototype.remove;jt.prototype.insert=jt.prototype.yf;
4
+ jt.prototype.append=jt.prototype.append;jt.prototype.goTo=jt.prototype.Uc;jt.prototype.previous=jt.prototype.Jf;jt.prototype.next=jt.prototype.next;jt.prototype.onEnded=jt.prototype.ze;jt.prototype.stop=jt.prototype.stop;jt.prototype.start=jt.prototype.start;jt.prototype.isStarted=jt.prototype.zf;jt.prototype.getUpcoming=jt.prototype.vf;jt.prototype.getCurrent=jt.prototype.qd;jt.prototype.getQueue=jt.prototype.uf;jt.prototype.getPosition=jt.prototype.getPosition;jt.prototype.off=jt.prototype.off;
5
5
  jt.prototype.one=jt.prototype.one;jt.prototype.on=jt.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 XE="Full MP4 box must have flags defined",YE="clpp.smooth.SmoothMP4Processor",ZE="codecPrivateData",$E=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.L(a,c);_.L(a,b)},aF=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.vj()}},bF=function(a,b){aF(a,b>>16&255);aF(a,b>>8&255);aF(a,b&255)},cF=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.vj()}},dF=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.vj()}},eF=function(a,b){try{a.f.setInt16(a.a,
2
- b,a.g),a.a+=2}catch(c){_.vj()}},fF=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},gF=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},hF=function(a,b,c,d){c=b.qe[c];b=b.bg;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 _.wu([a],[b])[0]},iF=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.v?c=["maxWidth","maxHeight","bitrate",ZE,"fourCC"]:a.type===_.Zb&&(c=["bitrate",ZE,"channels","bitsPerSample","samplingRate","fourCC"]);return _.rf(a,b,c,["id","segmentIndex"])},jF=function(a,b,c){const d=c.Nc.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ha:null,Jb:null,width:NaN,height:NaN,Cb:null,Hc:NaN,
4
- sampleSize:NaN,channelCount:NaN};switch(c.type){case _.v:a.Ha=[_.hj(d[1])];a.Jb=[_.hj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Zb:a.Cb=_.hj(c.Nc),a.sampleSize=c.$e||16,a.Hc=c.Hc,a.channelCount=c.le}return a},kF=function(a,b){return a.filter(c=>c.type===b)},lF=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)},sF=function(a,b,c){var d=null;if(mF.test(a)){{a=mF.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 nF.test(a)?d=lF(nF,a):oF.test(a)?d=lF(oF,a):pF.test(a)?(a=pF.exec(a),d=Number(a[1])/c.frameRate):qF.test(a)?(a=qF.exec(a),d=Number(a[1])/c.a):rF.test(a)&&(d=lF(rF,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},tF=function(a){let b=
6
- 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Pj(b)},AF=function(a,b,c){a:{var d=[_.Ic,_.Hc];for(e of d)if((d=c.Sc(e))&&d.keyId){var e=d.keyId;break a}_.B(YE,"Could not get default Key ID for DRM init data!");e=null}c=new uF("xxxx");a.type===_.v?c=new vF(a.width,a.height):c=new wF(a.channelCount,a.sampleSize,a.Hc);a=new xF;a.g=1;a.h=8;a.m=e||"00000000000000000000000000000000";a=(new uF("schi")).append([a]);b=(new uF(_.he)).append([new yF(b),new zF(_.rc,65536),a]);c.append([b]);return c},
7
- cG=function(a,b){var c=b.Xc(),d=new BF(a.timescale,a.duration,a.id),e=(new CF).append([new DF(a.id)]),f=new EF(a.id,a.duration,a.timescale,a.width,a.height),g=new FF(a.timescale,a.duration);const h=new GF(a.type);var k=null,l=new HF;l.entries=[new IF];var m=new JF;switch(a.type){case _.v:k=new KF(a.Ha,a.Jb);c?(a=AF(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new LF(a.width,a.height)).append([k]),m.entries=[a]);k=new MF;break;case _.Zb:k=new NF(a.Cb),c?(a=AF(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
- (a=(new OF(a.channelCount,a.sampleSize,a.Hc)).append([k]),m.entries=[a]),k=new PF}m=(new QF).append([m,new RF,new SF,new TF,new UF]);l=(new VF).append([l]);l=(new WF).append([k,l,m]);g=(new XF).append([g,h,l]);f=(new YF).append([f,g]);d=(new ZF).append([d,f,e]);e=new $F("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Sc(_.Hc),b=b.Sc(_.Ic),c&&d.append([new aG("pssh",c.initData,8)]),b&&d.append([new aG("pssh",b.initData,8)]),c||b||_.B(YE,"Could not get PSSH init data!"));b=new bG([e,d]);return _.G(b.write())},
9
- mG=function(a,b){let c,d,e,f,g,h;(new _.Nj).N("moof",_.N).Y("mfhd",k=>{{const l=new dG;l.g=_.M(k.H);c=l}}).N("traf",_.N).Y("tfhd",k=>{{const l=k.H.wa();if(null===k.flags)throw new _.H(_.F,3,3019,XE);const m=new eG(k.version||0,k.flags||0);m.g=_.M(k.H);0<l-k.H.getPosition()&&k.flags&1&&(m.h=_.Dj(k.H));0<l-k.H.getPosition()&&k.flags&2&&(m.A=_.M(k.H));0<l-k.H.getPosition()&&k.flags&8&&(m.j=_.M(k.H));0<l-k.H.getPosition()&&k.flags&16&&(m.o=_.M(k.H));0<l-k.H.getPosition()&&k.flags&32&&(m.m=_.M(k.H));d=
10
- m}}).Y("trun",k=>{{var l=k.H.wa();if(null===k.flags)throw new _.H(_.F,3,3019,XE);const m=new fG(k.version||0,k.flags||0);m.g=_.M(k.H);0<l-k.H.getPosition()&&k.flags&1&&(m.j=_.Bj(k.H));0<l-k.H.getPosition()&&k.flags&4&&(m.m=_.M(k.H));if(0<l-k.H.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.o.push(_.M(k.H)),k.flags&512&&m.sampleSize.push(_.M(k.H)),k.flags&1024&&m.A.push(_.M(k.H)),k.flags&2048&&(0===k.version?m.h.push(_.M(k.H)):m.h.push(_.Bj(k.H)));e=m}}).Y("sdtp",k=>{{const l=_.Ej(k.H,k.H.wa());f=
11
- new gG("sdtp",k.version||0,k.flags||0,l,0)}}).N("uuid",k=>{var l=_.Ej(k.H,16);if(_.jj(l,hG)){l=_.M(k.H);k.version=l>>>24;k.flags=l&16777215;l=new iG(k.version,k.flags);l.h=_.M(k.H);k.flags&1&&(l.j=_.zj(k.H));for(let m=0;m<l.h;m++){const n={te:_.Ej(k.H,8),tc:0,Yd:[]};if(k.flags&2){n.tc=_.Aj(k.H);for(let q=0;q<n.tc;q++){const t={je:0,ke:0};t.je=_.Aj(k.H);t.ke=_.M(k.H);n.Yd.push(t)}}l.g.push(n)}g=l}}).N(_.rd,k=>{{const l=new jG;0<k.H.wa()?l.g=_.Ej(k.H,k.H.wa()):(_.B(YE,"mdat box is empty!"),l.g=new Uint8Array(0));
12
- h=l}}).parse(a,!1);if(!h)return null;a=(new kG).append([d,e]);f&&a.append([f]);b.Xc()&&g&&a.append([g]);b=(new lG).append([c,a]);return new bG([b,h])},rG=function(a,b,c){var d=c.Xc(),e=a.request.startTime,f=parseInt(e*b,10);b=a.data||new ArrayBuffer(0);var g=mG(b,c);if(null===g)return a.request.contentType===_.r?a.data:g;c=g.get(_.rd);if(a.request.contentType===_.r){d=c.g.buffer;if(e){d=_.Ig(d);if((d=(new DOMParser).parseFromString(d,_.ue))&&"tt"===d.documentElement.tagName.toLowerCase())var h=d.documentElement;
13
- if(h&&(c=new nG(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=e;b=c;g=["begin",_.Wc];for(let y=0,A=g.length;y<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 E=l.length;for(;n<E;n++){var q=l[n].name;if(q=q.match(m)){k=
14
- k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[y],sF(k||"",a,b))}}}d=(new XMLSerializer).serializeToString(d);e=_.Jg(d).buffer}else e=d;return e}h=new lG;a=g.get("mfhd");b=new kG;k=g.get("tfhd");m=new oG(1,f);f=g.get("trun");n=g.get("sdtp");e=g.get("senc");k.g=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(d){g=0;k=[];if(e.flags&2)for(k=[],m=0;m<e.h;m++)k.push(10+6*e.g[m].tc);else g=8;b.append([e,new pG,new qG(g,k,e.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;c=new bG([h,
15
- c]);h=c.write();d&&(d=c.get("saio"),c=c.f,d.offset[0]=e.start+16,c.seek(d.start),d.write(c),h=c.buffer);return h},sG=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},tG=function(a){return{initData:_.nu(_.vk(a)),initDataType:_.rc,keyId:a,periodId:null}},uG=function(a,b,c){a=_.Dk(a);c&&a.version!==c&&(a=_.pu(a,c));return{initData:_.nu(a),
16
- initDataType:_.rc,keyId:b,periodId:null}},vG=function(a,b){return _.w(function*(){var c=_.ch(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;c.type=1;c=yield a.D.networkingEngine.fetch(c).R;a.m=c.uri;return c})},DG=function(a,b){let c=null;try{{const xa=new DOMParser;let ib,Oa;try{const cb=_.Ig(b);
17
- Oa=xa.parseFromString(cb.trim(),_.ue)}catch(cb){throw cb;}Oa&&Oa.documentElement.tagName==_.kb&&(ib=Oa.documentElement);c=ib&&0<ib.getElementsByTagName("parsererror").length?null:ib}}catch(xa){}if(!c)throw a.f.error("Unable to parse manifest"),new _.H(_.F,4,4033,a.m);const d=+wG(a,c,"MajorVersion"),e=+wG(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||1E7;let g=+wG(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||
18
- Infinity,m=_.pk(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.f.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.F,4,4036,a.m);h?(xG(a,yG),a.B=typeof a.g.liveRefreshPeriod===_.p?1E3*a.g.liveRefreshPeriod:Math.min(1E3*a.G,1E4),g=Infinity):xG(a,zG);a.a={startTime:0,delay:0,duration:g/f,nd:l/f,Cc:0};if(m){{var n=a.g.playreadyVersion;const xa=[],ib=_.pk(m,"ProtectionHeader")[0],Oa=_.gj(_.rk(ib)||""),cb=_.Dk(Oa).a;xa.push(sG(_.Ic,tG(cb),[cb]));xa.push(sG(_.Hc,uG(Oa,
19
- cb,n),[cb]));var q=xa}a.o=q}{const xa=[],ib=_.pk(c,"StreamIndex");if(!ib.length)throw a.f.error("No streams found!"),new _.H(_.F,4,4034,a.m);for(let Oa=0;Oa<ib.length;Oa++){{var t=a,u=ib[Oa];const cb=wG(t,u,"Type"),ic=+u.getAttribute("Chunks"),Qg=u.getAttribute("Subtype"),Fe=_.Oh(u.getAttribute("Language")||_.ye),Kd=u.getAttribute("Name")||"",Rg=+u.getAttribute(_.Ma),Af=+u.getAttribute(_.La),Bf=wG(t,u,"Url"),Fk=+u.getAttribute("TimeScale")||null;{const jc=[],li=_.pk(u,_.Za);for(let Ld=0;Ld<li.length;Ld++){{let kc,
20
- Ia,hd;var y=t,A=li[Ld],E=cb;const mi=+A.getAttribute("Index"),Cf=+wG(y,A,"Bitrate");let Pb=NaN,Df=NaN,Gk=NaN,mp=NaN,xy=NaN,yy=NaN,zy=NaN;const Ay=A.getAttribute("FourCC");switch(E){case _.v:Pb=+wG(y,A,_.La);Df=+wG(y,A,_.Ma);break;case _.Zb:mp=+A.getAttribute("Channels")||2,Gk=+wG(y,A,"SamplingRate"),yy=+wG(y,A,"AudioTag"),xy=+wG(y,A,"BitsPerSample"),zy=+wG(y,A,"PacketSize")}let np=String(A.getAttribute("CodecPrivateData"));if(E===_.Zb&&!np){{var D=mp;const By={96E3:0,88200:1,64E3:2,48E3:3,44100:4,
21
- 32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Hk=By[Gk];if("AACH"===Ay){Ia=new Uint8Array(4);const Cy=By[2*Gk];Ia[0]=40|Hk>>1;Ia[1]=Hk<<7|D<<3|Cy>>1;Ia[2]=Cy<<7|8;Ia[3]=0;kc=new Uint16Array(2);kc[0]=(Ia[0]<<8)+Ia[1];kc[1]=(Ia[2]<<8)+Ia[3];hd=kc[0].toString(16)+kc[1].toString(16)}else Ia=new Uint8Array(2),Ia[0]=16|Hk>>1,Ia[1]=Hk<<7|D<<3,kc=new Uint16Array(1),kc[0]=(Ia[0]<<8)+Ia[1],hd=kc[0].toString(16);np=hd.toUpperCase()}}var ma={id:y.V++,type:E,index:mi,bitrate:Cf,Nc:np,maxHeight:Pb,
22
- maxWidth:Df,Hc:Gk,le:mp,kg:yy,$e:xy,wg:zy,rf:Ay,segmentIndex:null}}jc.push(ma)}var na=jc}{const jc=[],li=_.pk(u,"c");for(let Ld=0;Ld<li.length;Ld++){const kc=li[Ld];let Ia=parseInt(kc.getAttribute("t"),10),hd=parseInt(kc.getAttribute("d"),10),mi=parseInt(kc.getAttribute("r"),10),Cf=0;if(isNaN(Ia)&&isNaN(hd))throw t.f.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.H(_.F,4,4037,t.m);0===Ld&&isNaN(Ia)&&(Cf=Ia=0);if(0<Ld){const Pb=jc[jc.length-
23
- 1];Cf=Pb.n+1;Pb.d||(Pb.d=Ia-Pb.t);Ia||(Ia=Pb.t+Pb.d);hd||(hd=Ia-Pb.t)}jc.push({n:Cf,d:hd,t:Ia});if(mi){mi--;for(let Pb=0;Pb<mi;Pb++){const Df=jc[jc.length-1];Cf=Df.n+1;Ia=Df.t+Df.d;hd=Df.d;jc.push({n:Cf,d:hd,t:Ia})}}}t.C()||jc.length===ic||t.f.warn("Number of fragments ("+ic+") differs from number of chunks ("+jc.length+").");var uf=jc}var vf={type:cb,ng:ic,Yf:Qg,language:Fe,name:Kd,maxWidth:Rg,maxHeight:Af,bg:Bf,tracks:na,qe:uf,timescale:Fk}}xa.push(vf)}var wf=xa}const Ra={ug:d,xe:e,timescale:f,
24
- duration:g,isLive:h,tg:k,nd:l,wd:!1,streams:wf};if(a.h&&a.w)return AG(a,Ra),Promise.resolve();{const xa=Ra.timescale,ib=Ra.duration,Oa=kF(Ra.streams,_.Zb),cb=kF(Ra.streams,_.v),ic=kF(Ra.streams,_.r),Qg=[];let Fe=BG(a,ib,xa,Oa),Kd=BG(a,ib,xa,cb);const Rg=BG(a,ib,xa,ic);Fe.length||(Fe=[null]);Kd.length||(Kd=[null]);for(let Af=0;Af<Kd.length;Af++)for(let Bf=0;Bf<Fe.length;Bf++)Qg.push(CG(a,Kd[Af],Fe[Bf]));var fd={startTime:0,variants:Qg,textStreams:Rg,thumbStreams:[]}}{var id=Ra.streams;let xa=a.a.startTime,
25
- ib=a.a.delay;const Oa=a.I;let cb=Math.min(a.a.duration||Infinity,Oa);const ic=a.C(),Qg=a.a.nd,Fe=a.a.Cc,Kd=a.G,Rg=isFinite(a.F)?a.F:0;if(ic)cb=Infinity,xa=Date.now()/1E3-Fe,a.a.startTime=xa,ib=3*Kd;else{const Af=isFinite(Oa)?Oa:a.a.duration;for(const Bf of id)for(const Fk of Bf.tracks)Fk.segmentIndex.offset(-Rg),_.gv(Fk.segmentIndex,Af)}a.A=new _.Bz(xa,ib,!ic,!0);a.A.Mb(cb);_.Uu(a.A,Kd);a.A.ac=Qg;ic||a.A.offset(-Rg)}a.D.filterAllPeriods([fd]);a.h={presentationTimeline:a.A,periods:[fd],offlineSessionIds:[],
26
- minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.ed(a.L),a.K=!0);a.w=Ra;return Promise.resolve()},EG=function(a,b){null!=a.B&&null!=b&&(a.j=window.setTimeout(a.wb.bind(a),b))},wG=function(a,b,c){if(b=b.getAttribute(c))return b;a.f.error("required attribute not provided: "+c);throw new _.H(_.F,4,4038,a.m,c);},xG=function(a,b){const c=b===zG;if(a.h&&a.h.presentationTimeline){var d=a.h.presentationTimeline;d.j=c;d.m=c}c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.B=null);a.O=b},AG=
27
- 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){iF(g,c)||a.f.warn("The current stream is updated with a stream that seems to have different base properties!");var d=FG(a,a.w.timescale,f,c);c=g.segmentIndex;_.cv(c,d);(d=a.a.nd)&&_.dv(c,_.av(c)-d)}else a.f.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},FG=function(a,
28
- b,c,d){let e=0;const f=[],g=c.timescale||b;c.qe.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=hF(a.m,c,k,d);a.G=Math.max(a.G,l);f.push(new _.bv(k,h,m,()=>[n],0,null,0,null,!0,g));e+=l});if(c.type===_.v||c.type===_.Zb)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Cc?a.a.Cc=b.endTime:a.a.Cc=Math.min(a.a.Cc,b.endTime);return f},BG=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=FG(a,c,k,h),m=new _.Cz(l),
29
- n=null;k.type!==_.r&&(n=GG(a,b,c,k,h));h.segmentIndex=m;l=a.M++;var q=Promise.resolve.bind(Promise),t=m.f.bind(m),u=m.get.bind(m),y=m.g.bind(m);m=m.getDuration.bind(m);var A=HG[k.type];var E="";switch(k.type){case _.v:E=h.Nc;var D=/00000001[0-9]7/.exec(E);E="avc1."+(D&&D[0]?E.substr(E.indexOf(D[0])+10,6):"42c00c");a.f.debug("VIDEO CODECS: ",E);break;case _.Zb:E=h.Nc,D=2,"AACH"===h.rf?D=5:E&&(D=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+D,a.f.debug("AUDIO CODECS: ",E)}D=k.type===_.r?IG[k.Yf]:
30
- void 0;return h={id:l,originalId:null,yg:null,createSegmentIndex:q,findSegmentPosition:t,getSegmentReference:u,adjustSegmentDurations:y,getDuration:m,segmentIndex:null,segmentLookupStrategy:_.Yt,initSegmentReference:n,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:D,encrypted:a.J(),keyId:null,language:k.language,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.le||null,closedCaptions:null}});
31
- e=e.concat(g)}return e},CG=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.ye;return c||b?{id:a.M++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},GG=function(a,b,c,d,e){b=jF(b,d.timescale||c,e);c={isLive:a.C.bind(a),Xc:a.J.bind(a),wf:()=>1,Sc:a.S.bind(a)};d=new Uint8Array(0);try{d=cG(b,c)}catch(g){throw a.f.error("Failed to generate initialization segment."),new _.H(_.F,3,4035,g);}const f="data:text/plain;base64,"+
32
- _.fj(d);return new _.Az(()=>[f],0,null,null,!0)},uF=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;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=
33
- 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?_.L(a,1):_.L(a,this.size);_.wj(a,fF(this.type));this.size>b&&$E(a,this.size);"uuid"===this.type&&_.wj(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()}},JG=class extends uF{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);aF(a,
34
- this.version);bF(a,this.flags)}},aG=class extends uF{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);_.wj(a,this.g,this.offset);a.getPosition()}},gG=class extends JG{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);_.wj(a,this.g,this.offset);a.getPosition()}},$F=class extends uF{constructor(a,b,c){super("ftyp");this.h=a;this.xe=b;this.g=
35
- c}a(){let a=this.h.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.wj(a,fF(this.h));_.L(a,this.xe);_.wj(a,fF(this.g.join("")));a.getPosition()}},ZF=class extends uF{constructor(){super(_.xd)}},YF=class extends uF{constructor(){super(_.we)}},BF=class extends JG{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,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?
36
- a+28:a+16;a=a+44+this.g.length;return a+=super.a()}write(a){super.write(a);1===this.version?($E(a,0),$E(a,0),_.L(a,this.timescale),$E(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.timescale),_.L(a,this.duration*this.timescale));_.L(a,65536);cF(a,this.volume);cF(a,0);_.L(a,0);_.L(a,0);for(let b=0;b<this.g.length;b++)aF(a,this.g[b]);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,this.h);a.getPosition()}},CF=class extends uF{constructor(){super("mvex")}},DF=class extends JG{constructor(a){super("trex",
37
- 0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.L(a,this.g);_.L(a,1);_.L(a,0);_.L(a,0);_.L(a,0);a.getPosition()}},EF=class extends JG{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+this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?($E(a,0),$E(a,0),_.L(a,
38
- this.h),_.L(a,0),$E(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.h),_.L(a,0),_.L(a,this.duration*this.timescale));_.L(a,0);_.L(a,0);cF(a,0);cF(a,0);cF(a,this.volume);cF(a,0);for(let b=0;b<this.g.length;b++)aF(a,this.g[b]);cF(a,this.width);cF(a,0);cF(a,this.height);cF(a,0);a.getPosition()}},FF=class extends JG{constructor(a,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);
39
- 1===this.version?($E(a,0),$E(a,0),_.L(a,this.timescale),$E(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.timescale),_.L(a,this.duration*this.timescale));cF(a,this.language);cF(a,0);a.getPosition()}},GF=class extends JG{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.L(a,0);this.g===_.v?_.wj(a,fF("vide")):_.wj(a,fF("soun"));_.L(a,0);_.L(a,0);_.L(a,0);this.g===_.v?_.wj(a,fF("VideoHandler\x00")):_.wj(a,fF("SoundHandler\x00"));a.getPosition()}},
40
- MF=class extends JG{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);cF(a,0);_.wj(a,this.g);a.getPosition()}},KG=class extends uF{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.L(a,0);cF(a,0);cF(a,1)}},LG=class extends KG{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);cF(a,0);cF(a,0);_.L(a,0);_.L(a,0);_.L(a,0);cF(a,
41
- this.width);cF(a,this.height);_.L(a,4718592);_.L(a,4718592);_.L(a,0);cF(a,1);aF(a,10);_.wj(a,fF("AVC Coding",31));cF(a,this.depth);eF(a,-1)}},MG=class extends KG{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);_.L(a,0);_.L(a,0);cF(a,this.channelCount);cF(a,this.sampleSize);eF(a,0);cF(a,0);cF(a,this.sampleRate);cF(a,0)}},LF=class extends LG{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);
42
- for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},vF=class extends LF{constructor(a,b){super(a,b);this.type="encv"}},OF=class extends MG{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()}},wF=class extends OF{constructor(a,b,c){super(a,b,c);this.type="enca"}},KF=class extends uF{constructor(a,b){super("avcC");this.Ha=a;this.Jb=b;this.version=1;this.g=this.Ha[0][1];this.h=this.Ha[0][2];this.level=this.Ha[0][3]}a(){let a=
43
- 7;for(var b=0;b<this.Ha.length;b++)a+=2,a+=this.Ha[b].byteLength;for(b=0;b<this.Ha.length;b++)a+=2,a+=this.Jb[b].byteLength;return a+super.a()}write(a){super.write(a);aF(a,this.version);aF(a,this.g);aF(a,this.h);aF(a,this.level);aF(a,255);aF(a,224|this.Ha.length);for(var b=0;b<this.Ha.length;b++)cF(a,this.Ha[b].length),_.wj(a,this.Ha[b]);aF(a,this.Jb.length);for(b=0;b<this.Jb.length;b++)cF(a,this.Jb[b].length),_.wj(a,this.Jb[b]);a.getPosition()}},NF=class extends JG{constructor(a){super("esds",0,
44
- 0);this.Cb=a}a(){return 22+(this.Cb.byteLength+3)+super.a()}write(a){super.write(a);aF(a,3);aF(a,23+this.Cb.byteLength);cF(a,1);aF(a,0);aF(a,4);aF(a,15+this.Cb.byteLength);aF(a,64);aF(a,21);bF(a,0);_.L(a,0);_.L(a,0);aF(a,5);aF(a,this.Cb.byteLength);_.wj(a,this.Cb);_.wj(a,new Uint8Array([6,1,2]));a.getPosition()}},IF=class extends JG{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.wj(a,fF(this.location));
45
- a.getPosition()}},HF=class extends JG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},QF=class extends uF{constructor(){super(_.me)}},JF=class extends JG{constructor(){super(_.oe,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);
46
- _.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},RF=class extends JG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},SF=class extends JG{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();
47
- return a+super.a()}write(a){super.write(a);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},UF=class extends JG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},TF=class extends JG{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);
48
- _.L(a,0);_.L(a,0);a.getPosition()}},PF=class extends JG{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);eF(a,0);cF(a,0);a.getPosition()}},VF=class extends uF{constructor(){super("dinf")}},WF=class extends uF{constructor(){super(_.wd)}},XF=class extends uF{constructor(){super(_.sd)}},oG=class extends JG{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);1===this.version?$E(a,this.g):_.L(a,this.g);
49
- a.getPosition()}},dG=class extends JG{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.L(a,this.g);a.getPosition()}},fG=class extends JG{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&NG&&(a+=4);this.flags&OG&&(a+=4);for(let b=0;b<this.g;b++)this.flags&PG&&(a+=4),this.flags&QG&&(a+=4),this.flags&RG&&(a+=4),this.flags&SG&&(a+=4);return a+super.a()}write(a){super.write(a);_.L(a,
50
- this.g);this.flags&NG&&(a.getPosition(),dF(a,this.j));this.flags&OG&&_.L(a,this.m);for(let b=0;b<this.g;b++)this.flags&PG&&_.L(a,this.o[b]),this.flags&QG&&_.L(a,this.sampleSize[b]),this.flags&RG&&_.L(a,this.A[b]),this.flags&SG&&(0===this.version?_.L(a,this.h[b]):dF(a,this.h[b]));a.getPosition()}},NG=1,OG=4,PG=256,QG=512,RG=1024,SG=2048,eG=class extends JG{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&TG&&(a+=8);this.flags&UG&&(a+=4);this.flags&
51
- VG&&(a+=4);this.flags&WG&&(a+=4);this.flags&XG&&(a+=4);return a+super.a()}write(a){super.write(a);_.L(a,this.g);this.flags&TG&&$E(a,this.h);this.flags&UG&&_.L(a,this.A);this.flags&VG&&_.L(a,this.j);this.flags&WG&&_.L(a,this.o);this.flags&XG&&_.L(a,this.m);a.getPosition()}},TG=1,UG=2,VG=8,WG=16,XG=32,kG=class extends uF{constructor(){super("traf")}},lG=class extends uF{constructor(){super("moof")}},jG=class extends uF{constructor(){super(_.rd);this.g=new Uint8Array(0)}a(){return this.g.byteLength+
52
- super.a()}write(a){super.write(a);0<this.g.byteLength&&_.wj(a,this.g)}},xF=class extends JG{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);aF(a,0);0===this.version?aF(a,0):aF(a,0);aF(a,this.g);aF(a,this.h);_.wj(a,_.hj(this.m));if(1===this.g&&0===this.h){aF(a,0);for(let b=0;b<this.j.length;b++)aF(a,this.j[b])}a.getPosition()}},zF=class extends JG{constructor(a,b){super("schm",
53
- 0,0);this.g=a;this.h=b;this.yb=""}a(){let a=8;this.flags&1&&(a+=fF(this.yb).byteLength);return a+super.a()}write(a){super.write(a);_.wj(a,fF(this.g));_.L(a,this.h);this.flags&1&&_.wj(a,fF(this.yb));a.getPosition()}},yF=class extends uF{constructor(a){super("frma");this.g=a}a(){return fF(this.g).byteLength+super.a()}write(a){super.write(a);_.wj(a,fF(this.g));a.getPosition()}},pG=class extends JG{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&&(_.L(a,0),_.L(a,0));_.L(a,1);for(let b=0;1>b;b++)0===this.version?_.L(a,this.offset[b]):$E(a,this.offset[b]);a.getPosition()}},qG=class extends JG{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&&(_.L(a,0),_.L(a,0));aF(a,this.g);_.L(a,this.h);if(0===this.g)for(let b=0;b<this.h;b++)aF(a,
55
- this.j[b]);a.getPosition()}},iG=class extends JG{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].te.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].tc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.L(a,this.h);this.flags&1&&aF(a,this.j);for(let b=0;b<this.h;b++)if(_.wj(a,this.g[b].te),this.flags&2){cF(a,this.g[b].tc);for(let c=0;c<this.g[b].tc;c++)cF(a,this.g[b].Yd[c].je),_.L(a,this.g[b].Yd[c].ke)}a.getPosition()}};var nG=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))}},mF=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,nF=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,oF=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,pF=/^(\d*\.?\d*)f$/,qF=/^(\d*\.?\d*)t$/,rF=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var bG=class{constructor(a){this.a=a;this.f=tF(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=tF(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var hG=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var YG=class{constructor(){this.w=this.h=this.g=this.D=null;this.M=1;this.V=0;this.m="";this.A=this.a=null;this.f=new _.O("clpp.smooth.SmoothParser");this.K=!1;this.j=this.B=null;this.O=zG;this.G=0;this.F=this.I=Infinity;this.o=[];this.L=this.T.bind(this)}configure(a){this.g=a}start(a,b){this.D=b;a=[...new Set([a,gF(a)])];return vG(this,a).then(c=>DG(this,c.data).then(()=>{EG(this,this.B);return this.h}))}stop(){this.D&&this.D.networkingEngine.Rd(this.L);this.B=this.w=this.h=this.g=this.D=null;this.j&&
56
- (clearTimeout(this.j),this.j=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.C())return vG(this,[this.m]).then(a=>DG(this,a.data).then(()=>this.h)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}wb(){this.f.debug(_.Rt);this.D&&(this.j=null,this.update().then(()=>{EG(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&EG(this,100))}))}C(){return this.O===yG}J(){return 0<this.o.length}S(a){let b=null;if(this.o.length)for(let c=
57
- 0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}T(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),Xc:this.J.bind(this),wf:()=>1,Sc:this.S.bind(this)};let d=!1;const e=new _.H(_.F,3,4035,null);let f=null;try{f=rG(a,b,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)}},HG={video:_.Je,
58
- audio:_.cc,text:_.Wb},zG="VOD",yG="LIVE",IG={gg:"caption",hg:_.fu};_.x("clpp.smooth.SmoothComponent",class extends _.Lp{constructor(){super()}f(){_.Ln.ism=YG;_.Jn[_.Xb]=YG}a(){_.jv("ism");_.kv(_.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 ZE="Full MP4 box must have flags defined",$E="clpp.smooth.SmoothMP4Processor",aF="codecPrivateData",bF=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.L(a,c);_.L(a,b)},cF=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.uj()}},dF=function(a,b){cF(a,b>>16&255);cF(a,b>>8&255);cF(a,b&255)},eF=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.uj()}},fF=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.uj()}},gF=function(a,b){try{a.f.setInt16(a.a,
2
+ b,a.g),a.a+=2}catch(c){_.uj()}},hF=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},iF=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},jF=function(a,b,c,d){c=b.oe[c];b=b.Xf;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 _.wu([a],[b])[0]},kF=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.u?c=["maxWidth","maxHeight","bitrate",aF,"fourCC"]:a.type===_.ac&&(c=["bitrate",aF,"channels","bitsPerSample","samplingRate","fourCC"]);return _.rf(a,b,c,["id","segmentIndex"])},lF=function(a,b,c){const d=c.Nc.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ga:null,Ib:null,width:NaN,height:NaN,Bb:null,Gc:NaN,
4
+ sampleSize:NaN,channelCount:NaN};switch(c.type){case _.u:a.Ga=[_.gj(d[1])];a.Ib=[_.gj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.ac:a.Bb=_.gj(c.Nc),a.sampleSize=c.Xe||16,a.Gc=c.Gc,a.channelCount=c.je}return a},mF=function(a,b){return a.filter(c=>c.type===b)},nF=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)},uF=function(a,b,c){var d=null;if(oF.test(a)){{a=oF.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 pF.test(a)?d=nF(pF,a):qF.test(a)?d=nF(qF,a):rF.test(a)?(a=rF.exec(a),d=Number(a[1])/c.frameRate):sF.test(a)?(a=sF.exec(a),d=Number(a[1])/c.a):tF.test(a)&&(d=nF(tF,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},vF=function(a){let b=
6
+ 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Oj(b)},CF=function(a,b,c){a:{var d=[_.Kc,_.Jc];for(e of d)if((d=c.Sc(e))&&d.keyId){var e=d.keyId;break a}_.B($E,"Could not get default Key ID for DRM init data!");e=null}c=new wF("xxxx");a.type===_.u?c=new xF(a.width,a.height):c=new yF(a.channelCount,a.sampleSize,a.Gc);a=new zF;a.g=1;a.h=8;a.m=e||"00000000000000000000000000000000";a=(new wF("schi")).append([a]);b=(new wF(_.he)).append([new AF(b),new BF(_.tc,65536),a]);c.append([b]);return c},
7
+ eG=function(a,b){var c=b.Xc(),d=new DF(a.timescale,a.duration,a.id),e=(new EF).append([new FF(a.id)]),f=new GF(a.id,a.duration,a.timescale,a.width,a.height),g=new HF(a.timescale,a.duration);const h=new IF(a.type);var k=null,l=new JF;l.entries=[new KF];var m=new LF;switch(a.type){case _.u:k=new MF(a.Ga,a.Ib);c?(a=CF(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new NF(a.width,a.height)).append([k]),m.entries=[a]);k=new OF;break;case _.ac:k=new PF(a.Bb),c?(a=CF(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
+ (a=(new QF(a.channelCount,a.sampleSize,a.Gc)).append([k]),m.entries=[a]),k=new RF}m=(new SF).append([m,new TF,new UF,new VF,new WF]);l=(new XF).append([l]);l=(new YF).append([k,l,m]);g=(new ZF).append([g,h,l]);f=(new $F).append([f,g]);d=(new aG).append([d,f,e]);e=new bG("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Sc(_.Jc),b=b.Sc(_.Kc),c&&d.append([new cG("pssh",c.initData,8)]),b&&d.append([new cG("pssh",b.initData,8)]),c||b||_.B($E,"Could not get PSSH init data!"));b=new dG([e,d]);return _.H(b.write())},
9
+ oG=function(a,b){let c,d,e,f,g,h;(new _.Mj).M("moof",_.N).X("mfhd",k=>{{const l=new fG;l.g=_.M(k.reader);c=l}}).M("traf",_.N).X("tfhd",k=>{{const l=k.reader.wa();if(null===k.flags)throw new _.G(_.F,3,3019,ZE);const m=new gG(k.version||0,k.flags||0);m.g=_.M(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.Cj(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.M(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.j=_.M(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.M(k.reader));
10
+ 0<l-k.reader.getPosition()&&k.flags&32&&(m.m=_.M(k.reader));d=m}}).X("trun",k=>{{var l=k.reader.wa();if(null===k.flags)throw new _.G(_.F,3,3019,ZE);const m=new hG(k.version||0,k.flags||0);m.g=_.M(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.Aj(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.m=_.M(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.o.push(_.M(k.reader)),k.flags&512&&m.sampleSize.push(_.M(k.reader)),k.flags&1024&&m.A.push(_.M(k.reader)),k.flags&
11
+ 2048&&(0===k.version?m.h.push(_.M(k.reader)):m.h.push(_.Aj(k.reader)));e=m}}).X("sdtp",k=>{{const l=_.Dj(k.reader,k.reader.wa());f=new iG("sdtp",k.version||0,k.flags||0,l,0)}}).M("uuid",k=>{var l=_.Dj(k.reader,16);if(_.ij(l,jG)){l=_.M(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new kG(k.version,k.flags);l.h=_.M(k.reader);k.flags&1&&(l.j=_.yj(k.reader));for(let m=0;m<l.h;m++){const n={re:_.Dj(k.reader,8),sc:0,Wd:[]};if(k.flags&2){n.sc=_.zj(k.reader);for(let q=0;q<n.sc;q++){const t={ge:0,he:0};
12
+ t.ge=_.zj(k.reader);t.he=_.M(k.reader);n.Wd.push(t)}}l.g.push(n)}g=l}}).M(_.qd,k=>{{const l=new lG;0<k.reader.wa()?l.g=_.Dj(k.reader,k.reader.wa()):(_.B($E,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new mG).append([d,e]);f&&a.append([f]);b.Xc()&&g&&a.append([g]);b=(new nG).append([c,a]);return new dG([b,h])},tG=function(a,b,c,d){var e=d.Xc(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=oG(b,d);if(null===g)return a.request.contentType===_.r?a.data:
13
+ g;d=g.get(_.qd);if(a.request.contentType===_.r){e=d.g.buffer;if(c){e=_.Lg(e);if((e=(new DOMParser).parseFromString(e,_.ue))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new pG(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");for(let t=0,v=f.length;t<v;t++){h=f[t];a=c;b=d;g=["begin",_.Yc];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 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[y],uF(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.Mg(e).buffer}else c=e;return c}h=new nG;a=g.get("mfhd");b=new mG;k=g.get("tfhd");m=new qG(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].sc);else g=8;b.append([c,new rG,new sG(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new dG([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},uG=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
+ periodId:null}},vG=function(a){return{initData:_.nu(_.uk(a)),initDataType:_.tc,keyId:a,periodId:null}},wG=function(a,b,c){a=_.Fk(a);c&&a.version!==c&&(a=_.pu(a,c));return{initData:_.nu(a),initDataType:_.tc,keyId:b,periodId:null}},xG=function(a,b){return _.w(function*(){var c=_.bh(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})},FG=function(a,b){let c=null;try{{const pa=new DOMParser;let ib,La;try{const ab=_.Lg(b);La=pa.parseFromString(ab.trim(),_.ue)}catch(ab){throw ab;}La&&La.documentElement.tagName==_.kb&&(ib=La.documentElement);c=ib&&0<ib.getElementsByTagName("parsererror").length?null:ib}}catch(pa){}if(!c)throw a.a.error("Unable to parse manifest"),new _.G(_.F,4,4033,a.m);const d=+yG(a,c,"MajorVersion"),e=+yG(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
+ 1E7;let g=+yG(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.ok(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 _.G(_.F,4,4036,a.m);h?(zG(a,AG),a.B=typeof a.g.liveRefreshPeriod===_.p?1E3*a.g.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):zG(a,BG);a.f={startTime:0,delay:0,duration:g/f,md:l/f,Bc:0};if(m){{var n=a.g.playreadyVersion;
19
+ const pa=[],ib=_.ok(m,"ProtectionHeader")[0],La=_.fj(_.qk(ib)||""),ab=_.Fk(La).a;pa.push(uG(_.Kc,vG(ab),[ab]));pa.push(uG(_.Jc,wG(La,ab,n),[ab]));var q=pa}a.o=q}{const pa=[],ib=_.ok(c,"StreamIndex");if(!ib.length)throw a.a.error("No streams found!"),new _.G(_.F,4,4034,a.m);for(let La=0;La<ib.length;La++){{var t=a,v=ib[La];const ab=yG(t,v,"Type"),ic=+v.getAttribute("Chunks"),Rg=v.getAttribute("Subtype"),De=_.Nh(v.getAttribute("Language")||_.ye),Kd=v.getAttribute("Name")||"",Sg=+v.getAttribute(_.Ma),
20
+ Af=+v.getAttribute(_.Ka),Bf=yG(t,v,"Url"),Bk=+v.getAttribute("TimeScale")||null;{const jc=[],ni=_.ok(v,_.Ya);for(let Ld=0;Ld<ni.length;Ld++){{let kc,Ha,gd;var y=t,A=ni[Ld],E=ab;const oi=+A.getAttribute("Index"),Cf=+yG(y,A,"Bitrate");let Qb=NaN,Df=NaN,Ck=NaN,kp=NaN,yy=NaN,zy=NaN,Ay=NaN;const By=A.getAttribute("FourCC");switch(E){case _.u:Qb=+yG(y,A,_.Ka);Df=+yG(y,A,_.Ma);break;case _.ac:kp=+A.getAttribute("Channels")||2,Ck=+yG(y,A,"SamplingRate"),zy=+yG(y,A,"AudioTag"),yy=+yG(y,A,"BitsPerSample"),
21
+ Ay=+yG(y,A,"PacketSize")}let lp=String(A.getAttribute("CodecPrivateData"));if(E===_.ac&&!lp){{var D=kp;const Cy={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},Dk=Cy[Ck];if("AACH"===By){Ha=new Uint8Array(4);const Dy=Cy[2*Ck];Ha[0]=40|Dk>>1;Ha[1]=Dk<<7|D<<3|Dy>>1;Ha[2]=Dy<<7|8;Ha[3]=0;kc=new Uint16Array(2);kc[0]=(Ha[0]<<8)+Ha[1];kc[1]=(Ha[2]<<8)+Ha[3];gd=kc[0].toString(16)+kc[1].toString(16)}else Ha=new Uint8Array(2),Ha[0]=16|Dk>>1,Ha[1]=Dk<<7|D<<
22
+ 3,kc=new Uint16Array(1),kc[0]=(Ha[0]<<8)+Ha[1],gd=kc[0].toString(16);lp=gd.toUpperCase()}}var ha={id:y.V++,type:E,index:oi,bitrate:Cf,Nc:lp,maxHeight:Qb,maxWidth:Df,Gc:Ck,je:kp,fg:zy,Xe:yy,rg:Ay,mf:By,segmentIndex:null}}jc.push(ha)}var gb=jc}{const jc=[],ni=_.ok(v,"c");for(let Ld=0;Ld<ni.length;Ld++){const kc=ni[Ld];let Ha=parseInt(kc.getAttribute("t"),10),gd=parseInt(kc.getAttribute("d"),10),oi=parseInt(kc.getAttribute("r"),10),Cf=0;if(isNaN(Ha)&&isNaN(gd))throw t.a.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
+ new _.G(_.F,4,4037,t.m);0===Ld&&isNaN(Ha)&&(Cf=Ha=0);if(0<Ld){const Qb=jc[jc.length-1];Cf=Qb.n+1;Qb.d||(Qb.d=Ha-Qb.t);Ha||(Ha=Qb.t+Qb.d);gd||(gd=Ha-Qb.t)}jc.push({n:Cf,d:gd,t:Ha});if(oi){oi--;for(let Qb=0;Qb<oi;Qb++){const Df=jc[jc.length-1];Cf=Df.n+1;Ha=Df.t+Df.d;gd=Df.d;jc.push({n:Cf,d:gd,t:Ha})}}}t.C()||jc.length===ic||t.a.warn("Number of fragments ("+ic+") differs from number of chunks ("+jc.length+").");var vf=jc}var yb={type:ab,ig:ic,Tf:Rg,language:De,name:Kd,maxWidth:Sg,maxHeight:Af,Xf:Bf,
24
+ tracks:gb,oe:vf,timescale:Bk}}pa.push(yb)}var wf=pa}const Ta={pg:d,ve:e,timescale:f,duration:g,isLive:h,og:k,md:l,ud:!1,streams:wf};if(a.h&&a.w)return CG(a,Ta),Promise.resolve();a.G.clear();{const pa=Ta.timescale,ib=Ta.duration,La=mF(Ta.streams,_.ac),ab=mF(Ta.streams,_.u),ic=mF(Ta.streams,_.r),Rg=[];let De=DG(a,ib,pa,La),Kd=DG(a,ib,pa,ab);const Sg=DG(a,ib,pa,ic);De.length||(De=[null]);Kd.length||(Kd=[null]);for(let Af=0;Af<Kd.length;Af++)for(let Bf=0;Bf<De.length;Bf++)Rg.push(EG(a,Kd[Af],De[Bf]));
25
+ var Hd={startTime:0,variants:Rg,textStreams:Sg,thumbStreams:[]}}{var rb=Ta.streams;let pa=a.f.startTime,ib=a.f.delay;const La=a.I;let ab=Math.min(a.f.duration||Infinity,La);const ic=a.C(),Rg=a.f.md,De=a.f.Bc,Kd=a.H,Sg=isFinite(a.F)?a.F:0;if(ic)ab=Infinity,pa=Date.now()/1E3-De,a.f.startTime=pa,ib=3*Kd;else{const Af=isFinite(La)?La:a.f.duration;for(const Bf of rb)for(const Bk of Bf.tracks)Bk.segmentIndex.offset(-Sg),_.gv(Bk.segmentIndex,Af)}a.A=new _.Bz(pa,ib,!ic,!0);a.A.Lb(ab);_.Uu(a.A,Kd);a.A.Zb=
26
+ Rg;ic||a.A.offset(-Sg)}a.D.filterAllPeriods([Hd]);a.h={presentationTimeline:a.A,periods:[Hd],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.dd(a.L),a.K=!0);a.w=Ta;return Promise.resolve()},GG=function(a,b){null!=a.B&&null!=b&&(a.j=window.setTimeout(a.vb.bind(a),b))},yG=function(a,b,c){if(b=b.getAttribute(c))return b;a.a.error("required attribute not provided: "+c);throw new _.G(_.F,4,4038,a.m,c);},zG=function(a,b){const c=b===BG;if(a.h&&a.h.presentationTimeline){var d=
27
+ a.h.presentationTimeline;d.j=c;d.m=c}c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.B=null);a.R=b},CG=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){kF(g,c)||a.a.warn("The current stream is updated with a stream that seems to have different base properties!");var d=HG(a,a.w.timescale,f,c);c=g.segmentIndex;_.cv(c,d);(d=a.f.md)&&_.dv(c,_.av(c)-d).forEach(h=>{h.Ca().forEach(k=>
28
+ {a.G.delete(k)})})}else a.a.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},HG=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.oe.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=jF(a.m,c,k,d);a.H=Math.max(a.H,l);f.push(new _.bv(k,h,m,()=>[n],0,null,0,null,!0,g));a.G.set(n,h);e+=l});if(c.type===_.u||c.type===_.ac)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.f.Bc?a.f.Bc=b.endTime:a.f.Bc=
29
+ Math.min(a.f.Bc,b.endTime);return f},DG=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=HG(a,c,k,h),m=new _.Cz(l),n=null;k.type!==_.r&&(n=IG(a,b,c,k,h));h.segmentIndex=m;l=a.N++;var q=Promise.resolve.bind(Promise),t=m.f.bind(m),v=m.get.bind(m),y=m.g.bind(m);m=m.getDuration.bind(m);var A=JG[k.type];var E="";switch(k.type){case _.u:E=h.Nc;var D=/00000001[0-9]7/.exec(E);E="avc1."+(D&&D[0]?E.substr(E.indexOf(D[0])+10,6):"42c00c");a.a.debug("VIDEO CODECS: ",
30
+ E);break;case _.ac:E=h.Nc,D=2,"AACH"===h.mf?D=5:E&&(D=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+D,a.a.debug("AUDIO CODECS: ",E)}D=k.type===_.r?KG[k.Tf]:void 0;return h={id:l,originalId:null,tg:null,createSegmentIndex:q,findSegmentPosition:t,getSegmentReference:v,adjustSegmentDurations:y,getDuration:m,segmentIndex:null,segmentLookupStrategy:_.Yt,initSegmentReference:n,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:D,encrypted:a.J(),
31
+ keyId:null,language:k.language,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.je||null,closedCaptions:null}});e=e.concat(g)}return e},EG=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.ye;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},IG=function(a,b,c,d,e){b=lF(b,d.timescale||c,e);c={isLive:a.C.bind(a),Xc:a.J.bind(a),sf:()=>
32
+ 1,Sc:a.S.bind(a)};d=new Uint8Array(0);try{d=eG(b,c)}catch(g){throw a.a.error("Failed to generate initialization segment."),new _.G(_.F,3,4035,g);}const f="data:text/plain;base64,"+_.ej(d);return new _.Az(()=>[f],0,null,null,!0)},wF=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===
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?_.L(a,1):_.L(a,this.size);_.vj(a,hF(this.type));this.size>b&&bF(a,this.size);"uuid"===this.type&&_.vj(a,null);if(0<this.f.length&&!this.w)for(b=0;b<this.f.length;b++)this.f[b].write(a),
34
+ this.f[b].a(),a.getPosition()}},LG=class extends wF{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);cF(a,this.version);dF(a,this.flags)}},cG=class extends wF{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);_.vj(a,this.g,this.offset);a.getPosition()}},iG=class extends LG{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);_.vj(a,this.g,this.offset);a.getPosition()}},bG=class extends wF{constructor(a,b,c){super("ftyp");this.h=a;this.ve=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);_.vj(a,hF(this.h));_.L(a,this.ve);_.vj(a,hF(this.g.join("")));a.getPosition()}},aG=class extends wF{constructor(){super(_.wd)}},$F=class extends wF{constructor(){super(_.we)}},DF=class extends LG{constructor(a,b,c){super("mvhd",1,0);this.timescale=
36
+ 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,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?(bF(a,0),bF(a,0),_.L(a,this.timescale),bF(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.timescale),_.L(a,this.duration*this.timescale));_.L(a,65536);eF(a,this.volume);eF(a,0);_.L(a,0);_.L(a,0);for(let b=0;b<this.g.length;b++)cF(a,this.g[b]);
37
+ _.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,this.h);a.getPosition()}},EF=class extends wF{constructor(){super("mvex")}},FF=class extends LG{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.L(a,this.g);_.L(a,1);_.L(a,0);_.L(a,0);_.L(a,0);a.getPosition()}},GF=class extends LG{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,
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?(bF(a,0),bF(a,0),_.L(a,this.h),_.L(a,0),bF(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.h),_.L(a,0),_.L(a,this.duration*this.timescale));_.L(a,0);_.L(a,0);eF(a,0);eF(a,0);eF(a,this.volume);eF(a,0);for(let b=0;b<this.g.length;b++)cF(a,this.g[b]);eF(a,this.width);eF(a,0);eF(a,this.height);eF(a,0);a.getPosition()}},HF=class extends LG{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?(bF(a,0),bF(a,0),_.L(a,this.timescale),bF(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.timescale),_.L(a,this.duration*this.timescale));eF(a,this.language);eF(a,0);a.getPosition()}},IF=class extends LG{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.L(a,0);this.g===
40
+ _.u?_.vj(a,hF("vide")):_.vj(a,hF("soun"));_.L(a,0);_.L(a,0);_.L(a,0);this.g===_.u?_.vj(a,hF("VideoHandler\x00")):_.vj(a,hF("SoundHandler\x00"));a.getPosition()}},OF=class extends LG{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);eF(a,0);_.vj(a,this.g);a.getPosition()}},MG=class extends wF{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.L(a,0);eF(a,0);eF(a,1)}},NG=class extends MG{constructor(a){super(a);
41
+ this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);eF(a,0);eF(a,0);_.L(a,0);_.L(a,0);_.L(a,0);eF(a,this.width);eF(a,this.height);_.L(a,4718592);_.L(a,4718592);_.L(a,0);eF(a,1);cF(a,10);_.vj(a,hF("AVC Coding",31));eF(a,this.depth);gF(a,-1)}},OG=class extends MG{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);_.L(a,0);_.L(a,0);eF(a,this.channelCount);eF(a,this.sampleSize);gF(a,0);
42
+ eF(a,0);eF(a,this.sampleRate);eF(a,0)}},NF=class extends NG{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()}},xF=class extends NF{constructor(a,b){super(a,b);this.type="encv"}},QF=class extends OG{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()}},yF=class extends QF{constructor(a,b,c){super(a,b,c);this.type="enca"}},
43
+ MF=class extends wF{constructor(a,b){super("avcC");this.Ga=a;this.Ib=b;this.version=1;this.g=this.Ga[0][1];this.h=this.Ga[0][2];this.level=this.Ga[0][3]}a(){let a=7;for(var b=0;b<this.Ga.length;b++)a+=2,a+=this.Ga[b].byteLength;for(b=0;b<this.Ga.length;b++)a+=2,a+=this.Ib[b].byteLength;return a+super.a()}write(a){super.write(a);cF(a,this.version);cF(a,this.g);cF(a,this.h);cF(a,this.level);cF(a,255);cF(a,224|this.Ga.length);for(var b=0;b<this.Ga.length;b++)eF(a,this.Ga[b].length),_.vj(a,this.Ga[b]);
44
+ cF(a,this.Ib.length);for(b=0;b<this.Ib.length;b++)eF(a,this.Ib[b].length),_.vj(a,this.Ib[b]);a.getPosition()}},PF=class extends LG{constructor(a){super("esds",0,0);this.Bb=a}a(){return 22+(this.Bb.byteLength+3)+super.a()}write(a){super.write(a);cF(a,3);cF(a,23+this.Bb.byteLength);eF(a,1);cF(a,0);cF(a,4);cF(a,15+this.Bb.byteLength);cF(a,64);cF(a,21);dF(a,0);_.L(a,0);_.L(a,0);cF(a,5);cF(a,this.Bb.byteLength);_.vj(a,this.Bb);_.vj(a,new Uint8Array([6,1,2]));a.getPosition()}},KF=class extends LG{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&&_.vj(a,hF(this.location));a.getPosition()}},JF=class extends LG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},SF=class extends wF{constructor(){super(_.me)}},LF=class extends LG{constructor(){super(_.oe,
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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},TF=class extends LG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
47
+ UF=class extends LG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},WF=class extends LG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
48
+ a.getPosition()}},VF=class extends LG{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.L(a,0);_.L(a,0);a.getPosition()}},RF=class extends LG{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);gF(a,0);eF(a,0);a.getPosition()}},XF=class extends wF{constructor(){super("dinf")}},YF=class extends wF{constructor(){super(_.vd)}},ZF=class extends wF{constructor(){super(_.rd)}},qG=class extends LG{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?bF(a,this.g):_.L(a,this.g);a.getPosition()}},fG=class extends LG{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.L(a,this.g);a.getPosition()}},hG=class extends LG{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&PG&&(a+=4);this.flags&QG&&(a+=4);for(let b=0;b<this.g;b++)this.flags&RG&&(a+=
50
+ 4),this.flags&SG&&(a+=4),this.flags&TG&&(a+=4),this.flags&UG&&(a+=4);return a+super.a()}write(a){super.write(a);_.L(a,this.g);this.flags&PG&&(a.getPosition(),fF(a,this.j));this.flags&QG&&_.L(a,this.m);for(let b=0;b<this.g;b++)this.flags&RG&&_.L(a,this.o[b]),this.flags&SG&&_.L(a,this.sampleSize[b]),this.flags&TG&&_.L(a,this.A[b]),this.flags&UG&&(0===this.version?_.L(a,this.h[b]):fF(a,this.h[b]));a.getPosition()}},PG=1,QG=4,RG=256,SG=512,TG=1024,UG=2048,gG=class extends LG{constructor(a,b){super("tfhd",
51
+ a,b);this.g=255;this.m=this.o=this.j=this.A=this.h=0}a(){let a=4;this.flags&VG&&(a+=8);this.flags&WG&&(a+=4);this.flags&XG&&(a+=4);this.flags&YG&&(a+=4);this.flags&ZG&&(a+=4);return a+super.a()}write(a){super.write(a);_.L(a,this.g);this.flags&VG&&bF(a,this.h);this.flags&WG&&_.L(a,this.A);this.flags&XG&&_.L(a,this.j);this.flags&YG&&_.L(a,this.o);this.flags&ZG&&_.L(a,this.m);a.getPosition()}},VG=1,WG=2,XG=8,YG=16,ZG=32,mG=class extends wF{constructor(){super("traf")}},nG=class extends wF{constructor(){super("moof")}},
52
+ lG=class extends wF{constructor(){super(_.qd);this.g=new Uint8Array(0)}a(){return this.g.byteLength+super.a()}write(a){super.write(a);0<this.g.byteLength&&_.vj(a,this.g)}},zF=class extends LG{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);cF(a,0);0===this.version?cF(a,0):cF(a,0);cF(a,this.g);cF(a,this.h);_.vj(a,_.gj(this.m));if(1===this.g&&0===this.h){cF(a,0);for(let b=0;b<
53
+ this.j.length;b++)cF(a,this.j[b])}a.getPosition()}},BF=class extends LG{constructor(a,b){super("schm",0,0);this.g=a;this.h=b;this.xb=""}a(){let a=8;this.flags&1&&(a+=hF(this.xb).byteLength);return a+super.a()}write(a){super.write(a);_.vj(a,hF(this.g));_.L(a,this.h);this.flags&1&&_.vj(a,hF(this.xb));a.getPosition()}},AF=class extends wF{constructor(a){super("frma");this.g=a}a(){return hF(this.g).byteLength+super.a()}write(a){super.write(a);_.vj(a,hF(this.g));a.getPosition()}},rG=class extends LG{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&&(_.L(a,0),_.L(a,0));_.L(a,1);for(let b=0;1>b;b++)0===this.version?_.L(a,this.offset[b]):bF(a,this.offset[b]);a.getPosition()}},sG=class extends LG{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&&(_.L(a,
55
+ 0),_.L(a,0));cF(a,this.g);_.L(a,this.h);if(0===this.g)for(let b=0;b<this.h;b++)cF(a,this.j[b]);a.getPosition()}},kG=class extends LG{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].re.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].sc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.L(a,this.h);this.flags&1&&cF(a,this.j);for(let b=0;b<this.h;b++)if(_.vj(a,this.g[b].re),this.flags&2){eF(a,this.g[b].sc);
56
+ for(let c=0;c<this.g[b].sc;c++)eF(a,this.g[b].Wd[c].ge),_.L(a,this.g[b].Wd[c].he)}a.getPosition()}};var pG=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))}},oF=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,pF=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,qF=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,rF=/^(\d*\.?\d*)f$/,sF=/^(\d*\.?\d*)t$/,tF=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var dG=class{constructor(a){this.a=a;this.f=vF(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=vF(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var jG=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var $G=class{constructor(){this.w=this.h=this.g=this.D=null;this.N=1;this.V=0;this.m="";this.A=this.f=null;this.a=new _.O("clpp.smooth.SmoothParser");this.K=!1;this.j=this.B=null;this.R=BG;this.H=0;this.F=this.I=Infinity;this.o=[];this.L=this.U.bind(this);this.G=new Map}configure(a){this.g=a}start(a,b){this.D=b;a=[...new Set([a,iF(a)])];return xG(this,a).then(c=>FG(this,c.data).then(()=>{GG(this,this.B);return this.h}))}stop(){this.D&&this.D.networkingEngine.Pd(this.L);this.B=this.w=this.h=this.g=
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 xG(this,[this.m]).then(a=>FG(this,a.data).then(()=>this.h)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}vb(){this.a.debug(_.Rt);this.D&&(this.j=null,this.update().then(()=>{GG(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&GG(this,100))}))}C(){return this.R===AG}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}U(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),Xc:this.J.bind(this),sf:()=>1,Sc:this.S.bind(this)};let d=!1;const e=new _.G(_.F,3,4035,null);let f=null;try{const g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.a.debug(`Using base media decode time ${g} instead of `+
59
+ `segment reference time ${a.request.startTime}`);f=tG(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)}},JG={video:_.Je,audio:_.ec,text:_.Yb},BG="VOD",AG="LIVE",KG={bg:"caption",cg:_.fu};_.x("clpp.smooth.SmoothComponent",class extends _.Lp{constructor(){super()}f(){_.Kn.ism=$G;_.In[_.Zb]=$G}a(){_.jv("ism");_.kv(_.Zb)}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 Is="No thumbnail duration or URL specified",Js="No thumbnail found for position ",Ks="Position is out of range: ",Ls="Thumbnail URL is mandatory",Ms="Wrong gridSize format",Ns="clpp.thumbnails",Ps=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Cd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Os(a,0,e,!!f))},Promise.resolve())},Os=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Qs(a,d).then(()=>a.a[b].load()).then(()=>Os(a,e,
2
- c,d))},Qs=function(a,b){return new Promise(c=>{if(b||a.g.getState()!==_.Ll)c();else a.g.one(_.hc,()=>{c()})})},Rs=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.ve.resolve()})},Us=function(a,b){return Ss(a,b).then(c=>new Ts(c,b.time,b.duration))},Ss=function(a,b){return b.load().then(()=>{const c=_.G(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.ej(c)})},Vs=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},Ws=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},Xs=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Ac:c,de:d,se:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Ys=function(a){return a.some(b=>0<b.thumbStreams.length)},Zs=function(a){if(!a)return null;a=new _.Lj(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 $s=class{constructor(){this.log=new _.O(Ns);this.g=null;this.a=[];this.w=!1}init(a,b){this.g=a;a.one(_.$d,()=>{this.w=!0});a.isLive()||this.m().then(()=>{b&&b.preload&&Ps(this,b.preload)})}};var Ts=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.ha=n;this.ff=h;this.Tf=k;this.Af=l;this.Bf=m;this.oa=null}raw(){return this.ha.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+_.Xd;a.style.height=d+_.Xd;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.ha.naturalWidth||this.ha.width))}px ${Math.ceil(d/this.height*(this.ha.naturalHeight||this.ha.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*c+_.Xd;a.style.backgroundPositionY="-"+b*d+_.Xd;return a}load(){this.oa||(this.oa=new Promise((a,b)=>{const c=()=>{this.width||
6
- (this.width=(this.ha.naturalWidth||this.ha.width)/this.ff);this.height||(this.height=(this.ha.naturalHeight||this.ha.height)/this.Tf);this.x||(this.x=this.width*this.Af);this.y||(this.y=this.height*this.Bf)};if(this.ha.src&&this.ha.complete)c(),a(this);else{var d=null,e=()=>{c();this.ha.removeEventListener("load",e);this.ha.removeEventListener(_.Yc,d);a(this)};d=()=>{this.ha.removeEventListener("load",e);this.ha.removeEventListener(_.Yc,d);b()};this.ha.addEventListener("load",e);this.ha.addEventListener(_.Yc,
7
- d);this.ha.src=this.src}}));return this.oa}};_.x("clpp.thumbnails.Thumbnail",Ts);Ts.prototype.load=Ts.prototype.load;Ts.prototype.element=Ts.prototype.element;Ts.prototype.raw=Ts.prototype.raw;var at=class extends $s{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.H(_.F,7,7100,Ls);if("GRID"===b.mode&&!b.gridSize)throw new _.H(_.F,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.H(_.F,7,7100,"Duration is mandatory");this.f=b;const c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(Is,c,d),new _.H(_.F,7,7100,Is);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(_.F,7,7100,Ms);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.H(_.F,7,7100,Ms);}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(Ks+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(Js+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 Ts(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 bt=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.ve=new _.Yk}load(){return this.ve}},dt=class{constructor(){this.g=new _.O(Ns);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Yk}init(a,b){if(!b||!b.url)throw new _.H(_.F,7,7100,Ls);const c=b.url;b=_.ch(c);b.type=_.bh;a.getNetworkEngine().fetch(b).R.then(d=>{{var e=d.data;d=_.G(this.f);e=_.G(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=_.G(d),f=String.fromCharCode.apply(null,ct),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 bt(g,f);if(g=this.a.length)g=
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Is="No thumbnail duration or URL specified",Js="No thumbnail found for position ",Ks="Position is out of range: ",Ls="Thumbnail URL is mandatory",Ms="Wrong gridSize format",Ns="clpp.thumbnails",Ps=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Bd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Os(a,0,e,!!f))},Promise.resolve())},Os=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Qs(a,d).then(()=>a.a[b].load()).then(()=>Os(a,e,
2
+ c,d))},Qs=function(a,b){return new Promise(c=>{if(b||a.g.getState()!==_.Kl)c();else a.g.one(_.mc,()=>{c()})})},Rs=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.te.resolve()})},Us=function(a,b){return Ss(a,b).then(c=>new Ts(c,b.time,b.duration))},Ss=function(a,b){return b.load().then(()=>{const c=_.H(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.dj(c)})},Vs=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},Ws=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},Xs=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{zc:c,be:d,qe:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Ys=function(a){return a.some(b=>0<b.thumbStreams.length)},Zs=function(a){if(!a)return null;a=new _.Kj(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 $s=class{constructor(){this.log=new _.O(Ns);this.g=null;this.a=[];this.w=!1}init(a,b){this.g=a;a.one(_.$d,()=>{this.w=!0});a.isLive()||this.m().then(()=>{b&&b.preload&&Ps(this,b.preload)})}};var Ts=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.ia=n;this.bf=h;this.Of=k;this.wf=l;this.xf=m;this.pa=null}raw(){return this.ia.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(_.Qc);a.style.width=
5
+ c+_.Xd;a.style.height=d+_.Xd;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.ia.naturalWidth||this.ia.width))}px ${Math.ceil(d/this.height*(this.ia.naturalHeight||this.ia.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*c+_.Xd;a.style.backgroundPositionY="-"+b*d+_.Xd;return a}load(){this.pa||(this.pa=new Promise((a,b)=>{const c=()=>{this.width||
6
+ (this.width=(this.ia.naturalWidth||this.ia.width)/this.bf);this.height||(this.height=(this.ia.naturalHeight||this.ia.height)/this.Of);this.x||(this.x=this.width*this.wf);this.y||(this.y=this.height*this.xf)};if(this.ia.src&&this.ia.complete)c(),a(this);else{var d=null,e=()=>{c();this.ia.removeEventListener("load",e);this.ia.removeEventListener(_.$c,d);a(this)};d=()=>{this.ia.removeEventListener("load",e);this.ia.removeEventListener(_.$c,d);b()};this.ia.addEventListener("load",e);this.ia.addEventListener(_.$c,
7
+ d);this.ia.src=this.src}}));return this.pa}};_.x("clpp.thumbnails.Thumbnail",Ts);Ts.prototype.load=Ts.prototype.load;Ts.prototype.element=Ts.prototype.element;Ts.prototype.raw=Ts.prototype.raw;var at=class extends $s{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.G(_.F,7,7100,Ls);if("GRID"===b.mode&&!b.gridSize)throw new _.G(_.F,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.G(_.F,7,7100,"Duration is mandatory");this.f=b;const c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(Is,c,d),new _.G(_.F,7,7100,Is);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 _.G(_.F,7,7100,Ms);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.G(_.F,7,7100,Ms);}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(Ks+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(Js+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 Ts(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 bt=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.te=new _.Xk}load(){return this.te}},dt=class{constructor(){this.g=new _.O(Ns);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Xk}init(a,b){if(!b||!b.url)throw new _.G(_.F,7,7100,Ls);const c=b.url;b=_.bh(c);b.type=_.ah;a.getNetworkEngine().fetch(b).P.then(d=>{{var e=d.data;d=_.H(this.f);e=_.H(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=_.H(d),f=String.fromCharCode.apply(null,ct),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 bt(g,f);if(g=this.a.length)g=
11
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(()=>{Rs(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(Ks+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 Us(this,c).then(d=>d.load().then(()=>d))}return Promise.reject(Js+a)})}},ct=[137,66,73,70,13,10,26,10];var et=class extends $s{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.H(_.F,7,7100,Ls);const c=b.url,d=_.ch(c);d.type=_.bh;this.f=a.getNetworkEngine().fetch(d).R.then(e=>{if(e=e.data){e=_.Fg(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=Vs(g[0]);g=Vs(g[1])-l;this.a.push(new Ts(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(Ks+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(Js+a)})}m(){return this.f}};var ft=class extends $s{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=Ws(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=Xs(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.se+a]);else if((c=d.Ea())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.se&&(g=a%e.Ac,h=Math.floor(a/e.Ac),d+=a*e.durationPerTile);f=new Ts(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ac,e.de,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&&!_.z(d=a.getSegmentReference(c++));){const e=Xs(d,a),f=d.Ea()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.de;++k)for(let l=0;l<e.Ac;++l)this.a.push(new Ts(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ac,
16
- e.de,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var gt=class{constructor(){this.f=new _.O(Ns);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=Zs(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new at:"WEBVTT"===b?this.a=new et:"BIF"===b&&(this.a=new dt)),this.a&&(this.f.info("Loading thumbs configuration",c),this.l.one(_.pd,()=>{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();Ys(c)&&(this.a=new ft,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.x("clpp.thumbnails.ThumbnailsPlugin",gt);gt.prototype.get=gt.prototype.get;gt.Id="thumbnails";_.Tm(new class{create(){return new gt}});};f.call(g, window);
12
+ + 'URL: ${c}`,d);a.onError(new _.G(1,7,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){return 0>a?Promise.reject(Ks+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 Us(this,c).then(d=>d.load().then(()=>d))}return Promise.reject(Js+a)})}},ct=[137,66,73,70,13,10,26,10];var et=class extends $s{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.G(_.F,7,7100,Ls);const c=b.url,d=_.bh(c);d.type=_.ah;this.f=a.getNetworkEngine().fetch(d).P.then(e=>{if(e=e.data){e=_.Ig(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=Vs(g[0]);g=Vs(g[1])-l;this.a.push(new Ts(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 _.G(1,7,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){return 0>a?Promise.reject(Ks+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(Js+a)})}m(){return this.f}};var ft=class extends $s{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=Ws(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=Xs(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.qe+a]);else if((c=d.Ca())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.qe&&(g=a%e.zc,h=Math.floor(a/e.zc),d+=a*e.durationPerTile);f=new Ts(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.zc,e.be,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&&!_.z(d=a.getSegmentReference(c++));){const e=Xs(d,a),f=d.Ca()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.be;++k)for(let l=0;l<e.zc;++l)this.a.push(new Ts(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.zc,
16
+ e.be,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var gt=class{constructor(){this.f=new _.O(Ns);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=Zs(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new at:"WEBVTT"===b?this.a=new et:"BIF"===b&&(this.a=new dt)),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();Ys(c)&&(this.a=new ft,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.x("clpp.thumbnails.ThumbnailsPlugin",gt);gt.prototype.get=gt.prototype.get;gt.Id="thumbnails";_.Sm(new class{create(){return new gt}});};f.call(g, window);