import * as i1 from '@angular/common';
import { DOCUMENT, CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { Directive, Input, HostListener, Component, Inject, ViewChild, EventEmitter, Output, Injectable, NgModule } from '@angular/core';
import * as i2 from 'ng-devui/button';
import { ButtonModule } from 'ng-devui/button';
import * as i3 from 'ng-devui/icon';
import { IconModule } from 'ng-devui/icon';
import * as i1$3 from 'ng-devui/overlay-container';
import { OverlayContainerModule } from 'ng-devui/overlay-container';
import { DocumentRef } from 'ng-devui/window-ref';
import { isUndefined, assign } from 'lodash-es';
import * as i1$2 from '@angular/platform-browser';
import * as i2$1 from 'ng-devui/utils';
import { backdropFadeInOut, wipeInOutAnimation } from 'ng-devui/utils';
import { Subscription, fromEvent } from 'rxjs';
import * as i1$1 from 'ng-devui/i18n';

class ModalContentDirective {
    constructor(viewContainerRef) {
        this.viewContainerRef = viewContainerRef;
    }
}
ModalContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalContentDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
ModalContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: ModalContentDirective, selector: "[dModalContentHost]", ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalContentDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[dModalContentHost]',
                }]
        }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
class ModalContainerDirective {
    constructor(viewContainerRef) {
        this.viewContainerRef = viewContainerRef;
    }
}
ModalContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalContainerDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
ModalContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: ModalContainerDirective, selector: "[dModalContainerHost]", ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalContainerDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[dModalContainerHost]',
                }]
        }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });

class MovableDirective {
    constructor(el) {
        this.el = el;
        this.topStart = 0;
        this.leftStart = 0;
        this._allowDrag = false;
        this.checkHandleTarget = function (target, element) {
            if (!element) {
                return false;
            }
            // Checks if the target is the element clicked, then checks each child element of element as well
            // Ignores button clicks
            // Ignore elements of type button
            if (element.tagName === 'BUTTON') {
                return false;
            }
            // If the target was found, return true (handle was found)
            if (element === target) {
                return true;
            }
            // Recursively iterate this elements children
            for (const /** @type {?} */ child in element.children) {
                if (Object.prototype.hasOwnProperty.call(element.children, child)) {
                    if (this.checkHandleTarget(target, element.children[child])) {
                        return true;
                    }
                }
            }
            // Handle was not found in this lineage
            // Note: return false is ignore unless it is the parent element
            return false;
        };
    }
    ngOnInit() {
        this.element = this.moveEl || this.el.nativeElement;
        // css changes
        if (this._allowDrag) {
            this.element.style.position = 'relative';
        }
    }
    ngOnChanges(changes) {
        if (changes['moveEl']) {
            this.element = this.moveEl || this.el.nativeElement;
        }
        if (changes['handle']) {
            this.allowDrag = this._allowDrag;
        }
    }
    onMouseDown(event) {
        if (event.button === 2 || !this.checkHandleTarget(event.target, this.handle)) {
            return; // prevents right click drag, remove his if you don't want it
        }
        this.md = true;
        this.topStart = event.clientY - this.element.style.top.replace('px', '');
        this.leftStart = event.clientX - this.element.style.left.replace('px', '');
    }
    onMouseUp(event) {
        this.md = false;
    }
    onMouseMove(event) {
        var _a;
        if (typeof window !== 'undefined' && this.md && this._allowDrag) {
            // 阻止拖动过程中文字被选中
            event.stopPropagation();
            event.preventDefault();
            // 判断边界条件
            const modalRect = this.element.getBoundingClientRect();
            const parentRect = this.element.parentNode.getBoundingClientRect();
            const [translateX, translateY] = ((_a = this.element.style.transform.match(/\d+/g)) === null || _a === void 0 ? void 0 : _a.map(item => Number(item))) || [0, 0];
            // 当前偏移量
            let currentTop = event.clientY - this.topStart;
            let currentLeft = event.clientX - this.leftStart;
            // 计算上下距离，按照parentNode的位置计算偏移量，后续parentNode存在偏移量，需要考虑偏移量
            const maxTop = window.innerHeight - parentRect.top - modalRect.height;
            currentTop =
                (parentRect.top + currentTop + translateY <= 0 && -parentRect.top - translateY) ||
                    (maxTop - currentTop - translateY <= 0 && maxTop - translateY) ||
                    currentTop;
            const halfWidth = (window.innerWidth - modalRect.width) / 2;
            // 计算左右距离，默认居中，后续parentNode存在偏移量，需要考虑偏移量
            currentLeft =
                (currentLeft + halfWidth + translateX <= 0 && -halfWidth - translateX) ||
                    (halfWidth - currentLeft - translateX <= 0 && halfWidth - translateX) ||
                    currentLeft;
            this.element.style.top = currentTop + 'px';
            this.element.style.left = currentLeft + 'px';
        }
    }
    onTouchStart(event) {
        this.md = true;
        this.topStart = event.changedTouches[0].clientY - this.element.style.top.replace('px', '');
        this.leftStart = event.changedTouches[0].clientX - this.element.style.left.replace('px', '');
        event.stopPropagation();
    }
    onTouchEnd() {
        this.md = false;
    }
    onTouchMove(event) {
        if (this.md && this._allowDrag) {
            this.element.style.top = (event.changedTouches[0].clientY - this.topStart) + 'px';
            this.element.style.left = (event.changedTouches[0].clientX - this.leftStart) + 'px';
        }
        event.stopPropagation();
    }
    set allowDrag(value) {
        this._allowDrag = value;
        if (this._allowDrag && this.handle) {
            this.handle.style.cursor = 'move';
        }
    }
}
MovableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MovableDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
MovableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: MovableDirective, selector: "[dMovable]", inputs: { handle: "handle", moveEl: "moveEl", allowDrag: ["dMovable", "allowDrag"] }, host: { listeners: { "mousedown": "onMouseDown($event)", "document:mouseup": "onMouseUp($event)", "document:mousemove": "onMouseMove($event)", "touchstart": "onTouchStart($event)", "document:touchend": "onTouchEnd()", "document:touchmove": "onTouchMove($event)" } }, usesOnChanges: true, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MovableDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[dMovable]'
                }]
        }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { handle: [{
                type: Input
            }], moveEl: [{
                type: Input
            }], onMouseDown: [{
                type: HostListener,
                args: ['mousedown', ['$event']]
            }], onMouseUp: [{
                type: HostListener,
                args: ['document:mouseup', ['$event']]
            }], onMouseMove: [{
                type: HostListener,
                args: ['document:mousemove', ['$event']]
            }], onTouchStart: [{
                type: HostListener,
                args: ['touchstart', ['$event']]
            }], onTouchEnd: [{
                type: HostListener,
                args: ['document:touchend']
            }], onTouchMove: [{
                type: HostListener,
                args: ['document:touchmove', ['$event']]
            }], allowDrag: [{
                type: Input,
                args: ['dMovable']
            }] } });

