1import{d as t,j as s,h as xs,B as hs,U as A,D as js,G as q,y as gs,x as ps}from"./index-BDkIXZro.js";import{r as l}from"./vendor-DaxRCwWg.js";import{q as y,x as d,t as C,w as H,l as n,m as c}from"./firebase-Cv3R1fLt.js";import{D as J,C as S}from"./DropdownMenu-r0Y_tSjS.js";import{C as w}from"./clock-bFAjWYID.js";import{U as K}from"./user-check-2JwcnQiS.js";import{D as us,P as Ns}from"./play-square-uqj0nr_n.js";import"./i18n-ZJY9W6Px.js";function Rs(){const[o,Y]=l.useState({total:0,active24h:0,verified:0,withKYC:0}),[r,L]=l.useState({totalMined:0,activeMiners:0,averageRate:0,totalSessions:0}),[e,V]=l.useState({freSlots:{totalSpins:0,totalPayouts:0,jackpotHits:0,currentJackpot:0},slots:{totalSpins:0,totalPayouts:0,jackpotHits:0},towers:{totalGames:0,totalPayouts:0,maxWin:0},keno:{totalGames:0,totalPayouts:0,maxWin:0},hilo:{totalGames:0,totalPayouts:0,maxStreak:0}}),[m,I]=l.useState({totalWithdrawals:0,pendingWithdrawals:0,totalAmount:0,averageAmount:0}),[Q,k]=l.useState(!0),[P,R]=l.useState(null);l.useEffect(()=>{B()},[]);const B=async()=>{try{k(!0),R(null);const j=y(t,"users"),x=await d(j),g=x.size,O=new Date,X=new Date(O.getTime()-24*60*60*1e3),z=y(t,"mining_sessions"),Z=C(z,H("active","==",!0)),$=await d(Z),p=new Set;$.forEach(a=>{const i=a.data();new Date(i.startTime)>X&&p.add(i.userId)});const ss=x.docs.filter(a=>a.data().emailVerified).length,es=x.docs.filter(a=>a.data().kycStatus==="approved").length;Y({total:g,active24h:p.size,verified:ss,withKYC:es});const F=x.docs.reduce((a,i)=>a+(i.data().totalMined||0),0),as=await d(z);L({totalMined:F,activeMiners:p.size,averageRate:g>0?F/g:0,totalSessions:as.size});const ts=n(t,"slot_machine_stats","fre_slot"),E=await c(ts),u=E.exists()?E.data():null,ls=n(t,"slot_jackpot","current"),M=await c(ls),is=M.exists()?M.data().amount:5e3,ns=n(t,"slot_machine_stats","free_slot"),T=await c(ns),N=T.exists()?T.data():null,cs=n(t,"game_stats","tower_stats"),D=await c(cs),f=D.exists()?D.data():null,ds=n(t,"game_stats","keno_stats"),G=await c(ds),v=G.exists()?G.data():null,os=n(t,"game_stats","hilo_stats"),W=await c(os),b=W.exists()?W.data():null;V({freSlots:{totalSpins:u?.totalSpins||0,totalPayouts:u?.totalPayouts||0,jackpotHits:u?.jackpotHits||0,currentJackpot:is},slots:{totalSpins:N?.totalSpins||0,totalPayouts:N?.totalPayouts||0,jackpotHits:N?.jackpotHits||0},towers:{totalGames:f?.totalGames||0,totalPayouts:f?.totalPayouts||0,maxWin:f?.maxPayout||0},keno:{totalGames:v?.totalGames||0,totalPayouts:v?.totalPayouts||0,maxWin:v?.maxPayout||0},hilo:{totalGames:b?.totalGames||0,totalPayouts:b?.totalPayouts||0,maxStreak:b?.maxStreak||0}});const _=y(t,"withdrawals"),h=await d(_),rs=C(_,H("status","==","pending")),ms=await d(rs),U=h.docs.reduce((a,i)=>a+i.data().amount,0);I({totalWithdrawals:h.size,pendingWithdrawals:ms.size,totalAmount:U,averageAmount:h.size>0?U/h.size:0})}catch(j){console.error("Error loading stats:",j),R("Une erreur est survenue lors du chargement des statistiques")}finally{k(!1)}};return Q?s.jsx("div",{className:"p-4",children:s.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[s.jsx("div",{className:"flex items-center justify-between mb-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{}),s.jsx("h2",{className:"text-lg font-semibold",children:"Statistiques"})]})}),s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(xs,{size:32,className:"animate-spin text-blue-500"})})]})}):s.jsx("div",{className:"p-4",children:s.jsxs("div",{className:"bg-gray-800 rounded-lg p-4",children:[s.jsx("div",{className:"flex items-center justify-between mb-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{}),s.jsx("h2",{className:"text-lg font-semibold",children:"Statistiques"})]})}),P&&s.jsxs("div",{className:"bg-red-500/10 border border-red-500 rounded-lg p-4 mb-6 flex items-start gap-3",children:[s.jsx(hs,{size:24,className:"text-red-500 flex-shrink-0"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-medium text-red-500",children:"Erreur"}),s.jsx("p",{className:"text-sm text-red-400",children:P})]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Statistiques Utilisateurs"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-500/20",children:s.jsx(A,{size:20,className:"text-blue-500"})}),s.jsx("h4",{className:"font-medium",children:"Total Utilisateurs"})]}),s.jsx("p",{className:"text-2xl font-semibold",children:o.total})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-green-500/20",children:s.jsx(w,{size:20,className:"text-green-500"})}),s.jsx("h4",{className:"font-medium",children:"Actifs (24h)"})]}),s.jsx("p",{className:"text-2xl font-semibold",children:o.active24h})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-yellow-500/20",children:s.jsx(K,{size:20,className:"text-yellow-500"})}),s.jsx("h4",{className:"font-medium",children:"Vérifiés"})]}),s.jsx("p",{className:"text-2xl font-semibold",children:o.verified})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-purple-500/20",children:s.jsx(K,{size:20,className:"text-purple-500"})}),s.jsx("h4",{className:"font-medium",children:"KYC Validés"})]}),s.jsx("p",{className:"text-2xl font-semibold",children:o.withKYC})]})]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Statistiques Minage"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-green-500/20",children:s.jsx(js,{size:20,className:"text-green-500"})}),s.jsx("h4",{className:"font-medium",children:"Total Miné"})]}),s.jsxs("p",{className:"text-2xl font-semibold font-mono",children:[r.totalMined.toFixed(2)," FRE"]})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-500/20",children:s.jsx(A,{size:20,className:"text-blue-500"})}),s.jsx("h4",{className:"font-medium",children:"Mineurs Actifs"})]}),s.jsx("p",{className:"text-2xl font-semibold",children:r.activeMiners})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-yellow-500/20",children:s.jsx(S,{size:20,className:"text-yellow-500"})}),s.jsx("h4",{className:"font-medium",children:"Moyenne/Utilisateur"})]}),s.jsxs("p",{className:"text-2xl font-semibold font-mono",children:[r.averageRate.toFixed(2)," FRE"]})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-purple-500/20",children:s.jsx(w,{size:20,className:"text-purple-500"})}),s.jsx("h4",{className:"font-medium",children:"Total Sessions"})]}),s.jsx("p",{className:"text-2xl font-semibold",children:r.totalSessions})]})]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Statistiques Jeux"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"p-2 rounded-lg bg-green-500/20",children:s.jsx(q,{size:20,className:"text-green-500"})}),s.jsx("h4",{className:"font-medium",children:"Machine à FRE"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Spins"}),s.jsx("span",{children:e.freSlots.totalSpins})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Payé"}),s.jsxs("span",{className:"font-mono",children:[e.freSlots.totalPayouts.toFixed(2)," FRE"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Jackpots"}),s.jsx("span",{children:e.freSlots.jackpotHits})]}),s.jsxs("div",{className:"flex justify-between text-yellow-500",children:[s.jsx("span",{children:"Jackpot Actuel"}),s.jsxs("span",{className:"font-mono",children:[e.freSlots.currentJackpot.toFixed(2)," FRE"]})]})]})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"p-2 rounded-lg bg-yellow-500/20",children:s.jsx(q,{size:20,className:"text-yellow-500"})}),s.jsx("h4",{className:"font-medium",children:"Machine à Sous"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Spins"}),s.jsx("span",{children:e.slots.totalSpins})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Payé"}),s.jsxs("span",{className:"font-mono",children:[e.slots.totalPayouts.toFixed(2)," FRE"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Jackpots"}),s.jsx("span",{children:e.slots.jackpotHits})]})]})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-500/20",children:s.jsx(gs,{size:20,className:"text-blue-500"})}),s.jsx("h4",{className:"font-medium",children:"Towers"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Parties"}),s.jsx("span",{children:e.towers.totalGames})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Payé"}),s.jsxs("span",{className:"font-mono",children:[e.towers.totalPayouts.toFixed(2)," FRE"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Gain Max"}),s.jsxs("span",{className:"font-mono",children:[e.towers.maxWin.toFixed(2)," FRE"]})]})]})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"p-2 rounded-lg bg-purple-500/20",children:s.jsx(us,{size:20,className:"text-purple-500"})}),s.jsx("h4",{className:"font-medium",children:"Keno"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Parties"}),s.jsx("span",{children:e.keno.totalGames})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Payé"}),s.jsxs("span",{className:"font-mono",children:[e.keno.totalPayouts.toFixed(2)," FRE"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Gain Max"}),s.jsxs("span",{className:"font-mono",children:[e.keno.maxWin.toFixed(2)," FRE"]})]})]})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"p-2 rounded-lg bg-green-500/20",children:s.jsx(Ns,{size:20,className:"text-green-500"})}),s.jsx("h4",{className:"font-medium",children:"Hi-Lo"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Parties"}),s.jsx("span",{children:e.hilo.totalGames})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Total Payé"}),s.jsxs("span",{className:"font-mono",children:[e.hilo.totalPayouts.toFixed(2)," FRE"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-gray-400",children:"Série Max"}),s.jsxs("span",{children:[e.hilo.maxStreak,"x"]})]})]})]})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Statistiques Retraits"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-500/20",children:s.jsx(ps,{size:20,className:"text-blue-500"})}),s.jsx("h4",{className:"font-medium",children:"Total Retraits"})]}),s.jsx("p",{className:"text-2xl font-semibold",children:m.totalWithdrawals})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-yellow-500/20",children:s.jsx(w,{size:20,className:"text-yellow-500"})}),s.jsx("h4",{className:"font-medium",children:"En Attente"})]}),s.jsx("p",{className:"text-2xl font-semibold",children:m.pendingWithdrawals})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-green-500/20",children:s.jsx(S,{size:20,className:"text-green-500"})}),s.jsx("h4",{className:"font-medium",children:"Montant Total"})]}),s.jsxs("p",{className:"text-2xl font-semibold font-mono",children:[m.totalAmount.toFixed(2)," FRE"]})]}),s.jsxs("div",{className:"bg-gray-700 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-purple-500/20",children:s.jsx(S,{size:20,className:"text-purple-500"})}),s.jsx("h4",{className:"font-medium",children:"Moyenne"})]}),s.jsxs("p",{className:"text-2xl font-semibold font-mono",children:[m.averageAmou
1nt.toFixed(2)," FRE"]})]})]})]})]})})}export{Rs as AdminStats};
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.