@v11g/agents-rock 1.0.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 (223) hide show
  1. package/README.md +65 -0
  2. package/bin/agents-rock.mjs +4 -0
  3. package/package.json +13 -0
  4. package/plugins/solution-architect/.claude-plugin/plugin.json +9 -0
  5. package/plugins/solution-architect/skills/analyze-requirements/README.md +75 -0
  6. package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +31 -0
  7. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/OFL.txt +98 -0
  8. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  9. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
  10. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
  11. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
  12. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
  13. package/plugins/solution-architect/skills/analyze-requirements/assets/mermaid-theme.json +52 -0
  14. package/plugins/solution-architect/skills/analyze-requirements/assets/section-help.json +101 -0
  15. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +2389 -0
  16. package/plugins/solution-architect/skills/analyze-requirements/references/interview.md +53 -0
  17. package/plugins/solution-architect/skills/analyze-requirements/references/likec4.md +157 -0
  18. package/plugins/solution-architect/skills/analyze-requirements/references/project-types.md +60 -0
  19. package/plugins/solution-architect/skills/analyze-requirements/references/research.md +78 -0
  20. package/plugins/solution-architect/skills/analyze-requirements/references/viewer.md +772 -0
  21. package/plugins/solution-architect/skills/analyze-requirements/references/writing.md +206 -0
  22. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +74 -0
  23. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/chrome.mjs +66 -0
  24. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/companion-links.mjs +20 -0
  25. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-kinds.mjs +37 -0
  26. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-links.mjs +26 -0
  27. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-routes.mjs +27 -0
  28. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-sections.mjs +78 -0
  29. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/embed.mjs +8 -0
  30. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/er-entities.mjs +16 -0
  31. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/fonts.mjs +39 -0
  32. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/frontmatter.mjs +17 -0
  33. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/inputs.mjs +41 -0
  34. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-config.mjs +41 -0
  35. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-extract.mjs +29 -0
  36. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-steps.mjs +22 -0
  37. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-defs.mjs +20 -0
  38. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-flows.mjs +46 -0
  39. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-inline.mjs +31 -0
  40. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-links.mjs +7 -0
  41. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-list.mjs +64 -0
  42. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-render.mjs +127 -0
  43. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-shape.mjs +19 -0
  44. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-tables.mjs +30 -0
  45. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-views.mjs +48 -0
  46. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-wide.mjs +44 -0
  47. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/nav.mjs +72 -0
  48. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/offline.mjs +19 -0
  49. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/port.mjs +13 -0
  50. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +113 -0
  51. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/section-help.mjs +49 -0
  52. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/slug-registry.mjs +11 -0
  53. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-clusters.mjs +15 -0
  54. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-deployment.mjs +8 -0
  55. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-elections.mjs +20 -0
  56. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-links.mjs +23 -0
  57. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-model-tables.mjs +24 -0
  58. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-palette.mjs +34 -0
  59. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +20 -0
  60. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-tree.mjs +16 -0
  61. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-config.mjs +19 -0
  62. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-export.mjs +35 -0
  63. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-gen.mjs +39 -0
  64. package/plugins/solution-architect/skills/analyze-requirements/scripts/render.mjs +130 -0
  65. package/plugins/solution-architect/skills/analyze-requirements/scripts/serve.mjs +71 -0
  66. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +553 -0
  67. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/companion-links.test.mjs +60 -0
  68. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-kinds.test.mjs +41 -0
  69. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-links.test.mjs +104 -0
  70. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-routes.test.mjs +54 -0
  71. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-sections.test.mjs +197 -0
  72. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/embed.test.mjs +28 -0
  73. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/er-entities.test.mjs +14 -0
  74. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/ARCHITECTURE.md +47 -0
  75. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/broken/model.c4 +27 -0
  76. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/pass/model.c4 +29 -0
  77. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/adr/0001-sample.md +18 -0
  78. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimate.html +2 -0
  79. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimation.md +8 -0
  80. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model-broken.json +1 -0
  81. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model.json +1 -0
  82. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/threat-model.md +8 -0
  83. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample-model.json +1 -0
  84. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample.c4 +28 -0
  85. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fonts.test.mjs +38 -0
  86. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/frontmatter.test.mjs +27 -0
  87. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/inputs.test.mjs +72 -0
  88. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config-cli.test.mjs +26 -0
  89. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config.test.mjs +74 -0
  90. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-export-cli.test.mjs +61 -0
  91. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-extract.test.mjs +37 -0
  92. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-gen-cli.test.mjs +73 -0
  93. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-steps.test.mjs +32 -0
  94. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-flows.test.mjs +82 -0
  95. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-links.test.mjs +16 -0
  96. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-provenance.test.mjs +42 -0
  97. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-render.test.mjs +226 -0
  98. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-tables.test.mjs +30 -0
  99. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-views.test.mjs +76 -0
  100. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-wide.test.mjs +76 -0
  101. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/nav.test.mjs +236 -0
  102. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/offline.test.mjs +37 -0
  103. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +86 -0
  104. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gates.test.mjs +20 -0
  105. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/render.test.mjs +171 -0
  106. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/research-workflow.test.mjs +38 -0
  107. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/section-help.test.mjs +101 -0
  108. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/serve.test.mjs +48 -0
  109. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-clusters.test.mjs +46 -0
  110. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-deployment.test.mjs +23 -0
  111. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-elections.test.mjs +30 -0
  112. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-links.test.mjs +38 -0
  113. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-model-tables.test.mjs +51 -0
  114. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +28 -0
  115. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-tree.test.mjs +43 -0
  116. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/viewer-template.test.mjs +1206 -0
  117. package/plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs +88 -0
  118. package/plugins/solution-architect/skills/analyze-requirements/workflows/research.js +57 -0
  119. package/plugins/solution-architect/skills/estimate/README.md +67 -0
  120. package/plugins/solution-architect/skills/estimate/SKILL.md +64 -0
  121. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +1128 -0
  122. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +95 -0
  123. package/plugins/solution-architect/skills/estimate/references/interview.md +80 -0
  124. package/plugins/solution-architect/skills/estimate/references/slicing.md +55 -0
  125. package/plugins/solution-architect/skills/estimate/references/techniques.md +111 -0
  126. package/plugins/solution-architect/skills/estimate/references/writing.md +211 -0
  127. package/plugins/solution-architect/skills/estimate/scripts/compute.mjs +23 -0
  128. package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +128 -0
  129. package/plugins/solution-architect/skills/estimate/scripts/lib/components.mjs +19 -0
  130. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +85 -0
  131. package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +10 -0
  132. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +30 -0
  133. package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +32 -0
  134. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +122 -0
  135. package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +128 -0
  136. package/plugins/solution-architect/skills/estimate/scripts/render.mjs +65 -0
  137. package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +623 -0
  138. package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +88 -0
  139. package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +34 -0
  140. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +112 -0
  141. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +58 -0
  142. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +30 -0
  143. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +60 -0
  144. package/plugins/solution-architect/skills/estimate/scripts/test/quality-gates.test.mjs +20 -0
  145. package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +71 -0
  146. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +121 -0
  147. package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +129 -0
  148. package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +72 -0
  149. package/plugins/solution-architect/skills/estimate/scripts/validate.mjs +20 -0
  150. package/plugins/solution-architect/skills/new-lead/README.md +48 -0
  151. package/plugins/solution-architect/skills/new-lead/SKILL.md +113 -0
  152. package/plugins/solution-architect/skills/new-lead/assets/dashboard/detail.html +842 -0
  153. package/plugins/solution-architect/skills/new-lead/assets/dashboard/index.html +655 -0
  154. package/plugins/solution-architect/skills/new-lead/assets/dashboard/start.sh +3 -0
  155. package/plugins/solution-architect/skills/new-lead/assets/dashboard/stats.mjs +98 -0
  156. package/plugins/solution-architect/skills/new-lead/assets/dashboard/vendor/reactflow-bundle.js +473 -0
  157. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/entry.jsx +33 -0
  158. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package-lock.json +1055 -0
  159. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package.json +19 -0
  160. package/plugins/solution-architect/skills/new-lead/scripts/init-root.mjs +73 -0
  161. package/plugins/solution-architect/skills/new-lead/scripts/lead-upsert.mjs +31 -0
  162. package/plugins/solution-architect/skills/new-lead/scripts/lib/enrich.mjs +20 -0
  163. package/plugins/solution-architect/skills/new-lead/scripts/lib/map-nodes.mjs +124 -0
  164. package/plugins/solution-architect/skills/new-lead/scripts/lib/map.mjs +117 -0
  165. package/plugins/solution-architect/skills/new-lead/scripts/lib/port.mjs +15 -0
  166. package/plugins/solution-architect/skills/new-lead/scripts/lib/registry.mjs +116 -0
  167. package/plugins/solution-architect/skills/new-lead/scripts/serve.mjs +163 -0
  168. package/plugins/solution-architect/skills/new-lead/scripts/test/e2e-workspace.test.mjs +59 -0
  169. package/plugins/solution-architect/skills/new-lead/scripts/test/enrich.test.mjs +16 -0
  170. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/ARCHITECTURE.md +16 -0
  171. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/brief.md +4 -0
  172. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/index.html +11 -0
  173. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/proposal-non-tech.html +2 -0
  174. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/threat-model.html +2 -0
  175. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation-inputs.json +6 -0
  176. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation.json +10 -0
  177. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/notes.md +3 -0
  178. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/proposal-non-tech.md +3 -0
  179. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/rfp.md +3 -0
  180. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads.json +25 -0
  181. package/plugins/solution-architect/skills/new-lead/scripts/test/init-root.test.mjs +81 -0
  182. package/plugins/solution-architect/skills/new-lead/scripts/test/lead-upsert.test.mjs +67 -0
  183. package/plugins/solution-architect/skills/new-lead/scripts/test/map.test.mjs +72 -0
  184. package/plugins/solution-architect/skills/new-lead/scripts/test/port.test.mjs +31 -0
  185. package/plugins/solution-architect/skills/new-lead/scripts/test/registry-io.test.mjs +57 -0
  186. package/plugins/solution-architect/skills/new-lead/scripts/test/registry.test.mjs +49 -0
  187. package/plugins/solution-architect/skills/new-lead/scripts/test/serve.test.mjs +205 -0
  188. package/plugins/solution-architect/skills/new-lead/scripts/test/stats.test.mjs +92 -0
  189. package/plugins/solution-architect/skills/new-lead/scripts/test/validate-cli.test.mjs +24 -0
  190. package/plugins/solution-architect/skills/new-lead/scripts/test/vendor-bundle.test.mjs +9 -0
  191. package/plugins/solution-architect/skills/new-lead/scripts/validate.mjs +9 -0
  192. package/plugins/solution-architect/skills/proposal/README.md +36 -0
  193. package/plugins/solution-architect/skills/proposal/SKILL.md +58 -0
  194. package/plugins/solution-architect/skills/proposal/assets/proposal-template.html +82 -0
  195. package/plugins/solution-architect/skills/proposal/references/interview.md +63 -0
  196. package/plugins/solution-architect/skills/proposal/references/review.md +28 -0
  197. package/plugins/solution-architect/skills/proposal/references/writing.md +102 -0
  198. package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +22 -0
  199. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +75 -0
  200. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +54 -0
  201. package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +17 -0
  202. package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +43 -0
  203. package/plugins/solution-architect/skills/proposal/scripts/lib/jargon.mjs +9 -0
  204. package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +32 -0
  205. package/plugins/solution-architect/skills/proposal/scripts/render.mjs +60 -0
  206. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +144 -0
  207. package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +93 -0
  208. package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +51 -0
  209. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +30 -0
  210. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +81 -0
  211. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +22 -0
  212. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +55 -0
  213. package/plugins/solution-architect/skills/proposal/scripts/test/quality-gates.test.mjs +20 -0
  214. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +70 -0
  215. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +40 -0
  216. package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +20 -0
  217. package/src/cli/agents.mjs +12 -0
  218. package/src/cli/args.mjs +46 -0
  219. package/src/cli/install.mjs +68 -0
  220. package/src/cli/main.mjs +124 -0
  221. package/src/cli/picker.mjs +78 -0
  222. package/src/cli/registry.mjs +26 -0
  223. package/src/cli/uninstall.mjs +38 -0
