(function(g){var window=this;'use strict';var VuO=function(J){J.publish("autonavvisibility")},hkr=function(J,K){J.I4("onAutonavCoundownStarted",K)},vT8=function(J){var K,n,X; return J==null?void 0:(K=J.playerOverlays)==null?void 0:(n=K.playerOverlayRenderer)==null?void 0:(X=n.autoplay)==null?void 0:X.playerOverlayAutoplayRenderer},ol=function(J,K,n){g.Qq(J.element,"ytp-suggestion-set",!!K.videoId); var X=K.playlistId;n=K.rK(n?n:"mqdefault.jpg");var l=null,x=null;K instanceof g.Iu&&(K.lengthText?(l=K.lengthText||null,x=K.cX||null):K.lengthSeconds&&(l=g.Iv(K.lengthSeconds),x=g.Iv(K.lengthSeconds,!0)));var V=!!X;X=V&&g.w6(X).type==="RD";var v=K instanceof g.Iu?K.isLivePlayback:null,Q=K instanceof g.Iu?K.isUpcoming:null,S=K.author,r=K.shortViewCount,C=K.publishedTimeText,O=[],H=[];S&&O.push(S);r&&(O.push(r),H.push(r));C&&H.push(C);n={title:K.title,author:S,author_and_views:O.join(" \u2022 "),aria_label:K.ariaLabel|| g.rK("Watch $TITLE",{TITLE:K.title}),duration:l,timestamp:x,url:K.BH(),is_live:v,is_upcoming:Q,is_list:V,is_mix:X,background:n?"background-image: url("+n+")":"",views_and_publish_time:H.join(" \u2022 "),autoplayAlternativeHeader:K.u3};K instanceof g.PF&&(n.playlist_length=K.playlistLength);J.update(n)},Xy=function(J){var K=J.S(),n=K.U; g.F.call(this,{j:"a",V:"ytp-autonav-suggestion-card",D:{href:"{{url}}",target:n?K.K:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},Y:[{j:"div",UM:["ytp-autonav-endscreen-upnext-thumbnail","ytp-autonav-thumbnail-small"],D:{style:"{{background}}"},Y:[{j:"div",D:{"aria-label":"{{timestamp}}"},UM:["ytp-autonav-timestamp"],hj:"{{duration}}"},{j:"div",UM:["ytp-autonav-live-stamp"],hj:"Live"},{j:"div", UM:["ytp-autonav-upcoming-stamp"],hj:"Upcoming"},{j:"div",V:"ytp-autonav-list-overlay",Y:[{j:"div",V:"ytp-autonav-mix-text",hj:"Mix"},{j:"div",V:"ytp-autonav-mix-icon"}]}]},{j:"div",UM:["ytp-autonav-endscreen-upnext-title","ytp-autonav-title-card"],hj:"{{title}}"},{j:"div",UM:["ytp-autonav-endscreen-upnext-author","ytp-autonav-author-card"],hj:"{{author}}"},{j:"div",UM:["ytp-autonav-endscreen-upnext-author","ytp-autonav-view-and-date-card"],hj:"{{views_and_publish_time}}"}]});this.B=J;this.suggestion= null;this.G=n;this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress)},ly=function(J,K){K=K===void 0?!1:K; g.F.call(this,{j:"div",V:"ytp-autonav-endscreen-countdown-overlay"});var n=this;this.W=K;this.cancelCommand=this.N=void 0;this.X=0;this.container=new g.F({j:"div",V:"ytp-autonav-endscreen-countdown-container"});g.Z(this,this.container);this.container.qQ(this.element);K=J.S();var X=K.U;this.B=J;this.suggestion=null;this.onVideoDataChange("newdata",g.U(this.B.getVideoData()));this.T(J,"videodatachange",this.onVideoDataChange);this.G=new g.F({j:"div",V:"ytp-autonav-endscreen-upnext-container",D:{"aria-label":"{{aria_label}}", "data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},Y:[{j:"div",V:"ytp-autonav-endscreen-upnext-header"},{j:"div",V:"ytp-autonav-endscreen-upnext-alternative-header",hj:"{{autoplayAlternativeHeader}}"},{j:"a",V:"ytp-autonav-endscreen-link-container",D:{href:"{{url}}",target:X?K.K:""},Y:[{j:"div",V:"ytp-autonav-endscreen-upnext-thumbnail",D:{style:"{{background}}"},Y:[{j:"div",D:{"aria-label":"{{timestamp}}"},UM:["ytp-autonav-timestamp"], hj:"{{duration}}"},{j:"div",UM:["ytp-autonav-live-stamp"],hj:"Live"},{j:"div",UM:["ytp-autonav-upcoming-stamp"],hj:"Upcoming"}]},{j:"div",V:"ytp-autonav-endscreen-video-info",Y:[{j:"div",V:"ytp-autonav-endscreen-premium-badge"},{j:"div",V:"ytp-autonav-endscreen-upnext-title",hj:"{{title}}"},{j:"div",V:"ytp-autonav-endscreen-upnext-author",hj:"{{author}}"},{j:"div",V:"ytp-autonav-view-and-date",hj:"{{views_and_publish_time}}"},{j:"div",V:"ytp-autonav-author-and-view",hj:"{{author_and_views}}"}]}]}]}); g.Z(this,this.G);this.G.qQ(this.container.element);X||this.T(this.G.rQ("ytp-autonav-endscreen-link-container"),"click",this.t$);this.B.createClientVe(this.container.element,this,115127);this.B.createClientVe(this.G.rQ("ytp-autonav-endscreen-link-container"),this,115128);this.overlay=new g.F({j:"div",V:"ytp-autonav-overlay"});g.Z(this,this.overlay);this.overlay.qQ(this.container.element);this.Z=new g.F({j:"div",V:"ytp-autonav-endscreen-button-container"});g.Z(this,this.Z);this.Z.qQ(this.container.element); this.cancelButton=new g.F({j:"button",UM:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-cancel-button",K.J("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],D:{"aria-label":"Cancel autoplay"},hj:"Cancel"});g.Z(this,this.cancelButton);this.cancelButton.qQ(this.Z.element);this.cancelButton.listen("click",this.Q6,this);this.B.createClientVe(this.cancelButton.element,this,115129);this.playButton=new g.F({j:"a",UM:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-play-button", K.J("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],D:{href:"{{url}}",role:"button","aria-label":"Play next video"},hj:"Play Now"});g.Z(this,this.playButton);this.playButton.qQ(this.Z.element);this.playButton.listen("click",this.t$,this);this.B.createServerVe(this.playButton.element,this.playButton,!0);(K=this.B.getVideoData())&&Q3z(this,K);this.U=new g.AT(function(){$mz(n)},500); g.Z(this,this.U);this.Wl();this.T(J,"autonavvisibility",this.Wl);this.B.J("web_autonav_color_transition")&&(this.T(J,"autonavchange",this.GX),this.T(J,"onAutonavCoundownStarted",this.ImQ))},xz=function(J){var K=J.B.CI(!0,J.B.isFullscreen()); g.Qq(J.container.element,"ytp-autonav-endscreen-small-mode",J.l1(K));g.Qq(J.container.element,"ytp-autonav-endscreen-is-premium",!!J.suggestion&&!!J.suggestion.QOx);g.Qq(J.B.getRootNode(),"ytp-autonav-endscreen-cancelled-state",!J.B.Mk());g.Qq(J.B.getRootNode(),"countdown-running",J.P1());g.Qq(J.container.element,"ytp-player-content",J.B.Mk());g.c7(J.overlay.element,{width:K.width+"px"});if(!J.P1()){J.B.Mk()?SfF(J,Math.round(rZS(J)/1E3)):SfF(J);K=!!J.suggestion&&!!J.suggestion.u3;var n=J.B.Mk()|| !K;g.Qq(J.container.element,"ytp-autonav-endscreen-upnext-alternative-header-only",!n&&K);g.Qq(J.container.element,"ytp-autonav-endscreen-upnext-no-alternative-header",n&&!K);J.Z.Yr(J.B.Mk());g.Qq(J.element,"ytp-enable-w2w-color-transitions",s3n(J))}},$mz=function(J){var K=rZS(J),n=Math,X=n.min; var l=J.X?Date.now()-J.X:0;n=X.call(n,l,K);SfF(J,Math.ceil((K-n)/1E3));K-n<=500&&J.P1()?J.select(!0):J.P1()&&J.U.start()},rZS=function(J){if(J.B.isFullscreen()){var K; J=(K=J.B.getVideoData())==null?void 0:K.tp;return J===-1||J===void 0?8E3:J}return J.B.Wb()>=0?J.B.Wb():g.Qg(J.B.S().experiments,"autoplay_time")||1E4},Q3z=function(J,K){K=K.getWatchNextResponse(); var n,X;K=(n=vT8(K))==null?void 0:(X=n.nextButton)==null?void 0:X.buttonRenderer;J.N=K==null?void 0:K.navigationEndpoint;n=K==null?void 0:K.trackingParams;J.playButton&&n&&J.B.setTrackingParams(J.playButton.element,n)},s3n=function(J){var K; return!((K=J.B.getVideoData())==null||!K.watchToWatchTransitionRenderer)},SfF=function(J,K){K=K===void 0?-1:K; J=J.G.rQ("ytp-autonav-endscreen-upnext-header");g.Kf(J);if(K>=0){K=String(K);var n="Up next in $SECONDS".match(RegExp("\\$SECONDS","gi"))[0],X="Up next in $SECONDS".indexOf(n);if(X>=0){J.appendChild(g.NE("Up next in $SECONDS".slice(0,X)));var l=g.ME("span");g.lm(l,"ytp-autonav-endscreen-upnext-header-countdown-number");g.lc(l,K);J.appendChild(l);J.appendChild(g.NE("Up next in $SECONDS".slice(X+n.length)));return}}g.lc(J,"Up next")},jZ=function(J,K){g.F.call(this,{j:"div", UM:["html5-endscreen","ytp-player-content",K||"base-endscreen"]});this.created=!1;this.player=J},V7=function(J){g.F.call(this,{j:"div", UM:["ytp-upnext","ytp-player-content"],D:{"aria-label":"{{aria_label}}"},Y:[{j:"div",V:"ytp-cued-thumbnail-overlay-image",D:{style:"{{background}}"}},{j:"span",V:"ytp-upnext-top",Y:[{j:"span",V:"ytp-upnext-header",hj:"Up Next"},{j:"span",V:"ytp-upnext-title",hj:"{{title}}"},{j:"span",V:"ytp-upnext-author",hj:"{{author}}"}]},{j:"a",V:"ytp-upnext-autoplay-icon",D:{role:"button",href:"{{url}}","aria-label":"Play next video"},Y:[{j:"svg",D:{height:"100%",version:"1.1",viewBox:"0 0 72 72",width:"100%"}, Y:[{j:"circle",V:"ytp-svg-autoplay-circle",D:{cx:"36",cy:"36",fill:"#fff","fill-opacity":"0.3",r:"31.5"}},{j:"circle",V:"ytp-svg-autoplay-ring",D:{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",V:"ytp-svg-fill",D:{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",V:"ytp-upnext-bottom",Y:[{j:"span",V:"ytp-upnext-cancel"},{j:"span",V:"ytp-upnext-paused", hj:"Autoplay is paused"}]}]});this.api=J;this.cancelButton=null;this.N=this.rQ("ytp-svg-autoplay-ring");this.X=this.notification=this.G=this.suggestion=null;this.U=new g.AT(this.VN,5E3,this);this.Z=0;var K=this.rQ("ytp-upnext-cancel");this.cancelButton=new g.F({j:"button",UM:["ytp-upnext-cancel-button","ytp-button"],D:{tabindex:"0","aria-label":"Cancel autoplay"},hj:"Cancel"});g.Z(this,this.cancelButton);this.cancelButton.listen("click",this.ZD,this);this.cancelButton.qQ(K);this.cancelButton&&this.api.createClientVe(this.cancelButton.element, this,115129);g.Z(this,this.U);this.api.createClientVe(this.element,this,18788);K=this.rQ("ytp-upnext-autoplay-icon");this.T(K,"click",this.hC);this.api.createClientVe(K,this,115130);this.e6();this.T(J,"autonavvisibility",this.e6);this.T(J,"mdxnowautoplaying",this.kiM);this.T(J,"mdxautoplaycanceled",this.RLv);g.Qq(this.element,"ytp-upnext-mobile",this.api.S().Z)},CrO=function(J,K){if(K)return K; if(J.api.isFullscreen()){var n;J=(n=J.api.getVideoData())==null?void 0:n.tp;return J===-1||J===void 0?8E3:J}return J.api.Wb()>=0?J.api.Wb():g.Qg(J.api.S().experiments,"autoplay_time")||1E4},Osj=function(J,K){K=CrO(J,K); var n=Math,X=n.min;var l=(0,g.a)()-J.Z;n=X.call(n,l,K);K=K===0?1:Math.min(n/K,1);J.N.setAttribute("stroke-dashoffset",""+-211*(K+1));K>=1&&J.P1()&&J.api.getPresentingPlayerType()!==3?J.select(!0):J.P1()&&J.G.start()},h9=function(J){jZ.call(this,J,"autonav-endscreen"); this.overlay=this.videoData=null;this.table=new g.F({j:"div",V:"ytp-suggestion-panel",Y:[{j:"div",UM:["ytp-autonav-endscreen-upnext-header","ytp-autonav-endscreen-more-videos"],hj:"More videos"}]});this.L=new g.F({j:"div",V:"ytp-suggestions-container"});this.videos=[];this.X=null;this.N=this.W=!1;this.Z=new ly(this.player);g.Z(this,this.Z);this.Z.qQ(this.element);J.getVideoData().C9?this.G=this.Z:(this.G=new V7(J),g.dv(this.player,this.G.element,4),g.Z(this,this.G));this.overlay=new g.F({j:"div", V:"ytp-autonav-overlay-cancelled-state"});g.Z(this,this.overlay);this.overlay.qQ(this.element);this.U=new g.gY(this);g.Z(this,this.U);g.Z(this,this.table);this.table.qQ(this.element);this.table.show();g.Z(this,this.L);this.L.qQ(this.table.element);this.hide()},vO=function(J){var K=J.Mk(); K!==J.N&&(J.N=K,VuO(J.player),J.N?(J.Z!==J.G&&J.Z.hide(),J.table.hide()):(J.Z!==J.G&&J.Z.show(),J.table.show()))},Q7=function(J,K){g.F.call(this,{j:"button", UM:["ytp-watch-on-youtube-button","ytp-button"],hj:"{{content}}"});this.B=J;this.buttonType=this.buttonType=K;this.TG();this.buttonType===2&&g.jv(this.element,"ytp-continue-watching-button");this.listen("click",this.onClick);this.listen("videodatachange",this.TG);this.Yr(!0)},$z=function(J,K){jZ.call(this,J,"embeds-lite-endscreen"); this.B=J;this.G=K;this.B.createClientVe(this.element,this,156943);this.watchButton=new Q7(J,2);g.Z(this,this.watchButton);this.watchButton.qQ(this.element);this.hide()},SZ=function(J){var K=J.S(),n=g.T2||g.Bp?{style:"will-change: opacity"}:void 0,X=K.U,l=["ytp-modern-videowall-still"]; K.Z&&l.push("ytp-videowall-show-text");g.F.call(this,{j:"a",UM:l,D:{href:"{{url}}",target:X?K.K:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},Y:[{j:"div",V:"ytp-modern-videowall-still-image",D:{style:"{{background}}"},Y:[{j:"span",V:"ytp-modern-videowall-still-info-duration",hj:"{{duration}}"}]},{j:"span",V:"ytp-modern-videowall-still-info",D:{"aria-hidden":"true"},Y:[{j:"span",V:"ytp-modern-videowall-still-info-bg",Y:[{j:"span", V:"ytp-modern-videowall-still-info-content",D:n,Y:[{j:"span",V:"ytp-modern-videowall-still-info-title",hj:"{{title}}"},{j:"span",V:"ytp-modern-videowall-still-info-author",hj:"{{author_and_views}}"},{j:"span",V:"ytp-modern-videowall-still-info-live",hj:"Live"}]}]}]},{j:"span",UM:["ytp-modern-videowall-still-listlabel-regular","ytp-modern-videowall-still-listlabel"],D:{"aria-hidden":"true"},Y:[{j:"span",V:"ytp-modern-videowall-still-listlabel-icon"},"Playlist",{j:"span",V:"ytp-modern-videowall-still-listlabel-length", Y:[" (",{j:"span",hj:"{{playlist_length}}"},")"]}]},{j:"span",UM:["ytp-modern-videowall-still-listlabel-mix","ytp-modern-videowall-still-listlabel"],D:{"aria-hidden":"true"},Y:[{j:"span",V:"ytp-modern-videowall-still-listlabel-mix-icon"},"Mix",{j:"span",V:"ytp-modern-videowall-still-listlabel-length",hj:" (50+)"}]}]});this.suggestion=null;this.Z=X;this.api=J;this.G=new g.gY(this);g.Z(this,this.G);this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress);this.G.T(J,"videodatachange", this.onVideoDataChange);J.createServerVe(this.element,this);this.onVideoDataChange()},HsS=function(J){jZ.call(this,J,"videowall-endscreen"); var K=this;this.B=J;this.stills=[];this.X=this.videoData=null;this.U=this.W=!1;this.L=null;g.jv(this.element,"modern-videowall-endscreen");this.Z=new g.gY(this);g.Z(this,this.Z);this.N=new g.AT(function(){g.jv(K.element,"ytp-show-tiles")},0); g.Z(this,this.N);this.table=new g.Qk({j:"div",V:"ytp-modern-endscreen-content"});g.Z(this,this.table);this.table.qQ(this.element);J.getVideoData().C9?this.G=new ly(J,!0):this.G=new V7(J);g.Z(this,this.G);g.dv(this.player,this.G.element,4);J.createClientVe(this.element,this,158789);this.hide()},rR=function(J){return g.kw(J.player)&&J.v5()&&!J.X},sn=function(J){var K=J.Mk(); K!==J.W&&(J.W=K,VuO(J.player))},Rk8=function(J){jZ.call(this,J,"subscribecard-endscreen"); this.G=new g.F({j:"div",V:"ytp-subscribe-card",Y:[{j:"img",V:"ytp-author-image",D:{src:"{{profilePicture}}"}},{j:"div",V:"ytp-subscribe-card-right",Y:[{j:"div",V:"ytp-author-name",hj:"{{author}}"},{j:"div",V:"html5-subscribe-button-container"}]}]});g.Z(this,this.G);this.G.qQ(this.element);var K=J.getVideoData();this.subscribeButton=new g.b8("Subscribe",null,"Unsubscribe",null,!0,!1,K.OR,K.subscribed,"trailer-endscreen",null,J,!1);g.Z(this,this.subscribeButton);this.subscribeButton.qQ(this.G.rQ("html5-subscribe-button-container")); this.T(J,"videodatachange",this.WW);this.WW();this.hide()},Cb=function(J){var K=J.S(),n=g.T2||g.Bp?{style:"will-change: opacity"}:void 0,X=K.U,l=["ytp-videowall-still"]; K.Z&&l.push("ytp-videowall-show-text");g.F.call(this,{j:"a",UM:l,D:{href:"{{url}}",target:X?K.K:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},Y:[{j:"div",V:"ytp-videowall-still-image",D:{style:"{{background}}"}},{j:"span",V:"ytp-videowall-still-info",D:{"aria-hidden":"true"},Y:[{j:"span",V:"ytp-videowall-still-info-bg",Y:[{j:"span",V:"ytp-videowall-still-info-content",D:n,Y:[{j:"span",V:"ytp-videowall-still-info-title",hj:"{{title}}"}, {j:"span",V:"ytp-videowall-still-info-author",hj:"{{author_and_views}}"},{j:"span",V:"ytp-videowall-still-info-live",hj:"Live"},{j:"span",V:"ytp-videowall-still-info-duration",hj:"{{duration}}"}]}]}]},{j:"span",UM:["ytp-videowall-still-listlabel-regular","ytp-videowall-still-listlabel"],D:{"aria-hidden":"true"},Y:[{j:"span",V:"ytp-videowall-still-listlabel-icon"},"Playlist",{j:"span",V:"ytp-videowall-still-listlabel-length",Y:[" (",{j:"span",hj:"{{playlist_length}}"},")"]}]},{j:"span",UM:["ytp-videowall-still-listlabel-mix", "ytp-videowall-still-listlabel"],D:{"aria-hidden":"true"},Y:[{j:"span",V:"ytp-videowall-still-listlabel-mix-icon"},"Mix",{j:"span",V:"ytp-videowall-still-listlabel-length",hj:" (50+)"}]}]});this.suggestion=null;this.Z=X;this.api=J;this.G=new g.gY(this);g.Z(this,this.G);this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress);this.G.T(J,"videodatachange",this.onVideoDataChange);J.createServerVe(this.element,this);this.onVideoDataChange()},On=function(J){jZ.call(this,J,"videowall-endscreen"); var K=this;this.B=J;this.X=0;this.stills=[];this.U=this.videoData=null;this.N=this.L=!1;this.K=null;this.Z=new g.gY(this);g.Z(this,this.Z);this.W=new g.AT(function(){g.jv(K.element,"ytp-show-tiles")},0); g.Z(this,this.W);var n=new g.F({j:"button",UM:["ytp-button","ytp-endscreen-previous"],D:{"aria-label":"Previous"},Y:[g.uC()]});g.Z(this,n);n.qQ(this.element);n.listen("click",this.cz,this);this.table=new g.Qk({j:"div",V:"ytp-endscreen-content"});g.Z(this,this.table);this.table.qQ(this.element);n=new g.F({j:"button",UM:["ytp-button","ytp-endscreen-next"],D:{"aria-label":"Next"},Y:[g.e3()]});g.Z(this,n);n.qQ(this.element);n.listen("click",this.E9,this);J.getVideoData().C9?this.G=new ly(J,!0):this.G= new V7(J);g.Z(this,this.G);g.dv(this.player,this.G.element,4);J.createClientVe(this.element,this,158789);this.hide()},HO=function(J){return g.kw(J.player)&&J.v5()&&!J.U},Rl=function(J){var K=J.Mk(); K!==J.L&&(J.L=K,VuO(J.player))},uy=function(J){jZ.call(this,J,"watch-again-on-youtube-endscreen"); this.watchButton=new Q7(J,1);g.Z(this,this.watchButton);this.watchButton.qQ(this.element);g.srr(J)&&(this.G=new g.bl(J),g.Z(this,this.G),this.Z=new g.F({j:"div",UM:["ytp-watch-again-on-youtube-endscreen-more-videos-container"],D:{tabIndex:"-1"},Y:[this.G]}),g.Z(this,this.Z),this.G.qQ(this.Z.element),this.Z.qQ(this.element));J.createClientVe(this.element,this,156914);this.hide()},wQu=function(J){g.CH.call(this,J); var K=this;this.endScreen=null;this.Z=this.G=this.X=this.U=!1;this.listeners=new g.gY(this);g.Z(this,this.listeners);var n=J.S(),X=J.getVideoData();X=X&&X.limitedPlaybackDurationInSeconds!==0;g.QT(g.Gx(n))&&X&&!g.pC(J)?(this.Z=!0,this.endScreen=new $z(J,g.s2(J))):J.isEmbedsShortsMode()?this.endScreen=new uy(J):u5n(J)?(this.U=!0,ekn(this),this.G?this.endScreen=new h9(J):n.J("delhi_modern_endscreen")?this.endScreen=new HsS(J):this.endScreen=new On(J)):n.oO?this.endScreen=new Rk8(J):this.endScreen=new jZ(J); g.Z(this,this.endScreen);g.dv(J,this.endScreen.element,4);zkV(this);this.listeners.T(J,"videodatachange",this.onVideoDataChange,this);this.listeners.T(J,g.o4("endscreen"),function(l){K.onCueRangeEnter(l)}); this.listeners.T(J,g.XD("endscreen"),function(l){K.onCueRangeExit(l)})},ekn=function(J){var K=J.player.getVideoData(); if(!K||J.G===K.G0&&J.X===K.C9)return!1;J.G=K.G0;J.X=K.C9;return!0},u5n=function(J){J=J.S(); return J.C9&&!J.oO&&!J.disableOrganicUi},zkV=function(J){J.player.Uo("endscreen"); var K=J.player.getVideoData();K=new g.KG(Math.max((K.lengthSeconds-10)*1E3,0),0x8000000000000,{id:"preload",namespace:"endscreen"});var n=new g.KG(0x8000000000000,0x8000000000000,{id:"load",priority:8,namespace:"endscreen"});J.player.yA([K,n])}; g.It.prototype.Wb=g.xH(14,function(){return this.app.Wb()}); g.sN.prototype.Wb=g.xH(13,function(){return this.getVideoData().FW}); g.eM.prototype.ek=g.xH(12,function(J){this.CA().ek(J)}); g.vv.prototype.ek=g.xH(11,function(J){this.G!==J&&(this.G=J,this.WW())}); g.mm.prototype.ek=g.xH(10,function(J){this.overflowButton&&this.overflowButton.ek(J)}); g.eM.prototype.Ve=g.xH(9,function(J){this.CA().Ve(J)}); g.CF.prototype.Ve=g.xH(8,function(J){this.Z!==J&&(this.Z=J,this.WW())}); g.mm.prototype.Ve=g.xH(7,function(J){this.shareButton&&this.shareButton.Ve(J)}); g.eM.prototype.LY=g.xH(6,function(J){this.CA().LY(J)}); g.Zb.prototype.LY=g.xH(5,function(J){this.vK!==J&&(this.vK=J,this.Q8())}); g.eM.prototype.FZ=g.xH(4,function(J){this.CA().FZ(J)}); g.mm.prototype.FZ=g.xH(3,function(J){this.K3!==J&&(this.K3=J,this.m8())});g.e(Xy,g.F);Xy.prototype.select=function(){this.B.z9(this.suggestion.videoId,this.suggestion.sessionData,this.suggestion.playlistId,void 0,void 0,this.suggestion.JK||void 0)&&this.B.logClick(this.element)}; Xy.prototype.onClick=function(J){g.lA(J,this.B,this.G,this.suggestion.sessionData||void 0)&&this.select()}; Xy.prototype.onKeyPress=function(J){switch(J.keyCode){case 13:case 32:J.defaultPrevented||(this.select(),J.preventDefault())}};g.e(ly,g.F);g.u=ly.prototype;g.u.DM=function(J){this.suggestion!==J&&(this.suggestion=J,ol(this.G,J),this.playButton.updateValue("url",this.suggestion.BH()),xz(this))}; g.u.P1=function(){return this.X>0}; g.u.lD=function(){this.P1()||(this.X=Date.now(),$mz(this),hkr(this.B,rZS(this)),g.Qq(this.B.getRootNode(),"countdown-running",this.P1()))}; g.u.R0=function(){this.EL();$mz(this);var J=this.G.rQ("ytp-autonav-endscreen-upnext-header");J&&g.lc(J,"Up next")}; g.u.EL=function(){this.P1()&&(this.U.stop(),this.X=0)}; g.u.select=function(J){this.B.nextVideo(!1,J===void 0?!1:J);this.EL()}; g.u.t$=function(J){g.lA(J,this.B)&&(J.currentTarget===this.playButton.element?this.B.logClick(this.playButton.element):J.currentTarget===this.G.rQ("ytp-autonav-endscreen-link-container")&&(J=this.G.rQ("ytp-autonav-endscreen-link-container"),this.B.logVisibility(J,!0),this.B.logClick(J)),this.N?(this.B.I4("innertubeCommand",this.N),this.EL()):this.select())}; g.u.Q6=function(){this.B.logClick(this.cancelButton.element);g.B4(this.B,!0);this.cancelCommand&&this.B.I4("innertubeCommand",this.cancelCommand)}; g.u.onVideoDataChange=function(J,K){Q3z(this,K);J=K.getWatchNextResponse();var n,X;J=(n=vT8(J))==null?void 0:(X=n.cancelButton)==null?void 0:X.buttonRenderer;this.cancelCommand=J==null?void 0:J.command}; g.u.ImQ=function(J){if(s3n(this)){var K=this.B.getVideoData().watchToWatchTransitionRenderer,n=K==null?void 0:K.fromColorPaletteDark;K=K==null?void 0:K.toColorPaletteDark;if(n&&K){var X=this.element;X.style.setProperty("--w2w-start-background-color",g.UC(n.surgeColor));X.style.setProperty("--w2w-start-primary-text-color",g.UC(n.primaryTitleColor));X.style.setProperty("--w2w-start-secondary-text-color",g.UC(n.secondaryTitleColor));X.style.setProperty("--w2w-end-background-color",g.UC(K.surgeColor)); X.style.setProperty("--w2w-end-primary-text-color",g.UC(K.primaryTitleColor));X.style.setProperty("--w2w-end-secondary-text-color",g.UC(K.secondaryTitleColor));X.style.setProperty("--w2w-animation-duration",J+"ms")}g.Qq(this.element,"ytp-w2w-animate",!0)}}; g.u.GX=function(J){this.B.J("web_autonav_color_transition")&&J!==2&&g.Qq(this.element,"ytp-w2w-animate",!1)}; g.u.Wl=function(){var J=this.B.Mk();this.W&&this.Kv!==J&&this.Yr(J);xz(this);this.B.logVisibility(this.container.element,J);this.B.logVisibility(this.cancelButton.element,J);this.B.logVisibility(this.G.rQ("ytp-autonav-endscreen-link-container"),J);this.B.logVisibility(this.playButton.element,J)}; g.u.l1=function(J){return J.width<400||J.height<459};g.e(jZ,g.F);g.u=jZ.prototype;g.u.create=function(){this.created=!0}; g.u.destroy=function(){this.created=!1}; g.u.v5=function(){return!1}; g.u.Mk=function(){return!1}; g.u.by=function(){return!1};g.e(V7,g.F);g.u=V7.prototype;g.u.VN=function(){this.notification&&(this.U.stop(),this.rR(this.X),this.X=null,this.notification.close(),this.notification=null)}; g.u.DM=function(J){this.suggestion=J;ol(this,J,"hqdefault.jpg")}; g.u.e6=function(){this.Yr(this.api.Mk());this.api.logVisibility(this.element,this.api.Mk());this.api.logVisibility(this.rQ("ytp-upnext-autoplay-icon"),this.api.Mk());this.cancelButton&&this.api.logVisibility(this.cancelButton.element,this.api.Mk())}; g.u.avW=function(){window.focus();this.VN()}; g.u.lD=function(J){var K=this;this.P1()||(g.jp("a11y-announce","Up Next "+this.suggestion.title),this.Z=(0,g.a)(),this.G=new g.AT(function(){Osj(K,J)},25),Osj(this,J),hkr(this.api,CrO(this,J))); g.hv(this.element,"ytp-upnext-autoplay-paused")}; g.u.hide=function(){g.F.prototype.hide.call(this)}; g.u.P1=function(){return!!this.G}; g.u.R0=function(){this.EL();this.Z=(0,g.a)();Osj(this);g.jv(this.element,"ytp-upnext-autoplay-paused")}; g.u.EL=function(){this.P1()&&(this.G.dispose(),this.G=null)}; g.u.select=function(J){J=J===void 0?!1:J;if(this.api.S().J("autonav_notifications")&&J&&window.Notification&&typeof document.hasFocus==="function"){var K=Notification.permission;K==="default"?Notification.requestPermission():K!=="granted"||document.hasFocus()||(this.VN(),this.notification=new Notification("Up Next",{body:this.suggestion.title,icon:this.suggestion.rK()}),this.X=this.T(this.notification,"click",this.avW),this.U.start())}this.EL();this.api.nextVideo(!1,J)}; g.u.hC=function(J){!g.XG(this.cancelButton.element,J.target)&&g.lA(J,this.api)&&(this.api.Mk()&&this.api.logClick(this.rQ("ytp-upnext-autoplay-icon")),this.select())}; g.u.ZD=function(){this.api.Mk()&&this.cancelButton&&this.api.logClick(this.cancelButton.element);g.B4(this.api,!0)}; g.u.kiM=function(J){this.api.getPresentingPlayerType();this.show();this.lD(J)}; g.u.RLv=function(){this.api.getPresentingPlayerType();this.EL();this.hide()}; g.u.Xq=function(){this.EL();this.VN();g.F.prototype.Xq.call(this)};g.e(h9,jZ);g.u=h9.prototype;g.u.create=function(){jZ.prototype.create.call(this);this.U.T(this.player,"appresize",this.Oh);this.U.T(this.player,"onVideoAreaChange",this.Oh);this.U.T(this.player,"videodatachange",this.onVideoDataChange);this.U.T(this.player,"autonavchange",this.Vq);this.U.T(this.player,"onAutonavCancelled",this.XJ);this.onVideoDataChange()}; g.u.show=function(){jZ.prototype.show.call(this);(this.W||this.X&&this.X!==this.videoData.clientPlaybackNonce)&&g.B4(this.player,!1);g.kw(this.player)&&this.v5()&&!this.X?(vO(this),this.videoData.autonavState===2?this.player.getVisibilityState()===3?this.G.select(!0):this.G.lD():this.videoData.autonavState===3&&this.G.R0()):(g.B4(this.player,!0),vO(this));this.Oh()}; g.u.hide=function(){jZ.prototype.hide.call(this);this.G.R0();vO(this)}; g.u.Oh=function(){var J=this.player.CI(!0,this.player.isFullscreen());vO(this);xz(this.Z);g.Qq(this.element,"ytp-autonav-cancelled-small-mode",this.l1(J));g.Qq(this.element,"ytp-autonav-cancelled-tiny-mode",this.ZF(J));g.Qq(this.element,"ytp-autonav-cancelled-mini-mode",J.width<=400||J.height<=360);this.overlay&&g.c7(this.overlay.element,{width:J.width+"px"});if(!this.N)for(J=0;J0&&(J= C*4,H=K<=Q-2&&S>=r*4;if((r+1)/C*X/V>V/(r/(C+1)*X)&&H)S-=r*4,K+=2;else if(O)S-=C*4,J+=2;else if(H)S-=r*4,K+=2;else break}X=!1;S>=12&&n*4-S<=6&&(K>=4||J>=4)&&(X=!0);S=J*96;v=K*54;V=S/v=J-2&&r>=K-2?H=1:r%2===0&&Q%2===0&&(r<2&&Q<2?r===0&&Q===0&&(H=2):H=2),C=g.m4(C+this.X,n),H!==0){O=this.stills[V];O||(O=new Cb(this.player),this.stills[V]=O,x.appendChild(O.element));var R=Math.floor(v*r/K),w=Math.floor(S*Q/J),P=Math.floor(v*(r+H)/K)-R-4,B=Math.floor(S*(Q+H)/J)-w-4;g.ZL(O.element,w,R);g.Fo(O.element,B,P);g.c7(O.element,"transitionDelay",(r+Q)/20+"s");g.Qq(O.element,"ytp-videowall-still-mini", H===1);g.Qq(O.element,"ytp-videowall-still-large",H>2);H=Math.max(B,P);g.Qq(O.element,"ytp-videowall-still-round-large",H>=256);g.Qq(O.element,"ytp-videowall-still-round-medium",H>96&&H<256);g.Qq(O.element,"ytp-videowall-still-round-small",H<=96);C=l[C];O.suggestion!==C&&(O.suggestion=C,H=O.api.S(),R=g.xt(O.element,"ytp-videowall-still-large")?"hqdefault.jpg":"mqdefault.jpg",ol(O,C,R),g.pR(H)&&!O.api.J("web_player_log_click_before_generating_ve_conversion_params")&&(H=C.BH(),R={},g.v4(O.api,"addEmbedsConversionTrackingParams", [R]),H=g.Td(H,R),O.updateValue("url",H)),(C=(C=C.sessionData)&&C.itct)&&O.api.setTrackingParams(O.element,C));V++}x.ariaBusy="false";g.Qq(this.element,"ytp-endscreen-paginate",V=V;l--)J=this.stills[l],g.oF(J.element),g.QD(J);this.stills.length=V}}; g.u.onVideoDataChange=function(){var J=this.player.getVideoData(1);this.videoData!==J&&(J!=null&&g.NJ(J)?(this.X=0,this.videoData=J,this.Mc()):this.player.Zm("missg",{vid:(J==null?void 0:J.videoId)||"",cpn:(J==null?void 0:J.clientPlaybackNonce)||""}))}; g.u.E9=function(){this.X+=this.stills.length;this.Mc()}; g.u.cz=function(){this.X-=this.stills.length;this.Mc()}; g.u.by=function(){return this.G.P1()}; g.u.CN=function(J){J===1?(this.N=!1,this.U=this.videoData.clientPlaybackNonce,this.G.EL(),this.Kv&&this.Mc()):(this.N=!0,this.Kv&&HO(this)&&(J===2?this.G.lD():J===3&&this.G.R0()))}; g.u.uw=function(J){if(J){for(J=0;J0||J.endSeconds>0||J.mutedAutoplayDurationMode!==2);if((this.player.isEmbedsShortsMode()||this.Z)&&!K)return!0;var n;var X=!!((J==null?0:g.NJ(J))||(J==null?0:(n=J.suggestions)==null?0:n.length));X=!u5n(this.player)||X;J=J.Td;n=this.player.SP();return X&&!J&&!n&&!K}; g.u.Mk=function(){return this.endScreen.Mk()}; g.u.Nu=function(){return this.Mk()?this.endScreen.by():!1}; g.u.Xq=function(){this.player.Uo("endscreen");g.CH.prototype.Xq.call(this)}; g.u.load=function(){var J=this.player.getVideoData();var K=J.transitionEndpointAtEndOfStream;if(K&&K.videoId){var n=this.player.hx().Yo.get("heartbeat"),X=g.NJ(J);!X||K.videoId!==X.videoId||J.Ec?(this.player.z9(K.videoId,void 0,void 0,!0,!0,K),n&&n.UJ("HEARTBEAT_ACTION_TRIGGER_AT_STREAM_END","HEARTBEAT_ACTION_TRANSITION_REASON_HAS_NEW_STREAM_TRANSITION_ENDPOINT"),J=!0):J=!1}else J=!1;J||(g.CH.prototype.load.call(this),this.endScreen.show())}; g.u.unload=function(){g.CH.prototype.unload.call(this);this.endScreen.hide();this.endScreen.destroy()}; g.u.onCueRangeEnter=function(J){this.zZ()&&(this.endScreen.created||this.endScreen.create(),J.getId()==="load"&&this.load())}; g.u.onCueRangeExit=function(J){J.getId()==="load"&&this.loaded&&this.unload()}; g.u.onVideoDataChange=function(){zkV(this);this.U&&ekn(this)&&(this.endScreen&&(this.endScreen.hide(),this.endScreen.created&&this.endScreen.destroy(),this.endScreen.dispose()),this.G?this.endScreen=new h9(this.player):this.endScreen=new On(this.player),g.Z(this,this.endScreen),g.dv(this.player,this.endScreen.element,4))};g.sU("endscreen",wQu);})(_yt_player);