effectable 0.1.0

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.
Files changed (124) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -0
  3. package/build/LICENSE +21 -0
  4. package/build/bootstrap/bootstrap.d.ts +32 -0
  5. package/build/bootstrap/bootstrap.d.ts.map +1 -0
  6. package/build/bootstrap/bootstrap.js +179 -0
  7. package/build/bootstrap/bootstrap.js.map +1 -0
  8. package/build/bootstrap/index.d.ts +9 -0
  9. package/build/bootstrap/index.d.ts.map +1 -0
  10. package/build/bootstrap/index.js +14 -0
  11. package/build/bootstrap/index.js.map +1 -0
  12. package/build/bootstrap/types.d.ts +105 -0
  13. package/build/bootstrap/types.d.ts.map +1 -0
  14. package/build/bootstrap/types.js +26 -0
  15. package/build/bootstrap/types.js.map +1 -0
  16. package/build/component/Component.d.ts +126 -0
  17. package/build/component/Component.d.ts.map +1 -0
  18. package/build/component/Component.js +123 -0
  19. package/build/component/Component.js.map +1 -0
  20. package/build/component/GraphRuntime.d.ts +457 -0
  21. package/build/component/GraphRuntime.d.ts.map +1 -0
  22. package/build/component/GraphRuntime.js +1168 -0
  23. package/build/component/GraphRuntime.js.map +1 -0
  24. package/build/component/constants.d.ts +1 -0
  25. package/build/component/constants.d.ts.map +1 -0
  26. package/build/component/constants.js +2 -0
  27. package/build/component/constants.js.map +1 -0
  28. package/build/component/context.d.ts +199 -0
  29. package/build/component/context.d.ts.map +1 -0
  30. package/build/component/context.js +262 -0
  31. package/build/component/context.js.map +1 -0
  32. package/build/component/graphRuntime.constants.d.ts +13 -0
  33. package/build/component/graphRuntime.constants.d.ts.map +1 -0
  34. package/build/component/graphRuntime.constants.js +15 -0
  35. package/build/component/graphRuntime.constants.js.map +1 -0
  36. package/build/component/h.d.ts +48 -0
  37. package/build/component/h.d.ts.map +1 -0
  38. package/build/component/h.js +72 -0
  39. package/build/component/h.js.map +1 -0
  40. package/build/component/index.d.ts +19 -0
  41. package/build/component/index.d.ts.map +1 -0
  42. package/build/component/index.js +39 -0
  43. package/build/component/index.js.map +1 -0
  44. package/build/component/lifecycle.d.ts +179 -0
  45. package/build/component/lifecycle.d.ts.map +1 -0
  46. package/build/component/lifecycle.js +367 -0
  47. package/build/component/lifecycle.js.map +1 -0
  48. package/build/component/refs.d.ts +105 -0
  49. package/build/component/refs.d.ts.map +1 -0
  50. package/build/component/refs.js +128 -0
  51. package/build/component/refs.js.map +1 -0
  52. package/build/component/types.d.ts +169 -0
  53. package/build/component/types.d.ts.map +1 -0
  54. package/build/component/types.js +40 -0
  55. package/build/component/types.js.map +1 -0
  56. package/build/connect/connect.d.ts +31 -0
  57. package/build/connect/connect.d.ts.map +1 -0
  58. package/build/connect/connect.js +500 -0
  59. package/build/connect/connect.js.map +1 -0
  60. package/build/connect/index.d.ts +8 -0
  61. package/build/connect/index.d.ts.map +1 -0
  62. package/build/connect/index.js +11 -0
  63. package/build/connect/index.js.map +1 -0
  64. package/build/connect/types.d.ts +90 -0
  65. package/build/connect/types.d.ts.map +1 -0
  66. package/build/connect/types.js +8 -0
  67. package/build/connect/types.js.map +1 -0
  68. package/build/index.d.ts +26 -0
  69. package/build/index.d.ts.map +1 -0
  70. package/build/index.js +60 -0
  71. package/build/index.js.map +1 -0
  72. package/build/runtime/BusDecorators.d.ts +113 -0
  73. package/build/runtime/BusDecorators.d.ts.map +1 -0
  74. package/build/runtime/BusDecorators.js +302 -0
  75. package/build/runtime/BusDecorators.js.map +1 -0
  76. package/build/runtime/CommandBus.d.ts +43 -0
  77. package/build/runtime/CommandBus.d.ts.map +1 -0
  78. package/build/runtime/CommandBus.js +65 -0
  79. package/build/runtime/CommandBus.js.map +1 -0
  80. package/build/runtime/EventBus.d.ts +50 -0
  81. package/build/runtime/EventBus.d.ts.map +1 -0
  82. package/build/runtime/EventBus.js +90 -0
  83. package/build/runtime/EventBus.js.map +1 -0
  84. package/build/runtime/HandleRegistry.d.ts +143 -0
  85. package/build/runtime/HandleRegistry.d.ts.map +1 -0
  86. package/build/runtime/HandleRegistry.js +244 -0
  87. package/build/runtime/HandleRegistry.js.map +1 -0
  88. package/build/runtime/QueryBus.d.ts +43 -0
  89. package/build/runtime/QueryBus.d.ts.map +1 -0
  90. package/build/runtime/QueryBus.js +65 -0
  91. package/build/runtime/QueryBus.js.map +1 -0
  92. package/build/runtime/index.d.ts +13 -0
  93. package/build/runtime/index.d.ts.map +1 -0
  94. package/build/runtime/index.js +32 -0
  95. package/build/runtime/index.js.map +1 -0
  96. package/build/runtime/types.d.ts +79 -0
  97. package/build/runtime/types.d.ts.map +1 -0
  98. package/build/runtime/types.js +8 -0
  99. package/build/runtime/types.js.map +1 -0
  100. package/build/store/createStore.d.ts +36 -0
  101. package/build/store/createStore.d.ts.map +1 -0
  102. package/build/store/createStore.js +131 -0
  103. package/build/store/createStore.js.map +1 -0
  104. package/build/store/index.d.ts +14 -0
  105. package/build/store/index.d.ts.map +1 -0
  106. package/build/store/index.js +39 -0
  107. package/build/store/index.js.map +1 -0
  108. package/build/store/middleware.d.ts +38 -0
  109. package/build/store/middleware.d.ts.map +1 -0
  110. package/build/store/middleware.js +99 -0
  111. package/build/store/middleware.js.map +1 -0
  112. package/build/store/selector.d.ts +62 -0
  113. package/build/store/selector.d.ts.map +1 -0
  114. package/build/store/selector.js +226 -0
  115. package/build/store/selector.js.map +1 -0
  116. package/build/store/semanticStateTree.d.ts +91 -0
  117. package/build/store/semanticStateTree.d.ts.map +1 -0
  118. package/build/store/semanticStateTree.js +263 -0
  119. package/build/store/semanticStateTree.js.map +1 -0
  120. package/build/store/types.d.ts +259 -0
  121. package/build/store/types.d.ts.map +1 -0
  122. package/build/store/types.js +28 -0
  123. package/build/store/types.js.map +1 -0
  124. package/package.json +109 -0
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Re-export of Effectable runtime primitives.
3
+ *
4
+ * @module Effectable/runtime
5
+ */
6
+ export { HandleRegistry, forwardRef, UseRef, UseImperativeHandle, } from './HandleRegistry';
7
+ export { CommandBus } from './CommandBus';
8
+ export { QueryBus } from './QueryBus';
9
+ export { EventBus } from './EventBus';
10
+ export type { RuntimeCommand, RuntimeQuery, RuntimeEvent, RuntimeDispose, CommandHandler, QueryHandler, EventHandler, RuntimeCommandHandlerContract, RuntimeQueryHandlerContract, } from './types';
11
+ export { UseCommandBus, UseQueryBus, UseEventBus, OnCommand, OnQuery, OnEvent, createRuntimeBuses, wireRuntimeBuses, wireRuntimeBusesIfDecorated, instanceUsesRuntimeBusDecorators, wireRuntimeBusesAll, } from './BusDecorators';
12
+ export type { RuntimeBusesBundle } from './BusDecorators';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,UAAU,EACV,MAAM,EACN,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACT,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,gBAAgB,EAChB,2BAA2B,EAC3B,gCAAgC,EAChC,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * Re-export of Effectable runtime primitives.
4
+ *
5
+ * @module Effectable/runtime
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.wireRuntimeBusesAll = exports.instanceUsesRuntimeBusDecorators = exports.wireRuntimeBusesIfDecorated = exports.wireRuntimeBuses = exports.createRuntimeBuses = exports.OnEvent = exports.OnQuery = exports.OnCommand = exports.UseEventBus = exports.UseQueryBus = exports.UseCommandBus = exports.EventBus = exports.QueryBus = exports.CommandBus = exports.UseImperativeHandle = exports.UseRef = exports.forwardRef = exports.HandleRegistry = void 0;
9
+ var HandleRegistry_1 = require("./HandleRegistry");
10
+ Object.defineProperty(exports, "HandleRegistry", { enumerable: true, get: function () { return HandleRegistry_1.HandleRegistry; } });
11
+ Object.defineProperty(exports, "forwardRef", { enumerable: true, get: function () { return HandleRegistry_1.forwardRef; } });
12
+ Object.defineProperty(exports, "UseRef", { enumerable: true, get: function () { return HandleRegistry_1.UseRef; } });
13
+ Object.defineProperty(exports, "UseImperativeHandle", { enumerable: true, get: function () { return HandleRegistry_1.UseImperativeHandle; } });
14
+ var CommandBus_1 = require("./CommandBus");
15
+ Object.defineProperty(exports, "CommandBus", { enumerable: true, get: function () { return CommandBus_1.CommandBus; } });
16
+ var QueryBus_1 = require("./QueryBus");
17
+ Object.defineProperty(exports, "QueryBus", { enumerable: true, get: function () { return QueryBus_1.QueryBus; } });
18
+ var EventBus_1 = require("./EventBus");
19
+ Object.defineProperty(exports, "EventBus", { enumerable: true, get: function () { return EventBus_1.EventBus; } });
20
+ var BusDecorators_1 = require("./BusDecorators");
21
+ Object.defineProperty(exports, "UseCommandBus", { enumerable: true, get: function () { return BusDecorators_1.UseCommandBus; } });
22
+ Object.defineProperty(exports, "UseQueryBus", { enumerable: true, get: function () { return BusDecorators_1.UseQueryBus; } });
23
+ Object.defineProperty(exports, "UseEventBus", { enumerable: true, get: function () { return BusDecorators_1.UseEventBus; } });
24
+ Object.defineProperty(exports, "OnCommand", { enumerable: true, get: function () { return BusDecorators_1.OnCommand; } });
25
+ Object.defineProperty(exports, "OnQuery", { enumerable: true, get: function () { return BusDecorators_1.OnQuery; } });
26
+ Object.defineProperty(exports, "OnEvent", { enumerable: true, get: function () { return BusDecorators_1.OnEvent; } });
27
+ Object.defineProperty(exports, "createRuntimeBuses", { enumerable: true, get: function () { return BusDecorators_1.createRuntimeBuses; } });
28
+ Object.defineProperty(exports, "wireRuntimeBuses", { enumerable: true, get: function () { return BusDecorators_1.wireRuntimeBuses; } });
29
+ Object.defineProperty(exports, "wireRuntimeBusesIfDecorated", { enumerable: true, get: function () { return BusDecorators_1.wireRuntimeBusesIfDecorated; } });
30
+ Object.defineProperty(exports, "instanceUsesRuntimeBusDecorators", { enumerable: true, get: function () { return BusDecorators_1.instanceUsesRuntimeBusDecorators; } });
31
+ Object.defineProperty(exports, "wireRuntimeBusesAll", { enumerable: true, get: function () { return BusDecorators_1.wireRuntimeBusesAll; } });
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mDAK0B;AAJxB,gHAAA,cAAc,OAAA;AACd,4GAAA,UAAU,OAAA;AACV,wGAAA,MAAM,OAAA;AACN,qHAAA,mBAAmB,OAAA;AAErB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAYjB,iDAYyB;AAXvB,8GAAA,aAAa,OAAA;AACb,4GAAA,WAAW,OAAA;AACX,4GAAA,WAAW,OAAA;AACX,0GAAA,SAAS,OAAA;AACT,wGAAA,OAAO,OAAA;AACP,wGAAA,OAAO,OAAA;AACP,mHAAA,kBAAkB,OAAA;AAClB,iHAAA,gBAAgB,OAAA;AAChB,4HAAA,2BAA2B,OAAA;AAC3B,iIAAA,gCAAgC,OAAA;AAChC,oHAAA,mBAAmB,OAAA"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Shared types for Effectable runtime primitives.
3
+ *
4
+ * @module Effectable/runtime/types
5
+ */
6
+ /**
7
+ * Base shape of a runtime command.
8
+ */
9
+ export interface RuntimeCommand<TType extends string = string, TPayload = unknown> {
10
+ type: TType;
11
+ payload: TPayload;
12
+ }
13
+ /**
14
+ * Base shape of a runtime query.
15
+ */
16
+ export interface RuntimeQuery<TType extends string = string, TPayload = unknown> {
17
+ type: TType;
18
+ payload: TPayload;
19
+ }
20
+ /**
21
+ * Base shape of a runtime event.
22
+ */
23
+ export interface RuntimeEvent<TType extends string = string, TPayload = unknown> {
24
+ type: TType;
25
+ payload: TPayload;
26
+ }
27
+ /**
28
+ * Generic resource dispose function.
29
+ */
30
+ export type RuntimeDispose = () => void;
31
+ /**
32
+ * Command handler.
33
+ */
34
+ export type CommandHandler<TCommand extends RuntimeCommand = RuntimeCommand, TResult = void> = (command: TCommand) => TResult | Promise<TResult>;
35
+ /**
36
+ * Query handler.
37
+ */
38
+ export type QueryHandler<TQuery extends RuntimeQuery = RuntimeQuery, TResult = unknown> = (query: TQuery) => TResult | Promise<TResult>;
39
+ /**
40
+ * Event handler.
41
+ */
42
+ export type EventHandler<TEvent extends RuntimeEvent = RuntimeEvent> = (event: TEvent) => void;
43
+ /**
44
+ * Command-handler contract for a runtime bus.
45
+ */
46
+ export interface RuntimeCommandHandlerContract<TCommand extends RuntimeCommand = RuntimeCommand, TResult = unknown> {
47
+ /**
48
+ * Returns the supported command type.
49
+ *
50
+ * @returns {TCommand['type']} string command type
51
+ */
52
+ getCommandType(): TCommand['type'];
53
+ /**
54
+ * Executes command handling.
55
+ *
56
+ * @param {TCommand} command - incoming command
57
+ * @returns {TResult | Promise<TResult>} handling result
58
+ */
59
+ execute(command: TCommand): TResult | Promise<TResult>;
60
+ }
61
+ /**
62
+ * Query-handler contract for a runtime bus.
63
+ */
64
+ export interface RuntimeQueryHandlerContract<TQuery extends RuntimeQuery = RuntimeQuery, TResult = unknown> {
65
+ /**
66
+ * Returns the supported query type.
67
+ *
68
+ * @returns {TQuery['type']} string query type
69
+ */
70
+ getQueryType(): TQuery['type'];
71
+ /**
72
+ * Executes query handling.
73
+ *
74
+ * @param {TQuery} query - incoming query
75
+ * @returns {TResult | Promise<TResult>} handling result
76
+ */
77
+ execute(query: TQuery): TResult | Promise<TResult>;
78
+ }
79
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,QAAQ,GAAG,OAAO;IAC/E,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,QAAQ,GAAG,OAAO;IAC7E,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,QAAQ,GAAG,OAAO;IAC7E,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,QAAQ,SAAS,cAAc,GAAG,cAAc,EAAE,OAAO,GAAG,IAAI,IACzF,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,MAAM,SAAS,YAAY,GAAG,YAAY,EAAE,OAAO,GAAG,OAAO,IACpF,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,MAAM,SAAS,YAAY,GAAG,YAAY,IACjE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,6BAA6B,CAC5C,QAAQ,SAAS,cAAc,GAAG,cAAc,EAChD,OAAO,GAAG,OAAO;IAEjB;;;;OAIG;IACH,cAAc,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEnC;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B,CAC1C,MAAM,SAAS,YAAY,GAAG,YAAY,EAC1C,OAAO,GAAG,OAAO;IAEjB;;;;OAIG;IACH,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAE/B;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * Shared types for Effectable runtime primitives.
4
+ *
5
+ * @module Effectable/runtime/types
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Redux Store Creator with RxJS Support
3
+ *
4
+ * Implements createStore, compatible with Redux v4,
5
+ * but using RxJS for reactive state management.
6
+ *
7
+ * @module Effectable/store/createStore
8
+ */
9
+ import { Store, Reducer, Action, StoreEnhancer } from './types';
10
+ /**
11
+ * Creates a Redux Store with RxJS support
12
+ *
13
+ * Primary function for creating application state storage.
14
+ * Compatible with Redux v4 API, but uses BehaviorSubject for
15
+ * reactive state management.
16
+ *
17
+ * @template S - Store state type
18
+ * @template A - Action type (must extend the base Action)
19
+ *
20
+ * @param reducer - Root reducer function that handles actions
21
+ * @param initialState - Initial application state
22
+ * @param enhancer - Store enhancer, optional
23
+ * @returns Store object with dispatch, getState, state$, select, destroy
24
+ *
25
+ * @example
26
+ * // Simple Store without middleware
27
+ * const store = createStore(rootReducer, initialState);
28
+ *
29
+ * @example
30
+ * // Using the Store
31
+ * store.dispatch({ type: 'INCREMENT', payload: 1 });
32
+ * store.state$.subscribe(state => console.log('State:', state));
33
+ * const count$ = store.select(state => state.count);
34
+ */
35
+ export declare function createStore<S, A extends Action>(reducer: Reducer<S, A>, initialState: S, enhancer?: StoreEnhancer<S, A>): Store<S, A>;
36
+ //# sourceMappingURL=createStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createStore.d.ts","sourceRoot":"","sources":["../../src/store/createStore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAY,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAC7C,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EACtB,YAAY,EAAE,CAAC,EACf,QAAQ,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAC7B,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CA+Gb"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ /**
3
+ * Redux Store Creator with RxJS Support
4
+ *
5
+ * Implements createStore, compatible with Redux v4,
6
+ * but using RxJS for reactive state management.
7
+ *
8
+ * @module Effectable/store/createStore
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.createStore = createStore;
12
+ const rxjs_1 = require("rxjs");
13
+ const operators_1 = require("rxjs/operators");
14
+ /**
15
+ * Creates a Redux Store with RxJS support
16
+ *
17
+ * Primary function for creating application state storage.
18
+ * Compatible with Redux v4 API, but uses BehaviorSubject for
19
+ * reactive state management.
20
+ *
21
+ * @template S - Store state type
22
+ * @template A - Action type (must extend the base Action)
23
+ *
24
+ * @param reducer - Root reducer function that handles actions
25
+ * @param initialState - Initial application state
26
+ * @param enhancer - Store enhancer, optional
27
+ * @returns Store object with dispatch, getState, state$, select, destroy
28
+ *
29
+ * @example
30
+ * // Simple Store without middleware
31
+ * const store = createStore(rootReducer, initialState);
32
+ *
33
+ * @example
34
+ * // Using the Store
35
+ * store.dispatch({ type: 'INCREMENT', payload: 1 });
36
+ * store.state$.subscribe(state => console.log('State:', state));
37
+ * const count$ = store.select(state => state.count);
38
+ */
39
+ function createStore(reducer, initialState, enhancer) {
40
+ // If an enhancer is provided (e.g. from applyMiddleware), delegate creation
41
+ if (enhancer) {
42
+ return enhancer(createStore)(reducer, initialState);
43
+ }
44
+ // Internal BehaviorSubject for reactive state
45
+ // BehaviorSubject ensures new subscribers receive the current value
46
+ const state$ = new rxjs_1.BehaviorSubject(initialState);
47
+ // Flag to prevent dispatch while a reducer is running
48
+ let isDispatching = false;
49
+ /**
50
+ * Base dispatch without middleware
51
+ *
52
+ * Calls the reducer with the current state and action,
53
+ * gets the new state, and emits it on the state$ Observable.
54
+ *
55
+ * @param action - Action to process
56
+ * @returns The same action
57
+ */
58
+ function dispatch(action) {
59
+ // Action validation
60
+ if (typeof action !== 'object' || action === null) {
61
+ throw new Error('Actions must be plain objects. Use custom middleware for async actions.');
62
+ }
63
+ if (typeof action.type === 'undefined') {
64
+ throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');
65
+ }
66
+ // Reentrancy check (dispatch called inside a reducer)
67
+ if (isDispatching) {
68
+ throw new Error('Reducers may not dispatch actions.');
69
+ }
70
+ let newState;
71
+ try {
72
+ isDispatching = true;
73
+ // Get current state
74
+ const currentState = state$.getValue();
75
+ // Call reducer to get the new state
76
+ newState = reducer(currentState, action);
77
+ }
78
+ finally {
79
+ // Important: reset the flag before notifying subscribers
80
+ // so they can safely dispatch follow-up actions (as in Redux).
81
+ isDispatching = false;
82
+ }
83
+ // Emit the new state on the Observable after the reduce phase completes.
84
+ state$.next(newState);
85
+ return action;
86
+ }
87
+ /**
88
+ * Method to get the current state synchronously
89
+ *
90
+ * @returns Current Store state
91
+ */
92
+ const getState = () => state$.getValue();
93
+ /**
94
+ * Universal select method for applying selectors
95
+ *
96
+ * Applies a selector function to each new state
97
+ * and automatically filters unchanged results via distinctUntilChanged.
98
+ *
99
+ * @template T - Selector result type
100
+ * @param selectorFn - Selector function
101
+ * @returns Observable of the selector result
102
+ *
103
+ * @example
104
+ * const currentPath$ = store.select(state => state.navigation.currentPath);
105
+ * currentPath$.subscribe(path => console.log('Path:', path));
106
+ */
107
+ const select = (selectorFn) => {
108
+ return state$.pipe((0, operators_1.map)(selectorFn), (0, operators_1.distinctUntilChanged)());
109
+ };
110
+ /**
111
+ * Shuts down the Store and releases resources
112
+ *
113
+ * Calls complete() on the BehaviorSubject, which ends all subscriptions.
114
+ * After destroy() the Store is no longer usable.
115
+ *
116
+ * @example
117
+ * // On application shutdown
118
+ * store.destroy();
119
+ */
120
+ const destroy = () => {
121
+ state$.complete();
122
+ };
123
+ return {
124
+ dispatch,
125
+ getState,
126
+ state$: state$.asObservable(), // Return as Observable, not BehaviorSubject
127
+ select,
128
+ destroy,
129
+ };
130
+ }
131
+ //# sourceMappingURL=createStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createStore.js","sourceRoot":"","sources":["../../src/store/createStore.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AA+BH,kCAmHC;AAhJD,+BAAmD;AACnD,8CAA2D;AAG3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,WAAW,CACzB,OAAsB,EACtB,YAAe,EACf,QAA8B;IAE9B,4EAA4E;IAC5E,IAAI,QAAQ,EAAE,CAAC;QACb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C9D,OAAO,MAAM,CAAC,IAAI,CAChB,IAAA,eAAG,EAAC,UAAU,CAAC,EACf,IAAA,gCAAoB,GAAE,CACvB,CAAC;IACJ,CAAC,CAAC;IAEF;;;;;;;;;OASG;IACH,MAAM,OAAO,GAAG,GAAS,EAAE;QACzB,MAAM,CAAC,QAAQ,EAAE,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE,EAAE,4CAA4C;QAC3E,MAAM;QACN,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Redux-RxJS Store Core Library
3
+ *
4
+ * Core Store library with Redux and RxJS support.
5
+ *
6
+ * @module Effectable/store
7
+ */
8
+ export { createStore } from './createStore';
9
+ export { applyMiddleware, compose } from './middleware';
10
+ export { createSelector, createStructuredSelector } from './selector';
11
+ export { buildSemanticStateTree, buildSemanticStateTreeFromReducerMap, buildSemanticStateTreeFromStore, semanticStateTreeToJsonString, } from './semanticStateTree';
12
+ export type { BuildSemanticStateTreeOptions, SemanticJsonNode, SemanticJsonPrimitiveKind, } from './semanticStateTree';
13
+ export * from './types';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,oCAAoC,EACpC,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Redux-RxJS Store Core Library
4
+ *
5
+ * Core Store library with Redux and RxJS support.
6
+ *
7
+ * @module Effectable/store
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.semanticStateTreeToJsonString = exports.buildSemanticStateTreeFromStore = exports.buildSemanticStateTreeFromReducerMap = exports.buildSemanticStateTree = exports.createStructuredSelector = exports.createSelector = exports.compose = exports.applyMiddleware = exports.createStore = void 0;
25
+ var createStore_1 = require("./createStore");
26
+ Object.defineProperty(exports, "createStore", { enumerable: true, get: function () { return createStore_1.createStore; } });
27
+ var middleware_1 = require("./middleware");
28
+ Object.defineProperty(exports, "applyMiddleware", { enumerable: true, get: function () { return middleware_1.applyMiddleware; } });
29
+ Object.defineProperty(exports, "compose", { enumerable: true, get: function () { return middleware_1.compose; } });
30
+ var selector_1 = require("./selector");
31
+ Object.defineProperty(exports, "createSelector", { enumerable: true, get: function () { return selector_1.createSelector; } });
32
+ Object.defineProperty(exports, "createStructuredSelector", { enumerable: true, get: function () { return selector_1.createStructuredSelector; } });
33
+ var semanticStateTree_1 = require("./semanticStateTree");
34
+ Object.defineProperty(exports, "buildSemanticStateTree", { enumerable: true, get: function () { return semanticStateTree_1.buildSemanticStateTree; } });
35
+ Object.defineProperty(exports, "buildSemanticStateTreeFromReducerMap", { enumerable: true, get: function () { return semanticStateTree_1.buildSemanticStateTreeFromReducerMap; } });
36
+ Object.defineProperty(exports, "buildSemanticStateTreeFromStore", { enumerable: true, get: function () { return semanticStateTree_1.buildSemanticStateTreeFromStore; } });
37
+ Object.defineProperty(exports, "semanticStateTreeToJsonString", { enumerable: true, get: function () { return semanticStateTree_1.semanticStateTreeToJsonString; } });
38
+ __exportStar(require("./types"), exports);
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;AAEH,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2CAAwD;AAA/C,6GAAA,eAAe,OAAA;AAAE,qGAAA,OAAO,OAAA;AACjC,uCAAsE;AAA7D,0GAAA,cAAc,OAAA;AAAE,oHAAA,wBAAwB,OAAA;AACjD,yDAK6B;AAJ3B,2HAAA,sBAAsB,OAAA;AACtB,yIAAA,oCAAoC,OAAA;AACpC,oIAAA,+BAA+B,OAAA;AAC/B,kIAAA,6BAA6B,OAAA;AAO/B,0CAAwB"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Redux Middleware System
3
+ *
4
+ * Implements a middleware system similar to Redux.
5
+ * Middleware can intercept actions, perform side-effects,
6
+ * run async operations, and dispatch new actions.
7
+ *
8
+ * @module Effectable/store/middleware
9
+ */
10
+ /**
11
+ * Supports two modes:
12
+ * 1. `applyMiddleware(api, rawDispatch, ...middlewares)` — wrap an existing dispatch
13
+ * 2. `applyMiddleware(...middlewares)` — legacy enhancer-style for compatibility
14
+ * 3. Middleware may arrive as default-export functions from slice modules.
15
+ */
16
+ export declare function applyMiddleware(...args: unknown[]): unknown;
17
+ /**
18
+ * Compose function for function composition
19
+ *
20
+ * Helper for functional composition.
21
+ * Takes an array of functions and returns their composition.
22
+ *
23
+ * @template T - Argument and result type of the functions
24
+ * @param funcs - Array of functions to compose
25
+ * @returns Composed function
26
+ *
27
+ * @example
28
+ * const addOne = (x) => x + 1;
29
+ * const double = (x) => x * 2;
30
+ * const composed = compose(addOne, double);
31
+ * composed(5); // => (5 * 2) + 1 = 11
32
+ *
33
+ * @remarks
34
+ * Used internally by applyMiddleware to build the middleware chain.
35
+ * Rarely needed for external use.
36
+ */
37
+ export declare function compose<T>(...funcs: Array<(arg: T) => T>): (arg: T) => T;
38
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/store/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8CH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAoB5D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAG,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAiBzE"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ /**
3
+ * Redux Middleware System
4
+ *
5
+ * Implements a middleware system similar to Redux.
6
+ * Middleware can intercept actions, perform side-effects,
7
+ * run async operations, and dispatch new actions.
8
+ *
9
+ * @module Effectable/store/middleware
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.applyMiddleware = applyMiddleware;
13
+ exports.compose = compose;
14
+ /**
15
+ * Normalizes middleware: a function or a default-export module `{ default: fn }`.
16
+ *
17
+ * @param {unknown} middleware - middleware or module-namespace with default
18
+ * @returns {Middleware<unknown, S, D>}
19
+ */
20
+ function coerceMiddleware(middleware) {
21
+ if (typeof middleware === 'function') {
22
+ return middleware;
23
+ }
24
+ if (typeof middleware === 'object' && middleware !== null && Object.hasOwn(middleware, 'default')) {
25
+ const defaultExport = Reflect.get(middleware, 'default');
26
+ if (typeof defaultExport === 'function') {
27
+ return defaultExport;
28
+ }
29
+ }
30
+ throw new Error('Expected a middleware function or a module with default-exported middleware function.');
31
+ }
32
+ function wrapDispatch(api, rawDispatch, middlewares) {
33
+ const chain = middlewares.reduceRight((next, middleware) => {
34
+ const coerced = coerceMiddleware(middleware);
35
+ // FIXME: teach middleware so action can carry a type and the output has a known type
36
+ const resolvedMiddleware = coerced(api);
37
+ return resolvedMiddleware(next);
38
+ }, rawDispatch);
39
+ api.dispatch = chain;
40
+ return chain;
41
+ }
42
+ /**
43
+ * Supports two modes:
44
+ * 1. `applyMiddleware(api, rawDispatch, ...middlewares)` — wrap an existing dispatch
45
+ * 2. `applyMiddleware(...middlewares)` — legacy enhancer-style for compatibility
46
+ * 3. Middleware may arrive as default-export functions from slice modules.
47
+ */
48
+ function applyMiddleware(...args) {
49
+ if (args.length > 1 && typeof args[0] === 'object' && args[0] !== null && 'getState' in args[0]) {
50
+ const [api, rawDispatch, ...middlewares] = args;
51
+ return wrapDispatch(api, rawDispatch, middlewares);
52
+ }
53
+ const middlewares = args;
54
+ return (createStore) => (reducer, initialState) => {
55
+ const store = createStore(reducer, initialState);
56
+ const api = {
57
+ getState: store.getState,
58
+ dispatch: null,
59
+ };
60
+ const dispatch = wrapDispatch(api, store.dispatch, middlewares);
61
+ return {
62
+ ...store,
63
+ dispatch,
64
+ };
65
+ };
66
+ }
67
+ /**
68
+ * Compose function for function composition
69
+ *
70
+ * Helper for functional composition.
71
+ * Takes an array of functions and returns their composition.
72
+ *
73
+ * @template T - Argument and result type of the functions
74
+ * @param funcs - Array of functions to compose
75
+ * @returns Composed function
76
+ *
77
+ * @example
78
+ * const addOne = (x) => x + 1;
79
+ * const double = (x) => x * 2;
80
+ * const composed = compose(addOne, double);
81
+ * composed(5); // => (5 * 2) + 1 = 11
82
+ *
83
+ * @remarks
84
+ * Used internally by applyMiddleware to build the middleware chain.
85
+ * Rarely needed for external use.
86
+ */
87
+ function compose(...funcs) {
88
+ // No functions — return identity
89
+ if (funcs.length === 0) {
90
+ return (arg) => arg;
91
+ }
92
+ // Single function — return it
93
+ if (funcs.length === 1) {
94
+ return funcs[0];
95
+ }
96
+ // Multiple functions — compose via reduce
97
+ return funcs.reduce((a, b) => (arg) => a(b(arg)));
98
+ }
99
+ //# sourceMappingURL=middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/store/middleware.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAoDH,0CAoBC;AAsBD,0BAiBC;AA3GD;;;;;GAKG;AACH,SAAS,gBAAgB,CAAQ,UAAmB;IAClD,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE,CAAC;QACrC,OAAO,UAAuC,CAAC;IACjD,CAAC;IAED,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC;QAClG,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QACzD,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE,CAAC;YACxC,OAAO,aAA0C,CAAC;QACpD,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CACb,uFAAuF,CACxF,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,GAAwB,EACxB,WAAc,EACd,WAA2B;IAE3B,MAAM,KAAK,GAAG,WAAW,CAAC,WAAW,CACnC,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE;QACnB,MAAM,OAAO,GAAG,gBAAgB,CAAO,UAAU,CAAC,CAAC;QACnD,qFAAqF;QACrF,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAiE,CAAC;QACxG,OAAO,kBAAkB,CAAC,IAAS,CAAoD,CAAC;IAC1F,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C,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,0CAA0C;IAC1C,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,CAAC,GAAM,EAAE,EAAE,CACT,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Selector System with Memoization
3
+ *
4
+ * Implements a memoized selector system similar to the reselect library.
5
+ * Selectors recompute only when dependencies change,
6
+ * which optimizes performance of reactive subscriptions.
7
+ *
8
+ * @module Effectable/store/selector
9
+ */
10
+ import { Selector, MemoizedSelector } from './types';
11
+ /**
12
+ * Creates a memoized selector (overload for 1 input selector)
13
+ */
14
+ export declare function createSelector<S, R1, T>(selector1: Selector<S, R1>, combiner: (res1: R1) => T): MemoizedSelector<S, T>;
15
+ /**
16
+ * Creates a memoized selector (overload for 2 input selectors)
17
+ */
18
+ export declare function createSelector<S, R1, R2, T>(selector1: Selector<S, R1>, selector2: Selector<S, R2>, combiner: (res1: R1, res2: R2) => T): MemoizedSelector<S, T>;
19
+ /**
20
+ * Creates a memoized selector (overload for 3 input selectors)
21
+ */
22
+ export declare function createSelector<S, R1, R2, R3, T>(selector1: Selector<S, R1>, selector2: Selector<S, R2>, selector3: Selector<S, R3>, combiner: (res1: R1, res2: R2, res3: R3) => T): MemoizedSelector<S, T>;
23
+ /**
24
+ * Creates a memoized selector (overload for 4 input selectors)
25
+ */
26
+ export declare function createSelector<S, R1, R2, R3, R4, T>(selector1: Selector<S, R1>, selector2: Selector<S, R2>, selector3: Selector<S, R3>, selector4: Selector<S, R4>, combiner: (res1: R1, res2: R2, res3: R3, res4: R4) => T): MemoizedSelector<S, T>;
27
+ /**
28
+ * Creates a memoized selector (overload for 5 input selectors)
29
+ */
30
+ export declare function createSelector<S, R1, R2, R3, R4, R5, T>(selector1: Selector<S, R1>, selector2: Selector<S, R2>, selector3: Selector<S, R3>, selector4: Selector<S, R4>, selector5: Selector<S, R5>, combiner: (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5) => T): MemoizedSelector<S, T>;
31
+ /**
32
+ * Creates a memoized selector (overload for an array of selectors)
33
+ */
34
+ export declare function createSelector<S, T>(selectors: Selector<S, any>[], combiner: (...args: any[]) => T): MemoizedSelector<S, T>;
35
+ /**
36
+ * Creates a structured selector from an object of selectors
37
+ *
38
+ * Convenient utility for creating a selector that returns an object
39
+ * with results of several selectors.
40
+ *
41
+ * @template S - State type
42
+ * @template T - Result type (object with selectors)
43
+ *
44
+ * @param selectorsObj - Object where keys are field names and values are selectors
45
+ * @returns Memoized selector returning an object of results
46
+ *
47
+ * @example
48
+ * const selectNavigation = createStructuredSelector({
49
+ * currentPath: (state) => state.navigation.currentPath,
50
+ * breadcrumb: (state) => state.navigation.breadcrumb,
51
+ * canGoBack: (state) => state.navigation.history.backStack.length > 0,
52
+ * });
53
+ *
54
+ * // Result: { currentPath: '...', breadcrumb: [...], canGoBack: true }
55
+ * store.select(selectNavigation).subscribe(nav => {
56
+ * console.log('Navigation:', nav);
57
+ * });
58
+ */
59
+ export declare function createStructuredSelector<S, T extends Record<string, any>>(selectorsObj: {
60
+ [K in keyof T]: Selector<S, T[K]>;
61
+ }): MemoizedSelector<S, T>;
62
+ //# sourceMappingURL=selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../../src/store/selector.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAoHrD;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EACrC,SAAS,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,EAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,GACxB,gBAAgB,CA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