@adaas/a-concept 0.2.5 → 0.2.7
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.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +19 -14
- package/dist/index.d.ts +19 -14
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/global/A-Component/A-Component.class.ts +3 -3
- package/src/global/A-Feature/A-Feature.class.ts +92 -21
- package/src/global/A-Stage/A-Stage.class.ts +54 -52
- package/src/helpers/A_TypeGuards.helper.ts +5 -0
- package/tests/A-Abstraction.test.ts +0 -2
- package/tests/A-Feature.test.ts +268 -17
package/dist/index.d.mts
CHANGED
|
@@ -917,10 +917,6 @@ declare class A_Stage {
|
|
|
917
917
|
* Indicates the current status of the stage
|
|
918
918
|
*/
|
|
919
919
|
private _status;
|
|
920
|
-
/**
|
|
921
|
-
* Promise that will be resolved when the stage is Processed
|
|
922
|
-
*/
|
|
923
|
-
private _processed;
|
|
924
920
|
/**
|
|
925
921
|
* A_Stage is a callable A_Function within A_Feature that should be run with specific parameters.
|
|
926
922
|
* [!] Depending on the Stage Definition type sync/async function can be executed correspondingly.
|
|
@@ -966,7 +962,7 @@ declare class A_Stage {
|
|
|
966
962
|
* @param step
|
|
967
963
|
* @returns
|
|
968
964
|
*/
|
|
969
|
-
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep):
|
|
965
|
+
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep): (A_Container | A_Component | A_Entity<any, A_TYPES__Entity_Serialized> | A_Fragment<A_TYPES__Fragment_Serialized> | A_Feature<A_TYPES__FeatureAvailableComponents> | A_Caller<A_TYPES__FeatureAvailableComponents> | A_Error<A_TYPES__Error_Init, A_TYPES__Error_Serialized> | A_Scope<any, A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<A_TYPES__Fragment_Serialized>[]> | A_TYPES__A_DependencyInjectable[] | undefined)[];
|
|
970
966
|
/**
|
|
971
967
|
* Resolves the component of the step
|
|
972
968
|
*
|
|
@@ -980,7 +976,10 @@ declare class A_Stage {
|
|
|
980
976
|
* @param step
|
|
981
977
|
* @returns
|
|
982
978
|
*/
|
|
983
|
-
protected callStepHandler(step: A_TYPES__A_StageStep, scope: A_Scope):
|
|
979
|
+
protected callStepHandler(step: A_TYPES__A_StageStep, scope: A_Scope): {
|
|
980
|
+
handler: Function;
|
|
981
|
+
params: any[];
|
|
982
|
+
};
|
|
984
983
|
skip(): void;
|
|
985
984
|
/**
|
|
986
985
|
* This method processes the stage by executing all the steps
|
|
@@ -991,7 +990,7 @@ declare class A_Stage {
|
|
|
991
990
|
/**
|
|
992
991
|
* Scope to be used to resolve the steps dependencies
|
|
993
992
|
*/
|
|
994
|
-
scope?: A_Scope): Promise<void
|
|
993
|
+
scope?: A_Scope): Promise<void> | void;
|
|
995
994
|
protected completed(): void;
|
|
996
995
|
protected failed(error: Error | A_Error | any): void;
|
|
997
996
|
/**
|
|
@@ -1211,7 +1210,11 @@ declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES_
|
|
|
1211
1210
|
* Optional scope to be used to resolve the steps dependencies
|
|
1212
1211
|
* If not provided, the scope of the caller component will be used
|
|
1213
1212
|
*/
|
|
1214
|
-
scope?: A_Scope): Promise<void
|
|
1213
|
+
scope?: A_Scope): Promise<void> | void;
|
|
1214
|
+
/**
|
|
1215
|
+
* Process stages one by one, ensuring each stage completes before starting the next
|
|
1216
|
+
*/
|
|
1217
|
+
private processStagesSequentially;
|
|
1215
1218
|
/**
|
|
1216
1219
|
* This method moves the feature to the next stage
|
|
1217
1220
|
*
|
|
@@ -1225,16 +1228,17 @@ declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES_
|
|
|
1225
1228
|
* @param result
|
|
1226
1229
|
* @returns
|
|
1227
1230
|
*/
|
|
1228
|
-
completed():
|
|
1231
|
+
completed(): void;
|
|
1229
1232
|
/**
|
|
1230
|
-
* This method marks the feature as failed and
|
|
1233
|
+
* This method marks the feature as failed and returns the error
|
|
1231
1234
|
* Uses to mark the feature as failed
|
|
1232
1235
|
*
|
|
1233
1236
|
* @param error
|
|
1237
|
+
* @returns The error that caused the failure
|
|
1234
1238
|
*/
|
|
1235
|
-
failed(error: A_FeatureError):
|
|
1239
|
+
failed(error: A_FeatureError): A_FeatureError;
|
|
1236
1240
|
/**
|
|
1237
|
-
* This method marks the feature as
|
|
1241
|
+
* This method marks the feature as interrupted and throws an error
|
|
1238
1242
|
* Uses to interrupt or end the feature processing
|
|
1239
1243
|
*
|
|
1240
1244
|
* @param error
|
|
@@ -1243,7 +1247,7 @@ declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES_
|
|
|
1243
1247
|
/**
|
|
1244
1248
|
* The reason of feature interruption
|
|
1245
1249
|
*/
|
|
1246
|
-
reason?: string | A_StageError | Error):
|
|
1250
|
+
reason?: string | A_StageError | Error): A_FeatureError;
|
|
1247
1251
|
/**
|
|
1248
1252
|
* Allows to chain the feature to another feature.
|
|
1249
1253
|
* In this case the parent feature scope (if new not provided), stages, caller will be used.
|
|
@@ -3707,7 +3711,7 @@ declare class A_Component {
|
|
|
3707
3711
|
/**
|
|
3708
3712
|
* Scope in which the feature will be executed
|
|
3709
3713
|
*/
|
|
3710
|
-
scope?: A_Scope): Promise<void
|
|
3714
|
+
scope?: A_Scope): Promise<any> | void;
|
|
3711
3715
|
}
|
|
3712
3716
|
|
|
3713
3717
|
/**
|
|
@@ -4800,6 +4804,7 @@ declare class A_TypeGuards {
|
|
|
4800
4804
|
*/
|
|
4801
4805
|
static isErrorConstructorType<T extends A_TYPES__Error_Init>(param: any): param is T;
|
|
4802
4806
|
static isErrorSerializedType<T extends A_TYPES__Error_Serialized>(param: any): param is T;
|
|
4807
|
+
static isPromiseInstance<T>(value: any): value is Promise<T>;
|
|
4803
4808
|
}
|
|
4804
4809
|
|
|
4805
4810
|
export { ASEID, ASEID_Error, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_CONSTANTS__ERROR_CODES, A_CONSTANTS__ERROR_DESCRIPTION, A_Caller, A_CallerError, A_CommonHelper, A_Component, A_ComponentMeta, A_Concept, A_ConceptMeta, A_Container, A_ContainerMeta, A_Context, A_ContextError, A_Dependency, A_DependencyError, A_Dependency_Default, A_Dependency_Load, A_Dependency_Require, A_Entity, A_EntityError, A_EntityMeta, A_Error, A_Feature, A_FeatureError, A_Feature_Define, A_Feature_Extend, A_FormatterHelper, A_Fragment, type A_ID_TYPES__TimeId_Parts, A_IdentityHelper, A_Inject, A_InjectError, A_Meta, A_MetaDecorator, A_Scope, A_ScopeError, A_Stage, A_StageError, A_StepManagerError, A_StepsManager, type A_TYPES_ScopeDependentComponents, type A_TYPES_ScopeIndependentComponents, type A_TYPES_StageExecutionBehavior, type A_TYPES__ASEID_Constructor, type A_TYPES__ASEID_ConstructorConfig, type A_TYPES__ASEID_JSON, type A_TYPES__A_DependencyConstructor, type A_TYPES__A_DependencyInjectable, type A_TYPES__A_DependencyResolutionStrategy, type A_TYPES__A_DependencyResolutionType, type A_TYPES__A_Dependency_AllDecoratorReturn, type A_TYPES__A_Dependency_DefaultDecoratorReturn, type A_TYPES__A_Dependency_EntityInjectionPagination, type A_TYPES__A_Dependency_EntityInjectionQuery, type A_TYPES__A_Dependency_EntityResolutionConfig, type A_TYPES__A_Dependency_FlatDecoratorReturn, type A_TYPES__A_Dependency_LoadDecoratorReturn, type A_TYPES__A_Dependency_ParentDecoratorReturn, type A_TYPES__A_Dependency_RequireDecoratorReturn, type A_TYPES__A_Dependency_Serialized, type A_TYPES__A_InjectDecoratorDescriptor, type A_TYPES__A_InjectDecoratorReturn, type A_TYPES__A_InjectDecorator_Meta, type A_TYPES__A_StageStep, type A_TYPES__A_StageStepProcessingExtraParams, A_TYPES__A_Stage_Status, type A_TYPES__AbstractionAvailableComponents, type A_TYPES__AbstractionDecoratorConfig, type A_TYPES__AbstractionDecoratorDescriptor, type A_TYPES__Abstraction_Constructor, type A_TYPES__Abstraction_Init, type A_TYPES__Abstraction_Serialized, type A_TYPES__CallerComponent, type A_TYPES__Caller_Constructor, type A_TYPES__Caller_Init, type A_TYPES__Caller_Serialized, type A_TYPES__ComponentMeta, type A_TYPES__ComponentMetaExtension, A_TYPES__ComponentMetaKey, type A_TYPES__Component_Constructor, type A_TYPES__Component_Init, type A_TYPES__Component_Serialized, type A_TYPES__ConceptAbstraction, type A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptAbstractions, type A_TYPES__ConceptENVVariables, A_TYPES__ConceptMetaKey, type A_TYPES__Concept_Constructor, type A_TYPES__Concept_Init, type A_TYPES__Concept_Serialized, type A_TYPES__ContainerMeta, type A_TYPES__ContainerMetaExtension, A_TYPES__ContainerMetaKey, type A_TYPES__Container_Constructor, type A_TYPES__Container_Init, type A_TYPES__Container_Serialized, type A_TYPES__ContextEnvironment, type A_TYPES__Ctor, type A_TYPES__DeepPartial, type A_TYPES__Dictionary, A_TYPES__EntityFeatures, type A_TYPES__EntityMeta, A_TYPES__EntityMetaKey, type A_TYPES__Entity_Constructor, type A_TYPES__Entity_Init, type A_TYPES__Entity_Serialized, type A_TYPES__Error_Constructor, type A_TYPES__Error_Init, type A_TYPES__Error_Serialized, type A_TYPES__ExtractNested, type A_TYPES__ExtractProperties, type A_TYPES__FeatureAvailableComponents, type A_TYPES__FeatureAvailableConstructors, type A_TYPES__FeatureDefineDecoratorConfig, type A_TYPES__FeatureDefineDecoratorDescriptor, type A_TYPES__FeatureDefineDecoratorMeta, type A_TYPES__FeatureDefineDecoratorTarget, type A_TYPES__FeatureDefineDecoratorTemplateItem, type A_TYPES__FeatureError_Init, type A_TYPES__FeatureExtendDecoratorConfig, type A_TYPES__FeatureExtendDecoratorDescriptor, type A_TYPES__FeatureExtendDecoratorMeta, type A_TYPES__FeatureExtendDecoratorScopeConfig, type A_TYPES__FeatureExtendDecoratorScopeItem, type A_TYPES__FeatureExtendDecoratorTarget, type A_TYPES__FeatureExtendableMeta, A_TYPES__FeatureState, type A_TYPES__Feature_Constructor, type A_TYPES__Feature_Init, type A_TYPES__Feature_InitWithComponent, type A_TYPES__Feature_InitWithTemplate, type A_TYPES__Feature_Serialized, type A_TYPES__Fragment_Constructor, type A_TYPES__Fragment_Init, type A_TYPES__Fragment_Serialized, type A_TYPES__IEntity, type A_TYPES__InjectableTargets, type A_TYPES__MetaLinkedComponentConstructors, type A_TYPES__MetaLinkedComponents, type A_TYPES__Meta_Constructor, type A_TYPES__NonObjectPaths, type A_TYPES__ObjectKeyEnum, type A_TYPES__Paths, type A_TYPES__PathsToObject, type A_TYPES__Required, type A_TYPES__ScopeConfig, type A_TYPES__ScopeLinkedComponents, type A_TYPES__ScopeLinkedConstructors, type A_TYPES__Scope_Constructor, type A_TYPES__Scope_Init, type A_TYPES__Scope_Serialized, type A_TYPES__Stage_Serialized, type A_TYPES__UnionToIntersection, A_TypeGuards };
|
package/dist/index.d.ts
CHANGED
|
@@ -917,10 +917,6 @@ declare class A_Stage {
|
|
|
917
917
|
* Indicates the current status of the stage
|
|
918
918
|
*/
|
|
919
919
|
private _status;
|
|
920
|
-
/**
|
|
921
|
-
* Promise that will be resolved when the stage is Processed
|
|
922
|
-
*/
|
|
923
|
-
private _processed;
|
|
924
920
|
/**
|
|
925
921
|
* A_Stage is a callable A_Function within A_Feature that should be run with specific parameters.
|
|
926
922
|
* [!] Depending on the Stage Definition type sync/async function can be executed correspondingly.
|
|
@@ -966,7 +962,7 @@ declare class A_Stage {
|
|
|
966
962
|
* @param step
|
|
967
963
|
* @returns
|
|
968
964
|
*/
|
|
969
|
-
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep):
|
|
965
|
+
protected getStepArgs(scope: A_Scope, step: A_TYPES__A_StageStep): (A_Container | A_Component | A_Entity<any, A_TYPES__Entity_Serialized> | A_Fragment<A_TYPES__Fragment_Serialized> | A_Feature<A_TYPES__FeatureAvailableComponents> | A_Caller<A_TYPES__FeatureAvailableComponents> | A_Error<A_TYPES__Error_Init, A_TYPES__Error_Serialized> | A_Scope<any, A_TYPES__Component_Constructor[], A_TYPES__Error_Constructor[], A_TYPES__Entity_Constructor[], A_Fragment<A_TYPES__Fragment_Serialized>[]> | A_TYPES__A_DependencyInjectable[] | undefined)[];
|
|
970
966
|
/**
|
|
971
967
|
* Resolves the component of the step
|
|
972
968
|
*
|
|
@@ -980,7 +976,10 @@ declare class A_Stage {
|
|
|
980
976
|
* @param step
|
|
981
977
|
* @returns
|
|
982
978
|
*/
|
|
983
|
-
protected callStepHandler(step: A_TYPES__A_StageStep, scope: A_Scope):
|
|
979
|
+
protected callStepHandler(step: A_TYPES__A_StageStep, scope: A_Scope): {
|
|
980
|
+
handler: Function;
|
|
981
|
+
params: any[];
|
|
982
|
+
};
|
|
984
983
|
skip(): void;
|
|
985
984
|
/**
|
|
986
985
|
* This method processes the stage by executing all the steps
|
|
@@ -991,7 +990,7 @@ declare class A_Stage {
|
|
|
991
990
|
/**
|
|
992
991
|
* Scope to be used to resolve the steps dependencies
|
|
993
992
|
*/
|
|
994
|
-
scope?: A_Scope): Promise<void
|
|
993
|
+
scope?: A_Scope): Promise<void> | void;
|
|
995
994
|
protected completed(): void;
|
|
996
995
|
protected failed(error: Error | A_Error | any): void;
|
|
997
996
|
/**
|
|
@@ -1211,7 +1210,11 @@ declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES_
|
|
|
1211
1210
|
* Optional scope to be used to resolve the steps dependencies
|
|
1212
1211
|
* If not provided, the scope of the caller component will be used
|
|
1213
1212
|
*/
|
|
1214
|
-
scope?: A_Scope): Promise<void
|
|
1213
|
+
scope?: A_Scope): Promise<void> | void;
|
|
1214
|
+
/**
|
|
1215
|
+
* Process stages one by one, ensuring each stage completes before starting the next
|
|
1216
|
+
*/
|
|
1217
|
+
private processStagesSequentially;
|
|
1215
1218
|
/**
|
|
1216
1219
|
* This method moves the feature to the next stage
|
|
1217
1220
|
*
|
|
@@ -1225,16 +1228,17 @@ declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES_
|
|
|
1225
1228
|
* @param result
|
|
1226
1229
|
* @returns
|
|
1227
1230
|
*/
|
|
1228
|
-
completed():
|
|
1231
|
+
completed(): void;
|
|
1229
1232
|
/**
|
|
1230
|
-
* This method marks the feature as failed and
|
|
1233
|
+
* This method marks the feature as failed and returns the error
|
|
1231
1234
|
* Uses to mark the feature as failed
|
|
1232
1235
|
*
|
|
1233
1236
|
* @param error
|
|
1237
|
+
* @returns The error that caused the failure
|
|
1234
1238
|
*/
|
|
1235
|
-
failed(error: A_FeatureError):
|
|
1239
|
+
failed(error: A_FeatureError): A_FeatureError;
|
|
1236
1240
|
/**
|
|
1237
|
-
* This method marks the feature as
|
|
1241
|
+
* This method marks the feature as interrupted and throws an error
|
|
1238
1242
|
* Uses to interrupt or end the feature processing
|
|
1239
1243
|
*
|
|
1240
1244
|
* @param error
|
|
@@ -1243,7 +1247,7 @@ declare class A_Feature<T extends A_TYPES__FeatureAvailableComponents = A_TYPES_
|
|
|
1243
1247
|
/**
|
|
1244
1248
|
* The reason of feature interruption
|
|
1245
1249
|
*/
|
|
1246
|
-
reason?: string | A_StageError | Error):
|
|
1250
|
+
reason?: string | A_StageError | Error): A_FeatureError;
|
|
1247
1251
|
/**
|
|
1248
1252
|
* Allows to chain the feature to another feature.
|
|
1249
1253
|
* In this case the parent feature scope (if new not provided), stages, caller will be used.
|
|
@@ -3707,7 +3711,7 @@ declare class A_Component {
|
|
|
3707
3711
|
/**
|
|
3708
3712
|
* Scope in which the feature will be executed
|
|
3709
3713
|
*/
|
|
3710
|
-
scope?: A_Scope): Promise<void
|
|
3714
|
+
scope?: A_Scope): Promise<any> | void;
|
|
3711
3715
|
}
|
|
3712
3716
|
|
|
3713
3717
|
/**
|
|
@@ -4800,6 +4804,7 @@ declare class A_TypeGuards {
|
|
|
4800
4804
|
*/
|
|
4801
4805
|
static isErrorConstructorType<T extends A_TYPES__Error_Init>(param: any): param is T;
|
|
4802
4806
|
static isErrorSerializedType<T extends A_TYPES__Error_Serialized>(param: any): param is T;
|
|
4807
|
+
static isPromiseInstance<T>(value: any): value is Promise<T>;
|
|
4803
4808
|
}
|
|
4804
4809
|
|
|
4805
4810
|
export { ASEID, ASEID_Error, A_Abstraction, A_AbstractionError, A_Abstraction_Extend, A_CONSTANTS__DEFAULT_ENV_VARIABLES, A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, A_CONSTANTS__ERROR_CODES, A_CONSTANTS__ERROR_DESCRIPTION, A_Caller, A_CallerError, A_CommonHelper, A_Component, A_ComponentMeta, A_Concept, A_ConceptMeta, A_Container, A_ContainerMeta, A_Context, A_ContextError, A_Dependency, A_DependencyError, A_Dependency_Default, A_Dependency_Load, A_Dependency_Require, A_Entity, A_EntityError, A_EntityMeta, A_Error, A_Feature, A_FeatureError, A_Feature_Define, A_Feature_Extend, A_FormatterHelper, A_Fragment, type A_ID_TYPES__TimeId_Parts, A_IdentityHelper, A_Inject, A_InjectError, A_Meta, A_MetaDecorator, A_Scope, A_ScopeError, A_Stage, A_StageError, A_StepManagerError, A_StepsManager, type A_TYPES_ScopeDependentComponents, type A_TYPES_ScopeIndependentComponents, type A_TYPES_StageExecutionBehavior, type A_TYPES__ASEID_Constructor, type A_TYPES__ASEID_ConstructorConfig, type A_TYPES__ASEID_JSON, type A_TYPES__A_DependencyConstructor, type A_TYPES__A_DependencyInjectable, type A_TYPES__A_DependencyResolutionStrategy, type A_TYPES__A_DependencyResolutionType, type A_TYPES__A_Dependency_AllDecoratorReturn, type A_TYPES__A_Dependency_DefaultDecoratorReturn, type A_TYPES__A_Dependency_EntityInjectionPagination, type A_TYPES__A_Dependency_EntityInjectionQuery, type A_TYPES__A_Dependency_EntityResolutionConfig, type A_TYPES__A_Dependency_FlatDecoratorReturn, type A_TYPES__A_Dependency_LoadDecoratorReturn, type A_TYPES__A_Dependency_ParentDecoratorReturn, type A_TYPES__A_Dependency_RequireDecoratorReturn, type A_TYPES__A_Dependency_Serialized, type A_TYPES__A_InjectDecoratorDescriptor, type A_TYPES__A_InjectDecoratorReturn, type A_TYPES__A_InjectDecorator_Meta, type A_TYPES__A_StageStep, type A_TYPES__A_StageStepProcessingExtraParams, A_TYPES__A_Stage_Status, type A_TYPES__AbstractionAvailableComponents, type A_TYPES__AbstractionDecoratorConfig, type A_TYPES__AbstractionDecoratorDescriptor, type A_TYPES__Abstraction_Constructor, type A_TYPES__Abstraction_Init, type A_TYPES__Abstraction_Serialized, type A_TYPES__CallerComponent, type A_TYPES__Caller_Constructor, type A_TYPES__Caller_Init, type A_TYPES__Caller_Serialized, type A_TYPES__ComponentMeta, type A_TYPES__ComponentMetaExtension, A_TYPES__ComponentMetaKey, type A_TYPES__Component_Constructor, type A_TYPES__Component_Init, type A_TYPES__Component_Serialized, type A_TYPES__ConceptAbstraction, type A_TYPES__ConceptAbstractionMeta, A_TYPES__ConceptAbstractions, type A_TYPES__ConceptENVVariables, A_TYPES__ConceptMetaKey, type A_TYPES__Concept_Constructor, type A_TYPES__Concept_Init, type A_TYPES__Concept_Serialized, type A_TYPES__ContainerMeta, type A_TYPES__ContainerMetaExtension, A_TYPES__ContainerMetaKey, type A_TYPES__Container_Constructor, type A_TYPES__Container_Init, type A_TYPES__Container_Serialized, type A_TYPES__ContextEnvironment, type A_TYPES__Ctor, type A_TYPES__DeepPartial, type A_TYPES__Dictionary, A_TYPES__EntityFeatures, type A_TYPES__EntityMeta, A_TYPES__EntityMetaKey, type A_TYPES__Entity_Constructor, type A_TYPES__Entity_Init, type A_TYPES__Entity_Serialized, type A_TYPES__Error_Constructor, type A_TYPES__Error_Init, type A_TYPES__Error_Serialized, type A_TYPES__ExtractNested, type A_TYPES__ExtractProperties, type A_TYPES__FeatureAvailableComponents, type A_TYPES__FeatureAvailableConstructors, type A_TYPES__FeatureDefineDecoratorConfig, type A_TYPES__FeatureDefineDecoratorDescriptor, type A_TYPES__FeatureDefineDecoratorMeta, type A_TYPES__FeatureDefineDecoratorTarget, type A_TYPES__FeatureDefineDecoratorTemplateItem, type A_TYPES__FeatureError_Init, type A_TYPES__FeatureExtendDecoratorConfig, type A_TYPES__FeatureExtendDecoratorDescriptor, type A_TYPES__FeatureExtendDecoratorMeta, type A_TYPES__FeatureExtendDecoratorScopeConfig, type A_TYPES__FeatureExtendDecoratorScopeItem, type A_TYPES__FeatureExtendDecoratorTarget, type A_TYPES__FeatureExtendableMeta, A_TYPES__FeatureState, type A_TYPES__Feature_Constructor, type A_TYPES__Feature_Init, type A_TYPES__Feature_InitWithComponent, type A_TYPES__Feature_InitWithTemplate, type A_TYPES__Feature_Serialized, type A_TYPES__Fragment_Constructor, type A_TYPES__Fragment_Init, type A_TYPES__Fragment_Serialized, type A_TYPES__IEntity, type A_TYPES__InjectableTargets, type A_TYPES__MetaLinkedComponentConstructors, type A_TYPES__MetaLinkedComponents, type A_TYPES__Meta_Constructor, type A_TYPES__NonObjectPaths, type A_TYPES__ObjectKeyEnum, type A_TYPES__Paths, type A_TYPES__PathsToObject, type A_TYPES__Required, type A_TYPES__ScopeConfig, type A_TYPES__ScopeLinkedComponents, type A_TYPES__ScopeLinkedConstructors, type A_TYPES__Scope_Constructor, type A_TYPES__Scope_Init, type A_TYPES__Scope_Serialized, type A_TYPES__Stage_Serialized, type A_TYPES__UnionToIntersection, A_TypeGuards };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var et=Object.defineProperty;var _=(c,e)=>et(c,"name",{value:e,configurable:true});var O={A_CONCEPT_NAME:"A_CONCEPT_NAME",A_CONCEPT_ROOT_SCOPE:"A_CONCEPT_ROOT_SCOPE",A_CONCEPT_ENVIRONMENT:"A_CONCEPT_ENVIRONMENT",A_CONCEPT_ROOT_FOLDER:"A_CONCEPT_ROOT_FOLDER",A_ERROR_DEFAULT_DESCRIPTION:"A_ERROR_DEFAULT_DESCRIPTION"},lt=[O.A_CONCEPT_NAME,O.A_CONCEPT_ROOT_SCOPE,O.A_CONCEPT_ENVIRONMENT,O.A_CONCEPT_ROOT_FOLDER,O.A_ERROR_DEFAULT_DESCRIPTION];var tt=(i=>(i.INITIALIZED="INITIALIZED",i.PROCESSING="PROCESSING",i.COMPLETED="COMPLETED",i.INTERRUPTED="INTERRUPTED",i.FAILED="FAILED",i))(tt||{});function Te(c){return function(e){return p.setMeta(e,new c),e}}_(Te,"A_MetaDecorator");var le=class le{constructor(){this.meta=new Map;}static Define(e){return Te(e)}[Symbol.iterator](){let e=this.meta.entries();return {next:_(()=>e.next(),"next")}}from(e){return this.meta=new Map(e.meta),this}set(e,t){let r=this.meta.get(e)||Array.isArray(t)?[]:t instanceof Map?new Map:{};this.meta.get(e)||Array.isArray(t)?[...r]:t instanceof Map?new Map(r):{...r};this.meta.set(e,t);}get(e){return this.meta.get(e)}delete(e){return this.meta.delete(e)}size(){return this.meta.size}convertToRegExp(e){return e instanceof RegExp?e:new RegExp(e)}find(e){let t=[];for(let[r,n]of this.meta.entries())this.convertToRegExp(String(r)).test(e)&&t.push([r,n]);return t}findByRegex(e){let t=[];for(let[r,n]of this.meta.entries())e.test(String(r))&&t.push([r,n]);return t}has(e){return this.meta.has(e)}entries(){return this.meta.entries()}clear(){this.meta.clear();}toArray(){return Array.from(this.meta.entries())}recursiveToJSON(e){switch(true){case e instanceof le:return e.toJSON();case e instanceof Map:let t={};for(let[n,i]of e.entries())t[String(n)]=this.recursiveToJSON(i);return t;case Array.isArray(e):return e.map(n=>this.recursiveToJSON(n));case(!!e&&typeof e=="object"):let r={};for(let[n,i]of Object.entries(e))r[n]=this.recursiveToJSON(i);return r;default:return e}}toJSON(){let e={};for(let[t,r]of this.meta.entries())e[String(t)]=this.recursiveToJSON(r);return e}};_(le,"A_Meta");var A=le;var rt=(n=>(n.EXTENSIONS="a-component-extensions",n.FEATURES="a-component-features",n.ABSTRACTIONS="a-component-abstractions",n.INJECTIONS="a-component-injections",n))(rt||{}),nt=(r=>(r.SAVE="save",r.DESTROY="destroy",r.LOAD="load",r))(nt||{});var ot=(n=>(n.FEATURES="a-container-features",n.INJECTIONS="a-container-injections",n.ABSTRACTIONS="a-container-abstractions",n.EXTENSIONS="a-container-extensions",n))(ot||{});var it=(n=>(n.EXTENSIONS="a-component-extensions",n.FEATURES="a-component-features",n.INJECTIONS="a-component-injections",n.ABSTRACTIONS="a-component-abstractions",n))(it||{});var Se=class Se extends A{injections(e){return this.get("a-component-injections")?.get(e)||[]}extensions(e){let t=[];return this.get("a-component-extensions")?.find(e).forEach(([n,i])=>{i.forEach(s=>{t.push({name:s.name,handler:s.handler,behavior:s.behavior,before:s.before||"",after:s.after||"",throwOnError:s.throwOnError||true,override:""});});}),t}features(){return this.get("a-component-features")?.toArray().map(([,t])=>t)||[]}abstractions(e){let t=[],r=this.get("a-component-abstractions"),n=this.get("a-component-injections");return r?.find(`CONCEPT_ABSTRACTION::${e}`).forEach(([i,s])=>{s.forEach(a=>{let u=n?.get(a.handler)||[];t.push({...a,args:u});});}),t}};_(Se,"A_ComponentMeta");var j=Se;var ye=class ye{get name(){return this.config?.name||this.constructor.name}get scope(){return p.scope(this)}constructor(e={}){this.config=e,p.allocate(this,this.config);}async call(e,t){return await new Y({name:e,component:this}).process(t)}};_(ye,"A_Container");var z=ye;var he=class he extends A{injections(e){return this.get("a-container-injections")?.get(e)||[]}features(){return this.get("a-container-features")?.toArray().map(([,t])=>t)||[]}abstractions(e){let t=[],r=this.get("a-container-abstractions"),n=this.get("a-container-injections");return r?.find(`CONCEPT_ABSTRACTION::${e}`).forEach(([i,s])=>{s.forEach(a=>{let u=n?.get(a.handler)||[];t.push({...a,args:u});});}),t}extensions(e){let t=[];return this.get("a-container-extensions")?.find(e).forEach(([n,i])=>{i.forEach(s=>{t.push({name:s.name,handler:s.handler,behavior:s.behavior,before:s.before||"",after:s.after||"",throwOnError:s.throwOnError||true,override:""});});}),t}};_(he,"A_ContainerMeta");var K=he;var ge=class ge{static toUpperSnakeCase(e){return e.trim().replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[^a-zA-Z0-9]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").toUpperCase()}static toCamelCase(e){return e.trim().replace(/[^a-zA-Z0-9]+/g," ").split(" ").filter(Boolean).map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}static toPascalCase(e){return e.trim().replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z0-9]+/g," ").split(" ").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}static toKebabCase(e){return e.replace(/[^a-zA-Z0-9]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim().replace(/\s+/g,"-").toLowerCase()}};_(ge,"A_FormatterHelper");var C=ge;var Ce=class Ce{static generateTimeId(e={timestamp:new Date,random:Math.random().toString(36).slice(2,8)}){let t=e.timestamp.getTime().toString(36),r=e.random;return `${t}-${r}`}static parseTimeId(e){let[t,r]=e.split("-");return {timestamp:new Date(parseInt(t,36)),random:r}}static formatWithLeadingZeros(e,t=10){return String(e).padStart(t+1,"0").slice(-t)}static removeLeadingZeros(e){return String(Number(e))}static hashString(e){let t=0,r,n;if(e.length===0)return t.toString();for(r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t.toString()}};_(Ce,"A_IdentityHelper");var U=Ce;var ee={UNEXPECTED_ERROR:"A-Error Unexpected Error",VALIDATION_ERROR:"A-Error Validation Error"},He="If you see this error please let us know.";var $=class $ extends Error{static get entity(){return C.toKebabCase(this.name)}static get concept(){return p.concept}static get scope(){return p.root.name}constructor(e,t){switch(true){case e instanceof $:return e;case e instanceof Error:super(e.message);break;case o.isErrorSerializedType(e):super(e.message);break;case(o.isErrorConstructorType(e)&&"description"in e):super(`[${e.title}]: ${e.description}`);break;case(o.isErrorConstructorType(e)&&!("description"in e)):super(e.title);break;case(o.isString(e)&&!t):super(e);break;case(o.isString(e)&&!!t):super(`[${e}]: ${t}`);break;default:super("An unknown error occurred.");}this.getInitializer(e,t).call(this,e,t);}get aseid(){return this._aseid}get title(){return this._title}get message(){return super.message}get code(){return this._code||C.toKebabCase(this.title)}get type(){return this.constructor.entity}get link(){return this._link?this._link:new URL(`https://adaas.support/a-concept/errors/${this.aseid.toString()}`).toString()}get scope(){return this._aseid.scope}get description(){return this._description||process.env[O.A_ERROR_DEFAULT_DESCRIPTION]||He}get originalError(){return this._originalError}getInitializer(e,t){switch(true){case(o.isString(e)&&!t):return this.fromMessage;case(o.isString(e)&&!!t):return this.fromTitle;case e instanceof Error:return this.fromError;case o.isErrorSerializedType(e):return this.fromJSON;case o.isErrorConstructorType(e):return this.fromConstructor;default:throw new $(ee.VALIDATION_ERROR,"Invalid parameters provided to A_Error constructor")}}fromError(e){this._title=ee.UNEXPECTED_ERROR,this._aseid=new I({concept:this.constructor.concept,scope:this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._originalError=e;}fromMessage(e){this._title=ee.UNEXPECTED_ERROR,this._aseid=new I({concept:this.constructor.concept,scope:this._scope||this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._link=void 0,this._originalError=void 0;}fromJSON(e){this._aseid=new I(e.aseid),super.message=e.message,this._title=e.title,this._code=e.code,this._scope=e.scope,this._description=e.description,this._originalError=e.originalError?new $(e.originalError):void 0,this._link=e.link;}fromTitle(e,t){this.validateTitle(e),this._title=e,this._description=t,this._aseid=new I({concept:this.constructor.concept,scope:this._scope||this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._link=void 0,this._originalError=void 0;}fromConstructor(e){if(this.validateTitle(e.title),this._title=e.title,this._code=e.code,this._scope=e.scope?o.isScopeInstance(e.scope)?e.scope.name:e.scope:void 0,this._aseid=new I({concept:this.constructor.concept,scope:this._scope||this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._description=e.description,this._link=e.link,e.originalError instanceof $){let t=e.originalError;for(;t.originalError instanceof $;)t=t.originalError;this._originalError=t.originalError||t;}else this._originalError=e.originalError;}toJSON(){return {aseid:this.aseid.toString(),title:this.title,code:this.code,type:this.type,message:this.message,link:this.link,scope:this.scope,description:this.description,originalError:this.originalError?.message}}validateTitle(e){if(e.length>60)throw new $(ee.VALIDATION_ERROR,"A-Error title exceeds 60 characters limit.");if(e.length===0)throw new $(ee.VALIDATION_ERROR,"A-Error title cannot be empty.")}};_($,"A_Error");var f=$;var se=class se extends f{};_(se,"ASEID_Error"),se.ASEIDInitializationError="ASEID Initialization Error",se.ASEIDValidationError="ASEID Validation Error";var w=se;var N=class N{static isASEID(e){return this.regexp.test(e)}static compare(e,t){if(!e||!t)return false;if(o.isString(e)&&this.isASEID(e)===false)throw new w(w.ASEIDValidationError,`Invalid ASEID format provided: ${e}`);if(o.isString(t)&&this.isASEID(t)===false)throw new w(w.ASEIDValidationError,`Invalid ASEID format provided: ${t}`);let r=e instanceof N?e:new N(e),n=t instanceof N?t:new N(t);return r.toString()===n.toString()}constructor(e){this.verifyInput(e),this.getInitializer(e).call(this,e);}get concept(){return this._concept||p.concept}get scope(){return this._scope||p.root.name}get entity(){return this._entity}get id(){return this._id}get version(){return this._version}get shard(){return this._shard}get hash(){return U.hashString(this.toString())}getInitializer(e){switch(true){case o.isString(e):return this.fromString;case o.isObject(e):return this.fromObject;default:throw new w(w.ASEIDInitializationError,"Invalid parameters provided to ASEID constructor")}}fromString(e){let[t,r,n]=e.split("@"),[i,s,a]=r.split(":"),u=a.includes(".")?a.split(".")[0]:void 0,d=a.includes(".")?a.split(".")[1]:a;this._concept=t||p.root.name,this._scope=i||p.root.name,this._entity=s,this._id=d,this._version=n,this._shard=u;}fromObject(e){this._concept=e.concept?N.isASEID(e.concept)?new N(e.concept).id:e.concept:p.concept,this._scope=e.scope?o.isNumber(e.scope)?U.formatWithLeadingZeros(e.scope):N.isASEID(e.scope)?new N(e.scope).id:e.scope:p.root.name,this._entity=e.entity,this._id=o.isNumber(e.id)?U.formatWithLeadingZeros(e.id):e.id,this._version=e.version,this._shard=e.shard;}toString(){return `${this.concept}@${this.scope}:${this.entity}:${this.shard?this.shard+"."+this.id:this.id}${this.version?"@"+this.version:""}`}toJSON(){return {concept:this._concept,scope:this._scope,entity:this._entity,id:this._id,version:this._version,shard:this._shard}}verifyInput(e){switch(true){case(o.isString(e)&&!N.isASEID(e)):throw new w(w.ASEIDValidationError,"Invalid ASEID format provided");case(o.isObject(e)&&!e.id):throw new w(w.ASEIDValidationError,"ASEID id is required");case(o.isObject(e)&&!e.entity):throw new w(w.ASEIDValidationError,"ASEID entity is required")}}};_(N,"ASEID"),N.regexp=new RegExp("^[a-z|A-Z|0-9|-]+@[a-z|A-Z|0-9|-]+:[a-z|A-Z|0-9|-]+:[a-z|A-Z|0-9|\\.|-]+(@v[0-9|\\.]+|@lts)?$");var I=N;var ue=class ue extends f{};_(ue,"A_EntityError"),ue.ValidationError="A-Entity Validation Error";var te=ue;var Pe=class Pe{static get entity(){return C.toKebabCase(this.name)}static get concept(){return p.concept}static get scope(){return p.root.name}constructor(e){this.getInitializer(e).call(this,e);}get id(){return this.aseid.id}isStringASEID(e){return typeof e=="string"&&I.isASEID(e)}isASEIDInstance(e){return e instanceof I}isSerializedObject(e){return !!e&&typeof e=="object"&&"aseid"in e}isConstructorProps(e){return !!e&&typeof e=="object"&&!("aseid"in e)}getInitializer(e){if(!e)return this.fromUndefined;if(this.isStringASEID(e))return this.fromASEID;if(this.isASEIDInstance(e))return this.fromASEID;if(this.isSerializedObject(e))return this.fromJSON;if(this.isConstructorProps(e))return this.fromNew;throw new te(te.ValidationError,"Unable to determine A-Entity constructor initialization method. Please check the provided parameters.")}generateASEID(e){return new I({concept:e?.concept||this.constructor.concept,scope:e?.scope||this.constructor.scope,entity:e?.entity||this.constructor.entity,id:e?.id||U.generateTimeId()})}async call(e,t){return await new Y({name:e,component:this,scope:t}).process(t)}async load(e){return this.call("load",e)}async destroy(e){return this.call("destroy",e)}async save(e){return this.call("save",e)}fromASEID(e){e instanceof I?this.aseid=e:this.aseid=new I(e);}fromUndefined(){this.aseid=this.generateASEID();}fromNew(e){this.aseid=this.generateASEID();}fromJSON(e){this.aseid=new I(e.aseid);}toJSON(){return {aseid:this.aseid.toString()}}toString(){return this.aseid?this.aseid.toString():this.constructor.name}};_(Pe,"A_Entity");var k=Pe;var Ie=class Ie extends A{features(){return this.get("a-component-features")?.toArray().map(([,t])=>t)||[]}injections(e){return this.get("a-component-injections")?.get(e)||[]}};_(Ie,"A_EntityMeta");var B=Ie;var be=class be{constructor(e={}){this._name=e.name||this.constructor.name;}get name(){return this._name}toJSON(){return {name:this.name}}};_(be,"A_Fragment");var J=be;var Ye=class Ye{static resolve(){return new Promise(e=>e())}static isInheritedFrom(e,t){let r=e;for(;r;){if(r===t)return true;r=Object.getPrototypeOf(r);}return false}static getParentClasses(e){let t=Object.getPrototypeOf(typeof e=="function"?e:e.constructor),r=[];for(;t&&t!==Function.prototype;)r.push(t),t=Object.getPrototypeOf(t);return r}static getClassInheritanceChain(e){let t=Object.getPrototypeOf(typeof e=="function"?e:e.constructor),r=typeof e=="function"?[e]:[e.constructor];for(;t&&t!==Function.prototype;)r.push(t),t=Object.getPrototypeOf(t);return r}static getParentClass(e){return Object.getPrototypeOf(e)}static omitProperties(e,t){let r=JSON.parse(JSON.stringify(e));function n(i,s){let a=s[0];s.length===1?delete i[a]:i[a]!==void 0&&typeof i[a]=="object"&&n(i[a],s.slice(1));}return _(n,"removeProperties"),t.forEach(i=>{let s=i.split(".");n(r,s);}),r}static isObject(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}static deepMerge(e,t,r=new Map){if(this.isObject(e)&&this.isObject(t))for(let n in t)this.isObject(t[n])?(e[n]||(e[n]={}),r.has(t[n])?e[n]=r.get(t[n]):(r.set(t[n],{}),this.deepMerge(e[n],t[n],r))):e[n]=t[n];return e}static deepClone(e){if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(t=>this.deepClone(t));if(typeof e=="function")return e;if(e instanceof Object){let t={};for(let r in e)e.hasOwnProperty(r)&&(t[r]=this.deepClone(e[r]));return t}throw new Error("Unable to clone the object. Unsupported type.")}static deepCloneAndMerge(e,t){if(t==null&&e==null)return e;if(e==null&&t)return this.deepClone(t);if(typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(r=>this.deepCloneAndMerge(r,t));if(typeof e=="function")return e;if(e instanceof Object){let r={};for(let n in e)t[n]!==null&&t[n]!==void 0?r[n]=this.deepCloneAndMerge(e[n],t[n]):r[n]=this.deepClone(e[n]);for(let n in t)e[n]!==void 0&&e[n]!==null?r[n]=this.deepCloneAndMerge(e[n],t[n]):r[n]=this.deepClone(t[n]);return r}throw new Error("Unable to clone the object. Unsupported type.")}static getComponentName(e){let t="Unknown",r="Anonymous";if(e==null)return t;if(typeof e=="string")return e||t;if(typeof e=="symbol")try{return e.toString()}catch{return t}if(Array.isArray(e))return e.length===0?t:this.getComponentName(e[0]);if(typeof e=="function"){let n=e;if(n.displayName)return String(n.displayName);if(n.name)return String(n.name);if(n.constructor&&n.constructor.name)return String(n.constructor.name);try{let s=Function.prototype.toString.call(e).match(/^(?:class\s+([A-Za-z0-9_$]+)|function\s+([A-Za-z0-9_$]+)|([A-Za-z0-9_$]+)\s*=>)/);if(s)return s[1]||s[2]||s[3]||r}catch{}return r}if(typeof e=="object"){let n=e;if(n.type)return this.getComponentName(n.type);if(n.displayName)return String(n.displayName);if(n.name)return String(n.name);if(n.constructor&&n.constructor.name&&n.constructor.name!=="Object")return String(n.constructor.name);try{let i=n.toString();if(typeof i=="string"&&i!=="[object Object]")return i}catch{}return r}try{return String(e)}catch{return t}}};_(Ye,"A_CommonHelper");var m=Ye;var L=class L extends f{};_(L,"A_ScopeError"),L.InitializationError="A-Scope Initialization Error",L.ConstructorError="Unable to construct A-Scope instance",L.ResolutionError="A-Scope Resolution Error",L.RegistrationError="A-Scope Registration Error",L.CircularInheritanceError="A-Scope Circular Inheritance Error",L.CircularImportError="A-Scope Circular Import Error",L.DeregistrationError="A-Scope Deregistration Error";var E=L;var q=class q extends f{};_(q,"A_DependencyError"),q.InvalidDependencyTarget="Invalid Dependency Target",q.InvalidLoadTarget="Invalid Load Target",q.InvalidLoadPath="Invalid Load Path",q.InvalidDefaultTarget="Invalid Default Target",q.ResolutionParametersError="Dependency Resolution Parameters Error";var h=q;function we(...c){return function(e,t,r){let n=m.getComponentName(e);if(!o.isTargetAvailableForInjection(e))throw new h(h.InvalidDefaultTarget,`A-Default cannot be used on the target of type ${typeof e} (${n})`);let i=t?String(t):"constructor",s;switch(true){case(o.isComponentConstructor(e)||o.isComponentInstance(e)):s="a-component-injections";break;case o.isContainerInstance(e):s="a-container-injections";break;case o.isEntityInstance(e):s="a-component-injections";break}let a=p.meta(e).get(s)||new A,u=a.get(i)||[];u[r].resolutionStrategy={create:true,args:c},a.set(i,u),p.meta(e).set(s,a);}}_(we,"A_Dependency_Default");function Ze(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new h(h.InvalidDependencyTarget,`A-Dependency cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={flat:true},s.set(n,a),p.meta(c).set(i,s);}}_(Ze,"A_Dependency_Flat");function xe(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new h(h.InvalidLoadTarget,`A-Load cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={load:true},s.set(n,a),p.meta(c).set(i,s);}}_(xe,"A_Dependency_Load");function We(c=-1){return function(e,t,r){let n=m.getComponentName(e);if(!o.isTargetAvailableForInjection(e))throw new h(h.InvalidDependencyTarget,`A-Dependency cannot be used on the target of type ${typeof e} (${n})`);let i=t?String(t):"constructor",s;switch(true){case(o.isComponentConstructor(e)||o.isComponentInstance(e)):s="a-component-injections";break;case o.isContainerInstance(e):s="a-container-injections";break;case o.isEntityInstance(e):s="a-component-injections";break}let a=p.meta(e).get(s)||new A,u=a.get(i)||[];u[r].resolutionStrategy={parent:c},a.set(i,u),p.meta(e).set(s,a);}}_(We,"A_Dependency_Parent");function De(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new h(h.InvalidDependencyTarget,`A-Dependency cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={require:true},s.set(n,a),p.meta(c).set(i,s);}}_(De,"A_Dependency_Require");function Xe(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new h(h.InvalidDependencyTarget,`A-All cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={pagination:{...a[t].resolutionStrategy.pagination,count:-1}},s.set(n,a),p.meta(c).set(i,s);}}_(Xe,"A_Dependency_All");var ve=class ve{constructor(e,t){this._defaultPagination={count:1,from:"start"};this._defaultResolutionStrategy={require:false,load:false,parent:0,flat:false,create:false,args:[],query:{},pagination:this._defaultPagination};this._name=typeof e=="string"?e:m.getComponentName(e),this._target=typeof e=="string"?void 0:e,this.resolutionStrategy=t||{},this.initCheck();}static get Required(){return De}static get Loaded(){return xe}static get Default(){return we}static get Parent(){return We}static get Flat(){return Ze}static get All(){return Xe}get flat(){return this._resolutionStrategy.flat}get require(){return this._resolutionStrategy.require}get load(){return this._resolutionStrategy.load}get all(){return this._resolutionStrategy.pagination.count!==1||Object.keys(this._resolutionStrategy.query).length>0}get parent(){return this._resolutionStrategy.parent}get create(){return this._resolutionStrategy.create}get args(){return this._resolutionStrategy.args}get query(){return this._resolutionStrategy.query}get pagination(){return this._resolutionStrategy.pagination}get name(){return this._name}get target(){return this._target}get resolutionStrategy(){return this._resolutionStrategy}set resolutionStrategy(e){this._resolutionStrategy={...this._defaultResolutionStrategy,...this._resolutionStrategy,...e,pagination:{...this._defaultPagination,...(this._resolutionStrategy||{}).pagination,...e.pagination||{}}};}initCheck(){if(!this._resolutionStrategy)throw new h(h.ResolutionParametersError,`Resolution strategy parameters are not provided for dependency: ${this._name}`);return this}toJSON(){return {name:this._name,all:this.all,require:this.require,load:this.load,parent:this.parent,flat:this.flat,create:this.create,args:this.args,query:this.query,pagination:this.pagination}}};_(ve,"A_Dependency");var v=ve;var Fe=class Fe{constructor(e,t){this._meta=new A;this._allowedComponents=new Set;this._allowedErrors=new Set;this._allowedEntities=new Set;this._allowedFragments=new Set;this._components=new Map;this._errors=new Map;this._entities=new Map;this._fragments=new Map;this._imports=new Set;this.getInitializer(e).call(this,e,t);}get name(){return this._name}get meta(){return this._meta}get allowedComponents(){return this._allowedComponents}get allowedEntities(){return this._allowedEntities}get allowedFragments(){return this._allowedFragments}get allowedErrors(){return this._allowedErrors}get entities(){return Array.from(this._entities.values())}get fragments(){return Array.from(this._fragments.values())}get components(){return Array.from(this._components.values())}get errors(){return Array.from(this._errors.values())}get imports(){return Array.from(this._imports.values())}get parent(){return this._parent}*parents(){let e=this._parent;for(;e;)yield e,e=e._parent;}parentOffset(e){let t=this;for(;e<=-1&&t;)t=t.parent,e++;return t}getInitializer(e,t){switch(true){case(!e&&!t):return this.defaultInitialized;case !!e:return this.defaultInitialized;default:throw new E(E.ConstructorError,"Invalid parameters provided to A_Scope constructor")}}defaultInitialized(e={},t={}){this._name=e.name||this.constructor.name,this.initComponents(e.components),this.initErrors(e.errors),this.initFragments(e.fragments),this.initEntities(e.entities),this.initMeta(e.meta),t.parent&&(this._parent=t.parent);}initComponents(e){e?.forEach(this.register.bind(this));}initErrors(e){e?.forEach(this.register.bind(this));}initEntities(e){e?.forEach(t=>this.register(t));}initFragments(e){e?.forEach(this.register.bind(this));}initMeta(e){e&&Object.entries(e).forEach(([t,r])=>{this._meta.set(t,r);});}destroy(){this._components.forEach(e=>p.deregister(e)),this._fragments.forEach(e=>p.deregister(e)),this._entities.forEach(e=>p.deregister(e)),this._components.clear(),this._errors.clear(),this._fragments.clear(),this._entities.clear(),this._imports.clear(),this.issuer()&&p.deallocate(this);}get(e){return this._meta.get(e)}set(e,t){this._meta.set(e,t);}issuer(){return p.issuer(this)}inherit(e){if(!e)throw new E(E.InitializationError,"Invalid parent scope provided");if(e===this)throw new E(E.CircularInheritanceError,`Unable to inherit scope ${this.name} from itself`);if(e===this._parent)return this;let t=this.checkCircularInheritance(e);if(t)throw new E(E.CircularInheritanceError,`Circular inheritance detected: ${[...t,e.name].join(" -> ")}`);return this._parent=e,this}import(...e){return e.forEach(t=>{if(t===this)throw new E(E.CircularImportError,`Unable to import scope ${this.name} into itself`);this._imports.has(t)||this._imports.add(t);}),this}deimport(...e){return e.forEach(t=>{this._imports.has(t)&&this._imports.delete(t);}),this}has(e){let t=this.hasFlat(e);if(!t&&this._parent)try{return this._parent.has(e)}catch{return false}return t}hasFlat(e){let t=false;switch(true){case o.isScopeConstructor(e):return true;case o.isString(e):{Array.from(this.allowedComponents).find(a=>a.name===e)&&(t=true),Array.from(this.allowedFragments).find(a=>a.name===e)&&(t=true),Array.from(this.allowedEntities).find(a=>a.name===e)&&(t=true),Array.from(this.allowedErrors).find(a=>a.name===e)&&(t=true);break}case o.isComponentConstructor(e):{t=this.isAllowedComponent(e)||!![...this.allowedComponents].find(r=>m.isInheritedFrom(r,e));break}case o.isEntityConstructor(e):{t=this.isAllowedEntity(e)||!![...this.allowedEntities].find(r=>m.isInheritedFrom(r,e));break}case o.isFragmentConstructor(e):{t=this.isAllowedFragment(e)||!![...this.allowedFragments].find(r=>m.isInheritedFrom(r,e));break}case o.isErrorConstructor(e):{t=this.isAllowedError(e)||!![...this.allowedErrors].find(r=>m.isInheritedFrom(r,e));break}case(this.issuer()&&(this.issuer().constructor===e||m.isInheritedFrom(this.issuer().constructor,e))):{t=true;break}}return t}resolveDependency(e){let t=[],r=this.parentOffset(e.parent)||this;switch(true){case(e.flat&&!e.all):{let d=r.resolveFlatOnce(e.target||e.name);d&&(t=[d]);break}case(e.flat&&e.all):{t=r.resolveFlatAll(e.target||e.name);break}case(!e.flat&&!e.all):{let d=r.resolveOnce(e.target||e.name);d&&(t=[d]);break}case(!e.flat&&e.all):{t=r.resolveAll(e.target||e.name);break}default:t=[];}if(e.create&&!t.length&&o.isAllowedForDependencyDefaultCreation(e.target)){let d=new e.target(...e.args);r.register(d),t.push(d);}if(e.require&&!t.length)throw new E(E.ResolutionError,`Dependency ${e.name} is required but could not be resolved in scope ${r.name}`);e.query.aseid?t=t.filter(d=>o.hasASEID(d)&&I.compare(d.aseid,e.query.aseid)):Object.keys(e.query).length>0&&(t=t.filter(d=>{let y=e.query;return y?Object.entries(y).every(([g,D])=>d[g]===D):true}));let n=e.pagination.count,i=e.pagination.from,s=i==="end"?n===-1?0:Math.max(t.length-n,0):0,a=i==="end"||n===-1?t.length:Math.min(n,t.length),u=t.slice(s,a);return u.length===1&&n!==-1?u[0]:u.length?u:void 0}resolveConstructor(e){let t=Array.from(this.allowedComponents).find(i=>i.name===e||i.name===C.toPascalCase(e));if(t)return t;{let i=Array.from(this.allowedComponents).find(s=>{let a=s;for(;a;){if(a.name===e||a.name===C.toPascalCase(e))return true;a=Object.getPrototypeOf(a);}return false});if(i)return i}let r=Array.from(this.allowedEntities).find(i=>i.name===e||i.name===C.toPascalCase(e)||i.entity===e||i.entity===C.toKebabCase(e));if(r)return r;{let i=Array.from(this.allowedEntities).find(s=>m.isInheritedFrom(s,e));if(i)return i}let n=Array.from(this.allowedFragments).find(i=>i.name===e||i.name===C.toPascalCase(e));if(n)return n;{let i=Array.from(this.allowedFragments).find(s=>m.isInheritedFrom(s,e));if(i)return i}for(let i of this._imports){let s=i.resolveConstructor(e);if(s)return s}if(this._parent)return this._parent.resolveConstructor(e)}resolveAll(e){let t=new Set;this.resolveFlatAll(e).forEach(i=>t.add(i)),this._imports.forEach(i=>{i.has(e)&&i.resolveFlatAll(e).forEach(a=>t.add(a));});let n=this._parent;for(;n&&n.has(e);)n.resolveAll(e).forEach(s=>t.add(s)),n=n._parent;return Array.from(t)}resolveFlatAll(e){let t=[];switch(true){case o.isComponentConstructor(e):{this.allowedComponents.forEach(r=>{if(m.isInheritedFrom(r,e)){let n=this.resolveOnce(r);n&&t.push(n);}});break}case o.isFragmentConstructor(e):{this.allowedFragments.forEach(r=>{if(m.isInheritedFrom(r,e)){let n=this.resolveOnce(r);n&&t.push(n);}});break}case o.isEntityConstructor(e):{this.entities.forEach(r=>{m.isInheritedFrom(r.constructor,e)&&t.push(r);});break}case o.isString(e):{let r=this.resolveConstructor(e);if(!o.isComponentConstructor(r)&&!o.isEntityConstructor(r)&&!o.isFragmentConstructor(r))throw new E(E.ResolutionError,`Unable to resolve all instances for name: ${e} in scope ${this.name} as no matching component, entity or fragment constructor found`);if(r){let n=this.resolveAll(r);n&&t.push(...n);}break}default:throw new E(E.ResolutionError,`Invalid parameter provided to resolveAll method: ${e} in scope ${this.name}`)}return t}resolve(e){let t=o.isDependencyInstance(e)?e:new v(e);return this.resolveDependency(t)}resolveOnce(e){let t=this.resolveFlatOnce(e);if(!t){for(let r of this._imports)if(r.has(e)){let n=r.resolveFlatOnce(e);if(n)return n}}return !t&&this.parent?this.parent.resolveOnce(e):t}resolveFlat(e){return this.resolveFlatOnce(e)}resolveFlatOnce(e){let t,r=m.getComponentName(e);if(!(!e||!this.has(e))){switch(true){case o.isString(e):{t=this.resolveByName(e);break}case o.isConstructorAllowedForScopeAllocation(e):{t=this.resolveIssuer(e);break}case o.isScopeConstructor(e):{t=this.resolveScope(e);break}case o.isEntityConstructor(e):{t=this.resolveEntity(e);break}case o.isFragmentConstructor(e):{t=this.resolveFragment(e);break}case o.isComponentConstructor(e):{t=this.resolveComponent(e);break}case o.isErrorConstructor(e):{t=this.resolveError(e);break}default:throw new E(E.ResolutionError,`Injected Component ${r} not found in the scope`)}return t}}resolveByName(e){let t=Array.from(this.allowedComponents).find(s=>s.name===e||s.name===C.toPascalCase(e));if(t)return this.resolveOnce(t);let r=Array.from(this.allowedEntities).find(s=>s.name===e||s.name===C.toPascalCase(e)||s.entity===e||s.entity===C.toKebabCase(e));if(r)return this.resolveOnce(r);let n=Array.from(this.allowedFragments).find(s=>s.name===e||s.name===C.toPascalCase(e));if(n)return this.resolveOnce(n);let i=Array.from(this.allowedErrors).find(s=>s.name===e||s.name===C.toPascalCase(e)||s.code===e||s.code===C.toKebabCase(e));if(i)return this.resolveOnce(i)}resolveIssuer(e){let t=this.issuer();if(t&&(t.constructor===e||m.isInheritedFrom(t?.constructor,e)))return t}resolveEntity(e){return this.entities.find(t=>t instanceof e)}resolveError(e){return this.errors.find(t=>t instanceof e)}resolveFragment(e){let t=this._fragments.get(e);switch(true){case(t&&this._fragments.has(e)):return t;case(!t&&Array.from(this._allowedFragments).some(r=>m.isInheritedFrom(r,e))):{let r=Array.from(this._allowedFragments).find(n=>m.isInheritedFrom(n,e));return this.resolveFragment(r)}default:return}}resolveScope(e){return this}resolveComponent(e){switch(true){case(this.allowedComponents.has(e)&&this._components.has(e)):return this._components.get(e);case(this.allowedComponents.has(e)&&!this._components.has(e)):{let n=(p.meta(e).get("a-component-injections")?.get("constructor")||[]).map(s=>this.resolve(s)),i=new e(...n);return this.register(i),this._components.get(e)}case(!this.allowedComponents.has(e)&&Array.from(this.allowedComponents).some(t=>m.isInheritedFrom(t,e))):{let t=Array.from(this.allowedComponents).find(r=>m.isInheritedFrom(r,e));return this.resolveComponent(t)}default:return}}register(e){switch(true){case e instanceof M:{this.allowedComponents.has(e.constructor)||this.allowedComponents.add(e.constructor),this._components.set(e.constructor,e),p.register(this,e);break}case(o.isEntityInstance(e)&&!this._entities.has(e.aseid.toString())):{this.allowedEntities.has(e.constructor)||this.allowedEntities.add(e.constructor),this._entities.set(e.aseid.toString(),e),p.register(this,e);break}case o.isFragmentInstance(e):{this.allowedFragments.has(e.constructor)||this.allowedFragments.add(e.constructor),this._fragments.set(e.constructor,e),p.register(this,e);break}case o.isErrorInstance(e):{this.allowedErrors.has(e.constructor)||this.allowedErrors.add(e.constructor),this._errors.set(e.code,e),p.register(this,e);break}case o.isComponentConstructor(e):{this.allowedComponents.has(e)||this.allowedComponents.add(e);break}case o.isFragmentConstructor(e):{this.allowedFragments.has(e)||this.allowedFragments.add(e);break}case o.isEntityConstructor(e):{this.allowedEntities.has(e)||this.allowedEntities.add(e);break}case o.isErrorConstructor(e):{this.allowedErrors.has(e)||this.allowedErrors.add(e);break}default:if(e instanceof k)throw new E(E.RegistrationError,`Entity with ASEID ${e.aseid.toString()} is already registered in the scope ${this.name}`);if(e instanceof J)throw new E(E.RegistrationError,`Fragment ${e.constructor.name} is already registered in the scope ${this.name}`);{let t=m.getComponentName(e);throw new E(E.RegistrationError,`Cannot register ${t} in the scope ${this.name}`)}}}deregister(e){switch(true){case e instanceof M:{this._components.delete(e.constructor),p.deregister(e);break}case o.isEntityInstance(e):{this._entities.delete(e.aseid.toString()),p.deregister(e);break}case o.isFragmentInstance(e):{this._fragments.delete(e.constructor),p.deregister(e);break}case o.isErrorInstance(e):{this._errors.delete(e.code),p.deregister(e);break}case o.isComponentConstructor(e):{this.allowedComponents.delete(e);break}case o.isFragmentConstructor(e):{this.allowedFragments.delete(e);break}case o.isEntityConstructor(e):{this.allowedEntities.delete(e);break}case o.isErrorConstructor(e):{this.allowedErrors.delete(e);break}default:let t=m.getComponentName(e);throw new E(E.DeregistrationError,`Cannot deregister ${t} from the scope ${this.name}`)}}toJSON(){return this.fragments.reduce((e,t)=>{let r=t.toJSON();return {...e,[r.name]:r}},{})}isAllowedComponent(e){return o.isComponentConstructor(e)&&this.allowedComponents.has(e)}isAllowedEntity(e){return o.isEntityConstructor(e)&&this.allowedEntities.has(e)}isAllowedFragment(e){return o.isFragmentConstructor(e)&&this.allowedFragments.has(e)}isAllowedError(e){return o.isErrorConstructor(e)&&this.allowedErrors.has(e)}isInheritedFrom(e){let t=this;for(;t;){if(t===e)return true;t=t._parent;}return false}checkCircularInheritance(e){let t=[],r=this._parent;for(;r;){if(t.push(r.name),r===e)return t;r=r._parent;}return false}printInheritanceChain(){let e=[],t=this;for(;t;)e.push(t.name),t=t._parent;console.log(e.join(" -> "));}};_(Fe,"A_Scope");var F=Fe;var de=class de extends f{};_(de,"A_CallerError"),de.CallerInitializationError="Unable to initialize A-Caller";var re=de;var Me=class Me{constructor(e){this.validateParams(e),this._component=e;}get component(){return this._component}validateParams(e){if(!o.isAllowedForFeatureCall(e))throw new re(re.CallerInitializationError,`Invalid A-Caller component provided of type: ${typeof e} with value: ${JSON.stringify(e).slice(0,100)}...`)}};_(Me,"A_Caller");var V=Me;var T=class T{static isString(e){return typeof e=="string"||e instanceof String}static isNumber(e){return typeof e=="number"&&isFinite(e)}static isBoolean(e){return typeof e=="boolean"}static isArray(e){return Array.isArray(e)}static isObject(e){return e&&typeof e=="object"&&!Array.isArray(e)}static isFunction(e){return typeof e=="function"}static isUndefined(e){return typeof e>"u"}static isRegExp(e){return e instanceof RegExp}static isContainerConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,z)}static isComponentConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,M)}static isFragmentConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,J)}static isEntityConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,k)}static isScopeConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,F)}static isErrorConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,f)}static isFeatureConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,Y)}static isCallerConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,V)}static isDependencyConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,v)}static isDependencyInstance(e){return e instanceof v}static isContainerInstance(e){return e instanceof z}static isComponentInstance(e){return e instanceof M}static isFeatureInstance(e){return e instanceof Y}static isFragmentInstance(e){return e instanceof J}static isEntityInstance(e){return e instanceof k}static isScopeInstance(e){return e instanceof F}static isErrorInstance(e){return e instanceof f}static isComponentMetaInstance(e){return e instanceof j}static isContainerMetaInstance(e){return e instanceof K}static isEntityMetaInstance(e){return e instanceof B}static hasASEID(e){return e&&typeof e=="object"&&"aseid"&&(T.isEntityInstance(e)||T.isErrorInstance(e))}static isConstructorAllowedForScopeAllocation(e){return T.isContainerConstructor(e)||T.isFeatureConstructor(e)}static isInstanceAllowedForScopeAllocation(e){return T.isContainerInstance(e)||T.isFeatureInstance(e)}static isConstructorAvailableForAbstraction(e){return T.isContainerInstance(e)||T.isComponentInstance(e)}static isTargetAvailableForInjection(e){return T.isComponentConstructor(e)||T.isComponentInstance(e)||T.isContainerInstance(e)||T.isEntityInstance(e)}static isAllowedForFeatureCall(e){return T.isContainerInstance(e)||T.isComponentInstance(e)||T.isEntityInstance(e)}static isAllowedForFeatureDefinition(e){return T.isContainerInstance(e)||T.isComponentInstance(e)||T.isEntityInstance(e)}static isAllowedForFeatureExtension(e){return T.isComponentInstance(e)||T.isContainerInstance(e)||T.isEntityInstance(e)}static isAllowedForAbstractionDefinition(e){return T.isContainerInstance(e)||T.isComponentInstance(e)}static isAllowedForDependencyDefaultCreation(e){return T.isFragmentConstructor(e)||m.isInheritedFrom(e,J)||T.isEntityConstructor(e)||m.isInheritedFrom(e,k)}static isErrorConstructorType(e){return !!e&&T.isObject(e)&&!(e instanceof Error)&&"title"in e}static isErrorSerializedType(e){return !!e&&T.isObject(e)&&!(e instanceof Error)&&"aseid"in e&&I.isASEID(e.aseid)}};_(T,"A_TypeGuards");var o=T;var G=class G extends f{fromConstructor(e){super.fromConstructor(e),this.stage=e.stage;}};_(G,"A_FeatureError"),G.Interruption="Feature Interrupted",G.FeatureInitializationError="Unable to initialize A-Feature",G.FeatureProcessingError="Error occurred during A-Feature processing",G.FeatureDefinitionError="Unable to define A-Feature",G.FeatureExtensionError="Unable to extend A-Feature";var S=G;function Oe(c={}){return function(e,t,r){let n=m.getComponentName(e);if(!o.isAllowedForFeatureDefinition(e))throw new S(S.FeatureDefinitionError,`A-Feature cannot be defined on the ${n} level`);let i=p.meta(e.constructor),s;switch(true){case o.isEntityInstance(e):s="a-component-features";break;case o.isContainerInstance(e):s="a-container-features";break;case o.isComponentInstance(e):s="a-component-features";break}let a=i.get(s)||new A,u=c.name||t,d=c.invoke||false;a.set(t,{name:`${e.constructor.name}.${u}`,handler:t,invoke:d,template:c.template&&c.template.length?c.template.map(g=>({...g,before:g.before||"",after:g.after||"",behavior:g.behavior||"sync",throwOnError:true,override:g.override||""})):[]}),p.meta(e.constructor).set(s,a);let y=r.value;return r.value=function(...g){if(d)y.apply(this,g);else return y.apply(this,g);if(typeof this.call=="function"&&d)return this.call(u)},r}}_(Oe,"A_Feature_Define");function Ne(c){return function(e,t,r){let n=m.getComponentName(e);if(!o.isAllowedForFeatureExtension(e))throw new S(S.FeatureExtensionError,`A-Feature-Extend cannot be applied on the ${n} level`);let i,s="sync",a="",u="",d="",y=[],g=[],D=true,R;switch(true){case o.isEntityInstance(e):R="a-component-extensions";break;case o.isContainerInstance(e):R="a-container-extensions";break;case o.isComponentInstance(e):R="a-component-extensions";break}switch(true){case o.isRegExp(c):i=c;break;case(!!c&&typeof c=="object"):Array.isArray(c.scope)?y=c.scope:c.scope&&typeof c.scope=="object"&&(Array.isArray(c.scope.include)&&(y=c.scope.include),Array.isArray(c.scope.exclude)&&(g=c.scope.exclude)),i=st(c,y,g,t),s=c.behavior||s,D=c.throwOnError!==void 0?c.throwOnError:D,a=o.isArray(c.before)?new RegExp(`^${c.before.join("|").replace(/\./g,"\\.")}$`).source:c.before instanceof RegExp?c.before.source:"",u=o.isArray(c.after)?new RegExp(`^${c.after.join("|").replace(/\./g,"\\.")}$`).source:c.after instanceof RegExp?c.after.source:"",d=o.isArray(c.override)?new RegExp(`^${c.override.join("|").replace(/\./g,"\\.")}$`).source:c.override instanceof RegExp?c.override.source:"";break;default:i=new RegExp(`^.*${t.replace(/\./g,"\\.")}$`);break}let X=p.meta(e).get(R),Be=p.meta(e),Q=Be.get(R)?new A().from(Be.get(R)):new A;if(X&&X.size()&&X.has(t)&&X.get(t).invoke)throw new S(S.FeatureExtensionError,`A-Feature-Extend cannot be used on the method "${t}" because it is already defined as a Feature with "invoke" set to true. Please remove the A-Feature-Extend decorator or set "invoke" to false in the A-Feature decorator.`);let pe=[...Q.get(i.source)||[]];for(let[ie,me]of Q.entries()){let Ge=me.findIndex(Qe=>Qe.handler===t);ie!==i.source&&Ge!==-1&&(me.splice(Ge,1),me.length===0?Q.delete(ie):Q.set(ie,me));}let qe=pe.findIndex(ie=>ie.handler===t),Ve={name:i.source,handler:t,behavior:s,before:a,after:u,throwOnError:D,override:d};qe!==-1?pe[qe]=Ve:pe.push(Ve),Q.set(i.source,pe),p.meta(e).set(R,Q);}}_(Ne,"A_Feature_Extend");function st(c,e,t,r){let n=e.length?`(${e.map(a=>a.name).join("|")})`:".*",i=t.length?`(?!${t.map(a=>a.name).join("|")})`:"",s=c.scope?`^${i}${n}\\.${c.name||r}$`:`.*\\.${c.name||r}$`;return new RegExp(s)}_(st,"buildTargetRegexp");var at=(s=>(s.PROCESSING="PROCESSING",s.COMPLETED="COMPLETED",s.FAILED="FAILED",s.SKIPPED="SKIPPED",s.INITIALIZED="INITIALIZED",s.ABORTED="ABORTED",s))(at||{});var Ae=class Ae extends f{static get CompileError(){return "Unable to compile A-Stage"}};_(Ae,"A_StageError"),Ae.ArgumentsResolutionError="A-Stage Arguments Resolution Error";var H=Ae;var Re=class Re{constructor(e,t){this._status="INITIALIZED";this._feature=e,this._definition=t;}get name(){return this.toString()}get definition(){return this._definition}get status(){return this._status}get feature(){return this._feature}get isProcessed(){return this._status==="COMPLETED"||this._status==="FAILED"||this._status==="SKIPPED"}get error(){return this._error}async getStepArgs(e,t){let r=t.dependency.target||e.resolveConstructor(t.dependency.name);return Promise.all(p.meta(r).injections(t.handler).map(async n=>{switch(true){case o.isCallerConstructor(n.target):return this._feature.caller.component;case o.isFeatureConstructor(n.target):return this._feature;default:return e.resolve(n)}}))}getStepComponent(e,t){let{dependency:r,handler:n}=t,i=e.resolve(r)||this.feature.scope.resolve(r);if(!i)throw new H(H.CompileError,`Unable to resolve component ${r.name} from scope ${e.name}`);if(!i[n])throw new H(H.CompileError,`Handler ${n} not found in ${i.constructor.name}`);return i}async callStepHandler(e,t){let r=await this.getStepComponent(t,e),n=await this.getStepArgs(t,e);return await r[e.handler](...n)}skip(){this._status="SKIPPED";}async process(e){let t=o.isScopeInstance(e)?e:this._feature.scope;return this._processed||(this._processed=new Promise(async(r,n)=>{try{return this._status="PROCESSING",this._definition.behavior==="sync"?await this.callStepHandler(this._definition,t):this.callStepHandler(this._definition,t),this.completed(),r()}catch(i){let s=new f(i);return this.failed(s),this._definition.throwOnError?r():n(s)}})),this._processed}completed(){this._status="COMPLETED";}failed(e){this._error=new f(e),this._status="FAILED";}toJSON(){return {name:this.name,status:this.status}}toString(){return `A-Stage(${this._feature.name}::${this._definition.behavior}@${this._definition.handler})`}};_(Re,"A_Stage");var ae=Re;var fe=class fe extends f{};_(fe,"A_StepManagerError"),fe.CircularDependencyError="A-StepManager Circular Dependency Error";var ne=fe;var ke=class ke{constructor(e){this._isBuilt=false;this.entities=this.prepareSteps(e),this.graph=new Map,this.visited=new Set,this.tempMark=new Set,this.sortedEntities=[];}prepareSteps(e){return e.map(t=>({...t,behavior:t.behavior||"sync",before:t.before||"",after:t.after||"",override:t.override||"",throwOnError:false}))}ID(e){return `${e.dependency.name}.${e.handler}`}buildGraph(){this._isBuilt||(this._isBuilt=true,this.entities=this.entities.filter((e,t,r)=>!r.some(n=>n.override?new RegExp(n.override).test(this.ID(e)):false)),this.entities.forEach(e=>this.graph.set(this.ID(e),new Set)),this.entities.forEach(e=>{let t=this.ID(e);e.before&&this.matchEntities(t,e.before).forEach(n=>{this.graph.has(n)||this.graph.set(n,new Set),this.graph.get(n).add(t);}),e.after&&this.matchEntities(t,e.after).forEach(n=>{this.graph.has(t)||this.graph.set(t,new Set),this.graph.get(t).add(n);});}));}matchEntities(e,t){let r=new RegExp(t);return this.entities.filter(n=>r.test(this.ID(n))&&this.ID(n)!==e).map(n=>this.ID(n))}visit(e){this.tempMark.has(e)||this.visited.has(e)||(this.tempMark.add(e),(this.graph.get(e)||[]).forEach(t=>this.visit(t)),this.tempMark.delete(e),this.visited.add(e),this.sortedEntities.push(e));}toSortedArray(){return this.buildGraph(),this.entities.forEach(e=>{this.visited.has(this.ID(e))||this.visit(this.ID(e));}),this.sortedEntities}toStages(e){return this.toSortedArray().map(r=>{let n=this.entities.find(i=>this.ID(i)===r);return new ae(e,n)})}};_(ke,"A_StepsManager");var oe=ke;var _e=class _e{constructor(e){this._stages=[];this._index=0;this._state="INITIALIZED";this.validateParams(e),this.getInitializer(e).call(this,e);}static get Define(){return Oe}static get Extend(){return Ne}get name(){return this._name}get error(){return this._error}get state(){return this._state}get index(){return this._index}get stage(){return this._current}get caller(){return this._caller}get scope(){return p.scope(this)}get size(){return this._stages.length}get isDone(){return !this.stage||this._index>=this._stages.length}get isProcessed(){return this.state==="COMPLETED"||this.state==="FAILED"||this.state==="INTERRUPTED"}[Symbol.iterator](){return {next:_(()=>this.isDone?(this._current=void 0,{value:void 0,done:true}):(this._current=this._stages[this._index],this._index++,{value:this._current,done:false}),"next")}}validateParams(e){if(!e||typeof e!="object")throw new S(S.FeatureInitializationError,`Invalid A-Feature initialization parameters of type: ${typeof e} with value: ${JSON.stringify(e).slice(0,100)}...`)}getInitializer(e){switch(true){case !("template"in e):return this.fromComponent;case "template"in e:return this.fromTemplate;default:throw new S(S.FeatureInitializationError,`Invalid A-Feature initialization parameters of type: ${typeof e} with value: ${JSON.stringify(e).slice(0,100)}...`)}}fromTemplate(e){if(!e.template||!Array.isArray(e.template))throw new S(S.FeatureInitializationError,`Invalid A-Feature template provided of type: ${typeof e.template} with value: ${JSON.stringify(e.template).slice(0,100)}...`);if(!e.component&&(!e.scope||!(e.scope instanceof F)))throw new S(S.FeatureInitializationError,`Invalid A-Feature scope provided of type: ${typeof e.scope} with value: ${JSON.stringify(e.scope).slice(0,100)}...`);this._name=e.name;let t,r=e.scope;try{e.component&&(t=p.scope(e.component));}catch(i){if(!r)throw i}t&&r&&!r.isInheritedFrom(t)&&r.inherit(t),this._caller=new V(e.component||new M),p.allocate(this).inherit(t||r),this._SM=new oe(e.template),this._stages=this._SM.toStages(this),this._current=this._stages[0];}fromComponent(e){if(!e.component||!o.isAllowedForFeatureDefinition(e.component))throw new S(S.FeatureInitializationError,`Invalid A-Feature component provided of type: ${typeof e.component} with value: ${JSON.stringify(e.component).slice(0,100)}...`);this._name=e.name;let t,r=e.scope;try{t=p.scope(e.component);}catch(s){if(!r)throw s}t&&r&&!r.isInheritedFrom(t)&&r.inherit(t),this._caller=new V(e.component);let n=p.allocate(this);n.inherit(t||r);let i=p.featureTemplate(this._name,this._caller.component,n);this._SM=new oe(i),this._stages=this._SM.toStages(this),this._current=this._stages[0];}async process(e){try{if(this.isProcessed)return;this._state="PROCESSING";for(let t of this)await t.process(e);return await this.completed()}catch(t){return await this.failed(new S({title:S.FeatureProcessingError,description:`An error occurred while processing the A-Feature: ${this.name}. Failed at stage: ${this.stage?.name||"N/A"}.`,stage:this.stage,originalError:t}))}}next(e){let t=this._stages.indexOf(e);this._index=t+1,this._index>=this._stages.length&&this.completed();}async completed(){this.isProcessed||(this._state="COMPLETED",this.scope.destroy());}async failed(e){if(!this.isProcessed)throw this._state="FAILED",this._error=e,this.scope.destroy(),this._error}async interrupt(e){if(!this.isProcessed){switch(this._state="INTERRUPTED",true){case o.isString(e):this._error=new S(S.Interruption,e);break;case o.isErrorInstance(e):this._error=new S({code:S.Interruption,title:e.title,description:e.description,stage:this.stage,originalError:e});break;}this.scope.destroy();}}chain(e,t,r){let n,i;e instanceof _e?(n=e,i=t instanceof F?t:void 0):(n=new _e({name:t,component:e}),i=r instanceof F?r:void 0);let s=i||this.scope;return n._caller=this._caller,n.process(s)}toString(){return `A-Feature(${this.caller.component?.constructor?.name||"Unknown"}::${this.name})`}};_(_e,"A_Feature");var Y=_e;var je=class je{async call(e,t){return await new Y({name:e,component:this}).process(t)}};_(je,"A_Component");var M=je;var P=class P extends f{};_(P,"A_ContextError"),P.NotAllowedForScopeAllocationError="Component is not allowed for scope allocation",P.ComponentAlreadyHasScopeAllocatedError="Component already has scope allocated",P.InvalidMetaParameterError="Invalid parameter provided to get meta",P.InvalidScopeParameterError="Invalid parameter provided to get scope",P.ScopeNotFoundError="Scope not found",P.InvalidFeatureParameterError="Invalid parameter provided to get feature",P.InvalidFeatureDefinitionParameterError="Invalid parameter provided to define feature",P.InvalidFeatureTemplateParameterError="Invalid parameter provided to get feature template",P.InvalidFeatureExtensionParameterError="Invalid parameter provided to extend feature",P.InvalidAbstractionParameterError="Invalid parameter provided to get abstraction",P.InvalidAbstractionDefinitionParameterError="Invalid parameter provided to define abstraction",P.InvalidAbstractionTemplateParameterError="Invalid parameter provided to get abstraction template",P.InvalidAbstractionExtensionParameterError="Invalid parameter provided to extend abstraction",P.InvalidInjectionParameterError="Invalid parameter provided to get injections",P.InvalidExtensionParameterError="Invalid parameter provided to get extensions",P.InvalidRegisterParameterError="Invalid parameter provided to register component",P.InvalidComponentParameterError="Invalid component provided",P.ComponentNotRegisteredError="Component not registered in the context",P.InvalidDeregisterParameterError="Invalid parameter provided to deregister component";var l=P;var x=class x{constructor(){this._registry=new WeakMap;this._scopeIssuers=new WeakMap;this._scopeStorage=new WeakMap;this._metaStorage=new Map;this._globals=new Map;let e="root";x.environment==="server"&&(e=process.env[O.A_CONCEPT_ROOT_SCOPE]||"root"),x.environment==="browser"&&(e=window[O.A_CONCEPT_ROOT_SCOPE]||"root"),this._root=new F({name:e});}static get concept(){return process.env[O.A_CONCEPT_NAME]||"a-concept"}static get root(){return this.getInstance()._root}static get environment(){let e="browser";try{e=window.location?"browser":"server";}catch{e="server";}return e}static getInstance(){return x._instance||(x._instance=new x),x._instance}static register(e,t){let r=m.getComponentName(t),n=this.getInstance();if(!t)throw new l(l.InvalidRegisterParameterError,"Unable to register component. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidRegisterParameterError,"Unable to register component. Scope cannot be null or undefined.");if(!this.isAllowedToBeRegistered(t))throw new l(l.NotAllowedForScopeAllocationError,`Component ${r} is not allowed for scope allocation.`);return n._scopeStorage.set(t,e),e}static deregister(e){let t=m.getComponentName(e),r=this.getInstance();if(!e)throw new l(l.InvalidDeregisterParameterError,"Unable to deregister component. Component cannot be null or undefined.");if(!r._scopeStorage.has(e))throw new l(l.ComponentNotRegisteredError,`Unable to deregister component. Component ${t} is not registered.`);r._scopeStorage.delete(e);}static allocate(e,t){let r=m.getComponentName(e);if(!this.isAllowedForScopeAllocation(e))throw new l(l.NotAllowedForScopeAllocationError,`Component of type ${r} is not allowed for scope allocation. Only A_Container, A_Feature are allowed.`);let n=this.getInstance();if(n._registry.has(e))throw new l(l.ComponentAlreadyHasScopeAllocatedError,`Component ${r} already has a scope allocated.`);let i=o.isScopeInstance(t)?t:new F(t||{name:r+"-scope"},t);return i.isInheritedFrom(x.root)||i.inherit(x.root),n._registry.set(e,i),n._scopeIssuers.set(i,e),i}static deallocate(e){let t=this.getInstance(),r=o.isScopeInstance(e)?e:t._registry.get(e);if(!r)return;let n=o.isComponentInstance(e)?e:this.issuer(r);n&&t._registry.delete(n),r&&t._scopeIssuers.delete(r);}static meta(e){let t=m.getComponentName(e),r=this.getInstance();if(!e)throw new l(l.InvalidMetaParameterError,"Invalid parameter provided to get meta. Parameter cannot be null or undefined.");if(!(this.isAllowedForMeta(e)||this.isAllowedForMetaConstructor(e)||o.isString(e)||o.isFunction(e)))throw new l(l.InvalidMetaParameterError,`Invalid parameter provided to get meta. Component of type ${t} is not allowed for meta storage. Only A_Container, A_Component and A_Entity are allowed.`);let n,i;switch(true){case o.isContainerInstance(e):{n=e.constructor,i=K;break}case o.isContainerConstructor(e):{n=e,i=K;break}case o.isComponentInstance(e):{n=e.constructor,i=j;break}case o.isComponentConstructor(e):{n=e,i=j;break}case o.isEntityInstance(e):{n=e.constructor,i=j;break}case o.isEntityConstructor(e):{n=e,i=B;break}case o.isFragmentInstance(e):{n=e.constructor,i=j;break}case o.isFragmentConstructor(e):{n=e,i=B;break}case typeof e=="string":{let s=Array.from(r._metaStorage).find(([a])=>a.name===e||a.name===C.toKebabCase(e)||a.name===C.toPascalCase(e));if(!(s&&s.length))throw new l(l.InvalidMetaParameterError,`Invalid parameter provided to get meta. Component with name ${e} not found in the meta storage.`);n=s[0],i=j;break}default:{n=e,i=A;break}}if(!r._metaStorage.has(n)){let s,a=n;for(;!s;){let u=Object.getPrototypeOf(a);if(!u)break;s=r._metaStorage.get(u),a=u;}s||(s=new i),r._metaStorage.set(n,new i().from(s));}return r._metaStorage.get(n)}static setMeta(e,t){let r=x.getInstance(),n=x.meta(e),i=typeof e=="function"?e:e.constructor;r._metaStorage.set(i,n?t.from(n):t);}static issuer(e){let t=this.getInstance();if(!e)throw new l(l.InvalidComponentParameterError,"Invalid parameter provided to get scope issuer. Parameter cannot be null or undefined.");return t._scopeIssuers.get(e)}static scope(e){let t=e?.constructor?.name||String(e),r=this.getInstance();if(!e)throw new l(l.InvalidScopeParameterError,"Invalid parameter provided to get scope. Parameter cannot be null or undefined.");if(!this.isAllowedForScopeAllocation(e)&&!this.isAllowedToBeRegistered(e))throw new l(l.InvalidScopeParameterError,`Invalid parameter provided to get scope. Component of type ${t} is not allowed for scope allocation.`);switch(true){case this.isAllowedForScopeAllocation(e):if(!r._registry.has(e))throw new l(l.ScopeNotFoundError,`Invalid parameter provided to get scope. Component of type ${t} does not have a scope allocated. Make sure to allocate a scope using A_Context.allocate() method before trying to get the scope.`);return r._registry.get(e);case this.isAllowedToBeRegistered(e):if(!r._scopeStorage.has(e))throw new l(l.ScopeNotFoundError,`Invalid parameter provided to get scope. Component of type ${t} does not have a scope registered. Make sure to register the component using A_Context.register() method before trying to get the scope.`);return r._scopeStorage.get(e);default:throw new l(l.InvalidScopeParameterError,`Invalid parameter provided to get scope. Component of type ${t} is not allowed to be registered.`)}}static featureTemplate(e,t,r=this.scope(t)){let n=m.getComponentName(t);if(!t)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Feature name cannot be null or undefined.");if(!o.isAllowedForFeatureDefinition(t))throw new l(l.InvalidFeatureTemplateParameterError,`Unable to get feature template. Component of type ${n} is not allowed for feature definition.`);return [...this.featureDefinition(e,t),...this.featureExtensions(e,t,r)]}static featureExtensions(e,t,r){let n=this.getInstance(),i=m.getComponentName(t);if(!t)throw new l(l.InvalidFeatureExtensionParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidFeatureExtensionParameterError,"Unable to get feature template. Feature name cannot be null or undefined.");if(!o.isAllowedForFeatureDefinition(t))throw new l(l.InvalidFeatureExtensionParameterError,`Unable to get feature template. Component of type ${i} is not allowed for feature definition.`);let s=m.getClassInheritanceChain(t).filter(d=>d!==M&&d!==z&&d!==k).map(d=>`${d.name}.${e}`),a=new Map,u=new Set;for(let d of s)for(let[y,g]of n._metaStorage)r.has(y)&&(o.isComponentMetaInstance(g)||o.isContainerMetaInstance(g))&&(u.add(y),g.extensions(d).forEach(D=>{let R=Array.from(u).reverse().find(X=>m.isInheritedFrom(y,X)&&X!==y);R&&a.delete(`${m.getComponentName(R)}.${D.handler}`),a.set(`${m.getComponentName(y)}.${D.handler}`,{dependency:new v(y),...D});}));return n.filterToMostDerived(r,Array.from(a.values()))}filterToMostDerived(e,t){return t.filter(r=>{let n=e.resolveConstructor(r.dependency.name);return !t.some(s=>{if(s===r)return false;let a=e.resolveConstructor(s.dependency.name);return !n||!a?false:n.prototype.isPrototypeOf(a.prototype)})})}static featureDefinition(e,t){let r;if(!e)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Feature name cannot be null or undefined.");if(!t)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Component cannot be null or undefined.");switch(true){case t instanceof k:r="a-component-features";break;case t instanceof z:r="a-container-features";break;case t instanceof M:r="a-component-features";break;default:throw new l(l.InvalidFeatureTemplateParameterError,`A-Feature cannot be defined on the ${t} level`)}return [...this.meta(t)?.get(r)?.get(e)?.template||[]]}static abstractionTemplate(e,t){let r=m.getComponentName(t);if(!t)throw new l(l.InvalidAbstractionTemplateParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidAbstractionTemplateParameterError,"Unable to get feature template. Abstraction stage cannot be null or undefined.");if(!o.isAllowedForAbstractionDefinition(t))throw new l(l.InvalidAbstractionTemplateParameterError,`Unable to get feature template. Component of type ${r} is not allowed for feature definition.`);return [...this.abstractionExtensions(e,t)]}static abstractionExtensions(e,t){let r=this.getInstance(),n=m.getComponentName(t);if(!t)throw new l(l.InvalidAbstractionExtensionParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidAbstractionExtensionParameterError,"Unable to get feature template. Abstraction stage cannot be null or undefined.");if(!o.isAllowedForAbstractionDefinition(t))throw new l(l.InvalidAbstractionExtensionParameterError,`Unable to get feature template. Component of type ${n} is not allowed for feature definition.`);let i=new Map,s=this.scope(t),a=new Set;for(let[u,d]of r._metaStorage)s.has(u)&&(o.isComponentMetaInstance(d)||o.isContainerMetaInstance(d))&&(a.add(u),d.abstractions(e).forEach(y=>{let g=Array.from(a).reverse().find(D=>m.isInheritedFrom(u,D)&&D!==u);g&&i.delete(`${m.getComponentName(g)}.${y.handler}`),i.set(`${m.getComponentName(u)}.${y.handler}`,{dependency:new v(u),...y});}));return r.filterToMostDerived(s,Array.from(i.values()))}static reset(){let e=x.getInstance();e._registry=new WeakMap;let t="root";x.environment==="server"&&(t=process.env[O.A_CONCEPT_ROOT_SCOPE]||"root"),x.environment==="browser"&&(t=window[O.A_CONCEPT_ROOT_SCOPE]||"root"),e._root=new F({name:t});}static isAllowedForScopeAllocation(e){return o.isContainerInstance(e)||o.isFeatureInstance(e)}static isAllowedToBeRegistered(e){return o.isEntityInstance(e)||o.isComponentInstance(e)||o.isFragmentInstance(e)||o.isErrorInstance(e)}static isAllowedForMeta(e){return o.isContainerInstance(e)||o.isComponentInstance(e)||o.isEntityInstance(e)}static isAllowedForMetaConstructor(e){return o.isContainerConstructor(e)||o.isComponentConstructor(e)||o.isEntityConstructor(e)}};_(x,"A_Context");var p=x;var Ee=class Ee extends f{};_(Ee,"A_AbstractionError"),Ee.AbstractionExtensionError="Unable to extend abstraction execution";var Z=Ee;function $e(c,e={}){return function(t,r,n){let i=m.getComponentName(t);if(!c)throw new Z(Z.AbstractionExtensionError,`Abstraction name must be provided to extend abstraction for '${i}'.`);if(!o.isConstructorAvailableForAbstraction(t))throw new Z(Z.AbstractionExtensionError,`Unable to extend Abstraction '${c}' for '${i}'. Only A-Containers and A-Components can extend Abstractions.`);let s,a=p.meta(t);switch(true){case(o.isContainerConstructor(t)||o.isContainerInstance(t)):s="a-container-abstractions";break;case(o.isComponentConstructor(t)||o.isComponentInstance(t)):s="a-component-abstractions";break}let u=`CONCEPT_ABSTRACTION::${c}`,d=a.get(s)?new A().from(a.get(s)):new A,y=[...d.get(u)||[]],g=y.findIndex(R=>R.handler===r),D={name:u,handler:r,behavior:e.behavior||"sync",throwOnError:e.throwOnError!==void 0?e.throwOnError:true,before:o.isArray(e.before)?new RegExp(`^${e.before.join("|").replace(/\./g,"\\.")}$`).source:e.before instanceof RegExp?e.before.source:"",after:o.isArray(e.after)?new RegExp(`^${e.after.join("|").replace(/\./g,"\\.")}$`).source:e.after instanceof RegExp?e.after.source:"",override:o.isArray(e.override)?new RegExp(`^${e.override.join("|").replace(/\./g,"\\.")}$`).source:e.after instanceof RegExp?e.after.source:""};g!==-1?y[g]=D:y.push(D),d.set(u,y),p.meta(t).set(s,d);}}_($e,"A_Abstraction_Extend");var Le=class Le{constructor(e){this._features=[];this._index=0;this._name=e.name,this._features=e.containers.map(t=>{let r=p.abstractionTemplate(this._name,t);return new Y({name:this._name,component:t,template:r})}),this._current=this._features[0];}static get Extend(){return $e}get name(){return this._name}get feature(){return this._current}get isDone(){return !this.feature||this._index>=this._features.length}[Symbol.iterator](){return {next:_(()=>this.isDone?(this._current=void 0,{value:void 0,done:true}):(this._current=this._features[this._index],{value:this._current,done:false}),"next")}}next(e){if(this._index>=this._features.length)return;let t=this._features.indexOf(e);this._index=t+1;}async process(e){if(!this.isDone)for(let t of this._features)await t.process(e);}};_(Le,"A_Abstraction");var b=Le;var _t=(a=>(a.Run="run",a.Build="build",a.Publish="publish",a.Deploy="deploy",a.Load="load",a.Start="start",a.Stop="stop",a))(_t||{}),ct=(e=>(e.LIFECYCLE="a-component-extensions",e))(ct||{});var Ue=class Ue{constructor(e){this.props=e;this._name=e.name||p.root.name,e.components&&e.components.length&&e.components.forEach(t=>this.scope.register(t)),e.fragments&&e.fragments.length&&e.fragments.forEach(t=>this.scope.register(t)),e.entities&&e.entities.length&&e.entities.forEach(t=>this.scope.register(t)),this._containers=e.containers||[];}static Load(e){return b.Extend("load",e)}static Publish(e){return b.Extend("publish")}static Deploy(e){return b.Extend("deploy",e)}static Build(e){return b.Extend("build",e)}static Run(e){return b.Extend("run",e)}static Start(e){return b.Extend("start",e)}static Stop(e){return b.Extend("stop",e)}get name(){return p.root.name}get scope(){return p.root}get register(){return this.scope.register.bind(this.scope)}get resolve(){return this.scope.resolve.bind(this.scope)}async load(e){await new b({name:"load",containers:this._containers}).process(e);}async run(e){await new b({name:"run",containers:this._containers}).process(e);}async start(e){await new b({name:"start",containers:this._containers}).process(e);}async stop(e){await new b({name:"stop",containers:this._containers}).process(e);}async build(e){await new b({name:"build",containers:this._containers}).process(e);}async deploy(e){await new b({name:"deploy",containers:this._containers}).process(e);}async publish(e){await new b({name:"publish",containers:this._containers}).process(e);}async call(e,t){return await new Y({name:e,component:t}).process()}};_(Ue,"A_Concept");var ze=Ue;var Ke=class Ke extends A{constructor(t){super();this.containers=t;}};_(Ke,"A_ConceptMeta");var Je=Ke;var ce=class ce extends f{};_(ce,"A_InjectError"),ce.InvalidInjectionTarget="Invalid target for A-Inject decorator",ce.MissingInjectionTarget="Missing target for A-Inject decorator";var W=ce;function pt(c,e){if(!c)throw new W(W.MissingInjectionTarget,"A-Inject decorator is missing the target to inject");return function(t,r,n){let i=m.getComponentName(t);if(!o.isTargetAvailableForInjection(t))throw new W(W.InvalidInjectionTarget,`A-Inject cannot be used on the target of type ${typeof t} (${i})`);let s=r?String(r):"constructor",a;switch(true){case(o.isComponentConstructor(t)||o.isComponentInstance(t)):a="a-component-injections";break;case o.isContainerInstance(t):a="a-container-injections";break;case o.isEntityInstance(t):a="a-component-injections";break}let u=p.meta(t).get(a)||new A,d=u.get(s)||[];d[n]=c instanceof v?c:new v(c,e),u.set(s,d),p.meta(t).set(a,u);}}_(pt,"A_Inject");
|
|
2
|
-
export{I as ASEID,w as ASEID_Error,b as A_Abstraction,Z as A_AbstractionError,$e as A_Abstraction_Extend,O as A_CONSTANTS__DEFAULT_ENV_VARIABLES,lt as A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,ee as A_CONSTANTS__ERROR_CODES,He as A_CONSTANTS__ERROR_DESCRIPTION,V as A_Caller,re as A_CallerError,m as A_CommonHelper,M as A_Component,j as A_ComponentMeta,ze as A_Concept,Je as A_ConceptMeta,z as A_Container,K as A_ContainerMeta,p as A_Context,l as A_ContextError,v as A_Dependency,
|
|
1
|
+
var et=Object.defineProperty;var _=(c,e)=>et(c,"name",{value:e,configurable:true});var O={A_CONCEPT_NAME:"A_CONCEPT_NAME",A_CONCEPT_ROOT_SCOPE:"A_CONCEPT_ROOT_SCOPE",A_CONCEPT_ENVIRONMENT:"A_CONCEPT_ENVIRONMENT",A_CONCEPT_ROOT_FOLDER:"A_CONCEPT_ROOT_FOLDER",A_ERROR_DEFAULT_DESCRIPTION:"A_ERROR_DEFAULT_DESCRIPTION"},lt=[O.A_CONCEPT_NAME,O.A_CONCEPT_ROOT_SCOPE,O.A_CONCEPT_ENVIRONMENT,O.A_CONCEPT_ROOT_FOLDER,O.A_ERROR_DEFAULT_DESCRIPTION];var tt=(i=>(i.INITIALIZED="INITIALIZED",i.PROCESSING="PROCESSING",i.COMPLETED="COMPLETED",i.INTERRUPTED="INTERRUPTED",i.FAILED="FAILED",i))(tt||{});function Te(c){return function(e){return p.setMeta(e,new c),e}}_(Te,"A_MetaDecorator");var le=class le{constructor(){this.meta=new Map;}static Define(e){return Te(e)}[Symbol.iterator](){let e=this.meta.entries();return {next:_(()=>e.next(),"next")}}from(e){return this.meta=new Map(e.meta),this}set(e,t){let r=this.meta.get(e)||Array.isArray(t)?[]:t instanceof Map?new Map:{};this.meta.get(e)||Array.isArray(t)?[...r]:t instanceof Map?new Map(r):{...r};this.meta.set(e,t);}get(e){return this.meta.get(e)}delete(e){return this.meta.delete(e)}size(){return this.meta.size}convertToRegExp(e){return e instanceof RegExp?e:new RegExp(e)}find(e){let t=[];for(let[r,n]of this.meta.entries())this.convertToRegExp(String(r)).test(e)&&t.push([r,n]);return t}findByRegex(e){let t=[];for(let[r,n]of this.meta.entries())e.test(String(r))&&t.push([r,n]);return t}has(e){return this.meta.has(e)}entries(){return this.meta.entries()}clear(){this.meta.clear();}toArray(){return Array.from(this.meta.entries())}recursiveToJSON(e){switch(true){case e instanceof le:return e.toJSON();case e instanceof Map:let t={};for(let[n,i]of e.entries())t[String(n)]=this.recursiveToJSON(i);return t;case Array.isArray(e):return e.map(n=>this.recursiveToJSON(n));case(!!e&&typeof e=="object"):let r={};for(let[n,i]of Object.entries(e))r[n]=this.recursiveToJSON(i);return r;default:return e}}toJSON(){let e={};for(let[t,r]of this.meta.entries())e[String(t)]=this.recursiveToJSON(r);return e}};_(le,"A_Meta");var A=le;var rt=(n=>(n.EXTENSIONS="a-component-extensions",n.FEATURES="a-component-features",n.ABSTRACTIONS="a-component-abstractions",n.INJECTIONS="a-component-injections",n))(rt||{}),nt=(r=>(r.SAVE="save",r.DESTROY="destroy",r.LOAD="load",r))(nt||{});var ot=(n=>(n.FEATURES="a-container-features",n.INJECTIONS="a-container-injections",n.ABSTRACTIONS="a-container-abstractions",n.EXTENSIONS="a-container-extensions",n))(ot||{});var it=(n=>(n.EXTENSIONS="a-component-extensions",n.FEATURES="a-component-features",n.INJECTIONS="a-component-injections",n.ABSTRACTIONS="a-component-abstractions",n))(it||{});var Se=class Se extends A{injections(e){return this.get("a-component-injections")?.get(e)||[]}extensions(e){let t=[];return this.get("a-component-extensions")?.find(e).forEach(([n,i])=>{i.forEach(s=>{t.push({name:s.name,handler:s.handler,behavior:s.behavior,before:s.before||"",after:s.after||"",throwOnError:s.throwOnError||true,override:""});});}),t}features(){return this.get("a-component-features")?.toArray().map(([,t])=>t)||[]}abstractions(e){let t=[],r=this.get("a-component-abstractions"),n=this.get("a-component-injections");return r?.find(`CONCEPT_ABSTRACTION::${e}`).forEach(([i,s])=>{s.forEach(a=>{let u=n?.get(a.handler)||[];t.push({...a,args:u});});}),t}};_(Se,"A_ComponentMeta");var j=Se;var he=class he{get name(){return this.config?.name||this.constructor.name}get scope(){return p.scope(this)}constructor(e={}){this.config=e,p.allocate(this,this.config);}async call(e,t){return await new Y({name:e,component:this}).process(t)}};_(he,"A_Container");var z=he;var ye=class ye extends A{injections(e){return this.get("a-container-injections")?.get(e)||[]}features(){return this.get("a-container-features")?.toArray().map(([,t])=>t)||[]}abstractions(e){let t=[],r=this.get("a-container-abstractions"),n=this.get("a-container-injections");return r?.find(`CONCEPT_ABSTRACTION::${e}`).forEach(([i,s])=>{s.forEach(a=>{let u=n?.get(a.handler)||[];t.push({...a,args:u});});}),t}extensions(e){let t=[];return this.get("a-container-extensions")?.find(e).forEach(([n,i])=>{i.forEach(s=>{t.push({name:s.name,handler:s.handler,behavior:s.behavior,before:s.before||"",after:s.after||"",throwOnError:s.throwOnError||true,override:""});});}),t}};_(ye,"A_ContainerMeta");var K=ye;var ge=class ge{static toUpperSnakeCase(e){return e.trim().replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[^a-zA-Z0-9]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"").toUpperCase()}static toCamelCase(e){return e.trim().replace(/[^a-zA-Z0-9]+/g," ").split(" ").filter(Boolean).map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}static toPascalCase(e){return e.trim().replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z0-9]+/g," ").split(" ").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}static toKebabCase(e){return e.replace(/[^a-zA-Z0-9]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim().replace(/\s+/g,"-").toLowerCase()}};_(ge,"A_FormatterHelper");var C=ge;var Ce=class Ce{static generateTimeId(e={timestamp:new Date,random:Math.random().toString(36).slice(2,8)}){let t=e.timestamp.getTime().toString(36),r=e.random;return `${t}-${r}`}static parseTimeId(e){let[t,r]=e.split("-");return {timestamp:new Date(parseInt(t,36)),random:r}}static formatWithLeadingZeros(e,t=10){return String(e).padStart(t+1,"0").slice(-t)}static removeLeadingZeros(e){return String(Number(e))}static hashString(e){let t=0,r,n;if(e.length===0)return t.toString();for(r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t.toString()}};_(Ce,"A_IdentityHelper");var U=Ce;var ee={UNEXPECTED_ERROR:"A-Error Unexpected Error",VALIDATION_ERROR:"A-Error Validation Error"},He="If you see this error please let us know.";var $=class $ extends Error{static get entity(){return C.toKebabCase(this.name)}static get concept(){return p.concept}static get scope(){return p.root.name}constructor(e,t){switch(true){case e instanceof $:return e;case e instanceof Error:super(e.message);break;case o.isErrorSerializedType(e):super(e.message);break;case(o.isErrorConstructorType(e)&&"description"in e):super(`[${e.title}]: ${e.description}`);break;case(o.isErrorConstructorType(e)&&!("description"in e)):super(e.title);break;case(o.isString(e)&&!t):super(e);break;case(o.isString(e)&&!!t):super(`[${e}]: ${t}`);break;default:super("An unknown error occurred.");}this.getInitializer(e,t).call(this,e,t);}get aseid(){return this._aseid}get title(){return this._title}get message(){return super.message}get code(){return this._code||C.toKebabCase(this.title)}get type(){return this.constructor.entity}get link(){return this._link?this._link:new URL(`https://adaas.support/a-concept/errors/${this.aseid.toString()}`).toString()}get scope(){return this._aseid.scope}get description(){return this._description||process.env[O.A_ERROR_DEFAULT_DESCRIPTION]||He}get originalError(){return this._originalError}getInitializer(e,t){switch(true){case(o.isString(e)&&!t):return this.fromMessage;case(o.isString(e)&&!!t):return this.fromTitle;case e instanceof Error:return this.fromError;case o.isErrorSerializedType(e):return this.fromJSON;case o.isErrorConstructorType(e):return this.fromConstructor;default:throw new $(ee.VALIDATION_ERROR,"Invalid parameters provided to A_Error constructor")}}fromError(e){this._title=ee.UNEXPECTED_ERROR,this._aseid=new I({concept:this.constructor.concept,scope:this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._originalError=e;}fromMessage(e){this._title=ee.UNEXPECTED_ERROR,this._aseid=new I({concept:this.constructor.concept,scope:this._scope||this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._link=void 0,this._originalError=void 0;}fromJSON(e){this._aseid=new I(e.aseid),super.message=e.message,this._title=e.title,this._code=e.code,this._scope=e.scope,this._description=e.description,this._originalError=e.originalError?new $(e.originalError):void 0,this._link=e.link;}fromTitle(e,t){this.validateTitle(e),this._title=e,this._description=t,this._aseid=new I({concept:this.constructor.concept,scope:this._scope||this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._link=void 0,this._originalError=void 0;}fromConstructor(e){if(this.validateTitle(e.title),this._title=e.title,this._code=e.code,this._scope=e.scope?o.isScopeInstance(e.scope)?e.scope.name:e.scope:void 0,this._aseid=new I({concept:this.constructor.concept,scope:this._scope||this.constructor.scope,entity:this.constructor.entity,id:this.code}),this._description=e.description,this._link=e.link,e.originalError instanceof $){let t=e.originalError;for(;t.originalError instanceof $;)t=t.originalError;this._originalError=t.originalError||t;}else this._originalError=e.originalError;}toJSON(){return {aseid:this.aseid.toString(),title:this.title,code:this.code,type:this.type,message:this.message,link:this.link,scope:this.scope,description:this.description,originalError:this.originalError?.message}}validateTitle(e){if(e.length>60)throw new $(ee.VALIDATION_ERROR,"A-Error title exceeds 60 characters limit.");if(e.length===0)throw new $(ee.VALIDATION_ERROR,"A-Error title cannot be empty.")}};_($,"A_Error");var E=$;var se=class se extends E{};_(se,"ASEID_Error"),se.ASEIDInitializationError="ASEID Initialization Error",se.ASEIDValidationError="ASEID Validation Error";var w=se;var N=class N{static isASEID(e){return this.regexp.test(e)}static compare(e,t){if(!e||!t)return false;if(o.isString(e)&&this.isASEID(e)===false)throw new w(w.ASEIDValidationError,`Invalid ASEID format provided: ${e}`);if(o.isString(t)&&this.isASEID(t)===false)throw new w(w.ASEIDValidationError,`Invalid ASEID format provided: ${t}`);let r=e instanceof N?e:new N(e),n=t instanceof N?t:new N(t);return r.toString()===n.toString()}constructor(e){this.verifyInput(e),this.getInitializer(e).call(this,e);}get concept(){return this._concept||p.concept}get scope(){return this._scope||p.root.name}get entity(){return this._entity}get id(){return this._id}get version(){return this._version}get shard(){return this._shard}get hash(){return U.hashString(this.toString())}getInitializer(e){switch(true){case o.isString(e):return this.fromString;case o.isObject(e):return this.fromObject;default:throw new w(w.ASEIDInitializationError,"Invalid parameters provided to ASEID constructor")}}fromString(e){let[t,r,n]=e.split("@"),[i,s,a]=r.split(":"),u=a.includes(".")?a.split(".")[0]:void 0,d=a.includes(".")?a.split(".")[1]:a;this._concept=t||p.root.name,this._scope=i||p.root.name,this._entity=s,this._id=d,this._version=n,this._shard=u;}fromObject(e){this._concept=e.concept?N.isASEID(e.concept)?new N(e.concept).id:e.concept:p.concept,this._scope=e.scope?o.isNumber(e.scope)?U.formatWithLeadingZeros(e.scope):N.isASEID(e.scope)?new N(e.scope).id:e.scope:p.root.name,this._entity=e.entity,this._id=o.isNumber(e.id)?U.formatWithLeadingZeros(e.id):e.id,this._version=e.version,this._shard=e.shard;}toString(){return `${this.concept}@${this.scope}:${this.entity}:${this.shard?this.shard+"."+this.id:this.id}${this.version?"@"+this.version:""}`}toJSON(){return {concept:this._concept,scope:this._scope,entity:this._entity,id:this._id,version:this._version,shard:this._shard}}verifyInput(e){switch(true){case(o.isString(e)&&!N.isASEID(e)):throw new w(w.ASEIDValidationError,"Invalid ASEID format provided");case(o.isObject(e)&&!e.id):throw new w(w.ASEIDValidationError,"ASEID id is required");case(o.isObject(e)&&!e.entity):throw new w(w.ASEIDValidationError,"ASEID entity is required")}}};_(N,"ASEID"),N.regexp=new RegExp("^[a-z|A-Z|0-9|-]+@[a-z|A-Z|0-9|-]+:[a-z|A-Z|0-9|-]+:[a-z|A-Z|0-9|\\.|-]+(@v[0-9|\\.]+|@lts)?$");var I=N;var ue=class ue extends E{};_(ue,"A_EntityError"),ue.ValidationError="A-Entity Validation Error";var te=ue;var Pe=class Pe{static get entity(){return C.toKebabCase(this.name)}static get concept(){return p.concept}static get scope(){return p.root.name}constructor(e){this.getInitializer(e).call(this,e);}get id(){return this.aseid.id}isStringASEID(e){return typeof e=="string"&&I.isASEID(e)}isASEIDInstance(e){return e instanceof I}isSerializedObject(e){return !!e&&typeof e=="object"&&"aseid"in e}isConstructorProps(e){return !!e&&typeof e=="object"&&!("aseid"in e)}getInitializer(e){if(!e)return this.fromUndefined;if(this.isStringASEID(e))return this.fromASEID;if(this.isASEIDInstance(e))return this.fromASEID;if(this.isSerializedObject(e))return this.fromJSON;if(this.isConstructorProps(e))return this.fromNew;throw new te(te.ValidationError,"Unable to determine A-Entity constructor initialization method. Please check the provided parameters.")}generateASEID(e){return new I({concept:e?.concept||this.constructor.concept,scope:e?.scope||this.constructor.scope,entity:e?.entity||this.constructor.entity,id:e?.id||U.generateTimeId()})}async call(e,t){return await new Y({name:e,component:this,scope:t}).process(t)}async load(e){return this.call("load",e)}async destroy(e){return this.call("destroy",e)}async save(e){return this.call("save",e)}fromASEID(e){e instanceof I?this.aseid=e:this.aseid=new I(e);}fromUndefined(){this.aseid=this.generateASEID();}fromNew(e){this.aseid=this.generateASEID();}fromJSON(e){this.aseid=new I(e.aseid);}toJSON(){return {aseid:this.aseid.toString()}}toString(){return this.aseid?this.aseid.toString():this.constructor.name}};_(Pe,"A_Entity");var k=Pe;var Ie=class Ie extends A{features(){return this.get("a-component-features")?.toArray().map(([,t])=>t)||[]}injections(e){return this.get("a-component-injections")?.get(e)||[]}};_(Ie,"A_EntityMeta");var q=Ie;var be=class be{constructor(e={}){this._name=e.name||this.constructor.name;}get name(){return this._name}toJSON(){return {name:this.name}}};_(be,"A_Fragment");var J=be;var Ye=class Ye{static resolve(){return new Promise(e=>e())}static isInheritedFrom(e,t){let r=e;for(;r;){if(r===t)return true;r=Object.getPrototypeOf(r);}return false}static getParentClasses(e){let t=Object.getPrototypeOf(typeof e=="function"?e:e.constructor),r=[];for(;t&&t!==Function.prototype;)r.push(t),t=Object.getPrototypeOf(t);return r}static getClassInheritanceChain(e){let t=Object.getPrototypeOf(typeof e=="function"?e:e.constructor),r=typeof e=="function"?[e]:[e.constructor];for(;t&&t!==Function.prototype;)r.push(t),t=Object.getPrototypeOf(t);return r}static getParentClass(e){return Object.getPrototypeOf(e)}static omitProperties(e,t){let r=JSON.parse(JSON.stringify(e));function n(i,s){let a=s[0];s.length===1?delete i[a]:i[a]!==void 0&&typeof i[a]=="object"&&n(i[a],s.slice(1));}return _(n,"removeProperties"),t.forEach(i=>{let s=i.split(".");n(r,s);}),r}static isObject(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}static deepMerge(e,t,r=new Map){if(this.isObject(e)&&this.isObject(t))for(let n in t)this.isObject(t[n])?(e[n]||(e[n]={}),r.has(t[n])?e[n]=r.get(t[n]):(r.set(t[n],{}),this.deepMerge(e[n],t[n],r))):e[n]=t[n];return e}static deepClone(e){if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(t=>this.deepClone(t));if(typeof e=="function")return e;if(e instanceof Object){let t={};for(let r in e)e.hasOwnProperty(r)&&(t[r]=this.deepClone(e[r]));return t}throw new Error("Unable to clone the object. Unsupported type.")}static deepCloneAndMerge(e,t){if(t==null&&e==null)return e;if(e==null&&t)return this.deepClone(t);if(typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(r=>this.deepCloneAndMerge(r,t));if(typeof e=="function")return e;if(e instanceof Object){let r={};for(let n in e)t[n]!==null&&t[n]!==void 0?r[n]=this.deepCloneAndMerge(e[n],t[n]):r[n]=this.deepClone(e[n]);for(let n in t)e[n]!==void 0&&e[n]!==null?r[n]=this.deepCloneAndMerge(e[n],t[n]):r[n]=this.deepClone(t[n]);return r}throw new Error("Unable to clone the object. Unsupported type.")}static getComponentName(e){let t="Unknown",r="Anonymous";if(e==null)return t;if(typeof e=="string")return e||t;if(typeof e=="symbol")try{return e.toString()}catch{return t}if(Array.isArray(e))return e.length===0?t:this.getComponentName(e[0]);if(typeof e=="function"){let n=e;if(n.displayName)return String(n.displayName);if(n.name)return String(n.name);if(n.constructor&&n.constructor.name)return String(n.constructor.name);try{let s=Function.prototype.toString.call(e).match(/^(?:class\s+([A-Za-z0-9_$]+)|function\s+([A-Za-z0-9_$]+)|([A-Za-z0-9_$]+)\s*=>)/);if(s)return s[1]||s[2]||s[3]||r}catch{}return r}if(typeof e=="object"){let n=e;if(n.type)return this.getComponentName(n.type);if(n.displayName)return String(n.displayName);if(n.name)return String(n.name);if(n.constructor&&n.constructor.name&&n.constructor.name!=="Object")return String(n.constructor.name);try{let i=n.toString();if(typeof i=="string"&&i!=="[object Object]")return i}catch{}return r}try{return String(e)}catch{return t}}};_(Ye,"A_CommonHelper");var m=Ye;var L=class L extends E{};_(L,"A_ScopeError"),L.InitializationError="A-Scope Initialization Error",L.ConstructorError="Unable to construct A-Scope instance",L.ResolutionError="A-Scope Resolution Error",L.RegistrationError="A-Scope Registration Error",L.CircularInheritanceError="A-Scope Circular Inheritance Error",L.CircularImportError="A-Scope Circular Import Error",L.DeregistrationError="A-Scope Deregistration Error";var T=L;var B=class B extends E{};_(B,"A_DependencyError"),B.InvalidDependencyTarget="Invalid Dependency Target",B.InvalidLoadTarget="Invalid Load Target",B.InvalidLoadPath="Invalid Load Path",B.InvalidDefaultTarget="Invalid Default Target",B.ResolutionParametersError="Dependency Resolution Parameters Error";var y=B;function we(...c){return function(e,t,r){let n=m.getComponentName(e);if(!o.isTargetAvailableForInjection(e))throw new y(y.InvalidDefaultTarget,`A-Default cannot be used on the target of type ${typeof e} (${n})`);let i=t?String(t):"constructor",s;switch(true){case(o.isComponentConstructor(e)||o.isComponentInstance(e)):s="a-component-injections";break;case o.isContainerInstance(e):s="a-container-injections";break;case o.isEntityInstance(e):s="a-component-injections";break}let a=p.meta(e).get(s)||new A,u=a.get(i)||[];u[r].resolutionStrategy={create:true,args:c},a.set(i,u),p.meta(e).set(s,a);}}_(we,"A_Dependency_Default");function Ze(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new y(y.InvalidDependencyTarget,`A-Dependency cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={flat:true},s.set(n,a),p.meta(c).set(i,s);}}_(Ze,"A_Dependency_Flat");function xe(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new y(y.InvalidLoadTarget,`A-Load cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={load:true},s.set(n,a),p.meta(c).set(i,s);}}_(xe,"A_Dependency_Load");function We(c=-1){return function(e,t,r){let n=m.getComponentName(e);if(!o.isTargetAvailableForInjection(e))throw new y(y.InvalidDependencyTarget,`A-Dependency cannot be used on the target of type ${typeof e} (${n})`);let i=t?String(t):"constructor",s;switch(true){case(o.isComponentConstructor(e)||o.isComponentInstance(e)):s="a-component-injections";break;case o.isContainerInstance(e):s="a-container-injections";break;case o.isEntityInstance(e):s="a-component-injections";break}let a=p.meta(e).get(s)||new A,u=a.get(i)||[];u[r].resolutionStrategy={parent:c},a.set(i,u),p.meta(e).set(s,a);}}_(We,"A_Dependency_Parent");function De(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new y(y.InvalidDependencyTarget,`A-Dependency cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={require:true},s.set(n,a),p.meta(c).set(i,s);}}_(De,"A_Dependency_Require");function Xe(){return function(c,e,t){let r=m.getComponentName(c);if(!o.isTargetAvailableForInjection(c))throw new y(y.InvalidDependencyTarget,`A-All cannot be used on the target of type ${typeof c} (${r})`);let n=e?String(e):"constructor",i;switch(true){case(o.isComponentConstructor(c)||o.isComponentInstance(c)):i="a-component-injections";break;case o.isContainerInstance(c):i="a-container-injections";break;case o.isEntityInstance(c):i="a-component-injections";break}let s=p.meta(c).get(i)||new A,a=s.get(n)||[];a[t].resolutionStrategy={pagination:{...a[t].resolutionStrategy.pagination,count:-1}},s.set(n,a),p.meta(c).set(i,s);}}_(Xe,"A_Dependency_All");var ve=class ve{constructor(e,t){this._defaultPagination={count:1,from:"start"};this._defaultResolutionStrategy={require:false,load:false,parent:0,flat:false,create:false,args:[],query:{},pagination:this._defaultPagination};this._name=typeof e=="string"?e:m.getComponentName(e),this._target=typeof e=="string"?void 0:e,this.resolutionStrategy=t||{},this.initCheck();}static get Required(){return De}static get Loaded(){return xe}static get Default(){return we}static get Parent(){return We}static get Flat(){return Ze}static get All(){return Xe}get flat(){return this._resolutionStrategy.flat}get require(){return this._resolutionStrategy.require}get load(){return this._resolutionStrategy.load}get all(){return this._resolutionStrategy.pagination.count!==1||Object.keys(this._resolutionStrategy.query).length>0}get parent(){return this._resolutionStrategy.parent}get create(){return this._resolutionStrategy.create}get args(){return this._resolutionStrategy.args}get query(){return this._resolutionStrategy.query}get pagination(){return this._resolutionStrategy.pagination}get name(){return this._name}get target(){return this._target}get resolutionStrategy(){return this._resolutionStrategy}set resolutionStrategy(e){this._resolutionStrategy={...this._defaultResolutionStrategy,...this._resolutionStrategy,...e,pagination:{...this._defaultPagination,...(this._resolutionStrategy||{}).pagination,...e.pagination||{}}};}initCheck(){if(!this._resolutionStrategy)throw new y(y.ResolutionParametersError,`Resolution strategy parameters are not provided for dependency: ${this._name}`);return this}toJSON(){return {name:this._name,all:this.all,require:this.require,load:this.load,parent:this.parent,flat:this.flat,create:this.create,args:this.args,query:this.query,pagination:this.pagination}}};_(ve,"A_Dependency");var v=ve;var Fe=class Fe{constructor(e,t){this._meta=new A;this._allowedComponents=new Set;this._allowedErrors=new Set;this._allowedEntities=new Set;this._allowedFragments=new Set;this._components=new Map;this._errors=new Map;this._entities=new Map;this._fragments=new Map;this._imports=new Set;this.getInitializer(e).call(this,e,t);}get name(){return this._name}get meta(){return this._meta}get allowedComponents(){return this._allowedComponents}get allowedEntities(){return this._allowedEntities}get allowedFragments(){return this._allowedFragments}get allowedErrors(){return this._allowedErrors}get entities(){return Array.from(this._entities.values())}get fragments(){return Array.from(this._fragments.values())}get components(){return Array.from(this._components.values())}get errors(){return Array.from(this._errors.values())}get imports(){return Array.from(this._imports.values())}get parent(){return this._parent}*parents(){let e=this._parent;for(;e;)yield e,e=e._parent;}parentOffset(e){let t=this;for(;e<=-1&&t;)t=t.parent,e++;return t}getInitializer(e,t){switch(true){case(!e&&!t):return this.defaultInitialized;case !!e:return this.defaultInitialized;default:throw new T(T.ConstructorError,"Invalid parameters provided to A_Scope constructor")}}defaultInitialized(e={},t={}){this._name=e.name||this.constructor.name,this.initComponents(e.components),this.initErrors(e.errors),this.initFragments(e.fragments),this.initEntities(e.entities),this.initMeta(e.meta),t.parent&&(this._parent=t.parent);}initComponents(e){e?.forEach(this.register.bind(this));}initErrors(e){e?.forEach(this.register.bind(this));}initEntities(e){e?.forEach(t=>this.register(t));}initFragments(e){e?.forEach(this.register.bind(this));}initMeta(e){e&&Object.entries(e).forEach(([t,r])=>{this._meta.set(t,r);});}destroy(){this._components.forEach(e=>p.deregister(e)),this._fragments.forEach(e=>p.deregister(e)),this._entities.forEach(e=>p.deregister(e)),this._components.clear(),this._errors.clear(),this._fragments.clear(),this._entities.clear(),this._imports.clear(),this.issuer()&&p.deallocate(this);}get(e){return this._meta.get(e)}set(e,t){this._meta.set(e,t);}issuer(){return p.issuer(this)}inherit(e){if(!e)throw new T(T.InitializationError,"Invalid parent scope provided");if(e===this)throw new T(T.CircularInheritanceError,`Unable to inherit scope ${this.name} from itself`);if(e===this._parent)return this;let t=this.checkCircularInheritance(e);if(t)throw new T(T.CircularInheritanceError,`Circular inheritance detected: ${[...t,e.name].join(" -> ")}`);return this._parent=e,this}import(...e){return e.forEach(t=>{if(t===this)throw new T(T.CircularImportError,`Unable to import scope ${this.name} into itself`);this._imports.has(t)||this._imports.add(t);}),this}deimport(...e){return e.forEach(t=>{this._imports.has(t)&&this._imports.delete(t);}),this}has(e){let t=this.hasFlat(e);if(!t&&this._parent)try{return this._parent.has(e)}catch{return false}return t}hasFlat(e){let t=false;switch(true){case o.isScopeConstructor(e):return true;case o.isString(e):{Array.from(this.allowedComponents).find(a=>a.name===e)&&(t=true),Array.from(this.allowedFragments).find(a=>a.name===e)&&(t=true),Array.from(this.allowedEntities).find(a=>a.name===e)&&(t=true),Array.from(this.allowedErrors).find(a=>a.name===e)&&(t=true);break}case o.isComponentConstructor(e):{t=this.isAllowedComponent(e)||!![...this.allowedComponents].find(r=>m.isInheritedFrom(r,e));break}case o.isEntityConstructor(e):{t=this.isAllowedEntity(e)||!![...this.allowedEntities].find(r=>m.isInheritedFrom(r,e));break}case o.isFragmentConstructor(e):{t=this.isAllowedFragment(e)||!![...this.allowedFragments].find(r=>m.isInheritedFrom(r,e));break}case o.isErrorConstructor(e):{t=this.isAllowedError(e)||!![...this.allowedErrors].find(r=>m.isInheritedFrom(r,e));break}case(this.issuer()&&(this.issuer().constructor===e||m.isInheritedFrom(this.issuer().constructor,e))):{t=true;break}}return t}resolveDependency(e){let t=[],r=this.parentOffset(e.parent)||this;switch(true){case(e.flat&&!e.all):{let d=r.resolveFlatOnce(e.target||e.name);d&&(t=[d]);break}case(e.flat&&e.all):{t=r.resolveFlatAll(e.target||e.name);break}case(!e.flat&&!e.all):{let d=r.resolveOnce(e.target||e.name);d&&(t=[d]);break}case(!e.flat&&e.all):{t=r.resolveAll(e.target||e.name);break}default:t=[];}if(e.create&&!t.length&&o.isAllowedForDependencyDefaultCreation(e.target)){let d=new e.target(...e.args);r.register(d),t.push(d);}if(e.require&&!t.length)throw new T(T.ResolutionError,`Dependency ${e.name} is required but could not be resolved in scope ${r.name}`);e.query.aseid?t=t.filter(d=>o.hasASEID(d)&&I.compare(d.aseid,e.query.aseid)):Object.keys(e.query).length>0&&(t=t.filter(d=>{let h=e.query;return h?Object.entries(h).every(([g,D])=>d[g]===D):true}));let n=e.pagination.count,i=e.pagination.from,s=i==="end"?n===-1?0:Math.max(t.length-n,0):0,a=i==="end"||n===-1?t.length:Math.min(n,t.length),u=t.slice(s,a);return u.length===1&&n!==-1?u[0]:u.length?u:void 0}resolveConstructor(e){let t=Array.from(this.allowedComponents).find(i=>i.name===e||i.name===C.toPascalCase(e));if(t)return t;{let i=Array.from(this.allowedComponents).find(s=>{let a=s;for(;a;){if(a.name===e||a.name===C.toPascalCase(e))return true;a=Object.getPrototypeOf(a);}return false});if(i)return i}let r=Array.from(this.allowedEntities).find(i=>i.name===e||i.name===C.toPascalCase(e)||i.entity===e||i.entity===C.toKebabCase(e));if(r)return r;{let i=Array.from(this.allowedEntities).find(s=>m.isInheritedFrom(s,e));if(i)return i}let n=Array.from(this.allowedFragments).find(i=>i.name===e||i.name===C.toPascalCase(e));if(n)return n;{let i=Array.from(this.allowedFragments).find(s=>m.isInheritedFrom(s,e));if(i)return i}for(let i of this._imports){let s=i.resolveConstructor(e);if(s)return s}if(this._parent)return this._parent.resolveConstructor(e)}resolveAll(e){let t=new Set;this.resolveFlatAll(e).forEach(i=>t.add(i)),this._imports.forEach(i=>{i.has(e)&&i.resolveFlatAll(e).forEach(a=>t.add(a));});let n=this._parent;for(;n&&n.has(e);)n.resolveAll(e).forEach(s=>t.add(s)),n=n._parent;return Array.from(t)}resolveFlatAll(e){let t=[];switch(true){case o.isComponentConstructor(e):{this.allowedComponents.forEach(r=>{if(m.isInheritedFrom(r,e)){let n=this.resolveOnce(r);n&&t.push(n);}});break}case o.isFragmentConstructor(e):{this.allowedFragments.forEach(r=>{if(m.isInheritedFrom(r,e)){let n=this.resolveOnce(r);n&&t.push(n);}});break}case o.isEntityConstructor(e):{this.entities.forEach(r=>{m.isInheritedFrom(r.constructor,e)&&t.push(r);});break}case o.isString(e):{let r=this.resolveConstructor(e);if(!o.isComponentConstructor(r)&&!o.isEntityConstructor(r)&&!o.isFragmentConstructor(r))throw new T(T.ResolutionError,`Unable to resolve all instances for name: ${e} in scope ${this.name} as no matching component, entity or fragment constructor found`);if(r){let n=this.resolveAll(r);n&&t.push(...n);}break}default:throw new T(T.ResolutionError,`Invalid parameter provided to resolveAll method: ${e} in scope ${this.name}`)}return t}resolve(e){let t=o.isDependencyInstance(e)?e:new v(e);return this.resolveDependency(t)}resolveOnce(e){let t=this.resolveFlatOnce(e);if(!t){for(let r of this._imports)if(r.has(e)){let n=r.resolveFlatOnce(e);if(n)return n}}return !t&&this.parent?this.parent.resolveOnce(e):t}resolveFlat(e){return this.resolveFlatOnce(e)}resolveFlatOnce(e){let t,r=m.getComponentName(e);if(!(!e||!this.has(e))){switch(true){case o.isString(e):{t=this.resolveByName(e);break}case o.isConstructorAllowedForScopeAllocation(e):{t=this.resolveIssuer(e);break}case o.isScopeConstructor(e):{t=this.resolveScope(e);break}case o.isEntityConstructor(e):{t=this.resolveEntity(e);break}case o.isFragmentConstructor(e):{t=this.resolveFragment(e);break}case o.isComponentConstructor(e):{t=this.resolveComponent(e);break}case o.isErrorConstructor(e):{t=this.resolveError(e);break}default:throw new T(T.ResolutionError,`Injected Component ${r} not found in the scope`)}return t}}resolveByName(e){let t=Array.from(this.allowedComponents).find(s=>s.name===e||s.name===C.toPascalCase(e));if(t)return this.resolveOnce(t);let r=Array.from(this.allowedEntities).find(s=>s.name===e||s.name===C.toPascalCase(e)||s.entity===e||s.entity===C.toKebabCase(e));if(r)return this.resolveOnce(r);let n=Array.from(this.allowedFragments).find(s=>s.name===e||s.name===C.toPascalCase(e));if(n)return this.resolveOnce(n);let i=Array.from(this.allowedErrors).find(s=>s.name===e||s.name===C.toPascalCase(e)||s.code===e||s.code===C.toKebabCase(e));if(i)return this.resolveOnce(i)}resolveIssuer(e){let t=this.issuer();if(t&&(t.constructor===e||m.isInheritedFrom(t?.constructor,e)))return t}resolveEntity(e){return this.entities.find(t=>t instanceof e)}resolveError(e){return this.errors.find(t=>t instanceof e)}resolveFragment(e){let t=this._fragments.get(e);switch(true){case(t&&this._fragments.has(e)):return t;case(!t&&Array.from(this._allowedFragments).some(r=>m.isInheritedFrom(r,e))):{let r=Array.from(this._allowedFragments).find(n=>m.isInheritedFrom(n,e));return this.resolveFragment(r)}default:return}}resolveScope(e){return this}resolveComponent(e){switch(true){case(this.allowedComponents.has(e)&&this._components.has(e)):return this._components.get(e);case(this.allowedComponents.has(e)&&!this._components.has(e)):{let n=(p.meta(e).get("a-component-injections")?.get("constructor")||[]).map(s=>this.resolve(s)),i=new e(...n);return this.register(i),this._components.get(e)}case(!this.allowedComponents.has(e)&&Array.from(this.allowedComponents).some(t=>m.isInheritedFrom(t,e))):{let t=Array.from(this.allowedComponents).find(r=>m.isInheritedFrom(r,e));return this.resolveComponent(t)}default:return}}register(e){switch(true){case e instanceof M:{this.allowedComponents.has(e.constructor)||this.allowedComponents.add(e.constructor),this._components.set(e.constructor,e),p.register(this,e);break}case(o.isEntityInstance(e)&&!this._entities.has(e.aseid.toString())):{this.allowedEntities.has(e.constructor)||this.allowedEntities.add(e.constructor),this._entities.set(e.aseid.toString(),e),p.register(this,e);break}case o.isFragmentInstance(e):{this.allowedFragments.has(e.constructor)||this.allowedFragments.add(e.constructor),this._fragments.set(e.constructor,e),p.register(this,e);break}case o.isErrorInstance(e):{this.allowedErrors.has(e.constructor)||this.allowedErrors.add(e.constructor),this._errors.set(e.code,e),p.register(this,e);break}case o.isComponentConstructor(e):{this.allowedComponents.has(e)||this.allowedComponents.add(e);break}case o.isFragmentConstructor(e):{this.allowedFragments.has(e)||this.allowedFragments.add(e);break}case o.isEntityConstructor(e):{this.allowedEntities.has(e)||this.allowedEntities.add(e);break}case o.isErrorConstructor(e):{this.allowedErrors.has(e)||this.allowedErrors.add(e);break}default:if(e instanceof k)throw new T(T.RegistrationError,`Entity with ASEID ${e.aseid.toString()} is already registered in the scope ${this.name}`);if(e instanceof J)throw new T(T.RegistrationError,`Fragment ${e.constructor.name} is already registered in the scope ${this.name}`);{let t=m.getComponentName(e);throw new T(T.RegistrationError,`Cannot register ${t} in the scope ${this.name}`)}}}deregister(e){switch(true){case e instanceof M:{this._components.delete(e.constructor),p.deregister(e);break}case o.isEntityInstance(e):{this._entities.delete(e.aseid.toString()),p.deregister(e);break}case o.isFragmentInstance(e):{this._fragments.delete(e.constructor),p.deregister(e);break}case o.isErrorInstance(e):{this._errors.delete(e.code),p.deregister(e);break}case o.isComponentConstructor(e):{this.allowedComponents.delete(e);break}case o.isFragmentConstructor(e):{this.allowedFragments.delete(e);break}case o.isEntityConstructor(e):{this.allowedEntities.delete(e);break}case o.isErrorConstructor(e):{this.allowedErrors.delete(e);break}default:let t=m.getComponentName(e);throw new T(T.DeregistrationError,`Cannot deregister ${t} from the scope ${this.name}`)}}toJSON(){return this.fragments.reduce((e,t)=>{let r=t.toJSON();return {...e,[r.name]:r}},{})}isAllowedComponent(e){return o.isComponentConstructor(e)&&this.allowedComponents.has(e)}isAllowedEntity(e){return o.isEntityConstructor(e)&&this.allowedEntities.has(e)}isAllowedFragment(e){return o.isFragmentConstructor(e)&&this.allowedFragments.has(e)}isAllowedError(e){return o.isErrorConstructor(e)&&this.allowedErrors.has(e)}isInheritedFrom(e){let t=this;for(;t;){if(t===e)return true;t=t._parent;}return false}checkCircularInheritance(e){let t=[],r=this._parent;for(;r;){if(t.push(r.name),r===e)return t;r=r._parent;}return false}printInheritanceChain(){let e=[],t=this;for(;t;)e.push(t.name),t=t._parent;console.log(e.join(" -> "));}};_(Fe,"A_Scope");var F=Fe;var de=class de extends E{};_(de,"A_CallerError"),de.CallerInitializationError="Unable to initialize A-Caller";var re=de;var Me=class Me{constructor(e){this.validateParams(e),this._component=e;}get component(){return this._component}validateParams(e){if(!o.isAllowedForFeatureCall(e))throw new re(re.CallerInitializationError,`Invalid A-Caller component provided of type: ${typeof e} with value: ${JSON.stringify(e).slice(0,100)}...`)}};_(Me,"A_Caller");var V=Me;var S=class S{static isString(e){return typeof e=="string"||e instanceof String}static isNumber(e){return typeof e=="number"&&isFinite(e)}static isBoolean(e){return typeof e=="boolean"}static isArray(e){return Array.isArray(e)}static isObject(e){return e&&typeof e=="object"&&!Array.isArray(e)}static isFunction(e){return typeof e=="function"}static isUndefined(e){return typeof e>"u"}static isRegExp(e){return e instanceof RegExp}static isContainerConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,z)}static isComponentConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,M)}static isFragmentConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,J)}static isEntityConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,k)}static isScopeConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,F)}static isErrorConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,E)}static isFeatureConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,Y)}static isCallerConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,V)}static isDependencyConstructor(e){return typeof e=="function"&&m.isInheritedFrom(e,v)}static isDependencyInstance(e){return e instanceof v}static isContainerInstance(e){return e instanceof z}static isComponentInstance(e){return e instanceof M}static isFeatureInstance(e){return e instanceof Y}static isFragmentInstance(e){return e instanceof J}static isEntityInstance(e){return e instanceof k}static isScopeInstance(e){return e instanceof F}static isErrorInstance(e){return e instanceof E}static isComponentMetaInstance(e){return e instanceof j}static isContainerMetaInstance(e){return e instanceof K}static isEntityMetaInstance(e){return e instanceof q}static hasASEID(e){return e&&typeof e=="object"&&"aseid"&&(S.isEntityInstance(e)||S.isErrorInstance(e))}static isConstructorAllowedForScopeAllocation(e){return S.isContainerConstructor(e)||S.isFeatureConstructor(e)}static isInstanceAllowedForScopeAllocation(e){return S.isContainerInstance(e)||S.isFeatureInstance(e)}static isConstructorAvailableForAbstraction(e){return S.isContainerInstance(e)||S.isComponentInstance(e)}static isTargetAvailableForInjection(e){return S.isComponentConstructor(e)||S.isComponentInstance(e)||S.isContainerInstance(e)||S.isEntityInstance(e)}static isAllowedForFeatureCall(e){return S.isContainerInstance(e)||S.isComponentInstance(e)||S.isEntityInstance(e)}static isAllowedForFeatureDefinition(e){return S.isContainerInstance(e)||S.isComponentInstance(e)||S.isEntityInstance(e)}static isAllowedForFeatureExtension(e){return S.isComponentInstance(e)||S.isContainerInstance(e)||S.isEntityInstance(e)}static isAllowedForAbstractionDefinition(e){return S.isContainerInstance(e)||S.isComponentInstance(e)}static isAllowedForDependencyDefaultCreation(e){return S.isFragmentConstructor(e)||m.isInheritedFrom(e,J)||S.isEntityConstructor(e)||m.isInheritedFrom(e,k)}static isErrorConstructorType(e){return !!e&&S.isObject(e)&&!(e instanceof Error)&&"title"in e}static isErrorSerializedType(e){return !!e&&S.isObject(e)&&!(e instanceof Error)&&"aseid"in e&&I.isASEID(e.aseid)}static isPromiseInstance(e){return e instanceof Promise}};_(S,"A_TypeGuards");var o=S;var G=class G extends E{fromConstructor(e){super.fromConstructor(e),this.stage=e.stage;}};_(G,"A_FeatureError"),G.Interruption="Feature Interrupted",G.FeatureInitializationError="Unable to initialize A-Feature",G.FeatureProcessingError="Error occurred during A-Feature processing",G.FeatureDefinitionError="Unable to define A-Feature",G.FeatureExtensionError="Unable to extend A-Feature";var f=G;function Oe(c={}){return function(e,t,r){let n=m.getComponentName(e);if(!o.isAllowedForFeatureDefinition(e))throw new f(f.FeatureDefinitionError,`A-Feature cannot be defined on the ${n} level`);let i=p.meta(e.constructor),s;switch(true){case o.isEntityInstance(e):s="a-component-features";break;case o.isContainerInstance(e):s="a-container-features";break;case o.isComponentInstance(e):s="a-component-features";break}let a=i.get(s)||new A,u=c.name||t,d=c.invoke||false;a.set(t,{name:`${e.constructor.name}.${u}`,handler:t,invoke:d,template:c.template&&c.template.length?c.template.map(g=>({...g,before:g.before||"",after:g.after||"",behavior:g.behavior||"sync",throwOnError:true,override:g.override||""})):[]}),p.meta(e.constructor).set(s,a);let h=r.value;return r.value=function(...g){if(d)h.apply(this,g);else return h.apply(this,g);if(typeof this.call=="function"&&d)return this.call(u)},r}}_(Oe,"A_Feature_Define");function Ne(c){return function(e,t,r){let n=m.getComponentName(e);if(!o.isAllowedForFeatureExtension(e))throw new f(f.FeatureExtensionError,`A-Feature-Extend cannot be applied on the ${n} level`);let i,s="sync",a="",u="",d="",h=[],g=[],D=true,R;switch(true){case o.isEntityInstance(e):R="a-component-extensions";break;case o.isContainerInstance(e):R="a-container-extensions";break;case o.isComponentInstance(e):R="a-component-extensions";break}switch(true){case o.isRegExp(c):i=c;break;case(!!c&&typeof c=="object"):Array.isArray(c.scope)?h=c.scope:c.scope&&typeof c.scope=="object"&&(Array.isArray(c.scope.include)&&(h=c.scope.include),Array.isArray(c.scope.exclude)&&(g=c.scope.exclude)),i=st(c,h,g,t),s=c.behavior||s,D=c.throwOnError!==void 0?c.throwOnError:D,a=o.isArray(c.before)?new RegExp(`^${c.before.join("|").replace(/\./g,"\\.")}$`).source:c.before instanceof RegExp?c.before.source:"",u=o.isArray(c.after)?new RegExp(`^${c.after.join("|").replace(/\./g,"\\.")}$`).source:c.after instanceof RegExp?c.after.source:"",d=o.isArray(c.override)?new RegExp(`^${c.override.join("|").replace(/\./g,"\\.")}$`).source:c.override instanceof RegExp?c.override.source:"";break;default:i=new RegExp(`^.*${t.replace(/\./g,"\\.")}$`);break}let X=p.meta(e).get(R),qe=p.meta(e),Q=qe.get(R)?new A().from(qe.get(R)):new A;if(X&&X.size()&&X.has(t)&&X.get(t).invoke)throw new f(f.FeatureExtensionError,`A-Feature-Extend cannot be used on the method "${t}" because it is already defined as a Feature with "invoke" set to true. Please remove the A-Feature-Extend decorator or set "invoke" to false in the A-Feature decorator.`);let pe=[...Q.get(i.source)||[]];for(let[ie,me]of Q.entries()){let Ge=me.findIndex(Qe=>Qe.handler===t);ie!==i.source&&Ge!==-1&&(me.splice(Ge,1),me.length===0?Q.delete(ie):Q.set(ie,me));}let Be=pe.findIndex(ie=>ie.handler===t),Ve={name:i.source,handler:t,behavior:s,before:a,after:u,throwOnError:D,override:d};Be!==-1?pe[Be]=Ve:pe.push(Ve),Q.set(i.source,pe),p.meta(e).set(R,Q);}}_(Ne,"A_Feature_Extend");function st(c,e,t,r){let n=e.length?`(${e.map(a=>a.name).join("|")})`:".*",i=t.length?`(?!${t.map(a=>a.name).join("|")})`:"",s=c.scope?`^${i}${n}\\.${c.name||r}$`:`.*\\.${c.name||r}$`;return new RegExp(s)}_(st,"buildTargetRegexp");var at=(s=>(s.PROCESSING="PROCESSING",s.COMPLETED="COMPLETED",s.FAILED="FAILED",s.SKIPPED="SKIPPED",s.INITIALIZED="INITIALIZED",s.ABORTED="ABORTED",s))(at||{});var Ae=class Ae extends E{static get CompileError(){return "Unable to compile A-Stage"}};_(Ae,"A_StageError"),Ae.ArgumentsResolutionError="A-Stage Arguments Resolution Error";var H=Ae;var Re=class Re{constructor(e,t){this._status="INITIALIZED";this._feature=e,this._definition=t;}get name(){return this.toString()}get definition(){return this._definition}get status(){return this._status}get feature(){return this._feature}get isProcessed(){return this._status==="COMPLETED"||this._status==="FAILED"||this._status==="SKIPPED"}get error(){return this._error}getStepArgs(e,t){let r=t.dependency.target||e.resolveConstructor(t.dependency.name);return p.meta(r).injections(t.handler).map(n=>{switch(true){case o.isCallerConstructor(n.target):return this._feature.caller.component;case o.isFeatureConstructor(n.target):return this._feature;default:return e.resolve(n)}})}getStepComponent(e,t){let{dependency:r,handler:n}=t,i=e.resolve(r)||this.feature.scope.resolve(r);if(!i)throw new H(H.CompileError,`Unable to resolve component ${r.name} from scope ${e.name}`);if(!i[n])throw new H(H.CompileError,`Handler ${n} not found in ${i.constructor.name}`);return i}callStepHandler(e,t){let r=this.getStepComponent(t,e),n=this.getStepArgs(t,e);return {handler:r[e.handler].bind(r),params:n}}skip(){this._status="SKIPPED";}process(e){let t=o.isScopeInstance(e)?e:this._feature.scope;if(!this.isProcessed){this._status="PROCESSING";let{handler:r,params:n}=this.callStepHandler(this._definition,t),i=r(...n);if(o.isPromiseInstance(i))return new Promise(async(s,a)=>{try{return await i,this.completed(),s()}catch(u){let d=new E(u);return this.failed(d),this._definition.throwOnError?s():a(d)}});this.completed();}}completed(){this._status="COMPLETED";}failed(e){this._error=new E(e),this._status="FAILED";}toJSON(){return {name:this.name,status:this.status}}toString(){return `A-Stage(${this._feature.name}::${this._definition.behavior}@${this._definition.handler})`}};_(Re,"A_Stage");var ae=Re;var fe=class fe extends E{};_(fe,"A_StepManagerError"),fe.CircularDependencyError="A-StepManager Circular Dependency Error";var ne=fe;var ke=class ke{constructor(e){this._isBuilt=false;this.entities=this.prepareSteps(e),this.graph=new Map,this.visited=new Set,this.tempMark=new Set,this.sortedEntities=[];}prepareSteps(e){return e.map(t=>({...t,behavior:t.behavior||"sync",before:t.before||"",after:t.after||"",override:t.override||"",throwOnError:false}))}ID(e){return `${e.dependency.name}.${e.handler}`}buildGraph(){this._isBuilt||(this._isBuilt=true,this.entities=this.entities.filter((e,t,r)=>!r.some(n=>n.override?new RegExp(n.override).test(this.ID(e)):false)),this.entities.forEach(e=>this.graph.set(this.ID(e),new Set)),this.entities.forEach(e=>{let t=this.ID(e);e.before&&this.matchEntities(t,e.before).forEach(n=>{this.graph.has(n)||this.graph.set(n,new Set),this.graph.get(n).add(t);}),e.after&&this.matchEntities(t,e.after).forEach(n=>{this.graph.has(t)||this.graph.set(t,new Set),this.graph.get(t).add(n);});}));}matchEntities(e,t){let r=new RegExp(t);return this.entities.filter(n=>r.test(this.ID(n))&&this.ID(n)!==e).map(n=>this.ID(n))}visit(e){this.tempMark.has(e)||this.visited.has(e)||(this.tempMark.add(e),(this.graph.get(e)||[]).forEach(t=>this.visit(t)),this.tempMark.delete(e),this.visited.add(e),this.sortedEntities.push(e));}toSortedArray(){return this.buildGraph(),this.entities.forEach(e=>{this.visited.has(this.ID(e))||this.visit(this.ID(e));}),this.sortedEntities}toStages(e){return this.toSortedArray().map(r=>{let n=this.entities.find(i=>this.ID(i)===r);return new ae(e,n)})}};_(ke,"A_StepsManager");var oe=ke;var _e=class _e{constructor(e){this._stages=[];this._index=0;this._state="INITIALIZED";this.validateParams(e),this.getInitializer(e).call(this,e);}static get Define(){return Oe}static get Extend(){return Ne}get name(){return this._name}get error(){return this._error}get state(){return this._state}get index(){return this._index}get stage(){return this._current}get caller(){return this._caller}get scope(){return p.scope(this)}get size(){return this._stages.length}get isDone(){return !this.stage||this._index>=this._stages.length}get isProcessed(){return this.state==="COMPLETED"||this.state==="FAILED"||this.state==="INTERRUPTED"}[Symbol.iterator](){return {next:_(()=>this.isDone?(this._current=void 0,{value:void 0,done:true}):(this._current=this._stages[this._index],this._index++,{value:this._current,done:false}),"next")}}validateParams(e){if(!e||typeof e!="object")throw new f(f.FeatureInitializationError,`Invalid A-Feature initialization parameters of type: ${typeof e} with value: ${JSON.stringify(e).slice(0,100)}...`)}getInitializer(e){switch(true){case !("template"in e):return this.fromComponent;case "template"in e:return this.fromTemplate;default:throw new f(f.FeatureInitializationError,`Invalid A-Feature initialization parameters of type: ${typeof e} with value: ${JSON.stringify(e).slice(0,100)}...`)}}fromTemplate(e){if(!e.template||!Array.isArray(e.template))throw new f(f.FeatureInitializationError,`Invalid A-Feature template provided of type: ${typeof e.template} with value: ${JSON.stringify(e.template).slice(0,100)}...`);if(!e.component&&(!e.scope||!(e.scope instanceof F)))throw new f(f.FeatureInitializationError,`Invalid A-Feature scope provided of type: ${typeof e.scope} with value: ${JSON.stringify(e.scope).slice(0,100)}...`);this._name=e.name;let t,r=e.scope;try{e.component&&(t=p.scope(e.component));}catch(i){if(!r)throw i}t&&r&&!r.isInheritedFrom(t)&&r.inherit(t),this._caller=new V(e.component||new M),p.allocate(this).inherit(t||r),this._SM=new oe(e.template),this._stages=this._SM.toStages(this),this._current=this._stages[0];}fromComponent(e){if(!e.component||!o.isAllowedForFeatureDefinition(e.component))throw new f(f.FeatureInitializationError,`Invalid A-Feature component provided of type: ${typeof e.component} with value: ${JSON.stringify(e.component).slice(0,100)}...`);this._name=e.name;let t,r=e.scope;try{t=p.scope(e.component);}catch(s){if(!r)throw s}t&&r&&!r.isInheritedFrom(t)&&r.inherit(t),this._caller=new V(e.component);let n=p.allocate(this);n.inherit(t||r);let i=p.featureTemplate(this._name,this._caller.component,n);this._SM=new oe(i),this._stages=this._SM.toStages(this),this._current=this._stages[0];}process(e){try{if(this.isProcessed)return;this._state="PROCESSING";let t=Array.from(this);return this.processStagesSequentially(t,e,0)}catch(t){throw this.failed(new f({title:f.FeatureProcessingError,description:`An error occurred while processing the A-Feature: ${this.name}. Failed at stage: ${this.stage?.name||"N/A"}.`,stage:this.stage,originalError:t}))}}processStagesSequentially(e,t,r){try{if(this.state==="INTERRUPTED")return;if(r>=e.length){this.completed();return}let n=e[r],i=n.process(t);return o.isPromiseInstance(i)?i.then(()=>{if(this.state!=="INTERRUPTED")return this.processStagesSequentially(e,t,r+1)}).catch(s=>{throw this.failed(new f({title:f.FeatureProcessingError,description:`An error occurred while processing the A-Feature: ${this.name}. Failed at stage: ${n.name}.`,stage:n,originalError:s}))}):this.processStagesSequentially(e,t,r+1)}catch(n){throw this.failed(new f({title:f.FeatureProcessingError,description:`An error occurred while processing the A-Feature: ${this.name}. Failed at stage: ${this.stage?.name||"N/A"}.`,stage:this.stage,originalError:n}))}}next(e){let t=this._stages.indexOf(e);this._index=t+1,this._index>=this._stages.length&&this.completed();}completed(){this.isProcessed||this.state!=="INTERRUPTED"&&(this._state="COMPLETED",this.scope.destroy());}failed(e){return this.isProcessed?this._error:(this._state="FAILED",this._error=e,this.scope.destroy(),this._error)}interrupt(e){if(this.isProcessed)return this._error;switch(this._state="INTERRUPTED",true){case o.isString(e):this._error=new f(f.Interruption,e);break;case o.isErrorInstance(e):this._error=new f({code:f.Interruption,title:e.title||"Feature Interrupted",description:e.description||e.message,stage:this.stage,originalError:e});break;default:this._error=new f(f.Interruption,"Feature was interrupted");break}return this.scope.destroy(),this._error}chain(e,t,r){let n,i;e instanceof _e?(n=e,i=t instanceof F?t:void 0):(n=new _e({name:t,component:e}),i=r instanceof F?r:void 0);let s=i||this.scope;n._caller=this._caller;let a=n.process(s);return o.isPromiseInstance(a)?a.catch(u=>{throw u}):a}toString(){return `A-Feature(${this.caller.component?.constructor?.name||"Unknown"}::${this.name})`}};_(_e,"A_Feature");var Y=_e;var je=class je{call(e,t){return new Y({name:e,component:this}).process(t)}};_(je,"A_Component");var M=je;var P=class P extends E{};_(P,"A_ContextError"),P.NotAllowedForScopeAllocationError="Component is not allowed for scope allocation",P.ComponentAlreadyHasScopeAllocatedError="Component already has scope allocated",P.InvalidMetaParameterError="Invalid parameter provided to get meta",P.InvalidScopeParameterError="Invalid parameter provided to get scope",P.ScopeNotFoundError="Scope not found",P.InvalidFeatureParameterError="Invalid parameter provided to get feature",P.InvalidFeatureDefinitionParameterError="Invalid parameter provided to define feature",P.InvalidFeatureTemplateParameterError="Invalid parameter provided to get feature template",P.InvalidFeatureExtensionParameterError="Invalid parameter provided to extend feature",P.InvalidAbstractionParameterError="Invalid parameter provided to get abstraction",P.InvalidAbstractionDefinitionParameterError="Invalid parameter provided to define abstraction",P.InvalidAbstractionTemplateParameterError="Invalid parameter provided to get abstraction template",P.InvalidAbstractionExtensionParameterError="Invalid parameter provided to extend abstraction",P.InvalidInjectionParameterError="Invalid parameter provided to get injections",P.InvalidExtensionParameterError="Invalid parameter provided to get extensions",P.InvalidRegisterParameterError="Invalid parameter provided to register component",P.InvalidComponentParameterError="Invalid component provided",P.ComponentNotRegisteredError="Component not registered in the context",P.InvalidDeregisterParameterError="Invalid parameter provided to deregister component";var l=P;var x=class x{constructor(){this._registry=new WeakMap;this._scopeIssuers=new WeakMap;this._scopeStorage=new WeakMap;this._metaStorage=new Map;this._globals=new Map;let e="root";x.environment==="server"&&(e=process.env[O.A_CONCEPT_ROOT_SCOPE]||"root"),x.environment==="browser"&&(e=window[O.A_CONCEPT_ROOT_SCOPE]||"root"),this._root=new F({name:e});}static get concept(){return process.env[O.A_CONCEPT_NAME]||"a-concept"}static get root(){return this.getInstance()._root}static get environment(){let e="browser";try{e=window.location?"browser":"server";}catch{e="server";}return e}static getInstance(){return x._instance||(x._instance=new x),x._instance}static register(e,t){let r=m.getComponentName(t),n=this.getInstance();if(!t)throw new l(l.InvalidRegisterParameterError,"Unable to register component. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidRegisterParameterError,"Unable to register component. Scope cannot be null or undefined.");if(!this.isAllowedToBeRegistered(t))throw new l(l.NotAllowedForScopeAllocationError,`Component ${r} is not allowed for scope allocation.`);return n._scopeStorage.set(t,e),e}static deregister(e){let t=m.getComponentName(e),r=this.getInstance();if(!e)throw new l(l.InvalidDeregisterParameterError,"Unable to deregister component. Component cannot be null or undefined.");if(!r._scopeStorage.has(e))throw new l(l.ComponentNotRegisteredError,`Unable to deregister component. Component ${t} is not registered.`);r._scopeStorage.delete(e);}static allocate(e,t){let r=m.getComponentName(e);if(!this.isAllowedForScopeAllocation(e))throw new l(l.NotAllowedForScopeAllocationError,`Component of type ${r} is not allowed for scope allocation. Only A_Container, A_Feature are allowed.`);let n=this.getInstance();if(n._registry.has(e))throw new l(l.ComponentAlreadyHasScopeAllocatedError,`Component ${r} already has a scope allocated.`);let i=o.isScopeInstance(t)?t:new F(t||{name:r+"-scope"},t);return i.isInheritedFrom(x.root)||i.inherit(x.root),n._registry.set(e,i),n._scopeIssuers.set(i,e),i}static deallocate(e){let t=this.getInstance(),r=o.isScopeInstance(e)?e:t._registry.get(e);if(!r)return;let n=o.isComponentInstance(e)?e:this.issuer(r);n&&t._registry.delete(n),r&&t._scopeIssuers.delete(r);}static meta(e){let t=m.getComponentName(e),r=this.getInstance();if(!e)throw new l(l.InvalidMetaParameterError,"Invalid parameter provided to get meta. Parameter cannot be null or undefined.");if(!(this.isAllowedForMeta(e)||this.isAllowedForMetaConstructor(e)||o.isString(e)||o.isFunction(e)))throw new l(l.InvalidMetaParameterError,`Invalid parameter provided to get meta. Component of type ${t} is not allowed for meta storage. Only A_Container, A_Component and A_Entity are allowed.`);let n,i;switch(true){case o.isContainerInstance(e):{n=e.constructor,i=K;break}case o.isContainerConstructor(e):{n=e,i=K;break}case o.isComponentInstance(e):{n=e.constructor,i=j;break}case o.isComponentConstructor(e):{n=e,i=j;break}case o.isEntityInstance(e):{n=e.constructor,i=j;break}case o.isEntityConstructor(e):{n=e,i=q;break}case o.isFragmentInstance(e):{n=e.constructor,i=j;break}case o.isFragmentConstructor(e):{n=e,i=q;break}case typeof e=="string":{let s=Array.from(r._metaStorage).find(([a])=>a.name===e||a.name===C.toKebabCase(e)||a.name===C.toPascalCase(e));if(!(s&&s.length))throw new l(l.InvalidMetaParameterError,`Invalid parameter provided to get meta. Component with name ${e} not found in the meta storage.`);n=s[0],i=j;break}default:{n=e,i=A;break}}if(!r._metaStorage.has(n)){let s,a=n;for(;!s;){let u=Object.getPrototypeOf(a);if(!u)break;s=r._metaStorage.get(u),a=u;}s||(s=new i),r._metaStorage.set(n,new i().from(s));}return r._metaStorage.get(n)}static setMeta(e,t){let r=x.getInstance(),n=x.meta(e),i=typeof e=="function"?e:e.constructor;r._metaStorage.set(i,n?t.from(n):t);}static issuer(e){let t=this.getInstance();if(!e)throw new l(l.InvalidComponentParameterError,"Invalid parameter provided to get scope issuer. Parameter cannot be null or undefined.");return t._scopeIssuers.get(e)}static scope(e){let t=e?.constructor?.name||String(e),r=this.getInstance();if(!e)throw new l(l.InvalidScopeParameterError,"Invalid parameter provided to get scope. Parameter cannot be null or undefined.");if(!this.isAllowedForScopeAllocation(e)&&!this.isAllowedToBeRegistered(e))throw new l(l.InvalidScopeParameterError,`Invalid parameter provided to get scope. Component of type ${t} is not allowed for scope allocation.`);switch(true){case this.isAllowedForScopeAllocation(e):if(!r._registry.has(e))throw new l(l.ScopeNotFoundError,`Invalid parameter provided to get scope. Component of type ${t} does not have a scope allocated. Make sure to allocate a scope using A_Context.allocate() method before trying to get the scope.`);return r._registry.get(e);case this.isAllowedToBeRegistered(e):if(!r._scopeStorage.has(e))throw new l(l.ScopeNotFoundError,`Invalid parameter provided to get scope. Component of type ${t} does not have a scope registered. Make sure to register the component using A_Context.register() method before trying to get the scope.`);return r._scopeStorage.get(e);default:throw new l(l.InvalidScopeParameterError,`Invalid parameter provided to get scope. Component of type ${t} is not allowed to be registered.`)}}static featureTemplate(e,t,r=this.scope(t)){let n=m.getComponentName(t);if(!t)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Feature name cannot be null or undefined.");if(!o.isAllowedForFeatureDefinition(t))throw new l(l.InvalidFeatureTemplateParameterError,`Unable to get feature template. Component of type ${n} is not allowed for feature definition.`);return [...this.featureDefinition(e,t),...this.featureExtensions(e,t,r)]}static featureExtensions(e,t,r){let n=this.getInstance(),i=m.getComponentName(t);if(!t)throw new l(l.InvalidFeatureExtensionParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidFeatureExtensionParameterError,"Unable to get feature template. Feature name cannot be null or undefined.");if(!o.isAllowedForFeatureDefinition(t))throw new l(l.InvalidFeatureExtensionParameterError,`Unable to get feature template. Component of type ${i} is not allowed for feature definition.`);let s=m.getClassInheritanceChain(t).filter(d=>d!==M&&d!==z&&d!==k).map(d=>`${d.name}.${e}`),a=new Map,u=new Set;for(let d of s)for(let[h,g]of n._metaStorage)r.has(h)&&(o.isComponentMetaInstance(g)||o.isContainerMetaInstance(g))&&(u.add(h),g.extensions(d).forEach(D=>{let R=Array.from(u).reverse().find(X=>m.isInheritedFrom(h,X)&&X!==h);R&&a.delete(`${m.getComponentName(R)}.${D.handler}`),a.set(`${m.getComponentName(h)}.${D.handler}`,{dependency:new v(h),...D});}));return n.filterToMostDerived(r,Array.from(a.values()))}filterToMostDerived(e,t){return t.filter(r=>{let n=e.resolveConstructor(r.dependency.name);return !t.some(s=>{if(s===r)return false;let a=e.resolveConstructor(s.dependency.name);return !n||!a?false:n.prototype.isPrototypeOf(a.prototype)})})}static featureDefinition(e,t){let r;if(!e)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Feature name cannot be null or undefined.");if(!t)throw new l(l.InvalidFeatureTemplateParameterError,"Unable to get feature template. Component cannot be null or undefined.");switch(true){case t instanceof k:r="a-component-features";break;case t instanceof z:r="a-container-features";break;case t instanceof M:r="a-component-features";break;default:throw new l(l.InvalidFeatureTemplateParameterError,`A-Feature cannot be defined on the ${t} level`)}return [...this.meta(t)?.get(r)?.get(e)?.template||[]]}static abstractionTemplate(e,t){let r=m.getComponentName(t);if(!t)throw new l(l.InvalidAbstractionTemplateParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidAbstractionTemplateParameterError,"Unable to get feature template. Abstraction stage cannot be null or undefined.");if(!o.isAllowedForAbstractionDefinition(t))throw new l(l.InvalidAbstractionTemplateParameterError,`Unable to get feature template. Component of type ${r} is not allowed for feature definition.`);return [...this.abstractionExtensions(e,t)]}static abstractionExtensions(e,t){let r=this.getInstance(),n=m.getComponentName(t);if(!t)throw new l(l.InvalidAbstractionExtensionParameterError,"Unable to get feature template. Component cannot be null or undefined.");if(!e)throw new l(l.InvalidAbstractionExtensionParameterError,"Unable to get feature template. Abstraction stage cannot be null or undefined.");if(!o.isAllowedForAbstractionDefinition(t))throw new l(l.InvalidAbstractionExtensionParameterError,`Unable to get feature template. Component of type ${n} is not allowed for feature definition.`);let i=new Map,s=this.scope(t),a=new Set;for(let[u,d]of r._metaStorage)s.has(u)&&(o.isComponentMetaInstance(d)||o.isContainerMetaInstance(d))&&(a.add(u),d.abstractions(e).forEach(h=>{let g=Array.from(a).reverse().find(D=>m.isInheritedFrom(u,D)&&D!==u);g&&i.delete(`${m.getComponentName(g)}.${h.handler}`),i.set(`${m.getComponentName(u)}.${h.handler}`,{dependency:new v(u),...h});}));return r.filterToMostDerived(s,Array.from(i.values()))}static reset(){let e=x.getInstance();e._registry=new WeakMap;let t="root";x.environment==="server"&&(t=process.env[O.A_CONCEPT_ROOT_SCOPE]||"root"),x.environment==="browser"&&(t=window[O.A_CONCEPT_ROOT_SCOPE]||"root"),e._root=new F({name:t});}static isAllowedForScopeAllocation(e){return o.isContainerInstance(e)||o.isFeatureInstance(e)}static isAllowedToBeRegistered(e){return o.isEntityInstance(e)||o.isComponentInstance(e)||o.isFragmentInstance(e)||o.isErrorInstance(e)}static isAllowedForMeta(e){return o.isContainerInstance(e)||o.isComponentInstance(e)||o.isEntityInstance(e)}static isAllowedForMetaConstructor(e){return o.isContainerConstructor(e)||o.isComponentConstructor(e)||o.isEntityConstructor(e)}};_(x,"A_Context");var p=x;var Ee=class Ee extends E{};_(Ee,"A_AbstractionError"),Ee.AbstractionExtensionError="Unable to extend abstraction execution";var Z=Ee;function $e(c,e={}){return function(t,r,n){let i=m.getComponentName(t);if(!c)throw new Z(Z.AbstractionExtensionError,`Abstraction name must be provided to extend abstraction for '${i}'.`);if(!o.isConstructorAvailableForAbstraction(t))throw new Z(Z.AbstractionExtensionError,`Unable to extend Abstraction '${c}' for '${i}'. Only A-Containers and A-Components can extend Abstractions.`);let s,a=p.meta(t);switch(true){case(o.isContainerConstructor(t)||o.isContainerInstance(t)):s="a-container-abstractions";break;case(o.isComponentConstructor(t)||o.isComponentInstance(t)):s="a-component-abstractions";break}let u=`CONCEPT_ABSTRACTION::${c}`,d=a.get(s)?new A().from(a.get(s)):new A,h=[...d.get(u)||[]],g=h.findIndex(R=>R.handler===r),D={name:u,handler:r,behavior:e.behavior||"sync",throwOnError:e.throwOnError!==void 0?e.throwOnError:true,before:o.isArray(e.before)?new RegExp(`^${e.before.join("|").replace(/\./g,"\\.")}$`).source:e.before instanceof RegExp?e.before.source:"",after:o.isArray(e.after)?new RegExp(`^${e.after.join("|").replace(/\./g,"\\.")}$`).source:e.after instanceof RegExp?e.after.source:"",override:o.isArray(e.override)?new RegExp(`^${e.override.join("|").replace(/\./g,"\\.")}$`).source:e.after instanceof RegExp?e.after.source:""};g!==-1?h[g]=D:h.push(D),d.set(u,h),p.meta(t).set(s,d);}}_($e,"A_Abstraction_Extend");var Le=class Le{constructor(e){this._features=[];this._index=0;this._name=e.name,this._features=e.containers.map(t=>{let r=p.abstractionTemplate(this._name,t);return new Y({name:this._name,component:t,template:r})}),this._current=this._features[0];}static get Extend(){return $e}get name(){return this._name}get feature(){return this._current}get isDone(){return !this.feature||this._index>=this._features.length}[Symbol.iterator](){return {next:_(()=>this.isDone?(this._current=void 0,{value:void 0,done:true}):(this._current=this._features[this._index],{value:this._current,done:false}),"next")}}next(e){if(this._index>=this._features.length)return;let t=this._features.indexOf(e);this._index=t+1;}async process(e){if(!this.isDone)for(let t of this._features)await t.process(e);}};_(Le,"A_Abstraction");var b=Le;var _t=(a=>(a.Run="run",a.Build="build",a.Publish="publish",a.Deploy="deploy",a.Load="load",a.Start="start",a.Stop="stop",a))(_t||{}),ct=(e=>(e.LIFECYCLE="a-component-extensions",e))(ct||{});var Ue=class Ue{constructor(e){this.props=e;this._name=e.name||p.root.name,e.components&&e.components.length&&e.components.forEach(t=>this.scope.register(t)),e.fragments&&e.fragments.length&&e.fragments.forEach(t=>this.scope.register(t)),e.entities&&e.entities.length&&e.entities.forEach(t=>this.scope.register(t)),this._containers=e.containers||[];}static Load(e){return b.Extend("load",e)}static Publish(e){return b.Extend("publish")}static Deploy(e){return b.Extend("deploy",e)}static Build(e){return b.Extend("build",e)}static Run(e){return b.Extend("run",e)}static Start(e){return b.Extend("start",e)}static Stop(e){return b.Extend("stop",e)}get name(){return p.root.name}get scope(){return p.root}get register(){return this.scope.register.bind(this.scope)}get resolve(){return this.scope.resolve.bind(this.scope)}async load(e){await new b({name:"load",containers:this._containers}).process(e);}async run(e){await new b({name:"run",containers:this._containers}).process(e);}async start(e){await new b({name:"start",containers:this._containers}).process(e);}async stop(e){await new b({name:"stop",containers:this._containers}).process(e);}async build(e){await new b({name:"build",containers:this._containers}).process(e);}async deploy(e){await new b({name:"deploy",containers:this._containers}).process(e);}async publish(e){await new b({name:"publish",containers:this._containers}).process(e);}async call(e,t){return await new Y({name:e,component:t}).process()}};_(Ue,"A_Concept");var ze=Ue;var Ke=class Ke extends A{constructor(t){super();this.containers=t;}};_(Ke,"A_ConceptMeta");var Je=Ke;var ce=class ce extends E{};_(ce,"A_InjectError"),ce.InvalidInjectionTarget="Invalid target for A-Inject decorator",ce.MissingInjectionTarget="Missing target for A-Inject decorator";var W=ce;function pt(c,e){if(!c)throw new W(W.MissingInjectionTarget,"A-Inject decorator is missing the target to inject");return function(t,r,n){let i=m.getComponentName(t);if(!o.isTargetAvailableForInjection(t))throw new W(W.InvalidInjectionTarget,`A-Inject cannot be used on the target of type ${typeof t} (${i})`);let s=r?String(r):"constructor",a;switch(true){case(o.isComponentConstructor(t)||o.isComponentInstance(t)):a="a-component-injections";break;case o.isContainerInstance(t):a="a-container-injections";break;case o.isEntityInstance(t):a="a-component-injections";break}let u=p.meta(t).get(a)||new A,d=u.get(s)||[];d[n]=c instanceof v?c:new v(c,e),u.set(s,d),p.meta(t).set(a,u);}}_(pt,"A_Inject");
|
|
2
|
+
export{I as ASEID,w as ASEID_Error,b as A_Abstraction,Z as A_AbstractionError,$e as A_Abstraction_Extend,O as A_CONSTANTS__DEFAULT_ENV_VARIABLES,lt as A_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY,ee as A_CONSTANTS__ERROR_CODES,He as A_CONSTANTS__ERROR_DESCRIPTION,V as A_Caller,re as A_CallerError,m as A_CommonHelper,M as A_Component,j as A_ComponentMeta,ze as A_Concept,Je as A_ConceptMeta,z as A_Container,K as A_ContainerMeta,p as A_Context,l as A_ContextError,v as A_Dependency,y as A_DependencyError,we as A_Dependency_Default,xe as A_Dependency_Load,De as A_Dependency_Require,k as A_Entity,te as A_EntityError,q as A_EntityMeta,E as A_Error,Y as A_Feature,f as A_FeatureError,Oe as A_Feature_Define,Ne as A_Feature_Extend,C as A_FormatterHelper,J as A_Fragment,U as A_IdentityHelper,pt as A_Inject,W as A_InjectError,A as A_Meta,Te as A_MetaDecorator,F as A_Scope,T as A_ScopeError,ae as A_Stage,H as A_StageError,ne as A_StepManagerError,oe as A_StepsManager,at as A_TYPES__A_Stage_Status,it as A_TYPES__ComponentMetaKey,_t as A_TYPES__ConceptAbstractions,ct as A_TYPES__ConceptMetaKey,ot as A_TYPES__ContainerMetaKey,nt as A_TYPES__EntityFeatures,rt as A_TYPES__EntityMetaKey,tt as A_TYPES__FeatureState,o as A_TypeGuards};//# sourceMappingURL=index.mjs.map
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|