1import{_ as q}from"./DQSYLdLJ.js";import{b as z,f as D,g as K,C as U,y as j,aM as O,r as d,I as Q,an as A,aq as G,a7 as b,c as k,ax as H,j as u,k as n,t as c,m as t,ak as J,ar as W,at as X,L as Y,au as Z,F as ee,n as te,v as _,w,o as se,x,_ as ae,q as o,l as oe,R as ne,s as S,aN as re}from"./B30BqIw0.js";import{u as le}from"./Bd9_UhsN.js";import{u as ie}from"./DcfyVq36.js";const ue={role:"status",class:"sr-only"},ce={class:"flex items-center"},de=["placeholder","onKeydown"],he={key:0,"data-testid":"layout-search-result-box",class:"absolute border-secondary-100 border-t-1 duration-300 mt-6 overflow-hidden right-0 rounded-b-md shadow-md transition-height w-25vw z-5001 bg-white"},pe={class:"flex overflow-y-auto min-h-[300px] max-h-[450px]"},me={class:"w-100%"},ve={key:0,class:"w-70vw h-40 bg-[#666666] blur-2xl fixed animate-spin"},fe={key:1},ge={key:0},ye={key:1,"data-testid":"layout-search-result-box-no-result"},Ce=z({__name:"LayoutStoreSearch",props:{displayTotal:{default:8}},emits:["link-clicked"],setup(be,{emit:ke}){const{searchTerm:$,search:C,getProducts:M,getTotal:r,loading:h}=le(),{trackSearch:L}=ie(),P=D(),{formatLink:p}=K(P),{t:v}=U(),{push:R}=j(),T=O(),l=d(!1),f=d(null),m=d();Q(()=>{m.value.focus(),window.addEventListener("reset-search-input",g)}),A(()=>{window.removeEventListener("reset-search-input",g)});const{focused:N}=G(m);b(l,e=>{N.value=e});const s=d("");b(s,e=>{e.length>=3&&B(e)});function g(){s.value=""}const B=re(e=>{$.value=e,C()},300),F=k(()=>s.value.length>=3&&l.value);H(f,()=>{l.value=!1});const I=()=>{T.close(),l.value=!1,s.value.trim()&&L(s.value),R(p("/search?search="+s.value))},V=k(()=>s.value.length<3||h.value?"":r.value>0?`${r.value} ${v("search.result",r.value)}`:v("search.noResults"));return(e,a)=>{const E=q,y=ae;return o(),u("div",{ref_key:"searchContainer",ref:f,class:"relative group p-3 pt-1.6 pl-0 pr-0 transition duration-300 inline-block w-full border-b-2 border-b-black"},[n("div",ue,c(t(V)),1),n("div",ce,[a[4]||(a[4]=n("div",{class:"sw-search-input w-6 h-6 icon ub-search"},null,-1)),J(n("input",{ref_key:"searchInput",ref:m,"onUpdate:modelValue":a[0]||(a[0]=i=>Z(s)?s.value=i:null),type:"text","aria-label":"Search for products",class:"sw-search-input bg-uppababy-bodybg text-uppababy p-2 ml-2 lg:ml-0 xl:ml-2 grow h-6 focus:outline-none xl:w-64",placeholder:e.$t("form.searchPlaceholder"),onFocus:a[1]||(a[1]=i=>l.value=!0),onKeydown:X(Y(I,["prevent"]),["enter"])},null,40,de),[[W,t(s)]])]),t(F)?(o(),u("div",he,[n("div",pe,[n("div",me,[(o(!0),u(ee,null,te(t(M)?.slice(0,e.displayTotal),i=>(o(),_(y,{key:i.id,to:t(p)(t(ne)(i)),"data-testid":"layout-search-suggest-link",class:"block px-4 py-2 hover:bg-gray-100",onClick:a[2]||(a[2]=_e=>[l.value=!1,e.$emit("link-clicked")])},{default:w(()=>[oe(E,{product:i},null,8,["product"])]),_:2},1032,["to"]))),128))])]),n("div",{class:se(["h-11 text-[15px] rounded-b-md p-3 text-center transition",[t(h)?"bg-uppababy-bordergrey":"bg-secondary-100"]]),style:{"clip-path":"inset(0% 0% 0% 0%)"}},[t(h)?(o(),u("div",ve)):(o(),u("div",fe,[t(r)>0?(o(),_(y,{key:0,"data-testid":"layout-search-result-box-more-link",to:t(p)({path:"/search",query:{search:t(s)}}),onClick:a[3]||(a[3]=i=>[l.value=!1,e.$emit("link-clicked")])},{default:w(()=>[S(c(e.$t("search.see"))+" ",1),t(r)!==1?(o(),u("span",ge,c(e.$t("search.all")),1)):x("",!0),S(" "+c(t(r))+" ",1),n("span",null,c(e.$t("search.result",t(r))),1)]),_:1},8,["to"])):(o(),u("div",ye,c(e.$t("search.noResults")),1))]))],2)])):x("",!0)],512)}}});export{Ce as _};
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.