import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { cn } from "../../../../lib/utils";
import { useParheliaSettings } from "../../../hooks/useParheliaSettings";
import { AgentModeSelector } from "./AgentModeSelector";
import { AgentSettingsPopover } from "./AgentSettingsPopover";
import { AgentPredefinedPromptsButton } from "./AgentPredefinedPromptsButton";
import { AgentMobileStatusPopover } from "./AgentMobileStatusPopover";
import { AgentPromptActionButtons } from "./AgentPromptActionButtons";
import { hasPromptPlaceholders, isPromptInPlaceholderMode, } from "../agentPromptPlaceholders";
export function AgentFullPromptControls({ prompt, hasActivePlaceholderInput, hideBottomControls, simpleMode, showAgentConfigControls, readOnly, mode, modeOptions, onModeChange, settingsOpen, onSettingsOpenChange, settingsContent, predefinedPrompts, predefinedOpen, onPredefinedOpenChange, onSelectPredefinedPrompt, showMobileStatusPopover, mobileStatusOpen, onMobileStatusOpenChange, mobileStatusContent, isVoiceDisabled, isListening, isExecuting, pendingApprovalCount, allPlaceholdersFilled, onVoicePointerDown, onVoicePointerUp, onVoicePointerCancel, onStop, onSubmit, footerStatusContent, editHistoryControl, leadingControls, }) {
    const parheliaSettings = useParheliaSettings();
    // The DevModeIndicator renders a fixed ribbon in the viewport's bottom-right
    // corner (dev mode or a configured environment label). When it's showing, it
    // overlaps the footer controls, so reserve extra right padding to clear it.
    const environmentBadgeVisible = process.env.PARHELIA_DEV_MODE === "true" ||
        !!parheliaSettings?.environmentLabel;
    const isInPlaceholderMode = isPromptInPlaceholderMode({
        prompt,
        hasActivePlaceholderInput,
    });
    const placeholderShowsOwnButtons = hideBottomControls && isInPlaceholderMode;
    if (placeholderShowsOwnButtons) {
        return null;
    }
    const shouldShowConfigControls = (showAgentConfigControls ?? !hideBottomControls) &&
        !simpleMode &&
        !isInPlaceholderMode;
    const footerHasContent = shouldShowConfigControls || footerStatusContent;
    return (_jsxs(_Fragment, { children: [_jsxs("div", { className: cn("pointer-events-none relative z-20 -mt-10 mb-2 flex items-center justify-between gap-2 px-2 pb-2", environmentBadgeVisible && "pr-12"), children: [_jsx("div", { className: "pointer-events-auto flex min-h-8 min-w-0 flex-1 items-center gap-1", children: leadingControls }), _jsxs("div", { className: "pointer-events-auto flex min-h-8 shrink-0 items-center justify-end gap-2", children: [shouldShowConfigControls ? (_jsxs("div", { className: "flex min-h-8 flex-wrap items-center justify-start gap-2", children: [readOnly ? (_jsx("span", { className: "rounded-badge badge-pad-sm bg-neutral-grey-5 text-2xs text-neutral-grey-50 shrink-0", title: "You have View-only access to this agent.", "data-testid": "agent-read-only-badge", children: "Read-only" })) : null, _jsx(AgentModeSelector, { mode: mode, options: modeOptions, readOnly: readOnly, onModeChange: onModeChange })] })) : null, _jsx(AgentPromptActionButtons, { isVoiceDisabled: isVoiceDisabled, isListening: isListening, isExecuting: isExecuting, sendDisabled: readOnly ||
                                    (!isExecuting &&
                                        (pendingApprovalCount > 0 ||
                                            (!prompt.trim() && !hasActivePlaceholderInput) ||
                                            (hasPromptPlaceholders(prompt) && !allPlaceholdersFilled) ||
                                            (hasActivePlaceholderInput && !allPlaceholdersFilled))), sendTitle: readOnly
                                    ? "Read-only access"
                                    : isExecuting
                                        ? "Stop"
                                        : pendingApprovalCount > 0
                                            ? "Approve or reject pending tool calls first"
                                            : "Send", onVoicePointerDown: onVoicePointerDown, onVoicePointerUp: onVoicePointerUp, onVoicePointerCancel: onVoicePointerCancel, onStop: onStop, onSubmit: onSubmit })] })] }), footerHasContent ? (_jsxs("div", { className: "mt-1 flex min-h-8 flex-wrap items-center justify-between gap-x-3 gap-y-2", children: [_jsx("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: footerStatusContent }), shouldShowConfigControls ? (_jsxs("div", { className: cn("flex flex-wrap items-center justify-end gap-2", environmentBadgeVisible && "pr-12"), children: [_jsx(AgentSettingsPopover, { open: settingsOpen, onOpenChange: onSettingsOpenChange, children: settingsContent }), editHistoryControl, _jsx(AgentPredefinedPromptsButton, { prompts: predefinedPrompts, open: predefinedOpen, onOpenChange: onPredefinedOpenChange, onSelectPrompt: onSelectPredefinedPrompt }), showMobileStatusPopover ? (_jsx(AgentMobileStatusPopover, { open: mobileStatusOpen, onOpenChange: onMobileStatusOpenChange, children: mobileStatusContent })) : null] })) : null] })) : null] }));
}
//# sourceMappingURL=AgentFullPromptControls.js.map