import { ɵɵelement, ɵɵelementStart, ɵɵelementContainerStart, ɵɵtemplate, ɵɵelementContainerEnd, ɵɵelementEnd, ɵɵnextContext, ɵɵadvance, ɵɵproperty, ɵɵpureFunction1, ɵɵclassProp, ɵɵsanitizeHtml, EventEmitter, ɵɵdirectiveInject, ChangeDetectorRef, ɵɵdefineComponent, ɵɵlistener, ɵɵtemplateRefExtractor, ɵɵreference, ɵɵpureFunction2, ɵsetClassMetadata, Component, ViewEncapsulation, Input, Output, ɵɵgetCurrentView, ɵɵrestoreView, ɵɵstyleProp, ChangeDetectionStrategy, ɵɵdefineNgModule, ɵɵdefineInjector, NgModule, ɵɵsetNgModuleScope, ɵɵinject, Injector, ɵɵdefineInjectable, Injectable } from '@angular/core';
import { NzStringTemplateOutletDirective, notificationMotion, toCssPixel, NzConfigService, NzOutletModule, NzSingletonService } from 'ng-zorro-antd/core';
import { NgStyle, NgClass, NgIf, NgTemplateOutlet, NgSwitch, NgSwitchCase, NgForOf, CommonModule } from '@angular/common';
import { NzIconDirective, NzIconModule } from 'ng-zorro-antd/icon';
import { OverlayModule, Overlay } from '@angular/cdk/overlay';
import { Subject } from 'rxjs';
import { ComponentPortal } from '@angular/cdk/portal';

/**
 * @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
 */
