import{c as u,j as e,r as L}from"./index-D5aSL5Lk.js";import{B as p,I as t}from"./Footer-B625QnUy.js";import{C as m}from"./checkbox-CzTzIcmO.js";import{f as E,g as R,i as q,j as F,k as I}from"./Header-CQ-hRMFy.js";/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const O=u("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const M=u("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]),A=({minPrice:n,maxPrice:c,setMinPrice:i,setMaxPrice:r,categorySearch:o,setCategorySearch:l,filteredCategories:a,selectedCategories:x,toggleCategory:d,brandSearch:j,setBrandSearch:v,filteredBrands:y,selectedBrands:f,toggleBrand:k,vendorSearch:N,setVendorSearch:b,filteredVendors:g,selectedVendors:C,toggleVendor:$,clearAllFilters:w,activeFiltersCount:h=0})=>{const S=a&&x&&d&&l;return e.jsxs(E,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(p,{variant:"outline",className:"lg:hidden gap-2",children:[e.jsx(M,{className:"h-4 w-4"}),"Filtre",h>0&&e.jsx("span",{className:"bg-primary text-primary-foreground text-xs rounded-full px-2 py-0.5",children:h})]})}),e.jsxs(q,{side:"left",className:"w-[300px] sm:w-[350px] overflow-y-auto",children:[e.jsx(F,{className:"mb-6",children:e.jsxs(I,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Filtre"}),e.jsx(p,{variant:"ghost",size:"sm",onClick:w,className:"text-xs",children:"Șterge toate"})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold mb-4",children:"PREȚ (RON):"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(t,{placeholder:"Minimum",type:"number",value:n,onChange:s=>i(s.target.value)}),e.jsx(t,{placeholder:"Max",type:"number",value:c,onChange:s=>r(s.target.value)})]})]}),S&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold mb-4",children:"CATEGORII:"}),e.jsx(t,{placeholder:"caută după categorie",className:"mb-3",value:o,onChange:s=>l(s.target.value)}),e.jsx("div",{className:"space-y-3 max-h-48 overflow-y-auto",children:a.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{id:`mobile-cat-${s}`,checked:x.includes(s),onCheckedChange:()=>d(s)}),e.jsx("label",{htmlFor:`mobile-cat-${s}`,className:"text-sm cursor-pointer",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold mb-4",children:"BRAND:"}),e.jsx(t,{placeholder:"caută după nume brand",className:"mb-3",value:j,onChange:s=>v(s.target.value)}),e.jsx("div",{className:"space-y-3 max-h-48 overflow-y-auto",children:y.slice(0,50).map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{id:`mobile-brand-${s}`,checked:f.includes(s),onCheckedChange:()=>k(s)}),e.jsx("label",{htmlFor:`mobile-brand-${s}`,className:"text-sm cursor-pointer",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold mb-4",children:"VÂNZĂTOR:"}),e.jsx(t,{placeholder:"caută după vânzător",className:"mb-3",value:N,onChange:s=>b(s.target.value)}),e.jsx("div",{className:"space-y-3 max-h-48 overflow-y-auto",children:g.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{id:`mobile-vendor-${s}`,checked:C.includes(s),onCheckedChange:()=>$(s)}),e.jsx("label",{htmlFor:`mobile-vendor-${s}`,className:"text-sm cursor-pointer",children:s})]},s))})]})]})]})]})},D=({currentPage:n,totalPages:c,baseUrl:i})=>{L.useEffect(()=>{const r=document.querySelector('link[rel="prev"]'),o=document.querySelector('link[rel="next"]');if(r&&r.remove(),o&&o.remove(),n>1){const l=document.createElement("link");l.rel="prev";const a=n===2?i:`${i}${i.includes("?")?"&":"?"}page=${n-1}`;l.href=a,document.head.appendChild(l)}if(n<c){const l=document.createElement("link");l.rel="next",l.href=`${i}${i.includes("?")?"&":"?"}page=${n+1}`,document.head.appendChild(l)}return()=>{const l=document.querySelector('link[rel="prev"]'),a=document.querySelector('link[rel="next"]');l&&l.remove(),a&&a.remove()}},[n,c,i])};export{O as C,A as M,D as u};