import * as React from 'react' import { cn } from '@/lib/utils' /** * Per-line classed renderer for unified diffs. Lives outside `CodeCard` so * tool-result panels (already nested inside a tool card) don't double-shell; * for markdown ` ```diff ` fences the standard `CodeCard` + Shiki path runs * instead and gives equivalent coloring. */ interface DiffLineKind { className?: string match: (line: string) => boolean } const DIFF_LINE_KINDS: DiffLineKind[] = [ { className: 'text-emerald-700 dark:text-emerald-300', match: line => line.startsWith('+') && !line.startsWith('+++') }, { className: 'text-rose-700 dark:text-rose-300', match: line => line.startsWith('-') && !line.startsWith('---') }, { className: 'text-sky-700 dark:text-sky-300', match: line => line.startsWith('@@') }, { className: 'text-muted-foreground/70', match: line => line.startsWith('---') || line.startsWith('+++') || / → /.test(line.slice(0, 60)) } ] function classifyLine(line: string): string | undefined { return DIFF_LINE_KINDS.find(kind => kind.match(line))?.className } interface DiffLinesProps extends Omit, 'children'> { text: string } export function DiffLines({ className, text, ...props }: DiffLinesProps) { return (
      {text.split('\n').map((line, index) => (
        
          {line || ' '}
        
      ))}
    
) }