import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { Overlay } from '@angular/cdk/overlay';
import { NgTemplateOutlet, AsyncPipe, JsonPipe } from '@angular/common';
import * as i0 from '@angular/core';
import { inject, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, booleanAttribute, InjectionToken, ViewChild, EventEmitter, numberAttribute, Directive, Output, NgModule } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import * as i1$1 from '@angular/forms';
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
import * as i1 from '@koobiq/components/badge';
import { KbqBadgeModule } from '@koobiq/components/badge';
import * as i9 from '@koobiq/components/core';
import { KbqAnimationCurves, KbqAnimationDurations, KBQ_TITLE_TEXT_REF, ruRULocaleData, KbqPopUp, KBQ_LOCALE_SERVICE, applyPopupMargins, KbqOptionModule, KbqPopUpTrigger, PopUpSizes, PopUpPlacements, PopUpTriggers, POSITION_TO_CSS_MAP, EmptyFocusTrapStrategy } from '@koobiq/components/core';
import * as i5 from '@koobiq/components/divider';
import { KbqDividerModule } from '@koobiq/components/divider';
import * as i7 from '@koobiq/components/dropdown';
import { KbqDropdownItem, KbqDropdownModule } from '@koobiq/components/dropdown';
import * as i2 from '@koobiq/components/form-field';
import { KbqFormFieldModule } from '@koobiq/components/form-field';
import * as i4 from '@koobiq/components/icon';
import { KbqIcon, KbqIconModule } from '@koobiq/components/icon';
import * as i3 from '@koobiq/components/input';
import { KbqInput, KbqInputModule } from '@koobiq/components/input';
import { defaultOffsetYWithArrow } from '@koobiq/components/popover';
import * as i8 from '@koobiq/components/scrollbar';
import { KbqScrollbarModule } from '@koobiq/components/scrollbar';
import { merge } from 'rxjs';
import { trigger, state, style, transition, animate } from '@angular/animations';
import { DomSanitizer } from '@angular/platform-browser';
import { FocusTrapFactory, ConfigurableFocusTrapFactory, FOCUS_TRAP_INERT_STRATEGY } from '@angular/cdk/a11y';

/** @docs-private */
const kbqAppSwitcherAnimations = {
    /** Animation that transitions a tooltip in and out. */
    state: trigger('state', [
        state('initial', style({
            opacity: 0,
            transform: 'scale(1, 0.8)'
        })),
        transition('* => visible', animate(`120ms ${KbqAnimationCurves.DecelerationCurve}`, style({
            opacity: 1,
            transform: 'scale(1, 1)'
        }))),
        transition('* => hidden', animate(`${KbqAnimationDurations.Rapid} linear`, style({ opacity: 0 })))
    ])
};

/** @docs-private */
class KbqAppSwitcherDropdownApp extends KbqDropdownItem {
    constructor() {
        super(...arguments);
        this.sanitizer = inject(DomSanitizer);
    }
    getIcon(icon) {
        return this.sanitizer.bypassSecurityTrustHtml(icon || '');
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherDropdownApp, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: KbqAppSwitcherDropdownApp, isStandalone: true, selector: "[kbq-app-switcher-dropdown-app]", inputs: { app: ["kbq-app-switcher-dropdown-app", "app"] }, host: { properties: { "class.kbq-dropdown-item": "false" }, classAttribute: "kbq-app-switcher-dropdown-app" }, providers: [
            { provide: KBQ_TITLE_TEXT_REF, useExisting: KbqAppSwitcherDropdownApp },
            { provide: KbqDropdownItem, useExisting: KbqAppSwitcherDropdownApp }
        ], exportAs: ["kbqAppSwitcherDropdownApp"], usesInheritance: true, ngImport: i0, template: `
        <i class="kbq kbq-icon" [className]=""></i>
        <span class="kbq-app-switcher-dropdown-app__icon" [innerHtml]="getIcon(app.icon)"></span>

        <div class="kbq-app-switcher-dropdown-app__container">
            <div class="kbq-app-switcher-dropdown-app__name">
                <span>{{ app.name }}</span>

                @if (isNested) {
                    <i
                        kbq-icon="kbq-chevron-right-s_16"
                        class="kbq-app-switcher-dropdown-item-trigger__icon"
                        [color]="componentColors.ContrastFade"
                    ></i>
                }
            </div>
            @if (app.caption) {
                <div class="kbq-app-switcher-dropdown-app__caption">{{ app.caption }}</div>
            }
        </div>
    `, isInline: true, styles: ["@keyframes kbq-progress{0%{background-position:0 0}to{background-position:64px 0}}.kbq-progress{position:relative}.kbq-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,#0000000a 12px,#ffffff1a 12px 22px,#0000000a 22px 34px,#ffffff1a 34px) repeat;background-size:32px 32px;animation:kbq-progress 1s linear infinite}.kbq-group{display:flex;flex-direction:row}.kbq-group .kbq-group_justified>.kbq-group-item{width:100%}.kbq-group .kbq-group-item+.kbq-group-item{margin-left:calc(-1 * var(--kbq-size-border-width))}.kbq-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group{display:flex;flex-direction:column}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group .kbq-group-item+.kbq-group-item{margin-top:calc(-1 * var(--kbq-size-border-width))}.kbq-truncate-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-no-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.kbq-app-switcher-dropdown-app{display:flex;flex-direction:row;width:100%;min-height:50px;border-radius:var(--kbq-size-xs);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent;cursor:pointer;padding:var(--kbq-size-xxs) var(--kbq-size-m)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__icon{padding-top:var(--kbq-size-s);padding-right:var(--kbq-size-m)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__container{width:100%;align-self:center}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__container .kbq-app-switcher-dropdown-app__name{display:flex;flex-direction:row;justify-content:space-between}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__container .kbq-app-switcher-dropdown-app__caption{margin-left:var(--kbq-size-3xs)}.kbq-app-switcher-dropdown-app .kbq-dropdown-item__caption{padding-top:var(--kbq-size-3xs)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-item-trigger__icon{margin-top:var(--kbq-size-3xs)}.kbq-app-switcher-dropdown-app{background:var(--kbq-list-default-container-background);color:var(--kbq-list-default-text-color)}.kbq-app-switcher-dropdown-app.kbq-dropdown-item_highlighted,.kbq-app-switcher-dropdown-app:hover{background:var(--kbq-states-background-transparent-active)}.kbq-app-switcher-dropdown-app.cdk-keyboard-focused{border-color:var(--kbq-list-states-focused-focus-outline-color)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__caption{color:var(--kbq-dropdown-item-caption-color)}.kbq-app-switcher-dropdown-app{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)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__caption{font-size:var(--kbq-typography-text-compact-font-size);font-style:var(--kbq-typography-text-compact-font-style);font-weight:var(--kbq-typography-text-compact-font-weight);line-height:var(--kbq-typography-text-compact-line-height);font-family:var(--kbq-typography-text-compact-font-family);text-transform:var(--kbq-typography-text-compact-text-transform);font-feature-settings:var(--kbq-typography-text-compact-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-letter-spacing)}\n"], dependencies: [{ kind: "component", type: KbqIcon, selector: "[kbq-icon]", inputs: ["small", "autoColor", "kbq-icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherDropdownApp, decorators: [{
            type: Component,
            args: [{ standalone: true, selector: '[kbq-app-switcher-dropdown-app]', exportAs: 'kbqAppSwitcherDropdownApp', template: `
        <i class="kbq kbq-icon" [className]=""></i>
        <span class="kbq-app-switcher-dropdown-app__icon" [innerHtml]="getIcon(app.icon)"></span>

        <div class="kbq-app-switcher-dropdown-app__container">
            <div class="kbq-app-switcher-dropdown-app__name">
                <span>{{ app.name }}</span>

                @if (isNested) {
                    <i
                        kbq-icon="kbq-chevron-right-s_16"
                        class="kbq-app-switcher-dropdown-item-trigger__icon"
                        [color]="componentColors.ContrastFade"
                    ></i>
                }
            </div>
            @if (app.caption) {
                <div class="kbq-app-switcher-dropdown-app__caption">{{ app.caption }}</div>
            }
        </div>
    `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'kbq-app-switcher-dropdown-app',
                        '[class.kbq-dropdown-item]': 'false'
                    }, imports: [KbqIcon], providers: [
                        { provide: KBQ_TITLE_TEXT_REF, useExisting: KbqAppSwitcherDropdownApp },
                        { provide: KbqDropdownItem, useExisting: KbqAppSwitcherDropdownApp }
                    ], styles: ["@keyframes kbq-progress{0%{background-position:0 0}to{background-position:64px 0}}.kbq-progress{position:relative}.kbq-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,#0000000a 12px,#ffffff1a 12px 22px,#0000000a 22px 34px,#ffffff1a 34px) repeat;background-size:32px 32px;animation:kbq-progress 1s linear infinite}.kbq-group{display:flex;flex-direction:row}.kbq-group .kbq-group_justified>.kbq-group-item{width:100%}.kbq-group .kbq-group-item+.kbq-group-item{margin-left:calc(-1 * var(--kbq-size-border-width))}.kbq-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group{display:flex;flex-direction:column}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group .kbq-group-item+.kbq-group-item{margin-top:calc(-1 * var(--kbq-size-border-width))}.kbq-truncate-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-no-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.kbq-app-switcher-dropdown-app{display:flex;flex-direction:row;width:100%;min-height:50px;border-radius:var(--kbq-size-xs);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent;cursor:pointer;padding:var(--kbq-size-xxs) var(--kbq-size-m)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__icon{padding-top:var(--kbq-size-s);padding-right:var(--kbq-size-m)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__container{width:100%;align-self:center}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__container .kbq-app-switcher-dropdown-app__name{display:flex;flex-direction:row;justify-content:space-between}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__container .kbq-app-switcher-dropdown-app__caption{margin-left:var(--kbq-size-3xs)}.kbq-app-switcher-dropdown-app .kbq-dropdown-item__caption{padding-top:var(--kbq-size-3xs)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-item-trigger__icon{margin-top:var(--kbq-size-3xs)}.kbq-app-switcher-dropdown-app{background:var(--kbq-list-default-container-background);color:var(--kbq-list-default-text-color)}.kbq-app-switcher-dropdown-app.kbq-dropdown-item_highlighted,.kbq-app-switcher-dropdown-app:hover{background:var(--kbq-states-background-transparent-active)}.kbq-app-switcher-dropdown-app.cdk-keyboard-focused{border-color:var(--kbq-list-states-focused-focus-outline-color)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__caption{color:var(--kbq-dropdown-item-caption-color)}.kbq-app-switcher-dropdown-app{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)}.kbq-app-switcher-dropdown-app .kbq-app-switcher-dropdown-app__caption{font-size:var(--kbq-typography-text-compact-font-size);font-style:var(--kbq-typography-text-compact-font-style);font-weight:var(--kbq-typography-text-compact-font-weight);line-height:var(--kbq-typography-text-compact-line-height);font-family:var(--kbq-typography-text-compact-font-family);text-transform:var(--kbq-typography-text-compact-text-transform);font-feature-settings:var(--kbq-typography-text-compact-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-letter-spacing)}\n"] }]
        }], propDecorators: { app: [{
                type: Input,
                args: ['kbq-app-switcher-dropdown-app']
            }] } });

