{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "code-editor-diff",
  "title": "Diff View",
  "description": "Diff view for the code editor: themed changed and deleted lines, chunk navigation with position and line counts, per-chunk and bulk accept or reject actions, keyboard shortcuts, and a side-by-side mode with revert controls between the panes.",
  "dependencies": [
    "@codemirror/merge",
    "@codemirror/state",
    "@codemirror/view",
    "lucide-react"
  ],
  "registryDependencies": [
    "litingyes/blocove/code-editor",
    "litingyes/blocove/code-editor-extension",
    "separator"
  ],
  "files": [
    {
      "path": "src/registry/blocove/ui/code-editor/diff.tsx",
      "content": "import type { Chunk } from '@codemirror/merge'\nimport type { Extension } from '@codemirror/state'\nimport type {\n  CodeEditorSurfaceMountContext,\n  CodeEditorSurfaceOptions,\n} from '@/lib/blocove/code-editor-extension'\nimport {\n  acceptChunk,\n  getChunks,\n  getOriginalDoc,\n  MergeView,\n  mergeViewSiblings,\n  rejectChunk,\n  unifiedMergeView,\n  updateOriginalDoc,\n} from '@codemirror/merge'\nimport { ChangeSet, Compartment, EditorState, Prec, Text } from '@codemirror/state'\nimport { EditorView, keymap, ViewPlugin } from '@codemirror/view'\nimport {\n  CheckCheckIcon,\n  CheckIcon,\n  ChevronDownIcon,\n  ChevronUpIcon,\n  RefreshCwIcon,\n  XCircleIcon,\n  XIcon,\n} from 'lucide-react'\nimport {\n  CodeEditorToolbarButton,\n  useCodeEditor,\n  useCodeEditorState,\n} from '@/components/blocove/code-editor/editor'\nimport { Separator } from '@/components/ui/separator'\nimport { defineCodeEditorExtension } from '@/lib/blocove/code-editor-extension'\n\nexport interface CodeEditorDiffLabels {\n  /** Text of the per-chunk accept control. */\n  accept?: string\n  /** Text of the per-chunk reject control. */\n  reject?: string\n}\n\nexport interface CodeEditorDiffProps {\n  /** Document the editor content is compared against. */\n  original: string\n  /**\n   * How the two documents are laid out. `inline` compares them inside one view,\n   * `split` renders them side by side.\n   */\n  mode?: 'inline' | 'split'\n  /**\n   * Split only: show a control between the panes that copies a chunk across.\n   * `a-to-b` writes `original` back into the editor content, `b-to-a` writes the\n   * editor content into `original`. Pass `false` to hide it.\n   */\n  revertControls?: 'a-to-b' | 'b-to-a' | false\n  /** Split only: which document is rendered first. Defaults to `a-b`. */\n  orientation?: 'a-b' | 'b-a'\n  /** Mark the inserted and deleted text inside changed chunks. */\n  highlightChanges?: boolean\n  /** Show a gutter marker next to changed lines. */\n  gutter?: boolean\n  /** Inline only: show the accept and reject controls for every chunk. */\n  mergeControls?: boolean\n  /**\n   * Collapse long stretches of unchanged text. Pass `false` to keep every line\n   * visible, or an object with the `margin` and `minSize` of the collapse.\n   */\n  collapseUnchanged?: false | { margin?: number, minSize?: number }\n  /** Inline only: show inline diffs for chunks that only change a few words. */\n  allowInlineDiffs?: boolean\n  /**\n   * Inline only: syntax-highlight the deleted lines. Requires a language item\n   * declared inside the editor, since the deleted text is tokenized with the\n   * document language. Defaults to true.\n   */\n  syntaxHighlightDeletions?: boolean\n  /**\n   * Inline only: register the diff keyboard shortcuts — previous and next\n   * change, accept and reject the chunk under the cursor. Defaults to true.\n   */\n  shortcuts?: boolean\n  /** Inline only: labels of the per-chunk accept and reject controls. */\n  labels?: CodeEditorDiffLabels\n}\n\ninterface ResolvedDiffLabels {\n  accept: string\n  reject: string\n}\n\ninterface DiffBaseline {\n  doc: Text\n  original: Text\n}\n\ninterface DiffReview {\n  chunks: readonly Chunk[]\n  /** Index of the chunk that contains the cursor, `-1` when there is none. */\n  index: number\n  added: number\n  removed: number\n  /** Whether the comparison or the document moved away from the baseline. */\n  dirty: boolean\n}\n\n// The palette lives on the editor root so consumers can retune the tints\n// without touching the item. Alpha colors keep the same values readable on\n// both page schemes, so no light/dark duplicate is needed.\nconst diffTheme = EditorView.theme({\n  '&': {\n    '--code-diff-add': 'oklch(0.63 0.17 155)',\n    '--code-diff-remove': 'oklch(0.58 0.21 25)',\n  },\n  '&.cm-merge-b .cm-changedLine': {\n    backgroundColor: 'color-mix(in oklab, var(--code-diff-add) 12%, transparent)',\n  },\n  '&.cm-merge-b .cm-changedText': {\n    background: 'color-mix(in oklab, var(--code-diff-add) 26%, transparent)',\n    borderRadius: '2px',\n  },\n  // Side by side, the original document is the comparison base, so its changed\n  // lines carry the removal tint instead of the addition tint.\n  '&.cm-merge-a .cm-changedLine': {\n    backgroundColor: 'color-mix(in oklab, var(--code-diff-remove) 12%, transparent)',\n  },\n  '&.cm-merge-a .cm-changedText': {\n    background: 'color-mix(in oklab, var(--code-diff-remove) 26%, transparent)',\n    borderRadius: '2px',\n  },\n  '& .cm-deletedChunk': {\n    position: 'relative',\n    padding: '0.125rem 0.75rem',\n    backgroundColor: 'color-mix(in oklab, var(--code-diff-remove) 10%, transparent)',\n    borderBlock: '1px solid color-mix(in oklab, var(--code-diff-remove) 22%, transparent)',\n  },\n  '& .cm-deletedChunk .cm-deletedLine': {\n    // Keep the floating controls clear of the deleted text.\n    paddingInlineEnd: '7rem',\n  },\n  '& .cm-deletedChunk .cm-deletedText': {\n    background: 'color-mix(in oklab, var(--code-diff-remove) 24%, transparent)',\n    borderRadius: '2px',\n  },\n  '& .cm-deletedChunk .cm-chunkButtons': {\n    position: 'absolute',\n    top: '0.125rem',\n    insetInlineEnd: '0.375rem',\n    display: 'flex',\n    gap: '0.25rem',\n  },\n  // Pure insertions have no deleted lines: give the controls their own row so\n  // they never float over the inserted code.\n  '& .cm-deletedChunk:not(:has(.cm-deletedLine))': {\n    minHeight: '1.75rem',\n    paddingBlock: '0.125rem',\n    background: 'transparent',\n    borderBlock: 'none',\n  },\n  '& .cm-deletedChunk:not(:has(.cm-deletedLine)) .cm-chunkButtons': {\n    position: 'static',\n    justifyContent: 'flex-end',\n    paddingInlineEnd: '0.375rem',\n  },\n  '& .cm-deletedChunk .cm-diff-control': {\n    margin: '0',\n    padding: '0.0625rem 0.375rem',\n    border: '1px solid var(--border)',\n    borderRadius: 'var(--radius-sm, 4px)',\n    background: 'var(--background)',\n    color: 'var(--foreground)',\n    fontFamily: 'inherit',\n    fontSize: '11px',\n    lineHeight: '1.4',\n    cursor: 'pointer',\n    userSelect: 'none',\n    boxShadow: '0 1px 2px rgb(0 0 0 / 0.06)',\n  },\n  '& .cm-deletedChunk .cm-diff-control:hover': {\n    background: 'var(--accent)',\n    color: 'var(--accent-foreground)',\n  },\n  '& .cm-deletedChunk .cm-diff-control:focus-visible': {\n    outline: '2px solid var(--ring)',\n    outlineOffset: '1px',\n  },\n  '& .cm-collapsedLines': {\n    padding: '0.125rem 0.75rem',\n    borderRadius: '4px',\n    background: 'transparent',\n    color: 'var(--muted-foreground)',\n    fontSize: '11px',\n    fontVariantNumeric: 'tabular-nums',\n    cursor: 'pointer',\n    userSelect: 'none',\n  },\n  '& .cm-collapsedLines:hover': {\n    background: 'var(--muted)',\n    color: 'var(--foreground)',\n  },\n  '& .cm-collapsedLines:before, & .cm-collapsedLines:after': {\n    content: 'none',\n  },\n  '& .cm-changeGutter': {\n    width: '3px',\n    paddingLeft: '0',\n  },\n  '&.cm-merge-b .cm-changedLineGutter': {\n    background: 'var(--code-diff-add)',\n  },\n  '& .cm-deletedLineGutter': {\n    // Marks where the deletion widget sits. A neutral rail avoids claiming a\n    // removal on pure insertions, where the widget carries no deleted text.\n    background: 'color-mix(in oklab, var(--foreground) 24%, transparent)',\n  },\n})\n\n// The document and the comparison base at the moment the view was created.\n// \"Reset comparison\" restores both, so accepting every chunk is not a dead end.\nconst diffBaselines = new WeakMap<EditorView, DiffBaseline>()\n\nfunction recordDiffBaseline(original: string) {\n  const parsed = Text.of(original.split(/\\r?\\n/))\n\n  return ViewPlugin.define((view) => {\n    diffBaselines.set(view, { doc: view.state.doc, original: parsed })\n\n    return {}\n  })\n}\n\nfunction getDiffChunks(state: EditorState): readonly Chunk[] {\n  return getChunks(state)?.chunks ?? []\n}\n\n/**\n * The document the chunks are compared against. A unified view keeps it in the\n * editor state; in a split view the original is the sibling editor, so the\n * chunk positions have to be resolved there.\n */\nfunction comparisonDoc(view: EditorView): Text {\n  const siblings = mergeViewSiblings(view)\n\n  return siblings\n    ? siblings.a.state.doc\n    : getOriginalDoc(view.state)\n}\n\nfunction countLines(doc: Text, from: number, to: number) {\n  if (from === to) {\n    return 0\n  }\n\n  return doc.lineAt(to).number - doc.lineAt(from).number + 1\n}\n\nfunction isDiffDirty(view: EditorView) {\n  const baseline = diffBaselines.get(view)\n\n  if (!baseline) {\n    return false\n  }\n\n  return !view.state.doc.eq(baseline.doc)\n    || !getOriginalDoc(view.state).eq(baseline.original)\n}\n\nfunction diffStats(chunks: readonly Chunk[], doc: Text, original: Text) {\n  let added = 0\n  let removed = 0\n\n  for (const chunk of chunks) {\n    added += countLines(doc, chunk.fromB, chunk.endB)\n    removed += countLines(original, chunk.fromA, chunk.endA)\n  }\n\n  return { added, removed }\n}\n\nfunction currentChunkIndex(chunks: readonly Chunk[], head: number) {\n  return chunks.findIndex(chunk => head >= chunk.fromB && head <= chunk.endB)\n}\n\nfunction computeDiffReview(view: EditorView | null): DiffReview {\n  if (!view) {\n    return {\n      chunks: [],\n      index: -1,\n      added: 0,\n      removed: 0,\n      dirty: false,\n    }\n  }\n\n  const state = view.state\n  const chunks = getDiffChunks(state)\n  const dirty = isDiffDirty(view)\n\n  if (chunks.length === 0) {\n    return {\n      chunks,\n      index: -1,\n      added: 0,\n      removed: 0,\n      dirty,\n    }\n  }\n\n  const { added, removed } = diffStats(chunks, state.doc, comparisonDoc(view))\n\n  return {\n    chunks,\n    index: currentChunkIndex(chunks, state.selection.main.head),\n    added,\n    removed,\n    dirty,\n  }\n}\n\n/**\n * Move the cursor to the next or previous changed chunk. Both directions wrap\n * around, so the buttons never become dead ends.\n */\nfunction moveToDiffChunk(view: EditorView, direction: -1 | 1) {\n  const chunks = getDiffChunks(view.state)\n\n  if (chunks.length === 0) {\n    return false\n  }\n\n  const head = view.state.selection.main.head\n  const current = currentChunkIndex(chunks, head)\n  let target = -1\n\n  if (direction === 1) {\n    target = current >= 0\n      ? (current + 1) % chunks.length\n      : chunks.findIndex(chunk => chunk.fromB > head)\n  }\n  else if (current >= 0) {\n    target = (current - 1 + chunks.length) % chunks.length\n  }\n  else {\n    for (let index = chunks.length - 1; index >= 0; index--) {\n      const chunk = chunks[index]\n\n      if (chunk && chunk.endB < head) {\n        target = index\n        break\n      }\n    }\n  }\n\n  if (target < 0) {\n    target = direction === 1\n      ? 0\n      : chunks.length - 1\n  }\n\n  const chunk = chunks[target]\n\n  if (!chunk) {\n    return false\n  }\n\n  view.dispatch({\n    selection: { anchor: chunk.fromB },\n    scrollIntoView: true,\n    userEvent: 'select',\n  })\n\n  return true\n}\n\n/**\n * Accept every remaining chunk at once by moving the comparison base to the\n * current document. The buffer itself is left untouched.\n */\nfunction acceptAllDiffChunks(view: EditorView) {\n  const chunks = getDiffChunks(view.state)\n\n  if (chunks.length === 0) {\n    return false\n  }\n\n  const original = getOriginalDoc(view.state)\n  const changes = ChangeSet.of(\n    {\n      from: 0,\n      to: original.length,\n      insert: view.state.doc.toString(),\n    },\n    original.length,\n  )\n\n  view.dispatch({\n    effects: updateOriginalDoc.of({\n      doc: changes.apply(original),\n      changes,\n    }),\n    userEvent: 'accept',\n  })\n\n  return true\n}\n\n/** Reject every remaining chunk by restoring the original document. */\nfunction rejectAllDiffChunks(view: EditorView) {\n  const chunks = getDiffChunks(view.state)\n\n  if (chunks.length === 0) {\n    return false\n  }\n\n  const original = getOriginalDoc(view.state).toString()\n\n  if (view.state.doc.toString() === original) {\n    return false\n  }\n\n  view.dispatch({\n    changes: { from: 0, to: view.state.doc.length, insert: original },\n    selection: { anchor: 0 },\n    scrollIntoView: true,\n    userEvent: 'revert',\n  })\n\n  return true\n}\n\n/** Restore both the document and its comparison base to the baseline. */\nfunction resetDiff(view: EditorView) {\n  const baseline = diffBaselines.get(view)\n\n  if (!baseline) {\n    return false\n  }\n\n  const original = getOriginalDoc(view.state)\n  const changes = ChangeSet.of(\n    {\n      from: 0,\n      to: original.length,\n      insert: baseline.original.toString(),\n    },\n    original.length,\n  )\n\n  // Only rewrite the document when it drifted from the baseline, so resetting\n  // after accepting every chunk keeps the collapsed unchanged ranges.\n  const docChanged = !view.state.doc.eq(baseline.doc)\n\n  view.dispatch({\n    ...(docChanged\n      ? {\n          changes: {\n            from: 0,\n            to: view.state.doc.length,\n            insert: baseline.doc.toString(),\n          },\n          selection: { anchor: 0 },\n          scrollIntoView: true,\n        }\n      : {}),\n    effects: updateOriginalDoc.of({\n      doc: changes.apply(original),\n      changes,\n    }),\n    userEvent: 'revert',\n  })\n\n  return true\n}\n\nconst diffShortcuts = Prec.high(keymap.of([\n  {\n    key: 'Mod-Alt-ArrowDown',\n    run: view => moveToDiffChunk(view, 1),\n  },\n  {\n    key: 'Mod-Alt-ArrowUp',\n    run: view => moveToDiffChunk(view, -1),\n  },\n  {\n    key: 'Mod-Enter',\n    run: view => acceptChunk(view),\n  },\n  {\n    key: 'Shift-Mod-Enter',\n    run: view => rejectChunk(view),\n  },\n]))\n\n/**\n * Render the per-chunk controls as plain buttons so they style with the shadcn\n * tokens and respond to click, which makes them reachable with the keyboard.\n */\nfunction renderMergeControls(labels: ResolvedDiffLabels) {\n  return (type: 'accept' | 'reject', action: (event: MouseEvent) => void) => {\n    // CodeMirror builds the chunk widget outside React, so the control has to\n    // be created with DOM APIs when the widget is first rendered.\n    // eslint-disable-next-line react/purity\n    const button = document.createElement('button')\n    const label = type === 'accept'\n      ? labels.accept\n      : labels.reject\n    const description = type === 'accept'\n      ? 'Accept this change'\n      : 'Reject this change'\n\n    button.type = 'button'\n    button.className = 'cm-diff-control'\n    button.dataset.action = type\n    button.textContent = label\n    button.title = description\n    button.setAttribute('aria-label', description)\n    button.addEventListener('click', event => action(event))\n\n    return button\n  }\n}\n\n/**\n * Inline diff view. The editor content is compared against `original`, changed\n * chunks are highlighted with their deleted lines above the new ones, and the\n * built-in controls apply or revert a chunk.\n */\nfunction inlineDiff(props: CodeEditorDiffProps): Extension[] {\n  const labels: ResolvedDiffLabels = {\n    accept: props.labels?.accept ?? 'Accept',\n    reject: props.labels?.reject ?? 'Reject',\n  }\n\n  return [\n    unifiedMergeView({\n      original: props.original,\n      highlightChanges: props.highlightChanges ?? true,\n      gutter: props.gutter ?? true,\n      mergeControls: props.mergeControls === false\n        ? false\n        : renderMergeControls(labels),\n      allowInlineDiffs: props.allowInlineDiffs ?? false,\n      syntaxHighlightDeletions: props.syntaxHighlightDeletions ?? true,\n      collapseUnchanged: props.collapseUnchanged === false\n        ? undefined\n        : props.collapseUnchanged ?? { margin: 2, minSize: 4 },\n    }),\n    diffTheme,\n    recordDiffBaseline(props.original),\n    ...(props.shortcuts === false\n      ? []\n      : [diffShortcuts]),\n  ]\n}\n\n/**\n * Split diff view. Two editors are aligned chunk by chunk, the original on the\n * left and the editor content on the right. Only the right side reports the\n * document, so reverting a chunk never looks like an edit of the buffer.\n */\nfunction splitDiff(props: CodeEditorDiffProps) {\n  if (props.mode !== 'split') {\n    return null\n  }\n\n  return ({\n    host,\n    doc,\n    primaryExtensions,\n    secondaryExtensions,\n    options,\n  }: CodeEditorSurfaceMountContext) => {\n    const originalEditable = new Compartment()\n    const contentEditable = new Compartment()\n    const originalWrapping = new Compartment()\n    const contentWrapping = new Compartment()\n    const wrap = options.lineWrapping\n      ? EditorView.lineWrapping\n      : []\n\n    const merge = new MergeView({\n      a: {\n        doc: props.original,\n        extensions: [\n          ...secondaryExtensions,\n          originalEditable.of([\n            EditorView.editable.of(false),\n            EditorState.readOnly.of(true),\n          ]),\n          originalWrapping.of(wrap),\n        ],\n      },\n      b: {\n        doc,\n        extensions: [\n          ...primaryExtensions,\n          contentEditable.of([\n            EditorView.editable.of(options.editable && !options.readOnly),\n            EditorState.readOnly.of(options.readOnly),\n          ]),\n          contentWrapping.of(wrap),\n        ],\n      },\n      parent: host,\n      orientation: props.orientation,\n      revertControls: props.revertControls === false\n        ? undefined\n        : props.revertControls ?? 'a-to-b',\n      highlightChanges: props.highlightChanges ?? true,\n      gutter: props.gutter ?? true,\n      collapseUnchanged: props.collapseUnchanged === false\n        ? undefined\n        : props.collapseUnchanged ?? { margin: 2, minSize: 4 },\n    })\n\n    // The merge view scrolls as one block, so it has to fill the surface. The\n    // divider keeps the panes apart when no revert column is rendered.\n    merge.dom.style.height = '100%'\n\n    merge.dom.querySelectorAll<HTMLElement>('.cm-mergeViewEditor').forEach((pane, index) => {\n      if (index > 0) {\n        pane.style.borderLeft = '1px solid var(--border)'\n      }\n    })\n\n    if (options.autoFocus) {\n      merge.b.focus()\n    }\n\n    return {\n      view: merge.b,\n      update(next: CodeEditorSurfaceOptions) {\n        const nextWrap = next.lineWrapping\n          ? EditorView.lineWrapping\n          : []\n\n        merge.a.dispatch({\n          effects: originalWrapping.reconfigure(nextWrap),\n        })\n        merge.b.dispatch({\n          effects: [\n            contentEditable.reconfigure([\n              EditorView.editable.of(next.editable && !next.readOnly),\n              EditorState.readOnly.of(next.readOnly),\n            ]),\n            contentWrapping.reconfigure(nextWrap),\n          ],\n        })\n      },\n      destroy() {\n        merge.destroy()\n      },\n    }\n  }\n}\n\n/**\n * Diff view for the code editor. The editor content is compared against\n * `original`, either inline in one view or side by side with `mode=\"split\"`.\n */\nexport const CodeEditorDiff = defineCodeEditorExtension<CodeEditorDiffProps>(\n  'diff',\n  (props: CodeEditorDiffProps): Extension[] =>\n    props.mode === 'split'\n      ? [diffTheme]\n      : inlineDiff(props),\n  { surface: splitDiff },\n)\n\nexport interface CodeEditorDiffToolbarProps {\n  /** Hide the position and line counters. */\n  hideCount?: boolean\n  /** Hide the accept and reject controls. */\n  hideActions?: boolean\n}\n\ninterface DiffStatusProps {\n  count: number\n  index: number\n  added: number\n  removed: number\n}\n\nfunction describeChangeCount(count: number) {\n  if (count === 1) {\n    return '1 change'\n  }\n\n  return `${count} changes`\n}\n\nfunction describeDiffSummary(count: number, index: number) {\n  if (count === 0) {\n    return { label: 'No changes', announcement: 'No changes' }\n  }\n\n  if (index >= 0) {\n    return {\n      label: `${index + 1} of ${count}`,\n      announcement: `Change ${index + 1} of ${count}`,\n    }\n  }\n\n  const label = describeChangeCount(count)\n\n  return { label, announcement: label }\n}\n\nfunction DiffStatus({ count, index, added, removed }: DiffStatusProps) {\n  const { label, announcement } = describeDiffSummary(count, index)\n\n  return (\n    <span className=\"flex items-center gap-1.5 px-1 text-xs whitespace-nowrap text-muted-foreground\">\n      <span\n        className=\"sr-only\"\n        role=\"status\"\n        aria-live=\"polite\"\n        aria-atomic=\"true\"\n      >\n        {announcement}\n      </span>\n      {count === 0\n        ? (\n            <CheckIcon\n              aria-hidden=\"true\"\n              className=\"size-3.5 text-emerald-600 dark:text-emerald-400\"\n            />\n          )\n        : null}\n      <span aria-hidden=\"true\" className=\"tabular-nums\">\n        {label}\n      </span>\n      {count > 0\n        ? (\n            <span aria-hidden=\"true\" className=\"flex items-center gap-1 tabular-nums\">\n              <span className=\"text-emerald-600 dark:text-emerald-400\">\n                +\n                {added}\n              </span>\n              <span className=\"text-destructive\">\n                −\n                {removed}\n              </span>\n            </span>\n          )\n        : null}\n    </span>\n  )\n}\n\n/**\n * Toolbar controls for the diff view: navigation between changed chunks with\n * their position and line counts, plus accept and reject actions for the chunk\n * under the cursor and for every remaining chunk. Render it inside the editor\n * toolbar.\n */\nexport function CodeEditorDiffToolbar({\n  hideCount = false,\n  hideActions = false,\n}: CodeEditorDiffToolbarProps) {\n  const { view } = useCodeEditor()\n\n  useCodeEditorState()\n\n  if (!view) {\n    return null\n  }\n\n  // Accept and reject rewrite the comparison document, which only the unified\n  // view owns; a split view reverts chunks between the panes instead.\n  const actionsHidden = hideActions || mergeViewSiblings(view) !== null\n\n  if (hideCount && actionsHidden) {\n    return null\n  }\n\n  const { chunks, index, added, removed, dirty } = computeDiffReview(view)\n  const count = chunks.length\n\n  return (\n    <div\n      role=\"group\"\n      aria-label=\"Diff review\"\n      className=\"flex items-center gap-1\"\n    >\n      <Separator\n        orientation=\"vertical\"\n        className=\"mx-1 hidden h-5 self-center sm:block\"\n      />\n      <CodeEditorToolbarButton\n        label=\"Previous change\"\n        shortcut=\"Mod Alt ↑\"\n        disabled={count === 0}\n        onClick={() => moveToDiffChunk(view, -1)}\n      >\n        <ChevronUpIcon />\n      </CodeEditorToolbarButton>\n      <CodeEditorToolbarButton\n        label=\"Next change\"\n        shortcut=\"Mod Alt ↓\"\n        disabled={count === 0}\n        onClick={() => moveToDiffChunk(view, 1)}\n      >\n        <ChevronDownIcon />\n      </CodeEditorToolbarButton>\n      {hideCount\n        ? null\n        : (\n            <DiffStatus\n              count={count}\n              index={index}\n              added={added}\n              removed={removed}\n            />\n          )}\n      {actionsHidden\n        ? null\n        : (\n            <>\n              <CodeEditorToolbarButton\n                label=\"Accept change\"\n                shortcut=\"Mod Enter\"\n                disabled={index < 0}\n                onClick={() => acceptChunk(view)}\n              >\n                <CheckIcon />\n              </CodeEditorToolbarButton>\n              <CodeEditorToolbarButton\n                label=\"Reject change\"\n                shortcut=\"Shift Mod Enter\"\n                disabled={index < 0}\n                onClick={() => rejectChunk(view)}\n              >\n                <XIcon />\n              </CodeEditorToolbarButton>\n              <CodeEditorToolbarButton\n                label=\"Accept all changes\"\n                disabled={count === 0}\n                onClick={() => acceptAllDiffChunks(view)}\n              >\n                <CheckCheckIcon />\n              </CodeEditorToolbarButton>\n              <CodeEditorToolbarButton\n                label=\"Reject all changes\"\n                disabled={count === 0}\n                onClick={() => rejectAllDiffChunks(view)}\n              >\n                <XCircleIcon />\n              </CodeEditorToolbarButton>\n              {count === 0 && dirty\n                ? (\n                    <CodeEditorToolbarButton\n                      label=\"Reset comparison\"\n                      onClick={() => resetDiff(view)}\n                    >\n                      <RefreshCwIcon />\n                    </CodeEditorToolbarButton>\n                  )\n                : null}\n            </>\n          )}\n    </div>\n  )\n}\n",
      "type": "registry:ui",
      "target": "components/blocove/code-editor/diff.tsx"
    }
  ],
  "categories": [
    "code-editor",
    "diff"
  ],
  "type": "registry:ui"
}