/**
 * @license
 * Copyright Endlessjs. All Rights Reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component, Input, QueryList, ViewChildren } from '@angular/core';
import { animate, style, transition, trigger } from '@angular/animations';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { ElToastComponent } from './toast.component';
import { ElLayoutDirectionService } from '../../services/direction.service';
import { ElPositionHelper } from '../cdk/overlay/position-helper';
var voidState = style({
    transform: 'translateX({{ direction }}110%)',
    height: 0,
    marginLeft: '0',
    marginRight: '0',
    marginTop: '0',
    marginBottom: '0',
});
var defaultOptions = { params: { direction: '' } };
var ElToastrContainerComponent = /** @class */ (function () {
    function ElToastrContainerComponent(layoutDirection, positionHelper) {
        this.layoutDirection = layoutDirection;
        this.positionHelper = positionHelper;
        this.destroy$ = new Subject();
        this.content = [];
    }
    ElToastrContainerComponent.prototype.ngOnInit = function () {
        var _this = this;
        this.layoutDirection.onDirectionChange()
            .pipe(takeUntil(this.destroy$))
            .subscribe(function () { return _this.onDirectionChange(); });
    };
    ElToastrContainerComponent.prototype.ngOnDestroy = function () {
        this.destroy$.next();
        this.destroy$.complete();
    };
    ElToastrContainerComponent.prototype.onDirectionChange = function () {
        var direction = this.positionHelper.isRightPosition(this.position) ? '' : '-';
        this.fadeIn = { value: '', params: { direction: direction } };
    };
    __decorate([
        Input(),
        __metadata("design:type", Array)
    ], ElToastrContainerComponent.prototype, "content", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], ElToastrContainerComponent.prototype, "context", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], ElToastrContainerComponent.prototype, "position", void 0);
    __decorate([
        ViewChildren(ElToastComponent),
        __metadata("design:type", QueryList)
    ], ElToastrContainerComponent.prototype, "toasts", void 0);
    ElToastrContainerComponent = __decorate([
        Component({
            selector: 'el-toastr-container',
            template: "\n    <el-toast [@fadeIn]=\"fadeIn\" *ngFor=\"let toast of content\" [toast]=\"toast\"></el-toast>",
            animations: [
                trigger('fadeIn', [
                    transition(':enter', [voidState, animate(100)], defaultOptions),
                    transition(':leave', [animate(100, voidState)], defaultOptions),
                ]),
            ]
        }),
        __metadata("design:paramtypes", [ElLayoutDirectionService,
            ElPositionHelper])
    ], ElToastrContainerComponent);
    return ElToastrContainerComponent;
}());
export { ElToastrContainerComponent };
//# sourceMappingURL=toastr-container.component.js.map