1import{a7 as ye,N as M,J as _e,e as H,a6 as we,r as d,A as F,Q as Ee,f as $e,o as A,j as Se,w as m,a as Y,B as O,h as t,p as Z,b as g,c as P,D as _,F as Ce,x as Ae,d as ae,t as oe,a5 as Te,m as C,l as ee,ab as Ve,X as W,y as Ie,u as Le,G as ke,z as Be,aq as Ne,q as Fe,_ as Oe}from"./BZfVVY5L.js";import{b as Pe,d as te,u as De,O as Re,E as xe,l as Ke,_ as Ue,w as Me,aV as We}from"./DFmS8tWm.js";import{u as ze,E as He}from"./DaEmWzY4.js";import{E as Ge}from"./FyWegQAD.js";import{u as je,E as qe}from"./D0hBDsqD.js";import{v as Je,x as Qe,b as Xe,t as Ye}from"./BxNYCKlc.js";import{U as D,I as z,C as se}from"./BB_Ol6Sd.js";import{d as Ze}from"./BV19457i.js";import{E as et}from"./DY32N-a_.js";/* empty css *//* empty css */import"./L3JICyaW.js";import{u as tt}from"./Cc0X24U9.js";import{g as at,i as ot}from"./BPCbgEzD.js";import"./CfHLQxI2.js";import"./mMG7yh9Y.js";import"./B1LHWFvT.js";import"./DW3ZqL8B.js";import"./C4IXhnWb.js";import"./DAa18bAU.js";import"./LiyIqwpb.js";import"./DzYFPAFe.js";import"./D3_ABt-T.js";import"./DxxO81JH.js";const st=Pe({valueKey:{type:String,default:"value"},modelValue:{type:[String,Number],default:""},debounce:{type:Number,default:300},placement:{type:te(String),values:["top","top-start","top-end","bottom","bottom-start","bottom-end"],default:"bottom-start"},fetchSuggestions:{type:te([Function,Array]),default:ye},popperClass:{type:String,default:""},triggerOnFocus:{type:Boolean,default:!0},selectWhenUnmatched:{type:Boolean,default:!1},hideLoading:{type:Boolean,default:!1},teleported:je.teleported,highlightFirstItem:{type:Boolean,default:!1},fitInputWidth:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},name:String,...Je(["ariaLabel"])}),lt={[D]:c=>M(c),[z]:c=>M(c),[se]:c=>M(c),focus:c=>c instanceof FocusEvent,blur:c=>c instanceof FocusEvent,clear:()=>!0,select:c=>_e(c)},le="ElAutocomplete",nt=H({name:le,inheritAttrs:!1}),rt=H({...nt,props:st,emits:lt,setup(c,{expose:T,emit:p}){const s=c,V=ze(),I=we(),L=Qe(),f=De("autocomplete"),i=d(),k=d(),w=d(),B=d();let u=!1,r=!1;const a=d([]),o=d(-1),E=d(""),l=d(!1),N=d(!1),b=d(!1),$=Xe(),ne=F(()=>I.style),h=F(()=>(a.value.length>0||b.value)&&l.value),G=F(()=>!s.hideLoading&&b.value),re=F(()=>i.value?Array.from(i.value.$el.querySelectorAll("input")):[]),ue=()=>{h.value&&(E.value=`${i.value.$el.offsetWidth}px`)},ie=()=>{o.value=-1},j=async e=>{if(N.value)return;const n=v=>{b.value=!1,!N.value&&(W(v)?(a.value=v,o.value=s.highlightFirstItem?0:-1):Ye(le,"autocomplete suggestions must be an array"))};if(b.value=!0,W(s.fetchSuggestions))n(s.fetchSuggestions);else{const v=await s.fetchSuggestions(e,n);W(v)&&n(v)}},q=Ze(j,s.debounce),ce=e=>{const n=!!e;if(p(z,e),p(D,e),N.value=!1,l.value||(l.value=n),!s.triggerOnFocus&&!e){N.value=!0,a.value=[];return}q(e)},pe=e=>{var n;L.value||(((n=e.target)==null?void 0:n.tagName)!=="INPUT"||re.value.includes(document.activeElement))&&(l.value=!0)},de=e=>{p(se,e)},fe=e=>{r?r=!1:(l.value=!0,p("focus",e),s.triggerOnFocus&&!u&&q(String(s.modelValue)))},ve=e=>{setTimeout(()=>{var n;if((n=w.value)!=null&&n.isFocusInsideContent()){r=!0;return}l.value&&S(),p("blur",e)})},me=()=>{l.value=!1,p(D,""),p("clear")},J=async()=>{h.value&&o.value>=0&&o.value<a.value.length?R(a.value[o.value]):s.selectWhenUnmatched&&(p("select",{value:s.modelValue}),a.value=[],o.value=-1)},ge=e=>{h.value&&(e.preventDefault(),e.stopPropagation(),S())},S=()=>{l.value=!1},he=()=>{var e;(e=i.value)==null||e.focus()},be=()=>{var e;(e=i.value)==null||e.blur()},R=async e=>{p(z,e[s.valueKey]),p(D,e[s.valueKey]),p("select",e),a.value=[],o.value=-1},x=e=>{if(!h.value||b.value)return;if(e<0){o.value=-1;return}e>=a.value.length&&(e=a.value.length-1);const n=k.value.querySelector(`.${f.be("suggestion","wrap")}`),y=n.querySelectorAll(`.${f.be("suggestion","list")} li`)[e],K=n.scrollTop,{offsetTop:X,scrollHeight:U}=y;X+U>K+n.clientHeight&&(n.scrollTop+=U),X<K&&(n.scrollTop-=U),o.value=e,i.value.ref.setAttribute("aria-activedescendant",`${$.value}-item-${o.value}`)},Q=Re(B,()=>{h.value&&S()});return Ee(()=>{Q==null||Q()}),$e(()=>{i.value.ref.setAttribute("role","textbox"),i.value.ref.setAttribute("aria-autocomplete","list"),i.value.ref.setAttribute("aria-controls","id"),i.value.ref.setAttribute("aria-activedescendant",`${$.value}-item-${o.value}`),u=i.value.ref.hasAttribute("readonly")}),T({highlightedIndex:o,activated:l,loading:b,inputRef:i,popperRef:w,suggestions:a,handleSelect:R,handleKeyEnter:J,focus:he,blur:be,close:S,highlight:x,getData:j}),(e,n)=>(A(),Se(t(qe),{ref_key:"popperRef",ref:w,visible:t(h),placement:e.placement,"fallback-placements":["bottom-start","to
1p-start"],"popper-class":[t(f).e("popper"),e.popperClass],teleported:e.teleported,"gpu-acceleration":!1,pure:"","manual-mode":"",effect:"light",trigger:"click",transition:`${t(f).namespace.value}-zoom-in-top`,persistent:"",role:"listbox",onBeforeShow:ue,onHide:ie},{content:m(()=>[Y("div",{ref_key:"regionRef",ref:k,class:O([t(f).b("suggestion"),t(f).is("loading",t(G))]),style:Z({[e.fitInputWidth?"width":"minWidth"]:E.value,outline:"none"}),role:"region"},[g(t(Ge),{id:t($),tag:"ul","wrap-class":t(f).be("suggestion","wrap"),"view-class":t(f).be("suggestion","list"),role:"listbox"},{default:m(()=>[t(G)?(A(),P("li",{key:0},[_(e.$slots,"loading",{},()=>[g(t(xe),{class:O(t(f).is("loading"))},{default:m(()=>[g(t(Ke))]),_:1},8,["class"])])])):(A(!0),P(Ce,{key:1},Ae(a.value,(v,y)=>(A(),P("li",{id:`${t($)}-item-${y}`,key:y,class:O({highlighted:o.value===y}),role:"option","aria-selected":o.value===y,onClick:K=>R(v)},[_(e.$slots,"default",{item:v},()=>[ae(oe(v[e.valueKey]),1)])],10,["id","aria-selected","onClick"]))),128))]),_:3},8,["id","wrap-class","view-class"])],6)]),default:m(()=>[Y("div",{ref_key:"listboxRef",ref:B,class:O([t(f).b(),e.$attrs.class]),style:Z(t(ne)),role:"combobox","aria-haspopup":"listbox","aria-expanded":t(h),"aria-owns":t($)},[g(t(He),Te({ref_key:"inputRef",ref:i},t(V),{clearable:e.clearable,disabled:t(L),name:e.name,"model-value":e.modelValue,"aria-label":e.ariaLabel,onInput:ce,onChange:de,onFocus:fe,onBlur:ve,onClear:me,onKeydown:[C(ee(v=>x(o.value-1),["prevent"]),["up"]),C(ee(v=>x(o.value+1),["prevent"]),["down"]),C(J,["enter"]),C(S,["tab"]),C(ge,["esc"])],onMousedown:pe}),Ve({_:2},[e.$slots.prepend?{name:"prepend",fn:m(()=>[_(e.$slots,"prepend")])}:void 0,e.$slots.append?{name:"append",fn:m(()=>[_(e.$slots,"append")])}:void 0,e.$slots.prefix?{name:"prefix",fn:m(()=>[_(e.$slots,"prefix")])}:void 0,e.$slots.suffix?{name:"suffix",fn:m(()=>[_(e.$slots,"suffix")])}:void 0]),1040,["clearable","disabled","name","model-value","aria-label","onKeydown"])],14,["aria-expanded","aria-owns"])]),_:3},8,["visible","placement","popper-class","teleported","transition"]))}});var ut=Ue(rt,[["__file","autocomplete.vue"]]);const it=Me(ut),ct={class:"navbar-search"},pt=H({__name:"Search",setup(c){const T=tt.routerStore();Ie();const p=d(),s=d(!1),V=d(""),{locale:I}=Le(),L=u=>at(I.value,u),f=()=>{s.value=!0,ke(()=>{setTimeout(()=>{p.value.focus()})})},i=(u,r)=>{const a=u?T.routes.filter(k(u)):T.routes;r(a)},k=u=>r=>{const a=I.value;if(ot(a))return r.path.toLowerCase().indexOf(u.toLowerCase())>-1||r.meta.title.toLowerCase().indexOf(u.toLowerCase())>-1;{const o=a.indexOf("-"),l=`${a.substring(0,o)}_title`;return r.path.toLowerCase().indexOf(u.toLowerCase())>-1||r.meta[l].toLowerCase().indexOf(u.toLowerCase())>-1}},w=async u=>{const r=Be();await Ne(r(u.path)),s.value=!1},B=()=>{s.value=!1};return(u,r)=>{const a=Fe,o=it,E=et;return A(),P("div",ct,[g(a,{name:"search",onClick:f}),g(E,{modelValue:s.value,"onUpdate:modelValue":r[1]||(r[1]=l=>s.value=l),width:280,"destroy-on-close":!0,modal:!1,fullscreen:"","show-close":!1},{default:m(()=>[g(o,{ref_key:"menuAutocompleteRef",ref:p,modelValue:V.value,"onUpdate:modelValue":r[0]||(r[0]=l=>V.value=l),size:"large","prefix-icon":t(We),"fetch-suggestions":i,placeholder:u.$t("admin.search"),onSelect:w,onBlur:B},{default:m(({item:l})=>[g(a,{name:l.meta.icon},null,8,["name"]),ae(" "+oe(L(l.meta)),1)]),_:1},8,["modelValue","prefix-icon","placeholder"])]),_:1},8,["modelValue"])])}}}),Pt=Oe(pt,[["__scopeId","data-v-e51ad9b0"]]);export{Pt as default};
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.