import { Directionality } from '@angular/cdk/bidi';
import { SelectionModel } from '@angular/cdk/collections';
import { CdkConnectedOverlay, CdkOverlayOrigin, ConnectedPosition } from '@angular/cdk/overlay';
import { AfterContentInit, AfterViewInit, ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, InjectionToken, NgZone, OnDestroy, OnInit, Provider, QueryList, Renderer2, TemplateRef } from '@angular/core';
import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';
import { CanUpdateErrorState, ErrorStateMatcher, KbqAbstractSelect, KbqComponentColors, KbqLocaleService, KbqSelectMatcher, KbqSelectSearch, KbqSelectTrigger } from '@koobiq/components/core';
import { KbqCleaner, KbqFormField, KbqFormFieldControl } from '@koobiq/components/form-field';
import { KbqTag } from '@koobiq/components/tags';
import { KbqTreeOption, KbqTreeSelection } from '@koobiq/components/tree';
import { Observable, Subject } from 'rxjs';
import * as i0 from "@angular/core";
/** Tree select trigger value type. */
export type KbqTreeSelectTriggerValue = {
    disabled: boolean;
    value: string;
    viewValue: string;
};
/** Tree select panel width type. */
export type KbqTreeSelectPanelWidth = 'auto' | number | null;
/** Options for the `kbq-tree-select` that can be configured using the `KBQ_TREE_SELECT_OPTIONS` injection token. */
export type KbqTreeSelectOptions = Partial<{
    /**
     * Width of the panel. If set to `auto`, the panel will match the trigger width.
     * If set to null or an empty string, the panel will grow to match the longest option's text.
     */
    panelWidth: KbqTreeSelectPanelWidth;
    /**
     * Minimum width of the panel. If minWidth is larger than window width or property set to null, it will be ignored.
     */
    panelMinWidth: Exclude<KbqTreeSelectPanelWidth, 'auto'>;
    /**
     * Whether to enable hiding search by default if options is less than minimum.
     *
     * - `'auto'` uses `KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD` as min value.
     * - number - will enables search hiding and uses value as min.
     * @see KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD
     */
    searchMinOptionsThreshold: 'auto' | number;
}>;
/** Injection token that can be used to provide the default options for the `kbq-tree-select`. */
export declare const KBQ_TREE_SELECT_OPTIONS: InjectionToken<Partial<{
    /**
     * Width of the panel. If set to `auto`, the panel will match the trigger width.
     * If set to null or an empty string, the panel will grow to match the longest option's text.
     */
    panelWidth: KbqTreeSelectPanelWidth;
    /**
     * Minimum width of the panel. If minWidth is larger than window width or property set to null, it will be ignored.
     */
    panelMinWidth: Exclude<KbqTreeSelectPanelWidth, "auto">;
    /**
     * Whether to enable hiding search by default if options is less than minimum.
     *
     * - `'auto'` uses `KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD` as min value.
     * - number - will enables search hiding and uses value as min.
     * @see KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD
     */
    searchMinOptionsThreshold: "auto" | number;
}>>;
/** Utility provider for `KBQ_TREE_SELECT_OPTIONS`. */
export declare const kbqTreeSelectOptionsProvider: (options: KbqTreeSelectOptions) => Provider;
/** Change event object that is emitted when the select value has changed. */
export declare class KbqTreeSelectChange {
    source: KbqTreeSelect;
    value: any;
    isUserInput: boolean;
    constructor(source: KbqTreeSelect, value: any, isUserInput?: boolean);
}
export declare class KbqTreeSelect extends KbqAbstractSelect implements AfterContentInit, AfterViewInit, OnDestroy, OnInit, DoCheck, ControlValueAccessor, KbqFormFieldControl<KbqTreeOption>, CanUpdateErrorState {
    elementRef: ElementRef<HTMLElement>;
    readonly changeDetectorRef: ChangeDetectorRef;
    private readonly ngZone;
    private readonly renderer;
    defaultErrorStateMatcher: ErrorStateMatcher;
    private readonly scrollStrategyFactory;
    private readonly dir;
    parentForm: NgForm;
    parentFormGroup: FormGroupDirective;
    private readonly parentFormField;
    ngControl: NgControl;
    private localeService?;
    protected readonly isBrowser: boolean;
    private readonly defaultOptions;
    /** Whether the component is in an error state. */
    errorState: boolean;
    /**
     * Emits whenever the component state changes and should cause the parent
     * form-field to update. Implemented as part of `KbqFormFieldControl`.
     * @docs-private
     */
    readonly stateChanges: Subject<void>;
    /** A name for this control that can be used by `kbq-form-field`. */
    controlType: string;
    hiddenItems: number;
    /** The last measured value for the trigger's client bounding rect. */
    triggerRect: DOMRect;
    /** The cached font-size of the trigger element. */
    triggerFontSize: number;
    /** Deals with the selection logic. */
    selectionModel: SelectionModel<any>;
    /** The value of the select panel's transform-origin property. */
    transformOrigin: string;
    /** Emits when the panel element is finished transforming in. */
    panelDoneAnimatingStream: Subject<string>;
    /** Strategy that will be used to handle scrolling while the select panel is open. */
    scrollStrategy: any;
    /**
     * The y-offset of the overlay panel in relation to the trigger's top start corner.
     * This must be adjusted to align the selected option text over the trigger text.
     * when the panel opens. Will change based on the y-position of the selected option.
     */
    offsetY: number;
    /**
     * This position config ensures that the top "start" corner of the overlay
     * is aligned with with the top "start" of the origin by default (overlapping
     * the trigger completely). If the panel cannot fit below the trigger, it
     * will fall back to a position above the trigger.
     */
    positions: ConnectedPosition[];
    options: QueryList<KbqTreeOption>;
    /**
     * Trigger - is a clickable field to open select dropdown panel
     */
    trigger: ElementRef;
    panel: ElementRef;
    overlayDir: CdkConnectedOverlay;
    tags: QueryList<KbqTag>;
    cleaner: KbqCleaner;
    /** User-supplied override of the trigger element. */
    customTrigger: KbqSelectTrigger;
    customMatcher: KbqSelectMatcher;
    customTagTemplateRef: TemplateRef<any>;
    tree: KbqTreeSelection;
    search: KbqSelectSearch;
    hiddenItemsText: string;
    /** Event emitted when the select panel has been toggled. */
    readonly openedChange: EventEmitter<boolean>;
    /** Event emitted when the select has been opened. */
    readonly openedStream: Observable<void>;
    /** Event emitted when the select has been closed. */
    readonly closedStream: Observable<void>;
    /** Event emitted when the selected value has been changed by the user. */
    readonly selectionChange: EventEmitter<KbqTreeSelectChange>;
    /**
     * Event that emits whenever the raw value of the select changes. This is here primarily
     * to facilitate the two-way binding for the `value` input.
     * @docs-private
     */
    readonly valueChange: EventEmitter<any>;
    /** Classes to be passed to the select panel. Supports the same syntax as `ngClass`. */
    panelClass: string | string[] | Set<string> | {
        [key: string]: any;
    };
    backdropClass: string;
    /** Object used to control when error messages are shown. */
    errorStateMatcher: ErrorStateMatcher;
    /**
     * Function used to sort the values in a select in multiple mode.
     * Follows the same logic as `Array.prototype.sort`.
     */
    sortComparator: (a: KbqTreeOption, b: KbqTreeOption, options: KbqTreeOption[]) => number;
    /**
     * Whether to use a multiline matcher or not. Default is false
     */
    multiline: boolean;
    /** Combined stream of all of the child options' change events. */
    readonly optionSelectionChanges: Observable<KbqTreeSelectChange>;
    /** Combined stream of all of the child options userInteraction events. */
    readonly userInteractionChanges: Observable<void>;
    get placeholder(): string;
    set placeholder(value: string);
    private _placeholder;
    get required(): boolean;
    set required(value: boolean);
    private _required;
    get multiple(): boolean;
    set multiple(value: boolean);
    private _multiple;
    get autoSelect(): boolean;
    set autoSelect(value: boolean);
    private _autoSelect;
    get value(): any;
    get id(): string;
    set id(value: string);
    private _id;
    get hasBackdrop(): boolean;
    set hasBackdrop(value: boolean);
    private _hasBackdrop;
    get tabIndex(): number | null;
    set tabIndex(value: number | null);
    private _tabIndex;
    get disabled(): boolean;
    set disabled(value: boolean);
    private _disabled;
    /**
     * Function for handling the combination Ctrl + A (select all). By default, the internal handler is used.
     */
    get selectAllHandler(): (event: KeyboardEvent, select: KbqTreeSelect) => void;
    set selectAllHandler(fn: (event: KeyboardEvent, select: KbqTreeSelect) => void);
    /** Function for handling the combination Ctrl + A (select all). By default, the internal handler is used. */
    private _selectAllHandler;
    /** Whether the select is focused. */
    get focused(): boolean;
    set focused(value: boolean);
    /** Whether multiple choice is enabled or not. True if multiple or multiline */
    get multiSelection(): boolean;
    private _focused;
    /** Width of the overlay panel. */
    protected overlayWidth: string | number;
    /** Min width of the overlay panel. */
    protected overlayMinWidth: string | number;
    /**
     * Minimum width of the panel.
     * If minWidth is larger than window width, it will be ignored.
     */
    panelMinWidth: Exclude<KbqTreeSelectPanelWidth, 'auto'>;
    /** Origin for the overlay panel. */
    protected overlayOrigin?: CdkOverlayOrigin | ElementRef;
    /**
     * Width of the panel. If set to `auto`, the panel will match the trigger width.
     * If set to null or an empty string, the panel will grow to match the longest option's text.
     */
    panelWidth: KbqTreeSelectPanelWidth;
    /**
     * Controls when the search functionality is displayed based on the number of available options.
     *
     * Automatically enables search hiding if value provided, even if `defaultOptions.searchMinOptionsThreshold` is provided.
     * @default undefined
     */
    set searchMinOptionsThreshold(value: 'auto' | number | undefined);
    get searchMinOptionsThreshold(): number | undefined;
    private _searchMinOptionsThreshold;
    get panelOpen(): boolean;
    get canShowCleaner(): boolean;
    /** @docs-private */
    get colorForState(): KbqComponentColors;
    isEmptySearchResult: boolean;
    triggerValues: KbqTreeSelectTriggerValue[];
    private closeSubscription;
    private _panelOpen;
    private originalOnKeyDown;
    /** The scroll position of the overlay panel, calculated to center the selected option. */
    private scrollTop;
    /** Unique id for this input. */
    private readonly uid;
    private tempValues;
    private readonly destroyRef;
    private readonly window;
    constructor(elementRef: ElementRef<HTMLElement>, changeDetectorRef: ChangeDetectorRef, ngZone: NgZone, renderer: Renderer2, defaultErrorStateMatcher: ErrorStateMatcher, scrollStrategyFactory: any, dir: Directionality, parentForm: NgForm, parentFormGroup: FormGroupDirective, parentFormField: KbqFormField, ngControl: NgControl, localeService?: KbqLocaleService | undefined);
    ngOnInit(): void;
    ngDoCheck(): void;
    ngAfterContentInit(): void;
    ngAfterViewInit(): void;
    ngOnDestroy(): void;
    updateErrorState(): void;
    hiddenItemsTextFormatter(hiddenItemsText: string, hiddenItems: number): string;
    clearValue($event: any): void;
    /** `View -> model callback called when value changes` */
    onChange: (value: any) => void;
    /** `View -> model callback called when select has been touched` */
    onTouched: () => void;
    handleClick(): void;
    toggle(): void;
    open(): void;
    /** Closes the overlay panel and focuses the host element. */
    close(): void;
    /**
     * Sets the select's value. Part of the ControlValueAccessor interface
     * required to integrate with Angular's core forms API.
     *
     * @param value New value to be written to the model.
     */
    writeValue(value: any): void;
    /**
     * Saves a callback function to be invoked when the select's value
     * changes from user input. Part of the ControlValueAccessor interface
     * required to integrate with Angular's core forms API.
     *
     * @param fn Callback to be triggered when the value changes.
     */
    registerOnChange(fn: (value: any) => void): void;
    /**
     * Saves a callback function to be invoked when the select is blurred
     * by the user. Part of the ControlValueAccessor interface required
     * to integrate with Angular's core forms API.
     *
     * @param fn Callback to be triggered when the component has been touched.
     */
    registerOnTouched(fn: () => {}): void;
    /**
     * Disables the select. Part of the ControlValueAccessor interface required
     * to integrate with Angular's core forms API.
     *
     * @param isDisabled Sets whether the component is disabled.
     */
    setDisabledState(isDisabled: boolean): void;
    get selected(): any;
    get selectedValues(): any;
    get triggerValue(): string;
    get empty(): boolean;
    isRtl(): boolean;
    get firstSelected(): any;
    handleKeydown(event: KeyboardEvent): void;
    onFocus(): void;
    /**
     * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
     * "blur" to the panel when it opens, causing a false positive.
     */
    onBlur(): void;
    /** Callback that is invoked when the overlay panel has been attached. */
    onAttached(): void;
    /** Returns the theme to be used on the panel. */
    getPanelTheme(): string;
    focus(): void;
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    onContainerClick(): void;
    /** Invoked when an option is clicked. */
    onRemoveSelectedOption(selectedOption: any, $event: any): void;
    calculateHiddenItems(): void;
    triggerKeydownHandler(event: KeyboardEvent): void;
    panelKeydownHandler(event: KeyboardEvent): any;
    /** @docs-private */
    protected shouldShowSearch(): boolean;
    private updateLocaleParams;
    private closingActions;
    private getTotalItemsWidthInMatcher;
    private getTotalVisibleItems;
    /** Gets how wide the overlay panel should be. */
    private getOverlayWidth;
    private buildTriggerClone;
    private getItemWidth;
    private refreshTriggerValues;
    /**
     * Sets the selected option based on a value. If no option can be
     * found with the designated value, the select trigger is cleared.
     */
    private setSelectionByValue;
    private initKeyManager;
    /** Sorts the selected values in the selected based on their order in the panel. */
    private sortValues;
    /**
     * Highlights the selected item. If no option is selected, it will highlight
     * the first item instead.
     */
    private highlightCorrectOption;
    /** Scrolls the active option into view. */
    private scrollActiveOptionIntoView;
    private subscribeOnSearchChanges;
    static ɵfac: i0.ɵɵFactoryDeclaration<KbqTreeSelect, [null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; host: true; }, { optional: true; self: true; }, { optional: true; }]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<KbqTreeSelect, "kbq-tree-select", ["kbqTreeSelect"], { "hiddenItemsText": { "alias": "hiddenItemsText"; "required": false; }; "panelClass": { "alias": "panelClass"; "required": false; }; "backdropClass": { "alias": "backdropClass"; "required": false; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "sortComparator": { "alias": "sortComparator"; "required": false; }; "multiline": { "alias": "multiline"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "required": { "alias": "required"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "autoSelect": { "alias": "autoSelect"; "required": false; }; "id": { "alias": "id"; "required": false; }; "hasBackdrop": { "alias": "hasBackdrop"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "selectAllHandler": { "alias": "selectAllHandler"; "required": false; }; "panelMinWidth": { "alias": "panelMinWidth"; "required": false; }; "panelWidth": { "alias": "panelWidth"; "required": false; }; "searchMinOptionsThreshold": { "alias": "searchMinOptionsThreshold"; "required": false; }; "hiddenItemsTextFormatter": { "alias": "hiddenItemsTextFormatter"; "required": false; }; }, { "openedChange": "openedChange"; "openedStream": "opened"; "closedStream": "closed"; "selectionChange": "selectionChange"; "valueChange": "valueChange"; }, ["cleaner", "customTrigger", "customMatcher", "customTagTemplateRef", "tree", "search"], ["kbq-select-matcher, [kbq-select-matcher]", "kbq-select-trigger, [kbq-select-trigger]", "kbq-cleaner", "[kbqSelectSearch]", "[kbq-select-search-empty-result]", "kbq-tree-selection", "kbq-select-footer,[kbq-tree-select-footer]"], false, never>;
    static ngAcceptInputType_multiline: unknown;
    static ngAcceptInputType_multiple: unknown;
    static ngAcceptInputType_disabled: unknown;
    static ngAcceptInputType_panelMinWidth: unknown;
}