function NzNotificationComponent_div_1_i_4_Template(rf, ctx) { if (rf & 1) {
    ɵɵelement(0, "i", 16);
} }
function NzNotificationComponent_div_1_i_5_Template(rf, ctx) { if (rf & 1) {
    ɵɵelement(0, "i", 17);
} }
function NzNotificationComponent_div_1_i_6_Template(rf, ctx) { if (rf & 1) {
    ɵɵelement(0, "i", 18);
} }
function NzNotificationComponent_div_1_i_7_Template(rf, ctx) { if (rf & 1) {
    ɵɵelement(0, "i", 19);
} }
const _c0 = function (a0) { return { "ant-notification-notice-with-icon": a0 }; };
function NzNotificationComponent_div_1_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "div", 7);
    ɵɵelementStart(1, "div", 8);
    ɵɵelementStart(2, "div");
    ɵɵelementContainerStart(3, 9);
    ɵɵtemplate(4, NzNotificationComponent_div_1_i_4_Template, 1, 0, "i", 10);
    ɵɵtemplate(5, NzNotificationComponent_div_1_i_5_Template, 1, 0, "i", 11);
    ɵɵtemplate(6, NzNotificationComponent_div_1_i_6_Template, 1, 0, "i", 12);
    ɵɵtemplate(7, NzNotificationComponent_div_1_i_7_Template, 1, 0, "i", 13);
    ɵɵelementContainerEnd();
    ɵɵelement(8, "div", 14);
    ɵɵelement(9, "div", 15);
    ɵɵelementEnd();
    ɵɵelementEnd();
    ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r666 = ɵɵnextContext();
    ɵɵadvance(1);
    ɵɵproperty("ngClass", ɵɵpureFunction1(10, _c0, ctx_r666.nzMessage.type !== "blank"));
    ɵɵadvance(1);
    ɵɵclassProp("ant-notification-notice-with-icon", ctx_r666.nzMessage.type !== "blank");
    ɵɵadvance(1);
    ɵɵproperty("ngSwitch", ctx_r666.nzMessage.type);
    ɵɵadvance(1);
    ɵɵproperty("ngSwitchCase", "success");
    ɵɵadvance(1);
    ɵɵproperty("ngSwitchCase", "info");
    ɵɵadvance(1);
    ɵɵproperty("ngSwitchCase", "warning");
    ɵɵadvance(1);
    ɵɵproperty("ngSwitchCase", "error");
    ɵɵadvance(1);
    ɵɵproperty("innerHTML", ctx_r666.nzMessage.title, ɵɵsanitizeHtml);
    ɵɵadvance(1);
    ɵɵproperty("innerHTML", ctx_r666.nzMessage.content, ɵɵsanitizeHtml);
} }
function NzNotificationComponent_ng_template_2_Template(rf, ctx) { }
function NzNotificationComponent_ng_container_5_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementContainerStart(0);
    ɵɵelement(1, "i", 21);
    ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r675 = ɵɵnextContext(2);
    ɵɵadvance(1);
    ɵɵproperty("nzType", ctx_r675.nzMessage.options == null ? null : ctx_r675.nzMessage.options.nzCloseIcon);
} }
function NzNotificationComponent_ng_container_5_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementContainerStart(0);
    ɵɵtemplate(1, NzNotificationComponent_ng_container_5_ng_container_1_Template, 2, 1, "ng-container", 20);
    ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r668 = ɵɵnextContext();
    ɵɵadvance(1);
    ɵɵproperty("nzStringTemplateOutlet", ctx_r668.nzMessage.options == null ? null : ctx_r668.nzMessage.options.nzCloseIcon);
} }
function NzNotificationComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
    ɵɵelement(0, "i", 22);
} }
const _c1 = function (a0, a1) { return { $implicit: a0, data: a1 }; };
class NzNotificationComponent {
    constructor(cdr) {
        this.cdr = cdr;
        this.messageDestroy = new EventEmitter();
        this.eraseTimer = null;
    }
    ngOnInit() {
        // `NzMessageContainer` does its job so all properties cannot be undefined.
        this.options = this.nzMessage.options;
        if (this.options.nzAnimate) {
            this.nzMessage.state = 'enter';
        }
        this.autoClose = this.options.nzDuration > 0;
        if (this.autoClose) {
            this.initErase();
            this.startEraseTimeout();
        }
    }
    ngOnDestroy() {
        if (this.autoClose) {
            this.clearEraseTimeout();
        }
    }
    onEnter() {
        if (this.autoClose && this.options.nzPauseOnHover) {
            this.clearEraseTimeout();
            this.updateTTL();
        }
    }
    onLeave() {
        if (this.autoClose && this.options.nzPauseOnHover) {
            this.startEraseTimeout();
        }
    }
    // Remove self
    destroy(userAction = false) {
        if (this.options.nzAnimate) {
            this.nzMessage.state = 'leave';
            this.cdr.detectChanges();
            setTimeout(() => {
                this.messageDestroy.next({ id: this.nzMessage.messageId, userAction: userAction });
            }, 200);
        }
        else {
            this.messageDestroy.next({ id: this.nzMessage.messageId, userAction: userAction });
        }
    }
    initErase() {
        this.eraseTTL = this.options.nzDuration;
        this.eraseTimingStart = Date.now();
    }
    updateTTL() {
        if (this.autoClose) {
            this.eraseTTL -= Date.now() - this.eraseTimingStart;
        }
    }
    startEraseTimeout() {
        if (this.eraseTTL > 0) {
            this.clearEraseTimeout();
            this.eraseTimer = setTimeout(() => this.destroy(), this.eraseTTL);
            this.eraseTimingStart = Date.now();
        }
        else {
            this.destroy();
        }
    }
    clearEraseTimeout() {
        if (this.eraseTimer !== null) {
            clearTimeout(this.eraseTimer);
            this.eraseTimer = null;
        }
    }
    close() {
        this.destroy(true);
    }
    get state() {
        if (this.nzMessage.state === 'enter') {
            if (this.nzPlacement === 'topLeft' || this.nzPlacement === 'bottomLeft') {
                return 'enterLeft';
            }
            else {
                return 'enterRight';
            }
        }
        else {
            return this.nzMessage.state;
        }
    }
}
/** @nocollapse */ NzNotificationComponent.ɵfac = function NzNotificationComponent_Factory(t) { return new (t || NzNotificationComponent)(ɵɵdirectiveInject(ChangeDetectorRef)); };
/** @nocollapse */ NzNotificationComponent.ɵcmp = ɵɵdefineComponent({ type: NzNotificationComponent, selectors: [["nz-notification"]], inputs: { nzMessage: "nzMessage", nzIndex: "nzIndex", nzPlacement: "nzPlacement" }, outputs: { messageDestroy: "messageDestroy" }, exportAs: ["nzNotification"], decls: 8, vars: 12, consts: [[1, "ant-notification-notice", "ant-notification-notice-closable", 3, "ngStyle", "ngClass", "mouseenter", "mouseleave"], ["class", "ant-notification-notice-content", 4, "ngIf"], [3, "ngIf", "ngTemplateOutlet", "ngTemplateOutletContext"], ["tabindex", "0", 1, "ant-notification-notice-close", 3, "click"], [1, "ant-notification-notice-close-x"], [4, "ngIf", "ngIfElse"], ["iconTpl", ""], [1, "ant-notification-notice-content"], [1, "ant-notification-notice-content", 3, "ngClass"], [3, "ngSwitch"], ["nz-icon", "", "nzType", "check-circle", "class", "ant-notification-notice-icon ant-notification-notice-icon-success", 4, "ngSwitchCase"], ["nz-icon", "", "nzType", "info-circle", "class", "ant-notification-notice-icon ant-notification-notice-icon-info", 4, "ngSwitchCase"], ["nz-icon", "", "nzType", "exclamation-circle", "class", "ant-notification-notice-icon ant-notification-notice-icon-warning", 4, "ngSwitchCase"], ["nz-icon", "", "nzType", "close-circle", "class", "ant-notification-notice-icon ant-notification-notice-icon-error", 4, "ngSwitchCase"], [1, "ant-notification-notice-message", 3, "innerHTML"], [1, "ant-notification-notice-description", 3, "innerHTML"], ["nz-icon", "", "nzType", "check-circle", 1, "ant-notification-notice-icon", "ant-notification-notice-icon-success"], ["nz-icon", "", "nzType", "info-circle", 1, "ant-notification-notice-icon", "ant-notification-notice-icon-info"], ["nz-icon", "", "nzType", "exclamation-circle", 1, "ant-notification-notice-icon", "ant-notification-notice-icon-warning"], ["nz-icon", "", "nzType", "close-circle", 1, "ant-notification-notice-icon", "ant-notification-notice-icon-error"], [4, "nzStringTemplateOutlet"], ["nz-icon", "", 3, "nzType"], ["nz-icon", "", "nzType", "close", 1, "ant-notification-close-icon"]], template: function NzNotificationComponent_Template(rf, ctx) { if (rf & 1) {
        ɵɵelementStart(0, "div", 0);
        ɵɵlistener("mouseenter", function NzNotificationComponent_Template_div_mouseenter_0_listener() { return ctx.onEnter(); })("mouseleave", function NzNotificationComponent_Template_div_mouseleave_0_listener() { return ctx.onLeave(); });
        ɵɵtemplate(1, NzNotificationComponent_div_1_Template, 10, 12, "div", 1);
        ɵɵtemplate(2, NzNotificationComponent_ng_template_2_Template, 0, 0, "ng-template", 2);
        ɵɵelementStart(3, "a", 3);
        ɵɵlistener("click", function NzNotificationComponent_Template_a_click_3_listener() { return ctx.close(); });
        ɵɵelementStart(4, "span", 4);
        ɵɵtemplate(5, NzNotificationComponent_ng_container_5_Template, 2, 1, "ng-container", 5);
        ɵɵtemplate(6, NzNotificationComponent_ng_template_6_Template, 1, 0, "ng-template", null, 6, ɵɵtemplateRefExtractor);
        ɵɵelementEnd();
        ɵɵelementEnd();
        ɵɵelementEnd();
    } if (rf & 2) {
        const _r669 = ɵɵreference(7);
        ɵɵproperty("ngStyle", ctx.nzMessage.options == null ? null : ctx.nzMessage.options.nzStyle)("ngClass", ctx.nzMessage.options == null ? null : ctx.nzMessage.options.nzClass)("@notificationMotion", ctx.state);
        ɵɵadvance(1);
        ɵɵproperty("ngIf", !ctx.nzMessage.template);
        ɵɵadvance(1);
        ɵɵproperty("ngIf", ctx.nzMessage.template)("ngTemplateOutlet", ctx.nzMessage.template)("ngTemplateOutletContext", ɵɵpureFunction2(9, _c1, ctx, ctx.nzMessage.options == null ? null : ctx.nzMessage.options.nzData));
        ɵɵadvance(3);
        ɵɵproperty("ngIf", ctx.nzMessage.options == null ? null : ctx.nzMessage.options.nzCloseIcon)("ngIfElse", _r669);
    } }, directives: [NgStyle, NgClass, NgIf, NgTemplateOutlet, NgSwitch, NgSwitchCase, NzIconDirective, NzStringTemplateOutletDirective], encapsulation: 2, data: { animation: [notificationMotion] } });
