import { Overlay } from '@angular/cdk/overlay';
import * as i1 from '@angular/cdk/portal';
import { ComponentPortal, PortalModule, DomPortal, TemplatePortal, CdkPortalOutlet } from '@angular/cdk/portal';
import * as i0 from '@angular/core';
import { InjectionToken, inject, DestroyRef, Injector, Input, Component, Directive, EventEmitter, booleanAttribute, ContentChild, Output, HostBinding, ChangeDetectionStrategy, ViewEncapsulation, ElementRef, isDevMode, ViewContainerRef, Renderer2, TemplateRef, ViewChild, ViewChildren, Injectable, NgModule } from '@angular/core';
import { applyCssClass, destroyObservable, ViewportSizeObservable, ResponsiveBreakpoints } from '@fundamental-ngx/cdk/utils';
import * as i1$1 from '@fundamental-ngx/i18n';
import { I18nModule, patchLanguage } from '@fundamental-ngx/i18n';
import { BehaviorSubject, map, tap, merge, fromEvent, startWith, Observable, of, takeUntil, filter, Subject, combineLatest } from 'rxjs';
import { NgTemplateOutlet, AsyncPipe } from '@angular/common';
import { ScrollbarDirective } from '@fundamental-ngx/core/scrollbar';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { Router, NavigationStart } from '@angular/router';
import { switchMap } from 'rxjs/operators';
import { __decorate, __metadata } from 'tslib';
import { ButtonComponent } from '@fundamental-ngx/core/button';
import { ContentDensityDirective } from '@fundamental-ngx/core/content-density';
import { IconComponent } from '@fundamental-ngx/core/icon';

class MessageStripAlertRef {
}

const defaultConfig = {
    position: 'top-middle',
    messageStrip: {},
    closeOnNavigation: false
};
/**
 * Applies default config to the given config
 */
function applyDefaultConfig(config) {
    return { ...defaultConfig, ...config };
}

/**
 * Injection token for getting the position of the message strip alert container.
 * Is available in any of the message strip alert components and in footer component.
 */
const MessageStripAlertContainerPosition = new InjectionToken('MessageStripAlertContainerPosition');
/**
 * Injection token for getting the list of the message strip alert refs
 * in the given container. Is available in the footer component injection
 * context.
 */
const MessageStripAlertContainerAlertRefs = new InjectionToken('MessageStripAlertContainerAlertRefs');
const MessageStripAlertComponentData = new InjectionToken('MessageStripAlertComponentData');

/**
 * The component that represents the footer of the message strip alert container.
 * if user has provided the footer component through service, then this component
 * will render it inside itself.
 * Bear in mind that this component is always created, just sometimes if there is nothing to render
 * it will be empty.
 */
class MessageStripAlertContainerFooterComponent {
    constructor() {
        /**
         * Position of the overlay in which this component is rendered.
         */
        this.position = inject(MessageStripAlertContainerPosition);
        /** @hidden */
        this._destroyRef = inject(DestroyRef);
        /** @hidden */
        this.messageStripAlertService = inject(MessageStripAlertService);
        /**
         * Observable that emits the alert references that are currently rendered in the container.
         */
        this.alertRefs$ = new BehaviorSubject([]);
    }
    /** @hidden */
    set alertRefs(alertRefs) {
        this.alertRefs$.next(alertRefs);
    }
    /** @hidden */
    ngAfterViewInit() {
        this.messageStripAlertService.footerComponents$
            .pipe(map((components) => components[this.position]), tap((footerComponent) => {
            if (footerComponent) {
                this.footerComponentPortal = new ComponentPortal(footerComponent, null, Injector.create({
                    providers: [
                        {
                            provide: MessageStripAlertContainerAlertRefs,
                            useValue: this.alertRefs$.pipe(takeUntilDestroyed(this._destroyRef))
                        }
                    ]
                }));
            }
            else {
                this.footerComponentPortal = undefined;
            }
        }), takeUntilDestroyed(this._destroyRef))
            .subscribe();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripAlertContainerFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.2", type: MessageStripAlertContainerFooterComponent, isStandalone: true, selector: "fd-message-strip-alert-container-footer", inputs: { alertRefs: "alertRefs" }, ngImport: i0, template: ` <ng-template [cdkPortalOutlet]="footerComponentPortal"></ng-template> `, isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripAlertContainerFooterComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fd-message-strip-alert-container-footer', template: ` <ng-template [cdkPortalOutlet]="footerComponentPortal"></ng-template> `, imports: [PortalModule], styles: [":host{display:block}\n"] }]
        }], propDecorators: { alertRefs: [{
                type: Input
            }] } });

class MessageStripIconDirective {
    /** @hidden */
    constructor(templateRef) {
        this.templateRef = templateRef;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripIconDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.2", type: MessageStripIconDirective, isStandalone: true, selector: "[fdMessageStripIcon]", ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripIconDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[fdMessageStripIcon]',
                    standalone: true
                }]
        }], ctorParameters: () => [{ type: i0.TemplateRef }] });

let messageStripUniqueId = 0;
/**
 * The component that represents a message-strip. It can only be used inline.
 */
