@castlabs/prestoplay 6.26.0 → 6.28.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 (68) hide show
  1. package/CHANGELOG.md +42 -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 +115 -113
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +623 -623
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +89 -89
  10. package/cjs/cl.externs.js +112 -72
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +78 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +353 -345
  18. package/cjs/cl.muxdata.js +14 -15
  19. package/cjs/cl.onboard.js +4 -3
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -17
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +73 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +38 -38
  33. package/cjs/polyfill.min.js +15 -3
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +6 -5
  37. package/cl.cast.js +93 -90
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +506 -507
  40. package/cl.crypto.js +9 -9
  41. package/cl.dash.js +83 -82
  42. package/cl.externs.js +112 -72
  43. package/cl.freewheel.js +19 -19
  44. package/cl.hls.js +80 -79
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +17 -17
  48. package/cl.mediatailor.js +2 -3
  49. package/cl.mse.js +308 -305
  50. package/cl.muxdata.js +13 -13
  51. package/cl.onboard.js +4 -4
  52. package/cl.persistent.js +11 -11
  53. package/cl.playlist.js +5 -5
  54. package/cl.simid.js +14 -14
  55. package/cl.smooth.js +60 -60
  56. package/cl.thumbnails.js +19 -19
  57. package/cl.tizen.js +57 -57
  58. package/cl.ttml.js +22 -22
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +15 -15
  62. package/cl.vtt.js +12 -12
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +31 -29
  65. package/package.json +1 -1
  66. package/typings.d.ts +115 -63
  67. package/cjs/cl.sessions.js +0 -21
  68. package/cl.sessions.js +0 -10
