(function(g){var window=this;'use strict';var Jxw=function(v){v.publish("autonavvisibility")},KZJ=function(v,O){v.PW("onAutonavCoundownStarted",O)},PTL=function(v){var O,Y,S; return v==null?void 0:(O=v.playerOverlays)==null?void 0:(Y=O.playerOverlayRenderer)==null?void 0:(S=Y.autoplay)==null?void 0:S.playerOverlayAutoplayRenderer},dm=function(v,O,Y){g.gr(v.element,"ytp-suggestion-set",!!O.videoId); var S=O.playlistId;Y=O.JE(Y?Y:"mqdefault.jpg");var d=null,r=null;O instanceof g.cO&&(O.lengthText?(d=O.lengthText||null,r=O.Ch||null):O.lengthSeconds&&(d=g.lC(O.lengthSeconds),r=g.lC(O.lengthSeconds,!0)));var b=!!S;S=b&&g.kf(S).type==="RD";var z=O instanceof g.cO?O.isLivePlayback:null,M=O instanceof g.cO?O.isUpcoming:null,V=O.author,A=O.shortViewCount,f=O.publishedTimeText,k=[],U=[];V&&k.push(V);A&&(k.push(A),U.push(A));f&&U.push(f);Y={title:O.title,author:V,author_and_views:k.join(" \u2022 "),aria_label:O.ariaLabel|| g.kD("Watch $TITLE",{TITLE:O.title}),duration:d,timestamp:r,url:O.qY(),is_live:z,is_upcoming:M,is_list:b,is_mix:S,background:Y?"background-image: url("+Y+")":"",views_and_publish_time:U.join(" \u2022 "),autoplayAlternativeHeader:O.Zx};O instanceof g.U3&&(Y.playlist_length=O.playlistLength);v.update(Y)},rm=function(v){var O=v.D(),Y=O.B; g.K.call(this,{J:"a",W:"ytp-autonav-suggestion-card",T:{href:"{{url}}",target:Y?O.j:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},K:[{J:"div",hK:["ytp-autonav-endscreen-upnext-thumbnail","ytp-autonav-thumbnail-small"],T:{style:"{{background}}"},K:[{J:"div",T:{"aria-label":"{{timestamp}}"},hK:["ytp-autonav-timestamp"],M3:"{{duration}}"},{J:"div",hK:["ytp-autonav-live-stamp"],M3:"Live"},{J:"div", hK:["ytp-autonav-upcoming-stamp"],M3:"Upcoming"},{J:"div",W:"ytp-autonav-list-overlay",K:[{J:"div",W:"ytp-autonav-mix-text",M3:"Mix"},{J:"div",W:"ytp-autonav-mix-icon"}]}]},{J:"div",hK:["ytp-autonav-endscreen-upnext-title","ytp-autonav-title-card"],M3:"{{title}}"},{J:"div",hK:["ytp-autonav-endscreen-upnext-author","ytp-autonav-author-card"],M3:"{{author}}"},{J:"div",hK:["ytp-autonav-endscreen-upnext-author","ytp-autonav-view-and-date-card"],M3:"{{views_and_publish_time}}"}]});this.N=v;this.suggestion= null;this.Y=Y;this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress)},bR=function(v,O){O=O===void 0?!1:O; g.K.call(this,{J:"div",W:"ytp-autonav-endscreen-countdown-overlay"});var Y=this;this.L=O;this.cancelCommand=this.C=void 0;this.G=0;this.container=new g.K({J:"div",W:"ytp-autonav-endscreen-countdown-container"});g.w(this,this.container);this.container.C1(this.element);O=v.D();var S=O.B;this.N=v;this.suggestion=null;this.onVideoDataChange("newdata",this.N.getVideoData());this.S(v,"videodatachange",this.onVideoDataChange);this.Y=new g.K({J:"div",W:"ytp-autonav-endscreen-upnext-container",T:{"aria-label":"{{aria_label}}", "data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},K:[{J:"div",W:"ytp-autonav-endscreen-upnext-header"},{J:"div",W:"ytp-autonav-endscreen-upnext-alternative-header",M3:"{{autoplayAlternativeHeader}}"},{J:"a",W:"ytp-autonav-endscreen-link-container",T:{href:"{{url}}",target:S?O.j:""},K:[{J:"div",W:"ytp-autonav-endscreen-upnext-thumbnail",T:{style:"{{background}}"},K:[{J:"div",T:{"aria-label":"{{timestamp}}"},hK:["ytp-autonav-timestamp"], M3:"{{duration}}"},{J:"div",hK:["ytp-autonav-live-stamp"],M3:"Live"},{J:"div",hK:["ytp-autonav-upcoming-stamp"],M3:"Upcoming"}]},{J:"div",W:"ytp-autonav-endscreen-video-info",K:[{J:"div",W:"ytp-autonav-endscreen-premium-badge"},{J:"div",W:"ytp-autonav-endscreen-upnext-title",M3:"{{title}}"},{J:"div",W:"ytp-autonav-endscreen-upnext-author",M3:"{{author}}"},{J:"div",W:"ytp-autonav-view-and-date",M3:"{{views_and_publish_time}}"},{J:"div",W:"ytp-autonav-author-and-view",M3:"{{author_and_views}}"}]}]}]}); g.w(this,this.Y);this.Y.C1(this.container.element);S||this.S(this.Y.BW("ytp-autonav-endscreen-link-container"),"click",this.TQ);this.N.createClientVe(this.container.element,this,115127);this.N.createClientVe(this.Y.BW("ytp-autonav-endscreen-link-container"),this,115128);this.overlay=new g.K({J:"div",W:"ytp-autonav-overlay"});g.w(this,this.overlay);this.overlay.C1(this.container.element);this.U=new g.K({J:"div",W:"ytp-autonav-endscreen-button-container"});g.w(this,this.U);this.U.C1(this.container.element); this.cancelButton=new g.K({J:"button",hK:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-cancel-button",O.V("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],T:{"aria-label":"Cancel autoplay"},M3:"Cancel"});g.w(this,this.cancelButton);this.cancelButton.C1(this.U.element);this.cancelButton.listen("click",this.iH,this);this.N.createClientVe(this.cancelButton.element,this,115129);this.playButton=new g.K({J:"a",hK:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-play-button", O.V("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],T:{href:"{{url}}",role:"button","aria-label":"Play next video"},M3:"Play Now"});g.w(this,this.playButton);this.playButton.C1(this.U.element);this.playButton.listen("click",this.TQ,this);this.N.createServerVe(this.playButton.element,this.playButton,!0);(O=this.N.getVideoData())&&GeY(this,O);this.B=new g.mX(function(){iVY(Y)},500); g.w(this,this.B);this.Em();this.S(v,"autonavvisibility",this.Em);this.N.V("web_autonav_color_transition")&&(this.S(v,"autonavchange",this.RV),this.S(v,"onAutonavCoundownStarted",this.bj8))},oe=function(v){var O=v.N.wW(!0,v.N.isFullscreen()); g.gr(v.container.element,"ytp-autonav-endscreen-small-mode",v.tE(O));g.gr(v.container.element,"ytp-autonav-endscreen-is-premium",!!v.suggestion&&!!v.suggestion.ZoO);g.gr(v.N.getRootNode(),"ytp-autonav-endscreen-cancelled-state",!v.N.WY());g.gr(v.N.getRootNode(),"countdown-running",v.D_());g.gr(v.container.element,"ytp-player-content",v.N.WY());g.ym(v.overlay.element,{width:O.width+"px"});if(!v.D_()){v.N.WY()?mVN(v,Math.round(t2t(v)/1E3)):mVN(v);O=!!v.suggestion&&!!v.suggestion.Zx;var Y=v.N.WY()|| !O;g.gr(v.container.element,"ytp-autonav-endscreen-upnext-alternative-header-only",!Y&&O);g.gr(v.container.element,"ytp-autonav-endscreen-upnext-no-alternative-header",Y&&!O);v.U.t9(v.N.WY());g.gr(v.element,"ytp-enable-w2w-color-transitions",DVN(v))}},iVY=function(v){var O=t2t(v),Y=Math,S=Y.min; var d=v.G?Date.now()-v.G:0;Y=S.call(Y,d,O);mVN(v,Math.ceil((O-Y)/1E3));O-Y<=500&&v.D_()?v.select(!0):v.D_()&&v.B.start()},t2t=function(v){if(v.N.isFullscreen()){var O; v=(O=v.N.getVideoData())==null?void 0:O.xD;return v===-1||v===void 0?8E3:v}return v.N.RY()>=0?v.N.RY():g.Vq(v.N.D().experiments,"autoplay_time")||1E4},GeY=function(v,O){O=O.getWatchNextResponse(); var Y,S;O=(Y=PTL(O))==null?void 0:(S=Y.nextButton)==null?void 0:S.buttonRenderer;v.C=O==null?void 0:O.navigationEndpoint;Y=O==null?void 0:O.trackingParams;v.playButton&&Y&&v.N.setTrackingParams(v.playButton.element,Y)},DVN=function(v){var O; return!((O=v.N.getVideoData())==null||!O.watchToWatchTransitionRenderer)},mVN=function(v,O){O=O===void 0?-1:O; v=v.Y.BW("ytp-autonav-endscreen-upnext-header");g.Nn(v);if(O>=0){O=String(O);var Y="Up next in $SECONDS".match(RegExp("\\$SECONDS","gi"))[0],S="Up next in $SECONDS".indexOf(Y);if(S>=0){v.appendChild(g.DC("Up next in $SECONDS".slice(0,S)));var d=g.tc("span");g.rr(d,"ytp-autonav-endscreen-upnext-header-countdown-number");g.S9(d,O);v.appendChild(d);v.appendChild(g.DC("Up next in $SECONDS".slice(S+Y.length)));return}}g.S9(v,"Up next")},jn=function(v,O){g.K.call(this,{J:"div", hK:["html5-endscreen","ytp-player-content",O||"base-endscreen"]});this.created=!1;this.player=v},WF=function(v){g.K.call(this,{J:"div", hK:["ytp-upnext","ytp-player-content"],T:{"aria-label":"{{aria_label}}"},K:[{J:"div",W:"ytp-cued-thumbnail-overlay-image",T:{style:"{{background}}"}},{J:"span",W:"ytp-upnext-top",K:[{J:"span",W:"ytp-upnext-header",M3:"Up Next"},{J:"span",W:"ytp-upnext-title",M3:"{{title}}"},{J:"span",W:"ytp-upnext-author",M3:"{{author}}"}]},{J:"a",W:"ytp-upnext-autoplay-icon",T:{role:"button",href:"{{url}}","aria-label":"Play next video"},K:[{J:"svg",T:{height:"100%",version:"1.1",viewBox:"0 0 72 72",width:"100%"}, K:[{J:"circle",W:"ytp-svg-autoplay-circle",T:{cx:"36",cy:"36",fill:"#fff","fill-opacity":"0.3",r:"31.5"}},{J:"circle",W:"ytp-svg-autoplay-ring",T:{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",W:"ytp-svg-fill",T:{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",W:"ytp-upnext-bottom",K:[{J:"span",W:"ytp-upnext-cancel"},{J:"span",W:"ytp-upnext-paused", M3:"Autoplay is paused"}]}]});this.api=v;this.cancelButton=null;this.C=this.BW("ytp-svg-autoplay-ring");this.G=this.notification=this.Y=this.suggestion=null;this.B=new g.mX(this.oo,5E3,this);this.U=0;var O=this.BW("ytp-upnext-cancel");this.cancelButton=new g.K({J:"button",hK:["ytp-upnext-cancel-button","ytp-button"],T:{tabindex:"0","aria-label":"Cancel autoplay"},M3:"Cancel"});g.w(this,this.cancelButton);this.cancelButton.listen("click",this.uH,this);this.cancelButton.C1(O);this.cancelButton&&this.api.createClientVe(this.cancelButton.element, this,115129);g.w(this,this.B);this.api.createClientVe(this.element,this,18788);O=this.BW("ytp-upnext-autoplay-icon");this.S(O,"click",this.f5);this.api.createClientVe(O,this,115130);this.Pm();this.S(v,"autonavvisibility",this.Pm);this.S(v,"mdxnowautoplaying",this.fgW);this.S(v,"mdxautoplaycanceled",this.agg);g.gr(this.element,"ytp-upnext-mobile",this.api.D().U)},HVL=function(v,O){if(O)return O; if(v.api.isFullscreen()){var Y;v=(Y=v.api.getVideoData())==null?void 0:Y.xD;return v===-1||v===void 0?8E3:v}return v.api.RY()>=0?v.api.RY():g.Vq(v.api.D().experiments,"autoplay_time")||1E4},N4t=function(v,O){O=HVL(v,O); var Y=Math,S=Y.min;var d=(0,g.J)()-v.U;Y=S.call(Y,d,O);O=O===0?1:Math.min(Y/O,1);v.C.setAttribute("stroke-dashoffset",""+-211*(O+1));O>=1&&v.D_()&&v.api.getPresentingPlayerType()!==3?v.select(!0):v.D_()&&v.Y.start()},zl=function(v){jn.call(this,v,"autonav-endscreen"); this.overlay=this.videoData=null;this.table=new g.K({J:"div",W:"ytp-suggestion-panel",K:[{J:"div",hK:["ytp-autonav-endscreen-upnext-header","ytp-autonav-endscreen-more-videos"],M3:"More videos"}]});this.X=new g.K({J:"div",W:"ytp-suggestions-container"});this.videos=[];this.G=null;this.C=this.L=!1;this.U=new bR(this.player);g.w(this,this.U);this.U.C1(this.element);v.getVideoData().II?this.Y=this.U:(this.Y=new WF(v),g.TW(this.player,this.Y.element,4),g.w(this,this.Y));this.overlay=new g.K({J:"div", W:"ytp-autonav-overlay-cancelled-state"});g.w(this,this.overlay);this.overlay.C1(this.element);this.B=new g.Z6(this);g.w(this,this.B);g.w(this,this.table);this.table.C1(this.element);this.table.show();g.w(this,this.X);this.X.C1(this.table.element);this.hide()},sh=function(v){var O=v.WY(); O!==v.C&&(v.C=O,Jxw(v.player),v.C?(v.U!==v.Y&&v.U.hide(),v.table.hide()):(v.U!==v.Y&&v.U.show(),v.table.show()))},gm=function(v,O){g.K.call(this,{J:"button", hK:["ytp-watch-on-youtube-button","ytp-button"],M3:"{{content}}"});this.N=v;this.buttonType=this.buttonType=O;this.N5();this.buttonType===2&&g.on(this.element,"ytp-continue-watching-button");this.listen("click",this.onClick);this.listen("videodatachange",this.N5);this.t9(!0)},MT=function(v,O){jn.call(this,v,"embeds-lite-endscreen"); this.N=v;this.Y=O;this.N.createClientVe(this.element,this,156943);this.watchButton=new gm(v,2);g.w(this,this.watchButton);this.watchButton.C1(this.element);this.hide()},Vy=function(v){var O=v.D(),Y=g.En||g.CH?{style:"will-change: opacity"}:void 0,S=O.B,d=["ytp-modern-videowall-still"]; O.U&&d.push("ytp-videowall-show-text");g.K.call(this,{J:"a",hK:d,T:{href:"{{url}}",target:S?O.j:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},K:[{J:"div",W:"ytp-modern-videowall-still-image",T:{style:"{{background}}"},K:[{J:"span",W:"ytp-modern-videowall-still-info-duration",M3:"{{duration}}"}]},{J:"span",W:"ytp-modern-videowall-still-info",T:{"aria-hidden":"true"},K:[{J:"span",W:"ytp-modern-videowall-still-info-bg",K:[{J:"span", W:"ytp-modern-videowall-still-info-content",T:Y,K:[{J:"span",W:"ytp-modern-videowall-still-info-title",M3:"{{title}}"},{J:"span",W:"ytp-modern-videowall-still-info-author",M3:"{{author_and_views}}"},{J:"span",W:"ytp-modern-videowall-still-info-live",M3:"Live"}]}]}]},{J:"span",hK:["ytp-modern-videowall-still-listlabel-regular","ytp-modern-videowall-still-listlabel"],T:{"aria-hidden":"true"},K:[{J:"span",W:"ytp-modern-videowall-still-listlabel-icon"},"Playlist",{J:"span",W:"ytp-modern-videowall-still-listlabel-length", K:[" (",{J:"span",M3:"{{playlist_length}}"},")"]}]},{J:"span",hK:["ytp-modern-videowall-still-listlabel-mix","ytp-modern-videowall-still-listlabel"],T:{"aria-hidden":"true"},K:[{J:"span",W:"ytp-modern-videowall-still-listlabel-mix-icon"},"Mix",{J:"span",W:"ytp-modern-videowall-still-listlabel-length",M3:" (50+)"}]}]});this.suggestion=null;this.U=S;this.api=v;this.Y=new g.Z6(this);g.w(this,this.Y);this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress);this.Y.S(v,"videodatachange", this.onVideoDataChange);v.createServerVe(this.element,this);this.onVideoDataChange()},v1N=function(v){jn.call(this,v,"videowall-endscreen"); var O=this;this.N=v;this.stills=[];this.G=this.videoData=null;this.B=this.L=!1;this.X=null;g.on(this.element,"modern-videowall-endscreen");this.U=new g.Z6(this);g.w(this,this.U);this.C=new g.mX(function(){g.on(O.element,"ytp-show-tiles")},0); g.w(this,this.C);this.table=new g.A6({J:"div",W:"ytp-modern-endscreen-content"});g.w(this,this.table);this.table.C1(this.element);v.getVideoData().II?this.Y=new bR(v,!0):this.Y=new WF(v);g.w(this,this.Y);g.TW(this.player,this.Y.element,4);v.createClientVe(this.element,this,158789);this.hide()},AH=function(v){return g.lb(v.player)&&v.eP()&&!v.G},fk=function(v){var O=v.WY(); O!==v.L&&(v.L=O,Jxw(v.player))},O9v=function(v){jn.call(this,v,"subscribecard-endscreen"); this.Y=new g.K({J:"div",W:"ytp-subscribe-card",K:[{J:"img",W:"ytp-author-image",T:{src:"{{profilePicture}}"}},{J:"div",W:"ytp-subscribe-card-right",K:[{J:"div",W:"ytp-author-name",M3:"{{author}}"},{J:"div",W:"html5-subscribe-button-container"}]}]});g.w(this,this.Y);this.Y.C1(this.element);var O=v.getVideoData();this.subscribeButton=new g.Gv("Subscribe",null,"Unsubscribe",null,!0,!1,O.HS,O.subscribed,"trailer-endscreen",null,v,!1);g.w(this,this.subscribeButton);this.subscribeButton.C1(this.Y.BW("html5-subscribe-button-container")); this.S(v,"videodatachange",this.q3);this.q3();this.hide()},$n=function(v){var O=v.D(),Y=g.En||g.CH?{style:"will-change: opacity"}:void 0,S=O.B,d=["ytp-videowall-still"]; O.U&&d.push("ytp-videowall-show-text");g.K.call(this,{J:"a",hK:d,T:{href:"{{url}}",target:S?O.j:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},K:[{J:"div",W:"ytp-videowall-still-image",T:{style:"{{background}}"}},{J:"span",W:"ytp-videowall-still-info",T:{"aria-hidden":"true"},K:[{J:"span",W:"ytp-videowall-still-info-bg",K:[{J:"span",W:"ytp-videowall-still-info-content",T:Y,K:[{J:"span",W:"ytp-videowall-still-info-title",M3:"{{title}}"}, {J:"span",W:"ytp-videowall-still-info-author",M3:"{{author_and_views}}"},{J:"span",W:"ytp-videowall-still-info-live",M3:"Live"},{J:"span",W:"ytp-videowall-still-info-duration",M3:"{{duration}}"}]}]}]},{J:"span",hK:["ytp-videowall-still-listlabel-regular","ytp-videowall-still-listlabel"],T:{"aria-hidden":"true"},K:[{J:"span",W:"ytp-videowall-still-listlabel-icon"},"Playlist",{J:"span",W:"ytp-videowall-still-listlabel-length",K:[" (",{J:"span",M3:"{{playlist_length}}"},")"]}]},{J:"span",hK:["ytp-videowall-still-listlabel-mix", "ytp-videowall-still-listlabel"],T:{"aria-hidden":"true"},K:[{J:"span",W:"ytp-videowall-still-listlabel-mix-icon"},"Mix",{J:"span",W:"ytp-videowall-still-listlabel-length",M3:" (50+)"}]}]});this.suggestion=null;this.U=S;this.api=v;this.Y=new g.Z6(this);g.w(this,this.Y);this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress);this.Y.S(v,"videodatachange",this.onVideoDataChange);v.createServerVe(this.element,this);this.onVideoDataChange()},kn=function(v){jn.call(this,v,"videowall-endscreen"); var O=this;this.N=v;this.G=0;this.stills=[];this.B=this.videoData=null;this.C=this.X=!1;this.j=null;this.U=new g.Z6(this);g.w(this,this.U);this.L=new g.mX(function(){g.on(O.element,"ytp-show-tiles")},0); g.w(this,this.L);var Y=new g.K({J:"button",hK:["ytp-button","ytp-endscreen-previous"],T:{"aria-label":"Previous"},K:[g.aF()]});g.w(this,Y);Y.C1(this.element);Y.listen("click",this.yL,this);this.table=new g.A6({J:"div",W:"ytp-endscreen-content"});g.w(this,this.table);this.table.C1(this.element);Y=new g.K({J:"button",hK:["ytp-button","ytp-endscreen-next"],T:{"aria-label":"Next"},K:[g.x9()]});g.w(this,Y);Y.C1(this.element);Y.listen("click",this.P8,this);v.getVideoData().II?this.Y=new bR(v,!0):this.Y= new WF(v);g.w(this,this.Y);g.TW(this.player,this.Y.element,4);v.createClientVe(this.element,this,158789);this.hide()},Uh=function(v){return g.lb(v.player)&&v.eP()&&!v.B},cF=function(v){var O=v.WY(); O!==v.X&&(v.X=O,Jxw(v.player))},uR=function(v){jn.call(this,v,"watch-again-on-youtube-endscreen"); this.watchButton=new gm(v,1);g.w(this,this.watchButton);this.watchButton.C1(this.element);g.NWw(v)&&(this.Y=new g.me(v),g.w(this,this.Y),this.U=new g.K({J:"div",hK:["ytp-watch-again-on-youtube-endscreen-more-videos-container"],T:{tabIndex:"-1"},K:[this.Y]}),g.w(this,this.U),this.Y.C1(this.U.element),this.U.C1(this.element));v.createClientVe(this.element,this,156914);this.hide()},rnJ=function(v){g.gx.call(this,v); var O=this;this.endScreen=null;this.U=this.Y=this.G=this.B=!1;this.listeners=new g.Z6(this);g.w(this,this.listeners);var Y=v.D(),S=v.getVideoData();S=S&&S.limitedPlaybackDurationInSeconds!==0;g.s9(g.EU(Y))&&S&&!g.yN(v)?(this.U=!0,this.endScreen=new MT(v,g.W2(v))):v.isEmbedsShortsMode()?this.endScreen=new uR(v):YML(v)?(this.B=!0,SMN(this),this.Y?this.endScreen=new zl(v):Y.V("delhi_modern_endscreen")?this.endScreen=new v1N(v):this.endScreen=new kn(v)):Y.Lo?this.endScreen=new O9v(v):this.endScreen=new jn(v); g.w(this,this.endScreen);g.TW(v,this.endScreen.element,4);dRv(this);this.listeners.S(v,"videodatachange",this.onVideoDataChange,this);this.listeners.S(v,g.bI("endscreen"),function(d){O.onCueRangeEnter(d)}); this.listeners.S(v,g.o1("endscreen"),function(d){O.onCueRangeExit(d)})},SMN=function(v){var O=v.player.getVideoData(); if(!O||v.Y===O.J3&&v.G===O.II)return!1;v.Y=O.J3;v.G=O.II;return!0},YML=function(v){v=v.D(); return v.w2&&!v.Lo&&!v.disableOrganicUi},dRv=function(v){v.player.oF("endscreen"); var O=v.player.getVideoData();O=new g.dh(Math.max((O.lengthSeconds-10)*1E3,0),0x8000000000000,{id:"preload",namespace:"endscreen"});var Y=new g.dh(0x8000000000000,0x8000000000000,{id:"load",priority:8,namespace:"endscreen"});v.player.YZ([O,Y])}; g.UT.prototype.RY=g.rF(14,function(){return this.app.RY()}); g.MI.prototype.RY=g.rF(13,function(){return this.getVideoData().IC}); g.A4.prototype.E$=g.rF(12,function(v){this.l8().E$(v)}); g.jo.prototype.E$=g.rF(11,function(v){this.Y!==v&&(this.Y=v,this.q3())}); g.pj.prototype.E$=g.rF(10,function(v){this.overflowButton&&this.overflowButton.E$(v)}); g.A4.prototype.T_=g.rF(9,function(v){this.l8().T_(v)}); g.Vx.prototype.T_=g.rF(8,function(v){this.U!==v&&(this.U=v,this.q3())}); g.pj.prototype.T_=g.rF(7,function(v){this.shareButton&&this.shareButton.T_(v)}); g.A4.prototype.Ip=g.rF(6,function(v){this.l8().Ip(v)}); g.wx.prototype.Ip=g.rF(5,function(v){this.G1!==v&&(this.G1=v,this.m2())}); g.A4.prototype.sR=g.rF(4,function(v){this.l8().sR(v)}); g.pj.prototype.sR=g.rF(3,function(v){this.Up!==v&&(this.Up=v,this.OP())});g.C(rm,g.K);rm.prototype.select=function(){this.N.Bu(this.suggestion.videoId,this.suggestion.sessionData,this.suggestion.playlistId,void 0,void 0,this.suggestion.SJ||void 0)&&this.N.logClick(this.element)}; rm.prototype.onClick=function(v){g.NG(v,this.N,this.Y,this.suggestion.sessionData||void 0)&&this.select()}; rm.prototype.onKeyPress=function(v){switch(v.keyCode){case 13:case 32:v.defaultPrevented||(this.select(),v.preventDefault())}};g.C(bR,g.K);g.u=bR.prototype;g.u.n0=function(v){this.suggestion!==v&&(this.suggestion=v,dm(this.Y,v),this.playButton.updateValue("url",this.suggestion.qY()),oe(this))}; g.u.D_=function(){return this.G>0}; g.u.QI=function(){this.D_()||(this.G=Date.now(),iVY(this),KZJ(this.N,t2t(this)),g.gr(this.N.getRootNode(),"countdown-running",this.D_()))}; g.u.E8=function(){this.oX();iVY(this);var v=this.Y.BW("ytp-autonav-endscreen-upnext-header");v&&g.S9(v,"Up next")}; g.u.oX=function(){this.D_()&&(this.B.stop(),this.G=0)}; g.u.select=function(v){this.N.nextVideo(!1,v===void 0?!1:v);this.oX()}; g.u.TQ=function(v){g.NG(v,this.N)&&(v.currentTarget===this.playButton.element?this.N.logClick(this.playButton.element):v.currentTarget===this.Y.BW("ytp-autonav-endscreen-link-container")&&(v=this.Y.BW("ytp-autonav-endscreen-link-container"),this.N.logVisibility(v,!0),this.N.logClick(v)),this.C?(this.N.PW("innertubeCommand",this.C),this.oX()):this.select())}; g.u.iH=function(){this.N.logClick(this.cancelButton.element);g.ub(this.N,!0);this.cancelCommand&&this.N.PW("innertubeCommand",this.cancelCommand)}; g.u.onVideoDataChange=function(v,O){GeY(this,O);v=O.getWatchNextResponse();var Y,S;v=(Y=PTL(v))==null?void 0:(S=Y.cancelButton)==null?void 0:S.buttonRenderer;this.cancelCommand=v==null?void 0:v.command}; g.u.bj8=function(v){if(DVN(this)){var O=this.N.getVideoData().watchToWatchTransitionRenderer,Y=O==null?void 0:O.fromColorPaletteDark;O=O==null?void 0:O.toColorPaletteDark;if(Y&&O){var S=this.element;S.style.setProperty("--w2w-start-background-color",g.n_(Y.surgeColor));S.style.setProperty("--w2w-start-primary-text-color",g.n_(Y.primaryTitleColor));S.style.setProperty("--w2w-start-secondary-text-color",g.n_(Y.secondaryTitleColor));S.style.setProperty("--w2w-end-background-color",g.n_(O.surgeColor)); S.style.setProperty("--w2w-end-primary-text-color",g.n_(O.primaryTitleColor));S.style.setProperty("--w2w-end-secondary-text-color",g.n_(O.secondaryTitleColor));S.style.setProperty("--w2w-animation-duration",v+"ms")}g.gr(this.element,"ytp-w2w-animate",!0)}}; g.u.RV=function(v){this.N.V("web_autonav_color_transition")&&v!==2&&g.gr(this.element,"ytp-w2w-animate",!1)}; g.u.Em=function(){var v=this.N.WY();this.L&&this.t$!==v&&this.t9(v);oe(this);this.N.logVisibility(this.container.element,v);this.N.logVisibility(this.cancelButton.element,v);this.N.logVisibility(this.Y.BW("ytp-autonav-endscreen-link-container"),v);this.N.logVisibility(this.playButton.element,v)}; g.u.tE=function(v){return v.width<400||v.height<459};g.C(jn,g.K);g.u=jn.prototype;g.u.create=function(){this.created=!0}; g.u.destroy=function(){this.created=!1}; g.u.eP=function(){return!1}; g.u.WY=function(){return!1}; g.u.ou=function(){return!1};g.C(WF,g.K);g.u=WF.prototype;g.u.oo=function(){this.notification&&(this.B.stop(),this.g2(this.G),this.G=null,this.notification.close(),this.notification=null)}; g.u.n0=function(v){this.suggestion=v;dm(this,v,"hqdefault.jpg")}; g.u.Pm=function(){this.t9(this.api.WY());this.api.logVisibility(this.element,this.api.WY());this.api.logVisibility(this.BW("ytp-upnext-autoplay-icon"),this.api.WY());this.cancelButton&&this.api.logVisibility(this.cancelButton.element,this.api.WY())}; g.u.s18=function(){window.focus();this.oo()}; g.u.QI=function(v){var O=this;this.D_()||(g.jk("a11y-announce","Up Next "+this.suggestion.title),this.U=(0,g.J)(),this.Y=new g.mX(function(){N4t(O,v)},25),N4t(this,v),KZJ(this.api,HVL(this,v))); g.WI(this.element,"ytp-upnext-autoplay-paused")}; g.u.hide=function(){g.K.prototype.hide.call(this)}; g.u.D_=function(){return!!this.Y}; g.u.E8=function(){this.oX();this.U=(0,g.J)();N4t(this);g.on(this.element,"ytp-upnext-autoplay-paused")}; g.u.oX=function(){this.D_()&&(this.Y.dispose(),this.Y=null)}; g.u.select=function(v){v=v===void 0?!1:v;if(this.api.D().V("autonav_notifications")&&v&&window.Notification&&typeof document.hasFocus==="function"){var O=Notification.permission;O==="default"?Notification.requestPermission():O!=="granted"||document.hasFocus()||(this.oo(),this.notification=new Notification("Up Next",{body:this.suggestion.title,icon:this.suggestion.JE()}),this.G=this.S(this.notification,"click",this.s18),this.B.start())}this.oX();this.api.nextVideo(!1,v)}; g.u.f5=function(v){!g.YW(this.cancelButton.element,v.target)&&g.NG(v,this.api)&&(this.api.WY()&&this.api.logClick(this.BW("ytp-upnext-autoplay-icon")),this.select())}; g.u.uH=function(){this.api.WY()&&this.cancelButton&&this.api.logClick(this.cancelButton.element);g.ub(this.api,!0)}; g.u.fgW=function(v){this.api.getPresentingPlayerType();this.show();this.QI(v)}; g.u.agg=function(){this.api.getPresentingPlayerType();this.oX();this.hide()}; g.u.cW=function(){this.oX();this.oo();g.K.prototype.cW.call(this)};g.C(zl,jn);g.u=zl.prototype;g.u.create=function(){jn.prototype.create.call(this);this.B.S(this.player,"appresize",this.zk);this.B.S(this.player,"onVideoAreaChange",this.zk);this.B.S(this.player,"videodatachange",this.onVideoDataChange);this.B.S(this.player,"autonavchange",this.ym);this.B.S(this.player,"onAutonavCancelled",this.aV);this.onVideoDataChange()}; g.u.show=function(){jn.prototype.show.call(this);(this.L||this.G&&this.G!==this.videoData.clientPlaybackNonce)&&g.ub(this.player,!1);g.lb(this.player)&&this.eP()&&!this.G?(sh(this),this.videoData.autonavState===2?this.player.getVisibilityState()===3?this.Y.select(!0):this.Y.QI():this.videoData.autonavState===3&&this.Y.E8()):(g.ub(this.player,!0),sh(this));this.zk()}; g.u.hide=function(){jn.prototype.hide.call(this);this.Y.E8();sh(this)}; g.u.zk=function(){var v=this.player.wW(!0,this.player.isFullscreen());sh(this);oe(this.U);g.gr(this.element,"ytp-autonav-cancelled-small-mode",this.tE(v));g.gr(this.element,"ytp-autonav-cancelled-tiny-mode",this.dQ(v));g.gr(this.element,"ytp-autonav-cancelled-mini-mode",v.width<=400||v.height<=360);this.overlay&&g.ym(this.overlay.element,{width:v.width+"px"});if(!this.C)for(v=0;v0&&(v= f*4,U=O<=M-2&&V>=A*4;if((A+1)/f*S/b>b/(A/(f+1)*S)&&U)V-=A*4,O+=2;else if(k)V-=f*4,v+=2;else if(U)V-=A*4,O+=2;else break}S=!1;V>=12&&Y*4-V<=6&&(O>=4||v>=4)&&(S=!0);V=v*96;z=O*54;b=V/z=v-2&&A>=O-2?U=1:A%2===0&&M%2===0&&(A<2&&M<2?A===0&&M===0&&(U=2):U=2),f=g.pd(f+this.G,Y),U!==0){k=this.stills[b];k||(k=new $n(this.player),this.stills[b]=k,r.appendChild(k.element));var c=Math.floor(z*A/O),a=Math.floor(V*M/v),x=Math.floor(z*(A+U)/O)-c-4,T=Math.floor(V*(M+U)/v)-a-4;g.FR(k.element,a,c);g.Ev(k.element,T,x);g.ym(k.element,"transitionDelay",(A+M)/20+"s");g.gr(k.element,"ytp-videowall-still-mini", U===1);g.gr(k.element,"ytp-videowall-still-large",U>2);U=Math.max(T,x);g.gr(k.element,"ytp-videowall-still-round-large",U>=256);g.gr(k.element,"ytp-videowall-still-round-medium",U>96&&U<256);g.gr(k.element,"ytp-videowall-still-round-small",U<=96);f=d[f];k.suggestion!==f&&(k.suggestion=f,U=k.api.D(),c=g.bE(k.element,"ytp-videowall-still-large")?"hqdefault.jpg":"mqdefault.jpg",dm(k,f,c),g.aP(U)&&!k.api.V("web_player_log_click_before_generating_ve_conversion_params")&&(U=f.qY(),c={},g.dB(k.api,"addEmbedsConversionTrackingParams", [c]),U=g.Te(U,c),k.updateValue("url",U)),(f=(f=f.sessionData)&&f.itct)&&k.api.setTrackingParams(k.element,f));b++}r.ariaBusy="false";g.gr(this.element,"ytp-endscreen-paginate",b=b;d--)v=this.stills[d],g.Ov(v.element),g.sM(v);this.stills.length=b}}; g.u.onVideoDataChange=function(){var v=this.player.getVideoData(1);this.videoData!==v&&(v!=null&&g.it(v)?(this.G=0,this.videoData=v,this.SB()):this.player.G0("missg",{vid:(v==null?void 0:v.videoId)||"",cpn:(v==null?void 0:v.clientPlaybackNonce)||""}))}; g.u.P8=function(){this.G+=this.stills.length;this.SB()}; g.u.yL=function(){this.G-=this.stills.length;this.SB()}; g.u.ou=function(){return this.Y.D_()}; g.u.wZ=function(v){v===1?(this.C=!1,this.B=this.videoData.clientPlaybackNonce,this.Y.oX(),this.t$&&this.SB()):(this.C=!0,this.t$&&Uh(this)&&(v===2?this.Y.QI():v===3&&this.Y.E8()))}; g.u.T9=function(v){if(v){for(v=0;v0||v.endSeconds>0||v.mutedAutoplayDurationMode!==2);if((this.player.isEmbedsShortsMode()||this.U)&&!O)return!0;var Y;var S=!!((v==null?0:g.it(v))||(v==null?0:(Y=v.suggestions)==null?0:Y.length));S=!YML(this.player)||S;v=v.Iv;Y=this.player.Kf();return S&&!v&&!Y&&!O}; g.u.WY=function(){return this.endScreen.WY()}; g.u.fI=function(){return this.WY()?this.endScreen.ou():!1}; g.u.cW=function(){this.player.oF("endscreen");g.gx.prototype.cW.call(this)}; g.u.load=function(){var v=this.player.getVideoData();var O=v.transitionEndpointAtEndOfStream;if(O&&O.videoId){var Y=this.player.QC().pE.get("heartbeat"),S=g.it(v);!S||O.videoId!==S.videoId||v.wp?(this.player.Bu(O.videoId,void 0,void 0,!0,!0,O),Y&&Y.A7("HEARTBEAT_ACTION_TRIGGER_AT_STREAM_END","HEARTBEAT_ACTION_TRANSITION_REASON_HAS_NEW_STREAM_TRANSITION_ENDPOINT"),v=!0):v=!1}else v=!1;v||(g.gx.prototype.load.call(this),this.endScreen.show())}; g.u.unload=function(){g.gx.prototype.unload.call(this);this.endScreen.hide();this.endScreen.destroy()}; g.u.onCueRangeEnter=function(v){this.MH()&&(this.endScreen.created||this.endScreen.create(),v.getId()==="load"&&this.load())}; g.u.onCueRangeExit=function(v){v.getId()==="load"&&this.loaded&&this.unload()}; g.u.onVideoDataChange=function(){dRv(this);this.B&&SMN(this)&&(this.endScreen&&(this.endScreen.hide(),this.endScreen.created&&this.endScreen.destroy(),this.endScreen.dispose()),this.Y?this.endScreen=new zl(this.player):this.endScreen=new kn(this.player),g.w(this,this.endScreen),g.TW(this.player,this.endScreen.element,4))};g.se("endscreen",rnJ);})(_yt_player);