class MessageStripComponent {
    /** @hidden */
    constructor(elementRef) {
        this.elementRef = elementRef;
        /** User's custom classes */
        this.class = '';
        /** Whether the message strip is dismissible. */
        this.dismissible = true;
        /** The default message strip does not have an icon.
         * The other types (warning, success, information and error) have icons by default.
         * To remove the icon set the property to true.
         */
        this.noIcon = false;
        /** Id for the message-strip component. If omitted, a unique one is generated. */
        this.id = 'fd-message-strip-' + messageStripUniqueId++;
        /** Event fired when the message-strip is dismissed. */
        this.onDismiss = new EventEmitter();
    }
    /** @hidden
     * CssClassBuilder interface implementation
     * function must return single string
     * function is responsible for order which css classes are applied
     */
    buildComponentCssClass() {
        return [
            'fd-message-strip',
            this.type ? `fd-message-strip--${this.type}` : '',
            this.dismissible ? 'fd-message-strip--dismissible' : '',
            this.noIcon ? 'fd-message-strip--no-icon' : '',
            this.indicationColor ? `fd-message-strip--indication-color-${this.indicationColor}` : '',
            this.class
        ];
    }
    /** @hidden */
    ngOnInit() {
        this.buildComponentCssClass();
    }
    /** @hidden */
    ngOnChanges() {
        this.buildComponentCssClass();
    }
    /** Whether icon container should be shown */
    get shouldShowIcon() {
        if (this.noIcon) {
            return false;
        }
        return !!this.icon || !!this.type;
    }
    /** @hidden */
    get typeSpecificIconName() {
        switch (this.type) {
            case 'warning':
                return 'alert';
            case 'success':
                return 'sys-enter-2';
            case 'error':
                return 'error';
            case 'information':
                return 'information';
            default:
                return '';
        }
    }
    /**
     * Dismisses the message-strip.
     */
    dismiss() {
        this.elementRef.nativeElement.classList.add('fd-has-display-none');
        this.elementRef.nativeElement.classList.remove('fd-has-display-block');
        this.onDismiss.emit();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.2", type: MessageStripComponent, isStandalone: true, selector: "fd-message-strip", inputs: { class: "class", dismissible: ["dismissible", "dismissible", booleanAttribute], dismissBtnTitle: "dismissBtnTitle", noIcon: ["noIcon", "noIcon", booleanAttribute], type: "type", id: "id", ariaLabelledBy: "ariaLabelledBy", ariaLabel: "ariaLabel", width: "width", minWidth: "minWidth", marginBottom: "marginBottom", indicationColor: "indicationColor" }, outputs: { onDismiss: "onDismiss" }, host: { attributes: { "role": "alert" }, properties: { "attr.aria-labelledby": "ariaLabelledBy", "attr.aria-label": "ariaLabel", "style.width": "width", "style.min-width": "minWidth", "style.margin-bottom": "marginBottom", "attr.id": "id", "class.fd-message-strip--dismissible": "this.dismissible", "class.fd-message-strip--no-icon": "this.noIcon" } }, queries: [{ propertyName: "icon", first: true, predicate: MessageStripIconDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (shouldShowIcon) {\n    <div class=\"fd-message-strip__icon-container\" aria-hidden=\"true\">\n        @if (icon) {\n            <ng-template [ngTemplateOutlet]=\"icon.templateRef\"></ng-template>\n        } @else {\n            <fd-icon [glyph]=\"typeSpecificIconName\"></fd-icon>\n        }\n    </div>\n}\n<p class=\"fd-message-strip__text\">\n    <ng-content></ng-content>\n</p>\n@if (dismissible) {\n    <button\n        class=\"fd-message-strip__close\"\n        fd-button\n        glyph=\"decline\"\n        fdType=\"transparent\"\n        fdCompact\n        (click)=\"dismiss()\"\n        [attr.aria-controls]=\"id\"\n        [attr.aria-label]=\"dismissBtnTitle || ('coreMessageStrip.dismissLabel' | fdTranslate)\"\n        [attr.title]=\"dismissBtnTitle || ('coreMessageStrip.dismissLabel' | fdTranslate)\"\n    ></button>\n}\n", styles: [".fd-message-strip{--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Neutral);--fdMessageStrip_Background_Color:var(--sapNeutralBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Neutral);--fdMessageStrip_Text_Color:var(--sapTextColor);--fdMessageStrip_Vertical_Padding:.4375rem;--fdMessageStrip_Left_Padding:2.4375rem;--fdMessageStrip_Right_Padding:.9375rem;background:var(--fdMessageStrip_Background_Color);border:0;border-color:var(--fdMessageStrip_Border_Color);border-radius:var(--fdMessageStrip_Border_Radius);border-style:solid;border-width:var(--fdMessageStrip_Border_Width);-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;height:auto;line-height:normal;margin-block:0;margin-inline:0;min-height:2rem;padding-block:0;padding-block:var(--fdMessageStrip_Vertical_Padding);padding-inline:0;padding-inline:var(--fdMessageStrip_Left_Padding) var(--fdMessageStrip_Right_Padding);position:relative}.fd-message-strip:after,.fd-message-strip:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-strip .fd-message-strip__close{position:absolute;right:.125rem;top:.125rem}.fd-message-strip .fd-message-strip__close[dir=rtl],[dir=rtl] .fd-message-strip .fd-message-strip__close{left:.125rem;right:auto}.fd-message-strip__text{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);color:var(--fdMessageStrip_Text_Color);font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;line-height:1rem;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;white-space:normal;word-break:break-word}.fd-message-strip__text:after,.fd-message-strip__text:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-strip__icon-container{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);display:-webkit-box;display:-ms-flexbox;display:flex;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--fdMessageStrip_Icon_Color);font-size:1rem;left:0;max-width:2.5rem;min-width:2.5rem;position:absolute;top:var(--fdMessageStrip_Vertical_Padding);width:2.5rem}.fd-message-strip__icon-container:after,.fd-message-strip__icon-container:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-strip__icon-container[dir=rtl],[dir=rtl] .fd-message-strip__icon-container{left:auto;right:0}.fd-message-strip__icon-container [class*=sap-icon]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--fdMessageStrip_Icon_Color);height:1rem;line-height:1;max-height:1rem;max-width:1rem;min-height:1rem;min-width:1rem;width:1rem}.fd-message-strip--warning{--fdMessageStrip_Background_Color:var(--sapWarningBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Warning);--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Warning)}.fd-message-strip--error{--fdMessageStrip_Background_Color:var(--sapErrorBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Error);--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Error)}.fd-message-strip--success{--fdMessageStrip_Background_Color:var(--sapSuccessBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Success);--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Success)}.fd-message-strip--information{--fdMessageStrip_Background_Color:var(--sapInformationBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Information);--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Informative)}.fd-message-strip--no-icon{--fdMessageStrip_Left_Padding:.9375rem;--fdMessageStrip_Right_Padding:.9375rem}.fd-message-strip--dismissible{--fdMessageStrip_Left_Padding:2.4375rem;--fdMessageStrip_Right_Padding:2.4375rem}.fd-message-strip--dismissible.fd-message-strip--no-icon{--fdMessageStrip_Left_Padding:.9375rem;--fdMessageStrip_Right_Padding:2.4375rem}.fd-message-strip--link a{text-shadow:var(--sapContent_TextShadow)}.fd-message-strip--indication-color-1{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_1_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_1_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_1_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_1_Background)}.fd-message-strip--indication-color-2{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_2_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_2_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_2_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_2_Background)}.fd-message-strip--indication-color-3{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_3_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_3_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_3_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_3_Background)}.fd-message-strip--indication-color-4{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_4_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_4_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_4_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_4_Background)}.fd-message-strip--indication-color-5{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_5_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_5_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_5_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_5_Background)}.fd-message-strip--indication-color-6{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_6_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_6_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_6_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_6_Background)}.fd-message-strip--indication-color-7{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_7_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_7_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_7_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_7_Background)}.fd-message-strip--indication-color-8{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_8_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_8_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_8_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_8_Background)}.fd-message-strip--indication-color-9{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_9_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_9_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_9_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_9_Background)}.fd-message-strip--indication-color-10{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_10_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_10_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_10_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_10_Background)}.fd-message-strip--indication-color-1b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_1);--fdMessageStrip_Text_Color:var(--sapIndicationColor_1);--fdMessageStrip_Border_Color:var(--sapIndicationColor_1b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_1b)}.fd-message-strip--indication-color-2b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_2);--fdMessageStrip_Text_Color:var(--sapIndicationColor_2);--fdMessageStrip_Border_Color:var(--sapIndicationColor_2b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_2b)}.fd-message-strip--indication-color-3b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_3);--fdMessageStrip_Text_Color:var(--sapIndicationColor_3);--fdMessageStrip_Border_Color:var(--sapIndicationColor_3b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_3b)}.fd-message-strip--indication-color-4b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_4);--fdMessageStrip_Text_Color:var(--sapIndicationColor_4);--fdMessageStrip_Border_Color:var(--sapIndicationColor_4b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_4b)}.fd-message-strip--indication-color-5b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_5);--fdMessageStrip_Text_Color:var(--sapIndicationColor_5);--fdMessageStrip_Border_Color:var(--sapIndicationColor_5b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_5b)}.fd-message-strip--indication-color-6b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_6);--fdMessageStrip_Text_Color:var(--sapIndicationColor_6);--fdMessageStrip_Border_Color:var(--sapIndicationColor_6b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_6b)}.fd-message-strip--indication-color-7b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_7);--fdMessageStrip_Text_Color:var(--sapIndicationColor_7);--fdMessageStrip_Border_Color:var(--sapIndicationColor_7b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_7b)}.fd-message-strip--indication-color-8b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_8);--fdMessageStrip_Text_Color:var(--sapIndicationColor_8);--fdMessageStrip_Border_Color:var(--sapIndicationColor_8b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_8b)}.fd-message-strip--indication-color-9b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_9);--fdMessageStrip_Text_Color:var(--sapIndicationColor_9);--fdMessageStrip_Border_Color:var(--sapIndicationColor_9b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_9b)}.fd-message-strip--indication-color-10b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_10);--fdMessageStrip_Text_Color:var(--sapIndicationColor_10);--fdMessageStrip_Border_Color:var(--sapIndicationColor_10b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_10b)}.fd-message-strip,.fd-has-display-block{display:block}.fd-has-display-none{display:none}\n/*! Bundled license information:\n\nfundamental-styles/dist/message-strip.css:\n  (*!\n   * Fundamental Library Styles v0.40.1\n   * Copyright (c) 2025 SAP SE or an SAP affiliate company.\n   * Licensed under Apache License 2.0 (https://github.com/SAP/fundamental-styles/blob/main/LICENSE)\n   *)\n*/\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[fd-button], a[fd-button], span[fd-button]", inputs: ["class"], exportAs: ["fd-button"] }, { kind: "directive", type: ContentDensityDirective, selector: "[fdContentDensity]:not([fdCompact]):not([fdCondensed]):not([fdCozy]),                [fdCompact]:not([fdContentDensity]):not([fdCondensed]):not([fdCozy]),                [fdCondensed]:not([fdContentDensity]):not([fdCompact]):not([fdCozy]),                [fdCozy]:not([fdContentDensity]):not([fdCompact]):not([fdCondensed])", inputs: ["fdContentDensity", "fdCompact", "fdCondensed", "fdCozy"], exportAs: ["fdContentDensity"] }, { kind: "ngmodule", type: I18nModule }, { kind: "pipe", type: i1$1.FdTranslatePipe, name: "fdTranslate" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconComponent, selector: "fd-icon", inputs: ["glyph", "font", "color", "background", "class", "ariaLabel", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
__decorate([
    applyCssClass,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Array)
], MessageStripComponent.prototype, "buildComponentCssClass", null);
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fd-message-strip', host: {
                        '[attr.aria-labelledby]': 'ariaLabelledBy',
                        '[attr.aria-label]': 'ariaLabel',
                        '[style.width]': 'width',
                        '[style.min-width]': 'minWidth',
                        '[style.margin-bottom]': 'marginBottom',
                        role: 'alert',
                        '[attr.id]': 'id'
                    }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [ButtonComponent, ContentDensityDirective, I18nModule, NgTemplateOutlet, IconComponent], template: "@if (shouldShowIcon) {\n    <div class=\"fd-message-strip__icon-container\" aria-hidden=\"true\">\n        @if (icon) {\n            <ng-template [ngTemplateOutlet]=\"icon.templateRef\"></ng-template>\n        } @else {\n            <fd-icon [glyph]=\"typeSpecificIconName\"></fd-icon>\n        }\n    </div>\n}\n<p class=\"fd-message-strip__text\">\n    <ng-content></ng-content>\n</p>\n@if (dismissible) {\n    <button\n        class=\"fd-message-strip__close\"\n        fd-button\n        glyph=\"decline\"\n        fdType=\"transparent\"\n        fdCompact\n        (click)=\"dismiss()\"\n        [attr.aria-controls]=\"id\"\n        [attr.aria-label]=\"dismissBtnTitle || ('coreMessageStrip.dismissLabel' | fdTranslate)\"\n        [attr.title]=\"dismissBtnTitle || ('coreMessageStrip.dismissLabel' | fdTranslate)\"\n    ></button>\n}\n", styles: [".fd-message-strip{--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Neutral);--fdMessageStrip_Background_Color:var(--sapNeutralBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Neutral);--fdMessageStrip_Text_Color:var(--sapTextColor);--fdMessageStrip_Vertical_Padding:.4375rem;--fdMessageStrip_Left_Padding:2.4375rem;--fdMessageStrip_Right_Padding:.9375rem;background:var(--fdMessageStrip_Background_Color);border:0;border-color:var(--fdMessageStrip_Border_Color);border-radius:var(--fdMessageStrip_Border_Radius);border-style:solid;border-width:var(--fdMessageStrip_Border_Width);-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;height:auto;line-height:normal;margin-block:0;margin-inline:0;min-height:2rem;padding-block:0;padding-block:var(--fdMessageStrip_Vertical_Padding);padding-inline:0;padding-inline:var(--fdMessageStrip_Left_Padding) var(--fdMessageStrip_Right_Padding);position:relative}.fd-message-strip:after,.fd-message-strip:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-strip .fd-message-strip__close{position:absolute;right:.125rem;top:.125rem}.fd-message-strip .fd-message-strip__close[dir=rtl],[dir=rtl] .fd-message-strip .fd-message-strip__close{left:.125rem;right:auto}.fd-message-strip__text{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);color:var(--fdMessageStrip_Text_Color);font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;line-height:1rem;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;white-space:normal;word-break:break-word}.fd-message-strip__text:after,.fd-message-strip__text:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-strip__icon-container{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);display:-webkit-box;display:-ms-flexbox;display:flex;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--fdMessageStrip_Icon_Color);font-size:1rem;left:0;max-width:2.5rem;min-width:2.5rem;position:absolute;top:var(--fdMessageStrip_Vertical_Padding);width:2.5rem}.fd-message-strip__icon-container:after,.fd-message-strip__icon-container:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-strip__icon-container[dir=rtl],[dir=rtl] .fd-message-strip__icon-container{left:auto;right:0}.fd-message-strip__icon-container [class*=sap-icon]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--fdMessageStrip_Icon_Color);height:1rem;line-height:1;max-height:1rem;max-width:1rem;min-height:1rem;min-width:1rem;width:1rem}.fd-message-strip--warning{--fdMessageStrip_Background_Color:var(--sapWarningBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Warning);--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Warning)}.fd-message-strip--error{--fdMessageStrip_Background_Color:var(--sapErrorBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Error);--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Error)}.fd-message-strip--success{--fdMessageStrip_Background_Color:var(--sapSuccessBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Success);--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Success)}.fd-message-strip--information{--fdMessageStrip_Background_Color:var(--sapInformationBackground);--fdMessageStrip_Icon_Color:var(--fdMessageStrip_Icon_Color_Information);--fdMessageStrip_Border_Color:var(--fdMessageStrip_Border_Color_Informative)}.fd-message-strip--no-icon{--fdMessageStrip_Left_Padding:.9375rem;--fdMessageStrip_Right_Padding:.9375rem}.fd-message-strip--dismissible{--fdMessageStrip_Left_Padding:2.4375rem;--fdMessageStrip_Right_Padding:2.4375rem}.fd-message-strip--dismissible.fd-message-strip--no-icon{--fdMessageStrip_Left_Padding:.9375rem;--fdMessageStrip_Right_Padding:2.4375rem}.fd-message-strip--link a{text-shadow:var(--sapContent_TextShadow)}.fd-message-strip--indication-color-1{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_1_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_1_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_1_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_1_Background)}.fd-message-strip--indication-color-2{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_2_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_2_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_2_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_2_Background)}.fd-message-strip--indication-color-3{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_3_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_3_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_3_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_3_Background)}.fd-message-strip--indication-color-4{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_4_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_4_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_4_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_4_Background)}.fd-message-strip--indication-color-5{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_5_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_5_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_5_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_5_Background)}.fd-message-strip--indication-color-6{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_6_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_6_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_6_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_6_Background)}.fd-message-strip--indication-color-7{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_7_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_7_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_7_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_7_Background)}.fd-message-strip--indication-color-8{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_8_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_8_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_8_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_8_Background)}.fd-message-strip--indication-color-9{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_9_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_9_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_9_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_9_Background)}.fd-message-strip--indication-color-10{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_10_TextColor);--fdMessageStrip_Text_Color:var(--sapIndicationColor_10_TextColor);--fdMessageStrip_Border_Color:var(--sapIndicationColor_10_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_10_Background)}.fd-message-strip--indication-color-1b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_1);--fdMessageStrip_Text_Color:var(--sapIndicationColor_1);--fdMessageStrip_Border_Color:var(--sapIndicationColor_1b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_1b)}.fd-message-strip--indication-color-2b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_2);--fdMessageStrip_Text_Color:var(--sapIndicationColor_2);--fdMessageStrip_Border_Color:var(--sapIndicationColor_2b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_2b)}.fd-message-strip--indication-color-3b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_3);--fdMessageStrip_Text_Color:var(--sapIndicationColor_3);--fdMessageStrip_Border_Color:var(--sapIndicationColor_3b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_3b)}.fd-message-strip--indication-color-4b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_4);--fdMessageStrip_Text_Color:var(--sapIndicationColor_4);--fdMessageStrip_Border_Color:var(--sapIndicationColor_4b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_4b)}.fd-message-strip--indication-color-5b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_5);--fdMessageStrip_Text_Color:var(--sapIndicationColor_5);--fdMessageStrip_Border_Color:var(--sapIndicationColor_5b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_5b)}.fd-message-strip--indication-color-6b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_6);--fdMessageStrip_Text_Color:var(--sapIndicationColor_6);--fdMessageStrip_Border_Color:var(--sapIndicationColor_6b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_6b)}.fd-message-strip--indication-color-7b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_7);--fdMessageStrip_Text_Color:var(--sapIndicationColor_7);--fdMessageStrip_Border_Color:var(--sapIndicationColor_7b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_7b)}.fd-message-strip--indication-color-8b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_8);--fdMessageStrip_Text_Color:var(--sapIndicationColor_8);--fdMessageStrip_Border_Color:var(--sapIndicationColor_8b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_8b)}.fd-message-strip--indication-color-9b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_9);--fdMessageStrip_Text_Color:var(--sapIndicationColor_9);--fdMessageStrip_Border_Color:var(--sapIndicationColor_9b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_9b)}.fd-message-strip--indication-color-10b{--fdMessageStrip_Icon_Color:var(--sapIndicationColor_10);--fdMessageStrip_Text_Color:var(--sapIndicationColor_10);--fdMessageStrip_Border_Color:var(--sapIndicationColor_10b_BorderColor);--fdMessageStrip_Background_Color:var(--sapIndicationColor_10b)}.fd-message-strip,.fd-has-display-block{display:block}.fd-has-display-none{display:none}\n/*! Bundled license information:\n\nfundamental-styles/dist/message-strip.css:\n  (*!\n   * Fundamental Library Styles v0.40.1\n   * Copyright (c) 2025 SAP SE or an SAP affiliate company.\n   * Licensed under Apache License 2.0 (https://github.com/SAP/fundamental-styles/blob/main/LICENSE)\n   *)\n*/\n"] }]
        }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { class: [{
                type: Input
            }], dismissible: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }, {
                type: HostBinding,
                args: ['class.fd-message-strip--dismissible']
            }], dismissBtnTitle: [{
                type: Input
            }], noIcon: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }, {
                type: HostBinding,
                args: ['class.fd-message-strip--no-icon']
            }], type: [{
                type: Input
            }], id: [{
                type: Input
            }], ariaLabelledBy: [{
                type: Input
            }], ariaLabel: [{
                type: Input
            }], width: [{
                type: Input
            }], minWidth: [{
                type: Input
            }], marginBottom: [{
                type: Input
            }], indicationColor: [{
                type: Input
            }], onDismiss: [{
                type: Output
            }], icon: [{
                type: ContentChild,
                args: [MessageStripIconDirective]
            }], buildComponentCssClass: [] } });

