import * as react_jsx_runtime from 'react/jsx-runtime';
import { ReactNode, PropsWithChildren, ComponentType } from 'react';
import PropTypes from 'prop-types';
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
import { ApiHolder, ApiRef, ApiFactory, AnyApiRef, OAuthRequestApi, DiscoveryApi, AuthProviderInfo, ConfigApi, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, ProfileInfo, BackstageIdentityResponse, OAuthApi, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, SessionApi, SessionState, AuthRequestOptions, oktaAuthApiRef, microsoftAuthApiRef, oneloginAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, atlassianAuthApiRef, vmwareCloudAuthApiRef, AlertApi, AlertMessage, AnalyticsApi, AnalyticsEvent, AppThemeApi, AppTheme, ErrorApi, ErrorApiError, ErrorApiErrorContext, FeatureFlagsApi, FeatureFlag, FeatureFlagsSaveOptions, FetchApi, IdentityApi, OAuthRequesterOptions, OAuthRequester, PendingOAuthRequest, StorageApi, StorageValueSnapshot, BackstagePlugin, IconComponent, ExternalRouteRef, AnyApiFactory, RouteRef, SubRouteRef } from '@backstage/core-plugin-api';
import * as _backstage_types from '@backstage/types';
import { Observable, JsonValue } from '@backstage/types';
import { Config, AppConfig } from '@backstage/config';
export { ConfigReader } from '@backstage/config';

/**
 * Prop types for the ApiProvider component.
 * @public
 */
type ApiProviderProps = {
    apis: ApiHolder;
    children: ReactNode;
};
/**
 * Provides an {@link @backstage/core-plugin-api#ApiHolder} for consumption in
 * the React tree.
 *
 * @public
 */
declare const ApiProvider: {
    (props: PropsWithChildren<ApiProviderProps>): react_jsx_runtime.JSX.Element;
    propTypes: {
        apis: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
            get: PropTypes.Validator<(...args: any[]) => any>;
        }>>>;
        children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
    };
};

/**
 * @public
 */
type ApiFactoryHolder = {
    get<T>(api: ApiRef<T>): ApiFactory<T, T, {
        [key in string]: unknown;
    }> | undefined;
};

/**
 * Handles the actual on-demand instantiation and memoization of APIs out of
 * an {@link ApiFactoryHolder}.
 *
 * @public
 */
declare class ApiResolver implements ApiHolder {
    private readonly factories;
    /**
     * Validate factories by making sure that each of the apis can be created
     * without hitting any circular dependencies.
     */
    static validateFactories(factories: ApiFactoryHolder, apis: Iterable<AnyApiRef>): void;
    private readonly apis;
    constructor(factories: ApiFactoryHolder);
    get<T>(ref: ApiRef<T>): T | undefined;
    private load;
    private loadDeps;
}

/**
 * Scope type when registering API factories.
 * @public
 */
type ApiFactoryScope = 'default' | 'app' | 'static';
/**
 * ApiFactoryRegistry is an ApiFactoryHolder implementation that enables
 * registration of API Factories with different scope.
 *
 * Each scope has an assigned priority, where factories registered with
 * higher priority scopes override ones with lower priority.
 *
 * @public
 */
declare class ApiFactoryRegistry implements ApiFactoryHolder {
    private readonly factories;
    /**
     * Register a new API factory. Returns true if the factory was added
     * to the registry.
     *
     * A factory will not be added to the registry if there is already
     * an existing factory with the same or higher priority.
     */
    register<Api, Impl extends Api, Deps extends {
        [name in string]: unknown;
    }>(scope: ApiFactoryScope, factory: ApiFactory<Api, Impl, Deps>): boolean;
    get<T>(api: ApiRef<T>): ApiFactory<T, T, {
        [x: string]: unknown;
    }> | undefined;
    getAllApis(): Set<AnyApiRef>;
}

/**
 * Create options for OAuth APIs.
 * @public
 */
type OAuthApiCreateOptions = AuthApiCreateOptions & {
    oauthRequestApi: OAuthRequestApi;
    defaultScopes?: string[];
};
/**
 * Generic create options for auth APIs.
 * @public
 */
type AuthApiCreateOptions = {
    discoveryApi: DiscoveryApi;
    environment?: string;
    provider?: AuthProviderInfo;
    configApi?: ConfigApi;
};

/**
 * Implements the OAuth flow to GitHub products.
 *
 * @public
 */
declare class GithubAuth {
    static create(options: OAuthApiCreateOptions): typeof githubAuthApiRef.T;
}

/**
 * Implements the OAuth flow to GitLab products.
 *
 * @public
 */
