"use client"; import { ArrowDown, ArrowUp, BookOpen, ChevronLeft, ChevronRight, Crosshair, Pause, Rows3 } from "lucide-react"; import { Button } from "@/components/ui/Button"; import { getTreeNavigationState } from "@/lib/tree/navigation"; import { visibleNodeIdsForStep } from "@/lib/tree/playback"; import type { TrajectoryTree } from "@/lib/tree/types"; import { cn } from "@/lib/utils"; export type CompactNavigatorFocusMode = "node" | "floor"; interface CompactTreeNavigatorProps { tree: TrajectoryTree | null; revealCount: number; selectedNodeId: string | null; autoReadEnabled: boolean; onNavigate: (nodeId: string, mode: CompactNavigatorFocusMode) => void; onToggleAutoRead: () => void; } function shortLabel(value: string) { const trimmed = value.trim(); if (trimmed.length <= 46) return trimmed; return `${trimmed.slice(0, 43)}...`; } export function CompactTreeNavigator({ tree, revealCount, selectedNodeId, autoReadEnabled, onNavigate, onToggleAutoRead }: CompactTreeNavigatorProps) { if (!tree || tree.nodes.length === 0) return null; const visibleIds = visibleNodeIdsForStep(tree.nodes, revealCount); const navigation = getTreeNavigationState(tree.nodes, visibleIds, selectedNodeId); const current = navigation.currentNode; if (!current) return null; const currentFloorPosition = navigation.floors.indexOf(navigation.currentDepth) + 1; const totalFloors = navigation.floors.length; return (