(function(g){var window=this;'use strict';var PIa=function(a,b){return g.Nb(a,b)},k4=function(a,b,c){a.l.set(b,c)},l4=function(a){k4(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^g.Ta()).toString(36));
return a},m4=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.Um(a.l,b,c)},QIa=function(a,b){var c=[];
g.Si(b,function(d){try{var e=g.In.prototype.l.call(this,d,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}void 0===e?c.push(d):g.Hn(e)&&c.push(d)},a);
return c},RIa=function(a,b){b=QIa(a,b);
g.zb(b,function(c){g.In.prototype.remove.call(this,c)},a)},SIa=function(a){if(a.W){if(a.W.locationOverrideToken)return{locationOverrideToken:a.W.locationOverrideToken};
if(null!=a.W.latitudeE7&&null!=a.W.longitudeE7)return{latitudeE7:a.W.latitudeE7,longitudeE7:a.W.longitudeE7}}return null},TIa=function(a,b){g.fb(a,b)||a.push(b)},n4=function(a){var b=0,c;
for(c in a)b++;return b},UIa=function(a,b){b=b instanceof g.Dc?b:g.Kc(b,/^data:image\//i.test(b));
a.src=g.Ec(b)},VIa=function(a){try{return g.A.JSON.parse(a)}catch(b){}a=String(a);
if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.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("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);},WIa=function(a){if(a.kh&&"function"==typeof a.kh)return a.kh();
if("string"===typeof a)return a.split("");if(g.Na(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return g.Kb(a)},XIa=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);
else if(g.Na(a)||"string"===typeof a)g.zb(a,b,void 0);else{if(a.xi&&"function"==typeof a.xi)var c=a.xi();else if(a.kh&&"function"==typeof a.kh)c=void 0;else if(g.Na(a)||"string"===typeof a){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=g.Lb(a);d=WIa(a);e=d.length;for(var f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a)}},YIa=function(a,b,c,d){var e=new g.Im(null,void 0);
a&&g.Jm(e,a);b&&g.Km(e,b);c&&g.Lm(e,c);d&&(e.J=d);return e},o4=function(){},p4=function(a,b){g.Fo[a]=!0;
var c=g.Do();c&&c.publish.apply(c,arguments);g.Fo[a]=!1},q4=function(a){this.app=this.name=this.id="";
this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.capabilities=new Set;this.experiments=new Set;this.theme="u";new g.Fm;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",ZIa(this,a.capabilities||""),$Ia(this,a.experiments||""))},ZIa=function(a,b){a.capabilities.clear();
g.Ie(b.split(","),g.Ra(PIa,aJa)).forEach(function(c){a.capabilities.add(c)})},$Ia=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},r4=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||"";this.idType=a.screenIdType||"normal"},s4=function(a,b){return!!b&&(a.id==b||a.uuid==b)},bJa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid,screenIdType:a.idType}},cJa=function(a){return new r4(a)},dJa=function(a){return Array.isArray(a)?g.Oc(a,cJa):[]},t4=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):"-")+",idType:"+a.idType+"}"):"null"},u4=function(a){return Array.isArray(a)?"["+g.Oc(a,t4).join(",")+"]":"null"},v4=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)})},eJa=function(a){return g.Oc(a,function(b){return{key:b.id,
name:b.name}})},w4=function(a,b){return g.cb(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},x4=function(a,b){return g.cb(a,function(c){return s4(c,b)})},fJa=function(){var a=(0,g.Mu)();
a&&RIa(a,a.i.ul(!0))},y4=function(){var a=g.Pu("yt-remote-connected-devices")||[];
g.wb(a);return a},gJa=function(a){if(g.gb(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return g.Oc(a,function(d,e){return 0==e?d:d.substring(c.length)})},hJa=function(a){g.Ou("yt-remote-connected-devices",a,86400)},A4=function(){if(z4)return z4;
var a=g.Pu("yt-remote-device-id");a||(a=v4(),g.Ou("yt-remote-device-id",a,31536E3));for(var b=y4(),c=1,d=a;g.fb(b,d);)c++,d=a+"#"+c;return z4=d},B4=function(){var a=y4(),b=A4();
g.fb(a,b);g.Ru()&&g.yb(a,b);a=gJa(a);if(g.gb(a))try{g.Uq("remote_sid")}catch(c){}else try{g.Sq("remote_sid",a.join(","),-1)}catch(c){}},iJa=function(){return g.Pu("yt-remote-session-browser-channel")},jJa=function(){return g.Pu("yt-remote-local-screens")||[]},kJa=function(){g.Ou("yt-remote-lounge-token-expiration",!0,86400)},lJa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=g.Oc(jJa(),function(d){return d.loungeToken}),c=g.Oc(a,function(d){return d.loungeToken});
g.Xg(c,function(d){return!g.fb(b,d)})&&kJa();
g.Ou("yt-remote-local-screens",a,31536E3)},mJa=function(a,b){g.Ou("yt-remote-session-browser-channel",a);
g.Ou("yt-remote-session-screen-id",b);a=y4();b=A4();g.fb(a,b)||a.push(b);hJa(a);B4()},C4=function(a){a||(g.Qu("yt-remote-session-screen-id"),g.Qu("yt-remote-session-video-id"));
B4();a=y4();g.kb(a,A4());hJa(a)},nJa=function(){if(!D4){var a=g.Sn();
a&&(D4=new g.Cn(a))}},oJa=function(){nJa();
return D4?!!D4.get("yt-remote-use-staging-server"):!1},E4=function(){var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
return a?parseInt(a[1],10):0},pJa=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},qJa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},F4=function(a){a.length?rJa(a.shift(),function(){F4(a)}):G4()},sJa=function(a){return"chrome-extension://"+a+"/cast_sender.js"},rJa=function(a,b,c){var d=document.createElement("script");
d.onerror=b;c&&(d.onload=c);g.id(d,g.bg(a));(document.head||document.documentElement).appendChild(d)},tJa=function(){var a=E4(),b=[];
if(1<a){var c=a-1;b.push("//www.gstatic.com/eureka/clank/"+a+"/cast_sender.js");b.push("//www.gstatic.com/eureka/clank/"+c+"/cast_sender.js")}return b},G4=function(){var a=qJa();
a&&a(!1,"No cast extension found")},H4=function(){if(uJa){var a=2,b=qJa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;rJa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",G4,c)}},vJa=function(){H4();
var a=tJa();a.push("//www.gstatic.com/eureka/clank/cast_sender.js");F4(a)},xJa=function(){H4();
var a=tJa();a.push.apply(a,g.ma(wJa.map(sJa)));a.push("//www.gstatic.com/eureka/clank/cast_sender.js");F4(a)},I4=function(a,b,c){g.F.call(this);
this.I=null!=c?(0,g.B)(a,c):a;this.zg=b;this.C=(0,g.B)(this.BM,this);this.i=!1;this.l=0;this.u=this.Cb=null;this.B=[]},J4=function(a,b,c){g.F.call(this);
this.B=null!=c?a.bind(c):a;this.zg=b;this.u=null;this.i=!1;this.l=0;this.Cb=null},K4=function(a){a.Cb=g.Dm(function(){a.Cb=null;
a.i&&!a.l&&(a.i=!1,K4(a))},a.zg);
var b=a.u;a.u=null;a.B.apply(null,b)},L4=function(a){if(g.A.JSON)try{return g.A.JSON.parse(a)}catch(b){}return VIa(a)},M4=function(){},N4=function(a,b){if("function"!==typeof a)throw Error("Fn must not be null and must be a function");
return g.A.setTimeout(function(){a()},b)},P4=function(a){O4.dispatchEvent(new yJa(O4,a))},yJa=function(a,b){g.zl.call(this,"statevent",a);
this.stat=b},Q4=function(){},zJa=function(){},BJa=function(a){return(a=AJa(a))?new ActiveXObject(a):new XMLHttpRequest},AJa=function(a){if(!a.l&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0",
"MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.l=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.l},R4=function(a,b,c,d){this.i=a;
this.l=b;this.L=c;this.J=d||1;this.C=45E3;this.B=new g.y_(this);this.u=new g.Cm;this.u.setInterval(250)},DJa=function(a,b,c){a.Rr=1;
a.ym=l4(b.clone());a.Ep=c;a.I=!0;CJa(a,null)},S4=function(a,b,c,d,e){a.Rr=1;
a.ym=l4(b.clone());a.Ep=null;a.I=c;e&&(a.LJ=!1);CJa(a,d)},CJa=function(a,b){a.Ir=Date.now();
T4(a);a.Fn=a.ym.clone();m4(a.Fn,"t",a.J);a.ov=0;a.rf=a.i.jA(a.i.Nu()?b:null);0<a.pz&&(a.Cx=new J4((0,g.B)(a.CK,a,a.rf),a.pz));a.B.Na(a.rf,"readystatechange",a.PS);b=a.Un?g.Ub(a.Un):{};a.Ep?(a.wy="POST",b["Content-Type"]="application/x-www-form-urlencoded",a.rf.send(a.Fn,a.wy,a.Ep,b)):(a.wy="GET",a.LJ&&!g.ye&&(b.Connection="close"),a.rf.send(a.Fn,a.wy,null,b));a.i.uj(1)},GJa=function(a,b,c){for(var d=!0;!a.Fo&&a.ov<c.length;){var e=EJa(a,c);
if(e==U4){4==b&&(a.nm=4,P4(15),d=!1);break}else if(e==FJa){a.nm=4;P4(16);d=!1;break}else V4(a,e)}4==b&&0==c.length&&(a.nm=1,P4(17),d=!1);a.Ij=a.Ij&&d;d||(W4(a),X4(a))},EJa=function(a,b){var c=a.ov,d=b.indexOf("\n",c);
if(-1==d)return U4;c=Number(b.substring(c,d));if(isNaN(c))return FJa;d+=1;if(d+c>b.length)return U4;b=b.substr(d,c);a.ov=d+c;return b},IJa=function(a,b){a.Ir=Date.now();
T4(a);var c=b?window.location.hostname:"";a.Fn=a.ym.clone();k4(a.Fn,"DOMAIN",c);k4(a.Fn,"t",a.J);try{a.Lj=new ActiveXObject("htmlfile")}catch(m){W4(a);a.nm=7;P4(22);X4(a);return}var d="<html><body>";if(b){var e="";for(b=0;b<c.length;b++){var f=c.charAt(b);if("<"==f)f=e+"\\x3c";else if(">"==f)f=e+"\\x3e";else{if(f in Y4)f=Y4[f];else if(f in HJa)f=Y4[f]=HJa[f];else{var h=f.charCodeAt(0);if(31<h&&127>h)var l=f;else{if(256>h){if(l="\\x",16>h||256<h)l+="0"}else l="\\u",4096>h&&(l+="0");l+=h.toString(16).toUpperCase()}f=
Y4[f]=l}f=e+f}e=f}d+='<script>document.domain="'+e+'"\x3c/script>'}c=g.fd(g.gc("b/12014412"),d+"</body></html>");a.Lj.open();a.Lj.write(g.bd(c));a.Lj.close();a.Lj.parentWindow.m=(0,g.B)(a.mS,a);a.Lj.parentWindow.d=(0,g.B)(a.YI,a,!0);a.Lj.parentWindow.rpcClose=(0,g.B)(a.YI,a,!1);c=a.Lj.createElement("DIV");a.Lj.parentWindow.document.body.appendChild(c);d=g.Ic(a.Fn.toString());d=g.nd(g.Ec(d));d=g.fd(g.gc("b/12014412"),'<iframe src="'+d+'"></iframe>');g.gd(c,d);a.i.uj(1)},T4=function(a){a.yD=Date.now()+
a.C;
JJa(a,a.C)},JJa=function(a,b){if(null!=a.Wr)throw Error("WatchDog timer not null");
a.Wr=N4((0,g.B)(a.uS,a),b)},Z4=function(a){a.Wr&&(g.A.clearTimeout(a.Wr),a.Wr=null)},X4=function(a){a.i.zE()||a.Fo||a.i.Fv(a)},W4=function(a){Z4(a);
g.ui(a.Cx);a.Cx=null;a.u.stop();g.BDa(a.B);if(a.rf){var b=a.rf;a.rf=null;b.abort();b.dispose()}a.Lj&&(a.Lj=null)},V4=function(a,b){try{a.i.QI(a,b),a.i.uj(4)}catch(c){}},LJa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;KJa(a,b,function(h){h?c(!0):g.A.setTimeout(function(){LJa(a,b,c,d,f)},f)})}},KJa=function(a,b,c){var d=new Image;
d.onload=function(){try{$4(d),c(!0)}catch(e){}};
d.onerror=function(){try{$4(d),c(!1)}catch(e){}};
d.onabort=function(){try{$4(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{$4(d),c(!1)}catch(e){}};
g.A.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
UIa(d,a)},$4=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},a5=function(a){g.Tl.call(this);
this.headers=new g.Fm;this.va=a||null;this.B=!1;this.ra=this.i=null;this.Ma=this.W="";this.I=0;this.u="";this.C=this.Aa=this.L=this.Ca=!1;this.J=0;this.X=null;this.Ra="";this.Y=this.Ga=!1},MJa=function(a){return g.we&&g.Xd(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},NJa=function(a){return"content-type"==a.toLowerCase()},PJa=function(a,b){a.B=!1;
a.i&&(a.C=!0,a.i.abort(),a.C=!1);a.u=b;a.I=5;OJa(a);b5(a)},OJa=function(a){a.Ca||(a.Ca=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))},RJa=function(a){if(a.B&&"undefined"!=typeof g.C_)if(a.ra[1]&&4==c5(a)&&2==a.getStatus())d5(a,"Local request error detected and ignored");
else if(a.L&&4==c5(a))g.Dm(a.MI,0,a);else if(a.dispatchEvent("readystatechange"),a.isComplete()){d5(a,"Request complete");a.B=!1;try{var b=a.getStatus();a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break a;default:c=!1}var d;if(!(d=c)){var e;if(e=0===b){var f=g.wd(1,String(a.W));if(!f&&g.A.self&&g.A.self.location){var h=g.A.self.location.protocol;f=h.substr(0,h.length-1)}e=!QJa.test(f?f.toLowerCase():"")}d=e}if(d)a.dispatchEvent("complete"),a.dispatchEvent("success");
else{a.I=6;try{var l=2<c5(a)?a.i.statusText:""}catch(m){l=""}a.u=l+" ["+a.getStatus()+"]";OJa(a)}}finally{b5(a)}}},b5=function(a,b){if(a.i){SJa(a);
var c=a.i,d=a.ra[0]?g.Ka:null;a.i=null;a.ra=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){}}},SJa=function(a){a.i&&a.Y&&(a.i.ontimeout=null);
a.X&&(g.A.clearTimeout(a.X),a.X=null)},c5=function(a){return a.i?a.i.readyState:0},e5=function(a){try{return a.i?a.i.responseText:""}catch(b){return""}},d5=function(a,b){return b+" ["+a.Ma+" "+a.W+" "+a.getStatus()+"]"},TJa=function(a){this.i=a;
this.l=new M4},UJa=function(a){var b=f5(a.i,a.Ms,"/mail/images/cleardot.gif");
l4(b);LJa(b.toString(),5E3,(0,g.B)(a.yN,a),3,2E3);a.uj(1)},h5=function(a){var b=a.i.L;
if(null!=b)P4(5),b?(P4(11),g5(a.i,a,!1)):(P4(12),g5(a.i,a,!0));else if(a.Ch=new R4(a,void 0,void 0,void 0),a.Ch.Un=a.qz,b=a.i,b=f5(b,b.Nu()?a.Cs:null,a.rz),P4(5),!g.we||g.Yd(10))m4(b,"TYPE","xmlhttp"),S4(a.Ch,b,!1,a.Cs,!1);else{m4(b,"TYPE","html");var c=a.Ch;a=!!a.Cs;c.Rr=3;c.ym=l4(b.clone());IJa(c,a)}},i5=function(a,b,c){this.bb=1;
this.i=[];this.u=[];this.B=new M4;this.J=a||null;this.L=null!=b?b:null;this.C=c||!1},VJa=function(a,b){this.i=a;
this.map=b;this.context=null},WJa=function(a,b,c,d){g.zl.call(this,"timingevent",a);
this.size=b;this.Gu=d},XJa=function(a){g.zl.call(this,"serverreachability",a)},$Ja=function(a){YJa(a);
if(3==a.bb){var b=a.au++,c=a.cw.clone();k4(c,"SID",a.l);k4(c,"RID",b);k4(c,"TYPE","terminate");j5(a,c);b=new R4(a,a.l,b,void 0);b.Rr=2;b.ym=l4(c.clone());UIa(new Image,b.ym.toString());b.Ir=Date.now();T4(b)}ZJa(a)},aKa=function(a){a.TN(1,0);
a.cw=f5(a,null,a.sz);k5(a)},YJa=function(a){a.Cm&&(a.Cm.abort(),a.Cm=null);
a.Ie&&(a.Ie.cancel(),a.Ie=null);a.wl&&(g.A.clearTimeout(a.wl),a.wl=null);l5(a);a.hh&&(a.hh.cancel(),a.hh=null);a.Lm&&(g.A.clearTimeout(a.Lm),a.Lm=null)},bKa=function(a,b){if(0==a.bb)throw Error("Invalid operation: sending map when state is closed");
a.i.push(new VJa(a.mP++,b));2!=a.bb&&3!=a.bb||k5(a)},cKa=function(a){var b=0;
a.Ie&&b++;a.hh&&b++;return b},k5=function(a){a.hh||a.Lm||(a.Lm=N4((0,g.B)(a.WI,a),0),a.Pq=0)},eKa=function(a,b){if(1==a.bb){if(!b){a.au=Math.floor(1E5*Math.random());
b=a.au++;var c=new R4(a,"",b,void 0);c.Un=a.fk;var d=m5(a),e=a.cw.clone();k4(e,"RID",b);k4(e,"CVER","1");j5(a,e);DJa(c,e,d);a.hh=c;a.bb=2}}else 3==a.bb&&(b?dKa(a,b):0==a.i.length||a.hh||dKa(a))},dKa=function(a,b){if(b)if(6<a.Go){a.i=a.u.concat(a.i);
a.u.length=0;var c=a.au-1;b=m5(a)}else c=b.L,b=b.Ep;else c=a.au++,b=m5(a);var d=a.cw.clone();k4(d,"SID",a.l);k4(d,"RID",c);k4(d,"AID",a.qr);j5(a,d);c=new R4(a,a.l,c,a.Pq+1);c.Un=a.fk;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.hh=c;DJa(c,d,b)},j5=function(a,b){a.qg&&(a=a.qg.tG())&&g.Cb(a,function(c,d){k4(b,d,c)})},m5=function(a){var b=Math.min(a.i.length,1E3),c=["count="+b];
if(6<a.Go&&0<b){var d=a.i[0].i;c.push("ofs="+d)}else d=0;for(var e={},f=0;f<b;e={aq:e.aq},f++){e.aq=a.i[f].i;var h=a.i[f].map;e.aq=6>=a.Go?f:e.aq-d;try{g.Cb(h,function(l){return function(m,n){c.push("req"+l.aq+"_"+n+"="+encodeURIComponent(m))}}(e))}catch(l){c.push("req"+e.aq+"_type="+encodeURIComponent("_badmap"))}}a.u=a.u.concat(a.i.splice(0,b));
return c.join("&")},fKa=function(a){a.Ie||a.wl||(a.I=1,a.wl=N4((0,g.B)(a.VI,a),0),a.Cq=0)},n5=function(a){if(a.Ie||a.wl||3<=a.Cq)return!1;
a.I++;a.wl=N4((0,g.B)(a.VI,a),gKa(a,a.Cq));a.Cq++;return!0},g5=function(a,b,c){a.uy=c;
a.gk=b.dl;a.C||aKa(a)},l5=function(a){null!=a.Oo&&(g.A.clearTimeout(a.Oo),a.Oo=null)},gKa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},o5=function(a,b){if(2==b||9==b){var c=null;
a.qg&&(c=null);var d=(0,g.B)(a.tT,a);c||(c=new g.Im("//www.google.com/images/cleardot.gif"),l4(c));KJa(c.toString(),1E4,d)}else P4(2);hKa(a,b)},hKa=function(a,b){a.bb=0;
a.qg&&a.qg.KF(b);ZJa(a);YJa(a)},ZJa=function(a){a.bb=0;
a.gk=-1;if(a.qg)if(0==a.u.length&&0==a.i.length)a.qg.Uz();else{g.ob(a.u);var b=g.ob(a.i);a.u.length=0;a.i.length=0;a.qg.Uz(b)}},f5=function(a,b,c){var d=g.Qm(c);
if(""!=d.i)b&&g.Km(d,b+"."+d.i),g.Lm(d,d.u);else{var e=window.location;d=YIa(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.gt&&g.Cb(a.gt,function(f,h){k4(d,h,f)});
k4(d,"VER",a.Go);j5(a,d);return d},iKa=function(){},jKa=function(){this.i=[];
this.l=[]},kKa=function(a,b){this.action=a;
this.params=b||{}},p5=function(a,b){g.F.call(this);
this.i=new g.J(this.eS,0,this);g.H(this,this.i);this.zg=5E3;this.l=0;if("function"===typeof a)b&&(a=(0,g.B)(a,b));else if(a&&"function"===typeof a.handleEvent)a=(0,g.B)(a.handleEvent,a);else throw Error("Invalid listener argument");this.u=a},q5=function(a,b,c,d,e){c=void 0===c?!1:c;
d=void 0===d?function(){return""}:d;
e=void 0===e?!1:e;this.ra=a;this.I=b;this.u=new g.Bn;this.l=new p5(this.aT,this);this.i=null;this.X=!1;this.C=null;this.W="";this.L=this.B=0;this.J=[];this.va=c;this.Y=d;this.Ca=e},lKa=function(a){return{firstTestResults:[""],
secondTestResults:!a.i.uy,sessionId:a.i.l,arrayId:a.i.qr}},mKa=function(a,b){a.L=b||0;
a.l.stop();r5(a);a.i&&(3==a.i.getState()&&eKa(a.i),$Ja(a.i));a.L=0},s5=function(a){return!!a.i&&3==a.i.getState()},r5=function(a){if(a.i){var b=a.Y(),c=a.i.fk||{};
b?c["x-youtube-lounge-xsrf-token"]=b:delete c["x-youtube-lounge-xsrf-token"];a.i.fk=c}},t5=function(a){this.port=this.domain="";
this.i="/api/lounge";this.l=!0;a=a||document.location.href;var b=Number(g.wd(4,a))||"";b&&(this.port=":"+b);this.domain=g.xd(a)||"";a=g.Uc;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.Bc(a,"10.0")&&(this.l=!1))},u5=function(a,b){var c=a.i;
a.l&&(c="https://"+a.domain+a.port+a.i);return g.Id(c+b,{})},v5=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Ra(a.B,d,!0),onError:g.Ra(a.u,e),onTimeout:g.Ra(a.C,e)};c&&(a.postParams=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.Yp(b,a)},qKa=function(){var a=nKa;
oKa();w5.push(a);pKa()},x5=function(a,b){oKa();
var c=rKa(a,String(b));g.gb(w5)?sKa(c):(pKa(),g.zb(w5,function(d){d(c)}))},oKa=function(){w5||(w5=g.Ja("yt.mdx.remote.debug.handlers_")||[],g.Fa("yt.mdx.remote.debug.handlers_",w5,void 0))},sKa=function(a){var b=(y5+1)%50;
y5=b;z5[b]=a;A5||(A5=49==b)},pKa=function(){var a=w5;
if(z5[0]){var b=A5?y5:-1;do{b=(b+1)%50;var c=z5[b];g.zb(a,function(d){d(c)})}while(b!=y5);
z5=Array(50);y5=-1;A5=!1}},rKa=function(a,b){var c=(Date.now()-tKa)/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("")},B5=function(a){g.P.call(this);
this.I=a;this.screens=[]},uKa=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c)return a=c.name,c.id=b.id||c.id,c.name=b.name,c.token=b.token,c.uuid=b.uuid||c.uuid,c.name!=a;a.screens.push(b);return!0},vKa=function(a,b){var c=a.screens.length!=b.length;
a.screens=g.Ie(a.screens,function(f){return!!w4(b,f)});
for(var d=0,e=b.length;d<e;d++)c=uKa(a,b[d])||c;return c},wKa=function(a,b){var c=a.screens.length;
a.screens=g.Ie(a.screens,function(d){return!(d||b?!d!=!b?0:d.id==b.id:1)});
return a.screens.length<c},C5=function(a,b,c,d,e){g.P.call(this);
this.u=a;this.J=b;this.B=c;this.I=d;this.C=e;this.l=0;this.i=null;this.Cb=NaN},E5=function(a){B5.call(this,"LocalScreenService");
this.l=a;this.i=NaN;D5(this);this.info("Initializing with "+u4(this.screens))},xKa=function(a){if(a.screens.length){var b=g.Oc(a.screens,function(d){return d.id}),c=u5(a.l,"/pairing/get_lounge_token_batch");
v5(a.l,c,{screen_ids:b.join(",")},(0,g.B)(a.qO,a),(0,g.B)(a.pO,a))}},D5=function(a){if(g.Qo("deprecate_pair_servlet_enabled"))return vKa(a,[]);
var b=dJa(jJa());b=g.Ie(b,function(c){return!c.uuid});
return vKa(a,b)},F5=function(a,b){lJa(g.Oc(a.screens,bJa));
b&&kJa()},H5=function(a,b){g.P.call(this);
this.I=b;b=(b=g.Pu("yt-remote-online-screen-ids")||"")?b.split(","):[];for(var c={},d=this.I(),e=0,f=d.length;e<f;++e){var h=d[e].id;c[h]=g.fb(b,h)}this.i=c;this.C=a;this.u=this.B=NaN;this.l=null;G5("Initialized with "+g.uj(this.i))},I5=function(a,b,c){var d=u5(a.C,"/pairing/get_screen_availability");
v5(a.C,d,{lounge_token:b.token},(0,g.B)(function(e){e=e.screens||[];for(var f=0,h=e.length;f<h;++f)if(e[f].loungeToken==b.token){c("online"==e[f].status);return}c(!1)},a),(0,g.B)(function(){c(!1)},a))},J5=function(a,b){a:if(n4(b)!=n4(a.i))var c=!1;
else{c=g.Lb(b);for(var d=0,e=c.length;d<e;++d)if(!a.i[c[d]]){c=!1;break a}c=!0}c||(G5("Updated online screens: "+g.uj(a.i)),a.i=b,a.V("screenChange"));yKa(a)},K5=function(a){isNaN(a.u)||g.Co(a.u);
a.u=g.Ao((0,g.B)(a.wC,a),0<a.B&&a.B<g.Ta()?2E4:1E4)},G5=function(a){x5("OnlineScreenService",a)},zKa=function(a){var b={};
g.zb(a.I(),function(c){c.token?b[c.token]=c.id:this.oe("Requesting availability of screen w/o lounge token.")});
return b},yKa=function(a){a=g.Lb(g.Db(a.i,function(b){return b}));
g.wb(a);a.length?g.Ou("yt-remote-online-screen-ids",a.join(","),60):g.Qu("yt-remote-online-screen-ids")},L5=function(a){B5.call(this,"ScreenService");
this.B=a;this.i=this.l=null;this.u=[];this.C={};AKa(this)},CKa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.C[b]);var h=a.Mh();if(h=(c?x4(h,c):null)||x4(h,b)){h.uuid=b;var l=M5(a,h);I5(a.i,l,function(m){e(m?l:null)})}else c?BKa(a,c,(0,g.B)(function(m){var n=M5(this,new r4({name:d,
screenId:c,loungeToken:m,dialId:b||""}));I5(this.i,n,function(p){e(p?n:null)})},a),f):e(null)},DKa=function(a,b){for(var c=0,d=a.screens.length;c<d;++c)if(a.screens[c].name==b)return a.screens[c];
return null},EKa=function(a,b,c){I5(a.i,b,c)},BKa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={postParams:{screen_ids:b},method:"POST",context:a,onSuccess:function(f,h){f=h&&h.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.Yp(u5(a.B,"/pairing/get_lounge_token_batch"),e)},FKa=function(a){a.screens=a.l.Mh();
var b=a.C,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.screens.length;b<d;++b){var e=a.screens[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+u4(a.screens))},AKa=function(a){N5(a);
a.l=new E5(a.B);a.l.subscribe("screenChange",(0,g.B)(a.wO,a));FKa(a);a.u=dJa(g.Pu("yt-remote-automatic-screen-cache")||[]);N5(a);a.info("Initializing automatic screens: "+u4(a.u));a.i=new H5(a.B,(0,g.B)(a.Mh,a,!0));a.i.subscribe("screenChange",(0,g.B)(function(){this.V("onlineScreenChange")},a))},M5=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=x4(a.u,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.u.push(b),GKa(a));N5(a);a.C[b.uuid]=b.id;g.Ou("yt-remote-device-id-map",a.C,31536E3);return b},GKa=function(a){a=g.Ie(a.u,function(b){return"shortLived"!=b.idType});
g.Ou("yt-remote-automatic-screen-cache",g.Oc(a,bJa))},N5=function(a){a.C=g.Pu("yt-remote-device-id-map")||{}},O5=function(a,b,c){g.P.call(this);
this.Ca=c;this.u=a;this.i=b;this.B=null},P5=function(a,b){a.B=b;
a.V("sessionScreen",a.B)},HKa=function(a,b){a.B&&(a.B.token=b,M5(a.u,a.B));
a.V("sessionScreen",a.B)},Q5=function(a,b){x5(a.Ca,b)},R5=function(a,b,c){O5.call(this,a,b,"CastSession");
var d=this;this.Aa=c;this.l=null;this.Y=(0,g.B)(this.GM,this);this.va=(0,g.B)(this.yS,this);this.X=g.Ao(function(){IKa(d,null)},12E4);
this.J=this.C=this.I=this.L=0;this.ra=!1;this.W="unknown"},S5=function(a,b){g.Co(a.J);
a.J=0;0==b?JKa(a):a.J=g.Ao(function(){JKa(a)},b)},JKa=function(a){KKa(a,"getLoungeToken");
g.Co(a.C);a.C=g.Ao(function(){LKa(a,null)},3E4)},KKa=function(a,b){a.info("sendYoutubeMessage_: "+b+" "+g.uj(void 0));
var c={};c.type=b;a.l?a.l.sendMessage("urn:x-cast:com.google.youtube.mdx",c,g.Ka,(0,g.B)(function(){Q5(this,"Failed to send message: "+b+".")},a)):Q5(a,"Sending yt message without session: "+g.uj(c))},T5=function(a,b){b?(a.info("onConnectedScreenId_: Received screenId: "+b),a.getScreen()&&a.getScreen().id==b||a.IG(b,function(c){P5(a,c)},function(){return a.Tg()},5)):a.Tg(Error("Waiting for session status timed out."))},NKa=function(a,b,c){a.info("onConnectedScreenData_: Received screenData: "+JSON.stringify(b));
var d=new r4(b);MKa(a,d,function(e){e?(a.ra=!0,M5(a.u,d),P5(a,d),a.W="unknown",S5(a,c)):(g.xo(Error("CastSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online.")),a.Tg())},5)},IKa=function(a,b){g.Co(a.X);
a.X=0;b?a.Aa.enableCastLoungeToken&&b.loungeToken?b.deviceId?a.getScreen()&&a.getScreen().uuid==b.deviceId||(b.loungeTokenRefreshIntervalMs?NKa(a,{name:a.i.friendlyName,screenId:b.screenId,loungeToken:b.loungeToken,dialId:b.deviceId,screenIdType:"shortLived"},b.loungeTokenRefreshIntervalMs):(g.xo(Error("No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: "+JSON.stringify(b)+".")),T5(a,b.screenId))):(g.xo(Error("No device id presents in mdxSessionStatusData: "+JSON.stringify(b)+".")),
T5(a,b.screenId)):T5(a,b.screenId):a.Tg(Error("Waiting for session status timed out."))},LKa=function(a,b){g.Co(a.C);
a.C=0;var c=null;if(b)if(b.loungeToken){var d;(null==(d=a.getScreen())?void 0:d.token)==b.loungeToken&&(c="staleLoungeToken")}else c="missingLoungeToken";else c="noLoungeTokenResponse";c?(a.info("Did not receive a new lounge token in onLoungeToken_ with data: "+(JSON.stringify(b)+", error: "+c)),a.W=c,S5(a,3E4)):(HKa(a,b.loungeToken),a.ra=!1,a.W="unknown",S5(a,b.loungeTokenRefreshIntervalMs))},MKa=function(a,b,c,d){g.Co(a.I);
a.I=0;EKa(a.u,b,function(e){e||0>d?c(e):a.I=g.Ao(function(){MKa(a,b,c,d-1)},300)})},OKa=function(a){g.Co(a.L);
a.L=0;g.Co(a.I);a.I=0;g.Co(a.X);a.X=0;g.Co(a.C);a.C=0;g.Co(a.J);a.J=0},U5=function(a,b,c,d){O5.call(this,a,b,"DialSession");
this.Ga=d;this.l=this.L=null;this.va="";this.Ma=c;this.Da=null;this.X=g.Ka;this.W=NaN;this.Aa=(0,g.B)(this.HM,this);this.C=g.Ka;this.J=this.I=0;this.Y=!1;this.ra="unknown"},V5=function(a){var b;
return!!(a.Ga.enableDialLoungeToken&&(null==(b=a.l)?0:b.getDialAppInfo))},PKa=function(a){a.C=a.u.BE(a.va,a.i.label,a.i.friendlyName,V5(a),function(b,c){a.C=g.Ka;
a.Y=!0;P5(a,b);"shortLived"==b.idType&&0<c&&W5(a,c)},function(b){a.C=g.Ka;
a.Tg(b)})},QKa=function(a){var b={};
b.pairingCode=a.va;b.theme=a.Ma;oJa()&&(b.env_useStageMdx=1);return g.Gd(b)},X5=function(a){return new Promise(function(b){a.va=v4();
if(a.Da){var c=new chrome.cast.DialLaunchResponse(!0,QKa(a));b(c);PKa(a)}else a.X=function(){g.Co(a.W);a.X=function(){};
a.W=NaN;var d=new chrome.cast.DialLaunchResponse(!0,QKa(a));b(d);PKa(a)},a.W=g.Ao(function(){a.X()},100)})},SKa=function(a,b,c){a.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(b));
var d=new r4(b);return(new Promise(function(e){RKa(a,d,function(f){f?(a.Y=!0,M5(a.u,d),P5(a,d),W5(a,c)):g.xo(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online."));e(f)},5)})).then(function(e){return e?new chrome.cast.DialLaunchResponse(!1):X5(a)})},TKa=function(a,b){var c=a.L.receiver.label,d=a.i.friendlyName;
return(new Promise(function(e){CKa(a.u,c,b,d,function(f){f&&f.token&&P5(a,f);e(f)},function(f){Q5(a,"Failed to get DIAL screen: "+f);
e(null)})})).then(function(e){return e&&e.token?new chrome.cast.DialLaunchResponse(!1):X5(a)})},RKa=function(a,b,c,d){g.Co(a.I);
a.I=0;EKa(a.u,b,function(e){e||0>d?c(e):a.I=g.Ao(function(){RKa(a,b,c,d-1)},300)})},W5=function(a,b){a.info("getDialAppInfoWithTimeout_ "+b);
V5(a)&&(g.Co(a.J),a.J=0,0==b?UKa(a):a.J=g.Ao(function(){UKa(a)},b))},UKa=function(a){V5(a)&&a.l.getDialAppInfo(function(b){a.info("getDialAppInfo dialLaunchData: "+JSON.stringify(b));
b=b.extraData||{};var c=null;if(b.loungeToken){var d;(null==(d=a.getScreen())?void 0:d.token)==b.loungeToken&&(c="staleLoungeToken")}else c="missingLoungeToken";c?(a.ra=c,W5(a,3E4)):(a.Y=!1,a.ra="unknown",HKa(a,b.loungeToken),W5(a,b.loungeTokenRefreshIntervalMs))},function(b){a.info("getDialAppInfo error: "+b);
a.ra="noLoungeTokenResponse";W5(a,3E4)})},VKa=function(a){g.Co(a.I);
a.I=0;g.Co(a.J);a.J=0;a.C();a.C=function(){};
g.Co(a.W)},Y5=function(a,b){O5.call(this,a,b,"ManualSession");
this.l=g.Ao((0,g.B)(this.rr,this,null),150)},Z5=function(a,b){g.P.call(this);
this.B=b;this.l=a;this.L=b.appId||"233637DE";this.C=b.theme||"cl";this.W=b.disableCastApi||!1;this.i=null;this.J=!1;this.u=[];this.I=(0,g.B)(this.uR,this)},WKa=function(a,b){return b?g.cb(a.u,function(c){return s4(b,c.label)},a):null},$5=function(a){x5("Controller",a)},nKa=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},a6=function(a){return a.J||!!a.u.length||!!a.i},b6=function(a,b,c){b!=a.i&&(g.ui(a.i),(a.i=b)?(c?a.V("yt-remote-cast2-receiver-resumed",
b.i):a.V("yt-remote-cast2-receiver-selected",b.i),b.subscribe("sessionScreen",(0,g.B)(a.TI,a,b)),b.getScreen()?a.V("yt-remote-cast2-session-change",b.getScreen()):c&&a.i.rr(null)):a.V("yt-remote-cast2-session-change",null))},XKa=function(a){var b=a.l.AE(),c=a.i&&a.i.i;
a=g.Oc(b,function(d){c&&s4(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=WKa(this,d);f?(f.label=e,f.friendlyName=d.name):(f=new chrome.cast.Receiver(e,d.name),f.receiverType=chrome.cast.ReceiverType.CUSTOM);return f},a);
c&&(c.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(c=new chrome.cast.Receiver(c.label,c.friendlyName),c.receiverType=chrome.cast.ReceiverType.CUSTOM),a.push(c));return a},bLa=function(a,b,c,d){d.disableCastApi?c6("Cannot initialize because disabled by Mdx config."):YKa()?ZKa(b,d)&&(d6(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?$Ka(a,c):(window.__onGCastApiAvailable=function(e,f){e?$Ka(a,c):(e6("Failed to load cast API: "+f),f6(!1),d6(!1),g.Qu("yt-remote-cast-available"),g.Qu("yt-remote-cast-receiver"),
aLa(),c(!1))},d.loadCastApiSetupScript?g.Mo("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"):0<=window.navigator.userAgent.indexOf("Android")&&0<=window.navigator.userAgent.indexOf("Chrome/")&&window.navigator.presentation?60<=E4()&&vJa():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?G4():89<=E4()?xJa():(H4(),F4(wJa.map(sJa))))):c6("Cannot initialize because not running Chrome")},aLa=function(){c6("dispose");
var a=g6();a&&a.dispose();g.Fa("yt.mdx.remote.cloudview.instance_",null,void 0);cLa(!1);g.Io(h6);h6.length=0},i6=function(){return!!g.Pu("yt-remote-cast-installed")},dLa=function(){var a=g.Pu("yt-remote-cast-receiver");
return a?a.friendlyName:null},eLa=function(){c6("clearCurrentReceiver");
g.Qu("yt-remote-cast-receiver")},fLa=function(){return i6()?g6()?g6().getCastSession():(e6("getCastSelector: Cast is not initialized."),null):(e6("getCastSelector: Cast API is not installed!"),null)},k6=function(){i6()?g6()?j6()?(c6("Requesting cast selector."),g6().requestSession()):(c6("Wait for cast API to be ready to request the session."),h6.push(g.Ho("yt-remote-cast2-api-ready",k6))):e6("requestCastSelector: Cast is not initialized."):e6("requestCastSelector: Cast API is not installed!")},l6=
function(a,b){j6()?g6().setConnectedScreenStatus(a,b):e6("setConnectedScreenStatus called before ready.")},YKa=function(){var a=0<=g.Uc.search(/ (CrMo|Chrome|CriOS)\//);
return g.wB||a},gLa=function(a,b){g6().init(a,b)},ZKa=function(a,b){var c=!1;
g6()||(a=new Z5(a,b),a.subscribe("yt-remote-cast2-availability-change",function(d){g.Ou("yt-remote-cast-available",d);p4("yt-remote-cast2-availability-change",d)}),a.subscribe("yt-remote-cast2-receiver-selected",function(d){c6("onReceiverSelected: "+d.friendlyName);
g.Ou("yt-remote-cast-receiver",d);p4("yt-remote-cast2-receiver-selected",d)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(d){c6("onReceiverResumed: "+d.friendlyName);
g.Ou("yt-remote-cast-receiver",d);p4("yt-remote-cast2-receiver-resumed",d)}),a.subscribe("yt-remote-cast2-session-change",function(d){c6("onSessionChange: "+t4(d));
d||g.Qu("yt-remote-cast-receiver");p4("yt-remote-cast2-session-change",d)}),g.Fa("yt.mdx.remote.cloudview.instance_",a,void 0),c=!0);
c6("cloudview.createSingleton_: "+c);return c},g6=function(){return g.Ja("yt.mdx.remote.cloudview.instance_")},$Ka=function(a,b){f6(!0);
d6(!1);gLa(a,function(c){c?(cLa(!0),g.Jo("yt-remote-cast2-api-ready")):(e6("Failed to initialize cast API."),f6(!1),g.Qu("yt-remote-cast-available"),g.Qu("yt-remote-cast-receiver"),aLa());b(c)})},c6=function(a){x5("cloudview",a)},e6=function(a){x5("cloudview",a)},f6=function(a){c6("setCastInstalled_ "+a);
g.Ou("yt-remote-cast-installed",a)},j6=function(){return!!g.Ja("yt.mdx.remote.cloudview.apiReady_")},cLa=function(a){c6("setApiReady_ "+a);
g.Fa("yt.mdx.remote.cloudview.apiReady_",a,void 0)},d6=function(a){g.Fa("yt.mdx.remote.cloudview.initializing_",a,void 0)},m6=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.I=this.J=0;this.trackData=null;this.hasNext=this.Fk=!1;this.L=this.C=this.i=this.B=0;this.u=NaN;this.l=!1;this.reset(a)},n6=function(a){a.audioTrackId=null;
a.trackData=null;a.playerState=-1;a.Fk=!1;a.hasNext=!1;a.J=0;a.I=g.Ta();a.B=0;a.i=0;a.C=0;a.L=0;a.u=NaN;a.l=!1},o6=function(a){return a.pc()?(g.Ta()-a.I)/1E3:0},p6=function(a,b){a.J=b;
a.I=g.Ta()},q6=function(a){switch(a.playerState){case 1:case 1081:return(g.Ta()-a.I)/1E3+a.J;
case -1E3:return 0}return a.J},r6=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&n6(a)},s6=function(a){var b={};
b.index=a.index;b.listId=a.listId;b.videoId=a.videoId;b.playerState=a.playerState;b.volume=a.volume;b.muted=a.muted;b.audioTrackId=a.audioTrackId;b.trackData=g.Vb(a.trackData);b.hasPrevious=a.Fk;b.hasNext=a.hasNext;b.playerTime=a.J;b.playerTimeAt=a.I;b.seekableStart=a.B;b.seekableEnd=a.i;b.duration=a.C;b.loadedTime=a.L;b.liveIngestionTime=a.u;return b},u6=function(a,b){g.P.call(this);
this.bb=0;this.u=a;this.C=[];this.B=new jKa;this.l=this.i=null;this.L=(0,g.B)(this.WP,this);this.I=(0,g.B)(this.ju,this);this.J=(0,g.B)(this.VP,this);this.W=(0,g.B)(this.dQ,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.IC,this),hLa(this))):c=3;0!=c&&(b?this.IC(c):g.Ao((0,g.B)(function(){this.IC(c)},this),0));
(a=fLa())&&t6(this,a);this.subscribe("yt-remote-cast2-session-change",this.W)},v6=function(a){return new m6(a.u.getPlayerContextData())},hLa=function(a){g.zb("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(b){this.C.push(this.u.subscribe(b,g.Ra(this.rR,b),this))},a)},iLa=function(a){g.zb(a.C,function(b){this.u.unsubscribeByKey(b)},a);
a.C.length=0},w6=function(a){return 1==a.getState()},x6=function(a,b){var c=a.B;
50>c.i.length+c.l.length&&a.B.l.push(b)},z6=function(a,b,c){var d=v6(a);
p6(d,c);-1E3!=d.playerState&&(d.playerState=b);y6(a,d)},A6=function(a,b,c){a.u.sendMessage(b,c)},y6=function(a,b){iLa(a);
a.u.setPlayerContextData(s6(b));hLa(a)},t6=function(a,b){a.l&&(a.l.removeUpdateListener(a.L),a.l.removeMediaListener(a.I),a.ju(null));
a.l=b;a.l&&(x5("CP","Setting cast session: "+a.l.sessionId),a.l.addUpdateListener(a.L),a.l.addMediaListener(a.I),a.l.media.length&&a.ju(a.l.media[0]))},jLa=function(a){var b=a.i.media,c=a.i.customData;
if(b&&c){var d=v6(a);b.contentId!=d.videoId&&x5("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;p6(d,a.i.getEstimatedTime());y6(a,d)}else x5("CP","No cast media video. Ignoring state update.")},B6=function(a,b,c){return(0,g.B)(function(d){this.oe("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.oe("Retrying "+b+" using MDx browser channel."),A6(this,b,c))},a)},C6=function(a,b,c){g.P.call(this);
this.C=NaN;this.ra=!1;this.L=this.J=this.X=this.Y=NaN;this.W=[];this.B=this.I=this.u=this.fc=this.i=null;this.Ca=a;this.W.push(g.bp(window,"beforeunload",(0,g.B)(this.mO,this)));this.l=[];this.fc=new m6;this.Aa=b.id;this.va=b.idType;this.i=kLa(this,c);this.i.subscribe("handlerOpened",this.aQ,this);this.i.subscribe("handlerClosed",this.XP,this);this.i.subscribe("handlerError",this.YP,this);this.i.subscribe("handlerMessage",this.ZP,this);this.i.Px(b.token);this.subscribe("remoteQueueChange",function(){var d=
this.fc.videoId;g.Ru()&&g.Ou("yt-remote-session-video-id",d)},this)},D6=function(a){x5("conn",a)},kLa=function(a,b){return new q5(u5(a.Ca,"/bc"),b,!1,function(){return a.FE()},"shortLived"==a.va)},E6=function(a,b){a.V("proxyStateChange",b)},lLa=function(a){a.C=g.Ao((0,g.B)(function(){D6("Connecting timeout");
this.Lq(1)},a),2E4)},F6=function(a){g.Co(a.C);
a.C=NaN},G6=function(a){g.Co(a.Y);
a.Y=NaN},mLa=function(a){H6(a);
a.X=g.Ao((0,g.B)(function(){I6(this,"getNowPlaying")},a),2E4)},H6=function(a){g.Co(a.X);
a.X=NaN},oLa=function(a,b){b&&(F6(a),G6(a));
var c=s5(a.i)&&isNaN(a.C);b==c?b&&(E6(a,1),I6(a,"getSubtitlesTrack")):b?(a.HG()&&a.fc.reset(),E6(a,1),I6(a,"getNowPlaying"),nLa(a)):a.Lq(1)},pLa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.fc.videoId&&(g.Qb(b.params)?a.fc.trackData=null:a.fc.trackData=b.params,a.V("remotePlayerChange"))},qLa=function(a,b){var c=b.params.videoId||b.params.video_id,d=parseInt(b.params.currentIndex,10);
a.fc.listId=b.params.listId||a.fc.listId;r6(a.fc,c,d);a.V("remoteQueueChange")},sLa=function(a,b){b.params=b.params||{};
qLa(a,b);rLa(a,b);a.V("autoplayDismissed")},rLa=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
p6(a.fc,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.fc.playerState&&(c=-1E3);a.fc.playerState=c;c=Number(b.params.loadedTime);a.fc.L=isNaN(c)?0:c;c=Number(b.params.duration);a.fc.C=isNaN(c)?0:c;c=a.fc;var d=Number(b.params.liveIngestionTime);c.u=d;c.l=isNaN(d)?!1:!0;c=a.fc;d=Number(b.params.seekableStartTime);b=Number(b.params.seekableEndTime);c.B=isNaN(d)?0:d;c.i=isNaN(b)?0:b;1==a.fc.playerState?mLa(a):H6(a);a.V("remotePlayerChange")},tLa=function(a,b){if(-1E3!=a.fc.playerState){var c=
1085;
switch(parseInt(b.params.adState,10)){case 1:c=1081;break;case 2:c=1084;break;case 0:c=1083}a.fc.playerState=c;b=parseInt(b.params.currentTime,10);p6(a.fc,isNaN(b)?0:b);a.V("remotePlayerChange")}},uLa=function(a,b){var c="true"==b.params.muted;
a.fc.volume=parseInt(b.params.volume,10);a.fc.muted=c;a.V("remotePlayerChange")},vLa=function(a,b){a.I=b.params.videoId;
a.V("nowAutoplaying",parseInt(b.params.timeout,10))},wLa=function(a,b){var c="true"==b.params.hasNext;
a.fc.Fk="true"==b.params.hasPrevious;a.fc.hasNext=c;a.V("previousNextChange")},nLa=function(a){g.Co(a.L);
a.L=g.Ao((0,g.B)(a.Lq,a,1),864E5)},I6=function(a,b,c){c?D6("Sending: action="+b+", params="+g.uj(c)):D6("Sending: action="+b);
a.i.sendMessage(b,c)},J6=function(a){B5.call(this,"ScreenServiceProxy");
this.yg=a;this.i=[];this.i.push(this.yg.$_s("screenChange",(0,g.B)(this.LM,this)));this.i.push(this.yg.$_s("onlineScreenChange",(0,g.B)(this.YQ,this)))},ALa=function(a,b){nJa();
if(!D4||!D4.get("yt-remote-disable-remote-module-for-dev")){b=g.M("MDX_CONFIG")||b;fJa();B4();K6||(K6=new t5(b?b.loungeApiHost:void 0),oJa()&&(K6.i="/api/loungedev"));L6||(L6=g.Ja("yt.mdx.remote.deferredProxies_")||[],g.Fa("yt.mdx.remote.deferredProxies_",L6,void 0));xLa();var c=M6();if(!c){var d=new L5(K6);g.Fa("yt.mdx.remote.screenService_",d,void 0);c=M6();var e={};b&&(e={appId:b.appId,disableDial:b.disableDial,theme:b.theme,loadCastApiSetupScript:b.loadCastApiSetupScript,disableCastApi:b.disableCastApi,
enableDialLoungeToken:b.enableDialLoungeToken,enableCastLoungeToken:b.enableCastLoungeToken});bLa(a,d,function(f){f?N6()&&l6(N6(),"YouTube TV"):d.subscribe("onlineScreenChange",function(){p4("yt-remote-receiver-availability-change")})},e)}b&&!g.Ja("yt.mdx.remote.initialized_")&&(g.Fa("yt.mdx.remote.initialized_",!0,void 0),O6("Initializing: "+g.uj(b)),P6.push(g.Ho("yt-remote-cast2-availability-change",function(){p4("yt-remote-receiver-availability-change")})),P6.push(g.Ho("yt-remote-cast2-receiver-selected",
function(){Q6(null);
p4("yt-remote-auto-connect","cast-selector-receiver")})),P6.push(g.Ho("yt-remote-cast2-receiver-resumed",function(){p4("yt-remote-receiver-resumed","cast-selector-receiver")})),P6.push(g.Ho("yt-remote-cast2-session-change",yLa)),P6.push(g.Ho("yt-remote-connection-change",function(f){f?l6(N6(),"YouTube TV"):R6()||(l6(null,null),eLa())})),a=S6(),b.isAuto&&(a.id+="#dial"),g.Qo("desktop_enable_autoplay")&&(a.capabilities=["atp"]),a.name=b.device,a.app=b.app,(b=b.theme)&&(a.theme=b),O6(" -- with channel params: "+
g.uj(a)),a?(g.Ou("yt-remote-session-app",a.app),g.Ou("yt-remote-session-name",a.name)):(g.Qu("yt-remote-session-app"),g.Qu("yt-remote-session-name")),g.Fa("yt.mdx.remote.channelParams_",a,void 0),c.start(),N6()||zLa())}},BLa=function(){var a=M6().yg.$_gos();
var b=T6();b&&U6()&&(w4(a,b)||a.push(b));return eJa(a)},V6=function(){var a=CLa();
!a&&i6()&&dLa()&&(a={key:"cast-selector-receiver",name:dLa()});return a},CLa=function(){var a=BLa(),b=T6();
b||(b=R6());return g.cb(a,function(c){return b&&s4(b,c.key)?!0:!1})},T6=function(){var a=N6();
if(!a)return null;var b=M6().Mh();return x4(b,a)},yLa=function(a){O6("remote.onCastSessionChange_: "+t4(a));
if(a){var b=T6();if(b&&b.id==a.id){if(l6(b.id,"YouTube TV"),"shortLived"==a.idType&&(a=a.token))W6&&(W6.token=a),(b=U6())&&b.Px(a)}else b&&X6(),Y6(a,1)}else U6()&&X6()},X6=function(){j6()?g6().stopSession():e6("stopSession called before API ready.");
var a=U6();a&&(a.disconnect(1),Z6(null))},$6=function(){var a=U6();
return!!a&&3!=a.getProxyState()},O6=function(a){x5("remote",a)},M6=function(){if(!a7){var a=g.Ja("yt.mdx.remote.screenService_");
a7=a?new J6(a):null}return a7},N6=function(){return g.Ja("yt.mdx.remote.currentScreenId_")},DLa=function(a){g.Fa("yt.mdx.remote.currentScreenId_",a,void 0)},ELa=function(){return g.Ja("yt.mdx.remote.connectData_")},Q6=function(a){g.Fa("yt.mdx.remote.connectData_",a,void 0)},U6=function(){return g.Ja("yt.mdx.remote.connection_")},Z6=function(a){var b=U6();
Q6(null);a||DLa("");g.Fa("yt.mdx.remote.connection_",a,void 0);L6&&(g.zb(L6,function(c){c(a)}),L6.length=0);
b&&!a?p4("yt-remote-connection-change",!1):!b&&a&&p4("yt-remote-connection-change",!0)},R6=function(){var a=g.Ru();
if(!a)return null;var b=M6();if(!b)return null;b=b.Mh();return x4(b,a)},Y6=function(a,b){N6();
T6()&&T6();b7?W6=a:(DLa(a.id),a=new C6(K6,a,S6()),a.connect(b,ELa()),a.subscribe("beforeDisconnect",function(c){p4("yt-remote-before-disconnect",c)}),a.subscribe("beforeDispose",function(){U6()&&(U6(),Z6(null))}),a.subscribe("browserChannelAuthError",function(){var c=T6();
c&&"shortLived"==c.idType&&(j6()?g6().handleBrowserChannelAuthError():e6("refreshLoungeToken called before API ready."))}),Z6(a))},zLa=function(){var a=R6();
a?(O6("Resume connection to: "+t4(a)),Y6(a,0)):(C4(),eLa(),O6("Skipping connecting because no session screen found."))},xLa=function(){var a=S6();
if(g.Qb(a)){a=A4();var b=g.Pu("yt-remote-session-name")||"",c=g.Pu("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.Fa("yt.mdx.remote.channelParams_",a,void 0)}},S6=function(){return g.Ja("yt.mdx.remote.channelParams_")||{}},c7=function(a,b,c){g.F.call(this);
var d=this;this.l=a;this.G=b;this.Nb=c;this.events=new g.TL(this);this.X=this.events.N(this.G,"onVolumeChange",function(e){FLa(d,e)});
this.C=!1;this.suggestion=null;this.I=new g.ZI(64);this.i=new g.J(this.TJ,500,this);this.u=new g.J(this.UJ,1E3,this);this.L=new I4(this.JT,0,this);this.B={};this.W=new g.J(this.uK,1E3,this);this.J=new J4(this.seekTo,1E3,this);this.Y=g.Ka;g.H(this,this.events);this.events.N(b,"onCaptionsTrackListChanged",this.HQ);this.events.N(b,"captionschanged",this.TP);this.events.N(b,"captionssettingschanged",this.ZJ);this.events.N(b,"videoplayerreset",this.wx);this.events.N(b,"mdxautoplaycancel",function(){d.Nb.dG()});
a=this.Nb;a.Ha();a.subscribe("proxyStateChange",this.OI,this);a.subscribe("remotePlayerChange",this.tu,this);a.subscribe("remoteQueueChange",this.wx,this);a.subscribe("previousNextChange",this.LI,this);a.subscribe("nowAutoplaying",this.FI,this);a.subscribe("autoplayDismissed",this.cI,this);g.H(this,this.i);g.H(this,this.u);g.H(this,this.L);g.H(this,this.W);g.H(this,this.J);this.ZJ();this.wx();this.tu()},FLa=function(a,b){if(d7(a)){a.Nb.unsubscribe("remotePlayerChange",a.tu,a);
var c=Math.round(b.volume);b=!!b.muted;var d=v6(a.Nb);if(c!==d.volume||b!==d.muted)a.Nb.setVolume(c,b),a.W.start();a.Nb.subscribe("remotePlayerChange",a.tu,a)}},GLa=function(a){a.Rb(0);
a.i.stop();a.Jb(new g.ZI(64))},e7=function(a,b){if(d7(a)&&!a.C){var c=null;
b&&(c={style:a.G.getSubtitlesUserSettings()},g.Xb(c,b));a.Nb.EE(a.G.getVideoData(1).videoId,c);a.B=v6(a.Nb).trackData}},f7=function(a,b){var c=a.G.getPlaylist();
if(null===c||void 0===c?0:c.listId){var d=c.index;var e=c.listId.toString()}c=a.G.getVideoData(1);a.Nb.playVideo(c.videoId,b,d,e,c.playerParams,c.Aa,SIa(c));a.Jb(new g.ZI(1))},HLa=function(a,b){if(b){var c=a.G.getOption("captions","tracklist",{aH:1});
c&&c.length?(a.G.setOption("captions","track",b),a.C=!1):(a.G.loadModule("captions"),a.C=!0)}else a.G.setOption("captions","track",{})},d7=function(a){return v6(a.Nb).videoId===a.G.getVideoData(1).videoId},g7=function(){g.W.call(this,{D:"div",
K:"ytp-mdx-manual-pairing-popup-dialog",U:{role:"dialog"},S:[{D:"div",K:"ytp-mdx-manual-pairing-popup-dialog-inner-content",S:[{D:"div",K:"ytp-mdx-manual-pairing-popup-title",ma:"Connecting to your TV on web using a code will be going away soon"},{D:"div",K:"ytp-mdx-manual-pairing-popup-buttons",S:[{D:"button",Ba:["ytp-button","ytp-mdx-manual-pairing-popup-learn-more"],ma:"Learn more"},{D:"button",Ba:["ytp-button","ytp-mdx-manual-pairing-popup-ok"],ma:"OK"}]}]}]});this.i=new g.IK(this,250);this.learnMoreButton=
this.ya("ytp-mdx-manual-pairing-popup-learn-more");this.okButton=this.ya("ytp-mdx-manual-pairing-popup-ok");g.H(this,this.i);this.N(this.learnMoreButton,"click",this.l);this.N(this.okButton,"click",this.u)},h7=function(){g.W.call(this,{D:"div",
K:"ytp-mdx-popup-dialog",U:{role:"dialog"},S:[{D:"div",K:"ytp-mdx-popup-dialog-inner-content",S:[{D:"div",K:"ytp-mdx-popup-title",ma:"You're signed out"},{D:"div",K:"ytp-mdx-popup-description",ma:"Videos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer."},{D:"div",K:"ytp-mdx-privacy-popup-buttons",S:[{D:"button",Ba:["ytp-button","ytp-mdx-privacy-popup-cancel"],ma:"Cancel"},{D:"button",Ba:["ytp-button",
"ytp-mdx-privacy-popup-confirm"],ma:"Confirm"}]}]}]});this.i=new g.IK(this,250);this.cancelButton=this.ya("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.ya("ytp-mdx-privacy-popup-confirm");g.H(this,this.i);this.N(this.cancelButton,"click",this.l);this.N(this.confirmButton,"click",this.u)},i7=function(a){g.W.call(this,{D:"div",
K:"ytp-remote",S:[{D:"div",K:"ytp-remote-display-status",S:[{D:"div",K:"ytp-remote-display-status-icon",S:[g.Nla()]},{D:"div",K:"ytp-remote-display-status-text",ma:"{{statustext}}"}]}]});this.api=a;this.i=new g.IK(this,250);g.H(this,this.i);this.N(a,"presentingplayerstatechange",this.l);ILa(this,a.rb())},ILa=function(a,b){if(3===a.api.getPresentingPlayerType()){var c={RECEIVER_NAME:a.api.getOption("remote","currentReceiver").name};
b=g.V(b,128)?g.wI("Error on $RECEIVER_NAME",c):b.pc()||g.V(b,4)?g.wI("Playing on $RECEIVER_NAME",c):g.wI("Connected to $RECEIVER_NAME",c);a.Oa("statustext",b);a.i.show()}else a.i.hide()},j7=function(a,b){g.LO.call(this,"Play on",0,a,b);
this.G=a;this.Cn={};this.N(a,"onMdxReceiversChange",this.C);this.N(a,"presentingplayerstatechange",this.C);this.C()},k7=function(a){g.aM.call(this,a);
this.rj={key:v4(),name:"This computer"};this.gi=null;this.subscriptions=[];this.kC=this.Nb=null;this.Cn=[this.rj];this.Em=this.rj;this.od=new g.ZI(64);this.vH=0;this.zf=-1;this.xr=null;this.wu=this.Ww=!1;this.Cp=this.Hr=null;if(!g.JD(this.player.T())){a=this.player;var b=g.HL(a);b&&(b=b.Tm())&&(b=new j7(a,b),g.H(this,b));b=new i7(a);g.H(this,b);g.RL(a,b.element,4);this.Hr=new h7;g.H(this,this.Hr);g.RL(a,this.Hr.element,4);g.S(this.player.T().experiments,"pair_servlet_deprecation_warning_enabled")&&
!g.S(this.player.T().experiments,"deprecate_pair_servlet_enabled")&&(this.xr=new g7,g.H(this,this.xr),g.RL(a,this.xr.element,4));this.wu=!!R6();this.Ww=!!g.Pu("yt-remote-manual-pairing-warning-shown")}},l7=function(a){a.Cp&&(a.player.removeEventListener("presentingplayerstatechange",a.Cp),a.Cp=null)},JLa=function(a,b,c){a.od=c;
a.player.V("presentingplayerstatechange",new g.dI(c,b))},KLa=function(a,b,c){var d=!1;
1===b?d=!a.wu:2===b&&(d=!a.Ww);d&&g.fI(c,8)&&(a.player.pauseVideo(),l7(a))},m7=function(a,b){if(b.key!==a.Em.key)if(b.key===a.rj.key)X6();
else{if(a.xr&&!a.Ww&&b!==a.rj&&"cast-selector-receiver"!==b.key&&g.dE(a.player.T()))LLa(a);else{var c;(c=!g.S(a.player.T().experiments,"mdx_enable_privacy_disclosure_ui"))||(c=((c=g.M("PLAYER_CONFIG"))&&c.args&&void 0!==c.args.authuser?!0:!(!g.M("SESSION_INDEX")&&!g.M("LOGGED_IN")))||a.wu||!a.Hr);(c?0:g.dE(a.player.T())||g.hE(a.player.T()))&&MLa(a)}a.Em=b;var d=a.player.getPlaylistId();c=a.player.getVideoData(1);var e=c.videoId;if(!d&&!e||(2===a.player.getAppState()||1===a.player.getAppState())&&
g.S(a.player.T().experiments,"should_clear_video_data_on_player_cued_unstarted"))a=null;else{var f=a.player.getPlaylist();if(f){var h=[];for(var l=0;l<f.length;l++)h[l]=f.Za(l).videoId}else h=[e];f=a.player.getCurrentTime(1);a={videoIds:h,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.Aa,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0===f?void 0:f};(c=SIa(c))&&(a.locationInfo=c)}O6("Connecting to: "+g.uj(b));"cast-selector-receiver"==b.key?(Q6(a||null),b=a||null,
j6()?g6().setLaunchParams(b):e6("setLaunchParams called before ready.")):!a&&$6()&&N6()==b.key?p4("yt-remote-connection-change",!0):(X6(),Q6(a||null),a=M6().Mh(),(b=x4(a,b.key))&&Y6(b,1))}},MLa=function(a){a.player.rb().pc()?a.player.pauseVideo():(a.Cp=function(b){KLa(a,1,b)},a.player.addEventListener("presentingplayerstatechange",a.Cp));
a.Hr&&a.Hr.Zc();U6()||(b7=!0)},LLa=function(a){a.player.rb().pc()?a.player.pauseVideo():(a.Cp=function(b){KLa(a,2,b)},a.player.addEventListener("presentingplayerstatechange",a.Cp));
a.xr&&a.xr.Zc();U6()||(b7=!0)},HJa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},Y4={"'":"\\'"},NLa={},aJa={IU:"atp",h4:"ska",d3:"que",n1:"mus",g4:"sus",AY:"dsp",w3:"seq",O0:"mic",AX:"dpa",UU:"cds"},D4,z4="",uJa=pJa("loadCastFramework")||pJa("loadCastApplicationFramework"),wJa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
g.Ua(I4,g.F);g.k=I4.prototype;g.k.gh=function(a){this.B=arguments;this.i=!1;this.Cb?this.u=g.Ta()+this.zg:this.Cb=g.Dm(this.C,this.zg)};
g.k.stop=function(){this.Cb&&(g.A.clearTimeout(this.Cb),this.Cb=null);this.u=null;this.i=!1;this.B=[]};
g.k.pause=function(){++this.l};
g.k.resume=function(){this.l&&(--this.l,!this.l&&this.i&&(this.i=!1,this.I.apply(null,this.B)))};
g.k.oa=function(){this.stop();I4.me.oa.call(this)};
g.k.BM=function(){this.u?(this.Cb=g.Dm(this.C,this.u-g.Ta()),this.u=null):(this.Cb=null,this.l?this.i=!0:(this.i=!1,this.I.apply(null,this.B)))};g.v(J4,g.F);g.k=J4.prototype;g.k.gh=function(a){this.u=arguments;this.Cb||this.l?this.i=!0:K4(this)};
g.k.stop=function(){this.Cb&&(g.A.clearTimeout(this.Cb),this.Cb=null,this.i=!1,this.u=null)};
g.k.pause=function(){this.l++};
g.k.resume=function(){this.l--;this.l||!this.i||this.Cb||(this.i=!1,K4(this))};
g.k.oa=function(){g.F.prototype.oa.call(this);this.stop()};M4.prototype.stringify=function(a){return g.A.JSON.stringify(a,void 0)};
M4.prototype.parse=function(a){return g.A.JSON.parse(a,void 0)};var O4=new g.Tl;g.v(yJa,g.zl);Q4.prototype.i=null;Q4.prototype.getOptions=function(){var a;(a=this.i)||(a={},AJa(this)&&(a[0]=!0,a[1]=!0),a=this.i=a);return a};var n7;g.Ua(zJa,Q4);n7=new zJa;g.k=R4.prototype;g.k.Un=null;g.k.Ij=!1;g.k.Wr=null;g.k.yD=null;g.k.Ir=null;g.k.Rr=null;g.k.ym=null;g.k.Fn=null;g.k.Ep=null;g.k.rf=null;g.k.ov=0;g.k.Lj=null;g.k.wy=null;g.k.nm=null;g.k.Bs=-1;g.k.LJ=!0;g.k.Fo=!1;g.k.pz=0;g.k.Cx=null;var FJa={},U4={};g.k=R4.prototype;g.k.setTimeout=function(a){this.C=a};
g.k.PS=function(a){a=a.target;var b=this.Cx;b&&3==c5(a)?b.gh():this.CK(a)};
g.k.CK=function(a){try{if(a==this.rf)a:{var b=c5(this.rf),c=this.rf.I,d=this.rf.getStatus();if(g.we&&!g.Yd(10)||g.ye&&!g.Xd("420+")){if(4>b)break a}else if(3>b||3==b&&!g.gg&&!e5(this.rf))break a;this.Fo||4!=b||7==c||(8==c||0>=d?this.i.uj(3):this.i.uj(2));Z4(this);var e=this.rf.getStatus();this.Bs=e;var f=e5(this.rf);(this.Ij=200==e)?(4==b&&W4(this),this.I?(GJa(this,b,f),g.gg&&this.Ij&&3==b&&(this.B.Na(this.u,"tick",this.KS),this.u.start())):V4(this,f),this.Ij&&!this.Fo&&(4==b?this.i.Fv(this):(this.Ij=
!1,T4(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.nm=3,P4(13)):(this.nm=0,P4(14)),W4(this),X4(this))}}catch(h){this.rf&&e5(this.rf)}finally{}};
g.k.KS=function(){var a=c5(this.rf),b=e5(this.rf);this.ov<b.length&&(Z4(this),GJa(this,a,b),this.Ij&&4!=a&&T4(this))};
g.k.mS=function(a){N4((0,g.B)(this.lS,this,a),0)};
g.k.lS=function(a){this.Fo||(Z4(this),V4(this,a),T4(this))};
g.k.YI=function(a){N4((0,g.B)(this.kS,this,a),0)};
g.k.kS=function(a){this.Fo||(W4(this),this.Ij=a,this.i.Fv(this),this.i.uj(4))};
g.k.cancel=function(){this.Fo=!0;W4(this)};
g.k.uS=function(){this.Wr=null;var a=Date.now();0<=a-this.yD?(2!=this.Rr&&this.i.uj(3),W4(this),this.nm=2,P4(18),X4(this)):JJa(this,this.yD-a)};
g.k.getLastError=function(){return this.nm};g.Ua(a5,g.Tl);var QJa=/^https?$/i,OLa=["POST","PUT"];g.k=a5.prototype;
g.k.send=function(a,b,c,d){if(this.i)throw Error("[goog.net.XhrIo] Object is active with another request="+this.W+"; newUri="+a);b=b?b.toUpperCase():"GET";this.W=a;this.u="";this.I=0;this.Ma=b;this.Ca=!1;this.B=!0;this.i=this.va?BJa(this.va):BJa(n7);this.ra=this.va?this.va.getOptions():n7.getOptions();this.i.onreadystatechange=(0,g.B)(this.MI,this);try{o4(d5(this,"Opening Xhr")),this.Aa=!0,this.i.open(b,String(a),!0),this.Aa=!1}catch(f){o4(d5(this,"Error opening Xhr: "+f.message));PJa(this,f);return}a=
c||"";var e=this.headers.clone();d&&XIa(d,function(f,h){e.set(h,f)});
d=g.cb(e.xi(),NJa);c=g.A.FormData&&a instanceof g.A.FormData;!g.fb(OLa,b)||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(f,h){this.i.setRequestHeader(h,f)},this);
this.Ra&&(this.i.responseType=this.Ra);"withCredentials"in this.i&&this.i.withCredentials!==this.Ga&&(this.i.withCredentials=this.Ga);try{SJa(this),0<this.J&&(this.Y=MJa(this.i),o4(d5(this,"Will abort after "+this.J+"ms if incomplete, xhr2 "+this.Y)),this.Y?(this.i.timeout=this.J,this.i.ontimeout=(0,g.B)(this.yE,this)):this.X=g.Dm(this.yE,this.J,this)),o4(d5(this,"Sending request")),this.L=!0,this.i.send(a),this.L=!1}catch(f){o4(d5(this,"Send error: "+f.message)),PJa(this,f)}};
g.k.yE=function(){"undefined"!=typeof g.C_&&this.i&&(this.u="Timed out after "+this.J+"ms, aborting",this.I=8,d5(this,this.u),this.dispatchEvent("timeout"),this.abort(8))};
g.k.abort=function(a){this.i&&this.B&&(d5(this,"Aborting"),this.B=!1,this.C=!0,this.i.abort(),this.C=!1,this.I=a||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),b5(this))};
g.k.oa=function(){this.i&&(this.B&&(this.B=!1,this.C=!0,this.i.abort(),this.C=!1),b5(this,!0));a5.me.oa.call(this)};
g.k.MI=function(){this.Ha()||(this.Aa||this.L||this.C?RJa(this):this.tR())};
g.k.tR=function(){RJa(this)};
g.k.isActive=function(){return!!this.i};
g.k.isComplete=function(){return 4==c5(this)};
g.k.getStatus=function(){try{return 2<c5(this)?this.i.status:-1}catch(a){return-1}};
g.k.getResponseHeader=function(a){if(this.i&&this.isComplete())return a=this.i.getResponseHeader(a),null===a?void 0:a};
g.k.getLastError=function(){return"string"===typeof this.u?this.u:String(this.u)};g.k=TJa.prototype;g.k.qz=null;g.k.Ch=null;g.k.Dx=!1;g.k.VJ=null;g.k.bw=null;g.k.yB=null;g.k.rz=null;g.k.bb=null;g.k.dl=-1;g.k.Cs=null;g.k.Ms=null;g.k.connect=function(a){this.rz=a;a=f5(this.i,null,this.rz);P4(3);this.VJ=Date.now();var b=this.i.J;null!=b?(this.Cs=b[0],(this.Ms=b[1])?(this.bb=1,UJa(this)):(this.bb=2,h5(this))):(m4(a,"MODE","init"),this.Ch=new R4(this,void 0,void 0,void 0),this.Ch.Un=this.qz,S4(this.Ch,a,!1,null,!0),this.bb=0)};
g.k.yN=function(a){if(a)this.bb=2,h5(this);else{P4(4);var b=this.i;b.gk=b.Cm.dl;o5(b,9)}a&&this.uj(2)};
g.k.jA=function(a){return this.i.jA(a)};
g.k.abort=function(){this.Ch&&(this.Ch.cancel(),this.Ch=null);this.dl=-1};
g.k.zE=function(){return!1};
g.k.QI=function(a,b){this.dl=a.Bs;if(0==this.bb)if(b){try{var c=this.l.parse(b)}catch(d){a=this.i;a.gk=this.dl;o5(a,2);return}this.Cs=c[0];this.Ms=c[1]}else a=this.i,a.gk=this.dl,o5(a,2);else if(2==this.bb)if(this.Dx)P4(7),this.yB=Date.now();else if("11111"==b){if(P4(6),this.Dx=!0,this.bw=Date.now(),a=this.bw-this.VJ,!g.we||g.Yd(10)||500>a)this.dl=200,this.Ch.cancel(),P4(12),g5(this.i,this,!0)}else P4(8),this.bw=this.yB=Date.now(),this.Dx=!1};
g.k.Fv=function(){this.dl=this.Ch.Bs;if(this.Ch.Ij)0==this.bb?this.Ms?(this.bb=1,UJa(this)):(this.bb=2,h5(this)):2==this.bb&&((!g.we||g.Yd(10)?!this.Dx:200>this.yB-this.bw)?(P4(11),g5(this.i,this,!1)):(P4(12),g5(this.i,this,!0)));else{0==this.bb?P4(9):2==this.bb&&P4(10);var a=this.i;this.Ch.getLastError();a.gk=this.dl;o5(a,2)}};
g.k.Nu=function(){return this.i.Nu()};
g.k.isActive=function(){return this.i.isActive()};
g.k.uj=function(a){this.i.uj(a)};g.k=i5.prototype;g.k.fk=null;g.k.gt=null;g.k.hh=null;g.k.Ie=null;g.k.sz=null;g.k.cw=null;g.k.zF=null;g.k.Gv=null;g.k.au=0;g.k.mP=0;g.k.qg=null;g.k.Lm=null;g.k.wl=null;g.k.Oo=null;g.k.Cm=null;g.k.uy=null;g.k.qr=-1;g.k.uH=-1;g.k.gk=-1;g.k.Pq=0;g.k.Cq=0;g.k.Go=8;g.Ua(WJa,g.zl);g.Ua(XJa,g.zl);g.k=i5.prototype;g.k.connect=function(a,b,c,d,e){P4(0);this.sz=b;this.gt=c||{};d&&void 0!==e&&(this.gt.OSID=d,this.gt.OAID=e);this.C?(N4((0,g.B)(this.QF,this,a),100),aKa(this)):this.QF(a)};
g.k.QF=function(a){this.Cm=new TJa(this);this.Cm.qz=this.fk;this.Cm.l=this.B;this.Cm.connect(a)};
g.k.zE=function(){return 0==this.bb};
g.k.getState=function(){return this.bb};
g.k.WI=function(a){this.Lm=null;eKa(this,a)};
g.k.VI=function(){this.wl=null;this.Ie=new R4(this,this.l,"rpc",this.I);this.Ie.Un=this.fk;this.Ie.pz=0;var a=this.zF.clone();k4(a,"RID","rpc");k4(a,"SID",this.l);k4(a,"CI",this.uy?"0":"1");k4(a,"AID",this.qr);j5(this,a);if(!g.we||g.Yd(10))k4(a,"TYPE","xmlhttp"),S4(this.Ie,a,!0,this.Gv,!1);else{k4(a,"TYPE","html");var b=this.Ie,c=!!this.Gv;b.Rr=3;b.ym=l4(a.clone());IJa(b,c)}};
g.k.QI=function(a,b){if(0!=this.bb&&(this.Ie==a||this.hh==a))if(this.gk=a.Bs,this.hh==a&&3==this.bb)if(7<this.Go){try{var c=this.B.parse(b)}catch(d){c=null}if(Array.isArray(c)&&3==c.length)if(a=c,0==a[0])a:{if(!this.wl){if(this.Ie)if(this.Ie.Ir+3E3<this.hh.Ir)l5(this),this.Ie.cancel(),this.Ie=null;else break a;n5(this);P4(19)}}else this.uH=a[1],0<this.uH-this.qr&&37500>a[2]&&this.uy&&0==this.Cq&&!this.Oo&&(this.Oo=N4((0,g.B)(this.PP,this),6E3));else o5(this,11)}else b!=NLa.oX.i&&o5(this,11);else if(this.Ie==
a&&l5(this),!g.pc(b))for(a=this.B.parse(b),b=0;b<a.length;b++)c=a[b],this.qr=c[0],c=c[1],2==this.bb?"c"==c[0]?(this.l=c[1],this.Gv=c[2],c=c[3],null!=c?this.Go=c:this.Go=6,this.bb=3,this.qg&&this.qg.MF(),this.zF=f5(this,this.Nu()?this.Gv:null,this.sz),fKa(this)):"stop"==c[0]&&o5(this,7):3==this.bb&&("stop"==c[0]?o5(this,7):"noop"!=c[0]&&this.qg&&this.qg.LF(c),this.Cq=0)};
g.k.PP=function(){null!=this.Oo&&(this.Oo=null,this.Ie.cancel(),this.Ie=null,n5(this),P4(20))};
g.k.Fv=function(a){if(this.Ie==a){l5(this);this.Ie=null;var b=2}else if(this.hh==a)this.hh=null,b=1;else return;this.gk=a.Bs;if(0!=this.bb)if(a.Ij)1==b?(b=O4,b.dispatchEvent(new WJa(b,a.Ep?a.Ep.length:0,Date.now()-a.Ir,this.Pq)),k5(this),this.u.length=0):fKa(this);else{var c=a.getLastError(),d;if(!(d=3==c||7==c||0==c&&0<this.gk)){if(d=1==b)this.hh||this.Lm||1==this.bb||2<=this.Pq?d=!1:(this.Lm=N4((0,g.B)(this.WI,this,a),gKa(this,this.Pq)),this.Pq++,d=!0);d=!(d||2==b&&n5(this))}if(d)switch(c){case 1:o5(this,
5);break;case 4:o5(this,10);break;case 3:o5(this,6);break;case 7:o5(this,12);break;default:o5(this,2)}}};
g.k.TN=function(a){if(!g.fb(arguments,this.bb))throw Error("Unexpected channel state: "+this.bb);};
g.k.tT=function(a){a?P4(2):(P4(1),hKa(this,8))};
g.k.jA=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new a5;a.Ga=!1;return a};
g.k.isActive=function(){return!!this.qg&&this.qg.isActive(this)};
g.k.uj=function(a){var b=O4;b.dispatchEvent(new XJa(b,a))};
g.k.Nu=function(){return!(!g.we||g.Yd(10))};
g.k=iKa.prototype;g.k.MF=function(){};
g.k.LF=function(){};
g.k.KF=function(){};
g.k.Uz=function(){};
g.k.tG=function(){return{}};
g.k.isActive=function(){return!0};g.k=jKa.prototype;g.k.isEmpty=function(){return g.gb(this.i)&&g.gb(this.l)};
g.k.clear=function(){this.i=[];this.l=[]};
g.k.contains=function(a){return g.fb(this.i,a)||g.fb(this.l,a)};
g.k.remove=function(a){var b=this.i;var c=(0,g.GDa)(b,a);0<=c?(g.jb(b,c),b=!0):b=!1;return b||g.kb(this.l,a)};
g.k.kh=function(){for(var a=[],b=this.i.length-1;0<=b;--b)a.push(this.i[b]);var c=this.l.length;for(b=0;b<c;++b)a.push(this.l[b]);return a};g.Ua(p5,g.F);g.k=p5.prototype;g.k.eS=function(){this.zg=Math.min(3E5,2*this.zg);this.u();this.l&&this.start()};
g.k.start=function(){var a=this.zg+15E3*Math.random();g.cn(this.i,a);this.l=g.Ta()+a};
g.k.stop=function(){this.i.stop();this.l=0};
g.k.isActive=function(){return this.i.isActive()};
g.k.reset=function(){this.i.stop();this.zg=5E3};g.Ua(q5,iKa);g.k=q5.prototype;g.k.subscribe=function(a,b,c){return this.u.subscribe(a,b,c)};
g.k.unsubscribe=function(a,b,c){return this.u.unsubscribe(a,b,c)};
g.k.Hg=function(a){return this.u.Hg(a)};
g.k.V=function(a,b){return this.u.V.apply(this.u,arguments)};
g.k.dispose=function(){this.X||(this.X=!0,g.ui(this.u),mKa(this),g.ui(this.l),this.l=null,this.Y=function(){return""})};
g.k.Ha=function(){return this.X};
g.k.connect=function(a,b,c){if(!this.i||2!=this.i.getState()){this.W="";this.l.stop();this.C=a||null;this.B=b||0;a=this.ra+"/test";b=this.ra+"/bind";var d=new i5(c?c.firstTestResults:null,c?c.secondTestResults:null,this.va),e=this.i;e&&(e.qg=null);d.qg=this;this.i=d;r5(this);if(this.i){d=g.M("ID_TOKEN");var f=this.i.fk||{};d?f["x-youtube-identity-token"]=d:delete f["x-youtube-identity-token"];this.i.fk=f}e?(3!=e.getState()&&0==cKa(e)||e.getState(),this.i.connect(a,b,this.I,e.l,e.qr)):c?this.i.connect(a,
b,this.I,c.sessionId,c.arrayId):this.i.connect(a,b,this.I)}};
g.k.sendMessage=function(a,b){a={_sc:a};b&&g.Xb(a,b);this.l.isActive()||2==(this.i?this.i.getState():0)?this.J.push(a):s5(this)&&(r5(this),bKa(this.i,a))};
g.k.MF=function(){this.l.reset();this.C=null;this.B=0;if(this.J.length){var a=this.J;this.J=[];for(var b=0,c=a.length;b<c;++b)bKa(this.i,a[b])}this.V("handlerOpened")};
g.k.KF=function(a){var b=2==a&&401==this.i.gk;4==a||b||this.l.start();this.V("handlerError",a,b)};
g.k.Uz=function(a){if(!this.l.isActive())this.V("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.J.push(d)}};
g.k.tG=function(){var a={v:2};this.W&&(a.gsessionid=this.W);0!=this.B&&(a.ui=""+this.B);0!=this.L&&(a.ui=""+this.L);this.C&&g.Xb(a,this.C);return a};
g.k.LF=function(a){"S"==a[0]?this.W=a[1]:"gracefulReconnect"==a[0]?(this.l.start(),$Ja(this.i)):this.V("handlerMessage",new kKa(a[0],a[1]))};
g.k.Px=function(a){(this.I.loungeIdToken=a)||this.l.stop();if(this.Ca&&this.i){var b=this.i.fk||{};a?b["X-YouTube-LoungeId-Token"]=a:delete b["X-YouTube-LoungeId-Token"];this.i.fk=b}};
g.k.aT=function(){this.l.isActive();0==cKa(this.i)&&this.connect(this.C,this.B)};t5.prototype.B=function(a,b,c,d){b?a(d):a({text:c.responseText})};
t5.prototype.u=function(a,b){a(Error("Request error: "+b.status))};
t5.prototype.C=function(a){a(Error("request timed out"))};var tKa=Date.now(),w5=null,z5=Array(50),y5=-1,A5=!1;g.Ua(B5,g.P);B5.prototype.Mh=function(){return this.screens};
B5.prototype.contains=function(a){return!!w4(this.screens,a)};
B5.prototype.get=function(a){return a?x4(this.screens,a):null};
B5.prototype.info=function(a){x5(this.I,a)};g.v(C5,g.P);g.k=C5.prototype;g.k.start=function(){!this.i&&isNaN(this.Cb)&&this.hJ()};
g.k.stop=function(){this.i&&(this.i.abort(),this.i=null);isNaN(this.Cb)||(g.Co(this.Cb),this.Cb=NaN)};
g.k.oa=function(){this.stop();g.P.prototype.oa.call(this)};
g.k.hJ=function(){this.Cb=NaN;this.i=g.Yp(u5(this.u,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.J},timeout:5E3,onSuccess:(0,g.B)(this.DM,this),onError:(0,g.B)(this.CM,this),onTimeout:(0,g.B)(this.EM,this)})};
g.k.DM=function(a,b){this.i=null;a=b.screen||{};a.dialId=this.B;a.name=this.I;b=-1;this.C&&a.shortLivedLoungeToken&&a.shortLivedLoungeToken.value&&a.shortLivedLoungeToken.refreshIntervalMs&&(a.screenIdType="shortLived",a.loungeToken=a.shortLivedLoungeToken.value,b=a.shortLivedLoungeToken.refreshIntervalMs);this.V("pairingComplete",new r4(a),b)};
g.k.CM=function(a){this.i=null;a.status&&404==a.status?this.l>=PLa.length?this.V("pairingFailed",Error("DIAL polling timed out")):(a=PLa[this.l],this.Cb=g.Ao((0,g.B)(this.hJ,this),a),this.l++):this.V("pairingFailed",Error("Server error "+a.status))};
g.k.EM=function(){this.i=null;this.V("pairingFailed",Error("Server not responding"))};
var PLa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.Ua(E5,B5);g.k=E5.prototype;g.k.start=function(){D5(this)&&this.V("screenChange");!g.Pu("yt-remote-lounge-token-expiration")&&xKa(this);g.Co(this.i);this.i=g.Ao((0,g.B)(this.start,this),1E4)};
g.k.add=function(a,b){D5(this);uKa(this,a);F5(this,!1);this.V("screenChange");b(a);a.token||xKa(this)};
g.k.remove=function(a,b){var c=D5(this);wKa(this,a)&&(F5(this,!1),c=!0);b(a);c&&this.V("screenChange")};
g.k.qy=function(a,b,c,d){var e=D5(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,F5(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.V("screenChange")};
g.k.oa=function(){g.Co(this.i);E5.me.oa.call(this)};
g.k.qO=function(a){D5(this);var b=this.screens.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)}F5(this,!b);b&&x5(this.I,"Missed "+b+" lounge tokens.")};
g.k.pO=function(a){x5(this.I,"Requesting lounge tokens failed: "+a)};g.v(H5,g.P);g.k=H5.prototype;g.k.start=function(){var a=parseInt(g.Pu("yt-remote-fast-check-period")||"0",10);(this.B=g.Ta()-144E5<a?0:a)?K5(this):(this.B=g.Ta()+3E5,g.Ou("yt-remote-fast-check-period",this.B),this.wC())};
g.k.isEmpty=function(){return g.Qb(this.i)};
g.k.update=function(){G5("Updating availability on schedule.");var a=this.I(),b=g.Db(this.i,function(c,d){return c&&!!x4(a,d)},this);
J5(this,b)};
g.k.oa=function(){g.Co(this.u);this.u=NaN;this.l&&(this.l.abort(),this.l=null);g.P.prototype.oa.call(this)};
g.k.wC=function(){g.Co(this.u);this.u=NaN;this.l&&this.l.abort();var a=zKa(this);if(n4(a)){var b=u5(this.C,"/pairing/get_screen_availability");this.l=v5(this.C,b,{lounge_token:g.Lb(a).join(",")},(0,g.B)(this.NR,this,a),(0,g.B)(this.MR,this))}else J5(this,{}),K5(this)};
g.k.NR=function(a,b){this.l=null;var c=g.Lb(zKa(this));if(g.xb(c,g.Lb(a))){b=b.screens||[];c={};for(var d=0,e=b.length;d<e;++d)c[a[b[d].loungeToken]]="online"==b[d].status;J5(this,c);K5(this)}else this.oe("Changing Screen set during request."),this.wC()};
g.k.MR=function(a){this.oe("Screen availability failed: "+a);this.l=null;K5(this)};
g.k.oe=function(a){x5("OnlineScreenService",a)};g.Ua(L5,B5);g.k=L5.prototype;g.k.start=function(){this.l.start();this.i.start();this.screens.length&&(this.V("screenChange"),this.i.isEmpty()||this.V("onlineScreenChange"))};
g.k.add=function(a,b,c){this.l.add(a,b,c)};
g.k.remove=function(a,b,c){this.l.remove(a,b,c);this.i.update()};
g.k.qy=function(a,b,c,d){this.l.contains(a)?this.l.qy(a,b,c,d):(a="Updating name of unknown screen: "+a.name,x5(this.I,a),d(Error(a)))};
g.k.Mh=function(a){return a?this.screens:g.nb(this.screens,g.Ie(this.u,function(b){return!this.contains(b)},this))};
g.k.AE=function(){return g.Ie(this.Mh(!0),function(a){return!!this.i.i[a.id]},this)};
g.k.BE=function(a,b,c,d,e,f){var h=this;this.info("getDialScreenByPairingCode "+a+" / "+b);var l=new C5(this.B,a,b,c,d);l.subscribe("pairingComplete",function(m,n){g.ui(l);e(M5(h,m),n)});
l.subscribe("pairingFailed",function(m){g.ui(l);f(m)});
l.start();return(0,g.B)(l.stop,l)};
g.k.FM=function(a,b,c,d){g.Yp(u5(this.B,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:a},timeout:5E3,onSuccess:(0,g.B)(function(e,f){e=new r4(f.screen||{});if(!e.name||DKa(this,e.name)){a:{f=e.name;for(var h=2,l=b(f,h);DKa(this,l);){h++;if(20<h)break a;l=b(f,h)}f=l}e.name=f}c(M5(this,e))},this),
onError:(0,g.B)(function(e){d(Error("pairing request failed: "+e.status))},this),
onTimeout:(0,g.B)(function(){d(Error("pairing request timed out."))},this)})};
g.k.oa=function(){g.ui(this.l);g.ui(this.i);L5.me.oa.call(this)};
g.k.wO=function(){FKa(this);this.V("screenChange");this.i.update()};
L5.prototype.dispose=L5.prototype.dispose;g.Ua(O5,g.P);g.k=O5.prototype;g.k.getScreen=function(){return this.B};
g.k.Tg=function(a){this.Ha()||(a&&Q5(this,""+a),this.B=null,this.V("sessionScreen",null))};
g.k.info=function(a){x5(this.Ca,a)};
g.k.CE=function(){return null};
g.k.GC=function(a){var b=this.i;a?(b.displayStatus=new chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;chrome.cast.setReceiverDisplayStatus(b,(0,g.B)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.B)(function(){Q5(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.k.oa=function(){this.GC("");O5.me.oa.call(this)};g.v(R5,O5);g.k=R5.prototype;g.k.FC=function(a){if(this.l){if(this.l==a)return;Q5(this,"Overriding cast session with new session object");OKa(this);this.ra=!1;this.W="unknown";this.l.removeUpdateListener(this.Y);this.l.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.va)}this.l=a;this.l.addUpdateListener(this.Y);this.l.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.va);KKa(this,"getMdxSessionStatus")};
g.k.rr=function(a){this.info("launchWithParams no-op for Cast: "+g.uj(a))};
g.k.stop=function(){this.l?this.l.stop((0,g.B)(function(){this.Tg()},this),(0,g.B)(function(){this.Tg(Error("Failed to stop receiver app."))},this)):this.Tg(Error("Stopping cast device without session."))};
g.k.GC=function(){};
g.k.oa=function(){this.info("disposeInternal");OKa(this);this.l&&(this.l.removeUpdateListener(this.Y),this.l.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.va));this.l=null;O5.prototype.oa.call(this)};
g.k.yS=function(a,b){if(!this.Ha())if(b)if(b=L4(b),g.Oa(b))switch(a=""+b.type,b=b.data||{},this.info("onYoutubeMessage_: "+a+" "+g.uj(b)),a){case "mdxSessionStatus":IKa(this,b);break;case "loungeToken":LKa(this,b);break;default:Q5(this,"Unknown youtube message: "+a)}else Q5(this,"Unable to parse message.");else Q5(this,"No data in message.")};
g.k.IG=function(a,b,c,d){g.Co(this.L);this.L=0;CKa(this.u,this.i.label,a,this.i.friendlyName,(0,g.B)(function(e){e?b(e):0<=d?(Q5(this,"Screen "+a+" appears to be offline. "+d+" retries left."),this.L=g.Ao((0,g.B)(this.IG,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.k.CE=function(){return this.l};
g.k.GM=function(a){this.Ha()||a||(Q5(this,"Cast session died."),this.Tg())};g.v(U5,O5);g.k=U5.prototype;g.k.FC=function(a){this.l=a;this.l.addUpdateListener(this.Aa)};
g.k.rr=function(a){this.Da=a;this.X()};
g.k.stop=function(){VKa(this);this.l?this.l.stop((0,g.B)(this.Tg,this,null),(0,g.B)(this.Tg,this,"Failed to stop DIAL device.")):this.Tg()};
g.k.oa=function(){VKa(this);this.l&&this.l.removeUpdateListener(this.Aa);this.l=null;O5.prototype.oa.call(this)};
g.k.HM=function(a){this.Ha()||a||(Q5(this,"DIAL session died."),this.C(),this.C=g.Ka,this.Tg())};g.v(Y5,O5);Y5.prototype.stop=function(){this.Tg()};
Y5.prototype.FC=function(){};
Y5.prototype.rr=function(){g.Co(this.l);this.l=NaN;var a=x4(this.u.Mh(),this.i.label);a?P5(this,a):this.Tg(Error("No such screen"))};
Y5.prototype.oa=function(){g.Co(this.l);this.l=NaN;O5.prototype.oa.call(this)};g.v(Z5,g.P);g.k=Z5.prototype;
g.k.init=function(a,b){chrome.cast.timeout.requestSession=3E4;var c=new chrome.cast.SessionRequest(this.L);this.W||(c.dialRequest=new chrome.cast.DialRequest("YouTube"));var d=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;a=a?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var e=(0,g.B)(this.xR,this);c=new chrome.cast.ApiConfig(c,(0,g.B)(this.RI,this),e,d,a);c.customDialLaunchCallback=(0,g.B)(this.kQ,this);chrome.cast.initialize(c,(0,g.B)(function(){this.Ha()||
(chrome.cast.addReceiverActionListener(this.I),qKa(),this.l.subscribe("onlineScreenChange",(0,g.B)(this.DE,this)),this.u=XKa(this),chrome.cast.setCustomReceivers(this.u,g.Ka,(0,g.B)(function(f){this.oe("Failed to set initial custom receivers: "+g.uj(f))},this)),this.V("yt-remote-cast2-availability-change",a6(this)),b(!0))},this),(0,g.B)(function(f){this.oe("Failed to initialize API: "+g.uj(f));
b(!1)},this))};
g.k.fT=function(a,b){$5("Setting connected screen ID: "+a+" -> "+b);if(this.i){var c=this.i.getScreen();if(!a||c&&c.id!=a)$5("Unsetting old screen status: "+this.i.i.friendlyName),b6(this,null)}if(a&&b){if(!this.i){c=x4(this.l.Mh(),a);if(!c){$5("setConnectedScreenStatus: Unknown screen.");return}if("shortLived"==c.idType){$5("setConnectedScreenStatus: Screen with id type to be short lived.");return}a=WKa(this,c);a||($5("setConnectedScreenStatus: Connected receiver not custom..."),a=new chrome.cast.Receiver(c.uuid?
c.uuid:c.id,c.name),a.receiverType=chrome.cast.ReceiverType.CUSTOM,this.u.push(a),chrome.cast.setCustomReceivers(this.u,g.Ka,(0,g.B)(function(d){this.oe("Failed to set initial custom receivers: "+g.uj(d))},this)));
$5("setConnectedScreenStatus: new active receiver: "+a.friendlyName);b6(this,new Y5(this.l,a),!0)}this.i.GC(b)}else $5("setConnectedScreenStatus: no screen.")};
g.k.gT=function(a){this.Ha()?this.oe("Setting connection data on disposed cast v2"):this.i?this.i.rr(a):this.oe("Setting connection data without a session")};
g.k.JM=function(){this.Ha()?this.oe("Stopping session on disposed cast v2"):this.i?(this.i.stop(),b6(this,null)):$5("Stopping non-existing session")};
g.k.requestSession=function(){chrome.cast.requestSession((0,g.B)(this.RI,this),(0,g.B)(this.QR,this))};
g.k.oa=function(){this.l.unsubscribe("onlineScreenChange",(0,g.B)(this.DE,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.I);var a=nKa,b=g.Ja("yt.mdx.remote.debug.handlers_");g.kb(b||[],a);g.ui(this.i);g.P.prototype.oa.call(this)};
g.k.oe=function(a){x5("Controller",a)};
g.k.TI=function(a,b){this.i==a&&(b||b6(this,null),this.V("yt-remote-cast2-session-change",b))};
g.k.uR=function(a,b){if(!this.Ha())if(a)switch(a.friendlyName=chrome.cast.unescape(a.friendlyName),$5("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case chrome.cast.ReceiverAction.CAST:if(this.i)if(this.i.i.label!=a.label)$5("onReceiverAction_: Stopping active receiver: "+this.i.i.friendlyName),this.i.stop();else{$5("onReceiverAction_: Casting to active receiver.");this.i.getScreen()&&this.V("yt-remote-cast2-session-change",this.i.getScreen());break}switch(a.receiverType){case chrome.cast.ReceiverType.CUSTOM:b6(this,
new Y5(this.l,a));break;case chrome.cast.ReceiverType.DIAL:b6(this,new U5(this.l,a,this.C,this.B));break;case chrome.cast.ReceiverType.CAST:b6(this,new R5(this.l,a,this.B));break;default:this.oe("Unknown receiver type: "+a.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.i&&this.i.i.label==a.label?this.i.stop():this.oe("Stopping receiver w/o session: "+a.friendlyName)}else this.oe("onReceiverAction_ called without receiver.")};
g.k.kQ=function(a){if(this.Ha())return Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.oe("Not DIAL receiver: "+b.friendlyName),b.receiverType=chrome.cast.ReceiverType.DIAL);var c=this.i?this.i.i:null;if(!c||c.label!=b.label)return this.oe("Receiving DIAL launch request for non-clicked DIAL receiver: "+b.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(c&&c.label==b.label&&c.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.i.getScreen())return $5("Reselecting dial screen."),
this.V("yt-remote-cast2-session-change",this.i.getScreen()),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.oe('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);b6(this,new U5(this.l,b,this.C,this.B))}b=this.i;b.L=a;b.L.appState==chrome.cast.DialAppState.RUNNING?(a=b.L.extraData||{},c=a.screenId||null,V5(b)&&a.loungeToken?a.loungeTokenRefreshIntervalMs?a=SKa(b,{name:b.i.friendlyName,screenId:a.screenId,loungeToken:a.loungeToken,dialId:b.L.receiver.label,
screenIdType:"shortLived"},a.loungeTokenRefreshIntervalMs):(g.xo(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(a)+".")),a=TKa(b,c)):a=TKa(b,c)):a=X5(b);return a};
g.k.RI=function(a){if(!this.Ha()){$5("New cast session ID: "+a.sessionId);var b=a.receiver;if(b.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.i)if(b.receiverType==chrome.cast.ReceiverType.CAST)$5("Got resumed cast session before resumed mdx connection."),b.friendlyName=chrome.cast.unescape(b.friendlyName),b6(this,new R5(this.l,b,this.B),!0);else{this.oe("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.i.i,d=x4(this.l.Mh(),c.label);d&&s4(d,b.label)&&
c.receiverType!=chrome.cast.ReceiverType.CAST&&b.receiverType==chrome.cast.ReceiverType.CAST&&($5("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.ui(this.i),this.i=new R5(this.l,b,this.B),this.i.subscribe("sessionScreen",(0,g.B)(this.TI,this,this.i)),this.i.rr(null));this.i.FC(a)}}};
g.k.IM=function(){return this.i?this.i.CE():null};
g.k.QR=function(a){this.Ha()||(this.oe("Failed to estabilish a session: "+g.uj(a)),a.code!=chrome.cast.ErrorCode.CANCEL&&b6(this,null))};
g.k.xR=function(a){$5("Receiver availability updated: "+a);if(!this.Ha()){var b=a6(this);this.J=a==chrome.cast.ReceiverAvailability.AVAILABLE;a6(this)!=b&&this.V("yt-remote-cast2-availability-change",a6(this))}};
g.k.DE=function(){this.Ha()||(this.u=XKa(this),$5("Updating custom receivers: "+g.uj(this.u)),chrome.cast.setCustomReceivers(this.u,g.Ka,(0,g.B)(function(){this.oe("Failed to set custom receivers.")},this)),this.V("yt-remote-cast2-availability-change",a6(this)))};
Z5.prototype.setLaunchParams=Z5.prototype.gT;Z5.prototype.setConnectedScreenStatus=Z5.prototype.fT;Z5.prototype.stopSession=Z5.prototype.JM;Z5.prototype.getCastSession=Z5.prototype.IM;Z5.prototype.requestSession=Z5.prototype.requestSession;Z5.prototype.init=Z5.prototype.init;Z5.prototype.dispose=Z5.prototype.dispose;var h6=[];g.k=m6.prototype;
g.k.reset=function(a){this.listId="";this.index=-1;this.videoId="";n6(this);this.volume=-1;this.muted=!1;a&&(this.index=a.index,this.listId=a.listId,this.videoId=a.videoId,this.playerState=a.playerState,this.volume=a.volume,this.muted=a.muted,this.audioTrackId=a.audioTrackId,this.trackData=a.trackData,this.Fk=a.hasPrevious,this.hasNext=a.hasNext,this.J=a.playerTime,this.I=a.playerTimeAt,this.B=a.seekableStart,this.i=a.seekableEnd,this.C=a.duration,this.L=a.loadedTime,this.u=a.liveIngestionTime,this.l=
!isNaN(this.u))};
g.k.pc=function(){return 1==this.playerState};
g.k.isAdPlaying=function(){return 1081==this.playerState};
g.k.getDuration=function(){return this.l?this.C+o6(this):this.C};
g.k.clone=function(){return new m6(s6(this))};g.v(u6,g.P);g.k=u6.prototype;g.k.getState=function(){return this.bb};
g.k.play=function(){w6(this)?(this.i?this.i.play(null,g.Ka,B6(this,"play")):A6(this,"play"),z6(this,1,q6(v6(this))),this.V("remotePlayerChange")):x6(this,this.play)};
g.k.pause=function(){w6(this)?(this.i?this.i.pause(null,g.Ka,B6(this,"pause")):A6(this,"pause"),z6(this,2,q6(v6(this))),this.V("remotePlayerChange")):x6(this,this.pause)};
g.k.seekTo=function(a){if(w6(this)){if(this.i){var b=v6(this),c=new chrome.cast.media.SeekRequest;c.currentTime=a;b.pc()||3==b.playerState?c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.i.seek(c,g.Ka,B6(this,"seekTo",{newTime:a}))}else A6(this,"seekTo",{newTime:a});z6(this,3,a);this.V("remotePlayerChange")}else x6(this,g.Ra(this.seekTo,a))};
g.k.stop=function(){if(w6(this)){this.i?this.i.stop(null,g.Ka,B6(this,"stopVideo")):A6(this,"stopVideo");var a=v6(this);a.index=-1;a.videoId="";n6(a);y6(this,a);this.V("remotePlayerChange")}else x6(this,this.stop)};
g.k.setVolume=function(a,b){if(w6(this)){var c=v6(this);if(this.l){if(c.volume!=a){var d=Math.round(a)/100;this.l.setReceiverVolumeLevel(d,(0,g.B)(function(){x5("CP","set receiver volume: "+d)},this),(0,g.B)(function(){this.oe("failed to set receiver volume.")},this))}c.muted!=b&&this.l.setReceiverMuted(b,(0,g.B)(function(){x5("CP","set receiver muted: "+b)},this),(0,g.B)(function(){this.oe("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);A6(this,"setVolume",e)}c.muted=b;c.volume=a;y6(this,c)}else x6(this,g.Ra(this.setVolume,a,b))};
g.k.EE=function(a,b){if(w6(this)){var c=v6(this);a={videoId:a};b&&(c.trackData={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,kind:b.kind},a.style=g.uj(b.style),g.Xb(a,c.trackData));A6(this,"setSubtitlesTrack",a);y6(this,c)}else x6(this,g.Ra(this.EE,a,b))};
g.k.setAudioTrack=function(a,b){w6(this)?(b=b.getLanguageInfo().getId(),A6(this,"setAudioTrack",{videoId:a,audioTrackId:b}),a=v6(this),a.audioTrackId=b,y6(this,a)):x6(this,g.Ra(this.setAudioTrack,a,b))};
g.k.playVideo=function(a,b,c,d,e,f,h){var l=v6(this);c=c||0;var m={videoId:a,currentIndex:c};r6(l,a,c);void 0!==b&&(p6(l,b),m.currentTime=b);void 0!==d&&(m.listId=d);null!=e&&(m.playerParams=e);null!=f&&(m.clickTrackingParams=f);null!=h&&(m.locationInfo=g.uj(h));A6(this,"setPlaylist",m);d||y6(this,l)};
g.k.yx=function(a,b){if(w6(this)){if(a&&b){var c=v6(this);r6(c,a,b);y6(this,c)}A6(this,"previous")}else x6(this,g.Ra(this.yx,a,b))};
g.k.nextVideo=function(a,b){if(w6(this)){if(a&&b){var c=v6(this);r6(c,a,b);y6(this,c)}A6(this,"next")}else x6(this,g.Ra(this.nextVideo,a,b))};
g.k.dG=function(){w6(this)?A6(this,"dismissAutoplay"):x6(this,this.dG)};
g.k.dispose=function(){if(3!=this.bb){var a=this.bb;this.bb=3;this.V("proxyStateChange",a,this.bb)}g.P.prototype.dispose.call(this)};
g.k.oa=function(){iLa(this);this.u=null;this.B.clear();t6(this,null);g.P.prototype.oa.call(this)};
g.k.IC=function(a){if((a!=this.bb||2==a)&&3!=this.bb&&0!=a){var b=this.bb;this.bb=a;this.V("proxyStateChange",b,a);if(1==a)for(;!this.B.isEmpty();)b=a=this.B,g.gb(b.i)&&(b.i=b.l,b.i.reverse(),b.l=[]),a.i.pop().apply(this);else 3==a&&this.dispose()}};
g.k.rR=function(a,b){this.V(a,b)};
g.k.WP=function(a){if(!a)this.ju(null),t6(this,null);else if(this.l.receiver.volume){a=this.l.receiver.volume;var b=v6(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)x5("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,y6(this,b)}};
g.k.ju=function(a){x5("CP","Cast media: "+!!a);this.i&&this.i.removeUpdateListener(this.J);if(this.i=a)this.i.addUpdateListener(this.J),jLa(this),this.V("remotePlayerChange")};
g.k.VP=function(a){a?(jLa(this),this.V("remotePlayerChange")):this.ju(null)};
g.k.cD=function(){A6(this,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.k.dQ=function(){var a=fLa();a&&t6(this,a)};
g.k.oe=function(a){x5("CP",a)};g.v(C6,g.P);g.k=C6.prototype;
g.k.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.playerParams,f=b.clickTrackingParams,h=b.index,l={videoId:d},m=b.currentTime;b=b.locationInfo;void 0!==m&&(l.currentTime=5>=m?0:m);e&&(l.playerParams=e);b&&(l.locationInfo=b);f&&(l.clickTrackingParams=f);c&&(l.listId=c);void 0!==h&&(l.currentIndex=h);c&&(this.fc.listId=c);this.fc.videoId=d;this.fc.index=h||0;this.fc.state=3;p6(this.fc,m);this.B="UNSUPPORTED";D6("Connecting with setPlaylist and params: "+g.uj(l));this.i.connect({method:"setPlaylist",
params:g.uj(l)},a,iJa())}else D6("Connecting without params"),this.i.connect({},a,iJa());lLa(this)};
g.k.Px=function(a){this.i.Px(a)};
g.k.dispose=function(){this.Ha()||(this.V("beforeDispose"),E6(this,3));g.P.prototype.dispose.call(this)};
g.k.oa=function(){F6(this);H6(this);G6(this);g.Co(this.J);this.J=NaN;g.Co(this.L);this.L=NaN;this.u=null;g.cp(this.W);this.W.length=0;this.i.dispose();g.P.prototype.oa.call(this);this.B=this.I=this.l=this.fc=this.i=null};
g.k.mO=function(){this.Lq(2)};
g.k.aQ=function(){D6("Channel opened");this.ra&&(this.ra=!1,G6(this),this.Y=g.Ao((0,g.B)(function(){D6("Timing out waiting for a screen.");this.Lq(1)},this),15E3));
mJa(lKa(this.i),this.Aa)};
g.k.XP=function(){D6("Channel closed");isNaN(this.C)?C4(!0):C4();this.dispose()};
g.k.YP=function(a,b){C4();isNaN(this.Ft())?(b&&"shortLived"==this.va&&this.V("browserChannelAuthError",a),D6("Channel error: "+a+" without reconnection"),this.dispose()):(this.ra=!0,D6("Channel error: "+a+" with reconnection in "+this.Ft()+" ms"),E6(this,2))};
g.k.ZP=function(a){a.params?D6("Received: action="+a.action+", params="+g.uj(a.params)):D6("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=L4(a.params.devices);this.l=g.Oc(a,function(c){return new q4(c)});
a=!!g.cb(this.l,function(c){return"LOUNGE_SCREEN"==c.type});
oLa(this,a);break;case "loungeScreenDisconnected":g.lb(this.l,function(c){return"LOUNGE_SCREEN"==c.type});
oLa(this,!1);break;case "remoteConnected":var b=new q4(L4(a.params.device));g.cb(this.l,function(c){return b?c.id==b.id:!1})||TIa(this.l,b);
break;case "remoteDisconnected":b=new q4(L4(a.params.device));g.lb(this.l,function(c){return b?c.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":qLa(this,a);break;case "nowPlaying":sLa(this,a);break;case "onStateChange":rLa(this,a);break;case "onAdStateChange":tLa(this,a);break;case "onVolumeChanged":uLa(this,a);break;case "onSubtitlesTrackChanged":pLa(this,a);break;case "nowAutoplaying":vLa(this,a);break;case "autoplayDismissed":this.V("autoplayDismissed");break;case "autoplayUpNext":this.I=a.params.videoId||null;this.V("autoplayUpNext",this.I);break;case "onAutoplayModeChanged":this.B=
a.params.autoplayMode;this.V("autoplayModeChange",this.B);"DISABLED"==this.B&&this.V("autoplayDismissed");break;case "onHasPreviousNextChanged":wLa(this,a);break;case "requestAssistedSignIn":this.V("assistedSignInRequested",a.params.authCode);break;default:D6("Unrecognized action: "+a.action)}};
g.k.WS=function(){if(this.u){var a=this.u;this.u=null;this.fc.videoId!=a&&I6(this,"getNowPlaying")}};
g.k.hO=function(){var a=3;this.Ha()||(a=0,isNaN(this.Ft())?s5(this.i)&&isNaN(this.C)&&(a=1):a=2);return a};
g.k.Lq=function(a){D6("Disconnecting with "+a);F6(this);this.V("beforeDisconnect",a);1==a&&C4();mKa(this.i,a);this.dispose()};
g.k.fO=function(){var a=this.fc;this.u&&(a=this.fc.clone(),r6(a,this.u,a.index));return s6(a)};
g.k.hT=function(a){var b=new m6(a);b.videoId&&b.videoId!=this.fc.videoId&&(this.u=b.videoId,g.Co(this.J),this.J=g.Ao((0,g.B)(this.WS,this),5E3));var c=[];this.fc.listId==b.listId&&this.fc.videoId==b.videoId&&this.fc.index==b.index||c.push("remoteQueueChange");this.fc.playerState==b.playerState&&this.fc.volume==b.volume&&this.fc.muted==b.muted&&q6(this.fc)==q6(b)&&g.uj(this.fc.trackData)==g.uj(b.trackData)||c.push("remotePlayerChange");this.fc.reset(a);g.zb(c,function(d){this.V(d)},this)};
g.k.HG=function(){var a=this.i.I.id,b=g.cb(this.l,function(c){return"REMOTE_CONTROL"==c.type&&c.id!=a});
return b?b.id:""};
g.k.Ft=function(){var a=this.i;return a.l.isActive()?a.l.l-g.Ta():NaN};
g.k.cO=function(){return this.B||"UNSUPPORTED"};
g.k.dO=function(){return this.I||""};
g.k.KM=function(){if(!isNaN(this.Ft())){var a=this.i.l;a.i.gh();a.start()}};
g.k.eT=function(a,b){I6(this,a,b);nLa(this)};
g.k.FE=function(){var a=g.Tq("SID","")||"",b=g.Tq("SAPISID","")||"",c=g.Tq("__Secure-3PAPISID","")||"";if(!a&&!b&&!c)return"";a=g.pf(g.Ue(a),2);b=g.pf(g.Ue(b),2);c=g.pf(g.Ue(c),2);return g.pf(g.Ue(a+","+b+","+c),2)};
C6.prototype.subscribe=C6.prototype.subscribe;C6.prototype.unsubscribeByKey=C6.prototype.Hg;C6.prototype.getProxyState=C6.prototype.hO;C6.prototype.disconnect=C6.prototype.Lq;C6.prototype.getPlayerContextData=C6.prototype.fO;C6.prototype.setPlayerContextData=C6.prototype.hT;C6.prototype.getOtherConnectedRemoteId=C6.prototype.HG;C6.prototype.getReconnectTimeout=C6.prototype.Ft;C6.prototype.getAutoplayMode=C6.prototype.cO;C6.prototype.getAutoplayVideoId=C6.prototype.dO;C6.prototype.reconnect=C6.prototype.KM;
C6.prototype.sendMessage=C6.prototype.eT;C6.prototype.getXsrfToken=C6.prototype.FE;g.v(J6,B5);g.k=J6.prototype;g.k.Mh=function(a){return this.yg.$_gs(a)};
g.k.contains=function(a){return!!this.yg.$_c(a)};
g.k.get=function(a){return this.yg.$_g(a)};
g.k.start=function(){this.yg.$_st()};
g.k.add=function(a,b,c){this.yg.$_a(a,b,c)};
g.k.remove=function(a,b,c){this.yg.$_r(a,b,c)};
g.k.qy=function(a,b,c,d){this.yg.$_un(a,b,c,d)};
g.k.oa=function(){for(var a=0,b=this.i.length;a<b;++a)this.yg.$_ubk(this.i[a]);this.i.length=0;this.yg=null;B5.prototype.oa.call(this)};
g.k.LM=function(){this.V("screenChange")};
g.k.YQ=function(){this.V("onlineScreenChange")};
L5.prototype.$_st=L5.prototype.start;L5.prototype.$_gspc=L5.prototype.FM;L5.prototype.$_gsppc=L5.prototype.BE;L5.prototype.$_c=L5.prototype.contains;L5.prototype.$_g=L5.prototype.get;L5.prototype.$_a=L5.prototype.add;L5.prototype.$_un=L5.prototype.qy;L5.prototype.$_r=L5.prototype.remove;L5.prototype.$_gs=L5.prototype.Mh;L5.prototype.$_gos=L5.prototype.AE;L5.prototype.$_s=L5.prototype.subscribe;L5.prototype.$_ubk=L5.prototype.Hg;var W6=null,b7=!1,K6=null,L6=null,a7=null,P6=[];g.v(c7,g.F);g.k=c7.prototype;g.k.oa=function(){g.F.prototype.oa.call(this);this.i.stop();this.u.stop();this.L.stop();this.Y();var a=this.Nb;a.unsubscribe("proxyStateChange",this.OI,this);a.unsubscribe("remotePlayerChange",this.tu,this);a.unsubscribe("remoteQueueChange",this.wx,this);a.unsubscribe("previousNextChange",this.LI,this);a.unsubscribe("nowAutoplaying",this.FI,this);a.unsubscribe("autoplayDismissed",this.cI,this);this.Nb=this.l=null};
g.k.GE=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.Nb.bb)if(d7(this)){if(!v6(this.Nb).isAdPlaying()||"control_seek"!==a)switch(a){case "control_toggle_play_pause":v6(this.Nb).pc()?this.Nb.pause():this.Nb.play();break;case "control_play":this.Nb.play();break;case "control_pause":this.Nb.pause();break;case "control_seek":this.J.gh(c[0],c[1]);break;case "control_subtitles_set_track":e7(this,c[0]);break;case "control_set_audio_track":this.setAudioTrack(c[0])}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":c=
this.G.getCurrentTime();f7(this,0===c?void 0:c);break;case "control_seek":f7(this,c[0]);break;case "control_subtitles_set_track":e7(this,c[0]);break;case "control_set_audio_track":this.setAudioTrack(c[0])}};
g.k.TP=function(a){this.L.gh(a)};
g.k.JT=function(a){this.GE("control_subtitles_set_track",g.Qb(a)?null:a)};
g.k.ZJ=function(){var a=this.G.getOption("captions","track");g.Qb(a)||e7(this,a)};
g.k.Rb=function(a){this.l.Rb(a,this.G.getVideoData().lengthSeconds)};
g.k.HQ=function(){g.Qb(this.B)||HLa(this,this.B);this.C=!1};
g.k.OI=function(a,b){this.u.stop();2===b&&this.UJ()};
g.k.tu=function(){if(d7(this)){this.i.stop();var a=v6(this.Nb);switch(a.playerState){case 1080:case 1081:case 1084:case 1085:this.l.zf=1;break;case 1082:case 1083:this.l.zf=0;break;default:this.l.zf=-1}switch(a.playerState){case 1081:case 1:this.Jb(new g.ZI(8));this.TJ();break;case 1085:case 3:this.Jb(new g.ZI(9));break;case 1083:case 0:this.Jb(new g.ZI(2));this.J.stop();this.Rb(this.G.getVideoData().lengthSeconds);break;case 1084:this.Jb(new g.ZI(4));break;case 2:this.Jb(new g.ZI(4));this.Rb(q6(a));
break;case -1:this.Jb(new g.ZI(64));break;case -1E3:this.Jb(new g.ZI(128,{errorCode:"mdx.remoteerror",errorMessage:"This video is not available for remote playback."}))}a=v6(this.Nb).trackData;var b=this.B;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.kind==b.kind:1)||(this.B=a,HLa(this,a));a=v6(this.Nb);-1===a.volume||Math.round(this.G.getVolume())===a.volume&&this.G.isMuted()===a.muted||this.W.isActive()||this.uK()}else GLa(this)};
g.k.LI=function(){this.G.V("mdxpreviousnextchange")};
g.k.wx=function(){d7(this)||GLa(this)};
g.k.FI=function(a){isNaN(a)||this.G.V("mdxnowautoplaying",a)};
g.k.cI=function(){this.G.V("mdxautoplaycanceled")};
g.k.setAudioTrack=function(a){d7(this)&&this.Nb.setAudioTrack(this.G.getVideoData(1).videoId,a)};
g.k.seekTo=function(a,b){-1===v6(this.Nb).playerState?f7(this,a):b&&this.Nb.seekTo(a)};
g.k.uK=function(){var a=this;if(d7(this)){var b=v6(this.Nb);this.events.hc(this.X);b.muted?this.G.mute():this.G.unMute();this.G.setVolume(b.volume);this.X=this.events.N(this.G,"onVolumeChange",function(c){FLa(a,c)})}};
g.k.TJ=function(){this.i.stop();if(!this.Nb.Ha()){var a=v6(this.Nb);a.pc()&&this.Jb(new g.ZI(8));this.Rb(q6(a));this.i.start()}};
g.k.UJ=function(){this.u.stop();this.i.stop();var a=this.Nb.u.getReconnectTimeout();2==this.Nb.bb&&!isNaN(a)&&this.u.start()};
g.k.Jb=function(a){this.u.stop();var b=this.I;if(!g.dJ(b,a)){var c=g.V(a,2);c!==g.V(this.I,2)&&this.G.Hp(c);this.I=a;JLa(this.l,b,a)}};g.v(g7,g.W);g7.prototype.Zc=function(){this.i.show()};
g7.prototype.Bb=function(){this.i.hide()};
g7.prototype.l=function(){g.FI("https://support.google.com/youtube/answer/7640706")};
g7.prototype.u=function(){p4("mdx-manual-pairing-popup-ok");this.Bb()};g.v(h7,g.W);h7.prototype.Zc=function(){this.i.show()};
h7.prototype.Bb=function(){this.i.hide()};
h7.prototype.l=function(){p4("mdx-privacy-popup-cancel");this.Bb()};
h7.prototype.u=function(){p4("mdx-privacy-popup-confirm");this.Bb()};g.v(i7,g.W);i7.prototype.l=function(a){ILa(this,a.state)};g.v(j7,g.LO);j7.prototype.C=function(){var a=this.G.getOption("remote","receivers");a&&1<a.length&&!this.G.getOption("remote","quickCast")?(this.Cn=g.Ab(a,this.i,this),g.MO(this,g.Oc(a,this.i)),a=this.G.getOption("remote","currentReceiver"),a=this.i(a),this.options[a]&&this.ai(a),this.enable(!0)):this.enable(!1)};
j7.prototype.i=function(a){return a.key};
j7.prototype.Zi=function(a){return"cast-selector-receiver"===a?"Cast...":this.Cn[a].name};
j7.prototype.Jf=function(a){g.LO.prototype.Jf.call(this,a);this.G.setOption("remote","currentReceiver",this.Cn[a]);this.wb.Bb()};g.v(k7,g.aM);g.k=k7.prototype;
g.k.create=function(){var a=this.player.T(),b=g.HD(a);a={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:g.S(a.experiments,"mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:g.S(a.experiments,"enable_dial_short_lived_lounge_token"),enableCastLoungeToken:g.S(a.experiments,"enable_cast_short_lived_lounge_token")};ALa(b,a);this.subscriptions.push(g.Ho("yt-remote-before-disconnect",this.RP,this));this.subscriptions.push(g.Ho("yt-remote-connection-change",this.yR,this));this.subscriptions.push(g.Ho("yt-remote-receiver-availability-change",
this.NI,this));this.subscriptions.push(g.Ho("yt-remote-auto-connect",this.wR,this));this.subscriptions.push(g.Ho("yt-remote-receiver-resumed",this.vR,this));this.subscriptions.push(g.Ho("mdx-privacy-popup-confirm",this.NS,this));this.subscriptions.push(g.Ho("mdx-privacy-popup-cancel",this.MS,this));this.subscriptions.push(g.Ho("mdx-manual-pairing-popup-ok",this.cP,this));this.NI()};
g.k.load=function(){this.player.cancelPlayback();g.aM.prototype.load.call(this);this.gi=new c7(this,this.player,this.Nb);var a=(a=ELa())?a.currentTime:0;var b=$6()?new u6(U6(),void 0):null;0==a&&b&&(a=q6(v6(b)));0!==a&&this.Rb(a);JLa(this,this.od,this.od);this.player.Sk(6)};
g.k.unload=function(){this.player.V("mdxautoplaycanceled");this.Em=this.rj;g.vi(this.gi,this.Nb);this.Nb=this.gi=null;g.aM.prototype.unload.call(this);this.player.Sk(5);l7(this)};
g.k.oa=function(){g.Io(this.subscriptions);g.aM.prototype.oa.call(this)};
g.k.Qk=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.gi.GE.apply(this.gi,[a].concat(g.ma(c)))};
g.k.getAdState=function(){return this.zf};
g.k.iO=function(){return this.loaded?this.gi.suggestion:null};
g.k.Fk=function(){return this.Nb?v6(this.Nb).Fk:!1};
g.k.hasNext=function(){return this.Nb?v6(this.Nb).hasNext:!1};
g.k.Rb=function(a,b){this.vH=a||0;this.player.V("progresssync",a,b)};
g.k.getCurrentTime=function(){return this.vH};
g.k.getProgressState=function(){var a=v6(this.Nb),b=this.player.getVideoData();return{allowSeeking:g.S(this.player.T().experiments,"web_player_mdx_allow_seeking_change_killswitch")?this.player.yf():!a.isAdPlaying()&&this.player.yf(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.l?a.u+o6(a):a.u,isAtLiveHead:1>=(a.l?a.i+o6(a):a.i)-this.getCurrentTime(),loaded:a.L,seekableEnd:a.l?a.i+o6(a):a.i,seekableStart:0<a.B?a.B+
o6(a):a.B}};
g.k.nextVideo=function(){this.Nb&&this.Nb.nextVideo()};
g.k.yx=function(){this.Nb&&this.Nb.yx()};
g.k.RP=function(a){1===a&&(this.kC=this.Nb?v6(this.Nb):null)};
g.k.yR=function(){var a=$6()?new u6(U6(),void 0):null;if(a){var b=this.Em;this.loaded&&this.unload();this.Nb=a;this.kC=null;b.key!==this.rj.key&&(this.Em=b,this.load())}else g.ui(this.Nb),this.Nb=null,this.loaded&&(this.unload(),(a=this.kC)&&a.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(a.videoId,q6(a)));this.player.V("videodatachange","newdata",this.player.getVideoData(),3)};
g.k.NI=function(){var a=[this.rj],b=a.concat,c=BLa();i6()&&g.Pu("yt-remote-cast-available")&&c.push({key:"cast-selector-receiver",name:"Cast..."});this.Cn=b.call(a,c);a=V6()||this.rj;m7(this,a);this.player.La("onMdxReceiversChange")};
g.k.wR=function(){var a=V6();m7(this,a)};
g.k.vR=function(){this.Em=V6()};
g.k.NS=function(){this.wu=!0;l7(this);b7=!1;W6&&Y6(W6,1);W6=null};
g.k.MS=function(){this.wu=!1;l7(this);m7(this,this.rj);this.Em=this.rj;b7=!1;W6=null;this.player.playVideo()};
g.k.cP=function(){this.Ww=!0;l7(this);g.Ou("yt-remote-manual-pairing-warning-shown",!0,2592E3);b7=!1;W6&&Y6(W6,1);W6=null};
g.k.uf=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.Cn;case "currentReceiver":return b&&("cast-selector-receiver"===b.key?k6():m7(this,b)),this.loaded?this.Em:this.rj;case "quickCast":return 2===this.Cn.length&&"cast-selector-receiver"===this.Cn[1].key?(b&&k6(),!0):!1}};
g.k.cD=function(){this.Nb.cD()};
g.k.Qi=function(){return!1};
g.k.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]};g.gM.remote=k7;})(_yt_player);
