import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import { Text, Box } from 'ink';
import { MarkdownDisplay } from '../../utils/MarkdownDisplay.js';
import { Colors } from '../../colors.js';
import { SCREEN_READER_MODEL_PREFIX } from '../../textConstants.js';
import { ThinkingBlockDisplay } from './ThinkingBlockDisplay.js';
import { useRuntimeApi } from '../../contexts/RuntimeContext.js';
import { useUIState } from '../../contexts/UIStateContext.js';
export const GeminiMessage = ({ text, isPending, availableTerminalHeight, terminalWidth, model, profileName, thinkingBlocks, }) => {
    /**
     * @plan:PLAN-20251202-THINKING-UI.P06
     * @requirement:REQ-THINK-UI-001
     * @requirement:REQ-THINK-UI-003
     */
    const { getEphemeralSetting } = useRuntimeApi();
    const showThinking = (getEphemeralSetting('reasoning.includeInResponse') ??
        true);
    const { renderMarkdown } = useUIState();
    const prefix = ' ';
    const prefixWidth = prefix.length;
    // Don't show thinkingBlocks in pending items - LoadingIndicator shows the
    // thought subject/description as spinner text during streaming. Only show
    // thinkingBlocks in committed history items to avoid duplication (fixes #922).
    const shouldShowThinkingBlocks = showThinking && !isPending;
    return (_jsxs(Box, { flexDirection: "column", children: [profileName && (_jsx(Box, { marginBottom: 0, children: _jsxs(Text, { color: Colors.DimComment, children: ["[", profileName, "]"] }) })), model && (_jsx(Box, { marginBottom: 0, children: _jsx(Text, { color: Colors.DimComment, children: model }) })), shouldShowThinkingBlocks &&
                thinkingBlocks?.map((block, index) => (_jsx(ThinkingBlockDisplay, { block: block, visible: true }, `thinking-${index}`))), _jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: prefixWidth, children: _jsx(Text, { color: Colors.AccentPurple, "aria-label": SCREEN_READER_MODEL_PREFIX, children: prefix }) }), _jsx(Box, { flexGrow: 1, flexDirection: "column", children: _jsx(MarkdownDisplay, { text: text, isPending: isPending, availableTerminalHeight: availableTerminalHeight, terminalWidth: terminalWidth, renderMarkdown: renderMarkdown }) })] })] }));
};
//# sourceMappingURL=GeminiMessage.js.map