@castlabs/prestoplay 6.17.0 → 6.17.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 (63) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +98 -98
  6. package/cjs/cl.conviva.js +31 -31
  7. package/cjs/cl.core.js +372 -369
  8. package/cjs/cl.crypto.js +8 -8
  9. package/cjs/cl.dash.js +71 -71
  10. package/cjs/cl.externs.js +1 -1
  11. package/cjs/cl.freewheel.js +21 -21
  12. package/cjs/cl.hls.js +67 -67
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +302 -302
  17. package/cjs/cl.muxdata.js +14 -14
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +15 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +64 -64
  26. package/cjs/cl.ttml.js +28 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +9 -9
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +14 -14
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +83 -83
  36. package/cl.conviva.js +26 -26
  37. package/cl.core.js +324 -323
  38. package/cl.crypto.js +8 -8
  39. package/cl.dash.js +69 -69
  40. package/cl.externs.js +1 -1
  41. package/cl.freewheel.js +15 -15
  42. package/cl.hls.js +72 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +15 -15
  46. package/cl.mse.js +267 -268
  47. package/cl.muxdata.js +11 -11
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +10 -10
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +54 -54
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +6 -6
  59. package/cl.vr.js +14 -14
  60. package/cl.vtt.js +11 -11
  61. package/cl.youbora.js +12 -12
  62. package/package.json +1 -1
  63. package/typings.d.ts +3 -2