class ModalComponent {
    constructor(elementRef, renderer, doc) {
        this.elementRef = elementRef;
        this.renderer = renderer;
        this.doc = doc;
        this.showAnimation = true;
        this.placement = 'center';
        this.bodyScrollable = true; // 打开弹窗body是否可滚动
        this.animateState = '';
        this.ignoreBackDropClick = false;
        this.pressEscToClose = new Subscription();
        this.onModalClick = ($event) => {
            // 一定要document.contains($event.target)，因为$event.target可能已经不在document里了，这个时候就不能进hide了,使用document.body兼容IE
            if (this.backdropCloseable && !this.ignoreBackDropClick &&
                (!this.dialogElement.nativeElement.contains($event.target) && this.document.body.contains($event.target))) {
                this.hide();
            }
            this.ignoreBackDropClick = false;
        };
        this.modalMouseDown = ($event) => {
            this.mouseDwonEl = $event.target;
        };
        this.modalMouseUp = ($event) => {
            if ($event.target !== this.mouseDwonEl) {
                this.ignoreBackDropClick = true;
            }
        };
        this.backdropCloseable = isUndefined(this.backdropCloseable)
            ? true
            : this.backdropCloseable;
        this.document = this.doc;
    }
    /**
     * @deprecated Use showAnimation to replace.
     */
    set showAnimate(isShowAnimate) {
        this.showAnimation = isShowAnimate;
    }
    ngOnInit() {
        if (this.escapable) {
            this.pressEscToClose.add(fromEvent(window, 'keydown').subscribe((event) => {
                if (event['keyCode'] === 27) {
                    this.hide();
                }
            }));
        }
        const handle = this.elementRef.nativeElement.querySelector('#d-modal-header');
        if (handle) {
            this.draggableHandleEl = handle;
        }
    }
    // Will overwrite this method in modal service
    onHidden() {
    }
    updateButtonOptions(buttonOptions) {
    }
    canHideModel() {
        let hiddenResult = Promise.resolve(true);
        if (this.beforeHidden) {
            const result = this.beforeHidden();
            if (typeof result !== 'undefined') {
                if (result.then) {
                    hiddenResult = result;
                }
                else if (result.subscribe) {
                    hiddenResult = result.toPromise();
                }
                else {
                    hiddenResult = Promise.resolve(result);
                }
            }
        }
        return hiddenResult;
    }
    hide() {
        this.canHideModel().then((canHide) => {
            if (!canHide) {
                return;
            }
            this.animateState = 'void';
        });
    }
    onAnimationEnd($event) {
        if ($event.fromState !== 'void' && this.animateState === 'void') {
            this.onHidden();
        }
    }
    show() {
        if (this.document.documentElement.scrollHeight > this.document.documentElement.clientHeight) {
            this.documentOverFlow = true;
            this.scrollTop = this.document.documentElement.scrollTop || this.document.body.scrollTop;
            this.scrollLeft = this.document.documentElement.scrollLeft || this.document.body.scrollLeft;
            this.renderer.addClass(this.document.body, 'devui-body-scrollblock');
            this.renderer.setStyle(this.document.body, 'top', `-${this.scrollTop}px`);
            this.renderer.setStyle(this.document.body, 'left', `-${this.scrollLeft}px`);
        }
        if (!this.bodyScrollable && this.documentOverFlow) {
            this.renderer.addClass(this.document.body, 'devui-body-overflow-hidden');
        }
        this.dialogElement.nativeElement.focus();
        if (this.showAnimation) {
            this.animateState = 'in';
        }
    }
    resolveTransformTranslate() {
        let autoOffsetYByPlacement;
        switch (this.placement) {
            case 'top':
                autoOffsetYByPlacement = '40px';
                break;
            case 'bottom':
                autoOffsetYByPlacement = '-40px';
                break;
            case 'center':
            default:
                autoOffsetYByPlacement = '0';
                break;
        }
        const offsetX = this.offsetX ? this.offsetX : '0';
        const offsetY = this.offsetY ? this.offsetY : autoOffsetYByPlacement;
        return 'translate(' + offsetX + ',' + offsetY + ')';
    }
    ngOnDestroy() {
        if (this.pressEscToClose) {
            this.pressEscToClose.unsubscribe();
            this.pressEscToClose = null;
        }
    }
}
ModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
ModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: ModalComponent, selector: "d-modal", inputs: { id: "id", showAnimation: "showAnimation", showAnimate: "showAnimate", width: "width", zIndex: "zIndex", backDropZIndex: "backDropZIndex", backdropCloseable: "backdropCloseable", beforeHidden: "beforeHidden", draggable: "draggable", placement: "placement", offsetX: "offsetX", offsetY: "offsetY", bodyScrollable: "bodyScrollable", escapable: "escapable" }, viewQueries: [{ propertyName: "modalContainerHost", first: true, predicate: ModalContainerDirective, descendants: true, static: true }, { propertyName: "dialogElement", first: true, predicate: ["dialog"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"modal-backdrop\" [ngStyle]=\"{ 'z-index': backDropZIndex }\" [@backdropAnimation]=\"animateState\"></div>\n<div\n  class=\"modal in\"\n  [ngStyle]=\"{ 'z-index': zIndex }\"\n  [attr.id]=\"id\"\n  (mousedown)=\"modalMouseDown($event)\"\n  (mouseup)=\"modalMouseUp($event)\"\n  (click)=\"onModalClick($event)\"\n>\n  <div\n    class=\"modal-dialog\"\n    [ngClass]=\"{\n      'place-at-top': placement === 'top',\n      'place-at-bottom': placement === 'bottom',\n      'place-at-center': placement === 'center'\n    }\"\n    [ngStyle]=\"{ width: width }\"\n    [@wipeInOutAnimation]=\"animateState\"\n    (@wipeInOutAnimation.done)=\"onAnimationEnd($event)\"\n    tabindex=\"1\"\n    #dialog\n  >\n    <div class=\"modal-content\" [dMovable]=\"draggable\" [handle]=\"draggableHandleEl\" [ngStyle]=\"{ transform: resolveTransformTranslate() }\">\n      <ng-template dModalContainerHost></ng-template>\n      <ng-container *ngIf=\"contentTemplate\">\n        <ng-template [ngTemplateOutlet]=\"contentTemplate\" [ngTemplateOutletContext]=\"{ modalInstance: this }\"></ng-template>\n      </ng-container>\n    </div>\n  </div>\n</div>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;z-index:var(--devui-z-index-modal, 1050);outline:0;overflow-y:auto;display:block;display:flex;flex-direction:column}.devui-body-scrollblock .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:0 auto}.modal-dialog.place-at-center{margin:auto}.modal-dialog.place-at-top{margin-bottom:auto}.modal-dialog.place-at-bottom{margin-top:auto}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1049;z-index:calc(var(--devui-z-index-modal, 1050) - 1);background-color:#252b3a33;background-color:var(--devui-shadow, rgba(37, 43, 58, .2))}:host ::ng-deep .modal-content{position:relative;border-radius:6px;border-radius:var(--devui-border-radius-card, 6px);border:none;background-color:#fff;background-color:var(--devui-fullscreen-overlay-bg, #ffffff);background-clip:padding-box;outline:0;box-shadow:0 12px 24px #252b3a33;box-shadow:var(--devui-shadow-length-fullscreen-overlay, 0 12px 24px 0) var(--devui-shadow, rgba(37, 43, 58, .2))}:host ::ng-deep .modal-content .modal-body{padding:20px;color:#575d6c;color:var(--devui-text-weak, #575d6c)}:host ::ng-deep .modal-content .modal-footer{border-top:none;text-align:center;padding:0 20px 20px}:host ::ng-deep .modal-content .modal-footer button{margin:0 5px;width:auto}:host ::ng-deep .modal-content .modal-footer button.pull-left{padding-left:5px;padding-right:5px;position:relative;left:-5px}:host ::ng-deep .modal-content .modal-footer button+button{margin-bottom:16px}:host ::ng-deep .d-btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;background-image:none;white-space:nowrap;font-size:14px;font-size:var(--devui-font-size-card-title, 14px);line-height:1.42857143;border-radius:2px;border-radius:var(--devui-border-radius, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none}:focus{outline:none}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: ModalContainerDirective, selector: "[dModalContainerHost]" }, { kind: "directive", type: MovableDirective, selector: "[dMovable]", inputs: ["handle", "moveEl", "dMovable"] }], animations: [
        backdropFadeInOut,
        wipeInOutAnimation
    ] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalComponent, decorators: [{
            type: Component,
            args: [{ selector: 'd-modal', animations: [
                        backdropFadeInOut,
                        wipeInOutAnimation
                    ], preserveWhitespaces: false, template: "<div class=\"modal-backdrop\" [ngStyle]=\"{ 'z-index': backDropZIndex }\" [@backdropAnimation]=\"animateState\"></div>\n<div\n  class=\"modal in\"\n  [ngStyle]=\"{ 'z-index': zIndex }\"\n  [attr.id]=\"id\"\n  (mousedown)=\"modalMouseDown($event)\"\n  (mouseup)=\"modalMouseUp($event)\"\n  (click)=\"onModalClick($event)\"\n>\n  <div\n    class=\"modal-dialog\"\n    [ngClass]=\"{\n      'place-at-top': placement === 'top',\n      'place-at-bottom': placement === 'bottom',\n      'place-at-center': placement === 'center'\n    }\"\n    [ngStyle]=\"{ width: width }\"\n    [@wipeInOutAnimation]=\"animateState\"\n    (@wipeInOutAnimation.done)=\"onAnimationEnd($event)\"\n    tabindex=\"1\"\n    #dialog\n  >\n    <div class=\"modal-content\" [dMovable]=\"draggable\" [handle]=\"draggableHandleEl\" [ngStyle]=\"{ transform: resolveTransformTranslate() }\">\n      <ng-template dModalContainerHost></ng-template>\n      <ng-container *ngIf=\"contentTemplate\">\n        <ng-template [ngTemplateOutlet]=\"contentTemplate\" [ngTemplateOutletContext]=\"{ modalInstance: this }\"></ng-template>\n      </ng-container>\n    </div>\n  </div>\n</div>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;z-index:var(--devui-z-index-modal, 1050);outline:0;overflow-y:auto;display:block;display:flex;flex-direction:column}.devui-body-scrollblock .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:0 auto}.modal-dialog.place-at-center{margin:auto}.modal-dialog.place-at-top{margin-bottom:auto}.modal-dialog.place-at-bottom{margin-top:auto}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1049;z-index:calc(var(--devui-z-index-modal, 1050) - 1);background-color:#252b3a33;background-color:var(--devui-shadow, rgba(37, 43, 58, .2))}:host ::ng-deep .modal-content{position:relative;border-radius:6px;border-radius:var(--devui-border-radius-card, 6px);border:none;background-color:#fff;background-color:var(--devui-fullscreen-overlay-bg, #ffffff);background-clip:padding-box;outline:0;box-shadow:0 12px 24px #252b3a33;box-shadow:var(--devui-shadow-length-fullscreen-overlay, 0 12px 24px 0) var(--devui-shadow, rgba(37, 43, 58, .2))}:host ::ng-deep .modal-content .modal-body{padding:20px;color:#575d6c;color:var(--devui-text-weak, #575d6c)}:host ::ng-deep .modal-content .modal-footer{border-top:none;text-align:center;padding:0 20px 20px}:host ::ng-deep .modal-content .modal-footer button{margin:0 5px;width:auto}:host ::ng-deep .modal-content .modal-footer button.pull-left{padding-left:5px;padding-right:5px;position:relative;left:-5px}:host ::ng-deep .modal-content .modal-footer button+button{margin-bottom:16px}:host ::ng-deep .d-btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;background-image:none;white-space:nowrap;font-size:14px;font-size:var(--devui-font-size-card-title, 14px);line-height:1.42857143;border-radius:2px;border-radius:var(--devui-border-radius, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none}:focus{outline:none}\n"] }]
        }], ctorParameters: function () {
        return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
                        type: Inject,
                        args: [DOCUMENT]
                    }] }];
    }, propDecorators: { id: [{
                type: Input
            }], showAnimation: [{
                type: Input
            }], showAnimate: [{
                type: Input
            }], width: [{
                type: Input
            }], zIndex: [{
                type: Input
            }], backDropZIndex: [{
                type: Input
            }], backdropCloseable: [{
                type: Input
            }], beforeHidden: [{
                type: Input
            }], draggable: [{
                type: Input
            }], placement: [{
                type: Input
            }], offsetX: [{
                type: Input
            }], offsetY: [{
                type: Input
            }], bodyScrollable: [{
                type: Input
            }], escapable: [{
                type: Input
            }], modalContainerHost: [{
                type: ViewChild,
                args: [ModalContainerDirective, { static: true }]
            }], dialogElement: [{
                type: ViewChild,
                args: ['dialog', { static: true }]
            }] } });

