import { PromptInputProps } from '../interfaces';
export { findAdjacentToken } from './dom-utils';
/** Reorders tokens so all pinned tokens come first, preserving relative order. */
export declare function enforcePinnedTokenOrdering(tokens: readonly PromptInputProps.InputToken[]): PromptInputProps.InputToken[];
/** Merges consecutive text tokens into single tokens to avoid DOM fragmentation. */
export declare function mergeConsecutiveTextTokens(tokens: readonly PromptInputProps.InputToken[]): PromptInputProps.InputToken[];
export declare function areAllTokensPinned(tokens: readonly PromptInputProps.InputToken[]): boolean;
/** Checks if a trigger is valid given the menu config, position, and preceding tokens. */
export declare function validateTrigger(menu: PromptInputProps.MenuDefinition, triggerIndex: number, text: string, precedingTokens: readonly PromptInputProps.InputToken[]): boolean;
/** Scans text for trigger characters and splits it into text and trigger tokens. */
export declare function detectTriggersInText(text: string, menus: readonly PromptInputProps.MenuDefinition[], precedingTokens: readonly PromptInputProps.InputToken[], onTriggerDetected?: (detail: PromptInputProps.TriggerDetectedDetail) => boolean, cancelledIds?: Set<string>): PromptInputProps.InputToken[];
/** Calculates the correct caret position after pinned tokens have been reordered to the front. */
export declare function getCaretPositionAfterPinnedReorder(originalTokens: readonly PromptInputProps.InputToken[], newTokens: readonly PromptInputProps.InputToken[], caretPosition: number): number;
/** Maps a caret position from an old token structure to the correct position after structural changes. */
export declare function getCaretPositionAfterTokenRemoval(savedPosition: number | null, prevTokens: readonly PromptInputProps.InputToken[], newTokens: readonly PromptInputProps.InputToken[]): number | null;
/**
 * Removes a logical range [start, end) from the token array.
 * Tokens fully within the range are removed. Text tokens partially within
 * the range are trimmed. Reference and trigger tokens are removed if any
 * part of them falls within the range (they're atomic).
 */
export declare function removeTokenRange(tokens: readonly PromptInputProps.InputToken[], start: number, end: number): PromptInputProps.InputToken[];
//# sourceMappingURL=token-utils.d.ts.map