import * as i2 from '@angular/cdk/bidi';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { SelectionModel } from '@angular/cdk/collections';
import * as i5 from '@angular/cdk/overlay';
import { CdkOverlayOrigin, CdkConnectedOverlay, OverlayModule } from '@angular/cdk/overlay';
import { Platform, _getEventTarget } from '@angular/cdk/platform';
import * as i0 from '@angular/core';
import { InjectionToken, inject, EventEmitter, DestroyRef, booleanAttribute, numberAttribute, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Inject, Optional, Host, Self, ViewChild, ViewChildren, ContentChild, Input, Output, NgModule } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import * as i3 from '@angular/forms';
import { DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, ENTER, SPACE, ESCAPE, TAB, HOME, END, PAGE_UP, PAGE_DOWN, isSelectAll, hasModifierKey } from '@koobiq/cdk/keycodes';
import * as i1 from '@koobiq/components/core';
import { KbqAbstractSelect, getKbqSelectDynamicMultipleError, KbqComponentColors, defaultOffsetY, KBQ_WINDOW, MultipleMode, isUndefined, getKbqSelectNonArrayValueError, KBQ_SELECT_SCROLL_STRATEGY, KBQ_LOCALE_SERVICE, KBQ_PARENT_POPUP, KbqSelectTrigger, KbqSelectMatcher, KbqSelectSearch, kbqSelectAnimations, KbqPseudoCheckboxModule, KbqSelectFooter, KbqSelectSearchEmptyResult, KBQ_SELECT_SCROLL_STRATEGY_PROVIDER } from '@koobiq/components/core';
import * as i4 from '@koobiq/components/form-field';
import { KbqFormFieldControl, KbqFormFieldModule } from '@koobiq/components/form-field';
import * as i7 from '@koobiq/components/tags';
import { KbqTag, KbqTagsModule } from '@koobiq/components/tags';
import { KbqTree, KbqTreeSelection, KbqTreeModule } from '@koobiq/components/tree';
import { SizeXxs } from '@koobiq/design-tokens';
import { Subject, defer, merge, Subscription, audit } from 'rxjs';
import { filter, map, startWith, switchMap, take, distinctUntilChanged, delay } from 'rxjs/operators';
import * as i6 from '@koobiq/components/icon';
import { KbqIconModule } from '@koobiq/components/icon';
import * as i8 from '@angular/common';
import { NgClass, NgTemplateOutlet } from '@angular/common';
import * as i9 from '@angular/cdk/a11y';
import { A11yModule } from '@angular/cdk/a11y';

