import { P as Plugin } from './core-BCevQFXU.js';
import * as js_logger from 'js-logger';
import js_logger__default, { ILogLevel, GlobalLogger, ILogger } from 'js-logger';

declare const DEFAULT_APP_NAME = "Hawtio Management Console";
declare const DEFAULT_LOGIN_TITLE = "Log in to your account";
declare const HAWTCONFIG_JSON = "hawtconfig.json";
/**
 * The single user-customisable entrypoint for the Hawtio console configurations.
 */
type Hawtconfig = {
    /**
     * Configuration for branding & styles.
     */
    branding?: BrandingConfig;
    /**
     * Configuration for the placement and structure of the UI
     */
    appearance?: AppearanceConfig;
    /**
     * Configuration for the built-in login page.
     */
    login?: LoginConfig;
    /**
     * Configuration for the About modal.
     */
    about?: AboutConfig;
    /**
     * The user can explicitly disable plugins by specifying the plugin route paths.
     *
     * This option can be used if some of the built-in plugins are not desirable
     * for the custom installation of Hawtio console.
     */
    disabledRoutes?: DisabledRoutes;
    /**
     * Configuration for JMX plugin.
     */
    jmx?: JmxConfig;
    /**
     * Configuration for Hawtio Online.
     */
    online?: OnlineConfig;
};
/**
 * Branding configuration type.
 */
type BrandingConfig = {
    appName?: string;
    showAppName?: boolean;
    appLogoUrl?: string;
    appLogoDarkModeUrl?: string;
    css?: string;
    favicon?: string;
};
/**
 * Appearance configuration type.
 */
type AppearanceConfig = {
    /**
     * Whether to display the header bar (default: true)
     */
    showHeader?: boolean;
    /**
     * Whether to display the brand logo on the header bar (default: true)
     */
    showBrand?: boolean;
    /**
     * Whether to display the user header dropdown on the header bar (default: true)
     */
    showUserHeader?: boolean;
    /**
     * Whether to display the sidebar (default: true)
     */
    showSideBar?: boolean;
};
/**
 * Login configuration type.
 */
type LoginConfig = {
    title?: string;
    description?: string;
    links?: LoginLink[];
};
/**
 * Configuration of a single link at the login page
 */
type LoginLink = {
    url: string;
    text: string;
};
/**
 * About configuration type.
 */
type AboutConfig = {
    title?: string;
    description?: string;
    imgSrc?: string;
    imgDarkModeSrc?: string;
    backgroundImgSrc?: string;
    backgroundDarkModeImgSrc?: string;
    productInfo?: AboutProductInfo[];
    copyright?: string;
};
/**
 * Information about single _product_ or _component_ added to Hawtio application
 */
type AboutProductInfo = {
    name: string;
    value: string;
};
/**
 * List of routes which should be disabled in a Hawtio application
 */
type DisabledRoutes = string[];
/**
 * JMX configuration type.
 */
type JmxConfig = {
    /**
     * This option can either disable workspace completely by setting `false`, or
     * specify an array of MBean paths in the form of
     * `<domain>/<prop1>=<value1>,<prop2>=<value2>,...`
     * to fine-tune which MBeans to load into workspace.
     *
     * Note that disabling workspace should also deactivate all the plugins that
     * depend on MBeans provided by workspace.
     *
     * @see https://github.com/hawtio/hawtio-react/issues/421
     */
    workspace?: boolean | string[];
};
/**
 * Hawtio Online configuration type.
 */
type OnlineConfig = {
    /**
     * Selector for OpenShift projects or Kubernetes namespaces.
     *
     * @see https://github.com/hawtio/hawtio-online/issues/64
     */
    projectSelector?: string;
};
/**
 * Stages of initialization tasks performed by Hawtio and presented in `<HawtioInitialization>` component
 */
declare enum TaskState {
    started = 0,
    skipped = 1,
    finished = 2,
    error = 3
}
/**
 * A structure to hold information about initialization tasks performed by Hawtio
 */
type InitializationTasks = Record<string, {
    ready: TaskState;
    group: string;
}>;
/**
 * Supported authentication methods
 */
type AuthenticationKind = 
/**
 * Basic authentication - requires preparation of `Authorization: Basic <base64(user:password)>` HTTP header
 */
'basic'
/**
 * External authentication - triggered even before navigating to Hawtio, so can't really be handled
 */
 | 'external'
/**
 * Digest authentication - [Digest Access Authentication Scheme](https://www.rfc-editor.org/rfc/rfc2617#section-3),
 * uses several challenge parameters (realm, nonces, ...)
 */
 | 'digest'
/**
 * Form authentication - we need to know the URI to send the credentials to. It may be
 * `application/x-www-form-urlencoded` content (then we need to know the fields to use) or JSON with some schema.
 */
 | 'form'
/**
 * This may be tricky, because we can't control it at JavaScript level...
 */
 | 'clientcert'
/**
 * This is universal OpenID connect login type, so we need some information - should be configured
 * using `.well-known/openid-configuration` endpoint, but with additional parameters (to choose supported values
 * for some operations).
 */
 | 'oidc'