class ModalHeaderComponent {
    constructor(ref, i18n) {
        this.ref = ref;
        this.i18n = i18n;
        this.dialogtype = 'standard';
        this.closeEvent = new EventEmitter();
    }
    get checkDialogType() {
        var _a;
        return ((_a = this.dialogtype) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || 'standard';
    }
    ngOnInit() {
        this.i18nText = this.i18n.getI18nText().modal;
        this.i18nSubscription = this.i18n.langChange().subscribe((data) => {
            this.i18nText = data.modal;
            this.ref.markForCheck();
        });
    }
    close(event) {
        this.closeEvent.emit(event);
    }
    ngOnDestroy() {
        if (this.i18nSubscription) {
            this.i18nSubscription.unsubscribe();
        }
    }
}
ModalHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalHeaderComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.I18nService }], target: i0.ɵɵFactoryTarget.Component });
ModalHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: ModalHeaderComponent, selector: "d-modal-header", inputs: { title: "title", dialogtype: "dialogtype", showCloseBtn: "showCloseBtn" }, outputs: { closeEvent: "closeEvent" }, ngImport: i0, template: "<div class=\"modal-header\" [ngClass]=\"{ 'no-title': !title && title !== '' && checkDialogType === 'standard' }\">\n  <div class=\"standard-title\">\n    <div *ngIf=\"checkDialogType === 'warning'\" class=\"header-alert-icon\">\n      <svg\n        class=\"devui-icon devui-icon-warning\"\n        viewBox=\"0 0 16 16\"\n        version=\"1.1\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n      >\n        <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n          <polygon\n            points=\"7.5 1.74501946 1.39184847 13.5954649 7.08947368 14.2207621 13.9973698 13.5954649 10.9383683 5.61273879 8.40084114 1.27624313\"\n          ></polygon>\n          <path\n            d=\"M8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 Z M8.87894737,11.2105263 L7.08947368,11.2105263 L7.08947368,13 L8.87894737,13 L8.87894737,11.2105263 Z M8.96842105,4.5 L7,4.5 L7.08947368,9.86842105 L8.87894737,9.86842105 L8.96842105,4.5 Z\"\n          ></path>\n        </g>\n      </svg>\n    </div>\n    <div *ngIf=\"checkDialogType === 'failed'\" class=\"header-alert-icon\">\n      <svg\n        class=\"devui-icon devui-icon-error\"\n        width=\"16px\"\n        height=\"16px\"\n        viewBox=\"0 0 16 16\"\n        version=\"1.1\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n      >\n        <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n          <circle cx=\"8\" cy=\"8\" r=\"7\"></circle>\n          <path\n            d=\"M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,12.6 L7,12.6 L7,10.6 L9,10.6 L9,12.6 Z M9,9.1 L7,9.1 L6.9,3.1 L9.1,3.1 L9,9.1 Z\"\n            fill-rule=\"nonzero\"\n          ></path>\n        </g>\n      </svg>\n    </div>\n    <div *ngIf=\"checkDialogType === 'sucess' || checkDialogType === 'success'\" class=\"header-alert-icon\">\n      <svg\n        class=\"devui-icon devui-icon-success\"\n        viewBox=\"0 0 16 16\"\n        version=\"1.1\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n      >\n        <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n          <circle cx=\"8\" cy=\"8\" r=\"7\"></circle>\n          <path d=\"M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z\" fill-rule=\"nonzero\"></path>\n          <polygon\n            stroke-width=\"0.4\"\n            fill-rule=\"nonzero\"\n            points=\"8.16 10.48 7.32 11.32 6.48 10.48 6.48 10.48 3.6 7.68 4.44 6.84 7.28 9.68 11.52 5.44 12.36 6.28\"\n          ></polygon>\n        </g>\n      </svg>\n    </div>\n    <div *ngIf=\"checkDialogType === 'info'\" class=\"header-alert-icon\">\n      <svg\n        class=\"devui-icon devui-icon-info\"\n        viewBox=\"0 0 16 16\"\n        version=\"1.1\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n      >\n        <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n          <circle cx=\"8\" cy=\"8\" r=\"7\"></circle>\n          <g stroke-width=\"1\">\n            <path\n              d=\"M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,5 L7,5 L7,3 L9,3 L9,5 Z M9,12.6 L7,12.6 L7,6.6 L9,6.6 L9,12.6 Z\"\n            ></path>\n          </g>\n        </g>\n      </svg>\n    </div>\n    <span *ngIf=\"title\" [title]=\"title\" class=\"title-text\">{{ title }}</span>\n    <ng-container *ngIf=\"!title\">\n      <span *ngIf=\"checkDialogType === 'warning'\" class=\"title-text\"> {{ i18nText?.warning }}</span>\n      <span *ngIf=\"checkDialogType === 'failed'\" class=\"title-text\">{{ i18nText?.error }}</span>\n      <span *ngIf=\"checkDialogType === 'sucess' || checkDialogType === 'success'\" class=\"title-text\">{{ i18nText?.success }}</span>\n      <span *ngIf=\"checkDialogType === 'info'\" class=\"title-text\">{{ i18nText?.info }}</span>\n    </ng-container>\n  </div>\n  <d-icon class=\"modal-header-close\" *ngIf=\"showCloseBtn\" [icon]=\"closeTemplate\" [operable]=\"true\" (click)=\"close($event)\"> </d-icon>\n  <ng-template #closeTemplate>\n    <svg\n      width=\"16px\"\n      height=\"16px\"\n      viewBox=\"0 0 16 16\"\n      version=\"1.1\"\n      xmlns=\"http://www.w3.org/2000/svg\"\n      xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n    >\n      <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <path\n          d=\"M14.6887175,1.25368865 C15.0770801,1.64205125 15.0121881,2.34244569 14.544513,2.81012074 L9.383,7.971 L14.544513,13.1322854 C14.9787827,13.5665551 15.0657548,14.2014859 14.7650189,14.6009195 L14.6887175,14.6887175 C14.3003549,15.0770801 13.5999604,15.0121881 13.1322854,14.544513 L13.1322854,14.544513 L7.971,9.383 L2.81012075,14.544513 C2.3424457,15.0121881 1.64205125,15.0770801 1.25368865,14.6887175 C0.865326051,14.3003549 0.930218063,13.5999605 1.39789313,13.1322854 L6.558,7.971 L1.39789311,2.81012074 C0.963623424,2.37585105 0.876651354,1.74092026 1.17738727,1.34148668 L1.25368865,1.25368865 C1.64205125,0.865326051 2.34244569,0.930218063 2.81012074,1.39789311 L2.81012074,1.39789311 L7.971,6.558 L13.1322854,1.39789311 C13.5999605,0.930218063 14.3003549,0.865326051 14.6887175,1.25368865 Z\"\n          id=\"\u5F62\u72B6\u7ED3\u5408\"\n          fill=\"#8A8E99\"\n          fill-rule=\"nonzero\"\n        ></path>\n      </g>\n    </svg>\n  </ng-template>\n</div>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}.modal-header{padding:20px 20px 0;position:relative;border:none}.modal-header .standard-title{height:26px;line-height:26px;color:#252b3a;color:var(--devui-text, #252b3a);letter-spacing:0;font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.modal-header.no-title{height:0;padding:0}.modal-header.no-title .standard-title{display:none}.header-alert-icon{display:inline-block;vertical-align:middle;margin-right:8px;width:24px;height:24px;line-height:16px;text-align:center}.header-alert-icon .devui-icon{width:24px;height:24px}.header-alert-icon .devui-icon circle,.header-alert-icon .devui-icon polygon{fill:#fff;fill:var(--devui-light-text, #ffffff)}.header-alert-icon .devui-icon.devui-icon-success path{fill:#50d4ab;fill:var(--devui-success, #50d4ab)}.header-alert-icon .devui-icon.devui-icon-warning path{fill:#fa9841;fill:var(--devui-warning-line, #fa9841)}.header-alert-icon .devui-icon.devui-icon-info path{fill:#5e7ce0;fill:var(--devui-info, #5e7ce0)}.header-alert-icon .devui-icon.devui-icon-error path{fill:#f66f6a;fill:var(--devui-danger, #f66f6a)}.title-text{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;vertical-align:middle}.modal-header-close{position:absolute;right:20px;top:18px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.IconComponent, selector: "d-icon", inputs: ["icon", "operable", "disabled", "rotate", "color"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalHeaderComponent, decorators: [{
            type: Component,
            args: [{ selector: 'd-modal-header', preserveWhitespaces: false, template: "<div class=\"modal-header\" [ngClass]=\"{ 'no-title': !title && title !== '' && checkDialogType === 'standard' }\">\n  <div class=\"standard-title\">\n    <div *ngIf=\"checkDialogType === 'warning'\" class=\"header-alert-icon\">\n      <svg\n        class=\"devui-icon devui-icon-warning\"\n        viewBox=\"0 0 16 16\"\n        version=\"1.1\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n      >\n        <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n          <polygon\n            points=\"7.5 1.74501946 1.39184847 13.5954649 7.08947368 14.2207621 13.9973698 13.5954649 10.9383683 5.61273879 8.40084114 1.27624313\"\n          ></polygon>\n          <path\n            d=\"M8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 Z M8.87894737,11.2105263 L7.08947368,11.2105263 L7.08947368,13 L8.87894737,13 L8.87894737,11.2105263 Z M8.96842105,4.5 L7,4.5 L7.08947368,9.86842105 L8.87894737,9.86842105 L8.96842105,4.5 Z\"\n          ></path>\n        </g>\n      </svg>\n    </div>\n    <div *ngIf=\"checkDialogType === 'failed'\" class=\"header-alert-icon\">\n      <svg\n        class=\"devui-icon devui-icon-error\"\n        width=\"16px\"\n        height=\"16px\"\n        viewBox=\"0 0 16 16\"\n        version=\"1.1\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n      >\n        <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n          <circle cx=\"8\" cy=\"8\" r=\"7\"></circle>\n          <path\n            d=\"M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,12.6 L7,12.6 L7,10.6 L9,10.6 L9,12.6 Z M9,9.1 L7,9.1 L6.9,3.1 L9.1,3.1 L9,9.1 Z\"\n            fill-rule=\"nonzero\"\n          ></path>\n        </g>\n      </svg>\n    </div>\n    <div *ngIf=\"checkDialogType === 'sucess' || checkDialogType === 'success'\" class=\"header-alert-icon\">\n      <svg\n        class=\"devui-icon devui-icon-success\"\n        viewBox=\"0 0 16 16\"\n        version=\"1.1\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n      >\n        <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n          <circle cx=\"8\" cy=\"8\" r=\"7\"></circle>\n          <path d=\"M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z\" fill-rule=\"nonzero\"></path>\n          <polygon\n            stroke-width=\"0.4\"\n            fill-rule=\"nonzero\"\n            points=\"8.16 10.48 7.32 11.32 6.48 10.48 6.48 10.48 3.6 7.68 4.44 6.84 7.28 9.68 11.52 5.44 12.36 6.28\"\n          ></polygon>\n        </g>\n      </svg>\n    </div>\n    <div *ngIf=\"checkDialogType === 'info'\" class=\"header-alert-icon\">\n      <svg\n        class=\"devui-icon devui-icon-info\"\n        viewBox=\"0 0 16 16\"\n        version=\"1.1\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n      >\n        <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n          <circle cx=\"8\" cy=\"8\" r=\"7\"></circle>\n          <g stroke-width=\"1\">\n            <path\n              d=\"M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,5 L7,5 L7,3 L9,3 L9,5 Z M9,12.6 L7,12.6 L7,6.6 L9,6.6 L9,12.6 Z\"\n            ></path>\n          </g>\n        </g>\n      </svg>\n    </div>\n    <span *ngIf=\"title\" [title]=\"title\" class=\"title-text\">{{ title }}</span>\n    <ng-container *ngIf=\"!title\">\n      <span *ngIf=\"checkDialogType === 'warning'\" class=\"title-text\"> {{ i18nText?.warning }}</span>\n      <span *ngIf=\"checkDialogType === 'failed'\" class=\"title-text\">{{ i18nText?.error }}</span>\n      <span *ngIf=\"checkDialogType === 'sucess' || checkDialogType === 'success'\" class=\"title-text\">{{ i18nText?.success }}</span>\n      <span *ngIf=\"checkDialogType === 'info'\" class=\"title-text\">{{ i18nText?.info }}</span>\n    </ng-container>\n  </div>\n  <d-icon class=\"modal-header-close\" *ngIf=\"showCloseBtn\" [icon]=\"closeTemplate\" [operable]=\"true\" (click)=\"close($event)\"> </d-icon>\n  <ng-template #closeTemplate>\n    <svg\n      width=\"16px\"\n      height=\"16px\"\n      viewBox=\"0 0 16 16\"\n      version=\"1.1\"\n      xmlns=\"http://www.w3.org/2000/svg\"\n      xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n    >\n      <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <path\n          d=\"M14.6887175,1.25368865 C15.0770801,1.64205125 15.0121881,2.34244569 14.544513,2.81012074 L9.383,7.971 L14.544513,13.1322854 C14.9787827,13.5665551 15.0657548,14.2014859 14.7650189,14.6009195 L14.6887175,14.6887175 C14.3003549,15.0770801 13.5999604,15.0121881 13.1322854,14.544513 L13.1322854,14.544513 L7.971,9.383 L2.81012075,14.544513 C2.3424457,15.0121881 1.64205125,15.0770801 1.25368865,14.6887175 C0.865326051,14.3003549 0.930218063,13.5999605 1.39789313,13.1322854 L6.558,7.971 L1.39789311,2.81012074 C0.963623424,2.37585105 0.876651354,1.74092026 1.17738727,1.34148668 L1.25368865,1.25368865 C1.64205125,0.865326051 2.34244569,0.930218063 2.81012074,1.39789311 L2.81012074,1.39789311 L7.971,6.558 L13.1322854,1.39789311 C13.5999605,0.930218063 14.3003549,0.865326051 14.6887175,1.25368865 Z\"\n          id=\"\u5F62\u72B6\u7ED3\u5408\"\n          fill=\"#8A8E99\"\n          fill-rule=\"nonzero\"\n        ></path>\n      </g>\n    </svg>\n  </ng-template>\n</div>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}.modal-header{padding:20px 20px 0;position:relative;border:none}.modal-header .standard-title{height:26px;line-height:26px;color:#252b3a;color:var(--devui-text, #252b3a);letter-spacing:0;font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.modal-header.no-title{height:0;padding:0}.modal-header.no-title .standard-title{display:none}.header-alert-icon{display:inline-block;vertical-align:middle;margin-right:8px;width:24px;height:24px;line-height:16px;text-align:center}.header-alert-icon .devui-icon{width:24px;height:24px}.header-alert-icon .devui-icon circle,.header-alert-icon .devui-icon polygon{fill:#fff;fill:var(--devui-light-text, #ffffff)}.header-alert-icon .devui-icon.devui-icon-success path{fill:#50d4ab;fill:var(--devui-success, #50d4ab)}.header-alert-icon .devui-icon.devui-icon-warning path{fill:#fa9841;fill:var(--devui-warning-line, #fa9841)}.header-alert-icon .devui-icon.devui-icon-info path{fill:#5e7ce0;fill:var(--devui-info, #5e7ce0)}.header-alert-icon .devui-icon.devui-icon-error path{fill:#f66f6a;fill:var(--devui-danger, #f66f6a)}.title-text{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;vertical-align:middle}.modal-header-close{position:absolute;right:20px;top:18px}\n"] }]
        }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$1.I18nService }]; }, propDecorators: { title: [{
                type: Input
            }], dialogtype: [{
                type: Input
            }], showCloseBtn: [{
                type: Input
            }], closeEvent: [{
                type: Output
            }] } });

