import{_ as w,r as _,b as p,c as s,o,F as C,g as M,f as u,w as f,k as i,a as x,d as B,t as L,e as I,n as R,T,M as N}from"./app-q0jdcHwC.js";import{u as V}from"./useMousePosition-BCaqObBa.js";/* empty css                                                                     */import{r as $}from"./ChevronRightIcon-BtvBgAWv.js";const z={class:"bg-white border rounded shadow-md w-64"},D=["onMouseenter"],F=["src"],j={class:"text-zinc-800 text-sm font-normal font-['Lato'] leading-snug"},q={__name:"CategoryMenu",props:{items:{type:Array,required:!0},showImage:{type:Boolean,default:!1}},emits:["close"],setup(d,{emit:h}){const v=h,{mouseY:m}=V(60),a=_(null),l=_({}),b=async(n,g)=>{a.value=n,await N();const r=g.currentTarget.getBoundingClientRect(),c=window.innerWidth-r.right,e=r.left;c<250&&e>250?l.value[n]=`right-full ${m.value>650?"bottom-0":"top-0"}`:l.value[n]=`left-full ${m.value>650?"bottom-0":"top-0"}`},y=()=>{a.value=null},k=()=>{v("close"),a.value=null};return(n,g)=>{const r=p("RouterLink"),c=p("CategoryMenu",!0);return o(),s("ul",z,[(o(!0),s(C,null,M(d.items,e=>(o(),s("li",{key:e.id,class:"relative group",onMouseenter:t=>b(e.id,t),onMouseleave:y},[u(r,{to:`/categories/${e.id}`,onClick:k,class:"flex items-center gap-2 p-3 hover:bg-gray-100 cursor-pointer"},{default:f(()=>{var t;return[d.showImage?(o(),s("img",{key:0,src:e.thumbnail,alt:"thumb",class:"w-10 h-8 rounded border border-neutral-100 object-cover rounded"},null,8,F)):i("",!0),x("p",j,L(e.name),1),(t=e.sub_categories)!=null&&t.length?(o(),B(I($),{key:1,class:"w-4 h-4 text-slate-400 ml-auto"})):i("",!0)]}),_:2},1032,["to"]),u(T,{name:"slide-fade"},{default:f(()=>{var t;return[(t=e.sub_categories)!=null&&t.length&&a.value===e.id?(o(),s("div",{key:0,class:R(["absolute",l.value[e.id]])},[u(c,{items:e.sub_categories},null,8,["items"])],2)):i("",!0)]}),_:2},1024)],40,D))),128))])}}},S=w(q,[["__scopeId","data-v-d1b9bb50"]]);export{S as C};
