import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, Text } from "ink";
export function QueuedPromptPanel(props) {
    const visible = visibleQueuedPrompts(props.prompts, 3);
    if (visible.length === 0)
        return null;
    const previewWidth = Math.max(16, Math.min(props.width - 18, 80));
    const hidden = props.prompts.length - visible.length;
    return (_jsxs(Box, { flexDirection: "column", paddingX: 1, width: props.width, children: [_jsx(Text, { color: "gray", children: `queued ${props.prompts.length} ${props.prompts.length === 1 ? "prompt" : "prompts"}` }), visible.map((prompt, index) => (_jsx(Text, { color: "gray", children: `  ${index + 1}. ${formatQueuedPromptPreview(prompt, previewWidth)}` }, `${index}-${prompt}`))), hidden > 0 && _jsx(Text, { color: "gray", children: `  +${hidden} more` })] }));
}
export function visibleQueuedPrompts(prompts, limit) {
    return prompts.slice(0, Math.max(0, limit));
}
export function formatQueuedPromptPreview(value, width) {
    const normalized = value.replace(/\s+/g, " ").trim();
    const max = Math.max(4, width);
    if (normalized.length <= max)
        return normalized;
    return `${normalized.slice(0, max - 3)}...`;
}
