(function(g){var window=this;var jIa=function(a,b){return g.Mb(a,b)},s4=function(a,b,c){a.l.set(b,c)},t4=function(a){s4(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^g.Sa()).toString(36));
return a},u4=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.Xm(a.l,b,c)},kIa=function(a,b){var c=[];
g.bj(b,function(d){try{var e=g.Kn.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.Jn(e)&&c.push(d)},a);
return c},lIa=function(a,b){var c=kIa(a,b);
g.Ab(c,function(d){g.Kn.prototype.remove.call(this,d)},a)},mIa=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},nIa=function(a,b){g.fb(a,b)||a.push(b)},v4=function(a){var b=0,c;
for(c in a)b++;return b},oIa=function(a,b){var c=b instanceof g.Gc?b:g.Mc(b,/^data:image\//i.test(b));
a.src=g.Hc(c)},pIa=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);},qIa=function(a){if(a.qg&&"function"==typeof a.qg)return a.qg();
if("string"===typeof a)return a.split("");if(g.Ma(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return g.Jb(a)},rIa=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);
else if(g.Ma(a)||"string"===typeof a)g.Ab(a,b,void 0);else{if(a.nh&&"function"==typeof a.nh)var c=a.nh();else if(a.qg&&"function"==typeof a.qg)c=void 0;else if(g.Ma(a)||"string"===typeof a){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=g.Kb(a);d=qIa(a);e=d.length;for(var f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a)}},sIa=function(a,b,c,d){var e=new g.Lm(null,void 0);
a&&g.Mm(e,a);b&&g.Nm(e,b);c&&g.Om(e,c);d&&(e.J=d);return e},w4=function(){},x4=function(a,b){g.zo[a]=!0;
var c=g.xo();c&&c.publish.apply(c,arguments);g.zo[a]=!1},y4=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.Im;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",tIa(this,a.capabilities||""),uIa(this,a.experiments||""))},tIa=function(a,b){a.capabilities.clear();
g.Ne(b.split(","),g.Qa(jIa,vIa)).forEach(function(c){a.capabilities.add(c)})},uIa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},z4=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"},A4=function(a,b){return!!b&&(a.id==b||a.uuid==b)},wIa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid,screenIdType:a.idType}},xIa=function(a){return new z4(a)},yIa=function(a){return Array.isArray(a)?g.Qc(a,xIa):[]},B4=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"},C4=function(a){return Array.isArray(a)?"["+g.Qc(a,B4).join(",")+"]":"null"},D4=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)})},zIa=function(a){return g.Qc(a,function(b){return{key:b.id,
name:b.name}})},E4=function(a,b){return g.cb(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},F4=function(a,b){return g.cb(a,function(c){return A4(c,b)})},AIa=function(){var a=(0,g.Bu)();
a&&lIa(a,a.i.Mj(!0))},G4=function(){var a=g.Eu("yt-remote-connected-devices")||[];
g.xb(a);return a},BIa=function(a){if(g.gb(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return g.Qc(a,function(d,e){return 0==e?d:d.substring(c.length)})},CIa=function(a){g.Du("yt-remote-connected-devices",a,86400)},I4=function(){if(H4)return H4;
var a=g.Eu("yt-remote-device-id");a||(a=D4(),g.Du("yt-remote-device-id",a,31536E3));for(var b=G4(),c=1,d=a;g.fb(b,d);)c++,d=a+"#"+c;return H4=d},J4=function(){var a=G4(),b=I4();
g.fb(a,b);g.Gu()&&g.zb(a,b);a=BIa(a);if(g.gb(a))try{g.Qq("remote_sid")}catch(c){}else try{g.Oq("remote_sid",a.join(","),-1)}catch(c){}},DIa=function(){return g.Eu("yt-remote-session-browser-channel")},EIa=function(){return g.Eu("yt-remote-local-screens")||[]},FIa=function(){g.Du("yt-remote-lounge-token-expiration",!0,86400)},GIa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=g.Qc(EIa(),function(d){return d.loungeToken}),c=g.Qc(a,function(d){return d.loungeToken});
g.fh(c,function(d){return!g.fb(b,d)})&&FIa();
g.Du("yt-remote-local-screens",a,31536E3)},HIa=function(a,b){g.Du("yt-remote-session-browser-channel",a);
g.Du("yt-remote-session-screen-id",b);var c=G4(),d=I4();g.fb(c,d)||c.push(d);CIa(c);J4()},K4=function(a){a||(g.Fu("yt-remote-session-screen-id"),g.Fu("yt-remote-session-video-id"));
J4();a=G4();g.kb(a,I4());CIa(a)},IIa=function(){if(!L4){var a=g.Un();
a&&(L4=new g.En(a))}},JIa=function(){IIa();
return L4?!!L4.get("yt-remote-use-staging-server"):!1},M4=function(){var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
return a?parseInt(a[1],10):0},KIa=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},LIa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},N4=function(a){a.length?MIa(a.shift(),function(){N4(a)}):O4()},NIa=function(a){return"chrome-extension://"+a+"/cast_sender.js"},MIa=function(a,b,c){var d=document.createElement("script");
d.onerror=b;c&&(d.onload=c);g.nd(d,g.kg(a));(document.head||document.documentElement).appendChild(d)},OIa=function(){var a=M4(),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},O4=function(){var a=LIa();
a&&a(!1,"No cast extension found")},P4=function(){if(PIa){var a=2,b=LIa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;MIa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",O4,c)}},QIa=function(){P4();
var a=OIa();a.push("//www.gstatic.com/eureka/clank/cast_sender.js");N4(a)},SIa=function(){P4();
var a=OIa();a.push.apply(a,g.la(RIa.map(NIa)));a.push("//www.gstatic.com/eureka/clank/cast_sender.js");N4(a)},Q4=function(a,b,c){g.E.call(this);
this.I=null!=c?(0,g.B)(a,c):a;this.Hf=b;this.C=(0,g.B)(this.JJ,this);this.i=!1;this.l=0;this.u=this.gb=null;this.B=[]},R4=function(a,b,c){g.E.call(this);
this.B=null!=c?a.bind(c):a;this.Hf=b;this.u=null;this.i=!1;this.l=0;this.gb=null},S4=function(a){a.gb=g.Gm(function(){a.gb=null;
a.i&&!a.l&&(a.i=!1,S4(a))},a.Hf);
var b=a.u;a.u=null;a.B.apply(null,b)},T4=function(a){if(g.A.JSON)try{return g.A.JSON.parse(a)}catch(b){}return pIa(a)},U4=function(){},V4=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)},X4=function(a){W4.dispatchEvent(new TIa(W4,a))},TIa=function(a,b){g.Cl.call(this,"statevent",a);
this.stat=b},Y4=function(){},UIa=function(){},WIa=function(a){return(a=VIa(a))?new ActiveXObject(a):new XMLHttpRequest},VIa=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},Z4=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.w_(this);this.u=new g.Fm;this.u.setInterval(250)},YIa=function(a,b,c){a.Cp=1;
a.Qk=t4(b.clone());a.Cn=c;a.I=!0;XIa(a,null)},$4=function(a,b,c,d,e){a.Cp=1;
a.Qk=t4(b.clone());a.Cn=null;a.I=c;e&&(a.LG=!1);XIa(a,d)},XIa=function(a,b){a.pp=g.Sa();
a5(a);a.Pl=a.Qk.clone();u4(a.Pl,"t",a.J);a.Ds=0;a.Be=a.i.zx(a.i.Yr()?b:null);0<a.ww&&(a.Qu=new R4((0,g.B)(a.HH,a,a.Be),a.ww));a.B.ya(a.Be,"readystatechange",a.YP);var c=a.im?g.Vb(a.im):{};a.Cn?(a.Dv="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.Be.send(a.Pl,a.Dv,a.Cn,c)):(a.Dv="GET",a.LG&&!g.De&&(c.Connection="close"),a.Be.send(a.Pl,a.Dv,null,c));a.i.ci(1)},aJa=function(a,b,c){for(var d=!0;!a.Lm&&a.Ds<c.length;){var e=ZIa(a,c);
if(e==b5){4==b&&(a.Kk=4,X4(15),d=!1);break}else if(e==$Ia){a.Kk=4;X4(16);d=!1;break}else c5(a,e)}4==b&&0==c.length&&(a.Kk=1,X4(17),d=!1);a.ti=a.ti&&d;d||(d5(a),e5(a))},ZIa=function(a,b){var c=a.Ds,d=b.indexOf("\n",c);
if(-1==d)return b5;c=Number(b.substring(c,d));if(isNaN(c))return $Ia;d+=1;if(d+c>b.length)return b5;var e=b.substr(d,c);a.Ds=d+c;return e},cJa=function(a,b){a.pp=g.Sa();
a5(a);var c=b?window.location.hostname:"";a.Pl=a.Qk.clone();s4(a.Pl,"DOMAIN",c);s4(a.Pl,"t",a.J);try{a.yi=new ActiveXObject("htmlfile")}catch(n){d5(a);a.Kk=7;X4(22);e5(a);return}var d="<html><body>";if(b){for(var e="",f=0;f<c.length;f++){var h=c.charAt(f);if("<"==h)h=e+"\\x3c";else if(">"==h)h=e+"\\x3e";else{if(h in f5)h=f5[h];else if(h in bJa)h=f5[h]=bJa[h];else{var l=h.charCodeAt(0);if(31<l&&127>l)var m=h;else{if(256>l){if(m="\\x",16>l||256<l)m+="0"}else m="\\u",4096>l&&(m+="0");m+=l.toString(16).toUpperCase()}h=
f5[h]=m}h=e+h}e=h}d+='<script>document.domain="'+e+'"\x3c/script>'}c=g.kd(g.gc("b/12014412"),d+"</body></html>");a.yi.open();a.yi.write(g.gd(c));a.yi.close();a.yi.parentWindow.m=(0,g.B)(a.tP,a);a.yi.parentWindow.d=(0,g.B)(a.XF,a,!0);a.yi.parentWindow.rpcClose=(0,g.B)(a.XF,a,!1);c=a.yi.createElement("DIV");a.yi.parentWindow.document.body.appendChild(c);d=g.Lc(a.Pl.toString());d=g.sd(g.Hc(d));d=g.kd(g.gc("b/12014412"),'<iframe src="'+d+'"></iframe>');g.ld(c,d);a.i.ci(1)},a5=function(a){a.LA=g.Sa()+
a.C;
dJa(a,a.C)},dJa=function(a,b){if(null!=a.Ip)throw Error("WatchDog timer not null");
a.Ip=V4((0,g.B)(a.BP,a),b)},g5=function(a){a.Ip&&(g.A.clearTimeout(a.Ip),a.Ip=null)},e5=function(a){a.i.KB()||a.Lm||a.i.Ts(a)},d5=function(a){g5(a);
g.Ei(a.Qu);a.Qu=null;a.u.stop();g.DCa(a.B);if(a.Be){var b=a.Be;a.Be=null;b.abort();b.dispose()}a.yi&&(a.yi=null)},c5=function(a,b){try{a.i.OF(a,b),a.i.ci(4)}catch(c){}},fJa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;eJa(a,b,function(h){h?c(!0):g.A.setTimeout(function(){fJa(a,b,c,d,f)},f)})}},eJa=function(a,b,c){var d=new Image;
d.onload=function(){try{h5(d),c(!0)}catch(e){}};
d.onerror=function(){try{h5(d),c(!1)}catch(e){}};
d.onabort=function(){try{h5(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{h5(d),c(!1)}catch(e){}};
g.A.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
oIa(d,a)},h5=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},i5=function(a){g.Wl.call(this);
this.headers=new g.Im;this.ea=a||null;this.B=!1;this.ca=this.i=null;this.za=this.W="";this.I=0;this.u="";this.C=this.la=this.L=this.ga=!1;this.J=0;this.X=null;this.Ca="";this.Y=this.ia=!1},gJa=function(a){return g.Be&&g.ce(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},hJa=function(a){return"content-type"==a.toLowerCase()},jJa=function(a,b){a.B=!1;
a.i&&(a.C=!0,a.i.abort(),a.C=!1);a.u=b;a.I=5;iJa(a);j5(a)},iJa=function(a){a.ga||(a.ga=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))},lJa=function(a){if(a.B&&"undefined"!=typeof g.z_)if(a.ca[1]&&4==k5(a)&&2==a.getStatus())l5(a,"Local request error detected and ignored");
else if(a.L&&4==k5(a))g.Gm(a.LF,0,a);else if(a.dispatchEvent("readystatechange"),a.isComplete()){l5(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.Bd(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=!kJa.test(f?f.toLowerCase():"")}d=e}if(d)a.dispatchEvent("complete"),a.dispatchEvent("success");
else{a.I=6;try{var l=2<k5(a)?a.i.statusText:""}catch(m){l=""}a.u=l+" ["+a.getStatus()+"]";iJa(a)}}finally{j5(a)}}},j5=function(a,b){if(a.i){mJa(a);
var c=a.i,d=a.ca[0]?g.Ia:null;a.i=null;a.ca=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){}}},mJa=function(a){a.i&&a.Y&&(a.i.ontimeout=null);
a.X&&(g.A.clearTimeout(a.X),a.X=null)},k5=function(a){return a.i?a.i.readyState:0},m5=function(a){try{return a.i?a.i.responseText:""}catch(b){return""}},l5=function(a,b){return b+" ["+a.za+" "+a.W+" "+a.getStatus()+"]"},nJa=function(a){this.i=a;
this.l=new U4},oJa=function(a){var b=n5(a.i,a.kq,"/mail/images/cleardot.gif");
t4(b);fJa(b.toString(),5E3,(0,g.B)(a.AK,a),3,2E3);a.ci(1)},p5=function(a){var b=a.i.L;
if(null!=b)X4(5),b?(X4(11),o5(a.i,a,!1)):(X4(12),o5(a.i,a,!0));else if(a.zg=new Z4(a,void 0,void 0,void 0),a.zg.im=a.xw,b=a.i,b=n5(b,b.Yr()?a.aq:null,a.yw),X4(5),!g.Be||g.de(10))u4(b,"TYPE","xmlhttp"),$4(a.zg,b,!1,a.aq,!1);else{u4(b,"TYPE","html");var c=a.zg;a=!!a.aq;c.Cp=3;c.Qk=t4(b.clone());cJa(c,a)}},q5=function(a,b,c){this.Ma=1;
this.i=[];this.u=[];this.B=new U4;this.J=a||null;this.L=null!=b?b:null;this.C=c||!1},pJa=function(a,b){this.i=a;
this.map=b;this.context=null},qJa=function(a,b,c,d){g.Cl.call(this,"timingevent",a);
this.size=b;this.Rr=d},rJa=function(a){g.Cl.call(this,"serverreachability",a)},uJa=function(a){sJa(a);
if(3==a.Ma){var b=a.yr++,c=a.zt.clone();s4(c,"SID",a.l);s4(c,"RID",b);s4(c,"TYPE","terminate");r5(a,c);b=new Z4(a,a.l,b,void 0);b.Cp=2;b.Qk=t4(c.clone());oIa(new Image,b.Qk.toString());b.pp=g.Sa();a5(b)}tJa(a)},vJa=function(a){a.UK(1,0);
a.zt=n5(a,null,a.zw);s5(a)},sJa=function(a){a.Uk&&(a.Uk.abort(),a.Uk=null);
a.Wd&&(a.Wd.cancel(),a.Wd=null);a.Oj&&(g.A.clearTimeout(a.Oj),a.Oj=null);t5(a);a.ng&&(a.ng.cancel(),a.ng=null);a.fl&&(g.A.clearTimeout(a.fl),a.fl=null)},wJa=function(a,b){if(0==a.Ma)throw Error("Invalid operation: sending map when state is closed");
a.i.push(new pJa(a.sM++,b));2!=a.Ma&&3!=a.Ma||s5(a)},xJa=function(a){var b=0;
a.Wd&&b++;a.ng&&b++;return b},s5=function(a){a.ng||a.fl||(a.fl=V4((0,g.B)(a.VF,a),0),a.yo=0)},zJa=function(a,b){if(1==a.Ma){if(!b){a.yr=Math.floor(1E5*Math.random());
var c=a.yr++,d=new Z4(a,"",c,void 0);d.im=a.Ei;var e=u5(a),f=a.zt.clone();s4(f,"RID",c);s4(f,"CVER","1");r5(a,f);YIa(d,f,e);a.ng=d;a.Ma=2}}else 3==a.Ma&&(b?yJa(a,b):0==a.i.length||a.ng||yJa(a))},yJa=function(a,b){if(b)if(6<a.Mm){a.i=a.u.concat(a.i);
a.u.length=0;var c=a.yr-1;var d=u5(a)}else c=b.L,d=b.Cn;else c=a.yr++,d=u5(a);var e=a.zt.clone();s4(e,"SID",a.l);s4(e,"RID",c);s4(e,"AID",a.Ro);r5(a,e);c=new Z4(a,a.l,c,a.yo+1);c.im=a.Ei;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.ng=c;YIa(c,e,d)},r5=function(a,b){if(a.zf){var c=a.zf.vD();
c&&g.Cb(c,function(d,e){s4(b,e,d)})}},u5=function(a){var b=Math.min(a.i.length,1E3),c=["count="+b];
if(6<a.Mm&&0<b){var d=a.i[0].i;c.push("ofs="+d)}else d=0;for(var e={},f=0;f<b;e={Sn:e.Sn},f++){e.Sn=a.i[f].i;var h=a.i[f].map;e.Sn=6>=a.Mm?f:e.Sn-d;try{g.Cb(h,function(l){return function(m,n){c.push("req"+l.Sn+"_"+n+"="+encodeURIComponent(m))}}(e))}catch(l){c.push("req"+e.Sn+"_type="+encodeURIComponent("_badmap"))}}a.u=a.u.concat(a.i.splice(0,b));
return c.join("&")},AJa=function(a){a.Wd||a.Oj||(a.I=1,a.Oj=V4((0,g.B)(a.UF,a),0),a.fo=0)},v5=function(a){if(a.Wd||a.Oj||3<=a.fo)return!1;
a.I++;a.Oj=V4((0,g.B)(a.UF,a),BJa(a,a.fo));a.fo++;return!0},o5=function(a,b,c){a.Bv=c;
a.Fi=b.Kj;a.C||vJa(a)},t5=function(a){null!=a.Tm&&(g.A.clearTimeout(a.Tm),a.Tm=null)},BJa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},w5=function(a,b){if(2==b||9==b){var c=null;
a.zf&&(c=null);var d=(0,g.B)(a.GQ,a);c||(c=new g.Lm("//www.google.com/images/cleardot.gif"),t4(c));eJa(c.toString(),1E4,d)}else X4(2);CJa(a,b)},CJa=function(a,b){a.Ma=0;
a.zf&&a.zf.LC(b);tJa(a);sJa(a)},tJa=function(a){a.Ma=0;
a.Fi=-1;if(a.zf)if(0==a.u.length&&0==a.i.length)a.zf.ix();else{g.ob(a.u);var b=g.ob(a.i);a.u.length=0;a.i.length=0;a.zf.ix(b)}},n5=function(a,b,c){var d=g.Tm(c);
if(""!=d.i)b&&g.Nm(d,b+"."+d.i),g.Om(d,d.u);else{var e=window.location;d=sIa(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.Eq&&g.Cb(a.Eq,function(f,h){s4(d,h,f)});
s4(d,"VER",a.Mm);r5(a,d);return d},DJa=function(){},EJa=function(){this.i=[];
this.l=[]},FJa=function(a,b){this.action=a;
this.params=b||{}},x5=function(a,b){g.E.call(this);
this.i=new g.M(this.lP,0,this);g.I(this,this.i);this.Hf=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},y5=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.ca=a;this.I=b;this.u=new g.Dn;this.l=new x5(this.iQ,this);this.i=null;this.X=!1;this.C=null;this.W="";this.L=this.B=0;this.J=[];this.ea=c;this.Y=d;this.ia=e},GJa=function(a){return{firstTestResults:[""],
secondTestResults:!a.i.Bv,sessionId:a.i.l,arrayId:a.i.Ro}},HJa=function(a,b){a.L=b||0;
a.l.stop();z5(a);a.i&&(3==a.i.getState()&&zJa(a.i),uJa(a.i));a.L=0},A5=function(a){return!!a.i&&3==a.i.getState()},z5=function(a){if(a.i){var b=a.Y(),c=a.i.Ei||{};
b?c["x-youtube-lounge-xsrf-token"]=b:delete c["x-youtube-lounge-xsrf-token"];a.i.Ei=c}},B5=function(a){this.scheme="https";
this.port=this.domain="";this.i="/api/lounge";this.l=!0;a=a||document.location.href;var b=Number(g.Bd(4,a))||"";b&&(this.port=":"+b);this.domain=g.Cd(a)||"";a=g.Wc;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.Ec(a,"10.0")&&(this.l=!1))},C5=function(a,b){var c=a.i;
a.l&&(c=a.scheme+"://"+a.domain+a.port+a.i);return g.Od(c+b,{})},D5=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Qa(a.B,d,!0),onError:g.Qa(a.u,e),onTimeout:g.Qa(a.C,e)};c&&(a.postParams=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.Tp(b,a)},LJa=function(){var a=IJa;
JJa();E5.push(a);KJa()},F5=function(a,b){JJa();
var c=MJa(a,String(b));g.gb(E5)?NJa(c):(KJa(),g.Ab(E5,function(d){d(c)}))},JJa=function(){E5||(E5=g.Ha("yt.mdx.remote.debug.handlers_")||[],g.Da("yt.mdx.remote.debug.handlers_",E5,void 0))},NJa=function(a){var b=(G5+1)%50;
G5=b;H5[b]=a;I5||(I5=49==b)},KJa=function(){var a=E5;
if(H5[0]){var b=I5?G5:-1;do{b=(b+1)%50;var c=H5[b];g.Ab(a,function(d){d(c)})}while(b!=G5);
H5=Array(50);G5=-1;I5=!1}},MJa=function(a,b){var c=(Date.now()-OJa)/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("")},J5=function(a){g.R.call(this);
this.I=a;this.screens=[]},PJa=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c){var d=c.name;c.id=b.id||c.id;c.name=b.name;c.token=b.token;c.uuid=b.uuid||c.uuid;return c.name!=d}a.screens.push(b);return!0},QJa=function(a,b){var c=a.screens.length!=b.length;
a.screens=g.Ne(a.screens,function(f){return!!E4(b,f)});
for(var d=0,e=b.length;d<e;d++)c=PJa(a,b[d])||c;return c},RJa=function(a,b){var c=a.screens.length;
a.screens=g.Ne(a.screens,function(d){return!(d||b?!d!=!b?0:d.id==b.id:1)});
return a.screens.length<c},K5=function(a,b,c,d,e){g.R.call(this);
this.u=a;this.J=b;this.B=c;this.I=d;this.C=e;this.l=0;this.i=null;this.gb=NaN},M5=function(a){J5.call(this,"LocalScreenService");
this.l=a;this.i=NaN;L5(this);this.info("Initializing with "+C4(this.screens))},SJa=function(a){if(a.screens.length){var b=g.Qc(a.screens,function(d){return d.id}),c=C5(a.l,"/pairing/get_lounge_token_batch");
D5(a.l,c,{screen_ids:b.join(",")},(0,g.B)(a.vL,a),(0,g.B)(a.uL,a))}},L5=function(a){if(g.Ko("deprecate_pair_servlet_enabled"))return QJa(a,[]);
var b=yIa(EIa());b=g.Ne(b,function(c){return!c.uuid});
return QJa(a,b)},N5=function(a,b){GIa(g.Qc(a.screens,wIa));
b&&FIa()},P5=function(a,b){g.R.call(this);
this.I=b;var c=g.Eu("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.I(),f=0,h=e.length;f<h;++f){var l=e[f].id;d[l]=g.fb(c,l)}this.i=d;this.C=a;this.u=this.B=NaN;this.l=null;O5("Initialized with "+g.Dj(this.i))},Q5=function(a,b,c){var d=C5(a.C,"/pairing/get_screen_availability");
D5(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))},R5=function(a,b){a:if(v4(b)!=v4(a.i))var c=!1;
else{c=g.Kb(b);for(var d=0,e=c.length;d<e;++d)if(!a.i[c[d]]){c=!1;break a}c=!0}c||(O5("Updated online screens: "+g.Dj(a.i)),a.i=b,a.V("screenChange"));TJa(a)},S5=function(a){isNaN(a.u)||g.wo(a.u);
a.u=g.uo((0,g.B)(a.Lz,a),0<a.B&&a.B<g.Sa()?2E4:1E4)},O5=function(a){F5("OnlineScreenService",a)},UJa=function(a){var b={};
g.Ab(a.I(),function(c){c.token?b[c.token]=c.id:this.Gd("Requesting availability of screen w/o lounge token.")});
return b},TJa=function(a){a=g.Kb(g.Db(a.i,function(b){return b}));
g.xb(a);a.length?g.Du("yt-remote-online-screen-ids",a.join(","),60):g.Fu("yt-remote-online-screen-ids")},T5=function(a){J5.call(this,"ScreenService");
this.B=a;this.i=this.l=null;this.u=[];this.C={};VJa(this)},XJa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.C[b]);var h=a.Kg();if(h=(c?F4(h,c):null)||F4(h,b)){h.uuid=b;var l=U5(a,h);Q5(a.i,l,function(m){e(m?l:null)})}else c?WJa(a,c,(0,g.B)(function(m){var n=U5(this,new z4({name:d,
screenId:c,loungeToken:m,dialId:b||""}));Q5(this.i,n,function(p){e(p?n:null)})},a),f):e(null)},YJa=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},ZJa=function(a,b,c){Q5(a.i,b,c)},WJa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={postParams:{screen_ids:b},method:"POST",context:a,onSuccess:function(f,h){var l=h&&h.screens||[];l[0]&&l[0].screenId==b?c(l[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.Tp(C5(a.B,"/pairing/get_lounge_token_batch"),e)},$Ja=function(a){a.screens=a.l.Kg();
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: "+C4(a.screens))},VJa=function(a){V5(a);
a.l=new M5(a.B);a.l.subscribe("screenChange",(0,g.B)(a.BL,a));$Ja(a);a.u=yIa(g.Eu("yt-remote-automatic-screen-cache")||[]);V5(a);a.info("Initializing automatic screens: "+C4(a.u));a.i=new P5(a.B,(0,g.B)(a.Kg,a,!0));a.i.subscribe("screenChange",(0,g.B)(function(){this.V("onlineScreenChange")},a))},U5=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=F4(a.u,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.u.push(b),aKa(a));V5(a);a.C[b.uuid]=b.id;g.Du("yt-remote-device-id-map",a.C,31536E3);return b},aKa=function(a){a=g.Ne(a.u,function(b){return"shortLived"!=b.idType});
g.Du("yt-remote-automatic-screen-cache",g.Qc(a,wIa))},V5=function(a){a.C=g.Eu("yt-remote-device-id-map")||{}},W5=function(a,b,c){g.R.call(this);
this.ia=c;this.u=a;this.i=b;this.B=null},X5=function(a,b){a.B=b;
a.V("sessionScreen",a.B)},bKa=function(a,b){a.B&&(a.B.token=b,U5(a.u,a.B));
a.V("sessionScreen",a.B)},Y5=function(a,b){F5(a.ia,b)},Z5=function(a,b,c){W5.call(this,a,b,"CastSession");
var d=this;this.ga=c;this.l=null;this.Y=(0,g.B)(this.OJ,this);this.ea=(0,g.B)(this.FP,this);this.X=g.uo(function(){cKa(d,null)},12E4);
this.J=this.C=this.I=this.L=0;this.ca=!1;this.W="unknown"},$5=function(a,b){g.wo(a.J);
a.J=0;0==b?dKa(a):a.J=g.uo(function(){dKa(a)},b)},dKa=function(a){eKa(a,"getLoungeToken");
g.wo(a.C);a.C=g.uo(function(){fKa(a,null)},3E4)},eKa=function(a,b){a.info("sendYoutubeMessage_: "+b+" "+g.Dj(void 0));
var c={};c.type=b;a.l?a.l.sendMessage("urn:x-cast:com.google.youtube.mdx",c,g.Ia,(0,g.B)(function(){Y5(this,"Failed to send message: "+b+".")},a)):Y5(a,"Sending yt message without session: "+g.Dj(c))},a6=function(a,b){b?(a.info("onConnectedScreenId_: Received screenId: "+b),a.getScreen()&&a.getScreen().id==b||a.MD(b,function(c){X5(a,c)},function(){return a.ag()},5)):a.ag(Error("Waiting for session status timed out."))},hKa=function(a,b,c){a.info("onConnectedScreenData_: Received screenData: "+JSON.stringify(b));
var d=new z4(b);gKa(a,d,function(e){e?(a.ca=!0,U5(a.u,d),X5(a,d),a.W="unknown",$5(a,c)):(g.ro(Error("CastSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online.")),a.ag())},5)},cKa=function(a,b){g.wo(a.X);
a.X=0;b?a.ga.enableCastLoungeToken&&b.loungeToken?b.deviceId?a.getScreen()&&a.getScreen().uuid==b.deviceId||(b.loungeTokenRefreshIntervalMs?hKa(a,{name:a.i.friendlyName,screenId:b.screenId,loungeToken:b.loungeToken,dialId:b.deviceId,screenIdType:"shortLived"},b.loungeTokenRefreshIntervalMs):(g.ro(Error("No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: "+JSON.stringify(b)+".")),a6(a,b.screenId))):(g.ro(Error("No device id presents in mdxSessionStatusData: "+JSON.stringify(b)+".")),
a6(a,b.screenId)):a6(a,b.screenId):a.ag(Error("Waiting for session status timed out."))},fKa=function(a,b){g.wo(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,$5(a,3E4)):(bKa(a,b.loungeToken),a.ca=!1,a.W="unknown",$5(a,b.loungeTokenRefreshIntervalMs))},gKa=function(a,b,c,d){g.wo(a.I);
a.I=0;ZJa(a.u,b,function(e){e||0>d?c(e):a.I=g.uo(function(){gKa(a,b,c,d-1)},300)})},iKa=function(a){g.wo(a.L);
a.L=0;g.wo(a.I);a.I=0;g.wo(a.X);a.X=0;g.wo(a.C);a.C=0;g.wo(a.J);a.J=0},b6=function(a,b,c,d){W5.call(this,a,b,"DialSession");
this.ma=d;this.l=this.L=null;this.ea="";this.za=c;this.la=null;this.X=g.Ia;this.W=NaN;this.ga=(0,g.B)(this.PJ,this);this.C=g.Ia;this.J=this.I=0;this.Y=!1;this.ca="unknown"},c6=function(a){var b;
return!!(a.ma.enableDialLoungeToken&&(null==(b=a.l)?0:b.getDialAppInfo))},jKa=function(a){a.C=a.u.MB(a.ea,a.i.label,a.i.friendlyName,c6(a),function(b,c){a.C=g.Ia;
a.Y=!0;X5(a,b);"shortLived"==b.idType&&0<c&&d6(a,c)},function(b){a.C=g.Ia;
a.ag(b)})},kKa=function(a){var b={};
b.pairingCode=a.ea;b.theme=a.za;JIa()&&(b.env_useStageMdx=1);return g.Md(b)},e6=function(a){return new Promise(function(b){a.ea=D4();
if(a.la){var c=new chrome.cast.DialLaunchResponse(!0,kKa(a));b(c);jKa(a)}else a.X=function(){g.wo(a.W);a.X=function(){};
a.W=NaN;var d=new chrome.cast.DialLaunchResponse(!0,kKa(a));b(d);jKa(a)},a.W=g.uo(function(){a.X()},100)})},mKa=function(a,b,c){a.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(b));
var d=new z4(b);return(new Promise(function(e){lKa(a,d,function(f){f?(a.Y=!0,U5(a.u,d),X5(a,d),d6(a,c)):g.ro(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online."));e(f)},5)})).then(function(e){return e?new chrome.cast.DialLaunchResponse(!1):e6(a)})},nKa=function(a,b){var c=a.L.receiver.label,d=a.i.friendlyName;
return(new Promise(function(e){XJa(a.u,c,b,d,function(f){f&&f.token&&X5(a,f);e(f)},function(f){Y5(a,"Failed to get DIAL screen: "+f);
e(null)})})).then(function(e){return e&&e.token?new chrome.cast.DialLaunchResponse(!1):e6(a)})},lKa=function(a,b,c,d){g.wo(a.I);
a.I=0;ZJa(a.u,b,function(e){e||0>d?c(e):a.I=g.uo(function(){lKa(a,b,c,d-1)},300)})},d6=function(a,b){a.info("getDialAppInfoWithTimeout_ "+b);
c6(a)&&(g.wo(a.J),a.J=0,0==b?oKa(a):a.J=g.uo(function(){oKa(a)},b))},oKa=function(a){c6(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.ca=c,d6(a,3E4)):(a.Y=!1,a.ca="unknown",bKa(a,b.loungeToken),d6(a,b.loungeTokenRefreshIntervalMs))},function(b){a.info("getDialAppInfo error: "+b);
a.ca="noLoungeTokenResponse";d6(a,3E4)})},pKa=function(a){g.wo(a.I);
a.I=0;g.wo(a.J);a.J=0;a.C();a.C=function(){};
g.wo(a.W)},f6=function(a,b){W5.call(this,a,b,"ManualSession");
this.l=g.uo((0,g.B)(this.So,this,null),150)},g6=function(a,b){g.R.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.BO,this)},qKa=function(a,b){return b?g.cb(a.u,function(c){return A4(b,c.label)},a):null},h6=function(a){F5("Controller",a)},IJa=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},i6=function(a){return a.J||!!a.u.length||!!a.i},j6=function(a,b,c){b!=a.i&&(g.Ei(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.SF,a,b)),b.getScreen()?a.V("yt-remote-cast2-session-change",b.getScreen()):c&&a.i.So(null)):a.V("yt-remote-cast2-session-change",null))},rKa=function(a){var b=a.l.LB(),c=a.i&&a.i.i;
a=g.Qc(b,function(d){c&&A4(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=qKa(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},wKa=function(a,b,c,d){d.disableCastApi?k6("Cannot initialize because disabled by Mdx config."):sKa()?tKa(b,d)&&(l6(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?uKa(a,c):(window.__onGCastApiAvailable=function(e,f){e?uKa(a,c):(m6("Failed to load cast API: "+f),n6(!1),l6(!1),g.Fu("yt-remote-cast-available"),g.Fu("yt-remote-cast-receiver"),
vKa(),c(!1))},d.loadCastApiSetupScript?g.Go("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<=M4()&&QIa():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?O4():89<=M4()?SIa():(P4(),N4(RIa.map(NIa))))):k6("Cannot initialize because not running Chrome")},vKa=function(){k6("dispose");
var a=o6();a&&a.dispose();g.Da("yt.mdx.remote.cloudview.instance_",null,void 0);xKa(!1);g.Co(p6);p6.length=0},q6=function(){return!!g.Eu("yt-remote-cast-installed")},yKa=function(){var a=g.Eu("yt-remote-cast-receiver");
return a?a.friendlyName:null},zKa=function(){k6("clearCurrentReceiver");
g.Fu("yt-remote-cast-receiver")},AKa=function(){return q6()?o6()?o6().getCastSession():(m6("getCastSelector: Cast is not initialized."),null):(m6("getCastSelector: Cast API is not installed!"),null)},s6=function(){q6()?o6()?r6()?(k6("Requesting cast selector."),o6().requestSession()):(k6("Wait for cast API to be ready to request the session."),p6.push(g.Bo("yt-remote-cast2-api-ready",s6))):m6("requestCastSelector: Cast is not initialized."):m6("requestCastSelector: Cast API is not installed!")},t6=
function(a,b){r6()?o6().setConnectedScreenStatus(a,b):m6("setConnectedScreenStatus called before ready.")},sKa=function(){var a=0<=g.Wc.search(/ (CrMo|Chrome|CriOS)\//);
return g.DA||a},BKa=function(a,b){o6().init(a,b)},tKa=function(a,b){var c=!1;
o6()||(c=new g6(a,b),c.subscribe("yt-remote-cast2-availability-change",function(d){g.Du("yt-remote-cast-available",d);x4("yt-remote-cast2-availability-change",d)}),c.subscribe("yt-remote-cast2-receiver-selected",function(d){k6("onReceiverSelected: "+d.friendlyName);
g.Du("yt-remote-cast-receiver",d);x4("yt-remote-cast2-receiver-selected",d)}),c.subscribe("yt-remote-cast2-receiver-resumed",function(d){k6("onReceiverResumed: "+d.friendlyName);
g.Du("yt-remote-cast-receiver",d);x4("yt-remote-cast2-receiver-resumed",d)}),c.subscribe("yt-remote-cast2-session-change",function(d){k6("onSessionChange: "+B4(d));
d||g.Fu("yt-remote-cast-receiver");x4("yt-remote-cast2-session-change",d)}),g.Da("yt.mdx.remote.cloudview.instance_",c,void 0),c=!0);
k6("cloudview.createSingleton_: "+c);return c},o6=function(){return g.Ha("yt.mdx.remote.cloudview.instance_")},uKa=function(a,b){n6(!0);
l6(!1);BKa(a,function(c){c?(xKa(!0),g.Do("yt-remote-cast2-api-ready")):(m6("Failed to initialize cast API."),n6(!1),g.Fu("yt-remote-cast-available"),g.Fu("yt-remote-cast-receiver"),vKa());b(c)})},k6=function(a){F5("cloudview",a)},m6=function(a){F5("cloudview",a)},n6=function(a){k6("setCastInstalled_ "+a);
g.Du("yt-remote-cast-installed",a)},r6=function(){return!!g.Ha("yt.mdx.remote.cloudview.apiReady_")},xKa=function(a){k6("setApiReady_ "+a);
g.Da("yt.mdx.remote.cloudview.apiReady_",a,void 0)},l6=function(a){g.Da("yt.mdx.remote.cloudview.initializing_",a,void 0)},u6=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.J=this.L=0;this.i=null;this.hasNext=this.Wi=!1;this.W=this.I=this.l=this.C=0;this.B=NaN;this.u=!1;this.reset(a)},v6=function(a){a.audioTrackId=null;
a.i=null;a.playerState=-1;a.Wi=!1;a.hasNext=!1;a.L=0;a.J=g.Sa();a.C=0;a.l=0;a.I=0;a.W=0;a.B=NaN;a.u=!1},w6=function(a){return a.Kb()?(g.Sa()-a.J)/1E3:0},x6=function(a,b){a.L=b;
a.J=g.Sa()},y6=function(a){switch(a.playerState){case 1:case 1081:return(g.Sa()-a.J)/1E3+a.L;
case -1E3:return 0}return a.L},z6=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&v6(a)},A6=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.Wb(a.i);b.hasPrevious=a.Wi;b.hasNext=a.hasNext;b.playerTime=a.L;b.playerTimeAt=a.J;b.seekableStart=a.C;b.seekableEnd=a.l;b.duration=a.I;b.loadedTime=a.W;b.liveIngestionTime=a.B;return b},C6=function(a,b){g.R.call(this);
this.Ma=0;this.u=a;this.C=[];this.B=new EJa;this.l=this.i=null;this.L=(0,g.B)(this.dN,this);this.I=(0,g.B)(this.Ar,this);this.J=(0,g.B)(this.cN,this);this.W=(0,g.B)(this.kN,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.Zz,this),CKa(this))):c=3;0!=c&&(b?this.Zz(c):g.uo((0,g.B)(function(){this.Zz(c)},this),0));
var d=AKa();d&&B6(this,d);this.subscribe("yt-remote-cast2-session-change",this.W)},D6=function(a){return new u6(a.u.getPlayerContextData())},CKa=function(a){g.Ab("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(b){this.C.push(this.u.subscribe(b,g.Qa(this.yO,b),this))},a)},DKa=function(a){g.Ab(a.C,function(b){this.u.unsubscribeByKey(b)},a);
a.C.length=0},E6=function(a){return 1==a.getState()},F6=function(a,b){var c=a.B;
50>c.i.length+c.l.length&&a.B.l.push(b)},H6=function(a,b,c){var d=D6(a);
x6(d,c);-1E3!=d.playerState&&(d.playerState=b);G6(a,d)},I6=function(a,b,c){a.u.sendMessage(b,c)},G6=function(a,b){DKa(a);
a.u.setPlayerContextData(A6(b));CKa(a)},B6=function(a,b){a.l&&(a.l.removeUpdateListener(a.L),a.l.removeMediaListener(a.I),a.Ar(null));
a.l=b;a.l&&(F5("CP","Setting cast session: "+a.l.sessionId),a.l.addUpdateListener(a.L),a.l.addMediaListener(a.I),a.l.media.length&&a.Ar(a.l.media[0]))},EKa=function(a){var b=a.i.media,c=a.i.customData;
if(b&&c){var d=D6(a);b.contentId!=d.videoId&&F5("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;x6(d,a.i.getEstimatedTime());G6(a,d)}else F5("CP","No cast media video. Ignoring state update.")},J6=function(a,b,c){return(0,g.B)(function(d){this.Gd("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Gd("Retrying "+b+" using MDx browser channel."),I6(this,b,c))},a)},K6=function(a,b,c){g.R.call(this);
this.C=NaN;this.ca=!1;this.L=this.J=this.X=this.Y=NaN;this.W=[];this.B=this.I=this.u=this.Fb=this.i=null;this.ia=a;this.W.push(g.Wo(window,"beforeunload",(0,g.B)(this.pL,this)));this.l=[];this.Fb=new u6;this.ga=b.id;this.ea=b.idType;this.i=FKa(this,c);this.i.subscribe("handlerOpened",this.hN,this);this.i.subscribe("handlerClosed",this.eN,this);this.i.subscribe("handlerError",this.fN,this);this.i.subscribe("handlerMessage",this.gN,this);this.i.av(b.token);this.subscribe("remoteQueueChange",function(){var d=
this.Fb.videoId;g.Gu()&&g.Du("yt-remote-session-video-id",d)},this)},L6=function(a){F5("conn",a)},FKa=function(a,b){return new y5(C5(a.ia,"/bc"),b,!1,function(){return a.QB()},"shortLived"==a.ea)},M6=function(a,b){a.V("proxyStateChange",b)},GKa=function(a){a.C=g.uo((0,g.B)(function(){L6("Connecting timeout");
this.uo(1)},a),2E4)},N6=function(a){g.wo(a.C);
a.C=NaN},O6=function(a){g.wo(a.Y);
a.Y=NaN},HKa=function(a){P6(a);
a.X=g.uo((0,g.B)(function(){Q6(this,"getNowPlaying")},a),2E4)},P6=function(a){g.wo(a.X);
a.X=NaN},JKa=function(a,b){b&&(N6(a),O6(a));
var c=A5(a.i)&&isNaN(a.C);b==c?b&&(M6(a,1),Q6(a,"getSubtitlesTrack")):b?(a.LD()&&a.Fb.reset(),M6(a,1),Q6(a,"getNowPlaying"),IKa(a)):a.uo(1)},KKa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.Fb.videoId&&(g.Pb(b.params)?a.Fb.i=null:a.Fb.i=b.params,a.V("remotePlayerChange"))},LKa=function(a,b){var c=b.params.videoId||b.params.video_id,d=parseInt(b.params.currentIndex,10);
a.Fb.listId=b.params.listId||a.Fb.listId;z6(a.Fb,c,d);a.V("remoteQueueChange")},NKa=function(a,b){b.params=b.params||{};
LKa(a,b);MKa(a,b);a.V("autoplayDismissed")},MKa=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
x6(a.Fb,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.Fb.playerState&&(c=-1E3);a.Fb.playerState=c;c=Number(b.params.loadedTime);a.Fb.W=isNaN(c)?0:c;c=Number(b.params.duration);a.Fb.I=isNaN(c)?0:c;c=a.Fb;var d=Number(b.params.liveIngestionTime);c.B=d;c.u=isNaN(d)?!1:!0;c=a.Fb;d=Number(b.params.seekableStartTime);var e=Number(b.params.seekableEndTime);c.C=isNaN(d)?0:d;c.l=isNaN(e)?0:e;1==a.Fb.playerState?HKa(a):P6(a);a.V("remotePlayerChange")},OKa=function(a,b){if(-1E3!=
a.Fb.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.Fb.playerState=c;c=parseInt(b.params.currentTime,10);x6(a.Fb,isNaN(c)?0:c);a.V("remotePlayerChange")}},PKa=function(a,b){var c="true"==b.params.muted;
a.Fb.volume=parseInt(b.params.volume,10);a.Fb.muted=c;a.V("remotePlayerChange")},QKa=function(a,b){a.I=b.params.videoId;
a.V("nowAutoplaying",parseInt(b.params.timeout,10))},RKa=function(a,b){var c="true"==b.params.hasNext;
a.Fb.Wi="true"==b.params.hasPrevious;a.Fb.hasNext=c;a.V("previousNextChange")},IKa=function(a){g.wo(a.L);
a.L=g.uo((0,g.B)(a.uo,a,1),864E5)},Q6=function(a,b,c){c?L6("Sending: action="+b+", params="+g.Dj(c)):L6("Sending: action="+b);
a.i.sendMessage(b,c)},R6=function(a){J5.call(this,"ScreenServiceProxy");
this.Gf=a;this.i=[];this.i.push(this.Gf.$_s("screenChange",(0,g.B)(this.TJ,this)));this.i.push(this.Gf.$_s("onlineScreenChange",(0,g.B)(this.fO,this)))},VKa=function(a,b){IIa();
if(!L4||!L4.get("yt-remote-disable-remote-module-for-dev")){b=g.P("MDX_CONFIG")||b;AIa();J4();S6||(S6=new B5(b?b.loungeApiHost:void 0),JIa()&&(S6.i="/api/loungedev"));T6||(T6=g.Ha("yt.mdx.remote.deferredProxies_")||[],g.Da("yt.mdx.remote.deferredProxies_",T6,void 0));SKa();var c=U6();if(!c){var d=new T5(S6);g.Da("yt.mdx.remote.screenService_",d,void 0);c=U6();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});wKa(a,d,function(h){h?V6()&&t6(V6(),"YouTube TV"):d.subscribe("onlineScreenChange",function(){x4("yt-remote-receiver-availability-change")})},e)}if(b&&!g.Ha("yt.mdx.remote.initialized_")){g.Da("yt.mdx.remote.initialized_",!0,void 0);
W6("Initializing: "+g.Dj(b));X6.push(g.Bo("yt-remote-cast2-availability-change",function(){x4("yt-remote-receiver-availability-change")}));
X6.push(g.Bo("yt-remote-cast2-receiver-selected",function(){Y6(null);x4("yt-remote-auto-connect","cast-selector-receiver")}));
X6.push(g.Bo("yt-remote-cast2-receiver-resumed",function(){x4("yt-remote-receiver-resumed","cast-selector-receiver")}));
X6.push(g.Bo("yt-remote-cast2-session-change",TKa));X6.push(g.Bo("yt-remote-connection-change",function(h){h?t6(V6(),"YouTube TV"):Z6()||(t6(null,null),zKa())}));
e=$6();b.isAuto&&(e.id+="#dial");g.Ko("desktop_enable_autoplay")&&(e.capabilities=["atp"]);e.name=b.device;e.app=b.app;var f=b.theme;f&&(e.theme=f);W6(" -- with channel params: "+g.Dj(e));e?(g.Du("yt-remote-session-app",e.app),g.Du("yt-remote-session-name",e.name)):(g.Fu("yt-remote-session-app"),g.Fu("yt-remote-session-name"));g.Da("yt.mdx.remote.channelParams_",e,void 0);c.start();V6()||UKa()}}},WKa=function(){var a=U6().Gf.$_gos();
var b=a7();b&&b7()&&(E4(a,b)||a.push(b));return zIa(a)},c7=function(){var a=XKa();
!a&&q6()&&yKa()&&(a={key:"cast-selector-receiver",name:yKa()});return a},XKa=function(){var a=WKa(),b=a7();
b||(b=Z6());return g.cb(a,function(c){return b&&A4(b,c.key)?!0:!1})},a7=function(){var a=V6();
if(!a)return null;var b=U6().Kg();return F4(b,a)},TKa=function(a){W6("remote.onCastSessionChange_: "+B4(a));
if(a){var b=a7();if(b&&b.id==a.id){if(t6(b.id,"YouTube TV"),"shortLived"==a.idType&&(a=a.token))d7&&(d7.token=a),(b=b7())&&b.av(a)}else b&&e7(),f7(a,1)}else b7()&&e7()},e7=function(){r6()?o6().stopSession():m6("stopSession called before API ready.");
var a=b7();a&&(a.disconnect(1),g7(null))},h7=function(){var a=b7();
return!!a&&3!=a.getProxyState()},W6=function(a){F5("remote",a)},U6=function(){if(!i7){var a=g.Ha("yt.mdx.remote.screenService_");
i7=a?new R6(a):null}return i7},V6=function(){return g.Ha("yt.mdx.remote.currentScreenId_")},YKa=function(a){g.Da("yt.mdx.remote.currentScreenId_",a,void 0)},ZKa=function(){return g.Ha("yt.mdx.remote.connectData_")},Y6=function(a){g.Da("yt.mdx.remote.connectData_",a,void 0)},b7=function(){return g.Ha("yt.mdx.remote.connection_")},g7=function(a){var b=b7();
Y6(null);a||YKa("");g.Da("yt.mdx.remote.connection_",a,void 0);T6&&(g.Ab(T6,function(c){c(a)}),T6.length=0);
b&&!a?x4("yt-remote-connection-change",!1):!b&&a&&x4("yt-remote-connection-change",!0)},Z6=function(){var a=g.Gu();
if(!a)return null;var b=U6();if(!b)return null;b=b.Kg();return F4(b,a)},f7=function(a,b){V6();
a7()&&a7();if(j7)d7=a;else{YKa(a.id);var c=new K6(S6,a,$6());c.connect(b,ZKa());c.subscribe("beforeDisconnect",function(d){x4("yt-remote-before-disconnect",d)});
c.subscribe("beforeDispose",function(){b7()&&(b7(),g7(null))});
c.subscribe("browserChannelAuthError",function(){var d=a7();d&&"shortLived"==d.idType&&(r6()?o6().handleBrowserChannelAuthError():m6("refreshLoungeToken called before API ready."))});
g7(c)}},UKa=function(){var a=Z6();
a?(W6("Resume connection to: "+B4(a)),f7(a,0)):(K4(),zKa(),W6("Skipping connecting because no session screen found."))},SKa=function(){var a=$6();
if(g.Pb(a)){a=I4();var b=g.Eu("yt-remote-session-name")||"",c=g.Eu("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.Da("yt.mdx.remote.channelParams_",a,void 0)}},$6=function(){return g.Ha("yt.mdx.remote.channelParams_")||{}},k7=function(a,b,c){g.E.call(this);
var d=this;this.l=a;this.G=b;this.wb=c;this.events=new g.XM(this);this.X=this.events.N(this.G,"onVolumeChange",function(e){$Ka(d,e)});
this.C=!1;this.suggestion=null;this.I=new g.bK(64);this.i=new g.M(this.VG,500,this);this.u=new g.M(this.WG,1E3,this);this.L=new Q4(this.XQ,0,this);this.B={};this.W=new g.M(this.xH,1E3,this);this.J=new R4(this.seekTo,1E3,this);this.Y=g.Ia;g.I(this,this.events);this.events.N(b,"onCaptionsTrackListChanged",this.ON);this.events.N(b,"captionschanged",this.aN);this.events.N(b,"captionssettingschanged",this.bH);this.events.N(b,"videoplayerreset",this.Ku);this.events.N(b,"mdxautoplaycancel",function(){d.wb.fD()});
a=this.wb;a.na();a.subscribe("proxyStateChange",this.NF,this);a.subscribe("remotePlayerChange",this.Gr,this);a.subscribe("remoteQueueChange",this.Ku,this);a.subscribe("previousNextChange",this.KF,this);a.subscribe("nowAutoplaying",this.FF,this);a.subscribe("autoplayDismissed",this.fF,this);g.I(this,this.i);g.I(this,this.u);g.I(this,this.L);g.I(this,this.W);g.I(this,this.J);this.bH();this.Ku();this.Gr()},$Ka=function(a,b){if(l7(a)){a.wb.unsubscribe("remotePlayerChange",a.Gr,a);
var c=Math.round(b.volume),d=!!b.muted,e=D6(a.wb);if(c!==e.volume||d!==e.muted)a.wb.setVolume(c,d),a.W.start();a.wb.subscribe("remotePlayerChange",a.Gr,a)}},aLa=function(a){a.Ab(0);
a.i.stop();a.tb(new g.bK(64))},m7=function(a,b){if(l7(a)&&!a.C){var c=null;
b&&(c={style:a.G.getSubtitlesUserSettings()},g.Yb(c,b));a.wb.PB(a.G.getVideoData(1).videoId,c);a.B=D6(a.wb).i}},n7=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.wb.playVideo(c.videoId,b,d,e,c.playerParams,c.ia,mIa(c));a.tb(new g.bK(1))},bLa=function(a,b){if(b){var c=a.G.getOption("captions","tracklist",{eE: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",{})},l7=function(a){return D6(a.wb).videoId===a.G.getVideoData(1).videoId},o7=function(){g.X.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",ba:"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",ka:["ytp-button","ytp-mdx-manual-pairing-popup-learn-more"],ba:"Learn more"},{D:"button",ka:["ytp-button","ytp-mdx-manual-pairing-popup-ok"],ba:"OK"}]}]}]});this.i=new g.LL(this,250);this.learnMoreButton=
this.ha("ytp-mdx-manual-pairing-popup-learn-more");this.okButton=this.ha("ytp-mdx-manual-pairing-popup-ok");g.I(this,this.i);this.N(this.learnMoreButton,"click",this.l);this.N(this.okButton,"click",this.u)},p7=function(){g.X.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",ba:"You're signed out"},{D:"div",K:"ytp-mdx-popup-description",ba:"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",ka:["ytp-button","ytp-mdx-privacy-popup-cancel"],ba:"Cancel"},{D:"button",ka:["ytp-button",
"ytp-mdx-privacy-popup-confirm"],ba:"Confirm"}]}]}]});this.i=new g.LL(this,250);this.cancelButton=this.ha("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.ha("ytp-mdx-privacy-popup-confirm");g.I(this,this.i);this.N(this.cancelButton,"click",this.l);this.N(this.confirmButton,"click",this.u)},q7=function(a){g.X.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.tma()]},{D:"div",K:"ytp-remote-display-status-text",ba:"{{statustext}}"}]}]});this.api=a;this.i=new g.LL(this,250);g.I(this,this.i);this.N(a,"presentingplayerstatechange",this.l);cLa(this,a.Xa())},cLa=function(a,b){if(3===a.api.getPresentingPlayerType()){var c={RECEIVER_NAME:a.api.getOption("remote","currentReceiver").name};
c=g.W(b,128)?g.AJ("Error on $RECEIVER_NAME",c):b.Kb()||g.W(b,4)?g.AJ("Playing on $RECEIVER_NAME",c):g.AJ("Connected to $RECEIVER_NAME",c);a.Ba("statustext",c);a.i.show()}else a.i.hide()},r7=function(a,b){g.PP.call(this,"Play on",0,a,b);
this.G=a;this.Ml={};this.N(a,"onMdxReceiversChange",this.C);this.N(a,"presentingplayerstatechange",this.C);this.C()},s7=function(a){g.eN.call(this,a);
this.Zh={key:D4(),name:"This computer"};this.hh=null;this.subscriptions=[];this.Az=this.wb=null;this.Ml=[this.Zh];this.Wk=this.Zh;this.Mc=new g.bK(64);this.zE=0;this.Me=-1;this.Wo=null;this.Jr=this.ou=!1;this.Bn=this.mp=null;if(!g.XF(this.player.T())){a=this.player;var b=g.LM(a);b&&(b=b.dn())&&(b=new r7(a,b),g.I(this,b));b=new q7(a);g.I(this,b);g.VM(a,b.element,4);this.mp=new p7;g.I(this,this.mp);g.VM(a,this.mp.element,4);g.U(this.player.T().experiments,"pair_servlet_deprecation_warning_enabled")&&
!g.U(this.player.T().experiments,"deprecate_pair_servlet_enabled")&&(this.Wo=new o7,g.I(this,this.Wo),g.VM(a,this.Wo.element,4));this.Jr=!!Z6();this.ou=!!g.Eu("yt-remote-manual-pairing-warning-shown")}},t7=function(a){a.Bn&&(a.player.removeEventListener("presentingplayerstatechange",a.Bn),a.Bn=null)},dLa=function(a,b,c){a.Mc=c;
a.player.V("presentingplayerstatechange",new g.gJ(c,b))},eLa=function(a,b,c){var d=!1;
1===b?d=!a.Jr:2===b&&(d=!a.ou);d&&g.iJ(c,8)&&(a.player.pauseVideo(),t7(a))},u7=function(a,b){if(b.key!==a.Wk.key)if(b.key===a.Zh.key)e7();
else{if(a.Wo&&!a.ou&&b!==a.Zh&&"cast-selector-receiver"!==b.key&&g.qG(a.player.T()))fLa(a);else{var c;(c=!g.U(a.player.T().experiments,"mdx_enable_privacy_disclosure_ui"))||(c=((c=g.P("PLAYER_CONFIG"))&&c.args&&void 0!==c.args.authuser?!0:!(!g.P("SESSION_INDEX")&&!g.P("LOGGED_IN")))||a.Jr||!a.mp);(c?0:g.qG(a.player.T())||g.uG(a.player.T()))&&gLa(a)}a.Wk=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.U(a.player.T().experiments,"should_clear_video_data_on_player_cued_unstarted"))c=null;else{var f=a.player.getPlaylist();if(f){var h=[];for(var l=0;l<f.length;l++)h[l]=f.Na(l).videoId}else h=[e];f=a.player.getCurrentTime(1);d={videoIds:h,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.ia,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0===f?void 0:f};(c=mIa(c))&&(d.locationInfo=c);c=d}W6("Connecting to: "+g.Dj(b));"cast-selector-receiver"==b.key?(Y6(c||null),c=c||null,
r6()?o6().setLaunchParams(c):m6("setLaunchParams called before ready.")):!c&&h7()&&V6()==b.key?x4("yt-remote-connection-change",!0):(e7(),Y6(c||null),c=U6().Kg(),(c=F4(c,b.key))&&f7(c,1))}},gLa=function(a){a.player.Xa().Kb()?a.player.pauseVideo():(a.Bn=function(b){eLa(a,1,b)},a.player.addEventListener("presentingplayerstatechange",a.Bn));
a.mp&&a.mp.Dc();b7()||(j7=!0)},fLa=function(a){a.player.Xa().Kb()?a.player.pauseVideo():(a.Bn=function(b){eLa(a,2,b)},a.player.addEventListener("presentingplayerstatechange",a.Bn));
a.Wo&&a.Wo.Dc();b7()||(j7=!0)},bJa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},f5={"'":"\\'"},hLa={},vIa={WR:"atp",l1:"ska",g0:"que",xZ:"mus",k1:"sus",OV:"dsp",z0:"seq",bZ:"mic",OU:"dpa"},L4,H4="",PIa=KIa("loadCastFramework")||KIa("loadCastApplicationFramework"),RIa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
g.Ta(Q4,g.E);g.k=Q4.prototype;g.k.mg=function(a){this.B=arguments;this.i=!1;this.gb?this.u=g.Sa()+this.Hf:this.gb=g.Gm(this.C,this.Hf)};
g.k.stop=function(){this.gb&&(g.A.clearTimeout(this.gb),this.gb=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.da=function(){this.stop();Q4.Ed.da.call(this)};
g.k.JJ=function(){this.u?(this.gb=g.Gm(this.C,this.u-g.Sa()),this.u=null):(this.gb=null,this.l?this.i=!0:(this.i=!1,this.I.apply(null,this.B)))};g.u(R4,g.E);g.k=R4.prototype;g.k.mg=function(a){this.u=arguments;this.gb||this.l?this.i=!0:S4(this)};
g.k.stop=function(){this.gb&&(g.A.clearTimeout(this.gb),this.gb=null,this.i=!1,this.u=null)};
g.k.pause=function(){this.l++};
g.k.resume=function(){this.l--;this.l||!this.i||this.gb||(this.i=!1,S4(this))};
g.k.da=function(){g.E.prototype.da.call(this);this.stop()};U4.prototype.stringify=function(a){return g.A.JSON.stringify(a,void 0)};
U4.prototype.parse=function(a){return g.A.JSON.parse(a,void 0)};var W4=new g.Wl;g.u(TIa,g.Cl);Y4.prototype.i=null;Y4.prototype.getOptions=function(){var a;(a=this.i)||(a={},VIa(this)&&(a[0]=!0,a[1]=!0),a=this.i=a);return a};var v7;g.Ta(UIa,Y4);v7=new UIa;g.k=Z4.prototype;g.k.im=null;g.k.ti=!1;g.k.Ip=null;g.k.LA=null;g.k.pp=null;g.k.Cp=null;g.k.Qk=null;g.k.Pl=null;g.k.Cn=null;g.k.Be=null;g.k.Ds=0;g.k.yi=null;g.k.Dv=null;g.k.Kk=null;g.k.Zp=-1;g.k.LG=!0;g.k.Lm=!1;g.k.ww=0;g.k.Qu=null;var $Ia={},b5={};g.k=Z4.prototype;g.k.setTimeout=function(a){this.C=a};
g.k.YP=function(a){a=a.target;var b=this.Qu;b&&3==k5(a)?b.mg():this.HH(a)};
g.k.HH=function(a){try{if(a==this.Be)a:{var b=k5(this.Be),c=this.Be.I,d=this.Be.getStatus();if(g.Be&&!g.de(10)||g.De&&!g.ce("420+")){if(4>b)break a}else if(3>b||3==b&&!g.pg&&!m5(this.Be))break a;this.Lm||4!=b||7==c||(8==c||0>=d?this.i.ci(3):this.i.ci(2));g5(this);var e=this.Be.getStatus();this.Zp=e;var f=m5(this.Be);(this.ti=200==e)?(4==b&&d5(this),this.I?(aJa(this,b,f),g.pg&&this.ti&&3==b&&(this.B.ya(this.u,"tick",this.RP),this.u.start())):c5(this,f),this.ti&&!this.Lm&&(4==b?this.i.Ts(this):(this.ti=
!1,a5(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.Kk=3,X4(13)):(this.Kk=0,X4(14)),d5(this),e5(this))}}catch(h){this.Be&&m5(this.Be)}finally{}};
g.k.RP=function(){var a=k5(this.Be),b=m5(this.Be);this.Ds<b.length&&(g5(this),aJa(this,a,b),this.ti&&4!=a&&a5(this))};
g.k.tP=function(a){V4((0,g.B)(this.sP,this,a),0)};
g.k.sP=function(a){this.Lm||(g5(this),c5(this,a),a5(this))};
g.k.XF=function(a){V4((0,g.B)(this.rP,this,a),0)};
g.k.rP=function(a){this.Lm||(d5(this),this.ti=a,this.i.Ts(this),this.i.ci(4))};
g.k.cancel=function(){this.Lm=!0;d5(this)};
g.k.BP=function(){this.Ip=null;var a=g.Sa();0<=a-this.LA?(2!=this.Cp&&this.i.ci(3),d5(this),this.Kk=2,X4(18),e5(this)):dJa(this,this.LA-a)};
g.k.getLastError=function(){return this.Kk};g.Ta(i5,g.Wl);var kJa=/^https?$/i,iLa=["POST","PUT"];g.k=i5.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.za=b;this.ga=!1;this.B=!0;this.i=this.ea?WIa(this.ea):WIa(v7);this.ca=this.ea?this.ea.getOptions():v7.getOptions();this.i.onreadystatechange=(0,g.B)(this.LF,this);try{w4(l5(this,"Opening Xhr")),this.la=!0,this.i.open(b,String(a),!0),this.la=!1}catch(f){w4(l5(this,"Error opening Xhr: "+f.message));jJa(this,f);return}a=
c||"";var e=this.headers.clone();d&&rIa(d,function(f,h){e.set(h,f)});
d=g.cb(e.nh(),hJa);c=g.A.FormData&&a instanceof g.A.FormData;!g.fb(iLa,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.Ca&&(this.i.responseType=this.Ca);"withCredentials"in this.i&&this.i.withCredentials!==this.ia&&(this.i.withCredentials=this.ia);try{mJa(this),0<this.J&&(this.Y=gJa(this.i),w4(l5(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.JB,this)):this.X=g.Gm(this.JB,this.J,this)),w4(l5(this,"Sending request")),this.L=!0,this.i.send(a),this.L=!1}catch(f){w4(l5(this,"Send error: "+f.message)),jJa(this,f)}};
g.k.JB=function(){"undefined"!=typeof g.z_&&this.i&&(this.u="Timed out after "+this.J+"ms, aborting",this.I=8,l5(this,this.u),this.dispatchEvent("timeout"),this.abort(8))};
g.k.abort=function(a){this.i&&this.B&&(l5(this,"Aborting"),this.B=!1,this.C=!0,this.i.abort(),this.C=!1,this.I=a||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),j5(this))};
g.k.da=function(){this.i&&(this.B&&(this.B=!1,this.C=!0,this.i.abort(),this.C=!1),j5(this,!0));i5.Ed.da.call(this)};
g.k.LF=function(){this.na()||(this.la||this.L||this.C?lJa(this):this.AO())};
g.k.AO=function(){lJa(this)};
g.k.isActive=function(){return!!this.i};
g.k.isComplete=function(){return 4==k5(this)};
g.k.getStatus=function(){try{return 2<k5(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=nJa.prototype;g.k.xw=null;g.k.zg=null;g.k.Ru=!1;g.k.XG=null;g.k.xt=null;g.k.Qy=null;g.k.yw=null;g.k.Ma=null;g.k.Kj=-1;g.k.aq=null;g.k.kq=null;g.k.connect=function(a){this.yw=a;a=n5(this.i,null,this.yw);X4(3);this.XG=g.Sa();var b=this.i.J;null!=b?(this.aq=b[0],(this.kq=b[1])?(this.Ma=1,oJa(this)):(this.Ma=2,p5(this))):(u4(a,"MODE","init"),this.zg=new Z4(this,void 0,void 0,void 0),this.zg.im=this.xw,$4(this.zg,a,!1,null,!0),this.Ma=0)};
g.k.AK=function(a){if(a)this.Ma=2,p5(this);else{X4(4);var b=this.i;b.Fi=b.Uk.Kj;w5(b,9)}a&&this.ci(2)};
g.k.zx=function(a){return this.i.zx(a)};
g.k.abort=function(){this.zg&&(this.zg.cancel(),this.zg=null);this.Kj=-1};
g.k.KB=function(){return!1};
g.k.OF=function(a,b){this.Kj=a.Zp;if(0==this.Ma)if(b){try{var c=this.l.parse(b)}catch(d){c=this.i;c.Fi=this.Kj;w5(c,2);return}this.aq=c[0];this.kq=c[1]}else c=this.i,c.Fi=this.Kj,w5(c,2);else if(2==this.Ma)if(this.Ru)X4(7),this.Qy=g.Sa();else if("11111"==b){if(X4(6),this.Ru=!0,this.xt=g.Sa(),c=this.xt-this.XG,!g.Be||g.de(10)||500>c)this.Kj=200,this.zg.cancel(),X4(12),o5(this.i,this,!0)}else X4(8),this.xt=this.Qy=g.Sa(),this.Ru=!1};
g.k.Ts=function(){this.Kj=this.zg.Zp;if(this.zg.ti)0==this.Ma?this.kq?(this.Ma=1,oJa(this)):(this.Ma=2,p5(this)):2==this.Ma&&((!g.Be||g.de(10)?!this.Ru:200>this.Qy-this.xt)?(X4(11),o5(this.i,this,!1)):(X4(12),o5(this.i,this,!0)));else{0==this.Ma?X4(9):2==this.Ma&&X4(10);var a=this.i;this.zg.getLastError();a.Fi=this.Kj;w5(a,2)}};
g.k.Yr=function(){return this.i.Yr()};
g.k.isActive=function(){return this.i.isActive()};
g.k.ci=function(a){this.i.ci(a)};g.k=q5.prototype;g.k.Ei=null;g.k.Eq=null;g.k.ng=null;g.k.Wd=null;g.k.zw=null;g.k.zt=null;g.k.yC=null;g.k.Us=null;g.k.yr=0;g.k.sM=0;g.k.zf=null;g.k.fl=null;g.k.Oj=null;g.k.Tm=null;g.k.Uk=null;g.k.Bv=null;g.k.Ro=-1;g.k.yE=-1;g.k.Fi=-1;g.k.yo=0;g.k.fo=0;g.k.Mm=8;g.Ta(qJa,g.Cl);g.Ta(rJa,g.Cl);g.k=q5.prototype;g.k.connect=function(a,b,c,d,e){X4(0);this.zw=b;this.Eq=c||{};d&&void 0!==e&&(this.Eq.OSID=d,this.Eq.OAID=e);this.C?(V4((0,g.B)(this.RC,this,a),100),vJa(this)):this.RC(a)};
g.k.RC=function(a){this.Uk=new nJa(this);this.Uk.xw=this.Ei;this.Uk.l=this.B;this.Uk.connect(a)};
g.k.KB=function(){return 0==this.Ma};
g.k.getState=function(){return this.Ma};
g.k.VF=function(a){this.fl=null;zJa(this,a)};
g.k.UF=function(){this.Oj=null;this.Wd=new Z4(this,this.l,"rpc",this.I);this.Wd.im=this.Ei;this.Wd.ww=0;var a=this.yC.clone();s4(a,"RID","rpc");s4(a,"SID",this.l);s4(a,"CI",this.Bv?"0":"1");s4(a,"AID",this.Ro);r5(this,a);if(!g.Be||g.de(10))s4(a,"TYPE","xmlhttp"),$4(this.Wd,a,!0,this.Us,!1);else{s4(a,"TYPE","html");var b=this.Wd,c=!!this.Us;b.Cp=3;b.Qk=t4(a.clone());cJa(b,c)}};
g.k.OF=function(a,b){if(0!=this.Ma&&(this.Wd==a||this.ng==a))if(this.Fi=a.Zp,this.ng==a&&3==this.Ma)if(7<this.Mm){try{var c=this.B.parse(b)}catch(f){c=null}if(Array.isArray(c)&&3==c.length)if(0==c[0])a:{if(!this.Oj){if(this.Wd)if(this.Wd.pp+3E3<this.ng.pp)t5(this),this.Wd.cancel(),this.Wd=null;else break a;v5(this);X4(19)}}else this.yE=c[1],0<this.yE-this.Ro&&37500>c[2]&&this.Bv&&0==this.fo&&!this.Tm&&(this.Tm=V4((0,g.B)(this.WM,this),6E3));else w5(this,11)}else b!=hLa.CU.i&&w5(this,11);else if(this.Wd==
a&&t5(this),!g.rc(b)){c=this.B.parse(b);for(var d=0;d<c.length;d++){var e=c[d];this.Ro=e[0];e=e[1];2==this.Ma?"c"==e[0]?(this.l=e[1],this.Us=e[2],e=e[3],null!=e?this.Mm=e:this.Mm=6,this.Ma=3,this.zf&&this.zf.NC(),this.yC=n5(this,this.Yr()?this.Us:null,this.zw),AJa(this)):"stop"==e[0]&&w5(this,7):3==this.Ma&&("stop"==e[0]?w5(this,7):"noop"!=e[0]&&this.zf&&this.zf.MC(e),this.fo=0)}}};
g.k.WM=function(){null!=this.Tm&&(this.Tm=null,this.Wd.cancel(),this.Wd=null,v5(this),X4(20))};
g.k.Ts=function(a){if(this.Wd==a){t5(this);this.Wd=null;var b=2}else if(this.ng==a)this.ng=null,b=1;else return;this.Fi=a.Zp;if(0!=this.Ma)if(a.ti)1==b?(b=W4,b.dispatchEvent(new qJa(b,a.Cn?a.Cn.length:0,g.Sa()-a.pp,this.yo)),s5(this),this.u.length=0):AJa(this);else{var c=a.getLastError(),d;if(!(d=3==c||7==c||0==c&&0<this.Fi)){if(d=1==b)this.ng||this.fl||1==this.Ma||2<=this.yo?d=!1:(this.fl=V4((0,g.B)(this.VF,this,a),BJa(this,this.yo)),this.yo++,d=!0);d=!(d||2==b&&v5(this))}if(d)switch(c){case 1:w5(this,
5);break;case 4:w5(this,10);break;case 3:w5(this,6);break;case 7:w5(this,12);break;default:w5(this,2)}}};
g.k.UK=function(a){if(!g.fb(arguments,this.Ma))throw Error("Unexpected channel state: "+this.Ma);};
g.k.GQ=function(a){a?X4(2):(X4(1),CJa(this,8))};
g.k.zx=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new i5;a.ia=!1;return a};
g.k.isActive=function(){return!!this.zf&&this.zf.isActive(this)};
g.k.ci=function(a){var b=W4;b.dispatchEvent(new rJa(b,a))};
g.k.Yr=function(){return!(!g.Be||g.de(10))};
g.k=DJa.prototype;g.k.NC=function(){};
g.k.MC=function(){};
g.k.LC=function(){};
g.k.ix=function(){};
g.k.vD=function(){return{}};
g.k.isActive=function(){return!0};g.k=EJa.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.ICa)(b,a);0<=c?(g.jb(b,c),b=!0):b=!1;return b||g.kb(this.l,a)};
g.k.qg=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.Ta(x5,g.E);g.k=x5.prototype;g.k.lP=function(){this.Hf=Math.min(3E5,2*this.Hf);this.u();this.l&&this.start()};
g.k.start=function(){var a=this.Hf+15E3*Math.random();g.en(this.i,a);this.l=g.Sa()+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.Hf=5E3};g.Ta(y5,DJa);g.k=y5.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.Nf=function(a){return this.u.Nf(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.Ei(this.u),HJa(this),g.Ei(this.l),this.l=null,this.Y=function(){return""})};
g.k.na=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.ca+"/test";b=this.ca+"/bind";var d=new q5(c?c.firstTestResults:null,c?c.secondTestResults:null,this.ea),e=this.i;e&&(e.zf=null);d.zf=this;this.i=d;z5(this);if(this.i){d=g.P("ID_TOKEN");var f=this.i.Ei||{};d?f["x-youtube-identity-token"]=d:delete f["x-youtube-identity-token"];this.i.Ei=f}e?(3!=e.getState()&&0==xJa(e)||e.getState(),this.i.connect(a,b,this.I,e.l,e.Ro)):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){var c={_sc:a};b&&g.Yb(c,b);this.l.isActive()||2==(this.i?this.i.getState():0)?this.J.push(c):A5(this)&&(z5(this),wJa(this.i,c))};
g.k.NC=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)wJa(this.i,a[b])}this.V("handlerOpened")};
g.k.LC=function(a){var b=2==a&&401==this.i.Fi;4==a||b||this.l.start();this.V("handlerError",a,b)};
g.k.ix=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.vD=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.Yb(a,this.C);return a};
g.k.MC=function(a){"S"==a[0]?this.W=a[1]:"gracefulReconnect"==a[0]?(this.l.start(),uJa(this.i)):this.V("handlerMessage",new FJa(a[0],a[1]))};
g.k.av=function(a){(this.I.loungeIdToken=a)||this.l.stop();if(this.ia&&this.i){var b=this.i.Ei||{};a?b["X-YouTube-LoungeId-Token"]=a:delete b["X-YouTube-LoungeId-Token"];this.i.Ei=b}};
g.k.iQ=function(){this.l.isActive();0==xJa(this.i)&&this.connect(this.C,this.B)};B5.prototype.B=function(a,b,c,d){b?a(d):a({text:c.responseText})};
B5.prototype.u=function(a,b){a(Error("Request error: "+b.status))};
B5.prototype.C=function(a){a(Error("request timed out"))};var OJa=Date.now(),E5=null,H5=Array(50),G5=-1,I5=!1;g.Ta(J5,g.R);J5.prototype.Kg=function(){return this.screens};
J5.prototype.contains=function(a){return!!E4(this.screens,a)};
J5.prototype.get=function(a){return a?F4(this.screens,a):null};
J5.prototype.info=function(a){F5(this.I,a)};g.u(K5,g.R);g.k=K5.prototype;g.k.start=function(){!this.i&&isNaN(this.gb)&&this.fG()};
g.k.stop=function(){this.i&&(this.i.abort(),this.i=null);isNaN(this.gb)||(g.wo(this.gb),this.gb=NaN)};
g.k.da=function(){this.stop();g.R.prototype.da.call(this)};
g.k.fG=function(){this.gb=NaN;this.i=g.Tp(C5(this.u,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.J},timeout:5E3,onSuccess:(0,g.B)(this.LJ,this),onError:(0,g.B)(this.KJ,this),onTimeout:(0,g.B)(this.MJ,this)})};
g.k.LJ=function(a,b){this.i=null;var c=b.screen||{};c.dialId=this.B;c.name=this.I;var d=-1;this.C&&c.shortLivedLoungeToken&&c.shortLivedLoungeToken.value&&c.shortLivedLoungeToken.refreshIntervalMs&&(c.screenIdType="shortLived",c.loungeToken=c.shortLivedLoungeToken.value,d=c.shortLivedLoungeToken.refreshIntervalMs);this.V("pairingComplete",new z4(c),d)};
g.k.KJ=function(a){this.i=null;a.status&&404==a.status?this.l>=jLa.length?this.V("pairingFailed",Error("DIAL polling timed out")):(a=jLa[this.l],this.gb=g.uo((0,g.B)(this.fG,this),a),this.l++):this.V("pairingFailed",Error("Server error "+a.status))};
g.k.MJ=function(){this.i=null;this.V("pairingFailed",Error("Server not responding"))};
var jLa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.Ta(M5,J5);g.k=M5.prototype;g.k.start=function(){L5(this)&&this.V("screenChange");!g.Eu("yt-remote-lounge-token-expiration")&&SJa(this);g.wo(this.i);this.i=g.uo((0,g.B)(this.start,this),1E4)};
g.k.add=function(a,b){L5(this);PJa(this,a);N5(this,!1);this.V("screenChange");b(a);a.token||SJa(this)};
g.k.remove=function(a,b){var c=L5(this);RJa(this,a)&&(N5(this,!1),c=!0);b(a);c&&this.V("screenChange")};
g.k.zv=function(a,b,c,d){var e=L5(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,N5(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.V("screenChange")};
g.k.da=function(){g.wo(this.i);M5.Ed.da.call(this)};
g.k.vL=function(a){L5(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)}N5(this,!b);b&&F5(this.I,"Missed "+b+" lounge tokens.")};
g.k.uL=function(a){F5(this.I,"Requesting lounge tokens failed: "+a)};g.u(P5,g.R);g.k=P5.prototype;g.k.start=function(){var a=parseInt(g.Eu("yt-remote-fast-check-period")||"0",10);(this.B=g.Sa()-144E5<a?0:a)?S5(this):(this.B=g.Sa()+3E5,g.Du("yt-remote-fast-check-period",this.B),this.Lz())};
g.k.isEmpty=function(){return g.Pb(this.i)};
g.k.update=function(){O5("Updating availability on schedule.");var a=this.I(),b=g.Db(this.i,function(c,d){return c&&!!F4(a,d)},this);
R5(this,b)};
g.k.da=function(){g.wo(this.u);this.u=NaN;this.l&&(this.l.abort(),this.l=null);g.R.prototype.da.call(this)};
g.k.Lz=function(){g.wo(this.u);this.u=NaN;this.l&&this.l.abort();var a=UJa(this);if(v4(a)){var b=C5(this.C,"/pairing/get_screen_availability");this.l=D5(this.C,b,{lounge_token:g.Kb(a).join(",")},(0,g.B)(this.UO,this,a),(0,g.B)(this.TO,this))}else R5(this,{}),S5(this)};
g.k.UO=function(a,b){this.l=null;var c=g.Kb(UJa(this));if(g.yb(c,g.Kb(a))){c=b.screens||[];for(var d={},e=0,f=c.length;e<f;++e)d[a[c[e].loungeToken]]="online"==c[e].status;R5(this,d);S5(this)}else this.Gd("Changing Screen set during request."),this.Lz()};
g.k.TO=function(a){this.Gd("Screen availability failed: "+a);this.l=null;S5(this)};
g.k.Gd=function(a){F5("OnlineScreenService",a)};g.Ta(T5,J5);g.k=T5.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.zv=function(a,b,c,d){this.l.contains(a)?this.l.zv(a,b,c,d):(a="Updating name of unknown screen: "+a.name,F5(this.I,a),d(Error(a)))};
g.k.Kg=function(a){return a?this.screens:g.nb(this.screens,g.Ne(this.u,function(b){return!this.contains(b)},this))};
g.k.LB=function(){return g.Ne(this.Kg(!0),function(a){return!!this.i.i[a.id]},this)};
g.k.MB=function(a,b,c,d,e,f){var h=this;this.info("getDialScreenByPairingCode "+a+" / "+b);var l=new K5(this.B,a,b,c,d);l.subscribe("pairingComplete",function(m,n){g.Ei(l);e(U5(h,m),n)});
l.subscribe("pairingFailed",function(m){g.Ei(l);f(m)});
l.start();return(0,g.B)(l.stop,l)};
g.k.NJ=function(a,b,c,d){g.Tp(C5(this.B,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:a},timeout:5E3,onSuccess:(0,g.B)(function(e,f){var h=new z4(f.screen||{});if(!h.name||YJa(this,h.name)){a:{var l=h.name;for(var m=2,n=b(l,m);YJa(this,n);){m++;if(20<m)break a;n=b(l,m)}l=n}h.name=l}c(U5(this,h))},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.da=function(){g.Ei(this.l);g.Ei(this.i);T5.Ed.da.call(this)};
g.k.BL=function(){$Ja(this);this.V("screenChange");this.i.update()};
T5.prototype.dispose=T5.prototype.dispose;g.Ta(W5,g.R);g.k=W5.prototype;g.k.getScreen=function(){return this.B};
g.k.ag=function(a){this.na()||(a&&Y5(this,""+a),this.B=null,this.V("sessionScreen",null))};
g.k.info=function(a){F5(this.ia,a)};
g.k.NB=function(){return null};
g.k.Wz=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(){Y5(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.k.da=function(){this.Wz("");W5.Ed.da.call(this)};g.u(Z5,W5);g.k=Z5.prototype;g.k.Vz=function(a){if(this.l){if(this.l==a)return;Y5(this,"Overriding cast session with new session object");iKa(this);this.ca=!1;this.W="unknown";this.l.removeUpdateListener(this.Y);this.l.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.ea)}this.l=a;this.l.addUpdateListener(this.Y);this.l.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.ea);eKa(this,"getMdxSessionStatus")};
g.k.So=function(a){this.info("launchWithParams no-op for Cast: "+g.Dj(a))};
g.k.stop=function(){this.l?this.l.stop((0,g.B)(function(){this.ag()},this),(0,g.B)(function(){this.ag(Error("Failed to stop receiver app."))},this)):this.ag(Error("Stopping cast device without session."))};
g.k.Wz=function(){};
g.k.da=function(){this.info("disposeInternal");iKa(this);this.l&&(this.l.removeUpdateListener(this.Y),this.l.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.ea));this.l=null;W5.prototype.da.call(this)};
g.k.FP=function(a,b){if(!this.na())if(b){var c=T4(b);if(g.Na(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.Dj(c));switch(d){case "mdxSessionStatus":cKa(this,c);break;case "loungeToken":fKa(this,c);break;default:Y5(this,"Unknown youtube message: "+d)}}else Y5(this,"Unable to parse message.")}else Y5(this,"No data in message.")};
g.k.MD=function(a,b,c,d){g.wo(this.L);this.L=0;XJa(this.u,this.i.label,a,this.i.friendlyName,(0,g.B)(function(e){e?b(e):0<=d?(Y5(this,"Screen "+a+" appears to be offline. "+d+" retries left."),this.L=g.uo((0,g.B)(this.MD,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.k.NB=function(){return this.l};
g.k.OJ=function(a){this.na()||a||(Y5(this,"Cast session died."),this.ag())};g.u(b6,W5);g.k=b6.prototype;g.k.Vz=function(a){this.l=a;this.l.addUpdateListener(this.ga)};
g.k.So=function(a){this.la=a;this.X()};
g.k.stop=function(){pKa(this);this.l?this.l.stop((0,g.B)(this.ag,this,null),(0,g.B)(this.ag,this,"Failed to stop DIAL device.")):this.ag()};
g.k.da=function(){pKa(this);this.l&&this.l.removeUpdateListener(this.ga);this.l=null;W5.prototype.da.call(this)};
g.k.PJ=function(a){this.na()||a||(Y5(this,"DIAL session died."),this.C(),this.C=g.Ia,this.ag())};g.u(f6,W5);f6.prototype.stop=function(){this.ag()};
f6.prototype.Vz=function(){};
f6.prototype.So=function(){g.wo(this.l);this.l=NaN;var a=F4(this.u.Kg(),this.i.label);a?X5(this,a):this.ag(Error("No such screen"))};
f6.prototype.da=function(){g.wo(this.l);this.l=NaN;W5.prototype.da.call(this)};g.u(g6,g.R);g.k=g6.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,e=a?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION,f=(0,g.B)(this.EO,this);c=new chrome.cast.ApiConfig(c,(0,g.B)(this.QF,this),f,d,e);c.customDialLaunchCallback=(0,g.B)(this.rN,this);chrome.cast.initialize(c,(0,g.B)(function(){this.na()||
(chrome.cast.addReceiverActionListener(this.I),LJa(),this.l.subscribe("onlineScreenChange",(0,g.B)(this.OB,this)),this.u=rKa(this),chrome.cast.setCustomReceivers(this.u,g.Ia,(0,g.B)(function(h){this.Gd("Failed to set initial custom receivers: "+g.Dj(h))},this)),this.V("yt-remote-cast2-availability-change",i6(this)),b(!0))},this),(0,g.B)(function(h){this.Gd("Failed to initialize API: "+g.Dj(h));
b(!1)},this))};
g.k.pQ=function(a,b){h6("Setting connected screen ID: "+a+" -> "+b);if(this.i){var c=this.i.getScreen();if(!a||c&&c.id!=a)h6("Unsetting old screen status: "+this.i.i.friendlyName),j6(this,null)}if(a&&b){if(!this.i){c=F4(this.l.Kg(),a);if(!c){h6("setConnectedScreenStatus: Unknown screen.");return}if("shortLived"==c.idType){h6("setConnectedScreenStatus: Screen with id type to be short lived.");return}var d=qKa(this,c);d||(h6("setConnectedScreenStatus: Connected receiver not custom..."),d=new chrome.cast.Receiver(c.uuid?
c.uuid:c.id,c.name),d.receiverType=chrome.cast.ReceiverType.CUSTOM,this.u.push(d),chrome.cast.setCustomReceivers(this.u,g.Ia,(0,g.B)(function(e){this.Gd("Failed to set initial custom receivers: "+g.Dj(e))},this)));
h6("setConnectedScreenStatus: new active receiver: "+d.friendlyName);j6(this,new f6(this.l,d),!0)}this.i.Wz(b)}else h6("setConnectedScreenStatus: no screen.")};
g.k.qQ=function(a){this.na()?this.Gd("Setting connection data on disposed cast v2"):this.i?this.i.So(a):this.Gd("Setting connection data without a session")};
g.k.RJ=function(){this.na()?this.Gd("Stopping session on disposed cast v2"):this.i?(this.i.stop(),j6(this,null)):h6("Stopping non-existing session")};
g.k.requestSession=function(){chrome.cast.requestSession((0,g.B)(this.QF,this),(0,g.B)(this.XO,this))};
g.k.da=function(){this.l.unsubscribe("onlineScreenChange",(0,g.B)(this.OB,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.I);var a=IJa,b=g.Ha("yt.mdx.remote.debug.handlers_");g.kb(b||[],a);g.Ei(this.i);g.R.prototype.da.call(this)};
g.k.Gd=function(a){F5("Controller",a)};
g.k.SF=function(a,b){this.i==a&&(b||j6(this,null),this.V("yt-remote-cast2-session-change",b))};
g.k.BO=function(a,b){if(!this.na())if(a)switch(a.friendlyName=chrome.cast.unescape(a.friendlyName),h6("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case chrome.cast.ReceiverAction.CAST:if(this.i)if(this.i.i.label!=a.label)h6("onReceiverAction_: Stopping active receiver: "+this.i.i.friendlyName),this.i.stop();else{h6("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:j6(this,
new f6(this.l,a));break;case chrome.cast.ReceiverType.DIAL:j6(this,new b6(this.l,a,this.C,this.B));break;case chrome.cast.ReceiverType.CAST:j6(this,new Z5(this.l,a,this.B));break;default:this.Gd("Unknown receiver type: "+a.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.i&&this.i.i.label==a.label?this.i.stop():this.Gd("Stopping receiver w/o session: "+a.friendlyName)}else this.Gd("onReceiverAction_ called without receiver.")};
g.k.rN=function(a){if(this.na())return Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.Gd("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.Gd("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 h6("Reselecting dial screen."),
this.V("yt-remote-cast2-session-change",this.i.getScreen()),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.Gd('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);j6(this,new b6(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,c6(b)&&a.loungeToken?a.loungeTokenRefreshIntervalMs?a=mKa(b,{name:b.i.friendlyName,screenId:a.screenId,loungeToken:a.loungeToken,dialId:b.L.receiver.label,
screenIdType:"shortLived"},a.loungeTokenRefreshIntervalMs):(g.ro(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(a)+".")),a=nKa(b,c)):a=nKa(b,c)):a=e6(b);return a};
g.k.QF=function(a){if(!this.na()){h6("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)h6("Got resumed cast session before resumed mdx connection."),b.friendlyName=chrome.cast.unescape(b.friendlyName),j6(this,new Z5(this.l,b,this.B),!0);else{this.Gd("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.i.i,d=F4(this.l.Kg(),c.label);d&&A4(d,b.label)&&
c.receiverType!=chrome.cast.ReceiverType.CAST&&b.receiverType==chrome.cast.ReceiverType.CAST&&(h6("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.Ei(this.i),this.i=new Z5(this.l,b,this.B),this.i.subscribe("sessionScreen",(0,g.B)(this.SF,this,this.i)),this.i.So(null));this.i.Vz(a)}}};
g.k.QJ=function(){return this.i?this.i.NB():null};
g.k.XO=function(a){this.na()||(this.Gd("Failed to estabilish a session: "+g.Dj(a)),a.code!=chrome.cast.ErrorCode.CANCEL&&j6(this,null))};
g.k.EO=function(a){h6("Receiver availability updated: "+a);if(!this.na()){var b=i6(this);this.J=a==chrome.cast.ReceiverAvailability.AVAILABLE;i6(this)!=b&&this.V("yt-remote-cast2-availability-change",i6(this))}};
g.k.OB=function(){this.na()||(this.u=rKa(this),h6("Updating custom receivers: "+g.Dj(this.u)),chrome.cast.setCustomReceivers(this.u,g.Ia,(0,g.B)(function(){this.Gd("Failed to set custom receivers.")},this)),this.V("yt-remote-cast2-availability-change",i6(this)))};
g6.prototype.setLaunchParams=g6.prototype.qQ;g6.prototype.setConnectedScreenStatus=g6.prototype.pQ;g6.prototype.stopSession=g6.prototype.RJ;g6.prototype.getCastSession=g6.prototype.QJ;g6.prototype.requestSession=g6.prototype.requestSession;g6.prototype.init=g6.prototype.init;g6.prototype.dispose=g6.prototype.dispose;var p6=[];g.k=u6.prototype;
g.k.reset=function(a){this.listId="";this.index=-1;this.videoId="";v6(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.i=a.trackData,this.Wi=a.hasPrevious,this.hasNext=a.hasNext,this.L=a.playerTime,this.J=a.playerTimeAt,this.C=a.seekableStart,this.l=a.seekableEnd,this.I=a.duration,this.W=a.loadedTime,this.B=a.liveIngestionTime,this.u=!isNaN(this.B))};
g.k.Kb=function(){return 1==this.playerState};
g.k.isAdPlaying=function(){return 1081==this.playerState};
g.k.getDuration=function(){return this.u?this.I+w6(this):this.I};
g.k.clone=function(){return new u6(A6(this))};g.u(C6,g.R);g.k=C6.prototype;g.k.getState=function(){return this.Ma};
g.k.play=function(){E6(this)?(this.i?this.i.play(null,g.Ia,J6(this,"play")):I6(this,"play"),H6(this,1,y6(D6(this))),this.V("remotePlayerChange")):F6(this,this.play)};
g.k.pause=function(){E6(this)?(this.i?this.i.pause(null,g.Ia,J6(this,"pause")):I6(this,"pause"),H6(this,2,y6(D6(this))),this.V("remotePlayerChange")):F6(this,this.pause)};
g.k.seekTo=function(a){if(E6(this)){if(this.i){var b=D6(this),c=new chrome.cast.media.SeekRequest;c.currentTime=a;b.Kb()||3==b.playerState?c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.i.seek(c,g.Ia,J6(this,"seekTo",{newTime:a}))}else I6(this,"seekTo",{newTime:a});H6(this,3,a);this.V("remotePlayerChange")}else F6(this,g.Qa(this.seekTo,a))};
g.k.stop=function(){if(E6(this)){this.i?this.i.stop(null,g.Ia,J6(this,"stopVideo")):I6(this,"stopVideo");var a=D6(this);a.index=-1;a.videoId="";v6(a);G6(this,a);this.V("remotePlayerChange")}else F6(this,this.stop)};
g.k.setVolume=function(a,b){if(E6(this)){var c=D6(this);if(this.l){if(c.volume!=a){var d=Math.round(a)/100;this.l.setReceiverVolumeLevel(d,(0,g.B)(function(){F5("CP","set receiver volume: "+d)},this),(0,g.B)(function(){this.Gd("failed to set receiver volume.")},this))}c.muted!=b&&this.l.setReceiverMuted(b,(0,g.B)(function(){F5("CP","set receiver muted: "+b)},this),(0,g.B)(function(){this.Gd("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);I6(this,"setVolume",e)}c.muted=b;c.volume=a;G6(this,c)}else F6(this,g.Qa(this.setVolume,a,b))};
g.k.PB=function(a,b){if(E6(this)){var c=D6(this),d={videoId:a};b&&(c.i={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,kind:b.kind},d.style=g.Dj(b.style),g.Yb(d,c.i));I6(this,"setSubtitlesTrack",d);G6(this,c)}else F6(this,g.Qa(this.PB,a,b))};
g.k.setAudioTrack=function(a,b){if(E6(this)){var c=b.getLanguageInfo().getId();I6(this,"setAudioTrack",{videoId:a,audioTrackId:c});var d=D6(this);d.audioTrackId=c;G6(this,d)}else F6(this,g.Qa(this.setAudioTrack,a,b))};
g.k.playVideo=function(a,b,c,d,e,f,h){var l=D6(this);c=c||0;var m={videoId:a,currentIndex:c};z6(l,a,c);void 0!==b&&(x6(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.Dj(h));I6(this,"setPlaylist",m);d||G6(this,l)};
g.k.Mu=function(a,b){if(E6(this)){if(a&&b){var c=D6(this);z6(c,a,b);G6(this,c)}I6(this,"previous")}else F6(this,g.Qa(this.Mu,a,b))};
g.k.nextVideo=function(a,b){if(E6(this)){if(a&&b){var c=D6(this);z6(c,a,b);G6(this,c)}I6(this,"next")}else F6(this,g.Qa(this.nextVideo,a,b))};
g.k.fD=function(){E6(this)?I6(this,"dismissAutoplay"):F6(this,this.fD)};
g.k.dispose=function(){if(3!=this.Ma){var a=this.Ma;this.Ma=3;this.V("proxyStateChange",a,this.Ma)}g.R.prototype.dispose.call(this)};
g.k.da=function(){DKa(this);this.u=null;this.B.clear();B6(this,null);g.R.prototype.da.call(this)};
g.k.Zz=function(a){if((a!=this.Ma||2==a)&&3!=this.Ma&&0!=a){var b=this.Ma;this.Ma=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.yO=function(a,b){this.V(a,b)};
g.k.dN=function(a){if(!a)this.Ar(null),B6(this,null);else if(this.l.receiver.volume){a=this.l.receiver.volume;var b=D6(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)F5("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,G6(this,b)}};
g.k.Ar=function(a){F5("CP","Cast media: "+!!a);this.i&&this.i.removeUpdateListener(this.J);if(this.i=a)this.i.addUpdateListener(this.J),EKa(this),this.V("remotePlayerChange")};
g.k.cN=function(a){a?(EKa(this),this.V("remotePlayerChange")):this.Ar(null)};
g.k.qA=function(){I6(this,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.k.kN=function(){var a=AKa();a&&B6(this,a)};
g.k.Gd=function(a){F5("CP",a)};g.u(K6,g.R);g.k=K6.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,n=b.locationInfo;void 0!==m&&(l.currentTime=5>=m?0:m);e&&(l.playerParams=e);n&&(l.locationInfo=n);f&&(l.clickTrackingParams=f);c&&(l.listId=c);void 0!==h&&(l.currentIndex=h);c&&(this.Fb.listId=c);this.Fb.videoId=d;this.Fb.index=h||0;this.Fb.state=3;x6(this.Fb,m);this.B="UNSUPPORTED";L6("Connecting with setPlaylist and params: "+g.Dj(l));this.i.connect({method:"setPlaylist",
params:g.Dj(l)},a,DIa())}else L6("Connecting without params"),this.i.connect({},a,DIa());GKa(this)};
g.k.av=function(a){this.i.av(a)};
g.k.dispose=function(){this.na()||(this.V("beforeDispose"),M6(this,3));g.R.prototype.dispose.call(this)};
g.k.da=function(){N6(this);P6(this);O6(this);g.wo(this.J);this.J=NaN;g.wo(this.L);this.L=NaN;this.u=null;g.Xo(this.W);this.W.length=0;this.i.dispose();g.R.prototype.da.call(this);this.B=this.I=this.l=this.Fb=this.i=null};
g.k.pL=function(){this.uo(2)};
g.k.hN=function(){L6("Channel opened");this.ca&&(this.ca=!1,O6(this),this.Y=g.uo((0,g.B)(function(){L6("Timing out waiting for a screen.");this.uo(1)},this),15E3));
HIa(GJa(this.i),this.ga)};
g.k.eN=function(){L6("Channel closed");isNaN(this.C)?K4(!0):K4();this.dispose()};
g.k.fN=function(a,b){K4();isNaN(this.Vq())?(b&&"shortLived"==this.ea&&this.V("browserChannelAuthError",a),L6("Channel error: "+a+" without reconnection"),this.dispose()):(this.ca=!0,L6("Channel error: "+a+" with reconnection in "+this.Vq()+" ms"),M6(this,2))};
g.k.gN=function(a){a.params?L6("Received: action="+a.action+", params="+g.Dj(a.params)):L6("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=T4(a.params.devices);this.l=g.Qc(a,function(c){return new y4(c)});
a=!!g.cb(this.l,function(c){return"LOUNGE_SCREEN"==c.type});
JKa(this,a);break;case "loungeScreenDisconnected":g.lb(this.l,function(c){return"LOUNGE_SCREEN"==c.type});
JKa(this,!1);break;case "remoteConnected":var b=new y4(T4(a.params.device));g.cb(this.l,function(c){return b?c.id==b.id:!1})||nIa(this.l,b);
break;case "remoteDisconnected":b=new y4(T4(a.params.device));g.lb(this.l,function(c){return b?c.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":LKa(this,a);break;case "nowPlaying":NKa(this,a);break;case "onStateChange":MKa(this,a);break;case "onAdStateChange":OKa(this,a);break;case "onVolumeChanged":PKa(this,a);break;case "onSubtitlesTrackChanged":KKa(this,a);break;case "nowAutoplaying":QKa(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":RKa(this,a);break;case "requestAssistedSignIn":this.V("assistedSignInRequested",a.params.authCode);break;default:L6("Unrecognized action: "+a.action)}};
g.k.eQ=function(){if(this.u){var a=this.u;this.u=null;this.Fb.videoId!=a&&Q6(this,"getNowPlaying")}};
g.k.lL=function(){var a=3;this.na()||(a=0,isNaN(this.Vq())?A5(this.i)&&isNaN(this.C)&&(a=1):a=2);return a};
g.k.uo=function(a){L6("Disconnecting with "+a);N6(this);this.V("beforeDisconnect",a);1==a&&K4();HJa(this.i,a);this.dispose()};
g.k.jL=function(){var a=this.Fb;this.u&&(a=this.Fb.clone(),z6(a,this.u,a.index));return A6(a)};
g.k.rQ=function(a){var b=new u6(a);b.videoId&&b.videoId!=this.Fb.videoId&&(this.u=b.videoId,g.wo(this.J),this.J=g.uo((0,g.B)(this.eQ,this),5E3));var c=[];this.Fb.listId==b.listId&&this.Fb.videoId==b.videoId&&this.Fb.index==b.index||c.push("remoteQueueChange");this.Fb.playerState==b.playerState&&this.Fb.volume==b.volume&&this.Fb.muted==b.muted&&y6(this.Fb)==y6(b)&&g.Dj(this.Fb.i)==g.Dj(b.i)||c.push("remotePlayerChange");this.Fb.reset(a);g.Ab(c,function(d){this.V(d)},this)};
g.k.LD=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.Vq=function(){var a=this.i;return a.l.isActive()?a.l.l-g.Sa():NaN};
g.k.fL=function(){return this.B||"UNSUPPORTED"};
g.k.gL=function(){return this.I||""};
g.k.SJ=function(){if(!isNaN(this.Vq())){var a=this.i.l;a.i.mg();a.start()}};
g.k.nQ=function(a,b){Q6(this,a,b);IKa(this)};
g.k.QB=function(){var a=g.Pq("SID","")||"",b=g.Pq("SAPISID","")||"",c=g.Pq("__Secure-3PAPISID","")||"";if(!a&&!b&&!c)return"";a=g.sf(g.Xe(a),2);b=g.sf(g.Xe(b),2);c=g.sf(g.Xe(c),2);return g.sf(g.Xe(a+","+b+","+c),2)};
K6.prototype.subscribe=K6.prototype.subscribe;K6.prototype.unsubscribeByKey=K6.prototype.Nf;K6.prototype.getProxyState=K6.prototype.lL;K6.prototype.disconnect=K6.prototype.uo;K6.prototype.getPlayerContextData=K6.prototype.jL;K6.prototype.setPlayerContextData=K6.prototype.rQ;K6.prototype.getOtherConnectedRemoteId=K6.prototype.LD;K6.prototype.getReconnectTimeout=K6.prototype.Vq;K6.prototype.getAutoplayMode=K6.prototype.fL;K6.prototype.getAutoplayVideoId=K6.prototype.gL;K6.prototype.reconnect=K6.prototype.SJ;
K6.prototype.sendMessage=K6.prototype.nQ;K6.prototype.getXsrfToken=K6.prototype.QB;g.u(R6,J5);g.k=R6.prototype;g.k.Kg=function(a){return this.Gf.$_gs(a)};
g.k.contains=function(a){return!!this.Gf.$_c(a)};
g.k.get=function(a){return this.Gf.$_g(a)};
g.k.start=function(){this.Gf.$_st()};
g.k.add=function(a,b,c){this.Gf.$_a(a,b,c)};
g.k.remove=function(a,b,c){this.Gf.$_r(a,b,c)};
g.k.zv=function(a,b,c,d){this.Gf.$_un(a,b,c,d)};
g.k.da=function(){for(var a=0,b=this.i.length;a<b;++a)this.Gf.$_ubk(this.i[a]);this.i.length=0;this.Gf=null;J5.prototype.da.call(this)};
g.k.TJ=function(){this.V("screenChange")};
g.k.fO=function(){this.V("onlineScreenChange")};
T5.prototype.$_st=T5.prototype.start;T5.prototype.$_gspc=T5.prototype.NJ;T5.prototype.$_gsppc=T5.prototype.MB;T5.prototype.$_c=T5.prototype.contains;T5.prototype.$_g=T5.prototype.get;T5.prototype.$_a=T5.prototype.add;T5.prototype.$_un=T5.prototype.zv;T5.prototype.$_r=T5.prototype.remove;T5.prototype.$_gs=T5.prototype.Kg;T5.prototype.$_gos=T5.prototype.LB;T5.prototype.$_s=T5.prototype.subscribe;T5.prototype.$_ubk=T5.prototype.Nf;var d7=null,j7=!1,S6=null,T6=null,i7=null,X6=[];g.u(k7,g.E);g.k=k7.prototype;g.k.da=function(){g.E.prototype.da.call(this);this.i.stop();this.u.stop();this.L.stop();this.Y();var a=this.wb;a.unsubscribe("proxyStateChange",this.NF,this);a.unsubscribe("remotePlayerChange",this.Gr,this);a.unsubscribe("remoteQueueChange",this.Ku,this);a.unsubscribe("previousNextChange",this.KF,this);a.unsubscribe("nowAutoplaying",this.FF,this);a.unsubscribe("autoplayDismissed",this.fF,this);this.wb=this.l=null};
g.k.RB=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.wb.Ma)if(l7(this)){if(!D6(this.wb).isAdPlaying()||"control_seek"!==a)switch(a){case "control_toggle_play_pause":D6(this.wb).Kb()?this.wb.pause():this.wb.play();break;case "control_play":this.wb.play();break;case "control_pause":this.wb.pause();break;case "control_seek":this.J.mg(c[0],c[1]);break;case "control_subtitles_set_track":m7(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();n7(this,0===c?void 0:c);break;case "control_seek":n7(this,c[0]);break;case "control_subtitles_set_track":m7(this,c[0]);break;case "control_set_audio_track":this.setAudioTrack(c[0])}};
g.k.aN=function(a){this.L.mg(a)};
g.k.XQ=function(a){this.RB("control_subtitles_set_track",g.Pb(a)?null:a)};
g.k.bH=function(){var a=this.G.getOption("captions","track");g.Pb(a)||m7(this,a)};
g.k.Ab=function(a){this.l.Ab(a,this.G.getVideoData().lengthSeconds)};
g.k.ON=function(){g.Pb(this.B)||bLa(this,this.B);this.C=!1};
g.k.NF=function(a,b){this.u.stop();2===b&&this.WG()};
g.k.Gr=function(){if(l7(this)){this.i.stop();var a=D6(this.wb);switch(a.playerState){case 1080:case 1081:case 1084:case 1085:this.l.Me=1;break;case 1082:case 1083:this.l.Me=0;break;default:this.l.Me=-1}switch(a.playerState){case 1081:case 1:this.tb(new g.bK(8));this.VG();break;case 1085:case 3:this.tb(new g.bK(9));break;case 1083:case 0:this.tb(new g.bK(2));this.J.stop();this.Ab(this.G.getVideoData().lengthSeconds);break;case 1084:this.tb(new g.bK(4));break;case 2:this.tb(new g.bK(4));this.Ab(y6(a));
break;case -1:this.tb(new g.bK(64));break;case -1E3:this.tb(new g.bK(128,{errorCode:"mdx.remoteerror",errorMessage:"This video is not available for remote playback."}))}a=D6(this.wb).i;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,bLa(this,a));a=D6(this.wb);-1===a.volume||Math.round(this.G.getVolume())===a.volume&&this.G.isMuted()===a.muted||this.W.isActive()||this.xH()}else aLa(this)};
g.k.KF=function(){this.G.V("mdxpreviousnextchange")};
g.k.Ku=function(){l7(this)||aLa(this)};
g.k.FF=function(a){isNaN(a)||this.G.V("mdxnowautoplaying",a)};
g.k.fF=function(){this.G.V("mdxautoplaycanceled")};
g.k.setAudioTrack=function(a){l7(this)&&this.wb.setAudioTrack(this.G.getVideoData(1).videoId,a)};
g.k.seekTo=function(a,b){-1===D6(this.wb).playerState?n7(this,a):b&&this.wb.seekTo(a)};
g.k.xH=function(){var a=this;if(l7(this)){var b=D6(this.wb);this.events.Gb(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){$Ka(a,c)})}};
g.k.VG=function(){this.i.stop();if(!this.wb.na()){var a=D6(this.wb);a.Kb()&&this.tb(new g.bK(8));this.Ab(y6(a));this.i.start()}};
g.k.WG=function(){this.u.stop();this.i.stop();var a=this.wb.u.getReconnectTimeout();2==this.wb.Ma&&!isNaN(a)&&this.u.start()};
g.k.tb=function(a){this.u.stop();var b=this.I;if(!g.gK(b,a)){var c=g.W(a,2);c!==g.W(this.I,2)&&this.G.En(c);this.I=a;dLa(this.l,b,a)}};g.u(o7,g.X);o7.prototype.Dc=function(){this.i.show()};
o7.prototype.kb=function(){this.i.hide()};
o7.prototype.l=function(){g.IJ("https://support.google.com/youtube/answer/7640706")};
o7.prototype.u=function(){x4("mdx-manual-pairing-popup-ok");this.kb()};g.u(p7,g.X);p7.prototype.Dc=function(){this.i.show()};
p7.prototype.kb=function(){this.i.hide()};
p7.prototype.l=function(){x4("mdx-privacy-popup-cancel");this.kb()};
p7.prototype.u=function(){x4("mdx-privacy-popup-confirm");this.kb()};g.u(q7,g.X);q7.prototype.l=function(a){cLa(this,a.state)};g.u(r7,g.PP);r7.prototype.C=function(){var a=this.G.getOption("remote","receivers");a&&1<a.length&&!this.G.getOption("remote","quickCast")?(this.Ml=g.Bb(a,this.i,this),g.QP(this,g.Qc(a,this.i)),a=this.G.getOption("remote","currentReceiver"),a=this.i(a),this.options[a]&&this.bh(a),this.enable(!0)):this.enable(!1)};
r7.prototype.i=function(a){return a.key};
r7.prototype.Ih=function(a){return"cast-selector-receiver"===a?"Cast...":this.Ml[a].name};
r7.prototype.Ue=function(a){g.PP.prototype.Ue.call(this,a);this.G.setOption("remote","currentReceiver",this.Ml[a]);this.bb.kb()};g.u(s7,g.eN);g.k=s7.prototype;
g.k.create=function(){var a=this.player.T(),b=g.VF(a);a={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:g.U(a.experiments,"mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:g.U(a.experiments,"enable_dial_short_lived_lounge_token"),enableCastLoungeToken:g.U(a.experiments,"enable_cast_short_lived_lounge_token")};VKa(b,a);this.subscriptions.push(g.Bo("yt-remote-before-disconnect",this.YM,this));this.subscriptions.push(g.Bo("yt-remote-connection-change",this.FO,this));this.subscriptions.push(g.Bo("yt-remote-receiver-availability-change",
this.MF,this));this.subscriptions.push(g.Bo("yt-remote-auto-connect",this.DO,this));this.subscriptions.push(g.Bo("yt-remote-receiver-resumed",this.CO,this));this.subscriptions.push(g.Bo("mdx-privacy-popup-confirm",this.UP,this));this.subscriptions.push(g.Bo("mdx-privacy-popup-cancel",this.TP,this));this.subscriptions.push(g.Bo("mdx-manual-pairing-popup-ok",this.hM,this));this.MF()};
g.k.load=function(){this.player.cancelPlayback();g.eN.prototype.load.call(this);this.hh=new k7(this,this.player,this.wb);var a=(a=ZKa())?a.currentTime:0;var b=h7()?new C6(b7(),void 0):null;0==a&&b&&(a=y6(D6(b)));0!==a&&this.Ab(a);dLa(this,this.Mc,this.Mc);this.player.xj(6)};
g.k.unload=function(){this.player.V("mdxautoplaycanceled");this.Wk=this.Zh;g.Fi(this.hh,this.wb);this.wb=this.hh=null;g.eN.prototype.unload.call(this);this.player.xj(5);t7(this)};
g.k.da=function(){g.Co(this.subscriptions);g.eN.prototype.da.call(this)};
g.k.nj=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.hh.RB.apply(this.hh,[a].concat(g.la(c)))};
g.k.getAdState=function(){return this.Me};
g.k.mL=function(){return this.loaded?this.hh.suggestion:null};
g.k.Wi=function(){return this.wb?D6(this.wb).Wi:!1};
g.k.hasNext=function(){return this.wb?D6(this.wb).hasNext:!1};
g.k.Ab=function(a,b){this.zE=a||0;this.player.V("progresssync",a,b)};
g.k.getCurrentTime=function(){return this.zE};
g.k.getProgressState=function(){var a=D6(this.wb),b=this.player.getVideoData();return{allowSeeking:g.U(this.player.T().experiments,"web_player_mdx_allow_seeking_change_killswitch")?this.player.Ke():!a.isAdPlaying()&&this.player.Ke(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.u?a.B+w6(a):a.B,isAtLiveHead:1>=(a.u?a.l+w6(a):a.l)-this.getCurrentTime(),loaded:a.W,seekableEnd:a.u?a.l+w6(a):a.l,seekableStart:0<a.C?a.C+
w6(a):a.C}};
g.k.nextVideo=function(){this.wb&&this.wb.nextVideo()};
g.k.Mu=function(){this.wb&&this.wb.Mu()};
g.k.YM=function(a){1===a&&(this.Az=this.wb?D6(this.wb):null)};
g.k.FO=function(){var a=h7()?new C6(b7(),void 0):null;if(a){var b=this.Wk;this.loaded&&this.unload();this.wb=a;this.Az=null;b.key!==this.Zh.key&&(this.Wk=b,this.load())}else g.Ei(this.wb),this.wb=null,this.loaded&&(this.unload(),(a=this.Az)&&a.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(a.videoId,y6(a)));this.player.V("videodatachange","newdata",this.player.getVideoData(),3)};
g.k.MF=function(){var a=[this.Zh],b=a.concat,c=WKa();q6()&&g.Eu("yt-remote-cast-available")&&c.push({key:"cast-selector-receiver",name:"Cast..."});this.Ml=b.call(a,c);a=c7()||this.Zh;u7(this,a);this.player.xa("onMdxReceiversChange")};
g.k.DO=function(){var a=c7();u7(this,a)};
g.k.CO=function(){this.Wk=c7()};
g.k.UP=function(){this.Jr=!0;t7(this);j7=!1;d7&&f7(d7,1);d7=null};
g.k.TP=function(){this.Jr=!1;t7(this);u7(this,this.Zh);this.Wk=this.Zh;j7=!1;d7=null;this.player.playVideo()};
g.k.hM=function(){this.ou=!0;t7(this);g.Du("yt-remote-manual-pairing-warning-shown",!0,2592E3);j7=!1;d7&&f7(d7,1);d7=null};
g.k.Fe=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.Ml;case "currentReceiver":return b&&("cast-selector-receiver"===b.key?s6():u7(this,b)),this.loaded?this.Wk:this.Zh;case "quickCast":return 2===this.Ml.length&&"cast-selector-receiver"===this.Ml[1].key?(b&&s6(),!0):!1}};
g.k.qA=function(){this.wb.qA()};
g.k.ri=function(){return!1};
g.k.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]};g.kN.remote=s7;})(_yt_player);
