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);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
import { InjectionToken, Optional, Inject, Injectable } from '@angular/core';
import { ReplaySubject } from 'rxjs';
import { share } from 'rxjs/operators';
/**
 * Layout direction.
 * */
export var ElLayoutDirection;
(function (ElLayoutDirection) {
    ElLayoutDirection["LTR"] = "ltr";
    ElLayoutDirection["RTL"] = "rtl";
})(ElLayoutDirection || (ElLayoutDirection = {}));
;
/**
 * Layout direction setting injection token.
 * */
export var EL_LAYOUT_DIRECTION = new InjectionToken('Layout direction');
/**
 * Layout Direction Service.
 * Allows to set or get layout direction and listen to its changes
 */
var ElLayoutDirectionService = /** @class */ (function () {
    function ElLayoutDirectionService(direction) {
        if (direction === void 0) { direction = ElLayoutDirection.LTR; }
        this.direction = direction;
        this.$directionChange = new ReplaySubject(1);
        this.setDirection(direction);
    }
    /**
     * Returns true if layout direction set to left to right.
     * @returns boolean.
     * */
    ElLayoutDirectionService.prototype.isLtr = function () {
        return this.direction === ElLayoutDirection.LTR;
    };
    /**
     * Returns true if layout direction set to right to left.
     * @returns boolean.
     * */
    ElLayoutDirectionService.prototype.isRtl = function () {
        return this.direction === ElLayoutDirection.RTL;
    };
    /**
     * Returns current layout direction.
     * @returns ElLayoutDirection.
     * */
    ElLayoutDirectionService.prototype.getDirection = function () {
        return this.direction;
    };
    /**
     * Sets layout direction
     * @param {ElLayoutDirection} direction
     */
    ElLayoutDirectionService.prototype.setDirection = function (direction) {
        this.direction = direction;
        this.$directionChange.next(direction);
    };
    /**
     * Triggered when direction was changed.
     * @returns Observable<ElLayoutDirection>.
     */
    ElLayoutDirectionService.prototype.onDirectionChange = function () {
        return this.$directionChange.pipe(share());
    };
    ElLayoutDirectionService = __decorate([
        Injectable(),
        __param(0, Optional()), __param(0, Inject(EL_LAYOUT_DIRECTION)),
        __metadata("design:paramtypes", [Object])
    ], ElLayoutDirectionService);
    return ElLayoutDirectionService;
}());
export { ElLayoutDirectionService };
//# sourceMappingURL=direction.service.js.map