"use client"; import { cn } from "@/lib/utils"; import type { ArrayState, PointerState } from "@/lib/visualizations/types"; import { ArrayElement } from "../primitives/array-element"; import { Pointer } from "../primitives/pointer"; interface ArrayViewProps { array: ArrayState; pointers: PointerState[]; showIndices?: boolean; elementSize?: "sm" | "md" | "lg"; className?: string; } // Must match SIZE_CLASSES in array-element.tsx (Tailwind units × 4) const ELEMENT_WIDTHS = { sm: 40, // w-10 = 40px md: 56, // w-14 = 56px lg: 72, // w-18 = 72px } as const; const ELEMENT_GAPS = { sm: 4, md: 8, lg: 12, } as const; export function ArrayView({ array, pointers, showIndices = true, elementSize = "md", className, }: ArrayViewProps) { const elementWidth = ELEMENT_WIDTHS[elementSize]; const gap = ELEMENT_GAPS[elementSize]; // Calculate total array width for proper pointer alignment const totalWidth = array.elements.length * elementWidth + (array.elements.length - 1) * gap; return (