@kephas/ngx-core
Version:
Provides integration capabilities with Angular 13+.
1 lines • 67.1 kB
Source Map (JSON)
{"version":3,"file":"kephas-ngx-core.mjs","sources":["../../../../projects/kephas/ngx-core/src/lib/angularTarget.ts","../../../../projects/kephas/ngx-core/src/lib/components/widgetBase.ts","../../../../projects/kephas/ngx-core/src/lib/components/valueEditorBase.ts","../../../../projects/kephas/ngx-core/src/lib/queries/commandQuery.ts","../../../../projects/kephas/ngx-core/src/lib/queries/messageQuery.ts","../../../../projects/kephas/ngx-core/src/lib/services/http/browserXhrFactory.ts","../../../../projects/kephas/ngx-core/src/lib/services/http/httpInterceptingHandler.ts","../../../../projects/kephas/ngx-core/src/lib/services/appSettings.ts","../../../../projects/kephas/ngx-core/src/lib/services/httpCommandProcessorClient.ts","../../../../projects/kephas/ngx-core/src/lib/services/httpMessageProcessorClient.ts","../../../../projects/kephas/ngx-core/src/lib/services/configuration.ts","../../../../projects/kephas/ngx-core/src/lib/rootProvidersRegistry.ts","../../../../projects/kephas/ngx-core/src/lib/kephas.module.ts","../../../../projects/kephas/ngx-core/src/public-api.ts","../../../../projects/kephas/ngx-core/src/kephas-ngx-core.ts"],"sourcesContent":["export const NgTarget: string = 'ng';\r\n","import {\r\n ElementRef, ViewContainerRef, ChangeDetectorRef,\r\n Input, SimpleChanges,\r\n OnInit, OnChanges, AfterViewInit,\r\n Type, Provider, forwardRef, QueryList, ViewChildren, OnDestroy, Component\r\n} from '@angular/core';\r\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\r\nimport { Logger } from '@kephas/core';\r\nimport { NotificationService } from '@kephas/ui';\r\n\r\n/**\r\n * Provides base functionality for a widget.\r\n *\r\n * @export\r\n * @class WidgetBase\r\n */\r\n@Component({\r\n template: ''\r\n})\r\nexport abstract class WidgetBase implements OnInit, AfterViewInit, OnChanges, OnDestroy {\r\n /**\r\n * Gets the logger.\r\n *\r\n * @protected\r\n * @type {Logger}\r\n * @memberof ValueEditorBase\r\n */\r\n protected readonly logger: Logger;\r\n\r\n /**\r\n * Gets the notification service.\r\n *\r\n * @protected\r\n * @type {NotificationService}\r\n * @memberof ValueEditorBase\r\n */\r\n protected readonly notification: NotificationService;\r\n\r\n /**\r\n * Gets the change detector service.\r\n *\r\n * @protected\r\n * @type {ChangeDetectorRef}\r\n * @memberof ValueEditorBase\r\n */\r\n protected readonly changeDetector: ChangeDetectorRef;\r\n\r\n private _isVisible = true;\r\n private _readonly = false;\r\n private _childWidgets?: QueryList<WidgetBase>;\r\n\r\n /**\r\n * Creates an instance of WidgetBase.\r\n * @param {ElementRef} elementRef The element reference.\r\n * @param {ViewContainerRef} viewContainerRef The view container reference.\r\n * @memberof WidgetBase\r\n */\r\n constructor(\r\n public readonly elementRef: ElementRef,\r\n public readonly viewContainerRef: ViewContainerRef,\r\n ) {\r\n const injector = viewContainerRef.injector;\r\n this.logger = injector.get(Logger);\r\n this.notification = injector.get(NotificationService);\r\n this.changeDetector = injector.get(ChangeDetectorRef);\r\n }\r\n\r\n /**\r\n * Gets or sets the child editors query.\r\n *\r\n * @readonly\r\n * @type {QueryList<EditorBase<any>>}\r\n * @memberof EditorBase\r\n */\r\n @ViewChildren(WidgetBase)\r\n get childWidgets(): QueryList<WidgetBase> {\r\n return this._childWidgets!;\r\n }\r\n set childWidgets(value: QueryList<WidgetBase>) {\r\n if (this._childWidgets === value) {\r\n return;\r\n }\r\n\r\n const oldValue = this._childWidgets;\r\n this._childWidgets = value;\r\n this.onChildWidgetsChanged(oldValue, value);\r\n }\r\n\r\n /**\r\n * Gets or sets a value indicating whether the widget is visible.\r\n *\r\n * @readonly\r\n * @type {boolean}\r\n * @memberof WidgetBase\r\n */\r\n @Input()\r\n get isVisible(): boolean {\r\n return this._isVisible;\r\n }\r\n set isVisible(value: boolean) {\r\n if (this._isVisible === value) {\r\n return;\r\n }\r\n\r\n this._isVisible = value;\r\n }\r\n\r\n /**\r\n * Gets or sets a value indicating whether the editor allows edits or not.\r\n *\r\n * @readonly\r\n * @type {boolean}\r\n * @memberof EditorBase\r\n */\r\n @Input()\r\n get readonly(): boolean {\r\n return this._readonly;\r\n }\r\n set readonly(value: boolean) {\r\n if (this._readonly === value) {\r\n return;\r\n }\r\n\r\n const oldValue = this._readonly;\r\n this._readonly = value;\r\n this.onReadOnlyChanged(oldValue, value);\r\n }\r\n\r\n /**\r\n * A callback method that is invoked immediately after the\r\n * default change detector has checked the directive's\r\n * data-bound properties for the first time,\r\n * and before any of the view or content children have been checked.\r\n * It is invoked only once when the directive is instantiated.\r\n *\r\n * @memberof WidgetBase\r\n */\r\n ngOnInit(): void {\r\n }\r\n\r\n /**\r\n * A callback method that is invoked immediately after\r\n * Angular has completed initialization of a component's view.\r\n * It is invoked only once when the view is instantiated.\r\n *\r\n * @memberof WidgetBase\r\n */\r\n ngAfterViewInit(): void {\r\n }\r\n\r\n /**\r\n * A callback method that is invoked immediately after the\r\n * default change detector has checked data-bound properties\r\n * if at least one has changed, and before the view and content\r\n * children are checked.\r\n *\r\n * @param changes The changed properties.\r\n * @memberof WidgetBase\r\n */\r\n ngOnChanges(changes: SimpleChanges): void {\r\n }\r\n\r\n /**\r\n * A callback method that performs custom clean-up, invoked immediately\r\n * after a directive, pipe, or service instance is destroyed.\r\n */\r\n ngOnDestroy(): void {\r\n }\r\n\r\n /**\r\n * When overridden in a derived class, this method is called when the read only state changes.\r\n *\r\n * @protected\r\n * @param {boolean} oldValue The old value.\r\n * @param {boolean} newValue The new value.\r\n *\r\n * @memberof WidgetBase\r\n */\r\n protected onReadOnlyChanged(oldValue: boolean, newValue: boolean): void {\r\n }\r\n\r\n /**\r\n * When overridden in a derived class, this method is called when the child widgets query changed.\r\n *\r\n * @protected\r\n * @param {QueryList<EditorBase<any>>} oldValue The old query.\r\n * @param {QueryList<EditorBase<any>>} newValue The new query.\r\n *\r\n * @memberof EditorBase\r\n */\r\n protected onChildWidgetsChanged(oldValue?: QueryList<WidgetBase>, newValue?: QueryList<WidgetBase>): void {\r\n }\r\n}\r\n\r\n/**\r\n * This function provides the component as a WidgetBase,\r\n * to be able to import it over this base class instead of over its own class.\r\n *\r\n * For example, use it as @ViewChild(WidgetBase) or @ViewChildren(WidgetBase).\r\n *\r\n * @export\r\n * @param {Type<any>} componentType The component type.\r\n * @returns {Provider} The provider.\r\n */\r\nexport function provideWidget(componentType: Type<any>): Provider {\r\n return {\r\n provide: WidgetBase,\r\n useExisting: forwardRef(() => componentType)\r\n };\r\n}\r\n\r\n/**\r\n * This function provides the component as a NG_VALUE_ACCESSOR.\r\n * Thus, it is possible to bind it like this:\r\n * <my-component [(ngModel)]=\"boundProperty\"></my-component>\r\n *\r\n * @export\r\n * @param {Type<any>} componentType The component type.\r\n * @returns {Provider} The provider.\r\n */\r\nexport function provideValueAccessor(componentType: Type<any>): Provider {\r\n return {\r\n provide: NG_VALUE_ACCESSOR,\r\n useExisting: forwardRef(() => componentType),\r\n multi: true\r\n };\r\n}\r\n","import {\r\n Input, ElementRef, ViewContainerRef, Component\r\n} from '@angular/core';\r\nimport { ControlValueAccessor } from '@angular/forms';\r\nimport { WidgetBase } from './widgetBase';\r\n\r\n/**\r\n * Provides a base implementation for value editors.\r\n *\r\n * @export\r\n * @abstract\r\n * @class ValueEditorBase\r\n * @implements {OnInit}\r\n * @implements {AfterViewInit}\r\n * @implements {ControlValueAccessor}\r\n * @template TValue The value type.\r\n */\r\n@Component({\r\n template: ''\r\n})\r\nexport abstract class ValueEditorBase<TValue>\r\n extends WidgetBase\r\n implements ControlValueAccessor {\r\n\r\n /**\r\n * Gets or sets the value description.\r\n *\r\n * @type {string}\r\n * @memberof ValueEditorBase\r\n */\r\n public description?: string;\r\n\r\n /**\r\n * Gets or sets the value prompt.\r\n *\r\n * @type {string}\r\n * @memberof ValueEditorBase\r\n */\r\n public prompt?: string;\r\n\r\n /**\r\n * Gets or sets a value indicating whether the value is changed from the change event.\r\n *\r\n * @protected\r\n * @memberof ValueEditorBase\r\n */\r\n protected valueChangeFromEvent = false;\r\n\r\n /**\r\n * Gets or sets a value indicating whether the value is changed from the value property.\r\n *\r\n * @protected\r\n * @memberof ValueEditorBase\r\n */\r\n protected valueChangeFromValue = false;\r\n\r\n private _valueBeforeChange?: TValue;\r\n\r\n /**\r\n * Creates an instance of ValueEditorBase.\r\n *\r\n * @param {ElementRef} elementRef The element reference.\r\n * @param {ViewContainerRef} viewContainerRef The view container reference.\r\n * @memberof ValueEditorBase\r\n */\r\n constructor(\r\n elementRef: ElementRef,\r\n viewContainerRef: ViewContainerRef,\r\n ) {\r\n super(elementRef, viewContainerRef);\r\n }\r\n\r\n /**\r\n * Gets or sets the value to edit.\r\n *\r\n * @type {TValue}\r\n * @memberOf ValueEditorBase\r\n */\r\n @Input()\r\n get value(): TValue {\r\n return this.getEditorValue();\r\n }\r\n set value(value: TValue) {\r\n if (this._valueBeforeChange === value) {\r\n return;\r\n }\r\n\r\n this.updateEditor(value);\r\n }\r\n\r\n /**\r\n * Updates the underlying editor with the provided value.\r\n *\r\n * @protected\r\n * @param {TValue} value\r\n * @returns {boolean}\r\n * @memberof ValueEditorBase\r\n */\r\n protected updateEditor(value: TValue): boolean {\r\n if (this.valueChangeFromValue) {\r\n return false;\r\n }\r\n\r\n const prevValueChangeFromValue = this.valueChangeFromValue;\r\n this.valueChangeFromValue = true;\r\n\r\n try {\r\n const oldValue = this._valueBeforeChange;\r\n this.onValueChanging(oldValue, value);\r\n this._valueBeforeChange = value;\r\n\r\n if (!this.valueChangeFromEvent) {\r\n this.setEditorValue(value);\r\n value = this.getEditorValue();\r\n }\r\n\r\n this.onValueChanged(oldValue, value);\r\n } catch (error) {\r\n this.logger.error(error as Error, 'Error while updating the editor.');\r\n throw error;\r\n } finally {\r\n this.valueChangeFromValue = prevValueChangeFromValue;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Overridable method invoked when the value is about to be changed.\r\n *\r\n * @protected\r\n * @param {(TValue | undefined)} oldValue The old value.\r\n * @param {(TValue | undefined)} newValue The new value.\r\n * @memberof ValueEditorBase\r\n */\r\n protected onValueChanging(oldValue: TValue | undefined, newValue: TValue | undefined): void {\r\n }\r\n\r\n /**\r\n * Overridable method invoked after the value was changed.\r\n *\r\n * @protected\r\n * @param {(TValue | undefined)} oldValue The old value.\r\n * @param {(TValue | undefined)} newValue The new value.\r\n * @memberof ValueEditorBase\r\n */\r\n protected onValueChanged(oldValue: TValue | undefined, newValue: TValue | undefined): void {\r\n this._onChange(newValue);\r\n }\r\n\r\n /**\r\n * Callback invoked from the change event of the underlying editor.\r\n *\r\n * @protected\r\n * @param {*} e\r\n * @returns\r\n * @memberof PropertyEditorComponent\r\n */\r\n protected onEditorChange(e: any) {\r\n if (this.valueChangeFromValue) {\r\n return;\r\n }\r\n\r\n const prevValueChangeFromEvent = this.valueChangeFromEvent;\r\n this.valueChangeFromEvent = true;\r\n try {\r\n const newValue = this.getEditorValueOnChange(e);\r\n this.value = newValue;\r\n } catch (error) {\r\n this.notification.notifyError(error);\r\n } finally {\r\n this.valueChangeFromEvent = prevValueChangeFromEvent;\r\n }\r\n }\r\n\r\n /**\r\n * Sets the value of the underlying editor.\r\n *\r\n * @protected\r\n * @param {TValue} value The value to be set.\r\n * @memberof ValueEditorBase\r\n */\r\n protected abstract setEditorValue(value: TValue): void;\r\n\r\n /**\r\n * Gets the underlying editor's value.\r\n *\r\n * @protected\r\n * @returns {TValue} The widget value.\r\n * @memberof ValueEditorBase\r\n */\r\n protected abstract getEditorValue(): TValue;\r\n\r\n /**\r\n * Gets the underlying editor's value upon change.\r\n *\r\n * @protected\r\n * @param {*} e The change event arguments.\r\n * @returns {TValue} The widget value.\r\n * @memberof ValueEditorBase\r\n */\r\n protected getEditorValueOnChange(e: any): TValue {\r\n return this.getEditorValue();\r\n }\r\n\r\n\r\n /**\r\n * Write a new value to the element.\r\n *\r\n * @param {*} obj The new value.\r\n *\r\n * @memberOf PropertyEditorComponent\r\n */\r\n writeValue(obj: any): void {\r\n this.value = obj;\r\n }\r\n\r\n /**\r\n * Set the function to be called when the control receives a change event.\r\n *\r\n * @param {*} fn The callback function.\r\n *\r\n * @memberOf PropertyEditorComponent\r\n */\r\n registerOnChange(fn: any): void {\r\n this._onChange = fn;\r\n }\r\n\r\n /**\r\n * Set the function to be called when the control receives a touch event.\r\n *\r\n * @param {*} fn The callback function.\r\n *\r\n * @memberOf PropertyEditorComponent\r\n */\r\n registerOnTouched(fn: any): void {\r\n this._onTouched = fn;\r\n }\r\n\r\n /**\r\n * This function is called when the control status changes to or from \"DISABLED\".\r\n * Depending on the value, it will enable or disable the appropriate DOM element.\r\n *\r\n * @param {boolean} isDisabled True if the state is disabled.\r\n *\r\n * @memberOf PropertyEditorComponent\r\n */\r\n setDisabledState(isDisabled: boolean): void {\r\n }\r\n\r\n private _onChange = (_: any) => {\r\n // The implementation will get overwritten by Angular in RegisterOnChange.\r\n };\r\n\r\n private _onTouched = () => {\r\n // The implementation will get overwritten by Angular in RegisterOnTouched.\r\n };\r\n}\r\n","import { Observable, BehaviorSubject, of, Subscription } from 'rxjs';\r\nimport { catchError, finalize, map, tap } from 'rxjs/operators';\r\nimport { CommandProcessorClient } from '@kephas/commands';\r\nimport { Expando } from '@kephas/core';\r\n\r\nexport interface CommandState<TArgs> extends Expando {\r\n command?: string;\r\n args?: TArgs;\r\n}\r\n\r\n/**\r\n * Observable based on a command query.\r\n *\r\n * @export\r\n * @abstract\r\n * @class CommandQuery\r\n * @extends {BehaviorSubject<TValue>}\r\n * @template TArgs\r\n * @template TResponseMessage\r\n * @template TValue\r\n */\r\nexport abstract class CommandQuery<TArgs, TResponseMessage, TValue> extends BehaviorSubject<TValue> {\r\n #loading = false;\r\n #lastError: any;\r\n\r\n public args?: TArgs;\r\n\r\n /**\r\n * Creates an instance of CommandQuery.\r\n * @param {CommandProcessorClient} processor\r\n * @param {string} command\r\n * @param {(r: TResponseMessage, state?: CommandState<TArgs>) => TValue} [resultMap]\r\n * @param {(args?: TArgs, state?: CommandState<TArgs>) => TArgs} [argsMap]\r\n * @param {TValue} [emptyResult={} as TValue]\r\n * @memberof CommandQuery\r\n */\r\n constructor(\r\n protected readonly processor: CommandProcessorClient,\r\n protected command: string,\r\n protected resultMap?: (r: TResponseMessage, state?: CommandState<TArgs>) => TValue,\r\n protected argsMap?: (args?: TArgs, state?: CommandState<TArgs>) => TArgs,\r\n protected emptyResult: TValue = {} as TValue) {\r\n super(null!);\r\n this.args ??= {} as TArgs;\r\n }\r\n\r\n /**\r\n * Gets a value indicating whether the query is executing.\r\n *\r\n * @readonly\r\n * @type {boolean}\r\n * @memberof CommandQuery\r\n */\r\n get loading(): boolean {\r\n return this.#loading;\r\n }\r\n\r\n /**\r\n * Gets the last error executing this query.\r\n *\r\n * @readonly\r\n * @type {*}\r\n * @memberof CommandQuery\r\n */\r\n get lastError(): any {\r\n return this.#lastError;\r\n }\r\n\r\n /**\r\n * Executes the command asynchronously.\r\n *\r\n * @param {CommandState<TArgs>} [state]\r\n * @memberof CommandQuery\r\n */\r\n public execute(state?: CommandState<TArgs>): void {\r\n // no need to unsubscribe, as this is an auto-complete observable.\r\n this.fetch(state?.command ?? this.command, state?.args ?? this.args!, state)\r\n .subscribe(x => super.next(x));\r\n }\r\n\r\n protected fetch(command: string, args?: TArgs, state?: CommandState<TArgs>): Observable<TValue> {\r\n this.#loading = true;\r\n\r\n args = this.mapArgs(args, state);\r\n\r\n return this.processor\r\n .process(command, args!)\r\n .pipe(\r\n map(response => {\r\n this.#lastError = undefined;\r\n return this.mapResponse(response as unknown as TResponseMessage, state);\r\n }),\r\n finalize(() => this.#loading = false),\r\n catchError(err => {\r\n this.#lastError = err;\r\n return of(this.emptyResult);\r\n })\r\n );\r\n }\r\n\r\n protected mapResponse(response: TResponseMessage, state?: CommandState<TArgs>): TValue {\r\n return this.resultMap ? this.resultMap(response, state) : response as unknown as TValue;\r\n }\r\n\r\n protected mapArgs(args?: TArgs, state?: CommandState<TArgs>): TArgs | undefined {\r\n return this.argsMap ? this.argsMap(args, state) : args;\r\n }\r\n}\r\n","import { Observable, BehaviorSubject, of, Subscription } from 'rxjs';\r\nimport { catchError, finalize, map, tap } from 'rxjs/operators';\r\nimport { MessageProcessorClient, ResponseMessage } from '@kephas/messaging';\r\nimport { Expando, Type } from '@kephas/core';\r\n\r\nexport interface MessageState<TMessage> extends Expando {\r\n message?: TMessage;\r\n}\r\n\r\n/**\r\n * Observable based on a message query.\r\n *\r\n * @export\r\n * @abstract\r\n * @class MessageQuery\r\n * @extends {BehaviorSubject<TValue>}\r\n * @template TMessage\r\n * @template TResponseMessage\r\n * @template TValue\r\n */\r\nexport abstract class MessageQuery<TMessage, TResponseMessage extends ResponseMessage, TValue> extends BehaviorSubject<TValue> {\r\n #loading = false;\r\n #lastError: any;\r\n\r\n /**\r\n * Creates an instance of MessageQuery.\r\n * @param {MessageProcessorClient} processor\r\n * @param {(r: TResponseMessage, state?: MessageState<TMessage>) => TValue} [resultMap]\r\n * @param {(m: TMessage, state?: MessageState<TMessage>) => TMessage} [messageMap]\r\n * @param {TValue} [emptyResult={} as TValue]\r\n * @memberof MessageQuery\r\n */\r\n constructor(\r\n protected readonly processor: MessageProcessorClient,\r\n protected resultMap?: (r: TResponseMessage, state?: MessageState<TMessage>) => TValue,\r\n protected messageMap?: (m: TMessage, state?: MessageState<TMessage>) => TMessage,\r\n protected emptyResult: TValue = {} as TValue) {\r\n super(null!);\r\n }\r\n\r\n /**\r\n * Gets a value indicating whether the query is executing.\r\n *\r\n * @readonly\r\n * @type {boolean}\r\n * @memberof CommandQuery\r\n */\r\n get loading(): boolean {\r\n return this.#loading;\r\n }\r\n\r\n /**\r\n * Gets the last error executing this query.\r\n *\r\n * @readonly\r\n * @type {*}\r\n * @memberof CommandQuery\r\n */\r\n get lastError(): any {\r\n return this.#lastError;\r\n }\r\n\r\n public execute(state?: MessageState<TMessage>): void {\r\n // no need to unsubscribe, as this is an auto-complete observable.\r\n this.fetch(state?.message, state)\r\n .subscribe(x => super.next(x));\r\n }\r\n\r\n protected fetch(message: any, state?: MessageState<TMessage>): Observable<TValue> {\r\n this.#loading = true;\r\n\r\n message = this.mapMessage(message, state);\r\n\r\n return this.processor\r\n .process(message)\r\n .pipe(\r\n map(response => {\r\n this.#lastError = undefined;\r\n return this.mapResponse(response as unknown as TResponseMessage, state);\r\n }),\r\n finalize(() => this.#loading = false),\r\n catchError(err => {\r\n this.#lastError = err;\r\n return of(this.emptyResult);\r\n })\r\n );\r\n }\r\n\r\n protected mapResponse(response: TResponseMessage, state?: MessageState<TMessage>): TValue {\r\n return this.resultMap ? this.resultMap(response, state) : response as unknown as TValue;\r\n }\r\n\r\n protected mapMessage(message: TMessage, state?: MessageState<TMessage>): TMessage {\r\n return this.messageMap ? this.messageMap(message, state) : message;\r\n }\r\n}\r\n","import { XhrFactory } from \"@angular/common\";\r\n\r\n/**\r\n * Browser implementation for an `XhrFactory`.\r\n *\r\n * @export\r\n * @class BrowserXhrFactory\r\n * @implements {XhrFactory}\r\n */\r\n export class BrowserXhrFactory implements XhrFactory {\r\n build(): XMLHttpRequest {\r\n return new XMLHttpRequest();\r\n }\r\n}\r\n","import { HttpHandler, HttpBackend, HttpRequest, HttpEvent, HTTP_INTERCEPTORS, HttpInterceptor } from '@angular/common/http';\r\nimport { Observable } from 'rxjs';\r\nimport { Injector, Injectable } from '@angular/core';\r\n\r\n/**\r\n* `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`.\r\n*\r\n*/\r\nexport class HttpInterceptorForwarder implements HttpHandler {\r\n constructor(private next: HttpHandler, private interceptor: HttpInterceptor) {\r\n }\r\n\r\n handle(req: HttpRequest<any>): Observable<HttpEvent<any>> {\r\n return this.interceptor.intercept(req, this.next);\r\n }\r\n}\r\n\r\n/**\r\n* An injectable `HttpHandler` that applies multiple interceptors\r\n* to a request before passing it to the given `HttpBackend`.\r\n*\r\n* The interceptors are loaded lazily from the injector, to allow\r\n* interceptors to themselves inject classes depending indirectly\r\n* on `HttpInterceptingHandler` itself.\r\n* @see `HttpInterceptor`\r\n*/\r\n\r\n@Injectable()\r\nexport class HttpInterceptingHandler implements HttpHandler {\r\n private chain: HttpHandler | null = null;\r\n\r\n /**\r\n * Creates an instance of HttpInterceptingHandler.\r\n * @param {HttpBackend} backend\r\n * @param {Injector} injector\r\n * @memberof HttpInterceptingHandler\r\n */\r\n constructor(private backend: HttpBackend, private injector: Injector) {\r\n }\r\n\r\n handle(req: HttpRequest<any>): Observable<HttpEvent<any>> {\r\n if (this.chain === null) {\r\n const interceptors = this.injector.get(HTTP_INTERCEPTORS, []);\r\n this.chain = interceptors.reduceRight(\r\n (next, interceptor) => new HttpInterceptorForwarder(next, interceptor), this.backend);\r\n }\r\n return this.chain.handle(req);\r\n }\r\n}\r\n","import {\r\n SingletonAppServiceContract, AppService, Priority, Expando\r\n} from '@kephas/core';\r\n\r\n/**\r\n * Gets the application settings.\r\n *\r\n * @export\r\n * @class AppSettings\r\n */\r\n@AppService({ overridePriority: Priority.Low })\r\n@SingletonAppServiceContract()\r\nexport class AppSettings implements Expando {\r\n\r\n /**\r\n * Gets the base URL of the application.\r\n *\r\n * @readonly\r\n * @type {string}\r\n * @memberof AppSettings\r\n */\r\n get baseUrl(): string {\r\n const baseQuery = document.getElementsByTagName('base');\r\n const baseElement = baseQuery && baseQuery[0];\r\n return (baseElement && baseElement.href) || document.baseURI || '/';\r\n }\r\n\r\n /**\r\n * Gets the base API URL of the application.\r\n *\r\n * @readonly\r\n * @type {string}\r\n * @memberof AppSettings\r\n */\r\n get baseApiUrl(): string {\r\n return `${this.baseUrl}api/`;\r\n }\r\n}\r\n","import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';\r\nimport {\r\n LogLevel, AppService,\r\n Priority, Logger, Expando\r\n} from '@kephas/core';\r\nimport {\r\n CommandProcessorClient, CommandClientContext, CommandResponse, CommandError\r\n} from '@kephas/commands';\r\nimport { NotificationService } from '@kephas/ui';\r\nimport { Observable, ObservableInput } from 'rxjs';\r\nimport { retry, map, catchError } from 'rxjs/operators';\r\nimport { AppSettings } from './appSettings';\r\n\r\n/**\r\n * Provides proxied command execution over HTTP.\r\n *\r\n * @export\r\n * @class HttpCommandProcessorClient\r\n */\r\n@AppService({ overridePriority: Priority.Low })\r\nexport class HttpCommandProcessorClient extends CommandProcessorClient {\r\n\r\n /**\r\n * Gets or sets the base route for the command execution.\r\n *\r\n * @protected\r\n * @type {string}\r\n * @memberof CommandProcessor\r\n */\r\n protected baseRoute = 'api/cmd/';\r\n\r\n /**\r\n * Initializes a new instance of the CommandProcessor class.\r\n * @param {NotificationService} notification The notification service.\r\n * @param {HttpClient} http The HTTP client.\r\n * @param {AppSettings} appSettings The application settings.\r\n */\r\n constructor(\r\n protected appSettings: AppSettings,\r\n protected http: HttpClient,\r\n protected notification: NotificationService,\r\n protected logger: Logger) {\r\n super();\r\n }\r\n\r\n /**\r\n * Processes the command asynchronously.\r\n * @tparam T The command response type.\r\n * @param {string} command The command.\r\n * @param {{}} [args] Optional. The arguments.\r\n * @param {CommandClientContext} [options] Optional. Options controlling the command processing.\r\n * @returns {Observable{T}} An observable over the result.\r\n */\r\n public process<T extends CommandResponse>(command: string, args?: {}, options?: CommandClientContext): Observable<T> {\r\n const url = this.getHttpGetUrl(command, args, options);\r\n let obs = this.http.get<T>(url, this.getHttpGetOptions(command, args, options));\r\n if (options && options.retries) {\r\n obs = obs.pipe(\r\n retry(options.retries),\r\n map(response => this._processResponse(response, options)),\r\n catchError(error => this._processError<T>(error, options)));\r\n }\r\n else {\r\n obs = obs.pipe(\r\n map(response => this._processResponse(response, options)),\r\n catchError(error => this._processError<T>(error, options)));\r\n }\r\n\r\n return obs;\r\n }\r\n\r\n /**\r\n * Gets the HTTP GET URL.\r\n *\r\n * @protected\r\n * @param {string} command The command.\r\n * @param {{}} [args] Optional. The arguments.\r\n * @param {CommandClientContext} [options] Optional. Options controlling the command processing.\r\n * @returns {string} The HTTP GET URL.\r\n * @memberof CommandProcessor\r\n */\r\n protected getHttpGetUrl(command: string, args?: {}, options?: CommandClientContext): string {\r\n let baseUrl = this.appSettings.baseUrl;\r\n if (!baseUrl.endsWith('/')) {\r\n baseUrl = baseUrl + '/';\r\n }\r\n\r\n return `${baseUrl}${this.baseRoute}${command}`;\r\n }\r\n\r\n /**\r\n * Gets the command GET parameters.\r\n *\r\n * @protected\r\n * @param {{}} [args]\r\n * @param {CommandClientContext} [options]\r\n * @return {*} {HttpParams}\r\n * @memberof HttpCommandProcessorClient\r\n */\r\n protected getHttpGetParams(args?: {}, options?: CommandClientContext): HttpParams | {\r\n [param: string]: string | string[];\r\n } {\r\n let params: Expando = {};\r\n if (args) {\r\n Object.keys(args)\r\n .forEach(key => params[key] = this._getParamValue((args as Expando)[key]));\r\n }\r\n\r\n return params;\r\n }\r\n\r\n /**\r\n * Gets the HTTP GET options. By default it does not return any options.\r\n *\r\n * @protected\r\n * @param {string} command The command.\r\n * @param {{}} [args] Optional. The arguments.\r\n * @param {CommandClientContext} [options] Optional. Options controlling the command processing.\r\n * @returns {({\r\n * headers?: HttpHeaders | {\r\n * [header: string]: string | string[];\r\n * };\r\n * observe?: 'body';\r\n * params?: HttpParams | {\r\n * [param: string]: string | string[];\r\n * };\r\n * reportProgress?: boolean;\r\n * responseType?: 'json';\r\n * withCredentials?: boolean;\r\n * } | undefined)} The options or undefined.\r\n * @memberof CommandProcessor\r\n */\r\n protected getHttpGetOptions(command: string, args?: {}, options?: CommandClientContext): {\r\n headers?: HttpHeaders | {\r\n [header: string]: string | string[];\r\n };\r\n observe?: 'body';\r\n params?: HttpParams | {\r\n [param: string]: string | string[];\r\n };\r\n reportProgress?: boolean;\r\n responseType?: 'json';\r\n withCredentials?: boolean;\r\n } | undefined {\r\n return {\r\n params: this.getHttpGetParams(args, options),\r\n };\r\n }\r\n\r\n private _processResponse<T extends CommandResponse>(response: T, options?: CommandClientContext): T {\r\n if (typeof response.severity === 'string') {\r\n response.severity = (LogLevel as Expando)[response.severity as string];\r\n }\r\n\r\n if (response.severity <= LogLevel.Error) {\r\n throw new CommandError(response.message!, response);\r\n }\r\n\r\n if (response.severity === LogLevel.Warning) {\r\n this.logger.log(response.severity, null, response.message!);\r\n if (!(options && (options.notifyWarnings === undefined || options.notifyWarnings))) {\r\n this.notification.notifyWarning(response);\r\n }\r\n }\r\n\r\n if (response.severity <= LogLevel.Error) {\r\n throw new Error(response.message);\r\n }\r\n return response;\r\n }\r\n\r\n private _processError<T extends CommandResponse>(error: any, options?: CommandClientContext): ObservableInput<T> {\r\n this.logger.error(error);\r\n if (!(options && (options.notifyErrors === undefined || options.notifyErrors))) {\r\n this.notification.notifyError(error);\r\n }\r\n\r\n throw error;\r\n }\r\n\r\n private _getParamValue(rawValue: any): string | string[] {\r\n if (typeof rawValue === 'string') {\r\n return rawValue;\r\n }\r\n\r\n if (Array.isArray(rawValue)) {\r\n return rawValue.map(e => `${e}`);\r\n }\r\n\r\n return `${rawValue}`;\r\n }\r\n}\r\n","import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';\r\nimport { LogLevel, AppService, Priority, Logger, Expando } from '@kephas/core';\r\nimport { NotificationService } from '@kephas/ui';\r\nimport {\r\n ResponseMessage, ErrorInfo, MessageProcessorClient,\r\n MessagingClientContext, MessagingError\r\n} from '@kephas/messaging';\r\nimport { Observable, ObservableInput } from 'rxjs';\r\nimport { retry, map, catchError } from 'rxjs/operators';\r\nimport { AppSettings } from './appSettings';\r\n\r\n\r\ninterface RawResponseMessage<T extends ResponseMessage> {\r\n /**\r\n * The exception information.\r\n *\r\n * @type {ErrorInfo}\r\n * @memberof RawResponseMessage\r\n */\r\n exception: ErrorInfo;\r\n\r\n /**\r\n * The response message.\r\n *\r\n * @type {T}\r\n * @memberof RawResponseMessage\r\n */\r\n message: T;\r\n}\r\n\r\n/**\r\n * Provides proxied message processing over HTTP.\r\n *\r\n * @export\r\n * @class MessageProcessor\r\n */\r\n@AppService({ overridePriority: Priority.Low })\r\nexport class HttpMessageProcessorClient extends MessageProcessorClient {\r\n\r\n /**\r\n * Gets or sets the base route for the command execution.\r\n *\r\n * @protected\r\n * @type {string}\r\n * @memberof MessageProcessor\r\n */\r\n protected baseRoute: string = 'api/msg/';\r\n\r\n /**\r\n * Initializes a new instance of the HttpMessageProcessor class.\r\n * @param {NotificationService} notification The notification service.\r\n * @param {HttpClient} http The HTTP client.\r\n * @param {AppSettings} appSettings The application settings.\r\n */\r\n constructor(\r\n protected appSettings: AppSettings,\r\n protected http: HttpClient,\r\n protected notification: NotificationService,\r\n protected logger: Logger) {\r\n super();\r\n }\r\n\r\n /**\r\n * Processes the message asynchronously.\r\n * @tparam T The message response type.\r\n * @param {{}} message The message.\r\n * @param {MessagingClientContext} [options] Optional. Options controlling the message processing.\r\n * @returns {Observable{T}} An observable over the result.\r\n */\r\n public process<T extends ResponseMessage>(message: {}, options?: MessagingClientContext): Observable<T> {\r\n const url = this.getHttpPostUrl(message, options);\r\n const obs = this.http.post<RawResponseMessage<T>>(url, message, this.getHttpPostOptions(message, options));\r\n const responseObj = (options && options.retries)\r\n ? obs.pipe(\r\n retry(options.retries),\r\n map(response => this._processResponse<T>(response, options)),\r\n catchError(error => this._processError<T>(error, options)))\r\n : obs.pipe(\r\n map(response => this._processResponse<T>(response, options)),\r\n catchError(error => this._processError<T>(error, options)));\r\n\r\n return responseObj;\r\n }\r\n\r\n /**\r\n * Gets the HTTP GET URL.\r\n *\r\n * @protected\r\n * @param {{}} message The message.\r\n * @param {MessagingClientContext} [options] Optional. Options controlling the command processing.\r\n * @returns {string} The HTTP GET URL.\r\n * @memberof MessageProcessor\r\n */\r\n protected getHttpPostUrl(message: {}, options?: MessagingClientContext): string {\r\n let baseUrl = this.appSettings.baseUrl;\r\n if (!baseUrl.endsWith('/')) {\r\n baseUrl = baseUrl + '/';\r\n }\r\n\r\n const url = `${baseUrl}${this.baseRoute}`;\r\n return url;\r\n }\r\n\r\n /**\r\n * Gets the HTTP GET options. By default it does not return any options.\r\n *\r\n * @protected\r\n * @param {string} command The command.\r\n * @param {{}} [args] Optional. The arguments.\r\n * @param {MessagingClientContext} [options] Optional. Options controlling the command processing.\r\n * @returns {({\r\n * headers?: HttpHeaders | {\r\n * [header: string]: string | string[];\r\n * };\r\n * observe?: 'body';\r\n * params?: HttpParams | {\r\n * [param: string]: string | string[];\r\n * };\r\n * reportProgress?: boolean;\r\n * responseType?: 'json';\r\n * withCredentials?: boolean;\r\n * } | undefined)} The options or undefined.\r\n * @memberof MessageProcessor\r\n */\r\n protected getHttpPostOptions(message: {}, options?: MessagingClientContext): {\r\n headers?: HttpHeaders | {\r\n [header: string]: string | string[];\r\n };\r\n observe?: 'body';\r\n params?: HttpParams | {\r\n [param: string]: string | string[];\r\n };\r\n reportProgress?: boolean;\r\n responseType?: 'json';\r\n withCredentials?: boolean;\r\n } | undefined {\r\n return undefined;\r\n }\r\n\r\n private _processResponse<T extends ResponseMessage>(rawResponse: RawResponseMessage<T>, options?: MessagingClientContext): T {\r\n if (rawResponse.exception) {\r\n const errorInfo = rawResponse.exception;\r\n if (typeof errorInfo.severity === 'string') {\r\n errorInfo.severity = (LogLevel as Expando)[errorInfo.severity as string];\r\n }\r\n\r\n throw new MessagingError(errorInfo.message!, errorInfo);\r\n }\r\n\r\n const response = rawResponse.message;\r\n if (typeof response.severity === 'string') {\r\n response.severity = (LogLevel as Expando)[response.severity as string];\r\n }\r\n\r\n if (!response.severity) {\r\n response.severity = LogLevel.Info;\r\n }\r\n\r\n if (response.severity <= LogLevel.Error) {\r\n throw new MessagingError(response.message!, response);\r\n }\r\n\r\n if (response.severity === LogLevel.Warning) {\r\n this.logger.log(response.severity, null, response.message!);\r\n if (!(options && (options.notifyWarnings === undefined || options.notifyWarnings))) {\r\n this.notification.notifyWarning(response);\r\n }\r\n }\r\n\r\n if (response.severity <= LogLevel.Error) {\r\n throw new MessagingError(response.message!, response);\r\n }\r\n return response;\r\n }\r\n\r\n private _processError<T extends ResponseMessage>(error: any, options?: MessagingClientContext): ObservableInput<T> {\r\n this.logger.error(error);\r\n if (!(options && (options.notifyErrors === undefined || options.notifyErrors))) {\r\n this.notification.notifyError(error);\r\n }\r\n\r\n throw error;\r\n }\r\n}\r\n","import { Type } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport {\r\n SingletonAppServiceContract, AppService, Priority,\r\n AsyncInitializable,\r\n Expando\r\n} from '@kephas/core';\r\n\r\n// https://stackoverflow.com/questions/50222998/error-encountered-in-metadata-generated-for-exported-symbol-when-constructing-an\r\n\r\n// @dynamic\r\n/**\r\n * The configuration service.\r\n *\r\n * @export\r\n * @class Configuration\r\n * @implements {AsyncInitializable}\r\n */\r\n@AppService({ overridePriority: Priority.Low })\r\n@SingletonAppServiceContract()\r\nexport class Configuration implements AsyncInitializable {\r\n\r\n private static readonly configurationFileUrl = '/app/configuration.json';\r\n\r\n private static configurationFile: {};\r\n\r\n /**\r\n * Ensures that the configuration file is initialized.\r\n *\r\n * @param {{ http: HttpClient, configurationFileUrl?: string }} context The context containing initialization data.\r\n * @returns {Promise<void>}\r\n * @memberof Configuration\r\n */\r\n public async initializeAsync(context: { http: HttpClient, configurationFileUrl?: string }): Promise<void> {\r\n if (Configuration.configurationFile) {\r\n return;\r\n }\r\n\r\n const response = await context.http.get(context.configurationFileUrl ? context.configurationFileUrl : Configuration.configurationFileUrl).toPromise();\r\n Configuration.configurationFile = response || {};\r\n }\r\n\r\n /**\r\n * Gets the configuration settings for the indicated section name.\r\n *\r\n * @template T The settings type.\r\n * @param {string} sectionName The section name.\r\n * @returns {T} The settings.\r\n * @memberof Configuration\r\n */\r\n public getSettings<T>(settingsType: Type<T>): T {\r\n\r\n if (!Configuration.configurationFile) {\r\n throw new Error('The configuration manager must be initialized prior to requesting settings from it.');\r\n }\r\n\r\n let sectionName = settingsType.name;\r\n const ending = 'Settings';\r\n if (sectionName.endsWith(ending)) {\r\n sectionName = sectionName.substring(0, sectionName.length - ending.length);\r\n }\r\n\r\n sectionName = sectionName[0].toLowerCase() + sectionName.substring(1);\r\n\r\n return (Configuration.configurationFile as Expando)[sectionName];\r\n }\r\n}\r\n","import { XhrFactory } from '@angular/common';\r\nimport { HttpClient, HttpHandler, HttpXhrBackend, HttpBackend } from '@angular/common/http';\r\nimport { Injectable, Injector, StaticClassProvider } from '@angular/core';\r\nimport { AppServiceInfo, AppServiceInfoRegistry, AppServiceMetadata, Expando, Type } from '@kephas/core';\r\nimport { NgTarget } from './angularTarget';\r\nimport { BrowserXhrFactory } from \"./services/http/browserXhrFactory\";\r\nimport { HttpInterceptingHandler } from './services/http/httpInterceptingHandler';\r\n\r\n/**\r\n* Registry for root services.\r\n*\r\n* @export\r\n* @class RootProvidersRegistry\r\n*/\r\n\r\nexport class RootProvidersRegistry {\r\n static #providers: StaticClassProvider[] = [\r\n { provide: HttpClient, useClass: HttpClient, deps: [HttpHandler] },\r\n { provide: HttpHandler, useClass: HttpInterceptingHandler, deps: [HttpBackend, Injector] },\r\n { provide: HttpBackend, useClass: HttpXhrBackend, deps: [XhrFactory] },\r\n { provide: HttpXhrBackend, useClass: HttpXhrBackend, deps: [XhrFactory] },\r\n { provide: XhrFactory, useClass: BrowserXhrFactory, deps: [] },\r\n ];\r\n\r\n /**\r\n * Gets the providers for the HTTP client.\r\n *\r\n * @returns {((StaticClassProvider | ExistingProvider)[])}\r\n * @memberof HttpClientAppServiceInfoRegistry\r\n */\r\n public static getRootProviders(serviceRegistry: AppServiceInfoRegistry): (StaticClassProvider)[] {\r\n const providers: (StaticClassProvider)[] = [];\r\n for (const c of serviceRegistry.serviceContracts) {\r\n const serviceContract: AppServiceInfo = c;\r\n if ((c as Expando).target === NgTarget) {\r\n Injectable()(serviceContract.contractType);\r\n for (const m of serviceContract.services) {\r\n const serviceMetadata: AppServiceMetadata<any> = m;\r\n Injectable()(serviceMetadata.serviceType!);\r\n providers.push({\r\n provide: serviceContract.contractToken || serviceContract.contractType,\r\n useClass: serviceMetadata.serviceType!,\r\n multi: serviceContract.allowMultiple,\r\n deps: RootProvidersRegistry.getDependencies(serviceMetadata.serviceType!),\r\n });\r\n }\r\n }\r\n }\r\n\r\n providers.push(...RootProvidersRegistry.#providers);\r\n\r\n return providers;\r\n }\r\n\r\n /**\r\n * Loads asynchronously the modules to make sure that the\r\n * overridden services area also loaded into the service registry.\r\n * First of all, loads the Kephas modules, afterwards\r\n * loads the application modules invoking the provided delegate.\r\n */\r\n public static async loadModules(loadAppModules?: () => Promise<void>): Promise<void> {\r\n await import('@kephas/core');\r\n await import('@kephas/reflection');\r\n await import('@kephas/commands');\r\n await import('@kephas/messaging');\r\n await import('@kephas/ui');\r\n\r\n await import('@angular/common/http');\r\n\r\n if (loadAppModules) {\r\n await loadAppModules();\r\n }\r\n }\r\n\r\n private static getDependencies(serviceType: Type<any>): any[] {\r\n let deps = Reflect.getMetadata('design:paramtypes', serviceType);\r\n if (!deps && serviceType.ctorParameters) {\r\n deps = serviceType.ctorParameters();\r\n }\r\n\r\n return deps || [];\r\n }\r\n}\r\n","import { Injectable, NgModule, Injector } from \"@angular/core\";\r\nimport { CommandProcessorClient } from \"@kephas/commands\";\r\nimport { AbstractType, EventHub, HashingService, Injector as KephasInjector, Logger, Type } from \"@kephas/core\";\r\nimport { MessageProcessorClient } from \"@kephas/messaging\";\r\nimport { TypeInfoRegistry } from \"@kephas/reflection\";\r\nimport { NotificationService } from \"@kephas/ui\";\r\nimport { AppSettings } from \"./services/appSettings\";\r\nimport { Configuration } from \"./services/configuration\";\r\nimport { HttpInterceptingHandler } from \"./services/http/httpInterceptingHandler\";\r\n\r\nexport function resolveAppService<T>(type: AbstractType | Type<T>) {\r\n Injectable()(type);\r\n return (injector: Injector) => KephasInjector.instance.resolve(type, t => injector.get(t));\r\n}\r\n\r\n@NgModule({\r\n providers: [\r\n // core\r\n {\r\n provide: KephasInjector,\r\n useFactory: resolveAppService(KephasInjector),\r\n deps: [Injector]\r\n },\r\n {\r\n provide: Logger,\r\n useFactory: resolveAppService(Logger),\r\n deps: [Injector]\r\n },\r\n {\r\n provide: HashingService,\r\n useFactory: resolveAppService(HashingService),\r\n deps: [Injector]\r\n },\r\n {\r\n provide: EventHub,\r\n useFactory: resolveAppService(EventHub),\r\n deps: [Injector]\r\n },\r\n\r\n // commands\r\n {\r\n provide: CommandProcessorClient,\r\n useFactory: resolveAppService(CommandProcessorClient),\r\n deps: [Injector]\r\n },\r\n\r\n // messaging\r\n {\r\n provide: MessageProcessorClient,\r\n useFactory: resolveAppService(MessageProcessorClient),\r\n deps: [Injector]\r\n },\r\n\r\n // reflection\r\n {\r\n provide: TypeInfoRegistry,\r\n useFactory: resolveAppService(TypeInfoRegistry),\r\n deps: [Injector]\r\n },\r\n\r\n // ui\r\n {\r\n provide: NotificationService,\r\n useFactory: resolveAppService(NotificationService),\r\n deps: [Injector]\r\n },\r\n\r\n // ngx-core\r\n {\r\n provide: AppSettings,\r\n useFactory: resolveAppService(AppSettings),\r\n deps: [Injector]\r\n },\r\n {\r\n provide: Configuration,\r\n useFactory: resolveAppService(Configuration),\r\n deps: [Injector]\r\n },\r\n HttpInterceptingHandler,\r\n ]\r\n})\r\nexport class KephasModule {\r\n}\r\n","/*\r\n * Public API Surface of @kephas/angular\r\n */\r\n\r\nexport * from './lib/angularTarget';\r\n\r\nexport * from './lib/components/widgetBase';\r\nexport * from './lib/components/valueEditorBase';\r\n\r\nexport * from './lib/queries/commandQuery';\r\nexport * from './lib/queries/messageQuery';\r\n\r\nexport * from './lib/services/http/browserXhrFactory';\r\nexport * from './lib/services/http/httpInterceptingHandler';\r\n\r\nexport * from './lib/services/appSettings';\r\nexport * from './lib/services/httpCommandProcessorClient';\r\nexport * from './lib/services/httpMessageProcessorClient';\r\nexport * from './lib/services/configuration';\r\n\r\nexport * from './lib/rootProvidersRegistry';\r\n\r\nexport * from './lib/kephas.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["KephasInjector"],"mappings":";;;;;;;;;;;;;;;MAAa,QAAQ,GAAW;;ACUhC;;;;;;MASsB,UAAU;;;;;;;IAsC5B,YACoB,UAAsB,EACtB,gBAAkC;QADlC,eAAU,GAAV,UAAU,CAAY;QACtB,qBAAgB,GAAhB,gBAAgB,CAAkB;QAZ9C,eAAU,GAAG,IAAI,CAAC;QAClB,cAAS,GAAG,KAAK,CAAC;QAatB,MAAM,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACtD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;KACzD;;;;;;;;IASD,IACI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAc,CAAC;KAC9B;IACD,IAAI,YAAY,CAAC,KAA4B;QACzC,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE;YAC9B,OAAO;SACV;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;KAC/C;;;;;;;;IASD,IACI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;KAC1B;IACD,IAAI,SAAS,CAAC,KAAc;QACxB,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE;YAC3B,OAAO;SACV;QAED,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;KAC3B;;;;;;;;IASD,IACI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;KACzB;IACD,IAAI,QAAQ,CAAC,KAAc;QACvB,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE;YAC1B,OAAO;SACV;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;KAC3C;;;;;;;;;;IAWD,QAAQ;KACP;;;;;;;;IASD,eAAe;KACd;;;;;;;;;;IAWD,WAAW,CAAC,OAAsB;KACjC;;;;;IAMD,WAAW;KACV;;;;;;;;;;IAWS,iBAAiB,CAAC,QAAiB,EAAE,QAAiB;KAC/D;;;;;;;;;;IAWS,qBAAqB,CAAC,QAAgC,EAAE,QAAgC;KACjG;;uGA5KiB,UAAU;2FAAV,UAAU,+IAuDd,UAAU,qEAzDhB,EAAE;2FAEQ,UAAU;kBAH/B,SAAS;mBAAC;oBACT,QAAQ,EAAE,EAAE;iBACb;gIAyDO,YAAY;sBADf,YAAY;uBAAC,UAAU;gBAsBpB,SAAS;sBADZ,KAAK;gBAoBF,QAAQ;sBADX,KAAK;;AAgFV;;;;;;;;;;SAUgB,aAAa,CAAC,aAAwB;IAClD,OAAO;QACH,OAAO,EAAE,UAAU;QACnB,WAAW,EAAE,UAAU,CAAC,MAAM,aAAa,CAAC;KAC/C,CAAC;AACN,CAAC;AAED;;;;;;;;;SASgB,oBAAoB,CAAC,aAAwB;IACzD,OAAO;QACH,OAAO,EAAE,iBAAiB;QAC1B,WAAW,EAAE,UAAU,C