import{d as D,v as _,a7 as E,b as f,a5 as F,_ as I}from"./app-QjDgb7aF.js";import{F as q}from"./split-B5EOpoau.js";import{b as j,c as z,E as b,j as a,g as G,i as u,q as d,k as i,I as y,u as l,J as U,D as C,p as r,x as g,F as N,G as L,H as S,a as v}from"./vue-Cm77DuTi.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const H={class:"tbhwbxdg"},J={class:"form"},O={key:0,class:"users"},R=["onClick"],T={class:"body"},W={key:1,class:"empty"},X={key:1,class:"recent"},K={class:"users"},P=["onClick"],Q={class:"body"},Y=j({__name:"MkUserSelectLocalDialog",emits:["ok","cancel","closed"],setup(Z,{emit:A}){const h=A;let n=v(""),c=v([]),M=v([]),t=v(null),m=v();const B=()=>{if(n.value===""){c.value=[];return}D("users/search",{query:n.value,origin:"local",limit:10,detail:!1}).then(o=>{c.value=o})},k=()=>{if(t.value==null)return;h("ok",t.value),m.value.close();let o=_.state.recentlyUsedUsers;o=o.filter(s=>s!==t.value.id),o.unshift(t.value.id),_.set("recentlyUsedUsers",o.splice(0,16))},w=()=>{h("cancel"),m.value.close()};return z(()=>{D("users/show",{userIds:_.state.recentlyUsedUsers}).then(o=>{M.value=o})}),(o,s)=>{const $=b("MkAvatar"),x=b("MkUserName"),V=b("MkAcct");return a(),G(F,{ref_key:"dialogEl",ref:m,"with-ok-button":!0,"ok-button-disabled":l(t)==null,onClick:s[3]||(s[3]=e=>w()),onClose:s[4]||(s[4]=e=>w()),onOk:s[5]||(s[5]=e=>k()),onClosed:s[6]||(s[6]=e=>o.$emit("closed"))},{header:u(()=>[U(C(l(f).ts.selectUser),1)]),default:u(()=>[d("div",H,[d("div",J,[i(q,{"min-width":170},{default:u(()=>[i(E,{modelValue:l(n),"onUpdate:modelValue":[s[0]||(s[0]=e=>y(n)?n.value=e:n=e),B],autofocus:!0},{label:u(()=>[U(C(l(f).ts.username),1)]),prefix:u(()=>[...s[7]||(s[7]=[U("@",-1)])]),_:1},8,["modelValue"])]),_:1})]),l(n)!=""?(a(),r("div",{key:0,class:g(["result",{hit:l(c).length>0}])},[l(c).length>0?(a(),r("div",O,[(a(!0),r(N,null,L(l(c),e=>(a(),r("div",{key:e.id,class:g(["user",{selected:l(t)&&l(t).id===e.id}]),onClick:p=>y(t)?t.value=e:t=e,onDblclick:s[1]||(s[1]=p=>k())},[i($,{user:e,class:"avatar","show-indicator":!0,disableLink:""},null,8,["user"]),d("div",T,[i(x,{user:e,class:"name"},null,8,["user"]),i(V,{user:e,class:"acct"},null,8,["user"])])],42,R))),128))])):(a(),r("div",W,[d("span",null,C(l(f).ts.noUsers),1)]))],2)):S("",!0),l(n)==""?(a(),r("div",X,[d("div",K,[(a(!0),r(N,null,L(l(M),e=>(a(),r("div",{key:e.id,class:g(["user",{selected:l(t)&&l(t).id===e.id}]),onClick:p=>y(t)?t.value=e:t=e,onDblclick:s[2]||(s[2]=p=>k())},[i($,{user:e,class:"avatar","show-indicator":!0,disableLink:""},null,8,["user"]),d("div",Q,[i(x,{user:e,class:"name"},null,8,["user"]),i(V,{user:e,class:"acct"},null,8,["user"])])],42,P))),128))])])):S("",!0)])]),_:1},8,["ok-button-disabled"])}}}),ae=I(Y,[["__scopeId","data-v-8f9f9b38"]]);export{ae as default};
//# sourceMappingURL=MkUserSelectLocalDialog-DH8XZeB8.js.map
