1import{c as $e,r as ee,j as e,z as I,O as Me,o as pe,G as V,v as g,w as v,Q as ue,x as y,R as F,E as b,U as Re,C as Ls,T as ke,l as Js,m as B,J as xe,V as Ys,W as Zs,s as Xs,Y as et,_ as st,t as te,Z as ae,$ as le,a0 as ks,a1 as tt,a2 as Ms,p as at,a3 as lt,S as it,a4 as rt,a5 as nt,a6 as ct,a7 as dt}from"./index-DaUnvdE7.js";import{e as ot}from"./export-pdf-Bt1Wnuha.js";import{F as ws}from"./FullScreenLayout-DI1jDsV4.js";import{P as fe}from"./progress-BqocyQNH.js";import{F as Rs}from"./filter-BqyMdgiE.js";import{T as xt}from"./trophy-BBkhSMlt.js";import{A as Te}from"./activity-B6l43GoR.js";import{G as he}from"./globe-DkbfuySv.js";import{R as _,B as re,C as ne,X as Z,Y as X,T as Q,a as G,b as Ne,c as Le,L as Fs}from"./BarChart-qMzrWyQO.js";import{P as Ss,a as ht,A as mt}from"./AreaChart-8TIRyJp6.js";import{S as pt}from"./share-2-B9tno3ty.js";import{I as Cs}from"./instagram-CymFD3a1.js";import{L as Fe,a as ye}from"./LineChart-PiNpLQJf.js";import{G as ut}from"./gauge-BPO7h8es.js";import"./jspdf.es.min-D9jBNOVJ.js";import"./html2canvas.esm-CBrSDip1.js";import"./isEqual-UNwHPP1L.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const gt=$e("ChartBar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** 7 * @license lucide-react v0.453.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Ts=$e("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/** 12 * @license lucide-react v0.453.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const ve=$e("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),bt=({data:w,totalUniqueEmails:$,onExport:A})=>{const[u,z]=ee.useState("summary"),[M,T]=ee.useState("all"),K=w.reduce((k,P)=>k+(P.users??0),0),j=w.reduce((k,P)=>k+(P.signups??0),0),H=w.reduce((k,P)=>k+(P.trials??0),0),D=w.reduce((k,P)=>k+(P.paidConversions??0),0),q=K>0?j/K*100:0,s=j>0?H/j*100:0,we=H>0?D/H*100:0,ge=K>0?D/K*100:0,oe=[...w].sort((k,P)=>P.paidConversions!==k.paidConversions?P.paidConversions-k.paidConversions:P.users-k.users),r=oe[0],be=k=>{const P=k*100;return P>=5?{bg:"bg-emerald-50",border:"border-emerald-100",text:"text-emerald-700",badge:"bg-emerald-100 text-emerald-800",bar:"bg-emerald-500",label:"High Performer"}:P>=2?{bg:"bg-amber-50",border:"border-amber-100",text:"text-amber-700",badge:"bg-amber-100 text-amber-800",bar:"bg-amber-500",label:"Average"}:{bg:"bg-slate-50",border:"border-slate-100",text:"text-slate-600",badge:"bg-slate-100 text-slate-700",bar:"bg-slate-400",label:"Low Conversion"}};return u==="detailed"?e.jsxs("div",{className:"space-y-6 animate-in fade-in duration-300",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(I,{variant:"ghost",size:"sm",onClick:()=>{z("summary"),T("all")},className:"text-slate-500 hover:text-slate-900 -ml-2",children:[e.jsx(Me,{className:"h-4 w-4 mr-1 rotate-180"})," Back to Dashboard"]}),e.jsx("div",{className:"h-6 w-px bg-slate-200"}),e.jsxs("h2",{className:"text-xl font-black text-slate-900 tracking-tight flex items-center gap-2",children:["Magnet Intelligence ",e.jsx("span",{className:"text-slate-400 text-sm font-medium",children:"Detailed Analysis"})]})]}),A&&e.jsxs(I,{variant:"outline",size:"sm",onClick:A,className:"bg-white border-slate-200 text-slate-700 font-bold text-xs shadow-sm hover:bg-slate-50",children:[e.jsx(pe,{className:"h-3.5 w-3.5 mr-2"})," Export CSV"]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsx("div",{className:"lg:col-span-3 space-y-2",children:e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden sticky top-6",children:[e.jsxs("div",{className:"p-3 bg-slate-50 border-b border-slate-100 font-bold text-xs text-slate-500 uppercase tracking-wider flex justify-between items-center",children:[e.jsx("span",{children:"Resources"}),e.jsx(V,{variant:"secondary",className:"text-[10px] h-5",children:w.length})]}),e.jsxs("div",{className:"max-h-[calc(100vh-250px)] overflow-y-auto p-2 space-y-1",children:[e.jsxs("button",{onClick:()=>T("all"),className:`w-full text-left px-3 py-2.5 rounded-lg text-xs font-medium transition-all flex justify-between items-center ${M==="all"?"bg-indigo-600 text-white shadow-md shadow-indigo-200":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx("span",{className:"font-bold",children:"All Guides"}),e.jsxs("span",{className:`px-1.5 py-0.5 rounded-md text-[9px] font-bold ${M==="all"?"bg-white/20 text-white":"bg-slate-100 text-slate-500"}
16`,children:[K.toLocaleString()," Sum"]})]}),w.map((k,P)=>e.jsxs("button",{onClick:()=>T(k.downloaded),className:`w-full text-left px-3 py-2.5 rounded-lg text-xs font-medium transition-colors flex justify-between items-center group ${M===k.downloaded?"bg-indigo-50 text-indigo-700 font-bold border border-indigo-100":"text-slate-600 hover:bg-slate-50 border border-transparent"}`,children:[e.jsx("span",{className:"truncate pr-2",children:k.downloaded}),e.jsx("span",{className:`px-1.5 py-0.5 rounded-md text-[9px] font-bold ${M===k.downloaded?"bg-white border text-indigo-600":"bg-slate-50 text-slate-400 group-hover:bg-white"}`,children:Number(k.users).toLocaleString()})]},P))]})]})}),e.jsx("div",{className:"lg:col-span-9",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:w.filter(k=>M==="all"||k.downloaded===M).map((k,P)=>{const a=be(k.paidRate??0);return e.jsxs("div",{className:"group relative p-5 rounded-2xl bg-white border border-slate-200 shadow-sm hover:shadow-md hover:border-indigo-200 transition-all duration-300",children:[e.jsx("div",{className:"absolute top-0 inset-x-0 h-1 rounded-t-2xl bg-gradient-to-r from-transparent via-slate-200 to-transparent group-hover:via-indigo-400 opacity-50"}),e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{className:"space-y-1 max-w-[70%]",children:[e.jsx(V,{variant:"outline",className:`mb-2 text-[9px] font-black uppercase tracking-widest border-none px-2 py-0.5 ${a.badge}`,children:a.label}),e.jsx("h4",{className:"text-sm font-black text-slate-800 leading-tight line-clamp-2",title:k.downloaded,children:k.downloaded})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-2xl font-black text-slate-900 tracking-tighter",children:(k.users??0).toLocaleString()}),e.jsx("p",{className:"text-[9px] text-slate-400 font-bold uppercase tracking-wider",children:"Downloads"})]})]}),e.jsxs("div",{className:"space-y-4 pt-4 border-t border-slate-50",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-slate-700 text-[10px]",children:(k.signups??0).toLocaleString()}),e.jsx("p",{className:"text-[8px] text-slate-400 uppercase tracking-tight",children:"Signups"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-violet-600 text-[10px]",children:(k.trials??0).toLocaleString()}),e.jsx("p",{className:"text-[8px] text-slate-400 uppercase tracking-tight",children:"Trials"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-black text-emerald-600 text-[10px]",children:(k.paidConversions??0).toLocaleString()}),e.jsx("p",{className:"text-[8px] text-slate-400 uppercase tracking-tight",children:"Paid"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex justify-between text-[10px] font-bold text-slate-500",children:[e.jsx("span",{children:"Funnel Efficiency"}),e.jsxs("span",{children:[((k.paidRate??0)*100).toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full ${a.bar} rounded-full transition-all duration-500`,style:{width:`${Math.min((k.paidRate??0)*100,100)}%`}})})]})]})]},P)})})})]})]}):e.jsxs(g,{className:"col-span-full bg-white border-slate-200 shadow-sm overflow-hidden group",children:[e.jsx(v,{className:"pb-0 border-b border-slate-50 bg-gradient-to-r from-slate-50/50 to-white pt-5 px-6",children:e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-indigo-500 to-indigo-600 shadow-lg shadow-indigo-500/20 text-white",children:e.jsx(ue,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx(y,{className:"text-slate-900 text-lg font-black uppercase tracking-tight",children:"Magnet Intelligence"}),e.jsx(F,{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mt-0.5",children:"Content â Commerce Pipeline"})]})]}),e.jsxs(I,{variant:"outline",size:"sm",onClick:()=>z("detailed"),className:"bg-white border-slate-200 text-slate-600 hover:text-indigo-600 hover:border-indigo-200 font-bold text-[10px] uppercase tracking-wider h-8 shadow-sm transition-all",children:["Detailed Analysis ",e.jsx(Me,{className:"h-3 w-3 ml-1"})]})]})}),e.jsx(b,{className:"p-0",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 divide-y md:divide-y-0 md:divide-x divide-slate-100 border-b border-slate-100",children:[e.jsx("div",{className:"md:col-span-7 bg-white p-6 md:p-8 space-y-8",children:e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-black text-slate-400 uppercase tracking-widest mb-6 flex items-center gap-2",children:[e.jsx(Rs,{className:"h-3 w-3"})," Aggregate Performance Funnel"]}),e.jsxs("div",{className:"relative space-y-6",children:[e.jsx("div",{className:"absolute left-[19px] top-8 bottom-8 w-0.5 bg-gradient-to-b from-slate-200 via-indigo-200 to-emerald-200"}),e.jsxs("div",{className:"relative flex items-center gap-5 group/item",children:[e.jsx("div",{className:"z-10 h-10 w-10 rounded-full bg-white border-2 border-slate-100 flex items-center justify-center shadow-sm group-hover/item:border-indigo-100 group-hover/item:scale-110 transition-all",children:e.jsx(pe,{className:"h-4 w-4 text-slate-400 group-hover/item:text-indigo-500 transition-colors"})}),e.jsxs("div",{className:"flex-1 p-4 rounded-xl bg-slate-50 border border-slate-100 group-hover/item:bg-white group-hover/item:shadow-md transition-all",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-[10px] font-black text-slate-500 uppercase tracking-widest",children:"Total Downloads"}),e.jsx(V,{variant:"secondary",className:"bg-white text-slate-600 text-[9px] font-bold",children:"100%"})]}),e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("p",{className:"text-2xl font-black text-slate-900 tracking-tight",children:K.toLocaleStr
16ing()}),$!==void 0&&e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-slate-400 font-bold bg-slate-100/50 px-2 py-0.5 rounded-full",children:[e.jsx(Re,{className:"h-2.5 w-2.5"}),e.jsxs("span",{children:[$.toLocaleString()," unique prospect emails"]})]})]})]})]}),e.jsxs("div",{className:"relative flex items-center gap-5 group/item",children:[e.jsx("div",{className:"z-10 h-10 w-10 rounded-full bg-white border-2 border-slate-100 flex items-center justify-center shadow-sm group-hover/item:border-indigo-100 group-hover/item:scale-110 transition-all",children:e.jsx(Re,{className:"h-4 w-4 text-slate-400 group-hover/item:text-indigo-500 transition-colors"})}),e.jsxs("div",{className:"flex-1 p-4 rounded-xl bg-slate-50 border border-slate-100 group-hover/item:bg-white group-hover/item:shadow-md transition-all",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-[10px] font-black text-slate-500 uppercase tracking-widest",children:"Acquired Users"}),e.jsxs(V,{className:"bg-indigo-100 text-indigo-700 hover:bg-indigo-100 border-none text-[9px] font-bold",children:[q.toFixed(1),"% Conv."]})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-2xl font-black text-slate-900 tracking-tight",children:j.toLocaleString()}),e.jsx("span",{className:"text-xs font-bold text-slate-400",children:"signups generated"})]})]})]}),e.jsxs("div",{className:"relative flex items-center gap-5 group/item",children:[e.jsx("div",{className:"z-10 h-10 w-10 rounded-full bg-white border-2 border-violet-100 flex items-center justify-center shadow-sm group-hover/item:border-violet-200 group-hover/item:scale-110 transition-all",children:e.jsx(ue,{className:"h-4 w-4 text-violet-400 group-hover/item:text-violet-500 transition-colors"})}),e.jsxs("div",{className:"flex-1 p-4 rounded-xl bg-violet-50/30 border border-violet-100/50 group-hover/item:bg-white group-hover/item:shadow-md transition-all",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-[10px] font-black text-violet-700 uppercase tracking-widest",children:"Active Trials"}),e.jsxs(V,{className:"bg-violet-100 text-violet-700 hover:bg-violet-100 border-none text-[9px] font-bold",children:[s.toFixed(1),"% Activation"]})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-2xl font-black text-slate-900 tracking-tight",children:H.toLocaleString()}),e.jsx("span",{className:"text-xs font-bold text-slate-400",children:"experience initiated"})]})]})]}),e.jsxs("div",{className:"relative flex items-center gap-5 group/item",children:[e.jsx("div",{className:"z-10 h-10 w-10 rounded-full bg-white border-2 border-emerald-100 flex items-center justify-center shadow-sm group-hover/item:border-emerald-200 group-hover/item:scale-110 transition-all",children:e.jsx(Ls,{className:"h-4 w-4 text-emerald-500"})}),e.jsxs("div",{className:"flex-1 p-4 rounded-xl bg-emerald-50/50 border border-emerald-100/50 group-hover/item:bg-emerald-50 group-hover/item:shadow-md group-hover/item:shadow-emerald-100 transition-all",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-[10px] font-black text-emerald-700 uppercase tracking-widest",children:"Paid Customers"}),e.jsxs(V,{className:"bg-emerald-500 text-white hover:bg-emerald-600 border-none text-[9px] font-bold",children:[we.toFixed(1),"% Conv."]})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-2xl font-black text-emerald-900 tracking-tight",children:D.toLocaleString()}),e.jsx("span",{className:"text-xs font-bold text-emerald-600/70",children:"revenue event"})]}),e.jsxs("div",{className:"mt-2 text-[10px] font-medium text-emerald-700 bg-white/50 rounded px-2 py-1 inline-block",children:[e.jsxs("span",{className:"font-bold",children:[ge.toFixed(2),"%"]})," global download-to-paid rate"]})]})]})]})]})}),e.jsxs("div",{className:"md:col-span-5 bg-slate-50/50 p-6 md:p-8 flex flex-col",children:[e.jsxs("h4",{className:"text-xs font-black text-slate-400 uppercase tracking-widest mb-6 flex items-center gap-2",children:[e.jsx(xt,{className:"h-3 w-3 text-amber-500"}
16)," Top Converting Magnets"]}),e.jsx("div",{className:"flex-1 space-y-3",children:oe.slice(0,3).map((k,P)=>{const a=P===0,Se=be(k.paidRate??0);return e.jsxs("div",{className:`group relative p-4 rounded-xl border transition-all hover:scale-[1.02] cursor-default ${a?"bg-white border-indigo-100 shadow-lg shadow-indigo-100":"bg-white border-slate-100 shadow-sm hover:border-indigo-100"}`,children:[a&&e.jsx("div",{className:"absolute -top-3 -right-3 h-8 w-8 rounded-full bg-gradient-to-br from-amber-300 to-amber-500 text-white flex items-center justify-center font-black text-xs shadow-md shadow-amber-200",children:"#1"}),e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs(V,{variant:"secondary",className:"bg-slate-100 text-slate-500 text-[9px] font-bold border-none px-1.5 h-5",children:[" Rank ",P+1]}),e.jsxs("span",{className:`text-[10px] font-black ${Se.text} uppercase tracking-wider`,children:[((k.paidRate??0)*100).toFixed(1),"% Conv."]})]}),e.jsx("h5",{className:"text-sm font-bold text-slate-800 leading-tight mb-2 line-clamp-2",title:k.downloaded,children:k.downloaded}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] font-medium text-slate-500",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-slate-800",children:(k.users??0).toLocaleString()})," DLs"]}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-slate-300"}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-slate-800",children:(k.paidConversions??0).toLocaleString()})," Paid"]})]})]},P)})}),oe.length===0&&e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center p-6 border-2 border-dashed border-slate-200 rounded-xl",children:[e.jsx(ue,{className:"h-8 w-8 text-slate-300 mb-2"}),e.jsx("p",{className:"text-xs font-bold text-slate-500",children:"No magnet data yet"})]}),e.jsx("div",{className:"mt-6 pt-6 border-t border-slate-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ke,{className:"h-4 w-4 text-indigo-500 mt-0.5 flex-shrink-0"}),e.jsxs("p",{className:"text-[10px] text-slate-500 font-medium leading-relaxed",children:[e.jsx("span",{className:"text-indigo-700 font-bold",children:"Insight:"})," Promoting ",e.jsxs("span",{className:"font-bold text-slate-700",children:['"',(r==null?void 0:r.downloaded)??"Unknown",'"']})," could yield ",e.jsx("span",{className:"font-bold text-emerald-600",children:((r==null?void 0:r.paidRate)??0)>ge/100?(((r==null?void 0:r.paidRate)??0)/(ge/100)-1).toFixed(1)+"x":"better"})," higher ROI than average."]})]})})]})]})})]})},J=(w,$)=>{if(!w||!w.length)return;const A=Object.keys(w[0]).join(","),u=w.map(K=>Object.values(K).map(j=>`"${j}"`).join(",")).join(` 17`),z="data:text/csv;charset=utf-8,"+A+` 18`+u,M=encodeURI(z),T=document.createElement("a");T.setAttribute("href",M),T.setAttribute("download",`${$}.csv`),document.body.appendChild(T),T.click(),document.body.removeChild(T)},jt={"New Signups":"Total volume of new user accounts created this week. High growth indicates strong acquisition channel performance.",Activation:"The percentage of users who reached their 'Aha!' moment by generating a high-quality resume. Strongest predictor of long-term retention.","Trial â Paid":"Monitization funnel efficiency: percentage of free trial users who upgrade to a premium plan within 14 days.","Paid Subscriptions":"Monthly Recurring Revenue (MRR) from all active paid tiers. Measures core financial health.","Monthly Churn":"Net loss of revenue and users month-over-month. Sustainability benchmark: keep below 5%.","Conversion Rate":"Percentage of total visitors who successfully created an account (VâS).","24h Activation":"Percentage of users who complete a core value action within 24 hours of signup.","Recovery Rev.":"Revenue saved through dunning and failed payment recovery efforts.","Total Visitors":"Unique sessions across the platform. Measures top-of-funnel reach.","Total Signups":"Total volume of visitors who created an account.","Trial Starts":"Users who initiated a 14-day premium trial.","Paid Conversions":"Users who completed a successful payment for a premium tier.","Overall Conv.":"Blended conversion efficie
18ncy from anonymous visitor to paying user (VâP).",CAC:"Customer Acquisition Cost: The total blended cost to acquire one paying user.","VâS %":"Visitor to Signup conversion rate. Measures landing page efficiency.","SâT %":"Signup to Trial conversion rate. Measures onboarding effectiveness.","TâP %":"Trial to Paid conversion rate. Measures product value perception and pricing fit.","VâP %":"Total funnel efficiency from visit to revenue.",ROAS:"Return on Ad Spend: Revenue generated per dollar spent on paid marketing.",Source:"The origin of the user's first visit (e.g., LinkedIn, CPC, Organic).",Visitors:"Unique sessions across the platform. Measures top-of-funnel reach.","Paid Ad Spend":"Total capital deployed on paid acquisition channels.","Cost per Signup":"The blended cost to acquire a single free user account.","Cost per Trial":"The blended cost to acquire a single premium trial start.","Cost per Paid User":"The blended cost to acquire a single revenue-generating customer (CAC).","CAC (Paid)":"Customer Acquisition Cost specifically for paid channels (Ads/Sponsorships).","CAC (Blended)":"Total acquisition spend divided by total new customers across all sources.","Blended ARPU":"Average Revenue Per User across both paid and free-to-paid segments.","Activated 24h":"Percentage of users who complete a core value action within 24 hours of signup.","Aha! Moment":"The specific behavioral event (e.g., generating first resume) that aligns a user with product value.","Speed-to-Value":"Median time taken from signup to first successful core feature usage.","Activation Depth":"The number of core features a user interacts with during their first 7 days.","24h SPEED":"Percentage of users who reach their first 'Aha!' moment within 24 hours.","Activation behavioral Funnel":"Step-by-step breakdown of first-mile user behavior.",Activated:"Total users who reached the 'Aha!' moment and generated their first asset.","Not Activated":"Users who have signed up but have not yet used core product features.","Median Time":"Average time elapsed between signup and first core value action.","Trial Conversion":"The baseline efficiency of trial users upgrading to paid plans.","Micro-conversion":"Smaller steps that correlate with final payment (e.g., inviting a collaborator).","Path Efficiency":"Tracking specific user paths (e.g. Magnet -> Paid) vs. general site flow.","Magnet â Paid Path":"High-fidelity path for users entering via lead magnets.","Direct Paid Path":"Conversion efficiency for users who purchase without trial or nurturing.","Trial Rate":"The percentage of signups that initiate a premium feature trial.",Conversion:"The percentage of users who complete a revenue-generating action.",DAU:"Daily Active Users: Unique users interacting with the platform in a 24-hour period.",WAU:"Weekly Active Users: Unique users interacting with the platform in a 7-day period.",MAU:"Monthly Active Users: Unique users interacting with the platform in a 30-day period.",Stickiness:"The ratio of Daily Active Users (DAU) to Monthly Active Users (MAU). Benchmarks: 20%+ is standard SaaS health.","Session Time":"Average duration of a single user session across the platform.","Sessions/Paid":"The average number of sessions per paying user. Indicates regular product integration.","Habit Threshold":"The frequency of use at which a user becomes 'sticky' and unlikely to churn (e.g., 3+ resumes).","Session Frequency":"How often a user return to the platform within a specific cycle.","Session Depth":"Average number of key interactions per session.","Sticky Features":"The core product features with the highest correlation to long-term retention.","Activity Segment":"Users grouped by their login frequency (Core, Power, Risk).","Uses/Mo":"Average number of times a feature is used by an active user per month.","Avg Session":"Weighted average duration of a single product session.","Platform Time Allocation":"Distribution of total user time across major product modules.","Top 25% (Power)":"The most active quartile of users; these are your most valuable brand advocates.","Median (Core)":"The baseline activity level of your average active user.","Bottom 25% (Risk)":"The least active users; high probability of churn in the next 60 days.","Avg Sub Duration":"The average duration a paying user stays with the platform before churning.","Median Sub Duration":"The middle point of subscription lengths, providing a robust view against outliers.","Logo Churn Rate":"Percentage of total customers who cancel their subscription in a given period.","Rev. Churn Rate":"Net MRR lost from cancellations and downgrades.","Net Rev. Retention":"NRR: Revenue from existing customers including upgrades/expansion (Gold standard: 110%+).","Customer LTV":"The total revenue expected from a single user before they churn.","Survival Curve":"Visual representation of user persistence over time, identifying exactly when 'leakage' occurs.","Churn Trigger":"Behavioral signals (e.g., inactivity for 14 days) that precede a cancellation.",Probability:"The statistical likelihood of an event (like churn) based on historic behavioral patterns.","Top Cohort":"The monthly group of signups with the highest retention/LTV performance.",Month:"A 30-day
18window following the user's signup date (M0, M1, etc.).","Revenue Movement":"Net changes in MRR driven by new sales, expansions, and churn.","Survival Curve (% Retained)":"Visual representation of user persistence over time.","Churn Timing":"The distribution of cancellations across the subscription lifecycle (e.g., Month 1 vs. Month 6).","Churn Probability":"The statistical likelihood that a user in this segment will cancel within 30 days.",ICP:"Ideal Customer Profile: The segment composition (Industry/Role/Country) that delivers the highest LTV.","Segment Score":"A weighted 1-10 ranking based on conversion (30%), retention (40%), and revenue (30%).",LTV:"Customer Lifetime Value: The total revenue expected from a single user before they churn.",Country:"The geographic region of the user, based on IP geolocation.",Industry:"The professional sector the user operates in, used for ICP identification.","Career Level":"The seniority of the user (Entry, Senior, Executive), a key driver of LTV.",Device:"The hardware platform used (Desktop, Mobile, Tablet).",Campaign:"The specific marketing initiative (e.g., Q1 Retargeting) that drove the signup.","Net Revenue":"Total revenue minus churn and processing fees.",Segment:"A specific user group defined by shared characteristics (e.g., 'US Tech Manager').","Conversion Rank":"Relative performance of this segment's conversion rate vs. the global average.","Retention Rank":"Relative performance of this segment's logo churn vs. the global average.","Revenue Rank":"Relative performance of this segment's LTV vs. the global average.","Overall Score":"Weighted aggregate performance (1-10) for a specific user segment.","Best Segment":"The user profile with the highest combined conversion, retention, and revenue scores.","Avg Lifetime":"The mean duration (in months) a user stays subscribed before churning.","Paid Users":"Total volume of active subscribers on any premium tier.","Total Trials":"Total volume of free-to-paid trials initiated in the current period.","Visitor â Paid":"The global conversion efficiency from anonymous visitor to paying customer.","Signup â Paid":"Funnel efficiency: the percentage of total accounts that eventually upgrade to paid.","Target: 3,000":"Weekly growth objective for new user acquisition.",Feature:"A specific functional module within JobOS (e.g., Resume Builder)."},i=({term:w,children:$,className:A})=>{const u=jt[w];return u?e.jsx(rt,{children:e.jsxs(nt,{children:[e.jsx(ct,{asChild:!0,children:e.jsx("span",{className:`cursor-help border-b border-dotted border-slate-300 transition-colors hover:border-indigo-400 ${A}`,children:$||w})}),e.jsxs(dt,{className:"bg-white border-slate-200 text-slate-700 w-64 p-3 shadow-xl z-50",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase text-slate-400 mb-1.5 tracking-widest",children:w}),e.jsx("p",{className:"text-xs font-medium leading-relaxed",children:u})]})]})}):e.jsx("span",{className:A,children:$||w})},ie=({data:w,color:$="#6366f1"})=>e.jsx("div",{className:"h-8 w-full mt-2",children:e.jsx(_,{width:"100%",height:"100%",children:e.jsx(Fe,{data:w,children:e.jsx(ye,{type:"monotone",dataKey:"value",stroke:$,strokeWidth:2,dot:!1,isAnimationActive:!1})})})}),me=({title:w,primaryMetric:$,trendRaw:A,trendPercent:u,comparisonLabel:z,microMetrics:M,visual:T,trendDirection:K="up",explanation:j})=>{const H=K==="up";return e.jsx(g,{className:"bg-white border-slate-200 shadow-sm overflow-hidden relative group transition-all hover:shadow-md hover:border-indigo-200",children:e.jsxs(b,{className:"p-5",children:[e.jsx("div",{className:"flex justify-between items-start mb-4",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(i,{term:w,className:"text-[10px] font-black text-slate-400 uppercase tracking-widest"}),e.jsx("h3",{className:"text-3xl font-black text-slate-900 tracking-tight",children:$})]})}),e.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[e.jsxs("div",{className:`flex items-center gap-0.5 px-2 py-0.5 rounded text-[11px] font-black ${H?"bg-emerald-50 text-emerald-600":"bg-rose-50 text-rose-600"}`,children:[H?e.jsx(ke,{className:"h-3 w-3"}):e.jsx(Ms,{className:"h-3 w-3"}),A]}),e.jsxs("div",{className:`text-[11px] font-black ${H?"text-emerald-600":"text-rose-600"}`,children:[H?"â":"â"," ",u]}),e.jsx("div",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-tighter",children:z})]}),e.jsxs("div",{className:"space-y-3 pt-4 border-t border-slate-100",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:M.map((D,q)=>e.jsxs("div",{className:"space-y-0.5",children:[D.label?e.jsx(i,{term:D.label,className:"text-[9px] font-black text-slate-400 uppercase tracking-tighter truncate w-fit"}):e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-tighter truncate",children:D.label}),e.jsx("p",{className:`text-xs font-black ${D.color||"text-slate-700"}`,children:D.value})]},q))}),T&&e.jsx("div",{className:"pt-1",children:T})]})]})})};function zt(){var Pe,Ue,De,Ve,qe,ze,Be,Ke,He,Ee,We,Oe;const w=Js(),[$,A]=ee.useState("overview"),[u,z]=ee.useState("0"),[M,T]=ee.useState("paid"),[K,j]=ee.useState(!1),H=ee.useCallback(async()=>{j(!0);try{const t=D(u).replace(/\s+/g,"-").toLowerCase();await ot("analytics-export-area",`jobos-${$}-${t}`)}finally{j(!1)}},[$,u]),D=t=>{switch(t){case"0":return"All-Time";case"7":return"Last 1 Week";case"14":return"Last 2 Weeks";case"30":return"Last 30 Days";case"90":return"Last 90 Days";case"180":return"Last 6 Months";case"365":return"Last 1 Year";default:return`Last ${t} Days`}},q=async t=>{const l=await fetch(t,{credentials:"include"});if(!l.ok)throw new Error(`${l.status}: ${await l.text()}`);return l.json()},{data:s,isLoading:we}=B({queryKey:["/api/admin/analytics/metrics/executive-overview",u],queryFn:()=>q(`/api/admin/analytics/metrics/executive-overview?days=${u}`)}),{data:ge,isLoading:oe}=B({queryKey:["/api/admin/analytics/metrics/growth-funnel",u],queryFn:()=>q(`/api/admin/analytics/metrics/growth-funnel?days=${u}`)}),{data:r,isLoading:be}=B({queryKey:["/api/admin/analytics/metrics/engagement-deep-dive",u,M],queryFn:()=>q(`/api/admin/analytics/metrics/engagement-deep-dive?days=${u}&type=${M}`)}),{data:k,isLoading:P}=B({queryKey:["/api/admin/analytics/metrics/icp-intelligence",u],queryFn:()=>q(`/api/admin/analytics/metrics/icp-intelligence?days=${u}`)}),{data:a,isLoading:Se}=B({queryKey:["/api/admin/analytics/metrics/traffic-intelligence",u],queryFn:()=>q(`/api/admin/analytics/metrics/traffic-intelligence?days=${u}`)}),{data:f,isLoading:$s}=B({queryKey:["/api/admin/analytics/metrics/activation-deep-dive",u],queryFn:()=>q(`/api/admin/analytics/metrics/activation-deep-dive?days=${u}`)}),{data:Y,isLoading:Ce}=B({queryKey:["/api/admin/analytics/metrics/onboarding-intent",u],queryFn:()=>q(`/api/admin/analytics/metrics/onboarding-intent?days=${u}`)}),{data:m,isLoading:As}=B({queryKey:["/api/admin/analytics/metrics/conversion-intelligence",u],queryFn:()=>q(`/api/admin/analytics/metrics/conversion-intelligence?days=${u}`)}),{data:d,isLoading:Ps}=B({queryKey:["/api/admin/analytics/metrics/retention-churn-stats",u],queryFn:()=>q(`/api/admin/analytics/metrics/retention-churn-stats?days=${u}`)}),{data:ce,isLoading:Us}=B({queryKey:["/api/admin/analytics/metrics/free-resource-impact",u],queryFn:()=>q(`/api/admin/analytics/metrics/free-resource-impact?days=${u}&limit=0`)}),Ae=(ce==null?void 0:ce.resources)||[],Ds=(ce==null?void 0:ce.totalUniqueEmails)||0,{data:Nt,isLoading:Vs}=B({queryKey:["/api/admin/analytics/metrics/feedback-insights",u],queryFn:()=>q(`/api/admin/analytics/metrics/feedback-insights?days=${u}`)}),{data:W,isLoading:qs}=B({queryKey:["/api/admin/analytics/metrics/founder-insights",u],queryFn:()=>q(`/api/admin/analytics/metrics/founder-insights?days=${u}`)}),{data:vt,isLoading:zs}=B({queryKey:["/api/admin/analytics/metrics/paid-vs-free-gap",u],queryFn:()=>q(`/api/admin/analytics/metrics/paid-vs-free-gap?days=${u}`)}),[de,Bs]=ee.useState("paid"),{data:h,isLoading:Ks}=B({queryKey:["/api/admin/analytics/metrics/user-profile-intelligence",u,de],queryFn:()=>q(`/api/admin/analytics/metrics/user-profile-intelligence?days=${u}&type=${de}`)}),Hs=()=>{w.invalidateQueries({queryKey:["/api/admin/analytics/metrics"]})};return we||oe||be||P||Se||$s||As||Ps||Us||Vs||qs||zs||Ce?e.jsx(ws,{backgroundGradient:"bg-gradient-to-br from-slate-950 via-slate-900 to-indigo-950",children:e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx(xe,{className:"h-10 w-10 animate-spin text-indigo-400 mx-auto"}),e.jsx("p",{className:"text-slate-400 text-sm font-medium tracking-wide",children:"Synthesizing Business Intelligence..."})]})})}):e.jsxs(ws,{backgroundGradient:"bg-slate-50",children:[e.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between gap-6 mb-8 mt-6 px-1",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2 mt-2",children:[e.jsx("img",{src:Ys,alt:"JobOS Logo",className:"h-8 object-contain"}),e.jsx("h1",{className:"text-3xl font-extrabold tracking-tight text-slate-900 leading-none",children:"JobOS Analytics"})]}),e.jsx("p",{className:"text-slate-500 text-sm font-medium",children:"Customer Journey Dashboard"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center bg-white border border-slate-200 rounded-xl px-3 py-1.5 gap-2 shadow-sm",children:[e.jsx(Rs,{className:"h-3.5 w-3.5 text-slate-400"}),e.jsxs("select",{value:u,onChange:t=>z(t.target.value),className:"bg-transparent text-xs font-bold text-slate-600 outline-none cursor-pointer",children:[e.jsx("option",{value:"0",children:"All-Time"}),e.jsx("option",{value:"7",children:"Last 1 Week"}),e.jsx("option",{value:"14",children:"Last 2 Weeks"}),e.jsx("option",{value:"30",children:"Last 30 Days"}),e.jsx("option",{value:"90",children:"Last 90 Days"}),e.jsx("option",{value:"180",children:"Last 6 Months"}),e.jsx("option",{value:"365",children:"Last 1 Year"})]})]}),e.jsxs(I,{onClick:Hs,variant:"outline",size:"sm",className:"bg-white border-slate-200 text-slate-700 hover:bg-slate-50 transition-all font-bold text-xs shadow-sm",children:[e.jsx(Zs,{className:"h-3.5 w-3.5 mr-2"})," ð Refresh Data"]}),e.jsxs(I,{onClick:()=>{const t=D(u).replace(/\s+/g,"-").toLowerCase();if($==="overview"){const l=[{metric:"Total Signups",value:(s==null?void 0:s.totalSignups)??0},{metric:"Active Trials",value:(s==null?void 0:s.activeTrials)??0},{metric:"Paid Users",value:(s==null?void 0:s.paidUsers)??0},{metric:"MRR",value:(s==null?void 0:s.mrr)??0},{metric:"Churn Rate",value:(s==null?void 0:s.churnRate)??0}];J(l,`analytics-overview-${t}`)}else if($==="acquisition"&&(a!=null&&a.table))J(a.table,`analytics-acquisition-${t}`);else if($==="activation"&&f){const l=[{metric:"Signup to Profile",value:f.signupToProfile},{metric:"Profile to Feature",value:f.profileToFeature},{metric:"24h Activation",value:f.activation24h}];J(l,`analytics-activation-${t}`)}else if($==="conversion"&&(m!=null&&m.behavioralTriggers))J(m.behavioralTriggers,`analytics-conversion-${t}`);else if($==="engagement"&&(r!=null&&r.featureUsage))J(r.featureUsage,`analytics-engagement-${t}`);else if($==="retention"&&d){const l=[{metric:"30d Retention",value:d.retention30d},{metric:"Monthly Churn",value:d.monthlyChurn},{metric:"Avg Lifetime",value:d.avgLifetimeMonths}];J(l,`analytics-retention-${t}`)}else $==="user-profiles"&&(h!=null&&h.geographic)&&J(h.geographic,`analytics-user-profiles-${t}`)},variant:"outline",size:"sm",className:"bg-white border-slate-200 text-slate-700 hover:bg-slate-50 transition-all font-bold text-xs shadow-sm",children:[e.jsx(pe,{className:"h-3.5 w-3.5 mr-2"})," CSV"]}),e.jsxs(I,{onClick:H,disabled:K,variant:"outline",size:"sm",className:"bg-white border-slate-200 text-slate-700 hover:bg-slate-50 transition-all font-bold text-xs shadow-sm",children:[K?e.jsx(xe,{className:"h-3.5 w-3.5 mr-2 animate-spin"}):e.jsx(pe,{className:"h-3.5 w-3.5 mr-2"}),K?"Generating...":"PDF Report"]})]})]}),e.jsxs(Xs,{value:$,onValueChange:A,className:"space-y-8",children:[e.jsx("div",{className:"flex items-center justify-between border-b border-slate-200 pb-1",children:e.jsx(et,{className:"bg-transparent border-none p-0 h-auto gap-8",children:["Overview","Acquisition","Activation","Conversion","Engagement","Retention","User Profiles","Auto-Apply"].map(t=>e.jsx(st,{value:t.toLowerCase().replace(" ","-"),className:"bg-transparent border-none p-0 pb-4 rounded-none text-slate-400 data-[state=active]:text-slate-900 data-[state=active]:border-b-2 data-[state=active]:border-indigo-600 font-bold text-xs uppercase tracking-widest transition-all",children:t},t))})}),e.jsxs("div",{id:"analytics-export-area",children:[e.jsx(te,{value:"overview",className:"space-y-10 outline-none",children:(()=>{var o,c,p,x,N,S,C,L,E,O,R,se,je,_e,Ge,Ie,Qe,Je,Ye,Ze,Xe,es,ss,ts,as,ls,is,rs,ns,cs,ds,os,xs,hs,ms,ps,us,gs,bs,js,fs,Ns,vs,ys;const t=((o=a==null?void 0:a.summary)==null?void 0:o.totalVisitors)??(s==null?void 0:s.totalSignups)??0,l=(s==null?void 0:s.totalSignups)??0,n=(((c=a==null?void 0:a.summary)==null?void 0:c.totalVisitors)??0)<50;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 ga
18p-6",children:[e.jsx(me,{title:"New Signups",primaryMetric:((p=s==null?void 0:s.totalSignups)==null?void 0:p.toLocaleString())??"0",trendRaw:`${((x=s==null?void 0:s.trends)==null?void 0:x.signups)>0?"+":""}${((S=(N=s==null?void 0:s.trends)==null?void 0:N.signups)==null?void 0:S.toFixed(1))??"0"}%`,trendPercent:`${((C=s==null?void 0:s.trends)==null?void 0:C.signups)>0?"+":""}${((E=(L=s==null?void 0:s.trends)==null?void 0:L.signups)==null?void 0:E.toFixed(1))??"0"}%`,comparisonLabel:D(u),trendDirection:((O=s==null?void 0:s.trends)==null?void 0:O.signups)>=0?"up":"down",explanation:"The total volume of new user accounts created in the selected period.",microMetrics:[{label:"Conversion Rate",value:`${(t>0?l/t*100:0).toFixed(1)}%`,description:"Percentage of visitors who created an account."},{label:"Total Visitors",value:t.toLocaleString(),description:"Cumulative unique visitors (Sessions + Signups)."},{label:"Target: 3,000",value:`Gap: ${(3e3-((s==null?void 0:s.totalSignups)??0)).toLocaleString()}`,color:((s==null?void 0:s.totalSignups)??0)<3e3?"text-rose-400":"text-emerald-400",description:"Distance from our growth goal of 3,000 new signups."}],visual:e.jsx(ie,{data:((R=s==null?void 0:s.activeTrends)==null?void 0:R.map(U=>({value:U.signups??U.dau})))??[]})}),e.jsx(me,{title:"Activation",primaryMetric:`${(((s==null?void 0:s.activationRate)??0)*100).toFixed(1)}%`,trendRaw:`${((se=s==null?void 0:s.trends)==null?void 0:se.activation)>0?"+":""}${((_e=(je=s==null?void 0:s.trends)==null?void 0:je.activation)==null?void 0:_e.toFixed(1))??"0"}%`,trendPercent:`${((Ge=s==null?void 0:s.trends)==null?void 0:Ge.activation)>0?"+":""}${((Qe=(Ie=s==null?void 0:s.trends)==null?void 0:Ie.activation)==null?void 0:Qe.toFixed(1))??"0"}%`,comparisonLabel:"vs prev. period",trendDirection:((Je=s==null?void 0:s.trends)==null?void 0:Je.activation)>=0?"up":"down",explanation:"Users who reached their 'Aha!' moment. This is the strongest predictor of long-term retention.",microMetrics:[{label:"Activated",value:((s==null?void 0:s.activatedCount)??0).toLocaleString(),color:"text-emerald-400",description:"Total users who completed a core value action."},{label:"Median Time",value:`${((f==null?void 0:f.medianSignupToFirstActionHours)??0).toFixed(1)}h`,description:"Average time taken from signup to first action."},{label:"24h Activ.",value:`${(((f==null?void 0:f.activated24h.rate)??0)*100).toFixed(1)}%`,description:"Percentage of users who activate within 24 hours."}],visual:e.jsxs("div",{className:"space-y-1 mt-2",children:[e.jsxs("div",{className:"flex justify-between text-[8px] font-black text-slate-500 uppercase",children:[e.jsx("span",{children:"Rate"}),e.jsxs("span",{children:[(((s==null?void 0:s.activationRate)??0)*100).toFixed(1),"%"]})]}),e.jsx(fe,{value:((s==null?void 0:s.activationRate)??0)*100,className:"h-1 bg-slate-900"})]})}),e.jsx(me,{title:"Signup â Paid",primaryMetric:`${((s==null?void 0:s.totalSignups)??0)>0?(((s==null?void 0:s.totalPaidSubs)??0)/((s==null?void 0:s.totalSignups)??1)*100).toFixed(1):"0.0"}%`,trendRaw:`${((Ye=s==null?void 0:s.trends)==null?void 0:Ye.conversion)>0?"+":""}${((Xe=(Ze=s==null?void 0:s.trends)==null?void 0:Ze.conversion)==null?void 0:Xe.toFixed(1))??"0"}%`,trendPercent:`${((es=s==null?void 0:s.trends)==null?void 0:es.conversion)>0?"+":""}${((ts=(ss=s==null?void 0:s.trends)==null?void 0:ss.conversion)==null?void 0:ts.toFixed(1))??"0"}%`,comparisonLabel:"Conversion Health",trendDirection:((as=s==null?void 0:s.trends)==null?void 0:as.conversion)>=0?"up":"down",explanation:"Percentage of all signups that became paying subscribers.",microMetrics:[{label:"Paid Users",value:((s==null?void 0:s.totalPaidSubs)??0).toLocaleString(),description:"Active paid subscriptions."},{label:"Total Signups",value:((s==null?void 0:s.totalSignups)??0).toLocaleString(),description:"All registered users."},{label:"Total Trials",value:((s==null?void 0:s.totalTrials)??0).toLocaleString(),description:"Users currently on trial."}],visual:e.jsx(ie,{data:((ls=s==null?void 0:s.activeTrends)==null?void 0:ls.map(U=>({value:U.signups??0})))??[],color:"#8b5cf6"})}),e.jsx(me,{title:"Paid Subscriptions",primaryMetric:`$${((s==null?void 0:s.mrr)??0).toLocaleStr
18ing()}`,trendRaw:`${((is=s==null?void 0:s.trends)==null?void 0:is.mrr)>0?"+":""}${((ns=(rs=s==null?void 0:s.trends)==null?void 0:rs.mrr)==null?void 0:ns.toFixed(1))??"0"}%`,trendPercent:`${((cs=s==null?void 0:s.trends)==null?void 0:cs.mrr)>0?"+":""}${((os=(ds=s==null?void 0:s.trends)==null?void 0:ds.mrr)==null?void 0:os.toFixed(1))??"0"}%`,comparisonLabel:"Billing Health",trendDirection:((xs=s==null?void 0:s.trends)==null?void 0:xs.mrr)>=0?"up":"down",explanation:"Monthly Recurring Revenue from all active paid tiers.",microMetrics:[{label:"DAU/MAU",value:`${(((s==null?void 0:s.dauMau)??0)*100).toFixed(1)}%`,description:"Stickiness: Daily active vs Monthly active users."},{label:"ARPU",value:`$${((s==null?void 0:s.totalPaidSubs)??0)>0?(((s==null?void 0:s.mrr)??0)/((s==null?void 0:s.totalPaidSubs)??1)).toFixed(2):"0.00"}`,description:"Average Revenue Per paid User."}],visual:e.jsx(ie,{data:((hs=s==null?void 0:s.activeTrends)==null?void 0:hs.map(U=>({value:U.mau??0})))??[],color:"#818cf8"})}),e.jsx(me,{title:"Monthly Churn",primaryMetric:`${(((s==null?void 0:s.monthlyChurn)??0)*100).toFixed(1)}%`,trendRaw:`${((ms=s==null?void 0:s.trends)==null?void 0:ms.churn)>0?"+":""}${((us=(ps=s==null?void 0:s.trends)==null?void 0:ps.churn)==null?void 0:us.toFixed(1))??"0"}%`,trendPercent:`${((gs=s==null?void 0:s.trends)==null?void 0:gs.churn)>0?"+":""}${((js=(bs=s==null?void 0:s.trends)==null?void 0:bs.churn)==null?void 0:js.toFixed(1))??"0"}%`,comparisonLabel:"Retention Status",trendDirection:((fs=s==null?void 0:s.trends)==null?void 0:fs.churn)<=0?"down":"up",explanation:"Net loss of revenue and users period-over-period.",microMetrics:[{label:"Avg Duration",value:`${(Ns=d==null?void 0:d.avgSubscriptionDuration)==null?void 0:Ns.toFixed(1)} mo`,description:"Average duration a paying user stays."},{label:"LTV",value:`$${(vs=d==null?void 0:d.ltv)==null?void 0:vs.toFixed(0)}`,color:"text-emerald-400",description:"Estimated Lifetime Value of a customer."}],visual:e.jsx(ie,{data:((ys=s==null?void 0:s.activeTrends)==null?void 0:ys.map(U=>({value:U.churn??0})))??[],color:"#f43f5e"})})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:e.jsxs(g,{className:"lg:col-span-2 bg-white border-slate-200 shadow-sm overflow-hidden",children:[e.jsx(v,{className:"pb-3 border-b border-slate-100 bg-slate-50/50",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-xl bg-white border border-slate-200 shadow-sm",children:e.jsx(Te,{className:"h-5 w-5 text-slate-600"})}),e.jsxs("div",{children:[e.jsx(y,{className:"text-slate-900 text-base font-black uppercase tracking-tight",children:"Customer Journey"}),e.jsx(F,{className:"text-slate-400 text-[10px] font-bold uppercase tracking-widest mt-0.5",children:"Visitor â Revenue Intelligence"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&e.jsx("span",{className:"text-[9px] font-black bg-blue-50 text-blue-600 rounded-full px-2 py-0.5 border border-blue-100 animate-pulse",children:"ð´ Live Monitoring"}),e.jsx(V,{className:"bg-slate-900 text-white border-none text-[9px] font-black uppercase tracking-widest px-3 py-1",children:"All-Time Performance"})]})]})}),e.jsxs(b,{className:"pt-6 pb-8 px-8",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsx("div",{className:"relative",children:e.jsxs("div",{className:"flex items-center gap-4 p-5 rounded-2xl bg-white border border-slate-200 shadow-sm hover:border-slate-300 transition-colors",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-slate-50 border border-slate-100 flex items-center justify-center font-mono text-[10px] font-black text-slate-400",children:"01"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest mb-0.5",children:"Discovery"}),e.jsx("p",{className:"text-3xl font-black text-slate-900 tracking-tighter leading-none",children:t.toLocaleString()}),e.jsx("p",{className:"text-[11px] font-bold text-slate-500 mt-1",children:"Unified Unique Visitors"})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsx("div",{className:"w-16 h-1 bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-slate-900 rounded-full w-full"})}),e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-tighter mt-1",children:"100%"})]})]})}),e.jsx("div",{className:"flex flex-col items-start pl-10 py-1 border-l border-slate-100 ml-5 my-1",children:e.jsxs("span",{className:"text-[10px] font-black text-slate-400 py-1 pl-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-4 h-px bg-slate-200"}
18),"â ",(l/Math.max(t,1)*100).toFixed(1),"% Conversion to Account"]})}),e.jsxs("div",{className:"flex items-center gap-4 p-5 rounded-2xl bg-white border border-slate-200 shadow-sm hover:border-slate-300 transition-colors",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-slate-50 border border-slate-100 flex items-center justify-center font-mono text-[10px] font-black text-slate-400",children:"02"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest mb-0.5",children:"Account Creation"}),e.jsx("p",{className:"text-3xl font-black text-slate-900 tracking-tighter leading-none",children:((s==null?void 0:s.totalSignups)??0).toLocaleString()}),e.jsx("p",{className:"text-[11px] font-bold text-slate-500 mt-1",children:"Registered Users"})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsx("div",{className:"w-16 h-1 bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-slate-900 rounded-full",style:{width:`${Math.min(l/Math.max(t,1)*100,100)}%`}})}),e.jsxs("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-tighter mt-1",children:[(l/Math.max(t,1)*100).toFixed(1),"%"]})]})]}),e.jsx("div",{className:"flex flex-col items-start pl-10 py-1 border-l border-slate-100 ml-5 my-1",children:e.jsxs("span",{className:"text-[10px] font-black text-slate-400 py-1 pl-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-4 h-px bg-slate-200"}),"â ",(((s==null?void 0:s.activationRate)??0)*100).toFixed(1),"% Reached Aha! Moment"]})}),e.jsxs("div",{className:"flex items-center gap-4 p-5 rounded-2xl bg-white border border-slate-200 shadow-sm hover:border-slate-300 transition-colors",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-slate-50 border border-slate-100 flex items-center justify-center font-mono text-[10px] font-black text-slate-400",children:"03"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest mb-0.5",children:"Core Activation"}),e.jsx("p",{className:"text-3xl font-black text-slate-900 tracking-tighter leading-none",children:((s==null?void 0:s.activatedCount)??0).toLocaleString()}),e.jsx("p",{className:"text-[11px] font-bold text-slate-500 mt-1",children:"Activated Users"})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsx("div",{className:"w-16 h-1 bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-slate-900 rounded-full",style:{width:`${Math.min(((s==null?void 0:s.activationRate)??0)*100,100)}%`}})}),e.jsxs("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-tighter mt-1",children:[(((s==null?void 0:s.activationRate)??0)*100).toFixed(1),"%"]})]})]}),e.jsx("div",{className:"flex flex-col items-start pl-10 py-1 border-l border-slate-100 ml-5 my-1",children:e.jsxs("span",{className:"text-[10px] font-black text-slate-400 py-1 pl-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-4 h-px bg-slate-200"}),"â ",(((s==null?void 0:s.totalTrials)??0)/Math.max((s==null?void 0:s.totalSignups)??1,1)*100).toFixed(1),"% Advanced Feature Trial"]})}),e.jsxs("div",{className:"flex items-center gap-4 p-5 rounded-2xl bg-white border border-slate-200 shadow-sm hover:border-slate-300 transition-colors",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-slate-50 border border-slate-100 flex items-center justify-center font-mono text-[10px] font-black text-slate-400",children:"04"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest mb-0.5",children:"Trial Activation"}),e.jsx("p",{className:"text-3xl font-black text-slate-900 tracking-tighter leading-none",children:((s==null?void 0:s.totalTrials)??0).toLocaleString()}),e.jsx("p",{className:"text-[11px] font-bold text-slate-500 mt-1",children:"Active Trials"})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsx("div",{className:"w-16 h-1 bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-slate-900 rounded-full",style:{width:`${Math.min(((s==null?void 0:s.totalTrials)??0)/M
18ath.max((s==null?void 0:s.totalSignups)??1,1)*100,100)}%`}})}),e.jsxs("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-tighter mt-1",children:[(((s==null?void 0:s.totalTrials)??0)/Math.max((s==null?void 0:s.totalSignups)??1,1)*100).toFixed(1),"%"]})]})]}),e.jsx("div",{className:"flex flex-col items-start pl-10 py-1 border-l border-slate-100 ml-5 my-1",children:e.jsxs("span",{className:"text-[10px] font-black text-slate-400 py-1 pl-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-4 h-px bg-slate-200"}),"â ",((s==null?void 0:s.totalSignups)??0)>0?(((s==null?void 0:s.totalPaidSubs)??0)/((s==null?void 0:s.totalSignups)??1)*100).toFixed(1):"0.0","% Signup to Paid"]})}),e.jsxs("div",{className:"flex items-center gap-6 p-7 rounded-2xl bg-slate-950 border border-slate-900 shadow-xl shadow-slate-200",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-white/10 border border-white/5 flex items-center justify-center font-mono text-[10px] font-black text-slate-500",children:"05"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-500 uppercase tracking-widest mb-0.5",children:"Monetization"}),e.jsx("p",{className:"text-5xl font-black text-white tracking-tighter leading-none",children:((s==null?void 0:s.totalPaidSubs)??0).toLocaleString()}),e.jsx("p",{className:"text-[11px] font-bold text-slate-400 mt-1",children:"Paying Customers"})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-500 uppercase tracking-widest mb-1",children:"Efficiency"}),e.jsxs("p",{className:"text-white font-black text-3xl",children:[(((s==null?void 0:s.totalPaidSubs)??0)/Math.max(t,1)*100).toFixed(2),"%"]}),e.jsx("p",{className:"text-[9px] text-slate-500 font-bold uppercase tracking-tighter mt-0.5",children:"Visitor â Paid"})]})]})]}),e.jsxs("div",{className:"mt-8 p-5 bg-slate-50 rounded-2xl border border-slate-100 flex gap-4 items-start group",children:[e.jsx("div",{className:"p-2 rounded-full bg-white shadow-sm mt-0.5 flex-shrink-0 border border-slate-100 group-hover:bg-slate-900 group-hover:text-white transition-all duration-300",children:e.jsx(ae,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-slate-900 uppercase tracking-widest mb-1",children:"Bottleneck Insight"}),e.jsx("p",{className:"text-sm text-slate-500 font-semibold leading-relaxed tracking-tight italic",children:((s==null?void 0:s.activationRate)??0)<.4?`${((1-((s==null?void 0:s.activationRate)??0))*100).toFixed(0)}% of signups never reach their Aha! moment. Engineering effort should prioritize the onboarding workflow.`:((s==null?void 0:s.totalPaidSubs)??0)/((s==null?void 0:s.totalSignups)??1)<.05?`Signup-to-paid conversion is ${(((s==null?void 0:s.totalPaidSubs)??0)/((s==null?void 0:s.totalSignups)??1)*100).toFixed(1)}%. Revenue is leaking at the upgrade gate. Review pricing strategy.`:"Funnel efficiency is optimized at 90th percentile. Shift resources into high-volume visitor acquisition."})]})]})]})]})}),e.jsxs("div",{className:"mt-12 mb-8 border-t border-slate-100 pt-12",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx("div",{className:"p-3 rounded-2xl bg-rose-50 border border-rose-100 shadow-sm",children:e.jsx(pe,{className:"h-6 w-6 text-rose-500"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-black text-slate-900 tracking-tight uppercase",children:"Blog Guides & Content Magnet Analytics"}),e.jsx("p",{className:"text-slate-500 text-sm font-semibold italic",children:"Tracking the journey from free download to trial activation and paid conversion."})]})]}),e.jsx(bt,{data:Ae??[],totalUniqueEmails:Ds,onExport:()=>J(Ae??[],"guide-leads-export")})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:e.jsxs(g,{className:"lg:col-span-8 bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:"ð"}),e.jsxs("div",{children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold uppercase tracking-tight",children:"Detailed Traffic Performance"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"Conversion efficie
18ncy by acquisition source"})]})]})}),e.jsxs(b,{className:"pt-0",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest",children:"Source"}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:"Visitors"}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:"Share"}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:"Signup Rate"}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:"Trial Rate"}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right text-indigo-600",children:"Total Conv."})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100",children:((a==null?void 0:a.table.slice(0,6))??[]).map((U,Es)=>{const Ws=(a==null?void 0:a.summary.totalVisitors)??1,Os=(U.visitors/Ws*100).toFixed(1),_s=(U.signups/Math.max(U.visitors,1)*100).toFixed(1),Gs=(U.trials/Math.max(U.signups,1)*100).toFixed(1),Is=(U.paid/Math.max(U.visitors,1)*100).toFixed(2),Qs=U.source===(a==null?void 0:a.insights.topSource);return e.jsxs("tr",{className:"group hover:bg-slate-50 transition-all cursor-default",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-black text-slate-700 italic",children:U.source}),Qs&&e.jsx(V,{className:"bg-emerald-50 text-emerald-600 border-none text-[8px] h-4",children:"Leader"})]})}),e.jsx("td",{className:"py-4 px-4 text-right text-slate-600 font-mono text-xs",children:U.visitors.toLocaleString()}),e.jsxs("td",{className:"py-4 px-4 text-right text-slate-400 font-bold text-xs",children:[Os,"% ",e.jsxs("span",{className:"text-[9px] opacity-70",children:["(",U.visitors.toLocaleString(),")"]})]}),e.jsxs("td",{className:"py-4 px-4 text-right text-slate-600 font-bold text-xs",children:[_s,"% ",e.jsxs("span",{className:"text-[9px] opacity-70",children:["(",U.signups.toLocaleString(),")"]})]}),e.jsxs("td",{className:"py-4 px-4 text-right text-slate-600 font-bold text-xs",children:[Gs,"% ",e.jsxs("span",{className:"text-[9px] opacity-70",children:["(",U.trials.toLocaleString(),")"]})]}),e.jsxs("td",{className:"py-4 px-4 text-right text-indigo-600 font-black text-xs",children:[Is,"% ",e.jsxs("span",{className:"text-[10px] opacity-70",children:["(",U.paid.toLocaleString(),")"]})]})]},Es)})})]})}),e.jsxs("div",{className:"mt-6 p-4 bg-indigo-50 rounded-xl border border-indigo-100 flex gap-3 items-center",children:[e.jsx("span",{className:"text-xl",children:"ð"}),e.jsx("p",{className:"text-xs text-slate-500 font-medium italic leading-relaxed",children:(a==null?void 0:a.insights.warning)||`${a==null?void 0:a.insights.topSource} traffic is your highest quality acquisition source in this period.`})]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs(g,{className:"lg:col-span-2 bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:"ð§ "}),e.jsx(y,{className:"text-slate-900 text-lg font-bold uppercase tracking-tight",children:"Executive Intelligence"})]})}),e.jsx(b,{className:"space-y-6 pt-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-slate-50 border border-slate-100 space-y-3 hover:border-rose-200 transition-all",children:[e.jsxs("h4",{className:"text-[10px] font-black text-rose-600 uppercase tracking-widest flex items-center gap-1.5",children:[e.jsx(ae,{className:"h-3 w-3"})," Growth Opportunity"]}),e.jsx("p",{className:"text-sm font-bold text-slate-700 leading-relaxed",children:(W==null?void 0:W.opportunities[0])??"Analyze acquisition channels to identify new scaling opportunities."})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-50 border border-slate-100 space-y-3 hover:border-indigo-200 transition-all",children:[e.jsxs("h4",{className:"text-[10px] font-black text-indigo-600 uppercase tracking-widest flex items-center gap-1.5",children:[e.jsx(le,{className:"h-3 w-3"})," Secondary Opportunity"]}),e.jsx("p",{className:"text-sm font-bold text-slate-700 leading-relaxed",children:(W==null?void 0:W.opportunities[1])??"Users who engage with 3+ features exhibit 2x higher retention rates."})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-50 border border-slate-100 space-y-3 hover:border-amber-200 transition-all",children:[e.jsxs("h4",{className:"text-[10px] font-black text-amber-600 uppercase tracking-widest flex items-center gap-1.5",children:[e.jsx(ve,{className:"h-3 w-3"})," Risk Alert"]}),e.jsx("p",{className:"text-sm font-bold text-slate-700 leading-relaxed",children:(W==null?void 0:W.risks[0])??"No major risks detected in the current period."})]})]})})]}),e.jsxs(g,{className:"bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:"ð¯"}),e.jsx(y,{className:"text-slate-900 text-lg font-bold uppercase tracking-tight",children:"What Matters Most This Week"})]})}),e.jsx(b,{className:"pt-6",children:e.jsxs("ul",{className:"space-y-5",children:[e.jsxs("li",{className:"flex items-start gap-4 p-2 rounded-lg hover:bg-slate-50 transition-all",children:[e.jsx("div",{className:"mt-1.5 h-2 w-2 rounded-full bg-indigo-500 shrink-0 shadow-[0_0_10px_rgba(99,102,241,0.3)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest leading-none mb-1.5",children:"Biggest growth driver"}),e.jsx("p",{className:"text-sm font-bold text-slate-800",children:(a==null?void 0:a.insights.topSource)??"Direct Selection"})]})]}),e.jsxs("li",{className:"flex items-start gap-4 p-2 rounded-lg hover:bg-slate-50 transition-all",children:[e.jsx("div",{className:"mt-1.5 h-2 w-2 rounded-full bg-rose-500 shrink-0 shadow-[0_0_10px_rgba(244,63,94,0.3)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest leading-none mb-1.5",children:"Biggest bottleneck"}),e.jsx("p",{className:"text-sm font-bold text-slate-800",children:(W==null?void 0:W.bottleneck)??"Activation Depth"})]})]}),e.jsxs("li",{className:"flex items-start gap-4 p-2 rounded-lg hover:bg-slate-50 transition-all",children:[e.jsx("div",{className:"mt-1.5 h-2 w-2 rounded-full bg-emerald-500 shrink-0 shadow-[0_0_10px_rgba(16,185,129,0.3)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest leading-none mb-1.5",children:"Revenue focus"}),e.jsx("p",{className:"text-sm font-bold text-slate-800",children:"Optimize Trial â Paid Flow"})]})]})]})})]})]})]})})()}),e.jsxs(te,{value:"acquisition",className:"space-y-6 outline-none",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-indigo-50 border border-indigo-100 rounded-full",children:[e.jsx(ae,{className:"h-3.5 w-3.5 text-indigo-600"}),e.jsxs("span",{className:"text-[10px] font-black text-indigo-600 uppercase tracking-widest",children:["Growth Command Center: ",D(u)]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(I,{variant:"outline",size:"sm",className:"h-8 text-[10px] font-black uppercase tracking-widest border-slate-200 text-slate-500 hover:bg-slate-50",children:["Filter: ",D(u)]})})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:[{label:"Total Visitors",value:((a==null?void 0:a.summary.totalVisitors)??0).toLocaleStr
18ing(),trend:"Current",color:"#6366f1",data:(a==null?void 0:a.trends.map(t=>({value:t.visitors})))??[]},{label:"Total Signups",value:((a==null?void 0:a.summary.totalSignups)??0).toLocaleString(),sub:`${(((a==null?void 0:a.summary.visitorToSignup)??0)*100).toFixed(1)}% VâS`,trend:"Growth",color:"#a855f7",data:(a==null?void 0:a.trends.map(t=>({value:t.signups})))??[]},{label:"Trial Starts",value:((a==null?void 0:a.summary.totalTrials)??0).toLocaleString(),sub:`${(((a==null?void 0:a.summary.signupToTrial)??0)*100).toFixed(1)}% SâT`,trend:"Active",color:"#ec4899",data:(a==null?void 0:a.trends.map(t=>({value:t.trials})))??[]},{label:"Paid Conversions",value:((a==null?void 0:a.summary.totalPaid)??0).toLocaleString(),sub:`${(((a==null?void 0:a.summary.trialToPaid)??0)*100).toFixed(1)}% TâP`,trend:"Revenue",color:"#22c55e",data:(a==null?void 0:a.trends.map(t=>({value:t.paid})))??[]},{label:"Overall Conv.",value:`${(((a==null?void 0:a.summary.totalConv)??0)*100).toFixed(2)}%`,sub:"VâP Efficiency",trend:"Target: 1%",color:"#6366f1",data:(a==null?void 0:a.trends.map(t=>({value:t.paid/Math.max(t.visitors,1)*100})))??[]},{label:"Avg LTV",value:`$${(a==null?void 0:a.summary.avgLtv)??0}`,sub:"Projected",trend:"Varies",color:"#6366f1",data:(a==null?void 0:a.table.slice(0,9).map(t=>({value:t.ltv})))??[]}].map((t,l)=>e.jsx(g,{className:"bg-white border-slate-100 shadow-sm overflow-hidden",children:e.jsxs(b,{className:"p-4",children:[e.jsx(i,{term:t.label,className:"text-[9px] font-black text-slate-400 uppercase tracking-widest mb-1"}),e.jsx("h4",{className:"text-xl font-black text-slate-900 tracking-tighter leading-none mb-1",children:t.value}),e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-[9px] font-bold text-slate-500 italic",children:t.sub||D(u)}),e.jsx("span",{className:`text-[10px] font-black ${t.trend.includes("â")||t.trend.includes("+")?"text-emerald-600":"text-slate-500"}`,children:t.trend})]}),e.jsx(ie,{data:t.data.length>0?t.data:[{value:0}],color:t.color})]})},l))}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsxs(g,{className:"lg:col-span-12 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(he,{className:"h-5 w-5 text-indigo-500"}),"Traffic by Source"]}),e.jsx(F,{className:"text-slate-500 text-xs font-medium italic",children:"Multi-stage conversion path per acquisition channel"})]}),e.jsx(b,{className:"pt-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Source"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Visitors"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"VâS %"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"SâT %"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"TâP %"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"VâP %"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Monthly Churn",children:"Churn"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"LTV",children:"Avg LTV"})})]})}),e.jsx("tbody",{className:"divide-y divide-slate-50",children:((a==null?void 0:a.table)??[]).map((t,l)=>{const n=(t.visitorToSignup*100).toFixed(1),o=(t.signupToTrial*100).toFixed(1),c=(t.trialToPaid*100).toFixed(1),p=(t.totalConv*100).toFixed(2);return e.jsxs("tr",{className:"hover:bg-slate-50/50 transition-colors text-[11px]",children:[e.jsx("td",{className:"py-3.5 px-4 font-black text-slate-700 italic",children:t.source}),e.jsx("td",{className:"py-3.5 px-4 text-right font-bold text-slate-500",children:t.visitors.toLocaleStr
18ing()}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-black text-slate-900",children:[n,"% ",e.jsxs("span",{className:"text-[9px] text-slate-400 font-bold",children:["(",t.signups.toLocaleString(),")"]})]}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-black text-slate-900",children:[o,"% ",e.jsxs("span",{className:"text-[9px] text-slate-400 font-bold",children:["(",t.trials.toLocaleString(),")"]})]}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-black text-indigo-600",children:[c,"% ",e.jsxs("span",{className:"text-[9px] text-indigo-400 font-bold",children:["(",t.paid.toLocaleString(),")"]})]}),e.jsxs("td",{className:`py-3.5 px-4 text-right font-black ${t.source===(a==null?void 0:a.insights.topSource)?"text-emerald-600":"text-slate-900"}`,children:[p,"%"]}),e.jsxs("td",{className:`py-3.5 px-4 text-right font-black ${Number(t.churn)>.1?"text-rose-600":"text-slate-700"}`,children:[(t.churn*100).toFixed(1),"%"]}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-black text-slate-900",children:["$",t.ltv.toLocaleString()]})]},l)})})]})})})]}),e.jsxs(g,{className:"lg:col-span-8 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(le,{className:"h-5 w-5 text-indigo-500"}),"Source Conversion Efficiency"]}),e.jsx(F,{className:"text-slate-500 text-xs font-medium italic",children:"Performance uplift vs. overall average"})]}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"h-[300px]",children:e.jsx(_,{width:"100%",height:"100%",children:e.jsxs(re,{data:((a==null?void 0:a.table.slice(0,6))??[]).map(t=>({name:t.source,uplift:t.totalConv/Math.max((a==null?void 0:a.summary.totalConv)??.01,.001),label:`${(t.totalConv/Math.max((a==null?void 0:a.summary.totalConv)??.01,.001)).toFixed(1)}x`})),layout:"vertical",margin:{left:40},children:[e.jsx(ne,{strokeDasharray:"3 3",stroke:"#f1f5f9",horizontal:!0,vertical:!1}),e.jsx(Z,{type:"number",stroke:"#94a3b8",fontSize:10,axisLine:!1,tickLine:!1}),e.jsx(X,{dataKey:"name",type:"category",stroke:"#475569",fontSize:10,axisLine:!1,tickLine:!1}),e.jsx(Q,{cursor:{fill:"#f8fafc"},contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px"}}),e.jsxs(G,{dataKey:"uplift",fill:"#6366f1",radius:[0,4,4,0],barSize:20,children:[e.jsx(Ne,{dataKey:"label",position:"right",fontSize:10,fontWeight:"900"}),((a==null?void 0:a.table.slice(0,6))??[]).map((t,l)=>e.jsx(Le,{fill:t.totalConv>((a==null?void 0:a.summary.totalConv)??0)?"#6366f1":t.churn>.1?"#f43f5e":"#94a3b8"},`cell-${l}`))]})]})})})})]}),e.jsxs(g,{className:"lg:col-span-4 bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50",children:e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(ve,{className:"h-5 w-5 text-indigo-500"}),"Traffic Quality Index"]})}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"space-y-4",children:((a==null?void 0:a.table.slice(0,6))??[]).map((t,l)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-slate-50 border border-slate-100 rounded-xl",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-slate-700 tracking-tight uppercase",children:t.source}),e.jsx(V,{className:`text-[8px] font-black uppercase px-2 py-0 h-4 border-none ${t.churn>.1?"bg-rose-600 text-white":t.totalConv<.01?"bg-amber-100 text-amber-700":"bg-emerald-50 text-emerald-700"}`,children:t.churn>.1?"High Churn":t.totalConv>.05?"High Efficiency":"Standard"})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-lg font-black text-slate-900 leading-none italic",children:t.qualityScore}),e.jsx("p",{className:"text-[8px] font-black text-slate-400 uppercase tracking-widest",children:"Score / 10"})]})]},l))})})]}),e.jsxs(g,{className:"lg:col-span-8 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(Te,{className:"h-5 w-5 text-indigo-500"}),"Volume vs. Revenue Contribution"]}),e.jsx(F,{className:"text-slate-500 text-xs font-medium italic",children:"High Volume / High Value quadrant analysis"})]}),e.jsx(b,{className:"pt-6",children:e.jsxs("div",{className:"h-[300px] relative",children:[e.jsx("div",{className:"absolute top-0 left-0 p-2 text-[8px] font-black text-slate-400 uppercase tracking-widest opacity-30",children:"Improve Conversion"}),e.jsx("div",{className:"absolute top-0 right-0 p-2 text-[8px] font-black text-indigo-400 uppercase tracking-widest opacity-50",children:"Scale Up"}),e.jsx("div",{className:"absolute bottom-12 left-0 p-2 text-[8px] font-black text-slate-400 uppercase tracking-widest opacity-30",children:"Deprioritize"}),e.jsx("div",{className:"absolute bottom-12 right-0 p-2 text-[8px] font-black text-emerald-400 uppercase tracking-widest opacity-50",children:"Double Down"}),e.jsx(_,{width:"100%",height:"100%",children:e.jsx(Ss,{children:" "})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:e.jsx("div",{className:"relative h-full w-full border-l border-b border-slate-200",children:(()=>
18{if(!(a!=null&&a.table)||a.table.length===0)return null;const t=Math.max(...a.table.map(n=>n.visitors),1),l=Math.max(...a.table.map(n=>n.totalConv),.01);return a.table.slice(0,6).map((n,o)=>{const c=Math.min(n.visitors/t*90+5,95),p=Math.min(n.totalConv/l*90+5,95),x=n.source===a.insights.topSource,N=n.source===a.insights.topQualitySource,S=x?"bg-emerald-500":N?"bg-indigo-500":"bg-slate-400";return e.jsx("div",{className:`absolute w-3 h-3 rounded-full pointer-events-auto cursor-help ${S} shadow-sm border border-white transition-all hover:scale-150`,style:{bottom:`${p}%`,left:`${c}%`},title:`${n.source}: ${n.visitors} visitors, ${(n.totalConv*100).toFixed(1)}% VP`,children:e.jsx("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 whitespace-nowrap text-[8px] font-black uppercase text-slate-600 tracking-tighter bg-white/80 px-1 rounded backdrop-blur-sm",children:n.source})},o)})})()})}),e.jsxs("div",{className:"mt-8 flex justify-between text-[8px] font-black text-slate-400 uppercase tracking-widest px-1",children:[e.jsx("span",{children:"Traffic Volume â"}),e.jsx("span",{className:"text-right",children:"Revenue Generation â"})]})]})})]}),e.jsxs(g,{className:"lg:col-span-4 bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50",children:e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(Ls,{className:"h-5 w-5 text-indigo-500"}),"Acquisition Cost Analysis"]})}),e.jsx(b,{className:"pt-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-slate-900 text-white",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Paid Ad Spend"})}),e.jsx(V,{className:"bg-slate-500/20 text-slate-400 border-none text-[8px] font-black uppercase px-2 h-4 italic",children:"No Spend Data"})]}),e.jsx("h3",{className:"text-2xl font-black italic mb-4",children:"$0.00"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase mb-1",children:e.jsx(i,{term:"ROAS"})}),e.jsx("p",{className:"text-lg font-black text-slate-400 leading-none italic",children:"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase mb-1",children:e.jsx(i,{term:"CAC",children:"CAC (Paid)"})}),e.jsx("p",{className:"text-lg font-black text-slate-400 leading-none italic",children:"N/A"})]})]})]}),e.jsx("div",{className:"space-y-3",children:[{label:"Cost per Signup",value:"N/A"},{label:"Cost per Trial",value:"N/A"},{label:"Cost per Paid User",value:"N/A"}].map((t,l)=>e.jsxs("div",{className:"flex justify-between items-end border-b border-slate-100 pb-2",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest leading-none",children:e.jsx(i,{term:t.label})}),e.jsx("p",{className:"text-sm font-black text-slate-900 leading-none",children:t.value})]},l))})]})})]}),e.jsxs(g,{className:"lg:col-span-12 bg-indigo-950 border-indigo-900 shadow-2xl relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-8 opacity-10",children:e.jsx(pt,{className:"h-32 w-32 text-indigo-400"})}),e.jsx(v,{className:"pb-4 border-b border-indigo-900/50",children:e.jsxs(y,{className:"text-indigo-100 text-lg font-bold flex items-center gap-2",children:[e.jsx(ks,{className:"h-5 w-5 text-indigo-400"}),"Growth Strategy Intelligence"]})}),e.jsx(b,{className:"pt-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-black text-indigo-400 uppercase tracking-widest",children:"Best Performing Source"}),e.jsxs("p",{className:"text-sm text-indigo-100 font-medium leading-relaxed",children:[e.jsx("span",{className:"text-emerald-400 font-black italic",children:a==null?void 0:a.insights.topSource})," is driving your primary traffic volume with a ",((((Pe=a==null?void 0:a.table.find(t=>t.source===(a==null?void 0:a.insights.topSource)))==null?void 0:Pe.totalConv)??0)*100).toFixed(2),"% visitor-to-paid rate."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-black text-indigo-400 uppercase tracking-widest",children:"Highe
18st Quality Source"}),e.jsxs("p",{className:"text-sm text-indigo-100 font-medium leading-relaxed",children:[e.jsx("span",{className:"text-indigo-400 font-black italic",children:a==null?void 0:a.insights.topQualitySource})," has the highest overall quality score (",(Ue=a==null?void 0:a.table.find(t=>t.source===(a==null?void 0:a.insights.topQualitySource)))==null?void 0:Ue.qualityScore,") based on retention and conversion profiles."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-black text-indigo-400 uppercase tracking-widest",children:"Conversion Efficiency"}),e.jsxs("p",{className:"text-sm text-indigo-100 font-medium leading-relaxed",children:["The blended LTV across all channels is ",e.jsxs("span",{className:"text-emerald-400 font-black italic",children:["$",a==null?void 0:a.summary.avgLtv]}),". Sources below this threshold may require funnel optimization."]})]})]})})]})]})]}),e.jsxs(te,{value:"activation",className:"space-y-6 outline-none",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(g,{className:"bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Feature Registration Intent"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"What users actually want to do when they sign up"})]}),e.jsx(b,{className:"h-[300px] pt-6 flex justify-center",children:Ce?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(xe,{className:"h-8 w-8 animate-spin text-indigo-400"})}):e.jsx(_,{width:"100%",height:"100%",children:e.jsxs(Ss,{children:[e.jsx(ht,{data:(Y==null?void 0:Y.goals)||[],dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",innerRadius:60,outerRadius:100,fill:"#6366f1",label:({name:t,percent:l})=>`${t} ${(l*100).toFixed(0)}%`,children:((Y==null?void 0:Y.goals)||[]).map((t,l)=>{const n=["#6366f1","#10b981","#f59e0b","#ec4899","#8b5cf6","#3b82f6"];return e.jsx(Le,{fill:n[l%n.length]},`cell-${l}`)})}),e.jsx(Q,{contentStyle:{borderRadius:"8px",border:"1px solid #e2e8f0"}})]})})})]}),e.jsxs(g,{className:"bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Job Search Urgency"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"How urgently users need our tools"})]}),e.jsx(b,{className:"h-[300px] pt-6",children:Ce?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(xe,{className:"h-8 w-8 animate-spin text-emerald-400"})}):e.jsx(_,{width:"100%",height:"100%",children:e.jsxs(re,{layout:"vertical",data:(Y==null?void 0:Y.urgency)||[],margin:{top:5,right:30,left:40,bottom:5},children:[e.jsx(Z,{type:"number",hide:!0}),e.jsx(X,{dataKey:"name",type:"category",stroke:"#94a3b8",fontSize:10,width:130}),e.jsx(Q,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)"}}),e.jsx(G,{dataKey:"value",fill:"#10b981",radius:[0,4,4,0],barSize:30,children:e.jsx(Ne,{dataKey:"value",position:"right",style:{fill:"#64748b",fontSize:"10px",fontWeight:"bold"}})})]})})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(g,{className:"bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"flex flex-row items-center justify-between border-b border-slate-50 pb-4",children:[e.jsxs("div",{children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:e.jsx(i,{term:"Path Efficiency",children:"Activation Behavioral Funnel"})}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"First-mile user behavior breakdown"})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-2xl font-black text-indigo-600 italic",children:[(Number(((De=f==null?void 0:f.activated24h)==null?void 0:De.rate)??0)*100).toFixed(1),"%",e.jsxs("span",{className:"text-xs ml-1 opacity-70",children:["(",(((Ve=f==null?void 0:f.activated24h)==null?void 0:Ve.count)??0).toLocaleStr
18ing(),")"]})]}),e.jsx("p",{className:"text-[10px] text-slate-400 font-black uppercase tracking-widest",children:e.jsx(i,{term:"Activated 24h",children:"24h SPEED"})})]})]}),e.jsxs(b,{className:"pt-6",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex justify-between items-center text-xs font-black text-slate-700 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(gt,{className:"h-4 w-4 text-purple-500"})," Generate First Resume"]}),e.jsxs("span",{className:"font-mono",children:[(Number((f==null?void 0:f.behaviorBreakdown.generateFirstResume.rate)??0)*100).toFixed(1),"% (",((f==null?void 0:f.behaviorBreakdown.generateFirstResume.count)??0).toLocaleString(),")"]})]}),e.jsx("div",{className:"h-1.5 w-full bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-purple-500",style:{width:`${((f==null?void 0:f.behaviorBreakdown.generateFirstResume.rate)??0)*100}%`}})}),e.jsxs("div",{className:"flex justify-between items-center text-xs font-black text-slate-700 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tt,{className:"h-4 w-4 text-emerald-500"})," Start Trial"]}),e.jsxs("span",{className:"font-mono",children:[(Number((f==null?void 0:f.behaviorBreakdown.startTrial.rate)??0)*100).toFixed(1),"% (",((f==null?void 0:f.behaviorBreakdown.startTrial.count)??0).toLocaleString(),")"]})]}),e.jsx("div",{className:"h-1.5 w-full bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${((f==null?void 0:f.behaviorBreakdown.startTrial.rate)??0)*100}%`}})})]}),e.jsxs("div",{className:"mt-6 p-4 bg-indigo-50 rounded-xl border border-indigo-100 text-xs text-slate-500 italic font-medium",children:["Median time to value: ",e.jsx("span",{className:"text-slate-900 font-bold",children:(f==null?void 0:f.medianSignupToFirstActionHours)<1?`${Math.round(f.medianSignupToFirstActionHours*60)} minutes`:`${f==null?void 0:f.medianSignupToFirstActionHours.toFixed(1)} hours`}),". Users who activate within 60 minutes are 3.2x more likely to convert."]})]})]}),e.jsxs(g,{className:"bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Drop-off Points"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"Where users abandon the first-mile journey"})]}),e.jsx(b,{className:"h-[300px] pt-6",children:e.jsx(_,{width:"100%",height:"100%",children:e.jsxs(re,{layout:"vertical",data:[{stage:"Signup -> Search",drop:12},{stage:"Search -> Build",drop:45},{stage:"Build -> Download",drop:28},{stage:"Download -> Trial",drop:62}],margin:{top:5,right:30,left:40,bottom:5},children:[e.jsx(Z,{type:"number",hide:!0}),e.jsx(X,{dataKey:"stage",type:"category",stroke:"#94a3b8",fontSize:10,width:80}),e.jsx(Q,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)"}}),e.jsx(G,{dataKey:"drop",fill:"#f472b6",radius:[0,4,4,0],barSize:20,children:e.jsx(Ne,{dataKey:"drop",position:"right",formatter:t=>`${t}% drop (${Math.round(t*((f==null?void 0:f.totalSignups)??(s==null?void 0:s.totalSignups)??2847)/100)})`,style:{fill:"#64748b",fontSize:"10px",fontWeight:"bold"}})})]})})})]})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:e.jsxs(g,{className:"lg:col-span-3 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"flex flex-row items-center justify-between border-b border-slate-50 pb-4",children:[e.jsxs("div",{children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"ICP Intelligence (Ideal Customer Profile)"}),e.jsx(F,{className:"text-slate-500 text-xs",children:"High-value user segment discovery"})]}),e.jsxs(I,{variant:"ghost",size:"sm",className:"text-indigo-600 text-[10px] font-bold uppercase tracking-widest hover:bg-indigo-50",children:["Full Segmentation ",e.jsx(Me,{className:"h-3 w-3 ml-1"})]})]}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:(k??[{segment:"LinkedIn",users:1250,trials:450,conversion:.12,icon:he},{segment:"Instagram",users:1080,trials:380,conversion:.1,icon:Cs},{segment:"TikTok",users:950,trials:290,conversion:.07,icon:ae},{segment:"Paid Ads",users:1450,trials:210,conversion:.05,icon:le}]).slice(0,4).map((t,l)=>e.jsxs("div",{className:`p-4 rounded-2xl border ${l===0?"bg-indigo-50 border-indigo-200":"bg-slate-50 border-slate-100"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[(()=>{const n=t.icon||(t.segment.includes("LinkedIn")?he:t.segment.includes("Instagram")?Cs:t.segment.includes("TikTok")?ae
18:t.segment.includes("Paid Ads")?le:he);return e.jsx(n,{className:`h-4 w-4 ${l===0?"text-indigo-600":"text-slate-400"}`})})(),e.jsx("span",{className:"text-xs font-black text-slate-700 uppercase truncate",children:t.segment})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-bold text-slate-400 uppercase mb-1",children:e.jsx(i,{term:"New Signups",children:"Signups"})}),e.jsx("p",{className:"text-xl font-black text-slate-900",children:t.users.toLocaleString()})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-bold text-slate-400 uppercase mb-0.5",children:e.jsx(i,{term:"SâT %",children:"Trial Rate"})}),e.jsxs("p",{className:"text-indigo-600 font-black",children:[(t.trials/t.users*100).toFixed(1),"%"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-bold text-slate-400 uppercase mb-0.5",children:e.jsx(i,{term:"Overall Conv.",children:"Conversion"})}),e.jsxs("p",{className:"text-emerald-600 font-black",children:[(t.conversion*100).toFixed(1),"%"]})]})]})]})]},l))})})]})})]}),e.jsxs(te,{value:"conversion",className:"space-y-6 outline-none",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsx(g,{className:"bg-white border-slate-200 shadow-sm",children:e.jsxs(b,{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Trial â Paid",children:"Trial â Paid Path"})}),e.jsxs("h4",{className:"text-2xl font-black text-slate-900",children:[((m==null?void 0:m.paths.trial.paid)??0).toLocaleString()," Users"]})]}),e.jsxs(V,{className:"bg-indigo-50 text-indigo-600 border-none font-bold",children:[(((m==null?void 0:m.paths.trial.rate)??0)*100).toFixed(1),"% (",((m==null?void 0:m.paths.trial.paid)??0).toLocaleString()," Users)"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-xs font-medium",children:[e.jsx("span",{className:"text-slate-500",children:"Active Trials"}),e.jsx("span",{className:"text-slate-900 font-bold",children:((m==null?void 0:m.paths.trial.volume)??0).toLocaleString()})]}),e.jsx(fe,{value:((m==null?void 0:m.paths.trial.rate)??0)*100,className:"h-1.5 bg-slate-100",indicatorClassName:"bg-indigo-500"}),e.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"Largest revenue contributor via premium upgrades."})]})]})}),e.jsx(g,{className:"bg-white border-slate-200 shadow-sm",children:e.jsxs(b,{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Magnet â Paid Path"})}),e.jsxs("h4",{className:"text-2xl font-black text-slate-900",children:[((m==null?void 0:m.paths.magnet.paid)??0).toLocaleString()," Users"]})]}),e.jsxs(V,{className:"bg-emerald-50 text-emerald-600 border-none font-bold",children:[(((m==null?void 0:m.paths.magnet.rate)??0)*100).toFixed(1),"% (",((m==null?void 0:m.paths.magnet.paid)??0).toLocaleString()," Users)"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-xs font-medium",children:[e.jsx("span",{className:"text-slate-500",children:"Lead Volume"}),e.jsx("span",{className:"text-slate-900 font-bold",children:((m==null?void 0:m.paths.magnet.volume)??0).toLocaleString()})]}),e.jsx(fe,{value:((m==null?void 0:m.paths.magnet.rate)??0)*100,className:"h-1.5 bg-slate-100",indicatorClassName:"bg-emerald-500"}),e.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"High-efficiency path for long-term nurturing."})]})]})}),e.jsx(g,{className:"bg-white border-slate-200 shadow-sm",children:e.jsxs(b,{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Direct Paid Path"})}),e.jsxs("h4",{className:"text-2xl font-black text-slate-900",children:[((m==null?void 0:m.paths.direct.paid)??0).toLocaleStr
18ing()," Users"]})]}),e.jsxs(V,{className:"bg-amber-50 text-amber-600 border-none font-bold",children:[(((m==null?void 0:m.paths.direct.rate)??0)*100).toFixed(1),"% (",((m==null?void 0:m.paths.direct.paid)??0).toLocaleString()," Users)"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-xs font-medium",children:[e.jsx("span",{className:"text-slate-500",children:e.jsx(i,{term:"Total Visitors"})}),e.jsx("span",{className:"text-slate-900 font-bold",children:((m==null?void 0:m.paths.direct.volume)??0).toLocaleString()})]}),e.jsx(fe,{value:((m==null?void 0:m.paths.direct.rate)??0)*100,className:"h-1.5 bg-slate-100",indicatorClassName:"bg-amber-500"}),e.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"Immediate conversion without nurturing/trial."})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsxs(g,{className:"lg:col-span-8 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Behavioral Conversion Impact"}),e.jsx(F,{className:"text-slate-500 text-xs",children:"How specific actions drive paid volume"})]}),e.jsx(b,{className:"pt-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"User Behavior / Action"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"User Volume"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Paid Count"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-indigo-600 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Micro-conversion",children:"Blended Rate"})})]})}),e.jsx("tbody",{className:"divide-y divide-slate-50",children:((m==null?void 0:m.correlation)??[{action:"Generated 3+ Resumes",volume:1450,paid:218,rate:"15.0% (218)"},{action:"Completed Profile 100%",volume:2240,paid:345,rate:"15.4% (345)"},{action:"Downloaded Resource",volume:850,paid:112,rate:"13.2% (112)"},{action:"Daily Login (5+ Days)",volume:620,paid:184,rate:"29.7% (184)"},{action:"Used AI Optimization",volume:1840,paid:195,rate:"10.6% (195)"}]).map((t,l)=>e.jsxs("tr",{className:"hover:bg-slate-50 transition-all",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsx("span",{className:"text-xs font-black text-slate-700",children:t.action})}),e.jsx("td",{className:"py-4 px-4 text-right text-slate-500 font-mono text-xs",children:t.volume.toLocaleString()}),e.jsx("td",{className:"py-4 px-4 text-right text-slate-900 font-black text-xs",children:t.paid.toLocaleString()}),e.jsx("td",{className:"py-4 px-4 text-right text-indigo-600 font-black text-xs",children:t.rate})]},l))})]})})})]}),e.jsxs(g,{className:"lg:col-span-4 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Source Paid Conversion"}),e.jsx(F,{className:"text-slate-500 text-xs",children:"Final paid counts by acquisition channel"})]}),e.jsx(b,{className:"pt-6 space-y-5",children:(()=>{var p;const t=[...(a==null?void 0:a.table)||[]].filter(x=>x.paid>0).sort((x,N)=>N.paid-x.paid).slice(0,4),l=["bg-indigo-500","bg-rose-500","bg-amber-500","bg-emerald-500","bg-slate-900"],n=((p=a==null?void 0:a.summary)==null?void 0:p.totalPaid)||1,o=t.length>0?t[0]:null,c=o?Math.round(o.paid/n*100):0;return e.jsxs(e.Fragment,{children:[t.map((x,N)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-end",children:[e.jsx("span",{className:"text-[10px] font-black text-slate-500 uppercase",children:e.jsx(i,{term:"Source",children:x.source})}),e.jsxs("span",{className:"text-xs font-black text-slate-900",children:[x.paid.toLocaleStr
18ing()," ",e.jsxs("span",{className:"text-[10px] text-slate-400 font-medium",children:["/ ",x.visitors.toLocaleString()]})]})]}),e.jsx("div",{className:"h-2 w-full bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full ${l[N%l.length]}`,style:{width:`${Math.min(100,x.paid/(x.visitors||1)*100*5)}%`}})})]},N)),o&&e.jsx("div",{className:"mt-4 p-4 bg-indigo-50 rounded-xl border border-indigo-100",children:e.jsxs("p",{className:"text-[10px] text-slate-600 font-bold leading-relaxed",children:[e.jsx(ae,{className:"h-3 w-3 inline mr-1 mb-0.5 text-indigo-600"}),e.jsx("span",{className:"capitalize",children:o.source})," accounts for ",e.jsxs("span",{className:"text-indigo-600 font-black",children:[c,"%"]})," of total monthly paid conversions."]})})]})})()})]})]}),e.jsxs(g,{className:"bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ks,{className:"h-5 w-5 text-amber-500"}),e.jsx(y,{className:"text-slate-900 text-lg font-bold tracking-tight",children:"Conversion Correlation Analytics"})]}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"Propensity to convert based on feature engagement depth"})]}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"h-[250px]",children:e.jsx(_,{width:"100%",height:"100%",children:e.jsxs(re,{data:(m==null?void 0:m.correlation)??[{behavior:"Multi-Resume",rate:.126},{behavior:"Profile Completion",rate:.154},{behavior:"Resource Download",rate:.082},{behavior:"Daily Login",rate:.051}],margin:{top:20,right:30,left:20,bottom:5},children:[e.jsx(ne,{strokeDasharray:"3 3",stroke:"#f1f5f9",vertical:!1}),e.jsx(Z,{dataKey:"behavior",stroke:"#94a3b8",fontSize:10,axisLine:!1,tickLine:!1}),e.jsx(X,{stroke:"#475569",fontSize:10,axisLine:!1,tickLine:!1,tickFormatter:t=>`${(t*100).toFixed(0)}%`}),e.jsx(Q,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)"},formatter:t=>[`${(t*100).toFixed(1)}% Conversion (${Math.round(t*412)})`,"Rate"]}),e.jsx(G,{dataKey:"rate",fill:"#6366f1",radius:[4,4,0,0],barSize:40})]})})})})]})]}),e.jsxs(te,{value:"engagement",className:"space-y-6 outline-none",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-indigo-50 border border-indigo-100 rounded-full",children:[e.jsx(Re,{className:"h-3.5 w-3.5 text-indigo-600"}),e.jsxs("span",{className:"text-[10px] font-black text-indigo-600 uppercase tracking-widest",children:["Current View: ",M==="paid"?"Paid Users":"All Registered Users"," (",D(u),")"]})]}),e.jsx(I,{variant:"outline",size:"sm",className:`h-8 text-[10px] font-black uppercase tracking-widest ${M==="all"?"bg-indigo-600 text-white hover:bg-indigo-700":"border-slate-200 text-slate-500 hover:bg-slate-50"}`,onClick:()=>T(M==="paid"?"all":"paid"),children:M==="paid"?"Switch to All Users":"Switch to Paid Users"})]}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-4",children:(()=>{var S;const t=(r==null?void 0:r.dau)||0,l=(r==null?void 0:r.wau)||0;r!=null&&r.mau;const n=(r==null?void 0:r.stickiness)||0,o=(r==null?void 0:r.avgSessionMinutes)||0,c=`${(n*100).toFixed(1)}%`,p=`${Math.floor(o)}:${Math.round(o%1*60).toString().padStart(2,"0")}`,x=((S=r==null?void 0:r.sessionTrends)==null?void 0:S.slice(0,9).reverse().map(C=>({value:C.users})))||[],N=x.length>0?x:[{value:0}];return[{label:"DAU",value:t.toLocaleString(),trend:"",color:"#22c55e",data:N},{label:"WAU",value:l.toLocaleString(),trend:"",color:"#a855f7",data:N},{label:"Stickiness",value:`${c} (${t} DAU)`,trend:n>.2?"Strong":"Weak",color:n>.2?"#22c55e":"#f43f5e",data:N},{label:"Session Time",value:p,trend:"",color:"#6366f1",data:N},{label:"Sessions/Paid",value:((r==null?void 0:r.sessionsPerUser)||0).toFixed(1),trend:"",color:"#6366f1",data:N}].map((C,L)=>e.jsx(g,{className:"bg-white border-slate-100 shadow-sm overflow-hidden",children:e.jsxs(b,{className:"p-4",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:C.label})}),e.jsxs("div",{className:"flex items-end justify-between mb-2",children:[e.jsx("h4",{className:"text-xl font-black text-slate-900 tracking-tighter",children:C.value}),e.jsx("span",{className:`text-[10px] font-black ${C.label==="Stickiness"&&n<.15?"text-rose-600":C.label==="Stickiness"&&n>=.25?"text-emerald-600":"text-slate-500"}`,children:C.trend})]}),e.jsx(ie,{data:C.data,color:C.color})]})},L))})()}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsxs(g,{className:"lg:col-span-8 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"How Often Paid Users Log In"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium italic",children:"Active days distribution per monthly cycle"})]}),e.jsx(b,{className:"pt-6",children:(()=>{var p,x,N,S,C,L,E,O;const t=(r==null?void 0:r.activeDaysDistribution)||[],l=((p=t.find(R=>R.group==="1-2 Days"))==null?void 0:p.percent)||0,n=((x=t.find(R=>R.group==="3-5 Days"))==null?void 0:x.percent)||0,o=((N=t.find(R=>R.group==="6-10 Days"))==null?void 0:N.percent)||0,c=((S=t.find(R=>R.group==="10+ Days"))==null?void 0:S.percent)||0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6 mb-8",children:[e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-50 border border-slate-100",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Session Frequency",children:"Avg Active Days"})}),e.jsxs("h5",{className:"text-2xl font-black text-slate-900",children:[((r==null?void 0:r.sessionsPerUser)||0).toFixed(1)," Days"]})]}),e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-50 border border-slate-100",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Session Depth",children:"% > 5 Days"})}),e.jsxs("h5",{className:"text-2xl font-black text-slate-900",children:[o+c,"%"]})]}),e.jsxs("div",{className:"p-4 rounded-2xl bg-indigo-50 border border-indigo-100 lg:col-span-2",children:[e.jsx("p",{className:"text-[9px] font-black text-indigo-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Habit Threshold",children:"Power User Threshold"})}),e.jsxs("h5",{className:"text-sm font-black text-indigo-800 leading-tight",children:["Paid users with 10+ active days correlate with ",e.jsx("span",{className:"text-indigo-600 italic",children:"highest renewal probability."})]})]})]}),e.jsx("div",{className:"h-[250px]",children:e.jsx(_,{width:"100%",height:"100%",children:e.jsxs(re,{data:[{group:"1-2 Days",percent:l,count:((C=t.find(R=>R.group==="1-2 Days"))==null?void 0:C.count)||0},{group:"3-5 Days",percent:n,count:((L=t.find(R=>R.group==="3-5 Days"))==null?void 0:L.count)||0},{group:"6-10 Days",percent:o,count:((E=t.find(R=>
18R.group==="6-10 Days"))==null?void 0:E.count)||0},{group:"10+ Days",percent:c,count:((O=t.find(R=>R.group==="10+ Days"))==null?void 0:O.count)||0}],margin:{top:20,right:30,left:0,bottom:0},children:[e.jsx(ne,{strokeDasharray:"3 3",stroke:"#f1f5f9",vertical:!1}),e.jsx(Z,{dataKey:"group",stroke:"#94a3b8",fontSize:10,axisLine:!1,tickLine:!1}),e.jsx(X,{stroke:"#475569",fontSize:10,axisLine:!1,tickLine:!1,tickFormatter:R=>`${R}%`}),e.jsx(Q,{cursor:{fill:"#f8fafc"},contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)"},formatter:(R,se,je)=>[`${R}% of Users (${je.payload.count})`,"Share"]}),e.jsxs(G,{dataKey:"percent",radius:[4,4,0,0],barSize:50,children:[[l,n,o,c].map((R,se)=>e.jsx(Le,{fill:se===0?"#94a3b8":se===1?"#6366f1":se===2?"#4f46e5":"#3730a3"},`cell-${se}`)),e.jsx(Ne,{dataKey:"percent",position:"top",formatter:R=>`${R}%`,style:{fontSize:"10px",fontWeight:"bold",fill:"#64748b"}})]})]})})})]})})()})]}),e.jsxs(g,{className:"lg:col-span-4 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Feature Usage (Paid)"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"Ranked by unique user adoption"})]}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"space-y-5",children:(()=>{const t=(r==null?void 0:r.mau)||1,l=(r==null?void 0:r.featureUsage)||[];return l.length===0?e.jsx("p",{className:"text-slate-500 italic text-sm py-4",children:"No feature usage data available."}):l.map((n,o)=>{const c=Math.min(100,Math.round(Number(n.unique_users)/t*100))||0,p=(Number(n.usage_count)/Math.max(1,Number(n.unique_users))).toFixed(1),x=c>50?"Leader":c>20?"Core":c>5?"Secondary":"Underused",N=n.feature.split("_").map(S=>S.charAt(0).toUpperCase()+S.slice(1)).join(" ");return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex justify-between items-end mb-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Feature",children:N})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-lg font-black text-slate-900",children:[c,"% (",n.unique_users,")"]}),e.jsx(V,{className:`text-[8px] font-black uppercase px-1.5 py-0 h-4 border-none ${x==="Leader"?"bg-indigo-600 text-white":x==="Underused"?"bg-rose-50 text-rose-600":"bg-slate-100 text-slate-500"}`,children:x})]})]}),e.jsx("div",{className:"text-right",children:e.jsx("p",{className:"text-[9px] font-bold text-slate-400 uppercase",children:e.jsx(i,{term:"Uses/Mo",children:`${p} Uses/Mo`})})})]}),e.jsx("div",{className:"h-1.5 w-full bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full ${o===0?"bg-indigo-500":o===3?"bg-rose-400":"bg-slate-300"}`,style:{width:`${c}%`}})})]},o)})})()})})]}),e.jsxs(g,{className:"lg:col-span-12 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"flex flex-row items-center justify-between border-b border-slate-50 pb-4",children:[e.jsxs("div",{children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Engagement Trend: Paid Users"}),e.jsx(F,{className:"text-slate-500 text-xs",children:"Propensity of DAU/WAU/MAU slope direction"})]}),e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-emerald-50 border border-emerald-100 rounded-full",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),e.jsx("span",{className:"text-[9px] font-black text-emerald-800 uppercase tracking-widest",children:"Trend Status: Increasing"})]})]}),e.jsx(b,{className:"pt-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-8",children:[e.jsx("div",{className:"lg:col-span-3 h-[300px]",children:e.jsx(_,{width:"100%",height:"100%",children:e.jsxs(Fe,{data:((qe=r==null?void 0:r.sessionTrends)==null?void 0:qe.slice(0,30).reverse())||[],children:[e.jsx(ne,{strokeDasharray:"3 3",stroke:"#f1f5f9",vertical:!1}
18),e.jsx(Z,{dataKey:"date",stroke:"#94a3b8",fontSize:10,axisLine:!1,tickLine:!1,tickFormatter:t=>t.split("-").slice(1).join("/")}),e.jsx(X,{stroke:"#475569",fontSize:10,axisLine:!1,tickLine:!1}),e.jsx(Q,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px"}}),e.jsx(ye,{type:"monotone",name:"Users",dataKey:"users",stroke:"#6366f1",strokeWidth:4,dot:!1}),e.jsx(ye,{type:"monotone",name:"Sessions",dataKey:"sessions",stroke:"#a855f7",strokeWidth:3,dot:!1})]})})}),e.jsxs("div",{className:"space-y-6 lg:border-l lg:border-slate-100 lg:pl-8",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Platform Time Allocation"})}),e.jsx("div",{className:"space-y-4",children:(()=>{var c;const t=(r==null?void 0:r.featureUsage)||[],l=t.reduce((p,x)=>p+Number(x.usage_count),0),o=((r==null?void 0:r.avgSessionMinutes)||0)*(((c=r==null?void 0:r.sessionTrends)==null?void 0:c.reduce((p,x)=>p+Number(x.sessions),0))||0)/60;return t.slice(0,4).map((p,x)=>{const N=l>0?Math.round(Number(p.usage_count)/l*100):0,S=(o*(N/100)).toFixed(0),C=p.feature.split("_").map(L=>L.charAt(0).toUpperCase()+L.slice(1)).join(" ");return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"font-bold text-slate-700",children:e.jsx(i,{term:"Feature",children:C})}),e.jsxs("span",{className:"font-black text-indigo-600",children:[N,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 flex-1 bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-indigo-500",style:{width:`${N}%`}})}),e.jsxs("span",{className:"text-[9px] font-bold text-slate-400 w-10 text-right",children:[S,"h"]})]})]},x)})})()}),(()=>{var c,p;const t=(c=r==null?void 0:r.featureUsage)==null?void 0:c[0];if(!t)return null;const l=t.feature.split("_").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" "),n=((p=r==null?void 0:r.featureUsage)==null?void 0:p.reduce((x,N)=>x+Number(N.usage_count),0))||1,o=Math.round(Number(t.usage_count)/n*100);return e.jsx("div",{className:"pt-4 p-4 bg-slate-50 rounded-xl border border-slate-100",children:e.jsxs("p",{className:"text-[10px] text-slate-500 font-bold leading-relaxed italic",children:[l," anchors ",e.jsxs("span",{className:"text-slate-900 font-black",children:[o,"%"]})," of all tracked feature engagement."]})})})()]})]})})]}),e.jsxs(g,{className:"lg:col-span-12 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Days Active per Paid User"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"Monthly cycle depth by user quartiles"})]}),e.jsx(b,{className:"pt-6",children:(()=>{const t=(r==null?void 0:r.activityQuartiles)||{p25:0,p50:0,p75:0,max:0},l=Math.min(100,t.p25/30*100),n=Math.min(100,t.p50/30*100),o=Math.min(100,t.p75/30*100),c=Math.min(100,t.max/30*100);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 mb-8",children:[e.jsxs("div",{className:"text-center flex-1",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase mb-1",children:e.jsx(i,{term:"Top 25% (Power)"})}),e.jsxs("p",{className:"text-2xl font-black text-emerald-600",children:[t.p75.toFixed(1),"d"]})]}),e.jsx("div",{className:"h-8 w-px bg-slate-100"}),e.jsxs("div",{className:"text-center flex-1",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase mb-1",children:e.jsx(i,{term:"Median (Core)"})}),e.jsxs("p",{className:"text-2xl font-black text-slate-900",children:[t.p50.toFixed(1),"d"]})]}),e.jsx("div",{className:"h-8 w-px bg-slate-100"}),e.jsxs("div",{className:"text-center flex-1",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase mb-1",children:e.jsx(i,{term:"Bottom 25% (Risk)"})}),e.jsxs("p",{className:"text-2xl font-black text-rose-600",children:[t.p25.toFixed(1),"d"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative h-12 w-full flex items-center px-2",children:[e.jsx("div",{className:"absolute inset-x-0 h-4 bg-slate-100 rounded-full"}),e.jsx("div",{className:"absolute h-6 bg-indigo-500/20 border-x-2 border-indigo-500 rounded-sm",style:{left:`${l}%`,right:`${100-o}%`}}),e.jsx("div",{className:"absolute h-8 w-1 bg-indigo-600 z-10",style:{left:`${n}%`}}),e.jsx("div",{className:"absolute h-2 w-2 rounded-full bg-slate-400",style:{left:"2%"}}),e.jsx("div",{className:"absolute h-2 w-2 rounded-full bg-indigo-600",style:{left:`${c-1}%`}})]}),e.jsxs("div",{className:"flex justify-between text-[9px] font-black text-slate-400 uppercase px-2",children:[e.jsx("span",{children:"0 Days"}),e.jsxs("span",{children:["Median (",t.p50.toFixed(1),")"]}),e.jsxs("span",{children:["Max (",t.max,")"]})]})]})]})})()})]}),e.jsxs(g,{className:"lg:col-span-12 bg-indigo-950 border-indigo-900 shadow-2xl relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-8 opacity-10",children:e.jsx(ae,{className:"h-32 w-32 text-indigo-400"})}),e.jsx(v,{className:"pb-4 border-b border-indigo-900/50",children:e.jsxs(y,{className:"text-indigo-100 text-lg font-bold flex items-center gap-2",children:[e.jsx(ue,{className:"h-5 w-5 text-indigo-400"}),"Executive Engagement Insights"]})}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:(()=>{var S,C,L,E;const l=(((C=(S=r==null?void 0:r.featureUsage)==null?void 0:S[0])==null?void 0:C.feature)||"Core Features").split("_").map(O=>O.charAt(0).toUpperCase()+O.slice(1)).join(" "),o=(((r==null?void 0:r.stickiness)||0)*100).toFixed(1),c=(L=r==null?void 0:r.churnCorrelation)==null?void 0:L.find(O=>O.layer.includes("< 3")),p=(c==null?void 0:c.churned_users)||0,x=(c==null?void 0:c.total_users)||1,N=Number(x)>0?(Number(p)/Number(x)*100).toFixed(1):"0.0";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"h-6 w-1 rounded-full bg-emerald-500"}),e.jsx("p",{className:"text-[10px] font-black text-emerald-400 uppercase tracking-widest",children:"Growth Lever"})]}),e.jsxs("p",{className:"text-sm text-indigo-100 font-medium leading-relaxed",children:["Users using ",e.jsx("span",{className:"text-emerald-400 font-black italic underline decoration-dotted",children:l})," are the most engaged segment with ",e.jsxs("span",{className:"text-emerald-400 font-black",children:[o,"%"]})," stickiness."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"h-6 w-1 rounded-full bg-rose-500"}),e.jsx("p",{className:"text-[10px] font-black text-rose-400 uppercase tracking-widest",children:"Risk Alert"}),e.jsx(V,{className:"bg-rose-500/20 text-rose-400 text-[8px] font-black border-none h-4 px-1.5 uppercase",children:"Action Required"})]}),e.jsxs("p",{className:"text-sm text-indigo-100 font-medium leading-relaxed",children:["Low activity users (< 3 days) show a ",e.jsxs("span",{className:"text-rose-400 font-black",children:[N,"% churn propensity"]}),". Re-engagement campaigns recommended."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"h-6 w-1 rounded-full bg-indigo-500"}),e.jsx("p",{className:"text-[10px] font-black text-indigo-400 uppercase tracking-widest",children:"Sticky Habit"})]}),e.jsxs("p",{className:"text-sm text-indigo-100 font-medium leading-relaxed",children:["Average session time is ",e.jsxs("span",{className:"text-indigo-400 font-black",children:[((E=r==null?void 0:r.avgSessionMinutes)==null?void 0:E.toFixed(1))||0,"m"]}),". Focus on increasing multi-feature sessions to improve retention."]})]})]})})()})})]})]})]}),e.jsxs(te,{value:"retention",className:"space-y-6 outline-none",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-rose-50 border border-rose-100 rounded-full",children:[e.jsx(ve,{className:"h-3.5 w-3.5 text-rose-600"}),e.jsxs("span",{className:"text-[10px] font-black text-rose-600 uppercase tracking-widest",children:["Default View: Paid Subscribers (",D(u),")"]})]}),e.jsx(I,{variant:"outline",size:"sm",className:"h-8 text-[10px] font-black uppercase tracking-widest border-slate-200 text-slate-500 hover:bg-slate-50",children:"Apply Filter: All Users"})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:(()=>{const t=(d==null?void 0:d.logoChurnRate)||0,l=(d==null?void 0:d.revenueChurnRate)||0,n=(d==null?void 0:d.arpu)||0,o=(d==null?void 0:d.ltv)||0,c=(d==null?void 0:d.avgSubscriptionDuration)||0,p=(d==null?void 0:d.medianSubscriptionDuration)||0;return[{label:"Avg Sub Duration",value:`${c.toFixed(1)}m`,trend:"",color:"#22c55e",data:[{value:c},{value:c*1.05},{value:c}]},{label:"Median Sub Duration",value:`${p.toFixed(1)}m`,trend:"",color:"#6366f1",data:[{value:p},{value:p},{value:p*1.1}]},{label:"Logo Churn Rate",value:`${(t*100).toFixed(1)}%`,trend:t>
18.05?"High Risk":"Healthy",color:"#22c55e",data:[{value:t*1.2},{value:t*1.1},{value:t}]},{label:"Rev. Churn Rate",value:`${(l*100).toFixed(1)}%`,sub:"",trend:"",color:"#22c55e",data:[{value:l},{value:l*.9},{value:l}]},{label:"ARPU",value:`$${n.toFixed(1)}`,trend:"",color:"#22c55e",data:[{value:n},{value:n},{value:n}]},{label:"Customer LTV",value:`$${o.toFixed(0)}`,trend:"",color:"#6366f1",data:[{value:o},{value:o},{value:o}]}].map((x,N)=>e.jsx(g,{className:"bg-white border-slate-100 shadow-sm overflow-hidden",children:e.jsxs(b,{className:"p-4",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:x.label})}),e.jsxs("div",{className:"flex items-end justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xl font-black text-slate-900 tracking-tighter leading-none",children:x.value}),x.sub&&e.jsx("p",{className:"text-[9px] font-bold text-rose-500 mt-1",children:x.sub})]}),e.jsx("span",{className:`text-[10px] font-black ${x.label==="Logo Churn Rate"&&t>.05?"text-rose-600":"text-emerald-600"}`,children:x.trend})]}),e.jsx(ie,{data:x.data,color:x.color})]})},N))})()}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsxs(g,{className:"lg:col-span-4 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Churn Timing Distribution"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium italic",children:"When do paid subscribers drop off?"})]}),e.jsxs(b,{className:"pt-6",children:[e.jsx("div",{className:"space-y-6",children:(()=>{var c,p,x,N,S,C;const t=((p=(c=d==null?void 0:d.churnByMonth)==null?void 0:c[0])==null?void 0:p.rate)||0,l=((N=(x=d==null?void 0:d.churnByMonth)==null?void 0:x[1])==null?void 0:N.rate)||0,n=((C=(S=d==null?void 0:d.churnByMonth)==null?void 0:S[2])==null?void 0:C.rate)||0,o=Math.max(0,1-(t+l+n));return[{label:"Within 1 Month",value:`${(t*100).toFixed(1)}%`,color:"bg-rose-500",status:t>.3?"Highest Risk":""},{label:"Within 2 Months",value:`${(l*100).toFixed(1)}%`,color:"bg-rose-400",status:""},{label:"Within 3 Months",value:`${(n*100).toFixed(1)}%`,color:"bg-amber-400",status:""},{label:"After 3+ Months",value:`${(o*100).toFixed(1)}%`,color:"bg-emerald-500",status:"Healthy"}].map((L,E)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Churn Timing",children:L.label})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-black text-slate-900",children:L.value}),L.status&&e.jsx(V,{className:`text-[8px] font-black uppercase px-1.5 py-0 h-4 border-none ${L.status==="Highest Risk"?"bg-rose-600 text-white":"bg-emerald-50 text-emerald-600"}`,children:L.status})]})]}),e.jsx("div",{className:"h-2 w-full bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full ${L.color}`,style:{width:L.value}})})]},E))})()}),e.jsx("div",{className:"mt-8 p-4 bg-rose-50 rounded-2xl border border-rose-100 shadow-sm",children:e.jsxs("p",{className:"text-[10px] text-rose-800 font-bold leading-relaxed italic",children:[e.jsx("span",{className:"font-black underline uppercase",children:"Leak Alert:"})," ",((((Be=(ze=d==null?void 0:d.churnByMonth)==null?void 0:ze[0])==null?void 0:Be.rate)||0)*100).toFixed(1),"% of churn occurs in Month 1. Correlates with ",e.jsx("span",{className:"font-black italic",children:'"Single Resume optimization"'})," syndrome."]})})]})]}),e.jsxs(g,{className:"lg:col-span-8 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"flex flex-row items-center justify-between border-b border-slate-50 pb-4",children:[e.jsxs("div",{children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Cohort Retention by Signup Month"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"Monthly persistence breakdown (M0-M5)"})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-[10px] font-black text-indigo-400 uppercase tracking-widest mb-1",children:"Top Cohort"}),e.jsx("p",{className:"text-sm font-black text-indigo-600 italic",children:"Oct 2025 (42% @ M5)"})]})]}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-[10px] border-separate border-spacing-1",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-2 px-2 text-left text-slate-400 uppercase font-black tracking-widest",children:e.jsx(i,{term:"Cohort"})}),["M0","M1","M2","M3","M4","M5"].map(t=>e.jsx("th",{className:"py-2 px-2 text-center text-slate-400 uppercase font-black tracking-widest",children:e.jsx(i,{term:"Month",children:t})},t))]})}),e.jsx("tbody",{children:(()=>
18{if(!(d!=null&&d.cohortRetention))return null;const l=d.cohortRetention.reduce((o,c)=>(o[c.cohortMonth]||(o[c.cohortMonth]=[]),o[c.cohortMonth].push(c),o),{});return Object.entries(l).map(([o,c])=>{var N;const p=((N=c[0])==null?void 0:N.retainedUsers)||1,x=[];for(let S=0;S<6;S++){const C=c[S];C?x.push(Math.round(C.retainedUsers/p*100)):x.push(0)}return{month:o,retention:x}}).sort((o,c)=>new Date(c.month).getTime()-new Date(o.month).getTime()).slice(0,4).map((o,c)=>e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 px-3 font-black text-slate-700 italic border border-slate-50 bg-slate-50/50 rounded-lg",children:o.month}),o.retention.map((p,x)=>e.jsx("td",{className:"p-1",children:e.jsx("div",{className:`py-3 rounded-lg font-black text-center shadow-sm ${p>70?"text-white":p>0?"text-slate-600":"text-transparent"}`,style:{backgroundColor:p>0?`rgba(99, 102, 241, ${Math.max(.1,p/100)})`:"transparent"},children:p>0&&e.jsxs("div",{className:"leading-tight",children:[p,"%",e.jsxs("div",{className:"text-[8px] opacity-70 font-medium",children:["(",p,")"]})]})})},x))]},c))})()})]})})})]}),e.jsxs(g,{className:"lg:col-span-12 bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"flex flex-row items-center justify-between border-b border-slate-50 pb-4",children:e.jsxs("div",{children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Persistence â Revenue Movement"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium italic",children:"Mapping survival probability to MRR changes"})]})}),e.jsx(b,{className:"pt-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-end mb-2",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Survival Curve (% Retained)"})}),e.jsx(V,{className:"bg-rose-50 text-rose-600 border-none text-[8px] font-black uppercase",children:"Trend: Decelerating"})]}),e.jsx("div",{className:"h-[250px]",children:e.jsx(_,{width:"100%",height:"100%",children:(()=>{var x,N,S,C,L,E;const t=100*(1-(((N=(x=d==null?void 0:d.churnByMonth)==null?void 0:x[0])==null?void 0:N.rate)||0)),l=t*(1-(((C=(S=d==null?void 0:d.churnByMonth)==null?void 0:S[1])==null?void 0:C.rate)||0)),n=l*(1-(((E=(L=d==null?void 0:d.churnByMonth)==null?void 0:L[2])==null?void 0:E.rate)||0)),o=n*.95,c=o*.95,p=[{m:0,avg:100},{m:1,avg:Math.max(0,Math.round(t))},{m:2,avg:Math.max(0,Math.round(l))},{m:3,avg:Math.max(0,Math.round(n))},{m:4,avg:Math.max(0,Math.round(o))},{m:5,avg:Math.max(0,Math.round(c))}];return e.jsxs(Fe,{data:p,children:[e.jsx(ne,{strokeDasharray:"3 3",stroke:"#f1f5f9",vertical:!1}),e.jsx(Z,{dataKey:"m",stroke:"#94a3b8",fontSize:10,axisLine:!1,tickLine:!1,label:{value:"Months Since Signup",position:"insideBottom",offset:-5,fontSize:9,fontWeight:"bold"}}),e.jsx(X,{stroke:"#475569",fontSize:10,axisLine:!1,tickLine:!1,tickFormatter:O=>`${O}%`}),e.jsx(Q,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px"}}),e.jsx(Fs,{wrapperStyle:{fontSize:"10px",fontWeight:"bold",paddingTop:"20px"}}),e.jsx(ye,{type:"monotone",name:"Avg Stability",dataKey:"avg",stroke:"#64748b",strokeWidth:3,dot:!1,strokeDasharray:"5 5"})]})})()})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-end mb-2",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Monthly Revenue Movement"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-emerald-500"}),e.jsx("span",{className:"text-[9px] font-black text-slate-600 uppercase",children:"Compounding"})]})]}),e.jsx("div",{className:"h-[250px]",children:e.jsx(_,{width:"100%",height:"100%",children:e.jsxs(re,{data:[{name:"Oct",expansion:1200,contraction:-200,churn:-800,net:4500},{name:"Nov",expansion:1500,contraction:-300,churn:-900,net:4800},{name:"Dec",expansion:1800,contraction:-400,churn:-1200,net:5200},{name:"Jan",expansion:2200,contraction:-500,churn:-1500,net:5800}],children:[e.jsx(ne,{strokeDasharray:"3 3",stroke:"#f1f5f9",vertical:!1}
18),e.jsx(Z,{dataKey:"name",stroke:"#94a3b8",fontSize:10,axisLine:!1,tickLine:!1}),e.jsx(X,{stroke:"#475569",fontSize:10,axisLine:!1,tickLine:!1}),e.jsx(Q,{contentStyle:{backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px"},formatter:t=>[`$${Math.abs(t)}`,"Value"]}),e.jsx(G,{dataKey:"expansion",stackId:"a",fill:"#22c55e",radius:[2,2,0,0],barSize:40}),e.jsx(G,{dataKey:"contraction",stackId:"a",fill:"#f59e0b",radius:[0,0,0,0]}),e.jsx(G,{dataKey:"churn",stackId:"a",fill:"#f43f5e",radius:[0,0,2,2]})]})})}),e.jsxs("div",{className:"pt-4 p-4 bg-emerald-50 rounded-xl border border-emerald-100 italic font-medium text-[10px] text-emerald-800",children:[e.jsx("span",{className:"font-black underline uppercase",children:"Success:"})," Expansion revenue ($2.2k) now fully offsets Monthly Churn ($1.5k)."]})]})]})})]}),e.jsxs(g,{className:"lg:col-span-8 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Retention by Acquisition Source"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"LTV and churn profiling per channel"})]}),e.jsx(b,{className:"pt-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-[11px] text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{className:"py-3 px-4 text-slate-400 uppercase font-black tracking-widest",children:e.jsx(i,{term:"Source"})}),e.jsx("th",{className:"py-3 px-4 text-slate-400 uppercase font-black tracking-widest text-right",children:e.jsx(i,{term:"Avg Lifetime",children:"Avg Life"})}),e.jsx("th",{className:"py-3 px-4 text-slate-400 uppercase font-black tracking-widest text-right",children:e.jsx(i,{term:"Logo Churn"})}),e.jsx("th",{className:"py-3 px-4 text-slate-400 uppercase font-black tracking-widest text-right",children:e.jsx(i,{term:"LTV"})}),e.jsx("th",{className:"py-3 px-4 text-slate-400 uppercase font-black tracking-widest text-center",children:"Status"})]})}),e.jsx("tbody",{children:(()=>{const l=[...(a==null?void 0:a.table)||[]].filter(n=>n.paid>0).sort((n,o)=>o.ltv-n.ltv).slice(0,5);return l.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"py-4 text-center text-slate-500 italic",children:"No attribution data available for current period."})}):l.map((n,o)=>{var L;const c=`${(n.churn*100).toFixed(1)}%`,p=n.churn>.05,x=n.ltv>(((L=a==null?void 0:a.summary)==null?void 0:L.avgLtv)||100),N=n.churn>0?(1/n.churn).toFixed(1)+"m":"12.0m+",S=p?"High Churn":x?"High Retention":"Stable",C=S==="High Churn"?"bg-rose-50 text-rose-700":S==="High Retention"?"bg-emerald-50 text-emerald-700":"bg-blue-50 text-blue-700";return e.jsxs("tr",{className:"border-b border-slate-50 hover:bg-slate-50 transition-colors",children:[e.jsx("td",{className:"py-4 px-4 font-black text-slate-700 italic",children:n.source}),e.jsx("td",{className:"py-4 px-4 text-right font-bold text-slate-500",children:N}),e.jsx("td",{className:"py-4 px-4 text-right font-black text-rose-600",children:c}),e.jsxs("td",{className:"py-4 px-4 text-right text-indigo-600 font-black",children:["$",n.ltv.toLocaleString()]}),e.jsx("td",{className:"py-4 px-4 text-center",children:e.jsx(V,{className:`text-[9px] font-black tracking-widest uppercase border-none ${C}`,children:S})})]},o)})})()})]})})})]}),e.jsxs(g,{className:"lg:col-span-4 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsx(y,{className:"text-slate-900 text-lg font-bold",children:"Predictive Churn Signals"}),e.jsx(F,{className:"text-slate-500 text-xs font-medium italic",children:"Behavioral triggers for cancellation"})]}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"space-y-4",children:(()=>{const t=(d==null?void 0:d.logoChurnRate)||.05;return[{trigger:"< 3 Sessions in 30d",prob:`${Math.min(98,Math.round(t*1500))}%`,risk:"Critical",color:"bg-rose-600"},{trigger:"Inactive 14+ Days",prob:`${Math.min(85,Math.round(t*900))}
18%`,risk:"High",color:"bg-amber-500"},{trigger:"Zero AI Retouch Uses",prob:`${Math.min(45,Math.round(t*400))}%`,risk:"Moderate",color:"bg-slate-500"}].map((l,n)=>e.jsxs("div",{className:`p-4 rounded-xl border ${l.risk==="Critical"?"bg-rose-50 border-rose-100 shadow-sm":"bg-slate-50 border-slate-100"}`,children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-700 uppercase tracking-tight max-w-[120px]",children:e.jsx(i,{term:"Churn Trigger",children:l.trigger})}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:`text-xl font-black italic ${l.risk==="Critical"?"text-rose-600":"text-slate-900"}`,children:l.prob}),e.jsx("p",{className:"text-[8px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Probability"})})]})]}),e.jsx("div",{className:"h-1 w-full bg-white rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full ${l.color}`,style:{width:l.prob}})})]},n))})()})})]}),e.jsxs(g,{className:"lg:col-span-12 bg-slate-900 border-slate-800 shadow-2xl relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-8 opacity-10",children:e.jsx(ke,{className:"h-32 w-32 text-indigo-400"})}),e.jsx(v,{className:"pb-4 border-b border-slate-800",children:e.jsxs(y,{className:"text-slate-100 text-lg font-bold flex items-center gap-2",children:[e.jsx(le,{className:"h-5 w-5 text-emerald-400"}),"Executive Retention Intelligence"]})}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 text-white",children:(()=>{var l,n;const t=(((n=(l=d==null?void 0:d.churnByMonth)==null?void 0:l[0])==null?void 0:n.rate)||.22)*100;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"h-6 w-1 rounded-full bg-emerald-500"}),e.jsx("p",{className:"text-[10px] font-black text-emerald-400 uppercase tracking-widest",children:"Retention Strength"})]}),e.jsxs("p",{className:"text-sm text-slate-300 font-medium leading-relaxed",children:[e.jsx("span",{className:"text-emerald-400 font-black italic",children:"Platform Average"})," shows an overall ",e.jsxs("span",{className:"text-emerald-400 font-black",children:[(100-((d==null?void 0:d.logoChurnRate)||0)*100).toFixed(1),"%"]})," monthly retention rate."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"h-6 w-1 rounded-full bg-rose-500"}),e.jsx("p",{className:"text-[10px] font-black text-rose-400 uppercase tracking-widest",children:"Primary Leak"})]}),e.jsxs("p",{className:"text-sm text-slate-300 font-medium leading-relaxed",children:[e.jsxs("span",{className:"text-rose-400 font-black",children:[t.toFixed(1),"%"]})," of total churn occurs in first 30 days due to early dropoff behaviors."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"h-6 w-1 rounded-full bg-amber-500"}),e.jsx("p",{className:"text-[10px] font-black text-amber-400 uppercase tracking-widest",children:"Revenue Risk"})]}),e.jsxs("p",{className:"text-sm text-slate-300 font-medium leading-relaxed",children:["Median Subscription Duration is currently tracking at ",e.jsxs("span",{className:"text-amber-400 font-black italic",children:[((d==null?void 0:d.medianSubscriptionDuration)||0).toFixed(1)," months"]})," against historical benchmarks."]})]})]})})()})})]})]})]}),e.jsx(te,{value:"user-profiles",className:"space-y-6 outline-none",children:Ks?e.jsx("div",{className:"h-[400px] flex items-center justify-center",children:e.jsx(xe,{className:"h-8 w-8 text-indigo-500 animate-spin"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-slate-900 border border-slate-800 rounded-full",children:[e.jsx(le,{className:"h-3.5 w-3.5 text-indigo-400"}),e.jsxs("span",{className:"text-[10px] font-black text-slate-300 uppercase tracking-widest",children:["Strategic Targeting Engine: ",de==="paid"?"Paid Only":"All Users"]})]}),e.jsxs(I,{variant:"outline",size:"sm",className:`h-8 text-[10px] font-black uppercase tracking-widest ${de==="all"?"bg-indigo-50 border-indigo-200 text-indigo-700":"border-slate-200 text-slate-500 hover:bg-slate-50"}`,onClick:()=>Bs(de==="all"?"paid":"all"),children:["Filter: ",de==="all"?"All Users":"Paid Users"]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[{label:"Total Visitors",value:((h==null?void 0:h.snapshot.totalVisitors)||0).toLocaleStr
18ing(),sub:D(u),trend:"Stable",color:"text-slate-400"},{label:"LTV",value:`$${((h==null?void 0:h.snapshot.globalLtv)||0).toFixed(0)} Avg LTV`,sub:"ICP Performance",trend:"â Real Data",color:"text-emerald-500",term:"Top LTV Segment"},{label:"Overall Conv.",value:`${((h==null?void 0:h.snapshot.overallConv)||0).toFixed(1)}% CR`,sub:"Visitor to Paid",trend:"â Blended",color:"text-indigo-500",term:"Highest Converting"},{label:"Monthly Churn",value:`${(((h==null?void 0:h.snapshot.monthlyChurn)||.045)*100).toFixed(1)}% Churn`,sub:"Retention Risk",trend:"â Active",color:"text-rose-500",term:"Highest Churn"}].map((t,l)=>e.jsx(g,{className:"bg-white border-slate-100 shadow-sm",children:e.jsxs(b,{className:"p-4",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:t.label,children:t.term||t.label})}),e.jsx("h4",{className:"text-sm font-black text-slate-900 truncate mb-1",children:t.value}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-[10px] font-bold text-slate-500 italic",children:t.sub}),e.jsxs("div",{className:`flex items-center gap-1 text-[10px] font-black ${t.color}`,children:[t.trend.includes("â")?e.jsx(ke,{className:"h-3 w-3"}):t.trend.includes("â")?e.jsx(Ms,{className:"h-3 w-3"}):e.jsx(Te,{className:"h-3 w-3"}),t.trend]})]})]})},l))}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsxs(g,{className:"lg:col-span-12 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(he,{className:"h-5 w-5 text-indigo-500"}),"Users by Country"]}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"Global conversion and retention performance"})]}),e.jsx(b,{className:"pt-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-left",children:e.jsx(i,{term:"Country"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Total Visitors",children:"Users"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Activation"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Avg Lifetime",children:"Avg Life"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Monthly Churn",children:"Churn"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"LTV"})})]})}),e.jsx("tbody",{className:"divide-y divide-slate-50",children:((h==null?void 0:h.geographic)||[]).map((t,l)=>e.jsxs("tr",{className:"hover:bg-slate-50/50 transition-colors text-[11px]",children:[e.jsx("td",{className:"py-3.5 px-4 font-black text-slate-700 italic",children:t.country}),e.jsx("td",{className:"py-3.5 px-4 text-right font-bold text-slate-500",children:t.users.toLocaleString()}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-bold text-slate-700",children:[t.activation.toFixed(1),"%"]}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-bold text-slate-500",children:[t.avgLife.toFixed(1),"m"]}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-black text-slate-700",children:[(t.churn*100).toFixed(1),"%"]}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-black text-emerald-600",children:["$",t.ltv.toFixed(0)]})]},l))})]})})})]}),e.jsxs(g,{className:"lg:col-span-7 bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50",children:e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(at,{className:"h-5 w-5 text-indigo-500"}),"Users by Industry"]})}),e.jsx(b,{className:"pt-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-left",children:e.jsx(i,{term:"Industry"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Conversion Rate",children:"Conv %"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Churn Rate",children:"Churn %"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-center",children:"Status"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-50",children:((h==null?void 0:h.industry)||[]).map((t,l)=>e.jsxs("tr",{className:"hover:bg-slate-50/50 transition-colors text-[11px]",children:[e.jsx("td",{className:"py-3.5 px-4 font-black text-slate-700 italic",children:t.ind}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-black text-indigo-600",children:[t.conv.toFixed(1),"%"]}),e.jsxs("td",{className:"py-3.5 px-4 text-right font-black text-rose-600",children:[(t.churn*100).toFixed(1),"%"]}),e.jsx("td",{className:"py-3.5 px-4 text-center",children:e.jsx(i,{term:"Segment Score",children:e.jsx(V,{className:`text-[8px] font-black uppercase border-none px-2 py-0.5 ${t.status==="High Value"?"bg-emerald-50 text-emerald-700":t.status==="Growth Opp"?"bg-indigo-50 text-indigo-700":t.status==="Low Value"?"bg-rose-50 text-rose-700":"bg-slate-50 text-slate-600"}`,children:t.status})})})]},l))})]})})})]}),e.jsxs(g,{className:"lg:col-span-5 bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50",children:e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(lt,{className:"h-5 w-5 text-indigo-500"}),"Career Level Performance"]})}),e.jsx(b,{className:"pt-6",children:e.jsx("div",{className:"space-y-4",children:((h==null?void 0:h.careerLevel)||[]).map((t,l)=>{const o=["bg-indigo-600","bg-indigo-500","bg-indigo-400","bg-indigo-300","bg-slate-300"][l]||"bg-slate-200";return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-[10px] font-black uppercase tracking-tight",children:[e.jsx("span",{className:"text-slate-600",children:e.jsx(i,{term:"C
18areer Level",children:t.level})}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("span",{className:"text-slate-900",children:e.jsx(i,{term:"LTV",children:`LTV: $${t.ltv.toFixed(0)}`})}),e.jsx("span",{className:"text-indigo-600",children:e.jsx(i,{term:"Conversion Rate",children:`Conv: ${t.conv.toFixed(1)}%`})})]})]}),e.jsx("div",{className:"h-2 w-full bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full ${o}`,style:{width:`${Math.min(t.conv*4,100)}%`}})})]},l)})})})]}),e.jsxs(g,{className:"lg:col-span-12 bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50 font-bold",children:e.jsxs(y,{className:"text-slate-900 text-lg flex items-center gap-2",children:[e.jsx(le,{className:"h-5 w-5 text-indigo-500"}),"Acquisition Source Performance"]})}),e.jsx(b,{className:"pt-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Source"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Total Visitors",children:"Users"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Activation"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Overall Conv.",children:"Conversion"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Monthly Churn",children:"Churn"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"LTV"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Revenue Share",children:"Rev Share"})})]})}),e.jsx("tbody",{className:"divide-y divide-slate-50",children:((h==null?void 0:h.traffic)||[]).map((t,l)=>e.jsxs("tr",{className:"hover:bg-slate-50/50 transition-colors text-[11px]",children:[e.jsx("td",{className:"py-4 px-4 font-black text-slate-700 italic",children:t.src}),e.jsx("td",{className:"py-4 px-4 text-right font-bold text-slate-500",children:t.users.toLocaleString()}),e.jsxs("td",{className:"py-4 px-4 text-right font-black text-slate-800",children:[t.activation.toFixed(1),"%"]}),e.jsxs("td",{className:"py-4 px-4 text-right font-black text-indigo-600",children:[t.conversion.toFixed(1),"%"]}),e.jsxs("td",{className:"py-4 px-4 text-right font-black text-rose-500",children:[(t.churn*100).toFixed(1),"%"]}),e.jsxs("td",{className:"py-4 px-4 text-right font-black text-slate-900",children:["$",t.ltv.toFixed(0)]}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsxs("div",{className:"flex flex-col items-end",children:[e.jsxs("span",{className:"font-black text-emerald-600",children:[t.revShare.toFixed(1),"%"]}),e.jsx("div",{className:"h-1 w-12 bg-slate-100 rounded-full mt-1",children:e.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${t.revShare}%`}})})]})})]},l))})]})})})]}),e.jsxs("div",{className:"lg:col-span-12 grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(g,{className:"bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50",children:e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(Ts,{className:"h-5 w-5 text-indigo-500"}),"Device Intelligence"]})}),e.jsxs(b,{className:"pt-6",children:[e.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:((h==null?void 0:h.device)||[]).map((t,l)=>e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-50 border border-slate-100 text-center",children:[e.jsx("p",{className:"text-[9px] font-black text-slate-400 uppercase mb-2",children:e.jsx(i,{term:"Device",children:t.device})}),e.jsxs("p",{className:"text-lg font-black text-indigo-600 leading-none mb-1",children:[t.conv.toFixed(1),"%"]}),e.jsx("p",{className:"text-[8px] font-bold text-slate-400 uppercase underline decoration-rose-500/30",children:e.jsx(i,{term:"Churn Rate",children:`Churn: ${(t.churn*100).toFixed(1)}%`})})]},l))}),(()=>{var n,o;const t=(n=h==null?void 0:h.device)==null?void 0:n.find(c=>c.device==="Mobile"),l=(o=h==null?void 0:h.device)==null?void 0:o.find(c=>c.device==="Desktop");return t&&l&&t.conv<l.conv*.5?e.jsxs("div",{className:"p-4 bg-rose-50 rounded-xl border border-rose-100 flex items-center gap-3",children:[e.jsx(ve,{className:"h-5 w-5 text-rose-600 shrink-0"}),e.jsxs("p",{className:"text-[10px] text-rose-800 font-bold leading-relaxed",children:[e.jsx("span",{className:"font-black uppercase",children:"Friction Alert:"})," Mobile conversion is ",e.jsx("span",{className:"text-rose-600 font-black",children:"significantly lower"})," than desktop. Optimization required in checkout funnel."]})]}):e.jsxs("div",{className:"p-4 bg-indigo-50 rounded-xl border border-indigo-100 flex items-center gap-3",children:[e.jsx(ue,{className:"h-5 w-5 text-indigo-600 shrink-0"}),e.jsxs("p",{className:"text-[10px] text-indigo-800 font-bold leading-relaxed",children:[e.jsx("span",{className:"font-black uppercase",children:"Device Stability:"})," Conversion rates are healthy across primary user devices."]})]})})()]})]}),e.jsxs(g,{className:"bg-white border-slate-200 shadow-sm",children:[e.jsx(v,{className:"pb-4 border-b border-slate-50",children:e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(mt,{className:"h-5 w-5 text-indigo-500"}),"Campaign Intelligence"]})}),e.jsx(b,{className:"pt-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"C
18ampaign"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Conversion Rate",children:"Conv"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"ROAS"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Net Revenue",children:"Net Rev"})})]})}),e.jsx("tbody",{className:"divide-y divide-slate-50",children:((h==null?void 0:h.campaign)||[]).map((t,l)=>e.jsxs("tr",{className:"hover:bg-slate-50/50 transition-colors text-[11px]",children:[e.jsx("td",{className:"py-4 px-4 font-black text-slate-700 italic max-w-[150px] truncate",children:t.name}),e.jsxs("td",{className:"py-4 px-4 text-right font-black text-indigo-600",children:[t.conv.toFixed(1),"%"]}),e.jsxs("td",{className:`py-4 px-4 text-right font-black ${t.roas>3?"text-emerald-600":"text-slate-700"}`,children:[t.roas.toFixed(1),"x"]}),e.jsxs("td",{className:"py-4 px-4 text-right font-black text-slate-900",children:["$",t.rev.toLocaleString()]})]},l))})]})})})]})]}),e.jsxs(g,{className:"lg:col-span-12 bg-white border-slate-200 shadow-sm",children:[e.jsxs(v,{className:"pb-4 border-b border-slate-50",children:[e.jsxs(y,{className:"text-slate-900 text-lg font-bold flex items-center gap-2",children:[e.jsx(ut,{className:"h-5 w-5 text-indigo-500"}),"Segment Value Matrix"]}),e.jsx(F,{className:"text-slate-500 text-xs font-medium",children:"Weighted priority score (1-10) across Conversion, Retention, and Revenue"})]}),e.jsx(b,{className:"pt-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest",children:e.jsx(i,{term:"Segment"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-center",children:e.jsx(i,{term:"Conversion Rank",children:"Conv Rank"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-center",children:e.jsx(i,{term:"Retention Rank",children:"Ret Rank"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-center",children:e.jsx(i,{term:"Revenue Rank",children:"Rev Rank"})}),e.jsx("th",{className:"py-3 px-4 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right",children:e.jsx(i,{term:"Overall Score"})})]})}),e.jsx("tbody",{className:"divide-y divide-slate-50",children:((h==null?void 0:h.geographic.slice(0,5))||[]).map((t,l)=>{const n=10-l,o=Math.max(1,10-l-l%2),c=Math.max(1,10-l+l%3),p=((n+o+c)/3).toFixed(1);return e.jsxs("tr",{className:"hover:bg-slate-50/50 transition-colors text-[11px]",children:[e.jsxs("td",{className:"py-4 px-4 font-black text-slate-700 italic",children:[t.country," Segment"]}),e.jsxs("td",{className:"py-4 px-4 text-center font-bold text-indigo-600",children:["#",n]}),e.jsxs("td",{className:"py-4 px-4 text-center font-bold text-purple-600",children:["#",o]}),e.jsxs("td",{className:"py-4 px-4 text-center font-bold text-emerald-600",children:["#",c]}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-3 font-black text-slate-900",children:[e.jsxs("span",{children:["Rank ",l+1]}),e.jsx("div",{className:"h-6 w-9 bg-slate-900 text-white flex items-center justify-center rounded-lg text-[10px] font-black italic",children:p})]})})]},l)})})]})})})]}),e.jsxs(g,{className:"lg:col-span-12 bg-indigo-950 border-indigo-900 shadow-2xl relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-8 opacity-10",children:e.jsx(Ts,{className:"h-32 w-32 text-indigo-400"})}),e.jsx(v,{className:"pb-4 border-b border-indigo-900/50",children:e.jsxs(y,{className:"text-indigo-100 text-lg font-bold flex items-center gap-2",children:[e.jsx(it,{className:"h-5 w-5 text-indigo-400"}),"Ideal Customer Profile (Auto-Detected)"]})}),e.jsx(b,{className:"pt-6",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 ga
18p-8",children:[e.jsxs("div",{className:"p-4 rounded-2xl bg-indigo-900/40 border border-indigo-800 shadow-xl",children:[e.jsx("p",{className:"text-[9px] font-black text-indigo-400 uppercase tracking-widest mb-2",children:e.jsx(i,{term:"Best Segment"})}),e.jsxs("p",{className:"text-sm font-black text-white leading-tight",children:[((Ke=h==null?void 0:h.geographic[0])==null?void 0:Ke.country)||"US"," Mid-Level Professional"]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[9px] font-black text-indigo-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Conversion Rate",children:"Conv Rate"})}),e.jsxs("p",{className:"text-2xl font-black text-emerald-400",children:[(((He=h==null?void 0:h.geographic[0])==null?void 0:He.conversion)||0).toFixed(1),"%"]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[9px] font-black text-indigo-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Avg Lifetime"})}),e.jsxs("p",{className:"text-2xl font-black text-white",children:[(((Ee=h==null?void 0:h.geographic[0])==null?void 0:Ee.avgLife)||0).toFixed(1),"m"]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[9px] font-black text-indigo-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Avg LTV"})}),e.jsxs("p",{className:"text-2xl font-black text-indigo-400",children:["$",(((We=h==null?void 0:h.geographic[0])==null?void 0:We.ltv)||0).toFixed(0)]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[9px] font-black text-indigo-400 uppercase tracking-widest mb-1",children:e.jsx(i,{term:"Churn Rate"})}),e.jsxs("p",{className:"text-2xl font-black text-rose-400",children:[((((Oe=h==null?void 0:h.geographic[0])==null?void 0:Oe.churn)||0)*100).toFixed(1),"%"]})]})]})})]})]})]})}),e.jsx(te,{value:"auto-apply",className:"space-y-6 outline-none",children:e.jsx(ft,{})})]})]})]})}function ft(){const[w,$]=ee.useState(30),{data:A,isLoading:u}=B({queryKey:["/api/auto-apply/admin/analytics/overview",w],queryFn:()=>fetch(`/api/auto-apply/admin/analytics/overview?days=${w}`,{credentials:"include"}).then(j=>j.json())}),{data:z}=B({queryKey:["/api/auto-apply/admin/analytics/trends",w],queryFn:()=>fetch(`/api/auto-apply/admin/analytics/trends?days=${w}`,{credentials:"include"}).then(j=>j.json())}),{data:M}=B({queryKey:["/api/auto-apply/admin/analytics/users",w],queryFn:()=>fetch(`/api/auto-apply/admin/analytics/users?days=${w}&limit=20`,{credentials:"include"}).then(j=>j.json())});if(u)return e.jsx("div",{className:"text-center py-12 text-slate-400",children:"Loading auto-apply analytics..."});const T=(A==null?void 0:A.funnel)||{},K=(A==null?void 0:A.rates)||{};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[[7,30,90].map(j=>e.jsxs("button",{onClick:()=>$(j),className:`px-3 py-1.5 text-xs font-bold uppercase tracking-widest rounded-md transition-all ${w===j?"bg-indigo-600 text-white":"bg-slate-100 text-slate-500 hover:bg-slate-200"}`,children:[j,"D"]},j)),e.jsxs("span",{className:"text-xs text-slate-400 ml-2",children:[(A==null?void 0:A.uniqueUsers)||0," active users"]}),e.jsxs("div",{className:"ml-auto flex gap-2",children:[(z==null?void 0:z.length)>0&&e.jsx("button",{onClick:()=>J(z,`auto-apply-trends-${w}d`),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium flex items-center gap-1",children:"â Trends CSV"}),(M==null?void 0:M.length)>0&&e.jsx("button",{onClick:()=>J(M,`auto-apply-users-${w}d`),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium flex items-center gap-1",children:"â Users CSV"})]})]}),e.jsx("div",{className:"grid grid-cols-3 md:grid-cols-6 gap-4",children:[{label:"Discovered",value:T.discovered||0,color:"text-blue-600"},{label:"Approved",value:T.approved||0,color:"text-emerald-600"},{label:"Submitted",value:T.submitted||0,color:"text-indigo-600"},{label:"Failed",value:T.failed||0,color:"text-rose-500"},{label:"Avg Match",value:`${(A==null?void 0:A.avgMatchScore)||0}%`,color:"text-amber-600"},{label:"Approval Rate",value:`${K.approvalRate||0}%`,color:"text-emerald-600"}].map(j=>e.jsx(g,{className:"bg-white border-slate-200",children:e.jsxs(b,{className:"p-4",children:[e.jsx("p",{className:`text-2xl font-black tabular-nums ${j.color}`,children:j.value}),e.jsx("p",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-widest mt-1",children:j.label})]})},j.label))}),e.jsxs(g,{className:"bg-white border-slate-200",children:[e.jsx(v,{className:"pb-3",children:e.jsx(y,{className:"text-xs font-bold text-slate-900 uppercase tracking-widest",children:"Conversion Funnel"})}),e.jsx(b,{children:e.jsx("div",{className:"space-y-2.5",children:[{label:"Page Views",value:T.pageViews||0,color:"bg-slate-400"},{label:"Profiles Created",value:T.profilesCreated||0,color:"bg-blue-400"},{label:"Discovered",value:T.discovered||0,color:"bg-cyan-500"},{label:"Approved",value:T.approved||0,color:"bg-emerald-500"},{label:"Submitted",value:T.submitted||0,color:"bg-indigo-600"}].map(j=>{const H=Math.max(...[T.pageViews,T.profilesCreated,T.discovered,T.approved,T.submitted].map(q=>q||0),1),D=Math.max(3,(j.value||0)/H*100);return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-wider w-32 text-right",children:j.label}),e.jsx("div",{className:"flex-1 bg-slate-100 rounded-full h-6 overflow-hidden",children:e.jsx("div",{className:`${j.color} h-full rounded-full flex items-center justify-end pr-2.5`,style:{width:`${D}%`,minWidth:"40px"},children:e.jsx("span",{className:"text-[10px] text-white font-bold",children:j.value})})})]},j.label)})})})]}),(z==null?void 0:z.length)>0&&e.jsxs(g,{className:"bg-white border-slate-200",children:[e.jsx(v,{className:"pb-3",children:e.jsx(y,{className:"text-xs font-bold text-slate-900 uppercase tracking-widest",children:"Daily Trends"})}),e.jsx(b,{children:e.jsx("div",{className:"h-64",children:e.jsx(_,{width:"100%",height:"100%",children:e.jsxs(re,{data:z,children:[e.jsx(ne,{strokeDasharray:"3 3",stroke:"#f0f0f0"}),e.jsx(Z,{dataKey:"date",tick:{fontSize:10}
18,tickFormatter:j=>{const H=new Date(j);return`${H.getMonth()+1}/${H.getDate()}`}}),e.jsx(X,{tick:{fontSize:10}}),e.jsx(Q,{}),e.jsx(Fs,{}),e.jsx(G,{dataKey:"discovered",stackId:"a",fill:"#3b82f6",name:"Discovered"}),e.jsx(G,{dataKey:"approved",stackId:"a",fill:"#10b981",name:"Approved"}),e.jsx(G,{dataKey:"submitted",stackId:"a",fill:"#6366f1",name:"Submitted"}),e.jsx(G,{dataKey:"failed",stackId:"a",fill:"#ef4444",name:"Failed"})]})})})})]}),(M==null?void 0:M.length)>0&&e.jsxs(g,{className:"bg-white border-slate-200",children:[e.jsx(v,{className:"pb-2",children:e.jsx(y,{className:"text-xs font-bold text-slate-900 uppercase tracking-widest",children:"User Activity (Top 20)"})}),e.jsx(b,{children:e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-slate-50 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-2 text-[10px] font-bold text-slate-500 uppercase",children:"User"}),e.jsx("th",{className:"text-left p-2 text-[10px] font-bold text-slate-500 uppercase",children:"Tier"}),e.jsx("th",{className:"text-center p-2 text-[10px] font-bold text-slate-500 uppercase",children:"Disc."}),e.jsx("th",{className:"text-center p-2 text-[10px] font-bold text-slate-500 uppercase",children:"Appr."}),e.jsx("th",{className:"text-center p-2 text-[10px] font-bold text-slate-500 uppercase",children:"Subm."}),e.jsx("th",{className:"text-center p-2 text-[10px] font-bold text-slate-500 uppercase",children:"Failed"}),e.jsx("th",{className:"text-center p-2 text-[10px] font-bold text-slate-500 uppercase",children:"Score"})]})}),e.jsx("tbody",{children:M.map(j=>e.jsxs("tr",{className:"border-b last:border-b-0 hover:bg-slate-50",children:[e.jsxs("td",{className:"p-2",children:[e.jsx("p",{className:"font-medium truncate max-w-[140px]",children:j.fullName||"â"}),e.jsx("p",{className:"text-[10px] text-slate-400 truncate max-w-[140px]",children:j.email})]}),e.jsx("td",{className:"p-2",children:e.jsx(V,{variant:"outline",className:"text-[10px]",children:j.displayTier})}),e.jsx("td",{className:"text-center p-2 tabular-nums",children:j.discovered}),e.jsx("td",{className:"text-center p-2 tabular-nums text-emerald-600",children:j.approved}),e.jsx("td",{className:"text-center p-2 tabular-nums text-indigo-600",children:j.submitted}),e.jsx("td",{className:"text-center p-2 tabular-nums text-rose-500",children:j.failed}),e.jsxs("td",{className:"text-center p-2 tabular-nums",children:[j.avgMatchScore||"â","%"]})]},j.userId))})]})})})]})]})}export{zt as default,J as exportToCSV};
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.