1import{j as e}from"./vendor-query-vWFYep2x.js";import{u as h,r as d}from"./vendor-router-ChBioB4i.js";import{d as x}from"./index-C0Hc7JXq.js";import"./vendor-react-LI-sLqvG.js";import"./vendor-motion-CyE-KEXQ.js";function N(){const[,i]=h(),[s,r]=d.useState(null),[l,m]=d.useState(null);if(d.useEffect(()=>{const t=()=>{x("/api/admin/analytics/summary").then(r).catch(()=>i("/admin/login")),x("/api/admin/analytics/funnel").then(m).catch(()=>{})};t();const c=setInterval(t,3e4);return()=>clearInterval(c)},[]),!s)return e.jsx("div",{className:"p-6 text-center text-pink-600",children:"Ø¬Ø§Ø±Ù Ø§ÙØªØÙ
ÙÙ..."});const n=s.totals||{},p=["bg-pink-500","bg-pink-500","bg-pink-500","bg-pink-500"];return e.jsxs("div",{className:"min-h-[100dvh] pb-20",children:[e.jsxs("div",{className:"px-4 py-4 flex items-center justify-between",children:[e.jsx("h1",{className:"text-lg font-bold text-pink-700",children:"ð Ø§ÙØªØÙÙÙØ§Øª"}),e.jsx("button",{onClick:()=>i("/admin"),className:"text-pink-500 text-sm",children:"Ø±Ø¬ÙØ¹"})]}),e.jsxs("div",{className:"px-4 grid grid-cols-2 gap-3",children:[e.jsx(a,{label:"Ø£ØØ¯Ø§Ø« 24س",value:n.events_24h,color:"from-pink-400 to-pink-600"}),e.jsx(a,{label:"Ø¬ÙØ³Ø§Øª 24س",value:n.sessions_24h,color:"from-pink-400 to-pink-600"}),e.jsx(a,{label:"Ù
ستخدÙ
Ù٠جدد",value:n.new_users_24h,
1color:"from-pink-400 to-pink-600"}),e.jsx(a,{label:"Ø·ÙØ¨Ø§Øª 24س",value:n.orders_24h,color:"from-rose-400 to-rose-600"}),e.jsx(a,{label:"Ø¥ÙØ±Ø§Ø¯Ø§Øª 24س",value:`${Number(n.revenue_24h||0).toFixed(2)}$`,color:"from-pink-500 to-pink-500"}),e.jsx(a,{label:"Ø·ÙØ¨Ø§Øª Ù
عÙÙØ©",value:n.pending_orders,color:"from-yellow-400 to-orange-500"}),e.jsx(a,{label:"Ø¥ÙØ¯Ø§Ø¹Ø§Øª Ù
عÙÙØ©",value:n.pending_deposits,color:"from-blue-400 to-cyan-500"}),e.jsx(a,{label:"ØªØ°Ø§ÙØ± Ù
ÙØªÙØØ©",value:n.open_tickets,color:"from-green-400 to-emerald-500"})]}),l&&e.jsxs("div",{className:"mx-4 mt-4 bg-white dark:bg-zinc-900 rounded-2xl p-4",children:[e.jsx("h3",{className:"font-bold text-pink-700 mb-3",children:"ÙÙ
ع Ø§ÙØªØÙÙÙ (آخر 7 Ø£ÙØ§Ù
)"}),e.jsx(o,{label:"Ø²ÙØ§Ø± Ø§ÙØµÙØØ© Ø§ÙØ±Ø¦ÙØ³ÙØ©",v:l.visitors,max:l.visitors}),e.jsx(o,{label:"Ø´Ø§ÙØ¯Ùا Ù
ÙØªØ¬Ø§Ù",v:l.product_views,max:l.visitors}),e.jsx(o,{label:"أضاÙÙØ§ ÙÙØ³ÙØ©",v:l.users_with_cart,max:l.visitors}),e.jsx(o,{label:"Ø£ÙÙ
ÙÙØ§ Ø§ÙØ´Ø±Ø§Ø¡",v:l.buyers,max:l.visitors})]}),!!s.eventsByType?.length&&e.jsxs("div",{className:"mx-4 mt-4 bg-white dark:bg-zinc-900 rounded-2xl p-4",children:[e.jsx("h3",{className:"font-bold text-pink-700 mb-3",children:"Ø£ÙÙØ§Ø¹ Ø§ÙØ£ØØ¯Ø§Ø« Ø§ÙØ£Ùثر Ø´ÙÙØ¹Ø§Ù"}),e.jsx("div",{className:"space-y-1.5",children:s.eventsByType.map((t,c)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-32 truncate",children:t.type}),e.jsx("div",{className:"flex-1 h-5 bg-white dark:bg-zinc-800 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full ${p[c%4]}`,style:{width:`${t.count/s.eventsByType[0].count*100}%`}})}),e.jsx("span",{className:"font-bold w-10 text-left",children:t.count})]},t.type))})]}),!!s.topProducts?.length&&e.jsxs("div",{className:"mx-4 mt-4 bg-white dark:bg-zinc-900 rounded-2xl p-4",children:[e.jsx("h3",{className:"font-bold text-pink-700 mb-3",children:"Ø£ÙØ«Ø± اÙÙ
ÙØªØ¬Ø§Øª Ù
Ø´Ø§ÙØ¯Ø©"}),e.jsx("div",{className:"space-y-1.5",children:s.topProducts.map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"flex-1 truncate",children:t.name}),e.jsxs("span",{className:"text-pink-600 font-bold",children:[t.views||0," ð"]}),e.jsxs("span",{className:"text-zinc-400",children:[t.sales_count||0," ð"]})]},t.id))})]})]})}function a({label:i,value:s,color:r}){return e.jsxs("div",{className:`rounded-2xl p-3 bg-gradient-to-br ${r} text-white`,children:[e.jsx("div",{className:"text-xs opacity-90",children:i}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:s??0})]})}function o({label:i,v:s,max:r}){const l=r>0?s/r*100:0;return e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[e.jsx("span",{children:i}),e.jsx("span",{className:"font-bold",children:s??0})]}),e.jsx("div",{className:"h-3 bg-white dark:bg-zinc-800 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-pink-500 to-pink-500",style:{width:`${l}%`}})})]})}export{N 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.