class ModalFooterComponent {
}
ModalFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
ModalFooterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: ModalFooterComponent, selector: "d-modal-footer", inputs: { buttons: "buttons" }, ngImport: i0, template: "<div class=\"modal-footer\">\n  <d-button\n    *ngFor=\"let button of buttons\"\n    [bsSize]=\"'lg'\"\n    [attr.id]=\"button.id\"\n    (btnClick)=\"button.handler($event)\"\n    [bsStyle]=\"button.cssClass\"\n    circled=\"true\"\n    [width]=\"button.btnwidth\"\n    [autofocus]=\"button.autofocus\"\n    [disabled]=\"button.disabled\"\n    >{{ button.text }}\n  </d-button>\n</div>\n", styles: [".modal-footer{padding-bottom:24px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i2.ButtonComponent, selector: "d-button", inputs: ["id", "type", "bsStyle", "shape", "bsSize", "bsPosition", "bordered", "icon", "disabled", "showLoading", "width", "autofocus", "loadingTemplateRef"], outputs: ["btnClick"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalFooterComponent, decorators: [{
            type: Component,
            args: [{ selector: 'd-modal-footer', preserveWhitespaces: false, template: "<div class=\"modal-footer\">\n  <d-button\n    *ngFor=\"let button of buttons\"\n    [bsSize]=\"'lg'\"\n    [attr.id]=\"button.id\"\n    (btnClick)=\"button.handler($event)\"\n    [bsStyle]=\"button.cssClass\"\n    circled=\"true\"\n    [width]=\"button.btnwidth\"\n    [autofocus]=\"button.autofocus\"\n    [disabled]=\"button.disabled\"\n    >{{ button.text }}\n  </d-button>\n</div>\n", styles: [".modal-footer{padding-bottom:24px}\n"] }]
        }], propDecorators: { buttons: [{
                type: Input
            }] } });

