@castlabs/prestoplay 6.20.0 → 6.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +35 -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 +109 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +553 -550
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +78 -77
  10. package/cjs/cl.externs.js +81 -97
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +22 -24
  16. package/cjs/cl.mse.js +305 -305
  17. package/cjs/cl.muxdata.js +15 -15
  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 +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +25 -25
  25. package/cjs/cl.tizen.js +70 -69
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +9 -0
  32. package/cjs/cl.youbora.js +38 -20
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -89
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +471 -468
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +74 -72
  41. package/cl.externs.js +71 -99
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +74 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +16 -17
  47. package/cl.mse.js +276 -276
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +11 -11
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +59 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -0
  63. package/cl.youbora.js +27 -15
  64. package/package.json +3 -1
  65. package/typings.d.ts +123 -24
package/cl.cast.js CHANGED
@@ -1,90 +1,89 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var DT="Cannot seek during ads playout.",ET="Cannot switch track",FT="Media session does not exist.",GT="No receivers available",HT="Reset ABR functionality not available on cast.",IT="SDK not yet ready",JT="Sender is destroyed.",KT="clpp.cast.CastProxy",LT="clpp.cast.Player",MT="clpp.cast.Receiver",NT="urn:x-cast:castlabs",OT="urn:x-cast:com.google.cast.media",PT=function(a){return _.w(function*(){yield _.Mq(a,_.He);yield _.Mq(a,_.Ge)})},QT=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===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},RT=function(a){if(typeof a!==_.Pf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},ST=function(a,b,c,d){return _.w(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=_.Xj(d,a.mimeType,g);f&&g&&(h=_.ij(a.url),(h=yield c.fetch(h).W)&&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})},TT=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 _.lg:return d.FMP4;case _.kg:return b===_.M?d.MPEG2_TS:c.TS;case _.Hc:return c.AAC;case _.Ic:return c.AC3;case _.Jc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Kc:return c.FMP4}},VT=function(a){a=void 0===a?UT:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.G(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}},WT=function(a,b){return a.h.filter(c=>c.type===b)},YT=function(a,b){const c=XT(a);return WT(a,b).find(d=>c.includes(d.id))||null},$T=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.ta();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;ZT(a,b)},e=>{a.f[b]=null;a.g.debug(ET,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{ZT(a,b)},e=>{a.g.debug(ET,e)}))},XT=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},ZT=function(a,b){b===_.L?a.a.trigger(new _.C(_.bl)):b===_.K&&a.a.trigger(new _.C(_.dl))},cU=function(a){if(a)for(const b of aU)bU(b)},bU=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.S.length){a.w=!0;a.o.Je();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z);dU&&a.o.fa(.02)}},eU=function(a){return _.w(function*(){aU.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z)}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.R=null;a.X=null})},fU=function(a){return _.w(function*(){a.Gb()||(yield cast.framework.CastContext.getInstance().requestSession())})},hU=function(a,b,c){c=
9
- void 0===c?0:c;return _.w(function*(){var d=a.f.ta();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.la())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield gU(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),ue:a.getPresentationStartTime(),autoplay:b,$a:a.h})})},gU=function(a,b){return _.w(function*(){var c=chrome.cast.media.StreamType;yield fU(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=TT(b.Tb,_.M);e.hlsSegmentFormat=TT(c,_.L);b.$a&&(a.L&&(c=yield Promise.resolve(a.L(b.$a)))&&(b.$a=c),a.h=b.$a,a.C=_.vo(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.$a.remoteTextTracks&&(c=yield Promise.all(b.$a.remoteTextTracks.map(a.ia.bind(a))),e.tracks=c.filter(k=>k),b.$a.remoteTextTracks=void 0),delete b.$a.autoplay,b.$a.startTime=null,e.customData={playerConfiguration:QT(b.$a)});c=a.yb()||{};
11
- var f=iU(c.metadataType),g;typeof b.ue===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.ue});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=jU(c);if(g=kU(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===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},kU=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(lU);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=VT(lU[b]);return Object.assign(b,a)},iU=function(a){var b=void 0===b?UT:b;return Object.values(lU).includes(a)?a:b},jU=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},nU=function(a,b){mU(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(NT,a.O)},oU=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
13
- null;a=null===a?null:a+b;return null===a?b:a},mU=function(a,b){a.a=b;a.a&&(a.G.release(),a.F=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.l),a.G.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.da.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Ra.bind(a)),a.j&&a.j.init(),a.trigger(new _.C(_.qe)))},rU=function(a){return new pU(a.h,()=>{a.trigger(new _.C(_.Zc))},(b,c)=>{{const d=a.f.getConfiguration();
14
- d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Ue&&(d.preferredAudioLanguage=c.Ue);c.Pf&&(d.preferredTextLanguage=c.Pf);_.Oq(a.f,null);a.trigger(new _.C("castingended"));a.j(b,d)}},()=>qU(a))},qU=function(a){return _.w(function*(){a.trigger(new _.C(_.Yc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Oq(a.f,a.a))})},uU=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{sU=!1;const e=
15
- _.ij(d),f=yield c.fetch(e).W;if(f&&f.data){const g=_.Ei(f.data),h=(new DOMParser).parseFromString(g,_.Vf);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=tU(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=tU(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),sU=!0}}catch(e){_.B("Failed to fetch an ad",
16
- e),sU=!0}})},tU=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},vU=function(a,b){b=new _.G(1,10,10003,{errorType:b});a.m.onError(b)},wU=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},yU=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=xU(a,c))&&(d={ad:c});a.m.trigger(new _.C(b,d))}},xU=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=
17
- null,e=null,f;typeof b.breakClipId===_.Pf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Pf&&(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},zU=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,
18
- cast.framework.events.EventType.TIMED_METADATA_EXIT]},AU=function(a){const b=a.dashTimedMetadata;let c=_.dg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.cg)?_.Bh:_.ag,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},BU=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},DU=function(a){a.a=BU().getTextTracksManager();const b=a.a.getTracks();a.j=CU(_.K,b)},CU=function(a,b){const c=[];for(const d of b)b=
19
- new _.Cj(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||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 _.Kj(b.id,b)),c.push(b);return c},EU=function(a,b,c,d){c=_.Qh(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ha());if(c=c.find(g=>{const h=
20
- _.qi(g);return f.some(k=>{k=_.qi(k.language||"");return _.ri(h,k)})})){const g=_.qi(c);c=f.filter(h=>{h=_.qi(h.language||"");return _.ri(g,h)});f=c.length?c:f;e=e||!!c.length}_.Ni(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.g.info("Will select track",e),b===_.L?a.va(e):b===_.K&&a.Oa(e))},FU=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},IU=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;
21
- b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.Jl(d);if(e){var f=[_.vd];_.vo(a)[0].type!==_.Fc&&f.unshift(_.xd);d.preferredDrmSystem===_.vd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.bb[g];h?(c=g===_.xd?cast.framework.ContentProtection.WIDEVINE:g===_.vd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},GU(b,h,a,c),HU(b,h,a,c)):c()}else c()}else c()},GU=
22
- function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.ij({method:_.tb,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},HU=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.mj(Object.assign({},f.headers),
23
- e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):a.licenseHandler=void 0},LU=function(){return JU||(JU=new KU)},MU=function(){return cast.framework.CastReceiverContext.getInstance()},NU=function(){const a=MU().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},OU=function(a,b){const c=MU().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,MU().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},
24
- QU=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=MU();var {hlsVideoSegmentFormat:d}=MU().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.lg:_.kg;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=PU(f,_.na),h=PU(f,_.Cb);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);
25
- ++e}return d.join("\n")},PU=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},SU=function(a,b){let c=null;const d=RU(a);d&&(c={ad:d});a.f.trigger(new _.C(b,c))},RU=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;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=
26
- 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},TU=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.h=_.po;this.o=_.Yt;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.po)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===
27
- _.E&&this.a(_.oo)}a(a){if(a!==this.h)if(this.h===_.oo&&a!==_.po)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;this.h===_.ko?(this.B=b,this.player.trigger(new _.C(_.Sc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.ko&&this.player.trigger(new _.C(_.Rc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Yn(this.l,this.h);this.player.trigger(new _.C(_.Mf,
28
- {detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var UT=0,lU={GENERIC:UT,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var UU=class extends TU{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Pb.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 _.w(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)}Pb(){if(this.f&&
29
- 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(_.ho);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.oo);break;default:this.a(_.po)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.so);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.ro);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.ko)}}};var VU=class extends _.S{constructor(){super();this.g=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.M;break;case chrome.cast.media.TrackType.AUDIO:c=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.Cj(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
30
- 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 _.Kj(c.id,c));return c}):[],this.a.trigger(new _.C(_.Bt)))}destroy(){this.a=null}getVideoTracks(){return WT(this,_.M)}getAudioTracks(){return WT(this,_.L)}ha(){return WT(this,_.K)}ma(){const a=this.Ma();return a?a.renditions[0]:null}Ua(){const a=this.la();return a?a.renditions[0]:null}La(){const a=this.ta();return a?a.renditions[0]:
31
- null}jb(){return this.f[_.M]||null}zb(){return this.f[_.L]||null}Ab(){return this.f[_.K]||null}Ma(){return YT(this,_.M)}la(){return YT(this,_.L)}ta(){return YT(this,_.K)}ub(a){$T(this,_.M,a)}va(a){$T(this,_.L,a)}Oa(a){$T(this,_.K,a)}ab(a){this.ub(a&&a.track)}sb(a){this.va(a&&a.track)}tb(a){this.Oa(a&&a.track)}addTextTrack(){return _.w(function*(){})}pa(){return!0}};VU.prototype.isAbrEnabled=VU.prototype.pa;VU.prototype.addTextTrack=VU.prototype.addTextTrack;VU.prototype.setTextRendition=VU.prototype.tb;
32
- VU.prototype.setAudioRendition=VU.prototype.sb;VU.prototype.setVideoRendition=VU.prototype.ab;VU.prototype.setTextTrack=VU.prototype.Oa;VU.prototype.setAudioTrack=VU.prototype.va;VU.prototype.setVideoTrack=VU.prototype.ub;VU.prototype.getTextTrack=VU.prototype.ta;VU.prototype.getAudioTrack=VU.prototype.la;VU.prototype.getVideoTrack=VU.prototype.Ma;VU.prototype.getLoadingTextRendition=VU.prototype.Ab;VU.prototype.getLoadingAudioRendition=VU.prototype.zb;VU.prototype.getLoadingVideoRendition=VU.prototype.jb;
33
- VU.prototype.getTextRendition=VU.prototype.La;VU.prototype.getAudioRendition=VU.prototype.Ua;VU.prototype.getVideoRendition=VU.prototype.ma;VU.prototype.getTextTracks=VU.prototype.ha;VU.prototype.getAudioTracks=VU.prototype.getAudioTracks;VU.prototype.getVideoTracks=VU.prototype.getVideoTracks;var pU=class extends _.Dt{constructor(a,b,c,d){super();this.g=new _.R(_.jd);this.S=a;this.o=new _.mk(b);this.R=c;this.X=d;this.h=this.I=_.nl();this.C=[];this.B=0;this.K=new _.yq;this.F=this.l=this.a=null;this.A=this.w=!1;this.Y="";this.ba=1E6;this.f=new VU;this.f.initialize(this);this.j=new UU(this);this.G=new _.Rs;this.J=null;this.H=new Set;this.M=this.Pa.bind(this);this.Z=this.Ha.bind(this);this.V=this.Sa.bind(this);this.O=this.Qa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
34
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{cU(!0)},0)}});bU(this);aU.add(this)}init(a,b){this.h=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(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setSeekInterceptor(){}destroy(){return _.w(function*(){})}hd(a){this.L=
35
- a}mc(){return this.w}Gb(){return this.A}$d(){return this.Y}sendMessage(a,b){const c=this;return _.w(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,QT(b))}catch(f){d=new _.G(1,8,8E3,{detailedErrorCode:f})}else d=new _.G(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.w(function*(){if(!a.mc())throw a.g.warn(IT),new _.G(1,8,8001,void 0);if(!dU)throw a.g.warn(GT),new _.G(1,8,8002,void 0);if(a.Gb())throw a.g.warn("Already casting"),
36
- new _.G(1,8,8003,void 0);try{yield fU(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 _.G(1,8,8E3,c);}})}Zd(){this.Gb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Yd&&this.H.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.H.delete(a)}play(){return this.isEnded()?hU(this,!0):new Promise((a,b)=>{if(!this.a)return b(FT);this.a.play(null,
37
- a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(FT);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.ho}seek(a){return this.isEnded()?hU(this,!1,a):new Promise((b,c)=>{this.a||c(FT);this.l.isPlayingBreak&&c(DT);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.C(_.fg));this.a.seek(d,()=>{this.trigger(new _.C(_.eg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
38
- 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!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(OT,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
39
- 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!==_.r?null:1E-8===a?0:a}getSeekRange(){let a=
40
- {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.Yt}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?RT(this.a.customData.stats):_.bo()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.mc())if(dU){b.C=_.vo(a);b.h=_.pl(b.I,a);var c=b.C[b.B];yield gU(b,{source:c,
41
- isLive:c.isLive,autoplay:b.h.autoplay,$a:b.h,Tb:c.Tb,audioMimeType:c.audioMimeType})}else b.g.warn(GT);else b.g.warn(IT)})}getBufferInfo(){return new _.Ct}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(HT)}onError(a){if(a&&
42
- (this.trigger(new _.C(_.Ud,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.jd}canPlay(){return this.mc()?2:0}yb(){return this.J}Sb(a){this.J=kU(a)}Ud(){this.J=null}Ee(a){const b=this.yb()||{};a={metadataType:iU(b.metadataType),title:a};this.Sb(Object.assign({},b,a))}Ce(a){const b=this.yb()||{},c=iU(b.metadataType);a=new chrome.cast.Image(a);this.Sb(Object.assign({},b,{metadataType:c,images:[a]}))}Be(a){const b=this.yb()||{};this.Sb(Object.assign({},b,{metadataType:3,artist:a}))}De(a){const b=
43
- this.yb()||{};a={metadataType:iU(b.metadataType),releaseDate:a};this.Sb(Object.assign({},b,a))}Pa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;dU=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Y=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Je()}Ha(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;nU(this,a.session);break;
44
- case cast.framework.SessionState.SESSION_RESUMED:this.Gb()||(this.A=!0,nU(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Gb()&&this.a){const d=this.a.media;var b=this.f.la(),c=this.f.ta();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:oU(this),Pf:c,Ue:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(NT,
45
- this.O);this.A=!1;this.a=null;this.G.release();this.l=this.F=null}}Sa(a){this.g.debug("New media session",a.mediaSession);mU(this,a.mediaSession)}Ra(a){a.value&&a.value.tracks&&this.f&&this.f.load()}Qa(a,b){if(a===NT&&0<this.H.size){const c=RT(b);this.H.forEach(d=>d(c))}}da(){this.trigger(new _.C(_.Wf))}ia(a){const b=this;return _.w(function*(){let c=null;const d=yield ST(a,[_.Uf,_.Ec],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ba++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=
46
- d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};pU.prototype.getTextDisplayer=pU.prototype.getTextDisplayer;pU.prototype.getNetworkEngine=pU.prototype.getNetworkEngine;pU.prototype.setNetworkEngine=pU.prototype.setNetworkEngine;var dU=!1,aU=new Set;window.__onGCastApiAvailable=cU;var WU=class extends _.Dt{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Yd?c:this.l;this.a=rU(this);this.g=new _.R(KT);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield eU(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&a!==_.ho&&a!==_.po&&(delete b.license,this.f.load(b))}Rd(){return!!this.a&&this.a.mc()&&dU}Gb(){return!!this.a&&this.a.Gb()}$d(){return this.a?this.a.$d():""}hd(a){this.a&&this.a.hd(a)}cast(a){const b=
47
- this;return _.w(function*(){if(b.a)try{if(yield b.a.cast(),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.ta();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=
48
- e&&typeof e.isLive===_.Pc?e.isLive:b.f.isLive();d={source:e,isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),ue:b.f.getPresentationStartTime(),Tb:h,audioMimeType:k,$a:l}}var c=d}yield qU(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield gU(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.C(_.Ud,{detail:d}),b.trigger(c)}})}Zd(){this.a&&this.a.Zd()}qg(a){const b=this;return _.w(function*(){a!==b.h&&(b.h=a,b.a&&(yield eU(b.a)),
49
- b.a=rU(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?yield b.a.sendMessage(NT,a):b.g.warn(JT)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(JT)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(JT)}yb(){return this.a&&this.a.yb()}Sb(a){this.a&&this.a.Sb(a)}Ud(){this.a&&this.a.Ud()}Ee(a){this.a&&this.a.Ee(a)}Ce(a){this.a&&this.a.Ce(a)}Be(a){this.a&&this.a.Be(a)}De(a){this.a&&this.a.De(a)}};_.x(KT,WU);
50
- WU.prototype.setContentReleaseDate=WU.prototype.De;WU.prototype.setContentArtist=WU.prototype.Be;WU.prototype.setContentImage=WU.prototype.Ce;WU.prototype.setContentTitle=WU.prototype.Ee;WU.prototype.clearContentMetadata=WU.prototype.Ud;WU.prototype.setContentMetadata=WU.prototype.Sb;WU.prototype.getContentMetadata=WU.prototype.yb;WU.prototype.removeMessageListener=WU.prototype.removeMessageListener;WU.prototype.addMessageListener=WU.prototype.addMessageListener;WU.prototype.sendMessage=WU.prototype.sendMessage;
51
- WU.prototype.changeReceiverId=WU.prototype.qg;WU.prototype.forceDisconnect=WU.prototype.Zd;WU.prototype.cast=WU.prototype.cast;WU.prototype.setPlayerConfigInterceptor=WU.prototype.hd;WU.prototype.getReceiverName=WU.prototype.$d;WU.prototype.isCasting=WU.prototype.Gb;WU.prototype.canCast=WU.prototype.Rd;WU.prototype.destroy=WU.prototype.destroy;var XU=class extends TU{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.R.bind(this);this.H=this.O.bind(this);this.A=this.Y.bind(this);this.w=this.X.bind(this);this.K=this.V.bind(this);this.J=this.S.bind(this);this.L=this.ba.bind(this);this.G=this.Z.bind(this);this.F=this.T.bind(this);this.f=this.M.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,
52
- 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 _.w(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
53
- 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)})}R(){this.player.trigger(new _.C(_.Re));this.a(_.so)}O(){this.a(_.ro)}Y(){this.a(_.ho)}X(a){a.isBuffering?
54
- this.a(_.ko):(a=this.player.isPaused()?_.ro:_.so,this.a(a))}V(){this.j=1;this.player.trigger(new _.C(_.fg))}S(){this.player.trigger(new _.C(_.eg))}ba(){this.j=2}Z(){this.a(_.qo)}M(a){const b=this.player.getStats();this.player.trigger(new _.C(_.Oc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.G(_.E,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.C(_.Ud,{detail:a}));this.a(_.oo)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.r?c:1;this.h=typeof d===_.r?d:1;this.j=typeof e===_.r?e:0}hb(){return"Google Cast Framework"}ib(){return cast.framework.VERSION}ob(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Nb(){return!1}xb(){return this.a.clickThroughUrl||
55
- null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}lb(){return 0}kb(){return 0}Za(){return 0}Va(){switch(this.Bb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Bb(){return this.f.position}Cb(){return this.l}nb(){return this.h}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
56
- Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.nb;Z.prototype.getPositionInSequence=Z.prototype.Cb;Z.prototype.getPodTimeOffset=Z.prototype.Bb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Va;Z.prototype.getMediaBitrate=Z.prototype.Za;Z.prototype.getMediaHeight=Z.prototype.kb;Z.prototype.getMediaWidth=Z.prototype.lb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.xb;
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var lU="Cannot seek during ads playout.",mU="Cannot switch track",nU="Media session does not exist.",oU="No receivers available",pU="Reset ABR functionality not available on cast.",qU="SDK not yet ready",rU="Sender is destroyed.",sU="clpp.cast.CastProxy",tU="clpp.cast.Player",uU="clpp.cast.Receiver",vU="urn:x-cast:castlabs",wU="urn:x-cast:com.google.cast.media",xU=function(a){return _.x(function*(){yield _.Vq(a,_.Ge);yield _.Vq(a,_.Fe)})},yU=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}})},zU=function(a){if(typeof a!==_.Of)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},AU=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=_.ak(d,a.mimeType,g);f&&g&&(h=_.jj(a.url),(h=yield c.fetch(h).W)&&h.data&&(e=f.a(_.K(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},BU=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 _.kg:return d.FMP4;case _.jg:return b===_.N?d.MPEG2_TS:c.TS;case _.Hc:return c.AAC;case _.Ic:return c.AC3;case _.Jc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Kc:return c.FMP4}},DU=function(a){a=void 0===a?CU:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.I(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}},EU=function(a,b){return a.h.filter(c=>c.type===b)},GU=function(a,b){const c=FU(a);return EU(a,b).find(d=>c.includes(d.id))||null},IU=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.L){const e=a.ta();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;HU(a,b)},e=>{a.f[b]=null;a.g.debug(mU,e)})}else b===_.L&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{HU(a,b)},e=>{a.g.debug(mU,e)}))},FU=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},HU=function(a,b){b===_.M?a.a.trigger(new _.E(_.fl)):b===_.L&&a.a.trigger(new _.E(_.gl))},LU=function(a){if(a)for(const b of JU)KU(b)},KU=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.S.length){a.w=!0;a.o.Ke();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z);MU&&a.o.fa(.02)}},NU=function(a){return _.x(function*(){JU.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z)}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.R=null;a.X=null})},OU=function(a){return _.x(function*(){a.Gb()||(yield cast.framework.CastContext.getInstance().requestSession())})},QU=function(a,b,c){c=
9
+ void 0===c?0:c;return _.x(function*(){var d=a.f.ta();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.ma())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield PU(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),ue:a.getPresentationStartTime(),autoplay:b,eb:a.h})})},PU=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield OU(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=BU(b.Tb,_.N);e.hlsSegmentFormat=BU(c,_.M);b.eb&&(a.L&&(c=yield Promise.resolve(a.L(b.eb)))&&(b.eb=c),a.h=b.eb,a.C=_.Co(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.eb.remoteTextTracks&&(c=yield Promise.all(b.eb.remoteTextTracks.map(a.ga.bind(a))),e.tracks=c.filter(k=>k),b.eb.remoteTextTracks=void 0),delete b.eb.autoplay,b.eb.startTime=null,e.customData={playerConfiguration:yU(b.eb)});c=a.yb()||{};
11
+ var f=RU(c.metadataType),g;typeof b.ue===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.ue});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=SU(c);if(g=TU(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)}})},TU=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(UU);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=DU(UU[b]);return Object.assign(b,a)},RU=function(a){var b=void 0===b?CU:b;return Object.values(UU).includes(a)?a:b},SU=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},WU=function(a,b){VU(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(vU,a.O)},XU=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},VU=function(a,b){a.a=b;a.a&&(a.G.release(),a.F=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.l),a.G.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ca.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Ua.bind(a)),a.j&&a.j.init(),a.trigger(new _.E(_.le)))},$U=function(a){return new YU(a.h,()=>{a.trigger(new _.E(_.Zc))},(b,c)=>{{const d=a.f.getConfiguration();
14
+ d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Xe&&(d.preferredAudioLanguage=c.Xe);c.Tf&&(d.preferredTextLanguage=c.Tf);_.Xq(a.f,null);a.trigger(new _.E("castingended"));a.j(b,d)}},()=>ZU(a))},ZU=function(a){return _.x(function*(){a.trigger(new _.E(_.Vc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Xq(a.f,a.a))})},cV=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{aV=!1;const e=
15
+ _.jj(d),f=yield c.fetch(e).W;if(f&&f.data){const g=_.Fi(f.data),h=(new DOMParser).parseFromString(g,_.Uf);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=bV(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=bV(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),aV=!0}}catch(e){_.C("Failed to fetch an ad",
16
+ e),aV=!0}})},bV=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},dV=function(a,b){b=new _.I(1,10,10003,{errorType:b});a.m.onError(b)},eV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},gV=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=fV(a,c))&&(d={ad:c});a.m.trigger(new _.E(b,d))}},fV=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=
17
+ null,e=null,f;typeof b.breakClipId===_.Of&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Of&&(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},hV=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,
18
+ cast.framework.events.EventType.TIMED_METADATA_EXIT]},iV=function(a){const b=a.dashTimedMetadata;let c=_.cg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.bg)?_.Ch:_.$f,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},jV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},lV=function(a){a.a=jV().getTextTracksManager();const b=a.a.getTracks();a.j=kV(_.L,b)},kV=function(a,b){const c=[];for(const d of b)b=
19
+ new _.Fj(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||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 _.Nj(b.id,b)),c.push(b);return c},mV=function(a,b,c,d){c=_.Rh(c).filter(g=>g);var e=!1;let f=[];b===_.M?f=a.getAudioTracks():b===_.L&&(f=a.ia());if(c=c.find(g=>{const h=
20
+ _.ri(g);return f.some(k=>{k=_.ri(k.language||"");return _.si(h,k)})})){const g=_.ri(c);c=f.filter(h=>{h=_.ri(h.language||"");return _.si(g,h)});f=c.length?c:f;e=e||!!c.length}_.Oi(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.g.info("Will select track",e),b===_.M?a.wa(e):b===_.L&&a.Ra(e))},nV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},qV=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;
21
+ b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.Ml(d);if(e){var f=[_.vd];_.Co(a)[0].type!==_.Fc&&f.unshift(_.xd);d.preferredDrmSystem===_.vd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ia[g];h?(c=g===_.xd?cast.framework.ContentProtection.WIDEVINE:g===_.vd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},oV(b,h,a,c),pV(b,h,a,c)):c()}else c()}else c()},oV=
22
+ function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.jj({method:_.tb,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},pV=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.nj(Object.assign({},f.headers),
23
+ e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},tV=function(){return rV||(rV=new sV)},uV=function(){return cast.framework.CastReceiverContext.getInstance()},vV=function(){const a=uV().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},wV=function(a,b){const c=uV().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,uV().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},
24
+ yV=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=uV();var {hlsVideoSegmentFormat:d}=uV().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.kg:_.jg;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=xV(f,_.na),h=xV(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);
25
+ ++e}return d.join("\n")},xV=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},AV=function(a,b){let c=null;const d=zV(a);d&&(c={ad:d});a.f.trigger(new _.E(b,c))},zV=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;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=
26
+ 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},BV=class{constructor(a,b){this.log=new _.S(b);this.player=a;this.l=null;this.h=_.wo;this.o=_.iu;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.wo)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===
27
+ _.F&&this.a(_.vo)}a(a){if(a!==this.h)if(this.h===_.vo&&a!==_.wo)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;this.h===_.ro?(this.B=b,this.player.trigger(new _.E(_.Rc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.ro&&this.player.trigger(new _.E(_.Qc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.fo(this.l,this.h);this.player.trigger(new _.E(_.Lf,
28
+ {detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var CU=0,UU={GENERIC:CU,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var CV=class extends BV{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Pb.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)}Pb(){if(this.f&&
29
+ 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(_.oo);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.vo);break;default:this.a(_.wo)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.zo);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.yo);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.ro)}}};var DV=class extends _.T{constructor(){super();this.g=new _.S("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(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=_.M;break;case chrome.cast.media.TrackType.TEXT:c=_.L}c=new _.Fj(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
30
+ 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 _.Nj(c.id,c));return c}):[],this.a.trigger(new _.E(_.Mt)))}destroy(){this.a=null}getVideoTracks(){return EU(this,_.N)}getAudioTracks(){return EU(this,_.M)}ia(){return EU(this,_.L)}ja(){const a=this.Da();return a?a.renditions[0]:null}Xa(){const a=this.ma();return a?a.renditions[0]:null}Pa(){const a=this.ta();return a?a.renditions[0]:
31
+ null}ob(){return this.f[_.N]||null}zb(){return this.f[_.M]||null}Ab(){return this.f[_.L]||null}Da(){return GU(this,_.N)}ma(){return GU(this,_.M)}ta(){return GU(this,_.L)}vb(a){IU(this,_.N,a)}wa(a){IU(this,_.M,a)}Ra(a){IU(this,_.L,a)}fb(a){this.vb(a&&a.track)}tb(a){this.wa(a&&a.track)}ub(a){this.Ra(a&&a.track)}addTextTrack(){return _.x(function*(){})}pa(){return!0}};DV.prototype.isAbrEnabled=DV.prototype.pa;DV.prototype.addTextTrack=DV.prototype.addTextTrack;DV.prototype.setTextRendition=DV.prototype.ub;
32
+ DV.prototype.setAudioRendition=DV.prototype.tb;DV.prototype.setVideoRendition=DV.prototype.fb;DV.prototype.setTextTrack=DV.prototype.Ra;DV.prototype.setAudioTrack=DV.prototype.wa;DV.prototype.setVideoTrack=DV.prototype.vb;DV.prototype.getTextTrack=DV.prototype.ta;DV.prototype.getAudioTrack=DV.prototype.ma;DV.prototype.getVideoTrack=DV.prototype.Da;DV.prototype.getLoadingTextRendition=DV.prototype.Ab;DV.prototype.getLoadingAudioRendition=DV.prototype.zb;DV.prototype.getLoadingVideoRendition=DV.prototype.ob;
33
+ DV.prototype.getTextRendition=DV.prototype.Pa;DV.prototype.getAudioRendition=DV.prototype.Xa;DV.prototype.getVideoRendition=DV.prototype.ja;DV.prototype.getTextTracks=DV.prototype.ia;DV.prototype.getAudioTracks=DV.prototype.getAudioTracks;DV.prototype.getVideoTracks=DV.prototype.getVideoTracks;var YU=class extends _.Ot{constructor(a,b,c,d){super();this.g=new _.S(_.jd);this.S=a;this.o=new _.pk(b);this.R=c;this.X=d;this.h=this.I=_.ql();this.C=[];this.B=0;this.K=new _.Hq;this.F=this.l=this.a=null;this.A=this.w=!1;this.Y="";this.ba=1E6;this.f=new DV;this.f.initialize(this);this.j=new CV(this);this.G=new _.bt;this.J=null;this.H=new Set;this.M=this.Sa.bind(this);this.Z=this.Ja.bind(this);this.V=this.Va.bind(this);this.O=this.Ta.bind(this);this.L=null;window.cast||Object.defineProperty(window,
34
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{LU(!0)},0)}});KU(this);JU.add(this)}init(a,b){this.h=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(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setSeekInterceptor(){}setPlaybackSessionId(){}destroy(){return _.x(function*(){})}fd(a){this.L=
35
+ a}mc(){return this.w}Gb(){return this.A}$d(){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,yU(b))}catch(f){d=new _.I(1,8,8E3,{detailedErrorCode:f})}else d=new _.I(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.x(function*(){if(!a.mc())throw a.g.warn(qU),new _.I(1,8,8001,void 0);if(!MU)throw a.g.warn(oU),new _.I(1,8,8002,void 0);if(a.Gb())throw a.g.warn("Already casting"),
36
+ new _.I(1,8,8003,void 0);try{yield OU(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 _.I(1,8,8E3,c);}})}Zd(){this.Gb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Xd&&this.H.add(a)}removeMessageListener(a){typeof a===_.Xd&&this.H.delete(a)}play(){return this.isEnded()?QU(this,!0):new Promise((a,b)=>{if(!this.a)return b(nU);this.a.play(null,
37
+ a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(nU);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.oo}seek(a){return this.isEnded()?QU(this,!1,a):new Promise((b,c)=>{this.a||c(nU);this.l.isPlayingBreak&&c(lU);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.E(_.eg));this.a.seek(d,()=>{this.trigger(new _.E(_.dg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
38
+ 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(wU,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
39
+ 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=
40
+ {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():_.iu}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?zU(this.a.customData.stats):_.jo()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.mc())if(MU){b.C=_.Co(a);b.h=_.sl(b.I,a);var c=b.C[b.B];yield PU(b,{source:c,
41
+ isLive:c.isLive,autoplay:b.h.autoplay,eb:b.h,Tb:c.Tb,audioMimeType:c.audioMimeType})}else b.g.warn(oU);else b.g.warn(qU)})}getBufferInfo(){return new _.Nt}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(pU)}onError(a){if(a&&
42
+ (this.trigger(new _.E(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.jd}canPlay(){return this.mc()?2:0}yb(){return this.J}Sb(a){this.J=TU(a)}Ud(){this.J=null}Ee(a){const b=this.yb()||{};a={metadataType:RU(b.metadataType),title:a};this.Sb(Object.assign({},b,a))}Ce(a){const b=this.yb()||{},c=RU(b.metadataType);a=new chrome.cast.Image(a);this.Sb(Object.assign({},b,{metadataType:c,images:[a]}))}Be(a){const b=this.yb()||{};this.Sb(Object.assign({},b,{metadataType:3,artist:a}))}De(a){const b=
43
+ this.yb()||{};a={metadataType:RU(b.metadataType),releaseDate:a};this.Sb(Object.assign({},b,a))}Sa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;MU=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Y=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Ke()}Ja(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;WU(this,a.session);break;
44
+ case cast.framework.SessionState.SESSION_RESUMED:this.Gb()||(this.A=!0,WU(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Gb()&&this.a){const d=this.a.media;var b=this.f.ma(),c=this.f.ta();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:XU(this),Tf:c,Xe:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(vU,
45
+ this.O);this.A=!1;this.a=null;this.G.release();this.l=this.F=null}}Va(a){this.g.debug("New media session",a.mediaSession);VU(this,a.mediaSession)}Ua(a){a.value&&a.value.tracks&&this.f&&this.f.load()}Ta(a,b){if(a===vU&&0<this.H.size){const c=zU(b);this.H.forEach(d=>d(c))}}ca(){this.trigger(new _.E(_.Vf))}ga(a){const b=this;return _.x(function*(){let c=null;const d=yield AU(a,[_.Tf,_.Ec],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ba++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=
46
+ d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}},MU=!1,JU=new Set;window.__onGCastApiAvailable=LU;var EV=class extends _.Ot{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Xd?c:this.l;this.a=$U(this);this.g=new _.S(sU);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield NU(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&a!==_.oo&&a!==_.wo&&(delete b.license,this.f.load(b))}Rd(){return!!this.a&&this.a.mc()&&MU}Gb(){return!!this.a&&this.a.Gb()}$d(){return this.a?this.a.$d():""}fd(a){this.a&&this.a.fd(a)}cast(a){const b=
47
+ this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),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.ma();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.ta();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=
48
+ e&&typeof e.isLive===_.Pc?e.isLive:b.f.isLive();d={source:e,isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),ue:b.f.getPresentationStartTime(),Tb:h,audioMimeType:k,eb:l}}var c=d}yield ZU(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield PU(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.E(_.r,{detail:d}),b.trigger(c)}})}Zd(){this.a&&this.a.Zd()}tg(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield NU(b.a)),
49
+ b.a=$U(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?yield b.a.sendMessage(vU,a):b.g.warn(rU)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(rU)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(rU)}yb(){return this.a&&this.a.yb()}Sb(a){this.a&&this.a.Sb(a)}Ud(){this.a&&this.a.Ud()}Ee(a){this.a&&this.a.Ee(a)}Ce(a){this.a&&this.a.Ce(a)}Be(a){this.a&&this.a.Be(a)}De(a){this.a&&this.a.De(a)}};_.z(sU,EV);
50
+ EV.prototype.setContentReleaseDate=EV.prototype.De;EV.prototype.setContentArtist=EV.prototype.Be;EV.prototype.setContentImage=EV.prototype.Ce;EV.prototype.setContentTitle=EV.prototype.Ee;EV.prototype.clearContentMetadata=EV.prototype.Ud;EV.prototype.setContentMetadata=EV.prototype.Sb;EV.prototype.getContentMetadata=EV.prototype.yb;EV.prototype.removeMessageListener=EV.prototype.removeMessageListener;EV.prototype.addMessageListener=EV.prototype.addMessageListener;EV.prototype.sendMessage=EV.prototype.sendMessage;
51
+ EV.prototype.changeReceiverId=EV.prototype.tg;EV.prototype.forceDisconnect=EV.prototype.Zd;EV.prototype.cast=EV.prototype.cast;EV.prototype.setPlayerConfigInterceptor=EV.prototype.fd;EV.prototype.getReceiverName=EV.prototype.$d;EV.prototype.isCasting=EV.prototype.Gb;EV.prototype.canCast=EV.prototype.Rd;EV.prototype.destroy=EV.prototype.destroy;var FV=class extends BV{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.R.bind(this);this.H=this.O.bind(this);this.A=this.Y.bind(this);this.w=this.X.bind(this);this.K=this.V.bind(this);this.J=this.S.bind(this);this.L=this.ba.bind(this);this.G=this.Z.bind(this);this.F=this.T.bind(this);this.f=this.M.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,
52
+ 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();
53
+ 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)})}R(){this.player.trigger(new _.E(_.Qe));this.a(_.zo)}O(){this.a(_.yo)}Y(){this.a(_.oo)}X(a){a.isBuffering?
54
+ this.a(_.ro):(a=this.player.isPaused()?_.yo:_.zo,this.a(a))}V(){this.j=1;this.player.trigger(new _.E(_.eg))}S(){this.player.trigger(new _.E(_.dg))}ba(){this.j=2}Z(){this.a(_.xo)}M(a){const b=this.player.getStats();this.player.trigger(new _.E(_.Oc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.I(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.E(_.r,{detail:a}));this.a(_.vo)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.t?c:1;this.h=typeof d===_.t?d:1;this.j=typeof e===_.t?e:0}kb(){return"Google Cast Framework"}lb(){return cast.framework.VERSION}pb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Nb(){return!1}nb(){return this.a.clickThroughUrl||
55
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}bb(){return 0}ab(){return 0}Na(){return 0}Oa(){switch(this.Bb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Bb(){return this.f.position}Cb(){return this.l}cb(){return this.h}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
56
+ Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.cb;Z.prototype.getPositionInSequence=Z.prototype.Cb;Z.prototype.getPodTimeOffset=Z.prototype.Bb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Oa;Z.prototype.getMediaBitrate=Z.prototype.Na;Z.prototype.getMediaHeight=Z.prototype.ab;Z.prototype.getMediaWidth=Z.prototype.bb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.nb;
57
57
  Z.prototype.isBumper=Z.prototype.Nb;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getPosition=Z.prototype.getPosition;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;
58
- Z.prototype.getTechnology=Z.prototype.ob;Z.prototype.getAdManagerVersion=Z.prototype.ib;Z.prototype.getAdManagerName=Z.prototype.hb;var YU=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Eb(){return!!this.a.find(a=>0===a.position)}Db(){return!!this.a.find(a=>-1===a.position)}};YU.prototype.hasPostroll=YU.prototype.Db;YU.prototype.hasPreroll=YU.prototype.Eb;YU.prototype.getCuePoints=YU.prototype.getCuePoints;var ZU=class{constructor(a){this.m=a;this.a=null;this.j=this.l.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];wU().addEventListener(this.f,
59
- this.j)}load(){const a=this;return _.w(function*(){sU&&(sU=!1,vU(a,0))})}start(){return _.w(function*(){wU().play()})}w(){}resume(){-1!==this.getPosition()&&wU().play()}pause(){-1!==this.getPosition()&&wU().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===_.r?a:-1}o(){return!0}h(){const a=this;return _.w(function*(){wU().removeEventListener(a.f,a.j)})}l(a){const b=cast.framework.events.EndedReason;
60
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=wU().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.C(_.vc,{adsTimeline:new YU(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:yU(this,_.lc,a);break;case cast.framework.events.EventType.BREAK_STARTED:yU(this,_.bc,a);break;case cast.framework.events.EventType.BREAK_ENDED:yU(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:yU(this,_.rc,a);
61
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(yU(this,_.qc,a),yU(this,_.sc,a)):a.endedReason===b.STOPPED?yU(this,_.sc,a):a.endedReason===b.END_OF_STREAM?(yU(this,_.fc,a),yU(this,_.sc,a)):a.endedReason===b.ERROR&&vU(this,1);break;case cast.framework.events.EventType.PLAYING:yU(this,_.pc,a);break;case cast.framework.events.EventType.PAUSE:yU(this,_.nc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?yU(this,_.dc,a):yU(this,_.pc,a)}}};
62
- ZU.prototype.getPosition=ZU.prototype.getPosition;ZU.prototype.setVolume=ZU.prototype.setVolume;ZU.prototype.getVolume=ZU.prototype.getVolume;ZU.prototype.skip=ZU.prototype.skip;ZU.prototype.pause=ZU.prototype.pause;ZU.prototype.resume=ZU.prototype.resume;var sU=!1;var $U=class{constructor(a){this.cb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(zU(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(zU(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>AU(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=
63
- _.Ph;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Gh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Hh}b&&this.cb(new _.C(b,{detail:AU(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.cb(new _.C(_.Ph,{detail:b}))}};var aV=class extends _.S{constructor(){super();this.g=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;BU().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;BU().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ha(){return this.j}ma(){return null}Ua(){const a=
64
- this.la();return a&&a.renditions[0]}La(){const a=this.ta();return a&&a.renditions[0]}jb(){return null}zb(){return null}Ab(){return null}Ma(){return null}la(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ta(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ha().find(c=>c.id===b)||null)}return a}ub(){this.g.warn("Video tracks unavailable on Cast")}va(a){a&&this.f&&
65
- this.f.setActiveById(+a.id)}Oa(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}ab(){this.g.warn("Video renditions unavailable on Cast")}sb(a){this.va(a&&a.track)}tb(a){this.Oa(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield ST(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=
66
- 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]),DU(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}pa(){return!0}w(){this.f=BU().getAudioTracksManager();var a=this.f.getTracks();this.h=CU(_.L,a);DU(this);a=this.m.getConfiguration();EU(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);EU(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};aV.prototype.isAbrEnabled=aV.prototype.pa;
67
- aV.prototype.addTextTrack=aV.prototype.addTextTrack;aV.prototype.setTextRendition=aV.prototype.tb;aV.prototype.setAudioRendition=aV.prototype.sb;aV.prototype.setVideoRendition=aV.prototype.ab;aV.prototype.setTextTrack=aV.prototype.Oa;aV.prototype.setAudioTrack=aV.prototype.va;aV.prototype.setVideoTrack=aV.prototype.ub;aV.prototype.getTextTrack=aV.prototype.ta;aV.prototype.getAudioTrack=aV.prototype.la;aV.prototype.getVideoTrack=aV.prototype.Ma;aV.prototype.getLoadingTextRendition=aV.prototype.Ab;
68
- aV.prototype.getLoadingAudioRendition=aV.prototype.zb;aV.prototype.getLoadingVideoRendition=aV.prototype.jb;aV.prototype.getTextRendition=aV.prototype.La;aV.prototype.getAudioRendition=aV.prototype.Ua;aV.prototype.getVideoRendition=aV.prototype.ma;aV.prototype.getTextTracks=aV.prototype.ha;aV.prototype.getAudioTracks=aV.prototype.getAudioTracks;aV.prototype.getVideoTracks=aV.prototype.getVideoTracks;var bV=class extends _.Dt{constructor(){super();this.g=new _.R(LT);this.h=this.w=_.nl();this.A=null;this.l=-1;this.F=new _.yq;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=FU();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new XU(this);this.a.init();this.j=new aV;this.j.initialize(this);this.o=new $U(c=>this.trigger(c));this.o.init()}unload(){const a=
69
- cast.framework.messages.PlayerState,b=FU();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 _.w(function*(){a.B=null;a.w=_.nl();a.h=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=FU();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
70
- a.play();return Promise.resolve()}pause(){const a=FU();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return FU().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return FU().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=FU();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(DT);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}getMediaPosition(){return FU().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
71
- FU().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return FU().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;FU().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||
72
- null}getLoadedSource(){const a=FU().getMediaInformation();if(a){var b=FU().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,Yh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return FU().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=FU().getLiveSeekableRange();
73
- b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.Yt}getStats(){var a=_.bo();if(this.f){a=FU().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.h=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
74
- this;return _.w(function*(){b.f=new _.Wt;b.a.l=b.f.a;b.A=_.vo(a);b.h=_.pl(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.h.autoplay;typeof b.h.startTime===_.r&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:QT(b.h),local:!0};yield FU().load(d)}})}getBufferInfo(){this.g.warn(_.oa);return new _.Ct}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setNetworkEngine(a){this.F=
75
- a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return LT}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(HT)}onError(a){a=new _.C(_.Ud,{detail:a});this.trigger(a)}canPlay(){return _.zk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=QT(this.getStats());var b=FU(),c=a.media||b.getMediaInformation();b=
76
- b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==b&&(this.g.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=FU().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;
77
- h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=RT(a.media.customData.playerConfiguration));(a=c?c.abr||null:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;IU(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};bV.prototype.getTextDisplayer=bV.prototype.getTextDisplayer;
78
- bV.prototype.getNetworkEngine=bV.prototype.getNetworkEngine;bV.prototype.setNetworkEngine=bV.prototype.setNetworkEngine;var KU=class{constructor(){this.a=!1;this.g=new _.R(MT);this.f=this.m=null;this.h=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.Rs;this.l=null}init(a){a&&(this.f=new bV,_.Oq(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.po&&(yield PT(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=MU(),b=MU().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
79
- c.customNamespaces={};c.customNamespaces[NT]=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,
80
- this.A);a.start(c);a.addCustomMessageListener(NT,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=MU();MU().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(NT,this.w);a.stop();this.m=this.f=null}}hd(a){this.j=a}yh(a){this.l=a}on(a,b){MU().addEventListener(a,b)}off(a,b){MU().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Yd&&this.h.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.h.delete(a)}sendMessage(a,
81
- b){MU().sendCustomMessage(NT,b,QT(a))}mc(){return this.a}yb(){return NU()}Sb(a){OU(this,a)}Lh(a){const b=NU();let c=null;a?c=Object.assign({},b,a):c=b;OU(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return QU(this,a);try{var b=(new DOMParser).parseFromString(a,_.Vf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=MU();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
82
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.t||g===_.p){g=e[f].getAttribute(_.xe);var h=e[f].getElementsByTagName(_.Db);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.xe)||g,m=h[k].getAttribute(_.pd);let n=h[k].getAttribute(_.Bg)||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(_.Db).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
83
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Jb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=MU();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.Ab);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.fb)||void 0,h=e[f].getAttribute(_.eb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.lg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ab).length||a.removeChild(c[d])}a=
84
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=RT(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield uU(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.Xq(b.m,d),yield _.Yq(b.m),d=b.m.getLoadedSource(),c.media.contentId=
85
- d.url,c.media.contentType=d.type,d.Tb&&(c.media.hlsVideoSegmentFormat=TT(d.Tb,_.M)),d.audioMimeType&&(c.media.hlsSegmentFormat=TT(d.audioMimeType,_.L)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(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=MU().getPlayerManager(),
86
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.$q(this.m)}}B(a){if(0<this.h.size){const b=RT(a.data);this.h.forEach(c=>c(b))}}};_.x(MT,KU);KU.prototype.updateContentMetadata=KU.prototype.Lh;KU.prototype.setContentMetadata=KU.prototype.Sb;KU.prototype.getContentMetadata=KU.prototype.yb;KU.prototype.isApiReady=KU.prototype.mc;
87
- KU.prototype.sendMessage=KU.prototype.sendMessage;KU.prototype.removeMessageListener=KU.prototype.removeMessageListener;KU.prototype.addMessageListener=KU.prototype.addMessageListener;KU.prototype.off=KU.prototype.off;KU.prototype.on=KU.prototype.on;KU.prototype.setLoadRequestDataInterceptor=KU.prototype.yh;KU.prototype.setPlayerConfigInterceptor=KU.prototype.hd;KU.prototype.stop=KU.prototype.stop;KU.prototype.start=KU.prototype.start;KU.prototype.init=KU.prototype.init;KU.getInstance=LU;var JU=null;var cV=class{constructor(a){this.f=a;this.a=null;this.j=new _.Rs;this.l=[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 _.w(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.A.bind(a);for(const d of a.l)a.j.on(b,d,c)}})}start(){return _.w(function*(){})}w(){}resume(){this.a&&
88
- 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(OT,{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===_.r&&(a=b));return a}o(){return!0}h(){const a=
89
- this;return _.w(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.C(_.vc,{adsTimeline:new YU(a.breaks)})));break;case "isPlayingBreak":a.value?SU(this,_.bc):(SU(this,_.fc),SU(this,_.sc),SU(this,_.cc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(SU(this,_.fc),SU(this,_.sc)),SU(this,_.rc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?SU(this,_.nc):SU(this,_.pc))}}};cV.prototype.getPosition=cV.prototype.getPosition;
90
- cV.prototype.setVolume=cV.prototype.setVolume;cV.prototype.getVolume=cV.prototype.getVolume;cV.prototype.skip=cV.prototype.skip;cV.prototype.pause=cV.prototype.pause;cV.prototype.resume=cV.prototype.resume;_.Ko(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.jd?!1:!(!b||!b.ima)}create(a){return new cV(a.a)}});_.Ko(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return LU().mc()?!(!b||!b.ima):!1}create(a){return new ZU(a)}});};f.call(g, window);
58
+ Z.prototype.getTechnology=Z.prototype.pb;Z.prototype.getAdManagerVersion=Z.prototype.lb;Z.prototype.getAdManagerName=Z.prototype.kb;var GV=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Eb(){return!!this.a.find(a=>0===a.position)}Db(){return!!this.a.find(a=>-1===a.position)}};GV.prototype.hasPostroll=GV.prototype.Db;GV.prototype.hasPreroll=GV.prototype.Eb;GV.prototype.getCuePoints=GV.prototype.getCuePoints;var HV=class{constructor(a){this.m=a;this.a=null;this.j=this.w.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];eV().addEventListener(this.f,
59
+ this.j)}load(){const a=this;return _.x(function*(){aV&&(aV=!1,dV(a,0))})}start(){return _.x(function*(){eV().play()})}o(){}resume(){-1!==this.getPosition()&&eV().play()}pause(){-1!==this.getPosition()&&eV().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}l(){return!0}h(){const a=this;return _.x(function*(){eV().removeEventListener(a.f,a.j)})}w(a){const b=cast.framework.events.EndedReason;
60
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=eV().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.E(_.vc,{adsTimeline:new GV(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:gV(this,_.kc,a);break;case cast.framework.events.EventType.BREAK_STARTED:gV(this,_.bc,a);break;case cast.framework.events.EventType.BREAK_ENDED:gV(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:gV(this,_.rc,a);
61
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(gV(this,_.qc,a),gV(this,_.sc,a)):a.endedReason===b.STOPPED?gV(this,_.sc,a):a.endedReason===b.END_OF_STREAM?(gV(this,_.fc,a),gV(this,_.sc,a)):a.endedReason===b.ERROR&&dV(this,1);break;case cast.framework.events.EventType.PLAYING:gV(this,_.oc,a);break;case cast.framework.events.EventType.PAUSE:gV(this,_.mc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?gV(this,_.dc,a):gV(this,_.oc,a)}}};
62
+ HV.prototype.getPosition=HV.prototype.getPosition;HV.prototype.setVolume=HV.prototype.setVolume;HV.prototype.getVolume=HV.prototype.getVolume;HV.prototype.skip=HV.prototype.skip;HV.prototype.pause=HV.prototype.pause;HV.prototype.resume=HV.prototype.resume;var aV=!1;var IV=class{constructor(a){this.gb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(hV(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(hV(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>iV(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=
63
+ _.Qh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Hh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Ih}b&&this.gb(new _.E(b,{detail:iV(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.gb(new _.E(_.Qh,{detail:b}))}};var JV=class extends _.T{constructor(){super();this.g=new _.S("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;jV().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;jV().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ia(){return this.j}ja(){return null}Xa(){const a=
64
+ this.ma();return a&&a.renditions[0]}Pa(){const a=this.ta();return a&&a.renditions[0]}ob(){return null}zb(){return null}Ab(){return null}Da(){return null}ma(){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}ta(){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}vb(){this.g.warn("Video tracks unavailable on Cast")}wa(a){a&&this.f&&
65
+ this.f.setActiveById(+a.id)}Ra(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}fb(){this.g.warn("Video renditions unavailable on Cast")}tb(a){this.wa(a&&a.track)}ub(a){this.Ra(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield AU(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=
66
+ 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]),lV(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}pa(){return!0}w(){this.f=jV().getAudioTracksManager();var a=this.f.getTracks();this.h=kV(_.M,a);lV(this);a=this.m.getConfiguration();mV(this,_.M,a.preferredAudioLanguage,a.preferredAudioRole);mV(this,_.L,a.preferredTextLanguage,a.preferredTextRole)}};JV.prototype.isAbrEnabled=JV.prototype.pa;
67
+ JV.prototype.addTextTrack=JV.prototype.addTextTrack;JV.prototype.setTextRendition=JV.prototype.ub;JV.prototype.setAudioRendition=JV.prototype.tb;JV.prototype.setVideoRendition=JV.prototype.fb;JV.prototype.setTextTrack=JV.prototype.Ra;JV.prototype.setAudioTrack=JV.prototype.wa;JV.prototype.setVideoTrack=JV.prototype.vb;JV.prototype.getTextTrack=JV.prototype.ta;JV.prototype.getAudioTrack=JV.prototype.ma;JV.prototype.getVideoTrack=JV.prototype.Da;JV.prototype.getLoadingTextRendition=JV.prototype.Ab;
68
+ JV.prototype.getLoadingAudioRendition=JV.prototype.zb;JV.prototype.getLoadingVideoRendition=JV.prototype.ob;JV.prototype.getTextRendition=JV.prototype.Pa;JV.prototype.getAudioRendition=JV.prototype.Xa;JV.prototype.getVideoRendition=JV.prototype.ja;JV.prototype.getTextTracks=JV.prototype.ia;JV.prototype.getAudioTracks=JV.prototype.getAudioTracks;JV.prototype.getVideoTracks=JV.prototype.getVideoTracks;var KV=class extends _.Ot{constructor(){super();this.g=new _.S(tU);this.h=this.w=_.ql();this.A=null;this.l=-1;this.F=new _.Hq;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=nV();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new FV(this);this.a.init();this.j=new JV;this.j.initialize(this);this.o=new IV(c=>this.trigger(c));this.o.init()}unload(){const a=
69
+ cast.framework.messages.PlayerState,b=nV();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=_.ql();a.h=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=nV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
70
+ a.play();return Promise.resolve()}pause(){const a=nV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return nV().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return nV().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=nV();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(lU);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getMediaPosition(){return nV().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
71
+ nV().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return nV().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;nV().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||
72
+ null}getLoadedSource(){const a=nV().getMediaInformation();if(a){var b=nV().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,ci:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return nV().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=nV().getLiveSeekableRange();
73
+ 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():_.iu}getStats(){var a=_.jo();if(this.f){a=nV().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.h=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=
74
+ this;return _.x(function*(){b.f=new _.gu;b.a.l=b.f.a;b.A=_.Co(a);b.h=_.sl(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.h.autoplay;typeof b.h.startTime===_.t&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:yU(b.h),local:!0};yield nV().load(d)}})}getBufferInfo(){this.g.warn(_.oa);return new _.Nt}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setNetworkEngine(a){this.F=
75
+ a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return tU}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(pU)}onError(a){a=new _.E(_.r,{detail:a});this.trigger(a)}canPlay(){return _.Ck()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=yU(this.getStats());var b=nV(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();
76
+ c&&typeof b===_.t&&c.startAbsoluteTime!==b&&(this.g.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=nV().getStartAbsoluteTime();if(typeof d===_.t){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=
77
+ d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=zU(a.media.customData.playerConfiguration));(a=c?c.abr||null:null)&&typeof a.defaultBandwidthEstimate===_.t?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;qV(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var sV=class{constructor(){this.a=!1;this.g=new _.S(uU);this.f=this.m=null;this.h=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.bt;this.l=null}init(a){a&&(this.f=new KV,_.Xq(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.wo&&(yield xU(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=uV(),b=uV().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
78
+ c.customNamespaces={};c.customNamespaces[vU]=cast.framework.system.MessageType.JSON;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(vU,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=uV();uV().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(vU,this.w);a.stop();this.m=this.f=null}}fd(a){this.j=a}Ch(a){this.l=a}on(a,b){uV().addEventListener(a,b)}off(a,b){uV().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Xd&&this.h.add(a)}removeMessageListener(a){typeof a===_.Xd&&this.h.delete(a)}sendMessage(a,
80
+ b){uV().sendCustomMessage(vU,b,yU(a))}mc(){return this.a}yb(){return vV()}Sb(a){wV(this,a)}Ph(a){const b=vV();let c=null;a?c=Object.assign({},b,a):c=b;wV(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return yV(this,a);try{var b=(new DOMParser).parseFromString(a,_.Uf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=uV();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);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(_.pd);let n=h[k].getAttribute(_.Ag)||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(_.ea).length||a.removeChild(c[d])}return a=
82
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Jb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=uV();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(_.fb)||void 0,h=e[f].getAttribute(_.eb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.kg,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=zU(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield cV(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 _.hr(b.m,d),yield _.ir(b.m),d=b.m.getLoadedSource(),c.media.contentId=
84
+ d.url,c.media.contentType=d.type,d.Tb&&(c.media.hlsVideoSegmentFormat=BU(d.Tb,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=BU(d.audioMimeType,_.M)));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=uV().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))}_.kr(this.m)}}B(a){if(0<this.h.size){const b=zU(a.data);this.h.forEach(c=>c(b))}}};_.z(uU,sV);sV.prototype.updateContentMetadata=sV.prototype.Ph;sV.prototype.setContentMetadata=sV.prototype.Sb;sV.prototype.getContentMetadata=sV.prototype.yb;sV.prototype.isApiReady=sV.prototype.mc;
86
+ sV.prototype.sendMessage=sV.prototype.sendMessage;sV.prototype.removeMessageListener=sV.prototype.removeMessageListener;sV.prototype.addMessageListener=sV.prototype.addMessageListener;sV.prototype.off=sV.prototype.off;sV.prototype.on=sV.prototype.on;sV.prototype.setLoadRequestDataInterceptor=sV.prototype.Ch;sV.prototype.setPlayerConfigInterceptor=sV.prototype.fd;sV.prototype.stop=sV.prototype.stop;sV.prototype.start=sV.prototype.start;sV.prototype.init=sV.prototype.init;sV.getInstance=tV;var rV=null;var LV=class{constructor(a){this.f=a;this.a=null;this.j=new _.bt;this.w=[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.A.bind(a);for(const d of a.w)a.j.on(b,d,c)}})}start(){return _.x(function*(){})}o(){}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(wU,{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}l(){return!0}h(){const a=
88
+ this;return _.x(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.E(_.vc,{adsTimeline:new GV(a.breaks)})));break;case "isPlayingBreak":a.value?AV(this,_.bc):(AV(this,_.fc),AV(this,_.sc),AV(this,_.cc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(AV(this,_.fc),AV(this,_.sc)),AV(this,_.rc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?AV(this,_.mc):AV(this,_.oc))}}};LV.prototype.getPosition=LV.prototype.getPosition;
89
+ LV.prototype.setVolume=LV.prototype.setVolume;LV.prototype.getVolume=LV.prototype.getVolume;LV.prototype.skip=LV.prototype.skip;LV.prototype.pause=LV.prototype.pause;LV.prototype.resume=LV.prototype.resume;_.Ro(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.jd?!1:!(!b||!b.ima)}create(a){return new LV(a.a)}});_.Ro(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return tV().mc()?!(!b||!b.ima):!1}create(a){return new HV(a)}});};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 eT="Ad Error",fT="onAdBreakStarted()",gT="onAdBreakStopped()",hT=function(a){var b=_.Ok();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Ak()&&(f="Apple");_.zk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Bk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Ak()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.tk()||_.qk()||_.pk("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.tk()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.qk()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.pk("Hisense")&&(b="",f="Hisense")):_.pk("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},iT=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},jT=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},lT=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
- iT(!!d);e[Conviva.Constants.ASSET_NAME]=eT;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"]=kT(a.getId()),e["c3.ad.creativeId"]=kT(a.getCreativeId()),e["c3.ad.system"]=kT(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=kT(a.getApiFramework()),e["c3.ad.advertiser"]=kT(a.getAdvertiserName()),e["c3.ad.position"]=jT(a.getPodIndex()),e["c3.ad.technology"]=0===a.ob()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=kT(a.hb()),e["c3.ad.adManagerVersion"]=kT(a.ib()),e["c3.ad.advertiserCategory"]=kT(null),e["c3.ad.advertiserId"]=kT(null),e["c3.ad.breakId"]=kT(null),e["c3.ad.campaignName"]=kT(null),e["c3.ad.category"]=kT(null),e["c3.ad.classification"]=kT(null),e["c3.ad.creativeName"]=kT(null),e["c3.ad.sequence"]=kT(a.Cb()),e["c3.ad.sessionStartEvent"]=kT(null),e["c3.ad.unitName"]=kT(null),e["c3.ad.dayPart"]=kT(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"]=kT(b),e["c3.ad.firstAdSystem"]=kT(c),e["c3.ad.firstCreativeId"]=kT(a));return e},kT=function(a){return a?""+a:"NA"},pT=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,_.rc,a.L.bind(a));a.f.on(a.m,_.oc,a.l.bind(a));a.f.on(a.m,_.nc,a.l.bind(a));a.f.on(a.m,_.pc,a.l.bind(a));a.f.on(a.m,_.dc,a.l.bind(a));a.f.on(a.m,_.sc,a.M.bind(a));
7
- a.f.on(a.m,_.qc,a.K.bind(a));a.f.on(a.m,_.ec,a.G.bind(a));a.f.on(a.m,_.kc,a.I.bind(a));a.f.on(a.m,_.lc,a.J.bind(a));a.f.on(a.m,_.gc,a.H.bind(a));a.f.on(a.m,_.mc,a.S.bind(a));a.f.on(a.m,_.tc,a.O.bind(a));a.f.on(a.m,_.Ud,b=>{var c=b.detail;if(10003===c.code&&(a.g.debug("onAdError()"),!a.h)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=eT}null===a.a&&mT(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
- nT(a,oT,c)}})},nT=function(a,b,c=eT){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case oT:a.a.reportAdFailed(c,lT(null,a.B,a.A));break;case qT:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},mT=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=lT(b,a.B,a.A,a.m.isLive()),d=String(b.ib()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.hb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
- d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.g.error("Could not create ad analytics session",c)}}},rT=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.g.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(hT(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]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},sT=function(a){return a.m.getConfiguration().autoplay||!1},uT=function(a){if(!a.l)if(a.C)a.g.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.g.debug(a.m.getConfiguration().source);var f={},g=
11
- new _.cm(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ej(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.pa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.z(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.g.debug("reportMiscellaneousMetrics()");if(tT(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.g.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.jf(h.args)}));a.j=[]}},vT=function(a){if(!a.l&&a.a){const b=iT(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},tT=function(a){return null!==a.a&&a.C},wT=function(a){a.g.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.h=!1,a.w=null,a.B=!1,a.O=0,a.J=!1,a.j=[],a.H=0)},xT=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.De;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.G(1,9,9E3),a.T(b,c)):b.namespace()===_.jd&&(a.a=!1,
14
- a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},yT=function(a){const b=[];typeof a===_.De&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.G(1,9,9001,{missingKeys:b});};var AT=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.pa;this.g=new _.R("clpp.conviva.ad");this.f=new _.Rs;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.g.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.pa;pT(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ha):(_.ph(this.f),this.a&&nT(this,zT),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Cd);this.o?this.g.debug(_.fa):this.o=!0}C(){this.g.debug(fT)}F(){this.g.debug(gT)}L(a){this.g.debug("onAdStarted()");
15
- a=a.ad;this.j||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),mT(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.lb(),a.kb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Za())}l(a){this.g.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.oc:case _.pc:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.nc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.dc:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&nT(this,zT)}K(){this.g.debug("onAdSkipped()");this.a&&nT(this,qT)}G(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.g.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.g.debug("onAdLoaded()");
17
- const b=a.ad,c=()=>{this.j=!0;mT(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Wf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Wf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}S(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}O(){this.g.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},qT=0,zT=1,oT=2;var BT=class{constructor(a,b){this.m=a;this.f=new _.Rs;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.O=0;this.J=!1;this.w=null;this.I=!1;this.g=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.G=!1,this.F=_.Pg(b),this.K=c,this.m=a,rT(this,this.F),this.f.on(this.m,_.Re,this.da.bind(this)),this.f.on(this.m,_.Mf,this.Y.bind(this)),this.f.on(this.m,_.Oc,this.L.bind(this)),this.f.on(this.m,_.fg,this.X.bind(this)),this.f.on(this.m,
19
- _.eg,this.V.bind(this)),this.f.on(this.m,_.bc,this.R.bind(this)),this.f.on(this.m,_.cc,this.S.bind(this)),this.f.on(this.m,_.vc,this.Z.bind(this)),this.f.on(this.m,_.Nc,this.ba.bind(this)),this.f.on(this.m,_.Ud,this.M.bind(this)),sT(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),uT(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ha):(_.ph(this.f),tT(this)||this.o||!sT(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),tT(this)&&
20
- wT(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Cd);this.l?this.g.debug(_.fa):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c}da(){this.g.debug("onPlayRequest()");tT(this)||sT(this)?tT(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),tT(this)&&!this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.g.debug("Creating conviva session. On Play Requested / No autoplay"),
21
- uT(this))}Y(a){this.g.debug(_.Ie);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),rT(this,this.F),uT(this),vT(this),tT(this))){var d=this.m.getTrackManager();d=d.ma()||d.jb();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)}tT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.so:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.ro:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ko:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.ho:this.g.debug("onVideoEnded()"),tT(this)&&(this.w&&this.w.Db()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):wT(this))}}L(a){this.g.debug(_.Ee);if(tT(this)){if(a=a.detail,typeof a.width===_.r&&typeof a.height===_.r&&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({jf:this.L.bind(this),args:a})}X(){this.g.debug("onSeeking()");tT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");tT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}Z(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(fT);
24
- var b=a.ad;a=0===b.Va();const c=jT(b.getPodIndex());tT(this)||sT(this)||!a||uT(this);if(tT(this)){a=0===b.ob()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.nb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.O;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.zk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}S(){this.g.debug(gT);
25
- tT(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&wT(this))}M(a){this.g.debug(_.Fe);if(this.o&&this.I)this.g.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===_.E&&(d=Conviva.Constants.ErrorSeverity.FATAL,tT(this)||uT(this));tT(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),
26
- this.I=!0,wT(this))):this.j.push({jf:this.M.bind(this),args:a})}}ba(){this.g.debug("onAutoPlayBlocked()");tT(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,tT(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var CT=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new BT(a,this.g)}onContentWillLoad(a,b){xT(this,a);if(this.a){var c=a.getConfiguration();c=_.Pg(c.conviva||{});try{yT(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new AT(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.G?this.T(a,d):this.T(a,new _.G(1,9,9002,d,d))}}}onContentLoaded(){this.a&&vT(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
- this.f=null,this.h&&(this.h.destroy(),this.h=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.h&&this.h.release())}id(){return"conviva"}T(a,b){a.trigger(new _.C(_.Ud,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",CT);CT.prototype.reportAppEvent=CT.prototype.reportAppEvent;CT.Id="conviva";_.Hq(new class{create(){return new CT}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var NT="Ad Error",OT="onAdBreakStarted()",PT="onAdBreakStopped()",QT=function(a){var b=_.Rk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Dk()&&(f="Apple");_.Ck()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Ek()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Dk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.wk()||_.tk()||_.sk("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.wk()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.tk()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.sk("Hisense")&&(b="",f="Hisense")):_.sk("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},RT=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},ST=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},UT=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
+ RT(!!d);e[Conviva.Constants.ASSET_NAME]=NT;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"]=TT(a.getId()),e["c3.ad.creativeId"]=TT(a.getCreativeId()),e["c3.ad.system"]=TT(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=TT(a.getApiFramework()),e["c3.ad.advertiser"]=TT(a.getAdvertiserName()),e["c3.ad.position"]=ST(a.getPodIndex()),e["c3.ad.technology"]=0===a.pb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=TT(a.kb()),e["c3.ad.adManagerVersion"]=TT(a.lb()),e["c3.ad.advertiserCategory"]=TT(null),e["c3.ad.advertiserId"]=TT(null),e["c3.ad.breakId"]=TT(null),e["c3.ad.campaignName"]=TT(null),e["c3.ad.category"]=TT(null),e["c3.ad.classification"]=TT(null),e["c3.ad.creativeName"]=TT(null),e["c3.ad.sequence"]=TT(a.Cb()),e["c3.ad.sessionStartEvent"]=TT(null),e["c3.ad.unitName"]=TT(null),e["c3.ad.dayPart"]=TT(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"]=TT(b),e["c3.ad.firstAdSystem"]=TT(c),e["c3.ad.firstCreativeId"]=TT(a));return e},TT=function(a){return a?""+a:"NA"},YT=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,_.rc,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,_.dc,a.l.bind(a));a.f.on(a.m,_.sc,a.M.bind(a));
7
+ a.f.on(a.m,_.qc,a.K.bind(a));a.f.on(a.m,_.ec,a.G.bind(a));a.f.on(a.m,_.jc,a.I.bind(a));a.f.on(a.m,_.kc,a.J.bind(a));a.f.on(a.m,_.gc,a.H.bind(a));a.f.on(a.m,_.lc,a.S.bind(a));a.f.on(a.m,_.tc,a.O.bind(a));a.f.on(a.m,_.r,b=>{var c=b.detail;if(10003===c.code&&(a.g.debug("onAdError()"),!a.h)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=NT}null===a.a&&VT(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ WT(a,XT,c)}})},WT=function(a,b,c=NT){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case XT:a.a.reportAdFailed(c,UT(null,a.B,a.A));break;case ZT:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},VT=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=UT(b,a.B,a.A,a.m.isLive()),d=String(b.lb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.kb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
+ d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.g.error("Could not create ad analytics session",c)}}},$T=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.g.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(QT(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]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},aU=function(a){return a.m.getConfiguration().autoplay||!1},cU=function(a){if(!a.l)if(a.C)a.g.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.g.debug(a.m.getConfiguration().source);var f={},g=
11
+ new _.fm(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Hj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.pa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.B(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.g.debug("reportMiscellaneousMetrics()");if(bU(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.g.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.mf(h.args)}));a.j=[]}},dU=function(a){if(!a.l&&a.a){const b=RT(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},bU=function(a){return null!==a.a&&a.C},eU=function(a){a.g.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.h=!1,a.w=null,a.B=!1,a.O=0,a.J=!1,a.j=[],a.H=0)},fU=function(a,b){var c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.Ce;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.I(1,9,9E3),a.T(b,c)):b.namespace()===_.jd&&(a.a=!1,
14
+ a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},gU=function(a){const b=[];typeof a===_.Ce&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.I(1,9,9001,{missingKeys:b});};var iU=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.pa;this.g=new _.S("clpp.conviva.ad");this.f=new _.bt;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.g.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.pa;YT(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ha):(_.qh(this.f),this.a&&WT(this,hU),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Cd);this.o?this.g.debug(_.fa):this.o=!0}C(){this.g.debug(OT)}F(){this.g.debug(PT)}L(a){this.g.debug("onAdStarted()");
15
+ a=a.ad;this.j||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),VT(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.bb(),a.ab());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Na())}l(a){this.g.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 _.dc:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&WT(this,hU)}K(){this.g.debug("onAdSkipped()");this.a&&WT(this,ZT)}G(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.g.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.g.debug("onAdLoaded()");
17
+ const b=a.ad,c=()=>{this.j=!0;VT(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Vf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Vf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}S(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}O(){this.g.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},ZT=0,hU=1,XT=2;var jU=class{constructor(a,b){this.m=a;this.f=new _.bt;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.O=0;this.J=!1;this.w=null;this.I=!1;this.g=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.G=!1,this.F=_.Qg(b),this.K=c,this.m=a,$T(this,this.F),this.f.on(this.m,_.Qe,this.ca.bind(this)),this.f.on(this.m,_.Lf,this.Y.bind(this)),this.f.on(this.m,_.Oc,this.L.bind(this)),this.f.on(this.m,_.eg,this.X.bind(this)),this.f.on(this.m,
19
+ _.dg,this.V.bind(this)),this.f.on(this.m,_.bc,this.R.bind(this)),this.f.on(this.m,_.cc,this.S.bind(this)),this.f.on(this.m,_.vc,this.Z.bind(this)),this.f.on(this.m,_.Nc,this.ba.bind(this)),this.f.on(this.m,_.r,this.M.bind(this)),aU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),cU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ha):(_.qh(this.f),bU(this)||this.o||!aU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),bU(this)&&
20
+ eU(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Cd);this.l?this.g.debug(_.fa):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c}ca(){this.g.debug("onPlayRequest()");bU(this)||aU(this)?bU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),bU(this)&&!this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.g.debug("Creating conviva session. On Play Requested / No autoplay"),
21
+ cU(this))}Y(a){this.g.debug(_.He);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),$T(this,this.F),cU(this),dU(this),bU(this))){var d=this.m.getTrackManager();d=d.ja()||d.ob();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)}bU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.zo:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.yo:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ro:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.oo:this.g.debug("onVideoEnded()"),bU(this)&&(this.w&&this.w.Db()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):eU(this))}}L(a){this.g.debug(_.De);if(bU(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({mf:this.L.bind(this),args:a})}X(){this.g.debug("onSeeking()");bU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");bU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}Z(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(OT);
24
+ var b=a.ad;a=0===b.Oa();const c=ST(b.getPodIndex());bU(this)||aU(this)||!a||cU(this);if(bU(this)){a=0===b.pb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.cb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.O;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Ck()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}S(){this.g.debug(PT);
25
+ bU(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&eU(this))}M(a){this.g.debug(_.Ee);if(this.o&&this.I)this.g.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,bU(this)||cU(this));bU(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),
26
+ this.I=!0,eU(this))):this.j.push({mf:this.M.bind(this),args:a})}}ba(){this.g.debug("onAutoPlayBlocked()");bU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,bU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var kU=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.S("clpp.conviva")}onPlayerCreated(a){this.f=new jU(a,this.g)}onContentWillLoad(a,b){fU(this,a);if(this.a){var c=a.getConfiguration();c=_.Qg(c.conviva||{});try{gU(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new iU(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.I?this.T(a,d):this.T(a,new _.I(1,9,9002,d,d))}}}onContentLoaded(){this.a&&dU(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
+ this.f=null,this.h&&(this.h.destroy(),this.h=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.h&&this.h.release())}id(){return"conviva"}T(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",kU);kU.prototype.reportAppEvent=kU.prototype.reportAppEvent;kU.Id="conviva";_.Qq(new class{create(){return new kU}});};f.call(g, window);