import{G as e,o as t,q as n}from"./useStore-B9WcefOa.js";import{t as r}from"./link-CSxX31-N.js";import{a as i,i as a}from"./index-VYIssuI_.js";import{n as o,r as s,t as c}from"./Layout-uiA8q21U.js";var l=n(e(),1),u=t(),d=[`Ancient Maps`,`Antique Maps`,`Books`,`Colorado Art`,`Historic Colorado Photos`,`Old Map Reproductions`,`Old World Maps`,`Replogle Globes`,`Vintage Posters`,`Vintage Prints`];function f({product:e}){return(0,u.jsxs)(`article`,{className:`group flex flex-col border border-border bg-card p-4 text-center shadow-sm transition-shadow hover:shadow-md`,children:[(0,u.jsx)(r,{to:`/shop/$slug`,params:{slug:e.slug},className:`block`,children:(0,u.jsx)(`div`,{className:`flex h-56 items-center justify-center overflow-hidden`,children:(0,u.jsx)(`img`,{src:e.image,alt:e.title,loading:`lazy`,className:`max-h-56 w-auto object-contain transition-transform duration-300 group-hover:scale-105`})})}),(0,u.jsx)(`h3`,{className:`mt-4 flex-1 font-display text-lg leading-snug text-maroon`,children:(0,u.jsx)(r,{to:`/shop/$slug`,params:{slug:e.slug},children:e.title})}),(0,u.jsx)(`p`,{className:`mt-2 text-[15px] text-foreground/80`,children:e.price}),(0,u.jsx)(r,{to:`/shop/$slug`,params:{slug:e.slug},className:`mt-3 inline-block bg-maroon px-4 py-2 text-sm uppercase tracking-wide text-primary-foreground hover:bg-maroon-dark`,children:`Details`})]})}function p({title:e,intro:t,categoryFilter:n}){let[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(`default`),[_,v]=(0,l.useState)(`All`),y=(0,l.useMemo)(()=>{let e=i.filter(e=>!n||e.category===n);if(_!==`All`){let t=_.toLowerCase().replace(/\s+/g,`-`);e=e.filter(e=>e.category===t)}if(p.trim()){let t=p.toLowerCase();e=e.filter(e=>e.title.toLowerCase().includes(t))}let t=e=>Number(e.price.replace(/[^0-9.]/g,``));return h===`low`&&(e=[...e].sort((e,n)=>t(e)-t(n))),h===`high`&&(e=[...e].sort((e,n)=>t(n)-t(e))),h===`az`&&(e=[...e].sort((e,t)=>e.title.localeCompare(t.title))),e},[n,_,p,h]);return(0,u.jsxs)(c,{children:[(0,u.jsx)(o,{children:e}),(0,u.jsx)(s,{children:t}),(0,u.jsx)(`div`,{className:`mt-10 flex items-center justify-end`,children:(0,u.jsxs)(`select`,{value:h,onChange:e=>g(e.target.value),className:`h-11 border border-border bg-secondary px-4 text-maroon`,"aria-label":`Sort by`,children:[(0,u.jsx)(`option`,{value:`default`,children:`Sort By`}),(0,u.jsx)(`option`,{value:`az`,children:`Sort alphabetically`}),(0,u.jsx)(`option`,{value:`low`,children:`Price: low to high`}),(0,u.jsx)(`option`,{value:`high`,children:`Price: high to low`})]})}),(0,u.jsxs)(`div`,{className:`mt-6 grid gap-10 lg:grid-cols-[260px_1fr]`,children:[(0,u.jsxs)(`aside`,{children:[(0,u.jsx)(`h2`,{className:`font-display text-xl text-maroon`,children:`Filter results by keyword…`}),(0,u.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`Filter results by keyword`,className:`mt-3 h-11 w-full border border-border bg-card px-3 outline-none focus:border-[color:var(--gold)]`}),(0,u.jsx)(`hr`,{className:`my-6 border-border`}),(0,u.jsx)(`h2`,{className:`font-display text-xl text-maroon`,children:`Product Categories`}),(0,u.jsx)(`ul`,{className:`mt-3 space-y-2 text-[15px]`,children:[`All`,...d].map(e=>(0,u.jsx)(`li`,{children:(0,u.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,u.jsx)(`input`,{type:`radio`,name:`product-category`,checked:_===e,onChange:()=>v(e),className:`accent-[color:var(--maroon)]`}),e]})},e))}),(0,u.jsx)(`hr`,{className:`my-6 border-border`}),(0,u.jsx)(`h2`,{className:`font-display text-xl text-maroon`,children:`All Categories`}),(0,u.jsx)(`ul`,{className:`mt-3 max-h-96 space-y-1.5 overflow-y-auto pr-2 text-sm`,children:a.slice(0,60).map(e=>(0,u.jsx)(`li`,{children:(0,u.jsxs)(r,{to:`/categories-of-our-catalog`,className:`hover:text-maroon`,children:[e.name,` (`,e.count,`)`]})},e.path))})]}),(0,u.jsx)(`div`,{children:y.length===0?(0,u.jsxs)(`p`,{className:`text-foreground/80`,children:[`No items match this filter yet. Please try another category or use our`,` `,(0,u.jsx)(r,{to:`/request-an-item`,className:`text-maroon underline`,children:`request-an-item feature`}),`.`]}):(0,u.jsx)(`div`,{className:`grid gap-6 sm:grid-cols-2 xl:grid-cols-3`,children:y.map(e=>(0,u.jsx)(f,{product:e},e.slug))})})]})]})}export{f as n,p as t};