import * as i0 from '@angular/core';
import { InjectionToken, Injectable, Optional, Component, inject, Input, ChangeDetectionStrategy, ChangeDetectorRef, ContentChild, ViewChild, ViewEncapsulation, TemplateRef, signal, ComponentRef, EmbeddedViewRef, Type, HostListener, HostBinding, Directive, Injector, Inject, NgModule } from '@angular/core';
import { DialogConfigBase, DialogFooterBase, DialogHeaderBase, DialogRefBase, DialogBase, dialogFade, DialogBaseService, DialogContentBase } from '@fundamental-ngx/core/dialog';
import { __decorate, __metadata } from 'tslib';
import * as i3 from '@angular/cdk/portal';
import { PortalModule, CdkPortalOutlet, ComponentPortal } from '@angular/cdk/portal';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import * as i1 from '@fundamental-ngx/cdk/utils';
import { applyCssClass, InitialFocusDirective, DynamicComponentContainer, RtlService, TemplateModule, InitialFocusModule, DynamicComponentService } from '@fundamental-ngx/cdk/utils';
import { NgTemplateOutlet } from '@angular/common';
import { BarComponent, BarRightDirective, BarLeftDirective, BarElementDirective, ButtonBarComponent } from '@fundamental-ngx/core/bar';
import { ContentDensityDirective } from '@fundamental-ngx/core/content-density';
import { TitleComponent } from '@fundamental-ngx/core/title';
import { FD_DEFAULT_ICON_FONT_FAMILY, IconComponent } from '@fundamental-ngx/core/icon';
import * as i2 from '@angular/cdk/overlay';
import { OverlayConfig } from '@angular/cdk/overlay';

const MESSAGE_BOX_DEFAULT_CONFIG = new InjectionToken('Default MessageBoxConfig');
/** @hidden */
class MessageBoxHost {
}
class MessageBoxConfig extends DialogConfigBase {
    constructor() {
        super(...arguments);
        /** Whether to show the semantic icon */
        this.showSemanticIcon = false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxConfig, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxConfig }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxConfig, decorators: [{
            type: Injectable
        }] });

/**
 * Building block of the message box used to create message box body.
 *
 * ```html
 * <fd-message-box-body></fd-message-box-body>
 * ```
 */
class MessageBoxBodyComponent {
    /** @hidden */
    get messageBoxConfig() {
        return this.messageBox?._messageBoxConfig || {};
    }
    /** @hidden */
    constructor(messageBox) {
        this.messageBox = messageBox;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxBodyComponent, deps: [{ token: MessageBoxHost, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: MessageBoxBodyComponent, isStandalone: true, selector: "fd-message-box-body", host: { properties: { "class.fd-message-box__body": "true", "class.fd-message-box__body--no-vertical-padding": "!messageBoxConfig.verticalPadding" } }, ngImport: i0, template: `<section>
        <ng-content></ng-content>
    </section>`, isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxBodyComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'fd-message-box-body',
                    template: `<section>
        <ng-content></ng-content>
    </section>`,
                    host: {
                        '[class.fd-message-box__body]': 'true',
                        '[class.fd-message-box__body--no-vertical-padding]': '!messageBoxConfig.verticalPadding'
                    },
                    standalone: true
                }]
        }], ctorParameters: () => [{ type: MessageBoxHost, decorators: [{
                    type: Optional
                }] }] });

const MessageBoxButtonClass = 'fd-message-box__decisive-button';
/**
 * Building block of the message box used to create message box header.
 *
 * ```html
 * <fd-message-box-footer><!--Content--></fd-message-box-footer>
 *
 * Complex footer:
 * <fd-message-box-footer>
 *     <ng-template fdkTemplate="footer"><!--Content--></ng-template>
 * </fd-message-box-footer>
 * ```
 * */
class MessageBoxFooterComponent extends DialogFooterBase {
    constructor() {
        super(...arguments);
        this.messageBox = inject(MessageBoxHost, { optional: true });
    }
    /** @hidden */
    get messageBoxConfig() {
        return this.messageBox?._messageBoxConfig || {};
    }
    /** @hidden */
    ngAfterViewInit() {
        this._listenForButtonChanges(MessageBoxButtonClass);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxFooterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: MessageBoxFooterComponent, isStandalone: true, selector: "fd-message-box-footer", usesInheritance: true, ngImport: i0, template: "<footer fd-bar class=\"fd-message-box__footer\" barDesign=\"footer\" [fdCozy]=\"messageBoxConfig.mobile\">\n    <ng-template [ngTemplateOutlet]=\"footerTemplate() ? footerTemplate() : defaultTemplate\"></ng-template>\n    <ng-template #defaultTemplate>\n        <div fd-bar-right>\n            <ng-content></ng-content>\n        </div>\n    </ng-template>\n</footer>\n", dependencies: [{ kind: "component", type: BarComponent, selector: "[fd-bar]", inputs: ["class", "barDesign", "inPage", "inHomePage", "clear", "size", "role"] }, { 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: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: BarRightDirective, selector: "[fd-bar-right]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxFooterComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fd-message-box-footer', imports: [BarComponent, ContentDensityDirective, NgTemplateOutlet, BarRightDirective], template: "<footer fd-bar class=\"fd-message-box__footer\" barDesign=\"footer\" [fdCozy]=\"messageBoxConfig.mobile\">\n    <ng-template [ngTemplateOutlet]=\"footerTemplate() ? footerTemplate() : defaultTemplate\"></ng-template>\n    <ng-template #defaultTemplate>\n        <div fd-bar-right>\n            <ng-content></ng-content>\n        </div>\n    </ng-template>\n</footer>\n" }]
        }] });

/**
 * Message box element representing the semantic icon in the message box header.
 *
 * ```html
 * <fd-message-box-semantic-icon></fd-message-box-semantic-icon>
 * ```
 */
