/**
 * Copyright (c) Microsoft Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { generateAriaTree, findNewElement } from './ariaSnapshot';
import { isElementVisible, isInsideScope } from './domUtils';
import { Highlight } from './highlight';
import { getAriaRole, getElementAccessibleDescription, getElementAccessibleName } from './roleUtils';
import { SelectorEvaluatorImpl } from './selectorEvaluator';
import { elementText } from './selectorUtils';
import { ConsoleAPI } from './consoleApi';
import type { AriaTemplateNode } from '@isomorphic/ariaSnapshot';
import type { Language } from '@isomorphic/locatorGenerators';
import type { ParsedSelector } from '@isomorphic/selectorParser';
import type * as channels from '@protocol/channels';
import type { AriaTreeOptions } from './ariaSnapshot';
import type { SelectorRoot } from './selectorEngine';
import type { GenerateSelectorOptions } from './selectorGenerator';
import type { Builtins } from './utilityScript';
export type FrameExpectParams = Omit<channels.FrameExpectParams, 'expectedValue' | 'timeout'> & {
    expectedValue?: any;
    timeoutForLogs?: number;
    noAutoWaiting?: boolean;
};
export type ElementState = 'visible' | 'hidden' | 'enabled' | 'disabled' | 'editable' | 'checked' | 'unchecked' | 'indeterminate' | 'stable';
export type ElementStateWithoutStable = Exclude<ElementState, 'stable'>;
export type ElementStateQueryResult = {
    matches: boolean;
    received?: string | 'error:notconnected';
    isRadio?: boolean;
};
export type ExpectReceived = {
    value?: any;
    ariaSnapshot?: string;
};
export type HitTargetInterceptionResult = {
    stop: () => 'done' | {
        hitTargetDescription: string;
    };
};
export type InjectedScriptOptions = {
    isUnderTest: boolean;
    sdkLanguage: Language;
    testIdAttributeName: string;
    stableRafCount: number;
    browserName: string;
    shouldPrependErrorPrefix?: boolean;
    isUtilityWorld?: boolean;
    customEngines: {
        name: string;
        source: string;
    }[];
};
export declare class InjectedScript {
    private _engines;
    readonly _evaluator: SelectorEvaluatorImpl;
    private _stableRafCount;
    private _browserName;
    private _shouldPrependErrorPrefix;
    private _isUtilityWorld;
    readonly onGlobalListenersRemoved: Set<() => void>;
    private _hitTargetInterceptor;
    private _highlight;
    readonly isUnderTest: boolean;
    private _sdkLanguage;
    private _testIdAttributeNameForStrictErrorAndConsoleCodegen;
    private _markedElements?;
    readonly window: Window & typeof globalThis;
    readonly document: Document;
    readonly consoleApi: ConsoleAPI;
    private _lastAriaSnapshotForTrack;
    private _lastAriaSnapshotForQuery;
    readonly utils: {
        asLocator: any;
        cacheNormalizedWhitespaces: any;
        elementText: typeof elementText;
        getAriaRole: typeof getAriaRole;
        getElementAccessibleDescription: typeof getElementAccessibleDescription;
        getElementAccessibleName: typeof getElementAccessibleName;
        isElementVisible: typeof isElementVisible;
        isInsideScope: typeof isInsideScope;
        normalizeWhiteSpace: any;
        parseAriaSnapshot: any;
        generateAriaTree: typeof generateAriaTree;
        findNewElement: typeof findNewElement;
        builtins: Builtins;
    };
    private _autoClosingTags;
    private _booleanAttributes;
    private _eventTypes;
    private _hoverHitTargetInterceptorEvents;
    private _tapHitTargetInterceptorEvents;
    private _mouseHitTargetInterceptorEvents;
    private _allHitTargetInterceptorEvents;
    constructor(window: Window & typeof globalThis, options: InjectedScriptOptions);
    eval(expression: string): any;
    testIdAttributeNameForStrictErrorAndConsoleCodegen(): string;
    parseSelector(selector: string): ParsedSelector;
    generateSelector(targetElement: Element, options: GenerateSelectorOptions): {
        selector: string;
        selectors: string[];
        elements: Element[];
    };
    generateSelectorSimple(targetElement: Element, options?: GenerateSelectorOptions): string;
    querySelector(selector: ParsedSelector, root: Node, strict: boolean): Element | undefined;
    private _queryNth;
    private _queryLayoutSelector;
    ariaSnapshot(node: Node, options: AriaTreeOptions): string;
    incrementalAriaSnapshot(node: Node, options: AriaTreeOptions & {
        track?: string;
        depth?: number;
    }): {
        full: string;
        incremental?: string;
        iframeRefs: string[];
        iframeDepths: Record<string, number>;
    };
    ariaSnapshotForRecorder(): {
        ariaSnapshot: string;
        refs: Map<Element, string>;
    };
    getAllElementsMatchingExpectAriaTemplate(document: Document, template: AriaTemplateNode): Element[];
    querySelectorAll(selector: ParsedSelector, root: Node): Element[];
    private _queryEngineAll;
    private _createAttributeEngine;
    private _createCSSEngine;
    private _createTextEngine;
    private _createInternalHasTextEngine;
    private _createInternalHasNotTextEngine;
    private _createInternalLabelEngine;
    private _createNamedAttributeEngine;
    private _createDescribeEngine;
    private _createControlEngine;
    private _createHasEngine;
    private _createHasNotEngine;
    private _createVisibleEngine;
    private _createInternalChainEngine;
    extend(source: string, params: any): any;
    viewportRatio(element: Element): Promise<number>;
    getElementBorderWidth(node: Node): {
        left: number;
        top: number;
    };
    describeIFrameStyle(iframe: Element): 'error:notconnected' | 'transformed' | {
        left: number;
        top: number;
    };
    retarget(node: Node, behavior: 'none' | 'follow-label' | 'no-follow-label' | 'button-link'): Element | null;
    checkElementStates(node: Node, states: ElementState[]): Promise<'error:notconnected' | {
        missingState: ElementState;
    } | undefined>;
    private _checkElementIsStable;
    _createAriaRefEngine(): {
        queryAll: (root: SelectorRoot, selector: string) => Element[];
    };
    elementState(node: Node, state: ElementStateWithoutStable): ElementStateQueryResult;
    selectOptions(node: Node, optionsToSelect: (Node | {
        valueOrLabel?: string;
        value?: string;
        label?: string;
        index?: number;
    })[]): string[] | 'error:notconnected' | 'error:optionsnotfound' | 'error:optionnotenabled';
    fill(node: Node, value: string): 'error:notconnected' | 'needsinput' | 'done';
    selectText(node: Node): 'error:notconnected' | 'done';
    private _activelyFocused;
    focusNode(node: Node, resetSelectionIfNotFocused?: boolean): 'error:notconnected' | 'done';
    blurNode(node: Node): 'error:notconnected' | 'done';
    setInputFiles(node: Node, payloads: {
        name: string;
        mimeType: string;
        buffer: string;
        lastModifiedMs?: number;
    }[]): "Node is not of type HTMLElement" | "Not an <input> element" | "Not an input[type=file] element" | undefined;
    expectHitTarget(hitPoint: {
        x: number;
        y: number;
    }, targetElement: Element): "done" | {
        hitTargetDescription: string;
    };
    setupHitTargetInterceptor(node: Node, action: 'hover' | 'tap' | 'mouse' | 'drag', hitPoint: {
        x: number;
        y: number;
    } | undefined, blockAllEvents: boolean): HitTargetInterceptionResult | 'error:notconnected' | string;
    dispatchEvent(node: Node, type: string, eventInitObj: Object): void;
    previewNode(node: Node): string;
    private _generateSelectors;
    strictModeViolationError(selector: ParsedSelector, matches: Element[]): Error;
    checkDeprecatedSelectorUsage(selector: ParsedSelector, matches: Element[]): void;
    createStacklessError(message: string): Error;
    createHighlight(): Highlight;
    maskSelectors(selectors: ParsedSelector[], color: string): void;
    private _createHighlight;
    private _ensureHighlight;
    addHighlight(selector: ParsedSelector, style?: string): void;
    removeHighlight(selector: ParsedSelector): void;
    setScreencastAnnotation(annotation: {
        point?: channels.Point;
        box?: channels.Rect;
        actionTitle?: string;
        duration?: number;
        position?: string;
        fontSize?: number;
    } | null): void;
    addUserOverlay(id: string, html: string): void;
    getUserOverlay(id: string): HTMLElement | undefined;
    removeUserOverlay(id: string): void;
    setUserOverlaysVisible(visible: boolean): void;
    hideHighlight(): void;
    markTargetElements(markedElements: Set<Element>, callId: string): void;
    private _setupGlobalListenersRemovalDetection;
    private _setupHitTargetInterceptors;
    expect(element: Element | undefined, options: FrameExpectParams, elements: Element[]): Promise<{
        matches: boolean;
        received?: ExpectReceived;
        missingReceived?: boolean;
    }>;
    private _ariaSnapshotForExpect;
    private _renderAriaSnapshot;
    private _expectCore;
    private expectSingleElement;
    private expectArray;
    private _matchSequentially;
}
//# sourceMappingURL=injectedScript.d.ts.map