@rxap/config 16.0.0-dev.0 → 16.0.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Injectable, Optional, Inject } from '@angular/core';
3
- import { SetObjectValue, deepMerge } from '@rxap/utilities';
3
+ import { deepMerge, coerceArray, SetObjectValue } from '@rxap/utilities';
4
+ import { firstValueFrom } from 'rxjs';
4
5
  import * as i1 from '@angular/common/http';
5
6
  import { HttpClient } from '@angular/common/http';
6
7
  import { finalize, share } from 'rxjs/operators';
@@ -21,7 +22,60 @@ class ConfigService {
21
22
  */
22
23
  static { this.Overwrites = {}; }
23
24
  static { this.LocalStorageKey = 'rxap/config/local-config'; }
24
- static { this.Urls = ['config.json']; }
25
+ /**
26
+ * @deprecated instead use the url property of the ConfigLoadOptions
27
+ */
28
+ static { this.Urls = []; }
29
+ constructor(config = null) {
30
+ this.config = ConfigService.Config;
31
+ if (config) {
32
+ this.config = deepMerge(this.config ?? {}, config);
33
+ }
34
+ if (!this.config) {
35
+ throw new Error('config not available');
36
+ }
37
+ }
38
+ /**
39
+ * Used to load the app config from a remote resource.
40
+ *
41
+ * Promise.all([ ConfigService.Load() ])
42
+ * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))
43
+ * .catch(err => console.error(err))
44
+ *
45
+ */
46
+ static async Load(options, environment) {
47
+ let config = deepMerge(this.Defaults, options?.static ?? {});
48
+ const urls = (options?.url ? coerceArray(options.url) : ConfigService.Urls).map(url => {
49
+ if (typeof url === 'function') {
50
+ if (!environment) {
51
+ throw new Error('environment is required when url is a function');
52
+ }
53
+ return coerceArray(url(environment));
54
+ }
55
+ return coerceArray(url);
56
+ }).flat();
57
+ for (const url of urls) {
58
+ config = deepMerge(config, await this.loadConfig(url, true, options?.schema));
59
+ }
60
+ config = deepMerge(config, this.Overwrites);
61
+ if (options?.fromLocalStorage !== false) {
62
+ const localConfig = localStorage.getItem(ConfigService.LocalStorageKey);
63
+ if (localConfig) {
64
+ try {
65
+ config = deepMerge(config, JSON.parse(localConfig));
66
+ }
67
+ catch (e) {
68
+ console.error('local config could not be parsed');
69
+ }
70
+ }
71
+ }
72
+ if (options?.fromUrlParam) {
73
+ const param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';
74
+ config = deepMerge(config, this.LoadConfigDefaultFromUrlParam(param));
75
+ }
76
+ console.debug('app config', config);
77
+ this.Config = config;
78
+ }
25
79
  static async loadConfig(url, required, schema) {
26
80
  let config;
27
81
  let response;
@@ -71,64 +125,6 @@ class ConfigService {
71
125
  }
72
126
  return config;
73
127
  }
74
- static showError(message) {
75
- const hasUl = document.getElementById('rxap-config-error') !== null;
76
- const ul = document.getElementById('rxap-config-error') ?? document.createElement('ul');
77
- ul.id = 'rxap-config-error';
78
- ul.style.position = 'fixed';
79
- ul.style.bottom = '16px';
80
- ul.style.right = '16px';
81
- ul.style.backgroundColor = 'white';
82
- ul.style.padding = '32px';
83
- ul.style.zIndex = '99999999';
84
- ul.style.color = 'black';
85
- const li = document.createElement('li');
86
- li.innerText = message;
87
- ul.appendChild(li);
88
- if (!hasUl) {
89
- document.body.appendChild(ul);
90
- }
91
- }
92
- static async SideLoad(url, propertyPath, required, schema) {
93
- if (!this.Config) {
94
- throw new Error('Config side load is only possible after the initial config load.');
95
- }
96
- const config = await this.loadConfig(url, required, schema);
97
- SetObjectValue(this.Config, propertyPath, config);
98
- console.debug(`Side loaded config for '${propertyPath}' successful`, this.Config);
99
- }
100
- /**
101
- * Used to load the app config from a remote resource.
102
- *
103
- * Promise.all([ ConfigService.Load() ])
104
- * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))
105
- * .catch(err => console.error(err))
106
- *
107
- */
108
- static async Load(options) {
109
- let config = this.Defaults;
110
- for (const url of ConfigService.Urls) {
111
- config = await this.loadConfig(url, true, options?.schema);
112
- }
113
- config = deepMerge(config, this.Overwrites);
114
- if (options?.fromLocalStorage !== false) {
115
- const localConfig = localStorage.getItem(ConfigService.LocalStorageKey);
116
- if (localConfig) {
117
- try {
118
- config = deepMerge(config, JSON.parse(localConfig));
119
- }
120
- catch (e) {
121
- console.error('local config could not be parsed');
122
- }
123
- }
124
- }
125
- if (options?.fromUrlParam) {
126
- const param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';
127
- config = deepMerge(config, this.LoadConfigDefaultFromUrlParam(param));
128
- }
129
- console.debug('app config', config);
130
- this.Config = config;
131
- }
132
128
  static LoadConfigDefaultFromUrlParam(param = 'config') {
133
129
  const queryString = window.location.search;
134
130
  const urlParams = new URLSearchParams(queryString);
@@ -148,6 +144,14 @@ class ConfigService {
148
144
  }
149
145
  return configFromParams;
150
146
  }
147
+ static async SideLoad(url, propertyPath, required, schema) {
148
+ if (!this.Config) {
149
+ throw new Error('Config side load is only possible after the initial config load.');
150
+ }
151
+ const config = await this.loadConfig(url, required, schema);
152
+ SetObjectValue(this.Config, propertyPath, config);
153
+ console.debug(`Side loaded config for '${propertyPath}' successful`, this.Config);
154
+ }
151
155
  static Get(path, defaultValue, config = this.Config) {
152
156
  if (!config) {
153
157
  throw new Error('config not loaded');
@@ -157,7 +161,8 @@ class ConfigService {
157
161
  throw new Error('The config property path is not a string');
158
162
  }
159
163
  for (const fragment of path.split('.')) {
160
- if (configValue?.hasOwnProperty(fragment)) {
164
+ // eslint-disable-next-line no-prototype-builtins
165
+ if (configValue.hasOwnProperty(fragment)) {
161
166
  configValue = configValue[fragment];
162
167
  }
163
168
  else {
@@ -170,13 +175,22 @@ class ConfigService {
170
175
  }
171
176
  return configValue;
172
177
  }
173
- constructor(config = null) {
174
- this.config = ConfigService.Config;
175
- if (config) {
176
- this.config = deepMerge(this.config ?? {}, config);
177
- }
178
- if (!this.config) {
179
- throw new Error('config not available');
178
+ static showError(message) {
179
+ const hasUl = document.getElementById('rxap-config-error') !== null;
180
+ const ul = document.getElementById('rxap-config-error') ?? document.createElement('ul');
181
+ ul.id = 'rxap-config-error';
182
+ ul.style.position = 'fixed';
183
+ ul.style.bottom = '16px';
184
+ ul.style.right = '16px';
185
+ ul.style.backgroundColor = 'white';
186
+ ul.style.padding = '32px';
187
+ ul.style.zIndex = '99999999';
188
+ ul.style.color = 'black';
189
+ const li = document.createElement('li');
190
+ li.innerText = message;
191
+ ul.appendChild(li);
192
+ if (!hasUl) {
193
+ document.body.appendChild(ul);
180
194
  }
181
195
  }
182
196
  setLocalConfig(config) {
@@ -195,13 +209,13 @@ class ConfigService {
195
209
  }
196
210
  return value;
197
211
  }
198
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConfigService, deps: [{ token: RXAP_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
199
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConfigService, providedIn: 'root' }); }
212
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ConfigService, deps: [{ token: RXAP_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
213
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ConfigService, providedIn: 'root' }); }
200
214
  }
201
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConfigService, decorators: [{
215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ConfigService, decorators: [{
202
216
  type: Injectable,
203
217
  args: [{
204
- providedIn: 'root'
218
+ providedIn: 'root',
205
219
  }]
206
220
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
207
221
  type: Optional
@@ -225,12 +239,12 @@ class ConfigLoaderService {
225
239
  }
226
240
  const loading$ = this.http.get(url).pipe(finalize(() => this.configLoading.delete(url)), share());
227
241
  this.configLoading.set(url, loading$);
228
- return loading$.toPromise();
242
+ return firstValueFrom(loading$);
229
243
  }
230
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConfigLoaderService, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
231
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConfigLoaderService, providedIn: 'root' }); }
244
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ConfigLoaderService, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
245
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ConfigLoaderService, providedIn: 'root' }); }
232
246
  }
