!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cd4468fe-a97d-4755-af4d-d94802c84eef",e._sentryDebugIdIdentifier="sentry-dbid-cd4468fe-a97d-4755-af4d-d94802c84eef")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3307],{23307:(e,t,a)=>{a.r(t),a.d(t,{default:()=>y});var s=a(6029),n=a(21377),r=a(21501),i=a(41249),o=a(59411),c=a(27956),l=a(14632),d=a(55729),m=a(947),p=a(41735),f=a(75751);let u=Object.assign({},c,o,l),h=u.scaleLinear().domain([0,3]).range([0,102]),g=p.default.div.withConfig({componentId:"sc-499aa4cb-0"})(["position:relative;height:",";width:100%;overflow:hidden;"," div.timeSpan{position:absolute;top:0;height:100%;padding-top:2px;background-color:",";text-align:center;border-radius:2px 2px 0 0;}div.avgPoints{width:100%;background-color:",";position:absolute;bottom:0;border-radius:2px 2px 0 0;}img{height:",";}"],"".concat(128,"px"),e=>"rtl"===e.theme.settings.textDirection&&"transform: scale(-1,1);",e=>e.theme.colors.surface.s2,e=>e.theme.colors.secondary.default,"".concat(20,"px"));function y(e){let{managerCareerHistory:t,managerDetails:a}=e,o=(0,d.useRef)(null),c=(0,r.uc)(o,{},100)||0,l=(0,m.A)(),y=(0,p.useTheme)(),[x,b]=(0,d.useState)(0),v=a.manager.performance,T=v?v.totalPoints/v.total:0,j=t.careerHistory.filter((e,t)=>e.endTimestamp||!e.endTimestamp&&0===t).reverse();return(0,d.useEffect)(()=>{c&&o.current&&b(function(e,t,a,s){let r=u.select(e),i=function(e,t,a){let s=Date.now()/1e3;(!e.endTimestamp||e.endTimestamp>s)&&(e.endTimestamp=s);let n=u.scaleTime().domain([t,e.endTimestamp]).range([0,a]);if(!(n(e.endTimestamp||0)-n(e.startTimestamp)>=20)){let s=u.scaleLinear().domain([0,a]).range([t,e.endTimestamp]),r=25-(a-n(e.endTimestamp)),i=s(a+r+1);n.domain([t,i]),e.endTimestamp=i}return n}(t[t.length-1],t[0].startTimestamp,a),o=e=>i(e.startTimestamp)+1,c=e=>i(e.endTimestamp||0)-i(e.startTimestamp)-1;r.selectAll("img").data(t).style("display",e=>c(e)>=20?"initial":"none");let l=r.selectAll("div.timeSpan").data(t).style("left",e=>"".concat(o(e),"px")).style("width",e=>"".concat(c(e),"px")).enter().append("div").attr("class","timeSpan").style("left",e=>"".concat(o(e),"px")).style("width",e=>"".concat(c(e),"px"));return l.append("img").attr("src",e=>e.team?n.cWY.image(Number(e.team.id)):"/static/images/placeholders/team.svg").style("display",e=>c(e)>=20?"initial":"none").attr("onerror","this.src='/static/images/placeholders/team.svg'"),l.append("div").attr("class","avgPoints").style("height",0).transition().delay((e,t)=>50*t).duration(500).style("height",e=>{let{performance:t}=e;return t?"".concat(h(t.totalPoints/t.total),"px"):0}),l.on("mouseover",(e,t)=>{t.team&&u.select("#js-manager-history-".concat(t.team.id,"-").concat(t.startTimestamp)).style("background",s.colors.surface.s2)}).on("mouseout",(e,t)=>{t.team&&u.select("#js-manager-history-".concat(t.team.id,"-").concat(t.startTimestamp)).style("background",s.colors.surface.s1)}),c(t[t.length-1])}(o.current,j,c,y))},[a.manager.id,c,o.current]),(0,s.jsx)(f.t,{tag:"ManagerHistoryGraph",children:(0,s.jsxs)(i.az,{pt:"sm",px:"lg",children:[(0,s.jsxs)(i.so,{align:"flex-end",children:[(0,s.jsxs)(i.so,{h:114,my:-6,w:20,direction:"column",justify:"space-between",children:[(0,s.jsx)(i.EY,{font:"assistive.micro",color:"onSurface.nLv3",children:"3"}),(0,s.jsx)(i.EY,{font:"assistive.micro",color:"onSurface.nLv3",children:"2"}),(0,s.jsx)(i.EY,{font:"assistive.micro",color:"onSurface.nLv3",children:"1"}),(0,s.jsx)(i.EY,{font:"assistive.micro",color:"transparent",children:"0"})]}),(0,s.jsx)(g,{ref:o,children:T&&(0,s.jsx)(i.az,{position:"absolute",left:0,bottom:h(T),border:"transparent",borderTop:"error.default",borderBottom:"0",h:1,w:"100%",zIndex:i.Py.Button,style:{borderStyle:"dashed"}})})]}),(0,s.jsxs)(i.so,{h:26,pl:20,justify:"space-between",align:"center",children:[(0,s.jsxs)(i.EY,{font:"assistive.micro",color:"onSurface.nLv3",children:["'",l.formatDate(1e3*j[0].startTimestamp,{year:"2-digit"})]}),(0,s.jsxs)(i.EY,{font:"assistive.micro",color:"onSurface.nLv3",mr:"".concat(x>0?x-14:0,"px"),children:["'",l.formatDate(1e3*j[j.length-1].startTimestamp,{year:"2-digit"})]})]})]})})}}}]);