(function(g){var window=this;'use strict';var qG0=function(f){if(f instanceof g.Sg)return f;if(typeof f.bO=="function")return f.bO(!1);if(g.MC(f)){var D=0,F=new g.Sg;F.next=function(){for(;;){if(D>=f.length)return g.qY;if(D in f)return g.cM(f[D++]);D++}}; return F}throw Error("Not implemented");},HkU=function(f,D,F){if(g.MC(f))g.hC(f,D,F); else for(f=qG0(f);;){var Z=f.next();if(Z.done)break;D.call(F,Z.value,void 0,f)}},fZ=function(f){g.Kk(f,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^g.We()).toString(36)); return f},DX=function(f,D,F){Array.isArray(F)||(F=[String(F)]); g.khE(f.G,D,F)},oXL=function(f,D){var F=[]; HkU(D,function(Z){try{var I=g.t$.prototype.nI.call(this,Z,!0)}catch(p){if(p=="Storage: Invalid value was encountered")return;throw p;}I===void 0?F.push(Z):g.cbD(I)&&F.push(Z)},f); return F},KP0=function(f,D){oXL(f,D).forEach(function(F){g.t$.prototype.remove.call(this,F)},f)},kEv=function(f){if(f.Z5){if(f.Z5.locationOverrideToken)return{locationOverrideToken:f.Z5.locationOverrideToken}; if(f.Z5.latitudeE7!=null&&f.Z5.longitudeE7!=null)return{latitudeE7:f.Z5.latitudeE7,longitudeE7:f.Z5.longitudeE7}}return null},jqe=function(f,D){g.e0(f,D)||f.push(D)},ike=function(f){var D=0,F; for(F in f)D++;return D},hPY=function(f,D){return g.TD(f,D)},yfo=function(f){try{return g.RU.JSON.parse(f)}catch(D){}f=String(f); if(/^\s*$/.test(f)?0:/^[\],:{}\s\u2028\u2029]*$/.test(f.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+f+")")}catch(D){}throw Error("Invalid JSON string: "+f);},FG=function(f){if(g.RU.JSON)try{return g.RU.JSON.parse(f)}catch(D){}return yfo(f)},AfA=function(){var f=g.Bc(); this.Y=f;f.EQ("/client_streamz/youtube/living_room/mdx/channel/opened",g.HP("channel_type"))},$LU=function(){var f=g.Bc(); this.Y=f;f.EQ("/client_streamz/youtube/living_room/mdx/channel/closed",g.HP("channel_type"))},V$Y=function(){var f=g.Bc(); this.Y=f;f.EQ("/client_streamz/youtube/living_room/mdx/channel/message_received",g.HP("channel_type"))},RPv=function(){var f=g.Bc(); this.Y=f;f.EQ("/client_streamz/youtube/living_room/mdx/channel/success")},dLv=function(){var f=g.Bc(); this.Y=f;f.EQ("/client_streamz/youtube/living_room/mdx/channel/error",g.HP("channel_type"),g.HP("error_type"))},QqV=function(){var f=g.Bc(); this.Y=f;f.EQ("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")},CP0=function(){var f=g.Bc(); this.Y=f;f.EQ("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")},mLn=function(f,D,F,Z){var I=new g.Rd(null); f&&g.pk(I,f);D&&g.dT(I,D);F&&g.zE(I,F);Z&&(I.J=Z);return I},TS0=function(f,D){return new g.fY(f,D)},ZX=function(f,D){return Object.prototype.hasOwnProperty.call(f,D)},bkv=function(f,D){return f===D},IO=function(f,D){this.J={}; this.Y=[];this.dJ=this.size=0;var F=arguments.length;if(F>1){if(F%2)throw Error("Uneven number of arguments");for(var Z=0;Z5&&(f=f.slice(f.length-5)); var D=g.M2(gX0(),function(Z){return Z.loungeToken}),F=g.M2(f,function(Z){return Z.loungeToken}); g.tG(F,function(Z){return!g.e0(D,Z)})&&ePC(); g.w0("yt-remote-local-screens",f,31536E3)},j8=function(f){f||(g.B6("yt-remote-session-screen-id"),g.B6("yt-remote-session-video-id")); uE0();f=KZ();g.no(f,k8());EXL(f)},XbL=function(){if(!iV){var f=g.GP(); f&&(iV=new g.TP(f))}},Ok0=function(){XbL(); return iV?!!iV.get("yt-remote-use-staging-server"):!1},he=function(f,D){g.Yh[f]=!0; var F=g.O2();F&&F.publish.apply(F,arguments);g.Yh[f]=!1},nXU=function(){var f=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return f?parseInt(f[1],10):0},YGn=function(f){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+f)!=-1||document.currentScript.src.indexOf("&"+f)!=-1)},PPb=function(){return typeof window.__onGCastApiAvailable=="function"?window.__onGCastApiAvailable:null},y7=function(f){f.length?fy0(f.shift(),function(){y7(f)}):DIb()},FQc=function(f){return"chrome-extension://"+f+"/cast_sender.js"},fy0=function(f,D,F){var Z=document.createElement("script"); Z.onerror=D;F&&(Z.onload=F);g.GJ(Z,g.S_(f));(document.head||document.documentElement).appendChild(Z)},ZYU=function(){var f=nXU(),D=[]; if(f>1){var F=f-1;D.push("//www.gstatic.com/eureka/clank/"+f+"/cast_sender.js");D.push("//www.gstatic.com/eureka/clank/"+F+"/cast_sender.js")}return D},DIb=function(){var f=PPb(); f&&f(!1,"No cast extension found")},p$0=function(){if(Iy0){var f=2,D=PPb(),F=function(){f--; f==0&&D&&D(!0)}; window.__onGCastApiAvailable=F;fy0("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",DIb,F)}},zsb=function(){p$0(); var f=ZYU();f.push("//www.gstatic.com/eureka/clank/cast_sender.js");y7(f)},qEX=function(){p$0(); var f=ZYU();f.push.apply(f,g.w(sCL.map(FQc)));f.push("//www.gstatic.com/eureka/clank/cast_sender.js");y7(f)},Ae=function(f,D,F){g.J.call(this); this.T=F!=null?(0,g.aU)(f,F):f;this.cV=D;this.X=(0,g.aU)(this.I8,this);this.Y=!1;this.J=0;this.B=this.AZ=null;this.G=[]},$8=function(){this.Y=g.We()},HYX=function(){V7||(V7=new $8)},oao=function(){V7||(V7=new $8)},RO=function(){},KQn=function(){g.PP.call(this,"p")},kPE=function(){g.PP.call(this,"o")},iYe=function(){return jCL=jCL||new g.i7},hs0=function(f){g.PP.call(this,"serverreachability",f)},d6=function(f){var D=iYe(); D.dispatchEvent(new hs0(D,f))},y$Y=function(f){g.PP.call(this,"statevent",f)},Q7=function(f){var D=iYe(); D.dispatchEvent(new y$Y(D,f))},A$C=function(f,D,F,Z){g.PP.call(this,"timingevent",f); this.size=D;this.rtt=F;this.retries=Z},CZ=function(f,D){if(typeof f!=="function")throw Error("Fn must not be null and must be a function"); return g.RU.setTimeout(function(){f()},D)},mB=function(){},T_=function(f,D,F,Z){this.B=f; this.G=D;this.AN=F;this.gw=Z||1;this.G3=new g.hf(this);this.eT=45E3;this.Ir=null;this.T=!1;this.Jb=this.LQ=this.N=this.jT=this.xo=this.JN=this.Bs=null;this.KQ=[];this.Y=null;this.S=0;this.X=this.zx=null;this.Uq=-1;this.rY=!1;this.b3=0;this.Ps=null;this.Wk=this.dY=this.Z5=this.Tx=!1;this.J=new $IV},$IV=function(){this.B=null; this.Y="";this.J=!1},RsX=function(f,D,F){f.jT=1; f.N=fZ(D.clone());f.Jb=F;f.Tx=!0;Vk0(f,null)},Vk0=function(f,D){f.xo=Date.now(); bV(f);f.LQ=f.N.clone();DX(f.LQ,"t",f.gw);f.S=0;var F=f.B.dY;f.J=new $IV;f.Y=dIX(f.B,F?D:null,!f.Jb);f.b3>0&&(f.Ps=new g.YX((0,g.aU)(f.t5,f,f.Y),f.b3));f.G3.listen(f.Y,"readystatechange",f.D0);D=f.Ir?g.UQ(f.Ir):{};f.Jb?(f.zx||(f.zx="POST"),D["Content-Type"]="application/x-www-form-urlencoded",f.Y.send(f.LQ,f.zx,f.Jb,D)):(f.zx="GET",f.Y.send(f.LQ,f.zx,null,D));d6(1)},CSY=function(f){if(!QCC(f))return g.ey(f.Y); var D=g.xQ(f.Y);if(D==="")return"";var F="",Z=D.length,I=g.N4(f.Y)==4;if(!f.J.B){if(typeof TextDecoder==="undefined")return Md(f),te(f),"";f.J.B=new g.RU.TextDecoder}for(var p=0;pD.length)return mIc;D=D.slice(Z,Z+F);f.S=Z+F;return D},bV=function(f){f.JN=Date.now()+f.eT; MkV(f,f.eT)},MkV=function(f,D){if(f.Bs!=null)throw Error("WatchDog timer not null"); f.Bs=CZ((0,g.aU)(f.MC,f),D)},tkb=function(f){f.Bs&&(g.RU.clearTimeout(f.Bs),f.Bs=null)},te=function(f){f.B.wS()||f.rY||SE0(f.B,f)},Md=function(f){tkb(f); g.jg(f.Ps);f.Ps=null;f.G3.removeAll();if(f.Y){var D=f.Y;f.Y=null;D.abort();D.dispose()}},Bpo=function(f,D){try{var F=f.B; if(F.aA!=0&&(F.Y==f||c$o(F.J,f)))if(!f.dY&&c$o(F.J,f)&&F.aA==3){try{var Z=F.HD.Y.parse(D)}catch(b){Z=null}if(Array.isArray(Z)&&Z.length==3){var I=Z;if(I[0]==0)a:{if(!F.N){if(F.Y)if(F.Y.xo+3E30&&(F.b3=1.5*K);Z=F;var k=f.Er();if(k){var h=g.X6(k,"X-Client-Wire-Protocol");if(h){var y=Z.J;!y.Y&&(g.OQ(h,"spdy")||g.OQ(h,"quic")||g.OQ(h,"h2"))&&(y.G=y.X,y.Y=new Set,y.J&&(aye(y,y.J),y.J=null))}if(Z.Tx){var A=g.X6(k,"X-HTTP-Session-Id");A&&(Z.Fd=A,g.Kk(Z.Ir,Z.Tx,A))}}F.aA=3;F.X&&F.X.cP();F.BI&&(F.Xt=Date.now()-f.xo);Z=F;var V=f;Z.vI=GPV(Z,Z.dY?Z.AN:null,Z.m9); if(V.dY){w$c(Z.J,V);var R=V,m=Z.b3;m&&R.setTimeout(m);R.Bs&&(tkb(R),bV(R));Z.Y=V}else WQb(Z);F.B.length>0&&vW(F)}else p[0]!="stop"&&p[0]!="close"||U3(F,7);else F.aA==3&&(p[0]=="stop"||p[0]=="close"?p[0]=="stop"?U3(F,7):F.disconnect():p[0]!="noop"&&F.X&&F.X.nN(p),F.KQ=0)}d6(4)}catch(b){}},r$X=function(f,D){this.Y=f; this.map=D;this.context=null},LQn=function(f){this.X=f||10; g.RU.PerformanceNavigationTiming?(f=g.RU.performance.getEntriesByType("navigation"),f=f.length>0&&(f[0].nextHopProtocol=="hq"||f[0].nextHopProtocol=="h2")):f=!!(g.RU.chrome&&g.RU.chrome.loadTimes&&g.RU.chrome.loadTimes()&&g.RU.chrome.loadTimes().wasFetchedViaSpdy);this.G=f?this.X:1;this.Y=null;this.G>1&&(this.Y=new Set);this.J=null;this.B=[]},lyn=function(f){return f.J?!0:f.Y?f.Y.size>=f.G:!1},van=function(f){return f.J?1:f.Y?f.Y.size:0},c$o=function(f,D){return f.J?f.J==D:f.Y?f.Y.has(D):!1},aye= function(f,D){f.Y?f.Y.add(D):f.J=D},w$c=function(f,D){f.J&&f.J==D?f.J=null:f.Y&&f.Y.has(D)&&f.Y.delete(D)},Eao=function(f){if(f.J!=null)return f.B.concat(f.J.KQ); if(f.Y!=null&&f.Y.size!==0){var D=f.B;f=g.a(f.Y.values());for(var F=f.next();!F.done;F=f.next())D=D.concat(F.value.KQ);return D}return g.FI(f.B)},J$0=function(f,D){var F=new mB; if(g.RU.Image){var Z=new Image;Z.onload=g.wE(aO,F,"TestLoadImage: loaded",!0,D,Z);Z.onerror=g.wE(aO,F,"TestLoadImage: error",!1,D,Z);Z.onabort=g.wE(aO,F,"TestLoadImage: abort",!1,D,Z);Z.ontimeout=g.wE(aO,F,"TestLoadImage: timeout",!1,D,Z);g.RU.setTimeout(function(){if(Z.ontimeout)Z.ontimeout()},1E4); Z.src=f}else D(!1)},usA=function(f,D){var F=new mB,Z=new AbortController,I=setTimeout(function(){Z.abort(); aO(F,"TestPingServer: timeout",!1,D)},1E4); fetch(f,{signal:Z.signal}).then(function(p){clearTimeout(I);p.ok?aO(F,"TestPingServer: ok",!0,D):aO(F,"TestPingServer: server error",!1,D)}).catch(function(){clearTimeout(I); aO(F,"TestPingServer: error",!1,D)})},aO=function(f,D,F,Z,I){try{I&&(I.onload=null,I.onerror=null,I.onabort=null,I.ontimeout=null),Z(F)}catch(p){}},NpY=function(){this.Y=new RO},G_=function(f,D,F){return F&&F.G3r?F.G3r[f]||D:D},gan=function(f){this.B=[]; this.AN=this.vI=this.Ir=this.m9=this.Y=this.Fd=this.Tx=this.rY=this.S=this.Z5=this.Jb=null;this.B_=this.LQ=0;this.Dp=G_("failFast",!1,f);this.Ps=this.Bs=this.N=this.T=this.X=null;this.qb=!0;this.Gi=this.jT=-1;this.gw=this.KQ=this.xo=0;this.Y_=G_("baseRetryDelayMs",5E3,f);this.Gm=G_("retryDelaySeedMs",1E4,f);this.JS=G_("forwardChannelMaxRetries",2,f);this.K4=G_("forwardChannelRequestTimeoutMs",2E4,f);this.Zx=f&&f.cxd||void 0;this.Tm=f&&f.bmF||void 0;this.qz=f&&f.nb3||!1;this.b3=void 0;this.dY=f&&f.TMr|| !1;this.G="";this.J=new LQn(f&&f.hBI);this.OI=Math.min(f&&f.imY||1E3,1E3);this.HD=new NpY;this.G3=f&&f.AOd||!1;this.JN=f&&f.Qa3||!1;this.G3&&this.JN&&(this.JN=!1);this.KK=f&&f.GSy||!1;f&&f.vtr&&(this.qb=!1);this.BI=!this.G3&&this.qb&&f&&f.IsY||!1;this.WI=void 0;f&&f.SK&&f.SK>0&&(this.WI=f.SK);this.Uq=void 0;this.Xt=0;this.eT=!1;this.Wk=this.zx=null},cW=function(f){f.Y&&(esY(f),f.Y.cancel(),f.Y=null)},xIe=function(f){cW(f); f.N&&(g.RU.clearTimeout(f.N),f.N=null);S8(f);f.J.cancel();f.T&&(typeof f.T==="number"&&g.RU.clearTimeout(f.T),f.T=null)},vW=function(f){lyn(f.J)||f.T||(f.T=!0,g.mF(f.BP,f),f.xo=0)},OYY=function(f,D){if(van(f.J)>=f.J.G-(f.T?1:0))return!1; if(f.T)return f.B=D.KQ.concat(f.B),!0;if(f.aA==1||f.aA==2||f.xo>=(f.Dp?0:f.JS))return!1;f.T=CZ((0,g.aU)(f.BP,f,D),X$n(f,f.xo));f.xo++;return!0},YEY=function(f,D){var F; D?F=D.AN:F=f.LQ++;var Z=f.Ir.clone();g.Kk(Z,"SID",f.G);g.Kk(Z,"RID",F);g.Kk(Z,"AID",f.jT);w6(f,Z);f.S&&f.Jb&&g.iP(Z,f.S,f.Jb);F=new T_(f,f.G,F,f.xo+1);f.S===null&&(F.Ir=f.Jb);D&&(f.B=D.KQ.concat(f.B));D=naY(f,F,f.OI);F.setTimeout(Math.round(f.K4*.5)+Math.round(f.K4*.5*Math.random()));aye(f.J,F);RsX(F,Z,D)},w6=function(f,D){f.rY&&g.Ga(f.rY,function(F,Z){g.Kk(D,Z,F)}); f.X&&g.Ga({},function(F,Z){g.Kk(D,Z,F)})},naY=function(f,D,F){F=Math.min(f.B.length,F); var Z=f.X?(0,g.aU)(f.X.Wi,f.X,f):null;a:{for(var I=f.B,p=-1;;){var z=["count="+F];p==-1?F>0?(p=I[0].Y,z.push("ofs="+p)):p=0:z.push("ofs="+p);for(var H=!0,K=0;K=3)return!1; f.gw++;f.N=CZ((0,g.aU)(f.Jf,f),X$n(f,f.KQ));f.KQ++;return!0},esY=function(f){f.zx!=null&&(g.RU.clearTimeout(f.zx),f.zx=null)},PSn=function(f){f.Y=new T_(f,f.G,"rpc",f.gw); f.S===null&&(f.Y.Ir=f.Jb);f.Y.b3=0;var D=f.vI.clone();g.Kk(D,"RID","rpc");g.Kk(D,"SID",f.G);g.Kk(D,"AID",f.jT);g.Kk(D,"CI",f.Ps?"0":"1");!f.Ps&&f.WI&&g.Kk(D,"TO",f.WI);g.Kk(D,"TYPE","xmlhttp");w6(f,D);f.S&&f.Jb&&g.iP(D,f.S,f.Jb);f.b3&&f.Y.setTimeout(f.b3);var F=f.Y;f=f.AN;F.jT=1;F.N=fZ(D.clone());F.Jb=null;F.Tx=!0;Vk0(F,f)},S8=function(f){f.Bs!=null&&(g.RU.clearTimeout(f.Bs),f.Bs=null)},SE0=function(f,D){var F=null; if(f.Y==D){S8(f);esY(f);f.Y=null;var Z=2}else if(c$o(f.J,D))F=D.KQ,w$c(f.J,D),Z=1;else return;if(f.aA!=0)if(D.T)if(Z==1){F=D.Jb?D.Jb.length:0;D=Date.now()-D.xo;var I=f.xo;Z=iYe();Z.dispatchEvent(new A$C(Z,F,D,I));vW(f)}else WQb(f);else{var p=D.Uq;I=D.getLastError();if(I==3||I==0&&p>0||!(Z==1&&OYY(f,D)||Z==2&&UIe(f)))switch(F&&F.length>0&&(D=f.J,D.B=D.B.concat(F)),I){case 1:U3(f,5);break;case 4:U3(f,10);break;case 3:U3(f,6);break;default:U3(f,2)}}},X$n=function(f,D){var F=f.Y_+Math.floor(Math.random()* f.Gm); f.isActive()||(F*=2);return F*D},U3=function(f,D){if(D==2){var F=(0,g.aU)(f.MdT,f),Z=f.Tm,I=!Z; Z=new g.Rd(Z||"//www.google.com/images/cleardot.gif");g.RU.location&&g.RU.location.protocol=="http"||g.pk(Z,"https");fZ(Z);I?J$0(Z.toString(),F):usA(Z.toString(),F)}else Q7(2);f.aA=0;f.X&&f.X.KN(D);fVV(f);xIe(f)},fVV=function(f){f.aA=0; f.Wk=[];if(f.X){var D=Eao(f.J);if(D.length!=0||f.B.length!=0)g.Z0(f.Wk,D),g.Z0(f.Wk,f.B),f.J.B.length=0,g.FI(f.B),f.B.length=0;f.X.G9()}},DTn=function(f){if(f.aA==0)return f.Wk; var D=[];g.Z0(D,Eao(f.J));g.Z0(D,f.B);return D},GPV=function(f,D,F){var Z=g.tI(F); Z.Y!=""?(D&&g.dT(Z,D+"."+Z.Y),g.zE(Z,Z.B)):(Z=g.RU.location,Z=mLn(Z.protocol,D?D+"."+Z.hostname:Z.hostname,+Z.port,F));D=f.Tx;F=f.Fd;D&&F&&g.Kk(Z,D,F);g.Kk(Z,"VER",f.Ya);w6(f,Z);return Z},dIX=function(f,D,F){if(D&&!f.dY)throw Error("Can't create secondary domain capable XhrIo object."); D=f.qz&&!f.Zx?new g.ED(new g.Dz({FM:F})):new g.ED(f.Zx);D.S=f.dY;return D},Fxb=function(){},ZcE=function(){},BW=function(f,D){g.i7.call(this); this.Y=new gan(D);this.X=f;this.J=D&&D.qqs||null;f=D&&D.bpd||null;D&&D.Uvo&&(f?f["X-Client-Protocol"]="webchannel":f={"X-Client-Protocol":"webchannel"});this.Y.Jb=f;f=D&&D.S4r||null;D&&D.gT&&(f?f["X-WebChannel-Content-Type"]=D.gT:f={"X-WebChannel-Content-Type":D.gT});D&&D.cE&&(f?f["X-WebChannel-Client-Profile"]=D.cE:f={"X-WebChannel-Client-Profile":D.cE});this.Y.Z5=f;(f=D&&D.zWE)&&!g.XI(f)&&(this.Y.S=f);this.T=D&&D.TMr||!1;this.G=D&&D.r3s||!1;(D=D&&D.qyT)&&!g.XI(D)&&(this.Y.Tx=D,g.ma(this.J,D)&&(f= this.J,D in f&&delete f[D]));this.B=new WW(this)},IV0=function(f){KQn.call(this); f.__headers__&&(this.headers=f.__headers__,this.statusCode=f.__status__,delete f.__headers__,delete f.__status__);var D=f.__sm__;D?this.data=(this.Y=g.Ri(D))?g.S5(D,this.Y):D:this.data=f},pYe=function(f){kPE.call(this); this.status=1;this.errorCode=f},WW=function(f){this.Y=f},z_o=function(f,D){this.J=f; this.Y=D},sJL=function(f){return DTn(f.Y).map(function(D){var F=f.J; D=D.map;"__data__"in D?(D=D.__data__,F=F.G?yfo(D):D):F=D;return F})},r6=function(f,D){if(typeof f!=="function")throw Error("Fn must not be null and must be a function"); return g.RU.setTimeout(function(){f()},D)},lV=function(f){LZ.dispatchEvent(new qtc(LZ,f))},qtc=function(f){g.PP.call(this,"statevent",f)},E3=function(f,D,F,Z){this.Y=f; this.G=D;this.S=F;this.T=Z||1;this.J=45E3;this.B=new g.hf(this);this.X=new g.av;this.X.setInterval(250)},oWn=function(f,D,F){f.dG=1; f.LU=fZ(D.clone());f.HW=F;f.Tx=!0;Hco(f,null)},Kx0=function(f,D,F,Z,I){f.dG=1; f.LU=fZ(D.clone());f.HW=null;f.Tx=F;I&&(f.Ao=!1);Hco(f,Z)},Hco=function(f,D){f.yw=Date.now(); kGL(f);f.NF=f.LU.clone();DX(f.NF,"t",f.T);f.gG=0;f.dQ=f.Y.C8(f.Y.RH()?D:null);f.ZM>0&&(f.F$=new g.YX((0,g.aU)(f.E8,f,f.dQ),f.ZM));f.B.listen(f.dQ,"readystatechange",f.Fx);D=f.ip?g.UQ(f.ip):{};f.HW?(f.uL="POST",D["Content-Type"]="application/x-www-form-urlencoded",f.dQ.send(f.NF,f.uL,f.HW,D)):(f.uL="GET",f.Ao&&!g.dL&&(D.Connection="close"),f.dQ.send(f.NF,f.uL,null,D));f.Y.XD(1)},h_X=function(f,D){var F=f.gG,Z=D.indexOf("\n",F); if(Z==-1)return jJe;F=Number(D.substring(F,Z));if(isNaN(F))return icE;Z+=1;if(Z+F>D.length)return jJe;D=D.slice(Z,Z+F);f.gG=Z+F;return D},kGL=function(f){f.Ts=Date.now()+f.J; yDo(f,f.J)},yDo=function(f,D){if(f.bS!=null)throw Error("WatchDog timer not null"); f.bS=r6((0,g.aU)(f.jV,f),D)},ADU=function(f){f.bS&&(g.RU.clearTimeout(f.bS),f.bS=null)},$Tc=function(f){f.Y.wS()||f.pU||f.Y.lU(f)},Je=function(f){ADU(f); g.jg(f.F$);f.F$=null;f.X.stop();f.B.removeAll();if(f.dQ){var D=f.dQ;f.dQ=null;D.abort();D.dispose()}f.t_&&(f.t_=null)},V_n=function(f,D){try{f.Y.xa(f,D),f.Y.XD(4)}catch(F){}},dTX=function(f,D,F,Z,I){if(Z==0)F(!1); else{var p=I||0;Z--;R_V(f,D,function(z){z?F(!0):g.RU.setTimeout(function(){dTX(f,D,F,Z,p)},p)})}},R_V=function(f,D,F){var Z=new Image; Z.onload=function(){try{uV(Z),F(!0)}catch(I){}}; Z.onerror=function(){try{uV(Z),F(!1)}catch(I){}}; Z.onabort=function(){try{uV(Z),F(!1)}catch(I){}}; Z.ontimeout=function(){try{uV(Z),F(!1)}catch(I){}}; g.RU.setTimeout(function(){if(Z.ontimeout)Z.ontimeout()},D); Z.src=f},uV=function(f){f.onload=null; f.onerror=null;f.onabort=null;f.ontimeout=null},QJ0=function(f){this.Y=f; this.J=new RO},Cfb=function(f){var D=e8(f.Y,f.N4,"/mail/images/cleardot.gif"); fZ(D);dTX(D.toString(),5E3,(0,g.aU)(f.B4,f),3,2E3);f.XD(1)},mTU=function(f){var D=f.Y.T; D!=null?(lV(5),D?(lV(11),x8(f.Y,f,!1)):(lV(12),x8(f.Y,f,!0))):(f.K1=new E3(f),f.K1.ip=f.zs,D=f.Y,D=e8(D,D.RH()?f.QR:null,f.Sh),lV(5),DX(D,"TYPE","xmlhttp"),Kx0(f.K1,D,!1,f.QR,!1))},TBX=function(f,D,F){this.Y=1; this.J=[];this.B=[];this.X=new RO;this.Jb=f||null;this.T=D!=null?D:null;this.N=F||!1},bcA=function(f,D){this.Y=f; this.map=D;this.context=null},M_0=function(f,D,F,Z){g.PP.call(this,"timingevent",f); this.size=D;this.rtt=F;this.retries=Z},t_L=function(f){g.PP.call(this,"serverreachability",f)},cD0=function(f){f.NC(1,0); f.PZ=e8(f,null,f.DM);StV(f)},UT0=function(f){f.rF&&(f.rF.abort(),f.rF=null); f.Bl&&(f.Bl.cancel(),f.Bl=null);f.Xl&&(g.RU.clearTimeout(f.Xl),f.Xl=null);XG(f);f.Wn&&(f.Wn.cancel(),f.Wn=null);f.tO&&(g.RU.clearTimeout(f.tO),f.tO=null)},vWb=function(f,D){if(f.Y==0)throw Error("Invalid operation: sending map when state is closed"); f.J.push(new bcA(f.dV++,D));f.Y!=2&&f.Y!=3||StV(f)},aVV=function(f){var D=0; f.Bl&&D++;f.Wn&&D++;return D},StV=function(f){f.Wn||f.tO||(f.tO=r6((0,g.aU)(f.hf,f),0),f.s$=0)},WxL=function(f,D){if(f.Y==1){if(!D){f.H1=Math.floor(Math.random()*1E5); D=f.H1++;var F=new E3(f,"",D);F.ip=f.a6;var Z=GGX(f),I=f.PZ.clone();g.Kk(I,"RID",D);g.Kk(I,"CVER","1");O3(f,I);oWn(F,I,Z);f.Wn=F;f.Y=2}}else f.Y==3&&(D?wYe(f,D):f.J.length==0||f.Wn||wYe(f))},wYe=function(f,D){if(D)if(f.A3>6){f.J=f.B.concat(f.J); f.B.length=0;var F=f.H1-1;D=GGX(f)}else F=D.S,D=D.HW;else F=f.H1++,D=GGX(f);var Z=f.PZ.clone();g.Kk(Z,"SID",f.G);g.Kk(Z,"RID",F);g.Kk(Z,"AID",f.tH);O3(f,Z);F=new E3(f,f.G,F,f.s$+1);F.ip=f.a6;F.setTimeout(1E4+Math.round(1E4*Math.random()));f.Wn=F;oWn(F,Z,D)},O3=function(f,D){f.vl&&(f=f.vl.z9())&&g.Ga(f,function(F,Z){g.Kk(D,Z,F)})},GGX=function(f){var D=Math.min(f.J.length,1E3),F=["count="+D]; if(f.A3>6&&D>0){var Z=f.J[0].Y;F.push("ofs="+Z)}else Z=0;for(var I={},p=0;p=3)return!1; f.S++;f.Xl=r6((0,g.aU)(f.U8,f),rDe(f,f.qk));f.qk++;return!0},x8=function(f,D,F){f.Pv=f.T==null?F:!f.T; f.N0=D.fG;f.N||cD0(f)},XG=function(f){f.aE!=null&&(g.RU.clearTimeout(f.aE),f.aE=null)},rDe=function(f,D){var F=5E3+Math.floor(Math.random()*1E4); f.isActive()||(F*=2);return F*D},nZ=function(f,D){if(D==2||D==9){var F=null; f.vl&&(F=null);var Z=(0,g.aU)(f.IBR,f);F||(F=new g.Rd("//www.google.com/images/cleardot.gif"),fZ(F));R_V(F.toString(),1E4,Z)}else lV(2);lV0(f,D)},lV0=function(f,D){f.Y=0; f.vl&&f.vl.m0(D);EWe(f);UT0(f)},EWe=function(f){f.Y=0; f.N0=-1;if(f.vl)if(f.B.length==0&&f.J.length==0)f.vl.rO();else{var D=g.FI(f.B),F=g.FI(f.J);f.B.length=0;f.J.length=0;f.vl.rO(D,F)}},e8=function(f,D,F){var Z=g.tI(F); if(Z.Y!="")D&&g.dT(Z,D+"."+Z.Y),g.zE(Z,Z.B);else{var I=window.location;Z=mLn(I.protocol,D?D+"."+I.hostname:I.hostname,+I.port,F)}f.wg&&g.Ga(f.wg,function(p,z){g.Kk(Z,z,p)}); g.Kk(Z,"VER",f.A3);O3(f,Z);return Z},JD0=function(){},urY=function(){this.Y=[]; this.J=[]},NBL=function(f){g.PP.call(this,"channelMessage"); this.message=f},gWo=function(f){g.PP.call(this,"channelError"); this.error=f},e_0=function(f,D){this.action=f; this.params=D||{}},Y8=function(f,D){g.J.call(this); this.Y=new g.xX(this.f1I,0,this);g.N(this,this.Y);this.cV=5E3;this.retryCount=this.B9=0;if(typeof f==="function")D&&(f=(0,g.aU)(f,D));else if(f&&typeof f.handleEvent==="function")f=(0,g.aU)(f.handleEvent,f);else throw Error("Invalid listener argument");this.J=f},xTE=function(f,D,F,Z,I,p,z,H,K,k,h,y,A,V,R,m){var b=this; F=F===void 0?!1:F;Z=Z===void 0?function(){return""}:Z; I=I===void 0?!1:I;p=p===void 0?!1:p;z=z===void 0?!1:z;H=H===void 0?function(){return g.ts({})}:H; K=K===void 0?!1:K;h=h===void 0?!1:h;y=y===void 0?!1:y;A=A===void 0?!1:A;V=V===void 0?!1:V;this.Ps=f;this.xo=D;this.N=new g.mQ;this.T=m;this.J=(this.B=!!R)?R(function(){b.OX()}):new Y8(this.OX,this); this.Y=null;this.Jb=!1;this.KQ=null;this.Tx="";this.zx=this.Bs=0;this.G=[];this.AN=F;this.Ir=Z;this.S=p;this.dY=H;this.jT=k;this.m9=z;this.rY=null;this.X=g.ts();this.qb=I;this.gw=K;this.Z5=h;this.Uq=y;this.BI=A;this.Wk=V;this.JN=new AfA;this.LQ=new $LU;this.G3=new RPv;this.eT=new V$Y;this.b3=new dLv;this.Xt=new QqV;this.WI=new CP0},nWn=function(f,D,F,Z,I){XYL(f); if(f.Y){var p=g.nc("ID_TOKEN"),z=f.Y.a6||{};p?z["x-youtube-identity-token"]=p:delete z["x-youtube-identity-token"];f.Y.a6=z}Occ(f);Z?(Z.getState()!=3&&aVV(Z)==0||Z.getState(),f.Y.connect(D,F,f.xo,Z.G,Z.tH)):I?f.Y.connect(D,F,f.xo,I.sessionId,I.arrayId):f.Y.connect(D,F,f.xo);f.B&&!f.J.isActive()&&f.J.start();f.T&&f.T.egE()},D1o=function(f,D){return f.BI?!0:f.Uq?Object.values(YtE).includes(D):f.Z5?!Object.values(Pfn).includes(D):f.Wk?Object.values(fKC).includes(D):!1},IKn=function(f){var D,F; g.l(function(Z){if(Z.Y==1)return g.zc(Z,2),g.r(Z,FIb(f),2);g.oU(Z);D=f.G;f.G=[];F=D.length;ZOb(f,D,F);PW(f);return g.Ko(Z,0)})},ZOb=function(f,D,F){for(var Z=0;Z0?F=Object.assign({},F,D):delete F.Authorization;f.Y.a6=F}},Occ=function(f){f.jT&&!f.S&&z60(f,f.jT())},fw=function(f){this.scheme="https"; this.port=this.domain="";this.Y="/api/lounge";this.J=!0;f=f||document.location.href;var D=Number(g.R_(f)[4]||null)||"";D&&(this.port=":"+D);this.domain=g.dy(f)||"";f=g.DM();f.search("MSIE")>=0&&(f=f.match(/MSIE ([\d.]+)/)[1],g.fW(f,"10.0")<0&&(this.J=!1))},Dl=function(f,D){var F=f.Y; f.J&&(F=f.scheme+"://"+f.domain+f.port+f.Y);return g.tL(F+D,{})},sg0=function(f,D){g.i7.call(this); var F=this;this.handler=f();this.handler.subscribe("handlerOpened",this.gV,this);this.handler.subscribe("handlerClosed",this.onClosed,this);this.handler.subscribe("handlerError",function(Z,I){F.onError(I)}); this.handler.subscribe("handlerMessage",this.onMessage,this);this.Y=D},q4E=function(f,D,F){var Z=this; F=F===void 0?function(){return""}:F; var I=I===void 0?new ZcE:I;var p=p===void 0?new g.mQ:p;this.pathPrefix=f;this.Y=D;this.xo=F;this.X=p;this.N=null;this.Jb=this.S=0;this.channel=null;this.T=0;this.B=new Y8(function(){Z.B.isActive();var z;((z=Z.channel)==null?void 0:van((new z_o(z,z.Y)).Y.J))===0&&Z.connect(Z.N,Z.S)}); this.G={};this.J={};this.Bs=!1;this.logger=null;this.KQ=[];this.Qz=void 0;this.Ir=new AfA;this.zx=new $LU;this.rY=new V$Y;this.Tx=new dLv},HOE=function(f){g.sD(f.channel,"m",function(){f.T=3; f.B.reset();f.N=null;f.S=0;for(var D=g.a(f.KQ),F=D.next();!F.done;F=D.next())F=F.value,f.channel&&f.channel.send(F);f.KQ=[];f.publish("webChannelOpened");f.Ir.Dx("WEB_CHANNEL")}); g.sD(f.channel,"n",function(){f.T=0;f.B.isActive()||f.publish("webChannelClosed");var D,F=(D=f.channel)==null?void 0:sJL(new z_o(D,D.Y));F&&(f.KQ=[].concat(g.w(F)));f.zx.Dx("WEB_CHANNEL")}); g.sD(f.channel,"p",function(D){var F=D.data;F[0]==="gracefulReconnect"?(f.B.start(),f.channel&&f.channel.close()):f.publish("webChannelMessage",new e_0(F[0],F[1]));f.Qz=D.statusCode;f.rY.Dx("WEB_CHANNEL")}); g.sD(f.channel,"o",function(){f.Qz===401||f.B.start();f.publish("webChannelError");f.Tx.Dx("WEB_CHANNEL","")})},ooX=function(f){var D=f.xo(); D?f.G["x-youtube-lounge-xsrf-token"]=D:delete f.G["x-youtube-lounge-xsrf-token"]},KIb=function(f){g.i7.call(this); this.Y=f();this.Y.subscribe("webChannelOpened",this.Qs,this);this.Y.subscribe("webChannelClosed",this.onClosed,this);this.Y.subscribe("webChannelError",this.onError,this);this.Y.subscribe("webChannelMessage",this.onMessage,this)},kre=function(f,D,F,Z,I){function p(){return new xTE(Dl(f,"/bc"),D,!1,F,Z)} F=F===void 0?function(){return""}:F; return g.CO("enable_mdx_web_channel_desktop")?new KIb(function(){return new q4E(Dl(f,"/wc"),D,F)}):new sg0(p,I)},yWV=function(){var f=jgL; iOb();FU.push(f);h6X()},Zl=function(f,D){iOb(); var F=AWL(f,String(D));FU.length==0?$1U(F):(h6X(),g.hC(FU,function(Z){Z(F)}))},IW=function(f){Zl("CP",f)},iOb=function(){FU||(FU=g.QY("yt.mdx.remote.debug.handlers_")||[],g.dE("yt.mdx.remote.debug.handlers_",FU))},$1U=function(f){var D=(pw+1)%50; pw=D;z3[D]=f;s7||(s7=D==49)},h6X=function(){var f=FU; if(z3[0]){var D=s7?pw:-1,F={};do F={lk:void 0},D=(D+1)%50,F.lk=z3[D],g.hC(f,function(Z){return function(I){I(Z.lk)}}(F)); while(D!=pw);z3=Array(50);pw=-1;s7=!1}},AWL=function(f,D){var F=(Date.now()-VtC)/1E3; F.toFixed&&(F=F.toFixed(3));var Z=[];Z.push("[",F+"s","] ");Z.push("[","yt.mdx.remote","] ");Z.push(f+": "+D,"\n");return Z.join("")},qt=function(f){g.zu.call(this); this.T=f;this.screens=[]},R6X=function(f,D){var F=f.get(D.uuid)||f.get(D.id); if(F)return f=F.name,F.id=D.id||F.id,F.name=D.name,F.token=D.token,F.uuid=D.uuid||F.uuid,F.name!=f;f.screens.push(D);return!0},d1n=function(f,D){var F=f.screens.length!=D.length; f.screens=g.G$(f.screens,function(p){return!!rfX(D,p)}); for(var Z=D.length,I=0;I0&&f.G0&&dC(f,F)},function(D){f.X=function(){}; f.qM(D)})},noE=function(f){var D={}; D.pairingCode=f.zx;D.theme=f.jT;Ok0()&&(D.env_useStageMdx=1);return g.MX(D)},Y4U=function(f){return new Promise(function(D){f.zx=WPU(); if(f.Ir){var F=new chrome.cast.DialLaunchResponse(!0,noE(f));D(F);OOo(f)}else f.Bs=function(){g.Vu(f.Jb);f.Bs=function(){}; f.Jb=NaN;var Z=new chrome.cast.DialLaunchResponse(!0,noE(f));D(Z);OOo(f)},f.Jb=g.AW(function(){f.Bs()},100)})},f8U=function(f,D,F){f.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(D)); var Z=new s3(D);return(new Promise(function(I){PLE(f,Z,function(p){p?(f.KQ=!0,io(f.G,Z),yK(f,Z),dC(f,F)):g.fO(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(D)+" is not online."));I(p)},5)})).then(function(I){return I?new chrome.cast.DialLaunchResponse(!1):Y4U(f)})},DPb=function(f,D){var F=f.N.receiver.label,Z=f.J.friendlyName; return(new Promise(function(I){aK0(f.G,F,D,Z,function(p){p&&p.token&&yK(f,p);I(p)},function(p){Ad(f,"Failed to get DIAL screen: "+p); I(null)})})).then(function(I){return I&&I.token?new chrome.cast.DialLaunchResponse(!1):Y4U(f)})},PLE=function(f,D,F,Z){g.Vu(f.T); f.T=0;wRV(f.G,D,function(I){I||Z<0?F(I):f.T=g.AW(function(){PLE(f,D,F,Z-1)},300)})},dC=function(f,D){f.info("getDialAppInfoWithTimeout_ "+D); RW(f)&&(g.Vu(f.S),f.S=0,D==0?FWe(f):f.S=g.AW(function(){FWe(f)},D))},FWe=function(f){RW(f)&&f.B.getDialAppInfo(function(D){f.info("getDialAppInfo dialLaunchData: "+JSON.stringify(D)); D=D.extraData||{};var F=null;if(D.loungeToken){var Z;((Z=f.Y)==null?void 0:Z.token)==D.loungeToken&&(F="staleLoungeToken")}else F="missingLoungeToken";F?(f.xo=F,dC(f,3E4)):(f.KQ=!1,f.xo="unknown",LIU(f,D.loungeToken),dC(f,D.loungeTokenRefreshIntervalMs))},function(D){f.info("getDialAppInfo error: "+D); f.xo="noLoungeTokenResponse";dC(f,3E4)})},ZC0=function(f){g.Vu(f.T); f.T=0;g.Vu(f.S);f.S=0;f.X();f.X=function(){}; g.Vu(f.Jb)},QK=function(f,D){hd.call(this,f,D,"ManualSession"); this.B=g.AW((0,g.aU)(this.LI,this,null),150)},Cw=function(f,D){g.zu.call(this); this.config_=D;this.J=f;this.N=D.appId||"233637DE";this.G=D.theme||"cl";this.Jb=D.disableCastApi||!1;this.T=D.forceMirroring||!1;this.Y=null;this.S=!1;this.B=[];this.X=(0,g.aU)(this.DIE,this)},I8Y=function(f,D){return D?g.NC(f.B,function(F){return qd(D,F.label)},f):null},me=function(f){Zl("Controller",f)},jgL=function(f){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(f)},T3=function(f){return f.S||!!f.B.length||!!f.Y},bo=function(f,D,F){D!=f.Y&&(g.jg(f.Y),(f.Y=D)?(F?f.publish("yt-remote-cast2-receiver-resumed", D.J):f.publish("yt-remote-cast2-receiver-selected",D.J),D.subscribe("sessionScreen",(0,g.aU)(f.QJ,f,D)),D.subscribe("sessionFailed",function(){return p6V(f,D)}),D.Y?f.publish("yt-remote-cast2-session-change",D.Y):F&&f.Y.LI(null)):f.publish("yt-remote-cast2-session-change",null))},p6V=function(f,D){f.Y==D&&f.publish("yt-remote-cast2-session-failed")},zLe=function(f){var D=f.J.lG(),F=f.Y&&f.Y.J; f=g.M2(D,function(Z){F&&qd(Z,F.label)&&(F=null);var I=Z.uuid?Z.uuid:Z.id,p=I8Y(this,Z);p?(p.label=I,p.friendlyName=Z.name):(p=new chrome.cast.Receiver(I,Z.name),p.receiverType=chrome.cast.ReceiverType.CUSTOM);return p},f); F&&(F.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(F=new chrome.cast.Receiver(F.label,F.friendlyName),F.receiverType=chrome.cast.ReceiverType.CUSTOM),f.push(F));return f},iCE=function(f,D,F,Z){Z.disableCastApi?Mt("Cannot initialize because disabled by Mdx config."):s8E()?qg0(D,Z)&&(HCn(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?oj0(f,F):(window.__onGCastApiAvailable=function(I,p){I?oj0(f,F):(td("Failed to load cast API: "+p),KW0(!1),HCn(!1),g.B6("yt-remote-cast-available"),g.B6("yt-remote-cast-receiver"), kf0(),F(!1))},Z.loadCastApiSetupScript?g.Zd(j8n):window.navigator.userAgent.indexOf("Android")>=0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?nXU()>=60&&zsb():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?DIb():nXU()>=89?qEX():(p$0(),y7(sCL.map(FQc))))):Mt("Cannot initialize because not running Chrome")},kf0=function(){Mt("dispose"); var f=SV();f&&f.dispose();g.dE("yt.mdx.remote.cloudview.instance_",null);hLe(!1);g.Dd(yXV);yXV.length=0},c_=function(){return!!g.W6("yt-remote-cast-installed")},AXX=function(){var f=g.W6("yt-remote-cast-receiver"); return f?f.friendlyName:null},$PE=function(){Mt("clearCurrentReceiver"); g.B6("yt-remote-cast-receiver")},VMX=function(){return c_()?SV()?SV().getCastSession():(td("getCastSelector: Cast is not initialized."),null):(td("getCastSelector: Cast API is not installed!"),null)},RLo=function(){c_()?SV()?U7()?(Mt("Requesting cast selector."),SV().requestSession()):(Mt("Wait for cast API to be ready to request the session."),yXV.push(g.f_("yt-remote-cast2-api-ready",RLo))):td("requestCastSelector: Cast is not initialized."):td("requestCastSelector: Cast API is not installed!")}, v_=function(f,D){U7()?SV().setConnectedScreenStatus(f,D):td("setConnectedScreenStatus called before ready.")},s8E=function(){var f=g.DM().search(/ (CrMo|Chrome|CriOS)\//)>=0; return g.op||f},dPX=function(f,D){SV().init(f,D)},qg0=function(f,D){var F=!1; SV()||(f=new Cw(f,D),f.subscribe("yt-remote-cast2-availability-change",function(Z){g.w0("yt-remote-cast-available",Z);he("yt-remote-cast2-availability-change",Z)}),f.subscribe("yt-remote-cast2-receiver-selected",function(Z){Mt("onReceiverSelected: "+Z.friendlyName); g.w0("yt-remote-cast-receiver",Z);he("yt-remote-cast2-receiver-selected",Z)}),f.subscribe("yt-remote-cast2-receiver-resumed",function(Z){Mt("onReceiverResumed: "+Z.friendlyName); g.w0("yt-remote-cast-receiver",Z);he("yt-remote-cast2-receiver-resumed",Z)}),f.subscribe("yt-remote-cast2-session-change",function(Z){Mt("onSessionChange: "+HW(Z)); Z||g.B6("yt-remote-cast-receiver");he("yt-remote-cast2-session-change",Z)}),g.dE("yt.mdx.remote.cloudview.instance_",f),F=!0); Mt("cloudview.createSingleton_: "+F);return F},SV=function(){return g.QY("yt.mdx.remote.cloudview.instance_")},oj0=function(f,D){KW0(!0); HCn(!1);dPX(f,function(F){F?(hLe(!0),g.FJ("yt-remote-cast2-api-ready")):(td("Failed to initialize cast API."),KW0(!1),g.B6("yt-remote-cast-available"),g.B6("yt-remote-cast-receiver"),kf0());D(F)})},Mt=function(f){Zl("cloudview",f)},td=function(f){Zl("cloudview",f)},KW0=function(f){Mt("setCastInstalled_ "+f); g.w0("yt-remote-cast-installed",f)},U7=function(){return!!g.QY("yt.mdx.remote.cloudview.apiReady_")},hLe=function(f){Mt("setApiReady_ "+f); g.dE("yt.mdx.remote.cloudview.apiReady_",f)},HCn=function(f){g.dE("yt.mdx.remote.cloudview.initializing_",f)},aW=function(f){this.index=-1; this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.X=this.T=0;this.trackData=null;this.hasNext=this.hasPrevious=!1;this.loadedTime=this.B=this.S=this.J=0;this.Y=NaN;this.G=!1;this.reset(f)},Q8X=function(f){f.audioTrackId=null; f.trackData=null;f.playerState=-1;f.hasPrevious=!1;f.hasNext=!1;f.T=0;f.X=g.We();f.J=0;f.S=0;f.B=0;f.loadedTime=0;f.Y=NaN;f.G=!1},G3=function(f){return f.isPlaying()?(g.We()-f.X)/1E3:0},wC=function(f,D){f.T=D; f.X=g.We()},W_=function(f){switch(f.playerState){case 1:case 1081:return(g.We()-f.X)/1E3+f.T; case -1E3:return 0}return f.T},CqL=function(f){return f.G?f.S+G3(f):f.S},B_=function(f,D,F){var Z=f.videoId; f.videoId=D;f.index=F;D!=Z&&Q8X(f)},mPn=function(f){var D={}; D.index=f.index;D.listId=f.listId;D.videoId=f.videoId;D.playerState=f.playerState;D.volume=f.volume;D.muted=f.muted;D.audioTrackId=f.audioTrackId;D.trackData=g.vO(f.trackData);D.hasPrevious=f.hasPrevious;D.hasNext=f.hasNext;D.playerTime=f.T;D.playerTimeAt=f.X;D.seekableStart=f.J;D.seekableEnd=f.S;D.duration=f.B;D.loadedTime=f.loadedTime;D.liveIngestionTime=f.Y;return D},Lw=function(f,D){g.zu.call(this); var F=this;this.B=0;this.G=f;this.T=[];this.X=new urY;this.J=this.Y=null;this.Jb=(0,g.aU)(this.gGY,this);this.S=(0,g.aU)(this.xf,this);this.N=(0,g.aU)(this.uto,this);this.Bs=(0,g.aU)(this.OFr,this);var Z=0;f?(Z=f.getProxyState(),Z!=3&&(f.subscribe("proxyStateChange",this.T0,this),T00(this))):Z=3;Z!=0&&(D?this.T0(Z):g.AW(function(){F.T0(Z)},0)); (f=VMX())&&rC(this,f);this.subscribe("yt-remote-cast2-session-change",this.Bs)},lo=function(f){return new aW(f.G.getPlayerContextData())},T00=function(f){g.hC("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "),function(D){this.T.push(this.G.subscribe(D,g.wE(this.SwF,D),this))},f)},bCC=function(f){g.hC(f.T,function(D){this.G.unsubscribeByKey(D)},f); f.T.length=0},E7=function(f){return f.getState()==1},Jd=function(f,D){var F=f.X; F.Y.length+F.J.length<50&&f.X.enqueue(D)},MME=function(f,D,F){var Z=lo(f); wC(Z,F);Z.playerState!=-1E3&&(Z.playerState=D);uo(f,Z)},Nt=function(f,D,F){f.G.sendMessage(D,F)},uo=function(f,D){bCC(f); f.G.setPlayerContextData(mPn(D));T00(f)},rC=function(f,D){f.J&&(f.J.removeUpdateListener(f.Jb),f.J.removeMediaListener(f.S),f.xf(null)); f.J=D;f.J&&(IW("Setting cast session: "+f.J.sessionId),f.J.addUpdateListener(f.Jb),f.J.addMediaListener(f.S),f.J.media.length&&f.xf(f.J.media[0]))},tML=function(f){var D=f.Y.media,F=f.Y.customData; if(D&&F){var Z=lo(f);D.contentId!=Z.videoId&&IW("Cast changing video to: "+D.contentId);Z.videoId=D.contentId;Z.playerState=F.playerState;wC(Z,f.Y.getEstimatedTime());uo(f,Z)}else IW("No cast media video. Ignoring state update.")},gC=function(f,D,F){return(0,g.aU)(function(Z){this.Z1("Failed to "+D+" with cast v2 channel. Error code: "+Z.code); Z.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Z1("Retrying "+D+" using MDx browser channel."),Nt(this,D,F))},f)},XU=function(f,D,F,Z){Z=Z===void 0?!1:Z; g.zu.call(this);var I=this;this.T=NaN;this.zx=!1;this.Jb=this.N=this.KQ=this.xo=NaN;this.Bs=[];this.X=this.S=this.G=this.Y=this.J=null;this.Ir=f;this.rY=Z;this.Bs.push(g.bq(window,"beforeunload",function(){I.dl(2)})); this.B=[];this.Y=new aW;this.jT=D.id;this.Tx=D.idType;this.J=kre(this.Ir,F,this.rd,this.Tx=="shortLived",this.jT);this.J.listen("channelOpened",function(){Sgn(I)}); this.J.listen("channelClosed",function(){eV("Channel closed");isNaN(I.T)?j8(!0):j8();I.dispose()}); this.J.listen("channelError",function(p){j8();isNaN(I.y6())?(p==1&&I.Tx=="shortLived"&&I.publish("browserChannelAuthError",p),eV("Channel error: "+p+" without reconnection"),I.dispose()):(I.zx=!0,eV("Channel error: "+p+" with reconnection in "+I.y6()+" ms"),xm(I,2))}); this.J.listen("channelMessage",function(p){cXU(I,p)}); this.J.gk(D.token);this.subscribe("remoteQueueChange",function(){var p=I.Y.videoId;g.r0()&&g.w0("yt-remote-session-video-id",p)})},UPe=function(f){return g.NC(f.B,function(D){return D.type=="LOUNGE_SCREEN"})},eV=function(f){Zl("conn",f)},xm=function(f,D){f.publish("proxyStateChange",D)},vj0=function(f){f.T=g.AW(function(){eV("Connecting timeout"); f.dl(1)},2E4)},a8n=function(f){g.Vu(f.T); f.T=NaN},Gf0=function(f){g.Vu(f.xo); f.xo=NaN},WWE=function(f){w6o(f); f.KQ=g.AW(function(){O7(f,"getNowPlaying")},2E4)},w6o=function(f){g.Vu(f.KQ); f.KQ=NaN},Sgn=function(f){eV("Channel opened"); f.zx&&(f.zx=!1,Gf0(f),f.xo=g.AW(function(){eV("Timing out waiting for a screen.");f.dl(1)},15E3))},rXU=function(f,D){var F=null; if(D){var Z=UPe(f);Z&&(F={clientName:Z.clientName,deviceMake:Z.brand,deviceModel:Z.model,osVersion:Z.osVersion})}g.dE("yt.mdx.remote.remoteClient_",F);D&&(a8n(f),Gf0(f));F=f.J.qs()&&isNaN(f.T);D==F?D&&(xm(f,1),O7(f,"getSubtitlesTrack")):D?(f.Ot()&&f.Y.reset(),xm(f,1),O7(f,"getNowPlaying"),B0Y(f)):f.dl(1)},LWn=function(f,D){var F=D.params.videoId; delete D.params.videoId;F==f.Y.videoId&&(g.tC(D.params)?f.Y.trackData=null:f.Y.trackData=D.params,f.publish("remotePlayerChange"))},l8o=function(f,D,F){var Z=D.params.videoId||D.params.video_id,I=parseInt(D.params.currentIndex,10); f.Y.listId=D.params.listId||f.Y.listId;B_(f.Y,Z,I);f.publish("remoteQueueChange",F)},JXA=function(f,D){D.params=D.params||{}; l8o(f,D,"NOW_PLAYING_MAY_CHANGE");Eje(f,D);f.publish("autoplayDismissed")},Eje=function(f,D){var F=parseInt(D.params.currentTime||D.params.current_time,10); wC(f.Y,isNaN(F)?0:F);F=parseInt(D.params.state,10);F=isNaN(F)?-1:F;F==-1&&f.Y.playerState==-1E3&&(F=-1E3);f.Y.playerState=F;F=Number(D.params.loadedTime);f.Y.loadedTime=isNaN(F)?0:F;f.Y.Oe(Number(D.params.duration));F=f.Y;var Z=Number(D.params.liveIngestionTime);F.Y=Z;F.G=isNaN(Z)?!1:!0;F=f.Y;Z=Number(D.params.seekableStartTime);D=Number(D.params.seekableEndTime);F.J=isNaN(Z)?0:Z;F.S=isNaN(D)?0:D;f.Y.playerState==1?WWE(f):w6o(f);f.publish("remotePlayerChange")},uqo=function(f,D){if(f.Y.playerState!= -1E3){var F=1085; switch(parseInt(D.params.adState,10)){case 1:F=1081;break;case 2:F=1084;break;case 0:F=1083}f.Y.playerState=F;D=parseInt(D.params.currentTime,10);wC(f.Y,isNaN(D)?0:D);f.publish("remotePlayerChange")}},N0A=function(f,D){var F=D.params.muted=="true"; f.Y.volume=parseInt(D.params.volume,10);f.Y.muted=F;f.publish("remotePlayerChange")},gjb=function(f,D){f.S=D.params.videoId; f.publish("nowAutoplaying",parseInt(D.params.timeout,10))},eLL=function(f,D){f.S=D.params.videoId||null; f.publish("autoplayUpNext",f.S)},xPn=function(f,D){f.X=D.params.autoplayMode; f.publish("autoplayModeChange",f.X);f.X=="DISABLED"&&f.publish("autoplayDismissed")},X6V=function(f,D){var F=D.params.hasNext=="true"; f.Y.hasPrevious=D.params.hasPrevious=="true";f.Y.hasNext=F;f.publish("previousNextChange")},cXU=function(f,D){D=D.message; D.params?eV("Received: action="+D.action+", params="+g.rG(D.params)):eV("Received: action="+D.action+" {}");switch(D.action){case "loungeStatus":D=FG(D.params.devices);f.B=g.M2(D,function(Z){return new z_(Z)}); D=!!g.NC(f.B,function(Z){return Z.type=="LOUNGE_SCREEN"}); rXU(f,D);D=f.Og("mlm");f.publish("multiStateLoopEnabled",D);break;case "loungeScreenDisconnected":g.fs(f.B,function(Z){return Z.type=="LOUNGE_SCREEN"}); rXU(f,!1);break;case "remoteConnected":var F=new z_(FG(D.params.device));g.NC(f.B,function(Z){return Z.equals(F)})||jqe(f.B,F); break;case "remoteDisconnected":F=new z_(FG(D.params.device));g.fs(f.B,function(Z){return Z.equals(F)}); break;case "gracefulDisconnect":break;case "playlistModified":l8o(f,D,"QUEUE_MODIFIED");break;case "nowPlaying":JXA(f,D);break;case "onStateChange":Eje(f,D);break;case "onAdStateChange":uqo(f,D);break;case "onVolumeChanged":N0A(f,D);break;case "onSubtitlesTrackChanged":LWn(f,D);break;case "nowAutoplaying":gjb(f,D);break;case "autoplayDismissed":f.publish("autoplayDismissed");break;case "autoplayUpNext":eLL(f,D);break;case "onAutoplayModeChanged":xPn(f,D);break;case "onHasPreviousNextChanged":X6V(f, D);break;case "requestAssistedSignIn":f.publish("assistedSignInRequested",D.params.authCode);break;case "onLoopModeChanged":f.publish("loopModeChange",D.params.loopMode);break;default:eV("Unrecognized action: "+D.action)}},B0Y=function(f){g.Vu(f.Jb); f.Jb=g.AW(function(){f.dl(1)},864E5)},O7=function(f,D,F){F?eV("Sending: action="+D+", params="+g.rG(F)):eV("Sending: action="+D); f.J.sendMessage(D,F)},OCV=function(f){qt.call(this,"ScreenServiceProxy"); this.T2=f;this.Y=[];this.Y.push(this.T2.$_s("screenChange",(0,g.aU)(this.Hi,this)));this.Y.push(this.T2.$_s("onlineScreenChange",(0,g.aU)(this.j$3,this)))},DSC=function(f,D){XbL(); if(!iV||!iV.get("yt-remote-disable-remote-module-for-dev")){D=g.nc("MDX_CONFIG")||D;LPe();uE0();nw||(nw=new fw(D?D.loungeApiHost:void 0),Ok0()&&(nw.Y="/api/loungedev"));Ym||(Ym=g.QY("yt.mdx.remote.deferredProxies_")||[],g.dE("yt.mdx.remote.deferredProxies_",Ym));njb();var F=P_();if(!F){var Z=new jV(nw,D?D.disableAutomaticScreenCache||!1:!1);g.dE("yt.mdx.remote.screenService_",Z);F=P_();var I={};D&&(I={appId:D.appId,disableDial:D.disableDial,theme:D.theme,loadCastApiSetupScript:D.loadCastApiSetupScript, disableCastApi:D.disableCastApi,enableDialLoungeToken:D.enableDialLoungeToken,enableCastLoungeToken:D.enableCastLoungeToken,forceMirroring:D.forceMirroring});g.dE("yt.mdx.remote.enableConnectWithInitialState_",D?D.enableConnectWithInitialState||!1:!1);iCE(f,Z,function(p){p?f9()&&v_(f9(),"YouTube TV"):Z.subscribe("onlineScreenChange",function(){he("yt-remote-receiver-availability-change")})},I)}D&&!g.QY("yt.mdx.remote.initialized_")&&(g.dE("yt.mdx.remote.initialized_",!0),Dn("Initializing: "+g.rG(D)), Fi.push(g.f_("yt-remote-cast2-api-ready",function(){he("yt-remote-api-ready")})),Fi.push(g.f_("yt-remote-cast2-availability-change",function(){he("yt-remote-receiver-availability-change")})),Fi.push(g.f_("yt-remote-cast2-receiver-selected",function(){Zn(null); he("yt-remote-auto-connect","cast-selector-receiver")})),Fi.push(g.f_("yt-remote-cast2-receiver-resumed",function(){he("yt-remote-receiver-resumed","cast-selector-receiver")})),Fi.push(g.f_("yt-remote-cast2-session-change",YgY)),Fi.push(g.f_("yt-remote-connection-change",function(p){p?v_(f9(),"YouTube TV"):I9()||(v_(null,null),$PE())})),Fi.push(g.f_("yt-remote-cast2-session-failed",function(){he("yt-remote-connection-failed")})),f=PqL(),D.isAuto&&(f.id+="#dial"),I=D.capabilities||[],I.length>0&&(f.capabilities= I),f.name=D.device,f.app=D.app,(D=D.theme)&&(f.theme=D),Dn(" -- with channel params: "+g.rG(f)),f?(g.w0("yt-remote-session-app",f.app),g.w0("yt-remote-session-name",f.name)):(g.B6("yt-remote-session-app"),g.B6("yt-remote-session-name")),g.dE("yt.mdx.remote.channelParams_",f),F.start(),f9()||fav())}},F5v=function(){var f=P_().T2.$_gos(); var D=p9();D&&zo()&&(rfX(f,D)||f.push(D));return BSb(f)},Ian=function(){var f=Z00(); !f&&c_()&&AXX()&&(f={key:"cast-selector-receiver",name:AXX()});return f},Z00=function(){var f=F5v(),D=p9(); D||(D=I9());return g.NC(f,function(F){return D&&qd(D,F.key)?!0:!1})},p9=function(){var f=f9(); if(!f)return null;var D=P_().hW();return oO(D,f)},YgY=function(f){Dn("remote.onCastSessionChange_: "+HW(f)); if(f){var D=p9();if(D&&D.id==f.id){if(v_(D.id,"YouTube TV"),f.idType=="shortLived"&&(f=f.token))si&&(si.token=f),(D=zo())&&D.gk(f)}else D&&qn(),HJ(f,1)}else zo()&&qn()},qn=function(){U7()?SV().stopSession():td("stopSession called before API ready."); var f=zo();f&&(f.disconnect(1),pGb(null))},zC0=function(){var f=zo(); return!!f&&f.getProxyState()!=3},Dn=function(f){Zl("remote",f)},P_=function(){if(!stX){var f=g.QY("yt.mdx.remote.screenService_"); stX=f?new OCV(f):null}return stX},f9=function(){return g.QY("yt.mdx.remote.currentScreenId_")},qXA=function(f){g.dE("yt.mdx.remote.currentScreenId_",f)},H0v=function(){return g.QY("yt.mdx.remote.connectData_")},Zn=function(f){g.dE("yt.mdx.remote.connectData_",f)},zo=function(){return g.QY("yt.mdx.remote.connection_")},pGb=function(f){var D=zo(); Zn(null);f||qXA("");g.dE("yt.mdx.remote.connection_",f);Ym&&(g.hC(Ym,function(F){F(f)}),Ym.length=0); D&&!f?he("yt-remote-connection-change",!1):!D&&f&&he("yt-remote-connection-change",!0)},I9=function(){var f=g.r0(); if(!f)return null;var D=P_();if(!D)return null;D=D.hW();return oO(D,f)},HJ=function(f,D){f9(); p9()&&p9();if(o9)si=f;else{qXA(f.id);var F=g.QY("yt.mdx.remote.enableConnectWithInitialState_")||!1;f=new XU(nw,f,PqL(),F);f.connect(D,H0v());f.subscribe("beforeDisconnect",function(Z){he("yt-remote-before-disconnect",Z)}); f.subscribe("beforeDispose",function(){zo()&&(zo(),pGb(null))}); f.subscribe("browserChannelAuthError",function(){var Z=p9();Z&&Z.idType=="shortLived"&&(U7()?SV().handleBrowserChannelAuthError():td("refreshLoungeToken called before API ready."))}); pGb(f)}},fav=function(){var f=I9(); f?(Dn("Resume connection to: "+HW(f)),HJ(f,0)):(j8(),$PE(),Dn("Skipping connecting because no session screen found."))},njb=function(){var f=PqL(); if(g.tC(f)){f=k8();var D=g.W6("yt-remote-session-name")||"",F=g.W6("yt-remote-session-app")||"";f={device:"REMOTE_CONTROL",id:f,name:D,app:F,mdxVersion:3};f.authuser=String(g.nc("SESSION_INDEX","0"));(D=g.nc("DELEGATED_SESSION_ID"))&&(f.pageId=String(D));g.dE("yt.mdx.remote.channelParams_",f)}},PqL=function(){return g.QY("yt.mdx.remote.channelParams_")||{}},keX=function(f,D,F){g.J.call(this); var Z=this;this.Y=f;this.U=D;this.JZ=F;this.events=new g.ia(this);this.X=!1;this.T=new g.du(64);this.J=new g.xX(this.I1,500,this);this.B=new g.xX(this.MX,1E3,this);this.N=new Ae(this.bwr,0,this);this.G={};this.Jb=new g.xX(this.MB,1E3,this);this.S=new g.YX(this.seekTo,1E3,this);this.Bs=this.events.D(this.U,"onVolumeChange",function(I){obX(Z,I)}); g.N(this,this.events);this.events.D(D,"onCaptionsTrackListChanged",this.U7I);this.events.D(D,"captionschanged",this.Nor);this.events.D(D,"captionssettingschanged",this.Py);this.events.D(D,"videoplayerreset",this.oQ);this.events.D(D,"mdxautoplaycancel",function(){Z.JZ.Qd()}); D.Z("enable_mdx_video_play_directly")&&this.events.D(D,"videodatachange",function(){K50(Z.Y)||K9(Z)||kx(Z,0)}); f=this.JZ;f.MR();f.subscribe("proxyStateChange",this.Fk,this);f.subscribe("remotePlayerChange",this.mu,this);f.subscribe("remoteQueueChange",this.oQ,this);f.subscribe("previousNextChange",this.rA,this);f.subscribe("nowAutoplaying",this.zj,this);f.subscribe("autoplayDismissed",this.JC,this);g.N(this,this.J);g.N(this,this.B);g.N(this,this.N);g.N(this,this.Jb);g.N(this,this.S);this.Py();this.oQ();this.mu()},obX=function(f,D){if(K9(f)){f.JZ.unsubscribe("remotePlayerChange",f.mu,f); var F=Math.round(D.volume);D=!!D.muted;var Z=lo(f.JZ);if(F!==Z.volume||D!==Z.muted)f.JZ.setVolume(F,D),f.Jb.start();f.JZ.subscribe("remotePlayerChange",f.mu,f)}},jtC=function(f){f.Ft(0); f.J.stop();f.cI(new g.du(64))},i0c=function(f,D){if(K9(f)&&!f.X){var F=null; D&&(F={style:f.U.getSubtitlesUserSettings()},Object.assign(F,D));f.JZ.Dv(f.U.getVideoData(1).videoId,F);f.G=lo(f.JZ).trackData}},kx=function(f,D){var F=f.U.getPlaylist(); if(F==null?0:F.listId){var Z=F.index;var I=F.listId.toString()}F=f.U.getVideoData(1);f.JZ.playVideo(F.videoId,D,Z,I,F.playerParams,F.Bs,kEv(F));f.cI(new g.du(1))},hCX=function(f,D){if(D){var F=f.U.getOption("captions","tracklist",{r6:1}); F&&F.length?(f.U.setOption("captions","track",D),f.X=!1):(f.U.loadModule("captions"),f.X=!0)}else f.U.setOption("captions","track",{})},K9=function(f){return lo(f.JZ).videoId===f.U.getVideoData(1).videoId},y2c=function(f,D){g.Bd.call(this,f); this.Y=D},jN=function(){g.x.call(this,{K:"div", C:"ytp-mdx-popup-dialog",W:{role:"dialog"},L:[{K:"div",C:"ytp-mdx-popup-dialog-inner-content",L:[{K:"div",C:"ytp-mdx-popup-title",nQ:"\u4f60\u5df2\u9000\u51fa\u8d26\u53f7"},{K:"div",C:"ytp-mdx-popup-description",nQ:"\u4f60\u89c2\u770b\u7684\u89c6\u9891\u53ef\u80fd\u4f1a\u6dfb\u52a0\u5230\u7535\u89c6\u7684\u89c2\u770b\u8bb0\u5f55\u4e2d\uff0c\u5e76\u5f71\u54cd\u7535\u89c6\u4e0a\u7684\u63a8\u8350\u5185\u5bb9\u3002\u4e3a\u907f\u514d\u53d1\u751f\u8fd9\u79cd\u60c5\u51b5\uff0c\u8bf7\u53d6\u6d88\u5e76\u5728\u8ba1\u7b97\u673a\u4e0a\u767b\u5f55 YouTube\u3002"}, {K:"div",C:"ytp-mdx-privacy-popup-buttons",L:[{K:"button",ST:["ytp-button","ytp-mdx-privacy-popup-cancel"],nQ:"\u53d6\u6d88"},{K:"button",ST:["ytp-button","ytp-mdx-privacy-popup-confirm"],nQ:"\u786e\u8ba4"}]}]}]});this.fade=new g.Zr(this,250);this.cancelButton=this.fQ("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.fQ("ytp-mdx-privacy-popup-confirm");g.N(this,this.fade);this.D(this.cancelButton,"click",this.Y);this.D(this.confirmButton,"click",this.J)},i1=function(f){g.x.call(this,{K:"div", C:"ytp-remote",L:[{K:"div",C:"ytp-remote-display-status",L:[{K:"div",C:"ytp-remote-display-status-icon",L:[g.Nod()]},{K:"div",C:"ytp-remote-display-status-text",nQ:"{{statustext}}"}]}]});this.api=f;this.fade=new g.Zr(this,250);g.N(this,this.fade);this.D(f,"presentingplayerstatechange",this.onStateChange);this.uJ(f.getPlayerStateObject())},hH=function(f,D){g.C7.call(this,"\u64ad\u653e\u8bbe\u5907",1,f,D); this.U=f;this.qy={};this.D(f,"onMdxReceiversChange",this.J);this.D(f,"presentingplayerstatechange",this.J);this.J()},A2E=function(f){g.KS.call(this,f); this.II={key:WPU(),name:"\u6b64\u8ba1\u7b97\u673a"};this.sQ=null;this.subscriptions=[];this.xV=this.JZ=null;this.qy=[this.II];this.jB=this.II;this.R$=new g.du(64);this.aV=0;this.UG=-1;this.g4=!1;this.ZB=this.uj=this.rZ=null;if(!g.ei(this.player.j())&&!g.rQ(this.player.j())){f=this.player;var D=g.CN(f);D&&(D=D.Pp())&&(D=new hH(f,D),g.N(this,D));D=new i1(f);g.N(this,D);g.uC(f,D.element,4);this.rZ=new jN;g.N(this,this.rZ);g.uC(f,this.rZ.element,4);this.g4=!!I9()}},yE=function(f){f.uj&&(f.player.removeEventListener("presentingplayerstatechange", f.uj),f.uj=null)},$SU=function(f,D,F){f.R$=F; f.player.publish("presentingplayerstatechange",new g.k4(F,D))},AH=function(f,D){if(D.key!==f.jB.key)if(D.key===f.II.key)qn(); else if(K50(f)&&VFA(f),f.jB=D,!g.rQ(f.player.j())){var F=f.player.getPlaylistId();var Z=f.player.getVideoData(1);var I=Z.videoId;if(!F&&!I||(f.player.getAppState()===2||f.player.getAppState()===1)&&f.player.j().Z("should_clear_video_data_on_player_cued_unstarted"))Z=null;else{var p=f.player.getPlaylist();if(p){var z=[];for(var H=0;H2*this.size&&pZ(this),!0):!1}; g.d.get=function(f,D){return ZX(this.J,f)?this.J[f]:D}; g.d.set=function(f,D){ZX(this.J,f)||(this.size+=1,this.Y.push(f),this.dJ++);this.J[f]=D}; g.d.forEach=function(f,D){for(var F=this.cC(),Z=0;Z=Z.Y.length)return g.qY;var p=Z.Y[D++];return g.cM(f?p:Z.J[p])}; return I}; var cfU={ZcY:"atp",T3F:"ska",Oys:"que",kwy:"mus",maT:"sus",BeI:"dsp",ssr:"seq",zHb:"mic",m5T:"dpa",WVY:"mlm",U5s:"dsdtr",OHy:"ntb",BsQ:"vsp",k1b:"scn",Lty:"rpe",ERI:"dcn",x5Y:"dcp",sqT:"pas",XRI:"drq",RHb:"opf",j63:"els",WlQ:"isg",GXT:"svq",jqs:"mvp",Csr:"ads",ryr:"stcp",cys:"sads",fi3:"dloc",Tyy:"dcw",lYF:"asw",znQ:"apw",SWF:"wrc",m0d:"pcw",iRs:"ipv",Vwd:"ndt",A73:"ctops"},ULn={YSx:"u",Ocx:"cl",aqo:"k",lqQ:"i",tL3:"cr",FVT:"m",RMx:"g",ZZ:"up"},YtE={wu:"adPlaying",tQ:"onAdStateChange"},Pfn={LVF:"nowPlaying", wLT:"onStateChange",wu:"adPlaying",tQ:"onAdStateChange",vB:"nowPlayingShorts",YD:"onShortsStateChange"},fKC={vB:"nowPlayingShorts",YD:"onShortsStateChange"};z_.prototype.equals=function(f){return f?this.id==f.id:!1}; var Jfc="",iV=null,Iy0=YGn("loadCastFramework")||YGn("loadCastApplicationFramework"),sCL=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.rE(Ae,g.J);g.d=Ae.prototype;g.d.SV=function(f){this.G=arguments;this.Y=!1;this.AZ?this.B=g.We()+this.cV:this.AZ=g.G2(this.X,this.cV)}; g.d.stop=function(){this.AZ&&(g.RU.clearTimeout(this.AZ),this.AZ=null);this.B=null;this.Y=!1;this.G=[]}; g.d.pause=function(){++this.J}; g.d.resume=function(){this.J&&(--this.J,!this.J&&this.Y&&(this.Y=!1,this.T.apply(null,this.G)))}; g.d.Ey=function(){this.stop();Ae.YK.Ey.call(this)}; g.d.I8=function(){this.AZ&&(g.RU.clearTimeout(this.AZ),this.AZ=null);this.B?(this.AZ=g.G2(this.X,this.B-g.We()),this.B=null):this.J?this.Y=!0:(this.Y=!1,this.T.apply(null,this.G))};var V7=null;$8.prototype.set=function(f){this.Y=f}; $8.prototype.reset=function(){this.set(g.We())}; $8.prototype.get=function(){return this.Y};g.rE(oao,HYX);RO.prototype.stringify=function(f){return g.RU.JSON.stringify(f,void 0)}; RO.prototype.parse=function(f){return g.RU.JSON.parse(f,void 0)};g.rE(KQn,g.PP);g.rE(kPE,g.PP);var jCL=null;g.rE(hs0,g.PP);g.rE(y$Y,g.PP);g.rE(A$C,g.PP);mB.prototype.debug=function(){}; mB.prototype.info=function(){}; mB.prototype.warning=function(){};var Tpc={},mIc={};g.d=T_.prototype;g.d.setTimeout=function(f){this.eT=f}; g.d.D0=function(f){f=f.target;var D=this.Ps;D&&g.N4(f)==3?D.Lu():this.t5(f)}; g.d.t5=function(f){try{if(f==this.Y)a:{var D=g.N4(this.Y),F=this.Y.J,Z=this.Y.getStatus();if(!(D<3)&&(D!=3||this.Y&&(this.J.J||g.ey(this.Y)||g.xQ(this.Y)))){this.rY||D!=4||F==7||(F==8||Z<=0?d6(3):d6(2));tkb(this);var I=this.Y.getStatus();this.Uq=I;var p=CSY(this);if(this.T=I==200){if(this.Z5&&!this.dY){b:{if(this.Y){var z=g.X6(this.Y,"X-HTTP-Initial-Response");if(z&&!g.XI(z)){var H=z;break b}}H=null}if(f=H)this.dY=!0,Bpo(this,f);else{this.T=!1;this.X=3;Q7(12);Md(this);te(this);break a}}if(this.Tx){f= !0;for(var K;!this.rY&&this.S0&&!this.Wk&&(this.Wk=!0,this.B.Zj(this)):(Md(this),te(this))}else Bpo(this,p);D==4&&Md(this);this.T&&!this.rY&&(D==4?SE0(this.B,this):(this.T=!1,bV(this)))}else g.ued(this.Y),I==400&&p.indexOf("Unknown SID")> 0?(this.X=3,Q7(12)):(this.X=0,Q7(13)),Md(this),te(this)}}}catch(k){}finally{}}; g.d.cancel=function(){this.rY=!0;Md(this)}; g.d.MC=function(){this.Bs=null;var f=Date.now();f-this.JN>=0?(this.jT!=2&&(d6(3),Q7(17)),Md(this),this.X=2,te(this)):MkV(this,this.JN-f)}; g.d.getLastError=function(){return this.X}; g.d.Er=function(){return this.Y};LQn.prototype.cancel=function(){this.B=Eao(this);if(this.J)this.J.cancel(),this.J=null;else if(this.Y&&this.Y.size!==0){for(var f=g.a(this.Y.values()),D=f.next();!D.done;D=f.next())D.value.cancel();this.Y.clear()}};g.d=gan.prototype;g.d.Ya=8;g.d.aA=1;g.d.connect=function(f,D,F,Z){Q7(0);this.m9=f;this.rY=D||{};F&&Z!==void 0&&(this.rY.OSID=F,this.rY.OAID=Z);this.Ps=this.qb;this.Ir=GPV(this,null,this.m9);vW(this)}; g.d.disconnect=function(){xIe(this);if(this.aA==3){var f=this.LQ++,D=this.Ir.clone();g.Kk(D,"SID",this.G);g.Kk(D,"RID",f);g.Kk(D,"TYPE","terminate");w6(this,D);f=new T_(this,this.G,f);f.jT=2;f.N=fZ(D.clone());D=!1;if(g.RU.navigator&&g.RU.navigator.sendBeacon)try{D=g.RU.navigator.sendBeacon(f.N.toString(),"")}catch(F){}!D&&g.RU.Image&&((new Image).src=f.N,D=!0);D||(f.Y=dIX(f.B,null),f.Y.send(f.N));f.xo=Date.now();bV(f)}fVV(this)}; g.d.wS=function(){return this.aA==0}; g.d.getState=function(){return this.aA}; g.d.BP=function(f){if(this.T)if(this.T=null,this.aA==1){if(!f){this.LQ=Math.floor(Math.random()*1E5);f=this.LQ++;var D=new T_(this,"",f),F=this.Jb;this.Z5&&(F?(F=g.UQ(F),g.ai(F,this.Z5)):F=this.Z5);this.S!==null||this.JN||(D.Ir=F,F=null);var Z;if(this.G3)a:{for(var I=Z=0;I4096){Z=I;break a}if(Z===4096||I===this.B.length-1){Z=I+1;break a}}Z= this.OI}else Z=this.OI;Z=naY(this,D,Z);I=this.Ir.clone();g.Kk(I,"RID",f);g.Kk(I,"CVER",22);this.Tx&&g.Kk(I,"X-HTTP-Session-Id",this.Tx);w6(this,I);F&&(this.JN?Z="headers="+g.lI(g.jXd(F))+"&"+Z:this.S&&g.iP(I,this.S,F));aye(this.J,D);this.KK&&g.Kk(I,"TYPE","init");this.G3?(g.Kk(I,"$req",Z),g.Kk(I,"SID","null"),D.Z5=!0,RsX(D,I,null)):RsX(D,I,Z);this.aA=2}}else this.aA==3&&(f?YEY(this,f):this.B.length==0||lyn(this.J)||YEY(this))}; g.d.Jf=function(){this.N=null;PSn(this);if(this.BI&&!(this.eT||this.Y==null||this.Xt<=0)){var f=4*this.Xt;this.zx=CZ((0,g.aU)(this.F9T,this),f)}}; g.d.F9T=function(){this.zx&&(this.zx=null,this.Ps=!1,this.eT=!0,Q7(10),cW(this),PSn(this))}; g.d.Zj=function(f){this.Y==f&&this.BI&&!this.eT&&(esY(this),this.eT=!0,Q7(11))}; g.d.rV=function(){this.Bs!=null&&(this.Bs=null,cW(this),UIe(this),Q7(19))}; g.d.MdT=function(f){f?Q7(2):Q7(1)}; g.d.isActive=function(){return!!this.X&&this.X.isActive(this)}; g.d=Fxb.prototype;g.d.cP=function(){}; g.d.nN=function(){}; g.d.KN=function(){}; g.d.G9=function(){}; g.d.isActive=function(){return!0}; g.d.Wi=function(){};g.rE(BW,g.i7);BW.prototype.open=function(){this.Y.X=this.B;this.T&&(this.Y.dY=!0);this.Y.connect(this.X,this.J||void 0)}; BW.prototype.close=function(){this.Y.disconnect()}; BW.prototype.send=function(f){var D=this.Y;if(typeof f==="string"){var F={};F.__data__=f;f=F}else this.G&&(F={},F.__data__=g.rG(f),f=F);D.B.push(new r$X(D.B_++,f));D.aA==3&&vW(D)}; BW.prototype.Ey=function(){this.Y.X=null;delete this.B;this.Y.disconnect();delete this.Y;BW.YK.Ey.call(this)}; g.rE(IV0,KQn);g.rE(pYe,kPE);g.rE(WW,Fxb);WW.prototype.cP=function(){this.Y.dispatchEvent("m")}; WW.prototype.nN=function(f){this.Y.dispatchEvent(new IV0(f))}; WW.prototype.KN=function(f){this.Y.dispatchEvent(new pYe(f))}; WW.prototype.G9=function(){this.Y.dispatchEvent("n")}; z_o.prototype.commit=function(f){this.Y.Uq=f};var LZ=new g.i7;g.C(qtc,g.PP);g.d=E3.prototype;g.d.ip=null;g.d.sH=!1;g.d.bS=null;g.d.Ts=null;g.d.yw=null;g.d.dG=null;g.d.LU=null;g.d.NF=null;g.d.HW=null;g.d.dQ=null;g.d.gG=0;g.d.t_=null;g.d.uL=null;g.d.wJ=null;g.d.Vw=-1;g.d.Ao=!0;g.d.pU=!1;g.d.ZM=0;g.d.F$=null;var icE={},jJe={};g.d=E3.prototype;g.d.setTimeout=function(f){this.J=f}; g.d.Fx=function(f){f=f.target;var D=this.F$;D&&g.N4(f)==3?D.Lu():this.E8(f)}; g.d.E8=function(f){try{if(f==this.dQ)a:{var D=g.N4(this.dQ),F=this.dQ.J,Z=this.dQ.getStatus();if(g.dL&&!g.YZ("420+")){if(D<4)break a}else if(D<3||D==3&&!g.ey(this.dQ))break a;this.pU||D!=4||F==7||(F==8||Z<=0?this.Y.XD(3):this.Y.XD(2));ADU(this);var I=this.dQ.getStatus();this.Vw=I;var p=g.ey(this.dQ);if(this.sH=I==200){D==4&&Je(this);if(this.Tx){for(f=!0;!this.pU&&this.gG0?(this.wJ=3,lV(13)):(this.wJ=0,lV(14)),Je(this),$Tc(this)}}catch(H){}finally{}}; g.d.cancel=function(){this.pU=!0;Je(this)}; g.d.jV=function(){this.bS=null;var f=Date.now();f-this.Ts>=0?(this.dG!=2&&this.Y.XD(3),Je(this),this.wJ=2,lV(18),$Tc(this)):yDo(this,this.Ts-f)}; g.d.getLastError=function(){return this.wJ};g.d=QJ0.prototype;g.d.zs=null;g.d.K1=null;g.d.S5=!1;g.d.Sh=null;g.d.e8=null;g.d.fG=-1;g.d.QR=null;g.d.N4=null;g.d.connect=function(f){this.Sh=f;f=e8(this.Y,null,this.Sh);lV(3);Date.now();var D=this.Y.Jb;D!=null?(this.QR=D[0],(this.N4=D[1])?(this.e8=1,Cfb(this)):(this.e8=2,mTU(this))):(DX(f,"MODE","init"),this.K1=new E3(this),this.K1.ip=this.zs,Kx0(this.K1,f,!1,null,!0),this.e8=0)}; g.d.B4=function(f){if(f)this.e8=2,mTU(this);else{lV(4);var D=this.Y;D.N0=D.rF.fG;nZ(D,9)}f&&this.XD(2)}; g.d.C8=function(f){return this.Y.C8(f)}; g.d.abort=function(){this.K1&&(this.K1.cancel(),this.K1=null);this.fG=-1}; g.d.wS=function(){return!1}; g.d.xa=function(f,D){this.fG=f.Vw;if(this.e8==0)if(D){try{var F=this.J.parse(D)}catch(Z){f=this.Y;f.N0=this.fG;nZ(f,2);return}this.QR=F[0];this.N4=F[1]}else f=this.Y,f.N0=this.fG,nZ(f,2);else this.e8==2&&(this.S5?(lV(7),Date.now()):D=="11111"?(lV(6),this.S5=!0,Date.now(),this.fG=200,this.K1.cancel(),lV(12),x8(this.Y,this,!0)):(lV(8),Date.now(),this.S5=!1))}; g.d.lU=function(){this.fG=this.K1.Vw;if(this.K1.sH)this.e8==0?this.N4?(this.e8=1,Cfb(this)):(this.e8=2,mTU(this)):this.e8==2&&(this.S5?(lV(12),x8(this.Y,this,!0)):(lV(11),x8(this.Y,this,!1)));else{this.e8==0?lV(9):this.e8==2&&lV(10);var f=this.Y;this.K1.getLastError();f.N0=this.fG;nZ(f,2)}}; g.d.RH=function(){return this.Y.RH()}; g.d.isActive=function(){return this.Y.isActive()}; g.d.XD=function(f){this.Y.XD(f)};g.d=TBX.prototype;g.d.a6=null;g.d.wg=null;g.d.Wn=null;g.d.Bl=null;g.d.DM=null;g.d.PZ=null;g.d.fN=null;g.d.It=null;g.d.H1=0;g.d.dV=0;g.d.vl=null;g.d.tO=null;g.d.Xl=null;g.d.aE=null;g.d.rF=null;g.d.Pv=null;g.d.tH=-1;g.d.Xg=-1;g.d.N0=-1;g.d.s$=0;g.d.qk=0;g.d.A3=8;var RC0={OK:0,iyR:2,XLI:4,pLT:5,t2F:6,STOP:7,AQ:8,S3E:9,CcF:10,lfo:11,IYb:12};g.rE(M_0,g.PP);g.rE(t_L,g.PP);g.d=TBX.prototype; g.d.connect=function(f,D,F,Z,I){lV(0);this.DM=D;this.wg=F||{};Z&&I!==void 0&&(this.wg.OSID=Z,this.wg.OAID=I);this.N?(r6((0,g.aU)(this.UJ,this,f),100),cD0(this)):this.UJ(f)}; g.d.disconnect=function(){UT0(this);if(this.Y==3){var f=this.H1++,D=this.PZ.clone();g.Kk(D,"SID",this.G);g.Kk(D,"RID",f);g.Kk(D,"TYPE","terminate");O3(this,D);f=new E3(this,this.G,f);f.dG=2;f.LU=fZ(D.clone());(new Image).src=f.LU.toString();f.yw=Date.now();kGL(f)}EWe(this)}; g.d.UJ=function(f){this.rF=new QJ0(this);this.rF.zs=this.a6;this.rF.J=this.X;this.rF.connect(f)}; g.d.wS=function(){return this.Y==0}; g.d.getState=function(){return this.Y}; g.d.hf=function(f){this.tO=null;WxL(this,f)}; g.d.U8=function(){this.Xl=null;this.Bl=new E3(this,this.G,"rpc",this.S);this.Bl.ip=this.a6;this.Bl.ZM=0;var f=this.fN.clone();g.Kk(f,"RID","rpc");g.Kk(f,"SID",this.G);g.Kk(f,"CI",this.Pv?"0":"1");g.Kk(f,"AID",this.tH);O3(this,f);g.Kk(f,"TYPE","xmlhttp");Kx0(this.Bl,f,!0,this.It,!1)}; g.d.xa=function(f,D){if(this.Y!=0&&(this.Bl==f||this.Wn==f))if(this.N0=f.Vw,this.Wn==f&&this.Y==3)if(this.A3>7){try{var F=this.X.parse(D)}catch(Z){F=null}if(Array.isArray(F)&&F.length==3)if(f=F,f[0]==0)a:{if(!this.Xl){if(this.Bl)if(this.Bl.yw+3E30)){if(Z=D==1)this.Wn||this.tO||this.Y==1||this.s$>=2?Z=!1:(this.tO=r6((0,g.aU)(this.hf,this,f),rDe(this,this.s$)),this.s$++, Z=!0);Z=!(Z||D==2&&LxC(this))}if(Z)switch(F){case 1:nZ(this,5);break;case 4:nZ(this,10);break;case 3:nZ(this,6);break;case 7:nZ(this,12);break;default:nZ(this,2)}}}; g.d.NC=function(f){if(!g.e0(arguments,this.Y))throw Error("Unexpected channel state: "+this.Y);}; g.d.IBR=function(f){f?lV(2):(lV(1),lV0(this,8))}; g.d.C8=function(f){if(f)throw Error("Can't create secondary domain capable XhrIo object.");f=new g.ED;f.S=!1;return f}; g.d.isActive=function(){return!!this.vl&&this.vl.isActive(this)}; g.d.XD=function(f){var D=LZ;D.dispatchEvent(new t_L(D,f))}; g.d.RH=function(){return!1}; new oao;g.d=JD0.prototype;g.d.T9=function(){}; g.d.Zv=function(){}; g.d.CN=function(){}; g.d.m0=function(){}; g.d.rO=function(){}; g.d.z9=function(){return{}}; g.d.isActive=function(){return!0};g.d=urY.prototype;g.d.enqueue=function(f){this.J.push(f)}; g.d.isEmpty=function(){return this.Y.length===0&&this.J.length===0}; g.d.clear=function(){this.Y=[];this.J=[]}; g.d.contains=function(f){return g.e0(this.Y,f)||g.e0(this.J,f)}; g.d.remove=function(f){var D=this.Y;var F=(0,g.TCT)(D,f);F>=0?(g.xn(D,F),D=!0):D=!1;return D||g.no(this.J,f)}; g.d.TR=function(){for(var f=[],D=this.Y.length-1;D>=0;--D)f.push(this.Y[D]);D=this.J.length;for(var F=0;F0&&(this.T.pYs(this.J.JK(),this.B,!0),this.T.V4R());this.T&&this.T.cOy();this.B?(this.J.stop(),g.jg(this.J),this.J=new Y8(this.OX,this),this.B=!1):this.J.reset();this.KQ=null;this.Bs=0;if(this.G.length)if(this.S)IKn(this);else{var f=this.G;this.G=[];var D=f.length;Occ(this);ZOb(this,f,D);PW(this)}else PW(this)}; g.d.m0=function(f){var D=f==2&&this.Y.N0==401;f==4||D||(this.B&&!this.J.isActive()&&(g.jg(this.J),this.J=new Y8(this.OX,this),this.B=!1),this.J.start());this.publish("handlerError",f,D);D=Object.keys(RC0).find(function(F){return RC0[F]===f}); this.b3.Dx("BROWSER_CHANNEL",D!=null?D:"UNKNOWN")}; g.d.rO=function(f,D){if(!this.J.isActive())this.publish("handlerClosed");else if(D)for(var F=D.length,Z=0;Z=dSo.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(f=dSo[this.J],this.AZ=g.AW((0,g.aU)(this.cz,this),f),this.J++):this.publish("pairingFailed",Error("Server error "+f.status))}; g.d.o8=function(){this.Y=null;this.publish("pairingFailed",Error("Server not responding"))}; var dSo=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.rE(oW,qt);g.d=oW.prototype;g.d.start=function(){H_(this)&&this.publish("screenChange");!g.W6("yt-remote-lounge-token-expiration")&&m10(this);g.Vu(this.Y);this.Y=g.AW((0,g.aU)(this.start,this),1E4)}; g.d.add=function(f,D){H_(this);R6X(this,f);Kw(this,!1);this.publish("screenChange");D(f);f.token||m10(this)}; g.d.remove=function(f,D){var F=H_(this);QgC(this,f)&&(Kw(this,!1),F=!0);D(f);F&&this.publish("screenChange")}; g.d.gI=function(f,D,F,Z){var I=H_(this),p=this.get(f.id);p?(p.name!=D&&(p.name=D,Kw(this,!1),I=!0),F(f)):Z(Error("no such local screen."));I&&this.publish("screenChange")}; g.d.Ey=function(){g.Vu(this.Y);oW.YK.Ey.call(this)}; g.d.jro=function(f){H_(this);var D=this.screens.length;f=f&&f.screens||[];for(var F=f.length,Z=0;Z20)break a;H=D(p,z)}p=H}I.name=p}F(io(this,I))},this), onError:(0,g.aU)(function(I){Z(Error("pairing request failed: "+I.status))},this), onTimeout:(0,g.aU)(function(){Z(Error("pairing request timed out."))},this)})}; g.d.Ey=function(){g.jg(this.J);g.jg(this.Y);jV.YK.Ey.call(this)}; g.d.P3E=function(){WIV(this);this.publish("screenChange");this.Y.update()}; jV.prototype.dispose=jV.prototype.dispose;g.rE(hd,g.zu);g.d=hd.prototype;g.d.qM=function(f){this.MR()||(f&&(Ad(this,""+f),this.publish("sessionFailed")),this.Y=null,this.publish("sessionScreen",null))}; g.d.info=function(f){Zl(this.Tx,f)}; g.d.Iz=function(){return null}; g.d.Xw=function(f){var D=this.J;f?(D.displayStatus=new chrome.cast.ReceiverDisplayStatus(f,[]),D.displayStatus.showStop=!0):D.displayStatus=null;chrome.cast.setReceiverDisplayStatus(D,(0,g.aU)(function(){this.info("Updated receiver status for "+D.friendlyName+": "+f)},this),(0,g.aU)(function(){Ad(this,"Failed to update receiver status for: "+D.friendlyName)},this))}; g.d.Ey=function(){this.Xw("");hd.YK.Ey.call(this)};g.C($m,hd);g.d=$m.prototype;g.d.xM=function(f){if(this.B){if(this.B==f)return;Ad(this,"Overriding cast session with new session object");XRA(this);this.xo=!1;this.Jb="unknown";this.B.removeUpdateListener(this.KQ);this.B.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.zx)}this.B=f;this.B.addUpdateListener(this.KQ);this.B.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.zx);umo(this,"getMdxSessionStatus")}; g.d.LI=function(f){this.info("launchWithParams no-op for Cast: "+g.rG(f))}; g.d.stop=function(){this.B?this.B.stop((0,g.aU)(function(){this.qM()},this),(0,g.aU)(function(){this.qM(Error("Failed to stop receiver app."))},this)):this.qM(Error("Stopping cast device without session."))}; g.d.Xw=function(){}; g.d.Ey=function(){this.info("disposeInternal");XRA(this);this.B&&(this.B.removeUpdateListener(this.KQ),this.B.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.zx));this.B=null;hd.prototype.Ey.call(this)}; g.d.rSF=function(f,D){if(!this.MR())if(D)if(D=FG(D),g.tv(D))switch(f=""+D.type,D=D.data||{},this.info("onYoutubeMessage_: "+f+" "+g.rG(D)),f){case "mdxSessionStatus":lKE(this,D);break;case "loungeToken":NoU(this,D);break;default:Ad(this,"Unknown youtube message: "+f)}else Ad(this,"Unable to parse message.");else Ad(this,"No data in message.")}; g.d.Ri=function(f,D,F,Z){g.Vu(this.N);this.N=0;aK0(this.G,this.J.label,f,this.J.friendlyName,(0,g.aU)(function(I){I?D(I):Z>=0?(Ad(this,"Screen "+f+" appears to be offline. "+Z+" retries left."),this.N=g.AW((0,g.aU)(this.Ri,this,f,D,F,Z-1),300)):F(Error("Unable to fetch screen."))},this),F)}; g.d.Iz=function(){return this.B}; g.d.p_=function(f){this.MR()||f||(Ad(this,"Cast session died."),this.qM())};g.C(VK,hd);g.d=VK.prototype;g.d.xM=function(f){this.B=f;this.B.addUpdateListener(this.rY)}; g.d.LI=function(f){this.Ir=f;this.Bs()}; g.d.stop=function(){ZC0(this);this.B?this.B.stop((0,g.aU)(this.qM,this,null),(0,g.aU)(this.qM,this,"Failed to stop DIAL device.")):this.qM()}; g.d.Ey=function(){ZC0(this);this.B&&this.B.removeUpdateListener(this.rY);this.B=null;hd.prototype.Ey.call(this)}; g.d.Vs=function(f){this.MR()||f||(Ad(this,"DIAL session died."),this.X(),this.X=function(){},this.qM())};g.C(QK,hd);QK.prototype.stop=function(){this.qM()}; QK.prototype.xM=function(){}; QK.prototype.LI=function(){g.Vu(this.B);this.B=NaN;var f=oO(this.G.hW(),this.J.label);f?yK(this,f):this.qM(Error("No such screen"))}; QK.prototype.Ey=function(){g.Vu(this.B);this.B=NaN;hd.prototype.Ey.call(this)};g.C(Cw,g.zu);g.d=Cw.prototype; g.d.init=function(f,D){chrome.cast.timeout.requestSession=3E4;var F=new chrome.cast.SessionRequest(this.N,[chrome.cast.Capability.AUDIO_OUT]);g.CO("desktop_enable_cast_connect")&&(F.androidReceiverCompatible=!0);this.Jb||(F.dialRequest=new chrome.cast.DialRequest("YouTube"));var Z=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;f=f||this.T?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var I=(0,g.aU)(this.jGs,this);F=new chrome.cast.ApiConfig(F,(0,g.aU)(this.uN, this),I,Z,f);F.customDialLaunchCallback=(0,g.aU)(this.wIE,this);chrome.cast.initialize(F,(0,g.aU)(function(){this.MR()||(chrome.cast.addReceiverActionListener(this.X),yWV(),this.J.subscribe("onlineScreenChange",(0,g.aU)(this.Mg,this)),this.B=zLe(this),chrome.cast.setCustomReceivers(this.B,function(){},(0,g.aU)(function(p){this.Z1("Failed to set initial custom receivers: "+g.rG(p))},this)),this.publish("yt-remote-cast2-availability-change",T3(this)),D(!0))},this),(0,g.aU)(function(p){this.Z1("Failed to initialize API: "+ g.rG(p)); D(!1)},this))}; g.d.VmQ=function(f,D){me("Setting connected screen ID: "+f+" -> "+D);if(this.Y){var F=this.Y.Y;if(!f||F&&F.id!=f)me("Unsetting old screen status: "+this.Y.J.friendlyName),bo(this,null)}if(f&&D){if(!this.Y){f=oO(this.J.hW(),f);if(!f){me("setConnectedScreenStatus: Unknown screen.");return}if(f.idType=="shortLived"){me("setConnectedScreenStatus: Screen with id type to be short lived.");return}F=I8Y(this,f);F||(me("setConnectedScreenStatus: Connected receiver not custom..."),F=new chrome.cast.Receiver(f.uuid? f.uuid:f.id,f.name),F.receiverType=chrome.cast.ReceiverType.CUSTOM,this.B.push(F),chrome.cast.setCustomReceivers(this.B,function(){},(0,g.aU)(function(Z){this.Z1("Failed to set initial custom receivers: "+g.rG(Z))},this))); me("setConnectedScreenStatus: new active receiver: "+F.friendlyName);bo(this,new QK(this.J,F),!0)}this.Y.Xw(D)}else me("setConnectedScreenStatus: no screen.")}; g.d.wld=function(f){this.MR()?this.Z1("Setting connection data on disposed cast v2"):this.Y?this.Y.LI(f):this.Z1("Setting connection data without a session")}; g.d.iy=function(){this.MR()?this.Z1("Stopping session on disposed cast v2"):this.Y?(this.Y.stop(),bo(this,null)):me("Stopping non-existing session")}; g.d.requestSession=function(){chrome.cast.requestSession((0,g.aU)(this.uN,this),(0,g.aU)(this.ap3,this))}; g.d.Ey=function(){this.J.unsubscribe("onlineScreenChange",(0,g.aU)(this.Mg,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.X);var f=jgL,D=g.QY("yt.mdx.remote.debug.handlers_");g.no(D||[],f);g.jg(this.Y);g.zu.prototype.Ey.call(this)}; g.d.Z1=function(f){Zl("Controller",f)}; g.d.QJ=function(f,D){this.Y==f&&(D||bo(this,null),this.publish("yt-remote-cast2-session-change",D))}; g.d.DIE=function(f,D){if(!this.MR())if(f)switch(f.friendlyName=chrome.cast.unescape(f.friendlyName),me("onReceiverAction_ "+f.label+" / "+f.friendlyName+"-- "+D),D){case chrome.cast.ReceiverAction.CAST:if(this.Y)if(this.Y.J.label!=f.label)me("onReceiverAction_: Stopping active receiver: "+this.Y.J.friendlyName),this.Y.stop();else{me("onReceiverAction_: Casting to active receiver.");this.Y.Y&&this.publish("yt-remote-cast2-session-change",this.Y.Y);break}switch(f.receiverType){case chrome.cast.ReceiverType.CUSTOM:bo(this, new QK(this.J,f));break;case chrome.cast.ReceiverType.DIAL:bo(this,new VK(this.J,f,this.G,this.config_));break;case chrome.cast.ReceiverType.CAST:bo(this,new $m(this.J,f,this.config_));break;default:this.Z1("Unknown receiver type: "+f.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.Y&&this.Y.J.label==f.label?this.Y.stop():this.Z1("Stopping receiver w/o session: "+f.friendlyName)}else this.Z1("onReceiverAction_ called without receiver.")}; g.d.wIE=function(f){if(this.MR())return Promise.reject(Error("disposed"));var D=f.receiver;D.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.Z1("Not DIAL receiver: "+D.friendlyName),D.receiverType=chrome.cast.ReceiverType.DIAL);var F=this.Y?this.Y.J:null;if(!F||F.label!=D.label)return this.Z1("Receiving DIAL launch request for non-clicked DIAL receiver: "+D.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(F&&F.label==D.label&&F.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.Y.Y)return me("Reselecting dial screen."), this.publish("yt-remote-cast2-session-change",this.Y.Y),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.Z1('Changing CAST intent from "'+F.receiverType+'" to "dial" for '+D.friendlyName);bo(this,new VK(this.J,D,this.G,this.config_))}D=this.Y;D.N=f;D.N.appState==chrome.cast.DialAppState.RUNNING?(f=D.N.extraData||{},F=f.screenId||null,RW(D)&&f.loungeToken?f.loungeTokenRefreshIntervalMs?f=f8U(D,{name:D.J.friendlyName,screenId:f.screenId,loungeToken:f.loungeToken,dialId:D.N.receiver.label, screenIdType:"shortLived"},f.loungeTokenRefreshIntervalMs):(g.fO(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(f)+".")),f=DPb(D,F)):f=DPb(D,F)):f=Y4U(D);return f}; g.d.uN=function(f){var D=this;if(!this.MR()&&!this.T){me("New cast session ID: "+f.sessionId);var F=f.receiver;if(F.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.Y)if(F.receiverType==chrome.cast.ReceiverType.CAST)me("Got resumed cast session before resumed mdx connection."),F.friendlyName=chrome.cast.unescape(F.friendlyName),bo(this,new $m(this.J,F,this.config_),!0);else{this.Z1("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var Z=this.Y.J,I=oO(this.J.hW(), Z.label);I&&qd(I,F.label)&&Z.receiverType!=chrome.cast.ReceiverType.CAST&&F.receiverType==chrome.cast.ReceiverType.CAST&&(me("onSessionEstablished_: manual to cast session change "+F.friendlyName),g.jg(this.Y),this.Y=new $m(this.J,F,this.config_),this.Y.subscribe("sessionScreen",(0,g.aU)(this.QJ,this,this.Y)),this.Y.subscribe("sessionFailed",function(){return p6V(D,D.Y)}),this.Y.LI(null)); this.Y.xM(f)}}}; g.d.ys=function(){return this.Y?this.Y.Iz():null}; g.d.ap3=function(f){this.MR()||(this.Z1("Failed to estabilish a session: "+g.rG(f)),f.code!=chrome.cast.ErrorCode.CANCEL&&bo(this,null),this.publish("yt-remote-cast2-session-failed"))}; g.d.jGs=function(f){me("Receiver availability updated: "+f);if(!this.MR()){var D=T3(this);this.S=f==chrome.cast.ReceiverAvailability.AVAILABLE;T3(this)!=D&&this.publish("yt-remote-cast2-availability-change",T3(this))}}; g.d.Mg=function(){this.MR()||(this.B=zLe(this),me("Updating custom receivers: "+g.rG(this.B)),chrome.cast.setCustomReceivers(this.B,function(){},(0,g.aU)(function(){this.Z1("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",T3(this)))}; Cw.prototype.setLaunchParams=Cw.prototype.wld;Cw.prototype.setConnectedScreenStatus=Cw.prototype.VmQ;Cw.prototype.stopSession=Cw.prototype.iy;Cw.prototype.getCastSession=Cw.prototype.ys;Cw.prototype.requestSession=Cw.prototype.requestSession;Cw.prototype.init=Cw.prototype.init;Cw.prototype.dispose=Cw.prototype.dispose;var Qtc=g.eu(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"]),yXV=[],j8n=g.oG(Qtc);g.d=aW.prototype; g.d.reset=function(f){this.listId="";this.index=-1;this.videoId="";Q8X(this);this.volume=-1;this.muted=!1;f&&(this.index=f.index,this.listId=f.listId,this.videoId=f.videoId,this.playerState=f.playerState,this.volume=f.volume,this.muted=f.muted,this.audioTrackId=f.audioTrackId,this.trackData=f.trackData,this.hasPrevious=f.hasPrevious,this.hasNext=f.hasNext,this.T=f.playerTime,this.X=f.playerTimeAt,this.J=f.seekableStart,this.S=f.seekableEnd,this.B=f.duration,this.loadedTime=f.loadedTime,this.Y=f.liveIngestionTime, this.G=!isNaN(this.Y))}; g.d.isPlaying=function(){return this.playerState==1}; g.d.isBuffering=function(){return this.playerState==3}; g.d.Oe=function(f){this.B=isNaN(f)?0:f}; g.d.getDuration=function(){return this.G?this.B+G3(this):this.B}; g.d.clone=function(){return new aW(mPn(this))};g.C(Lw,g.zu);g.d=Lw.prototype;g.d.getState=function(){return this.B}; g.d.AP=function(){return this.G.getReconnectTimeout()}; g.d.tT=function(){this.G.reconnect()}; g.d.play=function(){E7(this)?(this.Y?this.Y.play(null,g.u5,gC(this,"play")):Nt(this,"play"),MME(this,1,W_(lo(this))),this.publish("remotePlayerChange")):Jd(this,this.play)}; g.d.pause=function(){E7(this)?(this.Y?this.Y.pause(null,g.u5,gC(this,"pause")):Nt(this,"pause"),MME(this,2,W_(lo(this))),this.publish("remotePlayerChange")):Jd(this,this.pause)}; g.d.seekTo=function(f){if(E7(this)){if(this.Y){var D=lo(this),F=new chrome.cast.media.SeekRequest;F.currentTime=f;D.isPlaying()||D.isBuffering()?F.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:F.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.Y.seek(F,g.u5,gC(this,"seekTo",{newTime:f}))}else Nt(this,"seekTo",{newTime:f});MME(this,3,f);this.publish("remotePlayerChange")}else Jd(this,g.wE(this.seekTo,f))}; g.d.stop=function(){if(E7(this)){this.Y?this.Y.stop(null,g.u5,gC(this,"stopVideo")):Nt(this,"stopVideo");var f=lo(this);f.index=-1;f.videoId="";Q8X(f);uo(this,f);this.publish("remotePlayerChange")}else Jd(this,this.stop)}; g.d.setVolume=function(f,D){if(E7(this)){var F=lo(this);if(this.J){if(F.volume!=f){var Z=Math.round(f)/100;this.J.setReceiverVolumeLevel(Z,(0,g.aU)(function(){IW("set receiver volume: "+Z)},this),(0,g.aU)(function(){this.Z1("failed to set receiver volume.")},this))}F.muted!=D&&this.J.setReceiverMuted(D,(0,g.aU)(function(){IW("set receiver muted: "+D)},this),(0,g.aU)(function(){this.Z1("failed to set receiver muted.")},this))}else{var I={volume:f, muted:D};F.volume!=-1&&(I.delta=f-F.volume);Nt(this,"setVolume",I)}F.muted=D;F.volume=f;uo(this,F)}else Jd(this,g.wE(this.setVolume,f,D))}; g.d.Dv=function(f,D){if(E7(this)){var F=lo(this);f={videoId:f};D&&(F.trackData={trackName:D.name,languageCode:D.languageCode,sourceLanguageCode:D.translationLanguage?D.translationLanguage.languageCode:"",languageName:D.languageName,kind:D.kind},f.style=g.rG(D.style),g.ai(f,F.trackData));Nt(this,"setSubtitlesTrack",f);uo(this,F)}else Jd(this,g.wE(this.Dv,f,D))}; g.d.setAudioTrack=function(f,D){E7(this)?(D=D.getLanguageInfo().getId(),Nt(this,"setAudioTrack",{videoId:f,audioTrackId:D}),f=lo(this),f.audioTrackId=D,uo(this,f)):Jd(this,g.wE(this.setAudioTrack,f,D))}; g.d.playVideo=function(f,D,F,Z,I,p,z){Z=Z===void 0?null:Z;I=I===void 0?null:I;p=p===void 0?null:p;z=z===void 0?null:z;var H=lo(this),K={videoId:f};F!==void 0&&(K.currentIndex=F);B_(H,f,F||0);D!==void 0&&(wC(H,D),K.currentTime=D);Z&&(K.listId=Z);I&&(K.playerParams=I);p&&(K.clickTrackingParams=p);z&&(K.locationInfo=g.rG(z));Nt(this,"setPlaylist",K);Z||uo(this,H)}; g.d.EX=function(f,D){if(E7(this)){if(f&&D){var F=lo(this);B_(F,f,D);uo(this,F)}Nt(this,"previous")}else Jd(this,g.wE(this.EX,f,D))}; g.d.nextVideo=function(f,D){if(E7(this)){if(f&&D){var F=lo(this);B_(F,f,D);uo(this,F)}Nt(this,"next")}else Jd(this,g.wE(this.nextVideo,f,D))}; g.d.F8=function(){if(E7(this)){Nt(this,"clearPlaylist");var f=lo(this);f.reset();uo(this,f);this.publish("remotePlayerChange")}else Jd(this,this.F8)}; g.d.Qd=function(){E7(this)?Nt(this,"dismissAutoplay"):Jd(this,this.Qd)}; g.d.dispose=function(){if(this.B!=3){var f=this.B;this.B=3;this.publish("proxyStateChange",f,this.B)}g.zu.prototype.dispose.call(this)}; g.d.Ey=function(){bCC(this);this.G=null;this.X.clear();rC(this,null);g.zu.prototype.Ey.call(this)}; g.d.T0=function(f){if((f!=this.B||f==2)&&this.B!=3&&f!=0){var D=this.B;this.B=f;this.publish("proxyStateChange",D,f);if(f==1)for(;!this.X.isEmpty();)D=f=this.X,D.Y.length===0&&(D.Y=D.J,D.Y.reverse(),D.J=[]),f.Y.pop().apply(this);else f==3&&this.dispose()}}; g.d.SwF=function(f,D){this.publish(f,D)}; g.d.gGY=function(f){if(!f)this.xf(null),rC(this,null);else if(this.J.receiver.volume){f=this.J.receiver.volume;var D=lo(this),F=Math.round(100*f.level||0);if(D.volume!=F||D.muted!=f.muted)IW("Cast volume update: "+f.level+(f.muted?" muted":"")),D.volume=F,D.muted=!!f.muted,uo(this,D)}}; g.d.xf=function(f){IW("Cast media: "+!!f);this.Y&&this.Y.removeUpdateListener(this.N);if(this.Y=f)this.Y.addUpdateListener(this.N),tML(this),this.publish("remotePlayerChange")}; g.d.uto=function(f){f?(tML(this),this.publish("remotePlayerChange")):this.xf(null)}; g.d.vT=function(){Nt(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}; g.d.OFr=function(){var f=VMX();f&&rC(this,f)}; g.d.Z1=function(f){Zl("CP",f)};g.C(XU,g.zu);g.d=XU.prototype; g.d.connect=function(f,D){if(D){var F=D.listId,Z=D.videoId,I=D.videoIds,p=D.playerParams,z=D.clickTrackingParams,H=D.index,K={videoId:Z},k=D.currentTime,h=D.locationInfo;D=D.loopMode;k!==void 0&&(K.currentTime=k<=5?0:k);p&&(K.playerParams=p);h&&(K.locationInfo=h);z&&(K.clickTrackingParams=z);F&&(K.listId=F);I&&I.length>0&&(K.videoIds=I.join(","));H!==void 0&&(K.currentIndex=H);this.rY&&(K.loopMode=D||"LOOP_MODE_OFF");F&&(this.Y.listId=F);this.Y.videoId=Z;this.Y.index=H||0;this.Y.state=3;wC(this.Y, k);this.X="UNSUPPORTED";F=this.rY?"setInitialState":"setPlaylist";eV("Connecting with "+F+" and params: "+g.rG(K));this.J.connect({method:F,params:g.rG(K)},f,NSV())}else eV("Connecting without params"),this.J.connect({},f,NSV());vj0(this)}; g.d.gk=function(f){this.J.gk(f)}; g.d.dispose=function(){this.MR()||(g.dE("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),xm(this,3));g.zu.prototype.dispose.call(this)}; g.d.Ey=function(){a8n(this);w6o(this);Gf0(this);g.Vu(this.N);this.N=NaN;g.Vu(this.Jb);this.Jb=NaN;this.G=null;g.MP(this.Bs);this.Bs.length=0;this.J.dispose();g.zu.prototype.Ey.call(this);this.X=this.S=this.B=this.Y=this.J=null}; g.d.Og=function(f){if(!this.B||this.B.length===0)return!1;for(var D=g.a(this.B),F=D.next();!F.done;F=D.next())if(!F.value.capabilities.has(f))return!1;return!0}; g.d.GxQ=function(){var f=3;this.MR()||(f=0,isNaN(this.y6())?this.J.qs()&&isNaN(this.T)&&(f=1):f=2);return f}; g.d.dl=function(f){eV("Disconnecting with "+f);g.dE("yt.mdx.remote.remoteClient_",null);a8n(this);this.publish("beforeDisconnect",f);f==1&&j8();this.J.disconnect(f);this.dispose()}; g.d.vS=function(){var f=this.Y;this.G&&(f=this.Y.clone(),B_(f,this.G,f.index));return mPn(f)}; g.d.eST=function(f){var D=this,F=new aW(f);F.videoId&&F.videoId!=this.Y.videoId&&(this.G=F.videoId,g.Vu(this.N),this.N=g.AW(function(){if(D.G){var I=D.G;D.G=null;D.Y.videoId!=I&&O7(D,"getNowPlaying")}},5E3)); var Z=[];this.Y.listId==F.listId&&this.Y.videoId==F.videoId&&this.Y.index==F.index||Z.push("remoteQueueChange");this.Y.playerState==F.playerState&&this.Y.volume==F.volume&&this.Y.muted==F.muted&&W_(this.Y)==W_(F)&&g.rG(this.Y.trackData)==g.rG(F.trackData)||Z.push("remotePlayerChange");this.Y.reset(f);g.hC(Z,function(I){this.publish(I)},this)}; g.d.Ot=function(){var f=this.J.getDeviceId(),D=g.NC(this.B,function(F){return F.type=="REMOTE_CONTROL"&&F.id!=f}); return D?D.id:""}; g.d.y6=function(){return this.J.AP()}; g.d.uB=function(){return this.X||"UNSUPPORTED"}; g.d.gi=function(){return this.S||""}; g.d.wV=function(){!isNaN(this.y6())&&this.J.tT()}; g.d.O4r=function(f,D){O7(this,f,D);B0Y(this)}; g.d.rd=function(){var f=g.LO("SAPISID","")||g.LO("__Secure-1PAPISID")||"",D=g.LO("__Secure-3PAPISID","")||"";if(!f&&!D)return"";f=g.B9(g.W9(f),2);D=g.B9(g.W9(D),2);return g.B9(g.W9(","+f+","+D),2)}; XU.prototype.subscribe=XU.prototype.subscribe;XU.prototype.unsubscribeByKey=XU.prototype.A6;XU.prototype.getProxyState=XU.prototype.GxQ;XU.prototype.disconnect=XU.prototype.dl;XU.prototype.getPlayerContextData=XU.prototype.vS;XU.prototype.setPlayerContextData=XU.prototype.eST;XU.prototype.getOtherConnectedRemoteId=XU.prototype.Ot;XU.prototype.getReconnectTimeout=XU.prototype.y6;XU.prototype.getAutoplayMode=XU.prototype.uB;XU.prototype.getAutoplayVideoId=XU.prototype.gi;XU.prototype.reconnect=XU.prototype.wV; XU.prototype.sendMessage=XU.prototype.O4r;XU.prototype.getXsrfToken=XU.prototype.rd;XU.prototype.isCapabilitySupportedOnConnectedDevices=XU.prototype.Og;g.C(OCV,qt);g.d=OCV.prototype;g.d.hW=function(f){return this.T2.$_gs(f)}; g.d.contains=function(f){return!!this.T2.$_c(f)}; g.d.get=function(f){return this.T2.$_g(f)}; g.d.start=function(){this.T2.$_st()}; g.d.add=function(f,D,F){this.T2.$_a(f,D,F)}; g.d.remove=function(f,D,F){this.T2.$_r(f,D,F)}; g.d.gI=function(f,D,F,Z){this.T2.$_un(f,D,F,Z)}; g.d.Ey=function(){for(var f=this.Y.length,D=0;D1&&!this.U.getOption("remote","quickCast")?(this.qy=g.yg(f,this.Y,this),this.cR(g.M2(f,this.Y)),f=this.U.getOption("remote","currentReceiver"),f=this.Y(f),this.options[f]&&this.bv(f),this.enable(!0)):this.enable(!1)}; hH.prototype.Y=function(f){return f.key}; hH.prototype.gQ=function(f){return f==="cast-selector-receiver"?"\u6295\u653e\u2026":this.qy[f].name}; hH.prototype.G2=function(f){g.C7.prototype.G2.call(this,f);this.U.setOption("remote","currentReceiver",this.qy[f]);this.x8.Fq()};g.C(A2E,g.KS);g.d=A2E.prototype; g.d.create=function(){var f=this.player.j(),D=g.gk(f);f={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:f.Z("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:f.Z("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:f.Z("enable_cast_short_lived_lounge_token")};DSC(D,f);this.subscriptions.push(g.f_("yt-remote-before-disconnect",this.kTx,this));this.subscriptions.push(g.f_("yt-remote-connection-change",this.k8R,this));this.subscriptions.push(g.f_("yt-remote-receiver-availability-change",this.kA, this));this.subscriptions.push(g.f_("yt-remote-auto-connect",this.WFI,this));this.subscriptions.push(g.f_("yt-remote-receiver-resumed",this.rkT,this));this.subscriptions.push(g.f_("mdx-privacy-popup-confirm",this.t$x,this));this.subscriptions.push(g.f_("mdx-privacy-popup-cancel",this.sPo,this));this.kA()}; g.d.load=function(){this.player.cancelPlayback();g.KS.prototype.load.call(this);this.ZB=new y2c(this.player.j(),this);this.player.rE(this.ZB);this.sQ=new keX(this,this.player,this.JZ);var f=(f=H0v())?f.currentTime:0;var D=zC0()?new Lw(zo(),void 0):null;f==0&&D&&(f=W_(lo(D)));f!==0&&this.Ft(f);$SU(this,this.R$,this.R$);this.player.Ay(6)}; g.d.unload=function(){this.player.publish("mdxautoplaycanceled");this.player.Yr();this.jB=this.II;g.iD(this.sQ,this.JZ);this.JZ=this.ZB=this.sQ=null;g.KS.prototype.unload.call(this);this.player.Ay(5);yE(this)}; g.d.Ey=function(){g.Dd(this.subscriptions);g.KS.prototype.Ey.call(this)}; g.d.IQ=function(f){var D=g.hv.apply(1,arguments);this.loaded&&this.sQ.zR.apply(this.sQ,[f].concat(g.w(D)))}; g.d.getAdState=function(){return this.UG}; g.d.hasPrevious=function(){return this.JZ?lo(this.JZ).hasPrevious:!1}; g.d.hasNext=function(){return this.JZ?lo(this.JZ).hasNext:!1}; g.d.Ft=function(f,D){this.aV=f||0;this.player.publish("progresssync",f,D);this.player.Ep("onVideoProgress",f||0)}; g.d.getCurrentTime=function(){return this.aV}; g.d.getDuration=function(){return lo(this.JZ).getDuration()||0}; g.d.zi=function(){var f=lo(this.JZ);return f.G?f.Y+G3(f):f.Y}; g.d.VZ=function(){return lo(this.JZ).loadedTime}; g.d.jL=function(){return CqL(lo(this.JZ))}; g.d.ih=function(){var f=lo(this.JZ);return f.J>0?f.J+G3(f):f.J}; g.d.getProgressState=function(){var f=lo(this.JZ),D=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:f.playerState!=1081&&this.player.H_(),clipEnd:D.clipEnd,clipStart:D.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:this.getDuration(),ingestionTime:this.zi(),isAtLiveHead:this.isAtLiveHead(),loaded:this.VZ(),seekableEnd:this.jL(),seekableStart:this.ih(),offset:0,viewerLivestreamJoinMediaTime:0}}; g.d.isAtLiveHead=function(){return CqL(lo(this.JZ))-this.getCurrentTime()<=1}; g.d.nextVideo=function(){this.JZ&&this.JZ.nextVideo()}; g.d.EX=function(){this.JZ&&this.JZ.EX()}; g.d.kTx=function(f){f===1&&(this.xV=this.JZ?lo(this.JZ):null)}; g.d.k8R=function(){var f=zC0()?new Lw(zo(),void 0):null;if(f){var D=this.jB;this.loaded&&this.unload();this.JZ=f;this.xV=null;D.key!==this.II.key&&(this.jB=D,this.load())}else g.jg(this.JZ),this.JZ=null,this.loaded&&(this.unload(),(f=this.xV)&&f.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(f.videoId,W_(f)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}; g.d.kA=function(){var f=[this.II],D=f.concat,F=F5v();c_()&&g.W6("yt-remote-cast-available")&&F.push({key:"cast-selector-receiver",name:"Cast..."});this.qy=D.call(f,F);f=Ian()||this.II;AH(this,f);this.player.Ep("onMdxReceiversChange")}; g.d.WFI=function(){var f=Ian();AH(this,f)}; g.d.rkT=function(){this.jB=Ian()}; g.d.t$x=function(){this.g4=!0;yE(this);o9=!1;si&&HJ(si,1);si=null}; g.d.sPo=function(){this.g4=!1;yE(this);AH(this,this.II);this.jB=this.II;o9=!1;si=null;this.player.playVideo()}; g.d.JJ=function(f,D){switch(f){case "casting":return this.loaded;case "receivers":return this.qy;case "currentReceiver":return D&&(D.key==="cast-selector-receiver"?RLo():AH(this,D)),this.loaded?this.jB:this.II;case "quickCast":return this.qy.length===2&&this.qy[1].key==="cast-selector-receiver"?(D&&RLo(),!0):!1}}; g.d.vT=function(){this.JZ.vT()}; g.d.LC=function(){return!1}; g.d.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]}; g.d.isLoggedIn=function(){var f,D;return((f=g.nc("PLAYER_CONFIG"))==null?void 0:(D=f.args)==null?void 0:D.authuser)!==void 0?!0:!(!g.nc("SESSION_INDEX")&&!g.nc("LOGGED_IN"))};g.o2("remote",A2E);})(_yt_player);