(function(g){var window=this;var mya=function(a,b){return g.Rb(a,b)},I6=function(a){g.wm(a,"zx",g.wb());
return a},J6=function(a,b,c){g.ya(c)||(c=[String(c)]);
g.zm(a.g,b,c)},nya=function(a,b){var c=[];
g.dk(b,function(a){try{var b=g.KC.prototype.l.call(this,a,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}g.t(b)?g.JC(b)&&c.push(a):c.push(a)},a);
return c},oya=function(a,b){var c=nya(a,b);
(0,g.C)(c,function(a){g.KC.prototype.remove.call(this,a)},a)},pya=function(){var a=g.hG;
oya(a,a.g.de(!0))},qya=function(a,b,c,d){var e=new g.nm(null,void 0);
a&&g.om(e,a);b&&g.pm(e,b);c&&g.qm(e,c);d&&g.rm(e,d);return e},rya=function(a){g.rF[a]&&(a=g.rF[a],(0,g.C)(a,function(a){g.pF[a]&&delete g.pF[a]}),a.length=0)},sya=function(a){var b=g.oF();
if(b)if(b.clear(a),a)rya(a);else for(var c in g.rF)rya(c)},K6=function(a){this.app=this.name=this.id="";
this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.o=!1;this.capabilities=new window.Set;this.experiments=new window.Set;this.theme="u";new g.hm;this.g=this.l="";a&&(this.id=a.id||a.name,this.name=a.name,this.app=a.app,this.type=a.type||"REMOTE_CONTROL",this.username=a.user||"",this.avatar=a.userAvatarUri||"",this.obfuscatedGaiaId=a.obfuscatedGaiaId||"",this.theme=a.theme||"u",tya(this,a.capabilities||""),uya(this,a.experiments||""),this.l=a.remoteControllerUrl||"",
this.g=a.localChannelEncryptionKey||"")},tya=function(a,b){a.capabilities.clear();
(0,g.Hd)(b.split(","),g.Ea(mya,vya)).forEach(function(b){a.capabilities.add(b)})},uya=function(a,b){a.experiments.clear();
b.split(",").forEach(function(b){a.experiments.add(b)})},L6=function(a){a=a||{};
this.name=a.name||"";this.id=a.id||a.screenId||"";this.token=a.token||a.loungeToken||"";this.uuid=a.uuid||a.dialId||""},M6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},wya=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid}},xya=function(a){return new L6(a)},yya=function(a){return g.ya(a)?(0,g.H)(a,xya):[]},N6=function(a){return a?'{name:"'+a.name+'",id:'+a.id.substr(0,6)+"..,token:"+(a.token?".."+a.token.slice(-6):"-")+",uuid:"+(a.uuid?".."+a.uuid.slice(-6):"-")+"}":"null"},O6=function(a){return g.ya(a)?"["+(0,g.H)(a,N6).join(",")+"]":"null"},P6=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;
return("x"==a?b:b&3|8).toString(16)})},zya=function(a){return(0,g.H)(a,function(a){return{key:a.id,
name:a.name}})},Q6=function(a,b){return g.Ka(a,function(a){return a||b?!a!=!b?!1:a.id==b.id:!0})},R6=function(a,b){return g.Ka(a,function(a){return M6(a,b)})},S6=function(){var a=g.kG("yt-remote-connected-devices")||[];
g.fb(a);return a},Aya=function(a){if(g.Pa(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return(0,g.H)(a,function(a,b){return 0==b?a:a.substring(c.length)})},Bya=function(a){g.jG("yt-remote-connected-devices",a,86400)},U6=function(){if(T6)return T6;
var a=g.kG("yt-remote-device-id");a||(a=P6(),g.jG("yt-remote-device-id",a,31536E3));for(var b=S6(),c=1,d=a;g.Oa(b,d);)c++,d=a+"#"+c;return T6=d},V6=function(){var a=S6(),b=U6();
g.Oa(a,b);g.pG()&&g.ib(a,b);a=Aya(a);if(g.Pa(a))try{g.nG.remove("remote_sid","/","youtube.com")}catch(c){}else try{g.oG("remote_sid",a.join(","),-1)}catch(c){}},Cya=function(){return g.kG("yt-remote-session-browser-channel")},Dya=function(){return g.kG("yt-remote-local-screens")||[]},Eya=function(){g.jG("yt-remote-lounge-token-expiration",!0,86400)},Fya=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=(0,g.H)(Dya(),function(a){return a.loungeToken}),c=(0,g.H)(a,function(a){return a.loungeToken});
(0,g.Wl)(c,function(a){return!g.Oa(b,a)})&&Eya();
g.jG("yt-remote-local-screens",a,31536E3)},Gya=function(a,b){g.jG("yt-remote-session-browser-channel",a);
g.jG("yt-remote-session-screen-id",b);var c=S6(),d=U6();g.Oa(c,d)||c.push(d);Bya(c);V6()},W6=function(a){a||(g.lG("yt-remote-session-screen-id"),g.lG("yt-remote-session-video-id"));
V6();a=S6();g.Ta(a,U6());Bya(a)},Hya=function(){if(!X6){var a=g.QC();
a&&(X6=new g.EC(a))}return X6?!!X6.get("yt-remote-use-staging-server"):!1},Iya=function(){var a=window.document.createElement("a");
g.Tc(a,"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js");a=a.href.replace(/^[a-zA-Z]+:\/\//,"//");return"js-"+g.Bb(a)},Jya=function(a,b){var c=g.zd("SCRIPT");
c.id=a;c.onload=function(){b&&(0,window.setTimeout)(b,0)};
c.onreadystatechange=function(){switch(c.readyState){case "loaded":case "complete":c.onload()}};
g.Uc(c,g.Yd("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"));var d=window.document.getElementsByTagName("head")[0]||window.document.body;d.insertBefore(c,d.firstChild);return c},Kya=function(){var a=Iya(),b=window.document.getElementById(a),c=b&&g.DE(b,"loaded");
c||b&&!c||(b=Jya(a,function(){g.DE(b,"loaded")||(g.CE(b,"loaded","true"),g.vF(a),g.yD(g.Ea(sya,a),0))}))},Y6=function(a){return!!window.document.currentScript&&(-1!=window.document.currentScript.src.indexOf("?"+a)||-1!=window.document.currentScript.src.indexOf("&"+a))},Lya=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},Z6=function(a){a.length?Mya(a.shift(),function(){Z6(a)}):$6()},Nya=function(a){return"chrome-extension://"+a+a7},Mya=function(a,
b,c){var d=window.document.createElement("script");
d.onerror=b;c&&(d.onload=c);d.src=a;(window.document.head||window.document.documentElement).appendChild(d)},b7=function(a){return 0<=window.navigator.userAgent.indexOf(a)},$6=function(){var a=Lya();
a&&a(!1,"No cast extension found")},c7=function(){if(Oya){var a=2,b=Lya(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;Mya("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",$6,c)}},Pya=function(){var a=window.__gCrWeb&&window.__gCrWeb.message&&window.__gCrWeb.message.invokeOnHost;
a&&(c7(),a({command:"cast.sender.init"}))},Qya=function(){c7();
var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);Z6(["//www.gstatic.com/eureka/clank/"+(a?(0,window.parseInt)(a[1],10):0)+a7,"//www.gstatic.com/eureka/clank"+a7])},d7=function(a,b,c){g.K.call(this);
this.C=null!=c?(0,g.z)(a,c):a;this.uc=b;this.B=(0,g.z)(this.JH,this);this.g=!1;this.l=0;this.o=this.wa=null;this.A=[]},e7=function(){},f7=function(a,b,c,d){this.g=a;
this.o=b;this.F=c;this.D=d||1;this.B=45E3;this.A=new g.Dm(this);this.l=new g.mg;this.l.setInterval(250)},Sya=function(a,b,c){a.oj=1;
a.jh=I6(b.clone());a.Gi=c;a.C=!0;Rya(a,null)},g7=function(a,b,c,d,e){a.oj=1;
a.jh=I6(b.clone());a.Gi=null;a.C=c;e&&(a.dC=!1);Rya(a,d)},Rya=function(a,b){a.Rj=(0,g.G)();
h7(a);a.Bh=a.jh.clone();J6(a.Bh,"t",a.D);a.Rl=0;a.Pc=a.g.Aq(a.g.Kl()?b:null);0<a.dr&&(a.Qo=new g.Ik((0,g.z)(a.sD,a,a.Pc),a.dr));a.A.R(a.Pc,"readystatechange",a.HS);var c=a.gi?g.Yb(a.gi):{};a.Gi?(a.zp="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.Pc.send(a.Bh,a.zp,a.Gi,c)):(a.zp="GET",a.dC&&!g.ud&&(c.Connection="close"),a.Pc.send(a.Bh,a.zp,null,c));a.g.uf(1)},Vya=function(a,b,c){for(var d=!0;!a.Ph&&a.Rl<c.length;){var e=Tya(a,c);
if(e==i7){4==b&&(a.kh=4,j7(15),d=!1);break}else if(e==Uya){a.kh=4;j7(16);d=!1;break}else k7(a,e)}4==b&&0==c.length&&(a.kh=1,j7(17),d=!1);a.yf=a.yf&&d;d||(l7(a),m7(a))},Tya=function(a,b){var c=a.Rl,d=b.indexOf("\n",c);
if(-1==d)return i7;c=Number(b.substring(c,d));if((0,window.isNaN)(c))return Uya;d+=1;if(d+c>b.length)return i7;var e=b.substr(d,c);a.Rl=d+c;return e},Xya=function(a,b){a.Rj=(0,g.G)();
h7(a);var c=b?window.location.hostname:"";a.Bh=a.jh.clone();g.wm(a.Bh,"DOMAIN",c);g.wm(a.Bh,"t",a.D);try{a.zf=new window.ActiveXObject("htmlfile")}catch(n){l7(a);a.kh=7;j7(22);m7(a);return}var d="<html><body>";if(b){for(var e="",f=0;f<c.length;f++){var k=c.charAt(f);if("<"==k)e+="\\x3c";else if(">"==k)e+="\\x3e";else{var l=k;if(l in n7)k=n7[l];else if(l in Wya)k=n7[l]=Wya[l];else{var m=l.charCodeAt(0);if(31<m&&127>m)k=l;else{if(256>m){if(k="\\x",16>m||256<m)k+="0"}else k="\\u",4096>m&&(k+="0");k+=
m.toString(16).toUpperCase()}k=n7[l]=k}e+=k}}d+='<script>document.domain="'+e+'"\x3c/script>'}d+="</body></html>";c=g.Vc(g.sc("b/12014412"),d);a.zf.open();a.zf.write(g.Nc(c));a.zf.close();a.zf.parentWindow.m=(0,g.z)(a.MR,a);a.zf.parentWindow.d=(0,g.z)(a.uB,a,!0);a.zf.parentWindow.rpcClose=(0,g.z)(a.uB,a,!1);c=a.zf.createElement("DIV");a.zf.parentWindow.document.body.appendChild(c);d=g.Ec(a.Bh.toString());d=g.pb(g.Bc(d));d=g.Vc(g.sc("b/12014412"),'<iframe src="'+d+'"></iframe>');c.innerHTML=g.Nc(d);
a.g.uf(1)},h7=function(a){a.Ju=(0,g.G)()+a.B;
Yya(a,a.B)},Yya=function(a,b){if(null!=a.lk)throw Error("WatchDog timer not null");
a.lk=o7((0,g.z)(a.dS,a),b)},p7=function(a){a.lk&&(g.w.clearTimeout(a.lk),a.lk=null)},m7=function(a){a.g.Cx()||a.Ph||a.g.Fo(a)},l7=function(a){p7(a);
g.Ue(a.Qo);a.Qo=null;a.l.stop();g.Jm(a.A);if(a.Pc){var b=a.Pc;a.Pc=null;b.abort();b.dispose()}a.zf&&(a.zf=null)},k7=function(a,b){try{a.g.nB(a,b),a.g.uf(4)}catch(c){}},$ya=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;Zya(a,b,function(e){e?c(!0):g.w.setTimeout(function(){$ya(a,b,c,d,f)},f)})}},Zya=function(a,b,c){var d=new window.Image;
d.onload=function(){try{q7(d),c(!0)}catch(e){}};
d.onerror=function(){try{q7(d),c(!1)}catch(e){}};
d.onabort=function(){try{q7(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{q7(d),c(!1)}catch(e){}};
g.w.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
d.src=a},q7=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},aza=function(a){this.g=a;
this.l=new e7},bza=function(a){var b=r7(a.g,a.qk,"/mail/images/cleardot.gif");
I6(b);$ya(b.toString(),5E3,(0,g.z)(a.VG,a),3,2E3);a.uf(1)},t7=function(a){var b=a.g.H;
if(null!=b)j7(5),b?(j7(11),s7(a.g,a,!1)):(j7(12),s7(a.g,a,!0));else if(a.se=new f7(a,void 0,void 0,void 0),a.se.gi=a.Yq,b=a.g,b=r7(b,b.Kl()?a.Ok:null,a.ar),j7(5),!g.sd||g.oc(10))J6(b,"TYPE","xmlhttp"),g7(a.se,b,!1,a.Ok,!1);else{J6(b,"TYPE","html");var c=a.se;a=!!a.Ok;c.oj=3;c.jh=I6(b.clone());Xya(c,a)}},u7=function(a,b,c){this.g=1;
this.l=[];this.A=[];this.B=new e7;this.F=a||null;this.H=null!=b?b:null;this.C=c||!1},cza=function(a,b){this.g=a;
this.map=b;this.context=null},dza=function(a){g.We.call(this,"statevent",a)},eza=function(a,b){g.We.call(this,"timingevent",a);
this.size=b},fza=function(a){g.We.call(this,"serverreachability",a)},iza=function(a){gza(a);
if(3==a.g){var b=a.wl++,c=a.yn.clone();g.wm(c,"SID",a.o);g.wm(c,"RID",b);g.wm(c,"TYPE","terminate");v7(a,c);b=new f7(a,a.o,b,void 0);b.oj=2;b.jh=I6(c.clone());(new window.Image).src=b.jh;b.Rj=(0,g.G)();h7(b)}hza(a)},jza=function(a){a.qH(1,0);
a.yn=r7(a,null,a.Xq);w7(a)},gza=function(a){a.Yg&&(a.Yg.abort(),a.Yg=null);
a.tc&&(a.tc.cancel(),a.tc=null);a.pg&&(g.w.clearTimeout(a.pg),a.pg=null);x7(a);a.Pd&&(a.Pd.cancel(),a.Pd=null);a.ah&&(g.w.clearTimeout(a.ah),a.ah=null)},kza=function(a,b){if(0==a.g)throw Error("Invalid operation: sending map when state is closed");
a.l.push(new cza(a.HN++,b));2!=a.g&&3!=a.g||w7(a)},w7=function(a){a.Pd||a.ah||(a.ah=o7((0,g.z)(a.sB,a),0),a.gj=0)},mza=function(a,b){if(1==a.g){if(!b){a.wl=Math.floor(1E5*Math.random());
var c=a.wl++,d=new f7(a,"",c,void 0);d.gi=null;var e=y7(a),f=a.yn.clone();g.wm(f,"RID",c);g.wm(f,"CVER","1");v7(a,f);Sya(d,f,e);a.Pd=d;a.g=2}}else 3==a.g&&(b?lza(a,b):0==a.l.length||a.Pd||lza(a))},lza=function(a,b){if(b)if(6<a.Rh){a.l=a.A.concat(a.l);
a.A.length=0;var c=a.wl-1;var d=y7(a)}else c=b.F,d=b.Gi;else c=a.wl++,d=y7(a);var e=a.yn.clone();g.wm(e,"SID",a.o);g.wm(e,"RID",c);g.wm(e,"AID",a.Bj);v7(a,e);c=new f7(a,a.o,c,a.gj+1);c.gi=null;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.Pd=c;Sya(c,e,d)},v7=function(a,b){if(a.od){var c=a.od.fx();
c&&g.Ib(c,function(a,c){g.wm(b,c,a)})}},y7=function(a){var b=Math.min(a.l.length,1E3),c=["count="+b];
if(6<a.Rh&&0<b){var d=a.l[0].g;c.push("ofs="+d)}else d=0;for(var e=0;e<b;e++){var f=a.l[e].g,k=a.l[e].map;f=6>=a.Rh?e:f-d;try{g.Ib(k,function(a,b){c.push("req"+f+"_"+b+"="+(0,window.encodeURIComponent)(a))})}catch(l){c.push("req"+f+"_type="+(0,window.encodeURIComponent)("_badmap"))}}a.A=a.A.concat(a.l.splice(0,b));
return c.join("&")},nza=function(a){a.tc||a.pg||(a.D=1,a.pg=o7((0,g.z)(a.rB,a),0),a.Wi=0)},z7=function(a){if(a.tc||a.pg||3<=a.Wi)return!1;
a.D++;a.pg=o7((0,g.z)(a.rB,a),oza(a,a.Wi));a.Wi++;return!0},s7=function(a,b,c){a.yp=c;
a.jf=b.wg;a.C||jza(a)},x7=function(a){null!=a.Th&&(g.w.clearTimeout(a.Th),a.Th=null)},oza=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},A7=function(a,b){if(2==b||9==b){var c=null;
a.od&&(c=null);var d=(0,g.z)(a.zT,a);c||(c=new g.nm("//www.google.com/images/cleardot.gif"),I6(c));Zya(c.toString(),1E4,d)}else j7(2);pza(a,b)},pza=function(a,b){a.g=0;
a.od&&a.od.cw(b);hza(a);gza(a)},hza=function(a){a.g=0;
a.jf=-1;if(a.od)if(0==a.A.length&&0==a.l.length)a.od.nq();else{g.Wa(a.A);var b=g.Wa(a.l);a.A.length=0;a.l.length=0;a.od.nq(b)}},r7=function(a,b,c){var d=g.xm(c);
if(""!=d.l)b&&g.pm(d,b+"."+d.l),g.qm(d,d.B);else{var e=window.location;d=qya(e.protocol,b?b+"."+e.hostname:e.hostname,e.port,c)}a.Bk&&g.Ib(a.Bk,function(a,b){g.wm(d,b,a)});
g.wm(d,"VER",a.Rh);v7(a,d);return d},o7=function(a,b){if(!g.Aa(a))throw Error("Fn must not be null and must be a function");
return g.w.setTimeout(function(){a()},b)},j7=function(a){B7.dispatchEvent(new dza(B7,a))},qza=function(){},rza=function(a,b){this.action=a;
this.params=b||{}},D7=function(a,b){g.K.call(this);
this.g=new g.Mt(this.o,0,this);g.M(this,this.g);this.l=this.uc=0;if(g.Aa(a))b&&(a=(0,g.z)(a,b));else if(a&&g.Aa(a.handleEvent))a=(0,g.z)(a.handleEvent,a);else throw Error("Invalid listener argument");this.A=a;C7(this)},C7=function(a){a.g.stop();
a.uc=5E3+2E4*Math.random()},E7=function(a,b,c){this.K=a;
this.C=b;this.o=new g.DC;this.l=new D7(this.iU,this);this.g=this.Za=null;this.I=!1;this.B=null;this.H="";this.F=this.A=0;this.D=[];this.M=c||!1},sza=function(a){return{firstTestResults:[""],
secondTestResults:!a.g.yp,sessionId:a.g.o,arrayId:a.g.Bj}},tza=function(a,b){a.F=b||0;
a.l.stop();a.g&&(3==a.g.g&&mza(a.g),iza(a.g));a.F=0},F7=function(a){return!!a.g&&3==a.g.g},uza=function(a,b){(a.C.loungeIdToken=b)||a.l.stop()},G7=function(a){this.port=this.domain="";
this.g="/api/lounge";this.l=!0;a=a||window.document.location.href;var b=g.Cg(a)||"";b&&(this.port=":"+b);this.domain=g.Bg(a)||"";a=g.Gb;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.Ab(a,"10.0")&&(this.l=!1))},H7=function(a,b){var c=a.g;
if(g.t(void 0)?0:a.l)c="https://"+a.domain+a.port+a.g;return g.Lg(c+b,{})},I7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,Hb:g.Ea(a.A,d,!0),onError:g.Ea(a.o,e),sd:g.Ea(a.B,e)};c&&(a.Lb=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.OD(b,a)},yza=function(){var a=vza;
wza();J7.push(a);xza(J7)},K7=function(a,b){wza();
var c=J7,d=zza(a,String(b));g.Pa(c)?Aza(d):(xza(c),(0,g.C)(c,function(a){a(d)}))},wza=function(){J7||(J7=g.x("yt.mdx.remote.debug.handlers_")||[],g.va("yt.mdx.remote.debug.handlers_",J7,void 0))},Aza=function(a){var b=(L7+1)%50;
L7=b;M7[b]=a;N7||(N7=49==b)},xza=function(a){var b=M7;
if(b[0]){var c=L7,d=N7?c:-1;do{d=(d+1)%50;var e=b[d];(0,g.C)(a,function(a){a(e)})}while(d!=c);
M7=Array(50);L7=-1;N7=!1}},zza=function(a,b){var c=((0,g.G)()-Bza)/1E3;
c.toFixed&&(c=c.toFixed(3));var d=[];d.push("[",c+"s","] ");d.push("[","yt.mdx.remote","] ");d.push(a+": "+b,"\n");return d.join("")},O7=function(a){g.hF.call(this);
this.D=a;this.g=[]},Cza=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c){var d=c.name;c.id=b.id||c.id;c.name=b.name;c.token=b.token;c.uuid=b.uuid||c.uuid;return c.name!=d}a.g.push(b);return!0},Dza=function(a,b){var c=a.g.length!=b.length;
a.g=(0,g.Hd)(a.g,function(a){return!!Q6(b,a)});
for(var d=0,e=b.length;d<e;d++)c=Cza(a,b[d])||c;return c},Eza=function(a,b){var c=a.g.length;
a.g=(0,g.Hd)(a.g,function(a){return!(a||b?!a!=!b?0:a.id==b.id:1)});
return a.g.length<c},P7=function(a,b,c,d){g.hF.call(this);
this.C=a;this.B=b;this.o=c;this.A=d;this.l=0;this.g=null;this.wa=window.NaN},R7=function(a){O7.call(this,"LocalScreenService");
this.o=a;this.l=window.NaN;Q7(this);this.info("Initializing with "+O6(this.g))},Fza=function(a){if(a.g.length){var b=(0,g.H)(a.g,function(a){return a.id}),c=H7(a.o,"/pairing/get_lounge_token_batch");
I7(a.o,c,{screen_ids:b.join(",")},(0,g.z)(a.VH,a),(0,g.z)(a.UH,a))}},Q7=function(a){var b=yya(Dya());
b=(0,g.Hd)(b,function(a){return!a.uuid});
return Dza(a,b)},S7=function(a,b){Fya((0,g.H)(a.g,wya));
b&&Eya()},U7=function(a,b){g.hF.call(this);
this.C=b;var c=g.kG("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.C(),f=0,k=e.length;f<k;++f){var l=e[f].id;d[l]=g.Oa(c,l)}this.g=d;this.B=a;this.o=this.A=window.NaN;this.l=null;T7("Initialized with "+g.tg(this.g))},Gza=function(a,b,c){var d=H7(a.B,"/pairing/get_screen_availability");
I7(a.B,d,{lounge_token:b.token},(0,g.z)(function(a){a=a.screens||[];for(var d=0,e=a.length;d<e;++d)if(a[d].loungeToken==b.token){c("online"==a[d].status);return}c(!1)},a),(0,g.z)(function(){c(!1)},a))},V7=function(a,b){a:if(g.Mb(b)!=g.Mb(a.g))var c=!1;
else{c=g.Ob(b);for(var d=0,e=c.length;d<e;++d)if(!a.g[c[d]]){c=!1;break a}c=!0}c||(T7("Updated online screens: "+g.tg(a.g)),a.g=b,a.P("screenChange"));Hza(a)},W7=function(a){(0,window.isNaN)(a.o)||g.AD(a.o);
a.o=g.yD((0,g.z)(a.Vt,a),0<a.A&&a.A<(0,g.G)()?2E4:1E4)},T7=function(a){K7("OnlineScreenService",a)},Iza=function(a){var b={};
(0,g.C)(a.C(),function(a){a.token?b[a.token]=a.id:this.fc("Requesting availability of screen w/o lounge token.")});
return b},Hza=function(a){a=g.Ob(g.Jb(a.g,function(a){return a}));
g.fb(a);a.length?g.jG("yt-remote-online-screen-ids",a.join(","),60):g.lG("yt-remote-online-screen-ids")},X7=function(a){O7.call(this,"ScreenService");
this.C=a;this.l=this.o=null;this.A=[];this.B={};Jza(this)},Lza=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.B[b]);var k=a.ke();if(k=(c?R6(k,c):null)||R6(k,b)){k.uuid=b;var l=Y7(a,k);Gza(a.l,l,function(a){e(a?l:null)})}else c?Kza(a,c,(0,g.z)(function(a){var f=Y7(this,new L6({name:d,
screenId:c,loungeToken:a,dialId:b||""}));Gza(this.l,f,function(a){e(a?f:null)})},a),f):e(null)},Mza=function(a,b){for(var c=0,d=a.g.length;c<d;++c)if(a.g[c].name==b)return a.g[c];
return null},Kza=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={Lb:{screen_ids:b},method:"POST",context:a,Hb:function(a,e){var f=e&&e.screens||[];f[0]&&f[0].screenId==b?c(f[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.OD(H7(a.C,"/pairing/get_lounge_token_batch"),e)},Nza=function(a){a.g=a.o.ke();
var b=a.B,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.g.length;b<d;++b){var e=a.g[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+O6(a.g))},Jza=function(a){Z7(a);
a.o=new R7(a.C);a.o.subscribe("screenChange",(0,g.z)(a.lI,a));Nza(a);a.A=yya(g.kG("yt-remote-automatic-screen-cache")||[]);Z7(a);a.info("Initializing automatic screens: "+O6(a.A));a.l=new U7(a.C,(0,g.z)(a.ke,a,!0));a.l.subscribe("screenChange",(0,g.z)(function(){this.P("onlineScreenChange")},a))},Y7=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=R6(a.A,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.A.push(b),g.jG("yt-remote-automatic-screen-cache",(0,g.H)(a.A,wya)));Z7(a);a.B[b.uuid]=b.id;g.jG("yt-remote-device-id-map",a.B,31536E3);return b},Z7=function(a){a.B=g.kG("yt-remote-device-id-map")||{}},$7=function(a,b,c){g.hF.call(this);
this.M=c;this.H=a;this.l=b;this.o=null},a8=function(a,b){K7(a.M,b)},b8=function(a,b){$7.call(this,a,b,"CastSession");
this.g=null;this.A=0;this.C=(0,g.z)(this.oU,this);this.B=(0,g.z)(this.nS,this);this.A=g.yD((0,g.z)(function(){Oza(this,null)},this),12E4)},Pza=function(a){a.info("sendYoutubeMessage_: getMdxSessionStatus "+g.tg(void 0));
var b={type:"getMdxSessionStatus"};a.g?a.g.sendMessage("urn:x-cast:com.google.youtube.mdx",b,g.y,(0,g.z)(function(){a8(this,"Failed to send message: getMdxSessionStatus.")},a)):a8(a,"Sending yt message without session: "+g.tg(b))},Oza=function(a,b){g.AD(a.A);
if(b){if(a.info("onConnectedScreenId_: Received screenId: "+b),!a.o||a.o.id!=b){var c=(0,g.z)(a.Go,a),d=(0,g.z)(a.qe,a);a.vx(b,c,d,5)}}else a.qe(Error("Waiting for session status timed out."))},c8=function(a,b,c){$7.call(this,a,b,"DialSession");
this.A=this.F=null;this.I="";this.N=c;this.B=null;this.D=g.y;this.C=window.NaN;this.K=(0,g.z)(this.rU,this);this.g=g.y},Qza=function(a){a.g=a.H.yD(a.I,a.l.label,a.l.friendlyName,(0,g.z)(function(a){this.g=g.y;
this.Go(a)},a),(0,g.z)(function(a){this.g=g.y;
this.qe(a)},a))},Rza=function(a){var b={};
b.pairingCode=a.I;b.theme=a.N;if(a.B){var c=a.B.currentTime||0;b.v=a.B.videoId;b.t=c}Hya()&&(b.env_useStageMdx=1);return g.Jg(b)},d8=function(a,b){$7.call(this,a,b,"ManualSession");
this.g=g.yD((0,g.z)(this.Cj,this,null),150)},e8=function(a,b,c,d){g.hF.call(this);
this.l=a;this.D=b||"233637DE";this.C=c||"cl";this.F=d||!1;this.g=null;this.B=!1;this.o=[];this.A=(0,g.z)(this.TQ,this)},Sza=function(a,b){return b?g.Ka(a.o,function(a){return M6(b,a.label)},a):null},f8=function(a){K7("Controller",a)},vza=function(a){window.chrome&&window.chrome.cast&&window.chrome.cast.logMessage&&window.chrome.cast.logMessage(a)},g8=function(a){return a.B||!!a.o.length||!!a.g},h8=function(a,b,c){b!=a.g&&(g.Ue(a.g),(a.g=b)?(c?a.P("yt-remote-cast2-receiver-resumed",b.l):a.P("yt-remote-cast2-receiver-selected",
b.l),b.subscribe("sessionScreen",(0,g.z)(a.pB,a,b)),b.o?a.P("yt-remote-cast2-session-change",b.o):c&&a.g.Cj(null)):a.P("yt-remote-cast2-session-change",null))},Tza=function(a){var b=a.l.xD(),c=a.g&&a.g.l;
a=(0,g.H)(b,function(a){c&&M6(a,c.label)&&(c=null);var b=a.uuid?a.uuid:a.id,d=Sza(this,a);d?(d.label=b,d.friendlyName=a.name):(d=new window.chrome.cast.Receiver(b,a.name),d.receiverType=window.chrome.cast.ReceiverType.CUSTOM);return d},a);
c&&(c.receiverType!=window.chrome.cast.ReceiverType.CUSTOM&&(c=new window.chrome.cast.Receiver(c.label,c.friendlyName),c.receiverType=window.chrome.cast.ReceiverType.CUSTOM),a.push(c));return a},Zza=function(a,b,c,d,e,f,k){Uza()?Vza(b,e,f,k)&&(j8(!0),window.chrome&&window.chrome.cast&&window.chrome.cast.isAvailable?Wza(a,c):(window.__onGCastApiAvailable=function(b,d){b?Wza(a,c):(k8("Failed to load cast API: "+d),l8(!1),j8(!1),g.lG("yt-remote-cast-available"),g.lG("yt-remote-cast-receiver"),Xza(),
c(!1))},d?window.spf?window.spf.script.load("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js","",void 0):Kya():b7("CriOS")?Pya():b7("Android")&&b7("Chrome/")&&window.navigator.presentation?Qya():window.chrome&&window.navigator.presentation&&!b7("Edge")?(c7(),Z6(Yza.map(Nya))):$6())):i8("Cannot initialize because not running Chrome")},Xza=function(){i8("dispose");
var a=m8();a&&a.dispose();g.va("yt.mdx.remote.cloudview.instance_",null,void 0);$za(!1);g.tF(n8);n8.length=0},o8=function(){return!!g.kG("yt-remote-cast-installed")},aAa=function(){var a=g.kG("yt-remote-cast-receiver");
return a?a.friendlyName:null},bAa=function(){i8("clearCurrentReceiver");
g.lG("yt-remote-cast-receiver")},cAa=function(){return o8()?m8()?m8().getCastSession():(k8("getCastSelector: Cast is not initialized."),null):(k8("getCastSelector: Cast API is not installed!"),null)},q8=function(){o8()?m8()?p8()?(i8("Requesting cast selector."),m8().requestSession()):(i8("Wait for cast API to be ready to request the session."),n8.push(g.sF("yt-remote-cast2-api-ready",q8))):k8("requestCastSelector: Cast is not initialized."):k8("requestCastSelector: Cast API is not installed!")},r8=
function(a,b){p8()?m8().setConnectedScreenStatus(a,b):k8("setConnectedScreenStatus called before ready.")},Uza=function(){var a=0<=g.Gb.search(/ (CrMo|Chrome|CriOS)\//);
return g.aJ||a},dAa=function(a,b){m8().init(a,b)},Vza=function(a,b,c,d){var e=!1;
m8()||(a=new e8(a,b,c,d),a.subscribe("yt-remote-cast2-availability-change",function(a){g.jG("yt-remote-cast-available",a);g.wF("yt-remote-cast2-availability-change",a)}),a.subscribe("yt-remote-cast2-receiver-selected",function(a){i8("onReceiverSelected: "+a.friendlyName);
g.jG("yt-remote-cast-receiver",a);g.wF("yt-remote-cast2-receiver-selected",a)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(a){i8("onReceiverResumed: "+a.friendlyName);
g.jG("yt-remote-cast-receiver",a)}),a.subscribe("yt-remote-cast2-session-change",function(a){i8("onSessionChange: "+N6(a));
a||g.lG("yt-remote-cast-receiver");g.wF("yt-remote-cast2-session-change",a)}),g.va("yt.mdx.remote.cloudview.instance_",a,void 0),e=!0);
i8("cloudview.createSingleton_: "+e);return e},m8=function(){return g.x("yt.mdx.remote.cloudview.instance_")},Wza=function(a,b){l8(!0);
j8(!1);dAa(a,function(a){a?($za(!0),g.vF("yt-remote-cast2-api-ready")):(k8("Failed to initialize cast API."),l8(!1),g.lG("yt-remote-cast-available"),g.lG("yt-remote-cast-receiver"),Xza());b(a)})},i8=function(a){K7("cloudview",a)},k8=function(a){K7("cloudview",a)},l8=function(a){i8("setCastInstalled_ "+a);
g.jG("yt-remote-cast-installed",a)},p8=function(){return!!g.x("yt.mdx.remote.cloudview.apiReady_")},$za=function(a){i8("setApiReady_ "+a);
g.va("yt.mdx.remote.cloudview.apiReady_",a,void 0)},j8=function(a){g.va("yt.mdx.remote.cloudview.initializing_",a,void 0)},s8=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.g=-1;this.muted=!1;this.audioTrackId=null;this.D=this.F=0;this.l=null;this.hasNext=this.Mf=!1;this.I=this.H=this.o=this.B=0;this.A=window.NaN;this.C=!1;this.reset(a)},t8=function(a){a.audioTrackId=null;
a.l=null;a.g=-1;a.Mf=!1;a.hasNext=!1;a.F=0;a.D=(0,g.G)();a.B=0;a.o=0;a.H=0;a.I=0;a.A=window.NaN;a.C=!1},u8=function(a){return a.kb()?((0,g.G)()-a.D)/1E3:0},v8=function(a,b){a.F=b;
a.D=(0,g.G)()},w8=function(a){switch(a.g){case 1:case 1081:return((0,g.G)()-a.D)/1E3+a.F;
case -1E3:return 0}return a.F},x8=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&t8(a)},y8=function(a){var b={};
b.index=a.index;b.listId=a.listId;b.videoId=a.videoId;b.playerState=a.g;b.volume=a.volume;b.muted=a.muted;b.audioTrackId=a.audioTrackId;b.trackData=g.$b(a.l);b.hasPrevious=a.Mf;b.hasNext=a.hasNext;b.playerTime=a.F;b.playerTimeAt=a.D;b.seekableStart=a.B;b.seekableEnd=a.o;b.duration=a.H;b.loadedTime=a.I;b.liveIngestionTime=a.A;return b},A8=function(a,b){g.hF.call(this);
this.g=0;this.A=a;this.C=[];this.B=new g.UB;this.o=this.l=null;this.H=(0,g.z)(this.qO,this);this.D=(0,g.z)(this.zl,this);this.F=(0,g.z)(this.pO,this);this.I=(0,g.z)(this.DO,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.Pu,this),eAa(this))):c=3;0!=c&&(b?this.Pu(c):g.yD((0,g.z)(function(){this.Pu(c)},this),0));
var d=cAa();d&&z8(this,d);this.subscribe("yt-remote-cast2-session-change",this.I)},B8=function(a){return new s8(a.A.getPlayerContextData())},eAa=function(a){(0,g.C)("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(a){this.C.push(this.A.subscribe(a,g.Ea(this.PQ,a),this))},a)},fAa=function(a){(0,g.C)(a.C,function(a){this.A.unsubscribeByKey(a)},a);
a.C.length=0},C8=function(a,b){50>a.B.Lc()&&g.WB(a.B,b)},E8=function(a,b,c){var d=B8(a);
v8(d,c);-1E3!=d.g&&(d.g=b);D8(a,d)},F8=function(a,b,c){a.A.sendMessage(b,c)},D8=function(a,b){fAa(a);
a.A.setPlayerContextData(y8(b));eAa(a)},z8=function(a,b){a.o&&(a.o.removeUpdateListener(a.H),a.o.removeMediaListener(a.D),a.zl(null));
a.o=b;a.o&&(K7("CP","Setting cast session: "+a.o.sessionId),a.o.addUpdateListener(a.H),a.o.addMediaListener(a.D),a.o.media.length&&a.zl(a.o.media[0]))},gAa=function(a){var b=a.l.media,c=a.l.customData;
if(b&&c){var d=B8(a);b.contentId!=d.videoId&&K7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.g=c.playerState;v8(d,a.l.getEstimatedTime());D8(a,d)}else K7("CP","No cast media video. Ignoring state update.")},G8=function(a,b,c){return(0,g.z)(function(a){this.fc("Failed to "+b+" with cast v2 channel. Error code: "+a.code);
a.code!=window.chrome.cast.ErrorCode.TIMEOUT&&(this.fc("Retrying "+b+" using MDx browser channel."),F8(this,b,c))},a)},H8=function(a,b,c){g.hF.call(this);
this.B=window.NaN;this.N=!1;this.I=this.H=this.K=this.M=window.NaN;this.V=[];this.A=this.D=this.o=this.bb=this.g=null;this.na=a;this.V.push(g.SE(window,"beforeunload",(0,g.z)(this.MH,this)));this.l=[];this.bb=new s8;this.X=b.id;this.g=hAa(this,c);this.g.subscribe("handlerOpened",this.uO,this);this.g.subscribe("handlerClosed",this.rO,this);this.g.subscribe("handlerError",this.sO,this);this.g.subscribe("handlerMessage",this.tO,this);uza(this.g,b.token);this.subscribe("remoteQueueChange",function(){var a=
this.bb.videoId;g.pG()&&g.jG("yt-remote-session-video-id",a)},this)},I8=function(a){K7("conn",a)},hAa=function(a,b){return new E7(H7(a.na,"/bc"),b)},J8=function(a,b){a.P("proxyStateChange",b)},iAa=function(a){a.B=g.yD((0,g.z)(function(){I8("Connecting timeout");
this.C(1)},a),2E4)},K8=function(a){g.AD(a.B);
a.B=window.NaN},L8=function(a){g.AD(a.M);
a.M=window.NaN},jAa=function(a){M8(a);
a.K=g.yD((0,g.z)(function(){N8(this,"getNowPlaying")},a),2E4)},M8=function(a){g.AD(a.K);
a.K=window.NaN},lAa=function(a,b){b&&(K8(a),L8(a));
b==(F7(a.g)&&(0,window.isNaN)(a.B))?b&&(J8(a,1),N8(a,"getSubtitlesTrack")):b?(a.W()&&a.bb.reset(),J8(a,1),N8(a,"getNowPlaying"),kAa(a)):a.C(1)},mAa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.bb.videoId&&(g.Ub(b.params)?a.bb.l=null:a.bb.l=b.params,a.P("remotePlayerChange"))},nAa=function(a,b){var c=b.params.videoId||b.params.video_id,d=(0,window.parseInt)(b.params.currentIndex,10);
a.bb.listId=b.params.listId||a.bb.listId;x8(a.bb,c,d);a.P("remoteQueueChange")},pAa=function(a,b){b.params=b.params||{};
nAa(a,b);oAa(a,b);a.P("autoplayDismissed")},oAa=function(a,b){var c=(0,window.parseInt)(b.params.currentTime||b.params.current_time,10);
v8(a.bb,(0,window.isNaN)(c)?0:c);c=(0,window.parseInt)(b.params.state,10);c=(0,window.isNaN)(c)?-1:c;-1==c&&-1E3==a.bb.g&&(c=-1E3);a.bb.g=c;c=Number(b.params.loadedTime);a.bb.I=(0,window.isNaN)(c)?0:c;c=Number(b.params.duration);a.bb.H=(0,window.isNaN)(c)?0:c;c=a.bb;var d=Number(b.params.liveIngestionTime);c.A=d;c.C=(0,window.isNaN)(d)?!1:!0;c=a.bb;d=Number(b.params.seekableStartTime);var e=Number(b.params.seekableEndTime);c.B=(0,window.isNaN)(d)?0:d;c.o=(0,window.isNaN)(e)?0:e;1==a.bb.g?jAa(a):M8(a);
a.P("remotePlayerChange")},qAa=function(a,b){if(-1E3!=a.bb.g){var c=1085;
switch((0,window.parseInt)(b.params.adState,10)){case 1:c=1081;break;case 2:c=1084;break;case 0:c=1083}a.bb.g=c;c=(0,window.parseInt)(b.params.currentTime,10);v8(a.bb,(0,window.isNaN)(c)?0:c);a.P("remotePlayerChange")}},rAa=function(a,b){var c="true"==b.params.muted;
a.bb.volume=(0,window.parseInt)(b.params.volume,10);a.bb.muted=c;a.P("remotePlayerChange")},sAa=function(a,b){a.D=b.params.videoId;
a.P("nowAutoplaying",(0,window.parseInt)(b.params.timeout,10))},tAa=function(a,b){var c="true"==b.params.hasNext;
a.bb.Mf="true"==b.params.hasPrevious;a.bb.hasNext=c;a.P("previousNextChange")},kAa=function(a){g.AD(a.I);
a.I=g.yD((0,g.z)(a.C,a,1),864E5)},N8=function(a,b,c){c?I8("Sending: action="+b+", params="+g.tg(c)):I8("Sending: action="+b);
a.g.sendMessage(b,c)},O8=function(a){O7.call(this,"ScreenServiceProxy");
this.bd=a;this.l=[];this.l.push(this.bd.$_s("screenChange",(0,g.z)(this.mU,this)));this.l.push(this.bd.$_s("onlineScreenChange",(0,g.z)(this.qQ,this)))},yAa=function(a){var b={device:"Desktop",
app:"youtube-desktop"};b=g.sD("MDX_CONFIG")||b;g.hG&&pya();V6();P8||(P8=new G7(b?b.loungeApiHost:void 0),Hya()&&(P8.g="/api/loungedev"));Q8||(Q8=g.x("yt.mdx.remote.deferredProxies_")||[],g.va("yt.mdx.remote.deferredProxies_",Q8,void 0));uAa();var c=R8();if(!c){var d=new X7(P8);g.va("yt.mdx.remote.screenService_",d,void 0);c=R8();var e=!1,f=void 0,k=void 0,l=!1;b&&(e=!!b.loadCastApiSetupScript,f=b.appId,k=b.theme,l=!!b.disableDial);Zza(a,d,function(a){a?S8()&&r8(S8(),"YouTube TV"):d.subscribe("onlineScreenChange",
function(){g.wF("yt-remote-receiver-availability-change")})},e,f,k,l)}b&&!g.x("yt.mdx.remote.initialized_")&&(g.va("yt.mdx.remote.initialized_",!0,void 0),T8("Initializing: "+g.tg(b)),U8.push(g.sF("yt-remote-cast2-availability-change",function(){g.wF("yt-remote-receiver-availability-change")})),U8.push(g.sF("yt-remote-cast2-receiver-selected",function(){V8(null);
g.wF("yt-remote-auto-connect","cast-selector-receiver")})),U8.push(g.sF("yt-remote-cast2-receiver-resumed",function(){g.wF("yt-remote-receiver-resumed","cast-selector-receiver")})),U8.push(g.sF("yt-remote-cast2-session-change",vAa)),U8.push(g.sF("yt-remote-connection-change",function(a){a?r8(S8(),"YouTube TV"):W8()||(r8(null,null),bAa())})),a=X8(),b.isAuto&&(a.id+="#dial"),g.iE("desktop_enable_autoplay")&&(a.capabilities=["atp"]),a.name=b.device,a.app=b.app,(k=b.theme)&&(a.theme=k),T8(" -- with channel params: "+
g.tg(a)),wAa(a),c.start(),S8()||xAa())},AAa=function(){var a=zAa();
o8()&&g.kG("yt-remote-cast-available")&&a.push({key:"cast-selector-receiver",name:"Cast..."});return a},zAa=function(){var a=R8().bd.$_gos();
var b=Y8();b&&Z8()&&(Q6(a,b)||a.push(b));return zya(a)},$8=function(){var a=BAa();
!a&&o8()&&aAa()&&(a={key:"cast-selector-receiver",name:aAa()});return a},BAa=function(){var a=zAa(),b=Y8();
b||(b=W8());return g.Ka(a,function(a){return b&&M6(b,a.key)?!0:!1})},Y8=function(){var a=S8();
if(!a)return null;var b=R8().ke();return R6(b,a)},vAa=function(a){T8("remote.onCastSessionChange_: "+N6(a));
if(a){var b=Y8();b&&b.id==a.id?r8(b.id,"YouTube TV"):(b&&a9(),b9(a,1))}else Z8()&&a9()},a9=function(){p8()?m8().stopSession():k8("stopSession called before API ready.");
var a=Z8();a&&(a.disconnect(1),c9(null))},d9=function(){var a=Z8();
return!!a&&3!=a.getProxyState()},T8=function(a){K7("remote",a)},R8=function(){if(!e9){var a=g.x("yt.mdx.remote.screenService_");
e9=a?new O8(a):null}return e9},S8=function(){return g.x("yt.mdx.remote.currentScreenId_")},CAa=function(a){g.va("yt.mdx.remote.currentScreenId_",a,void 0)},DAa=function(){return g.x("yt.mdx.remote.connectData_")},V8=function(a){g.va("yt.mdx.remote.connectData_",a,void 0)},Z8=function(){return g.x("yt.mdx.remote.connection_")},c9=function(a){var b=Z8();
V8(null);a||CAa("");g.va("yt.mdx.remote.connection_",a,void 0);Q8&&((0,g.C)(Q8,function(b){b(a)}),Q8.length=0);
b&&!a?g.wF("yt-remote-connection-change",!1):!b&&a&&g.wF("yt-remote-connection-change",!0)},W8=function(){var a=g.pG();
if(!a)return null;var b=R8().ke();return R6(b,a)},b9=function(a,b){Y8()&&Y8();
CAa(a.id);var c=new H8(P8,a,X8());c.connect(b,DAa());c.subscribe("beforeDisconnect",function(a){g.wF("yt-remote-before-disconnect",a)});
c.subscribe("beforeDispose",function(){Z8()&&c9(null)});
c9(c)},xAa=function(){var a=W8();
a?(T8("Resume connection to: "+N6(a)),b9(a,0)):(W6(),bAa(),T8("Skipping connecting because no session screen found."))},uAa=function(){var a=X8();
if(g.Ub(a)){a=U6();var b=g.kG("yt-remote-session-name")||"",c=g.kG("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.va("yt.mdx.remote.channelParams_",a,void 0)}},X8=function(){return g.x("yt.mdx.remote.channelParams_")||{}},wAa=function(a){a?(g.jG("yt-remote-session-app",a.app),g.jG("yt-remote-session-name",a.name)):(g.lG("yt-remote-session-app"),g.lG("yt-remote-session-name"));
g.va("yt.mdx.remote.channelParams_",a,void 0)},f9=function(a,b,c){g.K.call(this);
this.F=a;this.l=b;this.o=new g.eF(this);g.M(this,this.o);this.o.O(b,"onCaptionsTrackListChanged",this.JP);this.o.O(b,"captionschanged",this.oO);this.o.O(b,"captionssettingschanged",this.HC);this.o.O(b,"videoplayerreset",this.Ho);this.o.O(b,"mdxautoplaycancel",this.UG);this.V=this.o.O(b,"onVolumeChange",this.ZA);this.D=!1;this.g=c;c.subscribe("proxyStateChange",this.mB,this);c.subscribe("remotePlayerChange",this.Cl,this);c.subscribe("remoteQueueChange",this.Ho,this);c.subscribe("autoplayUpNext",this.IA,
this);c.subscribe("previousNextChange",this.jB,this);c.subscribe("nowAutoplaying",this.bB,this);c.subscribe("autoplayDismissed",this.HA,this);this.suggestion=null;this.H=new g.dO(64);this.A=new g.Mt(this.DC,500,this);g.M(this,this.A);this.B=new g.Mt(this.EC,1E3,this);g.M(this,this.B);this.K=new d7(this.LT,0,this);g.M(this,this.K);this.C={};this.M=new g.Mt(this.kD,1E3,this);g.M(this,this.M);this.I=new g.Ik(this.jL,1E3,this);g.M(this,this.I);this.N=g.y;this.HC();this.Ho();this.Cl()},g9=function(a,b){var c=
a.F,d=a.l.ea().lengthSeconds;
c.H=b||0;c.g.P("progresssync",b,d)},EAa=function(a){g9(a,0);
a.A.stop();h9(a,new g.dO(64))},j9=function(a,b){if(i9(a)&&!a.D){var c=null;
b&&(c={style:a.l.yi()},g.bc(c,b));a.g.vC(a.l.ea(1).videoId,c);a.C=B8(a.g).l}},k9=function(a,b){var c=a.l.Xf();
if(c){var d=c.ie();var e=c.listId.toString()}var f=a.l.ea(1);c=a.g;var k=f.videoId,l=d;d=f.playerParams;f=f.yj;var m=B8(c),n=e||m.listId;l=l||0;var q={videoId:k,currentIndex:l};x8(m,k,l);g.t(b)&&(v8(m,b),q.currentTime=b);g.t(n)&&(q.listId=n);null!=d&&(q.playerParams=d);null!=f&&(q.clickTrackingParams=f);F8(c,"setPlaylist",q);e||D8(c,m);h9(a,new g.dO(1))},FAa=function(a,b){if(b){var c=a.l.zc("captions","tracklist",{oy:1});
c&&c.length?(a.l.Hd("captions","track",b),a.D=!1):(a.l.pl("captions"),a.D=!0)}else a.l.Hd("captions","track",{})},i9=function(a){return B8(a.g).videoId==a.l.ea(1).videoId},h9=function(a,b){a.B.stop();
var c=a.H;if(!g.kO(c,b)){var d=g.V(b,2);d!=g.V(a.H,2)&&g.XT(a.l,d);a.H=b;GAa(a.F,c,b)}},l9=function(a){g.X.call(this,{G:"div",
L:"ytp-remote",J:[{G:"div",L:"ytp-remote-display-status",J:[{G:"div",L:"ytp-remote-display-status-icon",J:[g.SU()]},{G:"div",L:"ytp-remote-display-status-text",J:["{{statustext}}"]}]}]});this.l=new g.oV(this,250);g.M(this,this.l);this.o=a;this.O(a,"presentingplayerstatechange",this.A);HAa(this,g.UT(a))},HAa=function(a,b){if(3==a.o.Ra()){var c={RECEIVER_NAME:a.o.zc("remote","currentReceiver").name};
c=g.V(b,128)?g.U("YTP_MDX_STATUS_ERROR_2",c):b.kb()||g.V(b,4)?g.U("YTP_MDX_STATUS_PLAYING_2",c):g.U("YTP_MDX_STATUS_CONNECTED_2",c);a.updateValue("statustext",c);a.l.show()}else a.l.hide()},m9=function(a,b){g.r_.call(this,g.U("YTP_MDX_TITLE"),0,a,b);
this.l=a;this.F={};this.O(a,"onMdxReceiversChange",this.I);this.O(a,"presentingplayerstatechange",this.I);this.I()},n9=function(a){g.vU.call(this,a);
g.rG({YTP_MDX_CAST_SELECTOR:"Cast...",YTP_MDX_MY_COMPUTER:"This computer",YTP_MDX_PLAYER_ERROR:"This video is not available for remote playback.",YTP_MDX_STATUS_CONNECTED_2:"Connected to $RECEIVER_NAME",YTP_MDX_STATUS_ERROR_2:"Error on $RECEIVER_NAME",YTP_MDX_STATUS_PLAYING_2:"Playing on $RECEIVER_NAME",YTP_MDX_TITLE:"Play on"});this.o={key:P6(),name:g.U("YTP_MDX_MY_COMPUTER")};this.B=null;this.C=[];this.I=this.l=null;this.F=[this.o];this.A=this.o;this.D=new g.dO(64);this.H=0;if(!g.KL(g.W(this.g))){a=
this.g;var b=g.NT(a).H;b&&(b=b.l&&b.l.g)&&(b=new m9(a,b),g.M(this,b));b=new l9(a);g.M(this,b);g.pU(a,b.element,4)}},GAa=function(a,b,c){a.D=c;
a.g.P("presentingplayerstatechange",new g.qO(c,b))},o9=function(a,b){if(b.key!=a.A.key)if(b.key==a.o.key)a9();
else{a.A=b;var c=a.g.getPlaylistId();var d=a.g.ea(1),e=d.videoId;if(c||e){var f=a.g.Xf();if(f){var k=[];for(var l=0;l<f.getLength();l++)k[l]=f.jc(l).videoId}else k=[e];f=a.g.getCurrentTime(1);c={videoIds:k,listId:c,videoId:e,playerParams:d.playerParams,clickTrackingParams:d.yj,index:Math.max(a.g.Gz(),0),currentTime:0==f?void 0:f}}else c=null;T8("Connecting to: "+g.tg(b));"cast-selector-receiver"==b.key?(V8(c||null),p8()?m8().setLaunchParams(c||null):k8("setLaunchParams called before ready.")):!c&&
d9()&&S8()==b.key?g.wF("yt-remote-connection-change",!0):(a9(),V8(c||null),c=R8().ke(),(c=R6(c,b.key))&&b9(c,1))}},Wya={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"<"},n7={"'":"\\'"},IAa={},vya={EV:"atp",Z_:"ska",p_:"que",zZ:"mus",V_:"sus"};
K6.prototype.fn=function(){var a=new K6({id:this.id,name:this.name,app:this.app,type:this.type,user:this.username,userAvatarUri:this.avatar,obfuscatedGaiaId:this.obfuscatedGaiaId,theme:this.theme,capabilities:Array.from(this.capabilities.values()).join(","),experiments:Array.from(this.experiments.values()).join(",")});a.o=this.o;a.l=this.l;a.g=this.g};
var X6,T6="",a7=Y6("loadGamesSDK")?"/cast_game_sender.js":"/cast_sender.js",Oya=Y6("loadCastFramework")||Y6("loadCastApplicationFramework"),Yza=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.A(d7,g.K);g.h=d7.prototype;g.h.IH=function(a){this.A=arguments;this.g=!1;this.wa?this.o=(0,g.G)()+this.uc:this.wa=g.ng(this.B,this.uc)};
g.h.stop=function(){this.wa&&(g.og(this.wa),this.wa=null);this.o=null;this.g=!1;this.A=[]};
g.h.pause=function(){++this.l};
g.h.resume=function(){this.l&&(--this.l,!this.l&&this.g&&(this.g=!1,this.C.apply(null,this.A)))};
g.h.U=function(){this.stop();d7.Z.U.call(this)};
g.h.JH=function(){this.o?(this.wa=g.ng(this.B,this.o-(0,g.G)()),this.o=null):(this.wa=null,this.l?this.g=!0:(this.g=!1,this.C.apply(null,this.A)))};e7.prototype.stringify=function(a){return g.w.JSON.stringify(a,void 0)};
e7.prototype.parse=function(a){return g.w.JSON.parse(a,void 0)};g.h=f7.prototype;g.h.gi=null;g.h.yf=!1;g.h.lk=null;g.h.Ju=null;g.h.Rj=null;g.h.oj=null;g.h.jh=null;g.h.Bh=null;g.h.Gi=null;g.h.Pc=null;g.h.Rl=0;g.h.zf=null;g.h.zp=null;g.h.kh=null;g.h.Pk=-1;g.h.dC=!0;g.h.Ph=!1;g.h.dr=0;g.h.Qo=null;var Uya={},i7={};g.h=f7.prototype;g.h.setTimeout=function(a){this.B=a};
g.h.HS=function(a){a=a.target;var b=this.Qo;b&&3==g.Xw(a)?b.mj():this.sD(a)};
g.h.sD=function(a){try{if(a==this.Pc)a:{var b=g.Xw(this.Pc),c=this.Pc.l,d=this.Pc.getStatus();if(g.sd&&!g.oc(10)||g.ud&&!g.nc("420+")){if(4>b)break a}else if(3>b||3==b&&!g.Ye&&!g.ax(this.Pc))break a;this.Ph||4!=b||7==c||(8==c||0>=d?this.g.uf(3):this.g.uf(2));p7(this);var e=this.Pc.getStatus();this.Pk=e;var f=g.ax(this.Pc);(this.yf=200==e)?(4==b&&l7(this),this.C?(Vya(this,b,f),g.Ye&&this.yf&&3==b&&(this.A.R(this.l,"tick",this.AS),this.l.start())):k7(this,f),this.yf&&!this.Ph&&(4==b?this.g.Fo(this):
(this.yf=!1,h7(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.kh=3,j7(13)):(this.kh=0,j7(14)),l7(this),m7(this))}}catch(k){this.Pc&&g.ax(this.Pc)}finally{}};
g.h.AS=function(){var a=g.Xw(this.Pc),b=g.ax(this.Pc);this.Rl<b.length&&(p7(this),Vya(this,a,b),this.yf&&4!=a&&h7(this))};
g.h.MR=function(a){o7((0,g.z)(this.LR,this,a),0)};
g.h.LR=function(a){this.Ph||(p7(this),k7(this,a),h7(this))};
g.h.uB=function(a){o7((0,g.z)(this.KR,this,a),0)};
g.h.KR=function(a){this.Ph||(l7(this),this.yf=a,this.g.Fo(this),this.g.uf(4))};
g.h.cancel=function(){this.Ph=!0;l7(this)};
g.h.dS=function(){this.lk=null;var a=(0,g.G)();0<=a-this.Ju?(2!=this.oj&&this.g.uf(3),l7(this),this.kh=2,j7(18),m7(this)):Yya(this,this.Ju-a)};g.h=aza.prototype;g.h.Yq=null;g.h.se=null;g.h.Ro=!1;g.h.Dx=null;g.h.vn=null;g.h.Zq=null;g.h.ar=null;g.h.Me=null;g.h.wg=-1;g.h.Ok=null;g.h.qk=null;g.h.connect=function(a){this.ar=a;a=r7(this.g,null,this.ar);j7(3);this.Dx=(0,g.G)();var b=this.g.F;null!=b?(this.Ok=b[0],(this.qk=b[1])?(this.Me=1,bza(this)):(this.Me=2,t7(this))):(J6(a,"MODE","init"),this.se=new f7(this,void 0,void 0,void 0),this.se.gi=this.Yq,g7(this.se,a,!1,null,!0),this.Me=0)};
g.h.VG=function(a){if(a)this.Me=2,t7(this);else{j7(4);var b=this.g;b.jf=b.Yg.wg;A7(b,9)}a&&this.uf(2)};
g.h.Aq=function(a){return this.g.Aq(a)};
g.h.abort=function(){this.se&&(this.se.cancel(),this.se=null);this.wg=-1};
g.h.Cx=function(){return!1};
g.h.nB=function(a,b){this.wg=a.Pk;if(0==this.Me)if(b){try{var c=this.l.parse(b)}catch(d){c=this.g;c.jf=this.wg;A7(c,2);return}this.Ok=c[0];this.qk=c[1]}else c=this.g,c.jf=this.wg,A7(c,2);else if(2==this.Me)if(this.Ro)j7(7),this.Zq=(0,g.G)();else if("11111"==b){if(j7(6),this.Ro=!0,this.vn=(0,g.G)(),c=this.vn-this.Dx,!g.sd||g.oc(10)||500>c)this.wg=200,this.se.cancel(),j7(12),s7(this.g,this,!0)}else j7(8),this.vn=this.Zq=(0,g.G)(),this.Ro=!1};
g.h.Fo=function(){this.wg=this.se.Pk;if(this.se.yf)0==this.Me?this.qk?(this.Me=1,bza(this)):(this.Me=2,t7(this)):2==this.Me&&((!g.sd||g.oc(10)?!this.Ro:200>this.Zq-this.vn)?(j7(11),s7(this.g,this,!1)):(j7(12),s7(this.g,this,!0)));else{0==this.Me?j7(9):2==this.Me&&j7(10);var a=this.g;a.jf=this.wg;A7(a,2)}};
g.h.Kl=function(){return this.g.Kl()};
g.h.isActive=function(){return this.g.isActive()};
g.h.uf=function(a){this.g.uf(a)};g.h=u7.prototype;g.h.Bk=null;g.h.Pd=null;g.h.tc=null;g.h.Xq=null;g.h.yn=null;g.h.Tv=null;g.h.Nn=null;g.h.wl=0;g.h.HN=0;g.h.od=null;g.h.ah=null;g.h.pg=null;g.h.Th=null;g.h.Yg=null;g.h.yp=null;g.h.Bj=-1;g.h.Dy=-1;g.h.jf=-1;g.h.gj=0;g.h.Wi=0;g.h.Rh=8;var B7=new g.xf;g.A(dza,g.We);g.A(eza,g.We);g.A(fza,g.We);g.h=u7.prototype;g.h.connect=function(a,b,c,d,e){j7(0);this.Xq=b;this.Bk=c||{};d&&g.t(e)&&(this.Bk.OSID=d,this.Bk.OAID=e);this.C?(o7((0,g.z)(this.rw,this,a),100),jza(this)):this.rw(a)};
g.h.rw=function(a){this.Yg=new aza(this);this.Yg.Yq=null;this.Yg.l=this.B;this.Yg.connect(a)};
g.h.Cx=function(){return 0==this.g};
g.h.sB=function(a){this.ah=null;mza(this,a)};
g.h.rB=function(){this.pg=null;this.tc=new f7(this,this.o,"rpc",this.D);this.tc.gi=null;this.tc.dr=0;var a=this.Tv.clone();g.wm(a,"RID","rpc");g.wm(a,"SID",this.o);g.wm(a,"CI",this.yp?"0":"1");g.wm(a,"AID",this.Bj);v7(this,a);if(!g.sd||g.oc(10))g.wm(a,"TYPE","xmlhttp"),g7(this.tc,a,!0,this.Nn,!1);else{g.wm(a,"TYPE","html");var b=this.tc,c=!!this.Nn;b.oj=3;b.jh=I6(a.clone());Xya(b,c)}};
g.h.nB=function(a,b){if(0!=this.g&&(this.tc==a||this.Pd==a))if(this.jf=a.Pk,this.Pd==a&&3==this.g)if(7<this.Rh){try{var c=this.B.parse(b)}catch(f){c=null}if(g.ya(c)&&3==c.length)if(0==c[0])a:{if(!this.pg){if(this.tc)if(this.tc.Rj+3E3<this.Pd.Rj)x7(this),this.tc.cancel(),this.tc=null;else break a;z7(this);j7(19)}}else this.Dy=c[1],0<this.Dy-this.Bj&&37500>c[2]&&this.yp&&0==this.Wi&&!this.Th&&(this.Th=o7((0,g.z)(this.jO,this),6E3));else A7(this,11)}else b!=IAa.JW.g&&A7(this,11);else if(this.tc==a&&
x7(this),!g.D(b)){c=this.B.parse(b);g.ya(c);for(var d=0;d<c.length;d++){var e=c[d];this.Bj=e[0];e=e[1];2==this.g?"c"==e[0]?(this.o=e[1],this.Nn=e[2],e=e[3],null!=e?this.Rh=e:this.Rh=6,this.g=3,this.od&&this.od.ew(),this.Tv=r7(this,this.Kl()?this.Nn:null,this.Xq),nza(this)):"stop"==e[0]&&A7(this,7):3==this.g&&("stop"==e[0]?A7(this,7):"noop"!=e[0]&&this.od&&this.od.dw(e),this.Wi=0)}}};
g.h.jO=function(){null!=this.Th&&(this.Th=null,this.tc.cancel(),this.tc=null,z7(this),j7(20))};
g.h.Fo=function(a){if(this.tc==a){x7(this);this.tc=null;var b=2}else if(this.Pd==a)this.Pd=null,b=1;else return;this.jf=a.Pk;if(0!=this.g)if(a.yf)1==b?(b=(0,g.G)()-a.Rj,B7.dispatchEvent(new eza(B7,a.Gi?a.Gi.length:0,b,this.gj)),w7(this),this.A.length=0):nza(this);else{var c=a.kh,d;if(!(d=3==c||7==c||0==c&&0<this.jf)){if(d=1==b)this.Pd||this.ah||1==this.g||2<=this.gj?d=!1:(this.ah=o7((0,g.z)(this.sB,this,a),oza(this,this.gj)),this.gj++,d=!0);d=!(d||2==b&&z7(this))}if(d)switch(c){case 1:A7(this,5);
break;case 4:A7(this,10);break;case 3:A7(this,6);break;case 7:A7(this,12);break;default:A7(this,2)}}};
g.h.qH=function(a){if(!g.Oa(arguments,this.g))throw Error("Unexpected channel state: "+this.g);};
g.h.zT=function(a){a?j7(2):(j7(1),pza(this,8))};
g.h.Aq=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new g.Rw;a.F=!1;return a};
g.h.isActive=function(){return!!this.od&&this.od.isActive(this)};
g.h.uf=function(a){B7.dispatchEvent(new fza(B7,a))};
g.h.Kl=function(){return!(!g.sd||g.oc(10))};
g.h=qza.prototype;g.h.ew=function(){};
g.h.dw=function(){};
g.h.cw=function(){};
g.h.nq=function(){};
g.h.fx=function(){return{}};
g.h.isActive=function(){return!0};g.A(D7,g.K);D7.prototype.o=function(){500<this.uc&&24E4>2*this.uc&&(this.uc*=2);this.A();this.l&&this.start()};
D7.prototype.start=function(){g.Nt(this.g,this.uc);this.l=(0,g.G)()+this.uc};
D7.prototype.stop=function(){this.g.stop();this.l=0};
D7.prototype.isActive=function(){return this.g.isActive()};g.A(E7,qza);g.h=E7.prototype;g.h.subscribe=function(a,b,c){return this.o.subscribe(a,b,c)};
g.h.unsubscribe=function(a,b,c){return this.o.unsubscribe(a,b,c)};
g.h.Jd=function(a){return this.o.Jd(a)};
g.h.P=function(a,b){return this.o.P.apply(this.o,arguments)};
g.h.dispose=function(){this.I||(this.I=!0,g.Ue(this.o),tza(this),g.Ue(this.l),this.l=null)};
g.h.ha=function(){return this.I};
g.h.connect=function(a,b,c){if(!this.g||2!=this.g.g){this.H="";this.l.stop();this.B=a||null;this.A=b||0;a=this.K+"/test";b=this.K+"/bind";var d=new u7(c?c.firstTestResults:null,c?c.secondTestResults:null,this.M),e=this.g;e&&(e.od=null);d.od=this;this.g=d;e?this.g.connect(a,b,this.C,e.o,e.Bj):c?this.g.connect(a,b,this.C,c.sessionId,c.arrayId):this.g.connect(a,b,this.C)}};
g.h.sendMessage=function(a,b){var c={_sc:a};b&&g.bc(c,b);this.l.isActive()||2==(this.g?this.g.g:0)?this.D.push(c):F7(this)&&kza(this.g,c)};
g.h.ew=function(){C7(this.l);this.B=null;this.A=0;if(this.D.length){var a=this.D;this.D=[];for(var b=0,c=a.length;b<c;++b)kza(this.g,a[b])}this.P("handlerOpened")};
g.h.cw=function(a){var b=2==a&&401==this.g.jf;if(4!=a&&!b){if(6==a||410==this.g.jf)b=this.l,b.g.stop(),b.uc=500;this.l.start()}this.P("handlerError",a)};
g.h.nq=function(a){if(!this.l.isActive())this.P("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.D.push(d)}};
g.h.fx=function(){var a={v:2};this.H&&(a.gsessionid=this.H);0!=this.A&&(a.ui=""+this.A);0!=this.F&&(a.ui=""+this.F);this.B&&g.bc(a,this.B);return a};
g.h.dw=function(a){"S"==a[0]?this.H=a[1]:"gracefulReconnect"==a[0]?(C7(this.l),this.l.start(),iza(this.g)):this.P("handlerMessage",new rza(a[0],a[1]))};
g.h.iU=function(){this.l.isActive();var a=this.g,b=0;a.tc&&b++;a.Pd&&b++;0!=b?this.l.start():this.connect(this.B,this.A)};G7.prototype.A=function(a,b,c,d){b?a(d):a({text:c.responseText})};
G7.prototype.o=function(a,b){a(Error("Request error: "+b.status))};
G7.prototype.B=function(a){a(Error("request timed out"))};var Bza=(0,g.G)(),J7=null,M7=Array(50),L7=-1,N7=!1;g.A(O7,g.hF);O7.prototype.ke=function(){return this.g};
O7.prototype.contains=function(a){return!!Q6(this.g,a)};
O7.prototype.get=function(a){return a?R6(this.g,a):null};
O7.prototype.info=function(a){K7(this.D,a)};g.A(P7,g.hF);var JAa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.h=P7.prototype;g.h.start=function(){!this.g&&(0,window.isNaN)(this.wa)&&this.wD()};
g.h.stop=function(){this.g&&(this.g.abort(),this.g=null);(0,window.isNaN)(this.wa)||(g.AD(this.wa),this.wa=window.NaN)};
g.h.U=function(){this.stop();P7.Z.U.call(this)};
g.h.wD=function(){this.wa=window.NaN;this.g=g.OD(H7(this.C,"/pairing/get_screen"),{method:"POST",Lb:{pairing_code:this.B},timeout:5E3,Hb:(0,g.z)(this.kU,this),onError:(0,g.z)(this.jU,this),sd:(0,g.z)(this.lU,this)})};
g.h.kU=function(a,b){this.g=null;var c=b.screen||{};c.dialId=this.o;c.name=this.A;this.P("pairingComplete",new L6(c))};
g.h.jU=function(a){this.g=null;a.status&&404==a.status?this.l>=JAa.length?this.P("pairingFailed",Error("DIAL polling timed out")):(a=JAa[this.l],this.wa=g.yD((0,g.z)(this.wD,this),a),this.l++):this.P("pairingFailed",Error("Server error "+a.status))};
g.h.lU=function(){this.g=null;this.P("pairingFailed",Error("Server not responding"))};g.A(R7,O7);g.h=R7.prototype;g.h.start=function(){Q7(this)&&this.P("screenChange");!g.kG("yt-remote-lounge-token-expiration")&&Fza(this);g.AD(this.l);this.l=g.yD((0,g.z)(this.start,this),1E4)};
g.h.add=function(a,b){Q7(this);Cza(this,a);S7(this,!1);this.P("screenChange");b(a);a.token||Fza(this)};
g.h.remove=function(a,b){var c=Q7(this);Eza(this,a)&&(S7(this,!1),c=!0);b(a);c&&this.P("screenChange")};
g.h.up=function(a,b,c,d){var e=Q7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,S7(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.P("screenChange")};
g.h.U=function(){g.AD(this.l);R7.Z.U.call(this)};
g.h.VH=function(a){Q7(this);var b=this.g.length;a=a&&a.screens||[];for(var c=0,d=a.length;c<d;++c){var e=a[c],f=this.get(e.screenId);f&&(f.token=e.loungeToken,--b)}S7(this,!b);b&&K7(this.D,"Missed "+b+" lounge tokens.")};
g.h.UH=function(a){K7(this.D,"Requesting lounge tokens failed: "+a)};g.A(U7,g.hF);g.h=U7.prototype;g.h.start=function(){var a=(0,window.parseInt)(g.kG("yt-remote-fast-check-period")||"0",10);(this.A=(0,g.G)()-144E5<a?0:a)?W7(this):(this.A=(0,g.G)()+3E5,g.jG("yt-remote-fast-check-period",this.A),this.Vt())};
g.h.isEmpty=function(){return g.Ub(this.g)};
g.h.update=function(){T7("Updating availability on schedule.");var a=this.C(),b=g.Jb(this.g,function(b,d){return b&&!!R6(a,d)},this);
V7(this,b)};
g.h.U=function(){g.AD(this.o);this.o=window.NaN;this.l&&(this.l.abort(),this.l=null);U7.Z.U.call(this)};
g.h.Vt=function(){g.AD(this.o);this.o=window.NaN;this.l&&this.l.abort();var a=Iza(this);if(g.Mb(a)){var b=H7(this.B,"/pairing/get_screen_availability");this.l=I7(this.B,b,{lounge_token:g.Ob(a).join(",")},(0,g.z)(this.mR,this,a),(0,g.z)(this.lR,this))}else V7(this,{}),W7(this)};
g.h.mR=function(a,b){this.l=null;var c=g.Ob(Iza(this));if(g.gb(c,g.Ob(a))){c=b.screens||[];for(var d={},e=0,f=c.length;e<f;++e)d[a[c[e].loungeToken]]="online"==c[e].status;V7(this,d);W7(this)}else this.fc("Changing Screen set during request."),this.Vt()};
g.h.lR=function(a){this.fc("Screen availability failed: "+a);this.l=null;W7(this)};
g.h.fc=function(a){K7("OnlineScreenService",a)};g.A(X7,O7);g.h=X7.prototype;g.h.start=function(){this.o.start();this.l.start();this.g.length&&(this.P("screenChange"),this.l.isEmpty()||this.P("onlineScreenChange"))};
g.h.add=function(a,b,c){this.o.add(a,b,c)};
g.h.remove=function(a,b,c){this.o.remove(a,b,c);this.l.update()};
g.h.up=function(a,b,c,d){this.o.contains(a)?this.o.up(a,b,c,d):(a="Updating name of unknown screen: "+a.name,K7(this.D,a),d(Error(a)))};
g.h.ke=function(a){return a?this.g:g.Va(this.g,(0,g.Hd)(this.A,function(a){return!this.contains(a)},this))};
g.h.xD=function(){return(0,g.Hd)(this.ke(!0),function(a){return!!this.l.g[a.id]},this)};
g.h.yD=function(a,b,c,d,e){this.info("getDialScreenByPairingCode "+a+" / "+b);var f=new P7(this.C,a,b,c);f.subscribe("pairingComplete",(0,g.z)(function(a){g.Ue(f);d(Y7(this,a))},this));
f.subscribe("pairingFailed",function(a){g.Ue(f);e(a)});
f.start();return(0,g.z)(f.stop,f)};
g.h.nU=function(a,b,c,d){g.OD(H7(this.C,"/pairing/get_screen"),{method:"POST",Lb:{pairing_code:a},timeout:5E3,Hb:(0,g.z)(function(a,d){var e=new L6(d.screen||{});if(!e.name||Mza(this,e.name)){a:{var f=e.name;for(var m=2,n=b(f,m);Mza(this,n);){m++;if(20<m)break a;n=b(f,m)}f=n}e.name=f}c(Y7(this,e))},this),
onError:(0,g.z)(function(a){d(Error("pairing request failed: "+a.status))},this),
sd:(0,g.z)(function(){d(Error("pairing request timed out."))},this)})};
g.h.U=function(){g.Ue(this.o);g.Ue(this.l);X7.Z.U.call(this)};
g.h.lI=function(){Nza(this);this.P("screenChange");this.l.update()};
X7.prototype.dispose=X7.prototype.dispose;g.A($7,g.hF);g.h=$7.prototype;g.h.Go=function(a){this.o=a;this.P("sessionScreen",this.o)};
g.h.qe=function(a){this.ha()||(a&&a8(this,""+a),this.o=null,this.P("sessionScreen",null))};
g.h.info=function(a){K7(this.M,a)};
g.h.AD=function(){return null};
g.h.du=function(a){var b=this.l;a?(b.displayStatus=new window.chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;window.chrome.cast.setReceiverDisplayStatus(b,(0,g.z)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.z)(function(){a8(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.h.U=function(){this.du("");$7.Z.U.call(this)};g.A(b8,$7);g.h=b8.prototype;g.h.cu=function(a){if(this.g){if(this.g==a)return;a8(this,"Overriding cast sesison with new session object");this.g.removeUpdateListener(this.C);this.g.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B)}this.g=a;this.g.addUpdateListener(this.C);this.g.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.B);Pza(this)};
g.h.Cj=function(a){this.info("launchWithParams no-op for Cast: "+g.tg(a))};
g.h.stop=function(){this.g?this.g.stop((0,g.z)(function(){this.qe()},this),(0,g.z)(function(){this.qe(Error("Failed to stop receiver app."))},this)):this.qe(Error("Stopping cast device witout session."))};
g.h.du=g.y;g.h.U=function(){this.info("disposeInternal");g.AD(this.A);this.A=0;this.g&&(this.g.removeUpdateListener(this.C),this.g.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B));this.g=null;b8.Z.U.call(this)};
g.h.nS=function(a,b){if(!this.ha())if(b){var c=g.Lw(b);if(g.Ba(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.tg(c));switch(d){case "mdxSessionStatus":Oza(this,c.screenId);break;default:a8(this,"Unknown youtube message: "+d)}}else a8(this,"Unable to parse message.")}else a8(this,"No data in message.")};
g.h.vx=function(a,b,c,d){Lza(this.H,this.l.label,a,this.l.friendlyName,(0,g.z)(function(e){e?b(e):0<=d?(a8(this,"Screen "+a+" appears to be offline. "+d+" retries left."),g.yD((0,g.z)(this.vx,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.h.AD=function(){return this.g};
g.h.oU=function(a){this.ha()||a||(a8(this,"Cast session died."),this.qe())};g.A(c8,$7);g.h=c8.prototype;g.h.cu=function(a){this.A=a;this.A.addUpdateListener(this.K)};
g.h.Cj=function(a){this.B=a;this.D()};
g.h.stop=function(){this.g();this.g=g.y;g.AD(this.C);this.A?this.A.stop((0,g.z)(this.qe,this,null),(0,g.z)(this.qe,this,"Failed to stop DIAL device.")):this.qe()};
g.h.U=function(){this.g();this.g=g.y;g.AD(this.C);this.A&&this.A.removeUpdateListener(this.K);this.A=null;c8.Z.U.call(this)};
g.h.rU=function(a){this.ha()||a||(a8(this,"DIAL session died."),this.g(),this.g=g.y,this.qe())};
g.h.Nr=function(a){this.I=P6();if(this.B){var b=new window.chrome.cast.DialLaunchResponse(!0,Rza(this));a(b);Qza(this)}else this.D=(0,g.z)(function(){g.AD(this.C);this.D=g.y;this.C=window.NaN;var b=new window.chrome.cast.DialLaunchResponse(!0,Rza(this));a(b);Qza(this)},this),this.C=g.yD((0,g.z)(function(){this.D()},this),100)};
g.h.CJ=function(a,b,c){Lza(this.H,this.F.receiver.label,a,this.l.friendlyName,(0,g.z)(function(a){a&&a.token?(this.Go(a),b(new window.chrome.cast.DialLaunchResponse(!1))):this.Nr(b,c)},this),(0,g.z)(function(a){a8(this,"Failed to get DIAL screen: "+a);
this.Nr(b,c)},this))};g.A(d8,$7);d8.prototype.stop=function(){this.qe()};
d8.prototype.cu=g.y;d8.prototype.Cj=function(){g.AD(this.g);this.g=window.NaN;var a=R6(this.H.ke(),this.l.label);a?this.Go(a):this.qe(Error("No such screen"))};
d8.prototype.U=function(){g.AD(this.g);this.g=window.NaN;d8.Z.U.call(this)};g.A(e8,g.hF);g.h=e8.prototype;
g.h.init=function(a,b){window.chrome.cast.timeout.requestSession=3E4;var c=new window.chrome.cast.SessionRequest(this.D);this.F||(c.dialRequest=new window.chrome.cast.DialRequest("YouTube"));var d=window.chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED,e=a?window.chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:window.chrome.cast.DefaultActionPolicy.CREATE_SESSION;c=new window.chrome.cast.ApiConfig(c,(0,g.z)(this.oB,this),(0,g.z)(this.XQ,this),d,e);c.customDialLaunchCallback=(0,g.z)(this.UO,this);window.chrome.cast.initialize(c,
(0,g.z)(function(){this.ha()||(window.chrome.cast.addReceiverActionListener(this.A),yza(),this.l.subscribe("onlineScreenChange",(0,g.z)(this.zD,this)),this.o=Tza(this),window.chrome.cast.setCustomReceivers(this.o,g.y,(0,g.z)(function(a){this.fc("Failed to set initial custom receivers: "+g.tg(a))},this)),this.P("yt-remote-cast2-availability-change",g8(this)),b(!0))},this),(0,g.z)(function(a){this.fc("Failed to initialize API: "+g.tg(a));
b(!1)},this))};
g.h.kT=function(a,b){f8("Setting connected screen ID: "+a+" -> "+b);if(this.g){var c=this.g.o;if(!a||c&&c.id!=a)f8("Unsetting old screen status: "+this.g.l.friendlyName),h8(this,null)}if(a&&b){if(!this.g){c=R6(this.l.ke(),a);if(!c){f8("setConnectedScreenStatus: Unknown screen.");return}var d=Sza(this,c);d||(f8("setConnectedScreenStatus: Connected receiver not custom..."),d=new window.chrome.cast.Receiver(c.uuid?c.uuid:c.id,c.name),d.receiverType=window.chrome.cast.ReceiverType.CUSTOM,this.o.push(d),
window.chrome.cast.setCustomReceivers(this.o,g.y,(0,g.z)(function(a){this.fc("Failed to set initial custom receivers: "+g.tg(a))},this)));
f8("setConnectedScreenStatus: new active receiver: "+d.friendlyName);h8(this,new d8(this.l,d),!0)}this.g.du(b)}else f8("setConnectedScreenStatus: no screen.")};
g.h.lT=function(a){this.ha()?this.fc("Setting connection data on disposed cast v2"):this.g?this.g.Cj(a):this.fc("Setting connection data without a session")};
g.h.qU=function(){this.ha()?this.fc("Stopping session on disposed cast v2"):this.g?(this.g.stop(),h8(this,null)):f8("Stopping non-existing session")};
g.h.requestSession=function(){window.chrome.cast.requestSession((0,g.z)(this.oB,this),(0,g.z)(this.qR,this))};
g.h.U=function(){this.l.unsubscribe("onlineScreenChange",(0,g.z)(this.zD,this));window.chrome&&window.chrome.cast&&window.chrome.cast.removeReceiverActionListener(this.A);g.Ta(g.x("yt.mdx.remote.debug.handlers_")||[],vza);g.Ue(this.g);e8.Z.U.call(this)};
g.h.fc=function(a){K7("Controller",a)};
g.h.pB=function(a,b){this.g==a&&(b||h8(this,null),this.P("yt-remote-cast2-session-change",b))};
g.h.TQ=function(a,b){if(!this.ha())if(a)switch(a.friendlyName=window.chrome.cast.unescape(a.friendlyName),f8("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case window.chrome.cast.ReceiverAction.CAST:if(this.g)if(this.g.l.label!=a.label)f8("onReceiverAction_: Stopping active receiver: "+this.g.l.friendlyName),this.g.stop();else{f8("onReceiverAction_: Casting to active receiver.");this.g.o&&this.P("yt-remote-cast2-session-change",this.g.o);break}switch(a.receiverType){case window.chrome.cast.ReceiverType.CUSTOM:h8(this,
new d8(this.l,a));break;case window.chrome.cast.ReceiverType.DIAL:h8(this,new c8(this.l,a,this.C));break;case window.chrome.cast.ReceiverType.CAST:h8(this,new b8(this.l,a));break;default:this.fc("Unknown receiver type: "+a.receiverType)}break;case window.chrome.cast.ReceiverAction.STOP:this.g&&this.g.l.label==a.label?this.g.stop():this.fc("Stopping receiver w/o session: "+a.friendlyName)}else this.fc("onReceiverAction_ called without receiver.")};
g.h.UO=function(a){if(this.ha())return window.Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=window.chrome.cast.ReceiverType.DIAL&&(this.fc("Not DIAL receiver: "+b.friendlyName),b.receiverType=window.chrome.cast.ReceiverType.DIAL);var c=this.g?this.g.l:null;if(!c||c.label!=b.label)return this.fc("Receiving DIAL launch request for non-clicked DIAL receiver: "+b.friendlyName),window.Promise.reject(Error("illegal DIAL launch"));if(c&&c.label==b.label&&c.receiverType!=window.chrome.cast.ReceiverType.DIAL){if(this.g.o)return f8("Reselecting dial screen."),
this.P("yt-remote-cast2-session-change",this.g.o),window.Promise.resolve(new window.chrome.cast.DialLaunchResponse(!1));this.fc('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);h8(this,new c8(this.l,b,this.C))}b=this.g;b.F=a;return b.F.appState==window.chrome.cast.DialAppState.RUNNING?new window.Promise((0,g.z)(b.CJ,b,(b.F.extraData||{}).screenId||null)):new window.Promise((0,g.z)(b.Nr,b))};
g.h.oB=function(a){if(!this.ha()){f8("New cast session ID: "+a.sessionId);var b=a.receiver;if(b.receiverType!=window.chrome.cast.ReceiverType.CUSTOM){if(!this.g)if(b.receiverType==window.chrome.cast.ReceiverType.CAST)f8("Got resumed cast session before resumed mdx connection."),b.friendlyName=window.chrome.cast.unescape(b.friendlyName),h8(this,new b8(this.l,b),!0);else{this.fc("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.g.l,d=R6(this.l.ke(),c.label);
d&&M6(d,b.label)&&c.receiverType!=window.chrome.cast.ReceiverType.CAST&&b.receiverType==window.chrome.cast.ReceiverType.CAST&&(f8("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.Ue(this.g),this.g=new b8(this.l,b),this.g.subscribe("sessionScreen",(0,g.z)(this.pB,this,this.g)),this.g.Cj(null));this.g.cu(a)}}};
g.h.pU=function(){return this.g?this.g.AD():null};
g.h.qR=function(a){this.ha()||(this.fc("Failed to estabilish a session: "+g.tg(a)),a.code!=window.chrome.cast.ErrorCode.CANCEL&&h8(this,null))};
g.h.XQ=function(a){f8("Receiver availability updated: "+a);if(!this.ha()){var b=g8(this);this.B=a==window.chrome.cast.ReceiverAvailability.AVAILABLE;g8(this)!=b&&this.P("yt-remote-cast2-availability-change",g8(this))}};
g.h.zD=function(){this.ha()||(this.o=Tza(this),f8("Updating custom receivers: "+g.tg(this.o)),window.chrome.cast.setCustomReceivers(this.o,g.y,(0,g.z)(function(){this.fc("Failed to set custom receivers.")},this)),this.P("yt-remote-cast2-availability-change",g8(this)))};
e8.prototype.setLaunchParams=e8.prototype.lT;e8.prototype.setConnectedScreenStatus=e8.prototype.kT;e8.prototype.stopSession=e8.prototype.qU;e8.prototype.getCastSession=e8.prototype.pU;e8.prototype.requestSession=e8.prototype.requestSession;e8.prototype.init=e8.prototype.init;e8.prototype.dispose=e8.prototype.dispose;var n8=[];g.h=s8.prototype;
g.h.reset=function(a){this.listId="";this.index=-1;this.videoId="";t8(this);this.volume=-1;this.muted=!1;a&&(this.index=a.index,this.listId=a.listId,this.videoId=a.videoId,this.g=a.playerState,this.volume=a.volume,this.muted=a.muted,this.audioTrackId=a.audioTrackId,this.l=a.trackData,this.Mf=a.hasPrevious,this.hasNext=a.hasNext,this.F=a.playerTime,this.D=a.playerTimeAt,this.B=a.seekableStart,this.o=a.seekableEnd,this.H=a.duration,this.I=a.loadedTime,this.A=a.liveIngestionTime,this.C=!(0,window.isNaN)(this.A))};
g.h.kb=function(){return 1==this.g};
g.h.isAdPlaying=function(){return 1081==this.g};
g.h.getDuration=function(){return this.C?this.H+u8(this):this.H};
g.h.clone=function(){return new s8(y8(this))};g.A(A8,g.hF);g.h=A8.prototype;g.h.play=function(){1==this.g?(this.l?this.l.play(null,g.y,G8(this,"play")):F8(this,"play"),E8(this,1,w8(B8(this))),this.P("remotePlayerChange")):C8(this,this.play)};
g.h.pause=function(){1==this.g?(this.l?this.l.pause(null,g.y,G8(this,"pause")):F8(this,"pause"),E8(this,2,w8(B8(this))),this.P("remotePlayerChange")):C8(this,this.pause)};
g.h.vD=function(a){if(1==this.g){if(this.l){var b=B8(this),c=new window.chrome.cast.media.SeekRequest;c.currentTime=a;c.resumeState=b.kb()||3==b.g?window.chrome.cast.media.ResumeState.PLAYBACK_START:window.chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.l.seek(c,g.y,G8(this,"seekTo",{newTime:a}))}else F8(this,"seekTo",{newTime:a});E8(this,3,a);this.P("remotePlayerChange")}else C8(this,g.Ea(this.vD,a))};
g.h.stop=function(){if(1==this.g){this.l?this.l.stop(null,g.y,G8(this,"stopVideo")):F8(this,"stopVideo");var a=B8(this);a.index=-1;a.videoId="";t8(a);D8(this,a);this.P("remotePlayerChange")}else C8(this,this.stop)};
g.h.setVolume=function(a,b){if(1==this.g){var c=B8(this);if(this.o){if(c.volume!=a){var d=Math.round(a)/100;this.o.setReceiverVolumeLevel(d,(0,g.z)(function(){K7("CP","set receiver volume: "+d)},this),(0,g.z)(function(){this.fc("failed to set receiver volume.")},this))}c.muted!=b&&this.o.setReceiverMuted(b,(0,g.z)(function(){K7("CP","set receiver muted: "+b)},this),(0,g.z)(function(){this.fc("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);F8(this,"setVolume",e)}c.muted=b;c.volume=a;D8(this,c)}else C8(this,g.Ea(this.setVolume,a,b))};
g.h.vC=function(a,b){if(1==this.g){var c=B8(this),d={videoId:a};b&&(c.l={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,format:b.format,kind:b.kind},d.style=g.tg(b.style),g.bc(d,c.l));F8(this,"setSubtitlesTrack",d);D8(this,c)}else C8(this,g.Ea(this.vC,a,b))};
g.h.Ou=function(a,b){if(1==this.g){F8(this,"setAudioTrack",{videoId:a,audioTrackId:b.Nb.id});var c=B8(this);c.audioTrackId=b.Nb.id;D8(this,c)}else C8(this,g.Ea(this.Ou,a,b))};
g.h.uD=function(a,b){if(1==this.g){if(a&&b){var c=B8(this);x8(c,a,b);D8(this,c)}F8(this,"previous")}else C8(this,g.Ea(this.uD,a,b))};
g.h.tD=function(a,b){if(1==this.g){if(a&&b){var c=B8(this);x8(c,a,b);D8(this,c)}F8(this,"next")}else C8(this,g.Ea(this.tD,a,b))};
g.h.Iw=function(){1==this.g?F8(this,"dismissAutoplay"):C8(this,this.Iw)};
g.h.dispose=function(){if(3!=this.g){var a=this.g;this.g=3;this.P("proxyStateChange",a,this.g)}A8.Z.dispose.call(this)};
g.h.U=function(){fAa(this);this.A=null;this.B.clear();z8(this,null);A8.Z.U.call(this)};
g.h.Pu=function(a){if((a!=this.g||2==a)&&3!=this.g&&0!=a){var b=this.g;this.g=a;this.P("proxyStateChange",b,a);if(1==a)for(;!this.B.isEmpty();)g.XB(this.B).apply(this);else 3==a&&this.dispose()}};
g.h.PQ=function(a,b){this.P(a,b)};
g.h.qO=function(a){if(!a)this.zl(null),z8(this,null);else if(this.o.receiver.volume){a=this.o.receiver.volume;var b=B8(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)K7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,D8(this,b)}};
g.h.zl=function(a){K7("CP","Cast media: "+!!a);this.l&&this.l.removeUpdateListener(this.F);if(this.l=a)this.l.addUpdateListener(this.F),gAa(this),this.P("remotePlayerChange")};
g.h.pO=function(a){a?(gAa(this),this.P("remotePlayerChange")):this.zl(null)};
g.h.DO=function(){var a=cAa();a&&z8(this,a)};
g.h.fc=function(a){K7("CP",a)};g.A(H8,g.hF);g.h=H8.prototype;
g.h.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.playerParams,f=b.clickTrackingParams,k=b.index,l={videoId:d},m=b.currentTime;g.t(m)&&(l.currentTime=5>=m?0:m);e&&(l.playerParams=e);f&&(l.clickTrackingParams=f);c&&(l.listId=c);g.t(k)&&(l.currentIndex=k);c&&(this.bb.listId=c);this.bb.videoId=d;this.bb.index=k||0;this.bb.state=3;v8(this.bb,m);this.A="UNSUPPORTED";I8("Connecting with setPlaylist and params: "+g.tg(l));this.g.connect({method:"setPlaylist",params:g.tg(l)},a,Cya())}else I8("Connecting without params"),
this.g.connect({},a,Cya());iAa(this)};
g.h.dispose=function(){this.ha()||(this.P("beforeDispose"),J8(this,3));H8.Z.dispose.call(this)};
g.h.U=function(){K8(this);M8(this);L8(this);g.AD(this.H);this.H=window.NaN;g.AD(this.I);this.I=window.NaN;this.o=null;g.TE(this.V);this.V.length=0;this.g.dispose();H8.Z.U.call(this);this.A=this.D=this.l=this.bb=this.g=null};
g.h.MH=function(){this.C(2)};
g.h.uO=function(){I8("Channel opened");this.N&&(this.N=!1,L8(this),this.M=g.yD((0,g.z)(function(){I8("Timing out waiting for a screen.");this.C(1)},this),15E3));
Gya(sza(this.g),this.X)};
g.h.rO=function(){I8("Channel closed");(0,window.isNaN)(this.B)?W6(!0):W6();this.dispose()};
g.h.sO=function(a){W6();(0,window.isNaN)(this.F())?(I8("Channel error: "+a+" without reconnection"),this.dispose()):(this.N=!0,I8("Channel error: "+a+" with reconnection in "+this.F()+" ms"),J8(this,2))};
g.h.tO=function(a){a.params?I8("Received: action="+a.action+", params="+g.tg(a.params)):I8("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=g.Lw(a.params.devices);this.l=(0,g.H)(a,function(a){return new K6(a)});
a=!!g.Ka(this.l,function(a){return"LOUNGE_SCREEN"==a.type});
lAa(this,a);break;case "loungeScreenDisconnected":g.Ua(this.l,function(a){return"LOUNGE_SCREEN"==a.type});
lAa(this,!1);break;case "remoteConnected":var b=new K6(g.Lw(a.params.device));g.Ka(this.l,function(a){return b?a.id==b.id:!1})||g.Ra(this.l,b);
break;case "remoteDisconnected":b=new K6(g.Lw(a.params.device));g.Ua(this.l,function(a){return b?a.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":nAa(this,a);break;case "nowPlaying":pAa(this,a);break;case "onStateChange":oAa(this,a);break;case "onAdStateChange":qAa(this,a);break;case "onVolumeChanged":rAa(this,a);break;case "onSubtitlesTrackChanged":mAa(this,a);break;case "nowAutoplaying":sAa(this,a);break;case "autoplayDismissed":this.P("autoplayDismissed");break;case "autoplayUpNext":this.D=a.params.videoId||null;this.P("autoplayUpNext",this.D);break;case "onAutoplayModeChanged":this.A=
a.params.autoplayMode;this.P("autoplayModeChange",this.A);"DISABLED"==this.A&&this.P("autoplayDismissed");break;case "onHasPreviousNextChanged":tAa(this,a);break;case "requestAssistedSignIn":this.P("assistedSignInRequested",a.params.authCode);break;default:I8("Unrecognized action: "+a.action)}};
g.h.US=function(){if(this.o){var a=this.o;this.o=null;this.bb.videoId!=a&&N8(this,"getNowPlaying")}};
H8.prototype.subscribe=H8.prototype.subscribe;H8.prototype.unsubscribeByKey=H8.prototype.Jd;H8.prototype.da=function(){var a=3;this.ha()||(a=0,(0,window.isNaN)(this.F())?F7(this.g)&&(0,window.isNaN)(this.B)&&(a=1):a=2);return a};
H8.prototype.getProxyState=H8.prototype.da;H8.prototype.C=function(a){I8("Disconnecting with "+a);K8(this);this.P("beforeDisconnect",a);1==a&&W6();tza(this.g,a);this.dispose()};
H8.prototype.disconnect=H8.prototype.C;H8.prototype.ca=function(){var a=this.bb;this.o&&(a=this.bb.clone(),x8(a,this.o,a.index));return y8(a)};
H8.prototype.getPlayerContextData=H8.prototype.ca;
H8.prototype.ka=function(a){var b=new s8(a);b.videoId&&b.videoId!=this.bb.videoId&&(this.o=b.videoId,g.AD(this.H),this.H=g.yD((0,g.z)(this.US,this),5E3));var c=[];this.bb.listId==b.listId&&this.bb.videoId==b.videoId&&this.bb.index==b.index||c.push("remoteQueueChange");this.bb.g==b.g&&this.bb.volume==b.volume&&this.bb.muted==b.muted&&w8(this.bb)==w8(b)&&g.tg(this.bb.l)==g.tg(b.l)||c.push("remotePlayerChange");this.bb.reset(a);(0,g.C)(c,function(a){this.P(a)},this)};
H8.prototype.setPlayerContextData=H8.prototype.ka;H8.prototype.W=function(){var a=this.g.C.id,b=g.Ka(this.l,function(b){return"REMOTE_CONTROL"==b.type&&b.id!=a});
return b?b.id:""};
H8.prototype.getOtherConnectedRemoteId=H8.prototype.W;H8.prototype.F=function(){var a=this.g;return a.l.isActive()?a.l.l-(0,g.G)():window.NaN};
H8.prototype.getReconnectTimeout=H8.prototype.F;H8.prototype.Y=function(){return this.A||"UNSUPPORTED"};
H8.prototype.getAutoplayMode=H8.prototype.Y;H8.prototype.ba=function(){return this.D||""};
H8.prototype.getAutoplayVideoId=H8.prototype.ba;H8.prototype.oa=function(){if(!(0,window.isNaN)(this.F())){var a=this.g.l;g.Ot(a.g);a.start()}};
H8.prototype.reconnect=H8.prototype.oa;H8.prototype.fa=function(a,b){N8(this,a,b);kAa(this)};
H8.prototype.sendMessage=H8.prototype.fa;g.A(O8,O7);g.h=O8.prototype;g.h.ke=function(a){return this.bd.$_gs(a)};
g.h.contains=function(a){return!!this.bd.$_c(a)};
g.h.get=function(a){return this.bd.$_g(a)};
g.h.start=function(){this.bd.$_st()};
g.h.add=function(a,b,c){this.bd.$_a(a,b,c)};
g.h.remove=function(a,b,c){this.bd.$_r(a,b,c)};
g.h.up=function(a,b,c,d){this.bd.$_un(a,b,c,d)};
g.h.U=function(){for(var a=0,b=this.l.length;a<b;++a)this.bd.$_ubk(this.l[a]);this.l.length=0;this.bd=null;O8.Z.U.call(this)};
g.h.mU=function(){this.P("screenChange")};
g.h.qQ=function(){this.P("onlineScreenChange")};
X7.prototype.$_st=X7.prototype.start;X7.prototype.$_gspc=X7.prototype.nU;X7.prototype.$_gsppc=X7.prototype.yD;X7.prototype.$_c=X7.prototype.contains;X7.prototype.$_g=X7.prototype.get;X7.prototype.$_a=X7.prototype.add;X7.prototype.$_un=X7.prototype.up;X7.prototype.$_r=X7.prototype.remove;X7.prototype.$_gs=X7.prototype.ke;X7.prototype.$_gos=X7.prototype.xD;X7.prototype.$_s=X7.prototype.subscribe;X7.prototype.$_ubk=X7.prototype.Jd;var P8=null,Q8=null,e9=null,U8=[];g.p(f9,g.K);g.h=f9.prototype;
g.h.U=function(){g.K.prototype.U.call(this);this.A.stop();this.B.stop();this.K.stop();this.N();this.g.unsubscribe("proxyStateChange",this.mB,this);this.g.unsubscribe("remotePlayerChange",this.Cl,this);this.g.unsubscribe("remoteQueueChange",this.Ho,this);this.g.unsubscribe("autoplayUpNext",this.IA,this);this.g.unsubscribe("previousNextChange",this.jB,this);this.g.unsubscribe("nowAutoplaying",this.bB,this);this.g.unsubscribe("autoplayDismissed",this.HA,this);this.g=this.F=null};
g.h.uz=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.g.g)if(i9(this)){if(!B8(this.g).isAdPlaying()||"control_seek"!=a)switch(a){case "control_toggle_play_pause":B8(this.g).kb()?this.g.pause():this.g.play();break;case "control_play":this.g.play();break;case "control_pause":this.g.pause();break;case "control_seek":this.I.mj(c[0],c[1]);break;case "control_subtitles_set_track":j9(this,c[0]);break;case "control_set_audio_track":c=c[0],i9(this)&&this.g.Ou(this.l.ea(1).videoId,
c)}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":c=this.l.getCurrentTime();k9(this,0==c?void 0:c);break;case "control_seek":k9(this,c[0]);break;case "control_subtitles_set_track":j9(this,c[0]);break;case "control_set_audio_track":c=c[0],i9(this)&&this.g.Ou(this.l.ea(1).videoId,c)}};
g.h.oO=function(a){this.K.IH(a)};
g.h.LT=function(a){this.uz("control_subtitles_set_track",g.Ub(a)?null:a)};
g.h.HC=function(){var a=this.l.zc("captions","track");g.Ub(a)||j9(this,a)};
g.h.ZA=function(a){if(i9(this)){this.g.unsubscribe("remotePlayerChange",this.Cl,this);var b=Math.round(a.volume);a=!!a.muted;var c=B8(this.g);if(b!=c.volume||a!=c.muted)this.g.setVolume(b,a),this.M.start();this.g.subscribe("remotePlayerChange",this.Cl,this)}};
g.h.JP=function(){g.Ub(this.C)||FAa(this,this.C);this.D=!1};
g.h.mB=function(a,b){this.B.stop();2==b&&this.EC()};
g.h.Cl=function(){if(i9(this)){this.A.stop();var a=B8(this.g);switch(a.g){case 1081:case 1:h9(this,new g.dO(8));this.DC();break;case 1085:case 3:h9(this,new g.dO(9));break;case 1083:case 0:h9(this,new g.dO(2));this.I.stop();g9(this,this.l.ea().lengthSeconds);break;case 1084:h9(this,new g.dO(4));break;case 2:h9(this,new g.dO(4));g9(this,w8(a));break;case -1:h9(this,new g.dO(64));break;case -1E3:a={errorCode:"mdx.remoteerror",message:g.U("YTP_MDX_PLAYER_ERROR")},h9(this,new g.dO(128,a))}a=B8(this.g).l;
var b=this.C;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.format==b.format&&a.kind==b.kind:1)||(this.C=a,FAa(this,a));a=B8(this.g);-1==a.volume||Math.round(this.l.getVolume())==a.volume&&this.l.isMuted()==a.muted||this.M.isActive()||this.kD()}else EAa(this)};
g.h.jB=function(){this.l.P("mdxpreviousnextchange")};
g.h.Ho=function(){i9(this)||EAa(this)};
g.h.UG=function(){this.g.Iw()};
g.h.IA=function(a){a&&(a=g.OD("/watch_queue_ajax",{method:"GET",Xc:{action_get_watch_queue_item:1,video_id:a},Hb:(0,g.z)(this.PR,this)}))&&(this.N=(0,g.z)(a.abort,a))};
g.h.PR=function(a,b){var c=new g.eN({videoId:b.videoId,title:b.title,author:b.author,murlmq_webp:b.url});this.suggestion=c;this.l.P("mdxautoplayupnext",c)};
g.h.bB=function(a){(0,window.isNaN)(a)||this.l.P("mdxnowautoplaying",a)};
g.h.HA=function(){this.l.P("mdxautoplaycanceled")};
g.h.jL=function(a,b){-1==B8(this.g).g?k9(this,a):b&&this.g.vD(a)};
g.h.kD=function(){if(i9(this)){var a=B8(this.g);this.o.Ca(this.V);a.muted?this.l.mute():this.l.Yf();this.l.setVolume(a.volume);this.V=this.o.O(this.l,"onVolumeChange",this.ZA)}};
g.h.DC=function(){this.A.stop();if(!this.g.ha()){var a=B8(this.g);a.kb()&&h9(this,new g.dO(8));g9(this,w8(a));this.A.start()}};
g.h.EC=function(){this.B.stop();this.A.stop();var a=this.g.A.getReconnectTimeout();2==this.g.g&&!(0,window.isNaN)(a)&&this.B.start()};g.p(l9,g.X);l9.prototype.A=function(a){HAa(this,a.state)};g.p(m9,g.r_);m9.prototype.I=function(){var a=this.l.zc("remote","receivers");a&&1<a.length&&!this.l.zc("remote","quickCast")?(this.F=g.jb(a,this.B,this),g.s_(this,(0,g.H)(a,this.B)),a=this.l.zc("remote","currentReceiver"),this.tf(this.B(a)),this.enable(!0)):this.enable(!1)};
m9.prototype.B=function(a){return a.key};
m9.prototype.sf=function(a){return"cast-selector-receiver"==a?g.U("YTP_MDX_CAST_SELECTOR"):this.F[a].name};
m9.prototype.rd=function(a){g.r_.prototype.rd.call(this,a);this.l.Hd("remote","currentReceiver",this.F[a]);this.A.Ob()};g.p(n9,g.vU);g.h=n9.prototype;g.h.create=function(){yAa(g.zL(g.W(this.g)));this.C.push(g.sF("yt-remote-before-disconnect",this.kO,this));this.C.push(g.sF("yt-remote-connection-change",this.YQ,this));this.C.push(g.sF("yt-remote-receiver-availability-change",this.kB,this));this.C.push(g.sF("yt-remote-auto-connect",this.WQ,this));this.C.push(g.sF("yt-remote-receiver-resumed",this.VQ,this));this.kB()};
g.h.load=function(){this.g.Rs();g.vU.prototype.load.call(this);this.B=new f9(this,this.g,this.l);var a=(a=DAa())?a.currentTime:0;var b=d9()?new A8(Z8(),void 0):null;0==a&&b&&(a=w8(B8(b)));0!=a&&(this.H=a||0,this.g.P("progresssync",a,void 0));GAa(this,this.D,this.D);g.B0(this.g.app,6)};
g.h.unload=function(){this.g.P("mdxautoplaycanceled");this.A=this.o;g.Ve(this.B,this.l);this.l=this.B=null;g.vU.prototype.unload.call(this);g.B0(this.g.app,5)};
g.h.U=function(){g.tF(this.C);g.vU.prototype.U.call(this)};
g.h.il=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.B.uz.apply(this.B,[].concat([a],g.qa(c)))};
g.h.EH=function(){return this.loaded?this.B.suggestion:null};
g.h.Mf=function(){return this.l?B8(this.l).Mf:!1};
g.h.hasNext=function(){return this.l?B8(this.l).hasNext:!1};
g.h.getCurrentTime=function(){return this.H};
g.h.KK=function(){var a=B8(this.l),b=this.g.ea();return{allowSeeking:this.g.cd(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.C?a.A+u8(a):a.A,isPeggedToLive:1>=(a.C?a.o+u8(a):a.o)-this.getCurrentTime(),loaded:a.I,seekableEnd:a.C?a.o+u8(a):a.o,seekableStart:0<a.B?a.B+u8(a):a.B}};
g.h.LK=function(){this.l&&this.l.tD()};
g.h.MK=function(){this.l&&this.l.uD()};
g.h.kO=function(a){1==a&&(this.I=this.l?B8(this.l):null)};
g.h.YQ=function(){var a=d9()?new A8(Z8(),void 0):null;if(a){var b=this.A;this.loaded&&this.unload();this.l=a;this.I=null;b.key!=this.o.key&&(this.A=b,this.load())}else g.Ue(this.l),this.l=null,this.loaded&&(this.unload(),(a=this.I)&&a.videoId==this.g.ea().videoId&&this.g.Ez(a.videoId,w8(a)));this.g.P("videodatachange","newdata",this.g.ea(),3)};
g.h.kB=function(){this.F=[this.o].concat(AAa());var a=$8()||this.o;o9(this,a);this.g.sa("onMdxReceiversChange")};
g.h.WQ=function(){var a=$8();o9(this,a)};
g.h.VQ=function(){this.A=$8()};
g.h.JK=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.F;case "currentReceiver":return b&&("cast-selector-receiver"==b.key?q8():o9(this,b)),this.loaded?this.A:this.o;case "quickCast":return 2==this.F.length&&"cast-selector-receiver"==this.F[1].key?(b&&q8(),!0):!1}};
g.h.NK=function(){F8(this.l,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.h.ud=function(){return!1};g.Y_.remote=n9;})(_yt_player);
