/*!
 * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (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 QueryMethod } from "./getByQuerySelector.js";
import { type AccessibleTextSelector, type AriaRole, type ElementChildSelector, type ElementSelector, type TestSelector } from "./testSelector.js";
export type InnerQuerySelectorProps<LocalTestSelector extends TestSelector, LocalQueryMethod extends QueryMethod> = {
    /**
     * Testing Library method used to query elements.
     */
    queryMethod?: LocalQueryMethod;
} & (LocalTestSelector extends ElementSelector ? LocalTestSelector["elementSelector"] extends {
    role: infer Role;
} ? Role extends AriaRole[] ? {
    /**
     * Role is used when you have an optional `role`; otherwise, it's baked into the metadata.
     */
    role: Role[number];
} : object : object : object) & (LocalTestSelector extends ElementSelector ? {
    /**
     * Helps narrow down HTML selection to the correct element.
     */
    options: Record<keyof LocalTestSelector["elementSelector"]["options"], string | RegExp>;
} : object);
export declare const captureElement: <LocalTestSelector extends TestSelector, QuerySelectorOptions extends Record<string, string | RegExp>, LocalQueryMethod extends QueryMethod = "get">({ containerElement, queryMethod, querySelectorOptions, role, testSelector, }: {
    containerElement: HTMLElement;
    queryMethod: LocalQueryMethod;
    querySelectorOptions?: QuerySelectorOptions;
    role?: AriaRole;
    testSelector: LocalTestSelector;
}) => HTMLElement | (LocalQueryMethod extends "get" ? HTMLElement : HTMLElement | null) | null;
export declare const querySelector: <LocalTestSelector extends TestSelector>(
/**
 * Selectors object including children and accessible text selections.
 */
testSelector: LocalTestSelector) => <LocalQueryMethod extends QueryMethod = "get">(props: {
    /**
     * Refers to Testing Library's canvas. This is usually `screen`, but Storybook uses `within(canvas)`.
     */
    element: HTMLElement;
} & InnerQuerySelectorProps<LocalTestSelector, LocalQueryMethod>) => {
    element: LocalQueryMethod extends "get" ? HTMLElement : HTMLElement | null;
    getAccessibleText: LocalTestSelector extends AccessibleTextSelector ? <LabelName extends LocalTestSelector extends AccessibleTextSelector ? keyof LocalTestSelector["accessibleText"] : never>(labelName: LabelName) => string : never;
    selectChild: LocalTestSelector extends ElementChildSelector ? <ChildName extends LocalTestSelector extends ElementChildSelector ? keyof LocalTestSelector["children"] : keyof ElementChildSelector, ChildQueryMethod extends QueryMethod = "get">(childProps: {
        name: ChildName;
    } & InnerQuerySelectorProps<LocalTestSelector extends ElementChildSelector ? LocalTestSelector["children"][ChildName] : TestSelector, ChildQueryMethod>) => {
        element: ChildQueryMethod extends "get" ? HTMLElement : HTMLElement | null;
        getAccessibleText: (LocalTestSelector extends ElementChildSelector ? LocalTestSelector["children"][ChildName] : TestSelector) extends infer T ? T extends (LocalTestSelector extends ElementChildSelector ? LocalTestSelector["children"][ChildName] : TestSelector) ? T extends AccessibleTextSelector ? <LabelName extends T extends AccessibleTextSelector ? keyof T["accessibleText"] : never>(labelName: LabelName) => string : never : never : never;
        selectChild: (LocalTestSelector extends ElementChildSelector ? LocalTestSelector["children"][ChildName] : TestSelector) extends infer T_1 ? T_1 extends (LocalTestSelector extends ElementChildSelector ? LocalTestSelector["children"][ChildName] : TestSelector) ? T_1 extends ElementChildSelector ? <ChildName_1 extends T_1 extends ElementChildSelector ? keyof T_1["children"] : "children", ChildQueryMethod_1 extends QueryMethod = "get">(childProps: {
            name: ChildName_1;
        } & {
            /**
             * Testing Library method used to query elements.
             */
            queryMethod?: ChildQueryMethod_1 | undefined;
        } & ((T_1 extends ElementChildSelector ? T_1["children"][ChildName_1] : TestSelector) extends infer T_2 ? T_2 extends (T_1 extends ElementChildSelector ? T_1["children"][ChildName_1] : TestSelector) ? T_2 extends ElementSelector ? T_2["elementSelector"] extends {
            role: infer Role;
        } ? Role extends AriaRole[] ? {
            /**
             * Role is used when you have an optional `role`; otherwise, it's baked into the metadata.
             */
            role: Role[number];
        } : object : object : object : never : never) & ((T_1 extends ElementChildSelector ? T_1["children"][ChildName_1] : TestSelector) extends infer T_3 ? T_3 extends (T_1 extends ElementChildSelector ? T_1["children"][ChildName_1] : TestSelector) ? T_3 extends ElementSelector ? {
            /**
             * Helps narrow down HTML selection to the correct element.
             */
            options: Record<keyof T_3["elementSelector"]["options"], string | RegExp>;
        } : object : never : never)) => {
            element: ChildQueryMethod_1 extends "get" ? HTMLElement : HTMLElement | null;
            getAccessibleText: (T_1 extends ElementChildSelector ? T_1["children"][ChildName_1] : TestSelector) extends infer T_4 ? T_4 extends (T_1 extends ElementChildSelector ? T_1["children"][ChildName_1] : TestSelector) ? T_4 extends AccessibleTextSelector ? <LabelName extends T_1 extends AccessibleTextSelector ? keyof T_1["accessibleText"] : never>(labelName: LabelName) => string : never : never : never;
            selectChild: (T_1 extends ElementChildSelector ? T_1["children"][ChildName_1] : TestSelector) extends infer T_5 ? T_5 extends (T_1 extends ElementChildSelector ? T_1["children"][ChildName_1] : TestSelector) ? T_5 extends ElementChildSelector ? /*elided*/ any : never : never : never;
        } : never : never : never;
    } : never;
};
//# sourceMappingURL=querySelector.d.ts.map