/** @docs-private */
class KbqAppSwitcherDropdownSite extends KbqDropdownItem {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherDropdownSite, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: KbqAppSwitcherDropdownSite, isStandalone: true, selector: "[kbq-app-switcher-dropdown-site]", inputs: { site: ["kbq-app-switcher-dropdown-site", "site"] }, host: { properties: { "class.kbq-dropdown-item": "false" }, classAttribute: "kbq-app-switcher-dropdown-site" }, providers: [
            { provide: KBQ_TITLE_TEXT_REF, useExisting: KbqAppSwitcherDropdownSite },
            { provide: KbqDropdownItem, useExisting: KbqAppSwitcherDropdownSite }
        ], exportAs: ["kbqAppSwitcherDropdownSite"], usesInheritance: true, ngImport: i0, template: `
        <span class="kbq-app-switcher-dropdown-site__name">{{ site.name }}</span>

        @if (site.status) {
            <kbq-badge class="kbq-app-switcher-dropdown-site__badge" [compact]="true">{{ site.status }}</kbq-badge>
        }

        @if (isNested) {
            <i
                kbq-icon="kbq-chevron-right-s_16"
                class="kbq-app-switcher-dropdown-item-trigger__icon"
                [color]="componentColors.ContrastFade"
            ></i>
        }
    `, isInline: true, styles: ["@keyframes kbq-progress{0%{background-position:0 0}to{background-position:64px 0}}.kbq-progress{position:relative}.kbq-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,#0000000a 12px,#ffffff1a 12px 22px,#0000000a 22px 34px,#ffffff1a 34px) repeat;background-size:32px 32px;animation:kbq-progress 1s linear infinite}.kbq-group{display:flex;flex-direction:row}.kbq-group .kbq-group_justified>.kbq-group-item{width:100%}.kbq-group .kbq-group-item+.kbq-group-item{margin-left:calc(-1 * var(--kbq-size-border-width))}.kbq-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group{display:flex;flex-direction:column}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group .kbq-group-item+.kbq-group-item{margin-top:calc(-1 * var(--kbq-size-border-width))}.kbq-truncate-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-no-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.kbq-app-switcher-dropdown-site{justify-content:space-between;width:100%;min-height:var(--kbq-size-3xl);text-decoration:none;border-radius:var(--kbq-size-xs);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent;min-height:32px;gap:var(--kbq-size-s);border:var(--kbq-size-3xs) solid transparent;padding:var(--kbq-size-xxs) calc(var(--kbq-size-m) - var(--kbq-size-3xs));padding:var(--kbq-size-xxs) var(--kbq-size-m)}.kbq-app-switcher-dropdown-site .kbq-list-text{display:flex;flex-direction:column;width:100%;box-sizing:content-box;display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-app-switcher-dropdown-site .kbq-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.kbq-app-switcher-dropdown-site .kbq-list-text:empty{display:none}.kbq-app-switcher-dropdown-site .kbq-list-option-caption{padding-top:var(--kbq-size-3xs)}.kbq-app-switcher-dropdown-site .kbq-app-switcher-dropdown-item-trigger__icon,.kbq-app-switcher-dropdown-site .kbq-badge{margin-top:var(--kbq-size-3xs);align-self:flex-start}.kbq-app-switcher-dropdown-site{background:var(--kbq-list-default-container-background);color:var(--kbq-list-default-text-color)}.kbq-app-switcher-dropdown-site.kbq-dropdown-item_highlighted,.kbq-app-switcher-dropdown-site:hover{background:var(--kbq-states-background-transparent-active)}.kbq-app-switcher-dropdown-site.cdk-keyboard-focused{border-color:var(--kbq-list-states-focused-focus-outline-color)}.kbq-app-switcher-dropdown-site{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"], dependencies: [{ kind: "component", type: KbqIcon, selector: "[kbq-icon]", inputs: ["small", "autoColor", "kbq-icon"] }, { kind: "ngmodule", type: KbqBadgeModule }, { kind: "component", type: i1.KbqBadge, selector: "kbq-badge", inputs: ["compact", "outline", "badgeColor"] }, { kind: "directive", type: i1.KbqBadgeCssStyler, selector: "kbq-badge" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherDropdownSite, decorators: [{
            type: Component,
            args: [{ standalone: true, selector: '[kbq-app-switcher-dropdown-site]', exportAs: 'kbqAppSwitcherDropdownSite', template: `
        <span class="kbq-app-switcher-dropdown-site__name">{{ site.name }}</span>

        @if (site.status) {
            <kbq-badge class="kbq-app-switcher-dropdown-site__badge" [compact]="true">{{ site.status }}</kbq-badge>
        }

        @if (isNested) {
            <i
                kbq-icon="kbq-chevron-right-s_16"
                class="kbq-app-switcher-dropdown-item-trigger__icon"
                [color]="componentColors.ContrastFade"
            ></i>
        }
    `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'kbq-app-switcher-dropdown-site',
                        '[class.kbq-dropdown-item]': 'false'
                    }, imports: [
                        KbqIcon,
                        KbqBadgeModule
                    ], providers: [
                        { provide: KBQ_TITLE_TEXT_REF, useExisting: KbqAppSwitcherDropdownSite },
                        { provide: KbqDropdownItem, useExisting: KbqAppSwitcherDropdownSite }
                    ], styles: ["@keyframes kbq-progress{0%{background-position:0 0}to{background-position:64px 0}}.kbq-progress{position:relative}.kbq-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,#0000000a 12px,#ffffff1a 12px 22px,#0000000a 22px 34px,#ffffff1a 34px) repeat;background-size:32px 32px;animation:kbq-progress 1s linear infinite}.kbq-group{display:flex;flex-direction:row}.kbq-group .kbq-group_justified>.kbq-group-item{width:100%}.kbq-group .kbq-group-item+.kbq-group-item{margin-left:calc(-1 * var(--kbq-size-border-width))}.kbq-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group{display:flex;flex-direction:column}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group .kbq-group-item+.kbq-group-item{margin-top:calc(-1 * var(--kbq-size-border-width))}.kbq-truncate-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-no-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.kbq-app-switcher-dropdown-site{justify-content:space-between;width:100%;min-height:var(--kbq-size-3xl);text-decoration:none;border-radius:var(--kbq-size-xs);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;display:flex;flex-direction:row;align-items:center;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent;min-height:32px;gap:var(--kbq-size-s);border:var(--kbq-size-3xs) solid transparent;padding:var(--kbq-size-xxs) calc(var(--kbq-size-m) - var(--kbq-size-3xs));padding:var(--kbq-size-xxs) var(--kbq-size-m)}.kbq-app-switcher-dropdown-site .kbq-list-text{display:flex;flex-direction:column;width:100%;box-sizing:content-box;display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-app-switcher-dropdown-site .kbq-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.kbq-app-switcher-dropdown-site .kbq-list-text:empty{display:none}.kbq-app-switcher-dropdown-site .kbq-list-option-caption{padding-top:var(--kbq-size-3xs)}.kbq-app-switcher-dropdown-site .kbq-app-switcher-dropdown-item-trigger__icon,.kbq-app-switcher-dropdown-site .kbq-badge{margin-top:var(--kbq-size-3xs);align-self:flex-start}.kbq-app-switcher-dropdown-site{background:var(--kbq-list-default-container-background);color:var(--kbq-list-default-text-color)}.kbq-app-switcher-dropdown-site.kbq-dropdown-item_highlighted,.kbq-app-switcher-dropdown-site:hover{background:var(--kbq-states-background-transparent-active)}.kbq-app-switcher-dropdown-site.cdk-keyboard-focused{border-color:var(--kbq-list-states-focused-focus-outline-color)}.kbq-app-switcher-dropdown-site{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"] }]
        }], propDecorators: { site: [{
                type: Input,
                args: ['kbq-app-switcher-dropdown-site']
            }] } });

