(function(g){var window=this;'use strict';var JsU=function(p){g.Bf("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "),function(a){this.G.push(this.j.subscribe(a,g.CP(this.Xyl,a),this))},p)},fV8=function(){var p=Ji(); this.L=p;p.eT("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")},aU8=function(p){return Array.isArray(p)?g.lb(p,pg2):[]},lUG=function(p){g.fs.call(this,"serverreachability",p)},yeB=function(p){return Array.isArray(p)?"["+g.lb(p,fS).join(",")+"]":"null"},SsM=function(p){return p.j?p.K+pM(p):p.K},ao=function(p){p=p||{}; this.name=p.name||"";this.id=p.id||p.screenId||"";this.token=p.token||p.loungeToken||"";this.uuid=p.uuid||p.dialId||"";this.idType=p.screenIdType||"normal"},nnl=function(){var p=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return p?parseInt(p[1],10):0},l2=function(p){if(g.dD.JSON)try{return g.dD.JSON.parse(p)}catch(a){}return VAc(p)},ys=function(p){p.onload=null; p.onerror=null;p.onabort=null;p.ontimeout=null},ZvK=function(p){g.pI(p.w7); p.w7=NaN},zhB=function(p){p.N3=0; p.Ha=[];if(p.W){var a=onG(p.S);if(a.length!=0||p.U.length!=0)g.N7(p.Ha,a),g.N7(p.Ha,p.U),p.S.U.length=0,g.hf(p.U),p.U.length=0;p.W.Pq()}},Sr=function(p){doa(p.S)||p.G||(p.G=!0,g.VU(p.xP,p),p.w7=0)},ByB=function(){GQa(); return nM?!!nM.get("yt-remote-use-staging-server"):!1},cea=function(p){g.Bf(p.G,function(a){this.j.unsubscribeByKey(a)},p); p.G.length=0},$oc=function(p,a){p.compatibleSenderThemes.clear(); g.Tz(a.split(","),g.CP(rec,wg8)).forEach(function(l){p.compatibleSenderThemes.add(l)})},PrB=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(p){var a=Math.random()*16|0; return(p=="x"?a:a&3|8).toString(16)})},Leb=function(){var p=Ji(); this.L=p;p.eT("/client_streamz/youtube/living_room/mdx/channel/opened",g.wA("channel_type"))},Vs=function(p,a,l){g.D.call(this); this.G=l!=null?(0,g.bn)(p,l):p;this.N0=a;this.W=(0,g.bn)(this.qn,this);this.L=!1;this.S=0;this.U=this.zR=null;this.j=[]},ZX=function(p,a,l,y,S){try{S&&(S.onload=null,S.onerror=null,S.onabort=null,S.ontimeout=null),y(l)}catch(n){}},Fe_=function(){XgK(); var p=xoc();p.push("//www.gstatic.com/eureka/clank/cast_sender.js");oo(p)},En1=function(p){p.W=p.j.dT(p.Bs,p.S.label,p.S.friendlyName,z_(p),function(a,l){p.W=function(){}; p.Xu=!0;dc(p,a);a.idType=="shortLived"&&l>0&&G_(p,l)},function(a){p.W=function(){}; p.Zb(a)})},Rh8=function(p){g.fs.call(this,"serverreachability",p)},XgK=function(){if(sM1){var p=2,a=Uo7(),l=function(){p--; p==0&&a&&a(!0)}; window.__onGCastApiAvailable=l;QMb("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",hha,l)}},Aec=function(p){g.pI(p.G); p.G=0;g.pI(p.K);p.K=0;p.W();p.W=function(){}; g.pI(p.Sl)},Bo=function(p,a){return Object.prototype.hasOwnProperty.call(p,a)},gnM=function(p){co("remote.onCastSessionChange_: "+fS(p)); if(p){var a=rc();if(a&&a.id==p.id){if(wc(a.id,"YouTube TV"),p.idType=="shortLived"&&(p=p.token))$l&&($l.token=p),(a=Po())&&a.kp(p)}else a&&LM(),X5(p,1)}else Po()&&LM()},F5=function(p){this.name=this.id=""; this.clientName="UNKNOWN_INTERFACE";this.app="";this.type="REMOTE_CONTROL";this.ownerObfuscatedGaiaId=this.obfuscatedGaiaId=this.avatar=this.username="";this.capabilities=new Set;this.compatibleSenderThemes=new Set;this.experiments=new Set;this.theme="u";new xl;this.model=this.brand="";this.year=0;this.chipset=this.osVersion=this.os="";this.mdxDialServerType="MDX_DIAL_SERVER_TYPE_UNKNOWN";p&&(this.id=p.id||p.name,this.name=p.name,this.clientName=p.clientName?p.clientName.toUpperCase():"UNKNOWN_INTERFACE", this.app=p.app,this.type=p.type||"REMOTE_CONTROL",this.username=p.user||"",this.avatar=p.userAvatarUri||"",this.obfuscatedGaiaId=p.obfuscatedGaiaId||"",this.ownerObfuscatedGaiaId=p.ownerObfuscatedGaiaId||"",this.theme=p.theme||"u",Ys8(this,p.capabilities||""),$oc(this,p.compatibleSenderThemes||""),qsb(this,p.experiments||""),this.brand=p.brand||"",this.model=p.model||"",this.year=p.year||0,this.os=p.os||"",this.osVersion=p.osVersion||"",this.chipset=p.chipset||"",this.mdxDialServerType=p.mdxDialServerType|| "MDX_DIAL_SERVER_TYPE_UNKNOWN",p=p.deviceInfo)&&(p=JSON.parse(p),this.brand=p.brand||"",this.model=p.model||"",this.year=p.year||0,this.os=p.os||"",this.osVersion=p.osVersion||"",this.chipset=p.chipset||"",this.clientName=p.clientName?p.clientName.toUpperCase():"UNKNOWN_INTERFACE",this.mdxDialServerType=p.mdxDialServerType||"MDX_DIAL_SERVER_TYPE_UNKNOWN")},Eo=function(p,a){if(typeof p!=="function")throw Error("Fn must not be null and must be a function"); return g.dD.setTimeout(function(){p()},a)},CM=function(p,a,l,y){this.U=p; this.j=a;this.Fh=l;this.va=y||1;this.Sb=new g.q4(this);this.Ps=45E3;this.Hs=null;this.G=!1;this.Sl=this.Kz=this.Z=this.nz=this.w7=this.Yv=this.UO=null;this.Xu=[];this.L=null;this.K=0;this.W=this.Bs=null;this.yQ=-1;this.t9=!1;this.VY=0;this.OO=null;this.Ha=this.r7=this.eb=this.QY=!1;this.S=new Jel},fUa=function(p){return{name:p.name, screenId:p.id,loungeToken:p.token,dialId:p.uuid,screenIdType:p.idType}},pDU=function(p,a){p.info("sendYoutubeMessage_: "+a+" "+g.kM()); var l={};l.type=a;p.U?p.U.sendMessage("urn:x-cast:com.google.youtube.mdx",l,function(){},(0,g.bn)(function(){vo(this,"Failed to send message: "+a+".")},p)):vo(p,"Sending yt message without session: "+g.kM(l))},aPB=function(p){return p.S?1:p.L?p.L.size:0},KM=function(){if(!lP2){var p=g.o4("yt.mdx.remote.screenService_"); lP2=p?new yYl(p):null}return lP2},nN1=function(p){var a=p.S.wT(),l=p.L&&p.L.S; p=g.lb(a,function(y){l&&er(y,l.label)&&(l=null);var S=y.uuid?y.uuid:y.id,n=S87(this,y);n?(n.label=S,n.friendlyName=y.name):(n=new chrome.cast.Receiver(S,y.name),n.receiverType=chrome.cast.ReceiverType.CUSTOM);return n},p); l&&(l.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(l=new chrome.cast.Receiver(l.label,l.friendlyName),l.receiverType=chrome.cast.ReceiverType.CUSTOM),p.push(l));return p},Vq8=function(p,a){p.L==a&&p.publish("yt-remote-cast2-session-failed")},ZTb=function(){var p=Ji(); this.L=p;p.eT("/client_streamz/youtube/living_room/mdx/channel/closed",g.wA("channel_type"))},oN7=function(p){p.audioTrackId=null; p.trackData=null;p.playerState=-1;p.NR=!1;p.nO=!1;p.G=0;p.W=g.XS();p.S=0;p.K=0;p.U=0;p.Z=0;p.L=NaN;p.j=!1},Ro=function(p){p||(g.ZF("yt-remote-session-screen-id"),g.ZF("yt-remote-session-video-id")); zWl();p=b2();g.FS(p,Io());dkc(p)},u2=function(p,a,l){Array.isArray(l)||(l=[String(l)]); g.VwM(p.j,a,l)},Oo=function(){},G2l=function(p){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(p)},Po=function(){return g.o4("yt.mdx.remote.connection_")},BVb=function(p,a){p.K=a.params.videoId||null; p.publish("autoplayUpNext",p.K)},wD7=function(){var p=cY7(); !p&&kl()&&rYG()&&(p={key:"cast-selector-receiver",name:rYG()});return p},LwM=function(p){var a,l; g.R(function(y){if(y.L==1)return g.DD(y,2),g.u(y,$ka(p),2);g.TK(y);a=p.U;p.U=[];l=a.length;PD7(p,a,l);Mm(p);return g.$F(y,0)})},xkc=function(){return XD7=XD7||new g.yT},CDG=function(p,a,l){p.info("onConnectedScreenData_: Received screenData: "+JSON.stringify(a)); var y=new ao(a);Fwb(p,y,function(S){S?(p.w7=!0,m_(p.j,y),dc(p,y),p.Sl="unknown",EN_(p,l)):(g.K8(Error("CastSession, RemoteScreen from screenData: "+JSON.stringify(a)+" is not online.")),p.Zb())},5)},tH=function(p){this.L=p},bTW=function(p,a){var l=null; if(a){var y=vNc(p);y&&(l={clientName:y.clientName,deviceMake:y.brand,deviceModel:y.model,osVersion:y.osVersion})}g.M8("yt.mdx.remote.remoteClient_",l);a&&(KwW(p),ZvK(p));l=p.S.F5()&&isNaN(p.G);a==l?a&&(jr(p,1),Wo(p,"getSubtitlesTrack")):a?(p.rL()&&p.L.reset(),jr(p,1),Wo(p,"getNowPlaying"),eWW(p)):p.IN(1)},uj_=function(p,a,l,y,S,n){p.info("getAutomaticScreenByIds "+l+" / "+a); l||(l=p.W[a]);var V=p.kc(),z=l?Ho(V,l):null;l&&(p.K||z)||(z=Ho(V,a));if(z){z.uuid=a;var d=m_(p,z);IP1(p.L,d,function(G){S(G?d:null)})}else l?RWG(p,l,(0,g.bn)(function(G){var B=m_(this,new ao({name:y, screenId:l,loungeToken:G,dialId:a||""}));IP1(this.L,B,function(c){S(c?B:null)})},p),n):S(null)},OTa=function(p,a){var l=a.params.hasNext=="true"; p.L.NR=a.params.hasPrevious=="true";p.L.nO=l;p.publish("previousNextChange")},hha=function(){var p=Uo7(); p&&p(!1,"No cast extension found")},DX=function(p,a){cea(p); p.j.setPlayerContextData(k2W(a));JsU(p)},HTM=function(p,a){Mq8(!0); mkK(!1);tqc(p,function(l){l?(jEc(!0),g.RL("yt-remote-cast2-api-ready")):(i2("Failed to initialize cast API."),Mq8(!1),g.ZF("yt-remote-cast-available"),g.ZF("yt-remote-cast-receiver"),Wwl());a(l)})},DkM=function(){return g.zv("yt-remote-local-screens")||[]},T_=function(){g.X.call(this,{X:"div", T:"ytp-mdx-popup-dialog",V:{role:"dialog"},N:[{X:"div",T:"ytp-mdx-popup-dialog-inner-content",N:[{X:"div",T:"ytp-mdx-popup-title",yY:"No has iniciado sesi\u00f3n"},{X:"div",T:"ytp-mdx-popup-description",yY:"Los v\u00eddeos que veas podr\u00edan aparecer en el historial de reproducciones de la TV e influir en las recomendaciones. Puedes evitarlo si cancelas e inicias sesi\u00f3n en YouTube desde tu ordenador."},{X:"div",T:"ytp-mdx-privacy-popup-buttons",N:[{X:"button",A9:["ytp-button","ytp-mdx-privacy-popup-cancel"], yY:"Cancelar"},{X:"button",A9:["ytp-button","ytp-mdx-privacy-popup-confirm"],yY:"Confirmar"}]}]}]});this.fade=new g.Gq(this,250);this.cancelButton=this.d7("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.d7("ytp-mdx-privacy-popup-confirm");g.E(this,this.fade);this.J(this.cancelButton,"click",this.L);this.J(this.confirmButton,"click",this.S)},iT_=function(p,a){this.action=p; this.params=a||{}},GQa=function(){if(!nM){var p=g.qb(); p&&(nM=new g.RF(p))}},TVK=function(p){p.W=g.zv("yt-remote-device-id-map")||{}},Mm=function(p){p.publish("handlerOpened"); p.VY.cX("BROWSER_CHANNEL")},Nm=function(p,a){g.qu.call(this); this.config_=a;this.S=p;this.Z=a.appId||"233637DE";this.j=a.theme||"cl";this.Sl=a.disableCastApi||!1;this.G=a.forceMirroring||!1;this.L=null;this.K=!1;this.U=[];this.W=(0,g.bn)(this.eFl,this)},NVl=function(p){if(p.N3==0)return p.Ha; var a=[];g.N7(a,onG(p.S));g.N7(a,p.U);return a},UkG=function(p){sEM.call(this); this.status=1;this.errorCode=p},hWa=function(p){p.Nn(1,0); p.F1=so(p,null,p.kd);QEW(p)},AY_=function(){var p=Ji(); this.L=p;p.eT("/client_streamz/youtube/living_room/mdx/channel/success")},Uo=function(p){this.scheme="https"; this.port=this.domain="";this.L="/api/lounge";this.S=!0;p=p||document.location.href;var a=Number(g.By(p)[4]||null)||"";a&&(this.port=":"+a);this.domain=g.Ir(p)||"";p=g.yI();p.search("MSIE")>=0&&(p=p.match(/MSIE ([\d.]+)/)[1],g.$O(p,"10.0")<0&&(this.S=!1))},ac2=function(p,a){GQa(); if(!nM||!nM.get("yt-remote-disable-remote-module-for-dev")){a=g.ZM("MDX_CONFIG")||a;gNG();zWl();Qs||(Qs=new Uo(a?a.loungeApiHost:void 0),ByB()&&(Qs.L="/api/loungedev"));hH||(hH=g.o4("yt.mdx.remote.deferredProxies_")||[],g.M8("yt.mdx.remote.deferredProxies_",hH));Y81();var l=KM();if(!l){var y=new AH(Qs,a?a.disableAutomaticScreenCache||!1:!1);g.M8("yt.mdx.remote.screenService_",y);l=KM();var S={};a&&(S={appId:a.appId,disableDial:a.disableDial,theme:a.theme,loadCastApiSetupScript:a.loadCastApiSetupScript, disableCastApi:a.disableCastApi,enableDialLoungeToken:a.enableDialLoungeToken,enableCastLoungeToken:a.enableCastLoungeToken,forceMirroring:a.forceMirroring});g.M8("yt.mdx.remote.enableConnectWithInitialState_",a?a.enableConnectWithInitialState||!1:!1);q82(p,y,function(n){n?Yl()&&wc(Yl(),"YouTube TV"):y.subscribe("onlineScreenChange",function(){qm("yt-remote-receiver-availability-change")})},S)}a&&!g.o4("yt.mdx.remote.initialized_")&&(g.M8("yt.mdx.remote.initialized_",!0),co("Initializing: "+g.kM(a)), JH.push(g.IL("yt-remote-cast2-api-ready",function(){qm("yt-remote-api-ready")})),JH.push(g.IL("yt-remote-cast2-availability-change",function(){qm("yt-remote-receiver-availability-change")})),JH.push(g.IL("yt-remote-cast2-receiver-selected",function(){fM(null); qm("yt-remote-auto-connect","cast-selector-receiver")})),JH.push(g.IL("yt-remote-cast2-receiver-resumed",function(){qm("yt-remote-receiver-resumed","cast-selector-receiver")})),JH.push(g.IL("yt-remote-cast2-session-change",gnM)),JH.push(g.IL("yt-remote-connection-change",function(n){n?wc(Yl(),"YouTube TV"):pb()||(wc(null,null),JYa())})),JH.push(g.IL("yt-remote-cast2-session-failed",function(){qm("yt-remote-connection-failed")})),p=fP8(),a.isAuto&&(p.id+="#dial"),S=a.capabilities||[],S.length>0&&(p.capabilities= S),p.name=a.device,p.app=a.app,(a=a.theme)&&(p.theme=a),co(" -- with channel params: "+g.kM(p)),p?(g.HE("yt-remote-session-app",p.app),g.HE("yt-remote-session-name",p.name)):(g.ZF("yt-remote-session-app"),g.ZF("yt-remote-session-name")),g.M8("yt.mdx.remote.channelParams_",p),l.start(),Yl()||piM())}},au=function(p){var a=xkc(); a.dispatchEvent(new lcG(a,p))},SLU=function(p,a,l,y,S){p.xB=1; p.iO=lI(a.clone());p.tX=null;p.QY=l;S&&(p.RO=!1);yhB(p,y)},SL=function(p,a,l){return(0,g.bn)(function(y){this.bG("Failed to "+a+" with cast v2 channel. Error code: "+y.code); y.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.bG("Retrying "+a+" using MDx browser channel."),yN(this,a,l))},p)},Jel=function(){this.S=null; this.L="";this.U=!1},zWl=function(){var p=b2(),a=Io(); g.yQ()&&g.fR(p,a);p=nA_(p);if(p.length==0)try{g.fjO("remote_sid")}catch(l){}else try{g.wh("remote_sid",p.join(","),-1)}catch(l){}},V47=function(p){p.YZ&&(g.dD.clearTimeout(p.YZ),p.YZ=null)},ZmK=function(p,a,l){l=Math.min(p.U.length,l); var y=p.W?(0,g.bn)(p.W.CS,p.W,p):null;a:{for(var S=p.U,n=-1;;){var V=["count="+l];n==-1?l>0?(n=S[0].L,V.push("ofs="+n)):n=0:V.push("ofs="+n);for(var z=!0,d=0;d1){if(l%2)throw Error("Uneven number of arguments");for(var y=0;y0&&(p.Oc=new g.yL((0,g.bn)(p.hh,p,p.Ao),p.Wj));p.U.listen(p.Ao,"readystatechange",p.hj);a=p.kt?g.j_(p.kt):{};p.tX?(p.Pz="POST",a["Content-Type"]="application/x-www-form-urlencoded",p.Ao.send(p.zq,p.Pz,p.tX,a)):(p.Pz="GET",p.RO&&!g.Hs&&(a.Connection="close"),p.Ao.send(p.zq,p.Pz,null,a));p.L.YY(1)},e7a=function(){mk||(mk=g.o4("yt.mdx.remote.debug.handlers_")||[],g.M8("yt.mdx.remote.debug.handlers_",mk))},Wwl=function(){PI("dispose"); var p=eL();p&&p.dispose();g.M8("yt.mdx.remote.cloudview.instance_",null);jEc(!1);g.Nz(beG);beG.length=0},R7b=function(p,a){var l=[]; Ix1(a,function(y){try{var S=g.we.prototype.XQ.call(this,y,!0)}catch(n){if(n=="Storage: Invalid value was encountered")return;throw n;}S===void 0?l.push(y):g.KQh(S)&&l.push(y)},p); return l},uf8=function(p){this.W=p||10; g.dD.PerformanceNavigationTiming?(p=g.dD.performance.getEntriesByType("navigation"),p=p.length>0&&(p[0].nextHopProtocol=="hq"||p[0].nextHopProtocol=="h2")):p=!!(g.dD.chrome&&g.dD.chrome.loadTimes&&g.dD.chrome.loadTimes()&&g.dD.chrome.loadTimes().wasFetchedViaSpdy);this.j=p?this.W:1;this.L=null;this.j>1&&(this.L=new Set);this.S=null;this.U=[]},IcB=function(p,a){if(p.L.playerState!=-1E3){var l=1085; switch(parseInt(a.params.adState,10)){case 1:l=1081;break;case 2:l=1084;break;case 0:l=1083}p.L.playerState=l;a=parseInt(a.params.currentTime,10);Fy(p.L,isNaN(a)?0:a);p.publish("remotePlayerChange")}},Mp2=function(p,a,l){p.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(a)); var y=new ao(a);return(new Promise(function(S){Oe7(p,y,function(n){n?(p.Xu=!0,m_(p.j,y),dc(p,y),G_(p,l)):g.K8(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(a)+" is not online."));S(n)},5)})).then(function(S){return S?new chrome.cast.DialLaunchResponse(!1):kzB(p)})},mYW=function(){var p=Ji(); this.L=p;p.eT("/client_streamz/youtube/living_room/mdx/channel/message_received",g.wA("channel_type"))},jP2=function(p){if(p.L||p.Z||p.Xu>=3)return!1; p.va++;p.Z=Eo((0,g.bn)(p.z$,p),tpa(p,p.Xu));p.Xu++;return!0},pM=function(p){return p.isPlaying()?(g.XS()-p.W)/1E3:0},ky=function(p,a){e7a(); var l=WMM(p,String(a));mk.length==0?Heb(l):(dY8(),g.Bf(mk,function(y){y(l)}))},DYG=function(){var p=G2l; e7a();mk.push(p);dY8()},ie7=function(){this.L=[]; this.S=[]},h71=function(p,a){try{var l=p.U; if(l.N3!=0&&(l.L==p||TkW(l.S,p)))if(!p.r7&&TkW(l.S,p)&&l.N3==3){try{var y=l.Sa.L.parse(a)}catch(v){y=null}if(Array.isArray(y)&&y.length==3){var S=y;if(S[0]==0)a:{if(!l.Z){if(l.L)if(l.L.w7+3E30&&(l.VY=1.5*d);y=l;var G=p.sJ();if(G){var B=g.Vk(G,"X-Client-Wire-Protocol");if(B){var c=y.S;!c.L&&(g.Gv(B,"spdy")||g.Gv(B,"quic")||g.Gv(B,"h2"))&&(c.j=c.W,c.L=new Set,c.S&&(EQ8(c,c.S),c.S=null))}if(y.QY){var r=g.Vk(G,"X-HTTP-Session-Id");r&&(y.Ae=r,g.r_(y.Hs,y.QY,r))}}l.N3=3;l.W&&l.W.Fy();l.O6&&(l.EC=Date.now()-p.w7);y=l;var w=p;y.Kt=Nkc(y,y.r7?y.Fh:null,y.oo); if(w.r7){sP1(y.S,w);var P=w,F=y.VY;F&&P.setTimeout(F);P.UO&&(UYK(P),BI(P));y.L=w}else QPc(y);l.U.length>0&&Sr(l)}else n[0]!="stop"&&n[0]!="close"||UE(l,7);else l.N3==3&&(n[0]=="stop"||n[0]=="close"?n[0]=="stop"?UE(l,7):l.disconnect():n[0]!="noop"&&l.W&&l.W.CX(n),l.Xu=0)}QN(4)}catch(v){}},UYK=function(p){p.UO&&(g.dD.clearTimeout(p.UO),p.UO=null)},AM_=function(p){return NVl(p.L).map(function(a){var l=p.S; a=a.map;"__data__"in a?(a=a.__data__,l=l.j?VAc(a):a):l=a;return l})},Yb1=function(p){if(p.yT||p.WO||p.Le>=3)return!1; p.K++;p.WO=ou((0,g.bn)(p.SC,p),gQW(p,p.Le));p.Le++;return!0},EQ8=function(p,a){p.L?p.L.add(a):p.S=a},qb2=function(p,a){var l=new wZ; if(g.dD.Image){var y=new Image;y.onload=g.CP(ZX,l,"TestLoadImage: loaded",!0,a,y);y.onerror=g.CP(ZX,l,"TestLoadImage: error",!1,a,y);y.onabort=g.CP(ZX,l,"TestLoadImage: abort",!1,a,y);y.ontimeout=g.CP(ZX,l,"TestLoadImage: timeout",!1,a,y);g.dD.setTimeout(function(){if(y.ontimeout)y.ontimeout()},1E4); y.src=p}else a(!1)},JM1=function(p,a){var l=p.screens.length; p.screens=g.Tz(p.screens,function(y){return!(y||a?!y!=!a?0:y.id==a.id:1)}); return p.screens.length1){var l=p-1;a.push("//www.gstatic.com/eureka/clank/"+p+"/cast_sender.js");a.push("//www.gstatic.com/eureka/clank/"+l+"/cast_sender.js")}return a},TtB=function(p,a,l){var y=new Image; y.onload=function(){try{ys(y),l(!0)}catch(S){}}; y.onerror=function(){try{ys(y),l(!1)}catch(S){}}; y.onabort=function(){try{ys(y),l(!1)}catch(S){}}; y.ontimeout=function(){try{ys(y),l(!1)}catch(S){}}; g.dD.setTimeout(function(){if(y.ontimeout)y.ontimeout()},a); y.src=p},TC=function(p,a){p.t9&&g.Re(p.t9,function(l,y){g.r_(a,y,l)}); p.W&&g.Re({},function(l,y){g.r_(a,y,l)})},PD7=function(p,a,l){for(var y=0;y=p.j:!1},aCU=function(p){return g.lb(p,function(a){return{key:a.id, name:a.name}})},axU=function(p){g.fs.call(this,"statevent",p)},S87=function(p,a){return a?g.rA(p.U,function(l){return er(a,l.label)},p):null},NI=function(p){p.CG&&(p.player.removeEventListener("presentingplayerstatechange",p.CG),p.CG=null)},lCb=function(p,a){return new g.V_1(p,a)},yT1=function(p,a){if(p.YZ!=null)throw Error("WatchDog timer not null"); p.YZ=ou((0,g.bn)(p.FY,p),a)},QEW=function(p){p.lk||p.zj||(p.zj=ou((0,g.bn)(p.Ux,p),0),p.SF=0)},Ji=function(){if(!h4){h4=new g.Rr(new SVl); var p=g.hh("client_streamz_web_flush_count",-1);p!==-1&&(h4.U=p)}return h4},A4=function(p,a){p.Yg&&(p=p.Yg.Ex())&&g.Re(p,function(l,y){g.r_(a,y,l)})},ecU=function(p,a){a.params=a.params||{}; zc8(p,a,"NOW_PLAYING_MAY_CHANGE");bmK(p,a);p.publish("autoplayDismissed")},nO8=function(p){var a={}; g.Bf(p.G(),function(l){l.token?a[l.token]=l.id:this.bG("Requesting availability of screen w/o lounge token.")}); return a},Z2W=function(p){p.t9&&!p.W&&Vhb(p,p.t9())},gA7=function(p,a){var l=p.get(a.uuid)||p.get(a.id); if(l)return p=l.name,l.id=a.id||l.id,l.name=a.name,l.token=a.token,l.uuid=a.uuid||l.uuid,l.name!=p;p.screens.push(a);return!0},oO_=function(p,a){g.aJ.call(this,p); this.L=a},qsb=function(p,a){p.experiments.clear(); a.split(",").forEach(function(l){p.experiments.add(l)})},zbG=function(p,a){var l=p.Z.receiver.label,y=p.S.friendlyName; return(new Promise(function(S){uj_(p.j,l,a,y,function(n){n&&n.token&&dc(p,n);S(n)},function(n){vo(p,"Failed to get DIAL screen: "+n); S(null)})})).then(function(S){return S&&S.token?new chrome.cast.DialLaunchResponse(!1):kzB(p)})},IP1=function(p,a,l){var y=Lb(p.W,"/pairing/get_screen_availability"); p.W.sendRequest("POST",y,{lounge_token:a.token},(0,g.bn)(function(S){S=S.screens||[];for(var n=S.length,V=0;Va.length)return cT1;a=a.slice(y,y+l);p.K=y+l;return a},yMc=function(p,a){var l=null; if(p.L==a){Zg(p);oAc(p);p.L=null;var y=2}else if(TkW(p.S,a))l=a.Xu,sP1(p.S,a),y=1;else return;if(p.N3!=0)if(a.G)if(y==1){l=a.Sl?a.Sl.length:0;a=Date.now()-a.w7;var S=p.w7;y=xkc();y.dispatchEvent(new $V8(y,l,a,S));Sr(p)}else QPc(p);else{var n=a.yQ;S=a.getLastError();if(S==3||S==0&&n>0||!(y==1&&Pbb(p,a)||y==2&&jP2(p)))switch(l&&l.length>0&&(a=p.S,a.U=a.U.concat(l)),S){case 1:UE(p,5);break;case 4:UE(p,10);break;case 3:UE(p,6);break;default:UE(p,2)}}},xVB=function(p,a){var l=p.VU,y=a.indexOf("\n",l); if(y==-1)return La_;l=Number(a.substring(l,y));if(isNaN(l))return XT1;y+=1;if(y+l>a.length)return La_;a=a.slice(y,y+l);p.VU=y+l;return a},Fwb=function(p,a,l,y){g.pI(p.G); p.G=0;Fa8(p.j,a,function(S){S||y<0?l(S):p.G=g.aY(function(){Fwb(p,a,l,y-1)},300)})},WMM=function(p,a){var l=(Date.now()-EOK)/1E3; l.toFixed&&(l=l.toFixed(3));var y=[];y.push("[",l+"s","] ");y.push("[","yt.mdx.remote","] ");y.push(p+": "+a,"\n");return y.join("")},tpa=function(p,a){var l=p.GO+Math.floor(Math.random()*p.M2); p.isActive()||(l*=2);return l*a},gQW=function(p,a){var l=5E3+Math.floor(Math.random()*1E4); p.isActive()||(l*=2);return l*a},Cbc=function(p){p=g.Tz(p.U,function(a){return a.idType!="shortLived"}); g.HE("yt-remote-automatic-screen-cache",g.lb(p,fUa))},Nkc=function(p,a,l){var y=g.BB(l); y.L!=""?(a&&g.AA(y,a+"."+y.L),g.tf(y,y.U)):(y=g.dD.location,y=wi1(y.protocol,a?a+"."+y.hostname:y.hostname,+y.port,l));a=p.QY;l=p.Ae;a&&l&&g.r_(y,a,l);g.r_(y,"VER",p.O5);TC(p,y);return y},xYa=function(p,a){R7b(p,a).forEach(function(l){g.we.prototype.remove.call(this,l)},p)},Ka1=function(p,a){if(a)if(p.u1>6){p.S=p.U.concat(p.S); p.U.length=0;var l=p.P2-1;a=vO1(p)}else l=a.K,a=a.tX;else l=p.P2++,a=vO1(p);var y=p.F1.clone();g.r_(y,"SID",p.j);g.r_(y,"RID",l);g.r_(y,"AID",p.Uv);A4(p,y);l=new HI(p,p.j,l,p.SF+1);l.kt=p.L8;l.setTimeout(1E4+Math.round(1E4*Math.random()));p.lk=l;D5b(l,y,a)},ebG=function(p){p.rq(0); p.S.stop();p.ju(new g.Z5(64))},b2B=function(p){return p.L?p.Bs=="GET"&&p.nz!=2&&p.U.L1:!1},piM=function(){var p=pb(); p?(co("Resume connection to: "+fS(p)),X5(p,0)):(Ro(),JYa(),co("Skipping connecting because no session screen found."))},dkc=function(p){g.HE("yt-remote-connected-devices",p,86400)},ICK=function(){g.HE("yt-remote-lounge-token-expiration",!0,86400)},kl=function(){return!!g.zv("yt-remote-cast-installed")},uhK=function(p){g.pD(p.channel,"m",function(){p.G=3; p.U.reset();p.Z=null;p.K=0;for(var a=g.t(p.Xu),l=a.next();!l.done;l=a.next())l=l.value,p.channel&&p.channel.send(l);p.Xu=[];p.publish("webChannelOpened");p.Hs.cX("WEB_CHANNEL")}); g.pD(p.channel,"n",function(){p.G=0;p.U.isActive()||p.publish("webChannelClosed");var a,l=(a=p.channel)==null?void 0:AM_(new Rb_(a,a.L));l&&(p.Xu=[].concat(g.u0(l)));p.Bs.cX("WEB_CHANNEL")}); g.pD(p.channel,"p",function(a){var l=a.data;l[0]==="gracefulReconnect"?(p.U.start(),p.channel&&p.channel.close()):p.publish("webChannelMessage",new iT_(l[0],l[1]));p.MA=a.statusCode;p.t9.cX("WEB_CHANNEL")}); g.pD(p.channel,"o",function(){p.MA===401||p.U.start();p.publish("webChannelError");p.QY.cX("WEB_CHANNEL","")})},Kb=function(){return!!g.o4("yt.mdx.remote.cloudview.apiReady_")},er=function(p,a){return!!a&&(p.id==a||p.uuid==a)},LMW=function(p,a){p.w7=Date.now(); BI(p);p.Kz=p.Z.clone();u2(p.Kz,"t",p.va);p.K=0;var l=p.U.r7;p.S=new Jel;p.L=L1a(p.U,l?a:null,!p.Sl);p.VY>0&&(p.OO=new g.yL((0,g.bn)(p.qs,p,p.L),p.VY));p.Sb.listen(p.L,"readystatechange",p.PF);a=p.Hs?g.j_(p.Hs):{};p.Sl?(p.Bs||(p.Bs="POST"),a["Content-Type"]="application/x-www-form-urlencoded",p.L.send(p.Kz,p.Bs,p.Sl,a)):(p.Bs="GET",p.L.send(p.Kz,p.Bs,null,a));QN(1)},O2c=function(p){var a=0,l; for(l in p)a++;return a},VN=function(p,a,l){var y=p.videoId; p.videoId=a;p.index=l;a!=y&&oN7(p)},i2=function(p){ky("cloudview",p)},$V8=function(p,a,l,y){g.fs.call(this,"timingevent",p); this.size=a;this.rtt=l;this.retries=y},qI=function(p,a){g.gl.call(this,"Reproducir en",1,p,a); this.B=p;this.cf={};this.J(p,"onMdxReceiversChange",this.S);this.J(p,"presentingplayerstatechange",this.S);this.S()},kIc=function(p,a){g.qu.call(this); this.G=a;a=(a=g.zv("yt-remote-online-screen-ids")||"")?a.split(","):[];for(var l={},y=this.G(),S=y.length,n=0;n5&&(p=p.slice(p.length-5)); var a=g.lb(DkM(),function(y){return y.loungeToken}),l=g.lb(p,function(y){return y.loungeToken}); g.Ar(l,function(y){return!g.rW(a,y)})&&ICK(); g.HE("yt-remote-local-screens",p,31536E3)},Wo=function(p,a,l){l?$y("Sending: action="+a+", params="+g.kM(l)):$y("Sending: action="+a); p.S.sendMessage(a,l)},rc=function(){var p=Yl(); if(!p)return null;var a=KM().kc();return Ho(a,p)},eL=function(){return g.o4("yt.mdx.remote.cloudview.instance_")},X5=function(p,a){Yl(); rc()&&rc();if(sE)$l=p;else{sUc(p.id);var l=g.o4("yt.mdx.remote.enableConnectWithInitialState_")||!1;p=new J4(Qs,p,fP8(),l);p.connect(a,PXW());p.subscribe("beforeDisconnect",function(y){qm("yt-remote-before-disconnect",y)}); p.subscribe("beforeDispose",function(){Po()&&(Po(),vQ2(null))}); p.subscribe("browserChannelAuthError",function(){var y=rc();y&&y.idType=="shortLived"&&(Kb()?eL().handleBrowserChannelAuthError():i2("refreshLoungeToken called before API ready."))}); vQ2(p)}},mVc=function(){var p=Ji(); this.L=p;p.eT("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")},SVl=function(){},th8=function(p){p.screens=p.S.kc(); var a=p.W,l={},y;for(y in a)l[a[y]]=y;a=p.screens.length;for(y=0;y6&&a>0){var y=p.S[0].L;l.push("ofs="+y)}else y=0;for(var S={},n=0;n= 0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?nnl()>=60&&Fe_():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?hha():nnl()>=89?rMl():(XgK(),oo(BkW.map(cMl))))):PI("Cannot initialize because not running Chrome")},i2K=function(p,a,l){g.D.call(this); var y=this;this.L=p;this.B=a;this.Nc=l;this.events=new g.hm(this);this.W=!1;this.G=new g.Z5(64);this.S=new g.l_(this.h2,500,this);this.U=new g.l_(this.mx,1E3,this);this.Z=new Vs(this.ngu,0,this);this.j={};this.Sl=new g.l_(this.LZ,1E3,this);this.K=new g.yL(this.seekTo,1E3,this);this.UO=this.events.J(this.B,"onVolumeChange",function(S){XiB(y,S)}); g.E(this,this.events);this.events.J(a,"onCaptionsTrackListChanged",this.NGO);this.events.J(a,"captionschanged",this.QoI);this.events.J(a,"captionssettingschanged",this.wB);this.events.J(a,"videoplayerreset",this.m2);this.events.J(a,"mdxautoplaycancel",function(){y.Nc.KL()}); a.D("enable_mdx_video_play_directly")&&this.events.J(a,"videodatachange",function(){qLW(y.L)||cI(y)||Iu(y,0)}); p=this.Nc;p.Gm();p.subscribe("proxyStateChange",this.WQ,this);p.subscribe("remotePlayerChange",this.GV,this);p.subscribe("remoteQueueChange",this.m2,this);p.subscribe("previousNextChange",this.e4,this);p.subscribe("nowAutoplaying",this.S4,this);p.subscribe("autoplayDismissed",this.oa,this);g.E(this,this.S);g.E(this,this.U);g.E(this,this.Z);g.E(this,this.Sl);g.E(this,this.K);this.wB();this.m2();this.GV()},pK=function(p,a,l){zC.call(this,p,a,"CastSession"); var y=this;this.config_=l;this.U=null;this.Xu=(0,g.bn)(this.eV,this);this.Bs=(0,g.bn)(this.XXu,this);this.UO=g.aY(function(){TlB(y,null)},12E4); this.K=this.W=this.G=this.Z=0;this.w7=!1;this.Sl="unknown"},NlK=function(){var p=Ji(); this.L=p;p.eT("/client_streamz/youtube/living_room/mdx/channel/error",g.wA("channel_type"),g.wA("error_type"))},Yl=function(){return g.o4("yt.mdx.remote.currentScreenId_")},sCK=function(p,a){for(var l=p.screens.length,y=0;y0&&p.j=0; return g.TE||p},ZeW=function(p){this.U=[]; this.Fh=this.Kt=this.Hs=this.oo=this.L=this.Ae=this.QY=this.t9=this.K=this.eb=this.Sl=null;this.OY=this.Kz=0;this.n1=GC("failFast",!1,p);this.OO=this.UO=this.Z=this.G=this.W=null;this.qc=!0;this.Ct=this.nz=-1;this.va=this.Xu=this.w7=0;this.GO=GC("baseRetryDelayMs",5E3,p);this.M2=GC("retryDelaySeedMs",1E4,p);this.aM=GC("forwardChannelMaxRetries",2,p);this.o4=GC("forwardChannelRequestTimeoutMs",2E4,p);this.bf=p&&p.k37||void 0;this.TO=p&&p.sII||void 0;this.L1=p&&p.R8c||!1;this.VY=void 0;this.r7=p&&p.mAT|| !1;this.j="";this.S=new uf8(p&&p.Fcm);this.Sa=new YLU;this.Sb=p&&p.vYY||!1;this.Yv=p&&p.gYs||!1;this.Sb&&this.Yv&&(this.Yv=!1);this.rP=p&&p.oSu||!1;p&&p.Gds&&(this.qc=!1);this.O6=!this.Sb&&this.qc&&p&&p.LgO||!1;this.vZ=void 0;p&&p.fK&&p.fK>0&&(this.vZ=p.fK);this.yQ=void 0;this.EC=0;this.Ps=!1;this.Ha=this.Bs=null},JT_=function(p){if(p instanceof g.ZI)return p; if(typeof p.y9=="function")return p.y9(!1);if(g.BA(p)){var a=0,l=new g.ZI;l.next=function(){for(;;){if(a>=p.length)return g.nB;if(a in p)return g.aB(p[a++]);a++}}; return l}throw Error("Not implemented");},Dg=function(p){p.Gx!=null&&(g.dD.clearTimeout(p.Gx),p.Gx=null)},Fa8=function(p,a,l){IP1(p.L,a,l)},nK7=function(){},om=function(p){ky("Controller",p)},m_=function(p,a){var l=p.get(a.id); l?(l.uuid=a.uuid,a=l):((l=Ho(p.U,a.uuid))?(l.id=a.id,l.token=a.token,a=l):p.U.push(a),p.K||Cbc(p));TVK(p);p.W[a.uuid]=a.id;g.HE("yt-remote-device-id-map",p.W,31536E3);return a},TkW=function(p,a){return p.S?p.S==a:p.L?p.L.has(a):!1},VT2=function(p){p.G=g.aY(function(){$y("Connecting timeout"); p.IN(1)},2E4)},Vhb=function(p,a){if(p.L){var l=p.L.L8||{}; a&&Object.keys(a).length>0?l=Object.assign({},l,a):delete l.Authorization;p.L.L8=l}},rec=function(p,a){return g.d7_(p,a)},Nt8=function(p,a){p.L=0; p.Yg&&p.Yg.jC(a);ATM(p);wpl(p)},fcc=function(p){if(p.Ct){if(p.Ct.locationOverrideToken)return{locationOverrideToken:p.Ct.locationOverrideToken}; if(p.Ct.latitudeE7!=null&&p.Ct.longitudeE7!=null)return{latitudeE7:p.Ct.latitudeE7,longitudeE7:p.Ct.longitudeE7}}return null},Y81=function(){var p=fP8(); if(g.cL(p)){p=Io();var a=g.zv("yt-remote-session-name")||"",l=g.zv("yt-remote-session-app")||"";p={device:"REMOTE_CONTROL",id:p,name:a,app:l,mdxVersion:3};p.authuser=String(g.ZM("SESSION_INDEX","0"));(a=g.ZM("DELEGATED_SESSION_ID"))&&(p.pageId=String(a));g.M8("yt.mdx.remote.channelParams_",p)}},jEc=function(p){PI("setApiReady_ "+p); g.M8("yt.mdx.remote.cloudview.apiReady_",p)},jr=function(p,a){p.publish("proxyStateChange",a)},RcB=function(p,a){var l=a.params.muted=="true"; p.L.volume=parseInt(a.params.volume,10);p.L.muted=l;p.publish("remotePlayerChange")},ZWc=function(p,a,l){var y=this; l=l===void 0?function(){return""}:l; var S=S===void 0?new nK7:S;var n=n===void 0?new g.Y2:n;this.pathPrefix=p;this.L=a;this.w7=l;this.W=n;this.Z=null;this.Sl=this.K=0;this.channel=null;this.G=0;this.U=new Ru(function(){y.U.isActive();var V;((V=y.channel)==null?void 0:aPB((new Rb_(V,V.L)).L.S))===0&&y.connect(y.Z,y.K)}); this.j={};this.S={};this.UO=!1;this.logger=null;this.Xu=[];this.MA=void 0;this.Hs=new Leb;this.Bs=new ZTb;this.t9=new mYW;this.QY=new NlK},oK7=function(p,a){g.yT.call(this); var l=this;this.handler=p();this.handler.subscribe("handlerOpened",this.SV,this);this.handler.subscribe("handlerClosed",this.onClosed,this);this.handler.subscribe("handlerError",function(y,S){l.onError(S)}); this.handler.subscribe("handlerMessage",this.onMessage,this);this.L=a},kzB=function(p){return new Promise(function(a){p.Bs=PrB(); if(p.Hs){var l=new chrome.cast.DialLaunchResponse(!0,dVc(p));a(l);En1(p)}else p.UO=function(){g.pI(p.Sl);p.UO=function(){}; p.Sl=NaN;var y=new chrome.cast.DialLaunchResponse(!0,dVc(p));a(y);En1(p)},p.Sl=g.aY(function(){p.UO()},100)})},so=function(p,a,l){var y=g.BB(l); if(y.L!="")a&&g.AA(y,a+"."+y.L),g.tf(y,y.U);else{var S=window.location;y=wi1(S.protocol,a?a+"."+S.hostname:S.hostname,+S.port,l)}p.xl&&g.Re(p.xl,function(n,V){g.r_(y,V,n)}); g.r_(y,"VER",p.u1);A4(p,y);return y},zNa=function(p,a){if(p.L==1){if(!a){p.P2=Math.floor(Math.random()*1E5); a=p.P2++;var l=new HI(p,"",a);l.kt=p.L8;var y=vO1(p),S=p.F1.clone();g.r_(S,"RID",a);g.r_(S,"CVER","1");A4(p,S);D5b(l,S,y);p.lk=l;p.L=2}}else p.L==3&&(a?Ka1(p,a):p.S.length==0||p.lk||Ka1(p))},dLB=function(p){p.yT||p.WO||(p.K=1,p.WO=ou((0,g.bn)(p.SC,p),0),p.Le=0)},$ka=function(p){if(p.eb)return g.t_(); if(!p.va)return Gg8(p);p.Bs===null&&(p.Bs=Gg8(p));return p.Bs},cn1=function(p,a){a:if(O2c(a)!=O2c(p.L))var l=!1; else{l=g.V_(a);for(var y=l.length,S=0;S=p.S.j-(p.G?1: 0))return!1; if(p.G)return p.U=a.Xu.concat(p.U),!0;if(p.N3==1||p.N3==2||p.w7>=(p.n1?0:p.aM))return!1;p.G=Eo((0,g.bn)(p.xP,p,a),tpa(p,p.w7));p.w7++;return!0},Lb=function(p,a){var l=p.L; p.S&&(l=p.scheme+"://"+p.domain+p.port+p.L);return g.C2(l+a,{})},CqK=function(p){var a=p.L.G; a!=null?(EE(5),a?(EE(11),ls(p.L,p,!1)):(EE(12),ls(p.L,p,!0))):(p.EM=new HI(p),p.EM.kt=p.DD,a=p.L,a=so(a,a.zI()?p.Ca:null,p.Hj),EE(5),u2(a,"TYPE","xmlhttp"),SLU(p.EM,a,!1,p.Ca,!1))},vKa=function(){},Gg8=function(p){return g.Z$(p.Hs().then(function(a){Vhb(p,a)}).Nb(function(){}),function(){p.Bs=null})},qm=function(p,a){g.ng[p]=!0; var l=g.KJ();l&&l.publish.apply(l,arguments);g.ng[p]=!1},fS=function(p){return p?'{name:"'+p.name+'",id:'+p.id.substr(0,6)+"..,token:"+((p.token?".."+p.token.slice(-6):"-")+",uuid:"+(p.uuid?".."+p.uuid.slice(-6):"-")+",idType:"+p.idType+"}"):"null"},KGc=function(p,a){try{p.L.Ns(p,a),p.L.YY(4)}catch(l){}},nA_=function(p){if(p.length==0)return[]; var a=p[0].indexOf("#"),l=a==-1?p[0]:p[0].substring(0,a);return g.lb(p,function(y,S){return S==0?y:y.substring(l.length)})},tqc=function(p,a){eL().init(p,a)},co=function(p){ky("remote",p)},c$=function(p,a,l,y){zC.call(this,p,a,"DialSession"); this.config_=y;this.U=this.Z=null;this.Bs="";this.nz=l;this.Hs=null;this.UO=function(){}; this.Sl=NaN;this.t9=(0,g.bn)(this.El,this);this.W=function(){}; this.K=this.G=0;this.Xu=!1;this.w7="unknown"},eNc=function(p,a,l,y,S){g.qu.call(this); this.U=p;this.K=a;this.j=l;this.G=y;this.W=S;this.S=0;this.L=null;this.zR=NaN},zC=function(p,a,l){g.qu.call(this); this.QY=l;this.j=p;this.S=a;this.L=null},rI=function(p){V47(p); g.p3(p.Oc);p.Oc=null;p.W.stop();p.U.removeAll();if(p.Ao){var a=p.Ao;p.Ao=null;a.abort();a.dispose()}p.Mg&&(p.Mg=null)},EK2=function(p){d5W(p); p.Xu=g.aY(function(){Wo(p,"getNowPlaying")},2E4)},Heb=function(p){var a=(WI+1)%50; WI=a;t4[a]=p;jL||(jL=a==49)},bWM=function(p){var a=p.w7(); a?p.j["x-youtube-lounge-xsrf-token"]=a:delete p.j["x-youtube-lounge-xsrf-token"]},Om1=function(p,a){p.K=a.params.videoId; p.publish("nowAutoplaying",parseInt(a.params.timeout,10))},wWU=function(p,a,l,y,S,n,V,z,d,G,B,c,r,w){l=l===void 0?!1:l; y=y===void 0?function(){return""}:y; S=S===void 0?!1:S;n=n===void 0?!1:n;V=V===void 0?!1:V;z=z===void 0?function(){return g.t_({})}:z; d=d===void 0?!1:d;B=B===void 0?!1:B;c=c===void 0?!1:c;r=r===void 0?!1:r;w=w===void 0?!1:w;this.nz=p;this.UO=a;this.G=new g.Y2;this.S=new Ru(this.wiv,this);this.L=null;this.K=!1;this.Sl=null;this.w7="";this.Xu=this.Z=0;this.U=[];this.Ha=l;this.QY=y;this.W=n;this.Hs=z;this.t9=G;this.va=V;this.Bs=null;this.j=g.t_();this.Fh=S;this.eb=d;this.Sb=B;this.Yv=c;this.oo=r;this.yQ=w;this.VY=new Leb;this.r7=new ZTb;this.Ps=new AY_;this.Kz=new mYW;this.OO=new NlK;this.qc=new fV8;this.O6=new mVc},wI=function(p){return p.getState()== 1},rZ=function(p){return new SW(p.j.getPlayerContextData())},fM=function(p){g.M8("yt.mdx.remote.connectData_",p)}; g.dA.prototype.Qz=g.vr(49,function(){this.app.mD().Qz()}); g.Qy.prototype.Qz=g.vr(48,function(){this.sU=null}); g.dA.prototype.JA=g.vr(47,function(p){this.app.mD().JA(p)}); g.Qy.prototype.JA=g.vr(46,function(p){this.sU=p}); Leb.prototype.cX=function(p){this.L.Ui("/client_streamz/youtube/living_room/mdx/channel/opened",p)}; ZTb.prototype.cX=function(p){this.L.Ui("/client_streamz/youtube/living_room/mdx/channel/closed",p)}; mYW.prototype.cX=function(p){this.L.Ui("/client_streamz/youtube/living_room/mdx/channel/message_received",p)}; AY_.prototype.cX=function(){this.L.Ui("/client_streamz/youtube/living_room/mdx/channel/success")}; NlK.prototype.cX=function(p,a){this.L.Ui("/client_streamz/youtube/living_room/mdx/channel/error",p,a)}; fV8.prototype.cX=function(){this.L.Ui("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}; mVc.prototype.cX=function(){this.L.Ui("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}; g.L=xl.prototype;g.L.HL=function(){fb(this);for(var p=[],a=0;a2*this.size&&fb(this),!0):!1}; g.L.get=function(p,a){return Bo(this.S,p)?this.S[p]:a}; g.L.set=function(p,a){Bo(this.S,p)||(this.size+=1,this.L.push(p),this.BH++);this.S[p]=a}; g.L.forEach=function(p,a){for(var l=this.x$(),y=0;y=y.L.length)return g.nB;var n=y.L[a++];return g.aB(p?n:y.S[n])}; return S}; var FMW={YUY:"atp",LCO:"ska",Awl:"que",dJl:"mus",NpY:"sus",ozI:"dsp",cws:"seq",Siu:"mic",NdT:"dpa",ETY:"mlm",h3Y:"dsdtr",sD9:"ntb",o$l:"vsp",WEO:"scn",RYO:"rpe",PXO:"dcn",VRY:"dcp",KbO:"pas",FMO:"drq",tTO:"opf",d7T:"els",wWY:"isg",q9V:"svq",wLl:"mvp",LDs:"ads",E$I:"stcp",x9Y:"sads",CXu:"dloc",LE7:"dcw",U0s:"asw",SUc:"apw",jdT:"wrc",mJm:"pcw",G_7:"ipv",k4v:"ndt",abT:"ctops"},wg8={iEc:"u",s77:"cl",T3u:"k",jQm:"i",JoV:"cr",WbI:"m",Gfl:"g",u9:"up"},F1W={sz:"adPlaying",BE:"onAdStateChange"},EA2={H87:"nowPlaying", G4T:"onStateChange",sz:"adPlaying",BE:"onAdStateChange",gb:"nowPlayingShorts",Qs:"onShortsStateChange"},CzM={gb:"nowPlayingShorts",Qs:"onShortsStateChange"};F5.prototype.equals=function(p){return p?this.id==p.id:!1}; var t48="",nM=null;g.A(SVl,g.nD);var h4,sM1=hbU("loadCastFramework")||hbU("loadCastApplicationFramework"),BkW=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.tP(Vs,g.D);g.L=Vs.prototype;g.L.oW=function(p){this.j=arguments;this.L=!1;this.zR?this.U=g.XS()+this.N0:this.zR=g.cG(this.W,this.N0)}; g.L.stop=function(){this.zR&&(g.dD.clearTimeout(this.zR),this.zR=null);this.U=null;this.L=!1;this.j=[]}; g.L.pause=function(){++this.S}; g.L.resume=function(){this.S&&(--this.S,!this.S&&this.L&&(this.L=!1,this.G.apply(null,this.j)))}; g.L.fz=function(){this.stop();Vs.Lv.fz.call(this)}; g.L.qn=function(){this.zR&&(g.dD.clearTimeout(this.zR),this.zR=null);this.U?(this.zR=g.cG(this.W,this.U-g.XS()),this.U=null):this.S?this.L=!0:(this.L=!1,this.G.apply(null,this.j))};Oo.prototype.stringify=function(p){return g.dD.JSON.stringify(p,void 0)}; Oo.prototype.parse=function(p){return g.dD.JSON.parse(p,void 0)};g.tP(Pzc,g.fs);g.tP(sEM,g.fs);var XD7=null;g.tP(Rh8,g.fs);g.tP(lcG,g.fs);g.tP($V8,g.fs);wZ.prototype.debug=function(){}; wZ.prototype.info=function(){}; wZ.prototype.warning=function(){};var rTU={},cT1={};g.L=CM.prototype;g.L.setTimeout=function(p){this.Ps=p}; g.L.PF=function(p){p=p.target;var a=this.OO;a&&g.uV(p)==3?a.Nm():this.qs(p)}; g.L.qs=function(p){try{if(p==this.L)a:{var a=g.uV(this.L),l=this.L.S,y=this.L.getStatus();if(!(a<3)&&(a!=3||this.L&&(this.S.U||g.Bq(this.L)||g.GO(this.L)))){this.t9||a!=4||l==7||(l==8||y<=0?QN(3):QN(2));UYK(this);var S=this.L.getStatus();this.yQ=S;var n=S0W(this);if(this.G=S==200){if(this.eb&&!this.r7){b:{if(this.L){var V=g.Vk(this.L,"X-HTTP-Initial-Response");if(V&&!g.Ta(V)){var z=V;break b}}z=null}if(p=z)this.r7=!0,h71(this,p);else{this.G=!1;this.W=3;au(12);Yy(this);OE(this);break a}}if(this.QY){p= !0;for(var d;!this.t9&&this.K0&&!this.Ha&&(this.Ha=!0,this.U.X8(this)):(Yy(this),OE(this))}else h71(this,n);a==4&&Yy(this);this.G&&!this.t9&&(a==4?yMc(this.U,this):(this.G=!1,BI(this)))}else g.orv(this.L),S==400&&n.indexOf("Unknown SID")> 0?(this.W=3,au(12)):(this.W=0,au(13)),Yy(this),OE(this)}}}catch(G){}finally{}}; g.L.cancel=function(){this.t9=!0;Yy(this)}; g.L.Og=function(){this.UO=null;var p=Date.now();p-this.Yv>=0?(this.nz!=2&&(QN(3),au(17)),Yy(this),this.W=2,OE(this)):$5G(this,this.Yv-p)}; g.L.getLastError=function(){return this.W}; g.L.sJ=function(){return this.L};uf8.prototype.cancel=function(){this.U=onG(this);if(this.S)this.S.cancel(),this.S=null;else if(this.L&&this.L.size!==0){for(var p=g.t(this.L.values()),a=p.next();!a.done;a=p.next())a.value.cancel();this.L.clear()}};g.L=ZeW.prototype;g.L.O5=8;g.L.N3=1;g.L.connect=function(p,a,l,y){au(0);this.oo=p;this.t9=a||{};l&&y!==void 0&&(this.t9.OSID=l,this.t9.OAID=y);this.OO=this.qc;this.Hs=Nkc(this,null,this.oo);Sr(this)}; g.L.disconnect=function(){jCK(this);if(this.N3==3){var p=this.Kz++,a=this.Hs.clone();g.r_(a,"SID",this.j);g.r_(a,"RID",p);g.r_(a,"TYPE","terminate");TC(this,a);p=new CM(this,this.j,p);p.nz=2;p.Z=lI(a.clone());a=!1;if(g.dD.navigator&&g.dD.navigator.sendBeacon)try{a=g.dD.navigator.sendBeacon(p.Z.toString(),"")}catch(l){}!a&&g.dD.Image&&((new Image).src=p.Z,a=!0);a||(p.L=L1a(p.U,null),p.L.send(p.Z));p.w7=Date.now();BI(p)}zhB(this)}; g.L.h$=function(){return this.N3==0}; g.L.getState=function(){return this.N3}; g.L.xP=function(p){if(this.G)if(this.G=null,this.N3==1){if(!p){this.Kz=Math.floor(Math.random()*1E5);p=this.Kz++;var a=new CM(this,"",p),l=this.Sl;this.eb&&(l?(l=g.j_(l),g.Qt(l,this.eb)):l=this.eb);this.K!==null||this.Yv||(a.Hs=l,l=null);var y;if(this.Sb)a:{for(var S=y=0;S4096){y=S;break a}if(y===4096||S===this.U.length-1){y=S+1;break a}}y= 1E3}else y=1E3;y=ZmK(this,a,y);S=this.Hs.clone();g.r_(S,"RID",p);g.r_(S,"CVER",22);this.QY&&g.r_(S,"X-HTTP-Session-Id",this.QY);TC(this,S);l&&(this.Yv?y="headers="+g.Ls(g.rNF(l))+"&"+y:this.K&&g.w_(S,this.K,l));EQ8(this.S,a);this.rP&&g.r_(S,"TYPE","init");this.Sb?(g.r_(S,"$req",y),g.r_(S,"SID","null"),a.eb=!0,XpK(a,S,null)):XpK(a,S,y);this.N3=2}}else this.N3==3&&(p?CXK(this,p):this.U.length==0||doa(this.S)||CXK(this))}; g.L.z$=function(){this.Z=null;qVM(this);if(this.O6&&!(this.Ps||this.L==null||this.EC<=0)){var p=4*this.EC;this.Bs=Eo((0,g.bn)(this.BGI,this),p)}}; g.L.BGI=function(){this.Bs&&(this.Bs=null,this.OO=!1,this.Ps=!0,au(10),nb(this),qVM(this))}; g.L.X8=function(p){this.L==p&&this.O6&&!this.Ps&&(oAc(this),this.Ps=!0,au(11))}; g.L.Vx=function(){this.UO!=null&&(this.UO=null,nb(this),jP2(this),au(19))}; g.L.XlO=function(p){p?au(2):au(1)}; g.L.isActive=function(){return!!this.W&&this.W.isActive(this)}; g.L=QC7.prototype;g.L.Fy=function(){}; g.L.CX=function(){}; g.L.VG=function(){}; g.L.Pq=function(){}; g.L.isActive=function(){return!0}; g.L.CS=function(){};g.tP(MI,g.yT);MI.prototype.open=function(){this.L.W=this.U;this.G&&(this.L.r7=!0);this.L.connect(this.W,this.S||void 0)}; MI.prototype.close=function(){this.L.disconnect()}; MI.prototype.send=function(p){var a=this.L;if(typeof p==="string"){var l={};l.__data__=p;p=l}else this.j&&(l={},l.__data__=g.kM(p),p=l);a.U.push(new fxK(a.OY++,p));a.N3==3&&Sr(a)}; MI.prototype.fz=function(){this.L.W=null;delete this.U;this.L.disconnect();delete this.L;MI.Lv.fz.call(this)}; g.tP(pW8,Pzc);g.tP(UkG,sEM);g.tP(tH,QC7);tH.prototype.Fy=function(){this.L.dispatchEvent("m")}; tH.prototype.CX=function(p){this.L.dispatchEvent(new pW8(p))}; tH.prototype.VG=function(p){this.L.dispatchEvent(new UkG(p))}; tH.prototype.Pq=function(){this.L.dispatchEvent("n")}; Rb_.prototype.commit=function(p){this.L.yQ=p};var uI=new g.yT;g.A(axU,g.fs);g.L=HI.prototype;g.L.kt=null;g.L.OV=!1;g.L.YZ=null;g.L.Bj=null;g.L.qw=null;g.L.xB=null;g.L.iO=null;g.L.zq=null;g.L.tX=null;g.L.Ao=null;g.L.VU=0;g.L.Mg=null;g.L.Pz=null;g.L.vH=null;g.L.oU=-1;g.L.RO=!0;g.L.Za=!1;g.L.Wj=0;g.L.Oc=null;var XT1={},La_={};g.L=HI.prototype;g.L.setTimeout=function(p){this.S=p}; g.L.hj=function(p){p=p.target;var a=this.Oc;a&&g.uV(p)==3?a.Nm():this.hh(p)}; g.L.hh=function(p){try{if(p==this.Ao)a:{var a=g.uV(this.Ao),l=this.Ao.S,y=this.Ao.getStatus();if(g.Hs&&!g.PT("420+")){if(a<4)break a}else if(a<3||a==3&&!g.Bq(this.Ao))break a;this.Za||a!=4||l==7||(l==8||y<=0?this.L.YY(3):this.L.YY(2));V47(this);var S=this.Ao.getStatus();this.oU=S;var n=g.Bq(this.Ao);if(this.OV=S==200){a==4&&rI(this);if(this.QY){for(p=!0;!this.Za&&this.VU0?(this.vH=3,EE(13)):(this.vH=0,EE(14)),rI(this),LGl(this)}}catch(z){}finally{}}; g.L.cancel=function(){this.Za=!0;rI(this)}; g.L.FY=function(){this.YZ=null;var p=Date.now();p-this.Bj>=0?(this.xB!=2&&this.L.YY(3),rI(this),this.vH=2,EE(18),LGl(this)):yT1(this,this.Bj-p)}; g.L.getLastError=function(){return this.vH};g.L=Gwb.prototype;g.L.DD=null;g.L.EM=null;g.L.nQ=!1;g.L.Hj=null;g.L.Yc=null;g.L.dN=-1;g.L.Ca=null;g.L.Jq=null;g.L.connect=function(p){this.Hj=p;p=so(this.L,null,this.Hj);EE(3);Date.now();var a=this.L.Sl;a!=null?(this.Ca=a[0],(this.Jq=a[1])?(this.Yc=1,Vp2(this)):(this.Yc=2,CqK(this))):(u2(p,"MODE","init"),this.EM=new HI(this),this.EM.kt=this.DD,SLU(this.EM,p,!1,null,!0),this.Yc=0)}; g.L.UW=function(p){if(p)this.Yc=2,CqK(this);else{EE(4);var a=this.L;a.AD=a.dC.dN;Cb(a,9)}p&&this.YY(2)}; g.L.Qf=function(p){return this.L.Qf(p)}; g.L.abort=function(){this.EM&&(this.EM.cancel(),this.EM=null);this.dN=-1}; g.L.h$=function(){return!1}; g.L.Ns=function(p,a){this.dN=p.oU;if(this.Yc==0)if(a){try{var l=this.S.parse(a)}catch(y){p=this.L;p.AD=this.dN;Cb(p,2);return}this.Ca=l[0];this.Jq=l[1]}else p=this.L,p.AD=this.dN,Cb(p,2);else this.Yc==2&&(this.nQ?(EE(7),Date.now()):a=="11111"?(EE(6),this.nQ=!0,Date.now(),this.dN=200,this.EM.cancel(),EE(12),ls(this.L,this,!0)):(EE(8),Date.now(),this.nQ=!1))}; g.L.AK=function(){this.dN=this.EM.oU;if(this.EM.OV)this.Yc==0?this.Jq?(this.Yc=1,Vp2(this)):(this.Yc=2,CqK(this)):this.Yc==2&&(this.nQ?(EE(12),ls(this.L,this,!0)):(EE(11),ls(this.L,this,!1)));else{this.Yc==0?EE(9):this.Yc==2&&EE(10);var p=this.L;this.EM.getLastError();p.AD=this.dN;Cb(p,2)}}; g.L.zI=function(){return this.L.zI()}; g.L.isActive=function(){return this.L.isActive()}; g.L.YY=function(p){this.L.YY(p)};g.L=oQ1.prototype;g.L.L8=null;g.L.xl=null;g.L.lk=null;g.L.yT=null;g.L.kd=null;g.L.F1=null;g.L.YP=null;g.L.Rq=null;g.L.P2=0;g.L.Y2=0;g.L.Yg=null;g.L.zj=null;g.L.WO=null;g.L.Gx=null;g.L.dC=null;g.L.ih=null;g.L.Uv=-1;g.L.Lf=-1;g.L.AD=-1;g.L.SF=0;g.L.Le=0;g.L.u1=8;var Id1={OK:0,G2V:2,CUv:4,RoT:5,JDl:6,STOP:7,WE:8,j7Y:9,LMO:10,UbT:11,X9l:12};g.tP(m5U,g.fs);g.tP(lUG,g.fs);g.L=oQ1.prototype; g.L.connect=function(p,a,l,y,S){EE(0);this.kd=a;this.xl=l||{};y&&S!==void 0&&(this.xl.OSID=y,this.xl.OAID=S);this.Z?(ou((0,g.bn)(this.Dj,this,p),100),hWa(this)):this.Dj(p)}; g.L.disconnect=function(){wpl(this);if(this.L==3){var p=this.P2++,a=this.F1.clone();g.r_(a,"SID",this.j);g.r_(a,"RID",p);g.r_(a,"TYPE","terminate");A4(this,a);p=new HI(this,this.j,p);p.xB=2;p.iO=lI(a.clone());(new Image).src=p.iO.toString();p.qw=Date.now();KMW(p)}ATM(this)}; g.L.Dj=function(p){this.dC=new Gwb(this);this.dC.DD=this.L8;this.dC.S=this.W;this.dC.connect(p)}; g.L.h$=function(){return this.L==0}; g.L.getState=function(){return this.L}; g.L.Ux=function(p){this.zj=null;zNa(this,p)}; g.L.SC=function(){this.WO=null;this.yT=new HI(this,this.j,"rpc",this.K);this.yT.kt=this.L8;this.yT.Wj=0;var p=this.YP.clone();g.r_(p,"RID","rpc");g.r_(p,"SID",this.j);g.r_(p,"CI",this.ih?"0":"1");g.r_(p,"AID",this.Uv);A4(this,p);g.r_(p,"TYPE","xmlhttp");SLU(this.yT,p,!0,this.Rq,!1)}; g.L.Ns=function(p,a){if(this.L!=0&&(this.yT==p||this.lk==p))if(this.AD=p.oU,this.lk==p&&this.L==3)if(this.u1>7){try{var l=this.W.parse(a)}catch(y){l=null}if(Array.isArray(l)&&l.length==3)if(p=l,p[0]==0)a:{if(!this.WO){if(this.yT)if(this.yT.qw+3E30)){if(y=a==1)this.lk||this.zj||this.L==1||this.SF>=2?y=!1:(this.zj=ou((0,g.bn)(this.Ux,this,p),gQW(this,this.SF)),this.SF++, y=!0);y=!(y||a==2&&Yb1(this))}if(y)switch(l){case 1:Cb(this,5);break;case 4:Cb(this,10);break;case 3:Cb(this,6);break;case 7:Cb(this,12);break;default:Cb(this,2)}}}; g.L.Nn=function(p){if(!g.rW(arguments,this.L))throw Error("Unexpected channel state: "+this.L);}; g.L.jvI=function(p){p?EE(2):(EE(1),Nt8(this,8))}; g.L.Qf=function(p){if(p)throw Error("Can't create secondary domain capable XhrIo object.");p=new g.Vi;p.K=!1;return p}; g.L.isActive=function(){return!!this.Yg&&this.Yg.isActive(this)}; g.L.YY=function(p){var a=uI;a.dispatchEvent(new lUG(a,p))}; g.L.zI=function(){return!1}; g.L=vKa.prototype;g.L.yX=function(){}; g.L.XU=function(){}; g.L.eC=function(){}; g.L.jC=function(){}; g.L.vj=function(){}; g.L.Ex=function(){return{}}; g.L.isActive=function(){return!0};g.L=ie7.prototype;g.L.enqueue=function(p){this.S.push(p)}; g.L.isEmpty=function(){return this.L.length===0&&this.S.length===0}; g.L.clear=function(){this.L=[];this.S=[]}; g.L.contains=function(p){return g.rW(this.L,p)||g.rW(this.S,p)}; g.L.remove=function(p){var a=this.L;var l=(0,g.L5c)(a,p);l>=0?(g.x3(a,l),a=!0):a=!1;return a||g.FS(this.S,p)}; g.L.HL=function(){for(var p=[],a=this.L.length-1;a>=0;--a)p.push(this.L[a]);a=this.S.length;for(var l=0;l=RNa.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(p=RNa[this.S],this.zR=g.aY((0,g.bn)(this.Z0,this),p),this.S++):this.publish("pairingFailed",Error("Server error "+p.status))}; g.L.yM=function(){this.L=null;this.publish("pairingFailed",Error("Server not responding"))}; var RNa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.tP(nK,iI);g.L=nK.prototype;g.L.start=function(){vI(this)&&this.publish("screenChange");!g.zv("yt-remote-lounge-token-expiration")&&jUb(this);g.pI(this.L);this.L=g.aY((0,g.bn)(this.start,this),1E4)}; g.L.add=function(p,a){vI(this);gA7(this,p);V4(this,!1);this.publish("screenChange");a(p);p.token||jUb(this)}; g.L.remove=function(p,a){var l=vI(this);JM1(this,p)&&(V4(this,!1),l=!0);a(p);l&&this.publish("screenChange")}; g.L.cS=function(p,a,l,y){var S=vI(this),n=this.get(p.id);n?(n.name!=a&&(n.name=a,V4(this,!1),S=!0),l(p)):y(Error("no such local screen."));S&&this.publish("screenChange")}; g.L.fz=function(){g.pI(this.L);nK.Lv.fz.call(this)}; g.L.WB=function(p){vI(this);var a=this.screens.length;p=p&&p.screens||[];for(var l=p.length,y=0;y20)break a;z=a(n,V)}n=z}S.name=n}l(m_(this,S))},this), onError:(0,g.bn)(function(S){y(Error("pairing request failed: "+S.status))},this), onTimeout:(0,g.bn)(function(){y(Error("pairing request timed out."))},this)})}; g.L.fz=function(){g.p3(this.S);g.p3(this.L);AH.Lv.fz.call(this)}; g.L.kI=function(){th8(this);this.publish("screenChange");this.L.update()}; AH.prototype.dispose=AH.prototype.dispose;g.tP(zC,g.qu);g.L=zC.prototype;g.L.Zb=function(p){this.Gm()||(p&&(vo(this,""+p),this.publish("sessionFailed")),this.L=null,this.publish("sessionScreen",null))}; g.L.info=function(p){ky(this.QY,p)}; g.L.WD=function(){return null}; g.L.xs=function(p){var a=this.S;p?(a.displayStatus=new chrome.cast.ReceiverDisplayStatus(p,[]),a.displayStatus.showStop=!0):a.displayStatus=null;chrome.cast.setReceiverDisplayStatus(a,(0,g.bn)(function(){this.info("Updated receiver status for "+a.friendlyName+": "+p)},this),(0,g.bn)(function(){vo(this,"Failed to update receiver status for: "+a.friendlyName)},this))}; g.L.fz=function(){this.xs("");zC.Lv.fz.call(this)};g.A(pK,zC);g.L=pK.prototype;g.L.Oh=function(p){if(this.U){if(this.U==p)return;vo(this,"Overriding cast session with new session object");WaW(this);this.w7=!1;this.Sl="unknown";this.U.removeUpdateListener(this.Xu);this.U.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Bs)}this.U=p;this.U.addUpdateListener(this.Xu);this.U.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.Bs);pDU(this,"getMdxSessionStatus")}; g.L.Jf=function(p){this.info("launchWithParams no-op for Cast: "+g.kM(p))}; g.L.stop=function(){this.U?this.U.stop((0,g.bn)(function(){this.Zb()},this),(0,g.bn)(function(){this.Zb(Error("Failed to stop receiver app."))},this)):this.Zb(Error("Stopping cast device without session."))}; g.L.xs=function(){}; g.L.fz=function(){this.info("disposeInternal");WaW(this);this.U&&(this.U.removeUpdateListener(this.Xu),this.U.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Bs));this.U=null;zC.prototype.fz.call(this)}; g.L.XXu=function(p,a){if(!this.Gm())if(a)if(a=l2(a),g.sC(a))switch(p=""+a.type,a=a.data||{},this.info("onYoutubeMessage_: "+p+" "+g.kM(a)),p){case "mdxSessionStatus":TlB(this,a);break;case "loungeToken":QUM(this,a);break;default:vo(this,"Unknown youtube message: "+p)}else vo(this,"Unable to parse message.");else vo(this,"No data in message.")}; g.L.im=function(p,a,l,y){g.pI(this.Z);this.Z=0;uj_(this.j,this.S.label,p,this.S.friendlyName,(0,g.bn)(function(S){S?a(S):y>=0?(vo(this,"Screen "+p+" appears to be offline. "+y+" retries left."),this.Z=g.aY((0,g.bn)(this.im,this,p,a,l,y-1),300)):l(Error("Unable to fetch screen."))},this),l)}; g.L.WD=function(){return this.U}; g.L.eV=function(p){this.Gm()||p||(vo(this,"Cast session died."),this.Zb())};g.A(c$,zC);g.L=c$.prototype;g.L.Oh=function(p){this.U=p;this.U.addUpdateListener(this.t9)}; g.L.Jf=function(p){this.Hs=p;this.UO()}; g.L.stop=function(){Aec(this);this.U?this.U.stop((0,g.bn)(this.Zb,this,null),(0,g.bn)(this.Zb,this,"Failed to stop DIAL device.")):this.Zb()}; g.L.fz=function(){Aec(this);this.U&&this.U.removeUpdateListener(this.t9);this.U=null;zC.prototype.fz.call(this)}; g.L.El=function(p){this.Gm()||p||(vo(this,"DIAL session died."),this.W(),this.W=function(){},this.Zb())};g.A(dZ,zC);dZ.prototype.stop=function(){this.Zb()}; dZ.prototype.Oh=function(){}; dZ.prototype.Jf=function(){g.pI(this.U);this.U=NaN;var p=Ho(this.j.kc(),this.S.label);p?dc(this,p):this.Zb(Error("No such screen"))}; dZ.prototype.fz=function(){g.pI(this.U);this.U=NaN;zC.prototype.fz.call(this)};g.A(Nm,g.qu);g.L=Nm.prototype; g.L.init=function(p,a){chrome.cast.timeout.requestSession=3E4;var l=new chrome.cast.SessionRequest(this.Z,[chrome.cast.Capability.AUDIO_OUT]);g.oO("desktop_enable_cast_connect")&&(l.androidReceiverCompatible=!0);this.Sl||(l.dialRequest=new chrome.cast.DialRequest("YouTube"));var y=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;p=p||this.G?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var S=(0,g.bn)(this.deT,this);l=new chrome.cast.ApiConfig(l,(0,g.bn)(this.bH, this),S,y,p);l.customDialLaunchCallback=(0,g.bn)(this.aNs,this);chrome.cast.initialize(l,(0,g.bn)(function(){this.Gm()||(chrome.cast.addReceiverActionListener(this.W),DYG(),this.S.subscribe("onlineScreenChange",(0,g.bn)(this.gT,this)),this.U=nN1(this),chrome.cast.setCustomReceivers(this.U,function(){},(0,g.bn)(function(n){this.bG("Failed to set initial custom receivers: "+g.kM(n))},this)),this.publish("yt-remote-cast2-availability-change",G8(this)),a(!0))},this),(0,g.bn)(function(n){this.bG("Failed to initialize API: "+ g.kM(n)); a(!1)},this))}; g.L.RLz=function(p,a){om("Setting connected screen ID: "+p+" -> "+a);if(this.L){var l=this.L.L;if(!p||l&&l.id!=p)om("Unsetting old screen status: "+this.L.S.friendlyName),gZ(this,null)}if(p&&a){if(!this.L){p=Ho(this.S.kc(),p);if(!p){om("setConnectedScreenStatus: Unknown screen.");return}if(p.idType=="shortLived"){om("setConnectedScreenStatus: Screen with id type to be short lived.");return}l=S87(this,p);l||(om("setConnectedScreenStatus: Connected receiver not custom..."),l=new chrome.cast.Receiver(p.uuid? p.uuid:p.id,p.name),l.receiverType=chrome.cast.ReceiverType.CUSTOM,this.U.push(l),chrome.cast.setCustomReceivers(this.U,function(){},(0,g.bn)(function(y){this.bG("Failed to set initial custom receivers: "+g.kM(y))},this))); om("setConnectedScreenStatus: new active receiver: "+l.friendlyName);gZ(this,new dZ(this.S,l),!0)}this.L.xs(a)}else om("setConnectedScreenStatus: no screen.")}; g.L.uFv=function(p){this.Gm()?this.bG("Setting connection data on disposed cast v2"):this.L?this.L.Jf(p):this.bG("Setting connection data without a session")}; g.L.WM=function(){this.Gm()?this.bG("Stopping session on disposed cast v2"):this.L?(this.L.stop(),gZ(this,null)):om("Stopping non-existing session")}; g.L.requestSession=function(){chrome.cast.requestSession((0,g.bn)(this.bH,this),(0,g.bn)(this.T$m,this))}; g.L.fz=function(){this.S.unsubscribe("onlineScreenChange",(0,g.bn)(this.gT,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.W);var p=G2l,a=g.o4("yt.mdx.remote.debug.handlers_");g.FS(a||[],p);g.p3(this.L);g.qu.prototype.fz.call(this)}; g.L.bG=function(p){ky("Controller",p)}; g.L.QC=function(p,a){this.L==p&&(a||gZ(this,null),this.publish("yt-remote-cast2-session-change",a))}; g.L.eFl=function(p,a){if(!this.Gm())if(p)switch(p.friendlyName=chrome.cast.unescape(p.friendlyName),om("onReceiverAction_ "+p.label+" / "+p.friendlyName+"-- "+a),a){case chrome.cast.ReceiverAction.CAST:if(this.L)if(this.L.S.label!=p.label)om("onReceiverAction_: Stopping active receiver: "+this.L.S.friendlyName),this.L.stop();else{om("onReceiverAction_: Casting to active receiver.");this.L.L&&this.publish("yt-remote-cast2-session-change",this.L.L);break}switch(p.receiverType){case chrome.cast.ReceiverType.CUSTOM:gZ(this, new dZ(this.S,p));break;case chrome.cast.ReceiverType.DIAL:gZ(this,new c$(this.S,p,this.j,this.config_));break;case chrome.cast.ReceiverType.CAST:gZ(this,new pK(this.S,p,this.config_));break;default:this.bG("Unknown receiver type: "+p.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.L&&this.L.S.label==p.label?this.L.stop():this.bG("Stopping receiver w/o session: "+p.friendlyName)}else this.bG("onReceiverAction_ called without receiver.")}; g.L.aNs=function(p){if(this.Gm())return Promise.reject(Error("disposed"));var a=p.receiver;a.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.bG("Not DIAL receiver: "+a.friendlyName),a.receiverType=chrome.cast.ReceiverType.DIAL);var l=this.L?this.L.S:null;if(!l||l.label!=a.label)return this.bG("Receiving DIAL launch request for non-clicked DIAL receiver: "+a.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(l&&l.label==a.label&&l.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.L.L)return om("Reselecting dial screen."), this.publish("yt-remote-cast2-session-change",this.L.L),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.bG('Changing CAST intent from "'+l.receiverType+'" to "dial" for '+a.friendlyName);gZ(this,new c$(this.S,a,this.j,this.config_))}a=this.L;a.Z=p;a.Z.appState==chrome.cast.DialAppState.RUNNING?(p=a.Z.extraData||{},l=p.screenId||null,z_(a)&&p.loungeToken?p.loungeTokenRefreshIntervalMs?p=Mp2(a,{name:a.S.friendlyName,screenId:p.screenId,loungeToken:p.loungeToken,dialId:a.Z.receiver.label, screenIdType:"shortLived"},p.loungeTokenRefreshIntervalMs):(g.K8(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(p)+".")),p=zbG(a,l)):p=zbG(a,l)):p=kzB(a);return p}; g.L.bH=function(p){var a=this;if(!this.Gm()&&!this.G){om("New cast session ID: "+p.sessionId);var l=p.receiver;if(l.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.L)if(l.receiverType==chrome.cast.ReceiverType.CAST)om("Got resumed cast session before resumed mdx connection."),l.friendlyName=chrome.cast.unescape(l.friendlyName),gZ(this,new pK(this.S,l,this.config_),!0);else{this.bG("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var y=this.L.S,S=Ho(this.S.kc(), y.label);S&&er(S,l.label)&&y.receiverType!=chrome.cast.ReceiverType.CAST&&l.receiverType==chrome.cast.ReceiverType.CAST&&(om("onSessionEstablished_: manual to cast session change "+l.friendlyName),g.p3(this.L),this.L=new pK(this.S,l,this.config_),this.L.subscribe("sessionScreen",(0,g.bn)(this.QC,this,this.L)),this.L.subscribe("sessionFailed",function(){return Vq8(a,a.L)}),this.L.Jf(null)); this.L.Oh(p)}}}; g.L.wv=function(){return this.L?this.L.WD():null}; g.L.T$m=function(p){this.Gm()||(this.bG("Failed to estabilish a session: "+g.kM(p)),p.code!=chrome.cast.ErrorCode.CANCEL&&gZ(this,null),this.publish("yt-remote-cast2-session-failed"))}; g.L.deT=function(p){om("Receiver availability updated: "+p);if(!this.Gm()){var a=G8(this);this.K=p==chrome.cast.ReceiverAvailability.AVAILABLE;G8(this)!=a&&this.publish("yt-remote-cast2-availability-change",G8(this))}}; g.L.gT=function(){this.Gm()||(this.U=nN1(this),om("Updating custom receivers: "+g.kM(this.U)),chrome.cast.setCustomReceivers(this.U,function(){},(0,g.bn)(function(){this.bG("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",G8(this)))}; Nm.prototype.setLaunchParams=Nm.prototype.uFv;Nm.prototype.setConnectedScreenStatus=Nm.prototype.RLz;Nm.prototype.stopSession=Nm.prototype.WM;Nm.prototype.getCastSession=Nm.prototype.wv;Nm.prototype.requestSession=Nm.prototype.requestSession;Nm.prototype.init=Nm.prototype.init;Nm.prototype.dispose=Nm.prototype.dispose;var u9b=g.to(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"]),beG=[],DV7=g.HS(u9b);g.L=SW.prototype; g.L.reset=function(p){this.listId="";this.index=-1;this.videoId="";oN7(this);this.volume=-1;this.muted=!1;p&&(this.index=p.index,this.listId=p.listId,this.videoId=p.videoId,this.playerState=p.playerState,this.volume=p.volume,this.muted=p.muted,this.audioTrackId=p.audioTrackId,this.trackData=p.trackData,this.NR=p.hasPrevious,this.nO=p.hasNext,this.G=p.playerTime,this.W=p.playerTimeAt,this.S=p.seekableStart,this.K=p.seekableEnd,this.U=p.duration,this.Z=p.loadedTime,this.L=p.liveIngestionTime,this.j= !isNaN(this.L))}; g.L.isPlaying=function(){return this.playerState==1}; g.L.isBuffering=function(){return this.playerState==3}; g.L.iK=function(p){this.U=isNaN(p)?0:p}; g.L.getDuration=function(){return this.j?this.U+pM(this):this.U}; g.L.clone=function(){return new SW(k2W(this))};g.A(dI,g.qu);g.L=dI.prototype;g.L.getState=function(){return this.U}; g.L.rC=function(){return this.j.getReconnectTimeout()}; g.L.Eo=function(){this.j.reconnect()}; g.L.play=function(){wI(this)?(this.L?this.L.play(null,g.xD,SL(this,"play")):yN(this,"play"),XWU(this,1,B$(rZ(this))),this.publish("remotePlayerChange")):Zr(this,this.play)}; g.L.pause=function(){wI(this)?(this.L?this.L.pause(null,g.xD,SL(this,"pause")):yN(this,"pause"),XWU(this,2,B$(rZ(this))),this.publish("remotePlayerChange")):Zr(this,this.pause)}; g.L.seekTo=function(p){if(wI(this)){if(this.L){var a=rZ(this),l=new chrome.cast.media.SeekRequest;l.currentTime=p;a.isPlaying()||a.isBuffering()?l.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:l.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.L.seek(l,g.xD,SL(this,"seekTo",{newTime:p}))}else yN(this,"seekTo",{newTime:p});XWU(this,3,p);this.publish("remotePlayerChange")}else Zr(this,g.CP(this.seekTo,p))}; g.L.stop=function(){if(wI(this)){this.L?this.L.stop(null,g.xD,SL(this,"stopVideo")):yN(this,"stopVideo");var p=rZ(this);p.index=-1;p.videoId="";oN7(p);DX(this,p);this.publish("remotePlayerChange")}else Zr(this,this.stop)}; g.L.setVolume=function(p,a){if(wI(this)){var l=rZ(this);if(this.S){if(l.volume!=p){var y=Math.round(p)/100;this.S.setReceiverVolumeLevel(y,(0,g.bn)(function(){Xy("set receiver volume: "+y)},this),(0,g.bn)(function(){this.bG("failed to set receiver volume.")},this))}l.muted!=a&&this.S.setReceiverMuted(a,(0,g.bn)(function(){Xy("set receiver muted: "+a)},this),(0,g.bn)(function(){this.bG("failed to set receiver muted.")},this))}else{var S={volume:p, muted:a};l.volume!=-1&&(S.delta=p-l.volume);yN(this,"setVolume",S)}l.muted=a;l.volume=p;DX(this,l)}else Zr(this,g.CP(this.setVolume,p,a))}; g.L.bV=function(p,a){if(wI(this)){var l=rZ(this);p={videoId:p};a&&(l.trackData={trackName:a.name,languageCode:a.languageCode,sourceLanguageCode:a.translationLanguage?a.translationLanguage.languageCode:"",languageName:a.languageName,kind:a.kind},p.style=g.kM(a.style),g.Qt(p,l.trackData));yN(this,"setSubtitlesTrack",p);DX(this,l)}else Zr(this,g.CP(this.bV,p,a))}; g.L.setAudioTrack=function(p,a){wI(this)?(a=a.getLanguageInfo().getId(),yN(this,"setAudioTrack",{videoId:p,audioTrackId:a}),p=rZ(this),p.audioTrackId=a,DX(this,p)):Zr(this,g.CP(this.setAudioTrack,p,a))}; g.L.playVideo=function(p,a,l,y,S,n,V){y=y===void 0?null:y;S=S===void 0?null:S;n=n===void 0?null:n;V=V===void 0?null:V;var z=rZ(this),d={videoId:p};l!==void 0&&(d.currentIndex=l);VN(z,p,l||0);a!==void 0&&(Fy(z,a),d.currentTime=a);y&&(d.listId=y);S&&(d.playerParams=S);n&&(d.clickTrackingParams=n);V&&(d.locationInfo=g.kM(V));yN(this,"setPlaylist",d);y||DX(this,z)}; g.L.lY=function(p,a){if(wI(this)){if(p&&a){var l=rZ(this);VN(l,p,a);DX(this,l)}yN(this,"previous")}else Zr(this,g.CP(this.lY,p,a))}; g.L.nextVideo=function(p,a){if(wI(this)){if(p&&a){var l=rZ(this);VN(l,p,a);DX(this,l)}yN(this,"next")}else Zr(this,g.CP(this.nextVideo,p,a))}; g.L.ML=function(){if(wI(this)){yN(this,"clearPlaylist");var p=rZ(this);p.reset();DX(this,p);this.publish("remotePlayerChange")}else Zr(this,this.ML)}; g.L.KL=function(){wI(this)?yN(this,"dismissAutoplay"):Zr(this,this.KL)}; g.L.dispose=function(){if(this.U!=3){var p=this.U;this.U=3;this.publish("proxyStateChange",p,this.U)}g.qu.prototype.dispose.call(this)}; g.L.fz=function(){cea(this);this.j=null;this.W.clear();z8(this,null);g.qu.prototype.fz.call(this)}; g.L.FZ=function(p){if((p!=this.U||p==2)&&this.U!=3&&p!=0){var a=this.U;this.U=p;this.publish("proxyStateChange",a,p);if(p==1)for(;!this.W.isEmpty();)a=p=this.W,a.L.length===0&&(a.L=a.S,a.L.reverse(),a.S=[]),p.L.pop().apply(this);else p==3&&this.dispose()}}; g.L.Xyl=function(p,a){this.publish(p,a)}; g.L.som=function(p){if(!p)this.sN(null),z8(this,null);else if(this.S.receiver.volume){p=this.S.receiver.volume;var a=rZ(this),l=Math.round(100*p.level||0);if(a.volume!=l||a.muted!=p.muted)Xy("Cast volume update: "+p.level+(p.muted?" muted":"")),a.volume=l,a.muted=!!p.muted,DX(this,a)}}; g.L.sN=function(p){Xy("Cast media: "+!!p);this.L&&this.L.removeUpdateListener(this.Z);if(this.L=p)this.L.addUpdateListener(this.Z),imG(this),this.publish("remotePlayerChange")}; g.L.lNT=function(p){p?(imG(this),this.publish("remotePlayerChange")):this.sN(null)}; g.L.G6=function(){yN(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}; g.L.Hx7=function(){var p=GI2();p&&z8(this,p)}; g.L.bG=function(p){ky("CP",p)};g.A(J4,g.qu);g.L=J4.prototype; g.L.connect=function(p,a){if(a){var l=a.listId,y=a.videoId,S=a.videoIds,n=a.playerParams,V=a.clickTrackingParams,z=a.index,d={videoId:y},G=a.currentTime,B=a.locationInfo;a=a.loopMode;G!==void 0&&(d.currentTime=G<=5?0:G);n&&(d.playerParams=n);B&&(d.locationInfo=B);V&&(d.clickTrackingParams=V);l&&(d.listId=l);S&&S.length>0&&(d.videoIds=S.join(","));z!==void 0&&(d.currentIndex=z);this.t9&&(d.loopMode=a||"LOOP_MODE_OFF");l&&(this.L.listId=l);this.L.videoId=y;this.L.index=z||0;this.L.state=3;Fy(this.L, G);this.W="UNSUPPORTED";l=this.t9?"setInitialState":"setPlaylist";$y("Connecting with "+l+" and params: "+g.kM(d));this.S.connect({method:l,params:g.kM(d)},p,chB())}else $y("Connecting without params"),this.S.connect({},p,chB());VT2(this)}; g.L.kp=function(p){this.S.kp(p)}; g.L.dispose=function(){this.Gm()||(g.M8("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),jr(this,3));g.qu.prototype.dispose.call(this)}; g.L.fz=function(){KwW(this);d5W(this);ZvK(this);g.pI(this.Z);this.Z=NaN;g.pI(this.Sl);this.Sl=NaN;this.j=null;g.Ue(this.UO);this.UO.length=0;this.S.dispose();g.qu.prototype.fz.call(this);this.W=this.K=this.U=this.L=this.S=null}; g.L.nu=function(p){if(!this.U||this.U.length===0)return!1;for(var a=g.t(this.U),l=a.next();!l.done;l=a.next())if(!l.value.capabilities.has(p))return!1;return!0}; g.L.P3=function(){var p=3;this.Gm()||(p=0,isNaN(this.hQ())?this.S.F5()&&isNaN(this.G)&&(p=1):p=2);return p}; g.L.IN=function(p){$y("Disconnecting with "+p);g.M8("yt.mdx.remote.remoteClient_",null);KwW(this);this.publish("beforeDisconnect",p);p==1&&Ro();this.S.disconnect(p);this.dispose()}; g.L.J0=function(){var p=this.L;this.j&&(p=this.L.clone(),VN(p,this.j,p.index));return k2W(p)}; g.L.agv=function(p){var a=this,l=new SW(p);l.videoId&&l.videoId!=this.L.videoId&&(this.j=l.videoId,g.pI(this.Z),this.Z=g.aY(function(){if(a.j){var S=a.j;a.j=null;a.L.videoId!=S&&Wo(a,"getNowPlaying")}},5E3)); var y=[];this.L.listId==l.listId&&this.L.videoId==l.videoId&&this.L.index==l.index||y.push("remoteQueueChange");this.L.playerState==l.playerState&&this.L.volume==l.volume&&this.L.muted==l.muted&&B$(this.L)==B$(l)&&g.kM(this.L.trackData)==g.kM(l.trackData)||y.push("remotePlayerChange");this.L.reset(p);g.Bf(y,function(S){this.publish(S)},this)}; g.L.rL=function(){var p=this.S.getDeviceId(),a=g.rA(this.U,function(l){return l.type=="REMOTE_CONTROL"&&l.id!=p}); return a?a.id:""}; g.L.hQ=function(){return this.S.rC()}; g.L.H3=function(){return this.W||"UNSUPPORTED"}; g.L.RV=function(){return this.K||""}; g.L.bD=function(){!isNaN(this.hQ())&&this.S.Eo()}; g.L.lgm=function(p,a){Wo(this,p,a);eWW(this)}; g.L.BD=function(){var p=g.cB("SAPISID","")||g.cB("__Secure-1PAPISID")||"",a=g.cB("__Secure-3PAPISID","")||"";if(!p&&!a)return"";p=g.MN(g.ij(p),2);a=g.MN(g.ij(a),2);return g.MN(g.ij(","+p+","+a),2)}; J4.prototype.subscribe=J4.prototype.subscribe;J4.prototype.unsubscribeByKey=J4.prototype.mN;J4.prototype.getProxyState=J4.prototype.P3;J4.prototype.disconnect=J4.prototype.IN;J4.prototype.getPlayerContextData=J4.prototype.J0;J4.prototype.setPlayerContextData=J4.prototype.agv;J4.prototype.getOtherConnectedRemoteId=J4.prototype.rL;J4.prototype.getReconnectTimeout=J4.prototype.hQ;J4.prototype.getAutoplayMode=J4.prototype.H3;J4.prototype.getAutoplayVideoId=J4.prototype.RV;J4.prototype.reconnect=J4.prototype.bD; J4.prototype.sendMessage=J4.prototype.lgm;J4.prototype.getXsrfToken=J4.prototype.BD;J4.prototype.isCapabilitySupportedOnConnectedDevices=J4.prototype.nu;g.A(yYl,iI);g.L=yYl.prototype;g.L.kc=function(p){return this.bN.$_gs(p)}; g.L.contains=function(p){return!!this.bN.$_c(p)}; g.L.get=function(p){return this.bN.$_g(p)}; g.L.start=function(){this.bN.$_st()}; g.L.add=function(p,a,l){this.bN.$_a(p,a,l)}; g.L.remove=function(p,a,l){this.bN.$_r(p,a,l)}; g.L.cS=function(p,a,l,y){this.bN.$_un(p,a,l,y)}; g.L.fz=function(){for(var p=this.L.length,a=0;a1&&!this.B.getOption("remote","quickCast")?(this.cf=g.tg(p,this.L,this),this.d3(g.lb(p,this.L)),p=this.B.getOption("remote","currentReceiver"),p=this.L(p),this.options[p]&&this.SE(p),this.enable(!0)):this.enable(!1)}; qI.prototype.L=function(p){return p.key}; qI.prototype.Xv=function(p){return p==="cast-selector-receiver"?"Enviar...":this.cf[p].name}; qI.prototype.fq=function(p){g.gl.prototype.fq.call(this,p);this.B.setOption("remote","currentReceiver",this.cf[p]);this.U6.Ro()};g.A(fCW,g.N_);g.L=fCW.prototype; g.L.create=function(){var p=this.player.C(),a=g.iT(p);p={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:p.D("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:p.D("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:p.D("enable_cast_short_lived_lounge_token")};ac2(a,p);this.subscriptions.push(g.IL("yt-remote-before-disconnect",this.bxT,this));this.subscriptions.push(g.IL("yt-remote-connection-change",this.WOI,this));this.subscriptions.push(g.IL("yt-remote-receiver-availability-change",this.d9, this));this.subscriptions.push(g.IL("yt-remote-auto-connect",this.wyu,this));this.subscriptions.push(g.IL("yt-remote-receiver-resumed",this.Eyv,this));this.subscriptions.push(g.IL("mdx-privacy-popup-confirm",this.pX7,this));this.subscriptions.push(g.IL("mdx-privacy-popup-cancel",this.TPl,this));this.d9()}; g.L.load=function(){this.player.cancelPlayback();g.N_.prototype.load.call(this);this.sU=new oO_(this.player.C(),this);this.player.JA(this.sU);this.f8=new i2K(this,this.player,this.Nc);var p=(p=PXW())?p.currentTime:0;var a=rh8()?new dI(Po(),void 0):null;p==0&&a&&(p=B$(rZ(a)));p!==0&&this.rq(p);PqK(this,this.qe,this.qe);this.player.Ja(6)}; g.L.unload=function(){this.player.publish("mdxautoplaycanceled");this.player.Qz();this.gC=this.g8;g.cX(this.f8,this.Nc);this.Nc=this.sU=this.f8=null;g.N_.prototype.unload.call(this);this.player.Ja(5);NI(this)}; g.L.fz=function(){g.Nz(this.subscriptions);g.N_.prototype.fz.call(this)}; g.L.ri=function(p){var a=g.D1.apply(1,arguments);this.loaded&&this.f8.kz.apply(this.f8,[p].concat(g.u0(a)))}; g.L.getAdState=function(){return this.D1}; g.L.NR=function(){return this.Nc?rZ(this.Nc).NR:!1}; g.L.nO=function(){return this.Nc?rZ(this.Nc).nO:!1}; g.L.rq=function(p,a){this.JZ=p||0;this.player.publish("progresssync",p,a);this.player.EE("onVideoProgress",p||0)}; g.L.getCurrentTime=function(){return this.JZ}; g.L.getDuration=function(){return rZ(this.Nc).getDuration()||0}; g.L.d$=function(){var p=rZ(this.Nc);return p.j?p.L+pM(p):p.L}; g.L.HW=function(){return rZ(this.Nc).Z}; g.L.Mb=function(){return SsM(rZ(this.Nc))}; g.L.Gd=function(){var p=rZ(this.Nc);return p.S>0?p.S+pM(p):p.S}; g.L.getProgressState=function(){var p=rZ(this.Nc),a=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:p.playerState!=1081&&this.player.NA(),clipEnd:a.clipEnd,clipStart:a.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:this.getDuration(),ingestionTime:this.d$(),isAtLiveHead:this.isAtLiveHead(),loaded:this.HW(),seekableEnd:this.Mb(),seekableStart:this.Gd(),offset:0,viewerLivestreamJoinMediaTime:0}}; g.L.isAtLiveHead=function(){return SsM(rZ(this.Nc))-this.getCurrentTime()<=1}; g.L.nextVideo=function(){this.Nc&&this.Nc.nextVideo()}; g.L.lY=function(){this.Nc&&this.Nc.lY()}; g.L.bxT=function(p){p===1&&(this.hR=this.Nc?rZ(this.Nc):null)}; g.L.WOI=function(){var p=rh8()?new dI(Po(),void 0):null;if(p){var a=this.gC;this.loaded&&this.unload();this.Nc=p;this.hR=null;a.key!==this.g8.key&&(this.gC=a,this.load())}else g.p3(this.Nc),this.Nc=null,this.loaded&&(this.unload(),(p=this.hR)&&p.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(p.videoId,B$(p)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}; g.L.d9=function(){var p=[this.g8],a=p.concat,l=xLc();kl()&&g.zv("yt-remote-cast-available")&&l.push({key:"cast-selector-receiver",name:"Cast..."});this.cf=a.call(p,l);p=wD7()||this.g8;bI(this,p);this.player.EE("onMdxReceiversChange")}; g.L.wyu=function(){var p=wD7();bI(this,p)}; g.L.Eyv=function(){this.gC=wD7()}; g.L.pX7=function(){this.FK=!0;NI(this);sE=!1;$l&&X5($l,1);$l=null}; g.L.TPl=function(){this.FK=!1;NI(this);bI(this,this.g8);this.gC=this.g8;sE=!1;$l=null;this.player.playVideo()}; g.L.jE=function(p,a){switch(p){case "casting":return this.loaded;case "receivers":return this.cf;case "currentReceiver":return a&&(a.key==="cast-selector-receiver"?YVc():bI(this,a)),this.loaded?this.gC:this.g8;case "quickCast":return this.cf.length===2&&this.cf[1].key==="cast-selector-receiver"?(a&&YVc(),!0):!1}}; g.L.G6=function(){this.Nc.G6()}; g.L.Z_=function(){return!1}; g.L.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]}; g.L.isLoggedIn=function(){var p,a;return((p=g.ZM("PLAYER_CONFIG"))==null?void 0:(a=p.args)==null?void 0:a.authuser)!==void 0?!0:!(!g.ZM("SESSION_INDEX")&&!g.ZM("LOGGED_IN"))};g.Qg("remote",fCW);})(_yt_player);