"use client"
import{a as b}from"./chunk-2GR7LSEE.mjs";import{g,j as u}from"./chunk-HIGE3J6C.mjs";import{AnimatePresence as k,motion as x}from"framer-motion";import{X as A}from"lucide-react";import{isValidElement as C}from"react";import{Fragment as L,jsx as t,jsxs as s}from"react/jsx-runtime";function S({filters:l,activeFilters:a,onRemove:h,onRemoveAll:N,className:v}){return t(b,{height:!0,className:"w-full",transition:{type:"tween",duration:.3},children:s("div",{className:u("flex w-full flex-wrap items-start gap-4 sm:flex-nowrap",v),children:[t("div",{className:"flex grow flex-wrap gap-x-4 gap-y-2",children:t(k,{children:a==null?void 0:a.map(({key:r,value:i})=>{if(r==="loader")return t(x.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},className:"h-9 w-48 animate-pulse rounded-md border border-gray-200 bg-white"},`loader-${i}`);let e=l.find(n=>n.key===r);if(!!e)return(e.multiple&&Array.isArray(i)?i:[i]).map(n=>{var d,c,y;let o=(d=e.options)==null?void 0:d.find(p=>typeof p.value=="string"&&typeof n=="string"?p.value.toLowerCase()===n.toLowerCase():p.value===n),m=(o==null?void 0:o.icon)??((c=e.getOptionIcon)==null?void 0:c.call(e,n,{key:e.key,option:o}))??e.icon,w=(o==null?void 0:o.label)??((y=e.getOptionLabel)==null?void 0:y.call(e,n,{key:e.key,option:o}))??n;return s(x.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},className:"flex items-center divide-x rounded-md border border-gray-200 bg-white text-sm text-black",children:[s("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[t("span",{className:"shrink-0 text-gray-600",children:f(e.icon)?e.icon:t(e.icon,{className:"h-4 w-4"})}),e.label]}),t("div",{className:"px-3 py-2 text-gray-500",children:"is"}),t("div",{className:"flex items-center gap-2.5 px-3 py-2",children:e.options?s(L,{children:[t("span",{className:"shrink-0 text-gray-600",children:f(m)?m:t(m,{className:"h-4 w-4"})}),g(w,30)]}):t("div",{className:"h-5 w-12 animate-pulse rounded-md bg-gray-200"})}),t("button",{type:"button",className:"h-full rounded-r-md p-2 text-gray-500 ring-inset ring-gray-500 hover:bg-gray-100 hover:text-gray-800 focus:outline-none focus-visible:ring-1",onClick:()=>h(r,n),children:t(A,{className:"h-3.5 w-3.5"})})]},r)})})})}),(a==null?void 0:a.length)!==0&&t("button",{type:"button",className:"mt-px whitespace-nowrap rounded-lg border border-transparent px-3 py-2 text-sm text-gray-500 ring-inset ring-gray-500 transition-colors hover:border-gray-200 hover:bg-white hover:text-black focus:outline-none",onClick:N,children:"Clear Filters"})]})})}var f=l=>C(l);export{S as a};
