1var h=(a,i,l)=>new Promise((d,n)=>{var s=r=>{try{t(l.next(r))}catch(c){n(c)}},o=r=>{try{t(l.throw(r))}catch(c){n(c)}},t=r=>r.done?d(r.value):Promise.resolve(r.value).then(s,o);t((l=l.apply(a,i)).next())});import{j as e,r as x}from"./react-vendor-BaX8wFxW.js";import{i as j,u as N,am as f}from"./index-CLYH3Hla.js";import{U as v,A as k}from"./ActivityBarChart-Z8afVif8.js";import{R as w,P as y,l as _,k as C,T as S,m as D}from"./charts-vendor-BEN4kyo5.js";import{A as g,p as R,q as m,T as A,c2 as p,aw as L}from"./icons-hi2-zdK1GiMw.js";import"./data-vendor-B9G6AmzB.js";import"./motion-vendor-C9lJIqxK.js";import"./icons-other-B4wTEEQh.js";const T=["#3b82f6","#ef4444","#10b981","#f59e0b"],u=({data:a,colors:i=T,title:l})=>e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center",children:[l&&e.jsx("h3",{className:"tex-lg font-semibold mb-2",children:l}),e.jsx(w,{width:"100%",height:250,children:e.jsxs(y,{children:[e.jsx(_,{data:a,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:a.map((d,n)=>e.jsx(C,{fill:i[n%i.length]},`cell-${n}`))}),e.jsx(S,{formatter:d=>[d,"Quantity"],labelFormatter:d=>`Cards: ${d}`,contentStyle:{backgroundColor:"#1f2937",border:"none",color:"#fff"}}),e.jsx(D,{verticalAlign:"bottom",height:36})]})})]}),G=()=>{const[a,i]=x.useState(null),[l,d]=x.useState(!0),{showToast:n}=j(),{t:s}=N(),o=x.useCallback(()=>h(null,null,function*(){try{d(!0);const t=yield f.getReports();i(t)}catch(t){n(s("admin.reports_load_error"),"error")}finally{d(!1)}}),[n,s]);return x.useEffect(()=>{o()},[o]),l?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})}):a?e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-3 bg-orange-100 dark:bg-orange-900/20 rounded-xl",children:e.jsx(g,{className:"w-6 h-6 text-orange-600 dark:text-orange-400"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"typo-title-lg text-primary",children:s("admin.reports_title")}),e.jsx("p",{className:"text-muted mt-1",children:s("admin.reports_subtitle")})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:[e.jsx(b,{title:s("admin.reports_new_users_7d"),value:a.stats.usersLast7Days,icon:e.jsx(R,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"}),bgIcon:"bg-blue-100 dark:bg-blue-900/20"}),e.jsx(b,{title:s("admin.reports_new_sets_7d"),value:a.stats.setsLast7Days,icon:e.jsx(m,{className:"w-6 h-6 text-purple-600 dark:text-purple-400"}),bgIcon:"bg-purple-100 dark:bg-purple-900/20"}),e.jsx(b,{title:s("admin.reports_public_sets"),value:a.stats.publicSets,icon:e.jsx(m,{className:"w-6 h-6 text-green-600 dark:text-green-400"}),bgIcon:"bg-green-100 dark:bg-green-900/20"}),e.jsx(b,{title:s("admin.reports_private_sets"),value:a.stats.privateSets,icon:e.jsx(m,{className:"w-6 h-6 text-muted"}),bgIcon:"bg-slate-100 dark:bg-slate-700"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8",children:[e.jsxs("div",{className:"lg:col-span-2 bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-slate-900 dark:text-white mb-6 flex items-center gap-2",children:[e.jsx(g,{className:"w-5 h-5 text-blue-500"}),s("admin.reports_user_growth_30d")]}),e.jsx("div",{className:"h-[300px]",children:e.jsx(v,{data:a.userGrowthData})})]}),e.jsxs("div",{className:"lg:col-span-1 bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-slate-900 dark:text-white mb-6 flex items-center gap-2",children:[e.jsx(A,{className:"w-5 h-5 text-orange-500"}),s("admin.reports_recent_activity")]}),e.jsx("div",{className:"h-[300px]",children:e.jsx(k,{data:a.dailyActivity||[]})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-8",children:[e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-slate-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(p,{className:"w-5 h-5 text-teal-500"}),s("admin.reports_user_status")]}),e.jsx("div",{className:"h-[250px]",children:e.jsx(u,{data:a.userStatusDistribution||[],colors:["#10b981","#ef4444","#94a3b8"]})})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-slate-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(p,{className:"w-5 h-5 text-indigo-500"}),s("admin.reports_set_distribution")]}),e.jsx("div",{className:"h-[250px]",children:e.jsx(u,{data:a.setDistribution||[],colors:["#3b82f6","#9ca3af"]})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsx(L,{className:"w-6 h-6 text-yellow-500"}),e.jsx("h2",{className:"text-xl font-bold text-slate-900 dark:text-white",children:s("admin.reports_top_contributors")})]}),e.jsx("div",{className:"space-y-4",children:a.topUsersBySets.map((t,r)=>e.jsxs("div",{className:"flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-700/50 rounded-lg hover:bg-slate-100 dar
1k:hover:bg-slate-700 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex items-center justify-center w-8 h-8 rounded-full typo-label flex-shrink-0 ${r===0?"bg-yellow-100 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 ring-2 ring-yellow-400/50":r===1?"bg-slate-200 dark:bg-slate-600 text-slate-700 dark:text-slate-300 ring-2 ring-slate-400/50":r===2?"bg-amber-100 dark:bg-amber-900/20 text-amber-600 dark:text-amber-400 ring-2 ring-amber-400/50":"bg-slate-100 dark:bg-slate-700 text-muted"}`,children:r+1}),e.jsxs("div",{children:[e.jsxs("div",{className:"typo-nav text-primary flex items-center gap-2",children:[t.displayName,t.role==="admin"&&e.jsx("span",{className:"typo-badge px-1.5 py-0.5 rounded bg-purple-100 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400 uppercase",children:s("admin.reports_admin_role")})]}),e.jsxs("div",{className:"text-sm text-muted",children:["@",t.username]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"font-semibold text-slate-900 dark:text-white",children:s("admin.reports_set_count",{count:t.setCount})}),e.jsx("div",{className:"text-sm text-muted",children:s("admin.reports_card_count",{count:t.totalCards})})]})]},t._id))})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsx(m,{className:"w-6 h-6 text-purple-500"}),e.jsx("h2",{className:"text-xl font-bold text-slate-900 dark:text-white",children:s("admin.reports_top_sets")})]}),e.jsx("div",{className:"space-y-4",children:a.topSetsByCards.map((t,r)=>{var c;return e.jsxs("div",{className:"flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-700/50 rounded-lg hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:`flex items-center justify-center w-8 h-8 rounded-full font-bold text-sm flex-shrink-0 ${r===0?"bg-yellow-100 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 ring-2 ring-yellow-400/50":r===1?"bg-slate-200 dark:bg-slate-600 text-slate-700 dark:text-slate-300 ring-2 ring-slate-400/50":r===2?"bg-amber-100 dark:bg-amber-900/20 text-amber-600 dark:text-amber-400 ring-2 ring-amber-400/50":"bg-slate-100 dark:bg-slate-700 text-muted"}`,children:r+1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium text-slate-900 dark:text-white truncate",children:t.title}),e.jsx("div",{className:"text-sm text-muted",children:((c=t.creator)==null?void 0:c.displayName)||e.jsx("span",{className:"italic opacity-50",children:s("admin.reports_unknown")})})]})]}),e.jsxs("div",{className:"text-right flex-shrink-0 ml-2",children:[e.jsx("div",{className:"font-semibold text-slate-900 dark:text-white",children:s("admin.reports_card_count",{count:t.cardCount})}),e.jsx("div",{className:`text-xs ${t.isPublic?"text-green-600 dark:text-green-400":"text-muted"}`,children:t.isPublic?s("admin.reports_public"):s("admin.reports_private")})]})]},t._id)})})]})]})]}):e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:e.jsx("p",{className:"text-center text-muted",children:s("admin.reports_no_data")})})},b=({title:a,value:i,icon:l,bgIcon:d})=>e.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-6 hover:shadow-lg transition-shadow",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted",children:a}),e.jsx("p",{className:"typo-metric-md text-primary mt-1",children:i})]}),e.jsx("div",{className:`p-3 rounded-lg ${d}`,children:l})]})});export{G as default};
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.