import{j as s,h as n}from"./vendor.e6eaca24.js";import{u,a as m,t as i}from"./index.c6944236.js";import{U as d}from"./UserAvatar.acd4ab4e.js";import{P as h}from"./PreviewSearch.7b29c032.js";const _="_result_134em_1",v="_avatar_134em_5",f="_username_134em_10";var t={result:_,avatar:v,username:f};let w=r=>{const a=u("components.user_search");return s(h,{className:r.className,placeholder:r.placeholder||a(".placeholder"),noResultsMessage:a(".no_result"),onGetResultKey:e=>e.id,onSearch:async e=>{const o=e.startsWith("*");if(o&&(e=e.substr(1)),!e)return[];const{requestError:l,response:c}=await m.user.searchUser({query:e,wildcard:o?"Both":"End"});if(l)i.error(l(a));else return c.userMetas;return[]},onRenderResult:e=>n("div",{className:t.result,children:[s(d,{className:t.avatar,userAvatar:e.avatar,imageSize:27.5,rounded:!0}),s("div",{className:t.username,children:e.username})]}),onResultSelect:r.onResultSelect})};export{w as U};
