!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]="81df4f57-102e-4689-b262-ae0c4a43b5fd",e._sentryDebugIdIdentifier="sentry-dbid-81df4f57-102e-4689-b262-ae0c4a43b5fd")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3003],{73003:(e,t,n)=>{n.r(t),n.d(t,{default:()=>S});var r=n(6029),i=n(21377),s=n(76356),o=n(99064),u=n(59018),a=n.n(u),l=n(55729),d=n(90248),c=n(65789),h=n(75751),m=n(42360),f=n(48686),p=n(85986),g=n(95195),x=n(25022),v=n(53214),y=n(14591),F=n(41735);let b=(0,F.default)(s.az).withConfig({componentId:"sc-ae384b7c-0"})(["cursor:move;transform-origin:top right;div{","}> div{border-top:1px solid ",";> div{min-height:268px;}}+ .cupTree-instruction-snackbar{transition:opacity 0.2s ease-in-out;opacity:0;}:hover{+ .cupTree-instruction-snackbar{opacity:1;pointer-events:none;}}"],e=>"rtl"===e.theme.settings.textDirection&&"transform-origin: top right 0px !important;",e=>e.theme.colors.onSurface.nLv4);function I(e){let{cupTree:t,roundDescriptions:n}=e,o=(0,l.useRef)([]),u=(0,l.useRef)(null),a=(0,l.useRef)(null),d="rtl"===(0,F.useTheme)().settings.textDirection,c=(0,l.useRef)(),{sourceTreeName:h,phaseFilter:m,rounds:g}=(0,p.B)(),x=(0,l.useCallback)(e=>{o.current.forEach(t=>t(e))},[o.current]),I=1===n.length,j=t.events.length>0,k=I&&/relegation|promotion/i.test(h),[S,E]=(0,l.useState)(!1),[T,w]=(0,l.useState)(!1),[C,_]=(0,l.useState)(1),[H,A]=(0,l.useState)(I?d?-300:300:0),[q,B]=(0,l.useState)(I?j?8:38:0);function D(e){("Control"===e.key||"Meta"===e.key)&&E(!0)}function M(e){S&&E(!1)}return(0,l.useEffect)(()=>{if(!c.current){var e;let t=null==(e=u.current)?void 0:e.getBoundingClientRect();t&&(c.current=t)}return document.addEventListener("keydown",D),document.addEventListener("keyup",M),()=>{document.removeEventListener("keydown",D),document.addEventListener("keyup",M)}},[S]),(0,l.useLayoutEffect)(()=>{function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;A(0),B(0);let r=t-n;if(0===r)return;let i=r>0?1:-1,s=n+.03*i;1===i&&s>t||-1===i&&se(t,s)))}let r=t.finished&&g[g.length-1].type===i.FFH.Finals&&!k;if("number"==typeof m&&m>0&&m<=4)return void requestAnimationFrame(()=>e(r?.92:1,C));if(a.current){let t=(a.current.clientWidth-36*!!r)/(300*n.length);t<.8&&C!==t&&requestAnimationFrame(()=>e(t,C))}},[m]),(0,r.jsxs)(s.az,{position:"relative",children:[(0,r.jsx)(v.eS,{onChange:o.current}),(0,r.jsx)(v.Cq,{roundNames:n,x:H,scale:C}),(0,r.jsx)(b,{ref:a,children:(0,r.jsx)(y.MapInteractionCSS,{disableZoom:!S,value:{scale:C,translation:{x:H,y:q}},onChange:e=>{let{scale:t,translation:n}=e;if(T||w(!0),t>=f.Yv&&t<=f.AK){var r,i,s,o,u,l;_(t),A(Math.max(-(((null==(r=c.current)?void 0:r.width)||0)*t*.8),Math.min(((null==(s=a.current)||null==(i=s.parentElement)?void 0:i.clientWidth)||f.IT)-100,n.x))),B(Math.max(-(((null==(o=c.current)?void 0:o.height)||0)*t*1),Math.min(((null==(l=a.current)||null==(u=l.parentElement)?void 0:u.clientHeight)||f.XV)-100,n.y)))}},children:(0,r.jsx)(s.az,{position:"relative",ref:u,children:(0,r.jsx)(v.Vr,{tree:t,columnWidth:300,depth:n.length,highlights:{set:x,clear:()=>x([])},isRelegationDecider:k})})})}),T?null:(0,r.jsx)(v._4,{}),(0,r.jsx)(v.Dg,{onZoomIn:()=>{requestAnimationFrame(()=>{_(Math.min(C+.1,f.AK))})},onZoomOut:()=>{requestAnimationFrame(()=>{_(Math.max(C-.1,f.Yv))})}})]})}let j={0:(0,r.jsx)(d.A,{id:"full_bracket"}),[i.FFH.EighthFinals]:(0,r.jsx)(d.A,{id:"bracket_top_n",values:{n:16}}),[i.FFH.Quarterfinals]:(0,r.jsx)(d.A,{id:"bracket_top_n",values:{n:8}})};function k(e){let{selectedTree:t,sport:n,uniqueTournamentId:u,uniqueTournamentSlug:d,categorySlug:m,seasonId:g,isCard:y=!0}=e,[F,b]=(0,l.useState)(0),k=function(e){let t=e.map(e=>e.type),n=[0];if(t.includes(i.FFH.EighthFinals)&&t.some(e=>e>i.FFH.EighthFinals)&&n.push(i.FFH.EighthFinals),t.includes(i.FFH.Quarterfinals)&&t.some(e=>e>i.FFH.Quarterfinals)&&n.push(i.FFH.Quarterfinals),n.length>1)return n}(t.rounds),S=null,E=a()(t.rounds.map(e=>e.description));if(F>0&&k){let e={...t,rounds:t.rounds.filter(e=>e.type<=k[F])};E=e.rounds.map(e=>e.description),S=(0,x.TI)(e,n,null)}else S=(0,x.TI)(t,n,null);if(0===F&&(!S||!(0,x.ov)(S)))return null;let T=[];return t.showSingleParticipantByeBlocks||(T=(0,x.BE)(t.rounds)),(0,r.jsx)(h.t,{tag:"CupTree",children:(0,r.jsxs)(c.HH,{isCard:y,children:[(0,r.jsx)(v.Y9,{id:t.id,name:t.name,sport:n,phaseSelector:k&&(0,r.jsx)(o.ms,{items:k,alignRight:!0,selectedItem:k[F],renderItem:e=>{if("number"==typeof e)return j[e]},onSelectedItemChange:e=>{"number"==typeof e.selectedItemIndex&&b(e.selectedItemIndex)}})}),(0,r.jsx)(s.az,{style:{maxHeight:f.XV},overflow:"hidden","data-tree-id":t.id,children:(0,r.jsx)(p.J,{sport:n,tournamentId:u,seasonId:g,sourceTreeId:t.id,rounds:t.rounds,sourceTreeName:t.name,showSingleParticipantByeBlocks:t.showSingleParticipantByeBlocks,phaseFilter:k?k[F]:void 0,entrantsPerRound:T,children:(0,r.jsx)(I,{cupTree:S,roundDescriptions:E})})}),(0,x.KA)(T)&&(0,r.jsx)(v.eo,{}),(0,r.jsx)(v.fT,{uniqueTournamentId:u,uniqueTournamentSlug:d,categorySlug:m,seasonId:g,cupTree:t,sport:n})]})},t.id)}function S(e){let{uniqueTournamentId:t,uniqueTournamentSlug:n,categorySlug:i,seasonId:s,sport:o,isCard:u=!0}=e,[a,l]=(0,g.Q)(t,s);return l?(0,r.jsx)(m.A,{}):a?(0,r.jsx)(r.Fragment,{children:a.map(e=>(0,r.jsx)(k,{selectedTree:e,uniqueTournamentId:t,uniqueTournamentSlug:n,categorySlug:i,seasonId:s,sport:o,isCard:u},e.id))}):null}}}]);