/**
 * Fingerprint of an indexed element for validation
 */
export interface ElementFingerprint {
    tagName: string;
    id: string | null;
    textContent: string | null;
    type: string | null;
    role: string | null;
    ariaLabel: string | null;
    name: string | null;
    href: string | null;
    selector: string;
    indexVersion: number;
}
/**
 * Result of validating an element at a given index
 */
export interface ValidationResult {
    isValid: boolean;
    mismatchReason?: 'element_removed' | 'element_changed';
}
/**
 * Result of looking up an element by index
 */
export interface ElementLookupResult {
    element: HTMLElement | null;
    error?: string;
}
/**
 * Result of validated element lookup (includes validation info)
 */
export interface ValidatedElementResult extends ElementLookupResult {
    validation: ValidationResult;
}
export declare class DOMService {
    private static instance;
    private elementMap;
    private elementToSequence;
    private selectorMap;
    private fingerprintMap;
    private isIndexed;
    private indexingInProgress;
    private indexVersion;
    private constructor();
    static getInstance(): DOMService;
    /**
     * Generate a unique CSS selector for an element
     */
    private generateSelector;
    /**
     * Generate a fingerprint for an element to enable validation later
     */
    private generateFingerprint;
    /**
     * Check if an element matches a stored fingerprint.
     * Uses strict matching - fails if any key attribute differs.
     */
    private matchesFingerprint;
    /**
     * Validate that the element at a given index still matches its fingerprint.
     * No recovery - just check if element exists and matches.
     */
    private validateElementAtIndex;
    /**
     * Export state for external persistence (selectors and fingerprints)
     */
    exportState(): {
        selectors: Array<[number, string]>;
        fingerprints: Array<[number, ElementFingerprint]>;
    };
    /**
     * Import state from external persistence (selectors and fingerprints)
     */
    importState(state: {
        selectors?: Array<[number, string]>;
        fingerprints?: Array<[number, ElementFingerprint]>;
    }): void;
    /**
     * Index all interactable elements in the live DOM.
     * Always clears previous index first.
     */
    indexInteractableElements(): Array<[number, Element]>;
    /**
     * Get element coordinates using getBoundingClientRect()
     * Returns viewport-relative coordinates
     */
    private getElementCoordinates;
    /**
     * Check if an element creates a stacking context
     * Based on CSS stacking context rules
     */
    private isStackingContext;
    /**
     * Calculate global z-order for an element
     * Traverses up the DOM tree to identify stacking contexts and calculate z-order
     */
    private calculateGlobalZOrder;
    /**
     * Get HTML snapshot with data-id attributes injected.
     * This re-indexes the live DOM and then produces a corresponding HTML string.
     */
    getSnapshotHtml(): string;
    /**
     * Get actionable elements metadata
     */
    getInteractableElements(): Array<{
        index: number;
        fingerprint: ElementFingerprint;
        coords: {
            x: number;
            y: number;
            w: number;
            h: number;
            z: number;
        };
        cssClasses: string[];
    }>;
    getElementByDataId(id: number): Element | undefined;
    getSequenceForElement(element: Element): number | undefined;
    isIndexActive(): boolean;
    clearIndex(): void;
    /**
     * Check if an element is interactable (visible, not hidden, not obscured).
     * Returns error string if not interactable, null if OK.
     */
    private checkInteractability;
    /**
     * Public method to check element interactability (for use by ShowModeService).
     */
    checkElementInteractable(element: HTMLElement, index: number): string | null;
    /**
     * Get an interactive element by its index.
     * Returns element only if it's interactable, otherwise returns null with error.
     */
    getElementByIndex(index: number): ElementLookupResult;
    /**
     * Get an element by index with validation.
     * This is the main entry point for ToolService to use.
     * It validates the element matches its fingerprint and attempts recovery if not.
     * Returns element only if it's interactable.
     */
    getValidatedElement(index: number): ValidatedElementResult;
    /**
     * Get fingerprint for a given index (for debugging/testing)
     */
    getFingerprint(index: number): ElementFingerprint | undefined;
    /**
     * Get all fingerprints (for debugging/testing)
     */
    getAllFingerprints(): Array<[number, ElementFingerprint]>;
    /**
     * Get current index version
     */
    getIndexVersion(): number;
}
export declare const domService: DOMService;
//# sourceMappingURL=DomService.d.ts.map