let nextUniqueId = 0;
/** Injection token that can be used to provide the default options for the `kbq-tree-select`. */
const KBQ_TREE_SELECT_OPTIONS = new InjectionToken('KBQ_TREE_SELECT_OPTIONS');
/** Utility provider for `KBQ_TREE_SELECT_OPTIONS`. */
const kbqTreeSelectOptionsProvider = (options) => {
    return {
        provide: KBQ_TREE_SELECT_OPTIONS,
        useValue: options
    };
};
/** Change event object that is emitted when the select value has changed. */
class KbqTreeSelectChange {
    constructor(source, value, isUserInput = false) {
        this.source = source;
        this.value = value;
        this.isUserInput = isUserInput;
    }
}
class KbqTreeSelect extends KbqAbstractSelect {
    get placeholder() {
        return this._placeholder;
    }
    set placeholder(value) {
        this._placeholder = value;
        this.stateChanges.next();
    }
    get required() {
        return this._required;
    }
    set required(value) {
        this._required = coerceBooleanProperty(value);
        this.stateChanges.next();
    }
    get multiple() {
        return this._multiple;
    }
    set multiple(value) {
        if (this.selectionModel) {
            throw getKbqSelectDynamicMultipleError();
        }
        this._multiple = coerceBooleanProperty(value);
    }
    get autoSelect() {
        if (this.multiSelection) {
            return false;
        }
        return this._autoSelect;
    }
    set autoSelect(value) {
        this._autoSelect = coerceBooleanProperty(value);
    }
    get value() {
        return this.tree.getSelectedValues();
    }
    get id() {
        return this._id;
    }
    set id(value) {
        this._id = value || this.uid;
        this.stateChanges.next();
    }
    get hasBackdrop() {
        return this._hasBackdrop;
    }
    set hasBackdrop(value) {
        this._hasBackdrop = coerceBooleanProperty(value);
    }
    get tabIndex() {
        return this.disabled ? -1 : this._tabIndex;
    }
    set tabIndex(value) {
        if (Number.isInteger(value) || value === null) {
            this._tabIndex = value;
        }
    }
    get disabled() {
        return this._disabled;
    }
    set disabled(value) {
        if (value !== this.disabled) {
            this._disabled = value;
            if (this.parentFormField) {
                Promise.resolve().then(() => {
                    this._disabled ? this.parentFormField.stopFocusMonitor() : this.parentFormField.runFocusMonitor();
                });
            }
            // Let the parent form field know to run change detection when the disabled state changes.
            this.stateChanges.next();
        }
    }
    /**
     * Function for handling the combination Ctrl + A (select all). By default, the internal handler is used.
     */
    get selectAllHandler() {
        return this._selectAllHandler;
    }
    set selectAllHandler(fn) {
        if (typeof fn !== 'function') {
            throw Error('`selectAllHandler` must be a function.');
        }
        this._selectAllHandler = fn;
    }
    /** Function for handling the combination Ctrl + A (select all). By default, the internal handler is used. */
    _selectAllHandler(event, select) {
        event.preventDefault();
        const options = select.options.filter(({ disabled }) => !disabled);
        const hasUnselectedOptions = options.some((option) => !option.selected);
        const toUnselect = [];
        const toSelect = [];
        options.forEach((option) => {
            if (hasUnselectedOptions) {
                option.select(false);
                toSelect.push(option.data);
            }
            else {
                option.deselect();
                toUnselect.push(option.data);
            }
        });
        this.selectionModel.deselect(...toUnselect);
        this.selectionModel.select(...toSelect);
    }
    /** Whether the select is focused. */
    get focused() {
        return this._focused || this._panelOpen;
    }
    set focused(value) {
        this._focused = value;
    }
    /** Whether multiple choice is enabled or not. True if multiple or multiline */
    get multiSelection() {
        return this.multiple || this.multiline;
    }
    /**
     * 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) {
        this._searchMinOptionsThreshold =
            this.resolveSearchMinOptionsThreshold(value) ??
                this.resolveSearchMinOptionsThreshold(this.defaultOptions?.searchMinOptionsThreshold);
    }
    get searchMinOptionsThreshold() {
        return this._searchMinOptionsThreshold;
    }
    get panelOpen() {
        return this._panelOpen;
    }
    get canShowCleaner() {
        return !this.disabled && this.cleaner && this.selectionModel.hasValue();
    }
    /** @docs-private */
    get colorForState() {
        const hasLegacyValidateDirective = this.elementRef.nativeElement.classList.contains('kbq-control_has-validate-directive');
        return (hasLegacyValidateDirective && this.ngControl?.invalid) || this.errorState
            ? KbqComponentColors.Error
            : KbqComponentColors.ContrastFade;
    }
    constructor(elementRef, changeDetectorRef, ngZone, renderer, defaultErrorStateMatcher, scrollStrategyFactory, dir, parentForm, parentFormGroup, parentFormField, ngControl, localeService) {
        super();
        this.elementRef = elementRef;
        this.changeDetectorRef = changeDetectorRef;
        this.ngZone = ngZone;
        this.renderer = renderer;
        this.defaultErrorStateMatcher = defaultErrorStateMatcher;
        this.scrollStrategyFactory = scrollStrategyFactory;
        this.dir = dir;
        this.parentForm = parentForm;
        this.parentFormGroup = parentFormGroup;
        this.parentFormField = parentFormField;
        this.ngControl = ngControl;
        this.localeService = localeService;
        this.isBrowser = inject(Platform).isBrowser;
        this.defaultOptions = inject(KBQ_TREE_SELECT_OPTIONS, { optional: true });
        /** Whether the component is in an error state. */
        this.errorState = false;
        /**
         * Emits whenever the component state changes and should cause the parent
         * form-field to update. Implemented as part of `KbqFormFieldControl`.
         * @docs-private
         */
        this.stateChanges = new Subject();
        /** A name for this control that can be used by `kbq-form-field`. */
        this.controlType = 'select';
        this.hiddenItems = 0;
        /** The cached font-size of the trigger element. */
        this.triggerFontSize = 0;
        /** The value of the select panel's transform-origin property. */
        this.transformOrigin = 'top';
        /** Emits when the panel element is finished transforming in. */
        this.panelDoneAnimatingStream = new Subject();
        /** Strategy that will be used to handle scrolling while the select panel is open. */
        this.scrollStrategy = this.scrollStrategyFactory();
        /**
         * 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.
         */
        this.offsetY = defaultOffsetY;
        /**
         * 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.
         */
        this.positions = [
            {
                originX: 'start',
                originY: 'bottom',
                overlayX: 'start',
                overlayY: 'top',
                offsetY: this.offsetY
            },
            {
                originX: 'start',
                originY: 'top',
                overlayX: 'start',
                overlayY: 'bottom',
                offsetY: -this.offsetY
            }
        ];
        this.hiddenItemsText = 'еще {{ number }}';
        /** Event emitted when the select panel has been toggled. */
        this.openedChange = new EventEmitter();
        /** Event emitted when the select has been opened. */
        this.openedStream = this.openedChange.pipe(filter((o) => o), map(() => { }));
        /** Event emitted when the select has been closed. */
        this.closedStream = this.openedChange.pipe(filter((o) => !o), map(() => { }));
        /** Event emitted when the selected value has been changed by the user. */
        this.selectionChange = new EventEmitter();
        /**
         * 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
         */
        this.valueChange = new EventEmitter();
        this.backdropClass = 'cdk-overlay-transparent-backdrop';
        /**
         * Whether to use a multiline matcher or not. Default is false
         */
        this.multiline = false;
        /** Combined stream of all of the child options' change events. */
        this.optionSelectionChanges = defer(() => {
            if (this.options) {
                return this.options.changes.pipe(startWith(this.options), switchMap(() => merge(...this.options.map((option) => option.onSelectionChange))));
            }
            return this.ngZone.onStable.asObservable().pipe(take(1), switchMap(() => this.optionSelectionChanges));
        });
        /** Combined stream of all of the child options userInteraction events. */
        this.userInteractionChanges = defer(() => {
            if (this.options) {
                return this.options.changes.pipe(startWith(this.options), switchMap(() => merge(...this.options.map((option) => option.userInteraction))));
            }
            return this.ngZone.onStable.asObservable().pipe(take(1), switchMap(() => this.userInteractionChanges));
        });
        this._required = false;
        this._multiple = false;
        this._autoSelect = true;
        this._hasBackdrop = false;
        this._tabIndex = 0;
        this._disabled = false;
        this._focused = false;
        /**
         * Minimum width of the panel.
         * If minWidth is larger than window width, it will be ignored.
         */
        this.panelMinWidth = this.defaultOptions?.panelMinWidth ?? 200;
        /**
         * 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.
         */
        this.panelWidth = this.defaultOptions?.panelWidth || null;
        this._searchMinOptionsThreshold = this.resolveSearchMinOptionsThreshold();
        this.triggerValues = [];
        this.closeSubscription = Subscription.EMPTY;
        this._panelOpen = false;
        /** The scroll position of the overlay panel, calculated to center the selected option. */
        this.scrollTop = 0;
        /** Unique id for this input. */
        this.uid = `kbq-tree-select-${nextUniqueId++}`;
        this.destroyRef = inject(DestroyRef);
        this.window = inject(KBQ_WINDOW);
        /** `View -> model callback called when value changes` */
        this.onChange = () => { };
        /** `View -> model callback called when select has been touched` */
        this.onTouched = () => { };
        this.updateLocaleParams = () => {
            this.hiddenItemsText = this.localeService?.getParams('select').hiddenItemsText;
            this.changeDetectorRef.markForCheck();
        };
        this.localeService?.changes.pipe(takeUntilDestroyed()).subscribe(this.updateLocaleParams);
        if (this.ngControl) {
            // Note: we provide the value accessor through here, instead of
            // the `providers` to avoid running into a circular import.
            this.ngControl.valueAccessor = this;
        }
        // Force setter to be called in case id was not specified.
        this.id = this.id;
    }
    ngOnInit() {
        this.stateChanges.next();
        // We need `distinctUntilChanged` here, because some browsers will
        // fire the animation end event twice for the same animation. See:
        // https://github.com/angular/angular/issues/24084
        this.panelDoneAnimatingStream
            .pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
            .subscribe(() => {
            if (this.panelOpen) {
                this.scrollTop = 0;
                if (this.search) {
                    this.search.focus();
                }
                this.openedChange.emit(true);
            }
            else {
                this.openedChange.emit(false);
                this.overlayDir.offsetX = 0;
                this.changeDetectorRef.markForCheck();
            }
        });
    }
    ngDoCheck() {
        if (this.ngControl) {
            this.updateErrorState();
        }
    }
    ngAfterContentInit() {
        if (!this.tree)
            return;
        this.tree.resetFocusedItemOnBlur = false;
        this.tree.optionShouldHoldFocusOnBlur = !!this.search;
        this.selectionModel = this.tree.selectionModel = new SelectionModel(this.multiSelection);
        this.selectionModel.changed.subscribe(() => {
            this.onChange(this.selectedValues);
            if (this.multiSelection) {
                this.refreshTriggerValues();
            }
        });
        this.selectionModel.changed.pipe(delay(0)).subscribe(() => this.setOverlayPosition());
        // eslint-disable-next-line @angular-eslint/no-lifecycle-call
        this.tree.ngAfterContentInit();
        this.initKeyManager();
        this.options = this.tree.renderedOptions;
        this.tree.autoSelect = this.autoSelect;
        if (this.tree.multipleMode === null) {
            // setTimeout need for prevent an error "NG0100: ExpressionChangedAfterItHasBeenCheckedError"
            setTimeout(() => (this.tree.multipleMode = this.multiSelection ? MultipleMode.CHECKBOX : null));
        }
        if (this.multiSelection) {
            this.tree.noUnselectLast = false;
        }
        if (this.tempValues) {
            this.setSelectionByValue(this.tempValues);
            this.tempValues = null;
        }
        this.userInteractionChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
            if (!this.multiSelection && this.panelOpen) {
                this.close();
                Promise.resolve().then(() => this.focus());
            }
        });
        this.tree.selectionChange.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
            this.onChange(this.selectedValues);
            this.selectionChange.emit(new KbqTreeSelectChange(this, event.option));
            if (this.search) {
                this.search.focus();
            }
        });
        if (!this.multiSelection) {
            this.selectionModel.changed
                .pipe(filter(({ added }) => !!added.length), takeUntilDestroyed(this.destroyRef))
                .subscribe(({ added }) => {
                this.tree.keyManager.setFocusOrigin('program');
                this.tree.keyManager.setActiveItem(this.options.find(({ data }) => data === added[0]));
            });
        }
        this.subscribeOnSearchChanges();
    }
    ngAfterViewInit() {
        if (!this.tree)
            return;
        this.tags.changes.pipe(startWith(null)).subscribe(() => {
            this.calculateHiddenItems();
        });
        this.tree.treeControl.expansionModel.changed
            .pipe(takeUntilDestroyed(this.destroyRef))
            .subscribe(() => this.setOverlayPosition());
    }
    ngOnDestroy() {
        this.stateChanges.complete();
        this.closeSubscription.unsubscribe();
    }
    updateErrorState() {
        const oldState = this.errorState;
        const parent = this.parentFormGroup || this.parentForm;
        const matcher = this.errorStateMatcher || this.defaultErrorStateMatcher;
        const control = this.ngControl ? this.ngControl.control : null;
        const newState = matcher.isErrorState(control, parent);
        if (newState !== oldState) {
            this.errorState = newState;
            this.stateChanges.next();
        }
    }
    hiddenItemsTextFormatter(hiddenItemsText, hiddenItems) {
        return hiddenItemsText.replace('{{ number }}', hiddenItems.toString());
    }
    clearValue($event) {
        // need to prevent opening
        $event.stopPropagation();
        // need to prevent scrolling
        $event.preventDefault();
        this.selectionModel.clear();
        this.tree.keyManager.setActiveItem(-1);
        this.setSelectionByValue([]);
        this.onChange(this.selectedValues);
        this.selectionChange.emit(new KbqTreeSelectChange(this, this.selectedValues));
        this.focus();
    }
    handleClick() {
        if (this.customMatcher && !this.customMatcher.useDefaultHandlers)
            return;
        this.toggle();
    }
    toggle() {
        if (this.panelOpen) {
            this.close();
        }
        else {
            this.open();
        }
    }
    open() {
        if (this.disabled || !this.options || !this.options.length || this._panelOpen)
            return;
        // add check for form-field bounding rectangles, since it adds extra padding around the trigger
        this.triggerRect = (this.parentFormField?.getConnectedOverlayOrigin().nativeElement || this.trigger.nativeElement).getBoundingClientRect();
        // Note: The computed font-size will be a string pixel value (e.g. "16px").
        // `parseInt` ignores the trailing 'px' and converts this to a number.
        this.triggerFontSize = parseInt(this.window.getComputedStyle(this.trigger.nativeElement)['font-size']);
        // It's important that we read this as late as possible, because doing so earlier will
        // return a different element since it's based on queries in the form field which may
        // not have run yet. Also this needs to be assigned before we measure the overlay width.
        if (this.parentFormField) {
            this.overlayOrigin = this.parentFormField.getConnectedOverlayOrigin();
        }
        this.overlayWidth = this.getOverlayWidth(this.overlayOrigin);
        // set overlayMinWidth to the largest of `panelMinWidth` and `triggerRect.width`
        // only if `overlayWidth` falsy and `panelMinWidth` not provided.
        // This ensures panel isn't narrow.
        this.overlayMinWidth =
            this.panelMinWidth !== null && !this.overlayWidth
                ? Math.max(this.panelMinWidth, this.triggerRect.width)
                : '';
        this._panelOpen = true;
        setTimeout(() => this.highlightCorrectOption());
        this.changeDetectorRef.markForCheck();
        // Set the font size on the panel element once it exists.
        this.ngZone.onStable
            .asObservable()
            .pipe(take(1))
            .subscribe(() => {
            if (this.triggerFontSize && this.overlayDir.overlayRef && this.overlayDir.overlayRef.overlayElement) {
                this.overlayDir.overlayRef.overlayElement.style.fontSize = `${this.triggerFontSize}px`;
            }
        });
    }
    /** Closes the overlay panel and focuses the host element. */
    close() {
        if (!this._panelOpen) {
            return;
        }
        this._panelOpen = false;
        this.changeDetectorRef.markForCheck();
        this.onTouched();
        if (this.search) {
            this.search.reset();
        }
    }
    /**
     * 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) {
        if (this.tree) {
            this.setSelectionByValue(value);
        }
        else {
            this.tempValues = value;
        }
    }
    /**
     * 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) {
        this.onChange = fn;
    }
    /**
     * 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.
     */
    // eslint-disable-next-line @typescript-eslint/ban-types
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    /**
     * 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) {
        this.disabled = isDisabled;
        this.changeDetectorRef.markForCheck();
        this.stateChanges.next();
    }
    get selected() {
        return this.multiSelection ? this.selectionModel?.selected : this.selectionModel?.selected[0];
    }
    get selectedValues() {
        const selectedValues = this.selectionModel.selected.map((value) => this.tree.treeControl.getValue(value));
        return this.multiSelection ? selectedValues : selectedValues[0];
    }
    get triggerValue() {
        if (this.empty) {
            return '';
        }
        return this.tree.treeControl.getViewValue(this.selected);
    }
    get empty() {
        return !this.selectionModel || this.selectionModel.isEmpty();
    }
    isRtl() {
        return this.dir ? this.dir.value === 'rtl' : false;
    }
    get firstSelected() {
        return this.selectionModel.selected.filter((node) => !this.tree.treeControl.isDisabled(node))[0];
    }
    handleKeydown(event) {
        if (this.customMatcher && !this.customMatcher.useDefaultHandlers)
            return;
        if (!this.disabled) {
            if (this.panelOpen) {
                this.panelKeydownHandler(event);
            }
            else {
                this.triggerKeydownHandler(event);
            }
        }
    }
    onFocus() {
        if (this.customMatcher && !this.customMatcher.useDefaultHandlers)
            return;
        if (!this.disabled) {
            this._focused = true;
            this.stateChanges.next();
        }
    }
    /**
     * 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() {
        if (this.customMatcher && !this.customMatcher.useDefaultHandlers)
            return;
        this._focused = false;
        if (!this.disabled && !this.panelOpen) {
            this.onTouched();
            this.changeDetectorRef.markForCheck();
            this.stateChanges.next();
            if (this.ngControl?.control) {
                const control = this.ngControl.control;
                control.updateValueAndValidity({ emitEvent: false });
                control.statusChanges.emit(control.status);
            }
        }
    }
    /** Callback that is invoked when the overlay panel has been attached. */
    onAttached() {
        this.overlayDir.positionChange.pipe(take(1)).subscribe(() => {
            this.changeDetectorRef.detectChanges();
            this.setOverlayPosition();
            this.panel.nativeElement.scrollTop = this.scrollTop;
            this.tree.updateScrollSize();
        });
        this.closeSubscription = this.closingActions().subscribe(() => this.close());
    }
    /** Returns the theme to be used on the panel. */
    getPanelTheme() {
        return this.parentFormField ? `kbq-${this.parentFormField.color}` : '';
    }
    focus() {
        this.elementRef.nativeElement.focus();
    }
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    onContainerClick() {
        this.focus();
    }
    /** Invoked when an option is clicked. */
    onRemoveSelectedOption(selectedOption, $event) {
        $event.stopPropagation();
        this.selectionModel.deselect(this.selected.find((value) => this.tree.treeControl.getValue(value) === selectedOption.value));
        this.selectionChange.emit(new KbqTreeSelectChange(this, this.options.find((option) => option.value === selectedOption.value) || selectedOption.value));
        this.onChange(this.selectedValues);
    }
    calculateHiddenItems() {
        if (!this.isBrowser ||
            this.customTrigger ||
            this.empty ||
            !this.multiple ||
            this.customMatcher ||
            this.multiline)
            return;
        const totalItemsWidth = this.getTotalItemsWidthInMatcher();
        const [totalVisibleItemsWidth, visibleItems] = this.getTotalVisibleItems();
        this.hiddenItems = this.selectionModel.selected.length - visibleItems;
        this.changeDetectorRef.detectChanges();
        if (this.hiddenItems) {
            const itemsCounter = this.trigger.nativeElement.querySelector('.kbq-select__match-hidden-text');
            const matcherList = this.trigger.nativeElement.querySelector('.kbq-select__match-list');
            const itemsCounterShowed = itemsCounter.offsetTop < itemsCounter.offsetHeight;
            const itemsCounterWidth = Math.floor(itemsCounter.getBoundingClientRect().width);
            const matcherListWidth = Math.floor(matcherList.getBoundingClientRect().width);
            const matcherWidth = matcherListWidth + (itemsCounterShowed ? itemsCounterWidth : 0);
            if (itemsCounterShowed && totalItemsWidth < matcherWidth) {
                this.hiddenItems = 0;
                this.changeDetectorRef.detectChanges();
            }
            if (totalVisibleItemsWidth === matcherListWidth ||
                totalVisibleItemsWidth + itemsCounterWidth < matcherListWidth) {
                this.changeDetectorRef.markForCheck();
                return;
            }
        }
        this.changeDetectorRef.markForCheck();
    }
    triggerKeydownHandler(event) {
        const keyCode = event.keyCode;
        const isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW || keyCode === LEFT_ARROW || keyCode === RIGHT_ARROW;
        const isOpenKey = keyCode === ENTER || keyCode === SPACE;
        // Open the select on ALT + arrow key to match the native <select>
        if (isOpenKey || ((this.multiSelection || event.altKey) && isArrowKey)) {
            // prevents the page from scrolling down when pressing space
            event.preventDefault();
            this.open();
        }
        else if (!this.multiSelection && this.tree.keyManager && this.tree.keyManager.onKeydown) {
            this.tree.keyManager.onKeydown(event);
        }
    }
    panelKeydownHandler(event) {
        const keyCode = event.keyCode;
        const isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW;
        if ((isArrowKey && event.altKey) || keyCode === ESCAPE || keyCode === TAB) {
            // Close the select on ALT + arrow key to match the native <select>
            event.preventDefault();
            this.close();
            this.focus();
        }
        else if (keyCode === LEFT_ARROW || keyCode === RIGHT_ARROW) {
            return this.originalOnKeyDown.call(this.tree, event);
        }
        else if (keyCode === HOME) {
            event.preventDefault();
            this.tree.keyManager.setFirstItemActive();
        }
        else if (keyCode === END) {
            event.preventDefault();
            this.tree.keyManager.setLastItemActive();
        }
        else if (keyCode === PAGE_UP) {
            event.preventDefault();
            this.tree.keyManager.setPreviousPageItemActive();
        }
        else if (keyCode === PAGE_DOWN) {
            event.preventDefault();
            this.tree.keyManager.setNextPageItemActive();
        }
        else if ((keyCode === ENTER || keyCode === SPACE) && this.tree.keyManager.activeItem) {
            event.preventDefault();
            if (!this.autoSelect) {
                this.originalOnKeyDown.call(this.tree, event);
            }
            else {
                this.close();
                this.focus();
            }
        }
        else if (this.multiSelection && isSelectAll(event)) {
            this.selectAllHandler(event, this);
        }
        else {
            const previouslyFocusedIndex = this.tree.keyManager.activeItemIndex;
            this.tree.keyManager.setFocusOrigin('keyboard');
            this.tree.keyManager.onKeydown(event);
            if (this.multiSelection &&
                isArrowKey &&
                event.shiftKey &&
                this.tree.keyManager.activeItem &&
                this.tree.keyManager.activeItemIndex !== previouslyFocusedIndex) {
                this.tree.keyManager.activeItem.selectViaInteraction(event);
            }
            if (this.autoSelect && this.tree.keyManager.activeItem) {
                this.tree.setSelectedOptionsByKey(this.tree.keyManager.activeItem, hasModifierKey(event, 'shiftKey'), 
                // ctrlKey is for Windows, metaKey is for MacOS
                hasModifierKey(event, 'ctrlKey', 'metaKey'));
            }
            if (this.search) {
                this.search.focus();
            }
        }
    }
    /** @docs-private */
    shouldShowSearch() {
        return isUndefined(this.searchMinOptionsThreshold) || this.options.length >= this.searchMinOptionsThreshold;
    }
    closingActions() {
        const backdrop = this.overlayDir.overlayRef.backdropClick();
        const outsidePointerEvents = this.overlayDir
            .overlayRef.outsidePointerEvents()
            .pipe(filter((event) => !this.elementRef.nativeElement.contains(_getEventTarget(event))));
        const detachments = this.overlayDir.overlayRef.detachments();
        return merge(backdrop, outsidePointerEvents, detachments);
    }
    getTotalItemsWidthInMatcher() {
        const triggerClone = this.buildTriggerClone();
        triggerClone.querySelector('.kbq-select__match-hidden-text')?.remove();
        this.renderer.appendChild(this.trigger.nativeElement, triggerClone);
        let totalItemsWidth = 0;
        const selectedItemsViewValueContainers = triggerClone.querySelectorAll('kbq-tag');
        selectedItemsViewValueContainers.forEach((item) => (totalItemsWidth += this.getItemWidth(item)));
        triggerClone.remove();
        return totalItemsWidth;
    }
    getTotalVisibleItems() {
        const triggerClone = this.buildTriggerClone();
        this.renderer.setStyle(triggerClone.querySelector('.kbq-select__match-hidden-text'), 'display', 'block');
        this.renderer.appendChild(this.trigger.nativeElement, triggerClone);
        let visibleItemsCount = 0;
        let totalVisibleItemsWidth = 0;
        triggerClone.querySelectorAll('kbq-tag').forEach((item) => {
            if (item.offsetTop < item.offsetHeight) {
                totalVisibleItemsWidth += this.getItemWidth(item);
                visibleItemsCount++;
            }
        });
        triggerClone.remove();
        return [totalVisibleItemsWidth, visibleItemsCount];
    }
    /** Gets how wide the overlay panel should be. */
    getOverlayWidth(origin) {
        if (this.panelWidth === 'auto') {
            const elementRef = origin instanceof CdkOverlayOrigin ? origin.elementRef : origin || this.elementRef;
            return elementRef.nativeElement.getBoundingClientRect().width;
        }
        return this.panelWidth ?? '';
    }
    buildTriggerClone() {
        const triggerClone = this.trigger.nativeElement.cloneNode(true);
        this.renderer.setStyle(triggerClone, 'position', 'absolute');
        this.renderer.setStyle(triggerClone, 'visibility', 'hidden');
        this.renderer.setStyle(triggerClone, 'top', '-100%');
        this.renderer.setStyle(triggerClone, 'left', '0');
        return triggerClone;
    }
    getItemWidth(element) {
        const computedStyle = this.window.getComputedStyle(element);
        const width = parseInt(computedStyle.width);
        const marginLeft = parseInt(computedStyle.marginLeft);
        const marginRight = parseInt(computedStyle.marginRight);
        return width + marginLeft + marginRight + parseInt(SizeXxs);
    }
    refreshTriggerValues() {
        this.triggerValues = this.selectionModel.selected.map((node) => ({
            value: this.tree.treeControl.getValue(node),
            viewValue: this.tree.treeControl.getViewValue(node),
            disabled: this.tree.treeControl.isDisabled(node)
        }));
        this.changeDetectorRef.detectChanges();
    }
    /**
     * Sets the selected option based on a value. If no option can be
     * found with the designated value, the select trigger is cleared.
     */
    setSelectionByValue(value) {
        if (this.multiSelection && value) {
            if (!Array.isArray(value)) {
                throw getKbqSelectNonArrayValueError();
            }
            this.tree.setOptionsFromValues(value);
            this.sortValues();
        }
        else {
            this.tree.setOptionsFromValues([value]);
        }
        this.changeDetectorRef.detectChanges();
    }
    initKeyManager() {
        this.originalOnKeyDown = this.tree.onKeyDown;
        this.tree.onKeyDown = () => { };
        this.tree.keyManager.change.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
            if (this._panelOpen && this.panel) {
                this.scrollActiveOptionIntoView();
            }
            else if (!this._panelOpen && !this.multiSelection && this.tree.keyManager.activeItem) {
                this.tree.keyManager.activeItem.selectViaInteraction();
            }
        });
    }
    /** Sorts the selected values in the selected based on their order in the panel. */
    sortValues() {
        if (this.multiSelection) {
            const options = this.options.toArray();
            this.selectionModel.sort((a, b) => {
                return this.sortComparator
                    ? this.sortComparator(a, b, options)
                    : options.indexOf(a) - options.indexOf(b);
            });
            this.stateChanges.next();
        }
    }
    /**
     * Highlights the selected item. If no option is selected, it will highlight
     * the first item instead.
     */
    highlightCorrectOption() {
        if (!this.tree.keyManager) {
            return;
        }
        const selectedOption = this.options.find((option) => option.data === this.firstSelected);
        this.tree.keyManager.setFocusOrigin('keyboard');
        if (selectedOption) {
            this.tree.keyManager.setActiveItem(selectedOption);
        }
        else {
            this.tree.keyManager.setFirstItemActive();
            if (this.tree.keyManager.activeItem?.disabled) {
                this.tree.keyManager.setActiveItem(-1);
            }
        }
    }
    /** Scrolls the active option into view. */
    scrollActiveOptionIntoView() {
        this.tree.keyManager.activeItem?.focus();
    }
    subscribeOnSearchChanges() {
        if (!this.search?.ngControl.valueChanges)
            return;
        this.search.ngControl.valueChanges.pipe(audit(() => this.tree.unorderedOptions.changes)).subscribe((value) => {
            this.isEmptySearchResult = !!value && this.tree.isEmpty;
            this.changeDetectorRef.markForCheck();
        });
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqTreeSelect, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.ErrorStateMatcher }, { token: KBQ_SELECT_SCROLL_STRATEGY }, { token: i2.Directionality, optional: true }, { token: i3.NgForm, optional: true }, { token: i3.FormGroupDirective, optional: true }, { token: i4.KbqFormField, host: true, optional: true }, { token: i3.NgControl, optional: true, self: true }, { token: KBQ_LOCALE_SERVICE, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: KbqTreeSelect, selector: "kbq-tree-select", inputs: { hiddenItemsText: "hiddenItemsText", panelClass: "panelClass", backdropClass: "backdropClass", errorStateMatcher: "errorStateMatcher", sortComparator: "sortComparator", multiline: ["multiline", "multiline", booleanAttribute], placeholder: "placeholder", required: "required", multiple: ["multiple", "multiple", booleanAttribute], autoSelect: "autoSelect", id: "id", hasBackdrop: "hasBackdrop", tabIndex: "tabIndex", disabled: ["disabled", "disabled", booleanAttribute], selectAllHandler: "selectAllHandler", panelMinWidth: ["panelMinWidth", "panelMinWidth", numberAttribute], panelWidth: "panelWidth", searchMinOptionsThreshold: "searchMinOptionsThreshold", hiddenItemsTextFormatter: "hiddenItemsTextFormatter" }, outputs: { openedChange: "openedChange", openedStream: "opened", closedStream: "closed", selectionChange: "selectionChange", valueChange: "valueChange" }, host: { listeners: { "click": "handleClick()", "keydown": "handleKeydown($event)", "focus": "onFocus()", "blur": "onBlur()", "window:resize": "calculateHiddenItems()" }, properties: { "class.kbq-select_multiple": "multiple", "class.kbq-select_multiline": "multiline", "class.kbq-disabled": "disabled", "class.kbq-invalid": "errorState", "attr.tabindex": "tabIndex", "attr.disabled": "disabled || null" }, classAttribute: "kbq-tree-select" }, providers: [
            { provide: KbqFormFieldControl, useExisting: KbqTreeSelect },
            { provide: KbqTree, useExisting: KbqTreeSelect },
            { provide: KBQ_PARENT_POPUP, useExisting: KbqTreeSelect }
        ], queries: [{ propertyName: "cleaner", first: true, predicate: ["kbqSelectCleaner"], descendants: true, static: true }, { propertyName: "customTrigger", first: true, predicate: KbqSelectTrigger, descendants: true }, { propertyName: "customMatcher", first: true, predicate: KbqSelectMatcher, descendants: true }, { propertyName: "customTagTemplateRef", first: true, predicate: ["kbqSelectTagContent"], descendants: true, read: TemplateRef }, { propertyName: "tree", first: true, predicate: KbqTreeSelection, descendants: true }, { propertyName: "search", first: true, predicate: KbqSelectSearch, descendants: true }], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }, { propertyName: "overlayDir", first: true, predicate: CdkConnectedOverlay, descendants: true }, { propertyName: "tags", predicate: KbqTag, descendants: true }], exportAs: ["kbqTreeSelect"], usesInheritance: true, ngImport: i0, template: "<div\n    #fallbackOverlayOrigin=\"cdkOverlayOrigin\"\n    #trigger\n    cdkOverlayOrigin\n    class=\"kbq-select__trigger\"\n    [class.kbq-select__trigger_empty]=\"empty\"\n    [class.kbq-select__trigger_multiline]=\"multiline\"\n    [class.kbq-select__trigger_multiple]=\"multiple\"\n    [class.kbq-select__trigger_single]=\"!multiple\"\n>\n    @if (!!customMatcher) {\n        <ng-content select=\"kbq-select-matcher, [kbq-select-matcher]\" />\n    } @else {\n        <div class=\"kbq-select__matcher\">\n            @if (empty) {\n                <span class=\"kbq-select__placeholder\">\n                    {{ placeholder || '\\u00A0' }}\n                </span>\n            } @else {\n                @if (!!customTrigger) {\n                    <ng-content select=\"kbq-select-trigger, [kbq-select-trigger]\" />\n                } @else {\n                    <div class=\"kbq-select__match-container\">\n                        @if (multiSelection) {\n                            <div\n                                [class.kbq-select__match-list]=\"!multiline\"\n                                [class.kbq-select__multiline-match-list]=\"multiline\"\n                            >\n                                @if (!customTagTemplateRef) {\n                                    @for (option of triggerValues; track option) {\n                                        <kbq-tag\n                                            [color]=\"colorForState\"\n                                            [disabled]=\"option.disabled || disabled\"\n                                            [selectable]=\"false\"\n                                        >\n                                            {{ option.viewValue }}\n                                            @if (!option.disabled && !disabled) {\n                                                <i\n                                                    kbq-icon=\"kbq-xmark-s_16\"\n                                                    kbqTagRemove\n                                                    (click)=\"onRemoveSelectedOption(option, $event)\"\n                                                ></i>\n                                            }\n                                        </kbq-tag>\n                                    }\n                                }\n                                @if (customTagTemplateRef) {\n                                    @for (option of triggerValues; track option) {\n                                        <ng-container\n                                            [ngTemplateOutlet]=\"customTagTemplateRef\"\n                                            [ngTemplateOutletContext]=\"{ $implicit: option, select: this }\"\n                                        />\n                                    }\n                                }\n                            </div>\n                        } @else {\n                            <span class=\"kbq-select__matcher-text\">\n                                {{ triggerValue }}\n                            </span>\n                        }\n                        @if (!multiline) {\n                            <div\n                                class=\"kbq-select__match-hidden-text\"\n                                [style.display]=\"hiddenItems > 0 ? 'block' : 'none'\"\n                            >\n                                {{ hiddenItemsTextFormatter(hiddenItemsText, hiddenItems) }}\n                            </div>\n                        }\n                    </div>\n                }\n            }\n\n            @if (canShowCleaner) {\n                <div\n                    class=\"kbq-select__cleaner\"\n                    (click)=\"clearValue($event)\"\n                    (keydown.enter)=\"clearValue($event)\"\n                    (keydown.space)=\"clearValue($event)\"\n                >\n                    <ng-content select=\"kbq-cleaner\" />\n                </div>\n            }\n\n            <div class=\"kbq-select__arrow-wrapper\">\n                <i kbq-icon=\"kbq-chevron-down-s_16\" class=\"kbq-select__arrow\" [color]=\"colorForState\"></i>\n            </div>\n        </div>\n    }\n</div>\n\n<ng-template\n    cdkConnectedOverlay\n    cdkConnectedOverlayLockPosition\n    [cdkConnectedOverlayBackdropClass]=\"backdropClass\"\n    [cdkConnectedOverlayHasBackdrop]=\"hasBackdrop\"\n    [cdkConnectedOverlayMinWidth]=\"overlayMinWidth\"\n    [cdkConnectedOverlayOffsetY]=\"offsetY\"\n    [cdkConnectedOverlayOpen]=\"panelOpen\"\n    [cdkConnectedOverlayOrigin]=\"overlayOrigin || fallbackOverlayOrigin\"\n    [cdkConnectedOverlayPanelClass]=\"overlayPanelClass\"\n    [cdkConnectedOverlayPositions]=\"positions\"\n    [cdkConnectedOverlayScrollStrategy]=\"scrollStrategy\"\n    [cdkConnectedOverlayWidth]=\"overlayWidth\"\n    (attach)=\"onAttached()\"\n    (backdropClick)=\"close()\"\n>\n    <div\n        #panel\n        cdkMonitorSubtreeFocus\n        class=\"kbq-tree-select__panel {{ getPanelTheme() }}\"\n        [ngClass]=\"panelClass\"\n        [style.font-size.px]=\"triggerFontSize\"\n        [style.transformOrigin]=\"transformOrigin\"\n        (keydown)=\"panelKeydownHandler($event)\"\n    >\n        @if (search && shouldShowSearch()) {\n            <div class=\"kbq-select__search-container\">\n                <ng-content select=\"[kbqSelectSearch]\" />\n            </div>\n        }\n\n        <div\n            #optionsContainer\n            class=\"kbq-tree-select__content kbq-scrollbar\"\n            [@fadeInContent]=\"'showing'\"\n            (@fadeInContent.done)=\"panelDoneAnimatingStream.next($event.toState)\"\n        >\n            @if (isEmptySearchResult) {\n                <div class=\"kbq-select__no-options-message\">\n                    <ng-content select=\"[kbq-select-search-empty-result]\" />\n                </div>\n            }\n\n            <ng-content select=\"kbq-tree-selection\" />\n        </div>\n\n        <ng-content select=\"kbq-select-footer,[kbq-tree-select-footer]\" />\n    </div>\n</ng-template>\n", styles: [".kbq-tree-select{box-sizing:border-box;display:inline-block;width:100%;outline:none}.kbq-tree-select .kbq-select__trigger{display:flex;box-sizing:border-box;position:relative;cursor:pointer;min-height:calc(var(--kbq-form-field-size-height) - var(--kbq-size-border-width) * 2)}.kbq-tree-select .kbq-select__trigger:not(.kbq-select__trigger_multiline){height:calc(var(--kbq-form-field-size-height) - var(--kbq-size-border-width) * 2)}.kbq-tree-select .kbq-select__trigger:not(.kbq-select__trigger_multiline) .kbq-select__matcher{overflow:hidden;white-space:nowrap}.kbq-tree-select .kbq-select__matcher{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-grow:1;align-items:center}.kbq-tree-select .kbq-select__matcher>span{flex:1;overflow:hidden}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_single .kbq-select__matcher,.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiple.kbq-select__trigger_empty .kbq-select__matcher{padding:var(--kbq-select-size-single-padding-vertical) var(--kbq-select-size-single-padding-right) var(--kbq-select-size-single-padding-vertical) var(--kbq-select-size-single-padding-left)}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiple:not(.kbq-select__trigger_empty) .kbq-select__matcher{padding:var(--kbq-select-size-multiple-padding-vertical) var(--kbq-select-size-multiple-padding-right) var(--kbq-select-size-multiple-padding-vertical) var(--kbq-select-size-multiple-padding-left)}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiple:not(.kbq-select__trigger_empty) .kbq-select__matcher .kbq-select__match-container{display:flex}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiple:not(.kbq-select__trigger_empty) .kbq-select__matcher .kbq-select__match-list{display:flex;flex-wrap:wrap;overflow:hidden;height:calc(var(--kbq-form-field-size-height) - var(--kbq-select-size-multiple-padding-vertical) * 2);max-height:calc(var(--kbq-form-field-size-height) - var(--kbq-select-size-multiple-padding-vertical) * 2);gap:var(--kbq-select-size-multiple-content-gap, var(--kbq-size-xxs));margin-right:var(--kbq-select-size-multiple-content-gap, var(--kbq-size-xxs))}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__match-container{flex-direction:column}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__matcher{max-width:100%;padding:calc(var(--kbq-select-size-multiple-padding-vertical) - var(--kbq-size-border-width)) var(--kbq-select-size-multiple-padding-right) calc(var(--kbq-select-size-multiple-padding-vertical) - var(--kbq-size-border-width)) var(--kbq-select-size-multiple-padding-left)}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__cleaner,.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__arrow-wrapper{align-self:flex-start;align-items:center;height:calc(var(--kbq-form-field-size-height) - var(--kbq-size-s));min-width:var(--kbq-form-field-size-addon-width)}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__multiline-match-list{display:flex;flex-direction:row;flex-wrap:wrap;margin-right:var(--kbq-select-size-multiple-content-gap, var(--kbq-size-xxs));gap:var(--kbq-size-xxs)}.kbq-tree-select .kbq-select__match-container{width:100%;text-overflow:ellipsis;overflow:hidden}.kbq-tree-select .kbq-select__match-container .kbq-select__match-hidden-text{flex:0 0 70px;align-self:center;padding-left:4px;padding-right:var(--kbq-select-size-multiple-content-gap, var(--kbq-size-xxs));text-align:right}.kbq-tree-select kbq-select-trigger,.kbq-tree-select [kbq-select-trigger]{width:100%}.kbq-tree-select .kbq-select__arrow-wrapper{display:flex;align-self:center;justify-content:center;min-width:var(--kbq-form-field-size-addon-width)}.kbq-form-field-appearance-fill .kbq-tree-select .kbq-select__arrow-wrapper,.kbq-form-field-appearance-standard .kbq-tree-select .kbq-select__arrow-wrapper{transform:translateY(-50%)}.kbq-form-field-appearance-outline .kbq-tree-select .kbq-select__arrow-wrapper{transform:translateY(-25%)}.kbq-disabled.kbq-tree-select .kbq-select__trigger{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.kbq-tree-select__panel{min-width:100%;overflow:hidden;border-radius:var(--kbq-select-panel-size-border-radius, var(--kbq-size-border-radius))}.kbq-tree-select__panel .kbq-option{font-size:inherit}.kbq-tree-select__panel .kbq-select__no-options-message{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;position:relative;max-width:100%;height:var(--kbq-option-size-height, var(--kbq-size-3xl));cursor:default;outline:none;padding-left:var(--kbq-option-size-horizontal-padding, var(--kbq-size-m));padding-right:var(--kbq-option-size-horizontal-padding, var(--kbq-size-m));border:var(--kbq-option-size-border-width, var(--kbq-size-3xs)) solid transparent}.kbq-tree-select__panel .kbq-select__search-container{padding:var(--kbq-size-xxs);border-bottom-width:1px;border-bottom-style:solid}.kbq-tree-select__content{max-height:var(--kbq-select-panel-size-max-height, 256px);padding:var(--kbq-size-xxs);overflow:hidden auto}.kbq-tree-select__panel .kbq-select__footer{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;align-items:center;box-sizing:border-box;min-height:40px;border-top-width:1px;border-top-style:solid;padding:var(--kbq-size-xxs) var(--kbq-size-l)}.kbq-tree-select__content .kbq-tree-selection{height:100%}.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option{position:relative}.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option:before,.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option:after{position:absolute;content:\"\";width:var(--kbq-size-xxs);height:calc(100% + var(--kbq-size-3xs) * 2)}.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option:before{right:calc(100% + var(--kbq-size-3xs))}.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option:after{left:calc(100% + var(--kbq-size-3xs))}.kbq-form-field-type-select:not(.kbq-disabled) .kbq-form-field-flex{cursor:pointer}.kbq-tree-select{color:var(--kbq-foreground-contrast)}.kbq-tree-select.kbq-control_has-validate-directive.ng-invalid,.kbq-tree-select.kbq-invalid{color:var(--kbq-error-default)}.kbq-tree-select.kbq-control_has-validate-directive.ng-invalid .kbq-select__placeholder,.kbq-tree-select.kbq-invalid .kbq-select__placeholder{color:var(--kbq-form-field-states-error-placeholder)}.kbq-tree-select.kbq-disabled{color:var(--kbq-states-foreground-disabled)}.kbq-tree-select.kbq-disabled .kbq-select__placeholder{color:var(--kbq-form-field-states-disabled-placeholder)}.kbq-select__placeholder{text-overflow:ellipsis;color:var(--kbq-form-field-default-placeholder)}.kbq-tree-select__panel{box-shadow:var(--kbq-select-panel-dropdown-shadow);background:var(--kbq-select-panel-dropdown-background)}.kbq-tree-select__panel .kbq-select__footer{border-color:var(--kbq-divider-color, var(--kbq-line-contrast-less))}.kbq-select__search-container{border-bottom-color:var(--kbq-divider-color, var(--kbq-line-contrast-less))}.kbq-select__no-options-message{color:var(--kbq-foreground-contrast-secondary)}.kbq-tree-select,.kbq-tree-select__panel{font-size:var(--kbq-typography-text-normal-font-size);font-style:var(--kbq-typography-text-normal-font-style);font-weight:var(--kbq-typography-text-normal-font-weight);line-height:var(--kbq-typography-text-normal-line-height);font-family:var(--kbq-typography-text-normal-font-family);text-transform:var(--kbq-typography-text-normal-text-transform);font-feature-settings:var(--kbq-typography-text-normal-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-letter-spacing)}\n", ".kbq-tree-select__panel{--kbq-select-panel-dropdown-background: var(--kbq-background-card);--kbq-select-panel-dropdown-shadow: var(--kbq-shadow-popup)}.kbq-tree-select__panel .kbq-tree-selection{--kbq-tree-option-border-radius: var(--kbq-size-xs)}\n", ".kbq-select,.kbq-tree-select,.kbq-select__panel{--kbq-select-size-single-padding-left: var(--kbq-form-field-size-infix-padding);--kbq-select-size-single-padding-right: var(--kbq-form-field-size-suffix-padding);--kbq-select-size-single-padding-vertical: var(--kbq-size-xs);--kbq-select-size-single-content-gap: var(--kbq-size-xxs);--kbq-select-size-multiple-padding-left: 0;--kbq-select-size-multiple-padding-right: 0;--kbq-select-size-multiple-padding-vertical: var(--kbq-size-xxs);--kbq-select-size-multiple-content-gap: var(--kbq-size-xxs);--kbq-select-panel-size-border-radius: var(--kbq-size-border-radius);--kbq-select-panel-size-max-height: 256px;--kbq-select-panel-dropdown-background: var(--kbq-background-card);--kbq-select-panel-dropdown-shadow: var(--kbq-shadow-popup)}\n"], dependencies: [{ kind: "directive", type: i5.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i5.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: i6.KbqIcon, selector: "[kbq-icon]", inputs: ["small", "autoColor", "kbq-icon"] }, { kind: "component", type: i7.KbqTag, selector: "kbq-tag, [kbq-tag], kbq-basic-tag, [kbq-basic-tag]", inputs: ["editable", "preventEditSubmit", "selected", "value", "selectable", "removable", "tabindex", "disabled"], outputs: ["editChange", "selectionChange", "destroyed", "removed"], exportAs: ["kbqTag"] }, { kind: "directive", type: i7.KbqTagRemove, selector: "[kbqTagRemove]" }, { kind: "directive", type: i8.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i8.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i9.CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"], exportAs: ["cdkMonitorFocus"] }], animations: [
            kbqSelectAnimations.transformPanel,
            kbqSelectAnimations.fadeInContent
        ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqTreeSelect, decorators: [{
            type: Component,
            args: [{ selector: 'kbq-tree-select', exportAs: 'kbqTreeSelect', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
                        class: 'kbq-tree-select',
                        '[class.kbq-select_multiple]': 'multiple',
                        '[class.kbq-select_multiline]': 'multiline',
                        '[class.kbq-disabled]': 'disabled',
                        '[class.kbq-invalid]': 'errorState',
                        '[attr.tabindex]': 'tabIndex',
                        '[attr.disabled]': 'disabled || null',
                        '(click)': 'handleClick()',
                        '(keydown)': 'handleKeydown($event)',
                        '(focus)': 'onFocus()',
                        '(blur)': 'onBlur()',
                        // @TODO: turn event listener only for specific conditions (#DS-4253)
                        '(window:resize)': 'calculateHiddenItems()'
                    }, animations: [
                        kbqSelectAnimations.transformPanel,
                        kbqSelectAnimations.fadeInContent
                    ], providers: [
                        { provide: KbqFormFieldControl, useExisting: KbqTreeSelect },
                        { provide: KbqTree, useExisting: KbqTreeSelect },
                        { provide: KBQ_PARENT_POPUP, useExisting: KbqTreeSelect }
                    ], template: "<div\n    #fallbackOverlayOrigin=\"cdkOverlayOrigin\"\n    #trigger\n    cdkOverlayOrigin\n    class=\"kbq-select__trigger\"\n    [class.kbq-select__trigger_empty]=\"empty\"\n    [class.kbq-select__trigger_multiline]=\"multiline\"\n    [class.kbq-select__trigger_multiple]=\"multiple\"\n    [class.kbq-select__trigger_single]=\"!multiple\"\n>\n    @if (!!customMatcher) {\n        <ng-content select=\"kbq-select-matcher, [kbq-select-matcher]\" />\n    } @else {\n        <div class=\"kbq-select__matcher\">\n            @if (empty) {\n                <span class=\"kbq-select__placeholder\">\n                    {{ placeholder || '\\u00A0' }}\n                </span>\n            } @else {\n                @if (!!customTrigger) {\n                    <ng-content select=\"kbq-select-trigger, [kbq-select-trigger]\" />\n                } @else {\n                    <div class=\"kbq-select__match-container\">\n                        @if (multiSelection) {\n                            <div\n                                [class.kbq-select__match-list]=\"!multiline\"\n                                [class.kbq-select__multiline-match-list]=\"multiline\"\n                            >\n                                @if (!customTagTemplateRef) {\n                                    @for (option of triggerValues; track option) {\n                                        <kbq-tag\n                                            [color]=\"colorForState\"\n                                            [disabled]=\"option.disabled || disabled\"\n                                            [selectable]=\"false\"\n                                        >\n                                            {{ option.viewValue }}\n                                            @if (!option.disabled && !disabled) {\n                                                <i\n                                                    kbq-icon=\"kbq-xmark-s_16\"\n                                                    kbqTagRemove\n                                                    (click)=\"onRemoveSelectedOption(option, $event)\"\n                                                ></i>\n                                            }\n                                        </kbq-tag>\n                                    }\n                                }\n                                @if (customTagTemplateRef) {\n                                    @for (option of triggerValues; track option) {\n                                        <ng-container\n                                            [ngTemplateOutlet]=\"customTagTemplateRef\"\n                                            [ngTemplateOutletContext]=\"{ $implicit: option, select: this }\"\n                                        />\n                                    }\n                                }\n                            </div>\n                        } @else {\n                            <span class=\"kbq-select__matcher-text\">\n                                {{ triggerValue }}\n                            </span>\n                        }\n                        @if (!multiline) {\n                            <div\n                                class=\"kbq-select__match-hidden-text\"\n                                [style.display]=\"hiddenItems > 0 ? 'block' : 'none'\"\n                            >\n                                {{ hiddenItemsTextFormatter(hiddenItemsText, hiddenItems) }}\n                            </div>\n                        }\n                    </div>\n                }\n            }\n\n            @if (canShowCleaner) {\n                <div\n                    class=\"kbq-select__cleaner\"\n                    (click)=\"clearValue($event)\"\n                    (keydown.enter)=\"clearValue($event)\"\n                    (keydown.space)=\"clearValue($event)\"\n                >\n                    <ng-content select=\"kbq-cleaner\" />\n                </div>\n            }\n\n            <div class=\"kbq-select__arrow-wrapper\">\n                <i kbq-icon=\"kbq-chevron-down-s_16\" class=\"kbq-select__arrow\" [color]=\"colorForState\"></i>\n            </div>\n        </div>\n    }\n</div>\n\n<ng-template\n    cdkConnectedOverlay\n    cdkConnectedOverlayLockPosition\n    [cdkConnectedOverlayBackdropClass]=\"backdropClass\"\n    [cdkConnectedOverlayHasBackdrop]=\"hasBackdrop\"\n    [cdkConnectedOverlayMinWidth]=\"overlayMinWidth\"\n    [cdkConnectedOverlayOffsetY]=\"offsetY\"\n    [cdkConnectedOverlayOpen]=\"panelOpen\"\n    [cdkConnectedOverlayOrigin]=\"overlayOrigin || fallbackOverlayOrigin\"\n    [cdkConnectedOverlayPanelClass]=\"overlayPanelClass\"\n    [cdkConnectedOverlayPositions]=\"positions\"\n    [cdkConnectedOverlayScrollStrategy]=\"scrollStrategy\"\n    [cdkConnectedOverlayWidth]=\"overlayWidth\"\n    (attach)=\"onAttached()\"\n    (backdropClick)=\"close()\"\n>\n    <div\n        #panel\n        cdkMonitorSubtreeFocus\n        class=\"kbq-tree-select__panel {{ getPanelTheme() }}\"\n        [ngClass]=\"panelClass\"\n        [style.font-size.px]=\"triggerFontSize\"\n        [style.transformOrigin]=\"transformOrigin\"\n        (keydown)=\"panelKeydownHandler($event)\"\n    >\n        @if (search && shouldShowSearch()) {\n            <div class=\"kbq-select__search-container\">\n                <ng-content select=\"[kbqSelectSearch]\" />\n            </div>\n        }\n\n        <div\n            #optionsContainer\n            class=\"kbq-tree-select__content kbq-scrollbar\"\n            [@fadeInContent]=\"'showing'\"\n            (@fadeInContent.done)=\"panelDoneAnimatingStream.next($event.toState)\"\n        >\n            @if (isEmptySearchResult) {\n                <div class=\"kbq-select__no-options-message\">\n                    <ng-content select=\"[kbq-select-search-empty-result]\" />\n                </div>\n            }\n\n            <ng-content select=\"kbq-tree-selection\" />\n        </div>\n\n        <ng-content select=\"kbq-select-footer,[kbq-tree-select-footer]\" />\n    </div>\n</ng-template>\n", styles: [".kbq-tree-select{box-sizing:border-box;display:inline-block;width:100%;outline:none}.kbq-tree-select .kbq-select__trigger{display:flex;box-sizing:border-box;position:relative;cursor:pointer;min-height:calc(var(--kbq-form-field-size-height) - var(--kbq-size-border-width) * 2)}.kbq-tree-select .kbq-select__trigger:not(.kbq-select__trigger_multiline){height:calc(var(--kbq-form-field-size-height) - var(--kbq-size-border-width) * 2)}.kbq-tree-select .kbq-select__trigger:not(.kbq-select__trigger_multiline) .kbq-select__matcher{overflow:hidden;white-space:nowrap}.kbq-tree-select .kbq-select__matcher{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-grow:1;align-items:center}.kbq-tree-select .kbq-select__matcher>span{flex:1;overflow:hidden}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_single .kbq-select__matcher,.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiple.kbq-select__trigger_empty .kbq-select__matcher{padding:var(--kbq-select-size-single-padding-vertical) var(--kbq-select-size-single-padding-right) var(--kbq-select-size-single-padding-vertical) var(--kbq-select-size-single-padding-left)}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiple:not(.kbq-select__trigger_empty) .kbq-select__matcher{padding:var(--kbq-select-size-multiple-padding-vertical) var(--kbq-select-size-multiple-padding-right) var(--kbq-select-size-multiple-padding-vertical) var(--kbq-select-size-multiple-padding-left)}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiple:not(.kbq-select__trigger_empty) .kbq-select__matcher .kbq-select__match-container{display:flex}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiple:not(.kbq-select__trigger_empty) .kbq-select__matcher .kbq-select__match-list{display:flex;flex-wrap:wrap;overflow:hidden;height:calc(var(--kbq-form-field-size-height) - var(--kbq-select-size-multiple-padding-vertical) * 2);max-height:calc(var(--kbq-form-field-size-height) - var(--kbq-select-size-multiple-padding-vertical) * 2);gap:var(--kbq-select-size-multiple-content-gap, var(--kbq-size-xxs));margin-right:var(--kbq-select-size-multiple-content-gap, var(--kbq-size-xxs))}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__match-container{flex-direction:column}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__matcher{max-width:100%;padding:calc(var(--kbq-select-size-multiple-padding-vertical) - var(--kbq-size-border-width)) var(--kbq-select-size-multiple-padding-right) calc(var(--kbq-select-size-multiple-padding-vertical) - var(--kbq-size-border-width)) var(--kbq-select-size-multiple-padding-left)}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__cleaner,.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__arrow-wrapper{align-self:flex-start;align-items:center;height:calc(var(--kbq-form-field-size-height) - var(--kbq-size-s));min-width:var(--kbq-form-field-size-addon-width)}.kbq-tree-select .kbq-select__trigger.kbq-select__trigger_multiline:not(.kbq-select__trigger_empty) .kbq-select__multiline-match-list{display:flex;flex-direction:row;flex-wrap:wrap;margin-right:var(--kbq-select-size-multiple-content-gap, var(--kbq-size-xxs));gap:var(--kbq-size-xxs)}.kbq-tree-select .kbq-select__match-container{width:100%;text-overflow:ellipsis;overflow:hidden}.kbq-tree-select .kbq-select__match-container .kbq-select__match-hidden-text{flex:0 0 70px;align-self:center;padding-left:4px;padding-right:var(--kbq-select-size-multiple-content-gap, var(--kbq-size-xxs));text-align:right}.kbq-tree-select kbq-select-trigger,.kbq-tree-select [kbq-select-trigger]{width:100%}.kbq-tree-select .kbq-select__arrow-wrapper{display:flex;align-self:center;justify-content:center;min-width:var(--kbq-form-field-size-addon-width)}.kbq-form-field-appearance-fill .kbq-tree-select .kbq-select__arrow-wrapper,.kbq-form-field-appearance-standard .kbq-tree-select .kbq-select__arrow-wrapper{transform:translateY(-50%)}.kbq-form-field-appearance-outline .kbq-tree-select .kbq-select__arrow-wrapper{transform:translateY(-25%)}.kbq-disabled.kbq-tree-select .kbq-select__trigger{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.kbq-tree-select__panel{min-width:100%;overflow:hidden;border-radius:var(--kbq-select-panel-size-border-radius, var(--kbq-size-border-radius))}.kbq-tree-select__panel .kbq-option{font-size:inherit}.kbq-tree-select__panel .kbq-select__no-options-message{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;position:relative;max-width:100%;height:var(--kbq-option-size-height, var(--kbq-size-3xl));cursor:default;outline:none;padding-left:var(--kbq-option-size-horizontal-padding, var(--kbq-size-m));padding-right:var(--kbq-option-size-horizontal-padding, var(--kbq-size-m));border:var(--kbq-option-size-border-width, var(--kbq-size-3xs)) solid transparent}.kbq-tree-select__panel .kbq-select__search-container{padding:var(--kbq-size-xxs);border-bottom-width:1px;border-bottom-style:solid}.kbq-tree-select__content{max-height:var(--kbq-select-panel-size-max-height, 256px);padding:var(--kbq-size-xxs);overflow:hidden auto}.kbq-tree-select__panel .kbq-select__footer{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;align-items:center;box-sizing:border-box;min-height:40px;border-top-width:1px;border-top-style:solid;padding:var(--kbq-size-xxs) var(--kbq-size-l)}.kbq-tree-select__content .kbq-tree-selection{height:100%}.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option{position:relative}.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option:before,.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option:after{position:absolute;content:\"\";width:var(--kbq-size-xxs);height:calc(100% + var(--kbq-size-3xs) * 2)}.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option:before{right:calc(100% + var(--kbq-size-3xs))}.kbq-tree-select__content .kbq-tree-selection .kbq-tree-option:after{left:calc(100% + var(--kbq-size-3xs))}.kbq-form-field-type-select:not(.kbq-disabled) .kbq-form-field-flex{cursor:pointer}.kbq-tree-select{color:var(--kbq-foreground-contrast)}.kbq-tree-select.kbq-control_has-validate-directive.ng-invalid,.kbq-tree-select.kbq-invalid{color:var(--kbq-error-default)}.kbq-tree-select.kbq-control_has-validate-directive.ng-invalid .kbq-select__placeholder,.kbq-tree-select.kbq-invalid .kbq-select__placeholder{color:var(--kbq-form-field-states-error-placeholder)}.kbq-tree-select.kbq-disabled{color:var(--kbq-states-foreground-disabled)}.kbq-tree-select.kbq-disabled .kbq-select__placeholder{color:var(--kbq-form-field-states-disabled-placeholder)}.kbq-select__placeholder{text-overflow:ellipsis;color:var(--kbq-form-field-default-placeholder)}.kbq-tree-select__panel{box-shadow:var(--kbq-select-panel-dropdown-shadow);background:var(--kbq-select-panel-dropdown-background)}.kbq-tree-select__panel .kbq-select__footer{border-color:var(--kbq-divider-color, var(--kbq-line-contrast-less))}.kbq-select__search-container{border-bottom-color:var(--kbq-divider-color, var(--kbq-line-contrast-less))}.kbq-select__no-options-message{color:var(--kbq-foreground-contrast-secondary)}.kbq-tree-select,.kbq-tree-select__panel{font-size:var(--kbq-typography-text-normal-font-size);font-style:var(--kbq-typography-text-normal-font-style);font-weight:var(--kbq-typography-text-normal-font-weight);line-height:var(--kbq-typography-text-normal-line-height);font-family:var(--kbq-typography-text-normal-font-family);text-transform:var(--kbq-typography-text-normal-text-transform);font-feature-settings:var(--kbq-typography-text-normal-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-letter-spacing)}\n", ".kbq-tree-select__panel{--kbq-select-panel-dropdown-background: var(--kbq-background-card);--kbq-select-panel-dropdown-shadow: var(--kbq-shadow-popup)}.kbq-tree-select__panel .kbq-tree-selection{--kbq-tree-option-border-radius: var(--kbq-size-xs)}\n", ".kbq-select,.kbq-tree-select,.kbq-select__panel{--kbq-select-size-single-padding-left: var(--kbq-form-field-size-infix-padding);--kbq-select-size-single-padding-right: var(--kbq-form-field-size-suffix-padding);--kbq-select-size-single-padding-vertical: var(--kbq-size-xs);--kbq-select-size-single-content-gap: var(--kbq-size-xxs);--kbq-select-size-multiple-padding-left: 0;--kbq-select-size-multiple-padding-right: 0;--kbq-select-size-multiple-padding-vertical: var(--kbq-size-xxs);--kbq-select-size-multiple-content-gap: var(--kbq-size-xxs);--kbq-select-panel-size-border-radius: var(--kbq-size-border-radius);--kbq-select-panel-size-max-height: 256px;--kbq-select-panel-dropdown-background: var(--kbq-background-card);--kbq-select-panel-dropdown-shadow: var(--kbq-shadow-popup)}\n"] }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.ErrorStateMatcher }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [KBQ_SELECT_SCROLL_STRATEGY]
                }] }, { type: i2.Directionality, decorators: [{
                    type: Optional
                }] }, { type: i3.NgForm, decorators: [{
                    type: Optional
                }] }, { type: i3.FormGroupDirective, decorators: [{
                    type: Optional
                }] }, { type: i4.KbqFormField, decorators: [{
                    type: Host
                }, {
                    type: Optional
                }] }, { type: i3.NgControl, decorators: [{
                    type: Optional
                }, {
                    type: Self
                }] }, { type: i1.KbqLocaleService, decorators: [{
                    type: Optional
                }, {
                    type: Inject,
                    args: [KBQ_LOCALE_SERVICE]
                }] }], propDecorators: { trigger: [{
                type: ViewChild,
                args: ['trigger', { static: false }]
            }], panel: [{
                type: ViewChild,
                args: ['panel', { static: false }]
            }], overlayDir: [{
                type: ViewChild,
                args: [CdkConnectedOverlay, { static: false }]
            }], tags: [{
                type: ViewChildren,
                args: [KbqTag]
            }], cleaner: [{
                type: ContentChild,
                args: ['kbqSelectCleaner', { static: true }]
            }], customTrigger: [{
                type: ContentChild,
                args: [KbqSelectTrigger, { static: false }]
            }], customMatcher: [{
                type: ContentChild,
                args: [KbqSelectMatcher, { static: false }]
            }], customTagTemplateRef: [{
                type: ContentChild,
                args: ['kbqSelectTagContent', { static: false, read: TemplateRef }]
            }], tree: [{
                type: ContentChild,
                args: [KbqTreeSelection, { static: false }]
            }], search: [{
                type: ContentChild,
                args: [KbqSelectSearch, { static: false }]
            }], hiddenItemsText: [{
                type: Input
            }], openedChange: [{
                type: Output
            }], openedStream: [{
                type: Output,
                args: ['opened']
            }], closedStream: [{
                type: Output,
                args: ['closed']
            }], selectionChange: [{
                type: Output
            }], valueChange: [{
                type: Output
            }], panelClass: [{
                type: Input
            }], backdropClass: [{
                type: Input
            }], errorStateMatcher: [{
                type: Input
            }], sortComparator: [{
                type: Input
            }], multiline: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], placeholder: [{
                type: Input
            }], required: [{
                type: Input
            }], multiple: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], autoSelect: [{
                type: Input
            }], id: [{
                type: Input
            }], hasBackdrop: [{
                type: Input
            }], tabIndex: [{
                type: Input
            }], disabled: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], selectAllHandler: [{
                type: Input
            }], panelMinWidth: [{
                type: Input,
                args: [{ transform: numberAttribute }]
            }], panelWidth: [{
                type: Input
            }], searchMinOptionsThreshold: [{
                type: Input
            }], hiddenItemsTextFormatter: [{
                type: Input
            }] } });

