/**
 * Unified Input Orchestrator
 *
 * Single point of keyboard input handling for the entire ink-cli.
 * Routes keystrokes based on focus state to prevent conflicts.
 *
 * Focus Priority (highest to lowest):
 * 1. Approval prompt (when visible)
 * 2. Active overlay (selector/autocomplete)
 * 3. Global shortcuts (Ctrl+C, Escape - handled specially)
 * 4. Main text input (default)
 *
 * Mouse scroll events are handled separately by ScrollProvider.
 */
import type React from 'react';
import type { UIState, InputState, SessionState, Message } from '../state/types.js';
import type { ApprovalRequest } from '../components/ApprovalPrompt.js';
import type { QueuedMessage } from '@dexto/core';
import type { TextBuffer } from '../components/shared/text-buffer.js';
import type { TuiAgentBackend } from '../agent-backend.js';
/**
 * Ink-compatible Key interface
 * Converted from our custom KeypressContext Key
 */
export interface Key {
    upArrow: boolean;
    downArrow: boolean;
    leftArrow: boolean;
    rightArrow: boolean;
    pageUp: boolean;
    pageDown: boolean;
    return: boolean;
    escape: boolean;
    ctrl: boolean;
    shift: boolean;
    meta: boolean;
    tab: boolean;
    backspace: boolean;
    delete: boolean;
    /** True if this input came from a paste operation (bracketed paste) */
    paste: boolean;
}
/**
 * Input handler function signature
 * Returns true if the input was consumed, false to continue to next handler
 */
export type InputHandler = (input: string, key: Key) => boolean | void;
/**
 * Handler configuration for the orchestrator
 *
 * Note: Main text input is NOT routed through the orchestrator.
 * TextBufferInput handles its own input directly via useKeypress.
 */
export interface InputHandlers {
    /** Handler for approval prompt (highest priority) */
    approval?: InputHandler;
    /** Handler for active overlay (selector/autocomplete) */
    overlay?: InputHandler;
}
export interface UseInputOrchestratorProps {
    ui: UIState;
    approval: ApprovalRequest | null;
    input: InputState;
    session: SessionState;
    /** Active-turn steer messages (for cancel handling) */
    steerMessages: QueuedMessage[];
    /** Text buffer for clearing input on first Ctrl+C */
    buffer: TextBuffer;
    setUi: React.Dispatch<React.SetStateAction<UIState>>;
    setInput: React.Dispatch<React.SetStateAction<InputState>>;
    setMessages: React.Dispatch<React.SetStateAction<Message[]>>;
    setPendingMessages: React.Dispatch<React.SetStateAction<Message[]>>;
    setSteerMessages: React.Dispatch<React.SetStateAction<QueuedMessage[]>>;
    agent: TuiAgentBackend;
    handlers: InputHandlers;
}
/**
 * Unified input orchestrator hook
 *
 * This is the ONLY keyboard input hook in the entire ink-cli.
 * All keyboard handling is routed through this single point.
 * Mouse events are handled separately by MouseProvider/ScrollProvider.
 */
export declare function useInputOrchestrator({ ui, approval, input, session, steerMessages, buffer, setUi, setInput, setMessages, setPendingMessages, setSteerMessages, agent, handlers, }: UseInputOrchestratorProps): void;
/**
 * Create an input handler for the approval prompt
 */
export interface ApprovalHandlerProps {
    onApprove: (rememberChoice: boolean) => void;
    onDeny: () => void;
    onCancel: () => void;
    selectedOption: 'yes' | 'yes-session' | 'no';
    setSelectedOption: (option: 'yes' | 'yes-session' | 'no') => void;
    isCommandApproval: boolean;
}
export declare function createApprovalInputHandler({ onApprove, onDeny, onCancel, selectedOption, setSelectedOption, isCommandApproval, }: ApprovalHandlerProps): InputHandler;
/**
 * Create an input handler for selector components (BaseSelector pattern)
 */
export interface SelectorHandlerProps {
    itemsLength: number;
    selectedIndexRef: React.RefObject<number>;
    onSelectIndex: (index: number) => void;
    onSelect: () => void;
    onClose: () => void;
}
export declare function createSelectorInputHandler({ itemsLength, selectedIndexRef, onSelectIndex, onSelect, onClose, }: SelectorHandlerProps): InputHandler;
/**
 * Create an input handler for autocomplete components
 */
export interface AutocompleteHandlerProps extends SelectorHandlerProps {
    onTab?: () => void;
}
export declare function createAutocompleteInputHandler({ itemsLength, selectedIndexRef, onSelectIndex, onSelect, onClose, onTab, }: AutocompleteHandlerProps): InputHandler;
/**
 * Create an input handler for the main text input
 */
export interface MainInputHandlerProps {
    value: string;
    cursorPos: number;
    onChange: (value: string) => void;
    setCursorPos: (pos: number) => void;
    onSubmit: (value: string) => void;
    isDisabled: boolean;
    history: string[];
    historyIndex: number;
    onHistoryNavigate?: (direction: 'up' | 'down') => void;
    getLineInfo: (pos: number) => {
        lines: string[];
        lineIndex: number;
        colIndex: number;
        charCount: number;
    };
    getLineStart: (lineIndex: number) => number;
}
export declare function createMainInputHandler({ value, cursorPos, onChange, setCursorPos, onSubmit, isDisabled, history, historyIndex, onHistoryNavigate, getLineInfo, getLineStart, }: MainInputHandlerProps): InputHandler;
//# sourceMappingURL=useInputOrchestrator.d.ts.map