1import{c as e,r as t,j as r}from"./vendor-react-DbsVTsKS.js";import{M as n}from"./index-Dirtnqiz.js";import{ae as a,bj as s,br as o,a6 as l,bh as i}from"./app-constants-D3ojol5R.js";import{u as d}from"./vendor-i18n-DiTKF2NC.js";import"./vendor-ui-B_XW8Pya.js";import"./vendor-charts-CG7l663-.js";import"./vendor-otel-B3hnpEUX.js";import"./vendor-virtuoso-CT6D0QVj.js";import"./vendor-markdown-CiT-VfZw.js";const c=e=>{if(!e)return"";try{return new Date(1e3*e).toLocaleString(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch{return""}},u=e=>e?e.trim().charAt(0).toUpperCase():"?",m=e=>{if(!e)return"#909090";let t=0;for(let r=0;r<e.length;r++)t=e.charCodeAt(r)+((t<<5)-t);return`hsl(${Math.abs(t)%360}, 68%, 48%)`},h=({name:e,image:t,score:n,isWinner:a,isLoser:s,isDarkMode:o})=>r.jsxs("div",{className:"flex items-center gap-1.5 py-[1px]",children:[r.jsxs("div",{className:"w-4 h-4 flex-shrink-0 relative",children:[t?r.jsx("img",{src:i(t),alt:"",className:"w-4 h-4 object-contain rounded-full absolute inset-0",loading:"lazy",decoding:"async",onError:e=>{e.currentTarget.style.display="none";const t=e.currentTarget.nextElementSibling;t&&(t.style.display="flex")}}):null,r.jsx("span",{style:{display:t?"none":"flex",backgroundColor:m(e)},className:"w-4 h-4 rounded-full items-center justify-center text-white text-[8px] font-bold absolute inset-0",children:u(e)})]}),r.jsx("span",{className:`flex-1 min-w-0 truncate text-[11px] leading-tight ${a?"font-bold":"font-medium"} ${s?o?"text-gray-500":"text-gray-400":o?"text-gray-100":"text-gray-900"}`,children:e||"?"}),r.jsx("span",{className:`flex-shrink-0 w-4 text-right text-[11px] leading-tight ${a?"font-bold":"font-medium"} ${s?o?"text-gray-500":"text-gray-400":o?"text-gray-100":"text-gray-900"}`,children:n??"â"})]}),g=({match:e,isDarkMode:t,t:n,onOpen:a,isContextMatch:i})=>{const d=s(e),u=d||o(e),m=u&&"number"==typeof e.homeGoalCount?e.homeGoalCount:null,g=u&&"number"==typeof e.awayGoalCount?e.awayGoalCount:null,x=d&&null!=m&&null!=g&&m>g,y=d&&null!=m&&null!=g&&g>m,b=l(e,n,!1);return r.jsxs("button",{type:"button",onClick:a,title:`${e.home_name??""} vs ${e.away_name??""}`,className:"w-full text-left rounded-md border px-2 py-1.5 shadow-sm transition-colors "+(i?t?"border-blue-500 bg-blue-900/30 ring-1 ring-blue-500":"border-blue-400 bg-blue-50 ring-1 ring-blue-300":t?"border-gray-600 bg-gray-800 hover:bg-gray-700":"border-gray-300 bg-white hover:bg-gray-50"),children:[r.jsxs("div",{className:"flex items-center justify-between mb-1 gap-1",children:[r.jsx("span",{className:"text-[9px] truncate "+(t?"text-gray-400":"text-gray-500"),children:c(e.date_unix)}),b.text&&r.jsx("span",{className:`text-[8px] px-1 rounded-sm font-medium leading-tight flex-shrink-0 ${b.className}`,children:b.text})]}),r.jsx(h,{name:e.home_name,image:e.home_image,score:m,isWinner:x,isLoser:y,isDarkMode:t}),r.jsx(h,{name:e.away_name,image:e.away_image,score:g,isWinner:y,isLoser:x,isDarkMode:t})]})},x=({rounds:o,league:l,isDarkMode:i,initialRoundId:c,currentMatchId:u,homeTeamId:m,awayTeamId:h})=>{var x;const{t:y}=d(),b=e(),{setMatchDetailsData:p}=t.useContext(n),f=t.useRef(null),j=t.useRef({}),v=t.useRef(null),w=t.useRef(!1),k=t.useMemo(()=>{if(!o||0===o.length)return 0;const e=o.findIndex(e=>String(e.round_id)===String(c));return e>=0?e:0},[o,c]),[N,C]=t.useState(k),[M,_]=t.useState({}),D=80*t.useMemo(()=>Math.max(1,...(o||[]).map(e=>{var t;return(null==(t=e.matches)?void 0:t.length)||1})),[o]),R=t.useCallback(()=>{const e=f.current;if(!e||!o||0===o.length)return;const t=e.getBoundingClientRect(),r=t.left+t.width/2;let n=0,a=1/0;const s={};o.forEach((e,o)=>{const l=j.current[e.round_id??o];if(!l)return;const i=l.getBoundingClientRect(),d=i.left+i.width/2,c=Math.abs(d-r),u=Math.min(1,c/Math.max(1,.6*t.width));s[e.round_id??o]={scale:1-.08*u,opacity:1-.45*u},c<a&&(a=c,n=o)}),_(s),C(n)},[o]),A=t.useCallback(()=>{v.current||(v.current=requestAnimationFrame(()=>{v.current=null,R()}))},[R]),L=t.useCallback((e,t="smooth")=>{if(!o||0===o.length)return;const r=Math.max(0,Math.min(o.length-1,e)),n=o[r],a=j.current[(null==n?void 0:n.round_id)??r];a&&a.scrollIntoView({behavior:t,inline:"center",block:"nearest"})},[o]);t.useEffect(()=>{w.current||(w.current=!0,L(k,"auto"),requestAnimationFrame(R))},[k,L,R]),t.useEffect(()=>(R(),window.addEventListener("resize",R),()=>{window.removeEventListener("resize",R),v.current&&cancelAnimationFrame(v.current)}),[R]);const $=t.useCallback(e=>{"ArrowRight"===e.key?(e.preventDefault(),L(N+1)):"ArrowLeft"===e.key&&(e.preventDefault(),L(N-1))},[N,L]),I=t.useCallback(e=>{if(!(null==e?void 0:e.id))return;const t=l??{};p({match:e,league:t,isPremiumUnlocked:!1}),a({match:e,league:t,isPremiumUnlocked:!1}),b(`/match/${e.id}`)},[l,b,p]);if(!o||0===o.length)return null;const E=e=>e.id===u||null!=m&&(e.homeID===m||e.awayID===m)||null!=h&&(e.homeID===h||e.awayID===h);return r.jsxs("div",{className:"mt-1",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2 px-1 gap-2",children:[r.jsx("button",{type:"button",onClick:()=>L(N-1),disabled:0===N,"aria-label":y("matchAnalysis.standings.previousRound","Previous round"),className:"w-6 h-6 flex-shrink-0 flex items-center justify-center rounded-full border transition-colors "+(0===N?"opacity-30 curs
1or-not-allowed "+(i?"border-gray-600":"border-gray-300"):i?"border-gray-500 hover:bg-gray-700 text-gray-200":"border-gray-400 hover:bg-gray-200 text-gray-700"),children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"15 18 9 12 15 6"})})}),r.jsx("span",{className:"text-xs font-semibold truncate text-center "+(i?"text-gray-100":"text-gray-800"),children:null==(x=o[N])?void 0:x.name}),r.jsx("button",{type:"button",onClick:()=>L(N+1),disabled:N===o.length-1,"aria-label":y("matchAnalysis.standings.nextRound","Next round"),className:"w-6 h-6 flex-shrink-0 flex items-center justify-center rounded-full border transition-colors "+(N===o.length-1?"opacity-30 cursor-not-allowed "+(i?"border-gray-600":"border-gray-300"):i?"border-gray-500 hover:bg-gray-700 text-gray-200":"border-gray-400 hover:bg-gray-200 text-gray-700"),children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),r.jsx("div",{ref:f,onScroll:A,onKeyDown:$,tabIndex:0,role:"region","aria-label":y("matchAnalysis.standings.bracketRegionLabel","Knockout bracket, swipe to browse rounds"),className:"flex overflow-x-auto overflow-y-auto snap-x snap-mandatory pb-2 [&::-webkit-scrollbar]:hidden focus:outline-none",style:{scrollbarWidth:"none",maxHeight:"min(64vh, 460px)"},children:o.map((e,t)=>{var n;const a=0===t,l=t===o.length-1,d=e.matches||[],c=d.length||1,u=D/c,m=M[e.round_id??t]||{scale:1,opacity:1},h=l?0:(null==(n=o[t+1].matches)?void 0:n.length)||0,x=!l&&h>0&&c===2*h,b=l&&1===d.length&&s(d[0]),p=b?d[0].homeGoalCount>d[0].awayGoalCount?d[0].home_name:d[0].away_name:null;return r.jsxs("div",{ref:r=>{r&&(j.current[e.round_id??t]=r)},className:"flex-shrink-0 snap-center transition-transform duration-150 ease-out",style:{width:208,marginRight:l?0:28,transform:`scale(${m.scale})`,opacity:m.opacity,transformOrigin:"50% 0%"},children:[r.jsx("div",{className:"text-center text-[10px] font-semibold mb-1.5 truncate px-1 "+(i?"text-gray-300":"text-gray-600"),children:e.name}),r.jsxs("div",{className:"relative",style:{height:D},children:[0===d.length?r.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-center text-[10px] rounded-md px-2 "+(i?"text-gray-500 bg-gray-700/30":"text-gray-400 bg-gray-100"),children:e.description||y("matchAnalysis.standings.noMatchesForRound","No match data available for this round.")}):d.map((e,t)=>r.jsx("div",{className:"absolute left-0 right-0 flex items-center px-1",style:{to
1p:t*u,height:u},children:r.jsxs("div",{className:"relative w-full",children:[!l&&r.jsx("span",{"aria-hidden":"true",className:"absolute top-1/2 h-[2px] "+(i?"bg-gray-600":"bg-gray-300"),style:{left:"100%",width:14,transform:"translateY(-1px)"}}),!a&&r.jsx("span",{"aria-hidden":"true",className:"absolute top-1/2 h-[2px] "+(i?"bg-gray-600":"bg-gray-300"),style:{right:"100%",width:14,transform:"translateY(-1px)"}}),r.jsx(g,{match:e,isDarkMode:i,t:y,onOpen:()=>I(e),isContextMatch:E(e)})]})},e.id??t)),x&&Array.from({length:Math.floor(c/2)}).map((e,t)=>{const n=(2*t+.5)*u,a=(2*t+1.5)*u;return r.jsx("span",{"aria-hidden":"true",className:"absolute w-[2px] "+(i?"bg-gray-600":"bg-gray-300"),style:{left:"calc(100% + 14px)",top:n,height:a-n}},`connector-${t}`)})]}),b&&p&&r.jsxs("div",{className:"text-center mt-2 text-[11px] font-bold "+(i?"text-yellow-400":"text-yellow-600"),children:["ð ",p]})]},e.round_id??t)})}),o.length>1&&r.jsx("div",{className:"flex items-center justify-center gap-1.5 mt-1",children:o.map((e,t)=>r.jsx("button",{type:"button",onClick:()=>L(t),"aria-label":y("matchAnalysis.standings.jumpToRound",{round:e.name,defaultValue:`Jump to ${e.name}`}),"aria-current":t===N,className:"rounded-full transition-all "+(t===N?"w-4 h-1.5 bg-blue-500":"w-1.5 h-1.5 "+(i?"bg-gray-600":"bg-gray-300"))},e.round_id??t))})]})};export{x as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.