(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,28480,e=>{"use strict";var s=e.i(43476),t=e.i(71645);function r(){let[e,r]=(0,t.useState)(null),[l,i]=(0,t.useState)(!0);if((0,t.useEffect)(()=>{fetch("/api/admin/billing").then(e=>e.json()).then(r).catch(console.error).finally(()=>i(!1))},[]),l)return(0,s.jsx)("div",{className:"py-20 text-center text-white/30",children:"Loading..."});if(!e)return(0,s.jsx)("div",{className:"py-20 text-center text-red-400",children:"Failed to load"});let a=Object.values(e.breakdown).reduce((e,s)=>e+s,0);return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-bold",children:"Billing & Revenue"}),(0,s.jsx)("p",{className:"text-sm text-white/50",children:"Revenue breakdown and subscriber management"})]}),(0,s.jsxs)("div",{className:"grid gap-4 sm:grid-cols-4",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-5",children:[(0,s.jsx)("p",{className:"text-xs font-semibold uppercase text-white/40",children:"MRR"}),(0,s.jsxs)("p",{className:"mt-2 text-4xl font-bold text-green-400",children:["$",e.mrr]}),(0,s.jsx)("p",{className:"text-xs text-white/30",children:"/month"})]}),["free","starter","pro"].map(t=>(0,s.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-5",children:[(0,s.jsx)("p",{className:"text-xs font-semibold uppercase text-white/40",children:t}),(0,s.jsx)("p",{className:"mt-2 text-3xl font-bold",children:e.breakdown[t]||0}),(0,s.jsxs)("p",{className:"text-xs text-white/30",children:[a>0?Math.round((e.breakdown[t]||0)/a*100):0,"% of users"]})]},t))]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/10",children:[(0,s.jsx)("div",{className:"border-b border-white/10 bg-white/5 px-5 py-3",children:(0,s.jsxs)("p",{className:"font-semibold",children:["Paying Subscribers (",e.subscribedUsers.length,")"]})}),0===e.subscribedUsers.length?(0,s.jsx)("div",{className:"px-5 py-8 text-center text-sm text-white/30",children:"No paying subscribers yet"}):(0,s.jsxs)("table",{className:"min-w-full text-sm",children:[(0,s.jsx)("thead",{className:"border-b border-white/5 text-left text-white/40",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 font-semibold",children:"User"}),(0,s.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Plan"}),(0,s.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Stripe ID"}),(0,s.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Since"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-white/5",children:e.subscribedUsers.map(e=>(0,s.jsxs)("tr",{className:"hover:bg-white/5",children:[(0,s.jsxs)("td",{className:"px-4 py-3",children:[(0,s.jsx)("p",{className:"font-medium",children:e.name}),(0,s.jsx)("p",{className:"text-xs text-white/40",children:e.email})]}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("span",{className:"rounded-full bg-[var(--color-bg-brand)]/20 px-2 py-0.5 text-xs text-[var(--color-accent-green-light)]",children:e.plan})}),(0,s.jsx)("td",{className:"px-4 py-3 font-mono text-xs text-white/30",children:e.stripeCustomerId||"—"}),(0,s.jsx)("td",{className:"px-4 py-3 text-xs text-white/40",children:new Date(e.createdAt).toLocaleDateString()})]},e._id))})]})]})]})}e.s(["default",()=>r])}]);