package/cl.cast.js CHANGED
@@ -1,90 +1,93 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var VV="Cannot seek during ads playout.",WV="Cannot switch track",XV="Media session does not exist.",YV="No receivers available",ZV="Reset ABR functionality not available on cast.",$V="SDK not yet ready",aW="Sender is destroyed.",bW="clpp.cast.CastProxy",cW="clpp.cast.Player",dW="clpp.cast.Receiver",eW="urn:x-cast:castlabs",fW="urn:x-cast:com.google.cast.media",gW=function(a){return _.x(function*(){yield _.Rr(a,_.Je);yield _.Rr(a,_.Ie)})},hW=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.Wd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ee?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.t?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},iW=function(a){if(typeof a!==_.Pf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},jW=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=_.ik(d,a.mimeType,g);f&&g&&(h=_.sj(a.url),(h=yield c.fetch(h).T)&&h.data&&(e=f.a(_.K(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},kW=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 _.rg:return d.FMP4;case _.qg:return b===_.N?d.MPEG2_TS:c.TS;case _.Bc: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}},mW=function(a){a=void 0===a?lW:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.I(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
- b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},nW=function(a,b){return a.h.filter(c=>c.type===b)},pW=function(a,b){const c=oW(a);return nW(a,b).find(d=>c.includes(d.id))||null},rW=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.L){const e=a.ta();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;qW(a,b)},e=>{a.f[b]=null;a.g.debug(WV,e)})}else b===_.L&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{qW(a,b)},e=>{a.g.debug(WV,e)}))},oW=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},qW=function(a,b){b===_.M?a.a.trigger(new _.F(_.Jc)):b===_.L&&a.a.trigger(new _.F(_.Wf))},uW=function(a){if(a)for(const b of sW)tW(b)},tW=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.S.length){a.w=!0;a.o.lf();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da);vW&&a.o.la(.02)}},wW=function(a){return _.x(function*(){sW.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.R=null;a.X=null})},xW=function(a){return _.x(function*(){a.Mb()||(yield cast.framework.CastContext.getInstance().requestSession())})},zW=function(a,b,c){c=
9
- void 0===c?0:c;return _.x(function*(){var d=a.f.ta();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.oa())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield yW(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Ve:a.getPresentationStartTime(),autoplay:b,ib:a.h})})},yW=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield xW(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=kW(b.Zb,_.N);e.hlsSegmentFormat=kW(c,_.M);b.ib&&(a.L&&(c=yield Promise.resolve(a.L(b.ib)))&&(b.ib=c),a.h=b.ib,a.C=_.bp(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.ib.remoteTextTracks&&(c=yield Promise.all(b.ib.remoteTextTracks.map(a.za.bind(a))),e.tracks=c.filter(k=>k),b.ib.remoteTextTracks=void 0),delete b.ib.autoplay,b.ib.startTime=null,e.customData={playerConfiguration:hW(b.ib)});c=a.Eb()||{};
11
- var f=AW(c.metadataType),g;typeof b.Ve===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.Ve});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=BW(c);if(g=CW(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Mc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},CW=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(DW);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=mW(DW[b]);return Object.assign(b,a)},AW=function(a){var b=void 0===b?lW:b;return Object.values(DW).includes(a)?a:b},BW=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},FW=function(a,b){EW(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(eW,a.P)},GW=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.t?null:a):a=
13
- null;a=null===a?null:a+b;return null===a?b:a},EW=function(a,b){a.a=b;a.a&&(a.G.release(),a.F=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.l),a.G.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ia.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.bb.bind(a)),a.j&&a.j.init(),a.trigger(new _.F(_.ne)))},JW=function(a){return new HW(a.h,()=>{a.trigger(new _.F(_.Sc))},(b,c)=>{{const d=a.f.getConfiguration();
14
- d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Ff&&(d.preferredAudioLanguage=c.Ff);c.Gg&&(d.preferredTextLanguage=c.Gg);_.Tr(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>IW(a))},IW=function(a){return _.x(function*(){a.trigger(new _.F(_.Rc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Tr(a.f,a.a))})},MW=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{KW=!1;const e=
15
- _.sj(d),f=yield c.fetch(e).T;if(f&&f.data){const g=_.Si(f.data),h=(new DOMParser).parseFromString(g,_.Vf);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=LW(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=LW(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),KW=!0}}catch(e){_.C("Failed to fetch an ad",
16
- e),KW=!0}})},LW=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},NW=function(a,b){b=new _.I(1,10,10003,{errorType:b});a.m.onError(b)},OW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},QW=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=PW(a,c))&&(d={ad:c});a.m.trigger(new _.F(b,d))}},PW=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=
17
- null,e=null,f;typeof b.breakClipId===_.Pf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Pf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},RW=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,
18
- cast.framework.events.EventType.TIMED_METADATA_EXIT]},SW=function(a){const b=a.dashTimedMetadata;let c=_.jg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.ig)?_.Rh:_.gg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},TW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},VW=function(a){a.a=TW().getTextTracksManager();const b=a.a.getTracks();a.j=UW(_.L,b)},UW=function(a,b){const c=[];for(const d of b)b=
19
- new _.Rj(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Vj(b.id,b)),c.push(b);return c},WW=function(a,b,c,d){c=_.bi(c).filter(g=>g);var e=!1;let f=[];b===_.M?f=a.getAudioTracks():b===_.L&&(f=a.pa());if(c=c.find(g=>{const h=
20
- _.Di(g);return f.some(k=>{k=_.Di(k.language||"");return _.Ei(h,k)})})){const g=_.Di(c);c=f.filter(h=>{h=_.Di(h.language||"");return _.Ei(g,h)});f=c.length?c:f;e=e||!!c.length}_.aj(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.M?a.ya(e):b===_.L&&a.Ua(e))},XW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},$W=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;
21
- b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.Yl(d);if(e){var f=[_.rd];_.bp(a)[0].type!==_.zc&&f.unshift(_.td);d.preferredDrmSystem===_.rd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ja[g];h?(c=g===_.td?cast.framework.ContentProtection.WIDEVINE:g===_.rd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},YW(b,h,a,c),ZW(b,h,a,c)):c()}else c()}else c()},YW=
22
- function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.sj({method:_.db,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},ZW=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.wj(Object.assign({},f.headers),
23
- e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},cX=function(){return aX||(aX=new bX)},dX=function(){return cast.framework.CastReceiverContext.getInstance()},eX=function(){const a=dX().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},fX=function(a,b){const c=dX().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,dX().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},
24
- hX=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=dX();var {hlsVideoSegmentFormat:d}=dX().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.rg:_.qg;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=gX(f,_.pa),h=gX(f,_.lb);let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);
25
- ++e}return d.join("\n")},gX=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},jX=function(a,b){let c=null;const d=iX(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},iX=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=
26
- c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},kX=class{constructor(a,b){this.log=new _.T(b);this.player=a;this.l=null;this.h=_.Wo;this.o=_.kv;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Wo)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===
27
- _.G&&this.a(_.Po)}a(a){if(a!==this.h)if(this.h===_.Po&&a!==_.Wo)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;this.h===_.So?(this.B=b,this.player.trigger(new _.F(_.Oc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.So&&this.player.trigger(new _.F(_.Nc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Ho(this.l,this.h);this.player.trigger(new _.F(_.Mf,
28
- {detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var lW=0,DW={GENERIC:lW,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var lX=class extends kX{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Vb.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)}Vb(){if(this.f&&
29
- this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Oo);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Po);break;default:this.a(_.Wo)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Zo);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Yo);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.So)}}};var mX=class extends _.U{constructor(){super();this.g=new _.T("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.N;break;case chrome.cast.media.TrackType.AUDIO:c=_.M;break;case chrome.cast.media.TrackType.TEXT:c=_.L}c=new _.Rj(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
30
- c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.Vj(c.id,c));return c}):[],this.a.trigger(new _.F(_.bg)))}destroy(){this.a=null}getVideoTracks(){return nW(this,_.N)}getAudioTracks(){return nW(this,_.M)}pa(){return nW(this,_.L)}qa(){const a=this.Fa();return a?a.renditions[0]:null}Oa(){const a=this.oa();return a?a.renditions[0]:null}Sa(){const a=this.ta();return a?a.renditions[0]:
31
- null}rb(){return this.f[_.N]||null}Fb(){return this.f[_.M]||null}Gb(){return this.f[_.L]||null}Fa(){return pW(this,_.N)}oa(){return pW(this,_.M)}ta(){return pW(this,_.L)}Ab(a){rW(this,_.N,a)}ya(a){rW(this,_.M,a)}Ua(a){rW(this,_.L,a)}jb(a){this.Ab(a&&a.track)}yb(a){this.ya(a&&a.track)}zb(a){this.Ua(a&&a.track)}addTextTrack(){return _.x(function*(){})}va(){return!0}};mX.prototype.isAbrEnabled=mX.prototype.va;mX.prototype.addTextTrack=mX.prototype.addTextTrack;mX.prototype.setTextRendition=mX.prototype.zb;
32
- mX.prototype.setAudioRendition=mX.prototype.yb;mX.prototype.setVideoRendition=mX.prototype.jb;mX.prototype.setTextTrack=mX.prototype.Ua;mX.prototype.setAudioTrack=mX.prototype.ya;mX.prototype.setVideoTrack=mX.prototype.Ab;mX.prototype.getTextTrack=mX.prototype.ta;mX.prototype.getAudioTrack=mX.prototype.oa;mX.prototype.getVideoTrack=mX.prototype.Fa;mX.prototype.getLoadingTextRendition=mX.prototype.Gb;mX.prototype.getLoadingAudioRendition=mX.prototype.Fb;mX.prototype.getLoadingVideoRendition=mX.prototype.rb;
33
- mX.prototype.getTextRendition=mX.prototype.Sa;mX.prototype.getAudioRendition=mX.prototype.Oa;mX.prototype.getVideoRendition=mX.prototype.qa;mX.prototype.getTextTracks=mX.prototype.pa;mX.prototype.getAudioTracks=mX.prototype.getAudioTracks;mX.prototype.getVideoTracks=mX.prototype.getVideoTracks;var HW=class extends _.vu{constructor(a,b,c,d){super();this.g=new _.T(_.dd);this.S=a;this.o=new _.wk(b);this.R=c;this.X=d;this.h=this.I=_.wl();this.C=[];this.B=0;this.K=new _.Dr;this.F=this.l=this.a=null;this.A=this.w=!1;this.ba="";this.fa=1E6;this.f=new mX;this.f.initialize(this);this.j=new lX(this);this.G=new _.Rt;this.J=null;this.H=new Set;this.M=this.Ka.bind(this);this.da=this.Db.bind(this);this.V=this.Cb.bind(this);this.P=this.Wa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
34
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{uW(!0)},0)}});tW(this);sW.add(this)}init(a,b){this.h=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.$a)}appendLoad(){return Promise.reject(_.$a)}seekWith(){return Promise.reject(_.$a)}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}destroy(){return _.x(function*(){})}Gd(a){this.L=
35
- a}xc(){return this.w}Mb(){return this.A}Ge(){return this.ba}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,hW(b))}catch(f){d=new _.I(1,8,8E3,{detailedErrorCode:f})}else d=new _.I(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.x(function*(){if(!a.xc())throw a.g.warn($V),new _.I(1,8,8001,void 0);if(!vW)throw a.g.warn(YV),new _.I(1,8,8002,void 0);if(a.Mb())throw a.g.warn("Already casting"),
36
- new _.I(1,8,8003,void 0);try{yield xW(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.I(1,8,8E3,c);}})}Fe(){this.Mb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Wd&&this.H.add(a)}removeMessageListener(a){typeof a===_.Wd&&this.H.delete(a)}play(){return this.isEnded()?zW(this,!0):new Promise((a,b)=>{if(!this.a)return b(XV);this.a.play(null,
37
- a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(XV);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Oo}seek(a){return this.isEnded()?zW(this,!1,a):new Promise((b,c)=>{this.a||c(XV);this.l.isPlayingBreak&&c(VV);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.lg));this.a.seek(d,()=>{this.trigger(new _.F(_.kg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
38
- this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.t?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(fW,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
39
- this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.t?null:1E-8===a?0:a}getSeekRange(){let a=
40
- {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.kv}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?iW(this.a.customData.stats):_.Lo()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.xc())if(vW){b.C=_.bp(a);b.h=_.yl(b.I,a);var c=b.C[b.B];yield yW(b,{source:c,
41
- isLive:c.isLive,autoplay:b.h.autoplay,ib:b.h,Zb:c.Zb,audioMimeType:c.audioMimeType})}else b.g.warn(YV);else b.g.warn($V)})}getBufferInfo(){return new _.uu}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(ZV)}onError(a){if(a&&
42
- (this.trigger(new _.F(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.dd}canPlay(){return this.xc()?2:0}Eb(){return this.J}Yb(a){this.J=CW(a)}Be(){this.J=null}ff(a){const b=this.Eb()||{};a={metadataType:AW(b.metadataType),title:a};this.Yb(Object.assign({},b,a))}df(a){const b=this.Eb()||{},c=AW(b.metadataType);a=new chrome.cast.Image(a);this.Yb(Object.assign({},b,{metadataType:c,images:[a]}))}cf(a){const b=this.Eb()||{};this.Yb(Object.assign({},b,{metadataType:3,artist:a}))}ef(a){const b=
43
- this.Eb()||{};a={metadataType:AW(b.metadataType),releaseDate:a};this.Yb(Object.assign({},b,a))}Ka(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;vW=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.ba=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.lf()}Db(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;FW(this,a.session);break;
44
- case cast.framework.SessionState.SESSION_RESUMED:this.Mb()||(this.A=!0,FW(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.oa(),c=this.f.ta();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:GW(this),Gg:c,Ff:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(eW,
45
- this.P);this.A=!1;this.a=null;this.G.release();this.l=this.F=null}}Cb(a){this.g.debug("New media session",a.mediaSession);EW(this,a.mediaSession)}bb(a){a.value&&a.value.tracks&&this.f&&this.f.load()}Wa(a,b){if(a===eW&&0<this.H.size){const c=iW(b);this.H.forEach(d=>d(c))}}ia(){this.trigger(new _.F(_.ag))}za(a){const b=this;return _.x(function*(){let c=null;const d=yield jW(a,[_.Uf,_.yc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.fa++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=
46
- d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}},vW=!1,sW=new Set;window.__onGCastApiAvailable=uW;var nX=class extends _.vu{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Wd?c:this.l;this.a=JW(this);this.g=new _.T(bW);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield wW(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&a!==_.Oo&&a!==_.Wo&&(delete b.license,this.f.load(b))}ye(){return!!this.a&&this.a.xc()&&vW}Mb(){return!!this.a&&this.a.Mb()}Ge(){return this.a?this.a.Ge():""}Gd(a){this.a&&this.a.Gd(a)}cast(a){const b=
47
- this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.oa();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.ta();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=
48
- e&&typeof e.isLive===_.Mc?e.isLive:b.f.isLive();d={source:e,isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Ve:b.f.getPresentationStartTime(),Zb:h,audioMimeType:k,ib:l}}var c=d}yield IW(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield yW(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.F(_.r,{detail:d}),b.trigger(c)}})}Fe(){this.a&&this.a.Fe()}ih(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield wW(b.a)),
49
- b.a=JW(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?yield b.a.sendMessage(eW,a):b.g.warn(aW)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(aW)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(aW)}Eb(){return this.a&&this.a.Eb()}Yb(a){this.a&&this.a.Yb(a)}Be(){this.a&&this.a.Be()}ff(a){this.a&&this.a.ff(a)}df(a){this.a&&this.a.df(a)}cf(a){this.a&&this.a.cf(a)}ef(a){this.a&&this.a.ef(a)}};_.z(bW,nX);
50
- nX.prototype.setContentReleaseDate=nX.prototype.ef;nX.prototype.setContentArtist=nX.prototype.cf;nX.prototype.setContentImage=nX.prototype.df;nX.prototype.setContentTitle=nX.prototype.ff;nX.prototype.clearContentMetadata=nX.prototype.Be;nX.prototype.setContentMetadata=nX.prototype.Yb;nX.prototype.getContentMetadata=nX.prototype.Eb;nX.prototype.removeMessageListener=nX.prototype.removeMessageListener;nX.prototype.addMessageListener=nX.prototype.addMessageListener;nX.prototype.sendMessage=nX.prototype.sendMessage;
51
- nX.prototype.changeReceiverId=nX.prototype.ih;nX.prototype.forceDisconnect=nX.prototype.Fe;nX.prototype.cast=nX.prototype.cast;nX.prototype.setPlayerConfigInterceptor=nX.prototype.Gd;nX.prototype.getReceiverName=nX.prototype.Ge;nX.prototype.isCasting=nX.prototype.Mb;nX.prototype.canCast=nX.prototype.ye;nX.prototype.destroy=nX.prototype.destroy;var oX=class extends kX{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.da.bind(this);this.w=this.ba.bind(this);this.K=this.X.bind(this);this.J=this.V.bind(this);this.L=this.ia.bind(this);this.G=this.fa.bind(this);this.F=this.P.bind(this);this.f=this.M.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
52
- this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
53
- d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}S(){this.player.trigger(new _.F(_.Te));this.a(_.Zo)}R(){this.a(_.Yo)}da(){this.a(_.Oo)}ba(a){a.isBuffering?
54
- this.a(_.So):(a=this.player.isPaused()?_.Yo:_.Zo,this.a(a))}X(){this.j=1;this.player.trigger(new _.F(_.lg))}V(){this.player.trigger(new _.F(_.kg))}ia(){this.j=2}fa(){this.a(_.Xo)}M(a){const b=this.player.getStats();this.player.trigger(new _.F(_.Lc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}P(a){a=new _.I(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.F(_.r,{detail:a}));this.a(_.Po)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.t?c:1;this.h=typeof d===_.t?d:1;this.j=typeof e===_.t?e:0}ob(){return"Google Cast Framework"}pb(){return cast.framework.VERSION}ub(){return 0}getId(){return""}getCreativeId(){return""}Qb(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Tb(){return!1}qb(){return this.a.clickThroughUrl||
55
- null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}fb(){return 0}eb(){return 0}Qa(){return 0}Ra(){switch(this.Hb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Hb(){return this.f.position}sb(){return this.l}gb(){return this.h}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Sb(){return null}};Z.prototype.getVideoElement=Z.prototype.Sb;Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;
56
- Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;Z.prototype.canSeek=Z.prototype.canSeek;Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.gb;Z.prototype.getPositionInSequence=Z.prototype.sb;Z.prototype.getPodTimeOffset=Z.prototype.Hb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Ra;Z.prototype.getMediaBitrate=Z.prototype.Qa;Z.prototype.getMediaHeight=Z.prototype.eb;Z.prototype.getMediaWidth=Z.prototype.fb;
57
- Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.qb;Z.prototype.isBumper=Z.prototype.Tb;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getPosition=Z.prototype.getPosition;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;
58
- Z.prototype.getSourceId=Z.prototype.Qb;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.ub;Z.prototype.getAdManagerVersion=Z.prototype.pb;Z.prototype.getAdManagerName=Z.prototype.ob;var pX=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Kb(){return!!this.a.find(a=>0===a.position)}Jb(){return!!this.a.find(a=>-1===a.position)}};pX.prototype.hasPostroll=pX.prototype.Jb;pX.prototype.hasPreroll=pX.prototype.Kb;pX.prototype.getCuePoints=pX.prototype.getCuePoints;var qX=class{constructor(a){this.m=a;this.a=null;this.j=this.w.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];OW().addEventListener(this.f,
59
- this.j)}load(){const a=this;return _.x(function*(){KW&&(KW=!1,NW(a,0))})}start(){return _.x(function*(){OW().play()})}o(){}resume(){-1!==this.getPosition()&&OW().play()}pause(){-1!==this.getPosition()&&OW().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.t?a:-1}l(){return!0}h(){const a=this;return _.x(function*(){OW().removeEventListener(a.f,a.j)})}w(a){const b=cast.framework.events.EndedReason;
60
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=OW().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.F(_.pc,{adsTimeline:new pX(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:QW(this,_.bc,a);break;case cast.framework.events.EventType.BREAK_STARTED:QW(this,_.Sb,a);break;case cast.framework.events.EventType.BREAK_ENDED:QW(this,_.Tb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:QW(this,_.hc,a);
61
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(QW(this,_.gc,a),QW(this,_.lc,a)):a.endedReason===b.STOPPED?QW(this,_.lc,a):a.endedReason===b.END_OF_STREAM?(QW(this,_.Wb,a),QW(this,_.lc,a)):a.endedReason===b.ERROR&&NW(this,1);break;case cast.framework.events.EventType.PLAYING:QW(this,_.fc,a);break;case cast.framework.events.EventType.PAUSE:QW(this,_.dc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?QW(this,_.Ub,a):QW(this,_.fc,a)}}};
62
- qX.prototype.getPosition=qX.prototype.getPosition;qX.prototype.setVolume=qX.prototype.setVolume;qX.prototype.getVolume=qX.prototype.getVolume;qX.prototype.skip=qX.prototype.skip;qX.prototype.pause=qX.prototype.pause;qX.prototype.resume=qX.prototype.resume;var KW=!1;var rX=class{constructor(a){this.Va=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(RW(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(RW(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>SW(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
63
- _.Xf;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Yf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Zf}b&&this.Va(new _.F(b,{detail:SW(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Va(new _.F(_.Xf,{detail:b}))}};var sX=class extends _.U{constructor(){super();this.g=new _.T("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;TW().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;TW().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}pa(){return this.j}qa(){return null}Oa(){const a=
64
- this.oa();return a&&a.renditions[0]}Sa(){const a=this.ta();return a&&a.renditions[0]}rb(){return null}Fb(){return null}Gb(){return null}Fa(){return null}oa(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.t&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ta(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.t&&(b=b.toString(),a=this.pa().find(c=>c.id===b)||null)}return a}Ab(){this.g.warn("Video tracks unavailable on Cast")}ya(a){a&&this.f&&
65
- this.f.setActiveById(+a.id)}Ua(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}jb(){this.g.warn("Video renditions unavailable on Cast")}yb(a){this.ya(a&&a.track)}zb(a){this.Ua(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield jW(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
66
- c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),VW(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}va(){return!0}w(){this.f=TW().getAudioTracksManager();var a=this.f.getTracks();this.h=UW(_.M,a);VW(this);a=this.m.getConfiguration();WW(this,_.M,a.preferredAudioLanguage,a.preferredAudioRole);WW(this,_.L,a.preferredTextLanguage,a.preferredTextRole)}};sX.prototype.isAbrEnabled=sX.prototype.va;
67
- sX.prototype.addTextTrack=sX.prototype.addTextTrack;sX.prototype.setTextRendition=sX.prototype.zb;sX.prototype.setAudioRendition=sX.prototype.yb;sX.prototype.setVideoRendition=sX.prototype.jb;sX.prototype.setTextTrack=sX.prototype.Ua;sX.prototype.setAudioTrack=sX.prototype.ya;sX.prototype.setVideoTrack=sX.prototype.Ab;sX.prototype.getTextTrack=sX.prototype.ta;sX.prototype.getAudioTrack=sX.prototype.oa;sX.prototype.getVideoTrack=sX.prototype.Fa;sX.prototype.getLoadingTextRendition=sX.prototype.Gb;
68
- sX.prototype.getLoadingAudioRendition=sX.prototype.Fb;sX.prototype.getLoadingVideoRendition=sX.prototype.rb;sX.prototype.getTextRendition=sX.prototype.Sa;sX.prototype.getAudioRendition=sX.prototype.Oa;sX.prototype.getVideoRendition=sX.prototype.qa;sX.prototype.getTextTracks=sX.prototype.pa;sX.prototype.getAudioTracks=sX.prototype.getAudioTracks;sX.prototype.getVideoTracks=sX.prototype.getVideoTracks;var tX=class extends _.vu{constructor(){super();this.g=new _.T(cW);this.h=this.w=_.wl();this.A=null;this.l=-1;this.F=new _.Dr;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=XW();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new oX(this);this.a.init();this.j=new sX;this.j.initialize(this);this.o=new rX(c=>this.trigger(c));this.o.init()}unload(){const a=
69
- cast.framework.messages.PlayerState,b=XW();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=_.wl();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=XW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
70
- a.play();return Promise.resolve()}pause(){const a=XW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return XW().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return XW().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=XW();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(VV);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}getMediaPosition(){return XW().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
71
- XW().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return XW().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;XW().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
72
- null}getLoadedSource(){const a=XW().getMediaInformation();if(a){var b=XW().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,aj:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return XW().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=XW().getLiveSeekableRange();
73
- b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.kv}getStats(){var a=_.Lo();if(this.f){a=XW().getStats();this.f.h=a.estimatedBandwidth||NaN;this.f.w=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.A=a.width||NaN;b.j=c;b=this.f;c=typeof a.decodedFrames===_.t?a.decodedFrames:NaN;b.o=typeof a.droppedFrames===_.t?a.droppedFrames:NaN;b.l=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
74
- this;return _.x(function*(){b.f=new _.jv;b.a.l=b.f.a;b.A=_.bp(a);b.h=_.yl(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.h.autoplay;typeof b.h.startTime===_.t&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:hW(b.h),local:!0};yield XW().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.uu}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.$a)}appendLoad(){return Promise.reject(_.$a)}seekWith(){return Promise.reject(_.$a)}setNetworkEngine(a){this.F=
75
- a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return cW}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(ZV)}onError(a){a=new _.F(_.r,{detail:a});this.trigger(a)}canPlay(){return _.Jk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=hW(this.getStats());var b=XW(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();
76
- c&&typeof b===_.t&&c.startAbsoluteTime!==b&&(this.g.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=XW().getStartAbsoluteTime();if(typeof d===_.t){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=
77
- d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){var c=null;a.media.customData&&(c=iW(a.media.customData.playerConfiguration));var d=c?c.abr||null:null,e=b;d&&typeof d.defaultBandwidthEstimate===_.t?e.initialBandwidth=d.defaultBandwidthEstimate:e.initialBandwidth=void 0;$W(c,b);d=null;a.media.customData&&(d=iW(a.media.customData["com.castlabs.reactnative.PlayerConfiguration"]));a=(a=d&&d.LiveConfiguration)?0===a.liveEdgeLatencyMs:!1;if(a=null!=c&&c.lowLatencyMode||
78
- a)a=Object.assign({},b.shakaConfig,{streaming:{lowLatencyMode:!0}}),b=Object.assign({},b,{shakaConfig:a});return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var bX=class{constructor(){this.a=!1;this.g=new _.T(dW);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 _.Rt;this.l=null}init(a){a&&(this.f=new tX,_.Tr(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Wo&&(yield gW(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=dX(),b=dX().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
79
- c.customNamespaces={};c.customNamespaces[eW]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
80
- this.A);a.start(c);a.addCustomMessageListener(eW,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=dX();dX().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(eW,this.w);a.stop();this.m=this.f=null}}Gd(a){this.j=a}zi(a){this.l=a}on(a,b){dX().addEventListener(a,b)}off(a,b){dX().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Wd&&this.h.add(a)}removeMessageListener(a){typeof a===_.Wd&&this.h.delete(a)}sendMessage(a,
81
- b){dX().sendCustomMessage(eW,b,hW(a))}xc(){return this.a}Eb(){return eX()}Yb(a){fX(this,a)}Ni(a){const b=eX();let c=null;a?c=Object.assign({},b,a):c=b;fX(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return hX(this,a);try{var b=(new DOMParser).parseFromString(a,_.Vf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=dX();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);for(var f=e.length-
82
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.ve);var h=e[f].getElementsByTagName(_.mb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.ve)||g,m=h[k].getAttribute(_.md);let n=h[k].getAttribute(_.Hg)||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(_.mb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=
83
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.rb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=dX();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.kb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ra)||void 0,h=e[f].getAttribute(_.Qa)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.rg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.kb).length||a.removeChild(c[d])}a=
84
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=iW(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield MW(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.t&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.ds(b.m,d),yield _.es(b.m),d=b.m.getLoadedSource(),c.media.contentId=
85
- d.url,c.media.contentType=d.type,d.Zb&&(c.media.hlsVideoSegmentFormat=kW(d.Zb,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=kW(d.audioMimeType,_.M)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.t&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=dX().getPlayerManager(),
86
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.t||typeof c!==_.t||typeof d!==_.t||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.t&&b>=a&&b<=c&&this.m.seek(b))}_.gs(this.m)}}B(a){if(0<this.h.size){const b=iW(a.data);this.h.forEach(c=>c(b))}}};_.z(dW,bX);bX.prototype.updateContentMetadata=bX.prototype.Ni;bX.prototype.setContentMetadata=bX.prototype.Yb;bX.prototype.getContentMetadata=bX.prototype.Eb;bX.prototype.isApiReady=bX.prototype.xc;
87
- bX.prototype.sendMessage=bX.prototype.sendMessage;bX.prototype.removeMessageListener=bX.prototype.removeMessageListener;bX.prototype.addMessageListener=bX.prototype.addMessageListener;bX.prototype.off=bX.prototype.off;bX.prototype.on=bX.prototype.on;bX.prototype.setLoadRequestDataInterceptor=bX.prototype.zi;bX.prototype.setPlayerConfigInterceptor=bX.prototype.Gd;bX.prototype.stop=bX.prototype.stop;bX.prototype.start=bX.prototype.start;bX.prototype.init=bX.prototype.init;bX.getInstance=cX;var aX=null;var uX=class{constructor(a){this.f=a;this.a=null;this.j=new _.Rt;this.w=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.x(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.A.bind(a);for(const d of a.w)a.j.on(b,d,c)}})}start(){return _.x(function*(){})}o(){}resume(){this.a&&
88
- this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(fW,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.t&&(a=b));return a}l(){return!0}h(){const a=
89
- this;return _.x(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.pc,{adsTimeline:new pX(a.breaks)})));break;case "isPlayingBreak":a.value?jX(this,_.Sb):(jX(this,_.Wb),jX(this,_.lc),jX(this,_.Tb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(jX(this,_.Wb),jX(this,_.lc)),jX(this,_.hc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?jX(this,_.dc):jX(this,_.fc))}}};uX.prototype.getPosition=uX.prototype.getPosition;
90
- uX.prototype.setVolume=uX.prototype.setVolume;uX.prototype.getVolume=uX.prototype.getVolume;uX.prototype.skip=uX.prototype.skip;uX.prototype.pause=uX.prototype.pause;uX.prototype.resume=uX.prototype.resume;_.pp(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.dd?!1:!(!b||!b.ima)}create(a){return new uX(a.a)}});_.pp(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return cX().xc()?!(!b||!b.ima):!1}create(a){return new qX(a)}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var TU="Cannot seek during ads playout.",UU="Cannot switch track",VU="Media session does not exist.",WU="No receivers available",XU="Reset ABR functionality not available on cast.",YU="SDK not yet ready",ZU="Sender is destroyed.",$U="clpp.cast.CastProxy",aV="clpp.cast.Player",bV="clpp.cast.Receiver",cV="urn:x-cast:castlabs",dV="urn:x-cast:com.google.cast.media",eV=function(a){return _.w(function*(){yield _.Qn(a,_.Le);yield _.Qn(a,_.Ke)})},fV=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.$d){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ge?"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}})},gV=function(a){if(typeof a!==_.Sf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},hV=function(a,b){const c=new Set(b);return Object.keys(a).reduce((d,e)=>{c.has(e)&&(d[e]=a[e]);
3
+ return d},{})},iV=function(a,b,c,d){return _.w(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Fr(d,a.mimeType,g);f&&g&&(h=_.nk(a.url),(h=yield c.fetch(h).U)&&h.data&&(e=f.a(_.F(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},jV=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;
4
+ else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.yg:return d.FMP4;case _.xg:return b===_.Q?d.MPEG2_TS:c.TS;case _.Cc:return c.AAC;case _.Dc:return c.AC3;case _.Ec:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Fc:return c.FMP4}},lV=function(a){a=void 0===a?kV:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,
5
+ d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;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}},mV=function(){return Math.round(1E3*Math.random())},nV=function(a,b){return a.h.filter(c=>c.type===b)},pV=function(a,b){const c=oV(a);return nV(a,b).find(d=>c.includes(d.id))||
6
+ null},rV=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.O){const e=a.ta();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);d.editTracksInfo(c,()=>{a.f[b]=null;qV(a,b)},e=>{a.f[b]=null;a.g.debug(UU,e)})}else b===_.O&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{qV(a,b)},e=>{a.g.debug(UU,e)}))},oV=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},qV=function(a,b){b===_.P?a.a.trigger(new _.G(_.Ic)):
7
+ b===_.O&&a.a.trigger(new _.G(_.$f))},uV=function(a){if(a)for(const b of sV)tV(b)},tV=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&cast.framework&&cast.framework.CastContext&&a.T.length){a.w=!0;a.o.kf();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);
8
+ b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da);vV&&a.o.la(.02)}},wV=function(a){return _.w(function*(){sV.delete(a);if(a.w){a.w=!1;var b=cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da)}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(),
9
+ a.o=null);a.R=null;a.Y=null})},xV=function(a){return _.w(function*(){a.Jb()||(yield cast.framework.CastContext.getInstance().requestSession())})},zV=function(a,b,c){c=void 0===c?0:c;return _.w(function*(){var d=a.f.ta();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.oa())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield yV(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Ve:a.getPresentationStartTime(),autoplay:b,gb:a.h})})},yV=function(a,b){return _.w(function*(){var c=
10
+ chrome.cast.media.StreamType;yield xV(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.$a;e.hlsVideoSegmentFormat=jV(b.Xb,_.Q);e.hlsSegmentFormat=jV(c,_.P);b.gb&&(a.L&&(c=yield Promise.resolve(a.L(b.gb)))&&(b.gb=c),a.h=b.gb,a.C=_.an(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.gb.remoteTextTracks&&(c=yield Promise.all(b.gb.remoteTextTracks.map(a.ya.bind(a))),e.tracks=
11
+ c.filter(k=>k),b.gb.remoteTextTracks=void 0),delete b.gb.autoplay,b.gb.startTime=null,e.customData={playerConfiguration:fV(b.gb)});c=a.Cb()||{};var f=AV(c.metadataType),g;typeof b.Ve===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.Ve});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=BV(c);if(g=CV(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Lc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);
12
+ yield d.loadMedia(e)}})},CV=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(DV);for(const d of c){const [e,f]=d;if(f===b){b=e;break a}}b=null}if(!b)return null;b=lV(DV[b]);return Object.assign(b,a)},AV=function(a){var b=void 0===b?kV:b;return Object.values(DV).includes(a)?a:b},BV=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},FV=function(a,b){EV(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(cV,
13
+ a.P)},GV=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=null;a=null===a?null:a+b;return null===a?b:a},EV=function(a,b){a.a=b;a.a&&(a.G.release(),a.F=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.l),a.G.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ia.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Za.bind(a)),a.j&&a.j.init(),a.trigger(new _.G(_.te)))},
14
+ JV=function(a){return new HV(a.h,()=>{a.trigger(new _.G(_.Rc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Ef&&(d.preferredAudioLanguage=c.Ef);c.Kg&&(d.preferredTextLanguage=c.Kg);_.Sn(a.f,null);a.trigger(new _.G("castingended"));a.j(b,d)}},()=>IV(a))},IV=function(a){return _.w(function*(){a.trigger(new _.G(_.Qc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),
15
+ _.Sn(a.f,a.a))})},MV=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{KV=!1;const e=_.nk(d),f=yield c.fetch(e).U;if(f&&f.data){const g=_.oi(f.data),h=(new DOMParser).parseFromString(g,_.Zf);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=LV(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=LV(d);const l=new cast.framework.messages.Break("b1",[k.id],
16
+ 0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),KV=!0}}catch(e){_.B("Failed to fetch an ad",e),KV=!0}})},LV=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},NV=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},OV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},QV=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=PV(a,c))&&(d={ad:c});
17
+ a.m.trigger(new _.G(b,d))}},PV=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Sf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Sf&&(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},RV=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
18
+ cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},SV=function(a){const b=a.dashTimedMetadata;let c=_.qg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.pg)?_.Ff:_.ng,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},TV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},VV=function(a){a.a=
19
+ TV().getTextTracksManager();const b=a.a.getTracks();a.j=UV(_.O,b)},UV=function(a,b){const c=[];for(const d of b)b=new _.or(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.sr(b.id,b)),c.push(b);return c},WV=function(a,
20
+ b,c,d){c=_.Yh(c).filter(g=>g);var e=!1;let f=[];b===_.P?f=a.getAudioTracks():b===_.O&&(f=a.pa());if(c=c.find(g=>{const h=_.Cn(g);return f.some(k=>{k=_.Cn(k.language||"");return _.Dn(h,k)})})){const g=_.Cn(c);c=f.filter(h=>{h=_.Cn(h.language||"");return _.Dn(g,h)});f=c.length?c:f;e=e||!!c.length}_.xi(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===_.P?a.xa(e):b===_.O&&a.Ra(e))},XV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},
21
+ $V=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.gn(d);if(e){var f=[_.sd];_.an(a)[0].type!==_.Ac&&f.unshift(_.ud);d.preferredDrmSystem===_.sd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ha[g];h?(c=g===_.ud?cast.framework.ContentProtection.WIDEVINE:g===_.sd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,
22
+ c={ldlDelay:0,customData:{}},YV(b,h,a,c),ZV(b,h,a,c)):c()}else c()}else c()},aW=function(a,b){b=Object.assign({},a.shakaConfig,b);return Object.assign({},a,{shakaConfig:b})},YV=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.nk({method:_.cb,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}:
23
+ a.licenseRequestHandler=void 0},ZV=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.rk(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.F(g.data)}):a.licenseHandler=void 0},dW=function(){return bW||(bW=new cW)},eW=function(){return cast.framework.CastReceiverContext.getInstance()},fW=function(){const a=eW().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},gW=function(a,b){const c=
24
+ eW().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,eW().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},iW=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=eW();var {hlsVideoSegmentFormat:d}=eW().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.yg:_.xg;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=
25
+ [];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=hW(f,_.pa),h=hW(f,_.kb);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")},hW=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},kW=function(a,b){let c=null;const d=jW(a);
26
+ d&&(c={ad:d});a.f.trigger(new _.G(b,c))},jW=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Y(d,c,g,e,f)}return b},lW=class{constructor(a,b){this.log=new _.S(b);
27
+ this.player=a;this.l=null;this.h=_.ts;this.o=7;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.ts)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.C&&this.a(_.ks)}a(a){if(a!==this.h)if(this.h===_.ks&&a!==_.ts)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;2===this.h?(this.B=b,this.player.trigger(new _.G(_.Nc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):2===this.o&&
28
+ this.player.trigger(new _.G(_.Mc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.ds(this.l,this.h);this.player.trigger(new _.G(_.Pf,{detail:a}))}}},mW;_.x("clpp.cast.CastUtils",class{});
29
+ var kV=0,DV={GENERIC:kV,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5},nW="addMissingTimelineCues alwaysStreamText bufferBehind bufferingGoal durationBackoff gapDetectionThreshold ignoreTextStreamFailures lowLatencyMode rebufferingGoal retryParameters safeSeekOffset stallEnabled stallSkip stallThreshold startAtSegmentBoundary".split(" "),oW="bandwidthDowngradeTarget bandwidthUpgradeTarget defaultBandwidthEstimate enabled initialRestrictions restrictions switchInterval".split(" ");var pW=class extends lW{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Sb.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)}Sb(){if(this.f&&
30
+ 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(5);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.ks);break;default:this.a(_.ts)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(3);break;case chrome.cast.media.PlayerState.PAUSED:this.a(4);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(2)}}};var qW=class extends _.U{constructor(){super();this.g=new _.S("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.Q;break;case chrome.cast.media.TrackType.AUDIO:c=_.P;break;case chrome.cast.media.TrackType.TEXT:c=_.O}c=new _.or(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
31
+ 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 _.sr(c.id,c));return c}):[],this.a.trigger(new _.G(_.fg)))}destroy(){this.a=null}getVideoTracks(){return nV(this,_.Q)}getAudioTracks(){return nV(this,_.P)}pa(){return nV(this,_.O)}qa(){const a=this.Ea();return a?a.renditions[0]:null}La(){const a=this.oa();return a?a.renditions[0]:null}Pa(){const a=this.ta();return a?a.renditions[0]:
32
+ null}pb(){return this.f[_.Q]||null}Db(){return this.f[_.P]||null}Eb(){return this.f[_.O]||null}Ea(){return pV(this,_.Q)}oa(){return pV(this,_.P)}ta(){return pV(this,_.O)}yb(a){rV(this,_.Q,a)}xa(a){rV(this,_.P,a)}Ra(a){rV(this,_.O,a)}hb(a){this.yb(a&&a.track)}wb(a){this.xa(a&&a.track)}xb(a){this.Ra(a&&a.track)}addTextTrack(){return _.w(function*(){})}ua(){return!0}};qW.prototype.isAbrEnabled=qW.prototype.ua;qW.prototype.addTextTrack=qW.prototype.addTextTrack;qW.prototype.setTextRendition=qW.prototype.xb;
33
+ qW.prototype.setAudioRendition=qW.prototype.wb;qW.prototype.setVideoRendition=qW.prototype.hb;qW.prototype.setTextTrack=qW.prototype.Ra;qW.prototype.setAudioTrack=qW.prototype.xa;qW.prototype.setVideoTrack=qW.prototype.yb;qW.prototype.getTextTrack=qW.prototype.ta;qW.prototype.getAudioTrack=qW.prototype.oa;qW.prototype.getVideoTrack=qW.prototype.Ea;qW.prototype.getLoadingTextRendition=qW.prototype.Eb;qW.prototype.getLoadingAudioRendition=qW.prototype.Db;qW.prototype.getLoadingVideoRendition=qW.prototype.pb;
34
+ qW.prototype.getTextRendition=qW.prototype.Pa;qW.prototype.getAudioRendition=qW.prototype.La;qW.prototype.getVideoRendition=qW.prototype.qa;qW.prototype.getTextTracks=qW.prototype.pa;qW.prototype.getAudioTracks=qW.prototype.getAudioTracks;qW.prototype.getVideoTracks=qW.prototype.getVideoTracks;var HV=class extends _.Ht{constructor(a,b,c,d){super();this.g=new _.S(_.fd);this.T=a;this.o=new _.Mi(b);this.R=c;this.Y=d;this.h=this.I=_.Vm();this.C=[];this.B=0;this.K=new _.zn;this.F=this.l=this.a=null;this.A=this.w=!1;this.ba="";this.ha=1E6;this.f=new qW;this.f.initialize(this);this.j=new pW(this);this.G=new _.Gt;this.J=null;this.H=new Set;this.M=this.Ta.bind(this);this.da=this.Bb.bind(this);this.V=this.Ab.bind(this);this.P=this.Ua.bind(this);this.L=null;window.cast||Object.defineProperty(window,
35
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{uV(!0)},0)}});tV(this);sV.add(this)}init(a,b){this.h=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.Za)}appendLoad(){return Promise.reject(_.Za)}seekWith(){return Promise.reject(_.Za)}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}destroy(){return _.w(function*(){})}yd(a){this.L=
36
+ a}vc(){return this.w}Jb(){return this.A}Ge(){return this.ba}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,fV(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 _.w(function*(){if(!a.vc())throw a.g.warn(YU),new _.H(1,8,8001,void 0);if(!vV)throw a.g.warn(WU),new _.H(1,8,8002,void 0);if(a.Jb())throw a.g.warn("Already casting"),
37
+ new _.H(1,8,8003,void 0);try{yield xV(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.H(1,8,8E3,c);}})}Fe(){this.Jb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.$d&&this.H.add(a)}removeMessageListener(a){typeof a===_.$d&&this.H.delete(a)}play(){return this.isEnded()?zV(this,!0):new Promise((a,b)=>{if(!this.a)return b(VU);this.a.play(null,
38
+ a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(VU);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return 5===this.getState()}seek(a){return this.isEnded()?zV(this,!1,a):new Promise((b,c)=>{this.a||c(VU);this.l.isPlayingBreak&&c(TU);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.G(_.sg));this.a.seek(d,()=>{this.trigger(new _.G(_.rg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
39
+ 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(dV,{type:"SET_PLAYBACK_RATE",requestId:mV(),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&
40
+ 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={start:0,end:this.getDuration()};if(this.isLive()){const b=
41
+ 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():7}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?gV(this.a.customData.stats):_.hs()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.vc())if(vV){b.C=_.an(a);b.h=_.Xm([b.I,a]);var c=b.C[b.B];yield yV(b,{source:c,isLive:c.isLive,autoplay:b.h.autoplay,gb:b.h,Xb:c.Xb,$a:c.$a})}else b.g.warn(WU);
42
+ else b.g.warn(YU)})}getBufferInfo(){return new _.Bt}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(XU)}onError(a){if(a&&(this.trigger(new _.G(_.Wd,{detail:a})),
43
+ this.j))this.j.onError(a)}namespace(){return _.fd}canPlay(){return this.vc()?2:0}Cb(){return this.J}Vb(a){this.J=CV(a)}Be(){this.J=null}ef(a){const b=this.Cb()||{};a={metadataType:AV(b.metadataType),title:a};this.Vb(Object.assign({},b,a))}cf(a){const b=this.Cb()||{},c=AV(b.metadataType);a=new chrome.cast.Image(a);this.Vb(Object.assign({},b,{metadataType:c,images:[a]}))}bf(a){const b=this.Cb()||{};this.Vb(Object.assign({},b,{metadataType:3,artist:a}))}df(a){const b=this.Cb()||{};a={metadataType:AV(b.metadataType),
44
+ releaseDate:a};this.Vb(Object.assign({},b,a))}Ta(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;vV=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.ba=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.kf()}Bb(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;FV(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.Jb()||
45
+ (this.A=!0,FV(this,a.session),this.Y());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Jb()&&this.a){const d=this.a.media;var b=this.f.oa(),c=this.f.ta();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:GV(this),Kg:c,Ef:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(cV,this.P);this.A=!1;this.a=null;this.G.release();
46
+ this.l=this.F=null}}Ab(a){this.g.debug("New media session",a.mediaSession);EV(this,a.mediaSession)}Za(a){a.value&&a.value.tracks&&this.f&&this.f.load()}Ua(a,b){if(a===cV&&0<this.H.size){const c=gV(b);this.H.forEach(d=>d(c))}}ia(){this.trigger(new _.G(_.eg))}ya(a){const b=this;return _.w(function*(){let c=null;const d=yield iV(a,[_.Yf,_.zc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ha++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
47
+ d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}},vV=!1,sV=new Set;window.__onGCastApiAvailable=uV;var Z=class extends _.Ht{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.$d?c:this.l;this.a=JV(this);this.g=new _.S($U);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield wV(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&5!==a&&a!==_.ts&&(delete b.license,this.f.load(b))}ye(){return!!this.a&&this.a.vc()&&vV}Jb(){return!!this.a&&this.a.Jb()}Ge(){return this.a?this.a.Ge():""}yd(a){this.a&&this.a.yd(a)}cast(a){const b=this;
48
+ return _.w(function*(){if(b.a)try{if(yield b.a.cast(),b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.oa();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.ta();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const p=
49
+ e&&typeof e.isLive===_.Lc?e.isLive:b.f.isLive();d={source:e,isLive:p,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Ve:b.f.getPresentationStartTime(),Xb:h,$a:k,gb:l}}var c=d}yield IV(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield yV(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.G(_.Wd,{detail:d}),b.trigger(c)}})}Fe(){this.a&&this.a.Fe()}oh(a){const b=this;return _.w(function*(){a!==b.h&&(b.h=a,b.a&&(yield wV(b.a)),b.a=JV(b))})}sendMessage(a){const b=
50
+ this;return _.w(function*(){b.a?yield b.a.sendMessage(cV,a):b.g.warn(ZU)})}ri(){const a=this;return _.w(function*(){yield a.a.sendMessage(dV,{type:"QUEUE_NEXT",requestId:mV(),mediaSessionId:a.a.a.mediaSessionId})})}si(){const a=this;return _.w(function*(){yield a.a.sendMessage(dV,{type:"QUEUE_PREV",requestId:mV(),mediaSessionId:a.a.a.mediaSessionId})})}pi(a){const b=this;return _.w(function*(){yield b.a.sendMessage(dV,{type:"QUEUE_INSERT",requestId:mV(),mediaSessionId:b.a.a.mediaSessionId,items:a})})}addMessageListener(a){this.a?
51
+ this.a.addMessageListener(a):this.g.warn(ZU)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(ZU)}Cb(){return this.a&&this.a.Cb()}Vb(a){this.a&&this.a.Vb(a)}Be(){this.a&&this.a.Be()}ef(a){this.a&&this.a.ef(a)}cf(a){this.a&&this.a.cf(a)}bf(a){this.a&&this.a.bf(a)}df(a){this.a&&this.a.df(a)}};_.x($U,Z);Z.prototype.setContentReleaseDate=Z.prototype.df;Z.prototype.setContentArtist=Z.prototype.bf;Z.prototype.setContentImage=Z.prototype.cf;Z.prototype.setContentTitle=Z.prototype.ef;
52
+ Z.prototype.clearContentMetadata=Z.prototype.Be;Z.prototype.setContentMetadata=Z.prototype.Vb;Z.prototype.getContentMetadata=Z.prototype.Cb;Z.prototype.removeMessageListener=Z.prototype.removeMessageListener;Z.prototype.addMessageListener=Z.prototype.addMessageListener;Z.prototype.queueAddItems=Z.prototype.pi;Z.prototype.queuePreviousItem=Z.prototype.si;Z.prototype.queueNextItem=Z.prototype.ri;Z.prototype.sendMessage=Z.prototype.sendMessage;Z.prototype.changeReceiverId=Z.prototype.oh;
53
+ Z.prototype.forceDisconnect=Z.prototype.Fe;Z.prototype.cast=Z.prototype.cast;Z.prototype.setPlayerConfigInterceptor=Z.prototype.yd;Z.prototype.getReceiverName=Z.prototype.Ge;Z.prototype.isCasting=Z.prototype.Jb;Z.prototype.canCast=Z.prototype.ye;Z.prototype.destroy=Z.prototype.destroy;var rW=class extends lW{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.T.bind(this);this.H=this.R.bind(this);this.A=this.da.bind(this);this.w=this.ba.bind(this);this.K=this.Y.bind(this);this.J=this.V.bind(this);this.L=this.ia.bind(this);this.G=this.ha.bind(this);this.F=this.P.bind(this);this.f=this.M.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
54
+ 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();
55
+ 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 _.G(_.Ve));this.a(3)}R(){this.a(4)}da(){this.a(5)}ba(a){a.isBuffering?
56
+ this.a(2):(a=this.player.isPaused()?4:3,this.a(a))}Y(){this.j=1;this.player.trigger(new _.G(_.sg))}V(){this.player.trigger(new _.G(_.rg))}ia(){this.j=2}ha(){this.a(1)}M(a){const b=this.player.getStats();this.player.trigger(new _.G(_.Kc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}P(a){a=new _.H(_.C,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.G(_.Wd,{detail:a}));this.a(_.ks)}};var Y=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.r?c:1;this.h=typeof d===_.r?d:1;this.j=typeof e===_.r?e:0}lb(){return"Google Cast Framework"}nb(){return cast.framework.VERSION}sb(){return 0}getId(){return""}getCreativeId(){return""}Nb(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Qb(){return!1}ob(){return this.a.clickThroughUrl||
57
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}cb(){return 0}bb(){return 0}Na(){return 0}Oa(){switch(this.Fb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Fb(){return this.f.position}qb(){return this.l}eb(){return this.h}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Pb(){return null}};Y.prototype.getVideoElement=Y.prototype.Pb;Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;
58
+ Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.canSeek=Y.prototype.canSeek;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.eb;Y.prototype.getPositionInSequence=Y.prototype.qb;Y.prototype.getPodTimeOffset=Y.prototype.Fb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Oa;Y.prototype.getMediaBitrate=Y.prototype.Na;Y.prototype.getMediaHeight=Y.prototype.bb;Y.prototype.getMediaWidth=Y.prototype.cb;
59
+ Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.ob;Y.prototype.isBumper=Y.prototype.Qb;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getPosition=Y.prototype.getPosition;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;
60
+ Y.prototype.getSourceId=Y.prototype.Nb;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.sb;Y.prototype.getAdManagerVersion=Y.prototype.nb;Y.prototype.getAdManagerName=Y.prototype.lb;var sW=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Hb(){return!!this.a.find(a=>0===a.position)}Gb(){return!!this.a.find(a=>-1===a.position)}};sW.prototype.hasPostroll=sW.prototype.Gb;sW.prototype.hasPreroll=sW.prototype.Hb;sW.prototype.getCuePoints=sW.prototype.getCuePoints;var tW=class{constructor(a){this.m=a;this.a=null;this.j=this.w.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];OV().addEventListener(this.f,
61
+ this.j)}load(){const a=this;return _.w(function*(){KV&&(KV=!1,NV(a,0))})}start(){return _.w(function*(){OV().play()})}o(){}resume(){-1!==this.getPosition()&&OV().play()}pause(){-1!==this.getPosition()&&OV().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}l(){return!0}h(){const a=this;return _.w(function*(){OV().removeEventListener(a.f,a.j)})}w(a){const b=cast.framework.events.EndedReason;
62
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=OV().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.G(_.oc,{adsTimeline:new sW(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:QV(this,_.ec,a);break;case cast.framework.events.EventType.BREAK_STARTED:QV(this,_.Rb,a);break;case cast.framework.events.EventType.BREAK_ENDED:QV(this,_.Sb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:QV(this,_.kc,a);
63
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(QV(this,_.jc,a),QV(this,_.lc,a)):a.endedReason===b.STOPPED?QV(this,_.lc,a):a.endedReason===b.END_OF_STREAM?(QV(this,_.Vb,a),QV(this,_.lc,a)):a.endedReason===b.ERROR&&NV(this,1);break;case cast.framework.events.EventType.PLAYING:QV(this,_.ic,a);break;case cast.framework.events.EventType.PAUSE:QV(this,_.gc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?QV(this,_.Tb,a):QV(this,_.ic,a)}}};
64
+ tW.prototype.getPosition=tW.prototype.getPosition;tW.prototype.setVolume=tW.prototype.setVolume;tW.prototype.getVolume=tW.prototype.getVolume;tW.prototype.skip=tW.prototype.skip;tW.prototype.pause=tW.prototype.pause;tW.prototype.resume=tW.prototype.resume;var KV=!1;var uW=class{constructor(a){this.Sa=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(RV(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(RV(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>SV(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=
65
+ _.ag;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.bg;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.cg}b&&this.Sa(new _.G(b,{detail:SV(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Sa(new _.G(_.ag,{detail:b}))}};var vW=class extends _.U{constructor(){super();this.g=new _.S("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;TV().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;TV().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}pa(){return this.j}qa(){return null}La(){const a=
66
+ this.oa();return a&&a.renditions[0]}Pa(){const a=this.ta();return a&&a.renditions[0]}pb(){return null}Db(){return null}Eb(){return null}Ea(){return null}oa(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ta(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.pa().find(c=>c.id===b)||null)}return a}yb(){this.g.warn("Video tracks unavailable on Cast")}xa(a){a&&this.f&&
67
+ this.f.setActiveById(+a.id)}Ra(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}hb(){this.g.warn("Video renditions unavailable on Cast")}wb(a){this.xa(a&&a.track)}xb(a){this.Ra(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield iV(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=
68
+ 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]),VV(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ua(){return!0}w(){this.f=TV().getAudioTracksManager();var a=this.f.getTracks();this.h=UV(_.P,a);VV(this);a=this.m.getConfiguration();WV(this,_.P,a.preferredAudioLanguage,a.preferredAudioRole);WV(this,_.O,a.preferredTextLanguage,a.preferredTextRole)}};vW.prototype.isAbrEnabled=vW.prototype.ua;
69
+ vW.prototype.addTextTrack=vW.prototype.addTextTrack;vW.prototype.setTextRendition=vW.prototype.xb;vW.prototype.setAudioRendition=vW.prototype.wb;vW.prototype.setVideoRendition=vW.prototype.hb;vW.prototype.setTextTrack=vW.prototype.Ra;vW.prototype.setAudioTrack=vW.prototype.xa;vW.prototype.setVideoTrack=vW.prototype.yb;vW.prototype.getTextTrack=vW.prototype.ta;vW.prototype.getAudioTrack=vW.prototype.oa;vW.prototype.getVideoTrack=vW.prototype.Ea;vW.prototype.getLoadingTextRendition=vW.prototype.Eb;
70
+ vW.prototype.getLoadingAudioRendition=vW.prototype.Db;vW.prototype.getLoadingVideoRendition=vW.prototype.pb;vW.prototype.getTextRendition=vW.prototype.Pa;vW.prototype.getAudioRendition=vW.prototype.La;vW.prototype.getVideoRendition=vW.prototype.qa;vW.prototype.getTextTracks=vW.prototype.pa;vW.prototype.getAudioTracks=vW.prototype.getAudioTracks;vW.prototype.getVideoTracks=vW.prototype.getVideoTracks;var wW=class extends _.Ht{constructor(){super();this.g=new _.S(aV);this.h=this.w=_.Vm();this.A=null;this.l=-1;this.F=new _.zn;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=XV();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new rW(this);this.a.init();this.j=new vW;this.j.initialize(this);this.o=new uW(c=>this.trigger(c));this.o.init()}unload(){const a=
71
+ cast.framework.messages.PlayerState,b=XV();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=_.Vm();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=XV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
72
+ a.play();return Promise.resolve()}pause(){const a=XV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return XV().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return XV().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=XV();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(TU);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}getMediaPosition(){return XV().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
73
+ XV().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return XV().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;XV().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||
74
+ null}getLoadedSource(){const a=XV().getMediaInformation();if(a){var b=XV().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,hj:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return XV().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=XV().getLiveSeekableRange();
75
+ 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():7}getStats(){var a=_.hs();if(this.f){a=XV().getStats();this.f.h=a.estimatedBandwidth||NaN;this.f.w=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.A=a.width||NaN;b.j=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.o=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.l=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
76
+ this;return _.w(function*(){b.f=new _.hv;b.a.l=b.f.a;b.A=_.an(a);b.h=_.Xm([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:fV(b.h),local:!0};yield XV().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.Bt}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.Za)}appendLoad(){return Promise.reject(_.Za)}seekWith(){return Promise.reject(_.Za)}setNetworkEngine(a){this.F=
77
+ a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return aV}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(XU)}onError(a){a=new _.G(_.Wd,{detail:a});this.trigger(a)}canPlay(){return _.Zi()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=fV(this.getStats());var b=XV(),c=a.media||b.getMediaInformation();b=
78
+ b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==b&&(this.g.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=XV().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;
79
+ h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){var c=null;a.media.customData&&(c=gV(a.media.customData.playerConfiguration));var d=null;var e=null;a.media.customData&&(d=gV(a.media.customData["com.castlabs.reactnative.PlayerConfiguration"]),e=gV(a.media.customData.playerConfiguration));a=(a=d&&d.LiveConfiguration)?0===a.liveEdgeLatencyMs:!1;d=!(!d||!d.lowLatencyMode);b=(e=null!=e&&e.lowLatencyMode||a||d)?aW(b,{streaming:{lowLatencyMode:!0}}):
80
+ b;if(!c)return b;e=c.chromecast||null;a=c.abr||null;d=b;a&&typeof a.defaultBandwidthEstimate===_.r?d.initialBandwidth=a.defaultBandwidthEstimate:d.initialBandwidth=void 0;$V(c,b);a={};d=c.streaming||null;e&&e.useSenderStreamingConfig&&d&&(a.streaming=hV(d,nW));c=c.abr||null;e&&e.useSenderAbrConfig&&c&&(a.abr=hV(c,oW));_.eh(a)&&(b=aW(b,a));return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var cW=class{constructor(){this.a=!1;this.g=new _.S(bV);this.f=this.m=null;this.j=new Set;this.B=this.H.bind(this);this.A=this.C.bind(this);this.l=null;this.w=new _.Gt;this.h=this.o=null}init(a){a&&(this.f=new wW,_.Sn(a,this.f),this.m=a,this.w.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.ts&&(yield eV(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=eW(),b=eW().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
81
+ c.customNamespaces={};c.customNamespaces[cV]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.G.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;this.h&&(c.queue=this.h);b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.F.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
82
+ this.B);a.start(c);a.addCustomMessageListener(cV,this.A)}}stop(){if(this.a){this.a=!1;this.w.release();const a=eW();eW().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.B);a.removeCustomMessageListener(cV,this.A);a.stop();this.h=this.m=this.f=null}}yd(a){this.l=a}Fi(a){this.o=a}on(a,b){eW().addEventListener(a,b)}off(a,b){eW().removeEventListener(a,b)}addMessageListener(a){typeof a===_.$d&&this.j.add(a)}removeMessageListener(a){typeof a===_.$d&&this.j.delete(a)}sendMessage(a,
83
+ b){eW().sendCustomMessage(cV,b,fV(a))}vc(){return this.a}Cb(){return fW()}Vb(a){gW(this,a)}Ui(a){const b=fW();let c=null;a?c=Object.assign({},b,a):c=b;gW(this,c)}Hi(a){this.h=a}getQueueManager(){return eW().getPlayerManager().getQueueManager()}G(a){a=a.trim();if(a.startsWith("#EXTM3U"))return iW(this,a);try{var b=(new DOMParser).parseFromString(a,_.Zf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=eW();c=a.getElementsByTagName("Period");
84
+ for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);for(var f=e.length-1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.t||g===_.q){g=e[f].getAttribute(_.Ae);var h=e[f].getElementsByTagName(_.lb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Ae)||g,m=h[k].getAttribute(_.nd);let n=h[k].getAttribute(_.Lg)||void 0,p=h[k].getAttribute(_.ae)||void 0;void 0!==n&&(n=+n);void 0!==p&&(p=+p);b.canDisplayType(l,m,n,p)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.lb).length||
85
+ c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ha).length||a.removeChild(c[d])}return a=(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.rb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=eW();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.jb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Qa)||void 0,h=e[f].getAttribute(_.Pa)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.yg,
86
+ void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.jb).length||a.removeChild(c[d])}a=(new XMLSerializer).serializeToString(a)}return a}F(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=gV(c.media.customData.playerConfiguration));if(b.m&&d){b.l&&(d=(yield Promise.resolve(b.l(d)))||d);d.ima&&(yield MV(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||
87
+ (b.f.C=!0,yield _.co(b.m,d),yield _.eo(b.m),d=b.m.getLoadedSource(),c.media.contentId=d.url,c.media.contentType=d.type,d.Xb&&(c.media.hlsVideoSegmentFormat=jV(d.Xb,_.Q)),d.$a&&(c.media.hlsSegmentFormat=jV(d.$a,_.P)));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.o&&(d=yield Promise.resolve(b.o(c)))&&(c=d);return c})}H(a){if(this.m&&(!a.media.customData||
88
+ !a.media.customData.local)){var b=eW().getPlayerManager(),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))}_.go(this.m)}}C(a){if(0<this.j.size){const b=gV(a.data);this.j.forEach(c=>c(b))}}};_.x(bV,cW);cW.prototype.getQueueManager=cW.prototype.getQueueManager;cW.prototype.setQueue=cW.prototype.Hi;
89
+ cW.prototype.updateContentMetadata=cW.prototype.Ui;cW.prototype.setContentMetadata=cW.prototype.Vb;cW.prototype.getContentMetadata=cW.prototype.Cb;cW.prototype.isApiReady=cW.prototype.vc;cW.prototype.sendMessage=cW.prototype.sendMessage;cW.prototype.removeMessageListener=cW.prototype.removeMessageListener;cW.prototype.addMessageListener=cW.prototype.addMessageListener;cW.prototype.off=cW.prototype.off;cW.prototype.on=cW.prototype.on;cW.prototype.setLoadRequestDataInterceptor=cW.prototype.Fi;
90
+ cW.prototype.setPlayerConfigInterceptor=cW.prototype.yd;cW.prototype.stop=cW.prototype.stop;cW.prototype.start=cW.prototype.start;cW.prototype.init=cW.prototype.init;cW.getInstance=dW;var bW=null;var xW=class{constructor(a){this.f=a;this.a=null;this.j=new _.Gt;this.w=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.w(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.A.bind(a);for(const d of a.w)a.j.on(b,d,c)}})}start(){return _.w(function*(){})}o(){}resume(){this.a&&
91
+ 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(dV,{type:"SKIP_AD",requestId:mV(),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}l(){return!0}h(){const a=this;return _.w(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&
92
+ (a=a.value,a.breaks&&this.f.trigger(new _.G(_.oc,{adsTimeline:new sW(a.breaks)})));break;case "isPlayingBreak":a.value?kW(this,_.Rb):(kW(this,_.Vb),kW(this,_.lc),kW(this,_.Sb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(kW(this,_.Vb),kW(this,_.lc)),kW(this,_.kc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?kW(this,_.gc):kW(this,_.ic))}}};xW.prototype.getPosition=xW.prototype.getPosition;xW.prototype.setVolume=xW.prototype.setVolume;xW.prototype.getVolume=xW.prototype.getVolume;
93
+ xW.prototype.skip=xW.prototype.skip;xW.prototype.pause=xW.prototype.pause;xW.prototype.resume=xW.prototype.resume;var yW=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.fd?!1:!(!b||!b.ima)}create(a){return new xW(a.a)}};var zW=class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return dW().vc()?!(!b||!b.ima):!1}create(a){return new tW(a)}};_.x("clpp.cast.createCastQueue",function(){mW=class extends cast.framework.QueueBase{initialize(a){let b=a.queueData;b||(b=new cast.framework.messages.QueueData,b.name="queue",b.description="queue",b.items=[{media:a.media}],b.startTime=a.currentTime);return b}};return new mW});_.Eh(new yW);_.Eh(new zW);};f.call(g, window);