(function(g){var window=this;'use strict';var dW=function(Z){g.zb("yt.mdx.remote.connectData_",Z)},dgV=function(Z){g.jD.call(this,"channelError"); this.error=Z},YnM=function(Z,I){var d=[]; oLv(I,function(Y){try{var T=g.$I.prototype.nT.call(this,Y,!0)}catch(f){if(f=="Storage: Invalid value was encountered")return;throw f;}T===void 0?d.push(Y):g.MyL(T)&&d.push(Y)},Z); return d},Yu=function(Z,I){Z.info("getDialAppInfoWithTimeout_ "+I); oo(Z)&&(g.Cl(Z.V),Z.V=0,I==0?jxg(Z):Z.V=g.lo(function(){jxg(Z)},I))},Tw3=function(Z){if(Z.R4){if(Z.R4.locationOverrideToken)return{locationOverrideToken:Z.R4.locationOverrideToken}; if(Z.R4.latitudeE7!=null&&Z.R4.longitudeE7!=null)return{latitudeE7:Z.R4.latitudeE7,longitudeE7:Z.R4.longitudeE7}}return null},iRE=function(){var Z=jE(); this.L=Z;Z.gP("/client_streamz/youtube/living_room/mdx/channel/message_received",g.Q7("channel_type"))},f8v=function(Z){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+Z)!=-1||document.currentScript.src.indexOf("&"+Z)!=-1)},P8V=function(){return typeof window.__onGCastApiAvailable=="function"?window.__onGCastApiAvailable:null},fe=function(Z){Z||(g.m4("yt-remote-session-screen-id"),g.m4("yt-remote-session-video-id")); QxM();Z=T0();g.s4(Z,iK());ORt(Z)},a8W=function(){},jE=function(){if(!P0){P0=new g.b1(new WiE); var Z=g.EQ("client_streamz_web_flush_count",-1);Z!==-1&&(P0.Z=Z)}return P0},Qr=function(Z){if(g.iN.JSON)try{return g.iN.JSON.parse(Z)}catch(I){}return eh3(Z)},Bwv=function(Z,I){Z.V=I.params.videoId; Z.publish("nowAutoplaying",parseInt(I.params.timeout,10))},OX=function(Z){isNaN(Z.Z)||g.Cl(Z.Z); Z.Z=g.lo((0,g.u5)(Z.jQ,Z),Z.N>0&&Z.N0&&(Z.sZ=new g.Qk((0,g.u5)(Z.JJ,Z,Z.L),Z.J5));Z.b5.listen(Z.L,"readystatechange",Z.e0);I=Z.mJ?g.zm(Z.mJ):{};Z.In?(Z.Bj||(Z.Bj="POST"),I["Content-Type"]="application/x-www-form-urlencoded",Z.L.send(Z.on,Z.Bj,Z.In,I)):(Z.Bj="GET",Z.L.send(Z.on,Z.Bj,null,I));wW(1)},Vr=function(Z,I){var d=Z.L; Z.D&&(d=Z.scheme+"://"+Z.domain+Z.port+Z.L);return g.gq(d+I,{})},xgE=function(){var Z=RhM(); if(g.xG(Z)){Z=iK();var I=g.T2("yt-remote-session-name")||"",d=g.T2("yt-remote-session-app")||"";Z={device:"REMOTE_CONTROL",id:Z,name:I,app:d,mdxVersion:3};Z.authuser=String(g.rh("SESSION_INDEX","0"));(I=g.rh("DELEGATED_SESSION_ID"))&&(Z.pageId=String(I));g.zb("yt.mdx.remote.channelParams_",Z)}},Kid=function(){if(!Na){var Z=g.Lu(); Z&&(Na=new g.QN(Z))}},bRV=function(Z,I){Z.capabilities.clear(); g.zG(I.split(","),g.T9(C8L,EL0)).forEach(function(d){Z.capabilities.add(d)})},HRu=function(Z){return{name:Z.name, screenId:Z.id,loungeToken:Z.token,dialId:Z.uuid,screenIdType:Z.idType,screenIdSecret:Z.secret}},sX=function(Z){Fb("Controller",Z)},c30=function(){return g.T2("yt-remote-session-browser-channel")},gLE=function(Z,I){g.zP.call(this,Z); this.L=I},ne=function(Z){return Z.getState()==1},hE=function(Z){Z.length?M4g(Z.shift(),function(){hE(Z)}):r3E()},Zb0=function(Z,I){this.L=Z; this.map=I;this.context=null},ITi=function(){var Z=g.Vs().search(/ (CrMo|Chrome|CriOS)\//)>=0; return g.h_||Z},jLd=function(Z){return new Promise(function(I){Z.Bj=dep(); if(Z.mJ){var d=new chrome.cast.DialLaunchResponse(!0,oTd(Z));I(d);YWv(Z)}else Z.LS=function(){g.Cl(Z.In);Z.LS=function(){}; Z.In=NaN;var Y=new chrome.cast.DialLaunchResponse(!0,oTd(Z));I(Y);YWv(Z)},Z.In=g.lo(function(){Z.LS()},100)})},Tdd=function(Z,I,d,Y){var T=new g.gR(null); Z&&g.MQ(T,Z);I&&g.rR(T,I);d&&g.Zl(T,d);Y&&(T.D=Y);return T},QLg=function(Z){g.ap(Z.channel,"m",function(){Z.j=3; Z.Z.reset();Z.X=null;Z.V=0;for(var I=g.t(Z.kS),d=I.next();!d.done;d=I.next())d=d.value,Z.channel&&Z.channel.send(d);Z.kS=[];Z.publish("webChannelOpened");Z.mJ.oE("WEB_CHANNEL")}); g.ap(Z.channel,"n",function(){Z.j=0;Z.Z.isActive()||Z.publish("webChannelClosed");var I,d=(I=Z.channel)==null?void 0:ibt(new fTi(I,I.L));d&&(Z.kS=[].concat(g.c(d)));Z.Bj.oE("WEB_CHANNEL")}); g.ap(Z.channel,"p",function(I){var d=I.data;d[0]==="gracefulReconnect"?(Z.Z.start(),Z.channel&&Z.channel.close()):Z.publish("webChannelMessage",new PTp(d[0],d[1]));Z.WE=I.statusCode;Z.j7.oE("WEB_CHANNEL")}); g.ap(Z.channel,"o",function(){Z.WE===401||Z.Z.start();Z.publish("webChannelError");Z.fS.oE("WEB_CHANNEL","")})},T0=function(){var Z=g.T2("yt-remote-connected-devices")||[]; g.ik(Z);return Z},Ob$=function(Z){return Z.N?Z.V+mG(Z):Z.V},sxu=function(){this.Z=null; this.L="";this.D=!1},VwM=function(Z,I,d){var Y=this; d=d===void 0?function(){return""}:d; var T=T===void 0?new aTW:T;var f=f===void 0?new g.Mc:f;this.pathPrefix=Z;this.L=I;this.Ns=d;this.B=f;this.X=null;this.In=this.V=0;this.channel=null;this.j=0;this.Z=new qa(function(){Y.Z.isActive();var P;((P=Y.channel)==null?void 0:WY0((new fTi(P,P.L)).L.D))===0&&Y.connect(Y.X,Y.V)}); this.N={};this.D={};this.LS=!1;this.logger=null;this.kS=[];this.WE=void 0;this.mJ=new ewi;this.Bj=new Bdi;this.j7=new iRE;this.fS=new wG$},Ndg=function(Z){g.jD.call(this,"statevent",Z)},hwV=function(Z,I){var d; I?d=I.eK:d=Z.on++;var Y=Z.mJ.clone();g.G_(Y,"SID",Z.N);g.G_(Y,"RID",d);g.G_(Y,"AID",Z.Tm);SE(Z,Y);Z.V&&Z.In&&g.DA(Y,Z.V,Z.In);d=new AE(Z,Z.N,d,Z.Ns+1);Z.V===null&&(d.mJ=Z.In);I&&(Z.Z=I.kS.concat(Z.Z));I=FYv(Z,d,1E3);d.setTimeout(Math.round(Z.En*.5)+Math.round(Z.En*.5*Math.random()));sLL(Z.D,d);nTV(d,Y,I)},YWv=function(Z){Z.B=Z.N.NG(Z.Bj,Z.D.label,Z.D.friendlyName,oo(Z),function(I,d){Z.B=function(){}; Z.kS=!0;DI(Z,I);I.idType=="shortLived"&&d>0&&Yu(Z,d)},function(I){Z.B=function(){}; Z.eI(I)})},ewi=function(){var Z=jE(); this.L=Z;Z.gP("/client_streamz/youtube/living_room/mdx/channel/opened",g.Q7("channel_type"))},met=function(Z){return Array.isArray(Z)?"["+g.Ft(Z,JE).join(",")+"]":"null"},SW0=function(Z,I){if(WY0(Z.D)>=Z.D.N-(Z.j?1:0))return!1; if(Z.j)return Z.Z=I.kS.concat(Z.Z),!0;if(Z.Um==1||Z.Um==2||Z.Ns>=(Z.Vf?0:Z.u8))return!1;Z.j=Ro((0,g.u5)(Z.Pn,Z,I),qWt(Z,Z.Ns));Z.Ns++;return!0},vTE=function(Z,I){var d=null; if(Z.L==I){Le(Z);A8t(Z);Z.L=null;var Y=2}else if(DeL(Z.D,I))d=I.kS,J8d(Z.D,I),Y=1;else return;if(Z.Um!=0)if(I.j)if(Y==1){d=I.In?I.In.length:0;I=Date.now()-I.Ns;var T=Z.Ns;Y=Rw3();Y.dispatchEvent(new LYW(Y,d,I,T));UX(Z)}else Ued(Z);else{var f=I.UZ;T=I.getLastError();if(T==3||T==0&&f>0||!(Y==1&&SW0(Z,I)||Y==2&&y8V(Z)))switch(d&&d.length>0&&(I=Z.D,I.Z=I.Z.concat(d)),T){case 1:yr(Z,5);break;case 4:yr(Z,10);break;case 3:yr(Z,6);break;default:yr(Z,2)}}},lTd=function(Z,I){if(Z.L.playerState!=-1E3){var d= 1085; switch(parseInt(I.params.adState,10)){case 1:d=1081;break;case 2:d=1084;break;case 0:d=1083}Z.L.playerState=d;I=parseInt(I.params.currentTime,10);v0(Z.L,isNaN(I)?0:I);Z.publish("remotePlayerChange")}},uJu=function(Z){this.B=Z||10; g.iN.PerformanceNavigationTiming?(Z=g.iN.performance.getEntriesByType("navigation"),Z=Z.length>0&&(Z[0].nextHopProtocol=="hq"||Z[0].nextHopProtocol=="h2")):Z=!!(g.iN.chrome&&g.iN.chrome.loadTimes&&g.iN.chrome.loadTimes()&&g.iN.chrome.loadTimes().wasFetchedViaSpdy);this.N=Z?this.B:1;this.L=null;this.N>1&&(this.L=new Set);this.D=null;this.Z=[]},GSV=function(Z){var I=Z.player.C(); return!I.Y("mdx_enable_privacy_disclosure_ui")||Z.isLoggedIn()||Z.oO||!Z.VS?!1:g.qN(I)||g.Mw(I)},uK=function(Z,I){g.mv.call(this); this.L=new zwM(I);this.B=Z;this.D=I&&I.er1||null;Z=I&&I.P55||null;I&&I.bZZ&&(Z?Z["X-Client-Protocol"]="webchannel":Z={"X-Client-Protocol":"webchannel"});this.L.In=Z;Z=I&&I.yq1||null;I&&I.Os&&(Z?Z["X-WebChannel-Content-Type"]=I.Os:Z={"X-WebChannel-Content-Type":I.Os});I&&I.Dk&&(Z?Z["X-WebChannel-Client-Profile"]=I.Dk:Z={"X-WebChannel-Client-Profile":I.Dk});this.L.I0=Z;(Z=I&&I.G8m)&&!g.Hw(Z)&&(this.L.V=Z);this.j=I&&I.tF5||!1;this.N=I&&I.el5||!1;(I=I&&I.Gw)&&!g.Hw(I)&&(this.L.fS=I,g.b3(this.D,I)&&(Z= this.D,I in Z&&delete Z[I]));this.Z=new lK(this)},G0=function(Z,I){Z.tB&&(Z=Z.tB.gC())&&g.TA(Z,function(d,Y){g.G_(I,Y,d)})},XGt=function(Z,I,d,Y,T){if(Y==0)d(!1); else{var f=T||0;Y--;kSd(Z,I,function(P){P?d(!0):g.iN.setTimeout(function(){XGt(Z,I,d,Y,f)},f)})}},UX=function(Z){twM(Z.D)||Z.j||(Z.j=!0,g.rB(Z.Pn,Z),Z.Ns=0)},z0=function(){g.k.call(this,{K:"div", T:"ytp-mdx-popup-dialog",J:{role:"dialog"},G:[{K:"div",T:"ytp-mdx-popup-dialog-inner-content",G:[{K:"div",T:"ytp-mdx-popup-title",Z1:"You're signed out"},{K:"div",T:"ytp-mdx-popup-description",Z1:"Videos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer."},{K:"div",T:"ytp-mdx-privacy-popup-buttons",G:[{K:"button",zm:["ytp-button","ytp-mdx-privacy-popup-cancel"],Z1:"Cancel"},{K:"button",zm:["ytp-button", "ytp-mdx-privacy-popup-confirm"],Z1:"Confirm"}]}]}]});this.fade=new g.nt(this,250);this.cancelButton=this.KS("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.KS("ytp-mdx-privacy-popup-confirm");g.z(this,this.fade);this.W(this.cancelButton,"click",this.L);this.W(this.confirmButton,"click",this.D)},$et=function(){var Z=ku; if(Xb[0]){var I=tE?$u:-1,d={};do d={Ik:void 0},I=(I+1)%50,d.Ik=Xb[I],g.KM(Z,function(Y){return function(T){T(Y.Ik)}}(d)); while(I!=$u);Xb=Array(50);$u=-1;tE=!1}},pG$=function(Z,I){var d=I.params.hasNext=="true"; Z.L.xb=I.params.hasPrevious=="true";Z.L.wf=d;Z.publish("previousNextChange")},RhM=function(){return g.gZ("yt.mdx.remote.channelParams_")||{}},SE=function(Z,I){Z.j7&&g.TA(Z.j7,function(d,Y){g.G_(I,Y,d)}); Z.B&&g.TA({},function(d,Y){g.G_(I,Y,d)})},xeu=function(Z,I,d){var Y=g.$e(d); Y.L!=""?(I&&g.rR(Y,I+"."+Y.L),g.Zl(Y,Y.Z)):(Y=g.iN.location,Y=Tdd(Y.protocol,I?I+"."+Y.hostname:Y.hostname,+Y.port,d));I=Z.fS;d=Z.kF;I&&d&&g.G_(Y,I,d);g.G_(Y,"VER",Z.CY);SE(Z,Y);return Y},KYp=function(Z,I){Z.B=I.params.autoplayMode; Z.publish("autoplayModeChange",Z.B);Z.B=="DISABLED"&&Z.publish("autoplayDismissed")},CTV=function(Z){pe.call(this,"ScreenServiceProxy"); this.SF=Z;this.L=[];this.L.push(this.SF.$_s("screenChange",(0,g.u5)(this.BR,this)));this.L.push(this.SF.$_s("onlineScreenChange",(0,g.u5)(this.zxJ,this)))},WY0=function(Z){return Z.D?1:Z.L?Z.L.size:0},Ke=function(Z,I){if(I==2||I==9){var d=null; Z.tB&&(d=null);var Y=(0,g.u5)(Z.gHS,Z);d||(d=new g.gR("//www.google.com/images/cleardot.gif"),W0(d));kSd(d.toString(),1E4,Y)}else xu(2);ETd(Z,I)},c8g=function(Z,I){var d=parseInt(I.params.currentTime||I.params.current_time,10); v0(Z.L,isNaN(d)?0:d);d=parseInt(I.params.state,10);d=isNaN(d)?-1:d;d==-1&&Z.L.playerState==-1E3&&(d=-1E3);Z.L.playerState=d;d=Number(I.params.loadedTime);Z.L.X=isNaN(d)?0:d;Z.L.cT(Number(I.params.duration));d=Z.L;var Y=Number(I.params.liveIngestionTime);d.L=Y;d.N=isNaN(Y)?!1:!0;d=Z.L;Y=Number(I.params.seekableStartTime);I=Number(I.params.seekableEndTime);d.D=isNaN(Y)?0:Y;d.V=isNaN(I)?0:I;Z.L.playerState==1?bbE(Z):Hbg(Z);Z.publish("remotePlayerChange")},A8t=function(Z){Z.Bj!=null&&(g.iN.clearTimeout(Z.Bj), Z.Bj=null)},r8i=function(Z,I,d,Y,T,f){Z.info("getAutomaticScreenByIds "+d+" / "+I); d||(d=Z.B[I]);var P=Z.uW(),O=d?Ce(P,d):null;d&&(Z.V||O)||(O=Ce(P,I));if(O){O.uuid=I;var a=EX(Z,O);gTv(Z.L,a,function(W){T(W?a:null)})}else d?Mw0(Z,d,(0,g.u5)(function(W){var e=EX(this,new bK({name:Y, screenId:d,loungeToken:W,dialId:I||""}));gTv(this.L,e,function(B){T(B?e:null)})},Z),f):T(null)},dQE=function(Z){Z.length>5&&(Z=Z.slice(Z.length-5)); var I=g.Ft(Zz3(),function(Y){return Y.loungeToken}),d=g.Ft(Z,function(Y){return Y.loungeToken}); g.a_(d,function(Y){return!g.Kc(I,Y)})&&IJt(); g.AU("yt-remote-local-screens",Z,31536E3)},oOp=function(Z){var I=0,d; for(d in Z)I++;return I},H0=function(Z,I){Fb(Z.fS,I)},bbE=function(Z){Hbg(Z); Z.kS=g.lo(function(){c0(Z,"getNowPlaying")},2E4)},j7d=function(Z,I,d){g.p.call(this); var Y=this;this.L=Z;this.S=I;this.yy=d;this.events=new g.De(this);this.B=!1;this.j=new g.ns(64);this.D=new g.uX(this.tP,500,this);this.Z=new g.uX(this.I5,1E3,this);this.X=new gW(this.oHj,0,this);this.N={};this.In=new g.uX(this.Dm,1E3,this);this.V=new g.Qk(this.seekTo,1E3,this);this.LS=this.events.W(this.S,"onVolumeChange",function(T){YEd(Y,T)}); g.z(this,this.events);this.events.W(I,"onCaptionsTrackListChanged",this.L5J);this.events.W(I,"captionschanged",this.j05);this.events.W(I,"captionssettingschanged",this.fq);this.events.W(I,"videoplayerreset",this.qH);this.events.W(I,"mdxautoplaycancel",function(){Y.yy.Wd()}); I.Y("enable_mdx_video_play_directly")&&this.events.W(I,"videodatachange",function(){GSV(Y.L)||Ma(Y)||rW(Y,0)}); Z=this.yy;Z.OZ();Z.subscribe("proxyStateChange",this.SV,this);Z.subscribe("remotePlayerChange",this.Ko,this);Z.subscribe("remoteQueueChange",this.qH,this);Z.subscribe("previousNextChange",this.xE,this);Z.subscribe("nowAutoplaying",this.kE,this);Z.subscribe("autoplayDismissed",this.Jo,this);g.z(this,this.D);g.z(this,this.Z);g.z(this,this.X);g.z(this,this.In);g.z(this,this.V);this.fq();this.qH();this.Ko()},Op=function(Z,I){Zq(); I0()&&I0();if(de)o0=Z;else{TRi(Z.id);var d=g.gZ("yt.mdx.remote.enableConnectWithInitialState_")||!1;Z=new Yg(j_,Z,RhM(),d);Z.connect(I,izg());Z.subscribe("beforeDisconnect",function(Y){Tt("yt-remote-before-disconnect",Y)}); Z.subscribe("beforeDispose",function(){iw()&&(iw(),fJt(null))}); Z.subscribe("browserChannelAuthError",function(){var Y=I0();Y&&Y.idType=="shortLived"&&(fm()?Pe().handleBrowserChannelAuthError():Q6("refreshLoungeToken called before API ready."))}); fJt(Z)}},dep=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(Z){var I=Math.random()*16|0; return(Z=="x"?I:I&3|8).toString(16)})},PIv=function(Z,I){Pe().init(Z,I)},Q7W=function(Z,I){var d=I.params.muted=="true"; Z.L.volume=parseInt(I.params.volume,10);Z.L.muted=d;Z.publish("remotePlayerChange")},Ozg=function(Z){Z.L.bT()||Z.CE||Z.L.g9(Z)},aJV=function(Z,I){YnM(Z,I).forEach(function(d){g.$I.prototype.remove.call(this,d)},Z)},a0=function(Z,I,d,Y){this.L=Z; this.N=I;this.V=d;this.j=Y||1;this.D=45E3;this.Z=new g.Vm(this);this.B=new g.qn;this.B.setInterval(250)},W3E=function(Z){We(Z); Z.X&&(g.iN.clearTimeout(Z.X),Z.X=null);Le(Z);Z.D.cancel();Z.j&&(typeof Z.j==="number"&&g.iN.clearTimeout(Z.j),Z.j=null)},AE=function(Z,I,d,Y){this.Z=Z; this.N=I;this.eK=d;this.Yl=Y||1;this.b5=new g.Vm(this);this.d4=45E3;this.mJ=null;this.j=!1;this.In=this.on=this.X=this.Tm=this.Ns=this.y5=this.LS=null;this.kS=[];this.L=null;this.V=0;this.B=this.Bj=null;this.UZ=-1;this.j7=!1;this.J5=0;this.sZ=null;this.SK=this.w4=this.I0=this.fS=!1;this.D=new sxu},e_=function(Z){switch(Z.playerState){case 1:case 1081:return(g.QY()-Z.B)/1E3+Z.j; case -1E3:return 0}return Z.j},sLL=function(Z,I){Z.L?Z.L.add(I):Z.D=I},BR3=function(Z,I,d,Y){g.Cl(Z.j); Z.j=0;e3u(Z.N,I,function(T){T||Y<0?d(T):Z.j=g.lo(function(){BR3(Z,I,d,Y-1)},300)})},wMg=function(){var Z=jE(); this.L=Z;Z.gP("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")},V1t=function(Z){Z.kH||Z.TX||(Z.V=1,Z.TX=Be((0,g.u5)(Z.tY,Z),0),Z.gj=0)},B0=function(Z,I,d){Array.isArray(d)||(d=[String(d)]); g.V87(Z.N,I,d)},NR$=function(Z){Z.j=g.lo(function(){we("Connecting timeout"); Z.dj(1)},2E4)},nOM=function(){F3L(); var Z=s7u();Z.push("//www.gstatic.com/eureka/clank/cast_sender.js");hE(Z)},pe=function(Z){g.dx.call(this); this.j=Z;this.screens=[]},h3d=function(Z,I){if(Z.Zh!=null)throw Error("WatchDog timer not null"); Z.Zh=Be((0,g.u5)(Z.pk,Z),I)},mQg=function(Z){g.jD.call(this,"channelMessage"); this.message=Z},SEV=function(Z){var I=Z.L.j; I!=null?(xu(5),I?(xu(11),V6(Z.L,Z,!1)):(xu(12),V6(Z.L,Z,!0))):(Z.Bl=new a0(Z),Z.Bl.W1=Z.Zx,I=Z.L,I=Nu(I,I.eb()?Z.jm:null,Z.Mw),xu(5),B0(I,"TYPE","xmlhttp"),qEp(Z.Bl,I,!1,Z.jm,!1))},Nu=function(Z,I,d){var Y=g.$e(d); if(Y.L!="")I&&g.rR(Y,I+"."+Y.L),g.Zl(Y,Y.Z);else{var T=window.location;Y=Tdd(T.protocol,I?I+"."+T.hostname:T.hostname,+T.port,d)}Z.Gc&&g.TA(Z.Gc,function(f,P){g.G_(Y,P,f)}); g.G_(Y,"VER",Z.Xc);G0(Z,Y);return Y},sp=function(Z,I){g.dx.call(this); var d=this;this.Z=0;this.N=Z;this.j=[];this.B=new ASp;this.D=this.L=null;this.In=(0,g.u5)(this.VK4,this);this.V=(0,g.u5)(this.Dv,this);this.X=(0,g.u5)(this.TKZ,this);this.LS=(0,g.u5)(this.afS,this);var Y=0;Z?(Y=Z.getProxyState(),Y!=3&&(Z.subscribe("proxyStateChange",this.AC,this),DQM(this))):Y=3;Y!=0&&(I?this.AC(Y):g.lo(function(){d.AC(Y)},0)); (Z=JSu())&&FM(this,Z);this.subscribe("yt-remote-cast2-session-change",this.LS)},UQ3=function(){var Z=R3L(); !Z&&nm()&&L3p()&&(Z={key:"cast-selector-receiver",name:L3p()});return Z},hZ=function(Z){Fb("remote",Z)},yS0=function(Z,I){return g.Xe(Z,function(d){return d||I?!d!=!I?!1:d.id==I.id:!0})},PTp=function(Z,I){this.action=Z; this.params=I||{}},lJW=function(Z,I){var d=Z.screens.length!=I.length; Z.screens=g.zG(Z.screens,function(f){return!!yS0(I,f)}); for(var Y=I.length,T=0;T0&&(Z.iZ=new g.Qk((0,g.u5)(Z.AJ,Z,Z.aL),Z.LV));Z.Z.listen(Z.aL,"readystatechange",Z.AI);I=Z.W1?g.zm(Z.W1):{};Z.oV?(Z.Qd="POST",I["Content-Type"]="application/x-www-form-urlencoded",Z.aL.send(Z.Sm,Z.Qd,Z.oV,I)):(Z.Qd="GET",Z.w2&&!g.Vd&&(I.Connection="close"),Z.aL.send(Z.Sm,Z.Qd,null,I));Z.L.iV(1)},ml=function(Z,I){Gmd(Z); Z.N.setPlayerContextData(z3i(I));DQM(Z)},kmd=function(Z){g.jD.call(this,"statevent",Z)},qu=function(Z){Z.onload=null; Z.onerror=null;Z.onabort=null;Z.ontimeout=null},XMg=function(Z){g.Cl(Z.j); Z.j=0;g.Cl(Z.V);Z.V=0;Z.B();Z.B=function(){}; g.Cl(Z.In)},ETd=function(Z,I){Z.L=0; Z.tB&&Z.tB.LU(I);t1t(Z);$Qp(Z)},pMp=function(Z){if(Z.L){var I=Z.fS(),d=Z.L.UF||{}; I?d["x-youtube-lounge-xsrf-token"]=I:delete d["x-youtube-lounge-xsrf-token"];Z.L.UF=d}},xQV=function(Z){Z.Zh&&(g.iN.clearTimeout(Z.Zh),Z.Zh=null)},Rw3=function(){return K3t=K3t||new g.mv},EO0=function(Z,I,d,Y,T,f,P,O,a,W,e,B,w,V){d=d===void 0?!1:d; Y=Y===void 0?function(){return""}:Y; T=T===void 0?!1:T;f=f===void 0?!1:f;P=P===void 0?!1:P;O=O===void 0?function(){return g.wL({})}:O; a=a===void 0?!1:a;e=e===void 0?!1:e;B=B===void 0?!1:B;w=w===void 0?!1:w;V=V===void 0?!1:V;this.Tm=Z;this.LS=I;this.j=new g.Mc;this.D=new qa(this.f55,this);this.L=null;this.V=!1;this.In=null;this.Ns="";this.kS=this.X=0;this.Z=[];this.SK=d;this.fS=Y;this.B=f;this.mJ=O;this.j7=W;this.Yl=P;this.Bj=null;this.N=g.wL();this.eK=T;this.I0=a;this.b5=e;this.y5=B;this.Hk=w;this.UZ=V;this.J5=new ewi;this.w4=new Bdi;this.d4=new V43;this.on=new iRE;this.sZ=new wG$;this.sU=new wMg;this.EU=new CIE},iw=function(){return g.gZ("yt.mdx.remote.connection_")}, Fb=function(Z,I){bzi(); var d=Hzg(Z,String(I));ku.length==0?cSW(d):($et(),g.KM(ku,function(Y){Y(d)}))},rS0=function(Z,I,d){Z.info("onConnectedScreenData_: Received screenData: "+JSON.stringify(I)); var Y=new bK(I);gOv(Z,Y,function(T){T?(Z.Ns=!0,EX(Z.N,Y),DI(Z,Y),Z.In="unknown",M1L(Z,d)):(g.eW(Error("CastSession, RemoteScreen from screenData: "+JSON.stringify(I)+" is not online.")),Z.eI())},5)},$Qp=function(Z){Z.uK&&(Z.uK.abort(),Z.uK=null); Z.kH&&(Z.kH.cancel(),Z.kH=null);Z.TX&&(g.iN.clearTimeout(Z.TX),Z.TX=null);S_(Z);Z.VJ&&(Z.VJ.cancel(),Z.VJ=null);Z.NN&&(g.iN.clearTimeout(Z.NN),Z.NN=null)},Zau=function(){},Dq=function(Z,I){AZ.call(this,Z,I,"ManualSession"); this.Z=g.lo((0,g.u5)(this.cN,this,null),150)},JZ=function(Z,I){g.St.call(this,"Play on",1,Z,I); this.S=Z;this.cU={};this.W(Z,"onMdxReceiversChange",this.D);this.W(Z,"presentingplayerstatechange",this.D);this.D()},Ild=function(Z){Z.L=new AE(Z,Z.N,"rpc",Z.Yl); Z.V===null&&(Z.L.mJ=Z.In);Z.L.J5=0;var I=Z.o4.clone();g.G_(I,"RID","rpc");g.G_(I,"SID",Z.N);g.G_(I,"AID",Z.Tm);g.G_(I,"CI",Z.sZ?"0":"1");!Z.sZ&&Z.Tv&&g.G_(I,"TO",Z.Tv);g.G_(I,"TYPE","xmlhttp");SE(Z,I);Z.V&&Z.In&&g.DA(I,Z.V,Z.In);Z.J5&&Z.L.setTimeout(Z.J5);var d=Z.L;Z=Z.eK;d.Tm=1;d.X=W0(I.clone());d.In=null;d.fS=!0;hhL(d,Z)},R0=function(Z){this.scheme="https"; this.port=this.domain="";this.L="/api/lounge";this.D=!0;Z=Z||document.location.href;var I=Number(g.gB(Z)[4]||null)||"";I&&(this.port=":"+I);this.domain=g.LM(Z)||"";Z=g.Vs();Z.search("MSIE")>=0&&(Z=Z.match(/MSIE ([\d.]+)/)[1],g.XL(Z,"10.0")<0&&(this.D=!1))},ox0=function(Z){dwi.call(this); this.status=1;this.errorCode=Z},YRV=function(){Kid(); return Na?!!Na.get("yt-remote-use-staging-server"):!1},fm=function(){return!!g.gZ("yt.mdx.remote.cloudview.apiReady_")},e3u=function(Z,I,d){gTv(Z.L,I,d)},j53=function(Z,I){g.Kc(Z,I)||Z.push(I)},iau=function(Z,I,d){for(var Y=0;Y0&&(this.Tv=Z.Kz);this.UZ=void 0;this.M8=0;this.d4=!1;this.SK=this.Bj=null},nm=function(){return!!g.T2("yt-remote-cast-installed")},uw=function(Z){pe.call(this,"LocalScreenService"); this.D=Z;this.L=NaN;lw(this);this.info("Initializing with "+met(this.screens))},wXM=function(){nm()?Pe()?fm()?(Gt("Requesting cast selector."),Pe().requestSession()):(Gt("Wait for cast API to be ready to request the session."),Bvi.push(g.iV("yt-remote-cast2-api-ready",wXM))):Q6("requestCastSelector: Cast is not initialized."):Q6("requestCastSelector: Cast API is not installed!")},t1t=function(Z){Z.L=0; Z.Vi=-1;if(Z.tB)if(Z.Z.length==0&&Z.D.length==0)Z.tB.nV();else{var I=g.FZ(Z.Z),d=g.FZ(Z.D);Z.Z.length=0;Z.D.length=0;Z.tB.nV(I,d)}},dwi=function(){g.jD.call(this,"o")},LYW=function(Z,I,d,Y){g.jD.call(this,"timingevent",Z); this.size=I;this.rtt=d;this.retries=Y},Yg=function(Z,I,d,Y){Y=Y===void 0?!1:Y; g.dx.call(this);var T=this;this.j=NaN;this.Bj=!1;this.In=this.X=this.kS=this.Ns=NaN;this.LS=[];this.B=this.V=this.N=this.L=this.D=null;this.mJ=Z;this.j7=Y;this.LS.push(g.vP(window,"beforeunload",function(){T.dj(2)})); this.Z=[];this.L=new zt;this.Tm=I.id;this.fS=I.idType;this.D=VWp(this.mJ,d,this.BP,this.fS=="shortLived",this.Tm);this.D.listen("channelOpened",function(){Nv$(T)}); this.D.listen("channelClosed",function(){we("Channel closed");isNaN(T.j)?fe(!0):fe();T.dispose()}); this.D.listen("channelError",function(f){fe();isNaN(T.J2())?(f==1&&T.fS=="shortLived"&&T.publish("browserChannelAuthError",f),we("Channel error: "+f+" without reconnection"),T.dispose()):(T.Bj=!0,we("Channel error: "+f+" with reconnection in "+T.J2()+" ms"),Up(T,2))}); this.D.listen("channelMessage",function(f){Fzu(T,f)}); this.D.Cr(I.token);this.subscribe("remoteQueueChange",function(){var f=T.L.videoId;g.Mj()&&g.AU("yt-remote-session-video-id",f)})},fTi=function(Z,I){this.D=Z; this.L=I},kg=function(Z,I,d,Y,T){try{T&&(T.onload=null,T.onerror=null,T.onabort=null,T.ontimeout=null),Y(d)}catch(f){}},We=function(Z){Z.L&&(A8t(Z),Z.L.cancel(),Z.L=null)},JE=function(Z){return Z?'{name:"'+Z.name+'",id:'+Z.id.substr(0,6)+"..,token:"+((Z.token?".."+Z.token.slice(-6):"-")+",uuid:"+(Z.uuid?".."+Z.uuid.slice(-6):"-")+",idType:"+Z.idType+",secret:")+((Z.secret?".."+Z.secret.slice(-6):"-")+"}"):"null"},s5t=function(Z){g.NI.call(this,Z); this.uP={key:dep(),name:"This computer"};this.Zy=null;this.subscriptions=[];this.tC=this.yy=null;this.cU=[this.uP];this.wF=this.uP;this.JZ=new g.ns(64);this.lD=0;this.Y$=-1;this.oO=!1;this.OI=this.Fh=this.VS=null;if(!g.$D(this.player.C())&&!g.vl(this.player.C())){Z=this.player;var I=g.k6(Z);I&&(I=I.sI())&&(I=new JZ(Z,I),g.z(this,I));I=new XM(Z);g.z(this,I);g.iS(Z,I.element,4);this.VS=new z0;g.z(this,this.VS);g.iS(Z,this.VS.element,4);this.oO=!!tZ()}},DI=function(Z,I){Z.L=I; Z.publish("sessionScreen",Z.L)},hPd=function(Z){Z.Um=0; Z.SK=[];if(Z.B){var I=nx3(Z.D);if(I.length!=0||Z.Z.length!=0)g.x4(Z.SK,I),g.x4(Z.SK,Z.Z),Z.D.Z.length=0,g.FZ(Z.Z),Z.Z.length=0;Z.B.eB()}},Hzg=function(Z,I){var d=(Date.now()-mwu)/1E3; d.toFixed&&(d=d.toFixed(3));var Y=[];Y.push("[",d+"s","] ");Y.push("[","yt.mdx.remote","] ");Y.push(Z+": "+I,"\n");return Y.join("")},Oai=function(Z){g.Cl(Z.In); Z.In=g.lo(function(){Z.dj(1)},864E5)},lK=function(Z){this.L=Z},qRu=function(Z){Z.screens=Z.D.uW(); var I=Z.B,d={},Y;for(Y in I)d[I[Y]]=Y;I=Z.screens.length;for(Y=0;Y=0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?UwL()>=60&&nOM():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?r3E():UwL()>=89?yR$():(F3L(),hE(vxp.map(llu))))):Gt("Cannot initialize because not running Chrome")},S_=function(Z){Z.H1!=null&&(g.iN.clearTimeout(Z.H1),Z.H1=null)},Ce=function(Z,I){return g.Xe(Z,function(d){return $g(d, I)})},qa=function(Z,I){g.p.call(this); this.L=new g.uX(this.pgn,0,this);g.z(this,this.L);this.ke=5E3;this.D=0;if(typeof Z==="function")I&&(Z=(0,g.u5)(Z,I));else if(Z&&typeof Z.handleEvent==="function")Z=(0,g.u5)(Z.handleEvent,Z);else throw Error("Invalid listener argument");this.Z=Z},r3E=function(){var Z=P8V(); Z&&Z(!1,"No cast extension found")},GnV=function(Z){var I=Z.L.media,d=Z.L.customData; if(I&&d){var Y=pm(Z);I.contentId!=Y.videoId&&xg("Cast changing video to: "+I.contentId);Y.videoId=I.contentId;Y.playerState=d.playerState;v0(Y,Z.L.getEstimatedTime());ml(Z,Y)}else xg("No cast media video. Ignoring state update.")},izg=function(){return g.gZ("yt.mdx.remote.connectData_")},zPt=function(Z,I){return Z===I},Hbg=function(Z){g.Cl(Z.kS); Z.kS=NaN},Lm=function(Z){Z.publish("handlerOpened"); Z.J5.oE("BROWSER_CHANNEL")},XX0=function(Z){var I,d; g.h(function(Y){if(Y.L==1)return g.tp(Y,2),g.m(Y,knu(Z),2);g.ON(Y);I=Z.Z;Z.Z=[];d=I.length;iau(Z,I,d);Lm(Z);return g.Bh(Y,0)})},$wd=function(Z,I){Z.compatibleSenderThemes.clear(); g.zG(I.split(","),g.T9(C8L,tWV)).forEach(function(d){Z.compatibleSenderThemes.add(d)})},iK=function(){if(pXu)return pXu; var Z=g.T2("yt-remote-device-id");Z||(Z=dep(),g.AU("yt-remote-device-id",Z,31536E3));for(var I=T0(),d=1,Y=Z;g.Kc(I,Y);)d++,Y=Z+"#"+d;return pXu=Y},CBg=function(Z,I){var d=Z.Yc,Y=I.indexOf("\n",d); if(Y==-1)return xwW;d=Number(I.substring(d,Y));if(isNaN(d))return Kzv;Y+=1;if(Y+d>I.length)return xwW;I=I.slice(Y,Y+d);Z.Yc=Y+d;return I},Exg=function(Z){Z=g.zG(Z.Z,function(I){return I.idType!="shortLived"}); g.AU("yt-remote-automatic-screen-cache",g.Ft(Z,HRu))},QxM=function(){var Z=T0(),I=iK(); g.Mj()&&g.IA(Z,I);Z=bag(Z);if(Z.length==0)try{g.$T("remote_sid")}catch(d){}else try{g.bl("remote_sid",Z.join(","),-1)}catch(d){}},Hap=function(Z,I){if(Ma(Z)&&!Z.B){var d=null; I&&(d={style:Z.S.getSubtitlesUserSettings()},Object.assign(d,I));Z.yy.xC(Z.S.getVideoData(1).videoId,d);Z.N=pm(Z.yy).trackData}},MWV=function(Z,I){a:if(oOp(I)!=oOp(Z.L))var d=!1; else{d=g.uS(I);for(var Y=d.length,T=0;T=Z.length)return g.QI;if(I in Z)return g.G6(Z[I++]);I++}}; return d}throw Error("Not implemented");},T1E=function(Z,I){var d=5E3+Math.floor(Math.random()*1E4); Z.isActive()||(d*=2);return d*I},Cm=function(){fm()?Pe().stopSession():Q6("stopSession called before API ready."); var Z=iw();Z&&(Z.disconnect(1),fJt(null))},JR$=function(Z){Gt("setCastInstalled_ "+Z); g.AU("yt-remote-cast-installed",Z)},PsM=function(Z){irt(Z,"getLoungeToken"); g.Cl(Z.B);Z.B=g.lo(function(){fAi(Z,null)},3E4)},Tt=function(Z,I){g.g4[Z]=!0; var d=g.l8();d&&d.publish.apply(d,arguments);g.g4[Z]=!1},oTd=function(Z){var I={}; I.pairingCode=Z.Bj;I.theme=Z.Tm;YRV()&&(I.env_useStageMdx=1);return g.xM(I)},EX=function(Z,I){var d=Z.get(I.id); d?(d.uuid=I.uuid,I=d):((d=Ce(Z.Z,I.uuid))?(d.id=I.id,d.token=I.token,I=d):Z.Z.push(I),Z.V||Exg(Z));QOp(Z);Z.B[I.uuid]=I.id;g.AU("yt-remote-device-id-map",Z.B,31536E3);return I},Orp=function(Z,I,d){Z.JZ=d; Z.player.publish("presentingplayerstatechange",new g.cQ(d,I))},aAV=function(Z){g.jD.call(this,"serverreachability",Z)},Fzu=function(Z,I){I=I.message; I.params?we("Received: action="+I.action+", params="+g.Q9(I.params)):we("Received: action="+I.action+" {}");switch(I.action){case "loungeStatus":I=Qr(I.params.devices);Z.Z=g.Ft(I,function(Y){return new He(Y)}); I=!!g.Xe(Z.Z,function(Y){return Y.type=="LOUNGE_SCREEN"}); alp(Z,I);I=Z.aG("mlm");Z.publish("multiStateLoopEnabled",I);break;case "loungeScreenDisconnected":g.Ug(Z.Z,function(Y){return Y.type=="LOUNGE_SCREEN"}); alp(Z,!1);break;case "remoteConnected":var d=new He(Qr(I.params.device));g.Xe(Z.Z,function(Y){return Y.equals(d)})||j53(Z.Z,d); break;case "remoteDisconnected":d=new He(Qr(I.params.device));g.Ug(Z.Z,function(Y){return Y.equals(d)}); break;case "gracefulDisconnect":break;case "playlistModified":W8u(Z,I,"QUEUE_MODIFIED");break;case "nowPlaying":e9i(Z,I);break;case "onStateChange":c8g(Z,I);break;case "onAdStateChange":lTd(Z,I);break;case "onVolumeChanged":Q7W(Z,I);break;case "onSubtitlesTrackChanged":oct(Z,I);break;case "nowAutoplaying":Bwv(Z,I);break;case "autoplayDismissed":Z.publish("autoplayDismissed");break;case "autoplayUpNext":B1W(Z,I);break;case "onAutoplayModeChanged":KYp(Z,I);break;case "onHasPreviousNextChanged":pG$(Z, I);break;case "requestAssistedSignIn":Z.publish("assistedSignInRequested",I.params.authCode);break;case "onLoopModeChanged":Z.publish("loopModeChange",I.params.loopMode);break;default:we("Unrecognized action: "+I.action)}},ce=function(Z,I){return Object.prototype.hasOwnProperty.call(Z,I)},N1L=function(Z,I){if(Z.L==1){if(!I){Z.y$=Math.floor(Math.random()*1E5); I=Z.y$++;var d=new a0(Z,"",I);d.W1=Z.UF;var Y=wTp(Z),T=Z.O1.clone();g.G_(T,"RID",I);g.G_(T,"CVER","1");G0(Z,T);Fid(d,T,Y);Z.VJ=d;Z.L=2}}else Z.L==3&&(I?VS0(Z,I):Z.D.length==0||Z.VJ||VS0(Z))},M1L=function(Z,I){g.Cl(Z.V); Z.V=0;I==0?PsM(Z):Z.V=g.lo(function(){PsM(Z)},I)},FM=function(Z,I){Z.D&&(Z.D.removeUpdateListener(Z.In),Z.D.removeMediaListener(Z.V),Z.Dv(null)); Z.D=I;Z.D&&(xg("Setting cast session: "+Z.D.sessionId),Z.D.addUpdateListener(Z.In),Z.D.addMediaListener(Z.V),Z.D.media.length&&Z.Dv(Z.D.media[0]))},we=function(Z){Fb("conn",Z)},xg=function(Z){Fb("CP",Z)},F8t=function(Z,I){return new g.v7$(Z,I)},sOM=function(Z,I){Z.experiments.clear(); I.split(",").forEach(function(d){Z.experiments.add(d)})},qWt=function(Z,I){var d=Z.Tx+Math.floor(Math.random()*Z.aE); Z.isActive()||(d*=2);return d*I},WiE=function(){},ncd=function(Z,I){Z.L==I&&Z.publish("yt-remote-cast2-session-failed")},C8L=function(Z,I){return g.Sf(Z,I)},vOW=function(Z,I){var d=Z.get(I.uuid)||Z.get(I.id); if(d)return Z=d.name,d.id=I.id||d.id,d.name=I.name,d.token=I.token,d.uuid=I.uuid||d.uuid,d.name!=Z;Z.screens.push(I);return!0},ge=function(Z){Z.Fh&&(Z.player.removeEventListener("presentingplayerstatechange",Z.Fh),Z.Fh=null)},oLv=function(Z,I,d){if(g.a8(Z))g.KM(Z,I,d); else for(Z=jOg(Z);;){var Y=Z.next();if(Y.done)break;I.call(d,Y.value,void 0,Z)}},uoE=function(Z){Z.Dx=Date.now()+Z.D; h3d(Z,Z.D)},c0=function(Z,I,d){d?we("Sending: action="+I+", params="+g.Q9(d)):we("Sending: action="+I); Z.D.sendMessage(I,d)},CIE=function(){var Z=jE(); this.L=Z;Z.gP("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")},mMg=function(Z){return g.op(Z.mJ().then(function(I){h9W(Z,I)}).LA(function(){}),function(){Z.Bj=null})},qfg=function(Z,I,d){var Y=pm(Z); v0(Y,d);Y.playerState!=-1E3&&(Y.playerState=I);ml(Z,Y)},DeL=function(Z,I){return Z.D?Z.D==I:Z.L?Z.L.has(I):!1},Nv$=function(Z){we("Channel opened"); Z.Bj&&(Z.Bj=!1,Q5u(Z),Z.Ns=g.lo(function(){we("Timing out waiting for a screen.");Z.dj(1)},15E3))},Sfd=function(Z){if(Z.Um==0)return Z.SK; var I=[];g.x4(I,nx3(Z.D));g.x4(I,Z.Z);return I},aTW=function(){},kSd=function(Z,I,d){var Y=new Image; Y.onload=function(){try{qu(Y),d(!0)}catch(T){}}; Y.onerror=function(){try{qu(Y),d(!1)}catch(T){}}; Y.onabort=function(){try{qu(Y),d(!1)}catch(T){}}; Y.ontimeout=function(){try{qu(Y),d(!1)}catch(T){}}; g.iN.setTimeout(function(){if(Y.ontimeout)Y.ontimeout()},I); Y.src=Z},M4g=function(Z,I,d){var Y=document.createElement("script"); Y.onerror=I;d&&(Y.onload=d);g.Om(Y,g.N5(Z));(document.head||document.documentElement).appendChild(Y)},FYv=function(Z,I,d){d=Math.min(Z.Z.length,d); var Y=Z.B?(0,g.u5)(Z.B.yU,Z.B,Z):null;a:{for(var T=Z.Z,f=-1;;){var P=["count="+d];f==-1?d>0?(f=T[0].L,P.push("ofs="+f)):f=0:P.push("ofs="+f);for(var O=!0,a=0;a1){if(d%2)throw Error("Uneven number of arguments");for(var Y=0;YI.length)return K8V;I=I.slice(Y,Y+d);Z.V=Y+d;return I},brM=function(Z,I){if(I){var d=Z.S.getOption("captions","tracklist",{S4:1}); d&&d.length?(Z.S.setOption("captions","track",I),Z.B=!1):(Z.S.loadModule("captions"),Z.B=!0)}else Z.S.setOption("captions","track",{})},gTv=function(Z,I,d){var Y=Vr(Z.B,"/pairing/get_screen_availability"); Z.B.sendRequest("POST",Y,{lounge_token:I.token},(0,g.u5)(function(T){T=T.screens||[];for(var f=T.length,P=0;P6&&I>0){var Y=Z.D[0].L;d.push("ofs="+Y)}else Y=0;for(var T={},f=0;f0?d=Object.assign({},d,I):delete d.Authorization;Z.L.UF=d}},IJt=function(){g.AU("yt-remote-lounge-token-expiration",!0,86400)},QcL=function(Z,I,d,Y,T){g.dx.call(this); this.Z=Z;this.V=I;this.N=d;this.j=Y;this.B=T;this.D=0;this.L=null;this.C_=NaN},gxi=function(Z){Z=g.uS(g.yi(Z.L,function(I){return I})); g.ik(Z);Z.length?g.AU("yt-remote-online-screen-ids",Z.join(","),60):g.m4("yt-remote-online-screen-ids")},irt=function(Z,I){Z.info("sendYoutubeMessage_: "+I+" "+g.Q9()); var d={};d.type=I;Z.Z?Z.Z.sendMessage("urn:x-cast:com.google.youtube.mdx",d,function(){},(0,g.u5)(function(){H0(this,"Failed to send message: "+I+".")},Z)):H0(Z,"Sending yt message without session: "+g.Q9(d))},L8W=function(Z){Z.VJ||Z.NN||(Z.NN=Be((0,g.u5)(Z.IZ,Z),0),Z.MD=0)},OxL=function(Z){if(Z.screens.length){var I=g.Ft(Z.screens,function(Y){return Y.id}),d=Vr(Z.D,"/pairing/get_lounge_token_batch"); Z.D.sendRequest("POST",d,{screen_ids:I.join(",")},(0,g.u5)(Z.zw,Z),(0,g.u5)(Z.SX,Z))}},fj=function(Z,I){dQE(g.Ft(Z.screens,HRu)); I&&IJt()},s7u=function(){var Z=UwL(),I=[]; if(Z>1){var d=Z-1;I.push("//www.gstatic.com/eureka/clank/"+Z+"/cast_sender.js");I.push("//www.gstatic.com/eureka/clank/"+d+"/cast_sender.js")}return I},ecd=function(Z,I){Kid(); if(!Na||!Na.get("yt-remote-disable-remote-module-for-dev")){I=g.rh("MDX_CONFIG")||I;a9u();QxM();j_||(j_=new R0(I?I.loungeApiHost:void 0),YRV()&&(j_.L="/api/loungedev"));iO||(iO=g.gZ("yt.mdx.remote.deferredProxies_")||[],g.zb("yt.mdx.remote.deferredProxies_",iO));xgE();var d=Ep();if(!d){var Y=new jo(j_,I?I.disableAutomaticScreenCache||!1:!1);g.zb("yt.mdx.remote.screenService_",Y);d=Ep();var T={};I&&(T={appId:I.appId,disableDial:I.disableDial,theme:I.theme,loadCastApiSetupScript:I.loadCastApiSetupScript, disableCastApi:I.disableCastApi,enableDialLoungeToken:I.enableDialLoungeToken,enableCastLoungeToken:I.enableCastLoungeToken,forceMirroring:I.forceMirroring});g.zb("yt.mdx.remote.enableConnectWithInitialState_",I?I.enableConnectWithInitialState||!1:!1);uEV(Z,Y,function(f){f?Zq()&&P$(Zq(),"YouTube TV"):Y.subscribe("onlineScreenChange",function(){Tt("yt-remote-receiver-availability-change")})},T)}I&&!g.gZ("yt.mdx.remote.initialized_")&&(g.zb("yt.mdx.remote.initialized_",!0),hZ("Initializing: "+g.Q9(I)), QP.push(g.iV("yt-remote-cast2-api-ready",function(){Tt("yt-remote-api-ready")})),QP.push(g.iV("yt-remote-cast2-availability-change",function(){Tt("yt-remote-receiver-availability-change")})),QP.push(g.iV("yt-remote-cast2-receiver-selected",function(){dW(null); Tt("yt-remote-auto-connect","cast-selector-receiver")})),QP.push(g.iV("yt-remote-cast2-receiver-resumed",function(){Tt("yt-remote-receiver-resumed","cast-selector-receiver")})),QP.push(g.iV("yt-remote-cast2-session-change",Wvu)),QP.push(g.iV("yt-remote-connection-change",function(f){f?P$(Zq(),"YouTube TV"):tZ()||(P$(null,null),Hrd())})),QP.push(g.iV("yt-remote-cast2-session-failed",function(){Tt("yt-remote-connection-failed")})),Z=RhM(),I.isAuto&&(Z.id+="#dial"),T=I.capabilities||[],T.length>0&&(Z.capabilities= T),Z.name=I.device,Z.app=I.app,(I=I.theme)&&(Z.theme=I),hZ(" -- with channel params: "+g.Q9(Z)),Z?(g.AU("yt-remote-session-app",Z.app),g.AU("yt-remote-session-name",Z.name)):(g.m4("yt-remote-session-app"),g.m4("yt-remote-session-name")),g.zb("yt.mdx.remote.channelParams_",Z),d.start(),Zq()||csu())}},OG=function(Z,I,d){var Y=Z.videoId; Z.videoId=I;Z.index=d;I!=Y&&Bjt(Z)},oo=function(Z){var I; return!!(Z.config_.enableDialLoungeToken&&((I=Z.Z)==null?0:I.getDialAppInfo))},JSu=function(){return nm()?Pe()?Pe().getCastSession():(Q6("getCastSelector: Cast is not initialized."),null):(Q6("getCastSelector: Cast API is not installed!"),null)},dMi=function(){var Z=iw(); return!!Z&&Z.getProxyState()!=3},Bjt=function(Z){Z.audioTrackId=null; Z.trackData=null;Z.playerState=-1;Z.xb=!1;Z.wf=!1;Z.j=0;Z.B=g.QY();Z.D=0;Z.V=0;Z.Z=0;Z.X=0;Z.L=NaN;Z.N=!1},wqp=function(Z){var I=Nu(Z.L,Z.sT,"/mail/images/cleardot.gif"); W0(I);XGt(I.toString(),5E3,(0,g.u5)(Z.I1,Z),3,2E3);Z.iV(1)},YEd=function(Z,I){if(Ma(Z)){Z.yy.unsubscribe("remotePlayerChange",Z.Ko,Z); var d=Math.round(I.volume);I=!!I.muted;var Y=pm(Z.yy);if(d!==Y.volume||I!==Y.muted)Z.yy.setVolume(d,I),Z.In.start();Z.yy.subscribe("remotePlayerChange",Z.Ko,Z)}},He=function(Z){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 dX;this.model=this.brand="";this.year=0;this.chipset=this.osVersion=this.os="";this.mdxDialServerType="MDX_DIAL_SERVER_TYPE_UNKNOWN";Z&&(this.id=Z.id||Z.name,this.name=Z.name,this.clientName=Z.clientName?Z.clientName.toUpperCase():"UNKNOWN_INTERFACE", this.app=Z.app,this.type=Z.type||"REMOTE_CONTROL",this.username=Z.user||"",this.avatar=Z.userAvatarUri||"",this.obfuscatedGaiaId=Z.obfuscatedGaiaId||"",this.ownerObfuscatedGaiaId=Z.ownerObfuscatedGaiaId||"",this.theme=Z.theme||"u",bRV(this,Z.capabilities||""),$wd(this,Z.compatibleSenderThemes||""),sOM(this,Z.experiments||""),this.brand=Z.brand||"",this.model=Z.model||"",this.year=Z.year||0,this.os=Z.os||"",this.osVersion=Z.osVersion||"",this.chipset=Z.chipset||"",this.mdxDialServerType=Z.mdxDialServerType|| "MDX_DIAL_SERVER_TYPE_UNKNOWN",Z=Z.deviceInfo)&&(Z=JSON.parse(Z),this.brand=Z.brand||"",this.model=Z.model||"",this.year=Z.year||0,this.os=Z.os||"",this.osVersion=Z.osVersion||"",this.chipset=Z.chipset||"",this.clientName=Z.clientName?Z.clientName.toUpperCase():"UNKNOWN_INTERFACE",this.mdxDialServerType=Z.mdxDialServerType||"MDX_DIAL_SERVER_TYPE_UNKNOWN")},gW=function(Z,I,d){g.p.call(this); this.j=d!=null?(0,g.u5)(Z,d):Z;this.ke=I;this.B=(0,g.u5)(this.Ck,this);this.L=!1;this.D=0;this.Z=this.C_=null;this.N=[]},W$=function(Z,I,d){return(0,g.u5)(function(Y){this.BE("Failed to "+I+" with cast v2 channel. Error code: "+Y.code); Y.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.BE("Retrying "+I+" using MDx browser channel."),ak(this,I,d))},Z)},cRL=function(Z){Fb("OnlineScreenService",Z)},eo=function(Z,I,d,Y){AZ.call(this,Z,I,"DialSession"); this.config_=Y;this.Z=this.X=null;this.Bj="";this.Tm=d;this.mJ=null;this.LS=function(){}; this.In=NaN;this.j7=(0,g.u5)(this.NT,this);this.B=function(){}; this.V=this.j=0;this.kS=!1;this.Ns="unknown"},e9i=function(Z,I){I.params=I.params||{}; W8u(Z,I,"NOW_PLAYING_MAY_CHANGE");c8g(Z,I);Z.publish("autoplayDismissed")},I9W=function(Z){Z.j7&&!Z.B&&h9W(Z,Z.j7())},GqM=function(Z,I){g.Cl(Z.LS); Z.LS=0;I?Z.config_.enableCastLoungeToken&&I.loungeToken?I.deviceId?Z.L&&Z.L.uuid==I.deviceId||(I.loungeTokenRefreshIntervalMs?rS0(Z,{name:Z.D.friendlyName,screenId:I.screenId,loungeToken:I.loungeToken,dialId:I.deviceId,screenIdType:"shortLived"},I.loungeTokenRefreshIntervalMs):(g.eW(Error("No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: "+JSON.stringify(I)+".")),kqM(Z,I.screenId))):(g.eW(Error("No device id presents in mdxSessionStatusData: "+JSON.stringify(I)+".")),kqM(Z,I.screenId)): kqM(Z,I.screenId):Z.eI(Error("Waiting for session status timed out."))},rW=function(Z,I){var d=Z.S.getPlaylist(); if(d==null?0:d.listId){var Y=d.index;var T=d.listId.toString()}d=Z.S.getVideoData(1);Z.yy.playVideo(d.videoId,I,Y,T,d.playerParams,d.kS,Tw3(d));Z.I4(new g.ns(1))},twM=function(Z){return Z.D?!0:Z.L?Z.L.size>=Z.N:!1},VId=function(Z,I){return I?g.Xe(Z.Z,function(d){return $g(I,d.label)},Z):null},Nji=function(Z){if(Z.kH||Z.TX||Z.gj>=3)return!1; Z.V++;Z.TX=Be((0,g.u5)(Z.tY,Z),T1E(Z,Z.gj));Z.gj++;return!0},Fvp=function(){g.jD.call(this,"p")},VWp=function(Z,I,d,Y,T){function f(){return new EO0(Vr(Z,"/bc"),I,!1,d,Y)} d=d===void 0?function(){return""}:d; return g.x9("enable_mdx_web_channel_desktop")?new vcg(function(){return new VwM(Vr(Z,"/wc"),I,d)}):new Yxu(f,T)},Dwt=function(Z,I){JR$(!0); ARM(!1);PIv(Z,function(d){d?(scd(!0),g.u8("yt-remote-cast2-api-ready")):(Q6("Failed to initialize cast API."),JR$(!1),g.m4("yt-remote-cast-available"),g.m4("yt-remote-cast-receiver"),RPg());I(d)})},yR$=function(){F3L(); var Z=s7u();Z.push.apply(Z,g.c(vxp.map(llu)));Z.push("//www.gstatic.com/eureka/clank/cast_sender.js");hE(Z)},ARM=function(Z){g.zb("yt.mdx.remote.cloudview.initializing_",Z)},R3L=function(){var Z=nbp(),I=I0(); I||(I=tZ());return g.Xe(Z,function(d){return I&&$g(I,d.key)?!0:!1})},Ep=function(){if(!hcL){var Z=g.gZ("yt.mdx.remote.screenService_"); hcL=Z?new CTV(Z):null}return hcL},Gt=function(Z){Fb("cloudview",Z)},z3i=function(Z){var I={}; I.index=Z.index;I.listId=Z.listId;I.videoId=Z.videoId;I.playerState=Z.playerState;I.volume=Z.volume;I.muted=Z.muted;I.audioTrackId=Z.audioTrackId;I.trackData=g.jh(Z.trackData);I.hasPrevious=Z.xb;I.hasNext=Z.wf;I.playerTime=Z.j;I.playerTimeAt=Z.B;I.seekableStart=Z.D;I.seekableEnd=Z.V;I.duration=Z.Z;I.loadedTime=Z.X;I.liveIngestionTime=Z.L;return I},B$=function(Z){xQV(Z); g.Th(Z.iZ);Z.iZ=null;Z.B.stop();Z.Z.removeAll();if(Z.aL){var I=Z.aL;Z.aL=null;I.abort();I.dispose()}Z.X0&&(Z.X0=null)},ibt=function(Z){return Sfd(Z.L).map(function(I){var d=Z.D; I=I.map;"__data__"in I?(I=I.__data__,d=d.N?eh3(I):I):d=I;return d})},jxg=function(Z){oo(Z)&&Z.Z.getDialAppInfo(function(I){Z.info("getDialAppInfo dialLaunchData: "+JSON.stringify(I)); I=I.extraData||{};var d=null;if(I.loungeToken){var Y;((Y=Z.L)==null?void 0:Y.token)==I.loungeToken&&(d="staleLoungeToken")}else d="missingLoungeToken";d?(Z.Ns=d,Yu(Z,3E4)):(Z.kS=!1,Z.Ns="unknown",tSW(Z,I.loungeToken),Yu(Z,I.loungeTokenRefreshIntervalMs))},function(I){Z.info("getDialAppInfo error: "+I); Z.Ns="noLoungeTokenResponse";Yu(Z,3E4)})},mn0=function(Z){var I=Z.D.MG(),d=Z.L&&Z.L.D; Z=g.Ft(I,function(Y){d&&$g(Y,d.label)&&(d=null);var T=Y.uuid?Y.uuid:Y.id,f=VId(this,Y);f?(f.label=T,f.friendlyName=Y.name):(f=new chrome.cast.Receiver(T,Y.name),f.receiverType=chrome.cast.ReceiverType.CUSTOM);return f},Z); d&&(d.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(d=new chrome.cast.Receiver(d.label,d.friendlyName),d.receiverType=chrome.cast.ReceiverType.CUSTOM),Z.push(d));return Z},I0=function(){var Z=Zq(); if(!Z)return null;var I=Ep().uW();return Ce(I,Z)},wX=function(Z){return Z.V||!!Z.Z.length||!!Z.L},qx0=function(Z){g.Cl(Z.X); Z.X=0;g.Cl(Z.j);Z.j=0;g.Cl(Z.LS);Z.LS=0;g.Cl(Z.B);Z.B=0;g.Cl(Z.V);Z.V=0},J8d=function(Z,I){Z.D&&Z.D==I?Z.D=null:Z.L&&Z.L.has(I)&&Z.L.delete(I)},SRi=function(Z,I){var d=!1; Pe()||(Z=new Z7(Z,I),Z.subscribe("yt-remote-cast2-availability-change",function(Y){g.AU("yt-remote-cast-available",Y);Tt("yt-remote-cast2-availability-change",Y)}),Z.subscribe("yt-remote-cast2-receiver-selected",function(Y){Gt("onReceiverSelected: "+Y.friendlyName); g.AU("yt-remote-cast-receiver",Y);Tt("yt-remote-cast2-receiver-selected",Y)}),Z.subscribe("yt-remote-cast2-receiver-resumed",function(Y){Gt("onReceiverResumed: "+Y.friendlyName); g.AU("yt-remote-cast-receiver",Y);Tt("yt-remote-cast2-receiver-resumed",Y)}),Z.subscribe("yt-remote-cast2-session-change",function(Y){Gt("onSessionChange: "+JE(Y)); Y||g.m4("yt-remote-cast-receiver");Tt("yt-remote-cast2-session-change",Y)}),g.zb("yt.mdx.remote.cloudview.instance_",Z),d=!0); Gt("cloudview.createSingleton_: "+d);return d},Sx3=function(Z){var I=Z.Ns(); I?Z.N["x-youtube-lounge-xsrf-token"]=I:delete Z.N["x-youtube-lounge-xsrf-token"]},AtM=function(Z){var I={}; g.KM(Z.j(),function(d){d.token?I[d.token]=d.id:this.BE("Requesting availability of screen w/o lounge token.")}); return I},llu=function(Z){return"chrome-extension://"+Z+"/cast_sender.js"},mG=function(Z){return Z.isPlaying()?(g.QY()-Z.B)/1E3:0},UwL=function(){var Z=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return Z?parseInt(Z[1],10):0},Hrd=function(){Gt("clearCurrentReceiver"); g.m4("yt-remote-cast-receiver")},a9u=function(){var Z=g.zo.lU(); Z&&aJV(Z,Z.Og.kx(!0))},Gmd=function(Z){g.KM(Z.j,function(I){this.N.unsubscribeByKey(I)},Z); Z.j.length=0},W8u=function(Z,I,d){var Y=I.params.videoId||I.params.video_id,T=parseInt(I.params.currentIndex,10); Z.L.listId=I.params.listId||Z.L.listId;OG(Z.L,Y,T);Z.publish("remoteQueueChange",d)},VS0=function(Z,I){if(I)if(Z.Xc>6){Z.D=Z.Z.concat(Z.D); Z.Z.length=0;var d=Z.y$-1;I=wTp(Z)}else d=I.V,I=I.oV;else d=Z.y$++,I=wTp(Z);var Y=Z.O1.clone();g.G_(Y,"SID",Z.N);g.G_(Y,"RID",d);g.G_(Y,"AID",Z.ND);G0(Z,Y);d=new a0(Z,Z.N,d,Z.MD+1);d.W1=Z.UF;d.setTimeout(1E4+Math.round(1E4*Math.random()));Z.VJ=d;Fid(d,Y,I)},eh3=function(Z){try{return g.iN.JSON.parse(Z)}catch(I){}Z=String(Z); if(/^\s*$/.test(Z)?0:/^[\],:{}\s\u2028\u2029]*$/.test(Z.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("("+Z+")")}catch(I){}throw Error("Invalid JSON string: "+Z);},P$=function(Z,I){fm()?Pe().setConnectedScreenStatus(Z,I):Q6("setConnectedScreenStatus called before ready.")},tSW=function(Z,I){Z.L&&(Z.L.token= I,EX(Z.N,Z.L)); Z.publish("sessionScreen",Z.L)},DnM=function(Z,I){try{var d=Z.Z; if(d.Um!=0&&(d.L==Z||DeL(d.D,Z)))if(!Z.w4&&DeL(d.D,Z)&&d.Um==3){try{var Y=d.vg.L.parse(I)}catch(A){Y=null}if(Array.isArray(Y)&&Y.length==3){var T=Y;if(T[0]==0)a:{if(!d.X){if(d.L)if(d.L.Ns+3E30&&(d.J5=1.5*a);Y=d;var W=Z.mC();if(W){var e=g.FR(W,"X-Client-Wire-Protocol");if(e){var B=Y.D;!B.L&&(g.QE(e,"spdy")||g.QE(e,"quic")||g.QE(e,"h2"))&&(B.N=B.B,B.L=new Set,B.D&&(sLL(B,B.D),B.D=null))}if(Y.fS){var w=g.FR(W,"X-HTTP-Session-Id");w&&(Y.kF=w,g.G_(Y.mJ,Y.fS,w))}}d.Um=3;d.B&&d.B.pY();d.EU&&(d.M8=Date.now()-Z.Ns);Y=d;var V=Z;Y.o4=xeu(Y,Y.w4?Y.eK:null,Y.Hk); if(V.w4){J8d(Y.D,V);var N=V,q=Y.J5;q&&N.setTimeout(q);N.LS&&(wCg(N),eE(N));Y.L=V}else Ued(Y);d.Z.length>0&&UX(d)}else f[0]!="stop"&&f[0]!="close"||yr(d,7);else d.Um==3&&(f[0]=="stop"||f[0]=="close"?f[0]=="stop"?yr(d,7):d.disconnect():f[0]!="noop"&&d.B&&d.B.b2(f),d.kS=0)}wW(4)}catch(A){}},MSM=function(Z,I){g.dx.call(this); this.j=I;I=(I=g.T2("yt-remote-online-screen-ids")||"")?I.split(","):[];for(var d={},Y=this.j(),T=Y.length,f=0;f=3)return!1; Z.Yl++;Z.X=Ro((0,g.u5)(Z.cn,Z),qWt(Z,Z.kS));Z.kS++;return!0},VP=function(Z,I,d){I!=Z.L&&(g.Th(Z.L),(Z.L=I)?(d?Z.publish("yt-remote-cast2-receiver-resumed",I.D):Z.publish("yt-remote-cast2-receiver-selected",I.D),I.subscribe("sessionScreen",(0,g.u5)(Z.YE,Z,I)),I.subscribe("sessionFailed",function(){return ncd(Z,I)}),I.L?Z.publish("yt-remote-cast2-session-change",I.L):d&&Z.L.cN(null)):Z.publish("yt-remote-cast2-session-change",null))},nbp=function(){var Z=Ep().SF.$_gos(); var I=I0();I&&iw()&&(yS0(Z,I)||Z.push(I));return jcg(Z)},Km=function(Z){Z.Z.bT()||Z.j7||vTE(Z.Z,Z)},RPg=function(){Gt("dispose"); var Z=Pe();Z&&Z.dispose();g.zb("yt.mdx.remote.cloudview.instance_",null);scd(!1);g.Z2(Bvi);Bvi.length=0},Q6=function(Z){Fb("cloudview",Z)},LvM=function(Z,I){var d=Z.screens.length; Z.screens=g.zG(Z.screens,function(Y){return!(Y||I?!Y!=!I?0:Y.id==I.id:1)}); return Z.screens.length2*this.size&&Tg(this),!0):!1}; g.n.get=function(Z,I){return ce(this.D,Z)?this.D[Z]:I}; g.n.set=function(Z,I){ce(this.D,Z)||(this.size+=1,this.L.push(Z),this.Yh++);this.D[Z]=I}; g.n.forEach=function(Z,I){for(var d=this.D$(),Y=0;Y=Y.L.length)return g.QI;var f=Y.L[I++];return g.G6(Z?f:Y.D[f])}; return T}; var EL0={Its:"atp",tOj:"ska",YY4:"que",x95:"mus",hEJ:"sus",J$7:"dsp",sUJ:"seq",LhS:"mic",Uk4:"dpa",KhS:"mlm",ves:"dsdtr",Y9J:"ntb",JEm:"vsp",B5J:"scn",OWS:"rpe",yKn:"dcn",bwn:"dcp",sa5:"pas",AK4:"drq",ayj:"opf",xO5:"els",nmm:"isg",Crm:"svq",nxs:"mvp",DA1:"ads",NeS:"stcp",eEs:"sads",pB5:"dloc",IbS:"dcw",Z65:"asw",kDs:"apw",g$J:"wrc",hLj:"pcw",wlr:"ipv",VdS:"ndt",oeS:"ctops"},tWV={Rfn:"u",jL5:"cl",XlZ:"k",D_Z:"i",Rtm:"cr",BPJ:"m",w3s:"g",Ys:"up"},Ast={Yz:"adPlaying",NE:"onAdStateChange"},DMu={Ops:"nowPlaying", Whj:"onStateChange",Yz:"adPlaying",NE:"onAdStateChange",ZZ:"nowPlayingShorts",KL:"onShortsStateChange"},Jsd={ZZ:"nowPlayingShorts",KL:"onShortsStateChange"};He.prototype.equals=function(Z){return Z?this.id==Z.id:!1}; var pXu="",Na=null;g.U(WiE,g.s9d);var P0,lAi=f8v("loadCastFramework")||f8v("loadCastApplicationFramework"),vxp=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.uN(gW,g.p);g.n=gW.prototype;g.n.JI=function(Z){this.N=arguments;this.L=!1;this.C_?this.Z=g.QY()+this.ke:this.C_=g.hy(this.B,this.ke)}; g.n.stop=function(){this.C_&&(g.iN.clearTimeout(this.C_),this.C_=null);this.Z=null;this.L=!1;this.N=[]}; g.n.pause=function(){++this.D}; g.n.resume=function(){this.D&&(--this.D,!this.D&&this.L&&(this.L=!1,this.j.apply(null,this.N)))}; g.n.g4=function(){this.stop();gW.AV.g4.call(this)}; g.n.Ck=function(){this.C_&&(g.iN.clearTimeout(this.C_),this.C_=null);this.Z?(this.C_=g.hy(this.B,this.Z-g.QY()),this.Z=null):this.D?this.L=!0:(this.L=!1,this.j.apply(null,this.N))};y6.prototype.stringify=function(Z){return g.iN.JSON.stringify(Z,void 0)}; y6.prototype.parse=function(Z){return g.iN.JSON.parse(Z,void 0)};g.uN(Fvp,g.jD);g.uN(dwi,g.jD);var K3t=null;g.uN(ysp,g.jD);g.uN(Ndg,g.jD);g.uN(LYW,g.jD);ok.prototype.debug=function(){}; ok.prototype.info=function(){}; ok.prototype.warning=function(){};var Csv={},K8V={};g.n=AE.prototype;g.n.setTimeout=function(Z){this.d4=Z}; g.n.e0=function(Z){Z=Z.target;var I=this.sZ;I&&g.b0(Z)==3?I.uZ():this.JJ(Z)}; g.n.JJ=function(Z){try{if(Z==this.L)a:{var I=g.b0(this.L),d=this.L.D,Y=this.L.getStatus();if(!(I<3)&&(I!=3||this.L&&(this.D.D||g.mC(this.L)||g.Pd(this.L)))){this.j7||I!=4||d==7||(d==8||Y<=0?wW(3):wW(2));wCg(this);var T=this.L.getStatus();this.UZ=T;var f=Zrg(this);if(this.j=T==200){if(this.I0&&!this.w4){b:{if(this.L){var P=g.FR(this.L,"X-HTTP-Initial-Response");if(P&&!g.Hw(P)){var O=P;break b}}O=null}if(Z=O)this.w4=!0,DnM(this,Z);else{this.j=!1;this.B=3;Ik(12);ao(this);Km(this);break a}}if(this.fS){Z= !0;for(var a;!this.j7&&this.V0&&!this.SK&&(this.SK=!0,this.Z.B_(this)):(ao(this),Km(this))}else DnM(this,f);I==4&&ao(this);this.j&&!this.j7&&(I==4?vTE(this.Z,this):(this.j=!1,eE(this)))}else g.vKB(this.L),T==400&&f.indexOf("Unknown SID")> 0?(this.B=3,Ik(12)):(this.B=0,Ik(13)),ao(this),Km(this)}}}catch(W){}finally{}}; g.n.cancel=function(){this.j7=!0;ao(this)}; g.n.cI=function(){this.LS=null;var Z=Date.now();Z-this.y5>=0?(this.Tm!=2&&(wW(3),Ik(17)),ao(this),this.B=2,Km(this)):Tjv(this,this.y5-Z)}; g.n.getLastError=function(){return this.B}; g.n.mC=function(){return this.L};uJu.prototype.cancel=function(){this.Z=nx3(this);if(this.D)this.D.cancel(),this.D=null;else if(this.L&&this.L.size!==0){for(var Z=g.t(this.L.values()),I=Z.next();!I.done;I=Z.next())I.value.cancel();this.L.clear()}};g.n=zwM.prototype;g.n.CY=8;g.n.Um=1;g.n.connect=function(Z,I,d,Y){Ik(0);this.Hk=Z;this.j7=I||{};d&&Y!==void 0&&(this.j7.OSID=d,this.j7.OAID=Y);this.sZ=this.sU;this.mJ=xeu(this,null,this.Hk);UX(this)}; g.n.disconnect=function(){W3E(this);if(this.Um==3){var Z=this.on++,I=this.mJ.clone();g.G_(I,"SID",this.N);g.G_(I,"RID",Z);g.G_(I,"TYPE","terminate");SE(this,I);Z=new AE(this,this.N,Z);Z.Tm=2;Z.X=W0(I.clone());I=!1;if(g.iN.navigator&&g.iN.navigator.sendBeacon)try{I=g.iN.navigator.sendBeacon(Z.X.toString(),"")}catch(d){}!I&&g.iN.Image&&((new Image).src=Z.X,I=!0);I||(Z.L=nLg(Z.Z,null),Z.L.send(Z.X));Z.Ns=Date.now();eE(Z)}hPd(this)}; g.n.bT=function(){return this.Um==0}; g.n.getState=function(){return this.Um}; g.n.Pn=function(Z){if(this.j)if(this.j=null,this.Um==1){if(!Z){this.on=Math.floor(Math.random()*1E5);Z=this.on++;var I=new AE(this,"",Z),d=this.In;this.I0&&(d?(d=g.zm(d),g.rt(d,this.I0)):d=this.I0);this.V!==null||this.y5||(I.mJ=d,d=null);var Y;if(this.b5)a:{for(var T=Y=0;T4096){Y=T;break a}if(Y===4096||T===this.Z.length-1){Y=T+1;break a}}Y= 1E3}else Y=1E3;Y=FYv(this,I,Y);T=this.mJ.clone();g.G_(T,"RID",Z);g.G_(T,"CVER",22);this.fS&&g.G_(T,"X-HTTP-Session-Id",this.fS);SE(this,T);d&&(this.y5?Y="headers="+g.fn(g.alL(d))+"&"+Y:this.V&&g.DA(T,this.V,d));sLL(this.D,I);this.wV&&g.G_(T,"TYPE","init");this.b5?(g.G_(T,"$req",Y),g.G_(T,"SID","null"),I.I0=!0,nTV(I,T,null)):nTV(I,T,Y);this.Um=2}}else this.Um==3&&(Z?hwV(this,Z):this.Z.length==0||twM(this.D)||hwV(this))}; g.n.cn=function(){this.X=null;Ild(this);if(this.EU&&!(this.d4||this.L==null||this.M8<=0)){var Z=4*this.M8;this.Bj=Ro((0,g.u5)(this.YU5,this),Z)}}; g.n.YU5=function(){this.Bj&&(this.Bj=null,this.sZ=!1,this.d4=!0,Ik(10),We(this),Ild(this))}; g.n.B_=function(Z){this.L==Z&&this.EU&&!this.d4&&(A8t(this),this.d4=!0,Ik(11))}; g.n.GI=function(){this.LS!=null&&(this.LS=null,We(this),y8V(this),Ik(19))}; g.n.MF5=function(Z){Z?Ik(2):Ik(1)}; g.n.isActive=function(){return!!this.B&&this.B.isActive(this)}; g.n=Zau.prototype;g.n.pY=function(){}; g.n.b2=function(){}; g.n.Gt=function(){}; g.n.eB=function(){}; g.n.isActive=function(){return!0}; g.n.yU=function(){};g.uN(uK,g.mv);uK.prototype.open=function(){this.L.B=this.Z;this.j&&(this.L.w4=!0);this.L.connect(this.B,this.D||void 0)}; uK.prototype.close=function(){this.L.disconnect()}; uK.prototype.send=function(Z){var I=this.L;if(typeof Z==="string"){var d={};d.__data__=Z;Z=d}else this.N&&(d={},d.__data__=g.Q9(Z),Z=d);I.Z.push(new Rcg(I.du++,Z));I.Um==3&&UX(I)}; uK.prototype.g4=function(){this.L.B=null;delete this.Z;this.L.disconnect();delete this.L;uK.AV.g4.call(this)}; g.uN(Jtd,Fvp);g.uN(ox0,dwi);g.uN(lK,Zau);lK.prototype.pY=function(){this.L.dispatchEvent("m")}; lK.prototype.b2=function(Z){this.L.dispatchEvent(new Jtd(Z))}; lK.prototype.Gt=function(Z){this.L.dispatchEvent(new ox0(Z))}; lK.prototype.eB=function(){this.L.dispatchEvent("n")}; fTi.prototype.commit=function(Z){this.L.UZ=Z};var Mu=new g.mv;g.U(kmd,g.jD);g.n=a0.prototype;g.n.W1=null;g.n.MN=!1;g.n.Zh=null;g.n.Dx=null;g.n.Pz=null;g.n.z7=null;g.n.J1=null;g.n.Sm=null;g.n.oV=null;g.n.aL=null;g.n.Yc=0;g.n.X0=null;g.n.Qd=null;g.n.Fc=null;g.n.cz=-1;g.n.w2=!0;g.n.CE=!1;g.n.LV=0;g.n.iZ=null;var Kzv={},xwW={};g.n=a0.prototype;g.n.setTimeout=function(Z){this.D=Z}; g.n.AI=function(Z){Z=Z.target;var I=this.iZ;I&&g.b0(Z)==3?I.uZ():this.AJ(Z)}; g.n.AJ=function(Z){try{if(Z==this.aL)a:{var I=g.b0(this.aL),d=this.aL.D,Y=this.aL.getStatus();if(g.Vd&&!g.xT("420+")){if(I<4)break a}else if(I<3||I==3&&!g.mC(this.aL))break a;this.CE||I!=4||d==7||(d==8||Y<=0?this.L.iV(3):this.L.iV(2));xQV(this);var T=this.aL.getStatus();this.cz=T;var f=g.mC(this.aL);if(this.MN=T==200){I==4&&B$(this);if(this.fS){for(Z=!0;!this.CE&&this.Yc0?(this.Fc=3,xu(13)):(this.Fc=0,xu(14)),B$(this),Ozg(this)}}catch(O){}finally{}}; g.n.cancel=function(){this.CE=!0;B$(this)}; g.n.pk=function(){this.Zh=null;var Z=Date.now();Z-this.Dx>=0?(this.z7!=2&&this.L.iV(3),B$(this),this.Fc=2,xu(18),Ozg(this)):h3d(this,this.Dx-Z)}; g.n.getLastError=function(){return this.Fc};g.n=z90.prototype;g.n.Zx=null;g.n.Bl=null;g.n.K7=!1;g.n.Mw=null;g.n.hh=null;g.n.OG=-1;g.n.jm=null;g.n.sT=null;g.n.connect=function(Z){this.Mw=Z;Z=Nu(this.L,null,this.Mw);xu(3);Date.now();var I=this.L.In;I!=null?(this.jm=I[0],(this.sT=I[1])?(this.hh=1,wqp(this)):(this.hh=2,SEV(this))):(B0(Z,"MODE","init"),this.Bl=new a0(this),this.Bl.W1=this.Zx,qEp(this.Bl,Z,!1,null,!0),this.hh=0)}; g.n.I1=function(Z){if(Z)this.hh=2,SEV(this);else{xu(4);var I=this.L;I.Vi=I.uK.OG;Ke(I,9)}Z&&this.iV(2)}; g.n.kD=function(Z){return this.L.kD(Z)}; g.n.abort=function(){this.Bl&&(this.Bl.cancel(),this.Bl=null);this.OG=-1}; g.n.bT=function(){return!1}; g.n.vn=function(Z,I){this.OG=Z.cz;if(this.hh==0)if(I){try{var d=this.D.parse(I)}catch(Y){Z=this.L;Z.Vi=this.OG;Ke(Z,2);return}this.jm=d[0];this.sT=d[1]}else Z=this.L,Z.Vi=this.OG,Ke(Z,2);else this.hh==2&&(this.K7?(xu(7),Date.now()):I=="11111"?(xu(6),this.K7=!0,Date.now(),this.OG=200,this.Bl.cancel(),xu(12),V6(this.L,this,!0)):(xu(8),Date.now(),this.K7=!1))}; g.n.g9=function(){this.OG=this.Bl.cz;if(this.Bl.MN)this.hh==0?this.sT?(this.hh=1,wqp(this)):(this.hh=2,SEV(this)):this.hh==2&&(this.K7?(xu(12),V6(this.L,this,!0)):(xu(11),V6(this.L,this,!1)));else{this.hh==0?xu(9):this.hh==2&&xu(10);var Z=this.L;this.Bl.getLastError();Z.Vi=this.OG;Ke(Z,2)}}; g.n.eb=function(){return this.L.eb()}; g.n.isActive=function(){return this.L.isActive()}; g.n.iV=function(Z){this.L.iV(Z)};g.n=WzL.prototype;g.n.UF=null;g.n.Gc=null;g.n.VJ=null;g.n.kH=null;g.n.KV=null;g.n.O1=null;g.n.hJ=null;g.n.Nw=null;g.n.y$=0;g.n.hI=0;g.n.tB=null;g.n.NN=null;g.n.TX=null;g.n.H1=null;g.n.uK=null;g.n.Ow=null;g.n.ND=-1;g.n.UQ=-1;g.n.Vi=-1;g.n.MD=0;g.n.gj=0;g.n.Xc=8;var yt0={OK:0,wS7:2,pls:4,TP7:5,E4m:6,STOP:7,DZ:8,Zwm:9,Lvr:10,kJs:11,Mor:12};g.uN(xMt,g.jD);g.uN(aAV,g.jD);g.n=WzL.prototype; g.n.connect=function(Z,I,d,Y,T){xu(0);this.KV=I;this.Gc=d||{};Y&&T!==void 0&&(this.Gc.OSID=Y,this.Gc.OAID=T);this.X?(Be((0,g.u5)(this.Mv,this,Z),100),u7i(this)):this.Mv(Z)}; g.n.disconnect=function(){$Qp(this);if(this.L==3){var Z=this.y$++,I=this.O1.clone();g.G_(I,"SID",this.N);g.G_(I,"RID",Z);g.G_(I,"TYPE","terminate");G0(this,I);Z=new a0(this,this.N,Z);Z.z7=2;Z.J1=W0(I.clone());(new Image).src=Z.J1.toString();Z.Pz=Date.now();uoE(Z)}t1t(this)}; g.n.Mv=function(Z){this.uK=new z90(this);this.uK.Zx=this.UF;this.uK.D=this.B;this.uK.connect(Z)}; g.n.bT=function(){return this.L==0}; g.n.getState=function(){return this.L}; g.n.IZ=function(Z){this.NN=null;N1L(this,Z)}; g.n.tY=function(){this.TX=null;this.kH=new a0(this,this.N,"rpc",this.V);this.kH.W1=this.UF;this.kH.LV=0;var Z=this.hJ.clone();g.G_(Z,"RID","rpc");g.G_(Z,"SID",this.N);g.G_(Z,"CI",this.Ow?"0":"1");g.G_(Z,"AID",this.ND);G0(this,Z);g.G_(Z,"TYPE","xmlhttp");qEp(this.kH,Z,!0,this.Nw,!1)}; g.n.vn=function(Z,I){if(this.L!=0&&(this.kH==Z||this.VJ==Z))if(this.Vi=Z.cz,this.VJ==Z&&this.L==3)if(this.Xc>7){try{var d=this.B.parse(I)}catch(Y){d=null}if(Array.isArray(d)&&d.length==3)if(Z=d,Z[0]==0)a:{if(!this.TX){if(this.kH)if(this.kH.Pz+3E30)){if(Y=I==1)this.VJ||this.NN||this.L==1||this.MD>=2?Y=!1:(this.NN=Be((0,g.u5)(this.IZ,this,Z),T1E(this,this.MD)),this.MD++, Y=!0);Y=!(Y||I==2&&Nji(this))}if(Y)switch(d){case 1:Ke(this,5);break;case 4:Ke(this,10);break;case 3:Ke(this,6);break;case 7:Ke(this,12);break;default:Ke(this,2)}}}; g.n.vI=function(Z){if(!g.Kc(arguments,this.L))throw Error("Unexpected channel state: "+this.L);}; g.n.gHS=function(Z){Z?xu(2):(xu(1),ETd(this,8))}; g.n.kD=function(Z){if(Z)throw Error("Can't create secondary domain capable XhrIo object.");Z=new g.UB;Z.V=!1;return Z}; g.n.isActive=function(){return!!this.tB&&this.tB.isActive(this)}; g.n.iV=function(Z){var I=Mu;I.dispatchEvent(new aAV(I,Z))}; g.n.eb=function(){return!1}; g.n=a8W.prototype;g.n.kC=function(){}; g.n.DQ=function(){}; g.n.ZQ=function(){}; g.n.LU=function(){}; g.n.nV=function(){}; g.n.gC=function(){return{}}; g.n.isActive=function(){return!0};g.n=ASp.prototype;g.n.enqueue=function(Z){this.D.push(Z)}; g.n.isEmpty=function(){return this.L.length===0&&this.D.length===0}; g.n.clear=function(){this.L=[];this.D=[]}; g.n.contains=function(Z){return g.Kc(this.L,Z)||g.Kc(this.D,Z)}; g.n.remove=function(Z){var I=this.L;var d=(0,g.mNu)(I,Z);d>=0?(g.$S(I,d),I=!0):I=!1;return I||g.s4(this.D,Z)}; g.n.O9=function(){for(var Z=[],I=this.L.length-1;I>=0;--I)Z.push(this.L[I]);I=this.D.length;for(var d=0;d=vbg.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(Z=vbg[this.D],this.C_=g.lo((0,g.u5)(this.Ps,this),Z),this.D++):this.publish("pairingFailed",Error("Server error "+Z.status))}; g.n.kU=function(){this.L=null;this.publish("pairingFailed",Error("Server not responding"))}; var vbg=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.uN(uw,pe);g.n=uw.prototype;g.n.start=function(){lw(this)&&this.publish("screenChange");!g.T2("yt-remote-lounge-token-expiration")&&OxL(this);g.Cl(this.L);this.L=g.lo((0,g.u5)(this.start,this),1E4)}; g.n.add=function(Z,I){lw(this);vOW(this,Z);fj(this,!1);this.publish("screenChange");I(Z);Z.token||OxL(this)}; g.n.remove=function(Z,I){var d=lw(this);LvM(this,Z)&&(fj(this,!1),d=!0);I(Z);d&&this.publish("screenChange")}; g.n.Q7=function(Z,I,d,Y){var T=lw(this),f=this.get(Z.id);f?(f.name!=I&&(f.name=I,fj(this,!1),T=!0),d(Z)):Y(Error("no such local screen."));T&&this.publish("screenChange")}; g.n.g4=function(){g.Cl(this.L);uw.AV.g4.call(this)}; g.n.zw=function(Z){lw(this);var I=this.screens.length;Z=Z&&Z.screens||[];for(var d=Z.length,Y=0;Y20)break a;O=I(f,P)}f=O}T.name=f}d(EX(this,T))},this), onError:(0,g.u5)(function(T){Y(Error("pairing request failed: "+T.status))},this), onTimeout:(0,g.u5)(function(){Y(Error("pairing request timed out."))},this)})}; g.n.g4=function(){g.Th(this.D);g.Th(this.L);jo.AV.g4.call(this)}; g.n.wc=function(){qRu(this);this.publish("screenChange");this.L.update()}; jo.prototype.dispose=jo.prototype.dispose;g.uN(AZ,g.dx);g.n=AZ.prototype;g.n.eI=function(Z){this.OZ()||(Z&&(H0(this,""+Z),this.publish("sessionFailed")),this.L=null,this.publish("sessionScreen",null))}; g.n.info=function(Z){Fb(this.fS,Z)}; g.n.KU=function(){return null}; g.n.eQ=function(Z){var I=this.D;Z?(I.displayStatus=new chrome.cast.ReceiverDisplayStatus(Z,[]),I.displayStatus.showStop=!0):I.displayStatus=null;chrome.cast.setReceiverDisplayStatus(I,(0,g.u5)(function(){this.info("Updated receiver status for "+I.friendlyName+": "+Z)},this),(0,g.u5)(function(){H0(this,"Failed to update receiver status for: "+I.friendlyName)},this))}; g.n.g4=function(){this.eQ("");AZ.AV.g4.call(this)};g.U(re,AZ);g.n=re.prototype;g.n.C4=function(Z){if(this.Z){if(this.Z==Z)return;H0(this,"Overriding cast session with new session object");qx0(this);this.Ns=!1;this.In="unknown";this.Z.removeUpdateListener(this.kS);this.Z.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Bj)}this.Z=Z;this.Z.addUpdateListener(this.kS);this.Z.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.Bj);irt(this,"getMdxSessionStatus")}; g.n.cN=function(Z){this.info("launchWithParams no-op for Cast: "+g.Q9(Z))}; g.n.stop=function(){this.Z?this.Z.stop((0,g.u5)(function(){this.eI()},this),(0,g.u5)(function(){this.eI(Error("Failed to stop receiver app."))},this)):this.eI(Error("Stopping cast device without session."))}; g.n.eQ=function(){}; g.n.g4=function(){this.info("disposeInternal");qx0(this);this.Z&&(this.Z.removeUpdateListener(this.kS),this.Z.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Bj));this.Z=null;AZ.prototype.g4.call(this)}; g.n.NV1=function(Z,I){if(!this.OZ())if(I)if(I=Qr(I),g.IB(I))switch(Z=""+I.type,I=I.data||{},this.info("onYoutubeMessage_: "+Z+" "+g.Q9(I)),Z){case "mdxSessionStatus":GqM(this,I);break;case "loungeToken":fAi(this,I);break;default:H0(this,"Unknown youtube message: "+Z)}else H0(this,"Unable to parse message.");else H0(this,"No data in message.")}; g.n.X$=function(Z,I,d,Y){g.Cl(this.X);this.X=0;r8i(this.N,this.D.label,Z,this.D.friendlyName,(0,g.u5)(function(T){T?I(T):Y>=0?(H0(this,"Screen "+Z+" appears to be offline. "+Y+" retries left."),this.X=g.lo((0,g.u5)(this.X$,this,Z,I,d,Y-1),300)):d(Error("Unable to fetch screen."))},this),d)}; g.n.KU=function(){return this.Z}; g.n.g7=function(Z){this.OZ()||Z||(H0(this,"Cast session died."),this.eI())};g.U(eo,AZ);g.n=eo.prototype;g.n.C4=function(Z){this.Z=Z;this.Z.addUpdateListener(this.j7)}; g.n.cN=function(Z){this.mJ=Z;this.LS()}; g.n.stop=function(){XMg(this);this.Z?this.Z.stop((0,g.u5)(this.eI,this,null),(0,g.u5)(this.eI,this,"Failed to stop DIAL device.")):this.eI()}; g.n.g4=function(){XMg(this);this.Z&&this.Z.removeUpdateListener(this.j7);this.Z=null;AZ.prototype.g4.call(this)}; g.n.NT=function(Z){this.OZ()||Z||(H0(this,"DIAL session died."),this.B(),this.B=function(){},this.eI())};g.U(Dq,AZ);Dq.prototype.stop=function(){this.eI()}; Dq.prototype.C4=function(){}; Dq.prototype.cN=function(){g.Cl(this.Z);this.Z=NaN;var Z=Ce(this.N.uW(),this.D.label);Z?DI(this,Z):this.eI(Error("No such screen"))}; Dq.prototype.g4=function(){g.Cl(this.Z);this.Z=NaN;AZ.prototype.g4.call(this)};g.U(Z7,g.dx);g.n=Z7.prototype; g.n.init=function(Z,I){chrome.cast.timeout.requestSession=3E4;var d=new chrome.cast.SessionRequest(this.X,[chrome.cast.Capability.AUDIO_OUT]);g.x9("desktop_enable_cast_connect")&&(d.androidReceiverCompatible=!0);this.In||(d.dialRequest=new chrome.cast.DialRequest("YouTube"));var Y=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;Z=Z||this.j?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var T=(0,g.u5)(this.ijn,this);d=new chrome.cast.ApiConfig(d,(0,g.u5)(this.mM, this),T,Y,Z);d.customDialLaunchCallback=(0,g.u5)(this.HMS,this);chrome.cast.initialize(d,(0,g.u5)(function(){this.OZ()||(chrome.cast.addReceiverActionListener(this.B),Un0(),this.D.subscribe("onlineScreenChange",(0,g.u5)(this.nU,this)),this.Z=mn0(this),chrome.cast.setCustomReceivers(this.Z,function(){},(0,g.u5)(function(f){this.BE("Failed to set initial custom receivers: "+g.Q9(f))},this)),this.publish("yt-remote-cast2-availability-change",wX(this)),I(!0))},this),(0,g.u5)(function(f){this.BE("Failed to initialize API: "+ g.Q9(f)); I(!1)},this))}; g.n.ui5=function(Z,I){sX("Setting connected screen ID: "+Z+" -> "+I);if(this.L){var d=this.L.L;if(!Z||d&&d.id!=Z)sX("Unsetting old screen status: "+this.L.D.friendlyName),VP(this,null)}if(Z&&I){if(!this.L){Z=Ce(this.D.uW(),Z);if(!Z){sX("setConnectedScreenStatus: Unknown screen.");return}if(Z.idType=="shortLived"){sX("setConnectedScreenStatus: Screen with id type to be short lived.");return}d=VId(this,Z);d||(sX("setConnectedScreenStatus: Connected receiver not custom..."),d=new chrome.cast.Receiver(Z.uuid? Z.uuid:Z.id,Z.name),d.receiverType=chrome.cast.ReceiverType.CUSTOM,this.Z.push(d),chrome.cast.setCustomReceivers(this.Z,function(){},(0,g.u5)(function(Y){this.BE("Failed to set initial custom receivers: "+g.Q9(Y))},this))); sX("setConnectedScreenStatus: new active receiver: "+d.friendlyName);VP(this,new Dq(this.D,d),!0)}this.L.eQ(I)}else sX("setConnectedScreenStatus: no screen.")}; g.n.qfJ=function(Z){this.OZ()?this.BE("Setting connection data on disposed cast v2"):this.L?this.L.cN(Z):this.BE("Setting connection data without a session")}; g.n.nH=function(){this.OZ()?this.BE("Stopping session on disposed cast v2"):this.L?(this.L.stop(),VP(this,null)):sX("Stopping non-existing session")}; g.n.requestSession=function(){chrome.cast.requestSession((0,g.u5)(this.mM,this),(0,g.u5)(this.sNj,this))}; g.n.g4=function(){this.D.unsubscribe("onlineScreenChange",(0,g.u5)(this.nU,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.B);var Z=PZ0,I=g.gZ("yt.mdx.remote.debug.handlers_");g.s4(I||[],Z);g.Th(this.L);g.dx.prototype.g4.call(this)}; g.n.BE=function(Z){Fb("Controller",Z)}; g.n.YE=function(Z,I){this.L==Z&&(I||VP(this,null),this.publish("yt-remote-cast2-session-change",I))}; g.n.xcm=function(Z,I){if(!this.OZ())if(Z)switch(Z.friendlyName=chrome.cast.unescape(Z.friendlyName),sX("onReceiverAction_ "+Z.label+" / "+Z.friendlyName+"-- "+I),I){case chrome.cast.ReceiverAction.CAST:if(this.L)if(this.L.D.label!=Z.label)sX("onReceiverAction_: Stopping active receiver: "+this.L.D.friendlyName),this.L.stop();else{sX("onReceiverAction_: Casting to active receiver.");this.L.L&&this.publish("yt-remote-cast2-session-change",this.L.L);break}switch(Z.receiverType){case chrome.cast.ReceiverType.CUSTOM:VP(this, new Dq(this.D,Z));break;case chrome.cast.ReceiverType.DIAL:VP(this,new eo(this.D,Z,this.N,this.config_));break;case chrome.cast.ReceiverType.CAST:VP(this,new re(this.D,Z,this.config_));break;default:this.BE("Unknown receiver type: "+Z.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.L&&this.L.D.label==Z.label?this.L.stop():this.BE("Stopping receiver w/o session: "+Z.friendlyName)}else this.BE("onReceiverAction_ called without receiver.")}; g.n.HMS=function(Z){if(this.OZ())return Promise.reject(Error("disposed"));var I=Z.receiver;I.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.BE("Not DIAL receiver: "+I.friendlyName),I.receiverType=chrome.cast.ReceiverType.DIAL);var d=this.L?this.L.D:null;if(!d||d.label!=I.label)return this.BE("Receiving DIAL launch request for non-clicked DIAL receiver: "+I.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(d&&d.label==I.label&&d.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.L.L)return sX("Reselecting dial screen."), this.publish("yt-remote-cast2-session-change",this.L.L),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.BE('Changing CAST intent from "'+d.receiverType+'" to "dial" for '+I.friendlyName);VP(this,new eo(this.D,I,this.N,this.config_))}I=this.L;I.X=Z;I.X.appState==chrome.cast.DialAppState.RUNNING?(Z=I.X.extraData||{},d=Z.screenId||null,oo(I)&&Z.loungeToken?Z.loungeTokenRefreshIntervalMs?Z=Zxd(I,{name:I.D.friendlyName,screenId:Z.screenId,loungeToken:Z.loungeToken,dialId:I.X.receiver.label, screenIdType:"shortLived"},Z.loungeTokenRefreshIntervalMs):(g.eW(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(Z)+".")),Z=ixu(I,d)):Z=ixu(I,d)):Z=jLd(I);return Z}; g.n.mM=function(Z){var I=this;if(!this.OZ()&&!this.j){sX("New cast session ID: "+Z.sessionId);var d=Z.receiver;if(d.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.L)if(d.receiverType==chrome.cast.ReceiverType.CAST)sX("Got resumed cast session before resumed mdx connection."),d.friendlyName=chrome.cast.unescape(d.friendlyName),VP(this,new re(this.D,d,this.config_),!0);else{this.BE("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var Y=this.L.D,T=Ce(this.D.uW(), Y.label);T&&$g(T,d.label)&&Y.receiverType!=chrome.cast.ReceiverType.CAST&&d.receiverType==chrome.cast.ReceiverType.CAST&&(sX("onSessionEstablished_: manual to cast session change "+d.friendlyName),g.Th(this.L),this.L=new re(this.D,d,this.config_),this.L.subscribe("sessionScreen",(0,g.u5)(this.YE,this,this.L)),this.L.subscribe("sessionFailed",function(){return ncd(I,I.L)}),this.L.cN(null)); this.L.C4(Z)}}}; g.n.KH=function(){return this.L?this.L.KU():null}; g.n.sNj=function(Z){this.OZ()||(this.BE("Failed to estabilish a session: "+g.Q9(Z)),Z.code!=chrome.cast.ErrorCode.CANCEL&&VP(this,null),this.publish("yt-remote-cast2-session-failed"))}; g.n.ijn=function(Z){sX("Receiver availability updated: "+Z);if(!this.OZ()){var I=wX(this);this.V=Z==chrome.cast.ReceiverAvailability.AVAILABLE;wX(this)!=I&&this.publish("yt-remote-cast2-availability-change",wX(this))}}; g.n.nU=function(){this.OZ()||(this.Z=mn0(this),sX("Updating custom receivers: "+g.Q9(this.Z)),chrome.cast.setCustomReceivers(this.Z,function(){},(0,g.u5)(function(){this.BE("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",wX(this)))}; Z7.prototype.setLaunchParams=Z7.prototype.qfJ;Z7.prototype.setConnectedScreenStatus=Z7.prototype.ui5;Z7.prototype.stopSession=Z7.prototype.nH;Z7.prototype.getCastSession=Z7.prototype.KH;Z7.prototype.requestSession=Z7.prototype.requestSession;Z7.prototype.init=Z7.prototype.init;Z7.prototype.dispose=Z7.prototype.dispose;var l93=g.K5(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"]),Bvi=[],Lz3=g.fk(l93);g.n=zt.prototype; g.n.reset=function(Z){this.listId="";this.index=-1;this.videoId="";Bjt(this);this.volume=-1;this.muted=!1;Z&&(this.index=Z.index,this.listId=Z.listId,this.videoId=Z.videoId,this.playerState=Z.playerState,this.volume=Z.volume,this.muted=Z.muted,this.audioTrackId=Z.audioTrackId,this.trackData=Z.trackData,this.xb=Z.hasPrevious,this.wf=Z.hasNext,this.j=Z.playerTime,this.B=Z.playerTimeAt,this.D=Z.seekableStart,this.V=Z.seekableEnd,this.Z=Z.duration,this.X=Z.loadedTime,this.L=Z.liveIngestionTime,this.N= !isNaN(this.L))}; g.n.isPlaying=function(){return this.playerState==1}; g.n.isBuffering=function(){return this.playerState==3}; g.n.cT=function(Z){this.Z=isNaN(Z)?0:Z}; g.n.getDuration=function(){return this.N?this.Z+mG(this):this.Z}; g.n.clone=function(){return new zt(z3i(this))};g.U(sp,g.dx);g.n=sp.prototype;g.n.getState=function(){return this.Z}; g.n.Pu=function(){return this.N.getReconnectTimeout()}; g.n.fg=function(){this.N.reconnect()}; g.n.play=function(){ne(this)?(this.L?this.L.play(null,g.b9,W$(this,"play")):ak(this,"play"),qfg(this,1,e_(pm(this))),this.publish("remotePlayerChange")):YJ(this,this.play)}; g.n.pause=function(){ne(this)?(this.L?this.L.pause(null,g.b9,W$(this,"pause")):ak(this,"pause"),qfg(this,2,e_(pm(this))),this.publish("remotePlayerChange")):YJ(this,this.pause)}; g.n.seekTo=function(Z){if(ne(this)){if(this.L){var I=pm(this),d=new chrome.cast.media.SeekRequest;d.currentTime=Z;I.isPlaying()||I.isBuffering()?d.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:d.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.L.seek(d,g.b9,W$(this,"seekTo",{newTime:Z}))}else ak(this,"seekTo",{newTime:Z});qfg(this,3,Z);this.publish("remotePlayerChange")}else YJ(this,g.T9(this.seekTo,Z))}; g.n.stop=function(){if(ne(this)){this.L?this.L.stop(null,g.b9,W$(this,"stopVideo")):ak(this,"stopVideo");var Z=pm(this);Z.index=-1;Z.videoId="";Bjt(Z);ml(this,Z);this.publish("remotePlayerChange")}else YJ(this,this.stop)}; g.n.setVolume=function(Z,I){if(ne(this)){var d=pm(this);if(this.D){if(d.volume!=Z){var Y=Math.round(Z)/100;this.D.setReceiverVolumeLevel(Y,(0,g.u5)(function(){xg("set receiver volume: "+Y)},this),(0,g.u5)(function(){this.BE("failed to set receiver volume.")},this))}d.muted!=I&&this.D.setReceiverMuted(I,(0,g.u5)(function(){xg("set receiver muted: "+I)},this),(0,g.u5)(function(){this.BE("failed to set receiver muted.")},this))}else{var T={volume:Z, muted:I};d.volume!=-1&&(T.delta=Z-d.volume);ak(this,"setVolume",T)}d.muted=I;d.volume=Z;ml(this,d)}else YJ(this,g.T9(this.setVolume,Z,I))}; g.n.xC=function(Z,I){if(ne(this)){var d=pm(this);Z={videoId:Z};I&&(d.trackData={trackName:I.name,languageCode:I.languageCode,sourceLanguageCode:I.translationLanguage?I.translationLanguage.languageCode:"",languageName:I.languageName,kind:I.kind},Z.style=g.Q9(I.style),g.rt(Z,d.trackData));ak(this,"setSubtitlesTrack",Z);ml(this,d)}else YJ(this,g.T9(this.xC,Z,I))}; g.n.setAudioTrack=function(Z,I){ne(this)?(I=I.getLanguageInfo().getId(),ak(this,"setAudioTrack",{videoId:Z,audioTrackId:I}),Z=pm(this),Z.audioTrackId=I,ml(this,Z)):YJ(this,g.T9(this.setAudioTrack,Z,I))}; g.n.playVideo=function(Z,I,d,Y,T,f,P){Y=Y===void 0?null:Y;T=T===void 0?null:T;f=f===void 0?null:f;P=P===void 0?null:P;var O=pm(this),a={videoId:Z};d!==void 0&&(a.currentIndex=d);OG(O,Z,d||0);I!==void 0&&(v0(O,I),a.currentTime=I);Y&&(a.listId=Y);T&&(a.playerParams=T);f&&(a.clickTrackingParams=f);P&&(a.locationInfo=g.Q9(P));ak(this,"setPlaylist",a);Y||ml(this,O)}; g.n.U5=function(Z,I){if(ne(this)){if(Z&&I){var d=pm(this);OG(d,Z,I);ml(this,d)}ak(this,"previous")}else YJ(this,g.T9(this.U5,Z,I))}; g.n.nextVideo=function(Z,I){if(ne(this)){if(Z&&I){var d=pm(this);OG(d,Z,I);ml(this,d)}ak(this,"next")}else YJ(this,g.T9(this.nextVideo,Z,I))}; g.n.Yv=function(){if(ne(this)){ak(this,"clearPlaylist");var Z=pm(this);Z.reset();ml(this,Z);this.publish("remotePlayerChange")}else YJ(this,this.Yv)}; g.n.Wd=function(){ne(this)?ak(this,"dismissAutoplay"):YJ(this,this.Wd)}; g.n.dispose=function(){if(this.Z!=3){var Z=this.Z;this.Z=3;this.publish("proxyStateChange",Z,this.Z)}g.dx.prototype.dispose.call(this)}; g.n.g4=function(){Gmd(this);this.N=null;this.B.clear();FM(this,null);g.dx.prototype.g4.call(this)}; g.n.AC=function(Z){if((Z!=this.Z||Z==2)&&this.Z!=3&&Z!=0){var I=this.Z;this.Z=Z;this.publish("proxyStateChange",I,Z);if(Z==1)for(;!this.B.isEmpty();)I=Z=this.B,I.L.length===0&&(I.L=I.D,I.L.reverse(),I.D=[]),Z.L.pop().apply(this);else Z==3&&this.dispose()}}; g.n.Nz4=function(Z,I){this.publish(Z,I)}; g.n.VK4=function(Z){if(!Z)this.Dv(null),FM(this,null);else if(this.D.receiver.volume){Z=this.D.receiver.volume;var I=pm(this),d=Math.round(100*Z.level||0);if(I.volume!=d||I.muted!=Z.muted)xg("Cast volume update: "+Z.level+(Z.muted?" muted":"")),I.volume=d,I.muted=!!Z.muted,ml(this,I)}}; g.n.Dv=function(Z){xg("Cast media: "+!!Z);this.L&&this.L.removeUpdateListener(this.X);if(this.L=Z)this.L.addUpdateListener(this.X),GnV(this),this.publish("remotePlayerChange")}; g.n.TKZ=function(Z){Z?(GnV(this),this.publish("remotePlayerChange")):this.Dv(null)}; g.n.aS=function(){ak(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}; g.n.afS=function(){var Z=JSu();Z&&FM(this,Z)}; g.n.BE=function(Z){Fb("CP",Z)};g.U(Yg,g.dx);g.n=Yg.prototype; g.n.connect=function(Z,I){if(I){var d=I.listId,Y=I.videoId,T=I.videoIds,f=I.playerParams,P=I.clickTrackingParams,O=I.index,a={videoId:Y},W=I.currentTime,e=I.locationInfo;I=I.loopMode;W!==void 0&&(a.currentTime=W<=5?0:W);f&&(a.playerParams=f);e&&(a.locationInfo=e);P&&(a.clickTrackingParams=P);d&&(a.listId=d);T&&T.length>0&&(a.videoIds=T.join(","));O!==void 0&&(a.currentIndex=O);this.j7&&(a.loopMode=I||"LOOP_MODE_OFF");d&&(this.L.listId=d);this.L.videoId=Y;this.L.index=O||0;this.L.state=3;v0(this.L, W);this.B="UNSUPPORTED";d=this.j7?"setInitialState":"setPlaylist";we("Connecting with "+d+" and params: "+g.Q9(a));this.D.connect({method:d,params:g.Q9(a)},Z,c30())}else we("Connecting without params"),this.D.connect({},Z,c30());NR$(this)}; g.n.Cr=function(Z){this.D.Cr(Z)}; g.n.dispose=function(){this.OZ()||(g.zb("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),Up(this,3));g.dx.prototype.dispose.call(this)}; g.n.g4=function(){PBg(this);Hbg(this);Q5u(this);g.Cl(this.X);this.X=NaN;g.Cl(this.In);this.In=NaN;this.N=null;g.zq(this.LS);this.LS.length=0;this.D.dispose();g.dx.prototype.g4.call(this);this.B=this.V=this.Z=this.L=this.D=null}; g.n.aG=function(Z){if(!this.Z||this.Z.length===0)return!1;for(var I=g.t(this.Z),d=I.next();!d.done;d=I.next())if(!d.value.capabilities.has(Z))return!1;return!0}; g.n.Gq=function(){var Z=3;this.OZ()||(Z=0,isNaN(this.J2())?this.D.Zq()&&isNaN(this.j)&&(Z=1):Z=2);return Z}; g.n.dj=function(Z){we("Disconnecting with "+Z);g.zb("yt.mdx.remote.remoteClient_",null);PBg(this);this.publish("beforeDisconnect",Z);Z==1&&fe();this.D.disconnect(Z);this.dispose()}; g.n.dT=function(){var Z=this.L;this.N&&(Z=this.L.clone(),OG(Z,this.N,Z.index));return z3i(Z)}; g.n.XEm=function(Z){var I=this,d=new zt(Z);d.videoId&&d.videoId!=this.L.videoId&&(this.N=d.videoId,g.Cl(this.X),this.X=g.lo(function(){if(I.N){var T=I.N;I.N=null;I.L.videoId!=T&&c0(I,"getNowPlaying")}},5E3)); var Y=[];this.L.listId==d.listId&&this.L.videoId==d.videoId&&this.L.index==d.index||Y.push("remoteQueueChange");this.L.playerState==d.playerState&&this.L.volume==d.volume&&this.L.muted==d.muted&&e_(this.L)==e_(d)&&g.Q9(this.L.trackData)==g.Q9(d.trackData)||Y.push("remotePlayerChange");this.L.reset(Z);g.KM(Y,function(T){this.publish(T)},this)}; g.n.un=function(){var Z=this.D.getDeviceId(),I=g.Xe(this.Z,function(d){return d.type=="REMOTE_CONTROL"&&d.id!=Z}); return I?I.id:""}; g.n.J2=function(){return this.D.Pu()}; g.n.Tq=function(){return this.B||"UNSUPPORTED"}; g.n.Vz=function(){return this.V||""}; g.n.xU=function(){!isNaN(this.J2())&&this.D.fg()}; g.n.jd5=function(Z,I){c0(this,Z,I);Oai(this)}; g.n.BP=function(){var Z=g.Zc("SAPISID","")||g.Zc("__Secure-1PAPISID")||"",I=g.Zc("__Secure-3PAPISID","")||"";if(!Z&&!I)return"";Z=g.Bg(g.eR(Z),2);I=g.Bg(g.eR(I),2);return g.Bg(g.eR(","+Z+","+I),2)}; Yg.prototype.subscribe=Yg.prototype.subscribe;Yg.prototype.unsubscribeByKey=Yg.prototype.h_;Yg.prototype.getProxyState=Yg.prototype.Gq;Yg.prototype.disconnect=Yg.prototype.dj;Yg.prototype.getPlayerContextData=Yg.prototype.dT;Yg.prototype.setPlayerContextData=Yg.prototype.XEm;Yg.prototype.getOtherConnectedRemoteId=Yg.prototype.un;Yg.prototype.getReconnectTimeout=Yg.prototype.J2;Yg.prototype.getAutoplayMode=Yg.prototype.Tq;Yg.prototype.getAutoplayVideoId=Yg.prototype.Vz;Yg.prototype.reconnect=Yg.prototype.xU; Yg.prototype.sendMessage=Yg.prototype.jd5;Yg.prototype.getXsrfToken=Yg.prototype.BP;Yg.prototype.isCapabilitySupportedOnConnectedDevices=Yg.prototype.aG;g.U(CTV,pe);g.n=CTV.prototype;g.n.uW=function(Z){return this.SF.$_gs(Z)}; g.n.contains=function(Z){return!!this.SF.$_c(Z)}; g.n.get=function(Z){return this.SF.$_g(Z)}; g.n.start=function(){this.SF.$_st()}; g.n.add=function(Z,I,d){this.SF.$_a(Z,I,d)}; g.n.remove=function(Z,I,d){this.SF.$_r(Z,I,d)}; g.n.Q7=function(Z,I,d,Y){this.SF.$_un(Z,I,d,Y)}; g.n.g4=function(){for(var Z=this.L.length,I=0;I1&&!this.S.getOption("remote","quickCast")?(this.cU=g.CM(Z,this.L,this),this.iW(g.Ft(Z,this.L)),Z=this.S.getOption("remote","currentReceiver"),Z=this.L(Z),this.options[Z]&&this.L6(Z),this.enable(!0)):this.enable(!1)}; JZ.prototype.L=function(Z){return Z.key}; JZ.prototype.KA=function(Z){return Z==="cast-selector-receiver"?"Cast...":this.cU[Z].name}; JZ.prototype.ZG=function(Z){g.St.prototype.ZG.call(this,Z);this.S.setOption("remote","currentReceiver",this.cU[Z]);this.A5.zb()};g.U(s5t,g.NI);g.n=s5t.prototype; g.n.create=function(){var Z=this.player.C(),I=g.bZ(Z);Z={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:Z.Y("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:Z.Y("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:Z.Y("enable_cast_short_lived_lounge_token")};ecd(I,Z);this.subscriptions.push(g.iV("yt-remote-before-disconnect",this.Q0J,this));this.subscriptions.push(g.iV("yt-remote-connection-change",this.SPr,this));this.subscriptions.push(g.iV("yt-remote-receiver-availability-change",this.iA, this));this.subscriptions.push(g.iV("yt-remote-auto-connect",this.fAS,this));this.subscriptions.push(g.iV("yt-remote-receiver-resumed",this.Bz5,this));this.subscriptions.push(g.iV("mdx-privacy-popup-confirm",this.EZ5,this));this.subscriptions.push(g.iV("mdx-privacy-popup-cancel",this.sEj,this));this.iA()}; g.n.load=function(){this.player.cancelPlayback();g.NI.prototype.load.call(this);this.OI=new gLE(this.player.C(),this);this.player.Qe(this.OI);this.Zy=new j7d(this,this.player,this.yy);var Z=(Z=izg())?Z.currentTime:0;var I=dMi()?new sp(iw(),void 0):null;Z==0&&I&&(Z=e_(pm(I)));Z!==0&&this.W$(Z);Orp(this,this.JZ,this.JZ);this.player.bP(6)}; g.n.unload=function(){this.player.publish("mdxautoplaycanceled");this.player.Al();this.wF=this.uP;g.t$(this.Zy,this.yy);this.yy=this.OI=this.Zy=null;g.NI.prototype.unload.call(this);this.player.bP(5);ge(this)}; g.n.g4=function(){g.Z2(this.subscriptions);g.NI.prototype.g4.call(this)}; g.n.xK=function(Z){var I=g.vj.apply(1,arguments);this.loaded&&this.Zy.w5.apply(this.Zy,[Z].concat(g.c(I)))}; g.n.getAdState=function(){return this.Y$}; g.n.xb=function(){return this.yy?pm(this.yy).xb:!1}; g.n.wf=function(){return this.yy?pm(this.yy).wf:!1}; g.n.W$=function(Z,I){this.lD=Z||0;this.player.publish("progresssync",Z,I);this.player.Kj("onVideoProgress",Z||0)}; g.n.getCurrentTime=function(){return this.lD}; g.n.getDuration=function(){return pm(this.yy).getDuration()||0}; g.n.xF=function(){var Z=pm(this.yy);return Z.N?Z.L+mG(Z):Z.L}; g.n.aK=function(){return pm(this.yy).X}; g.n.HB=function(){return Ob$(pm(this.yy))}; g.n.dR=function(){var Z=pm(this.yy);return Z.D>0?Z.D+mG(Z):Z.D}; g.n.getProgressState=function(){var Z=pm(this.yy),I=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:Z.playerState!=1081&&this.player.At(),clipEnd:I.clipEnd,clipStart:I.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:this.getDuration(),ingestionTime:this.xF(),isAtLiveHead:this.isAtLiveHead(),loaded:this.aK(),seekableEnd:this.HB(),seekableStart:this.dR(),offset:0,viewerLivestreamJoinMediaTime:0}}; g.n.isAtLiveHead=function(){return Ob$(pm(this.yy))-this.getCurrentTime()<=1}; g.n.nextVideo=function(){this.yy&&this.yy.nextVideo()}; g.n.U5=function(){this.yy&&this.yy.U5()}; g.n.Q0J=function(Z){Z===1&&(this.tC=this.yy?pm(this.yy):null)}; g.n.SPr=function(){var Z=dMi()?new sp(iw(),void 0):null;if(Z){var I=this.wF;this.loaded&&this.unload();this.yy=Z;this.tC=null;I.key!==this.uP.key&&(this.wF=I,this.load())}else g.Th(this.yy),this.yy=null,this.loaded&&(this.unload(),(Z=this.tC)&&Z.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(Z.videoId,e_(Z)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}; g.n.iA=function(){var Z=[this.uP],I=Z.concat,d=nbp();nm()&&g.T2("yt-remote-cast-available")&&d.push({key:"cast-selector-receiver",name:"Cast..."});this.cU=I.call(Z,d);Z=UQ3()||this.uP;bw(this,Z);this.player.Kj("onMdxReceiversChange")}; g.n.fAS=function(){var Z=UQ3();bw(this,Z)}; g.n.Bz5=function(){this.wF=UQ3()}; g.n.EZ5=function(){this.oO=!0;ge(this);de=!1;o0&&Op(o0,1);o0=null}; g.n.sEj=function(){this.oO=!1;ge(this);bw(this,this.uP);this.wF=this.uP;de=!1;o0=null;this.player.playVideo()}; g.n.k$=function(Z,I){switch(Z){case "casting":return this.loaded;case "receivers":return this.cU;case "currentReceiver":return I&&(I.key==="cast-selector-receiver"?wXM():bw(this,I)),this.loaded?this.wF:this.uP;case "quickCast":return this.cU.length===2&&this.cU[1].key==="cast-selector-receiver"?(I&&wXM(),!0):!1}}; g.n.aS=function(){this.yy.aS()}; g.n.bV=function(){return!1}; g.n.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]}; g.n.isLoggedIn=function(){var Z,I;return((Z=g.rh("PLAYER_CONFIG"))==null?void 0:(I=Z.args)==null?void 0:I.authuser)!==void 0?!0:!(!g.rh("SESSION_INDEX")&&!g.rh("LOGGED_IN"))};g.cI("remote",s5t);})(_yt_player);