(()=>{"use strict";class e{static enabled(){var e;return"on"===(null===(e=o.extractCookieValue(null===document||void 0===document?void 0:document.cookie,"APP_DEBUG"))||void 0===e?void 0:e.toLowerCase())}static log(...t){e.enabled()&&console.log(`${CBS.Registry.chromecast.receiver_id}:`,...t)}static debug(...t){e.enabled()&&console.debug(`${CBS.Registry.chromecast.receiver_id}:`,...t)}static error(...e){console.error(`${CBS.Registry.chromecast.receiver_id}:`,...e)}static warn(...e){console.warn(`${CBS.Registry.chromecast.receiver_id}:`,...e)}static info(...e){console.info(`${CBS.Registry.chromecast.receiver_id}:`,...e)}}const t="LIVE",a=["/watch/","/trailer/"];class o{static setTagVO(e){o.$tagVO=e}static gettagVO(){return o.$tagVO}static updateTagVOProp(e,t){o.$tagVO[e]=Object.assign(Object.assign({},o.$tagVO[e]),t)}static setRegistry(e){o.$registry=e}static getRegistry(){return o.$registry}static getContentID(){var e,t;const a=o.getMediaInformationFromPage();return null!==(t=null===(e=null==a?void 0:a.CONTENT)||void 0===e?void 0:e.refIdForCast)&&void 0!==t?t:""}static getContentType(){var e,t;const a=o.getMediaInformationFromPage();return(null==a?void 0:a.CONTENT)&&((null===(e=a.CONTENT.drm)||void 0===e?void 0:e.enabled)||["Trailer","Clip"].includes(null===(t=(a.CONTENT.metadata||[])[0])||void 0===t?void 0:t.mediaType))?"application/dash+xml":"application/x-mpegurl"}static isLive(){var e,t;const a=o.getMediaInformationFromPage();return null!==(t=null===(e=null==a?void 0:a.CONTENT)||void 0===e?void 0:e.isLive)&&void 0!==t&&t}static isLiveStreamType(e){return(e+"").toLowerCase()===t.toLowerCase()}static getDAIStreamKey(){var e,t,a;const s=o.getMediaInformationFromPage();return null!==(a=null===(t=null===(e=null==s?void 0:s.CONTENT)||void 0===e?void 0:e.metadata[0])||void 0===t?void 0:t.daistreamKey)&&void 0!==a?a:""}static getVideoProperties(){var e,t,a;const s=o.getMediaInformationFromPage();return null!==(a=null===(t=null===(e=null==s?void 0:s.CONTENT)||void 0===e?void 0:e.metadata[0])||void 0===t?void 0:t.videoProperties)&&void 0!==a?a:[]}static getContinuousPlay(){const e=`continuous_play_${CBS.Registry.user.profile_id}`,t=localStorage.getItem(e);return"true"===t||!t}static getCBSCookie(){return o.getCookie("CBS_COM")}static getMediaInformationFromPage(){return o.gettagVO()&&o.gettagVO().params?o.gettagVO().params:{}}static getCookie(e){const t=document.cookie.split(";");for(const a of t){const t=a.split("="),o=decodeURIComponent(t[0].trim()),s=t.length>1?t[1]:"";if(o===e)return decodeURIComponent(s)}return""}static getCustomDataObject(){var e,t,a;const s={};if(o.isLive()){if(o.getStationName())s.stationName=o.getStationName();else{switch(o.getStreamType()){case"cbsn":s.liveContent="CBSN";break;case"etl":s.liveContent="ETL";break;case"sports_hq":s.liveContent="SPORTS_HQ";break;case"live_stream":s.liveContent="LIVE_STREAM"}}o.getLatitude()&&(s.latitude=parseFloat(o.getLatitude())),o.getLongitude()&&(s.longitude=parseFloat(o.getLongitude()))}const i=o.getAdSessionValues();i&&(s.video_ad_session_values=i);const n=o.getMVPDAuthZObj();return n&&n.mvpd_name&&""!==n.mvpd_name&&(s.mvpd=n.mvpd_name,s.mvpd_name=n.mvpd_display_name),s.vguid=null!==(e=window.__page_uuid)&&void 0!==e?e:"",s.ptype=null!==(a=null===(t=window.utag_data)||void 0===t?void 0:t.pageType)&&void 0!==a?a:"",s}static getCoords(){var e,t,a;return o.getRegistry()&&o.getRegistry().location?o.getRegistry().location.coords:o.getLocation()&&(null===(e=o.getLocation())||void 0===e?void 0:e.coords)&&null!==(a=null===(t=o.getLocation())||void 0===t?void 0:t.coords)&&void 0!==a?a:null}static getLatitude(){var e;const t=o.getCoords();return null!==(e=null==t?void 0:t.latitude)&&void 0!==e?e:""}static getLongitude(){var e;const t=o.getCoords();return null!==(e=null==t?void 0:t.longitude)&&void 0!==e?e:""}static getStationName(){var e,t;const a=o.getMediaInformationFromPage();return null!==(t=null===(e=null==a?void 0:a.CONTENT)||void 0===e?void 0:e.stationName)&&void 0!==t?t:""}static setLocation(e){o.$geolocation=e}static getLocation(){return o.$geolocation}static getAdSessionValues(){const e={},t=o.getCookie("CBS_ADV_VAL"),a=o.getCookie("CBS_ADV_SUBSES_VAL");if(null!=t&&""!==t&&(e.session=t),null!=a&&""!==a&&(e.subses=a),Object.keys(e).length)return e}static getUserId(){var e,t;return null===(t=null===(e=o.getRegistry())||void 0===e?void 0:e.user)||void 0===t?void 0:t.id}static getMarketingCloudUserId(){var e;return null===(e=window.s)||void 0===e?void 0:e.marketingCloudVisitorID}static getStreamType(){var e,t,a,s;return null!==(s=null===(a=null===(t=null===(e=o.getRegistry())||void 0===e?void 0:e.paramsVO)||void 0===t?void 0:t.setByPage)||void 0===a?void 0:a.streamType)&&void 0!==s?s:""}static isEmptyObject(e){return!e||0===Object.keys(e).length}static getMVPDAuthZObj(){const t=o.getCookie("mvpd_authz");try{const e=JSON.parse(t);if(e&&"object"==typeof e)return e}catch(a){e.warn(`Error parsing mvpd_authz cookie: ${t}`)}return null}static extractCookieValue(e,t){const a=new RegExp(`\\b${t}\\b`,"gi");return-1===e.search(a)?null:decodeURIComponent(e.substr(e.search(a)+t.length+1).substr(0,e.substr(e.search(a)+t.length+1).search(/(&|;|$)/)))}static indexOfSkipURI(e){return a.find((t=>e.indexOf(t)>=0))}static isMovie(e){return 1===e}static getFormattedAdBreaks(e,t){const a=[];if(Array.isArray(e)){let o;for(let s=0;s<e.length;s++)o=Object.assign({},e[s]),o.startMediaTime=o.startTime=parseInt(`${o.position}`,10),o.position="post",0===Math.floor(o.startTime)?o.position="pre":o.startTime>0&&o.startTime<t&&(o.position="mid"),o.isUnwatched=o.isWatched,o.durationMediaTime=o.duration,o.index=s+1,a.push(o)}return a}static clamp(e,t,a){return Math.min(Math.max(e,t),a)}}class s{constructor(){this.defaultAppID=CBS.Registry.chromecast.receiver_id,this.$disconnectTime=0,this.$soundSettings=null,this.currentContentId="",this.liveEdgeDelta=10,this.liveEdgeSeekDelta=1,this.liveSeekableRange=null}init(e,t=this.defaultAppID,a=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED){this.$castToLocal=e,this.$castContext=cast.framework.CastContext.getInstance(),this.$remotePlayer=new cast.framework.RemotePlayer,this.$remotePlayerController=new cast.framework.RemotePlayerController(this.$remotePlayer),this.$castContext.setOptions({receiverApplicationId:t,autoJoinPolicy:a}),this.addEventListeners(),this.$castToLocal.enable()}get volumeLevel(){return this.$remotePlayer.volumeLevel}get currentCastSession(){var e;return null===(e=this.$castContext)||void 0===e?void 0:e.getCurrentSession()}get castSessionID(){var e;return null===(e=this.currentCastSession)||void 0===e?void 0:e.getSessionId()}get mediaSession(){var e,t;return null!==(t=null===(e=this.currentCastSession)||void 0===e?void 0:e.getMediaSession())&&void 0!==t?t:null}get pageURI(){var e,t;return null===(t=null===(e=this.mediaInfo)||void 0===e?void 0:e.customData)||void 0===t?void 0:t.page_uri}get mediaInfo(){var e;return null===(e=this.mediaSession)||void 0===e?void 0:e.media}get castDeviceName(){var e,t;return null===(t=null===(e=this.currentCastSession)||void 0===e?void 0:e.getCastDevice())||void 0===t?void 0:t.friendlyName}get mediaTitle(){return this.$remotePlayer.title}get mediaDuration(){var e;return null===(e=this.mediaInfo)||void 0===e?void 0:e.duration}get breaks(){var e;return null===(e=this.mediaInfo)||void 0===e?void 0:e.breaks}get currentTime(){var e;return null===(e=this.mediaSession)||void 0===e?void 0:e.getEstimatedTime()}get playerState(){return this.$remotePlayer.playerState}requestSession(){this.$castContext&&this.$castContext.requestSession()}loadRequest({contentId:t,contentType:a,startTime:s,cbs_com_cookie:i,isLive:n,userId:r,marketingCloudUserId:l,daistreamKey:c,videoProperties:d}={}){var u;t&&this.currentCastSession||e.error("Valid params needed to make a loadRequest");const m=new chrome.cast.media.MediaInfo(t,a);m.streamType=n?chrome.cast.media.StreamType.LIVE:chrome.cast.media.StreamType.BUFFERED;const g=o.getCustomDataObject();if(g.cbs_com_cookie=i,g.userId=r,g.marketingCloudUserId=l,g.daistreamKey=c||"",g.videoProperties=d||[],g.region=CBS.Registry.region,g.continuousPlay=o.getContinuousPlay(),this.$castToLocal.getCaptionsStyle()&&this.$castToLocal.getCaptionsStyle().language){const e=this.$castToLocal.getCaptionsStyle();g.captionsLanguage=e.language,m.textTrackStyle=this.processTextTrackStyles(e)}this.$castToLocal.getAudioTrackInfo()&&this.$castToLocal.getAudioTrackInfo().language?g.audioLanguage=this.$castToLocal.getAudioTrackInfo().language:g.audioLanguage="en",this.$castToLocal.getAudioTrackInfo()&&this.$castToLocal.getAudioTrackInfo().type&&(g.audioTrackRole=this.$castToLocal.getAudioTrackInfo().type),m.metadata=new chrome.cast.media.GenericMediaMetadata,m.customData=g;const v=new chrome.cast.media.LoadRequest(m);return v.currentTime=s,null===(u=this.currentCastSession)||void 0===u?void 0:u.loadMedia(v)}seek(e){isNaN(e)||(this.liveSeekableRange&&(e=o.clamp(e,this.liveSeekableRange.start,this.liveSeekableRange.end)),this.$remotePlayer.currentTime=e,this.$remotePlayerController.seek())}play(){this.$remotePlayer.isPaused&&this.$remotePlayerController.playOrPause()}pause(){this.$remotePlayer.isPaused||this.$remotePlayerController.playOrPause()}mute(e){this.$remotePlayer.isMuted!==e&&this.$remotePlayerController.muteOrUnmute()}isConnected(){return!!this.$castContext&&(this.$castContext.getCastState()===cast.framework.CastState.CONNECTING||this.$castContext.getCastState()===cast.framework.CastState.CONNECTED)}reconnectLocalToCast(){this.$castToLocal.connecting()}setVolume(e){!isNaN(e)&&e>=0&&(this.$remotePlayer.volumeLevel=Math.min(e,1),this.$remotePlayerController.setVolumeLevel())}castMedia(){var t,a,s,i;return this.$castToLocal.connect(),this.syncVolumeToSender(),this.isConnected()&&!this.mediaInfo?(e.debug("Starting new session"),void this.processLoadRequest()):this.isConnected()&&o.getContentID()!==(null===(t=this.mediaInfo)||void 0===t?void 0:t.contentId)?(e.debug("Joining existing session with new content",{old:this.mediaInfo,new:null===(s=null===(a=o.getMediaInformationFromPage())||void 0===a?void 0:a.CONTENT)||void 0===s?void 0:s.metadata}),void this.processLoadRequest()):void(o.getContentID()===(null===(i=this.mediaInfo)||void 0===i?void 0:i.contentId)&&(e.debug("Joining existing session with same content",this.mediaInfo),this.onLoadSuccess(),this.setMetaInfo()))}updateCaptions(e,t=null,a=null){this.updateTracks(chrome.cast.media.TrackType.TEXT,e,t,a)}updateAudioTracks(e,t,a){this.updateTracks(chrome.cast.media.TrackType.AUDIO,e,t,null,a)}syncVolumeToSender(){var e,t,a;this.$soundSettings?(this.setVolume(this.$soundSettings.volume),this.mute(this.$soundSettings.mute)):this.$castToLocal.volumeChange((null===(e=this.currentCastSession)||void 0===e?void 0:e.getVolume())||0,null!==(a=null===(t=this.currentCastSession)||void 0===t?void 0:t.isMute())&&void 0!==a&&a)}setMetaInfo(){let e="",t={};const a=this.mediaTitle;this.mediaInfo&&(e=this.mediaInfo.streamType,this.mediaInfo.metadata&&(t=this.mediaInfo.metadata)),this.$castToLocal.setMetaInfo(a,e,t)}onLoadSuccess(){var a,s;this.$disconnectTime=0,this.$castToLocal.loadSuccess(this.playerState,this.castDeviceName,this.castSessionID,this.mediaDuration,this.breaks),this.liveSeekableRange=null;const{CONTENT:i}=o.getMediaInformationFromPage();this.$castToLocal.setStreamType((null==i?void 0:i.isLive)?(null===(s=null===(a=null==i?void 0:i.metadata)||void 0===a?void 0:a[0].videoProperties)||void 0===s?void 0:s.includes("DVR"))?"DVR":t:"VOD"),this.addSessionMessageListeners(),e.debug("Finished content load")}onLoadFailure(t){e.error("Content load failed",t),this.$castToLocal.loadFailure()}addSessionMessageListeners(){const e=this.$castContext.getCurrentSession();if(!e)throw new Error("Cannot set up listeners when session is undefined");e.addMessageListener("urn:x-cast:livetimeshifting",((e,t)=>this.liveSeekableRange=JSON.parse(t)))}addEventListeners(){if(!this.$castContext)throw new Error("castContext not defined");if(this.$castContext.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,(e=>{e&&(e.sessionState,cast.framework.SessionState.SESSION_ENDING)})),this.$castContext.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,(e=>{!e||e.castState!==cast.framework.CastState.CONNECTED&&e.castState!==cast.framework.CastState.CONNECTING||this.$soundSettings||(this.$soundSettings=Object.assign({},this.$castToLocal.getSoundSettings()))})),!this.$remotePlayerController)throw new Error("remotePlayerController not defined");this.$remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,(e=>{var t,a,o,s,i,n,r;if(!(null==e?void 0:e.value))return;if(""!==this.currentContentId){if((null===(t=e.value)||void 0===t?void 0:t.contentId)&&this.currentContentId!==e.value.contentId&&e.value.streamType&&(null===(o=null===(a=e.value.customData)||void 0===a?void 0:a.video)||void 0===o?void 0:o.url))return this.currentContentId=e.value.contentId,void this.$castToLocal.newMediaSession(e.value.customData.video.url,e.value.contentId)}else this.currentContentId=e.value.contentId;if(!this.mediaInfo)return;const l=this.mediaInfo.tracks||[],c={ids:(null===(s=this.mediaSession)||void 0===s?void 0:s.activeTrackIds)||[],text:[],audio:[]};if(l.length){if(l.forEach((e=>{-1!==c.ids.indexOf(e.trackId)&&[chrome.cast.media.TrackType.TEXT,chrome.cast.media.TrackType.AUDIO].includes(e.type)&&c[e.type.toLowerCase()].push(e)})),null===(i=this.$castToLocal.getCaptionsStyle())||void 0===i?void 0:i.language){const e=Object.assign(Object.assign({},this.$castToLocal.getCaptionsStyle()),c.text.length&&{language:null===(n=c.text[0])||void 0===n?void 0:n.language});this.$castToLocal.setCaptionsStyle(e)}c.audio.length&&this.$castToLocal.setAudioTrack(c.audio[0])}this.$castToLocal.setMediaTracksData(l,null===(r=this.mediaSession)||void 0===r?void 0:r.activeTrackIds)})),this.$remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.TITLE_CHANGED,(()=>{this.setMetaInfo()})),this.$remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED,(e=>{e&&!1!==e.value?e&&!0===e.value&&this.$castToLocal.connecting():(this.$castToLocal.disconnectConnect(this.$disconnectTime||0),this.$soundSettings=null)})),this.$remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED,(e=>{var t,a;e&&this.$castToLocal.volumeChange(e.value,null!==(a=null===(t=this.currentCastSession)||void 0===t?void 0:t.isMute())&&void 0!==a&&a)})),this.$remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED,(e=>{e&&this.$castToLocal.muteOrUnmute(e.value)})),this.$remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,(e=>{if(!(null==e?void 0:e.value)||e.value<=0)return;const t=this.liveSeekableRange?e.value+this.liveEdgeDelta>=this.liveSeekableRange.end?e.value:this.liveSeekableRange.end:this.mediaDuration;this.$castToLocal.currentTimeChange(e.value,t),this.$disconnectTime=e.value})),this.$remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.ANY_CHANGE,(t=>e.debug(t))),this.$remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED,(e=>{e&&this.$castToLocal.playerStateChange(e.value)})),this.$remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,(e=>{e&&e.value?this.$castToLocal.adBreakStart():this.$castToLocal.adBreakEnd()}))}processLoadRequest(){var t;e.debug("Starting content load",o.getMediaInformationFromPage()),null===(t=this.loadRequest({contentId:o.getContentID(),contentType:o.getContentType(),startTime:this.resolveStartTime(),cbs_com_cookie:o.getCBSCookie(),isLive:o.isLive(),userId:o.getUserId(),marketingCloudUserId:o.getMarketingCloudUserId(),daistreamKey:o.getDAIStreamKey(),videoProperties:o.getVideoProperties()}))||void 0===t||t.then((()=>this.onLoadSuccess()),(e=>this.onLoadFailure(e)))}resolveStartTime(){return this.mediaInfo&&o.isLive()?(e.debug("Starting content from the start"),0):(e.debug("Using load start time",this.$castToLocal.getLoadStartTime()),this.$castToLocal.getLoadStartTime())}processTextTrackStyles(e){const t=new chrome.cast.media.TextTrackStyle;return t.backgroundColor=e.windowColor,t.edgeType=e.edgeType,t.fontFamily=e.fontFamily,t.fontGenericFamily=chrome.cast.media.TextTrackFontGenericFamily.SANS_SERIF,t.fontScale=e.fontScale,t.fontStyle=e.customData.fontStyle?e.customData.fontStyle.toUpperCase():chrome.cast.media.TextTrackFontStyle.NORMAL,t.fontSize=e.customData.fontSize?e.customData.fontSize:20,t.foregroundColor=e.foregroundColor,t.windowColor=e.windowColor,t.windowType=chrome.cast.media.TextTrackWindowType.ROUNDED_CORNERS,t}updateTracks(e,t,a,o=null,s=null,i=(()=>{}),n=(()=>{})){var r,l,c;const d="string"==typeof a?[a]:null!=a?a:[];if(this.mediaInfo){const u=this.mediaInfo.tracks;let m,g=(null===(r=this.mediaSession)||void 0===r?void 0:r.activeTrackIds)||[];const v=g.filter((t=>{const a=u.find((e=>e.trackId===t));if(a&&!a.type&&-1!==a.trackContentType.indexOf("mp4a")&&(a.type=chrome.cast.media.TrackType.AUDIO),a&&a.type!==e)return!0}));if(g=v||[],t){if(d)for(let e=0;e<d.length;e++)d[e]=(d[e]+"").toLowerCase();if(o&&(m=this.processTextTrackStyles(o)),u){const t=u.filter((t=>(!t.type&&t.trackContentType&&-1!==t.trackContentType.indexOf("mp4a")&&(t.type=chrome.cast.media.TrackType.AUDIO),t.type===e&&(!a||!!d.find((e=>(e+"").toLowerCase()===(t.language+"").toLowerCase()))))));if(t.length){const e=null===(l=s?t.find((e=>{var t;return(null===(t=null==e?void 0:e.roles)||void 0===t?void 0:t[0])===s})):t[0])||void 0===l?void 0:l.trackId;e&&g.push(e)}}}const h=new chrome.cast.media.EditTracksInfoRequest(g,m);null===(c=this.mediaSession)||void 0===c||c.editTracksInfo(h,i,n)}}}class i{constructor(e){this.$interfaceCastToLocal=e}get interfaceCastToLocal_(){return this.$interfaceCastToLocal}connect(){}disconnectConnect(e=0){}connecting(){}newMediaSession(e,t){}loadSuccess(e,t,a,o,s){}loadFailure(){}setMetaInfo(e,t,{metadataType:a,seriesTitle:o,season:s,episode:i,releaseDate:n}){}setMediaTracksData(e,t){}getLoadStartTime(){return 0}getCurrentTime(){return 0}getSoundSettings(){return null}volumeChange(e,t){}muteOrUnmute(e=!1){}currentTimeChange(e,t){}playerStateChange(e){}adBreakStart(){}adBreakEnd(){}contentStart(){}getCaptionsStyle(){return{}}setCaptionsStyle(e){}getAudioTrackInfo(){return{}}setAudioTrack(e){}enable(){}disable(){}setStreamType(e){}}class n extends i{constructor(e){super(e)}connect(){this.interfaceCastToLocal_.connect()}disconnectConnect(e=0){this.interfaceCastToLocal_.end(e)}connecting(){this.interfaceCastToLocal_.start()}newMediaSession(e,t){e&&e.length>0&&window&&window.location&&!o.indexOfSkipURI(window.location.href+"")&&(window.location.href+"").indexOf(t)<0&&(window.location.href+"").indexOf(e)<0&&(window.location.href=CBS.Registry.region.prefix+e)}loadSuccess(e,t,a,s,i){this.interfaceCastToLocal_.initialize(a,t,s,o.getFormattedAdBreaks(i,s)),this.interfaceCastToLocal_.playerState(e),this.interfaceCastToLocal_.contentStart(),this.interfaceCastToLocal_.adBreaks(o.getFormattedAdBreaks(i,s),s)}setMetaInfo(e,t,{metadataType:a,seriesTitle:s,season:i,episode:n,releaseDate:r}){const l={line1:"",line2:""};if(o.isLiveStreamType(t))l.line1=s,l.line2=e;else if(o.isMovie(a)){if(l.line1=null!=e?e:"",l.line2="",r){const e=new Date(r).getFullYear();l.line2=`${l.line2} ${e}`}}else l.line1=s,l.line2=e,n&&(l.line2=`E${n} ${l.line2}`),i&&(l.line2=`S${i} ${l.line2}`);this.interfaceCastToLocal_.metadata(l)}setMediaTracksData(e,t){this.interfaceCastToLocal_.mediaTracks(e,t)}getLoadStartTime(){const e=this.getCurrentTime(),t=this.getGlobalResumeTime();return e||(t||0)}getCurrentTime(){return this.interfaceCastToLocal_.getCurrentTime()}getGlobalResumeTime(){return this.interfaceCastToLocal_.getGlobalResumeTime()}getSoundSettings(){return this.interfaceCastToLocal_&&this.interfaceCastToLocal_.getSoundSettings?this.interfaceCastToLocal_.getSoundSettings():null}volumeChange(e,t=!1){e>=0&&!isNaN(e)&&(this.interfaceCastToLocal_.volumeUpdate(parseFloat(`${e}`)),this.muteOrUnmute(t))}muteOrUnmute(e=!1){e?this.interfaceCastToLocal_.mute():this.interfaceCastToLocal_.unmute()}currentTimeChange(e,t){e>=0&&!isNaN(e)&&this.interfaceCastToLocal_.playbackProgress(Math.floor(e),t||0)}playerStateChange(e){this.interfaceCastToLocal_.playerState(e)}adBreakStart(){this.interfaceCastToLocal_.adBreakStart()}adBreakEnd(){this.interfaceCastToLocal_.adBreakEnd(),this.contentStart()}contentStart(){this.interfaceCastToLocal_.contentStart()}getCaptionsStyle(){return this.interfaceCastToLocal_.getCaptionsInfo()}setCaptionsStyle(e){e&&this.interfaceCastToLocal_.setCaptions(e)}getAudioTrackInfo(){return this.interfaceCastToLocal_.getAudioTrackInfo()}setAudioTrack(e){this.interfaceCastToLocal_.setAudioTrack(e)}enable(){this.interfaceCastToLocal_.enable()}disable(){this.interfaceCastToLocal_.disable()}setStreamType(e){this.interfaceCastToLocal_.setStreamType(e)}}class r{constructor(e){this.$CastSenderMerica=e}get castSender_(){return this.$CastSenderMerica}readyToCast(){}stopCast(){}castMedia(){}seek(e){}playVideo(){}pauseVideo(){}mute(e){}unmute(e){}setVolume(e){}showCaptions(e){}hideCaptions(e){}updateVolume(e,t=-1){}requestCastSession(){}setCastAudioTrack(e){}setCaptionsStyle(e){}isConnected(){return!1}}class l extends r{constructor(e){super(e),this.hideCaptions=this.showCaptions,this.stopCast=this.requestCastSession}readyToCast(){super.castSender_.isConnected()&&super.castSender_.reconnectLocalToCast()}castMedia(){super.castSender_.castMedia()}seek(e){e&&e.payload&&super.castSender_.seek(e.payload.seekTo)}pauseVideo(){super.castSender_.pause()}playVideo(){super.castSender_.play()}mute(e){e&&this.updateVolume(!0)}unmute(e){e&&this.updateVolume(!1)}setVolume(e){e&&e.payload&&super.castSender_.setVolume(e.payload.volume)}showCaptions(e){let t={};e&&e.payload&&e.payload.ccSettings&&(t=e.payload.ccSettings);const a=void 0!==t.language;super.castSender_.updateCaptions(a,null==t?void 0:t.language,t||null)}updateVolume(e,t=-1){super.castSender_.mute(e),super.castSender_.setVolume(t)}requestCastSession(){super.castSender_.requestSession()}setCastAudioTrack(e){var t,a,o,s;let i,n={};(null===(a=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.audioTrack)||void 0===a?void 0:a.language)&&(n=e.payload.audioTrack,n.type=chrome.cast.media.TrackType.AUDIO,i=null!==(s=null===(o=null==n?void 0:n.roles)||void 0===o?void 0:o[0])&&void 0!==s?s:""),super.castSender_.updateAudioTracks(!(!n||!n.language),null==n?void 0:n.language,`${i}`)}setCaptionsStyle(e){let t={};e&&e.payload&&e.payload.ccSettings&&(t=e.payload.ccSettings);const a=void 0!==t.language;super.castSender_.updateCaptions(a,t?t.language:null,t||null)}isConnected(){return super.castSender_.isConnected()}}window.Chromecast=class{static getHelper(){return o}setSmartTagNameSpace(e,t){e.seek=e=>t.seek.apply(t,[e]),e.play=()=>t.playVideo.apply(t),e.pause=()=>t.pauseVideo.apply(t),e.mute=e=>t.mute.apply(t,[e]),e.unmute=e=>t.unmute.apply(t,[e]),e.setVolume=e=>t.setVolume.apply(t,[e]),e.updateVolume=(e,a=-1)=>t.updateVolume.apply(t,[e,a]),e.showCaptions=e=>t.showCaptions.apply(t,[e]),e.hideCaptions=e=>t.hideCaptions.apply(t,[e]),e.requestSession=()=>t.requestCastSession.apply(t),e.uiReady=()=>t.castMedia.apply(t),e.stopSession=()=>t.stopCast.apply(t),e.setAudioTrack=e=>t.setCastAudioTrack.apply(t,[e]),e.setCaptions=e=>t.setCaptionsStyle.apply(t,[e]),e.isConnected=()=>t.isConnected.apply(t)}start(e,t=null){const a=e.CastToLocalAdapter,i=e.CastNS,r=SmartTag.list[0];o.setRegistry(null===CBS||void 0===CBS?void 0:CBS.Registry),o.setTagVO(r),o.setLocation(t);const c=new s,d=new l(c),u=new n(a);this.setSmartTagNameSpace(i,d),chrome.cast&&c.init(u,CBS.Registry.chromecast.receiver_id,chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED)}}})();
//# sourceMappingURL=sender-f16a08328f922c9ef7be.min.js.map