1import{j as s,r as m,a as Ie,L as we}from"./react-vendor-d250d348.js";import{a as qe,g as ze,l as Be,m as We,n as Ve,o as He,p as Ge,q as Ke,r as Xe}from"./adminAnalyticsService-71426fb6.js";import{g as Je}from"./adminService-8d9391de.js";import{W,X as V,e as Ye,b as Qe,bu as Ze}from"./index-721397ec.js";import{cc as te,ao as et,X as je,cd as tt,D as st,U as rt,au as nt,A as ie,f as at,bi as oe,R as lt,T as it,d as ot,aJ as ct,y as ce}from"./lucide-1ed530d4.js";import{U as Se}from"./UserAvatar-05bf91ea.js";import{S as se,a as M,E as re}from"./AdminShared-5d419368.js";import"./sentry-5ddef7e0.js";import"./supabase-b5d9a3f8.js";import"./NameBadges-8c10539c.js";import"./dynamicBadgeIcons-e7802c8f.js";import"./utils-f85c62fa.js";import"./adminEntityUrl-6c40272a.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"72d1b8b3cf2f419b3766a3c986aa32488299d6dc"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f9573a88-826c-4bf2-aa6e-844d59a75c0e",e._sentryDebugIdIdentifier="sentry-dbid-f9573a88-826c-4bf2-aa6e-844d59a75c0e")}catch{}})();function dt(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),n=r.createElement("base"),a=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(a),t&&(n.href=t),a.href=e,a.href}const ut=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function T(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}let U=null;function Fe(e={}){return U||(e.includeStyleProperties?(U=e.includeStyleProperties,U):(U=T(window.getComputedStyle(document.documentElement)),U))}function H(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function mt(e){const t=H(e,"border-left-width"),r=H(e,"border-right-width");return e.clientWidth+t+r}function ht(e){const t=H(e,"border-top-width"),r=H(e,"border-bottom-width");return e.clientHeight+t+r}function ke(e,t={}){const r=t.width||mt(e),n=t.height||ht(e);return{width:r,height:n}}function ft(){let e,t;try{t=process}catch{}const r=t&&t.env?t.env.devicePixelRatio:null;return r&&(e=parseInt(r,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const C=16384;function gt(e){(e.width>C||e.height>C)&&(e.width>C&&e.height>C?e.width>e.height?(e.height*=C/e.width,e.width=C):(e.width*=C/e.height,e.height=C):e.width>C?(e.height*=C/e.width,e.width=C):(e.width*=C/e.height,e.height=C))}function G(e){return new Promise((t,r)=>{const n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>t(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=e})}async function xt(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function pt(e,t,r){const n="http://www.w3.org/2000/svg",a=document.createElementNS(n,"svg"),l=document.createElementNS(n,"foreignObject");return a.setAttribute("width",`${t}`),a.setAttribute("height",`${r}`),a.setAttribute("viewBox",`0 0 ${t} ${r}`),l.setAttribute("width","100%"),l.setAttribute("height","100%"),l.setAttribute("x","0"),l.setAttribute("y","0"),l.setAttribute("externalResourcesRequired","true"),a.appendChild(l),l.appendChild(e),xt(a)}const F=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||F(r,t)};function bt(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function yt(e,t){return Fe(t).map(r=>{const n=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${n}${a?" !important":""};`}).join(" ")}function vt(e,t,r,n){const a=`.${e}:${t}`,l=r.cssText?bt(r):yt(r,n);return document.createTextNode(`${a}{${l}}`)}function de(e,t,r,n){const a=window.getComputedStyle(e,r),l=a.getPropertyValue("content");
1if(l===""||l==="none")return;const i=ut();try{t.className=`${t.className} ${i}`}catch{return}const o=document.createElement("style");o.appendChild(vt(i,r,a,n)),t.appendChild(o)}function wt(e,t,r){de(e,t,":before",r),de(e,t,":after",r)}const ue="application/font-woff",me="image/jpeg",jt={woff:ue,woff2:ue,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:me,jpeg:me,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function St(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function ae(e){const t=St(e).toLowerCase();return jt[t]||""}function Ft(e){return e.split(/,/)[1]}function ne(e){return e.search(/^(data:)/)!==-1}function Ce(e,t){return`data:${t};base64,${e}`}async function Re(e,t,r){const n=await fetch(e,t);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const a=await n.blob();return new Promise((l,i)=>{const o=new FileReader;o.onerror=i,o.onloadend=()=>{try{l(r({res:n,result:o.result}))}catch(d){i(d)}},o.readAsDataURL(a)})}const J={};function kt(e,t,r){let n=e.replace(/\?.*/,"");return r&&(n=e),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),t?`[${t}]${n}`:n}async function le(e,t,r){const n=kt(e,t,r.includeQueryParams);if(J[n]!=null)return J[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const l=await Re(e,r.fetchRequestInit,({res:i,result:o})=>(t||(t=i.headers.get("Content-Type")||""),Ft(o)));a=Ce(l,t)}catch(l){a=r.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;l&&(i=typeof l=="string"?l:l.message),i&&console.warn(i)}return J[n]=a,a}async function Ct(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):G(t)}async function Rt(e,t){if(e.currentSrc){const l=document.createElement("canvas"),i=l.getContext("2d");l.width=e.clientWidth,l.height=e.clientHeight,i?.drawImage(e,0,0,l.width,l.height);const o=l.toDataURL();return G(o)}const r=e.poster,n=ae(r),a=await le(r,n,t);return G(a)}async function Et(e,t){var r;try{if(!((r=e?.contentDocument)===null||r===void 0)&&r.body)return await K(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function Nt(e,t){return F(e,HTMLCanvasElement)?Ct(e):F(e,HTMLVideoElement)?Rt(e,t):F(e,HTMLIFrameElement)?Et(e,t):e.cloneNode(Ee(e))}const Tt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",Ee=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function At(e,t,r){var n,a;if(Ee(t))return t;let l=[];return Tt(e)&&e.assignedNodes?l=T(e.assignedNodes()):F(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?l=T(e.contentDocument.body.childNodes):l=T(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),l.length===0||F(e,HTMLVideoElement)||await l.reduce((i,o)=>i.then(()=>K(o,r)).then(d=>{d&&t.appendChild(d)}),Promise.resolve()),t}function $t(e,t,r){const n=t.style;if(!n)return;const a=window.getComputedStyle(e);a.cssText?(n.cssText=a.cssText,n.transformOrigin=a.transformOrigin):Fe(r).forEach(l=>{let i=a.getPropertyValue(l);l==="font-size"&&i.endsWith("px")&&(i=`${Math.floor(parseFloat(i.substring(0,i.length-2)))-.1}px`),F(e,HTMLIFrameElement)&&l==="display"&&i==="inline"&&(i="block"),l==="d"&&t.getAttribute("d")&&(i=`path(${t.getAttribute("d")})`),n.setProperty(l,i,a.getPropertyPriority(l))})}function Lt(e,t){F(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),F(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function Dt(e,t){if(F(e,HTMLSelectElement)){const r=t,n=Array.from(r.children).find(a=>e.value===a.getAttribute("value"));n&&n.setAttribute("selected","")}}function Pt(e,t,r){return F(t,Element)&&($t(e,t,r),wt(e,t,r),Lt(e,t),Dt(e,t)),t}async function Mt(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const n={};for(let l=0;l<r.length;l++){const o=r[l].getAttribute("xlink:href");if(o){const d=e.querySelector(o),h=document.querySelector(o);!d&&h&&!n[o]&&(n[o]=await K(h,t,!0))}}const a=Object.values(n);if(a.length){const l="http://www.w3.org/1999/xhtml",i=document.createElementNS(l,"svg");i.setAttribute("xmlns",l),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";const o=document.createElementNS(l,"defs");i.appendChild(o);for(let d=0;d<a.length;d++)o.appendChild(a[d]);e.appendChild(i)}return e}async function K(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>Nt(n,t)).then(n=>At(e,n,t)).then(n=>Pt(e,n,t)).then(n=>Mt(n,t))}const Ne=/url\((['"]?)([^'"]+?)\1\)/g,Ut=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,_t=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ot(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function It(e){const t=[];return e.replace(Ne,(r,n,a)=>(t.push(a),r)),t.filter(r=>!ne(r))}async function qt(e,t,r,n,a){try{const l=r?dt(t,r):t,i=ae(t);let o;if(a){const d=await a(l);o=Ce(d,i)}else o=await le(l,i,n);return e.replace(Ot(t),`$1${o}$3`)}catch{}return e}function zt(e,{preferredFontFormat:t}){return t?e.replace(_t,r=>{for(;;){const[n,,a]=Ut.exec(r)||[];if(!a)return"";if(a===t)return`src: ${n};`}}):e}function Te(e){return e.search(Ne)!==-1}async function Ae(e,t,r){if(!Te(e))return e;const n=zt(e,r);return It(n).reduce((l,i)=>l.then(o=>qt(o,i,t,r)),Promise.resolve(n))}async function _(e,t,r){var n;const a=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(a){const l=await Ae(a,null,r);return t.style.setProperty(e,l,t.style.getPropertyPriority(e)),!0}return!1}async function Bt(e,t){await _("background",e,t)||await _("background-image",e,t),await _("mask",e,t)||await _("-webkit-mask",e,t)||await _("mask-image",e,t)||await _("-webkit-mask-image",e,t)}async function Wt(e,t){const r=F(e,HTMLImageElement);if(!(r&&!ne(e.src))&&!(F(e,SVGImageElement)&&!ne(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,a=await le(n,ae(n),t);await new Promise((l,i)=>{e.onload=l,e.onerror=t.onImageErrorHandler?(...d)=>{try{l(t.onImageErrorHandler(...d))}catch(h){i(h)}}:i;const o=e;o.decode&&(o.decode=l),o.loading==="lazy"&&(o.loading="eager"),r?(e.srcset="",e.src=a):e.href.baseVal=a})}async function Vt(e,t){const n=T(e.childNodes).map(a=>$e(a,t));await Promise.all(n).then(()=>e)}async function $e(e,t){F(e,Element)&&(await Bt(e,t),await Wt(e,t),await Vt(e,t))}function Ht(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const n=t.style;
1return n!=null&&Object.keys(n).forEach(a=>{r[a]=n[a]}),e}const he={};async function fe(e){let t=he[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},he[e]=t,t}async function ge(e,t){let r=e.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,l=(r.match(/url\([^)]+\)/g)||[]).map(async i=>{let o=i.replace(n,"$1");return o.startsWith("https://")||(o=new URL(o,e.url).href),Re(o,t.fetchRequestInit,({result:d})=>(r=r.replace(i,`url(${d})`),[i,d]))});return Promise.all(l).then(()=>r)}function xe(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=e.replace(r,"");const a=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const d=a.exec(n);if(d===null)break;t.push(d[0])}n=n.replace(a,"");const l=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",o=new RegExp(i,"gi");for(;;){let d=l.exec(n);if(d===null){if(d=o.exec(n),d===null)break;l.lastIndex=o.lastIndex}else o.lastIndex=l.lastIndex;t.push(d[0])}return t}async function Gt(e,t){const r=[],n=[];return e.forEach(a=>{if("cssRules"in a)try{T(a.cssRules||[]).forEach((l,i)=>{if(l.type===CSSRule.IMPORT_RULE){let o=i+1;const d=l.href,h=fe(d).then(p=>ge(p,t)).then(p=>xe(p).forEach(y=>{try{a.insertRule(y,y.startsWith("@import")?o+=1:a.cssRules.length)}catch(v){console.error("Error inserting rule from remote css",{rule:y,error:v})}})).catch(p=>{console.error("Error loading remote css",p.toString())});n.push(h)}})}catch(l){const i=e.find(o=>o.href==null)||document.styleSheets[0];a.href!=null&&n.push(fe(a.href).then(o=>ge(o,t)).then(o=>xe(o).forEach(d=>{i.insertRule(d,i.cssRules.length)})).catch(o=>{console.error("Error loading remote stylesheet",o)})),console.error("Error inlining remote css file",l)}}),Promise.all(n).then(()=>(e.forEach(a=>{if("cssRules"in a)try{T(a.cssRules||[]).forEach(l=>{r.push(l)})}catch(l){console.error(`Error while reading CSS rules from ${a.href}`,l)}}),r))}function Kt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Te(t.style.getPropertyValue("src")))}async function Xt(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=T(e.ownerDocument.styleSheets),n=await Gt(r,t);return Kt(n)}function Le(e){return e.trim().replace(/["']/g,"")}function Jt(e){const t=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(l=>{t.add(Le(l))}),Array.from(n.children).forEach(l=>{l instanceof HTMLElement&&r(l)})}return r(e),t}async function Yt(e,t){const r=await Xt(e,t),n=Jt(e);return(await Promise.all(r.filter(l=>n.has(Le(l.style.fontFamily))).map(l=>{const i=l.parentStyleSheet?l.parentStyleSheet.href:null;return Ae(l.cssText,i,t)}))).join(` 2`)}async function Qt(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Yt(e,t);if(r){const n=document.createElement("style"),a=document.createTextNode(r);n.appendChild(a),e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}}async function Zt(e,t={}){const{width:r,height:n}=ke(e,t),a=await K(e,t,!0);return await Qt(a,t),await $e(a,t),Ht(a,t),await pt(a,r,n)}async function es(e,t={}){const{width:r,height:n}=ke(e,t),a=await Zt(e,t),l=await G(a),i=document.createElement("canvas"),o=i.getContext("2d"),d=t.pixelRatio||ft(),h=t.canvasWidth||r,p=t.canvasHeight||n;return i.width=h*d,i.height=p*d,t.skipAutoScale||gt(i),i.style.width=`${h}`,i.style.height=`${p}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,i.width,i.height)),o.drawImage(l,0,0,i.width,i.height),i}async function pe(e,t={}){return(await es(e,t)).toDataURL()}const ts="/images/fasttrack-horizontal-logo.png",ss="/images/ft-secondary-mono-white.png",be={S:8,M:12,L:18},rs="6cqw",ns=e=>Number(e||0).toLocaleString("en-US"),z=e=>{const t=Number(e||0);return t>=1e6?`${(t/1e6).toFixed(1).replace(/\.0$/,"")}M`:t>=1e4?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}K`:t.toLocaleString("en-US")},O=(e,t,r)=>{const n=(e||"").trim();return n!==""?n:r(t)};function as({series:e}){const t=m.useMemo(()=>Math.max(1,...e.map(r=>r.count)),[e]);return s.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:"0.9cqw",height:"22cqw"},children:e.map((r,n)=>{const a=Math.max(4,r.count/t*100),l=e.length>1?n/(e.length-1):1,i=l>.72?"#00FF7F":l>.44?"#00c765":l>.2?"#176e4c":"#14312a";return s.jsx("div",{title:`${r.date}: ${r.count}`,style:{flex:1,height:`${a}%`,background:i,borderRadius:"0.6cqw 0.6cqw 0 0"}},r.date)})})}function ls({series:e}){const{line:t,area:r}=m.useMemo(()=>{const l=Math.max(1,...e.map(v=>v.count)),i=100,o=100,d=e.length>1?i/(e.length-1):i,h=e.map((v,S)=>[S*d,o-v.count/l*o]),p=h.map(([v,S])=>`${v.toFixed(2)},${S.toFixed(2)}`).join(" "),y=`M0,${o} L${p.replace(/ /g," L")} L${i},${o} Z`;return{line:p,area:y,last:h[h.length-1]}},[e]),n=Math.max(1,...e.map(l=>l.count)),a=100-e[e.length-1].count/n*100;return s.jsx("div",{style:{height:"22cqw"},children:s.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",style:{width:"100%",height:"100%",overflow:"visible"},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"ftShowcaseFill",x1:"0",x2:"0",y1:"0",y2:"1",children:[s.jsx("stop",{offset:"0",stopColor:"#00FF7F",stopOpacity:"0.26"}),s.jsx("stop",{offset:"1",stopColor:"#00FF7F",stopOpacity:"0"})]})}),s.jsx("path",{d:r,fill:"url(#ftShowcaseFill)"}),s.jsx("polyline",{points:t,fill:"none",stroke:"#00FF7F",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}),s.jsx("circle",{cx:"100",cy:a,r:"2.4",fill:"#00FF7F",vectorEffect:"non-scaling-stroke"})]})})}function Y({metrics:e,config:t,canvasRef:r,width:n}){const{series:a,headlineReal:l,deltaPct:i,membersReal:o,runsReal:d,activeReal:h,vehiclesReal:p}=e,{window:y,chart:v,logoSize:S,image:E,cards:w,overrides:g,labels:j}=t,A=i==null?"":`${i>=0?"â²":"â¼"} ${Math.abs(Math.round(i))}%`,u=(g.delta||"").trim(),b=u||A,c=u?!/^[-â¼]/.test(u):i==null||i>=0,f=[w.members&&{key:"members",label:"Members",value:O(g.members,o,z)},w.runs&&{key:"runs",label:"Runs Timed",value:O(g.runs,d,z)},w.vehicles&&{key:"vehicles",label:"Vehicles",value:O(g.vehicles,p,z)},w.active&&{key:"active",label:(j.active||"").trim()||"Active/wk",value:O(g.active,h,z)}
2].filter(Boolean);return s.jsxs("div",{ref:r,style:{containerType:"inline-size",width:n?`${n}px`:"100%",maxWidth:n?"none":420,aspectRatio:"9 / 16",background:"#070a0b",border:n?"none":"1px solid #16232b",overflow:"hidden",position:"relative",fontFamily:"'DM Sans', system-ui, -apple-system, sans-serif",display:"flex",flexDirection:"column"},children:[s.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(90deg,#0d1a22 1px,transparent 1px)",backgroundSize:"11cqw 11cqw",opacity:.3}}),s.jsxs("div",{style:{position:"relative",flex:1,boxSizing:"border-box",padding:rs,display:"flex",flexDirection:"column"},children:[s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsx("img",{src:ts,alt:"FastTrack",style:{height:`${be[S]||be.L}cqw`}}),s.jsx("img",{src:ss,alt:"","aria-hidden":!0,style:{height:"10cqw",opacity:.92}})]}),s.jsxs("div",{style:{marginTop:"9cqw",fontFamily:"'Bebas Neue','Arial Narrow',sans-serif",fontWeight:700,fontSize:"16cqw",lineHeight:.85,letterSpacing:".01em",color:"#f2f4f3",textTransform:"uppercase"},children:["Last ",y," Days"]}),w.signups?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{marginTop:"6cqw",display:"flex",alignItems:"baseline",gap:"3cqw"},children:[s.jsx("div",{style:{color:"#00FF7F",fontSize:"21cqw",fontWeight:800,lineHeight:.9,letterSpacing:"-.03em"},children:O(g.headline,l,ns)}),b&&s.jsx("div",{style:{color:c?"#8fb":"#f8a",fontSize:"3.8cqw",fontWeight:600,paddingBottom:"2.5cqw"},children:b})]}),s.jsx("div",{style:{color:"#9fb2ad",fontSize:"4.4cqw",fontWeight:600,marginTop:"0.6cqw",letterSpacing:".02em"},children:(j.caption||"").trim()||"new drivers joined"}),s.jsx("div",{style:{marginTop:"auto",marginBottom:"1.8cqw"},children:v==="line"?s.jsx(ls,{series:a}):s.jsx(as,{series:a})})]}):s.jsx("div",{style:{marginTop:"auto"}})]}),f.length>0&&s.jsx("div",{style:{position:"relative",display:"grid",gridTemplateColumns:`repeat(${f.length}, 1fr)`,gap:1,background:"#16232b",borderRadius:"3cqw",overflow:"hidden",marginTop:"4cqw"},children:f.map(x=>s.jsxs("div",{style:{background:"#070a0b",padding:"3.5cqw 1.2cqw",textAlign:"center"},children:[s.jsx("div",{style:{color:"#f2f4f3",fontSize:"5.6cqw",fontWeight:800},children:x.value}),s.jsx("div",{style:{color:"#6d827c",fontSize:"2.6cqw",letterSpacing:".12em",textTransform:"uppercase",marginTop:"0.6cqw"},children:x.label})]},x.key))}),E?s.jsxs("div",{style:{position:"relative",height:"30cqw",borderRadius:"3cqw",overflow:"hidden",marginTop:"4cqw",backgroundImage:`url('${E}')`,backgroundSize:"cover",backgroundPosition:"center 40%"},children:[s.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(180deg,rgba(7,10,11,.62),rgba(7,10,11,0) 55%)"}}),s.jsx("div",{style:{position:"absolute",left:0,right:0,top:"4.5cqw",textAlign:"center",color:"#eafff4",fontSize:"3.2cqw",letterSpacing:".24em",textTransform:"uppercase",fontWeight:600,textShadow:"0 1px 6px #000"},children:"fasttrackapp.biz"})]}):s.jsx("div",{style:{position:"relative",padding:"4cqw",textAlign:"center",color:"#4a6",fontSize:"3.2cqw",letterSpacing:".24em",textTransform:"uppercase",fontWeight:600,marginTop:"4cqw",borderTop:"1px solid #16232b"},children:"fasttrackapp.biz"})]})]})}const De="ft_admin_showcase_config_v1",D={window:14,chart:"bar",logoSize:"L",notes:!0,image:"/blog-images/dodge-charger-sixpack-hero.jpg",cards:{signups:!0,members:!0,runs:!0,active:!0,vehicles:!1},overrides:{headline:"",delta:"",members:"",runs:"",active:"",vehicles:""},labels:{active:"",caption:""}};function is(){try{const e=localStorage.getItem(De);if(!e)return D;const t=JSON.parse(e);return{...D,...t,cards:{...D.cards,...t.cards||{}},overrides:{...D.overrides,...t.overrides||{}},labels:{...D.labels,...t.labels||{}}}}catch{return D}}function os(){const[e,t]=m.useState(is);m.useEffect(()=>{try{localStorage.setItem(De,JSON.stringify(e))}catch{}},[e]);const r=m.useCallback((o,d)=>{t(h=>({...h,[o]:d}))},[]),n=m.useCallback(o=>{t(d=>({...d,cards:{...d.cards,[o]:!d.cards[o]}}))},[]),a=m.useCallback((o,d)=>{t(h=>({...h,overrides:{...h.overrides,[o]:d}}))},[]),l=m.useCallback((o,d)=>{t(h=>({...h,labels:{...h.labels,[o]:d}}))},[]),i=m.useCallback(()=>t(D),[]);return{config:e,setField:r,toggleCard:n,setOverride:a,setLabel:l,reset:i}}const cs=28,ds=[{key:"charger",label:"Charger",url:"/blog-images/dodge-charger-sixpack-hero.jpg"},{key:"corvette",label:"Corvette",url:"/blog-images/corvette-zr1x-hero.jpg"},{key:"jesko",label:"Jesko",url:"/blog-images/koenigsegg-jesko-absolut-hero.jpg"},{key:"mcmurtry",label:"McMurtry",url:"/blog-images/mcmurtry-speirling-pure-hero.jpg"},{key:"meet",label:"Car meet",url:"/blog-images/car-meet-palm-beach-hero.jpg"}],Q=({options:e,value:t,onChange:r})=>s.jsx("div",{className:"flex bg-[#191d20] rounded-lg p-0.5",children:e.map(n=>s.jsx("button",{onClick:()=>
2r(n.value),className:`flex-1 text-xs rounded-md py-1.5 px-2 transition-colors ${t===n.value?"bg-[#00FF7F] text-[#06231a] font-bold":"text-gray-400 hover:text-gray-200"}`,children:n.label},n.value))}),Pe=({on:e,onChange:t})=>s.jsx("button",{onClick:()=>t(!e),"aria-pressed":e,className:`w-9 h-5 rounded-full relative transition-colors ${e?"bg-[#00FF7F]":"bg-[#2b3136]"}`,children:s.jsx("span",{className:`absolute top-0.5 w-4 h-4 rounded-full transition-all ${e?"right-0.5 bg-[#06231a]":"left-0.5 bg-[#5a6169]"}`})}),L=({children:e})=>s.jsx("div",{className:"text-[10px] tracking-[0.14em] uppercase text-gray-500 font-semibold mt-4 mb-2",children:e}),I=({label:e,on:t,onToggle:r,override:n,onOverride:a,placeholder:l})=>s.jsxs("div",{className:"flex items-center gap-2 py-1",children:[s.jsx("button",{onClick:r,className:`text-sm flex-1 text-left ${t?"text-gray-200":"text-gray-500 line-through"}`,children:e}),s.jsx("input",{value:n,onChange:i=>a(i.target.value),placeholder:l,disabled:!t,className:"w-20 bg-[#191d20] border border-[#262b2f] rounded-md px-2 py-1 text-xs text-gray-200 placeholder:text-gray-600 disabled:opacity-40 focus:outline-none focus:border-[#00FF7F]/50"}),s.jsx(Pe,{on:t,onChange:r})]});function us({onClose:e}){const{config:t,setField:r,toggleCard:n,setOverride:a,setLabel:l,reset:i}=os(),[o,d]=m.useState(null),[h,p]=m.useState(!1),[y,v]=m.useState(!1),S=m.useRef(null),E=m.useRef(null),w=m.useRef(null);m.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[]),m.useEffect(()=>{const c=f=>{f.key==="Escape"&&(h?p(!1):e())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[h,e]),m.useEffect(()=>{let c=!0;const f=Date.now(),x=R=>new Date(f-R*864e5).toISOString(),k=async(R,N)=>{let $=Ye.from("profiles").select("*",{count:"exact",head:!0}).gte("created_at",x(R));N!=null&&($=$.lt("created_at",x(N)));const{count:P}=await $;return P||0};return Promise.all([qe(cs),Je(),ze("all"),k(7),k(14,7),k(14),k(28,14)]).then(([R,N,$,P,Me,Ue,_e])=>{if(!c)return;const q=(R.series||[]).map(X=>({date:X.date,count:X.signups||0,wau:X.wau||0})),Oe=q.length?q[q.length-1].wau:0;d({series28:q,wau:Oe,members:N?.totalUsers||0,runs:$?.runs?.total||0,vehicles:N?.totalVehicles||0,signups:{cur7:P,prev7:Me,cur14:Ue,prev14:_e}})}).catch(W(V.ui.fetch_error)),()=>{c=!1}},[]);const g=m.useMemo(()=>{if(!o)return null;const c=t.window,f=o.series28.slice(-c),x=o.signups||{cur7:0,prev7:0,cur14:0,prev14:0},k=c===7?x.cur7:x.cur14,R=c===7?x.prev7:x.prev14,N=R>0?(k-R)/R*100:null;return{series:f,headlineReal:k,deltaPct:N,membersReal:o.members,runsReal:o.runs,activeReal:o.wau,vehiclesReal:o.vehicles}},[o,t.window]),j=c=>{const f=c.target.files?.[0];if(!f)return;const x=new FileReader;x.onload=()=>r("image",x.result),x.readAsDataURL(f)},A=async()=>{const c=E.current;if(!(!c||y)){v(!0);try{const f={pixelRatio:1,cacheBust:!0,backgroundColor:"#070a0b"};await pe(c,f);const x=await pe(c,f),k=document.createElement("a");k.download=`fasttrack-growth-${new Date().toISOString().slice(0,10)}.png`,k.href=x,k.click()}catch(f){W(V.ui.fetch_error)(f)}finally{v(!1)}}},u=m.useMemo(()=>{if(!g)return[];const c=t.cards,f=t.overrides,x=(R,N,$,P)=>R?`${N}: actual ${Number($).toLocaleString()}${(P||"").trim()?` · showing "${P}"`:""}`:null,k=g.deltaPct==null?null:`Signups WoW (auto): ${g.deltaPct>=0?"+":""}${Math.round(g.deltaPct)}%${(f.delta||"").trim()?` · showing "${f.delta}"`:""}`;return[x(c.signups,`Signups (last ${t.window}d)`,g.headlineReal,f.headline),c.signups?k:null,x(c.members,"Members",g.membersReal,f.members),x(c.runs,"Runs timed",g.runsReal,f.runs),x(c.vehicles,"Vehicles",g.vehiclesReal,f.vehicles),x(c.active,"Active/wk (rolling 7-day WAU)",g.activeReal,f.active)].filter(Boolean)},[g,t.cards,t.overrides,t.window]),b=s.jsxs("div",{className:"fixed inset-0 z-[100] bg-[#050607] flex flex-col",children:[g&&s.jsx("div",{"aria-hidden":!0,style:{position:"fixed",left:-99999,top:0,pointerEvents:"none"},children:s.jsx(Y,{metrics:g,config:t,canvasRef:E,width:1080})}),h?s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-4",onClick:()=>p(!1),children:[s.jsx("div",{className:"text-gray-600 text-xs mb-3 select-none",children:"Tap outside the card or press Esc to exit · screenshot now"}),s.jsx("div",{className:"w-full flex justify-center",style:{maxHeight:"86vh"},onClick:c=>c.stopPropagation(),children:s.jsx("div",{style:{height:"86vh",aspectRatio:"9 / 16",maxWidth:"100%"},children:g&&s.jsx(Y,{metrics:g,config:t,canvasRef:S})})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[#1e2429]",children:[s.jsxs("div",{className:"flex items-center gap-2 text-white font-semibold",children:[s.jsx(te,{size:18,className:"text-[#00FF7F]"})," Growth Showcase"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:i,title:"Reset to defaults",className:"p-2 text-gray-500 hover:text-gray-300",children:s.jsx(et,{size:16})}),s.jsx("button",{onClick:e,className:"p-2 text-gray-400 hover:text-white",children:s.jsx(je,{size:20})})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto lg:overflow-hidden lg:flex",children:[s.jsxs("div",{className:"lg:w-[300px] lg:shrink-0 lg:h-full lg:overflow-y-auto border-b lg:border-b-0 lg:border-r border-[#1e2429] p-4",children:[s.jsx(L,{children:"Window"}),s.jsx(Q,{options:[{label:"7 days",value:7},{label:"14 days",value:14}],value:t.window,onChange:c=>r("window",c)}),s.jsx(L,{children:"Cards & vanity overrides"}),s.jsx(I,{label:"Signups headline",on:t.cards.signups,onToggle:()=>n("signups"),override:t.overrides.headline,onOverride:c=>a("headline",c),placeholder:"312"}),s.jsx(I,{label:"Members",on:t.cards.members,onToggle:()=>n("members"),override:t.overrides.members,onOverride:c=>a("members",c),placeholder:"3,000+"}),s.jsx(I,{label:"Runs timed",on:t.cards.runs,onToggle:()=>n("runs"),override:t.overrides.runs,onOverride:c=>a("runs",c),placeholder:"18.2K"}),s.jsx(I,{label:"Vehicles added",on:t.cards.vehicles,onToggle:()=>n("vehicles"),override:t.overrides.vehicles,onOverride:c=>a("vehicles",c),placeholder:"1,390"}),s.jsx(I,{label:"Active / week",on:t.cards.active,onToggle:()=>n("active"),override:t.overrides.active,onOverride:c=>a("active",c),placeholder:"1,190"}),s.jsx(L,{children:"Delta chip"}),s.jsx("input",{value:t.overrides.delta,onChange:c=>a("delta",c.target.value),placeholder:"auto (â² week over week)",className:"w-full bg-[#191d20] border border-[#262b2f] rounded-md px-2 py-1.5 text-xs text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-[#00FF7F]/50"}),s.jsx(L,{children:"Headline caption"}),s.jsx("input",{value:t.labels.caption,onChange:c=>l("caption",c.target.value),placeholder:"new drivers joined",className:"w-full bg-[#191d20] border border-[#262b2f] rounded-md px-2 py-1.5 text-xs text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-[#00FF7F]/50"}),s.jsx(L,{children:"Chart"}),s.jsx(Q,{options:[{label:"Bar",value:"bar"},{label:"Line",value:"line"}],value:t.chart,onChange:c=>r("chart",c)}),s.jsx(L,{children:"Bottom image"}),s.jsxs("div",{className:"grid grid-cols-3 gap-1.5",children:[ds.map(c=>s.jsx("button",{onClick:()=>r("image",c.url),className:`h-11 rounded-md bg-cover bg-center border ${t.image===c.url?"border-[#00FF7F]":"border-[#262b2f]"}`,style:{backgroundImage:`url('${c.url}')`},title:c.label},c.key)),s.jsx("button",{onClick:()=>w.current?.click(),className:"h-11 rounded-md border border-[#262b2f] text-gray-400 hover:text-gray-200 flex items-center justify-center",title:"Upload",children:s.jsx(tt,{size:15})})]}),s.jsx("div",{className:"flex items-center gap-3 mt-2",children:s.jsx("button",{onClick:()=>r("image",null),className:`text-xs ${t.image==null?"text-[#00FF7F]":"text-gray-500 hover:text-gray-300"}`,children:"No image"})}),s.jsx("input",{ref:w,type:"file",accept:"image/*",onChange:j,className:"absolute w-0 h-0 opacity-0 pointer-events-none"}),s.jsx(L,{children:"Logo size"}),s.jsx(Q,{options:[{label:"S",value:"S"},{label:"M",value:"M"},{label:"L",value:"L"}],value:t.logoSize,onChange:c=>r("logoSize",c)}),s.jsxs("div",{className:"flex items-center justify-between mt-4",children:[s.jsx("span",{className:"text-sm text-gray-200",children:"Super-admin notes"}),s.jsx(Pe,{on:t.notes,onChange:c=>r("notes",c)})]}),s.jsxs("button",{onClick:()=>p(!0),className:"w-full mt-5 bg-[#00FF7F] text-[#06231a] font-bold text-sm rounded-lg py-3 flex items-center justify-center gap-2",children:[s.jsx(te,{size:16})," Present · hide toolbar"]}),s.jsxs("button",{onClick:A,disabled:!g||y,className:"w-full mt-2 border border-[#00FF7F]/40 text-[#00FF7F] font-semibold text-sm rounded-lg py-2.5 flex items-center justify-center gap-2 hover:bg-[#00FF7F]/10 disabled:opacity-40 transition-colors",children:[s.jsx(st,{size:15})," ",y?"Renderingâ¦":"Download PNG · 1080Ã1920"]}),s.jsx("div",{className:"text-[11px] text-gray-600 mt-1.5 leading-snug",children:"Full-res story image, save it on desktop and AirDrop / send to your phone to post."})]}),s.jsxs("div",{className:"flex-1 lg:h-full lg:overflow-y-auto p-6 flex flex-col items-center gap-5",children:[s.jsx("div",{className:"w-full flex justify-center",children:s.jsx("div",{style:{width:340,maxWidth:"100%"},children:g?s.jsx(Y,{metrics:g,config:t,canvasRef:S}):s.jsx("div",{className:"w-full aspect-[9/16] bg-[#0c0f11] border border-[#1e2429] animate-pulse"})})}),t.notes&&u.length>0&&s.jsxs("div",{className:"w-full max-w-[420px] bg-[#0c0f11] border border-[#1e2429] rounded-xl p-4",children:[s.jsx("div",{className:"text-[10px] tracking-[0.14em] uppercase text-gray-500 font-semibold mb-2",children:"Super-admin notes · hidden when you present"}),s.jsx("ul",{className:"space-y-1.5",children:u.map((c,f)=>s.jsxs("li",{className:"text-xs text-gray-400 leading-relaxed",children:["· ",c]},f))})]})]})]})]})]});return Ie.createPortal(b,document.body)}const ms=["User Activity","Business Metrics"],hs={now:"Active in last 30 minutes",week:"Active this week",month:"Active this month"},ye={"auth.signin":"Sign-ins","auth.signup":"Sign-ups","post.created":"Posts created","post.commented":"Post comments","post.liked":"Post likes","post.deleted":"Posts deleted","vehicle.created":"Vehicles created","vehicle.deleted":"Vehicles deleted","run.logged":"Runs logged","run.deleted":"Runs deleted","rolling_run.logged":"Rolling runs logged","rolling_run.deleted":"Rolling runs deleted","drive.created":"Drives created","drive.deleted":"Drives deleted","group_post.created":"Group posts created","group_post.commented":"Group post comments","friend.requested":"Friend requests sent","friend.accepted":"Friend requests accepted","user.blocked":"Users blocked","group.created":"Groups created","group.invited":"Group invites sent","listing.created":"Listings created","offer.created":"Offers made","offer.accepted":"Offers accepted","offer.declined":"Offers declined","offer.countered":"Offers countered","transaction.created":"Transactions started","transaction.paid":"Transactions paid","transaction.shipped":"Items shipped","transaction.delivered":"Items delivered","transaction.completed":"Transactions completed","transaction.disputed":"Transactions disputed","transaction.refunded":"Transactions refunded","transaction.cancelled":"Transactions cancelled","review.created":"Reviews left","message.sent":"Messages sent","report.filed":"Reports filed","report.reviewed":"Reports reviewed","report.dismissed":"Reports dismissed","report.resolved":"Reports resolved"},fs={auth:"#A78BFA",content:"#00FF7F",social:"#60A5FA",marketplace:"#FBBF24",messaging:"#2DD4BF",moderation:"#F87171",admin:"#9CA3AF"},ve=e=>ye[e]?ye[e]:e.split(".").map(t=>t.charAt(0).toUpperCase()+t.slice(1).replace(/_/g," ")).join(" · "),gs=e=>{if(!e)return", ";const t=new Date(e);if(Number.isNaN(t.getTime()))return", ";const r=Math.floor((Date.now()-t.getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<86400*30?`${Math.floor(r/86400)}d ago`:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})},Z=e=>
2`$${((e||0)/100).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`,ee=({icon:e,label:t,value:r,color:n="#00FF7F",onClick:a})=>s.jsxs("button",{onClick:a,className:"text-left bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl p-5 hover:border-[#00FF7F]/40 hover:bg-[#1f1f1f] transition-colors w-full",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-[#0a0a0a]",children:s.jsx(e,{size:18,style:{color:n}})}),s.jsx("span",{className:"text-gray-400 text-sm font-medium",children:t})]}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("span",{className:"text-2xl font-bold",style:{color:n},children:r}),s.jsx("span",{className:"text-[10px] text-gray-500 ml-auto",children:"Click to drill in"})]})]}),xs=({data:e})=>{const t=m.useMemo(()=>Math.max(...e.map(r=>r.count),1),[e]);return s.jsxs("div",{className:"bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl p-5 overflow-x-auto",children:[s.jsx("h3",{className:"text-white text-sm font-semibold mb-4",children:"Signups (Last 14 Days)"}),s.jsx("div",{className:"flex items-end gap-1.5 min-w-[400px]",style:{height:160},children:e.map(r=>{const n=t>0?r.count/t*100:0,l=new Date(r.date+"T00:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric"});return s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-end h-full",children:[r.count>0&&s.jsx("span",{className:"text-[#00FF7F] text-[10px] font-bold mb-1",children:r.count}),s.jsx("div",{className:"w-full rounded-t",style:{height:`${Math.max(n,r.count>0?4:0)}%`,backgroundColor:"#00FF7F",opacity:r.count>0?1:.15,minHeight:r.count>0?4:1}}),s.jsx("span",{className:"text-gray-600 text-[8px] mt-1.5 rotate-[-45deg] origin-top-left whitespace-nowrap",children:l})]},r.date)})})]})},B=({label:e,count:t,maxCount:r,color:n="#00FF7F"})=>{const a=r>0?t/r*100:0;return s.jsxs("div",{className:"mb-3",children:[s.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[s.jsx("span",{className:"text-gray-400",children:e}),s.jsx("span",{className:"font-bold",style:{color:n},children:t})]}),s.jsx("div",{className:"h-3 bg-[#0a0a0a] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.max(a,t>0?2:0)}%`,backgroundColor:n}})})]})},ps=({window:e,onClose:t})=>{const[r,n]=m.useState("breakdown"),[a,l]=m.useState(null),[i,o]=m.useState(null),[d,h]=m.useState(null),[p,y]=m.useState(!0),[v,S]=m.useState(!1),[E,w]=m.useState(null);m.useEffect(()=>{let u=!0;return y(!0),w(null),Ke(e).then(b=>{u&&o(b)}).catch(b=>{u&&w(b.message||"Failed to load")}).finally(()=>{u&&y(!1)}),()=>{u=!1}},[e]);const g=m.useCallback(u=>{S(!0),h(null),w(null),Xe(e,{actionType:u,limit:200}).then(h).catch(b=>w(b.message||"Failed to load")).finally(()=>S(!1))},[e]),j=u=>{l(u),n("users"),g(u)},A=()=>{n("breakdown"),l(null),h(null)};return m.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[]),s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70",onClick:t,children:s.jsxs("div",{className:"w-full max-w-2xl max-h-[85vh] flex flex-col bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl shadow-xl",onClick:u=>u.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#2a2a2a]",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[r==="users"&&s.jsx("button",{onClick:A,className:"text-gray-400 hover:text-white transition-colors","aria-label":"Back",children:s.jsx(ct,{size:18})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-white font-semibold text-base truncate",children:r==="breakdown"?hs[e]:a?`Users: ${ve(a)}`:`All active users (${e==="now"?"30 min":e==="week"?"7 days":"30 days"})`}),r==="breakdown"&&i&&s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[i.totalUsers.toLocaleString()," active user",i.totalUsers!==1?"s":""," · ",i.totalEvents.toLocaleString()," event",i.totalEvents!==1?"s":""]})]})]}),s.jsx("button",{onClick:t,className:"text-gray-500 hover:text-white transition-colors","aria-label":"Close",children:s.jsx(je,{size:18})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[E&&s.jsx("p",{className:"text-sm text-accent2 bg-accent2/10 border border-accent2/20 rounded-lg mx-6 mt-4 px-3 py-2",children:E}),r==="breakdown"&&s.jsx(s.Fragment,{children:p?s.jsx(se,{}):!i||i.breakdown.length===0?s.jsx(re,{text:"No activity in this window"}):s.jsxs("div",{children:[s.jsxs("button",{onClick:()=>j(null),className:"w-full text-left px-6 py-3 border-b border-[#2a2a2a] hover:bg-[#0f0f0f] transition-colors flex items-center gap-3",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-[#00FF7F]"}),s.jsx("span",{className:"flex-1 text-white text-sm font-semibold",children:"View all active users"}),s.jsx("span",{className:"text-gray-400 text-sm font-bold",children:i.totalUsers}),s.jsx(ce,{size:14,className:"text-gray-600"})]}),i.breakdown.map(u=>{const b=fs[u.category]||"#00FF7F";return s.jsxs("button",{onClick:()=>j(u.action_type),className:"w-full text-left px-6 py-3 border-b border-[#2a2a2a] last:border-b-0 hover:bg-[#0f0f0f] transition-colors flex items-center gap-3",children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:b}}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-white text-sm font-medium truncate",children:ve(u.action_type)}),s.jsxs("div",{className:"text-[11px] text-gray-500 mt-0.5",children:[u.unique_users," user",u.unique_users!==1?"s":""]})]}),s.jsx("span",{className:"text-sm font-bold",style:{color:b}
2,children:u.event_count.toLocaleString()}),s.jsx(ce,{size:14,className:"text-gray-600"})]},u.action_type)})]})}),r==="users"&&s.jsx(s.Fragment,{children:v?s.jsx(se,{}):!d||d.length===0?s.jsx(re,{text:"No users matched this activity"}):s.jsx("div",{children:d.map((u,b)=>{const c={id:u.user_id,username:u.username,display_name:u.display_name,avatar_url:u.avatar_url,is_verified:u.is_verified};return s.jsxs(we,{to:u.user_id?`/admin/users/${u.user_id}`:"#",onClick:t,className:"flex items-center gap-3 px-6 py-3 border-b border-[#2a2a2a] last:border-b-0 hover:bg-[#0f0f0f] transition-colors",children:[s.jsx("span",{className:"text-gray-500 text-xs font-bold w-5 text-right",children:b+1}),s.jsx(Se,{profile:c,size:"xs"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-white text-sm font-medium truncate",children:u.display_name||u.username||"Unknown"}),s.jsxs("div",{className:"text-[11px] text-gray-500 truncate",children:[u.username?`@${u.username}`:"No username"," · last action ",gs(u.last_event_at)]})]}),s.jsx("span",{className:"text-[#00FF7F] text-sm font-bold",children:u.event_c
2ount.toLocaleString()})]},u.user_id||b)})})})]})]})})},As=()=>{const{profile:e}=Qe(),t=Ze(e?.role),r=t?ms:["User Activity"],[n,a]=m.useState("User Activity"),[l,i]=m.useState(!0),[o,d]=m.useState(!1),[h,p]=m.useState(null),[y,v]=m.useState([]),[S,E]=m.useState([]),[w,g]=m.useState(null),[j,A]=m.useState(null),[u,b]=m.useState(null);return m.useEffect(()=>{n==="User Activity"?(i(!0),Promise.all([Be(),We(14),Ve(10,"month")]).then(([c,f,x])=>{p(c),v(f),E(x)}).catch(W(V.ui.fetch_error)).finally(()=>i(!1))):t&&(i(!0),Promise.all([He(),Ge()]).then(([c,f])=>{A(c),b(f)}).catch(W(V.ui.fetch_error)).finally(()=>i(!1)))},[n,t]),s.jsxs("div",{children:[o&&s.jsx(us,{onClose:()=>d(!1)}),s.jsxs("div",{className:"flex items-center gap-3 mb-5 border-b border-[#2a2a2a]",children:[s.jsx("div",{className:"flex gap-1 overflow-x-auto flex-nowrap flex-1",children:r.map(c=>s.jsx("button",{onClick:()=>a(c),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${n===c?"text-[#00FF7F] border-[#00FF7F]":"text-gray-500 border-transparent hover:text-gray-300"}`,children:c},c))}),t&&s.jsxs("button",{onClick:()=>d(!0),title:"Growth Showcase, shareable growth snapshot",className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 mb-1 rounded-lg border border-[#00FF7F]/40 text-[#00FF7F] text-xs font-semibold hover:bg-[#00FF7F]/10 transition-colors",children:[s.jsx(te,{size:15})," Showcase"]})]}),l?s.jsx(se,{}):s.jsxs(s.Fragment,{children:[n==="User Activity"&&h&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3",children:[s.jsx(M,{icon:rt,label:"Total Users",value:h.totalUsers,delta:h.newToday}),s.jsx(ee,{icon:nt,label:"Active (30 min)",value:h.activeNow,color:"#00FF7F",onClick:()=>g("now")}),s.jsx(ee,{icon:ie,label:"Active This Week",value:h.activeThisWeek,color:"#2DD4BF",onClick:()=>g("week")}),s.jsx(ee,{icon:ie,label:"Active This Month",value:h.activeThisMonth,onClick:()=>g("month")}),s.jsx(M,{icon:at,label:"New This Month",value:h.newThisMonth,color:"#2DD4BF"})]}),s.jsx(xs,{data:y}),s.jsxs("div",{className:"bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"px-5 py-3 border-b border-[#2a2a2a] flex items-center justify-between",children:[s.jsx("h3",{className:"text-white text-sm font-semibold",children:"Most Active Users (Last 30 Days)"}),s.jsx("button",{onClick:()=>g("month"),className:"text-[10px] text-gray-500 hover:text-[#00FF7F] transition-colors",children:"See all â"})]}),S.length===0?s.jsx(re,{text:"No active users"}):s.jsx("div",{children:S.map((c,f)=>s.jsxs("div",{className:`flex items-center gap-4 px-5 py-3 ${f<S.length-1?"border-b border-[#2a2a2a]":""}`,children:[s.jsx("span",{className:"text-gray-500 text-sm font-bold w-6 text-center",children:f+1}),c.profile&&s.jsx(Se,{profile:c.profile,size:"xs"}),s.jsx(we,{to:`/admin/users/${c.userId}`,className:"text-white text-sm font-medium truncate hover:text-[#00FF7F] transition-colors flex-1 min-w-0",children:c.profile?.display_name||c.profile?.username||"Unknown"}),s.jsxs("span",{className:"text-[#00FF7F] text-sm font-bold",children:[c.eventCount.toLocaleString()," action",c.eventCount!==1?"s":""]})]},c.userId))})]})]}),n==="Business Metrics"&&j&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[s.jsx(M,{icon:oe,label:"Total GMV",value:Z(j.totalGMV)}),s.jsx(M,{icon:lt,label:"Transactions",value:j.totalTransactions}),s.jsx(M,{icon:it,label:"Avg Order Value",value:Z(j.avgOrderValue),color:"#2DD4BF"}),s.jsx(M,{icon:oe,label:"Platform Revenue",value:Z(j.platformRevenue),color:"#2DD4BF"})]}),j.disputedCount>0&&s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 bg-accent2/10 border border-accent2/20 rounded-xl",children:[s.jsx(ot,{size:16,className:"text-red-400"}),s.jsxs("span",{className:"text-accent2 text-sm font-medium",children:[j.disputedCount," disputed transaction",j.disputedCount!==1?"s":""]})]}),u&&s.jsxs("div",{className:"bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl p-5",children:[s.jsx("h3",{className:"text-white text-sm font-semibold mb-4",children:"Seller Funnel"}),s.jsx(B,{label:"Registered Sellers",count:u.totalSellers,maxCount:u.totalSellers}),s.jsx(B,{label:"Onboarded (Stripe)",count:u.onboarded,maxCount:u.totalSellers,color:"#00FF7F"}),s.jsx(B,{label:"Have Listings",count:u.withListings,maxCount:u.totalSellers,color:"#00BFFF"}),s.jsx(B,{label:"Have Sales",count:u.withSales,maxCount:u.totalSellers,color:"#2DD4BF"})]})]})]}),w&&s.jsx(ps,{window:w,onClose:()=>g(null)})]})};export{As 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.