@ngxs/store 3.7.3 → 3.7.4-dev.master-327646e

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 (270) hide show
  1. package/README.md +16 -16
  2. package/bundles/ngxs-store-internals-testing.umd.js +318 -215
  3. package/bundles/ngxs-store-internals-testing.umd.js.map +1 -1
  4. package/bundles/ngxs-store-internals-testing.umd.min.js +1 -1
  5. package/bundles/ngxs-store-internals-testing.umd.min.js.map +1 -1
  6. package/bundles/ngxs-store-internals.umd.js +398 -211
  7. package/bundles/ngxs-store-internals.umd.js.map +1 -1
  8. package/bundles/ngxs-store-internals.umd.min.js +1 -1
  9. package/bundles/ngxs-store-internals.umd.min.js.map +1 -1
  10. package/bundles/ngxs-store-operators.umd.js +311 -310
  11. package/bundles/ngxs-store-operators.umd.js.map +1 -1
  12. package/bundles/ngxs-store-operators.umd.min.js +1 -1
  13. package/bundles/ngxs-store-operators.umd.min.js.map +1 -1
  14. package/bundles/ngxs-store.umd.js +4496 -4519
  15. package/bundles/ngxs-store.umd.js.map +1 -1
  16. package/bundles/ngxs-store.umd.min.js +1 -1
  17. package/bundles/ngxs-store.umd.min.js.map +1 -1
  18. package/esm2015/index.js +13 -13
  19. package/esm2015/internals/angular.js +20 -40
  20. package/esm2015/internals/decorator-injector-adapter.js +204 -0
  21. package/esm2015/internals/index.js +11 -10
  22. package/esm2015/internals/initial-state.js +34 -34
  23. package/esm2015/internals/internal-tokens.js +16 -16
  24. package/esm2015/internals/memoize.js +70 -70
  25. package/esm2015/internals/ngxs-bootstrapper.js +41 -41
  26. package/esm2015/internals/ngxs-store-internals.js +9 -9
  27. package/esm2015/internals/src/symbols.js +14 -14
  28. package/esm2015/internals/symbols.js +14 -14
  29. package/esm2015/internals/testing/fresh-platform.js +110 -71
  30. package/esm2015/internals/testing/helpers/ngxs-test.component.js +22 -22
  31. package/esm2015/internals/testing/helpers/ngxs-test.module.js +24 -24
  32. package/esm2015/internals/testing/index.js +8 -7
  33. package/esm2015/internals/testing/ngxs-store-internals-testing.js +9 -9
  34. package/esm2015/internals/testing/ngxs.setup.js +76 -76
  35. package/esm2015/internals/testing/skip-console-logging.js +62 -0
  36. package/esm2015/internals/testing/symbol.js +29 -29
  37. package/esm2015/ngxs-store.js +23 -27
  38. package/esm2015/operators/append.js +31 -31
  39. package/esm2015/operators/compose.js +24 -24
  40. package/esm2015/operators/iif.js +56 -56
  41. package/esm2015/operators/index.js +18 -18
  42. package/esm2015/operators/insert-item.js +41 -41
  43. package/esm2015/operators/internals.js +5 -5
  44. package/esm2015/operators/ngxs-store-operators.js +8 -8
  45. package/esm2015/operators/patch.js +38 -39
  46. package/esm2015/operators/remove-item.js +34 -34
  47. package/esm2015/operators/update-item.js +54 -52
  48. package/esm2015/operators/utils.js +50 -50
  49. package/esm2015/src/actions/actions.js +39 -39
  50. package/esm2015/src/actions/symbols.js +39 -39
  51. package/esm2015/src/actions-stream.js +138 -140
  52. package/esm2015/src/configs/messages.config.js +79 -87
  53. package/esm2015/src/decorators/action.js +48 -44
  54. package/esm2015/src/decorators/select/select-factory.js +49 -46
  55. package/esm2015/src/decorators/select/select.js +81 -45
  56. package/esm2015/src/decorators/select/symbols.js +94 -50
  57. package/esm2015/src/decorators/selector/selector.js +59 -55
  58. package/esm2015/src/decorators/selector/symbols.js +5 -5
  59. package/esm2015/src/decorators/selector-options.js +34 -34
  60. package/esm2015/src/decorators/state.js +83 -75
  61. package/esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +103 -96
  62. package/esm2015/src/execution/internal-ngxs-execution-strategy.js +45 -45
  63. package/esm2015/src/execution/noop-ngxs-execution-strategy.js +29 -27
  64. package/esm2015/src/execution/symbols.js +52 -29
  65. package/esm2015/src/internal/dispatcher.js +217 -217
  66. package/esm2015/src/internal/internals.js +493 -489
  67. package/esm2015/src/internal/lifecycle-state-manager.js +129 -129
  68. package/esm2015/src/internal/state-context-factory.js +138 -138
  69. package/esm2015/src/internal/state-factory.js +449 -429
  70. package/esm2015/src/internal/state-operations.js +133 -125
  71. package/esm2015/src/internal/state-operators.js +33 -33
  72. package/esm2015/src/internal/state-stream.js +30 -21
  73. package/esm2015/src/ivy/ivy-enabled-in-dev-mode.js +28 -40
  74. package/esm2015/src/module.js +157 -172
  75. package/esm2015/src/modules/ngxs-feature.module.js +63 -63
  76. package/esm2015/src/modules/ngxs-root.module.js +52 -52
  77. package/esm2015/src/operators/leave-ngxs.js +58 -58
  78. package/esm2015/src/operators/of-action.js +197 -191
  79. package/esm2015/src/plugin-manager.js +70 -70
  80. package/esm2015/src/plugin_api.js +10 -10
  81. package/esm2015/src/public_api.js +29 -29
  82. package/esm2015/src/public_to_deprecate.js +64 -64
  83. package/esm2015/src/state-token/state-token.js +45 -45
  84. package/esm2015/src/state-token/symbols.js +5 -5
  85. package/esm2015/src/store.js +190 -174
  86. package/esm2015/src/symbols.js +220 -221
  87. package/esm2015/src/utils/compose.js +44 -44
  88. package/esm2015/src/utils/freeze.js +35 -35
  89. package/esm2015/src/utils/selector-utils.js +221 -221
  90. package/esm2015/src/utils/store-validators.js +60 -65
  91. package/esm2015/src/utils/utils.js +143 -143
  92. package/esm5/index.js +13 -13
  93. package/esm5/internals/angular.js +20 -40
  94. package/esm5/internals/decorator-injector-adapter.js +204 -0
  95. package/esm5/internals/index.js +11 -10
  96. package/esm5/internals/initial-state.js +45 -45
  97. package/esm5/internals/internal-tokens.js +16 -16
  98. package/esm5/internals/memoize.js +71 -71
  99. package/esm5/internals/ngxs-bootstrapper.js +56 -56
  100. package/esm5/internals/ngxs-store-internals.js +9 -9
  101. package/esm5/internals/src/symbols.js +14 -14
  102. package/esm5/internals/symbols.js +14 -14
  103. package/esm5/internals/testing/fresh-platform.js +121 -81
  104. package/esm5/internals/testing/helpers/ngxs-test.component.js +32 -32
  105. package/esm5/internals/testing/helpers/ngxs-test.module.js +32 -32
  106. package/esm5/internals/testing/index.js +8 -7
  107. package/esm5/internals/testing/ngxs-store-internals-testing.js +9 -9
  108. package/esm5/internals/testing/ngxs.setup.js +98 -98
  109. package/esm5/internals/testing/skip-console-logging.js +62 -0
  110. package/esm5/internals/testing/symbol.js +29 -29
  111. package/esm5/ngxs-store.js +23 -27
  112. package/esm5/operators/append.js +31 -31
  113. package/esm5/operators/compose.js +28 -28
  114. package/esm5/operators/iif.js +56 -56
  115. package/esm5/operators/index.js +18 -18
  116. package/esm5/operators/insert-item.js +41 -41
  117. package/esm5/operators/internals.js +5 -5
  118. package/esm5/operators/ngxs-store-operators.js +8 -8
  119. package/esm5/operators/patch.js +39 -40
  120. package/esm5/operators/remove-item.js +34 -34
  121. package/esm5/operators/update-item.js +54 -52
  122. package/esm5/operators/utils.js +50 -50
  123. package/esm5/src/actions/actions.js +62 -62
  124. package/esm5/src/actions/symbols.js +39 -39
  125. package/esm5/src/actions-stream.js +184 -186
  126. package/esm5/src/configs/messages.config.js +79 -104
  127. package/esm5/src/decorators/action.js +60 -56
  128. package/esm5/src/decorators/select/select-factory.js +50 -47
  129. package/esm5/src/decorators/select/select.js +87 -50
  130. package/esm5/src/decorators/select/symbols.js +95 -51
  131. package/esm5/src/decorators/selector/selector.js +59 -55
  132. package/esm5/src/decorators/selector/symbols.js +5 -5
  133. package/esm5/src/decorators/selector-options.js +34 -34
  134. package/esm5/src/decorators/state.js +84 -76
  135. package/esm5/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +123 -121
  136. package/esm5/src/execution/internal-ngxs-execution-strategy.js +54 -54
  137. package/esm5/src/execution/noop-ngxs-execution-strategy.js +43 -41
  138. package/esm5/src/execution/symbols.js +52 -29
  139. package/esm5/src/internal/dispatcher.js +253 -253
  140. package/esm5/src/internal/internals.js +495 -491
  141. package/esm5/src/internal/lifecycle-state-manager.js +177 -177
  142. package/esm5/src/internal/state-context-factory.js +146 -146
  143. package/esm5/src/internal/state-factory.js +575 -563
  144. package/esm5/src/internal/state-operations.js +143 -139
  145. package/esm5/src/internal/state-operators.js +34 -34
  146. package/esm5/src/internal/state-stream.js +37 -25
  147. package/esm5/src/ivy/ivy-enabled-in-dev-mode.js +28 -40
  148. package/esm5/src/module.js +200 -215
  149. package/esm5/src/modules/ngxs-feature.module.js +65 -65
  150. package/esm5/src/modules/ngxs-root.module.js +47 -47
  151. package/esm5/src/operators/leave-ngxs.js +58 -58
  152. package/esm5/src/operators/of-action.js +223 -217
  153. package/esm5/src/plugin-manager.js +82 -82
  154. package/esm5/src/plugin_api.js +10 -10
  155. package/esm5/src/public_api.js +29 -29
  156. package/esm5/src/public_to_deprecate.js +64 -64
  157. package/esm5/src/state-token/state-token.js +57 -57
  158. package/esm5/src/state-token/symbols.js +5 -5
  159. package/esm5/src/store.js +241 -225
  160. package/esm5/src/symbols.js +229 -230
  161. package/esm5/src/utils/compose.js +55 -55
  162. package/esm5/src/utils/freeze.js +35 -35
  163. package/esm5/src/utils/selector-utils.js +230 -230
  164. package/esm5/src/utils/store-validators.js +78 -86
  165. package/esm5/src/utils/utils.js +151 -151
  166. package/fesm2015/ngxs-store-internals-testing.js +278 -177
  167. package/fesm2015/ngxs-store-internals-testing.js.map +1 -1
  168. package/fesm2015/ngxs-store-internals.js +378 -194
  169. package/fesm2015/ngxs-store-internals.js.map +1 -1
  170. package/fesm2015/ngxs-store-operators.js +313 -312
  171. package/fesm2015/ngxs-store-operators.js.map +1 -1
  172. package/fesm2015/ngxs-store.js +3999 -3979
  173. package/fesm2015/ngxs-store.js.map +1 -1
  174. package/fesm5/ngxs-store-internals-testing.js +325 -223
  175. package/fesm5/ngxs-store-internals-testing.js.map +1 -1
  176. package/fesm5/ngxs-store-internals.js +403 -219
  177. package/fesm5/ngxs-store-internals.js.map +1 -1
  178. package/fesm5/ngxs-store-operators.js +317 -316
  179. package/fesm5/ngxs-store-operators.js.map +1 -1
  180. package/fesm5/ngxs-store.js +4494 -4512
  181. package/fesm5/ngxs-store.js.map +1 -1
  182. package/index.d.ts +8 -8
  183. package/internals/angular.d.ts +1 -3
  184. package/internals/decorator-injector-adapter.d.ts +15 -0
  185. package/internals/index.d.ts +7 -6
  186. package/internals/initial-state.d.ts +8 -8
  187. package/internals/internal-tokens.d.ts +9 -9
  188. package/internals/memoize.d.ts +9 -9
  189. package/internals/ngxs-bootstrapper.d.ts +13 -13
  190. package/internals/ngxs-store-internals.d.ts +4 -4
  191. package/internals/ngxs-store-internals.metadata.json +1 -1
  192. package/internals/src/symbols.d.ts +7 -7
  193. package/internals/symbols.d.ts +7 -7
  194. package/internals/testing/fresh-platform.d.ts +1 -1
  195. package/internals/testing/helpers/ngxs-test.component.d.ts +5 -5
  196. package/internals/testing/helpers/ngxs-test.module.d.ts +4 -4
  197. package/internals/testing/index.d.ts +4 -3
  198. package/internals/testing/ngxs-store-internals-testing.d.ts +4 -4
  199. package/internals/testing/ngxs-store-internals-testing.metadata.json +1 -1
  200. package/internals/testing/ngxs.setup.d.ts +7 -7
  201. package/internals/testing/skip-console-logging.d.ts +1 -0
  202. package/internals/testing/symbol.d.ts +14 -14
  203. package/ngxs-store.d.ts +19 -23
  204. package/ngxs-store.metadata.json +1 -1
  205. package/operators/append.d.ts +6 -6
  206. package/operators/compose.d.ts +3 -2
  207. package/operators/iif.d.ts +11 -11
  208. package/operators/index.d.ts +13 -13
  209. package/operators/insert-item.d.ts +7 -7
  210. package/operators/internals.d.ts +2 -2
  211. package/operators/ngxs-store-operators.d.ts +4 -4
  212. package/operators/ngxs-store-operators.metadata.json +1 -1
  213. package/operators/patch.d.ts +6 -10
  214. package/operators/remove-item.d.ts +7 -7
  215. package/operators/update-item.d.ts +10 -10
  216. package/operators/utils.d.ts +10 -9
  217. package/package.json +3 -3
  218. package/src/actions/actions.d.ts +15 -15
  219. package/src/actions/symbols.d.ts +21 -21
  220. package/src/actions-stream.d.ts +49 -49
  221. package/src/configs/messages.config.d.ts +11 -30
  222. package/src/decorators/action.d.ts +5 -5
  223. package/src/decorators/select/select-factory.d.ts +13 -14
  224. package/src/decorators/select/select.d.ts +4 -4
  225. package/src/decorators/select/symbols.d.ts +14 -10
  226. package/src/decorators/selector/selector.d.ts +5 -5
  227. package/src/decorators/selector/symbols.d.ts +4 -4
  228. package/src/decorators/selector-options.d.ts +5 -5
  229. package/src/decorators/state.d.ts +6 -6
  230. package/src/execution/dispatch-outside-zone-ngxs-execution-strategy.d.ts +11 -12
  231. package/src/execution/internal-ngxs-execution-strategy.d.ts +7 -7
  232. package/src/execution/noop-ngxs-execution-strategy.d.ts +5 -5
  233. package/src/execution/symbols.d.ts +10 -6
  234. package/src/internal/dispatcher.d.ts +32 -32
  235. package/src/internal/internals.d.ts +166 -167
  236. package/src/internal/lifecycle-state-manager.d.ts +20 -20
  237. package/src/internal/state-context-factory.d.ts +15 -15
  238. package/src/internal/state-factory.d.ts +57 -58
  239. package/src/internal/state-operations.d.ts +19 -21
  240. package/src/internal/state-operators.d.ts +2 -2
  241. package/src/internal/state-stream.d.ts +11 -9
  242. package/src/ivy/ivy-enabled-in-dev-mode.d.ts +6 -14
  243. package/src/module.d.ts +23 -23
  244. package/src/modules/ngxs-feature.module.d.ts +13 -13
  245. package/src/modules/ngxs-root.module.d.ts +13 -13
  246. package/src/operators/leave-ngxs.d.ts +7 -7
  247. package/src/operators/of-action.d.ts +56 -43
  248. package/src/plugin-manager.d.ts +10 -10
  249. package/src/plugin_api.d.ts +5 -5
  250. package/src/public_api.d.ts +17 -17
  251. package/src/public_to_deprecate.d.ts +21 -21
  252. package/src/state-token/state-token.d.ts +7 -7
  253. package/src/state-token/symbols.d.ts +5 -5
  254. package/src/store.d.ts +59 -53
  255. package/src/symbols.d.ts +138 -137
  256. package/src/utils/compose.d.ts +23 -23
  257. package/src/utils/freeze.d.ts +5 -5
  258. package/src/utils/selector-utils.d.ts +23 -23
  259. package/src/utils/store-validators.d.ts +7 -8
  260. package/src/utils/utils.d.ts +46 -46
  261. package/types/index.d.ts +2 -2
  262. package/esm2015/src/host-environment/host-environment.js +0 -31
  263. package/esm2015/src/internal/config-validator.js +0 -67
  264. package/esm2015/src/ivy/ensure-state-class-is-injectable.js +0 -34
  265. package/esm5/src/host-environment/host-environment.js +0 -29
  266. package/esm5/src/internal/config-validator.js +0 -76
  267. package/esm5/src/ivy/ensure-state-class-is-injectable.js +0 -34
  268. package/src/host-environment/host-environment.d.ts +0 -6
  269. package/src/internal/config-validator.d.ts +0 -10
  270. package/src/ivy/ensure-state-class-is-injectable.d.ts +0 -6
