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