/**
 * 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 type { ElementText } from './selectorUtils';
type QueryContext = {
    scope: Element | Document;
    pierceShadow: boolean;
    originalScope?: Element | Document;
};
export type Selector = any;
export interface SelectorEvaluator {
    query(context: QueryContext, selector: Selector): Element[];
    matches(element: Element, selector: Selector, context: QueryContext): boolean;
}
export interface SelectorEngine {
    matches?(element: Element, args: (string | number | Selector)[], context: QueryContext, evaluator: SelectorEvaluator): boolean;
    query?(context: QueryContext, args: (string | number | Selector)[], evaluator: SelectorEvaluator): Element[];
}
export declare class SelectorEvaluatorImpl implements SelectorEvaluator {
    private _engines;
    private _cacheQueryCSS;
    private _cacheMatches;
    private _cacheQuery;
    private _cacheMatchesSimple;
    private _cacheMatchesParents;
    private _cacheCallMatches;
    private _cacheCallQuery;
    private _cacheQuerySimple;
    _cacheText: Map<Element | ShadowRoot, ElementText>;
    private _scoreMap;
    private _retainCacheCounter;
    constructor();
    begin(): void;
    end(): void;
    private _cached;
    private _checkSelector;
    matches(element: Element, s: Selector, context: QueryContext): boolean;
    query(context: QueryContext, s: any): Element[];
    _markScore(element: Element, score: number): void;
    private _hasScopeClause;
    private _expandContextForScopeMatching;
    private _matchesSimple;
    private _querySimple;
    private _matchesParents;
    private _matchesEngine;
    private _queryEngine;
    private _callMatches;
    private _callQuery;
    private _matchesCSS;
    _queryCSS(context: QueryContext, css: string): Element[];
    private _getEngine;
}
export declare function sortInDOMOrder(elements: Iterable<Element>): Element[];
export {};
//# sourceMappingURL=selectorEvaluator.d.ts.map