import { Component, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { TemplatePortal } from '@angular/cdk/portal';
import { Subject } from 'rxjs';
import * as i0 from "@angular/core";
import * as i1 from "@angular/cdk/a11y";
import * as i2 from "@angular/common";
import * as i3 from "../../eui-button/eui-button.component";
import * as i4 from "../../atoms/eui-icon/eui-icon.component";
import * as i5 from "@angular/cdk/portal";
import * as i6 from "@ngx-translate/core";
function EuiMessageBoxContainerComponent_button_6_Template(rf, ctx) { if (rf & 1) {
    const _r11 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 17);
    i0.ɵɵlistener("click", function EuiMessageBoxContainerComponent_button_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(); return ctx_r10.closeMessageBox(); });
    i0.ɵɵelement(1, "span", 18);
    i0.ɵɵelementEnd();
} }
function EuiMessageBoxContainerComponent_span_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 19);
} }
function EuiMessageBoxContainerComponent_span_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 20);
} }
function EuiMessageBoxContainerComponent_span_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 21);
} }
function EuiMessageBoxContainerComponent_span_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 22);
} }
function EuiMessageBoxContainerComponent_span_13_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 23);
} }
function EuiMessageBoxContainerComponent_div_14_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 24);
} if (rf & 2) {
    const ctx_r6 = i0.ɵɵnextContext();
    i0.ɵɵproperty("innerHTML", ctx_r6.content ? ctx_r6.content : null, i0.ɵɵsanitizeHtml);
} }
function EuiMessageBoxContainerComponent_div_15_ng_template_1_Template(rf, ctx) { }
function EuiMessageBoxContainerComponent_div_15_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 25);
    i0.ɵɵtemplate(1, EuiMessageBoxContainerComponent_div_15_ng_template_1_Template, 0, 0, "ng-template", 26);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r7 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("cdkPortalOutlet", ctx_r7.content);
} }
function EuiMessageBoxContainerComponent_ng_container_17_ng_template_1_Template(rf, ctx) { }
function EuiMessageBoxContainerComponent_ng_container_17_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, EuiMessageBoxContainerComponent_ng_container_17_ng_template_1_Template, 0, 0, "ng-template", 26);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r8 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("cdkPortalOutlet", ctx_r8.footer);
} }
function EuiMessageBoxContainerComponent_ng_container_18_Template(rf, ctx) { if (rf & 1) {
    const _r16 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "button", 27, 28);
    i0.ɵɵlistener("click", function EuiMessageBoxContainerComponent_ng_container_18_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r16); const ctx_r15 = i0.ɵɵnextContext(); return ctx_r15.onDismiss(); });
    i0.ɵɵtext(3);
    i0.ɵɵpipe(4, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "button", 29);
    i0.ɵɵlistener("click", function EuiMessageBoxContainerComponent_ng_container_18_Template_button_click_5_listener() { i0.ɵɵrestoreView(_r16); const ctx_r17 = i0.ɵɵnextContext(); return ctx_r17.onAccept(); });
    i0.ɵɵtext(6);
    i0.ɵɵpipe(7, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r9 = i0.ɵɵnextContext();
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4, 2, ctx_r9.dismissLabel));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(7, 4, ctx_r9.acceptLabel));
} }
export class EuiMessageBoxContainerComponent {
    constructor() {
        this.e2eAttr = 'eui-message-box';
        this.outsideClick = new Subject();
        this.open = new Subject();
        this.close = new Subject();
        this.dismiss = new Subject();
        this.accept = new Subject();
        this.isContentTemplatePortal = false;
        this.isFooterTemplatePortal = false;
    }
    ngOnInit() {
        if (this.content instanceof TemplatePortal) {
            this.isContentTemplatePortal = true;
        }
        if (this.footer instanceof TemplatePortal) {
            this.isFooterTemplatePortal = true;
        }
        this.open.next();
    }
    closeMessageBox() {
        this.close.next();
    }
    onDismiss() {
        this.dismiss.next();
        this.closeMessageBox();
    }
    onAccept() {
        this.accept.next();
        this.closeMessageBox();
    }
}
/** @nocollapse */ EuiMessageBoxContainerComponent.ɵfac = function EuiMessageBoxContainerComponent_Factory(t) { return new (t || EuiMessageBoxContainerComponent)(); };
/** @nocollapse */ EuiMessageBoxContainerComponent.ɵcmp = i0.ɵɵdefineComponent({ type: EuiMessageBoxContainerComponent, selectors: [["eui-message-box-container"]], decls: 19, vars: 16, consts: [["cdkTrapFocus", "", "role", "dialog", "tabIndex", "-1", 3, "cdkTrapFocusAutoCapture"], ["role", "document", 1, "eui-message-box__wrapper"], [1, "eui-message-box__content"], [1, "eui-message-box__header"], [1, "eui-message-box__header-title"], ["euiButton", "", "euiIconButton", "", "euiSizeM", "", "euiBasicButton", "", 3, "click", 4, "ngIf"], [1, "eui-message-box__body"], [1, "eui-message-box__body-icon"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-ecl-error eui-message-box__body-icon-content", 4, "ngIf"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-check eui-message-box__body-icon-content", 4, "ngIf"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-info eui-message-box__body-icon-content", 4, "ngIf"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-question eui-message-box__body-icon-content", 4, "ngIf"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-exclamation-triangle eui-message-box__body-icon-content", 4, "ngIf"], ["class", "eui-message-box__body-content", 3, "innerHTML", 4, "ngIf"], ["class", "eui-message-box__body-content", 4, "ngIf"], [1, "eui-message-box__footer"], [4, "ngIf"], ["euiButton", "", "euiIconButton", "", "euiSizeM", "", "euiBasicButton", "", 3, "click"], [1, "eui-icon", "eui-icon-close-m"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-ecl-error eui-message-box__body-icon-content"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-check eui-message-box__body-icon-content"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-info eui-message-box__body-icon-content"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-question eui-message-box__body-icon-content"], ["euiIcon", "", "iconClass", "eui-icon eui-icon-exclamation-triangle eui-message-box__body-icon-content"], [1, "eui-message-box__body-content", 3, "innerHTML"], [1, "eui-message-box__body-content"], [3, "cdkPortalOutlet"], ["euiButton", "", 1, "eui-message-box__footer-dismiss-button", 3, "click"], ["focusedButton", ""], ["euiButton", "", "euiPrimary", "", 1, "eui-message-box__footer-accept-button", 3, "click"]], template: function EuiMessageBoxContainerComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "div", 0);
        i0.ɵɵelementStart(1, "div", 1);
        i0.ɵɵelementStart(2, "div", 2);
        i0.ɵɵelementStart(3, "div", 3);
        i0.ɵɵelementStart(4, "h5", 4);
        i0.ɵɵtext(5);
        i0.ɵɵelementEnd();
        i0.ɵɵtemplate(6, EuiMessageBoxContainerComponent_button_6_Template, 2, 0, "button", 5);
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(7, "div", 6);
        i0.ɵɵelementStart(8, "div", 7);
        i0.ɵɵtemplate(9, EuiMessageBoxContainerComponent_span_9_Template, 1, 0, "span", 8);
        i0.ɵɵtemplate(10, EuiMessageBoxContainerComponent_span_10_Template, 1, 0, "span", 9);
        i0.ɵɵtemplate(11, EuiMessageBoxContainerComponent_span_11_Template, 1, 0, "span", 10);
        i0.ɵɵtemplate(12, EuiMessageBoxContainerComponent_span_12_Template, 1, 0, "span", 11);
        i0.ɵɵtemplate(13, EuiMessageBoxContainerComponent_span_13_Template, 1, 0, "span", 12);
        i0.ɵɵelementEnd();
        i0.ɵɵtemplate(14, EuiMessageBoxContainerComponent_div_14_Template, 1, 1, "div", 13);
        i0.ɵɵtemplate(15, EuiMessageBoxContainerComponent_div_15_Template, 2, 1, "div", 14);
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(16, "div", 15);
        i0.ɵɵtemplate(17, EuiMessageBoxContainerComponent_ng_container_17_Template, 2, 1, "ng-container", 16);
        i0.ɵɵtemplate(18, EuiMessageBoxContainerComponent_ng_container_18_Template, 8, 6, "ng-container", 16);
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        i0.ɵɵclassMapInterpolate1("eui-message-box eui-message-box--", ctx.type, " eui-u-anim eui-u-anim--flipInY");
        i0.ɵɵproperty("cdkTrapFocusAutoCapture", true);
        i0.ɵɵattribute("data-e2e", ctx.e2eAttr);
        i0.ɵɵadvance(5);
        i0.ɵɵtextInterpolate(ctx.title);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.hasCloseButton);
        i0.ɵɵadvance(3);
        i0.ɵɵproperty("ngIf", ctx.type === "danger");
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.type === "success");
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.type === "info");
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.type === "question");
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.type === "warning");
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", !ctx.isContentTemplatePortal);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.isContentTemplatePortal);
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("ngIf", ctx.isFooterTemplatePortal);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", !ctx.isFooterTemplatePortal);
    } }, directives: [i1.CdkTrapFocus, i2.NgIf, i3.EuiButtonComponent, i4.EuiIconComponent, i5.CdkPortalOutlet], pipes: [i6.TranslatePipe], styles: ["eui-message-box-container{width:100%}.eui-message-box{background-color:var(--eui-color-white);border:1px solid var(--eui-color-grey-lighter);border-radius:var(--eui-border-radius-base);box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);width:100%}.eui-message-box__header{align-items:center;border-bottom:1px solid var(--eui-color-grey-lightest);border-top-left-radius:var(--eui-border-radius-base);border-top-right-radius:var(--eui-border-radius-base);display:flex;justify-content:space-between;padding:var(--eui-spacing-s) var(--eui-spacing)}.eui-message-box__header-title{font-size:var(--eui-font-size-xl);font-style:normal;font-weight:700;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.eui-message-box__body{align-items:center;display:flex;padding:var(--eui-spacing)}.eui-message-box__body-icon{margin:0 var(--eui-spacing)}.eui-message-box__body-icon-content{background:var(--eui-color-grey-lightest);border-radius:10rem;font-size:var(--eui-font-size-5xl);margin-right:var(--eui-spacing);padding:var(--eui-spacing-s)}.eui-message-box__footer{background-color:var(--eui-color-grey-lightester);border-bottom-left-radius:var(--eui-border-radius-base);border-bottom-right-radius:var(--eui-border-radius-base);border-top:1px solid var(--eui-color-grey-lightest);padding:var(--eui-spacing-s) var(--eui-spacing);text-align:right}.eui-message-box__footer-dismiss-button{margin-right:var(--eui-spacing-s)}.eui-message-box__backdrop.cdk-overlay-backdrop.cdk-overlay-backdrop-showing{background-color:var(--eui-color-black);opacity:.5}.eui-message-box--warning{border-color:var(--eui-color-warning)}.eui-message-box--warning .eui-message-box__body-icon,.eui-message-box--warning .eui-message-box__header-title{color:var(--eui-color-warning)}.eui-message-box--danger{border-color:var(--eui-color-danger)}.eui-message-box--danger .eui-message-box__body-icon,.eui-message-box--danger .eui-message-box__header-title{color:var(--eui-color-danger)}.eui-message-box--success{border-color:var(--eui-color-success)}.eui-message-box--success .eui-message-box__body-icon,.eui-message-box--success .eui-message-box__header-title{color:var(--eui-color-success)}.eui-message-box--info{border-color:var(--eui-color-info)}.eui-message-box--info .eui-message-box__body-icon,.eui-message-box--info .eui-message-box__header-title{color:var(--eui-color-info)}.eui-message-box--question{border-color:var(--eui-color-primary)}.eui-message-box--question .eui-message-box__body-icon,.eui-message-box--question .eui-message-box__header-title{color:var(--eui-color-primary)}"], encapsulation: 2, changeDetection: 0 });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiMessageBoxContainerComponent, [{
        type: Component,
        args: [{
                // tslint:disable-next-line
                selector: 'eui-message-box-container',
                templateUrl: './eui-message-box-container.component.html',
                styleUrls: ['../styles/_index.scss'],
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
            }]
    }], function () { return []; }, null); })();
//# sourceMappingURL=data:application/json;base64, 