(function(g){var window=this;var zBa=function(a,b){return g.Vb(a,b)},m6=function(a){g.Sm(a,"zx",g.xb());
return a},n6=function(a,b,c){g.ya(c)||(c=[String(c)]);
g.Vm(a.g,b,c)},ABa=function(a,b){var c=[];
g.Ak(b,function(a){try{var b=g.nD.prototype.l.call(this,a,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}g.t(b)?g.mD(b)&&c.push(a):c.push(a)},a);
return c},BBa=function(a,b){var c=ABa(a,b);
(0,g.B)(c,function(a){g.nD.prototype.remove.call(this,a)},a)},CBa=function(a){if(a.ud){if(a.ud.locationOverrideToken)return{locationOverrideToken:a.ud.locationOverrideToken};
if(null!=a.ud.latitudeE7&&null!=a.ud.longitudeE7)return{latitudeE7:a.ud.latitudeE7,longitudeE7:a.ud.longitudeE7}}return null},DBa=function(a,b,c,d){var e=new g.Jm(null,void 0);
a&&g.Km(e,a);b&&g.Lm(e,b);c&&g.Mm(e,c);d&&g.Nm(e,d);return e},EBa=function(a){g.jG[a]&&(a=g.jG[a],(0,g.B)(a,function(a){g.hG[a]&&delete g.hG[a]}),a.length=0)},FBa=function(a){var b=g.gG();
if(b)if(b.clear(a),a)EBa(a);else for(var c in g.jG)EBa(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.Dm;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",GBa(this,a.capabilities||""),HBa(this,a.experiments||""),this.l=a.remoteControllerUrl||"",
this.g=a.localChannelEncryptionKey||"")},GBa=function(a,b){a.capabilities.clear();
(0,g.Md)(b.split(","),g.Ea(zBa,IBa)).forEach(function(b){a.capabilities.add(b)})},HBa=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)},JBa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid}},KBa=function(a){return new p6(a)},LBa=function(a){return g.ya(a)?(0,g.G)(a,KBa):[]},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)})},MBa=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)})},NBa=function(){var a=(0,g.cH)();
a&&BBa(a,a.g.Md(!0))},w6=function(){var a=g.fH("yt-remote-connected-devices")||[];
g.ib(a);return a},OBa=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)})},PBa=function(a){g.eH("yt-remote-connected-devices",a,86400)},y6=function(){if(x6)return x6;
var a=g.fH("yt-remote-device-id");a||(a=t6(),g.eH("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.hH()&&g.kb(a,b);a=OBa(a);if(g.Ra(a))try{g.QG("remote_sid")}catch(c){}else try{g.PG("remote_sid",a.join(","),-1)}catch(c){}},QBa=function(){return g.fH("yt-remote-session-browser-channel")},RBa=function(){return g.fH("yt-remote-local-screens")||[]},SBa=function(){g.eH("yt-remote-lounge-token-expiration",!0,86400)},TBa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=(0,g.G)(RBa(),function(a){return a.loungeToken}),c=(0,g.G)(a,function(a){return a.loungeToken});
(0,g.rm)(c,function(a){return!g.Qa(b,a)})&&SBa();
g.eH("yt-remote-local-screens",a,31536E3)},UBa=function(a,b){g.eH("yt-remote-session-browser-channel",a);
g.eH("yt-remote-session-screen-id",b);var c=w6(),d=y6();g.Qa(c,d)||c.push(d);PBa(c);z6()},A6=function(a){a||(g.gH("yt-remote-session-screen-id"),g.gH("yt-remote-session-video-id"));
z6();a=w6();g.Wa(a,y6());PBa(a)},VBa=function(){if(!B6){var a=g.yD();
a&&(B6=new g.hD(a))}return B6?!!B6.get("yt-remote-use-staging-server"):!1},WBa=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)},XBa=function(a,b){var c=g.Fd("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.ee("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},YBa=function(){var a=WBa(),b=window.document.getElementById(a),c=b&&g.sF(b,"loaded");
c||b&&!c||(b=XBa(a,function(){g.sF(b,"loaded")||(g.rF(b,"loaded","true"),g.nG(a),g.gE(g.Ea(FBa,a),0))}))},C6=function(a){return!!window.document.currentScript&&(-1!=window.document.currentScript.src.indexOf("?"+a)||-1!=window.document.currentScript.src.indexOf("&"+a))},ZBa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},D6=function(a){a.length?$Ba(a.shift(),function(){D6(a)}):E6()},aCa=function(a){return"chrome-extension://"+a+F6},$Ba=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=ZBa();
a&&a(!1,"No cast extension found")},H6=function(){if(bCa){var a=2,b=ZBa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;$Ba("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",E6,c)}},cCa=function(){var a=window.__gCrWeb&&window.__gCrWeb.message&&window.__gCrWeb.message.invokeOnHost;
a&&(H6(),a({command:"cast.sender.init"}))},dCa=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.jI,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.Zm(this);this.l=new g.ug;this.l.setInterval(250)},fCa=function(a,b,c){a.oj=1;
a.Vg=m6(b.clone());a.yi=c;a.C=!0;eCa(a,null)},L6=function(a,b,c,d,e){a.oj=1;
a.Vg=m6(b.clone());a.yi=null;a.C=c;e&&(a.DC=!1);eCa(a,d)},eCa=function(a,b){a.Tj=(0,g.F)();
M6(a);a.th=a.Vg.clone();n6(a.th,"t",a.D);a.Tl=0;a.Oc=a.g.Bq(a.g.Nl()?b:null);0<a.ir&&(a.Go=new g.dl((0,g.z)(a.PD,a,a.Oc),a.ir));a.A.U(a.Oc,"readystatechange",a.DT);var c=a.Wh?g.cc(a.Wh):{};a.yi?(a.wp="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.Oc.send(a.th,a.wp,a.yi,c)):(a.wp="GET",a.DC&&!g.Bd&&(c.Connection="close"),a.Oc.send(a.th,a.wp,null,c));a.g.lf(1)},iCa=function(a,b,c){for(var d=!0;!a.Ih&&a.Tl<c.length;){var e=gCa(a,c);
if(e==N6){4==b&&(a.Wg=4,O6(15),d=!1);break}else if(e==hCa){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))},gCa=function(a,b){var c=a.Tl,d=b.indexOf("\n",c);
if(-1==d)return N6;c=Number(b.substring(c,d));if((0,window.isNaN)(c))return hCa;d+=1;if(d+c>b.length)return N6;var e=b.substr(d,c);a.Tl=d+c;return e},kCa=function(a,b){a.Tj=(0,g.F)();
M6(a);var c=b?window.location.hostname:"";a.th=a.Vg.clone();g.Sm(a.th,"DOMAIN",c);g.Sm(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 jCa)k=S6[l]=jCa[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.JS,a);a.tf.parentWindow.d=(0,g.z)(a.QB,a,!0);a.tf.parentWindow.rpcClose=(0,g.z)(a.QB,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.Mu=(0,g.F)()+a.B;
lCa(a,a.B)},lCa=function(a,b){if(null!=a.lk)throw Error("WatchDog timer not null");
a.lk=T6((0,g.z)(a.aT,a),b)},U6=function(a){a.lk&&(g.w.clearTimeout(a.lk),a.lk=null)},R6=function(a){a.g.Rx()||a.Ih||a.g.vo(a)},Q6=function(a){U6(a);
g.cf(a.Go);a.Go=null;a.l.stop();g.en(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.JB(a,b),a.g.lf(4)}catch(c){}},nCa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;mCa(a,b,function(e){e?c(!0):g.w.setTimeout(function(){nCa(a,b,c,d,f)},f)})}},mCa=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},oCa=function(a){this.g=a;
this.l=new J6},pCa=function(a){var b=W6(a.g,a.sk,"/mail/images/cleardot.gif");
m6(b);nCa(b.toString(),5E3,(0,g.z)(a.vH,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.ke=new K6(a,void 0,void 0,void 0),a.ke.Wh=a.dr,b=a.g,b=W6(b,b.Nl()?a.Rk:null,a.gr),O6(5),!g.zd||g.sc(10))n6(b,"TYPE","xmlhttp"),L6(a.ke,b,!1,a.Rk,!1);else{n6(b,"TYPE","html");var c=a.ke;a=!!a.Rk;c.oj=3;c.Vg=m6(b.clone());kCa(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},qCa=function(a,b){this.g=a;
this.map=b;this.context=null},rCa=function(a){g.ef.call(this,"statevent",a)},sCa=function(a,b){g.ef.call(this,"timingevent",a);
this.size=b},tCa=function(a){g.ef.call(this,"serverreachability",a)},wCa=function(a){uCa(a);
if(3==a.g){var b=a.zl++,c=a.tn.clone();g.Sm(c,"SID",a.o);g.Sm(c,"RID",b);g.Sm(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)}vCa(a)},xCa=function(a){a.QH(1,0);
a.tn=W6(a,null,a.ar);a7(a)},uCa=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.Rd&&(a.Rd.cancel(),a.Rd=null);a.Og&&(g.w.clearTimeout(a.Og),a.Og=null)},yCa=function(a,b){if(0==a.g)throw Error("Invalid operation: sending map when state is closed");
a.l.push(new qCa(a.zO++,b));2!=a.g&&3!=a.g||a7(a)},a7=function(a){a.Rd||a.Og||(a.Og=T6((0,g.z)(a.OB,a),0),a.cj=0)},ACa=function(a,b){if(1==a.g){if(!b){a.zl=Math.floor(1E5*Math.random());
var c=a.zl++,d=new K6(a,"",c,void 0);d.Wh=null;var e=c7(a),f=a.tn.clone();g.Sm(f,"RID",c);g.Sm(f,"CVER","1");$6(a,f);fCa(d,f,e);a.Rd=d;a.g=2}}else 3==a.g&&(b?zCa(a,b):0==a.l.length||a.Rd||zCa(a))},zCa=function(a,b){if(b)if(6<a.Kh){a.l=a.A.concat(a.l);
a.A.length=0;var c=a.zl-1;var d=c7(a)}else c=b.F,d=b.yi;else c=a.zl++,d=c7(a);var e=a.tn.clone();g.Sm(e,"SID",a.o);g.Sm(e,"RID",c);g.Sm(e,"AID",a.Bj);$6(a,e);c=new K6(a,a.o,c,a.cj+1);c.Wh=null;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.Rd=c;fCa(c,e,d)},$6=function(a,b){if(a.md){var c=a.md.zx();
c&&g.Kb(c,function(a,c){g.Sm(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("&")},BCa=function(a){a.sc||a.jg||(a.D=1,a.jg=T6((0,g.z)(a.NB,a),0),a.Qi=0)},d7=function(a){if(a.sc||a.jg||3<=a.Qi)return!1;
a.D++;a.jg=T6((0,g.z)(a.NB,a),CCa(a,a.Qi));a.Qi++;return!0},X6=function(a,b,c){a.up=c;
a.Ff=b.qg;a.C||xCa(a)},b7=function(a){null!=a.Mh&&(g.w.clearTimeout(a.Mh),a.Mh=null)},CCa=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.md&&(c=null);var d=(0,g.z)(a.yU,a);c||(c=new g.Jm("//www.google.com/images/cleardot.gif"),m6(c));mCa(c.toString(),1E4,d)}else O6(2);DCa(a,b)},DCa=function(a,b){a.g=0;
a.md&&a.md.tw(b);vCa(a);uCa(a)},vCa=function(a){a.g=0;
a.Ff=-1;if(a.md)if(0==a.A.length&&0==a.l.length)a.md.nq();else{g.Za(a.A);var b=g.Za(a.l);a.A.length=0;a.l.length=0;a.md.nq(b)}},W6=function(a,b,c){var d=g.Tm(c);
if(""!=d.l)b&&g.Lm(d,b+"."+d.l),g.Mm(d,d.B);else{var e=window.location;d=DBa(e.protocol,b?b+"."+e.hostname:e.hostname,e.port,c)}a.Dk&&g.Kb(a.Dk,function(a,b){g.Sm(d,b,a)});
g.Sm(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 rCa(f7,a))},ECa=function(){},FCa=function(a,b){this.action=a;
this.params=b||{}},g7=function(a,b){g.K.call(this);
this.g=new g.ju(this.AS,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.gD;this.l=new g7(this.hV,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},GCa=function(a){return{firstTestResults:[""],
secondTestResults:!a.g.up,sessionId:a.g.o,arrayId:a.g.Bj}},HCa=function(a,b){a.F=b||0;
a.l.stop();a.g&&(3==a.g.g&&ACa(a.g),wCa(a.g));a.F=0},i7=function(a){return!!a.g&&3==a.g.g},ICa=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.Lg(a)||"";b&&(this.port=":"+b);this.domain=g.Kg(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),rd:g.Ea(a.B,e)};c&&(a.Kb=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.EE(b,a)},MCa=function(){var a=JCa;
KCa();m7.push(a);LCa(m7)},n7=function(a,b){KCa();
var c=m7,d=NCa(a,String(b));g.Ra(c)?OCa(d):(LCa(c),(0,g.B)(c,function(a){a(d)}))},KCa=function(){m7||(m7=g.x("yt.mdx.remote.debug.handlers_")||[],g.va("yt.mdx.remote.debug.handlers_",m7,void 0))},OCa=function(a){var b=(o7+1)%50;
o7=b;p7[b]=a;q7||(q7=49==b)},LCa=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}},NCa=function(a,b){var c=((0,g.F)()-PCa)/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.ZF.call(this);
this.D=a;this.g=[]},QCa=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},RCa=function(a,b){var c=a.g.length!=b.length;
a.g=(0,g.Md)(a.g,function(a){return!!u6(b,a)});
for(var d=0,e=b.length;d<e;d++)c=QCa(a,b[d])||c;return c},SCa=function(a,b){var c=a.g.length;
a.g=(0,g.Md)(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.ZF.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))},TCa=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.wI,a),(0,g.z)(a.vI,a))}},t7=function(a){var b=LBa(RBa());
b=(0,g.Md)(b,function(a){return!a.uuid});
return RCa(a,b)},v7=function(a,b){TBa((0,g.G)(a.g,JBa));
b&&SBa()},x7=function(a,b){g.ZF.call(this);
this.C=b;var c=g.fH("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))},UCa=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.Sb(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"));VCa(a)},z7=function(a){(0,window.isNaN)(a.o)||g.iE(a.o);
a.o=g.gE((0,g.z)(a.bu,a),0<a.A&&a.A<(0,g.F)()?2E4:1E4)},w7=function(a){n7("OnlineScreenService",a)},WCa=function(a){var b={};
(0,g.B)(a.C(),function(a){a.token?b[a.token]=a.id:this.bc("Requesting availability of screen w/o lounge token.")});
return b},VCa=function(a){a=g.Sb(g.Lb(a.g,function(a){return a}));
g.ib(a);a.length?g.eH("yt-remote-online-screen-ids",a.join(","),60):g.gH("yt-remote-online-screen-ids")},A7=function(a){r7.call(this,"ScreenService");
this.C=a;this.l=this.o=null;this.A=[];this.B={};XCa(this)},ZCa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.B[b]);var k=a.fe();if(k=(c?v6(k,c):null)||v6(k,b)){k.uuid=b;var l=B7(a,k);UCa(a.l,l,function(a){e(a?l:null)})}else c?YCa(a,c,(0,g.z)(function(a){var f=B7(this,new p6({name:d,
screenId:c,loungeToken:a,dialId:b||""}));UCa(this.l,f,function(a){e(a?f:null)})},a),f):e(null)},$Ca=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},YCa=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.EE(k7(a.C,"/pairing/get_lounge_token_batch"),e)},aDa=function(a){a.g=a.o.fe();
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))},XCa=function(a){C7(a);
a.o=new u7(a.C);a.o.subscribe("screenChange",(0,g.z)(a.LI,a));aDa(a);a.A=LBa(g.fH("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.fe,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.eH("yt-remote-automatic-screen-cache",(0,g.G)(a.A,JBa)));C7(a);a.B[b.uuid]=b.id;g.eH("yt-remote-device-id-map",a.B,31536E3);return b},C7=function(a){a.B=g.fH("yt-remote-device-id-map")||{}},D7=function(a,b,c){g.ZF.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.nV,this);this.B=(0,g.z)(this.mT,this);this.A=g.gE((0,g.z)(function(){bDa(this,null)},this),12E4)},cDa=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))},bDa=function(a,b){g.iE(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.je,a);a.Kx(b,c,d,5)}}else a.je(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.qV,this);this.g=g.y},dDa=function(a){a.g=a.H.WD(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.je(a)},a))},eDa=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}VBa()&&(b.env_useStageMdx=1);return g.Sg(b)},H7=function(a,b){D7.call(this,a,b,"ManualSession");
this.g=g.gE((0,g.z)(this.Cj,this,null),150)},I7=function(a,b,c,d){g.ZF.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.NR,this)},fDa=function(a,b){return b?g.Ma(a.o,function(a){return q6(b,a.label)},a):null},J7=function(a){n7("Controller",a)},JCa=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.LB,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))},gDa=function(a){var b=a.l.VD(),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=fDa(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},mDa=function(a,b,c,d,e,f,k){hDa()?iDa(b,e,f,k)&&(N7(!0),window.chrome&&window.chrome.cast&&window.chrome.cast.isAvailable?jDa(a,c):(window.__onGCastApiAvailable=function(b,d){b?jDa(a,c):(O7("Failed to load cast API: "+d),P7(!1),N7(!1),g.gH("yt-remote-cast-available"),g.gH("yt-remote-cast-receiver"),kDa(),
c(!1))},d?window.spf?window.spf.script.load("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js","",void 0):YBa():G6("CriOS")?cCa():G6("Android")&&G6("Chrome/")&&window.navigator.presentation?dCa():window.chrome&&window.navigator.presentation&&!G6("Edge")?(H6(),D6(lDa.map(aCa))):E6())):M7("Cannot initialize because not running Chrome")},kDa=function(){M7("dispose");
var a=Q7();a&&a.dispose();g.va("yt.mdx.remote.cloudview.instance_",null,void 0);nDa(!1);g.lG(R7);R7.length=0},S7=function(){return!!g.fH("yt-remote-cast-installed")},oDa=function(){var a=g.fH("yt-remote-cast-receiver");
return a?a.friendlyName:null},pDa=function(){M7("clearCurrentReceiver");
g.gH("yt-remote-cast-receiver")},qDa=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.kG("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.")},hDa=function(){var a=0<=g.Ib.search(/ (CrMo|Chrome|CriOS)\//);
return g.GI||a},rDa=function(a,b){Q7().init(a,b)},iDa=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.eH("yt-remote-cast-available",a);g.oG("yt-remote-cast2-availability-change",a)}),a.subscribe("yt-remote-cast2-receiver-selected",function(a){M7("onReceiverSelected: "+a.friendlyName);
g.eH("yt-remote-cast-receiver",a);g.oG("yt-remote-cast2-receiver-selected",a)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(a){M7("onReceiverResumed: "+a.friendlyName);
g.eH("yt-remote-cast-receiver",a)}),a.subscribe("yt-remote-cast2-session-change",function(a){M7("onSessionChange: "+r6(a));
a||g.gH("yt-remote-cast-receiver");g.oG("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_")},jDa=function(a,b){P7(!0);
N7(!1);rDa(a,function(a){a?(nDa(!0),g.nG("yt-remote-cast2-api-ready")):(O7("Failed to initialize cast API."),P7(!1),g.gH("yt-remote-cast-available"),g.gH("yt-remote-cast-receiver"),kDa());b(a)})},M7=function(a){n7("cloudview",a)},O7=function(a){n7("cloudview",a)},P7=function(a){M7("setCastInstalled_ "+a);
g.eH("yt-remote-cast-installed",a)},T7=function(){return!!g.x("yt.mdx.remote.cloudview.apiReady_")},nDa=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.If=!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.If=!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.fb()?((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.If;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.ZF.call(this);
this.g=0;this.A=a;this.C=[];this.B=new g.xC;this.o=this.l=null;this.H=(0,g.z)(this.jP,this);this.D=(0,g.z)(this.Cl,this);this.F=(0,g.z)(this.iP,this);this.I=(0,g.z)(this.vP,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.Su,this),sDa(this))):c=3;0!=c&&(b?this.Su(c):g.gE((0,g.z)(function(){this.Su(c)},this),0));
var d=qDa();d&&c8(this,d);this.subscribe("yt-remote-cast2-session-change",this.I)},e8=function(a){return new W7(a.A.getPlayerContextData())},sDa=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.IR,a),this))},a)},tDa=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.zC(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){tDa(a);
a.A.setPlayerContextData(b8(b));sDa(a)},c8=function(a,b){a.o&&(a.o.removeUpdateListener(a.H),a.o.removeMediaListener(a.D),a.Cl(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.Cl(a.o.media[0]))},uDa=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.bc("Failed to "+b+" with cast v2 channel. Error code: "+a.code);
a.code!=window.chrome.cast.ErrorCode.TIMEOUT&&(this.bc("Retrying "+b+" using MDx browser channel."),i8(this,b,c))},a)},k8=function(a,b,c){g.ZF.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.oa=a;this.R.push(g.IF(window,"beforeunload",(0,g.z)(this.nI,this)));this.l=[];this.Va=new W7;this.Y=b.id;this.g=vDa(this,c);this.g.subscribe("handlerOpened",this.nP,this);this.g.subscribe("handlerClosed",this.kP,this);this.g.subscribe("handlerError",this.lP,this);this.g.subscribe("handlerMessage",this.mP,this);ICa(this.g,b.token);this.subscribe("remoteQueueChange",function(){var a=
this.Va.videoId;g.hH()&&g.eH("yt-remote-session-video-id",a)},this)},l8=function(a){n7("conn",a)},vDa=function(a,b){return new h7(k7(a.oa,"/bc"),b)},m8=function(a,b){a.T("proxyStateChange",b)},wDa=function(a){a.B=g.gE((0,g.z)(function(){l8("Connecting timeout");
this.C(1)},a),2E4)},n8=function(a){g.iE(a.B);
a.B=window.NaN},o8=function(a){g.iE(a.L);
a.L=window.NaN},xDa=function(a){p8(a);
a.K=g.gE((0,g.z)(function(){q8(this,"getNowPlaying")},a),2E4)},p8=function(a){g.iE(a.K);
a.K=window.NaN},zDa=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"),yDa(a)):a.C(1)},ADa=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"))},BDa=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")},DDa=function(a,b){b.params=b.params||{};
BDa(a,b);CDa(a,b);a.T("autoplayDismissed")},CDa=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?xDa(a):p8(a);
a.T("remotePlayerChange")},EDa=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")}},FDa=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")},GDa=function(a,b){a.D=b.params.videoId;
a.T("nowAutoplaying",(0,window.parseInt)(b.params.timeout,10))},HDa=function(a,b){var c="true"==b.params.hasNext;
a.Va.If="true"==b.params.hasPrevious;a.Va.hasNext=c;a.T("previousNextChange")},yDa=function(a){g.iE(a.I);
a.I=g.gE((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.lV,this)));this.l.push(this.Zc.$_s("onlineScreenChange",(0,g.z)(this.iR,this)))},MDa=function(a){var b={device:"Desktop",
app:"youtube-desktop"};b=g.aE("MDX_CONFIG")||b;NBa();z6();s8||(s8=new j7(b?b.loungeApiHost:void 0),VBa()&&(s8.g="/api/loungedev"));t8||(t8=g.x("yt.mdx.remote.deferredProxies_")||[],g.va("yt.mdx.remote.deferredProxies_",t8,void 0));IDa();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);mDa(a,d,function(a){a?v8()&&V7(v8(),"YouTube TV"):d.subscribe("onlineScreenChange",
function(){g.oG("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.kG("yt-remote-cast2-availability-change",function(){g.oG("yt-remote-receiver-availability-change")})),x8.push(g.kG("yt-remote-cast2-receiver-selected",function(){y8(null);
g.oG("yt-remote-auto-connect","cast-selector-receiver")})),x8.push(g.kG("yt-remote-cast2-receiver-resumed",function(){g.oG("yt-remote-receiver-resumed","cast-selector-receiver")})),x8.push(g.kG("yt-remote-cast2-session-change",JDa)),x8.push(g.kG("yt-remote-connection-change",function(a){a?V7(v8(),"YouTube TV"):z8()||(V7(null,null),pDa())})),a=A8(),b.isAuto&&(a.id+="#dial"),g.eG("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)),KDa(a),c.start(),v8()||LDa())},ODa=function(){var a=NDa();
S7()&&g.fH("yt-remote-cast-available")&&a.push({key:"cast-selector-receiver",name:"Cast..."});return a},NDa=function(){var a=u8().Zc.$_gos();
var b=B8();b&&C8()&&(u6(a,b)||a.push(b));return MBa(a)},D8=function(){var a=PDa();
!a&&S7()&&oDa()&&(a={key:"cast-selector-receiver",name:oDa()});return a},PDa=function(){var a=NDa(),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().fe();return v6(b,a)},JDa=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_")},QDa=function(a){g.va("yt.mdx.remote.currentScreenId_",a,void 0)},RDa=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||QDa("");g.va("yt.mdx.remote.connection_",a,void 0);t8&&((0,g.B)(t8,function(b){b(a)}),t8.length=0);
b&&!a?g.oG("yt-remote-connection-change",!1):!b&&a&&g.oG("yt-remote-connection-change",!0)},z8=function(){var a=g.hH();
if(!a)return null;var b=u8().fe();return v6(b,a)},F8=function(a,b){B8()&&B8();
QDa(a.id);var c=new k8(s8,a,A8());c.connect(b,RDa());c.subscribe("beforeDisconnect",function(a){g.oG("yt-remote-before-disconnect",a)});
c.subscribe("beforeDispose",function(){C8()&&G8(null)});
G8(c)},LDa=function(){var a=z8();
a?(w8("Resume connection to: "+r6(a)),F8(a,0)):(A6(),pDa(),w8("Skipping connecting because no session screen found."))},IDa=function(){var a=A8();
if(g.Yb(a)){a=y6();var b=g.fH("yt-remote-session-name")||"",c=g.fH("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_")||{}},KDa=function(a){a?(g.eH("yt-remote-session-app",a.app),g.eH("yt-remote-session-name",a.name)):(g.gH("yt-remote-session-app"),g.gH("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.WF(this);g.L(this,this.o);this.o.O(b,"onCaptionsTrackListChanged",this.BQ);this.o.O(b,"captionschanged",this.hP);this.o.O(b,"captionssettingschanged",this.jD);this.o.O(b,"videoplayerreset",this.xo);this.o.O(b,"mdxautoplaycancel",this.uH);this.R=this.o.O(b,"onVolumeChange",this.vB);this.D=!1;this.g=c;c.subscribe("proxyStateChange",this.IB,this);c.subscribe("remotePlayerChange",this.Fl,this);c.subscribe("remoteQueueChange",this.xo,this);c.subscribe("autoplayUpNext",this.eB,
this);c.subscribe("previousNextChange",this.FB,this);c.subscribe("nowAutoplaying",this.xB,this);c.subscribe("autoplayDismissed",this.dB,this);this.suggestion=null;this.H=new g.wP(64);this.A=new g.ju(this.fD,500,this);g.L(this,this.A);this.B=new g.ju(this.gD,1E3,this);g.L(this,this.B);this.K=new I6(this.OU,0,this);g.L(this,this.K);this.C={};this.L=new g.ju(this.GD,1E3,this);g.L(this,this.L);this.I=new g.dl(this.hN,1E3,this);g.L(this,this.I);this.N=g.y;this.jD();this.xo();this.Fl()},K8=function(a,b){var c=
a.F,d=a.l.getVideoData().lengthSeconds;
c.H=b||0;c.g.T("progresssync",b,d)},SDa=function(a){K8(a,0);
a.A.stop();L8(a,new g.wP(64))},N8=function(a,b){if(M8(a)&&!a.D){var c=null;
b&&(c={style:a.l.oi()},g.fc(c,b));a.g.WC(a.l.getVideoData(1).videoId,c);a.C=e8(a.g).l}},O8=function(a,b){var c=a.l.Sf();
if(c){var d=c.de();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=CBa(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.wP(1))},TDa=function(a,b){if(b){var c=a.l.uc("captions","tracklist",{Gy:1});
c&&c.length?(a.l.Fd("captions","track",b),a.D=!1):(a.l.Fj("captions"),a.D=!0)}else a.l.Fd("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.EP(c,b)){var d=g.W(b,2);d!=g.W(a.H,2)&&g.QU(a.l,d);a.H=b;UDa(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.kpa()]},{G:"div",M:"ytp-remote-display-status-text",J:["{{statustext}}"]}]}]});this.o=new g.DV(this,250);g.L(this,this.o);this.A=a;this.O(a,"presentingplayerstatechange",this.B);VDa(this,g.NU(a))},VDa=function(a,b){if(3==a.A.Pa()){var c={RECEIVER_NAME:a.A.uc("remote","currentReceiver").name};
c=g.W(b,128)?g.T("YTP_MDX_STATUS_ERROR_2",c):b.fb()||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.OZ.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.kV.call(this,a);
g.jH({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.wP(64);this.H=0;if(!g.MM(g.X(this.g))){a=
this.g;var b=g.WH(a);b&&(b=b.bo())&&(b=new Q8(a,b),g.L(this,b));b=new P8(a);g.L(this,b);g.eV(a,b.element,4)}},UDa=function(a,b,c){a.D=c;
a.g.T("presentingplayerstatechange",new g.KP(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.Sf();if(f){var k=[];for(var l=0;l<f.getLength();l++)k[l]=f.Ub(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.Jz(),0),currentTime:0==f?void 0:f};(d=CBa(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.oG("yt-remote-connection-change",!0):(E8(),y8(d||null),d=u8().fe(),(d=v6(d,b.key))&&F8(d,1))}},jCa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"<"},S6={"'":"\\'"},WDa={},IBa={DW:"atp",Y0:"ska",p0:"que",B_:"mus",U0:"sus",MY:"dsp"};
o6.prototype.Wm=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",bCa=C6("loadCastFramework")||C6("loadCastApplicationFramework"),lDa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.A(I6,g.K);g.h=I6.prototype;g.h.iI=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.Z.V.call(this)};
g.h.jI=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.Wh=null;g.h.sf=!1;g.h.lk=null;g.h.Mu=null;g.h.Tj=null;g.h.oj=null;g.h.Vg=null;g.h.th=null;g.h.yi=null;g.h.Oc=null;g.h.Tl=0;g.h.tf=null;g.h.wp=null;g.h.Wg=null;g.h.Sk=-1;g.h.DC=!0;g.h.Ih=!1;g.h.ir=0;g.h.Go=null;var hCa={},N6={};g.h=K6.prototype;g.h.setTimeout=function(a){this.B=a};
g.h.DT=function(a){a=a.target;var b=this.Go;b&&3==g.xx(a)?b.mj():this.PD(a)};
g.h.PD=function(a){try{if(a==this.Oc)a:{var b=g.xx(this.Oc),c=this.Oc.l,d=this.Oc.getStatus();if(g.zd&&!g.sc(10)||g.Bd&&!g.rc("420+")){if(4>b)break a}else if(3>b||3==b&&!g.gf&&!g.Bx(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.Bx(this.Oc);(this.sf=200==e)?(4==b&&Q6(this),this.C?(iCa(this,b,f),g.gf&&this.sf&&3==b&&(this.A.U(this.l,"tick",this.zT),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.Bx(this.Oc)}finally{}};
g.h.zT=function(){var a=g.xx(this.Oc),b=g.Bx(this.Oc);this.Tl<b.length&&(U6(this),iCa(this,a,b),this.sf&&4!=a&&M6(this))};
g.h.JS=function(a){T6((0,g.z)(this.IS,this,a),0)};
g.h.IS=function(a){this.Ih||(U6(this),P6(this,a),M6(this))};
g.h.QB=function(a){T6((0,g.z)(this.HS,this,a),0)};
g.h.HS=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.aT=function(){this.lk=null;var a=(0,g.F)();0<=a-this.Mu?(2!=this.oj&&this.g.lf(3),Q6(this),this.Wg=2,O6(18),R6(this)):lCa(this,this.Mu-a)};g.h=oCa.prototype;g.h.dr=null;g.h.ke=null;g.h.Ho=!1;g.h.Sx=null;g.h.nn=null;g.h.fr=null;g.h.gr=null;g.h.Ie=null;g.h.qg=-1;g.h.Rk=null;g.h.sk=null;g.h.connect=function(a){this.gr=a;a=W6(this.g,null,this.gr);O6(3);this.Sx=(0,g.F)();var b=this.g.F;null!=b?(this.Rk=b[0],(this.sk=b[1])?(this.Ie=1,pCa(this)):(this.Ie=2,Y6(this))):(n6(a,"MODE","init"),this.ke=new K6(this,void 0,void 0,void 0),this.ke.Wh=this.dr,L6(this.ke,a,!1,null,!0),this.Ie=0)};
g.h.vH=function(a){if(a)this.Ie=2,Y6(this);else{O6(4);var b=this.g;b.Ff=b.Mg.qg;e7(b,9)}a&&this.lf(2)};
g.h.Bq=function(a){return this.g.Bq(a)};
g.h.abort=function(){this.ke&&(this.ke.cancel(),this.ke=null);this.qg=-1};
g.h.Rx=function(){return!1};
g.h.JB=function(a,b){this.qg=a.Sk;if(0==this.Ie)if(b){try{var c=this.l.parse(b)}catch(d){c=this.g;c.Ff=this.qg;e7(c,2);return}this.Rk=c[0];this.sk=c[1]}else c=this.g,c.Ff=this.qg,e7(c,2);else if(2==this.Ie)if(this.Ho)O6(7),this.fr=(0,g.F)();else if("11111"==b){if(O6(6),this.Ho=!0,this.nn=(0,g.F)(),c=this.nn-this.Sx,!g.zd||g.sc(10)||500>c)this.qg=200,this.ke.cancel(),O6(12),X6(this.g,this,!0)}else O6(8),this.nn=this.fr=(0,g.F)(),this.Ho=!1};
g.h.vo=function(){this.qg=this.ke.Sk;if(this.ke.sf)0==this.Ie?this.sk?(this.Ie=1,pCa(this)):(this.Ie=2,Y6(this)):2==this.Ie&&((!g.zd||g.sc(10)?!this.Ho:200>this.fr-this.nn)?(O6(11),X6(this.g,this,!1)):(O6(12),X6(this.g,this,!0)));else{0==this.Ie?O6(9):2==this.Ie&&O6(10);var a=this.g;a.Ff=this.qg;e7(a,2)}};
g.h.Nl=function(){return this.g.Nl()};
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.Rd=null;g.h.sc=null;g.h.ar=null;g.h.tn=null;g.h.iw=null;g.h.Dn=null;g.h.zl=0;g.h.zO=0;g.h.md=null;g.h.Og=null;g.h.jg=null;g.h.Mh=null;g.h.Mg=null;g.h.up=null;g.h.Bj=-1;g.h.Uy=-1;g.h.Ff=-1;g.h.cj=0;g.h.Qi=0;g.h.Kh=8;var f7=new g.Gf;g.A(rCa,g.ef);g.A(sCa,g.ef);g.A(tCa,g.ef);g.h=Z6.prototype;g.h.connect=function(a,b,c,d,e){O6(0);this.ar=b;this.Dk=c||{};d&&g.t(e)&&(this.Dk.OSID=d,this.Dk.OAID=e);this.C?(T6((0,g.z)(this.Gw,this,a),100),xCa(this)):this.Gw(a)};
g.h.Gw=function(a){this.Mg=new oCa(this);this.Mg.dr=null;this.Mg.l=this.B;this.Mg.connect(a)};
g.h.Rx=function(){return 0==this.g};
g.h.OB=function(a){this.Og=null;ACa(this,a)};
g.h.NB=function(){this.jg=null;this.sc=new K6(this,this.o,"rpc",this.D);this.sc.Wh=null;this.sc.ir=0;var a=this.iw.clone();g.Sm(a,"RID","rpc");g.Sm(a,"SID",this.o);g.Sm(a,"CI",this.up?"0":"1");g.Sm(a,"AID",this.Bj);$6(this,a);if(!g.zd||g.sc(10))g.Sm(a,"TYPE","xmlhttp"),L6(this.sc,a,!0,this.Dn,!1);else{g.Sm(a,"TYPE","html");var b=this.sc,c=!!this.Dn;b.oj=3;b.Vg=m6(a.clone());kCa(b,c)}};
g.h.JB=function(a,b){if(0!=this.g&&(this.sc==a||this.Rd==a))if(this.Ff=a.Sk,this.Rd==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.Rd.Tj)b7(this),this.sc.cancel(),this.sc=null;else break a;d7(this);O6(19)}}else this.Uy=c[1],0<this.Uy-this.Bj&&37500>c[2]&&this.up&&0==this.Qi&&!this.Mh&&(this.Mh=T6((0,g.z)(this.cP,this),6E3));else e7(this,11)}else b!=WDa.GX.g&&e7(this,11);else if(this.sc==a&&
b7(this),!g.C(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.Dn=e[2],e=e[3],null!=e?this.Kh=e:this.Kh=6,this.g=3,this.md&&this.md.ww(),this.iw=W6(this,this.Nl()?this.Dn:null,this.ar),BCa(this)):"stop"==e[0]&&e7(this,7):3==this.g&&("stop"==e[0]?e7(this,7):"noop"!=e[0]&&this.md&&this.md.uw(e),this.Qi=0)}}};
g.h.cP=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.Rd==a)this.Rd=null,b=1;else return;this.Ff=a.Sk;if(0!=this.g)if(a.sf)1==b?(b=(0,g.F)()-a.Tj,f7.dispatchEvent(new sCa(f7,a.yi?a.yi.length:0,b,this.cj)),a7(this),this.A.length=0):BCa(this);else{var c=a.Wg,d;if(!(d=3==c||7==c||0==c&&0<this.Ff)){if(d=1==b)this.Rd||this.Og||1==this.g||2<=this.cj?d=!1:(this.Og=T6((0,g.z)(this.OB,this,a),CCa(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.QH=function(a){if(!g.Qa(arguments,this.g))throw Error("Unexpected channel state: "+this.g);};
g.h.yU=function(a){a?O6(2):(O6(1),DCa(this,8))};
g.h.Bq=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new g.px;a.F=!1;return a};
g.h.isActive=function(){return!!this.md&&this.md.isActive(this)};
g.h.lf=function(a){f7.dispatchEvent(new tCa(f7,a))};
g.h.Nl=function(){return!(!g.zd||g.sc(10))};
g.h=ECa.prototype;g.h.ww=function(){};
g.h.uw=function(){};
g.h.tw=function(){};
g.h.nq=function(){};
g.h.zx=function(){return{}};
g.h.isActive=function(){return!0};g.A(g7,g.K);g.h=g7.prototype;g.h.AS=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.ku(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,ECa);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.Id=function(a){return this.o.Id(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),HCa(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.md=null);d.md=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)&&yCa(this.g,c)};
g.h.ww=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)yCa(this.g,a[b])}this.T("handlerOpened")};
g.h.tw=function(a){var b=2==a&&401==this.g.Ff;4==a||b||this.l.start();this.T("handlerError",a)};
g.h.nq=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.zx=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.uw=function(a){"S"==a[0]?this.H=a[1]:"gracefulReconnect"==a[0]?(this.l.start(),wCa(this.g)):this.T("handlerMessage",new FCa(a[0],a[1]))};
g.h.hV=function(){this.l.isActive();var a=this.g,b=0;a.sc&&b++;a.Rd&&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 PCa=(0,g.F)(),m7=null,p7=Array(50),o7=-1,q7=!1;g.A(r7,g.ZF);r7.prototype.fe=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.ZF);var XDa=[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.UD()};
g.h.stop=function(){this.g&&(this.g.abort(),this.g=null);(0,window.isNaN)(this.va)||(g.iE(this.va),this.va=window.NaN)};
g.h.V=function(){this.stop();s7.Z.V.call(this)};
g.h.UD=function(){this.va=window.NaN;this.g=g.EE(k7(this.C,"/pairing/get_screen"),{method:"POST",Kb:{pairing_code:this.B},timeout:5E3,onSuccess:(0,g.z)(this.jV,this),onError:(0,g.z)(this.iV,this),rd:(0,g.z)(this.kV,this)})};
g.h.jV=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.iV=function(a){this.g=null;a.status&&404==a.status?this.l>=XDa.length?this.T("pairingFailed",Error("DIAL polling timed out")):(a=XDa[this.l],this.va=g.gE((0,g.z)(this.UD,this),a),this.l++):this.T("pairingFailed",Error("Server error "+a.status))};
g.h.kV=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.fH("yt-remote-lounge-token-expiration")&&TCa(this);g.iE(this.l);this.l=g.gE((0,g.z)(this.start,this),1E4)};
g.h.add=function(a,b){t7(this);QCa(this,a);v7(this,!1);this.T("screenChange");b(a);a.token||TCa(this)};
g.h.remove=function(a,b){var c=t7(this);SCa(this,a)&&(v7(this,!1),c=!0);b(a);c&&this.T("screenChange")};
g.h.np=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.iE(this.l);u7.Z.V.call(this)};
g.h.wI=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.vI=function(a){n7(this.D,"Requesting lounge tokens failed: "+a)};g.A(x7,g.ZF);g.h=x7.prototype;g.h.start=function(){var a=(0,window.parseInt)(g.fH("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.eH("yt-remote-fast-check-period",this.A),this.bu())};
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.iE(this.o);this.o=window.NaN;this.l&&(this.l.abort(),this.l=null);x7.Z.V.call(this)};
g.h.bu=function(){g.iE(this.o);this.o=window.NaN;this.l&&this.l.abort();var a=WCa(this);if(g.Pb(a)){var b=k7(this.B,"/pairing/get_screen_availability");this.l=l7(this.B,b,{lounge_token:g.Sb(a).join(",")},(0,g.z)(this.hS,this,a),(0,g.z)(this.gS,this))}else y7(this,{}),z7(this)};
g.h.hS=function(a,b){this.l=null;var c=g.Sb(WCa(this));if(g.jb(c,g.Sb(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.bc("Changing Screen set during request."),this.bu()};
g.h.gS=function(a){this.bc("Screen availability failed: "+a);this.l=null;z7(this)};
g.h.bc=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.np=function(a,b,c,d){this.o.contains(a)?this.o.np(a,b,c,d):(a="Updating name of unknown screen: "+a.name,n7(this.D,a),d(Error(a)))};
g.h.fe=function(a){return a?this.g:g.Ya(this.g,(0,g.Md)(this.A,function(a){return!this.contains(a)},this))};
g.h.VD=function(){return(0,g.Md)(this.fe(!0),function(a){return!!this.l.g[a.id]},this)};
g.h.WD=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.mV=function(a,b,c,d){g.EE(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||$Ca(this,e.name)){a:{var f=e.name;for(var m=2,n=b(f,m);$Ca(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),
rd:(0,g.z)(function(){d(Error("pairing request timed out."))},this)})};
g.h.V=function(){g.cf(this.o);g.cf(this.l);A7.Z.V.call(this)};
g.h.LI=function(){aDa(this);this.T("screenChange");this.l.update()};
A7.prototype.dispose=A7.prototype.dispose;g.A(D7,g.ZF);g.h=D7.prototype;g.h.wo=function(a){this.o=a;this.T("sessionScreen",this.o)};
g.h.je=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.YD=function(){return null};
g.h.iu=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.iu("");D7.Z.V.call(this)};g.A(F7,D7);g.h=F7.prototype;g.h.hu=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);cDa(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.je()},this),(0,g.z)(function(){this.je(Error("Failed to stop receiver app."))},this)):this.je(Error("Stopping cast device witout session."))};
g.h.iu=g.y;g.h.V=function(){this.info("disposeInternal");g.iE(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.Z.V.call(this)};
g.h.mT=function(a,b){if(!this.ha())if(b){var c=g.jx(b);if(g.Ba(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.Bg(c));switch(d){case "mdxSessionStatus":bDa(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.Kx=function(a,b,c,d){ZCa(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.gE((0,g.z)(this.Kx,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.h.YD=function(){return this.g};
g.h.nV=function(a){this.ha()||a||(E7(this,"Cast session died."),this.je())};g.A(G7,D7);g.h=G7.prototype;g.h.hu=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.iE(this.C);this.A?this.A.stop((0,g.z)(this.je,this,null),(0,g.z)(this.je,this,"Failed to stop DIAL device.")):this.je()};
g.h.V=function(){this.g();this.g=g.y;g.iE(this.C);this.A&&this.A.removeUpdateListener(this.K);this.A=null;G7.Z.V.call(this)};
g.h.qV=function(a){this.ha()||a||(E7(this,"DIAL session died."),this.g(),this.g=g.y,this.je())};
g.h.Rr=function(a){this.I=t6();if(this.B){var b=new window.chrome.cast.DialLaunchResponse(!0,eDa(this));a(b);dDa(this)}else this.D=(0,g.z)(function(){g.iE(this.C);this.D=g.y;this.C=window.NaN;var b=new window.chrome.cast.DialLaunchResponse(!0,eDa(this));a(b);dDa(this)},this),this.C=g.gE((0,g.z)(function(){this.D()},this),100)};
g.h.cK=function(a,b,c){ZCa(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.Rr(b,c)},this),(0,g.z)(function(a){E7(this,"Failed to get DIAL screen: "+a);
this.Rr(b,c)},this))};g.A(H7,D7);H7.prototype.stop=function(){this.je()};
H7.prototype.hu=g.y;H7.prototype.Cj=function(){g.iE(this.g);this.g=window.NaN;var a=v6(this.H.fe(),this.l.label);a?this.wo(a):this.je(Error("No such screen"))};
H7.prototype.V=function(){g.iE(this.g);this.g=window.NaN;H7.Z.V.call(this)};g.A(I7,g.ZF);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.KB,this),(0,g.z)(this.RR,this),d,e);c.customDialLaunchCallback=(0,g.z)(this.MP,this);window.chrome.cast.initialize(c,
(0,g.z)(function(){this.ha()||(window.chrome.cast.addReceiverActionListener(this.A),MCa(),this.l.subscribe("onlineScreenChange",(0,g.z)(this.XD,this)),this.o=gDa(this),window.chrome.cast.setCustomReceivers(this.o,g.y,(0,g.z)(function(a){this.bc("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.bc("Failed to initialize API: "+g.Bg(a));
b(!1)},this))};
g.h.iU=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.fe(),a);if(!c){J7("setConnectedScreenStatus: Unknown screen.");return}var d=fDa(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.bc("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.iu(b)}else J7("setConnectedScreenStatus: no screen.")};
g.h.jU=function(a){this.ha()?this.bc("Setting connection data on disposed cast v2"):this.g?this.g.Cj(a):this.bc("Setting connection data without a session")};
g.h.pV=function(){this.ha()?this.bc("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.KB,this),(0,g.z)(this.mS,this))};
g.h.V=function(){this.l.unsubscribe("onlineScreenChange",(0,g.z)(this.XD,this));window.chrome&&window.chrome.cast&&window.chrome.cast.removeReceiverActionListener(this.A);g.Wa(g.x("yt.mdx.remote.debug.handlers_")||[],JCa);g.cf(this.g);I7.Z.V.call(this)};
g.h.bc=function(a){n7("Controller",a)};
g.h.LB=function(a,b){this.g==a&&(b||L7(this,null),this.T("yt-remote-cast2-session-change",b))};
g.h.NR=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.bc("Unknown receiver type: "+a.receiverType)}break;case window.chrome.cast.ReceiverAction.STOP:this.g&&this.g.l.label==a.label?this.g.stop():this.bc("Stopping receiver w/o session: "+a.friendlyName)}else this.bc("onReceiverAction_ called without receiver.")};
g.h.MP=function(a){if(this.ha())return window.Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=window.chrome.cast.ReceiverType.DIAL&&(this.bc("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.bc("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.bc('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.cK,b,(b.F.extraData||{}).screenId||null)):new window.Promise((0,g.z)(b.Rr,b))};
g.h.KB=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.bc("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.g.l,d=v6(this.l.fe(),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.LB,this,this.g)),this.g.Cj(null));this.g.hu(a)}}};
g.h.oV=function(){return this.g?this.g.YD():null};
g.h.mS=function(a){this.ha()||(this.bc("Failed to estabilish a session: "+g.Bg(a)),a.code!=window.chrome.cast.ErrorCode.CANCEL&&L7(this,null))};
g.h.RR=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.XD=function(){this.ha()||(this.o=gDa(this),J7("Updating custom receivers: "+g.Bg(this.o)),window.chrome.cast.setCustomReceivers(this.o,g.y,(0,g.z)(function(){this.bc("Failed to set custom receivers.")},this)),this.T("yt-remote-cast2-availability-change",K7(this)))};
I7.prototype.setLaunchParams=I7.prototype.jU;I7.prototype.setConnectedScreenStatus=I7.prototype.iU;I7.prototype.stopSession=I7.prototype.pV;I7.prototype.getCastSession=I7.prototype.oV;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.If=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.fb=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.ZF);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.TD=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.fb()||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.TD,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.bc("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.bc("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.WC=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.WC,a,b))};
g.h.Ru=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.Ru,a,b))};
g.h.SD=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.SD,a,b))};
g.h.RD=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.RD,a,b))};
g.h.Xw=function(){1==this.g?i8(this,"dismissAutoplay"):f8(this,this.Xw)};
g.h.dispose=function(){if(3!=this.g){var a=this.g;this.g=3;this.T("proxyStateChange",a,this.g)}d8.Z.dispose.call(this)};
g.h.V=function(){tDa(this);this.A=null;this.B.clear();c8(this,null);d8.Z.V.call(this)};
g.h.Su=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.AC(this.B).apply(this);else 3==a&&this.dispose()}};
g.h.IR=function(a,b){this.T(a,b)};
g.h.jP=function(a){if(!a)this.Cl(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.Cl=function(a){n7("CP","Cast media: "+!!a);this.l&&this.l.removeUpdateListener(this.F);if(this.l=a)this.l.addUpdateListener(this.F),uDa(this),this.T("remotePlayerChange")};
g.h.iP=function(a){a?(uDa(this),this.T("remotePlayerChange")):this.Cl(null)};
g.h.vP=function(){var a=qDa();a&&c8(this,a)};
g.h.bc=function(a){n7("CP",a)};g.A(k8,g.ZF);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,QBa())}else l8("Connecting without params"),this.g.connect({},a,QBa());wDa(this)};
g.h.dispose=function(){this.ha()||(this.T("beforeDispose"),m8(this,3));k8.Z.dispose.call(this)};
g.h.V=function(){n8(this);p8(this);o8(this);g.iE(this.H);this.H=window.NaN;g.iE(this.I);this.I=window.NaN;this.o=null;g.JF(this.R);this.R.length=0;this.g.dispose();k8.Z.V.call(this);this.A=this.D=this.l=this.Va=this.g=null};
g.h.nI=function(){this.C(2)};
g.h.nP=function(){l8("Channel opened");this.N&&(this.N=!1,o8(this),this.L=g.gE((0,g.z)(function(){l8("Timing out waiting for a screen.");this.C(1)},this),15E3));
UBa(GCa(this.g),this.Y)};
g.h.kP=function(){l8("Channel closed");(0,window.isNaN)(this.B)?A6(!0):A6();this.dispose()};
g.h.lP=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.mP=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.jx(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});
zDa(this,a);break;case "loungeScreenDisconnected":g.Xa(this.l,function(a){return"LOUNGE_SCREEN"==a.type});
zDa(this,!1);break;case "remoteConnected":var b=new o6(g.jx(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.jx(a.params.device));g.Xa(this.l,function(a){return b?a.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":BDa(this,a);break;case "nowPlaying":DDa(this,a);break;case "onStateChange":CDa(this,a);break;case "onAdStateChange":EDa(this,a);break;case "onVolumeChanged":FDa(this,a);break;case "onSubtitlesTrackChanged":ADa(this,a);break;case "nowAutoplaying":GDa(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":HDa(this,a);break;case "requestAssistedSignIn":this.T("assistedSignInRequested",a.params.authCode);break;default:l8("Unrecognized action: "+a.action)}};
g.h.QT=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.Id;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();HCa(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.la=function(a){var b=new W7(a);b.videoId&&b.videoId!=this.Va.videoId&&(this.o=b.videoId,g.iE(this.H),this.H=g.gE((0,g.z)(this.QT,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.la;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.aa=function(){return this.D||""};
k8.prototype.getAutoplayVideoId=k8.prototype.aa;k8.prototype.pa=function(){if(!(0,window.isNaN)(this.F())){var a=this.g.l;g.lu(a.g);a.start()}};
k8.prototype.reconnect=k8.prototype.pa;k8.prototype.fa=function(a,b){q8(this,a,b);yDa(this)};
k8.prototype.sendMessage=k8.prototype.fa;g.A(r8,r7);g.h=r8.prototype;g.h.fe=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.np=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.Z.V.call(this)};
g.h.lV=function(){this.T("screenChange")};
g.h.iR=function(){this.T("onlineScreenChange")};
A7.prototype.$_st=A7.prototype.start;A7.prototype.$_gspc=A7.prototype.mV;A7.prototype.$_gsppc=A7.prototype.WD;A7.prototype.$_c=A7.prototype.contains;A7.prototype.$_g=A7.prototype.get;A7.prototype.$_a=A7.prototype.add;A7.prototype.$_un=A7.prototype.np;A7.prototype.$_r=A7.prototype.remove;A7.prototype.$_gs=A7.prototype.fe;A7.prototype.$_gos=A7.prototype.VD;A7.prototype.$_s=A7.prototype.subscribe;A7.prototype.$_ubk=A7.prototype.Id;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.IB,this);this.g.unsubscribe("remotePlayerChange",this.Fl,this);this.g.unsubscribe("remoteQueueChange",this.xo,this);this.g.unsubscribe("autoplayUpNext",this.eB,this);this.g.unsubscribe("previousNextChange",this.FB,this);this.g.unsubscribe("nowAutoplaying",this.xB,this);this.g.unsubscribe("autoplayDismissed",this.dB,this);this.g=this.F=null};
g.h.fA=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).fb()?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.Ru(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.Ru(this.l.getVideoData(1).videoId,c)}};
g.h.hP=function(a){this.K.iI(a)};
g.h.OU=function(a){this.fA("control_subtitles_set_track",g.Yb(a)?null:a)};
g.h.jD=function(){var a=this.l.uc("captions","track");g.Yb(a)||N8(this,a)};
g.h.vB=function(a){if(M8(this)){this.g.unsubscribe("remotePlayerChange",this.Fl,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.Fl,this)}};
g.h.BQ=function(){g.Yb(this.C)||TDa(this,this.C);this.D=!1};
g.h.IB=function(a,b){this.B.stop();2==b&&this.gD()};
g.h.Fl=function(){if(M8(this)){this.A.stop();var a=e8(this.g);switch(a.g){case 1081:case 1:L8(this,new g.wP(8));this.fD();break;case 1085:case 3:L8(this,new g.wP(9));break;case 1083:case 0:L8(this,new g.wP(2));this.I.stop();K8(this,this.l.getVideoData().lengthSeconds);break;case 1084:L8(this,new g.wP(4));break;case 2:L8(this,new g.wP(4));K8(this,$7(a));break;case -1:L8(this,new g.wP(64));break;case -1E3:a={errorCode:"mdx.remoteerror",message:g.T("YTP_MDX_PLAYER_ERROR")},L8(this,new g.wP(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,TDa(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.GD()}else SDa(this)};
g.h.FB=function(){this.l.T("mdxpreviousnextchange")};
g.h.xo=function(){M8(this)||SDa(this)};
g.h.uH=function(){this.g.Xw()};
g.h.eB=function(a){a&&(a=g.EE("/watch_queue_ajax",{method:"GET",Uc:{action_get_watch_queue_item:1,video_id:a},onSuccess:(0,g.z)(this.MS,this)}))&&(this.N=(0,g.z)(a.abort,a))};
g.h.MS=function(a,b){var c=new g.iO({videoId:b.videoId,title:b.title,author:b.author,murlmq_webp:b.url});this.suggestion=c;this.l.T("mdxautoplayupnext",c)};
g.h.xB=function(a){(0,window.isNaN)(a)||this.l.T("mdxnowautoplaying",a)};
g.h.dB=function(){this.l.T("mdxautoplaycanceled")};
g.h.hN=function(a,b){-1==e8(this.g).g?O8(this,a):b&&this.g.TD(a)};
g.h.GD=function(){if(M8(this)){var a=e8(this.g);this.o.Aa(this.R);a.muted?this.l.mute():this.l.Tf();this.l.setVolume(a.volume);this.R=this.o.O(this.l,"onVolumeChange",this.vB)}};
g.h.fD=function(){this.A.stop();if(!this.g.ha()){var a=e8(this.g);a.fb()&&L8(this,new g.wP(8));K8(this,$7(a));this.A.start()}};
g.h.gD=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){VDa(this,a.state)};g.p(Q8,g.OZ);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.PZ(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.pd=function(a){g.OZ.prototype.pd.call(this,a);this.o.Fd("remote","currentReceiver",this.H[a]);this.B.Ob()};g.p(R8,g.kV);g.h=R8.prototype;g.h.create=function(){MDa(g.zM(g.X(this.g)));this.C.push(g.kG("yt-remote-before-disconnect",this.dP,this));this.C.push(g.kG("yt-remote-connection-change",this.SR,this));this.C.push(g.kG("yt-remote-receiver-availability-change",this.GB,this));this.C.push(g.kG("yt-remote-auto-connect",this.QR,this));this.C.push(g.kG("yt-remote-receiver-resumed",this.PR,this));this.GB()};
g.h.load=function(){this.g.Os();g.kV.prototype.load.call(this);this.B=new J8(this,this.g,this.l);var a=(a=RDa())?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));UDa(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.kV.prototype.unload.call(this);g.$_(this.g.app,5)};
g.h.V=function(){g.lG(this.C);g.kV.prototype.V.call(this)};
g.h.ul=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.B.fA.apply(this.B,[a].concat(g.oa(c)))};
g.h.eI=function(){return this.loaded?this.B.suggestion:null};
g.h.If=function(){return this.l?e8(this.l).If:!1};
g.h.hasNext=function(){return this.l?e8(this.l).hasNext:!1};
g.h.getCurrentTime=function(){return this.H};
g.h.VM=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.WM=function(){this.l&&this.l.RD()};
g.h.XM=function(){this.l&&this.l.SD()};
g.h.dP=function(a){1==a&&(this.I=this.l?e8(this.l):null)};
g.h.SR=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.Hz(a.videoId,$7(a)));this.g.T("videodatachange","newdata",this.g.getVideoData(),3)};
g.h.GB=function(){this.F=[this.o].concat(ODa());var a=D8()||this.o;S8(this,a);this.g.sa("onMdxReceiversChange")};
g.h.QR=function(){var a=D8();S8(this,a)};
g.h.PR=function(){this.A=D8()};
g.h.UM=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.YM=function(){i8(this.l,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.h.Lc=function(){return!1};g.dY.remote=R8;})(_yt_player);