233
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConfigLoaderService, decorators: [{
247
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ConfigLoaderService, decorators: [{
234
248
  type: Injectable,
235
249
  args: [{ providedIn: 'root' }]
236
250
  }], ctorParameters: function () { return [{ type: i1.HttpClient, decorators: [{
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-config.mjs","sources":["../../../../libs/config/src/lib/tokens.ts","../../../../libs/config/src/lib/config.service.ts","../../../../libs/config/src/lib/config-loader.service.ts","../../../../libs/config/src/rxap-config.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const RXAP_CONFIG = new InjectionToken('rxap/config');\n","import {\n Injectable,\n Optional,\n Inject\n} from '@angular/core';\nimport {\n deepMerge,\n SetObjectValue\n} from '@rxap/utilities';\nimport { RXAP_CONFIG } from './tokens';\nimport { NoInferType } from './types';\nimport { AnySchema } from 'joi';\n\nexport interface ConfigLoadOptions {\n fromUrlParam?: string | boolean;\n fromLocalStorage?: boolean;\n schema?: AnySchema;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ConfigService<Config extends Record<string, any> = Record<string, any>> {\n\n public static Config: any = null;\n\n /**\n * Static default values for the config object.\n * Will be overwritten by an dynamic config file specified in\n * the Urls array.\n */\n public static Defaults: any = {};\n\n /**\n * Any value definition in the Overwrites object will overwrite any\n * value form the Defaults values or dynamic config files\n */\n public static Overwrites: any = {};\n\n public static LocalStorageKey = 'rxap/config/local-config';\n\n public static Urls = [ 'config.json' ];\n\n private static async loadConfig<T = any>(url: string, required?: boolean, schema?: AnySchema): Promise<T | null> {\n\n let config: any;\n let response: any;\n\n try {\n response = await fetch(url)\n } catch (error: any) {\n const message = `Could not fetch config from '${url}': ${error.message}`;\n if (required) {\n this.showError(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n try {\n config = await response.json()\n } catch (error: any) {\n const message = `Could not parse config from '${url}' to a json object: ${error.message}`;\n if (required) {\n this.showError(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n if (schema) {\n try {\n config = await schema.validateAsync(config);\n } catch (error: any) {\n const message = `Config from '${url}' is not valid: ${error.message}`;\n if (required) {\n this.showError(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n }\n\n return config;\n\n }\n\n private static showError(message: string) {\n const hasUl = document.getElementById('rxap-config-error') !== null;\n const ul = document.getElementById('rxap-config-error') ?? document.createElement('ul');\n ul.id = 'rxap-config-error';\n ul.style.position = 'fixed';\n ul.style.bottom = '16px';\n ul.style.right = '16px';\n ul.style.backgroundColor = 'white';\n ul.style.padding = '32px';\n ul.style.zIndex = '99999999';\n ul.style.color = 'black';\n const li = document.createElement('li');\n li.innerText = message;\n ul.appendChild(li);\n if (!hasUl) {\n document.body.appendChild(ul);\n }\n }\n\n public static async SideLoad(url: string, propertyPath: string, required?: boolean, schema?: AnySchema): Promise<void> {\n\n if (!this.Config) {\n throw new Error('Config side load is only possible after the initial config load.');\n }\n\n const config = await this.loadConfig(url, required, schema);\n\n SetObjectValue(this.Config, propertyPath, config);\n\n console.debug(`Side loaded config for '${propertyPath}' successful`, this.Config);\n\n }\n\n /**\n * Used to load the app config from a remote resource.\n *\n * Promise.all([ ConfigService.Load() ])\n * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))\n * .catch(err => console.error(err))\n *\n */\n public static async Load(options?: ConfigLoadOptions): Promise<void> {\n let config = this.Defaults;\n for (const url of ConfigService.Urls) {\n config = await this.loadConfig(url, true, options?.schema);\n }\n\n config = deepMerge(config, this.Overwrites);\n\n if (options?.fromLocalStorage !== false) {\n\n const localConfig = localStorage.getItem(ConfigService.LocalStorageKey);\n\n if (localConfig) {\n try {\n config = deepMerge(config, JSON.parse(localConfig));\n } catch (e: any) {\n console.error('local config could not be parsed');\n }\n }\n\n }\n\n if (options?.fromUrlParam) {\n const param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';\n config = deepMerge(config, this.LoadConfigDefaultFromUrlParam(param));\n }\n\n console.debug('app config', config);\n\n this.Config = config;\n }\n\n private static LoadConfigDefaultFromUrlParam(param: string = 'config') {\n\n const queryString = window.location.search;\n const urlParams = new URLSearchParams(queryString);\n\n const configFromParams = {};\n\n for (const configParam of urlParams.getAll('config')) {\n\n try {\n const split = configParam.split(';');\n if (split.length === 2) {\n const keyPath = split[ 0 ];\n const value = split[ 1 ];\n SetObjectValue(configFromParams, keyPath, value);\n }\n } catch (e: any) {\n console.warn(`Parsing of url config param failed for '${configParam}': ${e.message}`);\n }\n\n }\n\n return configFromParams;\n\n }\n\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(path: string, defaultValue: T | undefined, config: Record<string, any>): T\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(\n path: string,\n defaultValue: NoInferType<T>,\n config: Record<string, any> = this.Config\n ): T {\n if (!config) {\n throw new Error('config not loaded');\n }\n let configValue: any = config;\n if (typeof path !== 'string') {\n throw new Error('The config property path is not a string');\n }\n for (const fragment of (path as any).split('.')) {\n if (configValue?.hasOwnProperty(fragment)) {\n configValue = configValue[ fragment ];\n } else {\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n console.warn(`Config with path '${path}' not found`);\n return undefined as any;\n }\n }\n return configValue;\n }\n\n public readonly config!: Config;\n\n constructor(@Optional() @Inject(RXAP_CONFIG) config: any | null = null) {\n this.config = ConfigService.Config;\n if (config) {\n this.config = deepMerge(this.config ?? {}, config);\n }\n if (!this.config) {\n throw new Error('config not available');\n }\n }\n\n public setLocalConfig(config: Config): void {\n localStorage.setItem(ConfigService.LocalStorageKey, JSON.stringify(config));\n }\n\n public clearLocalConfig(): void {\n localStorage.removeItem(ConfigService.LocalStorageKey);\n }\n\n public get<T = any>(propertyPath: string): T | undefined;\n public get<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public get<T = any>(propertyPath: string, defaultValue?: T): T | undefined {\n return ConfigService.Get(propertyPath, defaultValue, this.config);\n }\n\n public getOrThrow<T = any>(propertyPath: string): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue?: T): T {\n const value = ConfigService.Get(propertyPath, defaultValue, this.config);\n if (value === undefined) {\n throw new Error(`Could not find config in path '${propertyPath}'`);\n }\n return value;\n }\n\n}\n","import { Injectable, Inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { HttpClient } from '@angular/common/http';\nimport { finalize, share } from 'rxjs/operators';\n\n@Injectable({ providedIn: 'root' })\nexport class ConfigLoaderService {\n public readonly configs = new Map<string, any>();\n\n public readonly configLoading = new Map<string, Observable<any>>();\n\n constructor(\n @Inject(HttpClient)\n public readonly http: HttpClient\n ) {}\n\n public async load$<T = any>(url: string): Promise<T> {\n if (this.configs.has(url)) {\n return this.configs.get(url);\n }\n\n if (this.configLoading.has(url)) {\n return this.configLoading.get(url)!.toPromise();\n }\n\n const loading$ = this.http.get<T>(url).pipe(\n finalize(() => this.configLoading.delete(url)),\n share()\n );\n\n this.configLoading.set(url, loading$);\n\n return loading$.toPromise();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAEa,WAAW,GAAG,IAAI,cAAc,CAAC,aAAa;;ACiB3D,MAGa,aAAa,CAAA;aAEV,IAAM,CAAA,MAAA,GAAQ,IAAR,CAAa,EAAA;AAEjC;;;;AAIG;aACW,IAAQ,CAAA,QAAA,GAAQ,EAAR,CAAW,EAAA;AAEjC;;;AAGG;aACW,IAAU,CAAA,UAAA,GAAQ,EAAR,CAAW,EAAA;aAErB,IAAe,CAAA,eAAA,GAAG,0BAAH,CAA8B,EAAA;AAE7C,IAAA,SAAA,IAAA,CAAA,IAAI,GAAG,CAAE,aAAa,CAAE,CAAC,EAAA;IAE/B,aAAa,UAAU,CAAU,GAAW,EAAE,QAAkB,EAAE,MAAkB,EAAA;AAE1F,QAAA,IAAI,MAAW,CAAC;AAChB,QAAA,IAAI,QAAa,CAAC;QAElB,IAAI;AACF,YAAA,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;AAC5B,SAAA;AAAC,QAAA,OAAO,KAAU,EAAE;YACnB,MAAM,OAAO,GAAG,CAAgC,6BAAA,EAAA,GAAG,MAAM,KAAK,CAAC,OAAO,CAAA,CAAE,CAAC;AACzE,YAAA,IAAI,QAAQ,EAAE;AACZ,gBAAA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACxB,gBAAA,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC1B,aAAA;AAAM,iBAAA;AACL,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACtB,gBAAA,OAAO,IAAI,CAAC;AACb,aAAA;AACF,SAAA;QAED,IAAI;AACF,YAAA,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;AAC/B,SAAA;AAAC,QAAA,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/angular/config/src/lib/tokens.ts","../../../../../packages/angular/config/src/lib/config.service.ts","../../../../../packages/angular/config/src/lib/config-loader.service.ts","../../../../../packages/angular/config/src/rxap-config.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const RXAP_CONFIG = new InjectionToken('rxap/config');\n","import {\n Inject,\n Injectable,\n Optional,\n} from '@angular/core';\nimport { Environment } from '@rxap/environment';\nimport {\n coerceArray,\n deepMerge,\n SetObjectValue,\n} from '@rxap/utilities';\nimport { AnySchema } from 'joi';\nimport { RXAP_CONFIG } from './tokens';\nimport { NoInferType } from './types';\n\nexport interface ConfigLoadOptions {\n fromUrlParam?: string | boolean;\n fromLocalStorage?: boolean;\n schema?: AnySchema;\n url?: string | string[] | ((environment: Environment) => string | string[]);\n /**\n * static config values\n */\n static?: Record<string, any>;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ConfigService<Config extends Record<string, any> = Record<string, any>> {\n\n public static Config: any = null;\n\n /**\n * Static default values for the config object.\n * Will be overwritten by an dynamic config file specified in\n * the Urls array.\n */\n public static Defaults: any = {};\n\n /**\n * Any value definition in the Overwrites object will overwrite any\n * value form the Defaults values or dynamic config files\n */\n public static Overwrites: any = {};\n\n public static LocalStorageKey = 'rxap/config/local-config';\n\n /**\n * @deprecated instead use the url property of the ConfigLoadOptions\n */\n public static Urls = [];\n public readonly config!: Config;\n\n constructor(@Optional() @Inject(RXAP_CONFIG) config: any | null = null) {\n this.config = ConfigService.Config;\n if (config) {\n this.config = deepMerge(this.config ?? {}, config);\n }\n if (!this.config) {\n throw new Error('config not available');\n }\n }\n\n /**\n * Used to load the app config from a remote resource.\n *\n * Promise.all([ ConfigService.Load() ])\n * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))\n * .catch(err => console.error(err))\n *\n */\n public static async Load(options?: ConfigLoadOptions, environment?: Environment): Promise<void> {\n let config = deepMerge(this.Defaults, options?.static ?? {});\n\n const urls = (options?.url ? coerceArray(options.url) : ConfigService.Urls).map(url => {\n if (typeof url === 'function') {\n if (!environment) {\n throw new Error('environment is required when url is a function');\n }\n return coerceArray(url(environment));\n }\n return coerceArray(url);\n }).flat();\n\n for (const url of urls) {\n config = deepMerge(config, await this.loadConfig(url, true, options?.schema));\n }\n\n config = deepMerge(config, this.Overwrites);\n\n if (options?.fromLocalStorage !== false) {\n\n const localConfig = localStorage.getItem(ConfigService.LocalStorageKey);\n\n if (localConfig) {\n try {\n config = deepMerge(config, JSON.parse(localConfig));\n } catch (e: any) {\n console.error('local config could not be parsed');\n }\n }\n\n }\n\n if (options?.fromUrlParam) {\n const param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';\n config = deepMerge(config, this.LoadConfigDefaultFromUrlParam(param));\n }\n\n console.debug('app config', config);\n\n this.Config = config;\n }\n\n private static async loadConfig<T = any>(url: string, required?: boolean, schema?: AnySchema): Promise<T | null> {\n\n let config: any;\n let response: any;\n\n try {\n response = await fetch(url);\n } catch (error: any) {\n const message = `Could not fetch config from '${ url }': ${ error.message }`;\n if (required) {\n this.showError(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n try {\n config = await response.json();\n } catch (error: any) {\n const message = `Could not parse config from '${ url }' to a json object: ${ error.message }`;\n if (required) {\n this.showError(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n\n if (schema) {\n try {\n config = await schema.validateAsync(config);\n } catch (error: any) {\n const message = `Config from '${ url }' is not valid: ${ error.message }`;\n if (required) {\n this.showError(message);\n throw new Error(message);\n } else {\n console.warn(message);\n return null;\n }\n }\n }\n\n return config;\n\n }\n\n private static LoadConfigDefaultFromUrlParam(param = 'config') {\n\n const queryString = window.location.search;\n const urlParams = new URLSearchParams(queryString);\n\n const configFromParams = {};\n\n for (const configParam of urlParams.getAll('config')) {\n\n try {\n const split = configParam.split(';');\n if (split.length === 2) {\n const keyPath = split[0];\n const value = split[1];\n SetObjectValue(configFromParams, keyPath, value);\n }\n } catch (e: any) {\n console.warn(`Parsing of url config param failed for '${ configParam }': ${ e.message }`);\n }\n\n }\n\n return configFromParams;\n\n }\n\n public static async SideLoad(\n url: string,\n propertyPath: string,\n required?: boolean,\n schema?: AnySchema,\n ): Promise<void> {\n\n if (!this.Config) {\n throw new Error('Config side load is only possible after the initial config load.');\n }\n\n const config = await this.loadConfig(url, required, schema);\n\n SetObjectValue(this.Config, propertyPath, config);\n\n console.debug(`Side loaded config for '${ propertyPath }' successful`, this.Config);\n\n }\n\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(\n path: string,\n defaultValue: T | undefined,\n config: Record<string, any>,\n ): T\n\n public static Get<T = any, K extends Record<string, any> = Record<string, any>>(\n path: string,\n defaultValue: NoInferType<T>,\n config: Record<string, any> = this.Config,\n ): T {\n if (!config) {\n throw new Error('config not loaded');\n }\n let configValue: any = config;\n if (typeof path !== 'string') {\n throw new Error('The config property path is not a string');\n }\n for (const fragment of (path as any).split('.')) {\n // eslint-disable-next-line no-prototype-builtins\n if (configValue.hasOwnProperty(fragment)) {\n configValue = configValue[fragment];\n } else {\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n console.warn(`Config with path '${ path }' not found`);\n return undefined as any;\n }\n }\n return configValue;\n }\n\n private static showError(message: string) {\n const hasUl = document.getElementById('rxap-config-error') !== null;\n const ul = document.getElementById('rxap-config-error') ?? document.createElement('ul');\n ul.id = 'rxap-config-error';\n ul.style.position = 'fixed';\n ul.style.bottom = '16px';\n ul.style.right = '16px';\n ul.style.backgroundColor = 'white';\n ul.style.padding = '32px';\n ul.style.zIndex = '99999999';\n ul.style.color = 'black';\n const li = document.createElement('li');\n li.innerText = message;\n ul.appendChild(li);\n if (!hasUl) {\n document.body.appendChild(ul);\n }\n }\n\n public setLocalConfig(config: Config): void {\n localStorage.setItem(ConfigService.LocalStorageKey, JSON.stringify(config));\n }\n\n public clearLocalConfig(): void {\n localStorage.removeItem(ConfigService.LocalStorageKey);\n }\n\n public get<T = any>(propertyPath: string): T | undefined;\n public get<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public get<T = any>(propertyPath: string, defaultValue?: T): T | undefined {\n return ConfigService.Get(propertyPath, defaultValue, this.config);\n }\n\n public getOrThrow<T = any>(propertyPath: string): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T;\n public getOrThrow<T = any>(propertyPath: string, defaultValue?: T): T {\n const value = ConfigService.Get(propertyPath, defaultValue, this.config);\n if (value === undefined) {\n throw new Error(`Could not find config in path '${ propertyPath }'`);\n }\n return value;\n }\n\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n firstValueFrom,\n Observable,\n} from 'rxjs';\nimport { HttpClient } from '@angular/common/http';\nimport {\n finalize,\n share,\n} from 'rxjs/operators';\n\n@Injectable({ providedIn: 'root' })\nexport class ConfigLoaderService {\n public readonly configs = new Map<string, any>();\n\n public readonly configLoading = new Map<string, Observable<any>>();\n\n constructor(\n @Inject(HttpClient)\n public readonly http: HttpClient,\n ) {\n }\n\n public async load$<T = any>(url: string): Promise<T> {\n if (this.configs.has(url)) {\n return this.configs.get(url);\n }\n\n if (this.configLoading.has(url)) {\n return this.configLoading.get(url)!.toPromise();\n }\n\n const loading$ = this.http.get<T>(url).pipe(\n finalize(() => this.configLoading.delete(url)),\n share(),\n );\n\n this.configLoading.set(url, loading$);\n\n return firstValueFrom(loading$);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAEa,WAAW,GAAG,IAAI,cAAc,CAAC,aAAa;;MC2B9C,aAAa,CAAA;aAEV,IAAM,CAAA,MAAA,GAAQ,IAAR,CAAa,EAAA;AAEjC;;;;AAIG;aACW,IAAQ,CAAA,QAAA,GAAQ,EAAR,CAAW,EAAA;AAEjC;;;AAGG;aACW,IAAU,CAAA,UAAA,GAAQ,EAAR,CAAW,EAAA;aAErB,IAAe,CAAA,eAAA,GAAG,0BAAH,CAA8B,EAAA;AAE3D;;AAEG;aACW,IA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rBtB;;AAEG;;;;"}
@@ -1,10 +1,16 @@
1
- import { NoInferType } from './types';
1
+ import { Environment } from '@rxap/environment';
2
2
  import { AnySchema } from 'joi';
3
+ import { NoInferType } from './types';
3
4
  import * as i0 from "@angular/core";
4
5
  export interface ConfigLoadOptions {
5
6
  fromUrlParam?: string | boolean;
6
7
  fromLocalStorage?: boolean;
7
8
  schema?: AnySchema;
9
+ url?: string | string[] | ((environment: Environment) => string | string[]);
10
+ /**
11
+ * static config values
12
+ */
13
+ static?: Record<string, any>;
8
14
  }
9
15
  export declare class ConfigService<Config extends Record<string, any> = Record<string, any>> {
10
16
  static Config: any;
@@ -20,10 +26,12 @@ export declare class ConfigService<Config extends Record<string, any> = Record<s
20
26
  */
21
27
  static Overwrites: any;
22
28
  static LocalStorageKey: string;
23
- static Urls: string[];
24
- private static loadConfig;
25
- private static showError;
26
- static SideLoad(url: string, propertyPath: string, required?: boolean, schema?: AnySchema): Promise<void>;
29
+ /**
30
+ * @deprecated instead use the url property of the ConfigLoadOptions
31
+ */
32
+ static Urls: never[];
33
+ readonly config: Config;
34
+ constructor(config?: any | null);
27
35
  /**
28
36
  * Used to load the app config from a remote resource.
29
37
  *
@@ -32,11 +40,12 @@ export declare class ConfigService<Config extends Record<string, any> = Record<s
32
40
  * .catch(err => console.error(err))
33
41
  *
34
42
  */
35
- static Load(options?: ConfigLoadOptions): Promise<void>;
43
+ static Load(options?: ConfigLoadOptions, environment?: Environment): Promise<void>;
44
+ private static loadConfig;
36
45
  private static LoadConfigDefaultFromUrlParam;
46
+ static SideLoad(url: string, propertyPath: string, required?: boolean, schema?: AnySchema): Promise<void>;
37
47
  static Get<T = any, K extends Record<string, any> = Record<string, any>>(path: string, defaultValue: T | undefined, config: Record<string, any>): T;
38
- readonly config: Config;
39
- constructor(config?: any | null);
48
+ private static showError;
40
49
  setLocalConfig(config: Config): void;
41
50
  clearLocalConfig(): void;
42
51
  get<T = any>(propertyPath: string): T | undefined;
package/package.json CHANGED
@@ -1,52 +1,59 @@
1
1
  {
2
2
  "name": "@rxap/config",
3
- "version": "16.0.0-dev.0",
4
- "private": false,
5
- "author": "Merzough Münker",
6
- "homepage": "https://gitlab.com/rxap/packages/libs/config",
7
- "repository": "git@gitlab.com:rxap/packages.git",
8
- "license": "MIT",
3
+ "version": "16.0.0-dev.10",
4
+ "dependencies": {
5
+ "joi": "^17.6.3",
6
+ "tslib": "2.5.3"
7
+ },
8
+ "sideEffects": false,
9
+ "peerDependencies": {
10
+ "@angular/common": "^16.1.4",
11
+ "@angular/core": "^16.1.4",
12
+ "@rxap/environment": "^16.0.0-dev.8",
13
+ "@rxap/utilities": "^16.0.0-dev.6",
14
+ "rxjs": "^7.8.0"
15
+ },
16
+ "description": "Simple config file manager for angular applications.",
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "directory": "../../../dist/packages/angular/config"
20
+ },
9
21
  "keywords": [
10
22
  "rxap",
23
+ "angular",
24
+ "ngx",
25
+ "packages",
11
26
  "config",
12
- "angular"
27
+ "angular-config"
13
28
  ],
29
+ "homepage": "https:/gitlab.com/rxap/packages/packages/angular/config",
14
30
  "bugs": {
15
31
  "url": "https://gitlab.com/rxap/packages/-/issues",
16
32
  "email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
17
33
  },
18
- "description": "Simple config file manager for angular applications.",
19
- "peerDependencies": {
20
- "@angular-devkit/schematics": "^15.0.3",
21
- "@angular/common": "^16.0.2",
22
- "@angular/core": "^16.0.2",
23
- "@angular/platform-browser-dynamic": "^16.0.2",
24
- "@rxap/utilities": "^16.0.0-dev.0",
25
- "joi": "^17.6.3",
26
- "reflect-metadata": "^0.1.13",
27
- "rxjs": "^6.6.0"
34
+ "license": "GPL-3.0-or-later",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://gitlab.com/rxap/packages.git",
38
+ "directory": "packages/angular/config"
39
+ },
40
+ "author": {
41
+ "name": "Merzough Münker",
42
+ "email": "mmuenker@digitaix.com"
28
43
  },
29
- "schematics": "./collection.json",
30
- "ng-update": {
31
- "migrations": "./migration.json",
44
+ "nx-migrations": {
32
45
  "packageGroup": [
33
- "@rxap/config",
34
- "@rxap/utilities"
46
+ {
47
+ "package": "@rxap/environment",
48
+ "version": "16.0.0-dev.8"
49
+ },
50
+ {
51
+ "package": "@rxap/utilities",
52
+ "version": "16.0.0-dev.6"
53
+ }
35
54
  ]
36
55
  },
37
- "publishConfig": {
38
- "directory": "../../dist/libs/config",
39
- "access": "public"
40
- },
41
- "ng-add": {
42
- "save": "dependencies"
43
- },
44
- "dependencies": {
45
- "@rxap/schematics-ts-morph": "^16.0.0-dev.0",
46
- "@rxap/schematics-utilities": "^16.0.0-dev.0",
47
- "ts-morph": "^13.0.3",
48
- "tslib": "^2.3.1"
49
- },
56
+ "gitHead": "3d49d0a2548a0c403ad55c564108b54ba734a677",
50
57
  "module": "fesm2022/rxap-config.mjs",
51
58
  "typings": "index.d.ts",
52
59
  "exports": {
@@ -58,7 +65,7 @@
58
65
  "esm2022": "./esm2022/rxap-config.mjs",
59
66
  "esm": "./esm2022/rxap-config.mjs",
60
67
  "default": "./fesm2022/rxap-config.mjs"
61
- }
62
- },
63
- "sideEffects": false
64
- }
68
+ },
69
+ "./theme": "./theme.css"
70
+ }
71
+ }
package/theme.css ADDED
@@ -0,0 +1 @@
1
+ .visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.block{display:block}.inline{display:inline}.table{display:table}.contents{display:contents}.hidden{display:none}.capitalize{text-transform:capitalize}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}
package/collection.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "schematics": {
3
- "ng-add": {
4
- "description": "Setup the package @rxap/config for the workspace.",
5
- "factory": "./src/schematics/ng-add/index",
6
- "schema": "./src/schematics/ng-add/schema.json"
7
- },
8
- "side-load": {
9
- "description": "Add a side load config to the project main file.",
10
- "factory": "./src/schematics/side-load/index",
11
- "schema": "./src/schematics/side-load/schema.json"
12
- }
13
- },
14
- "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json"
15
- }
package/migration.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "schematics": {},
3
- "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json"
4
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { NgAddSchema } from './schema';
3
- export default function (options: NgAddSchema): Rule;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const schematics_1 = require("@angular-devkit/schematics");
4
- const schematics_utilities_1 = require("@rxap/schematics-utilities");
5
- const ts_morph_1 = require("ts-morph");
6
- const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
7
- const path_1 = require("path");
8
- function default_1(options) {
9
- return (host) => {
10
- const rules = [
11
- (0, schematics_utilities_1.InstallPeerDependencies)()
12
- ];
13
- if (options.project) {
14
- const projectSourceRoot = (0, schematics_utilities_1.GetProjectSourceRoot)(host, options.project);
15
- const project = new ts_morph_1.Project({
16
- useInMemoryFileSystem: true,
17
- manipulationSettings: { quoteKind: ts_morph_1.QuoteKind.Single, indentationText: ts_morph_1.IndentationText.TwoSpaces }
18
- });
19
- (0, schematics_ts_morph_1.AddDir)(host.getDir(projectSourceRoot), project);
20
- const mainSourceFile = project.getSourceFile('/main.ts');
21
- if (!mainSourceFile) {
22
- throw new schematics_1.SchematicsException(`Could not find the main.ts source file in '[projectSourceRoot]/main.ts'`);
23
- }
24
- (0, schematics_ts_morph_1.AddToArray)(mainSourceFile, 'configSideLoad', 'Promise.resolve()', 'Promise<any>[]');
25
- (0, schematics_ts_morph_1.AddToArray)(mainSourceFile, 'setup', 'ConfigService.Load().then(() => Promise.all(configSideLoad))', 'Promise<any>[]');
26
- mainSourceFile.addImportDeclarations([
27
- {
28
- namedImports: ['ConfigService'],
29
- moduleSpecifier: '@rxap/config'
30
- }
31
- ]);
32
- rules.push((0, schematics_ts_morph_1.ApplyTsMorphProject)(project, projectSourceRoot));
33
- const configFilePath = (0, path_1.join)(projectSourceRoot, 'config.json');
34
- rules.push((0, schematics_utilities_1.UpdateAngularJson)(angular => {
35
- const p = angular.projects.get(options.project);
36
- if (p) {
37
- const buildTarget = p.targets.get('build');
38
- if (buildTarget) {
39
- if (!buildTarget.options.assets) {
40
- buildTarget.options.assets = [];
41
- }
42
- const assets = buildTarget.options.assets;
43
- if (!assets.includes(configFilePath)) {
44
- assets.push(configFilePath);
45
- }
46
- }
47
- }
48
- }));
49
- rules.push(tree => {
50
- if (!tree.exists(configFilePath)) {
51
- tree.create(configFilePath, '{}');
52
- }
53
- });
54
- }
55
- return (0, schematics_1.chain)(rules);
56
- };
57
- }
58
- exports.default = default_1;
59
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/config/src/schematics/ng-add/index.ts"],"names":[],"mappings":";;AAAA,2DAKoC;AACpC,qEAIoC;AAEpC,uCAIkB;AAClB,mEAImC;AACnC,+BAA4B;AAE5B,mBAAwB,OAAoB;IAC1C,OAAO,CAAC,IAAU,EAAE,EAAE;QAEpB,MAAM,KAAK,GAAW;YACpB,IAAA,8CAAuB,GAAE;SAC1B,CAAC;QAEF,IAAI,OAAO,CAAC,OAAO,EAAE;YAEnB,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACtE,MAAM,OAAO,GAAa,IAAI,kBAAO,CAAC;gBACpC,qBAAqB,EAAE,IAAI;gBAC3B,oBAAoB,EAAG,EAAE,SAAS,EAAE,oBAAS,CAAC,MAAM,EAAE,eAAe,EAAE,0BAAe,CAAC,SAAS,EAAE;aACnG,CAAC,CAAC;YACH,IAAA,4BAAM,EAAC,IAAI,CAAC,MAA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c,CAAC,CAAC;yBAC7B;qBACF;iBACF;YAEH,CAAC,CAAC,CAAC,CAAC;YAEJ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;oBAChC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;iBACnC;YACH,CAAC,CAAC,CAAC;SAEJ;QAED,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC;IAEtB,CAAC,CAAC;AACJ,CAAC;AA7ED,4BA6EC"}
@@ -1,15 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "config-ng-add",
4
- "type": "object",
5
- "properties": {
6
- "project": {
7
- "type": "string",
8
- "description": "The project where the environment feature should be added",
9
- "$default": {
10
- "$source": "projectName"
11
- }
12
- }
13
- },
14
- "required": []
15
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { SideLoadSchema } from './schema';
3
- export default function (options: SideLoadSchema): Rule;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const ts_morph_1 = require("ts-morph");
6
- const schematics_utilities_1 = require("@rxap/schematics-utilities");
7
- const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
8
- const path_1 = require("path");
9
- function default_1(options) {
10
- return (host) => tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- var _a;
12
- const project = new ts_morph_1.Project({
13
- manipulationSettings: {
14
- indentationText: ts_morph_1.IndentationText.TwoSpaces
15
- },
16
- useInMemoryFileSystem: true
17
- });
18
- const projectSourceRoot = (0, schematics_utilities_1.GetProjectSourceRoot)(host, options.project);
19
- const mainSourceFile = project.createSourceFile('main.ts', host.read((0, path_1.join)(projectSourceRoot, 'main.ts')).toString('utf-8'));
20
- (0, schematics_ts_morph_1.AddToArray)(mainSourceFile, 'configSideLoad', `ConfigService.SideLoad('${options.url}', '${options.propertyPath}', ${(_a = options.required) !== null && _a !== void 0 ? _a : false})`, 'Promise<any>[]');
21
- return (0, schematics_1.chain)([
22
- (0, schematics_ts_morph_1.ApplyTsMorphProject)(project, projectSourceRoot)
23
- ]);
24
- });
25
- }
26
- exports.default = default_1;
27
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/config/src/schematics/side-load/index.ts"],"names":[],"mappings":";;;AAAA,2DAIoC;AAEpC,uCAGkB;AAClB,qEAAkE;AAClE,mEAGmC;AACnC,+BAA4B;AAE5B,mBAAwB,OAAuB;IAE7C,OAAO,CAAO,IAAU,EAAE,EAAE;;QAE1B,MAAM,OAAO,GAAG,IAAI,kBAAO,CAAC;YAC1B,oBAAoB,EAAG;gBACrB,eAAe,EAAE,0BAAe,CAAC,SAAS;aAC3C;YACD,qBAAqB,EAAE,IAAI;SAC5B,CAAC,CAAC;QAEH,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAEtE,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAC7C,SAAS,EACT,IAAI,CAAC,IAAI,CAAC,IAAA,WAAI,EAAC,iBAAiB,EAAE,SAAS,CAAC,CAC1C,CAAC,QAAQ,CAAC,OAAO,CAAC,CACrB,CAAC;QAEF,IAAA,gCAAU,EACR,cAAc,EACd,gBAAgB,EAChB,2BAA2B,OAAO,CAAC,GAAG,OAAO,OAAO,CAAC,YAAY,MAAM,MAAA,OAAO,CAAC,QAAQ,mCAAI,KAAK,GAAG,EACnG,gBAAgB,CACjB,CAAC;QAEF,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,yCAAmB,EAAC,OAAO,EAAE,iBAAiB,CAAC;SAChD,CAAC,CAAC;IAEL,CAAC,CAAA,CAAC;AAEJ,CAAC;AAhCD,4BAgCC"}