class ModalContainerComponent {
    constructor(sanitizer, modalInstance) {
        this.sanitizer = sanitizer;
        this.modalInstance = modalInstance;
        this.dialogtype = 'standard';
    }
    ngOnInit() {
        if (this.html) {
            this.content = this.sanitizer.bypassSecurityTrustHtml(this.content);
        }
    }
    close(event) {
        this.onClose(event);
    }
    updateButtonOptions(buttonOptions = []) {
        this.buttons = this.buttons.map((button, index) => {
            return Object.assign(Object.assign({}, button), buttonOptions[index]);
        });
    }
}
ModalContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalContainerComponent, deps: [{ token: i1$2.DomSanitizer }, { token: ModalComponent }], target: i0.ɵɵFactoryTarget.Component });
ModalContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: ModalContainerComponent, selector: "d-modal-container", inputs: { maxHeight: "maxHeight", data: "data", title: "title", content: "content", buttons: "buttons", html: "html", onClose: "onClose", dialogtype: "dialogtype", showCloseBtn: "showCloseBtn" }, viewQueries: [{ propertyName: "modalContentHost", first: true, predicate: ModalContentDirective, descendants: true, static: true }], ngImport: i0, template: "<div>\n  <d-modal-header\n    id=\"d-modal-header\"\n    [title]=\"title\"\n    (closeEvent)=\"close($event)\"\n    [dialogtype]=\"dialogtype\"\n    [showCloseBtn]=\"showCloseBtn\"\n  ></d-modal-header>\n  <div\n    class=\"modal-body devui-scrollbar\"\n    [ngClass]=\"{\n      'flex-content': dialogtype === 'warning' || dialogtype === 'failed' || dialogtype === 'success' || dialogtype === 'info'\n    }\"\n    [ngStyle]=\"{ maxHeight: maxHeight }\"\n  >\n    <div\n      [ngClass]=\"{\n        'display-flex': dialogtype !== '' && dialogtype !== 'standard'\n      }\"\n    >\n      <div class=\"content\" [style.max-height]=\"maxHeight\" *ngIf=\"!!content && !html\">{{ content }}</div>\n      <div class=\"content\" [style.max-height]=\"maxHeight\" *ngIf=\"!!content && html\" [innerHTML]=\"content\"></div>\n      <div class=\"content\" *ngIf=\"contentTemplate\">\n        <ng-template\n          [ngTemplateOutlet]=\"contentTemplate\"\n          [ngTemplateOutletContext]=\"{ modalInstance: modalInstance, modalContentInstance: this }\"\n        ></ng-template>\n      </div>\n      <ng-template dModalContentHost></ng-template>\n    </div>\n  </div>\n\n  <d-modal-footer [buttons]=\"buttons\"></d-modal-footer>\n</div>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}.modal-body{padding:12px 32px;overflow-y:hidden}.modal-body:hover{overflow-y:auto;overflow-y:overlay}.display-flex{display:flex;display:-ms-flexbox;align-items:center;-ms-flex-align:center;max-width:100%}div.content{word-break:normal;word-wrap:break-word;width:100%}.flex-content ::ng-deep div.content{font-size:12px;font-size:var(--devui-font-size, 12px);word-break:normal;word-wrap:break-word;white-space:pre-wrap}.flex-content{display:flex;justify-content:left;align-items:center}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: ModalContentDirective, selector: "[dModalContentHost]" }, { kind: "component", type: ModalHeaderComponent, selector: "d-modal-header", inputs: ["title", "dialogtype", "showCloseBtn"], outputs: ["closeEvent"] }, { kind: "component", type: ModalFooterComponent, selector: "d-modal-footer", inputs: ["buttons"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalContainerComponent, decorators: [{
            type: Component,
            args: [{ selector: 'd-modal-container', preserveWhitespaces: false, template: "<div>\n  <d-modal-header\n    id=\"d-modal-header\"\n    [title]=\"title\"\n    (closeEvent)=\"close($event)\"\n    [dialogtype]=\"dialogtype\"\n    [showCloseBtn]=\"showCloseBtn\"\n  ></d-modal-header>\n  <div\n    class=\"modal-body devui-scrollbar\"\n    [ngClass]=\"{\n      'flex-content': dialogtype === 'warning' || dialogtype === 'failed' || dialogtype === 'success' || dialogtype === 'info'\n    }\"\n    [ngStyle]=\"{ maxHeight: maxHeight }\"\n  >\n    <div\n      [ngClass]=\"{\n        'display-flex': dialogtype !== '' && dialogtype !== 'standard'\n      }\"\n    >\n      <div class=\"content\" [style.max-height]=\"maxHeight\" *ngIf=\"!!content && !html\">{{ content }}</div>\n      <div class=\"content\" [style.max-height]=\"maxHeight\" *ngIf=\"!!content && html\" [innerHTML]=\"content\"></div>\n      <div class=\"content\" *ngIf=\"contentTemplate\">\n        <ng-template\n          [ngTemplateOutlet]=\"contentTemplate\"\n          [ngTemplateOutletContext]=\"{ modalInstance: modalInstance, modalContentInstance: this }\"\n        ></ng-template>\n      </div>\n      <ng-template dModalContentHost></ng-template>\n    </div>\n  </div>\n\n  <d-modal-footer [buttons]=\"buttons\"></d-modal-footer>\n</div>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}.modal-body{padding:12px 32px;overflow-y:hidden}.modal-body:hover{overflow-y:auto;overflow-y:overlay}.display-flex{display:flex;display:-ms-flexbox;align-items:center;-ms-flex-align:center;max-width:100%}div.content{word-break:normal;word-wrap:break-word;width:100%}.flex-content ::ng-deep div.content{font-size:12px;font-size:var(--devui-font-size, 12px);word-break:normal;word-wrap:break-word;white-space:pre-wrap}.flex-content{display:flex;justify-content:left;align-items:center}\n"] }]
        }], ctorParameters: function () { return [{ type: i1$2.DomSanitizer }, { type: ModalComponent }]; }, propDecorators: { maxHeight: [{
                type: Input
            }], data: [{
                type: Input
            }], title: [{
                type: Input
            }], content: [{
                type: Input
            }], buttons: [{
                type: Input
            }], html: [{
                type: Input
            }], onClose: [{
                type: Input
            }], modalContentHost: [{
                type: ViewChild,
                args: [ModalContentDirective, { static: true }]
            }], dialogtype: [{
                type: Input
            }], showCloseBtn: [{
                type: Input
            }] } });