class KbqTreeSelectModule {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqTreeSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: KbqTreeSelectModule, declarations: [KbqTreeSelect], imports: [OverlayModule,
            KbqTreeModule,
            KbqIconModule,
            KbqTagsModule,
            KbqPseudoCheckboxModule,
            KbqSelectSearch,
            KbqSelectFooter,
            KbqSelectMatcher,
            KbqSelectTrigger,
            KbqSelectSearchEmptyResult,
            NgClass,
            NgTemplateOutlet,
            A11yModule], exports: [KbqTreeSelect,
            KbqSelectSearch,
            KbqSelectFooter,
            KbqSelectMatcher,
            KbqSelectTrigger,
            KbqSelectSearchEmptyResult,
            KbqFormFieldModule] }); }
    /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqTreeSelectModule, providers: [KBQ_SELECT_SCROLL_STRATEGY_PROVIDER], imports: [OverlayModule,
            KbqTreeModule,
            KbqIconModule,
            KbqTagsModule,
            KbqPseudoCheckboxModule,
            A11yModule, KbqFormFieldModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqTreeSelectModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        OverlayModule,
                        KbqTreeModule,
                        KbqIconModule,
                        KbqTagsModule,
                        KbqPseudoCheckboxModule,
                        KbqSelectSearch,
                        KbqSelectFooter,
                        KbqSelectMatcher,
                        KbqSelectTrigger,
                        KbqSelectSearchEmptyResult,
                        NgClass,
                        NgTemplateOutlet,
                        A11yModule
                    ],
                    exports: [
                        KbqTreeSelect,
                        KbqSelectSearch,
                        KbqSelectFooter,
                        KbqSelectMatcher,
                        KbqSelectTrigger,
                        KbqSelectSearchEmptyResult,
                        KbqFormFieldModule
                    ],
                    declarations: [KbqTreeSelect],
                    providers: [KBQ_SELECT_SCROLL_STRATEGY_PROVIDER]
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { KBQ_TREE_SELECT_OPTIONS, KbqTreeSelect, KbqTreeSelectChange, KbqTreeSelectModule, kbqTreeSelectOptionsProvider };
//# sourceMappingURL=koobiq-components-tree-select.mjs.map
