1import{t as e,y as P,C as B,b as u}from"./index-MDSrXYZB.js";import{H as I}from"./HeroBleed-DvFt6AeZ.js";import{S as o,N as p,W as N,V as L,T as m,Q as E,U as A}from"./index-CmK9O5IZ.js";import{P as U,I as F,a as G}from"./page-header-C_cFHrTg.js";import{b as z}from"./app-store-buttons-BsIVKQIY.js";import{q as D,n as K,p as q}from"./index-zjnACzOi.js";import{C as Q,A as V}from"./center-DaGO3XtD.js";import{B as X}from"./badge-Bdyavm3n.js";import{C as y}from"./container-R8gsYCCj.js";import{S as Y}from"./simple-grid-Ble8rH-u.js";const J=t=>e.jsx(Q,{w:"full",h:"full",bg:"bg.muted",color:"fg.subtle",...t,children:e.jsx(D,{size:"48px"})});function Z(t){return`/workout/${t.guid}/${t.slug}`}const ee="https://my.latticetraining.com/workout",C="category",te=({workout:t})=>{const a=`${ee}/${t.guid}/${t.slug}`;return e.jsxs(o,{gap:{base:"4",md:"5"},h:"full",children:[e.jsx(p,{asChild:!0,flex:"1",children:e.jsx(P,{to:Z(t),style:{textDecoration:"none"},children:e.jsxs(o,{gap:{base:"4",md:"5"},align:"flex-start",h:"full",children:[e.jsx(V,{ratio:16/9,w:"full",maxH:"md",borderRadius:"lg",overflow:"hidden",children:t.imageUrl?e.jsx(N,{src:t.imageUrl,alt:t.name,objectFit:"cover"}):e.jsx(J,{})}),e.jsxs(o,{gap:"3",flex:"1",children:[e.jsxs(o,{align:"flex-start",gap:"2",children:[t.category&&e.jsx(X,{variant:"subtle",colorPalette:"gray",children:t.category.name}),e.jsx(L,{textStyle:{base:"xl",md:"2xl"},children:t.name})]}),t.excerpt&&e.jsx(m,{color:"fg.muted",textStyle:"md",children:t.excerpt})]}),t.durationMinutes&&e.jsxs(E,{gap:"1",color:"fg.muted",textStyle:"sm",children:[e.jsx(K,{"aria-hidden":!0}),e.jsxs(m,{children:[t.durationMinutes," min"]})]})]})})}),e.jsx(A,{asChild:!0,variant:"subtle",size:"sm",w:"full",children:e.jsxs("a",{href:a,"aria-label":`Open ${t.name}
1 in the Lattice Training app`,children:["Open in app",e.jsx(q,{"aria-hidden":!0})]})})]})},d=30,S=9,M="page";function se(t){const a=new Map;for(const s of t){if(!s.category)continue;const i=a.get(s.category.slug);i?i.count++:a.set(s.category.slug,{cat:s.category,count:1})}return[...a.values()].sort((s,i)=>i.count-s.count||s.cat.name.localeCompare(i.cat.name)).map(s=>s.cat)}const re=({categories:t,activeSlug:a})=>t.length===0?null:e.jsxs(E,{gap:"2",overflowX:"auto",flexWrap:{base:"nowrap",md:"wrap"},pb:"2",as:"nav","aria-label":"Workout category filter",children:[e.jsx(A,{variant:a===null?"primary":"subtle",size:"sm","aria-current":a===null?"page":void 0,flexShrink:"0",asChild:!0,children:e.jsx(P,{to:"/workouts",children:"All"})}),t.map(s=>e.jsx(A,{variant:a===s.slug?"primary":"subtle",size:"sm","aria-current":a===s.slug?"page":void 0,flexShrink:"0",asChild:!0,children:e.jsx(P,{to:`/workouts?${C}=${s.slug}`,children:s.name})},s.slug))]}),ae=({workouts:t})=>{const[a]=B(),s=a.get(C),i=Number(a.get(M)??"1"),R=Number.isFinite(i)&&i>=1?Math.floor(i):1,$=u.useMemo(()=>se(t),[t]),n=s?$.find(r=>r.slug===s)??null:null,[w,T]=u.useState(""),k=u.useDeferredValue(w),h=k.trim().toLowerCase(),c=h.length>0,f=u.useMemo(()=>n?t.filter(r=>r.category?.slug===n.slug):t,[t,n]),g=u.useMemo(()=>c?f.filter(r=>r.name.toLowerCase().includes(h)):f,[c,h,f]),l=g.length,j=Math.max(1,Math.ceil(l/S)),b=Math.min(R,j),v=u.useMemo(()=>{if(c)return l>d?g.slice(0,d):g;const r=(b-1)*S;return g.slice(r,r+S)},[c,l,g,b]),W=c&&l>d,O=n?n.name:"Workouts",_=n?`Workouts in ${n.name}.`:"A sample of the climbing-specific workouts available in the Lattice Training app. Browse the catalogue, then open a workout in the app to follow guided timers and log your sessions.",H=r=>{const x=[];return n&&x.push(`${C}=${n.slug}`),r>1&&x.push(`${M}=${r}`),x.length?`/workouts?${x.join("&")}`:"/workouts"};return e.jsxs(o,{gap:"0",children:[e.jsx(y,{py:{base:"16",md:"24"},pb:{base:"8",md:"12"},children:e.jsx(U,{tagline:"Workouts",headline:O,description:_,alignItems:"center",textAlign:"center"})}),e.jsx(p,{bg:"bg.subtle",children:e.jsx(y,{py:{base:"6",md:"8"},children:e.jsxs(o,{direction:{base:"column",md:"row"},gap:{base:"4",md:"8"},align:"center",justify:"center",textAlign:{base:"center",md:"left"},children:[e.jsxs(o,{gap:"1",children:[e.jsx(L,{as:"h2",textStyle:{base:"lg",md:"xl"},children:"Train these workouts in the app"}),e.jsx(m,{color:"fg.muted",textStyle:"sm",children:"Guided timers, session logging, and progress tracking."})]}),e.jsx(z,{height:40})]})})}),e.jsx(y,{py:{base:"12",md:"16"},children:e.jsxs(o,{gap:{base:"8",md:"12"},children:[e.jsx(p,{maxW:"lg",mx:"auto",w:"full",children:e.jsx(F,{type:"search",placeholder:"Search workoutsâ¦",value:w,onChange:r=>T(r.target.value),"aria-label":"Search workouts by name"})}),e.jsx(p,{srOnly:!0,"aria-live":"polite","aria-atomic":"true",children:c&&(l===0?`No workouts match ${h}.`:W?`Showing the first ${d} of ${l} matches â refine your search to narrow these results.`:`${l} ${l===1?"result":"results"}.`)}),e.jsx(re,{categories:$,activeSlug:n?.slug??null}),v.length===0?e.jsx(m,{color:"fg.muted",textAlign:"center",children:c?`No workouts match â${k.trim()}â.`:"No workouts available yet â check back soon."}):e.jsxs(o,{gap:"6",children:[W&&e.jsxs(m,{color:"fg.muted",textAlign:"center",textStyle:"sm",children:["Showing the first ",d," of ",l," ","matches â refine your search to narrow these results."]}),e.jsx(Y,{columns:{base:1,md:2,lg:3},gap:{base:"12",lg:"8"},children:v.map(r=>e.jsx(te,{workout:r},r.guid))})]}),!c&&j>1&&e.jsx(G,{currentPage:b,totalPages:j,hrefForPage:H,ariaLabel:"Workout pagination"})]})})]})};function ne({children:t}){return e.jsx(I,{withPadding:!0,children:t})}function pe({workouts:t}){return e.jsx(ne,{children:e.jsx(ae,{workouts:t})})}export{ee as A,J as I,pe as W,ne as a};
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.