text: /**
   * @fileoverview added by tsickle
   * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
   */
  /**
   * @license
   * Copyright Google LLC All Rights Reserved.
   *
   * Use of this source code is governed by an MIT-style license that can be
   * found in the LICENSE file at https://angular.io/license
   */
  import { EventEmitter, Inject, Injectable, Optional } from '@angular/core';
  import { DIR_DOCUMENT } from './dir-document-token';
  import * as i0 from "@angular/core";
  import * as i1 from "./dir-document-token";
  /**
   * The directionality (LTR / RTL) context for the application (or a subtree of it).
   * Exposes the current direction and a stream of direction changes.
   */
  var Directionality = /** @class */ (function () {
      function Directionality(_document) {
          /**
           * The current 'ltr' or 'rtl' value.
           */
          this.value = 'ltr';
          /**
           * Stream that emits whenever the 'ltr' / 'rtl' state changes.
           */
          this.change = new EventEmitter();
          if (_document) {
              // TODO: handle 'auto' value -
              // We still need to account for dir="auto".
              // It looks like HTMLElemenet.dir is also "auto" when that's set to the attribute,
              // but getComputedStyle return either "ltr" or "rtl". avoiding getComputedStyle for now
              /** @type {?} */
              var bodyDir = _document.body ? _document.body.dir : null;
              /** @type {?} */
              var htmlDir = _document.documentElement ? _document.documentElement.dir : null;
              /** @type {?} */
              var value = bodyDir || htmlDir;
              this.value = (value === 'ltr' || value === 'rtl') ? value : 'ltr';
          }
      }
      /**
       * @return {?}
       */
      Directionality.prototype.ngOnDestroy = /**
       * @return {?}
       */
      function () {
          this.change.complete();
      };
      Directionality.decorators = [
          { type: Injectable, args: [{ providedIn: 'root' },] },
      ];
      /** @nocollapse */
      Directionality.ctorParameters = function () { return [
          { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DIR_DOCUMENT,] }] }
      ]; };
      /** @nocollapse */ Directionality.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function Directionality_Factory() { return new Directionality(i0.ɵɵinject(i1.DIR_DOCUMENT, 8)); }, token: Directionality, providedIn: "root" });
      return Directionality;
  }());
  export { Directionality };
  if (false) {
      /**
       * The current 'ltr' or 'rtl' value.
       * @type {?}
       */
      Directionality.prototype.value;
      /**
       * Stream that emits whenever the 'ltr' / 'rtl' state changes.
       * @type {?}
       */
      Directionality.prototype.change;
  }
  //# sourceMappingURL=directionality.js.map