import * as i0 from '@angular/core';
import { inject, ElementRef, ChangeDetectorRef, Component, ViewEncapsulation, Input, NgModule } from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { startWith, debounceTime } from 'rxjs/operators';
import { A11yModule } from '@angular/cdk/a11y';
import { PlatformModule } from '@angular/cdk/platform';

class KbqDlComponent {
    constructor() {
        this.minWidth = 400;
        this.wide = false;
        this.vertical = null;
        this.resizeStream = new Subject();
        this.resizeDebounceInterval = 100;
        this.resizeSubscription = Subscription.EMPTY;
        this.elementRef = inject(ElementRef);
        this.changeDetectorRef = inject(ChangeDetectorRef);
        this.updateState = () => {
            const domRect = this.elementRef.nativeElement.getClientRects()[0];
            const width = domRect?.width || 0;
            this.vertical = width <= this.minWidth;
            this.changeDetectorRef.markForCheck();
        };
    }
    ngAfterContentInit() {
        if (this.vertical !== null) {
            return;
        }
        this.resizeSubscription = this.resizeStream
            .pipe(startWith(null), debounceTime(this.resizeDebounceInterval))
            .subscribe(this.updateState);
    }
    ngOnDestroy() {
        this.resizeSubscription.unsubscribe();
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqDlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: KbqDlComponent, selector: "kbq-dl", inputs: { minWidth: "minWidth", wide: "wide", vertical: "vertical" }, host: { listeners: { "window:resize": "resizeStream.next($event)" }, properties: { "class.kbq-dl_vertical": "vertical", "class.kbq-dl_wide": "wide" }, classAttribute: "kbq-dl" }, ngImport: i0, template: '<ng-content />', isInline: true, styles: [".kbq-dl{display:grid;column-gap:var(--kbq-description-list-size-horizontal-content-gap-horizontal);row-gap:var(--kbq-description-list-size-horizontal-gap-vertical);grid-template-columns:repeat(4,1fr)}.kbq-dl .kbq-dt{grid-column:1}.kbq-dl .kbq-dd{grid-column:2/span 3}.kbq-dl.kbq-dl_wide{grid-template-columns:repeat(2,1fr)}.kbq-dl.kbq-dl_wide .kbq-dt{grid-column:1}.kbq-dl.kbq-dl_wide .kbq-dd{grid-column:2}.kbq-dl.kbq-dl_vertical{grid-template-columns:repeat(1,1fr);row-gap:var(--kbq-description-list-size-vertical-content-gap-vertical)}.kbq-dl.kbq-dl_vertical .kbq-dt,.kbq-dl.kbq-dl_vertical .kbq-dd{grid-column:1}.kbq-dl.kbq-dl_vertical .kbq-dd:not(:last-child){margin-bottom:var(--kbq-description-list-size-vertical-gap-vertical)}.kbq-dt{color:var(--kbq-description-list-term-color)}.kbq-dd{color:var(--kbq-description-list-description-color)}.kbq-dl .kbq-dt,.kbq-dl .kbq-dd{font-size:var(--kbq-typography-text-normal-font-size);font-style:var(--kbq-typography-text-normal-font-style);font-weight:var(--kbq-typography-text-normal-font-weight);line-height:var(--kbq-typography-text-normal-line-height);font-family:var(--kbq-typography-text-normal-font-family);text-transform:var(--kbq-typography-text-normal-text-transform);font-feature-settings:var(--kbq-typography-text-normal-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-letter-spacing)}\n", ".kbq-dl{--kbq-description-list-size-horizontal-content-gap-horizontal: var(--kbq-size-l);--kbq-description-list-size-horizontal-gap-vertical: var(--kbq-size-l);--kbq-description-list-size-vertical-content-gap-vertical: var(--kbq-size-3xs);--kbq-description-list-size-vertical-gap-vertical: var(--kbq-size-m);--kbq-description-list-term-color: var(--kbq-foreground-contrast-secondary);--kbq-description-list-description-color: var(--kbq-foreground-contrast)}\n"], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqDlComponent, decorators: [{
            type: Component,
            args: [{ selector: 'kbq-dl', template: '<ng-content />', host: {
                        class: 'kbq-dl',
                        '[class.kbq-dl_vertical]': 'vertical',
                        '[class.kbq-dl_wide]': 'wide',
                        '(window:resize)': 'resizeStream.next($event)'
                    }, encapsulation: ViewEncapsulation.None, styles: [".kbq-dl{display:grid;column-gap:var(--kbq-description-list-size-horizontal-content-gap-horizontal);row-gap:var(--kbq-description-list-size-horizontal-gap-vertical);grid-template-columns:repeat(4,1fr)}.kbq-dl .kbq-dt{grid-column:1}.kbq-dl .kbq-dd{grid-column:2/span 3}.kbq-dl.kbq-dl_wide{grid-template-columns:repeat(2,1fr)}.kbq-dl.kbq-dl_wide .kbq-dt{grid-column:1}.kbq-dl.kbq-dl_wide .kbq-dd{grid-column:2}.kbq-dl.kbq-dl_vertical{grid-template-columns:repeat(1,1fr);row-gap:var(--kbq-description-list-size-vertical-content-gap-vertical)}.kbq-dl.kbq-dl_vertical .kbq-dt,.kbq-dl.kbq-dl_vertical .kbq-dd{grid-column:1}.kbq-dl.kbq-dl_vertical .kbq-dd:not(:last-child){margin-bottom:var(--kbq-description-list-size-vertical-gap-vertical)}.kbq-dt{color:var(--kbq-description-list-term-color)}.kbq-dd{color:var(--kbq-description-list-description-color)}.kbq-dl .kbq-dt,.kbq-dl .kbq-dd{font-size:var(--kbq-typography-text-normal-font-size);font-style:var(--kbq-typography-text-normal-font-style);font-weight:var(--kbq-typography-text-normal-font-weight);line-height:var(--kbq-typography-text-normal-line-height);font-family:var(--kbq-typography-text-normal-font-family);text-transform:var(--kbq-typography-text-normal-text-transform);font-feature-settings:var(--kbq-typography-text-normal-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-letter-spacing)}\n", ".kbq-dl{--kbq-description-list-size-horizontal-content-gap-horizontal: var(--kbq-size-l);--kbq-description-list-size-horizontal-gap-vertical: var(--kbq-size-l);--kbq-description-list-size-vertical-content-gap-vertical: var(--kbq-size-3xs);--kbq-description-list-size-vertical-gap-vertical: var(--kbq-size-m);--kbq-description-list-term-color: var(--kbq-foreground-contrast-secondary);--kbq-description-list-description-color: var(--kbq-foreground-contrast)}\n"] }]
        }], propDecorators: { minWidth: [{
                type: Input
            }], wide: [{
                type: Input
            }], vertical: [{
                type: Input
            }] } });
