@castlabs/prestoplay 6.2.7 → 6.3.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 (58) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +110 -106
  6. package/cjs/cl.conviva.js +33 -32
  7. package/cjs/cl.core.js +395 -383
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +69 -68
  10. package/cjs/cl.externs.js +98 -47
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +44 -43
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +32 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +250 -255
  17. package/cjs/cl.muxdata.js +12 -11
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -5
  21. package/cjs/cl.smooth.js +70 -70
  22. package/cjs/cl.thumbnails.js +22 -22
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +26 -26
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +18 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +19 -18
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +86 -82
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +346 -334
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +63 -62
  38. package/cl.externs.js +98 -47
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +37 -36
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -24
  43. package/cl.ima.js +16 -16
  44. package/cl.mse.js +220 -224
  45. package/cl.muxdata.js +8 -9
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +5 -4
  49. package/cl.smooth.js +57 -57
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +21 -21
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -15
  58. package/package.json +1 -1
package/cl.cast.js CHANGED
@@ -1,83 +1,87 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var NH="Cannot seek during ads playout.",OH="Cannot switch track",PH="Media session does not exist.",QH="No receivers available",RH="Reset ABR functionality not available on cast.",SH="SDK not yet ready",TH="Sender is destroyed.",UH="clpp.cast.CastProxy",VH="clpp.cast.Player",WH="clpp.cast.Receiver",XH="urn:x-cast:castlabs",YH="urn:x-cast:com.google.cast.media",ZH=function(a){return _.v(function*(){yield _.Gl(a,_.wd);yield _.Gl(a,_.vd)})},$H=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.Qc){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.rd?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.p?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},aI=function(a){if(typeof a!==_.ee)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},bI=function(a,b,c,d){return _.v(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=_.Dg(d,a.mimeType,g);f&&g&&(h=_.wg(a.url),(h=yield c.fetch(h).O)&&h.data&&(e=f.a(_.L(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},cI=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 _.Be:return d.FMP4;case _.Ae:return b===_.K?d.MPEG2_TS:c.TS;case _.Sb:return c.AAC;case _.Tb:return c.AC3;case _.Ub:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Vb:return c.FMP4}},dI=function(a,b){return a.g.filter(c=>c.type===b)},fI=function(a,b){const c=eI(a);return dI(a,b).find(d=>c.includes(d.id))||null},hI=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.I){const e=a.ia();e&&c.push(+e.id)}c=
5
- new chrome.cast.media.EditTracksInfoRequest(c);d.editTracksInfo(c,()=>{a.f[b]=null;gI(a,b)},e=>{a.f[b]=null;a.h.debug(OH,e)})}else b===_.I&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{gI(a,b)},e=>{a.h.debug(OH,e)}))},eI=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},gI=function(a,b){b===_.J?a.a.trigger(new _.F(_.Vg)):b===_.I&&a.a.trigger(new _.F(_.Wg))},kI=function(a){if(a)for(const b of iI)jI(b)},jI=function(a){if(!a.A&&window.chrome&&
6
- chrome.cast&&chrome.cast.isAvailable&&window.cast&&cast.framework&&cast.framework.CastContext&&a.T.length){a.A=!0;a.w.Od();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ca);lI&&a.w.$(.02)}},mI=function(a){return _.v(function*(){iI.delete(a);
7
- if(a.A){a.A=!1;var b=cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ca)}b=[];a.g&&(b.push(a.g.destroy()),a.g=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.B=!1;a.w&&(a.w.stop(),a.w=null);a.S=null;a.W=null})},nI=function(a){return _.v(function*(){a.Ya()||(yield cast.framework.CastContext.getInstance().requestSession())})},
8
- pI=function(a,b,c){c=void 0===c?0:c;return _.v(function*(){var d=a.g.ia();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.g.ha())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield oI(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),autoplay:b,Ea:a.h})})},oI=function(a,b){return _.v(function*(){var c=chrome.cast.media.StreamType;yield nI(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,b.source.type);
9
- e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=cI(b.tb,_.K);e.hlsSegmentFormat=cI(c,_.J);b.Ea&&(a.L&&(c=yield Promise.resolve(a.L(b.Ea)))&&(b.Ea=c),a.h=b.Ea,a.D=_.Fk(a.h),a.C=a.D.findIndex(f=>f.url===b.source.url),b.Ea.remoteTextTracks&&(c=yield Promise.all(b.Ea.remoteTextTracks.map(a.ua.bind(a))),e.tracks=c.filter(f=>f),b.Ea.remoteTextTracks=void 0),delete b.Ea.autoplay,b.Ea.startTime=null,e.customData={playerConfiguration:$H(b.Ea)});b.source.name&&a.Rc(b.source.name);
10
- a.f&&(e.metadata=a.f);e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Zb&&(e.autoplay=b.autoplay);typeof b.currentTime===_.p&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},rI=function(a,b){qI(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(XH,a.R)},qI=function(a,b){b!==a.a&&(a.a=b,a.a&&(a.I.release(),a.H=null,a.o=null,a.o=new cast.framework.RemotePlayer,a.H=new cast.framework.RemotePlayerController(a.o),a.I.on(a.H,
11
- cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.na.bind(a)),a.g&&a.g.load(),a.j&&a.j.init(),a.trigger(new _.F(_.dd))))},uI=function(a){return new sI(a.h,()=>{a.trigger(new _.F(_.hc))},(b,c)=>{{const d=a.f.getConfiguration();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.Wd&&(d.preferredAudioLanguage=c.Wd);c.Ae&&(d.preferredTextLanguage=c.Ae);_.Il(a.f,null);a.trigger(new _.F("castingended"));
12
- a.j(b,d)}},()=>tI(a))},tI=function(a){return _.v(function*(){a.trigger(new _.F(_.gc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Il(a.f,a.a))})},vI=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},wI=function(a){const b=a.dashTimedMetadata;let c=_.se;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.re)?_.Hf:_.Ff,schemeIdUri:c,
13
- id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},xI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},zI=function(a){a.a=xI().getTextTracksManager();const b=a.a.getTracks();a.m=yI(_.I,b)},yI=function(a,b){const c=[];for(const d of b)b=new _.Uf(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||
14
- null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.sn(b.id,b)),c.push(b);return c},AI=function(a,b,c,d){c=_.Jg(c).filter(g=>g);var e=!1;let f=[];b===_.J?f=a.getAudioTracks():b===_.I&&(f=a.ea());if(c=c.find(g=>{const h=_.Gg(g);return f.some(k=>{k=_.Gg(k.language||"");return _.Hg(h,k)})})){const g=_.Gg(c);c=f.filter(h=>{h=_.Gg(h.language||"");return _.Hg(g,h)});f=c.length?c:f;e=e||!!c.length}_.pg(d)&&(c=f.filter(g=>g.roles.includes(d)),
15
- f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.J?a.la(e):b===_.I&&a.ta(e))},BI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},EI=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.ti(d);if(e){var f=[_.xc];_.Fk(a)[0].type!==_.Ob&&f.unshift(_.yc);d.preferredDrmSystem===_.xc&&f.reverse();
16
- for(var g,h;f.length&&!h;)g=f.shift(),h=e.Oa[g];h?(c=g===_.yc?cast.framework.ContentProtection.WIDEVINE:g===_.xc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},CI(b,h,a,c),DI(b,h,a,c)):c()}else c()}else c()},CI=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.wg(e.url);e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,
17
- f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},DI=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=e=>{e=_.xg({},e.buffer,200,"");b.modifiers.licenseResponse(c,e,d);return _.L(e.data)}:a.licenseHandler=void 0},HI=function(a,b,c){return _.v(function*(){var d=b.adTagUrl;if(d)try{FI=!1;const e=_.wg(d),f=yield c.fetch(e).O;if(f&&f.data){const g=_.gg(f.data),h=(new DOMParser).parseFromString(g,_.le);
18
- if(h.getElementsByTagName("vmap:VMAP").length)_.z("VMAP detected."),a.vmapAdsRequest=GI(g);else if(h.getElementsByTagName("VAST").length){_.z("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=GI(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.z("Unsupported schema."),FI=!0}}catch(e){_.z("Failed to fetch an ad",e),FI=!0}})},GI=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},
19
- II=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.l.onError(b)},JI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},LI=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=KI(a,c))&&(d={ad:c});a.l.trigger(new _.F(b,d))}},KI=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.ee&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
20
- _.ee&&(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 X(d,e,b.index,b.total,f)}return c},OI=function(){return MI||(MI=new NI)},QI=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=cast.framework.CastReceiverContext.getInstance();var {hlsVideoSegmentFormat:d}=a.getPlayerManager().getMediaInformation();
21
- c=d===c.FMP4?_.Be:_.Ae;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=PI(f,_.ja),h=PI(f,"RESOLUTION");let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},PI=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(","),
22
- 0<=d&&(c=c.substring(0,d))));return c},SI=function(a,b){let c=null;const d=RI(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},RI=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=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)||
23
- null);b=new X(d,c,g,e,f)}return b},TI=class{constructor(a,b){this.log=new _.O(b);this.f=a;this.m=null;this.h=_.zk;this.o=_.go;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.zk)}destroy(){this.m=this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.G&&this.a(_.yk)}a(a){if(a!==this.h)if(this.h===_.yk&&a!==_.zk)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===_.uk?(this.B=b,this.f.trigger(new _.F(_.ac,
24
- {detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.uk&&this.f.trigger(new _.F(_.$b,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.m&&_.fk(this.m,this.h);this.f.trigger(new _.F(_.be,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var UI=class extends TI{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.g=null;this.A=this.D.bind(this)}init(){const a=this.f,b=a.a;b&&(this.g&&this.g.removeUpdateListener(this.A),this.g=b,this.g.addUpdateListener(this.A),this.w=a.o)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.v(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.o;b&&b.isPlayingBreak||super.a(a)}D(){if(this.g&&this.w&&
25
- !this.w.isPlayingBreak)switch(this.g.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.g.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.rk);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.yk);break;default:this.a(_.zk)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Ck);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Bk);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.uk)}}};var Y=class extends _.P{constructor(){super();this.h=new _.O("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}j(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.K;break;case chrome.cast.media.TrackType.AUDIO:c=_.J;break;case chrome.cast.media.TrackType.TEXT:c=_.I}c=new _.Uf(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;c.label=b.name;
26
- 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 _.sn(c.id,c));return c}):[],this.a.trigger(new _.F(_.xn)))}destroy(){this.a=null}getVideoTracks(){return dI(this,_.K)}getAudioTracks(){return dI(this,_.J)}ea(){return dI(this,_.I)}fa(){const a=this.Aa();return a?a.renditions[0]:null}xa(){const a=this.ha();return a?a.renditions[0]:null}za(){const a=this.ia();return a?a.renditions[0]:null}Ia(){return this.f[_.K]||
27
- null}Ua(){return this.f[_.J]||null}Va(){return this.f[_.I]||null}Aa(){return fI(this,_.K)}ha(){return fI(this,_.J)}ia(){return fI(this,_.I)}Na(a){hI(this,_.K,a)}la(a){hI(this,_.J,a)}ta(a){hI(this,_.I,a)}Ma(a){this.Na(a&&a.track)}bb(a){this.la(a&&a.track)}cb(a){this.ta(a&&a.track)}addTextTrack(){return _.v(function*(){})}ja(){return!0}};Y.prototype.isAbrEnabled=Y.prototype.ja;Y.prototype.addTextTrack=Y.prototype.addTextTrack;Y.prototype.setTextRendition=Y.prototype.cb;
28
- Y.prototype.setAudioRendition=Y.prototype.bb;Y.prototype.setVideoRendition=Y.prototype.Ma;Y.prototype.setTextTrack=Y.prototype.ta;Y.prototype.setAudioTrack=Y.prototype.la;Y.prototype.setVideoTrack=Y.prototype.Na;Y.prototype.getTextTrack=Y.prototype.ia;Y.prototype.getAudioTrack=Y.prototype.ha;Y.prototype.getVideoTrack=Y.prototype.Aa;Y.prototype.getLoadingTextRendition=Y.prototype.Va;Y.prototype.getLoadingAudioRendition=Y.prototype.Ua;Y.prototype.getLoadingVideoRendition=Y.prototype.Ia;
29
- Y.prototype.getTextRendition=Y.prototype.za;Y.prototype.getAudioRendition=Y.prototype.xa;Y.prototype.getVideoRendition=Y.prototype.fa;Y.prototype.getTextTracks=Y.prototype.ea;Y.prototype.getAudioTracks=Y.prototype.getAudioTracks;Y.prototype.getVideoTracks=Y.prototype.getVideoTracks;var sI=class extends _.zn{constructor(a,b,c,d){super();this.m=new _.O(_.pc);this.T=a;this.w=new _.rh(b);this.S=c;this.W=d;this.h=this.J=_.Wh();this.D=[];this.C=0;this.K=new _.zl;this.H=this.o=this.a=null;this.B=this.A=!1;this.aa="";this.ga=1E6;this.g=new Y;this.g.j(this);this.j=new UI(this);this.I=new _.cn;this.f=null;this.F=new Set;this.N=this.Qa.bind(this);this.ca=this.Ta.bind(this);this.V=this.Sa.bind(this);this.R=this.Ra.bind(this);this.L=null;window.cast||Object.defineProperty(window,"cast",
30
- {get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{kI(!0)},0)}});jI(this);iI.add(this)}init(a,b){this.h=this.J=b}unload(){return new Promise((a,b)=>{this.g&&this.g.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}destroy(){return _.v(function*(){})}Ac(a){this.L=a}Rb(){return this.A}Ya(){return this.B}jd(){return this.aa}sendMessage(a,b){const c=this;return _.v(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
31
- if(e)try{yield e.sendMessage(a,$H(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.v(function*(){if(!a.Rb())throw a.m.warn(SH),new _.H(1,8,8001,void 0);if(!lI)throw a.m.warn(QH),new _.H(1,8,8002,void 0);if(a.Ya())throw a.m.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield nI(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
32
- b;throw new _.H(1,8,8E3,c);}})}dd(){this.Ya()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Qc&&this.F.add(a)}removeMessageListener(a){typeof a===_.Qc&&this.F.delete(a)}play(){return this.isEnded()?pI(this,!0):new Promise((a,b)=>{if(!this.a)return b(PH);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(PH);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
33
- _.rk}seek(a){return this.isEnded()?pI(this,!1,a):new Promise((b,c)=>{this.a||c(PH);this.o.isPlayingBreak&&c(NH);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.ue));this.a.seek(d,()=>{this.trigger(new _.F(_.te));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){return this.a&&this.a.media&&typeof this.a.media.duration===_.p?this.a.media.duration:0}setDrmCustomDataModifier(){}setCdnErrorCallback(){}getPlaybackRate(){return this.a&&this.a.playbackRate||
34
- 0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(YH,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&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(){return this.a&&
35
- this.a.media.startAbsoluteTime||0}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.go}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?aI(this.a.customData.stats):_.jk()}isLive(){return-1===this.getDuration()}load(a){const b=this;return _.v(function*(){if(b.Rb())if(lI){b.D=_.Fk(a);
36
- _.Zh(a)&&(b.h=_.Yh(b.J,a));var c=b.D[b.C];yield oI(b,{source:c,isLive:c.isLive,autoplay:b.h.autoplay,Ea:b.h,tb:c.tb,audioMimeType:c.audioMimeType})}else b.m.warn(QH);else b.m.warn(SH)})}getBufferInfo(){return new _.yn}getTrackManager(){return this.g}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.C}setSourceIndex(a){this.C=a}getLoadedSource(){return this.D[this.C]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.m.warn(RH)}onError(a){if(a&&
37
- (this.trigger(new _.F(_.Oc,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.pc}canPlay(){return this.Rb()?2:0}Kd(a){this.f=a}Zc(){this.f=null}Rc(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});this.f.title=a}Jd(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});this.f.images=[{url:a}]}Hd(a){this.f||(this.f={});this.f.metadataType=chrome.cast.media.MetadataType.MUSIC_TRACK;this.f.artist=a}Ld(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});
38
- this.f.releaseDate=a}Qa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;lI=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.w.Od()}Ta(a){this.m.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.B=!0;rI(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.Ya()||(this.B=!0,
39
- rI(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Ya()&&this.a){const d=this.a.media;var b=this.g.ha(),c=this.g.ia();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:d.streamType===chrome.cast.media.StreamType.LIVE},currentTime:this.getPosition(),Ae:c,Wd:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(XH,this.R);this.B=
40
- !1;this.a=null;this.I.release();this.o=this.H=null}}Sa(a){this.m.debug("New media session",a.mediaSession);qI(this,a.mediaSession)}Ra(a,b){if(a===XH&&0<this.F.size){const c=aI(b);this.F.forEach(d=>d(c))}}na(a){this.trigger(new _.F(_.me,{currentTime:a.value}))}ua(a){const b=this;return _.v(function*(){let c=null;const d=yield bI(a,[_.ke,_.Nb],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ga++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
41
- d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};sI.prototype.getTextDisplayer=sI.prototype.getTextDisplayer;sI.prototype.getNetworkEngine=sI.prototype.getNetworkEngine;sI.prototype.setNetworkEngine=sI.prototype.setNetworkEngine;var lI=!1,iI=new Set;window.__onGCastApiAvailable=kI;var VI=class extends _.zn{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Qc?c:(d,e)=>{this.f&&d!==_.rk&&d!==_.zk&&this.f.load(e)};this.a=uI(this);this.g=new _.O(UH);this.addDelegate(this.f)}destroy(){const a=this;return _.v(function*(){a.a&&(yield mI(a.a),a.a=null);a.removeDelegate(a.f)})}Yc(){return!!this.a&&this.a.Rb()&&lI}Ya(){return!!this.a&&this.a.Ya()}jd(){return this.a?this.a.jd():""}Ac(a){this.a&&this.a.Ac(a)}cast(a){const b=this;return _.v(function*(){if(b.a){var c,d=null;
42
- if(c=b.f.getLoadedSource()){var e=b.f.getTrackManager();d=e.getVideoTracks()[0];let f,g;d&&d.mimeType&&(f=d.mimeType);d=b.f.getConfiguration();const h=e.ha();h&&(h.mimeType&&(g=h.mimeType),h.language&&(d.preferredAudioLanguage=h.language),h.roles.length&&(d.preferredAudioRole=h.roles[0]));if(e=e.ia())e.language&&(d.preferredTextLanguage=e.language),e.roles.length&&(d.preferredTextRole=e.roles[0]);e=c&&typeof c.isLive===_.Zb?c.isLive:b.f.isLive();d={source:c,isLive:e,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-
43
- 1,0),tb:f,audioMimeType:g,Ea:d}}c=d;try{yield b.a.cast(),b.f&&b.a&&(yield tI(b),b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield oI(b.a,c))))}catch(f){b.g.error("Error while trying to cast",f),c=new _.F(_.Oc,{detail:f}),b.trigger(c)}}})}dd(){this.a&&this.a.dd()}Oe(a){const b=this;return _.v(function*(){a!==b.h&&(b.h=a,b.a&&(yield mI(b.a)),b.a=uI(b))})}sendMessage(a){const b=this;return _.v(function*(){b.a?yield b.a.sendMessage(XH,a):b.g.warn(TH)})}addMessageListener(a){this.a?
44
- this.a.addMessageListener(a):this.g.warn(TH)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(TH)}Kd(a){this.a&&this.a.Kd(a)}Zc(){this.a&&this.a.Zc()}Rc(a){this.a&&this.a.Rc(a)}Jd(a){this.a&&this.a.Jd(a)}Hd(a){this.a&&this.a.Hd(a)}Ld(a){this.a&&this.a.Ld(a)}};_.x(UH,VI);VI.prototype.setContentReleaseDate=VI.prototype.Ld;VI.prototype.setContentArtist=VI.prototype.Hd;VI.prototype.setContentImage=VI.prototype.Jd;VI.prototype.setContentTitle=VI.prototype.Rc;
45
- VI.prototype.clearContentMetadata=VI.prototype.Zc;VI.prototype.setContentMetadata=VI.prototype.Kd;VI.prototype.removeMessageListener=VI.prototype.removeMessageListener;VI.prototype.addMessageListener=VI.prototype.addMessageListener;VI.prototype.sendMessage=VI.prototype.sendMessage;VI.prototype.changeReceiverId=VI.prototype.Oe;VI.prototype.forceDisconnect=VI.prototype.dd;VI.prototype.cast=VI.prototype.cast;VI.prototype.setPlayerConfigInterceptor=VI.prototype.Ac;VI.prototype.getReceiverName=VI.prototype.jd;
46
- VI.prototype.isCasting=VI.prototype.Ya;VI.prototype.canCast=VI.prototype.Yc;VI.prototype.destroy=VI.prototype.destroy;var WI=class extends TI{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.W.bind(this);this.K=this.V.bind(this);this.J=this.T.bind(this);this.L=this.ga.bind(this);this.F=this.ca.bind(this);this.D=this.U.bind(this);this.g=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var dI="Cannot seek during ads playout.",eI="Cannot switch track",fI="Media session does not exist.",gI="No receivers available",hI="Reset ABR functionality not available on cast.",iI="SDK not yet ready",jI="Sender is destroyed.",kI="clpp.cast.CastProxy",lI="clpp.cast.Player",mI="clpp.cast.Receiver",nI="urn:x-cast:castlabs",oI="urn:x-cast:com.google.cast.media",pI=function(a){return _.v(function*(){yield _.gm(a,_.Ad);yield _.gm(a,_.zd)})},qI=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.Vc){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.wd?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.p?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},rI=function(a){if(typeof a!==_.je)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},sI=function(a,b,c,d){return _.v(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=_.Jg(d,a.mimeType,g);f&&g&&(h=_.Cg(a.url),(h=yield c.fetch(h).O)&&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})},tI=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 _.Ge:return d.FMP4;case _.Fe:return b===_.J?d.MPEG2_TS:c.TS;case _.Wb:return c.AAC;case _.Xb:return c.AC3;case _.Yb:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Zb:return c.FMP4}},vI=function(a){a=void 0===a?uI: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}},wI=function(a,b){return a.g.filter(c=>c.type===b)},yI=function(a,b){const c=xI(a);return wI(a,b).find(d=>c.includes(d.id))||null},AI=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.H){const e=a.ia();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;zI(a,b)},e=>{a.f[b]=null;a.h.debug(eI,e)})}else b===_.H&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{zI(a,b)},e=>{a.h.debug(eI,e)}))},xI=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},zI=function(a,b){b===_.I?a.a.trigger(new _.B(_.ah)):b===_.H&&a.a.trigger(new _.B(_.bh))},DI=function(a){if(a)for(const b of BI)CI(b)},CI=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.T.length){a.w=!0;a.o.Qd();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ca);EI&&a.o.$(.02)}},FI=function(a){return _.v(function*(){BI.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ca)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.h&&(b.push(a.h.destroy()),a.h=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.W=null})},GI=function(a){return _.v(function*(){a.$a()||(yield cast.framework.CastContext.getInstance().requestSession())})},II=function(a,b,c){c=
9
+ void 0===c?0:c;return _.v(function*(){var d=a.f.ia();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.ha())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield HI(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Gd:a.getPresentationStartTime(),autoplay:b,Ea:a.g})})},HI=function(a,b){return _.v(function*(){var c=chrome.cast.media.StreamType;yield GI(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=tI(b.ub,_.J);e.hlsSegmentFormat=tI(c,_.I);b.Ea&&(a.L&&(c=yield Promise.resolve(a.L(b.Ea)))&&(b.Ea=c),a.g=b.Ea,a.C=_.gl(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Ea.remoteTextTracks&&(c=yield Promise.all(b.Ea.remoteTextTracks.map(a.ua.bind(a))),e.tracks=c.filter(k=>k),b.Ea.remoteTextTracks=void 0),delete b.Ea.autoplay,b.Ea.startTime=null,e.customData={playerConfiguration:qI(b.Ea)});c=a.Va()||{};
11
+ var f=JI(c.metadataType),g;typeof b.Gd===_.p&&(g={metadataType:f,sectionStartAbsoluteTime:b.Gd});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=KI(c);if(g=LI(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.cc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.p&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},LI=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(MI);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=vI(MI[b]);return Object.assign(b,a)},JI=function(a){var b=void 0===b?uI:b;return Object.values(MI).includes(a)?a:b},KI=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},OI=function(a,b){NI(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(nI,a.R)},NI=function(a,b){b!==a.a&&(a.a=b,a.a&&(a.H.release(),a.F=null,a.m=null,a.m=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.m),
13
+ a.H.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.na.bind(a)),a.f&&a.f.load(),a.h&&a.h.init(),a.trigger(new _.B(_.id))))},RI=function(a){return new PI(a.h,()=>{a.trigger(new _.B(_.lc))},(b,c)=>{{const d=a.f.getConfiguration();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.Yd&&(d.preferredAudioLanguage=c.Yd);c.Ce&&(d.preferredTextLanguage=c.Ce);_.im(a.f,null);a.trigger(new _.B("castingended"));
14
+ a.j(b,d)}},()=>QI(a))},QI=function(a){return _.v(function*(){a.trigger(new _.B(_.kc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.im(a.f,a.a))})},UI=function(a,b,c){return _.v(function*(){var d=b.adTagUrl;if(d)try{SI=!1;const e=_.Cg(d),f=yield c.fetch(e).O;if(f&&f.data){const g=_.mg(f.data),h=(new DOMParser).parseFromString(g,_.qe);if(h.getElementsByTagName("vmap:VMAP").length)_.z("VMAP detected."),a.vmapAdsRequest=TI(g);else if(h.getElementsByTagName("VAST").length){_.z("VAST detected.");{d=g;
15
+ const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=TI(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.z("Unsupported schema."),SI=!0}}catch(e){_.z("Failed to fetch an ad",e),SI=!0}})},TI=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},VI=function(a,b){b=new _.G(1,10,10003,{errorType:b});a.l.onError(b)},WI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},
16
+ YI=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=XI(a,c))&&(d={ad:c});a.l.trigger(new _.B(b,d))}},XI=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.je&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.je&&(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,
17
+ h)=>g.position-h.position).findIndex(g=>g===e)));c=new X(d,e,b.index,b.total,f)}return c},ZI=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},$I=function(a){const b=a.dashTimedMetadata;let c=_.ye;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.we)?_.Nf:_.Lf,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,
18
+ value:b&&b.value||"",eventElement:b&&b.eventElement}},aJ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},cJ=function(a){a.a=aJ().getTextTracksManager();const b=a.a.getTracks();a.j=bJ(_.H,b)},bJ=function(a,b){const c=[];for(const d of b)b=new _.$f(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=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||
19
+ b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Un(b.id,b)),c.push(b);return c},dJ=function(a,b,c,d){c=_.Pg(c).filter(g=>g);var e=!1;let f=[];b===_.I?f=a.getAudioTracks():b===_.H&&(f=a.ea());if(c=c.find(g=>{const h=_.Mg(g);return f.some(k=>{k=_.Mg(k.language||"");return _.Ng(h,k)})})){const g=_.Mg(c);c=f.filter(h=>{h=_.Mg(h.language||"");return _.Ng(g,h)});f=c.length?c:f;e=e||!!c.length}_.vg(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],
20
+ a.g.info("Will select track",e),b===_.I?a.la(e):b===_.H&&a.ta(e))},eJ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},hJ=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.Bi(d);if(e){var f=[_.Cc];_.gl(a)[0].type!==_.Sb&&f.unshift(_.Dc);d.preferredDrmSystem===_.Cc&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ga[g];
21
+ h?(c=g===_.Dc?cast.framework.ContentProtection.WIDEVINE:g===_.Cc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},fJ(b,h,a,c),gJ(b,h,a,c)):c()}else c()}else c()},fJ=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.Cg({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];
22
+ e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},gJ=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.v(function*(){const g=_.Dg(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},kJ=function(){return iJ||(iJ=new jJ)},lJ=function(){return cast.framework.CastReceiverContext.getInstance()},nJ=function(a,b){a.h.debug("Detected HLS, parsing");
23
+ var c=cast.framework.messages.HlsVideoSegmentFormat;a=lJ();var {hlsVideoSegmentFormat:d}=lJ().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Ge:_.Fe;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=mJ(f,_.ja),h=mJ(f,"RESOLUTION");let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},mJ=function(a,b){let c;
24
+ 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},pJ=function(a,b){let c=null;const d=oJ(a);d&&(c={ad:d});a.f.trigger(new _.B(b,c))},oJ=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=c.breakClipIds.length,f=0>=c.position?c.position:
25
+ 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 X(d,c,g,e,f)}return b},qJ=class{constructor(a,b){this.log=new _.O(b);this.f=a;this.m=null;this.h=_.$k;this.o=_.Ho;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.$k)}destroy(){this.m=this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.F&&this.a(_.Zk)}a(a){if(a!==this.h)if(this.h===_.Zk&&a!==
26
+ _.$k)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===_.Vk?(this.B=b,this.f.trigger(new _.B(_.hc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Vk&&this.f.trigger(new _.B(_.gc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.m&&_.Jk(this.m,this.h);this.f.trigger(new _.B(_.ge,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});
27
+ var uI=0,MI={GENERIC:uI,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var rJ=class extends qJ{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.g=null;this.A=this.D.bind(this)}init(){const a=this.f,b=a.a;b&&(this.g&&this.g.removeUpdateListener(this.A),this.g=b,this.g.addUpdateListener(this.A),this.w=a.m)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.v(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.m;b&&b.isPlayingBreak||super.a(a)}D(){if(this.g&&this.w&&
28
+ !this.w.isPlayingBreak)switch(this.g.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.g.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Sk);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Zk);break;default:this.a(_.$k)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.dl);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.bl);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Vk)}}};var Y=class extends _.P{constructor(){super();this.h=new _.O("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.J;break;case chrome.cast.media.TrackType.AUDIO:c=_.I;break;case chrome.cast.media.TrackType.TEXT:c=_.H}c=new _.$f(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
+ c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.Un(c.id,c));return c}):[],this.a.trigger(new _.B(_.Zn)))}destroy(){this.a=null}getVideoTracks(){return wI(this,_.J)}getAudioTracks(){return wI(this,_.I)}ea(){return wI(this,_.H)}fa(){const a=this.Aa();return a?a.renditions[0]:null}xa(){const a=this.ha();return a?a.renditions[0]:null}za(){const a=this.ia();return a?a.renditions[0]:
30
+ null}Ja(){return this.f[_.J]||null}Wa(){return this.f[_.I]||null}Xa(){return this.f[_.H]||null}Aa(){return yI(this,_.J)}ha(){return yI(this,_.I)}ia(){return yI(this,_.H)}Pa(a){AI(this,_.J,a)}la(a){AI(this,_.I,a)}ta(a){AI(this,_.H,a)}Oa(a){this.Pa(a&&a.track)}cb(a){this.la(a&&a.track)}eb(a){this.ta(a&&a.track)}addTextTrack(){return _.v(function*(){})}ja(){return!0}};Y.prototype.isAbrEnabled=Y.prototype.ja;Y.prototype.addTextTrack=Y.prototype.addTextTrack;Y.prototype.setTextRendition=Y.prototype.eb;
31
+ Y.prototype.setAudioRendition=Y.prototype.cb;Y.prototype.setVideoRendition=Y.prototype.Oa;Y.prototype.setTextTrack=Y.prototype.ta;Y.prototype.setAudioTrack=Y.prototype.la;Y.prototype.setVideoTrack=Y.prototype.Pa;Y.prototype.getTextTrack=Y.prototype.ia;Y.prototype.getAudioTrack=Y.prototype.ha;Y.prototype.getVideoTrack=Y.prototype.Aa;Y.prototype.getLoadingTextRendition=Y.prototype.Xa;Y.prototype.getLoadingAudioRendition=Y.prototype.Wa;Y.prototype.getLoadingVideoRendition=Y.prototype.Ja;
32
+ Y.prototype.getTextRendition=Y.prototype.za;Y.prototype.getAudioRendition=Y.prototype.xa;Y.prototype.getVideoRendition=Y.prototype.fa;Y.prototype.getTextTracks=Y.prototype.ea;Y.prototype.getAudioTracks=Y.prototype.getAudioTracks;Y.prototype.getVideoTracks=Y.prototype.getVideoTracks;var PI=class extends _.ao{constructor(a,b,c,d){super();this.j=new _.O(_.tc);this.T=a;this.o=new _.zh(b);this.S=c;this.W=d;this.g=this.I=_.di();this.C=[];this.B=0;this.K=new _.$l;this.F=this.m=this.a=null;this.A=this.w=!1;this.aa="";this.ga=1E6;this.f=new Y;this.f.initialize(this);this.h=new rJ(this);this.H=new _.Fn;this.J=null;this.D=new Set;this.N=this.Ra.bind(this);this.ca=this.Ua.bind(this);this.V=this.Ta.bind(this);this.R=this.Sa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
33
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{DI(!0)},0)}});CI(this);BI.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.h&&this.h.release()})}destroy(){return _.v(function*(){})}Cc(a){this.L=a}Sb(){return this.w}$a(){return this.A}kd(){return this.aa}sendMessage(a,b){const c=this;return _.v(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
+ if(e)try{yield e.sendMessage(a,qI(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 _.v(function*(){if(!a.Sb())throw a.j.warn(iI),new _.G(1,8,8001,void 0);if(!EI)throw a.j.warn(gI),new _.G(1,8,8002,void 0);if(a.$a())throw a.j.warn("Already casting"),new _.G(1,8,8003,void 0);try{yield GI(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
35
+ b;throw new _.G(1,8,8E3,c);}})}ed(){this.$a()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Vc&&this.D.add(a)}removeMessageListener(a){typeof a===_.Vc&&this.D.delete(a)}play(){return this.isEnded()?II(this,!0):new Promise((a,b)=>{if(!this.a)return b(fI);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(fI);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
+ _.Sk}seek(a){return this.isEnded()?II(this,!1,a):new Promise((b,c)=>{this.a||c(fI);this.m.isPlayingBreak&&c(dI);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.B(_.Be));this.a.seek(d,()=>{this.trigger(new _.B(_.Ae));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.p?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}getPlaybackRate(){return this.a&&
37
+ this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(oI,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&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||
38
+ !this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.p?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.h?this.h.getState():_.Ho}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?rI(this.a.customData.stats):_.Nk()}isLive(){return Infinity===
39
+ this.getDuration()}load(a){const b=this;return _.v(function*(){if(b.Sb())if(EI){b.C=_.gl(a);_.gi(a)&&(b.g=_.fi(b.I,a));var c=b.C[b.B];yield HI(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Ea:b.g,ub:c.ub,audioMimeType:c.audioMimeType})}else b.j.warn(gI);else b.j.warn(iI)})}getBufferInfo(){return new _.$n}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
+ a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.j.warn(hI)}onError(a){if(a&&(this.trigger(new _.B(_.Tc,{detail:a})),this.h))this.h.onError(a)}namespace(){return _.tc}canPlay(){return this.Sb()?2:0}Va(){return this.J}$b(a){this.J=LI(a)}$c(){this.J=null}Nd(a){const b=this.Va()||{};a={metadataType:JI(b.metadataType),title:a};this.$b(Object.assign({},b,a))}Ld(a){const b=this.Va()||{},c=JI(b.metadataType);a=new chrome.cast.Image(a);
41
+ this.$b(Object.assign({},b,{metadataType:c,images:[a]}))}Kd(a){const b=this.Va()||{};this.$b(Object.assign({},b,{metadataType:3,artist:a}))}Md(a){const b=this.Va()||{};a={metadataType:JI(b.metadataType),releaseDate:a};this.$b(Object.assign({},b,a))}Ra(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;EI=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Qd()}Ua(a){this.j.debug(`state: ${a.sessionState}, details:`,
42
+ a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;OI(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.$a()||(this.A=!0,OI(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.$a()&&this.a){const d=this.a.media;var b=this.f.ha(),c=this.f.ia();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:this.getPosition(),
43
+ Ce:c,Yd:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(nI,this.R);this.A=!1;this.a=null;this.H.release();this.m=this.F=null}}Ta(a){this.j.debug("New media session",a.mediaSession);NI(this,a.mediaSession)}Sa(a,b){if(a===nI&&0<this.D.size){const c=rI(b);this.D.forEach(d=>d(c))}}na(){this.trigger(new _.B(_.re))}ua(a){const b=this;return _.v(function*(){let c=null;const d=yield sI(a,[_.pe,_.Rb],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ga++,
44
+ chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};PI.prototype.getTextDisplayer=PI.prototype.getTextDisplayer;PI.prototype.getNetworkEngine=PI.prototype.getNetworkEngine;PI.prototype.setNetworkEngine=PI.prototype.setNetworkEngine;var EI=!1,BI=new Set;window.__onGCastApiAvailable=DI;var sJ=class extends _.ao{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Vc?c:(d,e)=>{this.f&&d!==_.Sk&&d!==_.$k&&this.f.load(e)};this.a=RI(this);this.g=new _.O(kI);this.addDelegate(this.f)}destroy(){const a=this;return _.v(function*(){a.a&&(yield FI(a.a),a.a=null);a.removeDelegate(a.f)})}Zc(){return!!this.a&&this.a.Sb()&&EI}$a(){return!!this.a&&this.a.$a()}kd(){return this.a?this.a.kd():""}Cc(a){this.a&&this.a.Cc(a)}cast(a){const b=this;return _.v(function*(){if(b.a){var c,d=null;
45
+ if(c=b.f.getLoadedSource()){var e=b.f.getTrackManager();d=e.getVideoTracks()[0];let f,g;d&&d.mimeType&&(f=d.mimeType);d=b.f.getConfiguration();const h=e.ha();h&&(h.mimeType&&(g=h.mimeType),h.language&&(d.preferredAudioLanguage=h.language),h.roles.length&&(d.preferredAudioRole=h.roles[0]));if(e=e.ia())e.language&&(d.preferredTextLanguage=e.language),e.roles.length&&(d.preferredTextRole=e.roles[0]);e=c&&typeof c.isLive===_.cc?c.isLive:b.f.isLive();d={source:c,isLive:e,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-
46
+ 1,0),Gd:b.f.getPresentationStartTime(),ub:f,audioMimeType:g,Ea:d}}c=d;try{yield b.a.cast(),b.f&&b.a&&(yield QI(b),b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield HI(b.a,c))))}catch(f){b.g.error("Error while trying to cast",f),c=new _.B(_.Tc,{detail:f}),b.trigger(c)}}})}ed(){this.a&&this.a.ed()}Qe(a){const b=this;return _.v(function*(){a!==b.h&&(b.h=a,b.a&&(yield FI(b.a)),b.a=RI(b))})}sendMessage(a){const b=this;return _.v(function*(){b.a?yield b.a.sendMessage(nI,a):b.g.warn(jI)})}addMessageListener(a){this.a?
47
+ this.a.addMessageListener(a):this.g.warn(jI)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(jI)}Va(){return this.a&&this.a.Va()}$b(a){this.a&&this.a.$b(a)}$c(){this.a&&this.a.$c()}Nd(a){this.a&&this.a.Nd(a)}Ld(a){this.a&&this.a.Ld(a)}Kd(a){this.a&&this.a.Kd(a)}Md(a){this.a&&this.a.Md(a)}};_.x(kI,sJ);sJ.prototype.setContentReleaseDate=sJ.prototype.Md;sJ.prototype.setContentArtist=sJ.prototype.Kd;sJ.prototype.setContentImage=sJ.prototype.Ld;
48
+ sJ.prototype.setContentTitle=sJ.prototype.Nd;sJ.prototype.clearContentMetadata=sJ.prototype.$c;sJ.prototype.setContentMetadata=sJ.prototype.$b;sJ.prototype.getContentMetadata=sJ.prototype.Va;sJ.prototype.removeMessageListener=sJ.prototype.removeMessageListener;sJ.prototype.addMessageListener=sJ.prototype.addMessageListener;sJ.prototype.sendMessage=sJ.prototype.sendMessage;sJ.prototype.changeReceiverId=sJ.prototype.Qe;sJ.prototype.forceDisconnect=sJ.prototype.ed;sJ.prototype.cast=sJ.prototype.cast;
49
+ sJ.prototype.setPlayerConfigInterceptor=sJ.prototype.Cc;sJ.prototype.getReceiverName=sJ.prototype.kd;sJ.prototype.isCasting=sJ.prototype.$a;sJ.prototype.canCast=sJ.prototype.Zc;sJ.prototype.destroy=sJ.prototype.destroy;var tJ=class extends qJ{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.W.bind(this);this.K=this.V.bind(this);this.J=this.T.bind(this);this.L=this.ga.bind(this);this.F=this.ca.bind(this);this.D=this.U.bind(this);this.g=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
47
50
  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.F);b.addEventListener(a.ERROR,this.D);b.addEventListener(a.BITRATE_CHANGED,this.g)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.v(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
48
- 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.F);d.removeEventListener(c.ERROR,a.D);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}S(){this.f.trigger(new _.F(_.Jd));this.a(_.Ck)}R(){this.a(_.Bk)}aa(){this.a(_.rk)}W(a){a.isBuffering?
49
- this.a(_.uk):(a=this.f.isPaused()?_.Bk:_.Ck,this.a(a))}V(){this.j=1;this.f.trigger(new _.F(_.ue))}T(){this.f.trigger(new _.F(_.te))}ga(){this.j=2}ca(){this.a(_.Ak)}N(a){const b=this.f.getStats();this.f.trigger(new _.F(_.Yb,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.F(_.Oc,{detail:a}));this.a(_.yk)}};var XI=class{constructor(a){this.Ib=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(vI(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(vI(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>wI(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=
50
- _.If;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Kf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Lf}b&&this.Ib(new _.F(b,{detail:wI(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Ib(new _.F(_.If,{detail:b}))}};var Z=class extends _.P{constructor(){super();this.g=new _.O("clpp.cast.TrackManager");this.l=null;this.w=1E9;this.h=[];this.m=[];this.o=this.A.bind(this);this.a=this.f=null}j(a){this.l=a;xI().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.o)}release(){this.h=[];this.m=[];this.a=this.f=null}load(){}destroy(){this.l=null;xI().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.o)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ea(){return this.m}fa(){return null}xa(){const a=
51
- this.ha();return a&&a.renditions[0]}za(){const a=this.ia();return a&&a.renditions[0]}Ia(){return null}Ua(){return null}Va(){return null}Aa(){return null}ha(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.p&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ia(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.p&&(b=b.toString(),a=this.ea().find(c=>c.id===b)||null)}return a}Na(){this.g.warn("Video tracks unavailable on Cast")}la(a){a&&this.f&&
52
- this.f.setActiveById(+a.id)}ta(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ma(){this.g.warn("Video renditions unavailable on Cast")}bb(a){this.la(a&&a.track)}cb(a){this.ta(a&&a.track)}addTextTrack(a){const b=this;return _.v(function*(){var c=b.l.getConfiguration();if((c=yield bI(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.w++,cast.framework.messages.TrackType.TEXT);d.isInBand=!1;d.language=
53
- 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]),zI(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ja(){return!0}A(){this.f=xI().getAudioTracksManager();var a=this.f.getTracks();this.h=yI(_.J,a);zI(this);a=this.l.getConfiguration();AI(this,_.J,a.preferredAudioLanguage,a.preferredAudioRole);AI(this,_.I,a.preferredTextLanguage,a.preferredTextRole)}};Z.prototype.isAbrEnabled=Z.prototype.ja;
54
- Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.cb;Z.prototype.setAudioRendition=Z.prototype.bb;Z.prototype.setVideoRendition=Z.prototype.Ma;Z.prototype.setTextTrack=Z.prototype.ta;Z.prototype.setAudioTrack=Z.prototype.la;Z.prototype.setVideoTrack=Z.prototype.Na;Z.prototype.getTextTrack=Z.prototype.ia;Z.prototype.getAudioTrack=Z.prototype.ha;Z.prototype.getVideoTrack=Z.prototype.Aa;Z.prototype.getLoadingTextRendition=Z.prototype.Va;
55
- Z.prototype.getLoadingAudioRendition=Z.prototype.Ua;Z.prototype.getLoadingVideoRendition=Z.prototype.Ia;Z.prototype.getTextRendition=Z.prototype.za;Z.prototype.getAudioRendition=Z.prototype.xa;Z.prototype.getVideoRendition=Z.prototype.fa;Z.prototype.getTextTracks=Z.prototype.ea;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var YI=class extends _.zn{constructor(){super();this.C=new _.O(VH);this.g=this.o=_.Wh();this.w=null;this.j=-1;this.D=new _.zl;this.f=this.m=this.h=this.a=this.A=null;this.B=!1}init(a,b){this.A=a;b&&(this.g=this.o=b);a=BI();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.F.bind(this));this.a=new WI(this);this.a.init();this.h=new Z;this.h.j(this);this.m=new XI(c=>this.trigger(c));this.m.init()}unload(){const a=BI();a.getPlayerState()!==
56
- cast.framework.messages.PlayerState.IDLE&&a.stop();this.h&&this.h.release();this.m&&this.m.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.v(function*(){a.A=null;a.o=_.Wh();a.g=a.o;a.j=-1;a.w=null;a.a&&(yield a.a.destroy(),a.a=null);a.h&&(a.h.destroy(),a.h=null)})}play(){const a=BI();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");a.play();
57
- return Promise.resolve()}pause(){const a=BI();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return BI().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return BI().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=BI();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(NH);b.seek(a);return Promise.resolve()}getPosition(){return BI().getCurrentTimeSec()}getDuration(){return BI().getDurationSec()}getPlaybackRate(){return BI().getPlaybackRate()}setPlaybackRate(a){if(0<
58
- a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;BI().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||null}getLoadedSource(){const a=
59
- BI().getMediaInformation();if(a){var b=BI().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.w&&-1!==this.j?this.w[this.j]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Tf:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){const a=BI().getMediaInformation();return a?a.startAbsoluteTime||0:0}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=BI().getLiveSeekableRange();
60
- b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.go}getStats(){var a=_.jk();if(this.f){a=BI().getStats();this.f.m=a.estimatedBandwidth||NaN;this.f.A=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.j=a.width||NaN;b.f=c;b=this.f;c=typeof a.decodedFrames===_.p?a.decodedFrames:NaN;b.h=typeof a.droppedFrames===_.p?a.droppedFrames:NaN;b.g=c;a=this.f.getStats()}return a}isLive(){return-1===this.getDuration()}load(a){const b=
61
- this;return _.v(function*(){b.f=new _.eo;b.a.m=b.f.a;b.w=_.Fk(a);_.Zh(a)&&(b.g=_.Yh(b.o,a));if(b.B)b.B=!1;else{var c=b.w[b.j],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.p&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:$H(b.g),local:!0};yield BI().load(d)}})}getBufferInfo(){this.C.warn(_.ka);return new _.yn}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.A}setNetworkEngine(a){this.D=
62
- a}getNetworkEngine(){return this.D}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return VH}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.C.warn(RH)}onError(a){a=new _.F(_.Oc,{detail:a});this.trigger(a)}canPlay(){return _.Eh()?2:0}H(a){a.customData||(a.customData={});a.customData.stats=$H(this.getStats());return a}F(a,b){let c=null;a.media.customData&&(c=aI(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===
63
- _.p?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;EI(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}};YI.prototype.getTextDisplayer=YI.prototype.getTextDisplayer;YI.prototype.getNetworkEngine=YI.prototype.getNetworkEngine;YI.prototype.setNetworkEngine=YI.prototype.setNetworkEngine;var X=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.p?c:1;this.j=typeof d===_.p?d:1;this.g=typeof e===_.p?e:0}gb(){return"Google Cast Framework"}hb(){return cast.framework.VERSION}mb(){return 0}ba(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}Tb(){return!1}zb(){return this.a.clickThroughUrl||
64
- null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}jb(){return 0}ib(){return 0}Wa(){return 0}Ja(){switch(this.Ab()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Ab(){return this.f.position}Bb(){return this.h}lb(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;
65
- X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.lb;X.prototype.getPositionInSequence=X.prototype.Bb;X.prototype.getPodTimeOffset=X.prototype.Ab;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ja;X.prototype.getMediaBitrate=X.prototype.Wa;X.prototype.getMediaHeight=X.prototype.ib;X.prototype.getMediaWidth=X.prototype.jb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.zb;
66
- X.prototype.isBumper=X.prototype.Tb;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.ba;X.prototype.getTechnology=X.prototype.mb;
67
- X.prototype.getAdManagerVersion=X.prototype.hb;X.prototype.getAdManagerName=X.prototype.gb;var ZI=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Cb(){return!!this.a.find(a=>0===a.position)}Xa(){return!!this.a.find(a=>-1===a.position)}};ZI.prototype.hasPostroll=ZI.prototype.Xa;ZI.prototype.hasPreroll=ZI.prototype.Cb;ZI.prototype.getCuePoints=ZI.prototype.getCuePoints;var $I=class{constructor(a){this.l=a;this.a=null;this.g=this.h.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];JI().addEventListener(this.f,
68
- this.g)}load(){const a=this;return _.v(function*(){FI&&(FI=!1,II(a,0))})}start(){return _.v(function*(){JI().play()})}resume(){-1!==this.getPosition()&&JI().play()}pause(){-1!==this.getPosition()&&JI().pause()}skip(){}getVolume(){return this.l.getVolume()||0}setVolume(a){this.l.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.p?a:-1}dispose(){const a=this;return _.v(function*(){JI().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
69
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=JI().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.F(_.Db,{adsTimeline:new ZI(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:LI(this,_.tb,a);break;case cast.framework.events.EventType.BREAK_STARTED:LI(this,_.mb,a);break;case cast.framework.events.EventType.BREAK_ENDED:LI(this,_.nb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:LI(this,_.zb,a);
70
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(LI(this,_.yb,a),LI(this,_.Ab,a)):a.endedReason===b.STOPPED?LI(this,_.Ab,a):a.endedReason===b.END_OF_STREAM?(LI(this,_.qb,a),LI(this,_.Ab,a)):a.endedReason===b.ERROR&&II(this,1);break;case cast.framework.events.EventType.PLAYING:LI(this,_.xb,a);break;case cast.framework.events.EventType.PAUSE:LI(this,_.vb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?LI(this,_.ob,a):LI(this,_.xb,a)}}};
71
- $I.prototype.getPosition=$I.prototype.getPosition;$I.prototype.setVolume=$I.prototype.setVolume;$I.prototype.getVolume=$I.prototype.getVolume;$I.prototype.skip=$I.prototype.skip;$I.prototype.pause=$I.prototype.pause;$I.prototype.resume=$I.prototype.resume;var FI=!1;var NI=class{constructor(){this.a=!1;this.h=new _.O(WH);this.f=this.l=null;this.g=new Set;this.A=this.F.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.cn;this.m=null}init(a){a&&(this.f=new YI,_.Il(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.v(function*(){b.l&&b.l.getState()!==_.zk&&(yield ZH(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=cast.framework.CastReceiverContext.getInstance(),b=a.getPlayerManager(),
72
- c=new cast.framework.CastReceiverOptions;c.customNamespaces={};c.customNamespaces[XH]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.D.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};c.playbackConfig=d;if(d=this.l&&this.l.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,
73
- this.A);a.start(c);a.addCustomMessageListener(XH,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=cast.framework.CastReceiverContext.getInstance();a.getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(XH,this.w);a.stop();this.l=this.f=null}}Ac(a){this.j=a}yf(a){this.m=a}on(a,b){cast.framework.CastReceiverContext.getInstance().addEventListener(a,b)}off(a,b){cast.framework.CastReceiverContext.getInstance().removeEventListener(a,
74
- b)}addMessageListener(a){typeof a===_.Qc&&this.g.add(a)}removeMessageListener(a){typeof a===_.Qc&&this.g.delete(a)}sendMessage(a,b){cast.framework.CastReceiverContext.getInstance().sendCustomMessage(XH,b,$H(a))}Rb(){return this.a}cf(){let a=null;const b=cast.framework.CastReceiverContext.getInstance().getPlayerManager().getMediaInformation();b&&b.metadata&&(a=b.metadata);return _.bf(a)}D(a){a=a.trim();if(a.startsWith("#EXTM3U"))return QI(this,a);try{var b=(new DOMParser).parseFromString(a,_.le)}catch(k){return a}var c=
75
- b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=cast.framework.CastReceiverContext.getInstance();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.u||g===_.Rb){g=e[f].getAttribute(_.jd);var h=e[f].getElementsByTagName(_.Va);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.jd)||g,m=h[k].getAttribute(_.tc);let n=h[k].getAttribute(_.Oe)||
76
- void 0,q=h[k].getAttribute(_.Rc)||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(_.Va).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.cb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=cast.framework.CastReceiverContext.getInstance();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===
77
- _.u){e=c[d].getElementsByTagName(_.Ta);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ja)||void 0,h=e[f].getAttribute(_.Ha)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Be,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ta).length||a.removeChild(c[d])}a=(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.v(function*(){var c;a.media.customData&&(c=aI(a.media.customData.playerConfiguration));b.l&&c&&(b.j&&(c=(yield Promise.resolve(b.j(c)))||
78
- c),c.ima&&(yield HI(a.media,c.ima,b.l.getNetworkEngine())),typeof c.startTime===_.p&&c.startTime!==a.currentTime&&(a.currentTime=c.startTime),a.media.customData.local||(b.f.B=!0,yield _.Pl(b.l,c),yield _.Ql(b.l),c=b.l.getLoadedSource(),a.media.contentId=c.url,a.media.contentType=c.type,c.tb&&(a.media.hlsVideoSegmentFormat=cI(c.tb,_.K)),c.audioMimeType&&(a.media.hlsSegmentFormat=cI(c.audioMimeType,_.J))),void 0===a.autoplay&&(a.autoplay=b.l.getConfiguration().autoplay));b.m&&(c=yield Promise.resolve(b.m(a)))&&
79
- (a=c);return a})}F(a){!this.l||a.media.customData&&a.media.customData.local||_.Sl(this.l)}B(a){if(0<this.g.size){const b=aI(a.data);this.g.forEach(c=>c(b))}}};_.x(WH,NI);NI.prototype.getContentMetadata=NI.prototype.cf;NI.prototype.isApiReady=NI.prototype.Rb;NI.prototype.sendMessage=NI.prototype.sendMessage;NI.prototype.removeMessageListener=NI.prototype.removeMessageListener;NI.prototype.addMessageListener=NI.prototype.addMessageListener;NI.prototype.off=NI.prototype.off;NI.prototype.on=NI.prototype.on;
80
- NI.prototype.setLoadRequestDataInterceptor=NI.prototype.yf;NI.prototype.setPlayerConfigInterceptor=NI.prototype.Ac;NI.prototype.stop=NI.prototype.stop;NI.prototype.start=NI.prototype.start;NI.prototype.init=NI.prototype.init;NI.getInstance=OI;var MI=null;var aJ=class{constructor(a){this.f=a;this.a=null;this.g=new _.cn;this.h=[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 _.v(function*(){a.a=a.f.o;if(a.a){const b=a.a.controller,c=a.j.bind(a);for(const d of a.h)a.g.on(b,d,c)}})}start(){return _.v(function*(){})}resume(){this.a&&
81
- 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(YH,{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===_.p&&(a=b));return a}dispose(){const a=this;
82
- return _.v(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.Db,{adsTimeline:new ZI(a.breaks)})));break;case "isPlayingBreak":a.value?SI(this,_.mb):(SI(this,_.qb),SI(this,_.Ab),SI(this,_.nb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(SI(this,_.qb),SI(this,_.Ab)),SI(this,_.zb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?SI(this,_.vb):SI(this,_.xb))}}};aJ.prototype.getPosition=aJ.prototype.getPosition;
83
- aJ.prototype.setVolume=aJ.prototype.setVolume;aJ.prototype.getVolume=aJ.prototype.getVolume;aJ.prototype.skip=aJ.prototype.skip;aJ.prototype.pause=aJ.prototype.pause;aJ.prototype.resume=aJ.prototype.resume;var bJ=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}Y(a,b){return a.namespace()!==_.pc?!1:!(!b||!b.ima)}create(a){return new aJ(a.a)}};bJ.prototype.create=bJ.prototype.create;bJ.prototype.isSupported=bJ.prototype.Y;bJ.prototype.name=bJ.prototype.name;_.Sk(new bJ);var cJ=class{name(){return"clpp.cast.ads.AdsManagerFactory"}Y(a,b){return OI().Rb()?!(!b||!b.ima):!1}create(a){return new $I(a)}};cJ.prototype.create=cJ.prototype.create;cJ.prototype.isSupported=cJ.prototype.Y;cJ.prototype.name=cJ.prototype.name;_.Sk(new cJ);};f.call(g, window);
51
+ 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.F);d.removeEventListener(c.ERROR,a.D);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}S(){this.f.trigger(new _.B(_.Nd));this.a(_.dl)}R(){this.a(_.bl)}aa(){this.a(_.Sk)}W(a){a.isBuffering?
52
+ this.a(_.Vk):(a=this.f.isPaused()?_.bl:_.dl,this.a(a))}V(){this.j=1;this.f.trigger(new _.B(_.Be))}T(){this.f.trigger(new _.B(_.Ae))}ga(){this.j=2}ca(){this.a(_.al)}N(a){const b=this.f.getStats();this.f.trigger(new _.B(_.bc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.G(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.B(_.Tc,{detail:a}));this.a(_.Zk)}};var X=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.p?c:1;this.j=typeof d===_.p?d:1;this.g=typeof e===_.p?e:0}hb(){return"Google Cast Framework"}ib(){return cast.framework.VERSION}nb(){return 0}ba(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}Ub(){return!1}Ab(){return this.a.clickThroughUrl||
53
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}kb(){return 0}jb(){return 0}Ya(){return 0}Ka(){switch(this.Bb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Bb(){return this.f.position}Cb(){return this.h}mb(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;
54
+ X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.mb;X.prototype.getPositionInSequence=X.prototype.Cb;X.prototype.getPodTimeOffset=X.prototype.Bb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ka;X.prototype.getMediaBitrate=X.prototype.Ya;X.prototype.getMediaHeight=X.prototype.jb;X.prototype.getMediaWidth=X.prototype.kb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Ab;
55
+ X.prototype.isBumper=X.prototype.Ub;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.ba;X.prototype.getTechnology=X.prototype.nb;
56
+ X.prototype.getAdManagerVersion=X.prototype.ib;X.prototype.getAdManagerName=X.prototype.hb;var uJ=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Db(){return!!this.a.find(a=>0===a.position)}Za(){return!!this.a.find(a=>-1===a.position)}};uJ.prototype.hasPostroll=uJ.prototype.Za;uJ.prototype.hasPreroll=uJ.prototype.Db;uJ.prototype.getCuePoints=uJ.prototype.getCuePoints;var vJ=class{constructor(a){this.l=a;this.a=null;this.g=this.h.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];WI().addEventListener(this.f,
57
+ this.g)}load(){const a=this;return _.v(function*(){SI&&(SI=!1,VI(a,0))})}start(){return _.v(function*(){WI().play()})}resume(){-1!==this.getPosition()&&WI().play()}pause(){-1!==this.getPosition()&&WI().pause()}skip(){}getVolume(){return this.l.getVolume()||0}setVolume(a){this.l.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.p?a:-1}dispose(){const a=this;return _.v(function*(){WI().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
58
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=WI().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.B(_.Hb,{adsTimeline:new uJ(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:YI(this,_.xb,a);break;case cast.framework.events.EventType.BREAK_STARTED:YI(this,_.qb,a);break;case cast.framework.events.EventType.BREAK_ENDED:YI(this,_.rb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:YI(this,_.Db,a);
59
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(YI(this,_.Cb,a),YI(this,_.Eb,a)):a.endedReason===b.STOPPED?YI(this,_.Eb,a):a.endedReason===b.END_OF_STREAM?(YI(this,_.ub,a),YI(this,_.Eb,a)):a.endedReason===b.ERROR&&VI(this,1);break;case cast.framework.events.EventType.PLAYING:YI(this,_.Bb,a);break;case cast.framework.events.EventType.PAUSE:YI(this,_.zb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?YI(this,_.sb,a):YI(this,_.Bb,a)}}};
60
+ vJ.prototype.getPosition=vJ.prototype.getPosition;vJ.prototype.setVolume=vJ.prototype.setVolume;vJ.prototype.getVolume=vJ.prototype.getVolume;vJ.prototype.skip=vJ.prototype.skip;vJ.prototype.pause=vJ.prototype.pause;vJ.prototype.resume=vJ.prototype.resume;var SI=!1;var wJ=class{constructor(a){this.Jb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(ZI(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(ZI(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>$I(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=
61
+ _.Of;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Qf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Rf}b&&this.Jb(new _.B(b,{detail:$I(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Jb(new _.B(_.Of,{detail:b}))}};var Z=class extends _.P{constructor(){super();this.g=new _.O("clpp.cast.TrackManager");this.l=null;this.o=1E9;this.h=[];this.j=[];this.m=this.w.bind(this);this.a=this.f=null}initialize(a){this.l=a;aJ().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.l=null;aJ().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ea(){return this.j}fa(){return null}xa(){const a=
62
+ this.ha();return a&&a.renditions[0]}za(){const a=this.ia();return a&&a.renditions[0]}Ja(){return null}Wa(){return null}Xa(){return null}Aa(){return null}ha(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.p&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ia(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.p&&(b=b.toString(),a=this.ea().find(c=>c.id===b)||null)}return a}Pa(){this.g.warn("Video tracks unavailable on Cast")}la(a){a&&this.f&&
63
+ this.f.setActiveById(+a.id)}ta(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Oa(){this.g.warn("Video renditions unavailable on Cast")}cb(a){this.la(a&&a.track)}eb(a){this.ta(a&&a.track)}addTextTrack(a){const b=this;return _.v(function*(){var c=b.l.getConfiguration();if((c=yield sI(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
64
+ 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]),cJ(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ja(){return!0}w(){this.f=aJ().getAudioTracksManager();var a=this.f.getTracks();this.h=bJ(_.I,a);cJ(this);a=this.l.getConfiguration();dJ(this,_.I,a.preferredAudioLanguage,a.preferredAudioRole);dJ(this,_.H,a.preferredTextLanguage,a.preferredTextRole)}};Z.prototype.isAbrEnabled=Z.prototype.ja;
65
+ Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.eb;Z.prototype.setAudioRendition=Z.prototype.cb;Z.prototype.setVideoRendition=Z.prototype.Oa;Z.prototype.setTextTrack=Z.prototype.ta;Z.prototype.setAudioTrack=Z.prototype.la;Z.prototype.setVideoTrack=Z.prototype.Pa;Z.prototype.getTextTrack=Z.prototype.ia;Z.prototype.getAudioTrack=Z.prototype.ha;Z.prototype.getVideoTrack=Z.prototype.Aa;Z.prototype.getLoadingTextRendition=Z.prototype.Xa;
66
+ Z.prototype.getLoadingAudioRendition=Z.prototype.Wa;Z.prototype.getLoadingVideoRendition=Z.prototype.Ja;Z.prototype.getTextRendition=Z.prototype.za;Z.prototype.getAudioRendition=Z.prototype.xa;Z.prototype.getVideoRendition=Z.prototype.fa;Z.prototype.getTextTracks=Z.prototype.ea;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var xJ=class extends _.ao{constructor(){super();this.C=new _.O(lI);this.g=this.o=_.di();this.w=null;this.j=-1;this.D=new _.$l;this.f=this.m=this.h=this.a=this.A=null;this.B=!1}init(a,b){this.A=a;b&&(this.g=this.o=b);a=eJ();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.F.bind(this));this.a=new tJ(this);this.a.init();this.h=new Z;this.h.initialize(this);this.m=new wJ(c=>this.trigger(c));this.m.init()}unload(){const a=cast.framework.messages.PlayerState,
67
+ b=eJ();b.getPlayerState()!==a.IDLE&&b.stop();this.h&&this.h.release();this.m&&this.m.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.v(function*(){a.A=null;a.o=_.di();a.g=a.o;a.j=-1;a.w=null;a.a&&(yield a.a.destroy(),a.a=null);a.h&&(a.h.destroy(),a.h=null)})}play(){const a=eJ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");a.play();
68
+ return Promise.resolve()}pause(){const a=eJ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return eJ().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return eJ().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=eJ();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(dI);b.seek(a);return Promise.resolve()}getPosition(){return eJ().getCurrentTimeSec()}getDuration(){const a=
69
+ eJ().getDurationSec();return typeof a===_.p?-1===a?Infinity:a:-1}getPlaybackRate(){return eJ().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;eJ().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||
70
+ null}getLoadedSource(){const a=eJ().getMediaInformation();if(a){var b=eJ().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.w&&-1!==this.j?this.w[this.j]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Uf:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return eJ().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=eJ().getLiveSeekableRange();
71
+ b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.Ho}getStats(){var a=_.Nk();if(this.f){a=eJ().getStats();this.f.m=a.estimatedBandwidth||NaN;this.f.A=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.j=a.width||NaN;b.f=c;b=this.f;c=typeof a.decodedFrames===_.p?a.decodedFrames:NaN;b.h=typeof a.droppedFrames===_.p?a.droppedFrames:NaN;b.g=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
+ this;return _.v(function*(){b.f=new _.Fo;b.a.m=b.f.a;b.w=_.gl(a);_.gi(a)&&(b.g=_.fi(b.o,a));if(b.B)b.B=!1;else{var c=b.w[b.j],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.p&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:qI(b.g),local:!0};yield eJ().load(d)}})}getBufferInfo(){this.C.warn(_.ka);return new _.$n}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.A}setNetworkEngine(a){this.D=
73
+ a}getNetworkEngine(){return this.D}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return lI}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.C.warn(hI)}onError(a){a=new _.B(_.Tc,{detail:a});this.trigger(a)}canPlay(){return _.Mh()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=qI(this.getStats());{const c=cast.framework.messages.StreamType,d=a.media;var b=!!d;const e=b&&d.streamType===c.LIVE,
74
+ f=b&&!d.metadata,g=!!a.liveSeekableRange;if(b&&g&&(!e||e&&f)){b=eJ().getStartAbsoluteTime();if(typeof b===_.p){d.startAbsoluteTime=b;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=d.metadata;h.sectionStartAbsoluteTime=b;d.metadata=h}d.streamType=c.LIVE}}return a}F(a,b){let c=null;a.media.customData&&(c=rI(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.p?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;hJ(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}};
75
+ xJ.prototype.getTextDisplayer=xJ.prototype.getTextDisplayer;xJ.prototype.getNetworkEngine=xJ.prototype.getNetworkEngine;xJ.prototype.setNetworkEngine=xJ.prototype.setNetworkEngine;var jJ=class{constructor(){this.a=!1;this.h=new _.O(mI);this.f=this.l=null;this.g=new Set;this.A=this.F.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.Fn;this.m=null}init(a){a&&(this.f=new xJ,_.im(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.v(function*(){b.l&&b.l.getState()!==_.$k&&(yield pI(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=lJ(),b=lJ().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
76
+ c.customNamespaces={};c.customNamespaces[nI]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.D.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};c.playbackConfig=d;if(d=this.l&&this.l.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,
77
+ this.A);a.start(c);a.addCustomMessageListener(nI,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=lJ();lJ().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(nI,this.w);a.stop();this.l=this.f=null}}Cc(a){this.j=a}zf(a){this.m=a}on(a,b){lJ().addEventListener(a,b)}off(a,b){lJ().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Vc&&this.g.add(a)}removeMessageListener(a){typeof a===_.Vc&&this.g.delete(a)}sendMessage(a,
78
+ b){lJ().sendCustomMessage(nI,b,qI(a))}Sb(){return this.a}Va(){var a;return a=(a=lJ().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}D(a){a=a.trim();if(a.startsWith("#EXTM3U"))return nJ(this,a);try{var b=(new DOMParser).parseFromString(a,_.qe)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=lJ();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
79
+ 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.u||g===_.Vb){g=e[f].getAttribute(_.od);var h=e[f].getElementsByTagName(_.Xa);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.od)||g,m=h[k].getAttribute(_.yc);let n=h[k].getAttribute(_.Te)||void 0,q=h[k].getAttribute(_.Yc)||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(_.Xa).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
80
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.fb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=lJ();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.u){e=c[d].getElementsByTagName(_.Va);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ka)||void 0,h=e[f].getAttribute(_.Ia)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Ge,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Va).length||a.removeChild(c[d])}a=
81
+ (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.v(function*(){let c=a;var d;c.media.customData&&(d=rI(c.media.customData.playerConfiguration));if(b.l&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield UI(c.media,d.ima,b.l.getNetworkEngine()));typeof d.startTime===_.p&&d.startTime!==c.currentTime&&(c.currentTime=d.startTime);c.media.customData.local||(b.f.B=!0,yield _.pm(b.l,d),yield _.qm(b.l),d=b.l.getLoadedSource(),c.media.contentId=d.url,c.media.contentType=
82
+ d.type,d.ub&&(c.media.hlsVideoSegmentFormat=tI(d.ub,_.J)),d.audioMimeType&&(c.media.hlsSegmentFormat=tI(d.audioMimeType,_.I)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.p&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.l.getConfiguration().autoplay)}b.m&&(d=yield Promise.resolve(b.m(c)))&&(c=d);return c})}F(a){!this.l||a.media.customData&&a.media.customData.local||_.sm(this.l)}B(a){if(0<this.g.size){const b=rI(a.data);
83
+ this.g.forEach(c=>c(b))}}};_.x(mI,jJ);jJ.prototype.getContentMetadata=jJ.prototype.Va;jJ.prototype.isApiReady=jJ.prototype.Sb;jJ.prototype.sendMessage=jJ.prototype.sendMessage;jJ.prototype.removeMessageListener=jJ.prototype.removeMessageListener;jJ.prototype.addMessageListener=jJ.prototype.addMessageListener;jJ.prototype.off=jJ.prototype.off;jJ.prototype.on=jJ.prototype.on;jJ.prototype.setLoadRequestDataInterceptor=jJ.prototype.zf;jJ.prototype.setPlayerConfigInterceptor=jJ.prototype.Cc;
84
+ jJ.prototype.stop=jJ.prototype.stop;jJ.prototype.start=jJ.prototype.start;jJ.prototype.init=jJ.prototype.init;jJ.getInstance=kJ;var iJ=null;var yJ=class{constructor(a){this.f=a;this.a=null;this.g=new _.Fn;this.h=[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 _.v(function*(){a.a=a.f.m;if(a.a){const b=a.a.controller,c=a.j.bind(a);for(const d of a.h)a.g.on(b,d,c)}})}start(){return _.v(function*(){})}resume(){this.a&&
85
+ 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(oI,{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===_.p&&(a=b));return a}dispose(){const a=this;
86
+ return _.v(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.B(_.Hb,{adsTimeline:new uJ(a.breaks)})));break;case "isPlayingBreak":a.value?pJ(this,_.qb):(pJ(this,_.ub),pJ(this,_.Eb),pJ(this,_.rb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(pJ(this,_.ub),pJ(this,_.Eb)),pJ(this,_.Db));break;case "isPaused":this.a.isPlayingBreak&&(a.value?pJ(this,_.zb):pJ(this,_.Bb))}}};yJ.prototype.getPosition=yJ.prototype.getPosition;
87
+ yJ.prototype.setVolume=yJ.prototype.setVolume;yJ.prototype.getVolume=yJ.prototype.getVolume;yJ.prototype.skip=yJ.prototype.skip;yJ.prototype.pause=yJ.prototype.pause;yJ.prototype.resume=yJ.prototype.resume;var zJ=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}Y(a,b){return a.namespace()!==_.tc?!1:!(!b||!b.ima)}create(a){return new yJ(a.a)}};zJ.prototype.create=zJ.prototype.create;zJ.prototype.isSupported=zJ.prototype.Y;zJ.prototype.name=zJ.prototype.name;_.tl(new zJ);var AJ=class{name(){return"clpp.cast.ads.AdsManagerFactory"}Y(a,b){return kJ().Sb()?!(!b||!b.ima):!1}create(a){return new vJ(a)}};AJ.prototype.create=AJ.prototype.create;AJ.prototype.isSupported=AJ.prototype.Y;AJ.prototype.name=AJ.prototype.name;_.tl(new AJ);};f.call(g, window);