class MessageBoxSemanticIconComponent {
    /** @hidden */
    get messageBoxConfig() {
        return this.messageBox?._messageBoxConfig || {};
    }
    /** @hidden */
    constructor(messageBox) {
        this.messageBox = messageBox;
        /** Glyph font family */
        this.glyphFont = FD_DEFAULT_ICON_FONT_FAMILY;
    }
    /** @hidden */
    get _showSemanticIcon() {
        return !!this.messageBoxConfig.showSemanticIcon;
    }
    /** @hidden */
    get _getIcon() {
        return this.glyph || this.messageBoxConfig.customSemanticIcon || this._semanticIcon;
    }
    /** @hidden */
    get _semanticIcon() {
        switch (this.messageBoxConfig.type) {
            case 'error':
                return 'error';
            case 'success':
                return 'sys-enter-2';
            case 'warning':
                return 'alert';
            case 'information':
                return 'information';
            case 'confirmation':
                return 'sys-help-2';
            default:
                return '';
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxSemanticIconComponent, deps: [{ token: MessageBoxHost, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: MessageBoxSemanticIconComponent, isStandalone: true, selector: "fd-message-box-semantic-icon", inputs: { glyph: "glyph", glyphFont: "glyphFont" }, host: { attributes: { "role": "presentation" }, properties: { "attr.aria-hidden": "true" } }, ngImport: i0, template: `<fd-icon [glyph]="_getIcon" [font]="glyphFont" role="presentation"></fd-icon>`, isInline: true, dependencies: [{ kind: "component", type: IconComponent, selector: "fd-icon", inputs: ["glyph", "font", "color", "background", "class", "ariaLabel", "ariaHidden"], outputs: ["ariaHiddenChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxSemanticIconComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'fd-message-box-semantic-icon',
                    template: `<fd-icon [glyph]="_getIcon" [font]="glyphFont" role="presentation"></fd-icon>`,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    imports: [IconComponent],
                    host: {
                        role: 'presentation',
                        '[attr.aria-hidden]': 'true'
                    }
                }]
        }], ctorParameters: () => [{ type: MessageBoxHost, decorators: [{
                    type: Optional
                }] }], propDecorators: { glyph: [{
                type: Input
            }], glyphFont: [{
                type: Input
            }] } });

/**
 * Building block of the message box used to create message box header.
 *
 * ```html
 * <fd-message-box-header>
 *     <fd-message-box-semantic-icon></fd-message-box-semantic-icon>
 *     <h1 fd-title><!-- Content --></h1>
 * </fd-message-box-header>
 *
 * Complex header:
 * <fd-message-box-header>
 *     <ng-template fdkTemplate="header"><!--Content--></ng-template>
 *     <ng-template fdkTemplate="subheader"><!--Content--></ng-template>
 * </fd-message-box-header>
 * ```
 */
class MessageBoxHeaderComponent extends DialogHeaderBase {
    constructor() {
        super(...arguments);
        /** @hidden */
        this._cdr = inject(ChangeDetectorRef);
        /** @hidden */
        this._messageBox = inject(MessageBoxHost, { optional: true });
    }
    /** @hidden */
    get messageBoxConfig() {
        return this._messageBox?._messageBoxConfig || {};
    }
    /** @hidden */
    get _showSemanticIcon() {
        return (!this._projectedSemanticIcon &&
            ((this.messageBoxConfig.type && this.messageBoxConfig.showSemanticIcon) ||
                !!this.messageBoxConfig.customSemanticIcon));
    }
    /** @hidden */
    ngAfterViewInit() {
        // need to re-check bindings after initialisation in order to reflect the proper state of "_showSemanticIcon" getter
        // running this in next microtask to avoid "ExpressionChangedAfterItHasBeenCheckedError"
        Promise.resolve().then(() => this._cdr.markForCheck());
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxHeaderComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: MessageBoxHeaderComponent, isStandalone: true, selector: "fd-message-box-header", queries: [{ propertyName: "_projectedSemanticIcon", first: true, predicate: MessageBoxSemanticIconComponent, descendants: true }], viewQueries: [{ propertyName: "defaultTemplateHeaderBar", first: true, predicate: ["defaultTemplateHeaderBar"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<header>\n    <div\n        fd-bar\n        role=\"group\"\n        class=\"fd-message-box__header\"\n        [fdCozy]=\"messageBoxConfig.mobile\"\n        [barDesign]=\"subHeaderTemplate() ? 'header-with-subheader' : 'header'\"\n    >\n        <ng-template [ngTemplateOutlet]=\"headerTemplate() ? headerTemplate() : defaultTemplate\"></ng-template>\n        <ng-template #defaultTemplate>\n            <div fd-bar-left>\n                <fd-bar-element #defaultTemplateHeaderBar>\n                    @if (_showSemanticIcon) {\n                        <fd-message-box-semantic-icon\n                            class=\"fd-message-box__internal-semantic-icon\"\n                        ></fd-message-box-semantic-icon>\n                    }\n                    <ng-content select=\"fd-message-box-semantic-icon\"></ng-content>\n                    <ng-content select=\"[fd-title]\"></ng-content>\n                </fd-bar-element>\n            </div>\n        </ng-template>\n    </div>\n    @if (subHeaderTemplate()) {\n        <div fd-bar class=\"fd-message-box__subheader\" barDesign=\"subheader\" [fdCozy]=\"messageBoxConfig.mobile\">\n            <ng-template [ngTemplateOutlet]=\"subHeaderTemplate()\"></ng-template>\n        </div>\n    }\n</header>\n", dependencies: [{ kind: "component", type: BarComponent, selector: "[fd-bar]", inputs: ["class", "barDesign", "inPage", "inHomePage", "clear", "size", "role"] }, { 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: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: BarLeftDirective, selector: "[fd-bar-left]" }, { kind: "directive", type: BarElementDirective, selector: "fd-bar-element", inputs: ["fullWidth"] }, { kind: "component", type: MessageBoxSemanticIconComponent, selector: "fd-message-box-semantic-icon", inputs: ["glyph", "glyphFont"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxHeaderComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fd-message-box-header', imports: [
                        BarComponent,
                        ContentDensityDirective,
                        NgTemplateOutlet,
                        BarLeftDirective,
                        BarElementDirective,
                        MessageBoxSemanticIconComponent
                    ], template: "<header>\n    <div\n        fd-bar\n        role=\"group\"\n        class=\"fd-message-box__header\"\n        [fdCozy]=\"messageBoxConfig.mobile\"\n        [barDesign]=\"subHeaderTemplate() ? 'header-with-subheader' : 'header'\"\n    >\n        <ng-template [ngTemplateOutlet]=\"headerTemplate() ? headerTemplate() : defaultTemplate\"></ng-template>\n        <ng-template #defaultTemplate>\n            <div fd-bar-left>\n                <fd-bar-element #defaultTemplateHeaderBar>\n                    @if (_showSemanticIcon) {\n                        <fd-message-box-semantic-icon\n                            class=\"fd-message-box__internal-semantic-icon\"\n                        ></fd-message-box-semantic-icon>\n                    }\n                    <ng-content select=\"fd-message-box-semantic-icon\"></ng-content>\n                    <ng-content select=\"[fd-title]\"></ng-content>\n                </fd-bar-element>\n            </div>\n        </ng-template>\n    </div>\n    @if (subHeaderTemplate()) {\n        <div fd-bar class=\"fd-message-box__subheader\" barDesign=\"subheader\" [fdCozy]=\"messageBoxConfig.mobile\">\n            <ng-template [ngTemplateOutlet]=\"subHeaderTemplate()\"></ng-template>\n        </div>\n    }\n</header>\n" }]
        }], propDecorators: { defaultTemplateHeaderBar: [{
                type: ViewChild,
                args: ['defaultTemplateHeaderBar']
            }], _projectedSemanticIcon: [{
                type: ContentChild,
                args: [MessageBoxSemanticIconComponent]
            }] } });

const CSS_CLASS_NAME = {
    messageBox: 'fd-message-box',
    messageBoxActive: 'fd-message-box--active',
    messageBoxTypeError: 'fd-message-box--error',
    messageBoxTypeWarning: 'fd-message-box--warning',
    messageBoxTypeSuccess: 'fd-message-box--success',
    messageBoxTypeInformation: 'fd-message-box--information',
    messageBoxTypeConfirmation: 'fd-message-box--confirmation'
};

class MessageBoxRef extends DialogRefBase {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxRef, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxRef }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxRef, decorators: [{
            type: Injectable
        }] });

/**
 * Message box component.
 *
 * ```html
 * <fd-message-box>
 *      <fd-message-box-header></fd-message-box-header>
 *      <fd-message-box-body></fd-message-box-body>
 *      <fd-message-box-footer></fd-message-box-footer>
 * </fd-message-box>
 * ```
 */
class MessageBoxComponent extends DialogBase {
    /** Custom classes */
    set class(userClass) {
        this._class = userClass;
    }
    /** MessageBoxRef - should be used for Template based Dialog implementation  */
    // eslint-disable-next-line @angular-eslint/no-input-rename
    set embeddedMessageBoxRef(value) {
        this._messageBoxRef = value;
    }
    /** MessageBoxConfig - should be used for Template based Dialog implementation  */
    // eslint-disable-next-line @angular-eslint/no-input-rename
    set embeddedMessageBoxConfig(value) {
        this._messageBoxConfig = value;
    }
    /** @hidden */
    get _config() {
        return this._messageBoxConfig;
    }
    /** @hidden */
    get _ref() {
        return this._messageBoxRef;
    }
    /** @hidden */
    constructor(_messageBoxConfig, _messageBoxRef) {
        super();
        this._messageBoxConfig = _messageBoxConfig;
        this._messageBoxRef = _messageBoxRef;
        /** @hidden */
        this._class = '';
    }
    /** @hidden */
    buildComponentCssClass() {
        return [
            CSS_CLASS_NAME.messageBoxActive,
            this._messageBoxTypeClass,
            this._messageBoxConfig.hasBackdrop ? CSS_CLASS_NAME.messageBox : '',
            this._messageBoxConfig.backdropClass ? this._messageBoxConfig.backdropClass : '',
            this._class
        ];
    }
    /** @hidden */
    ngOnInit() {
        this.buildComponentCssClass();
    }
    /** @hidden */
    ngOnChanges() {
        this.buildComponentCssClass();
    }
    /** @hidden */
    ngAfterViewInit() {
        // Manually call parent setup methods for test environments where afterNextRender may not execute
        if (this.dialogWindow) {
            this.setupFocusTrap();
            this.applyStyles();
            this.setupResizeObserver();
            this._ref?.loaded();
        }
    }
    /** @hidden */
    ngOnDestroy() {
        super.ngOnDestroy();
    }
    /** @hidden */
    get _messageBoxTypeClass() {
        switch (this._config.type) {
            case 'error':
                return CSS_CLASS_NAME.messageBoxTypeError;
            case 'success':
                return CSS_CLASS_NAME.messageBoxTypeSuccess;
            case 'warning':
                return CSS_CLASS_NAME.messageBoxTypeWarning;
            case 'information':
                return CSS_CLASS_NAME.messageBoxTypeInformation;
            case 'confirmation':
                return CSS_CLASS_NAME.messageBoxTypeConfirmation;
            default:
                return '';
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxComponent, deps: [{ token: MessageBoxConfig, optional: true }, { token: MessageBoxRef, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: MessageBoxComponent, isStandalone: true, selector: "fd-message-box", inputs: { class: "class", embeddedMessageBoxRef: ["messageBoxRef", "embeddedMessageBoxRef"], embeddedMessageBoxConfig: ["messageBoxConfig", "embeddedMessageBoxConfig"] }, host: { attributes: { "tabindex": "-1" } }, providers: [{ provide: MessageBoxHost, useExisting: MessageBoxComponent }], viewQueries: [{ propertyName: "dialogWindow", first: true, predicate: ["dialogWindow"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div\n    #dialogWindow\n    role=\"alertdialog\"\n    tabindex=\"-1\"\n    aria-modal=\"true\"\n    [class]=\"_messageBoxConfig.dialogPanelClass\"\n    [class.fd-message-box__content]=\"true\"\n    [class.fd-message-box__content--s]=\"dialogPaddingSize() === 'sm'\"\n    [class.fd-message-box__content--m]=\"dialogPaddingSize() === 'md'\"\n    [class.fd-message-box__content--l]=\"dialogPaddingSize() === 'lg'\"\n    [class.fd-message-box__content--xl]=\"dialogPaddingSize() === 'xl'\"\n    [class.fd-message-box__content--mobile]=\"_messageBoxConfig.mobile\"\n    [class.fd-message-box__content--no-mobile-stretch]=\"_messageBoxConfig.mobileOuterSpacing\"\n    [attr.id]=\"_messageBoxConfig.id\"\n    [attr.aria-label]=\"_messageBoxConfig.ariaLabel\"\n    [attr.aria-labelledby]=\"_messageBoxConfig.ariaLabelledBy\"\n    [attr.aria-describedby]=\"_messageBoxConfig.ariaDescribedBy\"\n>\n    <ng-content select=\"fd-message-box-header\"></ng-content>\n    <ng-content select=\"fd-message-box-body\"></ng-content>\n    <ng-content select=\"fd-message-box-footer\"></ng-content>\n</div>\n", styles: [".fd-message-box{position:fixed;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;height:100%;justify-content:center;left:0;top:0;width:100%}.fd-message-box:before{background-color:var(--sapBlockLayer_Background);content:\"\";height:100%;left:0;opacity:var(--sapBlockLayer_Opacity);position:absolute;top:0;width:100%}.fd-message-box__content{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;border-radius:var(--sapElement_BorderCornerRadius);-webkit-box-shadow:var(--sapContent_Shadow3);box-shadow:var(--sapContent_Shadow3);-ms-flex-direction:column;flex-direction:column;max-height:calc(100vh - 6%);max-width:calc(100vw - 10%);min-height:7.5rem;min-width:20rem;outline:none;position:absolute}.fd-message-box__body{overflow:auto;-webkit-box-flex:1;-ms-flex-positive:1;background-color:var(--sapGroup_ContentBackground);flex-grow:1}.fd-message-box__content--mobile{border-radius:0;height:100vh;max-height:100vh;max-width:100vw;width:100vw}.fd-message-box__title{font-size:1rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-message-box{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);display:none;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}.fd-message-box:after,.fd-message-box:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box__content{border:0;-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;line-height:normal;margin-block:0;margin-inline:0;overflow:hidden;padding-block:0;padding-inline:0}.fd-message-box__content:after,.fd-message-box__content:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box__content--s .fd-message-box__body,.fd-message-box__content--s .fd-message-box__footer,.fd-message-box__content--s .fd-message-box__header{--fdBar_Padding_X:1rem;--fdMessageBox_Body_Inline_Padding:1rem}.fd-message-box__content--l .fd-message-box__body,.fd-message-box__content--l .fd-message-box__footer,.fd-message-box__content--l .fd-message-box__header,.fd-message-box__content--m .fd-message-box__body,.fd-message-box__content--m .fd-message-box__footer,.fd-message-box__content--m .fd-message-box__header{--fdBar_Padding_X:2rem;--fdMessageBox_Body_Inline_Padding:2rem}.fd-message-box__content--xl .fd-message-box__body,.fd-message-box__content--xl .fd-message-box__footer,.fd-message-box__content--xl .fd-message-box__header{--fdBar_Padding_X:3rem;--fdMessageBox_Body_Inline_Padding:3rem}.fd-message-box__footer .fd-message-box__decisive-button{--fdButton_Min_Width:4rem}.fd-message-box__body{border:0;-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;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-block:1rem;padding-inline:0;padding-inline:var(--fdMessageBox_Body_Inline_Padding,1rem)}.fd-message-box__body:after,.fd-message-box__body:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box__title{border:0;-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;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0}.fd-message-box__title:after,.fd-message-box__title:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box__more{border:0;-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;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;-webkit-margin-before:1rem;margin-block-start:1rem}.fd-message-box__more:after,.fd-message-box__more:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box--active{display:-webkit-box;display:-ms-flexbox;display:flex}.fd-message-box--confirmation .fd-message-box__header{--fdBar_Shadow:var(--sapContent_HeaderShadow)}.fd-message-box--confirmation .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapNeutralElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box--error .fd-message-box__header{--fdBar_Shadow:var(--sapContent_Error_HeaderShadow)}.fd-message-box--error .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapNegativeElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box--success .fd-message-box__header{--fdBar_Shadow:var(--sapContent_Success_HeaderShadow)}.fd-message-box--success .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapPositiveElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box--warning .fd-message-box__header{--fdBar_Shadow:var(--sapContent_Warning_HeaderShadow)}.fd-message-box--warning .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapCriticalElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box--information .fd-message-box__header{--fdBar_Shadow:var(--sapContent_Information_HeaderShadow)}.fd-message-box--information .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapInformativeElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box[class*=-compact] .fd-message-box__decisive-button,.fd-message-box[class*=-condensed] .fd-message-box__decisive-button,[class*=-compact] .fd-message-box:not([class*=-cozy]) .fd-message-box__decisive-button,[class*=-condensed] .fd-message-box:not([class*=-cozy]) .fd-message-box__decisive-button{--fdButton_Min_Width:4rem}.fd-message-box{z-index:1000}.fd-message-box__header [class*=sap-icon]{margin-right:.5rem}.fd-message-box__header[dir=rtl] [class*=sap-icon],[dir=rtl] .fd-message-box__header [class*=sap-icon]{margin-right:0;margin-left:.5rem}.fd-message-box .fd-message-box__header .fd-title[class*=fd-title--h]{--fdTitle_Font_Size: var(--sapFontHeader5Size)}\n/*! Bundled license information:\n\nfundamental-styles/dist/message-box.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"], encapsulation: i0.ViewEncapsulation.None }); }
}
__decorate([
    applyCssClass,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Array)
], MessageBoxComponent.prototype, "buildComponentCssClass", null);
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fd-message-box', host: {
                        tabindex: '-1'
                    }, encapsulation: ViewEncapsulation.None, providers: [{ provide: MessageBoxHost, useExisting: MessageBoxComponent }], standalone: true, template: "<div\n    #dialogWindow\n    role=\"alertdialog\"\n    tabindex=\"-1\"\n    aria-modal=\"true\"\n    [class]=\"_messageBoxConfig.dialogPanelClass\"\n    [class.fd-message-box__content]=\"true\"\n    [class.fd-message-box__content--s]=\"dialogPaddingSize() === 'sm'\"\n    [class.fd-message-box__content--m]=\"dialogPaddingSize() === 'md'\"\n    [class.fd-message-box__content--l]=\"dialogPaddingSize() === 'lg'\"\n    [class.fd-message-box__content--xl]=\"dialogPaddingSize() === 'xl'\"\n    [class.fd-message-box__content--mobile]=\"_messageBoxConfig.mobile\"\n    [class.fd-message-box__content--no-mobile-stretch]=\"_messageBoxConfig.mobileOuterSpacing\"\n    [attr.id]=\"_messageBoxConfig.id\"\n    [attr.aria-label]=\"_messageBoxConfig.ariaLabel\"\n    [attr.aria-labelledby]=\"_messageBoxConfig.ariaLabelledBy\"\n    [attr.aria-describedby]=\"_messageBoxConfig.ariaDescribedBy\"\n>\n    <ng-content select=\"fd-message-box-header\"></ng-content>\n    <ng-content select=\"fd-message-box-body\"></ng-content>\n    <ng-content select=\"fd-message-box-footer\"></ng-content>\n</div>\n", styles: [".fd-message-box{position:fixed;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;height:100%;justify-content:center;left:0;top:0;width:100%}.fd-message-box:before{background-color:var(--sapBlockLayer_Background);content:\"\";height:100%;left:0;opacity:var(--sapBlockLayer_Opacity);position:absolute;top:0;width:100%}.fd-message-box__content{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;border-radius:var(--sapElement_BorderCornerRadius);-webkit-box-shadow:var(--sapContent_Shadow3);box-shadow:var(--sapContent_Shadow3);-ms-flex-direction:column;flex-direction:column;max-height:calc(100vh - 6%);max-width:calc(100vw - 10%);min-height:7.5rem;min-width:20rem;outline:none;position:absolute}.fd-message-box__body{overflow:auto;-webkit-box-flex:1;-ms-flex-positive:1;background-color:var(--sapGroup_ContentBackground);flex-grow:1}.fd-message-box__content--mobile{border-radius:0;height:100vh;max-height:100vh;max-width:100vw;width:100vw}.fd-message-box__title{font-size:1rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-message-box{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);display:none;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}.fd-message-box:after,.fd-message-box:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box__content{border:0;-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;line-height:normal;margin-block:0;margin-inline:0;overflow:hidden;padding-block:0;padding-inline:0}.fd-message-box__content:after,.fd-message-box__content:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box__content--s .fd-message-box__body,.fd-message-box__content--s .fd-message-box__footer,.fd-message-box__content--s .fd-message-box__header{--fdBar_Padding_X:1rem;--fdMessageBox_Body_Inline_Padding:1rem}.fd-message-box__content--l .fd-message-box__body,.fd-message-box__content--l .fd-message-box__footer,.fd-message-box__content--l .fd-message-box__header,.fd-message-box__content--m .fd-message-box__body,.fd-message-box__content--m .fd-message-box__footer,.fd-message-box__content--m .fd-message-box__header{--fdBar_Padding_X:2rem;--fdMessageBox_Body_Inline_Padding:2rem}.fd-message-box__content--xl .fd-message-box__body,.fd-message-box__content--xl .fd-message-box__footer,.fd-message-box__content--xl .fd-message-box__header{--fdBar_Padding_X:3rem;--fdMessageBox_Body_Inline_Padding:3rem}.fd-message-box__footer .fd-message-box__decisive-button{--fdButton_Min_Width:4rem}.fd-message-box__body{border:0;-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;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-block:1rem;padding-inline:0;padding-inline:var(--fdMessageBox_Body_Inline_Padding,1rem)}.fd-message-box__body:after,.fd-message-box__body:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box__title{border:0;-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;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0}.fd-message-box__title:after,.fd-message-box__title:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box__more{border:0;-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;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;-webkit-margin-before:1rem;margin-block-start:1rem}.fd-message-box__more:after,.fd-message-box__more:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-message-box--active{display:-webkit-box;display:-ms-flexbox;display:flex}.fd-message-box--confirmation .fd-message-box__header{--fdBar_Shadow:var(--sapContent_HeaderShadow)}.fd-message-box--confirmation .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapNeutralElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box--error .fd-message-box__header{--fdBar_Shadow:var(--sapContent_Error_HeaderShadow)}.fd-message-box--error .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapNegativeElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box--success .fd-message-box__header{--fdBar_Shadow:var(--sapContent_Success_HeaderShadow)}.fd-message-box--success .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapPositiveElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box--warning .fd-message-box__header{--fdBar_Shadow:var(--sapContent_Warning_HeaderShadow)}.fd-message-box--warning .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapCriticalElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box--information .fd-message-box__header{--fdBar_Shadow:var(--sapContent_Information_HeaderShadow)}.fd-message-box--information .fd-message-box__header :not(button)>[class*=sap-icon]{--fdIcon_Font_Size:1rem;--fdIcon_Color:var(--sapInformativeElementColor);-webkit-margin-end:.5rem;margin-inline-end:.5rem}.fd-message-box[class*=-compact] .fd-message-box__decisive-button,.fd-message-box[class*=-condensed] .fd-message-box__decisive-button,[class*=-compact] .fd-message-box:not([class*=-cozy]) .fd-message-box__decisive-button,[class*=-condensed] .fd-message-box:not([class*=-cozy]) .fd-message-box__decisive-button{--fdButton_Min_Width:4rem}.fd-message-box{z-index:1000}.fd-message-box__header [class*=sap-icon]{margin-right:.5rem}.fd-message-box__header[dir=rtl] [class*=sap-icon],[dir=rtl] .fd-message-box__header [class*=sap-icon]{margin-right:0;margin-left:.5rem}.fd-message-box .fd-message-box__header .fd-title[class*=fd-title--h]{--fdTitle_Font_Size: var(--sapFontHeader5Size)}\n/*! Bundled license information:\n\nfundamental-styles/dist/message-box.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: MessageBoxConfig, decorators: [{
                    type: Optional
                }] }, { type: MessageBoxRef, decorators: [{
                    type: Optional
                }] }], propDecorators: { class: [{
                type: Input
            }], embeddedMessageBoxRef: [{
                type: Input,
                args: ['messageBoxRef']
            }], embeddedMessageBoxConfig: [{
                type: Input,
                args: ['messageBoxConfig']
            }], dialogWindow: [{
                type: ViewChild,
                args: ['dialogWindow']
            }], buildComponentCssClass: [] } });

let mbTitleId = 0;
let mbContentId = 0;
/** Message box component used to create the message box in object based approach */
class MessageBoxDefaultComponent {
    /** @hidden */
    constructor(_messageBoxConfig, _changeDetectorRef) {
        this._messageBoxConfig = _messageBoxConfig;
        this._changeDetectorRef = _changeDetectorRef;
        /**
         * message box title id
         * if not set, a default value is provided
         */
        this.messageBoxTitleId = 'fd-message-box-title-id-' + mbTitleId++;
        /**
         * message box content id
         * if not set, a default value is provided
         */
        this.messageBoxContentId = 'fd-message-box-content-id-' + mbContentId++;
    }
    /** @hidden */
    ngOnInit() {
        this._footerVisible = !!(this._messageBoxContent?.cancelButton || this._messageBoxContent?.approveButton);
    }
    /** @hidden */
    ngAfterViewInit() {
        this._setContentTemplate();
        /**
         * If the configuration object doesn't provide values for ariaLabelledBy and/or ariaDescribedBy
         * use the default generated ids for title and content
         */
        if (this._messageBoxConfig) {
            this._messageBoxConfig.ariaLabelledBy ??= this.messageBoxTitleId;
            this._messageBoxConfig.ariaDescribedBy ??= this.messageBoxContentId;
        }
    }
    /** @hidden */
    _onCloseButton() {
        this._messageBoxContent?.closeButtonCallback?.();
    }
    /** @hidden */
    _onApproveButton() {
        this._messageBoxContent?.approveButtonCallback?.();
    }
    /** @hidden */
    _onCancelButton() {
        this._messageBoxContent?.cancelButtonCallback?.();
    }
    /** @hidden */
    _setContentTemplate() {
        this._contentTemplate =
            this._messageBoxContent?.content instanceof TemplateRef
                ? this._messageBoxContent.content
                : this._textContentTemplate;
        this._changeDetectorRef.detectChanges();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxDefaultComponent, deps: [{ token: MessageBoxConfig }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: MessageBoxDefaultComponent, isStandalone: true, selector: "fd-message-box-default", viewQueries: [{ propertyName: "_textContentTemplate", first: true, predicate: ["textContent"], descendants: true }], ngImport: i0, template: "@if (_messageBoxContent) {\n    <fd-message-box>\n        <fd-message-box-header>\n            <div\n                fd-title\n                role=\"heading\"\n                [ariaLevel]=\"_messageBoxContent.titleHeadingLevel || 2\"\n                [id]=\"_messageBoxContent.titleId || messageBoxTitleId\"\n            >\n                {{ _messageBoxContent.title }}\n            </div>\n        </fd-message-box-header>\n        <fd-message-box-body [id]=\"_messageBoxContent.contentId || messageBoxContentId\">\n            <ng-template [ngTemplateOutlet]=\"_contentTemplate\"></ng-template>\n        </fd-message-box-body>\n        @if (_footerVisible) {\n            <fd-message-box-footer>\n                @if (_messageBoxContent.approveButton) {\n                    <fd-button-bar\n                        fdkInitialFocus\n                        fdType=\"emphasized\"\n                        [label]=\"_messageBoxContent.approveButton\"\n                        [ariaLabel]=\"_messageBoxContent.approveButtonAriaLabel\"\n                        [id]=\"_messageBoxContent.approveButtonId || ''\"\n                        [fdCompact]=\"!_messageBoxConfig.mobile\"\n                        (click)=\"_onApproveButton()\"\n                    >\n                    </fd-button-bar>\n                }\n                @if (_messageBoxContent.cancelButton) {\n                    <fd-button-bar\n                        [label]=\"_messageBoxContent.cancelButton\"\n                        [ariaLabel]=\"_messageBoxContent.closeButtonAriaLabel\"\n                        [id]=\"_messageBoxContent.cancelButtonId || ''\"\n                        [fdCompact]=\"!_messageBoxConfig.mobile\"\n                        (click)=\"_onCancelButton()\"\n                    >\n                    </fd-button-bar>\n                }\n            </fd-message-box-footer>\n        }\n    </fd-message-box>\n}\n<ng-template #textContent>\n    {{ _messageBoxContent?.content }}\n</ng-template>\n", dependencies: [{ kind: "component", type: MessageBoxComponent, selector: "fd-message-box", inputs: ["class", "messageBoxRef", "messageBoxConfig"] }, { kind: "component", type: MessageBoxHeaderComponent, selector: "fd-message-box-header" }, { kind: "component", type: TitleComponent, selector: "[fd-title], [fdTitle]", inputs: ["headerSize", "wrap"], exportAs: ["fd-title"] }, { kind: "component", type: MessageBoxBodyComponent, selector: "fd-message-box-body" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MessageBoxFooterComponent, selector: "fd-message-box-footer" }, { kind: "component", type: ButtonBarComponent, selector: "fd-button-bar", inputs: ["fullWidth", "fdType", "title", "ariaLabelledby", "id"] }, { kind: "directive", type: InitialFocusDirective, selector: "[fdkInitialFocus]", inputs: ["fdkInitialFocus", "enabled", "focusLastElement"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxDefaultComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fd-message-box-default', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
                        MessageBoxComponent,
                        MessageBoxHeaderComponent,
                        TitleComponent,
                        MessageBoxBodyComponent,
                        NgTemplateOutlet,
                        MessageBoxFooterComponent,
                        ButtonBarComponent,
                        InitialFocusDirective,
                        ContentDensityDirective
                    ], template: "@if (_messageBoxContent) {\n    <fd-message-box>\n        <fd-message-box-header>\n            <div\n                fd-title\n                role=\"heading\"\n                [ariaLevel]=\"_messageBoxContent.titleHeadingLevel || 2\"\n                [id]=\"_messageBoxContent.titleId || messageBoxTitleId\"\n            >\n                {{ _messageBoxContent.title }}\n            </div>\n        </fd-message-box-header>\n        <fd-message-box-body [id]=\"_messageBoxContent.contentId || messageBoxContentId\">\n            <ng-template [ngTemplateOutlet]=\"_contentTemplate\"></ng-template>\n        </fd-message-box-body>\n        @if (_footerVisible) {\n            <fd-message-box-footer>\n                @if (_messageBoxContent.approveButton) {\n                    <fd-button-bar\n                        fdkInitialFocus\n                        fdType=\"emphasized\"\n                        [label]=\"_messageBoxContent.approveButton\"\n                        [ariaLabel]=\"_messageBoxContent.approveButtonAriaLabel\"\n                        [id]=\"_messageBoxContent.approveButtonId || ''\"\n                        [fdCompact]=\"!_messageBoxConfig.mobile\"\n                        (click)=\"_onApproveButton()\"\n                    >\n                    </fd-button-bar>\n                }\n                @if (_messageBoxContent.cancelButton) {\n                    <fd-button-bar\n                        [label]=\"_messageBoxContent.cancelButton\"\n                        [ariaLabel]=\"_messageBoxContent.closeButtonAriaLabel\"\n                        [id]=\"_messageBoxContent.cancelButtonId || ''\"\n                        [fdCompact]=\"!_messageBoxConfig.mobile\"\n                        (click)=\"_onCancelButton()\"\n                    >\n                    </fd-button-bar>\n                }\n            </fd-message-box-footer>\n        }\n    </fd-message-box>\n}\n<ng-template #textContent>\n    {{ _messageBoxContent?.content }}\n</ng-template>\n" }]
        }], ctorParameters: () => [{ type: MessageBoxConfig }, { type: i0.ChangeDetectorRef }], propDecorators: { _textContentTemplate: [{
                type: ViewChild,
                args: ['textContent']
            }] } });