/*@__PURE__*/ (function () { ɵsetClassMetadata(NzNotificationComponent, [{
        type: Component,
        args: [{
                encapsulation: ViewEncapsulation.None,
                selector: 'nz-notification',
                exportAs: 'nzNotification',
                preserveWhitespaces: false,
                animations: [notificationMotion],
                template: `
    <div
      class="ant-notification-notice ant-notification-notice-closable"
      [ngStyle]="nzMessage.options?.nzStyle"
      [ngClass]="nzMessage.options?.nzClass"
      [@notificationMotion]="state"
      (mouseenter)="onEnter()"
      (mouseleave)="onLeave()"
    >
      <div *ngIf="!nzMessage.template" class="ant-notification-notice-content">
        <div class="ant-notification-notice-content" [ngClass]="{ 'ant-notification-notice-with-icon': nzMessage.type !== 'blank' }">
          <div [class.ant-notification-notice-with-icon]="nzMessage.type !== 'blank'">
            <ng-container [ngSwitch]="nzMessage.type">
              <i
                *ngSwitchCase="'success'"
                nz-icon
                nzType="check-circle"
                class="ant-notification-notice-icon ant-notification-notice-icon-success"
              ></i>
              <i
                *ngSwitchCase="'info'"
                nz-icon
                nzType="info-circle"
                class="ant-notification-notice-icon ant-notification-notice-icon-info"
              ></i>
              <i
                *ngSwitchCase="'warning'"
                nz-icon
                nzType="exclamation-circle"
                class="ant-notification-notice-icon ant-notification-notice-icon-warning"
              ></i>
              <i
                *ngSwitchCase="'error'"
                nz-icon
                nzType="close-circle"
                class="ant-notification-notice-icon ant-notification-notice-icon-error"
              ></i>
            </ng-container>
            <div class="ant-notification-notice-message" [innerHTML]="nzMessage.title"></div>
            <div class="ant-notification-notice-description" [innerHTML]="nzMessage.content"></div>
          </div>
        </div>
      </div>
      <ng-template
        [ngIf]="nzMessage.template"
        [ngTemplateOutlet]="nzMessage.template"
        [ngTemplateOutletContext]="{ $implicit: this, data: nzMessage.options?.nzData }"
      >
      </ng-template>
      <a tabindex="0" class="ant-notification-notice-close" (click)="close()">
        <span class="ant-notification-notice-close-x">
          <ng-container *ngIf="nzMessage.options?.nzCloseIcon; else iconTpl">
            <ng-container *nzStringTemplateOutlet="nzMessage.options?.nzCloseIcon">
              <i nz-icon [nzType]="nzMessage.options?.nzCloseIcon"></i>
            </ng-container>
          </ng-container>
          <ng-template #iconTpl>
            <i nz-icon nzType="close" class="ant-notification-close-icon"></i>
          </ng-template>
        </span>
      </a>
    </div>
  `
            }]
    }], function () { return [{ type: ChangeDetectorRef }]; }, { nzMessage: [{
            type: Input
        }], nzIndex: [{
            type: Input
        }], nzPlacement: [{
            type: Input
        }], messageDestroy: [{
            type: Output
        }] }); })();

