"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5165],{75165:(e,r,t)=>{t.d(r,{A:()=>N});var a=t(95155),s=t(12115),l=t(52619),o=t.n(l),n=t(15239),d=t(20063),i=t(27937),c=t(34604),m=t(65229),u=t(26497),x=t(64555),g=t(47650),h=t(67546),f=t(15777),p=t(99274),b=t(25016),y=t(12976),v=t(84935),w=t(32985);function j({children:e}){return"undefined"==typeof document?null:(0,g.createPortal)(e,document.body)}function N({label:e,triggerClassName:r}={}){let{t}=(0,y.k)(),[l,g]=(0,s.useState)(!1),[k,C]=(0,s.useState)([]),[A,S]=(0,s.useState)(!1),[_,E]=(0,s.useState)(null),P=s.useRef(!1),H=(0,d.usePathname)(),M=H.split("/")[1]||"",O=/^[a-z]{2,3}$/.test(M)?M:"ka";(0,s.useEffect)(()=>{P.current||(async()=>{try{S(!0);let e=await (0,p.QU)();C(Array.isArray(e)?e:[]),P.current=!0}catch(e){console.error("Failed to load categories",e)}finally{S(!1)}})()},[]),(0,s.useEffect)(()=>{if(!l)return;let e=document.body.style.overflow,r=document.documentElement.style.overflow,t=document.body.style.position,a=document.body.style.width,s=window.scrollY;return document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.top=`-${s}px`,document.body.style.width="100%",()=>{document.documentElement.style.overflow=r,document.body.style.overflow=e,document.body.style.position=t,document.body.style.top="",document.body.style.width=a,window.scrollTo(0,s)}},[l]),(0,s.useEffect)(()=>{g(!1)},[H]);let{topLevel:U,childrenMap:z}=(0,s.useMemo)(()=>{let e="__root__",r={};return k.forEach(t=>{let a=t.parentId&&t.parentId.trim().length>0?t.parentId.trim():e;r[a]||(r[a]=[]),r[a].push(t)}),Object.keys(r).forEach(e=>r[e].sort((e,r)=>(e.name??"").localeCompare(r.name??""))),{topLevel:r[e]??[],childrenMap:r}},[k]),F=(0,s.useMemo)(()=>{let e=[];for(let r=0;re.id===_):null,$=_&&z[_]||[],L=e=>(0,w.nb)(`/category/${e.slug||e.id}`,O);return(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{"aria-expanded":l,"aria-label":l?t("category.drawer.ariaCloseMenu","Close categories menu"):t("category.drawer.ariaOpenMenu","Open categories menu"),className:(0,b.cn)("flex items-center gap-2 px-4 py-2 rounded-lg font-medium transition-all text-sm relative z-[10001]",r),onClick:()=>g(!l),children:[(0,a.jsx)(h.A,{className:"w-5 h-5 flex-shrink-0"}),e&&(0,a.jsx)("span",{className:"whitespace-nowrap",children:e})]}),(0,a.jsx)(u.N,{children:l&&(0,a.jsx)(j,{children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.P.div,{animate:{opacity:1},className:"fixed inset-0 bg-black/50 z-[10000] backdrop-blur-sm",exit:{opacity:0},initial:{opacity:0},onClick:()=>g(!1)}),(0,a.jsx)(x.P.div,{animate:{opacity:1,y:0},className:"fixed inset-0 z-[10000] flex items-start justify-center pt-28 md:pt-32 pb-4 px-2 md:px-6 pointer-events-none",exit:{opacity:0,y:12},initial:{opacity:0,y:12},transition:{duration:.25,ease:"easeOut"},children:(0,a.jsxs)("div",{className:"relative w-full max-w-6xl rounded-3xl bg-white dark:bg-brand-surfacedark shadow-[0_24px_80px_rgba(0,0,0,0.4)] border