import{d as e,f as t,h as n,s as r,t as i,u as a}from"./src-C0xjWfnx.js";import{t as o}from"./useNavigate-VRicZWJI.js";import{t as s}from"./arrow-left-9Wn53Zfu.js";import{c}from"./index-BXnbw4dQ.js";import{i as l}from"./prominent-api-hooks-DipwWw0H.js";var u=n(t()),d=e();function f(){let{storeId:e}=c.useParams(),t=o(),{data:n}=l(Number(e)),[f,p]=(0,u.useState)(null),m=n?.store,h=n?.products||[],g=(0,u.useMemo)(()=>{let e=new Set;return h.forEach(t=>{let n=t.category||`All`;e.add(n)}),[`All`,...Array.from(e)]},[h]),_=(0,u.useMemo)(()=>!f||f===`All`?h:h.filter(e=>(e.category||`All`)===f),[h,f]);return(0,d.jsxs)(i,{children:[(0,d.jsxs)(`div`,{className:`mb-4 flex items-center gap-3`,children:[(0,d.jsx)(r,{onClick:()=>t({to:`/stores`}),children:(0,d.jsx)(s,{className:`h-5 w-5`})}),(0,d.jsx)(a,{weight:`bold`,className:`text-xl`,children:m?.name||`Store`})]}),(0,d.jsx)(`div`,{className:`mb-4 flex gap-2 overflow-x-auto pb-2`,children:g.map(e=>(0,d.jsx)(`button`,{onClick:()=>p(e===`All`?null:e),className:`whitespace-nowrap rounded-full px-4 py-1.5 text-sm ${e===`All`&&!f||f===e?`bg-brand-500 text-white`:`bg-gray-100 text-gray-600`}`,children:e},e))}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:_.map(n=>(0,d.jsxs)(r,{onClick:()=>t({to:`/stores/$storeId/product/$productId`,params:{storeId:e,productId:String(n.id)}}),className:`rounded-xl border border-gray-100 bg-white p-3 shadow-sm`,children:[(0,d.jsx)(`div`,{className:`mb-2 aspect-square w-full overflow-hidden rounded-lg bg-gray-100`,children:n.images?.[0]&&(0,d.jsx)(`img`,{src:n.images[0].uri,alt:n.name,className:`h-full w-full object-cover`})}),(0,d.jsx)(a,{weight:`semibold`,className:`text-sm`,numberOfLines:2,children:n.name}),(0,d.jsxs)(a,{weight:`bold`,className:`mt-1 text-brand-600`,children:[`₹`,n.discountedPrice??n.price]})]},n.id))})]})}export{f as component};