"use client"
import{c as b}from"./chunk-F2HJFOHF.mjs";import{a as x}from"./chunk-H4UN7NPI.mjs";import{AnimatePresence as k,motion as f}from"framer-motion";import{X as C}from"lucide-react";import{isValidElement as L}from"react";import{Fragment as A,jsx as t,jsxs as i}from"react/jsx-runtime";function $({filters:l,activeFilters:a,onRemove:N,onRemoveAll:c,className:v}){return b("Escape",c,{priority:1}),t(x,{height:!0,className:"w-full",transition:{type:"tween",duration:.3},children:i("div",{className:(void 0)("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:n,value:s})=>{if(n==="loader")return t(f.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-${s}`);let e=l.find(r=>r.key===n);return e?(e.multiple&&Array.isArray(s)?s:[s]).map(r=>{var y,g,u;let o=(y=e.options)==null?void 0:y.find(d=>typeof d.value=="string"&&typeof r=="string"?d.value.toLowerCase()===r.toLowerCase():d.value===r),m=(o==null?void 0:o.icon)??((g=e.getOptionIcon)==null?void 0:g.call(e,r,{key:e.key,option:o}))??e.icon,w=(o==null?void 0:o.label)??((u=e.getOptionLabel)==null?void 0:u.call(e,r,{key:e.key,option:o}))??r;return i(f.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:[i("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[t("span",{className:"shrink-0 text-gray-600",children:h(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?i(A,{children:[t("span",{className:"shrink-0 text-gray-600",children:h(m)?m:t(m,{className:"h-4 w-4"})}),(void 0)(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:()=>N(n,r),children:t(C,{className:"h-3.5 w-3.5"})})]},`${n}-${r}`)}):(console.error("Filter.List received an activeFilter without a corresponding filter"),null)})})}),(a==null?void 0:a.length)!==0&&i("button",{type:"button",className:"group mt-px flex items-center gap-2 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:c,children:["Clear Filters",t("kbd",{className:"rounded-md border border-gray-200 px-1.5 py-0.5 text-xs text-gray-950 group-hover:bg-gray-50",children:"ESC"})]})]})})}var h=l=>L(l);export{$ as a};
