@agent-native/core 0.44.0 β†’ 0.44.1

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 (63) hide show
  1. package/dist/cli/pr-visual-recap-workflow.d.ts +1 -1
  2. package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
  3. package/dist/cli/pr-visual-recap-workflow.js +1 -1
  4. package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
  5. package/dist/cli/recap.d.ts +23 -0
  6. package/dist/cli/recap.d.ts.map +1 -1
  7. package/dist/cli/recap.js +175 -0
  8. package/dist/cli/recap.js.map +1 -1
  9. package/dist/cli/skills.d.ts +3 -3
  10. package/dist/cli/skills.d.ts.map +1 -1
  11. package/dist/cli/skills.js +54 -7
  12. package/dist/cli/skills.js.map +1 -1
  13. package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -1
  14. package/dist/client/blocks/library/AnnotatedCodeBlock.js +21 -8
  15. package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -1
  16. package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -1
  17. package/dist/client/blocks/library/ApiEndpointBlock.js +112 -12
  18. package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -1
  19. package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -1
  20. package/dist/client/blocks/library/DiffBlock.js +59 -75
  21. package/dist/client/blocks/library/DiffBlock.js.map +1 -1
  22. package/dist/client/blocks/library/JsonExplorerBlock.d.ts.map +1 -1
  23. package/dist/client/blocks/library/JsonExplorerBlock.js +1 -1
  24. package/dist/client/blocks/library/JsonExplorerBlock.js.map +1 -1
  25. package/dist/client/blocks/library/MermaidBlock.d.ts.map +1 -1
  26. package/dist/client/blocks/library/MermaidBlock.js +22 -3
  27. package/dist/client/blocks/library/MermaidBlock.js.map +1 -1
  28. package/dist/client/blocks/library/annotation-rail.d.ts +85 -0
  29. package/dist/client/blocks/library/annotation-rail.d.ts.map +1 -1
  30. package/dist/client/blocks/library/annotation-rail.js +149 -8
  31. package/dist/client/blocks/library/annotation-rail.js.map +1 -1
  32. package/dist/client/blocks/library/diagram.d.ts +17 -0
  33. package/dist/client/blocks/library/diagram.d.ts.map +1 -1
  34. package/dist/client/blocks/library/diagram.js +47 -2
  35. package/dist/client/blocks/library/diagram.js.map +1 -1
  36. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  37. package/dist/client/composer/TiptapComposer.js +13 -8
  38. package/dist/client/composer/TiptapComposer.js.map +1 -1
  39. package/dist/client/composer/pasted-text.d.ts +25 -0
  40. package/dist/client/composer/pasted-text.d.ts.map +1 -1
  41. package/dist/client/composer/pasted-text.js +86 -4
  42. package/dist/client/composer/pasted-text.js.map +1 -1
  43. package/dist/db/migrations.d.ts +10 -0
  44. package/dist/db/migrations.d.ts.map +1 -1
  45. package/dist/db/migrations.js +32 -0
  46. package/dist/db/migrations.js.map +1 -1
  47. package/dist/server/og-fonts-data.d.ts +3 -0
  48. package/dist/server/og-fonts-data.d.ts.map +1 -0
  49. package/dist/server/og-fonts-data.js +9 -0
  50. package/dist/server/og-fonts-data.js.map +1 -0
  51. package/dist/server/og-fonts.d.ts +10 -0
  52. package/dist/server/og-fonts.d.ts.map +1 -0
  53. package/dist/server/og-fonts.js +58 -0
  54. package/dist/server/og-fonts.js.map +1 -0
  55. package/dist/server/social-og-image.d.ts.map +1 -1
  56. package/dist/server/social-og-image.js +16 -5
  57. package/dist/server/social-og-image.js.map +1 -1
  58. package/dist/styles/blocks.css +111 -0
  59. package/dist/usage/store.d.ts +12 -0
  60. package/dist/usage/store.d.ts.map +1 -1
  61. package/dist/usage/store.js +35 -5
  62. package/dist/usage/store.js.map +1 -1
  63. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DiffBlock.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/DiffBlock.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,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AE7J,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,GAAG,GACzB,CACV,IACG,EACN,KAAC,WAAW,kBACE,cAAc,KAAK,GAAG,CAAC,OAAO,EAC1C,SAAS,EAAC,sBAAsB,EAChC,KAAK,EAAE,UAAU,CAAC,IAAI,EACtB,WAAW,EAAC,mCAA8B,EAC1C,QAAQ,EAAE,CAAC,QAAQ,EACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,gBAAgB,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAEvD,KA3DG,KAAK,CA4DN,CACP,CAAC,IACE,IACF,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import {\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport {\n IconChevronRight,\n IconColumns,\n IconDotsVertical,\n IconFileDiff,\n IconList,\n IconPlus,\n IconTrash,\n} from \"@tabler/icons-react\";\nimport { common, createLowlight } from \"lowlight\";\nimport { cn } from \"../../utils.js\";\nimport type {\n BlockEditProps,\n BlockReadProps,\n BlockRenderContext,\n} from \"../types.js\";\nimport type { DiffAnnotation, DiffData, DiffMode } from \"./diff.config.js\";\nimport {\n AnnotationGutterMarker,\n buildLineMarkerMap,\n hasRailAnnotations,\n rangeLabel,\n resolveAnnotations,\n type ResolvedAnnotation,\n} from \"./annotation-rail.js\";\nimport { DevInput, DevLabel, DevTextarea, DevSelect } from \"./dev-doc-ui.js\";\n\n/**\n * GitHub-style before/after diff block. The read renderer computes a line-level\n * diff, then renders it either unified (one column, `+`/`βˆ’` gutters) or split\n * (side-by-side). Long unchanged runs collapse into an expandable \"N unchanged\n * lines\" row (progressive disclosure). The read surface keeps the GitHub diff\n * shape while using the framework Tailwind theme tokens, so it follows each\n * host app's light/dark appearance instead of bringing its own palette.\n *\n * Lives in core so any app can register the dev-doc block. The line differ is\n * inlined (a small LCS-based `diffLines`) rather than pulling the `diff` package\n * into core; the output shape (`{ value, added, removed }` change records) is\n * identical to what the read renderer consumed before.\n *\n * Editing is panel-driven (config-style, like the HTML block): two monospace\n * textareas (Before / After) plus filename, language, and mode controls.\n */\n\n/* ── Inline line differ (LCS) β€” replaces jsdiff `diffLines` ─────────────────── */\n\ninterface Change {\n value: string;\n added?: boolean;\n removed?: boolean;\n}\n\n/**\n * Split text into lines, each KEEPING its trailing newline (so the change\n * `value`s concatenate back to the original and `splitLines` below behaves the\n * same as it did against jsdiff output).\n */\nfunction toLineTokens(text: string): string[] {\n if (text === \"\") return [];\n const out: string[] = [];\n let start = 0;\n for (let i = 0; i < text.length; i += 1) {\n if (text[i] === \"\\n\") {\n out.push(text.slice(start, i + 1));\n start = i + 1;\n }\n }\n if (start < text.length) out.push(text.slice(start));\n return out;\n}\n\n/**\n * A minimal line-level diff producing jsdiff-compatible `Change[]` records\n * (`{ value }` for context, `{ value, added: true }`, `{ value, removed: true }`).\n * Uses a classic LCS table over line tokens; the inputs here are short code\n * snippets so the O(nΒ·m) table is fine. Removed lines are emitted before added\n * lines within a change region, matching jsdiff's ordering.\n */\nexport function diffLines(before: string, after: string): Change[] {\n const a = toLineTokens(before);\n const b = toLineTokens(after);\n const n = a.length;\n const m = b.length;\n const cells = (n + 1) * (m + 1);\n\n if (cells > MAX_DIFF_LCS_CELLS) {\n return [\n ...(before ? [{ value: before, removed: true }] : []),\n ...(after ? [{ value: after, added: true }] : []),\n ];\n }\n\n // LCS length table.\n const lcs: number[][] = Array.from({ length: n + 1 }, () =>\n new Array<number>(m + 1).fill(0),\n );\n for (let i = n - 1; i >= 0; i -= 1) {\n for (let j = m - 1; j >= 0; j -= 1) {\n lcs[i][j] =\n a[i] === b[j]\n ? lcs[i + 1][j + 1] + 1\n : Math.max(lcs[i + 1][j], lcs[i][j + 1]);\n }\n }\n\n const changes: Change[] = [];\n // Push a token onto the last change if same kind, else open a new change.\n const push = (value: string, kind: \"context\" | \"added\" | \"removed\") => {\n const last = changes[changes.length - 1];\n const sameKind =\n last &&\n Boolean(last.added) === (kind === \"added\") &&\n Boolean(last.removed) === (kind === \"removed\");\n if (sameKind) {\n last.value += value;\n } else {\n changes.push({\n value,\n added: kind === \"added\" ? true : undefined,\n removed: kind === \"removed\" ? true : undefined,\n });\n }\n };\n\n let i = 0;\n let j = 0;\n while (i < n && j < m) {\n if (a[i] === b[j]) {\n push(a[i], \"context\");\n i += 1;\n j += 1;\n } else if (lcs[i + 1][j] >= lcs[i][j + 1]) {\n push(a[i], \"removed\");\n i += 1;\n } else {\n push(b[j], \"added\");\n j += 1;\n }\n }\n while (i < n) {\n push(a[i], \"removed\");\n i += 1;\n }\n while (j < m) {\n push(b[j], \"added\");\n j += 1;\n }\n return changes;\n}\n\n/* ── Syntax highlighting ───────────────────────────────────────────────────── */\n\nconst lowlight = createLowlight(common);\n\ntype LowlightNode = {\n type: string;\n value?: string;\n properties?: {\n className?: string[] | string;\n };\n children?: LowlightNode[];\n};\n\nconst LANGUAGE_ALIASES: Record<string, string> = {\n cjs: \"javascript\",\n cts: \"typescript\",\n htm: \"html\",\n js: \"javascript\",\n jsonc: \"json\",\n jsx: \"jsx\",\n md: \"markdown\",\n mdx: \"markdown\",\n mjs: \"javascript\",\n mts: \"typescript\",\n py: \"python\",\n rb: \"ruby\",\n rs: \"rust\",\n sh: \"bash\",\n shell: \"bash\",\n ts: \"typescript\",\n tsx: \"tsx\",\n yml: \"yaml\",\n zsh: \"bash\",\n};\n\nconst TOKEN_CLASS_NAMES: Record<string, string> = {\n \"hljs-addition\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-attr\": \"text-primary\",\n \"hljs-attribute\": \"text-primary\",\n \"hljs-built_in\": \"text-amber-700 dark:text-amber-300\",\n \"hljs-bullet\": \"text-primary\",\n \"hljs-comment\": \"text-muted-foreground italic\",\n \"hljs-deletion\": \"text-destructive\",\n \"hljs-doctag\": \"text-destructive\",\n \"hljs-emphasis\": \"italic\",\n \"hljs-formula\": \"text-destructive\",\n \"hljs-keyword\": \"text-destructive\",\n \"hljs-link\": \"text-primary underline-offset-2\",\n \"hljs-literal\": \"text-primary\",\n \"hljs-meta\": \"text-primary\",\n \"hljs-meta-string\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-name\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-number\": \"text-primary\",\n \"hljs-params\": \"text-primary\",\n \"hljs-property\": \"text-primary\",\n \"hljs-quote\": \"text-muted-foreground italic\",\n \"hljs-regexp\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-section\": \"text-violet-700 dark:text-violet-300\",\n \"hljs-selector-attr\": \"text-primary\",\n \"hljs-selector-class\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-selector-id\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-selector-pseudo\": \"text-primary\",\n \"hljs-selector-tag\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-string\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-strong\": \"font-semibold\",\n \"hljs-subst\": \"text-destructive\",\n \"hljs-symbol\": \"text-primary\",\n \"hljs-tag\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-template-variable\": \"text-amber-700 dark:text-amber-300\",\n \"hljs-title\": \"text-violet-700 dark:text-violet-300\",\n \"hljs-type\": \"text-amber-700 dark:text-amber-300\",\n \"hljs-variable\": \"text-amber-700 dark:text-amber-300\",\n language_: \"text-amber-700 dark:text-amber-300\",\n};\n\nfunction normalizeLanguage(value?: string | null): string | null {\n const raw = value?.trim().toLowerCase();\n if (!raw) return null;\n const normalized = LANGUAGE_ALIASES[raw] ?? raw;\n return lowlight.registered(normalized) ? normalized : null;\n}\n\nfunction getLanguageFromFilename(filename?: string): string | null {\n const basename = filename?.split(\"/\").pop()?.toLowerCase();\n if (!basename) return null;\n if (basename === \"dockerfile\") return normalizeLanguage(\"bash\");\n if (basename === \"makefile\") return normalizeLanguage(\"makefile\");\n const ext = basename.includes(\".\") ? basename.split(\".\").pop() : basename;\n return normalizeLanguage(ext);\n}\n\nfunction resolveDiffLanguage(data: DiffData): string {\n return (\n normalizeLanguage(data.language) ??\n getLanguageFromFilename(data.filename) ??\n \"plaintext\"\n );\n}\n\nfunction tokenClassName(className?: string[] | string): string | undefined {\n const classes = Array.isArray(className)\n ? className\n : className\n ? className.split(/\\s+/)\n : [];\n const mapped = classes\n .map((name) => TOKEN_CLASS_NAMES[name])\n .filter(Boolean)\n .join(\" \");\n return mapped || undefined;\n}\n\nfunction hastToReact(children: LowlightNode[], keyPrefix: string): ReactNode[] {\n return children.map((node, index) => {\n if (node.type === \"text\") return node.value ?? \"\";\n if (node.type === \"element\") {\n const key = `${keyPrefix}${index}`;\n const renderedChildren = node.children?.length\n ? hastToReact(node.children, `${key}-`)\n : null;\n const className = tokenClassName(node.properties?.className);\n if (className) {\n return (\n <span key={key} className={className}>\n {renderedChildren}\n </span>\n );\n }\n return <span key={key}>{renderedChildren}</span>;\n }\n return null;\n });\n}\n\nfunction SyntaxHighlightedLine({\n code,\n language,\n}: {\n code: string;\n language: string;\n}) {\n const highlighted = useMemo(() => {\n if (!code.trim() || language === \"plaintext\" || language === \"text\") {\n return null;\n }\n try {\n const tree = lowlight.highlight(language, code) as LowlightNode;\n return hastToReact(tree.children ?? [], `${language}-`);\n } catch {\n return null;\n }\n }, [code, language]);\n\n return <>{highlighted ?? code}</>;\n}\n\n/* ── Diff model ────────────────────────────────────────────────────────────── */\n\ntype DiffRowKind = \"context\" | \"added\" | \"removed\";\n\ninterface DiffRow {\n kind: DiffRowKind;\n /** Line number in the OLD file (omitted for added rows). */\n oldNo?: number;\n /** Line number in the NEW file (omitted for removed rows). */\n newNo?: number;\n text: string;\n}\n\n/** A contiguous run of context lines collapsed when longer than the threshold. */\ninterface CollapsedRun {\n collapsed: true;\n rows: DiffRow[];\n}\n\ntype DiffSegment = DiffRow | CollapsedRun;\n\n/** Which column a split-view row belongs to (the unified view passes nothing). */\ntype RowSide = \"old\" | \"new\";\n\n/**\n * Resolve the markers landing on a row. `side` scopes the lookup to one column\n * in the split view (so a left cell only lights from `before` annotations and a\n * right cell from `after`); the unified view omits it to merge both sides.\n */\ntype MarkersForRow = (\n row: DiffRow,\n side?: RowSide,\n) => ResolvedAnnotation<DiffAnnotation>[];\n\n/** The default side an annotation targets when `side` is omitted. */\nfunction annotationSide(annotation: DiffAnnotation): \"before\" | \"after\" {\n return annotation.side === \"before\" ? \"before\" : \"after\";\n}\n\n/**\n * Count 1-based source lines in a side's text, matching how `buildRows` numbers\n * `oldNo`/`newNo`: a trailing newline does not add a phantom final line.\n */\nfunction countLines(text: string): number {\n if (text === \"\") return 0;\n return splitLines(text).length;\n}\n\n/** Number of context lines above which an unchanged run is collapsed. */\nconst COLLAPSE_THRESHOLD = 6;\n/** Context lines kept visible at each edge of a collapsed run. */\nconst CONTEXT_EDGE = 3;\n\n/**\n * Split a change `value` into individual lines. Most hunks carry a trailing\n * newline; drop the empty final element it produces so a 2-line change does not\n * render a phantom 3rd blank line.\n */\nfunction splitLines(value: string): string[] {\n const lines = value.split(\"\\n\");\n if (lines.length > 0 && lines[lines.length - 1] === \"\") lines.pop();\n return lines;\n}\n\n/** Flatten change objects into numbered diff rows. */\nfunction buildRows(changes: Change[]): DiffRow[] {\n const rows: DiffRow[] = [];\n let oldNo = 0;\n let newNo = 0;\n for (const change of changes) {\n const lines = splitLines(change.value);\n for (const text of lines) {\n if (change.added) {\n newNo += 1;\n rows.push({ kind: \"added\", newNo, text });\n } else if (change.removed) {\n oldNo += 1;\n rows.push({ kind: \"removed\", oldNo, text });\n } else {\n oldNo += 1;\n newNo += 1;\n rows.push({ kind: \"context\", oldNo, newNo, text });\n }\n }\n }\n return rows;\n}\n\n/**\n * Group rows into segments, collapsing interior runs of >COLLAPSE_THRESHOLD\n * context rows (keeping CONTEXT_EDGE visible at each side). Leading/trailing runs\n * collapse too, but keep only the inner edge visible.\n *\n * `isAnchored` marks context rows that carry an annotation (or sit adjacent to\n * one): an anchored row is NEVER hidden inside a collapsed run, so a note that\n * targets an unchanged line stays reachable. An anchor splits its run into the\n * separately-collapsible spans on either side of it, with CONTEXT_EDGE rows kept\n * visible around the anchor.\n */\nfunction segmentRows(\n rows: DiffRow[],\n isAnchored?: (row: DiffRow) => boolean,\n): DiffSegment[] {\n const segments: DiffSegment[] = [];\n\n // Collapse one contiguous context run [from, to) that contains NO anchors.\n const collapseRun = (run: DiffRow[], atStart: boolean, atEnd: boolean) => {\n if (run.length <= COLLAPSE_THRESHOLD) {\n for (const row of run) segments.push(row);\n return;\n }\n const head = atStart ? [] : run.slice(0, CONTEXT_EDGE);\n const tail = atEnd ? [] : run.slice(run.length - CONTEXT_EDGE);\n const hidden = run.slice(head.length, run.length - tail.length);\n for (const row of head) segments.push(row);\n if (hidden.length > 0) segments.push({ collapsed: true, rows: hidden });\n for (const row of tail) segments.push(row);\n };\n\n let i = 0;\n while (i < rows.length) {\n if (rows[i].kind !== \"context\") {\n segments.push(rows[i]);\n i += 1;\n continue;\n }\n // Gather the full contiguous context run.\n let j = i;\n while (j < rows.length && rows[j].kind === \"context\") j += 1;\n const fullRun = rows.slice(i, j);\n const runAtStart = i === 0;\n const runAtEnd = j === rows.length;\n\n if (!isAnchored || !fullRun.some(isAnchored)) {\n collapseRun(fullRun, runAtStart, runAtEnd);\n } else {\n // Walk the run, emitting anchored rows verbatim and collapsing the\n // unanchored spans between them. An anchored row is always visible; the\n // spans on each side of it collapse independently.\n let spanStart = 0;\n for (let k = 0; k <= fullRun.length; k += 1) {\n const atAnchor = k < fullRun.length && isAnchored(fullRun[k]);\n if (atAnchor || k === fullRun.length) {\n const span = fullRun.slice(spanStart, k);\n if (span.length > 0) {\n collapseRun(\n span,\n runAtStart && spanStart === 0,\n runAtEnd && k === fullRun.length,\n );\n }\n if (k < fullRun.length) segments.push(fullRun[k]);\n spanStart = k + 1;\n }\n }\n }\n i = j;\n }\n return segments;\n}\n\n/* ── Theme-aware row styling (light + dark) ────────────────────────────────── */\n\nconst ROW_BG: Record<DiffRowKind, string> = {\n added: \"bg-emerald-500/10 dark:bg-emerald-500/15\",\n removed: \"bg-destructive/10\",\n context: \"bg-background\",\n};\n\nconst GUTTER_BG: Record<DiffRowKind, string> = {\n added: \"bg-emerald-500/15 dark:bg-emerald-500/20\",\n removed: \"bg-destructive/15\",\n context: \"bg-muted/60\",\n};\n\nconst SIGN_COLOR: Record<DiffRowKind, string> = {\n added: \"text-emerald-700 dark:text-emerald-300\",\n removed: \"text-destructive\",\n context: \"text-muted-foreground\",\n};\n\nconst SIGN: Record<DiffRowKind, string> = {\n added: \"+\",\n removed: \"βˆ’\",\n context: \" \",\n};\n\nconst LINE_NO_CLASS =\n \"select-none px-2 py-0 text-right font-mono [font-size:var(--plan-code-size)] leading-5 text-muted-foreground tabular-nums\";\n\nconst DIFF_LINE_CLASS =\n \"block min-w-max flex-1 whitespace-pre px-2 py-0 font-mono [font-size:var(--plan-code-size)] leading-5 text-foreground\";\n\nconst DEFAULT_VISIBLE_DIFF_LINES = 15;\nconst MAX_DIFF_LCS_CELLS = 1_000_000;\n\n/**\n * Below this rendered container width (px) a diff drops side-by-side `split`\n * mode and falls back to `unified`: split's two line-number gutters double the\n * width the code needs, exactly where space is tightest (e.g. a diff nested in a\n * vertical-tabs content column). Measured from the block's own box, not the\n * viewport, so the fallback fires by available width at any nesting depth.\n */\nconst SPLIT_MIN_WIDTH = 560;\n\n/**\n * Observe the rendered inline width of an element. Returns a ref to attach plus\n * the measured content-box width (null until the first ResizeObserver tick).\n * Lets the diff pick an effective mode from the width it was actually handed β€” a\n * measurement CSS container queries can't drive, since switching split↔unified\n * is a structural (DOM) change, not a style toggle.\n */\nfunction useContainerWidth<T extends HTMLElement>() {\n const ref = useRef<T | null>(null);\n const [width, setWidth] = useState<number | null>(null);\n useEffect(() => {\n const el = ref.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setWidth(entry.contentRect.width);\n });\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n return [ref, width] as const;\n}\n\nfunction splitDiffFilename(filename?: string): {\n basename: string;\n directory: string | null;\n} {\n const value = filename?.trim() || \"diff\";\n const segments = value.split(\"/\").filter(Boolean);\n const basename = segments[segments.length - 1] ?? value;\n const directory =\n segments.length > 1 ? segments.slice(0, -1).join(\"/\") : null;\n return { basename, directory };\n}\n\nfunction DiffLineText({ language, text }: { language: string; text: string }) {\n const code = text || \" \";\n return (\n <span className={DIFF_LINE_CLASS}>\n <SyntaxHighlightedLine code={code} language={language} />\n </span>\n );\n}\n\n/* ── Read ──────────────────────────────────────────────────────────────────── */\n\nfunction DiffRead({\n data,\n blockId,\n title,\n summary,\n ctx,\n}: BlockReadProps<DiffData>) {\n const [mode, setMode] = useState<DiffMode>(data.mode ?? \"unified\");\n const [expanded, setExpanded] = useState<Set<number>>(() => new Set());\n const [showAllRows, setShowAllRows] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n const [containerRef, containerWidth] = useContainerWidth<HTMLElement>();\n\n const rows = useMemo(\n () => buildRows(diffLines(data.before, data.after)),\n [data.before, data.after],\n );\n const language = useMemo(\n () => resolveDiffLanguage(data),\n [data.filename, data.language],\n );\n const fileParts = useMemo(\n () => splitDiffFilename(data.filename),\n [data.filename],\n );\n const splitLineCount = useMemo(() => pairSplitRows(rows).length, [rows]);\n\n // Resolve annotations against the side they target. A `before` annotation's\n // `lines` ref is clamped to the OLD file's line count and matched on `oldNo`;\n // an `after` (default) ref to the NEW file and matched on `newNo`. Markers are\n // authoring-order across BOTH sides so a note ↔ row ↔ rail card share one id.\n const beforeLineCount = useMemo(() => countLines(data.before), [data.before]);\n const afterLineCount = useMemo(() => countLines(data.after), [data.after]);\n const resolved = useMemo(\n () =>\n resolveAnnotations(data.annotations, (annotation) =>\n annotationSide(annotation) === \"before\"\n ? beforeLineCount\n : afterLineCount,\n ),\n [data.annotations, beforeLineCount, afterLineCount],\n );\n const hasAnnotations = hasRailAnnotations(resolved);\n // Effective render mode. The right-margin popover works in both unified and\n // split, so annotations no longer force a mode; only a container narrower than\n // SPLIT_MIN_WIDTH falls back to unified so split's doubled gutters never crush\n // the code. `canSplit` also gates the mode toggle (hidden when unavailable).\n const narrow = containerWidth != null && containerWidth < SPLIT_MIN_WIDTH;\n const canSplit = !narrow;\n const effectiveMode: DiffMode = canSplit ? mode : \"unified\";\n\n // Annotation popover (diff): a marked line shows its note as a hover popover\n // pinned in the diff's right margin and aligned to that line β€” no inline notes\n // and no permanent side rail, so the code keeps its full width. A short\n // hover-intent delay lets the pointer travel from the line into the popover.\n const clearTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const handleActiveChange = useCallback((index: number | null) => {\n if (clearTimer.current) {\n clearTimeout(clearTimer.current);\n clearTimer.current = null;\n }\n if (index == null) {\n clearTimer.current = setTimeout(() => setActiveIndex(null), 120);\n } else {\n setActiveIndex(index);\n }\n }, []);\n useEffect(\n () => () => {\n if (clearTimer.current) clearTimeout(clearTimer.current);\n },\n [],\n );\n const activeAnnotation =\n activeIndex == null\n ? null\n : (resolved.find((r) => r.index === activeIndex && r.range) ?? null);\n // Vertical center of the active marker's anchor row within the section, so the\n // popover sits beside that line. Rows are in page flow (no inner vertical\n // scroll), so a DOM measure on activeIndex change is stable.\n const [popoverTop, setPopoverTop] = useState<number | null>(null);\n useLayoutEffect(() => {\n const host = containerRef.current;\n if (activeIndex == null || !host) {\n setPopoverTop(null);\n return;\n }\n const rowEl = host.querySelector<HTMLElement>(\n `[data-annot-row=\"${activeIndex}\"]`,\n );\n if (!rowEl) {\n setPopoverTop(null);\n return;\n }\n const hostRect = host.getBoundingClientRect();\n const rowRect = rowEl.getBoundingClientRect();\n setPopoverTop(rowRect.top - hostRect.top + rowRect.height / 2);\n }, [activeIndex, containerRef]);\n // Side-scoped line β†’ markers maps so a row only lights from its own side.\n const beforeMarkers = useMemo(\n () =>\n buildLineMarkerMap(\n resolved.filter((r) => annotationSide(r.annotation) === \"before\"),\n ),\n [resolved],\n );\n const afterMarkers = useMemo(\n () =>\n buildLineMarkerMap(\n resolved.filter((r) => annotationSide(r.annotation) !== \"before\"),\n ),\n [resolved],\n );\n const markersForRow = useMemo<MarkersForRow>(() => {\n return (row, side) => {\n const out: ResolvedAnnotation<DiffAnnotation>[] = [];\n if (\n (side === undefined || side === \"old\") &&\n row.oldNo != null &&\n row.kind !== \"added\"\n ) {\n out.push(...(beforeMarkers.get(row.oldNo) ?? []));\n }\n if (\n (side === undefined || side === \"new\") &&\n row.newNo != null &&\n row.kind !== \"removed\"\n ) {\n out.push(...(afterMarkers.get(row.newNo) ?? []));\n }\n return out;\n };\n }, [beforeMarkers, afterMarkers]);\n // A context row that carries a marker is an anchor: never collapse it away.\n const anchoredRow = useMemo(() => {\n if (!hasAnnotations) return undefined;\n return (row: DiffRow) => markersForRow(row).length > 0;\n }, [hasAnnotations, markersForRow]);\n\n const added = rows.filter((r) => r.kind === \"added\").length;\n const removed = rows.filter((r) => r.kind === \"removed\").length;\n const unchanged = data.before === data.after;\n const totalVisibleLineCount =\n effectiveMode === \"split\" ? splitLineCount : rows.length;\n const shouldLimitRows = totalVisibleLineCount > DEFAULT_VISIBLE_DIFF_LINES;\n // Never truncate away an annotated row: extend the window past the last one.\n const effectiveRowLimit = useMemo(() => {\n if (showAllRows || !shouldLimitRows) return undefined;\n let limit = DEFAULT_VISIBLE_DIFF_LINES;\n if (hasAnnotations) {\n for (let idx = rows.length - 1; idx >= limit; idx -= 1) {\n if (markersForRow(rows[idx]).length > 0) {\n limit = idx + 1;\n break;\n }\n }\n }\n return limit;\n }, [showAllRows, shouldLimitRows, hasAnnotations, rows, markersForRow]);\n const rowLimit = effectiveRowLimit;\n const displayedRows =\n effectiveMode === \"unified\" && rowLimit ? rows.slice(0, rowLimit) : rows;\n\n const toggleRun = (index: number) =>\n setExpanded((prev) => {\n const next = new Set(prev);\n if (next.has(index)) next.delete(index);\n else next.add(index);\n return next;\n });\n\n return (\n <section\n ref={containerRef}\n className=\"relative plan-block group/diff-block\"\n data-block-id={blockId}\n >\n {title && <div className=\"plan-block-label\">{title}</div>}\n {summary && (\n <p className=\"mb-3 text-sm leading-relaxed text-plan-muted\">\n {summary}\n </p>\n )}\n {/* Code surface spans the full width; an annotated line shows its note as\n a hover popover pinned in the right margin, so nothing competes for it. */}\n <div className=\"overflow-hidden rounded-md border border-border bg-background\">\n {/* Header: filename, path, +/βˆ’ counts, mode toggle. */}\n <div className=\"flex min-h-10 flex-wrap items-center gap-2 border-b border-border bg-muted/60 px-3 py-1.5\">\n <IconFileDiff className=\"size-4 shrink-0 text-muted-foreground\" />\n <span\n className=\"flex min-w-0 flex-1 items-baseline gap-1.5 font-mono\"\n title={data.filename || undefined}\n >\n <span className=\"min-w-0 max-w-[16rem] truncate text-[13px] font-semibold leading-5 text-foreground\">\n {fileParts.basename}\n </span>\n {fileParts.directory && (\n <span className=\"min-w-0 flex-1 truncate text-[11px] leading-5 text-muted-foreground/70\">\n {fileParts.directory}\n </span>\n )}\n </span>\n <span className=\"ml-1 flex shrink-0 items-center gap-2 font-mono text-xs\">\n <span className=\"text-emerald-700 dark:text-emerald-300\">\n +{added}\n </span>\n <span className=\"text-destructive\">βˆ’{removed}</span>\n </span>\n {/* Mode toggle only when split is actually available: annotated diffs\n are unified-only (inline notes), and a narrow container forces\n unified, so the toggle would otherwise be a no-op. */}\n {canSplit && (\n <div className=\"pointer-events-none ml-auto flex shrink-0 items-center overflow-hidden rounded-md border border-border bg-background opacity-0 transition-opacity group-hover/diff-block:pointer-events-auto group-hover/diff-block:opacity-100 group-focus-within/diff-block:pointer-events-auto group-focus-within/diff-block:opacity-100\">\n <ModeButton\n active={mode === \"unified\"}\n onClick={() => setMode(\"unified\")}\n icon={<IconList className=\"size-3.5\" />}\n label=\"Unified\"\n />\n <ModeButton\n active={mode === \"split\"}\n onClick={() => setMode(\"split\")}\n icon={<IconColumns className=\"size-3.5\" />}\n label=\"Split\"\n />\n </div>\n )}\n </div>\n\n {/* Body. */}\n {unchanged ? (\n <div className=\"px-4 py-6 text-center font-mono text-sm text-muted-foreground\">\n No changes\n </div>\n ) : effectiveMode === \"split\" ? (\n <SplitView\n rows={rows}\n language={language}\n rowLimit={rowLimit}\n markersForRow={markersForRow}\n activeIndex={activeIndex}\n onActiveChange={handleActiveChange}\n />\n ) : (\n <UnifiedView\n rows={displayedRows}\n language={language}\n expanded={expanded}\n onToggleRun={toggleRun}\n markersForRow={markersForRow}\n anchoredRow={anchoredRow}\n activeIndex={activeIndex}\n onActiveChange={handleActiveChange}\n />\n )}\n {!unchanged && shouldLimitRows && (\n <button\n type=\"button\"\n data-plan-interactive\n aria-expanded={showAllRows}\n onClick={() => setShowAllRows((current) => !current)}\n className=\"flex h-7 w-full items-center justify-center gap-1.5 border-t border-border bg-background px-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground\"\n >\n <IconChevronRight\n className={cn(\n \"size-3 shrink-0 transition-transform\",\n showAllRows ? \"-rotate-90\" : \"rotate-90\",\n )}\n />\n {showAllRows\n ? \"Show fewer\"\n : `Show all ${totalVisibleLineCount} lines`}\n </button>\n )}\n </div>\n {activeAnnotation && popoverTop != null && (\n <AnnotationPopover\n item={activeAnnotation}\n top={popoverTop}\n onActiveChange={handleActiveChange}\n ctx={ctx}\n />\n )}\n </section>\n );\n}\n\nfunction ModeButton({\n active,\n onClick,\n icon,\n label,\n}: {\n active: boolean;\n onClick: () => void;\n icon: ReactNode;\n label: string;\n}) {\n return (\n <button\n type=\"button\"\n data-plan-interactive\n onClick={onClick}\n aria-pressed={active}\n className={cn(\n \"flex cursor-pointer items-center gap-1 px-2 py-1 text-xs font-medium transition-colors\",\n active\n ? \"bg-accent text-accent-foreground\"\n : \"text-muted-foreground hover:bg-muted/80 hover:text-foreground\",\n )}\n >\n {icon}\n {label}\n </button>\n );\n}\n\n/* ── Annotation wiring shared by both views ────────────────────────────────── */\n\n/** Marker + hover props threaded into the unified/split rows. */\ninterface RowAnnotationProps {\n markersForRow: MarkersForRow;\n anchoredRow?: (row: DiffRow) => boolean;\n activeIndex: number | null;\n onActiveChange: (index: number | null) => void;\n}\n\n/**\n * The numbered marker pip(s) for a row plus the active-state it derives. Returns\n * `null` when the row carries no annotation so unannotated diffs render an empty\n * marker column (or no column at all when the whole diff is unannotated).\n */\nfunction rowMarkerInfo(\n markers: ResolvedAnnotation<DiffAnnotation>[],\n activeIndex: number | null,\n): { isActive: boolean; primaryIndex: number } | null {\n if (markers.length === 0) return null;\n const isActive = markers.some((m) => m.index === activeIndex);\n return { isActive, primaryIndex: markers[0].index };\n}\n\n/** Shared amber wash for an annotated row, brighter when active. */\nfunction annotatedRowBg(info: { isActive: boolean } | null): string | null {\n if (!info) return null;\n return info.isActive\n ? \"bg-amber-400/20 dark:bg-amber-300/15\"\n : \"bg-amber-400/[0.07] dark:bg-amber-300/[0.07]\";\n}\n\n/**\n * Whether `row` is the FIRST line of `marker`'s resolved range. The numbered pip\n * renders only on this line, so a multi-line annotation shows a single marker at\n * the top of its span instead of repeating the same number down every line it\n * covers. The amber band still washes the whole range (via `annotatedRowBg`), so\n * the span stays visually grouped without the column of duplicate numbers.\n */\nfunction isMarkerRangeStart(\n row: DiffRow,\n marker: ResolvedAnnotation<DiffAnnotation>,\n): boolean {\n if (!marker.range) return false;\n const lineNo =\n annotationSide(marker.annotation) === \"before\" ? row.oldNo : row.newNo;\n return lineNo === marker.range.start;\n}\n\n/* ── Unified view ──────────────────────────────────────────────────────────── */\n\nfunction UnifiedView({\n rows,\n language,\n expanded,\n onToggleRun,\n markersForRow,\n anchoredRow,\n activeIndex,\n onActiveChange,\n}: {\n rows: DiffRow[];\n language: string;\n expanded: Set<number>;\n onToggleRun: (index: number) => void;\n} & RowAnnotationProps) {\n const segments = useMemo(\n () => segmentRows(rows, anchoredRow),\n [rows, anchoredRow],\n );\n // Any annotation present β‡’ reserve the marker column so rows stay aligned.\n const showMarkerColumn = useMemo(\n () => rows.some((row) => markersForRow(row).length > 0),\n [rows, markersForRow],\n );\n const rowProps = {\n language,\n markersForRow,\n activeIndex,\n onActiveChange,\n showMarkerColumn,\n };\n let runIndex = 0;\n return (\n <div className=\"overflow-x-auto\">\n <div className=\"w-max min-w-full font-mono [font-size:var(--plan-code-size)] leading-5\">\n {segments.map((segment, idx) => {\n if (\"collapsed\" in segment) {\n const key = runIndex++;\n const open = expanded.has(key);\n return (\n <div key={`run-${key}`}>\n <CollapsedRow\n count={segment.rows.length}\n open={open}\n onClick={() => onToggleRun(key)}\n />\n {open &&\n segment.rows.map((row, ri) => (\n <UnifiedRow\n key={`run-${key}-${ri}`}\n row={row}\n {...rowProps}\n />\n ))}\n </div>\n );\n }\n return <UnifiedRow key={idx} row={segment} {...rowProps} />;\n })}\n </div>\n </div>\n );\n}\n\nfunction UnifiedRow({\n language,\n row,\n markersForRow,\n activeIndex,\n onActiveChange,\n showMarkerColumn,\n}: {\n language: string;\n row: DiffRow;\n markersForRow: MarkersForRow;\n activeIndex: number | null;\n onActiveChange: (index: number | null) => void;\n showMarkerColumn: boolean;\n}) {\n const markers = markersForRow(row);\n const info = rowMarkerInfo(markers, activeIndex);\n const startMarker = markers.find((marker) => isMarkerRangeStart(row, marker));\n return (\n <div\n data-annot-row={startMarker ? startMarker.index : undefined}\n className={cn(\n \"flex min-h-5 min-w-full\",\n ROW_BG[row.kind],\n annotatedRowBg(info),\n )}\n onMouseEnter={info ? () => onActiveChange(info.primaryIndex) : undefined}\n onMouseLeave={info ? () => onActiveChange(null) : undefined}\n >\n <span className={cn(LINE_NO_CLASS, \"w-[52px]\")}>{row.oldNo ?? \"\"}</span>\n <span className={cn(LINE_NO_CLASS, \"w-[52px]\")}>{row.newNo ?? \"\"}</span>\n <span\n className={cn(\n \"w-6 shrink-0 select-none py-0 text-center font-semibold leading-5\",\n GUTTER_BG[row.kind],\n SIGN_COLOR[row.kind],\n )}\n >\n {SIGN[row.kind]}\n </span>\n {showMarkerColumn && (\n <MarkerCell\n startMarker={startMarker}\n active={startMarker != null && startMarker.index === activeIndex}\n />\n )}\n <DiffLineText text={row.text} language={language} />\n </div>\n );\n}\n\n/**\n * The fixed-width marker column rendered between the sign gutter and the code.\n * `startMarker` is set only on the FIRST line of an annotation's range, so the\n * numbered pip appears once at the top of a span; every other row (the rest of a\n * span, and every unannotated row in a diff that has annotations) renders an\n * empty spacer so the code text stays aligned.\n */\nfunction MarkerCell({\n startMarker,\n active,\n}: {\n startMarker?: ResolvedAnnotation<DiffAnnotation>;\n active: boolean;\n}) {\n return (\n <span className=\"flex w-6 shrink-0 select-none items-center justify-center py-0\">\n {startMarker != null && (\n <AnnotationGutterMarker marker={startMarker.marker} active={active} />\n )}\n </span>\n );\n}\n\n/**\n * The hover popover for a diff annotation, pinned in the diff's right margin and\n * vertically centered on the annotated line (`top` is measured by the caller).\n * It shows the marker pip, line range, optional label, and the markdown note β€”\n * beside the code instead of interrupting the diff flow β€” and keeps the\n * annotation active while hovered so the pointer can travel from line to note.\n */\nfunction AnnotationPopover({\n item,\n top,\n onActiveChange,\n ctx,\n}: {\n item: ResolvedAnnotation<DiffAnnotation>;\n top: number;\n onActiveChange: (index: number | null) => void;\n ctx: BlockRenderContext;\n}) {\n return (\n <div\n role=\"tooltip\"\n style={{ top }}\n onMouseEnter={() => onActiveChange(item.index)}\n onMouseLeave={() => onActiveChange(null)}\n className=\"absolute right-2 z-20 w-[min(17rem,calc(100%-3rem))] -translate-y-1/2 rounded-lg border border-amber-400/70 bg-background px-3 py-2.5 shadow-xl dark:border-amber-300/45\"\n >\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-0.5\">\n <AnnotationGutterMarker marker={item.marker} active />\n <span className=\"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground\">\n {rangeLabel(item)}\n </span>\n {item.annotation.label && (\n <span className=\"text-[13px] font-semibold text-foreground\">\n {item.annotation.label}\n </span>\n )}\n </div>\n <div className=\"plan-annotation-note mt-1 text-[13px] leading-relaxed text-foreground/85\">\n {ctx.renderMarkdown ? (\n ctx.renderMarkdown(item.annotation.note)\n ) : (\n <p>{item.annotation.note}</p>\n )}\n </div>\n </div>\n );\n}\n\nfunction CollapsedRow({\n count,\n open,\n onClick,\n}: {\n count: number;\n open: boolean;\n onClick: () => void;\n}) {\n return (\n <button\n type=\"button\"\n data-plan-interactive\n onClick={onClick}\n className=\"flex w-full cursor-pointer items-center gap-2 border-y border-border bg-muted/70 px-3 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\"\n >\n <IconDotsVertical className=\"size-3.5 shrink-0\" />\n <span>\n {open ? \"Hide\" : \"Show\"} {count} unchanged line\n {count === 1 ? \"\" : \"s\"}\n </span>\n </button>\n );\n}\n\n/* ── Split (side-by-side) view ─────────────────────────────────────────────── */\n\ninterface SplitRow {\n left?: DiffRow;\n right?: DiffRow;\n}\n\n/**\n * Pair removed lines (left) with added lines (right) so a modification shows the\n * old and new side by side; context lines mirror on both columns. Leftover adds\n * or removes fall through as half-empty rows (GitHub split behavior).\n */\nfunction pairSplitRows(rows: DiffRow[]): SplitRow[] {\n const out: SplitRow[] = [];\n let i = 0;\n while (i < rows.length) {\n const row = rows[i];\n if (row.kind === \"context\") {\n out.push({ left: row, right: row });\n i += 1;\n continue;\n }\n // Collect a contiguous block of removed-then-added rows.\n const removed: DiffRow[] = [];\n const added: DiffRow[] = [];\n while (i < rows.length && rows[i].kind === \"removed\")\n removed.push(rows[i++]);\n while (i < rows.length && rows[i].kind === \"added\") added.push(rows[i++]);\n const max = Math.max(removed.length, added.length);\n for (let k = 0; k < max; k += 1) {\n out.push({ left: removed[k], right: added[k] });\n }\n }\n return out;\n}\n\nfunction SplitView({\n language,\n rowLimit,\n rows,\n markersForRow,\n activeIndex,\n onActiveChange,\n}: {\n language: string;\n rowLimit?: number;\n rows: DiffRow[];\n} & Omit<RowAnnotationProps, \"anchoredRow\">) {\n const pairs = useMemo(() => pairSplitRows(rows), [rows]);\n const displayedPairs = rowLimit ? pairs.slice(0, rowLimit) : pairs;\n // Reserve the marker column on a side only if any visible row there has one.\n const showOldMarkers = useMemo(\n () =>\n displayedPairs.some(\n (pair) => pair.left && markersForRow(pair.left, \"old\").length > 0,\n ),\n [displayedPairs, markersForRow],\n );\n const showNewMarkers = useMemo(\n () =>\n displayedPairs.some(\n (pair) => pair.right && markersForRow(pair.right, \"new\").length > 0,\n ),\n [displayedPairs, markersForRow],\n );\n const cellProps = { language, markersForRow, activeIndex, onActiveChange };\n return (\n <div className=\"flex w-full bg-background font-mono [font-size:var(--plan-code-size)] leading-5\">\n <div className=\"min-w-0 flex-1 overflow-x-auto border-r border-border\">\n <div className=\"inline-block min-w-full\">\n {displayedPairs.map((pair, idx) => (\n <SplitCell\n key={`old-${idx}`}\n row={pair.left}\n side=\"old\"\n showMarkerColumn={showOldMarkers}\n {...cellProps}\n />\n ))}\n </div>\n </div>\n <div className=\"min-w-0 flex-1 overflow-x-auto\">\n <div className=\"inline-block min-w-full\">\n {displayedPairs.map((pair, idx) => (\n <SplitCell\n key={`new-${idx}`}\n row={pair.right}\n side=\"new\"\n showMarkerColumn={showNewMarkers}\n {...cellProps}\n />\n ))}\n </div>\n </div>\n </div>\n );\n}\n\nfunction SplitCell({\n language,\n row,\n side,\n markersForRow,\n activeIndex,\n onActiveChange,\n showMarkerColumn,\n}: {\n language: string;\n row?: DiffRow;\n side: RowSide;\n markersForRow: MarkersForRow;\n activeIndex: number | null;\n onActiveChange: (index: number | null) => void;\n showMarkerColumn: boolean;\n}) {\n if (!row) {\n return (\n <div className=\"flex min-h-5 min-w-full bg-muted/40 opacity-70\">\n <span className={cn(LINE_NO_CLASS, \"w-[52px]\")} />\n <span className=\"w-6 shrink-0 bg-muted/60\" />\n {showMarkerColumn && <span className=\"w-6 shrink-0\" />}\n <span className={DIFF_LINE_CLASS}> </span>\n </div>\n );\n }\n const sign = side === \"old\" ? \"βˆ’\" : \"+\";\n const showSign = row.kind !== \"context\";\n const markers = markersForRow(row, side);\n const info = rowMarkerInfo(markers, activeIndex);\n const startMarker = markers.find((marker) => isMarkerRangeStart(row, marker));\n return (\n <div\n data-annot-row={startMarker ? startMarker.index : undefined}\n className={cn(\n \"flex min-h-5 min-w-full\",\n ROW_BG[row.kind],\n annotatedRowBg(info),\n )}\n onMouseEnter={info ? () => onActiveChange(info.primaryIndex) : undefined}\n onMouseLeave={info ? () => onActiveChange(null) : undefined}\n >\n <span className={cn(LINE_NO_CLASS, \"w-[52px]\")}>\n {side === \"old\" ? (row.oldNo ?? \"\") : (row.newNo ?? \"\")}\n </span>\n <span\n className={cn(\n \"w-6 shrink-0 select-none py-0 text-center font-semibold leading-5\",\n GUTTER_BG[row.kind],\n SIGN_COLOR[row.kind],\n )}\n >\n {showSign ? sign : \" \"}\n </span>\n {showMarkerColumn && (\n <MarkerCell\n startMarker={startMarker}\n active={startMarker != null && startMarker.index === activeIndex}\n />\n )}\n <DiffLineText text={row.text} language={language} />\n </div>\n );\n}\n\n/* ── Edit (panel) ──────────────────────────────────────────────────────────── */\n\nconst codeAreaClass =\n \"min-h-[140px] font-mono [font-size:var(--plan-code-size)] leading-5\";\n\nfunction DiffEdit({ data, onChange, editable }: BlockEditProps<DiffData>) {\n const patch = (next: Partial<DiffData>) => onChange({ ...data, ...next });\n const mode: DiffMode = data.mode ?? \"unified\";\n const annotations = data.annotations ?? [];\n\n const updateAnnotation = (index: number, next: Partial<DiffAnnotation>) =>\n patch({\n annotations: annotations.map((annotation, i) =>\n i === index ? { ...annotation, ...next } : annotation,\n ),\n });\n\n const removeAnnotation = (index: number) =>\n patch({ annotations: annotations.filter((_, i) => i !== index) });\n\n const addAnnotation = () => {\n if (annotations.length >= 80) return; // schema max\n patch({\n annotations: [\n ...annotations,\n { side: \"after\", lines: \"1\", label: \"\", note: \"\" },\n ],\n });\n };\n\n return (\n <div className=\"flex flex-col gap-3\" data-plan-interactive>\n <div className=\"grid gap-3 sm:grid-cols-2\">\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel htmlFor=\"diff-filename\" className=\"text-xs\">\n Filename\n </DevLabel>\n <DevInput\n id=\"diff-filename\"\n value={data.filename ?? \"\"}\n placeholder=\"src/add.ts\"\n disabled={!editable}\n onChange={(event) =>\n patch({ filename: event.target.value || undefined })\n }\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel htmlFor=\"diff-language\" className=\"text-xs\">\n Language\n </DevLabel>\n <DevInput\n id=\"diff-language\"\n value={data.language ?? \"\"}\n placeholder=\"ts\"\n disabled={!editable}\n onChange={(event) =>\n patch({ language: event.target.value || undefined })\n }\n />\n </div>\n </div>\n\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel className=\"text-xs\">Layout</DevLabel>\n <DevSelect\n value={mode}\n disabled={!editable}\n onValueChange={(value) => patch({ mode: value as DiffMode })}\n options={[\n { value: \"unified\", label: \"Unified\" },\n { value: \"split\", label: \"Split (side-by-side)\" },\n ]}\n />\n </div>\n\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel htmlFor=\"diff-before\" className=\"text-xs\">\n Before\n </DevLabel>\n <DevTextarea\n id=\"diff-before\"\n spellCheck={false}\n className={codeAreaClass}\n value={data.before}\n disabled={!editable}\n onChange={(event) => patch({ before: event.target.value })}\n />\n </div>\n\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel htmlFor=\"diff-after\" className=\"text-xs\">\n After\n </DevLabel>\n <DevTextarea\n id=\"diff-after\"\n spellCheck={false}\n className={codeAreaClass}\n value={data.after}\n disabled={!editable}\n onChange={(event) => patch({ after: event.target.value })}\n />\n </div>\n\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center justify-between\">\n <DevLabel className=\"text-xs\">Annotations</DevLabel>\n {editable && annotations.length < 80 && (\n <button\n type=\"button\"\n data-plan-interactive\n onClick={addAnnotation}\n className=\"flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-plan-muted transition-colors hover:bg-plan-block/60 hover:text-plan-text\"\n >\n <IconPlus className=\"size-3.5\" />\n Add annotation\n </button>\n )}\n </div>\n {annotations.length === 0 && (\n <p className=\"text-xs text-plan-muted\">\n No annotations yet. Add one to anchor a note to a line range on the\n before or after side.\n </p>\n )}\n {annotations.map((annotation, index) => (\n <div\n key={index}\n className=\"flex flex-col gap-2 rounded-md border border-plan-line bg-plan-block/30 p-2\"\n >\n <div className=\"grid gap-2 sm:grid-cols-[110px_110px_minmax(0,1fr)_auto]\">\n <DevSelect\n aria-label={`Annotation ${index + 1} side`}\n value={annotation.side ?? \"after\"}\n disabled={!editable}\n onValueChange={(value) =>\n updateAnnotation(index, {\n side: value as DiffAnnotation[\"side\"],\n })\n }\n options={[\n { value: \"after\", label: \"After\" },\n { value: \"before\", label: \"Before\" },\n ]}\n />\n <DevInput\n aria-label={`Annotation ${index + 1} lines`}\n value={annotation.lines}\n placeholder=\"3-5\"\n disabled={!editable}\n onChange={(event) =>\n updateAnnotation(index, { lines: event.target.value })\n }\n />\n <DevInput\n aria-label={`Annotation ${index + 1} label`}\n value={annotation.label ?? \"\"}\n placeholder=\"Label (optional)\"\n disabled={!editable}\n onChange={(event) =>\n updateAnnotation(index, {\n label: event.target.value || undefined,\n })\n }\n />\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n aria-label={`Remove annotation ${index + 1}`}\n onClick={() => removeAnnotation(index)}\n className=\"flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-md text-plan-muted transition-colors hover:bg-muted hover:text-foreground\"\n >\n <IconTrash className=\"size-4\" />\n </button>\n )}\n </div>\n <DevTextarea\n aria-label={`Annotation ${index + 1} note`}\n className=\"min-h-[60px] text-sm\"\n value={annotation.note}\n placeholder=\"Explain what these lines do…\"\n disabled={!editable}\n onChange={(event) =>\n updateAnnotation(index, { note: event.target.value })\n }\n />\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nexport { DiffRead, DiffEdit };\n"]}
