PageSourceSearch

https://tariffrecoveryagency.com/assets/Stats-D0NGcNbk.js

js tariffrecoveryagency.com collected 2026-09-24 13:32:39 UTC 23,322 bytes, 2 lines download raw bytes

1import{j as e}from"./vendor-query-DUki8u-D.js";import{r as i}from"./vendor-react-DHU755GE.js";import{C as m,a as f,b as j,c as x}from"./card-DHYvmiDl.js";import{r as te,s as q,o as _e,h as ae,B as ve}from"./App-DQmYVKnt.js";import{S as we,a as be,b as Se,c as ke,d as O}from"./select-DEQ3_uib.js";import{T as Ce,a as De,b as Y,c as V}from"./tabs-Djw7dsBS.js";import{supabase as g}from"./client-CNze1gAi.js";import{b as Le,a as Te}from"./claim-constants-F6TZxwZ5.js";import{x as xe,a4 as ue,au as Ae,cR as Me,N as Re,aK as ze,a6 as Ke,am as Fe,$ as Ee}from"./vendor-icons-DQUIN5dH.js";import{R as k,h as se,X as A,Y as C,T as D,L as $,a as de,b,B as J,f as me,P as Oe,d as $e,e as qe}from"./vendor-charts-DsctC1NR.js";import"./vendor-pdf-BQwOdAin.js";import"./error-reporter-CRL-ULrG.js";import"./breadcrumbs-CN3GC8vy.js";import"./useTheme-CHHwG8SV.js";import"./vendor-supabase-D2XPrbcR.js";import"./vendor-motion-DoyUfQ58.js";import"./index-BdQq_4o_.js";import"./index-BFcYZw7s.js";const Be={platinum:Ae,gold:Me,silver:ue},Pe={platinum:"text-primary border-primary/30 bg-primary/5",gold:"text-gold border-gold/30 bg-gold/5",silver:"text-muted-foreground border-muted-foreground/30 bg-muted/5"},Ie=()=>{const[y,M]=i.useState([]),[L,R]=i.useState(!0),{dataSourceFilter:N}=te();return i.useEffect(()=>{(async()=>{const{data:n}=await g.from("brokers").select("id, full_name, company_name, tier, total_claims_closed, total_revenue_generated, revenue_share_pct").eq("status","approved").eq("data_source",N).order("total_revenue_generated",{ascending:!1}).limit(20);if(n){const _=n.map(p=>p.id),{data:S}=await g.from("broker_clients").select("broker_id").in("broker_id",_).eq("status","active"),T={};(S||[]).forEach(p=>{T[p.broker_id]=(T[p.broker_id]||0)+1}),M(n.map(p=>({...p,company_name:p.company_name,active_clients:T[p.id]||0})))}R(!1)})()},[N]),L?e.jsx(q,{className:"h-96"}):e.jsxs(m,{children:[e.jsx(f,{children:e.jsxs(j,{className:"text-lg flex items-center gap-2",children:[e.jsx(xe,{className:"h-5 w-5 text-gold"})," Broker Performance Leaderboard"]})}),e.jsx(x,{children:y.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No approved brokers yet"}):e.jsx("div",{className:"space-y-2",children:y.map((o,n)=>{const _=Be[o.tier]||ue,S=n===0?"bg-gold/5 border-gold/20":n===1?"bg-muted/40":n===2?"bg-orange-50 border-orange-200/30":"";return e.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg border ${S}`,children:[e.jsx("div",{className:"w-8 text-center",children:n<3?e.jsx("span",{className:`text-lg font-bold ${n===0?"text-gold":n===1?"text-muted-foreground":"text-orange-400"}`,children:n===0?"🥇":n===1?"🥈":"🥉"}):e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["#",n+1]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:o.company_name||o.full_name}),e.jsxs(_e,{variant:"outline",className:`text-[10px] capitalize gap-0.5 ${Pe[o.tier]||""}`,children:[e.jsx(_,{className:"h-2.5 w-2.5"})," ",o.tier]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o.full_name})]}),e.jsxs("div",{className:"flex items-center gap-6 text-xs shrink-0",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-foreground",children:o.total_claims_closed}),e.jsx("p",{className:"text-muted-foreground",children:"Claims"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-success",children:ae(o.total_revenue_generated,{compact:!0})}),e.jsx("p",{className:"text-muted-foreground",children:"Revenue"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-primary",children:o.active_clients}),e.jsx("p",{className:"text-muted-foreground",children:"Clients"})]})]})]},o.id)})})})]})},Ue=()=>{const[y,M]=i.useState([]),[L,R]=i.useState(!0),{dataSourceFilter:N}=te();return i.useEffect(()=>{(async()=>{var B;const{data:n=[]}=await g.from("affiliates").select("id, full_name, company, status").eq("status","approved").eq("data_source",N).limit(500),_=(n||[]).map(l
1=>l.id);if(_.length===0){M([]),R(!1);return}const[S,T]=await Promise.all([g.from("leads").select("id, affiliate_id, status").eq("data_source",N).in("affiliate_id",_),g.from("commission_ledger").select("affiliate_id, commission_amount, status").in("affiliate_id",_)]),p=S.data||[],X=T.data||[],z={};for(const l of p)l.affiliate_id&&(z[B=l.affiliate_id]||(z[B]=[])).push(l);const K={};for(const l of X)K[l.affiliate_id]=(K[l.affiliate_id]||0)+Number(l.commission_amount||0);const v=(n||[]).map(l=>{const d=z[l.id]||[],P=d.filter(E=>["closed_won","closed_paid","refund_received"].includes(E.status));return{...l,total_leads:d.length,won_leads:P.length,total_commissions:K[l.id]||0}}).sort((l,d)=>d.total_commissions-l.total_commissions).slice(0,25);M(v),R(!1)})()},[N]),L?e.jsx(q,{className:"h-96"}):e.jsxs(m,{children:[e.jsx(f,{children:e.jsxs(j,{className:"text-lg flex items-center gap-2",children:[e.jsx(xe,{className:"h-5 w-5 text-primary"})," Partner Performance Leaderboard"]})}),e.jsx(x,{children:y.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No approved partners yet"}):e.jsx("div",{className:"space-y-2",children:y.map((o,n)=>e.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg border ${n<3?"bg-primary/5 border-primary/10":""}`,children:[e.jsx("div",{className:"w-8 text-center",children:n<3?e.jsx("span",{className:"text-lg",children:n===0?"🥇":n===1?"🥈":"🥉"}):e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["#",n+1]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:o.full_name}),o.company&&e.jsx("p",{className:"text-xs text-muted-foreground",children:o.company})]}),e.jsxs("div",{className:"flex items-center gap-6 text-xs shrink-0",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-foreground",children:o.total_leads}),e.jsx("p",{className:"text-muted-foreground",children:"Referrals"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-success",children:o.won_leads}),e.jsx("p",{className:"text-muted-foreground",children:"Won"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-gold",children:ae(o.total_commissions,{compact:!0})}),e.jsx("p",{className:"text-muted-foreground",children:"Earned"})]})]})]},o.id))})})]})},c={primary:"hsl(224,64%,33%)",gold:"hsl(37,91%,44%)",success:"hsl(160,84%,39%)",destructive:"hsl(0,84%,60%)",muted:"hsl(215,20%,65%)",purple:"hsl(270,60%,50%)"},G=[c.primary,c.gold,c.success,c.destructive,c.muted,c.purple],os=()=>{const[y,M]=i.useState([]),[L,R]=i.useState([]),[N,o]=i.useState([]),[n,_]=i.useState([]),[S,T]=i.useState([]),[p,X]=i.useState([]),[z,K]=i.useState(!0),[v,B]=i.useState("all"),{dataSourceFilter:l}=te();i.useEffect(()=>{K(!0),Promise.all([g.from("leads").select("*").eq("data_source",l).order("created_at",{ascending:!0}),g.from("claim_entries").select("id, lead_id, entry_date, total_duties_paid, ieepa_duties, section_301_duties, section_232_duties, estimated_refund, actual_refund, country_of_origin, status").eq("data_source",l),g.from("claim_details").select("lead_id, estimated_recovery, actual_recovery, qualification_score").eq("data_source",l),g.from("commission_ledger").select("id, affiliate_id, commission_amount, status, created_at").eq("data_source",l),g.from("affiliates").select("id, full_name, status").eq("data_source",l),g.from("broker_commission_ledger").select("id, broker_id, commission_amount, status, created_at").eq("data_source",l)]).then(([s,t,a,r,u,h])=>{M(s.data||[]),R(t.data||[]),o(a.data||[]),_(r.data||[]),T(u.data||[]),X(h.data||[]),K(!1)})},[l]);const d=i.useMemo(()=>{if(v==="all")return y;const s=new Date,t=new Date;return v==="30d"?t.setDate(s.getDate()-30):v==="90d"?t.setDate(s.getDate()-90):v==="6m"?t.setMonth(s.getMonth()-6):v==="1y"&&t.setFullYear(s.getFullYear()-1),y.filter(a=>new Date(a.created_at)>=t)},[y,v]),P=s=>{if(!s)return 0;const t=parseFloat(s.replace(/[^0-9.]/g,""));return isNaN(t)?0:t},E=s=>ae(s,{compact:!0}),H=d.length,re=d.filter(s=>["closed_won","closed_paid","refund_received"].includes(s.status)).length,he=H>0?re/H*100:0,Q=d.filter(s=>["closed_won","closed_paid"].includes(s.status)).map(s=>Math.ceil((new Date(s.updated_at).getTime()-new Date(s.created_at).getTime())/(1e3*60*60*24))),pe=Q.length>0?Math.round(Q.reduce((s,t)=>s+t,0)/Q.length):0,Z=d.filter(s=>s.status==="refund_received"||s.status==="closed_paid").map(s=>Math.ceil((new Date(s.updated_at).getTime()-new Date(s.created_at).getTime())/(1e3*60*60*24))),fe=Z.length>0?Math.round(Z.reduce((s,t)=>s+t,0)/Z.length):0,je=N.reduce((s,t)=>s+Number(t.estimated_recovery||0),0),ge=N.reduce((s,t)=>s+Number(t.actual_recovery||0),0),F=i.useMemo(()=>{const s={};return d.forEach(t=>{const r=new Date(t.created_at).toLocaleDateString("en-US",{month:"short",year:"2-digit"});s[r]||(s[r]={leads:0,won:0,lost:0,value:0}),s[r].leads++,["closed_won","closed_paid","refund_received"].includes(t.status)&&s[r].won++,["closed_lost","disqualified"].includes(t.status)&&s[r].lost++,s[r].value+=(P(t.ieepa_2025)+P(t.ieepa_2026))/1e6}),Object.entries(s).map(([t,a])=>({month:t,...a}))},[d]),ne=i.useMemo(()=>{var oe;if(F.length<2)return[];const s=F.slice(-6),t=s.length>1?s.reduce((w,U,W)=>W===0?0:w+(U.value-s[W-1].value),0)/(s.length-1):0,a=((oe=s[s.length-1])==null?void 0:oe.value)||0,r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=new Date,h=s.map(w=>({month:w.month,actual:w.value,forecast:null}));for(let w=1;w<=3;w++){const U=new Date(u.getFullYear(),u.getMonth()+w,1),W=`${r[U.getMonth()]} '${String(U.getFullYear()).slice(-2)}`;h.push({month:W,actual:null,forecast:Math.max(0,a+t*w)})}return h},[F]),I=i.useMemo(()=>{const s={};return d.forEach(t=>{const r=new Date(t.created_at).toLocaleDateString("en-US",{month:"short",year:"2-digit"});s[r]||(s[r]={total:0,converted:0,avgDays:0,days:[]}),s[r].total++,["closed_won","closed_paid","refund_received"].includes(t.status)&&(s[r].converted++,s[r].days.push(Math.ceil((new Date(t.updated_at).getTime()-new Date(t.created_at).getTime())/864e5)))}),Object.entries(s).map(([t,a])=>({cohort:t,total:a.total,converted:a.converted,rate:a.total>0?Number((a.converted/a.total*100).toFixed(1)):0,avgDays:a.days.length>0?Math.round(a.days.reduce((r,u)=>r+u,0)/a.days.length):0}))},[d]),ie=i.useMemo(()=>{const s={};return d.forEach(t=>{const a=t.source||"direct";s[a]||(s[a]={total:0,won:0}),s[a].total++,["closed_won","closed_paid","refund_received"].includes(t.status)&&s[a].won++}),Object.entries(s).map(([t,a])=>({source:t.charAt(0).toUpperCase()+t.slice(1),total:a.total,won:a.won,rate:a.total>0?(a.won/a.total*100).toFixed(1):"0"}))},[d]),ee=i.useMemo(()=>{const s={};return d.forEach(t=>{const a=t.claim_type||"ieepa";s[a]=(s[a]||0)+1}),Object.entries(s).map(([t,a])=>({name:Le(t),value:a}))},[d]),ye=i.useMemo(()=>["new","account_created","application_in_progress","details_submitted","agreements_pending","documents_pending","identity_verification_required","ace_access_pending","ready_for_review","in_review","approved","filed_with_cbp","refund_received","closed_paid"].map(t=>({stage:Te[t]||t,count:d.filter(a=>a.status===t).length})),[d]),ce=i.useMemo(()=>{const s={};
1return L.forEach(t=>{const a=t.country_of_origin||"Unknown";s[a]||(s[a]={entries:0,duties:0}),s[a].entries++,s[a].duties+=Number(t.total_duties_paid||0)}),Object.entries(s).sort((t,a)=>a[1].duties-t[1].duties).slice(0,10).map(([t,a])=>({name:t,...a}))},[L]),le=i.useMemo(()=>S.map(s=>{const t=d.filter(r=>r.affiliate_id===s.id),a=n.filter(r=>r.affiliate_id===s.id);return{name:s.full_name,leads:t.length,won:t.filter(r=>["closed_won","closed_paid","refund_received"].includes(r.status)).length,commissions:a.reduce((r,u)=>r+Number(u.commission_amount||0),0)}}).filter(s=>s.leads>0).sort((s,t)=>t.leads-s.leads).slice(0,8),[S,d,n]),Ne=()=>{const s=["Month","Leads","Won","Lost","Value ($M)"],t=F.map(h=>[h.month,h.leads,h.won,h.lost,h.value.toFixed(2)]),a=[s,...t].map(h=>h.join(",")).join(`
2`),r=new Blob([a],{type:"text/csv"}),u=document.createElement("a");u.href=URL.createObjectURL(r),u.download=`stats-${new Date().toISOString().split("T")[0]}.csv`,u.click()};return z?e.jsxs("div",{className:"space-y-6",children:[e.jsx(q,{className:"h-8 w-48"}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[...Array(8)].map((s,t)=>e.jsx(q,{className:"h-24"},t))}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[...Array(4)].map((s,t)=>e.jsx(q,{className:"h-72"},t))})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h1",{className:"font-display font-bold text-2xl text-foreground flex items-center gap-2",children:[e.jsx(Re,{className:"h-6 w-6 text-primary"})," Stats & Reports"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(we,{value:v,onValueChange:B,children:[e.jsx(be,{className:"w-32 h-8 text-xs",children:e.jsx(Se,{})}),e.jsxs(ke,{children:[e.jsx(O,{value:"all",children:"All Time"}),e.jsx(O,{value:"30d",children:"Last 30 Days"}),e.jsx(O,{value:"90d",children:"Last 90 Days"}),e.jsx(O,{value:"6m",children:"Last 6 Months"}),e.jsx(O,{value:"1y",children:"Last Year"})]})]}),e.jsxs(ve,{variant:"outline",size:"sm",className:"gap-1 text-xs",onClick:Ne,children:[e.jsx(ze,{className:"h-3.5 w-3.5"})," Export"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-8 gap-3",children:[e.jsx(m,{children:e.jsxs(x,{className:"p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Leads"}),e.jsx("p",{className:"text-xl font-bold text-foreground",children:H})]})}),e.jsx(m,{children:e.jsxs(x,{className:"p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Converted"}),e.jsx("p",{className:"text-xl font-bold text-success",children:re})]})}),e.jsx(m,{children:e.jsxs(x,{className:"p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Conv. Rate"}),e.jsxs("p",{className:"text-xl font-bold text-gold",children:[he.toFixed(1),"%"]})]})}),e.jsx(m,{children:e.jsxs(x,{className:"p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Avg Close"}),e.jsxs("p",{className:"text-xl font-bold text-foreground",children:[pe,"d"]})]})}),e.jsx(m,{children:e.jsxs(x,{className:"p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Avg Recovery"}),e.jsxs("p",{className:"text-xl font-bold text-primary",children:[fe,"d"]})]})}),e.jsx(m,{children:e.jsxs(x,{className:"p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Est. Recovery"}),e.jsx("p",{className:"text-xl font-bold text-primary",children:E(je)})]})}),e.jsx(m,{children:e.jsxs(x,{className:"p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Actual Recovery"}),e.jsx("p",{className:"text-xl font-bold text-success",children:E(ge)})]})}),e.jsx(m,{children:e.jsxs(x,{className:"p-3",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Entries"}),e.jsx("p",{className:"text-xl font-bold text-foreground",children:L.length})]})})]}),e.jsxs(Ce,{defaultValue:"overview",className:"w-full",children:[e.jsxs(De,{className:"grid w-full grid-cols-4 h-9",children:[e.jsx(Y,{value:"overview",className:"text-xs",children:"Overview"}),e.jsx(Y,{value:"advanced",className:"text-xs",children:"Advanced Analytics"}),e.jsx(Y,{value:"leaderboards",className:"text-xs",children:"Leaderboards"}),e.jsx(Y,{value:"sources",className:"text-xs",children:"Sources & Types"})]}),e.jsxs(V,{value:"overview",className:"space-y-6 mt-4",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(m,{children:[e.jsx(f,{className:"pb-2",children:e.jsx(j,{className:"text-sm font-medium",children:"Lead Volume & Outcomes"})}),e.jsx(x,{children:F.length>0?e.jsx(k,{width:"100%",height:280,children:e.jsxs(se,{data:F,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"gradArea",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",
2stopColor:c.primary,stopOpacity:.1}),e.jsx("stop",{offset:"95%",stopColor:c.primary,stopOpacity:0})]})}),e.jsx(A,{dataKey:"month",tick:{fontSize:11}}),e.jsx(C,{tick:{fontSize:11}}),e.jsx(D,{}),e.jsx($,{iconSize:8,wrapperStyle:{fontSize:11}}),e.jsx(de,{type:"monotone",dataKey:"leads",name:"New Leads",fill:"url(#gradArea)",stroke:c.primary,strokeWidth:2}),e.jsx(b,{dataKey:"won",name:"Won",fill:c.success,radius:[3,3,0,0]}),e.jsx(b,{dataKey:"lost",name:"Lost",fill:c.destructive,radius:[3,3,0,0]})]})}):e.jsx("div",{className:"h-[280px] flex items-center justify-center text-muted-foreground text-sm",children:"No data yet"})})]}),e.jsxs(m,{children:[e.jsx(f,{className:"pb-2",children:e.jsx(j,{className:"text-sm font-medium",children:"Conversion Funnel"})}),e.jsx(x,{children:e.jsx(k,{width:"100%",height:280,children:e.jsxs(J,{data:ye,layout:"vertical",children:[e.jsx(A,{type:"number",tick:{fontSize:11}}),e.jsx(C,{type:"category",dataKey:"stage",width:100,tick:{fontSize:10}}),e.jsx(D,{}),e.jsx(b,{dataKey:"count",fill:c.primary,radius:[0,4,4,0]})]})})})]})]}),e.jsxs(m,{children:[e.jsx(f,{className:"pb-2",children:e.jsx(j,{className:"text-sm font-medium",children:"Top Countries (by Duties)"})}),e.jsx(x,{children:ce.length>0?e.jsx(k,{width:"100%",height:240,children:e.jsxs(J,{data:ce,children:[e.jsx(A,{dataKey:"name",tick:{fontSize:9}}),e.jsx(C,{tick:{fontSize:11},tickFormatter:s=>`$${(s/1e3).toFixed(0)}K`}),e.jsx(D,{formatter:s=>E(s)}),e.jsx(b,{dataKey:"duties",name:"Duties",fill:c.gold,radius:[3,3,0,0]})]})}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No entry data"})})]})]}),e.jsxs(V,{value:"advanced",className:"space-y-6 mt-4",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(m,{children:[e.jsx(f,{className:"pb-2",children:e.jsxs(j,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Ke,{className:"h-4 w-4 text-success"})," Revenue Forecast (3-Month)"]})}),e.jsx(x,{children:ne.length>0?e.jsx(k,{width:"100%",height:280,children:e.jsxs(se,{data:ne,children:[e.jsx(A,{dataKey:"month",tick:{fontSize:11}}),e.jsx(C,{tick:{fontSize:11},tickFormatter:s=>`$${s.toFixed(1)}M`}),e.jsx(D,{formatter:s=>`$${s.toFixed(2)}M`}),e.jsx($,{iconSize:8,wrapperStyle:{fontSize:11}}),e.jsx(de,{type:"monotone",dataKey:"actual",name:"Actual",fill:c.primary,fillOpacity:.1,stroke:c.primary,strokeWidth:2}),e.jsx(me,{type:"monotone",dataKey:"forecast",name:"Forecast",stroke:c.gold,strokeWidth:2,strokeDasharray:"6 3",dot:{fill:c.gold,r:4}})]})}):e.jsx("div",{className:"h-[280px] flex items-center justify-center text-muted-foreground text-sm",children:"Need at least 2 months of data"})})]}),e.jsxs(m,{children:[e.jsx(f,{className:"pb-2",children:e.jsxs(j,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Fe,{className:"h-4 w-4 text-primary"})," Cohort Analysis"]})}),e.jsx(x,{children:I.length>0?e.jsx(k,{width:"100%",height:280,children:e.jsxs(se,{data:I,children:[e.jsx(A,{dataKey:"cohort",tick:{fontSize:10}}),e.jsx(C,{yAxisId:"left",tick:{fontSize:11}}),e.jsx(C,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickFormatter:s=>`${s}%`}),e.jsx(D,{}),e.jsx($,{iconSize:8,wrapperStyle:{fontSize:11}}),e.jsx(b,{yAxisId:"left",dataKey:"total",name:"Total Leads",fill:c.muted,radius:[3,3,0,0]}),e.jsx(b,{yAxisId:"left",dataKey:"converted",name:"Converted",fill:c.success,radius:[3,3,0,0]}),e.jsx(me,{yAxisId:"right",type:"monotone",dataKey:"rate",name:"Conv. Rate %",stroke:c.gold,strokeWidth:2,dot:{fill:c.gold,r:3}})]})}):e.jsx("div",{className:"h-[280px] flex items-center justify-center text-muted-foreground text-sm",children:"No data yet"})})]})]}),e.jsxs(m,{children:[e.jsx(f,{className:"pb-2",children:e.jsxs(j,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Ee,{className:"h-4 w-4 text-primary"})," Avg Recovery Time by Cohort (Days)"]})}),e.jsx(x,{children:I.filter(s=>s.avgDays>0).length>0?e.jsx(k,{width:"100%",height:240,children:e.jsxs(J,{data:I.filter(s=>s.avgDays>0),children:[e.jsx(A,{dataKey:"cohort",tick:{fontSize:10}}),e.jsx(C,{tick:{fontSize:11}}),e.jsx(D,{formatter:s=>`${s} days`}),e.jsx(b,{dataKey:"avgDays",name:"Avg Days",fill:c.purple,radius:[3,3,0,0]})]})}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No completed claims yet"})})]})]}),e.jsxs(V,{value:"leaderboards",className:"space-y-6 mt-4",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(Ie,{}),e.jsx(Ue,{})]}),le.length>0&&e.jsxs(m,{children:[e.jsx(f,{className:"pb-2",children:e.jsx(j,{className:"text-sm font-medium",children:"Partner Performance Chart"})}),e.jsx(x,{children:e.jsx(k,{width:"100%",height:280,children:e.jsxs(J,{data:le,children:[e.jsx(A,{dataKey:"name",tick:{fontSize:10}}),e.jsx(C,{tick:{fontSize:11}}),e.jsx(D,{}),e.jsx($,{iconSize:8,wrapperStyle:{fontSize:11}}),e.jsx(b,{dataKey:"leads",name:"Leads",fill:c.primary,radius:[3,3,0,0]}),e.jsx(b,{dataKey:"won",name:"Won",fill:c.success,radius:[3,3,0,0]})]})})})]})]}),e.jsx(V,{value:"sources",className:"space-y-6 mt-4",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6",children:[e.jsxs(m,{children:[e.jsx(f,{className:"pb-2",children:e.jsx(j,{className:"text-sm font-medium",children:"Lead Sources"})}),e.jsx(x,{children:ie.length>0?e.jsx("div",{className:"space-y-3",children:ie.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:G[t%G.length]}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:s.source}),e.jsx("span",{className:"text-sm font-bold",children:s.total})]}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[e.jsxs("span",{children:[s.won," converted"]}),e.jsxs("span",{children:[s.rate,"% rate"]})]})]})]},t))}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No data"})})]}),e.jsxs(m,{children:[e.jsx(f,{className:"pb-2",children:e.jsx(j,{className:"text-sm font-medium",children:"Claim Types"})}),e.jsx(x,{children:ee.length>0?e.jsx(k,{width:"100%",height:220,children:e.jsxs(Oe,{children:[e.jsx($e,{data:ee,cx:"50%",cy:"50%",outerRadius:75,innerRadius:45,dataKey:"value",nameKey:"name",paddingAngle:2,children:ee.map((s,t)=>e.jsx(qe,{fill:G[t%G.length]},t))}),e.jsx(D,{}),e.jsx($,{iconSize:8,wrapperStyle:{fontSize:11}})]})}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No data"})})]})]})})]})]})};export{os as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.