1import{r as M,s as j,j as t,d as ve,B as Se,R as Oe,aH as v,aO as ye,c as Le,U as ke,O as De,f as Ee}from"./index-NwEFhPA0.js";import{A as Re}from"./AdminLayout-BUGuISGX.js";import{B as q}from"./badge-D_YHDHBA.js";import{T as Te,a as Ue,b as se,c as B,d as Ce,e as R}from"./table-BX6naeN4.js";import{B as Be}from"./building-2-4SNP6Ag4.js";import{f as K,L as G,m as Z,i as X,C as re,A as Ie,a as H,b as ue,c as Me,d as me,h as Ve,e as $e,G as ze,g as fe,j as he,k as ne,D as We,u as Fe,l as qe,X as be,Y as ge,n as Ke,R as He,o as Xe,T as Ye}from"./generateCategoricalChart-BQkzxdHr.js";import"./zap-CyU0R1qD.js";import"./log-out-CkU8Vx_b.js";import"./search-DLZpxukn.js";import"./upload-DhyafyxF.js";import"./index-Dh4i1-J3.js";const Ge=()=>{const[e,a]=M.useState([]),[r,s]=M.useState(!0);M.useEffect(()=>{n()},[]);const n=async()=>{try{const o=new Date(Date.now()-6048e5).toISOString(),{data:u,error:l}=await j.from("profiles").select("user_id, full_name, email, account_type, created_at, generation_credits").gte("created_at",o).order("created_at",{ascending:!1});if(l)throw l;if(!u||u.length===0){a([]),s(!1);return}const f=u.map(c=>c.user_id),[m,h]=await Promise.all([j.from("business_plans").select("id, user_id, business_name, is_unlocked, status, created_at").in("user_id",f),j.from("visa_business_plans").select("id, user_id, business_name, is_unlocked, status, created_at, visa_type").in("user_id",f)]);if(m.error)throw m.error;if(h.error)throw h.error;const p={};(m.data||[]).forEach(c=>{p[c.user_id]||(p[c.user_id]=[]),p[c.user_id].push({id:c.id,business_name:c.business_name,is_unlocked:c.is_unlocked,status:c.status,created_at:c.created_at,plan_kind:"standard"})}),(h.data||[]).forEach(c=>{p[c.user_id]||(p[c.user_id]=[]),p[c.user_id].push({id:c.id,business_name:c.business_name,is_unlocked:c.is_unlocked,status:c.status,created_at:c.created_at,plan_kind:"visa",visa_type:c.visa_type})});const g=u.map(c=>({...c,plans:p[c.user_id]||[]}));a(g)}catch(o){console.error("Error fetching recent users:",o)}finally{s(!1)}},i=o=>new Date(o).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),d=o=>{const u=Date.now()-new Date(o).getTime(),l=Math.round(u/6e4);if(l<1)return"just now";if(l<60)return`${l}m ago`;const f=Math.round(l/60);return f<24?`${f}h ago`:`${Math.round(f/24)}d ago`};return r?t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx(ve,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):t.jsxs("div",{className:"bg-card rounded-xl border",children:[t.jsxs("div",{className:"p-6 border-b flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold",children:"Recent Signups (Last 7 days)"}),t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," new user",e.length!==1?"s":""," · times shown in your local timezone"]})]}),t.jsxs(Se,{variant:"outline",size:"sm",onClick:()=>{s(!0),n()},children:[t.jsx(Oe,{className:"w-3.5 h-3.5 mr-2"}),"Refresh"]})]}),t.jsx("div",{className:"overflow-auto max-h-[500px]",children:t.jsxs(Te,{children:[t.jsx(Ue,{children:t.jsxs(se,{children:[t.jsx(B,{children:"Name"}),t.jsx(B,{children:"Email"}),t.jsx(B,{children:"Type"}),t.jsx(B,{children:"Signed Up"}),t.jsx(B,{children:"Plans"}),t.jsx(B,{children:"Status"}),t.jsx(B,{children:"Last Plan"}),t.jsx(B,{children:"Business Name"})]})}),t.jsx(Ce,{children:e.length===0?t.jsx(se,{children:t.jsx(R,{colSpan:8,className:"text-center text-muted-foreground py-8",children:"No signups in the last 7 days"})}):e.map(o=>{const u=o.plans.some(c=>c.is_unlocked),l=o.plans.length,f=o.plans.filter(c=>c.plan_kind==="visa").length,m=o.plans.filter(c=>c.plan_kind==="standard").length,h=o.plans.map(c=>c.business_name).filter(Boolean).join(", "),p=o.plans.length>0?o.plans.sort((c,y)=>new Date(y.created_at).getTime()-new Date(c.created_at).getTime())[0].created_at:null,g=o.account_type?o.account_type:f>0?"visa":"standard";return t.jsxs(se,{children:[t.jsx(R,{className:"font-medium",children:o.full_name||"â"}),t.jsx(R,{className:"text-muted-foreground text-xs",children:o.email||"â"}),t.jsx(R,{children:t.jsx(q,{variant:"outline",className:"capitalize text-xs",children:g})}),t.jsxs(R,{className:"text-xs whitespace-nowrap",children:[t.jsx("div",{children:i(o.created_at)}),t.jsx("div",{className:"text-[10px] text-muted-foreground",children:d(o.created_at)})]}),t.jsx(R,{className:"text-xs",children:l===0?t.jsx("span",{className:"text-muted-foreground",children:"â"}):t.jsxs("div",{className:"flex gap-1 flex-wrap",children:[f>0&&t.jsxs(q,{className:"bg-accent text-accent-foreground text-[10px]",children:[f," Visa"]}),m>0&&t.jsxs(q,{variant:"secondary",className:"text-[10px]",children:[m," Std"]})]})}),t.jsx(R,{children:u?t.jsx(q,{className:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20",children:"Paid"}):l>0?t.jsx(q,{variant:"secondary",children:"Free"}):t.jsx(q,{variant:"outline",className:"text-muted-foreground",children:"No Plan"})}),t.jsx(R,{className:"text-xs whitespace-nowrap",children:p?i(p):"â"}),t.jsx(R,{className:"max-w-[200px] truncate text-sm",children:h||"â"})]}
vendor: 8,420 bytes, line 1
1,o.user_id)})})]})})]})};var Je=["layout","type","stroke","connectNulls","isRange","ref"],Qe=["key"],je;function Y(e){"@babel/helpers - typeof";return Y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Y(e)}function _e(e,a){if(e==null)return{};var r=Ze(e,a),s,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)s=i[n],!(a.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function Ze(e,a){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(a.indexOf(s)>=0)continue;r[s]=e[s]}return r}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},z.apply(this,arguments)}function pe(e,a){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,s)}return r}function I(e){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?pe(Object(r),!0).forEach(function(s){D(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pe(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function et(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function xe(e,a){for(var r=0;r<a.length;r++){var s=a[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Ae(s.key),s)}}function tt(e,a,r){return a&&xe(e.prototype,a),r&&xe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function at(e,a,r){return a=ee(a),st(e,we()?Reflect.construct(a,r||[],ee(e).constructor):a.apply(e,r))}function st(e,a){if(a&&(Y(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rt(e)}function rt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(we=function(){return!!e})()}function ee(e){return ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ee(e)}function nt(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&ie(e,a)}function ie(e,a){return ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,n){return s.__proto__=n,s},ie(e,a)}function D(e,a,r){return a=Ae(a),a in e?Object.defineProperty(e,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[a]=r,e}function Ae(e){var a=it(e,"string");return Y(a)=="symbol"?a:a+""}function it(e,a){if(Y(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,a||"default");if(Y(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(e)}var V=function(e){function a(){var r;et(this,a);for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return r=at(this,a,[].concat(n)),D(r,"state",{isAnimationFinished:!0}),D(r,"id",Fe("recharts-area-")),D(r,"handleAnimationEnd",function(){var d=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),ne(d)&&d()}),D(r,"handleAnimationStart",function(){var d=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),ne(d)&&d()}),r}return nt(a,e),tt(a,[{key:"renderDots",value:function(s,n,i){var d=this.props.isAnimationActive,o=this.state.isAnimationFinished;if(d&&!o)return null;var u=this.props,l=u.dot,f=u.points,m=u.dataKey,h=K(this.props,!1),p=K(l,!0),g=f.map(function(y,N){var _=I(I(I({key:"dot-".concat(N),r:3},h),p),{},{index:N,cx:y.x,cy:y.y,dataKey:m,value:y.value,payload:y.payload,points:f});return a.renderDotItem(l,_)}),c={clipPath:s?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return v.createElement(G,z({className:"recharts-area-dots"},c),g)}},{key:"renderHorizontalRect",value:function(s){var n=this.props,i=n.baseLine,d=n.points,o=n.strokeWidth,u=d[0].x,l=d[d.length-1].x,f=s*Math.abs(u-l),m=Z(d.map(function(h){return h.y||0}));return X(i)&&typeof i=="number"?m=Math.max(i,m):i&&Array.isArray(i)&&i.length&&(m=Math.max(Z(i.map(function(h){return h.y||0})),m)),X(m)?v.createElement("rect",{x:u<l?u:u-f,y:0,width:f,height:Math.floor(m+(o?parseInt("".concat(o),10):1))}):null}},{key:"renderVerticalRect",value:function(s){var n=this.props,i=n.baseLine,d=n.points,o=n.strokeWidth,u=d[0].y,l=d[d.length-1].y,f=s*Math.abs(u-l),m=Z(d.map(function(h){return h.x||0}));return X(i)&&typeof i=="number"?m=Math.max(i,m):i&&Array.isArray(i)&&i.length&&(m=Math.max(Z(i.map(function(h){return h.x||0})),m)),X(m)?v.createElement("rect",{x:0,y:u<l?u:u-f,width:m+(o?parseInt("".concat(o),10):1),height:Math.floor(f)}):null}},{key:"renderClipRect",value:function(s){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(s):this.renderHorizontalRect(s)}},{key:"renderAreaStatically",value:function(s,n,i,d){var o=this.props,u=o.layout,l=o.type,f=o.stroke,m=o.connectNulls,h=o.isRange;o.ref;var p=_e(o,Je);return v.createElement(G,{clipPath:i?"url(#clipPath-".concat(d,")"):null},v.createElement(re,z({},K(p,!0),{points:s,connectNulls:m,type:l,baseLine:n,layout:u,stroke:"none",className:"recharts-area-area"})),f!=="none"&&v.createElement(re,z({},K(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:m,fill:"none",points:s})),f!=="none"&&h&&v.createElement(re,z({},K(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:m,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(s,n){var i=this,d=this.props,o=d.points,u=d.baseLine,l=d.isAnimationActive,f=d.animationBegin,m=d.animationDuration,h=d.animationEasing,p=d.animationId,g=this.state,c=g.prevPoints,y=g.prevBaseLine;return v.createElement(Ie,{begin:f,duration:m,isActive:l,easing:h,from:{t:0},to:{t:1},key:"area-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var _=N.t;if(c){var O=c.length/o.length,x=o.map(function(A,T){var E=Math.floor(T*O);if(c[E]){var L=c[E],$=H(L.x,A.x),W=H(L.y,A.y);return I(I({},A),{},{x:$(_),y:W(_)})}return A}),b;if(X(u)&&typeof u=="number"){var w=H(y,u);b=w(_)}else if(ue(u)||Me(u)){var P=H(y,0);b=P(_)}else b=u.map(function(A,T){var E=Math.floor(T*O);if(y[E]){var L=y[E],$=H(L.x,A.x),W=H(L.y,A.y);return I(I({},A),{},{x:$(_),y:W(_)})}return A});return i.renderAreaStatically(x,b,s,n)}return v.createElement(G,null,v.createElement("defs",null,v.createElement("clipPath",{id:"animationClipPath-".concat(n)},i.renderClipRect(_))),v.createElement(G,{clipPath:"url(#animationClipPath-".concat(n,")")},i.renderAreaStatically(o,u,s,n)))})}},{key:"renderArea",value:function(s,n){var i=this.props,d=i.points,o=i.baseLine,u=i.isAnimationActive,l=this.state,f=l.prevPoints,m=l.prevBaseLine,h=l.totalLength;return u&&d&&d.length&&(!f&&h>0||!me(f,d)||!me(m,o))?this.renderAreaWithAnimation(s,n):this.renderAreaStatically(d,o,s,n)}},{key:"render",value:function(){var s,n=this.props,i=n.hide,d=n.dot,o=n.points,u=n.className,l=n.top,f=n.left,m=n.xAxis,h=n.yAxis,p=n.width,g=n.height,c=n.isAnimationActive,y=n.id;if(i||!o||!o.length)return null;var N=this.state.isAnimationFinished,_=o.length===1,O=ye("recharts-area",u),x=m&&m.allowDataOverflow,b=h&&h.allowDataOverflow,w=x||b,P=ue(y)?this.id:y,A=(s=K(d,!1))!==null&&s!==void 0?s:{r:3,strokeWidth:2},T=A.r,E=T===void 0?3:T,L=A.strokeWidth,$=L===void 0?2:L,W=Ve(d)?d:{},J=W.clipDot,F=J===void 0?!0:J,U=E*2+$;return v.createElement(G,{className:O},x||b?v.createElement("defs",null,v.createElement("clipPath",{id:"clipPath-".concat(P)},v.createElement("rect",{x:x?f:f-p/2,y:b?l:l-g/2,width:x?p:p*2,height:b?g:g*2})),!F&&v.createElement("clipPath",{id:"clipPath-dots-".concat(P)},v.createElement("rect",{x:f-U/2,y:l-U/2,width:p+U,height:g+U}
1))):null,_?null:this.renderArea(w,P),(d||_)&&this.renderDots(w,F,P),(!c||N)&&$e.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(s,n){return s.animationId!==n.prevAnimationId?{prevAnimationId:s.animationId,curPoints:s.points,curBaseLine:s.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:s.points!==n.curPoints||s.baseLine!==n.curBaseLine?{curPoints:s.points,curBaseLine:s.baseLine}:null}}])}(M.PureComponent);je=V;D(V,"displayName","Area");D(V,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ze.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});D(V,"getBaseValue",function(e,a,r,s){var n=e.layout,i=e.baseValue,d=a.props.baseValue,o=d??i;if(X(o)&&typeof o=="number")return o;var u=n==="horizontal"?s:r,l=u.scale.domain();if(u.type==="number"){var f=Math.max(l[0],l[1]),m=Math.min(l[0],l[1]);return o==="dataMin"?m:o==="dataMax"||f<0?f:Math.max(Math.min(l[0],l[1]),0)}return o==="dataMin"?l[0]:o==="dataMax"?l[1]:l[0]});D(V,"getComposedData",function(e){var a=e.props,r=e.item,s=e.xAxis,n=e.yAxis,i=e.xAxisTicks,d=e.yAxisTicks,o=e.bandSize,u=e.dataKey,l=e.stackedData,f=e.dataStartIndex,m=e.displayedData,h=e.offset,p=a.layout,g=l&&l.length,c=je.getBaseValue(a,r,s,n),y=p==="horizontal",N=!1,_=m.map(function(x,b){var w;g?w=l[f+b]:(w=fe(x,u),Array.isArray(w)?N=!0:w=[c,w]);var P=w[1]==null||g&&fe(x,u)==null;return y?{x:he({axis:s,ticks:i,bandSize:o,entry:x,index:b}),y:P?null:n.scale(w[1]),value:w,payload:x}:{x:P?null:s.scale(w[1]),y:he({axis:n,ticks:d,bandSize:o,entry:x,index:b}),value:w,payload:x}}),O;return g||N?O=_.map(function(x){var b=Array.isArray(x.value)?x.value[0]:null;return y?{x:x.x,y:b!=null&&x.y!=null?n.scale(b):null}:{x:b!=null?s.scale(b):null,y:x.y}}):O=y?n.scale(c):s.scale(c),I({points:_,baseLine:O,layout:p,isRange:N},h)});D(V,"renderDotItem",function(e,a){var r;if(v.isValidElement(e))r=v.cloneElement(e,a);else if(ne(e))r=e(a);else{var s=ye("recharts-area-dot",typeof e!="boolean"?e.className:""),n=a.key,i=_e(a,Qe);r=v.createElement(We,z({},i,{key:n,className:s}))}return r});var ot=qe({chartName:"AreaChart",GraphicalChild:V,axisComponents:[{axisType:"xAxis",AxisComp:be},{axisType:"yAxis",AxisComp:ge}],formatAxisMap:Ke});const lt=(e,a)=>{if(a===0)return e>0?{value:100,positive:!0}:void 0;const r=Math.round((e-a)/a*100);return{value:Math.abs(r),positive:r>=0}},k=({label:e,value:a,accent:r})=>t.jsxs("div",{className:"flex items-center justify-between py-3 border-b last:border-b-0 border-border/50",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:e}),t.jsx("span",{className:`text-sm font-semibold ${r?"text-emerald-600":""}`,children:a})]}),ct=({trend:e})=>e?t.jsxs("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full ${e.positive?"bg-emerald-500/10 text-emerald-600":"bg-red-500/10 text-red-600"}`,children:[e.positive?"+":"-",e.value,"%"]}):null,jt=()=>{const e=Le(),[a,r]=M.useState(!0),[s,n]=M.useState(!1),[i,d]=M.useState(null);M.useEffect(()=>{o()},[]);const o=async()=>{try{const{data:{user:l}}=await j.auth.getUser();if(!l){e("/auth");return}const{data:f}=await j.from("user_roles").select("role").eq("user_id",l.id).eq("role","admin").single();if(!f){e("/dashboard");return}n(!0);const m=new Date,h=new Date(m.getTime()-30*24*60*60*1e3).toISOString(),p=new Date(m.getTime()-60*24*60*60*1e3).toISOString(),[g,c,y,N,_,O,x,b,w,P,A,T,E,L]=await Promise.all([j.from("profiles").select("*",{count:"exact",head:!0}),j.from("profiles").select("*",{count:"exact",head:!0}).eq("account_type","lawyer"),j.from("profiles").select("*",{count:"exact",head:!0}).eq("account_type","company"),j.from("business_plans").select("*",{count:"exact",head:!0}),j.from("business_plans").select("*",{count:"exact",head:!0}).eq("is_unlocked",!0),j.from("visa_business_plans").select("*",{count:"exact",head:!0}),j.from("visa_business_plans").select("*",{count:"exact",head:!0}).eq("is_unlocked",!0),j.from("visa_business_plans").select("*",{count:"exact",head:!0}).gte("created_at",h),j.from("profiles").select("*",{count:"exact",head:!0}).is("account_type",null).gte("created_at",h),j.from("profiles").select("*",{count:"exact",head:!0}).is("account_type",null).gte("created_at",p).lt("created_at",h),j.from("profiles").select("created_at").gte("created_at",h).order("created_at",{ascending:!0}),j.from("profiles").select("*",{count:"exact",head:!0}).gte("created_at",h).or("account_type.eq.company,account_type.eq.lawyer"),j.from("visa_business_plans").select("user_id"),j.from("visa_business_plans").select("user_id").gte("created_at",h)]),$=new Set((E.data||[]).map(S=>
1S.user_id)),W=new Set((L.data||[]).map(S=>S.user_id)),J=g.count||0,F=c.count||0,U=y.count||0,oe=F+U,le=Math.max($.size-oe,0),Ne=Math.max(J-oe-le,0),te=N.count||0,ce=_.count||0,ae=O.count||0,de=x.count||0,Q={};for(let S=29;S>=0;S--){const C=new Date(m);C.setDate(C.getDate()-S),Q[C.toISOString().split("T")[0]]=0}(A.data||[]).forEach(S=>{const C=new Date(S.created_at).toISOString().split("T")[0];Q[C]!==void 0&&Q[C]++});const Pe=Object.entries(Q).map(([S,C])=>({date:new Date(S).toLocaleDateString("en-US",{month:"short",day:"numeric"}),count:C}));d({traditionalUsers:Ne,traditionalPlans:te,traditionalUnlocked:ce,traditionalConversion:te>0?(ce/te*100).toFixed(1):"0",traditionalUsersLast30d:w.count||0,traditionalUsersPrev30d:P.count||0,visaUsers:F+U+le,visaLawyers:F,visaCompanies:U,visaPlans:ae,visaUnlocked:de,visaConversion:ae>0?(de/ae*100).toFixed(1):"0",visaPlansLast30d:b.count||0,visaUsersLast30d:T.count||0,signupsOverTime:Pe})}catch(l){console.error("Error fetching admin stats:",l)}finally{r(!1)}};if(a)return t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx(ve,{className:"w-8 h-8 animate-spin text-primary"})});if(!s||!i)return null;const u=lt(i.traditionalUsersLast30d,i.traditionalUsersPrev30d);return t.jsx(Re,{children:t.jsxs("div",{className:"space-y-8",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold font-display",children:"Admin Dashboard"}),t.jsx("p",{className:"text-muted-foreground",children:"Overview of platform metrics"})]}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[t.jsxs("div",{className:"bg-card rounded-xl border",children:[t.jsxs("div",{className:"p-5 border-b flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:t.jsx(ke,{className:"w-5 h-5 text-primary"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold",children:"Traditional Users & Plans"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Standard business plan users"})]})]}),t.jsxs("div",{className:"p-5",children:[t.jsx(k,{label:"Total Users",value:i.traditionalUsers.toLocaleString()}),t.jsx(k,{label:"Total Plans",value:i.traditionalPlans.toLocaleString()}),t.jsx(k,{label:"Paid (Unlocked) Plans",value:i.traditionalUnlocked.toLocaleString(),accent:!0}),t.jsx(k,{label:"Conversion Rate",value:`${i.traditionalConversion}%`}),t.jsxs("div",{className:"flex items-center justify-between py-3",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"New Users (30d)"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:i.traditionalUsersLast30d.toLocaleString()}),t.jsx(ct,{trend:u})]})]})]})]}),t.jsxs("div",{className:"bg-card rounded-xl border",children:[t.jsxs("div",{className:"p-5 border-b flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-lg bg-accent/10 flex items-center justify-center",children:t.jsx(De,{className:"w-5 h-5 text-accent-foreground"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold",children:"Visa Users & Plans"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Immigration visa business plan users"})]})]}),t.jsxs("div",{className:"p-5",children:[t.jsx(k,{label:"Total Visa Users",value:i.visaUsers.toLocaleString()}),t.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-border/50",children:[t.jsxs("span",{className:"text-sm text-muted-foreground pl-4 flex items-center gap-2",children:[t.jsx(Ee,{className:"w-3.5 h-3.5"})," Lawyers"]}),t.jsx("span",{className:"text-sm font-semibold",children:i.visaLawyers.toLocaleString()})]}),t.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-border/50",children:[t.jsxs("span",{className:"text-sm text-muted-foreground pl-4 flex items-center gap-2",children:[t.jsx(Be,{className:"w-3.5 h-3.5"})," Companies"]}),t.jsx("span",{className:"text-sm font-semibold",children:i.visaCompanies.toLocaleString()})]}),t.jsx(k,{label:"Total Visa Plans",value:i.visaPlans.toLocaleStr
1ing()}),t.jsx(k,{label:"Paid (Unlocked) Plans",value:i.visaUnlocked.toLocaleString(),accent:!0}),t.jsx(k,{label:"Conversion Rate",value:`${i.visaConversion}%`}),t.jsx(k,{label:"New Visa Plans (30d)",value:i.visaPlansLast30d.toLocaleString()}),t.jsx(k,{label:"New Visa Users (30d)",value:i.visaUsersLast30d.toLocaleString()})]})]})]}),t.jsxs("div",{className:"bg-card rounded-xl border p-6",children:[t.jsx("h3",{className:"font-semibold mb-4",children:"User Signups (Last 30 Days)"}),t.jsx("div",{className:"h-64",children:t.jsx(He,{width:"100%",height:"100%",children:t.jsxs(ot,{data:i.signupsOverTime,children:[t.jsx(Xe,{strokeDasharray:"3 3",className:"stroke-muted"}),t.jsx(be,{dataKey:"date",tick:{fontSize:12},interval:"preserveStartEnd"}),t.jsx(ge,{tick:{fontSize:12}}),t.jsx(Ye,{}),t.jsx(V,{type:"monotone",dataKey:"count",stroke:"hsl(var(--primary))",fill:"hsl(var(--primary) / 0.2)",strokeWidth:2})]})})})]}),t.jsx(Ge,{})]})})};export{jt 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.