/** @docs-private */
class KbqAppSwitcherListItem extends KbqDropdownItem {
    constructor() {
        super(...arguments);
        this.sanitizer = inject(DomSanitizer);
        this.toggle = false;
        this.collapsed = false;
    }
    clickHandler(event) {
        if (this.toggle) {
            event.stopPropagation();
            event.preventDefault();
            this.collapsed = !this.collapsed;
        }
    }
    getIcon(icon) {
        return this.sanitizer.bypassSecurityTrustHtml(icon || '');
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherListItem, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: KbqAppSwitcherListItem, isStandalone: true, selector: "[kbq-app-switcher-list-item]", inputs: { app: "app", toggle: ["toggle", "toggle", booleanAttribute], collapsed: ["collapsed", "collapsed", booleanAttribute] }, host: { listeners: { "click": "clickHandler($event)" }, properties: { "class.kbq-dropdown-item": "false" }, classAttribute: "kbq-app-switcher-list-item" }, providers: [
            { provide: KBQ_TITLE_TEXT_REF, useExisting: KbqAppSwitcherListItem },
            { provide: KbqDropdownItem, useExisting: KbqAppSwitcherListItem }
        ], exportAs: ["kbqAppSwitcherApp"], usesInheritance: true, ngImport: i0, template: `
        <span class="kbq-app-switcher-list-item__icon" [innerHtml]="getIcon(app.icon)"></span>

        <div class="kbq-app-switcher-list-item__container">
            <div class="kbq-app-switcher-list-item__name">{{ app.name }}</div>
            @if (app.caption) {
                <div class="kbq-app-switcher-list-item__caption">{{ app.caption }}</div>
            }
        </div>

        @if (toggle) {
            <div class="kbq-app-switcher-list-item__toggle" [class.kbq-expanded]="!collapsed">
                <i kbq-icon="kbq-chevron-down-s_16" [color]="'contrast-fade'"></i>
            </div>
        }
    `, isInline: true, styles: ["@keyframes kbq-progress{0%{background-position:0 0}to{background-position:64px 0}}.kbq-progress{position:relative}.kbq-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,#0000000a 12px,#ffffff1a 12px 22px,#0000000a 22px 34px,#ffffff1a 34px) repeat;background-size:32px 32px;animation:kbq-progress 1s linear infinite}.kbq-group{display:flex;flex-direction:row}.kbq-group .kbq-group_justified>.kbq-group-item{width:100%}.kbq-group .kbq-group-item+.kbq-group-item{margin-left:calc(-1 * var(--kbq-size-border-width))}.kbq-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group{display:flex;flex-direction:column}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group .kbq-group-item+.kbq-group-item{margin-top:calc(-1 * var(--kbq-size-border-width))}.kbq-truncate-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-no-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.kbq-app-switcher-list-item{position:relative;display:flex;flex-direction:row;max-width:100%;min-height:38px;border-radius:var(--kbq-size-s);padding:var(--kbq-size-xxs) var(--kbq-size-m) var(--kbq-size-xs) var(--kbq-size-m);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent;cursor:pointer}.kbq-app-switcher-list-item.kbq-app-switcher-site_nested{margin-left:var(--kbq-size-xxl);border-top-left-radius:unset;border-bottom-left-radius:unset}.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:after{content:\"\";position:absolute;left:-1px;top:0;height:100%;border-left-width:1px;border-left-style:solid}.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:has(+:not(.kbq-app-switcher-site_nested)),.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:last-child{border-bottom-left-radius:var(--kbq-size-s)}.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:has(+:not(.kbq-app-switcher-site_nested)):after,.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:last-child:after{top:0;width:var(--kbq-size-m);height:var(--kbq-size-xxl);border-bottom-left-radius:var(--kbq-size-s);border-bottom-width:1px;border-bottom-style:solid}.kbq-app-switcher-list-item__toggle{position:absolute;display:none;align-items:center;justify-content:center;top:var(--kbq-size-m);left:var(--kbq-size-m);width:var(--kbq-size-xxl);height:var(--kbq-size-xxl);border-radius:var(--kbq-size-xxs)}.kbq-app-switcher-list-item__toggle .kbq-icon{transform:rotate(0)}.kbq-app-switcher-list-item__toggle.kbq-expanded .kbq-icon{transform:rotate(180deg)}.kbq-app-switcher-list-item__icon{padding-top:var(--kbq-size-s);padding-right:var(--kbq-size-m)}.kbq-app-switcher-list-item__container{max-width:100%;min-width:0;align-self:center}.kbq-app-switcher-list-item__container .kbq-app-switcher-list-item__name,.kbq-app-switcher-list-item__container .kbq-app-switcher-list-item__caption{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-app-switcher-site_nested:after{border-left-color:var(--kbq-line-contrast-less);border-bottom-color:var(--kbq-line-contrast-less)}.kbq-app-switcher-list-item__caption{color:var(--kbq-foreground-contrast-secondary)}.kbq-app-switcher-list-item{background:var(--kbq-list-default-container-background);color:var(--kbq-list-default-text-color)}.kbq-app-switcher-list-item:hover:has(.kbq-app-switcher-list-item__toggle) .kbq-app-switcher-list-item__icon,.kbq-app-switcher-list-item.kbq-hover:has(.kbq-app-switcher-list-item__toggle) .kbq-app-switcher-list-item__icon,.kbq-app-switcher-list-item.kbq-focused:has(.kbq-app-switcher-list-item__toggle) .kbq-app-switcher-list-item__icon{visibility:hidden}.kbq-app-switcher-list-item:hover .kbq-app-switcher-list-item__toggle,.kbq-app-switcher-list-item.kbq-hover .kbq-app-switcher-list-item__toggle,.kbq-app-switcher-list-item.kbq-focused .kbq-app-switcher-list-item__toggle{display:flex}.kbq-app-switcher-list-item:hover,.kbq-app-switcher-list-item.kbq-hover,.kbq-app-switcher-list-item:hover .kbq-app-switcher-list-item__toggle,.kbq-app-switcher-list-item.kbq-hover .kbq-app-switcher-list-item__toggle{background:var(--kbq-states-background-transparent-hover)}.kbq-app-switcher-list-item:active,.kbq-app-switcher-list-item.kbq-active{background:var(--kbq-states-background-transparent-active)}.kbq-app-switcher-list-item.kbq-selected{background:var(--kbq-background-theme-less)}.kbq-app-switcher-list-item.kbq-selected:hover,.kbq-app-switcher-list-item.kbq-selected.kbq-hover{background:var(--kbq-states-background-theme-less-hover)}.kbq-app-switcher-list-item.kbq-selected:active,.kbq-app-switcher-list-item.kbq-selected.kbq-active{background:var(--kbq-states-background-theme-less-active)}.kbq-app-switcher-list-item.cdk-keyboard-focused{outline:none;border-color:var(--kbq-list-states-focused-focus-outline-color)}.kbq-app-switcher-list-item__name{font-size:var(--kbq-typography-text-normal-medium-font-size);font-style:var(--kbq-typography-text-normal-medium-font-style);font-weight:var(--kbq-typography-text-normal-medium-font-weight);line-height:var(--kbq-typography-text-normal-medium-line-height);font-family:var(--kbq-typography-text-normal-medium-font-family);text-transform:var(--kbq-typography-text-normal-medium-text-transform);font-feature-settings:var(--kbq-typography-text-normal-medium-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-medium-letter-spacing)}.kbq-app-switcher-list-item__caption{font-size:var(--kbq-typography-text-compact-font-size);font-style:var(--kbq-typography-text-compact-font-style);font-weight:var(--kbq-typography-text-compact-font-weight);line-height:var(--kbq-typography-text-compact-line-height);font-family:var(--kbq-typography-text-compact-font-family);text-transform:var(--kbq-typography-text-compact-text-transform);font-feature-settings:var(--kbq-typography-text-compact-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-letter-spacing)}\n"], dependencies: [{ kind: "component", type: KbqIcon, selector: "[kbq-icon]", inputs: ["small", "autoColor", "kbq-icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherListItem, decorators: [{
            type: Component,
            args: [{ standalone: true, selector: '[kbq-app-switcher-list-item]', exportAs: 'kbqAppSwitcherApp', template: `
        <span class="kbq-app-switcher-list-item__icon" [innerHtml]="getIcon(app.icon)"></span>

        <div class="kbq-app-switcher-list-item__container">
            <div class="kbq-app-switcher-list-item__name">{{ app.name }}</div>
            @if (app.caption) {
                <div class="kbq-app-switcher-list-item__caption">{{ app.caption }}</div>
            }
        </div>

        @if (toggle) {
            <div class="kbq-app-switcher-list-item__toggle" [class.kbq-expanded]="!collapsed">
                <i kbq-icon="kbq-chevron-down-s_16" [color]="'contrast-fade'"></i>
            </div>
        }
    `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'kbq-app-switcher-list-item',
                        '[class.kbq-dropdown-item]': 'false',
                        '(click)': 'clickHandler($event)'
                    }, imports: [
                        KbqIcon,
                        NgTemplateOutlet
                    ], providers: [
                        { provide: KBQ_TITLE_TEXT_REF, useExisting: KbqAppSwitcherListItem },
                        { provide: KbqDropdownItem, useExisting: KbqAppSwitcherListItem }
                    ], styles: ["@keyframes kbq-progress{0%{background-position:0 0}to{background-position:64px 0}}.kbq-progress{position:relative}.kbq-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,#0000000a 12px,#ffffff1a 12px 22px,#0000000a 22px 34px,#ffffff1a 34px) repeat;background-size:32px 32px;animation:kbq-progress 1s linear infinite}.kbq-group{display:flex;flex-direction:row}.kbq-group .kbq-group_justified>.kbq-group-item{width:100%}.kbq-group .kbq-group-item+.kbq-group-item{margin-left:calc(-1 * var(--kbq-size-border-width))}.kbq-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group{display:flex;flex-direction:column}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:first-child:not(:last-child)>.kbq-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--kbq-size-border-radius)}.kbq-vertical-group>.kbq-group-item:last-child:not(:first-child)>.kbq-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child){border-radius:0}.kbq-vertical-group>.kbq-group-item:not(:first-child):not(:last-child)>.kbq-form-field__container{border-radius:0}.kbq-vertical-group .kbq-group-item+.kbq-group-item{margin-top:calc(-1 * var(--kbq-size-border-width))}.kbq-truncate-line{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-no-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.kbq-app-switcher-list-item{position:relative;display:flex;flex-direction:row;max-width:100%;min-height:38px;border-radius:var(--kbq-size-s);padding:var(--kbq-size-xxs) var(--kbq-size-m) var(--kbq-size-xs) var(--kbq-size-m);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent;cursor:pointer}.kbq-app-switcher-list-item.kbq-app-switcher-site_nested{margin-left:var(--kbq-size-xxl);border-top-left-radius:unset;border-bottom-left-radius:unset}.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:after{content:\"\";position:absolute;left:-1px;top:0;height:100%;border-left-width:1px;border-left-style:solid}.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:has(+:not(.kbq-app-switcher-site_nested)),.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:last-child{border-bottom-left-radius:var(--kbq-size-s)}.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:has(+:not(.kbq-app-switcher-site_nested)):after,.kbq-app-switcher-list-item.kbq-app-switcher-site_nested:last-child:after{top:0;width:var(--kbq-size-m);height:var(--kbq-size-xxl);border-bottom-left-radius:var(--kbq-size-s);border-bottom-width:1px;border-bottom-style:solid}.kbq-app-switcher-list-item__toggle{position:absolute;display:none;align-items:center;justify-content:center;top:var(--kbq-size-m);left:var(--kbq-size-m);width:var(--kbq-size-xxl);height:var(--kbq-size-xxl);border-radius:var(--kbq-size-xxs)}.kbq-app-switcher-list-item__toggle .kbq-icon{transform:rotate(0)}.kbq-app-switcher-list-item__toggle.kbq-expanded .kbq-icon{transform:rotate(180deg)}.kbq-app-switcher-list-item__icon{padding-top:var(--kbq-size-s);padding-right:var(--kbq-size-m)}.kbq-app-switcher-list-item__container{max-width:100%;min-width:0;align-self:center}.kbq-app-switcher-list-item__container .kbq-app-switcher-list-item__name,.kbq-app-switcher-list-item__container .kbq-app-switcher-list-item__caption{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kbq-app-switcher-site_nested:after{border-left-color:var(--kbq-line-contrast-less);border-bottom-color:var(--kbq-line-contrast-less)}.kbq-app-switcher-list-item__caption{color:var(--kbq-foreground-contrast-secondary)}.kbq-app-switcher-list-item{background:var(--kbq-list-default-container-background);color:var(--kbq-list-default-text-color)}.kbq-app-switcher-list-item:hover:has(.kbq-app-switcher-list-item__toggle) .kbq-app-switcher-list-item__icon,.kbq-app-switcher-list-item.kbq-hover:has(.kbq-app-switcher-list-item__toggle) .kbq-app-switcher-list-item__icon,.kbq-app-switcher-list-item.kbq-focused:has(.kbq-app-switcher-list-item__toggle) .kbq-app-switcher-list-item__icon{visibility:hidden}.kbq-app-switcher-list-item:hover .kbq-app-switcher-list-item__toggle,.kbq-app-switcher-list-item.kbq-hover .kbq-app-switcher-list-item__toggle,.kbq-app-switcher-list-item.kbq-focused .kbq-app-switcher-list-item__toggle{display:flex}.kbq-app-switcher-list-item:hover,.kbq-app-switcher-list-item.kbq-hover,.kbq-app-switcher-list-item:hover .kbq-app-switcher-list-item__toggle,.kbq-app-switcher-list-item.kbq-hover .kbq-app-switcher-list-item__toggle{background:var(--kbq-states-background-transparent-hover)}.kbq-app-switcher-list-item:active,.kbq-app-switcher-list-item.kbq-active{background:var(--kbq-states-background-transparent-active)}.kbq-app-switcher-list-item.kbq-selected{background:var(--kbq-background-theme-less)}.kbq-app-switcher-list-item.kbq-selected:hover,.kbq-app-switcher-list-item.kbq-selected.kbq-hover{background:var(--kbq-states-background-theme-less-hover)}.kbq-app-switcher-list-item.kbq-selected:active,.kbq-app-switcher-list-item.kbq-selected.kbq-active{background:var(--kbq-states-background-theme-less-active)}.kbq-app-switcher-list-item.cdk-keyboard-focused{outline:none;border-color:var(--kbq-list-states-focused-focus-outline-color)}.kbq-app-switcher-list-item__name{font-size:var(--kbq-typography-text-normal-medium-font-size);font-style:var(--kbq-typography-text-normal-medium-font-style);font-weight:var(--kbq-typography-text-normal-medium-font-weight);line-height:var(--kbq-typography-text-normal-medium-line-height);font-family:var(--kbq-typography-text-normal-medium-font-family);text-transform:var(--kbq-typography-text-normal-medium-text-transform);font-feature-settings:var(--kbq-typography-text-normal-medium-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-medium-letter-spacing)}.kbq-app-switcher-list-item__caption{font-size:var(--kbq-typography-text-compact-font-size);font-style:var(--kbq-typography-text-compact-font-style);font-weight:var(--kbq-typography-text-compact-font-weight);line-height:var(--kbq-typography-text-compact-line-height);font-family:var(--kbq-typography-text-compact-font-family);text-transform:var(--kbq-typography-text-compact-text-transform);font-feature-settings:var(--kbq-typography-text-compact-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-letter-spacing)}\n"] }]
        }], propDecorators: { app: [{
                type: Input
            }], toggle: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], collapsed: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }] } });

