1import{j as e}from"./vendor-ui-DVg5vlja.js";import{L as O,a9 as U,l as F}from"./layout-G0LJ2LXm.js";import{O as T}from"./OpenInSportsbookButton-DOXVQtns.js";import{c as L,a as y,C as b,p as I,k as u}from"./index-BNgjLe9x.js";import{S as _}from"./skeleton-DJZ21Dig.js";import{u as E}from"./vendor-query-DdcG7b8d.js";import{r as p}from"./vendor-charts-0WqoWmMF.js";import{R as P}from"./refresh-cw-CVNP42wc.js";import{M as R}from"./map-pin-CiWBwn3p.js";import{C as $}from"./chevron-up-nwO4_gQL.js";import"./input-Czw0F4nb.js";import"./affiliate-links-BAUpR8Rt.js";import"./vendor-react-BzrpNAyj.js";/** 2 * @license lucide-react v0.545.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const D=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],q=L("clock-3",D);/** 7 * @license lucide-react v0.545.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const H=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],V=L("radio",H);function K(r){return Array.from(new Set(r.flatMap(t=>t.matchups.flatMap(o=>[...(o.moneylineA??[]).map(i=>i.book),...(o.moneylineB??[]).map(i=>i.book),...(o.roundsTotals??[]).map(i=>i.book),...(o.propMarkets??[]).flatMap(i=>i.selections.map(d=>d.book))]))))}const j="â",z=[["height","Height"],["weight","Weight"],["age","Age"],["reach","Reach"],["stance","Stance"],["fightingStyle","Fighting style"],["knockoutRecord","(T)KO record"],["submissionRecord","Submission record"]];function k(r){try{return new Intl.DateTimeFormat("en-US",{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(new Date(r))}catch{return r}}function w(r){try{return new Intl.DateTimeFormat("en-US",{weekday:"long",month:"long",day:"numeric"}).format(new Date(r))}catch{return r}}function Q(r,t){return(r??[]).filter(o=>t.has(o.book)).sort((o,i)=>i.price-o.price)}function h(r){if(!Number.isFinite(r)||r<=1)return j;const t=r>=2?Math.round((r-1)*100):Math.round(-100/(r-1));return t>0?`+${t}`:String(t)}function W(r){return r?[r.name,r.city,r.country].filter(Boolean).join(" · "):""}function Y(r){return r?String(r):"â"}function Z({fighter:r}){return r.headshot?e.jsx("img",{src:r.headshot,alt:"",className:"h-14 w-14 shrink-0 rounded-full object-cover ring-2 ring-primary/40"}):e.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-full bg-primary/15 text-sm font-bold text-primary ring-2 ring-primary/35",children:(r.shortName??r.name).slice(0,2).toUpperCase()})}function S({fighter:r}){return r.headshot?e.jsx("img",{src:r.headshot,alt:"",className:"h-8 w-8 shrink-0 rounded-full object-cover ring-1 ring-primary/40 sm:h-9 sm:w-9"}):e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/15 text-[9px] font-bold text-primary ring-1 ring-primary/35 sm:h-9 sm:w-9",children:(r.shortName??r.name).slice(0,2).toUpperCase()})}function G({odds:r,fighter:t,matchId:o,emptyLabel:i}){const{enabledBooks:d}=y(),l=r??[],m=Q(l,d);if(!m.length)return e.jsx("span",{className:"text-xs text-muted-foreground",children:l.length?"Filtered":i});const s=m[0];return e.jsx("div",{className:"flex flex-wrap justify-center gap-1.5 lg:justify-end",children:m.slice(0,4).map(a=>e.jsxs(T,{book:a.book,sport:"ufc",market:"moneyline",playerOrTeam:t.name,displayedPrice:h(a.price),gameId:String(o),sourcePage:"/ufc/schedule",sgoToken:a.token,className:u("rounded-md border px-2 py-1 text-[11px] font-bold transition-colors",a===s?"border-primary/60 bg-primary/15 text-primary":"border-border bg-background/60 text-muted-foreground hover:border-primary/40 hover:text-foreground"),ariaLabel:`Open ${t.name} at ${a.book}`,children:[a.book," ",e.jsx("span",{className:"font-mono",children:h(a.price)})]},`${a.book}-${a.price}`))})}function M({fighter:r,side:t,matchup:o,emptyOddsLabel:i}){const d=r.nickname?`"${r.nickname}"`:r.country;return e.jsxs("div",{className:u("min-w-0 flex-1 rounded-xl border border-border/80 bg-background/30 px-1.5 py-3 sm:px-3",t==="b"&&"lg:text-right"),children:[e.jsxs("div",{className:u("flex min-w-0 flex-col items-center gap-2 text-center lg:flex-row lg:gap-3 lg:text-left",t==="b"&&"lg:flex-row-reverse lg:text-right"),children:[e.jsx(Z,{fighter:r}
11),e.jsxs("div",{className:"min-w-0 w-full lg:w-auto",children:[e.jsx("div",{className:"break-words text-[13px] font-bold leading-tight sm:text-base",children:r.name}),d?e.jsx("div",{className:"break-words text-[11px] text-primary sm:text-xs",children:d}):null,e.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:r.record??"Record unavailable"})]})]}),e.jsxs("div",{className:u("mt-3 flex flex-col items-center gap-2 lg:flex-row lg:justify-between",t==="b"&&"lg:flex-row-reverse"),children:[e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[.16em] text-muted-foreground",children:"Moneyline"}),e.jsx(G,{odds:t==="a"?o.moneylineA:o.moneylineB,fighter:r,matchId:o.id,emptyLabel:i})]})]})}function C(r,t){const o=r.toLowerCase(),i=o==="yes"?"Yes":o==="no"?"No":o==="over"?"Over":o==="under"?"Under":r;return t===void 0?i:`${i} ${t}`}function J({matchup:r}){const[t,o]=p.useState(!1),{enabledBooks:i}=y(),d=r.roundsTotals?.length?{id:"rounds-completed",label:"Total rounds completed",selections:r.roundsTotals.flatMap(s=>[...s.overPrice?[{book:s.book,side:"over",line:s.line,price:s.overPrice,token:s.overToken}]:[],...s.underPrice?[{book:s.book,side:"under",line:s.line,price:s.underPrice,token:s.underToken}]:[]])}:null,l=[...d?[d]:[],...r.propMarkets??[]].map(s=>({...s,selections:s.selections.filter(a=>i.has(a.book))})).filter(s=>s.selections.length);if(!l.length)return null;const m=l.reduce((s,a)=>s+a.selections.length,0);return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border/70",children:[e.jsxs("button",{type:"button",onClick:()=>o(s=>!s),"aria-expanded":t,className:"flex w-full items-center justify-between gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/40",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold",children:"More markets"}),e.jsxs("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:[l.length," props · ",m," sportsbook offers"]})]}),t?e.jsx($,{className:"h-4 w-4 text-primary"}):e.jsx(F,{className:"h-4 w-4 text-muted-foreground"})]}),t?e.jsx("div",{className:"space-y-2 border-t border-border/70 p-3",children:l.map(s=>e.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/25 p-2.5",children:[e.jsx("div",{className:"mb-2 text-[11px] font-semibold",children:s.label}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.selections.map((a,f)=>e.jsxs(T,{book:a.book,sport:"ufc",market:s.label,playerOrTeam:`${r.fighterA.name} vs ${r.fighterB.name}`,displayedPrice:h(a.price),gameId:String(r.id),sourcePage:"/ufc/schedule",sgoToken:a.token,ariaLabel:`Open ${s.label} ${C(a.side,a.line)} at ${a.book}`,className:"rounded-md border border-border bg-card px-2 py-1 text-[10px] font-semibold text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground",children:[a.book," ",C(a.side,a.line)," ",e.jsx("span",{className:"font-mono",children:h(a.price)})]},`${a.book}-${a.side}-${a.line??""}-${f}`))})]},s.id))}):null]})}function X({matchup:r,expanded:t,onToggle:o,eventStatus:i}){const d=/final|completed|ended/i.test(i||"")?"Odds closed":"Not posted";return e.jsxs(b,{className:u("overflow-hidden border-border/80 bg-card/80 transition-all",t&&"border-primary/50 shadow-lg shadow-primary/5"),children:[e.jsxs("button",{type:"button",onClick:o,"aria-expanded":t,className:"w-full text-left",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-border/70 px-4 py-3",children:[e.jsx("span",{className:"flex h-6 min-w-6 items-center justify-center rounded bg-primary/15 px-1 font-mono text-[10px] font-bold text-primary",children:Y(r.order)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs font-bold uppercase tracking-[.14em] text-primary",children:[r.weightClass||"UFC Bout",r.order===1&&e.jsx("span",{className:"rounded border border-primary/40 bg-primary/15 px-1.5 py-0.5 text-[9px] tracking-wide text-primary",children:"MAIN EVENT"}),r.titleFight&&e.jsx("span",{className:"rounded bg-primary px-1.5 py-0.5 text-[9px] text-primary-foreground",children:"TITLE"})]}),e.jsx("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:r.titleFight?"Championship bout":"Scheduled matchup"})]}),t?e.jsx($,{className:"h-4 w-4 text-primary"}):e.jsx(F,{className:"h-4 w-4 text-muted-foreground"})]}),t?null:e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-1.5 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-col items-center gap-1.5 text-center lg:flex-row lg:justify-end lg:text-right",children:[e.jsx("div",{className:"min-w-0 break-words text-sm font-semibold max-lg:order-2",children:r.fighterA.name}),e.jsx(S,{fighter:r.fighterA})]}),e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full border border-primary/40 text-[9px] font-black text-primary sm:h-8 sm:w-8 sm:text-[10px]",children:"VS"}),e.jsxs("div",{className:"flex min-w-0 flex-col items-center gap-1.5 text-center lg:flex-row lg:text-left",children:[e.jsx(S,{fighter:r.fighterB}),e.jsx("div",{className:"min-w-0 break-words text-sm font-semibold",children:r.fighterB.name})]})]})]}),e.jsx("div",{className:u("grid transition-[grid-template-rows,opacity] duration-300",t?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"),children:e.jsx("div",{className:"min-h-0 overflow-hidden",children:e.jsxs("div",{className:"space-y-3 border-t border-border/70 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-stretch gap-1 sm:gap-2 lg:gap-3",children:[e.jsx(M,{fighter:r.fighterA,side:"a",matchup:r,emptyOddsLabel:d}),e.jsx("div",{className:"flex shrink-0 items-center text-[8px] font-black text-muted-foreground sm:text-[10px]",children:"VS"}),e.jsx(M,{fighter:r.fighterB,side:"b",matchup:r,emptyOddsLabel:d})]}),e.jsxs("div",{className:"rounded-lg border border-border/70 bg-background/25 p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-[10px] font-bold uppercase tracking-[.16em] text-muted-foreground",children:[e.jsx("span",{children:"Fighter context"}),e.jsx("span",{children:"Reported data"})]}),e.jsx("div",{className:"divide-y divide-border/60 rounded border border-border/60 bg-card/40",children:z.map(([l,m])=>e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(92px,auto)_minmax(0,1fr)] items-center gap-2 px-2 py-2.5 sm:px-3",children:[e.jsx("div",{className:"truncate text-left text-xs font-semibold",children:String(r.fighterA.stats?.[l]??j)}),e.jsx("div",{className:"text-center text-[9px] font-bold uppercase tracking-wide text-muted-foreground sm:text-[10px]",children:m}),e.jsx("div",{className:"truncate text-right text-xs font-semibold",children:String(r.fighterB.stats?.[l]??j)})]},l))})]}),e.jsx(J,{matchup:r})]})})})]})}function pe(){const{data:r,isLoading:t,isError:o,refetch:i,dataUpdatedAt:d}=E({queryKey:["ufc-schedule"],queryFn:async()=>{const n=await fetch("/api/ufc/schedule");if(!n.ok)throw new Error("Unable to load UFC schedule");return n.json()},staleTime:6e4,refetchInterval:6e4}),[l,m]=p.useState(null),[s,a]=p.useState("all"),{registerBooks:f}=y(),x=p.useMemo(()=>[...r?.data??[]].sort((n,c)=>{const g=/final|completed|ended/i.test(n.status||""),B=/final|completed|ended/i.test(c.status||"");return Number(g)-Number(B)||Date.parse(n.date||"")-Date.parse(c.date||"")}),[r?.data]),N=p.useMemo(()=>K(x),[x]);p.useEffect(()=>f(N),[N,f]);const v=p.useMemo(()=>s==="all"?x:x.filter(n=>String(n.id)===s),[x,s]),A=x.reduce((n,c)=>n+c.matchups.length,0);return e.jsx(O,{children:e.jsxs("div",{className:"ufc-command-center space-y-5",children:[e.jsxs("header",{className:"relative overflow-hidden rounded-2xl border border-primary/30 bg-[radial-gradient(circle_at_90%_0%,hsl(var(--primary)/.16),transparent_40%),linear-gradient(135deg,hsl(var(--card)),hsl(var(--background)))] p-5 sm:p-7",children:[e.jsx("div",{className:"absolute right-5 top-5 text-primary/20",children:e.jsx(U,{className:"h-24 w-24"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[10px] font-black uppercase tracking-[.22em] text-primary",children:[e.jsx(V,{className:"h-3.5 w-3.5"})," Fight week command center"]}),e.jsx("h1",{className:"max-w-xl text-2xl font-black tracking-tight sm:text-4xl",children:"UFC schedule & matchup research"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm text-muted-foreground",children:"Full card context, live prices, and fighter metrics in one fast board."}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-2 text-[11px] font-semibold text-muted-foreground",children:[e.jsxs("span",{className:"rounded-full border border-border bg-background/40 px-3 py-1.5",children:[x.length," event",x.length===1?"":"s"]}),e.jsxs("span",{className:"rounded-full border border-border bg-background/40 px-3 py-1.5",children:[A," matchups"]}),r?.retrievedAt||d?e.jsxs("span",{className:"rounded-full border border-border bg-background/40 px-3 py-1.5",children:["Updated ",r?.retrievedAt?k(r.retrievedAt):new Date(d).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})]}):null]})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-black uppercase tracking-[.18em] text-muted-foreground",children:"Upcoming card"}),e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:r?.range?`${w(r.range.start)} â ${w(r.range.end)}`:"Loading fight calendar"})]}),e.jsxs("select",{value:s,onChange:n=>a(n.target.value),className:"rounded-lg border border-border bg-card px-3 py-2 text-sm text-foreground",children:[e.jsx("option",{value:"all",children:"All events"}),x.map(n=>e.jsx("option",{value:String(n.id),children:n.name},n.id))]})]}),t?e.jsx("div",{className:"space-y-5",children:[1,2].map(n=>e.jsx(_,{className:"h-56 w-full rounded-2xl"},n))}):o?e.jsxs(b,{className:"flex flex-col items-center gap-3 p-10 text-center",children:[e.jsx(I,{className:"h-8 w-8 text-primary"}),e.jsx("p",{className:"font-semibold",children:"The fight calendar is unavailable."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Try again in a moment."}),e.jsxs("button",{onClick:()=>i(),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-bold text-primary-foreground",children:[e.jsx(P,{className:"h-4 w-4"})," Retry"]})]}):v.length?e.jsx("div",{className:"space-y-7",children:v.map(n=>e.jsxs("section",{children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold",children:n.name}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[n.date&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(q,{className:"h-3.5 w-3.5 text-primary"}),k(n.date)]}),n.venue&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(R,{className:"h-3.5 w-3.5 text-primary"}),W(n.venue)]})]})]}),e.jsx("span",{className:"rounded-full border border-primary/30 bg-primary/10 px-3 py-1 text-[10px] font-bold uppercase tracking-wider text-primary",children:n.status||"Scheduled"})]}),e.jsx("div",{className:"space-y-2",children:[...n.matchups].sort((c,g)=>(c.order??999)-(g.order??999)).map(c=>
11e.jsx(X,{matchup:c,expanded:l===c.id,onToggle:()=>m(l===c.id?null:c.id),eventStatus:n.status},c.id))})]},n.id))}):e.jsx(b,{className:"p-10 text-center text-muted-foreground",children:"No events are scheduled in this range."})]})})}export{pe 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.