"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9318],{2130:(e,r,t)=>{t.d(r,{Qp:()=>s,UN:()=>n});let a=["categories","search","cart","auth","language"];function s(e){let r=e?.customButtons??[];if(e?.headerLayout&&e.headerLayout.length>0){let t=new Set(r.map(e=>e.id)),a=e.headerLayout.filter(e=>"customButton"!==e.kind||!!e.customButtonId&&t.has(e.customButtonId)),s=new Set(a.filter(e=>"customButton"===e.kind).map(e=>e.customButtonId).filter(e=>!!e));return[...a,...r.filter(e=>!s.has(e.id)).map(e=>({id:`cb-${e.id}`,kind:"customButton",customButtonId:e.id}))]}let t=(e?.widgetOrder??a).filter((e,r,t)=>a.includes(e)&&t.indexOf(e)===r);return[{id:"logo",kind:"logo"},{id:"spacer-pre-search",kind:"spacer"},{id:"search",kind:"search"},{id:"spacer-post-search",kind:"spacer"},...[...t,...a.filter(e=>!t.includes(e))].filter(e=>"search"!==e).map(e=>({id:e,kind:e})),...r.map(e=>({id:`cb-${e.id}`,kind:"customButton",customButtonId:e.id}))]}function n(e,r){let t=function(e){switch(e){case"categories":return"showCategoriesLink";case"search":return"showSearch";case"cart":return"showCart";case"auth":return"showAuth";case"language":return"showLanguage";default:return null}}(e.kind);return!t||(r?.[t]??!0)}},15777:(e,r,t)=>{t.d(r,{U:()=>a});function a(e){if(e&&0!==e.length)return e[0]}},19630:(e,r,t)=>{t.d(r,{k:()=>s});var a=t(12115);function s(e){let{max:r=12,namespace:t="default",caseInsensitive:s=!0}=e||{},n=(0,a.useMemo)(()=>`search-history:${t}`,[t]),[l,i]=(0,a.useState)([]);(0,a.useEffect)(()=>{try{let e=localStorage.getItem(n);e&&i(JSON.parse(e))}catch{}},[n]);let o=(0,a.useCallback)(e=>{i(e);try{localStorage.setItem(n,JSON.stringify(e))}catch{}},[n]),c=(0,a.useCallback)(e=>{let t=e.trim();if(!t)return;let a=e=>s?e.toLowerCase():e,n=Date.now(),i=l.findIndex(e=>a(e.term)===a(t)),c=[...l];if(i>=0){let e=c[i];c.splice(i,1),c.unshift({term:e.term,ts:n,count:e.count+1})}else c.unshift({term:t,ts:n,count:1});c.length>r&&(c=c.slice(0,r)),o(c)},[l,r,s,o]),d=(0,a.useCallback)(e=>{let r=e.trim(),t=e=>s?e.toLowerCase():e;o(l.filter(e=>t(e.term)!==t(r)))},[l,s,o]);return{items:l,add:c,remove:d,clear:(0,a.useCallback)(()=>o([]),[o])}}},27397:(e,r,t)=>{t.d(r,{A:()=>N});var a=t(95155),s=t(12115),n=t(20063),l=t(56401),i=t(36982),o=t(51336),c=t(26497),d=t(64555),m=t(15239),u=t(95740),x=t(17268),h=t(36300),p=t(88873),f=t(19630),g=t(39607),b=t(12976),y=t(32985),v=t(38199),j=t(67093),w=t(22660);let N=({searchQuery:e,setSearchQuery:r,isModalOpen:t,setSearchModalOpen:N,containerClassName:k,leadingIcon:C})=>{let{t:S}=(0,b.k)(),{config:I}=(0,w.Ku)(),A=function(){let[e,r]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=window.matchMedia("(max-width: 767px)"),t=()=>r(e.matches);return r(e.matches),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),e}(),[T,E]=(0,s.useState)(t),[_,P]=(0,s.useState)(!1),[B,$]=(0,s.useState)(null),[F,z]=(0,s.useState)([]),[O,R]=(0,s.useState)([]),L=(0,s.useRef)(null),{trackSearchQuery:M}=(0,g.y)(),U=(0,n.useSearchParams)(),W=(0,n.useRouter)(),D=(0,n.usePathname)(),q=D?.split("/")[1]||"",Q=/^[a-z]{2,3}$/.test(q)?q:"ka",{items:J,add:K,remove:H,clear:V}=(0,f.k)({namespace:"global",max:15});(0,s.useEffect)(()=>{E(t)},[t]),(0,s.useEffect)(()=>(window.dispatchEvent(new CustomEvent("komero:search-state",{detail:{open:T}})),()=>{window.dispatchEvent(new CustomEvent("komero:search-state",{detail:{open:!1}}))}),[T]),(0,s.useEffect)(()=>{let e=U.get("q")||"";e&&(r(e),Y(e))},[U]);let Z=A?6:8,Y=async e=>{let r=e?.trim()??"";if(!r||r.length<2){z([]),R([]),P(!1),$(null);return}try{P(!0),$(null),M(r),(0,v.Jz)("Search",{search_string:r,content_type:"product"});let[e,t]=await Promise.all([(0,p.zh)(r,"name","asc",1,Z),I?.ui?.enableSemanticSearch===!0?(0,j.Ec)({query:r,topK:4}).catch(()=>[]):Promise.resolve([])]),a=e.items??[];z(a.map(e=>({id:e.id,name:e.name??"Unnamed product",slug:e.slug,images:e.images,price:e.price}))),R(t.filter(e=>e.score>.7))}catch(e){$(e?.message??"Search failed"),z([]),R([])}finally{P(!1)}},G=(0,s.useMemo)(()=>(e?.trim().length??0)>=2,[e]);return(0,a.jsxs)("div",{className:"relative w-full",children:[(0,a.jsxs)("div",{className:k??"flex items-center gap-1 bg-muted/50 rounded-full shadow-md border cursor-pointer w-full mx-auto p-0 px-4 transition focus-within:border-brand-primary focus-within:ring focus-within:ring-brand-primary/30",children:[C??(0,a.jsx)(x.WI,{className:"text-gray-500"}),(0,a.jsx)(l.p,{"aria-expanded":T,"aria-label":S("components.searchDropdown.searchProducts","Search products"),autoComplete:"off",className:"w-full pl-2 py-3 bg-transparent rounded-full text-foreground placeholder-muted-foreground transition-all outline-none focus:outline-none ring-0 focus:ring-0 focus:border-transparent",id:"search-input",placeholder:S("search.placeholder","Search products..."),role:"combobox",type:"search",value:e,onBlur:()=>{setTimeout(()=>{E(!1),N(!1)},200)},onChange:e=>{let t=e.target.value;r(t),L.current&&window.clearTimeout(L.current),P(!0),z([]),R([]),L.current=window.setTimeout(()=>Y(t),300)},onFocus:()=>{E(!0),N(!0)},onKeyDown:r=>{"Enter"===r.key&&(r.preventDefault(),e.trim().length>0&&(K(e),W.push((0,y.nb)(`/category?q=${encodeURIComponent(e)}`,Q))))}})]}),(0,a.jsx)(c.N,{children:T&&(0,a.jsx)(d.P.div,{animate:{opacity:1,y:0},className:"absolute left-0 right-0 mt-5 z-50",exit:{opacity:0,y:-10},initial:{opacity:0,y:-10},transition:{duration:.2},id:"search-results",onMouseDown:e=>e.preventDefault(),children:(0,a.jsx)(i.Z,{children:(0,a.jsxs)(o.U,{className:"p-5",children:[!G&&J.length>0&&(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"font-primary text-sm text-gray-500",children:S("search.recentSearches","Recent Searches")}),(0,a.jsx)("button",{className:"font-primary text-xs text-gray-500 underline hover:text-gray-700",onClick:V,children:S("search.clearAll","Clear all")})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:J.map(({term:e})=>(0,a.jsxs)("div",{className:"group flex items-center gap-2 px-3 py-1 rounded-full border text-sm hover:bg-brand-primary/5",children:[(0,a.jsx)("button",{className:"font-primary hover:underline",onClick:()=>(e=>{r(e),K(e),W.push((0,y.nb)(`/category?q=${encodeURIComponent(e)}`,Q)),setTimeout(()=>{E(!1),N(!1)},50)})(e),children:e}),(0,a.jsx)("button",{"aria-label":S("search.removeTerm","Remove {term}",{term:e}),className:"opacity-60 group-hover:opacity-100",title:S("search.remove","Remove"),onClick:()=>H(e),children:"\xd7"})]},e))})]}),G&&_&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-gray-400 animate-pulse",children:[(0,a.jsx)(x.WI,{className:"h-12 w-12 mb-2 opacity-30"}),(0,a.jsx)("p",{className:"font-primary text-sm",children:S("search.searching","Searching...")})]}),G&&!!B&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-6 text-red-500",children:[(0,a.jsxs)("p",{className:"font-primary text-sm",children:[S("search.error","Error"),": ",B]}),(0,a.jsx)("p",{className:"font-primary text-xs text-gray-500 mt-1",children:S("search.tryAgain","Please try again")})]}),G&&!_&&!B&&0===F.length&&0===O.length&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-gray-400",children:[(0,a.jsx)(x.WI,{className:"h-12 w-12 mb-2 opacity-20"}),(0,a.jsx)("p",{className:"font-primary text-sm",children:S("search.noResults","No results found")})]}),!G&&0===J.length&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-10 text-gray-400",children:[(0,a.jsx)(x.WI,{className:"h-12 w-12 mb-3 opacity-30"}),(0,a.jsx)("p",{className:"font-primary text-sm",children:S("search.noHistory","No search history")}),(0,a.jsx)("p",{className:"font-primary text-xs text-gray-500 mt-1",children:S("search.startTyping","Start typing to search...")})]}),G&&!_&&!B&&(F.length>0||O.length>0)&&(0,a.jsxs)("div",{className:"space-y-4",children:[O.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-primary text-[10px] uppercase tracking-widest text-brand-primary font-bold mb-2 block px-2",children:S("search.aiSuggestions","Semantic Hits / AI Suggestions")}),(0,a.jsx)("ul",{className:"space-y-1",children:O.map(r=>(0,a.jsx)(d.P.li,{animate:{opacity:1,x:0},className:"p-2 hover:bg-brand-primary/5 rounded-md cursor-pointer border border-transparent hover:border-brand-primary/10 transition-colors",initial:{opacity:0,x:-5},onClick:()=>{K(e),W.push((0,y.nb)(`/product/${r.productId}`,Q)),E(!1)},children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"h-8 w-8 rounded-full bg-brand-primary/10 flex items-center justify-center text-brand-primary",children:(0,a.jsx)(u.A,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,a.jsx)("span",{className:"font-primary text-sm line-clamp-1 font-medium",children:r.text}),(0,a.jsxs)("span",{className:"font-primary text-[10px] text-gray-400",children:[r.brand," • ",r.category]})]})]})},r.productId))})]}),F.length>0&&(0,a.jsxs)("div",{children:[O.length>0&&(0,a.jsx)("span",{className:"font-primary text-[10px] uppercase tracking-widest text-gray-400 font-bold mb-2 block px-2 mt-2",children:S("search.exactMatches","Catalog Matches")}),(0,a.jsx)("ul",{className:"space-y-1",children:F.map(r=>(0,a.jsx)(d.P.li,{animate:{opacity:1,y:0},className:"p-2 hover:bg-gray-100 hover:text-black rounded-md cursor-pointer",exit:{opacity:0,y:-5},initial:{opacity:0,y:-5},transition:{duration:.1},onClick:()=>{K(e),W.push((0,y.nb)(`/product/${r.slug||r.id}`,Q)),E(!1)},onMouseDown:e=>e.preventDefault(),children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,h.my)(r.images)?(0,a.jsx)("div",{className:"relative h-10 w-10 flex-shrink-0 rounded-md overflow-hidden border",children:(0,a.jsx)(m.default,{fill:!0,alt:r.name??S("search.product","Product"),className:"object-cover",sizes:"40px",src:(0,h.my)(r.images)})}):(0,a.jsx)("div",{className:"h-10 w-10 rounded-md flex items-center justify-center bg-gray-100 text-gray-500",children:(0,a.jsx)(x.WI,{className:"h-5 w-5"})}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-primary text-sm line-clamp-1",children:r.name??S("search.unnamedProduct","Unnamed product")}),(0,a.jsx)("span",{className:"font-primary text-xs text-gray-500",children:"number"==typeof r.price?`₾${r.price}`:""})]})]})},r.id))})]})]})]})})})})]})}},28973:(e,r,t)=>{t.d(r,{E:()=>i});var a=t(95155),s=t(90368),n=t(95684),l=t(12976);let i=({className:e,size:r=25,onClick:t})=>{let{t:i}=(0,l.k)();return(0,a.jsx)(n.T,{isIconOnly:!0,"aria-label":i("components.goBackButton.goBack","Go back"),className:`flex items-center bg-transparent gap-2 ${e||""}`,onPress:t,children:(0,a.jsx)(s.A,{size:r})})}},33461:(e,r,t)=>{t.d(r,{A:()=>s});var a=t(95155);function s({size:e=40,className:r="",style:t={}}){return(0,a.jsxs)("div",{className:`santa-hat ${r}`,style:{position:"absolute",top:-(.6*e),right:-(.3*e),width:e,height:e,zIndex:10,animation:"santa-hat-wiggle 2s ease-in-out infinite",...t},children:[(0,a.jsxs)("svg",{fill:"none",style:{width:"100%",height:"100%",filter:"drop-shadow(2px 2px 4px rgba(0,0,0,0.2))"},viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{d:"M20 60 Q30 20, 50 15 Q70 20, 80 60 L70 65 Q50 30, 30 65 Z",fill:"#DC2626",stroke:"#B91C1C",strokeWidth:"1"}),(0,a.jsx)("ellipse",{cx:"50",cy:"65",fill:"#FFFFFF",rx:"32",ry:"6"}),(0,a.jsx)("ellipse",{cx:"50",cy:"64",fill:"#F3F4F6",rx:"32",ry:"5"}),(0,a.jsx)("circle",{cx:"50",cy:"12",fill:"#FFFFFF",r:"8"}),(0,a.jsx)("circle",{cx:"50",cy:"12",fill:"#F9FAFB",r:"7"}),(0,a.jsx)("circle",{cx:"48",cy:"10",fill:"#E5E7EB",opacity:"0.6",r:"2"}),(0,a.jsx)("circle",{cx:"53",cy:"13",fill:"#E5E7EB",opacity:"0.6",r:"1.5"}),(0,a.jsx)("path",{d:"M35 35 Q40 25, 45 30 Q42 35, 37 40 Z",fill:"#EF4444",opacity:"0.6"})]}),(0,a.jsx)("style",{children:` @keyframes santa-hat-wiggle { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } } `})]})}},37457:(e,r,t)=>{t.d(r,{t:()=>m});var a=t(95155),s=t(52619),n=t.n(s),l=t(57378),i=t(4788),o=t(12976),c=t(32985),d=t(25016);function m({button:e,itemClassName:r,iconClassName:t="h-5 w-5"}){var s,m;let{lang:u}=(0,o.k)(),x=(s=e.iconName)?l[s]??i.A:i.A,h=(m=e.label,m&&(m[u]||m.en||Object.values(m)[0])||""),p=e.href||"#",f=p.startsWith("/")?(0,c.nb)(p,u):p;return(0,a.jsx)(n(),{href:f,"aria-label":h||e.iconName||"Custom action",title:h||void 0,rel:e.openInNewTab?"noopener noreferrer":void 0,target:e.openInNewTab?"_blank":void 0,className:(0,d.cn)("inline-flex h-9 w-9 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground dark:hover:bg-muted/30",r),children:(0,a.jsx)(x,{className:t,strokeWidth:1.75})})}},47507:(e,r,t)=>{t.d(r,{bq:()=>u,eb:()=>f,gC:()=>p,l6:()=>d,yv:()=>m});var a=t(95155),s=t(12115),n=t(14744),l=t(24033),i=t(12108),o=t(5917),c=t(25016);let d=n.bL;n.YJ;let m=n.WT,u=s.forwardRef(({className:e,children:r,...t},s)=>(0,a.jsxs)(n.l9,{ref:s,className:(0,c.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...t,children:[r,(0,a.jsx)(n.In,{asChild:!0,children:(0,a.jsx)(l.A,{className:"h-4 w-4 opacity-50"})})]}));u.displayName=n.l9.displayName;let x=s.forwardRef(({className:e,...r},t)=>(0,a.jsx)(n.PP,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",e),...r,children:(0,a.jsx)(i.A,{className:"h-4 w-4"})}));x.displayName=n.PP.displayName;let h=s.forwardRef(({className:e,...r},t)=>(0,a.jsx)(n.wn,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",e),...r,children:(0,a.jsx)(l.A,{className:"h-4 w-4"})}));h.displayName=n.wn.displayName;let p=s.forwardRef(({className:e,children:r,position:t="popper",...s},l)=>(0,a.jsx)(n.ZL,{children:(0,a.jsxs)(n.UC,{ref:l,className:(0,c.cn)("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===t&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:t,...s,children:[(0,a.jsx)(x,{}),(0,a.jsx)(n.LM,{className:(0,c.cn)("p-1","popper"===t&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),(0,a.jsx)(h,{})]})}));p.displayName=n.UC.displayName,s.forwardRef(({className:e,...r},t)=>(0,a.jsx)(n.JU,{ref:t,className:(0,c.cn)("px-2 py-1.5 text-sm font-semibold",e),...r})).displayName=n.JU.displayName;let f=s.forwardRef(({className:e,children:r,...t},s)=>(0,a.jsxs)(n.q7,{ref:s,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t,children:[(0,a.jsx)("span",{className:"font-primary absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(o.A,{className:"h-4 w-4"})})}),(0,a.jsx)(n.p4,{children:r})]}));f.displayName=n.q7.displayName,s.forwardRef(({className:e,...r},t)=>(0,a.jsx)(n.wv,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",e),...r})).displayName=n.wv.displayName},47758:(e,r,t)=>{t.d(r,{KB:()=>I,r0:()=>k});var a=t(95155),s=t(52619),n=t.n(s),l=t(20063),i=t(57378),o=t(50859),c=t(17268),d=t(12115),m=t(95684),u=t(631),x=t(49962),h=t(85388),p=t(12976);function f({showLabel:e=!1,icon:r}={}){let t=(0,x.x)(e=>e.getCount()),s=(0,x.x)(e=>e.cart.reduce((e,r)=>e+r.quantity,0)),{bottomNavCartRef:l}=(0,h.s)(),{t:i}=(0,p.k)(),o=(0,d.useRef)(t),[g,b]=(0,d.useState)(!1),y=(0,d.useRef)(null);return(0,d.useEffect)(()=>{t>0&&t!==o.current&&(o.current=t,b(!0))},[t]),(0,d.useEffect)(()=>{if(!g)return;let e=setTimeout(()=>b(!1),500);return()=>clearTimeout(e)},[g]),(0,d.useEffect)(()=>{y.current&&(l.current=y.current)},[l]),(0,a.jsxs)("div",{ref:y,className:"flex flex-col items-center",children:[(0,a.jsx)(u.w,{"data-badge":!0,className:`border-0 absolute top-2 right-2 ${g?"hidden":""}`,color:"danger",content:s,size:"sm",variant:"shadow",children:(0,a.jsx)(m.T,{isIconOnly:!0,"aria-label":i("cart.link.ariaLabel","კალათაში გადასვლა"),as:n(),className:`relative rounded-full bg-transparent ${g?"animate-ping":""}`,href:"/cart",variant:"solid",children:r??(0,a.jsx)(c.aJ,{size:30})})}),e&&(0,a.jsx)("span",{className:"font-primary text-xs text-text-subtle dark:text-text-subtledark truncate w-full text-center",children:i("cart.title","კალათა")})]})}var g=t(97050),b=t(98493),y=t(64655),v=t(32985),j=t(7588),w=t(25016);let N=[{id:"home",kind:"home"},{id:"search",kind:"search"},{id:"cart",kind:"cart"