(function(g){var window=this;'use strict';var cck=function(R,w){return g.Ym(R,w)},Pga=function(R){if(R instanceof g.tQ)return R; if(typeof R.xH=="function")return R.xH(!1);if(g.OI(R)){let w=0;const p=new g.tQ;p.next=function(){for(;;){if(w>=R.length)return g.SF;if(w in R)return g.ON(R[w++]);w++}}; return p}throw Error("Not implemented");},a_U=function(R,w,p){if(g.OI(R))g.iH(R,w,p); else for(R=Pga(R);;){const {done:r,value:f}=R.next();if(r)break;w.call(p,f,void 0,R)}},fY=function(R){g.Ry(R,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^g.c6()).toString(36)); return R},GC=function(R,w,p){Array.isArray(p)||(p=[String(p)]); g.Ga(R.G,w,p)},$Pa=function(R,w){const p=[]; a_U(w,function(r){let f;try{f=g.XH.prototype.LR.call(this,r,!0)}catch(G){if(G=="Storage: Invalid value was encountered")return;throw G;}f===void 0?p.push(r):g.$D(f)&&p.push(r)},R); return p},XAV=function(R,w){$Pa(R,w).forEach(function(p){g.XH.prototype.remove.call(this,p)},R)},nIP=function(R){if(R.f_){if(R.f_.locationOverrideToken)return{locationOverrideToken:R.f_.locationOverrideToken}; if(R.f_.latitudeE7!=null&&R.f_.longitudeE7!=null)return{latitudeE7:R.f_.latitudeE7,longitudeE7:R.f_.longitudeE7}}return null},dPa=function(R,w){g.ra(R,w)||R.push(w)},IG=function(R){let w=0; for(const p in R)w++;return w},ZuR=function(R){try{return g.qx.JSON.parse(R)}catch(w){}R=String(R); if(/^\s*$/.test(R)?0:/^[\],:{}\s\u2028\u2029]*$/.test(R.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("("+R+")")}catch(w){}throw Error("Invalid JSON string: "+R);},CY=function(R){if(g.qx.JSON)try{return g.qx.JSON.parse(R)}catch(w){}return ZuR(R)},Y8m=function(R,w,p,r){const f=new g.Qd(null); R&&g.hD(f,R);w&&g.g4(f,w);p&&g.Hh(f,p);r&&(f.C=r);return f},FGa=function(R,w){return new g.YGb(R,w)},uQ=function(R,w){return Object.prototype.hasOwnProperty.call(R,w)},jea=function(R,w){return R===w},s7=function(R,w){this.C={}; this.L=[];this.rM=this.size=0;var p=arguments.length;if(p>1){if(p%2)throw Error("Uneven number of arguments");for(var r=0;r{R.capabilities.add(p)})},T8b=function(R,w){R.compatibleSenderThemes.clear(); g.QD(w.split(","),g.Mx(cck,h4U)).forEach(p=>{R.compatibleSenderThemes.add(p)})},iup=function(R,w){R.experiments.clear(); w.split(",").forEach(p=>{R.experiments.add(p)})},Bm=function(R){R=R||{}; this.name=R.name||"";this.id=R.id||R.screenId||"";this.token=R.token||R.loungeToken||"";this.uuid=R.uuid||R.dialId||"";this.idType=R.screenIdType||"normal";this.secret=R.screenIdSecret||""},Wm=function(R,w){return!!w&&(R.id==w||R.uuid==w)},gIm=function(R){return{name:R.name, screenId:R.id,loungeToken:R.token,dialId:R.uuid,screenIdType:R.idType,screenIdSecret:R.secret}},Hup=function(R){return new Bm(R)},vIp=function(R){return Array.isArray(R)?g.gd(R,Hup):[]},xx=function(R){return R?`{name:"${R.name}",id:${R.id.substr(0,6)}..,token:${R.token?".."+R.token.slice(-6):"-"},uuid:${R.uuid?".."+R.uuid.slice(-6):"-"},idType:${R.idType},secret:${R.secret?".."+R.secret.slice(-6):"-"}}`:"null"},lQ=function(R){return Array.isArray(R)?"["+g.gd(R,xx).join(",")+"]":"null"},LY=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(R){const w=Math.random()*16|0; return(R=="x"?w:w&3|8).toString(16)})},N8k=function(R){return g.gd(R,function(w){return{key:w.id, name:w.name}})},qE=function(R,w){return g.S_(R,function(p){return p||w?!p!=!w?!1:p.id==w.id:!0})},AX=function(R,w){return g.S_(R,function(p){return Wm(p,w)})},k86=function(){const R=g.iB.oL(); R&&XAV(R,R.MV.xH(!0))},bQ=function(){const R=g.hj("yt-remote-connected-devices")||[]; g.tt(R);return R},UPk=function(R){if(R.length==0)return[]; const w=R[0].indexOf("#"),p=w==-1?R[0]:R[0].substring(0,w);return g.gd(R,function(r,f){return f==0?r:r.substring(p.length)})},S86=function(R){g.Qp("yt-remote-connected-devices",R,86400)},VH=function(){if(yH)return yH; let R=g.hj("yt-remote-device-id");R||(R=LY(),g.Qp("yt-remote-device-id",R,31536E3));const w=bQ();let p=1,r=R;for(;g.ra(w,r);)p++,r=R+"#"+p;return yH=r},oG=function(){let R=bQ(); const w=VH();g.He()&&g.KR(R,w);R=UPk(R);if(R.length==0)try{g.Us("remote_sid")}catch(p){}else try{g.NL("remote_sid",R.join(","),-1)}catch(p){}},RMp=function(){return g.hj("yt-remote-session-browser-channel")},wvb=function(){return g.hj("yt-remote-local-screens")||[]},pv6=function(){g.Qp("yt-remote-lounge-token-expiration",!0,86400)},r8R=function(R){R.length>5&&(R=R.slice(R.length-5)); const w=g.gd(wvb(),function(r){return r.loungeToken}),p=g.gd(R,function(r){return r.loungeToken}); g.kb(p,function(r){return!g.ra(w,r)})&&pv6(); g.Qp("yt-remote-local-screens",R,31536E3)},tX=function(R){R||(g.gy("yt-remote-session-screen-id"),g.gy("yt-remote-session-video-id")); oG();R=bQ();g.CR(R,VH());S86(R)},f1b=function(){if(!O7){const R=g.Ju(); R&&(O7=new g.ex(R))}},GFM=function(){f1b(); return O7?!!O7.get("yt-remote-use-staging-server"):!1},KY=function(R,w){g.ZW[R]=!0; const p=g.ni();p&&p.publish.apply(p,arguments);g.ZW[R]=!1},E7=function(){let R=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return R?parseInt(R[1],10):0},I1t=function(R){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+R)!=-1||document.currentScript.src.indexOf("&"+R)!=-1)},C9a=function(){return typeof window.__onGCastApiAvailable=="function"?window.__onGCastApiAvailable:null},Dz=function(R){R.length?uBt(R.shift(),function(){Dz(R)}):e7()},e7=function(){let R=C9a(); R&&R(!1,"No cast extension found")},uBt=function(R,w,p){let r=document.createElement("script"); r.onerror=w;p&&(r.onload=p);g.Sa(r,g.wD(R));(document.head||document.documentElement).appendChild(r)},sRP=function(R){return"chrome-extension://"+R+"/cast_sender.js"},m3i=function(){const R=E7(),w=[]; if(R>1){const p=R-1;w.push("//www.gstatic.com/eureka/clank/"+R+"/cast_sender.js");w.push("//www.gstatic.com/eureka/clank/"+p+"/cast_sender.js")}return w},ME=function(){if(zMm){var R=2,w=C9a(),p=function(){R--; R==0&&w&&w(!0)}; window.__onGCastApiAvailable=p;uBt("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",e7,p)}},Beb=function(){ME(); let R=m3i();R.push("//www.gstatic.com/eureka/clank/cast_sender.js");Dz(R)},x3p=function(){ME(); let R=m3i();R.push(...Wsb.map(sRP));R.push("//www.gstatic.com/eureka/clank/cast_sender.js");Dz(R)},cm=function(R,w,p){g.f5.call(this); this.J=p!=null?(0,g.e_)(R,p):R;this.Tv=w;this.K=(0,g.e_)(this.lV,this);this.L=!1;this.C=0;this.O=this.A2=null;this.G=[]},Pm=function(){this.L=g.c6()},l1m=function(){aG||(aG=new Pm)},Lsb=function(){aG||(aG=new Pm)},$x=function(){g.IR.call(this,"p")},Xv=function(){g.IR.call(this,"o")},nY=function(){return q1P=q1P||new g.E1},A8P=function(R){g.IR.call(this,"serverreachability",R)},dh=function(R){const w=nY(); w.dispatchEvent(new A8P(w,R))},b9m=function(R){g.IR.call(this,"statevent",R)},Zz=function(R){const w=nY(); w.dispatchEvent(new b9m(w,R))},y8i=function(R,w,p,r){g.IR.call(this,"timingevent",R); this.size=w;this.rtt=p;this.retries=r},Yx=function(R,w){if(typeof R!=="function")throw Error("Fn must not be null and must be a function"); return g.qx.setTimeout(function(){R()},w)},Fv=function(){},j7=function(R,w,p,r){this.O=R; this.G=w;this.f_=p;this.p_=r||1;this.N0=new g.uO(this);this.Qk=45E3;this.Jl=null;this.J=!1;this.X=this.nB=this.U=this.jI=this.xY=this.q0=this.pB=null;this.S=[];this.L=null;this.D=0;this.K=this.O0=null;this.eI=-1;this.M0=!1;this.U0=0;this.YY=null;this.mq=this.PS=this.SI=this.I0=!1;this.C=new VZt},VZt=function(){this.O=null; this.L="";this.C=!1},JX=function(R,w,p){R.jI=1; R.U=fY(w.clone());R.X=p;R.I0=!0;oZb(R,null)},oZb=function(R,w){R.xY=Date.now(); TC(R);R.nB=R.U.clone();GC(R.nB,"t",R.p_);R.D=0;const p=R.O.PS;R.C=new VZt;R.L=tZV(R.O,p?w:null,!R.X);R.U0>0&&(R.YY=new g.yV((0,g.e_)(R.hJ,R,R.L),R.U0));R.N0.listen(R.L,"readystatechange",R.P8);w=R.Jl?g.ht(R.Jl):{};R.X?(R.O0||(R.O0="POST"),w["Content-Type"]="application/x-www-form-urlencoded",R.L.send(R.nB,R.O0,R.X,w)):(R.O0="GET",R.L.send(R.nB,R.O0,null,w));dh(1)},Ksp=function(R){if(!O9U(R))return g.$w(R.L); const w=g.XM(R.L);if(w==="")return"";let p="";const r=w.length,f=g.c5(R.L)==4;if(!R.C.O){if(typeof TextDecoder==="undefined")return iQ(R),QH(R),"";R.C.O=new g.qx.TextDecoder}for(let G=0;Gw.length)return hX;w=w.slice(r,r+p);R.D=r+p;return w},TC=function(R){R.q0=Date.now()+R.Qk; eMa(R,R.Qk)},eMa=function(R,w){if(R.pB!=null)throw Error("WatchDog timer not null"); R.pB=Yx((0,g.e_)(R.iV,R),w)},gh=function(R){R.pB&&(g.qx.clearTimeout(R.pB),R.pB=null)},QH=function(R){R.O.u4()||R.M0||MZS(R.O,R)},iQ=function(R){gh(R); g.p5(R.YY);R.YY=null;R.N0.removeAll();if(R.L){const w=R.L;R.L=null;w.abort();w.dispose()}},pr=function(R,w){try{var p=R.O; if(p.pv!=0&&(p.L==R||Hm(p.C,R)))if(!R.PS&&Hm(p.C,R)&&p.pv==3){try{var r=p.uo.L.parse(w)}catch(m){r=null}if(Array.isArray(r)&&r.length==3){var f=r;if(f[0]==0)a:{if(!p.U){if(p.L)if(p.L.xY+3E30&&(p.U0=1.5*W);r=p;const x=R.W3();if(x){const q=g.dW(x,"X-Client-Wire-Protocol");if(q){var G=r.C;!G.L&&(g.G1(q,"spdy")||g.G1(q,"quic")||g.G1(q,"h2"))&&(G.G=G.K,G.L=new Set,G.C&&(RS(G,G.C),G.C=null))}if(r.I0){const O=g.dW(x,"X-HTTP-Session-Id");O&&(r.MH=O,g.Ry(r.Jl,r.I0,O))}}p.pv=3;p.K&&p.K.MD();p.cB&&(p.yh=Date.now()-R.xY);r=p;var I=R;r.Af=c8b(r,r.PS? r.f_:null,r.ag);if(I.PS){P9P(r.C,I);var C=I,u=r.U0;u&&C.setTimeout(u);C.pB&&(gh(C),TC(C));r.L=I}else a1P(r);p.O.length>0&&wT(p)}else m[0]!="stop"&&m[0]!="close"||S7(p,7);else p.pv==3&&(m[0]=="stop"||m[0]=="close"?m[0]=="stop"?S7(p,7):p.disconnect():m[0]!="noop"&&p.K&&p.K.z6(m),p.S=0)}dh(4)}catch(m){}},$3a=function(R){this.K=R||10; g.qx.PerformanceNavigationTiming?(R=g.qx.performance.getEntriesByType("navigation"),R=R.length>0&&(R[0].nextHopProtocol=="hq"||R[0].nextHopProtocol=="h2")):R=!!(g.qx.chrome&&g.qx.chrome.loadTimes&&g.qx.chrome.loadTimes()&&g.qx.chrome.loadTimes().wasFetchedViaSpdy);this.G=R?this.K:1;this.L=null;this.G>1&&(this.L=new Set);this.C=null;this.O=[]},XvV=function(R){return R.C?!0:R.L?R.L.size>=R.G:!1},U7=function(R){return R.C?1:R.L?R.L.size:0},Hm=function(R,w){return R.C?R.C==w:R.L?R.L.has(w):!1},RS=function(R, w){R.L?R.L.add(w):R.C=w},P9P=function(R,w){R.C&&R.C==w?R.C=null:R.L&&R.L.has(w)&&R.L.delete(w)},rT=function(R){if(R.C!=null)return R.O.concat(R.C.S); if(R.L!=null&&R.L.size!==0){let w=R.O;for(const p of R.L.values())w=w.concat(p.S);return w}return g.zp(R.O)},nZb=function(R,w){const p=new Fv; if(g.qx.Image){const r=new Image;r.onload=g.Mx(fr,p,"TestLoadImage: loaded",!0,w,r);r.onerror=g.Mx(fr,p,"TestLoadImage: error",!1,w,r);r.onabort=g.Mx(fr,p,"TestLoadImage: abort",!1,w,r);r.ontimeout=g.Mx(fr,p,"TestLoadImage: timeout",!1,w,r);g.qx.setTimeout(function(){if(r.ontimeout)r.ontimeout()},1E4); r.src=R}else w(!1)},d3U=function(R,w){const p=new Fv,r=new AbortController,f=setTimeout(()=>{r.abort(); fr(p,"TestPingServer: timeout",!1,w)},1E4); fetch(R,{signal:r.signal}).then(G=>{clearTimeout(f);G.ok?fr(p,"TestPingServer: ok",!0,w):fr(p,"TestPingServer: server error",!1,w)}).catch(()=>{clearTimeout(f); fr(p,"TestPingServer: error",!1,w)})},fr=function(R,w,p,r,f){try{f&&(f.onload=null,f.onerror=null,f.onabort=null,f.ontimeout=null),r(p)}catch(G){}},Z9b=function(){this.L=new Gs},IS=function(R,w,p){return p&&p.I$?p.I$[R]||w:w},Y1P=function(R){this.O=[]; this.f_=this.Af=this.Jl=this.ag=this.L=this.MH=this.I0=this.M0=this.D=this.SI=this.X=null;this.GE=this.nB=0;this.h8=IS("failFast",!1,R);this.YY=this.pB=this.U=this.J=this.K=null;this.Mr=!0;this.Ml=this.jI=-1;this.p_=this.S=this.xY=0;this.Nl=IS("baseRetryDelayMs",5E3,R);this.B1=IS("retryDelaySeedMs",1E4,R);this.wB=IS("forwardChannelMaxRetries",2,R);this.pL=IS("forwardChannelRequestTimeoutMs",2E4,R);this.Df=R&&R.Hoq||void 0;this.wg=R&&R.ZhB||void 0;this.a9=R&&R.Vt0||!1;this.U0=void 0;this.PS=R&&R.tL|| !1;this.G="";this.C=new $3a(R&&R.h1n);this.WB=Math.min(R&&R.YZ$||1E3,1E3);this.uo=new Z9b;this.N0=R&&R.Qb0||!1;this.q0=R&&R.ENn||!1;this.N0&&this.q0&&(this.q0=!1);this.Nk=R&&R.SCI||!1;R&&R.kEl&&(this.Mr=!1);this.cB=!this.N0&&this.Mr&&R&&R.tCB||!1;this.ez=void 0;R&&R.H2&&R.H2>0&&(this.ez=R.H2);this.eI=void 0;this.yh=0;this.Qk=!1;this.mq=this.O0=null},NE=function(R){R.L&&(Cr(R),R.L.cancel(),R.L=null)},Fsb=function(R){NE(R); R.U&&(g.qx.clearTimeout(R.U),R.U=null);vm(R);R.C.cancel();R.J&&(typeof R.J==="number"&&g.qx.clearTimeout(R.J),R.J=null)},wT=function(R){XvV(R.C)||R.J||(R.J=!0,g.TF(R.IF,R),R.xY=0)},J8U=function(R,w){if(U7(R.C)>=R.C.G-(R.J?1:0))return!1; if(R.J)return R.O=w.S.concat(R.O),!0;if(R.pv==1||R.pv==2||R.xY>=(R.h8?0:R.wB))return!1;R.J=Yx((0,g.e_)(R.IF,R,w),jRk(R,R.xY));R.xY++;return!0},i9a=function(R,w){var p; w?p=w.f_:p=R.nB++;const r=R.Jl.clone();g.Ry(r,"SID",R.G);g.Ry(r,"RID",p);g.Ry(r,"AID",R.jI);ud(R,r);R.D&&R.X&&g.CK(r,R.D,R.X);p=new j7(R,R.G,p,R.xY+1);R.D===null&&(p.Jl=R.X);w&&(R.O=w.S.concat(R.O));w=Tep(R,p,R.WB);p.setTimeout(Math.round(R.pL*.5)+Math.round(R.pL*.5*Math.random()));RS(R.C,p);JX(p,r,w)},ud=function(R,w){R.M0&&g.DS(R.M0,function(p,r){g.Ry(w,r,p)}); R.K&&g.DS({},function(p,r){g.Ry(w,r,p)})},Tep=function(R,w,p){p=Math.min(R.O.length,p); const r=R.K?(0,g.e_)(R.K.FG,R.K,R):null;a:{var f=R.O;let C=-1;for(;;){const u=["count="+p];C==-1?p>0?(C=f[0].L,u.push("ofs="+C)):C=0:u.push("ofs="+C);let m=!0;for(let z=0;z=3)return!1; R.p_++;R.U=Yx((0,g.e_)(R.G6,R),jRk(R,R.S));R.S++;return!0},Cr=function(R){R.O0!=null&&(g.qx.clearTimeout(R.O0),R.O0=null)},QRV=function(R){R.L=new j7(R,R.G,"rpc",R.p_); R.D===null&&(R.L.Jl=R.X);R.L.U0=0;var w=R.Af.clone();g.Ry(w,"RID","rpc");g.Ry(w,"SID",R.G);g.Ry(w,"AID",R.jI);g.Ry(w,"CI",R.YY?"0":"1");!R.YY&&R.ez&&g.Ry(w,"TO",R.ez);g.Ry(w,"TYPE","xmlhttp");ud(R,w);R.D&&R.X&&g.CK(w,R.D,R.X);R.U0&&R.L.setTimeout(R.U0);var p=R.L;R=R.f_;p.jI=1;p.U=fY(w.clone());p.X=null;p.I0=!0;oZb(p,R)},vm=function(R){R.pB!=null&&(g.qx.clearTimeout(R.pB),R.pB=null)},MZS=function(R,w){var p=null; if(R.L==w){vm(R);Cr(R);R.L=null;var r=2}else if(Hm(R.C,w))p=w.S,P9P(R.C,w),r=1;else return;if(R.pv!=0)if(w.J)if(r==1){p=w.X?w.X.length:0;w=Date.now()-w.xY;var f=R.xY;r=nY();r.dispatchEvent(new y8i(r,p,w,f));wT(R)}else a1P(R);else{var G=w.eI;f=w.getLastError();if(f==3||f==0&&G>0||!(r==1&&J8U(R,w)||r==2&&kx(R)))switch(p&&p.length>0&&(w=R.C,w.O=w.O.concat(p)),f){case 1:S7(R,5);break;case 4:S7(R,10);break;case 3:S7(R,6);break;default:S7(R,2)}}},jRk=function(R,w){let p=R.Nl+Math.floor(Math.random()*R.B1); R.isActive()||(p*=2);return p*w},S7=function(R,w){if(w==2){var p=(0,g.e_)(R.Y3,R),r=R.wg; const f=!r;r=new g.Qd(r||"//www.google.com/images/cleardot.gif");g.qx.location&&g.qx.location.protocol=="http"||g.hD(r,"https");fY(r);f?nZb(r.toString(),p):d3U(r.toString(),p)}else Zz(2);R.pv=0;R.K&&R.K.rX(w);hM6(R);Fsb(R)},hM6=function(R){R.pv=0; R.mq=[];if(R.K){const w=rT(R.C);if(w.length!=0||R.O.length!=0)g.Bk(R.mq,w),g.Bk(R.mq,R.O),R.C.O.length=0,g.zp(R.O),R.O.length=0;R.K.Kj()}},gZa=function(R){if(R.pv==0)return R.mq; let w=[];g.Bk(w,rT(R.C));g.Bk(w,R.O);return w},c8b=function(R,w,p){var r=g.wf(p); r.L!=""?(w&&g.g4(r,w+"."+r.L),g.Hh(r,r.O)):(r=g.qx.location,r=Y8m(r.protocol,w?w+"."+r.hostname:r.hostname,+r.port,p));w=R.I0;p=R.MH;w&&p&&g.Ry(r,w,p);g.Ry(r,"VER",R.Oo);ud(R,r);return r},tZV=function(R,w,p){if(w&&!R.PS)throw Error("Can't create secondary domain capable XhrIo object."); w=R.a9&&!R.Df?new g.OF(new g.FO({mB:p})):new g.OF(R.Df);w.D=R.PS;return w},H9M=function(){},vZV=function(){},mX=function(R,w){g.E1.call(this); this.L=new Y1P(w);this.J=R;this.C=w&&w.S7||null;R=w&&w.Xu||null;w&&w.Tgl&&(R?R["X-Client-Protocol"]="webchannel":R={"X-Client-Protocol":"webchannel"});this.L.X=R;R=w&&w.OhN||null;w&&w.bZ&&(R?R["X-WebChannel-Content-Type"]=w.bZ:R={"X-WebChannel-Content-Type":w.bZ});w&&w.Pz&&(R?R["X-WebChannel-Client-Profile"]=w.Pz:R={"X-WebChannel-Client-Profile":w.Pz});this.L.SI=R;(R=w&&w.Tll)&&!g.fj(R)&&(this.L.D=R);this.D=w&&w.tL||!1;this.K=w&&w.r3S||!1;(w=w&&w.pW)&&!g.fj(w)&&(this.L.I0=w,g.da(this.C,w)&&(R=this.C, w in R&&delete R[w]));this.O=new se(this)},Nem=function(R){$x.call(this); R.__headers__&&(this.headers=R.__headers__,this.statusCode=R.__status__,delete R.__headers__,delete R.__status__);const w=R.__sm__;w?this.data=(this.L=g.aM(w))?g.ia(w,this.L):w:this.data=R},kFi=function(R){Xv.call(this); this.status=1;this.errorCode=R},se=function(R){this.L=R},zs=function(R,w){this.G=R; this.L=w},BH=function(R,w){if(typeof R!=="function")throw Error("Fn must not be null and must be a function"); return g.qx.setTimeout(function(){R()},w)},xR=function(){WH.dispatchEvent(new U3R)},ld=function(R,w,p,r){this.L=R; this.G=w;this.D=p;this.J=r||1;this.C=45E3;this.O=new g.uO(this);this.K=new g.pw;this.K.setInterval(250)},RNp=function(R,w,p){R.Ke=1; R.fV=fY(w.clone());R.lT=p;R.I0=!0;S1V(R,null)},Lr=function(R,w,p,r,f){R.Ke=1; R.fV=fY(w.clone());R.lT=null;R.I0=p;f&&(R.lO=!1);S1V(R,r)},S1V=function(R,w){R.KV=Date.now(); qh(R);R.Ij=R.fV.clone();GC(R.Ij,"t",R.J);R.jD=0;R.cF=R.L.yY(R.L.rz()?w:null);R.F4>0&&(R.Gl=new g.yV((0,g.e_)(R.Bs,R,R.cF),R.F4));R.O.listen(R.cF,"readystatechange",R.Du);w=R.EF?g.ht(R.EF):{};R.lT?(R.zl="POST",w["Content-Type"]="application/x-www-form-urlencoded",R.cF.send(R.Ij,R.zl,R.lT,w)):(R.zl="GET",R.lO&&!g.f$&&(w.Connection="close"),R.cF.send(R.Ij,R.zl,null,w));R.L.G2(1)},p5i=function(R,w){var p=R.jD,r=w.indexOf("\n",p); if(r==-1)return Ae;p=Number(w.substring(p,r));if(isNaN(p))return w5b;r+=1;if(r+p>w.length)return Ae;w=w.slice(r,r+p);R.jD=r+p;return w},qh=function(R){R.DG=Date.now()+R.C; roa(R,R.C)},roa=function(R,w){if(R.dK!=null)throw Error("WatchDog timer not null"); R.dK=BH((0,g.e_)(R.c8,R),w)},fF6=function(R){R.dK&&(g.qx.clearTimeout(R.dK),R.dK=null)},bd=function(R){R.L.u4()||R.Ga||R.L.ZG(R)},yg=function(R){fF6(R); g.p5(R.Gl);R.Gl=null;R.K.stop();R.O.removeAll();if(R.cF){const w=R.cF;R.cF=null;w.abort();w.dispose()}R.Jb&&(R.Jb=null)},GSi=function(R,w){try{R.L.JJ(R,w),R.L.G2(4)}catch(p){}},C0a=function(R,w,p,r,f){if(r==0)p(!1); else{var G=f||0;r--;IFi(R,w,function(I){I?p(!0):g.qx.setTimeout(function(){C0a(R,w,p,r,G)},G)})}},IFi=function(R,w,p){const r=new Image; r.onload=function(){try{Vg(r),p(!0)}catch(f){}}; r.onerror=function(){try{Vg(r),p(!1)}catch(f){}}; r.onabort=function(){try{Vg(r),p(!1)}catch(f){}}; r.ontimeout=function(){try{Vg(r),p(!1)}catch(f){}}; g.qx.setTimeout(function(){if(r.ontimeout)r.ontimeout()},w); r.src=R},Vg=function(R){R.onload=null; R.onerror=null;R.onabort=null;R.ontimeout=null},uMk=function(R){this.L=R; this.C=new Gs},shk=function(R){const w=oS(R.L,R.Us,"/mail/images/cleardot.gif"); fY(w);C0a(w.toString(),5E3,(0,g.e_)(R.Cf,R),3,2E3);R.G2(1)},Oe=function(R){var w=R.L.J; w!=null?(xR(),w?(xR(),te(R.L,R,!1)):(xR(),te(R.L,R,!0))):(R.x7=new ld(R),R.x7.EF=R.nz,w=R.L,w=oS(w,w.rz()?R.Mz:null,R.o6),xR(),GC(w,"TYPE","xmlhttp"),Lr(R.x7,w,!1,R.Mz,!1))},Kr=function(R,w,p){this.L=1; this.C=[];this.O=[];this.K=new Gs;this.X=R||null;this.J=w!=null?w:null;this.U=p||!1},mnb=function(R,w){this.L=R; this.map=w;this.context=null},zNp=function(R,w,p,r){g.IR.call(this,"timingevent",R); this.size=w;this.rtt=p;this.retries=r},BWU=function(R){g.IR.call(this,"serverreachability",R)},W6R=function(R){R.y4(1,0); R.Bn=oS(R,null,R.Uw);Ee(R)},xnU=function(R){R.Ed&&(R.Ed.abort(),R.Ed=null); R.mL&&(R.mL.cancel(),R.mL=null);R.rE&&(g.qx.clearTimeout(R.rE),R.rE=null);Dn(R);R.gm&&(R.gm.cancel(),R.gm=null);R.bH&&(g.qx.clearTimeout(R.bH),R.bH=null)},eJ=function(R,w){if(R.L==0)throw Error("Invalid operation: sending map when state is closed"); R.C.push(new mnb(R.Zu++,w));R.L!=2&&R.L!=3||Ee(R)},lFU=function(R){let w=0; R.mL&&w++;R.gm&&w++;return w},Ee=function(R){R.gm||R.bH||(R.bH=BH((0,g.e_)(R.lJ,R),0),R.vE=0)},qF6=function(R,w){if(R.L==1){if(!w){R.Mf=Math.floor(Math.random()*1E5); w=R.Mf++;const p=new ld(R,"",w);p.EF=R.CJ;const r=Mh(R),f=R.Bn.clone();g.Ry(f,"RID",w);g.Ry(f,"CVER","1");cH(R,f);RNp(p,f,r);R.gm=p;R.L=2}}else R.L==3&&(w?L6V(R,w):R.C.length==0||R.gm||L6V(R))},L6V=function(R,w){if(w)if(R.iT>6){R.C=R.O.concat(R.C); R.O.length=0;var p=R.Mf-1;w=Mh(R)}else p=w.D,w=w.lT;else p=R.Mf++,w=Mh(R);const r=R.Bn.clone();g.Ry(r,"SID",R.G);g.Ry(r,"RID",p);g.Ry(r,"AID",R.RO);cH(R,r);p=new ld(R,R.G,p,R.vE+1);p.EF=R.CJ;p.setTimeout(1E4+Math.round(1E4*Math.random()));R.gm=p;RNp(p,r,w)},cH=function(R,w){R.T_&&(R=R.T_.Dn())&&g.DS(R,function(p,r){g.Ry(w,r,p)})},Mh=function(R){const w=Math.min(R.C.length,1E3),p=["count="+w]; let r;R.iT>6&&w>0?(r=R.C[0].L,p.push("ofs="+r)):r=0;for(let f=0;f=3)return!1; R.D++;R.rE=BH((0,g.e_)(R.Eo,R),bwM(R,R.qa));R.qa++;return!0},te=function(R,w,p){R.Xa=R.J==null?p:!R.J; R.Xo=w.Kg;R.U||W6R(R)},Dn=function(R){R.PX!=null&&(g.qx.clearTimeout(R.PX),R.PX=null)},bwM=function(R,w){let p=5E3+Math.floor(Math.random()*1E4); R.isActive()||(p*=2);return p*w},aS=function(R,w){if(w==2||w==9){var p=null; R.T_&&(p=null);var r=(0,g.e_)(R.PY,R);p||(p=new g.Qd("//www.google.com/images/cleardot.gif"),fY(p));IFi(p.toString(),1E4,r)}else xR();yoR(R,w)},yoR=function(R,w){R.L=0; R.T_&&R.T_.iJ(w);Vbb(R);xnU(R)},Vbb=function(R){R.L=0; R.Xo=-1;if(R.T_)if(R.O.length==0&&R.C.length==0)R.T_.k8();else{const w=g.zp(R.O),p=g.zp(R.C);R.O.length=0;R.C.length=0;R.T_.k8(w,p)}},oS=function(R,w,p){let r=g.wf(p); if(r.L!="")w&&g.g4(r,w+"."+r.L),g.Hh(r,r.O);else{const f=window.location;r=Y8m(f.protocol,w?w+"."+f.hostname:f.hostname,+f.port,p)}R.j8&&g.DS(R.j8,function(f,G){g.Ry(r,G,f)}); g.Ry(r,"VER",R.iT);cH(R,r);return r},owU=function(){},tbk=function(){this.L=[]; this.C=[]},Owa=function(R,w){this.action=R; this.params=w||{}},$R=function(R,w){g.f5.call(this); this.L=new g.vZ(this.X7,0,this);g.K(this,this.L);this.Tv=5E3;this.retryCount=this.d0=0;if(typeof R==="function")w&&(R=(0,g.e_)(R,w));else if(R&&typeof R.handleEvent==="function")R=(0,g.e_)(R.handleEvent,R);else throw Error("Invalid listener argument");this.C=R},XT=function(R,w,p=!1,r=()=>"",f=!1,G=!1,I=!1,C=()=>g.FB({}),u=!1,m,z){this.PS=R; this.xY=w;this.D=new g.DG;this.J=z;this.C=(this.O=!!m)?m(()=>{this.Om()}):new $R(this.Om,this); this.L=null;this.X=!1;this.S=null;this.I0="";this.O0=this.pB=0;this.G=[];this.eI=p;this.Jl=r;this.U=G;this.jI=C;this.SI=I;this.M0=null;this.K=g.FB();this.mq=f;this.N0=u;this.Qk=new K6b;this.YY=new Ewp;this.q0=new DnV;this.U0=new eNR;this.nB=new MbP;this.p_=new cok;this.f_=new P0R},aFp=function(R,w,p,r,f){nr(R); if(R.L){const G=g.n("ID_TOKEN"),I=R.L.CJ||{};G?I["x-youtube-identity-token"]=G:delete I["x-youtube-identity-token"];R.L.CJ=I}r?(r.getState()!=3&&lFU(r)==0||r.getState(),R.L.connect(w,p,R.xY,r.G,r.RO)):f?R.L.connect(w,p,R.xY,f.sessionId,f.arrayId):R.L.connect(w,p,R.xY);R.O&&!R.C.isActive()&&R.C.start();R.J&&R.J.UOl()},X5b=function(R,w){return R.N0?!Object.values($np).includes(w):!1},nwa=async function(R){try{await dT(R)}finally{var w=R.G; R.G=[];var p=w;w=w.length;for(let r=0;r{if(R.L){let p=R.L.CJ||{}; w&&Object.keys(w).length>0?p={...p,...w}:delete p.Authorization;R.L.CJ=p}}).bA(()=>{}),()=>{R.M0=null})},YR=function(R){this.scheme="https"; this.port=this.domain="";this.L="/api/lounge";this.C=!0;R=R||document.location.href;const w=Number(g.Cp(R)[4]||null)||"";w&&(this.port=":"+w);this.domain=g.sH(R)||"";R=g.s3();R.search("MSIE")>=0&&(R=R.match(/MSIE ([\d.]+)/)[1],g.uc(R,"10.0")<0&&(this.C=!1))},FT=function(R,w){let p=R.L; R.C&&(p=R.scheme+"://"+R.domain+R.port+R.L);return g.bu(p+w,{})},Zwp=function(R){g.l9(R.channel,"m",()=>{R.J=3; R.O.reset();R.U=null;R.D=0;for(const w of R.S)R.channel&&R.channel.send(w);R.S=[];R.publish("webChannelOpened");R.Jl.L("WEB_CHANNEL")}); g.l9(R.channel,"n",()=>{R.J=0;R.O.isActive()||R.publish("webChannelClosed");const w=R.channel?.G().O();w&&(R.S=[...w]);R.O0.L("WEB_CHANNEL")}); g.l9(R.channel,"p",w=>{const p=w.data;p[0]==="gracefulReconnect"?(R.O.start(),R.channel&&R.channel.close()):R.publish("webChannelMessage",new Owa(p[0],p[1]));R.Po=w.statusCode;R.M0.L("WEB_CHANNEL")}); g.l9(R.channel,"o",()=>{R.Po===401||R.O.start();R.publish("webChannelError");R.I0.L("WEB_CHANNEL","")})},jJ=function(R){const w=R.xY(); w?R.G["x-youtube-lounge-xsrf-token"]=w:delete R.G["x-youtube-lounge-xsrf-token"]},JoS=function(R,w,p=()=>"",r,f){const G=()=>new XT(FT(R,"/bc"),w,!1,p,r); return g.Y("enable_mdx_web_channel_desktop")?new YFP(()=>new F6b(FT(R,"/wc"),w,p)):new jhV(G,f)},hNR=function(){var R=TWm; iwb();Je.push(R);Qhi()},Ts=function(R,w){iwb(); const p=gwP(R,String(w));Je.length==0?Hwp(p):(Qhi(),g.iH(Je,function(r){r(p)}))},id=function(R){Ts("CP",R)},iwb=function(){Je||(Je=g.yD("yt.mdx.remote.debug.handlers_")||[],g.AY("yt.mdx.remote.debug.handlers_",Je))},Hwp=function(R){const w=(Qg+1)%50; Qg=w;he[w]=R;gT||(gT=w==49)},Qhi=function(){var R=Je; if(he[0]){var w=gT?Qg:-1;do{w=(w+1)%50;const p=he[w];g.iH(R,function(r){r(p)})}while(w!=Qg); he=Array(50);Qg=-1;gT=!1}},gwP=function(R,w){let p=(Date.now()-vwV)/1E3; p.toFixed&&(p=p.toFixed(3));const r=[];r.push("[",p+"s","] ");r.push("[","yt.mdx.remote","] ");r.push(R+": "+w,"\n");return r.join("")},HH=function(R){g.HC.call(this); this.J=R;this.screens=[]},NWb=function(R,w){const p=R.get(w.uuid)||R.get(w.id); if(p)return R=p.name,p.id=w.id||p.id,p.name=w.name,p.token=w.token,p.uuid=w.uuid||p.uuid,p.name!=R;R.screens.push(w);return!0},kSU=function(R,w){let p=R.screens.length!=w.length; R.screens=g.QD(R.screens,function(f){return!!qE(w,f)}); const r=w.length;for(let f=0;f0&&R.Gw.idType!="shortLived"); g.Qp("yt-remote-automatic-screen-cache",g.gd(R,gIm))},fO=function(R){R.K=g.hj("yt-remote-device-id-map")||{}},Gz=function(R,w,p){g.HC.call(this); this.I0=p;this.G=R;this.C=w;this.L=null},IC=function(R,w){R.L=w; R.publish("sessionScreen",R.L)},m_t=function(R,w){R.L&&(R.L.token=w,rR(R.G,R.L)); R.publish("sessionScreen",R.L)},CO=function(R,w){Ts(R.I0,w)},B4P=function(R,w){g.a2(R.pB); R.pB=0;w?R.config_.enableCastLoungeToken&&w.loungeToken?w.deviceId?R.L&&R.L.uuid==w.deviceId||(w.loungeTokenRefreshIntervalMs?zxb(R,{name:R.C.friendlyName,screenId:w.screenId,loungeToken:w.loungeToken,dialId:w.deviceId,screenIdType:"shortLived"},w.loungeTokenRefreshIntervalMs):(g.uF(Error(`No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: ${JSON.stringify(w)}.`)),u3(R,w.screenId))):(g.uF(Error(`No device id presents in mdxSessionStatusData: ${JSON.stringify(w)}.`)),u3(R,w.screenId)): u3(R,w.screenId):R.NJ(Error("Waiting for session status timed out."))},WRa=function(R){g.a2(R.X); R.X=0;g.a2(R.D);R.D=0;g.a2(R.pB);R.pB=0;g.a2(R.K);R.K=0;g.a2(R.U);R.U=0},x_M=function(R,w){R.info("sendYoutubeMessage_: "+w+" "+g.Ao()); const p={};p.type=w;R.O?R.O.sendMessage("urn:x-cast:com.google.youtube.mdx",p,()=>{},(0,g.e_)(function(){CO(this,"Failed to send message: "+w+".")},R)):CO(R,"Sending yt message without session: "+g.Ao(p))},LRm=function(R){x_M(R,"getLoungeToken"); g.a2(R.K);R.K=g.cI(()=>{l8R(R,null)},3E4)},sK=function(R,w){g.a2(R.U); R.U=0;w==0?LRm(R):R.U=g.cI(()=>{LRm(R)},w)},l8R=function(R,w){g.a2(R.K); R.K=0;let p=null;w?w.loungeToken?R.L?.token==w.loungeToken&&(p="staleLoungeToken"):p="missingLoungeToken":p="noLoungeTokenResponse";p?(R.info("Did not receive a new lounge token in onLoungeToken_ with "+`data: ${JSON.stringify(w)}, error: ${p}`),sK(R,3E4)):(m_t(R,w.loungeToken),sK(R,w.loungeTokenRefreshIntervalMs))},u3=function(R,w){w?(R.info("onConnectedScreenId_: Received screenId: "+w),R.L&&R.L.id==w||R.M0(w,p=>{IC(R,p)},()=>R.NJ(),5)):R.NJ(Error("Waiting for session status timed out."))},q2M= function(R,w,p,r){g.a2(R.D); R.D=0;I8U(R.G,w,f=>{f||r<0?p(f):R.D=g.cI(()=>{q2M(R,w,p,r-1)},300)})},zxb=function(R,w,p){R.info(`onConnectedScreenData_: Received screenData: ${JSON.stringify(w)}`); const r=new Bm(w);q2M(R,r,f=>{f?(rR(R.G,r),IC(R,r),sK(R,p)):(g.uF(Error(`CastSession, RemoteScreen from screenData: ${JSON.stringify(w)} is not online.`)),R.NJ())},5)},mm=function(R){return new Promise(w=>{R.xY=LY(); if(R.Jl){const p=new chrome.cast.DialLaunchResponse(!0,ADM(R));w(p);b4R(R)}else R.S=()=>{g.a2(R.pB);R.S=()=>{}; R.pB=NaN;const p=new chrome.cast.DialLaunchResponse(!0,ADM(R));w(p);b4R(R)},R.pB=g.cI(()=>{R.S()},100)})},yDR=function(R){g.a2(R.D); R.D=0;g.a2(R.U);R.U=0;R.K();R.K=()=>{}; g.a2(R.pB)},zz=function(R){return!(!R.config_.enableDialLoungeToken||!R.O?.getDialAppInfo)},Bp=function(R,w){R.info(`getDialAppInfoWithTimeout_ ${w}`); zz(R)&&(g.a2(R.U),R.U=0,w==0?VsM(R):R.U=g.cI(()=>{VsM(R)},w))},b4R=function(R){R.K=R.G.nj(R.xY,R.C.label,R.C.friendlyName,zz(R),(w,p)=>{R.K=()=>{}; IC(R,w);w.idType=="shortLived"&&p>0&&Bp(R,p)},w=>{R.K=()=>{}; R.NJ(w)})},ADM=function(R){var w={}; w.pairingCode=R.xY;w.theme=R.jI;GFM()&&(w.env_useStageMdx=1);return g.A4(w)},o5i=function(R,w){const p=R.X.receiver.label,r=R.C.friendlyName; return(new Promise(f=>{f8M(R.G,p,w,r,G=>{G&&G.token&&IC(R,G);f(G)},G=>{CO(R,"Failed to get DIAL screen: "+G); f(null)})})).then(f=>f&&f.token?new chrome.cast.DialLaunchResponse(!1):mm(R))},O4M=function(R,w,p){R.info(`initOnConnectedScreenDataPromise_: Received screenData: ${JSON.stringify(w)}`); const r=new Bm(w);return(new Promise(f=>{tsV(R,r,G=>{G?(rR(R.G,r),IC(R,r),Bp(R,p)):g.uF(Error(`DialSession, RemoteScreen from screenData: ${JSON.stringify(w)} is not online.`));f(G)},5)})).then(f=>f?new chrome.cast.DialLaunchResponse(!1):mm(R))},tsV=function(R,w,p,r){g.a2(R.D); R.D=0;I8U(R.G,w,f=>{f||r<0?p(f):R.D=g.cI(()=>{tsV(R,w,p,r-1)},300)})},VsM=function(R){zz(R)&&R.O.getDialAppInfo(w=>{R.info(`getDialAppInfo dialLaunchData: ${JSON.stringify(w)}`); w=w.extraData||{};let p=null;w.loungeToken?R.L?.token==w.loungeToken&&(p="staleLoungeToken"):p="missingLoungeToken";p?Bp(R,3E4):(m_t(R,w.loungeToken),Bp(R,w.loungeTokenRefreshIntervalMs))},w=>{R.info(`getDialAppInfo error: ${w}`); Bp(R,3E4)})},TWm=function(R){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(R)},E5P=function(R){const w=R.C.yz(); let p=R.L&&R.L.C;R=g.gd(w,function(r){p&&Wm(r,p.label)&&(p=null);const f=r.uuid?r.uuid:r.id;let G=KRM(this,r);G?(G.label=f,G.friendlyName=r.name):(G=new chrome.cast.Receiver(f,r.name),G.receiverType=chrome.cast.ReceiverType.CUSTOM);return G},R); p&&(p.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(p=new chrome.cast.Receiver(p.label,p.friendlyName),p.receiverType=chrome.cast.ReceiverType.CUSTOM),R.push(p));return R},Wp=function(R){return R.U||!!R.O.length||!!R.L},xT=function(R){Ts("Controller",R)},l3=function(R,w,p){w!=R.L&&(g.p5(R.L),(R.L=w)?(p?R.publish("yt-remote-cast2-receiver-resumed",w.C):R.publish("yt-remote-cast2-receiver-selected",w.C),w.subscribe("sessionScreen",(0,g.e_)(R.pB,R,w)),w.subscribe("sessionFailed",()=>D_i(R,w)),w.L? R.publish("yt-remote-cast2-session-change",w.L):p&&R.L.J(null)):R.publish("yt-remote-cast2-session-change",null))},KRM=function(R,w){return w?g.S_(R.O,function(p){return Wm(w,p.label)},R):null},D_i=function(R,w){R.L==w&&R.publish("yt-remote-cast2-session-failed")},$_V=function(R,w,p,r){r.disableCastApi?LO("Cannot initialize because disabled by Mdx config."):exa()?MsM(w,r)&&(qv(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?cDi(R,p):(window.__onGCastApiAvailable=function(f,G){f?cDi(R,p):(AL("Failed to load cast API: "+ G),b3(!1),qv(!1),g.gy("yt-remote-cast-available"),g.gy("yt-remote-cast-receiver"),PhU(),p(!1))},r.loadCastApiSetupScript?g.T9(a8m):window.navigator.userAgent.indexOf("Android")>=0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?E7()>=60&&Beb():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?e7():E7()>=89?x3p():(ME(),Dz(Wsb.map(sRP))))):LO("Cannot initialize because not running Chrome")},PhU=function(){LO("dispose"); const R=yu();R&&R.dispose();g.AY("yt.mdx.remote.cloudview.instance_",null);Xhb(!1);g.jh(Vu);Vu.length=0},oC=function(){return!!g.hj("yt-remote-cast-installed")},n5U=function(){const R=g.hj("yt-remote-cast-receiver"); return R?R.friendlyName:null},d_V=function(){LO("clearCurrentReceiver"); g.gy("yt-remote-cast-receiver")},Z4a=function(){return oC()?yu()?yu().getCastSession():(AL("getCastSelector: Cast is not initialized."),null):(AL("getCastSelector: Cast API is not installed!"),null)},OK=function(){oC()?yu()?tL()?(LO("Requesting cast selector."),yu().requestSession()):(LO("Wait for cast API to be ready to request the session."),Vu.push(g.FG("yt-remote-cast2-api-ready",OK))):AL("requestCastSelector: Cast is not initialized."):AL("requestCastSelector: Cast API is not installed!")},KO= function(R,w){tL()?yu().setConnectedScreenStatus(R,w):AL("setConnectedScreenStatus called before ready.")},exa=function(){var R=g.s3().search(/ (CrMo|Chrome|CriOS)\//)>=0; return g.Io||R},Y2b=function(R,w){yu().init(R,w)},MsM=function(R,w){let p=!1; yu()||(R=new EK(R,w),R.subscribe("yt-remote-cast2-availability-change",function(r){g.Qp("yt-remote-cast-available",r);KY("yt-remote-cast2-availability-change",r)}),R.subscribe("yt-remote-cast2-receiver-selected",function(r){LO("onReceiverSelected: "+r.friendlyName); g.Qp("yt-remote-cast-receiver",r);KY("yt-remote-cast2-receiver-selected",r)}),R.subscribe("yt-remote-cast2-receiver-resumed",function(r){LO("onReceiverResumed: "+r.friendlyName); g.Qp("yt-remote-cast-receiver",r);KY("yt-remote-cast2-receiver-resumed",r)}),R.subscribe("yt-remote-cast2-session-change",function(r){LO("onSessionChange: "+xx(r)); r||g.gy("yt-remote-cast-receiver");KY("yt-remote-cast2-session-change",r)}),g.AY("yt.mdx.remote.cloudview.instance_",R),p=!0); LO("cloudview.createSingleton_: "+p);return p},yu=function(){return g.yD("yt.mdx.remote.cloudview.instance_")},cDi=function(R,w){b3(!0); qv(!1);Y2b(R,function(p){p?(Xhb(!0),g.JT("yt-remote-cast2-api-ready")):(AL("Failed to initialize cast API."),b3(!1),g.gy("yt-remote-cast-available"),g.gy("yt-remote-cast-receiver"),PhU());w(p)})},LO=function(R){Ts("cloudview",R)},AL=function(R){Ts("cloudview",R)},b3=function(R){LO("setCastInstalled_ "+R); g.Qp("yt-remote-cast-installed",R)},tL=function(){return!!g.yD("yt.mdx.remote.cloudview.apiReady_")},Xhb=function(R){LO("setApiReady_ "+R); g.AY("yt.mdx.remote.cloudview.apiReady_",R)},qv=function(R){g.AY("yt.mdx.remote.cloudview.initializing_",R)},Dt=function(R){this.index=-1; this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.K=this.J=0;this.trackData=null;this.hasNext=this.hasPrevious=!1;this.loadedTime=this.O=this.D=this.C=0;this.L=NaN;this.G=!1;this.reset(R)},eA=function(R){R.audioTrackId=null; R.trackData=null;R.playerState=-1;R.hasPrevious=!1;R.hasNext=!1;R.J=0;R.K=g.c6();R.C=0;R.D=0;R.O=0;R.loadedTime=0;R.L=NaN;R.G=!1},Mv=function(R){return R.isPlaying()?(g.c6()-R.K)/1E3:0},cp=function(R,w){R.J=w; R.K=g.c6()},Pp=function(R){switch(R.playerState){case 1:case 1081:return(g.c6()-R.K)/1E3+R.J; case -1E3:return 0}return R.J},FR6=function(R){return R.G?R.D+Mv(R):R.D},aC=function(R,w,p){const r=R.videoId; R.videoId=w;R.index=p;w!=r&&eA(R)},$T=function(R){const w={}; w.index=R.index;w.listId=R.listId;w.videoId=R.videoId;w.playerState=R.playerState;w.volume=R.volume;w.muted=R.muted;w.audioTrackId=R.audioTrackId;w.trackData=g.Hk(R.trackData);w.hasPrevious=R.hasPrevious;w.hasNext=R.hasNext;w.playerTime=R.J;w.playerTimeAt=R.K;w.seekableStart=R.C;w.seekableEnd=R.D;w.duration=R.O;w.loadedTime=R.loadedTime;w.liveIngestionTime=R.L;return w},jQp=function(R){g.iH("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "), function(w){this.D.push(this.G.subscribe(w,g.Mx(this.PS,w),this))},R)},X$=function(R,w){R.C&&(R.C.removeUpdateListener(R.S),R.C.removeMediaListener(R.X),R.J(null)); R.C=w;R.C&&(id("Setting cast session: "+R.C.sessionId),R.C.addUpdateListener(R.S),R.C.addMediaListener(R.X),R.C.media.length&&R.J(R.C.media[0]))},nO=function(R){return new Dt(R.G.getPlayerContextData())},dR=function(R){return R.getState()==1},F$=function(R,w,p){return(0,g.e_)(function(r){this.GH("Failed to "+w+" with cast v2 channel. Error code: "+r.code); r.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.GH("Retrying "+w+" using MDx browser channel."),Zt(this,w,p))},R)},Zt=function(R,w,p){R.G.sendMessage(w,p)},JL=function(R,w,p){const r=nO(R); cp(r,p);r.playerState!=-1E3&&(r.playerState=w);jA(R,r)},Tz=function(R,w){var p=R.K; p.L.length+p.C.length<50&&R.K.enqueue(w)},jA=function(R,w){JDP(R); R.G.setPlayerContextData($T(w));jQp(R)},JDP=function(R){g.iH(R.D,function(w){this.G.unsubscribeByKey(w)},R); R.D.length=0},T4m=function(R){const w=R.L.media,p=R.L.customData; if(w&&p){var r=nO(R);w.contentId!=r.videoId&&id("Cast changing video to: "+w.contentId);r.videoId=w.contentId;r.playerState=p.playerState;cp(r,R.L.getEstimatedTime());jA(R,r)}else id("No cast media video. Ignoring state update.")},i4P=function(R){i3("Channel opened"); R.M0&&(R.M0=!1,Qu(R),R.I0=g.cI(()=>{i3("Timing out waiting for a screen.");R.D(1)},15E3))},pZi=function(R,w){w=w.message; w.params?i3("Received: action="+w.action+", params="+g.Ao(w.params)):i3("Received: action="+w.action+" {}");switch(w.action){case "loungeStatus":w=CY(w.params.devices);R.O=g.gd(w,function(r){return new zC(r)}); w=!!g.S_(R.O,function(r){return r.type=="LOUNGE_SCREEN"}); QQt(R,w);w=R.nB("mlm");R.publish("multiStateLoopEnabled",w);break;case "loungeScreenDisconnected":g.ua(R.O,function(r){return r.type=="LOUNGE_SCREEN"}); QQt(R,!1);break;case "remoteConnected":let p=new zC(CY(w.params.device));g.S_(R.O,function(r){return r.equals(p)})||dPa(R.O,p); break;case "remoteDisconnected":p=new zC(CY(w.params.device));g.ua(R.O,function(r){return r.equals(p)}); break;case "gracefulDisconnect":break;case "playlistModified":hxi(R,w,"QUEUE_MODIFIED");break;case "nowPlaying":g5b(R,w);break;case "onStateChange":H4R(R,w);break;case "onAdStateChange":v56(R,w);break;case "onVolumeChanged":N4b(R,w);break;case "onSubtitlesTrackChanged":k_t(R,w);break;case "nowAutoplaying":U_a(R,w);break;case "autoplayDismissed":R.publish("autoplayDismissed");break;case "autoplayUpNext":S2p(R,w);break;case "onAutoplayModeChanged":RAb(R,w);break;case "onHasPreviousNextChanged":wZM(R, w);break;case "requestAssistedSignIn":R.publish("assistedSignInRequested",w.params.authCode);break;case "onLoopModeChanged":R.publish("loopModeChange",w.params.loopMode);break;default:i3("Unrecognized action: "+w.action)}},i3=function(R){Ts("conn",R)},rfa=function(R){R.J=g.cI(()=>{i3("Connecting timeout"); R.D(1)},2E4)},hL=function(R,w){R.publish("proxyStateChange",w)},gR=function(R){g.a2(R.J); R.J=NaN},Hp=function(R){g.a2(R.O0); R.O0=NaN},Qu=function(R){g.a2(R.I0); R.I0=NaN},fcR=function(R){return g.S_(R.O,function(w){return w.type=="LOUNGE_SCREEN"})},vp=function(R,w,p){p?i3("Sending: action="+w+", params="+g.Ao(p)):i3("Sending: action="+w); R.C.sendMessage(w,p)},GaP=function(R){Hp(R); R.O0=g.cI(()=>{vp(R,"getNowPlaying")},2E4)},Ict=function(R){g.a2(R.S); R.S=g.cI(()=>{R.D(1)},864E5)},QQt=function(R,w){var p=null; if(w){const r=fcR(R);r&&(p={clientName:r.clientName,deviceMake:r.brand,deviceModel:r.model,osVersion:r.osVersion})}g.AY("yt.mdx.remote.remoteClient_",p);w&&(gR(R),Qu(R));p=R.C.Kw()&&isNaN(R.J);w==p?w&&(hL(R,1),vp(R,"getSubtitlesTrack")):w?(R.YY()&&R.L.reset(),hL(R,1),vp(R,"getNowPlaying"),Ict(R)):R.D(1)},k_t=function(R,w){const p=w.params.videoId; delete w.params.videoId;p==R.L.videoId&&(g.Jt(w.params)?R.L.trackData=null:R.L.trackData=w.params,R.publish("remotePlayerChange"))},hxi=function(R,w,p){const r=w.params.videoId||w.params.video_id,f=parseInt(w.params.currentIndex,10); R.L.listId=w.params.listId||R.L.listId;aC(R.L,r,f);R.publish("remoteQueueChange",p)},H4R=function(R,w){var p=parseInt(w.params.currentTime||w.params.current_time,10); cp(R.L,isNaN(p)?0:p);p=parseInt(w.params.state,10);p=isNaN(p)?-1:p;p==-1&&R.L.playerState==-1E3&&(p=-1E3);R.L.playerState=p;p=Number(w.params.loadedTime);R.L.loadedTime=isNaN(p)?0:p;R.L.vM(Number(w.params.duration));p=R.L;var r=Number(w.params.liveIngestionTime);p.L=r;p.G=isNaN(r)?!1:!0;p=R.L;r=Number(w.params.seekableStartTime);w=Number(w.params.seekableEndTime);p.C=isNaN(r)?0:r;p.D=isNaN(w)?0:w;R.L.playerState==1?GaP(R):Hp(R);R.publish("remotePlayerChange")},g5b=function(R,w){w.params=w.params|| {}; hxi(R,w,"NOW_PLAYING_MAY_CHANGE");H4R(R,w);R.publish("autoplayDismissed")},v56=function(R,w){if(R.L.playerState!=-1E3){var p=1085; switch(parseInt(w.params.adState,10)){case 1:p=1081;break;case 2:p=1084;break;case 0:p=1083}R.L.playerState=p;w=parseInt(w.params.currentTime,10);cp(R.L,isNaN(w)?0:w);R.publish("remotePlayerChange")}},N4b=function(R,w){const p=w.params.muted=="true"; R.L.volume=parseInt(w.params.volume,10);R.L.muted=p;R.publish("remotePlayerChange")},U_a=function(R,w){R.U=w.params.videoId; R.publish("nowAutoplaying",parseInt(w.params.timeout,10))},S2p=function(R,w){R.U=w.params.videoId||null; R.publish("autoplayUpNext",R.U)},RAb=function(R,w){R.K=w.params.autoplayMode; R.publish("autoplayModeChange",R.K);R.K=="DISABLED"&&R.publish("autoplayDismissed")},wZM=function(R,w){const p=w.params.hasNext=="true"; R.L.hasPrevious=w.params.hasPrevious=="true";R.L.hasNext=p;R.publish("previousNextChange")},mGk=function(R,w){f1b(); if(!O7||!O7.get("yt-remote-disable-remote-module-for-dev")){w=g.n("MDX_CONFIG")||w;k86();oG();Nv||(Nv=new YR(w?w.loungeApiHost:void 0),GFM()&&(Nv.L="/api/loungedev"));kT||(kT=g.yD("yt.mdx.remote.deferredProxies_")||[],g.AY("yt.mdx.remote.deferredProxies_",kT));COU();var p=UK();if(!p){const f=new pO(Nv,w?w.disableAutomaticScreenCache||!1:!1);g.AY("yt.mdx.remote.screenService_",f);p=UK();var r={};w&&(r={appId:w.appId,disableDial:w.disableDial,theme:w.theme,loadCastApiSetupScript:w.loadCastApiSetupScript, disableCastApi:w.disableCastApi,enableDialLoungeToken:w.enableDialLoungeToken,enableCastLoungeToken:w.enableCastLoungeToken,forceMirroring:w.forceMirroring});g.AY("yt.mdx.remote.enableConnectWithInitialState_",w?w.enableConnectWithInitialState||!1:!1);$_V(R,f,function(G){G?SA()&&KO(SA(),"YouTube TV"):f.subscribe("onlineScreenChange",function(){KY("yt-remote-receiver-availability-change")})},r)}w&&!g.yD("yt.mdx.remote.initialized_")&&(g.AY("yt.mdx.remote.initialized_",!0),R6("Initializing: "+g.Ao(w)), wV.push(g.FG("yt-remote-cast2-api-ready",function(){KY("yt-remote-api-ready")})),wV.push(g.FG("yt-remote-cast2-availability-change",function(){KY("yt-remote-receiver-availability-change")})),wV.push(g.FG("yt-remote-cast2-receiver-selected",function(){pS(null); KY("yt-remote-auto-connect","cast-selector-receiver")})),wV.push(g.FG("yt-remote-cast2-receiver-resumed",function(){KY("yt-remote-receiver-resumed","cast-selector-receiver")})),wV.push(g.FG("yt-remote-cast2-session-change",uLm)),wV.push(g.FG("yt-remote-connection-change",function(f){f?KO(SA(),"YouTube TV"):rV()||(KO(null,null),d_V())})),wV.push(g.FG("yt-remote-cast2-session-failed",()=>{KY("yt-remote-connection-failed")})),R=fS(),w.isAuto&&(R.id+="#dial"),r=w.capabilities||[],r.length>0&&(R.capabilities= r),R.name=w.device,R.app=w.app,(w=w.theme)&&(R.theme=w),R6(" -- with channel params: "+g.Ao(R)),R?(g.Qp("yt-remote-session-app",R.app),g.Qp("yt-remote-session-name",R.name)):(g.gy("yt-remote-session-app"),g.gy("yt-remote-session-name")),g.AY("yt.mdx.remote.channelParams_",R),p.start(),SA()||sya())}},zAm=function(){var R=UK().Gg.$_gos(); const w=G2();w&&I6()&&(qE(R,w)||R.push(w));return N8k(R)},CS=function(){let R=Bfm(); !R&&oC()&&n5U()&&(R={key:"cast-selector-receiver",name:n5U()});return R},Bfm=function(){const R=zAm(); let w=G2();w||(w=rV());return g.S_(R,function(p){return w&&Wm(w,p.key)?!0:!1})},G2=function(){const R=SA(); if(!R)return null;const w=UK().sj();return AX(w,R)},uLm=function(R){R6("remote.onCastSessionChange_: "+xx(R)); if(R){var w=G2();if(w&&w.id==R.id){if(KO(w.id,"YouTube TV"),R.idType=="shortLived"&&(R=R.token))uC&&(uC.token=R),(w=I6())&&w.kT(R)}else w&&mi(),z2(R,1)}else I6()&&mi()},mi=function(){tL()?yu().stopSession():AL("stopSession called before API ready."); const R=I6();R&&(R.disconnect(1),Bi(null))},Wi=function(){const R=I6(); return!!R&&R.getProxyState()!=3},R6=function(R){Ts("remote",R)},UK=function(){if(!x6){const R=g.yD("yt.mdx.remote.screenService_"); x6=R?new WPM(R):null}return x6},SA=function(){return g.yD("yt.mdx.remote.currentScreenId_")},xGU=function(R){g.AY("yt.mdx.remote.currentScreenId_",R)},lca=function(){return g.yD("yt.mdx.remote.connectData_")},pS=function(R){g.AY("yt.mdx.remote.connectData_",R)},I6=function(){return g.yD("yt.mdx.remote.connection_")},Bi=function(R){const w=I6(); pS(null);R||xGU("");g.AY("yt.mdx.remote.connection_",R);kT&&(g.iH(kT,function(p){p(R)}),kT.length=0); w&&!R?KY("yt-remote-connection-change",!1):!w&&R&&KY("yt-remote-connection-change",!0)},rV=function(){const R=g.He(); if(!R)return null;var w=UK();if(!w)return null;w=w.sj();return AX(w,R)},z2=function(R,w){SA(); G2()&&G2();if(lC)uC=R;else{xGU(R.id);var p=g.yD("yt.mdx.remote.enableConnectWithInitialState_")||!1;R=new LS(R,p);R.connect(w,lca());R.subscribe("beforeDisconnect",function(r){KY("yt-remote-before-disconnect",r)}); R.subscribe("beforeDispose",function(){I6()&&(I6(),Bi(null))}); R.subscribe("browserChannelAuthError",()=>{const r=G2();r&&r.idType=="shortLived"&&(tL()?yu().handleBrowserChannelAuthError():AL("refreshLoungeToken called before API ready."))}); Bi(R)}},sya=function(){const R=rV(); R?(R6("Resume connection to: "+xx(R)),z2(R,0)):(tX(),d_V(),R6("Skipping connecting because no session screen found."))},COU=function(){var R=fS(); if(g.Jt(R)){R=VH();var w=g.hj("yt-remote-session-name")||"";const p=g.hj("yt-remote-session-app")||"";R={device:"REMOTE_CONTROL",id:R,name:w,app:p,mdxVersion:3};R.authuser=String(g.n("SESSION_INDEX","0"));(w=g.n("DELEGATED_SESSION_ID"))&&(R.pageId=String(w));g.AY("yt.mdx.remote.channelParams_",R)}},fS=function(){return g.yD("yt.mdx.remote.channelParams_")||{}},LPk=function(R,w){if(qu(R)){R.xp.unsubscribe("remotePlayerChange",R.K,R); const p=Math.round(w.volume);w=!!w.muted;const r=nO(R.xp);if(p!==r.volume||w!==r.muted)R.xp.setVolume(p,w),R.S.start();R.xp.subscribe("remotePlayerChange",R.K,R)}},qu=function(R){return nO(R.xp).videoId===AF(R).videoId},bC=function(R,w){let p,r; var f=R.B.getPlaylist();f?.listId&&(p=f.index,r=f.listId.toString());f=AF(R);R.xp.playVideo(f.videoId,w,p,r,f.playerParams,f.S,nIP(f));R.I9(new g.Gf(1))},yJ=function(R,w){if(qu(R)&&!R.J){let p=null; w&&(p={style:R.B.getSubtitlesUserSettings()},Object.assign(p,w));R.xp.U(AF(R).videoId,p);R.G=nO(R.xp).trackData}},q4a=function(R,w){if(w){const p=R.B.getOption("captions","tracklist",{Cn:1}); p&&p.length?(R.B.setOption("captions","track",w),R.J=!1):(R.B.loadModule("captions"),R.J=!0)}else R.B.setOption("captions","track",{})},Afb=function(R){R.Q2(0); R.C.stop();R.I9(new g.Gf(64))},AF=function(R){return R.B.getVideoData({playerType:1})},bKk=function(R){const w=R.player.V(); return!w.Y("mdx_enable_privacy_disclosure_ui")||R.isLoggedIn()||R.BP||!R.OL?!1:g.t5(w)||g.Eg(w)},yfR=function(R,w,p){R.Rb=p; R.player.publish("presentingplayerstatechange",new g.ll(p,w))},VJ=function(R,w,...p){R.loaded&&R.qB.gw(w,...p)},o6=function(R){R.j2&&(R.player.removeEventListener("presentingplayerstatechange",R.j2),R.j2=null)},tF=function(R,w){if(w.key!==R.iH.key)if(w.key===R.D6.key)mi(); else if(bKk(R)&&V6a(R),R.iH=w,!g.dQ(R.player.V())){{const G=R.player.getPlaylistId();var p=R.player.getVideoData({playerType:1});const I=p.videoId;if(!G&&!I||(R.player.getAppState()===2||R.player.getAppState()===1)&&R.player.V().Y("should_clear_video_data_on_player_cued_unstarted"))p=null;else{var r=R.player.getPlaylist();if(r){var f=[];for(let C=0;C{!R.BP&&w.TE(8)&&(R.player.pauseVideo(), o6(R))},R.player.addEventListener("presentingplayerstatechange",R.j2)); R.OL&&R.OL.R9();I6()||(lC=!0)}; g.lL.prototype.QK=g.rd(46,function(){this.app.UZ().QK()}); g.Ux.prototype.QK=g.rd(45,function(){this.d_=null}); g.lL.prototype.wr=g.rd(44,function(R){this.app.UZ().wr(R)}); g.Ux.prototype.wr=g.rd(43,function(R){this.d_=R}); g.sL.prototype.mp=g.rd(1,function(){return g.wU(this,3)}); g.ie.prototype.mp=g.rd(0,function(){return g.wU(this,11)}); var K6b=class{constructor(){var R=g.l$();this.C=R;g.u0(R,"/client_streamz/youtube/living_room/mdx/channel/opened",g.E8("channel_type"))}L(R){g.B5(this.C,"/client_streamz/youtube/living_room/mdx/channel/opened",R)}},Ewp=class{constructor(){var R=g.l$();this.C=R;g.u0(R,"/client_streamz/youtube/living_room/mdx/channel/closed",g.E8("channel_type"))}L(R){g.B5(this.C,"/client_streamz/youtube/living_room/mdx/channel/closed",R)}},eNR=class{constructor(){var R=g.l$();this.C=R;g.u0(R,"/client_streamz/youtube/living_room/mdx/channel/message_received", g.E8("channel_type"))}L(R){g.B5(this.C,"/client_streamz/youtube/living_room/mdx/channel/message_received",R)}},DnV=class{constructor(){var R=g.l$();this.C=R;g.u0(R,"/client_streamz/youtube/living_room/mdx/channel/success")}L(){g.B5(this.C,"/client_streamz/youtube/living_room/mdx/channel/success")}},MbP=class{constructor(){var R=g.l$();this.C=R;g.u0(R,"/client_streamz/youtube/living_room/mdx/channel/error",g.E8("channel_type"),g.E8("error_type"))}L(R,w){g.B5(this.C,"/client_streamz/youtube/living_room/mdx/channel/error", R,w)}},cok=class{constructor(){var R=g.l$();this.C=R;g.u0(R,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}L(){g.B5(this.C,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}},P0R=class{constructor(){var R=g.l$();this.C=R;g.u0(R,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}L(){g.B5(this.C,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}};g.t=s7.prototype; g.t.BC=function(){m8(this);const R=[];for(let w=0;w2*this.size&&m8(this),!0):!1}; g.t.get=function(R,w){return uQ(this.C,R)?this.C[R]:w}; g.t.set=function(R,w){uQ(this.C,R)||(this.size+=1,this.L.push(R),this.rM++);this.C[R]=w}; g.t.forEach=function(R,w){const p=this.zD();for(let r=0;r=r.L.length)return g.SF;const G=r.L[w++];return g.ON(R?G:r.C[G])}; return f}; var Qe6={YM:"atp",KZ0:"ska",nY0:"que",tZ:"mus",Gk0:"sus",yT:"dsp",NN0:"seq",Ge:"mic",ot:"dpa",Bh:"mlm",nQ:"dsdtr",Yd:"ntb",wBn:"vsp",e3:"scn",oYY:"rpe",Y0:"dcn",Fy:"dcp",NA:"pas",y5:"drq",Qy:"opf",Ne:"els",A7:"isg",wSI:"svq",JZ:"mvp",JN:"ads",gBN:"stcp",xrB:"sads",DD:"dloc",UH:"dcw",s4:"asw",tN:"apw",g8:"wrc",GyB:"pcw",F0:"ipv",ZX:"ndt",fQ:"ctops",sM:"gsrm"},h4U={SQY:"u",mK:"cl",oZ:"k",C1:"i",Me:"cr",sG:"m",Ip:"g",rd:"up"},$np={DX:"nowPlaying",uG:"onStateChange",oC:"adPlaying",kd:"onAdStateChange", yy:"nowPlayingShorts",a4:"onShortsStateChange"};zC.prototype.equals=function(R){return R?this.id==R.id:!1}; var yH="",O7=null,zMm=I1t("loadCastFramework")||I1t("loadCastApplicationFramework"),Wsb=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.$b(cm,g.f5);g.t=cm.prototype;g.t.ET=function(R){this.G=arguments;this.L=!1;this.A2?this.O=g.c6()+this.Tv:this.A2=g.rW(this.K,this.Tv)}; g.t.stop=function(){this.A2&&(g.qx.clearTimeout(this.A2),this.A2=null);this.O=null;this.L=!1;this.G=[]}; g.t.pause=function(){++this.C}; g.t.resume=function(){this.C&&(--this.C,!this.C&&this.L&&(this.L=!1,this.J.apply(null,this.G)))}; g.t.Gy=function(){this.stop();cm.Su.Gy.call(this)}; g.t.lV=function(){this.A2&&(g.qx.clearTimeout(this.A2),this.A2=null);this.O?(this.A2=g.rW(this.K,this.O-g.c6()),this.O=null):this.C?this.L=!0:(this.L=!1,this.J.apply(null,this.G))};var aG=null;Pm.prototype.set=function(R){this.L=R}; Pm.prototype.reset=function(){this.set(g.c6())}; Pm.prototype.get=function(){return this.L};g.$b(Lsb,l1m);var Gs=class{stringify(R){return g.qx.JSON.stringify(R,void 0)}parse(R){return g.qx.JSON.parse(R,void 0)}};g.$b($x,g.IR);g.$b(Xv,g.IR);var q1P=null;g.$b(A8P,g.IR);g.$b(b9m,g.IR);g.$b(y8i,g.IR);Fv.prototype.debug=function(){}; Fv.prototype.info=function(){}; Fv.prototype.warning=function(){};var EZU={},hX={};g.t=j7.prototype;g.t.setTimeout=function(R){this.Qk=R}; g.t.P8=function(R){R=R.target;const w=this.YY;w&&g.c5(R)==3?w.G():this.hJ(R)}; g.t.hJ=function(R){try{if(R==this.L)a:{const f=g.c5(this.L),G=this.L.C,I=this.L.getStatus();if(!(f<3)&&(f!=3||this.L&&(this.C.C||g.$w(this.L)||g.XM(this.L)))){this.M0||f!=4||G==7||(G==8||I<=0?dh(3):dh(2));gh(this);var w=this.L.getStatus();this.eI=w;var p=Ksp(this);if(this.J=w==200){if(this.SI&&!this.PS){b:{if(this.L){const C=g.dW(this.L,"X-HTTP-Initial-Response");if(C&&!g.fj(C)){var r=C;break b}}r=null}if(R=r)this.PS=!0,pr(this,R);else{this.J=!1;this.K=3;Zz(12);iQ(this);QH(this);break a}}if(this.I0){R= !0;let C;for(;!this.M0&&this.D0&&!this.mq&&(this.mq=!0,this.O.Fw(this)):(iQ(this),QH(this))}else pr(this,p);f==4&&iQ(this);this.J&&!this.M0&&(f==4?MZS(this.O,this):(this.J=!1,TC(this)))}else g.nw(this.L),w==400&&p.indexOf("Unknown SID")> 0?(this.K=3,Zz(12)):(this.K=0,Zz(13)),iQ(this),QH(this)}}}catch(f){}finally{}}; g.t.cancel=function(){this.M0=!0;iQ(this)}; g.t.iV=function(){this.pB=null;const R=Date.now();R-this.q0>=0?(this.jI!=2&&(dh(3),Zz(17)),iQ(this),this.K=2,QH(this)):eMa(this,this.q0-R)}; g.t.getLastError=function(){return this.K}; g.t.W3=function(){return this.L};var oMb=class{constructor(R,w){this.L=R;this.map=w;this.context=null}};$3a.prototype.cancel=function(){this.O=rT(this);if(this.C)this.C.cancel(),this.C=null;else if(this.L&&this.L.size!==0){for(const R of this.L.values())R.cancel();this.L.clear()}};g.t=Y1P.prototype;g.t.Oo=8;g.t.pv=1;g.t.connect=function(R,w,p,r){Zz(0);this.ag=R;this.M0=w||{};p&&r!==void 0&&(this.M0.OSID=p,this.M0.OAID=r);this.YY=this.Mr;this.Jl=c8b(this,null,this.ag);wT(this)}; g.t.disconnect=function(){Fsb(this);if(this.pv==3){var R=this.nB++,w=this.Jl.clone();g.Ry(w,"SID",this.G);g.Ry(w,"RID",R);g.Ry(w,"TYPE","terminate");ud(this,w);R=new j7(this,this.G,R);R.jI=2;R.U=fY(w.clone());w=!1;if(g.qx.navigator&&g.qx.navigator.sendBeacon)try{w=g.qx.navigator.sendBeacon(R.U.toString(),"")}catch{}!w&&g.qx.Image&&((new Image).src=R.U,w=!0);w||(R.L=tZV(R.O,null),R.L.send(R.U));R.xY=Date.now();TC(R)}hM6(this)}; g.t.u4=function(){return this.pv==0}; g.t.getState=function(){return this.pv}; g.t.IF=function(R){if(this.J)if(this.J=null,this.pv==1){if(!R){this.nB=Math.floor(Math.random()*1E5);R=this.nB++;const f=new j7(this,"",R);let G=this.X;this.SI&&(G?(G=g.ht(G),g.N6(G,this.SI)):G=this.SI);this.D!==null||this.q0||(f.Jl=G,G=null);if(this.N0)a:{var w=0;for(var p=0;p4096){w=p;break a}if(w===4096||p===this.O.length-1){w=p+1;break a}}w= this.WB}else w=this.WB;w=Tep(this,f,w);p=this.Jl.clone();g.Ry(p,"RID",R);g.Ry(p,"CVER",22);this.I0&&g.Ry(p,"X-HTTP-Session-Id",this.I0);ud(this,p);G&&(this.q0?w="headers="+g.m3(g.Iy(G))+"&"+w:this.D&&g.CK(p,this.D,G));RS(this.C,f);this.Nk&&g.Ry(p,"TYPE","init");this.N0?(g.Ry(p,"$req",w),g.Ry(p,"SID","null"),f.SI=!0,JX(f,p,null)):JX(f,p,w);this.pv=2}}else this.pv==3&&(R?i9a(this,R):this.O.length==0||XvV(this.C)||i9a(this))}; g.t.G6=function(){this.U=null;QRV(this);if(this.cB&&!(this.Qk||this.L==null||this.yh<=0)){var R=4*this.yh;this.O0=Yx((0,g.e_)(this.B5,this),R)}}; g.t.B5=function(){this.O0&&(this.O0=null,this.YY=!1,this.Qk=!0,Zz(10),NE(this),QRV(this))}; g.t.Fw=function(R){this.L==R&&this.cB&&!this.Qk&&(Cr(this),this.Qk=!0,Zz(11))}; g.t.Ym=function(){this.pB!=null&&(this.pB=null,NE(this),kx(this),Zz(19))}; g.t.Y3=function(R){R?Zz(2):Zz(1)}; g.t.isActive=function(){return!!this.K&&this.K.isActive(this)}; g.t=H9M.prototype;g.t.MD=function(){}; g.t.z6=function(){}; g.t.rX=function(){}; g.t.Kj=function(){}; g.t.isActive=function(){return!0}; g.t.FG=function(){};g.$b(mX,g.E1);mX.prototype.open=function(){this.L.K=this.O;this.D&&(this.L.PS=!0);this.L.connect(this.J,this.C||void 0)}; mX.prototype.close=function(){this.L.disconnect()}; mX.prototype.send=function(R){var w=this.L;if(typeof R==="string"){var p={};p.__data__=R;R=p}else this.K&&(p={},p.__data__=g.Ao(R),R=p);w.O.push(new oMb(w.GE++,R));w.pv==3&&wT(w)}; mX.prototype.Gy=function(){this.L.K=null;delete this.O;this.L.disconnect();delete this.L;mX.Su.Gy.call(this)}; g.$b(Nem,$x);g.$b(kFi,Xv);g.$b(se,H9M);se.prototype.MD=function(){this.L.dispatchEvent("m")}; se.prototype.z6=function(R){this.L.dispatchEvent(new Nem(R))}; se.prototype.rX=function(R){this.L.dispatchEvent(new kFi(R))}; se.prototype.Kj=function(){this.L.dispatchEvent("n")}; mX.prototype.G=function(){return new zs(this,this.L)}; zs.prototype.C=function(){return U7(this.L.C)}; zs.prototype.O=function(){return gZa(this.L).map(R=>{var w=this.G;R=R.map;"__data__"in R?(R=R.__data__,w=w.K?ZuR(R):R):w=R;return w})}; zs.prototype.commit=function(R){this.L.eI=R};var WH=new g.E1,U3R=class extends g.IR{constructor(){super("statevent",WH)}};g.t=ld.prototype;g.t.EF=null;g.t.xq=!1;g.t.dK=null;g.t.DG=null;g.t.KV=null;g.t.Ke=null;g.t.fV=null;g.t.Ij=null;g.t.lT=null;g.t.cF=null;g.t.jD=0;g.t.Jb=null;g.t.zl=null;g.t.WE=null;g.t.IK=-1;g.t.lO=!0;g.t.Ga=!1;g.t.F4=0;g.t.Gl=null;var w5b={},Ae={};g.t=ld.prototype;g.t.setTimeout=function(R){this.C=R}; g.t.Du=function(R){R=R.target;const w=this.Gl;w&&g.c5(R)==3?w.G():this.Bs(R)}; g.t.Bs=function(R){try{if(R==this.cF)a:{const w=g.c5(this.cF),p=this.cF.C,r=this.cF.getStatus();if(g.f$&&!g.ew("420+")){if(w<4)break a}else if(w<3||w==3&&!g.$w(this.cF))break a;this.Ga||w!=4||p==7||(p==8||r<=0?this.L.G2(3):this.L.G2(2));fF6(this);const f=this.cF.getStatus();this.IK=f;const G=g.$w(this.cF);if(this.xq=f==200){w==4&&yg(this);if(this.I0){for(R=!0;!this.Ga&&this.jD0?3:0,xR(),yg(this),bd(this)}}catch(w){}finally{}}; g.t.cancel=function(){this.Ga=!0;yg(this)}; g.t.c8=function(){this.dK=null;const R=Date.now();R-this.DG>=0?(this.Ke!=2&&this.L.G2(3),yg(this),this.WE=2,xR(),bd(this)):roa(this,this.DG-R)}; g.t.getLastError=function(){return this.WE};g.t=uMk.prototype;g.t.nz=null;g.t.x7=null;g.t.Hl=!1;g.t.o6=null;g.t.LJ=null;g.t.Kg=-1;g.t.Mz=null;g.t.Us=null;g.t.connect=function(R){this.o6=R;R=oS(this.L,null,this.o6);xR();Date.now();const w=this.L.X;w!=null?(this.Mz=w[0],(this.Us=w[1])?(this.LJ=1,shk(this)):(this.LJ=2,Oe(this))):(GC(R,"MODE","init"),this.x7=new ld(this),this.x7.EF=this.nz,Lr(this.x7,R,!1,null,!0),this.LJ=0)}; g.t.Cf=function(R){if(R)this.LJ=2,Oe(this);else{xR();var w=this.L;w.Xo=w.Ed.Kg;aS(w,9)}R&&this.G2(2)}; g.t.yY=function(R){return this.L.yY(R)}; g.t.abort=function(){this.x7&&(this.x7.cancel(),this.x7=null);this.Kg=-1}; g.t.u4=function(){return!1}; g.t.JJ=function(R,w){this.Kg=R.IK;if(this.LJ==0)if(w){try{var p=this.C.parse(w)}catch(r){R=this.L;R.Xo=this.Kg;aS(R,2);return}this.Mz=p[0];this.Us=p[1]}else R=this.L,R.Xo=this.Kg,aS(R,2);else this.LJ==2&&(this.Hl?(xR(),Date.now()):w=="11111"?(xR(),this.Hl=!0,Date.now(),this.Kg=200,this.x7.cancel(),xR(),te(this.L,this,!0)):(xR(),Date.now(),this.Hl=!1))}; g.t.ZG=function(){this.Kg=this.x7.IK;if(this.x7.xq)this.LJ==0?this.Us?(this.LJ=1,shk(this)):(this.LJ=2,Oe(this)):this.LJ==2&&(this.Hl?(xR(),te(this.L,this,!0)):(xR(),te(this.L,this,!1)));else{this.LJ==0?xR():this.LJ==2&&xR();var R=this.L;this.x7.getLastError();R.Xo=this.Kg;aS(R,2)}}; g.t.rz=function(){return this.L.rz()}; g.t.isActive=function(){return this.L.isActive()}; g.t.G2=function(R){this.L.G2(R)};g.t=Kr.prototype;g.t.CJ=null;g.t.j8=null;g.t.gm=null;g.t.mL=null;g.t.Uw=null;g.t.Bn=null;g.t.tJ=null;g.t.QY=null;g.t.Mf=0;g.t.Zu=0;g.t.T_=null;g.t.bH=null;g.t.rE=null;g.t.PX=null;g.t.Ed=null;g.t.Xa=null;g.t.RO=-1;g.t.gX=-1;g.t.Xo=-1;g.t.vE=0;g.t.qa=0;g.t.iT=8;var t6M={OK:0,uBl:2,L9:4,n9:5,mrk:6,STOP:7,eU:8,Z3:9,D3:10,nY:11,E4:12};g.$b(zNp,g.IR);g.$b(BWU,g.IR);g.t=Kr.prototype; g.t.connect=function(R,w,p,r,f){xR();this.Uw=w;this.j8=p||{};r&&f!==void 0&&(this.j8.OSID=r,this.j8.OAID=f);this.U?(BH((0,g.e_)(this.cz,this,R),100),W6R(this)):this.cz(R)}; g.t.disconnect=function(){xnU(this);if(this.L==3){var R=this.Mf++;const w=this.Bn.clone();g.Ry(w,"SID",this.G);g.Ry(w,"RID",R);g.Ry(w,"TYPE","terminate");cH(this,w);R=new ld(this,this.G,R);R.Ke=2;R.fV=fY(w.clone());(new Image).src=R.fV.toString();R.KV=Date.now();qh(R)}Vbb(this)}; g.t.cz=function(R){this.Ed=new uMk(this);this.Ed.nz=this.CJ;this.Ed.C=this.K;this.Ed.connect(R)}; g.t.u4=function(){return this.L==0}; g.t.getState=function(){return this.L}; g.t.lJ=function(R){this.bH=null;qF6(this,R)}; g.t.Eo=function(){this.rE=null;this.mL=new ld(this,this.G,"rpc",this.D);this.mL.EF=this.CJ;this.mL.F4=0;var R=this.tJ.clone();g.Ry(R,"RID","rpc");g.Ry(R,"SID",this.G);g.Ry(R,"CI",this.Xa?"0":"1");g.Ry(R,"AID",this.RO);cH(this,R);g.Ry(R,"TYPE","xmlhttp");Lr(this.mL,R,!0,this.QY,!1)}; g.t.JJ=function(R,w){if(this.L!=0&&(this.mL==R||this.gm==R))if(this.Xo=R.IK,this.gm==R&&this.L==3)if(this.iT>7){try{var p=this.K.parse(w)}catch(r){p=null}if(Array.isArray(p)&&p.length==3)if(R=p,R[0]==0)a:{if(!this.rE){if(this.mL)if(this.mL.KV+3E30)){if(r=w==1)this.gm||this.bH||this.L==1||this.vE>=2?r=!1:(this.bH=BH((0,g.e_)(this.lJ,this,R),bwM(this,this.vE)),this.vE++, r=!0);r=!(r||w==2&&PH(this))}if(r)switch(p){case 1:aS(this,5);break;case 4:aS(this,10);break;case 3:aS(this,6);break;case 7:aS(this,12);break;default:aS(this,2)}}}; g.t.y4=function(R){if(!g.ra(arguments,this.L))throw Error("Unexpected channel state: "+this.L);}; g.t.PY=function(R){R?xR():(xR(),yoR(this,8))}; g.t.yY=function(R){if(R)throw Error("Can't create secondary domain capable XhrIo object.");R=new g.OF;R.D=!1;return R}; g.t.isActive=function(){return!!this.T_&&this.T_.isActive(this)}; g.t.G2=function(R){const w=WH;w.dispatchEvent(new BWU(w,R))}; g.t.rz=function(){return!1}; new Lsb;g.t=owU.prototype;g.t.Ye=function(){}; g.t.Ps=function(){}; g.t.F$=function(){}; g.t.iJ=function(){}; g.t.k8=function(){}; g.t.Dn=function(){return{}}; g.t.isActive=function(){return!0};g.t=tbk.prototype;g.t.enqueue=function(R){this.C.push(R)}; g.t.isEmpty=function(){return this.L.length===0&&this.C.length===0}; g.t.clear=function(){this.L=[];this.C=[]}; g.t.contains=function(R){return g.ra(this.L,R)||g.ra(this.C,R)}; g.t.remove=function(R){{var w=this.L;const p=Array.prototype.lastIndexOf.call(w,R,w.length-1);p>=0?(g.IM(w,p),w=!0):w=!1}return w||g.CR(this.C,R)}; g.t.BC=function(){const R=[];for(var w=this.L.length-1;w>=0;--w)R.push(this.L[w]);w=this.C.length;for(let p=0;p"",this.jI=()=>g.FB({}))}; g.t.cS=function(){return this.X}; g.t.connect=async function(R,w,p){try{this.U&&await this.K}finally{if(this.X||this.L&&this.L.getState()==2&&!this.O)return;this.I0="";this.O||this.C.stop();this.S=R||null;this.pB=w||0;const r=this.PS+"/test",f=this.PS+"/bind";R=new Kr(p?p.firstTestResults:null,p?p.secondTestResults:null,this.eI);const G=this.L;G&&(G.T_=null);R.T_=this;this.L=R;if(this.U)return this.K=dT(this).then(()=>aFp(this,r,f,G,p)),this.K.then(()=>{this.K=g.FB()}); aFp(this,r,f,G,p)}}; g.t.disconnect=function(R){try{this.U&&(this.K.cancel(),this.K=g.FB())}finally{this.O0=R||0,this.C&&this.C.stop(),nr(this),this.L&&(this.L.getState()==3&&qF6(this.L),this.L.disconnect()),this.O0=0}}; g.t.sendMessage=async function(R,w){try{this.U&&await this.K}finally{if(this.X)return;const p={_sc:R};w&&g.N6(p,w);if(this.C.isActive()||(this.L?this.L.getState():0)==2)this.G.push(p);else if(this.Kw())try{this.U&&!X5b(this,R)&&await dT(this)}finally{this.Kw()&&(X5b(this,R),nr(this),eJ(this.L,p))}}}; g.t.Ye=function(){this.J&&this.C&&this.C.mp()>0&&(this.J.lUN(this.C.mp(),this.O,!0),this.J.ih0());this.J&&this.J.L6Y();this.O?(this.C.stop(),g.p5(this.C),this.C=new $R(this.Om,this),this.O=!1):this.C.reset();this.S=null;this.pB=0;if(this.G.length)if(this.U)nwa(this);else{var R=this.G;this.G=[];var w=R.length;for(let p=0;pt6M[p]===R); this.nB.L("BROWSER_CHANNEL",w??"UNKNOWN")}; g.t.k8=function(R,w){if(!this.C.isActive())this.publish("handlerClosed");else if(w){const p=w.length;for(let r=0;r{this.onError(r)}); this.handler.subscribe("handlerMessage",this.onMessage,this);this.C=w}connect(R,w,p){this.handler.connect(R,w,p)}disconnect(R){this.handler.disconnect(R)}TG(){this.handler.TG()}getDeviceId(){return this.handler.getDeviceId()}V8(){return this.handler.V8()}Kw(){return this.handler.Kw()}L(){this.dispatchEvent("channelOpened");var R=this.handler,w=this.C;g.Qp("yt-remote-session-browser-channel",{firstTestResults:[""],secondTestResults:!R.L.Xa,sessionId:R.L.G,arrayId:R.L.RO});g.Qp("yt-remote-session-screen-id", w);R=bQ();w=VH();g.ra(R,w)||R.push(w);S86(R);oG()}onClosed(){this.dispatchEvent("channelClosed")}onMessage(R){this.dispatchEvent(new OKR(R))}onError(R){this.dispatchEvent(new KPi(R?1:0))}sendMessage(R,w){this.handler.sendMessage(R,w)}kT(R){this.handler.kT(R)}dispose(){this.handler.dispose()}};var F6b=class{constructor(R,w,p=()=>""){new vZV; var r=new g.DG;this.pathPrefix=R;this.L=w;this.xY=p;this.K=r;this.U=null;this.X=this.D=0;this.channel=null;this.J=0;this.O=new $R(()=>{this.O.isActive();this.channel?.G().C()===0&&this.connect(this.U,this.D)}); this.G={};this.C={};this.pB=!1;this.logger=null;this.S=[];this.Po=void 0;this.Jl=new K6b;this.O0=new Ewp;this.M0=new eNR;this.I0=new MbP}connect(R={},w=0){this.J!==2&&(this.O.stop(),this.U=R,this.D=w,jJ(this),(R=g.n("ID_TOKEN"))?this.G["x-youtube-identity-token"]=R:delete this.G["x-youtube-identity-token"],this.L&&(this.C.device=this.L.device,this.C.name=this.L.name,this.C.app=this.L.app,this.C.id=this.L.id,this.L.H_&&(this.C.mdxVersion=`${this.L.H_}`),this.L.theme&&(this.C.theme=this.L.theme),this.L.capabilities&& (this.C.capabilities=this.L.capabilities),this.L.tD&&(this.C.cst=this.L.tD),this.L.authuser&&(this.C.authuser=this.L.authuser),this.L.pageId&&(this.C.pageId=this.L.pageId)),this.D!==0?this.C.ui=`${this.D}`:delete this.C.ui,Object.assign(this.C,this.U),this.channel=new mX(this.pathPrefix,{pW:"gsessionid",Xu:this.G,S7:this.C}),this.channel.open(),this.J=2,Zwp(this))}disconnect(R=0){this.X=R;this.O.stop();jJ(this);this.channel&&(this.X!==0?this.C.ui=`${this.X}`:delete this.C.ui,this.channel.close()); this.X=0}V8(){return this.O.isActive()?this.O.d0-Date.now():NaN}TG(){var R=this.O;g.NG(R.L);R.start()}sendMessage(R,w){this.channel&&(jJ(this),this.channel.send({_sc:R,...w}))}kT(R){R||this.O.stop();R?this.G["X-YouTube-LoungeId-Token"]=R:delete this.G["X-YouTube-LoungeId-Token"]}getDeviceId(){return this.L?this.L.id:""}publish(R,...w){return this.K.publish(R,...w)}subscribe(R,w,p){return this.K.subscribe(R,w,p)}unsubscribe(R,w,p){return this.K.unsubscribe(R,w,p)}Cv(R){return this.K.Cv(R)}dispose(){this.pB|| (this.pB=!0,g.p5(this.K),this.disconnect(),g.p5(this.O),this.xY=()=>"")}cS(){return this.pB}};var YFP=class extends g.E1{constructor(R){super();this.L=R();this.L.subscribe("webChannelOpened",this.C,this);this.L.subscribe("webChannelClosed",this.onClosed,this);this.L.subscribe("webChannelError",this.onError,this);this.L.subscribe("webChannelMessage",this.onMessage,this)}connect(R,w){this.L.connect(R,w)}disconnect(R){this.L.disconnect(R)}TG(){this.L.TG()}getDeviceId(){return this.L.getDeviceId()}V8(){return this.L.V8()}Kw(){return this.L.J===3}C(){this.dispatchEvent("channelOpened")}onClosed(){this.dispatchEvent("channelClosed")}onMessage(R){this.dispatchEvent(new OKR(R))}onError(){this.dispatchEvent(new KPi(this.L.Po=== 401?1:0))}sendMessage(R,w){this.L.sendMessage(R,w)}kT(R){this.L.kT(R)}dispose(){this.L.dispose()}};var vwV=Date.now(),Je=null,he=Array(50),Qg=-1,gT=!1;g.$b(HH,g.HC);HH.prototype.sj=function(){return this.screens}; HH.prototype.contains=function(R){return!!qE(this.screens,R)}; HH.prototype.get=function(R){return R?AX(this.screens,R):null}; HH.prototype.info=function(R){Ts(this.J,R)};var DGb=class extends g.HC{constructor(R,w,p,r,f){super();this.G=R;this.S=w;this.U=p;this.pB=r;this.X=f;this.C=0;this.L=null;this.A2=NaN}start(){!this.L&&isNaN(this.A2)&&this.O()}stop(){this.L&&(this.L.abort(),this.L=null);isNaN(this.A2)||(g.a2(this.A2),this.A2=NaN)}Gy(){this.stop();super.Gy()}O(){this.A2=NaN;this.L=g.Ff(FT(this.G,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.S},timeout:5E3,onSuccess:(0,g.e_)(this.J,this),onError:(0,g.e_)(this.K,this),onTimeout:(0,g.e_)(this.D, this)})}J(R,w){this.L=null;R=w.screen||{};R.dialId=this.U;R.name=this.pB;w=-1;this.X&&R.shortLivedLoungeToken&&R.shortLivedLoungeToken.value&&R.shortLivedLoungeToken.refreshIntervalMs&&(R.screenIdType="shortLived",R.loungeToken=R.shortLivedLoungeToken.value,w=R.shortLivedLoungeToken.refreshIntervalMs);this.publish("pairingComplete",new Bm(R),w)}K(R){this.L=null;R.status&&R.status==404?this.C>=EMV.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(R=EMV[this.C],this.A2=g.cI((0,g.e_)(this.O, this),R),this.C++):this.publish("pairingFailed",Error("Server error "+R.status))}D(){this.L=null;this.publish("pairingFailed",Error("Server not responding"))}},EMV=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.$b(Nh,HH);g.t=Nh.prototype;g.t.start=function(){vH(this)&&this.publish("screenChange");!g.hj("yt-remote-lounge-token-expiration")&&SFS(this);g.a2(this.L);this.L=g.cI((0,g.e_)(this.start,this),1E4)}; g.t.add=function(R,w){vH(this);NWb(this,R);kR(this,!1);this.publish("screenChange");w(R);R.token||SFS(this)}; g.t.remove=function(R,w){let p=vH(this);Unb(this,R)&&(kR(this,!1),p=!0);w(R);p&&this.publish("screenChange")}; g.t.AT=function(R,w,p,r){let f=vH(this);const G=this.get(R.id);G?(G.name!=w&&(G.name=w,kR(this,!1),f=!0),p(R)):r(Error("no such local screen."));f&&this.publish("screenChange")}; g.t.Gy=function(){g.a2(this.L);Nh.Su.Gy.call(this)}; g.t.Va=function(R){vH(this);let w=this.screens.length;R=R&&R.screens||[];const p=R.length;for(let r=0;r{g.p5(I);f(rR(this,C),u)}); I.subscribe("pairingFailed",C=>{g.p5(I);G(C)}); I.start();return(0,g.e_)(I.stop,I)}; g.t.Q4=function(R,w,p,r){g.Ff(FT(this.G,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:R},timeout:5E3,onSuccess:(0,g.e_)(function(f,G){f=new Bm(G.screen||{});if(!f.name||G_a(this,f.name)){a:{G=f.name;let I=2,C=w(G,I);for(;G_a(this,C);){I++;if(I>20)break a;C=w(G,I)}G=C}f.name=G}p(rR(this,f))},this), onError:(0,g.e_)(function(f){r(Error("pairing request failed: "+f.status))},this), onTimeout:(0,g.e_)(function(){r(Error("pairing request timed out."))},this)})}; g.t.Gy=function(){g.p5(this.C);g.p5(this.L);pO.Su.Gy.call(this)}; g.t.XP=function(){ChS(this);this.publish("screenChange");this.L.update()}; pO.prototype.dispose=pO.prototype.dispose;g.$b(Gz,g.HC);g.t=Gz.prototype;g.t.NJ=function(R){this.cS()||(R&&(CO(this,""+R),this.publish("sessionFailed")),this.L=null,this.publish("sessionScreen",null))}; g.t.info=function(R){Ts(this.I0,R)}; g.t.Zn=function(){return null}; g.t.CP=function(R){const w=this.C;R?(w.displayStatus=new chrome.cast.ReceiverDisplayStatus(R,[]),w.displayStatus.showStop=!0):w.displayStatus=null;chrome.cast.setReceiverDisplayStatus(w,(0,g.e_)(function(){this.info("Updated receiver status for "+w.friendlyName+": "+R)},this),(0,g.e_)(function(){CO(this,"Failed to update receiver status for: "+w.friendlyName)},this))}; g.t.Gy=function(){this.CP("");Gz.Su.Gy.call(this)};var Ou=class extends Gz{constructor(R,w,p){super(R,w,"CastSession");this.config_=p;this.O=null;this.S=(0,g.e_)(this.Jl,this);this.xY=(0,g.e_)(this.jI,this);this.pB=g.cI(()=>{B4P(this,null)},12E4); this.U=this.K=this.D=this.X=0}O0(R){if(this.O){if(this.O==R)return;CO(this,"Overriding cast session with new session object");WRa(this);this.O.removeUpdateListener(this.S);this.O.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.xY)}this.O=R;this.O.addUpdateListener(this.S);this.O.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.xY);x_M(this,"getMdxSessionStatus")}J(R){this.info("launchWithParams no-op for Cast: "+g.Ao(R))}stop(){this.O?this.O.stop((0,g.e_)(function(){this.NJ()}, this),(0,g.e_)(function(){this.NJ(Error("Failed to stop receiver app."))},this)):this.NJ(Error("Stopping cast device without session."))}CP(){}Gy(){this.info("disposeInternal"); WRa(this);this.O&&(this.O.removeUpdateListener(this.S),this.O.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.xY));this.O=null;super.Gy()}jI(R,w){if(!this.cS())if(w)if(w=CY(w),g.Kd(w))switch(R=""+w.type,w=w.data||{},this.info("onYoutubeMessage_: "+R+" "+g.Ao(w)),R){case "mdxSessionStatus":B4P(this,w);break;case "loungeToken":l8R(this,w);break;default:CO(this,"Unknown youtube message: "+R)}else CO(this,"Unable to parse message.");else CO(this,"No data in message.")}M0(R,w,p,r){g.a2(this.X); this.X=0;f8M(this.G,this.C.label,R,this.C.friendlyName,(0,g.e_)(function(f){f?w(f):r>=0?(CO(this,"Screen "+R+" appears to be offline. "+r+" retries left."),this.X=g.cI((0,g.e_)(this.M0,this,R,w,p,r-1),300)):p(Error("Unable to fetch screen."))},this),p)}Zn(){return this.O}Jl(R){this.cS()||R||(CO(this,"Cast session died."),this.NJ())}};var eAk=class extends Gz{constructor(R,w,p,r){super(R,w,"DialSession");this.config_=r;this.O=this.X=null;this.xY="";this.jI=p;this.Jl=null;this.S=()=>{}; this.pB=NaN;this.M0=(0,g.e_)(this.PS,this);this.K=()=>{}; this.U=this.D=0}O0(R){this.O=R;this.O.addUpdateListener(this.M0)}J(R){this.Jl=R;this.S()}stop(){yDR(this);this.O?this.O.stop((0,g.e_)(this.NJ,this,null),(0,g.e_)(this.NJ,this,"Failed to stop DIAL device.")):this.NJ()}Gy(){yDR(this);this.O&&this.O.removeUpdateListener(this.M0);this.O=null;super.Gy()}PS(R){this.cS()||R||(CO(this,"DIAL session died."),this.K(),this.K=()=>{},this.NJ())}};var M6P=class extends Gz{constructor(R,w){super(R,w,"ManualSession");this.O=g.cI((0,g.e_)(this.J,this,null),150)}stop(){this.NJ()}O0(){}J(){g.a2(this.O);this.O=NaN;const R=AX(this.G.sj(),this.C.label);R?IC(this,R):this.NJ(Error("No such screen"))}Gy(){g.a2(this.O);this.O=NaN;super.Gy()}};var EK=class extends g.HC{constructor(R,w){super();this.config_=w;this.C=R;this.O0=w.appId||"233637DE";this.G=w.theme||"cl";this.I0=w.disableCastApi||!1;this.D=w.forceMirroring||!1;this.L=null;this.U=!1;this.O=[];this.J=(0,g.e_)(this.Jl,this)}init(R,w){chrome.cast.timeout.requestSession=3E4;var p=new chrome.cast.SessionRequest(this.O0,[chrome.cast.Capability.AUDIO_OUT]);g.Y("desktop_enable_cast_connect")&&(p.androidReceiverCompatible=!0);this.I0||(p.dialRequest=new chrome.cast.DialRequest("YouTube")); const r=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;R=R||this.D?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;const f=(0,g.e_)(this.jI,this);p=new chrome.cast.ApiConfig(p,(0,g.e_)(this.X,this),f,r,R);p.customDialLaunchCallback=(0,g.e_)(this.M0,this);chrome.cast.initialize(p,(0,g.e_)(function(){this.cS()||(chrome.cast.addReceiverActionListener(this.J),hNR(),this.C.subscribe("onlineScreenChange",(0,g.e_)(this.K,this)),this.O=E5P(this),chrome.cast.setCustomReceivers(this.O, ()=>{},(0,g.e_)(function(G){this.GH("Failed to set initial custom receivers: "+g.Ao(G))},this)),this.publish("yt-remote-cast2-availability-change",Wp(this)),w(!0))},this),(0,g.e_)(function(G){this.GH("Failed to initialize API: "+g.Ao(G)); w(!1)},this))}YY(R,w){xT("Setting connected screen ID: "+R+" -> "+w); if(this.L){var p=this.L.L;if(!R||p&&p.id!=R)xT("Unsetting old screen status: "+this.L.C.friendlyName),l3(this,null)}if(R&&w){if(!this.L){R=AX(this.C.sj(),R);if(!R){xT("setConnectedScreenStatus: Unknown screen.");return}if(R.idType=="shortLived"){xT("setConnectedScreenStatus: Screen with id type to be short lived.");return}p=KRM(this,R);p||(xT("setConnectedScreenStatus: Connected receiver not custom..."),p=new chrome.cast.Receiver(R.uuid?R.uuid:R.id,R.name),p.receiverType=chrome.cast.ReceiverType.CUSTOM, this.O.push(p),chrome.cast.setCustomReceivers(this.O,()=>{},(0,g.e_)(function(r){this.GH("Failed to set initial custom receivers: "+g.Ao(r))},this))); xT("setConnectedScreenStatus: new active receiver: "+p.friendlyName);l3(this,new M6P(this.C,p),!0)}this.L.CP(w)}else xT("setConnectedScreenStatus: no screen.")}nB(R){this.cS()?this.GH("Setting connection data on disposed cast v2"):this.L?this.L.J(R):this.GH("Setting connection data without a session")}xY(){this.cS()?this.GH("Stopping session on disposed cast v2"):this.L?(this.L.stop(),l3(this,null)):xT("Stopping non-existing session")}requestSession(){chrome.cast.requestSession((0,g.e_)(this.X,this), (0,g.e_)(this.PS,this))}Gy(){this.C.unsubscribe("onlineScreenChange",(0,g.e_)(this.K,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.J);var R=TWm;const w=g.yD("yt.mdx.remote.debug.handlers_");g.CR(w||[],R);g.p5(this.L);super.Gy()}GH(R){Ts("Controller",R)}pB(R,w){this.L==R&&(w||l3(this,null),this.publish("yt-remote-cast2-session-change",w))}Jl(R,w){if(!this.cS())if(R)switch(R.friendlyName=chrome.cast.unescape(R.friendlyName),xT("onReceiverAction_ "+R.label+" / "+R.friendlyName+ "-- "+w),w){case chrome.cast.ReceiverAction.CAST:if(this.L)if(this.L.C.label!=R.label)xT("onReceiverAction_: Stopping active receiver: "+this.L.C.friendlyName),this.L.stop();else{xT("onReceiverAction_: Casting to active receiver.");this.L.L&&this.publish("yt-remote-cast2-session-change",this.L.L);break}switch(R.receiverType){case chrome.cast.ReceiverType.CUSTOM:l3(this,new M6P(this.C,R));break;case chrome.cast.ReceiverType.DIAL:l3(this,new eAk(this.C,R,this.G,this.config_));break;case chrome.cast.ReceiverType.CAST:l3(this, new Ou(this.C,R,this.config_));break;default:this.GH("Unknown receiver type: "+R.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.L&&this.L.C.label==R.label?this.L.stop():this.GH("Stopping receiver w/o session: "+R.friendlyName)}else this.GH("onReceiverAction_ called without receiver.")}M0(R){if(this.cS())return Promise.reject(Error("disposed"));var w=R.receiver;w.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.GH("Not DIAL receiver: "+w.friendlyName),w.receiverType=chrome.cast.ReceiverType.DIAL); var p=this.L?this.L.C:null;if(!p||p.label!=w.label)return this.GH("Receiving DIAL launch request for non-clicked DIAL receiver: "+w.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(p&&p.label==w.label&&p.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.L.L)return xT("Reselecting dial screen."),this.publish("yt-remote-cast2-session-change",this.L.L),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.GH('Changing CAST intent from "'+p.receiverType+'" to "dial" for '+w.friendlyName); l3(this,new eAk(this.C,w,this.G,this.config_))}w=this.L;w.X=R;w.X.appState==chrome.cast.DialAppState.RUNNING?(R=w.X.extraData||{},p=R.screenId||null,zz(w)&&R.loungeToken?R.loungeTokenRefreshIntervalMs?R=O4M(w,{name:w.C.friendlyName,screenId:R.screenId,loungeToken:R.loungeToken,dialId:w.X.receiver.label,screenIdType:"shortLived"},R.loungeTokenRefreshIntervalMs):(g.uF(Error(`No loungeTokenRefreshIntervalMs presents in additionalData: ${JSON.stringify(R)}.`)),R=o5i(w,p)):R=o5i(w,p)):R=mm(w);return R}X(R){if(!this.cS()&& !this.D){xT("New cast session ID: "+R.sessionId);var w=R.receiver;if(w.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.L)if(w.receiverType==chrome.cast.ReceiverType.CAST)xT("Got resumed cast session before resumed mdx connection."),w.friendlyName=chrome.cast.unescape(w.friendlyName),l3(this,new Ou(this.C,w,this.config_),!0);else{this.GH("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var p=this.L.C,r=AX(this.C.sj(),p.label);r&&Wm(r,w.label)&&p.receiverType!= chrome.cast.ReceiverType.CAST&&w.receiverType==chrome.cast.ReceiverType.CAST&&(xT("onSessionEstablished_: manual to cast session change "+w.friendlyName),g.p5(this.L),this.L=new Ou(this.C,w,this.config_),this.L.subscribe("sessionScreen",(0,g.e_)(this.pB,this,this.L)),this.L.subscribe("sessionFailed",()=>D_i(this,this.L)),this.L.J(null)); this.L.O0(R)}}}S(){return this.L?this.L.Zn():null}PS(R){this.cS()||(this.GH("Failed to estabilish a session: "+g.Ao(R)),R.code!=chrome.cast.ErrorCode.CANCEL&&l3(this,null),this.publish("yt-remote-cast2-session-failed"))}jI(R){xT("Receiver availability updated: "+R);if(!this.cS()){var w=Wp(this);this.U=R==chrome.cast.ReceiverAvailability.AVAILABLE;Wp(this)!=w&&this.publish("yt-remote-cast2-availability-change",Wp(this))}}K(){this.cS()||(this.O=E5P(this),xT("Updating custom receivers: "+g.Ao(this.O)), chrome.cast.setCustomReceivers(this.O,()=>{},(0,g.e_)(function(){this.GH("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",Wp(this)))}}; EK.prototype.setLaunchParams=EK.prototype.nB;EK.prototype.setConnectedScreenStatus=EK.prototype.YY;EK.prototype.stopSession=EK.prototype.xY;EK.prototype.getCastSession=EK.prototype.S;EK.prototype.requestSession=EK.prototype.requestSession;EK.prototype.init=EK.prototype.init;EK.prototype.dispose=EK.prototype.dispose;var Vu=[],a8m=(0,g.JJ)`https://www.gstatic.com/cv/js/sender/v1/cast_sender.js`;g.t=Dt.prototype; g.t.reset=function(R){this.listId="";this.index=-1;this.videoId="";eA(this);this.volume=-1;this.muted=!1;R&&(this.index=R.index,this.listId=R.listId,this.videoId=R.videoId,this.playerState=R.playerState,this.volume=R.volume,this.muted=R.muted,this.audioTrackId=R.audioTrackId,this.trackData=R.trackData,this.hasPrevious=R.hasPrevious,this.hasNext=R.hasNext,this.J=R.playerTime,this.K=R.playerTimeAt,this.C=R.seekableStart,this.D=R.seekableEnd,this.O=R.duration,this.loadedTime=R.loadedTime,this.L=R.liveIngestionTime, this.G=!isNaN(this.L))}; g.t.isPlaying=function(){return this.playerState==1}; g.t.isBuffering=function(){return this.playerState==3}; g.t.vM=function(R){this.O=isNaN(R)?0:R}; g.t.getDuration=function(){return this.G?this.O+Mv(this):this.O}; g.t.clone=function(){return new Dt($T(this))};var cfM=class extends g.HC{constructor(){var R=I6();super();this.O=0;this.G=R;this.D=[];this.K=new tbk;this.C=this.L=null;this.S=(0,g.e_)(this.Jl,this);this.X=(0,g.e_)(this.J,this);this.pB=(0,g.e_)(this.M0,this);this.I0=(0,g.e_)(this.jI,this);let w=0;R?(w=R.getProxyState(),w!=3&&(R.subscribe("proxyStateChange",this.O0,this),jQp(this))):w=3;w!=0&&g.cI(()=>{this.O0(w)},0); (R=Z4a())&&X$(this,R);this.subscribe("yt-remote-cast2-session-change",this.I0)}getState(){return this.O}V8(){return this.G.getReconnectTimeout()}TG(){this.G.reconnect()}play(){dR(this)?(this.L?this.L.play(null,g.EW,F$(this,"play")):Zt(this,"play"),JL(this,1,Pp(nO(this))),this.publish("remotePlayerChange")):Tz(this,this.play)}pause(){dR(this)?(this.L?this.L.pause(null,g.EW,F$(this,"pause")):Zt(this,"pause"),JL(this,2,Pp(nO(this))),this.publish("remotePlayerChange")):Tz(this,this.pause)}seekTo(R){if(dR(this)){if(this.L){const w= nO(this),p=new chrome.cast.media.SeekRequest;p.currentTime=R;w.isPlaying()||w.isBuffering()?p.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:p.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.L.seek(p,g.EW,F$(this,"seekTo",{newTime:R}))}else Zt(this,"seekTo",{newTime:R});JL(this,3,R);this.publish("remotePlayerChange")}else Tz(this,g.Mx(this.seekTo,R))}stop(){if(dR(this)){this.L?this.L.stop(null,g.EW,F$(this,"stopVideo")):Zt(this,"stopVideo");var R=nO(this);R.index=-1;R.videoId= "";eA(R);jA(this,R);this.publish("remotePlayerChange")}else Tz(this,this.stop)}setVolume(R,w){if(dR(this)){var p=nO(this);if(this.C){if(p.volume!=R){const r=Math.round(R)/100;this.C.setReceiverVolumeLevel(r,(0,g.e_)(function(){id("set receiver volume: "+r)},this),(0,g.e_)(function(){this.GH("failed to set receiver volume.")},this))}p.muted!=w&&this.C.setReceiverMuted(w,(0,g.e_)(function(){id("set receiver muted: "+w)},this),(0,g.e_)(function(){this.GH("failed to set receiver muted.")},this))}else{const r= {volume:R, muted:w};p.volume!=-1&&(r.delta=R-p.volume);Zt(this,"setVolume",r)}p.muted=w;p.volume=R;jA(this,p)}else Tz(this,g.Mx(this.setVolume,R,w))}U(R,w){if(dR(this)){var p=nO(this);R={videoId:R};w&&(p.trackData={trackName:w.name,languageCode:w.languageCode,sourceLanguageCode:w.translationLanguage?w.translationLanguage.languageCode:"",languageName:w.languageName,kind:w.kind},R.style=g.Ao(w.style),g.N6(R,p.trackData));Zt(this,"setSubtitlesTrack",R);jA(this,p)}else Tz(this,g.Mx(this.U,R,w))}setAudioTrack(R, w){dR(this)?(w=w.getLanguageInfo().getId(),Zt(this,"setAudioTrack",{videoId:R,audioTrackId:w}),R=nO(this),R.audioTrackId=w,jA(this,R)):Tz(this,g.Mx(this.setAudioTrack,R,w))}playVideo(R,w,p,r=null,f=null,G=null,I=null){const C=nO(this),u={videoId:R};p!==void 0&&(u.currentIndex=p);aC(C,R,p||0);w!==void 0&&(cp(C,w),u.currentTime=w);r&&(u.listId=r);f&&(u.playerParams=f);G&&(u.clickTrackingParams=G);I&&(u.locationInfo=g.Ao(I));Zt(this,"setPlaylist",u);r||jA(this,C)}oY(R,w){if(dR(this)){if(R&&w){const p= nO(this);aC(p,R,w);jA(this,p)}Zt(this,"previous")}else Tz(this,g.Mx(this.oY,R,w))}nextVideo(R,w){if(dR(this)){if(R&&w){const p=nO(this);aC(p,R,w);jA(this,p)}Zt(this,"next")}else Tz(this,g.Mx(this.nextVideo,R,w))}tC(){if(dR(this)){Zt(this,"clearPlaylist");var R=nO(this);R.reset();jA(this,R);this.publish("remotePlayerChange")}else Tz(this,this.tC)}xY(){dR(this)?Zt(this,"dismissAutoplay"):Tz(this,this.xY)}dispose(){if(this.O!=3){const R=this.O;this.O=3;this.publish("proxyStateChange",R,this.O)}super.dispose()}Gy(){JDP(this); this.G=null;this.K.clear();X$(this,null);super.Gy()}O0(R){if((R!=this.O||R==2)&&this.O!=3&&R!=0){var w=this.O;this.O=R;this.publish("proxyStateChange",w,R);if(R==1)for(;!this.K.isEmpty();)w=R=this.K,w.L.length===0&&(w.L=w.C,w.L.reverse(),w.C=[]),R.L.pop().apply(this);else R==3&&this.dispose()}}PS(R,w){this.publish(R,w)}Jl(R){if(!R)this.J(null),X$(this,null);else if(this.C.receiver.volume){R=this.C.receiver.volume;const w=nO(this),p=Math.round(100*R.level||0);if(w.volume!=p||w.muted!=R.muted)id("Cast volume update: "+ R.level+(R.muted?" muted":"")),w.volume=p,w.muted=!!R.muted,jA(this,w)}}J(R){id("Cast media: "+!!R);this.L&&this.L.removeUpdateListener(this.pB);if(this.L=R)this.L.addUpdateListener(this.pB),T4m(this),this.publish("remotePlayerChange")}M0(R){R?(T4m(this),this.publish("remotePlayerChange")):this.J(null)}nP(){Zt(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}jI(){const R=Z4a();R&&X$(this,R)}GH(R){Ts("CP",R)}};var LS=class extends g.HC{constructor(R,w=!1){var p=Nv,r=fS();super();this.J=NaN;this.M0=!1;this.S=this.pB=this.O0=this.I0=NaN;this.xY=[];this.K=this.U=this.G=this.L=this.C=null;this.U0=p;this.PS=w;this.xY.push(g.ZU(window,"beforeunload",()=>{this.D(2)})); this.O=[];this.L=new Dt;this.q0=R.id;this.jI=R.idType;this.C=JoS(this.U0,r,this.Jl,this.jI=="shortLived",this.q0);this.C.listen("channelOpened",()=>{i4P(this)}); this.C.listen("channelClosed",()=>{i3("Channel closed");isNaN(this.J)?tX(!0):tX();this.dispose()}); this.C.listen("channelError",f=>{tX();isNaN(this.X())?(f==1&&this.jI=="shortLived"&&this.publish("browserChannelAuthError",f),i3(`Channel error: ${f} without reconnection`),this.dispose()):(this.M0=!0,i3("Channel error: "+f+" with reconnection in "+this.X()+" ms"),hL(this,2))}); this.C.listen("channelMessage",f=>{pZi(this,f)}); this.C.kT(R.token);this.subscribe("remoteQueueChange",()=>{var f=this.L.videoId;g.He()&&g.Qp("yt-remote-session-video-id",f)})}connect(R,w){if(w){var p=w.listId; const r=w.videoId,f=w.videoIds,G=w.playerParams,I=w.clickTrackingParams,C=w.index,u={videoId:r},m=w.currentTime,z=w.locationInfo;w=w.loopMode;m!==void 0&&(u.currentTime=m<=5?0:m);G&&(u.playerParams=G);z&&(u.locationInfo=z);I&&(u.clickTrackingParams=I);p&&(u.listId=p);f&&f.length>0&&(u.videoIds=f.join(","));C!==void 0&&(u.currentIndex=C);this.PS&&(u.loopMode=w||"LOOP_MODE_OFF");p&&(this.L.listId=p);this.L.videoId=r;this.L.index=C||0;this.L.state=3;cp(this.L,m);this.K="UNSUPPORTED";p=this.PS?"setInitialState": "setPlaylist";i3(`Connecting with ${p} and params: ${g.Ao(u)}`);this.C.connect({method:p,params:g.Ao(u)},R,RMp())}else i3("Connecting without params"),this.C.connect({},R,RMp());rfa(this)}kT(R){this.C.kT(R)}dispose(){this.cS()||(g.AY("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),hL(this,3));super.dispose()}Gy(){gR(this);Hp(this);Qu(this);g.a2(this.pB);this.pB=NaN;g.a2(this.S);this.S=NaN;this.G=null;g.YB(this.xY);this.xY.length=0;this.C.dispose();super.Gy();this.K=this.U=this.O= this.L=this.C=null}nB(R){if(!this.O||this.O.length===0)return!1;for(const w of this.O)if(!w.capabilities.has(R))return!1;return!0}mq(){let R=3;this.cS()||(R=0,isNaN(this.X())?this.C.Kw()&&isNaN(this.J)&&(R=1):R=2);return R}D(R){i3("Disconnecting with "+R);g.AY("yt.mdx.remote.remoteClient_",null);gR(this);this.publish("beforeDisconnect",R);R==1&&tX();this.C.disconnect(R);this.dispose()}SI(){let R=this.L;this.G&&(R=this.L.clone(),aC(R,this.G,R.index));return $T(R)}f_(R){const w=new Dt(R);w.videoId&& w.videoId!=this.L.videoId&&(this.G=w.videoId,g.a2(this.pB),this.pB=g.cI(()=>{if(this.G){const r=this.G;this.G=null;this.L.videoId!=r&&vp(this,"getNowPlaying")}},5E3)); const p=[];this.L.listId==w.listId&&this.L.videoId==w.videoId&&this.L.index==w.index||p.push("remoteQueueChange");this.L.playerState==w.playerState&&this.L.volume==w.volume&&this.L.muted==w.muted&&Pp(this.L)==Pp(w)&&g.Ao(this.L.trackData)==g.Ao(w.trackData)||p.push("remotePlayerChange");this.L.reset(R);g.iH(p,function(r){this.publish(r)},this)}YY(){const R=this.C.getDeviceId(),w=g.S_(this.O,function(p){return p.type=="REMOTE_CONTROL"&&p.id!=R}); return w?w.id:""}X(){return this.C.V8()}N0(){return this.K||"UNSUPPORTED"}eI(){return this.U||""}Qk(){!isNaN(this.X())&&this.C.TG()}p_(R,w){vp(this,R,w);Ict(this)}Jl(){var R=g.kE("SAPISID","")||g.kE("__Secure-1PAPISID")||"",w=g.kE("__Secure-3PAPISID","")||"";if(!R&&!w)return"";R=g.c8(g.DA(R),2);w=g.c8(g.DA(w),2);return g.c8(g.DA(`,${R},${w}`),2)}};LS.prototype.subscribe=LS.prototype.subscribe;LS.prototype.unsubscribeByKey=LS.prototype.Cv;LS.prototype.getProxyState=LS.prototype.mq; LS.prototype.disconnect=LS.prototype.D;LS.prototype.getPlayerContextData=LS.prototype.SI;LS.prototype.setPlayerContextData=LS.prototype.f_;LS.prototype.getOtherConnectedRemoteId=LS.prototype.YY;LS.prototype.getReconnectTimeout=LS.prototype.X;LS.prototype.getAutoplayMode=LS.prototype.N0;LS.prototype.getAutoplayVideoId=LS.prototype.eI;LS.prototype.reconnect=LS.prototype.Qk;LS.prototype.sendMessage=LS.prototype.p_;LS.prototype.getXsrfToken=LS.prototype.Jl; LS.prototype.isCapabilitySupportedOnConnectedDevices=LS.prototype.nB;var WPM=class extends HH{constructor(R){super("ScreenServiceProxy");this.Gg=R;this.L=[];this.L.push(this.Gg.$_s("screenChange",(0,g.e_)(this.C,this)));this.L.push(this.Gg.$_s("onlineScreenChange",(0,g.e_)(this.O,this)))}sj(R){return this.Gg.$_gs(R)}contains(R){return!!this.Gg.$_c(R)}get(R){return this.Gg.$_g(R)}start(){this.Gg.$_st()}add(R,w,p){this.Gg.$_a(R,w,p)}remove(R,w,p){this.Gg.$_r(R,w,p)}AT(R,w,p,r){this.Gg.$_un(R,w,p,r)}Gy(){const R=this.L.length;for(let w=0;w{LPk(this,r)}); g.K(this,this.events);this.events.W(w,"onCaptionsTrackListChanged",this.Qk);this.events.W(w,"captionschanged",this.U0);this.events.W(w,"captionssettingschanged",this.PS);this.events.W(w,"videoplayerreset",this.D);this.events.W(w,"mdxautoplaycancel",()=>{this.xp.xY()}); w.Y("enable_mdx_video_play_directly")&&this.events.W(w,"videodatachange",()=>{bKk(this.L)||qu(this)||bC(this,0)}); R=this.xp;R.cS();R.subscribe("proxyStateChange",this.M0,this);R.subscribe("remotePlayerChange",this.K,this);R.subscribe("remoteQueueChange",this.D,this);R.subscribe("previousNextChange",this.I0,this);R.subscribe("nowAutoplaying",this.O0,this);R.subscribe("autoplayDismissed",this.xY,this);g.K(this,this.C);g.K(this,this.O);g.K(this,this.pB);g.K(this,this.S);g.K(this,this.X);this.PS();this.D();this.K()}Gy(){super.Gy();this.C.stop();this.O.stop();this.pB.stop();const R=this.xp;R.unsubscribe("proxyStateChange", this.M0,this);R.unsubscribe("remotePlayerChange",this.K,this);R.unsubscribe("remoteQueueChange",this.D,this);R.unsubscribe("previousNextChange",this.I0,this);R.unsubscribe("nowAutoplaying",this.O0,this);R.unsubscribe("autoplayDismissed",this.xY,this);this.xp=this.L=null}gw(R,...w){if(this.xp.O!=2)if(qu(this)){if(nO(this.xp).playerState!=1081||R!=="control_seek")switch(R){case "control_toggle_play_pause":nO(this.xp).isPlaying()?this.xp.pause():this.xp.play();break;case "control_play":this.xp.play(); break;case "control_pause":this.xp.pause();break;case "control_seek":this.X.G(w[0],w[1]);break;case "control_subtitles_set_track":yJ(this,w[0]);break;case "control_set_audio_track":this.setAudioTrack(w[0])}}else switch(R){case "control_toggle_play_pause":case "control_play":case "control_pause":R=this.B.getCurrentTime();bC(this,R===0?void 0:R);break;case "control_seek":bC(this,w[0]);break;case "control_subtitles_set_track":yJ(this,w[0]);break;case "control_set_audio_track":this.setAudioTrack(w[0])}}U0(R){this.pB.ET(R)}q0(R){this.gw("control_subtitles_set_track", g.Jt(R)?null:R)}PS(){const R=this.B.getOption("captions","track");g.Jt(R)||yJ(this,R)}Q2(R){this.L.Q2(R,this.B.getVideoData().lengthSeconds)}Qk(){g.Jt(this.G)||q4a(this,this.G);this.J=!1}M0(R,w){this.O.stop();w===2&&this.jI()}K(){if(qu(this)){this.C.stop();var R=nO(this.xp);switch(R.playerState){case 1080:case 1081:case 1084:case 1085:this.L.rY=1;break;case 1082:case 1083:this.L.rY=0;break;default:this.L.rY=-1}switch(R.playerState){case 1081:case 1:this.I9(new g.Gf(8));this.Jl();break;case 1085:case 3:this.I9(new g.Gf(9)); break;case 1083:case 0:this.I9(new g.Gf(2));this.X.stop();this.Q2(this.B.getVideoData().lengthSeconds);break;case 1084:this.I9(new g.Gf(4));break;case 2:this.I9(new g.Gf(4));this.Q2(Pp(R));break;case -1:this.I9(new g.Gf(64));break;case -1E3:this.I9(new g.Gf(128,{errorCode:"mdx.remoteerror",errorMessage:"This video is not available for remote playback.",ma:2}))}const p=nO(this.xp).trackData;R=p;var w=this.G;(R||w?R&&w&&R.trackName==w.trackName&&R.languageCode==w.languageCode&&R.languageName==w.languageName&& R.kind==w.kind:1)||(this.G=p,q4a(this,p));R=nO(this.xp);R.volume===-1||Math.round(this.B.getVolume())===R.volume&&this.B.isMuted()===R.muted||this.S.isActive()||this.YY()}else Afb(this)}I0(){this.B.publish("mdxpreviousnextchange")}D(){qu(this)||Afb(this)}O0(R){isNaN(R)||this.B.publish("mdxnowautoplaying",R)}xY(){this.B.publish("mdxautoplaycanceled")}setAudioTrack(R){qu(this)&&this.xp.setAudioTrack(AF(this).videoId,R)}seekTo(R,w){nO(this.xp).playerState===-1?bC(this,R):w&&this.xp.seekTo(R)}YY(){if(qu(this)){var R= nO(this.xp);this.events.o9(this.nB);R.muted?this.B.mute():this.B.unMute();this.B.setVolume(R.volume);this.nB=this.events.W(this.B,"onVolumeChange",w=>{LPk(this,w)})}}Jl(){this.C.stop(); if(!this.xp.cS()){var R=nO(this.xp);R.isPlaying()&&this.I9(new g.Gf(8));this.Q2(Pp(R));this.C.start()}}jI(){this.O.stop();this.C.stop();const R=this.xp.V8();this.xp.O==2&&!isNaN(R)&&this.O.start()}I9(R){this.O.stop();const w=this.U;if(!g.zf(w,R)){const p=R.L(2);p!==this.U.L(2)&&this.B.EL(p);this.U=R;yfR(this.L,w,R)}}};var acM=class extends g.Nj{constructor(R,w){super(R);this.L=w}getCurrentTime(){return this.L.getCurrentTime()}getDuration(){return this.L.getDuration()}gg(){return this.L.gg()}BM(){return this.L.BM()}Ev(){return this.L.Ev()}dc(){return this.L.dc()}getPlayerState(){return this.L.Rb}isAtLiveHead(){return this.L.isAtLiveHead()}pauseVideo(){VJ(this.L,"control_pause")}async playVideo(){VJ(this.L,"control_play")}seekTo(R,w){VJ(this.L,"control_seek",R,!w?.Z4)}yl(R){VJ(this.L,"control_set_audio_track",R); return!0}};var $GS=class extends g.k{constructor(){super({j:"div",Z:"ytp-mdx-popup-dialog",A:{role:"dialog"},N:[{j:"div",Z:"ytp-mdx-popup-dialog-inner-content",N:[{j:"div",Z:"ytp-mdx-popup-title",fB:"You're signed out"},{j:"div",Z:"ytp-mdx-popup-description",fB:"Videos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer."},{j:"div",Z:"ytp-mdx-privacy-popup-buttons",N:[{j:"button",E0:["ytp-button","ytp-mdx-privacy-popup-cancel"], fB:"Cancel"},{j:"button",E0:["ytp-button","ytp-mdx-privacy-popup-confirm"],fB:"Confirm"}]}]}]});this.fade=new g.HU(this,250);this.cancelButton=this.KB("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.KB("ytp-mdx-privacy-popup-confirm");g.K(this,this.fade);this.W(this.cancelButton,"click",this.L);this.W(this.confirmButton,"click",this.C)}R9(){this.fade.show()}Qh(){this.fade.hide()}L(){KY("mdx-privacy-popup-cancel");this.Qh()}C(){KY("mdx-privacy-popup-confirm");this.Qh()}};var XZa=class extends g.k{constructor(R){super({j:"div",Z:"ytp-remote",N:[{j:"div",Z:"ytp-remote-display-status",N:[{j:"div",Z:"ytp-remote-display-status-icon",N:[g.NGI()]},{j:"div",Z:"ytp-remote-display-status-text",fB:"{{statustext}}"}]}]});this.api=R;this.fade=new g.HU(this,250);g.K(this,this.fade);this.W(R,"presentingplayerstatechange",this.onStateChange);this.kp(R.getPlayerStateObject())}onStateChange(R){this.kp(R.state)}kp(R){if(this.api.getPresentingPlayerType()===3){const w={RECEIVER_NAME:this.api.getOption("remote", "currentReceiver").name};R=R.L(128)?g.K2("Error on $RECEIVER_NAME",w):R.isPlaying()||R.isPaused()?g.K2("Playing on $RECEIVER_NAME",w):g.K2("Connected to $RECEIVER_NAME",w);this.updateValue("statustext",R);this.fade.show()}else this.fade.hide()}};var nMi=class extends g.d_{constructor(R,w){super("Play on",1,R,w);this.B=R;this.oz={};this.W(R,"onMdxReceiversChange",this.J);this.W(R,"presentingplayerstatechange",this.J);this.J()}J(){var R=this.B.getOption("remote","receivers");R&&R.length>1&&!this.B.getOption("remote","quickCast")?(this.oz=g.Ei(R,this.K,this),this.G(g.gd(R,this.K)),R=this.B.getOption("remote","currentReceiver"),R=this.K(R),this.options[R]&&this.C(R),this.enable(!0)):this.enable(!1)}K(R){return R.key}O(R){return R==="cast-selector-receiver"? "Cast...":this.oz[R].name}L(R){super.L(R);this.B.setOption("remote","currentReceiver",this.oz[R]);this.OQ.Qh()}};g.XA("remote",class extends g.F2{constructor(R){super(R);this.D6={key:LY(),name:"This computer"};this.qB=null;this.subscriptions=[];this.BQ=this.xp=null;this.oz=[this.D6];this.iH=this.D6;this.Rb=new g.Gf(64);this.gp=0;this.rY=-1;this.BP=!1;this.d_=this.j2=this.OL=null;if(!g.Cb(this.player.V())&&!g.dQ(this.player.V())){R=this.player;var w=g.qS(R);w&&(w=w.Ue())&&(w=new nMi(R,w),g.K(this,w));w=new XZa(R);g.K(this,w);g.P7(R,w.element,4);this.OL=new $GS;g.K(this,this.OL);g.P7(R,this.OL.element,4);this.BP= !!rV()}}create(){var R=this.player.V();const w=g.sg(R);R={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:R.Y("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:R.Y("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:R.Y("enable_cast_short_lived_lounge_token")};mGk(w,R);this.subscriptions.push(g.FG("yt-remote-before-disconnect",this.MK,this));this.subscriptions.push(g.FG("yt-remote-connection-change",this.EW,this));this.subscriptions.push(g.FG("yt-remote-receiver-availability-change", this.Ds,this));this.subscriptions.push(g.FG("yt-remote-auto-connect",this.gx,this));this.subscriptions.push(g.FG("yt-remote-receiver-resumed",this.sW,this));this.subscriptions.push(g.FG("mdx-privacy-popup-confirm",this.tS,this));this.subscriptions.push(g.FG("mdx-privacy-popup-cancel",this.JS,this));this.Ds()}load(){this.player.cancelPlayback();super.load();this.d_=new acM(this.player.V(),this);this.player.wr(this.d_);this.qB=new POR(this,this.player,this.xp);var R=(R=lca())?R.currentTime:0;const w= Wi()?new cfM:null;R==0&&w&&(R=Pp(nO(w)));R!==0&&this.Q2(R);yfR(this,this.Rb,this.Rb);this.player.NL(6)}unload(){this.player.publish("mdxautoplaycanceled");this.player.QK();this.iH=this.D6;g.rG(this.qB,this.xp);this.xp=this.d_=this.qB=null;super.unload();this.player.NL(5);o6(this)}Gy(){g.jh(this.subscriptions);super.Gy()}getAdState(){return this.rY}hasPrevious(){return this.xp?nO(this.xp).hasPrevious:!1}hasNext(){return this.xp?nO(this.xp).hasNext:!1}Q2(R,w){this.gp=R||0;this.player.publish("progresssync", R,w);g.xs(this.player,"onVideoProgress",R||0)}getCurrentTime(){return this.gp}getDuration(){return nO(this.xp).getDuration()||0}gg(){var R=nO(this.xp);return R.G?R.L+Mv(R):R.L}BM(){return nO(this.xp).loadedTime}Ev(){return FR6(nO(this.xp))}dc(){var R=nO(this.xp);return R.C>0?R.C+Mv(R):R.C}getProgressState(){const R=nO(this.xp),w=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:R.playerState!=1081&&this.player.Wo(),clipEnd:w.clipEnd,clipStart:w.clipStart,current:this.getCurrentTime(), displayedStart:-1,duration:this.getDuration(),ingestionTime:this.gg(),isAtLiveHead:this.isAtLiveHead(),loaded:this.BM(),seekableEnd:this.Ev(),seekableStart:this.dc(),offset:0,viewerLivestreamJoinMediaTime:0}}isAtLiveHead(){return FR6(nO(this.xp))-this.getCurrentTime()<=1}nextVideo(){this.xp&&this.xp.nextVideo()}oY(){this.xp&&this.xp.oY()}MK(R){R===1&&(this.BQ=this.xp?nO(this.xp):null)}EW(){var R=Wi()?new cfM:null;if(R){const w=this.iH;this.loaded&&this.unload();this.xp=R;this.BQ=null;w.key!==this.D6.key&& (this.iH=w,this.load())}else g.p5(this.xp),this.xp=null,this.loaded&&(this.unload(),(R=this.BQ)&&R.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(R.videoId,Pp(R)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}Ds(){var R=[this.D6],w=R.concat;const p=zAm();oC()&&g.hj("yt-remote-cast-available")&&p.push({key:"cast-selector-receiver",name:"Cast..."});this.oz=w.call(R,p);R=CS()||this.D6;tF(this,R);g.xs(this.player,"onMdxReceiversChange")}gx(){const R= CS();tF(this,R)}sW(){this.iH=CS()}tS(){this.BP=!0;o6(this);lC=!1;uC&&z2(uC,1);uC=null}JS(){this.BP=!1;o6(this);tF(this,this.D6);this.iH=this.D6;lC=!1;uC=null;this.player.playVideo()}Oe(R,w){switch(R){case "casting":return this.loaded;case "receivers":return this.oz;case "currentReceiver":return w&&(w.key==="cast-selector-receiver"?OK():tF(this,w)),this.loaded?this.iH:this.D6;case "quickCast":return this.oz.length===2&&this.oz[1].key==="cast-selector-receiver"?(w&&OK(),!0):!1}}nP(){this.xp.nP()}dR(){return!1}getOptions(){return["casting", "receivers","currentReceiver","quickCast"]}isLoggedIn(){return g.n("PLAYER_CONFIG")?.args?.authuser!==void 0?!0:!(!g.n("SESSION_INDEX")&&!g.n("LOGGED_IN"))}});})(_yt_player);