/**
 * @license
 * Copyright Alibaba.com All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */
import { FocusTrapFactory } from '@angular/cdk/a11y';
import { OverlayRef } from '@angular/cdk/overlay';
import { CdkPortalOutlet } from '@angular/cdk/portal';
import { DOCUMENT } from '@angular/common';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Inject, NgZone, Optional, Output, Renderer2, ViewChild } from '@angular/core';
import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { NzI18nService } from 'ng-zorro-antd/i18n';
import { nzModalAnimations } from './modal-animations';
import { BaseModalContainer } from './modal-container';
import { ModalOptions } from './modal-types';
import * as i0 from "@angular/core";
import * as i1 from "ng-zorro-antd/i18n";
import * as i2 from "@angular/cdk/a11y";
import * as i3 from "@angular/cdk/overlay";
import * as i4 from "./modal-types";
import * as i5 from "@angular/common";
import * as i6 from "ng-zorro-antd/core/transition-patch";
import * as i7 from "ng-zorro-antd/icon";
import * as i8 from "ng-zorro-antd/core";
import * as i9 from "@angular/cdk/portal";
import * as i10 from "./modal-close.component";
import * as i11 from "ng-zorro-antd/button";
const _c0 = ["modalElement"];
function NzModalConfirmContainerComponent_button_4_Template(rf, ctx) { if (rf & 1) {
    const _r1920 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 16);
    i0.ɵɵlistener("click", function NzModalConfirmContainerComponent_button_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r1920); const ctx_r1919 = i0.ɵɵnextContext(); return ctx_r1919.onCloseClick(); });
    i0.ɵɵelementEnd();
} }
function NzModalConfirmContainerComponent_ng_container_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelement(1, "span", 17);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r1914 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("innerHTML", ctx_r1914.config.nzTitle, i0.ɵɵsanitizeHtml);
} }
function NzModalConfirmContainerComponent_ng_template_12_Template(rf, ctx) { }
function NzModalConfirmContainerComponent_div_13_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 17);
} if (rf & 2) {
    const ctx_r1916 = i0.ɵɵnextContext();
    i0.ɵɵproperty("innerHTML", ctx_r1916.config.nzContent, i0.ɵɵsanitizeHtml);
} }
function NzModalConfirmContainerComponent_button_15_Template(rf, ctx) { if (rf & 1) {
    const _r1922 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 18);
    i0.ɵɵlistener("click", function NzModalConfirmContainerComponent_button_15_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r1922); const ctx_r1921 = i0.ɵɵnextContext(); return ctx_r1921.onCancel(); });
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1917 = i0.ɵɵnextContext();
    i0.ɵɵproperty("nzLoading", ctx_r1917.config.nzCancelLoading)("disabled", ctx_r1917.config.nzCancelDisabled);
    i0.ɵɵattribute("cdkFocusInitial", ctx_r1917.config.nzAutofocus === "cancel");
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r1917.config.nzCancelText || ctx_r1917.locale.cancelText, " ");
} }
function NzModalConfirmContainerComponent_button_16_Template(rf, ctx) { if (rf & 1) {
    const _r1924 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 19);
    i0.ɵɵlistener("click", function NzModalConfirmContainerComponent_button_16_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r1924); const ctx_r1923 = i0.ɵɵnextContext(); return ctx_r1923.onOk(); });
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1918 = i0.ɵɵnextContext();
    i0.ɵɵproperty("nzType", ctx_r1918.config.nzOkType)("nzLoading", ctx_r1918.config.nzOkLoading)("disabled", ctx_r1918.config.nzOkDisabled);
    i0.ɵɵattribute("cdkFocusInitial", ctx_r1918.config.nzAutofocus === "ok");
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r1918.config.nzOkText || ctx_r1918.locale.okText, " ");
} }
export class NzModalConfirmContainerComponent extends BaseModalContainer {
    constructor(i18n, elementRef, focusTrapFactory, cdr, render, zone, overlayRef, config, 
    // tslint:disable-next-line:no-any
    document, animationType) {
        super(elementRef, focusTrapFactory, cdr, render, zone, overlayRef, config, document, animationType);
        this.i18n = i18n;
        this.config = config;
        this.cancelTriggered = new EventEmitter();
        this.okTriggered = new EventEmitter();
        this.locale = {};
        this.destroy$ = new Subject();
        this.i18n.localeChange.pipe(takeUntil(this.destroy$)).subscribe(() => {
            this.locale = this.i18n.getLocaleData('Modal');
        });
    }
    onCancel() {
        this.cancelTriggered.emit();
    }
    onOk() {
        this.okTriggered.emit();
    }
    attachComponentPortal(_portal) {
        throw new Error('The confirm mode does not support using component as content');
    }
    ngOnDestroy() {
        this.destroy$.next();
        this.destroy$.complete();
    }
}
/** @nocollapse */ NzModalConfirmContainerComponent.ɵfac = function NzModalConfirmContainerComponent_Factory(t) { return new (t || NzModalConfirmContainerComponent)(i0.ɵɵdirectiveInject(i1.NzI18nService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i2.FocusTrapFactory), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(i3.OverlayRef), i0.ɵɵdirectiveInject(i4.ModalOptions), i0.ɵɵdirectiveInject(DOCUMENT, 8), i0.ɵɵdirectiveInject(ANIMATION_MODULE_TYPE, 8)); };
/** @nocollapse */ NzModalConfirmContainerComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NzModalConfirmContainerComponent, selectors: [["nz-modal-confirm-container"]], viewQuery: function NzModalConfirmContainerComponent_Query(rf, ctx) { if (rf & 1) {
        i0.ɵɵstaticViewQuery(CdkPortalOutlet, true);
        i0.ɵɵstaticViewQuery(_c0, true);
    } if (rf & 2) {
        var _t;
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.portalOutlet = _t.first);
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.modalElementRef = _t.first);
    } }, hostAttrs: ["tabindex", "-1", "role", "dialog", 1, "ant-modal-wrap"], hostVars: 6, hostBindings: function NzModalConfirmContainerComponent_HostBindings(rf, ctx) { if (rf & 1) {
        i0.ɵɵcomponentHostSyntheticListener("@modalContainer.start", function NzModalConfirmContainerComponent_animation_modalContainer_start_HostBindingHandler($event) { return ctx.onAnimationStart($event); })("@modalContainer.done", function NzModalConfirmContainerComponent_animation_modalContainer_done_HostBindingHandler($event) { return ctx.onAnimationDone($event); });
        i0.ɵɵlistener("mousedown", function NzModalConfirmContainerComponent_mousedown_HostBindingHandler($event) { return ctx.onMousedown($event); })("mouseup", function NzModalConfirmContainerComponent_mouseup_HostBindingHandler($event) { return ctx.onMouseup($event); });
    } if (rf & 2) {
        i0.ɵɵupdateSyntheticHostBinding("@.disabled", ctx.config.nzNoAnimation)("@modalContainer", ctx.state);
        i0.ɵɵclassMap(ctx.config.nzWrapClassName);
        i0.ɵɵstyleProp("z-index", ctx.config.nzZIndex);
    } }, outputs: { cancelTriggered: "cancelTriggered", okTriggered: "okTriggered" }, exportAs: ["nzModalConfirmContainer"], features: [i0.ɵɵInheritDefinitionFeature], decls: 17, vars: 14, consts: [["role", "document", 1, "ant-modal", 3, "ngStyle"], ["modalElement", ""], [1, "ant-modal-content"], ["nz-modal-close", "", 3, "click", 4, "ngIf"], [1, "ant-modal-body", 3, "ngStyle"], [1, "ant-modal-confirm-body-wrapper"], [1, "ant-modal-confirm-body"], ["nz-icon", "", 3, "nzType"], [1, "ant-modal-confirm-title"], [4, "nzStringTemplateOutlet"], [1, "ant-modal-confirm-content"], ["cdkPortalOutlet", ""], [3, "innerHTML", 4, "ngIf"], [1, "ant-modal-confirm-btns"], ["nz-button", "", 3, "nzLoading", "disabled", "click", 4, "ngIf"], ["nz-button", "", 3, "nzType", "nzLoading", "disabled", "click", 4, "ngIf"], ["nz-modal-close", "", 3, "click"], [3, "innerHTML"], ["nz-button", "", 3, "nzLoading", "disabled", "click"], ["nz-button", "", 3, "nzType", "nzLoading", "disabled", "click"]], template: function NzModalConfirmContainerComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "div", 0, 1);
        i0.ɵɵpipe(2, "nzToCssUnit");
        i0.ɵɵelementStart(3, "div", 2);
        i0.ɵɵtemplate(4, NzModalConfirmContainerComponent_button_4_Template, 1, 0, "button", 3);
        i0.ɵɵelementStart(5, "div", 4);
        i0.ɵɵelementStart(6, "div", 5);
        i0.ɵɵelementStart(7, "div", 6);
        i0.ɵɵelement(8, "i", 7);
        i0.ɵɵelementStart(9, "span", 8);
        i0.ɵɵtemplate(10, NzModalConfirmContainerComponent_ng_container_10_Template, 2, 1, "ng-container", 9);
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(11, "div", 10);
        i0.ɵɵtemplate(12, NzModalConfirmContainerComponent_ng_template_12_Template, 0, 0, "ng-template", 11);
        i0.ɵɵtemplate(13, NzModalConfirmContainerComponent_div_13_Template, 1, 1, "div", 12);
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(14, "div", 13);
        i0.ɵɵtemplate(15, NzModalConfirmContainerComponent_button_15_Template, 2, 4, "button", 14);
        i0.ɵɵtemplate(16, NzModalConfirmContainerComponent_button_16_Template, 2, 5, "button", 15);
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        i0.ɵɵclassMap(ctx.config.nzClassName);
        i0.ɵɵstyleProp("width", i0.ɵɵpipeBind1(2, 12, ctx.config == null ? null : ctx.config.nzWidth));
        i0.ɵɵproperty("ngStyle", ctx.config.nzStyle);
        i0.ɵɵadvance(4);
        i0.ɵɵproperty("ngIf", ctx.config.nzClosable);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngStyle", ctx.config.nzBodyStyle);
        i0.ɵɵadvance(3);
        i0.ɵɵproperty("nzType", ctx.config.nzIconType);
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("nzStringTemplateOutlet", ctx.config.nzTitle);
        i0.ɵɵadvance(3);
        i0.ɵɵproperty("ngIf", ctx.isStringContent);
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("ngIf", ctx.config.nzCancelText !== null);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.config.nzOkText !== null);
    } }, directives: [i5.NgStyle, i5.NgIf, i6.ɵNzTransitionPatchDirective, i7.NzIconDirective, i8.NzStringTemplateOutletDirective, i9.CdkPortalOutlet, i10.NzModalCloseComponent, i11.NzButtonComponent, i8.NzWaveDirective], pipes: [i8.NzToCssUnitPipe], encapsulation: 2, data: { animation: [nzModalAnimations.modalContainer] } });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(NzModalConfirmContainerComponent, [{
        type: Component,
        args: [{
                selector: 'nz-modal-confirm-container',
                exportAs: 'nzModalConfirmContainer',
                template: `
    <div
      #modalElement
      role="document"
      class="ant-modal"
      [class]="config.nzClassName"
      [ngStyle]="config.nzStyle"
      [style.width]="config?.nzWidth | nzToCssUnit"
    >
      <div class="ant-modal-content">
        <button *ngIf="config.nzClosable" nz-modal-close (click)="onCloseClick()"></button>
        <div class="ant-modal-body" [ngStyle]="config.nzBodyStyle">
          <div class="ant-modal-confirm-body-wrapper">
            <div class="ant-modal-confirm-body">
              <i nz-icon [nzType]="config.nzIconType"></i>
              <span class="ant-modal-confirm-title">
                <ng-container *nzStringTemplateOutlet="config.nzTitle">
                  <span [innerHTML]="config.nzTitle"></span>
                </ng-container>
              </span>
              <div class="ant-modal-confirm-content">
                <ng-template cdkPortalOutlet></ng-template>
                <div *ngIf="isStringContent" [innerHTML]="config.nzContent"></div>
              </div>
            </div>
            <div class="ant-modal-confirm-btns">
              <button
                *ngIf="config.nzCancelText !== null"
                [attr.cdkFocusInitial]="config.nzAutofocus === 'cancel'"
                nz-button
                (click)="onCancel()"
                [nzLoading]="config.nzCancelLoading"
                [disabled]="config.nzCancelDisabled"
              >
                {{ config.nzCancelText || locale.cancelText }}
              </button>
              <button
                *ngIf="config.nzOkText !== null"
                [attr.cdkFocusInitial]="config.nzAutofocus === 'ok'"
                nz-button
                [nzType]="config.nzOkType"
                (click)="onOk()"
                [nzLoading]="config.nzOkLoading"
                [disabled]="config.nzOkDisabled"
              >
                {{ config.nzOkText || locale.okText }}
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  `,
                animations: [nzModalAnimations.modalContainer],
                // Using OnPush for modal caused footer can not to detect changes. we can fix it when 8.x.
                changeDetection: ChangeDetectionStrategy.Default,
                host: {
                    tabindex: '-1',
                    role: 'dialog',
                    class: 'ant-modal-wrap',
                    '[class]': 'config.nzWrapClassName',
                    '[style.zIndex]': 'config.nzZIndex',
                    '[@.disabled]': 'config.nzNoAnimation',
                    '[@modalContainer]': 'state',
                    '(@modalContainer.start)': 'onAnimationStart($event)',
                    '(@modalContainer.done)': 'onAnimationDone($event)',
                    '(mousedown)': 'onMousedown($event)',
                    '(mouseup)': 'onMouseup($event)'
                }
            }]
    }], function () { return [{ type: i1.NzI18nService }, { type: i0.ElementRef }, { type: i2.FocusTrapFactory }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i3.OverlayRef }, { type: i4.ModalOptions }, { type: undefined, decorators: [{
                type: Optional
            }, {
                type: Inject,
                args: [DOCUMENT]
            }] }, { type: undefined, decorators: [{
                type: Optional
            }, {
                type: Inject,
                args: [ANIMATION_MODULE_TYPE]
            }] }]; }, { portalOutlet: [{
            type: ViewChild,
            args: [CdkPortalOutlet, { static: true }]
        }], modalElementRef: [{
            type: ViewChild,
            args: ['modalElement', { static: true }]
        }], cancelTriggered: [{
            type: Output
        }], okTriggered: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 