@@ -1,210 +1,394 @@
1
- import { getPlatform, COMPILER_OPTIONS, Injectable, InjectionToken } from '@angular/core';
1
+ import { Injectable, InjectionToken, ɵɵdirectiveInject, INJECTOR, ɵglobal } from '@angular/core';
2
2
  import { ReplaySubject } from 'rxjs';
3
3
 
4
- /**
5
- * @fileoverview added by tsickle
6
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7
- */
8
- /**
9
- * @param {?} a
10
- * @param {?} b
11
- * @return {?}
12
- */
13
- function defaultEqualityCheck(a, b) {
14
- return a === b;
15
- }
16
- /**
17
- * @param {?} equalityCheck
18
- * @param {?} prev
19
- * @param {?} next
20
- * @return {?}
21
- */
22
- function areArgumentsShallowlyEqual(equalityCheck, prev, next) {
23
- if (prev === null || next === null || prev.length !== next.length) {
24
- return false;
25
- }
26
- // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.
27
- /** @type {?} */
28
- const length = prev.length;
29
- for (let i = 0; i < length; i++) {
30
- if (!equalityCheck(prev[i], next[i])) {
31
- return false;
32
- }
33
- }
34
- return true;
35
- }
36
- /**
37
- * Memoize a function on its last inputs only.
38
- * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js
39
- *
40
- * @ignore
41
- * @template T
42
- * @param {?} func
43
- * @param {?=} equalityCheck
44
- * @return {?}
45
- */
46
- function memoize(func, equalityCheck = defaultEqualityCheck) {
47
- /** @type {?} */
48
- let lastArgs = null;
49
- /** @type {?} */
50
- let lastResult = null;
51
- // we reference arguments instead of spreading them for performance reasons
52
- /**
53
- * @return {?}
54
- */
55
- function memoized() {
56
- if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {
57
- // apply arguments instead of spreading for performance.
58
- lastResult = ((/** @type {?} */ (func))).apply(null, arguments);
59
- }
60
- lastArgs = arguments;
61
- return lastResult;
62
- }
63
- ((/** @type {?} */ (memoized))).reset = (/**
64
- * @return {?}
65
- */
66
- function () {
67
- // The hidden (for now) ability to reset the memoization
68
- lastArgs = null;
69
- lastResult = null;
70
- });
71
- return (/** @type {?} */ (memoized));
4
+ /**
5
+ * @fileoverview added by tsickle
6
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7
+ */
8
+ /**
9
+ * @return {?}
10
+ */
11
+ function isAngularInTestMode() {
12
+ // This is safe to check for these properties in the following way since `typeof` does not
13
+ // throw an exception if the value does not exist in the scope.
14
+ // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).
15
+ // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into
16
+ // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.
17
+ // this will return undefined `global.jest`, but `jest` will not equal undefined.
18
+ return (typeof __karma__ !== 'undefined' ||
19
+ typeof jasmine !== 'undefined' ||
20
+ typeof jest !== 'undefined' ||
21
+ typeof Mocha !== 'undefined');
72
22
  }
73
23
 
74
- /**
75
- * @fileoverview added by tsickle
76
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
77
- */
78
- /**
79
- * @return {?}
80
- */
81
- function _isAngularInTestMode() {
82
- /** @type {?} */
83
- const platformRef = getPlatform();
84
- if (!platformRef)
85
- return false;
86
- /** @type {?} */
87
- const compilerOptions = platformRef.injector.get(COMPILER_OPTIONS, null);
88
- if (!compilerOptions)
89
- return false;
90
- /** @type {?} */
91
- const isInTestMode = compilerOptions.some((/**
92
- * @param {?} item
93
- * @return {?}
94
- */
95
- (item) => {
96
- /** @type {?} */
97
- const providers = (item && item.providers) || [];
98
- return providers.some((/**
99
- * @param {?} provider
100
- * @return {?}
101
- */
102
- (provider) => {
103
- return ((provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||
104
- false);
105
- }));
106
- }));
107
- return isInTestMode;
108
- }
109
- /** @type {?} */
110
- const isAngularInTestMode = memoize(_isAngularInTestMode);
24
+ /**
25
+ * @fileoverview added by tsickle
26
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
27
+ */
28
+ class NgxsBootstrapper {
29
+ constructor() {
30
+ /**
31
+ * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
32
+ */
33
+ this.bootstrap$ = new ReplaySubject(1);
34
+ }
35
+ /**
36
+ * @return {?}
37
+ */
38
+ get appBootstrapped$() {
39
+ return this.bootstrap$.asObservable();
40
+ }
41
+ /**
42
+ * This event will be emitted after attaching `ComponentRef` of the root component
43
+ * to the tree of views, that's a signal that application has been fully rendered
44
+ * @return {?}
45
+ */
46
+ bootstrap() {
47
+ this.bootstrap$.next(true);
48
+ this.bootstrap$.complete();
49
+ }
50
+ }
51
+ NgxsBootstrapper.decorators = [
52
+ { type: Injectable }
53
+ ];
54
+ if (false) {
55
+ /**
56
+ * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
57
+ * @type {?}
58
+ * @private
59
+ */
60
+ NgxsBootstrapper.prototype.bootstrap$;
61
+ }
111
62
 
112
- /**
113
- * @fileoverview added by tsickle
114
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
115
- */
116
- class NgxsBootstrapper {
117
- constructor() {
118
- /**
119
- * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
120
- */
121
- this.bootstrap$ = new ReplaySubject(1);
122
- }
123
- /**
124
- * @return {?}
125
- */
126
- get appBootstrapped$() {
127
- return this.bootstrap$.asObservable();
128
- }
129
- /**
130
- * This event will be emitted after attaching `ComponentRef` of the root component
131
- * to the tree of views, that's a signal that application has been fully rendered
132
- * @return {?}
133
- */
134
- bootstrap() {
135
- this.bootstrap$.next(true);
136
- this.bootstrap$.complete();
137
- }
138
- }
139
- NgxsBootstrapper.decorators = [
140
- { type: Injectable }
141
- ];
142
- if (false) {
143
- /**
144
- * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
145
- * @type {?}
146
- * @private
147
- */
148
- NgxsBootstrapper.prototype.bootstrap$;
63
+ /**
64
+ * @fileoverview added by tsickle
65
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
66
+ */
67
+ /**
68
+ * @param {?} a
69
+ * @param {?} b
70
+ * @return {?}
71
+ */
72
+ function defaultEqualityCheck(a, b) {
73
+ return a === b;
74
+ }
75
+ /**
76
+ * @param {?} equalityCheck
77
+ * @param {?} prev
78
+ * @param {?} next
79
+ * @return {?}
80
+ */
81
+ function areArgumentsShallowlyEqual(equalityCheck, prev, next) {
82
+ if (prev === null || next === null || prev.length !== next.length) {
83
+ return false;
84
+ }
85
+ // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.
86
+ /** @type {?} */
87
+ const length = prev.length;
88
+ for (let i = 0; i < length; i++) {
89
+ if (!equalityCheck(prev[i], next[i])) {
90
+ return false;
91
+ }
92
+ }
93
+ return true;
94
+ }
95
+ /**
96
+ * Memoize a function on its last inputs only.
97
+ * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js
98
+ *
99
+ * @ignore
100
+ * @template T
101
+ * @param {?} func
102
+ * @param {?=} equalityCheck
103
+ * @return {?}
104
+ */
105
+ function memoize(func, equalityCheck = defaultEqualityCheck) {
106
+ /** @type {?} */
107
+ let lastArgs = null;
108
+ /** @type {?} */
109
+ let lastResult = null;
110
+ // we reference arguments instead of spreading them for performance reasons
111
+ /**
112
+ * @return {?}
113
+ */
114
+ function memoized() {
115
+ if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {
116
+ // apply arguments instead of spreading for performance.
117
+ lastResult = ((/** @type {?} */ (func))).apply(null, arguments);
118
+ }
119
+ lastArgs = arguments;
120
+ return lastResult;
121
+ }
122
+ ((/** @type {?} */ (memoized))).reset = (/**
123
+ * @return {?}
124
+ */
125
+ function () {
126
+ // The hidden (for now) ability to reset the memoization
127
+ lastArgs = null;
128
+ lastResult = null;
129
+ });
130
+ return (/** @type {?} */ (memoized));
149
131
  }
150
132
 
151
- /**
152
- * @fileoverview added by tsickle
153
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
154
- */
155
- /** @type {?} */
156
- const INITIAL_STATE_TOKEN = new InjectionToken('INITIAL_STATE_TOKEN');
157
- class InitialState {
158
- /**
159
- * @param {?} state
160
- * @return {?}
161
- */
162
- static set(state) {
163
- this.value = state;
164
- }
165
- /**
166
- * @return {?}
167
- */
168
- static pop() {
169
- /** @type {?} */
170
- const state = this.value;
171
- this.value = {};
172
- return state;
173
- }
174
- }
175
- InitialState.value = {};
176
- if (false) {
177
- /**
178
- * @type {?}
179
- * @private
180
- */
181
- InitialState.value;
133
+ /**
134
+ * @fileoverview added by tsickle
135
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
136
+ */
137
+ /** @type {?} */
138
+ const INITIAL_STATE_TOKEN = new InjectionToken('INITIAL_STATE_TOKEN');
139
+ class InitialState {
140
+ /**
141
+ * @param {?} state
142
+ * @return {?}
143
+ */
144
+ static set(state) {
145
+ this.value = state;
146
+ }
147
+ /**
148
+ * @return {?}
149
+ */
150
+ static pop() {
151
+ /** @type {?} */
152
+ const state = this.value;
153
+ this.value = {};
154
+ return state;
155
+ }
156
+ }
157
+ InitialState.value = {};
158
+ if (false) {
159
+ /**
160
+ * @type {?}
161
+ * @private
162
+ */
163
+ InitialState.value;
182
164
  }
183
165
 
184
- /**
185
- * @fileoverview added by tsickle
186
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
187
- */
188
- /**
189
- * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally
190
- * @type {?}
191
- */
192
- const NGXS_STATE_CONTEXT_FACTORY = new InjectionToken('Internals.StateContextFactory');
193
- /**
194
- * @see StateFactory as it's referenced by this token to be accessed by plugins internally
195
- * @type {?}
196
- */
166
+ /**
167
+ * @fileoverview added by tsickle
168
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
169
+ */
170
+ /**
171
+ * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally
172
+ * @type {?}
173
+ */
174
+ const NGXS_STATE_CONTEXT_FACTORY = new InjectionToken('Internals.StateContextFactory');
175
+ /**
176
+ * @see StateFactory as it's referenced by this token to be accessed by plugins internally
177
+ * @type {?}
178
+ */
197
179
  const NGXS_STATE_FACTORY = new InjectionToken('Internals.StateFactory');
198
180
 
199
- /**
200
- * @fileoverview added by tsickle
201
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
181
+ /**
182
+ * @fileoverview added by tsickle
183
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
184
+ */
185
+ // Angular doesn't export `NG_FACTORY_DEF`.
186
+ /** @type {?} */
187
+ const NG_FACTORY_DEF = 'ɵfac';
188
+ // A `Symbol` which is used to save the `Injector` onto the class instance.
189
+ /** @type {?} */
190
+ const InjectorInstance = Symbol('InjectorInstance');
191
+ // A `Symbol` which is used to determine if factory has been decorated previously or not.
192
+ /** @type {?} */
193
+ const FactoryHasBeenDecorated = Symbol('FactoryHasBeenDecorated');
194
+ // A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot
195
+ // be retrieved within the `constructor` since it's set after the `factory()` is called.
196
+ /** @type {?} */
197
+ const InjectorNotifier = Symbol('InjectorNotifier');
198
+ /**
199
+ * @record
200
+ */
201
+ function PrototypeWithInjectorNotifier() { }
202
+ if (false) {
203
+ /* Skipping unnamed member:
204
+ [InjectorNotifier]?: ReplaySubject<boolean>;*/
205
+ }
206
+ /**
207
+ * @param {?} target
208
+ * @return {?}
209
+ */
210
+ function ensureInjectorNotifierIsCaptured(target) {
211
+ if (target[InjectorNotifier]) {
212
+ return (/** @type {?} */ (target[InjectorNotifier]));
213
+ }
214
+ else {
215
+ /** @type {?} */
216
+ const injectorNotifier$ = new ReplaySubject(1);
217
+ Object.defineProperty(target, InjectorNotifier, {
218
+ get: (/**
219
+ * @return {?}
220
+ */
221
+ () => injectorNotifier$)
222
+ });
223
+ return injectorNotifier$;
224
+ }
225
+ }
226
+ // eslint-disable-next-line @typescript-eslint/ban-types
227
+ /**
228
+ * @param {?} target
229
+ * @return {?}
230
+ */
231
+ function ensureLocalInjectorCaptured(target) {
232
+ if (FactoryHasBeenDecorated in target.constructor.prototype) {
233
+ return;
234
+ }
235
+ /** @type {?} */
236
+ const constructor = target.constructor;
237
+ // Means we're in AOT mode.
238
+ if (typeof constructor[NG_FACTORY_DEF] === 'function') {
239
+ decorateFactory(constructor);
240
+ }
241
+ else if (ngDevMode) {
242
+ // We're running in JIT mode and that means we're not able to get the compiled definition
243
+ // on the class inside the property decorator during the current message loop tick. We have
244
+ // to wait for the next message loop tick. Note that this is safe since this Promise will be
245
+ // resolved even before the `APP_INITIALIZER` is resolved.
246
+ // The below code also will be executed only in development mode, since it's never recommended
247
+ // to use the JIT compiler in production mode (by setting "aot: false").
248
+ decorateFactoryLater(constructor);
249
+ }
250
+ target.constructor.prototype[FactoryHasBeenDecorated] = true;
251
+ }
252
+ /**
253
+ * @template T
254
+ * @param {?} instance
255
+ * @param {?} token
256
+ * @return {?}
257
+ */
258
+ function localInject(instance, token) {
259
+ /** @type {?} */
260
+ const injector = instance[InjectorInstance];
261
+ return injector ? injector.get(token) : null;
262
+ }
263
+ /**
264
+ * @param {?} constructor
265
+ * @return {?}
266
+ */
267
+ function decorateFactory(constructor) {
268
+ /** @type {?} */
269
+ const factory = constructor[NG_FACTORY_DEF];
270
+ if (typeof factory !== 'function') {
271
+ return;
272
+ }
273
+ // Let's try to get any definition.
274
+ // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first
275
+ // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).
276
+ /** @type {?} */
277
+ const def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;
278
+ /** @type {?} */
279
+ const decoratedFactory = (/**
280
+ * @return {?}
281
+ */
282
+ () => {
283
+ /** @type {?} */
284
+ const instance = factory();
285
+ // Caretaker note: `inject()` won't work here.
286
+ // We can use the `directiveInject` only during the component
287
+ // construction, since Angular captures the currently active injector.
288
+ // We're not able to use this function inside the getter (when the `selectorId` property is
289
+ // requested for the first time), since the currently active injector will be null.
290
+ instance[InjectorInstance] = ɵɵdirectiveInject(
291
+ // We're using `INJECTOR` token except of the `Injector` class since the compiler
292
+ // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.
293
+ // Caretaker note: that this is the same way of getting the injector.
294
+ INJECTOR);
295
+ // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.
296
+ /** @type {?} */
297
+ const injectorNotifier$ = instance[InjectorNotifier];
298
+ if (injectorNotifier$) {
299
+ injectorNotifier$.next(true);
300
+ injectorNotifier$.complete();
301
+ }
302
+ return instance;
303
+ });
304
+ // If we've found any definition then it's enough to override the `def.factory` since Angular
305
+ // code uses the `def.factory` and then fallbacks to `ɵfac`.
306
+ if (def) {
307
+ def.factory = decoratedFactory;
308
+ }
309
+ // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular
310
+ // still uses the `ɵfac`.
311
+ Object.defineProperty(constructor, NG_FACTORY_DEF, {
312
+ get: (/**
313
+ * @return {?}
314
+ */
315
+ () => decoratedFactory)
316
+ });
317
+ }
318
+ /**
319
+ * @param {?} constructor
320
+ * @return {?}
321
+ */
322
+ function decorateFactoryLater(constructor) {
323
+ // This function actually will be tree-shaken away when building for production since it's guarded with `ngDevMode`.
324
+ // We're having the `try-catch` here because of the `SyncTestZoneSpec`, which throws
325
+ // an error when micro or macrotask is used within a synchronous test. E.g. `Cannot call
326
+ // Promise.then from within a sync test`.
327
+ try {
328
+ Promise.resolve().then((/**
329
+ * @return {?}
330
+ */
331
+ () => {
332
+ decorateFactory(constructor);
333
+ }));
334
+ }
335
+ catch (_a) {
336
+ // This is kind of a "hack", but we try to be backwards-compatible,
337
+ // tho this `catch` block will only be executed when tests are run with Jasmine or Jest.
338
+ ɵglobal.process &&
339
+ ɵglobal.process.nextTick &&
340
+ ɵglobal.process.nextTick((/**
341
+ * @return {?}
342
+ */
343
+ () => {
344
+ decorateFactory(constructor);
345
+ }));
346
+ }
347
+ }
348
+ /**
349
+ * @record
350
+ */
351
+ function Definition() { }
352
+ if (false) {
353
+ /** @type {?} */
354
+ Definition.prototype.factory;
355
+ }
356
+ /**
357
+ * @record
358
+ */
359
+ function ConstructorWithDefinitionAndFactory() { }
360
+ if (false) {
361
+ /** @type {?|undefined} */
362
+ ConstructorWithDefinitionAndFactory.prototype.ɵprov;
363
+ /** @type {?|undefined} */
364
+ ConstructorWithDefinitionAndFactory.prototype.ɵpipe;
365
+ /** @type {?|undefined} */
366
+ ConstructorWithDefinitionAndFactory.prototype.ɵcmp;
367
+ /** @type {?|undefined} */
368
+ ConstructorWithDefinitionAndFactory.prototype.ɵdir;
369
+ /* Skipping unnamed member:
370
+ [NG_FACTORY_DEF]?: Factory;*/
371
+ }
372
+ /**
373
+ * @record
374
+ */
375
+ function PrivateInstance() { }
376
+ if (false) {
377
+ /* Skipping unnamed member:
378
+ [InjectorInstance]?: Injector;*/
379
+ /* Skipping unnamed member:
380
+ [InjectorNotifier]?: ReplaySubject<boolean>;*/
381
+ }
382
+
383
+ /**
384
+ * @fileoverview added by tsickle
385
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
202
386
  */
203
387
 
204
- /**
205
- * @fileoverview added by tsickle
206
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
388
+ /**
389
+ * @fileoverview added by tsickle
390
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
207
391
  */
208
392
 
209
- export { INITIAL_STATE_TOKEN, InitialState, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, NgxsBootstrapper, isAngularInTestMode, memoize };
393
+ export { INITIAL_STATE_TOKEN, InitialState, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, NgxsBootstrapper, ensureInjectorNotifierIsCaptured, ensureLocalInjectorCaptured, isAngularInTestMode, localInject, memoize };
210
394
  //# sourceMappingURL=ngxs-store-internals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngxs-store-internals.js","sources":["ng://@ngxs/store/internals/memoize.ts","ng://@ngxs/store/internals/angular.ts","ng://@ngxs/store/internals/ngxs-bootstrapper.ts","ng://@ngxs/store/internals/initial-state.ts","ng://@ngxs/store/internals/internal-tokens.ts"],"sourcesContent":["function defaultEqualityCheck(a: any, b: any) {\r\n return a === b;\r\n}\r\n\r\nfunction areArgumentsShallowlyEqual(\r\n equalityCheck: (a: any, b: any) => boolean,\r\n prev: IArguments | null,\r\n next: IArguments | null\r\n) {\r\n if (prev === null || next === null || prev.length !== next.length) {\r\n return false;\r\n }\r\n\r\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\r\n const length = prev.length;\r\n for (let i = 0; i < length; i++) {\r\n if (!equalityCheck(prev[i], next[i])) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Memoize a function on its last inputs only.\r\n * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js\r\n *\r\n * @ignore\r\n */\r\nexport function memoize<T extends (...args: any[]) => any>(\r\n func: T,\r\n equalityCheck = defaultEqualityCheck\r\n): T {\r\n let lastArgs: IArguments | null = null;\r\n let lastResult: any = null;\r\n // we reference arguments instead of spreading them for performance reasons\r\n function memoized() {\r\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\r\n // apply arguments instead of spreading for performance.\r\n lastResult = (<Function>func).apply(null, arguments);\r\n }\r\n\r\n lastArgs = arguments;\r\n return lastResult;\r\n }\r\n (<any>memoized).reset = function() {\r\n // The hidden (for now) ability to reset the memoization\r\n lastArgs = null;\r\n lastResult = null;\r\n };\r\n return memoized as T;\r\n}\r\n","import { getPlatform, COMPILER_OPTIONS, CompilerOptions, PlatformRef } from '@angular/core';\r\nimport { memoize } from './memoize';\r\n\r\nfunction _isAngularInTestMode() {\r\n const platformRef: PlatformRef | null = getPlatform();\r\n if (!platformRef) return false;\r\n const compilerOptions = platformRef.injector.get<any>(COMPILER_OPTIONS, null);\r\n if (!compilerOptions) return false;\r\n const isInTestMode = compilerOptions.some((item: CompilerOptions) => {\r\n const providers = (item && item.providers) || [];\r\n return providers.some((provider: any) => {\r\n return (\r\n (provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||\r\n false\r\n );\r\n });\r\n });\r\n return isInTestMode;\r\n}\r\n\r\nexport const isAngularInTestMode = memoize(_isAngularInTestMode);\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable, ReplaySubject } from 'rxjs';\r\n\r\n@Injectable()\r\nexport class NgxsBootstrapper {\r\n /**\r\n * Use `ReplaySubject`, thus we can get cached value even if the stream is completed\r\n */\r\n private bootstrap$ = new ReplaySubject<boolean>(1);\r\n\r\n get appBootstrapped$(): Observable<boolean> {\r\n return this.bootstrap$.asObservable();\r\n }\r\n\r\n /**\r\n * This event will be emitted after attaching `ComponentRef` of the root component\r\n * to the tree of views, that's a signal that application has been fully rendered\r\n */\r\n bootstrap(): void {\r\n this.bootstrap$.next(true);\r\n this.bootstrap$.complete();\r\n }\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport { PlainObject } from './symbols';\r\n\r\nexport const INITIAL_STATE_TOKEN = new InjectionToken<any>('INITIAL_STATE_TOKEN');\r\n\r\nexport class InitialState {\r\n private static value: PlainObject = {};\r\n\r\n public static set(state: PlainObject) {\r\n this.value = state;\r\n }\r\n\r\n public static pop(): PlainObject {\r\n const state: PlainObject = this.value;\r\n this.value = {};\r\n return state;\r\n }\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally\r\n */\r\nexport const NGXS_STATE_CONTEXT_FACTORY: InjectionToken<any> = new InjectionToken(\r\n 'Internals.StateContextFactory'\r\n);\r\n\r\n/**\r\n * @see StateFactory as it's referenced by this token to be accessed by plugins internally\r\n */\r\nexport const NGXS_STATE_FACTORY: InjectionToken<any> = new InjectionToken(\r\n 'Internals.StateFactory'\r\n);\r\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA,SAAS,oBAAoB,CAAC,CAAM,EAAE,CAAM;IAC1C,OAAO,CAAC,KAAK,CAAC,CAAC;CAChB;;;;;;;AAED,SAAS,0BAA0B,CACjC,aAA0C,EAC1C,IAAuB,EACvB,IAAuB;IAEvB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;QACjE,OAAO,KAAK,CAAC;KACd;;;UAGK,MAAM,GAAG,IAAI,CAAC,MAAM;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;YACpC,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;CACb;;;;;;;;;;;AAQD,SAAgB,OAAO,CACrB,IAAO,EACP,aAAa,GAAG,oBAAoB;;QAEhC,QAAQ,GAAsB,IAAI;;QAClC,UAAU,GAAQ,IAA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AE,CAAC;KACvC;;;;;;IAMD,SAAS;QACP,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC5B;;;YAlBF,UAAU;;;;;;;;IAKT,sCAAmD;;;;;;;ACRrD;AAGA,MAAa,mBAAmB,GAAG,IAAI,cAAc,CAAM,qBAAqB,CAAC;AAEjF,MAAa,YAAY;;;;;IAGhB,OAAO,GAAG,CAAC,KAAkB;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACpB;;;;IAEM,OAAO,GAAG;;cACT,KAAK,GAAgB,IAAI,CAAC,KAAK;QACrC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;KACd;;AAVc,kBAAK,GAAgB,EAAE,CAAC;;;;;;IAAvC,mBAAuC;;;;;;;ACNzC;;;;AAKA,MAAa,0BAA0B,GAAwB,IAAI,cAAc,CAC/E,+BAA+B,CAChC;;;;;AAKD,MAAa,kBAAkB,GAAwB,IAAI,cAAc,CACvE,wBAAwB,CACzB;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ngxs-store-internals.js","sources":["ng://@ngxs/store/internals/angular.ts","ng://@ngxs/store/internals/ngxs-bootstrapper.ts","ng://@ngxs/store/internals/memoize.ts","ng://@ngxs/store/internals/initial-state.ts","ng://@ngxs/store/internals/internal-tokens.ts","ng://@ngxs/store/internals/decorator-injector-adapter.ts"],"sourcesContent":["declare const __karma__: unknown;\ndeclare const jasmine: unknown;\ndeclare const jest: unknown;\ndeclare const Mocha: unknown;\n\nexport function isAngularInTestMode(): boolean {\n // This is safe to check for these properties in the following way since `typeof` does not\n // throw an exception if the value does not exist in the scope.\n // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).\n // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into\n // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.\n // this will return undefined `global.jest`, but `jest` will not equal undefined.\n return (\n typeof __karma__ !== 'undefined' ||\n typeof jasmine !== 'undefined' ||\n typeof jest !== 'undefined' ||\n typeof Mocha !== 'undefined'\n );\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, ReplaySubject } from 'rxjs';\n\n@Injectable()\nexport class NgxsBootstrapper {\n /**\n * Use `ReplaySubject`, thus we can get cached value even if the stream is completed\n */\n private bootstrap$ = new ReplaySubject<boolean>(1);\n\n get appBootstrapped$(): Observable<boolean> {\n return this.bootstrap$.asObservable();\n }\n\n /**\n * This event will be emitted after attaching `ComponentRef` of the root component\n * to the tree of views, that's a signal that application has been fully rendered\n */\n bootstrap(): void {\n this.bootstrap$.next(true);\n this.bootstrap$.complete();\n }\n}\n","function defaultEqualityCheck(a: any, b: any) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(\n equalityCheck: (a: any, b: any) => boolean,\n prev: IArguments | null,\n next: IArguments | null\n) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n const length = prev.length;\n for (let i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Memoize a function on its last inputs only.\n * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js\n *\n * @ignore\n */\nexport function memoize<T extends (...args: any[]) => any>(\n func: T,\n equalityCheck = defaultEqualityCheck\n): T {\n let lastArgs: IArguments | null = null;\n let lastResult: any = null;\n // we reference arguments instead of spreading them for performance reasons\n function memoized() {\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n lastResult = (<Function>func).apply(null, arguments);\n }\n\n lastArgs = arguments;\n return lastResult;\n }\n (<any>memoized).reset = function() {\n // The hidden (for now) ability to reset the memoization\n lastArgs = null;\n lastResult = null;\n };\n return memoized as T;\n}\n","import { InjectionToken } from '@angular/core';\nimport { PlainObject } from './symbols';\n\nexport const INITIAL_STATE_TOKEN = new InjectionToken<any>('INITIAL_STATE_TOKEN');\n\nexport class InitialState {\n private static value: PlainObject = {};\n\n public static set(state: PlainObject) {\n this.value = state;\n }\n\n public static pop(): PlainObject {\n const state: PlainObject = this.value;\n this.value = {};\n return state;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_CONTEXT_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateContextFactory'\n);\n\n/**\n * @see StateFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateFactory'\n);\n","import {\n InjectionToken,\n Injector,\n INJECTOR,\n Type,\n ɵɵdirectiveInject,\n ɵglobal\n} from '@angular/core';\nimport { ReplaySubject } from 'rxjs';\n\n// Will be provided through Terser global definitions by Angular CLI\n// during the production build. This is how Angular does tree-shaking internally.\ndeclare const ngDevMode: boolean;\n\n// Angular doesn't export `NG_FACTORY_DEF`.\nconst NG_FACTORY_DEF = 'ɵfac';\n\n// A `Symbol` which is used to save the `Injector` onto the class instance.\nconst InjectorInstance: unique symbol = Symbol('InjectorInstance');\n\n// A `Symbol` which is used to determine if factory has been decorated previously or not.\nconst FactoryHasBeenDecorated: unique symbol = Symbol('FactoryHasBeenDecorated');\n\n// A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot\n// be retrieved within the `constructor` since it's set after the `factory()` is called.\nconst InjectorNotifier: unique symbol = Symbol('InjectorNotifier');\n\ninterface PrototypeWithInjectorNotifier extends Object {\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n\nexport function ensureInjectorNotifierIsCaptured(\n target: PrototypeWithInjectorNotifier | PrivateInstance\n): ReplaySubject<boolean> {\n if (target[InjectorNotifier]) {\n return target[InjectorNotifier]!;\n } else {\n const injectorNotifier$ = new ReplaySubject<boolean>(1);\n Object.defineProperty(target, InjectorNotifier, {\n get: () => injectorNotifier$\n });\n return injectorNotifier$;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function ensureLocalInjectorCaptured(target: Object): void {\n if (FactoryHasBeenDecorated in target.constructor.prototype) {\n return;\n }\n\n const constructor: ConstructorWithDefinitionAndFactory = target.constructor;\n // Means we're in AOT mode.\n if (typeof constructor[NG_FACTORY_DEF] === 'function') {\n decorateFactory(constructor);\n } else if (ngDevMode) {\n // We're running in JIT mode and that means we're not able to get the compiled definition\n // on the class inside the property decorator during the current message loop tick. We have\n // to wait for the next message loop tick. Note that this is safe since this Promise will be\n // resolved even before the `APP_INITIALIZER` is resolved.\n // The below code also will be executed only in development mode, since it's never recommended\n // to use the JIT compiler in production mode (by setting \"aot: false\").\n decorateFactoryLater(constructor);\n }\n\n target.constructor.prototype[FactoryHasBeenDecorated] = true;\n}\n\nexport function localInject<T>(\n instance: PrivateInstance,\n token: InjectionToken<T> | Type<T>\n): T | null {\n const injector: Injector | undefined = instance[InjectorInstance];\n return injector ? injector.get(token) : null;\n}\n\nfunction decorateFactory(constructor: ConstructorWithDefinitionAndFactory): void {\n const factory = constructor[NG_FACTORY_DEF];\n\n if (typeof factory !== 'function') {\n return;\n }\n\n // Let's try to get any definition.\n // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first\n // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).\n const def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;\n\n const decoratedFactory = () => {\n const instance = factory();\n // Caretaker note: `inject()` won't work here.\n // We can use the `directiveInject` only during the component\n // construction, since Angular captures the currently active injector.\n // We're not able to use this function inside the getter (when the `selectorId` property is\n // requested for the first time), since the currently active injector will be null.\n instance[InjectorInstance] = ɵɵdirectiveInject(\n // We're using `INJECTOR` token except of the `Injector` class since the compiler\n // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.\n // Caretaker note: that this is the same way of getting the injector.\n INJECTOR\n );\n\n // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.\n const injectorNotifier$ = instance[InjectorNotifier];\n if (injectorNotifier$) {\n injectorNotifier$.next(true);\n injectorNotifier$.complete();\n }\n\n return instance;\n };\n\n // If we've found any definition then it's enough to override the `def.factory` since Angular\n // code uses the `def.factory` and then fallbacks to `ɵfac`.\n if (def) {\n def.factory = decoratedFactory;\n }\n\n // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular\n // still uses the `ɵfac`.\n Object.defineProperty(constructor, NG_FACTORY_DEF, {\n get: () => decoratedFactory\n });\n}\n\nfunction decorateFactoryLater(constructor: ConstructorWithDefinitionAndFactory): void {\n // This function actually will be tree-shaken away when building for production since it's guarded with `ngDevMode`.\n // We're having the `try-catch` here because of the `SyncTestZoneSpec`, which throws\n // an error when micro or macrotask is used within a synchronous test. E.g. `Cannot call\n // Promise.then from within a sync test`.\n try {\n Promise.resolve().then(() => {\n decorateFactory(constructor);\n });\n } catch {\n // This is kind of a \"hack\", but we try to be backwards-compatible,\n // tho this `catch` block will only be executed when tests are run with Jasmine or Jest.\n ɵglobal.process &&\n ɵglobal.process.nextTick &&\n ɵglobal.process.nextTick(() => {\n decorateFactory(constructor);\n });\n }\n}\n\n// We could've used `ɵɵFactoryDef` but we try to be backwards-compatible,\n// since it's not exported in older Angular versions.\ntype Factory = () => PrivateInstance;\n\n// We could've used `ɵɵInjectableDef`, `ɵɵPipeDef`, etc. We try to be backwards-compatible\n// since they're not exported in older Angular versions.\ninterface Definition {\n factory: Factory | null;\n}\n\ninterface ConstructorWithDefinitionAndFactory extends Function {\n // Provider definition for the `@Injectable()` class.\n ɵprov?: Definition;\n // Pipe definition for the `@Pipe()` class.\n ɵpipe?: Definition;\n // Component definition for the `@Component()` class.\n ɵcmp?: Definition;\n // Directive definition for the `@Directive()` class.\n ɵdir?: Definition;\n [NG_FACTORY_DEF]?: Factory;\n}\n\ninterface PrivateInstance {\n [Injector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