1
+ {"version":3,"file":"DiffBlock.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/DiffBlock.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,CAAC,EAAE,EAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EACtC,SAAS,EAAC,mJAAmJ,YAE7J,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,GAAG,GACzB,CACV,IACG,EACN,KAAC,WAAW,kBACE,cAAc,KAAK,GAAG,CAAC,OAAO,EAC1C,SAAS,EAAC,sBAAsB,EAChC,KAAK,EAAE,UAAU,CAAC,IAAI,EACtB,WAAW,EAAC,mCAA8B,EAC1C,QAAQ,EAAE,CAAC,QAAQ,EACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,gBAAgB,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAEvD,KA3DG,KAAK,CA4DN,CACP,CAAC,IACE,IACF,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport {\n IconChevronRight,\n IconColumns,\n IconDotsVertical,\n IconFileDiff,\n IconList,\n IconPlus,\n IconTrash,\n} from \"@tabler/icons-react\";\nimport { common, createLowlight } from \"lowlight\";\nimport { cn } from \"../../utils.js\";\nimport type { BlockEditProps, BlockReadProps } from \"../types.js\";\nimport type { DiffAnnotation, DiffData, DiffMode } from \"./diff.config.js\";\nimport {\n AnnotationGutterMarker,\n AnnotationHiddenStack,\n AnnotationHoverCard,\n anchorFromElements,\n buildLineMarkerMap,\n hasRailAnnotations,\n resolveAnnotations,\n useAnnotationHover,\n type ResolvedAnnotation,\n} from \"./annotation-rail.js\";\nimport { DevInput, DevLabel, DevTextarea, DevSelect } from \"./dev-doc-ui.js\";\n\n/**\n * GitHub-style before/after diff block. The read renderer computes a line-level\n * diff, then renders it either unified (one column, `+`/`βˆ’` gutters) or split\n * (side-by-side). Long unchanged runs collapse into an expandable \"N unchanged\n * lines\" row (progressive disclosure). The read surface keeps the GitHub diff\n * shape while using the framework Tailwind theme tokens, so it follows each\n * host app's light/dark appearance instead of bringing its own palette.\n *\n * Lives in core so any app can register the dev-doc block. The line differ is\n * inlined (a small LCS-based `diffLines`) rather than pulling the `diff` package\n * into core; the output shape (`{ value, added, removed }` change records) is\n * identical to what the read renderer consumed before.\n *\n * Editing is panel-driven (config-style, like the HTML block): two monospace\n * textareas (Before / After) plus filename, language, and mode controls.\n */\n\n/* ── Inline line differ (LCS) β€” replaces jsdiff `diffLines` ─────────────────── */\n\ninterface Change {\n value: string;\n added?: boolean;\n removed?: boolean;\n}\n\n/**\n * Split text into lines, each KEEPING its trailing newline (so the change\n * `value`s concatenate back to the original and `splitLines` below behaves the\n * same as it did against jsdiff output).\n */\nfunction toLineTokens(text: string): string[] {\n if (text === \"\") return [];\n const out: string[] = [];\n let start = 0;\n for (let i = 0; i < text.length; i += 1) {\n if (text[i] === \"\\n\") {\n out.push(text.slice(start, i + 1));\n start = i + 1;\n }\n }\n if (start < text.length) out.push(text.slice(start));\n return out;\n}\n\n/**\n * A minimal line-level diff producing jsdiff-compatible `Change[]` records\n * (`{ value }` for context, `{ value, added: true }`, `{ value, removed: true }`).\n * Uses a classic LCS table over line tokens; the inputs here are short code\n * snippets so the O(nΒ·m) table is fine. Removed lines are emitted before added\n * lines within a change region, matching jsdiff's ordering.\n */\nexport function diffLines(before: string, after: string): Change[] {\n const a = toLineTokens(before);\n const b = toLineTokens(after);\n const n = a.length;\n const m = b.length;\n const cells = (n + 1) * (m + 1);\n\n if (cells > MAX_DIFF_LCS_CELLS) {\n return [\n ...(before ? [{ value: before, removed: true }] : []),\n ...(after ? [{ value: after, added: true }] : []),\n ];\n }\n\n // LCS length table.\n const lcs: number[][] = Array.from({ length: n + 1 }, () =>\n new Array<number>(m + 1).fill(0),\n );\n for (let i = n - 1; i >= 0; i -= 1) {\n for (let j = m - 1; j >= 0; j -= 1) {\n lcs[i][j] =\n a[i] === b[j]\n ? lcs[i + 1][j + 1] + 1\n : Math.max(lcs[i + 1][j], lcs[i][j + 1]);\n }\n }\n\n const changes: Change[] = [];\n // Push a token onto the last change if same kind, else open a new change.\n const push = (value: string, kind: \"context\" | \"added\" | \"removed\") => {\n const last = changes[changes.length - 1];\n const sameKind =\n last &&\n Boolean(last.added) === (kind === \"added\") &&\n Boolean(last.removed) === (kind === \"removed\");\n if (sameKind) {\n last.value += value;\n } else {\n changes.push({\n value,\n added: kind === \"added\" ? true : undefined,\n removed: kind === \"removed\" ? true : undefined,\n });\n }\n };\n\n let i = 0;\n let j = 0;\n while (i < n && j < m) {\n if (a[i] === b[j]) {\n push(a[i], \"context\");\n i += 1;\n j += 1;\n } else if (lcs[i + 1][j] >= lcs[i][j + 1]) {\n push(a[i], \"removed\");\n i += 1;\n } else {\n push(b[j], \"added\");\n j += 1;\n }\n }\n while (i < n) {\n push(a[i], \"removed\");\n i += 1;\n }\n while (j < m) {\n push(b[j], \"added\");\n j += 1;\n }\n return changes;\n}\n\n/* ── Syntax highlighting ───────────────────────────────────────────────────── */\n\nconst lowlight = createLowlight(common);\n\ntype LowlightNode = {\n type: string;\n value?: string;\n properties?: {\n className?: string[] | string;\n };\n children?: LowlightNode[];\n};\n\nconst LANGUAGE_ALIASES: Record<string, string> = {\n cjs: \"javascript\",\n cts: \"typescript\",\n htm: \"html\",\n js: \"javascript\",\n jsonc: \"json\",\n jsx: \"jsx\",\n md: \"markdown\",\n mdx: \"markdown\",\n mjs: \"javascript\",\n mts: \"typescript\",\n py: \"python\",\n rb: \"ruby\",\n rs: \"rust\",\n sh: \"bash\",\n shell: \"bash\",\n ts: \"typescript\",\n tsx: \"tsx\",\n yml: \"yaml\",\n zsh: \"bash\",\n};\n\nconst TOKEN_CLASS_NAMES: Record<string, string> = {\n \"hljs-addition\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-attr\": \"text-primary\",\n \"hljs-attribute\": \"text-primary\",\n \"hljs-built_in\": \"text-amber-700 dark:text-amber-300\",\n \"hljs-bullet\": \"text-primary\",\n \"hljs-comment\": \"text-muted-foreground italic\",\n \"hljs-deletion\": \"text-destructive\",\n \"hljs-doctag\": \"text-destructive\",\n \"hljs-emphasis\": \"italic\",\n \"hljs-formula\": \"text-destructive\",\n \"hljs-keyword\": \"text-destructive\",\n \"hljs-link\": \"text-primary underline-offset-2\",\n \"hljs-literal\": \"text-primary\",\n \"hljs-meta\": \"text-primary\",\n \"hljs-meta-string\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-name\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-number\": \"text-primary\",\n \"hljs-params\": \"text-primary\",\n \"hljs-property\": \"text-primary\",\n \"hljs-quote\": \"text-muted-foreground italic\",\n \"hljs-regexp\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-section\": \"text-violet-700 dark:text-violet-300\",\n \"hljs-selector-attr\": \"text-primary\",\n \"hljs-selector-class\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-selector-id\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-selector-pseudo\": \"text-primary\",\n \"hljs-selector-tag\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-string\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-strong\": \"font-semibold\",\n \"hljs-subst\": \"text-destructive\",\n \"hljs-symbol\": \"text-primary\",\n \"hljs-tag\": \"text-emerald-700 dark:text-emerald-300\",\n \"hljs-template-variable\": \"text-amber-700 dark:text-amber-300\",\n \"hljs-title\": \"text-violet-700 dark:text-violet-300\",\n \"hljs-type\": \"text-amber-700 dark:text-amber-300\",\n \"hljs-variable\": \"text-amber-700 dark:text-amber-300\",\n language_: \"text-amber-700 dark:text-amber-300\",\n};\n\nfunction normalizeLanguage(value?: string | null): string | null {\n const raw = value?.trim().toLowerCase();\n if (!raw) return null;\n const normalized = LANGUAGE_ALIASES[raw] ?? raw;\n return lowlight.registered(normalized) ? normalized : null;\n}\n\nfunction getLanguageFromFilename(filename?: string): string | null {\n const basename = filename?.split(\"/\").pop()?.toLowerCase();\n if (!basename) return null;\n if (basename === \"dockerfile\") return normalizeLanguage(\"bash\");\n if (basename === \"makefile\") return normalizeLanguage(\"makefile\");\n const ext = basename.includes(\".\") ? basename.split(\".\").pop() : basename;\n return normalizeLanguage(ext);\n}\n\nfunction resolveDiffLanguage(data: DiffData): string {\n return (\n normalizeLanguage(data.language) ??\n getLanguageFromFilename(data.filename) ??\n \"plaintext\"\n );\n}\n\nfunction tokenClassName(className?: string[] | string): string | undefined {\n const classes = Array.isArray(className)\n ? className\n : className\n ? className.split(/\\s+/)\n : [];\n const mapped = classes\n .map((name) => TOKEN_CLASS_NAMES[name])\n .filter(Boolean)\n .join(\" \");\n return mapped || undefined;\n}\n\nfunction hastToReact(children: LowlightNode[], keyPrefix: string): ReactNode[] {\n return children.map((node, index) => {\n if (node.type === \"text\") return node.value ?? \"\";\n if (node.type === \"element\") {\n const key = `${keyPrefix}${index}`;\n const renderedChildren = node.children?.length\n ? hastToReact(node.children, `${key}-`)\n : null;\n const className = tokenClassName(node.properties?.className);\n if (className) {\n return (\n <span key={key} className={className}>\n {renderedChildren}\n </span>\n );\n }\n return <span key={key}>{renderedChildren}</span>;\n }\n return null;\n });\n}\n\nfunction SyntaxHighlightedLine({\n code,\n language,\n}: {\n code: string;\n language: string;\n}) {\n const highlighted = useMemo(() => {\n if (!code.trim() || language === \"plaintext\" || language === \"text\") {\n return null;\n }\n try {\n const tree = lowlight.highlight(language, code) as LowlightNode;\n return hastToReact(tree.children ?? [], `${language}-`);\n } catch {\n return null;\n }\n }, [code, language]);\n\n return <>{highlighted ?? code}</>;\n}\n\n/* ── Diff model ────────────────────────────────────────────────────────────── */\n\ntype DiffRowKind = \"context\" | \"added\" | \"removed\";\n\ninterface DiffRow {\n kind: DiffRowKind;\n /** Line number in the OLD file (omitted for added rows). */\n oldNo?: number;\n /** Line number in the NEW file (omitted for removed rows). */\n newNo?: number;\n text: string;\n}\n\n/** A contiguous run of context lines collapsed when longer than the threshold. */\ninterface CollapsedRun {\n collapsed: true;\n rows: DiffRow[];\n}\n\ntype DiffSegment = DiffRow | CollapsedRun;\n\n/** Which column a split-view row belongs to (the unified view passes nothing). */\ntype RowSide = \"old\" | \"new\";\n\n/**\n * Resolve the markers landing on a row. `side` scopes the lookup to one column\n * in the split view (so a left cell only lights from `before` annotations and a\n * right cell from `after`); the unified view omits it to merge both sides.\n */\ntype MarkersForRow = (\n row: DiffRow,\n side?: RowSide,\n) => ResolvedAnnotation<DiffAnnotation>[];\n\n/** The default side an annotation targets when `side` is omitted. */\nfunction annotationSide(annotation: DiffAnnotation): \"before\" | \"after\" {\n return annotation.side === \"before\" ? \"before\" : \"after\";\n}\n\n/**\n * Count 1-based source lines in a side's text, matching how `buildRows` numbers\n * `oldNo`/`newNo`: a trailing newline does not add a phantom final line.\n */\nfunction countLines(text: string): number {\n if (text === \"\") return 0;\n return splitLines(text).length;\n}\n\n/** Number of context lines above which an unchanged run is collapsed. */\nconst COLLAPSE_THRESHOLD = 6;\n/** Context lines kept visible at each edge of a collapsed run. */\nconst CONTEXT_EDGE = 3;\n\n/**\n * Split a change `value` into individual lines. Most hunks carry a trailing\n * newline; drop the empty final element it produces so a 2-line change does not\n * render a phantom 3rd blank line.\n */\nfunction splitLines(value: string): string[] {\n const lines = value.split(\"\\n\");\n if (lines.length > 0 && lines[lines.length - 1] === \"\") lines.pop();\n return lines;\n}\n\n/** Flatten change objects into numbered diff rows. */\nfunction buildRows(changes: Change[]): DiffRow[] {\n const rows: DiffRow[] = [];\n let oldNo = 0;\n let newNo = 0;\n for (const change of changes) {\n const lines = splitLines(change.value);\n for (const text of lines) {\n if (change.added) {\n newNo += 1;\n rows.push({ kind: \"added\", newNo, text });\n } else if (change.removed) {\n oldNo += 1;\n rows.push({ kind: \"removed\", oldNo, text });\n } else {\n oldNo += 1;\n newNo += 1;\n rows.push({ kind: \"context\", oldNo, newNo, text });\n }\n }\n }\n return rows;\n}\n\n/**\n * Group rows into segments, collapsing interior runs of >COLLAPSE_THRESHOLD\n * context rows (keeping CONTEXT_EDGE visible at each side). Leading/trailing runs\n * collapse too, but keep only the inner edge visible.\n *\n * `isAnchored` marks context rows that carry an annotation (or sit adjacent to\n * one): an anchored row is NEVER hidden inside a collapsed run, so a note that\n * targets an unchanged line stays reachable. An anchor splits its run into the\n * separately-collapsible spans on either side of it, with CONTEXT_EDGE rows kept\n * visible around the anchor.\n */\nfunction segmentRows(\n rows: DiffRow[],\n isAnchored?: (row: DiffRow) => boolean,\n): DiffSegment[] {\n const segments: DiffSegment[] = [];\n\n // Collapse one contiguous context run [from, to) that contains NO anchors.\n const collapseRun = (run: DiffRow[], atStart: boolean, atEnd: boolean) => {\n if (run.length <= COLLAPSE_THRESHOLD) {\n for (const row of run) segments.push(row);\n return;\n }\n const head = atStart ? [] : run.slice(0, CONTEXT_EDGE);\n const tail = atEnd ? [] : run.slice(run.length - CONTEXT_EDGE);\n const hidden = run.slice(head.length, run.length - tail.length);\n for (const row of head) segments.push(row);\n if (hidden.length > 0) segments.push({ collapsed: true, rows: hidden });\n for (const row of tail) segments.push(row);\n };\n\n let i = 0;\n while (i < rows.length) {\n if (rows[i].kind !== \"context\") {\n segments.push(rows[i]);\n i += 1;\n continue;\n }\n // Gather the full contiguous context run.\n let j = i;\n while (j < rows.length && rows[j].kind === \"context\") j += 1;\n const fullRun = rows.slice(i, j);\n const runAtStart = i === 0;\n const runAtEnd = j === rows.length;\n\n if (!isAnchored || !fullRun.some(isAnchored)) {\n collapseRun(fullRun, runAtStart, runAtEnd);\n } else {\n // Walk the run, emitting anchored rows verbatim and collapsing the\n // unanchored spans between them. An anchored row is always visible; the\n // spans on each side of it collapse independently.\n let spanStart = 0;\n for (let k = 0; k <= fullRun.length; k += 1) {\n const atAnchor = k < fullRun.length && isAnchored(fullRun[k]);\n if (atAnchor || k === fullRun.length) {\n const span = fullRun.slice(spanStart, k);\n if (span.length > 0) {\n collapseRun(\n span,\n runAtStart && spanStart === 0,\n runAtEnd && k === fullRun.length,\n );\n }\n if (k < fullRun.length) segments.push(fullRun[k]);\n spanStart = k + 1;\n }\n }\n }\n i = j;\n }\n return segments;\n}\n\n/* ── Theme-aware row styling (light + dark) ────────────────────────────────── */\n\nconst ROW_BG: Record<DiffRowKind, string> = {\n added: \"bg-emerald-500/10 dark:bg-emerald-500/15\",\n removed: \"bg-destructive/10\",\n context: \"bg-background\",\n};\n\nconst GUTTER_BG: Record<DiffRowKind, string> = {\n added: \"bg-emerald-500/15 dark:bg-emerald-500/20\",\n removed: \"bg-destructive/15\",\n context: \"bg-muted/60\",\n};\n\nconst SIGN_COLOR: Record<DiffRowKind, string> = {\n added: \"text-emerald-700 dark:text-emerald-300\",\n removed: \"text-destructive\",\n context: \"text-muted-foreground\",\n};\n\nconst SIGN: Record<DiffRowKind, string> = {\n added: \"+\",\n removed: \"βˆ’\",\n context: \" \",\n};\n\nconst LINE_NO_CLASS =\n \"select-none px-2 py-0 text-right font-mono [font-size:var(--plan-doc-code-size)] leading-5 text-muted-foreground tabular-nums\";\n\nconst DIFF_LINE_CLASS =\n \"block min-w-max flex-1 whitespace-pre px-2 py-0 font-mono [font-size:var(--plan-doc-code-size)] leading-5 text-foreground\";\n\nconst DEFAULT_VISIBLE_DIFF_LINES = 15;\nconst MAX_DIFF_LCS_CELLS = 1_000_000;\n\n/**\n * Below this rendered container width (px) a diff drops side-by-side `split`\n * mode and falls back to `unified`: split's two line-number gutters double the\n * width the code needs, exactly where space is tightest (e.g. a diff nested in a\n * vertical-tabs content column). Measured from the block's own box, not the\n * viewport, so the fallback fires by available width at any nesting depth.\n */\nconst SPLIT_MIN_WIDTH = 560;\n\n/**\n * Observe the rendered inline width of an element. Returns a ref to attach plus\n * the measured content-box width (null until the first ResizeObserver tick).\n * Lets the diff pick an effective mode from the width it was actually handed β€” a\n * measurement CSS container queries can't drive, since switching split↔unified\n * is a structural (DOM) change, not a style toggle.\n */\nfunction useContainerWidth<T extends HTMLElement>() {\n const ref = useRef<T | null>(null);\n const [width, setWidth] = useState<number | null>(null);\n useEffect(() => {\n const el = ref.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setWidth(entry.contentRect.width);\n });\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n return [ref, width] as const;\n}\n\nfunction splitDiffFilename(filename?: string): {\n basename: string;\n directory: string | null;\n} {\n const value = filename?.trim() || \"diff\";\n const segments = value.split(\"/\").filter(Boolean);\n const basename = segments[segments.length - 1] ?? value;\n const directory =\n segments.length > 1 ? segments.slice(0, -1).join(\"/\") : null;\n return { basename, directory };\n}\n\nfunction DiffLineText({ language, text }: { language: string; text: string }) {\n const code = text || \" \";\n return (\n <span className={DIFF_LINE_CLASS}>\n <SyntaxHighlightedLine code={code} language={language} />\n </span>\n );\n}\n\n/* ── Read ──────────────────────────────────────────────────────────────────── */\n\nfunction DiffRead({\n data,\n blockId,\n title,\n summary,\n ctx,\n}: BlockReadProps<DiffData>) {\n const [mode, setMode] = useState<DiffMode>(data.mode ?? \"unified\");\n const [expanded, setExpanded] = useState<Set<number>>(() => new Set());\n const [showAllRows, setShowAllRows] = useState(false);\n const [containerRef, containerWidth] = useContainerWidth<HTMLElement>();\n // On-hover popover (anchored to the right of the code) replaces the old\n // persistent rail: nothing is shown when idle. `codeRef` measures the code\n // box's right edge; `hover` carries the active index + captured geometry.\n const hover = useAnnotationHover();\n const { activeIndex } = hover;\n const codeRef = useRef<HTMLDivElement | null>(null);\n\n const rows = useMemo(\n () => buildRows(diffLines(data.before, data.after)),\n [data.before, data.after],\n );\n const language = useMemo(\n () => resolveDiffLanguage(data),\n [data.filename, data.language],\n );\n const fileParts = useMemo(\n () => splitDiffFilename(data.filename),\n [data.filename],\n );\n const splitLineCount = useMemo(() => pairSplitRows(rows).length, [rows]);\n\n // Resolve annotations against the side they target. A `before` annotation's\n // `lines` ref is clamped to the OLD file's line count and matched on `oldNo`;\n // an `after` (default) ref to the NEW file and matched on `newNo`. Markers are\n // authoring-order across BOTH sides so a note ↔ row ↔ rail card share one id.\n const beforeLineCount = useMemo(() => countLines(data.before), [data.before]);\n const afterLineCount = useMemo(() => countLines(data.after), [data.after]);\n const resolved = useMemo(\n () =>\n resolveAnnotations(data.annotations, (annotation) =>\n annotationSide(annotation) === \"before\"\n ? beforeLineCount\n : afterLineCount,\n ),\n [data.annotations, beforeLineCount, afterLineCount],\n );\n const hasAnnotations = hasRailAnnotations(resolved);\n // Effective render mode. Annotations live in a SEPARATE right-hand rail (not\n // over the code), so they no longer force a mode; only a container narrower\n // than SPLIT_MIN_WIDTH falls back to unified so split's doubled gutters never\n // crush the code. `canSplit` also gates the mode toggle (hidden when narrow).\n const narrow = containerWidth != null && containerWidth < SPLIT_MIN_WIDTH;\n const canSplit = !narrow;\n const effectiveMode: DiffMode = canSplit ? mode : \"unified\";\n\n // Annotations (diff): NO persistent column. Hovering a marked code line (or\n // its numbered pip) opens THAT note's card as an on-hover popover anchored to\n // the RIGHT of the code box, never over the code. The in-code pip stays as the\n // anchor indicator + active-line highlight. `onRowEnter` captures the code\n // box's right edge + the hovered row's vertical position to place the card;\n // `onRowLeave` schedules a short-delay close so the pointer can cross the gap\n // into the card (which cancels the close while hovered).\n const onRowEnter = useCallback(\n (index: number, rowEl: HTMLElement) => {\n const anchor = anchorFromElements(codeRef.current, rowEl);\n if (anchor) hover.open(index, anchor);\n },\n [hover],\n );\n const onRowLeave = useCallback(() => hover.scheduleClose(), [hover]);\n // Side-scoped line β†’ markers maps so a row only lights from its own side.\n const beforeMarkers = useMemo(\n () =>\n buildLineMarkerMap(\n resolved.filter((r) => annotationSide(r.annotation) === \"before\"),\n ),\n [resolved],\n );\n const afterMarkers = useMemo(\n () =>\n buildLineMarkerMap(\n resolved.filter((r) => annotationSide(r.annotation) !== \"before\"),\n ),\n [resolved],\n );\n const markersForRow = useMemo<MarkersForRow>(() => {\n return (row, side) => {\n const out: ResolvedAnnotation<DiffAnnotation>[] = [];\n if (\n (side === undefined || side === \"old\") &&\n row.oldNo != null &&\n row.kind !== \"added\"\n ) {\n out.push(...(beforeMarkers.get(row.oldNo) ?? []));\n }\n if (\n (side === undefined || side === \"new\") &&\n row.newNo != null &&\n row.kind !== \"removed\"\n ) {\n out.push(...(afterMarkers.get(row.newNo) ?? []));\n }\n return out;\n };\n }, [beforeMarkers, afterMarkers]);\n // A context row that carries a marker is an anchor: never collapse it away.\n const anchoredRow = useMemo(() => {\n if (!hasAnnotations) return undefined;\n return (row: DiffRow) => markersForRow(row).length > 0;\n }, [hasAnnotations, markersForRow]);\n\n // The resolved annotation whose card is currently shown on hover.\n const activeItem = useMemo<ResolvedAnnotation<DiffAnnotation> | null>(\n () =>\n activeIndex == null\n ? null\n : (resolved.find((item) => item.index === activeIndex) ?? null),\n [activeIndex, resolved],\n );\n\n const added = rows.filter((r) => r.kind === \"added\").length;\n const removed = rows.filter((r) => r.kind === \"removed\").length;\n const unchanged = data.before === data.after;\n const totalVisibleLineCount =\n effectiveMode === \"split\" ? splitLineCount : rows.length;\n const shouldLimitRows = totalVisibleLineCount > DEFAULT_VISIBLE_DIFF_LINES;\n // Never truncate away an annotated row: extend the window past the last one.\n const effectiveRowLimit = useMemo(() => {\n if (showAllRows || !shouldLimitRows) return undefined;\n let limit = DEFAULT_VISIBLE_DIFF_LINES;\n if (hasAnnotations) {\n for (let idx = rows.length - 1; idx >= limit; idx -= 1) {\n if (markersForRow(rows[idx]).length > 0) {\n limit = idx + 1;\n break;\n }\n }\n }\n return limit;\n }, [showAllRows, shouldLimitRows, hasAnnotations, rows, markersForRow]);\n const rowLimit = effectiveRowLimit;\n const displayedRows =\n effectiveMode === \"unified\" && rowLimit ? rows.slice(0, rowLimit) : rows;\n\n const toggleRun = (index: number) =>\n setExpanded((prev) => {\n const next = new Set(prev);\n if (next.has(index)) next.delete(index);\n else next.add(index);\n return next;\n });\n\n // The bordered code box. It always spans its full width β€” annotations surface\n // as an on-hover popover anchored to this box's right edge, never as a column.\n // `codeRef` measures that right edge for the popover's placement.\n const diffBox = (\n <div\n ref={codeRef}\n className=\"overflow-hidden rounded-md border border-border bg-background\"\n >\n {/* Header: filename, path, +/βˆ’ counts, mode toggle. */}\n <div className=\"flex min-h-10 flex-wrap items-center gap-2 border-b border-border bg-muted/60 px-3 py-1.5\">\n <IconFileDiff className=\"size-4 shrink-0 text-muted-foreground\" />\n <span\n className=\"flex min-w-0 flex-1 items-baseline gap-1.5 font-mono\"\n title={data.filename || undefined}\n >\n <span className=\"min-w-0 max-w-[16rem] truncate text-[13px] font-semibold leading-5 text-foreground\">\n {fileParts.basename}\n </span>\n {fileParts.directory && (\n <span className=\"min-w-0 flex-1 truncate text-[11px] leading-5 text-muted-foreground/70\">\n {fileParts.directory}\n </span>\n )}\n </span>\n <span className=\"ml-1 flex shrink-0 items-center gap-2 font-mono text-xs\">\n <span className=\"text-emerald-700 dark:text-emerald-300\">\n +{added}\n </span>\n <span className=\"text-destructive\">βˆ’{removed}</span>\n </span>\n {/* Mode toggle only when split is actually available: a narrow\n container forces unified (split's doubled gutters would crush the\n code), so the toggle would otherwise be a no-op. Annotations are an\n on-hover popover now, so they work in both unified and split. */}\n {canSplit && (\n <div className=\"pointer-events-none ml-auto flex shrink-0 items-center overflow-hidden rounded-md border border-border bg-background opacity-0 transition-opacity group-hover/diff-block:pointer-events-auto group-hover/diff-block:opacity-100 group-focus-within/diff-block:pointer-events-auto group-focus-within/diff-block:opacity-100\">\n <ModeButton\n active={mode === \"unified\"}\n onClick={() => setMode(\"unified\")}\n icon={<IconList className=\"size-3.5\" />}\n label=\"Unified\"\n />\n <ModeButton\n active={mode === \"split\"}\n onClick={() => setMode(\"split\")}\n icon={<IconColumns className=\"size-3.5\" />}\n label=\"Split\"\n />\n </div>\n )}\n </div>\n\n {/* Body. */}\n {unchanged ? (\n <div className=\"px-4 py-6 text-center font-mono text-sm text-muted-foreground\">\n No changes\n </div>\n ) : effectiveMode === \"split\" ? (\n <SplitView\n rows={rows}\n language={language}\n rowLimit={rowLimit}\n markersForRow={markersForRow}\n activeIndex={activeIndex}\n onRowEnter={onRowEnter}\n onRowLeave={onRowLeave}\n />\n ) : (\n <UnifiedView\n rows={displayedRows}\n language={language}\n expanded={expanded}\n onToggleRun={toggleRun}\n markersForRow={markersForRow}\n anchoredRow={anchoredRow}\n activeIndex={activeIndex}\n onRowEnter={onRowEnter}\n onRowLeave={onRowLeave}\n />\n )}\n {!unchanged && shouldLimitRows && (\n <button\n type=\"button\"\n data-plan-interactive\n aria-expanded={showAllRows}\n onClick={() => setShowAllRows((current) => !current)}\n className=\"flex h-7 w-full items-center justify-center gap-1.5 border-t border-border bg-background px-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground\"\n >\n <IconChevronRight\n className={cn(\n \"size-3 shrink-0 transition-transform\",\n showAllRows ? \"-rotate-90\" : \"rotate-90\",\n )}\n />\n {showAllRows\n ? \"Show fewer\"\n : `Show all ${totalVisibleLineCount} lines`}\n </button>\n )}\n </div>\n );\n\n return (\n <section\n ref={containerRef}\n className=\"relative plan-block group/diff-block\"\n data-block-id={blockId}\n >\n {title && <div className=\"plan-block-label\">{title}</div>}\n {summary && (\n <p className=\"mb-3 text-sm leading-relaxed text-plan-muted\">\n {summary}\n </p>\n )}\n {/* The diff keeps its full width β€” no persistent annotation column. The\n in-code numbered pips remain the hover anchors; notes live in a\n visually-hidden stack (a11y + tests) and surface ONE at a time as an\n on-hover popover anchored to the right of the code box. */}\n {diffBox}\n {hasAnnotations && (\n <AnnotationHiddenStack items={resolved} ctx={ctx} showMarker />\n )}\n {hasAnnotations && activeItem && hover.anchor && (\n <AnnotationHoverCard\n item={activeItem}\n anchor={hover.anchor}\n ctx={ctx}\n showMarker\n onMouseEnter={hover.cancelClose}\n onMouseLeave={hover.scheduleClose}\n />\n )}\n </section>\n );\n}\n\nfunction ModeButton({\n active,\n onClick,\n icon,\n label,\n}: {\n active: boolean;\n onClick: () => void;\n icon: ReactNode;\n label: string;\n}) {\n return (\n <button\n type=\"button\"\n data-plan-interactive\n onClick={onClick}\n aria-pressed={active}\n className={cn(\n \"flex cursor-pointer items-center gap-1 px-2 py-1 text-xs font-medium transition-colors\",\n active\n ? \"bg-accent text-accent-foreground\"\n : \"text-muted-foreground hover:bg-muted/80 hover:text-foreground\",\n )}\n >\n {icon}\n {label}\n </button>\n );\n}\n\n/* ── Annotation wiring shared by both views ────────────────────────────────── */\n\n/** Marker + hover props threaded into the unified/split rows. */\ninterface RowAnnotationProps {\n markersForRow: MarkersForRow;\n anchoredRow?: (row: DiffRow) => boolean;\n activeIndex: number | null;\n /** Hovering an annotated row opens its popover, anchored to this row's box. */\n onRowEnter: (index: number, rowEl: HTMLElement) => void;\n /** Leaving an annotated row schedules the popover's close. */\n onRowLeave: () => void;\n}\n\n/**\n * The numbered marker pip(s) for a row plus the active-state it derives. Returns\n * `null` when the row carries no annotation so unannotated diffs render an empty\n * marker column (or no column at all when the whole diff is unannotated).\n */\nfunction rowMarkerInfo(\n markers: ResolvedAnnotation<DiffAnnotation>[],\n activeIndex: number | null,\n): { isActive: boolean; primaryIndex: number } | null {\n if (markers.length === 0) return null;\n const isActive = markers.some((m) => m.index === activeIndex);\n return { isActive, primaryIndex: markers[0].index };\n}\n\n/** Shared amber wash for an annotated row, brighter when active. */\nfunction annotatedRowBg(info: { isActive: boolean } | null): string | null {\n if (!info) return null;\n return info.isActive\n ? \"bg-amber-400/20 dark:bg-amber-300/15\"\n : \"bg-amber-400/[0.07] dark:bg-amber-300/[0.07]\";\n}\n\n/**\n * Whether `row` is the FIRST line of `marker`'s resolved range. The numbered pip\n * renders only on this line, so a multi-line annotation shows a single marker at\n * the top of its span instead of repeating the same number down every line it\n * covers. The amber band still washes the whole range (via `annotatedRowBg`), so\n * the span stays visually grouped without the column of duplicate numbers.\n */\nfunction isMarkerRangeStart(\n row: DiffRow,\n marker: ResolvedAnnotation<DiffAnnotation>,\n): boolean {\n if (!marker.range) return false;\n const lineNo =\n annotationSide(marker.annotation) === \"before\" ? row.oldNo : row.newNo;\n return lineNo === marker.range.start;\n}\n\n/* ── Unified view ──────────────────────────────────────────────────────────── */\n\nfunction UnifiedView({\n rows,\n language,\n expanded,\n onToggleRun,\n markersForRow,\n anchoredRow,\n activeIndex,\n onRowEnter,\n onRowLeave,\n}: {\n rows: DiffRow[];\n language: string;\n expanded: Set<number>;\n onToggleRun: (index: number) => void;\n} & RowAnnotationProps) {\n const segments = useMemo(\n () => segmentRows(rows, anchoredRow),\n [rows, anchoredRow],\n );\n // Any annotation present β‡’ reserve the marker column so rows stay aligned.\n const showMarkerColumn = useMemo(\n () => rows.some((row) => markersForRow(row).length > 0),\n [rows, markersForRow],\n );\n const rowProps = {\n language,\n markersForRow,\n activeIndex,\n onRowEnter,\n onRowLeave,\n showMarkerColumn,\n };\n let runIndex = 0;\n return (\n <div className=\"overflow-x-auto\" data-code-surface>\n <div className=\"w-max min-w-full font-mono [font-size:var(--plan-doc-code-size)] leading-5\">\n {segments.map((segment, idx) => {\n if (\"collapsed\" in segment) {\n const key = runIndex++;\n const open = expanded.has(key);\n return (\n <div key={`run-${key}`}>\n <CollapsedRow\n count={segment.rows.length}\n open={open}\n onClick={() => onToggleRun(key)}\n />\n {open &&\n segment.rows.map((row, ri) => (\n <UnifiedRow\n key={`run-${key}-${ri}`}\n row={row}\n {...rowProps}\n />\n ))}\n </div>\n );\n }\n return <UnifiedRow key={idx} row={segment} {...rowProps} />;\n })}\n </div>\n </div>\n );\n}\n\nfunction UnifiedRow({\n language,\n row,\n markersForRow,\n activeIndex,\n onRowEnter,\n onRowLeave,\n showMarkerColumn,\n}: {\n language: string;\n row: DiffRow;\n markersForRow: MarkersForRow;\n activeIndex: number | null;\n onRowEnter: (index: number, rowEl: HTMLElement) => void;\n onRowLeave: () => void;\n showMarkerColumn: boolean;\n}) {\n const markers = markersForRow(row);\n const info = rowMarkerInfo(markers, activeIndex);\n const startMarker = markers.find((marker) => isMarkerRangeStart(row, marker));\n return (\n <div\n data-annot-row={startMarker ? startMarker.index : undefined}\n className={cn(\n \"flex min-h-5 min-w-full\",\n ROW_BG[row.kind],\n annotatedRowBg(info),\n )}\n onMouseEnter={\n info\n ? (event) =>\n onRowEnter(\n startMarker?.index ?? info.primaryIndex,\n event.currentTarget,\n )\n : undefined\n }\n onMouseLeave={info ? () => onRowLeave() : undefined}\n >\n <span className={cn(LINE_NO_CLASS, \"w-[52px]\")}>{row.oldNo ?? \"\"}</span>\n <span className={cn(LINE_NO_CLASS, \"w-[52px]\")}>{row.newNo ?? \"\"}</span>\n <span\n className={cn(\n \"w-6 shrink-0 select-none py-0 text-center font-semibold leading-5\",\n GUTTER_BG[row.kind],\n SIGN_COLOR[row.kind],\n )}\n >\n {SIGN[row.kind]}\n </span>\n {showMarkerColumn && (\n <MarkerCell\n startMarker={startMarker}\n active={startMarker != null && startMarker.index === activeIndex}\n />\n )}\n <DiffLineText text={row.text} language={language} />\n </div>\n );\n}\n\n/**\n * The fixed-width marker column rendered between the sign gutter and the code.\n * `startMarker` is set only on the FIRST line of an annotation's range, so the\n * numbered pip appears once at the top of a span; every other row (the rest of a\n * span, and every unannotated row in a diff that has annotations) renders an\n * empty spacer so the code text stays aligned.\n */\nfunction MarkerCell({\n startMarker,\n active,\n}: {\n startMarker?: ResolvedAnnotation<DiffAnnotation>;\n active: boolean;\n}) {\n return (\n <span className=\"flex w-6 shrink-0 select-none items-center justify-center py-0\">\n {startMarker != null && (\n <AnnotationGutterMarker marker={startMarker.marker} active={active} />\n )}\n </span>\n );\n}\n\nfunction CollapsedRow({\n count,\n open,\n onClick,\n}: {\n count: number;\n open: boolean;\n onClick: () => void;\n}) {\n return (\n <button\n type=\"button\"\n data-plan-interactive\n onClick={onClick}\n className=\"flex w-full cursor-pointer items-center gap-2 border-y border-border bg-muted/70 px-3 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\"\n >\n <IconDotsVertical className=\"size-3.5 shrink-0\" />\n <span>\n {open ? \"Hide\" : \"Show\"} {count} unchanged line\n {count === 1 ? \"\" : \"s\"}\n </span>\n </button>\n );\n}\n\n/* ── Split (side-by-side) view ─────────────────────────────────────────────── */\n\ninterface SplitRow {\n left?: DiffRow;\n right?: DiffRow;\n}\n\n/**\n * Pair removed lines (left) with added lines (right) so a modification shows the\n * old and new side by side; context lines mirror on both columns. Leftover adds\n * or removes fall through as half-empty rows (GitHub split behavior).\n */\nfunction pairSplitRows(rows: DiffRow[]): SplitRow[] {\n const out: SplitRow[] = [];\n let i = 0;\n while (i < rows.length) {\n const row = rows[i];\n if (row.kind === \"context\") {\n out.push({ left: row, right: row });\n i += 1;\n continue;\n }\n // Collect a contiguous block of removed-then-added rows.\n const removed: DiffRow[] = [];\n const added: DiffRow[] = [];\n while (i < rows.length && rows[i].kind === \"removed\")\n removed.push(rows[i++]);\n while (i < rows.length && rows[i].kind === \"added\") added.push(rows[i++]);\n const max = Math.max(removed.length, added.length);\n for (let k = 0; k < max; k += 1) {\n out.push({ left: removed[k], right: added[k] });\n }\n }\n return out;\n}\n\nfunction SplitView({\n language,\n rowLimit,\n rows,\n markersForRow,\n activeIndex,\n onRowEnter,\n onRowLeave,\n}: {\n language: string;\n rowLimit?: number;\n rows: DiffRow[];\n} & Omit<RowAnnotationProps, \"anchoredRow\">) {\n const pairs = useMemo(() => pairSplitRows(rows), [rows]);\n const displayedPairs = rowLimit ? pairs.slice(0, rowLimit) : pairs;\n // Reserve the marker column on a side only if any visible row there has one.\n const showOldMarkers = useMemo(\n () =>\n displayedPairs.some(\n (pair) => pair.left && markersForRow(pair.left, \"old\").length > 0,\n ),\n [displayedPairs, markersForRow],\n );\n const showNewMarkers = useMemo(\n () =>\n displayedPairs.some(\n (pair) => pair.right && markersForRow(pair.right, \"new\").length > 0,\n ),\n [displayedPairs, markersForRow],\n );\n const cellProps = {\n language,\n markersForRow,\n activeIndex,\n onRowEnter,\n onRowLeave,\n };\n return (\n <div\n className=\"flex w-full bg-background font-mono [font-size:var(--plan-doc-code-size)] leading-5\"\n data-code-surface\n >\n <div className=\"min-w-0 flex-1 overflow-x-auto border-r border-border\">\n <div className=\"inline-block min-w-full\">\n {displayedPairs.map((pair, idx) => (\n <SplitCell\n key={`old-${idx}`}\n row={pair.left}\n side=\"old\"\n showMarkerColumn={showOldMarkers}\n {...cellProps}\n />\n ))}\n </div>\n </div>\n <div className=\"min-w-0 flex-1 overflow-x-auto\">\n <div className=\"inline-block min-w-full\">\n {displayedPairs.map((pair, idx) => (\n <SplitCell\n key={`new-${idx}`}\n row={pair.right}\n side=\"new\"\n showMarkerColumn={showNewMarkers}\n {...cellProps}\n />\n ))}\n </div>\n </div>\n </div>\n );\n}\n\nfunction SplitCell({\n language,\n row,\n side,\n markersForRow,\n activeIndex,\n onRowEnter,\n onRowLeave,\n showMarkerColumn,\n}: {\n language: string;\n row?: DiffRow;\n side: RowSide;\n markersForRow: MarkersForRow;\n activeIndex: number | null;\n onRowEnter: (index: number, rowEl: HTMLElement) => void;\n onRowLeave: () => void;\n showMarkerColumn: boolean;\n}) {\n if (!row) {\n return (\n <div className=\"flex min-h-5 min-w-full bg-muted/40 opacity-70\">\n <span className={cn(LINE_NO_CLASS, \"w-[52px]\")} />\n <span className=\"w-6 shrink-0 bg-muted/60\" />\n {showMarkerColumn && <span className=\"w-6 shrink-0\" />}\n <span className={DIFF_LINE_CLASS}> </span>\n </div>\n );\n }\n const sign = side === \"old\" ? \"βˆ’\" : \"+\";\n const showSign = row.kind !== \"context\";\n const markers = markersForRow(row, side);\n const info = rowMarkerInfo(markers, activeIndex);\n const startMarker = markers.find((marker) => isMarkerRangeStart(row, marker));\n return (\n <div\n data-annot-row={startMarker ? startMarker.index : undefined}\n className={cn(\n \"flex min-h-5 min-w-full\",\n ROW_BG[row.kind],\n annotatedRowBg(info),\n )}\n onMouseEnter={\n info\n ? (event) =>\n onRowEnter(\n startMarker?.index ?? info.primaryIndex,\n event.currentTarget,\n )\n : undefined\n }\n onMouseLeave={info ? () => onRowLeave() : undefined}\n >\n <span className={cn(LINE_NO_CLASS, \"w-[52px]\")}>\n {side === \"old\" ? (row.oldNo ?? \"\") : (row.newNo ?? \"\")}\n </span>\n <span\n className={cn(\n \"w-6 shrink-0 select-none py-0 text-center font-semibold leading-5\",\n GUTTER_BG[row.kind],\n SIGN_COLOR[row.kind],\n )}\n >\n {showSign ? sign : \" \"}\n </span>\n {showMarkerColumn && (\n <MarkerCell\n startMarker={startMarker}\n active={startMarker != null && startMarker.index === activeIndex}\n />\n )}\n <DiffLineText text={row.text} language={language} />\n </div>\n );\n}\n\n/* ── Edit (panel) ──────────────────────────────────────────────────────────── */\n\nconst codeAreaClass =\n \"min-h-[140px] font-mono [font-size:var(--plan-code-size)] leading-5\";\n\nfunction DiffEdit({ data, onChange, editable }: BlockEditProps<DiffData>) {\n const patch = (next: Partial<DiffData>) => onChange({ ...data, ...next });\n const mode: DiffMode = data.mode ?? \"unified\";\n const annotations = data.annotations ?? [];\n\n const updateAnnotation = (index: number, next: Partial<DiffAnnotation>) =>\n patch({\n annotations: annotations.map((annotation, i) =>\n i === index ? { ...annotation, ...next } : annotation,\n ),\n });\n\n const removeAnnotation = (index: number) =>\n patch({ annotations: annotations.filter((_, i) => i !== index) });\n\n const addAnnotation = () => {\n if (annotations.length >= 80) return; // schema max\n patch({\n annotations: [\n ...annotations,\n { side: \"after\", lines: \"1\", label: \"\", note: \"\" },\n ],\n });\n };\n\n return (\n <div className=\"flex flex-col gap-3\" data-plan-interactive>\n <div className=\"grid gap-3 sm:grid-cols-2\">\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel htmlFor=\"diff-filename\" className=\"text-xs\">\n Filename\n </DevLabel>\n <DevInput\n id=\"diff-filename\"\n value={data.filename ?? \"\"}\n placeholder=\"src/add.ts\"\n disabled={!editable}\n onChange={(event) =>\n patch({ filename: event.target.value || undefined })\n }\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel htmlFor=\"diff-language\" className=\"text-xs\">\n Language\n </DevLabel>\n <DevInput\n id=\"diff-language\"\n value={data.language ?? \"\"}\n placeholder=\"ts\"\n disabled={!editable}\n onChange={(event) =>\n patch({ language: event.target.value || undefined })\n }\n />\n </div>\n </div>\n\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel className=\"text-xs\">Layout</DevLabel>\n <DevSelect\n value={mode}\n disabled={!editable}\n onValueChange={(value) => patch({ mode: value as DiffMode })}\n options={[\n { value: \"unified\", label: \"Unified\" },\n { value: \"split\", label: \"Split (side-by-side)\" },\n ]}\n />\n </div>\n\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel htmlFor=\"diff-before\" className=\"text-xs\">\n Before\n </DevLabel>\n <DevTextarea\n id=\"diff-before\"\n spellCheck={false}\n className={codeAreaClass}\n value={data.before}\n disabled={!editable}\n onChange={(event) => patch({ before: event.target.value })}\n />\n </div>\n\n <div className=\"flex flex-col gap-1.5\">\n <DevLabel htmlFor=\"diff-after\" className=\"text-xs\">\n After\n </DevLabel>\n <DevTextarea\n id=\"diff-after\"\n spellCheck={false}\n className={codeAreaClass}\n value={data.after}\n disabled={!editable}\n onChange={(event) => patch({ after: event.target.value })}\n />\n </div>\n\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center justify-between\">\n <DevLabel className=\"text-xs\">Annotations</DevLabel>\n {editable && annotations.length < 80 && (\n <button\n type=\"button\"\n data-plan-interactive\n onClick={addAnnotation}\n className=\"flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-plan-muted transition-colors hover:bg-plan-block/60 hover:text-plan-text\"\n >\n <IconPlus className=\"size-3.5\" />\n Add annotation\n </button>\n )}\n </div>\n {annotations.length === 0 && (\n <p className=\"text-xs text-plan-muted\">\n No annotations yet. Add one to anchor a note to a line range on the\n before or after side.\n </p>\n )}\n {annotations.map((annotation, index) => (\n <div\n key={index}\n className=\"flex flex-col gap-2 rounded-md border border-plan-line bg-plan-block/30 p-2\"\n >\n <div className=\"grid gap-2 sm:grid-cols-[110px_110px_minmax(0,1fr)_auto]\">\n <DevSelect\n aria-label={`Annotation ${index + 1} side`}\n value={annotation.side ?? \"after\"}\n disabled={!editable}\n onValueChange={(value) =>\n updateAnnotation(index, {\n side: value as DiffAnnotation[\"side\"],\n })\n }\n options={[\n { value: \"after\", label: \"After\" },\n { value: \"before\", label: \"Before\" },\n ]}\n />\n <DevInput\n aria-label={`Annotation ${index + 1} lines`}\n value={annotation.lines}\n placeholder=\"3-5\"\n disabled={!editable}\n onChange={(event) =>\n updateAnnotation(index, { lines: event.target.value })\n }\n />\n <DevInput\n aria-label={`Annotation ${index + 1} label`}\n value={annotation.label ?? \"\"}\n placeholder=\"Label (optional)\"\n disabled={!editable}\n onChange={(event) =>\n updateAnnotation(index, {\n label: event.target.value || undefined,\n })\n }\n />\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n aria-label={`Remove annotation ${index + 1}`}\n onClick={() => removeAnnotation(index)}\n className=\"flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-md text-plan-muted transition-colors hover:bg-muted hover:text-foreground\"\n >\n <IconTrash className=\"size-4\" />\n </button>\n )}\n </div>\n <DevTextarea\n aria-label={`Annotation ${index + 1} note`}\n className=\"min-h-[60px] text-sm\"\n value={annotation.note}\n placeholder=\"Explain what these lines do…\"\n disabled={!editable}\n onChange={(event) =>\n updateAnnotation(index, { note: event.target.value })\n }\n />\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nexport { DiffRead, DiffEdit };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"JsonExplorerBlock.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/JsonExplorerBlock.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AA2QnC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,OAAO,GACR,EAAE,cAAc,CAAC,gBAAgB,CAAC,2CAUlC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,SAAS,EACT,KAAc,GACf,EAAE;IACD,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CA6EA;AAID;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,QAAQ,EACR,QAAQ,GACT,EAAE,cAAc,CAAC,gBAAgB,CAAC,2CA6HlC"}
1
+ {"version":3,"file":"JsonExplorerBlock.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/JsonExplorerBlock.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AA2QnC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,OAAO,GACR,EAAE,cAAc,CAAC,gBAAgB,CAAC,2CAUlC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,SAAS,EACT,KAAc,GACf,EAAE;IACD,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAgFA;AAID;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,QAAQ,EACR,QAAQ,GACT,EAAE,cAAc,CAAC,gBAAgB,CAAC,2CA6HlC"}
@@ -153,7 +153,7 @@ export function JsonExplorerSurface({ data, className, label = "JSON", }) {
153
153
  })), className: "rounded px-1.5 py-0.5 text-xs text-plan-muted transition-colors hover:bg-accent/60 hover:text-plan-text", children: "Expand all" }), _jsx("span", { className: "text-plan-muted", children: "\u00B7" }), _jsx("button", { type: "button", "data-plan-interactive": true, onClick: () => setPulse((prev) => ({
154
154
  open: false,
155
155
  nonce: (prev?.nonce ?? 0) + 1,
156
- })), className: "rounded px-1.5 py-0.5 text-xs text-plan-muted transition-colors hover:bg-accent/60 hover:text-plan-text", children: "Collapse all" })] }))] }), _jsx("div", { className: "overflow-auto px-3 py-2.5 font-mono [font-size:var(--plan-code-size)] text-plan-code-text", children: parsed.ok ? (_jsx(JsonNode
156
+ })), className: "rounded px-1.5 py-0.5 text-xs text-plan-muted transition-colors hover:bg-accent/60 hover:text-plan-text", children: "Collapse all" })] }))] }), _jsx("div", { className: "overflow-auto px-3 py-2.5 font-mono [font-size:var(--plan-doc-code-size)] text-plan-code-text", "data-code-surface": true, children: parsed.ok ? (_jsx(JsonNode
157
157
  // Remount the whole tree when the global pulse fires so every node
158
158
  // re-seeds from the new open/closed state cleanly.
159
159
  , { value: parsed.value, depth: 0, collapsedDepth: collapsedDepth, forceOpen: pulse }, pulse?.nonce ?? 0)) : (_jsxs("div", { className: "space-y-2", children: [_jsx("pre", { className: "overflow-auto whitespace-pre-wrap break-words text-plan-code-text", children: data.json || "β€”" }), _jsxs("p", { className: "text-xs text-red-600 dark:text-red-300", children: ["Could not parse JSON: ", parsed.error] })] })) })] }));