import{d as O,G as k,e as o,u as e,D as L,H as c,J as s,h as j,az as A,L as N,M as D,a2 as _,b as p,K as F,bt as E,a4 as v,c as h,F as g,f as d,Q as b,al as z,O as S,r as I}from"./lucide-UY9XeFdQ.js";import{_ as C}from"./index-BVxt5AP1.js";import{_ as M}from"./index-CicoQvUc.js";import{c as R,_ as q}from"./index-CKxLfxpS.js";import{u as G,C as H,z as J}from"./reka-ui-D1_Wa3oe.js";import{l as K}from"./vueuse-Dj-fx4H6.js";import{_ as Q}from"./Input.vue_vue_type_script_setup_true_lang-CaZdJcvH.js";import{a as T,b as U,_ as X}from"./PopoverTrigger.vue_vue_type_script_setup_true_lang-gG_n3nKe.js";import{_ as W}from"./Separator.vue_vue_type_script_setup_true_lang-CCEYV8eE.js";const Y=O({__name:"Checkbox",props:{defaultValue:{},modelValue:{},disabled:{type:Boolean},value:{},id:{},trueValue:{},falseValue:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:["update:modelValue"],setup(u,{emit:y}){const n=u,m=y,f=K(n,"class"),r=G(f,m);return(i,V)=>(o(),k(e(H),L({"data-slot":"checkbox"},e(r),{class:e(R)("peer border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",n.class)}),{default:c(x=>[s(e(J),{"data-slot":"checkbox-indicator",class:"grid place-content-center text-current transition-none"},{default:c(()=>[j(i.$slots,"default",N(D(x)),()=>[s(e(A),{class:"size-3.5"})])]),_:2},1024)]),_:3},16,["class"]))}}),Z={class:"hidden space-x-1 lg:flex"},ee=["onClick"],ae={class:"faceted-filter-content"},te={class:"faceted-filter-list"},se=["onClick"],le=O({__name:"FacetedFilter",props:{title:{},options:{},modelValue:{},class:{type:[Boolean,null,String,Object,Array]}},emits:["update:modelValue"],setup(u,{emit:y}){const n=u,m=y,f=I(""),r=h(()=>new Set(n.modelValue||[])),i=h(()=>r.value.size),V=h(()=>n.options.filter(l=>r.value.has(l.value))),x=h(()=>{const l=f.value.toLowerCase().trim();return l?n.options.filter(t=>t.label.toLowerCase().includes(l)):n.options}),w=l=>{const t=new Set(r.value);t.has(l)?t.delete(l):t.add(l),m("update:modelValue",Array.from(t))},P=l=>{const t=new Set(r.value);t.delete(l),m("update:modelValue",Array.from(t))},$=()=>{m("update:modelValue",[])};return(l,t)=>(o(),k(e(X),null,{default:c(()=>[s(e(T),{"as-child":""},{default:c(()=>[s(e(M),{variant:"outline",class:"border-dashed"},{default:c(()=>[s(e(E),{class:"h-4 w-4"}),_(" "+v(u.title)+" ",1),i.value>0?(o(),p(g,{key:0},[s(e(W),{orientation:"vertical",class:"mx-2 h-4"}),s(e(C),{class:"lg:hidden font-medium rounded-[6px]"},{default:c(()=>[_(v(i.value),1)]),_:1}),d("div",Z,[i.value>2?(o(),k(e(C),{key:0,class:"rounded-[6px] gap-2"},{default:c(()=>[_(v(i.value)+" selected ",1),d("button",{type:"button",class:"flex items-center justify-center cursor-pointer hover:opacity-70",onClick:b($,["stop"])},[s(e(z),{class:"size-2.5"})])]),_:1})):(o(!0),p(g,{key:1},S(V.value,a=>(o(),k(e(C),{key:a.value,class:"font-medium rounded-[6px] gap-2"},{default:c(()=>[_(v(a.label)+" ",1),d("button",{type:"button",class:"flex items-center justify-center cursor-pointer hover:opacity-70",onClick:b(B=>P(a.value),["stop"])},[s(e(z),{class:"size-2.5"})],8,ee)]),_:2},1024))),128))])],64)):F("",!0)]),_:1})]),_:1}),s(e(U),{class:"w-[220px] p-0",align:"start"},{default:c(()=>[d("div",ae,[s(e(Q),{modelValue:f.value,"onUpdate:modelValue":t[0]||(t[0]=a=>f.value=a),placeholder:u.title,class:"mb-2 h-8"},null,8,["modelValue","placeholder"]),d("div",te,[(o(!0),p(g,null,S(x.value,a=>(o(),p("label",{key:`${a.value}-${r.value.has(a.value)}`,class:"faceted-filter-item"},[s(e(Y),{checked:r.value.has(a.value),"default-value":r.value.has(a.value),class:"mr-2",onClick:b(B=>w(a.value),["stop"])},null,8,["checked","default-value","onClick"]),d("span",{class:"truncate cursor-pointer",onClick:b(B=>w(a.value),["stop"])},v(a.label),9,se)]))),128))]),i.value>0?(o(),p("button",{key:0,type:"button",class:"faceted-filter-clear",onClick:$}," Clear filters ")):F("",!0)])]),_:1})]),_:1}))}}),pe=q(le,[["__scopeId","data-v-4ebcab1d"]]);export{pe as F};