/** @docs-private */
function defaultGroupBy(app, groups, untyped) {
    if (!app.type) {
        untyped.push(app);
    }
    else {
        const appType = app.type.toString();
        if (groups[appType]) {
            groups[appType].aliases.push(app);
        }
        else {
            groups[appType] = {
                name: appType,
                aliases: [app],
                icon: app.icon,
                id: ''
            };
        }
    }
}
const KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_SEARCH = 7;
const KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING = 3;
/** @docs-private */
const KBQ_APP_SWITCHER_SCROLL_STRATEGY = new InjectionToken('kbq-app-switcher-scroll-strategy');
/** @docs-private */
function kbqAppSwitcherScrollStrategyFactory(overlay) {
    return () => overlay.scrollStrategies.reposition({ scrollThrottle: 20 });
}
/** @docs-private */
const KBQ_APP_SWITCHER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
    provide: KBQ_APP_SWITCHER_SCROLL_STRATEGY,
    deps: [Overlay],
    useFactory: kbqAppSwitcherScrollStrategyFactory
};
/** default configuration of app-switcher */
/** @docs-private */
const KBQ_APP_SWITCHER_DEFAULT_CONFIGURATION = ruRULocaleData.appSwitcher;
/** Injection Token for providing configuration of app-switcher */
/** @docs-private */
const KBQ_APP_SWITCHER_CONFIGURATION = new InjectionToken('KbqAppSwitcherConfiguration');
/** @docs-private */
class KbqAppSwitcherComponent extends KbqPopUp {
    /** localized data
     * @docs-private */
    get localeData() {
        return this.configuration;
    }
    constructor() {
        super();
        /** @docs-private */
        this.localeService = inject(KBQ_LOCALE_SERVICE, { optional: true });
        this.externalConfiguration = inject(KBQ_APP_SWITCHER_CONFIGURATION, { optional: true });
        /** @docs-private */
        this.searchControl = new FormControl('');
        /** @docs-private */
        this.prefix = 'kbq-app-switcher';
        /** @docs-private */
        this.isTrapFocus = false;
        this.updateLocaleParams = () => {
            this.configuration = this.externalConfiguration || this.localeService?.getParams('appSwitcher');
            this.changeDetectorRef.markForCheck();
        };
        this.localeService?.changes.pipe(takeUntilDestroyed()).subscribe(this.updateLocaleParams);
        if (!this.localeService) {
            this.initDefaultParams();
        }
    }
    ngAfterViewInit() {
        if (this.input) {
            this.input.focus();
        }
        this.visibleChange.subscribe((state) => {
            if (this.offset !== null && state) {
                applyPopupMargins(this.renderer, this.elementRef.nativeElement, this.prefix, `${this.offset.toString()}px`);
            }
        });
        this.searchControl.valueChanges.subscribe((value) => (this.filteredSites = this.filterSites(value)));
    }
    /** @docs-private */
    updateClassMap(placement, customClass, size) {
        super.updateClassMap(placement, customClass, { [`${this.prefix}_${size}`]: !!size });
    }
    /** @docs-private */
    updateTrapFocus(isTrapFocus) {
        this.isTrapFocus = isTrapFocus;
    }
    /** @docs-private */
    escapeHandler() {
        this.hide(0);
    }
    /** @docs-private */
    selectAppInSite(site, app) {
        this.trigger.selectedSite = site;
        this.trigger.selectedApp = app;
        this.trigger.selectedSiteChange.emit(site);
        this.trigger.selectedAppChange.emit(app);
    }
    filterSites(query) {
        const filteredSites = structuredClone(this.trigger.originalSites);
        return query
            ? filteredSites.filter((site) => {
                const filteredApps = site.apps.filter((app) => app.name.toLowerCase().includes(query.toLowerCase()));
                if (filteredApps.length) {
                    site.apps = filteredApps;
                    return true;
                }
                return false;
            })
            : filteredSites;
    }
    initDefaultParams() {
        this.configuration = KBQ_APP_SWITCHER_DEFAULT_CONFIGURATION;
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: KbqAppSwitcherComponent, isStandalone: true, selector: "kbq-app-switcher", host: { classAttribute: "kbq-app-switcher" }, viewQueries: [{ propertyName: "input", first: true, predicate: KbqInput, descendants: true }, { propertyName: "otherSites", first: true, predicate: ["otherSites"], descendants: true }], usesInheritance: true, ngImport: i0, template: "@if (trigger.withSearch) {\n    <div class=\"kbq-app-switcher__search-container\" (mouseenter)=\"otherSites?.close()\">\n        <kbq-form-field noBorders>\n            <i kbq-icon=\"kbq-magnifying-glass_16\" kbqPrefix></i>\n            <input\n                autocomplete=\"off\"\n                kbqInput\n                placeholder=\"{{ localeData.searchPlaceholder }}\"\n                [formControl]=\"searchControl\"\n                (keydown.escape)=\"escapeHandler()\"\n            />\n            <kbq-cleaner />\n        </kbq-form-field>\n    </div>\n\n    <kbq-divider />\n}\n\n<div kbq-scrollbar>\n    @if (!searchControl.getRawValue()) {\n        <div class=\"kbq-app-switcher__app-container\" (mouseenter)=\"otherSites?.close()\">\n            @if (trigger.sitesMode) {\n                <div class=\"kbq-app-switcher-group-header\">\n                    <div class=\"kbq-app-switcher-group-header__text\">{{ trigger.selectedSite?.name }}</div>\n                    @if (trigger.selectedSite?.status) {\n                        <kbq-badge class=\"kbq-app-switcher-group-header__badge\" [compact]=\"true\">\n                            {{ trigger.selectedSite.status }}\n                        </kbq-badge>\n                    }\n                </div>\n            }\n\n            <kbq-dropdown [class]=\"'kbq-app-switcher-sites'\">\n                <div kbqDropdownStaticContent class=\"kbq-app-switcher-site\">\n                    @for (app of trigger.currentApps; track app) {\n                        @if (!app.aliases) {\n                            <a\n                                kbq-app-switcher-list-item\n                                href=\"{{ app.link }}\"\n                                [class.kbq-selected]=\"app.id === trigger.selectedApp?.id\"\n                                [app]=\"app\"\n                                [toggle]=\"!!app.aliases\"\n                            ></a>\n                        } @else {\n                            <div\n                                #appSwitcherApp=\"kbqAppSwitcherApp\"\n                                kbq-app-switcher-list-item\n                                [app]=\"app\"\n                                [toggle]=\"!!app.aliases\"\n                            ></div>\n\n                            @if (!appSwitcherApp.collapsed) {\n                                @for (alias of app.aliases; track alias) {\n                                    <a\n                                        class=\"kbq-app-switcher-site_nested\"\n                                        kbq-app-switcher-list-item\n                                        href=\"{{ alias.link }}\"\n                                        [class.kbq-selected]=\"alias.id === trigger.selectedApp?.id\"\n                                        [app]=\"alias\"\n                                    ></a>\n                                }\n                            }\n                        }\n                    }\n                </div>\n            </kbq-dropdown>\n        </div>\n\n        @if (trigger.sitesMode) {\n            <kbq-divider />\n\n            <div class=\"kbq-app-switcher__sites-container\">\n                <div class=\"kbq-app-switcher-group-header\">\n                    <div class=\"kbq-app-switcher-group-header__text\">{{ localeData.sitesHeader }}</div>\n                </div>\n\n                <kbq-dropdown #otherSites=\"kbqDropdown\">\n                    <div kbqDropdownStaticContent class=\"kbq-app-switcher-sites\">\n                        @for (site of trigger.sites; track site) {\n                            @if (site.id !== trigger.selectedSite?.id) {\n                                <div\n                                    [kbq-app-switcher-dropdown-site]=\"site\"\n                                    [kbqDropdownTriggerFor]=\"dropdownWithSelectedSite\"\n                                    [offsetX]=\"0\"\n                                    (mouseenter)=\"activeSite = site\"\n                                ></div>\n                            }\n                        }\n                    </div>\n                </kbq-dropdown>\n            </div>\n\n            <kbq-dropdown #dropdownWithSelectedSite=\"kbqDropdown\" [class]=\"'kbq-app-switcher-sites'\">\n                @for (app of activeSite?.apps; track app) {\n                    @if (app.aliases) {\n                        <div\n                            #dropdownWithGroupedAppsTrigger=\"kbqDropdownTrigger\"\n                            [kbq-app-switcher-dropdown-app]=\"app\"\n                            [kbqDropdownTriggerFor]=\"dropdownWithGroupedApps\"\n                            [offsetX]=\"0\"\n                            [class.kbq-pressed]=\"dropdownWithGroupedAppsTrigger.opened\"\n                            (mouseenter)=\"activeApp = app\"\n                        ></div>\n                    } @else {\n                        <a\n                            href=\"{{ app.link }}\"\n                            [kbq-app-switcher-dropdown-app]=\"app\"\n                            (click)=\"selectAppInSite(activeSite, app)\"\n                        ></a>\n                    }\n                }\n            </kbq-dropdown>\n\n            <kbq-dropdown #dropdownWithGroupedApps=\"kbqDropdown\" [class]=\"'kbq-app-switcher-sites'\">\n                @for (alias of activeApp?.aliases; track alias) {\n                    <a\n                        href=\"{{ alias.link }}\"\n                        [kbq-app-switcher-dropdown-app]=\"alias\"\n                        (click)=\"selectAppInSite(activeSite, alias)\"\n                    ></a>\n                }\n            </kbq-dropdown>\n        }\n    } @else {\n        <div class=\"kbq-app-switcher__search-result\">\n            <kbq-dropdown [class]=\"'kbq-app-switcher-sites'\">\n                <div kbqDropdownStaticContent class=\"kbq-app-switcher-site\">\n                    @for (site of filteredSites; track site) {\n                        @if (site.apps) {\n                            <kbq-optgroup label=\"{{ site.name }}\" />\n                        }\n\n                        @for (app of site.apps; track app) {\n                            <a kbq-app-switcher-list-item href=\"{{ app.link }}\" [app]=\"app\"></a>\n                        }\n                    } @empty {\n                        <div class=\"kbq-app-switcher__empty-search-result\">{{ localeData.searchEmptyResult }}</div>\n                    }\n                </div>\n            </kbq-dropdown>\n        </div>\n    }\n</div>\n", styles: [".kbq-app-switcher{position:relative;display:flex;flex-direction:column;margin-top:var(--kbq-size-xxs);margin-bottom:var(--kbq-size-xxs);width:320px;border-radius:var(--kbq-size-xs);box-shadow:var(--kbq-shadow-popup);box-sizing:border-box;z-index:1}.kbq-app-switcher__search-container{padding-top:var(--kbq-size-xxs)}.kbq-app-switcher__search-result{max-width:320px;min-height:0;padding:var(--kbq-size-s) var(--kbq-size-xxs)}.kbq-app-switcher__empty-search-result{display:flex;justify-content:center;align-items:center;height:96px}.kbq-app-switcher__app-container{display:flex;flex-direction:column;min-height:0;padding:var(--kbq-size-s) var(--kbq-size-xxs)}.kbq-app-switcher-group-header{padding:var(--kbq-size-s) var(--kbq-size-m);display:flex;flex-direction:row;justify-content:space-between}.kbq-app-switcher__sites-container{padding:var(--kbq-size-xxs)}.kbq-app-switcher{background:var(--kbq-background-card)}.kbq-app-switcher .kbq-app-switcher-group-header,.kbq-app-switcher__empty-search-result{color:var(--kbq-foreground-contrast-secondary)}.kbq-app-switcher,.kbq-app-switcher__empty-search-result{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)}.kbq-app-switcher-group-header__text{font-size:var(--kbq-typography-caps-compact-strong-font-size);font-style:var(--kbq-typography-caps-compact-strong-font-style);font-weight:var(--kbq-typography-caps-compact-strong-font-weight);line-height:var(--kbq-typography-caps-compact-strong-line-height);font-family:var(--kbq-typography-caps-compact-strong-font-family);text-transform:var(--kbq-typography-caps-compact-strong-text-transform);font-feature-settings:var(--kbq-typography-caps-compact-strong-font-feature-settings);letter-spacing:var(--kbq-typography-caps-compact-strong-letter-spacing)}.kbq-app-switcher-group-header__badge{font-size:var(--kbq-typography-text-compact-medium-font-size);font-style:var(--kbq-typography-text-compact-medium-font-style);font-weight:var(--kbq-typography-text-compact-medium-font-weight);line-height:var(--kbq-typography-text-compact-medium-line-height);font-family:var(--kbq-typography-text-compact-medium-font-family);text-transform:var(--kbq-typography-text-compact-medium-text-transform);font-feature-settings:var(--kbq-typography-text-compact-medium-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-medium-letter-spacing)}.kbq-app-switch-tree-option__text{font-size:var(--kbq-typography-text-normal-medium-font-size);font-style:var(--kbq-typography-text-normal-medium-font-style);font-weight:var(--kbq-typography-text-normal-medium-font-weight);line-height:var(--kbq-typography-text-normal-medium-line-height);font-family:var(--kbq-typography-text-normal-medium-font-family);text-transform:var(--kbq-typography-text-normal-medium-text-transform);font-feature-settings:var(--kbq-typography-text-normal-medium-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-medium-letter-spacing)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: KbqFormFieldModule }, { kind: "component", type: i2.KbqCleaner, selector: "kbq-cleaner", exportAs: ["kbqCleaner"] }, { kind: "component", type: i2.KbqFormField, selector: "kbq-form-field", inputs: ["noBorders"], exportAs: ["kbqFormField"] }, { kind: "directive", type: i2.KbqPrefix, selector: "[kbqPrefix]", exportAs: ["kbqPrefix"] }, { kind: "directive", type: i2.KbqValidateDirective, selector: "        input[kbqInput],        input[kbqNumberInput],        input[kbqInputPassword],        input[kbqTimepicker],        input[kbqDatepicker],        textarea[kbqTextarea],        kbq-select,        kbq-tree-select,        kbq-tag-list    ", exportAs: ["KbqValidate"] }, { kind: "directive", type: i2.KbqTrim, selector: "[kbqInput], [kbqTextarea]", exportAs: ["KbqTrim"] }, { kind: "ngmodule", type: KbqInputModule }, { kind: "directive", type: i3.KbqInput, selector: "input[kbqInput],input[kbqNumberInput]", inputs: ["errorStateMatcher", "placeholder", "disabled", "id", "required", "type", "value"], exportAs: ["kbqInput"] }, { kind: "ngmodule", type: KbqIconModule }, { kind: "component", type: i4.KbqIcon, selector: "[kbq-icon]", inputs: ["small", "autoColor", "kbq-icon"] }, { kind: "ngmodule", type: KbqDividerModule }, { kind: "component", type: i5.KbqDivider, selector: "kbq-divider", inputs: ["vertical", "inset", "paddings"] }, { kind: "ngmodule", type: KbqBadgeModule }, { kind: "component", type: i1.KbqBadge, selector: "kbq-badge", inputs: ["compact", "outline", "badgeColor"] }, { kind: "directive", type: i1.KbqBadgeCssStyler, selector: "kbq-badge" }, { kind: "ngmodule", type: KbqDropdownModule }, { kind: "component", type: i7.KbqDropdown, selector: "kbq-dropdown", inputs: ["navigationWithWrap", "xPosition", "yPosition", "overlapTriggerY", "overlapTriggerX", "hasBackdrop", "class", "backdropClass"], outputs: ["closed"], exportAs: ["kbqDropdown"] }, { kind: "directive", type: i7.KbqDropdownTrigger, selector: "[kbqDropdownTriggerFor]", inputs: ["offsetX", "offsetY", "kbqDropdownTriggerData", "openByArrowDown", "kbqDropdownTriggerRestoreFocus", "kbqDropdownTriggerFor"], outputs: ["dropdownOpened", "dropdownClosed"], exportAs: ["kbqDropdownTrigger"] }, { kind: "directive", type: i7.KbqDropdownStaticContent, selector: "[kbqDropdownStaticContent]" }, { kind: "ngmodule", type: KbqScrollbarModule }, { kind: "component", type: i8.KbqScrollbar, selector: "kbq-scrollbar, [kbq-scrollbar]", inputs: ["initializationTarget", "options", "events", "defer"], outputs: ["onInitialize", "onUpdate", "onDestroy", "onScroll"], exportAs: ["kbqScrollbar"] }, { kind: "ngmodule", type: KbqOptionModule }, { kind: "component", type: i9.KbqOptgroup, selector: "kbq-optgroup", inputs: ["label", "disabled"], exportAs: ["kbqOptgroup"] }, { kind: "component", type: KbqAppSwitcherDropdownApp, selector: "[kbq-app-switcher-dropdown-app]", inputs: ["kbq-app-switcher-dropdown-app"], exportAs: ["kbqAppSwitcherDropdownApp"] }, { kind: "component", type: KbqAppSwitcherDropdownSite, selector: "[kbq-app-switcher-dropdown-site]", inputs: ["kbq-app-switcher-dropdown-site"], exportAs: ["kbqAppSwitcherDropdownSite"] }, { kind: "component", type: KbqAppSwitcherListItem, selector: "[kbq-app-switcher-list-item]", inputs: ["app", "toggle", "collapsed"], exportAs: ["kbqAppSwitcherApp"] }], animations: [kbqAppSwitcherAnimations.state], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherComponent, decorators: [{
            type: Component,
            args: [{ standalone: true, selector: 'kbq-app-switcher', preserveWhitespaces: false, host: {
                        class: 'kbq-app-switcher'
                    }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
                        AsyncPipe,
                        FormsModule,
                        ReactiveFormsModule,
                        KbqFormFieldModule,
                        KbqInputModule,
                        KbqIconModule,
                        KbqDividerModule,
                        KbqBadgeModule,
                        KbqDropdownModule,
                        KbqScrollbarModule,
                        KbqOptionModule,
                        KbqAppSwitcherDropdownApp,
                        KbqAppSwitcherDropdownSite,
                        KbqAppSwitcherListItem,
                        JsonPipe
                    ], animations: [kbqAppSwitcherAnimations.state], template: "@if (trigger.withSearch) {\n    <div class=\"kbq-app-switcher__search-container\" (mouseenter)=\"otherSites?.close()\">\n        <kbq-form-field noBorders>\n            <i kbq-icon=\"kbq-magnifying-glass_16\" kbqPrefix></i>\n            <input\n                autocomplete=\"off\"\n                kbqInput\n                placeholder=\"{{ localeData.searchPlaceholder }}\"\n                [formControl]=\"searchControl\"\n                (keydown.escape)=\"escapeHandler()\"\n            />\n            <kbq-cleaner />\n        </kbq-form-field>\n    </div>\n\n    <kbq-divider />\n}\n\n<div kbq-scrollbar>\n    @if (!searchControl.getRawValue()) {\n        <div class=\"kbq-app-switcher__app-container\" (mouseenter)=\"otherSites?.close()\">\n            @if (trigger.sitesMode) {\n                <div class=\"kbq-app-switcher-group-header\">\n                    <div class=\"kbq-app-switcher-group-header__text\">{{ trigger.selectedSite?.name }}</div>\n                    @if (trigger.selectedSite?.status) {\n                        <kbq-badge class=\"kbq-app-switcher-group-header__badge\" [compact]=\"true\">\n                            {{ trigger.selectedSite.status }}\n                        </kbq-badge>\n                    }\n                </div>\n            }\n\n            <kbq-dropdown [class]=\"'kbq-app-switcher-sites'\">\n                <div kbqDropdownStaticContent class=\"kbq-app-switcher-site\">\n                    @for (app of trigger.currentApps; track app) {\n                        @if (!app.aliases) {\n                            <a\n                                kbq-app-switcher-list-item\n                                href=\"{{ app.link }}\"\n                                [class.kbq-selected]=\"app.id === trigger.selectedApp?.id\"\n                                [app]=\"app\"\n                                [toggle]=\"!!app.aliases\"\n                            ></a>\n                        } @else {\n                            <div\n                                #appSwitcherApp=\"kbqAppSwitcherApp\"\n                                kbq-app-switcher-list-item\n                                [app]=\"app\"\n                                [toggle]=\"!!app.aliases\"\n                            ></div>\n\n                            @if (!appSwitcherApp.collapsed) {\n                                @for (alias of app.aliases; track alias) {\n                                    <a\n                                        class=\"kbq-app-switcher-site_nested\"\n                                        kbq-app-switcher-list-item\n                                        href=\"{{ alias.link }}\"\n                                        [class.kbq-selected]=\"alias.id === trigger.selectedApp?.id\"\n                                        [app]=\"alias\"\n                                    ></a>\n                                }\n                            }\n                        }\n                    }\n                </div>\n            </kbq-dropdown>\n        </div>\n\n        @if (trigger.sitesMode) {\n            <kbq-divider />\n\n            <div class=\"kbq-app-switcher__sites-container\">\n                <div class=\"kbq-app-switcher-group-header\">\n                    <div class=\"kbq-app-switcher-group-header__text\">{{ localeData.sitesHeader }}</div>\n                </div>\n\n                <kbq-dropdown #otherSites=\"kbqDropdown\">\n                    <div kbqDropdownStaticContent class=\"kbq-app-switcher-sites\">\n                        @for (site of trigger.sites; track site) {\n                            @if (site.id !== trigger.selectedSite?.id) {\n                                <div\n                                    [kbq-app-switcher-dropdown-site]=\"site\"\n                                    [kbqDropdownTriggerFor]=\"dropdownWithSelectedSite\"\n                                    [offsetX]=\"0\"\n                                    (mouseenter)=\"activeSite = site\"\n                                ></div>\n                            }\n                        }\n                    </div>\n                </kbq-dropdown>\n            </div>\n\n            <kbq-dropdown #dropdownWithSelectedSite=\"kbqDropdown\" [class]=\"'kbq-app-switcher-sites'\">\n                @for (app of activeSite?.apps; track app) {\n                    @if (app.aliases) {\n                        <div\n                            #dropdownWithGroupedAppsTrigger=\"kbqDropdownTrigger\"\n                            [kbq-app-switcher-dropdown-app]=\"app\"\n                            [kbqDropdownTriggerFor]=\"dropdownWithGroupedApps\"\n                            [offsetX]=\"0\"\n                            [class.kbq-pressed]=\"dropdownWithGroupedAppsTrigger.opened\"\n                            (mouseenter)=\"activeApp = app\"\n                        ></div>\n                    } @else {\n                        <a\n                            href=\"{{ app.link }}\"\n                            [kbq-app-switcher-dropdown-app]=\"app\"\n                            (click)=\"selectAppInSite(activeSite, app)\"\n                        ></a>\n                    }\n                }\n            </kbq-dropdown>\n\n            <kbq-dropdown #dropdownWithGroupedApps=\"kbqDropdown\" [class]=\"'kbq-app-switcher-sites'\">\n                @for (alias of activeApp?.aliases; track alias) {\n                    <a\n                        href=\"{{ alias.link }}\"\n                        [kbq-app-switcher-dropdown-app]=\"alias\"\n                        (click)=\"selectAppInSite(activeSite, alias)\"\n                    ></a>\n                }\n            </kbq-dropdown>\n        }\n    } @else {\n        <div class=\"kbq-app-switcher__search-result\">\n            <kbq-dropdown [class]=\"'kbq-app-switcher-sites'\">\n                <div kbqDropdownStaticContent class=\"kbq-app-switcher-site\">\n                    @for (site of filteredSites; track site) {\n                        @if (site.apps) {\n                            <kbq-optgroup label=\"{{ site.name }}\" />\n                        }\n\n                        @for (app of site.apps; track app) {\n                            <a kbq-app-switcher-list-item href=\"{{ app.link }}\" [app]=\"app\"></a>\n                        }\n                    } @empty {\n                        <div class=\"kbq-app-switcher__empty-search-result\">{{ localeData.searchEmptyResult }}</div>\n                    }\n                </div>\n            </kbq-dropdown>\n        </div>\n    }\n</div>\n", styles: [".kbq-app-switcher{position:relative;display:flex;flex-direction:column;margin-top:var(--kbq-size-xxs);margin-bottom:var(--kbq-size-xxs);width:320px;border-radius:var(--kbq-size-xs);box-shadow:var(--kbq-shadow-popup);box-sizing:border-box;z-index:1}.kbq-app-switcher__search-container{padding-top:var(--kbq-size-xxs)}.kbq-app-switcher__search-result{max-width:320px;min-height:0;padding:var(--kbq-size-s) var(--kbq-size-xxs)}.kbq-app-switcher__empty-search-result{display:flex;justify-content:center;align-items:center;height:96px}.kbq-app-switcher__app-container{display:flex;flex-direction:column;min-height:0;padding:var(--kbq-size-s) var(--kbq-size-xxs)}.kbq-app-switcher-group-header{padding:var(--kbq-size-s) var(--kbq-size-m);display:flex;flex-direction:row;justify-content:space-between}.kbq-app-switcher__sites-container{padding:var(--kbq-size-xxs)}.kbq-app-switcher{background:var(--kbq-background-card)}.kbq-app-switcher .kbq-app-switcher-group-header,.kbq-app-switcher__empty-search-result{color:var(--kbq-foreground-contrast-secondary)}.kbq-app-switcher,.kbq-app-switcher__empty-search-result{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)}.kbq-app-switcher-group-header__text{font-size:var(--kbq-typography-caps-compact-strong-font-size);font-style:var(--kbq-typography-caps-compact-strong-font-style);font-weight:var(--kbq-typography-caps-compact-strong-font-weight);line-height:var(--kbq-typography-caps-compact-strong-line-height);font-family:var(--kbq-typography-caps-compact-strong-font-family);text-transform:var(--kbq-typography-caps-compact-strong-text-transform);font-feature-settings:var(--kbq-typography-caps-compact-strong-font-feature-settings);letter-spacing:var(--kbq-typography-caps-compact-strong-letter-spacing)}.kbq-app-switcher-group-header__badge{font-size:var(--kbq-typography-text-compact-medium-font-size);font-style:var(--kbq-typography-text-compact-medium-font-style);font-weight:var(--kbq-typography-text-compact-medium-font-weight);line-height:var(--kbq-typography-text-compact-medium-line-height);font-family:var(--kbq-typography-text-compact-medium-font-family);text-transform:var(--kbq-typography-text-compact-medium-text-transform);font-feature-settings:var(--kbq-typography-text-compact-medium-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-medium-letter-spacing)}.kbq-app-switch-tree-option__text{font-size:var(--kbq-typography-text-normal-medium-font-size);font-style:var(--kbq-typography-text-normal-medium-font-style);font-weight:var(--kbq-typography-text-normal-medium-font-weight);line-height:var(--kbq-typography-text-normal-medium-line-height);font-family:var(--kbq-typography-text-normal-medium-font-family);text-transform:var(--kbq-typography-text-normal-medium-text-transform);font-feature-settings:var(--kbq-typography-text-normal-medium-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-medium-letter-spacing)}\n"] }]
        }], ctorParameters: () => [], propDecorators: { input: [{
                type: ViewChild,
                args: [KbqInput]
            }], otherSites: [{
                type: ViewChild,
                args: ['otherSites']
            }] } });
