import{ax as G,d as c,aA as S,b as a,bA as m,P as i,o as E,r as F,_ as H}from"./app-QjDgb7aF.js";import{b as L,w as V,f as _,E as r,j as d,g as j,i as g,q as o,p as v,F as q,G as D,k as l,u as R,a as f}from"./vue-Cm77DuTi.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const T={class:"mk-group-page"},W={class:"_section members _gap"},Y={class:"_content"},$={class:"users"},z={class:"body"},J={class:"action"},K=["onClick","aria-label"],O=L({__name:"group",props:{groupId:{}},setup(k){const p=k,u=f([]),t=f(),b=G();V(()=>p.groupId,()=>{h()});async function h(){c("users/groups/show",{groupId:p.groupId}).then(e=>{t.value=e,c("users/show",{userIds:t.value.userIds}).then(s=>{u.value=s})})}h();function I(){m().then(e=>{i("users/groups/invite",{groupId:t.value.id,userId:e.id})})}function x(e){c("users/groups/pull",{groupId:t.value.id,userId:e.id}).then(()=>{u.value=u.value.filter(s=>s.id!==e.id)})}async function w(){const{canceled:e,result:s}=await E({title:a.ts.groupName,default:t.value.name});e||(await c("users/groups/update",{groupId:t.value.id,name:s}),t.value.name=s)}function M(){m().then(e=>{i("users/groups/transfer",{groupId:t.value.id,userId:e.id})})}async function y(){const{canceled:e}=await F({type:"warning",text:a.t("removeAreYouSure",{x:t.value.name})});e||(await i("users/groups/delete",{groupId:t.value.id}),b.push("/my/groups"))}S(_(()=>({title:a.ts.members,icon:"ph-users-three ph-bold ph-lg"})));const A=_(()=>[{icon:"ph-plus ph-bold ph-lg",text:a.ts.invite,handler:I},{icon:"ph-cursor-text ph-bold ph-lg",text:a.ts.rename,handler:w},{icon:"ph-arrows-left-right ph-bold ph-lg",text:a.ts.transfer,handler:M},{icon:"ph-trash ph-bold ph-lg",text:a.ts.delete,handler:y}]);return(e,s)=>{const C=r("MkPageHeader"),N=r("MkAvatar"),B=r("MkUserName"),P=r("MkAcct"),U=r("MkStickyContainer");return d(),j(U,null,{header:g(()=>[l(C,{actions:A.value},null,8,["actions"])]),default:g(()=>[o("div",T,[o("div",W,[o("div",Y,[o("div",$,[(d(!0),v(q,null,D(u.value,n=>(d(),v("div",{key:n.id,class:"user _panel"},[l(N,{user:n,class:"avatar","show-indicator":!0},null,8,["user"]),o("div",z,[l(B,{user:n,class:"name"},null,8,["user"]),l(P,{user:n,class:"acct"},null,8,["user"])]),o("div",J,[o("button",{class:"_button",onClick:Q=>x(n),"aria-label":R(a).t("removeMember")},[...s[0]||(s[0]=[o("i",{class:"ph-x ph-bold ph-lg"},null,-1)])],8,K)])]))),128))])])])])]),_:1})}}}),se=H(O,[["__scopeId","data-v-898205e3"]]);export{se as default};
//# sourceMappingURL=group-i-DvKKg9.js.map