class AutoDismissMessageStripDirective {
    constructor() {
        /** Whether the message strip is dismissible */
        this.dismissible = true;
        /** Whether the alert should be automatically dismissed. */
        this.autoDismiss = true;
        /** Duration of time *in milliseconds* that the alert will be visible. Set to -1 for indefinite. */
        this.duration = 10000;
        /** Whether the alert should stay open if the mouse is hovering over it. */
        this.mousePersist = false;
        /** Whether the message strip is currently opened. */
        this.opened = false;
        /** @hidden */
        this.messageStripComponent = inject(MessageStripComponent, { optional: false, host: true });
        /** @hidden */
        this.elementRef = inject(ElementRef);
        /** @hidden */
        this._destroyRef = inject(DestroyRef);
        /**
         * Mouse is hovering over the message strip.
         * */
        this.mouseIn$ = merge(fromEvent(this.elementRef.nativeElement, 'mouseenter').pipe(map(() => true)), fromEvent(this.elementRef.nativeElement, 'mouseleave').pipe(map(() => false))).pipe(startWith(false));
        /** @hidden */
        this.stopAutoDismiss = () => {
            if (this.autoDismissTimeout) {
                clearTimeout(this.autoDismissTimeout);
                this.autoDismissTimeout = undefined;
            }
        };
        /** @hidden */
        this.dismiss = () => this.messageStripComponent.dismiss();
    }
    /** @hidden */
    open() {
        this.opened = true;
        this.elementRef.nativeElement.classList.remove('fd-has-display-block');
        this.elementRef.nativeElement.classList.remove('fd-has-display-none');
        this.stopAutoDismiss();
        if (this.autoDismiss && !this.dismissible && isDevMode()) {
            console.warn('Auto dismiss is enabled but the message strip is not dismissible. Please set the dismissible input to true.');
        }
        if (this.autoDismiss && this.dismissible) {
            this.startAutoDismiss();
        }
    }
    /** @hidden */
    startAutoDismiss() {
        const startAutoDismissTimer$ = new Observable((res) => {
            this.autoDismissTimeout = setTimeout(() => {
                this.dismiss();
                res.next(null);
            }, this.duration);
            return this.stopAutoDismiss;
        });
        if (this.duration > -1) {
            const source$ = this.mousePersist
                ? this.mouseIn$.pipe(switchMap((mouseIn) => {
                    if (mouseIn) {
                        return of(null);
                    }
                    return startAutoDismissTimer$;
                }))
                : startAutoDismissTimer$;
            source$
                .pipe(takeUntil(merge(destroyObservable(this._destroyRef), this.messageStripComponent.onDismiss)))
                .subscribe();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: AutoDismissMessageStripDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.0.2", type: AutoDismissMessageStripDirective, isStandalone: true, selector: "fd-message-strip[mousePersist], fd-message-strip[duration], fd-message-strip[autoDismiss]", inputs: { dismissible: ["dismissible", "dismissible", booleanAttribute], autoDismiss: ["autoDismiss", "autoDismiss", booleanAttribute], duration: "duration", mousePersist: ["mousePersist", "mousePersist", booleanAttribute] }, host: { properties: { "style.display": "!opened ? \"none\" : null" } }, exportAs: ["fdAutoDismissMessageStrip"], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: AutoDismissMessageStripDirective, decorators: [{
            type: Directive,
            args: [{
                    // eslint-disable-next-line @angular-eslint/directive-selector
                    selector: 'fd-message-strip[mousePersist], fd-message-strip[duration], fd-message-strip[autoDismiss]',
                    exportAs: 'fdAutoDismissMessageStrip',
                    standalone: true,
                    host: {
                        '[style.display]': '!opened ? "none" : null'
                    }
                }]
        }], propDecorators: { dismissible: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], autoDismiss: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], duration: [{
                type: Input
            }], mousePersist: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }] } });