class DialogService {
    constructor(componentFactoryResolver, overlayContainerRef, rendererFactory, devConfigService, doc) {
        this.componentFactoryResolver = componentFactoryResolver;
        this.overlayContainerRef = overlayContainerRef;
        this.rendererFactory = rendererFactory;
        this.devConfigService = devConfigService;
        this.doc = doc;
        this.renderer = this.rendererFactory.createRenderer(null, null);
        this.document = this.doc;
    }
    open({ id, width, zIndex, backDropZIndex, backdropCloseable, maxHeight, showAnimation, 
    /**
     * @deprecated
     */
    showAnimate, title, content, html, data, buttons, injector, componentFactoryResolver, beforeHidden, onClose, dialogtype = 'standard', showCloseBtn = true, draggable = true, placement = 'center', offsetX, offsetY, bodyScrollable = true, contentTemplate, escapable = true }) {
        const finalComponentFactoryResolver = componentFactoryResolver || this.componentFactoryResolver;
        const modalRef = this.overlayContainerRef.createComponent(finalComponentFactoryResolver.resolveComponentFactory(ModalComponent), injector);
        let showAnimateValue = true;
        const componentConfig = this.devConfigService.getConfigForComponent('modal') || {};
        const configValue = componentConfig['showAnimation'];
        const apiConfig = this.devConfigService.getConfigForApi('showAnimation');
        if (configValue !== undefined) {
            showAnimateValue = configValue;
        }
        else if (apiConfig !== undefined) {
            showAnimateValue = apiConfig;
        }
        if (showAnimation === undefined) {
            if (showAnimate !== undefined) {
                showAnimation = showAnimate;
            }
            else {
                showAnimation = showAnimateValue;
            }
        }
        assign(modalRef.instance, {
            id,
            width,
            zIndex,
            backDropZIndex,
            showAnimation,
            beforeHidden,
            // set backdropCloseable default value "true" when not passing it
            backdropCloseable: isUndefined(backdropCloseable) ? true : backdropCloseable,
            draggable,
            placement,
            offsetX,
            offsetY,
            bodyScrollable,
            escapable
        });
        const modalContainerRef = modalRef.instance.modalContainerHost.viewContainerRef
            .createComponent(finalComponentFactoryResolver.resolveComponentFactory(ModalContainerComponent), 0, injector);
        assign(modalContainerRef.instance, { title, buttons, maxHeight, dialogtype, showCloseBtn });
        if (contentTemplate) {
            assign(modalContainerRef.instance, { contentTemplate });
        }
        else {
            if (typeof content === 'string') {
                assign(modalContainerRef.instance, { content, html });
            }
            else {
                this.contentRef = modalContainerRef.instance.modalContentHost.viewContainerRef
                    .createComponent(finalComponentFactoryResolver.resolveComponentFactory(content));
                assign(this.contentRef.instance, { data, dialogtype });
            }
        }
        modalContainerRef.instance.onClose = () => {
            modalRef.instance.hide();
        };
        modalRef.instance.updateButtonOptions = buttonOptions => modalContainerRef.instance.updateButtonOptions(buttonOptions);
        modalRef.instance.onHidden = () => {
            if (modalRef.instance.documentOverFlow) {
                this.renderer.removeStyle(this.document.body, 'top');
                this.renderer.removeStyle(this.document.body, 'left');
                this.renderer.removeClass(this.document.body, 'devui-body-scrollblock');
                this.renderer.removeClass(this.document.body, 'devui-body-overflow-hidden');
                this.document.documentElement.scrollTop = modalRef.instance.scrollTop;
                this.document.body.scrollTop = modalRef.instance.scrollTop;
                this.document.documentElement.scrollLeft = modalRef.instance.scrollLeft;
                this.document.body.scrollLeft = modalRef.instance.scrollLeft;
            }
            if (onClose) {
                onClose();
            }
            setTimeout(() => {
                modalRef.hostView.destroy();
            });
        };
        modalRef.instance.show();
        return {
            modalInstance: modalRef.instance,
            modalContentInstance: this.contentRef ? this.contentRef.instance : null,
        };
    }
}
DialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DialogService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i1$3.OverlayContainerRef }, { token: i0.RendererFactory2 }, { token: i2$1.DevConfigService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
DialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DialogService });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DialogService, decorators: [{
            type: Injectable
        }], ctorParameters: function () {
        return [{ type: i0.ComponentFactoryResolver }, { type: i1$3.OverlayContainerRef }, { type: i0.RendererFactory2 }, { type: i2$1.DevConfigService }, { type: undefined, decorators: [{
                        type: Inject,
                        args: [DOCUMENT]
                    }] }];
    } });

