@castlabs/prestoplay 6.14.0 → 6.15.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 (62) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +113 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +550 -529
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -73
  10. package/cjs/cl.externs.js +191 -64
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -68
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +290 -275
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +72 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +70 -70
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +89 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +457 -438
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +70 -68
  39. package/cl.externs.js +187 -64
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -69
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +255 -240
  46. package/cl.muxdata.js +13 -13
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +15 -15
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/clpp.styles.css +2 -0
  61. package/package.json +1 -1
  62. package/typings.d.ts +387 -90
package/cl.cast.js CHANGED
@@ -1,88 +1,89 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var bP="Cannot seek during ads playout.",cP="Cannot switch track",dP="Media session does not exist.",eP="No receivers available",fP="Reset ABR functionality not available on cast.",gP="SDK not yet ready",hP="Sender is destroyed.",iP="clpp.cast.CastProxy",jP="clpp.cast.Player",kP="clpp.cast.Receiver",lP="urn:x-cast:castlabs",nP="urn:x-cast:com.google.cast.media",oP=function(a){return _.x(function*(){yield _.wo(a,_.ze);yield _.wo(a,_.ye)})},pP=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.Qd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.ve?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},qP=function(a){if(typeof a!==_.vf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},rP=function(a,b,c,d){return _.x(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
- null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.gj(d,a.mimeType,g);f&&g&&(h=_.ui(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.J(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},sP=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 _.Rf:return d.FMP4;case _.Pf:return b===_.M?d.MPEG2_TS:c.TS;case _.Dc:return c.AAC;case _.Ec:return c.AC3;case _.Fc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Gc:return c.FMP4}},uP=function(a){a=void 0===a?tP:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
- b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},vP=function(a,b){return a.h.filter(c=>c.type===b)},xP=function(a,b){const c=wP(a);return vP(a,b).find(d=>c.includes(d.id))||null},zP=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.K){const e=a.qa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;yP(a,b)},e=>{a.f[b]=null;a.g.debug(cP,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{yP(a,b)},e=>{a.g.debug(cP,e)}))},wP=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},yP=function(a,b){b===_.L?a.a.trigger(new _.F(_.ck)):b===_.K&&a.a.trigger(new _.F(_.dk))},CP=function(a){if(a)for(const b of AP)BP(b)},BP=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.V.length){a.w=!0;a.o.xe();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.V;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.ba);DP&&a.o.ca(.02)}},EP=function(a){return _.x(function*(){AP.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.ba)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.T=null;a.Z=null})},FP=function(a){return _.x(function*(){a.mb()||(yield cast.framework.CastContext.getInstance().requestSession())})},HP=function(a,b,c){c=
9
- void 0===c?0:c;return _.x(function*(){var d=a.f.qa();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.ja())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield GP(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),ne:a.getPresentationStartTime(),autoplay:b,Qa:a.h})})},GP=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield FP(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=sP(b.Eb,_.M);e.hlsSegmentFormat=sP(c,_.L);b.Qa&&(a.M&&(c=yield Promise.resolve(a.M(b.Qa)))&&(b.Qa=c),a.h=b.Qa,a.C=_.un(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Qa.remoteTextTracks&&(c=yield Promise.all(b.Qa.remoteTextTracks.map(a.Oa.bind(a))),e.tracks=c.filter(k=>k),b.Qa.remoteTextTracks=void 0),delete b.Qa.autoplay,b.Qa.startTime=null,e.customData={playerConfiguration:pP(b.Qa)});c=a.hb()||{};
11
- var f=IP(c.metadataType),g;typeof b.ne===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.ne});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=JP(c);if(g=KP(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Kc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},KP=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(LP);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=uP(LP[b]);return Object.assign(b,a)},IP=function(a){var b=void 0===b?tP:b;return Object.values(LP).includes(a)?a:b},JP=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},NP=function(a,b){MP(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(lP,a.R)},OP=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
13
- null;a=null===a?null:a+b;return null===a?b:a},MP=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.la.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.F(_.he)))},RP=function(a){return new PP(a.h,()=>{a.trigger(new _.F(_.Qc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
14
- 1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.He&&(d.preferredAudioLanguage=c.He);c.xf&&(d.preferredTextLanguage=c.xf);_.yo(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>QP(a))},QP=function(a){return _.x(function*(){a.trigger(new _.F(_.Pc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.yo(a.f,a.a))})},UP=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{SP=!1;const e=_.ui(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.Rh(f.data),h=(new DOMParser).parseFromString(g,
15
- _.Bf);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=TP(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=TP(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),SP=!0}}catch(e){_.C("Failed to fetch an ad",e),SP=!0}})},TP=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
- a;return b},VP=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},WP=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},YP=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=XP(a,c))&&(d={ad:c});a.m.trigger(new _.F(b,d))}},XP=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.vf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
- _.vf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},ZP=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]},$P=function(a){const b=
18
- a.dashTimedMetadata;let c=_.Jf;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.If)?_.Yg:_.Wg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},aQ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},cQ=function(a){a.a=aQ().getTextTracksManager();const b=a.a.getTracks();a.j=bQ(_.K,b)},bQ=function(a,b){const c=[];for(const d of b)b=new _.Ki(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
- null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Ui(b.id,b)),c.push(b);return c},dQ=function(a,b,c,d){c=_.eh(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ga());if(c=c.find(g=>{const h=_.Eh(g);return f.some(k=>{k=_.Eh(k.language||"");return _.Fh(h,k)})})){const g=
20
- _.Eh(c);c=f.filter(h=>{h=_.Eh(h.language||"");return _.Fh(g,h)});f=c.length?c:f;e=e||!!c.length}_.$h(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.L?a.ta(e):b===_.K&&a.Ha(e))},eQ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},hQ=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
- if(a&&a.drm){var d=a.drm,e=_.Jk(d);if(e){var f=[_.pd];_.un(a)[0].type!==_.Bc&&f.unshift(_.rd);d.preferredDrmSystem===_.pd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Sa[g];h?(c=g===_.rd?cast.framework.ContentProtection.WIDEVINE:g===_.pd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},fQ(b,h,a,c),gQ(b,h,a,c)):c()}else c()}else c()},fQ=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
- _.ui({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},gQ=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.vi(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
23
- a.licenseHandler=void 0},kQ=function(){return iQ||(iQ=new jQ)},lQ=function(){return cast.framework.CastReceiverContext.getInstance()},nQ=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=lQ();var {hlsVideoSegmentFormat:d}=lQ().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Rf:_.Pf;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
- mQ(f,_.na),h=mQ(f,_.ub);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")},mQ=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},pQ=function(a,b){let c=null;const d=oQ(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},oQ=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
- let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},qQ=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.h=_.on;this.o=_.qs;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.on)}destroy(){this.l=
26
- this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.G&&this.a(_.nn)}a(a){if(a!==this.h)if(this.h===_.nn&&a!==_.on)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===_.jn?(this.B=b,this.player.trigger(new _.F(_.Mc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.jn&&this.player.trigger(new _.F(_.Lc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,
27
- timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Xm(this.l,this.h);this.player.trigger(new _.F(_.sf,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var tP=0,LP={GENERIC:tP,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var rQ=class extends qQ{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Bb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Bb(){if(this.f&&
28
- this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.fn);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.nn);break;default:this.a(_.on)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.rn);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.qn);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.jn)}}};var sQ=class extends _.S{constructor(){super();this.g=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.M;break;case chrome.cast.media.TrackType.AUDIO:c=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.Ki(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 _.Ui(c.id,c));return c}):[],this.a.trigger(new _.F(_.Ur)))}destroy(){this.a=null}getVideoTracks(){return vP(this,_.M)}getAudioTracks(){return vP(this,_.L)}ga(){return vP(this,_.K)}ka(){const a=this.Ea();return a?a.renditions[0]:null}Ka(){const a=this.ja();return a?a.renditions[0]:null}Da(){const a=this.qa();return a?a.renditions[0]:
30
- null}Va(){return this.f[_.M]||null}ib(){return this.f[_.L]||null}jb(){return this.f[_.K]||null}Ea(){return xP(this,_.M)}ja(){return xP(this,_.L)}qa(){return xP(this,_.K)}ab(a){zP(this,_.M,a)}ta(a){zP(this,_.L,a)}Ha(a){zP(this,_.K,a)}Ra(a){this.ab(a&&a.track)}Za(a){this.ta(a&&a.track)}$a(a){this.Ha(a&&a.track)}addTextTrack(){return _.x(function*(){})}na(){return!0}};sQ.prototype.isAbrEnabled=sQ.prototype.na;sQ.prototype.addTextTrack=sQ.prototype.addTextTrack;sQ.prototype.setTextRendition=sQ.prototype.$a;
31
- sQ.prototype.setAudioRendition=sQ.prototype.Za;sQ.prototype.setVideoRendition=sQ.prototype.Ra;sQ.prototype.setTextTrack=sQ.prototype.Ha;sQ.prototype.setAudioTrack=sQ.prototype.ta;sQ.prototype.setVideoTrack=sQ.prototype.ab;sQ.prototype.getTextTrack=sQ.prototype.qa;sQ.prototype.getAudioTrack=sQ.prototype.ja;sQ.prototype.getVideoTrack=sQ.prototype.Ea;sQ.prototype.getLoadingTextRendition=sQ.prototype.jb;sQ.prototype.getLoadingAudioRendition=sQ.prototype.ib;sQ.prototype.getLoadingVideoRendition=sQ.prototype.Va;
32
- sQ.prototype.getTextRendition=sQ.prototype.Da;sQ.prototype.getAudioRendition=sQ.prototype.Ka;sQ.prototype.getVideoRendition=sQ.prototype.ka;sQ.prototype.getTextTracks=sQ.prototype.ga;sQ.prototype.getAudioTracks=sQ.prototype.getAudioTracks;sQ.prototype.getVideoTracks=sQ.prototype.getVideoTracks;var PP=class extends _.Wr{constructor(a,b,c,d){super();this.g=new _.R(_.dd);this.V=a;this.o=new _.mj(b);this.T=c;this.Z=d;this.h=this.I=_.nk();this.C=[];this.B=0;this.K=new _.po;this.G=this.l=this.a=null;this.A=this.w=!1;this.aa="";this.ea=1E6;this.f=new sQ;this.f.initialize(this);this.j=new rQ(this);this.H=new _.ir;this.J=null;this.F=new Set;this.N=this.cb.bind(this);this.ba=this.gb.bind(this);this.W=this.fb.bind(this);this.R=this.eb.bind(this);this.M=null;window.cast||Object.defineProperty(window,
33
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{CP(!0)},0)}});BP(this);AP.add(this)}init(a,b){this.h=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}destroy(){return _.x(function*(){})}bd(a){this.M=a}dc(){return this.w}mb(){return this.A}Ud(){return this.aa}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
- if(e)try{yield e.sendMessage(a,pP(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.x(function*(){if(!a.dc())throw a.g.warn(gP),new _.H(1,8,8001,void 0);if(!DP)throw a.g.warn(eP),new _.H(1,8,8002,void 0);if(a.mb())throw a.g.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield FP(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 _.H(1,8,8E3,c);}})}Rd(){this.mb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Qd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Qd&&this.F.delete(a)}play(){return this.isEnded()?HP(this,!0):new Promise((a,b)=>{if(!this.a)return b(dP);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(dP);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
- _.fn}seek(a){return this.isEnded()?HP(this,!1,a):new Promise((b,c)=>{this.a||c(dP);this.l.isPlayingBreak&&c(bP);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.Lf));this.a.seek(d,()=>{this.trigger(new _.F(_.Kf));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!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&
37
- this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(nP,{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!==_.r?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===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.qs}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?qP(this.a.customData.stats):_.an()}isLive(){return Infinity===
39
- this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.dc())if(DP){b.C=_.un(a);_.qk(a)&&(b.h=_.pk(b.I,a));var c=b.C[b.B];yield GP(b,{source:c,isLive:c.isLive,autoplay:b.h.autoplay,Qa:b.h,Eb:c.Eb,audioMimeType:c.audioMimeType})}else b.g.warn(eP);else b.g.warn(gP)})}getBufferInfo(){return new _.Vr}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
- a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.g.warn(fP)}onError(a){if(a&&(this.trigger(new _.F(_.Nd,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.dd}canPlay(){return this.dc()?2:0}hb(){return this.J}jc(a){this.J=KP(a)}Nd(){this.J=null}te(a){const b=this.hb()||{};a={metadataType:IP(b.metadataType),title:a};this.jc(Object.assign({},b,a))}re(a){const b=this.hb()||{},c=IP(b.metadataType);a=new chrome.cast.Image(a);
41
- this.jc(Object.assign({},b,{metadataType:c,images:[a]}))}qe(a){const b=this.hb()||{};this.jc(Object.assign({},b,{metadataType:3,artist:a}))}se(a){const b=this.hb()||{};a={metadataType:IP(b.metadataType),releaseDate:a};this.jc(Object.assign({},b,a))}cb(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;DP=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.xe()}gb(a){this.g.debug(`state: ${a.sessionState}, details:`,
42
- a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;NP(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.mb()||(this.A=!0,NP(this,a.session),this.Z());break;case cast.framework.SessionState.SESSION_ENDED:if(this.mb()&&this.a){const d=this.a.media;var b=this.f.ja(),c=this.f.qa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.T(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:OP(this),xf:c,
43
- He:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(lP,this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}fb(a){this.g.debug("New media session",a.mediaSession);MP(this,a.mediaSession)}eb(a,b){if(a===lP&&0<this.F.size){const c=qP(b);this.F.forEach(d=>d(c))}}la(){this.trigger(new _.F(_.Cf))}Oa(a){const b=this;return _.x(function*(){let c=null;const d=yield rP(a,[_.Af,_.xc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ea++,
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}};PP.prototype.getTextDisplayer=PP.prototype.getTextDisplayer;PP.prototype.getNetworkEngine=PP.prototype.getNetworkEngine;PP.prototype.setNetworkEngine=PP.prototype.setNetworkEngine;var DP=!1,AP=new Set;window.__onGCastApiAvailable=CP;var tQ=class extends _.Wr{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Qd?c:(d,e)=>{this.f&&d!==_.fn&&d!==_.on&&this.f.load(e)};this.a=RP(this);this.g=new _.R(iP);this.addDelegate(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield EP(a.a),a.a=null);a.removeDelegate(a.f)})}Kd(){return!!this.a&&this.a.dc()&&DP}mb(){return!!this.a&&this.a.mb()}Ud(){return this.a?this.a.Ud():""}bd(a){this.a&&this.a.bd(a)}cast(a){const b=this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),
45
- b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.ja();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.qa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Kc?e.isLive:b.f.isLive();d={source:e,
46
- isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),ne:b.f.getPresentationStartTime(),Eb:h,audioMimeType:k,Qa:l}}var c=d}yield QP(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield GP(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.F(_.Nd,{detail:d}),b.trigger(c)}})}Rd(){this.a&&this.a.Rd()}Yf(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield EP(b.a)),b.a=RP(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?
47
- yield b.a.sendMessage(lP,a):b.g.warn(hP)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(hP)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(hP)}hb(){return this.a&&this.a.hb()}jc(a){this.a&&this.a.jc(a)}Nd(){this.a&&this.a.Nd()}te(a){this.a&&this.a.te(a)}re(a){this.a&&this.a.re(a)}qe(a){this.a&&this.a.qe(a)}se(a){this.a&&this.a.se(a)}};_.z(iP,tQ);tQ.prototype.setContentReleaseDate=tQ.prototype.se;tQ.prototype.setContentArtist=tQ.prototype.qe;
48
- tQ.prototype.setContentImage=tQ.prototype.re;tQ.prototype.setContentTitle=tQ.prototype.te;tQ.prototype.clearContentMetadata=tQ.prototype.Nd;tQ.prototype.setContentMetadata=tQ.prototype.jc;tQ.prototype.getContentMetadata=tQ.prototype.hb;tQ.prototype.removeMessageListener=tQ.prototype.removeMessageListener;tQ.prototype.addMessageListener=tQ.prototype.addMessageListener;tQ.prototype.sendMessage=tQ.prototype.sendMessage;tQ.prototype.changeReceiverId=tQ.prototype.Yf;tQ.prototype.forceDisconnect=tQ.prototype.Rd;
49
- tQ.prototype.cast=tQ.prototype.cast;tQ.prototype.setPlayerConfigInterceptor=tQ.prototype.bd;tQ.prototype.getReceiverName=tQ.prototype.Ud;tQ.prototype.isCasting=tQ.prototype.mb;tQ.prototype.canCast=tQ.prototype.Kd;tQ.prototype.destroy=tQ.prototype.destroy;var uQ=class extends qQ{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.T.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.Z.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.M=this.ea.bind(this);this.G=this.ba.bind(this);this.F=this.U.bind(this);this.f=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
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.M);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
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.M);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}T(){this.player.trigger(new _.F(_.Je));this.a(_.rn)}R(){this.a(_.qn)}aa(){this.a(_.fn)}Z(a){a.isBuffering?
52
- this.a(_.jn):(a=this.player.isPaused()?_.qn:_.rn,this.a(a))}W(){this.j=1;this.player.trigger(new _.F(_.Lf))}V(){this.player.trigger(new _.F(_.Kf))}ea(){this.j=2}ba(){this.a(_.pn)}N(a){const b=this.player.getStats();this.player.trigger(new _.F(_.Jc,{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.player.trigger(new _.F(_.Nd,{detail:a}));this.a(_.nn)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.r?c:1;this.l=typeof d===_.r?d:1;this.h=typeof e===_.r?e:0}rb(){return"Google Cast Framework"}sb(){return cast.framework.VERSION}yb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}fc(){return!1}Jb(){return this.a.clickThroughUrl||
53
- null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}vb(){return 0}ub(){return 0}kb(){return 0}Wa(){switch(this.Kb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.h}Kb(){return this.f.position}Lb(){return this.j}xb(){return this.l}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
54
- Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.xb;Z.prototype.getPositionInSequence=Z.prototype.Lb;Z.prototype.getPodTimeOffset=Z.prototype.Kb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Wa;Z.prototype.getMediaBitrate=Z.prototype.kb;Z.prototype.getMediaHeight=Z.prototype.ub;Z.prototype.getMediaWidth=Z.prototype.vb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.Jb;
55
- Z.prototype.isBumper=Z.prototype.fc;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.yb;
56
- Z.prototype.getAdManagerVersion=Z.prototype.sb;Z.prototype.getAdManagerName=Z.prototype.rb;var vQ=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Mb(){return!!this.a.find(a=>0===a.position)}lb(){return!!this.a.find(a=>-1===a.position)}};vQ.prototype.hasPostroll=vQ.prototype.lb;vQ.prototype.hasPreroll=vQ.prototype.Mb;vQ.prototype.getCuePoints=vQ.prototype.getCuePoints;var wQ=class{constructor(a){this.m=a;this.a=null;this.h=this.j.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];WP().addEventListener(this.f,
57
- this.h)}load(){const a=this;return _.x(function*(){SP&&(SP=!1,VP(a,0))})}start(){return _.x(function*(){WP().play()})}resume(){-1!==this.getPosition()&&WP().play()}pause(){-1!==this.getPosition()&&WP().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}dispose(){const a=this;return _.x(function*(){WP().removeEventListener(a.f,a.h)})}j(a){const b=cast.framework.events.EndedReason;
58
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=WP().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.F(_.nc,{adsTimeline:new vQ(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:YP(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_STARTED:YP(this,_.Wb,a);break;case cast.framework.events.EventType.BREAK_ENDED:YP(this,_.Xb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:YP(this,_.jc,a);
59
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(YP(this,_.ic,a),YP(this,_.kc,a)):a.endedReason===b.STOPPED?YP(this,_.kc,a):a.endedReason===b.END_OF_STREAM?(YP(this,_.ac,a),YP(this,_.kc,a)):a.endedReason===b.ERROR&&VP(this,1);break;case cast.framework.events.EventType.PLAYING:YP(this,_.hc,a);break;case cast.framework.events.EventType.PAUSE:YP(this,_.fc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?YP(this,_.Zb,a):YP(this,_.hc,a)}}};
60
- wQ.prototype.getPosition=wQ.prototype.getPosition;wQ.prototype.setVolume=wQ.prototype.setVolume;wQ.prototype.getVolume=wQ.prototype.getVolume;wQ.prototype.skip=wQ.prototype.skip;wQ.prototype.pause=wQ.prototype.pause;wQ.prototype.resume=wQ.prototype.resume;var SP=!1;var xQ=class{constructor(a){this.Sb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(ZP(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(ZP(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>$P(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
- _.Zg;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.ah;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.bh}b&&this.Sb(new _.F(b,{detail:$P(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Sb(new _.F(_.Zg,{detail:b}))}};var yQ=class extends _.S{constructor(){super();this.g=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;aQ().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;aQ().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ga(){return this.j}ka(){return null}Ka(){const a=
62
- this.ja();return a&&a.renditions[0]}Da(){const a=this.qa();return a&&a.renditions[0]}Va(){return null}ib(){return null}jb(){return null}Ea(){return null}ja(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}qa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ga().find(c=>c.id===b)||null)}return a}ab(){this.g.warn("Video tracks unavailable on Cast")}ta(a){a&&this.f&&
63
- this.f.setActiveById(+a.id)}Ha(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ra(){this.g.warn("Video renditions unavailable on Cast")}Za(a){this.ta(a&&a.track)}$a(a){this.Ha(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield rP(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
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]),cQ(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}na(){return!0}w(){this.f=aQ().getAudioTracksManager();var a=this.f.getTracks();this.h=bQ(_.L,a);cQ(this);a=this.m.getConfiguration();dQ(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);dQ(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};yQ.prototype.isAbrEnabled=yQ.prototype.na;
65
- yQ.prototype.addTextTrack=yQ.prototype.addTextTrack;yQ.prototype.setTextRendition=yQ.prototype.$a;yQ.prototype.setAudioRendition=yQ.prototype.Za;yQ.prototype.setVideoRendition=yQ.prototype.Ra;yQ.prototype.setTextTrack=yQ.prototype.Ha;yQ.prototype.setAudioTrack=yQ.prototype.ta;yQ.prototype.setVideoTrack=yQ.prototype.ab;yQ.prototype.getTextTrack=yQ.prototype.qa;yQ.prototype.getAudioTrack=yQ.prototype.ja;yQ.prototype.getVideoTrack=yQ.prototype.Ea;yQ.prototype.getLoadingTextRendition=yQ.prototype.jb;
66
- yQ.prototype.getLoadingAudioRendition=yQ.prototype.ib;yQ.prototype.getLoadingVideoRendition=yQ.prototype.Va;yQ.prototype.getTextRendition=yQ.prototype.Da;yQ.prototype.getAudioRendition=yQ.prototype.Ka;yQ.prototype.getVideoRendition=yQ.prototype.ka;yQ.prototype.getTextTracks=yQ.prototype.ga;yQ.prototype.getAudioTracks=yQ.prototype.getAudioTracks;yQ.prototype.getVideoTracks=yQ.prototype.getVideoTracks;var zQ=class extends _.Wr{constructor(){super();this.g=new _.R(jP);this.h=this.w=_.nk();this.A=null;this.l=-1;this.F=new _.po;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=eQ();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new uQ(this);this.a.init();this.j=new yQ;this.j.initialize(this);this.o=new xQ(c=>this.trigger(c));this.o.init()}unload(){const a=
67
- cast.framework.messages.PlayerState,b=eQ();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.x(function*(){a.B=null;a.w=_.nk();a.h=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=eQ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
68
- a.play();return Promise.resolve()}pause(){const a=eQ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return eQ().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return eQ().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=eQ();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(bP);b.seek(a);return Promise.resolve()}getPosition(){return eQ().getCurrentTimeSec()}getDuration(){const a=
69
- eQ().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return eQ().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;eQ().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=eQ().getMediaInformation();if(a){var b=eQ().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,th:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return eQ().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=eQ().getLiveSeekableRange();
71
- b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.qs}getStats(){var a=_.an();if(this.f){a=eQ().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.h=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
- this;return _.x(function*(){b.f=new _.os;b.a.l=b.f.a;b.A=_.un(a);_.qk(a)&&(b.h=_.pk(b.w,a));if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.h.autoplay;typeof b.h.startTime===_.r&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:pP(b.h),local:!0};yield eQ().load(d)}})}getBufferInfo(){this.g.warn(_.oa);return new _.Vr}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}setNetworkEngine(a){this.F=
73
- a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return jP}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.g.warn(fP)}onError(a){a=new _.F(_.Nd,{detail:a});this.trigger(a)}canPlay(){return _.zj()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=pP(this.getStats());var b=eQ(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
74
- b&&(this.g.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=eQ().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
75
- a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=qP(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;hQ(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};zQ.prototype.getTextDisplayer=zQ.prototype.getTextDisplayer;zQ.prototype.getNetworkEngine=zQ.prototype.getNetworkEngine;
76
- zQ.prototype.setNetworkEngine=zQ.prototype.setNetworkEngine;var jQ=class{constructor(){this.a=!1;this.g=new _.R(kP);this.f=this.m=null;this.h=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.ir;this.l=null}init(a){a&&(this.f=new zQ,_.yo(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.on&&(yield oP(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=lQ(),b=lQ().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
- c.customNamespaces={};c.customNamespaces[lP]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
78
- this.A);a.start(c);a.addCustomMessageListener(lP,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=lQ();lQ().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(lP,this.w);a.stop();this.m=this.f=null}}bd(a){this.j=a}Wg(a){this.l=a}on(a,b){lQ().addEventListener(a,b)}off(a,b){lQ().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Qd&&this.h.add(a)}removeMessageListener(a){typeof a===_.Qd&&this.h.delete(a)}sendMessage(a,
79
- b){lQ().sendCustomMessage(lP,b,pP(a))}dc(){return this.a}hb(){var a;return a=(a=lQ().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return nQ(this,a);try{var b=(new DOMParser).parseFromString(a,_.Bf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=lQ();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);for(var f=e.length-
80
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.oe);var h=e[f].getElementsByTagName(_.wb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.oe)||g,m=h[k].getAttribute(_.kd);let n=h[k].getAttribute(_.hg)||void 0,q=h[k].getAttribute(_.Rd)||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(_.wb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=
81
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Db)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=lQ();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.tb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.db)||void 0,h=e[f].getAttribute(_.cb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Rf,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.tb).length||a.removeChild(c[d])}a=
82
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=qP(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield UP(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.Fo(b.m,d),yield _.Go(b.m),d=b.m.getLoadedSource(),c.media.contentId=
83
- d.url,c.media.contentType=d.type,d.Eb&&(c.media.hlsVideoSegmentFormat=sP(d.Eb,_.M)),d.audioMimeType&&(c.media.hlsSegmentFormat=sP(d.audioMimeType,_.L)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=lQ().getPlayerManager(),
84
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.Io(this.m)}}B(a){if(0<this.h.size){const b=qP(a.data);this.h.forEach(c=>c(b))}}};_.z(kP,jQ);jQ.prototype.getContentMetadata=jQ.prototype.hb;jQ.prototype.isApiReady=jQ.prototype.dc;jQ.prototype.sendMessage=jQ.prototype.sendMessage;jQ.prototype.removeMessageListener=jQ.prototype.removeMessageListener;
85
- jQ.prototype.addMessageListener=jQ.prototype.addMessageListener;jQ.prototype.off=jQ.prototype.off;jQ.prototype.on=jQ.prototype.on;jQ.prototype.setLoadRequestDataInterceptor=jQ.prototype.Wg;jQ.prototype.setPlayerConfigInterceptor=jQ.prototype.bd;jQ.prototype.stop=jQ.prototype.stop;jQ.prototype.start=jQ.prototype.start;jQ.prototype.init=jQ.prototype.init;jQ.getInstance=kQ;var iQ=null;var AQ=class{constructor(a){this.f=a;this.a=null;this.h=new _.ir;this.j=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.x(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.l.bind(a);for(const d of a.j)a.h.on(b,d,c)}})}start(){return _.x(function*(){})}resume(){this.a&&
86
- 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(nP,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}dispose(){const a=this;
87
- return _.x(function*(){a.h.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.nc,{adsTimeline:new vQ(a.breaks)})));break;case "isPlayingBreak":a.value?pQ(this,_.Wb):(pQ(this,_.ac),pQ(this,_.kc),pQ(this,_.Xb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(pQ(this,_.ac),pQ(this,_.kc)),pQ(this,_.jc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?pQ(this,_.fc):pQ(this,_.hc))}}};AQ.prototype.getPosition=AQ.prototype.getPosition;
88
- AQ.prototype.setVolume=AQ.prototype.setVolume;AQ.prototype.getVolume=AQ.prototype.getVolume;AQ.prototype.skip=AQ.prototype.skip;AQ.prototype.pause=AQ.prototype.pause;AQ.prototype.resume=AQ.prototype.resume;var BQ=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}da(a,b){return a.namespace()!==_.dd?!1:!(!b||!b.ima)}create(a){return new AQ(a.a)}};BQ.prototype.create=BQ.prototype.create;BQ.prototype.isSupported=BQ.prototype.da;BQ.prototype.name=BQ.prototype.name;_.In(new BQ);var CQ=class{name(){return"clpp.cast.ads.AdsManagerFactory"}da(a,b){return kQ().dc()?!(!b||!b.ima):!1}create(a){return new wQ(a)}};CQ.prototype.create=CQ.prototype.create;CQ.prototype.isSupported=CQ.prototype.da;CQ.prototype.name=CQ.prototype.name;_.In(new CQ);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var KQ="Cannot seek during ads playout.",LQ="Cannot switch track",MQ="Media session does not exist.",NQ="No receivers available",OQ="Reset ABR functionality not available on cast.",PQ="SDK not yet ready",QQ="Sender is destroyed.",RQ="clpp.cast.CastProxy",SQ="clpp.cast.Player",TQ="clpp.cast.Receiver",VQ="urn:x-cast:castlabs",WQ="urn:x-cast:com.google.cast.media",XQ=function(a){return _.w(function*(){yield _.Yo(a,_.He);yield _.Yo(a,_.Ge)})},YQ=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.Yd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.De?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},ZQ=function(a){if(typeof a!==_.Lf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},$Q=function(a,b,c,d){return _.w(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
+ null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.zj(d,a.mimeType,g);f&&g&&(h=_.Ni(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.I(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},aR=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
4
+ d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.kg:return d.FMP4;case _.jg:return b===_.L?d.MPEG2_TS:c.TS;case _.Gc:return c.AAC;case _.Hc:return c.AC3;case _.Lc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Mc:return c.FMP4}},cR=function(a){a=void 0===a?bR: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}},dR=function(a,b){return a.g.filter(c=>c.type===b)},fR=function(a,b){const c=eR(a);return dR(a,b).find(d=>c.includes(d.id))||null},hR=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.J){const e=a.oa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;gR(a,b)},e=>{a.f[b]=null;a.h.debug(LQ,e)})}else b===_.J&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{gR(a,b)},e=>{a.h.debug(LQ,e)}))},eR=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},gR=function(a,b){b===_.K?a.a.trigger(new _.C(_.Dk)):b===_.J&&a.a.trigger(new _.C(_.Ek))},kR=function(a){if(a)for(const b of iR)jR(b)},jR=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.U.length){a.w=!0;a.o.Ee();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.U;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa);lR&&a.o.da(.02)}},mR=function(a){return _.w(function*(){iR.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.T=null;a.X=null})},nR=function(a){return _.w(function*(){a.mb()||(yield cast.framework.CastContext.getInstance().requestSession())})},pR=function(a,b,c){c=
9
+ void 0===c?0:c;return _.w(function*(){var d=a.f.oa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.ja())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield oR(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),re:a.getPresentationStartTime(),autoplay:b,Oa:a.g})})},oR=function(a,b){return _.w(function*(){var c=chrome.cast.media.StreamType;yield nR(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=aR(b.Db,_.L);e.hlsSegmentFormat=aR(c,_.K);b.Oa&&(a.L&&(c=yield Promise.resolve(a.L(b.Oa)))&&(b.Oa=c),a.g=b.Oa,a.C=_.Wn(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Oa.remoteTextTracks&&(c=yield Promise.all(b.Oa.remoteTextTracks.map(a.Fa.bind(a))),e.tracks=c.filter(k=>k),b.Oa.remoteTextTracks=void 0),delete b.Oa.autoplay,b.Oa.startTime=null,e.customData={playerConfiguration:YQ(b.Oa)});c=a.gb()||{};
11
+ var f=qR(c.metadataType),g;typeof b.re===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.re});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=rR(c);if(g=sR(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Rc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},sR=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(tR);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=cR(tR[b]);return Object.assign(b,a)},qR=function(a){var b=void 0===b?bR:b;return Object.values(tR).includes(a)?a:b},rR=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},vR=function(a,b){uR(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(VQ,a.R)},wR=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
13
+ null;a=null===a?null:a+b;return null===a?b:a},uR=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ha.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.C(_.qe)))},zR=function(a){return new xR(a.g,()=>{a.trigger(new _.C(_.Xc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
14
+ 1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Re&&(d.preferredAudioLanguage=c.Re);c.If&&(d.preferredTextLanguage=c.If);_.$o(a.f,null);a.trigger(new _.C("castingended"));a.j(b,d)}},()=>yR(a))},yR=function(a){return _.w(function*(){a.trigger(new _.C(_.Wc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.$o(a.f,a.a))})},CR=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{AR=!1;const e=_.Ni(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.ji(f.data),h=(new DOMParser).parseFromString(g,
15
+ _.Rf);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=BR(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=BR(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),AR=!0}}catch(e){_.B("Failed to fetch an ad",e),AR=!0}})},BR=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
+ a;return b},DR=function(a,b){b=new _.G(1,10,10003,{errorType:b});a.m.onError(b)},ER=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},GR=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=FR(a,c))&&(d={ad:c});a.m.trigger(new _.C(b,d))}},FR=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Lf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
+ _.Lf&&(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 Y(d,e,b.index,b.total,f)}return c},HR=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]},IR=function(a){const b=
18
+ a.dashTimedMetadata;let c=_.dg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.cg)?_.oh:_.mh,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},JR=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},LR=function(a){a.a=JR().getTextTracksManager();const b=a.a.getTracks();a.j=KR(_.J,b)},KR=function(a,b){const c=[];for(const d of b)b=new _.ej(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
+ null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.mj(b.id,b)),c.push(b);return c},MR=function(a,b,c,d){c=_.xh(c).filter(g=>g);var e=!1;let f=[];b===_.K?f=a.getAudioTracks():b===_.J&&(f=a.ga());if(c=c.find(g=>{const h=_.Xh(g);return f.some(k=>{k=_.Xh(k.language||"");return _.Yh(h,k)})})){const g=
20
+ _.Xh(c);c=f.filter(h=>{h=_.Xh(h.language||"");return _.Yh(g,h)});f=c.length?c:f;e=e||!!c.length}_.si(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.h.info("Will select track",e),b===_.K?a.ra(e):b===_.J&&a.Ea(e))},NR=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},QR=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
+ if(a&&a.drm){var d=a.drm,e=_.kl(d);if(e){var f=[_.wd];_.Wn(a)[0].type!==_.Dc&&f.unshift(_.yd);d.preferredDrmSystem===_.wd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Qa[g];h?(c=g===_.yd?cast.framework.ContentProtection.WIDEVINE:g===_.wd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},OR(b,h,a,c),PR(b,h,a,c)):c()}else c()}else c()},OR=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
+ _.Ni({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},PR=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Oi(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.I(g.data)}):
23
+ a.licenseHandler=void 0},TR=function(){return RR||(RR=new SR)},UR=function(){return cast.framework.CastReceiverContext.getInstance()},WR=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=UR();var {hlsVideoSegmentFormat:d}=UR().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.kg:_.jg;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
+ VR(f,_.pa),h=VR(f,_.Ab);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")},VR=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},ZR=function(a,b){let c=null;const d=YR(a);d&&(c={ad:d});a.f.trigger(new _.C(b,c))},YR=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
+ let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Y(d,c,g,e,f)}return b},$R=class{constructor(a,b){this.log=new _.Q(b);this.player=a;this.l=null;this.g=_.Qn;this.o=_.ht;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Qn)}destroy(){this.l=
26
+ this.player=null;return Promise.resolve()}getState(){return this.g}onError(a){a.severity===_.E&&this.a(_.Pn)}a(a){if(a!==this.g)if(this.g===_.Pn&&a!==_.Qn)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.g;this.g=a;this.g===_.Ln?(this.B=b,this.player.trigger(new _.C(_.Tc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Ln&&this.player.trigger(new _.C(_.Sc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.g,previousState:this.o,
27
+ timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.zn(this.l,this.g);this.player.trigger(new _.C(_.If,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var bR=0,tR={GENERIC:bR,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var aS=class extends $R{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Ab.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Ab(){if(this.f&&
28
+ this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.In);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Pn);break;default:this.a(_.Qn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Tn);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Sn);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Ln)}}};var Z=class extends _.R{constructor(){super();this.h=new _.Q("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=_.L;break;case chrome.cast.media.TrackType.AUDIO:c=_.K;break;case chrome.cast.media.TrackType.TEXT:c=_.J}c=new _.ej(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
+ c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.mj(c.id,c));return c}):[],this.a.trigger(new _.C(_.Ls)))}destroy(){this.a=null}getVideoTracks(){return dR(this,_.L)}getAudioTracks(){return dR(this,_.K)}ga(){return dR(this,_.J)}ka(){const a=this.Ca();return a?a.renditions[0]:null}Ia(){const a=this.ja();return a?a.renditions[0]:null}Ba(){const a=this.oa();return a?a.renditions[0]:
30
+ null}Ua(){return this.f[_.L]||null}hb(){return this.f[_.K]||null}ib(){return this.f[_.J]||null}Ca(){return fR(this,_.L)}ja(){return fR(this,_.K)}oa(){return fR(this,_.J)}$a(a){hR(this,_.L,a)}ra(a){hR(this,_.K,a)}Ea(a){hR(this,_.J,a)}Pa(a){this.$a(a&&a.track)}Ya(a){this.ra(a&&a.track)}Za(a){this.Ea(a&&a.track)}addTextTrack(){return _.w(function*(){})}ma(){return!0}};Z.prototype.isAbrEnabled=Z.prototype.ma;Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.Za;
31
+ Z.prototype.setAudioRendition=Z.prototype.Ya;Z.prototype.setVideoRendition=Z.prototype.Pa;Z.prototype.setTextTrack=Z.prototype.Ea;Z.prototype.setAudioTrack=Z.prototype.ra;Z.prototype.setVideoTrack=Z.prototype.$a;Z.prototype.getTextTrack=Z.prototype.oa;Z.prototype.getAudioTrack=Z.prototype.ja;Z.prototype.getVideoTrack=Z.prototype.Ca;Z.prototype.getLoadingTextRendition=Z.prototype.ib;Z.prototype.getLoadingAudioRendition=Z.prototype.hb;Z.prototype.getLoadingVideoRendition=Z.prototype.Ua;
32
+ Z.prototype.getTextRendition=Z.prototype.Ba;Z.prototype.getAudioRendition=Z.prototype.Ia;Z.prototype.getVideoRendition=Z.prototype.ka;Z.prototype.getTextTracks=Z.prototype.ga;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var xR=class extends _.Ns{constructor(a,b,c,d){super();this.h=new _.Q(_.kd);this.U=a;this.o=new _.Nj(b);this.T=c;this.X=d;this.g=this.I=_.Ok();this.C=[];this.B=0;this.K=new _.So;this.G=this.l=this.a=null;this.A=this.w=!1;this.$="";this.ea=1E6;this.f=new Z;this.f.initialize(this);this.j=new aS(this);this.H=new _.as;this.J=null;this.F=new Set;this.N=this.bb.bind(this);this.aa=this.fb.bind(this);this.W=this.eb.bind(this);this.R=this.cb.bind(this);this.L=null;window.cast||Object.defineProperty(window,
33
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{kR(!0)},0)}});jR(this);iR.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}destroy(){return _.w(function*(){})}gd(a){this.L=
34
+ a}ec(){return this.w}mb(){return this.A}$d(){return this.$}sendMessage(a,b){const c=this;return _.w(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,YQ(b))}catch(f){d=new _.G(1,8,8E3,{detailedErrorCode:f})}else d=new _.G(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.w(function*(){if(!a.ec())throw a.h.warn(PQ),new _.G(1,8,8001,void 0);if(!lR)throw a.h.warn(NQ),new _.G(1,8,8002,void 0);if(a.mb())throw a.h.warn("Already casting"),
35
+ new _.G(1,8,8003,void 0);try{yield nR(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.G(1,8,8E3,c);}})}Xd(){this.mb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Yd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.F.delete(a)}play(){return this.isEnded()?pR(this,!0):new Promise((a,b)=>{if(!this.a)return b(MQ);this.a.play(null,
36
+ a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(MQ);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.In}seek(a){return this.isEnded()?pR(this,!1,a):new Promise((b,c)=>{this.a||c(MQ);this.l.isPlayingBreak&&c(KQ);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.C(_.fg));this.a.seek(d,()=>{this.trigger(new _.C(_.eg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
37
+ this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(WQ,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
38
+ this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a=
39
+ {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.ht}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?ZQ(this.a.customData.stats):_.Dn()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.ec())if(lR){b.C=_.Wn(a);b.g=_.Qk(b.I,a);var c=b.C[b.B];yield oR(b,{source:c,
40
+ isLive:c.isLive,autoplay:b.g.autoplay,Oa:b.g,Db:c.Db,audioMimeType:c.audioMimeType})}else b.h.warn(NQ);else b.h.warn(PQ)})}getBufferInfo(){return new _.Ms}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.h.warn(OQ)}onError(a){if(a&&
41
+ (this.trigger(new _.C(_.Vd,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.kd}canPlay(){return this.ec()?2:0}gb(){return this.J}kc(a){this.J=sR(a)}Sd(){this.J=null}ze(a){const b=this.gb()||{};a={metadataType:qR(b.metadataType),title:a};this.kc(Object.assign({},b,a))}xe(a){const b=this.gb()||{},c=qR(b.metadataType);a=new chrome.cast.Image(a);this.kc(Object.assign({},b,{metadataType:c,images:[a]}))}we(a){const b=this.gb()||{};this.kc(Object.assign({},b,{metadataType:3,artist:a}))}ye(a){const b=
42
+ this.gb()||{};a={metadataType:qR(b.metadataType),releaseDate:a};this.kc(Object.assign({},b,a))}bb(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;lR=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.$=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Ee()}fb(a){this.h.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;vR(this,a.session);break;
43
+ case cast.framework.SessionState.SESSION_RESUMED:this.mb()||(this.A=!0,vR(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.mb()&&this.a){const d=this.a.media;var b=this.f.ja(),c=this.f.oa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.T(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:wR(this),If:c,Re:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(VQ,
44
+ this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}eb(a){this.h.debug("New media session",a.mediaSession);uR(this,a.mediaSession)}cb(a,b){if(a===VQ&&0<this.F.size){const c=ZQ(b);this.F.forEach(d=>d(c))}}ha(){this.trigger(new _.C(_.Sf))}Fa(a){const b=this;return _.w(function*(){let c=null;const d=yield $Q(a,[_.Qf,_.Cc],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ea++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
45
+ d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};xR.prototype.getTextDisplayer=xR.prototype.getTextDisplayer;xR.prototype.getNetworkEngine=xR.prototype.getNetworkEngine;xR.prototype.setNetworkEngine=xR.prototype.setNetworkEngine;var lR=!1,iR=new Set;window.__onGCastApiAvailable=kR;var bS=class extends _.Ns{constructor(a,b,c){super();this.f=a;this.g=b;this.j=typeof c===_.Yd?c:(d,e)=>{this.f&&d!==_.In&&d!==_.Qn&&this.f.load(e)};this.a=zR(this);this.h=new _.Q(RQ);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield mR(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}Pd(){return!!this.a&&this.a.ec()&&lR}mb(){return!!this.a&&this.a.mb()}$d(){return this.a?this.a.$d():""}gd(a){this.a&&this.a.gd(a)}cast(a){const b=this;return _.w(function*(){if(b.a)try{if(yield b.a.cast(),
46
+ b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.ja();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.oa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Rc?e.isLive:b.f.isLive();d={source:e,
47
+ isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),re:b.f.getPresentationStartTime(),Db:h,audioMimeType:k,Oa:l}}var c=d}yield yR(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield oR(b.a,c)))}}catch(d){b.h.error("Error while trying to cast",d),c=new _.C(_.Vd,{detail:d}),b.trigger(c)}})}Xd(){this.a&&this.a.Xd()}ig(a){const b=this;return _.w(function*(){a!==b.g&&(b.g=a,b.a&&(yield mR(b.a)),b.a=zR(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
48
+ yield b.a.sendMessage(VQ,a):b.h.warn(QQ)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.h.warn(QQ)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.h.warn(QQ)}gb(){return this.a&&this.a.gb()}kc(a){this.a&&this.a.kc(a)}Sd(){this.a&&this.a.Sd()}ze(a){this.a&&this.a.ze(a)}xe(a){this.a&&this.a.xe(a)}we(a){this.a&&this.a.we(a)}ye(a){this.a&&this.a.ye(a)}};_.x(RQ,bS);bS.prototype.setContentReleaseDate=bS.prototype.ye;bS.prototype.setContentArtist=bS.prototype.we;
49
+ bS.prototype.setContentImage=bS.prototype.xe;bS.prototype.setContentTitle=bS.prototype.ze;bS.prototype.clearContentMetadata=bS.prototype.Sd;bS.prototype.setContentMetadata=bS.prototype.kc;bS.prototype.getContentMetadata=bS.prototype.gb;bS.prototype.removeMessageListener=bS.prototype.removeMessageListener;bS.prototype.addMessageListener=bS.prototype.addMessageListener;bS.prototype.sendMessage=bS.prototype.sendMessage;bS.prototype.changeReceiverId=bS.prototype.ig;bS.prototype.forceDisconnect=bS.prototype.Xd;
50
+ bS.prototype.cast=bS.prototype.cast;bS.prototype.setPlayerConfigInterceptor=bS.prototype.gd;bS.prototype.getReceiverName=bS.prototype.$d;bS.prototype.isCasting=bS.prototype.mb;bS.prototype.canCast=bS.prototype.Pd;bS.prototype.destroy=bS.prototype.destroy;var cS=class extends $R{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.T.bind(this);this.H=this.R.bind(this);this.A=this.$.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.U.bind(this);this.L=this.ea.bind(this);this.G=this.aa.bind(this);this.F=this.V.bind(this);this.f=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
51
+ this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
52
+ d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}T(){this.player.trigger(new _.C(_.Re));this.a(_.Tn)}R(){this.a(_.Sn)}$(){this.a(_.In)}X(a){a.isBuffering?
53
+ this.a(_.Ln):(a=this.player.isPaused()?_.Sn:_.Tn,this.a(a))}W(){this.j=1;this.player.trigger(new _.C(_.fg))}U(){this.player.trigger(new _.C(_.eg))}ea(){this.j=2}aa(){this.a(_.Rn)}N(a){const b=this.player.getStats();this.player.trigger(new _.C(_.Qc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}V(a){a=new _.G(_.E,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.C(_.Vd,{detail:a}));this.a(_.Pn)}};var Y=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.r?c:1;this.l=typeof d===_.r?d:1;this.g=typeof e===_.r?e:0}rb(){return"Google Cast Framework"}sb(){return cast.framework.VERSION}yb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}gc(){return!1}Lb(){return this.a.clickThroughUrl||
54
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}vb(){return 0}ub(){return 0}jb(){return 0}Va(){switch(this.Mb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Mb(){return this.f.position}Nb(){return this.j}xb(){return this.l}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;
55
+ Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.xb;Y.prototype.getPositionInSequence=Y.prototype.Nb;Y.prototype.getPodTimeOffset=Y.prototype.Mb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Va;Y.prototype.getMediaBitrate=Y.prototype.jb;Y.prototype.getMediaHeight=Y.prototype.ub;Y.prototype.getMediaWidth=Y.prototype.vb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Lb;
56
+ Y.prototype.isBumper=Y.prototype.gc;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.yb;
57
+ Y.prototype.getAdManagerVersion=Y.prototype.sb;Y.prototype.getAdManagerName=Y.prototype.rb;var dS=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Ob(){return!!this.a.find(a=>0===a.position)}lb(){return!!this.a.find(a=>-1===a.position)}};dS.prototype.hasPostroll=dS.prototype.lb;dS.prototype.hasPreroll=dS.prototype.Ob;dS.prototype.getCuePoints=dS.prototype.getCuePoints;var eS=class{constructor(a){this.m=a;this.a=null;this.g=this.j.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];ER().addEventListener(this.f,
58
+ this.g)}load(){const a=this;return _.w(function*(){AR&&(AR=!1,DR(a,0))})}start(){return _.w(function*(){ER().play()})}resume(){-1!==this.getPosition()&&ER().play()}pause(){-1!==this.getPosition()&&ER().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}dispose(){const a=this;return _.w(function*(){ER().removeEventListener(a.f,a.g)})}j(a){const b=cast.framework.events.EndedReason;
59
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=ER().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.C(_.tc,{adsTimeline:new dS(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:GR(this,_.jc,a);break;case cast.framework.events.EventType.BREAK_STARTED:GR(this,_.bc,a);break;case cast.framework.events.EventType.BREAK_ENDED:GR(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:GR(this,_.pc,a);
60
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(GR(this,_.oc,a),GR(this,_.qc,a)):a.endedReason===b.STOPPED?GR(this,_.qc,a):a.endedReason===b.END_OF_STREAM?(GR(this,_.gc,a),GR(this,_.qc,a)):a.endedReason===b.ERROR&&DR(this,1);break;case cast.framework.events.EventType.PLAYING:GR(this,_.nc,a);break;case cast.framework.events.EventType.PAUSE:GR(this,_.lc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?GR(this,_.ec,a):GR(this,_.nc,a)}}};
61
+ eS.prototype.getPosition=eS.prototype.getPosition;eS.prototype.setVolume=eS.prototype.setVolume;eS.prototype.getVolume=eS.prototype.getVolume;eS.prototype.skip=eS.prototype.skip;eS.prototype.pause=eS.prototype.pause;eS.prototype.resume=eS.prototype.resume;var AR=!1;var fS=class{constructor(a){this.Ub=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(HR(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(HR(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>IR(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
62
+ _.ph;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.rh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.sh}b&&this.Ub(new _.C(b,{detail:IR(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Ub(new _.C(_.ph,{detail:b}))}};var gS=class extends _.R{constructor(){super();this.h=new _.Q("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.g=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;JR().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.g=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;JR().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.g}ga(){return this.j}ka(){return null}Ia(){const a=
63
+ this.ja();return a&&a.renditions[0]}Ba(){const a=this.oa();return a&&a.renditions[0]}Ua(){return null}hb(){return null}ib(){return null}Ca(){return null}ja(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}oa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ga().find(c=>c.id===b)||null)}return a}$a(){this.h.warn("Video tracks unavailable on Cast")}ra(a){a&&this.f&&
64
+ this.f.setActiveById(+a.id)}Ea(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Pa(){this.h.warn("Video renditions unavailable on Cast")}Ya(a){this.ra(a&&a.track)}Za(a){this.Ea(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield $Q(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
65
+ c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),LR(b)}catch(e){throw b.h.warn("failed on track",a),e;}}})}ma(){return!0}w(){this.f=JR().getAudioTracksManager();var a=this.f.getTracks();this.g=KR(_.K,a);LR(this);a=this.m.getConfiguration();MR(this,_.K,a.preferredAudioLanguage,a.preferredAudioRole);MR(this,_.J,a.preferredTextLanguage,a.preferredTextRole)}};gS.prototype.isAbrEnabled=gS.prototype.ma;
66
+ gS.prototype.addTextTrack=gS.prototype.addTextTrack;gS.prototype.setTextRendition=gS.prototype.Za;gS.prototype.setAudioRendition=gS.prototype.Ya;gS.prototype.setVideoRendition=gS.prototype.Pa;gS.prototype.setTextTrack=gS.prototype.Ea;gS.prototype.setAudioTrack=gS.prototype.ra;gS.prototype.setVideoTrack=gS.prototype.$a;gS.prototype.getTextTrack=gS.prototype.oa;gS.prototype.getAudioTrack=gS.prototype.ja;gS.prototype.getVideoTrack=gS.prototype.Ca;gS.prototype.getLoadingTextRendition=gS.prototype.ib;
67
+ gS.prototype.getLoadingAudioRendition=gS.prototype.hb;gS.prototype.getLoadingVideoRendition=gS.prototype.Ua;gS.prototype.getTextRendition=gS.prototype.Ba;gS.prototype.getAudioRendition=gS.prototype.Ia;gS.prototype.getVideoRendition=gS.prototype.ka;gS.prototype.getTextTracks=gS.prototype.ga;gS.prototype.getAudioTracks=gS.prototype.getAudioTracks;gS.prototype.getVideoTracks=gS.prototype.getVideoTracks;var hS=class extends _.Ns{constructor(){super();this.h=new _.Q(SQ);this.g=this.w=_.Ok();this.A=null;this.l=-1;this.F=new _.So;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.w=b);a=NR();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new cS(this);this.a.init();this.j=new gS;this.j.initialize(this);this.o=new fS(c=>this.trigger(c));this.o.init()}unload(){const a=
68
+ cast.framework.messages.PlayerState,b=NR();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.w(function*(){a.B=null;a.w=_.Ok();a.g=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=NR();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
69
+ a.play();return Promise.resolve()}pause(){const a=NR();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return NR().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return NR().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=NR();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(KQ);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}getMediaPosition(){return NR().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
70
+ NR().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return NR().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;NR().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
71
+ null}getLoadedSource(){const a=NR().getMediaInformation();if(a){var b=NR().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Kh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return NR().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=NR().getLiveSeekableRange();
72
+ b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.ht}getStats(){var a=_.Dn();if(this.f){a=NR().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
73
+ this;return _.w(function*(){b.f=new _.ft;b.a.l=b.f.a;b.A=_.Wn(a);b.g=_.Qk(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.r&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:YQ(b.g),local:!0};yield NR().load(d)}})}getBufferInfo(){this.h.warn(_.qa);return new _.Ms}getTrackManager(){return this.j}getConfiguration(){return this.g}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setNetworkEngine(a){this.F=
74
+ a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return SQ}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.h.warn(OQ)}onError(a){a=new _.C(_.Vd,{detail:a});this.trigger(a)}canPlay(){return _.ak()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=YQ(this.getStats());var b=NR(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
75
+ b&&(this.h.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=NR().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
76
+ a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=ZQ(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;QR(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};hS.prototype.getTextDisplayer=hS.prototype.getTextDisplayer;hS.prototype.getNetworkEngine=hS.prototype.getNetworkEngine;
77
+ hS.prototype.setNetworkEngine=hS.prototype.setNetworkEngine;var SR=class{constructor(){this.a=!1;this.h=new _.Q(TQ);this.f=this.m=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.as;this.l=null}init(a){a&&(this.f=new hS,_.$o(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.Qn&&(yield XQ(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=UR(),b=UR().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
78
+ c.customNamespaces={};c.customNamespaces[VQ]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
79
+ this.A);a.start(c);a.addCustomMessageListener(VQ,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=UR();UR().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(VQ,this.w);a.stop();this.m=this.f=null}}gd(a){this.j=a}lh(a){this.l=a}on(a,b){UR().addEventListener(a,b)}off(a,b){UR().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Yd&&this.g.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.g.delete(a)}sendMessage(a,
80
+ b){UR().sendCustomMessage(VQ,b,YQ(a))}ec(){return this.a}gb(){var a;return a=(a=UR().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return WR(this,a);try{var b=(new DOMParser).parseFromString(a,_.Rf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=UR();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);for(var f=e.length-
81
+ 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.t||g===_.p){g=e[f].getAttribute(_.xe);var h=e[f].getElementsByTagName(_.Bb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.xe)||g,m=h[k].getAttribute(_.rd);let n=h[k].getAttribute(_.xg)||void 0,q=h[k].getAttribute(_.Zd)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.Bb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ha).length||a.removeChild(c[d])}return a=
82
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Ib)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=UR();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.zb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.gb)||void 0,h=e[f].getAttribute(_.fb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.kg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.zb).length||a.removeChild(c[d])}a=
83
+ (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=ZQ(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield CR(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.jp(b.m,d),yield _.kp(b.m),d=b.m.getLoadedSource(),c.media.contentId=
84
+ d.url,c.media.contentType=d.type,d.Db&&(c.media.hlsVideoSegmentFormat=aR(d.Db,_.L)),d.audioMimeType&&(c.media.hlsSegmentFormat=aR(d.audioMimeType,_.K)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=UR().getPlayerManager(),
85
+ c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.mp(this.m)}}B(a){if(0<this.g.size){const b=ZQ(a.data);this.g.forEach(c=>c(b))}}};_.x(TQ,SR);SR.prototype.getContentMetadata=SR.prototype.gb;SR.prototype.isApiReady=SR.prototype.ec;SR.prototype.sendMessage=SR.prototype.sendMessage;SR.prototype.removeMessageListener=SR.prototype.removeMessageListener;
86
+ SR.prototype.addMessageListener=SR.prototype.addMessageListener;SR.prototype.off=SR.prototype.off;SR.prototype.on=SR.prototype.on;SR.prototype.setLoadRequestDataInterceptor=SR.prototype.lh;SR.prototype.setPlayerConfigInterceptor=SR.prototype.gd;SR.prototype.stop=SR.prototype.stop;SR.prototype.start=SR.prototype.start;SR.prototype.init=SR.prototype.init;SR.getInstance=TR;var RR=null;var iS=class{constructor(a){this.f=a;this.a=null;this.g=new _.as;this.j=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.w(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.l.bind(a);for(const d of a.j)a.g.on(b,d,c)}})}start(){return _.w(function*(){})}resume(){this.a&&
87
+ this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(WQ,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}dispose(){const a=this;
88
+ return _.w(function*(){a.g.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.C(_.tc,{adsTimeline:new dS(a.breaks)})));break;case "isPlayingBreak":a.value?ZR(this,_.bc):(ZR(this,_.gc),ZR(this,_.qc),ZR(this,_.cc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(ZR(this,_.gc),ZR(this,_.qc)),ZR(this,_.pc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?ZR(this,_.lc):ZR(this,_.nc))}}};iS.prototype.getPosition=iS.prototype.getPosition;
89
+ iS.prototype.setVolume=iS.prototype.setVolume;iS.prototype.getVolume=iS.prototype.getVolume;iS.prototype.skip=iS.prototype.skip;iS.prototype.pause=iS.prototype.pause;iS.prototype.resume=iS.prototype.resume;var jS=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}isSupported(a,b){return a.namespace()!==_.kd?!1:!(!b||!b.ima)}create(a){return new iS(a.a)}};jS.prototype.create=jS.prototype.create;jS.prototype.isSupported=jS.prototype.isSupported;jS.prototype.name=jS.prototype.name;_.lo(new jS);var kS=class{name(){return"clpp.cast.ads.AdsManagerFactory"}isSupported(a,b){return TR().ec()?!(!b||!b.ima):!1}create(a){return new eS(a)}};kS.prototype.create=kS.prototype.create;kS.prototype.isSupported=kS.prototype.isSupported;kS.prototype.name=kS.prototype.name;_.lo(new kS);};f.call(g, window);