(function(g){var window=this;var QBa=function(a,b){return g.Vb(a,b)},m6=function(a){g.Um(a,"zx",g.xb());
return a},n6=function(a,b,c){g.ya(c)||(c=[String(c)]);
g.Xm(a.g,b,c)},RBa=function(a,b){var c=[];
g.Dk(b,function(a){try{var b=g.pD.prototype.l.call(this,a,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}g.t(b)?g.oD(b)&&c.push(a):c.push(a)},a);
return c},SBa=function(a,b){var c=RBa(a,b);
(0,g.B)(c,function(a){g.pD.prototype.remove.call(this,a)},a)},TBa=function(a){if(a.wd){if(a.wd.locationOverrideToken)return{locationOverrideToken:a.wd.locationOverrideToken};
if(null!=a.wd.latitudeE7&&null!=a.wd.longitudeE7)return{latitudeE7:a.wd.latitudeE7,longitudeE7:a.wd.longitudeE7}}return null},UBa=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&&g.Pm(e,d);return e},VBa=function(a){g.lG[a]&&(a=g.lG[a],(0,g.B)(a,function(a){g.jG[a]&&delete g.jG[a]}),a.length=0)},WBa=function(a){var b=g.iG();
if(b)if(b.clear(a),a)VBa(a);else for(var c in g.lG)VBa(c)},o6=function(a){this.app=this.name=this.id="";
this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.o=!1;this.capabilities=new window.Set;this.experiments=new window.Set;this.theme="u";new g.Fm;this.g=this.l="";a&&(this.id=a.id||a.name,this.name=a.name,this.app=a.app,this.type=a.type||"REMOTE_CONTROL",this.username=a.user||"",this.avatar=a.userAvatarUri||"",this.obfuscatedGaiaId=a.obfuscatedGaiaId||"",this.theme=a.theme||"u",XBa(this,a.capabilities||""),YBa(this,a.experiments||""),this.l=a.remoteControllerUrl||"",
this.g=a.localChannelEncryptionKey||"")},XBa=function(a,b){a.capabilities.clear();
(0,g.Ld)(b.split(","),g.Ea(QBa,ZBa)).forEach(function(b){a.capabilities.add(b)})},YBa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(b){a.experiments.add(b)})},p6=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||""},q6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},$Ba=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid}},aCa=function(a){return new p6(a)},bCa=function(a){return g.ya(a)?(0,g.G)(a,aCa):[]},r6=function(a){return a?'{name:"'+a.name+'",id:'+a.id.substr(0,6)+"..,token:"+(a.token?".."+a.token.slice(-6):"-")+",uuid:"+(a.uuid?".."+a.uuid.slice(-6):"-")+"}":"null"},s6=function(a){return g.ya(a)?"["+(0,g.G)(a,r6).join(",")+"]":"null"},t6=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)})},cCa=function(a){return(0,g.G)(a,function(a){return{key:a.id,
name:a.name}})},u6=function(a,b){return g.Ma(a,function(a){return a||b?!a!=!b?!1:a.id==b.id:!0})},v6=function(a,b){return g.Ma(a,function(a){return q6(a,b)})},dCa=function(){var a=(0,g.eH)();
a&&SBa(a,a.g.Nd(!0))},w6=function(){var a=g.hH("yt-remote-connected-devices")||[];
g.ib(a);return a},eCa=function(a){if(g.Ra(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return(0,g.G)(a,function(a,b){return 0==b?a:a.substring(c.length)})},fCa=function(a){g.gH("yt-remote-connected-devices",a,86400)},y6=function(){if(x6)return x6;
var a=g.hH("yt-remote-device-id");a||(a=t6(),g.gH("yt-remote-device-id",a,31536E3));for(var b=w6(),c=1,d=a;g.Qa(b,d);)c++,d=a+"#"+c;return x6=d},z6=function(){var a=w6(),b=y6();
g.Qa(a,b);g.jH()&&g.kb(a,b);a=eCa(a);if(g.Ra(a))try{g.SG("remote_sid")}catch(c){}else try{g.RG("remote_sid",a.join(","),-1)}catch(c){}},gCa=function(){return g.hH("yt-remote-session-browser-channel")},hCa=function(){return g.hH("yt-remote-local-screens")||[]},iCa=function(){g.gH("yt-remote-lounge-token-expiration",!0,86400)},jCa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=(0,g.G)(hCa(),function(a){return a.loungeToken}),c=(0,g.G)(a,function(a){return a.loungeToken});
(0,g.tm)(c,function(a){return!g.Qa(b,a)})&&iCa();
g.gH("yt-remote-local-screens",a,31536E3)},kCa=function(a,b){g.gH("yt-remote-session-browser-channel",a);
g.gH("yt-remote-session-screen-id",b);var c=w6(),d=y6();g.Qa(c,d)||c.push(d);fCa(c);z6()},A6=function(a){a||(g.iH("yt-remote-session-screen-id"),g.iH("yt-remote-session-video-id"));
z6();a=w6();g.Va(a,y6());fCa(a)},lCa=function(){if(!B6){var a=g.AD();
a&&(B6=new g.jD(a))}return B6?!!B6.get("yt-remote-use-staging-server"):!1},mCa=function(){var a=window.document.createElement("a");
g.Zc(a,"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js");a=a.href.replace(/^[a-zA-Z]+:\/\//,"//");return"js-"+g.Bb(a)},nCa=function(a,b){var c=g.Ed("SCRIPT");
c.id=a;c.onload=function(){b&&(0,window.setTimeout)(b,0)};
c.onreadystatechange=function(){switch(c.readyState){case "loaded":case "complete":c.onload()}};
g.ad(c,g.de("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"));var d=window.document.getElementsByTagName("head")[0]||window.document.body;d.insertBefore(c,d.firstChild);return c},oCa=function(){var a=mCa(),b=window.document.getElementById(a),c=b&&g.uF(b,"loaded");
c||b&&!c||(b=nCa(a,function(){g.uF(b,"loaded")||(g.tF(b,"loaded","true"),g.pG(a),g.iE(g.Ea(WBa,a),0))}))},C6=function(a){return!!window.document.currentScript&&(-1!=window.document.currentScript.src.indexOf("?"+a)||-1!=window.document.currentScript.src.indexOf("&"+a))},pCa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},D6=function(a){a.length?qCa(a.shift(),function(){D6(a)}):E6()},rCa=function(a){return"chrome-extension://"+a+F6},qCa=function(a,
b,c){var d=window.document.createElement("script");
d.onerror=b;c&&(d.onload=c);d.src=a;(window.document.head||window.document.documentElement).appendChild(d)},G6=function(a){return 0<=window.navigator.userAgent.indexOf(a)},E6=function(){var a=pCa();
a&&a(!1,"No cast extension found")},H6=function(){if(sCa){var a=2,b=pCa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;qCa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",E6,c)}},tCa=function(){var a=window.__gCrWeb&&window.__gCrWeb.message&&window.__gCrWeb.message.invokeOnHost;
a&&(H6(),a({command:"cast.sender.init"}))},uCa=function(){H6();
var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);D6(["//www.gstatic.com/eureka/clank/"+(a?(0,window.parseInt)(a[1],10):0)+F6,"//www.gstatic.com/eureka/clank"+F6])},I6=function(a,b,c){g.K.call(this);
this.C=null!=c?(0,g.z)(a,c):a;this.ad=b;this.B=(0,g.z)(this.qI,this);this.g=!1;this.l=0;this.o=this.va=null;this.A=[]},J6=function(){},K6=function(a,b,c,d){this.g=a;
this.o=b;this.F=c;this.D=d||1;this.B=45E3;this.A=new g.an(this);this.l=new g.ug;this.l.setInterval(250)},wCa=function(a,b,c){a.oj=1;
a.Vg=m6(b.clone());a.xi=c;a.C=!0;vCa(a,null)},L6=function(a,b,c,d,e){a.oj=1;
a.Vg=m6(b.clone());a.xi=null;a.C=c;e&&(a.JC=!1);vCa(a,d)},vCa=function(a,b){a.Tj=(0,g.F)();
M6(a);a.th=a.Vg.clone();n6(a.th,"t",a.D);a.Ul=0;a.Oc=a.g.Dq(a.g.Ol()?b:null);0<a.kr&&(a.Io=new g.gl((0,g.z)(a.VD,a,a.Oc),a.kr));a.A.U(a.Oc,"readystatechange",a.KT);var c=a.Vh?g.cc(a.Vh):{};a.xi?(a.yp="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.Oc.send(a.th,a.yp,a.xi,c)):(a.yp="GET",a.JC&&!g.Ad&&(c.Connection="close"),a.Oc.send(a.th,a.yp,null,c));a.g.lf(1)},zCa=function(a,b,c){for(var d=!0;!a.Ih&&a.Ul<c.length;){var e=xCa(a,c);
if(e==N6){4==b&&(a.Wg=4,O6(15),d=!1);break}else if(e==yCa){a.Wg=4;O6(16);d=!1;break}else P6(a,e)}4==b&&0==c.length&&(a.Wg=1,O6(17),d=!1);a.sf=a.sf&&d;d||(Q6(a),R6(a))},xCa=function(a,b){var c=a.Ul,d=b.indexOf("\n",c);
if(-1==d)return N6;c=Number(b.substring(c,d));if((0,window.isNaN)(c))return yCa;d+=1;if(d+c>b.length)return N6;var e=b.substr(d,c);a.Ul=d+c;return e},BCa=function(a,b){a.Tj=(0,g.F)();
M6(a);var c=b?window.location.hostname:"";a.th=a.Vg.clone();g.Um(a.th,"DOMAIN",c);g.Um(a.th,"t",a.D);try{a.tf=new window.ActiveXObject("htmlfile")}catch(n){Q6(a);a.Wg=7;O6(22);R6(a);return}var d="<html><body>";if(b){for(var e="",f=0;f<c.length;f++){var k=c.charAt(f);if("<"==k)e+="\\x3c";else if(">"==k)e+="\\x3e";else{var l=k;if(l in S6)k=S6[l];else if(l in ACa)k=S6[l]=ACa[l];else{var m=l.charCodeAt(0);if(31<m&&127>m)k=l;else{if(256>m){if(k="\\x",16>m||256<m)k+="0"}else k="\\u",4096>m&&(k+="0");k+=
m.toString(16).toUpperCase()}k=S6[l]=k}e+=k}}d+='<script>document.domain="'+e+'"\x3c/script>'}d+="</body></html>";c=g.bd(g.xc("b/12014412"),d);a.tf.open();a.tf.write(g.Tc(c));a.tf.close();a.tf.parentWindow.m=(0,g.z)(a.PS,a);a.tf.parentWindow.d=(0,g.z)(a.WB,a,!0);a.tf.parentWindow.rpcClose=(0,g.z)(a.WB,a,!1);c=a.tf.createElement("DIV");a.tf.parentWindow.document.body.appendChild(c);d=g.Kc(a.th.toString());d=g.rb(g.Hc(d));d=g.bd(g.xc("b/12014412"),'<iframe src="'+d+'"></iframe>');c.innerHTML=g.Tc(d);
a.g.lf(1)},M6=function(a){a.Ou=(0,g.F)()+a.B;
CCa(a,a.B)},CCa=function(a,b){if(null!=a.lk)throw Error("WatchDog timer not null");
a.lk=T6((0,g.z)(a.gT,a),b)},U6=function(a){a.lk&&(g.w.clearTimeout(a.lk),a.lk=null)},R6=function(a){a.g.Yx()||a.Ih||a.g.vo(a)},Q6=function(a){U6(a);
g.cf(a.Io);a.Io=null;a.l.stop();g.gn(a.A);if(a.Oc){var b=a.Oc;a.Oc=null;b.abort();b.dispose()}a.tf&&(a.tf=null)},P6=function(a,b){try{a.g.PB(a,b),a.g.lf(4)}catch(c){}},ECa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;DCa(a,b,function(e){e?c(!0):g.w.setTimeout(function(){ECa(a,b,c,d,f)},f)})}},DCa=function(a,b,c){var d=new window.Image;
d.onload=function(){try{V6(d),c(!0)}catch(e){}};
d.onerror=function(){try{V6(d),c(!1)}catch(e){}};
d.onabort=function(){try{V6(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{V6(d),c(!1)}catch(e){}};
g.w.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
d.src=a},V6=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},FCa=function(a){this.g=a;
this.l=new J6},GCa=function(a){var b=W6(a.g,a.sk,"/mail/images/cleardot.gif");
m6(b);ECa(b.toString(),5E3,(0,g.z)(a.CH,a),3,2E3);a.lf(1)},Y6=function(a){var b=a.g.H;
if(null!=b)O6(5),b?(O6(11),X6(a.g,a,!1)):(O6(12),X6(a.g,a,!0));else if(a.ne=new K6(a,void 0,void 0,void 0),a.ne.Vh=a.gr,b=a.g,b=W6(b,b.Ol()?a.Rk:null,a.jr),O6(5),!g.yd||g.tc(10))n6(b,"TYPE","xmlhttp"),L6(a.ne,b,!1,a.Rk,!1);else{n6(b,"TYPE","html");var c=a.ne;a=!!a.Rk;c.oj=3;c.Vg=m6(b.clone());BCa(c,a)}},Z6=function(a,b,c){this.g=1;
this.l=[];this.A=[];this.B=new J6;this.F=a||null;this.H=null!=b?b:null;this.C=c||!1},HCa=function(a,b){this.g=a;
this.map=b;this.context=null},ICa=function(a){g.ef.call(this,"statevent",a)},JCa=function(a,b){g.ef.call(this,"timingevent",a);
this.size=b},KCa=function(a){g.ef.call(this,"serverreachability",a)},NCa=function(a){LCa(a);
if(3==a.g){var b=a.Al++,c=a.un.clone();g.Um(c,"SID",a.o);g.Um(c,"RID",b);g.Um(c,"TYPE","terminate");$6(a,c);b=new K6(a,a.o,b,void 0);b.oj=2;b.Vg=m6(c.clone());(new window.Image).src=b.Vg;b.Tj=(0,g.F)();M6(b)}MCa(a)},OCa=function(a){a.XH(1,0);
a.un=W6(a,null,a.fr);a7(a)},LCa=function(a){a.Mg&&(a.Mg.abort(),a.Mg=null);
a.sc&&(a.sc.cancel(),a.sc=null);a.jg&&(g.w.clearTimeout(a.jg),a.jg=null);b7(a);a.Sd&&(a.Sd.cancel(),a.Sd=null);a.Og&&(g.w.clearTimeout(a.Og),a.Og=null)},PCa=function(a,b){if(0==a.g)throw Error("Invalid operation: sending map when state is closed");
a.l.push(new HCa(a.FO++,b));2!=a.g&&3!=a.g||a7(a)},a7=function(a){a.Sd||a.Og||(a.Og=T6((0,g.z)(a.UB,a),0),a.cj=0)},RCa=function(a,b){if(1==a.g){if(!b){a.Al=Math.floor(1E5*Math.random());
var c=a.Al++,d=new K6(a,"",c,void 0);d.Vh=null;var e=c7(a),f=a.un.clone();g.Um(f,"RID",c);g.Um(f,"CVER","1");$6(a,f);wCa(d,f,e);a.Sd=d;a.g=2}}else 3==a.g&&(b?QCa(a,b):0==a.l.length||a.Sd||QCa(a))},QCa=function(a,b){if(b)if(6<a.Kh){a.l=a.A.concat(a.l);
a.A.length=0;var c=a.Al-1;var d=c7(a)}else c=b.F,d=b.xi;else c=a.Al++,d=c7(a);var e=a.un.clone();g.Um(e,"SID",a.o);g.Um(e,"RID",c);g.Um(e,"AID",a.Bj);$6(a,e);c=new K6(a,a.o,c,a.cj+1);c.Vh=null;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.Sd=c;wCa(c,e,d)},$6=function(a,b){if(a.nd){var c=a.nd.Gx();
c&&g.Kb(c,function(a,c){g.Um(b,c,a)})}},c7=function(a){var b=Math.min(a.l.length,1E3),c=["count="+b];
if(6<a.Kh&&0<b){var d=a.l[0].g;c.push("ofs="+d)}else d=0;for(var e=0;e<b;e++){var f=a.l[e].g,k=a.l[e].map;f=6>=a.Kh?e:f-d;try{g.Kb(k,function(a,b){c.push("req"+f+"_"+b+"="+(0,window.encodeURIComponent)(a))})}catch(l){c.push("req"+f+"_type="+(0,window.encodeURIComponent)("_badmap"))}}a.A=a.A.concat(a.l.splice(0,b));
return c.join("&")},SCa=function(a){a.sc||a.jg||(a.D=1,a.jg=T6((0,g.z)(a.TB,a),0),a.Pi=0)},d7=function(a){if(a.sc||a.jg||3<=a.Pi)return!1;
a.D++;a.jg=T6((0,g.z)(a.TB,a),TCa(a,a.Pi));a.Pi++;return!0},X6=function(a,b,c){a.wp=c;
a.Jf=b.qg;a.C||OCa(a)},b7=function(a){null!=a.Mh&&(g.w.clearTimeout(a.Mh),a.Mh=null)},TCa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},e7=function(a,b){if(2==b||9==b){var c=null;
a.nd&&(c=null);var d=(0,g.z)(a.FU,a);c||(c=new g.Lm("//www.google.com/images/cleardot.gif"),m6(c));DCa(c.toString(),1E4,d)}else O6(2);UCa(a,b)},UCa=function(a,b){a.g=0;
a.nd&&a.nd.Bw(b);MCa(a);LCa(a)},MCa=function(a){a.g=0;
a.Jf=-1;if(a.nd)if(0==a.A.length&&0==a.l.length)a.nd.pq();else{g.Ya(a.A);var b=g.Ya(a.l);a.A.length=0;a.l.length=0;a.nd.pq(b)}},W6=function(a,b,c){var d=g.Vm(c);
if(""!=d.l)b&&g.Nm(d,b+"."+d.l),g.Om(d,d.B);else{var e=window.location;d=UBa(e.protocol,b?b+"."+e.hostname:e.hostname,e.port,c)}a.Dk&&g.Kb(a.Dk,function(a,b){g.Um(d,b,a)});
g.Um(d,"VER",a.Kh);$6(a,d);return d},T6=function(a,b){if(!g.Aa(a))throw Error("Fn must not be null and must be a function");
return g.w.setTimeout(function(){a()},b)},O6=function(a){f7.dispatchEvent(new ICa(f7,a))},VCa=function(){},WCa=function(a,b){this.action=a;
this.params=b||{}},g7=function(a,b){g.K.call(this);
this.g=new g.mu(this.GS,0,this);g.L(this,this.g);this.ad=5E3;this.l=0;if(g.Aa(a))b&&(a=(0,g.z)(a,b));else if(a&&g.Aa(a.handleEvent))a=(0,g.z)(a.handleEvent,a);else throw Error("Invalid listener argument");this.o=a},h7=function(a,b,c){this.K=a;
this.C=b;this.o=new g.iD;this.l=new g7(this.nV,this);this.g=this.Ua=null;this.I=!1;this.B=null;this.H="";this.F=this.A=0;this.D=[];this.L=c||!1},XCa=function(a){return{firstTestResults:[""],
secondTestResults:!a.g.wp,sessionId:a.g.o,arrayId:a.g.Bj}},YCa=function(a,b){a.F=b||0;
a.l.stop();a.g&&(3==a.g.g&&RCa(a.g),NCa(a.g));a.F=0},i7=function(a){return!!a.g&&3==a.g.g},ZCa=function(a,b){(a.C.loungeIdToken=b)||a.l.stop()},j7=function(a){this.port=this.domain="";
this.g="/api/lounge";this.l=!0;a=a||window.document.location.href;var b=g.Kg(a)||"";b&&(this.port=":"+b);this.domain=g.Jg(a)||"";a=g.Ib;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.Ab(a,"10.0")&&(this.l=!1))},k7=function(a,b){var c=a.g;
if(g.t(void 0)?0:a.l)c="https://"+a.domain+a.port+a.g;return g.Ug(c+b,{})},l7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Ea(a.A,d,!0),onError:g.Ea(a.o,e),sd:g.Ea(a.B,e)};c&&(a.Kb=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.GE(b,a)},cDa=function(){var a=$Ca;
aDa();m7.push(a);bDa(m7)},n7=function(a,b){aDa();
var c=m7,d=dDa(a,String(b));g.Ra(c)?eDa(d):(bDa(c),(0,g.B)(c,function(a){a(d)}))},aDa=function(){m7||(m7=g.x("yt.mdx.remote.debug.handlers_")||[],g.va("yt.mdx.remote.debug.handlers_",m7,void 0))},eDa=function(a){var b=(o7+1)%50;
o7=b;p7[b]=a;q7||(q7=49==b)},bDa=function(a){var b=p7;
if(b[0]){var c=o7,d=q7?c:-1;do{d=(d+1)%50;var e=b[d];(0,g.B)(a,function(a){a(e)})}while(d!=c);
p7=Array(50);o7=-1;q7=!1}},dDa=function(a,b){var c=((0,g.F)()-fDa)/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("")},r7=function(a){g.aG.call(this);
this.D=a;this.g=[]},gDa=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c){var d=c.name;c.id=b.id||c.id;c.name=b.name;c.token=b.token;c.uuid=b.uuid||c.uuid;return c.name!=d}a.g.push(b);return!0},hDa=function(a,b){var c=a.g.length!=b.length;
a.g=(0,g.Ld)(a.g,function(a){return!!u6(b,a)});
for(var d=0,e=b.length;d<e;d++)c=gDa(a,b[d])||c;return c},iDa=function(a,b){var c=a.g.length;
a.g=(0,g.Ld)(a.g,function(a){return!(a||b?!a!=!b?0:a.id==b.id:1)});
return a.g.length<c},s7=function(a,b,c,d){g.aG.call(this);
this.C=a;this.B=b;this.o=c;this.A=d;this.l=0;this.g=null;this.va=window.NaN},u7=function(a){r7.call(this,"LocalScreenService");
this.o=a;this.l=window.NaN;t7(this);this.info("Initializing with "+s6(this.g))},jDa=function(a){if(a.g.length){var b=(0,g.G)(a.g,function(a){return a.id}),c=k7(a.o,"/pairing/get_lounge_token_batch");
l7(a.o,c,{screen_ids:b.join(",")},(0,g.z)(a.DI,a),(0,g.z)(a.CI,a))}},t7=function(a){var b=bCa(hCa());
b=(0,g.Ld)(b,function(a){return!a.uuid});
return hDa(a,b)},v7=function(a,b){jCa((0,g.G)(a.g,$Ba));
b&&iCa()},x7=function(a,b){g.aG.call(this);
this.C=b;var c=g.hH("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.C(),f=0,k=e.length;f<k;++f){var l=e[f].id;d[l]=g.Qa(c,l)}this.g=d;this.B=a;this.o=this.A=window.NaN;this.l=null;w7("Initialized with "+g.Bg(this.g))},kDa=function(a,b,c){var d=k7(a.B,"/pairing/get_screen_availability");
l7(a.B,d,{lounge_token:b.token},(0,g.z)(function(a){a=a.screens||[];for(var d=0,e=a.length;d<e;++d)if(a[d].loungeToken==b.token){c("online"==a[d].status);return}c(!1)},a),(0,g.z)(function(){c(!1)},a))},y7=function(a,b){a:if(g.Pb(b)!=g.Pb(a.g))var c=!1;
else{c=g.Rb(b);for(var d=0,e=c.length;d<e;++d)if(!a.g[c[d]]){c=!1;break a}c=!0}c||(w7("Updated online screens: "+g.Bg(a.g)),a.g=b,a.T("screenChange"));lDa(a)},z7=function(a){(0,window.isNaN)(a.o)||g.kE(a.o);
a.o=g.iE((0,g.z)(a.du,a),0<a.A&&a.A<(0,g.F)()?2E4:1E4)},w7=function(a){n7("OnlineScreenService",a)},mDa=function(a){var b={};
(0,g.B)(a.C(),function(a){a.token?b[a.token]=a.id:this.dc("Requesting availability of screen w/o lounge token.")});
return b},lDa=function(a){a=g.Rb(g.Lb(a.g,function(a){return a}));
g.ib(a);a.length?g.gH("yt-remote-online-screen-ids",a.join(","),60):g.iH("yt-remote-online-screen-ids")},A7=function(a){r7.call(this,"ScreenService");
this.C=a;this.l=this.o=null;this.A=[];this.B={};nDa(this)},pDa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.B[b]);var k=a.ge();if(k=(c?v6(k,c):null)||v6(k,b)){k.uuid=b;var l=B7(a,k);kDa(a.l,l,function(a){e(a?l:null)})}else c?oDa(a,c,(0,g.z)(function(a){var f=B7(this,new p6({name:d,
screenId:c,loungeToken:a,dialId:b||""}));kDa(this.l,f,function(a){e(a?f:null)})},a),f):e(null)},qDa=function(a,b){for(var c=0,d=a.g.length;c<d;++c)if(a.g[c].name==b)return a.g[c];
return null},oDa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={Kb:{screen_ids:b},method:"POST",context:a,onSuccess:function(a,e){var f=e&&e.screens||[];f[0]&&f[0].screenId==b?c(f[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.GE(k7(a.C,"/pairing/get_lounge_token_batch"),e)},rDa=function(a){a.g=a.o.ge();
var b=a.B,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.g.length;b<d;++b){var e=a.g[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+s6(a.g))},nDa=function(a){C7(a);
a.o=new u7(a.C);a.o.subscribe("screenChange",(0,g.z)(a.TI,a));rDa(a);a.A=bCa(g.hH("yt-remote-automatic-screen-cache")||[]);C7(a);a.info("Initializing automatic screens: "+s6(a.A));a.l=new x7(a.C,(0,g.z)(a.ge,a,!0));a.l.subscribe("screenChange",(0,g.z)(function(){this.T("onlineScreenChange")},a))},B7=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=v6(a.A,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.A.push(b),g.gH("yt-remote-automatic-screen-cache",(0,g.G)(a.A,$Ba)));C7(a);a.B[b.uuid]=b.id;g.gH("yt-remote-device-id-map",a.B,31536E3);return b},C7=function(a){a.B=g.hH("yt-remote-device-id-map")||{}},D7=function(a,b,c){g.aG.call(this);
this.L=c;this.H=a;this.l=b;this.o=null},E7=function(a,b){n7(a.L,b)},F7=function(a,b){D7.call(this,a,b,"CastSession");
this.g=null;this.A=0;this.C=(0,g.z)(this.tV,this);this.B=(0,g.z)(this.tT,this);this.A=g.iE((0,g.z)(function(){sDa(this,null)},this),12E4)},tDa=function(a){a.info("sendYoutubeMessage_: getMdxSessionStatus "+g.Bg(void 0));
var b={type:"getMdxSessionStatus"};a.g?a.g.sendMessage("urn:x-cast:com.google.youtube.mdx",b,g.y,(0,g.z)(function(){E7(this,"Failed to send message: getMdxSessionStatus.")},a)):E7(a,"Sending yt message without session: "+g.Bg(b))},sDa=function(a,b){g.kE(a.A);
if(b){if(a.info("onConnectedScreenId_: Received screenId: "+b),!a.o||a.o.id!=b){var c=(0,g.z)(a.wo,a),d=(0,g.z)(a.ke,a);a.Rx(b,c,d,5)}}else a.ke(Error("Waiting for session status timed out."))},G7=function(a,b,c){D7.call(this,a,b,"DialSession");
this.A=this.F=null;this.I="";this.N=c;this.B=null;this.D=g.y;this.C=window.NaN;this.K=(0,g.z)(this.wV,this);this.g=g.y},uDa=function(a){a.g=a.H.cE(a.I,a.l.label,a.l.friendlyName,(0,g.z)(function(a){this.g=g.y;
this.wo(a)},a),(0,g.z)(function(a){this.g=g.y;
this.ke(a)},a))},vDa=function(a){var b={};
b.pairingCode=a.I;b.theme=a.N;if(a.B){var c=a.B.currentTime||0;b.v=a.B.videoId;b.t=c}lCa()&&(b.env_useStageMdx=1);return g.Sg(b)},H7=function(a,b){D7.call(this,a,b,"ManualSession");
this.g=g.iE((0,g.z)(this.Cj,this,null),150)},I7=function(a,b,c,d){g.aG.call(this);
this.l=a;this.D=b||"233637DE";this.C=c||"cl";this.F=d||!1;this.g=null;this.B=!1;this.o=[];this.A=(0,g.z)(this.TR,this)},wDa=function(a,b){return b?g.Ma(a.o,function(a){return q6(b,a.label)},a):null},J7=function(a){n7("Controller",a)},$Ca=function(a){window.chrome&&window.chrome.cast&&window.chrome.cast.logMessage&&window.chrome.cast.logMessage(a)},K7=function(a){return a.B||!!a.o.length||!!a.g},L7=function(a,b,c){b!=a.g&&(g.cf(a.g),(a.g=b)?(c?a.T("yt-remote-cast2-receiver-resumed",b.l):a.T("yt-remote-cast2-receiver-selected",
b.l),b.subscribe("sessionScreen",(0,g.z)(a.RB,a,b)),b.o?a.T("yt-remote-cast2-session-change",b.o):c&&a.g.Cj(null)):a.T("yt-remote-cast2-session-change",null))},xDa=function(a){var b=a.l.bE(),c=a.g&&a.g.l;
a=(0,g.G)(b,function(a){c&&q6(a,c.label)&&(c=null);var b=a.uuid?a.uuid:a.id,d=wDa(this,a);d?(d.label=b,d.friendlyName=a.name):(d=new window.chrome.cast.Receiver(b,a.name),d.receiverType=window.chrome.cast.ReceiverType.CUSTOM);return d},a);
c&&(c.receiverType!=window.chrome.cast.ReceiverType.CUSTOM&&(c=new window.chrome.cast.Receiver(c.label,c.friendlyName),c.receiverType=window.chrome.cast.ReceiverType.CUSTOM),a.push(c));return a},DDa=function(a,b,c,d,e,f,k){yDa()?zDa(b,e,f,k)&&(N7(!0),window.chrome&&window.chrome.cast&&window.chrome.cast.isAvailable?ADa(a,c):(window.__onGCastApiAvailable=function(b,d){b?ADa(a,c):(O7("Failed to load cast API: "+d),P7(!1),N7(!1),g.iH("yt-remote-cast-available"),g.iH("yt-remote-cast-receiver"),BDa(),
c(!1))},d?window.spf?window.spf.script.load("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js","",void 0):oCa():G6("CriOS")?tCa():G6("Android")&&G6("Chrome/")&&window.navigator.presentation?uCa():window.chrome&&window.navigator.presentation&&!G6("Edge")?(H6(),D6(CDa.map(rCa))):E6())):M7("Cannot initialize because not running Chrome")},BDa=function(){M7("dispose");
var a=Q7();a&&a.dispose();g.va("yt.mdx.remote.cloudview.instance_",null,void 0);EDa(!1);g.nG(R7);R7.length=0},S7=function(){return!!g.hH("yt-remote-cast-installed")},FDa=function(){var a=g.hH("yt-remote-cast-receiver");
return a?a.friendlyName:null},GDa=function(){M7("clearCurrentReceiver");
g.iH("yt-remote-cast-receiver")},HDa=function(){return S7()?Q7()?Q7().getCastSession():(O7("getCastSelector: Cast is not initialized."),null):(O7("getCastSelector: Cast API is not installed!"),null)},U7=function(){S7()?Q7()?T7()?(M7("Requesting cast selector."),Q7().requestSession()):(M7("Wait for cast API to be ready to request the session."),R7.push(g.mG("yt-remote-cast2-api-ready",U7))):O7("requestCastSelector: Cast is not initialized."):O7("requestCastSelector: Cast API is not installed!")},V7=
function(a,b){T7()?Q7().setConnectedScreenStatus(a,b):O7("setConnectedScreenStatus called before ready.")},yDa=function(){var a=0<=g.Ib.search(/ (CrMo|Chrome|CriOS)\//);
return g.QI||a},IDa=function(a,b){Q7().init(a,b)},zDa=function(a,b,c,d){var e=!1;
Q7()||(a=new I7(a,b,c,d),a.subscribe("yt-remote-cast2-availability-change",function(a){g.gH("yt-remote-cast-available",a);g.qG("yt-remote-cast2-availability-change",a)}),a.subscribe("yt-remote-cast2-receiver-selected",function(a){M7("onReceiverSelected: "+a.friendlyName);
g.gH("yt-remote-cast-receiver",a);g.qG("yt-remote-cast2-receiver-selected",a)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(a){M7("onReceiverResumed: "+a.friendlyName);
g.gH("yt-remote-cast-receiver",a)}),a.subscribe("yt-remote-cast2-session-change",function(a){M7("onSessionChange: "+r6(a));
a||g.iH("yt-remote-cast-receiver");g.qG("yt-remote-cast2-session-change",a)}),g.va("yt.mdx.remote.cloudview.instance_",a,void 0),e=!0);
M7("cloudview.createSingleton_: "+e);return e},Q7=function(){return g.x("yt.mdx.remote.cloudview.instance_")},ADa=function(a,b){P7(!0);
N7(!1);IDa(a,function(a){a?(EDa(!0),g.pG("yt-remote-cast2-api-ready")):(O7("Failed to initialize cast API."),P7(!1),g.iH("yt-remote-cast-available"),g.iH("yt-remote-cast-receiver"),BDa());b(a)})},M7=function(a){n7("cloudview",a)},O7=function(a){n7("cloudview",a)},P7=function(a){M7("setCastInstalled_ "+a);
g.gH("yt-remote-cast-installed",a)},T7=function(){return!!g.x("yt.mdx.remote.cloudview.apiReady_")},EDa=function(a){M7("setApiReady_ "+a);
g.va("yt.mdx.remote.cloudview.apiReady_",a,void 0)},N7=function(a){g.va("yt.mdx.remote.cloudview.initializing_",a,void 0)},W7=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.g=-1;this.muted=!1;this.audioTrackId=null;this.D=this.F=0;this.l=null;this.hasNext=this.Mf=!1;this.I=this.H=this.o=this.B=0;this.A=window.NaN;this.C=!1;this.reset(a)},X7=function(a){a.audioTrackId=null;
a.l=null;a.g=-1;a.Mf=!1;a.hasNext=!1;a.F=0;a.D=(0,g.F)();a.B=0;a.o=0;a.H=0;a.I=0;a.A=window.NaN;a.C=!1},Y7=function(a){return a.gb()?((0,g.F)()-a.D)/1E3:0},Z7=function(a,b){a.F=b;
a.D=(0,g.F)()},$7=function(a){switch(a.g){case 1:case 1081:return((0,g.F)()-a.D)/1E3+a.F;
case -1E3:return 0}return a.F},a8=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&X7(a)},b8=function(a){var b={};
b.index=a.index;b.listId=a.listId;b.videoId=a.videoId;b.playerState=a.g;b.volume=a.volume;b.muted=a.muted;b.audioTrackId=a.audioTrackId;b.trackData=g.dc(a.l);b.hasPrevious=a.Mf;b.hasNext=a.hasNext;b.playerTime=a.F;b.playerTimeAt=a.D;b.seekableStart=a.B;b.seekableEnd=a.o;b.duration=a.H;b.loadedTime=a.I;b.liveIngestionTime=a.A;return b},d8=function(a,b){g.aG.call(this);
this.g=0;this.A=a;this.C=[];this.B=new g.zC;this.o=this.l=null;this.H=(0,g.z)(this.pP,this);this.D=(0,g.z)(this.Dl,this);this.F=(0,g.z)(this.oP,this);this.I=(0,g.z)(this.BP,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.Uu,this),JDa(this))):c=3;0!=c&&(b?this.Uu(c):g.iE((0,g.z)(function(){this.Uu(c)},this),0));
var d=HDa();d&&c8(this,d);this.subscribe("yt-remote-cast2-session-change",this.I)},e8=function(a){return new W7(a.A.getPlayerContextData())},JDa=function(a){(0,g.B)("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(a){this.C.push(this.A.subscribe(a,g.Ea(this.OR,a),this))},a)},KDa=function(a){(0,g.B)(a.C,function(a){this.A.unsubscribeByKey(a)},a);
a.C.length=0},f8=function(a,b){50>a.B.Ac()&&g.BC(a.B,b)},h8=function(a,b,c){var d=e8(a);
Z7(d,c);-1E3!=d.g&&(d.g=b);g8(a,d)},i8=function(a,b,c){a.A.sendMessage(b,c)},g8=function(a,b){KDa(a);
a.A.setPlayerContextData(b8(b));JDa(a)},c8=function(a,b){a.o&&(a.o.removeUpdateListener(a.H),a.o.removeMediaListener(a.D),a.Dl(null));
a.o=b;a.o&&(n7("CP","Setting cast session: "+a.o.sessionId),a.o.addUpdateListener(a.H),a.o.addMediaListener(a.D),a.o.media.length&&a.Dl(a.o.media[0]))},LDa=function(a){var b=a.l.media,c=a.l.customData;
if(b&&c){var d=e8(a);b.contentId!=d.videoId&&n7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.g=c.playerState;Z7(d,a.l.getEstimatedTime());g8(a,d)}else n7("CP","No cast media video. Ignoring state update.")},j8=function(a,b,c){return(0,g.z)(function(a){this.dc("Failed to "+b+" with cast v2 channel. Error code: "+a.code);
a.code!=window.chrome.cast.ErrorCode.TIMEOUT&&(this.dc("Retrying "+b+" using MDx browser channel."),i8(this,b,c))},a)},k8=function(a,b,c){g.aG.call(this);
this.B=window.NaN;this.N=!1;this.I=this.H=this.K=this.L=window.NaN;this.R=[];this.A=this.D=this.o=this.Va=this.g=null;this.ma=a;this.R.push(g.KF(window,"beforeunload",(0,g.z)(this.uI,this)));this.l=[];this.Va=new W7;this.Y=b.id;this.g=MDa(this,c);this.g.subscribe("handlerOpened",this.tP,this);this.g.subscribe("handlerClosed",this.qP,this);this.g.subscribe("handlerError",this.rP,this);this.g.subscribe("handlerMessage",this.sP,this);ZCa(this.g,b.token);this.subscribe("remoteQueueChange",function(){var a=
this.Va.videoId;g.jH()&&g.gH("yt-remote-session-video-id",a)},this)},l8=function(a){n7("conn",a)},MDa=function(a,b){return new h7(k7(a.ma,"/bc"),b)},m8=function(a,b){a.T("proxyStateChange",b)},NDa=function(a){a.B=g.iE((0,g.z)(function(){l8("Connecting timeout");
this.C(1)},a),2E4)},n8=function(a){g.kE(a.B);
a.B=window.NaN},o8=function(a){g.kE(a.L);
a.L=window.NaN},ODa=function(a){p8(a);
a.K=g.iE((0,g.z)(function(){q8(this,"getNowPlaying")},a),2E4)},p8=function(a){g.kE(a.K);
a.K=window.NaN},QDa=function(a,b){b&&(n8(a),o8(a));
b==(i7(a.g)&&(0,window.isNaN)(a.B))?b&&(m8(a,1),q8(a,"getSubtitlesTrack")):b?(a.W()&&a.Va.reset(),m8(a,1),q8(a,"getNowPlaying"),PDa(a)):a.C(1)},RDa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.Va.videoId&&(g.Yb(b.params)?a.Va.l=null:a.Va.l=b.params,a.T("remotePlayerChange"))},SDa=function(a,b){var c=b.params.videoId||b.params.video_id,d=(0,window.parseInt)(b.params.currentIndex,10);
a.Va.listId=b.params.listId||a.Va.listId;a8(a.Va,c,d);a.T("remoteQueueChange")},UDa=function(a,b){b.params=b.params||{};
SDa(a,b);TDa(a,b);a.T("autoplayDismissed")},TDa=function(a,b){var c=(0,window.parseInt)(b.params.currentTime||b.params.current_time,10);
Z7(a.Va,(0,window.isNaN)(c)?0:c);c=(0,window.parseInt)(b.params.state,10);c=(0,window.isNaN)(c)?-1:c;-1==c&&-1E3==a.Va.g&&(c=-1E3);a.Va.g=c;c=Number(b.params.loadedTime);a.Va.I=(0,window.isNaN)(c)?0:c;c=Number(b.params.duration);a.Va.H=(0,window.isNaN)(c)?0:c;c=a.Va;var d=Number(b.params.liveIngestionTime);c.A=d;c.C=(0,window.isNaN)(d)?!1:!0;c=a.Va;d=Number(b.params.seekableStartTime);var e=Number(b.params.seekableEndTime);c.B=(0,window.isNaN)(d)?0:d;c.o=(0,window.isNaN)(e)?0:e;1==a.Va.g?ODa(a):p8(a);
a.T("remotePlayerChange")},VDa=function(a,b){if(-1E3!=a.Va.g){var c=1085;
switch((0,window.parseInt)(b.params.adState,10)){case 1:c=1081;break;case 2:c=1084;break;case 0:c=1083}a.Va.g=c;c=(0,window.parseInt)(b.params.currentTime,10);Z7(a.Va,(0,window.isNaN)(c)?0:c);a.T("remotePlayerChange")}},WDa=function(a,b){var c="true"==b.params.muted;
a.Va.volume=(0,window.parseInt)(b.params.volume,10);a.Va.muted=c;a.T("remotePlayerChange")},XDa=function(a,b){a.D=b.params.videoId;
a.T("nowAutoplaying",(0,window.parseInt)(b.params.timeout,10))},YDa=function(a,b){var c="true"==b.params.hasNext;
a.Va.Mf="true"==b.params.hasPrevious;a.Va.hasNext=c;a.T("previousNextChange")},PDa=function(a){g.kE(a.I);
a.I=g.iE((0,g.z)(a.C,a,1),864E5)},q8=function(a,b,c){c?l8("Sending: action="+b+", params="+g.Bg(c)):l8("Sending: action="+b);
a.g.sendMessage(b,c)},r8=function(a){r7.call(this,"ScreenServiceProxy");
this.Zc=a;this.l=[];this.l.push(this.Zc.$_s("screenChange",(0,g.z)(this.rV,this)));this.l.push(this.Zc.$_s("onlineScreenChange",(0,g.z)(this.oR,this)))},cEa=function(a){var b={device:"Desktop",
app:"youtube-desktop"};b=g.cE("MDX_CONFIG")||b;dCa();z6();s8||(s8=new j7(b?b.loungeApiHost:void 0),lCa()&&(s8.g="/api/loungedev"));t8||(t8=g.x("yt.mdx.remote.deferredProxies_")||[],g.va("yt.mdx.remote.deferredProxies_",t8,void 0));ZDa();var c=u8();if(!c){var d=new A7(s8);g.va("yt.mdx.remote.screenService_",d,void 0);c=u8();var e=!1,f=void 0,k=void 0,l=!1;b&&(e=!!b.loadCastApiSetupScript,f=b.appId,k=b.theme,l=!!b.disableDial);DDa(a,d,function(a){a?v8()&&V7(v8(),"YouTube TV"):d.subscribe("onlineScreenChange",
function(){g.qG("yt-remote-receiver-availability-change")})},e,f,k,l)}b&&!g.x("yt.mdx.remote.initialized_")&&(g.va("yt.mdx.remote.initialized_",!0,void 0),w8("Initializing: "+g.Bg(b)),x8.push(g.mG("yt-remote-cast2-availability-change",function(){g.qG("yt-remote-receiver-availability-change")})),x8.push(g.mG("yt-remote-cast2-receiver-selected",function(){y8(null);
g.qG("yt-remote-auto-connect","cast-selector-receiver")})),x8.push(g.mG("yt-remote-cast2-receiver-resumed",function(){g.qG("yt-remote-receiver-resumed","cast-selector-receiver")})),x8.push(g.mG("yt-remote-cast2-session-change",$Da)),x8.push(g.mG("yt-remote-connection-change",function(a){a?V7(v8(),"YouTube TV"):z8()||(V7(null,null),GDa())})),a=A8(),b.isAuto&&(a.id+="#dial"),g.gG("desktop_enable_autoplay")&&(a.capabilities=["atp"]),a.name=b.device,a.app=b.app,(k=b.theme)&&(a.theme=k),w8(" -- with channel params: "+
g.Bg(a)),aEa(a),c.start(),v8()||bEa())},eEa=function(){var a=dEa();
S7()&&g.hH("yt-remote-cast-available")&&a.push({key:"cast-selector-receiver",name:"Cast..."});return a},dEa=function(){var a=u8().Zc.$_gos();
var b=B8();b&&C8()&&(u6(a,b)||a.push(b));return cCa(a)},D8=function(){var a=fEa();
!a&&S7()&&FDa()&&(a={key:"cast-selector-receiver",name:FDa()});return a},fEa=function(){var a=dEa(),b=B8();
b||(b=z8());return g.Ma(a,function(a){return b&&q6(b,a.key)?!0:!1})},B8=function(){var a=v8();
if(!a)return null;var b=u8().ge();return v6(b,a)},$Da=function(a){w8("remote.onCastSessionChange_: "+r6(a));
if(a){var b=B8();b&&b.id==a.id?V7(b.id,"YouTube TV"):(b&&E8(),F8(a,1))}else C8()&&E8()},E8=function(){T7()?Q7().stopSession():O7("stopSession called before API ready.");
var a=C8();a&&(a.disconnect(1),G8(null))},H8=function(){var a=C8();
return!!a&&3!=a.getProxyState()},w8=function(a){n7("remote",a)},u8=function(){if(!I8){var a=g.x("yt.mdx.remote.screenService_");
I8=a?new r8(a):null}return I8},v8=function(){return g.x("yt.mdx.remote.currentScreenId_")},gEa=function(a){g.va("yt.mdx.remote.currentScreenId_",a,void 0)},hEa=function(){return g.x("yt.mdx.remote.connectData_")},y8=function(a){g.va("yt.mdx.remote.connectData_",a,void 0)},C8=function(){return g.x("yt.mdx.remote.connection_")},G8=function(a){var b=C8();
y8(null);a||gEa("");g.va("yt.mdx.remote.connection_",a,void 0);t8&&((0,g.B)(t8,function(b){b(a)}),t8.length=0);
b&&!a?g.qG("yt-remote-connection-change",!1):!b&&a&&g.qG("yt-remote-connection-change",!0)},z8=function(){var a=g.jH();
if(!a)return null;var b=u8().ge();return v6(b,a)},F8=function(a,b){B8()&&B8();
gEa(a.id);var c=new k8(s8,a,A8());c.connect(b,hEa());c.subscribe("beforeDisconnect",function(a){g.qG("yt-remote-before-disconnect",a)});
c.subscribe("beforeDispose",function(){C8()&&G8(null)});
G8(c)},bEa=function(){var a=z8();
a?(w8("Resume connection to: "+r6(a)),F8(a,0)):(A6(),GDa(),w8("Skipping connecting because no session screen found."))},ZDa=function(){var a=A8();
if(g.Yb(a)){a=y6();var b=g.hH("yt-remote-session-name")||"",c=g.hH("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.va("yt.mdx.remote.channelParams_",a,void 0)}},A8=function(){return g.x("yt.mdx.remote.channelParams_")||{}},aEa=function(a){a?(g.gH("yt-remote-session-app",a.app),g.gH("yt-remote-session-name",a.name)):(g.iH("yt-remote-session-app"),g.iH("yt-remote-session-name"));
g.va("yt.mdx.remote.channelParams_",a,void 0)},J8=function(a,b,c){g.K.call(this);
this.F=a;this.l=b;this.o=new g.YF(this);g.L(this,this.o);this.o.O(b,"onCaptionsTrackListChanged",this.HQ);this.o.O(b,"captionschanged",this.nP);this.o.O(b,"captionssettingschanged",this.pD);this.o.O(b,"videoplayerreset",this.xo);this.o.O(b,"mdxautoplaycancel",this.BH);this.R=this.o.O(b,"onVolumeChange",this.BB);this.D=!1;this.g=c;c.subscribe("proxyStateChange",this.OB,this);c.subscribe("remotePlayerChange",this.Gl,this);c.subscribe("remoteQueueChange",this.xo,this);c.subscribe("autoplayUpNext",this.lB,
this);c.subscribe("previousNextChange",this.LB,this);c.subscribe("nowAutoplaying",this.DB,this);c.subscribe("autoplayDismissed",this.kB,this);this.suggestion=null;this.H=new g.DP(64);this.A=new g.mu(this.lD,500,this);g.L(this,this.A);this.B=new g.mu(this.mD,1E3,this);g.L(this,this.B);this.K=new I6(this.UU,0,this);g.L(this,this.K);this.C={};this.L=new g.mu(this.MD,1E3,this);g.L(this,this.L);this.I=new g.gl(this.oN,1E3,this);g.L(this,this.I);this.N=g.y;this.pD();this.xo();this.Gl()},K8=function(a,b){var c=
a.F,d=a.l.getVideoData().lengthSeconds;
c.H=b||0;c.g.T("progresssync",b,d)},iEa=function(a){K8(a,0);
a.A.stop();L8(a,new g.DP(64))},N8=function(a,b){if(M8(a)&&!a.D){var c=null;
b&&(c={style:a.l.ni()},g.fc(c,b));a.g.cD(a.l.getVideoData(1).videoId,c);a.C=e8(a.g).l}},O8=function(a,b){var c=a.l.Wf();
if(c){var d=c.ee();var e=c.listId.toString()}var f=a.l.getVideoData(1);c=a.g;var k=f.videoId,l=d;d=f.playerParams;var m=f.xj;f=TBa(f);var n=e8(c);l=l||0;var q={videoId:k,currentIndex:l};a8(n,k,l);g.t(b)&&(Z7(n,b),q.currentTime=b);g.t(e)&&(q.listId=e);null!=d&&(q.playerParams=d);null!=m&&(q.clickTrackingParams=m);null!=f&&(q.locationInfo=g.Bg(f));i8(c,"setPlaylist",q);e||g8(c,n);L8(a,new g.DP(1))},jEa=function(a,b){if(b){var c=a.l.uc("captions","tracklist",{Ny:1});
c&&c.length?(a.l.Gd("captions","track",b),a.D=!1):(a.l.Fj("captions"),a.D=!0)}else a.l.Gd("captions","track",{})},M8=function(a){return e8(a.g).videoId==a.l.getVideoData(1).videoId},L8=function(a,b){a.B.stop();
var c=a.H;if(!g.LP(c,b)){var d=g.W(b,2);d!=g.W(a.H,2)&&g.PU(a.l,d);a.H=b;kEa(a.F,c,b)}},P8=function(a){g.U.call(this,{G:"div",
M:"ytp-remote",J:[{G:"div",M:"ytp-remote-display-status",J:[{G:"div",M:"ytp-remote-display-status-icon",J:[g.Apa()]},{G:"div",M:"ytp-remote-display-status-text",J:["{{statustext}}"]}]}]});this.o=new g.CV(this,250);g.L(this,this.o);this.A=a;this.O(a,"presentingplayerstatechange",this.B);lEa(this,g.MU(a))},lEa=function(a,b){if(3==a.A.Qa()){var c={RECEIVER_NAME:a.A.uc("remote","currentReceiver").name};
c=g.W(b,128)?g.T("YTP_MDX_STATUS_ERROR_2",c):b.gb()||g.W(b,4)?g.T("YTP_MDX_STATUS_PLAYING_2",c):g.T("YTP_MDX_STATUS_CONNECTED_2",c);a.updateValue("statustext",c);a.o.show()}else a.o.hide()},Q8=function(a,b){g.MZ.call(this,g.T("YTP_MDX_TITLE"),0,a,b);
this.o=a;this.H={};this.O(a,"onMdxReceiversChange",this.K);this.O(a,"presentingplayerstatechange",this.K);this.K()},R8=function(a){g.jV.call(this,a);
g.lH({YTP_MDX_CAST_SELECTOR:"Cast...",YTP_MDX_MY_COMPUTER:"This computer",YTP_MDX_PLAYER_ERROR:"This video is not available for remote playback.",YTP_MDX_STATUS_CONNECTED_2:"Connected to $RECEIVER_NAME",YTP_MDX_STATUS_ERROR_2:"Error on $RECEIVER_NAME",YTP_MDX_STATUS_PLAYING_2:"Playing on $RECEIVER_NAME",YTP_MDX_TITLE:"Play on"});this.o={key:t6(),name:g.T("YTP_MDX_MY_COMPUTER")};this.B=null;this.C=[];this.I=this.l=null;this.F=[this.o];this.A=this.o;this.D=new g.DP(64);this.H=0;if(!g.XM(g.X(this.g))){a=
this.g;var b=g.YH(a);b&&(b=b.co())&&(b=new Q8(a,b),g.L(this,b));b=new P8(a);g.L(this,b);g.dV(a,b.element,4)}},kEa=function(a,b,c){a.D=c;
a.g.T("presentingplayerstatechange",new g.RP(c,b))},S8=function(a,b){if(b.key!=a.A.key)if(b.key==a.o.key)E8();
else{a.A=b;var c=a.g.getPlaylistId();var d=a.g.getVideoData(1);var e=d.videoId;if(c||e){var f=a.g.Wf();if(f){var k=[];for(var l=0;l<f.getLength();l++)k[l]=f.Wb(l).videoId}else k=[e];f=a.g.getCurrentTime(1);c={videoIds:k,listId:c,videoId:e,playerParams:d.playerParams,clickTrackingParams:d.xj,index:Math.max(a.g.Qz(),0),currentTime:0==f?void 0:f};(d=TBa(d))&&(c.locationInfo=d);d=c}else d=null;w8("Connecting to: "+g.Bg(b));"cast-selector-receiver"==b.key?(y8(d||null),T7()?Q7().setLaunchParams(d||null):
O7("setLaunchParams called before ready.")):!d&&H8()&&v8()==b.key?g.qG("yt-remote-connection-change",!0):(E8(),y8(d||null),d=u8().ge(),(d=v6(d,b.key))&&F8(d,1))}},ACa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"<"},S6={"'":"\\'"},mEa={},ZBa={JW:"atp",d1:"ska",u0:"que",G_:"mus",Z0:"sus",RY:"dsp"};
o6.prototype.Xm=function(){var a=new o6({id:this.id,name:this.name,app:this.app,type:this.type,user:this.username,userAvatarUri:this.avatar,obfuscatedGaiaId:this.obfuscatedGaiaId,theme:this.theme,capabilities:Array.from(this.capabilities.values()).join(","),experiments:Array.from(this.experiments.values()).join(",")});a.o=this.o;a.l=this.l;a.g=this.g};
var B6,x6="",F6=C6("loadGamesSDK")?"/cast_game_sender.js":"/cast_sender.js",sCa=C6("loadCastFramework")||C6("loadCastApplicationFramework"),CDa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.A(I6,g.K);g.h=I6.prototype;g.h.pI=function(a){this.A=arguments;this.g=!1;this.va?this.o=(0,g.F)()+this.ad:this.va=g.vg(this.B,this.ad)};
g.h.stop=function(){this.va&&(g.wg(this.va),this.va=null);this.o=null;this.g=!1;this.A=[]};
g.h.pause=function(){++this.l};
g.h.resume=function(){this.l&&(--this.l,!this.l&&this.g&&(this.g=!1,this.C.apply(null,this.A)))};
g.h.V=function(){this.stop();I6.aa.V.call(this)};
g.h.qI=function(){this.o?(this.va=g.vg(this.B,this.o-(0,g.F)()),this.o=null):(this.va=null,this.l?this.g=!0:(this.g=!1,this.C.apply(null,this.A)))};J6.prototype.stringify=function(a){return g.w.JSON.stringify(a,void 0)};
J6.prototype.parse=function(a){return g.w.JSON.parse(a,void 0)};g.h=K6.prototype;g.h.Vh=null;g.h.sf=!1;g.h.lk=null;g.h.Ou=null;g.h.Tj=null;g.h.oj=null;g.h.Vg=null;g.h.th=null;g.h.xi=null;g.h.Oc=null;g.h.Ul=0;g.h.tf=null;g.h.yp=null;g.h.Wg=null;g.h.Sk=-1;g.h.JC=!0;g.h.Ih=!1;g.h.kr=0;g.h.Io=null;var yCa={},N6={};g.h=K6.prototype;g.h.setTimeout=function(a){this.B=a};
g.h.KT=function(a){a=a.target;var b=this.Io;b&&3==g.zx(a)?b.mj():this.VD(a)};
g.h.VD=function(a){try{if(a==this.Oc)a:{var b=g.zx(this.Oc),c=this.Oc.l,d=this.Oc.getStatus();if(g.yd&&!g.tc(10)||g.Ad&&!g.sc("420+")){if(4>b)break a}else if(3>b||3==b&&!g.gf&&!g.Dx(this.Oc))break a;this.Ih||4!=b||7==c||(8==c||0>=d?this.g.lf(3):this.g.lf(2));U6(this);var e=this.Oc.getStatus();this.Sk=e;var f=g.Dx(this.Oc);(this.sf=200==e)?(4==b&&Q6(this),this.C?(zCa(this,b,f),g.gf&&this.sf&&3==b&&(this.A.U(this.l,"tick",this.GT),this.l.start())):P6(this,f),this.sf&&!this.Ih&&(4==b?this.g.vo(this):
(this.sf=!1,M6(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.Wg=3,O6(13)):(this.Wg=0,O6(14)),Q6(this),R6(this))}}catch(k){this.Oc&&g.Dx(this.Oc)}finally{}};
g.h.GT=function(){var a=g.zx(this.Oc),b=g.Dx(this.Oc);this.Ul<b.length&&(U6(this),zCa(this,a,b),this.sf&&4!=a&&M6(this))};
g.h.PS=function(a){T6((0,g.z)(this.OS,this,a),0)};
g.h.OS=function(a){this.Ih||(U6(this),P6(this,a),M6(this))};
g.h.WB=function(a){T6((0,g.z)(this.NS,this,a),0)};
g.h.NS=function(a){this.Ih||(Q6(this),this.sf=a,this.g.vo(this),this.g.lf(4))};
g.h.cancel=function(){this.Ih=!0;Q6(this)};
g.h.gT=function(){this.lk=null;var a=(0,g.F)();0<=a-this.Ou?(2!=this.oj&&this.g.lf(3),Q6(this),this.Wg=2,O6(18),R6(this)):CCa(this,this.Ou-a)};g.h=FCa.prototype;g.h.gr=null;g.h.ne=null;g.h.Jo=!1;g.h.Zx=null;g.h.pn=null;g.h.ir=null;g.h.jr=null;g.h.He=null;g.h.qg=-1;g.h.Rk=null;g.h.sk=null;g.h.connect=function(a){this.jr=a;a=W6(this.g,null,this.jr);O6(3);this.Zx=(0,g.F)();var b=this.g.F;null!=b?(this.Rk=b[0],(this.sk=b[1])?(this.He=1,GCa(this)):(this.He=2,Y6(this))):(n6(a,"MODE","init"),this.ne=new K6(this,void 0,void 0,void 0),this.ne.Vh=this.gr,L6(this.ne,a,!1,null,!0),this.He=0)};
g.h.CH=function(a){if(a)this.He=2,Y6(this);else{O6(4);var b=this.g;b.Jf=b.Mg.qg;e7(b,9)}a&&this.lf(2)};
g.h.Dq=function(a){return this.g.Dq(a)};
g.h.abort=function(){this.ne&&(this.ne.cancel(),this.ne=null);this.qg=-1};
g.h.Yx=function(){return!1};
g.h.PB=function(a,b){this.qg=a.Sk;if(0==this.He)if(b){try{var c=this.l.parse(b)}catch(d){c=this.g;c.Jf=this.qg;e7(c,2);return}this.Rk=c[0];this.sk=c[1]}else c=this.g,c.Jf=this.qg,e7(c,2);else if(2==this.He)if(this.Jo)O6(7),this.ir=(0,g.F)();else if("11111"==b){if(O6(6),this.Jo=!0,this.pn=(0,g.F)(),c=this.pn-this.Zx,!g.yd||g.tc(10)||500>c)this.qg=200,this.ne.cancel(),O6(12),X6(this.g,this,!0)}else O6(8),this.pn=this.ir=(0,g.F)(),this.Jo=!1};
g.h.vo=function(){this.qg=this.ne.Sk;if(this.ne.sf)0==this.He?this.sk?(this.He=1,GCa(this)):(this.He=2,Y6(this)):2==this.He&&((!g.yd||g.tc(10)?!this.Jo:200>this.ir-this.pn)?(O6(11),X6(this.g,this,!1)):(O6(12),X6(this.g,this,!0)));else{0==this.He?O6(9):2==this.He&&O6(10);var a=this.g;a.Jf=this.qg;e7(a,2)}};
g.h.Ol=function(){return this.g.Ol()};
g.h.isActive=function(){return this.g.isActive()};
g.h.lf=function(a){this.g.lf(a)};g.h=Z6.prototype;g.h.Dk=null;g.h.Sd=null;g.h.sc=null;g.h.fr=null;g.h.un=null;g.h.qw=null;g.h.En=null;g.h.Al=0;g.h.FO=0;g.h.nd=null;g.h.Og=null;g.h.jg=null;g.h.Mh=null;g.h.Mg=null;g.h.wp=null;g.h.Bj=-1;g.h.bz=-1;g.h.Jf=-1;g.h.cj=0;g.h.Pi=0;g.h.Kh=8;var f7=new g.Gf;g.A(ICa,g.ef);g.A(JCa,g.ef);g.A(KCa,g.ef);g.h=Z6.prototype;g.h.connect=function(a,b,c,d,e){O6(0);this.fr=b;this.Dk=c||{};d&&g.t(e)&&(this.Dk.OSID=d,this.Dk.OAID=e);this.C?(T6((0,g.z)(this.Nw,this,a),100),OCa(this)):this.Nw(a)};
g.h.Nw=function(a){this.Mg=new FCa(this);this.Mg.gr=null;this.Mg.l=this.B;this.Mg.connect(a)};
g.h.Yx=function(){return 0==this.g};
g.h.UB=function(a){this.Og=null;RCa(this,a)};
g.h.TB=function(){this.jg=null;this.sc=new K6(this,this.o,"rpc",this.D);this.sc.Vh=null;this.sc.kr=0;var a=this.qw.clone();g.Um(a,"RID","rpc");g.Um(a,"SID",this.o);g.Um(a,"CI",this.wp?"0":"1");g.Um(a,"AID",this.Bj);$6(this,a);if(!g.yd||g.tc(10))g.Um(a,"TYPE","xmlhttp"),L6(this.sc,a,!0,this.En,!1);else{g.Um(a,"TYPE","html");var b=this.sc,c=!!this.En;b.oj=3;b.Vg=m6(a.clone());BCa(b,c)}};
g.h.PB=function(a,b){if(0!=this.g&&(this.sc==a||this.Sd==a))if(this.Jf=a.Sk,this.Sd==a&&3==this.g)if(7<this.Kh){try{var c=this.B.parse(b)}catch(f){c=null}if(g.ya(c)&&3==c.length)if(0==c[0])a:{if(!this.jg){if(this.sc)if(this.sc.Tj+3E3<this.Sd.Tj)b7(this),this.sc.cancel(),this.sc=null;else break a;d7(this);O6(19)}}else this.bz=c[1],0<this.bz-this.Bj&&37500>c[2]&&this.wp&&0==this.Pi&&!this.Mh&&(this.Mh=T6((0,g.z)(this.iP,this),6E3));else e7(this,11)}else b!=mEa.MX.g&&e7(this,11);else if(this.sc==a&&
b7(this),!g.D(b)){c=this.B.parse(b);g.ya(c);for(var d=0;d<c.length;d++){var e=c[d];this.Bj=e[0];e=e[1];2==this.g?"c"==e[0]?(this.o=e[1],this.En=e[2],e=e[3],null!=e?this.Kh=e:this.Kh=6,this.g=3,this.nd&&this.nd.Dw(),this.qw=W6(this,this.Ol()?this.En:null,this.fr),SCa(this)):"stop"==e[0]&&e7(this,7):3==this.g&&("stop"==e[0]?e7(this,7):"noop"!=e[0]&&this.nd&&this.nd.Cw(e),this.Pi=0)}}};
g.h.iP=function(){null!=this.Mh&&(this.Mh=null,this.sc.cancel(),this.sc=null,d7(this),O6(20))};
g.h.vo=function(a){if(this.sc==a){b7(this);this.sc=null;var b=2}else if(this.Sd==a)this.Sd=null,b=1;else return;this.Jf=a.Sk;if(0!=this.g)if(a.sf)1==b?(b=(0,g.F)()-a.Tj,f7.dispatchEvent(new JCa(f7,a.xi?a.xi.length:0,b,this.cj)),a7(this),this.A.length=0):SCa(this);else{var c=a.Wg,d;if(!(d=3==c||7==c||0==c&&0<this.Jf)){if(d=1==b)this.Sd||this.Og||1==this.g||2<=this.cj?d=!1:(this.Og=T6((0,g.z)(this.UB,this,a),TCa(this,this.cj)),this.cj++,d=!0);d=!(d||2==b&&d7(this))}if(d)switch(c){case 1:e7(this,5);
break;case 4:e7(this,10);break;case 3:e7(this,6);break;case 7:e7(this,12);break;default:e7(this,2)}}};
g.h.XH=function(a){if(!g.Qa(arguments,this.g))throw Error("Unexpected channel state: "+this.g);};
g.h.FU=function(a){a?O6(2):(O6(1),UCa(this,8))};
g.h.Dq=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new g.tx;a.F=!1;return a};
g.h.isActive=function(){return!!this.nd&&this.nd.isActive(this)};
g.h.lf=function(a){f7.dispatchEvent(new KCa(f7,a))};
g.h.Ol=function(){return!(!g.yd||g.tc(10))};
g.h=VCa.prototype;g.h.Dw=function(){};
g.h.Cw=function(){};
g.h.Bw=function(){};
g.h.pq=function(){};
g.h.Gx=function(){return{}};
g.h.isActive=function(){return!0};g.A(g7,g.K);g.h=g7.prototype;g.h.GS=function(){this.ad=Math.min(3E5,2*this.ad);this.o();this.l&&this.start()};
g.h.start=function(){var a=this.ad+15E3*Math.random();g.nu(this.g,a);this.l=(0,g.F)()+a};
g.h.stop=function(){this.g.stop();this.l=0};
g.h.isActive=function(){return this.g.isActive()};
g.h.reset=function(){this.g.stop();this.ad=5E3};g.A(h7,VCa);g.h=h7.prototype;g.h.subscribe=function(a,b,c){return this.o.subscribe(a,b,c)};
g.h.unsubscribe=function(a,b,c){return this.o.unsubscribe(a,b,c)};
g.h.Jd=function(a){return this.o.Jd(a)};
g.h.T=function(a,b){return this.o.T.apply(this.o,arguments)};
g.h.dispose=function(){this.I||(this.I=!0,g.cf(this.o),YCa(this),g.cf(this.l),this.l=null)};
g.h.ha=function(){return this.I};
g.h.connect=function(a,b,c){if(!this.g||2!=this.g.g){this.H="";this.l.stop();this.B=a||null;this.A=b||0;a=this.K+"/test";b=this.K+"/bind";var d=new Z6(c?c.firstTestResults:null,c?c.secondTestResults:null,this.L),e=this.g;e&&(e.nd=null);d.nd=this;this.g=d;e?this.g.connect(a,b,this.C,e.o,e.Bj):c?this.g.connect(a,b,this.C,c.sessionId,c.arrayId):this.g.connect(a,b,this.C)}};
g.h.sendMessage=function(a,b){var c={_sc:a};b&&g.fc(c,b);this.l.isActive()||2==(this.g?this.g.g:0)?this.D.push(c):i7(this)&&PCa(this.g,c)};
g.h.Dw=function(){this.l.reset();this.B=null;this.A=0;if(this.D.length){var a=this.D;this.D=[];for(var b=0,c=a.length;b<c;++b)PCa(this.g,a[b])}this.T("handlerOpened")};
g.h.Bw=function(a){var b=2==a&&401==this.g.Jf;4==a||b||this.l.start();this.T("handlerError",a)};
g.h.pq=function(a){if(!this.l.isActive())this.T("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.D.push(d)}};
g.h.Gx=function(){var a={v:2};this.H&&(a.gsessionid=this.H);0!=this.A&&(a.ui=""+this.A);0!=this.F&&(a.ui=""+this.F);this.B&&g.fc(a,this.B);return a};
g.h.Cw=function(a){"S"==a[0]?this.H=a[1]:"gracefulReconnect"==a[0]?(this.l.start(),NCa(this.g)):this.T("handlerMessage",new WCa(a[0],a[1]))};
g.h.nV=function(){this.l.isActive();var a=this.g,b=0;a.sc&&b++;a.Sd&&b++;0!=b||this.connect(this.B,this.A)};j7.prototype.A=function(a,b,c,d){b?a(d):a({text:c.responseText})};
j7.prototype.o=function(a,b){a(Error("Request error: "+b.status))};
j7.prototype.B=function(a){a(Error("request timed out"))};var fDa=(0,g.F)(),m7=null,p7=Array(50),o7=-1,q7=!1;g.A(r7,g.aG);r7.prototype.ge=function(){return this.g};
r7.prototype.contains=function(a){return!!u6(this.g,a)};
r7.prototype.get=function(a){return a?v6(this.g,a):null};
r7.prototype.info=function(a){n7(this.D,a)};g.A(s7,g.aG);var nEa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.h=s7.prototype;g.h.start=function(){!this.g&&(0,window.isNaN)(this.va)&&this.aE()};
g.h.stop=function(){this.g&&(this.g.abort(),this.g=null);(0,window.isNaN)(this.va)||(g.kE(this.va),this.va=window.NaN)};
g.h.V=function(){this.stop();s7.aa.V.call(this)};
g.h.aE=function(){this.va=window.NaN;this.g=g.GE(k7(this.C,"/pairing/get_screen"),{method:"POST",Kb:{pairing_code:this.B},timeout:5E3,onSuccess:(0,g.z)(this.pV,this),onError:(0,g.z)(this.oV,this),sd:(0,g.z)(this.qV,this)})};
g.h.pV=function(a,b){this.g=null;var c=b.screen||{};c.dialId=this.o;c.name=this.A;this.T("pairingComplete",new p6(c))};
g.h.oV=function(a){this.g=null;a.status&&404==a.status?this.l>=nEa.length?this.T("pairingFailed",Error("DIAL polling timed out")):(a=nEa[this.l],this.va=g.iE((0,g.z)(this.aE,this),a),this.l++):this.T("pairingFailed",Error("Server error "+a.status))};
g.h.qV=function(){this.g=null;this.T("pairingFailed",Error("Server not responding"))};g.A(u7,r7);g.h=u7.prototype;g.h.start=function(){t7(this)&&this.T("screenChange");!g.hH("yt-remote-lounge-token-expiration")&&jDa(this);g.kE(this.l);this.l=g.iE((0,g.z)(this.start,this),1E4)};
g.h.add=function(a,b){t7(this);gDa(this,a);v7(this,!1);this.T("screenChange");b(a);a.token||jDa(this)};
g.h.remove=function(a,b){var c=t7(this);iDa(this,a)&&(v7(this,!1),c=!0);b(a);c&&this.T("screenChange")};
g.h.qp=function(a,b,c,d){var e=t7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,v7(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.T("screenChange")};
g.h.V=function(){g.kE(this.l);u7.aa.V.call(this)};
g.h.DI=function(a){t7(this);var b=this.g.length;a=a&&a.screens||[];for(var c=0,d=a.length;c<d;++c){var e=a[c],f=this.get(e.screenId);f&&(f.token=e.loungeToken,--b)}v7(this,!b);b&&n7(this.D,"Missed "+b+" lounge tokens.")};
g.h.CI=function(a){n7(this.D,"Requesting lounge tokens failed: "+a)};g.A(x7,g.aG);g.h=x7.prototype;g.h.start=function(){var a=(0,window.parseInt)(g.hH("yt-remote-fast-check-period")||"0",10);(this.A=(0,g.F)()-144E5<a?0:a)?z7(this):(this.A=(0,g.F)()+3E5,g.gH("yt-remote-fast-check-period",this.A),this.du())};
g.h.isEmpty=function(){return g.Yb(this.g)};
g.h.update=function(){w7("Updating availability on schedule.");var a=this.C(),b=g.Lb(this.g,function(b,d){return b&&!!v6(a,d)},this);
y7(this,b)};
g.h.V=function(){g.kE(this.o);this.o=window.NaN;this.l&&(this.l.abort(),this.l=null);x7.aa.V.call(this)};
g.h.du=function(){g.kE(this.o);this.o=window.NaN;this.l&&this.l.abort();var a=mDa(this);if(g.Pb(a)){var b=k7(this.B,"/pairing/get_screen_availability");this.l=l7(this.B,b,{lounge_token:g.Rb(a).join(",")},(0,g.z)(this.nS,this,a),(0,g.z)(this.mS,this))}else y7(this,{}),z7(this)};
g.h.nS=function(a,b){this.l=null;var c=g.Rb(mDa(this));if(g.jb(c,g.Rb(a))){c=b.screens||[];for(var d={},e=0,f=c.length;e<f;++e)d[a[c[e].loungeToken]]="online"==c[e].status;y7(this,d);z7(this)}else this.dc("Changing Screen set during request."),this.du()};
g.h.mS=function(a){this.dc("Screen availability failed: "+a);this.l=null;z7(this)};
g.h.dc=function(a){n7("OnlineScreenService",a)};g.A(A7,r7);g.h=A7.prototype;g.h.start=function(){this.o.start();this.l.start();this.g.length&&(this.T("screenChange"),this.l.isEmpty()||this.T("onlineScreenChange"))};
g.h.add=function(a,b,c){this.o.add(a,b,c)};
g.h.remove=function(a,b,c){this.o.remove(a,b,c);this.l.update()};
g.h.qp=function(a,b,c,d){this.o.contains(a)?this.o.qp(a,b,c,d):(a="Updating name of unknown screen: "+a.name,n7(this.D,a),d(Error(a)))};
g.h.ge=function(a){return a?this.g:g.Xa(this.g,(0,g.Ld)(this.A,function(a){return!this.contains(a)},this))};
g.h.bE=function(){return(0,g.Ld)(this.ge(!0),function(a){return!!this.l.g[a.id]},this)};
g.h.cE=function(a,b,c,d,e){this.info("getDialScreenByPairingCode "+a+" / "+b);var f=new s7(this.C,a,b,c);f.subscribe("pairingComplete",(0,g.z)(function(a){g.cf(f);d(B7(this,a))},this));
f.subscribe("pairingFailed",function(a){g.cf(f);e(a)});
f.start();return(0,g.z)(f.stop,f)};
g.h.sV=function(a,b,c,d){g.GE(k7(this.C,"/pairing/get_screen"),{method:"POST",Kb:{pairing_code:a},timeout:5E3,onSuccess:(0,g.z)(function(a,d){var e=new p6(d.screen||{});if(!e.name||qDa(this,e.name)){a:{var f=e.name;for(var m=2,n=b(f,m);qDa(this,n);){m++;if(20<m)break a;n=b(f,m)}f=n}e.name=f}c(B7(this,e))},this),
onError:(0,g.z)(function(a){d(Error("pairing request failed: "+a.status))},this),
sd:(0,g.z)(function(){d(Error("pairing request timed out."))},this)})};
g.h.V=function(){g.cf(this.o);g.cf(this.l);A7.aa.V.call(this)};
g.h.TI=function(){rDa(this);this.T("screenChange");this.l.update()};
A7.prototype.dispose=A7.prototype.dispose;g.A(D7,g.aG);g.h=D7.prototype;g.h.wo=function(a){this.o=a;this.T("sessionScreen",this.o)};
g.h.ke=function(a){this.ha()||(a&&E7(this,""+a),this.o=null,this.T("sessionScreen",null))};
g.h.info=function(a){n7(this.L,a)};
g.h.eE=function(){return null};
g.h.ku=function(a){var b=this.l;a?(b.displayStatus=new window.chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;window.chrome.cast.setReceiverDisplayStatus(b,(0,g.z)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.z)(function(){E7(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.h.V=function(){this.ku("");D7.aa.V.call(this)};g.A(F7,D7);g.h=F7.prototype;g.h.ju=function(a){if(this.g){if(this.g==a)return;E7(this,"Overriding cast sesison with new session object");this.g.removeUpdateListener(this.C);this.g.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B)}this.g=a;this.g.addUpdateListener(this.C);this.g.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.B);tDa(this)};
g.h.Cj=function(a){this.info("launchWithParams no-op for Cast: "+g.Bg(a))};
g.h.stop=function(){this.g?this.g.stop((0,g.z)(function(){this.ke()},this),(0,g.z)(function(){this.ke(Error("Failed to stop receiver app."))},this)):this.ke(Error("Stopping cast device witout session."))};
g.h.ku=g.y;g.h.V=function(){this.info("disposeInternal");g.kE(this.A);this.A=0;this.g&&(this.g.removeUpdateListener(this.C),this.g.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B));this.g=null;F7.aa.V.call(this)};
g.h.tT=function(a,b){if(!this.ha())if(b){var c=g.lx(b);if(g.Ba(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.Bg(c));switch(d){case "mdxSessionStatus":sDa(this,c.screenId);break;default:E7(this,"Unknown youtube message: "+d)}}else E7(this,"Unable to parse message.")}else E7(this,"No data in message.")};
g.h.Rx=function(a,b,c,d){pDa(this.H,this.l.label,a,this.l.friendlyName,(0,g.z)(function(e){e?b(e):0<=d?(E7(this,"Screen "+a+" appears to be offline. "+d+" retries left."),g.iE((0,g.z)(this.Rx,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.h.eE=function(){return this.g};
g.h.tV=function(a){this.ha()||a||(E7(this,"Cast session died."),this.ke())};g.A(G7,D7);g.h=G7.prototype;g.h.ju=function(a){this.A=a;this.A.addUpdateListener(this.K)};
g.h.Cj=function(a){this.B=a;this.D()};
g.h.stop=function(){this.g();this.g=g.y;g.kE(this.C);this.A?this.A.stop((0,g.z)(this.ke,this,null),(0,g.z)(this.ke,this,"Failed to stop DIAL device.")):this.ke()};
g.h.V=function(){this.g();this.g=g.y;g.kE(this.C);this.A&&this.A.removeUpdateListener(this.K);this.A=null;G7.aa.V.call(this)};
g.h.wV=function(a){this.ha()||a||(E7(this,"DIAL session died."),this.g(),this.g=g.y,this.ke())};
g.h.Tr=function(a){this.I=t6();if(this.B){var b=new window.chrome.cast.DialLaunchResponse(!0,vDa(this));a(b);uDa(this)}else this.D=(0,g.z)(function(){g.kE(this.C);this.D=g.y;this.C=window.NaN;var b=new window.chrome.cast.DialLaunchResponse(!0,vDa(this));a(b);uDa(this)},this),this.C=g.iE((0,g.z)(function(){this.D()},this),100)};
g.h.iK=function(a,b,c){pDa(this.H,this.F.receiver.label,a,this.l.friendlyName,(0,g.z)(function(a){a&&a.token?(this.wo(a),b(new window.chrome.cast.DialLaunchResponse(!1))):this.Tr(b,c)},this),(0,g.z)(function(a){E7(this,"Failed to get DIAL screen: "+a);
this.Tr(b,c)},this))};g.A(H7,D7);H7.prototype.stop=function(){this.ke()};
H7.prototype.ju=g.y;H7.prototype.Cj=function(){g.kE(this.g);this.g=window.NaN;var a=v6(this.H.ge(),this.l.label);a?this.wo(a):this.ke(Error("No such screen"))};
H7.prototype.V=function(){g.kE(this.g);this.g=window.NaN;H7.aa.V.call(this)};g.A(I7,g.aG);g.h=I7.prototype;
g.h.init=function(a,b){window.chrome.cast.timeout.requestSession=3E4;var c=new window.chrome.cast.SessionRequest(this.D);this.F||(c.dialRequest=new window.chrome.cast.DialRequest("YouTube"));var d=window.chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED,e=a?window.chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:window.chrome.cast.DefaultActionPolicy.CREATE_SESSION;c=new window.chrome.cast.ApiConfig(c,(0,g.z)(this.QB,this),(0,g.z)(this.XR,this),d,e);c.customDialLaunchCallback=(0,g.z)(this.SP,this);window.chrome.cast.initialize(c,
(0,g.z)(function(){this.ha()||(window.chrome.cast.addReceiverActionListener(this.A),cDa(),this.l.subscribe("onlineScreenChange",(0,g.z)(this.dE,this)),this.o=xDa(this),window.chrome.cast.setCustomReceivers(this.o,g.y,(0,g.z)(function(a){this.dc("Failed to set initial custom receivers: "+g.Bg(a))},this)),this.T("yt-remote-cast2-availability-change",K7(this)),b(!0))},this),(0,g.z)(function(a){this.dc("Failed to initialize API: "+g.Bg(a));
b(!1)},this))};
g.h.pU=function(a,b){J7("Setting connected screen ID: "+a+" -> "+b);if(this.g){var c=this.g.o;if(!a||c&&c.id!=a)J7("Unsetting old screen status: "+this.g.l.friendlyName),L7(this,null)}if(a&&b){if(!this.g){c=v6(this.l.ge(),a);if(!c){J7("setConnectedScreenStatus: Unknown screen.");return}var d=wDa(this,c);d||(J7("setConnectedScreenStatus: Connected receiver not custom..."),d=new window.chrome.cast.Receiver(c.uuid?c.uuid:c.id,c.name),d.receiverType=window.chrome.cast.ReceiverType.CUSTOM,this.o.push(d),
window.chrome.cast.setCustomReceivers(this.o,g.y,(0,g.z)(function(a){this.dc("Failed to set initial custom receivers: "+g.Bg(a))},this)));
J7("setConnectedScreenStatus: new active receiver: "+d.friendlyName);L7(this,new H7(this.l,d),!0)}this.g.ku(b)}else J7("setConnectedScreenStatus: no screen.")};
g.h.qU=function(a){this.ha()?this.dc("Setting connection data on disposed cast v2"):this.g?this.g.Cj(a):this.dc("Setting connection data without a session")};
g.h.vV=function(){this.ha()?this.dc("Stopping session on disposed cast v2"):this.g?(this.g.stop(),L7(this,null)):J7("Stopping non-existing session")};
g.h.requestSession=function(){window.chrome.cast.requestSession((0,g.z)(this.QB,this),(0,g.z)(this.sS,this))};
g.h.V=function(){this.l.unsubscribe("onlineScreenChange",(0,g.z)(this.dE,this));window.chrome&&window.chrome.cast&&window.chrome.cast.removeReceiverActionListener(this.A);g.Va(g.x("yt.mdx.remote.debug.handlers_")||[],$Ca);g.cf(this.g);I7.aa.V.call(this)};
g.h.dc=function(a){n7("Controller",a)};
g.h.RB=function(a,b){this.g==a&&(b||L7(this,null),this.T("yt-remote-cast2-session-change",b))};
g.h.TR=function(a,b){if(!this.ha())if(a)switch(a.friendlyName=window.chrome.cast.unescape(a.friendlyName),J7("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case window.chrome.cast.ReceiverAction.CAST:if(this.g)if(this.g.l.label!=a.label)J7("onReceiverAction_: Stopping active receiver: "+this.g.l.friendlyName),this.g.stop();else{J7("onReceiverAction_: Casting to active receiver.");this.g.o&&this.T("yt-remote-cast2-session-change",this.g.o);break}switch(a.receiverType){case window.chrome.cast.ReceiverType.CUSTOM:L7(this,
new H7(this.l,a));break;case window.chrome.cast.ReceiverType.DIAL:L7(this,new G7(this.l,a,this.C));break;case window.chrome.cast.ReceiverType.CAST:L7(this,new F7(this.l,a));break;default:this.dc("Unknown receiver type: "+a.receiverType)}break;case window.chrome.cast.ReceiverAction.STOP:this.g&&this.g.l.label==a.label?this.g.stop():this.dc("Stopping receiver w/o session: "+a.friendlyName)}else this.dc("onReceiverAction_ called without receiver.")};
g.h.SP=function(a){if(this.ha())return window.Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=window.chrome.cast.ReceiverType.DIAL&&(this.dc("Not DIAL receiver: "+b.friendlyName),b.receiverType=window.chrome.cast.ReceiverType.DIAL);var c=this.g?this.g.l:null;if(!c||c.label!=b.label)return this.dc("Receiving DIAL launch request for non-clicked DIAL receiver: "+b.friendlyName),window.Promise.reject(Error("illegal DIAL launch"));if(c&&c.label==b.label&&c.receiverType!=window.chrome.cast.ReceiverType.DIAL){if(this.g.o)return J7("Reselecting dial screen."),
this.T("yt-remote-cast2-session-change",this.g.o),window.Promise.resolve(new window.chrome.cast.DialLaunchResponse(!1));this.dc('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);L7(this,new G7(this.l,b,this.C))}b=this.g;b.F=a;return b.F.appState==window.chrome.cast.DialAppState.RUNNING?new window.Promise((0,g.z)(b.iK,b,(b.F.extraData||{}).screenId||null)):new window.Promise((0,g.z)(b.Tr,b))};
g.h.QB=function(a){if(!this.ha()){J7("New cast session ID: "+a.sessionId);var b=a.receiver;if(b.receiverType!=window.chrome.cast.ReceiverType.CUSTOM){if(!this.g)if(b.receiverType==window.chrome.cast.ReceiverType.CAST)J7("Got resumed cast session before resumed mdx connection."),b.friendlyName=window.chrome.cast.unescape(b.friendlyName),L7(this,new F7(this.l,b),!0);else{this.dc("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.g.l,d=v6(this.l.ge(),c.label);
d&&q6(d,b.label)&&c.receiverType!=window.chrome.cast.ReceiverType.CAST&&b.receiverType==window.chrome.cast.ReceiverType.CAST&&(J7("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.cf(this.g),this.g=new F7(this.l,b),this.g.subscribe("sessionScreen",(0,g.z)(this.RB,this,this.g)),this.g.Cj(null));this.g.ju(a)}}};
g.h.uV=function(){return this.g?this.g.eE():null};
g.h.sS=function(a){this.ha()||(this.dc("Failed to estabilish a session: "+g.Bg(a)),a.code!=window.chrome.cast.ErrorCode.CANCEL&&L7(this,null))};
g.h.XR=function(a){J7("Receiver availability updated: "+a);if(!this.ha()){var b=K7(this);this.B=a==window.chrome.cast.ReceiverAvailability.AVAILABLE;K7(this)!=b&&this.T("yt-remote-cast2-availability-change",K7(this))}};
g.h.dE=function(){this.ha()||(this.o=xDa(this),J7("Updating custom receivers: "+g.Bg(this.o)),window.chrome.cast.setCustomReceivers(this.o,g.y,(0,g.z)(function(){this.dc("Failed to set custom receivers.")},this)),this.T("yt-remote-cast2-availability-change",K7(this)))};
I7.prototype.setLaunchParams=I7.prototype.qU;I7.prototype.setConnectedScreenStatus=I7.prototype.pU;I7.prototype.stopSession=I7.prototype.vV;I7.prototype.getCastSession=I7.prototype.uV;I7.prototype.requestSession=I7.prototype.requestSession;I7.prototype.init=I7.prototype.init;I7.prototype.dispose=I7.prototype.dispose;var R7=[];g.h=W7.prototype;
g.h.reset=function(a){this.listId="";this.index=-1;this.videoId="";X7(this);this.volume=-1;this.muted=!1;a&&(this.index=a.index,this.listId=a.listId,this.videoId=a.videoId,this.g=a.playerState,this.volume=a.volume,this.muted=a.muted,this.audioTrackId=a.audioTrackId,this.l=a.trackData,this.Mf=a.hasPrevious,this.hasNext=a.hasNext,this.F=a.playerTime,this.D=a.playerTimeAt,this.B=a.seekableStart,this.o=a.seekableEnd,this.H=a.duration,this.I=a.loadedTime,this.A=a.liveIngestionTime,this.C=!(0,window.isNaN)(this.A))};
g.h.gb=function(){return 1==this.g};
g.h.isAdPlaying=function(){return 1081==this.g};
g.h.getDuration=function(){return this.C?this.H+Y7(this):this.H};
g.h.clone=function(){return new W7(b8(this))};g.A(d8,g.aG);g.h=d8.prototype;g.h.play=function(){1==this.g?(this.l?this.l.play(null,g.y,j8(this,"play")):i8(this,"play"),h8(this,1,$7(e8(this))),this.T("remotePlayerChange")):f8(this,this.play)};
g.h.pause=function(){1==this.g?(this.l?this.l.pause(null,g.y,j8(this,"pause")):i8(this,"pause"),h8(this,2,$7(e8(this))),this.T("remotePlayerChange")):f8(this,this.pause)};
g.h.ZD=function(a){if(1==this.g){if(this.l){var b=e8(this),c=new window.chrome.cast.media.SeekRequest;c.currentTime=a;c.resumeState=b.gb()||3==b.g?window.chrome.cast.media.ResumeState.PLAYBACK_START:window.chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.l.seek(c,g.y,j8(this,"seekTo",{newTime:a}))}else i8(this,"seekTo",{newTime:a});h8(this,3,a);this.T("remotePlayerChange")}else f8(this,g.Ea(this.ZD,a))};
g.h.stop=function(){if(1==this.g){this.l?this.l.stop(null,g.y,j8(this,"stopVideo")):i8(this,"stopVideo");var a=e8(this);a.index=-1;a.videoId="";X7(a);g8(this,a);this.T("remotePlayerChange")}else f8(this,this.stop)};
g.h.setVolume=function(a,b){if(1==this.g){var c=e8(this);if(this.o){if(c.volume!=a){var d=Math.round(a)/100;this.o.setReceiverVolumeLevel(d,(0,g.z)(function(){n7("CP","set receiver volume: "+d)},this),(0,g.z)(function(){this.dc("failed to set receiver volume.")},this))}c.muted!=b&&this.o.setReceiverMuted(b,(0,g.z)(function(){n7("CP","set receiver muted: "+b)},this),(0,g.z)(function(){this.dc("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);i8(this,"setVolume",e)}c.muted=b;c.volume=a;g8(this,c)}else f8(this,g.Ea(this.setVolume,a,b))};
g.h.cD=function(a,b){if(1==this.g){var c=e8(this),d={videoId:a};b&&(c.l={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,format:b.format,kind:b.kind},d.style=g.Bg(b.style),g.fc(d,c.l));i8(this,"setSubtitlesTrack",d);g8(this,c)}else f8(this,g.Ea(this.cD,a,b))};
g.h.Tu=function(a,b){if(1==this.g){i8(this,"setAudioTrack",{videoId:a,audioTrackId:b.Nb.id});var c=e8(this);c.audioTrackId=b.Nb.id;g8(this,c)}else f8(this,g.Ea(this.Tu,a,b))};
g.h.YD=function(a,b){if(1==this.g){if(a&&b){var c=e8(this);a8(c,a,b);g8(this,c)}i8(this,"previous")}else f8(this,g.Ea(this.YD,a,b))};
g.h.XD=function(a,b){if(1==this.g){if(a&&b){var c=e8(this);a8(c,a,b);g8(this,c)}i8(this,"next")}else f8(this,g.Ea(this.XD,a,b))};
g.h.hx=function(){1==this.g?i8(this,"dismissAutoplay"):f8(this,this.hx)};
g.h.dispose=function(){if(3!=this.g){var a=this.g;this.g=3;this.T("proxyStateChange",a,this.g)}d8.aa.dispose.call(this)};
g.h.V=function(){KDa(this);this.A=null;this.B.clear();c8(this,null);d8.aa.V.call(this)};
g.h.Uu=function(a){if((a!=this.g||2==a)&&3!=this.g&&0!=a){var b=this.g;this.g=a;this.T("proxyStateChange",b,a);if(1==a)for(;!this.B.isEmpty();)g.CC(this.B).apply(this);else 3==a&&this.dispose()}};
g.h.OR=function(a,b){this.T(a,b)};
g.h.pP=function(a){if(!a)this.Dl(null),c8(this,null);else if(this.o.receiver.volume){a=this.o.receiver.volume;var b=e8(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)n7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,g8(this,b)}};
g.h.Dl=function(a){n7("CP","Cast media: "+!!a);this.l&&this.l.removeUpdateListener(this.F);if(this.l=a)this.l.addUpdateListener(this.F),LDa(this),this.T("remotePlayerChange")};
g.h.oP=function(a){a?(LDa(this),this.T("remotePlayerChange")):this.Dl(null)};
g.h.BP=function(){var a=HDa();a&&c8(this,a)};
g.h.dc=function(a){n7("CP",a)};g.A(k8,g.aG);g.h=k8.prototype;
g.h.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.playerParams,f=b.clickTrackingParams,k=b.index,l={videoId:d},m=b.currentTime,n=b.locationInfo;g.t(m)&&(l.currentTime=5>=m?0:m);e&&(l.playerParams=e);n&&(l.locationInfo=n);f&&(l.clickTrackingParams=f);c&&(l.listId=c);g.t(k)&&(l.currentIndex=k);c&&(this.Va.listId=c);this.Va.videoId=d;this.Va.index=k||0;this.Va.state=3;Z7(this.Va,m);this.A="UNSUPPORTED";l8("Connecting with setPlaylist and params: "+g.Bg(l));this.g.connect({method:"setPlaylist",
params:g.Bg(l)},a,gCa())}else l8("Connecting without params"),this.g.connect({},a,gCa());NDa(this)};
g.h.dispose=function(){this.ha()||(this.T("beforeDispose"),m8(this,3));k8.aa.dispose.call(this)};
g.h.V=function(){n8(this);p8(this);o8(this);g.kE(this.H);this.H=window.NaN;g.kE(this.I);this.I=window.NaN;this.o=null;g.LF(this.R);this.R.length=0;this.g.dispose();k8.aa.V.call(this);this.A=this.D=this.l=this.Va=this.g=null};
g.h.uI=function(){this.C(2)};
g.h.tP=function(){l8("Channel opened");this.N&&(this.N=!1,o8(this),this.L=g.iE((0,g.z)(function(){l8("Timing out waiting for a screen.");this.C(1)},this),15E3));
kCa(XCa(this.g),this.Y)};
g.h.qP=function(){l8("Channel closed");(0,window.isNaN)(this.B)?A6(!0):A6();this.dispose()};
g.h.rP=function(a){A6();(0,window.isNaN)(this.F())?(l8("Channel error: "+a+" without reconnection"),this.dispose()):(this.N=!0,l8("Channel error: "+a+" with reconnection in "+this.F()+" ms"),m8(this,2))};
g.h.sP=function(a){a.params?l8("Received: action="+a.action+", params="+g.Bg(a.params)):l8("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=g.lx(a.params.devices);this.l=(0,g.G)(a,function(a){return new o6(a)});
a=!!g.Ma(this.l,function(a){return"LOUNGE_SCREEN"==a.type});
QDa(this,a);break;case "loungeScreenDisconnected":g.Wa(this.l,function(a){return"LOUNGE_SCREEN"==a.type});
QDa(this,!1);break;case "remoteConnected":var b=new o6(g.lx(a.params.device));g.Ma(this.l,function(a){return b?a.id==b.id:!1})||g.Ta(this.l,b);
break;case "remoteDisconnected":b=new o6(g.lx(a.params.device));g.Wa(this.l,function(a){return b?a.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":SDa(this,a);break;case "nowPlaying":UDa(this,a);break;case "onStateChange":TDa(this,a);break;case "onAdStateChange":VDa(this,a);break;case "onVolumeChanged":WDa(this,a);break;case "onSubtitlesTrackChanged":RDa(this,a);break;case "nowAutoplaying":XDa(this,a);break;case "autoplayDismissed":this.T("autoplayDismissed");break;case "autoplayUpNext":this.D=a.params.videoId||null;this.T("autoplayUpNext",this.D);break;case "onAutoplayModeChanged":this.A=
a.params.autoplayMode;this.T("autoplayModeChange",this.A);"DISABLED"==this.A&&this.T("autoplayDismissed");break;case "onHasPreviousNextChanged":YDa(this,a);break;case "requestAssistedSignIn":this.T("assistedSignInRequested",a.params.authCode);break;default:l8("Unrecognized action: "+a.action)}};
g.h.ZT=function(){if(this.o){var a=this.o;this.o=null;this.Va.videoId!=a&&q8(this,"getNowPlaying")}};
k8.prototype.subscribe=k8.prototype.subscribe;k8.prototype.unsubscribeByKey=k8.prototype.Jd;k8.prototype.ea=function(){var a=3;this.ha()||(a=0,(0,window.isNaN)(this.F())?i7(this.g)&&(0,window.isNaN)(this.B)&&(a=1):a=2);return a};
k8.prototype.getProxyState=k8.prototype.ea;k8.prototype.C=function(a){l8("Disconnecting with "+a);n8(this);this.T("beforeDisconnect",a);1==a&&A6();YCa(this.g,a);this.dispose()};
k8.prototype.disconnect=k8.prototype.C;k8.prototype.da=function(){var a=this.Va;this.o&&(a=this.Va.clone(),a8(a,this.o,a.index));return b8(a)};
k8.prototype.getPlayerContextData=k8.prototype.da;
k8.prototype.ia=function(a){var b=new W7(a);b.videoId&&b.videoId!=this.Va.videoId&&(this.o=b.videoId,g.kE(this.H),this.H=g.iE((0,g.z)(this.ZT,this),5E3));var c=[];this.Va.listId==b.listId&&this.Va.videoId==b.videoId&&this.Va.index==b.index||c.push("remoteQueueChange");this.Va.g==b.g&&this.Va.volume==b.volume&&this.Va.muted==b.muted&&$7(this.Va)==$7(b)&&g.Bg(this.Va.l)==g.Bg(b.l)||c.push("remotePlayerChange");this.Va.reset(a);(0,g.B)(c,function(a){this.T(a)},this)};
k8.prototype.setPlayerContextData=k8.prototype.ia;k8.prototype.W=function(){var a=this.g.C.id,b=g.Ma(this.l,function(b){return"REMOTE_CONTROL"==b.type&&b.id!=a});
return b?b.id:""};
k8.prototype.getOtherConnectedRemoteId=k8.prototype.W;k8.prototype.F=function(){var a=this.g;return a.l.isActive()?a.l.l-(0,g.F)():window.NaN};
k8.prototype.getReconnectTimeout=k8.prototype.F;k8.prototype.X=function(){return this.A||"UNSUPPORTED"};
k8.prototype.getAutoplayMode=k8.prototype.X;k8.prototype.Z=function(){return this.D||""};
k8.prototype.getAutoplayVideoId=k8.prototype.Z;k8.prototype.oa=function(){if(!(0,window.isNaN)(this.F())){var a=this.g.l;g.ou(a.g);a.start()}};
k8.prototype.reconnect=k8.prototype.oa;k8.prototype.fa=function(a,b){q8(this,a,b);PDa(this)};
k8.prototype.sendMessage=k8.prototype.fa;g.A(r8,r7);g.h=r8.prototype;g.h.ge=function(a){return this.Zc.$_gs(a)};
g.h.contains=function(a){return!!this.Zc.$_c(a)};
g.h.get=function(a){return this.Zc.$_g(a)};
g.h.start=function(){this.Zc.$_st()};
g.h.add=function(a,b,c){this.Zc.$_a(a,b,c)};
g.h.remove=function(a,b,c){this.Zc.$_r(a,b,c)};
g.h.qp=function(a,b,c,d){this.Zc.$_un(a,b,c,d)};
g.h.V=function(){for(var a=0,b=this.l.length;a<b;++a)this.Zc.$_ubk(this.l[a]);this.l.length=0;this.Zc=null;r8.aa.V.call(this)};
g.h.rV=function(){this.T("screenChange")};
g.h.oR=function(){this.T("onlineScreenChange")};
A7.prototype.$_st=A7.prototype.start;A7.prototype.$_gspc=A7.prototype.sV;A7.prototype.$_gsppc=A7.prototype.cE;A7.prototype.$_c=A7.prototype.contains;A7.prototype.$_g=A7.prototype.get;A7.prototype.$_a=A7.prototype.add;A7.prototype.$_un=A7.prototype.qp;A7.prototype.$_r=A7.prototype.remove;A7.prototype.$_gs=A7.prototype.ge;A7.prototype.$_gos=A7.prototype.bE;A7.prototype.$_s=A7.prototype.subscribe;A7.prototype.$_ubk=A7.prototype.Jd;var s8=null,t8=null,I8=null,x8=[];g.p(J8,g.K);g.h=J8.prototype;
g.h.V=function(){g.K.prototype.V.call(this);this.A.stop();this.B.stop();this.K.stop();this.N();this.g.unsubscribe("proxyStateChange",this.OB,this);this.g.unsubscribe("remotePlayerChange",this.Gl,this);this.g.unsubscribe("remoteQueueChange",this.xo,this);this.g.unsubscribe("autoplayUpNext",this.lB,this);this.g.unsubscribe("previousNextChange",this.LB,this);this.g.unsubscribe("nowAutoplaying",this.DB,this);this.g.unsubscribe("autoplayDismissed",this.kB,this);this.g=this.F=null};
g.h.mA=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.g.g)if(M8(this)){if(!e8(this.g).isAdPlaying()||"control_seek"!=a)switch(a){case "control_toggle_play_pause":e8(this.g).gb()?this.g.pause():this.g.play();break;case "control_play":this.g.play();break;case "control_pause":this.g.pause();break;case "control_seek":this.I.mj(c[0],c[1]);break;case "control_subtitles_set_track":N8(this,c[0]);break;case "control_set_audio_track":c=c[0],M8(this)&&this.g.Tu(this.l.getVideoData(1).videoId,
c)}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":c=this.l.getCurrentTime();O8(this,0==c?void 0:c);break;case "control_seek":O8(this,c[0]);break;case "control_subtitles_set_track":N8(this,c[0]);break;case "control_set_audio_track":c=c[0],M8(this)&&this.g.Tu(this.l.getVideoData(1).videoId,c)}};
g.h.nP=function(a){this.K.pI(a)};
g.h.UU=function(a){this.mA("control_subtitles_set_track",g.Yb(a)?null:a)};
g.h.pD=function(){var a=this.l.uc("captions","track");g.Yb(a)||N8(this,a)};
g.h.BB=function(a){if(M8(this)){this.g.unsubscribe("remotePlayerChange",this.Gl,this);var b=Math.round(a.volume);a=!!a.muted;var c=e8(this.g);if(b!=c.volume||a!=c.muted)this.g.setVolume(b,a),this.L.start();this.g.subscribe("remotePlayerChange",this.Gl,this)}};
g.h.HQ=function(){g.Yb(this.C)||jEa(this,this.C);this.D=!1};
g.h.OB=function(a,b){this.B.stop();2==b&&this.mD()};
g.h.Gl=function(){if(M8(this)){this.A.stop();var a=e8(this.g);switch(a.g){case 1081:case 1:L8(this,new g.DP(8));this.lD();break;case 1085:case 3:L8(this,new g.DP(9));break;case 1083:case 0:L8(this,new g.DP(2));this.I.stop();K8(this,this.l.getVideoData().lengthSeconds);break;case 1084:L8(this,new g.DP(4));break;case 2:L8(this,new g.DP(4));K8(this,$7(a));break;case -1:L8(this,new g.DP(64));break;case -1E3:a={errorCode:"mdx.remoteerror",message:g.T("YTP_MDX_PLAYER_ERROR")},L8(this,new g.DP(128,a))}a=
e8(this.g).l;var b=this.C;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.format==b.format&&a.kind==b.kind:1)||(this.C=a,jEa(this,a));a=e8(this.g);-1==a.volume||Math.round(this.l.getVolume())==a.volume&&this.l.isMuted()==a.muted||this.L.isActive()||this.MD()}else iEa(this)};
g.h.LB=function(){this.l.T("mdxpreviousnextchange")};
g.h.xo=function(){M8(this)||iEa(this)};
g.h.BH=function(){this.g.hx()};
g.h.lB=function(a){a&&(a=g.GE("/watch_queue_ajax",{method:"GET",Uc:{action_get_watch_queue_item:1,video_id:a},onSuccess:(0,g.z)(this.SS,this)}))&&(this.N=(0,g.z)(a.abort,a))};
g.h.SS=function(a,b){var c=new g.uO({videoId:b.videoId,title:b.title,author:b.author,murlmq_webp:b.url});this.suggestion=c;this.l.T("mdxautoplayupnext",c)};
g.h.DB=function(a){(0,window.isNaN)(a)||this.l.T("mdxnowautoplaying",a)};
g.h.kB=function(){this.l.T("mdxautoplaycanceled")};
g.h.oN=function(a,b){-1==e8(this.g).g?O8(this,a):b&&this.g.ZD(a)};
g.h.MD=function(){if(M8(this)){var a=e8(this.g);this.o.Aa(this.R);a.muted?this.l.mute():this.l.Xf();this.l.setVolume(a.volume);this.R=this.o.O(this.l,"onVolumeChange",this.BB)}};
g.h.lD=function(){this.A.stop();if(!this.g.ha()){var a=e8(this.g);a.gb()&&L8(this,new g.DP(8));K8(this,$7(a));this.A.start()}};
g.h.mD=function(){this.B.stop();this.A.stop();var a=this.g.A.getReconnectTimeout();2==this.g.g&&!(0,window.isNaN)(a)&&this.B.start()};g.p(P8,g.U);P8.prototype.B=function(a){lEa(this,a.state)};g.p(Q8,g.MZ);Q8.prototype.K=function(){var a=this.o.uc("remote","receivers");a&&1<a.length&&!this.o.uc("remote","quickCast")?(this.H=g.lb(a,this.C,this),g.NZ(this,(0,g.G)(a,this.C)),a=this.o.uc("remote","currentReceiver"),this.kf(this.C(a)),this.enable(!0)):this.enable(!1)};
Q8.prototype.C=function(a){return a.key};
Q8.prototype.jf=function(a){return"cast-selector-receiver"==a?g.T("YTP_MDX_CAST_SELECTOR"):this.H[a].name};
Q8.prototype.qd=function(a){g.MZ.prototype.qd.call(this,a);this.o.Gd("remote","currentReceiver",this.H[a]);this.B.Ob()};g.p(R8,g.jV);g.h=R8.prototype;g.h.create=function(){cEa(g.KM(g.X(this.g)));this.C.push(g.mG("yt-remote-before-disconnect",this.jP,this));this.C.push(g.mG("yt-remote-connection-change",this.YR,this));this.C.push(g.mG("yt-remote-receiver-availability-change",this.MB,this));this.C.push(g.mG("yt-remote-auto-connect",this.WR,this));this.C.push(g.mG("yt-remote-receiver-resumed",this.VR,this));this.MB()};
g.h.load=function(){this.g.Qs();g.jV.prototype.load.call(this);this.B=new J8(this,this.g,this.l);var a=(a=hEa())?a.currentTime:0;var b=H8()?new d8(C8(),void 0):null;0==a&&b&&(a=$7(e8(b)));0!=a&&(this.H=a||0,this.g.T("progresssync",a,void 0));kEa(this,this.D,this.D);g.$_(this.g.app,6)};
g.h.unload=function(){this.g.T("mdxautoplaycanceled");this.A=this.o;g.df(this.B,this.l);this.l=this.B=null;g.jV.prototype.unload.call(this);g.$_(this.g.app,5)};
g.h.V=function(){g.nG(this.C);g.jV.prototype.V.call(this)};
g.h.vl=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.B.mA.apply(this.B,[a].concat(g.pa(c)))};
g.h.lI=function(){return this.loaded?this.B.suggestion:null};
g.h.Mf=function(){return this.l?e8(this.l).Mf:!1};
g.h.hasNext=function(){return this.l?e8(this.l).hasNext:!1};
g.h.getCurrentTime=function(){return this.H};
g.h.cN=function(){var a=e8(this.l),b=this.g.getVideoData();return{allowSeeking:this.g.bd(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.C?a.A+Y7(a):a.A,isPeggedToLive:1>=(a.C?a.o+Y7(a):a.o)-this.getCurrentTime(),loaded:a.I,seekableEnd:a.C?a.o+Y7(a):a.o,seekableStart:0<a.B?a.B+Y7(a):a.B}};
g.h.dN=function(){this.l&&this.l.XD()};
g.h.eN=function(){this.l&&this.l.YD()};
g.h.jP=function(a){1==a&&(this.I=this.l?e8(this.l):null)};
g.h.YR=function(){var a=H8()?new d8(C8(),void 0):null;if(a){var b=this.A;this.loaded&&this.unload();this.l=a;this.I=null;b.key!=this.o.key&&(this.A=b,this.load())}else g.cf(this.l),this.l=null,this.loaded&&(this.unload(),(a=this.I)&&a.videoId==this.g.getVideoData().videoId&&this.g.Oz(a.videoId,$7(a)));this.g.T("videodatachange","newdata",this.g.getVideoData(),3)};
g.h.MB=function(){this.F=[this.o].concat(eEa());var a=D8()||this.o;S8(this,a);this.g.ra("onMdxReceiversChange")};
g.h.WR=function(){var a=D8();S8(this,a)};
g.h.VR=function(){this.A=D8()};
g.h.bN=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.F;case "currentReceiver":return b&&("cast-selector-receiver"==b.key?U7():S8(this,b)),this.loaded?this.A:this.o;case "quickCast":return 2==this.F.length&&"cast-selector-receiver"==this.F[1].key?(b&&U7(),!0):!1}};
g.h.fN=function(){i8(this.l,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.h.Lc=function(){return!1};g.bY.remote=R8;})(_yt_player);