class ModalService {
    constructor(componentFactoryResolver, overlayContainerRef, rendererFactory, devConfigService, doc) {
        this.componentFactoryResolver = componentFactoryResolver;
        this.overlayContainerRef = overlayContainerRef;
        this.rendererFactory = rendererFactory;
        this.devConfigService = devConfigService;
        this.doc = doc;
        this.renderer = this.rendererFactory.createRenderer(null, null);
        this.document = this.doc;
    }
    open({ id, component, injector, width, zIndex, backDropZIndex, data, handler, showAnimation, 
    /**
     * @deprecated
     */
    showAnimate, backdropCloseable, componentFactoryResolver, onClose, beforeHidden, placement = 'center', offsetX, offsetY, bodyScrollable = true, contentTemplate, escapable = true }) {
        const finalComponentFactoryResolver = componentFactoryResolver || this.componentFactoryResolver;
        const modalRef = this.overlayContainerRef.createComponent(finalComponentFactoryResolver.resolveComponentFactory(ModalComponent), injector);
        let showAnimateValue = true;
        const componentConfig = this.devConfigService.getConfigForComponent('modal') || {};
        const configValue = componentConfig['showAnimation'];
        const apiConfig = this.devConfigService.getConfigForApi('showAnimation');
        if (configValue !== undefined) {
            showAnimateValue = configValue;
        }
        else if (apiConfig !== undefined) {
            showAnimateValue = apiConfig;
        }
        if (showAnimation === undefined) {
            if (showAnimate !== undefined) {
                showAnimation = showAnimate;
            }
            else {
                showAnimation = showAnimateValue;
            }
        }
        assign(modalRef.instance, {
            id,
            width,
            zIndex,
            backDropZIndex,
            showAnimation,
            beforeHidden,
            backdropCloseable: isUndefined(backdropCloseable) ? true : backdropCloseable,
            placement,
            offsetX,
            offsetY,
            bodyScrollable,
            contentTemplate,
            escapable
        });
        let modalContentInstance;
        if (component) {
            modalContentInstance = modalRef.instance.modalContainerHost.viewContainerRef
                .createComponent(finalComponentFactoryResolver.resolveComponentFactory(component), 0, injector);
            assign(modalContentInstance.instance, { data, handler });
        }
        modalRef.instance.onHidden = () => {
            if (modalRef.instance.documentOverFlow) {
                this.renderer.removeStyle(this.document.body, 'top');
                this.renderer.removeStyle(this.document.body, 'left');
                this.renderer.removeClass(this.document.body, 'devui-body-scrollblock');
                this.renderer.removeClass(this.document.body, 'devui-body-overflow-hidden');
                this.document.documentElement.scrollTop = modalRef.instance.scrollTop;
                this.document.body.scrollTop = modalRef.instance.scrollTop;
                this.document.documentElement.scrollLeft = modalRef.instance.scrollLeft;
                this.document.body.scrollLeft = modalRef.instance.scrollLeft;
            }
            if (onClose) {
                onClose();
            }
            setTimeout(() => {
                modalRef.hostView.destroy();
            });
        };
        modalRef.instance.show();
        return {
            modalInstance: modalRef.instance,
            modalContentInstance: modalContentInstance ? modalContentInstance.instance : null
        };
    }
}
ModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i1$3.OverlayContainerRef }, { token: i0.RendererFactory2 }, { token: i2$1.DevConfigService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
ModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalService });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalService, decorators: [{
            type: Injectable
        }], ctorParameters: function () {
        return [{ type: i0.ComponentFactoryResolver }, { type: i1$3.OverlayContainerRef }, { type: i0.RendererFactory2 }, { type: i2$1.DevConfigService }, { type: undefined, decorators: [{
                        type: Inject,
                        args: [DOCUMENT]
                    }] }];
    } });

