-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremote.js
732 lines (731 loc) · 119 KB
/
remote.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
(function(g){var window=this;'use strict';var x1a=function(a,b){this.u=a>>>0;this.j=b>>>0},z1a=function(a){if(!a)return y1a||(y1a=new x1a(0,0));
if(!/^\d+$/.test(a))return null;g.hba(a);return new x1a(g.yd,g.Bd)},A1a=function(a,b,c){null!=c&&("string"===typeof c&&z1a(c),g.Ud(a,b,1),"number"===typeof c?(a=a.j,b=c>>>0,c=Math.floor((c-b)/4294967296)>>>0,g.yd=b,g.Bd=c,g.Sd(a,g.yd),g.Sd(a,g.Bd)):(c=z1a(c),a=a.j,b=c.j,g.Sd(a,c.u),g.Sd(a,b)))},B1a=function(a,b,c){b=g.Yc(b,c);
null!=b&&(g.Ud(a,c,0),a.j.j.push(b?1:0))},C1a=function(a,b){b=b instanceof g.sf?b:g.Af(b,/^data:image\//i.test(b));
a.src=g.tf(b)},E1a=function(a){g.F.call(this,a,-1,D1a)},F1a=function(a){g.F.call(this,a)},G1a=function(a){g.F.call(this,a)},H1a=function(a){g.F.call(this,a)},I1a=function(a){g.F.call(this,a)},m6=function(a){g.Ri(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^g.Va()).toString(36));
return a},n6=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.yfa(a.u,b,c)},J1a=function(a){if(a instanceof g.Gl)return a;
if("function"==typeof a.Ni)return a.Ni(!1);if(g.Oa(a)){var b=0,c=new g.Gl;c.next=function(){for(;;){if(b>=a.length)return g.XZ;if(b in a)return g.Hl(a[b++]);b++}};
return c}throw Error("Not implemented");},K1a=function(a,b,c){if(g.Oa(a))g.mc(a,b,c);
else for(a=J1a(a);;){var d=a.next();if(d.done)break;b.call(c,d.value,void 0,a)}},L1a=function(a,b){var c=[];
K1a(b,function(d){try{var e=g.to.prototype.u.call(this,d,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}void 0===e?c.push(d):g.ika(e)&&c.push(d)},a);
return c},M1a=function(a,b){L1a(a,b).forEach(function(c){g.to.prototype.remove.call(this,c)},a)},N1a=function(a){if(a.ea){if(a.ea.locationOverrideToken)return{locationOverrideToken:a.ea.locationOverrideToken};
if(null!=a.ea.latitudeE7&&null!=a.ea.longitudeE7)return{latitudeE7:a.ea.latitudeE7,longitudeE7:a.ea.longitudeE7}}return null},O1a=function(a,b){g.Ub(a,b)||a.push(b)},o6=function(a){var b=0,c;
for(c in a)b++;return b},P1a=function(a,b){return g.He(a,b)},Q1a=function(a){try{return g.C.JSON.parse(a)}catch(b){}a=String(a);
if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);},p6=function(a){if(g.C.JSON)try{return g.C.JSON.parse(a)}catch(b){}return Q1a(a)},R1a=function(a,b,c,d){var e=new g.Ji(null);
a&&g.Ki(e,a);b&&g.Li(e,b);c&&g.Mi(e,c);d&&(e.J=d);return e},q6=function(a,b){g.rt[a]=!0;
var c=g.pt();c&&c.publish.apply(c,arguments);g.rt[a]=!1},r6=function(a){this.name=this.id="";
this.clientName="UNKNOWN_INTERFACE";this.app="";this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.capabilities=new Set;this.experiments=new Set;this.theme="u";new g.Ln;this.model=this.brand="";this.year=0;this.chipset=this.osVersion=this.os="";this.mdxDialServerType="MDX_DIAL_SERVER_TYPE_UNKNOWN";a&&(this.id=a.id||a.name,this.name=a.name,this.clientName=a.clientName?a.clientName.toUpperCase():"UNKNOWN_INTERFACE",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",S1a(this,a.capabilities||""),T1a(this,a.experiments||""),this.brand=a.brand||"",this.model=a.model||"",this.year=a.year||0,this.os=a.os||"",this.osVersion=a.osVersion||"",this.chipset=a.chipset||"",this.mdxDialServerType=a.mdxDialServerType||"MDX_DIAL_SERVER_TYPE_UNKNOWN",a=a.deviceInfo)&&(a=JSON.parse(a),this.brand=a.brand||"",this.model=a.model||"",this.year=a.year||0,this.os=a.os||"",
this.osVersion=a.osVersion||"",this.chipset=a.chipset||"",this.clientName=a.clientName?a.clientName.toUpperCase():"UNKNOWN_INTERFACE",this.mdxDialServerType=a.mdxDialServerType||"MDX_DIAL_SERVER_TYPE_UNKNOWN")},S1a=function(a,b){a.capabilities.clear();
g.Ll(b.split(","),g.Ta(P1a,U1a)).forEach(function(c){a.capabilities.add(c)})},T1a=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},s6=function(a){a=a||{};
this.name=a.name||"";this.id=a.id||a.screenId||"";this.token=a.token||a.loungeToken||"";this.uuid=a.uuid||a.dialId||"";this.idType=a.screenIdType||"normal"},t6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},V1a=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid,screenIdType:a.idType}},W1a=function(a){return new s6(a)},X1a=function(a){return Array.isArray(a)?g.ak(a,W1a):[]},u6=function(a){return a?'{name:"'+a.name+'",id:'+a.id.substr(0,6)+"..,token:"+((a.token?".."+a.token.slice(-6):"-")+",uuid:"+(a.uuid?".."+a.uuid.slice(-6):"-")+",idType:"+a.idType+"}"):"null"},v6=function(a){return Array.isArray(a)?"["+g.ak(a,u6).join(",")+"]":"null"},w6=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)})},Y1a=function(a){return g.ak(a,function(b){return{key:b.id,
name:b.name}})},x6=function(a,b){return g.Sb(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},y6=function(a,b){return g.Sb(a,function(c){return t6(c,b)})},Z1a=function(){var a=(0,g.Qu)();
a&&M1a(a,a.j.Ni(!0))},z6=function(){var a=g.Tu("yt-remote-connected-devices")||[];
g.jc(a);return a},$1a=function(a){if(g.Vb(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return g.ak(a,function(d,e){return 0==e?d:d.substring(c.length)})},a2a=function(a){g.Su("yt-remote-connected-devices",a,86400)},B6=function(){if(A6)return A6;
var a=g.Tu("yt-remote-device-id");a||(a=w6(),g.Su("yt-remote-device-id",a,31536E3));for(var b=z6(),c=1,d=a;g.Ub(b,d);)c++,d=a+"#"+c;return A6=d},C6=function(){var a=z6(),b=B6();
g.Vu()&&g.lc(a,b);a=$1a(a);if(g.Vb(a))try{g.ola("remote_sid")}catch(c){}else try{g.nq("remote_sid",a.join(","),-1)}catch(c){}},b2a=function(){return g.Tu("yt-remote-session-browser-channel")},c2a=function(){return g.Tu("yt-remote-local-screens")||[]},d2a=function(){g.Su("yt-remote-lounge-token-expiration",!0,86400)},e2a=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=g.ak(c2a(),function(d){return d.loungeToken}),c=g.ak(a,function(d){return d.loungeToken});
g.bk(c,function(d){return!g.Ub(b,d)})&&d2a();
g.Su("yt-remote-local-screens",a,31536E3)},D6=function(a){a||(g.Uu("yt-remote-session-screen-id"),g.Uu("yt-remote-session-video-id"));
C6();a=z6();g.Yb(a,B6());a2a(a)},f2a=function(){if(!E6){var a=g.Co();
a&&(E6=new g.qo(a))}},g2a=function(){f2a();
return E6?!!E6.get("yt-remote-use-staging-server"):!1},F6=function(){var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
return a?parseInt(a[1],10):0},h2a=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},i2a=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},G6=function(a){a.length?j2a(a.shift(),function(){G6(a)}):H6()},k2a=function(a){return"chrome-extension://"+a+"/cast_sender.js"},j2a=function(a,b,c){var d=document.createElement("script");
d.onerror=b;c&&(d.onload=c);g.li(d,g.qf(a));(document.head||document.documentElement).appendChild(d)},l2a=function(){var a=F6(),b=[];
if(1<a){var c=a-1;b.push("//www.gstatic.com/eureka/clank/"+a+"/cast_sender.js");b.push("//www.gstatic.com/eureka/clank/"+c+"/cast_sender.js")}return b},H6=function(){var a=i2a();
a&&a(!1,"No cast extension found")},I6=function(){if(m2a){var a=2,b=i2a(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;j2a("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",H6,c)}},n2a=function(){I6();
var a=l2a();a.push("//www.gstatic.com/eureka/clank/cast_sender.js");G6(a)},p2a=function(){I6();
var a=l2a();a.push.apply(a,g.v(o2a.map(k2a)));a.push("//www.gstatic.com/eureka/clank/cast_sender.js");G6(a)},q2a=function(){this.j=J6();
this.j.Jo("/client_streamz/youtube/living_room/mdx/channel/opened",{rh:3,qh:"channel_type"})},r2a=function(a,b){a.j.Cq("/client_streamz/youtube/living_room/mdx/channel/opened",b)},s2a=function(){this.j=J6();
this.j.Jo("/client_streamz/youtube/living_room/mdx/channel/closed",{rh:3,qh:"channel_type"})},t2a=function(a,b){a.j.Cq("/client_streamz/youtube/living_room/mdx/channel/closed",b)},u2a=function(){this.j=J6();
this.j.Jo("/client_streamz/youtube/living_room/mdx/channel/message_received",{rh:3,qh:"channel_type"})},v2a=function(a,b){a.j.Cq("/client_streamz/youtube/living_room/mdx/channel/message_received",b)},w2a=function(){this.j=J6();
this.j.Jo("/client_streamz/youtube/living_room/mdx/channel/error",{rh:3,qh:"channel_type"})},x2a=function(a,b){a.j.Cq("/client_streamz/youtube/living_room/mdx/channel/error",b)},y2a=function(){this.j=J6();
this.j.Jo("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")},z2a=function(){this.j=J6();
this.j.Jo("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")},K6=function(a,b,c){g.I.call(this);
this.I=null!=c?(0,g.Sa)(a,c):a;this.Ug=b;this.D=(0,g.Sa)(this.KS,this);this.j=!1;this.u=0;this.B=this.kc=null;this.C=[]},L6=function(a,b,c){g.I.call(this);
this.C=null!=c?a.bind(c):a;this.Ug=b;this.B=null;this.j=!1;this.u=0;this.kc=null},M6=function(a){a.kc=g.Vg(function(){a.kc=null;
a.j&&!a.u&&(a.j=!1,M6(a))},a.Ug);
var b=a.B;a.B=null;a.C.apply(null,b)},N6=function(){},O6=function(){g.se.call(this,"p")},P6=function(){g.se.call(this,"o")},A2a=function(){var a=new g.C.TextEncoder;
return new g.C.ReadableStream({start:function(b){for(var c=g.r(["test\r\n","test\r\n"]),d=c.next();!d.done;d=c.next())b.enqueue(a.encode(d.value));b.close()}})},B2a=function(a){return(a=/\/\/([^\/]+)\//.exec(a))?a[1].endsWith("google.com"):!1},D2a=function(a,b){if(!C2a){C2a=!0;
var c;a:{if(c=g.C.navigator)if(c=c.userAgent)break a;c=""}(-1==c.indexOf("Chrome")||-1!=c.indexOf("Edg")?0:90<=parseInt(/Chrome\/(\d+)/.exec(c)[1],10))&&B2a(a)&&window&&window.document&&B2a(window.document.URL)&&(c=document.createElement("meta"),c.httpEquiv="origin-trial",c.content="A0eNbltY1nd4MP7XTHXnTxWogDL6mWTdgIIKfKOTJoUHNbFFMZQBoiHHjJ9UK9lgYndWFaxOWR7ld8uUjcWmcwIAAAB/eyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IkZldGNoVXBsb2FkU3RyZWFtaW5nIiwiZXhwaXJ5IjoxNjM2NTAyMzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==",
document.head.appendChild(c),(new Request("",{body:new ReadableStream,method:"POST"})).headers.has("Content-Type")||(g.C.fetch(a+"?ot=1",{method:"POST",body:"test\r\n"}).catch(b),g.C.fetch(a+"?ot=2",{method:"POST",body:A2a(),bV:!1}).catch(b),g.C.fetch(a+"?ot=3",{method:"POST",body:A2a(),bV:!0}).catch(b)))}},Q6=function(){return E2a=E2a||new g.bf},F2a=function(a){g.se.call(this,"serverreachability",a)},R6=function(a){var b=Q6();
b.dispatchEvent(new F2a(b,a))},G2a=function(a,b){g.se.call(this,"statevent",a);
this.stat=b},S6=function(a){var b=Q6();
b.dispatchEvent(new G2a(b,a))},H2a=function(a,b,c,d){g.se.call(this,"timingevent",a);
this.size=b;this.Fv=d},T6=function(a,b){if("function"!==typeof a)throw Error("Fn must not be null and must be a function");
return g.C.setTimeout(function(){a()},b)},U6=function(){},V6=function(a,b,c,d){this.D=a;
this.C=b;this.Gc=c;this.Fc=d||1;this.Ya=new g.Wi(this);this.sb=45E3;a=g.uB?125:void 0;this.Za=new g.Ug(a);this.Ga=null;this.B=!1;this.P=this.Ra=this.J=this.Ja=this.Z=this.Gb=this.U=null;this.ea=[];this.j=null;this.V=0;this.I=this.ma=null;this.Kb=-1;this.Ca=!1;this.ib=0;this.Qa=null;this.lc=this.Pa=this.Yb=this.xa=!1;this.u=new I2a},I2a=function(){this.B=null;
this.j="";this.u=!1},W6=function(a,b,c){a.Ja=1;
a.J=m6(b.clone());a.P=c;a.xa=!0;J2a(a,null)},J2a=function(a,b){a.Z=Date.now();
X6(a);a.Ra=a.J.clone();n6(a.Ra,"t",a.Fc);a.V=0;var c=a.D.Ja;a.u=new I2a;a.j=K2a(a.D,c?b:null,!a.P);0<a.ib&&(a.Qa=new L6((0,g.Sa)(a.yK,a,a.j),a.ib));a.Ya.Ka(a.j,"readystatechange",a.NS);b=a.Ga?g.Ne(a.Ga):{};a.P?(a.ma||(a.ma="POST"),b["Content-Type"]="application/x-www-form-urlencoded",a.j.send(a.Ra,a.ma,a.P,b)):(a.ma="GET",a.j.send(a.Ra,a.ma,null,b));R6(1)},L2a=function(a){return a.j?"GET"==a.ma&&2!=a.Ja&&a.D.xe:!1},N2a=function(a,b,c){for(var d=!0,e;!a.Ca&&a.V<c.length;)if(e=M2a(a,c),e==Y6){4==b&&
(a.I=4,S6(14),d=!1);
break}else if(e==Z6){a.I=4;S6(15);d=!1;break}else $6(a,e);L2a(a)&&e!=Y6&&e!=Z6&&(a.u.j="",a.V=0);4!=b||0!=c.length||a.u.u||(a.I=1,S6(16),d=!1);a.B=a.B&&d;d?0<c.length&&!a.lc&&(a.lc=!0,a.D.bI(a)):(a7(a),b7(a))},M2a=function(a,b){var c=a.V,d=b.indexOf("\n",c);
if(-1==d)return Y6;c=Number(b.substring(c,d));if(isNaN(c))return Z6;d+=1;if(d+c>b.length)return Y6;b=b.slice(d,d+c);a.V=d+c;return b},X6=function(a){a.Gb=Date.now()+a.sb;
O2a(a,a.sb)},O2a=function(a,b){if(null!=a.U)throw Error("WatchDog timer not null");
a.U=T6((0,g.Sa)(a.LS,a),b)},c7=function(a){a.U&&(g.C.clearTimeout(a.U),a.U=null)},b7=function(a){a.D.Hf()||a.Ca||P2a(a.D,a)},a7=function(a){c7(a);
g.ne(a.Qa);a.Qa=null;a.Za.stop();g.Xi(a.Ya);if(a.j){var b=a.j;a.j=null;b.abort();b.dispose()}},$6=function(a,b){try{var c=a.D;
if(0!=c.Uf&&(c.j==a||d7(c.u,a)))if(!a.Pa&&d7(c.u,a)&&3==c.Uf){try{var d=c.Og.j.parse(b)}catch(y){d=null}if(Array.isArray(d)&&3==d.length){var e=d;if(0==e[0])a:{if(!c.P){if(c.j)if(c.j.Z+3E3<a.Z)e7(c),f7(c);else break a;g7(c);S6(18)}}else c.wd=e[1],0<c.wd-c.Pa&&37500>e[2]&&c.Za&&0==c.ea&&!c.V&&(c.V=T6((0,g.Sa)(c.OS,c),6E3));if(1>=h7(c.u)&&c.Vc){try{c.Vc()}catch(y){}c.Vc=void 0}}else i7(c,11)}else if((a.Pa||c.j==a)&&e7(c),!g.pb(b))for(e=c.Og.j.parse(b),b=0;b<e.length;b++){var f=e[b];c.Pa=f[0];f=f[1];
if(2==c.Uf)if("c"==f[0]){c.C=f[1];c.lc=f[2];var h=f[3];null!=h&&(c.zK=h);var l=f[5];null!=l&&"number"===typeof l&&0<l&&(c.Ra=1.5*l);d=c;var m=a.j;if(m){var n=g.Oh(m,"X-Client-Wire-Protocol");if(n){var p=d.u;!p.j&&(g.rb(n,"spdy")||g.rb(n,"quic")||g.rb(n,"h2"))&&(p.C=p.D,p.j=new Set,p.u&&(j7(p,p.u),p.u=null))}if(d.xa){var q=g.Oh(m,"X-HTTP-Session-Id");q&&(d.Zd=q,g.Ri(d.Ga,d.xa,q))}}c.Uf=3;c.D&&c.D.FK();c.Kc&&(c.Wc=Date.now()-a.Z);d=c;var t=a;d.hd=Q2a(d,d.Ja?d.lc:null,d.Fc);if(t.Pa){R2a(d.u,t);var u=
t,x=d.Ra;x&&u.setTimeout(x);u.U&&(c7(u),X6(u));d.j=t}else S2a(d);0<c.B.length&&k7(c)}else"stop"!=f[0]&&"close"!=f[0]||i7(c,7);else 3==c.Uf&&("stop"==f[0]||"close"==f[0]?"stop"==f[0]?i7(c,7):c.disconnect():"noop"!=f[0]&&c.D&&c.D.EK(f),c.ea=0)}R6(4)}catch(y){}},T2a=function(a,b){this.j=a;
this.map=b;this.context=null},U2a=function(a){this.D=a||10;
g.C.PerformanceNavigationTiming?(a=g.C.performance.getEntriesByType("navigation"),a=0<a.length&&("hq"==a[0].nextHopProtocol||"h2"==a[0].nextHopProtocol)):a=!!(g.C.chrome&&g.C.chrome.loadTimes&&g.C.chrome.loadTimes()&&g.C.chrome.loadTimes().wasFetchedViaSpdy);this.C=a?this.D:1;this.j=null;1<this.C&&(this.j=new Set);this.u=null;this.B=[]},V2a=function(a){return a.u?!0:a.j?a.j.size>=a.C:!1},h7=function(a){return a.u?1:a.j?a.j.size:0},d7=function(a,b){return a.u?a.u==b:a.j?a.j.has(b):!1},j7=function(a,
b){a.j?a.j.add(b):a.u=b},R2a=function(a,b){a.u&&a.u==b?a.u=null:a.j&&a.j.has(b)&&a.j.delete(b)},l7=function(a){if(null!=a.u)return a.B.concat(a.u.ea);
if(null!=a.j&&0!==a.j.size){var b=a.B;a=g.r(a.j.values());for(var c=a.next();!c.done;c=a.next())b=b.concat(c.value.ea);return b}return g.bc(a.B)},W2a=function(a,b){var c=new U6;
if(g.C.Image){var d=new Image;d.onload=g.Ta(m7,c,d,"TestLoadImage: loaded",!0,b);d.onerror=g.Ta(m7,c,d,"TestLoadImage: error",!1,b);d.onabort=g.Ta(m7,c,d,"TestLoadImage: abort",!1,b);d.ontimeout=g.Ta(m7,c,d,"TestLoadImage: timeout",!1,b);g.C.setTimeout(function(){if(d.ontimeout)d.ontimeout()},1E4);
d.src=a}else b(!1)},m7=function(a,b,c,d,e){try{b.onload=null,b.onerror=null,b.onabort=null,b.ontimeout=null,e(d)}catch(f){}},X2a=function(){this.j=new N6},Y2a=function(a,b,c){var d=c||"";
try{g.Ii(a,function(e,f){var h=e;g.Pa(e)&&(h=g.lh(e));b.push(d+f+"="+encodeURIComponent(h))})}catch(e){throw b.push(d+"type="+encodeURIComponent("_badmap")),e;
}},n7=function(a,b,c){return c&&c.OW?c.OW[a]||b:b},Z2a=function(a){this.B=[];
this.lc=this.hd=this.Ga=this.Fc=this.j=this.Zd=this.xa=this.Ca=this.J=this.Gb=this.U=null;this.Se=this.Qa=0;this.He=n7("failFast",!1,a);this.Za=this.V=this.P=this.I=this.D=null;this.Gc=!0;this.Bd=this.wd=this.Pa=-1;this.Yb=this.ea=this.Z=0;this.Ge=n7("baseRetryDelayMs",5E3,a);this.Te=n7("retryDelaySeedMs",1E4,a);this.Ie=n7("forwardChannelMaxRetries",2,a);this.jd=n7("forwardChannelRequestTimeoutMs",2E4,a);this.Hd=a&&a.Xka||void 0;this.xe=a&&a.Vka||!1;this.Ra=void 0;this.Ja=a&&a.B0||!1;this.C="";this.u=
new U2a(a&&a.Mja);this.Og=new X2a;this.sb=a&&a.bka||!1;this.ib=a&&a.Tja||!1;this.sb&&this.ib&&(this.ib=!1);this.Ue=a&&a.Hja||!1;a&&a.dka&&(this.Gc=!1);this.Kc=!this.sb&&this.Gc&&a&&a.Qja||!1;this.Vc=void 0;this.Wc=0;this.Ya=!1;this.ma=null;this.gf=!a||!1!==a.Sja;this.Kb=null},f7=function(a){a.j&&(o7(a),a.j.cancel(),a.j=null)},$2a=function(a){f7(a);
a.P&&(g.C.clearTimeout(a.P),a.P=null);e7(a);a.u.cancel();a.I&&("number"===typeof a.I&&g.C.clearTimeout(a.I),a.I=null)},k7=function(a){V2a(a.u)||a.I||(a.I=!0,g.Lg(a.BK,a),a.Z=0)},b3a=function(a,b){if(h7(a.u)>=a.u.C-(a.I?1:0))return!1;
if(a.I)return a.B=b.ea.concat(a.B),!0;if(1==a.Uf||2==a.Uf||a.Z>=(a.He?0:a.Ie))return!1;a.I=T6((0,g.Sa)(a.BK,a,b),a3a(a,a.Z));a.Z++;return!0},d3a=function(a,b){var c;
b?c=b.Gc:c=a.Qa++;var d=a.Ga.clone();g.Ri(d,"SID",a.C);g.Ri(d,"RID",c);g.Ri(d,"AID",a.Pa);p7(a,d);a.J&&a.U&&g.Vi(d,a.J,a.U);c=new V6(a,a.C,c,a.Z+1);null===a.J&&(c.Ga=a.U);b&&(a.B=b.ea.concat(a.B));b=c3a(a,c,1E3);c.setTimeout(Math.round(.5*a.jd)+Math.round(.5*a.jd*Math.random()));j7(a.u,c);W6(c,d,b)},p7=function(a,b){a.Ca&&g.ze(a.Ca,function(c,d){g.Ri(b,d,c)});
a.D&&g.Ii({},function(c,d){g.Ri(b,d,c)})},c3a=function(a,b,c){c=Math.min(a.B.length,c);
var d=a.D?(0,g.Sa)(a.D.PS,a.D,a):null;a:for(var e=a.B,f=-1;;){var h=["count="+c];-1==f?0<c?(f=e[0].j,h.push("ofs="+f)):f=0:h.push("ofs="+f);for(var l=!0,m=0;m<c;m++){var n=e[m].j,p=e[m].map;n-=f;if(0>n)f=Math.max(0,e[m].j-100),l=!1;else try{Y2a(p,h,"req"+n+"_")}catch(q){d&&d(p)}}if(l){d=h.join("&");break a}}a=a.B.splice(0,c);b.ea=a;return d},S2a=function(a){a.j||a.P||(a.Yb=1,g.Lg(a.AK,a),a.ea=0)},g7=function(a){if(a.j||a.P||3<=a.ea)return!1;
a.Yb++;a.P=T6((0,g.Sa)(a.AK,a),a3a(a,a.ea));a.ea++;return!0},o7=function(a){null!=a.ma&&(g.C.clearTimeout(a.ma),a.ma=null)},e3a=function(a){a.j=new V6(a,a.C,"rpc",a.Yb);
null===a.J&&(a.j.Ga=a.U);a.j.ib=0;var b=a.hd.clone();g.Ri(b,"RID","rpc");g.Ri(b,"SID",a.C);g.Ri(b,"CI",a.Za?"0":"1");g.Ri(b,"AID",a.Pa);g.Ri(b,"TYPE","xmlhttp");p7(a,b);a.J&&a.U&&g.Vi(b,a.J,a.U);a.Ra&&a.j.setTimeout(a.Ra);var c=a.j;a=a.lc;c.Ja=1;c.J=m6(b.clone());c.P=null;c.xa=!0;J2a(c,a)},e7=function(a){null!=a.V&&(g.C.clearTimeout(a.V),a.V=null)},P2a=function(a,b){var c=null;
if(a.j==b){e7(a);o7(a);a.j=null;var d=2}else if(d7(a.u,b))c=b.ea,R2a(a.u,b),d=1;else return;if(0!=a.Uf)if(a.Bd=b.Kb,b.B)if(1==d){c=b.P?b.P.length:0;b=Date.now()-b.Z;var e=a.Z;d=Q6();d.dispatchEvent(new H2a(d,c,b,e));k7(a)}else S2a(a);else if(e=b.getLastError(),3==e||0==e&&0<a.Bd||!(1==d&&b3a(a,b)||2==d&&g7(a)))switch(c&&0<c.length&&(b=a.u,b.B=b.B.concat(c)),e){case 1:i7(a,5);break;case 4:i7(a,10);break;case 3:i7(a,6);break;default:i7(a,2)}},a3a=function(a,b){var c=a.Ge+Math.floor(Math.random()*a.Te);
a.isActive()||(c*=2);return c*b},i7=function(a,b){if(2==b){var c=null;
a.D&&(c=null);var d=(0,g.Sa)(a.H0,a);c||(c=new g.Ji("//www.google.com/images/cleardot.gif"),g.C.location&&"http"==g.C.location.protocol||g.Ki(c,"https"),m6(c));W2a(c.toString(),d)}else S6(2);a.Uf=0;a.D&&a.D.DK(b);f3a(a);$2a(a)},f3a=function(a){a.Uf=0;
a.Kb=[];if(a.D){var b=l7(a.u);if(0!=b.length||0!=a.B.length)g.cc(a.Kb,b),g.cc(a.Kb,a.B),a.u.B.length=0,g.bc(a.B),a.B.length=0;a.D.CK()}},g3a=function(a){if(0==a.Uf)return a.Kb;
var b=[];g.cc(b,l7(a.u));g.cc(b,a.B);return b},Q2a=function(a,b,c){var d=g.Si(c);
""!=d.j?(b&&g.Li(d,b+"."+d.j),g.Mi(d,d.B)):(d=g.C.location,d=R1a(d.protocol,b?b+"."+d.hostname:d.hostname,+d.port,c));b=a.xa;c=a.Zd;b&&c&&g.Ri(d,b,c);g.Ri(d,"VER",a.zK);p7(a,d);return d},K2a=function(a,b,c){if(b&&!a.Ja)throw Error("Can't create secondary domain capable XhrIo object.");
b=c&&a.xe&&!a.Hd?new g.Hh(new g.Ei({mR:!0})):new g.Hh(a.Hd);b.J=a.Ja;return b},h3a=function(){},i3a=function(){if(g.vc&&!g.sc(10))throw Error("Environmental error: no available transport.");
},r7=function(a,b){g.bf.call(this);
this.j=new Z2a(b);this.I=a;this.u=b&&b.qX||null;a=b&&b.pX||null;b&&b.Lja&&(a?a["X-Client-Protocol"]="webchannel":a={"X-Client-Protocol":"webchannel"});this.j.U=a;a=b&&b.hka||null;b&&b.WO&&(a?a["X-WebChannel-Content-Type"]=b.WO:a={"X-WebChannel-Content-Type":b.WO});b&&b.QM&&(a?a["X-WebChannel-Client-Profile"]=b.QM:a={"X-WebChannel-Client-Profile":b.QM});this.j.Gb=a;(a=b&&b.fka)&&!g.pb(a)&&(this.j.J=a);this.J=b&&b.B0||!1;this.D=b&&b.Kka||!1;(b=b&&b.KW)&&!g.pb(b)&&(this.j.xa=b,g.Ge(this.u,b)&&g.Ke(this.u,
b));this.C=new q7(this)},j3a=function(a){O6.call(this);
a.__headers__&&(this.headers=a.__headers__,this.statusCode=a.__status__,delete a.__headers__,delete a.__status__);var b=a.__sm__;b?this.data=(this.metadataKey=g.De(b))?g.Le(b,this.metadataKey):b:this.data=a},k3a=function(a){P6.call(this);
this.status=1;this.errorCode=a},q7=function(a){this.j=a},l3a=function(a,b){this.u=a;
this.j=b},m3a=function(a){return g3a(a.j).map(function(b){b=b.map;
"__data__"in b&&(b=b.__data__,b=a.u.D?Q1a(b):b);return b})},s7=function(a,b){if("function"!==typeof a)throw Error("Fn must not be null and must be a function");
return g.C.setTimeout(function(){a()},b)},u7=function(a){t7.dispatchEvent(new n3a(t7,a))},n3a=function(a,b){g.se.call(this,"statevent",a);
this.stat=b},v7=function(a,b,c,d){this.j=a;
this.C=b;this.J=c;this.I=d||1;this.u=45E3;this.B=new g.Wi(this);this.D=new g.Ug;this.D.setInterval(250)},p3a=function(a,b,c){a.Bt=1;
a.Ao=m6(b.clone());a.zq=c;a.xa=!0;o3a(a,null)},w7=function(a,b,c,d,e){a.Bt=1;
a.Ao=m6(b.clone());a.zq=null;a.xa=c;e&&(a.YQ=!1);o3a(a,d)},o3a=function(a,b){a.At=Date.now();
x7(a);a.Co=a.Ao.clone();n6(a.Co,"t",a.I);a.dA=0;a.hh=a.j.hE(a.j.uw()?b:null);0<a.fE&&(a.bA=new L6((0,g.Sa)(a.GK,a,a.hh),a.fE));a.B.Ka(a.hh,"readystatechange",a.RS);b=a.yq?g.Ne(a.yq):{};a.zq?(a.cA="POST",b["Content-Type"]="application/x-www-form-urlencoded",a.hh.send(a.Co,a.cA,a.zq,b)):(a.cA="GET",a.YQ&&!g.ve&&(b.Connection="close"),a.hh.send(a.Co,a.cA,null,b));a.j.Pk(1)},r3a=function(a,b){var c=a.dA,d=b.indexOf("\n",c);
if(-1==d)return y7;c=Number(b.substring(c,d));if(isNaN(c))return q3a;d+=1;if(d+c>b.length)return y7;b=b.slice(d,d+c);a.dA=d+c;return b},t3a=function(a,b){a.At=Date.now();
x7(a);var c=b?window.location.hostname:"";a.Co=a.Ao.clone();g.Ri(a.Co,"DOMAIN",c);g.Ri(a.Co,"t",a.I);try{a.dl=new ActiveXObject("htmlfile")}catch(m){z7(a);a.Bo=7;u7(22);A7(a);return}var d="<html><body>";if(b){var e="";for(b=0;b<c.length;b++){var f=c.charAt(b);if("<"==f)f=e+"\\x3c";else if(">"==f)f=e+"\\x3e";else{if(f in B7)f=B7[f];else if(f in s3a)f=B7[f]=s3a[f];else{var h=f.charCodeAt(0);if(31<h&&127>h)var l=f;else{if(256>h){if(l="\\x",16>h||256<h)l+="0"}else l="\\u",4096>h&&(l+="0");l+=h.toString(16).toUpperCase()}f=
B7[f]=l}f=e+f}e=f}d+='<script>document.domain="'+e+'"\x3c/script>'}d+="</body></html>";c=g.Kf(g.nf("b/12014412"),d);a.dl.open();a.dl.write(g.Hf(c));a.dl.close();a.dl.parentWindow.m=(0,g.Sa)(a.r_,a);a.dl.parentWindow.d=(0,g.Sa)(a.bQ,a,!0);a.dl.parentWindow.rpcClose=(0,g.Sa)(a.bQ,a,!1);c=a.dl.createElement("DIV");a.dl.parentWindow.document.body.appendChild(c);d=g.vf(a.Co.toString());d=g.cg(g.tf(d));d=g.Kf(g.nf("b/12014412"),'<iframe src="'+d+'"></iframe>');g.Vca(c,d);a.j.Pk(1)},x7=function(a){a.gE=
Date.now()+a.u;
u3a(a,a.u)},u3a=function(a,b){if(null!=a.Ct)throw Error("WatchDog timer not null");
a.Ct=s7((0,g.Sa)(a.QS,a),b)},C7=function(a){a.Ct&&(g.C.clearTimeout(a.Ct),a.Ct=null)},A7=function(a){a.j.Hf()||a.xq||a.j.eA(a)},z7=function(a){C7(a);
g.ne(a.bA);a.bA=null;a.D.stop();g.Xi(a.B);if(a.hh){var b=a.hh;a.hh=null;b.abort();b.dispose()}a.dl&&(a.dl=null)},D7=function(a,b){try{a.j.HK(a,b),a.j.Pk(4)}catch(c){}},w3a=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;v3a(a,b,function(h){h?c(!0):g.C.setTimeout(function(){w3a(a,b,c,d,f)},f)})}},v3a=function(a,b,c){var d=new Image;
d.onload=function(){try{E7(d),c(!0)}catch(e){}};
d.onerror=function(){try{E7(d),c(!1)}catch(e){}};
d.onabort=function(){try{E7(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{E7(d),c(!1)}catch(e){}};
g.C.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
C1a(d,a)},E7=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},x3a=function(a){this.j=a;
this.u=new N6},y3a=function(a){var b=F7(a.j,a.ex,"/mail/images/cleardot.gif");
m6(b);w3a(b.toString(),5E3,(0,g.Sa)(a.hV,a),3,2E3);a.Pk(1)},H7=function(a){var b=a.j.U;
if(null!=b)u7(5),b?(u7(11),G7(a.j,a,!1)):(u7(12),G7(a.j,a,!0));else if(a.Mh=new v7(a),a.Mh.yq=a.iE,b=a.j,b=F7(b,b.uw()?a.qw:null,a.jE),u7(5),!g.vc||g.sc(10))n6(b,"TYPE","xmlhttp"),w7(a.Mh,b,!1,a.qw,!1);else{n6(b,"TYPE","html");var c=a.Mh;a=!!a.qw;c.Bt=3;c.Ao=m6(b.clone());t3a(c,a)}},I7=function(a,b,c){this.j=1;
this.u=[];this.B=[];this.D=new N6;this.P=a||null;this.U=null!=b?b:null;this.J=c||!1},z3a=function(a,b){this.j=a;
this.map=b;this.context=null},A3a=function(a,b,c,d){g.se.call(this,"timingevent",a);
this.size=b;this.Fv=d},B3a=function(a){g.se.call(this,"serverreachability",a)},C3a=function(a){a.SS(1,0);
a.fA=F7(a,null,a.kE);J7(a)},D3a=function(a){a.Ro&&(a.Ro.abort(),a.Ro=null);
a.sf&&(a.sf.cancel(),a.sf=null);a.Om&&(g.C.clearTimeout(a.Om),a.Om=null);K7(a);a.ai&&(a.ai.cancel(),a.ai=null);a.Do&&(g.C.clearTimeout(a.Do),a.Do=null)},E3a=function(a,b){if(0==a.j)throw Error("Invalid operation: sending map when state is closed");
a.u.push(new z3a(a.US++,b));2!=a.j&&3!=a.j||J7(a)},F3a=function(a){var b=0;
a.sf&&b++;a.ai&&b++;return b},J7=function(a){a.ai||a.Do||(a.Do=s7((0,g.Sa)(a.LK,a),0),a.Et=0)},H3a=function(a,b){if(1==a.j){if(!b){a.xw=Math.floor(1E5*Math.random());
b=a.xw++;var c=new v7(a,"",b);c.yq=a.Cl;var d=L7(a),e=a.fA.clone();g.Ri(e,"RID",b);g.Ri(e,"CVER","1");M7(a,e);p3a(c,e,d);a.ai=c;a.j=2}}else 3==a.j&&(b?G3a(a,b):0==a.u.length||a.ai||G3a(a))},G3a=function(a,b){if(b)if(6<a.Aq){a.u=a.B.concat(a.u);
a.B.length=0;var c=a.xw-1;b=L7(a)}else c=b.J,b=b.zq;else c=a.xw++,b=L7(a);var d=a.fA.clone();g.Ri(d,"SID",a.C);g.Ri(d,"RID",c);g.Ri(d,"AID",a.Ft);M7(a,d);c=new v7(a,a.C,c,a.Et+1);c.yq=a.Cl;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.ai=c;p3a(c,d,b)},M7=function(a,b){a.Ng&&(a=a.Ng.PK())&&g.ze(a,function(c,d){g.Ri(b,d,c)})},L7=function(a){var b=Math.min(a.u.length,1E3),c=["count="+b];
if(6<a.Aq&&0<b){var d=a.u[0].j;c.push("ofs="+d)}else d=0;for(var e={},f=0;f<b;e={jt:e.jt},f++){e.jt=a.u[f].j;var h=a.u[f].map;e.jt=6>=a.Aq?f:e.jt-d;try{g.ze(h,function(l){return function(m,n){c.push("req"+l.jt+"_"+n+"="+encodeURIComponent(m))}}(e))}catch(l){c.push("req"+e.jt+"_type="+encodeURIComponent("_badmap"))}}a.B=a.B.concat(a.u.splice(0,b));
return c.join("&")},I3a=function(a){a.sf||a.Om||(a.I=1,a.Om=s7((0,g.Sa)(a.KK,a),0),a.Dt=0)},N7=function(a){if(a.sf||a.Om||3<=a.Dt)return!1;
a.I++;a.Om=s7((0,g.Sa)(a.KK,a),J3a(a,a.Dt));a.Dt++;return!0},G7=function(a,b,c){a.DD=c;
a.Dl=b.Nm;a.J||C3a(a)},K7=function(a){null!=a.Bq&&(g.C.clearTimeout(a.Bq),a.Bq=null)},J3a=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},O7=function(a,b){if(2==b||9==b){var c=null;
a.Ng&&(c=null);var d=(0,g.Sa)(a.G0,a);c||(c=new g.Ji("//www.google.com/images/cleardot.gif"),m6(c));v3a(c.toString(),1E4,d)}else u7(2);K3a(a,b)},K3a=function(a,b){a.j=0;
a.Ng&&a.Ng.MK(b);L3a(a);D3a(a)},L3a=function(a){a.j=0;
a.Dl=-1;if(a.Ng)if(0==a.B.length&&0==a.u.length)a.Ng.lE();else{var b=g.bc(a.B),c=g.bc(a.u);a.B.length=0;a.u.length=0;a.Ng.lE(b,c)}},F7=function(a,b,c){var d=g.Si(c);
if(""!=d.j)b&&g.Li(d,b+"."+d.j),g.Mi(d,d.B);else{var e=window.location;d=R1a(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.ww&&g.ze(a.ww,function(f,h){g.Ri(d,h,f)});
g.Ri(d,"VER",a.Aq);M7(a,d);return d},M3a=function(){},N3a=function(){this.j=[];
this.u=[]},O3a=function(){},J6=function(){if(!P7){P7=new g.Xg(new O3a);
var a=g.Gp("client_streamz_web_flush_count",-1);-1!==a&&(P7.C=a)}return P7},Q7=function(a){g.se.call(this,"channelMessage");
this.message=a},R7=function(a){g.se.call(this,"channelError");
this.error=a},P3a=function(a,b){this.action=a;
this.params=b||{}},S7=function(a,b){g.I.call(this);
this.j=new g.K(this.j_,0,this);g.J(this,this.j);this.Ug=5E3;this.u=0;if("function"===typeof a)b&&(a=(0,g.Sa)(a,b));else if(a&&"function"===typeof a.handleEvent)a=(0,g.Sa)(a.handleEvent,a);else throw Error("Invalid listener argument");this.B=a},T7=function(a,b,c,d,e){c=void 0===c?!1:c;
d=void 0===d?function(){return""}:d;
e=void 0===e?!1:e;this.Z=a;this.J=b;this.B=new g.po;this.u=new S7(this.j0,this);this.j=null;this.V=!1;this.I=null;this.U="";this.P=this.D=0;this.C=[];this.Ja=c;this.ea=d;this.Pa=e;this.Ga=new q2a;this.ma=new s2a;this.Ca=new u2a;this.xa=new w2a;this.Qa=new y2a;this.Ra=new z2a},U7=function(a){if(a.j){var b=a.ea(),c=a.j.Cl||{};
b?c["x-youtube-lounge-xsrf-token"]=b:delete c["x-youtube-lounge-xsrf-token"];a.j.Cl=c}},V7=function(a){this.port=this.domain="";
this.j="/api/lounge";this.u=!0;a=a||document.location.href;var b=Number(g.wh(4,a))||"";b&&(this.port=":"+b);this.domain=g.xh(a)||"";a=g.wb();0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.vb(a,"10.0")&&(this.u=!1))},W7=function(a,b){var c=a.j;
a.u&&(c="https://"+a.domain+a.port+a.j);return g.Dh(c+b,{})},X7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Ta(a.C,d,!0),onError:g.Ta(a.B,e),onTimeout:g.Ta(a.D,e)};c&&(a.postParams=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.eq(b,a)},Y7=function(a,b){g.bf.call(this);
var c=this;this.Lc=a();this.Lc.subscribe("handlerOpened",this.YS,this);this.Lc.subscribe("handlerClosed",this.WS,this);this.Lc.subscribe("handlerError",function(d,e){c.onError(e)});
this.Lc.subscribe("handlerMessage",this.XS,this);this.j=b},Q3a=function(a,b,c){var d=this;
c=void 0===c?function(){return""}:c;
var e=void 0===e?new i3a:e;var f=void 0===f?new g.po:f;this.pathPrefix=a;this.j=b;this.ma=c;this.D=f;this.P=null;this.U=this.J=0;this.channel=null;this.I=0;this.B=new S7(function(){d.B.isActive();var h;0===(null==(h=d.channel)?void 0:h7((new l3a(h,h.j)).j.u))&&d.connect(d.P,d.J)});
this.C={};this.u={};this.V=!1;this.logger=null;this.Z=[];this.ea=void 0;this.Ja=new q2a;this.xa=new s2a;this.Ga=new u2a;this.Ca=new w2a},R3a=function(a){g.Ve(a.channel,"m",function(){a.I=3;
a.B.reset();a.P=null;a.J=0;for(var b=g.r(a.Z),c=b.next();!c.done;c=b.next())c=c.value,a.channel&&a.channel.send(c);a.Z=[];a.W("webChannelOpened");r2a(a.Ja,"WEB_CHANNEL")});
g.Ve(a.channel,"n",function(){a.I=0;a.B.isActive()||a.W("webChannelClosed");var b,c=null==(b=a.channel)?void 0:m3a(new l3a(b,b.j));c&&(a.Z=[].concat(g.v(c)));t2a(a.xa,"WEB_CHANNEL")});
g.Ve(a.channel,"p",function(b){var c=b.data;"gracefulReconnect"===c[0]?(a.B.start(),a.channel&&a.channel.close()):a.W("webChannelMessage",new P3a(c[0],c[1]));a.ea=b.statusCode;v2a(a.Ga,"WEB_CHANNEL")});
g.Ve(a.channel,"o",function(){401===a.ea||a.B.start();a.W("webChannelError");x2a(a.Ca,"WEB_CHANNEL")})},Z7=function(a){var b=a.ma();
b?a.C["x-youtube-lounge-xsrf-token"]=b:delete a.C["x-youtube-lounge-xsrf-token"]},$7=function(a){g.bf.call(this);
this.j=a();this.j.subscribe("webChannelOpened",this.bT,this);this.j.subscribe("webChannelClosed",this.ZS,this);this.j.subscribe("webChannelError",this.onError,this);this.j.subscribe("webChannelMessage",this.aT,this)},S3a=function(a,b,c,d,e){function f(){return new T7(W7(a,"/bc"),b,!1,c,d)}
c=void 0===c?function(){return""}:c;
return g.Q("enable_mdx_web_channel_desktop")?new $7(function(){return new Q3a(W7(a,"/wc"),b,c)}):new Y7(f,e)},W3a=function(){var a=T3a;
U3a();a8.push(a);V3a()},b8=function(a,b){U3a();
var c=X3a(a,String(b));g.Vb(a8)?Y3a(c):(V3a(),g.mc(a8,function(d){d(c)}))},c8=function(a){b8("CP",a)},U3a=function(){a8||(a8=g.La("yt.mdx.remote.debug.handlers_")||[],g.Ka("yt.mdx.remote.debug.handlers_",a8))},Y3a=function(a){var b=(d8+1)%50;
d8=b;e8[b]=a;f8||(f8=49==b)},V3a=function(){var a=a8;
if(e8[0]){var b=f8?d8:-1;do{b=(b+1)%50;var c=e8[b];g.mc(a,function(d){d(c)})}while(b!=d8);
e8=Array(50);d8=-1;f8=!1}},X3a=function(a,b){var c=(Date.now()-Z3a)/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("")},g8=function(a){g.bu.call(this);
this.I=a;this.screens=[]},$3a=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c)return a=c.name,c.id=b.id||c.id,c.name=b.name,c.token=b.token,c.uuid=b.uuid||c.uuid,c.name!=a;a.screens.push(b);return!0},a4a=function(a,b){var c=a.screens.length!=b.length;
a.screens=g.Ll(a.screens,function(f){return!!x6(b,f)});
for(var d=0,e=b.length;d<e;d++)c=$3a(a,b[d])||c;return c},b4a=function(a,b){var c=a.screens.length;
a.screens=g.Ll(a.screens,function(d){return!(d||b?!d!=!b?0:d.id==b.id:1)});
return a.screens.length<c},h8=function(a,b,c,d,e){g.bu.call(this);
this.B=a;this.J=b;this.C=c;this.I=d;this.D=e;this.u=0;this.j=null;this.kc=NaN},j8=function(a){g8.call(this,"LocalScreenService");
this.u=a;this.j=NaN;i8(this);this.info("Initializing with "+v6(this.screens))},c4a=function(a){if(a.screens.length){var b=g.ak(a.screens,function(d){return d.id}),c=W7(a.u,"/pairing/get_lounge_token_batch");
X7(a.u,c,{screen_ids:b.join(",")},(0,g.Sa)(a.iW,a),(0,g.Sa)(a.hW,a))}},i8=function(a){if(g.Q("deprecate_pair_servlet_enabled"))return a4a(a,[]);
var b=X1a(c2a());b=g.Ll(b,function(c){return!c.uuid});
return a4a(a,b)},k8=function(a,b){e2a(g.ak(a.screens,V1a));
b&&d2a()},m8=function(a,b){g.bu.call(this);
this.I=b;b=(b=g.Tu("yt-remote-online-screen-ids")||"")?b.split(","):[];for(var c={},d=this.I(),e=0,f=d.length;e<f;++e){var h=d[e].id;c[h]=g.Ub(b,h)}this.j=c;this.D=a;this.B=this.C=NaN;this.u=null;l8("Initialized with "+g.lh(this.j))},n8=function(a,b,c){var d=W7(a.D,"/pairing/get_screen_availability");
X7(a.D,d,{lounge_token:b.token},(0,g.Sa)(function(e){e=e.screens||[];for(var f=0,h=e.length;f<h;++f)if(e[f].loungeToken==b.token){c("online"==e[f].status);return}c(!1)},a),(0,g.Sa)(function(){c(!1)},a))},o8=function(a,b){a:if(o6(b)!=o6(a.j))var c=!1;
else{c=g.Fe(b);for(var d=0,e=c.length;d<e;++d)if(!a.j[c[d]]){c=!1;break a}c=!0}c||(l8("Updated online screens: "+g.lh(a.j)),a.j=b,a.W("screenChange"));d4a(a)},p8=function(a){isNaN(a.B)||g.bq(a.B);
a.B=g.$p((0,g.Sa)(a.RI,a),0<a.C&&a.C<g.Va()?2E4:1E4)},l8=function(a){b8("OnlineScreenService",a)},e4a=function(a){var b={};
g.mc(a.I(),function(c){c.token?b[c.token]=c.id:this.Re("Requesting availability of screen w/o lounge token.")});
return b},d4a=function(a){a=g.Fe(g.Ae(a.j,function(b){return b}));
g.jc(a);a.length?g.Su("yt-remote-online-screen-ids",a.join(","),60):g.Uu("yt-remote-online-screen-ids")},q8=function(a,b){b=void 0===b?!1:b;
g8.call(this,"ScreenService");this.C=a;this.J=b;this.j=this.u=null;this.B=[];this.D={};f4a(this)},h4a=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.D[b]);var h=a.Ti(),l=c?y6(h,c):null;c&&(a.J||l)||(l=y6(h,b));if(l){l.uuid=b;var m=r8(a,l);n8(a.j,m,function(n){e(n?m:null)})}else c?g4a(a,c,(0,g.Sa)(function(n){var p=r8(this,new s6({name:d,
screenId:c,loungeToken:n,dialId:b||""}));n8(this.j,p,function(q){e(q?p:null)})},a),f):e(null)},i4a=function(a,b){for(var c=0,d=a.screens.length;c<d;++c)if(a.screens[c].name==b)return a.screens[c];
return null},j4a=function(a,b,c){n8(a.j,b,c)},g4a=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={postParams:{screen_ids:b},method:"POST",context:a,onSuccess:function(f,h){f=h&&h.screens||[];f[0]&&f[0].screenId==b?c(f[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.eq(W7(a.C,"/pairing/get_lounge_token_batch"),e)},k4a=function(a){a.screens=a.u.Ti();
var b=a.D,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.screens.length;b<d;++b){var e=a.screens[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+v6(a.screens))},f4a=function(a){s8(a);
a.u=new j8(a.C);a.u.subscribe("screenChange",(0,g.Sa)(a.rW,a));k4a(a);a.J||(a.B=X1a(g.Tu("yt-remote-automatic-screen-cache")||[]));s8(a);a.info("Initializing automatic screens: "+v6(a.B));a.j=new m8(a.C,(0,g.Sa)(a.Ti,a,!0));a.j.subscribe("screenChange",(0,g.Sa)(function(){this.W("onlineScreenChange")},a))},r8=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=y6(a.B,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.B.push(b),a.J||l4a(a));s8(a);a.D[b.uuid]=b.id;g.Su("yt-remote-device-id-map",a.D,31536E3);return b},l4a=function(a){a=g.Ll(a.B,function(b){return"shortLived"!=b.idType});
g.Su("yt-remote-automatic-screen-cache",g.ak(a,V1a))},s8=function(a){a.D=g.Tu("yt-remote-device-id-map")||{}},t8=function(a,b,c){g.bu.call(this);
this.xa=c;this.B=a;this.j=b;this.C=null},u8=function(a,b){a.C=b;
a.W("sessionScreen",a.C)},m4a=function(a,b){a.C&&(a.C.token=b,r8(a.B,a.C));
a.W("sessionScreen",a.C)},v8=function(a,b){b8(a.xa,b)},w8=function(a,b,c){t8.call(this,a,b,"CastSession");
var d=this;this.config_=c;this.u=null;this.ea=(0,g.Sa)(this.gT,this);this.ma=(0,g.Sa)(this.B_,this);this.V=g.$p(function(){n4a(d,null)},12E4);
this.J=this.D=this.I=this.P=0;this.Z=!1;this.U="unknown"},x8=function(a,b){g.bq(a.J);
a.J=0;0==b?o4a(a):a.J=g.$p(function(){o4a(a)},b)},o4a=function(a){p4a(a,"getLoungeToken");
g.bq(a.D);a.D=g.$p(function(){q4a(a,null)},3E4)},p4a=function(a,b){a.info("sendYoutubeMessage_: "+b+" "+g.lh());
var c={};c.type=b;a.u?a.u.sendMessage("urn:x-cast:com.google.youtube.mdx",c,function(){},(0,g.Sa)(function(){v8(this,"Failed to send message: "+b+".")},a)):v8(a,"Sending yt message without session: "+g.lh(c))},y8=function(a,b){b?(a.info("onConnectedScreenId_: Received screenId: "+b),a.getScreen()&&a.getScreen().id==b||a.KN(b,function(c){u8(a,c)},function(){return a.Ch()},5)):a.Ch(Error("Waiting for session status timed out."))},s4a=function(a,b,c){a.info("onConnectedScreenData_: Received screenData: "+
JSON.stringify(b));
var d=new s6(b);r4a(a,d,function(e){e?(a.Z=!0,r8(a.B,d),u8(a,d),a.U="unknown",x8(a,c)):(g.Kp(Error("CastSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online.")),a.Ch())},5)},n4a=function(a,b){g.bq(a.V);
a.V=0;b?a.config_.enableCastLoungeToken&&b.loungeToken?b.deviceId?a.getScreen()&&a.getScreen().uuid==b.deviceId||(b.loungeTokenRefreshIntervalMs?s4a(a,{name:a.j.friendlyName,screenId:b.screenId,loungeToken:b.loungeToken,dialId:b.deviceId,screenIdType:"shortLived"},b.loungeTokenRefreshIntervalMs):(g.Kp(Error("No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: "+JSON.stringify(b)+".")),y8(a,b.screenId))):(g.Kp(Error("No device id presents in mdxSessionStatusData: "+JSON.stringify(b)+
".")),y8(a,b.screenId)):y8(a,b.screenId):a.Ch(Error("Waiting for session status timed out."))},q4a=function(a,b){g.bq(a.D);
a.D=0;var c=null;if(b)if(b.loungeToken){var d;(null==(d=a.getScreen())?void 0:d.token)==b.loungeToken&&(c="staleLoungeToken")}else c="missingLoungeToken";else c="noLoungeTokenResponse";c?(a.info("Did not receive a new lounge token in onLoungeToken_ with data: "+(JSON.stringify(b)+", error: "+c)),a.U=c,x8(a,3E4)):(m4a(a,b.loungeToken),a.Z=!1,a.U="unknown",x8(a,b.loungeTokenRefreshIntervalMs))},r4a=function(a,b,c,d){g.bq(a.I);
a.I=0;j4a(a.B,b,function(e){e||0>d?c(e):a.I=g.$p(function(){r4a(a,b,c,d-1)},300)})},t4a=function(a){g.bq(a.P);
a.P=0;g.bq(a.I);a.I=0;g.bq(a.V);a.V=0;g.bq(a.D);a.D=0;g.bq(a.J);a.J=0},z8=function(a,b,c,d){t8.call(this,a,b,"DialSession");
this.config_=d;this.u=this.P=null;this.ma="";this.Ja=c;this.Ga=null;this.V=function(){};
this.U=NaN;this.Ca=(0,g.Sa)(this.hT,this);this.D=function(){};
this.J=this.I=0;this.ea=!1;this.Z="unknown"},A8=function(a){var b;
return!!(a.config_.enableDialLoungeToken&&(null==(b=a.u)?0:b.getDialAppInfo))},u4a=function(a){a.D=a.B.RK(a.ma,a.j.label,a.j.friendlyName,A8(a),function(b,c){a.D=function(){};
a.ea=!0;u8(a,b);"shortLived"==b.idType&&0<c&&B8(a,c)},function(b){a.D=function(){};
a.Ch(b)})},v4a=function(a){var b={};
b.pairingCode=a.ma;b.theme=a.Ja;g2a()&&(b.env_useStageMdx=1);return g.Bh(b)},C8=function(a){return new Promise(function(b){a.ma=w6();
if(a.Ga){var c=new chrome.cast.DialLaunchResponse(!0,v4a(a));b(c);u4a(a)}else a.V=function(){g.bq(a.U);a.V=function(){};
a.U=NaN;var d=new chrome.cast.DialLaunchResponse(!0,v4a(a));b(d);u4a(a)},a.U=g.$p(function(){a.V()},100)})},x4a=function(a,b,c){a.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(b));
var d=new s6(b);return(new Promise(function(e){w4a(a,d,function(f){f?(a.ea=!0,r8(a.B,d),u8(a,d),B8(a,c)):g.Kp(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online."));e(f)},5)})).then(function(e){return e?new chrome.cast.DialLaunchResponse(!1):C8(a)})},y4a=function(a,b){var c=a.P.receiver.label,d=a.j.friendlyName;
return(new Promise(function(e){h4a(a.B,c,b,d,function(f){f&&f.token&&u8(a,f);e(f)},function(f){v8(a,"Failed to get DIAL screen: "+f);
e(null)})})).then(function(e){return e&&e.token?new chrome.cast.DialLaunchResponse(!1):C8(a)})},w4a=function(a,b,c,d){g.bq(a.I);
a.I=0;j4a(a.B,b,function(e){e||0>d?c(e):a.I=g.$p(function(){w4a(a,b,c,d-1)},300)})},B8=function(a,b){a.info("getDialAppInfoWithTimeout_ "+b);
A8(a)&&(g.bq(a.J),a.J=0,0==b?z4a(a):a.J=g.$p(function(){z4a(a)},b))},z4a=function(a){A8(a)&&a.u.getDialAppInfo(function(b){a.info("getDialAppInfo dialLaunchData: "+JSON.stringify(b));
b=b.extraData||{};var c=null;if(b.loungeToken){var d;(null==(d=a.getScreen())?void 0:d.token)==b.loungeToken&&(c="staleLoungeToken")}else c="missingLoungeToken";c?(a.Z=c,B8(a,3E4)):(a.ea=!1,a.Z="unknown",m4a(a,b.loungeToken),B8(a,b.loungeTokenRefreshIntervalMs))},function(b){a.info("getDialAppInfo error: "+b);
a.Z="noLoungeTokenResponse";B8(a,3E4)})},A4a=function(a){g.bq(a.I);
a.I=0;g.bq(a.J);a.J=0;a.D();a.D=function(){};
g.bq(a.U)},D8=function(a,b){t8.call(this,a,b,"ManualSession");
this.u=g.$p((0,g.Sa)(this.Vu,this,null),150)},E8=function(a,b){g.bu.call(this);
this.config_=b;this.u=a;this.P=b.appId||"233637DE";this.C=b.theme||"cl";this.U=b.disableCastApi||!1;this.I=b.forceMirroring||!1;this.j=null;this.J=!1;this.B=[];this.D=(0,g.Sa)(this.xZ,this)},B4a=function(a,b){return b?g.Sb(a.B,function(c){return t6(b,c.label)},a):null},F8=function(a){b8("Controller",a)},T3a=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},G8=function(a){return a.J||!!a.B.length||!!a.j},H8=function(a,b,c){b!=a.j&&(g.ne(a.j),(a.j=b)?(c?a.W("yt-remote-cast2-receiver-resumed",
b.j):a.W("yt-remote-cast2-receiver-selected",b.j),b.subscribe("sessionScreen",(0,g.Sa)(a.ZP,a,b)),b.subscribe("sessionFailed",function(){return C4a(a,b)}),b.getScreen()?a.W("yt-remote-cast2-session-change",b.getScreen()):c&&a.j.Vu(null)):a.W("yt-remote-cast2-session-change",null))},C4a=function(a,b){a.j==b&&a.W("yt-remote-cast2-session-failed")},D4a=function(a){var b=a.u.QK(),c=a.j&&a.j.j;
a=g.ak(b,function(d){c&&t6(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=B4a(this,d);f?(f.label=e,f.friendlyName=d.name):(f=new chrome.cast.Receiver(e,d.name),f.receiverType=chrome.cast.ReceiverType.CUSTOM);return f},a);
c&&(c.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(c=new chrome.cast.Receiver(c.label,c.friendlyName),c.receiverType=chrome.cast.ReceiverType.CUSTOM),a.push(c));return a},I4a=function(a,b,c,d){d.disableCastApi?I8("Cannot initialize because disabled by Mdx config."):E4a()?F4a(b,d)&&(J8(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?G4a(a,c):(window.__onGCastApiAvailable=function(e,f){e?G4a(a,c):(K8("Failed to load cast API: "+f),L8(!1),J8(!1),g.Uu("yt-remote-cast-available"),g.Uu("yt-remote-cast-receiver"),
H4a(),c(!1))},d.loadCastApiSetupScript?g.Wu("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"):0<=window.navigator.userAgent.indexOf("Android")&&0<=window.navigator.userAgent.indexOf("Chrome/")&&window.navigator.presentation?60<=F6()&&n2a():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?H6():89<=F6()?p2a():(I6(),G6(o2a.map(k2a))))):I8("Cannot initialize because not running Chrome")},H4a=function(){I8("dispose");
var a=M8();a&&a.dispose();g.Ka("yt.mdx.remote.cloudview.instance_",null);J4a(!1);g.vt(N8);N8.length=0},O8=function(){return!!g.Tu("yt-remote-cast-installed")},K4a=function(){var a=g.Tu("yt-remote-cast-receiver");
return a?a.friendlyName:null},L4a=function(){I8("clearCurrentReceiver");
g.Uu("yt-remote-cast-receiver")},M4a=function(){return O8()?M8()?M8().getCastSession():(K8("getCastSelector: Cast is not initialized."),null):(K8("getCastSelector: Cast API is not installed!"),null)},Q8=function(){O8()?M8()?P8()?(I8("Requesting cast selector."),M8().requestSession()):(I8("Wait for cast API to be ready to request the session."),N8.push(g.ut("yt-remote-cast2-api-ready",Q8))):K8("requestCastSelector: Cast is not initialized."):K8("requestCastSelector: Cast API is not installed!")},R8=
function(a,b){P8()?M8().setConnectedScreenStatus(a,b):K8("setConnectedScreenStatus called before ready.")},E4a=function(){var a=0<=g.wb().search(/ (CrMo|Chrome|CriOS)\//);
return g.gz||a},N4a=function(a,b){M8().init(a,b)},F4a=function(a,b){var c=!1;
M8()||(a=new E8(a,b),a.subscribe("yt-remote-cast2-availability-change",function(d){g.Su("yt-remote-cast-available",d);q6("yt-remote-cast2-availability-change",d)}),a.subscribe("yt-remote-cast2-receiver-selected",function(d){I8("onReceiverSelected: "+d.friendlyName);
g.Su("yt-remote-cast-receiver",d);q6("yt-remote-cast2-receiver-selected",d)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(d){I8("onReceiverResumed: "+d.friendlyName);
g.Su("yt-remote-cast-receiver",d);q6("yt-remote-cast2-receiver-resumed",d)}),a.subscribe("yt-remote-cast2-session-change",function(d){I8("onSessionChange: "+u6(d));
d||g.Uu("yt-remote-cast-receiver");q6("yt-remote-cast2-session-change",d)}),g.Ka("yt.mdx.remote.cloudview.instance_",a),c=!0);
I8("cloudview.createSingleton_: "+c);return c},M8=function(){return g.La("yt.mdx.remote.cloudview.instance_")},G4a=function(a,b){L8(!0);
J8(!1);N4a(a,function(c){c?(J4a(!0),g.wt("yt-remote-cast2-api-ready")):(K8("Failed to initialize cast API."),L8(!1),g.Uu("yt-remote-cast-available"),g.Uu("yt-remote-cast-receiver"),H4a());b(c)})},I8=function(a){b8("cloudview",a)},K8=function(a){b8("cloudview",a)},L8=function(a){I8("setCastInstalled_ "+a);
g.Su("yt-remote-cast-installed",a)},P8=function(){return!!g.La("yt.mdx.remote.cloudview.apiReady_")},J4a=function(a){I8("setApiReady_ "+a);
g.Ka("yt.mdx.remote.cloudview.apiReady_",a)},J8=function(a){g.Ka("yt.mdx.remote.cloudview.initializing_",a)},S8=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.I=this.J=0;this.trackData=null;this.hasNext=this.lm=!1;this.P=this.D=this.j=this.C=0;this.B=NaN;this.u=!1;this.reset(a)},T8=function(a){a.audioTrackId=null;
a.trackData=null;a.playerState=-1;a.lm=!1;a.hasNext=!1;a.J=0;a.I=g.Va();a.C=0;a.j=0;a.D=0;a.P=0;a.B=NaN;a.u=!1},U8=function(a){return a.isPlaying()?(g.Va()-a.I)/1E3:0},V8=function(a,b){a.J=b;
a.I=g.Va()},W8=function(a){switch(a.playerState){case 1:case 1081:return(g.Va()-a.I)/1E3+a.J;
case -1E3:return 0}return a.J},X8=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&T8(a)},Y8=function(a){var b={};
b.index=a.index;b.listId=a.listId;b.videoId=a.videoId;b.playerState=a.playerState;b.volume=a.volume;b.muted=a.muted;b.audioTrackId=a.audioTrackId;b.trackData=g.Oe(a.trackData);b.hasPrevious=a.lm;b.hasNext=a.hasNext;b.playerTime=a.J;b.playerTimeAt=a.I;b.seekableStart=a.C;b.seekableEnd=a.j;b.duration=a.D;b.loadedTime=a.P;b.liveIngestionTime=a.B;return b},$8=function(a,b){g.bu.call(this);
this.B=0;this.C=a;this.I=[];this.D=new N3a;this.u=this.j=null;this.U=(0,g.Sa)(this.jY,this);this.J=(0,g.Sa)(this.Oy,this);this.P=(0,g.Sa)(this.iY,this);this.V=(0,g.Sa)(this.mY,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.kJ,this),O4a(this))):c=3;0!=c&&(b?this.kJ(c):g.$p((0,g.Sa)(function(){this.kJ(c)},this),0));
(a=M4a())&&Z8(this,a);this.subscribe("yt-remote-cast2-session-change",this.V)},a9=function(a){return new S8(a.C.getPlayerContextData())},O4a=function(a){g.mc("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "),function(b){this.I.push(this.C.subscribe(b,g.Ta(this.vZ,b),this))},a)},P4a=function(a){g.mc(a.I,function(b){this.C.unsubscribeByKey(b)},a);
a.I.length=0},b9=function(a){return 1==a.getState()},c9=function(a,b){var c=a.D;
50>c.j.length+c.u.length&&a.D.enqueue(b)},e9=function(a,b,c){var d=a9(a);
V8(d,c);-1E3!=d.playerState&&(d.playerState=b);d9(a,d)},f9=function(a,b,c){a.C.sendMessage(b,c)},d9=function(a,b){P4a(a);
a.C.setPlayerContextData(Y8(b));O4a(a)},Z8=function(a,b){a.u&&(a.u.removeUpdateListener(a.U),a.u.removeMediaListener(a.J),a.Oy(null));
a.u=b;a.u&&(c8("Setting cast session: "+a.u.sessionId),a.u.addUpdateListener(a.U),a.u.addMediaListener(a.J),a.u.media.length&&a.Oy(a.u.media[0]))},Q4a=function(a){var b=a.j.media,c=a.j.customData;
if(b&&c){var d=a9(a);b.contentId!=d.videoId&&c8("Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;V8(d,a.j.getEstimatedTime());d9(a,d)}else c8("No cast media video. Ignoring state update.")},g9=function(a,b,c){return(0,g.Sa)(function(d){this.Re("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Re("Retrying "+b+" using MDx browser channel."),f9(this,b,c))},a)},j9=function(a,b,c,d){d=void 0===d?!1:d;
g.bu.call(this);var e=this;this.I=NaN;this.ma=!1;this.U=this.P=this.ea=this.Z=NaN;this.V=[];this.D=this.J=this.C=this.j=this.u=null;this.Ga=a;this.Ca=d;this.V.push(g.$s(window,"beforeunload",function(){e.nu(2)}));
this.B=[];this.j=new S8;this.Ja=b.id;this.xa=b.idType;this.u=S3a(this.Ga,c,this.VK,"shortLived"==this.xa,this.Ja);this.u.Ka("channelOpened",function(){R4a(e)});
this.u.Ka("channelClosed",function(){h9("Channel closed");isNaN(e.I)?D6(!0):D6();e.dispose()});
this.u.Ka("channelError",function(f){D6();isNaN(e.Sx())?(1==f&&"shortLived"==e.xa&&e.W("browserChannelAuthError",f),h9("Channel error: "+f+" without reconnection"),e.dispose()):(e.ma=!0,h9("Channel error: "+f+" with reconnection in "+e.Sx()+" ms"),i9(e,2))});
this.u.Ka("channelMessage",function(f){S4a(e,f)});
this.u.Zn(b.token);this.subscribe("remoteQueueChange",function(){var f=e.j.videoId;g.Vu()&&g.Su("yt-remote-session-video-id",f)})},T4a=function(a){return g.Sb(a.B,function(b){return"LOUNGE_SCREEN"==b.type})},h9=function(a){b8("conn",a)},i9=function(a,b){a.W("proxyStateChange",b)},U4a=function(a){a.I=g.$p(function(){h9("Connecting timeout");
a.nu(1)},2E4)},k9=function(a){g.bq(a.I);
a.I=NaN},l9=function(a){g.bq(a.Z);
a.Z=NaN},V4a=function(a){m9(a);
a.ea=g.$p(function(){n9(a,"getNowPlaying")},2E4)},m9=function(a){g.bq(a.ea);
a.ea=NaN},R4a=function(a){h9("Channel opened");
a.ma&&(a.ma=!1,l9(a),a.Z=g.$p(function(){h9("Timing out waiting for a screen.");a.nu(1)},15E3))},X4a=function(a,b){var c=null;
if(b){var d=T4a(a);d&&(c={clientName:d.clientName,deviceMake:d.brand,deviceModel:d.model,osVersion:d.osVersion})}g.Ka("yt.mdx.remote.remoteClient_",c);b&&(k9(a),l9(a));c=a.u.Nu()&&isNaN(a.I);b==c?b&&(i9(a,1),n9(a,"getSubtitlesTrack")):b?(a.JN()&&a.j.reset(),i9(a,1),n9(a,"getNowPlaying"),W4a(a)):a.nu(1)},Y4a=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.j.videoId&&(g.Je(b.params)?a.j.trackData=null:a.j.trackData=b.params,a.W("remotePlayerChange"))},Z4a=function(a,b,c){var d=b.params.videoId||b.params.video_id,e=parseInt(b.params.currentIndex,10);
a.j.listId=b.params.listId||a.j.listId;X8(a.j,d,e);a.W("remoteQueueChange",c)},a5a=function(a,b){b.params=b.params||{};
Z4a(a,b,"NOW_PLAYING_MAY_CHANGE");$4a(a,b);a.W("autoplayDismissed")},$4a=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
V8(a.j,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.j.playerState&&(c=-1E3);a.j.playerState=c;c=Number(b.params.loadedTime);a.j.P=isNaN(c)?0:c;a.j.Wk(Number(b.params.duration));c=a.j;var d=Number(b.params.liveIngestionTime);c.B=d;c.u=isNaN(d)?!1:!0;c=a.j;d=Number(b.params.seekableStartTime);b=Number(b.params.seekableEndTime);c.C=isNaN(d)?0:d;c.j=isNaN(b)?0:b;1==a.j.playerState?V4a(a):m9(a);a.W("remotePlayerChange")},b5a=function(a,b){if(-1E3!=a.j.playerState){var c=1085;
switch(parseInt(b.params.adState,10)){case 1:c=1081;break;case 2:c=1084;break;case 0:c=1083}a.j.playerState=c;b=parseInt(b.params.currentTime,10);V8(a.j,isNaN(b)?0:b);a.W("remotePlayerChange")}},c5a=function(a,b){var c="true"==b.params.muted;
a.j.volume=parseInt(b.params.volume,10);a.j.muted=c;a.W("remotePlayerChange")},d5a=function(a,b){a.J=b.params.videoId;
a.W("nowAutoplaying",parseInt(b.params.timeout,10))},e5a=function(a,b){a.J=b.params.videoId||null;
a.W("autoplayUpNext",a.J)},f5a=function(a,b){a.D=b.params.autoplayMode;
a.W("autoplayModeChange",a.D);"DISABLED"==a.D&&a.W("autoplayDismissed")},g5a=function(a,b){var c="true"==b.params.hasNext;
a.j.lm="true"==b.params.hasPrevious;a.j.hasNext=c;a.W("previousNextChange")},S4a=function(a,b){b=b.message;
b.params?h9("Received: action="+b.action+", params="+g.lh(b.params)):h9("Received: action="+b.action+" {}");switch(b.action){case "loungeStatus":b=p6(b.params.devices);a.B=g.ak(b,function(d){return new r6(d)});
b=!!g.Sb(a.B,function(d){return"LOUNGE_SCREEN"==d.type});
X4a(a,b);b=a.qO("mlm");a.W("multiStateLoopEnabled",b);break;case "loungeScreenDisconnected":g.Zb(a.B,function(d){return"LOUNGE_SCREEN"==d.type});
X4a(a,!1);break;case "remoteConnected":var c=new r6(p6(b.params.device));g.Sb(a.B,function(d){return d.equals(c)})||O1a(a.B,c);
break;case "remoteDisconnected":c=new r6(p6(b.params.device));g.Zb(a.B,function(d){return d.equals(c)});
break;case "gracefulDisconnect":break;case "playlistModified":Z4a(a,b,"QUEUE_MODIFIED");break;case "nowPlaying":a5a(a,b);break;case "onStateChange":$4a(a,b);break;case "onAdStateChange":b5a(a,b);break;case "onVolumeChanged":c5a(a,b);break;case "onSubtitlesTrackChanged":Y4a(a,b);break;case "nowAutoplaying":d5a(a,b);break;case "autoplayDismissed":a.W("autoplayDismissed");break;case "autoplayUpNext":e5a(a,b);break;case "onAutoplayModeChanged":f5a(a,b);break;case "onHasPreviousNextChanged":g5a(a,b);break;
case "requestAssistedSignIn":a.W("assistedSignInRequested",b.params.authCode);break;case "onLoopModeChanged":a.W("loopModeChange",b.params.loopMode);break;default:h9("Unrecognized action: "+b.action)}},W4a=function(a){g.bq(a.U);
a.U=g.$p(function(){a.nu(1)},864E5)},n9=function(a,b,c){c?h9("Sending: action="+b+", params="+g.lh(c)):h9("Sending: action="+b);
a.u.sendMessage(b,c)},o9=function(a){g8.call(this,"ScreenServiceProxy");
this.Ff=a;this.j=[];this.j.push(this.Ff.$_s("screenChange",(0,g.Sa)(this.lT,this)));this.j.push(this.Ff.$_s("onlineScreenChange",(0,g.Sa)(this.dZ,this)))},k5a=function(a,b){f2a();
if(!E6||!E6.get("yt-remote-disable-remote-module-for-dev")){b=g.P("MDX_CONFIG")||b;Z1a();C6();p9||(p9=new V7(b?b.loungeApiHost:void 0),g2a()&&(p9.j="/api/loungedev"));q9||(q9=g.La("yt.mdx.remote.deferredProxies_")||[],g.Ka("yt.mdx.remote.deferredProxies_",q9));h5a();var c=r9();if(!c){var d=new q8(p9,b?b.disableAutomaticScreenCache||!1:!1);g.Ka("yt.mdx.remote.screenService_",d);c=r9();var e={};b&&(e={appId:b.appId,disableDial:b.disableDial,theme:b.theme,loadCastApiSetupScript:b.loadCastApiSetupScript,
disableCastApi:b.disableCastApi,enableDialLoungeToken:b.enableDialLoungeToken,enableCastLoungeToken:b.enableCastLoungeToken,forceMirroring:b.forceMirroring});g.Ka("yt.mdx.remote.enableConnectWithInitialState_",b?b.enableConnectWithInitialState||!1:!1);I4a(a,d,function(f){f?s9()&&R8(s9(),"YouTube TV"):d.subscribe("onlineScreenChange",function(){q6("yt-remote-receiver-availability-change")})},e)}b&&!g.La("yt.mdx.remote.initialized_")&&(g.Ka("yt.mdx.remote.initialized_",!0),t9("Initializing: "+g.lh(b)),
u9.push(g.ut("yt-remote-cast2-api-ready",function(){q6("yt-remote-api-ready")})),u9.push(g.ut("yt-remote-cast2-availability-change",function(){q6("yt-remote-receiver-availability-change")})),u9.push(g.ut("yt-remote-cast2-receiver-selected",function(){v9(null);
q6("yt-remote-auto-connect","cast-selector-receiver")})),u9.push(g.ut("yt-remote-cast2-receiver-resumed",function(){q6("yt-remote-receiver-resumed","cast-selector-receiver")})),u9.push(g.ut("yt-remote-cast2-session-change",i5a)),u9.push(g.ut("yt-remote-connection-change",function(f){f?R8(s9(),"YouTube TV"):w9()||(R8(null,null),L4a())})),u9.push(g.ut("yt-remote-cast2-session-failed",function(){q6("yt-remote-connection-failed")})),a=x9(),b.isAuto&&(a.id+="#dial"),e=b.capabilities||[],g.Q("desktop_enable_autoplay")&&
e.push("atp"),0<e.length&&(a.capabilities=e),a.name=b.device,a.app=b.app,(b=b.theme)&&(a.theme=b),t9(" -- with channel params: "+g.lh(a)),a?(g.Su("yt-remote-session-app",a.app),g.Su("yt-remote-session-name",a.name)):(g.Uu("yt-remote-session-app"),g.Uu("yt-remote-session-name")),g.Ka("yt.mdx.remote.channelParams_",a),c.start(),s9()||j5a())}},l5a=function(){var a=r9().Ff.$_gos();
var b=y9();b&&z9()&&(x6(a,b)||a.push(b));return Y1a(a)},A9=function(){var a=m5a();
!a&&O8()&&K4a()&&(a={key:"cast-selector-receiver",name:K4a()});return a},m5a=function(){var a=l5a(),b=y9();
b||(b=w9());return g.Sb(a,function(c){return b&&t6(b,c.key)?!0:!1})},y9=function(){var a=s9();
if(!a)return null;var b=r9().Ti();return y6(b,a)},i5a=function(a){t9("remote.onCastSessionChange_: "+u6(a));
if(a){var b=y9();if(b&&b.id==a.id){if(R8(b.id,"YouTube TV"),"shortLived"==a.idType&&(a=a.token))B9&&(B9.token=a),(b=z9())&&b.Zn(a)}else b&&C9(),D9(a,1)}else z9()&&C9()},C9=function(){P8()?M8().stopSession():K8("stopSession called before API ready.");
var a=z9();a&&(a.disconnect(1),E9(null))},F9=function(){var a=z9();
return!!a&&3!=a.getProxyState()},t9=function(a){b8("remote",a)},r9=function(){if(!G9){var a=g.La("yt.mdx.remote.screenService_");
G9=a?new o9(a):null}return G9},s9=function(){return g.La("yt.mdx.remote.currentScreenId_")},n5a=function(a){g.Ka("yt.mdx.remote.currentScreenId_",a)},o5a=function(){return g.La("yt.mdx.remote.connectData_")},v9=function(a){g.Ka("yt.mdx.remote.connectData_",a)},z9=function(){return g.La("yt.mdx.remote.connection_")},E9=function(a){var b=z9();
v9(null);a||n5a("");g.Ka("yt.mdx.remote.connection_",a);q9&&(g.mc(q9,function(c){c(a)}),q9.length=0);
b&&!a?q6("yt-remote-connection-change",!1):!b&&a&&q6("yt-remote-connection-change",!0)},w9=function(){var a=g.Vu();
if(!a)return null;var b=r9();if(!b)return null;b=b.Ti();return y6(b,a)},D9=function(a,b){s9();
y9()&&y9();if(H9)B9=a;else{n5a(a.id);var c=g.La("yt.mdx.remote.enableConnectWithInitialState_")||!1;a=new j9(p9,a,x9(),c);a.connect(b,o5a());a.subscribe("beforeDisconnect",function(d){q6("yt-remote-before-disconnect",d)});
a.subscribe("beforeDispose",function(){z9()&&(z9(),E9(null))});
a.subscribe("browserChannelAuthError",function(){var d=y9();d&&"shortLived"==d.idType&&(P8()?M8().handleBrowserChannelAuthError():K8("refreshLoungeToken called before API ready."))});
E9(a)}},j5a=function(){var a=w9();
a?(t9("Resume connection to: "+u6(a)),D9(a,0)):(D6(),L4a(),t9("Skipping connecting because no session screen found."))},h5a=function(){var a=x9();
if(g.Je(a)){a=B6();var b=g.Tu("yt-remote-session-name")||"",c=g.Tu("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.Ka("yt.mdx.remote.channelParams_",a)}},x9=function(){return g.La("yt.mdx.remote.channelParams_")||{}},I9=function(a,b,c){g.I.call(this);
var d=this;this.u=a;this.G=b;this.Ub=c;this.events=new g.cz(this);this.V=this.events.N(this.G,"onVolumeChange",function(e){p5a(d,e)});
this.D=!1;this.I=new g.oF(64);this.j=new g.K(this.jR,500,this);this.B=new g.K(this.kR,1E3,this);this.P=new K6(this.b1,0,this);this.C={};this.U=new g.K(this.TR,1E3,this);this.J=new L6(this.seekTo,1E3,this);g.J(this,this.events);this.events.N(b,"onCaptionsTrackListChanged",this.OY);this.events.N(b,"captionschanged",this.gY);this.events.N(b,"captionssettingschanged",this.rR);this.events.N(b,"videoplayerreset",this.AC);this.events.N(b,"mdxautoplaycancel",function(){d.Ub.eN()});
a=this.Ub;a.isDisposed();a.subscribe("proxyStateChange",this.WP,this);a.subscribe("remotePlayerChange",this.Ty,this);a.subscribe("remoteQueueChange",this.AC,this);a.subscribe("previousNextChange",this.TP,this);a.subscribe("nowAutoplaying",this.NP,this);a.subscribe("autoplayDismissed",this.qP,this);g.J(this,this.j);g.J(this,this.B);g.J(this,this.P);g.J(this,this.U);g.J(this,this.J);this.rR();this.AC();this.Ty()},p5a=function(a,b){if(J9(a)){a.Ub.unsubscribe("remotePlayerChange",a.Ty,a);
var c=Math.round(b.volume);b=!!b.muted;var d=a9(a.Ub);if(c!==d.volume||b!==d.muted)a.Ub.setVolume(c,b),a.U.start();a.Ub.subscribe("remotePlayerChange",a.Ty,a)}},q5a=function(a){a.Qb(0);
a.j.stop();a.Pb(new g.oF(64))},K9=function(a,b){if(J9(a)&&!a.D){var c=null;
b&&(c={style:a.G.getSubtitlesUserSettings()},g.Qe(c,b));a.Ub.UK(a.G.getVideoData(1).videoId,c);a.C=a9(a.Ub).trackData}},L9=function(a,b){var c=a.G.getPlaylist();
if(null==c?0:c.listId){var d=c.index;var e=c.listId.toString()}c=a.G.getVideoData(1);a.Ub.playVideo(c.videoId,b,d,e,c.playerParams,c.ma,N1a(c));a.Pb(new g.oF(1))},r5a=function(a,b){if(b){var c=a.G.getOption("captions","tracklist",{iO:1});
c&&c.length?(a.G.setOption("captions","track",b),a.D=!1):(a.G.loadModule("captions"),a.D=!0)}else a.G.setOption("captions","track",{})},J9=function(a){return a9(a.Ub).videoId===a.G.getVideoData(1).videoId},M9=function(){g.W.call(this,{F:"div",
L:"ytp-mdx-popup-dialog",T:{role:"dialog"},R:[{F:"div",L:"ytp-mdx-popup-dialog-inner-content",R:[{F:"div",L:"ytp-mdx-popup-title",X:"You're signed out"},{F:"div",L:"ytp-mdx-popup-description",X:"Videos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer."},{F:"div",L:"ytp-mdx-privacy-popup-buttons",R:[{F:"button",Aa:["ytp-button","ytp-mdx-privacy-popup-cancel"],X:"Cancel"},{F:"button",Aa:["ytp-button","ytp-mdx-privacy-popup-confirm"],
X:"Confirm"}]}]}]});this.j=new g.XG(this,250);this.cancelButton=this.va("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.va("ytp-mdx-privacy-popup-confirm");g.J(this,this.j);this.N(this.cancelButton,"click",this.u);this.N(this.confirmButton,"click",this.B)},N9=function(a){g.W.call(this,{F:"div",
L:"ytp-remote",R:[{F:"div",L:"ytp-remote-display-status",R:[{F:"div",L:"ytp-remote-display-status-icon",R:[g.hBa()]},{F:"div",L:"ytp-remote-display-status-text",X:"{{statustext}}"}]}]});this.api=a;this.j=new g.XG(this,250);g.J(this,this.j);this.N(a,"presentingplayerstatechange",this.onStateChange);s5a(this,a.vb())},s5a=function(a,b){if(3===a.api.getPresentingPlayerType()){var c={RECEIVER_NAME:a.api.getOption("remote","currentReceiver").name};
b=g.V(b,128)?g.WE("Error on $RECEIVER_NAME",c):b.isPlaying()||g.V(b,4)?g.WE("Playing on $RECEIVER_NAME",c):g.WE("Connected to $RECEIVER_NAME",c);a.updateValue("statustext",b);a.j.show()}else a.j.hide()},O9=function(a,b){g.lM.call(this,"Play on",0,a,b);
this.G=a;this.aq={};this.N(a,"onMdxReceiversChange",this.C);this.N(a,"presentingplayerstatechange",this.C);this.C()},P9=function(a){g.NI.call(this,a);
this.ym={key:w6(),name:"This computer"};this.xj=null;this.subscriptions=[];this.BI=this.Ub=null;this.aq=[this.ym];this.Uo=this.ym;this.Od=new g.oF(64);this.DO=0;this.fg=-1;this.cz=!1;this.Zy=this.zv=null;if(!g.YA(this.player.S())&&!g.ZA(this.player.S())){a=this.player;var b=g.nI(a);b&&(b=b.vp())&&(b=new O9(a,b),g.J(this,b));b=new N9(a);g.J(this,b);g.xI(a,b.element,4);this.zv=new M9;g.J(this,this.zv);g.xI(a,this.zv.element,4);this.cz=!!w9()}},Q9=function(a){a.Zy&&(a.player.removeEventListener("presentingplayerstatechange",
a.Zy),a.Zy=null)},t5a=function(a,b,c){a.Od=c;
a.player.W("presentingplayerstatechange",new g.IE(c,b))},R9=function(a,b){if(b.key!==a.Uo.key)if(b.key===a.ym.key)C9();
else{var c;(c=!a.player.S().K("mdx_enable_privacy_disclosure_ui"))||(c=((c=g.P("PLAYER_CONFIG"))&&c.args&&void 0!==c.args.authuser?!0:!(!g.P("SESSION_INDEX")&&!g.P("LOGGED_IN")))||a.cz||!a.zv);(c?0:g.oB(a.player.S())||g.rB(a.player.S()))&&u5a(a);a.Uo=b;if(!a.player.S().K("disable_mdx_connection_in_mdx_module_for_music_web")||!g.ZA(a.player.S())){var d=a.player.getPlaylistId();c=a.player.getVideoData(1);var e=c.videoId;if(!d&&!e||(2===a.player.getAppState()||1===a.player.getAppState())&&a.player.S().K("should_clear_video_data_on_player_cued_unstarted"))a=
null;else{var f=a.player.getPlaylist();if(f){var h=[];for(var l=0;l<f.length;l++)h[l]=g.II(f,l).videoId}else h=[e];f=a.player.getCurrentTime(1);a={videoIds:h,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.ma,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0===f?void 0:f};(c=N1a(c))&&(a.locationInfo=c)}t9("Connecting to: "+g.lh(b));"cast-selector-receiver"==b.key?(v9(a||null),b=a||null,P8()?M8().setLaunchParams(b):K8("setLaunchParams called before ready.")):!a&&F9()&&
s9()==b.key?q6("yt-remote-connection-change",!0):(C9(),v9(a||null),a=r9().Ti(),(b=y6(a,b.key))&&D9(b,1))}}},u5a=function(a){a.player.vb().isPlaying()?a.player.pauseVideo():(a.Zy=function(b){!a.cz&&g.KE(b,8)&&(a.player.pauseVideo(),Q9(a))},a.player.addEventListener("presentingplayerstatechange",a.Zy));
a.zv&&a.zv.md();z9()||(H9=!0)};
g.Qo.prototype.ip=g.ea(1,function(){return g.Yc(this,6)});
g.Cd.prototype.iA=g.ea(0,function(){var a=g.Gd(this);return 4294967296*g.Gd(this)+(a>>>0)});
var y1a,v5a=g.ee(function(a,b,c){if(1!==a.u)return!1;g.E(b,c,g.Hd(a.j));return!0},g.fe),w5a=g.ee(function(a,b,c,d){if(1!==a.u)return!1;
g.id(b,c,d,g.Hd(a.j));return!0},g.fe),x5a=g.ee(function(a,b,c){if(0!==a.u)return!1;
g.E(b,c,g.Ed(a.j));return!0},g.ge),y5a=g.ee(function(a,b,c,d){if(0!==a.u)return!1;
g.id(b,c,d,g.Ed(a.j));return!0},g.ge),z5a=g.ee(function(a,b,c){if(0!==a.u)return!1;
g.E(b,c,g.Fd(a.j));return!0},g.he),A5a=g.ee(function(a,b,c,d){if(0!==a.u)return!1;
g.id(b,c,d,g.Fd(a.j));return!0},g.he),B5a=g.ee(function(a,b,c){if(1!==a.u)return!1;
g.E(b,c,a.j.iA());return!0},function(a,b,c){A1a(a,c,g.Yc(b,c))}),C5a=g.ee(function(a,b,c){if(1!==a.u&&2!==a.u)return!1;
b=g.$c(b,c);if(2==a.u){c=g.Cd.prototype.iA;var d=g.Fd(a.j)>>>0;for(d=a.j.j+d;a.j.j<d;)b.push(c.call(a.j))}else b.push(a.j.iA());return!0},function(a,b,c){b=g.$c(b,c);
if(null!=b)for(var d=0;d<b.length;d++)A1a(a,c,b[d])}),D5a=g.ee(function(a,b,c){if(0!==a.u)return!1;
g.E(b,c,g.Id(a.j));return!0},B1a),E5a=g.ee(function(a,b,c,d){if(0!==a.u)return!1;
g.id(b,c,d,g.Id(a.j));return!0},B1a),F5a=g.ee(function(a,b,c){if(2!==a.u)return!1;
a=g.Pd(a);g.gd(b,c,a);return!0},function(a,b,c){b=g.$c(b,c);
if(null!=b)for(var d=0;d<b.length;d++){var e=b[d];null!=e&&g.Vd(a,c,g.gb(e))}}),G5a=g.ee(function(a,b,c,d){if(2!==a.u)return!1;
g.id(b,c,d,g.Pd(a));return!0},g.Sba),H5a=g.ee(function(a,b,c,d,e){if(2!==a.u)return!1;
g.Ld(a,g.$aa(b,d,c),e);return!0},g.Tba),D1a=[1];
g.w(E1a,g.F);g.w(F1a,g.F);var I5a=[E1a,1,g.MZ,[F1a,1,v5a,2,x5a]];g.w(G1a,g.F);g.w(H1a,g.F);g.w(I1a,g.F);
var J5a=[1,2],K5a=[g.Yg,1,g.LZ,5,B5a,2,H5a,[G1a,1,g.NZ,[H1a,1,g.LZ,2,g.LZ,3,D5a],J5a,2,g.NZ,[I1a,1,g.LZ,2,g.LZ,3,z5a,4,D5a],J5a],3,F5a,6,C5a,4,g.MZ,[g.Zg,1,g.MZ,[g.$g,1,G5a,g.ch,2,A5a,g.ch,3,E5a,g.ch],2,H5a,[g.ah,1,y5a,g.bh,2,w5a,g.bh,3,g.NZ,I5a,g.bh]]],s3a={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},B7={"'":"\\'"},U1a={W2:"atp",vga:"ska",Mea:"que",gca:"mus",tga:"sus",A8:"dsp",qfa:"seq",Iba:"mic",p7:"dpa",r3:"cds",eca:"mlm",
m7:"dsdtr",dda:"ntb"};r6.prototype.equals=function(a){return a?this.id==a.id:!1};
var E6,A6="",m2a=h2a("loadCastFramework")||h2a("loadCastApplicationFramework"),o2a=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
g.Wa(K6,g.I);g.k=K6.prototype;g.k.JS=function(a){this.C=arguments;this.j=!1;this.kc?this.B=g.Va()+this.Ug:this.kc=g.Vg(this.D,this.Ug)};
g.k.stop=function(){this.kc&&(g.C.clearTimeout(this.kc),this.kc=null);this.B=null;this.j=!1;this.C=[]};
g.k.pause=function(){++this.u};
g.k.resume=function(){this.u&&(--this.u,!this.u&&this.j&&(this.j=!1,this.I.apply(null,this.C)))};
g.k.Y=function(){this.stop();K6.Ee.Y.call(this)};
g.k.KS=function(){this.kc&&(g.C.clearTimeout(this.kc),this.kc=null);this.B?(this.kc=g.Vg(this.D,this.B-g.Va()),this.B=null):this.u?this.j=!0:(this.j=!1,this.I.apply(null,this.C))};g.w(L6,g.I);g.k=L6.prototype;g.k.eE=function(a){this.B=arguments;this.kc||this.u?this.j=!0:M6(this)};
g.k.stop=function(){this.kc&&(g.C.clearTimeout(this.kc),this.kc=null,this.j=!1,this.B=null)};
g.k.pause=function(){this.u++};
g.k.resume=function(){this.u--;this.u||!this.j||this.kc||(this.j=!1,M6(this))};
g.k.Y=function(){g.I.prototype.Y.call(this);this.stop()};N6.prototype.stringify=function(a){return g.C.JSON.stringify(a,void 0)};
N6.prototype.parse=function(a){return g.C.JSON.parse(a,void 0)};g.Wa(O6,g.se);g.Wa(P6,g.se);var C2a=!1;var E2a=null;g.Wa(F2a,g.se);g.Wa(G2a,g.se);g.Wa(H2a,g.se);U6.prototype.info=function(){};
U6.prototype.warning=function(){};var Z6={},Y6={};g.k=V6.prototype;g.k.setTimeout=function(a){this.sb=a};
g.k.NS=function(a){a=a.target;var b=this.Qa;b&&3==g.Kh(a)?b.eE():this.yK(a)};
g.k.yK=function(a){try{if(a==this.j)a:{var b=g.Kh(this.j),c=this.j.u,d=this.j.getStatus();if(!(3>b)&&(3!=b||g.uB||this.j&&(this.u.u||g.Mh(this.j)||g.Nh(this.j)))){this.Ca||4!=b||7==c||(8==c||0>=d?R6(3):R6(2));c7(this);var e=this.j.getStatus();this.Kb=e;b:if(L2a(this)){var f=g.Nh(this.j);a="";var h=f.length,l=4==g.Kh(this.j);if(!this.u.B){if("undefined"===typeof TextDecoder){a7(this);b7(this);var m="";break b}this.u.B=new g.C.TextDecoder}for(c=0;c<h;c++)this.u.u=!0,a+=this.u.B.decode(f[c],{stream:l&&
c==h-1});f.splice(0,h);this.u.j+=a;this.V=0;m=this.u.j}else m=g.Mh(this.j);if(this.B=200==e){if(this.Yb&&!this.Pa){b:{if(this.j){var n=g.Oh(this.j,"X-HTTP-Initial-Response");if(n&&!g.pb(n)){var p=n;break b}}p=null}if(e=p)this.Pa=!0,$6(this,e);else{this.B=!1;this.I=3;S6(12);a7(this);b7(this);break a}}this.xa?(N2a(this,b,m),g.uB&&this.B&&3==b&&(this.Ya.Ka(this.Za,"tick",this.MS),this.Za.start())):$6(this,m);4==b&&a7(this);this.B&&!this.Ca&&(4==b?P2a(this.D,this):(this.B=!1,X6(this)))}else 400==e&&0<
m.indexOf("Unknown SID")?(this.I=3,S6(12)):(this.I=0,S6(13)),a7(this),b7(this)}}}catch(q){}finally{}};
g.k.MS=function(){if(this.j){var a=g.Kh(this.j),b=g.Mh(this.j);this.V<b.length&&(c7(this),N2a(this,a,b),this.B&&4!=a&&X6(this))}};
g.k.cancel=function(){this.Ca=!0;a7(this)};
g.k.LS=function(){this.U=null;var a=Date.now();0<=a-this.Gb?(2!=this.Ja&&(R6(3),S6(17)),a7(this),this.I=2,b7(this)):O2a(this,this.Gb-a)};
g.k.getLastError=function(){return this.I};U2a.prototype.cancel=function(){this.B=l7(this);if(this.u)this.u.cancel(),this.u=null;else if(this.j&&0!==this.j.size){for(var a=g.r(this.j.values()),b=a.next();!b.done;b=a.next())b.value.cancel();this.j.clear()}};g.k=Z2a.prototype;g.k.zK=8;g.k.Uf=1;g.k.connect=function(a,b,c,d){this.gf&&g.Lg((0,g.Sa)(this.g0,this,a));S6(0);this.Fc=a;this.Ca=b||{};c&&void 0!==d&&(this.Ca.OSID=c,this.Ca.OAID=d);this.Za=this.Gc;this.Ga=Q2a(this,null,this.Fc);k7(this)};
g.k.disconnect=function(){$2a(this);if(3==this.Uf){var a=this.Qa++,b=this.Ga.clone();g.Ri(b,"SID",this.C);g.Ri(b,"RID",a);g.Ri(b,"TYPE","terminate");p7(this,b);a=new V6(this,this.C,a);a.Ja=2;a.J=m6(b.clone());b=!1;g.C.navigator&&g.C.navigator.sendBeacon&&(b=g.C.navigator.sendBeacon(a.J.toString(),""));!b&&g.C.Image&&((new Image).src=a.J,b=!0);b||(a.j=K2a(a.D,null),a.j.send(a.J));a.Z=Date.now();X6(a)}f3a(this)};
g.k.g0=function(a){try{D2a(a,function(){})}catch(b){}};
g.k.Hf=function(){return 0==this.Uf};
g.k.getState=function(){return this.Uf};
g.k.BK=function(a){if(this.I)if(this.I=null,1==this.Uf){if(!a){this.Qa=Math.floor(1E5*Math.random());a=this.Qa++;var b=new V6(this,"",a),c=this.U;this.Gb&&(c?(c=g.Ne(c),g.Qe(c,this.Gb)):c=this.Gb);null!==this.J||this.ib||(b.Ga=c,c=null);var d;if(this.sb)a:{for(var e=d=0;e<this.B.length;e++){b:{var f=this.B[e];if("__data__"in f.map&&(f=f.map.__data__,"string"===typeof f)){f=f.length;break b}f=void 0}if(void 0===f)break;d+=f;if(4096<d){d=e;break a}if(4096===d||e===this.B.length-1){d=e+1;break a}}d=
1E3}else d=1E3;d=c3a(this,b,d);e=this.Ga.clone();g.Ri(e,"RID",a);g.Ri(e,"CVER",22);this.xa&&g.Ri(e,"X-HTTP-Session-Id",this.xa);p7(this,e);c&&(this.ib?d="headers="+g.ag(g.zfa(c))+"&"+d:this.J&&g.Vi(e,this.J,c));j7(this.u,b);this.Ue&&g.Ri(e,"TYPE","init");this.sb?(g.Ri(e,"$req",d),g.Ri(e,"SID","null"),b.Yb=!0,W6(b,e,null)):W6(b,e,d);this.Uf=2}}else 3==this.Uf&&(a?d3a(this,a):0==this.B.length||V2a(this.u)||d3a(this))};
g.k.AK=function(){this.P=null;e3a(this);if(this.Kc&&!(this.Ya||null==this.j||0>=this.Wc)){var a=2*this.Wc;this.ma=T6((0,g.Sa)(this.fY,this),a)}};
g.k.fY=function(){this.ma&&(this.ma=null,this.Za=!1,this.Ya=!0,S6(10),f7(this),e3a(this))};
g.k.bI=function(a){this.j==a&&this.Kc&&!this.Ya&&(o7(this),this.Ya=!0,S6(11))};
g.k.OS=function(){null!=this.V&&(this.V=null,f7(this),g7(this),S6(19))};
g.k.H0=function(a){a?S6(2):S6(1)};
g.k.isActive=function(){return!!this.D&&this.D.isActive(this)};
g.k=h3a.prototype;g.k.FK=function(){};
g.k.EK=function(){};
g.k.DK=function(){};
g.k.CK=function(){};
g.k.isActive=function(){return!0};
g.k.PS=function(){};g.Wa(r7,g.bf);r7.prototype.open=function(){this.j.D=this.C;this.J&&(this.j.Ja=!0);this.j.connect(this.I,this.u||void 0)};
r7.prototype.close=function(){this.j.disconnect()};
r7.prototype.send=function(a){var b=this.j;if("string"===typeof a){var c={};c.__data__=a;a=c}else this.D&&(c={},c.__data__=g.lh(a),a=c);b.B.push(new T2a(b.Se++,a));3==b.Uf&&k7(b)};
r7.prototype.Y=function(){this.j.D=null;delete this.C;this.j.disconnect();delete this.j;r7.Ee.Y.call(this)};
g.Wa(j3a,O6);g.Wa(k3a,P6);g.Wa(q7,h3a);q7.prototype.FK=function(){this.j.dispatchEvent("m")};
q7.prototype.EK=function(a){this.j.dispatchEvent(new j3a(a))};
q7.prototype.DK=function(a){this.j.dispatchEvent(new k3a(a))};
q7.prototype.CK=function(){this.j.dispatchEvent("n")};var t7=new g.bf;g.w(n3a,g.se);g.k=v7.prototype;g.k.yq=null;g.k.Mm=!1;g.k.Ct=null;g.k.gE=null;g.k.At=null;g.k.Bt=null;g.k.Ao=null;g.k.Co=null;g.k.zq=null;g.k.hh=null;g.k.dA=0;g.k.dl=null;g.k.cA=null;g.k.Bo=null;g.k.pw=-1;g.k.YQ=!0;g.k.xq=!1;g.k.fE=0;g.k.bA=null;var q3a={},y7={};g.k=v7.prototype;g.k.setTimeout=function(a){this.u=a};
g.k.RS=function(a){a=a.target;var b=this.bA;b&&3==g.Kh(a)?b.eE():this.GK(a)};
g.k.GK=function(a){try{if(a==this.hh)a:{var b=g.Kh(this.hh),c=this.hh.u,d=this.hh.getStatus();if(g.vc&&!g.sc(10)||g.ve&&!g.rc("420+")){if(4>b)break a}else if(3>b||3==b&&!g.Mh(this.hh))break a;this.xq||4!=b||7==c||(8==c||0>=d?this.j.Pk(3):this.j.Pk(2));C7(this);var e=this.hh.getStatus();this.pw=e;var f=g.Mh(this.hh);if(this.Mm=200==e){4==b&&z7(this);if(this.xa){for(a=!0;!this.xq&&this.dA<f.length;){var h=r3a(this,f);if(h==y7){4==b&&(this.Bo=4,u7(15),a=!1);break}else if(h==q3a){this.Bo=4;u7(16);a=!1;
break}else D7(this,h)}4==b&&0==f.length&&(this.Bo=1,u7(17),a=!1);this.Mm=this.Mm&&a;a||(z7(this),A7(this))}else D7(this,f);this.Mm&&!this.xq&&(4==b?this.j.eA(this):(this.Mm=!1,x7(this)))}else 400==e&&0<f.indexOf("Unknown SID")?(this.Bo=3,u7(13)):(this.Bo=0,u7(14)),z7(this),A7(this)}}catch(l){}finally{}};
g.k.r_=function(a){s7((0,g.Sa)(this.q_,this,a),0)};
g.k.q_=function(a){this.xq||(C7(this),D7(this,a),x7(this))};
g.k.bQ=function(a){s7((0,g.Sa)(this.p_,this,a),0)};
g.k.p_=function(a){this.xq||(z7(this),this.Mm=a,this.j.eA(this),this.j.Pk(4))};
g.k.cancel=function(){this.xq=!0;z7(this)};
g.k.QS=function(){this.Ct=null;var a=Date.now();0<=a-this.gE?(2!=this.Bt&&this.j.Pk(3),z7(this),this.Bo=2,u7(18),A7(this)):u3a(this,this.gE-a)};
g.k.getLastError=function(){return this.Bo};g.k=x3a.prototype;g.k.iE=null;g.k.Mh=null;g.k.UC=!1;g.k.lR=null;g.k.hB=null;g.k.tH=null;g.k.jE=null;g.k.sj=null;g.k.Nm=-1;g.k.qw=null;g.k.ex=null;g.k.connect=function(a){this.jE=a;a=F7(this.j,null,this.jE);u7(3);this.lR=Date.now();var b=this.j.P;null!=b?(this.qw=b[0],(this.ex=b[1])?(this.sj=1,y3a(this)):(this.sj=2,H7(this))):(n6(a,"MODE","init"),this.Mh=new v7(this),this.Mh.yq=this.iE,w7(this.Mh,a,!1,null,!0),this.sj=0)};
g.k.hV=function(a){if(a)this.sj=2,H7(this);else{u7(4);var b=this.j;b.Dl=b.Ro.Nm;O7(b,9)}a&&this.Pk(2)};
g.k.hE=function(a){return this.j.hE(a)};
g.k.abort=function(){this.Mh&&(this.Mh.cancel(),this.Mh=null);this.Nm=-1};
g.k.Hf=function(){return!1};
g.k.HK=function(a,b){this.Nm=a.pw;if(0==this.sj)if(b){try{var c=this.u.parse(b)}catch(d){a=this.j;a.Dl=this.Nm;O7(a,2);return}this.qw=c[0];this.ex=c[1]}else a=this.j,a.Dl=this.Nm,O7(a,2);else if(2==this.sj)if(this.UC)u7(7),this.tH=Date.now();else if("11111"==b){if(u7(6),this.UC=!0,this.hB=Date.now(),a=this.hB-this.lR,!g.vc||g.sc(10)||500>a)this.Nm=200,this.Mh.cancel(),u7(12),G7(this.j,this,!0)}else u7(8),this.hB=this.tH=Date.now(),this.UC=!1};
g.k.eA=function(){this.Nm=this.Mh.pw;if(this.Mh.Mm)0==this.sj?this.ex?(this.sj=1,y3a(this)):(this.sj=2,H7(this)):2==this.sj&&((!g.vc||g.sc(10)?!this.UC:200>this.tH-this.hB)?(u7(11),G7(this.j,this,!1)):(u7(12),G7(this.j,this,!0)));else{0==this.sj?u7(9):2==this.sj&&u7(10);var a=this.j;this.Mh.getLastError();a.Dl=this.Nm;O7(a,2)}};
g.k.uw=function(){return this.j.uw()};
g.k.isActive=function(){return this.j.isActive()};
g.k.Pk=function(a){this.j.Pk(a)};g.k=I7.prototype;g.k.Cl=null;g.k.ww=null;g.k.ai=null;g.k.sf=null;g.k.kE=null;g.k.fA=null;g.k.IK=null;g.k.gA=null;g.k.xw=0;g.k.US=0;g.k.Ng=null;g.k.Do=null;g.k.Om=null;g.k.Bq=null;g.k.Ro=null;g.k.DD=null;g.k.Ft=-1;g.k.JK=-1;g.k.Dl=-1;g.k.Et=0;g.k.Dt=0;g.k.Aq=8;g.Wa(A3a,g.se);g.Wa(B3a,g.se);g.k=I7.prototype;g.k.connect=function(a,b,c,d,e){u7(0);this.kE=b;this.ww=c||{};d&&void 0!==e&&(this.ww.OSID=d,this.ww.OAID=e);this.J?(s7((0,g.Sa)(this.RM,this,a),100),C3a(this)):this.RM(a)};
g.k.disconnect=function(){D3a(this);if(3==this.j){var a=this.xw++,b=this.fA.clone();g.Ri(b,"SID",this.C);g.Ri(b,"RID",a);g.Ri(b,"TYPE","terminate");M7(this,b);a=new v7(this,this.C,a);a.Bt=2;a.Ao=m6(b.clone());C1a(new Image,a.Ao.toString());a.At=Date.now();x7(a)}L3a(this)};
g.k.RM=function(a){this.Ro=new x3a(this);this.Ro.iE=this.Cl;this.Ro.u=this.D;this.Ro.connect(a)};
g.k.Hf=function(){return 0==this.j};
g.k.getState=function(){return this.j};
g.k.LK=function(a){this.Do=null;H3a(this,a)};
g.k.KK=function(){this.Om=null;this.sf=new v7(this,this.C,"rpc",this.I);this.sf.yq=this.Cl;this.sf.fE=0;var a=this.IK.clone();g.Ri(a,"RID","rpc");g.Ri(a,"SID",this.C);g.Ri(a,"CI",this.DD?"0":"1");g.Ri(a,"AID",this.Ft);M7(this,a);if(!g.vc||g.sc(10))g.Ri(a,"TYPE","xmlhttp"),w7(this.sf,a,!0,this.gA,!1);else{g.Ri(a,"TYPE","html");var b=this.sf,c=!!this.gA;b.Bt=3;b.Ao=m6(a.clone());t3a(b,c)}};
g.k.HK=function(a,b){if(0!=this.j&&(this.sf==a||this.ai==a))if(this.Dl=a.pw,this.ai==a&&3==this.j)if(7<this.Aq){try{var c=this.D.parse(b)}catch(d){c=null}if(Array.isArray(c)&&3==c.length)if(a=c,0==a[0])a:{if(!this.Om){if(this.sf)if(this.sf.At+3E3<this.ai.At)K7(this),this.sf.cancel(),this.sf=null;else break a;N7(this);u7(19)}}else this.JK=a[1],0<this.JK-this.Ft&&37500>a[2]&&this.DD&&0==this.Dt&&!this.Bq&&(this.Bq=s7((0,g.Sa)(this.VS,this),6E3));else O7(this,11)}else null!=b&&O7(this,11);else if(this.sf==
a&&K7(this),!g.pb(b))for(a=this.D.parse(b),b=0;b<a.length;b++)c=a[b],this.Ft=c[0],c=c[1],2==this.j?"c"==c[0]?(this.C=c[1],this.gA=c[2],c=c[3],null!=c?this.Aq=c:this.Aq=6,this.j=3,this.Ng&&this.Ng.OK(),this.IK=F7(this,this.uw()?this.gA:null,this.kE),I3a(this)):"stop"==c[0]&&O7(this,7):3==this.j&&("stop"==c[0]?O7(this,7):"noop"!=c[0]&&this.Ng&&this.Ng.NK(c),this.Dt=0)};
g.k.VS=function(){null!=this.Bq&&(this.Bq=null,this.sf.cancel(),this.sf=null,N7(this),u7(20))};
g.k.eA=function(a){if(this.sf==a){K7(this);this.sf=null;var b=2}else if(this.ai==a)this.ai=null,b=1;else return;this.Dl=a.pw;if(0!=this.j)if(a.Mm)if(1==b){b=Date.now()-a.At;var c=t7;c.dispatchEvent(new A3a(c,a.zq?a.zq.length:0,b,this.Et));J7(this);this.B.length=0}else I3a(this);else{c=a.getLastError();var d;if(!(d=3==c||7==c||0==c&&0<this.Dl)){if(d=1==b)this.ai||this.Do||1==this.j||2<=this.Et?d=!1:(this.Do=s7((0,g.Sa)(this.LK,this,a),J3a(this,this.Et)),this.Et++,d=!0);d=!(d||2==b&&N7(this))}if(d)switch(c){case 1:O7(this,
5);break;case 4:O7(this,10);break;case 3:O7(this,6);break;case 7:O7(this,12);break;default:O7(this,2)}}};
g.k.SS=function(a){if(!g.Ub(arguments,this.j))throw Error("Unexpected channel state: "+this.j);};
g.k.G0=function(a){a?u7(2):(u7(1),K3a(this,8))};
g.k.hE=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new g.Hh;a.J=!1;return a};
g.k.isActive=function(){return!!this.Ng&&this.Ng.isActive(this)};
g.k.Pk=function(a){var b=t7;b.dispatchEvent(new B3a(b,a))};
g.k.uw=function(){return!(!g.vc||g.sc(10))};
g.k=M3a.prototype;g.k.OK=function(){};
g.k.NK=function(){};
g.k.MK=function(){};
g.k.lE=function(){};
g.k.PK=function(){return{}};
g.k.isActive=function(){return!0};g.k=N3a.prototype;g.k.enqueue=function(a){this.u.push(a)};
g.k.isEmpty=function(){return 0===this.j.length&&0===this.u.length};
g.k.clear=function(){this.j=[];this.u=[]};
g.k.contains=function(a){return g.Ub(this.j,a)||g.Ub(this.u,a)};
g.k.remove=function(a){var b=this.j;var c=(0,g.tTa)(b,a);0<=c?(g.Wb(b,c),b=!0):b=!1;return b||g.Yb(this.u,a)};
g.k.Dj=function(){for(var a=[],b=this.j.length-1;0<=b;--b)a.push(this.j[b]);var c=this.u.length;for(b=0;b<c;++b)a.push(this.u[b]);return a};O3a.prototype.flush=function(a,b){a=void 0===a?[]:a;b=void 0===b?!1:b;if(g.Q("enable_client_streamz_web")){a=g.r(a);for(var c=a.next();!c.done;c=a.next())c=g.Oda(c.value),c={serializedIncrementBatch:g.tc(g.de(c,K5a))},g.kr("streamzIncremented",c,{eJ:b})}};var P7;g.w(Q7,g.se);g.w(R7,g.se);g.Wa(S7,g.I);g.k=S7.prototype;g.k.j_=function(){this.Ug=Math.min(3E5,2*this.Ug);this.B();this.u&&this.start()};
g.k.start=function(){var a=this.Ug+15E3*Math.random();g.xn(this.j,a);this.u=Date.now()+a};
g.k.stop=function(){this.j.stop();this.u=0};
g.k.isActive=function(){return this.j.isActive()};
g.k.reset=function(){this.j.stop();this.Ug=5E3};g.Wa(T7,M3a);g.k=T7.prototype;g.k.subscribe=function(a,b,c){return this.B.subscribe(a,b,c)};
g.k.unsubscribe=function(a,b,c){return this.B.unsubscribe(a,b,c)};
g.k.pg=function(a){return this.B.pg(a)};
g.k.W=function(a,b){return this.B.W.apply(this.B,arguments)};
g.k.dispose=function(){this.V||(this.V=!0,g.ne(this.B),this.disconnect(),g.ne(this.u),this.u=null,this.ea=function(){return""})};
g.k.isDisposed=function(){return this.V};
g.k.connect=function(a,b,c){if(!this.j||2!=this.j.getState()){this.U="";this.u.stop();this.I=a||null;this.D=b||0;a=this.Z+"/test";b=this.Z+"/bind";var d=new I7(c?c.firstTestResults:null,c?c.secondTestResults:null,this.Ja),e=this.j;e&&(e.Ng=null);d.Ng=this;this.j=d;U7(this);if(this.j){d=g.P("ID_TOKEN");var f=this.j.Cl||{};d?f["x-youtube-identity-token"]=d:delete f["x-youtube-identity-token"];this.j.Cl=f}e?(3!=e.getState()&&0==F3a(e)||e.getState(),this.j.connect(a,b,this.J,e.C,e.Ft)):c?this.j.connect(a,
b,this.J,c.sessionId,c.arrayId):this.j.connect(a,b,this.J)}};
g.k.disconnect=function(a){this.P=a||0;this.u.stop();U7(this);this.j&&(3==this.j.getState()&&H3a(this.j),this.j.disconnect());this.P=0};
g.k.sendMessage=function(a,b){a={_sc:a};b&&g.Qe(a,b);this.u.isActive()||2==(this.j?this.j.getState():0)?this.C.push(a):this.Nu()&&(U7(this),E3a(this.j,a))};
g.k.OK=function(){this.u.reset();this.I=null;this.D=0;if(this.C.length){var a=this.C;this.C=[];for(var b=0,c=a.length;b<c;++b)E3a(this.j,a[b])}this.W("handlerOpened");r2a(this.Ga,"BROWSER_CHANNEL")};
g.k.MK=function(a){var b=2==a&&401==this.j.Dl;4==a||b||this.u.start();this.W("handlerError",a,b);x2a(this.xa,"BROWSER_CHANNEL")};
g.k.lE=function(a,b){if(!this.u.isActive())this.W("handlerClosed");else if(b)for(var c=0,d=b.length;c<d;++c){var e=b[c].map;e&&this.C.push(e)}t2a(this.ma,"BROWSER_CHANNEL");a&&this.Qa.j.oE("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps",a.length);b&&this.Ra.j.oE("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps",b.length)};
g.k.PK=function(){var a={v:2};this.U&&(a.gsessionid=this.U);0!=this.D&&(a.ui=""+this.D);0!=this.P&&(a.ui=""+this.P);this.I&&g.Qe(a,this.I);return a};
g.k.NK=function(a){"S"==a[0]?this.U=a[1]:"gracefulReconnect"==a[0]?(this.u.start(),this.j.disconnect()):this.W("handlerMessage",new P3a(a[0],a[1]));v2a(this.Ca,"BROWSER_CHANNEL")};
g.k.Nu=function(){return!!this.j&&3==this.j.getState()};
g.k.Zn=function(a){(this.J.loungeIdToken=a)||this.u.stop();if(this.Pa&&this.j){var b=this.j.Cl||{};a?b["X-YouTube-LoungeId-Token"]=a:delete b["X-YouTube-LoungeId-Token"];this.j.Cl=b}};
g.k.ip=function(){return this.J.id};
g.k.tp=function(){return this.u.isActive()?this.u.u-Date.now():NaN};
g.k.Bs=function(){var a=this.u;g.yn(a.j);a.start()};
g.k.j0=function(){this.u.isActive();0==F3a(this.j)&&this.connect(this.I,this.D)};V7.prototype.C=function(a,b,c,d){b?a(d):a({text:c.responseText})};
V7.prototype.B=function(a,b){a(Error("Request error: "+b.status))};
V7.prototype.D=function(a){a(Error("request timed out"))};g.w(Y7,g.bf);g.k=Y7.prototype;g.k.connect=function(a,b,c){this.Lc.connect(a,b,c)};
g.k.disconnect=function(a){this.Lc.disconnect(a)};
g.k.Bs=function(){this.Lc.Bs()};
g.k.ip=function(){return this.Lc.ip()};
g.k.tp=function(){return this.Lc.tp()};
g.k.Nu=function(){return this.Lc.Nu()};
g.k.YS=function(){this.dispatchEvent("channelOpened");var a=this.Lc,b=this.j;g.Su("yt-remote-session-browser-channel",{firstTestResults:[""],secondTestResults:!a.j.DD,sessionId:a.j.C,arrayId:a.j.Ft});g.Su("yt-remote-session-screen-id",b);a=z6();b=B6();g.Ub(a,b)||a.push(b);a2a(a);C6()};
g.k.WS=function(){this.dispatchEvent("channelClosed")};
g.k.XS=function(a){this.dispatchEvent(new Q7(a))};
g.k.onError=function(a){this.dispatchEvent(new R7(a?1:0))};
g.k.sendMessage=function(a,b){this.Lc.sendMessage(a,b)};
g.k.Zn=function(a){this.Lc.Zn(a)};
g.k.dispose=function(){this.Lc.dispose()};g.k=Q3a.prototype;
g.k.connect=function(a,b){a=void 0===a?{}:a;b=void 0===b?0:b;2!==this.I&&(this.B.stop(),this.P=a,this.J=b,Z7(this),(a=g.P("ID_TOKEN"))?this.C["x-youtube-identity-token"]=a:delete this.C["x-youtube-identity-token"],this.j&&(this.u.device=this.j.device,this.u.name=this.j.name,this.u.app=this.j.app,this.u.id=this.j.id,this.j.mX&&(this.u.mdxVersion=""+this.j.mX),this.j.theme&&(this.u.theme=this.j.theme),this.j.capabilities&&(this.u.capabilities=this.j.capabilities)),0!==this.J?this.u.ui=""+this.J:delete this.u.ui,
Object.assign(this.u,this.P),this.channel=new r7(this.pathPrefix,{KW:"gsessionid",pX:this.C,qX:this.u}),this.channel.open(),this.I=2,R3a(this))};
g.k.disconnect=function(a){this.U=void 0===a?0:a;this.B.stop();Z7(this);this.channel&&(0!==this.U?this.u.ui=""+this.U:delete this.u.ui,this.channel.close());this.U=0};
g.k.tp=function(){return this.B.isActive()?this.B.u-Date.now():NaN};
g.k.Bs=function(){var a=this.B;g.yn(a.j);a.start()};
g.k.sendMessage=function(a,b){this.channel&&(Z7(this),a=Object.assign({},{_sc:a},b),this.channel.send(a))};
g.k.Zn=function(a){a||this.B.stop();a?this.C["X-YouTube-LoungeId-Token"]=a:delete this.C["X-YouTube-LoungeId-Token"]};
g.k.ip=function(){return this.j?this.j.id:""};
g.k.W=function(a){return this.D.W.apply(this.D,[a].concat(g.v(g.Ea.apply(1,arguments))))};
g.k.subscribe=function(a,b,c){return this.D.subscribe(a,b,c)};
g.k.unsubscribe=function(a,b,c){return this.D.unsubscribe(a,b,c)};
g.k.pg=function(a){return this.D.pg(a)};
g.k.dispose=function(){this.V||(this.V=!0,g.ne(this.D),this.disconnect(),g.ne(this.B),this.ma=function(){return""})};
g.k.isDisposed=function(){return this.V};g.w($7,g.bf);g.k=$7.prototype;g.k.connect=function(a,b){this.j.connect(a,b)};
g.k.disconnect=function(a){this.j.disconnect(a)};
g.k.Bs=function(){this.j.Bs()};
g.k.ip=function(){return this.j.ip()};
g.k.tp=function(){return this.j.tp()};
g.k.Nu=function(){return 3===this.j.I};
g.k.bT=function(){this.dispatchEvent("channelOpened")};
g.k.ZS=function(){this.dispatchEvent("channelClosed")};
g.k.aT=function(a){this.dispatchEvent(new Q7(a))};
g.k.onError=function(){this.dispatchEvent(new R7(401===this.j.ea?1:0))};
g.k.sendMessage=function(a,b){this.j.sendMessage(a,b)};
g.k.Zn=function(a){this.j.Zn(a)};
g.k.dispose=function(){this.j.dispose()};var Z3a=Date.now(),a8=null,e8=Array(50),d8=-1,f8=!1;g.Wa(g8,g.bu);g8.prototype.Ti=function(){return this.screens};
g8.prototype.contains=function(a){return!!x6(this.screens,a)};
g8.prototype.get=function(a){return a?y6(this.screens,a):null};
g8.prototype.info=function(a){b8(this.I,a)};g.w(h8,g.bu);g.k=h8.prototype;g.k.start=function(){!this.j&&isNaN(this.kc)&&this.pQ()};
g.k.stop=function(){this.j&&(this.j.abort(),this.j=null);isNaN(this.kc)||(g.bq(this.kc),this.kc=NaN)};
g.k.Y=function(){this.stop();g.bu.prototype.Y.call(this)};
g.k.pQ=function(){this.kc=NaN;this.j=g.eq(W7(this.B,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.J},timeout:5E3,onSuccess:(0,g.Sa)(this.dT,this),onError:(0,g.Sa)(this.cT,this),onTimeout:(0,g.Sa)(this.eT,this)})};
g.k.dT=function(a,b){this.j=null;a=b.screen||{};a.dialId=this.C;a.name=this.I;b=-1;this.D&&a.shortLivedLoungeToken&&a.shortLivedLoungeToken.value&&a.shortLivedLoungeToken.refreshIntervalMs&&(a.screenIdType="shortLived",a.loungeToken=a.shortLivedLoungeToken.value,b=a.shortLivedLoungeToken.refreshIntervalMs);this.W("pairingComplete",new s6(a),b)};
g.k.cT=function(a){this.j=null;a.status&&404==a.status?this.u>=L5a.length?this.W("pairingFailed",Error("DIAL polling timed out")):(a=L5a[this.u],this.kc=g.$p((0,g.Sa)(this.pQ,this),a),this.u++):this.W("pairingFailed",Error("Server error "+a.status))};
g.k.eT=function(){this.j=null;this.W("pairingFailed",Error("Server not responding"))};
var L5a=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.Wa(j8,g8);g.k=j8.prototype;g.k.start=function(){i8(this)&&this.W("screenChange");!g.Tu("yt-remote-lounge-token-expiration")&&c4a(this);g.bq(this.j);this.j=g.$p((0,g.Sa)(this.start,this),1E4)};
g.k.add=function(a,b){i8(this);$3a(this,a);k8(this,!1);this.W("screenChange");b(a);a.token||c4a(this)};
g.k.remove=function(a,b){var c=i8(this);b4a(this,a)&&(k8(this,!1),c=!0);b(a);c&&this.W("screenChange")};
g.k.BD=function(a,b,c,d){var e=i8(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,k8(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.W("screenChange")};
g.k.Y=function(){g.bq(this.j);j8.Ee.Y.call(this)};
g.k.iW=function(a){i8(this);var b=this.screens.length;a=a&&a.screens||[];for(var c=0,d=a.length;c<d;++c){var e=a[c],f=this.get(e.screenId);f&&(f.token=e.loungeToken,--b)}k8(this,!b);b&&b8(this.I,"Missed "+b+" lounge tokens.")};
g.k.hW=function(a){b8(this.I,"Requesting lounge tokens failed: "+a)};g.w(m8,g.bu);g.k=m8.prototype;g.k.start=function(){var a=parseInt(g.Tu("yt-remote-fast-check-period")||"0",10);(this.C=g.Va()-144E5<a?0:a)?p8(this):(this.C=g.Va()+3E5,g.Su("yt-remote-fast-check-period",this.C),this.RI())};
g.k.isEmpty=function(){return g.Je(this.j)};
g.k.update=function(){l8("Updating availability on schedule.");var a=this.I(),b=g.Ae(this.j,function(c,d){return c&&!!y6(a,d)},this);
o8(this,b)};
g.k.Y=function(){g.bq(this.B);this.B=NaN;this.u&&(this.u.abort(),this.u=null);g.bu.prototype.Y.call(this)};
g.k.RI=function(){g.bq(this.B);this.B=NaN;this.u&&this.u.abort();var a=e4a(this);if(o6(a)){var b=W7(this.D,"/pairing/get_screen_availability");this.u=X7(this.D,b,{lounge_token:g.Fe(a).join(",")},(0,g.Sa)(this.PZ,this,a),(0,g.Sa)(this.OZ,this))}else o8(this,{}),p8(this)};
g.k.PZ=function(a,b){this.u=null;var c=g.Fe(e4a(this));if(g.kc(c,g.Fe(a))){b=b.screens||[];c={};for(var d=0,e=b.length;d<e;++d)c[a[b[d].loungeToken]]="online"==b[d].status;o8(this,c);p8(this)}else this.Re("Changing Screen set during request."),this.RI()};
g.k.OZ=function(a){this.Re("Screen availability failed: "+a);this.u=null;p8(this)};
g.k.Re=function(a){b8("OnlineScreenService",a)};g.Wa(q8,g8);g.k=q8.prototype;g.k.start=function(){this.u.start();this.j.start();this.screens.length&&(this.W("screenChange"),this.j.isEmpty()||this.W("onlineScreenChange"))};
g.k.add=function(a,b,c){this.u.add(a,b,c)};
g.k.remove=function(a,b,c){this.u.remove(a,b,c);this.j.update()};
g.k.BD=function(a,b,c,d){this.u.contains(a)?this.u.BD(a,b,c,d):(a="Updating name of unknown screen: "+a.name,b8(this.I,a),d(Error(a)))};
g.k.Ti=function(a){return a?this.screens:g.ac(this.screens,g.Ll(this.B,function(b){return!this.contains(b)},this))};
g.k.QK=function(){return g.Ll(this.Ti(!0),function(a){return!!this.j.j[a.id]},this)};
g.k.RK=function(a,b,c,d,e,f){var h=this;this.info("getDialScreenByPairingCode "+a+" / "+b);var l=new h8(this.C,a,b,c,d);l.subscribe("pairingComplete",function(m,n){g.ne(l);e(r8(h,m),n)});
l.subscribe("pairingFailed",function(m){g.ne(l);f(m)});
l.start();return(0,g.Sa)(l.stop,l)};
g.k.fT=function(a,b,c,d){g.eq(W7(this.C,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:a},timeout:5E3,onSuccess:(0,g.Sa)(function(e,f){e=new s6(f.screen||{});if(!e.name||i4a(this,e.name)){a:{f=e.name;for(var h=2,l=b(f,h);i4a(this,l);){h++;if(20<h)break a;l=b(f,h)}f=l}e.name=f}c(r8(this,e))},this),
onError:(0,g.Sa)(function(e){d(Error("pairing request failed: "+e.status))},this),
onTimeout:(0,g.Sa)(function(){d(Error("pairing request timed out."))},this)})};
g.k.Y=function(){g.ne(this.u);g.ne(this.j);q8.Ee.Y.call(this)};
g.k.rW=function(){k4a(this);this.W("screenChange");this.j.update()};
q8.prototype.dispose=q8.prototype.dispose;g.Wa(t8,g.bu);g.k=t8.prototype;g.k.getScreen=function(){return this.C};
g.k.Ch=function(a){this.isDisposed()||(a&&(v8(this,""+a),this.W("sessionFailed")),this.C=null,this.W("sessionScreen",null))};
g.k.info=function(a){b8(this.xa,a)};
g.k.SK=function(){return null};
g.k.iJ=function(a){var b=this.j;a?(b.displayStatus=new chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;chrome.cast.setReceiverDisplayStatus(b,(0,g.Sa)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.Sa)(function(){v8(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.k.Y=function(){this.iJ("");t8.Ee.Y.call(this)};g.w(w8,t8);g.k=w8.prototype;g.k.hJ=function(a){if(this.u){if(this.u==a)return;v8(this,"Overriding cast session with new session object");t4a(this);this.Z=!1;this.U="unknown";this.u.removeUpdateListener(this.ea);this.u.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.ma)}this.u=a;this.u.addUpdateListener(this.ea);this.u.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.ma);p4a(this,"getMdxSessionStatus")};
g.k.Vu=function(a){this.info("launchWithParams no-op for Cast: "+g.lh(a))};
g.k.stop=function(){this.u?this.u.stop((0,g.Sa)(function(){this.Ch()},this),(0,g.Sa)(function(){this.Ch(Error("Failed to stop receiver app."))},this)):this.Ch(Error("Stopping cast device without session."))};
g.k.iJ=function(){};
g.k.Y=function(){this.info("disposeInternal");t4a(this);this.u&&(this.u.removeUpdateListener(this.ea),this.u.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.ma));this.u=null;t8.prototype.Y.call(this)};
g.k.B_=function(a,b){if(!this.isDisposed())if(b)if(b=p6(b),g.Pa(b))switch(a=""+b.type,b=b.data||{},this.info("onYoutubeMessage_: "+a+" "+g.lh(b)),a){case "mdxSessionStatus":n4a(this,b);break;case "loungeToken":q4a(this,b);break;default:v8(this,"Unknown youtube message: "+a)}else v8(this,"Unable to parse message.");else v8(this,"No data in message.")};
g.k.KN=function(a,b,c,d){g.bq(this.P);this.P=0;h4a(this.B,this.j.label,a,this.j.friendlyName,(0,g.Sa)(function(e){e?b(e):0<=d?(v8(this,"Screen "+a+" appears to be offline. "+d+" retries left."),this.P=g.$p((0,g.Sa)(this.KN,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.k.SK=function(){return this.u};
g.k.gT=function(a){this.isDisposed()||a||(v8(this,"Cast session died."),this.Ch())};g.w(z8,t8);g.k=z8.prototype;g.k.hJ=function(a){this.u=a;this.u.addUpdateListener(this.Ca)};
g.k.Vu=function(a){this.Ga=a;this.V()};
g.k.stop=function(){A4a(this);this.u?this.u.stop((0,g.Sa)(this.Ch,this,null),(0,g.Sa)(this.Ch,this,"Failed to stop DIAL device.")):this.Ch()};
g.k.Y=function(){A4a(this);this.u&&this.u.removeUpdateListener(this.Ca);this.u=null;t8.prototype.Y.call(this)};
g.k.hT=function(a){this.isDisposed()||a||(v8(this,"DIAL session died."),this.D(),this.D=function(){},this.Ch())};g.w(D8,t8);D8.prototype.stop=function(){this.Ch()};
D8.prototype.hJ=function(){};
D8.prototype.Vu=function(){g.bq(this.u);this.u=NaN;var a=y6(this.B.Ti(),this.j.label);a?u8(this,a):this.Ch(Error("No such screen"))};
D8.prototype.Y=function(){g.bq(this.u);this.u=NaN;t8.prototype.Y.call(this)};g.w(E8,g.bu);g.k=E8.prototype;
g.k.init=function(a,b){chrome.cast.timeout.requestSession=3E4;var c=new chrome.cast.SessionRequest(this.P,[chrome.cast.Capability.AUDIO_OUT]);this.U||(c.dialRequest=new chrome.cast.DialRequest("YouTube"));var d=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;a=a||this.I?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var e=(0,g.Sa)(this.AZ,this);c=new chrome.cast.ApiConfig(c,(0,g.Sa)(this.XP,this),e,d,a);c.customDialLaunchCallback=(0,g.Sa)(this.vY,this);
chrome.cast.initialize(c,(0,g.Sa)(function(){this.isDisposed()||(chrome.cast.addReceiverActionListener(this.D),W3a(),this.u.subscribe("onlineScreenChange",(0,g.Sa)(this.TK,this)),this.B=D4a(this),chrome.cast.setCustomReceivers(this.B,function(){},(0,g.Sa)(function(f){this.Re("Failed to set initial custom receivers: "+g.lh(f))},this)),this.W("yt-remote-cast2-availability-change",G8(this)),b(!0))},this),(0,g.Sa)(function(f){this.Re("Failed to initialize API: "+g.lh(f));
b(!1)},this))};
g.k.n0=function(a,b){F8("Setting connected screen ID: "+a+" -> "+b);if(this.j){var c=this.j.getScreen();if(!a||c&&c.id!=a)F8("Unsetting old screen status: "+this.j.j.friendlyName),H8(this,null)}if(a&&b){if(!this.j){c=y6(this.u.Ti(),a);if(!c){F8("setConnectedScreenStatus: Unknown screen.");return}if("shortLived"==c.idType){F8("setConnectedScreenStatus: Screen with id type to be short lived.");return}a=B4a(this,c);a||(F8("setConnectedScreenStatus: Connected receiver not custom..."),a=new chrome.cast.Receiver(c.uuid?
c.uuid:c.id,c.name),a.receiverType=chrome.cast.ReceiverType.CUSTOM,this.B.push(a),chrome.cast.setCustomReceivers(this.B,function(){},(0,g.Sa)(function(d){this.Re("Failed to set initial custom receivers: "+g.lh(d))},this)));
F8("setConnectedScreenStatus: new active receiver: "+a.friendlyName);H8(this,new D8(this.u,a),!0)}this.j.iJ(b)}else F8("setConnectedScreenStatus: no screen.")};
g.k.o0=function(a){this.isDisposed()?this.Re("Setting connection data on disposed cast v2"):this.j?this.j.Vu(a):this.Re("Setting connection data without a session")};
g.k.jT=function(){this.isDisposed()?this.Re("Stopping session on disposed cast v2"):this.j?(this.j.stop(),H8(this,null)):F8("Stopping non-existing session")};
g.k.requestSession=function(){chrome.cast.requestSession((0,g.Sa)(this.XP,this),(0,g.Sa)(this.SZ,this))};
g.k.Y=function(){this.u.unsubscribe("onlineScreenChange",(0,g.Sa)(this.TK,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.D);var a=T3a,b=g.La("yt.mdx.remote.debug.handlers_");g.Yb(b||[],a);g.ne(this.j);g.bu.prototype.Y.call(this)};
g.k.Re=function(a){b8("Controller",a)};
g.k.ZP=function(a,b){this.j==a&&(b||H8(this,null),this.W("yt-remote-cast2-session-change",b))};
g.k.xZ=function(a,b){if(!this.isDisposed())if(a)switch(a.friendlyName=chrome.cast.unescape(a.friendlyName),F8("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case chrome.cast.ReceiverAction.CAST:if(this.j)if(this.j.j.label!=a.label)F8("onReceiverAction_: Stopping active receiver: "+this.j.j.friendlyName),this.j.stop();else{F8("onReceiverAction_: Casting to active receiver.");this.j.getScreen()&&this.W("yt-remote-cast2-session-change",this.j.getScreen());break}switch(a.receiverType){case chrome.cast.ReceiverType.CUSTOM:H8(this,
new D8(this.u,a));break;case chrome.cast.ReceiverType.DIAL:H8(this,new z8(this.u,a,this.C,this.config_));break;case chrome.cast.ReceiverType.CAST:H8(this,new w8(this.u,a,this.config_));break;default:this.Re("Unknown receiver type: "+a.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.j&&this.j.j.label==a.label?this.j.stop():this.Re("Stopping receiver w/o session: "+a.friendlyName)}else this.Re("onReceiverAction_ called without receiver.")};
g.k.vY=function(a){if(this.isDisposed())return Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.Re("Not DIAL receiver: "+b.friendlyName),b.receiverType=chrome.cast.ReceiverType.DIAL);var c=this.j?this.j.j:null;if(!c||c.label!=b.label)return this.Re("Receiving DIAL launch request for non-clicked DIAL receiver: "+b.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(c&&c.label==b.label&&c.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.j.getScreen())return F8("Reselecting dial screen."),
this.W("yt-remote-cast2-session-change",this.j.getScreen()),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.Re('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);H8(this,new z8(this.u,b,this.C,this.config_))}b=this.j;b.P=a;b.P.appState==chrome.cast.DialAppState.RUNNING?(a=b.P.extraData||{},c=a.screenId||null,A8(b)&&a.loungeToken?a.loungeTokenRefreshIntervalMs?a=x4a(b,{name:b.j.friendlyName,screenId:a.screenId,loungeToken:a.loungeToken,dialId:b.P.receiver.label,
screenIdType:"shortLived"},a.loungeTokenRefreshIntervalMs):(g.Kp(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(a)+".")),a=y4a(b,c)):a=y4a(b,c)):a=C8(b);return a};
g.k.XP=function(a){var b=this;if(!this.isDisposed()&&!this.I){F8("New cast session ID: "+a.sessionId);var c=a.receiver;if(c.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.j)if(c.receiverType==chrome.cast.ReceiverType.CAST)F8("Got resumed cast session before resumed mdx connection."),c.friendlyName=chrome.cast.unescape(c.friendlyName),H8(this,new w8(this.u,c,this.config_),!0);else{this.Re("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var d=this.j.j,e=y6(this.u.Ti(),
d.label);e&&t6(e,c.label)&&d.receiverType!=chrome.cast.ReceiverType.CAST&&c.receiverType==chrome.cast.ReceiverType.CAST&&(F8("onSessionEstablished_: manual to cast session change "+c.friendlyName),g.ne(this.j),this.j=new w8(this.u,c,this.config_),this.j.subscribe("sessionScreen",(0,g.Sa)(this.ZP,this,this.j)),this.j.subscribe("sessionFailed",function(){return C4a(b,b.j)}),this.j.Vu(null));
this.j.hJ(a)}}};
g.k.iT=function(){return this.j?this.j.SK():null};
g.k.SZ=function(a){this.isDisposed()||(this.Re("Failed to estabilish a session: "+g.lh(a)),a.code!=chrome.cast.ErrorCode.CANCEL&&H8(this,null),this.W("yt-remote-cast2-session-failed"))};
g.k.AZ=function(a){F8("Receiver availability updated: "+a);if(!this.isDisposed()){var b=G8(this);this.J=a==chrome.cast.ReceiverAvailability.AVAILABLE;G8(this)!=b&&this.W("yt-remote-cast2-availability-change",G8(this))}};
g.k.TK=function(){this.isDisposed()||(this.B=D4a(this),F8("Updating custom receivers: "+g.lh(this.B)),chrome.cast.setCustomReceivers(this.B,function(){},(0,g.Sa)(function(){this.Re("Failed to set custom receivers.")},this)),this.W("yt-remote-cast2-availability-change",G8(this)))};
E8.prototype.setLaunchParams=E8.prototype.o0;E8.prototype.setConnectedScreenStatus=E8.prototype.n0;E8.prototype.stopSession=E8.prototype.jT;E8.prototype.getCastSession=E8.prototype.iT;E8.prototype.requestSession=E8.prototype.requestSession;E8.prototype.init=E8.prototype.init;E8.prototype.dispose=E8.prototype.dispose;var N8=[];g.k=S8.prototype;
g.k.reset=function(a){this.listId="";this.index=-1;this.videoId="";T8(this);this.volume=-1;this.muted=!1;a&&(this.index=a.index,this.listId=a.listId,this.videoId=a.videoId,this.playerState=a.playerState,this.volume=a.volume,this.muted=a.muted,this.audioTrackId=a.audioTrackId,this.trackData=a.trackData,this.lm=a.hasPrevious,this.hasNext=a.hasNext,this.J=a.playerTime,this.I=a.playerTimeAt,this.C=a.seekableStart,this.j=a.seekableEnd,this.D=a.duration,this.P=a.loadedTime,this.B=a.liveIngestionTime,this.u=
!isNaN(this.B))};
g.k.isPlaying=function(){return 1==this.playerState};
g.k.isAdPlaying=function(){return 1081==this.playerState};
g.k.Wk=function(a){this.D=isNaN(a)?0:a};
g.k.getDuration=function(){return this.u?this.D+U8(this):this.D};
g.k.clone=function(){return new S8(Y8(this))};g.w($8,g.bu);g.k=$8.prototype;g.k.getState=function(){return this.B};
g.k.tp=function(){return this.C.getReconnectTimeout()};
g.k.Bs=function(){this.C.reconnect()};
g.k.play=function(){b9(this)?(this.j?this.j.play(null,g.ff,g9(this,"play")):f9(this,"play"),e9(this,1,W8(a9(this))),this.W("remotePlayerChange")):c9(this,this.play)};
g.k.pause=function(){b9(this)?(this.j?this.j.pause(null,g.ff,g9(this,"pause")):f9(this,"pause"),e9(this,2,W8(a9(this))),this.W("remotePlayerChange")):c9(this,this.pause)};
g.k.seekTo=function(a){if(b9(this)){if(this.j){var b=a9(this),c=new chrome.cast.media.SeekRequest;c.currentTime=a;b.isPlaying()||3==b.playerState?c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.j.seek(c,g.ff,g9(this,"seekTo",{newTime:a}))}else f9(this,"seekTo",{newTime:a});e9(this,3,a);this.W("remotePlayerChange")}else c9(this,g.Ta(this.seekTo,a))};
g.k.stop=function(){if(b9(this)){this.j?this.j.stop(null,g.ff,g9(this,"stopVideo")):f9(this,"stopVideo");var a=a9(this);a.index=-1;a.videoId="";T8(a);d9(this,a);this.W("remotePlayerChange")}else c9(this,this.stop)};
g.k.setVolume=function(a,b){if(b9(this)){var c=a9(this);if(this.u){if(c.volume!=a){var d=Math.round(a)/100;this.u.setReceiverVolumeLevel(d,(0,g.Sa)(function(){c8("set receiver volume: "+d)},this),(0,g.Sa)(function(){this.Re("failed to set receiver volume.")},this))}c.muted!=b&&this.u.setReceiverMuted(b,(0,g.Sa)(function(){c8("set receiver muted: "+b)},this),(0,g.Sa)(function(){this.Re("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);f9(this,"setVolume",e)}c.muted=b;c.volume=a;d9(this,c)}else c9(this,g.Ta(this.setVolume,a,b))};
g.k.UK=function(a,b){if(b9(this)){var c=a9(this);a={videoId:a};b&&(c.trackData={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,kind:b.kind},a.style=g.lh(b.style),g.Qe(a,c.trackData));f9(this,"setSubtitlesTrack",a);d9(this,c)}else c9(this,g.Ta(this.UK,a,b))};
g.k.setAudioTrack=function(a,b){b9(this)?(b=b.getLanguageInfo().getId(),f9(this,"setAudioTrack",{videoId:a,audioTrackId:b}),a=a9(this),a.audioTrackId=b,d9(this,a)):c9(this,g.Ta(this.setAudioTrack,a,b))};
g.k.playVideo=function(a,b,c,d,e,f,h){d=void 0===d?null:d;e=void 0===e?null:e;f=void 0===f?null:f;h=void 0===h?null:h;var l=a9(this),m={videoId:a};void 0!==c&&(m.currentIndex=c);X8(l,a,c||0);void 0!==b&&(V8(l,b),m.currentTime=b);d&&(m.listId=d);e&&(m.playerParams=e);f&&(m.clickTrackingParams=f);h&&(m.locationInfo=g.lh(h));f9(this,"setPlaylist",m);d||d9(this,l)};
g.k.NC=function(a,b){if(b9(this)){if(a&&b){var c=a9(this);X8(c,a,b);d9(this,c)}f9(this,"previous")}else c9(this,g.Ta(this.NC,a,b))};
g.k.nextVideo=function(a,b){if(b9(this)){if(a&&b){var c=a9(this);X8(c,a,b);d9(this,c)}f9(this,"next")}else c9(this,g.Ta(this.nextVideo,a,b))};
g.k.Wt=function(){if(b9(this)){f9(this,"clearPlaylist");var a=a9(this);a.reset();d9(this,a);this.W("remotePlayerChange")}else c9(this,this.Wt)};
g.k.eN=function(){b9(this)?f9(this,"dismissAutoplay"):c9(this,this.eN)};
g.k.dispose=function(){if(3!=this.B){var a=this.B;this.B=3;this.W("proxyStateChange",a,this.B)}g.bu.prototype.dispose.call(this)};
g.k.Y=function(){P4a(this);this.C=null;this.D.clear();Z8(this,null);g.bu.prototype.Y.call(this)};
g.k.kJ=function(a){if((a!=this.B||2==a)&&3!=this.B&&0!=a){var b=this.B;this.B=a;this.W("proxyStateChange",b,a);if(1==a)for(;!this.D.isEmpty();)b=a=this.D,0===b.j.length&&(b.j=b.u,b.j.reverse(),b.u=[]),a.j.pop().apply(this);else 3==a&&this.dispose()}};
g.k.vZ=function(a,b){this.W(a,b)};
g.k.jY=function(a){if(!a)this.Oy(null),Z8(this,null);else if(this.u.receiver.volume){a=this.u.receiver.volume;var b=a9(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)c8("Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,d9(this,b)}};
g.k.Oy=function(a){c8("Cast media: "+!!a);this.j&&this.j.removeUpdateListener(this.P);if(this.j=a)this.j.addUpdateListener(this.P),Q4a(this),this.W("remotePlayerChange")};
g.k.iY=function(a){a?(Q4a(this),this.W("remotePlayerChange")):this.Oy(null)};
g.k.HJ=function(){f9(this,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.k.mY=function(){var a=M4a();a&&Z8(this,a)};
g.k.Re=function(a){b8("CP",a)};g.w(j9,g.bu);g.k=j9.prototype;
g.k.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.videoIds,f=b.playerParams,h=b.clickTrackingParams,l=b.index,m={videoId:d},n=b.currentTime,p=b.locationInfo;b=b.loopMode;void 0!==n&&(m.currentTime=5>=n?0:n);f&&(m.playerParams=f);p&&(m.locationInfo=p);h&&(m.clickTrackingParams=h);c&&(m.listId=c);e&&0<e.length&&(m.videoIds=e.join(","));void 0!==l&&(m.currentIndex=l);this.Ca&&(m.loopMode=b||"LOOP_MODE_OFF");c&&(this.j.listId=c);this.j.videoId=d;this.j.index=l||0;this.j.state=3;V8(this.j,
n);this.D="UNSUPPORTED";c=this.Ca?"setInitialState":"setPlaylist";h9("Connecting with "+c+" and params: "+g.lh(m));this.u.connect({method:c,params:g.lh(m)},a,b2a())}else h9("Connecting without params"),this.u.connect({},a,b2a());U4a(this)};
g.k.Zn=function(a){this.u.Zn(a)};
g.k.dispose=function(){this.isDisposed()||(g.Ka("yt.mdx.remote.remoteClient_",null),this.W("beforeDispose"),i9(this,3));g.bu.prototype.dispose.call(this)};
g.k.Y=function(){k9(this);m9(this);l9(this);g.bq(this.P);this.P=NaN;g.bq(this.U);this.U=NaN;this.C=null;g.at(this.V);this.V.length=0;this.u.dispose();g.bu.prototype.Y.call(this);this.D=this.J=this.B=this.j=this.u=null};
g.k.qO=function(a){if(!this.B||0===this.B.length)return!1;for(var b=g.r(this.B),c=b.next();!c.done;c=b.next())if(!c.value.capabilities.has(a))return!1;return!0};
g.k.bW=function(){var a=3;this.isDisposed()||(a=0,isNaN(this.Sx())?this.u.Nu()&&isNaN(this.I)&&(a=1):a=2);return a};
g.k.nu=function(a){h9("Disconnecting with "+a);g.Ka("yt.mdx.remote.remoteClient_",null);k9(this);this.W("beforeDisconnect",a);1==a&&D6();this.u.disconnect(a);this.dispose()};
g.k.ZV=function(){var a=this.j;this.C&&(a=this.j.clone(),X8(a,this.C,a.index));return Y8(a)};
g.k.q0=function(a){var b=this,c=new S8(a);c.videoId&&c.videoId!=this.j.videoId&&(this.C=c.videoId,g.bq(this.P),this.P=g.$p(function(){if(b.C){var e=b.C;b.C=null;b.j.videoId!=e&&n9(b,"getNowPlaying")}},5E3));
var d=[];this.j.listId==c.listId&&this.j.videoId==c.videoId&&this.j.index==c.index||d.push("remoteQueueChange");this.j.playerState==c.playerState&&this.j.volume==c.volume&&this.j.muted==c.muted&&W8(this.j)==W8(c)&&g.lh(this.j.trackData)==g.lh(c.trackData)||d.push("remotePlayerChange");this.j.reset(a);g.mc(d,function(e){this.W(e)},this)};
g.k.JN=function(){var a=this.u.ip(),b=g.Sb(this.B,function(c){return"REMOTE_CONTROL"==c.type&&c.id!=a});
return b?b.id:""};
g.k.Sx=function(){return this.u.tp()};
g.k.WV=function(){return this.D||"UNSUPPORTED"};
g.k.XV=function(){return this.J||""};
g.k.kT=function(){!isNaN(this.Sx())&&this.u.Bs()};
g.k.m0=function(a,b){n9(this,a,b);W4a(this)};
g.k.VK=function(){var a=g.oq("SID","")||"",b=g.oq("SAPISID","")||"",c=g.oq("__Secure-3PAPISID","")||"";if(!a&&!b&&!c)return"";a=g.tc(g.ib(a),2);b=g.tc(g.ib(b),2);c=g.tc(g.ib(c),2);return g.tc(g.ib(a+","+b+","+c),2)};
j9.prototype.subscribe=j9.prototype.subscribe;j9.prototype.unsubscribeByKey=j9.prototype.pg;j9.prototype.getProxyState=j9.prototype.bW;j9.prototype.disconnect=j9.prototype.nu;j9.prototype.getPlayerContextData=j9.prototype.ZV;j9.prototype.setPlayerContextData=j9.prototype.q0;j9.prototype.getOtherConnectedRemoteId=j9.prototype.JN;j9.prototype.getReconnectTimeout=j9.prototype.Sx;j9.prototype.getAutoplayMode=j9.prototype.WV;j9.prototype.getAutoplayVideoId=j9.prototype.XV;j9.prototype.reconnect=j9.prototype.kT;
j9.prototype.sendMessage=j9.prototype.m0;j9.prototype.getXsrfToken=j9.prototype.VK;j9.prototype.isCapabilitySupportedOnConnectedDevices=j9.prototype.qO;g.w(o9,g8);g.k=o9.prototype;g.k.Ti=function(a){return this.Ff.$_gs(a)};
g.k.contains=function(a){return!!this.Ff.$_c(a)};
g.k.get=function(a){return this.Ff.$_g(a)};
g.k.start=function(){this.Ff.$_st()};
g.k.add=function(a,b,c){this.Ff.$_a(a,b,c)};
g.k.remove=function(a,b,c){this.Ff.$_r(a,b,c)};
g.k.BD=function(a,b,c,d){this.Ff.$_un(a,b,c,d)};
g.k.Y=function(){for(var a=0,b=this.j.length;a<b;++a)this.Ff.$_ubk(this.j[a]);this.j.length=0;this.Ff=null;g8.prototype.Y.call(this)};
g.k.lT=function(){this.W("screenChange")};
g.k.dZ=function(){this.W("onlineScreenChange")};
q8.prototype.$_st=q8.prototype.start;q8.prototype.$_gspc=q8.prototype.fT;q8.prototype.$_gsppc=q8.prototype.RK;q8.prototype.$_c=q8.prototype.contains;q8.prototype.$_g=q8.prototype.get;q8.prototype.$_a=q8.prototype.add;q8.prototype.$_un=q8.prototype.BD;q8.prototype.$_r=q8.prototype.remove;q8.prototype.$_gs=q8.prototype.Ti;q8.prototype.$_gos=q8.prototype.QK;q8.prototype.$_s=q8.prototype.subscribe;q8.prototype.$_ubk=q8.prototype.pg;var B9=null,H9=!1,p9=null,q9=null,G9=null,u9=[];g.w(I9,g.I);g.k=I9.prototype;g.k.Y=function(){g.I.prototype.Y.call(this);this.j.stop();this.B.stop();this.P.stop();var a=this.Ub;a.unsubscribe("proxyStateChange",this.WP,this);a.unsubscribe("remotePlayerChange",this.Ty,this);a.unsubscribe("remoteQueueChange",this.AC,this);a.unsubscribe("previousNextChange",this.TP,this);a.unsubscribe("nowAutoplaying",this.NP,this);a.unsubscribe("autoplayDismissed",this.qP,this);this.Ub=this.u=null};
g.k.Jk=function(a){var b=g.Ea.apply(1,arguments);if(2!=this.Ub.B)if(J9(this)){if(!a9(this.Ub).isAdPlaying()||"control_seek"!==a)switch(a){case "control_toggle_play_pause":a9(this.Ub).isPlaying()?this.Ub.pause():this.Ub.play();break;case "control_play":this.Ub.play();break;case "control_pause":this.Ub.pause();break;case "control_seek":this.J.eE(b[0],b[1]);break;case "control_subtitles_set_track":K9(this,b[0]);break;case "control_set_audio_track":this.setAudioTrack(b[0])}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":b=
this.G.getCurrentTime();L9(this,0===b?void 0:b);break;case "control_seek":L9(this,b[0]);break;case "control_subtitles_set_track":K9(this,b[0]);break;case "control_set_audio_track":this.setAudioTrack(b[0])}};
g.k.gY=function(a){this.P.JS(a)};
g.k.b1=function(a){this.Jk("control_subtitles_set_track",g.Je(a)?null:a)};
g.k.rR=function(){var a=this.G.getOption("captions","track");g.Je(a)||K9(this,a)};
g.k.Qb=function(a){this.u.Qb(a,this.G.getVideoData().lengthSeconds)};
g.k.OY=function(){g.Je(this.C)||r5a(this,this.C);this.D=!1};
g.k.WP=function(a,b){this.B.stop();2===b&&this.kR()};
g.k.Ty=function(){if(J9(this)){this.j.stop();var a=a9(this.Ub);switch(a.playerState){case 1080:case 1081:case 1084:case 1085:this.u.fg=1;break;case 1082:case 1083:this.u.fg=0;break;default:this.u.fg=-1}switch(a.playerState){case 1081:case 1:this.Pb(new g.oF(8));this.jR();break;case 1085:case 3:this.Pb(new g.oF(9));break;case 1083:case 0:this.Pb(new g.oF(2));this.J.stop();this.Qb(this.G.getVideoData().lengthSeconds);break;case 1084:this.Pb(new g.oF(4));break;case 2:this.Pb(new g.oF(4));this.Qb(W8(a));
break;case -1:this.Pb(new g.oF(64));break;case -1E3:this.Pb(new g.oF(128,{errorCode:"mdx.remoteerror",errorMessage:"This video is not available for remote playback.",cB:2}))}a=a9(this.Ub).trackData;var b=this.C;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.kind==b.kind:1)||(this.C=a,r5a(this,a));a=a9(this.Ub);-1===a.volume||Math.round(this.G.getVolume())===a.volume&&this.G.isMuted()===a.muted||this.U.isActive()||this.TR()}else q5a(this)};
g.k.TP=function(){this.G.W("mdxpreviousnextchange")};
g.k.AC=function(){J9(this)||q5a(this)};
g.k.NP=function(a){isNaN(a)||this.G.W("mdxnowautoplaying",a)};
g.k.qP=function(){this.G.W("mdxautoplaycanceled")};
g.k.setAudioTrack=function(a){J9(this)&&this.Ub.setAudioTrack(this.G.getVideoData(1).videoId,a)};
g.k.seekTo=function(a,b){-1===a9(this.Ub).playerState?L9(this,a):b&&this.Ub.seekTo(a)};
g.k.TR=function(){var a=this;if(J9(this)){var b=a9(this.Ub);this.events.pc(this.V);b.muted?this.G.mute():this.G.unMute();this.G.setVolume(b.volume);this.V=this.events.N(this.G,"onVolumeChange",function(c){p5a(a,c)})}};
g.k.jR=function(){this.j.stop();if(!this.Ub.isDisposed()){var a=a9(this.Ub);a.isPlaying()&&this.Pb(new g.oF(8));this.Qb(W8(a));this.j.start()}};
g.k.kR=function(){this.B.stop();this.j.stop();var a=this.Ub.tp();2==this.Ub.B&&!isNaN(a)&&this.B.start()};
g.k.Pb=function(a){this.B.stop();var b=this.I;if(!g.tF(b,a)){var c=g.V(a,2);c!==g.V(this.I,2)&&this.G.Lv(c);this.I=a;t5a(this.u,b,a)}};g.w(M9,g.W);M9.prototype.md=function(){this.j.show()};
M9.prototype.Db=function(){this.j.hide()};
M9.prototype.u=function(){q6("mdx-privacy-popup-cancel");this.Db()};
M9.prototype.B=function(){q6("mdx-privacy-popup-confirm");this.Db()};g.w(N9,g.W);N9.prototype.onStateChange=function(a){s5a(this,a.state)};g.w(O9,g.lM);O9.prototype.C=function(){var a=this.G.getOption("remote","receivers");a&&1<a.length&&!this.G.getOption("remote","quickCast")?(this.aq=g.nc(a,this.j,this),g.mM(this,g.ak(a,this.j)),a=this.G.getOption("remote","currentReceiver"),a=this.j(a),this.options[a]&&this.uj(a),this.enable(!0)):this.enable(!1)};
O9.prototype.j=function(a){return a.key};
O9.prototype.vk=function(a){return"cast-selector-receiver"===a?"Cast...":this.aq[a].name};
O9.prototype.rg=function(a){g.lM.prototype.rg.call(this,a);this.G.setOption("remote","currentReceiver",this.aq[a]);this.gb.Db()};g.w(P9,g.NI);g.k=P9.prototype;
g.k.create=function(){var a=this.player.S(),b=g.WA(a);a={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:a.K("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:a.K("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:a.K("enable_cast_short_lived_lounge_token")};k5a(b,a);this.subscriptions.push(g.ut("yt-remote-before-disconnect",this.eY,this));this.subscriptions.push(g.ut("yt-remote-connection-change",this.BZ,this));this.subscriptions.push(g.ut("yt-remote-receiver-availability-change",this.VP,
this));this.subscriptions.push(g.ut("yt-remote-auto-connect",this.zZ,this));this.subscriptions.push(g.ut("yt-remote-receiver-resumed",this.yZ,this));this.subscriptions.push(g.ut("mdx-privacy-popup-confirm",this.P_,this));this.subscriptions.push(g.ut("mdx-privacy-popup-cancel",this.O_,this));this.VP()};
g.k.load=function(){this.player.cancelPlayback();g.NI.prototype.load.call(this);this.xj=new I9(this,this.player,this.Ub);var a=(a=o5a())?a.currentTime:0;var b=F9()?new $8(z9(),void 0):null;0==a&&b&&(a=W8(a9(b)));0!==a&&this.Qb(a);t5a(this,this.Od,this.Od);this.player.Fm(6)};
g.k.unload=function(){this.player.W("mdxautoplaycanceled");this.Uo=this.ym;g.oe(this.xj,this.Ub);this.Ub=this.xj=null;g.NI.prototype.unload.call(this);this.player.Fm(5);Q9(this)};
g.k.Y=function(){g.vt(this.subscriptions);g.NI.prototype.Y.call(this)};
g.k.zm=function(a){var b=g.Ea.apply(1,arguments);this.loaded&&this.xj.Jk.apply(this.xj,[a].concat(g.v(b)))};
g.k.getAdState=function(){return this.fg};
g.k.lm=function(){return this.Ub?a9(this.Ub).lm:!1};
g.k.hasNext=function(){return this.Ub?a9(this.Ub).hasNext:!1};
g.k.Qb=function(a,b){this.DO=a||0;this.player.W("progresssync",a,b);this.player.Ia("onVideoProgress",a||0)};
g.k.getCurrentTime=function(){return this.DO};
g.k.getProgressState=function(){var a=a9(this.Ub),b=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:this.player.S().K("web_player_mdx_allow_seeking_change_killswitch")?this.player.Of():!a.isAdPlaying()&&this.player.Of(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.u?a.B+U8(a):a.B,isAtLiveHead:1>=(a.u?a.j+U8(a):a.j)-this.getCurrentTime(),loaded:a.P,seekableEnd:a.u?a.j+U8(a):a.j,seekableStart:0<
a.C?a.C+U8(a):a.C}};
g.k.nextVideo=function(){this.Ub&&this.Ub.nextVideo()};
g.k.NC=function(){this.Ub&&this.Ub.NC()};
g.k.eY=function(a){1===a&&(this.BI=this.Ub?a9(this.Ub):null)};
g.k.BZ=function(){var a=F9()?new $8(z9(),void 0):null;if(a){var b=this.Uo;this.loaded&&this.unload();this.Ub=a;this.BI=null;b.key!==this.ym.key&&(this.Uo=b,this.load())}else g.ne(this.Ub),this.Ub=null,this.loaded&&(this.unload(),(a=this.BI)&&a.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(a.videoId,W8(a)));this.player.W("videodatachange","newdata",this.player.getVideoData(),3)};
g.k.VP=function(){var a=[this.ym],b=a.concat,c=l5a();O8()&&g.Tu("yt-remote-cast-available")&&c.push({key:"cast-selector-receiver",name:"Cast..."});this.aq=b.call(a,c);a=A9()||this.ym;R9(this,a);this.player.Ia("onMdxReceiversChange")};
g.k.zZ=function(){var a=A9();R9(this,a)};
g.k.yZ=function(){this.Uo=A9()};
g.k.P_=function(){this.cz=!0;Q9(this);H9=!1;B9&&D9(B9,1);B9=null};
g.k.O_=function(){this.cz=!1;Q9(this);R9(this,this.ym);this.Uo=this.ym;H9=!1;B9=null;this.player.playVideo()};
g.k.Wf=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.aq;case "currentReceiver":return b&&("cast-selector-receiver"===b.key?Q8():R9(this,b)),this.loaded?this.Uo:this.ym;case "quickCast":return 2===this.aq.length&&"cast-selector-receiver"===this.aq[1].key?(b&&Q8(),!0):!1}};
g.k.HJ=function(){this.Ub.HJ()};
g.k.ij=function(){return!1};
g.k.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]};g.MI("remote",P9);})(_yt_player);