/**
 * The wrapper component, which is wrapping the Message Strip and passes
 * configuration to it, also generates the content which will appear in it.
 */
class MessageStripAlertComponent {
    /** @hidden */
    constructor() {
        /** User provided data. Full of it */
        this.data = inject(MessageStripAlertComponentData);
        /**
         * Reference to the message strip alert, which is used to close it from the outside, or access the data and/or the component instance
         *  */
        this.alertRef = inject(MessageStripAlertRef);
        /** @hidden */
        this.viewContainerRef = inject(ViewContainerRef);
        /** @hidden */
        this.renderer2 = inject(Renderer2);
        this.messageStripConfig = this.data.messageStripConfig;
        this.contentPortal = this.getPortal(this.data.content);
        if (this.data.closeOnNavigation) {
            inject(Router, { optional: true })
                ?.events.pipe(filter((event) => event instanceof NavigationStart), takeUntilDestroyed())
                .subscribe(() => this.onDismissHandler());
        }
    }
    /**
     * Handler for the dismiss button click.
     *  */
    onDismissHandler() {
        this.messageStripConfig.onDismiss();
    }
    /** @hidden */
    ngOnDestroy() {
        clearTimeout(this.autoDismissTimeout);
    }
    /** @hidden */
    ngAfterViewInit() {
        this.autoDismissMessageStripDirective.open();
    }
    /**
     * Method, which is responsible for generating the portal, which will be rendered inside the message strip.
     * It can be any type of the portal, depending on the user provided content.
     *  */
    getPortal(content) {
        if (typeof content === 'string') {
            const textEl = this.renderer2.createText(content);
            this.renderer2.appendChild(this.viewContainerRef.element.nativeElement, textEl);
            return new DomPortal(textEl);
        }
        if (content instanceof TemplateRef) {
            return new TemplatePortal(content, this.viewContainerRef, { $implicit: this.alertRef });
        }
        return new ComponentPortal(content);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripAlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.2", type: MessageStripAlertComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "autoDismissMessageStripDirective", first: true, predicate: AutoDismissMessageStripDirective, descendants: true }], ngImport: i0, template: "<fd-message-strip\n    [class]=\"messageStripConfig.class\"\n    [dismissible]=\"messageStripConfig.dismissible\"\n    [autoDismiss]=\"messageStripConfig.duration > 0\"\n    [mousePersist]=\"messageStripConfig.mousePersist\"\n    [duration]=\"messageStripConfig.duration\"\n    [noIcon]=\"messageStripConfig.noIcon\"\n    [type]=\"messageStripConfig.type\"\n    [id]=\"messageStripConfig.id\"\n    [ariaLabelledBy]=\"messageStripConfig.ariaLabelledBy\"\n    [ariaLabel]=\"messageStripConfig.ariaLabel\"\n    (onDismiss)=\"onDismissHandler()\"\n>\n    <ng-template [cdkPortalOutlet]=\"contentPortal\"></ng-template>\n</fd-message-strip>\n", dependencies: [{ kind: "component", type: MessageStripComponent, selector: "fd-message-strip", inputs: ["class", "dismissible", "dismissBtnTitle", "noIcon", "type", "id", "ariaLabelledBy", "ariaLabel", "width", "minWidth", "marginBottom", "indicationColor"], outputs: ["onDismiss"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "directive", type: AutoDismissMessageStripDirective, selector: "fd-message-strip[mousePersist], fd-message-strip[duration], fd-message-strip[autoDismiss]", inputs: ["dismissible", "autoDismiss", "duration", "mousePersist"], exportAs: ["fdAutoDismissMessageStrip"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripAlertComponent, decorators: [{
            type: Component,
            args: [{ imports: [MessageStripComponent, PortalModule, AutoDismissMessageStripDirective], template: "<fd-message-strip\n    [class]=\"messageStripConfig.class\"\n    [dismissible]=\"messageStripConfig.dismissible\"\n    [autoDismiss]=\"messageStripConfig.duration > 0\"\n    [mousePersist]=\"messageStripConfig.mousePersist\"\n    [duration]=\"messageStripConfig.duration\"\n    [noIcon]=\"messageStripConfig.noIcon\"\n    [type]=\"messageStripConfig.type\"\n    [id]=\"messageStripConfig.id\"\n    [ariaLabelledBy]=\"messageStripConfig.ariaLabelledBy\"\n    [ariaLabel]=\"messageStripConfig.ariaLabel\"\n    (onDismiss)=\"onDismissHandler()\"\n>\n    <ng-template [cdkPortalOutlet]=\"contentPortal\"></ng-template>\n</fd-message-strip>\n" }]
        }], ctorParameters: () => [], propDecorators: { autoDismissMessageStripDirective: [{
                type: ViewChild,
                args: [AutoDismissMessageStripDirective]
            }] } });

/**
 * This will be rendered in the overlay. It is responsible for rendering the alerts and the footer.
 */
class MessageStripAlertContainerComponent {
    constructor() {
        /**
         * The list of the elements that are attached to the container.
         */
        this.attachedElements = [];
    }
    /** @hidden */
    ngAfterViewInit() {
        this.alertRefs$ = this.portalOutlets.changes.pipe(startWith(this.portalOutlets), map(() => this.portalOutlets
            .toArray()
            .map((p) => p.attachedRef?.instance.alertRef)));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripAlertContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.2", type: MessageStripAlertContainerComponent, isStandalone: true, selector: "fd-message-strip-alert-container", viewQueries: [{ propertyName: "portalOutlets", predicate: CdkPortalOutlet, descendants: true }, { propertyName: "alerts", predicate: MessageStripAlertComponent, descendants: true }], ngImport: i0, template: `
        <div fdScrollbar>
            @for (portal of attachedElements; track portal) {
                <ng-template [cdkPortalOutlet]="portal"></ng-template>
            }
        </div>
        <fd-message-strip-alert-container-footer
            [alertRefs]="alertRefs$ | async"
        ></fd-message-strip-alert-container-footer>
    `, isInline: true, styles: [".fd-message-strip-alert-overlay{max-width:33.33vw;padding:.5rem}.fd-message-strip-alert-overlay--top{top:0;max-height:100vh}.fd-message-strip-alert-overlay--top.fd-message-strip-alert-overlay--bottom-opened{max-height:50vh}.fd-message-strip-alert-overlay--bottom{top:initial;bottom:0;max-height:100vh}.fd-message-strip-alert-overlay--bottom fd-message-strip-alert-container{flex-direction:column-reverse}.fd-message-strip-alert-overlay--bottom.fd-message-strip-alert-overlay--top-opened{max-height:50vh}.fd-message-strip-alert-overlay--start{left:0}.fd-message-strip-alert-overlay--middle{left:33.33vw;width:33.33vw}@media screen and (max-width: 992px){.fd-message-strip-alert-overlay--middle{left:5vw;width:90vw;max-width:90vw}}.fd-message-strip-alert-overlay--middle fd-message-strip-alert-container{width:100%}.fd-message-strip-alert-overlay--middle fd-message-strip-alert-container>.fd-scrollbar>*{width:fit-content;margin:0 auto}.fd-message-strip-alert-overlay--end{right:0}.fd-message-strip-alert-overlay fd-message-strip-alert-container{display:flex;flex-direction:column}.fd-message-strip-alert-overlay fd-message-strip-alert-container div[fdscrollbar]{width:100%;display:flex;padding:.5rem;gap:.75rem;flex-direction:column;max-height:100%}\n"], dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "directive", type: ScrollbarDirective, selector: "[fdScrollbar], [fd-scrollbar]", inputs: ["noHorizontalScroll", "noVerticalScroll", "alwaysVisible"] }, { kind: "component", type: MessageStripAlertContainerFooterComponent, selector: "fd-message-strip-alert-container-footer", inputs: ["alertRefs"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripAlertContainerComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fd-message-strip-alert-container', template: `
        <div fdScrollbar>
            @for (portal of attachedElements; track portal) {
                <ng-template [cdkPortalOutlet]="portal"></ng-template>
            }
        </div>
        <fd-message-strip-alert-container-footer
            [alertRefs]="alertRefs$ | async"
        ></fd-message-strip-alert-container-footer>
    `, encapsulation: ViewEncapsulation.None, imports: [PortalModule, ScrollbarDirective, MessageStripAlertContainerFooterComponent, AsyncPipe], styles: [".fd-message-strip-alert-overlay{max-width:33.33vw;padding:.5rem}.fd-message-strip-alert-overlay--top{top:0;max-height:100vh}.fd-message-strip-alert-overlay--top.fd-message-strip-alert-overlay--bottom-opened{max-height:50vh}.fd-message-strip-alert-overlay--bottom{top:initial;bottom:0;max-height:100vh}.fd-message-strip-alert-overlay--bottom fd-message-strip-alert-container{flex-direction:column-reverse}.fd-message-strip-alert-overlay--bottom.fd-message-strip-alert-overlay--top-opened{max-height:50vh}.fd-message-strip-alert-overlay--start{left:0}.fd-message-strip-alert-overlay--middle{left:33.33vw;width:33.33vw}@media screen and (max-width: 992px){.fd-message-strip-alert-overlay--middle{left:5vw;width:90vw;max-width:90vw}}.fd-message-strip-alert-overlay--middle fd-message-strip-alert-container{width:100%}.fd-message-strip-alert-overlay--middle fd-message-strip-alert-container>.fd-scrollbar>*{width:fit-content;margin:0 auto}.fd-message-strip-alert-overlay--end{right:0}.fd-message-strip-alert-overlay fd-message-strip-alert-container{display:flex;flex-direction:column}.fd-message-strip-alert-overlay fd-message-strip-alert-container div[fdscrollbar]{width:100%;display:flex;padding:.5rem;gap:.75rem;flex-direction:column;max-height:100%}\n"] }]
        }], propDecorators: { portalOutlets: [{
                type: ViewChildren,
                args: [CdkPortalOutlet]
            }], alerts: [{
                type: ViewChildren,
                args: [MessageStripAlertComponent]
            }] } });

/**
 * Service that is responsible for opening and closing message strip alerts.
 * This should be only created once in entire application.
 * Service is responsible for creating and managing the overlays for the
 * message strip alerts. This also manages the footer components for any
 * given position.
 */
class MessageStripAlertService {
    /** @hidden */
    constructor() {
        /** @hidden */
        this.injector = inject(Injector);
        /** @hidden */
        this._overlay = inject(Overlay);
        /** @hidden */
        this.viewportSize$ = inject(ViewportSizeObservable);
        /** @hidden */
        this._messageStripAlertService = inject(MessageStripAlertService, { optional: true, skipSelf: true });
        /** @hidden */
        this._messageAlerts$ = new BehaviorSubject([]);
        /** @hidden */
        this._overlayRefs = {};
        /** @hidden */
        this._messageStripAlertContainerFooters$ = new BehaviorSubject({});
        if (this._messageStripAlertService) {
            throw new Error('MessageStripAlertService is already provided');
        }
        this.footerComponents$ = this._messageStripAlertContainerFooters$.asObservable();
        this.listenToItemsChanges();
    }
    /**
     * Set the footer component for a given position.
     */
    setFooterComponent(position, component) {
        this._messageStripAlertContainerFooters$.next({
            ...this._messageStripAlertContainerFooters$.value,
            [position]: component
        });
    }
    /**
     * Open a message strip alert with given configuration
     */
    open(c) {
        const config = applyDefaultConfig(c);
        const alertRef = this.getMessageStripAlertRef(config);
        this._messageAlerts$.next([{ ...config, portal: alertRef.portal }, ...this._messageAlerts$.value]);
        return alertRef;
    }
    /** @hidden */
    getMessageStripAlertRef(config) {
        const onDismiss$ = new Subject();
        const alertRef = {
            portal: new ComponentPortal((MessageStripAlertComponent), null, Injector.create({
                providers: [
                    {
                        provide: MessageStripAlertComponentData,
                        useValue: {
                            content: config.content,
                            closeOnNavigation: config.closeOnNavigation,
                            messageStripConfig: {
                                ...config.messageStrip,
                                onDismiss: () => {
                                    this._messageAlerts$.next(this._messageAlerts$.value.filter((item) => item.portal !== alertRef.portal));
                                    config.messageStrip &&
                                        config.messageStrip.onDismiss &&
                                        config.messageStrip.onDismiss();
                                    onDismiss$.next();
                                    onDismiss$.complete();
                                }
                            }
                        }
                    },
                    {
                        provide: MessageStripAlertRef,
                        useFactory: () => alertRef
                    },
                    patchLanguage((lang) => ({
                        coreMessageStrip: {
                            dismissLabel: config.messageStrip.dismissLabel || lang.coreMessageStrip.dismissLabel
                        }
                    }))
                ],
                parent: this.injector
            })),
            dismiss: () => {
                this._messageAlerts$.next(this._messageAlerts$.value.filter((item) => item.portal !== alertRef.portal));
                config.messageStrip && config.messageStrip.onDismiss && config.messageStrip.onDismiss();
                onDismiss$.next();
                onDismiss$.complete();
            },
            onDismiss$: onDismiss$.asObservable()
        };
        return alertRef;
    }
    /** @hidden */
    listenToItemsChanges() {
        combineLatest([this.viewportSize$, this._messageAlerts$.asObservable()])
            .pipe(map(([viewportSize, messageAlerts]) => {
            if (viewportSize < ResponsiveBreakpoints.M) {
                return messageAlerts.reduce((acc, next) => {
                    const position = next.position?.startsWith('top') ? 'top-middle' : 'bottom-middle';
                    acc[position] = [...(acc[position] || []), next.portal];
                    return acc;
                }, {});
            }
            return messageAlerts.reduce((acc, next) => {
                acc[next.position] = [...(acc[next.position] || []), next.portal];
                return acc;
            }, {});
        }), tap((messageAlertsByPosition) => {
            let topSectionIsOpened = false;
            let bottomSectionIsOpened = false;
            Object.entries(messageAlertsByPosition).forEach(([position, portals]) => {
                topSectionIsOpened = topSectionIsOpened || position.startsWith('top');
                bottomSectionIsOpened = bottomSectionIsOpened || position.startsWith('bottom');
                const { containerRef } = this.getOverlayRef(position);
                containerRef.instance.attachedElements = portals;
                containerRef.changeDetectorRef.detectChanges();
            });
            this.syncExistingOverlays(messageAlertsByPosition, bottomSectionIsOpened, topSectionIsOpened);
        }))
            .subscribe();
    }
    /** @hidden */
    syncExistingOverlays(messageAlertsByPosition, bottomSectionIsOpened, topSectionIsOpened) {
        Object.keys(this._overlayRefs).forEach((position) => {
            if (!messageAlertsByPosition[position]) {
                this._overlayRefs[position].ref.dispose();
                delete this._overlayRefs[position];
            }
            else {
                const ref = this._overlayRefs[position].ref;
                if (position.startsWith('top')) {
                    if (bottomSectionIsOpened) {
                        ref.overlayElement.classList.add('fd-message-strip-alert-overlay--bottom-opened');
                    }
                    else {
                        ref.overlayElement.classList.remove('fd-message-strip-alert-overlay--bottom-opened');
                    }
                }
                if (position.startsWith('bottom')) {
                    if (topSectionIsOpened) {
                        ref.overlayElement.classList.add('fd-message-strip-alert-overlay--top-opened');
                    }
                    else {
                        ref.overlayElement.classList.remove('fd-message-strip-alert-overlay--top-opened');
                    }
                }
            }
        });
    }
    /** @hidden */
    getOverlayRef(position) {
        if (!this._overlayRefs[position]) {
            const [verticalPosition, horizontalPosition] = position.split('-');
            const overlayRef = this.createOverlay(verticalPosition, horizontalPosition);
            const containerRef = overlayRef.attach(new ComponentPortal(MessageStripAlertContainerComponent, null, Injector.create({
                parent: this.injector,
                providers: [
                    {
                        provide: MessageStripAlertContainerPosition,
                        useValue: position
                    }
                ]
            })));
            this._overlayRefs[position] = { ref: overlayRef, containerRef };
        }
        return this._overlayRefs[position];
    }
    /** @hidden */
    createOverlay(verticalPosition, horizontalPosition) {
        return this._overlay.create({
            panelClass: [
                'fd-message-strip-alert-overlay',
                `fd-message-strip-alert-overlay--${verticalPosition}`,
                `fd-message-strip-alert-overlay--${horizontalPosition}`
            ],
            hasBackdrop: false
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripAlertService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripAlertService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripAlertService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [] });

const messageStripIndicationColors = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
const _messageStripIndicationColors = messageStripIndicationColors.reduce((acc, item) => {
    acc.push(item);
    acc.push(`${item}b`);
    return acc;
}, []);

class MessageStripModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.2", ngImport: i0, type: MessageStripModule, imports: [MessageStripComponent, AutoDismissMessageStripDirective, MessageStripIconDirective], exports: [MessageStripComponent, AutoDismissMessageStripDirective, MessageStripIconDirective] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripModule, imports: [MessageStripComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: MessageStripModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [MessageStripComponent, AutoDismissMessageStripDirective, MessageStripIconDirective],
                    exports: [MessageStripComponent, AutoDismissMessageStripDirective, MessageStripIconDirective]
                }]
        }] });

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

export { AutoDismissMessageStripDirective, MessageStripAlertContainerAlertRefs, MessageStripAlertContainerPosition, MessageStripAlertRef, MessageStripAlertService, MessageStripComponent, MessageStripIconDirective, MessageStripModule, _messageStripIndicationColors };
//# sourceMappingURL=fundamental-ngx-core-message-strip.mjs.map