declare class GitlabAuth {
    static create(options: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T;
}

/**
 * Implements the OAuth flow to Google products.
 *
 * @public
 */
declare class GoogleAuth {
    static create(options: OAuthApiCreateOptions): typeof googleAuthApiRef.T;
}

/**
 * Options used to open a login popup.
 *
 * @public
 */
type OpenLoginPopupOptions = {
    /**
     * The URL that the auth popup should point to
     */
    url: string;
    /**
     * The name of the popup, as in second argument to window.open
     */
    name: string;
    /**
     * The width of the popup in pixels, defaults to 500
     */
    width?: number;
    /**
     * The height of the popup in pixels, defaults to 700
     */
    height?: number;
};
/**
 * Show a popup pointing to a URL that starts an auth flow. Implementing the receiving
 * end of the postMessage mechanism outlined in https://tools.ietf.org/html/draft-sakimura-oauth-wmrm-00
 *
 * The redirect handler of the flow should use postMessage to communicate back
 * to the app window. The message posted to the app must match the AuthResult type.
 *
 * The returned promise resolves to the response of the message that was posted from the auth popup.
 *
 * @public
 */
declare function openLoginPopup(options: OpenLoginPopupOptions): Promise<unknown>;

/**
 * @public
 */
type AuthConnectorCreateSessionOptions = {
    scopes: Set<string>;
    instantPopup?: boolean;
};
/**
 * @public
 */
type AuthConnectorRefreshSessionOptions = {
    scopes: Set<string>;
};
/**
 * An AuthConnector is responsible for realizing auth session actions
 * by for example communicating with a backend or interacting with the user.
 *
 * @public
 */
type AuthConnector<AuthSession> = {
    createSession(options: AuthConnectorCreateSessionOptions): Promise<AuthSession>;
    refreshSession(options?: AuthConnectorRefreshSessionOptions): Promise<AuthSession>;
    removeSession(): Promise<void>;
};
/**
 * Options for login popup
 * @public
 */
type PopupOptions = {
    size?: {
        width: number;
        height: number;
        fullscreen?: never;
    } | {
        width?: never;
        height?: never;
        fullscreen: boolean;
    };
};

/**
 * Session information for generic OAuth2 auth.
 *
 * @public
 */
type OAuth2Session = {
    providerInfo: {
        idToken: string;
        accessToken: string;
        scopes: Set<string>;
        expiresAt?: Date;
    };
    profile: ProfileInfo;
    backstageIdentity?: BackstageIdentityResponse;
};
/**
 * OAuth2 create options.
 * @public
 */
type OAuth2CreateOptions = OAuthApiCreateOptions & {
    scopeTransform?: (scopes: string[]) => string[];
    popupOptions?: PopupOptions;
};
/**
 * OAuth2 create options with custom auth connector.
 * @public
 */
type OAuth2CreateOptionsWithAuthConnector = {
    scopeTransform?: (scopes: string[]) => string[];
    defaultScopes?: string[];
    authConnector: AuthConnector<OAuth2Session>;
};

/**
 * Implements a generic OAuth2 flow for auth.
 *
 * @public
 */
declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, SessionApi {
    private static createAuthConnector;
    static create(options: OAuth2CreateOptions | OAuth2CreateOptionsWithAuthConnector): OAuth2;
    private readonly sessionManager;
    private readonly scopeTransform;
    private constructor();
    signIn(): Promise<void>;
    signOut(): Promise<void>;
    sessionState$(): Observable<SessionState>;
    getAccessToken(scope?: string | string[], options?: AuthRequestOptions): Promise<string>;
    getIdToken(options?: AuthRequestOptions): Promise<string>;
    getBackstageIdentity(options?: AuthRequestOptions): Promise<BackstageIdentityResponse | undefined>;
    getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
    /**
     * @public
     */
    static normalizeScopes(scopes?: string | string[], options?: {
        scopeTransform: (scopes: string[]) => string[];
    }): Set<string>;
}

/**
 * Implements the OAuth flow to Okta products.
 *
 * @public
 */
declare class OktaAuth {
    static create(options: OAuthApiCreateOptions): typeof oktaAuthApiRef.T;
}

/**
 * Implements a general SAML based auth flow.
 *
 * @public
 */
declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionApi {
    private readonly sessionManager;
    static create(options: AuthApiCreateOptions): SamlAuth;
    sessionState$(): Observable<SessionState>;
    private constructor();
    signIn(): Promise<void>;
    signOut(): Promise<void>;
    getBackstageIdentity(options?: AuthRequestOptions): Promise<BackstageIdentityResponse | undefined>;
    getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
}

/**
 * Implements the OAuth flow to Microsoft products.
 *
 * @public
 */
declare class MicrosoftAuth {
    private oauth2;
    private configApi;
    private environment;
    private provider;
    private oauthRequestApi;
    private discoveryApi;
    private scopeTransform;
    private static MicrosoftGraphID;
    static create(options: OAuth2CreateOptions): typeof microsoftAuthApiRef.T;
    private constructor();
    private microsoftGraph;
    private static resourceForScopes;
    private static resourceForScope;
    getAccessToken(scope?: string | string[], options?: AuthRequestOptions): Promise<string>;
    getIdToken(options?: AuthRequestOptions): Promise<string>;
    getProfile(options?: AuthRequestOptions): Promise<_backstage_core_plugin_api.ProfileInfo | undefined>;
    getBackstageIdentity(options?: AuthRequestOptions): Promise<_backstage_core_plugin_api.BackstageIdentityResponse | undefined>;
    signIn(): Promise<void>;
    signOut(): Promise<void>;
    sessionState$(): _backstage_types.Observable<_backstage_core_plugin_api.SessionState>;
}

/**
 * OneLogin auth provider create options.
 * @public
 */
type OneLoginAuthCreateOptions = {
    configApi?: ConfigApi;
    discoveryApi: DiscoveryApi;
    oauthRequestApi: OAuthRequestApi;
    environment?: string;
    provider?: AuthProviderInfo;
};
/**
 * Implements a OneLogin OAuth flow.
 *
 * @public
 */
declare class OneLoginAuth {
    static create(options: OneLoginAuthCreateOptions): typeof oneloginAuthApiRef.T;
}

/**
 * Session information for Bitbucket auth.
 *
 * @public
 */
type BitbucketSession = {
    providerInfo: {
        accessToken: string;
        scopes: Set<string>;
        expiresAt?: Date;
    };
    profile: ProfileInfo;
    backstageIdentity: BackstageIdentityResponse;
};

/**
 * Implements the OAuth flow to Bitbucket products.
 *
 * @public
 */
declare class BitbucketAuth {
    static create(options: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T;
}

/**
 * Session information for Bitbucket Server auth.
 *
 * @public
 */
type BitbucketServerSession = {
    providerInfo: {
        accessToken: string;
        scopes: Set<string>;
        expiresAt?: Date;
    };
    profile: ProfileInfo;
    backstageIdentity: BackstageIdentityResponse;
};

/**
 * Implements the OAuth flow to Bitbucket Server.
 * @public
 */
declare class BitbucketServerAuth {
    static create(options: OAuthApiCreateOptions): typeof bitbucketServerAuthApiRef.T;
}

/**
 * Implements the OAuth flow to Atlassian products.
 *
 * @public
 */
declare class AtlassianAuth {
    static create(options: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T;
}

/**
 * Implements the OAuth flow for VMware Cloud Services
 *
 * @public
 */
declare class VMwareCloudAuth {
    static create(options: OAuthApiCreateOptions): typeof vmwareCloudAuthApiRef.T;
}

/**
 * Base implementation for the AlertApi that simply forwards alerts to consumers.
 *
 * @public
 */
declare class AlertApiForwarder implements AlertApi {
    private readonly subject;
    post(alert: AlertMessage): void;
    alert$(): Observable<AlertMessage>;
}

/**
 * An implementation of the AnalyticsApi that can be used to forward analytics
 * events to multiple concrete implementations.
 *
 * @public
 *
 * @example
 *
 * ```jsx
 * createApiFactory({
 *   api: analyticsApiRef,
 *   deps: { configApi: configApiRef, identityApi: identityApiRef, storageApi: storageApiRef },
 *   factory: ({ configApi, identityApi, storageApi }) =>
 *     MultipleAnalyticsApi.fromApis([
 *       VendorAnalyticsApi.fromConfig(configApi, { identityApi }),
 *       CustomAnalyticsApi.fromConfig(configApi, { identityApi, storageApi }),
 *     ]),
 * });
 * ```
 */
declare class MultipleAnalyticsApi implements AnalyticsApi {
    private readonly actualApis;
    private constructor();
    /**
     * Create an AnalyticsApi implementation from an array of concrete
     * implementations.
     *
     * @example
     *
     * ```jsx
     * MultipleAnalyticsApi.fromApis([
     *   SomeAnalyticsApi.fromConfig(configApi),
     *   new CustomAnalyticsApi(),
     * ]);
     * ```
     */
    static fromApis(actualApis: AnalyticsApi[]): MultipleAnalyticsApi;
    /**
     * Forward the event to all configured analytics API implementations.
     */
    captureEvent(event: AnalyticsEvent): void;
}

/**
 * Base implementation for the AnalyticsApi that does nothing.
 *
 * @public
 */
declare class NoOpAnalyticsApi implements AnalyticsApi {
    captureEvent(_event: AnalyticsEvent): void;
}

/**
 * Exposes the themes installed in the app, and permits switching the currently
 * active theme.
 *
 * @public
 */
declare class AppThemeSelector implements AppThemeApi {
    private readonly themes;
    static createWithStorage(themes: AppTheme[]): AppThemeSelector;
    private activeThemeId;
    private readonly subject;
    constructor(themes: AppTheme[]);
    getInstalledThemes(): AppTheme[];
    activeThemeId$(): Observable<string | undefined>;
    getActiveThemeId(): string | undefined;
    setActiveThemeId(themeId?: string): void;
}

/**
 * UrlPatternDiscovery is a lightweight DiscoveryApi implementation.
 * It uses a single template string to construct URLs for each plugin.
 *
 * @public
 */
declare class UrlPatternDiscovery implements DiscoveryApi {
    private readonly parts;
    /**
     * Creates a new UrlPatternDiscovery given a template. The only
     * interpolation done for the template is to replace instances of `{{pluginId}}`
     * with the ID of the plugin being requested.
     *
     * Example pattern: `http://localhost:7007/api/{{ pluginId }}`
     */
    static compile(pattern: string): UrlPatternDiscovery;
    private constructor();
    getBaseUrl(pluginId: string): Promise<string>;
}

/**
 * FrontendHostDiscovery is a config driven DiscoveryApi implementation.
 * It uses the app-config to determine the url for a plugin.
 *
 * @public
 */
declare class FrontendHostDiscovery implements DiscoveryApi {
    private readonly endpoints;
    private readonly defaultEndpoint;
    /**
     * Creates a new FrontendHostDiscovery discovery instance by reading
     * the external target URL from the `discovery.endpoints` config section.
     *
     * eg.
     * ```yaml
     * discovery:
     *  endpoints:
     *    - target: https://internal.example.com/internal-catalog
     *      plugins: [catalog]
     *    - target: https://internal.example.com/secure/api/{{pluginId}}
     *      plugins: [auth, permissions]
     *    - target:
     *        internal: https://internal.example.com/search
     *        external: https://example.com/search
     *      plugins: [search]
     * ```
     *
     * If a plugin is not declared in the config, the discovery will fall back to using the baseUrl with
     * the provided `pathPattern` appended. The default path pattern is `"/api/{{ pluginId }}"`.
     */
    static fromConfig(config: Config, options?: {
        pathPattern?: string;
    }): FrontendHostDiscovery;
    private constructor();
    getBaseUrl(pluginId: string): Promise<string>;
}

/**
 * Decorates an ErrorApi by also forwarding error messages
 * to the alertApi with an 'error' severity.
 *
 * @public
 */
declare class ErrorAlerter implements ErrorApi {
    private readonly alertApi;
    private readonly errorApi;
    constructor(alertApi: AlertApi, errorApi: ErrorApi);
    post(error: ErrorApiError, context?: ErrorApiErrorContext): void;
    error$(): _backstage_types.Observable<{
        error: ErrorApiError;
        context?: ErrorApiErrorContext;
    }>;
}

/**
 * Base implementation for the ErrorApi that simply forwards errors to consumers.
 *
 * @public
 */
declare class ErrorApiForwarder implements ErrorApi {
    private readonly subject;
    post(error: ErrorApiError, context?: ErrorApiErrorContext): void;
    error$(): Observable<{
        error: Error;
        context?: ErrorApiErrorContext;
    }>;
}

/**
 * Utility class that helps with error forwarding.
 *
 * @public
 */
declare class UnhandledErrorForwarder {
    /**
     * Add event listener, such that unhandled errors can be forwarded using an given `ErrorApi` instance
     */
    static forward(errorApi: ErrorApi, errorContext: ErrorApiErrorContext): void;
}

/**
 * A feature flags implementation that stores the flags in the browser's local
 * storage.
 *
 * @public
 */
declare class LocalStorageFeatureFlags implements FeatureFlagsApi {
    private registeredFeatureFlags;
    private flags?;
    registerFlag(flag: FeatureFlag): void;
    getRegisteredFlags(): FeatureFlag[];
    isActive(name: string): boolean;
    save(options: FeatureFlagsSaveOptions): void;
    private load;
}

/**
 * A middleware that modifies the behavior of an ongoing fetch.
 *
 * @public
 */
interface FetchMiddleware {
    /**
     * Applies this middleware to an inner implementation.
     *
     * @param next - The next, inner, implementation, that this middleware shall
     *               call out to as part of the request cycle.
     */
    apply(next: typeof fetch): typeof fetch;
}

/**
 * Builds a fetch API, based on the builtin fetch wrapped by a set of optional
 * middleware implementations that add behaviors.
 *
 * @remarks
 *
 * The middleware are applied in reverse order, i.e. the last one will be
 * "closest" to the base implementation. Passing in `[M1, M2, M3]` effectively
 * leads to `M1(M2(M3(baseImplementation)))`.
 *
 * @public
 */
declare function createFetchApi(options: {
    baseImplementation?: typeof fetch | undefined;
    middleware?: FetchMiddleware | FetchMiddleware[] | undefined;
}): FetchApi;

/**
 * A collection of common middlewares for the FetchApi.
 *
 * @public
 */
declare class FetchMiddlewares {
    /**
     * Handles translation from `plugin://` URLs to concrete http(s) URLs based on
     * the discovery API.
     *
     * @remarks
     *
     * If the request is for `plugin://catalog/entities?filter=x=y`, the discovery
     * API will be queried for `'catalog'`. If it returned
     * `https://backstage.example.net/api/catalog`, the resulting query would be
     * `https://backstage.example.net/api/catalog/entities?filter=x=y`.
     *
     * If the incoming URL protocol was not `plugin`, the request is just passed
     * through verbatim to the underlying implementation.
     */
    static resolvePluginProtocol(options: {
        discoveryApi: DiscoveryApi;
    }): FetchMiddleware;
    /**
     * Injects a Backstage token header when the user is signed in.
     *
     * @remarks
     *
     * Per default, an `Authorization: Bearer <token>` is generated. This can be
     * customized using the `header` option.
     *
     * The header injection only happens on allowlisted URLs. Per default, if the
     * `config` option is passed in, the `backend.baseUrl` is allowlisted, unless
     * the `urlPrefixAllowlist` or `allowUrl` options are passed in, in which case
     * they take precedence. If you pass in neither config nor an
     * allowlist/callback, the middleware will have no effect since effectively no
     * request will match the (nonexistent) rules.
     */
    static injectIdentityAuth(options: {
        identityApi: IdentityApi;
        config?: Config;
        urlPrefixAllowlist?: string[];
        allowUrl?: (url: string) => boolean;
        header?: {
            name: string;
            value: (backstageToken: string) => string;
        };
    }): FetchMiddleware;
    private constructor();
}

/**
 * The OAuthRequestManager is an implementation of the OAuthRequestApi.
 *
 * The purpose of this class and the API is to read a stream of incoming requests
 * of OAuth access tokens from different providers with varying scope, and funnel
 * them all together into a single request for each OAuth provider.
 *
 * @public
 */
declare class OAuthRequestManager implements OAuthRequestApi {
    private readonly subject;
    private currentRequests;
    private handlerCount;
    createAuthRequester<T>(options: OAuthRequesterOptions<T>): OAuthRequester<T>;
    private makeAuthRequest;
    authRequest$(): Observable<PendingOAuthRequest[]>;
}

/**
 * An implementation of the storage API, that uses the browser's local storage.
 *
 * @public
 */
declare class WebStorage implements StorageApi {
    private readonly namespace;
    private readonly errorApi;
    constructor(namespace: string, errorApi: ErrorApi);
    private static hasSubscribed;
    static create(options: {
        errorApi: ErrorApi;
        namespace?: string;
    }): WebStorage;
    private static addStorageEventListener;
    get<T>(key: string): T | undefined;
    snapshot<T extends JsonValue>(key: string): StorageValueSnapshot<T>;
    forBucket(name: string): WebStorage;
    set<T>(key: string, data: T): Promise<void>;
    remove(key: string): Promise<void>;
    observe$<T extends JsonValue>(key: string): Observable<StorageValueSnapshot<T>>;
    private handleStorageChange;
    private getKeyName;
    private notifyChanges;
    private subscribers;
    private readonly observable;
}

/**
 * Props for the {@link AppRouter} component.
 * @public
 */
interface AppRouterProps {
    children?: ReactNode;
}
/**
 * App router and sign-in page wrapper.
 *
 * @public
 * @remarks
 *
 * The AppRouter provides the routing context and renders the sign-in page.
 * Until the user has successfully signed in, this component will render
 * the sign-in page. Once the user has signed-in, it will instead render
 * the app, while providing routing and route tracking for the app.
 */
declare function AppRouter(props: AppRouterProps): react_jsx_runtime.JSX.Element;

/**
 * Props for the `BootErrorPage` component of {@link AppComponents}.
 *
 * @public
 */
type BootErrorPageProps = PropsWithChildren<{
    step: 'load-config' | 'load-chunk';
    error: Error;
}>;
/**
 * Props for the `SignInPage` component of {@link AppComponents}.
 *
 * @public
 */
type SignInPageProps = PropsWithChildren<{
    /**
     * Set the IdentityApi on successful sign-in. This should only be called once.
     */
    onSignInSuccess(identityApi: IdentityApi): void;
}>;
/**
 * Props for the fallback error boundary.
 *
 * @public
 */
type ErrorBoundaryFallbackProps = PropsWithChildren<{
    plugin?: BackstagePlugin;
    error: Error;
    resetError: () => void;
}>;
/**
 * A set of replaceable core components that are part of every Backstage app.
 *
 * @public
 */
type AppComponents = {
    NotFoundErrorPage: ComponentType<PropsWithChildren<{}>>;
    BootErrorPage: ComponentType<BootErrorPageProps>;
    Progress: ComponentType<PropsWithChildren<{}>>;
    Router: ComponentType<PropsWithChildren<{
        basename?: string;
    }>>;
    ErrorBoundaryFallback: ComponentType<ErrorBoundaryFallbackProps>;
    ThemeProvider?: ComponentType<PropsWithChildren<{}>>;
    /**
     * An optional sign-in page that will be rendered instead of the AppRouter at startup.
     *
     * If a sign-in page is set, it will always be shown before the app, and it is up
     * to the sign-in page to handle e.g. saving of login methods for subsequent visits.
     *
     * The sign-in page will be displayed until it has passed up a result to the parent,
     * and which point the AppRouter and all of its children will be rendered instead.
     */
    SignInPage?: ComponentType<SignInPageProps>;
};
/**
 * A set of well-known icons that should be available within an app.
 *
 * @public
 */
type AppIcons = {
    'kind:api': IconComponent;
    'kind:component': IconComponent;
    'kind:domain': IconComponent;
    'kind:group': IconComponent;
    'kind:location': IconComponent;
    'kind:system': IconComponent;
    'kind:user': IconComponent;
    'kind:resource': IconComponent;
    'kind:template': IconComponent;
    brokenImage: IconComponent;
    catalog: IconComponent;
    chat: IconComponent;
    dashboard: IconComponent;
    docs: IconComponent;
    email: IconComponent;
    github: IconComponent;
    group: IconComponent;
    help: IconComponent;
    scaffolder: IconComponent;
    search: IconComponent;
    techdocs: IconComponent;
    user: IconComponent;
    warning: IconComponent;
    star: IconComponent;
    unstarred: IconComponent;
};
/**
 * A function that loads in the App config that will be accessible via the ConfigApi.
 *
 * If multiple config objects are returned in the array, values in the earlier configs
 * will override later ones.
 *
 * @public
 */
type AppConfigLoader = () => Promise<AppConfig[]>;
/**
 * Extracts a union of the keys in a map whose value extends the given type
 *
 * @ignore
 */
type KeysWithType<Obj extends {
    [key in string]: any;
}, Type> = {
    [key in keyof Obj]: Obj[key] extends Type ? key : never;
}[keyof Obj];
/**
 * Takes a map Map required values and makes all keys matching Keys optional
 *
 * @ignore
 */
type PartialKeys<Map extends {
    [name in string]: any;
}, Keys extends keyof Map> = Partial<Pick<Map, Keys>> & Required<Omit<Map, Keys>>;
/**
 * Creates a map of target routes with matching parameters based on a map of external routes.
 *
 * @ignore
 */
type TargetRouteMap<ExternalRoutes extends {
    [name: string]: ExternalRouteRef;
}> = {
    [name in keyof ExternalRoutes]: ExternalRoutes[name] extends ExternalRouteRef<infer Params, any> ? RouteRef<Params> | SubRouteRef<Params> | false : never;
};
/**
 * A function that can bind from external routes of a given plugin, to concrete
 * routes of other plugins. See {@link createSpecializedApp}.
 *
 * @public
 */
type AppRouteBinder = <ExternalRoutes extends {
    [name: string]: ExternalRouteRef;
}>(externalRoutes: ExternalRoutes, targetRoutes: PartialKeys<TargetRouteMap<ExternalRoutes>, KeysWithType<ExternalRoutes, ExternalRouteRef<any, true>>>) => void;
/**
 * The options accepted by {@link createSpecializedApp}.
 *
 * @public
 */
type AppOptions = {
    /**
     * A collection of ApiFactories to register in the application to either
     * add new ones, or override factories provided by default or by plugins.
     */
    apis?: Iterable<AnyApiFactory>;
    /**
     * A collection of ApiFactories to register in the application as default APIs.
     * These APIs cannot be overridden by plugin factories, but can be overridden
     * by plugin APIs provided through the
     * A collection of ApiFactories to register in the application to either
     * add new ones, or override factories provided by default or by plugins.
     */
    defaultApis?: Iterable<AnyApiFactory>;
    /**
     * Supply icons to override the default ones.
     */
    icons: AppIcons & {
        [key in string]: IconComponent;
    };
    /**
     * A list of all plugins to include in the app.
     */
    plugins?: Array<BackstagePlugin & {
        output?(): Array<{
            type: 'feature-flag';
            name: string;
        } | {
            type: string;
        }>;
    }>;
    /**
     * Application level feature flags.
     */
    featureFlags?: (FeatureFlag & Omit<FeatureFlag, 'pluginId'>)[];
    /**
     * Supply components to the app to override the default ones.
     */
    components: AppComponents;
    /**
     * Themes provided as a part of the app. By default two themes are included, one
     * light variant of the default backstage theme, and one dark.
     *
     * This is the default config:
     *
     * ```
     * [{
     *   id: 'light',
     *   title: 'Light Theme',
     *   variant: 'light',
     *   icon: <LightIcon />,
     *   Provider: ({ children }) => <UnifiedThemeProvider theme={themes.light} />,
     * }, {
     *   id: 'dark',
     *   title: 'Dark Theme',
     *   variant: 'dark',
     *   icon: <DarkIcon />,
     *   Provider: ({ children }) => <UnifiedThemeProvider theme={themes.dark} />,
     * }]
     * ```
     */
    themes: (Partial<AppTheme> & Omit<AppTheme, 'theme'>)[];
    /**
     * A function that loads in App configuration that will be accessible via
     * the ConfigApi.
     *
     * Defaults to an empty config.
     *
     * TODO(Rugvip): Omitting this should instead default to loading in configuration
     *  that was packaged by the backstage-cli and default docker container boot script.
     */
    configLoader?: AppConfigLoader;
    /**
     * A function that is used to register associations between cross-plugin route
     * references, enabling plugins to navigate between each other.
     *
     * The `bind` function that is passed in should be used to bind all external
     * routes of all used plugins.
     *
     * ```ts
     * bindRoutes({ bind }) {
     *   bind(docsPlugin.externalRoutes, {
     *     homePage: managePlugin.routes.managePage,
     *   })
     *   bind(homePagePlugin.externalRoutes, {
     *     settingsPage: settingsPlugin.routes.settingsPage,
     *   })
     * }
     * ```
     */
    bindRoutes?(context: {
        bind: AppRouteBinder;
    }): void;
    __experimentalTranslations?: {
        defaultLanguage?: string;
        availableLanguages?: string[];
        resources?: Array<{
            $$type: '@backstage/TranslationResource';
            id: string;
        } | {
            $$type: '@backstage/TranslationMessages';
            id: string;
            full: boolean;
            messages: Record<string, string>;
        }>;
    };
};
/**
 * The public API of the output of {@link createSpecializedApp}.
 *
 * @public
 */
type BackstageApp = {
    /**
     * Returns all plugins registered for the app.
     */
    getPlugins(): BackstagePlugin[];
    /**
     * Get a common or custom icon for this app.
     */
    getSystemIcon(key: string): IconComponent | undefined;
    /**
     * Creates the root component that renders the entire app.
     *
     * @remarks
     *
     * This method must only be called once, and you have to provide it the entire
     * app element tree. The element tree will be analyzed to discover plugins,
     * routes, and other app features. The returned component will render all
     * of the app elements wrapped within the app context provider.
     *
     * @example
     * ```tsx
     * export default app.createRoot(
     *   <>
     *     <AlertDisplay />
     *     <OAuthRequestDialog />
     *     <AppRouter>
     *       <Root>{routes}</Root>
     *     </AppRouter>
     *   </>,
     * );
     * ```
     */
    createRoot(element: JSX.Element): ComponentType<PropsWithChildren<{}>>;
    /**
     * Provider component that should wrap the Router created with getRouter()
     * and any other components that need to be within the app context.
     *
     * @deprecated Use {@link BackstageApp.createRoot} instead.
     */
    getProvider(): ComponentType<PropsWithChildren<{}>>;
    /**
     * Router component that should wrap the App Routes create with getRoutes()
     * and any other components that should only be available while signed in.
     *
     * @deprecated Import and use the {@link AppRouter} component from `@backstage/core-app-api` instead
     */
    getRouter(): ComponentType<PropsWithChildren<{}>>;
};
/**
 * The central context providing runtime app specific state that plugin views
 * want to consume.
 *
 * @public
 */
type AppContext = {
    /**
     * Get a list of all plugins that are installed in the app.
     */
    getPlugins(): BackstagePlugin[];
    /**
     * Get a common or custom icon for this app.
     */
    getSystemIcon(key: string): IconComponent | undefined;
    /**
     * Get a list of common and custom icons for this app.
     */
    getSystemIcons(): Record<string, IconComponent>;
    /**
     * Get the components registered for various purposes in the app.
     */
    getComponents(): AppComponents;
};

/**
 * Creates a new Backstage App where the full set of options are required.
 *
 * @public
 * @param options - A set of options for creating the app
 * @returns
 * @remarks
 *
 * You will most likely want to use {@link @backstage/app-defaults#createApp},
 * however, this low-level API allows you to provide a full set of options,
 * including your own `components`, `icons`, `defaultApis`, and `themes`. This
 * is particularly useful if you are not using `@backstage/core-components` or
 * Material UI, as it allows you to avoid those dependencies completely.
 */
declare function createSpecializedApp(options: AppOptions): BackstageApp;

/**
 * The default config loader, which expects that config is available at compile-time
 * in `process.env.APP_CONFIG`. APP_CONFIG should be an array of config objects as
 * returned by the config loader.
 *
 * It will also load runtime config from the __APP_INJECTED_RUNTIME_CONFIG__ string,
 * which can be rewritten at runtime to contain an additional JSON config object.
 * If runtime config is present, it will be placed first in the config array, overriding
 * other config values.
 *
 * @public
 */
declare const defaultConfigLoader: AppConfigLoader;

/**
 * Props for the {@link FlatRoutes} component.
 *
 * @public
 */
type FlatRoutesProps = {
    children: ReactNode;
};
/**
 * A wrapper around a set of routes.
 *
 * @remarks
 *
 * The root of the routing hierarchy in your app should use this component,
 * instead of the one from `react-router-dom`. This ensures that all of the
 * plugin route and utility API wiring happens under the hood.
 *
 * @public
 */
declare const FlatRoutes: (props: FlatRoutesProps) => JSX.Element | null;

/**
 * Props for the {@link FeatureFlagged} component.
 *
 * @public
 */
type FeatureFlaggedProps = {
    children: ReactNode;
} & ({
    with: string;
} | {
    without: string;
});
/**
 * Enables or disables rendering of its children based on the state of a given
 * feature flag.
 *
 * @public
 */
declare const FeatureFlagged: (props: FeatureFlaggedProps) => react_jsx_runtime.JSX.Element;

export { AlertApiForwarder, type ApiFactoryHolder, ApiFactoryRegistry, type ApiFactoryScope, ApiProvider, type ApiProviderProps, ApiResolver, type AppComponents, type AppConfigLoader, type AppContext, type AppIcons, type AppOptions, type AppRouteBinder, AppRouter, type AppRouterProps, AppThemeSelector, AtlassianAuth, type AuthApiCreateOptions, type AuthConnector, type AuthConnectorCreateSessionOptions, type AuthConnectorRefreshSessionOptions, type BackstageApp, BitbucketAuth, BitbucketServerAuth, type BitbucketServerSession, type BitbucketSession, type BootErrorPageProps, ErrorAlerter, ErrorApiForwarder, type ErrorBoundaryFallbackProps, FeatureFlagged, type FeatureFlaggedProps, type FetchMiddleware, FetchMiddlewares, FlatRoutes, type FlatRoutesProps, FrontendHostDiscovery, GithubAuth, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, MultipleAnalyticsApi, NoOpAnalyticsApi, OAuth2, type OAuth2CreateOptions, type OAuth2CreateOptionsWithAuthConnector, type OAuth2Session, type OAuthApiCreateOptions, OAuthRequestManager, OktaAuth, OneLoginAuth, type OneLoginAuthCreateOptions, type OpenLoginPopupOptions, type PopupOptions, SamlAuth, type SignInPageProps, UnhandledErrorForwarder, UrlPatternDiscovery, VMwareCloudAuth, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader, openLoginPopup };