@@ -0,0 +1,842 @@
1
+ <!doctype html>
2
+ <!-- new-lead-dashboard v3 -->
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <meta name="description" content="Lead detail page">
8
+ <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3' fill='%230f766e'/%3E%3C/svg%3E">
9
+ <title>Lead detail</title>
10
+ <style>
11
+ /* Tokens: same vocabulary as index.html. Full light palette on bare :root,
12
+ dark redefines via media query; [data-theme] lets this page's own toggle
13
+ force an override in either direction. */
14
+ :root {
15
+ color-scheme:light;
16
+ --bg:#f6f4ef; --bg-sunk:#edeae1; --card:#fffdf9; --card-raised:#fff;
17
+ --ink:#1c1b18; --ink-soft:#45423a; --ink-dim:#6c6759;
18
+ --border:#e4dfd3; --border-strong:#cec7b6;
19
+ --accent:#0f766e; --accent-ink:#0a544f; --accent-soft:rgba(15,118,110,.09); --accent-line:rgba(15,118,110,.38);
20
+ --ok:#15803d; --ok-soft:rgba(21,128,61,.1);
21
+ --warn:#a55708; --warn-soft:rgba(165,87,8,.1);
22
+ --pending-bg:#eae7dd; --pending-border:#c8c1b0; --pending-ink:#857f70;
23
+ --focus:#0f766e; --focus-halo:rgba(15,118,110,.22);
24
+ --scroll-thumb:#cec7b6; --scroll-thumb-hover:#b3aa95; --scroll-track:transparent;
25
+ --tier-flat:0 0 0 1px rgba(0,0,0,.06);
26
+ --tier-raised:0 0 0 1px rgba(0,0,0,.06), 0 1px 2px -1px rgba(0,0,0,.06), 0 2px 4px 0 rgba(0,0,0,.04);
27
+ --tier-raised-hover:0 0 0 1px rgba(0,0,0,.08), 0 1px 2px -1px rgba(0,0,0,.08), 0 2px 4px 0 rgba(0,0,0,.06);
28
+ --tier-hero:0 0 0 1px rgba(15,118,110,.16), 0 2px 6px -2px rgba(0,0,0,.07), 0 10px 26px -8px rgba(0,0,0,.09);
29
+ --tier-sunk:inset 0 1px 3px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.04);
30
+ --r-lg:.875rem; --r-md:.625rem; --r-sm:.5rem; --r-xs:.375rem; --r-pill:999px;
31
+ --topbar-h:4.25rem; --ease:cubic-bezier(.16, 1, .3, 1);
32
+ }
33
+ @media (prefers-color-scheme:dark) {
34
+ :root:not([data-theme="light"]) {
35
+ color-scheme:dark;
36
+ --bg:#0f1413; --bg-sunk:#0a0e0d; --card:#171d1c; --card-raised:#1c2322;
37
+ --ink:#e9e7e2; --ink-soft:#bdc4c0; --ink-dim:#8d9a95;
38
+ --border:#26312f; --border-strong:#3a4946;
39
+ --accent:#3fb3a8; --accent-ink:#74d6cc; --accent-soft:rgba(63,179,168,.13); --accent-line:rgba(63,179,168,.42);
40
+ --ok:#62c082; --ok-soft:rgba(98,192,130,.13);
41
+ --warn:#dd9247; --warn-soft:rgba(221,146,71,.13);
42
+ --pending-bg:#171d1c; --pending-border:#35423f; --pending-ink:#737e79;
43
+ --focus:#74d6cc; --focus-halo:rgba(116,214,204,.25);
44
+ --scroll-thumb:#3a4946; --scroll-thumb-hover:#4f6360;
45
+ --tier-flat:0 0 0 1px rgba(255,255,255,.08);
46
+ --tier-raised:0 0 0 1px rgba(255,255,255,.08);
47
+ --tier-raised-hover:0 0 0 1px rgba(255,255,255,.13);
48
+ --tier-hero:0 0 0 1px rgba(116,214,204,.22), 0 10px 30px -12px rgba(0,0,0,.7);
49
+ --tier-sunk:inset 0 1px 3px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.05);
50
+ }
51
+ }
52
+ :root[data-theme="dark"] {
53
+ color-scheme:dark;
54
+ --bg:#0f1413; --bg-sunk:#0a0e0d; --card:#171d1c; --card-raised:#1c2322;
55
+ --ink:#e9e7e2; --ink-soft:#bdc4c0; --ink-dim:#8d9a95;
56
+ --border:#26312f; --border-strong:#3a4946;
57
+ --accent:#3fb3a8; --accent-ink:#74d6cc; --accent-soft:rgba(63,179,168,.13); --accent-line:rgba(63,179,168,.42);
58
+ --ok:#62c082; --ok-soft:rgba(98,192,130,.13);
59
+ --warn:#dd9247; --warn-soft:rgba(221,146,71,.13);
60
+ --pending-bg:#171d1c; --pending-border:#35423f; --pending-ink:#737e79;
61
+ --focus:#74d6cc; --focus-halo:rgba(116,214,204,.25);
62
+ --scroll-thumb:#3a4946; --scroll-thumb-hover:#4f6360;
63
+ --tier-flat:0 0 0 1px rgba(255,255,255,.08);
64
+ --tier-raised:0 0 0 1px rgba(255,255,255,.08);
65
+ --tier-raised-hover:0 0 0 1px rgba(255,255,255,.13);
66
+ --tier-hero:0 0 0 1px rgba(116,214,204,.22), 0 10px 30px -12px rgba(0,0,0,.7);
67
+ --tier-sunk:inset 0 1px 3px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.05);
68
+ }
69
+
70
+ /* base */
71
+ * { box-sizing:border-box; }
72
+ html { -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; scrollbar-width:thin; scrollbar-color:var(--scroll-thumb) var(--scroll-track); }
73
+ html::-webkit-scrollbar { width:11px; height:11px; }
74
+ html::-webkit-scrollbar-track { background:var(--scroll-track); }
75
+ html::-webkit-scrollbar-thumb { background:var(--scroll-thumb); border-radius:var(--r-pill); border:3px solid transparent; background-clip:content-box; }
76
+ html::-webkit-scrollbar-thumb:hover { background:var(--scroll-thumb-hover); background-clip:content-box; }
77
+ body {
78
+ margin:0; color:var(--ink); background-color:var(--bg);
79
+ background-image:radial-gradient(ellipse 90% 55% at 50% -8%, var(--accent-soft) 0%, transparent 70%);
80
+ background-repeat:no-repeat;
81
+ font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
82
+ font-size:clamp(15px, .35vw + 14px, 16.5px); line-height:1.6; overflow-wrap:break-word;
83
+ }
84
+ .mono { font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace; font-variant-numeric:tabular-nums; }
85
+ button, textarea, input { font:inherit; color:inherit; }
86
+ h1, h2, h3 { margin:0; text-wrap:balance; letter-spacing:-.011em; }
87
+ p, li, dd { text-wrap:pretty; }
88
+ :focus-visible { outline:2px solid var(--focus); outline-offset:2px; border-radius:var(--r-xs); }
89
+ [hidden] { display:none !important; }
90
+ .wrap > *, .main > *, .panel-head > *, .topbar > *, .facts > * { min-width:0; }
91
+
92
+ /* themed scrollbars on every scrolling region */
93
+ .scroll-region { scrollbar-width:thin; scrollbar-color:var(--scroll-thumb) var(--scroll-track); }
94
+ .scroll-region::-webkit-scrollbar { width:9px; height:9px; }
95
+ .scroll-region::-webkit-scrollbar-track { background:var(--scroll-track); }
96
+ .scroll-region::-webkit-scrollbar-thumb { background:var(--scroll-thumb); border-radius:var(--r-pill); border:2px solid transparent; background-clip:content-box; }
97
+ .scroll-region::-webkit-scrollbar-thumb:hover { background:var(--scroll-thumb-hover); background-clip:content-box; }
98
+ .scroll-region::-webkit-scrollbar-corner { background:transparent; }
99
+
100
+ /* enter, staggered */
101
+ .enter { opacity:0; transform:translateY(10px); animation:enter-up 420ms var(--ease) both; animation-delay:calc(var(--i, 0) * 70ms); }
102
+ @keyframes enter-up { to { opacity:1; transform:none; } }
103
+ @media (prefers-reduced-motion:reduce) {
104
+ *, *::before, *::after {
105
+ animation-duration:.001ms !important; animation-delay:0ms !important;
106
+ transition-duration:.001ms !important; scroll-behavior:auto !important;
107
+ }
108
+ .enter { opacity:1; transform:none; }
109
+ }
110
+
111
+ /* top bar */
112
+ .topbar {
113
+ position:sticky; top:0; z-index:30; min-height:var(--topbar-h);
114
+ display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.75rem 1rem;
115
+ padding:.7rem max(1.25rem, calc((100% - 1280px) / 2));
116
+ background:color-mix(in srgb, var(--card) 88%, transparent);
117
+ -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px);
118
+ box-shadow:0 1px 0 0 var(--border);
119
+ }
120
+ .topbar-left { display:flex; align-items:baseline; flex-wrap:wrap; gap:.3rem .6rem; }
121
+ .crumb { font-size:.74rem; color:var(--ink-dim); }
122
+ .topbar h1 { font-size:clamp(1.05rem, .5vw + .95rem, 1.3rem); font-weight:620; line-height:1.25; }
123
+ .topbar-right { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }
124
+
125
+ /* badges: same tone vocabulary as index.html */
126
+ .badge {
127
+ display:inline-flex; align-items:center; gap:.35rem; font-size:.68rem; font-weight:650;
128
+ letter-spacing:.045em; text-transform:uppercase; padding:.18rem .5rem; border-radius:var(--r-pill);
129
+ white-space:nowrap; background:var(--pending-bg); color:var(--pending-ink);
130
+ }
131
+ .badge::before { content:""; width:.4rem; height:.4rem; border-radius:50%; background:currentColor; }
132
+ .badge-active { background:var(--accent-soft); color:var(--accent-ink); }
133
+ .badge-won { background:var(--ok-soft); color:var(--ok); }
134
+ .badge-lost { background:var(--pending-bg); color:var(--pending-ink); }
135
+
136
+ .src {
137
+ font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace; font-size:.69rem; color:var(--ink-dim);
138
+ background:var(--bg-sunk); padding:.1rem .4rem; border-radius:var(--r-xs); white-space:nowrap;
139
+ }
140
+
141
+ /* buttons */
142
+ .btn {
143
+ min-height:2.5rem; display:inline-flex; align-items:center; gap:.4rem; padding:0 .85rem;
144
+ font-size:.84rem; font-weight:550; border:0; border-radius:var(--r-sm);
145
+ background:var(--card); color:var(--ink); box-shadow:var(--tier-raised); cursor:pointer;
146
+ transition-property:box-shadow, background-color, color, scale; transition-duration:160ms; transition-timing-function:var(--ease);
147
+ }
148
+ .btn:hover { box-shadow:var(--tier-raised-hover); }
149
+ .btn:active { scale:.96; }
150
+ .btn-won { color:var(--ok); font-weight:620; }
151
+ .btn-lost { color:var(--ink-dim); }
152
+
153
+ .seg { display:inline-flex; padding:3px; gap:2px; border-radius:11px; background:var(--bg-sunk); box-shadow:var(--tier-flat); } /* concentric: 8 + 3 = 11 */
154
+ .seg button {
155
+ min-height:2.125rem; padding:0 .7rem; border:0; border-radius:8px; background:transparent;
156
+ color:var(--ink-dim); font-size:.78rem; cursor:pointer;
157
+ transition-property:background-color, color, scale; transition-duration:160ms; transition-timing-function:var(--ease);
158
+ }
159
+ .seg button:hover { color:var(--ink); }
160
+ .seg button:active { scale:.96; }
161
+ .seg button[aria-pressed="true"] { background:var(--card); color:var(--accent-ink); font-weight:620; box-shadow:var(--tier-flat); }
162
+
163
+ /* shell: sticky TOC + main column */
164
+ .wrap { max-width:1280px; margin:0 auto; padding:1.4rem 1.25rem 3rem; display:grid; grid-template-columns:190px minmax(0, 1fr); gap:0 2rem; }
165
+ .toc {
166
+ grid-row:1 / -1; position:sticky; top:calc(var(--topbar-h) + .85rem); align-self:start;
167
+ max-height:calc(100dvh - var(--topbar-h) - 2.5rem); overflow-y:auto; padding:.1rem .3rem .5rem 0;
168
+ }
169
+ .toc-title { font-size:.66rem; font-weight:700; letter-spacing:.16em; text-transform:uppercase; color:var(--ink-dim); padding:0 .55rem .55rem; margin-bottom:.45rem; border-bottom:1px solid var(--border); }
170
+ .toc a {
171
+ display:block; min-height:2.125rem; padding:.45rem .55rem; margin-bottom:1px; font-size:.8rem; line-height:1.35;
172
+ color:var(--ink-dim); text-decoration:none; border-left:2px solid transparent; border-radius:0 var(--r-sm) var(--r-sm) 0;
173
+ transition-property:color, background-color, border-color; transition-duration:160ms; transition-timing-function:var(--ease);
174
+ }
175
+ .toc a:hover { color:var(--ink); background:var(--accent-soft); }
176
+ .toc a.active { color:var(--accent-ink); font-weight:620; border-left-color:var(--accent); background:var(--accent-soft); }
177
+
178
+ .main { min-width:0; display:grid; gap:1.1rem; align-content:start; }
179
+ [id] { scroll-margin-top:calc(var(--topbar-h) + 1rem); }
180
+
181
+ /* panels + depth tiers */
182
+ .panel { background:var(--card); border-radius:var(--r-lg); box-shadow:var(--tier-raised); padding:1.05rem 1.15rem; transition-property:box-shadow; transition-duration:200ms; transition-timing-function:var(--ease); }
183
+ .panel:hover { box-shadow:var(--tier-raised-hover); }
184
+ .panel--hero { background:var(--card-raised); box-shadow:var(--tier-hero); }
185
+ .panel-head { display:flex; align-items:center; justify-content:space-between; gap:.5rem 1rem; flex-wrap:wrap; margin-bottom:.75rem; }
186
+ .panel-head h2 { font-size:.78rem; font-weight:700; letter-spacing:.11em; text-transform:uppercase; color:var(--ink-dim); }
187
+ .panel--hero .panel-head h2 { color:var(--accent-ink); }
188
+ .panel-head .hint { font-size:.76rem; color:var(--ink-dim); }
189
+
190
+ .prose { max-width:65ch; line-height:1.7; }
191
+ .prose p { margin:0 0 .9rem; }
192
+ .prose p:last-child { margin-bottom:0; }
193
+ .prose h1, .prose h2, .prose h3 { margin:0 0 .5rem; font-size:1em; font-weight:650; }
194
+ .prose ul { margin:0 0 .9rem; padding-left:1.15rem; }
195
+ .note { margin:.7rem 0 0; font-size:.78rem; line-height:1.55; color:var(--ink-dim); max-width:62ch; }
196
+
197
+ /* error + next-action banners */
198
+ .banner {
199
+ display:flex; align-items:center; gap:.5rem; margin:0; padding:.65rem .9rem; font-size:.85rem;
200
+ border-radius:var(--r-md); border-left:3px solid var(--warn); background:var(--warn-soft); color:var(--warn);
201
+ }
202
+ .callout {
203
+ display:flex; flex-wrap:wrap; align-items:center; gap:.5rem .8rem; padding:.8rem 1rem; border-radius:var(--r-lg);
204
+ border-left:3px solid var(--accent); background:var(--accent-soft); color:var(--accent-ink); font-size:.9rem;
205
+ }
206
+
207
+ /* source legend, collapsible */
208
+ .legend summary {
209
+ list-style:none; cursor:pointer; display:flex; align-items:center; gap:.5rem; min-height:2.25rem;
210
+ padding:.25rem .35rem; font-size:.78rem; font-weight:620; color:var(--ink-dim); border-radius:var(--r-sm);
211
+ transition-property:color; transition-duration:160ms; transition-timing-function:var(--ease);
212
+ }
213
+ .legend summary:hover { color:var(--ink); }
214
+ .legend summary::-webkit-details-marker { display:none; }
215
+ .legend summary::before {
216
+ content:""; width:.4rem; height:.4rem; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor;
217
+ transform:rotate(-45deg); transition-property:transform; transition-duration:200ms; transition-timing-function:var(--ease);
218
+ }
219
+ .legend[open] summary::before { transform:rotate(45deg); }
220
+ .legend-body { display:grid; grid-template-columns:repeat(auto-fit, minmax(15rem, 1fr)); gap:.3rem 1.25rem; padding:.5rem .55rem .2rem 1.3rem; font-size:.79rem; color:var(--ink-dim); }
221
+
222
+ /* key facts */
223
+ .facts { display:grid; grid-template-columns:repeat(auto-fit, minmax(11rem, 1fr)); gap:.9rem 1rem; margin:0 0 .95rem; }
224
+ .facts > div { display:flex; flex-direction:column; gap:.15rem; min-width:0; }
225
+ .facts dt { font-size:.68rem; font-weight:600; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-dim); }
226
+ .facts dd { margin:0; font-size:1rem; font-weight:620; }
227
+ .facts dd.muted { font-weight:500; font-size:.84rem; color:var(--ink-dim); }
228
+ .cluster { display:flex; flex-wrap:wrap; gap:.4rem; }
229
+ .chip { font-size:.78rem; padding:.25rem .6rem; border-radius:var(--r-sm); color:var(--ink-soft); background:var(--bg-sunk); box-shadow:var(--tier-flat); }
230
+
231
+ /* lineage diagram: React Flow mounts into #canvas; the bundle injects its
232
+ own (light-only) stylesheet on first render, so these rules override it
233
+ to track the page tokens in both themes. No extra vendor CSS file. */
234
+ .diagram-hint { font-size:.76rem; color:var(--ink-dim); margin:0 0 .55rem; }
235
+ .diagram-hint kbd { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:.72rem; padding:.05rem .3rem; border-radius:var(--r-xs); background:var(--bg-sunk); box-shadow:var(--tier-flat); }
236
+ .diagram-wrap { border-radius:var(--r-md); background:var(--bg-sunk); box-shadow:var(--tier-sunk); overflow:hidden; }
237
+ .rf-canvas { width:100%; height:min(62vh, 460px); min-height:320px; }
238
+ /* #canvas-prefixed for specificity: the bundle's stylesheet is appended to
239
+ <head> AFTER this one (on first render), so same-specificity rules would
240
+ lose the cascade tie-break; qualifying by the container id wins outright. */
241
+ #canvas .react-flow__attribution { display:none; }
242
+ #canvas .react-flow__node {
243
+ padding:.5rem .7rem; border-radius:var(--r-sm); font-size:.78rem; font-weight:560; width:auto;
244
+ background:var(--card); color:var(--ink); border:1px solid var(--border-strong); box-shadow:var(--tier-flat);
245
+ }
246
+ #canvas .react-flow__node.lead-node-pending { background:var(--pending-bg); border-color:var(--pending-border); color:var(--pending-ink); border-style:dashed; }
247
+ #canvas .react-flow__node.lead-node-picked { outline:2px solid var(--accent); outline-offset:2px; }
248
+ #canvas .react-flow__edge-path { stroke:var(--border-strong); stroke-width:1.5; }
249
+ #canvas .react-flow__handle { background:var(--border-strong); width:6px; height:6px; }
250
+ #canvas .react-flow__controls { box-shadow:var(--tier-raised); border-radius:var(--r-sm); overflow:hidden; }
251
+ #canvas .react-flow__controls-button { background:var(--card); border-bottom:1px solid var(--border); }
252
+ #canvas .react-flow__controls-button:hover { background:var(--accent-soft); }
253
+ #canvas .react-flow__controls-button svg { fill:var(--ink-dim); }
254
+ #canvas .react-flow__minimap { border-radius:var(--r-sm); box-shadow:var(--tier-raised); background-color:var(--bg-sunk); }
255
+ #canvas .react-flow__minimap-mask { fill:var(--accent-soft); }
256
+ #canvas .react-flow__minimap-node { fill:var(--border-strong); stroke:none; }
257
+ #canvas .react-flow__background { opacity:.6; }
258
+
259
+ /* inline node detail (expand-in-place, for nodes without an href) */
260
+ .node-detail { margin-top:.75rem; padding:.75rem .9rem; border-radius:var(--r-md); background:var(--bg-sunk); box-shadow:var(--tier-sunk); }
261
+ .node-detail-head { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin-bottom:.35rem; }
262
+ .node-detail-head h3 { font-size:.82rem; font-weight:620; }
263
+ .node-detail-close { border:0; background:transparent; color:var(--ink-dim); font-size:1.1rem; line-height:1; cursor:pointer; padding:.2rem .4rem; border-radius:var(--r-xs); }
264
+ .node-detail-close:hover { color:var(--ink); background:var(--accent-soft); }
265
+ #node-detail-body { margin:0; font-size:.85rem; color:var(--ink-soft); }
266
+
267
+ /* bands: one vertical slice, one TOC entry each */
268
+ .band { display:grid; grid-template-columns:repeat(auto-fit, minmax(19rem, 1fr)); gap:1.1rem; align-items:start; }
269
+ .band > * { min-width:0; }
270
+
271
+ .list { margin:0; padding-left:1.15rem; font-size:.89rem; line-height:1.6; }
272
+ .list li { margin-bottom:.5rem; max-width:60ch; }
273
+ .list li:last-child { margin-bottom:0; }
274
+ .list li.note { list-style:none; margin-left:-1.15rem; color:var(--ink-dim); font-size:.82rem; }
275
+
276
+ .timeline { list-style:none; margin:0; padding:0; font-size:.87rem; }
277
+ .timeline li { display:grid; grid-template-columns:max-content minmax(0, 1fr); gap:.1rem .75rem; padding:.5rem 0; border-top:1px solid var(--border); }
278
+ .timeline li:first-child { border-top:none; }
279
+ .timeline-when { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:.74rem; color:var(--ink-dim); padding-top:.13rem; }
280
+ .timeline-what { min-width:0; max-width:58ch; }
281
+
282
+ .fold > summary { list-style:none; cursor:pointer; display:flex; align-items:center; justify-content:space-between; gap:.5rem 1rem; flex-wrap:wrap; min-height:2.25rem; margin:-.15rem 0 .6rem; border-radius:var(--r-sm); }
283
+ .fold > summary::-webkit-details-marker { display:none; }
284
+ .fold > summary h2 { font-size:.78rem; font-weight:700; letter-spacing:.11em; text-transform:uppercase; color:var(--ink-dim); display:flex; align-items:center; gap:.45rem; }
285
+ .fold > summary h2::before { content:""; width:.4rem; height:.4rem; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:rotate(-45deg); transition-property:transform; transition-duration:200ms; transition-timing-function:var(--ease); }
286
+ .fold[open] > summary h2::before { transform:rotate(45deg); }
287
+ .fold > summary:hover h2 { color:var(--ink); }
288
+
289
+ .notes-box { width:100%; min-height:7rem; padding:.65rem .75rem; border:0; border-radius:var(--r-md); background:var(--bg-sunk); box-shadow:var(--tier-sunk); font-size:.87rem; line-height:1.6; resize:vertical; }
290
+ .notes-status { margin:.4rem 0 0; font-size:.76rem; color:var(--ink-dim); }
291
+
292
+ /* responsive */
293
+ @media (max-width:1000px) {
294
+ .topbar { position:static; }
295
+ .wrap { grid-template-columns:minmax(0, 1fr); padding-top:0; }
296
+ .toc {
297
+ grid-row:auto; position:sticky; top:0; z-index:20; max-height:none; display:flex; align-items:center; gap:3px;
298
+ overflow-x:auto; overflow-y:hidden; padding:.45rem 0; margin-bottom:1.1rem;
299
+ background:color-mix(in srgb, var(--bg) 92%, transparent);
300
+ -webkit-backdrop-filter:blur(10px); backdrop-filter:blur(10px); box-shadow:0 1px 0 0 var(--border);
301
+ }
302
+ .toc-title { display:none; }
303
+ .toc a { flex:0 0 auto; white-space:nowrap; border-left:0; border-bottom:2px solid transparent; border-radius:var(--r-sm) var(--r-sm) 0 0; padding:.4rem .6rem; font-size:.78rem; }
304
+ .toc a.active { border-left:0; border-bottom-color:var(--accent); }
305
+ [id] { scroll-margin-top:3.6rem; }
306
+ }
307
+ @media (max-width:560px) {
308
+ .wrap { padding-left:1rem; padding-right:1rem; }
309
+ .topbar { padding:.7rem 1rem; }
310
+ .topbar-right { width:100%; justify-content:flex-start; }
311
+ .panel { padding:.9rem 1rem; }
312
+ }
313
+ </style>
314
+ </head>
315
+ <body>
316
+
317
+ <header class="topbar">
318
+ <div class="topbar-left">
319
+ <span class="crumb mono" id="crumb"></span>
320
+ <h1 id="lead-title">Lead detail</h1>
321
+ <span class="badge" id="status-badge"></span>
322
+ </div>
323
+ <div class="topbar-right">
324
+ <div class="seg" role="group" aria-label="Colour theme">
325
+ <button type="button" data-set-theme="light" aria-pressed="false">Light</button>
326
+ <button type="button" data-set-theme="dark" aria-pressed="false">Dark</button>
327
+ </div>
328
+ <button type="button" class="btn btn-lost" id="lost-btn">Mark lost</button>
329
+ <button type="button" class="btn btn-won" id="won-btn">Mark won</button>
330
+ </div>
331
+ </header>
332
+
333
+ <div class="wrap">
334
+
335
+ <nav class="toc scroll-region" id="toc" aria-label="Page sections">
336
+ <div class="toc-title">Contents</div>
337
+ <a href="#s-summary">Executive summary</a>
338
+ <a href="#s-facts">Key facts</a>
339
+ <a href="#s-lineage">Lead lineage</a>
340
+ <a href="#band-open">Risks &amp; questions</a>
341
+ <a href="#band-history">Decisions &amp; activity</a>
342
+ <a href="#s-notes">Notes</a>
343
+ </nav>
344
+
345
+ <main class="main">
346
+
347
+ <p class="banner" id="error-banner" role="alert" hidden></p>
348
+ <div class="callout enter" id="next-banner" style="--i:0" hidden>
349
+ <span class="callout-text" id="next-banner-text"></span>
350
+ </div>
351
+
352
+ <details class="legend enter panel" style="--i:1">
353
+ <summary>Where each value comes from</summary>
354
+ <div class="legend-body">
355
+ <div><code class="src">leads.json</code> &mdash; intake JSON</div>
356
+ <div><code class="src">estimation.json</code> &mdash; scenarios and risks JSON</div>
357
+ <div><code class="src">brief.md</code> &mdash; qualitative brief</div>
358
+ <div><code class="src">git log</code> &mdash; versioned docs and history (notes.md, ARCHITECTURE.md, commits)</div>
359
+ </div>
360
+ </details>
361
+
362
+ <section class="panel panel--hero enter" id="s-summary" style="--i:2" aria-labelledby="h-summary">
363
+ <div class="panel-head">
364
+ <h2 id="h-summary">Executive summary</h2>
365
+ <span class="src">brief.md</span>
366
+ </div>
367
+ <div class="prose" id="brief-content"></div>
368
+ </section>
369
+
370
+ <section class="panel enter" id="s-facts" style="--i:3" aria-labelledby="h-facts">
371
+ <div class="panel-head">
372
+ <h2 id="h-facts">Key facts</h2>
373
+ <span class="src">leads.json</span>
374
+ </div>
375
+ <dl class="facts" id="facts-dl"></dl>
376
+ </section>
377
+
378
+ <section class="panel enter" id="s-lineage" style="--i:4" aria-labelledby="h-lineage">
379
+ <div class="panel-head">
380
+ <h2 id="h-lineage">Lead lineage</h2>
381
+ <span class="hint">evidence through proposal, current state</span>
382
+ </div>
383
+ <p class="diagram-hint">
384
+ Drag to pan. Use the on-canvas controls to zoom, or hold <kbd>Ctrl</kbd>/<kbd>Cmd</kbd> and scroll.
385
+ Click a node to open its document, or view its detail inline.
386
+ </p>
387
+ <div class="diagram-wrap">
388
+ <div id="canvas" class="rf-canvas" role="group" aria-label="Lead lineage diagram"></div>
389
+ </div>
390
+ <div class="node-detail" id="node-detail" hidden>
391
+ <div class="node-detail-head">
392
+ <h3 id="node-detail-title"></h3>
393
+ <button type="button" class="node-detail-close" id="node-detail-close" aria-label="Close detail">&times;</button>
394
+ </div>
395
+ <p id="node-detail-body"></p>
396
+ </div>
397
+ </section>
398
+
399
+ <div class="band" id="band-open">
400
+ <section class="panel enter" id="s-risks" style="--i:5" aria-labelledby="h-risks">
401
+ <div class="panel-head">
402
+ <h2 id="h-risks">Top risks</h2>
403
+ <span class="src">estimation.json</span>
404
+ </div>
405
+ <ol class="list" id="risks-list"></ol>
406
+ </section>
407
+
408
+ <section class="panel enter" id="s-questions" style="--i:6" aria-labelledby="h-questions">
409
+ <div class="panel-head">
410
+ <h2 id="h-questions">Open questions</h2>
411
+ <span class="src">estimation-inputs.json</span>
412
+ </div>
413
+ <ul class="list" id="questions-list"></ul>
414
+ </section>
415
+ </div>
416
+
417
+ <div class="band" id="band-history">
418
+ <section class="panel enter" id="s-decisions" style="--i:7" aria-labelledby="h-decisions">
419
+ <details class="fold" open>
420
+ <summary><h2 id="h-decisions">Decision log</h2><span class="src">git log</span></summary>
421
+ <ul class="timeline" id="decisions-list"></ul>
422
+ <p class="note">This lead's log has no separate decision markers yet, so this shows the same commit history as Activity.</p>
423
+ </details>
424
+ </section>
425
+
426
+ <section class="panel enter" id="s-activity" style="--i:8" aria-labelledby="h-activity">
427
+ <details class="fold" open>
428
+ <summary><h2 id="h-activity">Activity</h2><span class="src">git log</span></summary>
429
+ <ul class="timeline" id="activity-list"></ul>
430
+ </details>
431
+ </section>
432
+ </div>
433
+
434
+ <section class="panel enter" id="s-notes" style="--i:9" aria-labelledby="h-notes">
435
+ <div class="panel-head">
436
+ <h2 id="h-notes">Notes</h2>
437
+ <span class="src">notes.md</span>
438
+ </div>
439
+ <textarea class="notes-box scroll-region" id="notes" aria-labelledby="h-notes" placeholder="Add a note..."></textarea>
440
+ <p class="notes-status" id="notes-status"></p>
441
+ </section>
442
+
443
+ </main>
444
+ </div>
445
+
446
+ <script src="/scripts/vendor/reactflow-bundle.js"></script>
447
+ <script type="module">
448
+ const LEAD_ID = location.pathname.split('/').pop();
449
+ const STEPS = { arch: 1, estimate: 2, scenario: 2, proposal: 3 };
450
+
451
+ const ESCAPES = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' };
452
+ function esc(s) {
453
+ return String(s ?? '').replace(/[&<>"']/g, (c) => ESCAPES[c]);
454
+ }
455
+
456
+ /* ================================================================== *
457
+ * Theme toggle (three-state tokens; this only forces an override).
458
+ * ================================================================== */
459
+ (function () {
460
+ const buttons = document.querySelectorAll('[data-set-theme]');
461
+ function mark(theme) {
462
+ buttons.forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.setTheme === theme)));
463
+ }
464
+ const media = window.matchMedia('(prefers-color-scheme: dark)');
465
+ function current() {
466
+ return document.documentElement.dataset.theme || (media.matches ? 'dark' : 'light');
467
+ }
468
+ mark(current());
469
+ media.addEventListener('change', () => { if (!document.documentElement.dataset.theme) mark(current()); });
470
+ buttons.forEach((btn) => btn.addEventListener('click', () => {
471
+ document.documentElement.dataset.theme = btn.dataset.setTheme;
472
+ mark(btn.dataset.setTheme);
473
+ }));
474
+ })();
475
+
476
+ /* ================================================================== *
477
+ * Sticky TOC scroll-spy. Ported unchanged from the approved mockup:
478
+ * activates the last section whose top has passed the activation line,
479
+ * pinned to the final entry at the true page bottom. No tail padding.
480
+ * ================================================================== */
481
+ function collectSections(links) {
482
+ const sections = [];
483
+ links.forEach((link) => {
484
+ const el = document.getElementById(link.getAttribute('href').slice(1));
485
+ if (el) sections.push({ el, link });
486
+ });
487
+ return sections;
488
+ }
489
+ function setActiveLink(links, link) {
490
+ if (link.classList.contains('active')) return;
491
+ links.forEach((l) => l.classList.remove('active'));
492
+ link.classList.add('active');
493
+ if (window.innerWidth <= 1000) link.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });
494
+ }
495
+ // Active section = the last one (in document order) whose activation line
496
+ // has been passed; falls back to the first section if none has.
497
+ function findActiveSection(sections) {
498
+ const maxScroll = document.documentElement.scrollHeight - window.innerHeight;
499
+ const offset = window.innerHeight * 0.1;
500
+ const step = window.innerHeight * 0.12;
501
+ let ceiling = maxScroll + step;
502
+ for (let i = sections.length - 1; i >= 0; i--) {
503
+ const docTop = sections[i].el.getBoundingClientRect().top + window.scrollY;
504
+ ceiling = Math.min(docTop - offset, ceiling - step);
505
+ if (window.scrollY >= ceiling) return sections[i];
506
+ }
507
+ return sections[0];
508
+ }
509
+ function wireTocClicks(links) {
510
+ links.forEach((link) => link.addEventListener('click', (e) => {
511
+ e.preventDefault();
512
+ const el = document.getElementById(link.getAttribute('href').slice(1));
513
+ if (!el) return;
514
+ el.scrollIntoView({ behavior: 'smooth', block: 'start' });
515
+ history.replaceState(null, '', '#' + link.getAttribute('href').slice(1));
516
+ }));
517
+ }
518
+ function initScrollSpy(links, sections) {
519
+ const update = () => setActiveLink(links, findActiveSection(sections).link);
520
+ setActiveLink(links, sections[0].link);
521
+ update();
522
+ let ticking = false;
523
+ window.addEventListener('scroll', () => {
524
+ if (ticking) return;
525
+ ticking = true;
526
+ requestAnimationFrame(() => { update(); ticking = false; });
527
+ }, { passive: true });
528
+ wireTocClicks(links);
529
+ }
530
+ (function () {
531
+ const toc = document.getElementById('toc');
532
+ if (!toc) return;
533
+ const links = toc.querySelectorAll('a');
534
+ const sections = collectSections(links);
535
+ if (!sections.length) return;
536
+ initScrollSpy(links, sections);
537
+ })();
538
+
539
+ /* ================================================================== *
540
+ * Error banner (load/save failures) vs. next-action callout (status).
541
+ * ================================================================== */
542
+ function showError(msg) {
543
+ const el = document.getElementById('error-banner');
544
+ el.textContent = msg;
545
+ el.hidden = false;
546
+ }
547
+ function clearError() {
548
+ document.getElementById('error-banner').hidden = true;
549
+ }
550
+
551
+ /* ================================================================== *
552
+ * Minimal markdown: escape first, THEN apply heading/bold/list
553
+ * transforms to the already-escaped string. A brief containing
554
+ * <img src=x onerror=...> must render as visible literal text.
555
+ * ================================================================== */
556
+ function bold(s) {
557
+ return s.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');
558
+ }
559
+ function headingTag(line) {
560
+ const m = line.match(/^(#{1,3})\s+(.*)$/);
561
+ return m ? [`h${m[1].length}`, m[2]] : null;
562
+ }
563
+ function mdLite(raw) {
564
+ const lines = esc(raw).trim().split('\n');
565
+ const blocks = [];
566
+ let para = [];
567
+ let list = null;
568
+ const flushPara = () => { if (para.length) { blocks.push(`<p>${bold(para.join(' '))}</p>`); para = []; } };
569
+ const flushList = () => { if (list) { blocks.push(`<ul>${list.map((i) => `<li>${bold(i)}</li>`).join('')}</ul>`); list = null; } };
570
+ for (const line of lines) {
571
+ const heading = headingTag(line);
572
+ const item = line.match(/^[-*]\s+(.*)$/);
573
+ if (heading) { flushPara(); flushList(); blocks.push(`<${heading[0]}>${bold(heading[1])}</${heading[0]}>`); }
574
+ else if (item) { flushPara(); (list ??= []).push(item[1]); }
575
+ else if (line.trim() === '') { flushPara(); flushList(); }
576
+ else { flushList(); para.push(line.trim()); }
577
+ }
578
+ flushPara();
579
+ flushList();
580
+ return blocks.join('');
581
+ }
582
+
583
+ /* ================================================================== *
584
+ * Header + status badge.
585
+ * ================================================================== */
586
+ function renderHeader(lead) {
587
+ document.getElementById('crumb').textContent = lead.id;
588
+ document.getElementById('lead-title').textContent = `${lead.client}: ${lead.title}`;
589
+ document.title = `${lead.client}: ${lead.title}`;
590
+ const badge = document.getElementById('status-badge');
591
+ badge.className = `badge badge-${esc(lead.status)}`;
592
+ badge.textContent = lead.status;
593
+ document.getElementById('won-btn').hidden = !!lead.closed;
594
+ document.getElementById('lost-btn').hidden = !!lead.closed;
595
+ }
596
+
597
+ /* ================================================================== *
598
+ * Next-action banner: pure function over lead + panels + nodes.
599
+ * ================================================================== */
600
+ function stepFor(node) {
601
+ return STEPS[node.id] ?? STEPS[node.type] ?? null;
602
+ }
603
+ function computeBanner(lead, panels, nodes) {
604
+ if (lead.closed) return `${lead.status} on ${lead.closed}`;
605
+ const pending = nodes.find((n) => n.data.status === 'pending');
606
+ if (!pending) return null;
607
+ const step = stepFor(pending);
608
+ return `waiting: ${pending.data.label} (step ${step ?? '?'})`;
609
+ }
610
+ function renderBanner(text) {
611
+ const el = document.getElementById('next-banner');
612
+ el.hidden = !text;
613
+ if (text) document.getElementById('next-banner-text').textContent = text;
614
+ }
615
+
616
+ /* ================================================================== *
617
+ * Lead lineage canvas: mounts the vendored React Flow bundle, then
618
+ * layers on the states the bundle itself doesn't know about (pending /
619
+ * picked-scenario styling and a click-to-expand fallback for nodes
620
+ * with no href). All text below goes through textContent, never
621
+ * innerHTML, so no escaping is needed for lead-supplied node data.
622
+ * ================================================================== */
623
+ function styleNode(el, node, pickedId) {
624
+ if (node.data.status === 'pending') {
625
+ el.classList.add('lead-node-pending');
626
+ const step = stepFor(node);
627
+ el.title = step ? `unlocks at step ${step}` : 'pending';
628
+ }
629
+ if (node.id === pickedId) el.classList.add('lead-node-picked');
630
+ }
631
+ function watchNodes(container, nodes, pickedId) {
632
+ const byId = new Map(nodes.map((n) => [n.id, n]));
633
+ function apply() {
634
+ const els = container.querySelectorAll('.react-flow__node');
635
+ if (els.length < nodes.length) return false;
636
+ els.forEach((el) => { const n = byId.get(el.dataset.id); if (n) styleNode(el, n, pickedId); });
637
+ return true;
638
+ }
639
+ if (apply()) return;
640
+ const mo = new MutationObserver(() => { if (apply()) mo.disconnect(); });
641
+ mo.observe(container, { childList: true, subtree: true });
642
+ // Safety net: if the bundle ever renders a different node count than
643
+ // the logical node list, don't watch the subtree forever.
644
+ setTimeout(() => mo.disconnect(), 5000);
645
+ }
646
+ // Only stop the wheel event from ever reaching React Flow's own zoom
647
+ // handler when the gesture isn't a deliberate zoom (Ctrl/Cmd+wheel).
648
+ // We never call preventDefault ourselves, so plain page scroll is
649
+ // never hijacked while the pointer happens to be over the canvas.
650
+ // Guarded so a won/lost click (which re-runs load() -> mountCanvas())
651
+ // never stacks a second listener on the same persistent #canvas element.
652
+ function guardWheel(container) {
653
+ if (container.dataset.wheelGuarded) return;
654
+ container.dataset.wheelGuarded = '1';
655
+ container.addEventListener('wheel', (e) => {
656
+ if (!e.ctrlKey && !e.metaKey) e.stopPropagation();
657
+ }, { capture: true });
658
+ }
659
+ function showNodeDetail(node) {
660
+ document.getElementById('node-detail-title').textContent = node.data.label;
661
+ document.getElementById('node-detail-body').textContent = node.data.detail || 'No additional detail recorded for this item.';
662
+ document.getElementById('node-detail').hidden = false;
663
+ }
664
+ function onNodeClick(node) {
665
+ if (node.data.href) { window.open(node.data.href, '_blank', 'noopener'); return; }
666
+ showNodeDetail(node);
667
+ }
668
+ function mountCanvas(map, lead) {
669
+ const container = document.getElementById('canvas');
670
+ guardWheel(container);
671
+ LeadFlow.render(container, map, { onNodeClick });
672
+ const pickedId = lead.scenario ? `scenario-${lead.scenario}` : null;
673
+ watchNodes(container, map.nodes, pickedId);
674
+ }
675
+ /* ================================================================== *
676
+ * Panels: brief (markdown), key facts, risks, open questions,
677
+ * decisions/activity (share one git-log-derived list; see note in
678
+ * the Decision log panel), notes.
679
+ * ================================================================== */
680
+ function renderBrief(brief) {
681
+ const el = document.getElementById('brief-content');
682
+ el.innerHTML = brief ? mdLite(brief) : '<p class="note">No brief recorded yet.</p>';
683
+ }
684
+ function factRow(dl, label, value) {
685
+ const div = document.createElement('div');
686
+ const dt = document.createElement('dt');
687
+ dt.textContent = label;
688
+ const dd = document.createElement('dd');
689
+ if (value) { dd.textContent = value; } else { dd.textContent = 'Not captured'; dd.className = 'muted'; }
690
+ div.append(dt, dd);
691
+ dl.append(div);
692
+ }
693
+ // facts is the registry entry — the only business metadata the dashboard has now
694
+ // that the answers file is gone. A lead with no client yet shows an em dash.
695
+ function renderFacts(facts) {
696
+ const dl = document.getElementById('facts-dl');
697
+ dl.replaceChildren();
698
+ if (!facts) return;
699
+ factRow(dl, 'Client', facts.client ?? '—');
700
+ factRow(dl, 'Title', facts.title);
701
+ factRow(dl, 'Created', facts.created);
702
+ factRow(dl, 'Scenario', facts.scenario ?? '—');
703
+ }
704
+ function appendEmptyNote(el, text) {
705
+ const li = document.createElement('li');
706
+ li.className = 'note';
707
+ li.textContent = text;
708
+ el.append(li);
709
+ }
710
+ function renderList(id, items, emptyText) {
711
+ const el = document.getElementById(id);
712
+ el.replaceChildren();
713
+ if (!items.length) return appendEmptyNote(el, emptyText);
714
+ items.forEach((text) => { const li = document.createElement('li'); li.textContent = text; el.append(li); });
715
+ }
716
+ function timelineItems(entries) {
717
+ return entries.map((line) => {
718
+ const [when, ...rest] = line.split(' ');
719
+ return { when, what: rest.join(' ') || when };
720
+ });
721
+ }
722
+ function renderTimeline(id, entries, emptyText) {
723
+ const el = document.getElementById(id);
724
+ el.replaceChildren();
725
+ if (!entries.length) return appendEmptyNote(el, emptyText);
726
+ timelineItems(entries).forEach(({ when, what }) => {
727
+ const li = document.createElement('li');
728
+ const w = document.createElement('span'); w.className = 'timeline-when mono'; w.textContent = when;
729
+ const b = document.createElement('span'); b.className = 'timeline-what'; b.textContent = what;
730
+ li.append(w, b);
731
+ el.append(li);
732
+ });
733
+ }
734
+ function renderPanels(panels, lead) {
735
+ renderBrief(panels.brief);
736
+ renderFacts(panels.facts);
737
+ renderList('risks-list', panels.risks, 'No risks recorded.');
738
+ renderList('questions-list', panels.openQuestions, 'No open questions recorded.');
739
+ renderTimeline('decisions-list', panels.activity, 'No activity recorded yet.');
740
+ renderTimeline('activity-list', panels.activity, 'No activity recorded yet.');
741
+ }
742
+
743
+ /* ================================================================== *
744
+ * Notes: save on blur + Ctrl/Cmd-S. There is no documented GET for an
745
+ * existing note's content, so this can save but can't prefill from
746
+ * disk on load — see the task report for that gap.
747
+ * ================================================================== */
748
+ const notesBox = document.getElementById('notes');
749
+ const notesStatus = document.getElementById('notes-status');
750
+ let notesDirty = false;
751
+ notesBox.addEventListener('input', () => { notesDirty = true; notesStatus.textContent = 'Unsaved changes'; });
752
+ notesBox.addEventListener('blur', saveNotes);
753
+ notesBox.addEventListener('keydown', (e) => {
754
+ if ((e.ctrlKey || e.metaKey) && e.key === 's') { e.preventDefault(); saveNotes(); }
755
+ });
756
+ async function saveNotes() {
757
+ if (!notesDirty) return;
758
+ try {
759
+ const res = await fetch(`/api/leads/${LEAD_ID}/notes`, {
760
+ method: 'POST', headers: { 'content-type': 'application/json' },
761
+ body: JSON.stringify({ content: notesBox.value }),
762
+ });
763
+ if (!res.ok) throw new Error(`save failed (${res.status})`);
764
+ notesDirty = false;
765
+ notesStatus.textContent = 'Saved';
766
+ } catch (err) {
767
+ showError(`Could not save notes: ${err.message}`);
768
+ }
769
+ }
770
+
771
+ /* ================================================================== *
772
+ * Won / lost.
773
+ * ================================================================== */
774
+ async function setStatus(status) {
775
+ try {
776
+ const res = await fetch(`/api/leads/${LEAD_ID}`, {
777
+ method: 'POST', headers: { 'content-type': 'application/json' },
778
+ body: JSON.stringify({ status }),
779
+ });
780
+ if (!res.ok) {
781
+ const body = await res.json().catch(() => ({}));
782
+ throw new Error(body.error || `request failed (${res.status})`);
783
+ }
784
+ await load();
785
+ } catch (err) {
786
+ showError(`Could not update lead: ${err.message}`);
787
+ }
788
+ }
789
+ // One delegated click listener with a small dispatch table, same pattern
790
+ // as index.html's CLICK_ACTIONS — on document.body since the topbar
791
+ // (won/lost) sits outside <main>.
792
+ const CLICK_ACTIONS = [
793
+ ['#won-btn', () => setStatus('won')],
794
+ ['#lost-btn', () => setStatus('lost')],
795
+ ['#node-detail-close', () => { document.getElementById('node-detail').hidden = true; }],
796
+ ];
797
+ document.body.addEventListener('click', (e) => {
798
+ for (const [selector, handler] of CLICK_ACTIONS) {
799
+ const el = e.target.closest(selector);
800
+ if (el) return handler(el);
801
+ }
802
+ });
803
+
804
+ /* ================================================================== *
805
+ * Load: two same-origin fetches, then header/canvas/panels render.
806
+ * Separate catches for the fetch step and the render step, per the
807
+ * three error paths index.html established.
808
+ * ================================================================== */
809
+ async function fetchLeadAndMap() {
810
+ const [leadsRes, mapRes] = await Promise.all([fetch('/api/leads'), fetch(`/api/leads/${LEAD_ID}/map`)]);
811
+ if (!leadsRes.ok) throw new Error(`server returned ${leadsRes.status}`);
812
+ if (!mapRes.ok) throw new Error(`server returned ${mapRes.status}`);
813
+ const leadsBody = await leadsRes.json();
814
+ const map = await mapRes.json();
815
+ const lead = leadsBody.leads.find((l) => l.id === LEAD_ID);
816
+ if (!lead) throw new Error('lead not found in registry');
817
+ return { lead, map };
818
+ }
819
+ async function load() {
820
+ let lead, map;
821
+ try {
822
+ ({ lead, map } = await fetchLeadAndMap());
823
+ } catch (err) {
824
+ showError(`Could not load lead (${err.message}). Try reloading the page.`);
825
+ return;
826
+ }
827
+ try {
828
+ clearError();
829
+ renderHeader(lead);
830
+ renderBanner(computeBanner(lead, map.panels, map.nodes));
831
+ mountCanvas(map, lead);
832
+ renderPanels(map.panels, lead);
833
+ } catch (err) {
834
+ showError(`Could not display lead (${err.message}).`);
835
+ }
836
+ }
837
+
838
+ load();
839
+ </script>
840
+
841
+ </body>
842
+ </html>