1import{e as r,b1 as F,eB as L,b2 as z,r as $,j as e,B as b,aq as _,dx as u,dy as m,eJ as v,ar as x,er as j,e2 as I,R as f,y,ei as N,es as k,Q as O}from"./index-AXjBfABT.js";import{T as C,a as T,b as c,c as o,d as R,e as l}from"./table-BBaG7VxI.js";import{u as D}from"./useQuery-zJNcmMfu.js";import{a as E}from"./admin_overview_title-Bv0sfnxd.js";import{D as P}from"./dashboard-header-fyAB-8df.js";import"./useBaseQuery-rwx0sKqC.js";import"./sidebar-Y6ErTO0z.js";const U=()=>"Admin",H=((n={},t={})=>(t.locale??r(),U())),q=()=>"Lifetime sums by transaction type.",M=((n={},t={})=>(t.locale??r(),q())),Q=()=>"No credit transactions yet.",V=((n={},t={})=>(t.locale??r(),Q())),K=()=>"Credit ledger by type",G=((n={},t={})=>(t.locale??r(),K())),J=n=>`${n?.count} transactions`,W=((n,t={})=>(t.locale??r(),J(n))),X=()=>"Operational snapshot across users, tasks, credits, and payments.",Y=((n={},t={})=>(t.locale??r(),X())),Z=()=>"Failed to load overview.",ee=((n={},t={})=>(t.locale??r(),Z())),te=()=>"Loading overviewâ¦",ne=((n={},t={})=>(t.locale??r(),te())),re=()=>"Credits used",se=((n={},t={})=>(t.locale??r(),re())),ie=()=>"Lifetime usage",ae=((n={},t={})=>(t.locale??r(),ie())),le=()=>"Paid payments",oe=((n={},t={})=>(t.locale??r(),le())),de=n=>`${n?.count} total payment rows`,ce=((n,t={})=>(t.locale??r(),de(n))),_e=()=>"Tasks",ue=((n={},t={})=>(t.locale??r(),_e())),me=n=>`${n?.count} new in range`,ve=((n,t={})=>(t.locale??r(),me(n))),xe=()=>"Users",pe=((n={},t={})=>(t.locale??r(),xe())),we=n=>`${n?.count} new in range`,he=((n,t={})=>(t.locale??r(),we(n))),je=n=>`${n?.count} paid in range`,ge=((n,t={})=>(t.locale??r(),je(n))),be=()=>"30 days",fe=((n={},t={})=>(t.locale??r(),be())),ye=()=>"7 days",Ne=((n={},t={})=>(t.locale??r(),ye())),ke=()=>"Latest 8 tasks across all users.",Ce=((n={},t={})=>(t.locale??r(),ke())),Te=()=>"No recent tasks.",Re=((n={},t={})=>(t.locale??r(),Te())),Ae=()=>"Recent tasks",Se=((n={},t={})=>(t.locale??r(),Ae())),Ee=()=>"Latest 8 registered accounts.",Be=((n={},t={})=>(t.locale??r(),Ee())),Fe=()=>"No users yet.",Le=((n={},t={})=>(t.locale??r(),Fe())),ze=()=>"Recent users",$e=((n={},t={})=>(t.locale??r(),ze())),Ie=()=>"Account and content inventory.",Oe=((n={},t={})=>(t.locale??r(),Ie())),De=()=>"System summary",Pe=((n={},t={})=>(t.locale??r(),De())),Ue=()=>"Created",A=((n={},t={})=>(t.locale??r(),Ue())),He=()=>"Credits",qe=((n={},t={})=>(t.locale??r(),He())),Me=()=>"Email",Qe=((n={},t={})=>(t.locale??r(),Me())),Ve=()=>"Name",Ke=((n={},t={})=>(t.locale??r(),Ve())),Ge=()=>"Role",Je=((n={},t={})=>(t.locale??r(),Ge())),We=()=>"Status",Xe=((n={},t={})=>(t.locale??r(),We())),Ye=()=>"Task",Ze=((n={},t={})=>(t.locale??r(),Ye())),et=()=>"User",tt=((n={},t={})=>(t.locale??r(),et())),nt=()=>"Lifetime distribution of task outcomes.",rt=((n={},t={})=>(t.locale??r(),nt())),st=()=>"No tasks yet.",it=((n={},t={})=>(t.locale??r(),st())),at=()=>"Tasks by status",lt=((n={},t={})=>(t.locale??r(),at())),ot=()=>"Admins",dt=((n={},t={})=>(t.locale??r(),ot())),ct=()=>"Banned users",_t=((n={},t={})=>(t.locale??r(),ct())),ut=()=>"Blog posts",mt=((n={},t={})=>(t.locale??r(),ut())),vt=()=>"File storage",xt=((n={},t={})=>(t.locale??r(),vt())),pt=()=>"Files",wt=((n={},t={})=>(t.locale??r(),pt())),ht=()=>"Enabled footer links",jt=((n={},t={})=>(t.locale??r(),ht())),gt=()=>"View all activity",bt=((n={},t={})=>(t.locale??r(),gt())),ft=()=>"View all users",yt=((n={},t={})=>(t.locale??r(),ft())),Nt=F({method:"GET"}).middleware([L]).handler(z("c21a15791b73d5f4d97eea7fa720c0788ff6480ab69dd57d83eddc08c3d595e8")),B={all:["admin-overview"],range:n=>[...B.all,n]};function kt(n=7){return D({queryKey:B.range(n),queryFn:()=>Nt({data:{rangeDays:n}})})}const Ct=new Intl.NumberFormat("en-US");function a(n){return Ct.format(n)}function Tt(n){const t=a(Math.abs(n));return n>0?`+${t}`:n<0?`-${t}`:t}function w({title:n,value:t,detail:p}){return e.jsxs(_,{children:[e.jsxs(u,{className:"pb-2",children:[e.jsx(v,{children:n}),e.jsx(m,{className:"text-2xl tabular-nums",children:t})]}),e.jsx(x,{className:"text-muted-foreground text-sm",children:p})]})}function d({label:n,value:t}){return e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsx("span",{className:"text-muted-foreground text-sm",children:n}),e.jsx("span",{className:"font-medium tabular-nums text-sm",children:t})]})}function S({label:n}){return e.jsx("div",{className:"rounded-md border border-dashed px-3 py-6 text-center text-muted-foreground text-sm",children:n})}function Rt({extraMetrics:n}){const[t,p]=$.useState(7),h=kt(t),i=h.data,g=!!O.payment?.enable;return e.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-semibold text-2xl",children:E()}),e.jsx("p",{className:"mt-1 text-muted-foreground text-sm",children:Y()})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{size:"sm",variant:t===7?"default":"outline",onClick:()=>p(7),children:Ne()}),e.jsx(b,{size:"sm",variant:t===30?"default":"outline",onClick:()=>p(30),children:fe()})]})]}),h.isLoading?e.jsx("div",{className:"rounded-lg border p-8 text-center text-muted-foreground",children:ne()}):h.isError||!i?e.jsx("div",{className:"rounded-lg border border-destructive/40 p-8 text-center text-destructive",children:ee()}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[e.jsx(w,{title:pe(),value:a(i.users.total),detail:he({count:a(i.users.newInRange)})}),e.jsx(w,{title:ue(),value:a(i.tasks.total),detail:ve({count:a(i.tasks.newInRange)})}),e.jsx(w,{title:se(),value:a(i.credits.used),detail:ae()}),g?e.jsx(w,{title:oe(),value:a(i.payments.paid),detail:ce({count:a(i.payments.total)})}):null]}),n,e.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[e.jsxs(_,{children:[e.jsxs(u,{children:[e.jsx(m,{children:lt()}),e.jsx(v,{children:rt()})]}),e.jsx(x,{children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:i.tasks.byStatus.length===0?e.jsx(S,{label:it()}):i.tasks.byStatus.map(s=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsx(j,{variant:"outline",children:s.status}),e.jsx("span",{className:"font-medium tabular-nums",children:a(s.count)})]},s.status))})})]}),e.jsxs(_,{children:[e.jsxs(u,{children:[e.jsx(m,{children:Pe()}),e.jsx(v,{children:Oe()})]}),e.jsxs(x,{className:"grid gap-2",children:[e.jsx(d,{label:dt(),value:a(i.users.admins)}),e.jsx(d,{label:_t(),value:a(i.users.banned)}),e.jsx(d,{label:wt(),value:a(i.files.total)}
1),e.jsx(d,{label:xt(),value:I(i.files.size)}),e.jsx(d,{label:mt(),value:a(i.content.blogPosts)}),e.jsx(d,{label:jt(),value:a(i.content.footerLinksEnabled)}),g?e.jsx(d,{label:ge({count:a(i.payments.paidInRange)}),value:a(i.payments.paidInRange)}):null]})]})]}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[1.4fr_1fr]",children:[e.jsxs(_,{children:[e.jsxs(u,{className:"flex flex-row items-center justify-between gap-2 space-y-0",children:[e.jsxs("div",{children:[e.jsx(m,{children:Se()}),e.jsx(v,{children:Ce()})]}),e.jsx("a",{href:f.AdminActivity,className:y(N({size:"sm",variant:"outline"})),children:bt()})]}),e.jsx(x,{children:e.jsx("div",{className:"overflow-hidden rounded-lg border",children:e.jsxs(C,{children:[e.jsx(T,{children:e.jsxs(c,{children:[e.jsx(o,{children:Ze()}),e.jsx(o,{children:tt()}),e.jsx(o,{children:Xe()}),e.jsx(o,{className:"text-right",children:qe()}),e.jsx(o,{className:"text-right",children:A()})]})}),e.jsx(R,{children:i.tasks.recent.length===0?e.jsx(c,{children:e.jsx(l,{colSpan:5,className:"h-24 text-center text-muted-foreground",children:Re()})}):i.tasks.recent.map(s=>e.jsxs(c,{children:[e.jsxs(l,{children:[e.jsx("div",{className:"font-medium text-sm",children:s.title??s.type}),e.jsx("div",{className:"text-muted-foreground text-xs",children:s.provider})]}),e.jsxs(l,{children:[e.jsx("div",{className:"text-sm",children:s.userName??"-"}),e.jsx("div",{className:"text-muted-foreground text-xs",children:s.userEmail??s.userId})]}),e.jsx(l,{children:e.jsx(j,{variant:"outline",children:s.status})}),e.jsx(l,{className:"text-right tabular-nums",children:a(s.creditsUsed)}),e.jsx(l,{className:"text-right text-muted-foreground",children:k(s.createdAt)})]},s.id))})]})})})]}),e.jsxs(_,{children:[e.jsxs(u,{children:[e.jsx(m,{children:G()}),e.jsx(v,{children:M()})]}),e.jsx(x,{className:"flex flex-col gap-3",children:i.credits.byType.length===0?e.jsx(S,{label:V()}):i.credits.byType.map(s=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:s.type}),e.jsx("div",{className:"text-muted-foreground text-xs",children:W({count:a(s.count)})})]}),e.jsx("div",{className:"font-medium tabular-nums",children:Tt(s.total)})]},s.type))})]})]}),e.jsxs(_,{children:[e.jsxs(u,{className:"flex flex-row items-center justify-between gap-2 space-y-0",children:[e.jsxs("div",{children:[e.jsx(m,{children:$e()}),e.jsx(v,{children:Be()})]}),e.jsx("a",{href:f.AdminUsers,className:y(N({size:"sm",variant:"outline"})),children:yt()})]}),e.jsx(x,{children:e.jsx("div",{className:"overflow-hidden rounded-lg border",children:e.jsxs(C,{children:[e.jsx(T,{children:e.jsxs(c,{children:[e.jsx(o,{children:Ke()}),e.jsx(o,{children:Qe()}),e.jsx(o,{children:Je()}),e.jsx(o,{className:"text-right",children:A()})]})}),e.jsx(R,{children:i.users.recent.length===0?e.jsx(c,{children:e.jsx(l,{colSpan:4,className:"h-24 text-center text-muted-foreground",children:Le()})}):i.users.recent.map(s=>e.jsxs(c,{children:[e.jsx(l,{className:"font-medium",children:s.name}),e.jsx(l,{children:s.email}),e.jsx(l,{children:e.jsx(j,{variant:"outline",children:s.role??"user"})}),e.jsx(l,{className:"text-right text-muted-foreground",children:k(s.createdAt)})]},s.id))})]})})})]})]})]})}function $t(){return e.jsxs(e.Fragment,{children:[e.jsx(P,{breadcrumbs:[{label:H(),isCurrentPage:!1},{label:E(),isCurrentPage:!0}]}),e.jsx(Rt,{})]})}export{$t as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.