1import{d as V,T as Z,c as H,g as i,h as s,i as c,H as B,t as h,F as y,x as K,s as b,ad as G,r as v,l as z,f as r,v as J,_ as P}from"./BSliLbpZ.js";const Q={class:"locsearch"},W={class:"locsearch__field"},X=["id","aria-expanded","aria-activedescendant","aria-label","placeholder","value"],Y=["id","aria-selected","onMousedown","onMouseenter"],ee=["src","alt"],te={key:1,class:"locsearch__logo locsearch__logo--fallback","aria-hidden":"true"},ae={class:"locsearch__text"},oe={class:"locsearch__title"},se={class:"locsearch__meta"},le={class:"locsearch__text"},ne={class:"locsearch__title"},ie={key:0,class:"locsearch__meta"},ce={key:0,class:"locsearch__none"},re=V({__name:"LocationSearch",props:{placeholder:{},ariaLabel:{},inputId:{},debounceMs:{default:400},minChars:{default:3}},emits:["select","error"],setup(_,{expose:D,emit:q}){const m=_,w=q,E=Z(),C=G(),$=`${C}-list`,x=e=>`${C}-opt-${e}`,M=v(null),u=v(""),l=v([]),n=v(!1),f=v(!1),o=v(-1),F=z(()=>o.value>=0&&o.value<l.value.length?x(o.value):void 0),S=z(()=>n.value&&!f.value&&l.value.length===0&&u.value.trim().length>=m.minChars);let d=null,p=null;function j(e){return e._type==="host"?e.item_name:`${e.item_plz} ${e.item_ort_einfach}`.trim()}function A(e){if(u.value=e.target.value,o.value=-1,d&&clearTimeout(d),u.value.trim().length<m.minChars){l.value=[],n.value=!1,f.value=!1;return}f.value=!0,n.value=!0,d=setTimeout(T,m.debounceMs)}async function T(){const e=u.value.trim();if(!(e.length<m.minChars))try{const t=await E.searchLocations(e);if(u.value.trim()!==e)return;l.value=t,n.value=!0}catch(t){l.value=[],w("error",t)}finally{u.value.trim()===e&&(f.value=!1)}}function k(e){n.value=!1,o.value=-1,u.value=j(e),w("select",e)}function I(){if(o.value>=0&&l.value[o.value]){k(l.value[o.value]);return}if(l.value.length>0){k(l.value[0]);return}d&&clearTimeout(d),u.value.trim().length>=m.minChars&&(f.value=!0,n.value=!0,T())}function L(e){const t=l.value.length;t!==0&&(n.value=!0,o.value=o.value<0?e>0?0:t-1:(o.value+e+t)%t)}function N(e){switch(e.key){case"ArrowDown":e.preventDefault(),L(1);break;case"ArrowUp":e.preventDefault(),L(-1);break;case"Enter":e.preventDefault(),I();break;case"Escape":n.value=!1,o.value=-1;break}}function R(){p&&clearTimeout(p),l.value.length>0&&(n.value=!0)}function O(){p=setTimeout(()=>{n.value=!1},120)}return H(()=>{d&&clearTimeout(d),p&&clearTimeout(p)}),D({focus:()=>M.value?.focus()}),(e,t)=>(r(),i("div",Q,[s("div",W,[t[1]||(t[1]=s("svg",{class:"locsearch__pin",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[s("path",{d:"M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z"}),s("circle",{cx:"12",cy:"10",r:"3"})],-1)),s("input",{id:_.inputId,ref_key:"inputRef",ref:M,class:"locsearch__input",type:"search",role:"combobox","aria-autocomplete":"list","aria-expanded":c(n),"aria-controls":$,"aria-activedescendant":c(F),"aria-label":_.inputId?void 0:_.ariaLabel??_.placeholder,placeholder:_.placeholder,value:c(u),autocomplete:"off",autocapitalize:"off",autocorrect:"off",spellcheck:"false",enterkeyhint:"search",onInput:A,onKeydown:N,onFocus:R,onBlur:O},null,40,X),s("button",{type:"button",class:"locsearch__submit",onMousedown:t[0]||(t[0]=B(()=>{},["prevent"])),onClick:I},h(e.$t("home.searchSubmit")),33)]),c(n)&&(c(l).length>0||c(S))?(r(),i("ul",{key:0,id:$,class:"locsearch__list",role:"listbox"},[(r(!0),i(y,null,K(c(l),(a,g)=>(r(),i("li",{id:x(g),key:`${a._type}-${a.id}`,class:J(["locsearch__option",{"is-active":g===c(o)}]),role:"option","aria-selected":g===c(o),onMousedown:B(U=>k(a),["prevent"]),onMouseenter:U=>o.value=g},[a._type==="host"?(r(),i(y,{key:0},[a.item_logo?(r(),i("img",{key:0,src:a.item_logo,alt:a.item_name,class:"locsearch__logo",width:"32",height:"32",loading:"lazy"},null,8,ee)):(r(),i("span",te,"ð½")),s("span",ae,[s("span",oe,h(a.item_name),1),s("span",se,h(a.item_plz)+" "+h(a.item_ort),1)])],64)):(r(),i(y,{key:1},[t[2]||(t[2]=s("svg",{class:"locsearch__optpin",viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[s("path",{d:"M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z"}),s("circle",{cx:"12",cy:"10",r:"3"})],-1)),s("span",le,[s("span",ne,h(a.item_plz)+" "+h(a.item_ort_einfach),1),a.item_ortsteil&&a.item_ortsteil!==a.item_ort_einfach?(r(),i("span",ie,h(a.item_ortsteil),1)):b("",!0)])],64))],42,Y))),128)),c(S)?(r(),i("li",ce,h(e.$t("home.searchNoResults")),1)):b("",!0)])):b("",!0)]))}}),he=Object.assign(P(re,[["__scopeId","data-v-0a326478"]]),{__name:"LocationSearch"});export{he as L};
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.