class ModalModule {
}
ModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
ModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: ModalModule, declarations: [ModalComponent,
        ModalContainerComponent,
        ModalContainerDirective,
        ModalContentDirective,
        ModalHeaderComponent,
        ModalFooterComponent,
        MovableDirective], imports: [CommonModule,
        OverlayContainerModule,
        ButtonModule,
        IconModule], exports: [ModalComponent,
        ModalContainerComponent,
        ModalHeaderComponent,
        ModalFooterComponent,
        MovableDirective] });
ModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalModule, providers: [
        ModalService,
        DialogService,
        DocumentRef,
    ], imports: [CommonModule,
        OverlayContainerModule,
        ButtonModule,
        IconModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ModalModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CommonModule,
                        OverlayContainerModule,
                        ButtonModule,
                        IconModule
                    ],
                    declarations: [
                        ModalComponent,
                        ModalContainerComponent,
                        ModalContainerDirective,
                        ModalContentDirective,
                        ModalHeaderComponent,
                        ModalFooterComponent,
                        MovableDirective
                    ],
                    exports: [
                        ModalComponent,
                        ModalContainerComponent,
                        ModalHeaderComponent,
                        ModalFooterComponent,
                        MovableDirective
                    ],
                    providers: [
                        ModalService,
                        DialogService,
                        DocumentRef,
                    ],
                }]
        }] });

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

export { DialogService, ModalComponent, ModalContainerComponent, ModalContainerDirective, ModalContentDirective, ModalFooterComponent, ModalHeaderComponent, ModalModule, ModalService, MovableDirective };
//# sourceMappingURL=ng-devui-modal.mjs.map
