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