/**
 * _Native_ Keycloak authentication using `keycloak.js` library
 */
 | 'keycloak'
/**
 * Probably less standardized than `.well-known/openid-configuration`, but similar. We need to know the endpoints
 * to use for OAuth2 auth.
 */
 | 'oauth2';
/**
 * State of authentication result which is used at login screen to show specific error message
 */
declare enum AuthenticationResult {
    /** successful authentication */
    ok = 0,
    /** error due to initial configuration of the plugin */
    configuration_error = 1,
    /** error due to communication error with IdP (for OIDC) */
    connect_error = 2,
    /** error due to `window.isSecureContext` */
    security_context_error = 3
}
/**
 * Base type for authentication methods supported by Hawtio
 */
type AuthenticationMethod = {
    /** One of the supported methods. If a plugin augments given method, we should have one such method only or matching `position` */
    method: AuthenticationKind;
    /** If there are more methods of the same kind, we need a position field to distinguish them */
    position?: number;
    /** Name to be presented at login page for login method selection */
    name?: string;
    /** Plugin specific method for performing login. For now it's for OAuth2/OIDC/Keycloak. This field is set up by auth plugin */
    login?: () => Promise<AuthenticationResult>;
};
/**
 * Configuration of Basic Authentication
 */
type BasicAuthenticationMethod = AuthenticationMethod & {
    /** Basic Authentication Realm - not sent with `Authorization`, but user should see it */
    realm: string;
};
/**
 * Configuration of FORM-based login configuration
 */
type FormAuthenticationMethod = AuthenticationMethod & {
    /** POST URL to send the credentials to */
    url: string | URL;
    /** POST URL for logout endpoint */
    logoutUrl: string | URL;
    /**
     * `application/x-www-form-urlencoded` or `application/json`. For JSON it's just object with two configurable fields
     */
    type: 'form' | 'json';
    /**
     * Field name for user name
     */
    userField: string;
    /**
     * Field name for password
     * TODO: possibly encoded/encrypted?
     */
    passwordField: string;
};
/**
 * OpenID Connect authentication method configuration.
 * All details are specified in a type defined in OIDC plugin, but here we may define some generic fields
 */
type OidcAuthenticationMethod = AuthenticationMethod & {};
/**
 * Interface through which `ConfigManager` should be available when importing it through `@hawtio/core/init` entry point.
 *
 * We should keep public methods of the implementing class available to other parts of `@hawtio/react`,
 * but other NPM packages which use `@hawtio/react` should rather import `init` entry point and get access to
 * a subset of available methods.
 */
interface IConfigManager {
    /**
     * Add information about product that builds on `@hawtio/react`. It may be full application or part of the
     * application
     *
     * @param name Name of the component
     * @param value Value to show for the component name - usually a version
     */
    addProductInfo(name: string, value: string): Promise<void>;
    /**
     * Track initialization task at selected {@link TaskState}. For proper usage, all tasks should first be
     * registered with `started` and finally with one of:
     *  * `finished`
     *  * `skipped`
     *  * `error`
     *
     * @param item Initialization task name
     * @param state Initialization task state
     * @param group One of supported initialization task groups
     */
    initItem(item: string, state: TaskState, group: 'config' | 'plugins' | 'finish'): void;
    /**
     * Returns global log level value set for the "root logger". Defaults to INFO value.
     */
    globalLogLevel(): number;
}
/**
 * This class provides API for configuration of `@hawtio/react` package
 */
