-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathannotations_module.js
279 lines (277 loc) · 66.8 KB
/
annotations_module.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
(function(g){var window=this;/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';var C1=function(a){a.W("cardstatechange",a.Yg()&&a.Gj()?1:0)},D1=function(a,b){var c=g.La(b),d=c?b:arguments;
for(c=c?0:1;c<d.length;c++){if(null==a)return;a=a[d[c]]}return a},oHa=function(a){var b=g.sg(a);
a=g.yg(a);return new g.ag(b.x,b.y,a.width,a.height)},pHa=function(a){return Math.pow(a,3)},qHa=function(a){return 3*a*a-2*a*a*a},G1=function(a){a=g.Oa(a);
delete E1[a];g.Ob(E1)&&F1&&F1.stop()},sHa=function(){F1||(F1=new g.J(function(){rHa()},20));
var a=F1;a.isActive()||a.start()},rHa=function(){var a=g.Ra();
g.Bb(E1,function(b){tHa(b,a)});
g.Ob(E1)||sHa()},H1=function(a,b,c,d){g.En.call(this);
if(!Array.isArray(a)||!Array.isArray(b))throw Error("Start and end parameters must be arrays");if(a.length!=b.length)throw Error("Start and end points must be the same length");this.i=a;this.J=b;this.duration=c;this.C=d;this.coords=[];this.progress=this.G=0;this.B=null},tHa=function(a,b){b<a.startTime&&(a.endTime=b+a.endTime-a.startTime,a.startTime=b);
a.progress=(b-a.startTime)/(a.endTime-a.startTime);1<a.progress&&(a.progress=1);a.G=1E3/(b-a.B);a.B=b;uHa(a,a.progress);1==a.progress?(a.fb=0,G1(a),a.onFinish(),a.Bt()):a.qc()&&a.Ry()},uHa=function(a,b){"function"===typeof a.C&&(b=a.C(b));
a.coords=Array(a.i.length);for(var c=0;c<a.i.length;c++)a.coords[c]=(a.J[c]-a.i[c])*b+a.i[c]},vHa=function(a,b){g.Cl.call(this,a);
this.coords=b.coords;this.x=b.coords[0];this.y=b.coords[1];this.z=b.coords[2];this.duration=b.duration;this.progress=b.progress;this.fps=b.G;this.state=b.fb},I1=function(a,b,c,d,e){H1.call(this,b,c,d,e);
this.element=a},J1=function(a,b,c,d,e){if(2!=b.length||2!=c.length)throw Error("Start and end points must be 2D");
I1.call(this,a,b,c,d,e)},K1=function(a){g.E.call(this);
this.l=a||window;this.i=[]},L1=function(a){return a.baseUrl||null},M1=function(a,b){return g.Le(g.Kc(a,b,void 0),function(c){return!!c})},wHa=function(a,b,c){function d(za){var Ya,Wc,Re,Za=za.hovercardButton;
if(!Za)return null;Za=Za.subscribeButtonRenderer;if(!Za)return null;var ze=f(Za.unsubscribedButtonText),Ch=f(Za.subscribedButtonText);if(Za.subscribed){var Mj=f(Za.subscriberCountWithUnsubscribeText);var Di=f(Za.subscriberCountText)}else Mj=f(Za.subscriberCountText),Di=f(Za.subscriberCountWithSubscribeText);var qc=null;return za.signinEndpoint&&(qc=D1(za,"signinEndpoint","webNavigationEndpointData","url"),qc||(qc=null===(Re=null===(Wc=null===(Ya=Za.signInEndpoint)||void 0===Ya?void 0:Ya.commandMetadata)||
void 0===Wc?void 0:Wc.webCommandMetadata)||void 0===Re?void 0:Re.url),!qc)?null:ze&&(Ch||qc)?{subscribed:Za.subscribed,subscribeText:ze,subscribeCount:Mj,unsubscribeText:Ch,unsubscribeCount:Di,enabled:Za.enabled,signinUrl:qc,classic:za.useClassicSubscribeButton}:null}
function e(za){if(za){var Ya=[],Wc=za.videoId;Wc&&Ya.push("v="+Wc);(Wc=za.playlistId)&&Ya.push("list="+Wc);(za=za.startTimeSeconds)&&Ya.push("t="+za);return"/watch?"+Ya.join("&")}}
function f(za){if(!za)return null;var Ya=za.simpleText;return Ya?Ya:za.runs?g.Kc(za.runs,function(Wc){return Wc.text}).join(""):null}
b=b.endscreenElementRenderer;if(!b)return null;var h=b.style,l=b.endpoint||{},m=null,n=null,p=null,r=null,t=null,u=null,x=!1,y=null,B=null,G=null,H=null,I=null;if("VIDEO"===h)l.urlEndpoint?m=l.urlEndpoint.url:m=e(l.watchEndpoint),n=!1,p=a,r=f(b.videoDuration);else if("PLAYLIST"===h)l.urlEndpoint?m=l.urlEndpoint.url:m=e(l.watchEndpoint),n=!1,p=a,t=f(b.playlistLength);else if("CHANNEL"===h){if(x=D1(l,"browseEndpoint","browseId"))u=x,m="/channel/"+u;n=!1;p="new";(x=!!b.isSubscribe)?y=d(b):B=f(b.subscribersText)}else"WEBSITE"===
h?((G=D1(l,"urlEndpoint","url"))&&(m=G),n=!0,p="new",G=b.icon.thumbnails[0].url):"CREATOR_MERCHANDISE"===h&&(b.productPrice&&(H=f(b.productPrice)),b.additionalFeesText&&(I=f(b.additionalFeesText)),(n=D1(l,"urlEndpoint","url"))&&(m=n),n=!0,p="new");a=D1(b,"title","accessibility","accessibilityData","label");var M=b.endpoint?b.endpoint.clickTrackingParams:null,O="";if(b.metadata){var la=f(b.metadata);la&&(O=la)}return{id:"element-"+c,type:h,title:f(b.title),metadata:O,callToAction:f(b.callToAction),
TF:b.image,iconUrl:G,left:Number(b.left),width:Number(b.width),top:Number(b.top),aspectRatio:Number(b.aspectRatio),startMs:Math.floor(Number(b.startMs)),endMs:Math.floor(Number(b.endMs)),videoDuration:r,playlistLength:t,channelId:u,subscribeButton:y,subscribersText:B,isSubscribe:x,targetUrl:m||null,zO:n,Md:M?{itct:M}:null,hT:p,Hr:a?a:null,CO:b.isPlaceholder,impressionUrls:M1(b.impressionUrls||[],L1),rO:M1(b.hovercardShowUrls||[],L1),clickUrls:M1(l.loggingUrls||[],L1),visualElement:g.Au(b.trackingParams),
productPrice:H,additionalFeesText:I}},N1=function(a,b){var c={startMs:Math.floor(Number(a.startMs)),
impressionUrls:M1(a.impressionUrls||[],L1),elements:M1(a.elements||[],function(d,e){return wHa(b,d,e)})};
a.trackingParams&&(c.visualElement=g.Au(a.trackingParams));return c},O1=function(a){g.YL.call(this,a);
this.u=this.endscreen=null;this.i={};this.C={};this.B=this.l=null;this.J=[];this.U=!0;this.G=0;a=a.T();this.L=g.AD(a)||g.ED(a);this.events=new g.NL(this);g.F(this,this.events);this.events.N(this.player,g.Zv("creatorendscreen"),this.xd);this.events.N(this.player,g.$v("creatorendscreen"),this.Te);this.events.N(this.player,"resize",this.tb);this.events.N(window,"focus",this.jS);this.load();var b=g.Ge("STYLE");(document.getElementsByTagName("HEAD")[0]||document.body).appendChild(b);g.Ai(this,function(){g.Ke(b)});
b.sheet&&(b.sheet.insertRule(".ytp-ce-playlist-icon {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAIVBMVEVMaXGzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7P///91E4wTAAAACXRSTlMArBbpVOtYrReN+x2FAAAAAWJLR0QKaND0VgAAACFJREFUCNdjYCAWzIQAFBaZ6hgVYLKcJnBWGEyWvYGASwCXtBf7m4i3CQAAAABJRU5ErkJggg==) no-repeat center;background-size:18px;width:18px;height:18px}",0),b.sheet.insertRule(".ytp-ce-size-853 .ytp-ce-playlist-icon, .ytp-ce-size-1280 .ytp-ce-playlist-icon, .ytp-ce-size-1920 .ytp-ce-playlist-icon {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAJ1BMVEVMaXGzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7P///9RfzIKAAAAC3RSTlMAvDeyLvxYtDK9Ogx4T1QAAAABYktHRAyBs1FjAAAAK0lEQVQY02NgoBjshgO8HJoYwKiAMGAD92YHJM7uMCTO9gaEHs4FlPuZAQC8Fj8x/xHjxwAAAABJRU5ErkJggg==) no-repeat center;background-size:24px;width:24px;height:24px}",
0))},xHa=function(a){return a.player.getVideoData().C?"current":a.L?"new":"current"},P1=function(a){return"creator-endscreen-editor"===a.player.T().playerStyle},yHa=function(a){var b=a.player.getVideoData(),c=b.videoId;
a.u&&a.u.abort();c={method:"POST",onFinish:function(e){var f=a.u=null;200===e.status&&(e=e.responseText,")]}"===e.substring(0,3)&&(e=e.substring(3),f=JSON.parse(e),f=N1(f,xHa(a))));Q1(a,f)},
urlParams:{v:c},withCredentials:!0};a.L&&(c.urlParams.ptype="embedded");var d=b.Cn;d&&(c.postParams={ad_tracking:d});if(b=g.uja(b))if(b=g.Fc(b),b=g.Bc(b))a.u=g.sp(b,c)},Q1=function(a,b,c){c=void 0===c?!0:c;
a.player.Ve("creatorendscreen");a.l&&(a.l.dispose(),a.l=null,a.B.dispose(),a.B=null);for(var d=g.q(Object.values(a.i)),e=d.next();!e.done;e=d.next())e.value.dispose();a.i={};a.C={};0<a.J.length&&(a.J.forEach(function(l){l.dispose()}),a.J.length=0);
a.G=0;if((a.endscreen=b)&&b.elements){c&&zHa(a);c=[];d=new g.Wv(b.startMs,0x7ffffffffffff,{id:"ytp-ce-in-endscreen",namespace:"creatorendscreen"});c.push(d);a.player.T().i||(a.l=new g.V({D:"div",K:"ytp-ce-shadow"}),g.LL(a.player,a.l.element,4),a.B=new g.CK(a.l,200));for(d=0;d<b.elements.length;++d){e=b.elements[d];var f=AHa(a,e);if(f){a.i[e.id]=f;a.C[e.id]=e;g.LL(a.player,f.element,4);var h=new g.Wv(e.startMs,e.endMs,{id:"ytp-ce-element-"+e.id,namespace:"creatorendscreen"});c.push(h);BHa(a,f,e)}else g.Su(new g.As("buildEndscreenElement null",
e))}a.player.Bd(c);a.tb()}},zHa=function(a){var b=g.Eu(),c=g.Gu();
c&&b&&a.endscreen.visualElement&&g.fv(c,b,a.endscreen.visualElement)},AHa=function(a,b){var c=null;
switch(b.type){case "VIDEO":c=a.player.Z("player_endscreen_ellipsis_fix")?["ytp-webkit-ellipsis"]:["yt-ui-ellipsis","yt-ui-ellipsis-2"];a={D:"div",Ca:["ytp-ce-element","ytp-ce-video"],V:{tabindex:"0","aria-label":b.Hr||"","aria-hidden":"true"},S:[{D:"div",K:"ytp-ce-element-shadow"},{D:"div",K:"ytp-ce-covering-image",V:R1(b)},{D:"div",K:"ytp-ce-covering-shadow-top"},{D:"a",K:"ytp-ce-covering-overlay",V:{href:S1(a,b.targetUrl),tabindex:"-1"},S:[{D:"div",Ca:["ytp-ce-video-title"].concat(g.ma(c)),V:{dir:g.Kn(b.title||
"")},oa:b.title},{D:"div",K:"ytp-ce-video-duration",oa:b.videoDuration||void 0}]}]};c=new g.V(a);break;case "PLAYLIST":c=a.player.Z("player_endscreen_ellipsis_fix")?["ytp-webkit-ellipsis"]:["yt-ui-ellipsis","yt-ui-ellipsis-2"];a={D:"div",Ca:["ytp-ce-element","ytp-ce-playlist"],V:{tabindex:"0","aria-label":b.Hr||"","aria-hidden":"true"},S:[{D:"div",K:"ytp-ce-element-shadow"},{D:"div",K:"ytp-ce-covering-image",V:R1(b)},{D:"div",K:"ytp-ce-covering-shadow-top"},{D:"a",K:"ytp-ce-covering-overlay",V:{href:S1(a,
b.targetUrl),tabindex:"-1"},S:[{D:"div",Ca:["ytp-ce-playlist-title"].concat(g.ma(c)),V:{dir:g.Kn(b.title||"")},oa:b.title},{D:"div",K:"ytp-ce-playlist-count",S:[{D:"div",K:"ytp-ce-playlist-icon"},{D:"div",K:"ytp-ce-playlist-count-text",oa:b.playlistLength||void 0}]}]}]};c=new g.V(a);break;case "CHANNEL":c={D:"div",Ca:["ytp-ce-element","ytp-ce-channel",b.isSubscribe?"ytp-ce-channel-this":"ytp-ce-channel-that"],V:{tabindex:"0","aria-label":b.Hr||"","aria-hidden":"true"},S:[{D:"div",K:"ytp-ce-element-shadow"},
{D:"div",K:"ytp-ce-expanding-overlay",S:[{D:"div",K:"ytp-ce-expanding-overlay-hider"},{D:"div",K:"ytp-ce-expanding-overlay-background"},{D:"div",K:"ytp-ce-expanding-overlay-content",S:[{D:"div",K:"ytp-ce-expanding-overlay-body",S:[{D:"div",K:"ytp-ce-expanding-overlay-body-padding",S:[{D:"a",Ca:["ytp-ce-channel-title","ytp-ce-link"],V:{href:S1(a,b.targetUrl),target:"_blank",tabindex:"-1",dir:g.Kn(b.title||"")},oa:b.title},b.subscribeButton?{D:"div",K:"ytp-ce-subscribe-container",S:[{D:"div",K:"ytp-ce-channel-subscribe"}]}:
"",b.subscribersText?{D:"div",K:"ytp-ce-channel-subscribers-text",oa:b.subscribersText}:"",b.metadata?{D:"div",Ca:["ytp-ce-channel-metadata","yt-ui-ellipsis","yt-ui-ellipsis-3"],oa:b.metadata}:""]}]}]}]},{D:"div",K:"ytp-ce-expanding-image",V:R1(b)}]};c=new g.V(c);var d=g.re(document,"div","ytp-ce-channel-subscribe",c.element)[0];if(b.subscribeButton&&b.channelId){g.K(d,"ytp-ce-subscribe-button");if(a.player.T().i){var e=null;var f=b.Md.itct}else e="endscreen",f=null;e=new g.eN(b.subscribeButton.subscribeText,
b.subscribeButton.subscribeCount,b.subscribeButton.unsubscribeText,b.subscribeButton.unsubscribeCount,!!b.subscribeButton.enabled,!!b.subscribeButton.classic,b.channelId,!!b.subscribeButton.subscribed,e,f,b.subscribeButton.signinUrl,a.player);d.appendChild(e.element);a.J.push(e)}break;case "WEBSITE":a={D:"div",Ca:["ytp-ce-element","ytp-ce-website"],V:{tabindex:"0","aria-label":b.Hr||"","aria-hidden":"true"},S:[{D:"div",K:"ytp-ce-element-shadow"},{D:"div",K:"ytp-ce-expanding-overlay",S:[{D:"div",K:"ytp-ce-expanding-overlay-hider"},
{D:"div",K:"ytp-ce-expanding-overlay-background"},{D:"div",K:"ytp-ce-expanding-overlay-content",S:[{D:"div",K:"ytp-ce-expanding-overlay-body",S:[{D:"div",K:"ytp-ce-expanding-overlay-body-padding",S:[{D:"div",K:"ytp-ce-website-title",V:{dir:g.Kn(b.title||"")},oa:b.title},{D:"div",K:"ytp-ce-website-metadata",oa:b.metadata},{D:"a",Ca:["ytp-ce-website-goto","ytp-ce-link"],V:{href:S1(a,b.targetUrl),target:"_blank",tabindex:"-1"},oa:b.callToAction}]}]}]}]},{D:"div",K:"ytp-ce-expanding-image",V:R1(b)},{D:"div",
K:"ytp-ce-expanding-icon",V:CHa(b.iconUrl)}]};c=new g.V(a);break;case "CREATOR_MERCHANDISE":c="",b.productPrice&&(c={D:"div",K:"ytp-ce-merchandise-price-container",S:[{D:"div",K:"ytp-ce-merchandise-price",oa:b.productPrice}]},b.additionalFeesText&&c.S.push({D:"div",K:"ytp-ce-merchandise-additional-fees",oa:b.additionalFeesText})),a={D:"div",Ca:["ytp-ce-element","ytp-ce-merchandise"],V:{tabindex:"0","aria-label":b.Hr||"","aria-hidden":"true"},S:[{D:"div",K:"ytp-ce-element-shadow"},{D:"div",K:"ytp-ce-expanding-overlay",
S:[{D:"div",K:"ytp-ce-expanding-overlay-hider"},{D:"div",K:"ytp-ce-expanding-overlay-background"},{D:"div",K:"ytp-ce-expanding-overlay-content",S:[{D:"div",K:"ytp-ce-expanding-overlay-body",S:[{D:"div",K:"ytp-ce-expanding-overlay-body-padding",S:[{D:"div",K:"ytp-ce-merchandise-title",V:{dir:g.Kn(b.title||"")},oa:b.title},c,{D:"div",K:"ytp-ce-merchandise-metadata",oa:b.metadata},{D:"a",Ca:["ytp-ce-merchandise-goto","ytp-ce-link"],V:{href:S1(a,b.targetUrl),target:"_blank",tabindex:"-1"},oa:b.callToAction}]}]}]}]},
{D:"div",K:"ytp-ce-expanding-image",V:R1(b)},{D:"div",K:"ytp-ce-merchandise-invideo-cta-container",S:[{D:"div",K:"ytp-ce-merchandise-invideo-cta",oa:b.callToAction||void 0}]}]},c=new g.V(a)}b.CO&&g.K(c.element,"ytp-ce-placeholder");return c},R1=function(a){if(a.TF)var b=a.TF.thumbnails;
return CHa(b?b[b.length-1].url:null)},CHa=function(a){return a?{style:"background-image: url("+a+")"}:{}},BHa=function(a,b,c){function d(m){m&&(b.Qa("blur",function(){"none"!=m.style.display&&a.U&&m.focus()}),b.N(m,"focus",f),b.N(m,"blur",h))}
function e(m){a.G+=m;0<a.G?(g.K(b.element,"ytp-ce-force-expand"),T1(a,c.id,!0)):(g.Bn(b.element,"ytp-ce-force-expand"),g.Bn(b.element,"ytp-ce-element-hover"),T1(a,c.id,!1))}
function f(){e(1)}
function h(){e(-1)}
b.Qa("mouseenter",function(){U1(a,b,c)});
b.Qa("mouseleave",function(){V1(a,b,c)});
a.player.T().i||b.Qa("click",function(){g.K(b.element,"ytp-ce-element-hover")});
b.Qa("click",function(m){DHa(a,c,m)});
b.Qa("keypress",function(m){DHa(a,c,m)});
b.Qa("focus",function(){U1(a,b,c)});
b.Qa("blur",function(){V1(a,b,c)});
b.Qa("touchstart",function(){U1(a,b,c)});
var l=g.te("ytp-ce-expanding-overlay-hider",b.element);l&&b.N(l,"touchstart",function(m){m=m||window.event;m.cancelBubble=!0;m.stopPropagation&&m.stopPropagation();g.Bn(b.element,"ytp-ce-element-hover");g.Bn(b.element,"ytp-ce-force-expand")});
b.Qa("keydown",function(m){a.U=9===m.keyCode&&!m.shiftKey});
d(g.te("ytp-sb-subscribe",b.element));d(g.te("ytp-sb-unsubscribe",b.element));b.Qa("focus",f);b.Qa("blur",h)},DHa=function(a,b,c){if(b.targetUrl&&(!c||"keypress"!==c.type||13===c.keyCode)){for(var d=c.target;d&&!g.zn(d,"ytp-ce-element");){g.zn(d,"subscribe-label")&&W1(a,b);
if(g.zn(d,"ytp-ce-channel-subscribe"))return;d=g.Me(d)}if(!d||g.zn(d,"ytp-ce-element-hover")){c.preventDefault();c.stopPropagation();if(d=a.i[b.id])V1(a,d,b),d.element.blur();if(c.ctrlKey||c.metaKey||"new"===b.hT)W1(a,b),a.player.sendVideoStatsEngageEvent(17,void 0),a.player.pauseVideo(),c=g.Fc(S1(a,b.targetUrl)),c=g.Bc(c),g.DI(c,void 0,b.Md);else{var e=a.player.getVideoData().C,f=function(){var h=S1(a,b.targetUrl),l=b.Md,m=g.Zo(h);e&&m&&(m.v||m.list)?a.player.ej(m.v,l,m.list,!1):g.CI(h,l)};
W1(a,b,function(){a.player.sendVideoStatsEngageEvent(17,f)})}}}},S1=function(a,b){a=a.player.T();
if(b){if(b.startsWith("//"))return a.protocol+":"+b;if(b.startsWith("/"))return g.kE(a)+b}else return"";return b},U1=function(a,b,c){g.zn(b.element,"ytp-ce-element-hover")||("VIDEO"===c.type||"PLAYLIST"===c.type?g.K(b.element,"ytp-ce-element-hover"):a.player.T().i?(new g.J(function(){g.K(b.element,"ytp-ce-element-hover")},200)).start():g.K(b.element,"ytp-ce-element-hover"),X1(a,c.rO),T1(a,c.id,!0))},V1=function(a,b,c){g.Bn(b.element,"ytp-ce-element-hover");
g.Bn(b.element,"ytp-ce-force-expand");T1(a,c.id,!1)},T1=function(a,b,c){a.l&&(c?a.B.show():a.B.hide());
for(var d=g.q(Object.keys(a.i)),e=d.next();!e.done;e=d.next())e=e.value,e!==b&&g.L(a.i[e].element,"ytp-ce-element-shadow-show",c)},X1=function(a,b,c){function d(){f||(e++,e===b.length&&(h.stop(),c&&c()))}
if(!b||0===b.length||P1(a))c&&c();else{b=EHa(a,b);var e=0,f=!1,h=new g.J(function(){f=!0;c&&c()},1E3,a);
h.start();for(a=0;a<b.length;a++)g.Pq(b[a],d)}},W1=function(a,b,c){X1(a,b.clickUrls,c);
(a=g.Gu())&&b.zO&&g.iv(a,b.visualElement)},EHa=function(a,b){var c=a.player.getVideoData().clientPlaybackNonce;
a=a.player.getCurrentTime().toFixed(2);c={CPN:c,AD_CPN:c,MT:a};a=[];for(var d=0;d<b.length;d++)a.push(FHa(b[d],c));return a},FHa=function(a,b){return a.replace(/%5B[a-zA-Z_:]+%5D|\[[a-zA-Z_:]+\]/g,function(c){var d=unescape(c);
d=d.substring(1,d.length-1);return b[d]?escape(b[d]):c})},GHa=function(a){return Array.isArray(a)&&a.length?a[0]:a},Y1=function(a){return"string"===typeof a?a:""},Z1=function(a,b,c){for(var d in b)if(b[d]===a)return a;
return c},HHa=function(a){this.externalId=a},IHa=function(a,b,c,d){this.value=a;
this.target=b;this.showLinkIcon=c;this.i=d},$1=function(a){return a.value?a.value:null},a2=function(a){if(!a)return null;
var b=g.Fc(Y1(a.value));b=g.Bc(b);if(!b)return null;var c=Z1(a.target,JHa,"current");if(null==c)a=null;else{var d=a.show_link_icon;a=new IHa(b,c,"true"===d||"false"===d?"true"===d:!0,null!=a.pause_on_navigation?a.pause_on_navigation:!0)}return a},KHa=function(a,b,c,d){this.type=a;
this.trigger=b;this.url=c;this.subscribeData=d},NHa=function(a){if(!a)return null;
var b=Z1(a.type,LHa),c=Z1(a.trigger,MHa),d=GHa(a.url);d=a2(d?d:null);a=GHa(a.subscribeData);var e=a?a:null;e?(a=Y1(e.external_user_id),e=Y1(e.subscription_token),a=a&&e?new HHa(a):null):a=null;return b?new KHa(b,c,d,a):null},OHa=function(a,b,c,d,e){this.id=a;
this.type=b;this.style=c;this.data=e;this.action=d||[]},QHa=function(a){return(a=PHa(a,function(b){return"openUrl"===b.type&&null!=b.url}))?a.url:null},PHa=function(a,b){return g.cb(a.action,b,void 0)},RHa=function(a,b){this.context=a;
this.i=b},c2=function(a){return a.customMessage?b2("div","iv-card-message",a.customMessage):""},d2=function(a,b){a="background-image: url("+a+");";
var c=[];b&&c.push(b);return{D:"div",K:"iv-card-image",V:{style:a},S:c}},e2=function(a){if(!a.metaInfo||0===a.metaInfo.length)return"";
var b=[];a=g.q(a.metaInfo);for(var c=a.next();!c.done;c=a.next())b.push(b2("li","",c.value));return{D:"ul",K:"iv-card-meta-info",S:b}},b2=function(a,b,c){b?"string"===typeof b?b={"class":b}:Array.isArray(b)&&(b={"class":b.join(" ")}):b={};
b.dir=g.Kn(c);return{D:a,V:b,oa:c}},SHa=function(a){if(!a.customMessage)return"";
var b=["iv-card-action","iv-card-primary-link"],c={};a.Yu&&(b.push("iv-card-action-icon"),c.style="background-image: url("+a.Yu+");");c.dir=g.Kn(a.customMessage);var d=[{D:"span",oa:a.customMessage}];a.showLinkIcon&&(d.push("\u00a0"),d.push({D:"span",K:"iv-card-link-icon"}));return{D:"div",Ca:b,V:c,S:d}},f2=function(a,b,c,d){if(d){b=g.q(b);
for(var e=b.next();!e.done;e=b.next())a.i(e.value,d,c.id,c.Md,c.tracking.click,5)}},THa=function(a,b){this.merchant=a;
this.price=b},UHa=function(a){var b;
(b=a)&&!(b=1<a.length?"/"===a.charAt(0)&&"/"!==a.charAt(1):"/"===a)&&(b=a.replace(/^(https?:)?\/\//,""),b=b.split("/",1),b=!b||1>b.length||!b[0]?[]:b[0].toLowerCase().split(".").reverse(),b="com"===b[0]&&"youtube"===b[1]||"be"===b[0]&&"youtu"===b[1]);return b?-1===a.indexOf("/redirect?"):!1},VHa=function(a,b){return b?b:UHa(a)?"current":"new"},g2=function(a,b){g.E.call(this);
var c=this;this.element=a;this.context=b;this.Wa=!1;this.Ga=new Map;this.Na=new Map;this.context.I.addEventListener(g.Zv("annotations_module"),function(d){(d=c.Ga.get(d))&&d.apply(c)});
this.context.I.addEventListener(g.$v("annotations_module"),function(d){(d=c.Na.get(d))&&d.apply(c)})},h2=function(a,b,c,d,e,f,h){a.context.i.Qa(b,"click",function(l){a.Sy(c,d,e,f||[],h||0,l)});
a.context.i.Qa(b,"touchstart",function(){a.Wa=!1});
a.context.i.Qa(b,"touchmove",function(){a.Wa=!0})},WHa=function(a){if(a.urlEndpoint&&a.urlEndpoint.url)return a.urlEndpoint.url;
if(a.watchEndpoint&&a.watchEndpoint.videoId){var b="/watch?v="+a.watchEndpoint.videoId;a.watchEndpoint.playlistId&&(b+="&list="+a.watchEndpoint.playlistId);a.watchEndpoint.index&&(b+="&index="+a.watchEndpoint.index);a.watchEndpoint.startTimeSeconds&&(b+="&t="+a.watchEndpoint.startTimeSeconds);return b}return null},i2=function(a,b,c){return{MG:(a.impressionLoggingUrlsV2s||[]).map(function(d){return d.baseUrl||""}),
click:(c.loggingUrls||[]).map(function(d){return d.baseUrl||""}),
close:(b.dismissLoggingUrlsV2s||[]).map(function(d){return d.baseUrl||""}),
EJ:(b.impressionLoggingUrlsV2s||[]).map(function(d){return d.baseUrl||""}),
Mx:(b.clickLoggingUrlsV2s||[]).map(function(d){return d.baseUrl||""})}},l2=function(a,b,c){g2.call(this,b,c);
var d=this;this.I=a;this.eventId=null;this.Ea=this.bb=this.u=this.Qd=!1;this.ma=null;this.cards=[];this.Xa=this.L=this.Aa=this.C=this.Da=this.i=null;this.Y=[];this.J=this.Wd=this.xa=null;this.G=0;this.va=new g.J(g.Ia,c.B.zc?4E3:3E3);g.F(this,this.va);this.Va=new g.J(g.Ia);g.F(this,this.Va);this.X=new RHa(c,function(e,f,h,l,m,n){h2(d,e,f,h,l,m,n)});
this.U=new g.V({D:"div",K:"iv-drawer",V:{id:"iv-drawer"},S:[{D:"div",K:"iv-drawer-header",V:{"aria-role":"heading"},S:[{D:"span",K:"iv-drawer-header-text"},{D:"button",Ca:["iv-drawer-close-button","ytp-button"],V:{"aria-label":"Hide cards",tabindex:"0"}}]},{D:"div",K:"iv-drawer-content"}]});g.F(this,this.U);this.B=this.U.element;this.Oa=new g.CK(this.U,330);g.F(this,this.Oa);this.Za=g.te("iv-drawer-header-text",this.B);this.l=g.te("iv-drawer-content",this.B);this.addCueRange(0,1E3*c.videoData.lengthSeconds,
"",function(){d.bb&&j2(d,"YOUTUBE_DRAWER_AUTO_OPEN")},function(){(d.bb=d.u)&&k2(d)})},XHa=function(a,b){b=b.data;
b.autoOpenMs&&a.addCueRange(b.autoOpenMs,0x8000000000000,"",function(){j2(a,"YOUTUBE_DRAWER_AUTO_OPEN")});
b.autoCloseMs&&a.addCueRange(b.autoCloseMs,0x8000000000000,"",function(){k2(a)});
var c=b.headerText;g.Oe(a.Za,c);a.L&&a.L.setAttribute("title",c);b.eventId&&(a.eventId=b.eventId);a.xa=g.Au(b.trackingParams);a.J=g.Au(b.closeTrackingParams);a.Wd=g.Au(b.iconTrackingParams)},YHa=function(a,b){var c=b.cardId?b.cardId:"cr:"+a.G;
if(b.content.simpleCardContentRenderer){if(!b.cueRanges.length)return;var d=b.content.simpleCardContentRenderer,e=b.teaser.simpleCardTeaserRenderer,f=b.icon?b.icon.infoCardIconRenderer:null;b={id:c,timestamp:a.G,type:"simple",teaserText:g.fw(e.message),teaserDurationMs:Number(b.cueRanges[0].teaserDurationMs),startMs:Number(b.cueRanges[0].startCardActiveMs),autoOpen:!!b.autoOpen,Md:m2(a,c,b,d),sponsored:!1,tracking:i2(d,e,d.command),Ik:d.trackingParams?g.Au(d.trackingParams):null,gi:e.trackingParams?
g.Au(e.trackingParams):null,Wd:f&&f.trackingParams?g.Au(f.trackingParams):null,imageUrl:n2(d.image.thumbnails,290).url,displayDomain:d.displayDomain?g.fw(d.displayDomain):null,showLinkIcon:!!d.showLinkIcon,Yu:null,title:d.title?g.fw(d.title):"",customMessage:d.callToAction?g.fw(d.callToAction):"",url:d.command.urlEndpoint.url?a2({pause_on_navigation:!a.context.videoData.isLivePlayback,target:"new",value:d.command.urlEndpoint.url}):null};o2(a,b)}else if(b.content.collaboratorInfoCardContentRenderer){if(!b.cueRanges.length)return;
d=b.content.collaboratorInfoCardContentRenderer;e=b.teaser.simpleCardTeaserRenderer;f=b.icon?b.icon.infoCardIconRenderer:null;b={id:c,timestamp:a.G,type:"collaborator",teaserText:g.fw(e.message),teaserDurationMs:Number(b.cueRanges[0].teaserDurationMs),startMs:Number(b.cueRanges[0].startCardActiveMs),autoOpen:!!b.autoOpen,Md:m2(a,c,b,d),sponsored:!1,tracking:i2(d,e,d.endpoint),Ik:d.trackingParams?g.Au(d.trackingParams):null,gi:e.trackingParams?g.Au(e.trackingParams):null,Wd:f&&f.trackingParams?g.Au(f.trackingParams):
null,channelId:d.endpoint.browseEndpoint.browseId,customMessage:d.customText?g.fw(d.customText):null,profileImageUrl:n2(d.channelAvatar.thumbnails,290).url,title:d.channelName?g.fw(d.channelName):"",metaInfo:[d.subscriberCountText?g.fw(d.subscriberCountText):""],url:a2({pause_on_navigation:!a.context.videoData.isLivePlayback,target:"new",value:d.endpoint.browseEndpoint.canonicalBaseUrl?d.endpoint.browseEndpoint.canonicalBaseUrl:"/channel/"+d.endpoint.browseEndpoint.browseId})};o2(a,b)}else if(b.content.playlistInfoCardContentRenderer){if(!b.cueRanges.length)return;
d=b.content.playlistInfoCardContentRenderer;e=b.teaser.simpleCardTeaserRenderer;f=b.icon?b.icon.infoCardIconRenderer:null;b={id:c,timestamp:a.G,type:"playlist",teaserText:g.fw(e.message),teaserDurationMs:Number(b.cueRanges[0].teaserDurationMs),startMs:Number(b.cueRanges[0].startCardActiveMs),autoOpen:!!b.autoOpen,Md:m2(a,c,b,d),sponsored:!1,tracking:i2(d,e,d.action),Ik:d.trackingParams?g.Au(d.trackingParams):null,gi:e.trackingParams?g.Au(e.trackingParams):null,Wd:f&&f.trackingParams?g.Au(f.trackingParams):
null,vu:n2(d.playlistThumbnail.thumbnails,258).url,customMessage:d.customMessage?g.fw(d.customMessage):null,playlistVideoCount:g.fw(d.playlistVideoCount),title:d.playlistTitle?g.fw(d.playlistTitle):"",metaInfo:[d.channelName?g.fw(d.channelName):"",d.videoCountText?g.fw(d.videoCountText):""],url:a2({pause_on_navigation:!a.context.videoData.isLivePlayback,target:"new",value:WHa(d.action)})};o2(a,b)}else if(b.content.videoInfoCardContentRenderer){if(!b.cueRanges.length)return;d=b.content.videoInfoCardContentRenderer;
e=b.teaser.simpleCardTeaserRenderer;f=b.icon?b.icon.infoCardIconRenderer:null;b={id:c,timestamp:a.G,type:"video",teaserText:g.fw(e.message),teaserDurationMs:Number(b.cueRanges[0].teaserDurationMs),startMs:Number(b.cueRanges[0].startCardActiveMs),autoOpen:!!b.autoOpen,Md:m2(a,c,b,d),sponsored:!1,tracking:i2(d,e,d.action),Ik:d.trackingParams?g.Au(d.trackingParams):null,gi:e.trackingParams?g.Au(e.trackingParams):null,Wd:f&&f.trackingParams?g.Au(f.trackingParams):null,vu:n2(d.videoThumbnail.thumbnails,
258).url,videoDuration:d.lengthString?g.fw(d.lengthString):null,customMessage:d.customMessage?g.fw(d.customMessage):null,title:d.videoTitle?g.fw(d.videoTitle):"",metaInfo:[d.channelName?g.fw(d.channelName):"",d.viewCountText?g.fw(d.viewCountText):""],isLiveNow:!!d.badge,url:a2({pause_on_navigation:!a.context.videoData.isLivePlayback,target:"new",value:WHa(d.action)})};o2(a,b)}a.G++},n2=function(a,b){for(var c=-1,d=-1,e=0;e<a.length;e++){if(a[e].height===b||290===a[e].width)return a[e];
((a[e].height||0)<b||290>(a[e].width||0))&&(0>c||(a[c].height||0)<(a[e].height||0)||(a[c].width||0)<(a[e].width||0))?c=e:((a[e].height||0)>=b||290<=(a[e].width||0))&&(0>d||(a[d].height||0)>(a[e].height||0)||(a[d].width||0)>(a[e].width||0))&&(d=e)}return a[0<=d?d:c]},m2=function(a,b,c,d){return{feature:c.feature?c.feature:"cards",
src_vid:a.context.videoData.videoId,annotation_id:b,ei:a.context.videoData.eventId||"",itct:d.trackingParams||""}},$Ha=function(a,b){if(b=ZHa(a,b))b===a.i&&(a.i=null),a.I.removeCueRange(b.card.id),g.Ke(b.Pz),g.kb(a.cards,b),a.bv(),p2(a)},j2=function(a,b,c){if(!a.u){a.Oa.show();
a.Da=new g.J(function(){g.K(a.context.I.getRootNode(),g.vS.IV_DRAWER_OPEN)},0);
a.Da.start();a.ma=g.oq(a.l,"mousewheel",function(h){a.va.start();h.preventDefault();h=h||window.event;var l=0;"MozMousePixelScroll"==h.type?l=0==(h.axis==h.HORIZONTAL_AXIS)?h.detail:0:window.opera?l=h.detail:l=0==h.wheelDelta%120?"WebkitTransform"in document.documentElement.style?window.chrome&&0==navigator.platform.indexOf("Mac")?h.wheelDeltaY/-30:h.wheelDeltaY/-1.2:h.wheelDelta/-1.6:h.wheelDeltaY/-3;if(h=l)a.l.scrollTop+=h});
a.u=!0;var d=g.Gu();d&&a.xa&&a.J&&g.gv(d,[a.xa,a.J]);b={TRIGGER_TYPE:b};for(var e=g.q(a.cards),f=e.next();!f.done;f=e.next())f=f.value,f.rH||(f.rH=!0,aIa(a.context.logger,f.card.tracking.MG,b)),d&&g.gv(d,[f.card.Ik]);C1(a.I);c&&(a.C=new g.J(function(){a.Aa=a.L;a.Xa.focus()},330),a.C.start())}},k2=function(a){a.u&&(a.Oa.hide(),g.pq(a.ma),a.ma=null,g.Bn(a.context.I.getRootNode(),g.vS.IV_DRAWER_OPEN),a.u=!1,C1(a.I),a.C&&a.C.stop(),a.C=new g.J(function(){a.Aa&&(a.Aa.focus(),a.Aa=null)},330),a.C.start())},
cIa=function(a){g.An(a.element,[g.vS.STOP_EVENT_PROPAGATION,
"iv-drawer-manager"]);g.LL(a.I,a.B,5);bIa(a);a.L=g.te("ytp-cards-button",a.I.getRootNode());a.Xa=g.te("iv-drawer-close-button",a.B);a.Qd=!0},bIa=function(a){var b=g.te("iv-drawer-close-button",a.B);
a.context.i.Qa(b,"click",a.iN,a);a.context.i.Qa(a.l,"touchend",function(){a.va.start()});
a.context.i.Qa(a.l,"scroll",a.tN,a);a.context.l.subscribe("onHideControls",function(){a.Ea=!0});
a.context.l.subscribe("onShowControls",function(){a.Ea=!1});
a.context.l.subscribe("onVideoAreaChange",function(){a.Ea=g.zn(a.I.getRootNode(),"ytp-autohide")});
a.Y.push(g.Wq("iv-button-shown",a.KO,a));a.Y.push(g.Wq("iv-button-hidden",a.JO,a));a.Y.push(g.Wq("iv-teaser-shown",a.LL,a));a.Y.push(g.Wq("iv-teaser-hidden",a.MO,a));a.Y.push(g.Wq("iv-teaser-clicked",a.KL,a))},o2=function(a,b){a.Qd||cIa(a);
$Ha(a,b.id);var c=dIa(a,b);if(c){var d={card:b,Pz:c.element,rH:!1},e=eIa(a,d);g.rb(a.cards,e,0,d);c.ya(a.l,e);a.bv();b.autoOpen?a.addCueRange(b.startMs,0x8000000000000,b.id,function(){a.u||(a.i=d,p2(a),fIa(a,d),j2(a,"YOUTUBE_DRAWER_AUTO_OPEN",!1))}):(c=1E3*a.context.I.getCurrentTime(),5E3>c&&c>b.startMs&&gIa(a,d),a.addCueRange(b.startMs,b.startMs+1,b.id,function(){gIa(a,d)}),p2(a))}},dIa=function(a,b){switch(b.type){case "simple":a=a.X;
var c=b.displayDomain?{D:"div",K:"iv-card-image-text",oa:b.displayDomain}:void 0;var d=SHa(b);c={D:"div",Ca:["iv-card"],S:[{D:"a",K:"iv-click-target",V:{href:b.url?$1(b.url)||"":""},S:[d2(b.imageUrl,c),{D:"div",K:"iv-card-content",S:[b2("h2",void 0,b.title),d]}]}]};c=new g.V(c);f2(a,g.se("iv-click-target",c.element),b,b.url);return c;case "collaborator":return a=a.X,c={D:"div",Ca:["iv-card","iv-card-channel"],S:[{D:"a",Ca:["iv-click-target"],V:{href:$1(b.url)||"","data-ytid":b.channelId},S:[d2(b.profileImageUrl),
{D:"div",K:"iv-card-content",S:[c2(b),{D:"h2",K:"iv-card-primary-link",oa:b.title},e2(b)]}]}]},c=new g.V(c),f2(a,g.se("iv-click-target",c.element),b,b.url),c;case "playlist":return a=a.X,c={D:"div",Ca:["iv-card","iv-card-playlist"],S:[{D:"a",K:"iv-click-target",V:{href:$1(b.url)||""},S:[d2(b.vu,{D:"div",K:"iv-card-image-overlay",S:[{D:"span",K:"iv-card-playlist-video-count",oa:b.playlistVideoCount}]}),{D:"div",K:"iv-card-content",S:[c2(b),b2("h2","iv-card-primary-link",b.title),e2(b)]}]}]},c=new g.V(c),
f2(a,g.se("iv-click-target",c.element),b,b.url),c;case "productListing":a=a.X;var e=!g.gb(b.offers);c=["iv-card"];d="";var f=SHa(b);e&&(c.push("iv-card-product-listing"),d="iv-card-primary-link",f=b.offers[0],e=[],f.price&&e.push({D:"div",K:"iv-card-offer-price",oa:f.price}),f.merchant&&e.push({D:"div",K:"iv-card-offer-merchant",oa:f.merchant}),f={D:"div",S:e});e=b.url?$1(b.url)||"":"";c={D:"div",Ca:c,V:{tabindex:"0"},S:[{D:"a",Ca:["iv-card-image","iv-click-target"],V:{style:"background-image: url("+
b.imageUrl+");",href:e,"aria-hidden":"true",tabindex:"-1"}},{D:"div",K:"iv-card-content",S:[b.sponsored?{D:"div",K:"iv-card-sponsored",S:["Sponsored",{D:"div",K:"iv-ad-info-container",S:[{D:"div",K:"iv-ad-info",oa:"{{adInfo}}"},{D:"div",K:"iv-ad-info-icon-container",S:[{D:"div",K:"iv-ad-info-icon"},{D:"div",K:"iv-ad-info-callout"}]}]}]}:"",{D:"a",K:"iv-click-target",V:{href:e},S:[b2("h2",d,b.title),f]}]}]};c=new g.V(c);d=g.Ge("span");g.Oe(d,"You are seeing this product because we think it is relevant to the video. Google may be compensated by the merchant.");
c.Tc(d,"adInfo");f2(a,g.se("iv-click-target",c.element),b,b.url);return c;case "video":return a=a.X,d=b.videoDuration?{D:"span",K:"iv-card-video-duration",oa:b.videoDuration}:void 0,f=b.isLiveNow?{D:"span",Ca:["yt-badge","yt-badge-live"],oa:"LIVE NOW"}:null,d={D:"div",Ca:["iv-card","iv-card-video"],S:[{D:"a",K:"iv-click-target",V:{href:(null===(c=b.url)||void 0===c?void 0:$1(c))||""},S:[d2(b.vu,d),{D:"div",K:"iv-card-content",S:[c2(b),b2("h2","iv-card-primary-link",b.title),e2(b),f]}]}]},c=new g.V(d),
f2(a,g.se("iv-click-target",c.element),b,b.url),c;default:return null}},eIa=function(a,b){if(0===a.cards.length)return 0;
a=g.db(a.cards,function(c){return b.card.startMs>c.card.startMs||b.card.startMs===c.card.startMs&&b.card.timestamp>=c.card.timestamp?!0:!1});
return-1===a?0:a+1},hIa=function(a){return a.i?"productListing"===a.i.card.type:g.eh(a.cards,function(b){return"productListing"===b.card.type})},p2=function(a){g.L(a.I.getRootNode(),"ytp-cards-shopping-active",hIa(a))},gIa=function(a,b){if(!g.zn(a.I.getRootNode(),"ytp-cards-teaser-shown")){if(a.i!==b){var c=g.Gu(),d=a.i?a.i.card.Wd:a.Wd;
c&&d&&g.hv(c,[d]);a.i=b;p2(a)}if(c="none"!=a.element.style.display)g.S(a.context.I.T().experiments,"html5_enable_single_video_vod_ivar_on_pacf")||2!==a.context.I.getPresentingPlayerType()?(c=a.context.I.getPlayerState(),d=0===c&&0===a.context.I.getCurrentTime(),c=1===c||3===c||d):c=1===a.context.I.getAdState();c&&b.card.teaserDurationMs&&a.I.Lq(!0,{teaserText:b.card.teaserText,durationMs:b.card.teaserDurationMs});a.Va.isActive()||((!a.u||!a.va.isActive()&&a.Ea)&&fIa(a,b),a.Va.start(910+b.card.teaserDurationMs))}},
fIa=function(a,b){a.U.vb?(b=new H1([0,
a.l.scrollTop],[0,b.Pz.offsetTop],600,qHa),a.context.u.Qa(b,"animate",function(c){a.l.scrollTop=c.y}),a.context.u.Qa(b,"finish",function(c){a.l.scrollTop=c.y}),b.play()):(g.TJ(a.U,!0),a.l.scrollTop=b.Pz.offsetTop,g.TJ(a.U,!1))},q2=function(a){return a.i&&a.i.card?a.i.card:a.cards[0]&&a.cards[0].card?a.cards[0].card:null},ZHa=function(a,b){return g.cb(a.cards,function(c){return c.card.id===b})},r2=function(a,b,c){g2.call(this,a,b);
this.annotation=c;this.isActive=!1},iIa=function(a){var b=a.annotation.data;
"start_ms"in b&&"end_ms"in b&&a.addCueRange(b.start_ms,b.end_ms,a.annotation.id,function(){a.show()},function(){a.hide()})},s2=function(a,b,c){r2.call(this,a,b,c);
this.l=null;this.J=!1;this.u=null;this.B=!1;this.i=this.G=this.C=null},jIa=function(a,b){var c=void 0===c?0:c;
var d=oHa(b).width;g.qg(b,d);c=new J1(b,[d,b.offsetTop],[d-d-c,b.offsetTop],200,pHa);g.F(a,c);a.context.u.Qa(c,"begin",function(){g.zg(b,!0)});
c.play()},mIa=function(a,b){if(b.channel_name){var c=a.createElement({D:"div",
Ca:["iv-branding-context-name"],oa:b.channel_name}),d=a.createElement({D:"div",Ca:["iv-branding-context-subscribe"]}),e=b.standalone_subscribe_button_data;e&&(a.i=new g.eN(e.subscribeText,e.subscribeCount,e.unsubscribeText,e.unsubscribeCount,!!e.enabled,!!e.classic,b.channel_id,!!e.subscribed,e.feature,b.session_data.itct,e.signinUrl,a.context.I),a.i.ya(d));var f=a.createElement({D:"div",Ca:["iv-branding-context-subscribe-caret"]}),h=a.createElement({D:"div",Ca:["branding-context-container-inner"]});
h.appendChild(f);h.appendChild(c);h.appendChild(d);g.zg(h,!1);var l=a.createElement({D:"div",Ca:["branding-context-container-outer"]});l.appendChild(h);g.ig(l,"right",b.image_width+"px");a.element.appendChild(l);a.u=new g.J(function(){kIa(a,h,l)},500);
g.F(a,a.u);a.context.i.Qa(a.element,"mouseover",function(){lIa(a,h,l,f,b.image_height)});
a.context.i.Qa(a.element,"mouseout",function(){a.u.start()})}},lIa=function(a,b,c,d,e){a.u.stop();
if(!a.B){var f=g.yg(b);a.i||(b.style.width=g.pg(f.width,!0),c.style.width=g.pg(f.width,!0));g.ig(d,"top",f.height-Math.max(Math.min(f.height,e)/2+10,20)+"px");g.ig(d,"right","1px");a.B=!0;g.zg(b,!0);a.C=new g.J(function(){g.K(this.element,"iv-branding-active")},0,a);
a.C.start()}},kIa=function(a,b,c){g.Bn(a.element,"iv-branding-active");
a.G=new g.J(function(){g.zg(b,!1);a.i||(c.style.width=g.pg(0,!0))},250);
a.G.start();a.B=!1},nIa=function(a,b,c,d,e,f,h){this.i=a;
this.u=b;this.B=c;this.videoData=d;this.logger=e;this.I=f;this.l=h},t2=function(a,b,c){r2.call(this,a,b,c);
var d=this;this.L=this.isCollapsed=this.U=!1;this.G=5E3;this.l=this.u=this.i=this.B=null;this.J=this.createElement({D:"div",Ca:["iv-promo-contents"]});this.C=new g.J(function(){d.i.setAttribute("aria-hidden","true");g.zg(d.u,!1);g.zg(d.l,!0)},700,this);
g.F(this,this.C)},oIa=function(a){var b=a.annotation.data;
if("cta"===a.annotation.style)var c=6;else if("video"===a.annotation.style||"playlist"===a.annotation.style)c=7;a.G=b.collapsedelay_ms||a.G;var d=["iv-promo","iv-promo-inactive"];a.element.setAttribute("aria-hidden","true");a.element.setAttribute("aria-label","Promotion");a.element.tabIndex=0;var e=QHa(a.annotation),f=b.image_url;if(f){var h=a.createElement({D:"div",Ca:["iv-promo-img","iv-click-target"]});f=a.createElement({D:"img",V:{src:f,"aria-hidden":"true"}});h.appendChild(f);b.video_duration&&
!b.is_live?(f=a.createElement({D:"span",K:"iv-promo-video-duration",oa:b.video_duration}),h.appendChild(f)):b.playlist_length&&(f=a.createElement({D:"span",K:"iv-promo-playlist-length",oa:b.playlist_length.toString()}),h.appendChild(f));e&&h2(a,h,e,a.annotation.id,b.session_data,void 0,c)}e?(f=a.createElement({D:"a",K:"iv-promo-txt"}),g.gd(f,$1(e)),a.i=f):a.i=a.createElement({D:"div",K:"iv-promo-txt"});switch(a.annotation.style){case "cta":case "website":var l=a.createElement({D:"p",S:[{D:"strong",
oa:b.text_line_1}]});var m=a.createElement({D:"p",S:[{D:"span",K:"iv-promo-link",oa:b.text_line_2}]});if(f=b.text_line_3){d.push("iv-promo-website-card-cta-redesign");var n=a.createElement({D:"button",Ca:["iv-promo-round-expand-icon","ytp-button"]});f=a.createElement({D:"button",Ca:["iv-button","iv-promo-button"],S:[{D:"span",K:"iv-button-content",oa:f}]});var p=a.createElement({D:"div",K:"iv-promo-button-container"});p.appendChild(f);e&&h2(a,a.element,e,a.annotation.id,b.session_data,void 0,c)}g.K(a.i,
"iv-click-target");e&&h2(a,a.i,e,a.annotation.id,b.session_data,void 0,c);break;case "playlist":case "video":l=a.createElement({D:"p",S:[{D:"span",oa:b.text_line_1}]}),m=a.createElement({D:"p",S:[{D:"strong",oa:b.text_line_2}]}),b.is_live&&(l=m,m=a.createElement({D:"span",Ca:["yt-badge","iv-promo-badge-live"],oa:"LIVE NOW"})),g.K(a.i,"iv-click-target"),e&&h2(a,a.i,e,a.annotation.id,b.session_data,void 0,c),d.push("iv-promo-video")}l&&a.i.appendChild(l);m&&a.i.appendChild(m);a.J.appendChild(a.i);p&&
a.J.appendChild(p);c=a.createElement({D:"div",K:"iv-promo-actions"});a.l=a.createElement({D:"button",Ca:["iv-promo-expand","ytp-button"]});a.l.title="Expand";a.context.i.Qa(a.l,"click",function(r){u2(a,5E3,r)});
c.appendChild(a.l);g.zg(a.l,!1);a.context.i.Qa(a.element,"mouseover",a.YN,a);a.context.i.Qa(a.element,"mouseout",a.XN,a);a.context.i.Qa(a.element,"touchend",function(r){u2(a,5E3,r)});
a.u=a.createElement({D:"button",Ca:["iv-promo-close","ytp-button"]});a.u.title="Close";a.context.i.Qa(a.u,"click","cta"===a.annotation.style&&b.text_line_3?a.UN:a.TN,a);c.appendChild(a.u);g.An(a.element,d);h&&(a.element.appendChild(h),n&&h.appendChild(n));a.element.appendChild(a.J);a.element.appendChild(c)},u2=function(a,b,c){c.stopPropagation();
pIa(a);qIa(a,b);a.i.focus()},rIa=function(a){a.isCollapsed||a.L||a.B||(g.K(a.element,"iv-promo-collapsed"),a.isCollapsed=!0,a.C.start())},pIa=function(a){a.C.stop();
a.isCollapsed&&(g.Cn(a.element,["iv-promo-collapsed","iv-promo-collapsed-no-delay"]),a.isCollapsed=!1,a.i&&a.i.removeAttribute("aria-hidden"),g.zg(a.l,!1),g.zg(a.u,!0))},qIa=function(a,b){a.B||(a.B=g.Km(function(){v2(this);
rIa(this)},b,a))},v2=function(a){a.B&&(g.A.clearTimeout(a.B),a.B=null)},sIa=function(a){this.I=a},aIa=function(a,b,c){b&&(c?w2(a,b.map(function(d){return g.ln(d,c)})):w2(a,b))},w2=function(a,b,c,d){var e=1,f=void 0,h=-1;
if(c){var l=!1;f=function(){e--;e||l||(clearTimeout(h),l=!0,c())};
h=setTimeout(function(){l=!0;c()},1E3)}b=g.q(b||[]);
for(var m=b.next();!m.done;m=b.next())m=m.value,e++,g.Pq(m,f);d&&(e++,0!==d&&a.I.sendVideoStatsEngageEvent(d,f))},x2=function(a){g.YL.call(this,a);
var b=this;this.U=!1;this.loadNumber=0;this.J={};this.logger=new sIa(this.player);this.C=new g.NL(this);this.G=this.u=null;this.events=new g.NL(this);this.L=this.i=null;this.Y=[];g.F(this,this.C);this.C.N(this.player,"onVideoAreaChange",function(){b.W("onVideoAreaChange")});
this.C.N(this.player,"onHideControls",function(){b.W("onHideControls")});
this.C.N(this.player,"onShowControls",function(){b.W("onShowControls")});
this.C.N(this.player,"resize",function(d){b.W("resize",d)});
this.C.N(this.player,"presentingplayerstatechange",function(d){b.W("presentingplayerstatechange",d)});
this.subscribe("presentingplayerstatechange",this.ML,this);this.subscribe("resize",this.Zw,this);this.player.T().U.subscribe("vast_info_card_add",this.GI,this);g.F(this,this.events);this.X=this.createElement({D:"div",K:"video-custom-annotations"});this.l=new g.V({D:"div",Ca:["ytp-player-content","ytp-iv-player-content"]});g.F(this,this.l);g.LL(this.player,this.l.element,4);this.l.hide();this.B=new g.V({D:"div",Ca:["ytp-iv-video-content"]});g.F(this,this.B);a=this.createElement({D:"div",K:"video-annotations"});
a.appendChild(this.X);this.B.element.appendChild(a);this.kp()&&this.load();var c=this.createElement({D:"style"});(document.getElementsByTagName("HEAD")[0]||document.body).appendChild(c);g.Ai(this,function(){g.Ke(c)});
if(a=c.sheet)a.insertRule(".iv-promo .iv-promo-contents .iv-promo-txt .iv-promo-link:after {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUBAMAAAB/pwA+AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAHlBMVEVMaXH////////////////////////////////////Z6AnKAAAACXRSTlMA+/A2IuI1mJIldm0CAAAAAWJLR0QB/wIt3gAAAEVJREFUCNdjYGCYCQUMBJlACOIzIDElIcyZkwxgojOVWWDMSQauMKYySySUOSnBdSaUOZ0lEsac2YqwYiZ+JhwgM7E5HACgzVCI/YJ59AAAAABJRU5ErkJggg==) no-repeat center;background-size:10px;width:10px;height:10px}",
0),a.insertRule(".iv-promo .iv-promo-actions .iv-promo-close:after {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJBAMAAAASvxsjAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAJFBMVEVMaXH///////////////////////////////////////////9tKdXLAAAAC3RSTlMAVaQDpaimqQbl5rjXUFUAAAABYktHRAH/Ai3eAAAAPUlEQVQI12MQMmAwEmDwDmaOTmAw39663YCBuXp2MQMDQ+fOBgYG5ujVwQwMptvbgeLaxczVCQwiBgxmAgBkXg1FN5iwiAAAAABJRU5ErkJggg==) no-repeat center;background-size:9px;width:9px;height:9px}",
0),a.insertRule(".iv-promo .iv-promo-actions .iv-promo-expand:after {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAJBAMAAADnQZCTAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAJFBMVEVMaXHMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMz////eMKB4AAAAC3RSTlMAOpE7k5Uvj5kpfRaQSaQAAAABYktHRAsf18TAAAAAHklEQVQI12MQYGBQZmBwTWCo0GSo6AKRQDZQRIABADXXA/UkIpvtAAAAAElFTkSuQmCC) no-repeat center;background-size:4px 9px;width:4px;height:9px}",0),a.insertRule(".iv-promo-website-card-cta-redesign .iv-promo-round-expand-icon:after {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAQAAAD9CzEMAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgCgUUEztsNfqrAAAAXklEQVRYw+3Uuw2AQAwEUUNXfBpDIvBRMhQwJJAScNrA0r4CdiQHjjAzK4NGKucPAFmCnZcmwcTphBNO9CTGH4VB+/Zm6YlYis9fhedXz38FNvFriCCl808iw8ysrBu65gCeuV/CfgAAAABJRU5ErkJggg==) no-repeat center;background-size:18px 18px;width:18px;height:18px}",
0),a.insertRule(".iv-card-link-icon {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEVMaXG7u7u7u7u7u7u7u7u7u7u7u7v///+WKTAlAAAABnRSTlMAFdQWbGj9GiOuAAAAAWJLR0QHFmGI6wAAAEhJREFUCNdjYACBNCBgQGMxMKrBWEJJaRAJRjVlKEsoSQDIAqtSZICwgEIQFkgIZBRECMxiBqsCsVjAqsCygQwwFgMeFgQgswBg2xjLrfC4mgAAAABJRU5ErkJggg==) no-repeat center;background-size:9px;width:9px;height:9px}",0),a.insertRule(".iv-card-playlist-video-count:after {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAJFBMVEVMaXH///////////////////////////////////////////9tKdXLAAAAC3RSTlMAvDeyLvxYtDK9Ogx4T1QAAAABYktHRAH/Ai3eAAAAK0lEQVQY02NgoBjshgO8HJoYwKiAMGAD92YHJM7uMCTO9gaEHs4FlPuZAQC8Fj8x/xHjxwAAAABJRU5ErkJggg==) no-repeat center;background-size:24px;width:24px;height:24px}",
0),a.insertRule(".iv-drawer-close-button:after {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMAgMAAAArG7R0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACVBMVEVMaXH////////OZTV/AAAAAnRSTlMAoKBFbtAAAAABYktHRAH/Ai3eAAAAKUlEQVQI12MIYGBlSGGQBMIUBjbHCQyM0xwYGDIZwBjEBomB5EBqgGoBolQGzYuy51cAAAAASUVORK5CYII=) no-repeat center;background-size:12px;width:12px;height:12px}",0),a.insertRule(".iv-ad-info-icon {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAMAAACecocUAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAVFBMVEVMaXGUlJSYmJiZmZmYmJiXl5eZmZmZmZmWlpaVlZWOjo6ZmZmSkpKXl5eYmJiYmJiZmZmZmZmZmZmZmZmYmJiJiYmXl5eZmZmYmJiWlpaZmZn///+81lbeAAAAGnRSTlMAE5DM80DliTMMEjccWIM5p1UjaTQNgB5cLlr5mgUAAAABYktHRBsCYNSkAAAAVElEQVQI102NRw7AIBADhw7ppIf/PzQLJ/ZgWSNrFlDaWKMVcs6HmGLwTqjEME6CFDrAXBYIGhNh3TJEg02wHydctvFc7sbrvnXZV8/zfs3T+7u/P7CrAso35YfPAAAAAElFTkSuQmCC) no-repeat center;background-size:11px;width:11px;height:11px}",
0),a.insertRule(".annotation-close-button {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAALVBMVEVMaXEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/Pz9aWloBAQGZmZlbW1v///+X9wUzAAAACHRSTlMANprf+g6lyRmB9hUAAAABYktHRA5vvTBPAAAAWUlEQVQI12NgYBAycVZkAIKwDiBIZWBgrQAx2gMY2DrAIIFBomPWju6VHY0MGh1rbu891dHEYNGx9+yd2x3NDB4d3XfO7uhoQTDgUnDFcO1wA+FWwC2FOQMAdKg6tUSAFEAAAAAASUVORK5CYII=) no-repeat center}",0),a.insertRule(".annotation-link-icon {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAMAAAANmfvwAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAUVBMVEVMaXH////////////////////////////////////////////////////////////////////////////////////////////////////////JzkR1AAAAGnRSTlMAfXf+c3xsdGdv/GJoXPtXXflSVk5L7DBH9VeFfsQAAAABYktHRAH/Ai3eAAAAgElEQVQ4y93SSQ6AIAwFULSOOOJs739Qf9SF0VA2uNCu+psHaQJK7cVCqY+Rg92PXA++Q84KnCR03UIRJrFEKMEgZYFQhpyzQHSBWJJAdIVUENtJ3SC0mu3EdOh7zXZiBrRdzQLJ0Y1GfOlpVstD3HaZktX9X/gvRCxvxL6FR7IBS1RTM5xIpLoAAAAASUVORK5CYII=) no-repeat center}",
0)},tIa=function(a){a=a.createElement({D:"div",
Ca:["annotation","annotation-type-custom"]});g.zg(a,!1);return a},uIa=function(a,b){b=!b.isCued()&&!g.U(b,1024);
g.TJ(a.l,b);g.TJ(a.B,b)},vIa=function(a,b,c){a.U=!0;
a.G=g.sp(b,c)},wIa=function(a,b){for(var c={},d=g.q(b.attributes),e=d.next();!e.done;e=d.next())e=e.value,c[e.name]=e.nodeValue;
for(d=0;d<b.childNodes.length;d++)if(e=b.childNodes[d],g.Ma(e)&&1==e.nodeType){if(c[e.tagName])var f=c[e.tagName];else if("data"===e.tagName){0<e.childNodes.length&&(f=e.childNodes[0].nodeValue,c[e.tagName]="string"===typeof f?f.trim():f);continue}else f=[],c[e.tagName]=f;e&&"TEXT"===e.tagName?1===e.childNodes.length&&3===e.childNodes[0].nodeType?f.push(e.childNodes[0].nodeValue):f.push(""):e&&f.push(wIa(a,e))}return c},zIa=function(a){var b=a.player.getVideoData();
if(b.xa){var c=a.player.T().U.get(b.videoId);if(c){var d={format:"XML",urlParams:{},method:"POST",withCredentials:!0,onFinish:function(e,f,h){e=b.videoId;a.loaded&&a.loadNumber===a.loadNumber&&a.player.getVideoData().videoId===e&&(h=g.kp(h)&&h.responseXML?h.responseXML:null)&&y2(a,h)}};
g.Gq()&&(d.onFinish=xIa(a,d.onFinish));d.postParams={ic_only:"1"};yIa(d,c);a.U=!0;g.sp(b.xa,d)}}},yIa=function(a,b){a.method="POST";
a.postParams=a.postParams||{};b.Sr&&(a.postParams.ic_coll=b.Sr);b.ov&&(a.postParams.ic_xml=b.ov);b.yu&&(a.postParams.ic_track=b.yu)},AIa=function(a){var b=new g.V({D:"div"});
g.zg(b.element,!1);var c=new l2(a.player,b.element,z2(a));g.F(c,b);b.ya(a.l.element);c.Xt();return c},z2=function(a){if(!a.L){var b=new K1(a);
g.F(a,b);var c=new g.l0(a);g.F(a,c);a.L=new nIa(b,c,a.player.T(),a.player.getVideoData(),a.logger,a.player,a.Zc)}return a.L},y2=function(a,b){var c=!1,d=b.getElementsByTagName("annotations");
if(d&&!(1>d.length)&&(d=d[0].getAttribute("itct"))){var e=g.Gu();if(e){var f=g.Eu();f&&g.Zu(g.Mo("use_default_events_client")?void 0:g.$t,e,f,[g.Au(d)])}}b=b.getElementsByTagName("annotation");for(d=0;d<b.length;d++){f=wIa(a,b[d]);e=null;try{if(f){var h=f.id,l=/.+/;var m="string"===typeof h&&null!=l&&null!=h&&h.match(l)?h:"";var n=Z1(f.type,BIa),p=Z1(f.style,CIa),r=Y1(f.data),t=0!==r.length?JSON.parse(r):{};var u=f.action;f=NHa;if(null==u)var x=null;else if(g.La(u)){l=[];for(var y=g.q(u),B=y.next();!B.done;B=
y.next()){var G=f(B.value);G&&l.push(G)}x=l}else{var H=f(u);x=H?[H]:[]}e=m&&n?new OHa(m,n,p,x,t):null}else e=null}catch(Ya){}if(e)if("branding"===e.type||"promotion"===e.type){f=a;l=e;var I=tIa(f),M=null;switch(l.type){case "branding":if(f.player.T().ub)break;f.l.element.appendChild(I);M=new s2(I,z2(f),l);break;case "promotion":g.LL(f.player,I,4),M=new t2(I,z2(f),l)}M&&M.Xt();if(f=M)g.F(a,f),a.J[e.id]=f}else if("card"===e.type||"drawer"===e.type){a.i||(a.i=AIa(a),g.F(a,a.i));if("card"===e.type){c=
a.i;var O=e&&e.data&&e.data.card_type;f=e.data;if(O)switch(l=f.tracking||{},l={MG:l.impression,click:l.click,close:l.close,EJ:l.teaser_impression,Mx:l.teaser_click},I=f.tracking_params||{},M=null,O){case "collaborator":e={id:e.id,timestamp:f.timestamp||0,type:f.card_type,teaserText:f.teaser_text,teaserDurationMs:f.teaser_duration_ms,startMs:f.start_ms,autoOpen:f.auto_open||!1,Md:f.session_data||{},sponsored:f.sponsored||!1,tracking:l,Ik:I.card?g.Au(I.card):null,gi:I.teaser?g.Au(I.teaser):null,Wd:I.icon?
g.Au(I.icon):null,channelId:f.channel_id,customMessage:f.custom_message?f.custom_message:null,profileImageUrl:f.image_url,title:f.title,metaInfo:f.meta_info,url:a2({pause_on_navigation:f.pause_on_navigation,target:f.target||"new",value:f.url})};o2(c,e);break;case "playlist":e={id:e.id,timestamp:f.timestamp||0,type:f.card_type,teaserText:f.teaser_text,teaserDurationMs:f.teaser_duration_ms,startMs:f.start_ms,autoOpen:f.auto_open||!1,Md:f.session_data||{},sponsored:f.sponsored||!1,tracking:l,Ik:I.card?
g.Au(I.card):null,gi:I.teaser?g.Au(I.teaser):null,Wd:I.icon?g.Au(I.icon):null,vu:f.image_url,playlistVideoCount:f.playlist_video_count,customMessage:f.custom_message?f.custom_message:null,title:f.title,metaInfo:f.meta_info,url:a2({pause_on_navigation:f.pause_on_navigation,target:f.target||"new",value:f.url})};o2(c,e);break;case "productListing":f.signin_url&&(M=a2({target:"current",value:f.signin_url}));O=[];for(var la=f.offers||[],za=0;za<la.length;za++)O.push(new THa(g.nd(la[za].merchant),g.nd(la[za].price)));
e={id:e.id,timestamp:f.timestamp||0,type:f.card_type,teaserText:f.teaser_text,teaserDurationMs:f.teaser_duration_ms,startMs:f.start_ms,autoOpen:f.auto_open||!1,Md:f.session_data||{},sponsored:f.sponsored||!1,tracking:l,Ik:I.card?g.Au(I.card):null,gi:I.teaser?g.Au(I.teaser):null,Wd:I.icon?g.Au(I.icon):null,imageUrl:f.image_url,displayDomain:f.display_domain?f.display_domain:null,showLinkIcon:!!f.show_link_icon,Yu:f.button_icon_url?f.button_icon_url:null,title:f.title,customMessage:f.custom_message?
f.custom_message:null,url:a2({pause_on_navigation:f.pause_on_navigation,target:f.target||"new",value:f.url}),L6:M,K6:f.signin_title?f.signin_title:void 0,J6:f.signin_message?f.signin_message:void 0,offers:O};o2(c,e);break;case "simple":e={id:e.id,timestamp:f.timestamp||0,type:f.card_type,teaserText:f.teaser_text,teaserDurationMs:f.teaser_duration_ms,startMs:f.start_ms,autoOpen:f.auto_open||!1,Md:f.session_data||{},sponsored:f.sponsored||!1,tracking:l,Ik:I.card?g.Au(I.card):null,gi:I.teaser?g.Au(I.teaser):
null,Wd:I.icon?g.Au(I.icon):null,imageUrl:f.image_url,displayDomain:f.display_domain?f.display_domain:null,showLinkIcon:!!f.show_link_icon,Yu:f.button_icon_url?f.button_icon_url:null,title:f.title,customMessage:f.custom_message?f.custom_message:null,url:a2({pause_on_navigation:f.pause_on_navigation,target:f.target||"new",value:f.url})};o2(c,e);break;case "video":e={id:e.id,timestamp:f.timestamp||0,type:f.card_type,teaserText:f.teaser_text,teaserDurationMs:f.teaser_duration_ms,startMs:f.start_ms,autoOpen:f.auto_open||
!1,Md:f.session_data||{},sponsored:f.sponsored||!1,tracking:l,Ik:I.card?g.Au(I.card):null,gi:I.teaser?g.Au(I.teaser):null,Wd:I.icon?g.Au(I.icon):null,vu:f.image_url,videoDuration:f.video_duration||null,customMessage:f.custom_message?f.custom_message:null,title:f.title,metaInfo:f.meta_info,isLiveNow:!!f.is_live_now,url:a2({pause_on_navigation:f.pause_on_navigation,target:f.target||"new",value:f.url})},o2(c,e)}}else XHa(a.i,e);c=!0}}c&&(C1(a.player),a.Zw())},DIa=function(a,b){var c=!1;
a.i||(a.i=AIa(a),g.F(a,a.i));for(var d=g.q(b.cards||[]),e=d.next();!e.done;e=d.next())e=e.value,e.cardRenderer&&(YHa(a.i,e.cardRenderer),c=!0);c&&(c=a.i,d=b.headerText?g.fw(b.headerText):"",g.Oe(c.Za,d),c.L&&c.L.setAttribute("title",d),c.context.videoData.eventId&&(c.eventId=c.context.videoData.eventId),c.xa=b.trackingParams?g.Au(b.trackingParams):null,c.J=b.closeButton.infoCardIconRenderer.trackingParams?g.Au(b.closeButton.infoCardIconRenderer.trackingParams):null,c.Wd=b.icon.infoCardIconRenderer.trackingParams?
g.Au(b.icon.infoCardIconRenderer.trackingParams):null,C1(a.player),a.Zw())},EIa=function(a,b,c,d,e){if(!a.player.T().ub){var f=[];
b.navigationEndpoint&&b.navigationEndpoint.browseEndpoint&&b.navigationEndpoint.browseEndpoint.browseId&&f.push(new KHa("openUrl","click",new IHa("/channel/"+b.navigationEndpoint.browseEndpoint.browseId,"new",!0,!0),null));var h=b.watermark.thumbnails[0];d={channel_name:b.channelName,end_ms:b.endTimeMs,image_height:h.height,image_type:1,image_url:h.url,image_width:h.width,is_mobile:!1,session_data:{annotation_id:c,ei:e,feature:"iv",itct:b.trackingParams,src_vid:d},start_ms:b.startTimeMs};if(b.subscribeButton&&
b.subscribeButton.subscribeButtonRenderer){d.channel_id=b.subscribeButton.subscribeButtonRenderer.channelId;var l;b=b.subscribeButton.subscribeButtonRenderer;var m,n;h=e=null;b.subscribed?(b.subscriberCountWithUnsubscribeText&&(e=g.fw(b.subscriberCountWithUnsubscribeText)),b.subscriberCountText&&(h=g.fw(b.subscriberCountText))):(b.subscriberCountText&&(e=g.fw(b.subscriberCountText)),b.subscriberCountWithSubscribeText&&(h=g.fw(b.subscriberCountWithSubscribeText)));var p=b.signInEndpoint&&b.signInEndpoint.webNavigationEndpointData&&
b.signInEndpoint.webNavigationEndpointData.url?b.signInEndpoint.webNavigationEndpointData.url:(null===(n=null===(m=null===(l=b.signInEndpoint)||void 0===l?void 0:l.commandMetadata)||void 0===m?void 0:m.webCommandMetadata)||void 0===n?void 0:n.url)||"";l={subscribeText:g.fw(b.unsubscribedButtonText),subscribeCount:e||"",unsubscribeText:g.fw(b.subscribedButtonText),unsubscribeCount:h||"",enabled:b.enabled||!1,classic:!1,subscribed:b.subscribed||!1,feature:"iv",signInUrl:p};d.standalone_subscribe_button_data=
l}f=new OHa(c,"branding","branding",f,d);l=tIa(a);a.l.element.appendChild(l);f=new s2(l,z2(a),f);f.Xt();g.F(f,f);a.J[c]=f}},xIa=function(a,b){return function(c){for(var d=[],e=0;e<arguments.length;++e)d[e-0]=arguments[e];
a.Ha()||a.Y.push(g.Dq(function(){b.apply(null,g.ma(d))}))}},FIa=function(a){return"annotation-editor"===a||"live-dashboard"===a};
g.EL.prototype.Lq=g.ca(17,function(a,b){var c=g.oM(this.rb());c&&c.Lq(a,b)});
var E1={},F1=null;g.Sa(H1,g.En);g.k=H1.prototype;g.k.getDuration=function(){return this.duration};
g.k.play=function(a){if(a||0==this.fb)this.progress=0,this.coords=this.i;else if(this.qc())return!1;G1(this);this.startTime=a=g.Ra();-1==this.fb&&(this.startTime-=this.duration*this.progress);this.endTime=this.startTime+this.duration;this.B=this.startTime;this.progress||this.Xw();this.Hh("play");-1==this.fb&&this.Hh("resume");this.fb=1;var b=g.Oa(this);b in E1||(E1[b]=this);sHa();tHa(this,a);return!0};
g.k.stop=function(a){G1(this);this.fb=0;a&&(this.progress=1);uHa(this,this.progress);this.Hh("stop");this.Bt()};
g.k.pause=function(){this.qc()&&(G1(this),this.fb=-1,this.Hh("pause"))};
g.k.ra=function(){0==this.fb||this.stop(!1);this.Hh("destroy");H1.Nd.ra.call(this)};
g.k.destroy=function(){this.dispose()};
g.k.Ry=function(){this.Hh("animate")};
g.k.Hh=function(a){this.dispatchEvent(new vHa(a,this))};
g.Sa(vHa,g.Cl);g.Sa(I1,H1);I1.prototype.u=g.Ia;I1.prototype.Ry=function(){this.u();I1.Nd.Ry.call(this)};
I1.prototype.Bt=function(){this.u();I1.Nd.Bt.call(this)};
I1.prototype.Xw=function(){this.u();I1.Nd.Xw.call(this)};
g.Sa(J1,I1);J1.prototype.u=function(){this.element.style.left=Math.round(this.coords[0])+"px";this.element.style.top=Math.round(this.coords[1])+"px"};g.v(K1,g.E);K1.prototype.Qa=function(a,b,c,d){c=(0,g.C)(c,d||this.l);a=g.oq(a,b,c);this.i.push(a);return a};
K1.prototype.tB=function(a,b,c,d){c=(0,g.C)(c,d||this.l);a=g.xq(a,b,c);this.i.push(a);return a};
K1.prototype.dc=function(a){g.pq(a);g.kb(this.i,a)};
K1.prototype.ra=function(){g.pq(this.i);this.i.length=0;g.E.prototype.ra.call(this)};g.v(O1,g.YL);g.k=O1.prototype;g.k.load=function(){g.YL.prototype.load.call(this);if(!P1(this)){var a=g.vja(this.player.getVideoData());a?(a=N1(a,xHa(this)),Q1(this,a,!1)):yHa(this)}};
g.k.unload=function(){Q1(this,null);this.u&&(this.u.abort(),this.u=null);g.YL.prototype.unload.call(this)};
g.k.Ke=function(a,b){return P1(this)?"loadCustomEndscreenRenderer"===a?(a=N1(b,"new"),Q1(this,a),!0):null:null};
g.k.getOptions=function(){return P1(this)?["loadCustomEndscreenRenderer"]:[]};
g.k.tb=function(){if(this.endscreen&&this.endscreen.elements){var a=this.player.getVideoContentRect();if(a&&0!==a.width&&0!==a.height){var b=this.player.getPlayerSize();if(b&&0!==b.width&&0!==b.height){var c=a.width/a.height;var d=0;for(var e=-1,f=0;f<GIa.length;f++){var h=Math.abs(b.width-GIa[f]);if(-1===e||d>=h)e=f,d=h}d=HIa[e];this.l&&g.ig(this.l.element,"outline-width",Math.max(b.width,b.height)+"px");for(b=0;b<this.endscreen.elements.length;++b)if(f=this.endscreen.elements[b].id,e=this.i[f],
h=this.C[f],e&&h){var l=h.width*c/h.aspectRatio;f=Math.round(l*a.height);var m=a.left+Math.round(h.left*a.width),n=a.top+Math.round(h.top*a.height);g.xg(e.element,Math.round(h.width*a.width),f);g.qg(e.element,m,n);g.Cn(e.element,IIa);m=h.left+h.width/2;h=h.top+l/2;g.K(e.element,.5>=m&&.5>=h?"ytp-ce-top-left-quad":.5<m&&.5>=h?"ytp-ce-top-right-quad":.5>=m&&.5<h?"ytp-ce-bottom-left-quad":"ytp-ce-bottom-right-quad");g.Cn(e.element,HIa);g.K(e.element,d);(e=g.re(document,"div","ytp-ce-expanding-overlay-body",
e.element)[0])&&g.ig(e,"height",f+"px")}}}}};
g.k.xd=function(a){if(this.endscreen)if("ytp-ce-in-endscreen"===a.getId())X1(this,this.endscreen.impressionUrls),(a=g.Gu())&&this.endscreen.visualElement&&g.$u(a,this.endscreen.visualElement,void 0);else{a=a.getId().substring(15);var b=this.i[a],c=this.C[a];g.K(b.element,"ytp-ce-element-show");b.element.removeAttribute("aria-hidden");b=this.player.getRootNode();g.K(b,"ytp-ce-shown");X1(this,c.impressionUrls);(b=g.Gu())&&g.$u(b,c.visualElement,void 0);this.player.T().u&&this.player.Ma("endscreenelementshown",
a)}};
g.k.Te=function(a){if("ytp-ce-in-endscreen"!==a.getId()){a=a.getId().substring(15);var b=this.i[a];g.Bn(b.element,"ytp-ce-element-show");b.element.setAttribute("aria-hidden","true");b=this.player.getRootNode();g.Bn(b,"ytp-ce-shown");this.player.T().u&&this.player.Ma("endscreenelementhidden",a)}};
g.k.jS=function(a){var b=this;a.target===window&&(new g.J(function(){for(var c=g.q(Object.values(b.i)),d=c.next();!d.done;d=c.next())g.Cn(d.value.element,["ytp-ce-force-expand","ytp-ce-element-hover","ytp-ce-element-shadow-show"])},0)).start()};
var GIa=[346,426,470,506,570,640,853,1280,1920],HIa="ytp-ce-size-346 ytp-ce-size-426 ytp-ce-size-470 ytp-ce-size-506 ytp-ce-size-570 ytp-ce-size-640 ytp-ce-size-853 ytp-ce-size-1280 ytp-ce-size-1920".split(" "),IIa=["ytp-ce-top-left-quad","ytp-ce-top-right-quad","ytp-ce-bottom-left-quad","ytp-ce-bottom-right-quad"];var JHa={iX:"current",H1:"new"};var LHa={CLOSE:"close",Y1:"openUrl",MM:"subscribe"},MHa={aV:"click",CLOSE:"close",vY:"hidden",n3:"rollOut",o3:"rollOver",b4:"shown"};var CIa={uU:"anchored",oK:"branding",CHANNEL:"channel",gX:"cta",yY:"highlightText",vZ:"label",PLAYLIST:"playlist",I2:"popup",k4:"speech",MM:"subscribe",B4:"title",VIDEO:"video",J5:"website"},BIa={oK:"branding",NU:"card",uX:"drawer",xY:"highlight",V_:"marker",Q2:"promotion",TEXT:"text",P5:"widget"};g.v(g2,g.E);g.k=g2.prototype;g.k.addCueRange=function(a,b,c,d,e){a=new g.Wv(a,b,{id:c});a.namespace="annotations_module";d&&this.Ga.set(a,d);e&&this.Na.set(a,e);this.context.I.Bd([a])};
g.k.Xt=function(){this.context.l.subscribe("resize",this.bv,this)};
g.k.Sy=function(a,b,c,d,e,f){if(this.Wa)return!1;f&&(f.stopPropagation(),f.preventDefault());this.navigate(a,c,d,e);return!1};
g.k.show=function(){};
g.k.hide=function(){};
g.k.destroy=function(){g.Ke(this.element)};
g.k.bv=function(){};
g.k.navigate=function(a,b,c,d){var e=this,f=$1(a);if(f){var h=VHa(f,a.target),l=function(){a.i&&e.context.I.pauseVideo();var m=e.context.videoData.C||!1,n=g.Zo(f||"");m&&n&&(n.v||n.list)?e.context.I.ej(n.v,b,n.list,!1):g.DI(f||"","current"===h?"_top":void 0,b)};
"new"===h&&(l(),l=null);w2(this.context.logger,c,l,d);UHa(f)||(c=g.Gu(),d=b.itct,c&&d&&g.iv(c,g.Au(d)))}};
g.k.ra=function(){this.Ga.clear();this.Na.clear();g.E.prototype.ra.call(this)};
g.k.createElement=function(a){a=new g.V(a);g.F(this,a);return a.element};g.v(l2,g2);g.k=l2.prototype;g.k.isAvailable=function(){var a;if(a=!!this.cards.length)(a=this.I.getRootNode())?(a=g.yg(a),a=173<a.width&&173<a.height):a=!1;return a};
g.k.bv=function(){var a=this.isAvailable();g.zg(this.element,a);g.L(this.context.I.getRootNode(),g.vS.IV_DRAWER_ENABLED,a);C1(this.I)};
g.k.destroy=function(){this.I.Lq(!1);try{this.I.getRootNode().removeChild(this.B)}catch(a){}g.Xq(this.Y);g.pq(this.ma);this.Da&&this.Da.dispose();this.C&&this.C.dispose();g2.prototype.destroy.call(this)};
g.k.iN=function(){if(this.u){w2(this.context.logger,q2(this).tracking.close);var a=g.Gu();a&&this.J&&g.iv(a,this.J);k2(this)}};
g.k.tN=function(){g.L(this.B,"iv-drawer-scrolled",0<this.l.scrollTop)};
g.k.KO=function(){var a=g.Gu(),b=q2(this);b=b?b.Wd:this.Wd;a&&b&&g.gv(a,[b])};
g.k.JO=function(){var a=g.Gu(),b=q2(this);b=b?b.Wd:this.Wd;a&&b&&g.hv(a,[b])};
g.k.LL=function(){var a=q2(this);w2(this.context.logger,a.tracking.EJ);var b=g.Gu();b&&a&&g.gv(b,[a.gi,a.Wd])};
g.k.MO=function(){var a=g.Gu(),b=q2(this);a&&b&&g.hv(a,[b.gi])};
g.k.KL=function(a){var b=q2(this),c=g.Gu();this.i?a?(a=this.context.logger,w2(a,b.tracking.Mx),a.I.sendVideoStatsEngageEvent(4,void 0),c&&b.gi&&g.iv(c,b.gi)):(a=this.context.logger,w2(a,b.tracking.Mx),a.I.sendVideoStatsEngageEvent(4,void 0),c&&b.Wd&&g.iv(c,b.Wd)):(a=this.context.logger,w2(a,b.tracking.Mx),a.I.sendVideoStatsEngageEvent(4,void 0),c&&this.Wd&&g.iv(c,this.Wd))};g.v(r2,g2);r2.prototype.Xt=function(){g2.prototype.Xt.call(this);iIa(this)};
r2.prototype.show=function(){g2.prototype.show.call(this);var a=g.Gu(),b=this.annotation.data;a&&b&&(b=b.session_data)&&g.gv(a,[g.Au(b.itct)])};
r2.prototype.hide=function(){g2.prototype.hide.call(this);var a=g.Gu(),b=this.annotation.data;a&&b&&(b=b.session_data)&&g.hv(a,[g.Au(b.itct)])};g.v(s2,r2);
s2.prototype.show=function(){if(!this.isActive){r2.prototype.show.call(this);if(!this.J){g.K(this.element,"iv-branding");var a=this.annotation.data;this.l=this.createElement({D:"img",Ca:["branding-img","iv-click-target"],V:{"aria-label":"Channel watermark",src:a.image_url,width:a.image_width,height:a.image_height}});g.zg(this.l,!1);var b=this.createElement({D:"div",Ca:["branding-img-container"]});b.appendChild(this.l);this.element.appendChild(b);(b=QHa(this.annotation))&&h2(this,this.l,b,this.annotation.id,
a.session_data);mIa(this,a);this.J=!0}g.zg(this.element,!0);this.isActive=!0;this.l&&jIa(this,this.l)}};
s2.prototype.hide=function(){this.isActive&&(r2.prototype.hide.call(this),g.zg(this.element,!1),this.isActive=!1)};
s2.prototype.destroy=function(){this.i&&(this.i.dispose(),this.i=null);r2.prototype.destroy.call(this)};g.v(t2,r2);g.k=t2.prototype;g.k.show=function(){this.isActive||(r2.prototype.show.call(this),this.U||(oIa(this),this.U=!0),g.zg(this.element,!0),g.Km(function(){g.Bn(this.element,"iv-promo-inactive")},100,this),this.element.removeAttribute("aria-hidden"),this.isActive=!0,v2(this),pIa(this),qIa(this,this.G))};
g.k.hide=function(){this.isActive&&(g.K(this.element,"iv-promo-inactive"),this.isActive=!1,this.element.setAttribute("aria-hidden","true"))};
g.k.Sy=function(a,b,c,d,e,f){return this.isCollapsed?!1:r2.prototype.Sy.call(this,a,b,c,d,e,f)};
g.k.YN=function(a){this.L=!0;u2(this,500,a)};
g.k.XN=function(){this.L=!1;rIa(this)};
g.k.TN=function(a){a.stopPropagation();this.hide()};
g.k.UN=function(a){a.stopPropagation();v2(this);this.isCollapsed=!0;g.K(this.element,"iv-promo-collapsed-no-delay");this.C.start()};
g.k.destroy=function(){this.C.dispose();r2.prototype.destroy.call(this)};g.v(x2,g.YL);g.k=x2.prototype;g.k.Ke=function(a,b){if(!FIa(this.player.T().playerStyle))return null;switch(a){case "loadCustomAnnotationsXml":return(a=g.k0(b))&&y2(this,a),!0;case "removeCustomAnnotationById":return b&&this.i&&($Ha(this.i,b),C1(this.player)),!0}return null};
g.k.getOptions=function(){return FIa(this.player.T().playerStyle)?["loadCustomAnnotationsXml","removeCustomAnnotationById"]:[]};
g.k.kp=function(){var a=this.player.T(),b=this.player.getVideoData();return b.C&&a.pfpChazalUi?!1:1===(a.annotationsLoadPolicy||b.annotationsLoadPolicy)&&!b.nF||a.U.get(b.videoId)||g.oG(b)||g.pG(b)?!0:!1};
g.k.Zw=function(){if(this.B){var a=this.player.Ya().getVideoContentRect(!0);g.xg(this.B.element,a.width,a.height);g.qg(this.B.element,a.left,a.top)}if(this.i){var b=this.player.Ei();a=this.i;b=b.width;g.L(a.B,"iv-drawer-small",426>=b);g.L(a.B,"iv-drawer-big",1280<=b)}};
g.k.ML=function(a){uIa(this,a.state);g.U(a.state,2)&&(this.Yg()&&this.Gj()&&2!==this.player.getPresentingPlayerType()&&this.setCardsVisible(!1),this.Lq(!1))};
g.k.load=function(){function a(h){var l=b.loadNumber;b.G=null;b.loaded&&b.loadNumber===l&&b.player.getVideoData().videoId===d&&(h=g.kp(h)&&h.responseXML?h.responseXML:null)&&(y2(b,h),g.K(b.player.getRootNode(),"iv-module-loaded"))}
var b=this;g.YL.prototype.load.call(this);uIa(this,this.player.sb());this.loadNumber++;var c=this.player.getVideoData(),d=c.videoId;g.Gq()&&(a=xIa(this,a));var e={format:"XML",onFinish:a,onError:function(){b.G=null},
urlParams:{}};c.isPharma&&(e.urlParams.pharma="1");e.method="POST";e.withCredentials=!0;var f=this.player.T().U.get(d);f&&yIa(e,f);f=f&&(f.ov||f.Sr);if(!c.Ek||f)c.xa?vIa(this,c.xa,e):(this.u=function(){b.jb(e)},this.player.addEventListener("videodatachange",this.u));
g.LL(this.player,this.B.element,4);this.Zw();(f=g.oG(c))&&DIa(this,f);(f=g.pG(c))&&f.featuredChannel&&EIa(this,f.featuredChannel,f.annotationId||"branding",c.videoId||null,c.eventId||null)};
g.k.jb=function(a){var b=this.player.getVideoData();b.xa&&(this.u&&(this.player.removeEventListener("videodatachange",this.u),this.u=null),vIa(this,b.xa,a))};
g.k.unload=function(){this.player.Ve("annotations_module");for(var a=g.q(Object.keys(this.J)),b=a.next();!b.done;b=a.next())this.J[b.value].destroy();this.L=null;this.i&&(this.i.destroy(),this.i=null,C1(this.player));this.U=!1;this.G&&(this.G.abort(),this.G=null);this.J={};this.l.hide();g.YL.prototype.unload.call(this);this.B.detach();this.u&&(this.player.removeEventListener("videodatachange",this.u),this.u=null)};
g.k.GI=function(a){a===this.player.getVideoData().videoId&&(this.loaded?zIa(this):this.load())};
g.k.Yg=function(){return!!this.i&&this.i.isAvailable()};
g.k.Gj=function(){this.Yg();return!!this.i&&this.i.u};
g.k.setCardsVisible=function(a,b,c){b=void 0===b?!1:b;this.Yg();this.i&&(a?c?j2(this.i,c,b):j2(this.i,"YOUTUBE_DRAWER_AUTO_OPEN",b):k2(this.i))};
g.k.Lq=function(a,b){this.player.W(a?"cardsteasershow":"cardsteaserhide",b)};
g.k.ra=function(){this.player.T().U.unsubscribe("vast_info_card_add",this.GI,this);g.Bn(this.player.getRootNode(),g.vS.IV_DRAWER_OPEN);for(var a=this.Y,b=0,c=a.length;b<c;b++)g.Hq(a[b]);this.Y.length=0;g.YL.prototype.ra.call(this)};
g.k.createElement=function(a){a=new g.V(a);g.F(this,a);return a.element};g.iM.annotations_module=x2;g.iM.creatorendscreen=O1;})(_yt_player);