1import{u as P,r as _,aB as R,j as U,a6 as H,a7 as J,c as o,o as l,q as d,d as f,F as h,G as b,e as u,A as y,g as p,f as K,ad as k,B as Q,E as B,aa as O,aA as $,a2 as W}from"./FTaPbxLM.js";import X from"./DrazZ_kY.js";const Y={class:"my-20 hidden flex-col gap-5 lg:flex"},Z={class:"flex gap-5"},I={key:0,class:"absolute z-50 mt-1 w-full overflow-hidden rounded-xl border border-base-500 bg-base-300 shadow-lg"},ee=["onClick"],te={key:0,class:"ml-auto flex size-8 items-center justify-center rounded-full bg-primary-100"},se={key:0,class:"flex flex-wrap items-center gap-2"},ae=["onClick"],ie={class:"text-sm"},ne={class:"lg:hidden"},le={class:"fixed bottom-0 left-0 right-0 z-[60]"},oe={class:"text-xl font-medium text-white"},ce={key:0,class:"overflow-auto p-4"},re=["onClick"],ue={class:"text-1xl text-white"},de={key:0},me=["onClick"],ve={class:"text-lg text-white"},pe={key:0,class:"flex size-8 items-center justify-center rounded-full bg-primary-100"},_e={__name:"Filter",props:{tagFilters:{type:Array,default:()=>[]},initialFilters:{type:Object,default:()=>({})}},emits:["filter-change"],setup(z,{emit:A}){const w=z,{t:D}=P(),S=A,E=_([]),m=_([]),n=_({}),F=_({}),x=_(!1),g=_([]),j=()=>{const e={};Object.keys(n.value).forEach(i=>{var c;const t=(c=w.tagFilters[i])==null?void 0:c.name;t&&(e[t]=n.value[i].map(r=>{const a=w.tagFilters[i].children.find(s=>s.id===r);return a?{id:a.id,name:a.name}:null}).filter(Boolean))}),F.value=e};R(()=>[w.tagFilters,w.initialFilters],([e,i])=>{m.value=new Array(e.length).fill(!1),g.value=new Array(e.length).fill(!1);const t={};e.forEach((c,r)=>{t[r]=[],(i[c.name]||[]).forEach(s=>{var v;(v=c.children)!=null&&v.some(C=>C.id===s.id)&&t[r].push(s.id)})}),n.value=t,j()},{immediate:!0});const T=()=>{j(),S("filter-change",F.value)},M=e=>{m.value=m.value.map((i,t)=>t===e?!i:!1)},L=(e,i)=>{n.value[e]||(n.value[e]=[]);const t=n.value[e].indexOf(i);n.value[e]=t===-1?[...n.value[e],i]:n.value[e].filter(c=>c!==i),m.value[e]=!1,T()},N=(e,i)=>{const t=w.tagFilters.findIndex(c=>c.name===e);t!==-1&&(n.value[t]=n.value[t].filter(c=>c!==i),j(),T())},V=U(()=>Object.values(F.value).some(e=>e.length>0)),q=e=>{g.value[e]=!g.value[e]},G=(e,i)=>{event.stopPropagation(),n.value[e]||(n.value[e]=[]);const t=n.value[e].indexOf(i);n.value[e]=t===-1?[...n.value[e],i]:n.value[e].filter(c=>c!==i),W(()=>{g.value[e]=!0}),T()};return H(()=>{const e=i=>{var t;(t=E.value)==null||t.forEach((c,r)=>{c&&!c.contains(i.target)&&(m.value[r]=!1)})};document.addEventListener("click",e),J(()=>{document.removeEventListener("click",e)})}),(e,i)=>{const t=Q,c=X;return l(),o(h,null,[d("div",Y,[d("div",Z,[(l(!0),o(h,null,b(z.tagFilters,(r,a)=>(l(),o("div",{key:r.id,ref_for:!0,ref:s=>{s&&(u(E)[a]=s)},class:"relative w-80"},[p(c,{size:"btn-sm",variant:"",class:y(["flex w-full items-center justify-between gap-2 rounded-xl border border-base-500 px-7 py-4 font-normal text-base-500",{"bg-base-300":u(m)[a]}]),onClick:s=>M(a)},{default:B(()=>[d("span",{class:y(["text-sm lg:text-base",{"text-white":u(m)[a]}])},k(r.name),3),p(t,{name:"lucide:chevron-down",class:y(["text-gray-950 size-6 transition-transform",{"rotate-180 text-white":u(m)[a]}])},null,8,["class"])]),_:2},1032,["class","onClick"]),u(m)[a]?(l(),o("ul",I,[(l(!0),o(h,null,b(r.children,s=>{var v,C;return l(),o("li",{key:s.id,class:"group flex cursor-pointer items-center gap-3 px-7 py-4 hover:font-semibold",onClick:he=>L(a,s.id)},[d("span",{class:y(["text-sm text-white lg:text-base",{"font-semibold":(v=u(n)[a])==null?void 0:v.includes(s.id)}])},k(s.name),3),(C=u(n)[a])!=null&&C.includes(s.id)?(l(),o("div",te,[p(t,{name:"lucide:check",class:"size-5 text-base-300"})])):f("",!0)],8,ee)}),128))])):f("",!0)]))),128))]),u(V)?(l(),o("div",se,[(l(!0),o(h,null,b(u(F),(r,a)=>(l(),o(h,{key:a},[(l(!0),o(h,null,b(r,s=>(l(),o("div",{key:s.id,class:"flex cursor-pointer items-center gap-2 rounded-full bg-primary-200 px-4 py-2",onClick:v=>N(a,s.id)},[d("span",ie,k(s.name),1),p(t,{name:"lucide:x",class:"ml-auto text-lg"})],8,ae))),128))],64))),128))])):f("",!0)]),d("div",ne,[d("div",le,[d("div",{class:y(["rounded-t-2xl bg-base-300 shadow-lg",{"max-h-[80vh] overflow-auto [&::-webkit-scrollbar]:hidden":u(x)}])},[d("div",{class:"relative flex cursor-pointer items-center justify-center gap-3 px-4 py-5",onClick:i[0]||(i[0]=r=>x.value=!u(x))},[d("span",oe,k(u(D)("filters")),1),p(t,{name:"lucide:menu",class:"size-6 text-white"}),u(x)?(l(),K(t,{key:0,name:"lucide:x",class:"absolute right-4 size-6 text-white"})):f("",!0)]),p(O,{"enter-active-class":"transition-opacity duration-200 ease-in","leave-active-class":"transition-opacity duration-200 ease-in","enter-from-class":"opacity-0","leave-to-class":"opacity-0"},{default:B(()=>[u(x)?(l(),o("div",ce,[(l(!0),o(h,null,b(z.tagFilters,(r,a)=>(l(),o("div",{key:r.id,class:"mb-6 border-b-2 border-base-500"},[d("div",{class:"flex items-center justify-between py-4",onClick:$(s=>q(a),["stop"])},[d("span",ue,k(r.name),1),p(t,{name:"lucide:chevron-down",class:y(["size-6 text-white transition-transform",{"rotate-180":u(g)[a]}])},null,8,["class"])],8,re),p(O,{"enter-active-class":"transition-opacity duration-200 ease-in","leave-active-class":"transition-opacity duration-200 ease-in","enter-from-class":"opacity-0","leave-to-class":"opacity-0"},{default:B(()=>[u(g)[a]?(l(),o("div",de,[(l(!0),o(h,null,b(r.children,s=>{var v;return l(),o("div",{key:s.id,class:"flex items-center justify-between border-b-2 border-base-500 py-3 last:border-b-0",onClick:$(C=>G(a,s.id),["stop"])}
1,[d("span",ve,k(s.name),1),(v=u(n)[a])!=null&&v.includes(s.id)?(l(),o("div",pe,[p(t,{name:"lucide:check",class:"size-5 text-base-300"})])):f("",!0)],8,me)}),128))])):f("",!0)]),_:2},1024)]))),128))])):f("",!0)]),_:1})],2)])])],64)}}};export{_e as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.