"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,triggerIcon:t}={}){let{t:l}=(0,y.k)(),[g,k]=(0,s.useState)(!1),[C,A]=(0,s.useState)([]),[S,_]=(0,s.useState)(!1),[E,P]=(0,s.useState)(null),H=s.useRef(!1),M=(0,d.usePathname)(),O=M.split("/")[1]||"",U=/^[a-z]{2,3}$/.test(O)?O:"ka";(0,s.useEffect)(()=>{H.current||(async()=>{try{_(!0);let e=await (0,p.QU)();A(Array.isArray(e)?e:[]),H.current=!0}catch(e){console.error("Failed to load categories",e)}finally{_(!1)}})()},[]),(0,s.useEffect)(()=>{if(!g)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)}},[g]),(0,s.useEffect)(()=>{k(!1)},[M]);let{topLevel:z,childrenMap:F}=(0,s.useMemo)(()=>{let e="__root__",r={};return C.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}},[C]),I=(0,s.useMemo)(()=>{let e=[];for(let r=0;re.id===E):null,L=E&&F[E]||[],V=e=>(0,w.nb)(`/category/${e.slug||e.id}`,U);return(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{"aria-expanded":g,"aria-label":g?l("category.drawer.ariaCloseMenu","Close categories menu"):l("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:()=>k(!g),children:[t??(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:g&&(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:()=>k(!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