/** Message box container where the message box content is embedded. */
class MessageBoxContainerComponent extends DynamicComponentContainer {
    /** Custom classes */
    set class(userClass) {
        this._class = userClass;
        this.buildComponentCssClass();
    }
    /** The state of the Dialog animations. */
    get _animationState() {
        return this._animationStateSignal();
    }
    /** @hidden */
    constructor(messageBoxConfig, ref, _destroyRef, elementRef, _cdr, injector) {
        super(elementRef, injector);
        this.messageBoxConfig = messageBoxConfig;
        this.ref = ref;
        this._destroyRef = _destroyRef;
        this._cdr = _cdr;
        /** @hidden */
        this._class = '';
        /** @hidden */
        this._animationStateSignal = signal('void', ...(ngDevMode ? [{ debugName: "_animationStateSignal" }] : []));
    }
    /** @hidden */
    buildComponentCssClass() {
        return [this.messageBoxConfig.containerClass ? this.messageBoxConfig.containerClass : '', this._class];
    }
    /** Handle end of animations, updating the state of the Message Toast. */
    onAnimationEnd(event) {
        const { toState } = event;
        if (toState === 'hidden') {
            this.ref._endClose$.next();
            this.ref._endClose$.complete();
        }
    }
    /** @hidden */
    ngAfterViewInit() {
        setTimeout(() => {
            this._loadContent();
            this._listenOnClose();
        });
    }
    /** @hidden */
    _attached(event) {
        if (event instanceof ComponentRef) {
            event.changeDetectorRef.markForCheck();
        }
        else if (event instanceof EmbeddedViewRef) {
            event.markForCheck();
        }
    }
    /** @hidden Load received content */
    _loadContent() {
        if (this.childContent instanceof Type) {
            this._createFromComponent(this.childContent);
        }
        else if (this.childContent instanceof TemplateRef) {
            this._createFromTemplate(this.childContent, this._templateContext());
        }
        else {
            this._createFromDefaultMessageBox(this.childContent ?? null);
        }
        this._animationStateSignal.set('visible');
        this._cdr.detectChanges();
    }
    /** @hidden Returns context for embedded template*/
    _templateContext() {
        return { $implicit: this.ref, messageBoxConfig: this.messageBoxConfig };
    }
    /** @hidden Load Dialog component from passed object */
    _createFromDefaultMessageBox(content) {
        this._createFromComponent(MessageBoxDefaultComponent);
        const instance = this._componentRef.instance;
        instance._messageBoxContent = content;
    }
    /**
     * @hidden
     * We need to wait until animation plays, and then send signal to the service to destroy the component.
     */
    _listenOnClose() {
        const callback = () => {
            this._animationStateSignal.set('hidden');
            this._cdr.detectChanges();
        };
        this.ref.afterClosed.pipe(takeUntilDestroyed(this._destroyRef)).subscribe({
            next: () => callback(),
            error: () => callback()
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxContainerComponent, deps: [{ token: MessageBoxConfig }, { token: MessageBoxRef }, { token: i0.DestroyRef }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: MessageBoxContainerComponent, isStandalone: true, selector: "fd-message-box-container", inputs: { class: "class" }, host: { listeners: { "@state.done": "onAnimationEnd($event)" }, properties: { "@state": "this._animationState" } }, viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true }], usesInheritance: true, ngImport: i0, template: '<ng-template (attached)="_attached($event)" cdkPortalOutlet></ng-template>', isInline: true, dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i3.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [dialogFade] }); }
}
__decorate([
    applyCssClass,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Array)
], MessageBoxContainerComponent.prototype, "buildComponentCssClass", null);
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxContainerComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'fd-message-box-container',
                    template: '<ng-template (attached)="_attached($event)" cdkPortalOutlet></ng-template>',
                    animations: [dialogFade],
                    imports: [PortalModule]
                }]
        }], ctorParameters: () => [{ type: MessageBoxConfig }, { type: MessageBoxRef }, { type: i0.DestroyRef }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }], propDecorators: { class: [{
                type: Input
            }], _animationState: [{
                type: HostBinding,
                args: ['@state']
            }], portalOutlet: [{
                type: ViewChild,
                args: [CdkPortalOutlet]
            }], buildComponentCssClass: [], onAnimationEnd: [{
                type: HostListener,
                args: ['@state.done', ['$event']]
            }] } });