declare class ConfigManager implements IConfigManager {
    /** Configuration object read from `hawtconfig.json` and/or built programmatically */
    private config?;
    /** List of initialization tasks to be presented in `<HawtioInitialization>` component */
    private initTasks;
    /** Listeners notified about initialization task state changes */
    private initListeners;
    /** Configuration of available authentication methods, used by login-related components */
    private authenticationConfig;
    /** Resolution method for `authenticationConfigPromise` */
    private authenticationConfigReady;
    private authenticationConfigEndpointSupported;
    /** Promise resolved when authentication config is already read from external source */
    private authenticationConfigPromise;
    addProductInfo(name: string, value: string): Promise<void>;
    initItem(item: string, ready: TaskState, group: 'config' | 'plugins' | 'finish'): void;
    globalLogLevel(): number;
    /**
     * This method is called by `hawtio.bootstrap()`, so we have a single point where global (not plugin-specific)
     * configuration is loaded
     */
    initialize(): Promise<boolean>;
    /**
     * Called by plugins to augment generic authentication method config.
     * Plugins may provide additional details, like location of OIDC provider.
     * @param config
     */
    configureAuthenticationMethod(config: AuthenticationMethod): Promise<void>;
    /**
     * Get configured authentication methods - possibly augmented by plugins. This method should
     * be called from hooks and React components, so can be done only after hawtio.bootstrap() promise is
     * resolved. This ensures that plugins already finished their configuration.
     */
    getAuthenticationConfig(): AuthenticationMethod[];
    /**
     * Returns selected authentication method by name
     * @param method
     * @param idx
     */
    getAuthenticationMethod(method: string, idx: number): AuthenticationMethod | undefined;
    /**
     * Set new `Hawtconfig` object as the configuration
     * @param config
     */
    setHawtconfig(config: Hawtconfig): void;
    /**
     * Returns currently configured `Hawtconfig` object
     */
    getHawtconfig(): Promise<Hawtconfig>;
    /**
     * Resets current `Hawtconfig` object to undefined state
     */
    reset(): void;
    /**
     * Loads configuration from `hawtconfig.json`.
     * @private
     */
    private loadConfig;
    /**
     * Plugins may use this method to change parts, or entire `hawtconfig.json` configuration.
     * @param configurer
     */
    configure(configurer: (config: Hawtconfig) => void): Promise<void>;
    /**
     * Apply loaded configuration to application (titles, links, icons). Should be called during Hawtio bootstrap.
     */
    applyBranding(): Promise<boolean>;
    /**
     * Alters `href` attribute of selected DOM element (for icons, styles)
     * @param id
     * @param path
     * @param moveToLast
     * @private
     */
    private updateHref;
    isRouteEnabled(path: string): Promise<boolean>;
    /**
     * Filter loaded plugins, so only plugins which are not explicitly disabled in `hawtconfig.json` are used.
     * @param plugins
     */
    filterEnabledPlugins(plugins: Plugin[]): Promise<Plugin[]>;
    /**
     * Returns current state of initialization tasks
     */
    getInitializationTasks(): InitializationTasks;
    /**
     * Register a listener to be notified about state changes of initialization tasks
     * @param listener
     */
    addInitListener(listener: (tasks: InitializationTasks) => void): void;
    /**
     * Unregister previously registered listener for state changes of initialization tasks
     * @param listener
     */
    removeInitListener(listener: (tasks: InitializationTasks) => void): void;
    /**
     * Are all the initialization items completed? The returned promise will be asynchronously resolved when
     * initialization is finished.
     *
     * When the configuration is _ready_, Hawtio may proceed to rendering UI.
     */
    ready(): Promise<boolean>;
}
declare const configManager: ConfigManager;

declare const STORAGE_KEY_LOG_LEVEL = "core.logging.logLevel";
declare const STORAGE_KEY_CHILD_LOGGERS = "core.logging.childLoggers";
interface HawtioLogger extends GlobalLogger {
    getChildLoggers(): ChildLogger[];
    getAvailableChildLoggers(): ChildLogger[];
    addChildLogger(logger: ChildLogger): void;
    updateChildLogger(name: string, level: ILogLevel | string): void;
    removeChildLogger(logger: ChildLogger): void;
}
interface ChildLogger {
    name: string;
    filterLevel: ILogLevel;
}
declare class LocalStorageHawtioLogger implements HawtioLogger {
    TRACE: ILogLevel;
    DEBUG: ILogLevel;
    INFO: ILogLevel;
    TIME: ILogLevel;
    WARN: ILogLevel;
    ERROR: ILogLevel;
    OFF: ILogLevel;
    trace: (...x: any[]) => void;
    debug: (...x: any[]) => void;
    info: (...x: any[]) => void;
    log: (...x: any[]) => void;
    warn: (...x: any[]) => void;
    error: (...x: any[]) => void;
    time: (label: string) => void;
    timeEnd: (label: string) => void;
    getLevel: () => ILogLevel;
    enabledFor: (level: ILogLevel) => boolean;
    useDefaults: (options?: js_logger.ILoggerOpts) => void;
    setHandler: (logHandler: js_logger.ILogHandler) => void;
    createDefaultHandler: typeof js_logger__default.createDefaultHandler;
    private readonly LOG_LEVEL_MAP;
    get(name: string): ILogger;
    setLevel(level: ILogLevel | string): void;
    private loggers;
    constructor();
    private toLogLevel;
    private loadLogLevel;
    private saveLogLevel;
    private loadChildLoggers;
    private saveChildLoggers;
    getChildLoggers(): ChildLogger[];
    getAvailableChildLoggers(): ChildLogger[];
    addChildLogger(logger: ChildLogger): void;
    updateChildLogger(name: string, level: ILogLevel | string): void;
    removeChildLogger(logger: ChildLogger): void;
}
/**
 * Hawtio logger
 */
declare const Logger: LocalStorageHawtioLogger;

export { type AboutConfig as A, type BasicAuthenticationMethod as B, type ChildLogger as C, DEFAULT_APP_NAME as D, type FormAuthenticationMethod as F, type Hawtconfig as H, type IConfigManager as I, type JmxConfig as J, Logger as L, type OidcAuthenticationMethod as O, STORAGE_KEY_CHILD_LOGGERS as S, TaskState as T, type AboutProductInfo as a, type AppearanceConfig as b, type AuthenticationKind as c, type AuthenticationMethod as d, AuthenticationResult as e, type BrandingConfig as f, ConfigManager as g, DEFAULT_LOGIN_TITLE as h, type DisabledRoutes as i, HAWTCONFIG_JSON as j, type HawtioLogger as k, type InitializationTasks as l, type LoginConfig as m, type LoginLink as n, type OnlineConfig as o, STORAGE_KEY_LOG_LEVEL as p, configManager as q };
