{"version":3,"file":"bidi.js","sources":["../../packages/cdk/bidi/directionality.js","../../packages/cdk/bidi/dir.js","../../packages/cdk/bidi/bidi-module.js","../../packages/cdk/bidi/index.js"],"sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { EventEmitter, Injectable, Optional, SkipSelf, Inject, InjectionToken, } from '@angular/core';\nimport { DOCUMENT } from '@angular/platform-browser';\n/**\n * Injection token used to inject the document into Directionality.\n * This is used so that the value can be faked in tests.\n *\n * We can't use the real document in tests because changing the real `dir` causes geometry-based\n * tests in Safari to fail.\n *\n * We also can't re-provide the DOCUMENT token from platform-brower because the unit tests\n * themselves use things like `querySelector` in test code.\n */\nexport const DIR_DOCUMENT = new InjectionToken('mat-dir-doc');\n/**\n * The directionality (LTR / RTL) context for the application (or a subtree of it).\n * Exposes the current direction and a stream of direction changes.\n */\nexport class Directionality {\n /**\n * @param {?=} _document\n */\n constructor(_document) {\n this.value = 'ltr';\n this.change = new EventEmitter();\n if (_document) {\n // TODO: handle 'auto' value -\n // We still need to account for dir=\"auto\".\n // It looks like HTMLElemenet.dir is also \"auto\" when that's set to the attribute,\n // but getComputedStyle return either \"ltr\" or \"rtl\". avoiding getComputedStyle for now\n const bodyDir = _document.body ? _document.body.dir : null;\n const htmlDir = _document.documentElement ? _document.documentElement.dir : null;\n this.value = (bodyDir || htmlDir || 'ltr');\n }\n }\n}\nDirectionality.decorators = [\n { type: Injectable },\n];\n/**\n * @nocollapse\n */\nDirectionality.ctorParameters = () => [\n { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DIR_DOCUMENT,] },] },\n];\nfunction Directionality_tsickle_Closure_declarations() {\n /** @type {?} */\n Directionality.decorators;\n /**\n * @nocollapse\n * @type {?}\n */\n Directionality.ctorParameters;\n /** @type {?} */\n Directionality.prototype.value;\n /** @type {?} */\n Directionality.prototype.change;\n}\n/**\n * \\@docs-private\n * @param {?} parentDirectionality\n * @param {?} _document\n * @return {?}\n */\nexport function DIRECTIONALITY_PROVIDER_FACTORY(parentDirectionality, _document) {\n return parentDirectionality || new Directionality(_document);\n}\n/**\n * \\@docs-private\n */\nexport const DIRECTIONALITY_PROVIDER = {\n // If there is already a Directionality available, use that. Otherwise, provide a new one.\n provide: Directionality,\n deps: [[new Optional(), new SkipSelf(), Directionality], [new Optional(), DOCUMENT]],\n useFactory: DIRECTIONALITY_PROVIDER_FACTORY\n};\n//# sourceMappingURL=directionality.js.map","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { Directive, Output, Input, EventEmitter } from '@angular/core';\nimport { Directionality } from './directionality';\n/**\n * Directive to listen for changes of direction of part of the DOM.\n *\n * Would provide itself in case a component looks for the Directionality service\n */\nexport class Dir {\n constructor() {\n /**\n * Layout direction of the element.\n */\n this._dir = 'ltr';\n /**\n * Whether the `value` has been set to its initial value.\n */\n this._isInitialized = false;\n /**\n * Event emitted when the direction changes.\n */\n this.change = new EventEmitter();\n }\n /**\n * \\@docs-private\n * @return {?}\n */\n get dir() {\n return this._dir;\n }\n /**\n * @param {?} v\n * @return {?}\n */\n set dir(v) {\n let /** @type {?} */ old = this._dir;\n this._dir = v;\n if (old !== this._dir && this._isInitialized) {\n this.change.emit();\n }\n }\n /**\n * Current layout direction of the element.\n * @return {?}\n */\n get value() { return this.dir; }\n /**\n * Initialize once default value has been set.\n * @return {?}\n */\n ngAfterContentInit() {\n this._isInitialized = true;\n }\n}\nDir.decorators = [\n { type: Directive, args: [{\n selector: '[dir]',\n providers: [{ provide: Directionality, useExisting: Dir }],\n host: { '[dir]': 'dir' },\n exportAs: 'dir',\n },] },\n];\n/**\n * @nocollapse\n */\nDir.ctorParameters = () => [];\nDir.propDecorators = {\n 'change': [{ type: Output, args: ['dirChange',] },],\n 'dir': [{ type: Input, args: ['dir',] },],\n};\nfunction Dir_tsickle_Closure_declarations() {\n /** @type {?} */\n Dir.decorators;\n /**\n * @nocollapse\n * @type {?}\n */\n Dir.ctorParameters;\n /** @type {?} */\n Dir.propDecorators;\n /**\n * Layout direction of the element.\n * @type {?}\n */\n Dir.prototype._dir;\n /**\n * Whether the `value` has been set to its initial value.\n * @type {?}\n */\n Dir.prototype._isInitialized;\n /**\n * Event emitted when the direction changes.\n * @type {?}\n */\n Dir.prototype.change;\n}\n//# sourceMappingURL=dir.js.map","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { NgModule } from '@angular/core';\nimport { DOCUMENT } from '@angular/platform-browser';\nimport { Dir } from './dir';\nimport { DIR_DOCUMENT, Directionality } from './directionality';\nexport class BidiModule {\n}\nBidiModule.decorators = [\n { type: NgModule, args: [{\n exports: [Dir],\n declarations: [Dir],\n providers: [\n { provide: DIR_DOCUMENT, useExisting: DOCUMENT },\n Directionality,\n ]\n },] },\n];\n/**\n * @nocollapse\n */\nBidiModule.ctorParameters = () => [];\nfunction BidiModule_tsickle_Closure_declarations() {\n /** @type {?} */\n BidiModule.decorators;\n /**\n * @nocollapse\n * @type {?}\n */\n BidiModule.ctorParameters;\n}\n//# sourceMappingURL=bidi-module.js.map","/**\n * Generated bundle index. Do not edit.\n */\nexport { Directionality, DIRECTIONALITY_PROVIDER_FACTORY, DIRECTIONALITY_PROVIDER, DIR_DOCUMENT, Dir, BidiModule } from './public-api';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;;;;;;AASA;;;;;;;;;;AAUA,AAAO,MAAM,YAAY,GAAG,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;;;;;AAK9D,AAAO,MAAM,cAAc,CAAC;;;;IAIxB,WAAW,CAAC,SAAS,EAAE;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,EAAE,CA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