/**
 * @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
 */
function NzNotificationContainerComponent_nz_notification_1_Template(rf, ctx) { if (rf & 1) {
    const _r682 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "nz-notification", 5);
    ɵɵlistener("messageDestroy", function NzNotificationContainerComponent_nz_notification_1_Template_nz_notification_messageDestroy_0_listener($event) { ɵɵrestoreView(_r682); const ctx_r681 = ɵɵnextContext(); return ctx_r681.removeMessage($event.id, $event.userAction); });
    ɵɵelementEnd();
} if (rf & 2) {
    const message_r680 = ctx.$implicit;
    const ctx_r676 = ɵɵnextContext();
    ɵɵproperty("nzMessage", message_r680)("nzPlacement", ctx_r676.config.nzPlacement);
} }
function NzNotificationContainerComponent_nz_notification_3_Template(rf, ctx) { if (rf & 1) {
    const _r685 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "nz-notification", 5);
    ɵɵlistener("messageDestroy", function NzNotificationContainerComponent_nz_notification_3_Template_nz_notification_messageDestroy_0_listener($event) { ɵɵrestoreView(_r685); const ctx_r684 = ɵɵnextContext(); return ctx_r684.removeMessage($event.id, $event.userAction); });
    ɵɵelementEnd();
} if (rf & 2) {
    const message_r683 = ctx.$implicit;
    const ctx_r677 = ɵɵnextContext();
    ɵɵproperty("nzMessage", message_r683)("nzPlacement", ctx_r677.config.nzPlacement);
} }
function NzNotificationContainerComponent_nz_notification_5_Template(rf, ctx) { if (rf & 1) {
    const _r688 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "nz-notification", 5);
    ɵɵlistener("messageDestroy", function NzNotificationContainerComponent_nz_notification_5_Template_nz_notification_messageDestroy_0_listener($event) { ɵɵrestoreView(_r688); const ctx_r687 = ɵɵnextContext(); return ctx_r687.removeMessage($event.id, $event.userAction); });
    ɵɵelementEnd();
} if (rf & 2) {
    const message_r686 = ctx.$implicit;
    const ctx_r678 = ɵɵnextContext();
    ɵɵproperty("nzMessage", message_r686)("nzPlacement", ctx_r678.config.nzPlacement);
} }
function NzNotificationContainerComponent_nz_notification_7_Template(rf, ctx) { if (rf & 1) {
    const _r691 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "nz-notification", 5);
    ɵɵlistener("messageDestroy", function NzNotificationContainerComponent_nz_notification_7_Template_nz_notification_messageDestroy_0_listener($event) { ɵɵrestoreView(_r691); const ctx_r690 = ɵɵnextContext(); return ctx_r690.removeMessage($event.id, $event.userAction); });
    ɵɵelementEnd();
} if (rf & 2) {
    const message_r689 = ctx.$implicit;
    const ctx_r679 = ɵɵnextContext();
    ɵɵproperty("nzMessage", message_r689)("nzPlacement", ctx_r679.config.nzPlacement);
} }
const NZ_CONFIG_COMPONENT_NAME = 'notification';
const NZ_NOTIFICATION_DEFAULT_CONFIG = {
    nzTop: '24px',
    nzBottom: '24px',
    nzPlacement: 'topRight',
    nzDuration: 4500,
    nzMaxStack: 7,
    nzPauseOnHover: true,
    nzAnimate: true
};
class NzNotificationContainerComponent {
    constructor(cdr, nzConfigService) {
        this.cdr = cdr;
        this.nzConfigService = nzConfigService;
        this.messages = [];
        this.destroy$ = new Subject();
        this.updateConfig();
    }
    get topLeftMessages() {
        return this.messages.filter(m => m.options.nzPosition === 'topLeft');
    }
    get topRightMessages() {
        return this.messages.filter(m => m.options.nzPosition === 'topRight' || !m.options.nzPosition);
    }
    get bottomLeftMessages() {
        return this.messages.filter(m => m.options.nzPosition === 'bottomLeft');
    }
    get bottomRightMessages() {
        return this.messages.filter(m => m.options.nzPosition === 'bottomRight');
    }
    /**
     * Create a new notification.
     * If there's a notification whose `nzKey` is same with `nzKey` in `NzNotificationDataFilled`,
     * replace its content instead of create a new one.
     * @override
     * @param notification
     */
    createMessage(notification) {
        notification.options = this.mergeMessageOptions(notification.options);
        notification.onClose = new Subject();
        const key = notification.options.nzKey;
        const notificationWithSameKey = this.messages.find(msg => msg.options.nzKey === notification.options.nzKey);
        if (key && notificationWithSameKey) {
            this.replaceNotification(notificationWithSameKey, notification);
        }
        else {
            if (this.messages.length >= this.config.nzMaxStack) {
                this.messages.splice(0, 1);
            }
            this.messages.push(notification);
        }
        this.cdr.detectChanges();
    }
    updateConfig() {
        const newConfig = (this.config = Object.assign(Object.assign(Object.assign({}, NZ_NOTIFICATION_DEFAULT_CONFIG), this.config), this.nzConfigService.getConfigForComponent(NZ_CONFIG_COMPONENT_NAME)));
        this.top = toCssPixel(newConfig.nzTop);
        this.bottom = toCssPixel(newConfig.nzBottom);
        this.cdr.markForCheck();
    }
    subscribeConfigChange() {
        this.nzConfigService.getConfigChangeEventForComponent(NZ_CONFIG_COMPONENT_NAME).subscribe(() => this.updateConfig());
    }
    replaceNotification(old, _new) {
        old.title = _new.title;
        old.content = _new.content;
        old.template = _new.template;
        old.type = _new.type;
    }
    ngOnInit() {
        this.subscribeConfigChange();
    }
    ngOnDestroy() {
        this.destroy$.next();
        this.destroy$.complete();
    }
    /**
     * Remove a message by `messageId`.
     * @param messageId Id of the message to be removed.
     * @param userAction Whether this is closed by user interaction.
     */
    removeMessage(messageId, userAction = false) {
        this.messages.some((message, index) => {
            if (message.messageId === messageId) {
                this.messages.splice(index, 1);
                this.messages = [...this.messages];
                this.cdr.detectChanges();
                message.onClose.next(userAction);
                message.onClose.complete();
                return true;
            }
            return false;
        });
    }
    /**
     * Remove all messages.
     */
    removeMessageAll() {
        this.messages = [];
        this.cdr.detectChanges();
    }
    /**
     * Merge default options and custom message options
     * @param options
     */
    mergeMessageOptions(options) {
        const defaultOptions = {
            nzDuration: this.config.nzDuration,
            nzAnimate: this.config.nzAnimate,
            nzPauseOnHover: this.config.nzPauseOnHover
        };
        return Object.assign(Object.assign({}, defaultOptions), options);
    }
}
/** @nocollapse */ NzNotificationContainerComponent.ɵfac = function NzNotificationContainerComponent_Factory(t) { return new (t || NzNotificationContainerComponent)(ɵɵdirectiveInject(ChangeDetectorRef), ɵɵdirectiveInject(NzConfigService)); };
/** @nocollapse */ NzNotificationContainerComponent.ɵcmp = ɵɵdefineComponent({ type: NzNotificationContainerComponent, selectors: [["nz-notification-container"]], exportAs: ["nzNotificationContainer"], decls: 8, vars: 20, consts: [[1, "ant-notification", "ant-notification-topLeft"], [3, "nzMessage", "nzPlacement", "messageDestroy", 4, "ngFor", "ngForOf"], [1, "ant-notification", "ant-notification-topRight"], [1, "ant-notification", "ant-notification-bottomLeft"], [1, "ant-notification", "ant-notification-bottomRight"], [3, "nzMessage", "nzPlacement", "messageDestroy"]], template: function NzNotificationContainerComponent_Template(rf, ctx) { if (rf & 1) {
        ɵɵelementStart(0, "div", 0);
        ɵɵtemplate(1, NzNotificationContainerComponent_nz_notification_1_Template, 1, 2, "nz-notification", 1);
        ɵɵelementEnd();
        ɵɵelementStart(2, "div", 2);
        ɵɵtemplate(3, NzNotificationContainerComponent_nz_notification_3_Template, 1, 2, "nz-notification", 1);
        ɵɵelementEnd();
        ɵɵelementStart(4, "div", 3);
        ɵɵtemplate(5, NzNotificationContainerComponent_nz_notification_5_Template, 1, 2, "nz-notification", 1);
        ɵɵelementEnd();
        ɵɵelementStart(6, "div", 4);
        ɵɵtemplate(7, NzNotificationContainerComponent_nz_notification_7_Template, 1, 2, "nz-notification", 1);
        ɵɵelementEnd();
    } if (rf & 2) {
        ɵɵstyleProp("top", ctx.top)("left", "0px");
        ɵɵadvance(1);
        ɵɵproperty("ngForOf", ctx.topLeftMessages);
        ɵɵadvance(1);
        ɵɵstyleProp("top", ctx.top)("right", "0px");
        ɵɵadvance(1);
        ɵɵproperty("ngForOf", ctx.topRightMessages);
        ɵɵadvance(1);
        ɵɵstyleProp("bottom", ctx.bottom)("left", "0px");
        ɵɵadvance(1);
        ɵɵproperty("ngForOf", ctx.bottomLeftMessages);
        ɵɵadvance(1);
        ɵɵstyleProp("bottom", ctx.bottom)("right", "0px");
        ɵɵadvance(1);
        ɵɵproperty("ngForOf", ctx.bottomRightMessages);
    } }, directives: [NgForOf, NzNotificationComponent], encapsulation: 2, changeDetection: 0 });