package/cl.cast.js CHANGED
@@ -1,89 +1,89 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var NS="Cannot seek during ads playout.",OS="Cannot switch track",PS="Media session does not exist.",QS="No receivers available",RS="Reset ABR functionality not available on cast.",SS="SDK not yet ready",TS="Sender is destroyed.",US="clpp.cast.CastProxy",VS="clpp.cast.Player",WS="clpp.cast.Receiver",XS="urn:x-cast:castlabs",ZS="urn:x-cast:com.google.cast.media",$S=function(a){return _.x(function*(){yield _.ap(a,_.He);yield _.ap(a,_.Ge)})},aT=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.Yd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.De?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.t?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},bT=function(a){if(typeof a!==_.Nf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},cT=function(a,b,c,d){return _.x(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
- null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Bj(d,a.mimeType,g);f&&g&&(h=_.Pi(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.J(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},dT=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
4
- d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.ig:return d.FMP4;case _.hg:return b===_.N?d.MPEG2_TS:c.TS;case _.Gc:return c.AAC;case _.Hc:return c.AC3;case _.Ic:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Jc:return c.FMP4}},fT=function(a){a=void 0===a?eT:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
- b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},gT=function(a,b){return a.g.filter(c=>c.type===b)},iT=function(a,b){const c=hT(a);return gT(a,b).find(d=>c.includes(d.id))||null},kT=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.K){const e=a.qa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;jT(a,b)},e=>{a.f[b]=null;a.h.debug(OS,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{jT(a,b)},e=>{a.h.debug(OS,e)}))},hT=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},jT=function(a,b){b===_.L?a.a.trigger(new _.E(_.Gk)):b===_.K&&a.a.trigger(new _.E(_.Hk))},nT=function(a){if(a)for(const b of lT)mT(b)},mT=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.T.length){a.w=!0;a.o.Ge();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa);oT&&a.o.fa(.02)}},pT=function(a){return _.x(function*(){lT.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.X=null})},qT=function(a){return _.x(function*(){a.rb()||(yield cast.framework.CastContext.getInstance().requestSession())})},sT=function(a,b,c){c=
9
- void 0===c?0:c;return _.x(function*(){var d=a.f.qa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.la())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield rT(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),se:a.getPresentationStartTime(),autoplay:b,Ua:a.g})})},rT=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield qT(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
10
- b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=dT(b.Hb,_.N);e.hlsSegmentFormat=dT(c,_.L);b.Ua&&(a.L&&(c=yield Promise.resolve(a.L(b.Ua)))&&(b.Ua=c),a.g=b.Ua,a.C=_.Zn(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Ua.remoteTextTracks&&(c=yield Promise.all(b.Ua.remoteTextTracks.map(a.ja.bind(a))),e.tracks=c.filter(k=>k),b.Ua.remoteTextTracks=void 0),delete b.Ua.autoplay,b.Ua.startTime=null,e.customData={playerConfiguration:aT(b.Ua)});c=a.kb()||{};
11
- var f=tT(c.metadataType),g;typeof b.se===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.se});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=uT(c);if(g=vT(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Pc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},vT=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(wT);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=fT(wT[b]);return Object.assign(b,a)},tT=function(a){var b=void 0===b?eT:b;return Object.values(wT).includes(a)?a:b},uT=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},yT=function(a,b){xT(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(XS,a.R)},zT=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.t?null:a):a=
13
- null;a=null===a?null:a+b;return null===a?b:a},xT=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.da.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.E(_.qe)))},CT=function(a){return new AT(a.g,()=>{a.trigger(new _.E(_.Yc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
14
- 1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Se&&(d.preferredAudioLanguage=c.Se);c.If&&(d.preferredTextLanguage=c.If);_.cp(a.f,null);a.trigger(new _.E("castingended"));a.j(b,d)}},()=>BT(a))},BT=function(a){return _.x(function*(){a.trigger(new _.E(_.Xc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.cp(a.f,a.a))})},FT=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{DT=!1;const e=_.Pi(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.li(f.data),h=(new DOMParser).parseFromString(g,
15
- _.Tf);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=ET(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=ET(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),DT=!0}}catch(e){_.C("Failed to fetch an ad",e),DT=!0}})},ET=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
- a;return b},GT=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},HT=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},JT=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=IT(a,c))&&(d={ad:c});a.m.trigger(new _.E(b,d))}},IT=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Nf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
- _.Nf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},KT=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},LT=function(a){const b=
18
- a.dashTimedMetadata;let c=_.ag;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.$f)?_.qh:_.oh,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},MT=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},OT=function(a){a.a=MT().getTextTracksManager();const b=a.a.getTracks();a.j=NT(_.K,b)},NT=function(a,b){const c=[];for(const d of b)b=new _.ej(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
- null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.mj(b.id,b)),c.push(b);return c},PT=function(a,b,c,d){c=_.xh(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ia());if(c=c.find(g=>{const h=_.Zh(g);return f.some(k=>{k=_.Zh(k.language||"");return _.$h(h,k)})})){const g=
20
- _.Zh(c);c=f.filter(h=>{h=_.Zh(h.language||"");return _.$h(g,h)});f=c.length?c:f;e=e||!!c.length}_.ui(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.h.info("Will select track",e),b===_.L?a.ta(e):b===_.K&&a.Ha(e))},QT=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},TT=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
- if(a&&a.drm){var d=a.drm,e=_.nl(d);if(e){var f=[_.xd];_.Zn(a)[0].type!==_.Ec&&f.unshift(_.zd);d.preferredDrmSystem===_.xd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Wa[g];h?(c=g===_.zd?cast.framework.ContentProtection.WIDEVINE:g===_.xd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},RT(b,h,a,c),ST(b,h,a,c)):c()}else c()}else c()},RT=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
- _.Pi({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},ST=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.Qi(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
23
- a.licenseHandler=void 0},WT=function(){return UT||(UT=new VT)},XT=function(){return cast.framework.CastReceiverContext.getInstance()},ZT=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=XT();var {hlsVideoSegmentFormat:d}=XT().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.ig:_.hg;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
- YT(f,_.pa),h=YT(f,_.Bb);let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},YT=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},aU=function(a,b){let c=null;const d=$T(a);d&&(c={ad:d});a.f.trigger(new _.E(b,c))},$T=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
- let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},bU=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.g=_.Tn;this.o=_.ot;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Tn)}destroy(){this.l=
26
- this.player=null;return Promise.resolve()}getState(){return this.g}onError(a){a.severity===_.F&&this.a(_.Sn)}a(a){if(a!==this.g)if(this.g===_.Sn&&a!==_.Tn)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.g;this.g=a;this.g===_.On?(this.B=b,this.player.trigger(new _.E(_.Uc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.On&&this.player.trigger(new _.E(_.Qc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.g,previousState:this.o,
27
- timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Cn(this.l,this.g);this.player.trigger(new _.E(_.Kf,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var eT=0,wT={GENERIC:eT,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var cU=class extends bU{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Eb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Eb(){if(this.f&&
28
- this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Ln);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Sn);break;default:this.a(_.Tn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Wn);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Vn);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.On)}}};var dU=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.N;break;case chrome.cast.media.TrackType.AUDIO:c=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.ej(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
- c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.mj(c.id,c));return c}):[],this.a.trigger(new _.E(_.Ss)))}destroy(){this.a=null}getVideoTracks(){return gT(this,_.N)}getAudioTracks(){return gT(this,_.L)}ia(){return gT(this,_.K)}ma(){const a=this.Fa();return a?a.renditions[0]:null}Na(){const a=this.la();return a?a.renditions[0]:null}Ea(){const a=this.qa();return a?a.renditions[0]:
30
- null}$a(){return this.f[_.N]||null}lb(){return this.f[_.L]||null}mb(){return this.f[_.K]||null}Fa(){return iT(this,_.N)}la(){return iT(this,_.L)}qa(){return iT(this,_.K)}gb(a){kT(this,_.N,a)}ta(a){kT(this,_.L,a)}Ha(a){kT(this,_.K,a)}Va(a){this.gb(a&&a.track)}eb(a){this.ta(a&&a.track)}fb(a){this.Ha(a&&a.track)}addTextTrack(){return _.x(function*(){})}oa(){return!0}};dU.prototype.isAbrEnabled=dU.prototype.oa;dU.prototype.addTextTrack=dU.prototype.addTextTrack;dU.prototype.setTextRendition=dU.prototype.fb;
31
- dU.prototype.setAudioRendition=dU.prototype.eb;dU.prototype.setVideoRendition=dU.prototype.Va;dU.prototype.setTextTrack=dU.prototype.Ha;dU.prototype.setAudioTrack=dU.prototype.ta;dU.prototype.setVideoTrack=dU.prototype.gb;dU.prototype.getTextTrack=dU.prototype.qa;dU.prototype.getAudioTrack=dU.prototype.la;dU.prototype.getVideoTrack=dU.prototype.Fa;dU.prototype.getLoadingTextRendition=dU.prototype.mb;dU.prototype.getLoadingAudioRendition=dU.prototype.lb;dU.prototype.getLoadingVideoRendition=dU.prototype.$a;
32
- dU.prototype.getTextRendition=dU.prototype.Ea;dU.prototype.getAudioRendition=dU.prototype.Na;dU.prototype.getVideoRendition=dU.prototype.ma;dU.prototype.getTextTracks=dU.prototype.ia;dU.prototype.getAudioTracks=dU.prototype.getAudioTracks;dU.prototype.getVideoTracks=dU.prototype.getVideoTracks;var AT=class extends _.Us{constructor(a,b,c,d){super();this.h=new _.R(_.kd);this.T=a;this.o=new _.Qj(b);this.S=c;this.X=d;this.g=this.I=_.Rk();this.C=[];this.B=0;this.K=new _.Vo;this.G=this.l=this.a=null;this.A=this.w=!1;this.Y="";this.ea=1E6;this.f=new dU;this.f.initialize(this);this.j=new cU(this);this.H=new _.hs;this.J=null;this.F=new Set;this.N=this.Ia.bind(this);this.aa=this.La.bind(this);this.W=this.Ka.bind(this);this.R=this.Ja.bind(this);this.L=null;window.cast||Object.defineProperty(window,
33
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{nT(!0)},0)}});mT(this);lT.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}destroy(){return _.x(function*(){})}hd(a){this.L=
34
- a}fc(){return this.w}rb(){return this.A}ae(){return this.Y}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,aT(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.x(function*(){if(!a.fc())throw a.h.warn(SS),new _.H(1,8,8001,void 0);if(!oT)throw a.h.warn(QS),new _.H(1,8,8002,void 0);if(a.rb())throw a.h.warn("Already casting"),
35
- new _.H(1,8,8003,void 0);try{yield qT(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.H(1,8,8E3,c);}})}Yd(){this.rb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Yd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.F.delete(a)}play(){return this.isEnded()?sT(this,!0):new Promise((a,b)=>{if(!this.a)return b(PS);this.a.play(null,
36
- a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(PS);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Ln}seek(a){return this.isEnded()?sT(this,!1,a):new Promise((b,c)=>{this.a||c(PS);this.l.isPlayingBreak&&c(NS);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.E(_.cg));this.a.seek(d,()=>{this.trigger(new _.E(_.bg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
37
- this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.t?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(ZS,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var PS="Cannot seek during ads playout.",QS="Cannot switch track",RS="Media session does not exist.",SS="No receivers available",TS="Reset ABR functionality not available on cast.",US="SDK not yet ready",VS="Sender is destroyed.",WS="clpp.cast.CastProxy",XS="clpp.cast.Player",YS="clpp.cast.Receiver",ZS="urn:x-cast:castlabs",aT="urn:x-cast:com.google.cast.media",bT=function(a){return _.x(function*(){yield _.dp(a,_.Ge);yield _.dp(a,_.Fe)})},cT=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.Xd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ce?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.t?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},dT=function(a){if(typeof a!==_.Mf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},eT=function(a,b,c,d){return _.x(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
+ null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Bj(d,a.mimeType,g);f&&g&&(h=_.Pi(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.J(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},fT=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
4
+ d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.ig:return d.FMP4;case _.hg:return b===_.N?d.MPEG2_TS:c.TS;case _.Fc:return c.AAC;case _.Gc:return c.AC3;case _.Hc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Ic:return c.FMP4}},hT=function(a){a=void 0===a?gT:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
+ b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},iT=function(a,b){return a.g.filter(c=>c.type===b)},kT=function(a,b){const c=jT(a);return iT(a,b).find(d=>c.includes(d.id))||null},mT=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.K){const e=a.qa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;lT(a,b)},e=>{a.f[b]=null;a.h.debug(QS,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{lT(a,b)},e=>{a.h.debug(QS,e)}))},jT=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},lT=function(a,b){b===_.L?a.a.trigger(new _.E(_.Gk)):b===_.K&&a.a.trigger(new _.E(_.Hk))},pT=function(a){if(a)for(const b of nT)oT(b)},oT=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.T.length){a.w=!0;a.o.Ge();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa);qT&&a.o.fa(.02)}},rT=function(a){return _.x(function*(){nT.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.X=null})},sT=function(a){return _.x(function*(){a.rb()||(yield cast.framework.CastContext.getInstance().requestSession())})},uT=function(a,b,c){c=
9
+ void 0===c?0:c;return _.x(function*(){var d=a.f.qa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.la())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield tT(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),se:a.getPresentationStartTime(),autoplay:b,Ua:a.g})})},tT=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield sT(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
10
+ b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=fT(b.Hb,_.N);e.hlsSegmentFormat=fT(c,_.L);b.Ua&&(a.L&&(c=yield Promise.resolve(a.L(b.Ua)))&&(b.Ua=c),a.g=b.Ua,a.C=_.Zn(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Ua.remoteTextTracks&&(c=yield Promise.all(b.Ua.remoteTextTracks.map(a.ja.bind(a))),e.tracks=c.filter(k=>k),b.Ua.remoteTextTracks=void 0),delete b.Ua.autoplay,b.Ua.startTime=null,e.customData={playerConfiguration:cT(b.Ua)});c=a.kb()||{};
11
+ var f=vT(c.metadataType),g;typeof b.se===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.se});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=wT(c);if(g=xT(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Nc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},xT=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(yT);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=hT(yT[b]);return Object.assign(b,a)},vT=function(a){var b=void 0===b?gT:b;return Object.values(yT).includes(a)?a:b},wT=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},AT=function(a,b){zT(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(ZS,a.R)},BT=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.t?null:a):a=
13
+ null;a=null===a?null:a+b;return null===a?b:a},zT=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.da.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.E(_.me)))},ET=function(a){return new CT(a.g,()=>{a.trigger(new _.E(_.Xc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
14
+ 1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Se&&(d.preferredAudioLanguage=c.Se);c.If&&(d.preferredTextLanguage=c.If);_.fp(a.f,null);a.trigger(new _.E("castingended"));a.j(b,d)}},()=>DT(a))},DT=function(a){return _.x(function*(){a.trigger(new _.E(_.Wc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.fp(a.f,a.a))})},HT=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{FT=!1;const e=_.Pi(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.li(f.data),h=(new DOMParser).parseFromString(g,
15
+ _.Sf);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=GT(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=GT(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),FT=!0}}catch(e){_.C("Failed to fetch an ad",e),FT=!0}})},GT=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
+ a;return b},IT=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},JT=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},LT=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=KT(a,c))&&(d={ad:c});a.m.trigger(new _.E(b,d))}},KT=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Mf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
+ _.Mf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},MT=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},NT=function(a){const b=
18
+ a.dashTimedMetadata;let c=_.ag;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.$f)?_.qh:_.oh,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},OT=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},QT=function(a){a.a=OT().getTextTracksManager();const b=a.a.getTracks();a.j=PT(_.K,b)},PT=function(a,b){const c=[];for(const d of b)b=new _.ej(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
+ null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.mj(b.id,b)),c.push(b);return c},RT=function(a,b,c,d){c=_.xh(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ia());if(c=c.find(g=>{const h=_.Zh(g);return f.some(k=>{k=_.Zh(k.language||"");return _.$h(h,k)})})){const g=
20
+ _.Zh(c);c=f.filter(h=>{h=_.Zh(h.language||"");return _.$h(g,h)});f=c.length?c:f;e=e||!!c.length}_.ui(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.h.info("Will select track",e),b===_.L?a.ta(e):b===_.K&&a.Ha(e))},ST=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},VT=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
+ if(a&&a.drm){var d=a.drm,e=_.nl(d);if(e){var f=[_.wd];_.Zn(a)[0].type!==_.Dc&&f.unshift(_.yd);d.preferredDrmSystem===_.wd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Wa[g];h?(c=g===_.yd?cast.framework.ContentProtection.WIDEVINE:g===_.wd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},TT(b,h,a,c),UT(b,h,a,c)):c()}else c()}else c()},TT=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
+ _.Pi({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},UT=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.Qi(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
23
+ a.licenseHandler=void 0},YT=function(){return WT||(WT=new XT)},ZT=function(){return cast.framework.CastReceiverContext.getInstance()},aU=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=ZT();var {hlsVideoSegmentFormat:d}=ZT().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.ig:_.hg;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
+ $T(f,_.pa),h=$T(f,_.Bb);let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},$T=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},cU=function(a,b){let c=null;const d=bU(a);d&&(c={ad:d});a.f.trigger(new _.E(b,c))},bU=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
+ let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},dU=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.g=_.Tn;this.o=_.rt;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Tn)}destroy(){this.l=
26
+ this.player=null;return Promise.resolve()}getState(){return this.g}onError(a){a.severity===_.F&&this.a(_.Sn)}a(a){if(a!==this.g)if(this.g===_.Sn&&a!==_.Tn)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.g;this.g=a;this.g===_.On?(this.B=b,this.player.trigger(new _.E(_.Qc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.On&&this.player.trigger(new _.E(_.Pc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.g,previousState:this.o,
27
+ timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Cn(this.l,this.g);this.player.trigger(new _.E(_.Jf,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var gT=0,yT={GENERIC:gT,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var eU=class extends dU{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Eb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Eb(){if(this.f&&
28
+ this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Ln);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Sn);break;default:this.a(_.Tn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Wn);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Vn);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.On)}}};var fU=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.N;break;case chrome.cast.media.TrackType.AUDIO:c=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.ej(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
+ c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.mj(c.id,c));return c}):[],this.a.trigger(new _.E(_.Vs)))}destroy(){this.a=null}getVideoTracks(){return iT(this,_.N)}getAudioTracks(){return iT(this,_.L)}ia(){return iT(this,_.K)}ma(){const a=this.Fa();return a?a.renditions[0]:null}Na(){const a=this.la();return a?a.renditions[0]:null}Ea(){const a=this.qa();return a?a.renditions[0]:
30
+ null}$a(){return this.f[_.N]||null}lb(){return this.f[_.L]||null}mb(){return this.f[_.K]||null}Fa(){return kT(this,_.N)}la(){return kT(this,_.L)}qa(){return kT(this,_.K)}gb(a){mT(this,_.N,a)}ta(a){mT(this,_.L,a)}Ha(a){mT(this,_.K,a)}Va(a){this.gb(a&&a.track)}eb(a){this.ta(a&&a.track)}fb(a){this.Ha(a&&a.track)}addTextTrack(){return _.x(function*(){})}oa(){return!0}};fU.prototype.isAbrEnabled=fU.prototype.oa;fU.prototype.addTextTrack=fU.prototype.addTextTrack;fU.prototype.setTextRendition=fU.prototype.fb;
31
+ fU.prototype.setAudioRendition=fU.prototype.eb;fU.prototype.setVideoRendition=fU.prototype.Va;fU.prototype.setTextTrack=fU.prototype.Ha;fU.prototype.setAudioTrack=fU.prototype.ta;fU.prototype.setVideoTrack=fU.prototype.gb;fU.prototype.getTextTrack=fU.prototype.qa;fU.prototype.getAudioTrack=fU.prototype.la;fU.prototype.getVideoTrack=fU.prototype.Fa;fU.prototype.getLoadingTextRendition=fU.prototype.mb;fU.prototype.getLoadingAudioRendition=fU.prototype.lb;fU.prototype.getLoadingVideoRendition=fU.prototype.$a;
32
+ fU.prototype.getTextRendition=fU.prototype.Ea;fU.prototype.getAudioRendition=fU.prototype.Na;fU.prototype.getVideoRendition=fU.prototype.ma;fU.prototype.getTextTracks=fU.prototype.ia;fU.prototype.getAudioTracks=fU.prototype.getAudioTracks;fU.prototype.getVideoTracks=fU.prototype.getVideoTracks;var CT=class extends _.Xs{constructor(a,b,c,d){super();this.h=new _.R(_.jd);this.T=a;this.o=new _.Qj(b);this.S=c;this.X=d;this.g=this.I=_.Rk();this.C=[];this.B=0;this.K=new _.Yo;this.G=this.l=this.a=null;this.A=this.w=!1;this.Y="";this.ea=1E6;this.f=new fU;this.f.initialize(this);this.j=new eU(this);this.H=new _.ks;this.J=null;this.F=new Set;this.N=this.Ia.bind(this);this.aa=this.La.bind(this);this.W=this.Ka.bind(this);this.R=this.Ja.bind(this);this.L=null;window.cast||Object.defineProperty(window,
33
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{pT(!0)},0)}});oT(this);nT.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}destroy(){return _.x(function*(){})}hd(a){this.L=
34
+ a}fc(){return this.w}rb(){return this.A}ae(){return this.Y}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,cT(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.x(function*(){if(!a.fc())throw a.h.warn(US),new _.H(1,8,8001,void 0);if(!qT)throw a.h.warn(SS),new _.H(1,8,8002,void 0);if(a.rb())throw a.h.warn("Already casting"),
35
+ new _.H(1,8,8003,void 0);try{yield sT(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.H(1,8,8E3,c);}})}Zd(){this.rb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Xd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Xd&&this.F.delete(a)}play(){return this.isEnded()?uT(this,!0):new Promise((a,b)=>{if(!this.a)return b(RS);this.a.play(null,
36
+ a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(RS);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Ln}seek(a){return this.isEnded()?uT(this,!1,a):new Promise((b,c)=>{this.a||c(RS);this.l.isPlayingBreak&&c(PS);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.E(_.cg));this.a.seek(d,()=>{this.trigger(new _.E(_.bg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
37
+ this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.t?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(aT,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
38
38
  this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.t?null:1E-8===a?0:a}getSeekRange(){let a=
39
- {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.ot}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?bT(this.a.customData.stats):_.Gn()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.fc())if(oT){b.C=_.Zn(a);b.g=_.Tk(b.I,a);var c=b.C[b.B];yield rT(b,{source:c,
40
- isLive:c.isLive,autoplay:b.g.autoplay,Ua:b.g,Hb:c.Hb,audioMimeType:c.audioMimeType})}else b.h.warn(QS);else b.h.warn(SS)})}getBufferInfo(){return new _.Ts}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.h.warn(RS)}onError(a){if(a&&
41
- (this.trigger(new _.E(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.kd}canPlay(){return this.fc()?2:0}kb(){return this.J}kc(a){this.J=vT(a)}Td(){this.J=null}Be(a){const b=this.kb()||{};a={metadataType:tT(b.metadataType),title:a};this.kc(Object.assign({},b,a))}ze(a){const b=this.kb()||{},c=tT(b.metadataType);a=new chrome.cast.Image(a);this.kc(Object.assign({},b,{metadataType:c,images:[a]}))}ye(a){const b=this.kb()||{};this.kc(Object.assign({},b,{metadataType:3,artist:a}))}Ae(a){const b=
42
- this.kb()||{};a={metadataType:tT(b.metadataType),releaseDate:a};this.kc(Object.assign({},b,a))}Ia(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;oT=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Y=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Ge()}La(a){this.h.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;yT(this,a.session);break;
43
- case cast.framework.SessionState.SESSION_RESUMED:this.rb()||(this.A=!0,yT(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.rb()&&this.a){const d=this.a.media;var b=this.f.la(),c=this.f.qa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:zT(this),If:c,Se:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(XS,
44
- this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}Ka(a){this.h.debug("New media session",a.mediaSession);xT(this,a.mediaSession)}Ja(a,b){if(a===XS&&0<this.F.size){const c=bT(b);this.F.forEach(d=>d(c))}}da(){this.trigger(new _.E(_.Uf))}ja(a){const b=this;return _.x(function*(){let c=null;const d=yield cT(a,[_.Sf,_.Dc],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ea++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
45
- d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};AT.prototype.getTextDisplayer=AT.prototype.getTextDisplayer;AT.prototype.getNetworkEngine=AT.prototype.getNetworkEngine;AT.prototype.setNetworkEngine=AT.prototype.setNetworkEngine;var oT=!1,lT=new Set;window.__onGCastApiAvailable=nT;var eU=class extends _.Us{constructor(a,b,c){super();this.f=a;this.g=b;this.j=typeof c===_.Yd?c:(d,e)=>{this.f&&d!==_.Ln&&d!==_.Tn&&this.f.load(e)};this.a=CT(this);this.h=new _.R(US);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield pT(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}Qd(){return!!this.a&&this.a.fc()&&oT}rb(){return!!this.a&&this.a.rb()}ae(){return this.a?this.a.ae():""}hd(a){this.a&&this.a.hd(a)}cast(a){const b=this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),
46
- b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.la();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.qa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Pc?e.isLive:b.f.isLive();d={source:e,
47
- isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),se:b.f.getPresentationStartTime(),Hb:h,audioMimeType:k,Ua:l}}var c=d}yield BT(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield rT(b.a,c)))}}catch(d){b.h.error("Error while trying to cast",d),c=new _.E(_.r,{detail:d}),b.trigger(c)}})}Yd(){this.a&&this.a.Yd()}ig(a){const b=this;return _.x(function*(){a!==b.g&&(b.g=a,b.a&&(yield pT(b.a)),b.a=CT(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?
48
- yield b.a.sendMessage(XS,a):b.h.warn(TS)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.h.warn(TS)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.h.warn(TS)}kb(){return this.a&&this.a.kb()}kc(a){this.a&&this.a.kc(a)}Td(){this.a&&this.a.Td()}Be(a){this.a&&this.a.Be(a)}ze(a){this.a&&this.a.ze(a)}ye(a){this.a&&this.a.ye(a)}Ae(a){this.a&&this.a.Ae(a)}};_.z(US,eU);eU.prototype.setContentReleaseDate=eU.prototype.Ae;eU.prototype.setContentArtist=eU.prototype.ye;
49
- eU.prototype.setContentImage=eU.prototype.ze;eU.prototype.setContentTitle=eU.prototype.Be;eU.prototype.clearContentMetadata=eU.prototype.Td;eU.prototype.setContentMetadata=eU.prototype.kc;eU.prototype.getContentMetadata=eU.prototype.kb;eU.prototype.removeMessageListener=eU.prototype.removeMessageListener;eU.prototype.addMessageListener=eU.prototype.addMessageListener;eU.prototype.sendMessage=eU.prototype.sendMessage;eU.prototype.changeReceiverId=eU.prototype.ig;eU.prototype.forceDisconnect=eU.prototype.Yd;
50
- eU.prototype.cast=eU.prototype.cast;eU.prototype.setPlayerConfigInterceptor=eU.prototype.hd;eU.prototype.getReceiverName=eU.prototype.ae;eU.prototype.isCasting=eU.prototype.rb;eU.prototype.canCast=eU.prototype.Qd;eU.prototype.destroy=eU.prototype.destroy;var fU=class extends bU{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.Y.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.T.bind(this);this.L=this.ea.bind(this);this.G=this.aa.bind(this);this.F=this.U.bind(this);this.f=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
39
+ {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.rt}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?dT(this.a.customData.stats):_.Gn()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.fc())if(qT){b.C=_.Zn(a);b.g=_.Tk(b.I,a);var c=b.C[b.B];yield tT(b,{source:c,
40
+ isLive:c.isLive,autoplay:b.g.autoplay,Ua:b.g,Hb:c.Hb,audioMimeType:c.audioMimeType})}else b.h.warn(SS);else b.h.warn(US)})}getBufferInfo(){return new _.Ws}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.h.warn(TS)}onError(a){if(a&&
41
+ (this.trigger(new _.E(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.jd}canPlay(){return this.fc()?2:0}kb(){return this.J}kc(a){this.J=xT(a)}Ud(){this.J=null}Be(a){const b=this.kb()||{};a={metadataType:vT(b.metadataType),title:a};this.kc(Object.assign({},b,a))}ze(a){const b=this.kb()||{},c=vT(b.metadataType);a=new chrome.cast.Image(a);this.kc(Object.assign({},b,{metadataType:c,images:[a]}))}ye(a){const b=this.kb()||{};this.kc(Object.assign({},b,{metadataType:3,artist:a}))}Ae(a){const b=
42
+ this.kb()||{};a={metadataType:vT(b.metadataType),releaseDate:a};this.kc(Object.assign({},b,a))}Ia(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;qT=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Y=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Ge()}La(a){this.h.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;AT(this,a.session);break;
43
+ case cast.framework.SessionState.SESSION_RESUMED:this.rb()||(this.A=!0,AT(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.rb()&&this.a){const d=this.a.media;var b=this.f.la(),c=this.f.qa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:BT(this),If:c,Se:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(ZS,
44
+ this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}Ka(a){this.h.debug("New media session",a.mediaSession);zT(this,a.mediaSession)}Ja(a,b){if(a===ZS&&0<this.F.size){const c=dT(b);this.F.forEach(d=>d(c))}}da(){this.trigger(new _.E(_.Tf))}ja(a){const b=this;return _.x(function*(){let c=null;const d=yield eT(a,[_.Rf,_.Cc],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ea++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
45
+ d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};CT.prototype.getTextDisplayer=CT.prototype.getTextDisplayer;CT.prototype.getNetworkEngine=CT.prototype.getNetworkEngine;CT.prototype.setNetworkEngine=CT.prototype.setNetworkEngine;var qT=!1,nT=new Set;window.__onGCastApiAvailable=pT;var gU=class extends _.Xs{constructor(a,b,c){super();this.f=a;this.g=b;this.j=typeof c===_.Xd?c:(d,e)=>{this.f&&d!==_.Ln&&d!==_.Tn&&this.f.load(e)};this.a=ET(this);this.h=new _.R(WS);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield rT(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}Rd(){return!!this.a&&this.a.fc()&&qT}rb(){return!!this.a&&this.a.rb()}ae(){return this.a?this.a.ae():""}hd(a){this.a&&this.a.hd(a)}cast(a){const b=this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),
46
+ b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.la();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.qa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Nc?e.isLive:b.f.isLive();d={source:e,
47
+ isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),se:b.f.getPresentationStartTime(),Hb:h,audioMimeType:k,Ua:l}}var c=d}yield DT(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield tT(b.a,c)))}}catch(d){b.h.error("Error while trying to cast",d),c=new _.E(_.r,{detail:d}),b.trigger(c)}})}Zd(){this.a&&this.a.Zd()}ig(a){const b=this;return _.x(function*(){a!==b.g&&(b.g=a,b.a&&(yield rT(b.a)),b.a=ET(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?
48
+ yield b.a.sendMessage(ZS,a):b.h.warn(VS)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.h.warn(VS)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.h.warn(VS)}kb(){return this.a&&this.a.kb()}kc(a){this.a&&this.a.kc(a)}Ud(){this.a&&this.a.Ud()}Be(a){this.a&&this.a.Be(a)}ze(a){this.a&&this.a.ze(a)}ye(a){this.a&&this.a.ye(a)}Ae(a){this.a&&this.a.Ae(a)}};_.z(WS,gU);gU.prototype.setContentReleaseDate=gU.prototype.Ae;gU.prototype.setContentArtist=gU.prototype.ye;
49
+ gU.prototype.setContentImage=gU.prototype.ze;gU.prototype.setContentTitle=gU.prototype.Be;gU.prototype.clearContentMetadata=gU.prototype.Ud;gU.prototype.setContentMetadata=gU.prototype.kc;gU.prototype.getContentMetadata=gU.prototype.kb;gU.prototype.removeMessageListener=gU.prototype.removeMessageListener;gU.prototype.addMessageListener=gU.prototype.addMessageListener;gU.prototype.sendMessage=gU.prototype.sendMessage;gU.prototype.changeReceiverId=gU.prototype.ig;gU.prototype.forceDisconnect=gU.prototype.Zd;
50
+ gU.prototype.cast=gU.prototype.cast;gU.prototype.setPlayerConfigInterceptor=gU.prototype.hd;gU.prototype.getReceiverName=gU.prototype.ae;gU.prototype.isCasting=gU.prototype.rb;gU.prototype.canCast=gU.prototype.Rd;gU.prototype.destroy=gU.prototype.destroy;var hU=class extends dU{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.Y.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.T.bind(this);this.L=this.ea.bind(this);this.G=this.aa.bind(this);this.F=this.U.bind(this);this.f=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
51
51
  this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
52
- d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}S(){this.player.trigger(new _.E(_.Re));this.a(_.Wn)}R(){this.a(_.Vn)}Y(){this.a(_.Ln)}X(a){a.isBuffering?
53
- this.a(_.On):(a=this.player.isPaused()?_.Vn:_.Wn,this.a(a))}W(){this.j=1;this.player.trigger(new _.E(_.cg))}T(){this.player.trigger(new _.E(_.bg))}ea(){this.j=2}aa(){this.a(_.Un)}N(a){const b=this.player.getStats();this.player.trigger(new _.E(_.Nc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.E(_.r,{detail:a}));this.a(_.Sn)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.t?c:1;this.l=typeof d===_.t?d:1;this.g=typeof e===_.t?e:0}vb(){return"Google Cast Framework"}wb(){return cast.framework.VERSION}Cb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}gc(){return!1}Mb(){return this.a.clickThroughUrl||
52
+ d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}S(){this.player.trigger(new _.E(_.Qe));this.a(_.Wn)}R(){this.a(_.Vn)}Y(){this.a(_.Ln)}X(a){a.isBuffering?
53
+ this.a(_.On):(a=this.player.isPaused()?_.Vn:_.Wn,this.a(a))}W(){this.j=1;this.player.trigger(new _.E(_.cg))}T(){this.player.trigger(new _.E(_.bg))}ea(){this.j=2}aa(){this.a(_.Un)}N(a){const b=this.player.getStats();this.player.trigger(new _.E(_.Mc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.E(_.r,{detail:a}));this.a(_.Sn)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.t?c:1;this.l=typeof d===_.t?d:1;this.g=typeof e===_.t?e:0}vb(){return"Google Cast Framework"}wb(){return cast.framework.VERSION}Cb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}gc(){return!1}Mb(){return this.a.clickThroughUrl||
54
54
  null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}zb(){return 0}yb(){return 0}nb(){return 0}ab(){switch(this.Nb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Nb(){return this.f.position}Ob(){return this.j}Bb(){return this.l}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
55
55
  Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.Bb;Z.prototype.getPositionInSequence=Z.prototype.Ob;Z.prototype.getPodTimeOffset=Z.prototype.Nb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.ab;Z.prototype.getMediaBitrate=Z.prototype.nb;Z.prototype.getMediaHeight=Z.prototype.yb;Z.prototype.getMediaWidth=Z.prototype.zb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.Mb;
56
56
  Z.prototype.isBumper=Z.prototype.gc;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.Cb;
57
- Z.prototype.getAdManagerVersion=Z.prototype.wb;Z.prototype.getAdManagerName=Z.prototype.vb;var gU=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Pb(){return!!this.a.find(a=>0===a.position)}pb(){return!!this.a.find(a=>-1===a.position)}};gU.prototype.hasPostroll=gU.prototype.pb;gU.prototype.hasPreroll=gU.prototype.Pb;gU.prototype.getCuePoints=gU.prototype.getCuePoints;var hU=class{constructor(a){this.m=a;this.a=null;this.g=this.j.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];HT().addEventListener(this.f,
58
- this.g)}load(){const a=this;return _.x(function*(){DT&&(DT=!1,GT(a,0))})}start(){return _.x(function*(){HT().play()})}resume(){-1!==this.getPosition()&&HT().play()}pause(){-1!==this.getPosition()&&HT().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.t?a:-1}dispose(){const a=this;return _.x(function*(){HT().removeEventListener(a.f,a.g)})}j(a){const b=cast.framework.events.EndedReason;
59
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=HT().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.E(_.uc,{adsTimeline:new gU(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:JT(this,_.jc,a);break;case cast.framework.events.EventType.BREAK_STARTED:JT(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_ENDED:JT(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:JT(this,_.qc,a);
60
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(JT(this,_.pc,a),JT(this,_.rc,a)):a.endedReason===b.STOPPED?JT(this,_.rc,a):a.endedReason===b.END_OF_STREAM?(JT(this,_.gc,a),JT(this,_.rc,a)):a.endedReason===b.ERROR&&GT(this,1);break;case cast.framework.events.EventType.PLAYING:JT(this,_.oc,a);break;case cast.framework.events.EventType.PAUSE:JT(this,_.mc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?JT(this,_.ec,a):JT(this,_.oc,a)}}};
61
- hU.prototype.getPosition=hU.prototype.getPosition;hU.prototype.setVolume=hU.prototype.setVolume;hU.prototype.getVolume=hU.prototype.getVolume;hU.prototype.skip=hU.prototype.skip;hU.prototype.pause=hU.prototype.pause;hU.prototype.resume=hU.prototype.resume;var DT=!1;var iU=class{constructor(a){this.Vb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(KT(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(KT(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>LT(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
62
- _.rh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.th;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.uh}b&&this.Vb(new _.E(b,{detail:LT(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Vb(new _.E(_.rh,{detail:b}))}};var jU=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.g=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;MT().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.g=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;MT().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.g}ia(){return this.j}ma(){return null}Na(){const a=
57
+ Z.prototype.getAdManagerVersion=Z.prototype.wb;Z.prototype.getAdManagerName=Z.prototype.vb;var iU=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Pb(){return!!this.a.find(a=>0===a.position)}pb(){return!!this.a.find(a=>-1===a.position)}};iU.prototype.hasPostroll=iU.prototype.pb;iU.prototype.hasPreroll=iU.prototype.Pb;iU.prototype.getCuePoints=iU.prototype.getCuePoints;var jU=class{constructor(a){this.m=a;this.a=null;this.g=this.j.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];JT().addEventListener(this.f,
58
+ this.g)}load(){const a=this;return _.x(function*(){FT&&(FT=!1,IT(a,0))})}start(){return _.x(function*(){JT().play()})}resume(){-1!==this.getPosition()&&JT().play()}pause(){-1!==this.getPosition()&&JT().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.t?a:-1}dispose(){const a=this;return _.x(function*(){JT().removeEventListener(a.f,a.g)})}j(a){const b=cast.framework.events.EndedReason;
59
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=JT().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.E(_.tc,{adsTimeline:new iU(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:LT(this,_.ic,a);break;case cast.framework.events.EventType.BREAK_STARTED:LT(this,_.bc,a);break;case cast.framework.events.EventType.BREAK_ENDED:LT(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:LT(this,_.pc,a);
60
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(LT(this,_.oc,a),LT(this,_.qc,a)):a.endedReason===b.STOPPED?LT(this,_.qc,a):a.endedReason===b.END_OF_STREAM?(LT(this,_.fc,a),LT(this,_.qc,a)):a.endedReason===b.ERROR&&IT(this,1);break;case cast.framework.events.EventType.PLAYING:LT(this,_.nc,a);break;case cast.framework.events.EventType.PAUSE:LT(this,_.lc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?LT(this,_.dc,a):LT(this,_.nc,a)}}};
61
+ jU.prototype.getPosition=jU.prototype.getPosition;jU.prototype.setVolume=jU.prototype.setVolume;jU.prototype.getVolume=jU.prototype.getVolume;jU.prototype.skip=jU.prototype.skip;jU.prototype.pause=jU.prototype.pause;jU.prototype.resume=jU.prototype.resume;var FT=!1;var kU=class{constructor(a){this.Vb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(MT(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(MT(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>NT(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
62
+ _.rh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.th;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.uh}b&&this.Vb(new _.E(b,{detail:NT(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Vb(new _.E(_.rh,{detail:b}))}};var lU=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.g=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;OT().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.g=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;OT().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.g}ia(){return this.j}ma(){return null}Na(){const a=
63
63
  this.la();return a&&a.renditions[0]}Ea(){const a=this.qa();return a&&a.renditions[0]}$a(){return null}lb(){return null}mb(){return null}Fa(){return null}la(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.t&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}qa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.t&&(b=b.toString(),a=this.ia().find(c=>c.id===b)||null)}return a}gb(){this.h.warn("Video tracks unavailable on Cast")}ta(a){a&&this.f&&
64
- this.f.setActiveById(+a.id)}Ha(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Va(){this.h.warn("Video renditions unavailable on Cast")}eb(a){this.ta(a&&a.track)}fb(a){this.Ha(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield cT(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
65
- c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),OT(b)}catch(e){throw b.h.warn("failed on track",a),e;}}})}oa(){return!0}w(){this.f=MT().getAudioTracksManager();var a=this.f.getTracks();this.g=NT(_.L,a);OT(this);a=this.m.getConfiguration();PT(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);PT(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};jU.prototype.isAbrEnabled=jU.prototype.oa;
66
- jU.prototype.addTextTrack=jU.prototype.addTextTrack;jU.prototype.setTextRendition=jU.prototype.fb;jU.prototype.setAudioRendition=jU.prototype.eb;jU.prototype.setVideoRendition=jU.prototype.Va;jU.prototype.setTextTrack=jU.prototype.Ha;jU.prototype.setAudioTrack=jU.prototype.ta;jU.prototype.setVideoTrack=jU.prototype.gb;jU.prototype.getTextTrack=jU.prototype.qa;jU.prototype.getAudioTrack=jU.prototype.la;jU.prototype.getVideoTrack=jU.prototype.Fa;jU.prototype.getLoadingTextRendition=jU.prototype.mb;
67
- jU.prototype.getLoadingAudioRendition=jU.prototype.lb;jU.prototype.getLoadingVideoRendition=jU.prototype.$a;jU.prototype.getTextRendition=jU.prototype.Ea;jU.prototype.getAudioRendition=jU.prototype.Na;jU.prototype.getVideoRendition=jU.prototype.ma;jU.prototype.getTextTracks=jU.prototype.ia;jU.prototype.getAudioTracks=jU.prototype.getAudioTracks;jU.prototype.getVideoTracks=jU.prototype.getVideoTracks;var kU=class extends _.Us{constructor(){super();this.h=new _.R(VS);this.g=this.w=_.Rk();this.A=null;this.l=-1;this.F=new _.Vo;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.w=b);a=QT();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new fU(this);this.a.init();this.j=new jU;this.j.initialize(this);this.o=new iU(c=>this.trigger(c));this.o.init()}unload(){const a=
68
- cast.framework.messages.PlayerState,b=QT();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.x(function*(){a.B=null;a.w=_.Rk();a.g=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=QT();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
69
- a.play();return Promise.resolve()}pause(){const a=QT();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return QT().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return QT().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=QT();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(NS);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}getMediaPosition(){return QT().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
70
- QT().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return QT().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;QT().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
71
- null}getLoadedSource(){const a=QT().getMediaInformation();if(a){var b=QT().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Lh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return QT().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=QT().getLiveSeekableRange();
72
- b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.ot}getStats(){var a=_.Gn();if(this.f){a=QT().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.t?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.t?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
73
- this;return _.x(function*(){b.f=new _.mt;b.a.l=b.f.a;b.A=_.Zn(a);b.g=_.Tk(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.t&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:aT(b.g),local:!0};yield QT().load(d)}})}getBufferInfo(){this.h.warn(_.qa);return new _.Ts}getTrackManager(){return this.j}getConfiguration(){return this.g}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}setNetworkEngine(a){this.F=
74
- a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return VS}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.h.warn(RS)}onError(a){a=new _.E(_.r,{detail:a});this.trigger(a)}canPlay(){return _.dk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=aT(this.getStats());var b=QT(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.t&&c.startAbsoluteTime!==
75
- b&&(this.h.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=QT().getStartAbsoluteTime();if(typeof d===_.t){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
76
- a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=bT(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.t?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;TT(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};kU.prototype.getTextDisplayer=kU.prototype.getTextDisplayer;kU.prototype.getNetworkEngine=kU.prototype.getNetworkEngine;
77
- kU.prototype.setNetworkEngine=kU.prototype.setNetworkEngine;var VT=class{constructor(){this.a=!1;this.h=new _.R(WS);this.f=this.m=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.hs;this.l=null}init(a){a&&(this.f=new kU,_.cp(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Tn&&(yield $S(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=XT(),b=XT().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
78
- c.customNamespaces={};c.customNamespaces[XS]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
79
- this.A);a.start(c);a.addCustomMessageListener(XS,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=XT();XT().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(XS,this.w);a.stop();this.m=this.f=null}}hd(a){this.j=a}mh(a){this.l=a}on(a,b){XT().addEventListener(a,b)}off(a,b){XT().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Yd&&this.g.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.g.delete(a)}sendMessage(a,
80
- b){XT().sendCustomMessage(XS,b,aT(a))}fc(){return this.a}kb(){var a;return a=(a=XT().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return ZT(this,a);try{var b=(new DOMParser).parseFromString(a,_.Tf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=XT();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);for(var f=e.length-
81
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.xe);var h=e[f].getElementsByTagName(_.Cb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.xe)||g,m=h[k].getAttribute(_.sd);let n=h[k].getAttribute(_.zg)||void 0,q=h[k].getAttribute(_.Zd)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.Cb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ha).length||a.removeChild(c[d])}return a=
82
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Jb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=XT();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.Ab);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.hb)||void 0,h=e[f].getAttribute(_.gb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.ig,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ab).length||a.removeChild(c[d])}a=
83
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=bT(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield FT(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.t&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.mp(b.m,d),yield _.np(b.m),d=b.m.getLoadedSource(),c.media.contentId=
84
- d.url,c.media.contentType=d.type,d.Hb&&(c.media.hlsVideoSegmentFormat=dT(d.Hb,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=dT(d.audioMimeType,_.L)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.t&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=XT().getPlayerManager(),
85
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.t||typeof c!==_.t||typeof d!==_.t||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.t&&b>=a&&b<=c&&this.m.seek(b))}_.pp(this.m)}}B(a){if(0<this.g.size){const b=bT(a.data);this.g.forEach(c=>c(b))}}};_.z(WS,VT);VT.prototype.getContentMetadata=VT.prototype.kb;VT.prototype.isApiReady=VT.prototype.fc;VT.prototype.sendMessage=VT.prototype.sendMessage;VT.prototype.removeMessageListener=VT.prototype.removeMessageListener;
86
- VT.prototype.addMessageListener=VT.prototype.addMessageListener;VT.prototype.off=VT.prototype.off;VT.prototype.on=VT.prototype.on;VT.prototype.setLoadRequestDataInterceptor=VT.prototype.mh;VT.prototype.setPlayerConfigInterceptor=VT.prototype.hd;VT.prototype.stop=VT.prototype.stop;VT.prototype.start=VT.prototype.start;VT.prototype.init=VT.prototype.init;VT.getInstance=WT;var UT=null;var lU=class{constructor(a){this.f=a;this.a=null;this.g=new _.hs;this.j=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.x(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.l.bind(a);for(const d of a.j)a.g.on(b,d,c)}})}start(){return _.x(function*(){})}resume(){this.a&&
87
- this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(ZS,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.t&&(a=b));return a}dispose(){const a=this;
88
- return _.x(function*(){a.g.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.E(_.uc,{adsTimeline:new gU(a.breaks)})));break;case "isPlayingBreak":a.value?aU(this,_.cc):(aU(this,_.gc),aU(this,_.rc),aU(this,_.dc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(aU(this,_.gc),aU(this,_.rc)),aU(this,_.qc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?aU(this,_.mc):aU(this,_.oc))}}};lU.prototype.getPosition=lU.prototype.getPosition;
89
- lU.prototype.setVolume=lU.prototype.setVolume;lU.prototype.getVolume=lU.prototype.getVolume;lU.prototype.skip=lU.prototype.skip;lU.prototype.pause=lU.prototype.pause;lU.prototype.resume=lU.prototype.resume;var mU=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}isSupported(a,b){return a.namespace()!==_.kd?!1:!(!b||!b.ima)}create(a){return new lU(a.a)}};mU.prototype.create=mU.prototype.create;mU.prototype.isSupported=mU.prototype.isSupported;mU.prototype.name=mU.prototype.name;_.oo(new mU);var nU=class{name(){return"clpp.cast.ads.AdsManagerFactory"}isSupported(a,b){return WT().fc()?!(!b||!b.ima):!1}create(a){return new hU(a)}};nU.prototype.create=nU.prototype.create;nU.prototype.isSupported=nU.prototype.isSupported;nU.prototype.name=nU.prototype.name;_.oo(new nU);};f.call(g, window);
64
+ this.f.setActiveById(+a.id)}Ha(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Va(){this.h.warn("Video renditions unavailable on Cast")}eb(a){this.ta(a&&a.track)}fb(a){this.Ha(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield eT(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
65
+ c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),QT(b)}catch(e){throw b.h.warn("failed on track",a),e;}}})}oa(){return!0}w(){this.f=OT().getAudioTracksManager();var a=this.f.getTracks();this.g=PT(_.L,a);QT(this);a=this.m.getConfiguration();RT(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);RT(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};lU.prototype.isAbrEnabled=lU.prototype.oa;
66
+ lU.prototype.addTextTrack=lU.prototype.addTextTrack;lU.prototype.setTextRendition=lU.prototype.fb;lU.prototype.setAudioRendition=lU.prototype.eb;lU.prototype.setVideoRendition=lU.prototype.Va;lU.prototype.setTextTrack=lU.prototype.Ha;lU.prototype.setAudioTrack=lU.prototype.ta;lU.prototype.setVideoTrack=lU.prototype.gb;lU.prototype.getTextTrack=lU.prototype.qa;lU.prototype.getAudioTrack=lU.prototype.la;lU.prototype.getVideoTrack=lU.prototype.Fa;lU.prototype.getLoadingTextRendition=lU.prototype.mb;
67
+ lU.prototype.getLoadingAudioRendition=lU.prototype.lb;lU.prototype.getLoadingVideoRendition=lU.prototype.$a;lU.prototype.getTextRendition=lU.prototype.Ea;lU.prototype.getAudioRendition=lU.prototype.Na;lU.prototype.getVideoRendition=lU.prototype.ma;lU.prototype.getTextTracks=lU.prototype.ia;lU.prototype.getAudioTracks=lU.prototype.getAudioTracks;lU.prototype.getVideoTracks=lU.prototype.getVideoTracks;var mU=class extends _.Xs{constructor(){super();this.h=new _.R(XS);this.g=this.w=_.Rk();this.A=null;this.l=-1;this.F=new _.Yo;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.w=b);a=ST();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new hU(this);this.a.init();this.j=new lU;this.j.initialize(this);this.o=new kU(c=>this.trigger(c));this.o.init()}unload(){const a=
68
+ cast.framework.messages.PlayerState,b=ST();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.x(function*(){a.B=null;a.w=_.Rk();a.g=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=ST();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
69
+ a.play();return Promise.resolve()}pause(){const a=ST();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return ST().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return ST().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=ST();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(PS);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}getMediaPosition(){return ST().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
70
+ ST().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return ST().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;ST().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
71
+ null}getLoadedSource(){const a=ST().getMediaInformation();if(a){var b=ST().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Lh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return ST().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=ST().getLiveSeekableRange();
72
+ b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.rt}getStats(){var a=_.Gn();if(this.f){a=ST().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.t?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.t?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
73
+ this;return _.x(function*(){b.f=new _.pt;b.a.l=b.f.a;b.A=_.Zn(a);b.g=_.Tk(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.t&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:cT(b.g),local:!0};yield ST().load(d)}})}getBufferInfo(){this.h.warn(_.qa);return new _.Ws}getTrackManager(){return this.j}getConfiguration(){return this.g}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}setNetworkEngine(a){this.F=
74
+ a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return XS}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.h.warn(TS)}onError(a){a=new _.E(_.r,{detail:a});this.trigger(a)}canPlay(){return _.dk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=cT(this.getStats());var b=ST(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.t&&c.startAbsoluteTime!==
75
+ b&&(this.h.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=ST().getStartAbsoluteTime();if(typeof d===_.t){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
76
+ a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=dT(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.t?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;VT(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};mU.prototype.getTextDisplayer=mU.prototype.getTextDisplayer;mU.prototype.getNetworkEngine=mU.prototype.getNetworkEngine;
77
+ mU.prototype.setNetworkEngine=mU.prototype.setNetworkEngine;var XT=class{constructor(){this.a=!1;this.h=new _.R(YS);this.f=this.m=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.ks;this.l=null}init(a){a&&(this.f=new mU,_.fp(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Tn&&(yield bT(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=ZT(),b=ZT().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
78
+ c.customNamespaces={};c.customNamespaces[ZS]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
79
+ this.A);a.start(c);a.addCustomMessageListener(ZS,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=ZT();ZT().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(ZS,this.w);a.stop();this.m=this.f=null}}hd(a){this.j=a}mh(a){this.l=a}on(a,b){ZT().addEventListener(a,b)}off(a,b){ZT().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Xd&&this.g.add(a)}removeMessageListener(a){typeof a===_.Xd&&this.g.delete(a)}sendMessage(a,
80
+ b){ZT().sendCustomMessage(ZS,b,cT(a))}fc(){return this.a}kb(){var a;return a=(a=ZT().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return aU(this,a);try{var b=(new DOMParser).parseFromString(a,_.Sf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=ZT();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);for(var f=e.length-
81
+ 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.we);var h=e[f].getElementsByTagName(_.Cb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.we)||g,m=h[k].getAttribute(_.rd);let n=h[k].getAttribute(_.zg)||void 0,q=h[k].getAttribute(_.Yd)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.Cb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ha).length||a.removeChild(c[d])}return a=
82
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Ib)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=ZT();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.Ab);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.hb)||void 0,h=e[f].getAttribute(_.gb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.ig,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ab).length||a.removeChild(c[d])}a=
83
+ (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=dT(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield HT(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.t&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.pp(b.m,d),yield _.qp(b.m),d=b.m.getLoadedSource(),c.media.contentId=
84
+ d.url,c.media.contentType=d.type,d.Hb&&(c.media.hlsVideoSegmentFormat=fT(d.Hb,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=fT(d.audioMimeType,_.L)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.t&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=ZT().getPlayerManager(),
85
+ c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.t||typeof c!==_.t||typeof d!==_.t||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.t&&b>=a&&b<=c&&this.m.seek(b))}_.sp(this.m)}}B(a){if(0<this.g.size){const b=dT(a.data);this.g.forEach(c=>c(b))}}};_.z(YS,XT);XT.prototype.getContentMetadata=XT.prototype.kb;XT.prototype.isApiReady=XT.prototype.fc;XT.prototype.sendMessage=XT.prototype.sendMessage;XT.prototype.removeMessageListener=XT.prototype.removeMessageListener;
86
+ XT.prototype.addMessageListener=XT.prototype.addMessageListener;XT.prototype.off=XT.prototype.off;XT.prototype.on=XT.prototype.on;XT.prototype.setLoadRequestDataInterceptor=XT.prototype.mh;XT.prototype.setPlayerConfigInterceptor=XT.prototype.hd;XT.prototype.stop=XT.prototype.stop;XT.prototype.start=XT.prototype.start;XT.prototype.init=XT.prototype.init;XT.getInstance=YT;var WT=null;var nU=class{constructor(a){this.f=a;this.a=null;this.g=new _.ks;this.j=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.x(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.l.bind(a);for(const d of a.j)a.g.on(b,d,c)}})}start(){return _.x(function*(){})}resume(){this.a&&
87
+ this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(aT,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.t&&(a=b));return a}dispose(){const a=this;
88
+ return _.x(function*(){a.g.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.E(_.tc,{adsTimeline:new iU(a.breaks)})));break;case "isPlayingBreak":a.value?cU(this,_.bc):(cU(this,_.fc),cU(this,_.qc),cU(this,_.cc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(cU(this,_.fc),cU(this,_.qc)),cU(this,_.pc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?cU(this,_.lc):cU(this,_.nc))}}};nU.prototype.getPosition=nU.prototype.getPosition;
89
+ nU.prototype.setVolume=nU.prototype.setVolume;nU.prototype.getVolume=nU.prototype.getVolume;nU.prototype.skip=nU.prototype.skip;nU.prototype.pause=nU.prototype.pause;nU.prototype.resume=nU.prototype.resume;var oU=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}isSupported(a,b){return a.namespace()!==_.jd?!1:!(!b||!b.ima)}create(a){return new nU(a.a)}};oU.prototype.create=oU.prototype.create;oU.prototype.isSupported=oU.prototype.isSupported;oU.prototype.name=oU.prototype.name;_.oo(new oU);var pU=class{name(){return"clpp.cast.ads.AdsManagerFactory"}isSupported(a,b){return YT().fc()?!(!b||!b.ima):!1}create(a){return new jU(a)}};pU.prototype.create=pU.prototype.create;pU.prototype.isSupported=pU.prototype.isSupported;pU.prototype.name=pU.prototype.name;_.oo(new pU);};f.call(g, window);
package/cl.conviva.js CHANGED
@@ -1,27 +1,27 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var oS="Ad Error",pS="onAdBreakStarted()",qS="onAdBreakStopped()",rS=function(a){var b=_.sk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.ek()&&(f="Apple");_.dk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.fk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.ek()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var qS="Ad Error",rS="onAdBreakStarted()",sS="onAdBreakStopped()",tS=function(a){var b=_.sk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.ek()&&(f="Apple");_.dk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.fk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.ek()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
2
  _.Xj()||_.Uj()||_.Tj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Xj()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Uj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Tj("Hisense")&&(b="",f="Hisense")):_.Tj("Xbox One")&&(f="Microsoft",c=Conviva.Constants.DeviceType.CONSOLE,d=Conviva.Constants.DeviceCategory.XBOX);const g=a.deviceMetadata||{},h=(k,l)=>{k in g||!l||(g[k]=l)};h(Conviva.Constants.DeviceMetadata.TYPE,a.deviceType||
3
- c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},sS=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},tS=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},vS=function(a,b,c,d){const e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=b;e[Conviva.Constants.IS_LIVE]=
4
- sS(!!d);e[Conviva.Constants.ASSET_NAME]=oS;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=uS(a.getId()),e["c3.ad.creativeId"]=uS(a.getCreativeId()),e["c3.ad.system"]=uS(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=uS(a.getApiFramework()),e["c3.ad.advertiser"]=uS(a.getAdvertiserName()),e["c3.ad.position"]=tS(a.getPodIndex()),e["c3.ad.technology"]=0===a.Cb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=uS(a.vb()),e["c3.ad.adManagerVersion"]=uS(a.wb()),e["c3.ad.advertiserCategory"]=uS(null),e["c3.ad.advertiserId"]=uS(null),e["c3.ad.breakId"]=uS(null),e["c3.ad.campaignName"]=uS(null),e["c3.ad.category"]=uS(null),e["c3.ad.classification"]=uS(null),e["c3.ad.creativeName"]=uS(null),e["c3.ad.sequence"]=uS(a.Ob()),e["c3.ad.sessionStartEvent"]=uS(null),e["c3.ad.unitName"]=uS(null),e["c3.ad.dayPart"]=uS(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
- a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=uS(b),e["c3.ad.firstAdSystem"]=uS(c),e["c3.ad.firstCreativeId"]=uS(a));return e},uS=function(a){return a?""+a:"NA"},zS=function(a){a.f.on(a.m,_.cc,a.C.bind(a));a.f.on(a.m,_.dc,a.F.bind(a));a.f.on(a.m,_.qc,a.L.bind(a));a.f.on(a.m,_.nc,a.l.bind(a));a.f.on(a.m,_.mc,a.l.bind(a));a.f.on(a.m,_.oc,a.l.bind(a));a.f.on(a.m,_.ec,a.l.bind(a));a.f.on(a.m,_.rc,a.N.bind(a));
7
- a.f.on(a.m,_.pc,a.K.bind(a));a.f.on(a.m,_.fc,a.G.bind(a));a.f.on(a.m,_.ic,a.I.bind(a));a.f.on(a.m,_.jc,a.J.bind(a));a.f.on(a.m,_.hc,a.H.bind(a));a.f.on(a.m,_.lc,a.T.bind(a));a.f.on(a.m,_.sc,a.R.bind(a));a.f.on(a.m,_.r,b=>{var c=b.detail;if(10003===c.code&&(a.h.debug("onAdError()"),!a.g)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=oS}null===a.a&&wS(a,null);a.a.reportAdError(c,b.FATAL);a.g=!0;a.h.debug("Ad Playback Failure");
8
- xS(a,yS,c)}})},xS=function(a,b,c=oS){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case yS:a.a.reportAdFailed(c,vS(null,a.B,a.A));break;case AS:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},wS=function(a,b){if(!a.o){a.g=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=vS(b,a.B,a.A,a.m.isLive()),d=String(b.wb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.vb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
- d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.h.error("Could not create ad analytics session",c)}}},BS=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.h.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,null,c);Conviva.Analytics.setDeviceMetadata(rS(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
- b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.ra;b[Conviva.Constants.FRAMEWORK_VERSION]=_.fa;a.a.setPlayerInfo(b)},CS=function(a){return a.m.getConfiguration().autoplay||!1},ES=function(a){if(!a.l)if(a.C)a.h.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.K,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.h.debug(a.m.getConfiguration().source);var f={},g=
11
- new _.Hl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.gj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.A(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.h.debug("reportMiscellaneousMetrics()");if(DS(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
- h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.h.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.g=!0;a.I=!1;0<a.j.length&&(a.h.debug("Report deferred events"),a.j.forEach(h=>{h.ff(h.args)}));a.j=[]}},FS=function(a){if(!a.l&&a.a){const b=sS(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},DS=function(a){return null!==a.a&&a.C},GS=function(a){a.h.debug("terminateSession()");
13
- a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.g=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},HS=function(a,b){var c=b.getConfiguration();a.a=!_.A(c.conviva)&&typeof c.conviva===_.De;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.U(b,c)):b.namespace()===_.kd&&(a.a=!1,
14
- a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},IS=function(a){const b=[];typeof a===_.De&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var KS=class{constructor(a,b){this.m=a;this.S=b;this.B="";this.A=_.ra;this.h=new _.R("clpp.conviva.ad");this.f=new _.hs;this.a=null;this.g=this.o=this.w=this.j=!1}initialize(a){this.h.debug("Initialize Ad Insights");this.g=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.ra;zS(this)}release(){this.h.debug("Release Ad Insights");this.w?this.h.debug(_.ja):(_.mh(this.f),this.a&&xS(this,JS),this.f.release(),this.w=!0,this.j=this.g=!1)}destroy(){this.h.debug(_.Ed);this.o?this.h.debug(_.ia):this.o=!0}C(){this.h.debug(pS)}F(){this.h.debug(qS)}L(a){this.h.debug("onAdStarted()");
15
- a=a.ad;this.j||(this.h.warn("Ad load event was not triggered. This will have incidence on VSF"),wS(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.zb(),a.yb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.nb())}l(a){this.h.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.nc:case _.oc:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.mc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ec:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.h.debug("onAdStopped()");this.a&&!this.g&&xS(this,JS)}K(){this.h.debug("onAdSkipped()");this.a&&xS(this,AS)}G(){this.h.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.h.debug("onAdImpression()");if(this.a){const a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}}J(a){this.h.debug("onAdLoaded()");
17
- const b=a.ad,c=()=>{this.j=!0;wS(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Uf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Uf),c())})}H(){this.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}T(){this.h.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.h.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},AS=0,JS=1,yS=2;var LS=class{constructor(a,b){this.m=a;this.f=new _.hs;this.a=null;this.o=!1;this.G=!0;this.B=this.g=this.A=this.C=this.l=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.h=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.h.debug("Initialize conviva"),this.G=!1,this.F=_.Ng(b),this.K=c,this.m=a,BS(this,this.F),this.f.on(this.m,_.Re,this.da.bind(this)),this.f.on(this.m,_.Kf,this.Y.bind(this)),this.f.on(this.m,_.Nc,this.L.bind(this)),this.f.on(this.m,_.cg,this.X.bind(this)),this.f.on(this.m,
19
- _.bg,this.W.bind(this)),this.f.on(this.m,_.cc,this.S.bind(this)),this.f.on(this.m,_.dc,this.T.bind(this)),this.f.on(this.m,_.uc,this.aa.bind(this)),this.f.on(this.m,_.Mc,this.ea.bind(this)),this.f.on(this.m,_.r,this.N.bind(this)),CS(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),ES(this)))}release(){this.h.debug("Release conviva");this.G?this.h.debug(_.ja):(_.mh(this.f),DS(this)||this.o||!CS(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),DS(this)&&
20
- GS(this),this.a=null,this.G=!0)}destroy(){this.h.debug(_.Ed);this.l?this.h.debug(_.ia):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.h.debug("Report app event error",d),c=!1}return c}da(){this.h.debug("onPlayRequest()");DS(this)||CS(this)?DS(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),DS(this)&&!this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.g=!0),this.A=!1):(this.h.debug("Creating conviva session. On Play Requested / No autoplay"),
21
- ES(this))}Y(a){this.h.debug(_.Ie);const b=c=>{if(this.o&&(this.h.debug("Creating conviva session (On Seek / Replay)"),BS(this,this.F),ES(this),FS(this),DS(this))){var d=this.m.getTrackManager();d=d.ma()||d.$a();d.width&&d.height&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}DS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Wn:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.Vn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.On:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Ln:this.h.debug("onVideoEnded()"),DS(this)&&(this.w&&this.w.pb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.J=!0):GS(this))}}L(a){this.h.debug(_.Ee);if(DS(this)){if(a=a.detail,typeof a.width===_.t&&typeof a.height===_.t&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,
23
- a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.a.setContentInfo(b)}}else this.j.push({ff:this.L.bind(this),args:a})}X(){this.h.debug("onSeeking()");DS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.h.debug("onSeeked()");DS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}aa(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.h.debug(pS);
24
- var b=a.ad;a=0===b.ab();const c=tS(b.getPodIndex());DS(this)||CS(this)||!a||ES(this);if(DS(this)){a=0===b.Cb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.Bb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.dk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")}T(){this.h.debug(qS);
25
- DS(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&GS(this))}N(a){this.h.debug(_.Fe);if(this.o&&this.I)this.h.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.F&&(d=Conviva.Constants.ErrorSeverity.FATAL,DS(this)||ES(this));DS(this)?(this.h.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.h.debug("Video Playback Failure"),
26
- this.I=!0,GS(this))):this.j.push({ff:this.N.bind(this),args:a})}}ea(){this.h.debug("onAutoPlayBlocked()");DS(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,DS(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))}};var MS=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new LS(a,this.h)}onContentWillLoad(a,b){HS(this,a);if(this.a){var c=a.getConfiguration();c=_.Ng(c.conviva||{});try{IS(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new KS(a,()=>this.f.a),this.g.initialize(c))}catch(d){d instanceof _.H?this.U(a,d):this.U(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&FS(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
- this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}U(a,b){a.trigger(new _.E(_.r,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",MS);MS.prototype.reportAppEvent=MS.prototype.reportAppEvent;MS.Id="conviva";_.Yo(new class{create(){return new MS}});};f.call(g, window);
3
+ c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},uS=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},vS=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},xS=function(a,b,c,d){const e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=b;e[Conviva.Constants.IS_LIVE]=
4
+ uS(!!d);e[Conviva.Constants.ASSET_NAME]=qS;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=wS(a.getId()),e["c3.ad.creativeId"]=wS(a.getCreativeId()),e["c3.ad.system"]=wS(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=wS(a.getApiFramework()),e["c3.ad.advertiser"]=wS(a.getAdvertiserName()),e["c3.ad.position"]=vS(a.getPodIndex()),e["c3.ad.technology"]=0===a.Cb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=wS(a.vb()),e["c3.ad.adManagerVersion"]=wS(a.wb()),e["c3.ad.advertiserCategory"]=wS(null),e["c3.ad.advertiserId"]=wS(null),e["c3.ad.breakId"]=wS(null),e["c3.ad.campaignName"]=wS(null),e["c3.ad.category"]=wS(null),e["c3.ad.classification"]=wS(null),e["c3.ad.creativeName"]=wS(null),e["c3.ad.sequence"]=wS(a.Ob()),e["c3.ad.sessionStartEvent"]=wS(null),e["c3.ad.unitName"]=wS(null),e["c3.ad.dayPart"]=wS(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
+ a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=wS(b),e["c3.ad.firstAdSystem"]=wS(c),e["c3.ad.firstCreativeId"]=wS(a));return e},wS=function(a){return a?""+a:"NA"},BS=function(a){a.f.on(a.m,_.bc,a.C.bind(a));a.f.on(a.m,_.cc,a.F.bind(a));a.f.on(a.m,_.pc,a.L.bind(a));a.f.on(a.m,_.mc,a.l.bind(a));a.f.on(a.m,_.lc,a.l.bind(a));a.f.on(a.m,_.nc,a.l.bind(a));a.f.on(a.m,_.dc,a.l.bind(a));a.f.on(a.m,_.qc,a.N.bind(a));
7
+ a.f.on(a.m,_.oc,a.K.bind(a));a.f.on(a.m,_.ec,a.G.bind(a));a.f.on(a.m,_.hc,a.I.bind(a));a.f.on(a.m,_.ic,a.J.bind(a));a.f.on(a.m,_.gc,a.H.bind(a));a.f.on(a.m,_.jc,a.T.bind(a));a.f.on(a.m,_.rc,a.R.bind(a));a.f.on(a.m,_.r,b=>{var c=b.detail;if(10003===c.code&&(a.h.debug("onAdError()"),!a.g)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=qS}null===a.a&&yS(a,null);a.a.reportAdError(c,b.FATAL);a.g=!0;a.h.debug("Ad Playback Failure");
8
+ zS(a,AS,c)}})},zS=function(a,b,c=qS){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case AS:a.a.reportAdFailed(c,xS(null,a.B,a.A));break;case CS:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},yS=function(a,b){if(!a.o){a.g=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=xS(b,a.B,a.A,a.m.isLive()),d=String(b.wb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.vb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
+ d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.h.error("Could not create ad analytics session",c)}}},DS=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.h.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,null,c);Conviva.Analytics.setDeviceMetadata(tS(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
+ b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.ra;b[Conviva.Constants.FRAMEWORK_VERSION]=_.fa;a.a.setPlayerInfo(b)},ES=function(a){return a.m.getConfiguration().autoplay||!1},GS=function(a){if(!a.l)if(a.C)a.h.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.K,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.h.debug(a.m.getConfiguration().source);var f={},g=
11
+ new _.Hl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.gj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.A(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.h.debug("reportMiscellaneousMetrics()");if(FS(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
+ h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.h.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.g=!0;a.I=!1;0<a.j.length&&(a.h.debug("Report deferred events"),a.j.forEach(h=>{h.ff(h.args)}));a.j=[]}},HS=function(a){if(!a.l&&a.a){const b=uS(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},FS=function(a){return null!==a.a&&a.C},IS=function(a){a.h.debug("terminateSession()");
13
+ a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.g=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},JS=function(a,b){var c=b.getConfiguration();a.a=!_.A(c.conviva)&&typeof c.conviva===_.Ce;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.U(b,c)):b.namespace()===_.jd&&(a.a=!1,
14
+ a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},KS=function(a){const b=[];typeof a===_.Ce&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var MS=class{constructor(a,b){this.m=a;this.S=b;this.B="";this.A=_.ra;this.h=new _.R("clpp.conviva.ad");this.f=new _.ks;this.a=null;this.g=this.o=this.w=this.j=!1}initialize(a){this.h.debug("Initialize Ad Insights");this.g=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.ra;BS(this)}release(){this.h.debug("Release Ad Insights");this.w?this.h.debug(_.ja):(_.mh(this.f),this.a&&zS(this,LS),this.f.release(),this.w=!0,this.j=this.g=!1)}destroy(){this.h.debug(_.Dd);this.o?this.h.debug(_.ia):this.o=!0}C(){this.h.debug(rS)}F(){this.h.debug(sS)}L(a){this.h.debug("onAdStarted()");
15
+ a=a.ad;this.j||(this.h.warn("Ad load event was not triggered. This will have incidence on VSF"),yS(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.zb(),a.yb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.nb())}l(a){this.h.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.mc:case _.nc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.lc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.dc:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.h.debug("onAdStopped()");this.a&&!this.g&&zS(this,LS)}K(){this.h.debug("onAdSkipped()");this.a&&zS(this,CS)}G(){this.h.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.h.debug("onAdImpression()");if(this.a){const a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}}J(a){this.h.debug("onAdLoaded()");
17
+ const b=a.ad,c=()=>{this.j=!0;yS(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Tf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Tf),c())})}H(){this.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}T(){this.h.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.h.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},CS=0,LS=1,AS=2;var NS=class{constructor(a,b){this.m=a;this.f=new _.ks;this.a=null;this.o=!1;this.G=!0;this.B=this.g=this.A=this.C=this.l=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.h=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.h.debug("Initialize conviva"),this.G=!1,this.F=_.Ng(b),this.K=c,this.m=a,DS(this,this.F),this.f.on(this.m,_.Qe,this.da.bind(this)),this.f.on(this.m,_.Jf,this.Y.bind(this)),this.f.on(this.m,_.Mc,this.L.bind(this)),this.f.on(this.m,_.cg,this.X.bind(this)),this.f.on(this.m,
19
+ _.bg,this.W.bind(this)),this.f.on(this.m,_.bc,this.S.bind(this)),this.f.on(this.m,_.cc,this.T.bind(this)),this.f.on(this.m,_.tc,this.aa.bind(this)),this.f.on(this.m,_.Lc,this.ea.bind(this)),this.f.on(this.m,_.r,this.N.bind(this)),ES(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),GS(this)))}release(){this.h.debug("Release conviva");this.G?this.h.debug(_.ja):(_.mh(this.f),FS(this)||this.o||!ES(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),FS(this)&&
20
+ IS(this),this.a=null,this.G=!0)}destroy(){this.h.debug(_.Dd);this.l?this.h.debug(_.ia):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.h.debug("Report app event error",d),c=!1}return c}da(){this.h.debug("onPlayRequest()");FS(this)||ES(this)?FS(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),FS(this)&&!this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.g=!0),this.A=!1):(this.h.debug("Creating conviva session. On Play Requested / No autoplay"),
21
+ GS(this))}Y(a){this.h.debug(_.He);const b=c=>{if(this.o&&(this.h.debug("Creating conviva session (On Seek / Replay)"),DS(this,this.F),GS(this),HS(this),FS(this))){var d=this.m.getTrackManager();d=d.ma()||d.$a();d.width&&d.height&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}FS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Wn:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.Vn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.On:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Ln:this.h.debug("onVideoEnded()"),FS(this)&&(this.w&&this.w.pb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.J=!0):IS(this))}}L(a){this.h.debug(_.De);if(FS(this)){if(a=a.detail,typeof a.width===_.t&&typeof a.height===_.t&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,
23
+ a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.a.setContentInfo(b)}}else this.j.push({ff:this.L.bind(this),args:a})}X(){this.h.debug("onSeeking()");FS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.h.debug("onSeeked()");FS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}aa(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.h.debug(rS);
24
+ var b=a.ad;a=0===b.ab();const c=vS(b.getPodIndex());FS(this)||ES(this)||!a||GS(this);if(FS(this)){a=0===b.Cb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.Bb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.dk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")}T(){this.h.debug(sS);
25
+ FS(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&IS(this))}N(a){this.h.debug(_.Ee);if(this.o&&this.I)this.h.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.F&&(d=Conviva.Constants.ErrorSeverity.FATAL,FS(this)||GS(this));FS(this)?(this.h.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.h.debug("Video Playback Failure"),
26
+ this.I=!0,IS(this))):this.j.push({ff:this.N.bind(this),args:a})}}ea(){this.h.debug("onAutoPlayBlocked()");FS(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,FS(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))}};var OS=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new NS(a,this.h)}onContentWillLoad(a,b){JS(this,a);if(this.a){var c=a.getConfiguration();c=_.Ng(c.conviva||{});try{KS(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new MS(a,()=>this.f.a),this.g.initialize(c))}catch(d){d instanceof _.H?this.U(a,d):this.U(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&HS(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
+ this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}U(a,b){a.trigger(new _.E(_.r,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",OS);OS.prototype.reportAppEvent=OS.prototype.reportAppEvent;OS.Id="conviva";_.ap(new class{create(){return new OS}});};f.call(g, window);