import { __extends } from "tslib";
/**
 * @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, Inject, NgZone, Optional, Renderer2, ViewChild } from '@angular/core';
import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
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 "@angular/cdk/a11y";
import * as i2 from "@angular/cdk/overlay";
import * as i3 from "./modal-types";
import * as i4 from "@angular/common";
import * as i5 from "@angular/cdk/portal";
import * as i6 from "./modal-close.component";
import * as i7 from "./modal-title.component";
import * as i8 from "./modal-footer.component";
import * as i9 from "ng-zorro-antd/core";
var _c0 = ["modalElement"];
function NzModalContainerComponent_button_4_Template(rf, ctx) { if (rf & 1) {
    var _r1975 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 9);
    i0.ɵɵlistener("click", function NzModalContainerComponent_button_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r1975); var ctx_r1974 = i0.ɵɵnextContext(); return ctx_r1974.onCloseClick(); });
    i0.ɵɵelementEnd();
} }
function NzModalContainerComponent_div_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 10);
} }
function NzModalContainerComponent_ng_template_7_Template(rf, ctx) { }
function NzModalContainerComponent_div_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 11);
} if (rf & 2) {
    var ctx_r1972 = i0.ɵɵnextContext();
    i0.ɵɵproperty("innerHTML", ctx_r1972.config.nzContent, i0.ɵɵsanitizeHtml);
} }
function NzModalContainerComponent_div_9_Template(rf, ctx) { if (rf & 1) {
    var _r1977 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 12);
    i0.ɵɵlistener("cancelTriggered", function NzModalContainerComponent_div_9_Template_div_cancelTriggered_0_listener() { i0.ɵɵrestoreView(_r1977); var ctx_r1976 = i0.ɵɵnextContext(); return ctx_r1976.onCloseClick(); })("okTriggered", function NzModalContainerComponent_div_9_Template_div_okTriggered_0_listener() { i0.ɵɵrestoreView(_r1977); var ctx_r1978 = i0.ɵɵnextContext(); return ctx_r1978.onOkClick(); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r1973 = i0.ɵɵnextContext();
    i0.ɵɵproperty("modalRef", ctx_r1973.modalRef);
} }
var NzModalContainerComponent = /** @class */ (function (_super) {
    __extends(NzModalContainerComponent, _super);
    function NzModalContainerComponent(elementRef, focusTrapFactory, cdr, render, zone, overlayRef, config, 
    // tslint:disable-next-line:no-any
    document, animationType) {
        var _this = _super.call(this, elementRef, focusTrapFactory, cdr, render, zone, overlayRef, config, document, animationType) || this;
        _this.config = config;
        return _this;
    }
    /** @nocollapse */ NzModalContainerComponent.ɵfac = function NzModalContainerComponent_Factory(t) { return new (t || NzModalContainerComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1.FocusTrapFactory), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(i2.OverlayRef), i0.ɵɵdirectiveInject(i3.ModalOptions), i0.ɵɵdirectiveInject(DOCUMENT, 8), i0.ɵɵdirectiveInject(ANIMATION_MODULE_TYPE, 8)); };
    /** @nocollapse */ NzModalContainerComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NzModalContainerComponent, selectors: [["nz-modal-container"]], viewQuery: function NzModalContainerComponent_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 NzModalContainerComponent_HostBindings(rf, ctx) { if (rf & 1) {
            i0.ɵɵcomponentHostSyntheticListener("@modalContainer.start", function NzModalContainerComponent_animation_modalContainer_start_HostBindingHandler($event) { return ctx.onAnimationStart($event); })("@modalContainer.done", function NzModalContainerComponent_animation_modalContainer_done_HostBindingHandler($event) { return ctx.onAnimationDone($event); });
            i0.ɵɵlistener("mousedown", function NzModalContainerComponent_mousedown_HostBindingHandler($event) { return ctx.onMousedown($event); })("mouseup", function NzModalContainerComponent_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);
        } }, exportAs: ["nzModalContainer"], features: [i0.ɵɵInheritDefinitionFeature], decls: 10, vars: 12, consts: [["role", "document", 1, "ant-modal", 3, "ngStyle"], ["modalElement", ""], [1, "ant-modal-content"], ["nz-modal-close", "", 3, "click", 4, "ngIf"], ["nz-modal-title", "", 4, "ngIf"], [1, "ant-modal-body", 3, "ngStyle"], ["cdkPortalOutlet", ""], [3, "innerHTML", 4, "ngIf"], ["nz-modal-footer", "", 3, "modalRef", "cancelTriggered", "okTriggered", 4, "ngIf"], ["nz-modal-close", "", 3, "click"], ["nz-modal-title", ""], [3, "innerHTML"], ["nz-modal-footer", "", 3, "modalRef", "cancelTriggered", "okTriggered"]], template: function NzModalContainerComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0, 1);
            i0.ɵɵpipe(2, "nzToCssUnit");
            i0.ɵɵelementStart(3, "div", 2);
            i0.ɵɵtemplate(4, NzModalContainerComponent_button_4_Template, 1, 0, "button", 3);
            i0.ɵɵtemplate(5, NzModalContainerComponent_div_5_Template, 1, 0, "div", 4);
            i0.ɵɵelementStart(6, "div", 5);
            i0.ɵɵtemplate(7, NzModalContainerComponent_ng_template_7_Template, 0, 0, "ng-template", 6);
            i0.ɵɵtemplate(8, NzModalContainerComponent_div_8_Template, 1, 1, "div", 7);
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(9, NzModalContainerComponent_div_9_Template, 1, 1, "div", 8);
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵclassMap(ctx.config.nzClassName);
            i0.ɵɵstyleProp("width", i0.ɵɵpipeBind1(2, 10, 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("ngIf", ctx.config.nzTitle);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngStyle", ctx.config.nzBodyStyle);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngIf", ctx.isStringContent);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", ctx.config.nzFooter !== null);
        } }, directives: [i4.NgStyle, i4.NgIf, i5.CdkPortalOutlet, i6.NzModalCloseComponent, i7.NzModalTitleComponent, i8.NzModalFooterComponent], pipes: [i9.NzToCssUnitPipe], encapsulation: 2, data: { animation: [nzModalAnimations.modalContainer] } });
    return NzModalContainerComponent;
}(BaseModalContainer));
export { NzModalContainerComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(NzModalContainerComponent, [{
        type: Component,
        args: [{
                selector: 'nz-modal-container',
                exportAs: 'nzModalContainer',
                template: "\n    <div\n      #modalElement\n      role=\"document\"\n      class=\"ant-modal\"\n      [class]=\"config.nzClassName\"\n      [ngStyle]=\"config.nzStyle\"\n      [style.width]=\"config?.nzWidth | nzToCssUnit\"\n    >\n      <div class=\"ant-modal-content\">\n        <button *ngIf=\"config.nzClosable\" nz-modal-close (click)=\"onCloseClick()\"></button>\n        <div *ngIf=\"config.nzTitle\" nz-modal-title></div>\n        <div class=\"ant-modal-body\" [ngStyle]=\"config.nzBodyStyle\">\n          <ng-template cdkPortalOutlet></ng-template>\n          <div *ngIf=\"isStringContent\" [innerHTML]=\"config.nzContent\"></div>\n        </div>\n        <div\n          *ngIf=\"config.nzFooter !== null\"\n          nz-modal-footer\n          [modalRef]=\"modalRef\"\n          (cancelTriggered)=\"onCloseClick()\"\n          (okTriggered)=\"onOkClick()\"\n        ></div>\n      </div>\n    </div>\n  ",
                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: i0.ElementRef }, { type: i1.FocusTrapFactory }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i2.OverlayRef }, { type: i3.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 }]
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 