/*@__PURE__*/ (function () { ɵsetClassMetadata(NzNotificationContainerComponent, [{
        type: Component,
        args: [{
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
                selector: 'nz-notification-container',
                exportAs: 'nzNotificationContainer',
                preserveWhitespaces: false,
                template: `
    <div class="ant-notification ant-notification-topLeft" [style.top]="top" [style.left]="'0px'">
      <nz-notification
        *ngFor="let message of topLeftMessages"
        [nzMessage]="message"
        [nzPlacement]="config.nzPlacement"
        (messageDestroy)="removeMessage($event.id, $event.userAction)"
      ></nz-notification>
    </div>
    <div class="ant-notification ant-notification-topRight" [style.top]="top" [style.right]="'0px'">
      <nz-notification
        *ngFor="let message of topRightMessages"
        [nzMessage]="message"
        [nzPlacement]="config.nzPlacement"
        (messageDestroy)="removeMessage($event.id, $event.userAction)"
      ></nz-notification>
    </div>
    <div class="ant-notification ant-notification-bottomLeft" [style.bottom]="bottom" [style.left]="'0px'">
      <nz-notification
        *ngFor="let message of bottomLeftMessages"
        [nzMessage]="message"
        [nzPlacement]="config.nzPlacement"
        (messageDestroy)="removeMessage($event.id, $event.userAction)"
      ></nz-notification>
    </div>
    <div class="ant-notification ant-notification-bottomRight" [style.bottom]="bottom" [style.right]="'0px'">
      <nz-notification
        *ngFor="let message of bottomRightMessages"
        [nzMessage]="message"
        [nzPlacement]="config.nzPlacement"
        (messageDestroy)="removeMessage($event.id, $event.userAction)"
      ></nz-notification>
    </div>
  `
            }]
    }], function () { return [{ type: ChangeDetectorRef }, { type: NzConfigService }]; }, null); })();

