{"version":3,"sources":["node_modules/@angular/cdk/fesm2022/bidi.mjs"],"sourcesContent":["import * as i0 from '@angular/core';\nimport { InjectionToken, inject, EventEmitter, Injectable, Optional, Inject, Directive, Output, Input, NgModule } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\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-browser because the unit tests\n * themselves use things like `querySelector` in test code.\n *\n * This token is defined in a separate file from Directionality as a workaround for\n * https://github.com/angular/angular/issues/22559\n *\n * @docs-private\n */\nconst DIR_DOCUMENT = /*#__PURE__*/new InjectionToken('cdk-dir-doc', {\n providedIn: 'root',\n factory: DIR_DOCUMENT_FACTORY\n});\n/** @docs-private */\nfunction DIR_DOCUMENT_FACTORY() {\n return inject(DOCUMENT);\n}\n\n/** Regex that matches locales with an RTL script. Taken from `goog.i18n.bidi.isRtlLanguage`. */\nconst RTL_LOCALE_PATTERN = /^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;\n/** Resolves a string value to a specific direction. */\nfunction _resolveDirectionality(rawValue) {\n const value = rawValue?.toLowerCase() || '';\n if (value === 'auto' && typeof navigator !== 'undefined' && navigator?.language) {\n return RTL_LOCALE_PATTERN.test(navigator.language) ? 'rtl' : 'ltr';\n }\n return value === 'rtl' ? 'rtl' : 'ltr';\n}\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 */\nlet Directionality = /*#__PURE__*/(() => {\n class Directionality {\n constructor(_document) {\n /** The current 'ltr' or 'rtl' value. */\n this.value = 'ltr';\n /** Stream that emits whenever the 'ltr' / 'rtl' state changes. */\n this.change = new EventEmitter();\n if (_document) {\n const bodyDir = _document.body ? _document.body.dir : null;\n const htmlDir = _document.documentElement ? _document.documentElement.dir : null;\n this.value = _resolveDirectionality(bodyDir || htmlDir || 'ltr');\n }\n }\n ngOnDestroy() {\n this.change.complete();\n }\n static {\n this.ɵfac = function Directionality_Factory(t) {\n return new (t || Directionality)(i0.ɵɵinject(DIR_DOCUMENT, 8));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Directionality,\n factory: Directionality.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return Directionality;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Directive to listen for changes of direction of part of the DOM.\n *\n * Provides itself as Directionality such that descendant directives only need to ever inject\n * Directionality to get the closest direction.\n */\nlet Dir = /*#__PURE__*/(() => {\n class Dir {\n constructor() {\n /** Normalized direction that accounts for invalid/unsupported values. */\n this._dir = 'ltr';\n /** Whether the `value` has been set to its initial value. */\n this._isInitialized = false;\n /** Event emitted when the direction changes. */\n this.change = new EventEmitter();\n }\n /** @docs-private */\n get dir() {\n return this._dir;\n }\n set dir(value) {\n const previousValue = this._dir;\n // Note: `_resolveDirectionality` resolves the language based on the browser's language,\n // whereas the browser does it based on the content of the element. Since doing so based\n // on the content can be expensive, for now we're doing the simpler matching.\n this._dir = _resolveDirectionality(value);\n this._rawDir = value;\n if (previousValue !== this._dir && this._isInitialized) {\n this.change.emit(this._dir);\n }\n }\n /** Current layout direction of the element. */\n get value() {\n return this.dir;\n }\n /** Initialize once default value has been set. */\n ngAfterContentInit() {\n this._isInitialized = true;\n }\n ngOnDestroy() {\n this.change.complete();\n }\n static {\n this.ɵfac = function Dir_Factory(t) {\n return new (t || Dir)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: Dir,\n selectors: [[\"\", \"dir\", \"\"]],\n hostVars: 1,\n hostBindings: function Dir_HostBindings(rf, ctx) {\n if (rf & 2) {\n i0.ɵɵattribute(\"dir\", ctx._rawDir);\n }\n },\n inputs: {\n dir: \"dir\"\n },\n outputs: {\n change: \"dirChange\"\n },\n exportAs: [\"dir\"],\n standalone: true,\n features: [i0.ɵɵProvidersFeature([{\n provide: Directionality,\n useExisting: Dir\n }])]\n });\n }\n }\n return Dir;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet BidiModule = /*#__PURE__*/(() => {\n class BidiModule {\n static {\n this.ɵfac = function BidiModule_Factory(t) {\n return new (t || BidiModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: BidiModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n }\n return BidiModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BidiModule, DIR_DOCUMENT, Dir, Directionality };\n"],"mappings":"iIAmBA,IAAMA,EAA4B,IAAIC,EAAe,cAAe,CAClE,WAAY,OACZ,QAASC,CACX,CAAC,EAED,SAASA,GAAuB,CAC9B,OAAOC,EAAOC,CAAQ,CACxB,CAGA,IAAMC,EAAqB,qHAE3B,SAASC,EAAuBC,EAAU,CACxC,IAAMC,EAAQD,GAAU,YAAY,GAAK,GACzC,OAAIC,IAAU,QAAU,OAAO,UAAc,KAAe,WAAW,SAC9DH,EAAmB,KAAK,UAAU,QAAQ,EAAI,MAAQ,MAExDG,IAAU,MAAQ,MAAQ,KACnC,CAKA,IAAIC,GAA+B,IAAM,CACvC,IAAMC,EAAN,MAAMA,CAAe,CACnB,YAAYC,EAAW,CAKrB,GAHA,KAAK,MAAQ,MAEb,KAAK,OAAS,IAAIC,EACdD,EAAW,CACb,IAAME,EAAUF,EAAU,KAAOA,EAAU,KAAK,IAAM,KAChDG,EAAUH,EAAU,gBAAkBA,EAAU,gBAAgB,IAAM,KAC5E,KAAK,MAAQL,EAAuBO,GAAWC,GAAW,KAAK,CACjE,CACF,CACA,aAAc,CACZ,KAAK,OAAO,SAAS,CACvB,CAaF,EAXIJ,EAAK,UAAO,SAAgCK,EAAG,CAC7C,OAAO,IAAKA,GAAKL,GAAmBM,EAAShB,EAAc,CAAC,CAAC,CAC/D,EAGAU,EAAK,WAA0BO,EAAmB,CAChD,MAAOP,EACP,QAASA,EAAe,UACxB,WAAY,MACd,CAAC,EAzBL,IAAMD,EAANC,EA4BA,OAAOD,CACT,GAAG,EAkFH,IAAIS,GAA2B,IAAM,CACnC,IAAMC,EAAN,MAAMA,CAAW,CAcjB,EAZIA,EAAK,UAAO,SAA4BC,EAAG,CACzC,OAAO,IAAKA,GAAKD,EACnB,EAGAA,EAAK,UAAyBE,EAAiB,CAC7C,KAAMF,CACR,CAAC,EAGDA,EAAK,UAAyBG,EAAiB,CAAC,CAAC,EAZrD,IAAMJ,EAANC,EAeA,OAAOD,CACT,GAAG","names":["DIR_DOCUMENT","InjectionToken","DIR_DOCUMENT_FACTORY","inject","DOCUMENT","RTL_LOCALE_PATTERN","_resolveDirectionality","rawValue","value","Directionality","_Directionality","_document","EventEmitter","bodyDir","htmlDir","t","ɵɵinject","ɵɵdefineInjectable","BidiModule","_BidiModule","t","ɵɵdefineNgModule","ɵɵdefineInjector"],"x_google_ignoreList":[0]}