import{j as e,P as h,y as u,B as j,k as l,z as f,E as p,w as v}from"./index-C9vqJYWU.js";import{C as N,e as g,f as C,g as y,h as m,i as c,k as w}from"./command-CfddNxWu.js";import{S}from"./separator-XQIAzE1m.js";import{C as b}from"./data-table-omMLuxxA.js";function E({title:n,options:d,value:o,onChange:t,placeholder:x}){const a=new Set(o);return e.jsxs(h,{children:[e.jsx(u,{asChild:!0,children:e.jsxs(j,{variant:"outline",size:"sm",className:"h-9 border-dashed",children:[e.jsx(b,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(S,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(l,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden gap-1 lg:flex",children:a.size>2?e.jsxs(l,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):d.filter(s=>a.has(s.value)).map(s=>e.jsx(l,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:s.label},s.value))})]})]})}),e.jsx(f,{className:"w-[220px] p-0",align:"start",children:e.jsxs(N,{children:[e.jsx(g,{placeholder:x||n,className:"h-9"}),e.jsxs(C,{children:[e.jsx(y,{children:"No results found."}),e.jsx(m,{children:d.map(s=>{const i=a.has(s.value);return e.jsxs(c,{onSelect:()=>{const r=new Set(a);i?r.delete(s.value):r.add(s.value),t(Array.from(r))},children:[e.jsx("div",{className:v("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-neutral-900",i?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(p,{className:"h-4 w-4","aria-hidden":"true"})}),s.icon&&e.jsx(s.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:s.label})]},s.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(w,{}),e.jsx(m,{children:e.jsx(c,{onSelect:()=>t([]),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}export{E as M};