/**
 * @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
 */
class NzNotificationServiceModule {
}
/** @nocollapse */ NzNotificationServiceModule.ɵmod = ɵɵdefineNgModule({ type: NzNotificationServiceModule });
/** @nocollapse */ NzNotificationServiceModule.ɵinj = ɵɵdefineInjector({ factory: function NzNotificationServiceModule_Factory(t) { return new (t || NzNotificationServiceModule)(); } });
/*@__PURE__*/ (function () { ɵsetClassMetadata(NzNotificationServiceModule, [{
        type: NgModule
    }], null, null); })();

/**
 * @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
 */
class NzNotificationModule {
}
/** @nocollapse */ NzNotificationModule.ɵmod = ɵɵdefineNgModule({ type: NzNotificationModule });
/** @nocollapse */ NzNotificationModule.ɵinj = ɵɵdefineInjector({ factory: function NzNotificationModule_Factory(t) { return new (t || NzNotificationModule)(); }, imports: [[CommonModule, OverlayModule, NzIconModule, NzOutletModule, NzNotificationServiceModule]] });
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(NzNotificationModule, { declarations: [NzNotificationComponent, NzNotificationContainerComponent], imports: [CommonModule, OverlayModule, NzIconModule, NzOutletModule, NzNotificationServiceModule] }); })();
/*@__PURE__*/ (function () { ɵsetClassMetadata(NzNotificationModule, [{
        type: NgModule,
        args: [{
                imports: [CommonModule, OverlayModule, NzIconModule, NzOutletModule, NzNotificationServiceModule],
                declarations: [NzNotificationComponent, NzNotificationContainerComponent]
            }]
    }], null, null); })();

