import{oi as e,ui as t}from"./vendor-DlcENO3s.js";import{r as n}from"./match-status-utils-DwQOYIBi.js";import{Dt as r,R as i}from"./index-DzbXm3fG.js";import{t as a}from"./status-pill-Bt5YywK0.js";import{t as o}from"./MapImage-B_WSCLd4.js";var s=e();function c({match:e,gameSlug:c,hideSpoilers:l}){let u=e.team1,d=e.team2,f=e.mapResults??[],p=e.mapResults?.filter(e=>n(e)&&e.winnerId===u.id).length??0,m=e.mapResults?.filter(e=>n(e)&&e.winnerId===d.id).length??0,h=[...f].reverse().find(e=>!n(e)&&(e.team1Score>0||e.team2Score>0)),g=f.find(e=>!n(e)&&e.team1Score===0&&e.team2Score===0),_=e.status===`live`,v=h??(_?g:void 0)??[...f].filter(n).slice(-1)[0],y=u.rating==null?null:Math.round(u.rating),b=d.rating==null?null:Math.round(d.rating),x=e.winProbabilityA??null,S=e.winProbabilityB??null,C=v?f.indexOf(v):-1,w=_&&!l&&v&&v===h?v:null;return(0,s.jsx)(t,{to:`/${c}/matches/${e.id}`,className:r(`glk-card glk-card-interactive !p-0 group relative block overflow-hidden`,`glk-featured-match`),style:{borderLeft:`3px solid var(--glk-brand)`,backgroundImage:`linear-gradient(135deg, color-mix(in srgb, var(--glk-brand) 6%, transparent), transparent 60%)`},children:(0,s.jsxs)(`div`,{className:`p-4`,children:[(0,s.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,s.jsx)(a,{tone:`live`,size:`xs`,pulse:!0,children:`Live`}),e.tournament?.name&&(0,s.jsxs)(`span`,{className:`min-w-0 truncate text-xs text-zinc-600 dark:text-zinc-300`,children:[e.tournament.name,e.stage?(0,s.jsxs)(`span`,{className:`text-zinc-400`,children:[` · `,e.stage]}):null]}),e.format&&(0,s.jsx)(`span`,{className:`rounded border border-zinc-200 px-1.5 py-0.5 text-2xs font-bold tracking-wider text-zinc-500 dark:border-white/10 dark:text-zinc-400`,children:e.format.toUpperCase()}),v&&(0,s.jsxs)(`span`,{className:`glk-featured-current-map ml-auto flex items-center gap-1.5 text-xs`,children:[(0,s.jsxs)(`span`,{className:`glk-eyebrow`,children:[`Map `,C>=0?C+1:f.length]}),(0,s.jsx)(`span`,{className:`capitalize text-zinc-600 dark:text-zinc-300`,children:v.mapName.toLowerCase()})]})]}),(0,s.jsxs)(`div`,{className:`glk-featured-main mt-4 grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-4`,children:[(0,s.jsxs)(`div`,{className:`glk-featured-team glk-featured-team-1 flex min-w-0 items-center gap-3`,children:[(0,s.jsx)(i,{name:u.name,slug:u.slug,abbreviation:u.abbreviation,logoUrl:u.logoUrl,size:`lg`}),(0,s.jsxs)(`div`,{className:`min-w-0`,children:[(0,s.jsx)(`div`,{className:`truncate text-[18px] font-bold tracking-tight text-zinc-900 dark:text-zinc-50`,style:{fontFamily:`var(--font-display)`},children:u.name}),(0,s.jsx)(`div`,{className:`text-xs text-zinc-500 dark:text-zinc-400`,children:y!=null&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`span`,{className:`glk-eyebrow mr-1`,children:`Rating`}),(0,s.jsx)(`span`,{className:`glk-metric glk-metric-sm text-zinc-700 dark:text-zinc-200`,children:y})]})})]})]}),(0,s.jsxs)(`div`,{className:`glk-featured-score flex flex-col items-center`,children:[(0,s.jsx)(`div`,{className:`flex items-baseline gap-1.5 font-mono font-bold leading-none tracking-tight`,children:l?(0,s.jsx)(`span`,{className:`text-zinc-400 dark:text-zinc-500`,style:{fontSize:36},children:`· — ·`}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`span`,{className:r(`glk-tabular`,p>=m?`text-zinc-900 dark:text-zinc-50`:`text-zinc-400 dark:text-zinc-500`),style:{fontSize:36},children:p}),(0,s.jsx)(`span`,{className:`text-zinc-400 dark:text-zinc-600`,style:{fontSize:28},children:`–`}),(0,s.jsx)(`span`,{className:r(`glk-tabular`,m>=p?`text-zinc-900 dark:text-zinc-50`:`text-zinc-400 dark:text-zinc-500`),style:{fontSize:36},children:m})]})}),(0,s.jsx)(`div`,{className:`glk-featured-series-eyebrow glk-eyebrow mt-1.5`,children:`Map Series`}),w&&(0,s.jsxs)(`div`,{className:`glk-featured-live-map mt-1.5 flex items-center gap-1.5 text-2xs`,"aria-label":`Live round score: ${w.mapName}, ${w.team1Score} to ${w.team2Score}`,children:[(0,s.jsx)(`span`,{className:`glk-live-dot`,"aria-hidden":`true`}),(0,s.jsx)(`span`,{className:`font-semibold capitalize text-zinc-700 dark:text-zinc-200`,children:w.mapName.toLowerCase()}),(0,s.jsxs)(`span`,{className:`glk-metric glk-tabular text-zinc-900 dark:text-zinc-50`,children:[w.team1Score,`–`,w.team2Score]})]})]}),(0,s.jsxs)(`div`,{className:`glk-featured-team glk-featured-team-2 flex min-w-0 items-center justify-end gap-3`,children:[(0,s.jsxs)(`div`,{className:`glk-featured-team-2-meta min-w-0 text-right`,children:[(0,s.jsx)(`div`,{className:`truncate text-[18px] font-bold tracking-tight text-zinc-900 dark:text-zinc-50`,style:{fontFamily:`var(--font-display)`},children:d.name}),(0,s.jsx)(`div`,{className:`text-xs text-zinc-500 dark:text-zinc-400`,children:b!=null&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`span`,{className:`glk-eyebrow mr-1`,children:`Rating`}),(0,s.jsx)(`span`,{className:`glk-metric glk-metric-sm text-zinc-700 dark:text-zinc-200`,children:b})]})})]}),(0,s.jsx)(i,{name:d.name,slug:d.slug,abbreviation:d.abbreviation,logoUrl:d.logoUrl,size:`lg`})]})]}),f.length>0&&!l&&(()=>{let e=Math.min(f.length,5);return(0,s.jsx)(`div`,{className:`mt-4 grid gap-2`,style:{gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`},children:f.slice(0,e).map((e,t)=>{let i=_&&e===v&&!n(e),a=e.winnerId===u.id;return(0,s.jsxs)(`div`,{className:r(`relative flex items-center gap-3 overflow-hidden rounded-md border px-2.5 py-2`,i?`glk-card-live-tint`:`border-zinc-200 bg-zinc-50 dark:border-white/[0.06] dark:bg-white/[0.02]`),children:[(0,s.jsxs)(`div`,{className:`pointer-events-none absolute inset-0`,"aria-hidden":`true`,children:[(0,s.jsx)(o,{name:e.mapName,variant:`strip`,index:t,total:f.length,grayed:!i&&!n(e)}),(0,s.jsx)(`div`,{className:r(`absolute inset-0`,i?`glk-card-live-scrim`:`bg-zinc-50/80 dark:bg-zinc-900/80`)})]}),i&&(0,s.jsx)(`span`,{className:`glk-live-dot absolute right-1.5 top-1.5 z-20`,"aria-label":`Live map`}),(0,s.jsxs)(`div`,{className:`relative z-10 min-w-0 flex-1`,children:[(0,s.jsxs)(`div`,{className:`glk-eyebrow`,children:[`Map `,t+1]}),(0,s.jsx)(`div`,{className:`truncate text-sm font-semibold capitalize text-zinc-800 drop-shadow-[0_1px_1px_rgba(0,0,0,0.25)] dark:text-zinc-100`,children:e.mapName.toLowerCase()})]}),(0,s.jsxs)(`div`,{className:r(`glk-metric glk-tabular relative z-10 mt-3 flex items-center gap-1.5 self-end rounded-md border border-white/10 bg-zinc-950/60 px-2 py-1 text-sm leading-none shadow-[inset_0_1px_0_rgba(255,255,255,0.06)] backdrop-blur-[2px] dark:border-white/10 dark:bg-black/50`,i&&`mr-3`),children:[(0,s.jsx)(`span`,{className:r(n(e)&&!a?`text-zinc-200 dark:text-zinc-500`:`text-zinc-100`),children:e.team1Score}),(0,s.jsx)(`span`,{className:`text-zinc-300 dark:text-zinc-600`,children:`·`}),(0,s.jsx)(`span`,{className:r(n(e)&&a?`text-zinc-200 dark:text-zinc-500`:`text-zinc-100`),children:e.team2Score})]})]},t)})})})(),!l&&x!=null&&S!=null&&!_&&(0,s.jsxs)(`div`,{className:`mt-4`,children:[(0,s.jsxs)(`div`,{className:`glk-eyebrow mb-1.5 flex items-center justify-between`,children:[(0,s.jsx)(`span`,{className:`flex items-center gap-1.5`,children:`Win Probability`}),(0,s.jsx)(`span`,{className:`normal-case tracking-normal text-zinc-400 dark:text-zinc-500`,children:`Glicko matchup`})]}),(0,s.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full`,style:{background:`linear-gradient(90deg,
                  var(--glk-prob-a) 0%,
                  var(--glk-prob-a) ${Math.max(0,x-18)}%,
                  var(--glk-prob-b) ${Math.min(100,x+18)}%,
                  var(--glk-prob-b) 100%)`}}),(0,s.jsxs)(`div`,{className:`glk-tabular mt-1 flex min-w-0 justify-between gap-2 text-2xs`,children:[(0,s.jsxs)(`span`,{className:`truncate font-bold`,style:{color:`var(--glk-prob-a)`},children:[u.abbreviation??u.name,` `,x,`%`]}),(0,s.jsxs)(`span`,{className:`truncate text-right font-bold`,style:{color:`var(--glk-prob-b)`},children:[S,`% `,d.abbreviation??d.name]})]})]})]})})}export{c as t};