1import{a as l,j as e}from"./chunk-three-BTWAGdoL.js";import{I as w,B as n}from"./index-CmZofxmK.js";import{P as N}from"./ProductCard-Bo10oihL.js";import{D as b,M as y}from"./MarketplaceFilters-CPclmYBv.js";import{b as P,a as F,c as M,d as S}from"./use-marketplace-DMn0emfh.js";import{o as C,p as k,aI as I,aw as E,Z as L,C as T}from"./chunk-icons-CmzO8GHu.js";import"./chunk-router-DABpbG10.js";import"./chunk-uppy-Ddo71Xia.js";import"./chunk-charts-D8AvoNRl.js";import"./chunk-utils-CL3reoUV.js";import"./chunk-maps-ByCLyVpA.js";import"./chunk-query-NCR7N3-H.js";import"./chunk-radix-CYYWsbOs.js";import"./wholesale-hub-validators-CPfPzyIA.js";function K(){const[o,x]=l.useState(b),[c,h]=l.useState(""),[a,r]=l.useState(1),d=24,p=l.useMemo(()=>P({filters:o,mobileSearch:c,page:a,limit:d}),[o,c,a]),{data:s,isLoading:u,error:m}=F(p),{data:j=[]}=M(),{favProductIds:g,toggleFavorite:f}=S(),i=s?Math.ceil(s.total/d):0;return e.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8 space-y-6","data-testid":"vip-shop",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-white",children:"VIP Shop"}),e.jsx("p",{className:"text-white/50 text-sm mt-1",children:"Exclusive products for VIP members"})]}),e.jsxs("div",{className:"lg:hidden relative",children:[e.jsx(C,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-white/40"}),e.jsx(w,{placeholder:"Search products...",value:c,onChange:t=>{h(t.target.value),r(1)},className:"pl-9 bg-black/60 border-white/10 text-white"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[260px_1fr] gap-6",children:[e.jsx("div",{children:e.jsx(y,{filters:o,onFiltersChange:t=>{x(t),r(1)},wholesalers:j})}),e.jsx("div",{children:u?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(k,{className:"w-8 h-8 animate-spin text-[#D4AF37]"})}):m?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx(I,{className:"w-12 h-12 text-red-400/40 mb-4"}),e.jsx("h3",{className:"text-white/30 font-semibold",children:"Failed to load products"}),e.jsx("p",{className:"text-white/20 text-sm mt-1",children:m instanceof Error?m.message:"Please try again"})]}):s?.products?.length?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-white/40 text-sm mb-4",children:[s.total," product",s.total!==1?"s":""," found"]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:s.products.map(t=>e.jsx(N,{product:t,isFavorited:g.has(t.id),onToggleFavorite:v=>f.mutate({entityType:"product",entityId:v}),linkPrefix:"/vip/shop",showVipPrice:!0},t.id))}),i>1&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mt-8",children:[e.jsx(n,{variant:"outline",size:"sm",className:"border-white/20 text-white/60",onClick:()=>r(t=>Math.max(1,t-1)),disabled:a<=1,children:e.jsx(L,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-sm text-white/50",children:["Page ",a," of ",i]}),e.jsx(n,{variant:"outline",size:"sm",className:"border-white/20 text-white/60",onClick:()=>r(t=>Math.min(i,t+1)),disabled:a>=i,children:e.jsx(T,{className:"w-4 h-4"})})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx(E,{className:"w-12 h-12 text-white/10 mb-4"}),e.jsx("h3",{className:"text-white/30 font-semibold",children:"No products found"}),e.jsx("p",{className:"text-white/20 text-sm mt-1",children:"Try adjusting your filters or search terms"})]})})]})]})}export{K 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.