{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "diff-view",
  "title": "Diff view",
  "description": "Unified or split diff computed from before and after text, with old/new gutters, syntax colors, changed-character highlights inside replaced lines, and Accept or Reject per hunk that collapses the discarded lines.",
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "https://goodui.dev/r/code-block.json",
    "https://goodui.dev/r/goodui-motion.json",
    "https://goodui.dev/r/locale.json"
  ],
  "files": [
    {
      "path": "registry/components/ai/diff-view.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\nimport { Check, FileCode2, RotateCcw, X } from \"lucide-react\"\nimport { cn } from \"@/lib/utils\"\nimport { CODE_CSS, CodeTokens, tokenizeCode, type CodeLanguage, type CodeToken } from \"@/components/goodui/code-block\"\nimport { useLabels } from \"@/lib/goodui-locale\"\nimport { GooduiTokens, spring } from \"@/lib/goodui-motion\"\n\n/*\n * Diff viewer for AI code edits: computes a line diff between `before` and `after`, groups changes into\n * hunks with context, shows them unified or split with old/new gutters, syntax colors and changed-character\n * highlights, and lets the reviewer accept or reject each hunk (rejected additions and accepted deletions\n * collapse away).\n */\n\nconst CSS = `\n.pc-diff{--pc-diff-add:oklch(0.53 0.13 155);--pc-diff-del:oklch(0.56 0.21 27)}\n.dark .pc-diff{--pc-diff-add:oklch(0.7 0.16 155);--pc-diff-del:oklch(0.68 0.2 25)}\n.pc-diff-row[data-kind=add]{background:color-mix(in oklab,var(--pc-diff-add) 12%,transparent)}\n.pc-diff-row[data-kind=del]{background:color-mix(in oklab,var(--pc-diff-del) 12%,transparent)}\n.pc-diff-row[data-kind=add] .pc-diff-gutter{color:color-mix(in oklab,var(--pc-diff-add) 70%,var(--foreground))}\n.pc-diff-row[data-kind=del] .pc-diff-gutter{color:color-mix(in oklab,var(--pc-diff-del) 70%,var(--foreground))}\n.pc-diff-row[data-kind=add] .pc-diff-mark{background:color-mix(in oklab,var(--pc-diff-add) 28%,transparent);border-radius:2px}\n.pc-diff-row[data-kind=del] .pc-diff-mark{background:color-mix(in oklab,var(--pc-diff-del) 28%,transparent);border-radius:2px}\n.pc-diff-row[data-settled] .pc-diff-mark{background:none}\n.pc-diff-mark,.pc-diff-mark [data-t]{color:var(--foreground)}\n.pc-diff-gutter{user-select:none;-webkit-user-select:none}\n.pc-diff-text{white-space:pre}\n.pc-diff[data-wrap=true] .pc-diff-text{white-space:pre-wrap;overflow-wrap:anywhere}\n`\n\nexport type DiffOp = { kind: \"eq\" | \"add\" | \"del\"; text: string; a?: number; b?: number }\nexport type DiffHunk = { ops: DiffOp[]; aStart: number; aLines: number; bStart: number; bLines: number }\nexport type HunkDecision = \"accepted\" | \"rejected\"\n\n/** Line diff (LCS) between two texts. Exported for custom renderers. */\nexport function diffLines(before: string, after: string): DiffOp[] {\n  const a = before.replace(/\\r\\n?/g, \"\\n\").split(\"\\n\")\n  const b = after.replace(/\\r\\n?/g, \"\\n\").split(\"\\n\")\n  let start = 0\n  while (start < a.length && start < b.length && a[start] === b[start]) start++\n  let endA = a.length\n  let endB = b.length\n  while (endA > start && endB > start && a[endA - 1] === b[endB - 1]) {\n    endA--\n    endB--\n  }\n  const ops: DiffOp[] = []\n  for (let i = 0; i < start; i++) ops.push({ kind: \"eq\", text: a[i] ?? \"\", a: i + 1, b: i + 1 })\n  const n = endA - start\n  const m = endB - start\n  if (n * m > 4_000_000) {\n    for (let i = start; i < endA; i++) ops.push({ kind: \"del\", text: a[i] ?? \"\", a: i + 1 })\n    for (let j = start; j < endB; j++) ops.push({ kind: \"add\", text: b[j] ?? \"\", b: j + 1 })\n  } else {\n    // LCS table on the middle part only.\n    const dp: Uint32Array[] = []\n    for (let i = 0; i <= n; i++) dp.push(new Uint32Array(m + 1))\n    for (let i = n - 1; i >= 0; i--) {\n      const row = dp[i]!\n      const next = dp[i + 1]!\n      for (let j = m - 1; j >= 0; j--) row[j] = a[start + i] === b[start + j] ? next[j + 1]! + 1 : Math.max(next[j]!, row[j + 1]!)\n    }\n    let i = 0\n    let j = 0\n    while (i < n && j < m) {\n      if (a[start + i] === b[start + j]) {\n        ops.push({ kind: \"eq\", text: a[start + i] ?? \"\", a: start + i + 1, b: start + j + 1 })\n        i++\n        j++\n      } else if (dp[i + 1]![j]! >= dp[i]![j + 1]!) {\n        ops.push({ kind: \"del\", text: a[start + i] ?? \"\", a: start + i + 1 })\n        i++\n      } else {\n        ops.push({ kind: \"add\", text: b[start + j] ?? \"\", b: start + j + 1 })\n        j++\n      }\n    }\n    while (i < n) ops.push({ kind: \"del\", text: a[start + i] ?? \"\", a: start + ++i })\n    while (j < m) ops.push({ kind: \"add\", text: b[start + j] ?? \"\", b: start + ++j })\n  }\n  for (let k = endA, kb = endB; k < a.length; k++, kb++) ops.push({ kind: \"eq\", text: a[k] ?? \"\", a: k + 1, b: kb + 1 })\n  return ops\n}\n\n/** Groups ops into hunks with `context` unchanged lines around each change. */\nexport function toHunks(ops: DiffOp[], context = 3): DiffHunk[] {\n  const changed = ops.map((o) => o.kind !== \"eq\")\n  const ranges: [number, number][] = []\n  for (let i = 0; i < ops.length; i++) {\n    if (!changed[i]) continue\n    let j = i\n    while (j + 1 < ops.length && (changed[j + 1] || ops.slice(j + 1, j + 1 + context * 2 + 1).some((o) => o.kind !== \"eq\"))) j++\n    ranges.push([Math.max(0, i - context), Math.min(ops.length - 1, j + context)])\n    i = j\n  }\n  return ranges.map(([s, e]) => {\n    const slice = ops.slice(s, e + 1)\n    const aStart = slice.find((o) => o.a !== undefined)?.a ?? (ops[s]?.a ?? 1)\n    const bStart = slice.find((o) => o.b !== undefined)?.b ?? (ops[s]?.b ?? 1)\n    return { ops: slice, aStart, aLines: slice.filter((o) => o.kind !== \"add\").length, bStart, bLines: slice.filter((o) => o.kind !== \"del\").length }\n  })\n}\n\n// Common prefix/suffix of a replaced line pair, so only the characters that changed get the stronger tint.\nfunction changedRange(x: string, y: string): [number, number] | null {\n  if (x === y) return null\n  let p = 0\n  while (p < x.length && p < y.length && x[p] === y[p]) p++\n  let s = 0\n  while (s < x.length - p && s < y.length - p && x[x.length - 1 - s] === y[y.length - 1 - s]) s++\n  return [p, s]\n}\n\nfunction splitTokens(tokens: CodeToken[], from: number, to: number): [CodeToken[], CodeToken[], CodeToken[]] {\n  const parts: [CodeToken[], CodeToken[], CodeToken[]] = [[], [], []]\n  let pos = 0\n  for (const t of tokens) {\n    const end = pos + t.content.length\n    const cut = (lo: number, hi: number, bucket: 0 | 1 | 2) => {\n      const s = Math.max(pos, lo)\n      const e = Math.min(end, hi)\n      if (e > s) parts[bucket].push({ type: t.type, content: t.content.slice(s - pos, e - pos) })\n    }\n    cut(0, from, 0)\n    cut(from, to, 1)\n    cut(to, Infinity, 2)\n    pos = end\n  }\n  return parts\n}\n\nexport type DiffViewLabels = {\n  unified: string\n  split: string\n  accept: string\n  reject: string\n  accepted: string\n  rejected: string\n  undo: string\n  additions: (n: number) => string\n  deletions: (n: number) => string\n  hunk: (n: number) => string\n  view: string\n  wrap: string\n}\nconst DEFAULT_LABELS: DiffViewLabels = {\n  unified: \"Unified\",\n  split: \"Split\",\n  accept: \"Accept\",\n  reject: \"Reject\",\n  accepted: \"Accepted\",\n  rejected: \"Rejected\",\n  undo: \"Undo\",\n  additions: (n) => `${n} addition${n === 1 ? \"\" : \"s\"}`,\n  deletions: (n) => `${n} deletion${n === 1 ? \"\" : \"s\"}`,\n  hunk: (n) => `Change ${n}`,\n  view: \"View\",\n  wrap: \"Wrap lines\",\n}\n\nexport type DiffViewProps = Omit<React.ComponentProps<\"div\">, \"children\"> & {\n  before: string\n  after: string\n  language?: CodeLanguage\n  fileName?: string\n  /** unified (one column) or split (old and new side by side). */\n  mode?: \"unified\" | \"split\"\n  defaultMode?: \"unified\" | \"split\"\n  onModeChange?: (mode: \"unified\" | \"split\") => void\n  /** Show the Unified/Split toggle. */\n  modeToggle?: boolean\n  /** Unchanged lines kept around each change. */\n  context?: number\n  /** Accept/Reject buttons per hunk. On by default when onDecision is passed. */\n  reviewable?: boolean\n  /** Hunk decisions by hunk index (controlled). */\n  decisions?: Record<number, HunkDecision | undefined>\n  onDecision?: (hunkIndex: number, decision: HunkDecision | null, hunk: DiffHunk) => void\n  /** Wrap long lines instead of scrolling. */\n  wrap?: boolean\n  /** Scroll inside the view beyond this height (px). */\n  maxHeight?: number\n  /** Text for built-in controls and screen readers; pass translations here. */\n  labels?: Partial<DiffViewLabels>\n}\n\ntype Row = { kind: DiffOp[\"kind\"]; a?: number; b?: number; tokens: CodeToken[]; mark?: [number, number] }\n\n/** Unified or split diff with syntax colors, changed-character highlights and accept/reject per hunk. */\nexport function DiffView({\n  before,\n  after,\n  language = \"text\",\n  fileName,\n  mode: modeProp,\n  defaultMode = \"unified\",\n  onModeChange,\n  modeToggle = true,\n  context = 3,\n  reviewable,\n  decisions: decisionsProp,\n  onDecision,\n  wrap = false,\n  maxHeight,\n  labels,\n  className,\n  ...props\n}: DiffViewProps) {\n  const l = useLabels(\"diff-view\", DEFAULT_LABELS, labels)\n  const reduce = useReducedMotion() ?? false\n  const uid = React.useId()\n  const [modeInner, setModeInner] = React.useState(defaultMode)\n  const mode = modeProp ?? modeInner\n  const [decInner, setDecInner] = React.useState<Record<number, HunkDecision | undefined>>({})\n  const decisions = decisionsProp ?? decInner\n  const review = reviewable ?? onDecision !== undefined\n\n  const { hunks, adds, dels, tokA, tokB } = React.useMemo(() => {\n    const ops = diffLines(before, after)\n    return {\n      hunks: toHunks(ops, context),\n      adds: ops.filter((o) => o.kind === \"add\").length,\n      dels: ops.filter((o) => o.kind === \"del\").length,\n      tokA: tokenizeCode(before, language),\n      tokB: tokenizeCode(after, language),\n    }\n  }, [before, after, context, language])\n\n  // Rows with tokens; replaced line pairs get a changed-character range.\n  const rowsOf = React.useCallback(\n    (hunk: DiffHunk): Row[] => {\n      const rows: Row[] = []\n      const ops = hunk.ops\n      for (let i = 0; i < ops.length; i++) {\n        const op = ops[i]!\n        if (op.kind === \"del\") {\n          let j = i\n          while (j < ops.length && ops[j]?.kind === \"del\") j++\n          let k = j\n          while (k < ops.length && ops[k]?.kind === \"add\") k++\n          const delRun = ops.slice(i, j)\n          const addRun = ops.slice(j, k)\n          delRun.forEach((d, idx) => {\n            const partner = delRun.length === addRun.length ? addRun[idx] : undefined\n            const r = partner ? changedRange(d.text, partner.text) : null\n            rows.push({ kind: \"del\", a: d.a, tokens: tokA[(d.a ?? 1) - 1] ?? [], mark: r ? [r[0], d.text.length - r[1]] : undefined })\n          })\n          addRun.forEach((ad, idx) => {\n            const partner = delRun.length === addRun.length ? delRun[idx] : undefined\n            const r = partner ? changedRange(partner.text, ad.text) : null\n            rows.push({ kind: \"add\", b: ad.b, tokens: tokB[(ad.b ?? 1) - 1] ?? [], mark: r ? [r[0], ad.text.length - r[1]] : undefined })\n          })\n          i = k - 1\n        } else if (op.kind === \"add\") rows.push({ kind: \"add\", b: op.b, tokens: tokB[(op.b ?? 1) - 1] ?? [] })\n        else rows.push({ kind: \"eq\", a: op.a, b: op.b, tokens: tokB[(op.b ?? 1) - 1] ?? [] })\n      }\n      return rows\n    },\n    [tokA, tokB],\n  )\n\n  const decide = (i: number, d: HunkDecision | null) => {\n    if (decisionsProp === undefined) setDecInner((s) => ({ ...s, [i]: d ?? undefined }))\n    onDecision?.(i, d, hunks[i]!)\n  }\n  const setMode = (m: \"unified\" | \"split\") => {\n    if (modeProp === undefined) setModeInner(m)\n    onModeChange?.(m)\n  }\n\n  const text = (row: Row) => {\n    if (!row.mark) return <CodeTokens tokens={row.tokens} />\n    const [pre, mid, post] = splitTokens(row.tokens, row.mark[0], row.mark[1])\n    return (\n      <>\n        <CodeTokens tokens={pre} />\n        <span className=\"pc-diff-mark\">\n          <CodeTokens tokens={mid} />\n        </span>\n        <CodeTokens tokens={post} />\n      </>\n    )\n  }\n  const gutterW = `${Math.max(2, String(Math.max(before.split(\"\\n\").length, after.split(\"\\n\").length)).length) + 1}ch`\n  const visible = (row: Row, d: HunkDecision | undefined) => !((d === \"accepted\" && row.kind === \"del\") || (d === \"rejected\" && row.kind === \"add\"))\n  const settled = (row: Row, d: HunkDecision | undefined) => (d === \"accepted\" && row.kind === \"add\") || (d === \"rejected\" && row.kind === \"del\")\n  const springRow = reduce ? { duration: 0 } : spring.ui\n\n  const unifiedRow = (row: Row, key: string, d: HunkDecision | undefined) => (\n    <motion.div\n      key={key}\n      layout=\"position\"\n      initial={false}\n      exit={{ height: 0, opacity: 0, transition: reduce ? { duration: 0 } : { duration: 0.18 } }}\n      transition={springRow}\n      className=\"pc-diff-row grid overflow-hidden\"\n      style={{ gridTemplateColumns: `${gutterW} ${gutterW} 1.5ch minmax(0,1fr)` }}\n      data-kind={settled(row, d) ? \"eq\" : row.kind}\n      data-settled={settled(row, d) ? \"\" : undefined}\n    >\n      <span className=\"pc-diff-gutter px-1 text-end text-muted-foreground\" aria-hidden=\"true\">\n        {row.a ?? \"\"}\n      </span>\n      <span className=\"pc-diff-gutter px-1 text-end text-muted-foreground\" aria-hidden=\"true\">\n        {row.b ?? \"\"}\n      </span>\n      <span className=\"pc-diff-gutter text-center font-semibold\" aria-hidden=\"true\">\n        {row.kind === \"add\" ? \"+\" : row.kind === \"del\" ? \"−\" : \"\"}\n      </span>\n      <span className=\"pc-diff-text pe-3\">\n        {row.kind !== \"eq\" && <span className=\"sr-only\">{row.kind === \"add\" ? \"+ \" : \"− \"}</span>}\n        {text(row)}\n      </span>\n    </motion.div>\n  )\n\n  const splitRows = (rows: Row[]) => {\n    const pairs: [Row | null, Row | null][] = []\n    for (let i = 0; i < rows.length; i++) {\n      const r = rows[i]!\n      if (r.kind === \"eq\") pairs.push([r, r])\n      else if (r.kind === \"del\") {\n        let j = i\n        while (j < rows.length && rows[j]?.kind === \"del\") j++\n        let k = j\n        while (k < rows.length && rows[k]?.kind === \"add\") k++\n        const dels = rows.slice(i, j)\n        const adds = rows.slice(j, k)\n        for (let x = 0; x < Math.max(dels.length, adds.length); x++) pairs.push([dels[x] ?? null, adds[x] ?? null])\n        i = k - 1\n      } else pairs.push([null, r])\n    }\n    return pairs\n  }\n\n  const splitCell = (row: Row | null, side: \"a\" | \"b\", d: HunkDecision | undefined) => {\n    const hidden = row && !visible(row, d)\n    const shown = row && !hidden ? row : null\n    return (\n      <div\n        className={cn(\"pc-diff-row grid min-w-0 border-e last:border-e-0\", !shown && \"bg-muted/30\")}\n        style={{ gridTemplateColumns: `${gutterW} 1.5ch minmax(0,1fr)` }}\n        data-kind={shown ? (settled(shown, d) ? \"eq\" : shown.kind) : undefined}\n        data-settled={shown && settled(shown, d) ? \"\" : undefined}\n      >\n        <span className=\"pc-diff-gutter px-1 text-end text-muted-foreground\" aria-hidden=\"true\">\n          {shown ? (side === \"a\" ? (shown.a ?? \"\") : (shown.b ?? \"\")) : \"\"}\n        </span>\n        <span className=\"pc-diff-gutter text-center font-semibold\" aria-hidden=\"true\">\n          {shown?.kind === \"add\" ? \"+\" : shown?.kind === \"del\" ? \"−\" : \"\"}\n        </span>\n        <span className=\"pc-diff-text pe-3\">{shown ? text(shown) : \"\"}</span>\n      </div>\n    )\n  }\n\n  return (\n    <div className={cn(\"pc-diff pc-code overflow-hidden rounded-xl border bg-card text-[13px] text-card-foreground\", className)} data-wrap={wrap} {...props}>\n      <GooduiTokens />\n      <style href=\"pc-code-block\" precedence=\"default\">\n        {CODE_CSS}\n      </style>\n      <style href=\"pc-diff-view\" precedence=\"default\">\n        {CSS}\n      </style>\n      <div className=\"flex h-10 items-center gap-2 border-b bg-muted/40 ps-3 pe-1.5\">\n        {fileName && (\n          <span className=\"inline-flex min-w-0 items-center gap-1.5 text-xs font-medium\">\n            <FileCode2 className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n            <span className=\"truncate\">{fileName}</span>\n          </span>\n        )}\n        <span className=\"flex shrink-0 items-center gap-2 text-xs tabular-nums\">\n          <span className=\"text-[color-mix(in_oklab,var(--pc-diff-add)_70%,var(--foreground))]\">\n            <span aria-hidden=\"true\">+{adds}</span>\n            <span className=\"sr-only\">{l.additions(adds)}</span>\n          </span>\n          <span className=\"text-[color-mix(in_oklab,var(--pc-diff-del)_70%,var(--foreground))]\">\n            <span aria-hidden=\"true\">−{dels}</span>\n            <span className=\"sr-only\">{l.deletions(dels)}</span>\n          </span>\n        </span>\n        <span className=\"flex-1\" />\n        {modeToggle && (\n          <div role=\"radiogroup\" aria-label={l.view} className=\"flex items-center rounded-lg bg-muted/80 p-0.5\">\n            {([\"unified\", \"split\"] as const).map((m) => (\n              <button\n                key={m}\n                type=\"button\"\n                role=\"radio\"\n                aria-checked={mode === m}\n                onClick={() => setMode(m)}\n                className={cn(\"pc-press relative h-6 rounded-md px-2 text-xs font-medium outline-none focus-visible:ring-3 focus-visible:ring-ring/50\", mode === m ? \"text-foreground\" : \"text-foreground/65 hover:text-foreground\")}\n              >\n                {mode === m && <motion.span layoutId={`${uid}-mode`} className=\"absolute inset-0 rounded-md bg-background shadow-[var(--pc-e1)]\" transition={reduce ? { duration: 0 } : spring.snap} />}\n                <span className=\"relative\">{l[m]}</span>\n              </button>\n            ))}\n          </div>\n        )}\n      </div>\n      <div className=\"overflow-auto outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset\" style={{ maxHeight }} tabIndex={0} dir=\"ltr\">\n        <div className={cn(\"py-1 font-mono leading-6\", mode === \"split\" && !wrap && \"min-w-[640px]\")}>\n          {hunks.map((h, hi) => {\n            const d = decisions[hi]\n            const rows = rowsOf(h)\n            return (\n              <section key={hi} aria-label={l.hunk(hi + 1)} className=\"border-b last:border-b-0\">\n                <div className=\"flex items-center gap-2 bg-muted/30 px-3 py-1 text-xs text-muted-foreground\">\n                  <span className=\"font-mono\">\n                    spring. -{h.aStart},{h.aLines} +{h.bStart},{h.bLines} spring.\n                  </span>\n                  <span className=\"flex-1\" />\n                  {review && (\n                    <AnimatePresence mode=\"wait\" initial={false}>\n                      {d ? (\n                        <motion.span key=\"decided\" initial={{ opacity: 0, x: 6 }} animate={{ opacity: 1, x: 0 }} exit={{ opacity: 0 }} transition={reduce ? { duration: 0 } : { duration: 0.15 }} className=\"inline-flex items-center gap-1.5\">\n                          <span className={cn(\"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium\", d === \"accepted\" ? \"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300\" : \"bg-rose-500/15 text-rose-700 dark:text-rose-300\")}>\n                            {d === \"accepted\" ? <Check className=\"size-3\" aria-hidden=\"true\" /> : <X className=\"size-3\" aria-hidden=\"true\" />}\n                            {d === \"accepted\" ? l.accepted : l.rejected}\n                          </span>\n                          <button type=\"button\" onClick={() => decide(hi, null)} className=\"pc-press inline-flex h-6 items-center gap-1 rounded-md px-1.5 text-[11px] font-medium outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50\">\n                            <RotateCcw className=\"size-3\" aria-hidden=\"true\" />\n                            {l.undo}\n                          </button>\n                        </motion.span>\n                      ) : (\n                        <motion.span key=\"pending\" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={reduce ? { duration: 0 } : { duration: 0.15 }} className=\"inline-flex items-center gap-1\">\n                          <button\n                            type=\"button\"\n                            onClick={() => decide(hi, \"accepted\")}\n                            className=\"pc-press inline-flex h-6 items-center gap-1 rounded-md px-2 text-[11px] font-medium text-emerald-700 outline-none hover:bg-emerald-500/15 focus-visible:ring-3 focus-visible:ring-ring/50 dark:text-emerald-300\"\n                          >\n                            <Check className=\"size-3\" aria-hidden=\"true\" />\n                            {l.accept}\n                          </button>\n                          <button\n                            type=\"button\"\n                            onClick={() => decide(hi, \"rejected\")}\n                            className=\"pc-press inline-flex h-6 items-center gap-1 rounded-md px-2 text-[11px] font-medium text-rose-700 outline-none hover:bg-rose-500/15 focus-visible:ring-3 focus-visible:ring-ring/50 dark:text-rose-300\"\n                          >\n                            <X className=\"size-3\" aria-hidden=\"true\" />\n                            {l.reject}\n                          </button>\n                        </motion.span>\n                      )}\n                    </AnimatePresence>\n                  )}\n                </div>\n                {mode === \"unified\" ? (\n                  <AnimatePresence initial={false}>{rows.filter((r) => visible(r, d)).map((r) => unifiedRow(r, `${r.kind}-${r.a ?? \"\"}-${r.b ?? \"\"}`, d))}</AnimatePresence>\n                ) : (\n                  <div className=\"grid grid-cols-2\">\n                    {splitRows(rows).map(([left, right], i) => (\n                      <React.Fragment key={i}>\n                        {splitCell(left, \"a\", d)}\n                        {splitCell(right, \"b\", d)}\n                      </React.Fragment>\n                    ))}\n                  </div>\n                )}\n              </section>\n            )\n          })}\n          {hunks.length === 0 && <div className=\"px-3 py-6 text-center text-sm text-muted-foreground\">No changes</div>}\n        </div>\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/goodui/diff-view.tsx"
    }
  ],
  "categories": [
    "components",
    "ai"
  ],
  "type": "registry:component"
}
