@schoolbelle/common
Version: 
1,279 lines (1,258 loc) • 151 kB
JavaScript
import { BsModalRef, BsModalService, ModalModule } from 'ngx-bootstrap/modal';
import { trigger, style, transition, animate } from '@angular/animations';
import { Router, NavigationError } from '@angular/router';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { CommonModule } from '@angular/common';
import { getSelectionRange, isIE, setSelectionRange } from '@schoolbelle/common/functions';
import { FormControl, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR, FormGroup, NG_VALIDATORS } from '@angular/forms';
import { parse, format, parseNumber, formatNumber, AsYouType, getCountryCallingCode, isValidNumber } from 'libphonenumber-js';
import { Component, Input, EventEmitter, Injectable, NgModule, ApplicationRef, ViewEncapsulation, Injector, ComponentFactoryResolver, NgZone, forwardRef, ChangeDetectionStrategy, ChangeDetectorRef, Output, Inject, InjectionToken, Directive, Attribute, HostListener, ElementRef, Renderer2, Pipe, LOCALE_ID, defineInjectable, inject } from '@angular/core';
import { debounceTime, filter, take, tap, switchMap, distinctUntilChanged, map, takeWhile, startWith } from 'rxjs/operators';
import { fromEvent, merge, Subscription, of, Subject } from 'rxjs';
import { find, orderBy, forEach, isArray, isPlainObject, get as get$1, set as set$1, unset, isEqual, cloneDeep, isEmpty, values, defaults as defaults$1 } from 'lodash-es';
import { __assign, __extends, __values, __spread, __read } from 'tslib';
import { times, defaults, get, set, cloneDeep as cloneDeep$1, isEmpty as isEmpty$1 } from 'lodash';
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var DialogAbstractComponent = /** @class */ (function () {
    function DialogAbstractComponent(modalRef) {
        this.modalRef = modalRef;
        this.subscription = new Subscription();
        this.action = new EventEmitter();
    }
    /**
     * @return {?}
     */
    DialogAbstractComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        var _this = this;
        this.subscription.add(merge(fromEvent(document, 'keydown'), fromEvent(document, 'keypress'))
            .pipe(debounceTime(0), filter((/**
         * @param {?} e
         * @return {?}
         */
        function (e) {
            return e.which === 13;
        })))
            .subscribe((/**
         * @param {?} e
         * @return {?}
         */
        function (e) {
            _this.enter();
        })));
    };
    /**
     * @return {?}
     */
    DialogAbstractComponent.prototype.ngOnDestroy = /**
     * @return {?}
     */
    function () {
        this.subscription.unsubscribe();
    };
    /**
     * @return {?}
     */
    DialogAbstractComponent.prototype.enter = /**
     * @return {?}
     */
    function () { };
    /**
     * @param {?=} result
     * @return {?}
     */
    DialogAbstractComponent.prototype.ok = /**
     * @param {?=} result
     * @return {?}
     */
    function (result) {
        if (result === void 0) { result = true; }
        this.modalRef.hide();
        this.action.emit(result);
    };
    /**
     * @return {?}
     */
    DialogAbstractComponent.prototype.cancel = /**
     * @return {?}
     */
    function () {
        this.modalRef.hide();
        this.action.emit(false);
    };
    DialogAbstractComponent.decorators = [
        { type: Component, args: [{
                    template: ''
                }] }
    ];
    /** @nocollapse */
    DialogAbstractComponent.ctorParameters = function () { return [
        { type: BsModalRef }
    ]; };
    DialogAbstractComponent.propDecorators = {
        title: [{ type: Input }],
        message: [{ type: Input }]
    };
    return DialogAbstractComponent;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var DialogConfirmComponent = /** @class */ (function (_super) {
    __extends(DialogConfirmComponent, _super);
    function DialogConfirmComponent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.showNeverShowItAgainCheckbox = false;
        _this.neverShowItAgain = false;
        return _this;
    }
    /**
     * @return {?}
     */
    DialogConfirmComponent.prototype.enter = /**
     * @return {?}
     */
    function () {
        this.ok();
    };
    DialogConfirmComponent.decorators = [
        { type: Component, args: [{
                    selector: 'dialog-confirm',
                    template: "<div *ngIf=\"title\" class=\"modal-header d-block\" [innerHTML]=\"title\"></div>\n<div *ngIf=\"message\" class=\"modal-body\" [innerHTML]=\"message\"></div>\n<div class=\"modal-footer justify-content-start border-top-0\">\n  <label *ngIf=\"showNeverShowItAgainCheckbox\" class=\"custom-control custom-checkbox\">\n    <input type=\"checkbox\" class=\"custom-control-input\" [(ngModel)]=\"neverShowItAgain\">\n    <p class=\"custom-control-label\" i18n>See no more.</p>\n  </label>  \n  <button type=\"button\" class=\"btn btn-outline-secondary ml-auto\" (click)=\"modalRef.hide(); action.emit(false)\" i18n>No</button>\n  <button type=\"button\" class=\"btn btn-primary\" (click)=\"modalRef.hide(); action.emit(true)\" i18n>Yes</button>\n</div>\n"
                }] }
    ];
    return DialogConfirmComponent;
}(DialogAbstractComponent));
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var DialogAlertComponent = /** @class */ (function (_super) {
    __extends(DialogAlertComponent, _super);
    function DialogAlertComponent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.showNeverShowItAgainCheckbox = false;
        _this.neverShowItAgain = false;
        return _this;
    }
    /**
     * @return {?}
     */
    DialogAlertComponent.prototype.enter = /**
     * @return {?}
     */
    function () {
        this.ok();
    };
    DialogAlertComponent.decorators = [
        { type: Component, args: [{
                    selector: 'dialog-alert',
                    template: "<div *ngIf=\"title\" class=\"modal-header\" [innerHTML]=\"title\"></div>\n<div *ngIf=\"message\" class=\"modal-body\" [innerHTML]=\"message\"></div>\n<div class=\"modal-footer justify-content-start border-top-0\">\n  <label *ngIf=\"showNeverShowItAgainCheckbox\" class=\"custom-control custom-checkbox\">\n    <input type=\"checkbox\" class=\"custom-control-input\" [(ngModel)]=\"neverShowItAgain\">\n    <p class=\"custom-control-label\" i18n>See no more.</p>\n  </label>  \n  <button type=\"button\" class=\"btn btn-secondary ml-auto\" (click)=\"modalRef.hide(); action.emit(true)\" i18n>Ok</button>\n</div>\n\n"
                }] }
    ];
    return DialogAlertComponent;
}(DialogAbstractComponent));
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var DialogSelectComponent = /** @class */ (function (_super) {
    __extends(DialogSelectComponent, _super);
    function DialogSelectComponent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.selections = [];
        return _this;
    }
    /**
     * @param {?} i
     * @return {?}
     */
    DialogSelectComponent.prototype.select = /**
     * @param {?} i
     * @return {?}
     */
    function (i) {
        this.modalRef.hide();
        this.action.emit(i);
    };
    DialogSelectComponent.decorators = [
        { type: Component, args: [{
                    selector: 'dialog-select',
                    template: "<div *ngIf=\"title\" class=\"modal-header\" [innerHTML]=\"title\"></div>\n<div class=\"modal-body\">\n  <button class=\"btn btn-block btn-secondary\" *ngFor=\"let selection of selections; let i = index;\" (click)=\"select(i)\" [innerHTML]=\"selection.html || selection\" [ngClass]=\"selection.class || ''\"></button>\n  <button type=\"button\" class=\"btn btn-block btn-outline-secondary\" (click)=\"cancel()\" i18n>Cancel</button>\n</div>\n"
                }] }
    ];
    DialogSelectComponent.propDecorators = {
        selections: [{ type: Input }]
    };
    return DialogSelectComponent;
}(DialogAbstractComponent));
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var DialogPromptComponent = /** @class */ (function (_super) {
    __extends(DialogPromptComponent, _super);
    function DialogPromptComponent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.validators = [];
        return _this;
    }
    /**
     * @return {?}
     */
    DialogPromptComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        _super.prototype.ngOnInit.call(this);
        this.input = new FormControl('', this.validators);
    };
    /**
     * @return {?}
     */
    DialogPromptComponent.prototype.enter = /**
     * @return {?}
     */
    function () {
        if (!this.input.invalid)
            this.ok(this.input.value);
    };
    DialogPromptComponent.decorators = [
        { type: Component, args: [{
                    selector: 'dialog-prompt',
                    template: "<div *ngIf=\"title\" class=\"modal-header\" [innerHTML]=\"title\"></div>\n<div *ngIf=\"message\" class=\"modal-body\">\n  <p [innerHTML]=\"message\"></p>\n  <div class=\"px-3\">\n      <input class=\"form-control text-center\" \n      [ngClass]=\"{'is-invalid':input.dirty && input.invalid}\"\n      [formControl]=\"input\" [type]=\"type\" placeholder=\"\" autofocus (keyup.enter)=\"ok(input.value)\">\n  </div>\n</div>\n<div class=\"modal-footer justify-content-start border-top-0\">\n  <button type=\"button\" class=\"btn btn-outline-secondary ml-auto\" (click)=\"cancel()\" i18n>Cancel</button>\n  <button type=\"button\" class=\"btn btn-primary\" \n  [ngClass]=\"{\n    'btn-primary':!input.invalid,\n    'btn-secondary':input.invalid\n  }\"\n  [disabled]=\"input.invalid\" \n  (click)=\"ok(input.value)\" i18n>Ok</button>\n</div>\n"
                }] }
    ];
    DialogPromptComponent.propDecorators = {
        type: [{ type: Input }]
    };
    return DialogPromptComponent;
}(DialogAbstractComponent));
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var DialogService = /** @class */ (function () {
    function DialogService(modalService) {
        this.modalService = modalService;
        this.neverShowItAgainList = [];
    }
    /**
     * @param {?=} title
     * @param {?=} message
     * @param {?=} showNeverShowItAgainCheckbox
     * @param {?=} options
     * @return {?}
     */
    DialogService.prototype.confirm = /**
     * @param {?=} title
     * @param {?=} message
     * @param {?=} showNeverShowItAgainCheckbox
     * @param {?=} options
     * @return {?}
     */
    function (title, message, showNeverShowItAgainCheckbox, options) {
        var _this = this;
        if (title === void 0) { title = ''; }
        if (message === void 0) { message = ''; }
        if (showNeverShowItAgainCheckbox === void 0) { showNeverShowItAgainCheckbox = false; }
        if (options === void 0) { options = {}; }
        return of(null).pipe(switchMap((/**
         * @return {?}
         */
        function () {
            /** @type {?} */
            var dialogKey = title + "|" + message;
            if (_this.neverShowItAgainList.includes(dialogKey))
                return of(true);
            /** @type {?} */
            var modalRef = _this.modalService.show(DialogConfirmComponent, Object.assign({}, options, { backdrop: 'static', initialState: { title: title, message: message, showNeverShowItAgainCheckbox: showNeverShowItAgainCheckbox } }));
            return (/** @type {?} */ (modalRef.content.action.pipe(take(1), tap((/**
             * @return {?}
             */
            function () {
                if (modalRef.content.neverShowItAgain === true)
                    _this.neverShowItAgainList.push(dialogKey);
            })))));
        })));
    };
    /**
     * @param {?=} title
     * @param {?=} message
     * @param {?=} showNeverShowItAgainCheckbox
     * @param {?=} options
     * @return {?}
     */
    DialogService.prototype.alert = /**
     * @param {?=} title
     * @param {?=} message
     * @param {?=} showNeverShowItAgainCheckbox
     * @param {?=} options
     * @return {?}
     */
    function (title, message, showNeverShowItAgainCheckbox, options) {
        var _this = this;
        if (title === void 0) { title = ''; }
        if (message === void 0) { message = ''; }
        if (showNeverShowItAgainCheckbox === void 0) { showNeverShowItAgainCheckbox = false; }
        if (options === void 0) { options = {}; }
        return of(null).pipe(switchMap((/**
         * @return {?}
         */
        function () {
            /** @type {?} */
            var dialogKey = title + "|" + message;
            if (_this.neverShowItAgainList.includes(dialogKey))
                return of(true);
            /** @type {?} */
            var modalRef = _this.modalService.show(DialogAlertComponent, Object.assign({}, options, { backdrop: 'static', initialState: { title: title, message: message, showNeverShowItAgainCheckbox: showNeverShowItAgainCheckbox } }));
            return modalRef.content.action.pipe(take(1), tap((/**
             * @return {?}
             */
            function () {
                if (modalRef.content.neverShowItAgain === true)
                    _this.neverShowItAgainList.push(dialogKey);
            })));
        })));
    };
    /**
     * @param {?=} title
     * @param {?=} selections
     * @param {?=} options
     * @return {?}
     */
    DialogService.prototype.select = /**
     * @param {?=} title
     * @param {?=} selections
     * @param {?=} options
     * @return {?}
     */
    function (title, selections, options) {
        var _this = this;
        if (title === void 0) { title = ''; }
        if (options === void 0) { options = {}; }
        return of(null).pipe(switchMap((/**
         * @return {?}
         */
        function () {
            /** @type {?} */
            var modalRef = _this.modalService.show(DialogSelectComponent, Object.assign({}, options, { backdrop: 'static', initialState: { title: title, selections: selections } }));
            return modalRef.content.action.pipe(take(1));
        })));
    };
    /**
     * @param {?=} title
     * @param {?=} message
     * @param {?=} type
     * @param {?=} validators
     * @param {?=} options
     * @return {?}
     */
    DialogService.prototype.prompt = /**
     * @param {?=} title
     * @param {?=} message
     * @param {?=} type
     * @param {?=} validators
     * @param {?=} options
     * @return {?}
     */
    function (title, message, type, validators, options) {
        var _this = this;
        if (title === void 0) { title = ''; }
        if (message === void 0) { message = ''; }
        if (validators === void 0) { validators = []; }
        if (options === void 0) { options = {}; }
        return of(null).pipe(switchMap((/**
         * @return {?}
         */
        function () {
            /** @type {?} */
            var modalRef = _this.modalService.show(DialogPromptComponent, Object.assign({}, options, { backdrop: 'static', initialState: { title: title, message: message, type: type, validators: validators } }));
            return (/** @type {?} */ (modalRef.content.action.pipe(take(1))));
        })));
    };
    DialogService.decorators = [
        { type: Injectable }
    ];
    /** @nocollapse */
    DialogService.ctorParameters = function () { return [
        { type: BsModalService }
    ]; };
    return DialogService;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var DialogModule = /** @class */ (function () {
    function DialogModule() {
    }
    /**
     * @return {?}
     */
    DialogModule.forRoot = /**
     * @return {?}
     */
    function () {
        return {
            ngModule: DialogModule,
            providers: __spread([
                DialogService
            ], ModalModule.forRoot().providers)
        };
    };
    DialogModule.decorators = [
        { type: NgModule, args: [{
                    imports: [
                        CommonModule,
                        ModalModule.forRoot(),
                        FormsModule, ReactiveFormsModule,
                    ],
                    entryComponents: [
                        DialogConfirmComponent,
                        DialogAlertComponent,
                        DialogSelectComponent,
                        DialogPromptComponent,
                    ],
                    declarations: [
                        DialogAbstractComponent,
                        DialogConfirmComponent,
                        DialogAlertComponent,
                        DialogSelectComponent,
                        DialogPromptComponent,
                    ],
                },] }
    ];
    return DialogModule;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var PromiseTrackerService = /** @class */ (function () {
    function PromiseTrackerService(appRef) {
        this.appRef = appRef;
        this.promiseList = [];
        this.delayJustFinished = false;
    }
    /**
     * @param {?} options
     * @return {?}
     */
    PromiseTrackerService.prototype.reset = /**
     * @param {?} options
     * @return {?}
     */
    function (options) {
        var _this = this;
        this.minDuration = options.minDuration;
        this.promiseList = [];
        options.promiseList.forEach((/**
         * @param {?} promise
         * @return {?}
         */
        function (promise) {
            if (!promise || promise['busyFulfilled']) {
                return;
            }
            _this.addPromise(promise, options.onActivateTick);
        }));
        if (this.promiseList.length === 0) {
            return;
        }
        this.delayJustFinished = false;
        if (options.delay) {
            this.delayPromise = setTimeout((/**
             * @return {?}
             */
            function () {
                _this.delayPromise = null;
                _this.delayJustFinished = true;
            }), options.delay);
        }
        if (options.minDuration) {
            this.durationPromise = setTimeout((/**
             * @return {?}
             */
            function () {
                _this.durationPromise = null;
            }), options.minDuration + (options.delay || 0));
        }
    };
    /**
     * @private
     * @param {?} promise
     * @param {?} onActivateTick
     * @return {?}
     */
    PromiseTrackerService.prototype.addPromise = /**
     * @private
     * @param {?} promise
     * @param {?} onActivateTick
     * @return {?}
     */
    function (promise, onActivateTick) {
        var _this = this;
        if (this.promiseList.indexOf(promise) !== -1) {
            return;
        }
        this.promiseList.push(promise);
        if (promise instanceof Promise) {
            promise.then.call(promise, (/**
             * @return {?}
             */
            function () { return _this.finishPromise(promise, onActivateTick); }), (/**
             * @return {?}
             */
            function () { return _this.finishPromise(promise, onActivateTick); }));
        }
        else if (promise instanceof Subscription) {
            promise.add((/**
             * @return {?}
             */
            function () { return _this.finishPromise(promise, onActivateTick); }));
        }
    };
    /**
     * @private
     * @param {?} promise
     * @param {?} onActivateTick
     * @return {?}
     */
    PromiseTrackerService.prototype.finishPromise = /**
     * @private
     * @param {?} promise
     * @param {?} onActivateTick
     * @return {?}
     */
    function (promise, onActivateTick) {
        promise['busyFulfilled'] = true;
        /** @type {?} */
        var index = this.promiseList.indexOf(promise);
        if (index === -1) {
            return;
        }
        this.promiseList.splice(index, 1);
        if (onActivateTick === true)
            this.appRef.tick();
    };
    /**
     * @return {?}
     */
    PromiseTrackerService.prototype.isActive = /**
     * @return {?}
     */
    function () {
        if (this.delayPromise) {
            return false;
        }
        if (!this.delayJustFinished) {
            if (this.durationPromise) {
                return true;
            }
            return this.promiseList.length > 0;
        }
        this.delayJustFinished = false;
        if (this.promiseList.length === 0) {
            this.durationPromise = null;
        }
        return this.promiseList.length > 0;
    };
    PromiseTrackerService.decorators = [
        { type: Injectable }
    ];
    /** @nocollapse */
    PromiseTrackerService.ctorParameters = function () { return [
        { type: ApplicationRef }
    ]; };
    return PromiseTrackerService;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/** @type {?} */
var inactiveStyle = style({
    opacity: 0
});
/** @type {?} */
var timing = '.3s ease';
var LoadingBackdropComponent = /** @class */ (function () {
    function LoadingBackdropComponent(tracker) {
        this.tracker = tracker;
    }
    /**
     * @return {?}
     */
    LoadingBackdropComponent.prototype.isActive = /**
     * @return {?}
     */
    function () {
        return this.tracker.isActive();
    };
    LoadingBackdropComponent.decorators = [
        { type: Component, args: [{
                    selector: 'div[bs-loading-backdrop]',
                    template: "\n        <div class=\"ng-busy-backdrop\"\n             @fadeInOut\n             *ngIf=\"isActive()\">\n        </div>\n    ",
                    animations: [
                        trigger('fadeInOut', [
                            transition('void => *', [inactiveStyle, animate(timing)]),
                            transition('* => void', [animate(timing, inactiveStyle)])
                        ])
                    ]
                }] }
    ];
    /** @nocollapse */
    LoadingBackdropComponent.ctorParameters = function () { return [
        { type: PromiseTrackerService }
    ]; };
    return LoadingBackdropComponent;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/** @type {?} */
var inactiveStyle$1 = style({
    opacity: 0,
    transform: 'translateY(-40px)'
});
/** @type {?} */
var timing$1 = '.3s ease';
var LoadingComponent = /** @class */ (function () {
    function LoadingComponent(tracker) {
        this.tracker = tracker;
    }
    /**
     * @return {?}
     */
    LoadingComponent.prototype.ngDoCheck = /**
     * @return {?}
     */
    function () {
        if (this.message === this.lastMessage) {
            return;
        }
        this.lastMessage = this.message;
    };
    /**
     * @return {?}
     */
    LoadingComponent.prototype.isActive = /**
     * @return {?}
     */
    function () {
        return this.tracker.isActive();
    };
    LoadingComponent.decorators = [
        { type: Component, args: [{
                    selector: 'div[bs-loading]',
                    template: "\n\n\n<div [class]=\"wrapperClass\" *ngIf=\"isActive()\" @flyInOut>\n    <div class=\"ng-busy-default-wrapper\">\n        <div class=\"ng-busy-default-sign\">\n            <!-- <div class=\"ng-busy-default-spinner\">\n                <div class=\"bar1\"></div>\n                <div class=\"bar2\"></div>\n                <div class=\"bar3\"></div>\n                <div class=\"bar4\"></div>\n                <div class=\"bar5\"></div>\n                <div class=\"bar6\"></div>\n                <div class=\"bar7\"></div>\n                <div class=\"bar8\"></div>\n                <div class=\"bar9\"></div>\n                <div class=\"bar10\"></div>\n                <div class=\"bar11\"></div>\n                <div class=\"bar12\"></div>\n            </div> -->\n          <div style=\"display: flex;align-items: center;\">\n            <div class=\"lds-css ng-scope\"><div style=\"width:100%;height:100%\" class=\"lds-bars\"><div></div><div></div><div></div><div></div></div><style type=\"text/css\">@keyframes lds-bars {\n              0% {\n                opacity: 1;\n              }\n              50% {\n                opacity: 0.5;\n              }\n              100% {\n                opacity: 1;\n              }\n            }\n            @-webkit-keyframes lds-bars {\n              0% {\n                opacity: 1;\n              }\n              50% {\n                opacity: 0.5;\n              }\n              100% {\n                opacity: 1;\n              }\n            }\n            .lds-bars {\n              position: relative;\n            }\n            .lds-bars div {\n              position: absolute;\n              width: 30px;\n              height: 80px;\n              top: 60px;\n              -webkit-animation: lds-bars 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n              animation: lds-bars 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n            }\n            .lds-bars div:nth-child(1) {\n              left: 25px;\n              background: #ff5a29;\n              -webkit-animation-delay: -0.48s;\n              animation-delay: -0.48s;\n            }\n            .lds-bars div:nth-child(2) {\n              left: 65px;\n              background: #ffd000;\n              -webkit-animation-delay: -0.32s;\n              animation-delay: -0.32s;\n            }\n            .lds-bars div:nth-child(3) {\n              left: 105px;\n              background: #68c578;\n              -webkit-animation-delay: -0.16s;\n              animation-delay: -0.16s;\n            }\n            .lds-bars div:nth-child(4) {\n              left: 145px;\n              background: #1fb9ec;\n            }\n            .lds-bars {\n              width: 50px !important;\n              height: 50px !important;\n              -webkit-transform: translate(-25px, -25px) scale(0.25) translate(25px, 25px);\n              transform: translate(-25px, -25px) scale(0.25) translate(25px, 25px);\n            }\n            </style></div>\n\n\n\n            <div class=\"ng-busy-default-text\">{{message}}</div>\n          </div>\n        </div>\n    </div>\n</div>\n",
                    animations: [
                        trigger('flyInOut', [
                            transition('void => *', [inactiveStyle$1, animate(timing$1)]),
                            transition('* => void', [animate(timing$1, inactiveStyle$1)])
                        ])
                    ],
                    encapsulation: ViewEncapsulation.None,
                    styles: [".ng-busy,.ng-busy>*,.ng-busy>ng-component>*{position:absolute;top:0;left:0;right:0;bottom:0}.ng-busy-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;background:#fff;opacity:.7}.ng-busy-default-wrapper{text-align:center}.ng-busy-default-sign{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);display:inline-block;z-index:1;padding:12px 14px;border:none;border-top:0;border-radius:0 0 4px 4px;box-shadow:0 0 0 rgba(255,255,255,.1);background:0 0;color:#333;width:-webkit-max-content;width:-moz-max-content;width:max-content}.ng-busy-default-text{display:inline-block;margin-left:6px;max-width:400px;font-size:14px;text-align:left}.ng-busy-default-spinner{position:relative;display:inline-block;width:25px;height:25px;vertical-align:middle}.ng-busy-default-spinner div{position:absolute;left:44.5%;top:37%;width:10%;height:26%;background:#666;border-radius:50px;box-shadow:0 0 3px rgba(0,0,0,.2);opacity:0;-webkit-animation:1s linear infinite busy-spinner-anim;animation:1s linear infinite busy-spinner-anim}.ng-busy-default-spinner .bar1{transform:rotate(0) translate(0,-142%);-webkit-animation-delay:-1s;animation-delay:-1s}.ng-busy-default-spinner .bar2{transform:rotate(30deg) translate(0,-142%);-webkit-animation-delay:-.91666667s;animation-delay:-.91666667s}.ng-busy-default-spinner .bar3{transform:rotate(60deg) translate(0,-142%);-webkit-animation-delay:-.83333333s;animation-delay:-.83333333s}.ng-busy-default-spinner .bar4{transform:rotate(90deg) translate(0,-142%);-webkit-animation-delay:-.75s;animation-delay:-.75s}.ng-busy-default-spinner .bar5{transform:rotate(120deg) translate(0,-142%);-webkit-animation-delay:-.66666667s;animation-delay:-.66666667s}.ng-busy-default-spinner .bar6{transform:rotate(150deg) translate(0,-142%);-webkit-animation-delay:-.58333333s;animation-delay:-.58333333s}.ng-busy-default-spinner .bar7{transform:rotate(180deg) translate(0,-142%);-webkit-animation-delay:-.5s;animation-delay:-.5s}.ng-busy-default-spinner .bar8{transform:rotate(210deg) translate(0,-142%);-webkit-animation-delay:-.41666667s;animation-delay:-.41666667s}.ng-busy-default-spinner .bar9{transform:rotate(240deg) translate(0,-142%);-webkit-animation-delay:-.33333333s;animation-delay:-.33333333s}.ng-busy-default-spinner .bar10{transform:rotate(270deg) translate(0,-142%);-webkit-animation-delay:-.25s;animation-delay:-.25s}.ng-busy-default-spinner .bar11{transform:rotate(300deg) translate(0,-142%);-webkit-animation-delay:-.16666667s;animation-delay:-.16666667s}.ng-busy-default-spinner .bar12{transform:rotate(330deg) translate(0,-142%);-webkit-animation-delay:-83.33333ms;animation-delay:-83.33333ms}@-webkit-keyframes busy-spinner-anim{from{opacity:1}to{opacity:.25}}@keyframes busy-spinner-anim{from{opacity:1}to{opacity:.25}}"]
                }] }
    ];
    /** @nocollapse */
    LoadingComponent.ctorParameters = function () { return [
        { type: PromiseTrackerService }
    ]; };
    return LoadingComponent;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var LoadingConfig = /** @class */ (function () {
    function LoadingConfig(config) {
        if (config === void 0) { config = {}; }
        for (var option in BUSY_CONFIG_DEFAULTS) {
            this[option] =
                config[option] != null ? config[option] : BUSY_CONFIG_DEFAULTS[option];
        }
    }
    return LoadingConfig;
}());
/** @type {?} */
var BUSY_CONFIG_DEFAULTS = {
    delay: 0,
    minDuration: 0,
    backdrop: true,
    message: 'Please wait...',
    wrapperClass: 'ng-busy',
    onActivateTick: false,
};
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var LoadingService = /** @class */ (function () {
    function LoadingService(_applicationRef, _injector, tracker, _componentFactoryResolver) {
        this._applicationRef = _applicationRef;
        this._injector = _injector;
        this.tracker = tracker;
        this._backdropFactory = _componentFactoryResolver.resolveComponentFactory(LoadingBackdropComponent);
        this._loadingFactory = _componentFactoryResolver.resolveComponentFactory(LoadingComponent);
        /** @type {?} */
        var options = this.normalizeOptions(null);
        this.tracker.reset({
            promiseList: options.busy,
            delay: options.delay,
            minDuration: options.minDuration,
            onActivateTick: options.onActivateTick,
        });
        /** @type {?} */
        var containerEl = document.querySelector('body');
        /** @type {?} */
        var backdropCmptRef;
        /** @type {?} */
        var loadingCmptRef;
        // create backdrop
        backdropCmptRef = this._backdropFactory.create(this._injector);
        this._applicationRef.attachView(backdropCmptRef.hostView);
        containerEl.appendChild(backdropCmptRef.location.nativeElement);
        // create loading
        loadingCmptRef = this._loadingFactory.create(this._injector);
        this._applicationRef.attachView(loadingCmptRef.hostView);
        containerEl.appendChild(loadingCmptRef.location.nativeElement);
        /** @type {?} */
        var instance = loadingCmptRef.instance;
        instance.message = options.message;
        instance.wrapperClass = options.wrapperClass;
        this.backdropCmptRef = backdropCmptRef;
        this.loadingCmptRef = loadingCmptRef;
        ((/** @type {?} */ (this.backdropCmptRef.location.nativeElement))).style.position = 'relative';
        ((/** @type {?} */ (this.loadingCmptRef.location.nativeElement))).style.position = 'relative';
        // this.backdropCmptRef.location.nativeElement.style.zIndex = 2000;
        // this.loadingCmptRef.location.nativeElement.style.zIndex = 2001;
    }
    /**
     * @param {?=} options
     * @return {?}
     */
    LoadingService.prototype.open = /**
     * @param {?=} options
     * @return {?}
     */
    function (options) {
        if (options === void 0) { options = undefined; }
        options = this.normalizeOptions(options);
        if (options.busy.length === 0) {
            this._fakeBusy = new Subject().subscribe();
            this._fakeBusy = new Promise((/**
             * @param {?} resolve
             * @return {?}
             */
            function (resolve) {
                if (options.maxDuration)
                    setTimeout((/**
                     * @return {?}
                     */
                    function () { return resolve(); }), options.maxDuration);
            }));
            options.busy.push(this._fakeBusy);
        }
        else if (this._fakeBusy) {
            this._fakeBusy = null;
        }
        this.tracker.reset({
            promiseList: options.busy,
            delay: options.delay,
            minDuration: options.minDuration,
            onActivateTick: options.onActivateTick,
        });
        /** @type {?} */
        var instance = this.loadingCmptRef.instance;
        instance.message = options.message;
        instance.wrapperClass = options.wrapperClass;
        if (options.onActivateTick === true)
            this._applicationRef.tick();
        this.zIndex(options.zIndex);
        return this.loadingCmptRef;
    };
    /**
     * @param {?} options
     * @return {?}
     */
    LoadingService.prototype.update = /**
     * @param {?} options
     * @return {?}
     */
    function (options) {
        options = this.normalizeOptions(options);
        /** @type {?} */
        var instance = this.loadingCmptRef.instance;
        if (options.message)
            instance.message = options.message;
        if (options.wrapperClass)
            instance.wrapperClass = options.wrapperClass;
        if (options.onActivateTick === true)
            this._applicationRef.tick();
        return this.loadingCmptRef;
    };
    /**
     * @return {?}
     */
    LoadingService.prototype.close = /**
     * @return {?}
     */
    function () {
        if (this._fakeBusy)
            this._fakeBusy = null;
        /** @type {?} */
        var options = this.normalizeOptions(undefined);
        this.tracker.reset({
            promiseList: options.busy,
            delay: options.delay,
            minDuration: options.minDuration,
            onActivateTick: options.onActivateTick,
        });
        /** @type {?} */
        var instance = this.loadingCmptRef.instance;
        instance.message = options.message;
        instance.wrapperClass = options.wrapperClass;
        if (options.onActivateTick === true)
            this._applicationRef.tick();
        return this.loadingCmptRef;
    };
    /**
     * @param {?=} zIndex
     * @return {?}
     */
    LoadingService.prototype.zIndex = /**
     * @param {?=} zIndex
     * @return {?}
     */
    function (zIndex) {
        if (zIndex === void 0) { zIndex = 2000; }
        this.backdropCmptRef.location.nativeElement.style.zIndex = zIndex;
        this.loadingCmptRef.location.nativeElement.style.zIndex = zIndex + 1;
    };
    /**
     * @private
     * @param {?} options
     * @return {?}
     */
    LoadingService.prototype.normalizeOptions = /**
     * @private
     * @param {?} options
     * @return {?}
     */
    function (options) {
        if (!options) {
            options = { busy: null };
        }
        else if (Array.isArray(options) ||
            options instanceof Promise ||
            options instanceof Subscription) {
            options = { busy: options };
        }
        options = Object.assign({}, new LoadingConfig(), options);
        if (!Array.isArray(options.busy)) {
            options.busy = options.busy ? [options.busy] : [];
        }
        return options;
    };
    LoadingService.decorators = [
        { type: Injectable }
    ];
    /** @nocollapse */
    LoadingService.ctorParameters = function () { return [
        { type: ApplicationRef },
        { type: Injector },
        { type: PromiseTrackerService },
        { type: ComponentFactoryResolver }
    ]; };
    return LoadingService;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var LoadingModule = /** @class */ (function () {
    function LoadingModule() {
    }
    /**
     * @param {?=} config
     * @return {?}
     */
    LoadingModule.forRoot = /**
     * @param {?=} config
     * @return {?}
     */
    function (config) {
        if (config === void 0) { config = {}; }
        return {
            ngModule: LoadingModule,
            providers: [
                LoadingService,
                PromiseTrackerService,
                { provide: LoadingConfig, useValue: config }
            ]
        };
    };
    LoadingModule.decorators = [
        { type: NgModule, args: [{
                    imports: [CommonModule],
                    declarations: [LoadingComponent, LoadingBackdropComponent],
                    entryComponents: [LoadingComponent, LoadingBackdropComponent]
                },] }
    ];
    return LoadingModule;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var LoadingChunkErrorHandlerService = /** @class */ (function () {
    function LoadingChunkErrorHandlerService(router, zone) {
        this.router = router;
        this.zone = zone;
        // filter router events of type NavigationError
        this.navigationError$ = this.router.events.pipe(filter((/**
         * @param {?} e
         * @return {?}
         */
        function (e) { return e instanceof NavigationError; })));
        this.initErrorHandler();
    }
    /**
     * @return {?}
     */
    LoadingChunkErrorHandlerService.prototype.initErrorHandler = /**
     * @return {?}
     */
    function () {
        var _this = this;
        this.navigationError$.subscribe((/**
         * @param {?} event
         * @return {?}
         */
        function (event) {
            /** @type {?} */
            var showPopup = false;
            // handle known error messages that can be retried
            if (event.error.message.startsWith('Loading chunk')) {
                showPopup = true;
            }
            if (showPopup) {
                // display a popup however you want...
                // if (confirm('웹사이트가 업데이트 되었습니다. 새로고침후 사용해주세요.')) {
                window.location.reload();
                // }
                // mark the error as handled to avoid global handler
                _this._errorHandled = event.error;
            }
            // normal global error handler
            _this.zone.onError.subscribe((/**
             * @param {?} error
             * @return {?}
             */
            function (error) {
                // ignore errors that were already handled but couldn't be cancelled
                if (error.rejection === _this._errorHandled) {
                    _this._errorHandled = undefined;
                    return;
                }
                // Whatever you want to do here for true unhandled errors
                console.warn(error);
            }));
        }));
    };
    LoadingChunkErrorHandlerService.decorators = [
        { type: Injectable, args: [{
                    providedIn: 'root',
                },] }
    ];
    /** @nocollapse */
    LoadingChunkErrorHandlerService.ctorParameters = function () { return [
        { type: Router },
        { type: NgZone }
    ]; };
    /** @nocollapse */ LoadingChunkErrorHandlerService.ngInjectableDef = defineInjectable({ factory: function LoadingChunkErrorHandlerService_Factory() { return new LoadingChunkErrorHandlerService(inject(Router), inject(NgZone)); }, token: LoadingChunkErrorHandlerService, providedIn: "root" });
    return LoadingChunkErrorHandlerService;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var PhoneNumberPipe = /** @class */ (function () {
    function PhoneNumberPipe() {
    }
    /**
     * @param {?} value
     * @param {?=} args
     * @return {?}
     */
    PhoneNumberPipe.prototype.transform = /**
     * @param {?} value
     * @param {?=} args
     * @return {?}
     */
    function (value, args) {
        if (args === void 0) { args = 'National'; }
        if (!value) {
            return value;
        }
        try {
            return format(parse(value, { extended: true, defaultCountry: 'KR' }), args);
        }
        catch (e) {
            return value;
        }
    };
    PhoneNumberPipe.decorators = [
        { type: Pipe, args: [{
                    name: 'phoneNumber'
                },] }
    ];
    return PhoneNumberPipe;
}());
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/** @type {?} */
var DEFAULT_COUNTRY_CALLING_CODE = new InjectionToken('DEFAULT_COUNTRY_CALLING_CODE');
/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/** @type {?} */
var IntlTelInputComponentValueAccessor = {
    provide: NG_VALUE_ACCESSOR,
    useExisting: forwardRef((/**
     * @return {?}
     */
    function () { return PhoneNumberInputComponent; })),
    multi: true
};
var PhoneNumberInputComponent = /** @class */ (function () {
    function PhoneNumberInputComponent(cdRef, elementRef, renderer, countryCallingCode) {
        this.cdRef = cdRef;
        this.elementRef = elementRef;
        this.renderer = renderer;
        this.countryCallingCode = countryCallingCode;
        this.size = 'md';
        this.placeholder = '';
        this.type = 'tel';
        this.autocomplete = 'off';
        this.blur = new EventEmitter();
        this.focus = new EventEmitter();
        this.phoneNumberChange = new EventEmitter();
        this.isContrySelectOpen = false;
        this.onChange = (/**
         * @param {?} _
         * @return {?}
         */
        function (_) { });
        this.onTouched = (/**
         * @return {?}
         */
        function () { });
        this.subscriptions = new Subscription();
    }
    /**
     * @private
     * @param {?} countryDialCode
     * @param {?} tel
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.updatePhonenumberProperties = /**
     * @private
     * @param {?} countryDialCode
     * @param {?} tel
     * @return {?}
     */
    function (countryDialCode, tel) {
        tel = tel.replace(/^0/, '');
        tel = tel.replace(/\D/g, '');
        this.value = '+' + countryDialCode + tel;
        if (this.value === '+')
            this.value = undefined;
    };
    /**
     * @param {?=} value
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.writeValue = /**
     * @param {?=} value
     * @return {?}
     */
    function (value) {
        if (value === void 0) { value = ''; }
        /** @type {?} */
        var parsed = null;
        /** @type {?} */
        var tel = '';
        /** @type {?} */
        var countryDialCode = '';
        if (value && typeof value === 'string') {
            try {
                parsed = parseNumber(value, { extended: true, defaultCountry: 'KR' });
                if (((/** @type {?} */ (parsed))).countryCallingCode)
                    countryDialCode = ((/** @type {?} */ (parsed))).countryCallingCode || '';
                tel = formatNumber((/** @type {?} */ (parsed)), 'National').replace(/\D/g, '') || '';
                // for testing phone numbers starting with 00
                if (value.match(/^\+8200/))
                    tel = '00' + tel;
                this.updatePhonenumberProperties(countryDialCode, tel);
            }
            catch (e) { }
        }
        // if only +defaultCountryDialCode is present, set countryDialCode to it.
        if (!countryDialCode && value === "+" + this.countryCallingCode)
            countryDialCode = this.countryCallingCode;
        if (countryDialCode !== this.countryDialCode.value)
            this.countryDialCode.setValue(countryDialCode, { emitEvent: false });
        if (tel !== this.tel.value)
            this.tel.setValue(tel, { emitEvent: false });
        if (!this.cdRef['destroyed'])
            this.cdRef.detectChanges();
        if (value !== this.value)
            this.onChange(this.value);
    };
    /**
     * @param {?} fn
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.registerOnChange = /**
     * @param {?} fn
     * @return {?}
     */
    function (fn) {
        this.onChange = fn;
    };
    /**
     * @param {?} fn
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.registerOnTouched = /**
     * @param {?} fn
     * @return {?}
     */
    function (fn) {
        this.onTouched = fn;
    };
    /**
     * @param {?} isDisabled
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.setDisabledState = /**
     * @param {?} isDisabled
     * @return {?}
     */
    function (isDisabled) {
        this.disabled = isDisabled;
        if (isDisabled) {
            this.tel.disable();
            this.countryDialCode.disable();
        }
        else {
            this.tel.enable();
            this.countryDialCode.enable();
        }
    };
    /**
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.updateIntlTel = /**
     * @return {?}
     */
    function () {
        /** @type {?} */
        var countryDialCode = this.countryDialCode.value;
        /** @type {?} */
        var tel = this.tel.value
        // .replace(/\D/g, '');
        ;
        // .replace(/\D/g, '');
        this.updatePhonenumberProperties(countryDialCode, tel);
        this.onChange(this.value);
        this.phoneNumberChange.next({ countryDialCode: countryDialCode, national: tel, intltel: this.value });
    };
    /** This allows the "clear search" X button to properly update the value for Edge & IE browsers */
    /**
     * This allows the "clear search" X button to properly update the value for Edge & IE browsers
     * @param {?} $event
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.detectSearchClear = /**
     * This allows the "clear search" X button to properly update the value for Edge & IE browsers
     * @param {?} $event
     * @return {?}
     */
    function ($event) {
        var _this = this;
        if ($event.target) {
            /** @type {?} */
            var inputEl_1 = (/** @type {?} */ ($event.target));
            /** @type {?} */
            var beforeVal_1 = inputEl_1.value;
            setTimeout((/**
             * @return {?}
             */
            function () {
                /** @type {?} */
                var afterVal = inputEl_1.value;
                if (beforeVal_1 !== '' && afterVal === '') {
                    _this.writeValue('');
                    _this.updateIntlTel();
                }
            }), 1);
        }
    };
    /**
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.createFormControls = /**
     * @return {?}
     */
    function () {
        this.tel = new FormControl({ value: '', disabled: this.disabled });
        this.countryDialCode = new FormControl({
            value: '',
            disabled: this.disabled
        });
    };
    /**
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.createForm = /**
     * @return {?}
     */
    function () {
        this.form = new FormGroup({
            countryDialCode: this.countryDialCode,
            tel: this.tel
        });
    };
    /**
     * @param {?} $event
     * @return {?}
     */
    PhoneNumberInputComponent.prototype.onFocus = /**
     * @param {?} $event