(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3],{64942:function(e,t,s){Promise.resolve().then(s.bind(s,42282))},87461:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});var r=s(64090),l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),a=(e,t)=>{let s=(0,r.forwardRef)((s,a)=>{let{color:i="currentColor",size:c=24,strokeWidth:o=2,absoluteStrokeWidth:d,className:u="",children:x,...h}=s;return(0,r.createElement)("svg",{ref:a,...l,width:c,height:c,stroke:i,strokeWidth:d?24*Number(o)/Number(c):o,className:["lucide","lucide-".concat(n(e)),u].join(" "),...h},[...t.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(x)?x:[x]])});return s.displayName="".concat(e),s}},37841:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},63013:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]])},13716:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("MousePointerClick",[["path",{d:"m9 9 5 12 1.8-5.2L21 14Z",key:"1b76lo"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}]])},90043:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]])},73354:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]])},85497:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]])},34059:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(87461).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},24232:function(e,t,s){"use strict";s.d(t,{default:function(){return l.a}});var r=s(24930),l=s.n(r)},24930:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}});let r=s(86921);s(3827),s(64090);let l=r._(s(84795));function n(e,t){let s={loading:e=>{let{error:t,isLoading:s,pastDelay:r}=e;return null}};return"function"==typeof e&&(s.loader=e),(0,l.default)({...s,...t})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},19721:function(e,t,s){"use strict";function r(e){let{reason:t,children:s}=e;return s}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return r}}),s(99775)},84795:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return c}});let r=s(3827),l=s(64090),n=s(19721);function a(e){var t;return{default:null!=(t=null==e?void 0:e.default)?t:e}}let i={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},c=function(e){let t={...i,...e},s=(0,l.lazy)(()=>t.loader().then(a)),c=t.loading;function o(e){let a=c?(0,r.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,i=t.ssr?(0,r.jsx)(s,{...e}):(0,r.jsx)(n.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(s,{...e})});return(0,r.jsx)(l.Suspense,{fallback:a,children:i})}return o.displayName="LoadableComponent",o}},42282:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return N}});var r=s(3827),l=s(24232),n=s(89966),a=s(71774),i=s(90043),c=s(63013),o=s(73354),d=s(87461);/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let u=(0,d.Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]),x=(0,d.Z)("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);var h=s(37841),m=s(34059),p=s(85497),g=s(13716);let f=(0,l.default)(()=>Promise.all([s.e(8620),s.e(6767),s.e(4460),s.e(7659)]).then(s.bind(s,97659)),{loadableGenerated:{webpack:()=>[97659]},ssr:!1,loading:()=>(0,r.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[1,2,3].map(e=>(0,r.jsx)("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-xl p-6 h-80 animate-pulse"},e))})}),y={FREE:"#94a3b8",PRO:"#3b82f6",BUSINESS:"#8b5cf6"},b={mobile:i.Z,desktop:c.Z,tablet:o.Z},v={mobile:"#f59e0b",desktop:"#3b82f6",tablet:"#10b981",unknown:"#6b7280"};function w(e){let{value:t,isAr:s}=e;if(0===t)return(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"—"});let l=t>0;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium ".concat(l?"text-green-400":"text-red-400"),children:[(0,r.jsx)(l?u:x,{className:"h-3 w-3"}),l?"+":"",t,"%"]})}let j={contentStyle:{backgroundColor:"#1a1a2e",border:"1px solid rgba(255,255,255,0.06)",borderRadius:"8px",color:"#e5e7eb"},labelStyle:{color:"#9ca3af"}};function N(){let{lang:e}=(0,a.Z)(),t="ar"===e,{data:s,isLoading:l}=(0,n.ZP)("/api/admin/stats");if(l||!s)return(0,r.jsx)("div",{className:"flex justify-center py-20",children:(0,r.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-gray-500 border-t-transparent"})});let i=[{label:t?"المشاهدات":"Views",value:s.totalViews,icon:h.Z,color:"text-blue-400",bg:"bg-blue-500/10",growth:s.growth.views},{label:t?"المستخدمون":"Users",value:s.totalUsers,icon:m.Z,color:"text-green-400",bg:"bg-green-500/10",growth:s.growth.users},{label:t?"العملاء المحتملون":"Leads",value:s.totalLeads,icon:p.Z,color:"text-purple-400",bg:"bg-purple-500/10",growth:s.growth.leads},{label:t?"معدل التحويل":"Conversion",value:"".concat(s.conversionRate,"%"),icon:g.Z,color:"text-orange-400",bg:"bg-orange-500/10",growth:null}],o=s.deviceBreakdown.map(e=>({...e,device:e.device||"unknown"})),d=o.reduce((e,t)=>e+t.count,0);return(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-bold mb-1 text-white",children:t?"لوحة القيادة":"Dashboard"}),(0,r.jsx)("p",{className:"text-gray-400 mb-6",children:t?"نظرة عامة على النظام":"System overview"}),(0,r.jsx)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:i.map(e=>{let s=e.icon;return(0,r.jsxs)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] p-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("div",{className:"p-2 rounded-lg ".concat(e.bg),children:(0,r.jsx)(s,{className:"h-5 w-5 ".concat(e.color)})}),null!==e.growth&&(0,r.jsx)(w,{value:e.growth,isAr:t})]}),(0,r.jsx)("div",{className:"text-3xl font-bold text-white",children:"number"==typeof e.value?e.value.toLocaleString():e.value}),(0,r.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:e.label})]},e.label)})}),(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(f,{stats:{dailyViews:s.dailyViews,dailyRegistrations:s.dailyRegistrations,planDistribution:s.planDistribution},isAr:t,planColors:y,tooltipStyle:j})}),(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6",children:[(0,r.jsxs)("div",{className:"lg:col-span-2 rounded-2xl border border-white/[0.06] bg-white/[0.03] p-6",children:[(0,r.jsx)("h3",{className:"text-base font-semibold text-white mb-4",children:t?"أفضل الصفحات أداءً":"Top Performing Pages"}),0===s.topPages.length?(0,r.jsx)("p",{className:"text-gray-500 text-sm py-8 text-center",children:t?"لا توجد صفحات بعد":"No pages yet"}):(0,r.jsx)("div",{className:"space-y-3",children:s.topPages.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-xl bg-white/[0.02] hover:bg-white/[0.04] transition-colors",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-sm font-bold ".concat(0===t?"bg-yellow-500/10 text-yellow-400":1===t?"bg-gray-400/10 text-gray-300":"bg-orange-500/10 text-orange-400"),children:t+1}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-white truncate",children:e.title}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:["/p/",e.slug]})]}),(0,r.jsx)("div",{className:"text-right shrink-0",children:(0,r.jsxs)("div",{className:"flex items-center gap-3 text-xs",children:[(0,r.jsxs)("span",{className:"text-gray-400",children:[(0,r.jsx)(h.Z,{className:"h-3 w-3 inline mr-1"}),e.views]}),(0,r.jsxs)("span",{className:"text-purple-400",children:[(0,r.jsx)(p.Z,{className:"h-3 w-3 inline mr-1"}),e.leads]}),(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded-full ".concat(e.conversionRate>5?"bg-green-500/10 text-green-400":e.conversionRate>0?"bg-yellow-500/10 text-yellow-400":"bg-white/[0.05] text-gray-500"),children:[e.conversionRate,"%"]})]})})]},e.slug))})]}),(0,r.jsxs)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] p-6",children:[(0,r.jsx)("h3",{className:"text-base font-semibold text-white mb-4",children:t?"الأجهزة":"Devices"}),0===o.length?(0,r.jsx)("p",{className:"text-gray-500 text-sm py-8 text-center",children:t?"لا توجد بيانات":"No data"}):(0,r.jsx)("div",{className:"space-y-4",children:o.map(e=>{let t=b[e.device]||c.Z,s=d>0?Math.round(e.count/d*100):0,l=v[e.device]||v.unknown;return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-gray-300",children:[(0,r.jsx)(t,{className:"h-4 w-4",style:{color:l}}),(0,r.jsx)("span",{className:"capitalize",children:e.device})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-gray-500 text-xs",children:e.count.toLocaleString()}),(0,r.jsxs)("span",{className:"text-white font-medium text-sm",children:[s,"%"]})]})]}),(0,r.jsx)("div",{className:"w-full h-1.5 rounded-full bg-white/[0.06]",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:"".concat(s,"%"),backgroundColor:l}})})]},e.device)})})]}),(0,r.jsxs)("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.03] p-6",children:[(0,r.jsx)("h3",{className:"text-base font-semibold text-white mb-4",children:t?"مصادر الزيارات":"Top Referrers"}),0===s.topReferrers.length?(0,r.jsx)("p",{className:"text-gray-500 text-sm py-8 text-center",children:t?"لا توجد بيانات":"No data"}):(0,r.jsx)("div",{className:"space-y-3",children:s.topReferrers.slice(0,6).map((e,t)=>{var l;let n=(null===(l=s.topReferrers[0])||void 0===l?void 0:l.count)||1,a=Math.max(e.count/n*100,8);return(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,r.jsx)("span",{className:"text-gray-300 truncate max-w-[150px]",children:e.referrer||"Direct"}),(0,r.jsx)("span",{className:"text-gray-500 text-xs",children:e.count})]}),(0,r.jsx)("div",{className:"w-full h-1 rounded-full bg-white/[0.06]",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-indigo-500/50",style:{width:"".concat(a,"%")}})})]},t)})})]})]})]})}}},function(e){e.O(0,[9966,1774,2971,8069,1744],function(){return e(e.s=64942)}),_N_E=e.O()}]);