import{b as D,w as I,f as h,E as u,j as p,g as z,i as o,k as a,q as i,T as w,u as l,p as v,J as f,D as _,I as E,H as g,F as R,G as j,a as k}from"./vue-Cm77DuTi.js";import{aA as q,M,b as d,a8 as G,d as c,w as J,P as W,o as Y,r as K,at as O,m as Q,_ as X}from"./app-QjDgb7aF.js";import{F as Z}from"./section-Dbg05qO2.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const ee={class:"mk-list-page"},te={key:0,class:"_section"},se={class:"_content"},ae={key:0,class:"_section members _gap"},ne={class:"_title"},oe={class:"_content"},le={class:"users"},ie={class:"body"},de={class:"action"},re=["onClick","aria-label"],ue=D({__name:"list",props:{listId:{}},setup(y){const b=y;let s=k(null),r=k(!1),m=k([]);function C(){c("users/lists/show",{listId:b.listId}).then(t=>{s.value=t,r.value=t.hideFromHomeTl,c("users/show",{userIds:s.value.userIds}).then(e=>{m.value=e})})}function F(){J().then(t=>{W("users/lists/push",{listId:s.value.id,userId:t.id}).then(()=>{m.value.push(t)})})}function x(t){c("users/lists/pull",{listId:s.value.id,userId:t.id}).then(()=>{m.value=m.value.filter(e=>e.id!==t.id)})}async function H(){const{canceled:t,result:e}=await Y({title:d.ts.enterListName,default:s.value.name});t||(await c("users/lists/update",{listId:s.value.id,name:e}),s.value.name=e)}async function S(){const{canceled:t}=await K({type:"warning",text:d.t("removeAreYouSure",{x:s.value.name})});t||(await c("users/lists/delete",{listId:s.value.id}),O(),Q.push("/my/lists"))}async function T(){await c("users/lists/update",{listId:s.value.id,hideFromHomeTl:r.value})}I(()=>b.listId,C,{immediate:!0}),I(()=>r.value,T);const A=h(()=>[]),N=h(()=>[]);return q(h(()=>s.value?{title:s.value.name,icon:"ph-list-bullets ph-bold ph-lg"}:null)),(t,e)=>{const U=u("MkPageHeader"),V=u("MkAvatar"),B=u("MkUserName"),L=u("MkAcct"),$=u("MkSpacer"),P=u("MkStickyContainer");return p(),z(P,null,{header:o(()=>[a(U,{actions:A.value,tabs:N.value},null,8,["actions","tabs"])]),default:o(()=>[a($,{"content-max":700},{default:o(()=>[i("div",ee,[a(w,{name:t.$store.state.animation?"zoom":"",mode:"out-in"},{default:o(()=>[l(s)?(p(),v("div",te,[i("div",se,[a(M,{inline:"",onClick:e[0]||(e[0]=n=>F())},{default:o(()=>[f(_(l(d).ts.addUser),1)]),_:1}),a(M,{inline:"",onClick:e[1]||(e[1]=n=>H())},{default:o(()=>[f(_(l(d).ts.rename),1)]),_:1}),a(M,{inline:"",onClick:e[2]||(e[2]=n=>S())},{default:o(()=>[f(_(l(d).ts.delete),1)]),_:1}),a(Z,null,{default:o(()=>[a(G,{modelValue:l(r),"onUpdate:modelValue":e[3]||(e[3]=n=>E(r)?r.value=n:r=n)},{default:o(()=>[f(_(l(d).ts.hideFromHome),1)]),_:1},8,["modelValue"])]),_:1})])])):g("",!0)]),_:1},8,["name"]),a(w,{name:t.$store.state.animation?"zoom":"",mode:"out-in"},{default:o(()=>[l(s)?(p(),v("div",ae,[i("div",ne,_(l(d).ts.members),1),i("div",oe,[i("div",le,[(p(!0),v(R,null,j(l(m),n=>(p(),v("div",{key:n.id,class:"user _panel"},[a(V,{user:n,class:"avatar","show-indicator":!0},null,8,["user"]),i("div",ie,[a(B,{user:n,class:"name"},null,8,["user"]),a(L,{user:n,class:"acct"},null,8,["user"])]),i("div",de,[i("button",{class:"_button",onClick:ce=>x(n),"aria-label":l(d).t("removeMember")},[...e[4]||(e[4]=[i("i",{class:"ph-x ph-bold ph-lg"},null,-1)])],8,re)])]))),128))])])])):g("",!0)]),_:1},8,["name"])])]),_:1})]),_:1})}}}),he=X(ue,[["__scopeId","data-v-398af29e"]]);export{he as default};
//# sourceMappingURL=list-jVdFJ8i7.js.map
