{"version":3,"file":"ng-zorro-antd-alert.mjs","sources":["../../components/alert/alert.component.ts","../../components/alert/alert.module.ts","../../components/alert/public-api.ts","../../components/alert/ng-zorro-antd-alert.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { Direction, Directionality } from '@angular/cdk/bidi';\nimport {\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  EventEmitter,\n  Input,\n  OnChanges,\n  OnInit,\n  Output,\n  SimpleChanges,\n  TemplateRef,\n  ViewEncapsulation,\n  booleanAttribute,\n  inject,\n  DestroyRef\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { slideAlertMotion } from 'ng-zorro-antd/core/animation';\nimport { NzConfigKey, onConfigChangeEventForComponent, WithConfig } from 'ng-zorro-antd/core/config';\nimport { NzOutletModule } from 'ng-zorro-antd/core/outlet';\nimport { NzIconModule } from 'ng-zorro-antd/icon';\n\nconst NZ_CONFIG_MODULE_NAME: NzConfigKey = 'alert';\nexport type NzAlertType = 'success' | 'info' | 'warning' | 'error';\n\n@Component({\n  selector: 'nz-alert',\n  exportAs: 'nzAlert',\n  animations: [slideAlertMotion],\n  imports: [NzIconModule, NzOutletModule],\n  template: `\n    @if (!closed) {\n      <div\n        class=\"ant-alert\"\n        [class.ant-alert-rtl]=\"dir === 'rtl'\"\n        [class.ant-alert-success]=\"nzType === 'success'\"\n        [class.ant-alert-info]=\"nzType === 'info'\"\n        [class.ant-alert-warning]=\"nzType === 'warning'\"\n        [class.ant-alert-error]=\"nzType === 'error'\"\n        [class.ant-alert-no-icon]=\"!nzShowIcon\"\n        [class.ant-alert-banner]=\"nzBanner\"\n        [class.ant-alert-closable]=\"nzCloseable\"\n        [class.ant-alert-with-description]=\"!!nzDescription\"\n        [@.disabled]=\"nzNoAnimation\"\n        [@slideAlertMotion]\n        (@slideAlertMotion.done)=\"onFadeAnimationDone()\"\n      >\n        @if (nzShowIcon) {\n          <div class=\"ant-alert-icon\">\n            @if (nzIcon) {\n              <ng-container *nzStringTemplateOutlet=\"nzIcon\"></ng-container>\n            } @else {\n              <nz-icon [nzType]=\"nzIconType || inferredIconType\" [nzTheme]=\"iconTheme\" />\n            }\n          </div>\n        }\n\n        @if (nzMessage || nzDescription) {\n          <div class=\"ant-alert-content\">\n            @if (nzMessage) {\n              <span class=\"ant-alert-message\">\n                <ng-container *nzStringTemplateOutlet=\"nzMessage\">{{ nzMessage }}</ng-container>\n              </span>\n            }\n            @if (nzDescription) {\n              <span class=\"ant-alert-description\">\n                <ng-container *nzStringTemplateOutlet=\"nzDescription\">{{ nzDescription }}</ng-container>\n              </span>\n            }\n          </div>\n        }\n\n        @if (nzAction) {\n          <div class=\"ant-alert-action\">\n            <ng-container *nzStringTemplateOutlet=\"nzAction\">{{ nzAction }}</ng-container>\n          </div>\n        }\n\n        @if (nzCloseable || nzCloseText) {\n          <button type=\"button\" tabindex=\"0\" class=\"ant-alert-close-icon\" (click)=\"closeAlert()\">\n            @if (nzCloseText) {\n              <ng-container *nzStringTemplateOutlet=\"nzCloseText\">\n                <span class=\"ant-alert-close-text\">{{ nzCloseText }}</span>\n              </ng-container>\n            } @else {\n              <nz-icon nzType=\"close\" />\n            }\n          </button>\n        }\n      </div>\n    }\n  `,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None\n})\nexport class NzAlertComponent implements OnChanges, OnInit {\n  private cdr = inject(ChangeDetectorRef);\n  private directionality = inject(Directionality);\n  private readonly destroyRef = inject(DestroyRef);\n  readonly _nzModuleName: NzConfigKey = NZ_CONFIG_MODULE_NAME;\n\n  @Input() nzAction: string | TemplateRef<void> | null = null;\n  @Input() nzCloseText: string | TemplateRef<void> | null = null;\n  @Input() nzIconType: string | null = null;\n  @Input() nzMessage: string | TemplateRef<void> | null = null;\n  @Input() nzDescription: string | TemplateRef<void> | null = null;\n  @Input() nzType: 'success' | 'info' | 'warning' | 'error' = 'info';\n  @Input({ transform: booleanAttribute }) @WithConfig() nzCloseable: boolean = false;\n  @Input({ transform: booleanAttribute }) @WithConfig() nzShowIcon: boolean = false;\n  @Input({ transform: booleanAttribute }) nzBanner = false;\n  @Input({ transform: booleanAttribute }) nzNoAnimation = false;\n  @Input() nzIcon: string | TemplateRef<void> | null = null;\n  @Output() readonly nzOnClose = new EventEmitter<boolean>();\n  closed = false;\n  iconTheme: 'outline' | 'fill' = 'fill';\n  inferredIconType: string = 'info-circle';\n  dir: Direction = 'ltr';\n  private isTypeSet = false;\n  private isShowIconSet = false;\n\n  constructor() {\n    onConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME, () => this.cdr.markForCheck());\n  }\n\n  ngOnInit(): void {\n    this.directionality.change?.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((direction: Direction) => {\n      this.dir = direction;\n      this.cdr.detectChanges();\n    });\n\n    this.dir = this.directionality.value;\n  }\n\n  closeAlert(): void {\n    this.closed = true;\n  }\n\n  onFadeAnimationDone(): void {\n    if (this.closed) {\n      this.nzOnClose.emit(true);\n    }\n  }\n\n  ngOnChanges(changes: SimpleChanges): void {\n    const { nzShowIcon, nzDescription, nzType, nzBanner } = changes;\n    if (nzShowIcon) {\n      this.isShowIconSet = true;\n    }\n    if (nzType) {\n      this.isTypeSet = true;\n      switch (this.nzType) {\n        case 'error':\n          this.inferredIconType = 'close-circle';\n          break;\n        case 'success':\n          this.inferredIconType = 'check-circle';\n          break;\n        case 'info':\n          this.inferredIconType = 'info-circle';\n          break;\n        case 'warning':\n          this.inferredIconType = 'exclamation-circle';\n          break;\n      }\n    }\n    if (nzDescription) {\n      this.iconTheme = this.nzDescription ? 'outline' : 'fill';\n    }\n    if (nzBanner) {\n      if (!this.isTypeSet) {\n        this.nzType = 'warning';\n      }\n      if (!this.isShowIconSet) {\n        this.nzShowIcon = true;\n      }\n    }\n  }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { NgModule } from '@angular/core';\n\nimport { NzAlertComponent } from './alert.component';\n\n@NgModule({\n  exports: [NzAlertComponent],\n  imports: [NzAlertComponent]\n})\nexport class NzAlertModule {}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nexport * from './alert.component';\nexport * from './alert.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;AA6BA,MAAM,qBAAqB,GAAgB,OAAO;IAyErC,gBAAgB,GAAA,CAAA,MAAA;;;;;;;iBAAhB,gBAAgB,CAAA;;;AAYc,YAAA,uBAAA,GAAA,CAAA,UAAU,EAAE,CAAA;AACZ,YAAA,sBAAA,GAAA,CAAA,UAAU,EAAE,CAAA;YADC,YAAA,CAAA,IAAA,EAAA,IAAA,EAAA,uBAAA,EAAA,EAAA,IAAA,EAAA,OAAA,EAAA,IAAA,EAAA,aAAA,EAAA,MAAA,EAAA,KAAA,EAAA,OAAA,EAAA,KAAA,EAAA,MAAA,EAAA,EAAA,GAAA,EAAA,GAAA,IAAA,aAAA,IAAA,GAAA,EAAA,GAAA,EAAA,GAAA,IAAA,GAAA,CAAA,WAAW,EAAX,GAAA,EAAA,CAAA,GAAA,EAAA,KAAA,KAAA,EAAA,GAAA,CAAA,WAAW,GAAkB,KAAA,CAAA,EAAA,EAAA,EAAA,QAAA,EAAA,SAAA,EAAA,EAAA,yBAAA,EAAA,8BAAA,CAAA;YAC7B,YAAA,CAAA,IAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,EAAA,IAAA,EAAA,OAAA,EAAA,IAAA,EAAA,YAAA,EAAA,MAAA,EAAA,KAAA,EAAA,OAAA,EAAA,KAAA,EAAA,MAAA,EAAA,EAAA,GAAA,EAAA,GAAA,IAAA,YAAA,I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