/**
 * @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
 */
let globalCounter = 0;
class NzNotificationService {
    constructor(nzSingletonService, overlay, injector) {
        this.nzSingletonService = nzSingletonService;
        this.overlay = overlay;
        this.injector = injector;
        this.name = 'notification-';
    }
    remove(messageId) {
        if (messageId) {
            this.container.removeMessage(messageId);
        }
        else {
            this.container.removeMessageAll();
        }
    }
    createMessage(message, options) {
        this.container = this.withContainer();
        this.nzSingletonService.registerSingletonWithKey(this.name, this.container);
        const resultMessage = Object.assign(Object.assign({}, message), {
            createdAt: new Date(),
            messageId: this.generateMessageId(),
            options
        });
        this.container.createMessage(resultMessage);
        return resultMessage;
    }
    generateMessageId() {
        return `${this.name}-${globalCounter++}`;
    }
    // Manually creating container for overlay to avoid multi-checking error, see: https://github.com/NG-ZORRO/ng-zorro-antd/issues/391
    // NOTE: we never clean up the container component and it's overlay resources, if we should, we need to do it by our own codes.
    withContainer() {
        const containerInstance = this.nzSingletonService.getSingletonWithKey(this.name);
        if (containerInstance) {
            return containerInstance;
        }
        const overlayRef = this.overlay.create({
            hasBackdrop: false,
            scrollStrategy: this.overlay.scrollStrategies.noop(),
            positionStrategy: this.overlay.position().global()
        });
        const componentPortal = new ComponentPortal(NzNotificationContainerComponent, null, this.injector);
        const componentRef = overlayRef.attach(componentPortal);
        const overlayPane = overlayRef.overlayElement;
        overlayPane.style.zIndex = '1010'; // Patching: assign the same zIndex of ant-message to it's parent overlay panel, to the ant-message's zindex work.
        return componentRef.instance;
    }
    // Shortcut methods
    success(title, content, options) {
        return this.createMessage({ type: 'success', title, content }, options);
    }
    error(title, content, options) {
        return this.createMessage({ type: 'error', title, content }, options);
    }
    info(title, content, options) {
        return this.createMessage({ type: 'info', title, content }, options);
    }
    warning(title, content, options) {
        return this.createMessage({ type: 'warning', title, content }, options);
    }
    blank(title, content, options) {
        return this.createMessage({ type: 'blank', title, content }, options);
    }
    create(type, title, content, options) {
        return this.createMessage({ type, title, content }, options);
    }
    // For content with template
    template(template, options) {
        return this.createMessage({ template }, options);
    }
}
/** @nocollapse */ NzNotificationService.ɵfac = function NzNotificationService_Factory(t) { return new (t || NzNotificationService)(ɵɵinject(NzSingletonService), ɵɵinject(Overlay), ɵɵinject(Injector)); };
/** @nocollapse */ NzNotificationService.ɵprov = ɵɵdefineInjectable({ token: NzNotificationService, factory: NzNotificationService.ɵfac, providedIn: NzNotificationServiceModule });
/*@__PURE__*/ (function () { ɵsetClassMetadata(NzNotificationService, [{
        type: Injectable,
        args: [{
                providedIn: NzNotificationServiceModule
            }]
    }], function () { return [{ type: NzSingletonService }, { type: Overlay }, { type: Injector }]; }, null); })();

/**
 * @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
 */

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

export { NzNotificationComponent, NzNotificationContainerComponent, NzNotificationModule, NzNotificationService, NzNotificationServiceModule };
//# sourceMappingURL=ng-zorro-antd-notification.js.map