class MessageBoxTemplateDirective {
    constructor() {
        /** @hidden */
        this.templateRef = inject((TemplateRef));
    }
    /** @hidden */
    static ngTemplateContextGuard(dir, ctx) {
        return true;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: MessageBoxTemplateDirective, isStandalone: true, selector: "[fdMessageBoxTemplate]", inputs: { fdMessageBoxTemplateConfig: "fdMessageBoxTemplateConfig" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxTemplateDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[fdMessageBoxTemplate]',
                    standalone: true
                }]
        }], propDecorators: { fdMessageBoxTemplateConfig: [{
                type: Input
            }] } });

/** Service used to create a message box. */
class MessageBoxService extends DialogBaseService {
    /** @hidden */
    constructor(_defaultConfig, _rtlService, _overlay) {
        super();
        this._defaultConfig = _defaultConfig;
        this._rtlService = _rtlService;
        this._overlay = _overlay;
    }
    /**
     * Opens a message box component with provided content.
     * @param content Content of the message box component.
     * @param config Configuration of the message box component.
     */
    open(content, config) {
        const messageBoxRef = new MessageBoxRef();
        config = this._applyDefaultConfig(config || {}, this._defaultConfig || new MessageBoxConfig());
        messageBoxRef.data = config.data;
        const injector = Injector.create({
            providers: [
                { provide: MessageBoxConfig, useValue: config },
                { provide: MessageBoxRef, useValue: messageBoxRef },
                { provide: RtlService, useValue: this._rtlService }
            ],
            parent: config.injector
        });
        const overlayRef = this._overlay.create(new OverlayConfig());
        const portal = new ComponentPortal(MessageBoxContainerComponent, null, injector);
        const componentRef = overlayRef.attach(portal);
        componentRef.instance.childContent = content;
        componentRef.instance.messageBoxConfig = config;
        // Register dialog for tracking (replaces manual push)
        this._registerDialog(componentRef);
        messageBoxRef._endClose$.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
            this._destroyDialog(componentRef);
            overlayRef.dispose();
        });
        return messageBoxRef;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxService, deps: [{ token: MESSAGE_BOX_DEFAULT_CONFIG, optional: true }, { token: i1.RtlService, optional: true }, { token: i2.Overlay }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: MessageBoxConfig, decorators: [{
                    type: Optional
                }, {
                    type: Inject,
                    args: [MESSAGE_BOX_DEFAULT_CONFIG]
                }] }, { type: i1.RtlService, decorators: [{
                    type: Optional
                }] }, { type: i2.Overlay }] });

