oneshot-gtm-server 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/bin.mjs +2232 -1211
  2. package/dist/bin.mjs.map +1 -1
  3. package/dist/web/assets/Badge-B2tW85qr.js +1 -0
  4. package/dist/web/assets/Button-C-XcKplu.js +1 -0
  5. package/dist/web/assets/EmptyNote-zvLnRLPo.js +1 -0
  6. package/dist/web/assets/Field-BxSk5tbg.js +1 -0
  7. package/dist/web/assets/Modal-CU0ZPvE2.js +1 -0
  8. package/dist/web/assets/Skeleton-DNAfO8PV.js +1 -0
  9. package/dist/web/assets/StrategistPanel-DMjQbPlQ.js +6 -0
  10. package/dist/web/assets/cadences-CvBPoULf.js +1 -0
  11. package/dist/web/assets/chevron-down-CDjJN-YY.js +1 -0
  12. package/dist/web/assets/chevron-right-BTFaTdbr.js +1 -0
  13. package/dist/web/assets/cn-CS0Arupu.js +1 -0
  14. package/dist/web/assets/inbox-CzzgtWQf.js +1 -0
  15. package/dist/web/assets/index-B_nrqLlS.js +54 -0
  16. package/dist/web/assets/index-Ya_svHJk.css +2 -0
  17. package/dist/web/assets/loader-circle-CKkt6cSn.js +1 -0
  18. package/dist/web/assets/measure-CEgySDdR.js +1 -0
  19. package/dist/web/assets/plays-CuudkOHb.js +1 -0
  20. package/dist/web/assets/queue-C7vGtsQ5.js +1 -0
  21. package/dist/web/assets/receipts-B5u3oLpw.js +1 -0
  22. package/dist/web/assets/refresh-cw-Bz4Kdt55.js +1 -0
  23. package/dist/web/assets/routes-DHC_we4Z.js +1 -0
  24. package/dist/web/assets/run._playName-B9sG9Msq.js +4 -0
  25. package/dist/web/assets/send-Bv2Dd-HU.js +1 -0
  26. package/dist/web/assets/setup-BRVBiCEX.js +1 -0
  27. package/dist/web/assets/{summarizeRun-BsPt7szF.js → summarizeRun-CVWcweeA.js} +1 -2
  28. package/dist/web/assets/x-CPdidoxn.js +1 -0
  29. package/dist/web/index.html +3 -3
  30. package/package.json +1 -1
  31. package/dist/web/assets/Badge-DE7L41a6.js +0 -2
  32. package/dist/web/assets/Badge-DE7L41a6.js.map +0 -1
  33. package/dist/web/assets/Button-NJ1UVzeB.js +0 -2
  34. package/dist/web/assets/Button-NJ1UVzeB.js.map +0 -1
  35. package/dist/web/assets/EmptyNote-DkmaZWuo.js +0 -2
  36. package/dist/web/assets/EmptyNote-DkmaZWuo.js.map +0 -1
  37. package/dist/web/assets/Field-B4mT8TGa.js +0 -2
  38. package/dist/web/assets/Field-B4mT8TGa.js.map +0 -1
  39. package/dist/web/assets/Modal-frAt7msr.js +0 -2
  40. package/dist/web/assets/Modal-frAt7msr.js.map +0 -1
  41. package/dist/web/assets/Skeleton-d2p06ghN.js +0 -2
  42. package/dist/web/assets/Skeleton-d2p06ghN.js.map +0 -1
  43. package/dist/web/assets/cadences-CsU8vKw2.js +0 -2
  44. package/dist/web/assets/cadences-CsU8vKw2.js.map +0 -1
  45. package/dist/web/assets/chevron-right-BXb7J1cp.js +0 -2
  46. package/dist/web/assets/chevron-right-BXb7J1cp.js.map +0 -1
  47. package/dist/web/assets/inbox-Dzd9QYT4.js +0 -2
  48. package/dist/web/assets/inbox-Dzd9QYT4.js.map +0 -1
  49. package/dist/web/assets/index-ByTPAanr.css +0 -2
  50. package/dist/web/assets/index-CzTgATNQ.js +0 -60
  51. package/dist/web/assets/index-CzTgATNQ.js.map +0 -1
  52. package/dist/web/assets/loader-circle-BylpxA-u.js +0 -2
  53. package/dist/web/assets/loader-circle-BylpxA-u.js.map +0 -1
  54. package/dist/web/assets/measure-S3BWSb2L.js +0 -2
  55. package/dist/web/assets/measure-S3BWSb2L.js.map +0 -1
  56. package/dist/web/assets/plays-DHIZA49D.js +0 -2
  57. package/dist/web/assets/plays-DHIZA49D.js.map +0 -1
  58. package/dist/web/assets/queue-ClVxfeJ0.js +0 -2
  59. package/dist/web/assets/queue-ClVxfeJ0.js.map +0 -1
  60. package/dist/web/assets/receipts-BgXV3-De.js +0 -2
  61. package/dist/web/assets/receipts-BgXV3-De.js.map +0 -1
  62. package/dist/web/assets/refresh-cw-BpMRSA9y.js +0 -2
  63. package/dist/web/assets/refresh-cw-BpMRSA9y.js.map +0 -1
  64. package/dist/web/assets/routes-B9L9tBMF.js +0 -2
  65. package/dist/web/assets/routes-B9L9tBMF.js.map +0 -1
  66. package/dist/web/assets/run._playName-a3eeybKs.js +0 -5
  67. package/dist/web/assets/run._playName-a3eeybKs.js.map +0 -1
  68. package/dist/web/assets/setup-fs0DMLq4.js +0 -2
  69. package/dist/web/assets/setup-fs0DMLq4.js.map +0 -1
  70. package/dist/web/assets/summarizeRun-BsPt7szF.js.map +0 -1
