"use client"; import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react"; import { IconX, IconClock, IconEdit, IconCheck } from "@tabler/icons-react"; import { Button } from "@kandev/ui"; import { Tooltip, TooltipContent, TooltipTrigger } from "@kandev/ui/tooltip"; import { cn } from "@/lib/utils"; import { Textarea } from "@kandev/ui/textarea"; /** Strip internal ... blocks from display text. */ function stripSystemTags(text: string): string { return text.replace(/[\s\S]*?<\/kandev-system>/g, "").trim(); } export type QueuedMessageIndicatorHandle = { startEdit: () => void; }; type QueuedMessageIndicatorProps = { content: string; onCancel: () => void; onUpdate: (content: string) => Promise; isVisible: boolean; onEditComplete?: () => void; }; type QueuedEditViewProps = { editValue: string; isSaving: boolean; textareaRef: React.RefObject; onChange: (val: string) => void; onKeyDown: (event: React.KeyboardEvent) => void; onSave: () => void; onCancel: () => void; }; function QueuedEditView({ editValue, isSaving, textareaRef, onChange, onKeyDown, onSave, onCancel, }: QueuedEditViewProps) { return (