const declarations = [
    MessageBoxSemanticIconComponent,
    MessageBoxContainerComponent,
    MessageBoxDefaultComponent,
    MessageBoxFooterComponent,
    MessageBoxHeaderComponent,
    MessageBoxBodyComponent,
    MessageBoxComponent,
    MessageBoxTemplateDirective
];
/**
 * @deprecated
 * Use direct imports of components and directives.
 */
class MessageBoxModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxModule, imports: [TemplateModule, InitialFocusModule, TitleComponent, MessageBoxSemanticIconComponent,
            MessageBoxContainerComponent,
            MessageBoxDefaultComponent,
            MessageBoxFooterComponent,
            MessageBoxHeaderComponent,
            MessageBoxBodyComponent,
            MessageBoxComponent,
            MessageBoxTemplateDirective], exports: [MessageBoxSemanticIconComponent,
            MessageBoxContainerComponent,
            MessageBoxDefaultComponent,
            MessageBoxFooterComponent,
            MessageBoxHeaderComponent,
            MessageBoxBodyComponent,
            MessageBoxComponent,
            MessageBoxTemplateDirective, TemplateModule, InitialFocusModule, TitleComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxModule, providers: [MessageBoxService, DynamicComponentService], imports: [TemplateModule, InitialFocusModule, TitleComponent, MessageBoxSemanticIconComponent,
            MessageBoxContainerComponent,
            MessageBoxDefaultComponent,
            MessageBoxFooterComponent,
            MessageBoxHeaderComponent, TemplateModule, InitialFocusModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: MessageBoxModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [TemplateModule, InitialFocusModule, TitleComponent, declarations],
                    exports: [declarations, TemplateModule, InitialFocusModule, TitleComponent],
                    providers: [MessageBoxService, DynamicComponentService]
                }]
        }] });

class MessageBoxContent extends DialogContentBase {
}

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

export { MESSAGE_BOX_DEFAULT_CONFIG, MessageBoxBodyComponent, MessageBoxButtonClass, MessageBoxComponent, MessageBoxConfig, MessageBoxContainerComponent, MessageBoxContent, MessageBoxDefaultComponent, MessageBoxFooterComponent, MessageBoxHeaderComponent, MessageBoxHost, MessageBoxModule, MessageBoxRef, MessageBoxSemanticIconComponent, MessageBoxService, MessageBoxTemplateDirective };
//# sourceMappingURL=fundamental-ngx-core-message-box.mjs.map
