(function(g){var window=this;'use strict';var I1m=function(k,U){return g.W7(k,U)},q1V=function(k){if(k instanceof g.$U)return k; if(typeof k.s9=="function")return k.s9(!1);if(g.Qs(k)){let U=0;const n=new g.$U;n.next=function(){for(;;){if(U>=k.length)return g.ye;if(U in k)return g.pw(k[U++]);U++}}; return n}throw Error("Not implemented");},Jni=function(k,U,n){if(g.Qs(k))g.SU(k,U,n); else for(k=q1V(k);;){const {done:Z,value:C}=k.next();if(Z)break;U.call(n,C,void 0,k)}},Ce=function(k){g.rf(k,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^g.tS()).toString(36)); return k},rQ=function(k,U,n){Array.isArray(n)||(n=[String(n)]); g.wf(k.J,U,n)},el_=function(k,U){const n=[]; Jni(U,function(Z){let C;try{C=g.DR.prototype.Dn.call(this,Z,!0)}catch(r){if(r=="Storage: Invalid value was encountered")return;throw r;}C===void 0?n.push(Z):g.Yq(C)&&n.push(Z)},k); return n},BNp=function(k,U){el_(k,U).forEach(function(n){g.DR.prototype.remove.call(this,n)},k)},PWY=function(k){if(k.Y$){if(k.Y$.locationOverrideToken)return{locationOverrideToken:k.Y$.locationOverrideToken}; if(k.Y$.latitudeE7!=null&&k.Y$.longitudeE7!=null)return{latitudeE7:k.Y$.latitudeE7,longitudeE7:k.Y$.longitudeE7}}return null},snV=function(k,U){g.n8(k,U)||k.push(U)},Le=function(k){let U=0; for(const n in k)U++;return U},Y1V=function(k){try{return g.Vs.JSON.parse(k)}catch(U){}k=String(k); if(/^\s*$/.test(k)?0:/^[\],:{}\s\u2028\u2029]*$/.test(k.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("("+k+")")}catch(U){}throw Error("Invalid JSON string: "+k);},FN=function(k){if(g.Vs.JSON)try{return g.Vs.JSON.parse(k)}catch(U){}return Y1V(k)},DwV=function(k,U,n,Z){const C=new g.lU(null); k&&g.mj(C,k);U&&g.kh(C,U);n&&g.iE(C,n);Z&&(C.B=Z);return C},oxO=function(k,U){return new g.MXB(k,U)},v0=function(k,U){return Object.prototype.hasOwnProperty.call(k,U)},WYO=function(k,U){return k===U},OA=function(k,U){this.B={}; this.S=[];this.oH=this.size=0;var n=arguments.length;if(n>1){if(n%2)throw Error("Uneven number of arguments");for(var Z=0;Z{k.capabilities.add(n)})},S1s=function(k,U){k.compatibleSenderThemes.clear(); g.GN(U.split(","),g.N6(I1m,MLp)).forEach(n=>{k.compatibleSenderThemes.add(n)})},G3V=function(k,U){k.experiments.clear(); U.split(",").forEach(n=>{k.experiments.add(n)})},gQ=function(k){k=k||{}; this.name=k.name||"";this.id=k.id||k.screenId||"";this.token=k.token||k.loungeToken||"";this.uuid=k.uuid||k.dialId||"";this.idType=k.screenIdType||"normal";this.secret=k.screenIdSecret||""},XN=function(k,U){return!!U&&(k.id==U||k.uuid==U)},ynb=function(k){return{name:k.name, screenId:k.id,loungeToken:k.token,dialId:k.uuid,screenIdType:k.idType,screenIdSecret:k.secret}},cnB=function(k){return new gQ(k)},l1B=function(k){return Array.isArray(k)?g.fz(k,cnB):[]},EA=function(k){return k?`{name:"${k.name}",id:${k.id.substr(0,6)}..,token:${k.token?".."+k.token.slice(-6):"-"},uuid:${k.uuid?".."+k.uuid.slice(-6):"-"},idType:${k.idType},secret:${k.secret?".."+k.secret.slice(-6):"-"}}`:"null"},A0=function(k){return Array.isArray(k)?"["+g.fz(k,EA).join(",")+"]":"null"},dQ=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(k){const U=Math.random()*16|0; return(k=="x"?U:U&3|8).toString(16)})},mwb=function(k){return g.fz(k,function(U){return{key:U.id, name:U.name}})},VA=function(k,U){return g.kB(k,function(n){return n||U?!n!=!U?!1:n.id==U.id:!0})},H0=function(k,U){return g.kB(k,function(n){return XN(n,U)})},xwB=function(){const k=g.rC.yD(); k&&BNp(k,k.kQ.s9(!0))},R9=function(){const k=g.F6("yt-remote-connected-devices")||[]; g.zp(k);return k},kX7=function(k){if(k.length==0)return[]; const U=k[0].indexOf("#"),n=U==-1?k[0]:k[0].substring(0,U);return g.fz(k,function(Z,C){return C==0?Z:Z.substring(n.length)})},iT2=function(k){g.Lr("yt-remote-connected-devices",k,86400)},b3=function(){if(h0)return h0; let k=g.F6("yt-remote-device-id");k||(k=dQ(),g.Lr("yt-remote-device-id",k,31536E3));const U=R9();let n=1,Z=k;for(;g.n8(U,Z);)n++,Z=k+"#"+n;return h0=Z},zA=function(){let k=R9(); const U=b3();g.O9()&&g.p8(k,U);k=kX7(k);if(k.length==0)try{g.XQ("remote_sid")}catch(n){}else try{g.uB("remote_sid",k.join(","),-1)}catch(n){}},UQx=function(){return g.F6("yt-remote-session-browser-channel")},npB=function(){return g.F6("yt-remote-local-screens")||[]},ZTV=function(){g.Lr("yt-remote-lounge-token-expiration",!0,86400)},CeV=function(k){k.length>5&&(k=k.slice(k.length-5)); const U=g.fz(npB(),function(Z){return Z.loungeToken}),n=g.fz(k,function(Z){return Z.loungeToken}); g.mB(n,function(Z){return!g.n8(U,Z)})&&ZTV(); g.Lr("yt-remote-local-screens",k,31536E3)},QA=function(k){k||(g.vi("yt-remote-session-screen-id"),g.vi("yt-remote-session-video-id")); zA();k=R9();g.FO(k,b3());iT2(k)},rdb=function(){if(!Ke){const k=g.M_(); k&&(Ke=new g.Ji(k))}},LlB=function(){rdb(); return Ke?!!Ke.get("yt-remote-use-staging-server"):!1},TA=function(k,U){g.ZD[k]=!0; const n=g.UX();n&&n.publish.apply(n,arguments);g.ZD[k]=!1},a9=function(){let k=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return k?parseInt(k[1],10):0},Fl2=function(k){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+k)!=-1||document.currentScript.src.indexOf("&"+k)!=-1)},vp_=function(){return typeof window.__onGCastApiAvailable=="function"?window.__onGCastApiAvailable:null},$f=function(k){k.length?OTp(k.shift(),function(){$f(k)}):pe()},pe=function(){let k=vp_(); k&&k(!1,"No cast extension found")},OTp=function(k,U,n){let Z=document.createElement("script"); Z.onerror=U;n&&(Z.onload=n);g.UI(Z,g.vE(k));(document.head||document.documentElement).appendChild(Z)},wx7=function(k){return"chrome-extension://"+k+"/cast_sender.js"},u08=function(){const k=a9(),U=[]; if(k>1){const n=k-1;U.push("//www.gstatic.com/eureka/clank/"+k+"/cast_sender.js");U.push("//www.gstatic.com/eureka/clank/"+n+"/cast_sender.js")}return U},NY=function(){if(gpE){var k=2,U=vp_(),n=function(){k--; k==0&&U&&U(!0)}; window.__onGCastApiAvailable=n;OTp("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",pe,n)}},Xx8=function(){NY(); let k=u08();k.push("//www.gstatic.com/eureka/clank/cast_sender.js");$f(k)},AdV=function(){NY(); let k=u08();k.push(...Eps.map(wx7));k.push("//www.gstatic.com/eureka/clank/cast_sender.js");$f(k)},t0=function(k,U,n){g.ca.call(this); this.V=n!=null?(0,g.pz)(k,n):k;this.nZ=U;this.W=(0,g.pz)(this.JB,this);this.S=!1;this.B=0;this.j=this.uu=null;this.J=[]},I9=function(){this.S=g.tS()},dQ7=function(){qY||(qY=new I9)},Vxp=function(){qY||(qY=new I9)},J0=function(){g.g5.call(this,"p")},eH=function(){g.g5.call(this,"o")},B0=function(){return HT7=HT7||new g.q1},RQV=function(k){g.g5.call(this,"serverreachability",k)},P0=function(k){const U=B0(); U.dispatchEvent(new RQV(U,k))},hQ2=function(k){g.g5.call(this,"statevent",k)},sA=function(k){const U=B0(); U.dispatchEvent(new hQ2(U,k))},bTE=function(k,U,n,Z){g.g5.call(this,"timingevent",k); this.size=U;this.rtt=n;this.retries=Z},Yf=function(k,U){if(typeof k!=="function")throw Error("Fn must not be null and must be a function"); return g.Vs.setTimeout(function(){k()},U)},D$=function(){},o9=function(k,U,n,Z){this.j=k; this.J=U;this.xo=n;this.Y$=Z||1;this.bL=new g.XL(this);this.Xo=45E3;this.eE=null;this.V=!1;this.D=this.TJ=this.X=this.IQ=this.SE=this.uL=this.dM=null;this.Y=[];this.S=null;this.L=0;this.W=this.x$=null;this.GJ=-1;this.Wy=!1;this.aQ=0;this.pN=null;this.h8=this.V$=this.Fo=this.By=!1;this.B=new zQi},zQi=function(){this.j=null; this.S="";this.B=!1},W0=function(k,U,n){k.IQ=1; k.X=Ce(U.clone());k.D=n;k.By=!0;Qsi(k,null)},Qsi=function(k,U){k.SE=Date.now(); jH(k);k.TJ=k.X.clone();rQ(k.TJ,"t",k.Y$);k.L=0;const n=k.j.V$;k.B=new zQi;k.S=Klm(k.j,n?U:null,!k.D);k.aQ>0&&(k.pN=new g.EG((0,g.pz)(k.Dr,k,k.S),k.aQ));k.bL.listen(k.S,"readystatechange",k.I5);U=k.eE?g.c7(k.eE):{};k.D?(k.x$||(k.x$="POST"),U["Content-Type"]="application/x-www-form-urlencoded",k.S.send(k.TJ,k.x$,k.D,U)):(k.x$="GET",k.S.send(k.TJ,k.x$,null,U));P0(1)},at8=function(k){if(!Tv2(k))return g.oh(k.S); const U=g.WT(k.S);if(U==="")return"";let n="";const Z=U.length,C=g.sh(k.S)==4;if(!k.B.j){if(typeof TextDecoder==="undefined")return SH(k),GA(k),"";k.B.j=new g.Vs.TextDecoder}for(let r=0;rU.length)return fe;U=U.slice(Z,Z+n);k.L=Z+n;return U},jH=function(k){k.uL=Date.now()+k.Xo; NvY(k,k.Xo)},NvY=function(k,U){if(k.dM!=null)throw Error("WatchDog timer not null"); k.dM=Yf((0,g.pz)(k.W0,k),U)},MY=function(k){k.dM&&(g.Vs.clearTimeout(k.dM),k.dM=null)},GA=function(k){k.j.Ty()||k.Wy||tx_(k.j,k)},SH=function(k){MY(k); g.MD(k.pN);k.pN=null;k.bL.removeAll();if(k.S){const U=k.S;k.S=null;U.abort();U.dispose()}},ng=function(k,U){try{var n=k.j; if(n.uV!=0&&(n.S==k||yA(n.B,k)))if(!k.V$&&yA(n.B,k)&&n.uV==3){try{var Z=n.TN.S.parse(U)}catch(O){Z=null}if(Array.isArray(Z)&&Z.length==3){var C=Z;if(C[0]==0)a:{if(!n.X){if(n.S)if(n.S.SE+3E30&&(n.aQ=1.5*X);Z=n;const E=k.yv();if(E){const V=g.Sz(E,"X-Client-Wire-Protocol");if(V){var r=Z.B;!r.S&&(g.Fm(V,"spdy")||g.Fm(V,"quic")||g.Fm(V,"h2"))&&(r.J=r.W,r.S=new Set,r.B&&(ii(r,r.B),r.B=null))}if(Z.By){const Q=g.Sz(E,"X-HTTP-Session-Id");Q&&(Z.Nj=Q,g.rf(Z.eE,Z.By,Q))}}n.uV=3;n.W&&n.W.kx();n.V3&&(n.gt=Date.now()-k.SE);Z=n;var L=k;Z.Nf=Itx(Z,Z.V$? Z.xo:null,Z.tS);if(L.V$){qWV(Z.B,L);var F=L,v=Z.aQ;v&&F.setTimeout(v);F.dM&&(MY(F),jH(F));Z.S=L}else Jdp(Z);n.j.length>0&&UT(n)}else O[0]!="stop"&&O[0]!="close"||k4(n,7);else n.uV==3&&(O[0]=="stop"||O[0]=="close"?O[0]=="stop"?k4(n,7):n.disconnect():O[0]!="noop"&&n.W&&n.W.Y7(O),n.Y=0)}P0(4)}catch(O){}},eQ_=function(k){this.W=k||10; g.Vs.PerformanceNavigationTiming?(k=g.Vs.performance.getEntriesByType("navigation"),k=k.length>0&&(k[0].nextHopProtocol=="hq"||k[0].nextHopProtocol=="h2")):k=!!(g.Vs.chrome&&g.Vs.chrome.loadTimes&&g.Vs.chrome.loadTimes()&&g.Vs.chrome.loadTimes().wasFetchedViaSpdy);this.J=k?this.W:1;this.S=null;this.J>1&&(this.S=new Set);this.B=null;this.j=[]},Bv8=function(k){return k.B?!0:k.S?k.S.size>=k.J:!1},xf=function(k){return k.B?1:k.S?k.S.size:0},yA=function(k,U){return k.B?k.B==U:k.S?k.S.has(U):!1},ii=function(k, U){k.S?k.S.add(U):k.B=U},qWV=function(k,U){k.B&&k.B==U?k.B=null:k.S&&k.S.has(U)&&k.S.delete(U)},Zm=function(k){if(k.B!=null)return k.j.concat(k.B.Y); if(k.S!=null&&k.S.size!==0){let U=k.j;for(const n of k.S.values())U=U.concat(n.Y);return U}return g.wb(k.j)},Pes=function(k,U){const n=new D$; if(g.Vs.Image){const Z=new Image;Z.onload=g.N6(Cg,n,"TestLoadImage: loaded",!0,U,Z);Z.onerror=g.N6(Cg,n,"TestLoadImage: error",!1,U,Z);Z.onabort=g.N6(Cg,n,"TestLoadImage: abort",!1,U,Z);Z.ontimeout=g.N6(Cg,n,"TestLoadImage: timeout",!1,U,Z);g.Vs.setTimeout(function(){if(Z.ontimeout)Z.ontimeout()},1E4); Z.src=k}else U(!1)},ssV=function(k,U){const n=new D$,Z=new AbortController,C=setTimeout(()=>{Z.abort(); Cg(n,"TestPingServer: timeout",!1,U)},1E4); fetch(k,{signal:Z.signal}).then(r=>{clearTimeout(C);r.ok?Cg(n,"TestPingServer: ok",!0,U):Cg(n,"TestPingServer: server error",!1,U)}).catch(()=>{clearTimeout(C); Cg(n,"TestPingServer: error",!1,U)})},Cg=function(k,U,n,Z,C){try{C&&(C.onload=null,C.onerror=null,C.onabort=null,C.ontimeout=null),Z(n)}catch(r){}},YWV=function(){this.S=new rz},Lg=function(k,U,n){return n&&n.vY?n.vY[k]||U:U},DQs=function(k){this.j=[]; this.xo=this.Nf=this.eE=this.tS=this.S=this.Nj=this.By=this.Wy=this.L=this.Fo=this.D=null;this.Sl=this.TJ=0;this.nW=Lg("failFast",!1,k);this.pN=this.dM=this.X=this.V=this.W=null;this.e5=!0;this.f7=this.IQ=-1;this.Y$=this.Y=this.SE=0;this.n7=Lg("baseRetryDelayMs",5E3,k);this.J3=Lg("retryDelaySeedMs",1E4,k);this.FA=Lg("forwardChannelMaxRetries",2,k);this.PV=Lg("forwardChannelRequestTimeoutMs",2E4,k);this.EU=k&&k.HWN||void 0;this.F2=k&&k.qDg||void 0;this.tH=k&&k.XSo||!1;this.aQ=void 0;this.V$=k&&k.QR|| !1;this.J="";this.B=new eQ_(k&&k.FZb);this.lZ=Math.min(k&&k.fD4||1E3,1E3);this.TN=new YWV;this.bL=k&&k.O6L||!1;this.uL=k&&k.Bho||!1;this.bL&&this.uL&&(this.uL=!1);this.l2=k&&k.llM||!1;k&&k.pnL&&(this.e5=!1);this.V3=!this.bL&&this.e5&&k&&k.xQ4||!1;this.Hc=void 0;k&&k.A$&&k.A$>0&&(this.Hc=k.A$);this.GJ=void 0;this.gt=0;this.Xo=!1;this.h8=this.x$=null},l3=function(k){k.S&&(Fv(k),k.S.cancel(),k.S=null)},opV=function(k){l3(k); k.X&&(g.Vs.clearTimeout(k.X),k.X=null);c0(k);k.B.cancel();k.V&&(typeof k.V==="number"&&g.Vs.clearTimeout(k.V),k.V=null)},UT=function(k){Bv8(k.B)||k.V||(k.V=!0,g.cz(k.vz,k),k.SE=0)},js7=function(k,U){if(xf(k.B)>=k.B.J-(k.V?1:0))return!1; if(k.V)return k.j=U.Y.concat(k.j),!0;if(k.uV==1||k.uV==2||k.SE>=(k.nW?0:k.FA))return!1;k.V=Yf((0,g.pz)(k.vz,k,U),Wl8(k,k.SE));k.SE++;return!0},GXV=function(k,U){var n; U?n=U.xo:n=k.TJ++;const Z=k.eE.clone();g.rf(Z,"SID",k.J);g.rf(Z,"RID",n);g.rf(Z,"AID",k.IQ);vA(k,Z);k.L&&k.D&&g.gf(Z,k.L,k.D);n=new o9(k,k.J,n,k.SE+1);k.L===null&&(n.eE=k.D);U&&(k.j=U.Y.concat(k.j));U=SWO(k,n,k.lZ);n.setTimeout(Math.round(k.PV*.5)+Math.round(k.PV*.5*Math.random()));ii(k.B,n);W0(n,Z,U)},vA=function(k,U){k.Wy&&g.tm(k.Wy,function(n,Z){g.rf(U,Z,n)}); k.W&&g.tm({},function(n,Z){g.rf(U,Z,n)})},SWO=function(k,U,n){n=Math.min(k.j.length,n); const Z=k.W?(0,g.pz)(k.W.qy,k.W,k):null;a:{var C=k.j;let F=-1;for(;;){const v=["count="+n];F==-1?n>0?(F=C[0].S,v.push("ofs="+F)):F=0:v.push("ofs="+F);let O=!0;for(let w=0;w=3)return!1; k.Y$++;k.X=Yf((0,g.pz)(k.o6,k),Wl8(k,k.Y));k.Y++;return!0},Fv=function(k){k.x$!=null&&(g.Vs.clearTimeout(k.x$),k.x$=null)},ft7=function(k){k.S=new o9(k,k.J,"rpc",k.Y$); k.L===null&&(k.S.eE=k.D);k.S.aQ=0;var U=k.Nf.clone();g.rf(U,"RID","rpc");g.rf(U,"SID",k.J);g.rf(U,"AID",k.IQ);g.rf(U,"CI",k.pN?"0":"1");!k.pN&&k.Hc&&g.rf(U,"TO",k.Hc);g.rf(U,"TYPE","xmlhttp");vA(k,U);k.L&&k.D&&g.gf(U,k.L,k.D);k.aQ&&k.S.setTimeout(k.aQ);var n=k.S;k=k.xo;n.IQ=1;n.X=Ce(U.clone());n.D=null;n.By=!0;Qsi(n,k)},c0=function(k){k.dM!=null&&(g.Vs.clearTimeout(k.dM),k.dM=null)},tx_=function(k,U){var n=null; if(k.S==U){c0(k);Fv(k);k.S=null;var Z=2}else if(yA(k.B,U))n=U.Y,qWV(k.B,U),Z=1;else return;if(k.uV!=0)if(U.V)if(Z==1){n=U.D?U.D.length:0;U=Date.now()-U.SE;var C=k.SE;Z=B0();Z.dispatchEvent(new bTE(Z,n,U,C));UT(k)}else Jdp(k);else{var r=U.GJ;C=U.getLastError();if(C==3||C==0&&r>0||!(Z==1&&js7(k,U)||Z==2&&mo(k)))switch(n&&n.length>0&&(U=k.B,U.j=U.j.concat(n)),C){case 1:k4(k,5);break;case 4:k4(k,10);break;case 3:k4(k,6);break;default:k4(k,2)}}},Wl8=function(k,U){let n=k.n7+Math.floor(Math.random()*k.J3); k.isActive()||(n*=2);return n*U},k4=function(k,U){if(U==2){var n=(0,g.pz)(k.Im,k),Z=k.F2; const C=!Z;Z=new g.lU(Z||"//www.google.com/images/cleardot.gif");g.Vs.location&&g.Vs.location.protocol=="http"||g.mj(Z,"https");Ce(Z);C?Pes(Z.toString(),n):ssV(Z.toString(),n)}else sA(2);k.uV=0;k.W&&k.W.wZ(U);Mxi(k);opV(k)},Mxi=function(k){k.uV=0; k.h8=[];if(k.W){const U=Zm(k.B);if(U.length!=0||k.j.length!=0)g.u2(k.h8,U),g.u2(k.h8,k.j),k.B.j.length=0,g.wb(k.j),k.j.length=0;k.W.MH()}},ydp=function(k){if(k.uV==0)return k.h8; let U=[];g.u2(U,Zm(k.B));g.u2(U,k.j);return U},Itx=function(k,U,n){var Z=g.Lp(n); Z.S!=""?(U&&g.kh(Z,U+"."+Z.S),g.iE(Z,Z.j)):(Z=g.Vs.location,Z=DwV(Z.protocol,U?U+"."+Z.hostname:Z.hostname,+Z.port,n));U=k.By;n=k.Nj;U&&n&&g.rf(Z,U,n);g.rf(Z,"VER",k.Fk);vA(k,Z);return Z},Klm=function(k,U,n){if(U&&!k.V$)throw Error("Can't create secondary domain capable XhrIo object."); U=k.tH&&!k.EU?new g.Ih(new g.GG({lq:n})):new g.Ih(k.EU);U.L=k.V$;return U},cd2=function(){},ltp=function(){},wz=function(k,U){g.q1.call(this); this.S=new DQs(U);this.V=k;this.B=U&&U.gr||null;k=U&&U.NW||null;U&&U.Dky&&(k?k["X-Client-Protocol"]="webchannel":k={"X-Client-Protocol":"webchannel"});this.S.D=k;k=U&&U.hmg||null;U&&U.s7&&(k?k["X-WebChannel-Content-Type"]=U.s7:k={"X-WebChannel-Content-Type":U.s7});U&&U.Q8&&(k?k["X-WebChannel-Client-Profile"]=U.Q8:k={"X-WebChannel-Client-Profile":U.Q8});this.S.Fo=k;(k=U&&U.DmQ)&&!g.LL(k)&&(this.S.L=k);this.L=U&&U.QR||!1;this.W=U&&U.YDy||!1;(U=U&&U.N4)&&!g.LL(U)&&(this.S.By=U,g.oV(this.B,U)&&(k=this.B, U in k&&delete k[U]));this.j=new OT(this)},mQi=function(k){J0.call(this); k.__headers__&&(this.headers=k.__headers__,this.statusCode=k.__status__,delete k.__headers__,delete k.__status__);const U=k.__sm__;U?this.data=(this.S=g.B7(U))?g.Mx(U,this.S):U:this.data=k},xQE=function(k){eH.call(this); this.status=1;this.errorCode=k},OT=function(k){this.S=k},ui=function(k,U){this.J=k; this.S=U},gz=function(k,U){if(typeof k!=="function")throw Error("Fn must not be null and must be a function"); return g.Vs.setTimeout(function(){k()},U)},ET=function(){Xv.dispatchEvent(new kS_)},Aw=function(k,U,n,Z){this.S=k; this.J=U;this.L=n;this.V=Z||1;this.B=45E3;this.j=new g.XL(this);this.W=new g.vT;this.W.setInterval(250)},U1x=function(k,U,n){k.jD=1; k.dn=Ce(U.clone());k.xd=n;k.By=!0;i5O(k,null)},dz=function(k,U,n,Z,C){k.jD=1; k.dn=Ce(U.clone());k.xd=null;k.By=n;C&&(k.QH=!1);i5O(k,Z)},i5O=function(k,U){k.zI=Date.now(); Vl(k);k.m2=k.dn.clone();rQ(k.m2,"t",k.V);k.WQ=0;k.Qg=k.S.Ot(k.S.Qn()?U:null);k.qx>0&&(k.cQ=new g.EG((0,g.pz)(k.PR,k,k.Qg),k.qx));k.j.listen(k.Qg,"readystatechange",k.Os);U=k.rB?g.c7(k.rB):{};k.xd?(k.Jt="POST",U["Content-Type"]="application/x-www-form-urlencoded",k.Qg.send(k.m2,k.Jt,k.xd,U)):(k.Jt="GET",k.QH&&!g.CK&&(U.Connection="close"),k.Qg.send(k.m2,k.Jt,null,U));k.S.oN(1)},Z5V=function(k,U){var n=k.WQ,Z=U.indexOf("\n",n); if(Z==-1)return HA;n=Number(U.substring(n,Z));if(isNaN(n))return nNB;Z+=1;if(Z+n>U.length)return HA;U=U.slice(Z,Z+n);k.WQ=Z+n;return U},Vl=function(k){k.Et=Date.now()+k.B; CcO(k,k.B)},CcO=function(k,U){if(k.KP!=null)throw Error("WatchDog timer not null"); k.KP=gz((0,g.pz)(k.Es,k),U)},rk_=function(k){k.KP&&(g.Vs.clearTimeout(k.KP),k.KP=null)},Ri=function(k){k.S.Ty()||k.Sr||k.S.p$(k)},hw=function(k){rk_(k); g.MD(k.cQ);k.cQ=null;k.W.stop();k.j.removeAll();if(k.Qg){const U=k.Qg;k.Qg=null;U.abort();U.dispose()}k.zV&&(k.zV=null)},L47=function(k,U){try{k.S.d6(k,U),k.S.oN(4)}catch(n){}},vN8=function(k,U,n,Z,C){if(Z==0)n(!1); else{var r=C||0;Z--;F4p(k,U,function(L){L?n(!0):g.Vs.setTimeout(function(){vN8(k,U,n,Z,r)},r)})}},F4p=function(k,U,n){const Z=new Image; Z.onload=function(){try{bi(Z),n(!0)}catch(C){}}; Z.onerror=function(){try{bi(Z),n(!1)}catch(C){}}; Z.onabort=function(){try{bi(Z),n(!1)}catch(C){}}; Z.ontimeout=function(){try{bi(Z),n(!1)}catch(C){}}; g.Vs.setTimeout(function(){if(Z.ontimeout)Z.ontimeout()},U); Z.src=k},bi=function(k){k.onload=null; k.onerror=null;k.onabort=null;k.ontimeout=null},O58=function(k){this.S=k; this.B=new rz},wzb=function(k){const U=z7(k.S,k.Rg,"/mail/images/cleardot.gif"); Ce(U);vN8(U.toString(),5E3,(0,g.pz)(k.gL,k),3,2E3);k.oN(1)},Kg=function(k){var U=k.S.V; U!=null?(ET(),U?(ET(),Ql(k.S,k,!1)):(ET(),Ql(k.S,k,!0))):(k.lB=new Aw(k),k.lB.rB=k.Vm,U=k.S,U=z7(U,U.Qn()?k.Iy:null,k.C$),ET(),rQ(U,"TYPE","xmlhttp"),dz(k.lB,U,!1,k.Iy,!1))},T7=function(k,U,n){this.S=1; this.B=[];this.j=[];this.W=new rz;this.D=k||null;this.V=U!=null?U:null;this.X=n||!1},ur_=function(k,U){this.S=k; this.map=U;this.context=null},gNb=function(k,U,n,Z){g.g5.call(this,"timingevent",k); this.size=U;this.rtt=n;this.retries=Z},XzO=function(k){g.g5.call(this,"serverreachability",k)},EN2=function(k){k.VC(1,0); k.ZZ=z7(k,null,k.Ac);ai(k)},Aks=function(k){k.xn&&(k.xn.abort(),k.xn=null); k.n1&&(k.n1.cancel(),k.n1=null);k.kD&&(g.Vs.clearTimeout(k.kD),k.kD=null);$4(k);k.xG&&(k.xG.cancel(),k.xG=null);k.l3&&(g.Vs.clearTimeout(k.l3),k.l3=null)},pg=function(k,U){if(k.S==0)throw Error("Invalid operation: sending map when state is closed"); k.B.push(new ur_(k.pJ++,U));k.S!=2&&k.S!=3||ai(k)},d1B=function(k){let U=0; k.n1&&U++;k.xG&&U++;return U},ai=function(k){k.xG||k.l3||(k.l3=gz((0,g.pz)(k.z7,k),0),k.sz=0)},H52=function(k,U){if(k.S==1){if(!U){k.jr=Math.floor(Math.random()*1E5); U=k.jr++;const n=new Aw(k,"",U);n.rB=k.K4;const Z=NS(k),C=k.ZZ.clone();g.rf(C,"RID",U);g.rf(C,"CVER","1");tw(k,C);U1x(n,C,Z);k.xG=n;k.S=2}}else k.S==3&&(U?Vqs(k,U):k.B.length==0||k.xG||Vqs(k))},Vqs=function(k,U){if(U)if(k.z8>6){k.B=k.j.concat(k.B); k.j.length=0;var n=k.jr-1;U=NS(k)}else n=U.L,U=U.xd;else n=k.jr++,U=NS(k);const Z=k.ZZ.clone();g.rf(Z,"SID",k.J);g.rf(Z,"RID",n);g.rf(Z,"AID",k.uX);tw(k,Z);n=new Aw(k,k.J,n,k.sz+1);n.rB=k.K4;n.setTimeout(1E4+Math.round(1E4*Math.random()));k.xG=n;U1x(n,Z,U)},tw=function(k,U){k.lV&&(k=k.lV.jI())&&g.tm(k,function(n,Z){g.rf(U,Z,n)})},NS=function(k){const U=Math.min(k.B.length,1E3),n=["count="+U]; let Z;k.z8>6&&U>0?(Z=k.B[0].S,n.push("ofs="+Z)):Z=0;for(let C=0;C=3)return!1; k.L++;k.kD=gz((0,g.pz)(k.xx,k),hMx(k,k.Uz));k.Uz++;return!0},Ql=function(k,U,n){k.lr=k.V==null?n:!k.V; k.aq=U.YO;k.X||EN2(k)},$4=function(k){k.Q_!=null&&(g.Vs.clearTimeout(k.Q_),k.Q_=null)},hMx=function(k,U){let n=5E3+Math.floor(Math.random()*1E4); k.isActive()||(n*=2);return n*U},qS=function(k,U){if(U==2||U==9){var n=null; k.lV&&(n=null);var Z=(0,g.pz)(k.W3,k);n||(n=new g.lU("//www.google.com/images/cleardot.gif"),Ce(n));F4p(n.toString(),1E4,Z)}else ET();b58(k,U)},b58=function(k,U){k.S=0; k.lV&&k.lV.Qj(U);zMB(k);Aks(k)},zMB=function(k){k.S=0; k.aq=-1;if(k.lV)if(k.j.length==0&&k.B.length==0)k.lV.Tf();else{const U=g.wb(k.j),n=g.wb(k.B);k.j.length=0;k.B.length=0;k.lV.Tf(U,n)}},z7=function(k,U,n){let Z=g.Lp(n); if(Z.S!="")U&&g.kh(Z,U+"."+Z.S),g.iE(Z,Z.j);else{const C=window.location;Z=DwV(C.protocol,U?U+"."+C.hostname:C.hostname,+C.port,n)}k.B2&&g.tm(k.B2,function(C,r){g.rf(Z,r,C)}); g.rf(Z,"VER",k.z8);tw(k,Z);return Z},Qos=function(){},K4m=function(){this.S=[]; this.B=[]},T5_=function(k,U){this.action=k; this.params=U||{}},Jw=function(k,U){g.ca.call(this); this.S=new g.iX(this.uF,0,this);g.K(this,this.S);this.nZ=5E3;this.retryCount=this.g$=0;if(typeof k==="function")U&&(k=(0,g.pz)(k,U));else if(k&&typeof k.handleEvent==="function")k=(0,g.pz)(k.handleEvent,k);else throw Error("Invalid listener argument");this.B=k},es=function(k,U,n=!1,Z=()=>"",C=!1,r=!1,L=!1,F=()=>g.f5({}),v=!1,O,w){this.V$=k; this.SE=U;this.L=new g.q_;this.V=w;this.B=(this.j=!!O)?O(()=>{this.Y_()}):new Jw(this.Y_,this); this.S=null;this.D=!1;this.Y=null;this.By="";this.x$=this.dM=0;this.J=[];this.GJ=n;this.eE=Z;this.X=r;this.IQ=F;this.Fo=L;this.Wy=null;this.W=g.f5();this.h8=C;this.bL=v;this.Xo=new a8B;this.pN=new $1V;this.uL=new pzO;this.aQ=new N5V;this.TJ=new tq8;this.Y$=new I8_;this.xo=new qlO},JkV=function(k,U,n,Z,C){BA(k); if(k.S){const r=g.Y("ID_TOKEN"),L=k.S.K4||{};r?L["x-youtube-identity-token"]=r:delete L["x-youtube-identity-token"];k.S.K4=L}Z?(Z.getState()!=3&&d1B(Z)==0||Z.getState(),k.S.connect(U,n,k.SE,Z.J,Z.uX)):C?k.S.connect(U,n,k.SE,C.sessionId,C.arrayId):k.S.connect(U,n,k.SE);k.j&&!k.B.isActive()&&k.B.start();k.V&&k.V.OWN()},B5i=function(k,U){return k.bL?!Object.values(eMb).includes(U):!1},Pcb=async function(k){try{await PA(k)}finally{var U=k.J; k.J=[];var n=U;U=U.length;for(let Z=0;Z{if(k.S){let n=k.S.K4||{}; U&&Object.keys(U).length>0?n={...n,...U}:delete n.Authorization;k.S.K4=n}}).U0(()=>{}),()=>{k.Wy=null})},Y4=function(k){this.scheme="https"; this.port=this.domain="";this.S="/api/lounge";this.B=!0;k=k||document.location.href;const U=Number(g.xT(k)[4]||null)||"";U&&(this.port=":"+U);this.domain=g.iw(k)||"";k=g.u7();k.search("MSIE")>=0&&(k=k.match(/MSIE ([\d.]+)/)[1],g.wu(k,"10.0")<0&&(this.B=!1))},Dm=function(k,U){let n=k.S; k.B&&(n=k.scheme+"://"+k.domain+k.port+k.S);return g.wV(n+U,{})},YlE=function(k){g.bc(k.channel,"m",()=>{k.V=3; k.j.reset();k.X=null;k.L=0;for(const U of k.Y)k.channel&&k.channel.send(U);k.Y=[];k.publish("webChannelOpened");k.eE.S("WEB_CHANNEL")}); g.bc(k.channel,"n",()=>{k.V=0;k.j.isActive()||k.publish("webChannelClosed");const U=k.channel?.J().j();U&&(k.Y=[...U]);k.x$.S("WEB_CHANNEL")}); g.bc(k.channel,"p",U=>{const n=U.data;n[0]==="gracefulReconnect"?(k.j.start(),k.channel&&k.channel.close()):k.publish("webChannelMessage",new T5_(n[0],n[1]));k.Id=U.statusCode;k.Wy.S("WEB_CHANNEL")}); g.bc(k.channel,"o",()=>{k.Id===401||k.j.start();k.publish("webChannelError");k.By.S("WEB_CHANNEL","")})},oi=function(k){const U=k.SE(); U?k.J["x-youtube-lounge-xsrf-token"]=U:delete k.J["x-youtube-lounge-xsrf-token"]},jom=function(k,U,n=()=>"",Z,C){const r=()=>new es(Dm(k,"/bc"),U,!1,n,Z); return g.GM("enable_mdx_web_channel_desktop")?new D18(()=>new oNx(Dm(k,"/wc"),U,n)):new W4V(r,C)},Mqs=function(){var k=Sls; GSE();WA.push(k);f8V()},js=function(k,U){GSE(); const n=ykb(k,String(U));WA.length==0?ck_(n):(f8V(),g.SU(WA,function(Z){Z(n)}))},Ss=function(k){js("CP",k)},GSE=function(){WA||(WA=g.RP("yt.mdx.remote.debug.handlers_")||[],g.HJ("yt.mdx.remote.debug.handlers_",WA))},ck_=function(k){const U=(G7+1)%50; G7=U;fg[U]=k;MS||(MS=U==49)},f8V=function(){var k=WA; if(fg[0]){var U=MS?G7:-1;do{U=(U+1)%50;const n=fg[U];g.SU(k,function(Z){Z(n)})}while(U!=G7); fg=Array(50);G7=-1;MS=!1}},ykb=function(k,U){let n=(Date.now()-l88)/1E3; n.toFixed&&(n=n.toFixed(3));const Z=[];Z.push("[",n+"s","] ");Z.push("[","yt.mdx.remote","] ");Z.push(k+": "+U,"\n");return Z.join("")},yl=function(k){g.O8.call(this); this.V=k;this.screens=[]},m1V=function(k,U){const n=k.get(U.uuid)||k.get(U.id); if(n)return k=n.name,n.id=U.id||n.id,n.name=U.name,n.token=U.token,n.uuid=U.uuid||n.uuid,n.name!=k;k.screens.push(U);return!0},x1V=function(k,U){let n=k.screens.length!=U.length; k.screens=g.GN(k.screens,function(C){return!!VA(U,C)}); const Z=U.length;for(let C=0;C0&&k.JU.idType!="shortLived"); g.Lr("yt-remote-automatic-screen-cache",g.fz(k,ynb))},CC=function(k){k.W=g.F6("yt-remote-device-id-map")||{}},rE=function(k,U,n){g.O8.call(this); this.By=n;this.J=k;this.B=U;this.S=null},LC=function(k,U){k.S=U; k.publish("sessionScreen",k.S)},utB=function(k,U){k.S&&(k.S.token=U,Zc(k.J,k.S)); k.publish("sessionScreen",k.S)},Fe=function(k,U){js(k.By,U)},XTB=function(k,U){g.WE(k.dM); k.dM=0;U?k.config_.enableCastLoungeToken&&U.loungeToken?U.deviceId?k.S&&k.S.uuid==U.deviceId||(U.loungeTokenRefreshIntervalMs?gjY(k,{name:k.B.friendlyName,screenId:U.screenId,loungeToken:U.loungeToken,dialId:U.deviceId,screenIdType:"shortLived"},U.loungeTokenRefreshIntervalMs):(g.Vt(Error(`No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: ${JSON.stringify(U)}.`)),vw(k,U.screenId))):(g.Vt(Error(`No device id presents in mdxSessionStatusData: ${JSON.stringify(U)}.`)),vw(k,U.screenId)): vw(k,U.screenId):k.Af(Error("Waiting for session status timed out."))},Ej7=function(k){g.WE(k.D); k.D=0;g.WE(k.L);k.L=0;g.WE(k.dM);k.dM=0;g.WE(k.W);k.W=0;g.WE(k.X);k.X=0},AVp=function(k,U){k.info("sendYoutubeMessage_: "+U+" "+g.Ki()); const n={};n.type=U;k.j?k.j.sendMessage("urn:x-cast:com.google.youtube.mdx",n,()=>{},(0,g.pz)(function(){Fe(this,"Failed to send message: "+U+".")},k)):Fe(k,"Sending yt message without session: "+g.Ki(n))},Vzi=function(k){AVp(k,"getLoungeToken"); g.WE(k.W);k.W=g.D2(()=>{de2(k,null)},3E4)},Ou=function(k,U){g.WE(k.X); k.X=0;U==0?Vzi(k):k.X=g.D2(()=>{Vzi(k)},U)},de2=function(k,U){g.WE(k.W); k.W=0;let n=null;U?U.loungeToken?k.S?.token==U.loungeToken&&(n="staleLoungeToken"):n="missingLoungeToken":n="noLoungeTokenResponse";n?(k.info("Did not receive a new lounge token in onLoungeToken_ with "+`data: ${JSON.stringify(U)}, error: ${n}`),Ou(k,3E4)):(utB(k,U.loungeToken),Ou(k,U.loungeTokenRefreshIntervalMs))},vw=function(k,U){U?(k.info("onConnectedScreenId_: Received screenId: "+U),k.S&&k.S.id==U||k.Wy(U,n=>{LC(k,n)},()=>k.Af(),5)):k.Af(Error("Waiting for session status timed out."))},HiE= function(k,U,n,Z){g.WE(k.L); k.L=0;FXB(k.J,U,C=>{C||Z<0?n(C):k.L=g.D2(()=>{HiE(k,U,n,Z-1)},300)})},gjY=function(k,U,n){k.info(`onConnectedScreenData_: Received screenData: ${JSON.stringify(U)}`); const Z=new gQ(U);HiE(k,Z,C=>{C?(Zc(k.J,Z),LC(k,Z),Ou(k,n)):(g.Vt(Error(`CastSession, RemoteScreen from screenData: ${JSON.stringify(U)} is not online.`)),k.Af())},5)},wE=function(k){return new Promise(U=>{k.SE=dQ(); if(k.eE){const n=new chrome.cast.DialLaunchResponse(!0,R7V(k));U(n);h7B(k)}else k.Y=()=>{g.WE(k.dM);k.Y=()=>{}; k.dM=NaN;const n=new chrome.cast.DialLaunchResponse(!0,R7V(k));U(n);h7B(k)},k.dM=g.D2(()=>{k.Y()},100)})},biV=function(k){g.WE(k.L); k.L=0;g.WE(k.X);k.X=0;k.W();k.W=()=>{}; g.WE(k.dM)},uP=function(k){return!(!k.config_.enableDialLoungeToken||!k.j?.getDialAppInfo)},gE=function(k,U){k.info(`getDialAppInfoWithTimeout_ ${U}`); uP(k)&&(g.WE(k.X),k.X=0,U==0?z7V(k):k.X=g.D2(()=>{z7V(k)},U))},h7B=function(k){k.W=k.J.Jk(k.SE,k.B.label,k.B.friendlyName,uP(k),(U,n)=>{k.W=()=>{}; LC(k,U);U.idType=="shortLived"&&n>0&&gE(k,n)},U=>{k.W=()=>{}; k.Af(U)})},R7V=function(k){var U={}; U.pairingCode=k.SE;U.theme=k.IQ;LlB()&&(U.env_useStageMdx=1);return g.OF(U)},QhE=function(k,U){const n=k.D.receiver.label,Z=k.B.friendlyName; return(new Promise(C=>{rVE(k.J,n,U,Z,r=>{r&&r.token&&LC(k,r);C(r)},r=>{Fe(k,"Failed to get DIAL screen: "+r); C(null)})})).then(C=>C&&C.token?new chrome.cast.DialLaunchResponse(!1):wE(k))},TSE=function(k,U,n){k.info(`initOnConnectedScreenDataPromise_: Received screenData: ${JSON.stringify(U)}`); const Z=new gQ(U);return(new Promise(C=>{KX7(k,Z,r=>{r?(Zc(k.J,Z),LC(k,Z),gE(k,n)):g.Vt(Error(`DialSession, RemoteScreen from screenData: ${JSON.stringify(U)} is not online.`));C(r)},5)})).then(C=>C?new chrome.cast.DialLaunchResponse(!1):wE(k))},KX7=function(k,U,n,Z){g.WE(k.L); k.L=0;FXB(k.J,U,C=>{C||Z<0?n(C):k.L=g.D2(()=>{KX7(k,U,n,Z-1)},300)})},z7V=function(k){uP(k)&&k.j.getDialAppInfo(U=>{k.info(`getDialAppInfo dialLaunchData: ${JSON.stringify(U)}`); U=U.extraData||{};let n=null;U.loungeToken?k.S?.token==U.loungeToken&&(n="staleLoungeToken"):n="missingLoungeToken";n?gE(k,3E4):(utB(k,U.loungeToken),gE(k,U.loungeTokenRefreshIntervalMs))},U=>{k.info(`getDialAppInfo error: ${U}`); gE(k,3E4)})},Sls=function(k){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(k)},$eV=function(k){const U=k.B.fC(); let n=k.S&&k.S.B;k=g.fz(U,function(Z){n&&XN(Z,n.label)&&(n=null);const C=Z.uuid?Z.uuid:Z.id;let r=aHV(this,Z);r?(r.label=C,r.friendlyName=Z.name):(r=new chrome.cast.Receiver(C,Z.name),r.receiverType=chrome.cast.ReceiverType.CUSTOM);return r},k); n&&(n.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(n=new chrome.cast.Receiver(n.label,n.friendlyName),n.receiverType=chrome.cast.ReceiverType.CUSTOM),k.push(n));return k},Xe=function(k){return k.X||!!k.j.length||!!k.S},Eu=function(k){js("Controller",k)},AL=function(k,U,n){U!=k.S&&(g.MD(k.S),(k.S=U)?(n?k.publish("yt-remote-cast2-receiver-resumed",U.B):k.publish("yt-remote-cast2-receiver-selected",U.B),U.subscribe("sessionScreen",(0,g.pz)(k.dM,k,U)),U.subscribe("sessionFailed",()=>pTO(k,U)),U.S? k.publish("yt-remote-cast2-session-change",U.S):n&&k.S.V(null)):k.publish("yt-remote-cast2-session-change",null))},aHV=function(k,U){return U?g.kB(k.j,function(n){return XN(U,n.label)},k):null},pTO=function(k,U){k.S==U&&k.publish("yt-remote-cast2-session-failed")},e7p=function(k,U,n,Z){Z.disableCastApi?dE("Cannot initialize because disabled by Mdx config."):NSs()?tz8(U,Z)&&(VR(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?IHm(k,n):(window.__onGCastApiAvailable=function(C,r){C?IHm(k,n):(Hw("Failed to load cast API: "+ r),RN(!1),VR(!1),g.vi("yt-remote-cast-available"),g.vi("yt-remote-cast-receiver"),qhi(),n(!1))},Z.loadCastApiSetupScript?g.v9(JVE):window.navigator.userAgent.indexOf("Android")>=0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?a9()>=60&&Xx8():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?pe():a9()>=89?AdV():(NY(),$f(Eps.map(wx7))))):dE("Cannot initialize because not running Chrome")},qhi=function(){dE("dispose"); const k=hL();k&&k.dispose();g.HJ("yt.mdx.remote.cloudview.instance_",null);BSY(!1);g.LN(bP);bP.length=0},zB=function(){return!!g.F6("yt-remote-cast-installed")},PDx=function(){const k=g.F6("yt-remote-cast-receiver"); return k?k.friendlyName:null},sh7=function(){dE("clearCurrentReceiver"); g.vi("yt-remote-cast-receiver")},Yhx=function(){return zB()?hL()?hL().getCastSession():(Hw("getCastSelector: Cast is not initialized."),null):(Hw("getCastSelector: Cast API is not installed!"),null)},KC=function(){zB()?hL()?QR()?(dE("Requesting cast selector."),hL().requestSession()):(dE("Wait for cast API to be ready to request the session."),bP.push(g.rk("yt-remote-cast2-api-ready",KC))):Hw("requestCastSelector: Cast is not initialized."):Hw("requestCastSelector: Cast API is not installed!")},TB= function(k,U){QR()?hL().setConnectedScreenStatus(k,U):Hw("setConnectedScreenStatus called before ready.")},NSs=function(){var k=g.u7().search(/ (CrMo|Chrome|CriOS)\//)>=0; return g.X3||k},Dep=function(k,U){hL().init(k,U)},tz8=function(k,U){let n=!1; hL()||(k=new aN(k,U),k.subscribe("yt-remote-cast2-availability-change",function(Z){g.Lr("yt-remote-cast-available",Z);TA("yt-remote-cast2-availability-change",Z)}),k.subscribe("yt-remote-cast2-receiver-selected",function(Z){dE("onReceiverSelected: "+Z.friendlyName); g.Lr("yt-remote-cast-receiver",Z);TA("yt-remote-cast2-receiver-selected",Z)}),k.subscribe("yt-remote-cast2-receiver-resumed",function(Z){dE("onReceiverResumed: "+Z.friendlyName); g.Lr("yt-remote-cast-receiver",Z);TA("yt-remote-cast2-receiver-resumed",Z)}),k.subscribe("yt-remote-cast2-session-change",function(Z){dE("onSessionChange: "+EA(Z)); Z||g.vi("yt-remote-cast-receiver");TA("yt-remote-cast2-session-change",Z)}),g.HJ("yt.mdx.remote.cloudview.instance_",k),n=!0); dE("cloudview.createSingleton_: "+n);return n},hL=function(){return g.RP("yt.mdx.remote.cloudview.instance_")},IHm=function(k,U){RN(!0); VR(!1);Dep(k,function(n){n?(BSY(!0),g.FR("yt-remote-cast2-api-ready")):(Hw("Failed to initialize cast API."),RN(!1),g.vi("yt-remote-cast-available"),g.vi("yt-remote-cast-receiver"),qhi());U(n)})},dE=function(k){js("cloudview",k)},Hw=function(k){js("cloudview",k)},RN=function(k){dE("setCastInstalled_ "+k); g.Lr("yt-remote-cast-installed",k)},QR=function(){return!!g.RP("yt.mdx.remote.cloudview.apiReady_")},BSY=function(k){dE("setApiReady_ "+k); g.HJ("yt.mdx.remote.cloudview.apiReady_",k)},VR=function(k){g.HJ("yt.mdx.remote.cloudview.initializing_",k)},$n=function(k){this.index=-1; this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.W=this.V=0;this.trackData=null;this.hasNext=this.hasPrevious=!1;this.loadedTime=this.j=this.L=this.B=0;this.S=NaN;this.J=!1;this.reset(k)},pC=function(k){k.audioTrackId=null; k.trackData=null;k.playerState=-1;k.hasPrevious=!1;k.hasNext=!1;k.V=0;k.W=g.tS();k.B=0;k.L=0;k.j=0;k.loadedTime=0;k.S=NaN;k.J=!1},NI=function(k){return k.isPlaying()?(g.tS()-k.W)/1E3:0},tL=function(k,U){k.V=U; k.W=g.tS()},IN=function(k){switch(k.playerState){case 1:case 1081:return(g.tS()-k.W)/1E3+k.V; case -1E3:return 0}return k.V},ojE=function(k){return k.J?k.L+NI(k):k.L},qI=function(k,U,n){const Z=k.videoId; k.videoId=U;k.index=n;U!=Z&&pC(k)},JL=function(k){const U={}; U.index=k.index;U.listId=k.listId;U.videoId=k.videoId;U.playerState=k.playerState;U.volume=k.volume;U.muted=k.muted;U.audioTrackId=k.audioTrackId;U.trackData=g.l2(k.trackData);U.hasPrevious=k.hasPrevious;U.hasNext=k.hasNext;U.playerTime=k.V;U.playerTimeAt=k.W;U.seekableStart=k.B;U.seekableEnd=k.L;U.duration=k.j;U.loadedTime=k.loadedTime;U.liveIngestionTime=k.S;return U},WXO=function(k){g.SU("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "), function(U){this.L.push(this.J.subscribe(U,g.N6(this.V$,U),this))},k)},eF=function(k,U){k.B&&(k.B.removeUpdateListener(k.Y),k.B.removeMediaListener(k.D),k.V(null)); k.B=U;k.B&&(Ss("Setting cast session: "+k.B.sessionId),k.B.addUpdateListener(k.Y),k.B.addMediaListener(k.D),k.B.media.length&&k.V(k.B.media[0]))},Bw=function(k){return new $n(k.J.getPlayerContextData())},Pw=function(k){return k.getState()==1},Dc=function(k,U,n){return(0,g.pz)(function(Z){this.kJ("Failed to "+U+" with cast v2 channel. Error code: "+Z.code); Z.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.kJ("Retrying "+U+" using MDx browser channel."),Yn(this,U,n))},k)},Yn=function(k,U,n){k.J.sendMessage(U,n)},Ww=function(k,U,n){const Z=Bw(k); tL(Z,n);Z.playerState!=-1E3&&(Z.playerState=U);oN(k,Z)},jF=function(k,U){var n=k.W; n.S.length+n.B.length<50&&k.W.enqueue(U)},oN=function(k,U){jhs(k); k.J.setPlayerContextData(JL(U));WXO(k)},jhs=function(k){g.SU(k.L,function(U){this.J.unsubscribeByKey(U)},k); k.L.length=0},ShV=function(k){const U=k.S.media,n=k.S.customData; if(U&&n){var Z=Bw(k);U.contentId!=Z.videoId&&Ss("Cast changing video to: "+U.contentId);Z.videoId=U.contentId;Z.playerState=n.playerState;tL(Z,k.S.getEstimatedTime());oN(k,Z)}else Ss("No cast media video. Ignoring state update.")},Gkx=function(k){SF("Channel opened"); k.Wy&&(k.Wy=!1,GB(k),k.By=g.D2(()=>{SF("Timing out waiting for a screen.");k.L(1)},15E3))},ZWi=function(k,U){U=U.message; U.params?SF("Received: action="+U.action+", params="+g.Ki(U.params)):SF("Received: action="+U.action+" {}");switch(U.action){case "loungeStatus":U=FN(U.params.devices);k.j=g.fz(U,function(Z){return new u3(Z)}); U=!!g.kB(k.j,function(Z){return Z.type=="LOUNGE_SCREEN"}); fHp(k,U);U=k.TJ("mlm");k.publish("multiStateLoopEnabled",U);break;case "loungeScreenDisconnected":g.v7(k.j,function(Z){return Z.type=="LOUNGE_SCREEN"}); fHp(k,!1);break;case "remoteConnected":let n=new u3(FN(U.params.device));g.kB(k.j,function(Z){return Z.equals(n)})||snV(k.j,n); break;case "remoteDisconnected":n=new u3(FN(U.params.device));g.v7(k.j,function(Z){return Z.equals(n)}); break;case "gracefulDisconnect":break;case "playlistModified":Mzm(k,U,"QUEUE_MODIFIED");break;case "nowPlaying":yV8(k,U);break;case "onStateChange":cVb(k,U);break;case "onAdStateChange":lHO(k,U);break;case "onVolumeChanged":meV(k,U);break;case "onSubtitlesTrackChanged":xeb(k,U);break;case "nowAutoplaying":kGO(k,U);break;case "autoplayDismissed":k.publish("autoplayDismissed");break;case "autoplayUpNext":iWi(k,U);break;case "onAutoplayModeChanged":U87(k,U);break;case "onHasPreviousNextChanged":nuY(k, U);break;case "requestAssistedSignIn":k.publish("assistedSignInRequested",U.params.authCode);break;case "onLoopModeChanged":k.publish("loopModeChange",U.params.loopMode);break;default:SF("Unrecognized action: "+U.action)}},SF=function(k){js("conn",k)},CUB=function(k){k.V=g.D2(()=>{SF("Connecting timeout"); k.L(1)},2E4)},fC=function(k,U){k.publish("proxyStateChange",U)},MI=function(k){g.WE(k.V); k.V=NaN},yR=function(k){g.WE(k.x$); k.x$=NaN},GB=function(k){g.WE(k.By); k.By=NaN},r6E=function(k){return g.kB(k.j,function(U){return U.type=="LOUNGE_SCREEN"})},cw=function(k,U,n){n?SF("Sending: action="+U+", params="+g.Ki(n)):SF("Sending: action="+U); k.B.sendMessage(U,n)},LjV=function(k){yR(k); k.x$=g.D2(()=>{cw(k,"getNowPlaying")},2E4)},Fj_=function(k){g.WE(k.Y); k.Y=g.D2(()=>{k.L(1)},864E5)},fHp=function(k,U){var n=null; if(U){const Z=r6E(k);Z&&(n={clientName:Z.clientName,deviceMake:Z.brand,deviceModel:Z.model,osVersion:Z.osVersion})}g.HJ("yt.mdx.remote.remoteClient_",n);U&&(MI(k),GB(k));n=k.B.hN()&&isNaN(k.V);U==n?U&&(fC(k,1),cw(k,"getSubtitlesTrack")):U?(k.pN()&&k.S.reset(),fC(k,1),cw(k,"getNowPlaying"),Fj_(k)):k.L(1)},xeb=function(k,U){const n=U.params.videoId; delete U.params.videoId;n==k.S.videoId&&(g.Gp(U.params)?k.S.trackData=null:k.S.trackData=U.params,k.publish("remotePlayerChange"))},Mzm=function(k,U,n){const Z=U.params.videoId||U.params.video_id,C=parseInt(U.params.currentIndex,10); k.S.listId=U.params.listId||k.S.listId;qI(k.S,Z,C);k.publish("remoteQueueChange",n)},cVb=function(k,U){var n=parseInt(U.params.currentTime||U.params.current_time,10); tL(k.S,isNaN(n)?0:n);n=parseInt(U.params.state,10);n=isNaN(n)?-1:n;n==-1&&k.S.playerState==-1E3&&(n=-1E3);k.S.playerState=n;n=Number(U.params.loadedTime);k.S.loadedTime=isNaN(n)?0:n;k.S.O9(Number(U.params.duration));n=k.S;var Z=Number(U.params.liveIngestionTime);n.S=Z;n.J=isNaN(Z)?!1:!0;n=k.S;Z=Number(U.params.seekableStartTime);U=Number(U.params.seekableEndTime);n.B=isNaN(Z)?0:Z;n.L=isNaN(U)?0:U;k.S.playerState==1?LjV(k):yR(k);k.publish("remotePlayerChange")},yV8=function(k,U){U.params=U.params|| {}; Mzm(k,U,"NOW_PLAYING_MAY_CHANGE");cVb(k,U);k.publish("autoplayDismissed")},lHO=function(k,U){if(k.S.playerState!=-1E3){var n=1085; switch(parseInt(U.params.adState,10)){case 1:n=1081;break;case 2:n=1084;break;case 0:n=1083}k.S.playerState=n;U=parseInt(U.params.currentTime,10);tL(k.S,isNaN(U)?0:U);k.publish("remotePlayerChange")}},meV=function(k,U){const n=U.params.muted=="true"; k.S.volume=parseInt(U.params.volume,10);k.S.muted=n;k.publish("remotePlayerChange")},kGO=function(k,U){k.X=U.params.videoId; k.publish("nowAutoplaying",parseInt(U.params.timeout,10))},iWi=function(k,U){k.X=U.params.videoId||null; k.publish("autoplayUpNext",k.X)},U87=function(k,U){k.W=U.params.autoplayMode; k.publish("autoplayModeChange",k.W);k.W=="DISABLED"&&k.publish("autoplayDismissed")},nuY=function(k,U){const n=U.params.hasNext=="true"; k.S.hasPrevious=U.params.hasPrevious=="true";k.S.hasNext=n;k.publish("previousNextChange")},uA8=function(k,U){rdb(); if(!Ke||!Ke.get("yt-remote-disable-remote-module-for-dev")){U=g.Y("MDX_CONFIG")||U;xwB();zA();lP||(lP=new Y4(U?U.loungeApiHost:void 0),LlB()&&(lP.S="/api/loungedev"));mS||(mS=g.RP("yt.mdx.remote.deferredProxies_")||[],g.HJ("yt.mdx.remote.deferredProxies_",mS));vus();var n=xn();if(!n){const C=new nC(lP,U?U.disableAutomaticScreenCache||!1:!1);g.HJ("yt.mdx.remote.screenService_",C);n=xn();var Z={};U&&(Z={appId:U.appId,disableDial:U.disableDial,theme:U.theme,loadCastApiSetupScript:U.loadCastApiSetupScript, disableCastApi:U.disableCastApi,enableDialLoungeToken:U.enableDialLoungeToken,enableCastLoungeToken:U.enableCastLoungeToken,forceMirroring:U.forceMirroring});g.HJ("yt.mdx.remote.enableConnectWithInitialState_",U?U.enableConnectWithInitialState||!1:!1);e7p(k,C,function(r){r?ko()&&TB(ko(),"YouTube TV"):C.subscribe("onlineScreenChange",function(){TA("yt-remote-receiver-availability-change")})},Z)}U&&!g.RP("yt.mdx.remote.initialized_")&&(g.HJ("yt.mdx.remote.initialized_",!0),i4("Initializing: "+g.Ki(U)), UU.push(g.rk("yt-remote-cast2-api-ready",function(){TA("yt-remote-api-ready")})),UU.push(g.rk("yt-remote-cast2-availability-change",function(){TA("yt-remote-receiver-availability-change")})),UU.push(g.rk("yt-remote-cast2-receiver-selected",function(){nV(null); TA("yt-remote-auto-connect","cast-selector-receiver")})),UU.push(g.rk("yt-remote-cast2-receiver-resumed",function(){TA("yt-remote-receiver-resumed","cast-selector-receiver")})),UU.push(g.rk("yt-remote-cast2-session-change",OW8)),UU.push(g.rk("yt-remote-connection-change",function(C){C?TB(ko(),"YouTube TV"):ZO()||(TB(null,null),sh7())})),UU.push(g.rk("yt-remote-cast2-session-failed",()=>{TA("yt-remote-connection-failed")})),k=CV(),U.isAuto&&(k.id+="#dial"),Z=U.capabilities||[],Z.length>0&&(k.capabilities= Z),k.name=U.device,k.app=U.app,(U=U.theme)&&(k.theme=U),i4(" -- with channel params: "+g.Ki(k)),k?(g.Lr("yt-remote-session-app",k.app),g.Lr("yt-remote-session-name",k.name)):(g.vi("yt-remote-session-app"),g.vi("yt-remote-session-name")),g.HJ("yt.mdx.remote.channelParams_",k),n.start(),ko()||wQb())}},guV=function(){var k=xn().YJ.$_gos(); const U=rD();U&&LV()&&(VA(k,U)||k.push(U));return mwb(k)},FH=function(){let k=XQ2(); !k&&zB()&&PDx()&&(k={key:"cast-selector-receiver",name:PDx()});return k},XQ2=function(){const k=guV(); let U=rD();U||(U=ZO());return g.kB(k,function(n){return U&&XN(U,n.key)?!0:!1})},rD=function(){const k=ko(); if(!k)return null;const U=xn().wy();return H0(U,k)},OW8=function(k){i4("remote.onCastSessionChange_: "+EA(k)); if(k){var U=rD();if(U&&U.id==k.id){if(TB(U.id,"YouTube TV"),k.idType=="shortLived"&&(k=k.token))vL&&(vL.token=k),(U=LV())&&U.qp(k)}else U&&OU(),wD(k,1)}else LV()&&OU()},OU=function(){QR()?hL().stopSession():Hw("stopSession called before API ready."); const k=LV();k&&(k.disconnect(1),u4(null))},gD=function(){const k=LV(); return!!k&&k.getProxyState()!=3},i4=function(k){js("remote",k)},xn=function(){if(!XH){const k=g.RP("yt.mdx.remote.screenService_"); XH=k?new Eu8(k):null}return XH},ko=function(){return g.RP("yt.mdx.remote.currentScreenId_")},A6_=function(k){g.HJ("yt.mdx.remote.currentScreenId_",k)},d8m=function(){return g.RP("yt.mdx.remote.connectData_")},nV=function(k){g.HJ("yt.mdx.remote.connectData_",k)},LV=function(){return g.RP("yt.mdx.remote.connection_")},u4=function(k){const U=LV(); nV(null);k||A6_("");g.HJ("yt.mdx.remote.connection_",k);mS&&(g.SU(mS,function(n){n(k)}),mS.length=0); U&&!k?TA("yt-remote-connection-change",!1):!U&&k&&TA("yt-remote-connection-change",!0)},ZO=function(){const k=g.O9(); if(!k)return null;var U=xn();if(!U)return null;U=U.wy();return H0(U,k)},wD=function(k,U){ko(); rD()&&rD();if(EU)vL=k;else{A6_(k.id);var n=g.RP("yt.mdx.remote.enableConnectWithInitialState_")||!1;k=new AF(k,n);k.connect(U,d8m());k.subscribe("beforeDisconnect",function(Z){TA("yt-remote-before-disconnect",Z)}); k.subscribe("beforeDispose",function(){LV()&&(LV(),u4(null))}); k.subscribe("browserChannelAuthError",()=>{const Z=rD();Z&&Z.idType=="shortLived"&&(QR()?hL().handleBrowserChannelAuthError():Hw("refreshLoungeToken called before API ready."))}); u4(k)}},wQb=function(){const k=ZO(); k?(i4("Resume connection to: "+EA(k)),wD(k,0)):(QA(),sh7(),i4("Skipping connecting because no session screen found."))},vus=function(){var k=CV(); if(g.Gp(k)){k=b3();var U=g.F6("yt-remote-session-name")||"";const n=g.F6("yt-remote-session-app")||"";k={device:"REMOTE_CONTROL",id:k,name:U,app:n,mdxVersion:3};k.authuser=String(g.Y("SESSION_INDEX","0"));(U=g.Y("DELEGATED_SESSION_ID"))&&(k.pageId=String(U));g.HJ("yt.mdx.remote.channelParams_",k)}},CV=function(){return g.RP("yt.mdx.remote.channelParams_")||{}},VCB=function(k,U){if(dD(k)){k.ol.unsubscribe("remotePlayerChange",k.W,k); const n=Math.round(U.volume);U=!!U.muted;const Z=Bw(k.ol);if(n!==Z.volume||U!==Z.muted)k.ol.setVolume(n,U),k.Y.start();k.ol.subscribe("remotePlayerChange",k.W,k)}},dD=function(k){return Bw(k.ol).videoId===Vd(k).videoId},HL=function(k,U){let n,Z; var C=k.O.getPlaylist();C?.listId&&(n=C.index,Z=C.listId.toString());C=Vd(k);k.ol.playVideo(C.videoId,U,n,Z,C.playerParams,C.Y,PWY(C));k.xF(new g.wo(1))},RX=function(k,U){if(dD(k)&&!k.V){let n=null; U&&(n={style:k.O.getSubtitlesUserSettings()},Object.assign(n,U));k.ol.X(Vd(k).videoId,n);k.J=Bw(k.ol).trackData}},HW8=function(k,U){if(U){const n=k.O.getOption("captions","tracklist",{NR:1}); n&&n.length?(k.O.setOption("captions","track",U),k.V=!1):(k.O.loadModule("captions"),k.V=!0)}else k.O.setOption("captions","track",{})},RXb=function(k){k.p7(0); k.B.stop();k.xF(new g.wo(64))},Vd=function(k){return k.O.getVideoData({playerType:1})},hXE=function(k){const U=k.player.U(); return!U.C("mdx_enable_privacy_disclosure_ui")||k.isLoggedIn()||k.Wl||!k.Pe?!1:g.kD(U)||g.KU(U)},bW7=function(k,U,n){k.K6=n; k.player.publish("presentingplayerstatechange",new g.b5(n,U))},hF=function(k,U,...n){k.loaded&&k.Cc.wk(U,...n)},b4=function(k){k.fG&&(k.player.removeEventListener("presentingplayerstatechange",k.fG),k.fG=null)},z2=function(k,U){if(U.key!==k.Qu.key)if(U.key===k.JC.key)OU(); else if(hXE(k)&&zXO(k),k.Qu=U,!g.mN(k.player.U())){{const r=k.player.getPlaylistId();var n=k.player.getVideoData({playerType:1});const L=n.videoId;if(!r&&!L||(k.player.getAppState()===2||k.player.getAppState()===1)&&k.player.U().C("should_clear_video_data_on_player_cued_unstarted"))n=null;else{var Z=k.player.getPlaylist();if(Z){var C=[];for(let F=0;F{!k.Wl&&U.Mk(8)&&(k.player.pauseVideo(), b4(k))},k.player.addEventListener("presentingplayerstatechange",k.fG)); k.Pe&&k.Pe.K7();LV()||(EU=!0)}; g.wX.prototype.yh=g.nz(46,function(){this.app.tT().yh()}); g.MC.prototype.yh=g.nz(45,function(){this.rD=null}); g.wX.prototype.FH=g.nz(44,function(k){this.app.tT().FH(k)}); g.MC.prototype.FH=g.nz(43,function(k){this.rD=k}); g.C$.prototype.bj=g.nz(1,function(){return g.kH(this,3)}); g.O$.prototype.bj=g.nz(0,function(){return g.kH(this,11)}); var a8B=class{constructor(){var k=g.ib();this.B=k;g.dS(k,"/client_streamz/youtube/living_room/mdx/channel/opened",g.qQ("channel_type"))}S(k){g.HT(this.B,"/client_streamz/youtube/living_room/mdx/channel/opened",k)}},$1V=class{constructor(){var k=g.ib();this.B=k;g.dS(k,"/client_streamz/youtube/living_room/mdx/channel/closed",g.qQ("channel_type"))}S(k){g.HT(this.B,"/client_streamz/youtube/living_room/mdx/channel/closed",k)}},N5V=class{constructor(){var k=g.ib();this.B=k;g.dS(k,"/client_streamz/youtube/living_room/mdx/channel/message_received", g.qQ("channel_type"))}S(k){g.HT(this.B,"/client_streamz/youtube/living_room/mdx/channel/message_received",k)}},pzO=class{constructor(){var k=g.ib();this.B=k;g.dS(k,"/client_streamz/youtube/living_room/mdx/channel/success")}S(){g.HT(this.B,"/client_streamz/youtube/living_room/mdx/channel/success")}},tq8=class{constructor(){var k=g.ib();this.B=k;g.dS(k,"/client_streamz/youtube/living_room/mdx/channel/error",g.qQ("channel_type"),g.qQ("error_type"))}S(k,U){g.HT(this.B,"/client_streamz/youtube/living_room/mdx/channel/error", k,U)}},I8_=class{constructor(){var k=g.ib();this.B=k;g.dS(k,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}S(){g.HT(this.B,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}},qlO=class{constructor(){var k=g.ib();this.B=k;g.dS(k,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}S(){g.HT(this.B,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}};g.z=OA.prototype; g.z.vx=function(){wQ(this);const k=[];for(let U=0;U2*this.size&&wQ(this),!0):!1}; g.z.get=function(k,U){return v0(this.B,k)?this.B[k]:U}; g.z.set=function(k,U){v0(this.B,k)||(this.size+=1,this.S.push(k),this.oH++);this.B[k]=U}; g.z.forEach=function(k,U){const n=this.F0();for(let Z=0;Z=Z.S.length)return g.ye;const r=Z.S[U++];return g.pw(k?r:Z.B[r])}; return C}; var f1i={m8:"atp",ME4:"ska",IbN:"que",P5:"mus",o$E:"sus",cB:"dsp",abg:"seq",GO:"mic",J2:"dpa",YL:"mlm",jo:"dsdtr",B5:"ntb",noM:"vsp",Ra:"scn",eOM:"rpe",Qe:"dcn",BZ:"dcp",Rf:"pas",mj:"drq",If:"opf",Tw:"els",A2:"isg",lbg:"svq",kA:"mvp",Sw:"ads",z$g:"stcp",g$g:"sads",cZ:"dloc",Ia:"dcw",xv:"asw",rO:"apw",Qc:"wrc",DS:"pcw",QZ:"ipv",Je:"ndt",iY:"ctops",d4:"gsrm"},MLp={u5N:"u",aW:"cl",fI:"k",Ug:"i",wG:"cr",dX:"m",oa:"g",S0:"up"},eMb={mQ:"nowPlaying",EE:"onStateChange",ew:"adPlaying",eX:"onAdStateChange", jX:"nowPlayingShorts",qd:"onShortsStateChange"};u3.prototype.equals=function(k){return k?this.id==k.id:!1}; var h0="",Ke=null,gpE=Fl2("loadCastFramework")||Fl2("loadCastApplicationFramework"),Eps=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.JS(t0,g.ca);g.z=t0.prototype;g.z.fJ=function(k){this.J=arguments;this.S=!1;this.uu?this.j=g.tS()+this.nZ:this.uu=g.Oh(this.W,this.nZ)}; g.z.stop=function(){this.uu&&(g.Vs.clearTimeout(this.uu),this.uu=null);this.j=null;this.S=!1;this.J=[]}; g.z.pause=function(){++this.B}; g.z.resume=function(){this.B&&(--this.B,!this.B&&this.S&&(this.S=!1,this.V.apply(null,this.J)))}; g.z.Q$=function(){this.stop();t0.nD.Q$.call(this)}; g.z.JB=function(){this.uu&&(g.Vs.clearTimeout(this.uu),this.uu=null);this.j?(this.uu=g.Oh(this.W,this.j-g.tS()),this.j=null):this.B?this.S=!0:(this.S=!1,this.V.apply(null,this.J))};var qY=null;I9.prototype.set=function(k){this.S=k}; I9.prototype.reset=function(){this.set(g.tS())}; I9.prototype.get=function(){return this.S};g.JS(Vxp,dQ7);var rz=class{stringify(k){return g.Vs.JSON.stringify(k,void 0)}parse(k){return g.Vs.JSON.parse(k,void 0)}};g.JS(J0,g.g5);g.JS(eH,g.g5);var HT7=null;g.JS(RQV,g.g5);g.JS(hQ2,g.g5);g.JS(bTE,g.g5);D$.prototype.debug=function(){}; D$.prototype.info=function(){}; D$.prototype.warning=function(){};var $Q2={},fe={};g.z=o9.prototype;g.z.setTimeout=function(k){this.Xo=k}; g.z.I5=function(k){k=k.target;const U=this.pN;U&&g.sh(k)==3?U.J():this.Dr(k)}; g.z.Dr=function(k){try{if(k==this.S)a:{const C=g.sh(this.S),r=this.S.B,L=this.S.getStatus();if(!(C<3)&&(C!=3||this.S&&(this.B.B||g.oh(this.S)||g.WT(this.S)))){this.Wy||C!=4||r==7||(r==8||L<=0?P0(3):P0(2));MY(this);var U=this.S.getStatus();this.GJ=U;var n=at8(this);if(this.V=U==200){if(this.Fo&&!this.V$){b:{if(this.S){const F=g.Sz(this.S,"X-HTTP-Initial-Response");if(F&&!g.LL(F)){var Z=F;break b}}Z=null}if(k=Z)this.V$=!0,ng(this,k);else{this.V=!1;this.W=3;sA(12);SH(this);GA(this);break a}}if(this.By){k= !0;let F;for(;!this.Wy&&this.L0&&!this.h8&&(this.h8=!0,this.j.Iz(this)):(SH(this),GA(this))}else ng(this,n);C==4&&SH(this);this.V&&!this.Wy&&(C==4?tx_(this.j,this):(this.V=!1,jH(this)))}else g.jz(this.S),U==400&&n.indexOf("Unknown SID")> 0?(this.W=3,sA(12)):(this.W=0,sA(13)),SH(this),GA(this)}}}catch(C){}finally{}}; g.z.cancel=function(){this.Wy=!0;SH(this)}; g.z.W0=function(){this.dM=null;const k=Date.now();k-this.uL>=0?(this.IQ!=2&&(P0(3),sA(17)),SH(this),this.W=2,GA(this)):NvY(this,this.uL-k)}; g.z.getLastError=function(){return this.W}; g.z.yv=function(){return this.S};var Qwx=class{constructor(k,U){this.S=k;this.map=U;this.context=null}};eQ_.prototype.cancel=function(){this.j=Zm(this);if(this.B)this.B.cancel(),this.B=null;else if(this.S&&this.S.size!==0){for(const k of this.S.values())k.cancel();this.S.clear()}};g.z=DQs.prototype;g.z.Fk=8;g.z.uV=1;g.z.connect=function(k,U,n,Z){sA(0);this.tS=k;this.Wy=U||{};n&&Z!==void 0&&(this.Wy.OSID=n,this.Wy.OAID=Z);this.pN=this.e5;this.eE=Itx(this,null,this.tS);UT(this)}; g.z.disconnect=function(){opV(this);if(this.uV==3){var k=this.TJ++,U=this.eE.clone();g.rf(U,"SID",this.J);g.rf(U,"RID",k);g.rf(U,"TYPE","terminate");vA(this,U);k=new o9(this,this.J,k);k.IQ=2;k.X=Ce(U.clone());U=!1;if(g.Vs.navigator&&g.Vs.navigator.sendBeacon)try{U=g.Vs.navigator.sendBeacon(k.X.toString(),"")}catch{}!U&&g.Vs.Image&&((new Image).src=k.X,U=!0);U||(k.S=Klm(k.j,null),k.S.send(k.X));k.SE=Date.now();jH(k)}Mxi(this)}; g.z.Ty=function(){return this.uV==0}; g.z.getState=function(){return this.uV}; g.z.vz=function(k){if(this.V)if(this.V=null,this.uV==1){if(!k){this.TJ=Math.floor(Math.random()*1E5);k=this.TJ++;const C=new o9(this,"",k);let r=this.D;this.Fo&&(r?(r=g.c7(r),g.xB(r,this.Fo)):r=this.Fo);this.L!==null||this.uL||(C.eE=r,r=null);if(this.bL)a:{var U=0;for(var n=0;n4096){U=n;break a}if(U===4096||n===this.j.length-1){U=n+1;break a}}U= this.lZ}else U=this.lZ;U=SWO(this,C,U);n=this.eE.clone();g.rf(n,"RID",k);g.rf(n,"CVER",22);this.By&&g.rf(n,"X-HTTP-Session-Id",this.By);vA(this,n);r&&(this.uL?U="headers="+g.OI(g.uE(r))+"&"+U:this.L&&g.gf(n,this.L,r));ii(this.B,C);this.l2&&g.rf(n,"TYPE","init");this.bL?(g.rf(n,"$req",U),g.rf(n,"SID","null"),C.Fo=!0,W0(C,n,null)):W0(C,n,U);this.uV=2}}else this.uV==3&&(k?GXV(this,k):this.j.length==0||Bv8(this.B)||GXV(this))}; g.z.o6=function(){this.X=null;ft7(this);if(this.V3&&!(this.Xo||this.S==null||this.gt<=0)){var k=4*this.gt;this.x$=Yf((0,g.pz)(this.cA,this),k)}}; g.z.cA=function(){this.x$&&(this.x$=null,this.pN=!1,this.Xo=!0,sA(10),l3(this),ft7(this))}; g.z.Iz=function(k){this.S==k&&this.V3&&!this.Xo&&(Fv(this),this.Xo=!0,sA(11))}; g.z.ZM=function(){this.dM!=null&&(this.dM=null,l3(this),mo(this),sA(19))}; g.z.Im=function(k){k?sA(2):sA(1)}; g.z.isActive=function(){return!!this.W&&this.W.isActive(this)}; g.z=cd2.prototype;g.z.kx=function(){}; g.z.Y7=function(){}; g.z.wZ=function(){}; g.z.MH=function(){}; g.z.isActive=function(){return!0}; g.z.qy=function(){};g.JS(wz,g.q1);wz.prototype.open=function(){this.S.W=this.j;this.L&&(this.S.V$=!0);this.S.connect(this.V,this.B||void 0)}; wz.prototype.close=function(){this.S.disconnect()}; wz.prototype.send=function(k){var U=this.S;if(typeof k==="string"){var n={};n.__data__=k;k=n}else this.W&&(n={},n.__data__=g.Ki(k),k=n);U.j.push(new Qwx(U.Sl++,k));U.uV==3&&UT(U)}; wz.prototype.Q$=function(){this.S.W=null;delete this.j;this.S.disconnect();delete this.S;wz.nD.Q$.call(this)}; g.JS(mQi,J0);g.JS(xQE,eH);g.JS(OT,cd2);OT.prototype.kx=function(){this.S.dispatchEvent("m")}; OT.prototype.Y7=function(k){this.S.dispatchEvent(new mQi(k))}; OT.prototype.wZ=function(k){this.S.dispatchEvent(new xQE(k))}; OT.prototype.MH=function(){this.S.dispatchEvent("n")}; wz.prototype.J=function(){return new ui(this,this.S)}; ui.prototype.B=function(){return xf(this.S.B)}; ui.prototype.j=function(){return ydp(this.S).map(k=>{var U=this.J;k=k.map;"__data__"in k?(k=k.__data__,U=U.W?Y1V(k):k):U=k;return U})}; ui.prototype.commit=function(k){this.S.GJ=k};var Xv=new g.q1,kS_=class extends g.g5{constructor(){super("statevent",Xv)}};g.z=Aw.prototype;g.z.rB=null;g.z.u3=!1;g.z.KP=null;g.z.Et=null;g.z.zI=null;g.z.jD=null;g.z.dn=null;g.z.m2=null;g.z.xd=null;g.z.Qg=null;g.z.WQ=0;g.z.zV=null;g.z.Jt=null;g.z.H8=null;g.z.x3=-1;g.z.QH=!0;g.z.Sr=!1;g.z.qx=0;g.z.cQ=null;var nNB={},HA={};g.z=Aw.prototype;g.z.setTimeout=function(k){this.B=k}; g.z.Os=function(k){k=k.target;const U=this.cQ;U&&g.sh(k)==3?U.J():this.PR(k)}; g.z.PR=function(k){try{if(k==this.Qg)a:{const U=g.sh(this.Qg),n=this.Qg.B,Z=this.Qg.getStatus();if(g.CK&&!g.pM("420+")){if(U<4)break a}else if(U<3||U==3&&!g.oh(this.Qg))break a;this.Sr||U!=4||n==7||(n==8||Z<=0?this.S.oN(3):this.S.oN(2));rk_(this);const C=this.Qg.getStatus();this.x3=C;const r=g.oh(this.Qg);if(this.u3=C==200){U==4&&hw(this);if(this.By){for(k=!0;!this.Sr&&this.WQ0?3:0,ET(),hw(this),Ri(this)}}catch(U){}finally{}}; g.z.cancel=function(){this.Sr=!0;hw(this)}; g.z.Es=function(){this.KP=null;const k=Date.now();k-this.Et>=0?(this.jD!=2&&this.S.oN(3),hw(this),this.H8=2,ET(),Ri(this)):CcO(this,this.Et-k)}; g.z.getLastError=function(){return this.H8};g.z=O58.prototype;g.z.Vm=null;g.z.lB=null;g.z.Un=!1;g.z.C$=null;g.z.aY=null;g.z.YO=-1;g.z.Iy=null;g.z.Rg=null;g.z.connect=function(k){this.C$=k;k=z7(this.S,null,this.C$);ET();Date.now();const U=this.S.D;U!=null?(this.Iy=U[0],(this.Rg=U[1])?(this.aY=1,wzb(this)):(this.aY=2,Kg(this))):(rQ(k,"MODE","init"),this.lB=new Aw(this),this.lB.rB=this.Vm,dz(this.lB,k,!1,null,!0),this.aY=0)}; g.z.gL=function(k){if(k)this.aY=2,Kg(this);else{ET();var U=this.S;U.aq=U.xn.YO;qS(U,9)}k&&this.oN(2)}; g.z.Ot=function(k){return this.S.Ot(k)}; g.z.abort=function(){this.lB&&(this.lB.cancel(),this.lB=null);this.YO=-1}; g.z.Ty=function(){return!1}; g.z.d6=function(k,U){this.YO=k.x3;if(this.aY==0)if(U){try{var n=this.B.parse(U)}catch(Z){k=this.S;k.aq=this.YO;qS(k,2);return}this.Iy=n[0];this.Rg=n[1]}else k=this.S,k.aq=this.YO,qS(k,2);else this.aY==2&&(this.Un?(ET(),Date.now()):U=="11111"?(ET(),this.Un=!0,Date.now(),this.YO=200,this.lB.cancel(),ET(),Ql(this.S,this,!0)):(ET(),Date.now(),this.Un=!1))}; g.z.p$=function(){this.YO=this.lB.x3;if(this.lB.u3)this.aY==0?this.Rg?(this.aY=1,wzb(this)):(this.aY=2,Kg(this)):this.aY==2&&(this.Un?(ET(),Ql(this.S,this,!0)):(ET(),Ql(this.S,this,!1)));else{this.aY==0?ET():this.aY==2&&ET();var k=this.S;this.lB.getLastError();k.aq=this.YO;qS(k,2)}}; g.z.Qn=function(){return this.S.Qn()}; g.z.isActive=function(){return this.S.isActive()}; g.z.oN=function(k){this.S.oN(k)};g.z=T7.prototype;g.z.K4=null;g.z.B2=null;g.z.xG=null;g.z.n1=null;g.z.Ac=null;g.z.ZZ=null;g.z.SI=null;g.z.L$=null;g.z.jr=0;g.z.pJ=0;g.z.lV=null;g.z.l3=null;g.z.kD=null;g.z.Q_=null;g.z.xn=null;g.z.lr=null;g.z.uX=-1;g.z.r6=-1;g.z.aq=-1;g.z.sz=0;g.z.Uz=0;g.z.z8=8;var Kjx={OK:0,CL0:2,KI:4,fO:5,sl$:6,STOP:7,Ny:8,IW:9,f_:10,Wq:11,Bp:12};g.JS(gNb,g.g5);g.JS(XzO,g.g5);g.z=T7.prototype; g.z.connect=function(k,U,n,Z,C){ET();this.Ac=U;this.B2=n||{};Z&&C!==void 0&&(this.B2.OSID=Z,this.B2.OAID=C);this.X?(gz((0,g.pz)(this.jH,this,k),100),EN2(this)):this.jH(k)}; g.z.disconnect=function(){Aks(this);if(this.S==3){var k=this.jr++;const U=this.ZZ.clone();g.rf(U,"SID",this.J);g.rf(U,"RID",k);g.rf(U,"TYPE","terminate");tw(this,U);k=new Aw(this,this.J,k);k.jD=2;k.dn=Ce(U.clone());(new Image).src=k.dn.toString();k.zI=Date.now();Vl(k)}zMB(this)}; g.z.jH=function(k){this.xn=new O58(this);this.xn.Vm=this.K4;this.xn.B=this.W;this.xn.connect(k)}; g.z.Ty=function(){return this.S==0}; g.z.getState=function(){return this.S}; g.z.z7=function(k){this.l3=null;H52(this,k)}; g.z.xx=function(){this.kD=null;this.n1=new Aw(this,this.J,"rpc",this.L);this.n1.rB=this.K4;this.n1.qx=0;var k=this.SI.clone();g.rf(k,"RID","rpc");g.rf(k,"SID",this.J);g.rf(k,"CI",this.lr?"0":"1");g.rf(k,"AID",this.uX);tw(this,k);g.rf(k,"TYPE","xmlhttp");dz(this.n1,k,!0,this.L$,!1)}; g.z.d6=function(k,U){if(this.S!=0&&(this.n1==k||this.xG==k))if(this.aq=k.x3,this.xG==k&&this.S==3)if(this.z8>7){try{var n=this.W.parse(U)}catch(Z){n=null}if(Array.isArray(n)&&n.length==3)if(k=n,k[0]==0)a:{if(!this.kD){if(this.n1)if(this.n1.zI+3E30)){if(Z=U==1)this.xG||this.l3||this.S==1||this.sz>=2?Z=!1:(this.l3=gz((0,g.pz)(this.z7,this,k),hMx(this,this.sz)),this.sz++, Z=!0);Z=!(Z||U==2&&Ii(this))}if(Z)switch(n){case 1:qS(this,5);break;case 4:qS(this,10);break;case 3:qS(this,6);break;case 7:qS(this,12);break;default:qS(this,2)}}}; g.z.VC=function(k){if(!g.n8(arguments,this.S))throw Error("Unexpected channel state: "+this.S);}; g.z.W3=function(k){k?ET():(ET(),b58(this,8))}; g.z.Ot=function(k){if(k)throw Error("Can't create secondary domain capable XhrIo object.");k=new g.Ih;k.L=!1;return k}; g.z.isActive=function(){return!!this.lV&&this.lV.isActive(this)}; g.z.oN=function(k){const U=Xv;U.dispatchEvent(new XzO(U,k))}; g.z.Qn=function(){return!1}; new Vxp;g.z=Qos.prototype;g.z.cR=function(){}; g.z.BR=function(){}; g.z.mu=function(){}; g.z.Qj=function(){}; g.z.Tf=function(){}; g.z.jI=function(){return{}}; g.z.isActive=function(){return!0};g.z=K4m.prototype;g.z.enqueue=function(k){this.B.push(k)}; g.z.isEmpty=function(){return this.S.length===0&&this.B.length===0}; g.z.clear=function(){this.S=[];this.B=[]}; g.z.contains=function(k){return g.n8(this.S,k)||g.n8(this.B,k)}; g.z.remove=function(k){{var U=this.S;const n=Array.prototype.lastIndexOf.call(U,k,U.length-1);n>=0?(g.L8(U,n),U=!0):U=!1}return U||g.FO(this.B,k)}; g.z.vx=function(){const k=[];for(var U=this.S.length-1;U>=0;--U)k.push(this.S[U]);U=this.B.length;for(let n=0;n"",this.IQ=()=>g.f5({}))}; g.z.LN=function(){return this.D}; g.z.connect=async function(k,U,n){try{this.X&&await this.W}finally{if(this.D||this.S&&this.S.getState()==2&&!this.j)return;this.By="";this.j||this.B.stop();this.Y=k||null;this.dM=U||0;const Z=this.V$+"/test",C=this.V$+"/bind";k=new T7(n?n.firstTestResults:null,n?n.secondTestResults:null,this.GJ);const r=this.S;r&&(r.lV=null);k.lV=this;this.S=k;if(this.X)return this.W=PA(this).then(()=>JkV(this,Z,C,r,n)),this.W.then(()=>{this.W=g.f5()}); JkV(this,Z,C,r,n)}}; g.z.disconnect=function(k){try{this.X&&(this.W.cancel(),this.W=g.f5())}finally{this.x$=k||0,this.B&&this.B.stop(),BA(this),this.S&&(this.S.getState()==3&&H52(this.S),this.S.disconnect()),this.x$=0}}; g.z.sendMessage=async function(k,U){try{this.X&&await this.W}finally{if(this.D)return;const n={_sc:k};U&&g.xB(n,U);if(this.B.isActive()||(this.S?this.S.getState():0)==2)this.J.push(n);else if(this.hN())try{this.X&&!B5i(this,k)&&await PA(this)}finally{this.hN()&&(B5i(this,k),BA(this),pg(this.S,n))}}}; g.z.cR=function(){this.V&&this.B&&this.B.bj()>0&&(this.V.cT$(this.B.bj(),this.j,!0),this.V.mjN());this.V&&this.V.NmN();this.j?(this.B.stop(),g.MD(this.B),this.B=new Jw(this.Y_,this),this.j=!1):this.B.reset();this.Y=null;this.dM=0;if(this.J.length)if(this.X)Pcb(this);else{var k=this.J;this.J=[];var U=k.length;for(let n=0;nKjx[n]===k); this.TJ.S("BROWSER_CHANNEL",U??"UNKNOWN")}; g.z.Tf=function(k,U){if(!this.B.isActive())this.publish("handlerClosed");else if(U){const n=U.length;for(let Z=0;Z{this.onError(Z)}); this.handler.subscribe("handlerMessage",this.onMessage,this);this.B=U}connect(k,U,n){this.handler.connect(k,U,n)}disconnect(k){this.handler.disconnect(k)}GY(){this.handler.GY()}getDeviceId(){return this.handler.getDeviceId()}T5(){return this.handler.T5()}hN(){return this.handler.hN()}S(){this.dispatchEvent("channelOpened");var k=this.handler,U=this.B;g.Lr("yt-remote-session-browser-channel",{firstTestResults:[""],secondTestResults:!k.S.lr,sessionId:k.S.J,arrayId:k.S.uX});g.Lr("yt-remote-session-screen-id", U);k=R9();U=b3();g.n8(k,U)||k.push(U);iT2(k);zA()}onClosed(){this.dispatchEvent("channelClosed")}onMessage(k){this.dispatchEvent(new Tq7(k))}onError(k){this.dispatchEvent(new av7(k?1:0))}sendMessage(k,U){this.handler.sendMessage(k,U)}qp(k){this.handler.qp(k)}dispose(){this.handler.dispose()}};var oNx=class{constructor(k,U,n=()=>""){new ltp; var Z=new g.q_;this.pathPrefix=k;this.S=U;this.SE=n;this.W=Z;this.X=null;this.D=this.L=0;this.channel=null;this.V=0;this.j=new Jw(()=>{this.j.isActive();this.channel?.J().B()===0&&this.connect(this.X,this.L)}); this.J={};this.B={};this.dM=!1;this.logger=null;this.Y=[];this.Id=void 0;this.eE=new a8B;this.x$=new $1V;this.Wy=new N5V;this.By=new tq8}connect(k={},U=0){this.V!==2&&(this.j.stop(),this.X=k,this.L=U,oi(this),(k=g.Y("ID_TOKEN"))?this.J["x-youtube-identity-token"]=k:delete this.J["x-youtube-identity-token"],this.S&&(this.B.device=this.S.device,this.B.name=this.S.name,this.B.app=this.S.app,this.B.id=this.S.id,this.S.Kx&&(this.B.mdxVersion=`${this.S.Kx}`),this.S.theme&&(this.B.theme=this.S.theme),this.S.capabilities&& (this.B.capabilities=this.S.capabilities),this.S.Sg&&(this.B.cst=this.S.Sg),this.S.authuser&&(this.B.authuser=this.S.authuser),this.S.pageId&&(this.B.pageId=this.S.pageId)),this.L!==0?this.B.ui=`${this.L}`:delete this.B.ui,Object.assign(this.B,this.X),this.channel=new wz(this.pathPrefix,{N4:"gsessionid",NW:this.J,gr:this.B}),this.channel.open(),this.V=2,YlE(this))}disconnect(k=0){this.D=k;this.j.stop();oi(this);this.channel&&(this.D!==0?this.B.ui=`${this.D}`:delete this.B.ui,this.channel.close()); this.D=0}T5(){return this.j.isActive()?this.j.g$-Date.now():NaN}GY(){var k=this.j;g.Ue(k.S);k.start()}sendMessage(k,U){this.channel&&(oi(this),this.channel.send({_sc:k,...U}))}qp(k){k||this.j.stop();k?this.J["X-YouTube-LoungeId-Token"]=k:delete this.J["X-YouTube-LoungeId-Token"]}getDeviceId(){return this.S?this.S.id:""}publish(k,...U){return this.W.publish(k,...U)}subscribe(k,U,n){return this.W.subscribe(k,U,n)}unsubscribe(k,U,n){return this.W.unsubscribe(k,U,n)}sN(k){return this.W.sN(k)}dispose(){this.dM|| (this.dM=!0,g.MD(this.W),this.disconnect(),g.MD(this.j),this.SE=()=>"")}LN(){return this.dM}};var D18=class extends g.q1{constructor(k){super();this.S=k();this.S.subscribe("webChannelOpened",this.B,this);this.S.subscribe("webChannelClosed",this.onClosed,this);this.S.subscribe("webChannelError",this.onError,this);this.S.subscribe("webChannelMessage",this.onMessage,this)}connect(k,U){this.S.connect(k,U)}disconnect(k){this.S.disconnect(k)}GY(){this.S.GY()}getDeviceId(){return this.S.getDeviceId()}T5(){return this.S.T5()}hN(){return this.S.V===3}B(){this.dispatchEvent("channelOpened")}onClosed(){this.dispatchEvent("channelClosed")}onMessage(k){this.dispatchEvent(new Tq7(k))}onError(){this.dispatchEvent(new av7(this.S.Id=== 401?1:0))}sendMessage(k,U){this.S.sendMessage(k,U)}qp(k){this.S.qp(k)}dispose(){this.S.dispose()}};var l88=Date.now(),WA=null,fg=Array(50),G7=-1,MS=!1;g.JS(yl,g.O8);yl.prototype.wy=function(){return this.screens}; yl.prototype.contains=function(k){return!!VA(this.screens,k)}; yl.prototype.get=function(k){return k?H0(this.screens,k):null}; yl.prototype.info=function(k){js(this.V,k)};var pQ_=class extends g.O8{constructor(k,U,n,Z,C){super();this.J=k;this.Y=U;this.X=n;this.dM=Z;this.D=C;this.B=0;this.S=null;this.uu=NaN}start(){!this.S&&isNaN(this.uu)&&this.j()}stop(){this.S&&(this.S.abort(),this.S=null);isNaN(this.uu)||(g.WE(this.uu),this.uu=NaN)}Q$(){this.stop();super.Q$()}j(){this.uu=NaN;this.S=g.xX(Dm(this.J,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.Y},timeout:5E3,onSuccess:(0,g.pz)(this.V,this),onError:(0,g.pz)(this.W,this),onTimeout:(0,g.pz)(this.L, this)})}V(k,U){this.S=null;k=U.screen||{};k.dialId=this.X;k.name=this.dM;U=-1;this.D&&k.shortLivedLoungeToken&&k.shortLivedLoungeToken.value&&k.shortLivedLoungeToken.refreshIntervalMs&&(k.screenIdType="shortLived",k.loungeToken=k.shortLivedLoungeToken.value,U=k.shortLivedLoungeToken.refreshIntervalMs);this.publish("pairingComplete",new gQ(k),U)}W(k){this.S=null;k.status&&k.status==404?this.B>=$82.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(k=$82[this.B],this.uu=g.D2((0,g.pz)(this.j, this),k),this.B++):this.publish("pairingFailed",Error("Server error "+k.status))}L(){this.S=null;this.publish("pairingFailed",Error("Server not responding"))}},$82=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.JS(li,yl);g.z=li.prototype;g.z.start=function(){cA(this)&&this.publish("screenChange");!g.F6("yt-remote-lounge-token-expiration")&&ii2(this);g.WE(this.S);this.S=g.D2((0,g.pz)(this.start,this),1E4)}; g.z.add=function(k,U){cA(this);m1V(this,k);mR(this,!1);this.publish("screenChange");U(k);k.token||ii2(this)}; g.z.remove=function(k,U){let n=cA(this);kkE(this,k)&&(mR(this,!1),n=!0);U(k);n&&this.publish("screenChange")}; g.z.UL=function(k,U,n,Z){let C=cA(this);const r=this.get(k.id);r?(r.name!=U&&(r.name=U,mR(this,!1),C=!0),n(k)):Z(Error("no such local screen."));C&&this.publish("screenChange")}; g.z.Q$=function(){g.WE(this.S);li.nD.Q$.call(this)}; g.z.Tx=function(k){cA(this);let U=this.screens.length;k=k&&k.screens||[];const n=k.length;for(let Z=0;Z{g.MD(L);C(Zc(this,F),v)}); L.subscribe("pairingFailed",F=>{g.MD(L);r(F)}); L.start();return(0,g.pz)(L.stop,L)}; g.z.LJ=function(k,U,n,Z){g.xX(Dm(this.J,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:k},timeout:5E3,onSuccess:(0,g.pz)(function(C,r){C=new gQ(r.screen||{});if(!C.name||LXb(this,C.name)){a:{r=C.name;let L=2,F=U(r,L);for(;LXb(this,F);){L++;if(L>20)break a;F=U(r,L)}r=F}C.name=r}n(Zc(this,C))},this), onError:(0,g.pz)(function(C){Z(Error("pairing request failed: "+C.status))},this), onTimeout:(0,g.pz)(function(){Z(Error("pairing request timed out."))},this)})}; g.z.Q$=function(){g.MD(this.B);g.MD(this.S);nC.nD.Q$.call(this)}; g.z.HY=function(){vjE(this);this.publish("screenChange");this.S.update()}; nC.prototype.dispose=nC.prototype.dispose;g.JS(rE,g.O8);g.z=rE.prototype;g.z.Af=function(k){this.LN()||(k&&(Fe(this,""+k),this.publish("sessionFailed")),this.S=null,this.publish("sessionScreen",null))}; g.z.info=function(k){js(this.By,k)}; g.z.WR=function(){return null}; g.z.NK=function(k){const U=this.B;k?(U.displayStatus=new chrome.cast.ReceiverDisplayStatus(k,[]),U.displayStatus.showStop=!0):U.displayStatus=null;chrome.cast.setReceiverDisplayStatus(U,(0,g.pz)(function(){this.info("Updated receiver status for "+U.friendlyName+": "+k)},this),(0,g.pz)(function(){Fe(this,"Failed to update receiver status for: "+U.friendlyName)},this))}; g.z.Q$=function(){this.NK("");rE.nD.Q$.call(this)};var Qd=class extends rE{constructor(k,U,n){super(k,U,"CastSession");this.config_=n;this.j=null;this.Y=(0,g.pz)(this.eE,this);this.SE=(0,g.pz)(this.IQ,this);this.dM=g.D2(()=>{XTB(this,null)},12E4); this.X=this.W=this.L=this.D=0}x$(k){if(this.j){if(this.j==k)return;Fe(this,"Overriding cast session with new session object");Ej7(this);this.j.removeUpdateListener(this.Y);this.j.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.SE)}this.j=k;this.j.addUpdateListener(this.Y);this.j.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.SE);AVp(this,"getMdxSessionStatus")}V(k){this.info("launchWithParams no-op for Cast: "+g.Ki(k))}stop(){this.j?this.j.stop((0,g.pz)(function(){this.Af()}, this),(0,g.pz)(function(){this.Af(Error("Failed to stop receiver app."))},this)):this.Af(Error("Stopping cast device without session."))}NK(){}Q$(){this.info("disposeInternal"); Ej7(this);this.j&&(this.j.removeUpdateListener(this.Y),this.j.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.SE));this.j=null;super.Q$()}IQ(k,U){if(!this.LN())if(U)if(U=FN(U),g.TN(U))switch(k=""+U.type,U=U.data||{},this.info("onYoutubeMessage_: "+k+" "+g.Ki(U)),k){case "mdxSessionStatus":XTB(this,U);break;case "loungeToken":de2(this,U);break;default:Fe(this,"Unknown youtube message: "+k)}else Fe(this,"Unable to parse message.");else Fe(this,"No data in message.")}Wy(k,U,n,Z){g.WE(this.D); this.D=0;rVE(this.J,this.B.label,k,this.B.friendlyName,(0,g.pz)(function(C){C?U(C):Z>=0?(Fe(this,"Screen "+k+" appears to be offline. "+Z+" retries left."),this.D=g.D2((0,g.pz)(this.Wy,this,k,U,n,Z-1),300)):n(Error("Unable to fetch screen."))},this),n)}WR(){return this.j}eE(k){this.LN()||k||(Fe(this,"Cast session died."),this.Af())}};var NqV=class extends rE{constructor(k,U,n,Z){super(k,U,"DialSession");this.config_=Z;this.j=this.D=null;this.SE="";this.IQ=n;this.eE=null;this.Y=()=>{}; this.dM=NaN;this.Wy=(0,g.pz)(this.V$,this);this.W=()=>{}; this.X=this.L=0}x$(k){this.j=k;this.j.addUpdateListener(this.Wy)}V(k){this.eE=k;this.Y()}stop(){biV(this);this.j?this.j.stop((0,g.pz)(this.Af,this,null),(0,g.pz)(this.Af,this,"Failed to stop DIAL device.")):this.Af()}Q$(){biV(this);this.j&&this.j.removeUpdateListener(this.Wy);this.j=null;super.Q$()}V$(k){this.LN()||k||(Fe(this,"DIAL session died."),this.W(),this.W=()=>{},this.Af())}};var tCO=class extends rE{constructor(k,U){super(k,U,"ManualSession");this.j=g.D2((0,g.pz)(this.V,this,null),150)}stop(){this.Af()}x$(){}V(){g.WE(this.j);this.j=NaN;const k=H0(this.J.wy(),this.B.label);k?LC(this,k):this.Af(Error("No such screen"))}Q$(){g.WE(this.j);this.j=NaN;super.Q$()}};var aN=class extends g.O8{constructor(k,U){super();this.config_=U;this.B=k;this.x$=U.appId||"233637DE";this.J=U.theme||"cl";this.By=U.disableCastApi||!1;this.L=U.forceMirroring||!1;this.S=null;this.X=!1;this.j=[];this.V=(0,g.pz)(this.eE,this)}init(k,U){chrome.cast.timeout.requestSession=3E4;var n=new chrome.cast.SessionRequest(this.x$,[chrome.cast.Capability.AUDIO_OUT]);g.GM("desktop_enable_cast_connect")&&(n.androidReceiverCompatible=!0);this.By||(n.dialRequest=new chrome.cast.DialRequest("YouTube")); const Z=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;k=k||this.L?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;const C=(0,g.pz)(this.IQ,this);n=new chrome.cast.ApiConfig(n,(0,g.pz)(this.D,this),C,Z,k);n.customDialLaunchCallback=(0,g.pz)(this.Wy,this);chrome.cast.initialize(n,(0,g.pz)(function(){this.LN()||(chrome.cast.addReceiverActionListener(this.V),Mqs(),this.B.subscribe("onlineScreenChange",(0,g.pz)(this.W,this)),this.j=$eV(this),chrome.cast.setCustomReceivers(this.j, ()=>{},(0,g.pz)(function(r){this.kJ("Failed to set initial custom receivers: "+g.Ki(r))},this)),this.publish("yt-remote-cast2-availability-change",Xe(this)),U(!0))},this),(0,g.pz)(function(r){this.kJ("Failed to initialize API: "+g.Ki(r)); U(!1)},this))}pN(k,U){Eu("Setting connected screen ID: "+k+" -> "+U); if(this.S){var n=this.S.S;if(!k||n&&n.id!=k)Eu("Unsetting old screen status: "+this.S.B.friendlyName),AL(this,null)}if(k&&U){if(!this.S){k=H0(this.B.wy(),k);if(!k){Eu("setConnectedScreenStatus: Unknown screen.");return}if(k.idType=="shortLived"){Eu("setConnectedScreenStatus: Screen with id type to be short lived.");return}n=aHV(this,k);n||(Eu("setConnectedScreenStatus: Connected receiver not custom..."),n=new chrome.cast.Receiver(k.uuid?k.uuid:k.id,k.name),n.receiverType=chrome.cast.ReceiverType.CUSTOM, this.j.push(n),chrome.cast.setCustomReceivers(this.j,()=>{},(0,g.pz)(function(Z){this.kJ("Failed to set initial custom receivers: "+g.Ki(Z))},this))); Eu("setConnectedScreenStatus: new active receiver: "+n.friendlyName);AL(this,new tCO(this.B,n),!0)}this.S.NK(U)}else Eu("setConnectedScreenStatus: no screen.")}TJ(k){this.LN()?this.kJ("Setting connection data on disposed cast v2"):this.S?this.S.V(k):this.kJ("Setting connection data without a session")}SE(){this.LN()?this.kJ("Stopping session on disposed cast v2"):this.S?(this.S.stop(),AL(this,null)):Eu("Stopping non-existing session")}requestSession(){chrome.cast.requestSession((0,g.pz)(this.D,this), (0,g.pz)(this.V$,this))}Q$(){this.B.unsubscribe("onlineScreenChange",(0,g.pz)(this.W,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.V);var k=Sls;const U=g.RP("yt.mdx.remote.debug.handlers_");g.FO(U||[],k);g.MD(this.S);super.Q$()}kJ(k){js("Controller",k)}dM(k,U){this.S==k&&(U||AL(this,null),this.publish("yt-remote-cast2-session-change",U))}eE(k,U){if(!this.LN())if(k)switch(k.friendlyName=chrome.cast.unescape(k.friendlyName),Eu("onReceiverAction_ "+k.label+" / "+k.friendlyName+ "-- "+U),U){case chrome.cast.ReceiverAction.CAST:if(this.S)if(this.S.B.label!=k.label)Eu("onReceiverAction_: Stopping active receiver: "+this.S.B.friendlyName),this.S.stop();else{Eu("onReceiverAction_: Casting to active receiver.");this.S.S&&this.publish("yt-remote-cast2-session-change",this.S.S);break}switch(k.receiverType){case chrome.cast.ReceiverType.CUSTOM:AL(this,new tCO(this.B,k));break;case chrome.cast.ReceiverType.DIAL:AL(this,new NqV(this.B,k,this.J,this.config_));break;case chrome.cast.ReceiverType.CAST:AL(this, new Qd(this.B,k,this.config_));break;default:this.kJ("Unknown receiver type: "+k.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.S&&this.S.B.label==k.label?this.S.stop():this.kJ("Stopping receiver w/o session: "+k.friendlyName)}else this.kJ("onReceiverAction_ called without receiver.")}Wy(k){if(this.LN())return Promise.reject(Error("disposed"));var U=k.receiver;U.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.kJ("Not DIAL receiver: "+U.friendlyName),U.receiverType=chrome.cast.ReceiverType.DIAL); var n=this.S?this.S.B:null;if(!n||n.label!=U.label)return this.kJ("Receiving DIAL launch request for non-clicked DIAL receiver: "+U.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(n&&n.label==U.label&&n.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.S.S)return Eu("Reselecting dial screen."),this.publish("yt-remote-cast2-session-change",this.S.S),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.kJ('Changing CAST intent from "'+n.receiverType+'" to "dial" for '+U.friendlyName); AL(this,new NqV(this.B,U,this.J,this.config_))}U=this.S;U.D=k;U.D.appState==chrome.cast.DialAppState.RUNNING?(k=U.D.extraData||{},n=k.screenId||null,uP(U)&&k.loungeToken?k.loungeTokenRefreshIntervalMs?k=TSE(U,{name:U.B.friendlyName,screenId:k.screenId,loungeToken:k.loungeToken,dialId:U.D.receiver.label,screenIdType:"shortLived"},k.loungeTokenRefreshIntervalMs):(g.Vt(Error(`No loungeTokenRefreshIntervalMs presents in additionalData: ${JSON.stringify(k)}.`)),k=QhE(U,n)):k=QhE(U,n)):k=wE(U);return k}D(k){if(!this.LN()&& !this.L){Eu("New cast session ID: "+k.sessionId);var U=k.receiver;if(U.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.S)if(U.receiverType==chrome.cast.ReceiverType.CAST)Eu("Got resumed cast session before resumed mdx connection."),U.friendlyName=chrome.cast.unescape(U.friendlyName),AL(this,new Qd(this.B,U,this.config_),!0);else{this.kJ("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var n=this.S.B,Z=H0(this.B.wy(),n.label);Z&&XN(Z,U.label)&&n.receiverType!= chrome.cast.ReceiverType.CAST&&U.receiverType==chrome.cast.ReceiverType.CAST&&(Eu("onSessionEstablished_: manual to cast session change "+U.friendlyName),g.MD(this.S),this.S=new Qd(this.B,U,this.config_),this.S.subscribe("sessionScreen",(0,g.pz)(this.dM,this,this.S)),this.S.subscribe("sessionFailed",()=>pTO(this,this.S)),this.S.V(null)); this.S.x$(k)}}}Y(){return this.S?this.S.WR():null}V$(k){this.LN()||(this.kJ("Failed to estabilish a session: "+g.Ki(k)),k.code!=chrome.cast.ErrorCode.CANCEL&&AL(this,null),this.publish("yt-remote-cast2-session-failed"))}IQ(k){Eu("Receiver availability updated: "+k);if(!this.LN()){var U=Xe(this);this.X=k==chrome.cast.ReceiverAvailability.AVAILABLE;Xe(this)!=U&&this.publish("yt-remote-cast2-availability-change",Xe(this))}}W(){this.LN()||(this.j=$eV(this),Eu("Updating custom receivers: "+g.Ki(this.j)), chrome.cast.setCustomReceivers(this.j,()=>{},(0,g.pz)(function(){this.kJ("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",Xe(this)))}}; aN.prototype.setLaunchParams=aN.prototype.TJ;aN.prototype.setConnectedScreenStatus=aN.prototype.pN;aN.prototype.stopSession=aN.prototype.SE;aN.prototype.getCastSession=aN.prototype.Y;aN.prototype.requestSession=aN.prototype.requestSession;aN.prototype.init=aN.prototype.init;aN.prototype.dispose=aN.prototype.dispose;var bP=[],JVE=(0,g.Wr)`https://www.gstatic.com/cv/js/sender/v1/cast_sender.js`;g.z=$n.prototype; g.z.reset=function(k){this.listId="";this.index=-1;this.videoId="";pC(this);this.volume=-1;this.muted=!1;k&&(this.index=k.index,this.listId=k.listId,this.videoId=k.videoId,this.playerState=k.playerState,this.volume=k.volume,this.muted=k.muted,this.audioTrackId=k.audioTrackId,this.trackData=k.trackData,this.hasPrevious=k.hasPrevious,this.hasNext=k.hasNext,this.V=k.playerTime,this.W=k.playerTimeAt,this.B=k.seekableStart,this.L=k.seekableEnd,this.j=k.duration,this.loadedTime=k.loadedTime,this.S=k.liveIngestionTime, this.J=!isNaN(this.S))}; g.z.isPlaying=function(){return this.playerState==1}; g.z.isBuffering=function(){return this.playerState==3}; g.z.O9=function(k){this.j=isNaN(k)?0:k}; g.z.getDuration=function(){return this.J?this.j+NI(this):this.j}; g.z.clone=function(){return new $n(JL(this))};var IvO=class extends g.O8{constructor(){var k=LV();super();this.j=0;this.J=k;this.L=[];this.W=new K4m;this.B=this.S=null;this.Y=(0,g.pz)(this.eE,this);this.D=(0,g.pz)(this.V,this);this.dM=(0,g.pz)(this.Wy,this);this.By=(0,g.pz)(this.IQ,this);let U=0;k?(U=k.getProxyState(),U!=3&&(k.subscribe("proxyStateChange",this.x$,this),WXO(this))):U=3;U!=0&&g.D2(()=>{this.x$(U)},0); (k=Yhx())&&eF(this,k);this.subscribe("yt-remote-cast2-session-change",this.By)}getState(){return this.j}T5(){return this.J.getReconnectTimeout()}GY(){this.J.reconnect()}play(){Pw(this)?(this.S?this.S.play(null,g.TK,Dc(this,"play")):Yn(this,"play"),Ww(this,1,IN(Bw(this))),this.publish("remotePlayerChange")):jF(this,this.play)}pause(){Pw(this)?(this.S?this.S.pause(null,g.TK,Dc(this,"pause")):Yn(this,"pause"),Ww(this,2,IN(Bw(this))),this.publish("remotePlayerChange")):jF(this,this.pause)}seekTo(k){if(Pw(this)){if(this.S){const U= Bw(this),n=new chrome.cast.media.SeekRequest;n.currentTime=k;U.isPlaying()||U.isBuffering()?n.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:n.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.S.seek(n,g.TK,Dc(this,"seekTo",{newTime:k}))}else Yn(this,"seekTo",{newTime:k});Ww(this,3,k);this.publish("remotePlayerChange")}else jF(this,g.N6(this.seekTo,k))}stop(){if(Pw(this)){this.S?this.S.stop(null,g.TK,Dc(this,"stopVideo")):Yn(this,"stopVideo");var k=Bw(this);k.index=-1;k.videoId= "";pC(k);oN(this,k);this.publish("remotePlayerChange")}else jF(this,this.stop)}setVolume(k,U){if(Pw(this)){var n=Bw(this);if(this.B){if(n.volume!=k){const Z=Math.round(k)/100;this.B.setReceiverVolumeLevel(Z,(0,g.pz)(function(){Ss("set receiver volume: "+Z)},this),(0,g.pz)(function(){this.kJ("failed to set receiver volume.")},this))}n.muted!=U&&this.B.setReceiverMuted(U,(0,g.pz)(function(){Ss("set receiver muted: "+U)},this),(0,g.pz)(function(){this.kJ("failed to set receiver muted.")},this))}else{const Z= {volume:k, muted:U};n.volume!=-1&&(Z.delta=k-n.volume);Yn(this,"setVolume",Z)}n.muted=U;n.volume=k;oN(this,n)}else jF(this,g.N6(this.setVolume,k,U))}X(k,U){if(Pw(this)){var n=Bw(this);k={videoId:k};U&&(n.trackData={trackName:U.name,languageCode:U.languageCode,sourceLanguageCode:U.translationLanguage?U.translationLanguage.languageCode:"",languageName:U.languageName,kind:U.kind},k.style=g.Ki(U.style),g.xB(k,n.trackData));Yn(this,"setSubtitlesTrack",k);oN(this,n)}else jF(this,g.N6(this.X,k,U))}setAudioTrack(k, U){Pw(this)?(U=U.getLanguageInfo().getId(),Yn(this,"setAudioTrack",{videoId:k,audioTrackId:U}),k=Bw(this),k.audioTrackId=U,oN(this,k)):jF(this,g.N6(this.setAudioTrack,k,U))}playVideo(k,U,n,Z=null,C=null,r=null,L=null){const F=Bw(this),v={videoId:k};n!==void 0&&(v.currentIndex=n);qI(F,k,n||0);U!==void 0&&(tL(F,U),v.currentTime=U);Z&&(v.listId=Z);C&&(v.playerParams=C);r&&(v.clickTrackingParams=r);L&&(v.locationInfo=g.Ki(L));Yn(this,"setPlaylist",v);Z||oN(this,F)}pL(k,U){if(Pw(this)){if(k&&U){const n= Bw(this);qI(n,k,U);oN(this,n)}Yn(this,"previous")}else jF(this,g.N6(this.pL,k,U))}nextVideo(k,U){if(Pw(this)){if(k&&U){const n=Bw(this);qI(n,k,U);oN(this,n)}Yn(this,"next")}else jF(this,g.N6(this.nextVideo,k,U))}fY(){if(Pw(this)){Yn(this,"clearPlaylist");var k=Bw(this);k.reset();oN(this,k);this.publish("remotePlayerChange")}else jF(this,this.fY)}SE(){Pw(this)?Yn(this,"dismissAutoplay"):jF(this,this.SE)}dispose(){if(this.j!=3){const k=this.j;this.j=3;this.publish("proxyStateChange",k,this.j)}super.dispose()}Q$(){jhs(this); this.J=null;this.W.clear();eF(this,null);super.Q$()}x$(k){if((k!=this.j||k==2)&&this.j!=3&&k!=0){var U=this.j;this.j=k;this.publish("proxyStateChange",U,k);if(k==1)for(;!this.W.isEmpty();)U=k=this.W,U.S.length===0&&(U.S=U.B,U.S.reverse(),U.B=[]),k.S.pop().apply(this);else k==3&&this.dispose()}}V$(k,U){this.publish(k,U)}eE(k){if(!k)this.V(null),eF(this,null);else if(this.B.receiver.volume){k=this.B.receiver.volume;const U=Bw(this),n=Math.round(100*k.level||0);if(U.volume!=n||U.muted!=k.muted)Ss("Cast volume update: "+ k.level+(k.muted?" muted":"")),U.volume=n,U.muted=!!k.muted,oN(this,U)}}V(k){Ss("Cast media: "+!!k);this.S&&this.S.removeUpdateListener(this.dM);if(this.S=k)this.S.addUpdateListener(this.dM),ShV(this),this.publish("remotePlayerChange")}Wy(k){k?(ShV(this),this.publish("remotePlayerChange")):this.V(null)}I6(){Yn(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}IQ(){const k=Yhx();k&&eF(this,k)}kJ(k){js("CP",k)}};var AF=class extends g.O8{constructor(k,U=!1){var n=lP,Z=CV();super();this.V=NaN;this.Wy=!1;this.Y=this.dM=this.x$=this.By=NaN;this.SE=[];this.W=this.X=this.J=this.S=this.B=null;this.aQ=n;this.V$=U;this.SE.push(g.ka(window,"beforeunload",()=>{this.L(2)})); this.j=[];this.S=new $n;this.uL=k.id;this.IQ=k.idType;this.B=jom(this.aQ,Z,this.eE,this.IQ=="shortLived",this.uL);this.B.listen("channelOpened",()=>{Gkx(this)}); this.B.listen("channelClosed",()=>{SF("Channel closed");isNaN(this.V)?QA(!0):QA();this.dispose()}); this.B.listen("channelError",C=>{QA();isNaN(this.D())?(C==1&&this.IQ=="shortLived"&&this.publish("browserChannelAuthError",C),SF(`Channel error: ${C} without reconnection`),this.dispose()):(this.Wy=!0,SF("Channel error: "+C+" with reconnection in "+this.D()+" ms"),fC(this,2))}); this.B.listen("channelMessage",C=>{ZWi(this,C)}); this.B.qp(k.token);this.subscribe("remoteQueueChange",()=>{var C=this.S.videoId;g.O9()&&g.Lr("yt-remote-session-video-id",C)})}connect(k,U){if(U){var n=U.listId; const Z=U.videoId,C=U.videoIds,r=U.playerParams,L=U.clickTrackingParams,F=U.index,v={videoId:Z},O=U.currentTime,w=U.locationInfo;U=U.loopMode;O!==void 0&&(v.currentTime=O<=5?0:O);r&&(v.playerParams=r);w&&(v.locationInfo=w);L&&(v.clickTrackingParams=L);n&&(v.listId=n);C&&C.length>0&&(v.videoIds=C.join(","));F!==void 0&&(v.currentIndex=F);this.V$&&(v.loopMode=U||"LOOP_MODE_OFF");n&&(this.S.listId=n);this.S.videoId=Z;this.S.index=F||0;this.S.state=3;tL(this.S,O);this.W="UNSUPPORTED";n=this.V$?"setInitialState": "setPlaylist";SF(`Connecting with ${n} and params: ${g.Ki(v)}`);this.B.connect({method:n,params:g.Ki(v)},k,UQx())}else SF("Connecting without params"),this.B.connect({},k,UQx());CUB(this)}qp(k){this.B.qp(k)}dispose(){this.LN()||(g.HJ("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),fC(this,3));super.dispose()}Q$(){MI(this);yR(this);GB(this);g.WE(this.dM);this.dM=NaN;g.WE(this.Y);this.Y=NaN;this.J=null;g.io(this.SE);this.SE.length=0;this.B.dispose();super.Q$();this.W=this.X=this.j= this.S=this.B=null}TJ(k){if(!this.j||this.j.length===0)return!1;for(const U of this.j)if(!U.capabilities.has(k))return!1;return!0}h8(){let k=3;this.LN()||(k=0,isNaN(this.D())?this.B.hN()&&isNaN(this.V)&&(k=1):k=2);return k}L(k){SF("Disconnecting with "+k);g.HJ("yt.mdx.remote.remoteClient_",null);MI(this);this.publish("beforeDisconnect",k);k==1&&QA();this.B.disconnect(k);this.dispose()}Fo(){let k=this.S;this.J&&(k=this.S.clone(),qI(k,this.J,k.index));return JL(k)}xo(k){const U=new $n(k);U.videoId&& U.videoId!=this.S.videoId&&(this.J=U.videoId,g.WE(this.dM),this.dM=g.D2(()=>{if(this.J){const Z=this.J;this.J=null;this.S.videoId!=Z&&cw(this,"getNowPlaying")}},5E3)); const n=[];this.S.listId==U.listId&&this.S.videoId==U.videoId&&this.S.index==U.index||n.push("remoteQueueChange");this.S.playerState==U.playerState&&this.S.volume==U.volume&&this.S.muted==U.muted&&IN(this.S)==IN(U)&&g.Ki(this.S.trackData)==g.Ki(U.trackData)||n.push("remotePlayerChange");this.S.reset(k);g.SU(n,function(Z){this.publish(Z)},this)}pN(){const k=this.B.getDeviceId(),U=g.kB(this.j,function(n){return n.type=="REMOTE_CONTROL"&&n.id!=k}); return U?U.id:""}D(){return this.B.T5()}bL(){return this.W||"UNSUPPORTED"}GJ(){return this.X||""}Xo(){!isNaN(this.D())&&this.B.GY()}Y$(k,U){cw(this,k,U);Fj_(this)}eE(){var k=g.g0("SAPISID","")||g.g0("__Secure-1PAPISID")||"",U=g.g0("__Secure-3PAPISID","")||"";if(!k&&!U)return"";k=g.p0(g.TV(k),2);U=g.p0(g.TV(U),2);return g.p0(g.TV(`,${k},${U}`),2)}};AF.prototype.subscribe=AF.prototype.subscribe;AF.prototype.unsubscribeByKey=AF.prototype.sN;AF.prototype.getProxyState=AF.prototype.h8; AF.prototype.disconnect=AF.prototype.L;AF.prototype.getPlayerContextData=AF.prototype.Fo;AF.prototype.setPlayerContextData=AF.prototype.xo;AF.prototype.getOtherConnectedRemoteId=AF.prototype.pN;AF.prototype.getReconnectTimeout=AF.prototype.D;AF.prototype.getAutoplayMode=AF.prototype.bL;AF.prototype.getAutoplayVideoId=AF.prototype.GJ;AF.prototype.reconnect=AF.prototype.Xo;AF.prototype.sendMessage=AF.prototype.Y$;AF.prototype.getXsrfToken=AF.prototype.eE; AF.prototype.isCapabilitySupportedOnConnectedDevices=AF.prototype.TJ;var Eu8=class extends yl{constructor(k){super("ScreenServiceProxy");this.YJ=k;this.S=[];this.S.push(this.YJ.$_s("screenChange",(0,g.pz)(this.B,this)));this.S.push(this.YJ.$_s("onlineScreenChange",(0,g.pz)(this.j,this)))}wy(k){return this.YJ.$_gs(k)}contains(k){return!!this.YJ.$_c(k)}get(k){return this.YJ.$_g(k)}start(){this.YJ.$_st()}add(k,U,n){this.YJ.$_a(k,U,n)}remove(k,U,n){this.YJ.$_r(k,U,n)}UL(k,U,n,Z){this.YJ.$_un(k,U,n,Z)}Q$(){const k=this.S.length;for(let U=0;U{VCB(this,Z)}); g.K(this,this.events);this.events.K(U,"onCaptionsTrackListChanged",this.Xo);this.events.K(U,"captionschanged",this.aQ);this.events.K(U,"captionssettingschanged",this.V$);this.events.K(U,"videoplayerreset",this.L);this.events.K(U,"mdxautoplaycancel",()=>{this.ol.SE()}); U.C("enable_mdx_video_play_directly")&&this.events.K(U,"videodatachange",()=>{hXE(this.S)||dD(this)||HL(this,0)}); k=this.ol;k.LN();k.subscribe("proxyStateChange",this.Wy,this);k.subscribe("remotePlayerChange",this.W,this);k.subscribe("remoteQueueChange",this.L,this);k.subscribe("previousNextChange",this.By,this);k.subscribe("nowAutoplaying",this.x$,this);k.subscribe("autoplayDismissed",this.SE,this);g.K(this,this.B);g.K(this,this.j);g.K(this,this.dM);g.K(this,this.Y);g.K(this,this.D);this.V$();this.L();this.W()}Q$(){super.Q$();this.B.stop();this.j.stop();this.dM.stop();const k=this.ol;k.unsubscribe("proxyStateChange", this.Wy,this);k.unsubscribe("remotePlayerChange",this.W,this);k.unsubscribe("remoteQueueChange",this.L,this);k.unsubscribe("previousNextChange",this.By,this);k.unsubscribe("nowAutoplaying",this.x$,this);k.unsubscribe("autoplayDismissed",this.SE,this);this.ol=this.S=null}wk(k,...U){if(this.ol.j!=2)if(dD(this)){if(Bw(this.ol).playerState!=1081||k!=="control_seek")switch(k){case "control_toggle_play_pause":Bw(this.ol).isPlaying()?this.ol.pause():this.ol.play();break;case "control_play":this.ol.play(); break;case "control_pause":this.ol.pause();break;case "control_seek":this.D.J(U[0],U[1]);break;case "control_subtitles_set_track":RX(this,U[0]);break;case "control_set_audio_track":this.setAudioTrack(U[0])}}else switch(k){case "control_toggle_play_pause":case "control_play":case "control_pause":k=this.O.getCurrentTime();HL(this,k===0?void 0:k);break;case "control_seek":HL(this,U[0]);break;case "control_subtitles_set_track":RX(this,U[0]);break;case "control_set_audio_track":this.setAudioTrack(U[0])}}aQ(k){this.dM.fJ(k)}uL(k){this.wk("control_subtitles_set_track", g.Gp(k)?null:k)}V$(){const k=this.O.getOption("captions","track");g.Gp(k)||RX(this,k)}p7(k){this.S.p7(k,this.O.getVideoData().lengthSeconds)}Xo(){g.Gp(this.J)||HW8(this,this.J);this.V=!1}Wy(k,U){this.j.stop();U===2&&this.IQ()}W(){if(dD(this)){this.B.stop();var k=Bw(this.ol);switch(k.playerState){case 1080:case 1081:case 1084:case 1085:this.S.F6=1;break;case 1082:case 1083:this.S.F6=0;break;default:this.S.F6=-1}switch(k.playerState){case 1081:case 1:this.xF(new g.wo(8));this.eE();break;case 1085:case 3:this.xF(new g.wo(9)); break;case 1083:case 0:this.xF(new g.wo(2));this.D.stop();this.p7(this.O.getVideoData().lengthSeconds);break;case 1084:this.xF(new g.wo(4));break;case 2:this.xF(new g.wo(4));this.p7(IN(k));break;case -1:this.xF(new g.wo(64));break;case -1E3:this.xF(new g.wo(128,{errorCode:"mdx.remoteerror",errorMessage:"Este v\u00eddeo no se puede reproducir de forma remota.",DB:2}))}const n=Bw(this.ol).trackData;k=n;var U=this.J;(k||U?k&&U&&k.trackName==U.trackName&&k.languageCode==U.languageCode&&k.languageName== U.languageName&&k.kind==U.kind:1)||(this.J=n,HW8(this,n));k=Bw(this.ol);k.volume===-1||Math.round(this.O.getVolume())===k.volume&&this.O.isMuted()===k.muted||this.Y.isActive()||this.pN()}else RXb(this)}By(){this.O.publish("mdxpreviousnextchange")}L(){dD(this)||RXb(this)}x$(k){isNaN(k)||this.O.publish("mdxnowautoplaying",k)}SE(){this.O.publish("mdxautoplaycanceled")}setAudioTrack(k){dD(this)&&this.ol.setAudioTrack(Vd(this).videoId,k)}seekTo(k,U){Bw(this.ol).playerState===-1?HL(this,k):U&&this.ol.seekTo(k)}pN(){if(dD(this)){var k= Bw(this.ol);this.events.V4(this.TJ);k.muted?this.O.mute():this.O.unMute();this.O.setVolume(k.volume);this.TJ=this.events.K(this.O,"onVolumeChange",U=>{VCB(this,U)})}}eE(){this.B.stop(); if(!this.ol.LN()){var k=Bw(this.ol);k.isPlaying()&&this.xF(new g.wo(8));this.p7(IN(k));this.B.start()}}IQ(){this.j.stop();this.B.stop();const k=this.ol.T5();this.ol.j==2&&!isNaN(k)&&this.j.start()}xF(k){this.j.stop();const U=this.X;if(!g.VO(U,k)){const n=k.S(2);n!==this.X.S(2)&&this.O.eV(n);this.X=k;bW7(this.S,U,k)}}};var J6b=class extends g.G${constructor(k,U){super(k);this.S=U}getCurrentTime(){return this.S.getCurrentTime()}getDuration(){return this.S.getDuration()}jl(){return this.S.jl()}v6(){return this.S.v6()}zo(){return this.S.zo()}C9(){return this.S.C9()}getPlayerState(){return this.S.K6}isAtLiveHead(){return this.S.isAtLiveHead()}pauseVideo(){hF(this.S,"control_pause")}async playVideo(){hF(this.S,"control_play")}seekTo(k,U){hF(this.S,"control_seek",k,!U?.Cp)}Ez(k){hF(this.S,"control_set_audio_track",k); return!0}};var eX7=class extends g.l{constructor(){super({Z:"div",A:"ytp-mdx-popup-dialog",N:{role:"dialog"},G:[{Z:"div",A:"ytp-mdx-popup-dialog-inner-content",G:[{Z:"div",A:"ytp-mdx-popup-title",zJ:"No has iniciado sesi\u00f3n"},{Z:"div",A:"ytp-mdx-popup-description",zJ:"Los v\u00eddeos que veas podr\u00edan aparecer en el historial de reproducciones de la TV e influir en las recomendaciones. Puedes evitarlo si cancelas e inicias sesi\u00f3n en YouTube desde tu ordenador."},{Z:"div",A:"ytp-mdx-privacy-popup-buttons", G:[{Z:"button",O4:["ytp-button","ytp-mdx-privacy-popup-cancel"],zJ:"Cancelar"},{Z:"button",O4:["ytp-button","ytp-mdx-privacy-popup-confirm"],zJ:"Confirmar"}]}]}]});this.fade=new g.Wf(this,250);this.cancelButton=this.jE("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.jE("ytp-mdx-privacy-popup-confirm");g.K(this,this.fade);this.K(this.cancelButton,"click",this.S);this.K(this.confirmButton,"click",this.B)}K7(){this.fade.show()}Lm(){this.fade.hide()}S(){TA("mdx-privacy-popup-cancel");this.Lm()}B(){TA("mdx-privacy-popup-confirm"); this.Lm()}};var Bqb=class extends g.l{constructor(k){super({Z:"div",A:"ytp-remote",G:[{Z:"div",A:"ytp-remote-display-status",G:[{Z:"div",A:"ytp-remote-display-status-icon",G:[g.M3n()]},{Z:"div",A:"ytp-remote-display-status-text",zJ:"{{statustext}}"}]}]});this.api=k;this.fade=new g.Wf(this,250);g.K(this,this.fade);this.K(k,"presentingplayerstatechange",this.onStateChange);this.L7(k.getPlayerStateObject())}onStateChange(k){this.L7(k.state)}L7(k){if(this.api.getPresentingPlayerType()===3){const U={RECEIVER_NAME:this.api.getOption("remote", "currentReceiver").name};k=k.S(128)?g.q2("No se ha podido reproducir el v\u00eddeo en $RECEIVER_NAME",U):k.isPlaying()||k.isPaused()?g.q2("El v\u00eddeo se est\u00e1 reproduciendo en $RECEIVER_NAME",U):g.q2("Conectado/a a $RECEIVER_NAME",U);this.updateValue("statustext",k);this.fade.show()}else this.fade.hide()}};var PUm=class extends g.Ij{constructor(k,U){super("Reproducir en",1,k,U);this.O=k;this.ZN={};this.K(k,"onMdxReceiversChange",this.V);this.K(k,"presentingplayerstatechange",this.V);this.V()}V(){var k=this.O.getOption("remote","receivers");k&&k.length>1&&!this.O.getOption("remote","quickCast")?(this.ZN=g.Nx(k,this.W,this),this.J(g.fz(k,this.W)),k=this.O.getOption("remote","currentReceiver"),k=this.W(k),this.options[k]&&this.B(k),this.enable(!0)):this.enable(!1)}W(k){return k.key}j(k){return k==="cast-selector-receiver"? "Enviar...":this.ZN[k].name}S(k){super.S(k);this.O.setOption("remote","currentReceiver",this.ZN[k]);this.dt.Lm()}};g.Jq("remote",class extends g.eX{constructor(k){super(k);this.JC={key:dQ(),name:"Este ordenador"};this.Cc=null;this.subscriptions=[];this.dN=this.ol=null;this.ZN=[this.JC];this.Qu=this.JC;this.K6=new g.wo(64);this.zn=0;this.F6=-1;this.Wl=!1;this.rD=this.fG=this.Pe=null;if(!g.FG(this.player.U())&&!g.mN(this.player.U())){k=this.player;var U=g.Ec(k);U&&(U=U.Ik())&&(U=new PUm(k,U),g.K(this,U));U=new Bqb(k);g.K(this,U);g.$Z(k,U.element,4);this.Pe=new eX7;g.K(this,this.Pe);g.$Z(k,this.Pe.element,4);this.Wl= !!ZO()}}create(){var k=this.player.U();const U=g.Oj(k);k={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:k.C("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:k.C("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:k.C("enable_cast_short_lived_lounge_token")};uA8(U,k);this.subscriptions.push(g.rk("yt-remote-before-disconnect",this.BA,this));this.subscriptions.push(g.rk("yt-remote-connection-change",this.WW,this));this.subscriptions.push(g.rk("yt-remote-receiver-availability-change", this.zl,this));this.subscriptions.push(g.rk("yt-remote-auto-connect",this.JU,this));this.subscriptions.push(g.rk("yt-remote-receiver-resumed",this.jU,this));this.subscriptions.push(g.rk("mdx-privacy-popup-confirm",this.Bk,this));this.subscriptions.push(g.rk("mdx-privacy-popup-cancel",this.QT,this));this.zl()}load(){this.player.cancelPlayback();super.load();this.rD=new J6b(this.player.U(),this);this.player.FH(this.rD);this.Cc=new qdV(this,this.player,this.ol);var k=(k=d8m())?k.currentTime:0;const U= gD()?new IvO:null;k==0&&U&&(k=IN(Bw(U)));k!==0&&this.p7(k);bW7(this,this.K6,this.K6);this.player.Kt(6)}unload(){this.player.publish("mdxautoplaycanceled");this.player.yh();this.Qu=this.JC;g.yN(this.Cc,this.ol);this.ol=this.rD=this.Cc=null;super.unload();this.player.Kt(5);b4(this)}Q$(){g.LN(this.subscriptions);super.Q$()}getAdState(){return this.F6}hasPrevious(){return this.ol?Bw(this.ol).hasPrevious:!1}hasNext(){return this.ol?Bw(this.ol).hasNext:!1}p7(k,U){this.zn=k||0;this.player.publish("progresssync", k,U);g.wh(this.player,"onVideoProgress",k||0)}getCurrentTime(){return this.zn}getDuration(){return Bw(this.ol).getDuration()||0}jl(){var k=Bw(this.ol);return k.J?k.S+NI(k):k.S}v6(){return Bw(this.ol).loadedTime}zo(){return ojE(Bw(this.ol))}C9(){var k=Bw(this.ol);return k.B>0?k.B+NI(k):k.B}getProgressState(){const k=Bw(this.ol),U=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:k.playerState!=1081&&this.player.Rd(),clipEnd:U.clipEnd,clipStart:U.clipStart,current:this.getCurrentTime(), displayedStart:-1,duration:this.getDuration(),ingestionTime:this.jl(),isAtLiveHead:this.isAtLiveHead(),loaded:this.v6(),seekableEnd:this.zo(),seekableStart:this.C9(),offset:0,viewerLivestreamJoinMediaTime:0}}isAtLiveHead(){return ojE(Bw(this.ol))-this.getCurrentTime()<=1}nextVideo(){this.ol&&this.ol.nextVideo()}pL(){this.ol&&this.ol.pL()}BA(k){k===1&&(this.dN=this.ol?Bw(this.ol):null)}WW(){var k=gD()?new IvO:null;if(k){const U=this.Qu;this.loaded&&this.unload();this.ol=k;this.dN=null;U.key!==this.JC.key&& (this.Qu=U,this.load())}else g.MD(this.ol),this.ol=null,this.loaded&&(this.unload(),(k=this.dN)&&k.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(k.videoId,IN(k)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}zl(){var k=[this.JC],U=k.concat;const n=guV();zB()&&g.F6("yt-remote-cast-available")&&n.push({key:"cast-selector-receiver",name:"Cast..."});this.ZN=U.call(k,n);k=FH()||this.JC;z2(this,k);g.wh(this.player,"onMdxReceiversChange")}JU(){const k= FH();z2(this,k)}jU(){this.Qu=FH()}Bk(){this.Wl=!0;b4(this);EU=!1;vL&&wD(vL,1);vL=null}QT(){this.Wl=!1;b4(this);z2(this,this.JC);this.Qu=this.JC;EU=!1;vL=null;this.player.playVideo()}NT(k,U){switch(k){case "casting":return this.loaded;case "receivers":return this.ZN;case "currentReceiver":return U&&(U.key==="cast-selector-receiver"?KC():z2(this,U)),this.loaded?this.Qu:this.JC;case "quickCast":return this.ZN.length===2&&this.ZN[1].key==="cast-selector-receiver"?(U&&KC(),!0):!1}}I6(){this.ol.I6()}VE(){return!1}getOptions(){return["casting", "receivers","currentReceiver","quickCast"]}isLoggedIn(){return g.Y("PLAYER_CONFIG")?.args?.authuser!==void 0?!0:!(!g.Y("SESSION_INDEX")&&!g.Y("LOGGED_IN"))}});})(_yt_player);