(function(g){var window=this;'use strict';var QYy=function(d,f){return g.x_(d,f)},Oag=function(d){if(d instanceof g.ii)return d; if(typeof d.Nm=="function")return d.Nm(!1);if(g.og(d)){let f=0;const m=new g.ii;m.next=function(){for(;;){if(f>=d.length)return g.wv;if(f in d)return g.cn(d[f++]);f++}}; return m}throw Error("Not implemented");},oeg=function(d,f,m){if(g.og(d))g.vT(d,f,m); else for(d=Oag(d);;){const {done:y,value:C}=d.next();if(y)break;f.call(m,C,void 0,d)}},Cj=function(d){g.bG(d,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^g.uc()).toString(36)); return d},BC=function(d,f,m){Array.isArray(m)||(m=[String(m)]); g.Gf(d.j,f,m)},aat=function(d,f){const m=[]; oeg(f,function(y){let C;try{C=g.Ii.prototype.qK.call(this,y,!0)}catch(B){if(B=="Storage: Invalid value was encountered")return;throw B;}C===void 0?m.push(y):g.ge(C)&&m.push(y)},d); return m},hdZ=function(d,f){aat(d,f).forEach(function(m){g.Ii.prototype.remove.call(this,m)},d)},Fdd=function(d){if(d.A7){if(d.A7.locationOverrideToken)return{locationOverrideToken:d.A7.locationOverrideToken}; if(d.A7.latitudeE7!=null&&d.A7.longitudeE7!=null)return{latitudeE7:d.A7.latitudeE7,longitudeE7:d.A7.longitudeE7}}return null},ruN=function(d,f){g.fg(d,f)||d.push(f)},e4=function(d){let f=0; for(const m in d)f++;return f},geP=function(d){try{return g.pS.JSON.parse(d)}catch(f){}d=String(d); if(/^\s*$/.test(d)?0:/^[\],:{}\s\u2028\u2029]*$/.test(d.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("("+d+")")}catch(f){}throw Error("Invalid JSON string: "+d);},MM=function(d){if(g.pS.JSON)try{return g.pS.JSON.parse(d)}catch(f){}return geP(d)},Ia_=function(d,f,m,y){const C=new g.LR(null); d&&g.J2(C,d);f&&g.SE(C,f);m&&g.jE(C,m);y&&(C.A=y);return C},uzt=function(d,f){return new g.P4q(d,f)},Kj=function(d,f){return Object.prototype.hasOwnProperty.call(d,f)},XzP=function(d,f){return d===f},NM=function(d,f){this.A={}; this.S=[];this.o_=this.size=0;var m=arguments.length;if(m>1){if(m%2)throw Error("Uneven number of arguments");for(var y=0;y{d.capabilities.add(m)})},neU=function(d,f){d.compatibleSenderThemes.clear(); g.zP(f.split(","),g.Ig(QYy,laU)).forEach(m=>{d.compatibleSenderThemes.add(m)})},Zax=function(d,f){d.experiments.clear(); f.split(",").forEach(m=>{d.experiments.add(m)})},cC=function(d){d=d||{}; this.name=d.name||"";this.id=d.id||d.screenId||"";this.token=d.token||d.loungeToken||"";this.uuid=d.uuid||d.dialId||"";this.idType=d.screenIdType||"normal";this.secret=d.screenIdSecret||""},s5=function(d,f){return!!f&&(d.id==f||d.uuid==f)},xxX=function(d){return{name:d.name, screenId:d.id,loungeToken:d.token,dialId:d.uuid,screenIdType:d.idType,screenIdSecret:d.secret}},PpZ=function(d){return new cC(d)},Ldt=function(d){return Array.isArray(d)?g.TP(d,PpZ):[]},DC=function(d){return d?`{name:"${d.name}",id:${d.id.substr(0,6)}..,token:${d.token?".."+d.token.slice(-6):"-"},uuid:${d.uuid?".."+d.uuid.slice(-6):"-"},idType:${d.idType},secret:${d.secret?".."+d.secret.slice(-6):"-"}}`:"null"},E5=function(d){return Array.isArray(d)?"["+g.TP(d,DC).join(",")+"]":"null"},pj=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(d){const f=Math.random()*16|0; return(d=="x"?f:f&3|8).toString(16)})},Jut=function(d){return g.TP(d,function(f){return{key:f.id, name:f.name}})},$P=function(d,f){return g.Un(d,function(m){return m||f?!m!=!f?!1:m.id==f.id:!0})},AB=function(d,f){return g.Un(d,function(m){return s5(m,f)})},STx=function(){const d=g.Mb.X0(); d&&hdZ(d,d.MD.Nm(!0))},kP=function(){const d=g.Nb("yt-remote-connected-devices")||[]; g.oU(d);return d},jYZ=function(d){if(d.length==0)return[]; const f=d[0].indexOf("#"),m=f==-1?d[0]:d[0].substring(0,f);return g.TP(d,function(y,C){return C==0?y:y.substring(m.length)})},veN=function(d){g.KP("yt-remote-connected-devices",d,86400)},O5=function(){if(Qg)return Qg; let d=g.Nb("yt-remote-device-id");d||(d=pj(),g.KP("yt-remote-device-id",d,31536E3));const f=kP();let m=1,y=d;for(;g.fg(f,y);)m++,y=d+"#"+m;return Qg=y},ov=function(){let d=kP(); const f=O5();g.Wa()&&g.hf(d,f);d=jYZ(d);if(d.length==0)try{g.fl("remote_sid")}catch(m){}else try{g.Gw("remote_sid",d.join(","),-1)}catch(m){}},zdx=function(){return g.Nb("yt-remote-session-browser-channel")},Tlf=function(){return g.Nb("yt-remote-local-screens")||[]},qTU=function(){g.KP("yt-remote-lounge-token-expiration",!0,86400)},baU=function(d){d.length>5&&(d=d.slice(d.length-5)); const f=g.TP(Tlf(),function(y){return y.loungeToken}),m=g.TP(d,function(y){return y.loungeToken}); g.w5(m,function(y){return!g.fg(f,y)})&&qTU(); g.KP("yt-remote-local-screens",d,31536E3)},av=function(d){d||(g.i6("yt-remote-session-screen-id"),g.i6("yt-remote-session-video-id")); ov();d=kP();g.ex(d,O5());veN(d)},tqg=function(){if(!hB){const d=g.lU(); d&&(hB=new g.oi(d))}},Hat=function(){tqg(); return hB?!!hB.get("yt-remote-use-staging-server"):!1},Ft=function(d,f){g.dK[d]=!0; const m=g.UL();m&&m.publish.apply(m,arguments);g.dK[d]=!1},r7=function(){let d=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return d?parseInt(d[1],10):0},wzx=function(d){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+d)!=-1||document.currentScript.src.indexOf("&"+d)!=-1)},YTx=function(){return typeof window.__onGCastApiAvailable=="function"?window.__onGCastApiAvailable:null},g7=function(d){d.length?UxX(d.shift(),function(){g7(d)}):Iv()},Iv=function(){let d=YTx(); d&&d(!1,"No cast extension found")},UxX=function(d,f,m){let y=document.createElement("script"); y.onerror=f;m&&(y.onload=m);g.Yk(y,g.w2(d));(document.head||document.documentElement).appendChild(y)},Gud=function(d){return"chrome-extension://"+d+"/cast_sender.js"},dIt=function(){const d=r7(),f=[]; if(d>1){const m=d-1;f.push("//www.gstatic.com/eureka/clank/"+d+"/cast_sender.js");f.push("//www.gstatic.com/eureka/clank/"+m+"/cast_sender.js")}return f},uC=function(){if(fN_){var d=2,f=YTx(),m=function(){d--; d==0&&f&&f(!0)}; window.__onGCastApiAvailable=m;UxX("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",Iv,m)}},mIE=function(){uC(); let d=dIt();d.push("//www.gstatic.com/eureka/clank/cast_sender.js");g7(d)},CMt=function(){uC(); let d=dIt();d.push(...ygV.map(Gud));d.push("//www.gstatic.com/eureka/clank/cast_sender.js");g7(d)},Xt=function(d,f,m){g.qj.call(this); this.C=m!=null?(0,g.g5)(d,m):d;this.Kl=f;this.Y=(0,g.g5)(this.OW,this);this.S=!1;this.A=0;this.V=this.Lo=null;this.j=[]},Rv=function(){this.S=g.uc()},Bzf=function(){nj||(nj=new Rv)},enf=function(){nj||(nj=new Rv)},ZC=function(){g.HA.call(this,"p")},Vg=function(){g.HA.call(this,"o")},lC=function(){return MvU=MvU||new g.p6},KeU=function(d){g.HA.call(this,"serverreachability",d)},xP=function(d){const f=lC(); f.dispatchEvent(new KeU(f,d))},Nzx=function(d){g.HA.call(this,"statevent",d)},PC=function(d){const f=lC(); f.dispatchEvent(new Nzx(f,d))},i7U=function(d,f,m,y){g.HA.call(this,"timingevent",d); this.size=f;this.rtt=m;this.retries=y},Lj=function(d,f){if(typeof d!=="function")throw Error("Fn must not be null and must be a function"); return g.pS.setTimeout(function(){d()},f)},JB=function(){},S4=function(d,f,m,y){this.V=d; this.j=f;this.h7=m;this.A7=y||1;this.Ul=new g.mG(this);this.Br=45E3;this.pC=null;this.C=!1;this.K=this.CC=this.G=this.qp=this.AP=this.GL=this.rD=null;this.X=[];this.S=null;this.B=0;this.Y=this.V2=null;this.mS=-1;this.e1=!1;this.nC=0;this.gD=null;this.Np=this.tP=this.KC=this.hP=!1;this.A=new WeZ},WeZ=function(){this.V=null; this.S="";this.A=!1},j4=function(d,f,m){d.qp=1; d.G=Cj(f.clone());d.K=m;d.hP=!0;cgP(d,null)},cgP=function(d,f){d.AP=Date.now(); vC(d);d.CC=d.G.clone();BC(d.CC,"t",d.A7);d.B=0;const m=d.V.tP;d.A=new WeZ;d.S=swN(d.V,m?f:null,!d.K);d.nC>0&&(d.gD=new g.$X((0,g.g5)(d.e0,d,d.S),d.nC));d.Ul.listen(d.S,"readystatechange",d.Hs);f=d.pC?g.TE(d.pC):{};d.K?(d.V2||(d.V2="POST"),f["Content-Type"]="application/x-www-form-urlencoded",d.S.send(d.CC,d.V2,d.K,f)):(d.V2="GET",d.S.send(d.CC,d.V2,null,f));xP(1)},EZX=function(d){if(!DIZ(d))return g.uD(d.S); const f=g.XW(d.S);if(f==="")return"";let m="";const y=f.length,C=g.rt(d.S)==4;if(!d.A.V){if(typeof TextDecoder==="undefined")return z7(d),T7(d),"";d.A.V=new g.pS.TextDecoder}for(let B=0;Bf.length)return qM;f=f.slice(y,y+m);d.B=y+m;return f},vC=function(d){d.GL=Date.now()+d.Br; AgU(d,d.Br)},AgU=function(d,f){if(d.rD!=null)throw Error("WatchDog timer not null"); d.rD=Lj((0,g.g5)(d.kT,d),f)},bC=function(d){d.rD&&(g.pS.clearTimeout(d.rD),d.rD=null)},T7=function(d){d.V.i5()||d.e1||k$E(d.V,d)},z7=function(d){bC(d); g.zg(d.gD);d.gD=null;d.Ul.removeAll();if(d.S){const f=d.S;d.S=null;f.abort();f.dispose()}},mW=function(d,f){try{var m=d.V; if(m.LR!=0&&(m.S==d||tB(m.A,d)))if(!d.tP&&tB(m.A,d)&&m.LR==3){try{var y=m.v9.S.parse(f)}catch(N){y=null}if(Array.isArray(y)&&y.length==3){var C=y;if(C[0]==0)a:{if(!m.G){if(m.S)if(m.S.AP+3E30&&(m.nC=1.5*D);y=m;const E=d.Nz();if(E){const k=g.nd(E,"X-Client-Wire-Protocol");if(k){var B=y.A;!B.S&&(g.Cy(k,"spdy")||g.Cy(k,"quic")||g.Cy(k,"h2"))&&(B.j=B.Y,B.S=new Set,B.A&&(dI(B,B.A),B.A=null))}if(y.hP){const r=g.nd(E,"X-HTTP-Session-Id");r&&(y.Ld=r,g.bG(y.pC,y.hP,r))}}m.LR=3;m.Y&&m.Y.Q0();m.Z$&&(m.sB=Date.now()-d.AP);y=m;var e=d;y.Lk=QwN(y,y.tP? y.h7:null,y.vZ);if(e.tP){O7Z(y.A,e);var M=e,K=y.nC;K&&M.setTimeout(K);M.rD&&(bC(M),vC(M));y.S=e}else oZP(y);m.V.length>0&&fq(m)}else N[0]!="stop"&&N[0]!="close"||G7(m,7);else m.LR==3&&(N[0]=="stop"||N[0]=="close"?N[0]=="stop"?G7(m,7):m.disconnect():N[0]!="noop"&&m.Y&&m.Y.MS(N),m.X=0)}xP(4)}catch(N){}},aNd=function(d){this.Y=d||10; g.pS.PerformanceNavigationTiming?(d=g.pS.performance.getEntriesByType("navigation"),d=d.length>0&&(d[0].nextHopProtocol=="hq"||d[0].nextHopProtocol=="h2")):d=!!(g.pS.chrome&&g.pS.chrome.loadTimes&&g.pS.chrome.loadTimes()&&g.pS.chrome.loadTimes().wasFetchedViaSpdy);this.j=d?this.Y:1;this.S=null;this.j>1&&(this.S=new Set);this.A=null;this.V=[]},hnx=function(d){return d.A?!0:d.S?d.S.size>=d.j:!1},U5=function(d){return d.A?1:d.S?d.S.size:0},tB=function(d,f){return d.A?d.A==f:d.S?d.S.has(f):!1},dI=function(d, f){d.S?d.S.add(f):d.A=f},O7Z=function(d,f){d.A&&d.A==f?d.A=null:d.S&&d.S.has(f)&&d.S.delete(f)},y_=function(d){if(d.A!=null)return d.V.concat(d.A.X); if(d.S!=null&&d.S.size!==0){let f=d.V;for(const m of d.S.values())f=f.concat(m.X);return f}return g.NN(d.V)},Fet=function(d,f){const m=new JB; if(g.pS.Image){const y=new Image;y.onload=g.Ig(Cq,m,"TestLoadImage: loaded",!0,f,y);y.onerror=g.Ig(Cq,m,"TestLoadImage: error",!1,f,y);y.onabort=g.Ig(Cq,m,"TestLoadImage: abort",!1,f,y);y.ontimeout=g.Ig(Cq,m,"TestLoadImage: timeout",!1,f,y);g.pS.setTimeout(function(){if(y.ontimeout)y.ontimeout()},1E4); y.src=d}else f(!1)},rgx=function(d,f){const m=new JB,y=new AbortController,C=setTimeout(()=>{y.abort(); Cq(m,"TestPingServer: timeout",!1,f)},1E4); fetch(d,{signal:y.signal}).then(B=>{clearTimeout(C);B.ok?Cq(m,"TestPingServer: ok",!0,f):Cq(m,"TestPingServer: server error",!1,f)}).catch(()=>{clearTimeout(C); Cq(m,"TestPingServer: error",!1,f)})},Cq=function(d,f,m,y,C){try{C&&(C.onload=null,C.onerror=null,C.onabort=null,C.ontimeout=null),y(m)}catch(B){}},gZx=function(){this.S=new BQ},ee=function(d,f,m){return m&&m.Dx?m.Dx[d]||f:f},INU=function(d){this.V=[]; this.h7=this.Lk=this.pC=this.vZ=this.S=this.Ld=this.hP=this.e1=this.B=this.KC=this.K=null;this.qH=this.CC=0;this.mQ=ee("failFast",!1,d);this.gD=this.rD=this.G=this.C=this.Y=null;this.MW=!0;this.TU=this.qp=-1;this.A7=this.X=this.AP=0;this.UM=ee("baseRetryDelayMs",5E3,d);this.QT=ee("retryDelaySeedMs",1E4,d);this.SP=ee("forwardChannelMaxRetries",2,d);this.hM=ee("forwardChannelRequestTimeoutMs",2E4,d);this.JM=d&&d.wDp||void 0;this.Fq=d&&d.QQP||void 0;this.y9=d&&d.bRl||!1;this.nC=void 0;this.tP=d&&d.p6|| !1;this.j="";this.A=new aNd(d&&d.X91);this.ws=Math.min(d&&d.TuW||1E3,1E3);this.v9=new gZx;this.Ul=d&&d.ZGr||!1;this.GL=d&&d.DHC||!1;this.Ul&&this.GL&&(this.GL=!1);this.Px=d&&d.cMW||!1;d&&d.WJS&&(this.MW=!1);this.Z$=!this.Ul&&this.MW&&d&&d.dH2||!1;this.PZ=void 0;d&&d.Fm&&d.Fm>0&&(this.PZ=d.Fm);this.mS=void 0;this.sB=0;this.Br=!1;this.Np=this.V2=null},w7=function(d){d.S&&(Mq(d),d.S.cancel(),d.S=null)},u5g=function(d){w7(d); d.G&&(g.pS.clearTimeout(d.G),d.G=null);HC(d);d.A.cancel();d.C&&(typeof d.C==="number"&&g.pS.clearTimeout(d.C),d.C=null)},fq=function(d){hnx(d.A)||d.C||(d.C=!0,g.n6(d.Tj,d),d.AP=0)},Rnf=function(d,f){if(U5(d.A)>=d.A.j-(d.C?1:0))return!1; if(d.C)return d.V=f.X.concat(d.V),!0;if(d.LR==1||d.LR==2||d.AP>=(d.mQ?0:d.SP))return!1;d.C=Lj((0,g.g5)(d.Tj,d,f),XAy(d,d.AP));d.AP++;return!0},Z7x=function(d,f){var m; f?m=f.h7:m=d.CC++;const y=d.pC.clone();g.bG(y,"SID",d.j);g.bG(y,"RID",m);g.bG(y,"AID",d.qp);Kq(d,y);d.B&&d.K&&g.fk(y,d.B,d.K);m=new S4(d,d.j,m,d.AP+1);d.B===null&&(m.pC=d.K);f&&(d.V=f.X.concat(d.V));f=nZP(d,m,d.ws);m.setTimeout(Math.round(d.hM*.5)+Math.round(d.hM*.5*Math.random()));dI(d.A,m);j4(m,y,f)},Kq=function(d,f){d.e1&&g.rx(d.e1,function(m,y){g.bG(f,y,m)}); d.Y&&g.rx({},function(m,y){g.bG(f,y,m)})},nZP=function(d,f,m){m=Math.min(d.V.length,m); const y=d.Y?(0,g.g5)(d.Y.UW,d.Y,d):null;a:{var C=d.V;let M=-1;for(;;){const K=["count="+m];M==-1?m>0?(M=C[0].S,K.push("ofs="+M)):M=0:K.push("ofs="+M);let N=!0;for(let W=0;W=3)return!1; d.A7++;d.G=Lj((0,g.g5)(d.x4,d),XAy(d,d.X));d.X++;return!0},Mq=function(d){d.V2!=null&&(g.pS.clearTimeout(d.V2),d.V2=null)},Vvg=function(d){d.S=new S4(d,d.j,"rpc",d.A7); d.B===null&&(d.S.pC=d.K);d.S.nC=0;var f=d.Lk.clone();g.bG(f,"RID","rpc");g.bG(f,"SID",d.j);g.bG(f,"AID",d.qp);g.bG(f,"CI",d.gD?"0":"1");!d.gD&&d.PZ&&g.bG(f,"TO",d.PZ);g.bG(f,"TYPE","xmlhttp");Kq(d,f);d.B&&d.K&&g.fk(f,d.B,d.K);d.nC&&d.S.setTimeout(d.nC);var m=d.S;d=d.h7;m.qp=1;m.G=Cj(f.clone());m.K=null;m.hP=!0;cgP(m,d)},HC=function(d){d.rD!=null&&(g.pS.clearTimeout(d.rD),d.rD=null)},k$E=function(d,f){var m=null; if(d.S==f){HC(d);Mq(d);d.S=null;var y=2}else if(tB(d.A,f))m=f.X,O7Z(d.A,f),y=1;else return;if(d.LR!=0)if(f.C)if(y==1){m=f.K?f.K.length:0;f=Date.now()-f.AP;var C=d.AP;y=lC();y.dispatchEvent(new i7U(y,m,f,C));fq(d)}else oZP(d);else{var B=f.mS;C=f.getLastError();if(C==3||C==0&&B>0||!(y==1&&Rnf(d,f)||y==2&&YP(d)))switch(m&&m.length>0&&(f=d.A,f.V=f.V.concat(m)),C){case 1:G7(d,5);break;case 4:G7(d,10);break;case 3:G7(d,6);break;default:G7(d,2)}}},XAy=function(d,f){let m=d.UM+Math.floor(Math.random()*d.QT); d.isActive()||(m*=2);return m*f},G7=function(d,f){if(f==2){var m=(0,g.g5)(d.Mt,d),y=d.Fq; const C=!y;y=new g.LR(y||"//www.google.com/images/cleardot.gif");g.pS.location&&g.pS.location.protocol=="http"||g.J2(y,"https");Cj(y);C?Fet(y.toString(),m):rgx(y.toString(),m)}else PC(2);d.LR=0;d.Y&&d.Y.Ij(f);lNt(d);u5g(d)},lNt=function(d){d.LR=0; d.Np=[];if(d.Y){const f=y_(d.A);if(f.length!=0||d.V.length!=0)g.Wd(d.Np,f),g.Wd(d.Np,d.V),d.A.V.length=0,g.NN(d.V),d.V.length=0;d.Y.gR()}},xId=function(d){if(d.LR==0)return d.Np; let f=[];g.Wd(f,y_(d.A));g.Wd(f,d.V);return f},QwN=function(d,f,m){var y=g.t2(m); y.S!=""?(f&&g.SE(y,f+"."+y.S),g.jE(y,y.V)):(y=g.pS.location,y=Ia_(y.protocol,f?f+"."+y.hostname:y.hostname,+y.port,m));f=d.hP;m=d.Ld;f&&m&&g.bG(y,f,m);g.bG(y,"VER",d.DE);Kq(d,y);return y},swN=function(d,f,m){if(f&&!d.tP)throw Error("Can't create secondary domain capable XhrIo object."); f=d.y9&&!d.JM?new g.QF(new g.Zm({Ya:m})):new g.QF(d.JM);f.B=d.tP;return f},PMX=function(){},Lex=function(){},iS=function(d,f){g.p6.call(this); this.S=new INU(f);this.C=d;this.A=f&&f.Fu||null;d=f&&f.SX||null;f&&f.K6w&&(d?d["X-Client-Protocol"]="webchannel":d={"X-Client-Protocol":"webchannel"});this.S.K=d;d=f&&f.Xgw||null;f&&f.qs&&(d?d["X-WebChannel-Content-Type"]=f.qs:d={"X-WebChannel-Content-Type":f.qs});f&&f.yv&&(d?d["X-WebChannel-Client-Profile"]=f.yv:d={"X-WebChannel-Client-Profile":f.yv});this.S.KC=d;(d=f&&f.NLC)&&!g.y3(d)&&(this.S.B=d);this.B=f&&f.p6||!1;this.Y=f&&f.lvl||!1;(f=f&&f.hA)&&!g.y3(f)&&(this.S.hP=f,g.lt(this.A,f)&&(d=this.A, f in d&&delete d[f]));this.V=new Nq(this)},JgV=function(d){ZC.call(this); d.__headers__&&(this.headers=d.__headers__,this.statusCode=d.__status__,delete d.__headers__,delete d.__status__);const f=d.__sm__;f?this.data=(this.S=g.RU(f))?g.vd(f,this.S):f:this.data=d},S9E=function(d){Vg.call(this); this.status=1;this.errorCode=d},Nq=function(d){this.S=d},WQ=function(d,f){this.j=d; this.S=f},cQ=function(d,f){if(typeof d!=="function")throw Error("Fn must not be null and must be a function"); return g.pS.setTimeout(function(){d()},f)},DR=function(){sE.dispatchEvent(new jwX)},EE=function(d,f,m,y){this.S=d; this.j=f;this.B=m;this.C=y||1;this.A=45E3;this.V=new g.mG(this);this.Y=new g.Ut;this.Y.setInterval(250)},zng=function(d,f,m){d.Jj=1; d.JT=Cj(f.clone());d.Wf=m;d.hP=!0;vZy(d,null)},pq=function(d,f,m,y,C){d.Jj=1; d.JT=Cj(f.clone());d.Wf=null;d.hP=m;C&&(d.R5=!1);vZy(d,y)},vZy=function(d,f){d.B2=Date.now(); $s(d);d.Q5=d.JT.clone();BC(d.Q5,"t",d.C);d.Zh=0;d.Mk=d.S.z8(d.S.W2()?f:null);d.RV>0&&(d.Mb=new g.$X((0,g.g5)(d.Jn,d,d.Mk),d.RV));d.V.listen(d.Mk,"readystatechange",d.Ps);f=d.Bf?g.TE(d.Bf):{};d.Wf?(d.CX="POST",f["Content-Type"]="application/x-www-form-urlencoded",d.Mk.send(d.Q5,d.CX,d.Wf,f)):(d.CX="GET",d.R5&&!g.Ga&&(f.Connection="close"),d.Mk.send(d.Q5,d.CX,null,f));d.S.pP(1)},q9Z=function(d,f){var m=d.Zh,y=f.indexOf("\n",m); if(y==-1)return A5;m=Number(f.substring(m,y));if(isNaN(m))return Tzx;y+=1;if(y+m>f.length)return A5;f=f.slice(y,y+m);d.Zh=y+m;return f},$s=function(d){d.G8=Date.now()+d.A; b7N(d,d.A)},b7N=function(d,f){if(d.NZ!=null)throw Error("WatchDog timer not null"); d.NZ=cQ((0,g.g5)(d.mG,d),f)},tvf=function(d){d.NZ&&(g.pS.clearTimeout(d.NZ),d.NZ=null)},ks=function(d){d.S.i5()||d.CV||d.S.kK(d)},Q_=function(d){tvf(d); g.zg(d.Mb);d.Mb=null;d.Y.stop();d.V.removeAll();if(d.Mk){const f=d.Mk;d.Mk=null;f.abort();f.dispose()}d.vS&&(d.vS=null)},H7X=function(d,f){try{d.S.Cb(d,f),d.S.pP(4)}catch(m){}},Y9U=function(d,f,m,y,C){if(y==0)m(!1); else{var B=C||0;y--;wAN(d,f,function(e){e?m(!0):g.pS.setTimeout(function(){Y9U(d,f,m,y,B)},B)})}},wAN=function(d,f,m){const y=new Image; y.onload=function(){try{OE(y),m(!0)}catch(C){}}; y.onerror=function(){try{OE(y),m(!1)}catch(C){}}; y.onabort=function(){try{OE(y),m(!1)}catch(C){}}; y.ontimeout=function(){try{OE(y),m(!1)}catch(C){}}; g.pS.setTimeout(function(){if(y.ontimeout)y.ontimeout()},f); y.src=d},OE=function(d){d.onload=null; d.onerror=null;d.onabort=null;d.ontimeout=null},UId=function(d){this.S=d; this.A=new BQ},G$X=function(d){const f=o1(d.S,d.KV,"/mail/images/cleardot.gif"); Cj(f);Y9U(f.toString(),5E3,(0,g.g5)(d.eB,d),3,2E3);d.pP(1)},h5=function(d){var f=d.S.C; f!=null?(DR(),f?(DR(),a1(d.S,d,!1)):(DR(),a1(d.S,d,!0))):(d.XJ=new EE(d),d.XJ.Bf=d.Ox,f=d.S,f=o1(f,f.W2()?d.BC:null,d.HB),DR(),BC(f,"TYPE","xmlhttp"),pq(d.XJ,f,!1,d.BC,!1))},Fx=function(d,f,m){this.S=1; this.A=[];this.V=[];this.Y=new BQ;this.K=d||null;this.C=f!=null?f:null;this.G=m||!1},dKE=function(d,f){this.S=d; this.map=f;this.context=null},fBx=function(d,f,m,y){g.HA.call(this,"timingevent",d); this.size=f;this.rtt=m;this.retries=y},mKy=function(d){g.HA.call(this,"serverreachability",d)},yaX=function(d){d.EW(1,0); d.WC=o1(d,null,d.Ls);rI(d)},C$V=function(d){d.Q_&&(d.Q_.abort(),d.Q_=null); d.cM&&(d.cM.cancel(),d.cM=null);d.gZ&&(g.pS.clearTimeout(d.gZ),d.gZ=null);gI(d);d.xN&&(d.xN.cancel(),d.xN=null);d.V_&&(g.pS.clearTimeout(d.V_),d.V_=null)},I1=function(d,f){if(d.S==0)throw Error("Invalid operation: sending map when state is closed"); d.A.push(new dKE(d.Ng++,f));d.S!=2&&d.S!=3||rI(d)},BRN=function(d){let f=0; d.cM&&f++;d.xN&&f++;return f},rI=function(d){d.xN||d.V_||(d.V_=cQ((0,g.g5)(d.y0,d),0),d.Xp=0)},MaV=function(d,f){if(d.S==1){if(!f){d.yg=Math.floor(Math.random()*1E5); f=d.yg++;const m=new EE(d,"",f);m.Bf=d.PF;const y=uS(d),C=d.WC.clone();g.bG(C,"RID",f);g.bG(C,"CVER","1");Xx(d,C);zng(m,C,y);d.xN=m;d.S=2}}else d.S==3&&(f?eWV(d,f):d.A.length==0||d.xN||eWV(d))},eWV=function(d,f){if(f)if(d.sK>6){d.A=d.V.concat(d.A); d.V.length=0;var m=d.yg-1;f=uS(d)}else m=f.B,f=f.Wf;else m=d.yg++,f=uS(d);const y=d.WC.clone();g.bG(y,"SID",d.j);g.bG(y,"RID",m);g.bG(y,"AID",d.Sz);Xx(d,y);m=new EE(d,d.j,m,d.Xp+1);m.Bf=d.PF;m.setTimeout(1E4+Math.round(1E4*Math.random()));d.xN=m;zng(m,y,f)},Xx=function(d,f){d.Um&&(d=d.Um.wR())&&g.rx(d,function(m,y){g.bG(f,y,m)})},uS=function(d){const f=Math.min(d.A.length,1E3),m=["count="+f]; let y;d.sK>6&&f>0?(y=d.A[0].S,m.push("ofs="+y)):y=0;for(let C=0;C=3)return!1; d.B++;d.gZ=cQ((0,g.g5)(d.W1,d),NRZ(d,d.K8));d.K8++;return!0},a1=function(d,f,m){d.VN=d.C==null?m:!d.C; d.NG=f.tF;d.G||yaX(d)},gI=function(d){d.yP!=null&&(g.pS.clearTimeout(d.yP),d.yP=null)},NRZ=function(d,f){let m=5E3+Math.floor(Math.random()*1E4); d.isActive()||(m*=2);return m*f},nq=function(d,f){if(f==2||f==9){var m=null; d.Um&&(m=null);var y=(0,g.g5)(d.Ir,d);m||(m=new g.LR("//www.google.com/images/cleardot.gif"),Cj(m));wAN(m.toString(),1E4,y)}else DR();i6P(d,f)},i6P=function(d,f){d.S=0; d.Um&&d.Um.v1(f);WmU(d);C$V(d)},WmU=function(d){d.S=0; d.NG=-1;if(d.Um)if(d.V.length==0&&d.A.length==0)d.Um.Ux();else{const f=g.NN(d.V),m=g.NN(d.A);d.V.length=0;d.A.length=0;d.Um.Ux(f,m)}},o1=function(d,f,m){let y=g.t2(m); if(y.S!="")f&&g.SE(y,f+"."+y.S),g.jE(y,y.V);else{const C=window.location;y=Ia_(C.protocol,f?f+"."+C.hostname:C.hostname,+C.port,m)}d.sO&&g.rx(d.sO,function(C,B){g.bG(y,B,C)}); g.bG(y,"VER",d.sK);Xx(d,y);return y},cag=function(){},seZ=function(){this.S=[]; this.A=[]},DKX=function(d,f){this.action=d; this.params=f||{}},ZR=function(d,f){g.qj.call(this); this.S=new g.vg(this.ED,0,this);g.I(this,this.S);this.Kl=5E3;this.retryCount=this.hg=0;if(typeof d==="function")f&&(d=(0,g.g5)(d,f));else if(d&&typeof d.handleEvent==="function")d=(0,g.g5)(d.handleEvent,d);else throw Error("Invalid listener argument");this.A=d},V_=function(d,f,m=!1,y=()=>"",C=!1,B=!1,e=!1,M=()=>g.u$({}),K=!1,N,W){this.tP=d; this.AP=f;this.B=new g.Ob;this.C=W;this.A=(this.V=!!N)?N(()=>{this.T5()}):new ZR(this.T5,this); this.S=null;this.K=!1;this.X=null;this.hP="";this.V2=this.rD=0;this.j=[];this.mS=m;this.pC=y;this.G=B;this.qp=M;this.KC=e;this.e1=null;this.Y=g.u$();this.Np=C;this.Ul=K;this.Br=new E7U;this.gD=new p_x;this.GL=new $K_;this.nC=new Aa_;this.CC=new kJN;this.A7=new QeN;this.h7=new O6t},o7P=function(d,f,m,y,C){lS(d); if(d.S){const B=g.P("ID_TOKEN"),e=d.S.PF||{};B?e["x-youtube-identity-token"]=B:delete e["x-youtube-identity-token"];d.S.PF=e}y?(y.getState()!=3&&BRN(y)==0||y.getState(),d.S.connect(f,m,d.AP,y.j,y.Sz)):C?d.S.connect(f,m,d.AP,C.sessionId,C.arrayId):d.S.connect(f,m,d.AP);d.V&&!d.A.isActive()&&d.A.start();d.C&&d.C.Cke()},hWE=function(d,f){return d.Ul?!Object.values(aBU).includes(f):!1},FmU=async function(d){try{await xs(d)}finally{var f=d.j; d.j=[];var m=f;f=f.length;for(let y=0;y{if(d.S){let m=d.S.PF||{}; f&&Object.keys(f).length>0?m={...m,...f}:delete m.Authorization;d.S.PF=m}}).Xe(()=>{}),()=>{d.e1=null})},Lq=function(d){this.scheme="https"; this.port=this.domain="";this.S="/api/lounge";this.A=!0;d=d||document.location.href;const f=Number(g.tN(d)[4]||null)||"";f&&(this.port=":"+f);this.domain=g.wG(d)||"";d=g.Ky();d.search("MSIE")>=0&&(d=d.match(/MSIE ([\d.]+)/)[1],g.M_(d,"10.0")<0&&(this.A=!1))},J5=function(d,f){let m=d.S; d.A&&(m=d.scheme+"://"+d.domain+d.port+d.S);return g.Mj(m+f,{})},g7t=function(d){g.C6(d.channel,"m",()=>{d.C=3; d.V.reset();d.G=null;d.B=0;for(const f of d.X)d.channel&&d.channel.send(f);d.X=[];d.publish("webChannelOpened");d.pC.S("WEB_CHANNEL")}); g.C6(d.channel,"n",()=>{d.C=0;d.V.isActive()||d.publish("webChannelClosed");const f=d.channel?.j().V();f&&(d.X=[...f]);d.V2.S("WEB_CHANNEL")}); g.C6(d.channel,"p",f=>{const m=f.data;m[0]==="gracefulReconnect"?(d.V.start(),d.channel&&d.channel.close()):d.publish("webChannelMessage",new DKX(m[0],m[1]));d.IQ=f.statusCode;d.e1.S("WEB_CHANNEL")}); g.C6(d.channel,"o",()=>{d.IQ===401||d.V.start();d.publish("webChannelError");d.hP.S("WEB_CHANNEL","")})},Se=function(d){const f=d.AP(); f?d.j["x-youtube-lounge-xsrf-token"]=f:delete d.j["x-youtube-lounge-xsrf-token"]},RWx=function(d,f,m=()=>"",y,C){const B=()=>new V_(J5(d,"/bc"),f,!1,m,y); return g.n4("enable_mdx_web_channel_desktop")?new IBN(()=>new urX(J5(d,"/wc"),f,m)):new X_U(B,C)},lBx=function(){var d=n7U; Z6X();je.push(d);Vat()},vQ=function(d,f){Z6X(); const m=xKZ(d,String(f));je.length==0?P$U(m):(Vat(),g.vT(je,function(y){y(m)}))},zO=function(d){vQ("CP",d)},Z6X=function(){je||(je=g.AV("yt.mdx.remote.debug.handlers_")||[],g.$K("yt.mdx.remote.debug.handlers_",je))},P$U=function(d){const f=(TO+1)%50; TO=f;qq[f]=d;bS||(bS=f==49)},Vat=function(){var d=je; if(qq[0]){var f=bS?TO:-1;do{f=(f+1)%50;const m=qq[f];g.vT(d,function(y){y(m)})}while(f!=TO); qq=Array(50);TO=-1;bS=!1}},xKZ=function(d,f){let m=(Date.now()-Lmy)/1E3; m.toFixed&&(m=m.toFixed(3));const y=[];y.push("[",m+"s","] ");y.push("[","yt.mdx.remote","] ");y.push(d+": "+f,"\n");return y.join("")},t5=function(d){g.ym.call(this); this.C=d;this.screens=[]},Jaf=function(d,f){const m=d.get(f.uuid)||d.get(f.id); if(m)return d=m.name,m.id=f.id||m.id,m.name=f.name,m.token=f.token,m.uuid=f.uuid||m.uuid,m.name!=d;d.screens.push(f);return!0},Sty=function(d,f){let m=d.screens.length!=f.length; d.screens=g.zP(d.screens,function(C){return!!$P(f,C)}); const y=f.length;for(let C=0;C0&&d.jf.idType!="shortLived"); g.KP("yt-remote-automatic-screen-cache",g.TP(d,xxX))},BG=function(d){d.Y=g.Nb("yt-remote-device-id-map")||{}},ek=function(d,f,m){g.ym.call(this); this.hP=m;this.j=d;this.A=f;this.S=null},Md=function(d,f){d.S=f; d.publish("sessionScreen",d.S)},dJx=function(d,f){d.S&&(d.S.token=f,CN(d.j,d.S)); d.publish("sessionScreen",d.S)},KN=function(d,f){vQ(d.hP,f)},mJE=function(d,f){g.ud(d.rD); d.rD=0;f?d.config_.enableCastLoungeToken&&f.loungeToken?f.deviceId?d.S&&d.S.uuid==f.deviceId||(f.loungeTokenRefreshIntervalMs?f6P(d,{name:d.A.friendlyName,screenId:f.screenId,loungeToken:f.loungeToken,dialId:f.deviceId,screenIdType:"shortLived"},f.loungeTokenRefreshIntervalMs):(g.yi(Error(`No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: ${JSON.stringify(f)}.`)),Nd(d,f.screenId))):(g.yi(Error(`No device id presents in mdxSessionStatusData: ${JSON.stringify(f)}.`)),Nd(d,f.screenId)): Nd(d,f.screenId):d.Hb(Error("Waiting for session status timed out."))},yLZ=function(d){g.ud(d.K); d.K=0;g.ud(d.B);d.B=0;g.ud(d.rD);d.rD=0;g.ud(d.Y);d.Y=0;g.ud(d.G);d.G=0},CDx=function(d,f){d.info("sendYoutubeMessage_: "+f+" "+g.D6()); const m={};m.type=f;d.V?d.V.sendMessage("urn:x-cast:com.google.youtube.mdx",m,()=>{},(0,g.g5)(function(){KN(this,"Failed to send message: "+f+".")},d)):KN(d,"Sending yt message without session: "+g.D6(m))},eUx=function(d){CDx(d,"getLoungeToken"); g.ud(d.Y);d.Y=g.gp(()=>{BtN(d,null)},3E4)},i7=function(d,f){g.ud(d.G); d.G=0;f==0?eUx(d):d.G=g.gp(()=>{eUx(d)},f)},BtN=function(d,f){g.ud(d.Y); d.Y=0;let m=null;f?f.loungeToken?d.S?.token==f.loungeToken&&(m="staleLoungeToken"):m="missingLoungeToken":m="noLoungeTokenResponse";m?(d.info("Did not receive a new lounge token in onLoungeToken_ with "+`data: ${JSON.stringify(f)}, error: ${m}`),i7(d,3E4)):(dJx(d,f.loungeToken),i7(d,f.loungeTokenRefreshIntervalMs))},Nd=function(d,f){f?(d.info("onConnectedScreenId_: Received screenId: "+f),d.S&&d.S.id==f||d.e1(f,m=>{Md(d,m)},()=>d.Hb(),5)):d.Hb(Error("Waiting for session status timed out."))},MYy= function(d,f,m,y){g.ud(d.B); d.B=0;w_y(d.j,f,C=>{C||y<0?m(C):d.B=g.gp(()=>{MYy(d,f,m,y-1)},300)})},f6P=function(d,f,m){d.info(`onConnectedScreenData_: Received screenData: ${JSON.stringify(f)}`); const y=new cC(f);MYy(d,y,C=>{C?(CN(d.j,y),Md(d,y),i7(d,m)):(g.yi(Error(`CastSession, RemoteScreen from screenData: ${JSON.stringify(f)} is not online.`)),d.Hb())},5)},WG=function(d){return new Promise(f=>{d.AP=pj(); if(d.pC){const m=new chrome.cast.DialLaunchResponse(!0,K__(d));f(m);Nty(d)}else d.X=()=>{g.ud(d.rD);d.X=()=>{}; d.rD=NaN;const m=new chrome.cast.DialLaunchResponse(!0,K__(d));f(m);Nty(d)},d.rD=g.gp(()=>{d.X()},100)})},idg=function(d){g.ud(d.B); d.B=0;g.ud(d.G);d.G=0;d.Y();d.Y=()=>{}; g.ud(d.rD)},cG=function(d){return!(!d.config_.enableDialLoungeToken||!d.V?.getDialAppInfo)},sy=function(d,f){d.info(`getDialAppInfoWithTimeout_ ${f}`); cG(d)&&(g.ud(d.G),d.G=0,f==0?W_U(d):d.G=g.gp(()=>{W_U(d)},f))},Nty=function(d){d.Y=d.j.Gj(d.AP,d.A.label,d.A.friendlyName,cG(d),(f,m)=>{d.Y=()=>{}; Md(d,f);f.idType=="shortLived"&&m>0&&sy(d,m)},f=>{d.Y=()=>{}; d.Hb(f)})},K__=function(d){var f={}; f.pairingCode=d.AP;f.theme=d.qp;Hat()&&(f.env_useStageMdx=1);return g.eS(f)},cLN=function(d,f){const m=d.K.receiver.label,y=d.A.friendlyName; return(new Promise(C=>{taU(d.j,m,f,y,B=>{B&&B.token&&Md(d,B);C(B)},B=>{KN(d,"Failed to get DIAL screen: "+B); C(null)})})).then(C=>C&&C.token?new chrome.cast.DialLaunchResponse(!1):WG(d))},DJV=function(d,f,m){d.info(`initOnConnectedScreenDataPromise_: Received screenData: ${JSON.stringify(f)}`); const y=new cC(f);return(new Promise(C=>{scX(d,y,B=>{B?(CN(d.j,y),Md(d,y),sy(d,m)):g.yi(Error(`DialSession, RemoteScreen from screenData: ${JSON.stringify(f)} is not online.`));C(B)},5)})).then(C=>C?new chrome.cast.DialLaunchResponse(!1):WG(d))},scX=function(d,f,m,y){g.ud(d.B); d.B=0;w_y(d.j,f,C=>{C||y<0?m(C):d.B=g.gp(()=>{scX(d,f,m,y-1)},300)})},W_U=function(d){cG(d)&&d.V.getDialAppInfo(f=>{d.info(`getDialAppInfo dialLaunchData: ${JSON.stringify(f)}`); f=f.extraData||{};let m=null;f.loungeToken?d.S?.token==f.loungeToken&&(m="staleLoungeToken"):m="missingLoungeToken";m?sy(d,3E4):(dJx(d,f.loungeToken),sy(d,f.loungeTokenRefreshIntervalMs))},f=>{d.info(`getDialAppInfo error: ${f}`); sy(d,3E4)})},n7U=function(d){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(d)},pWy=function(d){const f=d.A.Rj(); let m=d.S&&d.S.A;d=g.TP(f,function(y){m&&s5(y,m.label)&&(m=null);const C=y.uuid?y.uuid:y.id;let B=EDX(this,y);B?(B.label=C,B.friendlyName=y.name):(B=new chrome.cast.Receiver(C,y.name),B.receiverType=chrome.cast.ReceiverType.CUSTOM);return B},d); m&&(m.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(m=new chrome.cast.Receiver(m.label,m.friendlyName),m.receiverType=chrome.cast.ReceiverType.CUSTOM),d.push(m));return d},De=function(d){return d.G||!!d.V.length||!!d.S},Ey=function(d){vQ("Controller",d)},pN=function(d,f,m){f!=d.S&&(g.zg(d.S),(d.S=f)?(m?d.publish("yt-remote-cast2-receiver-resumed",f.A):d.publish("yt-remote-cast2-receiver-selected",f.A),f.subscribe("sessionScreen",(0,g.g5)(d.rD,d,f)),f.subscribe("sessionFailed",()=>$Jf(d,f)),f.S? d.publish("yt-remote-cast2-session-change",f.S):m&&d.S.C(null)):d.publish("yt-remote-cast2-session-change",null))},EDX=function(d,f){return f?g.Un(d.V,function(m){return s5(f,m.label)},d):null},$Jf=function(d,f){d.S==f&&d.publish("yt-remote-cast2-session-failed")},a6V=function(d,f,m,y){y.disableCastApi?$$("Cannot initialize because disabled by Mdx config."):ALU()?kIg(f,y)&&(AT(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?QcE(d,m):(window.__onGCastApiAvailable=function(C,B){C?QcE(d,m):(k$("Failed to load cast API: "+ B),Qt(!1),AT(!1),g.i6("yt-remote-cast-available"),g.i6("yt-remote-cast-receiver"),OdZ(),m(!1))},y.loadCastApiSetupScript?g.BV(oDE):window.navigator.userAgent.indexOf("Android")>=0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?r7()>=60&&mIE():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?Iv():r7()>=89?CMt():(uC(),g7(ygV.map(Gud))))):$$("Cannot initialize because not running Chrome")},OdZ=function(){$$("dispose"); const d=Oy();d&&d.dispose();g.$K("yt.mdx.remote.cloudview.instance_",null);hUN(!1);g.yo(oO);oO.length=0},aO=function(){return!!g.Nb("yt-remote-cast-installed")},F_x=function(){const d=g.Nb("yt-remote-cast-receiver"); return d?d.friendlyName:null},rLV=function(){$$("clearCurrentReceiver"); g.i6("yt-remote-cast-receiver")},gDt=function(){return aO()?Oy()?Oy().getCastSession():(k$("getCastSelector: Cast is not initialized."),null):(k$("getCastSelector: Cast API is not installed!"),null)},F9=function(){aO()?Oy()?hT()?($$("Requesting cast selector."),Oy().requestSession()):($$("Wait for cast API to be ready to request the session."),oO.push(g.m9("yt-remote-cast2-api-ready",F9))):k$("requestCastSelector: Cast is not initialized."):k$("requestCastSelector: Cast API is not installed!")},rq= function(d,f){hT()?Oy().setConnectedScreenStatus(d,f):k$("setConnectedScreenStatus called before ready.")},ALU=function(){var d=g.Ky().search(/ (CrMo|Chrome|CriOS)\//)>=0; return g.$h||d},I6d=function(d,f){Oy().init(d,f)},kIg=function(d,f){let m=!1; Oy()||(d=new gq(d,f),d.subscribe("yt-remote-cast2-availability-change",function(y){g.KP("yt-remote-cast-available",y);Ft("yt-remote-cast2-availability-change",y)}),d.subscribe("yt-remote-cast2-receiver-selected",function(y){$$("onReceiverSelected: "+y.friendlyName); g.KP("yt-remote-cast-receiver",y);Ft("yt-remote-cast2-receiver-selected",y)}),d.subscribe("yt-remote-cast2-receiver-resumed",function(y){$$("onReceiverResumed: "+y.friendlyName); g.KP("yt-remote-cast-receiver",y);Ft("yt-remote-cast2-receiver-resumed",y)}),d.subscribe("yt-remote-cast2-session-change",function(y){$$("onSessionChange: "+DC(y)); y||g.i6("yt-remote-cast-receiver");Ft("yt-remote-cast2-session-change",y)}),g.$K("yt.mdx.remote.cloudview.instance_",d),m=!0); $$("cloudview.createSingleton_: "+m);return m},Oy=function(){return g.AV("yt.mdx.remote.cloudview.instance_")},QcE=function(d,f){Qt(!0); AT(!1);I6d(d,function(m){m?(hUN(!0),g.CF("yt-remote-cast2-api-ready")):(k$("Failed to initialize cast API."),Qt(!1),g.i6("yt-remote-cast-available"),g.i6("yt-remote-cast-receiver"),OdZ());f(m)})},$$=function(d){vQ("cloudview",d)},k$=function(d){vQ("cloudview",d)},Qt=function(d){$$("setCastInstalled_ "+d); g.KP("yt-remote-cast-installed",d)},hT=function(){return!!g.AV("yt.mdx.remote.cloudview.apiReady_")},hUN=function(d){$$("setApiReady_ "+d); g.$K("yt.mdx.remote.cloudview.apiReady_",d)},AT=function(d){g.$K("yt.mdx.remote.cloudview.initializing_",d)},IO=function(d){this.index=-1; this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.Y=this.C=0;this.trackData=null;this.hasNext=this.hasPrevious=!1;this.loadedTime=this.V=this.B=this.A=0;this.S=NaN;this.j=!1;this.reset(d)},u7=function(d){d.audioTrackId=null; d.trackData=null;d.playerState=-1;d.hasPrevious=!1;d.hasNext=!1;d.C=0;d.Y=g.uc();d.A=0;d.B=0;d.V=0;d.loadedTime=0;d.S=NaN;d.j=!1},X9=function(d){return d.isPlaying()?(g.uc()-d.Y)/1E3:0},RO=function(d,f){d.C=f; d.Y=g.uc()},nN=function(d){switch(d.playerState){case 1:case 1081:return(g.uc()-d.Y)/1E3+d.C; case -1E3:return 0}return d.C},uWx=function(d){return d.j?d.B+X9(d):d.B},Ze=function(d,f,m){const y=d.videoId; d.videoId=f;d.index=m;f!=y&&u7(d)},Vt=function(d){const f={}; f.index=d.index;f.listId=d.listId;f.videoId=d.videoId;f.playerState=d.playerState;f.volume=d.volume;f.muted=d.muted;f.audioTrackId=d.audioTrackId;f.trackData=g.qN(d.trackData);f.hasPrevious=d.hasPrevious;f.hasNext=d.hasNext;f.playerTime=d.C;f.playerTimeAt=d.Y;f.seekableStart=d.A;f.seekableEnd=d.B;f.duration=d.V;f.loadedTime=d.loadedTime;f.liveIngestionTime=d.S;return f},XWX=function(d){g.vT("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "), function(f){this.B.push(this.j.subscribe(f,g.Ig(this.tP,f),this))},d)},l7=function(d,f){d.A&&(d.A.removeUpdateListener(d.X),d.A.removeMediaListener(d.K),d.C(null)); d.A=f;d.A&&(zO("Setting cast session: "+d.A.sessionId),d.A.addUpdateListener(d.X),d.A.addMediaListener(d.K),d.A.media.length&&d.C(d.A.media[0]))},x$=function(d){return new IO(d.j.getPlayerContextData())},PG=function(d){return d.getState()==1},JT=function(d,f,m){return(0,g.g5)(function(y){this.AO("Failed to "+f+" with cast v2 channel. Error code: "+y.code); y.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.AO("Retrying "+f+" using MDx browser channel."),LN(this,f,m))},d)},LN=function(d,f,m){d.j.sendMessage(f,m)},jk=function(d,f,m){const y=x$(d); RO(y,m);y.playerState!=-1E3&&(y.playerState=f);Sk(d,y)},vG=function(d,f){var m=d.Y; m.S.length+m.A.length<50&&d.Y.enqueue(f)},Sk=function(d,f){RUf(d); d.j.setPlayerContextData(Vt(f));XWX(d)},RUf=function(d){g.vT(d.B,function(f){this.j.unsubscribeByKey(f)},d); d.B.length=0},nDX=function(d){const f=d.S.media,m=d.S.customData; if(f&&m){var y=x$(d);f.contentId!=y.videoId&&zO("Cast changing video to: "+f.contentId);y.videoId=f.contentId;y.playerState=m.playerState;RO(y,d.S.getEstimatedTime());Sk(d,y)}else zO("No cast media video. Ignoring state update.")},Zdx=function(d){z8("Channel opened"); d.e1&&(d.e1=!1,T8(d),d.hP=g.gp(()=>{z8("Timing out waiting for a screen.");d.B(1)},15E3))},qAg=function(d,f){f=f.message; f.params?z8("Received: action="+f.action+", params="+g.D6(f.params)):z8("Received: action="+f.action+" {}");switch(f.action){case "loungeStatus":f=MM(f.params.devices);d.V=g.TP(f,function(y){return new WC(y)}); f=!!g.Un(d.V,function(y){return y.type=="LOUNGE_SCREEN"}); VYt(d,f);f=d.CC("mlm");d.publish("multiStateLoopEnabled",f);break;case "loungeScreenDisconnected":g.MN(d.V,function(y){return y.type=="LOUNGE_SCREEN"}); VYt(d,!1);break;case "remoteConnected":let m=new WC(MM(f.params.device));g.Un(d.V,function(y){return y.equals(m)})||ruN(d.V,m); break;case "remoteDisconnected":m=new WC(MM(f.params.device));g.MN(d.V,function(y){return y.equals(m)}); break;case "gracefulDisconnect":break;case "playlistModified":l6U(d,f,"QUEUE_MODIFIED");break;case "nowPlaying":xJE(d,f);break;case "onStateChange":PDN(d,f);break;case "onAdStateChange":L_N(d,f);break;case "onVolumeChanged":JLV(d,f);break;case "onSubtitlesTrackChanged":SAZ(d,f);break;case "nowAutoplaying":jcf(d,f);break;case "autoplayDismissed":d.publish("autoplayDismissed");break;case "autoplayUpNext":vDZ(d,f);break;case "onAutoplayModeChanged":zUP(d,f);break;case "onHasPreviousNextChanged":Ttf(d, f);break;case "requestAssistedSignIn":d.publish("assistedSignInRequested",f.params.authCode);break;case "onLoopModeChanged":d.publish("loopModeChange",f.params.loopMode);break;default:z8("Unrecognized action: "+f.action)}},z8=function(d){vQ("conn",d)},bdX=function(d){d.C=g.gp(()=>{z8("Connecting timeout"); d.B(1)},2E4)},qd=function(d,f){d.publish("proxyStateChange",f)},b7=function(d){g.ud(d.C); d.C=NaN},tT=function(d){g.ud(d.V2); d.V2=NaN},T8=function(d){g.ud(d.hP); d.hP=NaN},tYf=function(d){return g.Un(d.V,function(f){return f.type=="LOUNGE_SCREEN"})},HG=function(d,f,m){m?z8("Sending: action="+f+", params="+g.D6(m)):z8("Sending: action="+f); d.A.sendMessage(f,m)},Hdt=function(d){tT(d); d.V2=g.gp(()=>{HG(d,"getNowPlaying")},2E4)},wWX=function(d){g.ud(d.X); d.X=g.gp(()=>{d.B(1)},864E5)},VYt=function(d,f){var m=null; if(f){const y=tYf(d);y&&(m={clientName:y.clientName,deviceMake:y.brand,deviceModel:y.model,osVersion:y.osVersion})}g.$K("yt.mdx.remote.remoteClient_",m);f&&(b7(d),T8(d));m=d.A.IY()&&isNaN(d.C);f==m?f&&(qd(d,1),HG(d,"getSubtitlesTrack")):f?(d.gD()&&d.S.reset(),qd(d,1),HG(d,"getNowPlaying"),wWX(d)):d.B(1)},SAZ=function(d,f){const m=f.params.videoId; delete f.params.videoId;m==d.S.videoId&&(g.Sx(f.params)?d.S.trackData=null:d.S.trackData=f.params,d.publish("remotePlayerChange"))},l6U=function(d,f,m){const y=f.params.videoId||f.params.video_id,C=parseInt(f.params.currentIndex,10); d.S.listId=f.params.listId||d.S.listId;Ze(d.S,y,C);d.publish("remoteQueueChange",m)},PDN=function(d,f){var m=parseInt(f.params.currentTime||f.params.current_time,10); RO(d.S,isNaN(m)?0:m);m=parseInt(f.params.state,10);m=isNaN(m)?-1:m;m==-1&&d.S.playerState==-1E3&&(m=-1E3);d.S.playerState=m;m=Number(f.params.loadedTime);d.S.loadedTime=isNaN(m)?0:m;d.S.wy(Number(f.params.duration));m=d.S;var y=Number(f.params.liveIngestionTime);m.S=y;m.j=isNaN(y)?!1:!0;m=d.S;y=Number(f.params.seekableStartTime);f=Number(f.params.seekableEndTime);m.A=isNaN(y)?0:y;m.B=isNaN(f)?0:f;d.S.playerState==1?Hdt(d):tT(d);d.publish("remotePlayerChange")},xJE=function(d,f){f.params=f.params|| {}; l6U(d,f,"NOW_PLAYING_MAY_CHANGE");PDN(d,f);d.publish("autoplayDismissed")},L_N=function(d,f){if(d.S.playerState!=-1E3){var m=1085; switch(parseInt(f.params.adState,10)){case 1:m=1081;break;case 2:m=1084;break;case 0:m=1083}d.S.playerState=m;f=parseInt(f.params.currentTime,10);RO(d.S,isNaN(f)?0:f);d.publish("remotePlayerChange")}},JLV=function(d,f){const m=f.params.muted=="true"; d.S.volume=parseInt(f.params.volume,10);d.S.muted=m;d.publish("remotePlayerChange")},jcf=function(d,f){d.G=f.params.videoId; d.publish("nowAutoplaying",parseInt(f.params.timeout,10))},vDZ=function(d,f){d.G=f.params.videoId||null; d.publish("autoplayUpNext",d.G)},zUP=function(d,f){d.Y=f.params.autoplayMode; d.publish("autoplayModeChange",d.Y);d.Y=="DISABLED"&&d.publish("autoplayDismissed")},Ttf=function(d,f){const m=f.params.hasNext=="true"; d.S.hasPrevious=f.params.hasPrevious=="true";d.S.hasNext=m;d.publish("previousNextChange")},d0E=function(d,f){tqg(); if(!hB||!hB.get("yt-remote-disable-remote-module-for-dev")){f=g.P("MDX_CONFIG")||f;STx();ov();wq||(wq=new Lq(f?f.loungeApiHost:void 0),Hat()&&(wq.S="/api/loungedev"));Y$||(Y$=g.AV("yt.mdx.remote.deferredProxies_")||[],g.$K("yt.mdx.remote.deferredProxies_",Y$));YAZ();var m=Uy();if(!m){const C=new mu(wq,f?f.disableAutomaticScreenCache||!1:!1);g.$K("yt.mdx.remote.screenService_",C);m=Uy();var y={};f&&(y={appId:f.appId,disableDial:f.disableDial,theme:f.theme,loadCastApiSetupScript:f.loadCastApiSetupScript, disableCastApi:f.disableCastApi,enableDialLoungeToken:f.enableDialLoungeToken,enableCastLoungeToken:f.enableCastLoungeToken,forceMirroring:f.forceMirroring});g.$K("yt.mdx.remote.enableConnectWithInitialState_",f?f.enableConnectWithInitialState||!1:!1);a6V(d,C,function(B){B?G8()&&rq(G8(),"YouTube TV"):C.subscribe("onlineScreenChange",function(){Ft("yt-remote-receiver-availability-change")})},y)}f&&!g.AV("yt.mdx.remote.initialized_")&&(g.$K("yt.mdx.remote.initialized_",!0),dZ("Initializing: "+g.D6(f)), fX.push(g.m9("yt-remote-cast2-api-ready",function(){Ft("yt-remote-api-ready")})),fX.push(g.m9("yt-remote-cast2-availability-change",function(){Ft("yt-remote-receiver-availability-change")})),fX.push(g.m9("yt-remote-cast2-receiver-selected",function(){ma(null); Ft("yt-remote-auto-connect","cast-selector-receiver")})),fX.push(g.m9("yt-remote-cast2-receiver-resumed",function(){Ft("yt-remote-receiver-resumed","cast-selector-receiver")})),fX.push(g.m9("yt-remote-cast2-session-change",UJN)),fX.push(g.m9("yt-remote-connection-change",function(C){C?rq(G8(),"YouTube TV"):yS()||(rq(null,null),rLV())})),fX.push(g.m9("yt-remote-cast2-session-failed",()=>{Ft("yt-remote-connection-failed")})),d=CX(),f.isAuto&&(d.id+="#dial"),y=f.capabilities||[],y.length>0&&(d.capabilities= y),d.name=f.device,d.app=f.app,(f=f.theme)&&(d.theme=f),dZ(" -- with channel params: "+g.D6(d)),d?(g.KP("yt-remote-session-app",d.app),g.KP("yt-remote-session-name",d.name)):(g.i6("yt-remote-session-app"),g.i6("yt-remote-session-name")),g.$K("yt.mdx.remote.channelParams_",d),m.start(),G8()||GIU())}},fmt=function(){var d=Uy().A8.$_gos(); const f=Br();f&&eK()&&($P(d,f)||d.push(f));return Jut(d)},M$=function(){let d=m0y(); !d&&aO()&&F_x()&&(d={key:"cast-selector-receiver",name:F_x()});return d},m0y=function(){const d=fmt(); let f=Br();f||(f=yS());return g.Un(d,function(m){return f&&s5(f,m.key)?!0:!1})},Br=function(){const d=G8(); if(!d)return null;const f=Uy().xE();return AB(f,d)},UJN=function(d){dZ("remote.onCastSessionChange_: "+DC(d)); if(d){var f=Br();if(f&&f.id==d.id){if(rq(f.id,"YouTube TV"),d.idType=="shortLived"&&(d=d.token))KX&&(KX.token=d),(f=eK())&&f.RU(d)}else f&&N$(),iR(d,1)}else eK()&&N$()},N$=function(){hT()?Oy().stopSession():k$("stopSession called before API ready."); const d=eK();d&&(d.disconnect(1),Wr(null))},cr=function(){const d=eK(); return!!d&&d.getProxyState()!=3},dZ=function(d){vQ("remote",d)},Uy=function(){if(!sP){const d=g.AV("yt.mdx.remote.screenService_"); sP=d?new y2E(d):null}return sP},G8=function(){return g.AV("yt.mdx.remote.currentScreenId_")},CGE=function(d){g.$K("yt.mdx.remote.currentScreenId_",d)},BHP=function(){return g.AV("yt.mdx.remote.connectData_")},ma=function(d){g.$K("yt.mdx.remote.connectData_",d)},eK=function(){return g.AV("yt.mdx.remote.connection_")},Wr=function(d){const f=eK(); ma(null);d||CGE("");g.$K("yt.mdx.remote.connection_",d);Y$&&(g.vT(Y$,function(m){m(d)}),Y$.length=0); f&&!d?Ft("yt-remote-connection-change",!1):!f&&d&&Ft("yt-remote-connection-change",!0)},yS=function(){const d=g.Wa(); if(!d)return null;var f=Uy();if(!f)return null;f=f.xE();return AB(f,d)},iR=function(d,f){G8(); Br()&&Br();if(Dy)KX=d;else{CGE(d.id);var m=g.AV("yt.mdx.remote.enableConnectWithInitialState_")||!1;d=new EP(d,m);d.connect(f,BHP());d.subscribe("beforeDisconnect",function(y){Ft("yt-remote-before-disconnect",y)}); d.subscribe("beforeDispose",function(){eK()&&(eK(),Wr(null))}); d.subscribe("browserChannelAuthError",()=>{const y=Br();y&&y.idType=="shortLived"&&(hT()?Oy().handleBrowserChannelAuthError():k$("refreshLoungeToken called before API ready."))}); Wr(d)}},GIU=function(){const d=yS(); d?(dZ("Resume connection to: "+DC(d)),iR(d,0)):(av(),rLV(),dZ("Skipping connecting because no session screen found."))},YAZ=function(){var d=CX(); if(g.Sx(d)){d=O5();var f=g.Nb("yt-remote-session-name")||"";const m=g.Nb("yt-remote-session-app")||"";d={device:"REMOTE_CONTROL",id:d,name:f,app:m,mdxVersion:3};d.authuser=String(g.P("SESSION_INDEX","0"));(f=g.P("DELEGATED_SESSION_ID"))&&(d.pageId=String(f));g.$K("yt.mdx.remote.channelParams_",d)}},CX=function(){return g.AV("yt.mdx.remote.channelParams_")||{}},ezV=function(d,f){if(pX(d)){d.Ft.unsubscribe("remotePlayerChange",d.Y,d); const m=Math.round(f.volume);f=!!f.muted;const y=x$(d.Ft);if(m!==y.volume||f!==y.muted)d.Ft.setVolume(m,f),d.X.start();d.Ft.subscribe("remotePlayerChange",d.Y,d)}},pX=function(d){return x$(d.Ft).videoId===$q(d).videoId},Ae=function(d,f){let m,y; var C=d.J.getPlaylist();C?.listId&&(m=C.index,y=C.listId.toString());C=$q(d);d.Ft.playVideo(C.videoId,f,m,y,C.playerParams,C.X,Fdd(C));d.uo(new g.E7(1))},kq=function(d,f){if(pX(d)&&!d.C){let m=null; f&&(m={style:d.J.getSubtitlesUserSettings()},Object.assign(m,f));d.Ft.G($q(d).videoId,m);d.j=x$(d.Ft).trackData}},MEV=function(d,f){if(f){const m=d.J.getOption("captions","tracklist",{eC:1}); m&&m.length?(d.J.setOption("captions","track",f),d.C=!1):(d.J.loadModule("captions"),d.C=!0)}else d.J.setOption("captions","track",{})},Kng=function(d){d.B9(0); d.A.stop();d.uo(new g.E7(64))},$q=function(d){return d.J.getVideoData({playerType:1})},NHU=function(d){const f=d.player.L(); return!f.Z("mdx_enable_privacy_disclosure_ui")||d.isLoggedIn()||d.f_||!d.JE?!1:g.nl(f)||g.rC(f)},iRd=function(d,f,m){d.Hx=m; d.player.publish("presentingplayerstatechange",new g.Ff(m,f))},QS=function(d,f,...m){d.loaded&&d.cq.T0(f,...m)},OP=function(d){d.vW&&(d.player.removeEventListener("presentingplayerstatechange",d.vW),d.vW=null)},o6=function(d,f){if(f.key!==d.Ce.key)if(f.key===d.s5.key)N$(); else if(NHU(d)&&WnV(d),d.Ce=f,!g.bY(d.player.L())){{const B=d.player.getPlaylistId();var m=d.player.getVideoData({playerType:1});const e=m.videoId;if(!B&&!e||(d.player.getAppState()===2||d.player.getAppState()===1)&&d.player.L().Z("should_clear_video_data_on_player_cued_unstarted"))m=null;else{var y=d.player.getPlaylist();if(y){var C=[];for(let M=0;M{!d.f_&&f.VT(8)&&(d.player.pauseVideo(), OP(d))},d.player.addEventListener("presentingplayerstatechange",d.vW)); d.JE&&d.JE.OM();eK()||(Dy=!0)}; g.DV.prototype.Xr=g.mE(46,function(){this.app.vM().Xr()}); g.Yw.prototype.Xr=g.mE(45,function(){this.yS=null}); g.DV.prototype.xY=g.mE(44,function(d){this.app.vM().xY(d)}); g.Yw.prototype.xY=g.mE(43,function(d){this.yS=d}); g.e3.prototype.ux=g.mE(1,function(){return g.HU(this,3)}); g.yw.prototype.ux=g.mE(0,function(){return g.HU(this,11)}); var E7U=class{constructor(){var d=g.w1();this.A=d;g.Cd(d,"/client_streamz/youtube/living_room/mdx/channel/opened",g.E9("channel_type"))}S(d){g.eY(this.A,"/client_streamz/youtube/living_room/mdx/channel/opened",d)}},p_x=class{constructor(){var d=g.w1();this.A=d;g.Cd(d,"/client_streamz/youtube/living_room/mdx/channel/closed",g.E9("channel_type"))}S(d){g.eY(this.A,"/client_streamz/youtube/living_room/mdx/channel/closed",d)}},Aa_=class{constructor(){var d=g.w1();this.A=d;g.Cd(d,"/client_streamz/youtube/living_room/mdx/channel/message_received", g.E9("channel_type"))}S(d){g.eY(this.A,"/client_streamz/youtube/living_room/mdx/channel/message_received",d)}},$K_=class{constructor(){var d=g.w1();this.A=d;g.Cd(d,"/client_streamz/youtube/living_room/mdx/channel/success")}S(){g.eY(this.A,"/client_streamz/youtube/living_room/mdx/channel/success")}},kJN=class{constructor(){var d=g.w1();this.A=d;g.Cd(d,"/client_streamz/youtube/living_room/mdx/channel/error",g.E9("channel_type"),g.E9("error_type"))}S(d,f){g.eY(this.A,"/client_streamz/youtube/living_room/mdx/channel/error", d,f)}},QeN=class{constructor(){var d=g.w1();this.A=d;g.Cd(d,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}S(){g.eY(this.A,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}},O6t=class{constructor(){var d=g.w1();this.A=d;g.Cd(d,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}S(){g.eY(this.A,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}};g.F=NM.prototype; g.F.DY=function(){iC(this);const d=[];for(let f=0;f2*this.size&&iC(this),!0):!1}; g.F.get=function(d,f){return Kj(this.A,d)?this.A[d]:f}; g.F.set=function(d,f){Kj(this.A,d)||(this.size+=1,this.S.push(d),this.o_++);this.A[d]=f}; g.F.forEach=function(d,f){const m=this.Yg();for(let y=0;y=y.S.length)return g.wv;const B=y.S[f++];return g.cn(d?B:y.A[B])}; return C}; var Vqy={pA:"atp",A7e:"ska",M1L:"que",aD:"mus",Foe:"sus",xD:"dsp",GLC:"seq",N2:"mic",I2:"dpa",lf:"mlm",o2:"dsdtr",ph:"ntb",LoS:"vsp",bS:"scn",JPC:"rpe",DH:"dcn",pN:"dcp",wS:"pas",Ts:"drq",QI:"opf",fN:"els",iS:"isg",cPL:"svq",VI:"mvp",jm:"ads",qBP:"stcp",mp2:"sads",x$:"dloc",Qs:"dcw",uU:"asw",hf:"apw",Y5:"wrc",FSs:"pcw",e6:"ipv",ID:"ndt",EU:"ctops",jx:"gsrm"},laU={HkP:"u",Gv:"cl",o9:"k",OG:"i",Vs:"cr",jt:"m",XG:"g",sR:"up"},aBU={T4:"nowPlaying",Bc:"onStateChange",Mi:"adPlaying",Ch:"onAdStateChange", oD:"nowPlayingShorts",Zd:"onShortsStateChange"};WC.prototype.equals=function(d){return d?this.id==d.id:!1}; var Qg="",hB=null,fN_=wzx("loadCastFramework")||wzx("loadCastApplicationFramework"),ygV=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.nS(Xt,g.qj);g.F=Xt.prototype;g.F.ze=function(d){this.j=arguments;this.S=!1;this.Lo?this.V=g.uc()+this.Kl:this.Lo=g.GJ(this.Y,this.Kl)}; g.F.stop=function(){this.Lo&&(g.pS.clearTimeout(this.Lo),this.Lo=null);this.V=null;this.S=!1;this.j=[]}; g.F.pause=function(){++this.A}; g.F.resume=function(){this.A&&(--this.A,!this.A&&this.S&&(this.S=!1,this.C.apply(null,this.j)))}; g.F.j1=function(){this.stop();Xt.cg.j1.call(this)}; g.F.OW=function(){this.Lo&&(g.pS.clearTimeout(this.Lo),this.Lo=null);this.V?(this.Lo=g.GJ(this.Y,this.V-g.uc()),this.V=null):this.A?this.S=!0:(this.S=!1,this.C.apply(null,this.j))};var nj=null;Rv.prototype.set=function(d){this.S=d}; Rv.prototype.reset=function(){this.set(g.uc())}; Rv.prototype.get=function(){return this.S};g.nS(enf,Bzf);var BQ=class{stringify(d){return g.pS.JSON.stringify(d,void 0)}parse(d){return g.pS.JSON.parse(d,void 0)}};g.nS(ZC,g.HA);g.nS(Vg,g.HA);var MvU=null;g.nS(KeU,g.HA);g.nS(Nzx,g.HA);g.nS(i7U,g.HA);JB.prototype.debug=function(){}; JB.prototype.info=function(){}; JB.prototype.warning=function(){};var pAg={},qM={};g.F=S4.prototype;g.F.setTimeout=function(d){this.Br=d}; g.F.Hs=function(d){d=d.target;const f=this.gD;f&&g.rt(d)==3?f.j():this.e0(d)}; g.F.e0=function(d){try{if(d==this.S)a:{const C=g.rt(this.S),B=this.S.A,e=this.S.getStatus();if(!(C<3)&&(C!=3||this.S&&(this.A.A||g.uD(this.S)||g.XW(this.S)))){this.e1||C!=4||B==7||(B==8||e<=0?xP(3):xP(2));bC(this);var f=this.S.getStatus();this.mS=f;var m=EZX(this);if(this.C=f==200){if(this.KC&&!this.tP){b:{if(this.S){const M=g.nd(this.S,"X-HTTP-Initial-Response");if(M&&!g.y3(M)){var y=M;break b}}y=null}if(d=y)this.tP=!0,mW(this,d);else{this.C=!1;this.Y=3;PC(12);z7(this);T7(this);break a}}if(this.hP){d= !0;let M;for(;!this.e1&&this.B0&&!this.Np&&(this.Np=!0,this.V.n2(this)):(z7(this),T7(this))}else mW(this,m);C==4&&z7(this);this.C&&!this.e1&&(C==4?k$E(this.V,this):(this.C=!1,vC(this)))}else g.Rc(this.S),f==400&&m.indexOf("Unknown SID")> 0?(this.Y=3,PC(12)):(this.Y=0,PC(13)),z7(this),T7(this)}}}catch(C){}finally{}}; g.F.cancel=function(){this.e1=!0;z7(this)}; g.F.kT=function(){this.rD=null;const d=Date.now();d-this.GL>=0?(this.qp!=2&&(xP(3),PC(17)),z7(this),this.Y=2,T7(this)):AgU(this,this.GL-d)}; g.F.getLastError=function(){return this.Y}; g.F.Nz=function(){return this.S};var c2x=class{constructor(d,f){this.S=d;this.map=f;this.context=null}};aNd.prototype.cancel=function(){this.V=y_(this);if(this.A)this.A.cancel(),this.A=null;else if(this.S&&this.S.size!==0){for(const d of this.S.values())d.cancel();this.S.clear()}};g.F=INU.prototype;g.F.DE=8;g.F.LR=1;g.F.connect=function(d,f,m,y){PC(0);this.vZ=d;this.e1=f||{};m&&y!==void 0&&(this.e1.OSID=m,this.e1.OAID=y);this.gD=this.MW;this.pC=QwN(this,null,this.vZ);fq(this)}; g.F.disconnect=function(){u5g(this);if(this.LR==3){var d=this.CC++,f=this.pC.clone();g.bG(f,"SID",this.j);g.bG(f,"RID",d);g.bG(f,"TYPE","terminate");Kq(this,f);d=new S4(this,this.j,d);d.qp=2;d.G=Cj(f.clone());f=!1;if(g.pS.navigator&&g.pS.navigator.sendBeacon)try{f=g.pS.navigator.sendBeacon(d.G.toString(),"")}catch{}!f&&g.pS.Image&&((new Image).src=d.G,f=!0);f||(d.S=swN(d.V,null),d.S.send(d.G));d.AP=Date.now();vC(d)}lNt(this)}; g.F.i5=function(){return this.LR==0}; g.F.getState=function(){return this.LR}; g.F.Tj=function(d){if(this.C)if(this.C=null,this.LR==1){if(!d){this.CC=Math.floor(Math.random()*1E5);d=this.CC++;const C=new S4(this,"",d);let B=this.K;this.KC&&(B?(B=g.TE(B),g.tf(B,this.KC)):B=this.KC);this.B!==null||this.GL||(C.pC=B,B=null);if(this.Ul)a:{var f=0;for(var m=0;m4096){f=m;break a}if(f===4096||m===this.V.length-1){f=m+1;break a}}f= this.ws}else f=this.ws;f=nZP(this,C,f);m=this.pC.clone();g.bG(m,"RID",d);g.bG(m,"CVER",22);this.hP&&g.bG(m,"X-HTTP-Session-Id",this.hP);Kq(this,m);B&&(this.GL?f="headers="+g.B0(g.dE(B))+"&"+f:this.B&&g.fk(m,this.B,B));dI(this.A,C);this.Px&&g.bG(m,"TYPE","init");this.Ul?(g.bG(m,"$req",f),g.bG(m,"SID","null"),C.KC=!0,j4(C,m,null)):j4(C,m,f);this.LR=2}}else this.LR==3&&(d?Z7x(this,d):this.V.length==0||hnx(this.A)||Z7x(this))}; g.F.x4=function(){this.G=null;Vvg(this);if(this.Z$&&!(this.Br||this.S==null||this.sB<=0)){var d=4*this.sB;this.V2=Lj((0,g.g5)(this.IW,this),d)}}; g.F.IW=function(){this.V2&&(this.V2=null,this.gD=!1,this.Br=!0,PC(10),w7(this),Vvg(this))}; g.F.n2=function(d){this.S==d&&this.Z$&&!this.Br&&(Mq(this),this.Br=!0,PC(11))}; g.F.L9=function(){this.rD!=null&&(this.rD=null,w7(this),YP(this),PC(19))}; g.F.Mt=function(d){d?PC(2):PC(1)}; g.F.isActive=function(){return!!this.Y&&this.Y.isActive(this)}; g.F=PMX.prototype;g.F.Q0=function(){}; g.F.MS=function(){}; g.F.Ij=function(){}; g.F.gR=function(){}; g.F.isActive=function(){return!0}; g.F.UW=function(){};g.nS(iS,g.p6);iS.prototype.open=function(){this.S.Y=this.V;this.B&&(this.S.tP=!0);this.S.connect(this.C,this.A||void 0)}; iS.prototype.close=function(){this.S.disconnect()}; iS.prototype.send=function(d){var f=this.S;if(typeof d==="string"){var m={};m.__data__=d;d=m}else this.Y&&(m={},m.__data__=g.D6(d),d=m);f.V.push(new c2x(f.qH++,d));f.LR==3&&fq(f)}; iS.prototype.j1=function(){this.S.Y=null;delete this.V;this.S.disconnect();delete this.S;iS.cg.j1.call(this)}; g.nS(JgV,ZC);g.nS(S9E,Vg);g.nS(Nq,PMX);Nq.prototype.Q0=function(){this.S.dispatchEvent("m")}; Nq.prototype.MS=function(d){this.S.dispatchEvent(new JgV(d))}; Nq.prototype.Ij=function(d){this.S.dispatchEvent(new S9E(d))}; Nq.prototype.gR=function(){this.S.dispatchEvent("n")}; iS.prototype.j=function(){return new WQ(this,this.S)}; WQ.prototype.A=function(){return U5(this.S.A)}; WQ.prototype.V=function(){return xId(this.S).map(d=>{var f=this.j;d=d.map;"__data__"in d?(d=d.__data__,f=f.Y?geP(d):d):f=d;return f})}; WQ.prototype.commit=function(d){this.S.mS=d};var sE=new g.p6,jwX=class extends g.HA{constructor(){super("statevent",sE)}};g.F=EE.prototype;g.F.Bf=null;g.F.l4=!1;g.F.NZ=null;g.F.G8=null;g.F.B2=null;g.F.Jj=null;g.F.JT=null;g.F.Q5=null;g.F.Wf=null;g.F.Mk=null;g.F.Zh=0;g.F.vS=null;g.F.CX=null;g.F.Ev=null;g.F.Zy=-1;g.F.R5=!0;g.F.CV=!1;g.F.RV=0;g.F.Mb=null;var Tzx={},A5={};g.F=EE.prototype;g.F.setTimeout=function(d){this.A=d}; g.F.Ps=function(d){d=d.target;const f=this.Mb;f&&g.rt(d)==3?f.j():this.Jn(d)}; g.F.Jn=function(d){try{if(d==this.Mk)a:{const f=g.rt(this.Mk),m=this.Mk.A,y=this.Mk.getStatus();if(g.Ga&&!g.o5("420+")){if(f<4)break a}else if(f<3||f==3&&!g.uD(this.Mk))break a;this.CV||f!=4||m==7||(m==8||y<=0?this.S.pP(3):this.S.pP(2));tvf(this);const C=this.Mk.getStatus();this.Zy=C;const B=g.uD(this.Mk);if(this.l4=C==200){f==4&&Q_(this);if(this.hP){for(d=!0;!this.CV&&this.Zh0?3:0,DR(),Q_(this),ks(this)}}catch(f){}finally{}}; g.F.cancel=function(){this.CV=!0;Q_(this)}; g.F.mG=function(){this.NZ=null;const d=Date.now();d-this.G8>=0?(this.Jj!=2&&this.S.pP(3),Q_(this),this.Ev=2,DR(),ks(this)):b7N(this,this.G8-d)}; g.F.getLastError=function(){return this.Ev};g.F=UId.prototype;g.F.Ox=null;g.F.XJ=null;g.F.rF=!1;g.F.HB=null;g.F.ma=null;g.F.tF=-1;g.F.BC=null;g.F.KV=null;g.F.connect=function(d){this.HB=d;d=o1(this.S,null,this.HB);DR();Date.now();const f=this.S.K;f!=null?(this.BC=f[0],(this.KV=f[1])?(this.ma=1,G$X(this)):(this.ma=2,h5(this))):(BC(d,"MODE","init"),this.XJ=new EE(this),this.XJ.Bf=this.Ox,pq(this.XJ,d,!1,null,!0),this.ma=0)}; g.F.eB=function(d){if(d)this.ma=2,h5(this);else{DR();var f=this.S;f.NG=f.Q_.tF;nq(f,9)}d&&this.pP(2)}; g.F.z8=function(d){return this.S.z8(d)}; g.F.abort=function(){this.XJ&&(this.XJ.cancel(),this.XJ=null);this.tF=-1}; g.F.i5=function(){return!1}; g.F.Cb=function(d,f){this.tF=d.Zy;if(this.ma==0)if(f){try{var m=this.A.parse(f)}catch(y){d=this.S;d.NG=this.tF;nq(d,2);return}this.BC=m[0];this.KV=m[1]}else d=this.S,d.NG=this.tF,nq(d,2);else this.ma==2&&(this.rF?(DR(),Date.now()):f=="11111"?(DR(),this.rF=!0,Date.now(),this.tF=200,this.XJ.cancel(),DR(),a1(this.S,this,!0)):(DR(),Date.now(),this.rF=!1))}; g.F.kK=function(){this.tF=this.XJ.Zy;if(this.XJ.l4)this.ma==0?this.KV?(this.ma=1,G$X(this)):(this.ma=2,h5(this)):this.ma==2&&(this.rF?(DR(),a1(this.S,this,!0)):(DR(),a1(this.S,this,!1)));else{this.ma==0?DR():this.ma==2&&DR();var d=this.S;this.XJ.getLastError();d.NG=this.tF;nq(d,2)}}; g.F.W2=function(){return this.S.W2()}; g.F.isActive=function(){return this.S.isActive()}; g.F.pP=function(d){this.S.pP(d)};g.F=Fx.prototype;g.F.PF=null;g.F.sO=null;g.F.xN=null;g.F.cM=null;g.F.Ls=null;g.F.WC=null;g.F.ZE=null;g.F.cB=null;g.F.yg=0;g.F.Ng=0;g.F.Um=null;g.F.V_=null;g.F.gZ=null;g.F.yP=null;g.F.Q_=null;g.F.VN=null;g.F.Sz=-1;g.F.B1=-1;g.F.NG=-1;g.F.Xp=0;g.F.K8=0;g.F.sK=8;var sWE={OK:0,sPs:2,zP:4,gS:5,kt1:6,STOP:7,eD:8,IG:9,Tv:10,gh:11,dJ:12};g.nS(fBx,g.HA);g.nS(mKy,g.HA);g.F=Fx.prototype; g.F.connect=function(d,f,m,y,C){DR();this.Ls=f;this.sO=m||{};y&&C!==void 0&&(this.sO.OSID=y,this.sO.OAID=C);this.G?(cQ((0,g.g5)(this.iF,this,d),100),yaX(this)):this.iF(d)}; g.F.disconnect=function(){C$V(this);if(this.S==3){var d=this.yg++;const f=this.WC.clone();g.bG(f,"SID",this.j);g.bG(f,"RID",d);g.bG(f,"TYPE","terminate");Xx(this,f);d=new EE(this,this.j,d);d.Jj=2;d.JT=Cj(f.clone());(new Image).src=d.JT.toString();d.B2=Date.now();$s(d)}WmU(this)}; g.F.iF=function(d){this.Q_=new UId(this);this.Q_.Ox=this.PF;this.Q_.A=this.Y;this.Q_.connect(d)}; g.F.i5=function(){return this.S==0}; g.F.getState=function(){return this.S}; g.F.y0=function(d){this.V_=null;MaV(this,d)}; g.F.W1=function(){this.gZ=null;this.cM=new EE(this,this.j,"rpc",this.B);this.cM.Bf=this.PF;this.cM.RV=0;var d=this.ZE.clone();g.bG(d,"RID","rpc");g.bG(d,"SID",this.j);g.bG(d,"CI",this.VN?"0":"1");g.bG(d,"AID",this.Sz);Xx(this,d);g.bG(d,"TYPE","xmlhttp");pq(this.cM,d,!0,this.cB,!1)}; g.F.Cb=function(d,f){if(this.S!=0&&(this.cM==d||this.xN==d))if(this.NG=d.Zy,this.xN==d&&this.S==3)if(this.sK>7){try{var m=this.Y.parse(f)}catch(y){m=null}if(Array.isArray(m)&&m.length==3)if(d=m,d[0]==0)a:{if(!this.gZ){if(this.cM)if(this.cM.B2+3E30)){if(y=f==1)this.xN||this.V_||this.S==1||this.Xp>=2?y=!1:(this.V_=cQ((0,g.g5)(this.y0,this,d),NRZ(this,this.Xp)),this.Xp++, y=!0);y=!(y||f==2&&R1(this))}if(y)switch(m){case 1:nq(this,5);break;case 4:nq(this,10);break;case 3:nq(this,6);break;case 7:nq(this,12);break;default:nq(this,2)}}}; g.F.EW=function(d){if(!g.fg(arguments,this.S))throw Error("Unexpected channel state: "+this.S);}; g.F.Ir=function(d){d?DR():(DR(),i6P(this,8))}; g.F.z8=function(d){if(d)throw Error("Can't create secondary domain capable XhrIo object.");d=new g.QF;d.B=!1;return d}; g.F.isActive=function(){return!!this.Um&&this.Um.isActive(this)}; g.F.pP=function(d){const f=sE;f.dispatchEvent(new mKy(f,d))}; g.F.W2=function(){return!1}; new enf;g.F=cag.prototype;g.F.fb=function(){}; g.F.iM=function(){}; g.F.bM=function(){}; g.F.v1=function(){}; g.F.Ux=function(){}; g.F.wR=function(){return{}}; g.F.isActive=function(){return!0};g.F=seZ.prototype;g.F.enqueue=function(d){this.A.push(d)}; g.F.isEmpty=function(){return this.S.length===0&&this.A.length===0}; g.F.clear=function(){this.S=[];this.A=[]}; g.F.contains=function(d){return g.fg(this.S,d)||g.fg(this.A,d)}; g.F.remove=function(d){{var f=this.S;const m=Array.prototype.lastIndexOf.call(f,d,f.length-1);m>=0?(g.Bd(f,m),f=!0):f=!1}return f||g.ex(this.A,d)}; g.F.DY=function(){const d=[];for(var f=this.S.length-1;f>=0;--f)d.push(this.S[f]);f=this.A.length;for(let m=0;m"",this.qp=()=>g.u$({}))}; g.F.Mp=function(){return this.K}; g.F.connect=async function(d,f,m){try{this.G&&await this.Y}finally{if(this.K||this.S&&this.S.getState()==2&&!this.V)return;this.hP="";this.V||this.A.stop();this.X=d||null;this.rD=f||0;const y=this.tP+"/test",C=this.tP+"/bind";d=new Fx(m?m.firstTestResults:null,m?m.secondTestResults:null,this.mS);const B=this.S;B&&(B.Um=null);d.Um=this;this.S=d;if(this.G)return this.Y=xs(this).then(()=>o7P(this,y,C,B,m)),this.Y.then(()=>{this.Y=g.u$()}); o7P(this,y,C,B,m)}}; g.F.disconnect=function(d){try{this.G&&(this.Y.cancel(),this.Y=g.u$())}finally{this.V2=d||0,this.A&&this.A.stop(),lS(this),this.S&&(this.S.getState()==3&&MaV(this.S),this.S.disconnect()),this.V2=0}}; g.F.sendMessage=async function(d,f){try{this.G&&await this.Y}finally{if(this.K)return;const m={_sc:d};f&&g.tf(m,f);if(this.A.isActive()||(this.S?this.S.getState():0)==2)this.j.push(m);else if(this.IY())try{this.G&&!hWE(this,d)&&await xs(this)}finally{this.IY()&&(hWE(this,d),lS(this),I1(this.S,m))}}}; g.F.fb=function(){this.C&&this.A&&this.A.ux()>0&&(this.C.DQC(this.A.ux(),this.V,!0),this.C.pMe());this.C&&this.C.Ue2();this.V?(this.A.stop(),g.zg(this.A),this.A=new ZR(this.T5,this),this.V=!1):this.A.reset();this.X=null;this.rD=0;if(this.j.length)if(this.G)FmU(this);else{var d=this.j;this.j=[];var f=d.length;for(let m=0;msWE[m]===d); this.CC.S("BROWSER_CHANNEL",f??"UNKNOWN")}; g.F.Ux=function(d,f){if(!this.A.isActive())this.publish("handlerClosed");else if(f){const m=f.length;for(let y=0;y{this.onError(y)}); this.handler.subscribe("handlerMessage",this.onMessage,this);this.A=f}connect(d,f,m){this.handler.connect(d,f,m)}disconnect(d){this.handler.disconnect(d)}p8(){this.handler.p8()}getDeviceId(){return this.handler.getDeviceId()}P5(){return this.handler.P5()}IY(){return this.handler.IY()}S(){this.dispatchEvent("channelOpened");var d=this.handler,f=this.A;g.KP("yt-remote-session-browser-channel",{firstTestResults:[""],secondTestResults:!d.S.VN,sessionId:d.S.j,arrayId:d.S.Sz});g.KP("yt-remote-session-screen-id", f);d=kP();f=O5();g.fg(d,f)||d.push(f);veN(d);ov()}onClosed(){this.dispatchEvent("channelClosed")}onMessage(d){this.dispatchEvent(new D0x(d))}onError(d){this.dispatchEvent(new EGU(d?1:0))}sendMessage(d,f){this.handler.sendMessage(d,f)}RU(d){this.handler.RU(d)}dispose(){this.handler.dispose()}};var urX=class{constructor(d,f,m=()=>""){new Lex; var y=new g.Ob;this.pathPrefix=d;this.S=f;this.AP=m;this.Y=y;this.G=null;this.K=this.B=0;this.channel=null;this.C=0;this.V=new ZR(()=>{this.V.isActive();this.channel?.j().A()===0&&this.connect(this.G,this.B)}); this.j={};this.A={};this.rD=!1;this.logger=null;this.X=[];this.IQ=void 0;this.pC=new E7U;this.V2=new p_x;this.e1=new Aa_;this.hP=new kJN}connect(d={},f=0){this.C!==2&&(this.V.stop(),this.G=d,this.B=f,Se(this),(d=g.P("ID_TOKEN"))?this.j["x-youtube-identity-token"]=d:delete this.j["x-youtube-identity-token"],this.S&&(this.A.device=this.S.device,this.A.name=this.S.name,this.A.app=this.S.app,this.A.id=this.S.id,this.S.Ef&&(this.A.mdxVersion=`${this.S.Ef}`),this.S.theme&&(this.A.theme=this.S.theme),this.S.capabilities&& (this.A.capabilities=this.S.capabilities),this.S.WO&&(this.A.cst=this.S.WO),this.S.authuser&&(this.A.authuser=this.S.authuser),this.S.pageId&&(this.A.pageId=this.S.pageId)),this.B!==0?this.A.ui=`${this.B}`:delete this.A.ui,Object.assign(this.A,this.G),this.channel=new iS(this.pathPrefix,{hA:"gsessionid",SX:this.j,Fu:this.A}),this.channel.open(),this.C=2,g7t(this))}disconnect(d=0){this.K=d;this.V.stop();Se(this);this.channel&&(this.K!==0?this.A.ui=`${this.K}`:delete this.A.ui,this.channel.close()); this.K=0}P5(){return this.V.isActive()?this.V.hg-Date.now():NaN}p8(){var d=this.V;g.zd(d.S);d.start()}sendMessage(d,f){this.channel&&(Se(this),this.channel.send({_sc:d,...f}))}RU(d){d||this.V.stop();d?this.j["X-YouTube-LoungeId-Token"]=d:delete this.j["X-YouTube-LoungeId-Token"]}getDeviceId(){return this.S?this.S.id:""}publish(d,...f){return this.Y.publish(d,...f)}subscribe(d,f,m){return this.Y.subscribe(d,f,m)}unsubscribe(d,f,m){return this.Y.unsubscribe(d,f,m)}HD(d){return this.Y.HD(d)}dispose(){this.rD|| (this.rD=!0,g.zg(this.Y),this.disconnect(),g.zg(this.V),this.AP=()=>"")}Mp(){return this.rD}};var IBN=class extends g.p6{constructor(d){super();this.S=d();this.S.subscribe("webChannelOpened",this.A,this);this.S.subscribe("webChannelClosed",this.onClosed,this);this.S.subscribe("webChannelError",this.onError,this);this.S.subscribe("webChannelMessage",this.onMessage,this)}connect(d,f){this.S.connect(d,f)}disconnect(d){this.S.disconnect(d)}p8(){this.S.p8()}getDeviceId(){return this.S.getDeviceId()}P5(){return this.S.P5()}IY(){return this.S.C===3}A(){this.dispatchEvent("channelOpened")}onClosed(){this.dispatchEvent("channelClosed")}onMessage(d){this.dispatchEvent(new D0x(d))}onError(){this.dispatchEvent(new EGU(this.S.IQ=== 401?1:0))}sendMessage(d,f){this.S.sendMessage(d,f)}RU(d){this.S.RU(d)}dispose(){this.S.dispose()}};var Lmy=Date.now(),je=null,qq=Array(50),TO=-1,bS=!1;g.nS(t5,g.ym);t5.prototype.xE=function(){return this.screens}; t5.prototype.contains=function(d){return!!$P(this.screens,d)}; t5.prototype.get=function(d){return d?AB(this.screens,d):null}; t5.prototype.info=function(d){vQ(this.C,d)};var $0E=class extends g.ym{constructor(d,f,m,y,C){super();this.j=d;this.X=f;this.G=m;this.rD=y;this.K=C;this.A=0;this.S=null;this.Lo=NaN}start(){!this.S&&isNaN(this.Lo)&&this.V()}stop(){this.S&&(this.S.abort(),this.S=null);isNaN(this.Lo)||(g.ud(this.Lo),this.Lo=NaN)}j1(){this.stop();super.j1()}V(){this.Lo=NaN;this.S=g.L4(J5(this.j,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.X},timeout:5E3,onSuccess:(0,g.g5)(this.C,this),onError:(0,g.g5)(this.Y,this),onTimeout:(0,g.g5)(this.B, this)})}C(d,f){this.S=null;d=f.screen||{};d.dialId=this.G;d.name=this.rD;f=-1;this.K&&d.shortLivedLoungeToken&&d.shortLivedLoungeToken.value&&d.shortLivedLoungeToken.refreshIntervalMs&&(d.screenIdType="shortLived",d.loungeToken=d.shortLivedLoungeToken.value,f=d.shortLivedLoungeToken.refreshIntervalMs);this.publish("pairingComplete",new cC(d),f)}Y(d){this.S=null;d.status&&d.status==404?this.A>=pPX.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(d=pPX[this.A],this.Lo=g.gp((0,g.g5)(this.V, this),d),this.A++):this.publish("pairingFailed",Error("Server error "+d.status))}B(){this.S=null;this.publish("pairingFailed",Error("Server not responding"))}},pPX=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.nS(wI,t5);g.F=wI.prototype;g.F.start=function(){HQ(this)&&this.publish("screenChange");!g.Nb("yt-remote-lounge-token-expiration")&&v7x(this);g.ud(this.S);this.S=g.gp((0,g.g5)(this.start,this),1E4)}; g.F.add=function(d,f){HQ(this);Jaf(this,d);Ys(this,!1);this.publish("screenChange");f(d);d.token||v7x(this)}; g.F.remove=function(d,f){let m=HQ(this);jet(this,d)&&(Ys(this,!1),m=!0);f(d);m&&this.publish("screenChange")}; g.F.Ab=function(d,f,m,y){let C=HQ(this);const B=this.get(d.id);B?(B.name!=f&&(B.name=f,Ys(this,!1),C=!0),m(d)):y(Error("no such local screen."));C&&this.publish("screenChange")}; g.F.j1=function(){g.ud(this.S);wI.cg.j1.call(this)}; g.F.XX=function(d){HQ(this);let f=this.screens.length;d=d&&d.screens||[];const m=d.length;for(let y=0;y{g.zg(e);C(CN(this,M),K)}); e.subscribe("pairingFailed",M=>{g.zg(e);B(M)}); e.start();return(0,g.g5)(e.stop,e)}; g.F.Xv=function(d,f,m,y){g.L4(J5(this.j,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:d},timeout:5E3,onSuccess:(0,g.g5)(function(C,B){C=new cC(B.screen||{});if(!C.name||H6g(this,C.name)){a:{B=C.name;let e=2,M=f(B,e);for(;H6g(this,M);){e++;if(e>20)break a;M=f(B,e)}B=M}C.name=B}m(CN(this,C))},this), onError:(0,g.g5)(function(C){y(Error("pairing request failed: "+C.status))},this), onTimeout:(0,g.g5)(function(){y(Error("pairing request timed out."))},this)})}; g.F.j1=function(){g.zg(this.A);g.zg(this.S);mu.cg.j1.call(this)}; g.F.AA=function(){Ytx(this);this.publish("screenChange");this.S.update()}; mu.prototype.dispose=mu.prototype.dispose;g.nS(ek,g.ym);g.F=ek.prototype;g.F.Hb=function(d){this.Mp()||(d&&(KN(this,""+d),this.publish("sessionFailed")),this.S=null,this.publish("sessionScreen",null))}; g.F.info=function(d){vQ(this.hP,d)}; g.F.zj=function(){return null}; g.F.YI=function(d){const f=this.A;d?(f.displayStatus=new chrome.cast.ReceiverDisplayStatus(d,[]),f.displayStatus.showStop=!0):f.displayStatus=null;chrome.cast.setReceiverDisplayStatus(f,(0,g.g5)(function(){this.info("Updated receiver status for "+f.friendlyName+": "+d)},this),(0,g.g5)(function(){KN(this,"Failed to update receiver status for: "+f.friendlyName)},this))}; g.F.j1=function(){this.YI("");ek.cg.j1.call(this)};var a6=class extends ek{constructor(d,f,m){super(d,f,"CastSession");this.config_=m;this.V=null;this.X=(0,g.g5)(this.pC,this);this.AP=(0,g.g5)(this.qp,this);this.rD=g.gp(()=>{mJE(this,null)},12E4); this.G=this.Y=this.B=this.K=0}V2(d){if(this.V){if(this.V==d)return;KN(this,"Overriding cast session with new session object");yLZ(this);this.V.removeUpdateListener(this.X);this.V.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.AP)}this.V=d;this.V.addUpdateListener(this.X);this.V.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.AP);CDx(this,"getMdxSessionStatus")}C(d){this.info("launchWithParams no-op for Cast: "+g.D6(d))}stop(){this.V?this.V.stop((0,g.g5)(function(){this.Hb()}, this),(0,g.g5)(function(){this.Hb(Error("Failed to stop receiver app."))},this)):this.Hb(Error("Stopping cast device without session."))}YI(){}j1(){this.info("disposeInternal"); yLZ(this);this.V&&(this.V.removeUpdateListener(this.X),this.V.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.AP));this.V=null;super.j1()}qp(d,f){if(!this.Mp())if(f)if(f=MM(f),g.hV(f))switch(d=""+f.type,f=f.data||{},this.info("onYoutubeMessage_: "+d+" "+g.D6(f)),d){case "mdxSessionStatus":mJE(this,f);break;case "loungeToken":BtN(this,f);break;default:KN(this,"Unknown youtube message: "+d)}else KN(this,"Unable to parse message.");else KN(this,"No data in message.")}e1(d,f,m,y){g.ud(this.K); this.K=0;taU(this.j,this.A.label,d,this.A.friendlyName,(0,g.g5)(function(C){C?f(C):y>=0?(KN(this,"Screen "+d+" appears to be offline. "+y+" retries left."),this.K=g.gp((0,g.g5)(this.e1,this,d,f,m,y-1),300)):m(Error("Unable to fetch screen."))},this),m)}zj(){return this.V}pC(d){this.Mp()||d||(KN(this,"Cast session died."),this.Hb())}};var A2x=class extends ek{constructor(d,f,m,y){super(d,f,"DialSession");this.config_=y;this.V=this.K=null;this.AP="";this.qp=m;this.pC=null;this.X=()=>{}; this.rD=NaN;this.e1=(0,g.g5)(this.tP,this);this.Y=()=>{}; this.G=this.B=0}V2(d){this.V=d;this.V.addUpdateListener(this.e1)}C(d){this.pC=d;this.X()}stop(){idg(this);this.V?this.V.stop((0,g.g5)(this.Hb,this,null),(0,g.g5)(this.Hb,this,"Failed to stop DIAL device.")):this.Hb()}j1(){idg(this);this.V&&this.V.removeUpdateListener(this.e1);this.V=null;super.j1()}tP(d){this.Mp()||d||(KN(this,"DIAL session died."),this.Y(),this.Y=()=>{},this.Hb())}};var kfV=class extends ek{constructor(d,f){super(d,f,"ManualSession");this.V=g.gp((0,g.g5)(this.C,this,null),150)}stop(){this.Hb()}V2(){}C(){g.ud(this.V);this.V=NaN;const d=AB(this.j.xE(),this.A.label);d?Md(this,d):this.Hb(Error("No such screen"))}j1(){g.ud(this.V);this.V=NaN;super.j1()}};var gq=class extends g.ym{constructor(d,f){super();this.config_=f;this.A=d;this.V2=f.appId||"233637DE";this.j=f.theme||"cl";this.hP=f.disableCastApi||!1;this.B=f.forceMirroring||!1;this.S=null;this.G=!1;this.V=[];this.C=(0,g.g5)(this.pC,this)}init(d,f){chrome.cast.timeout.requestSession=3E4;var m=new chrome.cast.SessionRequest(this.V2,[chrome.cast.Capability.AUDIO_OUT]);g.n4("desktop_enable_cast_connect")&&(m.androidReceiverCompatible=!0);this.hP||(m.dialRequest=new chrome.cast.DialRequest("YouTube")); const y=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;d=d||this.B?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;const C=(0,g.g5)(this.qp,this);m=new chrome.cast.ApiConfig(m,(0,g.g5)(this.K,this),C,y,d);m.customDialLaunchCallback=(0,g.g5)(this.e1,this);chrome.cast.initialize(m,(0,g.g5)(function(){this.Mp()||(chrome.cast.addReceiverActionListener(this.C),lBx(),this.A.subscribe("onlineScreenChange",(0,g.g5)(this.Y,this)),this.V=pWy(this),chrome.cast.setCustomReceivers(this.V, ()=>{},(0,g.g5)(function(B){this.AO("Failed to set initial custom receivers: "+g.D6(B))},this)),this.publish("yt-remote-cast2-availability-change",De(this)),f(!0))},this),(0,g.g5)(function(B){this.AO("Failed to initialize API: "+g.D6(B)); f(!1)},this))}gD(d,f){Ey("Setting connected screen ID: "+d+" -> "+f); if(this.S){var m=this.S.S;if(!d||m&&m.id!=d)Ey("Unsetting old screen status: "+this.S.A.friendlyName),pN(this,null)}if(d&&f){if(!this.S){d=AB(this.A.xE(),d);if(!d){Ey("setConnectedScreenStatus: Unknown screen.");return}if(d.idType=="shortLived"){Ey("setConnectedScreenStatus: Screen with id type to be short lived.");return}m=EDX(this,d);m||(Ey("setConnectedScreenStatus: Connected receiver not custom..."),m=new chrome.cast.Receiver(d.uuid?d.uuid:d.id,d.name),m.receiverType=chrome.cast.ReceiverType.CUSTOM, this.V.push(m),chrome.cast.setCustomReceivers(this.V,()=>{},(0,g.g5)(function(y){this.AO("Failed to set initial custom receivers: "+g.D6(y))},this))); Ey("setConnectedScreenStatus: new active receiver: "+m.friendlyName);pN(this,new kfV(this.A,m),!0)}this.S.YI(f)}else Ey("setConnectedScreenStatus: no screen.")}CC(d){this.Mp()?this.AO("Setting connection data on disposed cast v2"):this.S?this.S.C(d):this.AO("Setting connection data without a session")}AP(){this.Mp()?this.AO("Stopping session on disposed cast v2"):this.S?(this.S.stop(),pN(this,null)):Ey("Stopping non-existing session")}requestSession(){chrome.cast.requestSession((0,g.g5)(this.K,this), (0,g.g5)(this.tP,this))}j1(){this.A.unsubscribe("onlineScreenChange",(0,g.g5)(this.Y,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.C);var d=n7U;const f=g.AV("yt.mdx.remote.debug.handlers_");g.ex(f||[],d);g.zg(this.S);super.j1()}AO(d){vQ("Controller",d)}rD(d,f){this.S==d&&(f||pN(this,null),this.publish("yt-remote-cast2-session-change",f))}pC(d,f){if(!this.Mp())if(d)switch(d.friendlyName=chrome.cast.unescape(d.friendlyName),Ey("onReceiverAction_ "+d.label+" / "+d.friendlyName+ "-- "+f),f){case chrome.cast.ReceiverAction.CAST:if(this.S)if(this.S.A.label!=d.label)Ey("onReceiverAction_: Stopping active receiver: "+this.S.A.friendlyName),this.S.stop();else{Ey("onReceiverAction_: Casting to active receiver.");this.S.S&&this.publish("yt-remote-cast2-session-change",this.S.S);break}switch(d.receiverType){case chrome.cast.ReceiverType.CUSTOM:pN(this,new kfV(this.A,d));break;case chrome.cast.ReceiverType.DIAL:pN(this,new A2x(this.A,d,this.j,this.config_));break;case chrome.cast.ReceiverType.CAST:pN(this, new a6(this.A,d,this.config_));break;default:this.AO("Unknown receiver type: "+d.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.S&&this.S.A.label==d.label?this.S.stop():this.AO("Stopping receiver w/o session: "+d.friendlyName)}else this.AO("onReceiverAction_ called without receiver.")}e1(d){if(this.Mp())return Promise.reject(Error("disposed"));var f=d.receiver;f.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.AO("Not DIAL receiver: "+f.friendlyName),f.receiverType=chrome.cast.ReceiverType.DIAL); var m=this.S?this.S.A:null;if(!m||m.label!=f.label)return this.AO("Receiving DIAL launch request for non-clicked DIAL receiver: "+f.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(m&&m.label==f.label&&m.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.S.S)return Ey("Reselecting dial screen."),this.publish("yt-remote-cast2-session-change",this.S.S),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.AO('Changing CAST intent from "'+m.receiverType+'" to "dial" for '+f.friendlyName); pN(this,new A2x(this.A,f,this.j,this.config_))}f=this.S;f.K=d;f.K.appState==chrome.cast.DialAppState.RUNNING?(d=f.K.extraData||{},m=d.screenId||null,cG(f)&&d.loungeToken?d.loungeTokenRefreshIntervalMs?d=DJV(f,{name:f.A.friendlyName,screenId:d.screenId,loungeToken:d.loungeToken,dialId:f.K.receiver.label,screenIdType:"shortLived"},d.loungeTokenRefreshIntervalMs):(g.yi(Error(`No loungeTokenRefreshIntervalMs presents in additionalData: ${JSON.stringify(d)}.`)),d=cLN(f,m)):d=cLN(f,m)):d=WG(f);return d}K(d){if(!this.Mp()&& !this.B){Ey("New cast session ID: "+d.sessionId);var f=d.receiver;if(f.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.S)if(f.receiverType==chrome.cast.ReceiverType.CAST)Ey("Got resumed cast session before resumed mdx connection."),f.friendlyName=chrome.cast.unescape(f.friendlyName),pN(this,new a6(this.A,f,this.config_),!0);else{this.AO("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var m=this.S.A,y=AB(this.A.xE(),m.label);y&&s5(y,f.label)&&m.receiverType!= chrome.cast.ReceiverType.CAST&&f.receiverType==chrome.cast.ReceiverType.CAST&&(Ey("onSessionEstablished_: manual to cast session change "+f.friendlyName),g.zg(this.S),this.S=new a6(this.A,f,this.config_),this.S.subscribe("sessionScreen",(0,g.g5)(this.rD,this,this.S)),this.S.subscribe("sessionFailed",()=>$Jf(this,this.S)),this.S.C(null)); this.S.V2(d)}}}X(){return this.S?this.S.zj():null}tP(d){this.Mp()||(this.AO("Failed to estabilish a session: "+g.D6(d)),d.code!=chrome.cast.ErrorCode.CANCEL&&pN(this,null),this.publish("yt-remote-cast2-session-failed"))}qp(d){Ey("Receiver availability updated: "+d);if(!this.Mp()){var f=De(this);this.G=d==chrome.cast.ReceiverAvailability.AVAILABLE;De(this)!=f&&this.publish("yt-remote-cast2-availability-change",De(this))}}Y(){this.Mp()||(this.V=pWy(this),Ey("Updating custom receivers: "+g.D6(this.V)), chrome.cast.setCustomReceivers(this.V,()=>{},(0,g.g5)(function(){this.AO("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",De(this)))}}; gq.prototype.setLaunchParams=gq.prototype.CC;gq.prototype.setConnectedScreenStatus=gq.prototype.gD;gq.prototype.stopSession=gq.prototype.AP;gq.prototype.getCastSession=gq.prototype.X;gq.prototype.requestSession=gq.prototype.requestSession;gq.prototype.init=gq.prototype.init;gq.prototype.dispose=gq.prototype.dispose;var oO=[],oDE=(0,g.xE)`https://www.gstatic.com/cv/js/sender/v1/cast_sender.js`;g.F=IO.prototype; g.F.reset=function(d){this.listId="";this.index=-1;this.videoId="";u7(this);this.volume=-1;this.muted=!1;d&&(this.index=d.index,this.listId=d.listId,this.videoId=d.videoId,this.playerState=d.playerState,this.volume=d.volume,this.muted=d.muted,this.audioTrackId=d.audioTrackId,this.trackData=d.trackData,this.hasPrevious=d.hasPrevious,this.hasNext=d.hasNext,this.C=d.playerTime,this.Y=d.playerTimeAt,this.A=d.seekableStart,this.B=d.seekableEnd,this.V=d.duration,this.loadedTime=d.loadedTime,this.S=d.liveIngestionTime, this.j=!isNaN(this.S))}; g.F.isPlaying=function(){return this.playerState==1}; g.F.isBuffering=function(){return this.playerState==3}; g.F.wy=function(d){this.V=isNaN(d)?0:d}; g.F.getDuration=function(){return this.j?this.V+X9(this):this.V}; g.F.clone=function(){return new IO(Vt(this))};var QWy=class extends g.ym{constructor(){var d=eK();super();this.V=0;this.j=d;this.B=[];this.Y=new seZ;this.A=this.S=null;this.X=(0,g.g5)(this.pC,this);this.K=(0,g.g5)(this.C,this);this.rD=(0,g.g5)(this.e1,this);this.hP=(0,g.g5)(this.qp,this);let f=0;d?(f=d.getProxyState(),f!=3&&(d.subscribe("proxyStateChange",this.V2,this),XWX(this))):f=3;f!=0&&g.gp(()=>{this.V2(f)},0); (d=gDt())&&l7(this,d);this.subscribe("yt-remote-cast2-session-change",this.hP)}getState(){return this.V}P5(){return this.j.getReconnectTimeout()}p8(){this.j.reconnect()}play(){PG(this)?(this.S?this.S.play(null,g.Q7,JT(this,"play")):LN(this,"play"),jk(this,1,nN(x$(this))),this.publish("remotePlayerChange")):vG(this,this.play)}pause(){PG(this)?(this.S?this.S.pause(null,g.Q7,JT(this,"pause")):LN(this,"pause"),jk(this,2,nN(x$(this))),this.publish("remotePlayerChange")):vG(this,this.pause)}seekTo(d){if(PG(this)){if(this.S){const f= x$(this),m=new chrome.cast.media.SeekRequest;m.currentTime=d;f.isPlaying()||f.isBuffering()?m.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:m.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.S.seek(m,g.Q7,JT(this,"seekTo",{newTime:d}))}else LN(this,"seekTo",{newTime:d});jk(this,3,d);this.publish("remotePlayerChange")}else vG(this,g.Ig(this.seekTo,d))}stop(){if(PG(this)){this.S?this.S.stop(null,g.Q7,JT(this,"stopVideo")):LN(this,"stopVideo");var d=x$(this);d.index=-1;d.videoId= "";u7(d);Sk(this,d);this.publish("remotePlayerChange")}else vG(this,this.stop)}setVolume(d,f){if(PG(this)){var m=x$(this);if(this.A){if(m.volume!=d){const y=Math.round(d)/100;this.A.setReceiverVolumeLevel(y,(0,g.g5)(function(){zO("set receiver volume: "+y)},this),(0,g.g5)(function(){this.AO("failed to set receiver volume.")},this))}m.muted!=f&&this.A.setReceiverMuted(f,(0,g.g5)(function(){zO("set receiver muted: "+f)},this),(0,g.g5)(function(){this.AO("failed to set receiver muted.")},this))}else{const y= {volume:d, muted:f};m.volume!=-1&&(y.delta=d-m.volume);LN(this,"setVolume",y)}m.muted=f;m.volume=d;Sk(this,m)}else vG(this,g.Ig(this.setVolume,d,f))}G(d,f){if(PG(this)){var m=x$(this);d={videoId:d};f&&(m.trackData={trackName:f.name,languageCode:f.languageCode,sourceLanguageCode:f.translationLanguage?f.translationLanguage.languageCode:"",languageName:f.languageName,kind:f.kind},d.style=g.D6(f.style),g.tf(d,m.trackData));LN(this,"setSubtitlesTrack",d);Sk(this,m)}else vG(this,g.Ig(this.G,d,f))}setAudioTrack(d, f){PG(this)?(f=f.getLanguageInfo().getId(),LN(this,"setAudioTrack",{videoId:d,audioTrackId:f}),d=x$(this),d.audioTrackId=f,Sk(this,d)):vG(this,g.Ig(this.setAudioTrack,d,f))}playVideo(d,f,m,y=null,C=null,B=null,e=null){const M=x$(this),K={videoId:d};m!==void 0&&(K.currentIndex=m);Ze(M,d,m||0);f!==void 0&&(RO(M,f),K.currentTime=f);y&&(K.listId=y);C&&(K.playerParams=C);B&&(K.clickTrackingParams=B);e&&(K.locationInfo=g.D6(e));LN(this,"setPlaylist",K);y||Sk(this,M)}cw(d,f){if(PG(this)){if(d&&f){const m= x$(this);Ze(m,d,f);Sk(this,m)}LN(this,"previous")}else vG(this,g.Ig(this.cw,d,f))}nextVideo(d,f){if(PG(this)){if(d&&f){const m=x$(this);Ze(m,d,f);Sk(this,m)}LN(this,"next")}else vG(this,g.Ig(this.nextVideo,d,f))}Wl(){if(PG(this)){LN(this,"clearPlaylist");var d=x$(this);d.reset();Sk(this,d);this.publish("remotePlayerChange")}else vG(this,this.Wl)}AP(){PG(this)?LN(this,"dismissAutoplay"):vG(this,this.AP)}dispose(){if(this.V!=3){const d=this.V;this.V=3;this.publish("proxyStateChange",d,this.V)}super.dispose()}j1(){RUf(this); this.j=null;this.Y.clear();l7(this,null);super.j1()}V2(d){if((d!=this.V||d==2)&&this.V!=3&&d!=0){var f=this.V;this.V=d;this.publish("proxyStateChange",f,d);if(d==1)for(;!this.Y.isEmpty();)f=d=this.Y,f.S.length===0&&(f.S=f.A,f.S.reverse(),f.A=[]),d.S.pop().apply(this);else d==3&&this.dispose()}}tP(d,f){this.publish(d,f)}pC(d){if(!d)this.C(null),l7(this,null);else if(this.A.receiver.volume){d=this.A.receiver.volume;const f=x$(this),m=Math.round(100*d.level||0);if(f.volume!=m||f.muted!=d.muted)zO("Cast volume update: "+ d.level+(d.muted?" muted":"")),f.volume=m,f.muted=!!d.muted,Sk(this,f)}}C(d){zO("Cast media: "+!!d);this.S&&this.S.removeUpdateListener(this.rD);if(this.S=d)this.S.addUpdateListener(this.rD),nDX(this),this.publish("remotePlayerChange")}e1(d){d?(nDX(this),this.publish("remotePlayerChange")):this.C(null)}zK(){LN(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}qp(){const d=gDt();d&&l7(this,d)}AO(d){vQ("CP",d)}};var EP=class extends g.ym{constructor(d,f=!1){var m=wq,y=CX();super();this.C=NaN;this.e1=!1;this.X=this.rD=this.V2=this.hP=NaN;this.AP=[];this.Y=this.G=this.j=this.S=this.A=null;this.nC=m;this.tP=f;this.AP.push(g.fP(window,"beforeunload",()=>{this.B(2)})); this.V=[];this.S=new IO;this.GL=d.id;this.qp=d.idType;this.A=RWx(this.nC,y,this.pC,this.qp=="shortLived",this.GL);this.A.listen("channelOpened",()=>{Zdx(this)}); this.A.listen("channelClosed",()=>{z8("Channel closed");isNaN(this.C)?av(!0):av();this.dispose()}); this.A.listen("channelError",C=>{av();isNaN(this.K())?(C==1&&this.qp=="shortLived"&&this.publish("browserChannelAuthError",C),z8(`Channel error: ${C} without reconnection`),this.dispose()):(this.e1=!0,z8("Channel error: "+C+" with reconnection in "+this.K()+" ms"),qd(this,2))}); this.A.listen("channelMessage",C=>{qAg(this,C)}); this.A.RU(d.token);this.subscribe("remoteQueueChange",()=>{var C=this.S.videoId;g.Wa()&&g.KP("yt-remote-session-video-id",C)})}connect(d,f){if(f){var m=f.listId; const y=f.videoId,C=f.videoIds,B=f.playerParams,e=f.clickTrackingParams,M=f.index,K={videoId:y},N=f.currentTime,W=f.locationInfo;f=f.loopMode;N!==void 0&&(K.currentTime=N<=5?0:N);B&&(K.playerParams=B);W&&(K.locationInfo=W);e&&(K.clickTrackingParams=e);m&&(K.listId=m);C&&C.length>0&&(K.videoIds=C.join(","));M!==void 0&&(K.currentIndex=M);this.tP&&(K.loopMode=f||"LOOP_MODE_OFF");m&&(this.S.listId=m);this.S.videoId=y;this.S.index=M||0;this.S.state=3;RO(this.S,N);this.Y="UNSUPPORTED";m=this.tP?"setInitialState": "setPlaylist";z8(`Connecting with ${m} and params: ${g.D6(K)}`);this.A.connect({method:m,params:g.D6(K)},d,zdx())}else z8("Connecting without params"),this.A.connect({},d,zdx());bdX(this)}RU(d){this.A.RU(d)}dispose(){this.Mp()||(g.$K("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),qd(this,3));super.dispose()}j1(){b7(this);tT(this);T8(this);g.ud(this.rD);this.rD=NaN;g.ud(this.X);this.X=NaN;this.j=null;g.ml(this.AP);this.AP.length=0;this.A.dispose();super.j1();this.Y=this.G=this.V= this.S=this.A=null}CC(d){if(!this.V||this.V.length===0)return!1;for(const f of this.V)if(!f.capabilities.has(d))return!1;return!0}Np(){let d=3;this.Mp()||(d=0,isNaN(this.K())?this.A.IY()&&isNaN(this.C)&&(d=1):d=2);return d}B(d){z8("Disconnecting with "+d);g.$K("yt.mdx.remote.remoteClient_",null);b7(this);this.publish("beforeDisconnect",d);d==1&&av();this.A.disconnect(d);this.dispose()}KC(){let d=this.S;this.j&&(d=this.S.clone(),Ze(d,this.j,d.index));return Vt(d)}h7(d){const f=new IO(d);f.videoId&& f.videoId!=this.S.videoId&&(this.j=f.videoId,g.ud(this.rD),this.rD=g.gp(()=>{if(this.j){const y=this.j;this.j=null;this.S.videoId!=y&&HG(this,"getNowPlaying")}},5E3)); const m=[];this.S.listId==f.listId&&this.S.videoId==f.videoId&&this.S.index==f.index||m.push("remoteQueueChange");this.S.playerState==f.playerState&&this.S.volume==f.volume&&this.S.muted==f.muted&&nN(this.S)==nN(f)&&g.D6(this.S.trackData)==g.D6(f.trackData)||m.push("remotePlayerChange");this.S.reset(d);g.vT(m,function(y){this.publish(y)},this)}gD(){const d=this.A.getDeviceId(),f=g.Un(this.V,function(m){return m.type=="REMOTE_CONTROL"&&m.id!=d}); return f?f.id:""}K(){return this.A.P5()}Ul(){return this.Y||"UNSUPPORTED"}mS(){return this.G||""}Br(){!isNaN(this.K())&&this.A.p8()}A7(d,f){HG(this,d,f);wWX(this)}pC(){var d=g.dk("SAPISID","")||g.dk("__Secure-1PAPISID")||"",f=g.dk("__Secure-3PAPISID","")||"";if(!d&&!f)return"";d=g.hD(g.Of(d),2);f=g.hD(g.Of(f),2);return g.hD(g.Of(`,${d},${f}`),2)}};EP.prototype.subscribe=EP.prototype.subscribe;EP.prototype.unsubscribeByKey=EP.prototype.HD;EP.prototype.getProxyState=EP.prototype.Np; EP.prototype.disconnect=EP.prototype.B;EP.prototype.getPlayerContextData=EP.prototype.KC;EP.prototype.setPlayerContextData=EP.prototype.h7;EP.prototype.getOtherConnectedRemoteId=EP.prototype.gD;EP.prototype.getReconnectTimeout=EP.prototype.K;EP.prototype.getAutoplayMode=EP.prototype.Ul;EP.prototype.getAutoplayVideoId=EP.prototype.mS;EP.prototype.reconnect=EP.prototype.Br;EP.prototype.sendMessage=EP.prototype.A7;EP.prototype.getXsrfToken=EP.prototype.pC; EP.prototype.isCapabilitySupportedOnConnectedDevices=EP.prototype.CC;var y2E=class extends t5{constructor(d){super("ScreenServiceProxy");this.A8=d;this.S=[];this.S.push(this.A8.$_s("screenChange",(0,g.g5)(this.A,this)));this.S.push(this.A8.$_s("onlineScreenChange",(0,g.g5)(this.V,this)))}xE(d){return this.A8.$_gs(d)}contains(d){return!!this.A8.$_c(d)}get(d){return this.A8.$_g(d)}start(){this.A8.$_st()}add(d,f,m){this.A8.$_a(d,f,m)}remove(d,f,m){this.A8.$_r(d,f,m)}Ab(d,f,m,y){this.A8.$_un(d,f,m,y)}j1(){const d=this.S.length;for(let f=0;f{ezV(this,y)}); g.I(this,this.events);this.events.O(f,"onCaptionsTrackListChanged",this.Br);this.events.O(f,"captionschanged",this.nC);this.events.O(f,"captionssettingschanged",this.tP);this.events.O(f,"videoplayerreset",this.B);this.events.O(f,"mdxautoplaycancel",()=>{this.Ft.AP()}); f.Z("enable_mdx_video_play_directly")&&this.events.O(f,"videodatachange",()=>{NHU(this.S)||pX(this)||Ae(this,0)}); d=this.Ft;d.Mp();d.subscribe("proxyStateChange",this.e1,this);d.subscribe("remotePlayerChange",this.Y,this);d.subscribe("remoteQueueChange",this.B,this);d.subscribe("previousNextChange",this.hP,this);d.subscribe("nowAutoplaying",this.V2,this);d.subscribe("autoplayDismissed",this.AP,this);g.I(this,this.A);g.I(this,this.V);g.I(this,this.rD);g.I(this,this.X);g.I(this,this.K);this.tP();this.B();this.Y()}j1(){super.j1();this.A.stop();this.V.stop();this.rD.stop();const d=this.Ft;d.unsubscribe("proxyStateChange", this.e1,this);d.unsubscribe("remotePlayerChange",this.Y,this);d.unsubscribe("remoteQueueChange",this.B,this);d.unsubscribe("previousNextChange",this.hP,this);d.unsubscribe("nowAutoplaying",this.V2,this);d.unsubscribe("autoplayDismissed",this.AP,this);this.Ft=this.S=null}T0(d,...f){if(this.Ft.V!=2)if(pX(this)){if(x$(this.Ft).playerState!=1081||d!=="control_seek")switch(d){case "control_toggle_play_pause":x$(this.Ft).isPlaying()?this.Ft.pause():this.Ft.play();break;case "control_play":this.Ft.play(); break;case "control_pause":this.Ft.pause();break;case "control_seek":this.K.j(f[0],f[1]);break;case "control_subtitles_set_track":kq(this,f[0]);break;case "control_set_audio_track":this.setAudioTrack(f[0])}}else switch(d){case "control_toggle_play_pause":case "control_play":case "control_pause":d=this.J.getCurrentTime();Ae(this,d===0?void 0:d);break;case "control_seek":Ae(this,f[0]);break;case "control_subtitles_set_track":kq(this,f[0]);break;case "control_set_audio_track":this.setAudioTrack(f[0])}}nC(d){this.rD.ze(d)}GL(d){this.T0("control_subtitles_set_track", g.Sx(d)?null:d)}tP(){const d=this.J.getOption("captions","track");g.Sx(d)||kq(this,d)}B9(d){this.S.B9(d,this.J.getVideoData().lengthSeconds)}Br(){g.Sx(this.j)||MEV(this,this.j);this.C=!1}e1(d,f){this.V.stop();f===2&&this.qp()}Y(){if(pX(this)){this.A.stop();var d=x$(this.Ft);switch(d.playerState){case 1080:case 1081:case 1084:case 1085:this.S.FT=1;break;case 1082:case 1083:this.S.FT=0;break;default:this.S.FT=-1}switch(d.playerState){case 1081:case 1:this.uo(new g.E7(8));this.pC();break;case 1085:case 3:this.uo(new g.E7(9)); break;case 1083:case 0:this.uo(new g.E7(2));this.K.stop();this.B9(this.J.getVideoData().lengthSeconds);break;case 1084:this.uo(new g.E7(4));break;case 2:this.uo(new g.E7(4));this.B9(nN(d));break;case -1:this.uo(new g.E7(64));break;case -1E3:this.uo(new g.E7(128,{errorCode:"mdx.remoteerror",errorMessage:"Este v\u00eddeo no se puede reproducir de forma remota.",At:2}))}const m=x$(this.Ft).trackData;d=m;var f=this.j;(d||f?d&&f&&d.trackName==f.trackName&&d.languageCode==f.languageCode&&d.languageName== f.languageName&&d.kind==f.kind:1)||(this.j=m,MEV(this,m));d=x$(this.Ft);d.volume===-1||Math.round(this.J.getVolume())===d.volume&&this.J.isMuted()===d.muted||this.X.isActive()||this.gD()}else Kng(this)}hP(){this.J.publish("mdxpreviousnextchange")}B(){pX(this)||Kng(this)}V2(d){isNaN(d)||this.J.publish("mdxnowautoplaying",d)}AP(){this.J.publish("mdxautoplaycanceled")}setAudioTrack(d){pX(this)&&this.Ft.setAudioTrack($q(this).videoId,d)}seekTo(d,f){x$(this.Ft).playerState===-1?Ae(this,d):f&&this.Ft.seekTo(d)}gD(){if(pX(this)){var d= x$(this.Ft);this.events.Zc(this.CC);d.muted?this.J.mute():this.J.unMute();this.J.setVolume(d.volume);this.CC=this.events.O(this.J,"onVolumeChange",f=>{ezV(this,f)})}}pC(){this.A.stop(); if(!this.Ft.Mp()){var d=x$(this.Ft);d.isPlaying()&&this.uo(new g.E7(8));this.B9(nN(d));this.A.start()}}qp(){this.V.stop();this.A.stop();const d=this.Ft.P5();this.Ft.V==2&&!isNaN(d)&&this.V.start()}uo(d){this.V.stop();const f=this.G;if(!g.O7(f,d)){const m=d.S(2);m!==this.G.S(2)&&this.J.GW(m);this.G=d;iRd(this.S,f,d)}}};var oGV=class extends g.HD{constructor(d,f){super(d);this.S=f}getCurrentTime(){return this.S.getCurrentTime()}getDuration(){return this.S.getDuration()}It(){return this.S.It()}DR(){return this.S.DR()}TH(){return this.S.TH()}c5(){return this.S.c5()}getPlayerState(){return this.S.Hx}isAtLiveHead(){return this.S.isAtLiveHead()}pauseVideo(){QS(this.S,"control_pause")}async playVideo(){QS(this.S,"control_play")}seekTo(d,f){QS(this.S,"control_seek",d,!f?.Uq)}GJ(d){QS(this.S,"control_set_audio_track",d); return!0}};var amx=class extends g.Y{constructor(){super({D:"div",W:"ytp-mdx-popup-dialog",U:{role:"dialog"},N:[{D:"div",W:"ytp-mdx-popup-dialog-inner-content",N:[{D:"div",W:"ytp-mdx-popup-title",aP:"No has iniciado sesi\u00f3n"},{D:"div",W:"ytp-mdx-popup-description",aP:"Los v\u00eddeos que veas podr\u00edan aparecer en el historial de reproducciones de la TV e influir en las recomendaciones. Puedes evitarlo si cancelas e inicias sesi\u00f3n en YouTube desde tu ordenador."},{D:"div",W:"ytp-mdx-privacy-popup-buttons", N:[{D:"button",oP:["ytp-button","ytp-mdx-privacy-popup-cancel"],aP:"Cancelar"},{D:"button",oP:["ytp-button","ytp-mdx-privacy-popup-confirm"],aP:"Confirmar"}]}]}]});this.fade=new g.TC(this,250);this.cancelButton=this.ue("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.ue("ytp-mdx-privacy-popup-confirm");g.I(this,this.fade);this.O(this.cancelButton,"click",this.S);this.O(this.confirmButton,"click",this.A)}OM(){this.fade.show()}ya(){this.fade.hide()}S(){Ft("mdx-privacy-popup-cancel");this.ya()}A(){Ft("mdx-privacy-popup-confirm"); this.ya()}};var hzX=class extends g.Y{constructor(d){super({D:"div",W:"ytp-remote",N:[{D:"div",W:"ytp-remote-display-status",N:[{D:"div",W:"ytp-remote-display-status-icon",N:[g.Z1v()]},{D:"div",W:"ytp-remote-display-status-text",aP:"{{statustext}}"}]}]});this.api=d;this.fade=new g.TC(this,250);g.I(this,this.fade);this.O(d,"presentingplayerstatechange",this.onStateChange);this.sM(d.getPlayerStateObject())}onStateChange(d){this.sM(d.state)}sM(d){if(this.api.getPresentingPlayerType()===3){const f={RECEIVER_NAME:this.api.getOption("remote", "currentReceiver").name};d=d.S(128)?g.xB("No se ha podido reproducir el v\u00eddeo en $RECEIVER_NAME",f):d.isPlaying()||d.isPaused()?g.xB("El v\u00eddeo se est\u00e1 reproduciendo en $RECEIVER_NAME",f):g.xB("Conectado/a a $RECEIVER_NAME",f);this.updateValue("statustext",d);this.fade.show()}else this.fade.hide()}};var Fnd=class extends g.l4{constructor(d,f){super("Reproducir en",1,d,f);this.J=d;this.Ob={};this.O(d,"onMdxReceiversChange",this.C);this.O(d,"presentingplayerstatechange",this.C);this.C()}C(){var d=this.J.getOption("remote","receivers");d&&d.length>1&&!this.J.getOption("remote","quickCast")?(this.Ob=g.FP(d,this.Y,this),this.j(g.TP(d,this.Y)),d=this.J.getOption("remote","currentReceiver"),d=this.Y(d),this.options[d]&&this.A(d),this.enable(!0)):this.enable(!1)}Y(d){return d.key}V(d){return d==="cast-selector-receiver"? "Enviar...":this.Ob[d].name}S(d){super.S(d);this.J.setOption("remote","currentReceiver",this.Ob[d]);this.aO.ya()}};g.Pc("remote",class extends g.Ln{constructor(d){super(d);this.s5={key:pj(),name:"Este ordenador"};this.cq=null;this.subscriptions=[];this.MV=this.Ft=null;this.Ob=[this.s5];this.Ce=this.s5;this.Hx=new g.E7(64);this.nS=0;this.FT=-1;this.f_=!1;this.yS=this.vW=this.JE=null;if(!g.K3(this.player.L())&&!g.bY(this.player.L())){d=this.player;var f=g.O8(d);f&&(f=f.Jq())&&(f=new Fnd(d,f),g.I(this,f));f=new hzX(d);g.I(this,f);g.lW(d,f.element,4);this.JE=new amx;g.I(this,this.JE);g.lW(d,this.JE.element,4);this.f_= !!yS()}}create(){var d=this.player.L();const f=g.iL(d);d={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:d.Z("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:d.Z("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:d.Z("enable_cast_short_lived_lounge_token")};d0E(f,d);this.subscriptions.push(g.m9("yt-remote-before-disconnect",this.gA,this));this.subscriptions.push(g.m9("yt-remote-connection-change",this.CL,this));this.subscriptions.push(g.m9("yt-remote-receiver-availability-change", this.zX,this));this.subscriptions.push(g.m9("yt-remote-auto-connect",this.Js,this));this.subscriptions.push(g.m9("yt-remote-receiver-resumed",this.Qz,this));this.subscriptions.push(g.m9("mdx-privacy-popup-confirm",this.oa,this));this.subscriptions.push(g.m9("mdx-privacy-popup-cancel",this.T1,this));this.zX()}load(){this.player.cancelPlayback();super.load();this.yS=new oGV(this.player.L(),this);this.player.xY(this.yS);this.cq=new ORx(this,this.player,this.Ft);var d=(d=BHP())?d.currentTime:0;const f= cr()?new QWy:null;d==0&&f&&(d=nN(x$(f)));d!==0&&this.B9(d);iRd(this,this.Hx,this.Hx);this.player.Kw(6)}unload(){this.player.publish("mdxautoplaycanceled");this.player.Xr();this.Ce=this.s5;g.Tg(this.cq,this.Ft);this.Ft=this.yS=this.cq=null;super.unload();this.player.Kw(5);OP(this)}j1(){g.yo(this.subscriptions);super.j1()}getAdState(){return this.FT}hasPrevious(){return this.Ft?x$(this.Ft).hasPrevious:!1}hasNext(){return this.Ft?x$(this.Ft).hasNext:!1}B9(d,f){this.nS=d||0;this.player.publish("progresssync", d,f);g.$4(this.player,"onVideoProgress",d||0)}getCurrentTime(){return this.nS}getDuration(){return x$(this.Ft).getDuration()||0}It(){var d=x$(this.Ft);return d.j?d.S+X9(d):d.S}DR(){return x$(this.Ft).loadedTime}TH(){return uWx(x$(this.Ft))}c5(){var d=x$(this.Ft);return d.A>0?d.A+X9(d):d.A}getProgressState(){const d=x$(this.Ft),f=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:d.playerState!=1081&&this.player.fd(),clipEnd:f.clipEnd,clipStart:f.clipStart,current:this.getCurrentTime(), displayedStart:-1,duration:this.getDuration(),ingestionTime:this.It(),isAtLiveHead:this.isAtLiveHead(),loaded:this.DR(),seekableEnd:this.TH(),seekableStart:this.c5(),offset:0,viewerLivestreamJoinMediaTime:0}}isAtLiveHead(){return uWx(x$(this.Ft))-this.getCurrentTime()<=1}nextVideo(){this.Ft&&this.Ft.nextVideo()}cw(){this.Ft&&this.Ft.cw()}gA(d){d===1&&(this.MV=this.Ft?x$(this.Ft):null)}CL(){var d=cr()?new QWy:null;if(d){const f=this.Ce;this.loaded&&this.unload();this.Ft=d;this.MV=null;f.key!==this.s5.key&& (this.Ce=f,this.load())}else g.zg(this.Ft),this.Ft=null,this.loaded&&(this.unload(),(d=this.MV)&&d.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(d.videoId,nN(d)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}zX(){var d=[this.s5],f=d.concat;const m=fmt();aO()&&g.Nb("yt-remote-cast-available")&&m.push({key:"cast-selector-receiver",name:"Cast..."});this.Ob=f.call(d,m);d=M$()||this.s5;o6(this,d);g.$4(this.player,"onMdxReceiversChange")}Js(){const d= M$();o6(this,d)}Qz(){this.Ce=M$()}oa(){this.f_=!0;OP(this);Dy=!1;KX&&iR(KX,1);KX=null}T1(){this.f_=!1;OP(this);o6(this,this.s5);this.Ce=this.s5;Dy=!1;KX=null;this.player.playVideo()}PD(d,f){switch(d){case "casting":return this.loaded;case "receivers":return this.Ob;case "currentReceiver":return f&&(f.key==="cast-selector-receiver"?F9():o6(this,f)),this.loaded?this.Ce:this.s5;case "quickCast":return this.Ob.length===2&&this.Ob[1].key==="cast-selector-receiver"?(f&&F9(),!0):!1}}zK(){this.Ft.zK()}On(){return!1}getOptions(){return["casting", "receivers","currentReceiver","quickCast"]}isLoggedIn(){return g.P("PLAYER_CONFIG")?.args?.authuser!==void 0?!0:!(!g.P("SESSION_INDEX")&&!g.P("LOGGED_IN"))}});})(_yt_player);