@@ -1,2 +0,0 @@
1
- import{s as e}from"./Button-NJ1UVzeB.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
2
- //# sourceMappingURL=loader-circle-BylpxA-u.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader-circle-BylpxA-u.js","names":[],"sources":["../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/loader-circle.mjs"],"sourcesContent":["/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [[\"path\", { d: \"M21 12a9 9 0 1 1-6.219-8.56\", key: \"13zald\" }]];\nconst LoaderCircle = createLucideIcon(\"loader-circle\", __iconNode);\n\nexport { __iconNode, LoaderCircle as default };\n//# sourceMappingURL=loader-circle.mjs.map\n"],"x_google_ignoreList":[0],"mappings":"yCAUA,IAAM,EAAe,EAAiB,gBAAiB,CADnC,CAAC,OAAQ,CAAE,EAAG,8BAA+B,IAAK,SAAU,CAAC,CAC1B,CAAW"}
@@ -1,2 +0,0 @@
1
- import{c as e,d as t,l as n,n as r,o as i,r as a,t as o}from"./Button-NJ1UVzeB.js";import{p as s}from"./index-CzTgATNQ.js";import{t as c}from"./EmptyNote-DkmaZWuo.js";import{n as l}from"./Skeleton-d2p06ghN.js";var u=t(n(),1),d=e(),f={receipt:`var(--ink-receipt)`,spend:`var(--ink-spend)`,blocked:`var(--ink-blocked)`,signal:`var(--ink-signal)`,muted:`var(--ink-muted)`};function p({values:e,width:t=120,height:n=28,tone:i=`receipt`,animateIn:a=!0,fill:o=!0,tip:s=!0,className:c,"aria-label":l}){let p=(0,u.useId)(),h=f[i],{path:g,area:_,tipX:v,tipY:y,length:b}=(0,u.useMemo)(()=>m(e,t,n),[e,t,n]);return e.length===0?(0,d.jsx)(`svg`,{width:t,height:n,className:r(`block`,c),role:`img`,"aria-label":l??`no data`}):(0,d.jsxs)(`svg`,{width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:r(`block`,c),role:`img`,"aria-label":l??`sparkline`,children:[o&&(0,d.jsx)(`defs`,{children:(0,d.jsxs)(`linearGradient`,{id:`${p}-g`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,d.jsx)(`stop`,{offset:`0%`,stopColor:h,stopOpacity:`0.28`}),(0,d.jsx)(`stop`,{offset:`100%`,stopColor:h,stopOpacity:`0`})]})}),o&&(0,d.jsx)(`path`,{d:_,fill:`url(#${p}-g)`}),(0,d.jsx)(`path`,{d:g,fill:`none`,stroke:h,strokeWidth:1.25,strokeLinecap:`round`,strokeLinejoin:`round`,style:a?{strokeDasharray:b,strokeDashoffset:b,animation:`ln-draw 600ms var(--ease-reveal) forwards`,"--ln-dash-length":`${b}`}:void 0}),s&&(0,d.jsx)(`circle`,{cx:v,cy:y,r:1.8,fill:h,style:a?{opacity:0,animation:`ln-settle 280ms var(--ease-reveal) 500ms forwards`}:void 0})]})}function m(e,t,n){let r=t-4,i=n-4,a=Math.min(...e),o=Math.max(...e)-a||1,s=e.length,c=s>1?r/(s-1):0,l=e.map((e,t)=>[2+t*c,2+(1-(e-a)/o)*i]),u=l.map(([e,t],n)=>n===0?`M${e.toFixed(2)},${t.toFixed(2)}`:`L${e.toFixed(2)},${t.toFixed(2)}`).join(` `),d=l[0],f=l[l.length-1],p=`${u} L${f[0].toFixed(2)},${(n-2).toFixed(2)} L${d[0].toFixed(2)},${(n-2).toFixed(2)} Z`,m=0;for(let e=1;e<l.length;e++){let t=l[e][0]-l[e-1][0],n=l[e][1]-l[e-1][1];m+=Math.sqrt(t*t+n*n)}return m=Math.max(m,1),{path:u,area:p,tipX:f[0],tipY:f[1],length:m}}var h=[{label:`all-time`,value:void 0},{label:`30d`,value:30},{label:`7d`,value:7}];function g(){let[e,t]=(0,u.useState)(void 0),n=s({queryKey:[`measure`,`cac`,e],queryFn:()=>i.measureCac(e)}),f=s({queryKey:[`measure`,`rocs`,e],queryFn:()=>i.measureRocs(e)}),m=s({queryKey:[`measure`,`receipts-trend`],queryFn:()=>i.receipts({limit:500}),staleTime:6e4}),g=e??30,b=(0,u.useMemo)(()=>_(m.data?.receipts??[],g),[m.data?.receipts,g]),x=n.data?.spend.reduce((e,t)=>e+t.totalUsd,0)??0,S=n.data?.events.reduce((e,t)=>e+t.replied,0)??0,C=n.data?.events.reduce((e,t)=>e+t.sent,0)??0,w=f.data?.outcomes.reduce((e,t)=>e+t.won,0)??0;return(0,d.jsxs)(`div`,{className:`-mx-6 -my-6 flex flex-col`,children:[(0,d.jsxs)(`section`,{className:`flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:`The Ledger · Measure`}),(0,d.jsx)(`h1`,{className:`mt-1 text-ink-cream`,style:{fontFamily:`var(--font-display)`,fontSize:44,fontWeight:600,letterSpacing:`-0.025em`,lineHeight:.98},children:`$ per reply, per meeting, per won.`})]}),(0,d.jsx)(`div`,{className:`flex items-center gap-1.5`,children:h.map(n=>(0,d.jsx)(o,{variant:e===n.value?`primary`:`secondary`,size:`sm`,onClick:()=>t(n.value),children:n.label},n.label))})]}),(0,d.jsxs)(`section`,{className:`grid grid-cols-2 divide-x divide-ink-rule border-b border-ink-rule md:grid-cols-4`,children:[(0,d.jsx)(v,{label:`Total spend`,value:n.data?a(x):void 0,tone:`spend`}),(0,d.jsx)(v,{label:`Sent`,value:n.data?String(C):void 0,caption:`lifetime, all plays`}),(0,d.jsx)(v,{label:`Replied`,value:n.data?String(S):void 0,caption:n.data&&C>0?`${(S/C*100).toFixed(1)}% reply rate`:void 0,tone:`receipt`}),(0,d.jsx)(v,{label:`Won`,value:f.data?String(w):void 0,caption:f.data?`deals`:void 0})]}),(0,d.jsxs)(`section`,{className:`border-b border-ink-rule`,children:[(0,d.jsxs)(`div`,{className:`flex items-baseline justify-between px-6 pb-2 pt-5`,children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:`CAC by play · signed receipts`}),(0,d.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:y(e)})]}),n.isLoading?Array.from({length:3},(e,t)=>(0,d.jsx)(l,{},t)):n.data?.spend.length===0?(0,d.jsx)(`div`,{className:`px-6 pb-6`,children:(0,d.jsx)(c,{note:`No spend in this window. Run a play and the dollars will account for themselves.`,cli:`oneshot-gtm motion show-hn --target targets.json`})}):(0,d.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,d.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`play`}),(0,d.jsxs)(`th`,{className:`py-2 text-left font-medium`,children:[`spend · `,g,`d`]}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`spend`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`calls`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`sent`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`replied`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`$/send`}),(0,d.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`$/reply`})]})}),(0,d.jsx)(`tbody`,{children:n.data?.spend.map((e,t)=>{let i=n.data.events.find(t=>t.playName===e.playName),o=i?.sent??0,s=i?.replied??0,c=b.get(e.playName)??[];return(0,d.jsxs)(`tr`,{className:r(`border-t border-ink-rule/60`,t%2==1&&`bg-ink-surface/20`),children:[(0,d.jsx)(`td`,{className:`px-6 py-2 text-ink-cream`,children:e.playName}),(0,d.jsx)(`td`,{className:`py-2`,children:c.length>1?(0,d.jsx)(p,{values:c,tone:`spend`,width:96,height:22,"aria-label":`${e.playName} spend over last ${g} days`}):(0,d.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream`,children:a(e.totalUsd)}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:e.calls}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:o}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:s}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream-2`,children:o>0?a(e.totalUsd/o):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]`,children:s>0?a(e.totalUsd/s):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})})]},e.playName)})})]})]}),(0,d.jsxs)(`section`,{className:`border-b border-ink-rule`,children:[(0,d.jsxs)(`div`,{className:`flex items-baseline justify-between px-6 pb-2 pt-5`,children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:`RoCS · return on cognitive spend`}),(0,d.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:y(e)})]}),f.isLoading?Array.from({length:3},(e,t)=>(0,d.jsx)(l,{},t)):f.data?.spend.length===0?(0,d.jsx)(`div`,{className:`px-6 pb-6`,children:(0,d.jsx)(c,{note:`No spend in this window to attribute to outcomes yet.`})}):(0,d.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,d.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`play`}),(0,d.jsxs)(`th`,{className:`py-2 text-left font-medium`,children:[`spend · `,g,`d`]}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`spend`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`meetings`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`SQLs`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`won`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`$/meeting`}),(0,d.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`$/won`})]})}),(0,d.jsx)(`tbody`,{children:f.data?.spend.map((e,t)=>{let n=f.data.outcomes.find(t=>t.playName===e.playName),i=n?.meetings??0,o=n?.sqls??0,s=n?.won??0,c=b.get(e.playName)??[];return(0,d.jsxs)(`tr`,{className:r(`border-t border-ink-rule/60`,t%2==1&&`bg-ink-surface/20`),children:[(0,d.jsx)(`td`,{className:`px-6 py-2 text-ink-cream`,children:e.playName}),(0,d.jsx)(`td`,{className:`py-2`,children:c.length>1?(0,d.jsx)(p,{values:c,tone:`spend`,width:96,height:22,"aria-label":`${e.playName} spend over last ${g} days`}):(0,d.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream`,children:a(e.totalUsd)}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:i}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:o}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-[color:var(--ink-receipt-2)]`,children:s}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream-2`,children:i>0?a(e.totalUsd/i):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]`,children:s>0?a(e.totalUsd/s):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})})]},e.playName)})})]})]})]})}function _(e,t){let n=Math.max(7,Math.min(t,90)),r=Date.now(),i=new Map;for(let t of e){if(t.costUsd==null)continue;let e=new Date(t.createdAt).getTime();if(Number.isNaN(e))continue;let a=Math.floor((r-e)/864e5);if(a<0||a>=n)continue;let o=n-1-a,s=i.get(t.playName);s||(s=Array.from({length:n},()=>0),i.set(t.playName,s)),s[o]=(s[o]??0)+t.costUsd}return i}function v({label:e,value:t,caption:n,tone:r=`neutral`}){return(0,d.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:e}),(0,d.jsx)(`div`,{className:`mt-1 truncate text-ink-cream ln-numeral`,style:{fontSize:34,lineHeight:1},children:t??(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})}),n&&(0,d.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px]`,style:{color:r===`spend`?`var(--ink-spend-2)`:r===`receipt`?`var(--ink-receipt-2)`:`var(--ink-faint)`},children:n})]})}function y(e){return e===void 0?`all-time`:`last ${e}d`}export{g as component};
2
- //# sourceMappingURL=measure-S3BWSb2L.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"measure-S3BWSb2L.js","names":["useQuery","useMemo","useState","api","Button","EmptyNote","SkeletonRow","Sparkline","cn","formatUsd","RANGES","label","value","undefined","const","MeasurePage","sinceDays","setSinceDays","cac","queryKey","queryFn","measureCac","rocs","measureRocs","receipts","limit","staleTime","sparkDays","spendSeries","buildSpendSeries","data","totalSpend","spend","reduce","a","s","totalUsd","totalReplied","events","e","replied","totalSent","sent","totalWon","outcomes","o","won","fontFamily","fontSize","fontWeight","letterSpacing","lineHeight","map","r","String","toFixed","rangeLabel","isLoading","Array","from","length","_","i","ev","find","playName","series","get","calls","oc","meet","meetings","sql","sqls","ReceiptView","windowDays","Map","days","Math","max","min","now","Date","DAY_MS","out","costUsd","ts","createdAt","getTime","Number","isNaN","daysAgo","floor","idx","arr","set","Summary","caption","tone","captionColor","color","component"],"sources":["../../src/components/primitives/Sparkline.tsx","../../src/routes/measure.tsx?tsr-split=component"],"sourcesContent":["import { useId, useMemo } from \"react\";\nimport { cn } from \"../../lib/cn.ts\";\n\ninterface SparklineProps {\n /** Values in chronological order. First is oldest, last is newest. */\n values: number[];\n width?: number;\n height?: number;\n /** Stroke colour (CSS colour). Defaults to the receipt tone. */\n tone?: \"receipt\" | \"spend\" | \"blocked\" | \"signal\" | \"muted\";\n /** Animate the stroke drawing in on mount. */\n animateIn?: boolean;\n /** Draw a subtle area fill under the line. */\n fill?: boolean;\n /** Show a filled dot at the last point (current reading). */\n tip?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}\n\nconst TONE_VAR: Record<NonNullable<SparklineProps[\"tone\"]>, string> = {\n receipt: \"var(--ink-receipt)\",\n spend: \"var(--ink-spend)\",\n blocked: \"var(--ink-blocked)\",\n signal: \"var(--ink-signal)\",\n muted: \"var(--ink-muted)\",\n};\n\n/**\n * A tiny SVG sparkline. No chart library — just a smooth polyline over\n * the values you give it, optionally with a faint fill and a tip dot.\n * The line draws in like an EKG on mount when `animateIn` is true.\n */\nexport function Sparkline({\n values,\n width = 120,\n height = 28,\n tone = \"receipt\",\n animateIn = true,\n fill = true,\n tip = true,\n className,\n \"aria-label\": ariaLabel,\n}: SparklineProps) {\n const id = useId();\n const colour = TONE_VAR[tone];\n\n const { path, area, tipX, tipY, length } = useMemo(\n () => buildPath(values, width, height),\n [values, width, height],\n );\n\n if (values.length === 0) {\n return (\n <svg\n width={width}\n height={height}\n className={cn(\"block\", className)}\n role=\"img\"\n aria-label={ariaLabel ?? \"no data\"}\n />\n );\n }\n\n return (\n <svg\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n className={cn(\"block\", className)}\n role=\"img\"\n aria-label={ariaLabel ?? \"sparkline\"}\n >\n {fill && (\n <defs>\n <linearGradient id={`${id}-g`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={colour} stopOpacity=\"0.28\" />\n <stop offset=\"100%\" stopColor={colour} stopOpacity=\"0\" />\n </linearGradient>\n </defs>\n )}\n {fill && <path d={area} fill={`url(#${id}-g)`} />}\n <path\n d={path}\n fill=\"none\"\n stroke={colour}\n strokeWidth={1.25}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={\n animateIn\n ? ({\n strokeDasharray: length,\n strokeDashoffset: length,\n animation: \"ln-draw 600ms var(--ease-reveal) forwards\",\n [\"--ln-dash-length\" as string]: `${length}`,\n } as React.CSSProperties)\n : undefined\n }\n />\n {tip && (\n <circle\n cx={tipX}\n cy={tipY}\n r={1.8}\n fill={colour}\n style={\n animateIn\n ? ({\n opacity: 0,\n animation: \"ln-settle 280ms var(--ease-reveal) 500ms forwards\",\n } as React.CSSProperties)\n : undefined\n }\n />\n )}\n </svg>\n );\n}\n\nfunction buildPath(values: number[], width: number, height: number) {\n const pad = 2;\n const w = width - pad * 2;\n const h = height - pad * 2;\n const min = Math.min(...values);\n const max = Math.max(...values);\n const range = max - min || 1;\n const n = values.length;\n const step = n > 1 ? w / (n - 1) : 0;\n\n const pts = values.map((v, i) => {\n const x = pad + i * step;\n const y = pad + (1 - (v - min) / range) * h;\n return [x, y] as const;\n });\n\n const path = pts\n .map(([x, y], i) =>\n i === 0 ? `M${x.toFixed(2)},${y.toFixed(2)}` : `L${x.toFixed(2)},${y.toFixed(2)}`,\n )\n .join(\" \");\n const first = pts[0]!;\n const last = pts[pts.length - 1]!;\n const area = `${path} L${last[0].toFixed(2)},${(height - pad).toFixed(2)} L${first[0].toFixed(2)},${(\n height - pad\n ).toFixed(2)} Z`;\n\n // Approximate polyline length for stroke-dasharray drawing animation.\n let length = 0;\n for (let i = 1; i < pts.length; i++) {\n const dx = pts[i]![0] - pts[i - 1]![0];\n const dy = pts[i]![1] - pts[i - 1]![1];\n length += Math.sqrt(dx * dx + dy * dy);\n }\n length = Math.max(length, 1);\n\n return { path, area, tipX: last[0], tipY: last[1], length };\n}\n","import { useQuery } from \"@tanstack/react-query\";\nimport { createFileRoute } from \"@tanstack/react-router\";\nimport { useMemo, useState } from \"react\";\nimport type { ReceiptView } from \"@oneshot-gtm/shared-types\";\nimport { api } from \"../api/client.ts\";\nimport { Button } from \"../components/primitives/Button.tsx\";\nimport { EmptyNote } from \"../components/primitives/EmptyNote.tsx\";\nimport { SkeletonRow } from \"../components/primitives/Skeleton.tsx\";\nimport { Sparkline } from \"../components/primitives/Sparkline.tsx\";\nimport { cn, formatUsd } from \"../lib/cn.ts\";\n\nexport const Route = createFileRoute(\"/measure\")({\n component: MeasurePage,\n});\n\nconst RANGES = [\n { label: \"all-time\", value: undefined },\n { label: \"30d\", value: 30 },\n { label: \"7d\", value: 7 },\n] as const;\n\nfunction MeasurePage() {\n const [sinceDays, setSinceDays] = useState<number | undefined>(undefined);\n const cac = useQuery({\n queryKey: [\"measure\", \"cac\", sinceDays],\n queryFn: () => api.measureCac(sinceDays),\n });\n const rocs = useQuery({\n queryKey: [\"measure\", \"rocs\", sinceDays],\n queryFn: () => api.measureRocs(sinceDays),\n });\n\n // Pull a wide receipts window once so the per-play sparklines can show a\n // daily-spend trend. We grab up to 500 receipts; for heavier founders we'd\n // wire a server-side time-bucketed aggregate, but 500 covers a month of\n // daily activity for the current scale.\n const receipts = useQuery({\n queryKey: [\"measure\", \"receipts-trend\"],\n queryFn: () => api.receipts({ limit: 500 }),\n staleTime: 60_000,\n });\n\n const sparkDays = sinceDays ?? 30;\n const spendSeries = useMemo(\n () => buildSpendSeries(receipts.data?.receipts ?? [], sparkDays),\n [receipts.data?.receipts, sparkDays],\n );\n\n const totalSpend = cac.data?.spend.reduce((a, s) => a + s.totalUsd, 0) ?? 0;\n const totalReplied = cac.data?.events.reduce((a, e) => a + e.replied, 0) ?? 0;\n const totalSent = cac.data?.events.reduce((a, e) => a + e.sent, 0) ?? 0;\n const totalWon = rocs.data?.outcomes.reduce((a, o) => a + o.won, 0) ?? 0;\n\n return (\n <div className=\"-mx-6 -my-6 flex flex-col\">\n {/* Masthead */}\n <section className=\"flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6\">\n <div>\n <div className=\"ln-eyebrow\">The Ledger · Measure</div>\n <h1\n className=\"mt-1 text-ink-cream\"\n style={{\n fontFamily: \"var(--font-display)\",\n fontSize: 44,\n fontWeight: 600,\n letterSpacing: \"-0.025em\",\n lineHeight: 0.98,\n }}\n >\n $ per reply, per meeting, per won.\n </h1>\n </div>\n <div className=\"flex items-center gap-1.5\">\n {RANGES.map((r) => (\n <Button\n key={r.label}\n variant={sinceDays === r.value ? \"primary\" : \"secondary\"}\n size=\"sm\"\n onClick={() => setSinceDays(r.value)}\n >\n {r.label}\n </Button>\n ))}\n </div>\n </section>\n\n {/* Aggregate strip */}\n <section className=\"grid grid-cols-2 divide-x divide-ink-rule border-b border-ink-rule md:grid-cols-4\">\n <Summary\n label=\"Total spend\"\n value={cac.data ? formatUsd(totalSpend) : undefined}\n tone=\"spend\"\n />\n <Summary\n label=\"Sent\"\n value={cac.data ? String(totalSent) : undefined}\n caption=\"lifetime, all plays\"\n />\n <Summary\n label=\"Replied\"\n value={cac.data ? String(totalReplied) : undefined}\n caption={\n cac.data && totalSent > 0\n ? `${((totalReplied / totalSent) * 100).toFixed(1)}% reply rate`\n : undefined\n }\n tone=\"receipt\"\n />\n <Summary\n label=\"Won\"\n value={rocs.data ? String(totalWon) : undefined}\n caption={rocs.data ? \"deals\" : undefined}\n />\n </section>\n\n {/* CAC table */}\n <section className=\"border-b border-ink-rule\">\n <div className=\"flex items-baseline justify-between px-6 pb-2 pt-5\">\n <div className=\"ln-eyebrow\">CAC by play · signed receipts</div>\n <div className=\"font-mono text-[11px] text-ink-faint\">{rangeLabel(sinceDays)}</div>\n </div>\n {cac.isLoading ? (\n Array.from({ length: 3 }, (_, i) => <SkeletonRow key={i} />)\n ) : cac.data?.spend.length === 0 ? (\n <div className=\"px-6 pb-6\">\n <EmptyNote\n note=\"No spend in this window. Run a play and the dollars will account for themselves.\"\n cli=\"oneshot-gtm motion show-hn --target targets.json\"\n />\n </div>\n ) : (\n <table className=\"w-full text-[13px]\">\n <thead>\n <tr className=\"text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n <th className=\"px-6 py-2 text-left font-medium\">play</th>\n <th className=\"py-2 text-left font-medium\">spend · {sparkDays}d</th>\n <th className=\"py-2 text-right font-medium\">spend</th>\n <th className=\"py-2 text-right font-medium\">calls</th>\n <th className=\"py-2 text-right font-medium\">sent</th>\n <th className=\"py-2 text-right font-medium\">replied</th>\n <th className=\"py-2 text-right font-medium\">$/send</th>\n <th className=\"px-6 py-2 text-right font-medium\">$/reply</th>\n </tr>\n </thead>\n <tbody>\n {cac.data?.spend.map((s, i) => {\n const ev = cac.data.events.find((e) => e.playName === s.playName);\n const sent = ev?.sent ?? 0;\n const replied = ev?.replied ?? 0;\n const series = spendSeries.get(s.playName) ?? [];\n return (\n <tr\n key={s.playName}\n className={cn(\n \"border-t border-ink-rule/60\",\n i % 2 === 1 && \"bg-ink-surface/20\",\n )}\n >\n <td className=\"px-6 py-2 text-ink-cream\">{s.playName}</td>\n <td className=\"py-2\">\n {series.length > 1 ? (\n <Sparkline\n values={series}\n tone=\"spend\"\n width={96}\n height={22}\n aria-label={`${s.playName} spend over last ${sparkDays} days`}\n />\n ) : (\n <span className=\"font-mono text-[11px] text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-cream\">\n {formatUsd(s.totalUsd)}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{s.calls}</td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{sent}</td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{replied}</td>\n <td className=\"py-2 text-right font-mono text-ink-cream-2\">\n {sent > 0 ? (\n formatUsd(s.totalUsd / sent)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]\">\n {replied > 0 ? (\n formatUsd(s.totalUsd / replied)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n )}\n </section>\n\n {/* RoCS table */}\n <section className=\"border-b border-ink-rule\">\n <div className=\"flex items-baseline justify-between px-6 pb-2 pt-5\">\n <div className=\"ln-eyebrow\">RoCS · return on cognitive spend</div>\n <div className=\"font-mono text-[11px] text-ink-faint\">{rangeLabel(sinceDays)}</div>\n </div>\n {rocs.isLoading ? (\n Array.from({ length: 3 }, (_, i) => <SkeletonRow key={i} />)\n ) : rocs.data?.spend.length === 0 ? (\n <div className=\"px-6 pb-6\">\n <EmptyNote note=\"No spend in this window to attribute to outcomes yet.\" />\n </div>\n ) : (\n <table className=\"w-full text-[13px]\">\n <thead>\n <tr className=\"text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n <th className=\"px-6 py-2 text-left font-medium\">play</th>\n <th className=\"py-2 text-left font-medium\">spend · {sparkDays}d</th>\n <th className=\"py-2 text-right font-medium\">spend</th>\n <th className=\"py-2 text-right font-medium\">meetings</th>\n <th className=\"py-2 text-right font-medium\">SQLs</th>\n <th className=\"py-2 text-right font-medium\">won</th>\n <th className=\"py-2 text-right font-medium\">$/meeting</th>\n <th className=\"px-6 py-2 text-right font-medium\">$/won</th>\n </tr>\n </thead>\n <tbody>\n {rocs.data?.spend.map((s, i) => {\n const oc = rocs.data.outcomes.find((o) => o.playName === s.playName);\n const meet = oc?.meetings ?? 0;\n const sql = oc?.sqls ?? 0;\n const won = oc?.won ?? 0;\n const series = spendSeries.get(s.playName) ?? [];\n return (\n <tr\n key={s.playName}\n className={cn(\n \"border-t border-ink-rule/60\",\n i % 2 === 1 && \"bg-ink-surface/20\",\n )}\n >\n <td className=\"px-6 py-2 text-ink-cream\">{s.playName}</td>\n <td className=\"py-2\">\n {series.length > 1 ? (\n <Sparkline\n values={series}\n tone=\"spend\"\n width={96}\n height={22}\n aria-label={`${s.playName} spend over last ${sparkDays} days`}\n />\n ) : (\n <span className=\"font-mono text-[11px] text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-cream\">\n {formatUsd(s.totalUsd)}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{meet}</td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{sql}</td>\n <td className=\"py-2 text-right font-mono text-[color:var(--ink-receipt-2)]\">\n {won}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-cream-2\">\n {meet > 0 ? (\n formatUsd(s.totalUsd / meet)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]\">\n {won > 0 ? (\n formatUsd(s.totalUsd / won)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n )}\n </section>\n </div>\n );\n}\n\n/**\n * Group receipts by play and compute a daily spend histogram (oldest → newest).\n * Returns a Map keyed by playName. Receipts without a `costUsd` value are\n * skipped. Days beyond `windowDays` are dropped.\n */\nfunction buildSpendSeries(receipts: ReceiptView[], windowDays: number): Map<string, number[]> {\n const days = Math.max(7, Math.min(windowDays, 90));\n const now = Date.now();\n const DAY_MS = 24 * 3600 * 1000;\n const out = new Map<string, number[]>();\n\n for (const r of receipts) {\n if (r.costUsd == null) continue;\n const ts = new Date(r.createdAt).getTime();\n if (Number.isNaN(ts)) continue;\n const daysAgo = Math.floor((now - ts) / DAY_MS);\n if (daysAgo < 0 || daysAgo >= days) continue;\n const idx = days - 1 - daysAgo;\n let arr = out.get(r.playName);\n if (!arr) {\n arr = Array.from({ length: days }, () => 0);\n out.set(r.playName, arr);\n }\n arr[idx] = (arr[idx] ?? 0) + r.costUsd;\n }\n return out;\n}\n\nfunction Summary({\n label,\n value,\n caption,\n tone = \"neutral\",\n}: {\n label: string;\n value: string | undefined;\n caption?: string;\n /** Caption tint only; the number itself stays cream. */\n tone?: \"neutral\" | \"receipt\" | \"spend\";\n}) {\n const captionColor =\n tone === \"spend\"\n ? \"var(--ink-spend-2)\"\n : tone === \"receipt\"\n ? \"var(--ink-receipt-2)\"\n : \"var(--ink-faint)\";\n return (\n <div className=\"px-5 py-4\">\n <div className=\"ln-eyebrow\">{label}</div>\n <div\n className=\"mt-1 truncate text-ink-cream ln-numeral\"\n style={{ fontSize: 34, lineHeight: 1 }}\n >\n {value ?? <span className=\"text-ink-faint\">—</span>}\n </div>\n {caption && (\n <div className=\"mt-2 truncate font-mono text-[11px]\" style={{ color: captionColor }}>\n {caption}\n </div>\n )}\n </div>\n );\n}\n\nfunction rangeLabel(s: number | undefined): string {\n if (s === undefined) return \"all-time\";\n return `last ${s}d`;\n}\n"],"mappings":"uOAoBM,EAAgE,CACpE,QAAS,qBACT,MAAO,mBACP,QAAS,qBACT,OAAQ,oBACR,MAAO,mBACR,CAOD,SAAgB,EAAU,CACxB,SACA,QAAQ,IACR,SAAS,GACT,OAAO,UACP,YAAY,GACZ,OAAO,GACP,MAAM,GACN,YACA,aAAc,GACG,CACjB,IAAM,GAAA,EAAA,EAAA,QAAY,CACZ,EAAS,EAAS,GAElB,CAAE,OAAM,OAAM,OAAM,OAAM,WAAA,EAAA,EAAA,aACxB,EAAU,EAAQ,EAAO,EAAO,CACtC,CAAC,EAAQ,EAAO,EAAO,CACxB,CAcD,OAZI,EAAO,SAAW,GAElB,EAAA,EAAA,KAAC,MAAD,CACS,QACC,SACR,UAAW,EAAG,QAAS,EAAU,CACjC,KAAK,MACL,aAAY,GAAa,UACzB,CAAA,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AW,KAAM,SACvB,IAAMC,EAAK,IAAIJ,KAAK7B,EAAEkC,UAAU,CAACC,SAAS,CAC1C,GAAIC,OAAOC,MAAMJ,EAAG,CAAE,SACtB,IAAMK,EAAUb,KAAKc,OAAOX,EAAMK,GAAMH,MAAO,CAC/C,GAAIQ,EAAU,GAAKA,GAAWd,EAAM,SACpC,IAAMgB,EAAMhB,EAAO,EAAIc,EACnBG,EAAMV,EAAIjB,IAAId,EAAEY,SAAS,CACxB6B,IACHA,EAAMpC,MAAMC,KAAK,CAAEC,OAAQiB,EAAM,KAAQ,EAAE,CAC3CO,EAAIW,IAAI1C,EAAEY,SAAU6B,EAAI,EAE1BA,EAAID,IAAQC,EAAID,IAAQ,GAAKxC,EAAEgC,QAEjC,OAAOD,EAGT,SAASY,EAAQ,CACfrF,QACAC,QACAqF,UACAC,OAAO,WAON,CAOD,OACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qBAAf,EACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,sBAAcvF,EAAW,CAAA,EACxC,EAAA,EAAA,KAAC,MAAD,CACE,UAAU,0CACV,MAAO,CAAEqC,SAAU,GAAIG,WAAY,EAAG,UAErCvC,IAAS,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,0BAAiB,IAAQ,CAAA,CAChD,CAAA,CACJqF,IACC,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,sCAAsC,MAAO,CAAEG,MAflEF,IAAS,QACL,qBACAA,IAAS,UACP,uBACA,mBAWiF,UAChFD,EAEJ,CAAA,CACG,GAIV,SAASzC,EAAWrB,EAA+B,CAEjD,OADIA,IAAMtB,IAAAA,GAAkB,WACrB,QAAQsB,EAAC"}
@@ -1,2 +0,0 @@
1
- import{c as e,d as t,l as n,n as r,o as i,s as a,t as o}from"./Button-NJ1UVzeB.js";import{a as s,c,f as l,l as u,m as d,n as f,o as p,p as m,u as h}from"./index-CzTgATNQ.js";import{r as g}from"./Field-B4mT8TGa.js";import{n as _}from"./Skeleton-d2p06ghN.js";var v=a(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),y=a(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),b=a(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),x=t(n()),S=e();function C({steps:e,className:t}){return e.length===0?(0,S.jsx)(`div`,{className:r(`ln-note text-[11.5px] text-ink-faint`,t),children:`no cadence`}):e.length===1?(0,S.jsxs)(`div`,{className:r(`flex items-center gap-2 text-[11.5px] text-ink-faint`,t),children:[(0,S.jsx)(`span`,{className:`h-[6px] w-[6px] rounded-full bg-[color:var(--ink-signal)]`}),(0,S.jsx)(`span`,{className:`font-mono`,children:`one-touch · day 0`})]}):(0,S.jsx)(`div`,{className:r(`flex items-center gap-0 overflow-hidden`,t),children:e.map((t,n)=>{let i=n===e.length-1;return(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,S.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5`,children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:r(`h-[6px] w-[6px] rounded-full`,t.breakup?`bg-[color:var(--ink-spend)]`:n===0?`bg-[color:var(--ink-signal)]`:`bg-[color:var(--ink-signal)]/60`)}),(0,S.jsxs)(`span`,{className:`whitespace-nowrap font-mono text-[10px] text-ink-faint`,children:[`d`,t.day]}),(0,S.jsx)(`span`,{className:`whitespace-nowrap text-[10px] text-ink-muted`,children:t.label})]}),!i&&(0,S.jsx)(`span`,{"aria-hidden":`true`,className:r(`mx-2 mb-[14px] h-px w-6 shrink-0`,`bg-ink-rule`)})]},`${t.day}-${t.label}`)})})}var w={email:p,sms:y,voice:b,linkedin:y},T=new Set([`show-hn`,`job-change`,`post-funding`,`accelerator-batch`,`hiring-signal`,`podcast-guest`,`stack-consolidation`]),E={"show-hn":{description:`One-touch founder-to-founder reply to a recent Show HN post, referencing a specific comment thread.`,steps:[{day:0,label:`send`}]},"job-change":{description:`Trigger: prospect started a new role at a target company. Day-0 send; day-5 follow-up; day-14 breakup.`,steps:[{day:0,label:`send`},{day:5,label:`follow-up`},{day:14,label:`breakup`,breakup:!0}]},"post-funding":{description:`Trigger: prospect's company announced a round. Day-3 congrats; day-9 follow-up; day-18 breakup.`,steps:[{day:0,label:`send`},{day:9,label:`follow-up`},{day:18,label:`breakup`,breakup:!0}]},"accelerator-batch":{description:`Founder-to-founder outreach within or across accelerator batches (YC, OD, SPC, Antler, Techstars).`,steps:[{day:0,label:`send`},{day:5,label:`follow-up`},{day:12,label:`breakup`,breakup:!0}]},concierge:{description:`Autonomous voice onboarding for new signups. Pre-call email → voice call → post-call summary email.`,steps:[{day:0,label:`prep email`},{day:0,label:`voice`},{day:0,label:`summary`}]},"demo-no-show":{description:`Same-day SMS + email recovery for demo no-shows; cadence engine handles day-3 follow-up.`,steps:[{day:0,label:`sms + email`},{day:3,label:`follow-up`}]},"competitor-switch":{description:`Migration-honesty pitch for prospects using a competing vendor. Optional G2 / BuiltWith scrape.`,steps:[{day:0,label:`send`}]},"stack-consolidation":{description:`Consolidation-honesty pitch for repos wiring up several API vendors. Fed by the github-topics finder.`,steps:[{day:0,label:`send`}]},"hiring-signal":{description:`Triggered by a job post at a target company. One-touch email to the hiring manager with your ramp-time claim.`,steps:[{day:0,label:`send`}]},"podcast-guest":{description:`One-touch reply to a recent podcast guest referencing a specific moment from the episode.`,steps:[{day:0,label:`send`}]},"breakup-revive":{description:"Pattern-interrupt for ledger cold leads (60–90 days). Pulled from `listColdProspects`.",steps:[{day:0,label:`revive`}]}};function D(){let e=m({queryKey:[`plays`],queryFn:i.plays}),t=O(m({queryKey:[`receipts`,`plays-catalogue`],queryFn:()=>i.receipts({limit:500}),staleTime:6e4}).data?.receipts??[]),[n,a]=(0,x.useState)(null);return(0,S.jsxs)(`div`,{className:`-mx-6 -my-6 flex flex-col`,children:[(0,S.jsxs)(`section`,{className:`flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`ln-eyebrow`,children:`The Ledger · Plays`}),(0,S.jsx)(`h1`,{className:`mt-1 text-ink-cream`,style:{fontFamily:`var(--font-display)`,fontSize:44,fontWeight:600,letterSpacing:`-0.025em`,lineHeight:.98},children:`The motion catalogue.`}),(0,S.jsx)(`p`,{className:`ln-note mt-2 max-w-[64ch] text-[13px] text-ink-cream-2`,children:`Ten motion plays. Each one is a known signal you can act on — trigger, cadence, anti-slop lint, signed receipt. Run from the CLI or, for the six queue-drain plays, from the dashboard.`})]}),(0,S.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:e.data?(0,S.jsxs)(S.Fragment,{children:[e.data.plays.length,` `,(0,S.jsx)(`span`,{className:`text-ink-muted`,children:`plays`})]}):`…`})]}),(0,S.jsx)(`section`,{children:e.isLoading?(0,S.jsx)(`div`,{children:Array.from({length:8},(e,t)=>(0,S.jsx)(_,{},t))}):(0,S.jsx)(`div`,{children:e.data?.plays.map((e,i)=>{let l=E[e.name],d=T.has(e.name),f=t.get(e.name)??0;return(0,S.jsxs)(`div`,{className:r(`group grid gap-x-6 gap-y-3 px-6 py-5`,`grid-cols-[minmax(220px,280px)_1fr_auto]`,`border-b border-ink-rule/60`,`transition-colors duration-[var(--dur-stamp)]`,`hover:bg-ink-surface/40`,i%2==1&&`bg-ink-surface/20`),children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`code`,{className:`font-mono text-[15px] font-medium text-ink-cream`,style:{fontFeatureSettings:`"zero"`},children:e.name}),d&&(0,S.jsx)(`span`,{className:`font-mono text-[10px] text-ink-faint`,children:`· runnable`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-1 text-ink-muted`,children:e.channels.map(e=>(0,S.jsx)(`span`,{className:`inline-flex h-[18px] w-[18px] items-center justify-center rounded-[var(--radius-xs)] border border-ink-rule`,title:e,children:(0,S.jsx)(w[e]??p,{size:10})},e))}),(0,S.jsxs)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:[e.followupCount,` follow-up`,e.followupCount===1?``:`s`,e.hasBreakup?` · breakup`:``]})]}),(0,S.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:f>0?(0,S.jsxs)(`span`,{children:[(0,S.jsx)(`span`,{className:`text-[color:var(--ink-receipt-2)]`,children:f}),` receipt`,f===1?``:`s`,` signed`]}):(0,S.jsx)(`span`,{children:`no receipts yet`})})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[l?.description&&(0,S.jsx)(`p`,{className:`ln-note text-[13px] text-ink-cream-2`,children:l.description}),(0,S.jsx)(k,{play:e}),(0,S.jsxs)(`code`,{className:r(`block overflow-x-auto whitespace-nowrap rounded-[var(--radius-sm)]`,`border border-ink-rule bg-ink-bg-deep px-2.5 py-1.5`,`font-mono text-[12px] text-ink-cream-2`),children:[`$ `,e.cliInvocation]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[d&&(0,S.jsx)(h,{to:`/run/$playName`,params:{playName:e.name},className:`inline-flex`,children:(0,S.jsxs)(o,{variant:`primary`,size:`sm`,children:[(0,S.jsx)(s,{size:12}),` run`]})}),(0,S.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(e.cliInvocation),a(e.name),setTimeout(()=>a(t=>t===e.name?null:t),1500)},children:n===e.name?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(u,{size:12}),` copied`]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(c,{size:12}),` copy`]})}),!d&&(0,S.jsx)(`span`,{className:`font-mono text-[10px] text-ink-faint`,children:`CLI only`})]})]},e.name)})})})]})}function O(e){let t=new Map;for(let n of e)t.set(n.playName,(t.get(n.playName)??0)+1);return t}function k({play:e}){let t=d(),[n,r]=(0,x.useState)(!1),[a,s]=(0,x.useState)(e.steps.map(e=>e.day));(0,x.useEffect)(()=>{n||s(e.steps.map(e=>e.day))},[e.steps,n]);let c=l({mutationFn:t=>i.setCadence(e.name,t),onSuccess:(n,i)=>{t.invalidateQueries({queryKey:[`plays`]}),r(!1),f.success(i===null?`${e.name} · cadence reset`:`${e.name} · timing saved`)},onError:e=>f.error(`couldn't save · ${e.message}`)}),u=[{day:0,label:`send`},...e.steps.map(e=>({day:e.day,label:e.label,breakup:e.label.toLowerCase().includes(`breakup`)}))],p=e.steps.length>0,m=JSON.stringify(a)!==JSON.stringify(e.defaultDays);return(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(C,{steps:u}),p&&!n&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`inline-flex items-center gap-1 font-mono text-[10px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream-2`,children:[(0,S.jsx)(v,{size:10}),` edit timing`]})]}),n&&(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep p-3`,children:[(0,S.jsx)(`div`,{className:`flex flex-wrap items-end gap-3`,children:e.steps.map((e,t)=>(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[e.label,` · day`]}),(0,S.jsx)(g,{type:`number`,min:1,max:120,value:a[t]??1,onChange:e=>{let n=Math.max(1,Math.min(120,Number.parseInt(e.target.value,10)||1));s(e=>e.map((e,r)=>r===t?n:e))},className:`w-20 font-mono text-[12px]`})]},e.label))}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(o,{size:`sm`,disabled:c.isPending,onClick:()=>c.mutate(a),children:c.isPending?`saving…`:`save`}),(0,S.jsx)(o,{variant:`ghost`,size:`sm`,disabled:c.isPending||!m,onClick:()=>c.mutate(null),title:`Restore the code-default timing`,children:`reset to default`}),(0,S.jsx)(o,{variant:`ghost`,size:`sm`,disabled:c.isPending,onClick:()=>{s(e.steps.map(e=>e.day)),r(!1)},children:`cancel`})]}),(0,S.jsxs)(`p`,{className:`font-mono text-[10px] text-ink-faint`,children:[`cumulative days from the day-0 send · strictly increasing · 1–120 · default`,` `,e.defaultDays.map(e=>`d${e}`).join(` · `)]})]})]})}export{D as component};
2
- //# sourceMappingURL=plays-DHIZA49D.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plays-DHIZA49D.js","names":["__iconNode","__iconNode","useMutation","useQuery","useQueryClient","Link","Check","Clock","Copy","Mail","MessageSquare","Phone","Play","useEffect","useState","toast","api","Button","Input","SkeletonRow","CadenceTimeline","cn","CHANNEL_ICON","email","sms","voice","linkedin","const","RUNNABLE_PLAYS","Set","PLAY_META","Record","description","steps","CadenceStep","day","label","breakup","concierge","PlaysPage","plays","queryKey","queryFn","receipts","limit","staleTime","receiptCounts","groupByPlay","data","copiedName","setCopiedName","fontFamily","fontSize","fontWeight","letterSpacing","lineHeight","length","isLoading","Array","from","_","i","map","p","meta","name","runnable","has","count","get","fontFeatureSettings","channels","ch","Icon","followupCount","hasBreakup","cliInvocation","playName","navigator","clipboard","writeText","setTimeout","n","rows","T","Map","m","r","set","CadenceEditor","play","PlayDescriptor","qc","editing","setEditing","days","setDays","s","save","mutationFn","next","setCadence","onSuccess","_data","invalidateQueries","success","onError","err","error","message","timeline","toLowerCase","includes","hasFollowups","isModified","JSON","stringify","defaultDays","e","v","Math","max","min","Number","parseInt","target","value","prev","d","j","isPending","mutate","join","component"],"sources":["../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/clock.mjs","../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/message-square.mjs","../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/phone.mjs","../../src/components/plays/CadenceTimeline.tsx","../../src/routes/plays.tsx?tsr-split=component"],"sourcesContent":["/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"M12 6v6l4 2\", key: \"mmk7yg\" }]\n];\nconst Clock = createLucideIcon(\"clock\", __iconNode);\n\nexport { __iconNode, Clock as default };\n//# sourceMappingURL=clock.mjs.map\n","/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\",\n key: \"18887p\"\n }\n ]\n];\nconst MessageSquare = createLucideIcon(\"message-square\", __iconNode);\n\nexport { __iconNode, MessageSquare as default };\n//# sourceMappingURL=message-square.mjs.map\n","/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384\",\n key: \"9njp5v\"\n }\n ]\n];\nconst Phone = createLucideIcon(\"phone\", __iconNode);\n\nexport { __iconNode, Phone as default };\n//# sourceMappingURL=phone.mjs.map\n","import { cn } from \"../../lib/cn.ts\";\n\nexport interface CadenceStep {\n /** Day offset from enrollment (0 = first send). */\n day: number;\n label: string;\n /** When true, this is the final \"breakup\" touch — dot is amber, not cobalt. */\n breakup?: boolean;\n}\n\n/**\n * A small horizontal timeline of cadence steps — day-0 send on the left,\n * follow-ups walking right, breakup amber. When there's only one step the\n * timeline reads \"one-touch · no follow-ups\".\n */\nexport function CadenceTimeline({\n steps,\n className,\n}: {\n steps: CadenceStep[];\n className?: string;\n}) {\n if (steps.length === 0) {\n return <div className={cn(\"ln-note text-[11.5px] text-ink-faint\", className)}>no cadence</div>;\n }\n if (steps.length === 1) {\n return (\n <div className={cn(\"flex items-center gap-2 text-[11.5px] text-ink-faint\", className)}>\n <span className=\"h-[6px] w-[6px] rounded-full bg-[color:var(--ink-signal)]\" />\n <span className=\"font-mono\">one-touch · day 0</span>\n </div>\n );\n }\n\n return (\n <div className={cn(\"flex items-center gap-0 overflow-hidden\", className)}>\n {steps.map((s, i) => {\n const isLast = i === steps.length - 1;\n return (\n <span key={`${s.day}-${s.label}`} className=\"flex min-w-0 items-center\">\n <span className=\"flex flex-col items-center gap-0.5\">\n <span\n aria-hidden=\"true\"\n className={cn(\n \"h-[6px] w-[6px] rounded-full\",\n s.breakup\n ? \"bg-[color:var(--ink-spend)]\"\n : i === 0\n ? \"bg-[color:var(--ink-signal)]\"\n : \"bg-[color:var(--ink-signal)]/60\",\n )}\n />\n <span className=\"whitespace-nowrap font-mono text-[10px] text-ink-faint\">\n d{s.day}\n </span>\n <span className=\"whitespace-nowrap text-[10px] text-ink-muted\">{s.label}</span>\n </span>\n {!isLast && (\n <span\n aria-hidden=\"true\"\n className={cn(\"mx-2 mb-[14px] h-px w-6 shrink-0\", \"bg-ink-rule\")}\n />\n )}\n </span>\n );\n })}\n </div>\n );\n}\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { createFileRoute, Link } from \"@tanstack/react-router\";\nimport { Check, Clock, Copy, Mail, MessageSquare, Phone, Play } from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport type { PlayDescriptor } from \"@oneshot-gtm/shared-types\";\nimport { api } from \"../api/client.ts\";\nimport { Button } from \"../components/primitives/Button.tsx\";\nimport { Input } from \"../components/primitives/Field.tsx\";\nimport { SkeletonRow } from \"../components/primitives/Skeleton.tsx\";\nimport { CadenceTimeline, type CadenceStep } from \"../components/plays/CadenceTimeline.tsx\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const Route = createFileRoute(\"/plays\")({\n component: PlaysPage,\n});\n\nconst CHANNEL_ICON = {\n email: Mail,\n sms: MessageSquare,\n voice: Phone,\n linkedin: MessageSquare,\n} as const;\n\n// Mirror of apps/server/src/api/run.ts SUPPORTED — plays whose targets the\n// SSE /api/run endpoint knows how to dispatch.\nconst RUNNABLE_PLAYS = new Set([\n \"show-hn\",\n \"job-change\",\n \"post-funding\",\n \"accelerator-batch\",\n \"hiring-signal\",\n \"podcast-guest\",\n \"stack-consolidation\",\n]);\n\n/**\n * Per-play metadata the API doesn't expose yet — human description + day-\n * offset timeline. Values mirror the sequences defined in\n * packages/plays/src/_cadence.ts on the server.\n */\nconst PLAY_META: Record<string, { description: string; steps: CadenceStep[] }> = {\n \"show-hn\": {\n description:\n \"One-touch founder-to-founder reply to a recent Show HN post, referencing a specific comment thread.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"job-change\": {\n description:\n \"Trigger: prospect started a new role at a target company. Day-0 send; day-5 follow-up; day-14 breakup.\",\n steps: [\n { day: 0, label: \"send\" },\n { day: 5, label: \"follow-up\" },\n { day: 14, label: \"breakup\", breakup: true },\n ],\n },\n \"post-funding\": {\n description:\n \"Trigger: prospect's company announced a round. Day-3 congrats; day-9 follow-up; day-18 breakup.\",\n steps: [\n { day: 0, label: \"send\" },\n { day: 9, label: \"follow-up\" },\n { day: 18, label: \"breakup\", breakup: true },\n ],\n },\n \"accelerator-batch\": {\n description:\n \"Founder-to-founder outreach within or across accelerator batches (YC, OD, SPC, Antler, Techstars).\",\n steps: [\n { day: 0, label: \"send\" },\n { day: 5, label: \"follow-up\" },\n { day: 12, label: \"breakup\", breakup: true },\n ],\n },\n concierge: {\n description:\n \"Autonomous voice onboarding for new signups. Pre-call email → voice call → post-call summary email.\",\n steps: [\n { day: 0, label: \"prep email\" },\n { day: 0, label: \"voice\" },\n { day: 0, label: \"summary\" },\n ],\n },\n \"demo-no-show\": {\n description:\n \"Same-day SMS + email recovery for demo no-shows; cadence engine handles day-3 follow-up.\",\n steps: [\n { day: 0, label: \"sms + email\" },\n { day: 3, label: \"follow-up\" },\n ],\n },\n \"competitor-switch\": {\n description:\n \"Migration-honesty pitch for prospects using a competing vendor. Optional G2 / BuiltWith scrape.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"stack-consolidation\": {\n description:\n \"Consolidation-honesty pitch for repos wiring up several API vendors. Fed by the github-topics finder.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"hiring-signal\": {\n description:\n \"Triggered by a job post at a target company. One-touch email to the hiring manager with your ramp-time claim.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"podcast-guest\": {\n description:\n \"One-touch reply to a recent podcast guest referencing a specific moment from the episode.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"breakup-revive\": {\n description:\n \"Pattern-interrupt for ledger cold leads (60–90 days). Pulled from `listColdProspects`.\",\n steps: [{ day: 0, label: \"revive\" }],\n },\n};\n\nfunction PlaysPage() {\n const plays = useQuery({ queryKey: [\"plays\"], queryFn: api.plays });\n\n // Pull a wide window of receipts once and group them client-side so we can\n // show per-play \"signed N this month\" without an API change.\n const receipts = useQuery({\n queryKey: [\"receipts\", \"plays-catalogue\"],\n queryFn: () => api.receipts({ limit: 500 }),\n staleTime: 60_000,\n });\n const receiptCounts = groupByPlay(receipts.data?.receipts ?? []);\n\n const [copiedName, setCopiedName] = useState<string | null>(null);\n\n return (\n <div className=\"-mx-6 -my-6 flex flex-col\">\n {/* Masthead */}\n <section className=\"flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6\">\n <div>\n <div className=\"ln-eyebrow\">The Ledger · Plays</div>\n <h1\n className=\"mt-1 text-ink-cream\"\n style={{\n fontFamily: \"var(--font-display)\",\n fontSize: 44,\n fontWeight: 600,\n letterSpacing: \"-0.025em\",\n lineHeight: 0.98,\n }}\n >\n The motion catalogue.\n </h1>\n <p className=\"ln-note mt-2 max-w-[64ch] text-[13px] text-ink-cream-2\">\n Ten motion plays. Each one is a known signal you can act on — trigger, cadence,\n anti-slop lint, signed receipt. Run from the CLI or, for the six queue-drain plays, from\n the dashboard.\n </p>\n </div>\n <div className=\"font-mono text-[11px] text-ink-faint\">\n {plays.data ? (\n <>\n {plays.data.plays.length} <span className=\"text-ink-muted\">plays</span>\n </>\n ) : (\n \"…\"\n )}\n </div>\n </section>\n\n {/* Plays ledger — one rich row per play */}\n <section>\n {plays.isLoading ? (\n <div>\n {Array.from({ length: 8 }, (_, i) => (\n <SkeletonRow key={i} />\n ))}\n </div>\n ) : (\n <div>\n {plays.data?.plays.map((p, i) => {\n const meta = PLAY_META[p.name];\n const runnable = RUNNABLE_PLAYS.has(p.name);\n const count = receiptCounts.get(p.name) ?? 0;\n return (\n <div\n key={p.name}\n className={cn(\n \"group grid gap-x-6 gap-y-3 px-6 py-5\",\n \"grid-cols-[minmax(220px,280px)_1fr_auto]\",\n \"border-b border-ink-rule/60\",\n \"transition-colors duration-[var(--dur-stamp)]\",\n \"hover:bg-ink-surface/40\",\n i % 2 === 1 && \"bg-ink-surface/20\",\n )}\n >\n {/* Left: name + channel chips + receipt badge */}\n <div className=\"flex flex-col gap-2.5\">\n <div className=\"flex items-baseline gap-2\">\n <code\n className=\"font-mono text-[15px] font-medium text-ink-cream\"\n style={{ fontFeatureSettings: '\"zero\"' }}\n >\n {p.name}\n </code>\n {runnable && (\n <span className=\"font-mono text-[10px] text-ink-faint\">· runnable</span>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex items-center gap-1 text-ink-muted\">\n {p.channels.map((ch) => {\n const Icon = CHANNEL_ICON[ch] ?? Mail;\n return (\n <span\n key={ch}\n className=\"inline-flex h-[18px] w-[18px] items-center justify-center rounded-[var(--radius-xs)] border border-ink-rule\"\n title={ch}\n >\n <Icon size={10} />\n </span>\n );\n })}\n </div>\n <span className=\"font-mono text-[11px] text-ink-faint\">\n {p.followupCount} follow-up{p.followupCount === 1 ? \"\" : \"s\"}\n {p.hasBreakup ? \" · breakup\" : \"\"}\n </span>\n </div>\n <div className=\"font-mono text-[11px] text-ink-faint\">\n {count > 0 ? (\n <span>\n <span className=\"text-[color:var(--ink-receipt-2)]\">{count}</span> receipt\n {count === 1 ? \"\" : \"s\"} signed\n </span>\n ) : (\n <span>no receipts yet</span>\n )}\n </div>\n </div>\n\n {/* Middle: description + cadence timeline + CLI */}\n <div className=\"flex flex-col gap-3 min-w-0\">\n {meta?.description && (\n <p className=\"ln-note text-[13px] text-ink-cream-2\">{meta.description}</p>\n )}\n <CadenceEditor play={p} />\n <code\n className={cn(\n \"block overflow-x-auto whitespace-nowrap rounded-[var(--radius-sm)]\",\n \"border border-ink-rule bg-ink-bg-deep px-2.5 py-1.5\",\n \"font-mono text-[12px] text-ink-cream-2\",\n )}\n >\n $ {p.cliInvocation}\n </code>\n </div>\n\n {/* Right: actions */}\n <div className=\"flex flex-col items-end gap-1.5\">\n {runnable && (\n <Link\n to=\"/run/$playName\"\n params={{ playName: p.name }}\n className=\"inline-flex\"\n >\n <Button variant=\"primary\" size=\"sm\">\n <Play size={12} /> run\n </Button>\n </Link>\n )}\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n void navigator.clipboard.writeText(p.cliInvocation);\n setCopiedName(p.name);\n setTimeout(() => setCopiedName((n) => (n === p.name ? null : n)), 1500);\n }}\n >\n {copiedName === p.name ? (\n <>\n <Check size={12} /> copied\n </>\n ) : (\n <>\n <Copy size={12} /> copy\n </>\n )}\n </Button>\n {!runnable && (\n <span className=\"font-mono text-[10px] text-ink-faint\">CLI only</span>\n )}\n </div>\n </div>\n );\n })}\n </div>\n )}\n </section>\n </div>\n );\n}\n\nfunction groupByPlay<T extends { playName: string }>(rows: T[]): Map<string, number> {\n const m = new Map<string, number>();\n for (const r of rows) m.set(r.playName, (m.get(r.playName) ?? 0) + 1);\n return m;\n}\n\n/**\n * Cadence timeline + inline timing editor for a play. The day-0 send is fixed;\n * the founder edits each follow-up's cumulative day (1–120, strictly\n * increasing). Save persists a per-play override; reset clears it back to the\n * code default. Structure (which prompts, breakup position) isn't editable.\n */\nfunction CadenceEditor({ play }: { play: PlayDescriptor }) {\n const qc = useQueryClient();\n const [editing, setEditing] = useState(false);\n const [days, setDays] = useState<number[]>(play.steps.map((s) => s.day));\n\n // Re-sync local state from the server after save/reset — but never while the\n // founder is mid-edit (a background refetch, e.g. on window focus, must not\n // clobber in-progress input).\n useEffect(() => {\n if (!editing) setDays(play.steps.map((s) => s.day));\n }, [play.steps, editing]);\n\n const save = useMutation({\n mutationFn: (next: number[] | null) => api.setCadence(play.name, next),\n onSuccess: (_data, next) => {\n void qc.invalidateQueries({ queryKey: [\"plays\"] });\n setEditing(false);\n toast.success(next === null ? `${play.name} · cadence reset` : `${play.name} · timing saved`);\n },\n onError: (err) => toast.error(`couldn't save · ${err.message}`),\n });\n\n const timeline: CadenceStep[] = [\n { day: 0, label: \"send\" },\n ...play.steps.map((s) => ({\n day: s.day,\n label: s.label,\n breakup: s.label.toLowerCase().includes(\"breakup\"),\n })),\n ];\n const hasFollowups = play.steps.length > 0;\n const isModified = JSON.stringify(days) !== JSON.stringify(play.defaultDays);\n\n return (\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center gap-3\">\n <CadenceTimeline steps={timeline} />\n {hasFollowups && !editing && (\n <button\n type=\"button\"\n onClick={() => setEditing(true)}\n className=\"inline-flex items-center gap-1 font-mono text-[10px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream-2\"\n >\n <Clock size={10} /> edit timing\n </button>\n )}\n </div>\n {editing && (\n <div className=\"flex flex-col gap-2 rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep p-3\">\n <div className=\"flex flex-wrap items-end gap-3\">\n {play.steps.map((s, i) => (\n <label key={s.label} className=\"flex flex-col gap-1\">\n <span className=\"font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n {s.label} · day\n </span>\n <Input\n type=\"number\"\n min={1}\n max={120}\n value={days[i] ?? 1}\n onChange={(e) => {\n const v = Math.max(1, Math.min(120, Number.parseInt(e.target.value, 10) || 1));\n setDays((prev) => prev.map((d, j) => (j === i ? v : d)));\n }}\n className=\"w-20 font-mono text-[12px]\"\n />\n </label>\n ))}\n </div>\n <div className=\"flex items-center gap-1.5\">\n <Button size=\"sm\" disabled={save.isPending} onClick={() => save.mutate(days)}>\n {save.isPending ? \"saving…\" : \"save\"}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={save.isPending || !isModified}\n onClick={() => save.mutate(null)}\n title=\"Restore the code-default timing\"\n >\n reset to default\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={save.isPending}\n onClick={() => {\n setDays(play.steps.map((s) => s.day));\n setEditing(false);\n }}\n >\n cancel\n </Button>\n </div>\n <p className=\"font-mono text-[10px] text-ink-faint\">\n cumulative days from the day-0 send · strictly increasing · 1–120 · default{\" \"}\n {play.defaultDays.map((d) => `d${d}`).join(\" · \")}\n </p>\n </div>\n )}\n </div>\n );\n}\n"],"x_google_ignoreList":[0,1,2],"mappings":"iQAaA,IAAM,EAAQ,EAAiB,QAASA,CAHtC,CAAC,SAAU,CAAE,GAAI,KAAM,GAAI,KAAM,EAAG,KAAM,IAAK,SAAU,CAAC,CAC1D,CAAC,OAAQ,CAAE,EAAG,cAAe,IAAK,SAAU,CAAC,CAEPA,CAAW,CCK7C,EAAgB,EAAiB,iBAAkBC,CARvD,CACE,OACA,CACE,EAAG,sHACH,IAAK,SACN,CACF,CAEsDA,CAAW,CCA9D,EAAQ,EAAiB,QAAS,CARtC,CACE,OACA,CACE,EAAG,wNACH,IAAK,SACN,CACF,CAEqC,CAAW,gBCHnD,SAAA,EAAA,CAAA,QAAA,aAAA,CAmBE,OAZA,EAAA,SAAA,GAAA,EAAA,EAAA,KAAA,MAAA,+EAGA,EAAA,SAAA,GAAA,EAAA,EAAA,MAAA,MAAA,sPASA,EAAA,EAAA,KAAA,MAAA,sGAIM,OAAA,EAAA,EAAA,MAAA,OAAA,upBCrBR,IAAMqB,EAAe,CACnBC,MAAOd,EACPe,IAAKd,EACLe,MAAOd,EACPe,SAAUhB,EACX,CAIKkB,EAAiB,IAAIC,IAAI,CAC7B,UACA,aACA,eACA,oBACA,gBACA,gBACA,sBACD,CAAC,CAOIC,EAA2E,CAC/E,UAAW,CACTE,YACE,sGACFC,MAAO,CAAC,CAAEE,IAAK,EAAGC,MAAO,OAAQ,CAAA,CAClC,CACD,aAAc,CACZJ,YACE,yGACFC,MAAO,CACL,CAAEE,IAAK,EAAGC,MAAO,OAAQ,CACzB,CAAED,IAAK,EAAGC,MAAO,YAAa,CAC9B,CAAED,IAAK,GAAIC,MAAO,UAAWC,QAAS,GAAM,CAAA,CAE/C,CACD,eAAgB,CACdL,YACE,k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CAChC,MAAM,2CAAiC,mBAGjC,CAAA,EACR,EAAA,EAAA,KAAC,EAAD,CACE,QAAQ,QACR,KAAK,KACL,SAAUjC,EAAKgC,UACf,YAAe,CACblC,EAAQN,EAAKzD,MAAM6B,IAAKmC,GAAMA,EAAE9D,IAAI,CAAC,CACrC2D,EAAW,GAAM,WACjB,SAGI,CAAA,CACL,IACL,EAAA,EAAA,MAAC,IAAD,CAAG,UAAU,gDAAb,CAAmD,8EAC2B,IAC3EJ,EAAK2B,YAAYvD,IAAKkE,GAAM,IAAIA,IAAI,CAACI,KAAK,MAAM,CAChD,GAEN,GACG"}
@@ -1,2 +0,0 @@
1
- import{c as e,d as t,i as n,l as r,n as i,o as a,s as o,t as s}from"./Button-NJ1UVzeB.js";import{n as c,t as l}from"./chevron-right-BXb7J1cp.js";import{t as u}from"./loader-circle-BylpxA-u.js";import{a as d,d as f,f as p,l as m,m as h,n as g,p as _,r as v,u as y}from"./index-CzTgATNQ.js";import{t as b}from"./Badge-DE7L41a6.js";import{t as x}from"./EmptyNote-DkmaZWuo.js";import{a as S,n as C,o as w,r as T}from"./Field-B4mT8TGa.js";import{t as E}from"./Modal-frAt7msr.js";import{n as ee}from"./Skeleton-d2p06ghN.js";import{n as D,t as O}from"./summarizeRun-BsPt7szF.js";var k=o(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),A=o(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),j=o(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),M=o(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),N=t(r(),1);function P(e,t=new Date){let n=F(t),r=[];for(let e=6;e>=0;e--){let t=new Date(n);t.setDate(t.getDate()-e),r.push({label:t.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`}),count:0,startMs:t.getTime()})}let i=r[0].startMs;for(let t of e){let e=new Date(t.foundAt);if(Number.isNaN(e.getTime()))continue;let a=F(e);if(a.getTime()<i)continue;let o=6-Math.round((n.getTime()-a.getTime())/(24*3600*1e3));o>=0&&o<7&&(r[o].count+=1)}return r}function F(e){let t=new Date(e);return t.setHours(0,0,0,0),t}var I=`oneshot-gtm:trigger-running:`,L=14400*1e3,R=1500;function te(e){try{localStorage.setItem(I+e,String(Date.now()))}catch{}}function z(e){try{localStorage.removeItem(I+e)}catch{}}function B(){try{for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);if(t&&t.startsWith(I))return!0}return!1}catch{return!1}}function V(e){try{let t=localStorage.getItem(I+e);if(!t)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:null}catch{return null}}function H(e,t,n){let[r,i]=(0,N.useState)(0);(0,N.useEffect)(()=>{let e=setInterval(()=>i(e=>e+1),1e3);return()=>clearInterval(e)},[]);let a=new Map,o=Date.now();for(let r of e){let e=V(r),i=n.get(r),s=i?new Date(i).getTime():null,c=e??s;if(c!=null){if(e!=null){let n=t.get(r),i=n?new Date(n).getTime():0,c=o-e;if(i>e&&c>=R){z(r),s!=null&&s>i&&a.set(r,{startedAt:s,elapsedMs:o-s});continue}if(c>L){z(r);continue}}a.set(r,{startedAt:c,elapsedMs:o-c})}}return a}function U(e){let t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}var W=e(),ne=[`all`,`pending`,`approved`,`rejected`,`sent`,`expired`],re=[`show-hn`,`job-change`,`post-funding`,`accelerator-batch`,`hiring-signal`,`podcast-guest`,`competitor-switch`,`stack-consolidation`];function G(e){switch(e){case`pending`:return`spend`;case`approved`:return`receipt`;case`rejected`:return`blocked`;case`sent`:return`signal`;case`expired`:return`neutral`}}function K(){let e=h(),t=f(),[n,r]=(0,N.useState)(`pending`),[i,o]=(0,N.useState)(`all`),[c,l]=(0,N.useState)(null),[u,d]=(0,N.useState)(new Set),[y,b]=(0,N.useState)(null),[x,D]=(0,N.useState)(``),[O,k]=(0,N.useState)(null),[A,M]=(0,N.useState)(10),[P,F]=(0,N.useState)(``),[I,L]=(0,N.useState)(``),[R,te]=(0,N.useState)(!0),z=_({queryKey:[`queue`,n,i],queryFn:()=>a.queue({...n===`all`?{}:{status:n},...i===`all`?{}:{play:i},limit:200}),refetchInterval:2e4}),B=()=>{e.invalidateQueries({queryKey:[`queue`]}),e.invalidateQueries({queryKey:[`home`]})},V=p({mutationFn:e=>a.approveQueue(e),onSuccess:B,onError:e=>g.error(`couldn't approve · ${e.message}`)}),H=p({mutationFn:e=>a.rejectQueue(e.id,e.reason),onSuccess:()=>{b(null),D(``),B()},onError:e=>g.error(`couldn't reject · ${e.message}`)}),U=p({mutationFn:e=>a.approveAllQueue(e),onSuccess:e=>{B(),g.success(`approved ${e.approved} pending`)},onError:e=>g.error(`couldn't approve all · ${e.message}`)}),G=p({mutationFn:async e=>{let t=0;for(let n of e)try{await a.approveQueue(n),t++}catch{}return{ok:t,total:e.length}},onSuccess:({ok:e,total:t})=>{d(new Set),B(),g.success(`approved ${e} of ${t}`)}}),K=p({mutationFn:async e=>{let t=0;for(let n of e)try{await a.rejectQueue(n),t++}catch{}return{ok:t,total:e.length}},onSuccess:({ok:e,total:t})=>{d(new Set),B(),g.success(`rejected ${e} of ${t}`)}}),q=O?.playName===`accelerator-batch`&&P.trim().length===0,J=()=>{if(!O||q)return;let e={fromQueue:`1`,limit:String(A),dryRun:R?`1`:`0`};P.trim()&&(e.senderCohort=P.trim()),I.trim()&&(e.freeForCohortOffer=I.trim()),t({to:`/run/$playName`,params:{playName:O.playName},search:e})},X=z.data?.counts??{pending:0,approved:0,rejected:0,sent:0,expired:0},Z=z.data?.rows??[],le=Array.from(new Set(Z.map(e=>e.playName))).toSorted(),Q=u.size>0,$=Z.length>0&&u.size===Z.length;return(0,W.jsxs)(`div`,{className:`-mx-6 -my-6 flex flex-col`,children:[(0,W.jsxs)(`section`,{className:`flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`ln-eyebrow`,children:`The Ledger · Queue`}),(0,W.jsx)(`h1`,{className:`mt-1 text-ink-cream`,style:{fontFamily:`var(--font-display)`,fontSize:44,fontWeight:600,letterSpacing:`-0.025em`,lineHeight:.98},children:`Candidates, for review.`})]}),(0,W.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:Object.entries(X).map(([e,t])=>`${e} ${t}`).join(` · `)})]}),(0,W.jsx)(se,{}),(0,W.jsx)(oe,{}),(0,W.jsxs)(`section`,{className:`border-t-2 border-ink-rule`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-6 pb-3 pt-5`,children:[(0,W.jsx)(`div`,{className:`flex items-baseline gap-3`,children:(0,W.jsxs)(`div`,{className:`ln-eyebrow`,children:[`Target Queue`,` `,(0,W.jsxs)(`span`,{className:`text-ink-faint`,children:[`· `,z.data?Z.length:`…`,` row`,Z.length===1?``:`s`]})]})}),(0,W.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:`refresh · 20s`})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-ink-rule/60 px-6 pb-3`,children:[(0,W.jsx)(`span`,{className:`ln-eyebrow`,children:`status`}),ne.map(e=>(0,W.jsx)(s,{variant:n===e?`primary`:`ghost`,size:`sm`,onClick:()=>r(e),children:e},e)),(0,W.jsx)(`span`,{className:`mx-2 h-4 w-px bg-ink-rule`}),(0,W.jsx)(`span`,{className:`ln-eyebrow`,children:`play`}),(0,W.jsx)(s,{variant:i===`all`?`primary`:`ghost`,size:`sm`,onClick:()=>o(`all`),children:`all`}),le.map(e=>(0,W.jsx)(s,{variant:i===e?`primary`:`ghost`,size:`sm`,onClick:()=>o(e),children:e},e))]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-ink-rule/60 bg-ink-surface/30 px-6 py-3`,children:[(0,W.jsxs)(s,{variant:`secondary`,size:`sm`,disabled:U.isPending||X.pending===0,onClick:()=>U.mutate(i===`all`?void 0:i),children:[(0,W.jsx)(m,{size:12}),` approve all pending`,i===`all`?``:` (${i})`]}),re.map(e=>(0,W.jsxs)(s,{variant:`ghost`,size:`sm`,disabled:X.approved===0||i!==`all`&&i!==e||!Z.some(t=>t.playName===e&&t.status===`approved`),onClick:()=>k({playName:e,approvedCount:Z.filter(t=>t.playName===e&&t.status===`approved`).length}),children:[(0,W.jsx)(j,{size:12}),` drain `,e]},e))]}),Z.length>0&&(0,W.jsx)(ae,{rows:Z}),z.isLoading?Array.from({length:5},(e,t)=>(0,W.jsx)(ee,{},t)):Z.length===0?(0,W.jsx)(ce,{filterActive:n!==`pending`||i!==`all`}):(0,W.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,W.jsx)(`thead`,{className:`sticky top-0 z-10 bg-ink-bg`,children:(0,W.jsxs)(`tr`,{className:`border-b border-ink-rule text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,W.jsx)(`th`,{className:`w-6 py-2`}),(0,W.jsx)(`th`,{className:`w-6 py-2`,children:(0,W.jsx)(`label`,{className:`inline-flex cursor-pointer items-center`,children:(0,W.jsx)(`input`,{type:`checkbox`,className:`h-[13px] w-[13px] rounded-[var(--radius-xs)] border border-ink-rule bg-ink-bg-deep accent-[color:var(--ink-signal)]`,checked:$,ref:e=>{e&&(e.indeterminate=Q&&!$)},onChange:e=>d(e.target.checked?new Set(Z.map(e=>e.id)):new Set),"aria-label":$?`deselect all`:`select all`})})}),(0,W.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`id`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`prospect`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`play`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`status`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`source`}),(0,W.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`found`}),(0,W.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`actions`})]})}),(0,W.jsx)(`tbody`,{children:Z.map((e,t)=>(0,W.jsx)(ie,{row:e,zebra:t%2==1,expanded:c===e.id,selected:u.has(e.id),anySelected:Q,onToggleSelect:()=>{d(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})},onToggle:()=>l(c===e.id?null:e.id),onApprove:()=>V.mutate(e.id),onReject:()=>b({id:e.id,email:Y(e.payload)??`#${e.id}`}),busy:V.isPending||H.isPending},e.id))})]})]}),Q&&(0,W.jsxs)(`div`,{className:`sticky bottom-0 z-20 flex items-center justify-between gap-4 border-b border-t border-ink-rule bg-ink-bg/95 px-6 py-3 backdrop-blur-[2px]`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`span`,{className:`inline-flex h-6 min-w-[24px] items-center justify-center rounded-full bg-[color:var(--ink-signal)]/20 px-2 font-mono text-[12px] text-[color:var(--ink-signal-2)]`,children:u.size}),(0,W.jsx)(`span`,{className:`text-[13px] text-ink-cream-2`,children:u.size===1?`row selected`:`rows selected`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>d(new Set),className:`font-mono text-[11px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream hover:decoration-ink-cream-2`,children:`clear`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsxs)(s,{variant:`secondary`,size:`sm`,disabled:G.isPending||u.size===0,onClick:()=>G.mutate([...u]),children:[(0,W.jsx)(m,{size:12}),` approve `,u.size]}),(0,W.jsxs)(s,{variant:`ghost`,size:`sm`,disabled:K.isPending||u.size===0,onClick:()=>K.mutate([...u]),children:[(0,W.jsx)(v,{size:12}),` reject `,u.size]})]})]}),(0,W.jsx)(E,{open:y!=null,onClose:()=>b(null),title:`Reject #${y?.id} — ${y?.email??``}`,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s,{variant:`ghost`,onClick:()=>b(null),children:`Cancel`}),(0,W.jsx)(s,{variant:`danger`,onClick:()=>y&&H.mutate({id:y.id,reason:x||void 0}),disabled:H.isPending,children:H.isPending?`Rejecting…`:`Reject`})]}),children:(0,W.jsx)(C,{label:`Reason (optional, logged for ICP-filter learning)`,children:(0,W.jsx)(S,{rows:3,value:x,onChange:e=>D(e.target.value),placeholder:`e.g. wrong stage, wrong industry, already a customer`})})}),(0,W.jsx)(E,{open:O!=null,onClose:()=>k(null),title:`Drain ${O?.playName??``} (${O?.approvedCount??0} approved)`,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s,{variant:`ghost`,onClick:()=>k(null),children:`Cancel`}),(0,W.jsxs)(s,{onClick:J,disabled:q,children:[(0,W.jsx)(j,{size:12}),R?`Preview drafts (no send)`:`Send up to ${A}`]})]}),children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(C,{label:`Limit`,children:(0,W.jsx)(T,{type:`number`,min:1,value:A,onChange:e=>M(Math.max(1,Number.parseInt(e.target.value,10)||1))})}),O?.playName===`accelerator-batch`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C,{label:`Sender cohort (required)`,hint:`Your accelerator/cohort tag, e.g. yc-w23`,children:(0,W.jsx)(T,{value:P,onChange:e=>F(e.target.value),placeholder:`yc-w23`,required:!0})}),(0,W.jsx)(C,{label:`Free-for-cohort offer (optional)`,children:(0,W.jsx)(T,{value:I,onChange:e=>L(e.target.value),placeholder:`Free for current YC W26 through demo day, just reply with your batch.`})})]}),(0,W.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2.5 text-[13px] text-ink-cream-2 hover:text-ink-cream`,children:[(0,W.jsx)(w,{checked:R,onChange:te,label:`dry run`}),(0,W.jsx)(`span`,{children:`Dry run — preview drafts only, no send (a one-time enrich lookup may apply)`})]}),(0,W.jsx)(`p`,{className:`font-mono text-[11px] text-ink-faint`,children:`Drafts stream live on the next page — every lint flag and send confirmation is visible per row.`}),q&&(0,W.jsx)(`p`,{className:`font-mono text-[11px] text-[color:var(--ink-blocked-2)]`,children:`accelerator-batch needs a sender cohort tag before it can run.`})]})})]})}function ie({row:e,zebra:t,expanded:r,selected:a,anySelected:o,onToggleSelect:u,onToggle:d,onApprove:f,onReject:p,busy:h}){let g=Y(e.payload),_=X(e.payload),y=Z(e.payload),x=le(e.payload),S=Q(e.payload);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`tr`,{className:i(`group cursor-pointer border-b border-ink-rule/60`,`transition-colors duration-[var(--dur-stamp)]`,`hover:bg-ink-surface/60`,t&&`bg-ink-surface/20`,a&&`bg-[color:var(--ink-signal)]/8`),onClick:d,children:[(0,W.jsx)(`td`,{className:`w-6 py-2 pl-4 pr-0 text-ink-faint`,children:r?(0,W.jsx)(c,{size:12}):(0,W.jsx)(l,{size:12})}),(0,W.jsx)(`td`,{className:`w-6 py-2`,onClick:e=>e.stopPropagation(),children:(0,W.jsx)(`label`,{className:`inline-flex cursor-pointer items-center`,children:(0,W.jsx)(`input`,{type:`checkbox`,className:i(`h-[13px] w-[13px] rounded-[var(--radius-xs)]`,`border border-ink-rule bg-ink-bg-deep accent-[color:var(--ink-signal)]`,`transition-opacity duration-[var(--dur-stamp)]`,a||o?`opacity-100`:`opacity-0 group-hover:opacity-100 focus:opacity-100`),checked:a,onChange:u,"aria-label":a?`deselect #${e.id}`:`select #${e.id}`})})}),(0,W.jsxs)(`td`,{className:`px-6 py-2 font-mono text-[11px] text-ink-faint`,children:[`#`,e.id]}),(0,W.jsxs)(`td`,{className:`py-2`,children:[(0,W.jsx)(`div`,{className:`text-ink-cream`,children:_??`(unknown)`}),(0,W.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:[g??`—`,y?` · ${y}`:``,x?(0,W.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`ml-1 text-ink-cream-2 underline decoration-ink-rule underline-offset-2 hover:text-ink-cream hover:decoration-ink-cream-2`,onClick:e=>e.stopPropagation(),children:`[in]`}):null,S?(0,W.jsxs)(`span`,{className:`ml-1 text-ink-faint`,children:[`· `,S]}):null]})]}),(0,W.jsx)(`td`,{className:`py-2 text-ink-cream-2`,children:e.playName}),(0,W.jsx)(`td`,{className:`py-2`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(b,{tone:G(e.status),children:e.status}),e.lastDraft&&(0,W.jsx)(b,{tone:e.lastDraft.sent?`receipt`:e.lastDraft.flags.length>0?`blocked`:`neutral`,title:e.lastDraft.sent?`draft sent`:e.lastDraft.flags.length>0?`draft held · ${e.lastDraft.flags.length} flag(s)`:`draft preview`,children:`draft`})]})}),(0,W.jsx)(`td`,{className:`py-2 font-mono text-[11px] text-ink-faint`,children:e.source}),(0,W.jsx)(`td`,{className:`py-2 text-right font-mono text-[12px] text-ink-muted`,children:n(e.foundAt)}),(0,W.jsx)(`td`,{className:`px-6 py-2 text-right`,onClick:e=>e.stopPropagation(),children:(0,W.jsx)(`div`,{className:`flex items-center justify-end gap-1`,children:e.status===`pending`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s,{variant:`ghost`,size:`sm`,title:`approve`,disabled:h,onClick:f,children:(0,W.jsx)(m,{size:12})}),(0,W.jsx)(s,{variant:`ghost`,size:`sm`,title:`reject`,disabled:h,onClick:p,children:(0,W.jsx)(v,{size:12})})]})})})]}),r&&(0,W.jsx)(`tr`,{className:`border-b border-ink-rule/60 bg-ink-bg-deep/50`,children:(0,W.jsx)(`td`,{colSpan:9,className:`px-6 py-3`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 text-[12px] text-ink-muted`,children:[e.notes?(0,W.jsx)(`div`,{className:`ln-note`,children:e.notes}):null,(0,W.jsx)(q,{id:e.id,playName:e.playName,status:e.status,draft:e.lastDraft,draftedAt:e.lastDraftedAt}),(0,W.jsxs)(`details`,{className:`text-ink-faint`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer font-mono text-[10px] uppercase tracking-[0.14em] hover:text-ink-cream-2`,children:`payload json`}),(0,W.jsx)(`pre`,{className:`mt-2 max-h-[300px] overflow-auto rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep p-3 font-mono text-[11.5px] leading-[1.55] text-ink-cream-2`,children:JSON.stringify(e.payload,null,2)})]})]})})})]})}function q({id:e,playName:t,status:r,draft:i,draftedAt:o}){let c=h(),l=p({mutationFn:()=>a.regenerateDraft(e),onSuccess:()=>{c.invalidateQueries({queryKey:[`queue`]}),g.success(`draft ready · preview only, not sent`)},onError:e=>g.error(`couldn't draft · ${e.message}`)}),d=p({mutationFn:()=>a.sendDraft(e),onSuccess:()=>{c.invalidateQueries({queryKey:[`queue`]}),c.invalidateQueries({queryKey:[`home`]}),g.success(`sent · the reviewed draft went out as-is`)},onError:e=>g.error(`couldn't send · ${e.message}`)}),f=t!==`accelerator-batch`&&!(i?.sent??!1),m=i?`regenerate`:`generate draft`,_=i?`regenerating…`:`generating…`,v=f?(0,W.jsxs)(s,{variant:`ghost`,size:`sm`,disabled:l.isPending,onClick:()=>l.mutate(),title:`Draft this row in preview mode — dry-run, never sends`,children:[l.isPending?(0,W.jsx)(u,{size:11,className:`animate-spin`}):(0,W.jsx)(A,{size:11}),l.isPending?_:m]}):null,x=i!=null&&i.flags.length===0&&!i.sent,S=r===`approved`&&!(i?.sent??!1)?(0,W.jsxs)(s,{variant:`secondary`,size:`sm`,disabled:d.isPending||!x,onClick:()=>d.mutate(),title:x?`Send this prospect now — sends the reviewed draft above, as-is`:i==null?`Generate a draft first, then send it`:`Draft has lint flags — regenerate to clear them, then send`,children:[d.isPending?(0,W.jsx)(u,{size:11,className:`animate-spin`}):(0,W.jsx)(j,{size:11}),d.isPending?`sending…`:`send this one`]}):null;if(!i)return(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-[var(--radius-sm)] border border-dashed border-ink-rule bg-ink-bg-deep px-3 py-2.5`,children:[(0,W.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:`no draft yet`}),(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[S,v]})]});let C=i.sent?`receipt`:i.flags.length>0?`blocked`:i.dryRun?`spend`:`neutral`,w=i.sent?`sent`:i.flags.length>0?`held · lint`:i.dryRun?`preview`:`drafted`;return(0,W.jsxs)(`div`,{className:`rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-ink-rule/60 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,W.jsx)(`span`,{children:`last draft`}),o?(0,W.jsxs)(`span`,{className:`text-ink-muted`,children:[`· `,n(o)]}):null,(0,W.jsx)(b,{tone:C,children:w}),i.flags.length>0&&i.flags.map(e=>(0,W.jsx)(b,{tone:`blocked`,children:e},e)),(0,W.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 normal-case tracking-normal`,children:[i.receiptIds.map(e=>(0,W.jsxs)(y,{to:`/receipts`,className:`font-mono text-[10px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream-2`,children:[`receipt #`,e]},e)),S,v]})]}),(0,W.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,W.jsx)(`div`,{className:`text-[13px] font-medium text-ink-cream`,children:i.subject}),(0,W.jsx)(`pre`,{className:`mt-2 max-h-[360px] overflow-auto whitespace-pre-wrap font-mono text-[11.5px] leading-[1.55] text-ink-cream-2`,children:i.body})]})]})}function ae({rows:e}){let t=P(e),n=Math.max(1,...t.map(e=>e.count)),r=t.reduce((e,t)=>e+t.count,0);return(0,W.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-ink-rule/60 bg-ink-bg-deep/40 px-6 py-2.5`,children:[(0,W.jsx)(`div`,{className:`ln-eyebrow`,style:{fontSize:10},children:`last 7d`}),(0,W.jsx)(`div`,{className:`flex items-end gap-1`,"aria-hidden":`true`,children:t.map(e=>{let t=Math.round(e.count/n*20);return(0,W.jsx)(`span`,{title:`${e.label} · ${e.count} enqueued`,className:i(`w-[10px] rounded-[1px]`,e.count===0?`bg-ink-rule`:`bg-[color:var(--ink-signal)]/70`),style:{height:Math.max(2,t)}},e.label)})}),(0,W.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-muted`,children:[r,` enqueued`,(0,W.jsxs)(`span`,{className:`ml-2 text-ink-faint`,children:[`· `,(0,W.jsx)(`span`,{className:`text-ink-cream-2`,children:t[t.length-1]?.count??0}),` today`]})]})]})}function oe(){let e=h(),t=_({queryKey:[`triggers`],queryFn:()=>a.triggers(),refetchInterval:e=>B()||e.state.data?.triggers.some(e=>e.running)?5e3:3e4}),n=p({mutationFn:e=>a.setTriggerEnabled(e.name,e.enabled),onSuccess:()=>void e.invalidateQueries({queryKey:[`triggers`]}),onError:e=>g.error(e.message)}),r=p({mutationFn:e=>a.setTriggerConfig(e.name,e.config),onSuccess:()=>{s(null),e.invalidateQueries({queryKey:[`triggers`]})},onError:e=>g.error(e.message)}),i=p({mutationFn:e=>(te(e),a.runTrigger(e)),onSuccess:(t,n)=>{if(e.invalidateQueries({queryKey:[`triggers`]}),t.pending){g.success(`${n} · started`,{description:`polling for results`});return}if(z(n),e.invalidateQueries({queryKey:[`queue`]}),e.invalidateQueries({queryKey:[`home`]}),t.error){g.error(`${n} · ${t.error}`);return}let r=t.result;if(!r){g.success(`${n} · ran`);return}let i=[`${r.candidates} candidates`,`${r.enqueued} kept`,r.droppedIcp?`${r.droppedIcp} icp-drop`:null,r.droppedDuplicate?`${r.droppedDuplicate} dup`:null,r.droppedEnrichment?`${r.droppedEnrichment} enrich-fail`:null,`$${r.costUsd.toFixed(2)}`,r.halted?`halted: ${r.halted}`:null].filter(Boolean);g.success(`${n} · ${i.join(` · `)}`)},onError:(t,n)=>{if(t.message.includes(`already running`)){e.invalidateQueries({queryKey:[`triggers`]}),g.info(`${n} · already running`);return}z(n),g.error(`${n} · ${t.message}`)}}),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(null),u=t.data?.triggers??[],d=u.filter(e=>e.running).map(e=>e.name).toSorted().join(`,`),f=(0,N.useRef)(``);(0,N.useEffect)(()=>{let t=f.current;f.current=d;let n=t?t.split(`,`):[],r=d?d.split(`,`):[],i=new Set(r);n.some(e=>!i.has(e))&&(e.invalidateQueries({queryKey:[`queue`]}),e.invalidateQueries({queryKey:[`home`]}))},[d,e]);let m=new Map(u.map(e=>[e.name,e.lastPolledAt])),v=new Map(u.map(e=>[e.name,e.runningSince])),y=H(u.map(e=>e.name),m,v);return(0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(`section`,{className:`border-b border-ink-rule`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between px-6 pb-2 pt-5`,children:[(0,W.jsxs)(`div`,{className:`ln-eyebrow`,children:[`Triggers `,(0,W.jsxs)(`span`,{className:`text-ink-faint`,children:[`· `,u.length]})]}),(0,W.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:`refresh · 30s`})]}),t.isLoading?Array.from({length:3},(e,t)=>(0,W.jsx)(ee,{},t)):u.length===0?(0,W.jsx)(`div`,{className:`px-6 pb-6`,children:(0,W.jsx)(x,{note:`No triggers stored yet. Enable one below and it bootstraps itself on the next watch tick — or run the watch loop once to initialise.`,cli:`oneshot-gtm find watch --once`})}):(0,W.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{className:`border-b border-ink-rule/60 text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,W.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`name`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`enabled`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`interval`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`last polled`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`last run`}),(0,W.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`actions`})]})}),(0,W.jsx)(`tbody`,{children:u.map((e,t)=>{let a=O(e.lastRunSummary),u=i.isPending&&i.variables===e.name,d=y.get(e.name),f=u||d!=null,p=d?.elapsedMs??null,m=o?.name===e.name;return(0,W.jsx)(J,{trigger:e,zebra:t%2==1,running:f,elapsedMs:p,summary:a,isEditing:!!m,editing:m?o:null,editError:m?c:null,onToggleEnabled:t=>n.mutate({name:e.name,enabled:t}),onRun:()=>i.mutate(e.name),onStartEdit:()=>{s({name:e.name,text:JSON.stringify(e.config??{},null,2),defaultConfig:e.defaultConfig}),l(null)},onCancelEdit:()=>{s(null),l(null)},onChangeEditText:e=>s(t=>t&&{...t,text:e}),onResetDefaults:()=>s(e=>e&&{...e,text:JSON.stringify(e.defaultConfig??{},null,2)}),onSaveEdit:()=>{if(!o)return;let e;try{e=JSON.parse(o.text)}catch(e){l(`invalid JSON: ${e.message}`);return}if(!e||typeof e!=`object`){l(`config must be a JSON object`);return}l(null),r.mutate({name:o.name,config:e})},setEnabledPending:n.isPending,setConfigPending:r.isPending},e.name)})})]})]})})}function J(e){let t=e.trigger,r=t.ready===!1,a=t.notReadyReason??`missing required config`,o=e.setEnabledPending||r&&!t.enabled,c=e.running||r;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`tr`,{className:i(`group relative border-b border-ink-rule/60`,`transition-colors duration-[var(--dur-stamp)]`,e.zebra&&`bg-ink-surface/20`,!t.enabled&&`opacity-65`,`hover:bg-ink-surface/50`,e.isEditing&&`bg-ink-surface/50`,e.running&&`bg-[color:var(--ink-signal)]/[0.08]`),children:[(0,W.jsxs)(`td`,{className:`relative px-6 py-2 font-mono text-[12px]`,children:[e.running?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-[2px] bg-[color:var(--ink-signal)] animate-pulse`}):t.enabled&&(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-[2px] bg-[color:var(--ink-signal)]/60`}),(0,W.jsx)(`span`,{className:t.enabled?`text-ink-cream`:`text-ink-muted`,children:t.name})]}),(0,W.jsx)(`td`,{className:`py-2`,title:r&&!t.enabled?`not ready · ${a}`:void 0,children:(0,W.jsx)(w,{checked:t.enabled,disabled:o,label:`${t.enabled?`disable`:`enable`} ${t.name}`,onChange:e.onToggleEnabled})}),(0,W.jsxs)(`td`,{className:`py-2 font-mono text-[12px] text-ink-muted`,children:[D(t.intervalMs),t.intervalMs!==t.defaultIntervalMs&&(0,W.jsxs)(`span`,{className:`ml-1 text-ink-faint`,children:[`· default `,D(t.defaultIntervalMs)]})]}),(0,W.jsx)(`td`,{className:`py-2 font-mono text-[12px] text-ink-muted`,children:t.lastPolledAt?n(t.lastPolledAt):`never`}),(0,W.jsx)(`td`,{className:i(`py-2 font-mono text-[11.5px]`,r?`text-[color:var(--ink-blocked-2)]`:`text-ink-muted`),children:r?`not ready · ${a}`:e.summary}),(0,W.jsx)(`td`,{className:`px-6 py-2 text-right`,children:(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,W.jsxs)(s,{variant:e.running?`accent`:`ghost`,size:`sm`,"aria-disabled":c||void 0,onClick:c?void 0:e.onRun,className:i(c&&`cursor-not-allowed pointer-events-none`),title:e.running?`Running for ${e.elapsedMs==null?`a moment`:U(e.elapsedMs)} — click won't re-fire`:r?`not ready · ${a}`:`Run this finder now — ignores schedule, spends OneShot $`,children:[e.running?(0,W.jsx)(u,{size:12,className:`animate-spin`,"aria-hidden":`true`}):(0,W.jsx)(d,{size:12,"aria-hidden":`true`}),e.running?e.elapsedMs==null?`running…`:`running · ${U(e.elapsedMs)}`:`run now`]}),(0,W.jsx)(s,{variant:e.isEditing?`secondary`:`ghost`,size:`sm`,title:e.isEditing?`close config`:`edit config`,"aria-label":`${e.isEditing?`close`:`edit`} ${t.name} config`,onClick:e.isEditing?e.onCancelEdit:e.onStartEdit,children:(0,W.jsx)(k,{size:12})})]})})]}),e.isEditing&&e.editing&&(0,W.jsx)(`tr`,{className:`border-b border-ink-rule/60 bg-ink-bg-deep/60`,children:(0,W.jsx)(`td`,{colSpan:6,className:`px-6 py-4`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`ln-eyebrow`,children:[`config ·`,` `,(0,W.jsx)(`span`,{className:`text-ink-cream-2 normal-case font-mono tracking-normal`,children:t.name})]}),(0,W.jsxs)(`div`,{className:`ln-note text-[12px] text-ink-cream-2`,children:[`add`,` `,(0,W.jsx)(`code`,{className:`ln-mono text-[11.5px] text-[color:var(--ink-signal-2)]`,children:`"intervalMs"`}),` `,`to override the watch cadence · min 60000`]})]}),(0,W.jsx)(S,{rows:8,value:e.editing.text,onChange:t=>e.onChangeEditText(t.target.value),className:`font-mono text-[12px]`,spellCheck:!1}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`div`,{className:`font-mono text-[11.5px] text-[color:var(--ink-blocked-2)]`,children:e.editError??``}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.editing.defaultConfig&&(0,W.jsx)(s,{variant:`ghost`,size:`sm`,onClick:e.onResetDefaults,disabled:e.setConfigPending,title:`Replace the textarea with the registry default config`,children:`reset`}),(0,W.jsx)(s,{variant:`ghost`,size:`sm`,onClick:e.onCancelEdit,disabled:e.setConfigPending,children:`cancel`}),(0,W.jsx)(s,{variant:`primary`,size:`sm`,onClick:e.onSaveEdit,disabled:e.setConfigPending,children:e.setConfigPending?`saving…`:`save`})]})]})]})})})]})}function se(){let e=_({queryKey:[`setup`],queryFn:()=>a.setupStatus()}),t=e.data?.cfg.icpOneLiner??null;return e.isLoading?null:!t||t.trim().length===0?(0,W.jsxs)(`section`,{className:`flex items-start gap-3 border-b border-ink-rule bg-[color:var(--ink-spend)]/6 px-6 py-4`,children:[(0,W.jsx)(M,{size:14,className:`mt-[3px] shrink-0 text-[color:var(--ink-spend-2)]`}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`ln-eyebrow`,style:{color:`var(--ink-spend-2)`},children:`Set your ICP first`}),(0,W.jsx)(`div`,{className:`ln-note mt-0.5 text-[13px] text-ink-cream-2`,children:`The find layer needs a free-text ICP one-liner to filter candidates. Without it, every result passes through and you'll review more noise than signal.`})]}),(0,W.jsx)(y,{to:`/setup`,children:(0,W.jsx)(s,{size:`sm`,children:`Open setup`})})]}):(0,W.jsxs)(`section`,{className:`flex items-start gap-3 border-b border-ink-rule px-6 py-3`,children:[(0,W.jsx)(M,{size:14,className:`mt-[3px] shrink-0 text-[color:var(--ink-receipt-2)]`}),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(`div`,{className:`ln-eyebrow`,children:`ICP`}),(0,W.jsx)(`div`,{className:`mt-0.5 truncate text-[13px] text-ink-cream-2`,children:t})]}),(0,W.jsx)(y,{to:`/setup`,children:(0,W.jsx)(s,{variant:`ghost`,size:`sm`,children:`edit`})})]})}function ce({filterActive:e}){return e?(0,W.jsx)(`div`,{className:`p-5`,children:(0,W.jsx)(x,{note:`No queue rows match this filter. Try a different status or play above to see other rows.`})}):(0,W.jsx)(`div`,{className:`p-5`,children:(0,W.jsx)(x,{note:`No targets yet. Pick a finder from the Triggers panel and run it — candidates land here for review before any send.`,cli:`oneshot-gtm find watch`})})}function Y(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.email==`string`?t.email:typeof t.founderEmail==`string`?t.founderEmail:null}function X(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.name==`string`)return t.name;if(typeof t.founderName==`string`)return t.founderName;let n=typeof t.repoUrl==`string`?t.repoUrl:null;if(n){let e=n.match(/github\.com\/([^/]+)\/([^/?#]+)/);if(e)return`${e[1]}/${e[2]}`}let r=typeof t.postUrl==`string`?t.postUrl:null;if(r)try{let e=new URL(r).hostname.replace(/^www\./,``);if(e)return e}catch{}return null}function Z(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.company==`string`?t.company:null}function le(e){if(!e||typeof e!=`object`)return null;let t=e.linkedinUrl;return typeof t!=`string`||t.length===0?null:/^https?:\/\/(?:[a-z0-9-]+\.)*linkedin\.com\/in\//i.test(t)?t:null}function Q(e){if(!e||typeof e!=`object`)return null;let t=e.phone;return typeof t==`string`&&t.length>0?t:null}export{K as component};
2
- //# sourceMappingURL=queue-ClVxfeJ0.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue-ClVxfeJ0.js","names":["__iconNode","__iconNode","__iconNode","useMutation","useQuery","useQueryClient","Link","useNavigate","Check","ChevronDown","ChevronRight","Loader2","Pencil","Play","RotateCw","Send","Target","X","useEffect","useRef","useState","toast","api","Badge","Button","EmptyNote","Field","Input","Textarea","Modal","SkeletonRow","Toggle","cn","timeAgo","humanInterval","buildSignalDays","summarizeRun","clearTriggerRunning","hasAnyRunningTrigger","humanDuration","markTriggerRunning","useRunningTriggers","STATUSES","Array","QueueStatusView","DRAINABLE_PLAYS","statusTone","status","RejectModalState","id","email","DrainModalState","playName","approvedCount","EditingState","name","text","defaultConfig","Record","QueuePage","qc","navigate","statusFilter","setStatusFilter","playFilter","setPlayFilter","expanded","setExpanded","selected","setSelected","Set","rejectModal","setRejectModal","rejectReason","setRejectReason","drainModal","setDrainModal","drainLimit","setDrainLimit","drainSenderCohort","setDrainSenderCohort","drainOffer","setDrainOffer","drainDryRun","setDrainDryRun","queueQuery","queryKey","queryFn","queue","play","limit","refetchInterval","invalidate","invalidateQueries","approve","mutationFn","approveQueue","onSuccess","onError","err","error","message","reject","vars","reason","rejectQueue","approveAll","approveAllQueue","data","success","approved","bulkApprove","ids","ok","total","length","bulkReject","drainNeedsSenderCohort","trim","submitDrainViaRun","search","fromQueue","String","dryRun","to","params","counts","pending","rejected","sent","expired","rows","playList","from","map","r","toSorted","someSelected","size","allSelected","fontFamily","fontSize","fontWeight","letterSpacing","lineHeight","Object","entries","k","v","join","s","p","isPending","mutate","undefined","some","filter","isLoading","_","i","el","indeterminate","e","target","checked","row","has","prev","next","delete","add","emailFor","payload","value","Math","max","Number","parseInt","QueueRow","zebra","anySelected","onToggleSelect","onToggle","onApprove","onReject","busy","QueueRowView","nameFor","company","companyFor","linkedinUrl","linkedinUrlFor","phone","phoneFor","stopPropagation","lastDraft","flags","source","foundAt","notes","lastDraftedAt","JSON","stringify","DraftSection","draft","draftedAt","React","ReactElement","regenerate","regenerateDraft","send","sendDraft","canDraft","verb","pendingVerb","draftButton","cleanDraft","sendButton","tone","stateLabel","f","receiptIds","rid","subject","body","SignalStrip","days","d","count","reduce","a","h","round","label","height","TriggersCard","triggersQuery","triggers","query","state","t","running","setEnabled","enabled","setTriggerEnabled","setConfig","config","setTriggerConfig","setEditing","runTrigger","description","result","parts","candidates","enqueued","droppedIcp","droppedDuplicate","droppedEnrichment","costUsd","toFixed","halted","Boolean","includes","info","editing","editError","setEditError","runningKey","prevRunningRef","current","prevNames","split","nowNames","stillRunning","n","lastPolledByName","Map","lastPolledAt","serverRunningSinceByName","runningSince","runningByName","summary","lastRunSummary","inProcess","variables","tracked","get","elapsedMs","isEditing","parsed","parse","Error","TriggerRowProps","trigger","TriggerView","onToggleEnabled","onRun","onStartEdit","onCancelEdit","onChangeEditText","onResetDefaults","onSaveEdit","setEnabledPending","setConfigPending","TriggerRowFragment","props","notReady","ready","notReadyReason","toggleDisabled","runDisabled","intervalMs","defaultIntervalMs","IcpBanner","setupQuery","setupStatus","icp","cfg","icpOneLiner","color","EmptyQueueHelp","filterActive","repoUrl","m","match","postUrl","host","URL","hostname","replace","test","component"],"sources":["../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/pencil.mjs","../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/rotate-cw.mjs","../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/send.mjs","../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/target.mjs","../../src/lib/signalDays.ts","../../src/lib/triggerRunState.ts","../../src/routes/queue.tsx?tsr-split=component"],"sourcesContent":["/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\",\n key: \"1a8usu\"\n }\n ],\n [\"path\", { d: \"m15 5 4 4\", key: \"1mk7zo\" }]\n];\nconst Pencil = createLucideIcon(\"pencil\", __iconNode);\n\nexport { __iconNode, Pencil as default };\n//# sourceMappingURL=pencil.mjs.map\n","/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\", key: \"1p45f6\" }],\n [\"path\", { d: \"M21 3v5h-5\", key: \"1q7to0\" }]\n];\nconst RotateCw = createLucideIcon(\"rotate-cw\", __iconNode);\n\nexport { __iconNode, RotateCw as default };\n//# sourceMappingURL=rotate-cw.mjs.map\n","/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z\",\n key: \"1ffxy3\"\n }\n ],\n [\"path\", { d: \"m21.854 2.147-10.94 10.939\", key: \"12cjpa\" }]\n];\nconst Send = createLucideIcon(\"send\", __iconNode);\n\nexport { __iconNode, Send as default };\n//# sourceMappingURL=send.mjs.map\n","/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"6\", key: \"1vlfrh\" }],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"2\", key: \"1c9p78\" }]\n];\nconst Target = createLucideIcon(\"target\", __iconNode);\n\nexport { __iconNode, Target as default };\n//# sourceMappingURL=target.mjs.map\n","import type { QueueRowView } from \"@oneshot-gtm/shared-types\";\n\nexport interface SignalDay {\n /** Local-formatted day label, e.g. \"Mon · Apr 21\". */\n label: string;\n count: number;\n /** ms epoch at the start of this calendar day in local time. */\n startMs: number;\n}\n\n/**\n * 7-day histogram (oldest → newest) of queue enqueues, bucketed by LOCAL\n * calendar day. Each bar's count is the number of rows whose `foundAt`\n * falls inside that day's local-midnight-to-midnight window.\n *\n * Why calendar buckets, not rolling 24h windows: the labels say \"Mon Apr 21\"\n * etc, so the bars must mean the same thing. The previous version used\n * `Math.floor((now - ts) / 24h)` which drifted — a row from yesterday at\n * 18:00 viewed at noon today (18h diff = 0.75 days = floor 0) landed in\n * the \"today\" bucket even though it's clearly yesterday by any calendar.\n *\n * `now` is injected so tests can pin time without faking Date globally.\n * Math.round on the day-diff handles DST transitions where a \"day\" is\n * 23 or 25 hours of wall-clock time but still one calendar day.\n */\nexport function buildSignalDays(rows: QueueRowView[], now: Date = new Date()): SignalDay[] {\n const todayStart = startOfLocalDay(now);\n const days: SignalDay[] = [];\n for (let i = 6; i >= 0; i--) {\n const d = new Date(todayStart);\n d.setDate(d.getDate() - i);\n days.push({\n label: d.toLocaleDateString(undefined, { weekday: \"short\", month: \"short\", day: \"numeric\" }),\n count: 0,\n startMs: d.getTime(),\n });\n }\n const cutoffMs = days[0]!.startMs;\n for (const r of rows) {\n const ts = new Date(r.foundAt);\n if (Number.isNaN(ts.getTime())) continue;\n const tsStart = startOfLocalDay(ts);\n if (tsStart.getTime() < cutoffMs) continue;\n const dayDiff = Math.round((todayStart.getTime() - tsStart.getTime()) / (24 * 3600 * 1000));\n const idx = 6 - dayDiff;\n if (idx >= 0 && idx < 7) {\n days[idx]!.count += 1;\n }\n }\n return days;\n}\n\nfunction startOfLocalDay(d: Date): Date {\n const out = new Date(d);\n out.setHours(0, 0, 0, 0);\n return out;\n}\n","import { useEffect, useState } from \"react\";\n\n/**\n * Per-trigger \"is running\" tracker persisted to localStorage, so a mid-run\n * refresh preserves the spinner. Entries are cleared when the server\n * confirms completion (lastPolledAt > startedAt and MIN_VISIBLE_MS has\n * elapsed), or when MAX_RUNTIME_MS zombie-cleans them.\n *\n * Storage: localStorage[\"oneshot-gtm:trigger-running:<name>\"] = \"<unix-ms>\"\n */\nconst KEY_PREFIX = \"oneshot-gtm:trigger-running:\";\n/**\n * Client-side zombie cleanup for the localStorage spinner marker. Set to\n * 4h to match `MAX_RUN_AGE_MS` in @oneshot-gtm/find — generous headroom\n * over realistic finder runtimes (github-topics with concurrency=3 typically\n * completes in 5-15 min; the deepResearchPerson tier sets the upper bound\n * at 2-5 min per call). The spinner shouldn't disappear mid-run on a\n * genuinely-long execution.\n */\nconst MAX_RUNTIME_MS = 4 * 60 * 60 * 1000;\n/**\n * Minimum visible duration after a click. Without this floor the\n * unconfigured-halt + ledger-only finders complete in <10ms, flipping the\n * button back to \"run now\" before the user perceives the spinner.\n */\nconst MIN_VISIBLE_MS = 1500;\n\nexport function markTriggerRunning(name: string): void {\n try {\n localStorage.setItem(KEY_PREFIX + name, String(Date.now()));\n } catch {\n // private mode / SSR — no-op\n }\n}\n\nexport function clearTriggerRunning(name: string): void {\n try {\n localStorage.removeItem(KEY_PREFIX + name);\n } catch {\n // ignore\n }\n}\n\nexport function hasAnyRunningTrigger(): boolean {\n try {\n for (let i = 0; i < localStorage.length; i++) {\n const k = localStorage.key(i);\n if (k && k.startsWith(KEY_PREFIX)) return true;\n }\n return false;\n } catch {\n return false;\n }\n}\n\nfunction readStartedAt(name: string): number | null {\n try {\n const raw = localStorage.getItem(KEY_PREFIX + name);\n if (!raw) return null;\n const n = Number.parseInt(raw, 10);\n return Number.isFinite(n) ? n : null;\n } catch {\n return null;\n }\n}\n\ninterface RunningInfo {\n startedAt: number;\n elapsedMs: number;\n}\n\n/**\n * Merge local (localStorage) + server (`runningSince` from the triggers\n * poll) start times into a per-name running map with a live-ticking\n * elapsedMs. Local wins when both are present; server fills in for fresh\n * tabs that never set a marker.\n */\nexport function useRunningTriggers(\n names: string[],\n lastPolledByName: Map<string, string | null>,\n serverRunningSinceByName: Map<string, string | null>,\n): Map<string, RunningInfo> {\n const [tick, setTick] = useState(0);\n useEffect(() => {\n const t = setInterval(() => setTick((n) => n + 1), 1000);\n return () => clearInterval(t);\n }, []);\n\n const out = new Map<string, RunningInfo>();\n const now = Date.now();\n for (const name of names) {\n const localStartedAt = readStartedAt(name);\n const serverSinceIso = serverRunningSinceByName.get(name);\n const serverStartedAt = serverSinceIso ? new Date(serverSinceIso).getTime() : null;\n const startedAt = localStartedAt ?? serverStartedAt;\n if (startedAt == null) continue;\n\n if (localStartedAt != null) {\n const polledIso = lastPolledByName.get(name);\n const polledMs = polledIso ? new Date(polledIso).getTime() : 0;\n const visibleFor = now - localStartedAt;\n if (polledMs > localStartedAt && visibleFor >= MIN_VISIBLE_MS) {\n clearTriggerRunning(name);\n if (serverStartedAt != null && serverStartedAt > polledMs) {\n out.set(name, { startedAt: serverStartedAt, elapsedMs: now - serverStartedAt });\n }\n continue;\n }\n if (visibleFor > MAX_RUNTIME_MS) {\n clearTriggerRunning(name);\n continue;\n }\n }\n\n out.set(name, { startedAt, elapsedMs: now - startedAt });\n }\n // Ref `tick` so the elapsed counter re-computes on the interval.\n void tick;\n return out;\n}\n\nexport function humanDuration(ms: number): string {\n const s = Math.floor(ms / 1000);\n if (s < 60) return `${s}s`;\n const m = Math.floor(s / 60);\n const r = s % 60;\n return `${m}m ${r}s`;\n}\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { createFileRoute, Link, useNavigate } from \"@tanstack/react-router\";\nimport {\n Check,\n ChevronDown,\n ChevronRight,\n Loader2,\n Pencil,\n Play,\n RotateCw,\n Send,\n Target,\n X,\n} from \"lucide-react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport type { QueueRowView, QueueStatusView, TriggerView } from \"@oneshot-gtm/shared-types\";\nimport { api } from \"../api/client.ts\";\nimport { Badge } from \"../components/primitives/Badge.tsx\";\nimport { Button } from \"../components/primitives/Button.tsx\";\nimport { EmptyNote } from \"../components/primitives/EmptyNote.tsx\";\nimport { Field, Input, Textarea } from \"../components/primitives/Field.tsx\";\nimport { Modal } from \"../components/primitives/Modal.tsx\";\nimport { SkeletonRow } from \"../components/primitives/Skeleton.tsx\";\nimport { Toggle } from \"../components/primitives/Toggle.tsx\";\nimport { cn, timeAgo } from \"../lib/cn.ts\";\nimport { humanInterval } from \"../lib/humanInterval.ts\";\nimport { buildSignalDays } from \"../lib/signalDays.ts\";\nimport { summarizeRun } from \"../lib/summarizeRun.ts\";\nimport {\n clearTriggerRunning,\n hasAnyRunningTrigger,\n humanDuration,\n markTriggerRunning,\n useRunningTriggers,\n} from \"../lib/triggerRunState.ts\";\n\nexport const Route = createFileRoute(\"/queue\")({\n component: QueuePage,\n});\n\nconst STATUSES: Array<QueueStatusView | \"all\"> = [\n \"all\",\n \"pending\",\n \"approved\",\n \"rejected\",\n \"sent\",\n \"expired\",\n];\n\n// Finder-fed plays whose queue rows can be drained. github-topics routes\n// candidates to stack-consolidation (vendor sprawl) or competitor-switch\n// (when a detected vendor is on its directCompetitors list), so both appear.\nconst DRAINABLE_PLAYS = [\n \"show-hn\",\n \"job-change\",\n \"post-funding\",\n \"accelerator-batch\",\n \"hiring-signal\",\n \"podcast-guest\",\n \"competitor-switch\",\n \"stack-consolidation\",\n];\n\nfunction statusTone(\n status: QueueStatusView,\n): \"receipt\" | \"spend\" | \"blocked\" | \"signal\" | \"neutral\" {\n switch (status) {\n case \"pending\":\n return \"spend\";\n case \"approved\":\n return \"receipt\";\n case \"rejected\":\n return \"blocked\";\n case \"sent\":\n return \"signal\";\n case \"expired\":\n return \"neutral\";\n }\n}\n\ninterface RejectModalState {\n id: number;\n email: string;\n}\n\ninterface DrainModalState {\n playName: string;\n approvedCount: number;\n}\n\ninterface EditingState {\n name: string;\n text: string;\n defaultConfig: Record<string, unknown> | null;\n}\n\nfunction QueuePage() {\n const qc = useQueryClient();\n const navigate = useNavigate();\n const [statusFilter, setStatusFilter] = useState<QueueStatusView | \"all\">(\"pending\");\n const [playFilter, setPlayFilter] = useState<string>(\"all\");\n const [expanded, setExpanded] = useState<number | null>(null);\n const [selected, setSelected] = useState<Set<number>>(new Set());\n const [rejectModal, setRejectModal] = useState<RejectModalState | null>(null);\n const [rejectReason, setRejectReason] = useState(\"\");\n const [drainModal, setDrainModal] = useState<DrainModalState | null>(null);\n const [drainLimit, setDrainLimit] = useState(10);\n const [drainSenderCohort, setDrainSenderCohort] = useState(\"\");\n const [drainOffer, setDrainOffer] = useState(\"\");\n const [drainDryRun, setDrainDryRun] = useState(true);\n\n const queueQuery = useQuery({\n queryKey: [\"queue\", statusFilter, playFilter],\n queryFn: () =>\n api.queue({\n ...(statusFilter !== \"all\" ? { status: statusFilter } : {}),\n ...(playFilter !== \"all\" ? { play: playFilter } : {}),\n limit: 200,\n }),\n refetchInterval: 20_000,\n });\n\n const invalidate = (): void => {\n void qc.invalidateQueries({ queryKey: [\"queue\"] });\n void qc.invalidateQueries({ queryKey: [\"home\"] });\n };\n\n const approve = useMutation({\n mutationFn: (id: number) => api.approveQueue(id),\n onSuccess: invalidate,\n onError: (err) => toast.error(`couldn't approve · ${err.message}`),\n });\n const reject = useMutation({\n mutationFn: (vars: { id: number; reason?: string }) => api.rejectQueue(vars.id, vars.reason),\n onSuccess: () => {\n setRejectModal(null);\n setRejectReason(\"\");\n invalidate();\n },\n onError: (err) => toast.error(`couldn't reject · ${err.message}`),\n });\n const approveAll = useMutation({\n mutationFn: (play?: string) => api.approveAllQueue(play),\n onSuccess: (data) => {\n invalidate();\n toast.success(`approved ${data.approved} pending`);\n },\n onError: (err) => toast.error(`couldn't approve all · ${err.message}`),\n });\n\n // Bulk selection mutations — operate over the current `selected` set.\n const bulkApprove = useMutation({\n mutationFn: async (ids: number[]) => {\n let ok = 0;\n for (const id of ids) {\n try {\n await api.approveQueue(id);\n ok++;\n } catch {\n // continue the batch; surface the count at the end\n }\n }\n return { ok, total: ids.length };\n },\n onSuccess: ({ ok, total }) => {\n setSelected(new Set());\n invalidate();\n toast.success(`approved ${ok} of ${total}`);\n },\n });\n const bulkReject = useMutation({\n mutationFn: async (ids: number[]) => {\n let ok = 0;\n for (const id of ids) {\n try {\n await api.rejectQueue(id);\n ok++;\n } catch {\n /* ignore */\n }\n }\n return { ok, total: ids.length };\n },\n onSuccess: ({ ok, total }) => {\n setSelected(new Set());\n invalidate();\n toast.success(`rejected ${ok} of ${total}`);\n },\n });\n // Drain modal submit → navigate to /run/<play>?fromQueue=1&… instead of\n // hitting POST /api/queue/drain. The drain endpoint dropped draft content\n // on the floor (counts only); the /run page streams every draft live with\n // its lint flags so partial batches and lint-blocked sends are visible.\n // Both dryRun and real-send paths route through here — the founder picks\n // mode via the modal toggle and /run honors it via the URL param.\n //\n // accelerator-batch requires senderCohort server-side (run.ts:136); we\n // pre-validate here so an empty value can't sneak through to a 400 on the\n // /run page after the founder already navigated.\n const drainNeedsSenderCohort =\n drainModal?.playName === \"accelerator-batch\" && drainSenderCohort.trim().length === 0;\n const submitDrainViaRun = (): void => {\n if (!drainModal) return;\n if (drainNeedsSenderCohort) return;\n const search: Record<string, string> = {\n fromQueue: \"1\",\n limit: String(drainLimit),\n dryRun: drainDryRun ? \"1\" : \"0\",\n };\n if (drainSenderCohort.trim()) search[\"senderCohort\"] = drainSenderCohort.trim();\n if (drainOffer.trim()) search[\"freeForCohortOffer\"] = drainOffer.trim();\n void navigate({\n to: \"/run/$playName\",\n params: { playName: drainModal.playName },\n search,\n });\n };\n\n const counts = queueQuery.data?.counts ?? {\n pending: 0,\n approved: 0,\n rejected: 0,\n sent: 0,\n expired: 0,\n };\n const rows = queueQuery.data?.rows ?? [];\n\n const playList = Array.from(new Set(rows.map((r) => r.playName))).toSorted();\n\n // Selection derived state — stable across renders even if rows refetch.\n const someSelected = selected.size > 0;\n const allSelected = rows.length > 0 && selected.size === rows.length;\n\n return (\n <div className=\"-mx-6 -my-6 flex flex-col\">\n {/* Masthead */}\n <section className=\"flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6\">\n <div>\n <div className=\"ln-eyebrow\">The Ledger · Queue</div>\n <h1\n className=\"mt-1 text-ink-cream\"\n style={{\n fontFamily: \"var(--font-display)\",\n fontSize: 44,\n fontWeight: 600,\n letterSpacing: \"-0.025em\",\n lineHeight: 0.98,\n }}\n >\n Candidates, for review.\n </h1>\n </div>\n <div className=\"font-mono text-[11px] text-ink-faint\">\n {Object.entries(counts)\n .map(([k, v]) => `${k} ${v}`)\n .join(\" · \")}\n </div>\n </section>\n\n <IcpBanner />\n\n <TriggersCard />\n\n {/* Target Queue — the candidates themselves. A heavier rule + explicit\n section header separates this from the Triggers table above (which\n was reading as a seamless continuation of the same list). Play\n filter lives inline here: it narrows the rows in this table\n specifically, so it belongs next to them, not in the global bar. */}\n <section className=\"border-t-2 border-ink-rule\">\n <div className=\"flex flex-wrap items-center justify-between gap-3 px-6 pb-3 pt-5\">\n <div className=\"flex items-baseline gap-3\">\n <div className=\"ln-eyebrow\">\n Target Queue{\" \"}\n <span className=\"text-ink-faint\">\n · {queueQuery.data ? rows.length : \"…\"} row{rows.length === 1 ? \"\" : \"s\"}\n </span>\n </div>\n </div>\n <div className=\"font-mono text-[11px] text-ink-faint\">refresh · 20s</div>\n </div>\n\n {/* Status + play filters, inline with the table they scope. Status\n is first (it narrows far more rows than play) and the two are\n visually separated by a thin rule for scannability. */}\n <div className=\"flex flex-wrap items-center gap-2 border-b border-ink-rule/60 px-6 pb-3\">\n <span className=\"ln-eyebrow\">status</span>\n {STATUSES.map((s) => (\n <Button\n key={s}\n variant={statusFilter === s ? \"primary\" : \"ghost\"}\n size=\"sm\"\n onClick={() => setStatusFilter(s)}\n >\n {s}\n </Button>\n ))}\n <span className=\"mx-2 h-4 w-px bg-ink-rule\" />\n <span className=\"ln-eyebrow\">play</span>\n <Button\n variant={playFilter === \"all\" ? \"primary\" : \"ghost\"}\n size=\"sm\"\n onClick={() => setPlayFilter(\"all\")}\n >\n all\n </Button>\n {playList.map((p) => (\n <Button\n key={p}\n variant={playFilter === p ? \"primary\" : \"ghost\"}\n size=\"sm\"\n onClick={() => setPlayFilter(p)}\n >\n {p}\n </Button>\n ))}\n </div>\n\n {/* Bulk actions — approve-all + per-play drain. Colocated with the\n table they act on; respects the current play filter so clicking\n \"approve all pending\" while a play is selected scopes down. */}\n <div className=\"flex flex-wrap items-center gap-2 border-b border-ink-rule/60 bg-ink-surface/30 px-6 py-3\">\n <Button\n variant=\"secondary\"\n size=\"sm\"\n disabled={approveAll.isPending || counts.pending === 0}\n onClick={() => approveAll.mutate(playFilter === \"all\" ? undefined : playFilter)}\n >\n <Check size={12} /> approve all pending\n {playFilter !== \"all\" ? ` (${playFilter})` : \"\"}\n </Button>\n {DRAINABLE_PLAYS.map((p) => (\n <Button\n key={p}\n variant=\"ghost\"\n size=\"sm\"\n disabled={\n counts.approved === 0 ||\n (playFilter !== \"all\" && playFilter !== p) ||\n !rows.some((r) => r.playName === p && r.status === \"approved\")\n }\n onClick={() =>\n setDrainModal({\n playName: p,\n approvedCount: rows.filter((r) => r.playName === p && r.status === \"approved\")\n .length,\n })\n }\n >\n <Send size={12} /> drain {p}\n </Button>\n ))}\n </div>\n\n {/* 7-day signal strip — enqueues per day from the rows in memory. */}\n {rows.length > 0 && <SignalStrip rows={rows} />}\n\n {queueQuery.isLoading ? (\n Array.from({ length: 5 }, (_, i) => <SkeletonRow key={i} />)\n ) : rows.length === 0 ? (\n <EmptyQueueHelp filterActive={statusFilter !== \"pending\" || playFilter !== \"all\"} />\n ) : (\n <table className=\"w-full text-[13px]\">\n <thead className=\"sticky top-0 z-10 bg-ink-bg\">\n <tr className=\"border-b border-ink-rule text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n <th className=\"w-6 py-2\" />\n <th className=\"w-6 py-2\">\n <label className=\"inline-flex cursor-pointer items-center\">\n <input\n type=\"checkbox\"\n className=\"h-[13px] w-[13px] rounded-[var(--radius-xs)] border border-ink-rule bg-ink-bg-deep accent-[color:var(--ink-signal)]\"\n checked={allSelected}\n ref={(el) => {\n if (el) el.indeterminate = someSelected && !allSelected;\n }}\n onChange={(e) =>\n setSelected(e.target.checked ? new Set(rows.map((r) => r.id)) : new Set())\n }\n aria-label={allSelected ? \"deselect all\" : \"select all\"}\n />\n </label>\n </th>\n <th className=\"px-6 py-2 text-left font-medium\">id</th>\n <th className=\"py-2 text-left font-medium\">prospect</th>\n <th className=\"py-2 text-left font-medium\">play</th>\n <th className=\"py-2 text-left font-medium\">status</th>\n <th className=\"py-2 text-left font-medium\">source</th>\n <th className=\"py-2 text-right font-medium\">found</th>\n <th className=\"px-6 py-2 text-right font-medium\">actions</th>\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <QueueRow\n key={row.id}\n row={row}\n zebra={i % 2 === 1}\n expanded={expanded === row.id}\n selected={selected.has(row.id)}\n anySelected={someSelected}\n onToggleSelect={() => {\n setSelected((prev) => {\n const next = new Set(prev);\n if (next.has(row.id)) next.delete(row.id);\n else next.add(row.id);\n return next;\n });\n }}\n onToggle={() => setExpanded(expanded === row.id ? null : row.id)}\n onApprove={() => approve.mutate(row.id)}\n onReject={() =>\n setRejectModal({ id: row.id, email: emailFor(row.payload) ?? `#${row.id}` })\n }\n busy={approve.isPending || reject.isPending}\n />\n ))}\n </tbody>\n </table>\n )}\n </section>\n\n {/* Sticky bulk-action bar — only when something is selected */}\n {someSelected && (\n <div className=\"sticky bottom-0 z-20 flex items-center justify-between gap-4 border-b border-t border-ink-rule bg-ink-bg/95 px-6 py-3 backdrop-blur-[2px]\">\n <div className=\"flex items-center gap-3\">\n <span className=\"inline-flex h-6 min-w-[24px] items-center justify-center rounded-full bg-[color:var(--ink-signal)]/20 px-2 font-mono text-[12px] text-[color:var(--ink-signal-2)]\">\n {selected.size}\n </span>\n <span className=\"text-[13px] text-ink-cream-2\">\n {selected.size === 1 ? \"row selected\" : \"rows selected\"}\n </span>\n <button\n type=\"button\"\n onClick={() => setSelected(new Set())}\n className=\"font-mono text-[11px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream hover:decoration-ink-cream-2\"\n >\n clear\n </button>\n </div>\n <div className=\"flex items-center gap-1.5\">\n <Button\n variant=\"secondary\"\n size=\"sm\"\n disabled={bulkApprove.isPending || selected.size === 0}\n onClick={() => bulkApprove.mutate([...selected])}\n >\n <Check size={12} /> approve {selected.size}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={bulkReject.isPending || selected.size === 0}\n onClick={() => bulkReject.mutate([...selected])}\n >\n <X size={12} /> reject {selected.size}\n </Button>\n </div>\n </div>\n )}\n\n <Modal\n open={rejectModal != null}\n onClose={() => setRejectModal(null)}\n title={`Reject #${rejectModal?.id} — ${rejectModal?.email ?? \"\"}`}\n footer={\n <>\n <Button variant=\"ghost\" onClick={() => setRejectModal(null)}>\n Cancel\n </Button>\n <Button\n variant=\"danger\"\n onClick={() =>\n rejectModal &&\n reject.mutate({ id: rejectModal.id, reason: rejectReason || undefined })\n }\n disabled={reject.isPending}\n >\n {reject.isPending ? \"Rejecting…\" : \"Reject\"}\n </Button>\n </>\n }\n >\n <Field label=\"Reason (optional, logged for ICP-filter learning)\">\n <Textarea\n rows={3}\n value={rejectReason}\n onChange={(e) => setRejectReason(e.target.value)}\n placeholder=\"e.g. wrong stage, wrong industry, already a customer\"\n />\n </Field>\n </Modal>\n\n <Modal\n open={drainModal != null}\n onClose={() => setDrainModal(null)}\n title={`Drain ${drainModal?.playName ?? \"\"} (${drainModal?.approvedCount ?? 0} approved)`}\n footer={\n <>\n <Button variant=\"ghost\" onClick={() => setDrainModal(null)}>\n Cancel\n </Button>\n <Button onClick={submitDrainViaRun} disabled={drainNeedsSenderCohort}>\n <Send size={12} />\n {drainDryRun ? \"Preview drafts (no send)\" : `Send up to ${drainLimit}`}\n </Button>\n </>\n }\n >\n <div className=\"flex flex-col gap-3\">\n <Field label=\"Limit\">\n <Input\n type=\"number\"\n min={1}\n value={drainLimit}\n onChange={(e) => setDrainLimit(Math.max(1, Number.parseInt(e.target.value, 10) || 1))}\n />\n </Field>\n {drainModal?.playName === \"accelerator-batch\" && (\n <>\n <Field\n label=\"Sender cohort (required)\"\n hint=\"Your accelerator/cohort tag, e.g. yc-w23\"\n >\n <Input\n value={drainSenderCohort}\n onChange={(e) => setDrainSenderCohort(e.target.value)}\n placeholder=\"yc-w23\"\n required\n />\n </Field>\n <Field label=\"Free-for-cohort offer (optional)\">\n <Input\n value={drainOffer}\n onChange={(e) => setDrainOffer(e.target.value)}\n placeholder=\"Free for current YC W26 through demo day, just reply with your batch.\"\n />\n </Field>\n </>\n )}\n <label className=\"inline-flex cursor-pointer items-center gap-2.5 text-[13px] text-ink-cream-2 hover:text-ink-cream\">\n <Toggle checked={drainDryRun} onChange={setDrainDryRun} label=\"dry run\" />\n <span>Dry run — preview drafts only, no send (a one-time enrich lookup may apply)</span>\n </label>\n <p className=\"font-mono text-[11px] text-ink-faint\">\n Drafts stream live on the next page — every lint flag and send confirmation is visible\n per row.\n </p>\n {drainNeedsSenderCohort && (\n <p className=\"font-mono text-[11px] text-[color:var(--ink-blocked-2)]\">\n accelerator-batch needs a sender cohort tag before it can run.\n </p>\n )}\n </div>\n </Modal>\n </div>\n );\n}\n\nfunction QueueRow({\n row,\n zebra,\n expanded,\n selected,\n anySelected,\n onToggleSelect,\n onToggle,\n onApprove,\n onReject,\n busy,\n}: {\n row: QueueRowView;\n zebra: boolean;\n expanded: boolean;\n selected: boolean;\n anySelected: boolean;\n onToggleSelect: () => void;\n onToggle: () => void;\n onApprove: () => void;\n onReject: () => void;\n busy: boolean;\n}) {\n const email = emailFor(row.payload);\n const name = nameFor(row.payload);\n const company = companyFor(row.payload);\n const linkedinUrl = linkedinUrlFor(row.payload);\n const phone = phoneFor(row.payload);\n return (\n <>\n <tr\n className={cn(\n \"group cursor-pointer border-b border-ink-rule/60\",\n \"transition-colors duration-[var(--dur-stamp)]\",\n \"hover:bg-ink-surface/60\",\n zebra && \"bg-ink-surface/20\",\n selected && \"bg-[color:var(--ink-signal)]/8\",\n )}\n onClick={onToggle}\n >\n <td className=\"w-6 py-2 pl-4 pr-0 text-ink-faint\">\n {expanded ? <ChevronDown size={12} /> : <ChevronRight size={12} />}\n </td>\n <td className=\"w-6 py-2\" onClick={(e) => e.stopPropagation()}>\n <label className=\"inline-flex cursor-pointer items-center\">\n <input\n type=\"checkbox\"\n className={cn(\n \"h-[13px] w-[13px] rounded-[var(--radius-xs)]\",\n \"border border-ink-rule bg-ink-bg-deep accent-[color:var(--ink-signal)]\",\n // Hide until the row is hovered OR any other row is selected —\n // so the default look stays clean, but once you start selecting\n // the checkboxes stay visible for rapid batch picking.\n \"transition-opacity duration-[var(--dur-stamp)]\",\n selected || anySelected\n ? \"opacity-100\"\n : \"opacity-0 group-hover:opacity-100 focus:opacity-100\",\n )}\n checked={selected}\n onChange={onToggleSelect}\n aria-label={selected ? `deselect #${row.id}` : `select #${row.id}`}\n />\n </label>\n </td>\n <td className=\"px-6 py-2 font-mono text-[11px] text-ink-faint\">#{row.id}</td>\n <td className=\"py-2\">\n <div className=\"text-ink-cream\">{name ?? \"(unknown)\"}</div>\n <div className=\"font-mono text-[11px] text-ink-faint\">\n {email ?? \"—\"}\n {company ? ` · ${company}` : \"\"}\n {linkedinUrl ? (\n <a\n href={linkedinUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"ml-1 text-ink-cream-2 underline decoration-ink-rule underline-offset-2 hover:text-ink-cream hover:decoration-ink-cream-2\"\n onClick={(e) => e.stopPropagation()}\n >\n [in]\n </a>\n ) : null}\n {phone ? <span className=\"ml-1 text-ink-faint\">· {phone}</span> : null}\n </div>\n </td>\n <td className=\"py-2 text-ink-cream-2\">{row.playName}</td>\n <td className=\"py-2\">\n <div className=\"flex items-center gap-1.5\">\n <Badge tone={statusTone(row.status)}>{row.status}</Badge>\n {row.lastDraft && (\n <Badge\n tone={\n row.lastDraft.sent\n ? \"receipt\"\n : row.lastDraft.flags.length > 0\n ? \"blocked\"\n : \"neutral\"\n }\n title={\n row.lastDraft.sent\n ? \"draft sent\"\n : row.lastDraft.flags.length > 0\n ? `draft held · ${row.lastDraft.flags.length} flag(s)`\n : \"draft preview\"\n }\n >\n draft\n </Badge>\n )}\n </div>\n </td>\n <td className=\"py-2 font-mono text-[11px] text-ink-faint\">{row.source}</td>\n <td className=\"py-2 text-right font-mono text-[12px] text-ink-muted\">\n {timeAgo(row.foundAt)}\n </td>\n <td className=\"px-6 py-2 text-right\" onClick={(e) => e.stopPropagation()}>\n <div className=\"flex items-center justify-end gap-1\">\n {row.status === \"pending\" && (\n <>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n title=\"approve\"\n disabled={busy}\n onClick={onApprove}\n >\n <Check size={12} />\n </Button>\n <Button variant=\"ghost\" size=\"sm\" title=\"reject\" disabled={busy} onClick={onReject}>\n <X size={12} />\n </Button>\n </>\n )}\n </div>\n </td>\n </tr>\n {expanded && (\n <tr className=\"border-b border-ink-rule/60 bg-ink-bg-deep/50\">\n <td colSpan={9} className=\"px-6 py-3\">\n <div className=\"flex flex-col gap-3 text-[12px] text-ink-muted\">\n {row.notes ? <div className=\"ln-note\">{row.notes}</div> : null}\n <DraftSection\n id={row.id}\n playName={row.playName}\n status={row.status}\n draft={row.lastDraft}\n draftedAt={row.lastDraftedAt}\n />\n <details className=\"text-ink-faint\">\n <summary className=\"cursor-pointer font-mono text-[10px] uppercase tracking-[0.14em] hover:text-ink-cream-2\">\n payload json\n </summary>\n <pre className=\"mt-2 max-h-[300px] overflow-auto rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep p-3 font-mono text-[11.5px] leading-[1.55] text-ink-cream-2\">\n {JSON.stringify(row.payload, null, 2)}\n </pre>\n </details>\n </div>\n </td>\n </tr>\n )}\n </>\n );\n}\n\n/**\n * Expanded-row draft area. Shows the persisted draft (subject + body + lint\n * flags + send state + receipt links) when one exists, with a regenerate\n * action; when none exists yet, shows a thin \"no draft\" bar with a generate\n * action. Both actions hit the same preview-only endpoint (dry-run, never\n * sends). Hidden for accelerator-batch (needs a sender cohort not on the row)\n * and for already-sent drafts (re-rolling would only overwrite the preview).\n */\nfunction DraftSection({\n id,\n playName,\n status,\n draft,\n draftedAt,\n}: {\n id: number;\n playName: string;\n status: QueueStatusView;\n draft: QueueRowView[\"lastDraft\"];\n draftedAt: string | null;\n}): React.ReactElement {\n const qc = useQueryClient();\n const regenerate = useMutation({\n mutationFn: () => api.regenerateDraft(id),\n onSuccess: () => {\n void qc.invalidateQueries({ queryKey: [\"queue\"] });\n toast.success(\"draft ready · preview only, not sent\");\n },\n onError: (err) => toast.error(`couldn't draft · ${err.message}`),\n });\n const send = useMutation({\n mutationFn: () => api.sendDraft(id),\n onSuccess: () => {\n void qc.invalidateQueries({ queryKey: [\"queue\"] });\n void qc.invalidateQueries({ queryKey: [\"home\"] });\n toast.success(\"sent · the reviewed draft went out as-is\");\n },\n onError: (err) => toast.error(`couldn't send · ${err.message}`),\n });\n const canDraft = playName !== \"accelerator-batch\" && !(draft?.sent ?? false);\n const verb = draft ? \"regenerate\" : \"generate draft\";\n const pendingVerb = draft ? \"regenerating…\" : \"generating…\";\n const draftButton = canDraft ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={regenerate.isPending}\n onClick={() => regenerate.mutate()}\n title=\"Draft this row in preview mode — dry-run, never sends\"\n >\n {regenerate.isPending ? (\n <Loader2 size={11} className=\"animate-spin\" />\n ) : (\n <RotateCw size={11} />\n )}\n {regenerate.isPending ? pendingVerb : verb}\n </Button>\n ) : null;\n\n // Send THIS prospect now, using the reviewed draft VERBATIM (no LLM re-roll).\n // Enabled only for an approved row with a clean (lint-flag-free), not-yet-sent\n // draft — that's the review gate: regenerate until clean, then send exactly\n // that. Disabled (with a hint) when there's no draft or it's flagged.\n const cleanDraft = draft != null && draft.flags.length === 0 && !draft.sent;\n const sendButton =\n status === \"approved\" && !(draft?.sent ?? false) ? (\n <Button\n variant=\"secondary\"\n size=\"sm\"\n disabled={send.isPending || !cleanDraft}\n onClick={() => send.mutate()}\n title={\n cleanDraft\n ? \"Send this prospect now — sends the reviewed draft above, as-is\"\n : draft == null\n ? \"Generate a draft first, then send it\"\n : \"Draft has lint flags — regenerate to clear them, then send\"\n }\n >\n {send.isPending ? (\n <Loader2 size={11} className=\"animate-spin\" />\n ) : (\n <Send size={11} />\n )}\n {send.isPending ? \"sending…\" : \"send this one\"}\n </Button>\n ) : null;\n\n if (!draft) {\n return (\n <div className=\"flex items-center justify-between gap-2 rounded-[var(--radius-sm)] border border-dashed border-ink-rule bg-ink-bg-deep px-3 py-2.5\">\n <span className=\"font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n no draft yet\n </span>\n <span className=\"flex items-center gap-2\">\n {sendButton}\n {draftButton}\n </span>\n </div>\n );\n }\n\n const tone: \"receipt\" | \"spend\" | \"blocked\" | \"neutral\" = draft.sent\n ? \"receipt\"\n : draft.flags.length > 0\n ? \"blocked\"\n : draft.dryRun\n ? \"spend\"\n : \"neutral\";\n const stateLabel = draft.sent\n ? \"sent\"\n : draft.flags.length > 0\n ? \"held · lint\"\n : draft.dryRun\n ? \"preview\"\n : \"drafted\";\n return (\n <div className=\"rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep\">\n <div className=\"flex items-center gap-2 border-b border-ink-rule/60 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n <span>last draft</span>\n {draftedAt ? <span className=\"text-ink-muted\">· {timeAgo(draftedAt)}</span> : null}\n <Badge tone={tone}>{stateLabel}</Badge>\n {draft.flags.length > 0 &&\n draft.flags.map((f) => (\n <Badge key={f} tone=\"blocked\">\n {f}\n </Badge>\n ))}\n <span className=\"ml-auto flex items-center gap-2 normal-case tracking-normal\">\n {draft.receiptIds.map((rid) => (\n <Link\n key={rid}\n to=\"/receipts\"\n className=\"font-mono text-[10px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream-2\"\n >\n receipt #{rid}\n </Link>\n ))}\n {sendButton}\n {draftButton}\n </span>\n </div>\n <div className=\"px-3 py-2.5\">\n <div className=\"text-[13px] font-medium text-ink-cream\">{draft.subject}</div>\n <pre className=\"mt-2 max-h-[360px] overflow-auto whitespace-pre-wrap font-mono text-[11.5px] leading-[1.55] text-ink-cream-2\">\n {draft.body}\n </pre>\n </div>\n </div>\n );\n}\n\n/**\n * 7-day signal strip — renders a tight row of daily-enqueue bars computed\n * client-side from `rows`. It's an approximate readout (limited to the\n * rows currently in memory) but gives a quick visual pulse without any\n * new API.\n */\nfunction SignalStrip({ rows }: { rows: QueueRowView[] }) {\n const days = buildSignalDays(rows);\n const max = Math.max(1, ...days.map((d) => d.count));\n const total = days.reduce((a, d) => a + d.count, 0);\n\n return (\n <div className=\"flex items-center gap-4 border-b border-ink-rule/60 bg-ink-bg-deep/40 px-6 py-2.5\">\n <div className=\"ln-eyebrow\" style={{ fontSize: 10 }}>\n last 7d\n </div>\n <div className=\"flex items-end gap-1\" aria-hidden=\"true\">\n {days.map((d) => {\n const h = Math.round((d.count / max) * 20);\n return (\n <span\n key={d.label}\n title={`${d.label} · ${d.count} enqueued`}\n className={cn(\n \"w-[10px] rounded-[1px]\",\n d.count === 0 ? \"bg-ink-rule\" : \"bg-[color:var(--ink-signal)]/70\",\n )}\n style={{ height: Math.max(2, h) }}\n />\n );\n })}\n </div>\n <div className=\"font-mono text-[11px] text-ink-muted\">\n {total} enqueued\n <span className=\"ml-2 text-ink-faint\">\n · <span className=\"text-ink-cream-2\">{days[days.length - 1]?.count ?? 0}</span> today\n </span>\n </div>\n </div>\n );\n}\n\nfunction TriggersCard() {\n const qc = useQueryClient();\n const triggersQuery = useQuery({\n queryKey: [\"triggers\"],\n queryFn: () => api.triggers(),\n // Poll 5s while anything is running (local marker OR server `running`), 30s otherwise.\n refetchInterval: (query) => {\n if (hasAnyRunningTrigger()) return 5_000;\n const data = query.state.data;\n if (data?.triggers.some((t) => t.running)) return 5_000;\n return 30_000;\n },\n });\n const setEnabled = useMutation({\n mutationFn: (vars: { name: string; enabled: boolean }) =>\n api.setTriggerEnabled(vars.name, vars.enabled),\n onSuccess: () => void qc.invalidateQueries({ queryKey: [\"triggers\"] }),\n onError: (err) => toast.error(err.message),\n });\n const setConfig = useMutation({\n mutationFn: (vars: { name: string; config: unknown }) =>\n api.setTriggerConfig(vars.name, vars.config),\n onSuccess: () => {\n setEditing(null);\n void qc.invalidateQueries({ queryKey: [\"triggers\"] });\n },\n onError: (err) => toast.error(err.message),\n });\n const runTrigger = useMutation({\n mutationFn: (name: string) => {\n markTriggerRunning(name);\n return api.runTrigger(name);\n },\n onSuccess: (data, name) => {\n void qc.invalidateQueries({ queryKey: [\"triggers\"] });\n if (data.pending) {\n toast.success(`${name} · started`, {\n description: \"polling for results\",\n });\n return;\n }\n clearTriggerRunning(name);\n void qc.invalidateQueries({ queryKey: [\"queue\"] });\n void qc.invalidateQueries({ queryKey: [\"home\"] });\n if (data.error) {\n toast.error(`${name} · ${data.error}`);\n return;\n }\n const r = data.result;\n if (!r) {\n toast.success(`${name} · ran`);\n return;\n }\n const parts = [\n `${r.candidates} candidates`,\n `${r.enqueued} kept`,\n r.droppedIcp ? `${r.droppedIcp} icp-drop` : null,\n r.droppedDuplicate ? `${r.droppedDuplicate} dup` : null,\n r.droppedEnrichment ? `${r.droppedEnrichment} enrich-fail` : null,\n `$${r.costUsd.toFixed(2)}`,\n r.halted ? `halted: ${r.halted}` : null,\n ].filter(Boolean);\n toast.success(`${name} · ${parts.join(\" · \")}`);\n },\n onError: (err, name) => {\n // 409 = server already running it — keep the local marker so the\n // spinner stays lit until the authoritative `running` flag clears.\n if (err.message.includes(\"already running\")) {\n void qc.invalidateQueries({ queryKey: [\"triggers\"] });\n toast.info(`${name} · already running`);\n return;\n }\n clearTriggerRunning(name);\n toast.error(`${name} · ${err.message}`);\n },\n });\n\n const [editing, setEditing] = useState<EditingState | null>(null);\n const [editError, setEditError] = useState<string | null>(null);\n\n const triggers = triggersQuery.data?.triggers ?? [];\n\n // Invalidate queue/home the moment any trigger's `running` flips true → false.\n const runningKey = triggers\n .filter((t) => t.running)\n .map((t) => t.name)\n .toSorted()\n .join(\",\");\n const prevRunningRef = useRef<string>(\"\");\n useEffect(() => {\n const prev = prevRunningRef.current;\n prevRunningRef.current = runningKey;\n const prevNames = prev ? prev.split(\",\") : [];\n const nowNames = runningKey ? runningKey.split(\",\") : [];\n const stillRunning = new Set(nowNames);\n if (prevNames.some((n) => !stillRunning.has(n))) {\n void qc.invalidateQueries({ queryKey: [\"queue\"] });\n void qc.invalidateQueries({ queryKey: [\"home\"] });\n }\n }, [runningKey, qc]);\n\n const lastPolledByName = new Map<string, string | null>(\n triggers.map((t) => [t.name, t.lastPolledAt]),\n );\n const serverRunningSinceByName = new Map<string, string | null>(\n triggers.map((t) => [t.name, t.runningSince]),\n );\n const runningByName = useRunningTriggers(\n triggers.map((t) => t.name),\n lastPolledByName,\n serverRunningSinceByName,\n );\n\n return (\n <>\n <section className=\"border-b border-ink-rule\">\n <div className=\"flex items-baseline justify-between px-6 pb-2 pt-5\">\n <div className=\"ln-eyebrow\">\n Triggers <span className=\"text-ink-faint\">· {triggers.length}</span>\n </div>\n <div className=\"font-mono text-[11px] text-ink-faint\">refresh · 30s</div>\n </div>\n {triggersQuery.isLoading ? (\n Array.from({ length: 3 }, (_, i) => <SkeletonRow key={i} />)\n ) : triggers.length === 0 ? (\n <div className=\"px-6 pb-6\">\n <EmptyNote\n note=\"No triggers stored yet. Enable one below and it bootstraps itself on the next watch tick — or run the watch loop once to initialise.\"\n cli=\"oneshot-gtm find watch --once\"\n />\n </div>\n ) : (\n <table className=\"w-full text-[13px]\">\n <thead>\n <tr className=\"border-b border-ink-rule/60 text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n <th className=\"px-6 py-2 text-left font-medium\">name</th>\n <th className=\"py-2 text-left font-medium\">enabled</th>\n <th className=\"py-2 text-left font-medium\">interval</th>\n <th className=\"py-2 text-left font-medium\">last polled</th>\n <th className=\"py-2 text-left font-medium\">last run</th>\n <th className=\"px-6 py-2 text-right font-medium\">actions</th>\n </tr>\n </thead>\n <tbody>\n {triggers.map((t, i) => {\n const summary = summarizeRun(t.lastRunSummary);\n // `inProcess` covers the sub-millisecond window before the 202 lands;\n // `tracked` takes over via localStorage + server `runningSince`.\n const inProcess = runTrigger.isPending && runTrigger.variables === t.name;\n const tracked = runningByName.get(t.name);\n const running = inProcess || tracked != null;\n const elapsedMs = tracked?.elapsedMs ?? null;\n const isEditing = editing?.name === t.name;\n return (\n <TriggerRowFragment\n key={t.name}\n trigger={t}\n zebra={i % 2 === 1}\n running={running}\n elapsedMs={elapsedMs}\n summary={summary}\n isEditing={Boolean(isEditing)}\n editing={isEditing ? editing : null}\n editError={isEditing ? editError : null}\n onToggleEnabled={(next) => setEnabled.mutate({ name: t.name, enabled: next })}\n onRun={() => runTrigger.mutate(t.name)}\n onStartEdit={() => {\n setEditing({\n name: t.name,\n text: JSON.stringify(t.config ?? {}, null, 2),\n defaultConfig: t.defaultConfig,\n });\n setEditError(null);\n }}\n onCancelEdit={() => {\n setEditing(null);\n setEditError(null);\n }}\n onChangeEditText={(text) =>\n setEditing((prev) => (prev ? { ...prev, text } : prev))\n }\n onResetDefaults={() =>\n setEditing((prev) =>\n prev\n ? {\n ...prev,\n text: JSON.stringify(prev.defaultConfig ?? {}, null, 2),\n }\n : prev,\n )\n }\n onSaveEdit={() => {\n if (!editing) return;\n let parsed: unknown;\n try {\n parsed = JSON.parse(editing.text);\n } catch (err) {\n setEditError(`invalid JSON: ${(err as Error).message}`);\n return;\n }\n if (!parsed || typeof parsed !== \"object\") {\n setEditError(\"config must be a JSON object\");\n return;\n }\n setEditError(null);\n setConfig.mutate({ name: editing.name, config: parsed });\n }}\n setEnabledPending={setEnabled.isPending}\n setConfigPending={setConfig.isPending}\n />\n );\n })}\n </tbody>\n </table>\n )}\n </section>\n </>\n );\n}\n\ninterface TriggerRowProps {\n trigger: TriggerView;\n zebra: boolean;\n running: boolean;\n /** ms elapsed since the cross-refresh start; null when only in-process. */\n elapsedMs: number | null;\n summary: string;\n isEditing: boolean;\n editing: EditingState | null;\n editError: string | null;\n onToggleEnabled: (next: boolean) => void;\n onRun: () => void;\n onStartEdit: () => void;\n onCancelEdit: () => void;\n onChangeEditText: (text: string) => void;\n onResetDefaults: () => void;\n onSaveEdit: () => void;\n setEnabledPending: boolean;\n setConfigPending: boolean;\n}\n\nfunction TriggerRowFragment(props: TriggerRowProps) {\n const t = props.trigger;\n // Missing `ready` field = treat as ready (tolerate older servers).\n const notReady = t.ready === false;\n const notReadyReason = t.notReadyReason ?? \"missing required config\";\n // Block enabling an unready trigger but still allow disabling.\n const toggleDisabled = props.setEnabledPending || (notReady && !t.enabled);\n const runDisabled = props.running || notReady;\n return (\n <>\n <tr\n className={cn(\n \"group relative border-b border-ink-rule/60\",\n \"transition-colors duration-[var(--dur-stamp)]\",\n props.zebra && \"bg-ink-surface/20\",\n !t.enabled && \"opacity-65\",\n \"hover:bg-ink-surface/50\",\n props.isEditing && \"bg-ink-surface/50\",\n props.running && \"bg-[color:var(--ink-signal)]/[0.08]\",\n )}\n >\n <td className=\"relative px-6 py-2 font-mono text-[12px]\">\n {props.running ? (\n <span\n aria-hidden=\"true\"\n className=\"absolute inset-y-0 left-0 w-[2px] bg-[color:var(--ink-signal)] animate-pulse\"\n />\n ) : (\n t.enabled && (\n <span\n aria-hidden=\"true\"\n className=\"absolute inset-y-0 left-0 w-[2px] bg-[color:var(--ink-signal)]/60\"\n />\n )\n )}\n <span className={t.enabled ? \"text-ink-cream\" : \"text-ink-muted\"}>{t.name}</span>\n </td>\n <td\n className=\"py-2\"\n title={notReady && !t.enabled ? `not ready · ${notReadyReason}` : undefined}\n >\n <Toggle\n checked={t.enabled}\n disabled={toggleDisabled}\n label={`${t.enabled ? \"disable\" : \"enable\"} ${t.name}`}\n onChange={props.onToggleEnabled}\n />\n </td>\n <td className=\"py-2 font-mono text-[12px] text-ink-muted\">\n {humanInterval(t.intervalMs)}\n {t.intervalMs !== t.defaultIntervalMs && (\n <span className=\"ml-1 text-ink-faint\">\n · default {humanInterval(t.defaultIntervalMs)}\n </span>\n )}\n </td>\n <td className=\"py-2 font-mono text-[12px] text-ink-muted\">\n {t.lastPolledAt ? timeAgo(t.lastPolledAt) : \"never\"}\n </td>\n <td\n className={cn(\n \"py-2 font-mono text-[11.5px]\",\n notReady ? \"text-[color:var(--ink-blocked-2)]\" : \"text-ink-muted\",\n )}\n >\n {notReady ? `not ready · ${notReadyReason}` : props.summary}\n </td>\n <td className=\"px-6 py-2 text-right\">\n <div className=\"flex items-center justify-end gap-1\">\n <Button\n variant={props.running ? \"accent\" : \"ghost\"}\n size=\"sm\"\n // `aria-disabled` (not `disabled`) so accent colors stay vivid;\n // clicks are gated by the `onClick` guard + pointer-events-none.\n aria-disabled={runDisabled || undefined}\n onClick={runDisabled ? undefined : props.onRun}\n className={cn(runDisabled && \"cursor-not-allowed pointer-events-none\")}\n title={\n props.running\n ? `Running for ${props.elapsedMs != null ? humanDuration(props.elapsedMs) : \"a moment\"} — click won't re-fire`\n : notReady\n ? `not ready · ${notReadyReason}`\n : \"Run this finder now — ignores schedule, spends OneShot $\"\n }\n >\n {props.running ? (\n <Loader2 size={12} className=\"animate-spin\" aria-hidden=\"true\" />\n ) : (\n <Play size={12} aria-hidden=\"true\" />\n )}\n {props.running\n ? props.elapsedMs != null\n ? `running · ${humanDuration(props.elapsedMs)}`\n : \"running…\"\n : \"run now\"}\n </Button>\n <Button\n variant={props.isEditing ? \"secondary\" : \"ghost\"}\n size=\"sm\"\n title={props.isEditing ? \"close config\" : \"edit config\"}\n aria-label={`${props.isEditing ? \"close\" : \"edit\"} ${t.name} config`}\n onClick={props.isEditing ? props.onCancelEdit : props.onStartEdit}\n >\n <Pencil size={12} />\n </Button>\n </div>\n </td>\n </tr>\n {props.isEditing && props.editing && (\n <tr className=\"border-b border-ink-rule/60 bg-ink-bg-deep/60\">\n <td colSpan={6} className=\"px-6 py-4\">\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-baseline justify-between gap-3\">\n <div className=\"ln-eyebrow\">\n config ·{\" \"}\n <span className=\"text-ink-cream-2 normal-case font-mono tracking-normal\">\n {t.name}\n </span>\n </div>\n <div className=\"ln-note text-[12px] text-ink-cream-2\">\n add{\" \"}\n <code className=\"ln-mono text-[11.5px] text-[color:var(--ink-signal-2)]\">\n \"intervalMs\"\n </code>{\" \"}\n to override the watch cadence · min 60000\n </div>\n </div>\n <Textarea\n rows={8}\n value={props.editing.text}\n onChange={(e) => props.onChangeEditText(e.target.value)}\n className=\"font-mono text-[12px]\"\n spellCheck={false}\n />\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"font-mono text-[11.5px] text-[color:var(--ink-blocked-2)]\">\n {props.editError ?? \"\"}\n </div>\n <div className=\"flex items-center gap-1.5\">\n {props.editing.defaultConfig && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={props.onResetDefaults}\n disabled={props.setConfigPending}\n title=\"Replace the textarea with the registry default config\"\n >\n reset\n </Button>\n )}\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={props.onCancelEdit}\n disabled={props.setConfigPending}\n >\n cancel\n </Button>\n <Button\n variant=\"primary\"\n size=\"sm\"\n onClick={props.onSaveEdit}\n disabled={props.setConfigPending}\n >\n {props.setConfigPending ? \"saving…\" : \"save\"}\n </Button>\n </div>\n </div>\n </div>\n </td>\n </tr>\n )}\n </>\n );\n}\n\nfunction IcpBanner() {\n const setupQuery = useQuery({ queryKey: [\"setup\"], queryFn: () => api.setupStatus() });\n const icp = setupQuery.data?.cfg.icpOneLiner ?? null;\n if (setupQuery.isLoading) return null;\n\n if (!icp || icp.trim().length === 0) {\n return (\n <section className=\"flex items-start gap-3 border-b border-ink-rule bg-[color:var(--ink-spend)]/6 px-6 py-4\">\n <Target size={14} className=\"mt-[3px] shrink-0 text-[color:var(--ink-spend-2)]\" />\n <div className=\"flex-1\">\n <div className=\"ln-eyebrow\" style={{ color: \"var(--ink-spend-2)\" }}>\n Set your ICP first\n </div>\n <div className=\"ln-note mt-0.5 text-[13px] text-ink-cream-2\">\n The find layer needs a free-text ICP one-liner to filter candidates. Without it, every\n result passes through and you'll review more noise than signal.\n </div>\n </div>\n <Link to=\"/setup\">\n <Button size=\"sm\">Open setup</Button>\n </Link>\n </section>\n );\n }\n\n return (\n <section className=\"flex items-start gap-3 border-b border-ink-rule px-6 py-3\">\n <Target size={14} className=\"mt-[3px] shrink-0 text-[color:var(--ink-receipt-2)]\" />\n <div className=\"flex-1 min-w-0\">\n <div className=\"ln-eyebrow\">ICP</div>\n <div className=\"mt-0.5 truncate text-[13px] text-ink-cream-2\">{icp}</div>\n </div>\n <Link to=\"/setup\">\n <Button variant=\"ghost\" size=\"sm\">\n edit\n </Button>\n </Link>\n </section>\n );\n}\n\nfunction EmptyQueueHelp({ filterActive }: { filterActive: boolean }) {\n if (filterActive) {\n return (\n <div className=\"p-5\">\n <EmptyNote note=\"No queue rows match this filter. Try a different status or play above to see other rows.\" />\n </div>\n );\n }\n return (\n <div className=\"p-5\">\n <EmptyNote\n note=\"No targets yet. Pick a finder from the Triggers panel and run it — candidates land here for review before any send.\"\n cli=\"oneshot-gtm find watch\"\n />\n </div>\n );\n}\n\nfunction emailFor(payload: unknown): string | null {\n if (!payload || typeof payload !== \"object\") return null;\n const p = payload as Record<string, unknown>;\n if (typeof p[\"email\"] === \"string\") return p[\"email\"] as string;\n if (typeof p[\"founderEmail\"] === \"string\") return p[\"founderEmail\"] as string;\n return null;\n}\n\nfunction nameFor(payload: unknown): string | null {\n if (!payload || typeof payload !== \"object\") return null;\n const p = payload as Record<string, unknown>;\n if (typeof p[\"name\"] === \"string\") return p[\"name\"] as string;\n if (typeof p[\"founderName\"] === \"string\") return p[\"founderName\"] as string;\n // Pre-enrichment rejected rows only carry a source URL — derive a handle.\n const repoUrl = typeof p[\"repoUrl\"] === \"string\" ? (p[\"repoUrl\"] as string) : null;\n if (repoUrl) {\n const m = repoUrl.match(/github\\.com\\/([^/]+)\\/([^/?#]+)/);\n if (m) return `${m[1]}/${m[2]}`;\n }\n const postUrl = typeof p[\"postUrl\"] === \"string\" ? (p[\"postUrl\"] as string) : null;\n if (postUrl) {\n try {\n const host = new URL(postUrl).hostname.replace(/^www\\./, \"\");\n if (host) return host;\n } catch {\n // fall through\n }\n }\n return null;\n}\n\nfunction companyFor(payload: unknown): string | null {\n if (!payload || typeof payload !== \"object\") return null;\n const p = payload as Record<string, unknown>;\n if (typeof p[\"company\"] === \"string\") return p[\"company\"] as string;\n return null;\n}\n\nfunction linkedinUrlFor(payload: unknown): string | null {\n if (!payload || typeof payload !== \"object\") return null;\n const p = payload as Record<string, unknown>;\n const v = p[\"linkedinUrl\"];\n if (typeof v !== \"string\" || v.length === 0) return null;\n // Defense in depth — payload comes from sqlite but a stale/garbage row should\n // never render as a clickable javascript:// or data:// link.\n return /^https?:\\/\\/(?:[a-z0-9-]+\\.)*linkedin\\.com\\/in\\//i.test(v) ? v : null;\n}\n\nfunction phoneFor(payload: unknown): string | null {\n if (!payload || typeof payload !== \"object\") return null;\n const p = payload as Record<string, unknown>;\n const v = p[\"phone\"];\n if (typeof v === \"string\" && v.length > 0) return v;\n return null;\n}\n"],"x_google_ignoreList":[0,1,2,3],"mappings":"4jBAmBA,IAAM,EAAS,EAAiB,SAAUA,CATxC,CACE,OACA,CACE,EAAG,mIACH,IAAK,SACN,CACF,CACD,CAAC,OAAQ,CAAE,EAAG,YAAa,IAAK,SAAU,CAAC,CAEHA,CAAW,CCN/C,EAAW,EAAiB,YAAaC,CAH7C,CAAC,OAAQ,CAAE,EAAG,oDAAqD,IAAK,SAAU,CAAC,CACnF,CAAC,OAAQ,CAAE,EAAG,aAAc,IAAK,SAAU,CAAC,CAECA,CAAW,CCMpD,EAAO,EAAiB,OAAQC,CATpC,CACE,OACA,CACE,EAAG,kIACH,IAAK,SACN,CACF,CACD,CAAC,OAAQ,CAAE,EAAG,6BAA8B,IAAK,SAAU,CAAC,CAExBA,CAAW,CCL3C,EAAS,EAAiB,SAAU,CAJxC,CAAC,SAAU,CAAE,GAAI,KAAM,GAAI,KAAM,EAAG,KAAM,IAAK,SAAU,CAAC,CAC1D,CAAC,SAAU,CAAE,GAAI,KAAM,GAAI,KAAM,EAAG,IAA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js";import{t as l}from"./Modal-frAt7msr.js";import{n as u,t as d}from"./Skeleton-d2p06ghN.js";var f=t(r()),p=e(),m=new Set([`web.search`]);function h(){let[e,t]=(0,f.useState)(null),n=s({queryKey:[`receipts`,`list`],queryFn:()=>a.receipts({limit:200}),refetchInterval:2e4}),r=s({queryKey:[`receipts`,`detail`,e],queryFn:()=>e==null?Promise.resolve(null):a.receipt(e),enabled:e!=null}),i=(0,f.useMemo)(()=>_(n.data?.receipts??[]),[n.data]),m=(0,f.useMemo)(()=>(n.data?.receipts??[]).reduce((e,t)=>e+(t.costUsd??0),0),[n.data]);return(0,p.jsxs)(`div`,{className:`-mx-6 -my-6 flex flex-col`,children:[(0,p.jsxs)(`section`,{className:`flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`ln-eyebrow`,children:`The Ledger · Receipts`}),(0,p.jsx)(`h1`,{className:`mt-1 text-ink-cream`,style:{fontFamily:`var(--font-display)`,fontSize:44,fontWeight:600,letterSpacing:`-0.025em`,lineHeight:.98},children:`Signed, most recent first.`})]}),(0,p.jsx)(`div`,{className:`text-right font-mono text-[11px] text-ink-faint`,children:n.data?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`span`,{className:`text-ink-cream-2`,children:n.data.receipts.length}),` `,(0,p.jsx)(`span`,{className:`text-ink-muted`,children:`shown`})]}),(0,p.jsxs)(`div`,{className:`mt-0.5`,children:[(0,p.jsx)(`span`,{className:`text-[color:var(--ink-spend-2)]`,children:o(m)}),` `,(0,p.jsx)(`span`,{className:`text-ink-muted`,children:`total`})]})]}):(0,p.jsx)(d,{lines:2,widths:[`96px`,`64px`]})})]}),(0,p.jsx)(`section`,{children:n.isLoading?(0,p.jsx)(`div`,{children:Array.from({length:8},(e,t)=>(0,p.jsx)(u,{},t))}):n.data?.receipts.length===0?(0,p.jsx)(`div`,{className:`px-6 py-8`,children:(0,p.jsx)(c,{note:`No receipts yet. Every call the agent makes leaves one; one always beats zero.`,cli:`oneshot-gtm motion show-hn`})}):(0,p.jsx)(`div`,{children:i.map(e=>(0,p.jsx)(g,{group:e,onClickRow:e=>t(e)},e.key))})}),(0,p.jsx)(l,{open:e!=null,title:r.data?.receipt.playName??`receipt`,subtitle:r.data?`#${e} · ${r.data.receipt.callType}`:`#${e}`,onClose:()=>t(null),width:720,children:r.isLoading?(0,p.jsx)(d,{lines:8}):(0,p.jsx)(`pre`,{className:`max-h-[60vh] overflow-auto rounded-[var(--radius-md)] border border-ink-rule bg-ink-bg-deep p-3 font-mono text-[12px] leading-[1.55] text-ink-cream-2`,children:JSON.stringify(r.data?.receipt.signedReceipt??{},null,2)})})]})}function g({group:e,onClickRow:t}){return(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-baseline justify-between border-b border-ink-rule/80 bg-ink-bg/95 px-6 py-2.5 backdrop-blur-[2px]`,children:[(0,p.jsx)(`div`,{className:`ln-eyebrow text-ink-cream-2`,children:e.label}),(0,p.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:[(0,p.jsx)(`span`,{className:`text-ink-cream-2`,children:e.count}),` call`,e.count===1?``:`s`,e.totalCost>0&&(0,p.jsxs)(p.Fragment,{children:[` · `,(0,p.jsx)(`span`,{className:`text-[color:var(--ink-spend-2)]`,children:o(e.totalCost)})]})]})]}),(0,p.jsx)(`table`,{className:`w-full text-[13px]`,children:(0,p.jsx)(`tbody`,{children:e.rows.map((e,r)=>(0,p.jsxs)(`tr`,{onClick:()=>t(e.id),className:i(`cursor-pointer border-b border-ink-rule/50`,`transition-colors duration-[var(--dur-stamp)]`,`hover:bg-ink-surface/60`,r%2==1&&`bg-ink-surface/15`),children:[(0,p.jsxs)(`td`,{className:`w-[72px] px-6 py-2 font-mono text-[11px] text-ink-faint`,children:[`#`,e.id]}),(0,p.jsx)(`td`,{className:`py-2 text-ink-cream`,children:e.playName}),(0,p.jsx)(`td`,{className:`py-2 font-mono text-[12px] text-ink-muted`,children:e.callType}),(0,p.jsx)(`td`,{className:`w-[88px] py-2 text-right font-mono text-ink-cream`,children:e.costUsd==null?(0,p.jsx)(`span`,{className:`text-ink-faint`,children:`—`}):o(e.costUsd)}),(0,p.jsx)(`td`,{className:`w-[72px] py-2 text-right font-mono text-[12px] text-ink-muted`,children:n(e.createdAt)}),(0,p.jsx)(`td`,{className:`w-[200px] px-6 py-2 text-right font-mono text-[11px] text-ink-faint truncate`,children:e.oneshotRequestId?e.oneshotRequestId:m.has(e.callType)?(0,p.jsx)(`span`,{className:`inline-flex items-center rounded-[var(--radius-xs)] border border-ink-rule/60 px-1.5 py-[1.5px] text-[10px] uppercase tracking-[0.08em] text-ink-faint`,title:`Synchronous call — no async request ID by design`,children:`sync`}):`—`})]},e.id))})})]})}function _(e){let t=new Date,n=v(t),r=(()=>{let e=new Date(t);return e.setDate(e.getDate()-1),v(e)})(),i=[],a=new Map;for(let t of e){let e=new Date(t.createdAt);if(Number.isNaN(e.getTime()))continue;let o=v(e),s=a.get(o);s||(s={key:o,label:y(e,o,n,r),count:0,totalCost:0,rows:[]},a.set(o,s),i.push(s)),s.rows.push(t),s.count++,s.totalCost+=t.costUsd??0}return i}function v(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function y(e,t,n,r){return t===n?`Today`:t===r?`Yesterday`:e.toLocaleDateString(void 0,{weekday:`long`,month:`long`,day:`numeric`})}export{h as component};
2
- //# sourceMappingURL=receipts-BgXV3-De.js.map