class KbqAppSwitcherTrigger extends KbqPopUpTrigger {
    constructor() {
        super(...arguments);
        /** @docs-private */
        this.scrollStrategy = inject(KBQ_APP_SWITCHER_SCROLL_STRATEGY);
        // not used
        /** @docs-private */
        this.arrow = false;
        /** @docs-private */
        this.hasBackdrop = false;
        /** @docs-private */
        this.size = PopUpSizes.Medium;
        /** Placement of popUp */
        this.placement = PopUpPlacements.BottomLeft;
        /** Class that will be used in the background */
        this.backdropClass = 'cdk-overlay-transparent-backdrop';
        /** Offset of popUp */
        this.offset = defaultOffsetYWithArrow;
        this._groupBy = defaultGroupBy;
        /** Emits a change event whenever the placement state changes. */
        this.placementChange = new EventEmitter();
        /** Emits a change event whenever the visible state changes. */
        this.visibleChange = new EventEmitter();
        /** @docs-private */
        this.selectedSiteChange = new EventEmitter();
        /** @docs-private */
        this.selectedAppChange = new EventEmitter();
        /** @docs-private */
        this.trigger = `${PopUpTriggers.Click}, ${PopUpTriggers.Keydown}`;
        /** @docs-private */
        this.originSelector = '.kbq-app-switcher';
        this.hideIfNotInViewPort = () => {
            if (!this.scrollable)
                return;
            const rect = this.elementRef.nativeElement.getBoundingClientRect();
            const containerRect = this.scrollable.getElementRef().nativeElement.getBoundingClientRect();
            if (!(rect.bottom >= containerRect.top &&
                rect.right >= containerRect.left &&
                rect.top <= containerRect.bottom &&
                rect.left <= containerRect.right)) {
                this.hide();
            }
        };
    }
    /** Whether search is used or not */
    get withSearch() {
        return this.appsCount > KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_SEARCH;
    }
    /** Number of applications to choose from
     * @docs-private */
    get appsCount() {
        if (this.sitesMode) {
            return this.originalSites.reduce((acc, site) => acc + site.apps.length, 0);
        }
        return this.originalApps.length;
    }
    /** Whether the sites are used or not
     * @docs-private */
    get sitesMode() {
        return this.originalSites?.length > 0;
    }
    /** Whether the sites are used or not
     * @docs-private */
    get currentApps() {
        return this.sitesMode ? this.selectedSite.apps : this._parsedApps;
    }
    /** Array of sites */
    get sites() {
        return this._parsedSites;
    }
    set sites(value) {
        this.originalSites = value;
        this._parsedSites = [];
        value.forEach((site) => {
            const newSite = { ...site, apps: [] };
            newSite.apps = this.makeGroupsForApps(site.apps, KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING);
            this._parsedSites.push(newSite);
        });
    }
    /** Array of applications */
    get apps() {
        return this._parsedApps;
    }
    set apps(apps) {
        this.originalApps = apps;
        this._parsedApps = this.makeGroupsForApps(this.originalApps, KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING);
    }
    makeGroupsForApps(apps, minAppsForGrouping) {
        const groups = {};
        const untyped = [];
        const groupedApps = [];
        apps.forEach((app) => {
            this.groupBy(app, groups, untyped);
        });
        Object.values(groups).forEach((group) => {
            if (group.aliases && group.aliases.length > minAppsForGrouping) {
                groupedApps.push(group);
            }
            else {
                untyped.push(...group.aliases);
            }
        });
        groupedApps.push(...untyped);
        return groupedApps;
    }
    /** Function to group the apps by type. The first argument is an app object with type.
     * The second is a groups object and third is an array for untyped apps */
    get groupBy() {
        return this._groupBy;
    }
    set groupBy(fn) {
        if (typeof fn !== 'function') {
            throw new Error('The argument must be a function');
        }
        this._groupBy = fn;
    }
    /** Selected site */
    get selectedSite() {
        return this._parsedSelectedSite;
    }
    set selectedSite(value) {
        const originValue = this.originalSites.find((site) => value.id === site.id);
        const newSite = { ...originValue, apps: [] };
        newSite.apps = this.makeGroupsForApps(originValue.apps, KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING);
        this._parsedSelectedSite = newSite;
    }
    /** Whether the trigger is disabled. */
    get disabled() {
        return this._disabled;
    }
    set disabled(value) {
        this._disabled = coerceBooleanProperty(value);
        if (this._disabled) {
            this.hide();
        }
    }
    /** @docs-private */
    get hasClickTrigger() {
        return this.trigger.includes(PopUpTriggers.Click);
    }
    /** @docs-private */
    get overlayConfig() {
        return {
            panelClass: 'kbq-app-switcher__panel',
            hasBackdrop: this.hasBackdrop,
            backdropClass: this.backdropClass
        };
    }
    ngOnInit() {
        super.ngOnInit();
        this.scrollable
            ?.elementScrolled()
            .pipe(takeUntilDestroyed(this.destroyRef))
            .subscribe(this.hideIfNotInViewPort);
    }
    ngAfterContentInit() {
        if (this.closeOnScroll === null) {
            this.scrollDispatcher.scrolled().subscribe((scrollable) => {
                if (!scrollable?.getElementRef().nativeElement.classList.contains('kbq-hide-nested-popup'))
                    return;
                const parentRects = scrollable.getElementRef().nativeElement.getBoundingClientRect();
                const childRects = this.elementRef.nativeElement.getBoundingClientRect();
                if (childRects.bottom < parentRects.top || childRects.top > parentRects.bottom) {
                    this.hide();
                }
            });
        }
        this.visibleChange.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((visible) => {
            if (visible) {
                // eslint-disable-next-line rxjs/no-nested-subscribe
                this.preventClosingByInnerScrollSubscription = this.closingActions().subscribe((event) => {
                    if (event['scrollDispatcher']) {
                        event['kbqPopoverPreventHide'] = true;
                        event['type'] = 'click';
                    }
                });
            }
            else {
                this.preventClosingByInnerScrollSubscription.unsubscribe();
                this.focus();
            }
        });
    }
    /** @docs-private */
    updateData() {
        if (!this.instance)
            return;
        this.instance.header = this.header;
        this.instance.content = this.content;
        this.instance.arrow = this.arrow;
        this.instance.offset = this.offset;
        this.instance.footer = this.footer;
        this.instance.updateTrapFocus(this.trigger !== PopUpTriggers.Focus);
        if (this.isOpen) {
            this.updatePosition(true);
        }
    }
    /** Updates the current position.
     * @docs-private */
    updatePosition(reapplyPosition = false) {
        this.overlayRef = this.createOverlay();
        const position = this.overlayRef.getConfig().positionStrategy
            .withPositions(this.getAdjustedPositions())
            .withPush(true);
        if (reapplyPosition) {
            setTimeout(() => position.reapplyLastPosition());
        }
    }
    /** @docs-private */
    getOverlayHandleComponentType() {
        return KbqAppSwitcherComponent;
    }
    /** @docs-private */
    updateClassMap(newPlacement = this.placement) {
        if (!this.instance)
            return;
        this.instance.updateClassMap(POSITION_TO_CSS_MAP[newPlacement], this.customClass, this.size);
        this.instance.markForCheck();
    }
    /** @docs-private */
    closingActions() {
        return merge(this.overlayRef.outsidePointerEvents(), this.overlayRef.backdropClick(), this.scrollDispatcher.scrolled());
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherTrigger, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.2.14", type: KbqAppSwitcherTrigger, isStandalone: true, selector: "[kbqAppSwitcher]", inputs: { selectedApp: "selectedApp", placement: ["kbqAppSwitcherPlacement", "placement"], backdropClass: "backdropClass", offset: ["offset", "offset", numberAttribute], sites: "sites", apps: "apps", groupBy: "groupBy", selectedSite: "selectedSite", disabled: ["disabled", "disabled", booleanAttribute] }, outputs: { placementChange: "kbqPlacementChange", visibleChange: "kbqVisibleChange", selectedSiteChange: "selectedSiteChange", selectedAppChange: "selectedAppChange" }, host: { listeners: { "keydown": "keydownHandler($event)", "touchend": "touchendHandler()" }, properties: { "class.kbq-app-switcher_open": "isOpen", "class.kbq-active": "hasClickTrigger && isOpen" } }, exportAs: ["kbqAppSwitcher"], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherTrigger, decorators: [{
            type: Directive,
            args: [{
                    standalone: true,
                    selector: '[kbqAppSwitcher]',
                    exportAs: 'kbqAppSwitcher',
                    host: {
                        '[class.kbq-app-switcher_open]': 'isOpen',
                        '[class.kbq-active]': 'hasClickTrigger && isOpen',
                        '(keydown)': 'keydownHandler($event)',
                        '(touchend)': 'touchendHandler()'
                    }
                }]
        }], propDecorators: { selectedApp: [{
                type: Input
            }], placement: [{
                type: Input,
                args: ['kbqAppSwitcherPlacement']
            }], backdropClass: [{
                type: Input
            }], offset: [{
                type: Input,
                args: [{ transform: numberAttribute }]
            }], sites: [{
                type: Input
            }], apps: [{
                type: Input
            }], groupBy: [{
                type: Input
            }], selectedSite: [{
                type: Input
            }], disabled: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], placementChange: [{
                type: Output,
                args: ['kbqPlacementChange']
            }], visibleChange: [{
                type: Output,
                args: ['kbqVisibleChange']
            }], selectedSiteChange: [{
                type: Output
            }], selectedAppChange: [{
                type: Output
            }] } });