class KbqDtComponent {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqDtComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: KbqDtComponent, selector: "kbq-dt", host: { classAttribute: "kbq-dt" }, ngImport: i0, template: '<ng-content />', isInline: true, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqDtComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'kbq-dt',
                    template: '<ng-content />',
                    host: {
                        class: 'kbq-dt'
                    },
                    encapsulation: ViewEncapsulation.None
                }]
        }] });
class KbqDdComponent {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqDdComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: KbqDdComponent, selector: "kbq-dd", host: { classAttribute: "kbq-dd" }, ngImport: i0, template: '<ng-content />', isInline: true, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqDdComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'kbq-dd',
                    template: '<ng-content />',
                    host: {
                        class: 'kbq-dd'
                    },
                    encapsulation: ViewEncapsulation.None
                }]
        }] });

class KbqDlModule {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqDlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: KbqDlModule, declarations: [KbqDlComponent,
            KbqDtComponent,
            KbqDdComponent], imports: [A11yModule,
            PlatformModule], exports: [KbqDlComponent,
            KbqDtComponent,
            KbqDdComponent] }); }
    /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqDlModule, imports: [A11yModule,
            PlatformModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqDlModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        A11yModule,
                        PlatformModule
                    ],
                    exports: [
                        KbqDlComponent,
                        KbqDtComponent,
                        KbqDdComponent
                    ],
                    declarations: [
                        KbqDlComponent,
                        KbqDtComponent,
                        KbqDdComponent
                    ]
                }]
        }] });

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

export { KbqDdComponent, KbqDlComponent, KbqDlModule, KbqDtComponent };
//# sourceMappingURL=koobiq-components-dl.mjs.map
