(function(g){var window=this;'use strict';var iz1=function(z){z.publish("autonavvisibility")},TNg=function(z,p){z.AD("onAutonavCoundownStarted",p)},bz9=function(z){var p,c,B; return z==null?void 0:(p=z.playerOverlays)==null?void 0:(c=p.playerOverlayRenderer)==null?void 0:(B=c.autoplay)==null?void 0:B.playerOverlayAutoplayRenderer},co=function(z,p,c){g.Yf(z.element,"ytp-suggestion-set",!!p.videoId); var B=p.playlistId;c=p.o3(c?c:"mqdefault.jpg");var H=null,T=null;p instanceof g.Z3&&(p.lengthText?(H=p.lengthText||null,T=p.My||null):p.lengthSeconds&&(H=g.dn(p.lengthSeconds),T=g.dn(p.lengthSeconds,!0)));var b=!!B;B=b&&g.ui(B).type==="RD";var D=p instanceof g.Z3?p.isLivePlayback:null,t=p instanceof g.Z3?p.isUpcoming:null,X=p.author,x=p.shortViewCount,E=p.publishedTimeText,q=[],J=[];X&&q.push(X);x&&(q.push(x),J.push(x));E&&J.push(E);c={title:p.title,author:X,author_and_views:q.join(" \u2022 "),aria_label:p.ariaLabel|| g.RD("Watch $TITLE",{TITLE:p.title}),duration:H,timestamp:T,url:p.ZZ(),is_live:D,is_upcoming:t,is_list:b,is_mix:B,background:c?"background-image: url("+c+")":"",views_and_publish_time:J.join(" \u2022 "),autoplayAlternativeHeader:p.S0};p instanceof g.ad&&(c.playlist_length=p.playlistLength);z.update(c)},Bo=function(z){var p=z.N(),c=p.X; g.Q.call(this,{j:"a",B:"ytp-autonav-suggestion-card",C:{href:"{{url}}",target:c?p.U:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},J:[{j:"div",LH:["ytp-autonav-endscreen-upnext-thumbnail","ytp-autonav-thumbnail-small"],C:{style:"{{background}}"},J:[{j:"div",C:{"aria-label":"{{timestamp}}"},LH:["ytp-autonav-timestamp"],F3:"{{duration}}"},{j:"div",LH:["ytp-autonav-live-stamp"],F3:"Live"},{j:"div", LH:["ytp-autonav-upcoming-stamp"],F3:"Upcoming"},{j:"div",B:"ytp-autonav-list-overlay",J:[{j:"div",B:"ytp-autonav-mix-text",F3:"Mix"},{j:"div",B:"ytp-autonav-mix-icon"}]}]},{j:"div",LH:["ytp-autonav-endscreen-upnext-title","ytp-autonav-title-card"],F3:"{{title}}"},{j:"div",LH:["ytp-autonav-endscreen-upnext-author","ytp-autonav-author-card"],F3:"{{author}}"},{j:"div",LH:["ytp-autonav-endscreen-upnext-author","ytp-autonav-view-and-date-card"],F3:"{{views_and_publish_time}}"}]});this.T=z;this.suggestion= null;this.W=c;this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress)},Ho=function(z,p){p=p===void 0?!1:p; g.Q.call(this,{j:"div",B:"ytp-autonav-endscreen-countdown-overlay"});var c=this;this.G=p;this.cancelCommand=this.V=void 0;this.D=0;this.container=new g.Q({j:"div",B:"ytp-autonav-endscreen-countdown-container"});g.l(this,this.container);this.container.Ia(this.element);p=z.N();var B=p.X;this.T=z;this.suggestion=null;this.onVideoDataChange("newdata",this.T.getVideoData());this.Z(z,"videodatachange",this.onVideoDataChange);this.W=new g.Q({j:"div",B:"ytp-autonav-endscreen-upnext-container",C:{"aria-label":"{{aria_label}}", "data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},J:[{j:"div",B:"ytp-autonav-endscreen-upnext-header"},{j:"div",B:"ytp-autonav-endscreen-upnext-alternative-header",F3:"{{autoplayAlternativeHeader}}"},{j:"a",B:"ytp-autonav-endscreen-link-container",C:{href:"{{url}}",target:B?p.U:""},J:[{j:"div",B:"ytp-autonav-endscreen-upnext-thumbnail",C:{style:"{{background}}"},J:[{j:"div",C:{"aria-label":"{{timestamp}}"},LH:["ytp-autonav-timestamp"], F3:"{{duration}}"},{j:"div",LH:["ytp-autonav-live-stamp"],F3:"Live"},{j:"div",LH:["ytp-autonav-upcoming-stamp"],F3:"Upcoming"}]},{j:"div",B:"ytp-autonav-endscreen-video-info",J:[{j:"div",B:"ytp-autonav-endscreen-premium-badge"},{j:"div",B:"ytp-autonav-endscreen-upnext-title",F3:"{{title}}"},{j:"div",B:"ytp-autonav-endscreen-upnext-author",F3:"{{author}}"},{j:"div",B:"ytp-autonav-view-and-date",F3:"{{views_and_publish_time}}"},{j:"div",B:"ytp-autonav-author-and-view",F3:"{{author_and_views}}"}]}]}]}); g.l(this,this.W);this.W.Ia(this.container.element);B||this.Z(this.W.jp("ytp-autonav-endscreen-link-container"),"click",this.Rh);this.T.createClientVe(this.container.element,this,115127);this.T.createClientVe(this.W.jp("ytp-autonav-endscreen-link-container"),this,115128);this.overlay=new g.Q({j:"div",B:"ytp-autonav-overlay"});g.l(this,this.overlay);this.overlay.Ia(this.container.element);this.K=new g.Q({j:"div",B:"ytp-autonav-endscreen-button-container"});g.l(this,this.K);this.K.Ia(this.container.element); this.cancelButton=new g.Q({j:"button",LH:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-cancel-button",p.Y("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],C:{"aria-label":"Cancel autoplay"},F3:"Cancel"});g.l(this,this.cancelButton);this.cancelButton.Ia(this.K.element);this.cancelButton.listen("click",this.QP,this);this.T.createClientVe(this.cancelButton.element,this,115129);this.playButton=new g.Q({j:"a",LH:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-play-button", p.Y("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],C:{href:"{{url}}",role:"button","aria-label":"Play next video"},F3:"Play Now"});g.l(this,this.playButton);this.playButton.Ia(this.K.element);this.playButton.listen("click",this.Rh,this);this.T.createServerVe(this.playButton.element,this.playButton,!0);(p=this.T.getVideoData())&&VKz(this,p);this.X=new g.B4(function(){Dll(c)},500); g.l(this,this.X);this.h3();this.Z(z,"autonavvisibility",this.h3);this.T.Y("web_autonav_color_transition")&&(this.Z(z,"autonavchange",this.tY),this.Z(z,"onAutonavCoundownStarted",this.vr0))},iw=function(z){var p=z.T.Ub(!0,z.T.isFullscreen()); g.Yf(z.container.element,"ytp-autonav-endscreen-small-mode",z.jm(p));g.Yf(z.container.element,"ytp-autonav-endscreen-is-premium",!!z.suggestion&&!!z.suggestion.daH);g.Yf(z.T.getRootNode(),"ytp-autonav-endscreen-cancelled-state",!z.T.rJ());g.Yf(z.T.getRootNode(),"countdown-running",z.y3());g.Yf(z.container.element,"ytp-player-content",z.T.rJ());g.mm(z.overlay.element,{width:p.width+"px"});if(!z.y3()){z.T.rJ()?tKK(z,Math.round(Xb3(z)/1E3)):tKK(z);p=!!z.suggestion&&!!z.suggestion.S0;var c=z.T.rJ()|| !p;g.Yf(z.container.element,"ytp-autonav-endscreen-upnext-alternative-header-only",!c&&p);g.Yf(z.container.element,"ytp-autonav-endscreen-upnext-no-alternative-header",c&&!p);z.K.DP(z.T.rJ());g.Yf(z.element,"ytp-enable-w2w-color-transitions",xlK(z))}},Dll=function(z){var p=Xb3(z),c=Math,B=c.min; var H=z.D?Date.now()-z.D:0;c=B.call(c,H,p);tKK(z,Math.ceil((p-c)/1E3));p-c<=500&&z.y3()?z.select(!0):z.y3()&&z.X.start()},Xb3=function(z){if(z.T.isFullscreen()){var p; z=(p=z.T.getVideoData())==null?void 0:p.OD;return z===-1||z===void 0?8E3:z}return z.T.D9()>=0?z.T.D9():g.P3(z.T.N().experiments,"autoplay_time")||1E4},VKz=function(z,p){p=p.getWatchNextResponse(); var c,B;p=(c=bz9(p))==null?void 0:(B=c.nextButton)==null?void 0:B.buttonRenderer;z.V=p==null?void 0:p.navigationEndpoint;c=p==null?void 0:p.trackingParams;z.playButton&&c&&z.T.setTrackingParams(z.playButton.element,c)},xlK=function(z){var p; return!((p=z.T.getVideoData())==null||!p.watchToWatchTransitionRenderer)},tKK=function(z,p){p=p===void 0?-1:p; z=z.W.jp("ytp-autonav-endscreen-upnext-header");g.Vm(z);if(p>=0){p=String(p);var c="Up next in $SECONDS".match(RegExp("\\$SECONDS","gi"))[0],B="Up next in $SECONDS".indexOf(c);if(B>=0){z.appendChild(g.T5("Up next in $SECONDS".slice(0,B)));var H=g.i4("span");g.Xj(H,"ytp-autonav-endscreen-upnext-header-countdown-number");g.xr(H,p);z.appendChild(H);z.appendChild(g.T5("Up next in $SECONDS".slice(B+c.length)));return}}g.xr(z,"Up next")},TA=function(z,p){g.Q.call(this,{j:"div", LH:["html5-endscreen","ytp-player-content",p||"base-endscreen"]});this.created=!1;this.player=z},bw=function(z){g.Q.call(this,{j:"div", LH:["ytp-upnext","ytp-player-content"],C:{"aria-label":"{{aria_label}}"},J:[{j:"div",B:"ytp-cued-thumbnail-overlay-image",C:{style:"{{background}}"}},{j:"span",B:"ytp-upnext-top",J:[{j:"span",B:"ytp-upnext-header",F3:"Up Next"},{j:"span",B:"ytp-upnext-title",F3:"{{title}}"},{j:"span",B:"ytp-upnext-author",F3:"{{author}}"}]},{j:"a",B:"ytp-upnext-autoplay-icon",C:{role:"button",href:"{{url}}","aria-label":"Play next video"},J:[{j:"svg",C:{height:"100%",version:"1.1",viewBox:"0 0 72 72",width:"100%"}, J:[{j:"circle",B:"ytp-svg-autoplay-circle",C:{cx:"36",cy:"36",fill:"#fff","fill-opacity":"0.3",r:"31.5"}},{j:"circle",B:"ytp-svg-autoplay-ring",C:{cx:"-36",cy:"36","fill-opacity":"0",r:"33.5",stroke:"#FFFFFF","stroke-dasharray":"211","stroke-dashoffset":"-211","stroke-width":"4",transform:"rotate(-90)"}},{j:"path",B:"ytp-svg-fill",C:{d:"M 24,48 41,36 24,24 V 48 z M 44,24 v 24 h 4 V 24 h -4 z"}}]}]},{j:"span",B:"ytp-upnext-bottom",J:[{j:"span",B:"ytp-upnext-cancel"},{j:"span",B:"ytp-upnext-paused", F3:"Autoplay is paused"}]}]});this.api=z;this.cancelButton=null;this.V=this.jp("ytp-svg-autoplay-ring");this.D=this.notification=this.W=this.suggestion=null;this.X=new g.B4(this.A$,5E3,this);this.K=0;var p=this.jp("ytp-upnext-cancel");this.cancelButton=new g.Q({j:"button",LH:["ytp-upnext-cancel-button","ytp-button"],C:{tabindex:"0","aria-label":"Cancel autoplay"},F3:"Cancel"});g.l(this,this.cancelButton);this.cancelButton.listen("click",this.jE,this);this.cancelButton.Ia(p);this.cancelButton&&this.api.createClientVe(this.cancelButton.element, this,115129);g.l(this,this.X);this.api.createClientVe(this.element,this,18788);p=this.jp("ytp-upnext-autoplay-icon");this.Z(p,"click",this.TA);this.api.createClientVe(p,this,115130);this.Ih();this.Z(z,"autonavvisibility",this.Ih);this.Z(z,"mdxnowautoplaying",this.DPt);this.Z(z,"mdxautoplaycanceled",this.zhD);g.Yf(this.element,"ytp-upnext-mobile",this.api.N().K)},EX3=function(z,p){if(p)return p; if(z.api.isFullscreen()){var c;z=(c=z.api.getVideoData())==null?void 0:c.OD;return z===-1||z===void 0?8E3:z}return z.api.D9()>=0?z.api.D9():g.P3(z.api.N().experiments,"autoplay_time")||1E4},qEE=function(z,p){p=EX3(z,p); var c=Math,B=c.min;var H=(0,g.y2)()-z.K;c=B.call(c,H,p);p=p===0?1:Math.min(c/p,1);z.V.setAttribute("stroke-dashoffset",""+-211*(p+1));p>=1&&z.y3()&&z.api.getPresentingPlayerType()!==3?z.select(!0):z.y3()&&z.W.start()},V4=function(z){TA.call(this,z,"autonav-endscreen"); this.overlay=this.videoData=null;this.table=new g.Q({j:"div",B:"ytp-suggestion-panel",J:[{j:"div",LH:["ytp-autonav-endscreen-upnext-header","ytp-autonav-endscreen-more-videos"],F3:"More videos"}]});this.S=new g.Q({j:"div",B:"ytp-suggestions-container"});this.videos=[];this.D=null;this.V=this.G=!1;this.K=new Ho(this.player);g.l(this,this.K);this.K.Ia(this.element);z.getVideoData().cO?this.W=this.K:(this.W=new bw(z),g.F7(this.player,this.W.element,4),g.l(this,this.W));this.overlay=new g.Q({j:"div", B:"ytp-autonav-overlay-cancelled-state"});g.l(this,this.overlay);this.overlay.Ia(this.element);this.X=new g.or(this);g.l(this,this.X);g.l(this,this.table);this.table.Ia(this.element);this.table.show();g.l(this,this.S);this.S.Ia(this.table.element);this.hide()},Dh=function(z){var p=z.rJ(); p!==z.V&&(z.V=p,iz1(z.player),z.V?(z.K!==z.W&&z.K.hide(),z.table.hide()):(z.K!==z.W&&z.K.show(),z.table.show()))},t4=function(z,p){g.Q.call(this,{j:"button", LH:["ytp-watch-on-youtube-button","ytp-button"],F3:"{{content}}"});this.T=z;this.buttonType=this.buttonType=p;this.wF();this.buttonType===2&&g.Eo(this.element,"ytp-continue-watching-button");this.listen("click",this.onClick);this.listen("videodatachange",this.wF);this.DP(!0)},Xt=function(z,p){TA.call(this,z,"embeds-lite-endscreen"); this.T=z;this.W=p;this.T.createClientVe(this.element,this,156943);this.watchButton=new t4(z,2);g.l(this,this.watchButton);this.watchButton.Ia(this.element);this.hide()},xs=function(z){var p=z.N(),c=g.v2||g.dX?{style:"will-change: opacity"}:void 0,B=p.X,H=["ytp-modern-videowall-still"]; p.K&&H.push("ytp-videowall-show-text");g.Q.call(this,{j:"a",LH:H,C:{href:"{{url}}",target:B?p.U:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},J:[{j:"div",B:"ytp-modern-videowall-still-image",C:{style:"{{background}}"},J:[{j:"span",B:"ytp-modern-videowall-still-info-duration",F3:"{{duration}}"}]},{j:"span",B:"ytp-modern-videowall-still-info",C:{"aria-hidden":"true"},J:[{j:"span",B:"ytp-modern-videowall-still-info-bg",J:[{j:"span", B:"ytp-modern-videowall-still-info-content",C:c,J:[{j:"span",B:"ytp-modern-videowall-still-info-title",F3:"{{title}}"},{j:"span",B:"ytp-modern-videowall-still-info-author",F3:"{{author_and_views}}"},{j:"span",B:"ytp-modern-videowall-still-info-live",F3:"Live"}]}]}]},{j:"span",LH:["ytp-modern-videowall-still-listlabel-regular","ytp-modern-videowall-still-listlabel"],C:{"aria-hidden":"true"},J:[{j:"span",B:"ytp-modern-videowall-still-listlabel-icon"},"Playlist",{j:"span",B:"ytp-modern-videowall-still-listlabel-length", J:[" (",{j:"span",F3:"{{playlist_length}}"},")"]}]},{j:"span",LH:["ytp-modern-videowall-still-listlabel-mix","ytp-modern-videowall-still-listlabel"],C:{"aria-hidden":"true"},J:[{j:"span",B:"ytp-modern-videowall-still-listlabel-mix-icon"},"Mix",{j:"span",B:"ytp-modern-videowall-still-listlabel-length",F3:" (50+)"}]}]});this.suggestion=null;this.K=B;this.api=z;this.W=new g.or(this);g.l(this,this.W);this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress);this.W.Z(z,"videodatachange", this.onVideoDataChange);z.createServerVe(this.element,this);this.onVideoDataChange()},J9v=function(z){TA.call(this,z,"videowall-endscreen"); var p=this;this.T=z;this.stills=[];this.D=this.videoData=null;this.X=this.G=!1;this.S=null;g.Eo(this.element,"modern-videowall-endscreen");this.K=new g.or(this);g.l(this,this.K);this.V=new g.B4(function(){g.Eo(p.element,"ytp-show-tiles")},0); g.l(this,this.V);this.table=new g.Yj({j:"div",B:"ytp-modern-endscreen-content"});g.l(this,this.table);this.table.Ia(this.element);z.getVideoData().cO?this.W=new Ho(z,!0):this.W=new bw(z);g.l(this,this.W);g.F7(this.player,this.W.element,4);z.createClientVe(this.element,this,158789);this.hide()},E1=function(z){return g.ov(z.player)&&z.CJ()&&!z.D},qX=function(z){var p=z.rJ(); p!==z.G&&(z.G=p,iz1(z.player))},MK$=function(z){TA.call(this,z,"subscribecard-endscreen"); this.W=new g.Q({j:"div",B:"ytp-subscribe-card",J:[{j:"img",B:"ytp-author-image",C:{src:"{{profilePicture}}"}},{j:"div",B:"ytp-subscribe-card-right",J:[{j:"div",B:"ytp-author-name",F3:"{{author}}"},{j:"div",B:"html5-subscribe-button-container"}]}]});g.l(this,this.W);this.W.Ia(this.element);var p=z.getVideoData();this.subscribeButton=new g.GZ("Subscribe",null,"Unsubscribe",null,!0,!1,p.uD,p.subscribed,"trailer-endscreen",null,z,!1);g.l(this,this.subscribeButton);this.subscribeButton.Ia(this.W.jp("html5-subscribe-button-container")); this.Z(z,"videodatachange",this.Bq);this.Bq();this.hide()},J4=function(z){var p=z.N(),c=g.v2||g.dX?{style:"will-change: opacity"}:void 0,B=p.X,H=["ytp-videowall-still"]; p.K&&H.push("ytp-videowall-show-text");g.Q.call(this,{j:"a",LH:H,C:{href:"{{url}}",target:B?p.U:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},J:[{j:"div",B:"ytp-videowall-still-image",C:{style:"{{background}}"}},{j:"span",B:"ytp-videowall-still-info",C:{"aria-hidden":"true"},J:[{j:"span",B:"ytp-videowall-still-info-bg",J:[{j:"span",B:"ytp-videowall-still-info-content",C:c,J:[{j:"span",B:"ytp-videowall-still-info-title",F3:"{{title}}"}, {j:"span",B:"ytp-videowall-still-info-author",F3:"{{author_and_views}}"},{j:"span",B:"ytp-videowall-still-info-live",F3:"Live"},{j:"span",B:"ytp-videowall-still-info-duration",F3:"{{duration}}"}]}]}]},{j:"span",LH:["ytp-videowall-still-listlabel-regular","ytp-videowall-still-listlabel"],C:{"aria-hidden":"true"},J:[{j:"span",B:"ytp-videowall-still-listlabel-icon"},"Playlist",{j:"span",B:"ytp-videowall-still-listlabel-length",J:[" (",{j:"span",F3:"{{playlist_length}}"},")"]}]},{j:"span",LH:["ytp-videowall-still-listlabel-mix", "ytp-videowall-still-listlabel"],C:{"aria-hidden":"true"},J:[{j:"span",B:"ytp-videowall-still-listlabel-mix-icon"},"Mix",{j:"span",B:"ytp-videowall-still-listlabel-length",F3:" (50+)"}]}]});this.suggestion=null;this.K=B;this.api=z;this.W=new g.or(this);g.l(this,this.W);this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress);this.W.Z(z,"videodatachange",this.onVideoDataChange);z.createServerVe(this.element,this);this.onVideoDataChange()},MX=function(z){TA.call(this,z,"videowall-endscreen"); var p=this;this.T=z;this.D=0;this.stills=[];this.X=this.videoData=null;this.V=this.S=!1;this.U=null;this.K=new g.or(this);g.l(this,this.K);this.G=new g.B4(function(){g.Eo(p.element,"ytp-show-tiles")},0); g.l(this,this.G);var c=new g.Q({j:"button",LH:["ytp-button","ytp-endscreen-previous"],C:{"aria-label":"Previous"},J:[g.KB()]});g.l(this,c);c.Ia(this.element);c.listen("click",this.Lq,this);this.table=new g.Yj({j:"div",B:"ytp-endscreen-content"});g.l(this,this.table);this.table.Ia(this.element);c=new g.Q({j:"button",LH:["ytp-button","ytp-endscreen-next"],C:{"aria-label":"Next"},J:[g.uZ()]});g.l(this,c);c.Ia(this.element);c.listen("click",this.vS,this);z.getVideoData().cO?this.W=new Ho(z,!0):this.W= new bw(z);g.l(this,this.W);g.F7(this.player,this.W.element,4);z.createClientVe(this.element,this,158789);this.hide()},Ys=function(z){return g.ov(z.player)&&z.CJ()&&!z.X},mD=function(z){var p=z.rJ(); p!==z.S&&(z.S=p,iz1(z.player))},h4=function(z){TA.call(this,z,"watch-again-on-youtube-endscreen"); this.watchButton=new t4(z,1);g.l(this,this.watchButton);this.watchButton.Ia(this.element);g.EBg(z)&&(this.W=new g.UK(z),g.l(this,this.W),this.K=new g.Q({j:"div",LH:["ytp-watch-again-on-youtube-endscreen-more-videos-container"],C:{tabIndex:"-1"},J:[this.W]}),g.l(this,this.K),this.W.Ia(this.K.element),this.K.Ia(this.element));z.createClientVe(this.element,this,156914);this.hide()},Po3=function(z){g.Ms.call(this,z); var p=this;this.endScreen=null;this.K=this.W=this.D=this.X=!1;this.listeners=new g.or(this);g.l(this,this.listeners);var c=z.N(),B=z.getVideoData();B=B&&B.limitedPlaybackDurationInSeconds!==0;g.MD(g.nm(c))&&B&&!g.lg(z)?(this.K=!0,this.endScreen=new Xt(z,g.w$(z))):z.isEmbedsShortsMode()?this.endScreen=new h4(z):YE$(z)?(this.X=!0,mld(this),this.W?this.endScreen=new V4(z):c.Y("delhi_modern_endscreen")?this.endScreen=new J9v(z):this.endScreen=new MX(z)):c.y4?this.endScreen=new MK$(z):this.endScreen=new TA(z); g.l(this,this.endScreen);g.F7(z,this.endScreen.element,4);hE1(this);this.listeners.Z(z,"videodatachange",this.onVideoDataChange,this);this.listeners.Z(z,g.E5("endscreen"),function(H){p.onCueRangeEnter(H)}); this.listeners.Z(z,g.qT("endscreen"),function(H){p.onCueRangeExit(H)})},mld=function(z){var p=z.player.getVideoData(); if(!p||z.W===p.ou&&z.D===p.cO)return!1;z.W=p.ou;z.D=p.cO;return!0},YE$=function(z){z=z.N(); return z.wU&&!z.y4&&!z.disableOrganicUi},hE1=function(z){z.player.gs("endscreen"); var p=z.player.getVideoData();p=new g.Xq(Math.max((p.lengthSeconds-10)*1E3,0),0x8000000000000,{id:"preload",namespace:"endscreen"});var c=new g.Xq(0x8000000000000,0x8000000000000,{id:"load",priority:8,namespace:"endscreen"});z.player.KN([p,c])}; g.Wv.prototype.D9=g.BD(14,function(){return this.app.D9()}); g.qz.prototype.D9=g.BD(13,function(){return this.getVideoData().T_}); g.av.prototype.QU=g.BD(12,function(z){this.N_().QU(z)}); g.q$.prototype.QU=g.BD(11,function(z){this.W!==z&&(this.W=z,this.Bq())}); g.$d.prototype.QU=g.BD(10,function(z){this.overflowButton&&this.overflowButton.QU(z)}); g.av.prototype.j0=g.BD(9,function(z){this.N_().j0(z)}); g.h8.prototype.j0=g.BD(8,function(z){this.K!==z&&(this.K=z,this.Bq())}); g.$d.prototype.j0=g.BD(7,function(z){this.shareButton&&this.shareButton.j0(z)}); g.av.prototype.KL=g.BD(6,function(z){this.N_().KL(z)}); g.o0.prototype.KL=g.BD(5,function(z){this.Ss!==z&&(this.Ss=z,this.dX())}); g.av.prototype.cN=g.BD(4,function(z){this.N_().cN(z)}); g.$d.prototype.cN=g.BD(3,function(z){this.ZT!==z&&(this.ZT=z,this.Oo())});g.Y(Bo,g.Q);Bo.prototype.select=function(){this.T.oH(this.suggestion.videoId,this.suggestion.sessionData,this.suggestion.playlistId,void 0,void 0,this.suggestion.Oq||void 0)&&this.T.logClick(this.element)}; Bo.prototype.onClick=function(z){g.EB(z,this.T,this.W,this.suggestion.sessionData||void 0)&&this.select()}; Bo.prototype.onKeyPress=function(z){switch(z.keyCode){case 13:case 32:z.defaultPrevented||(this.select(),z.preventDefault())}};g.Y(Ho,g.Q);g.V=Ho.prototype;g.V.Eg=function(z){this.suggestion!==z&&(this.suggestion=z,co(this.W,z),this.playButton.updateValue("url",this.suggestion.ZZ()),iw(this))}; g.V.y3=function(){return this.D>0}; g.V.wM=function(){this.y3()||(this.D=Date.now(),Dll(this),TNg(this.T,Xb3(this)),g.Yf(this.T.getRootNode(),"countdown-running",this.y3()))}; g.V.m3=function(){this.NR();Dll(this);var z=this.W.jp("ytp-autonav-endscreen-upnext-header");z&&g.xr(z,"Up next")}; g.V.NR=function(){this.y3()&&(this.X.stop(),this.D=0)}; g.V.select=function(z){this.T.nextVideo(!1,z===void 0?!1:z);this.NR()}; g.V.Rh=function(z){g.EB(z,this.T)&&(z.currentTarget===this.playButton.element?this.T.logClick(this.playButton.element):z.currentTarget===this.W.jp("ytp-autonav-endscreen-link-container")&&(z=this.W.jp("ytp-autonav-endscreen-link-container"),this.T.logVisibility(z,!0),this.T.logClick(z)),this.V?(this.T.AD("innertubeCommand",this.V),this.NR()):this.select())}; g.V.QP=function(){this.T.logClick(this.cancelButton.element);g.CP(this.T,!0);this.cancelCommand&&this.T.AD("innertubeCommand",this.cancelCommand)}; g.V.onVideoDataChange=function(z,p){VKz(this,p);z=p.getWatchNextResponse();var c,B;z=(c=bz9(z))==null?void 0:(B=c.cancelButton)==null?void 0:B.buttonRenderer;this.cancelCommand=z==null?void 0:z.command}; g.V.vr0=function(z){if(xlK(this)){var p=this.T.getVideoData().watchToWatchTransitionRenderer,c=p==null?void 0:p.fromColorPaletteDark;p=p==null?void 0:p.toColorPaletteDark;if(c&&p){var B=this.element;B.style.setProperty("--w2w-start-background-color",g.kQ(c.surgeColor));B.style.setProperty("--w2w-start-primary-text-color",g.kQ(c.primaryTitleColor));B.style.setProperty("--w2w-start-secondary-text-color",g.kQ(c.secondaryTitleColor));B.style.setProperty("--w2w-end-background-color",g.kQ(p.surgeColor)); B.style.setProperty("--w2w-end-primary-text-color",g.kQ(p.primaryTitleColor));B.style.setProperty("--w2w-end-secondary-text-color",g.kQ(p.secondaryTitleColor));B.style.setProperty("--w2w-animation-duration",z+"ms")}g.Yf(this.element,"ytp-w2w-animate",!0)}}; g.V.tY=function(z){this.T.Y("web_autonav_color_transition")&&z!==2&&g.Yf(this.element,"ytp-w2w-animate",!1)}; g.V.h3=function(){var z=this.T.rJ();this.G&&this.EH!==z&&this.DP(z);iw(this);this.T.logVisibility(this.container.element,z);this.T.logVisibility(this.cancelButton.element,z);this.T.logVisibility(this.W.jp("ytp-autonav-endscreen-link-container"),z);this.T.logVisibility(this.playButton.element,z)}; g.V.jm=function(z){return z.width<400||z.height<459};g.Y(TA,g.Q);g.V=TA.prototype;g.V.create=function(){this.created=!0}; g.V.destroy=function(){this.created=!1}; g.V.CJ=function(){return!1}; g.V.rJ=function(){return!1}; g.V.kK=function(){return!1};g.Y(bw,g.Q);g.V=bw.prototype;g.V.A$=function(){this.notification&&(this.X.stop(),this.vy(this.D),this.D=null,this.notification.close(),this.notification=null)}; g.V.Eg=function(z){this.suggestion=z;co(this,z,"hqdefault.jpg")}; g.V.Ih=function(){this.DP(this.api.rJ());this.api.logVisibility(this.element,this.api.rJ());this.api.logVisibility(this.jp("ytp-upnext-autoplay-icon"),this.api.rJ());this.cancelButton&&this.api.logVisibility(this.cancelButton.element,this.api.rJ())}; g.V.TsH=function(){window.focus();this.A$()}; g.V.wM=function(z){var p=this;this.y3()||(g.qA("a11y-announce","Up Next "+this.suggestion.title),this.K=(0,g.y2)(),this.W=new g.B4(function(){qEE(p,z)},25),qEE(this,z),TNg(this.api,EX3(this,z))); g.Jn(this.element,"ytp-upnext-autoplay-paused")}; g.V.hide=function(){g.Q.prototype.hide.call(this)}; g.V.y3=function(){return!!this.W}; g.V.m3=function(){this.NR();this.K=(0,g.y2)();qEE(this);g.Eo(this.element,"ytp-upnext-autoplay-paused")}; g.V.NR=function(){this.y3()&&(this.W.dispose(),this.W=null)}; g.V.select=function(z){z=z===void 0?!1:z;if(this.api.N().Y("autonav_notifications")&&z&&window.Notification&&typeof document.hasFocus==="function"){var p=Notification.permission;p==="default"?Notification.requestPermission():p!=="granted"||document.hasFocus()||(this.A$(),this.notification=new Notification("Up Next",{body:this.suggestion.title,icon:this.suggestion.o3()}),this.D=this.Z(this.notification,"click",this.TsH),this.X.start())}this.NR();this.api.nextVideo(!1,z)}; g.V.TA=function(z){!g.X4(this.cancelButton.element,z.target)&&g.EB(z,this.api)&&(this.api.rJ()&&this.api.logClick(this.jp("ytp-upnext-autoplay-icon")),this.select())}; g.V.jE=function(){this.api.rJ()&&this.cancelButton&&this.api.logClick(this.cancelButton.element);g.CP(this.api,!0)}; g.V.DPt=function(z){this.api.getPresentingPlayerType();this.show();this.wM(z)}; g.V.zhD=function(){this.api.getPresentingPlayerType();this.NR();this.hide()}; g.V.m0=function(){this.NR();this.A$();g.Q.prototype.m0.call(this)};g.Y(V4,TA);g.V=V4.prototype;g.V.create=function(){TA.prototype.create.call(this);this.X.Z(this.player,"appresize",this.kc);this.X.Z(this.player,"onVideoAreaChange",this.kc);this.X.Z(this.player,"videodatachange",this.onVideoDataChange);this.X.Z(this.player,"autonavchange",this.Vb);this.X.Z(this.player,"onAutonavCancelled",this.hY);this.onVideoDataChange()}; g.V.show=function(){TA.prototype.show.call(this);(this.G||this.D&&this.D!==this.videoData.clientPlaybackNonce)&&g.CP(this.player,!1);g.ov(this.player)&&this.CJ()&&!this.D?(Dh(this),this.videoData.autonavState===2?this.player.getVisibilityState()===3?this.W.select(!0):this.W.wM():this.videoData.autonavState===3&&this.W.m3()):(g.CP(this.player,!0),Dh(this));this.kc()}; g.V.hide=function(){TA.prototype.hide.call(this);this.W.m3();Dh(this)}; g.V.kc=function(){var z=this.player.Ub(!0,this.player.isFullscreen());Dh(this);iw(this.K);g.Yf(this.element,"ytp-autonav-cancelled-small-mode",this.jm(z));g.Yf(this.element,"ytp-autonav-cancelled-tiny-mode",this.YW(z));g.Yf(this.element,"ytp-autonav-cancelled-mini-mode",z.width<=400||z.height<=360);this.overlay&&g.mm(this.overlay.element,{width:z.width+"px"});if(!this.V)for(z=0;z0&&(z= E*4,J=p<=t-2&&X>=x*4;if((x+1)/E*B/b>b/(x/(E+1)*B)&&J)X-=x*4,p+=2;else if(q)X-=E*4,z+=2;else if(J)X-=x*4,p+=2;else break}B=!1;X>=12&&c*4-X<=6&&(p>=4||z>=4)&&(B=!0);X=z*96;D=p*54;b=X/D=z-2&&x>=p-2?J=1:x%2===0&&t%2===0&&(x<2&&t<2?x===0&&t===0&&(J=2):J=2),E=g.Y0(E+this.D,c),J!==0){q=this.stills[b];q||(q=new J4(this.player),this.stills[b]=q,T.appendChild(q.element));var M=Math.floor(D*x/p),P=Math.floor(X*t/z),O=Math.floor(D*(x+J)/p)-M-4,R=Math.floor(X*(t+J)/z)-P-4;g.Rj(q.element,P,M);g.dY(q.element,R,O);g.mm(q.element,"transitionDelay",(x+t)/20+"s");g.Yf(q.element,"ytp-videowall-still-mini", J===1);g.Yf(q.element,"ytp-videowall-still-large",J>2);J=Math.max(R,O);g.Yf(q.element,"ytp-videowall-still-round-large",J>=256);g.Yf(q.element,"ytp-videowall-still-round-medium",J>96&&J<256);g.Yf(q.element,"ytp-videowall-still-round-small",J<=96);E=H[E];q.suggestion!==E&&(q.suggestion=E,J=q.api.N(),M=g.xf(q.element,"ytp-videowall-still-large")?"hqdefault.jpg":"mqdefault.jpg",co(q,E,M),g.yB(J)&&!q.api.Y("web_player_log_click_before_generating_ve_conversion_params")&&(J=E.ZZ(),M={},g.YG(q.api,"addEmbedsConversionTrackingParams", [M]),J=g.g6(J,M),q.updateValue("url",J)),(E=(E=E.sessionData)&&E.itct)&&q.api.setTrackingParams(q.element,E));b++}T.ariaBusy="false";g.Yf(this.element,"ytp-endscreen-paginate",b=b;H--)z=this.stills[H],g.t3(z.element),g.Dm(z);this.stills.length=b}}; g.V.onVideoDataChange=function(){var z=this.player.getVideoData(1);this.videoData!==z&&(z!=null&&g.Tz(z)?(this.D=0,this.videoData=z,this.y7()):this.player.KH("missg",{vid:(z==null?void 0:z.videoId)||"",cpn:(z==null?void 0:z.clientPlaybackNonce)||""}))}; g.V.vS=function(){this.D+=this.stills.length;this.y7()}; g.V.Lq=function(){this.D-=this.stills.length;this.y7()}; g.V.kK=function(){return this.W.y3()}; g.V.DB=function(z){z===1?(this.V=!1,this.X=this.videoData.clientPlaybackNonce,this.W.NR(),this.EH&&this.y7()):(this.V=!0,this.EH&&Ys(this)&&(z===2?this.W.wM():z===3&&this.W.m3()))}; g.V.VP=function(z){if(z){for(z=0;z0||z.endSeconds>0||z.mutedAutoplayDurationMode!==2);if((this.player.isEmbedsShortsMode()||this.K)&&!p)return!0;var c;var B=!!((z==null?0:g.Tz(z))||(z==null?0:(c=z.suggestions)==null?0:c.length));B=!YE$(this.player)||B;z=z.j1;c=this.player.tP();return B&&!z&&!c&&!p}; g.V.rJ=function(){return this.endScreen.rJ()}; g.V.DsI=function(){return this.rJ()?this.endScreen.kK():!1}; g.V.m0=function(){this.player.gs("endscreen");g.Ms.prototype.m0.call(this)}; g.V.load=function(){var z=this.player.getVideoData();var p=z.transitionEndpointAtEndOfStream;if(p&&p.videoId){var c=this.player.mU().DS.get("heartbeat"),B=g.Tz(z);!B||p.videoId!==B.videoId||z.Wi?(this.player.oH(p.videoId,void 0,void 0,!0,!0,p),c&&c.ST("HEARTBEAT_ACTION_TRIGGER_AT_STREAM_END","HEARTBEAT_ACTION_TRANSITION_REASON_HAS_NEW_STREAM_TRANSITION_ENDPOINT"),z=!0):z=!1}else z=!1;z||(g.Ms.prototype.load.call(this),this.endScreen.show())}; g.V.unload=function(){g.Ms.prototype.unload.call(this);this.endScreen.hide();this.endScreen.destroy()}; g.V.onCueRangeEnter=function(z){this.O$()&&(this.endScreen.created||this.endScreen.create(),z.getId()==="load"&&this.load())}; g.V.onCueRangeExit=function(z){z.getId()==="load"&&this.loaded&&this.unload()}; g.V.onVideoDataChange=function(){hE1(this);this.X&&mld(this)&&(this.endScreen&&(this.endScreen.hide(),this.endScreen.created&&this.endScreen.destroy(),this.endScreen.dispose()),this.W?this.endScreen=new V4(this.player):this.endScreen=new MX(this.player),g.l(this,this.endScreen),g.F7(this.player,this.endScreen.element,4))};g.JV("endscreen",Po3);})(_yt_player);