class KbqAppSwitcherModule {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherModule, imports: [KbqAppSwitcherComponent,
            KbqAppSwitcherTrigger,
            KbqAppSwitcherListItem,
            KbqAppSwitcherDropdownApp,
            KbqAppSwitcherDropdownSite], exports: [KbqAppSwitcherTrigger] }); }
    /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherModule, providers: [
            KBQ_APP_SWITCHER_SCROLL_STRATEGY_FACTORY_PROVIDER,
            { provide: FocusTrapFactory, useClass: ConfigurableFocusTrapFactory },
            { provide: FOCUS_TRAP_INERT_STRATEGY, useClass: EmptyFocusTrapStrategy }
        ], imports: [KbqAppSwitcherComponent,
            KbqAppSwitcherListItem,
            KbqAppSwitcherDropdownApp,
            KbqAppSwitcherDropdownSite] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqAppSwitcherModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        KbqAppSwitcherComponent,
                        KbqAppSwitcherTrigger,
                        KbqAppSwitcherListItem,
                        KbqAppSwitcherDropdownApp,
                        KbqAppSwitcherDropdownSite
                    ],
                    exports: [
                        KbqAppSwitcherTrigger
                    ],
                    providers: [
                        KBQ_APP_SWITCHER_SCROLL_STRATEGY_FACTORY_PROVIDER,
                        { provide: FocusTrapFactory, useClass: ConfigurableFocusTrapFactory },
                        { provide: FOCUS_TRAP_INERT_STRATEGY, useClass: EmptyFocusTrapStrategy }
                    ]
                }]
        }] });

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

export { KBQ_APP_SWITCHER_CONFIGURATION, KBQ_APP_SWITCHER_DEFAULT_CONFIGURATION, KBQ_APP_SWITCHER_SCROLL_STRATEGY, KBQ_APP_SWITCHER_SCROLL_STRATEGY_FACTORY_PROVIDER, KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_GROUPING, KBQ_MIN_NUMBER_OF_APPS_TO_ENABLE_SEARCH, KbqAppSwitcherComponent, KbqAppSwitcherDropdownApp, KbqAppSwitcherDropdownSite, KbqAppSwitcherListItem, KbqAppSwitcherModule, KbqAppSwitcherTrigger, defaultGroupBy, kbqAppSwitcherAnimations, kbqAppSwitcherScrollStrategyFactory };
//# sourceMappingURL=koobiq-components-app-switcher.mjs.map
