import{u as g,p as w,c as s,e as f,a as e,t as a,q as i,f as k,F as C,m as A,g as c,w as D,h as L,r as _,o,k as y}from"./index-Bodg7xX-.js";import{_ as N}from"./AdminSidebar-C3W8DF6y.js";import{u as R}from"./admins-Dq1-j8lI.js";import"./bmmg-logo-CDMybbK7.js";const S={class:"min-h-screen bg-ink flex flex-col md:flex-row"},V={class:"flex-1 p-6 md:p-10 max-w-3xl"},$={class:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-8"},j={class:"text-muted text-sm mt-1"},B={key:0,class:"text-muted text-sm"},E={key:1,class:"text-wine text-sm"},F={key:2,class:"glass rounded-2xl overflow-hidden"},M={class:"w-full text-sm"},q={class:"px-5 py-3"},z={class:"text-cream"},J={key:0,class:"text-muted text-xs ml-1"},T={class:"text-muted text-xs md:hidden"},U={class:"px-5 py-3 hidden md:table-cell text-muted text-xs"},G={class:"px-5 py-3 hidden md:table-cell text-muted text-xs font-mono"},H={class:"px-5 py-3 text-right"},I=["onClick"],K={key:1,class:"text-xs text-muted/50"},O={key:0,class:"p-12 text-center"},P={class:"glass rounded-2xl p-6 max-w-sm w-full shadow-soft"},Q={class:"text-muted text-sm mb-2"},W={key:0,class:"text-sm text-wine mb-4"},X={class:"flex gap-3 justify-end"},ne={__name:"AdminsList",setup(Y){const l=R(),u=g(),d=_(null),m=_("");w(()=>l.fetchAdmins());function b(r){return r?new Date(r).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"—"}async function v(){var r,t;if(d.value){m.value="";try{await l.removeAdmin(d.value.id),d.value=null}catch(x){m.value=((t=(r=x.response)==null?void 0:r.data)==null?void 0:t.message)||"Could not remove this admin."}}}return(r,t)=>{const x=L("RouterLink");return o(),s("div",S,[f(N),e("main",V,[e("div",$,[e("div",null,[t[2]||(t[2]=e("h1",{class:"font-display text-2xl text-cream"},"Admins",-1)),e("p",j,a(i(l).admins.length)+" account"+a(i(l).admins.length===1?"":"s"),1)]),f(x,{to:{name:"admin-admin-new"},class:"inline-flex items-center gap-2 bg-gold hover:bg-gold-bright text-ink text-sm font-semibold rounded-lg px-4 py-2.5 transition-colors w-fit"},{default:k(()=>[...t[3]||(t[3]=[y(" + Add admin ",-1)])]),_:1})]),i(l).loading?(o(),s("p",B,"Loading admins…")):i(l).error?(o(),s("p",E,a(i(l).error),1)):(o(),s("div",F,[e("table",M,[t[4]||(t[4]=e("thead",null,[e("tr",{class:"border-b border-hairline text-left"},[e("th",{class:"eyebrow font-normal px-5 py-3"},"Name"),e("th",{class:"eyebrow font-normal px-5 py-3 hidden md:table-cell"},"Email"),e("th",{class:"eyebrow font-normal px-5 py-3 hidden md:table-cell"},"Joined"),e("th",{class:"eyebrow font-normal px-5 py-3 text-right"},"Actions")])],-1)),e("tbody",null,[(o(!0),s(C,null,A(i(l).admins,n=>{var p,h;return o(),s("tr",{key:n.id,class:"border-b border-hairline last:border-0 hover:bg-white/[0.02] transition-colors"},[e("td",q,[e("p",z,[y(a(n.name)+" ",1),n.id===((p=i(u).admin)==null?void 0:p.id)?(o(),s("span",J,"(you)")):c("",!0)]),e("p",T,a(n.email),1)]),e("td",U,a(n.email),1),e("td",G,a(b(n.created_at)),1),e("td",H,[n.id!==((h=i(u).admin)==null?void 0:h.id)?(o(),s("button",{key:0,onClick:Z=>d.value=n,class:"text-xs text-wine hover:text-red-400 transition-colors"}," Remove ",8,I)):(o(),s("span",K,"—"))])])}),128))])]),i(l).admins.length===0?(o(),s("div",O,[...t[5]||(t[5]=[e("p",{class:"text-muted text-sm"},"No admins yet.",-1)])])):c("",!0)]))]),d.value?(o(),s("div",{key:0,class:"fixed inset-0 bg-black/70 backdrop-blur-sm flex items-center justify-center px-6 z-50",onClick:t[1]||(t[1]=D(n=>d.value=null,["self"]))},[e("div",P,[t[6]||(t[6]=e("h2",{class:"font-display text-lg text-cream mb-2"},"Remove this admin?",-1)),e("p",Q,' "'+a(d.value.name)+'" will lose access immediately. Any releases they published stay in the catalog but become manageable by any admin. ',1),m.value?(o(),s("p",W,a(m.value),1)):c("",!0),e("div",X,[e("button",{onClick:t[0]||(t[0]=n=>d.value=null),class:"px-4 py-2 rounded-lg text-sm text-muted hover:text-cream transition-colors"}," Cancel "),e("button",{onClick:v,class:"px-4 py-2 rounded-lg text-sm bg-wine hover:bg-wine-deep text-cream transition-colors"}," Remove ")])])])):c("",!0)])}}};export{ne as default};
