@ngxs/store 3.7.3 → 3.7.4
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/bundles/ngxs-store-internals-testing.umd.js +114 -11
- package/bundles/ngxs-store-internals-testing.umd.js.map +1 -1
- package/bundles/ngxs-store-internals-testing.umd.min.js +1 -1
- package/bundles/ngxs-store-internals-testing.umd.min.js.map +1 -1
- package/bundles/ngxs-store-internals.umd.js +278 -91
- package/bundles/ngxs-store-internals.umd.js.map +1 -1
- package/bundles/ngxs-store-internals.umd.min.js +1 -1
- package/bundles/ngxs-store-internals.umd.min.js.map +1 -1
- package/bundles/ngxs-store.umd.js +457 -484
- package/bundles/ngxs-store.umd.js.map +1 -1
- package/bundles/ngxs-store.umd.min.js +1 -1
- package/bundles/ngxs-store.umd.min.js.map +1 -1
- package/esm2015/internals/angular.js +12 -32
- package/esm2015/internals/decorator-injector-adapter.js +204 -0
- package/esm2015/internals/index.js +2 -1
- package/esm2015/internals/ngxs-store-internals.js +2 -2
- package/esm2015/internals/testing/fresh-platform.js +46 -7
- package/esm2015/internals/testing/index.js +2 -1
- package/esm2015/internals/testing/ngxs-store-internals-testing.js +2 -2
- package/esm2015/internals/testing/skip-console-logging.js +62 -0
- package/esm2015/internals/testing/symbol.js +1 -1
- package/esm2015/ngxs-store.js +14 -18
- package/esm2015/src/configs/messages.config.js +74 -82
- package/esm2015/src/decorators/action.js +10 -6
- package/esm2015/src/decorators/select/select-factory.js +8 -5
- package/esm2015/src/decorators/select/select.js +39 -3
- package/esm2015/src/decorators/select/symbols.js +56 -12
- package/esm2015/src/decorators/selector/selector.js +10 -6
- package/esm2015/src/decorators/state.js +12 -4
- package/esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +25 -18
- package/esm2015/src/execution/noop-ngxs-execution-strategy.js +4 -2
- package/esm2015/src/execution/symbols.js +26 -3
- package/esm2015/src/internal/internals.js +8 -4
- package/esm2015/src/internal/state-factory.js +46 -26
- package/esm2015/src/internal/state-operations.js +47 -39
- package/esm2015/src/internal/state-operators.js +4 -4
- package/esm2015/src/internal/state-stream.js +10 -1
- package/esm2015/src/ivy/ivy-enabled-in-dev-mode.js +18 -30
- package/esm2015/src/module.js +7 -22
- package/esm2015/src/modules/ngxs-root.module.js +8 -8
- package/esm2015/src/store.js +20 -4
- package/esm2015/src/symbols.js +4 -5
- package/esm2015/src/utils/store-validators.js +24 -29
- package/esm5/internals/angular.js +12 -32
- package/esm5/internals/decorator-injector-adapter.js +204 -0
- package/esm5/internals/index.js +2 -1
- package/esm5/internals/ngxs-store-internals.js +2 -2
- package/esm5/internals/testing/fresh-platform.js +53 -13
- package/esm5/internals/testing/index.js +2 -1
- package/esm5/internals/testing/ngxs-store-internals-testing.js +2 -2
- package/esm5/internals/testing/skip-console-logging.js +62 -0
- package/esm5/internals/testing/symbol.js +1 -1
- package/esm5/ngxs-store.js +14 -18
- package/esm5/src/configs/messages.config.js +75 -100
- package/esm5/src/decorators/action.js +10 -6
- package/esm5/src/decorators/select/select-factory.js +8 -5
- package/esm5/src/decorators/select/select.js +40 -3
- package/esm5/src/decorators/select/symbols.js +56 -12
- package/esm5/src/decorators/selector/selector.js +10 -6
- package/esm5/src/decorators/state.js +12 -4
- package/esm5/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +25 -23
- package/esm5/src/execution/noop-ngxs-execution-strategy.js +4 -2
- package/esm5/src/execution/symbols.js +26 -3
- package/esm5/src/internal/internals.js +8 -4
- package/esm5/src/internal/state-factory.js +39 -27
- package/esm5/src/internal/state-operations.js +47 -43
- package/esm5/src/internal/state-operators.js +4 -4
- package/esm5/src/internal/state-stream.js +13 -1
- package/esm5/src/ivy/ivy-enabled-in-dev-mode.js +18 -30
- package/esm5/src/module.js +7 -22
- package/esm5/src/modules/ngxs-root.module.js +7 -7
- package/esm5/src/store.js +20 -4
- package/esm5/src/symbols.js +4 -5
- package/esm5/src/utils/store-validators.js +28 -36
- package/fesm2015/ngxs-store-internals-testing.js +108 -7
- package/fesm2015/ngxs-store-internals-testing.js.map +1 -1
- package/fesm2015/ngxs-store-internals.js +263 -79
- package/fesm2015/ngxs-store-internals.js.map +1 -1
- package/fesm2015/ngxs-store.js +429 -413
- package/fesm2015/ngxs-store.js.map +1 -1
- package/fesm5/ngxs-store-internals-testing.js +115 -13
- package/fesm5/ngxs-store-internals-testing.js.map +1 -1
- package/fesm5/ngxs-store-internals.js +277 -93
- package/fesm5/ngxs-store-internals.js.map +1 -1
- package/fesm5/ngxs-store.js +443 -465
- package/fesm5/ngxs-store.js.map +1 -1
- package/internals/angular.d.ts +1 -3
- package/internals/decorator-injector-adapter.d.ts +15 -0
- package/internals/index.d.ts +1 -0
- package/internals/ngxs-store-internals.metadata.json +1 -1
- package/internals/testing/fresh-platform.d.ts +1 -1
- package/internals/testing/index.d.ts +1 -0
- package/internals/testing/ngxs-store-internals-testing.metadata.json +1 -1
- package/internals/testing/skip-console-logging.d.ts +1 -0
- package/internals/testing/symbol.d.ts +1 -1
- package/ngxs-store.d.ts +14 -18
- package/ngxs-store.metadata.json +1 -1
- package/package.json +2 -2
- package/src/configs/messages.config.d.ts +11 -30
- package/src/decorators/select/select-factory.d.ts +2 -3
- package/src/decorators/select/symbols.d.ts +6 -2
- package/src/execution/dispatch-outside-zone-ngxs-execution-strategy.d.ts +0 -1
- package/src/execution/symbols.d.ts +5 -1
- package/src/internal/internals.d.ts +0 -1
- package/src/internal/state-factory.d.ts +2 -3
- package/src/internal/state-operations.d.ts +1 -3
- package/src/internal/state-stream.d.ts +3 -1
- package/src/ivy/ivy-enabled-in-dev-mode.d.ts +4 -12
- package/src/modules/ngxs-root.module.d.ts +2 -2
- package/src/store.d.ts +6 -0
- package/src/symbols.d.ts +4 -3
- package/src/utils/store-validators.d.ts +5 -6
- package/esm2015/src/host-environment/host-environment.js +0 -31
- package/esm2015/src/internal/config-validator.js +0 -67
- package/esm2015/src/ivy/ensure-state-class-is-injectable.js +0 -34
- package/esm5/src/host-environment/host-environment.js +0 -29
- package/esm5/src/internal/config-validator.js +0 -76
- package/esm5/src/ivy/ensure-state-class-is-injectable.js +0 -34
- package/src/host-environment/host-environment.d.ts +0 -6
- package/src/internal/config-validator.d.ts +0 -10
- package/src/ivy/ensure-state-class-is-injectable.d.ts +0 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __spread, __awaiter, __generator } from 'tslib';
|
|
2
|
-
import { Component, NgModule, ApplicationRef, destroyPlatform, createPlatform } from '@angular/core';
|
|
2
|
+
import { Component, NgModule, ApplicationRef, destroyPlatform, VERSION, createPlatform } from '@angular/core';
|
|
3
3
|
import { TestBed } from '@angular/core/testing';
|
|
4
4
|
import { DOCUMENT } from '@angular/common';
|
|
5
5
|
import { BrowserModule, ɵBrowserDomAdapter, ɵgetDOM } from '@angular/platform-browser';
|
|
@@ -194,41 +194,143 @@ function destroyPlatformBeforeBootstrappingTheNewOne() {
|
|
|
194
194
|
function resetPlatformAfterBootstrapping() {
|
|
195
195
|
removeRootElement();
|
|
196
196
|
destroyPlatform();
|
|
197
|
-
|
|
197
|
+
/** @type {?} */
|
|
198
|
+
var version = +VERSION.major;
|
|
199
|
+
// https://github.com/angular/angular/commit/e250db4f261741b04ee4cbad4dec41a8908a12aa
|
|
200
|
+
if (version < 14) {
|
|
201
|
+
createPlatform(TestBed);
|
|
202
|
+
}
|
|
198
203
|
}
|
|
199
204
|
/**
|
|
200
205
|
* @param {?} fn
|
|
201
206
|
* @return {?}
|
|
202
207
|
*/
|
|
203
208
|
function freshPlatform(fn) {
|
|
209
|
+
/** @type {?} */
|
|
210
|
+
var resolve = null;
|
|
211
|
+
/** @type {?} */
|
|
212
|
+
var reject = null;
|
|
213
|
+
/** @type {?} */
|
|
214
|
+
var whenDoneIsCalledPromise = null;
|
|
215
|
+
/** @type {?} */
|
|
216
|
+
var hasDoneArgument = fn.length === 1;
|
|
217
|
+
if (hasDoneArgument) {
|
|
218
|
+
whenDoneIsCalledPromise = new Promise((/**
|
|
219
|
+
* @param {?} _resolve
|
|
220
|
+
* @param {?} _reject
|
|
221
|
+
* @return {?}
|
|
222
|
+
*/
|
|
223
|
+
function (_resolve, _reject) {
|
|
224
|
+
resolve = _resolve;
|
|
225
|
+
reject = _reject;
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
204
228
|
return (/**
|
|
205
|
-
* @this {?}
|
|
206
|
-
* @param {...?} args
|
|
207
229
|
* @return {?}
|
|
208
230
|
*/
|
|
209
231
|
function testWithAFreshPlatform() {
|
|
210
|
-
var args = [];
|
|
211
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
212
|
-
args[_i] = arguments[_i];
|
|
213
|
-
}
|
|
214
232
|
return __awaiter(this, void 0, void 0, function () {
|
|
215
233
|
return __generator(this, function (_a) {
|
|
216
234
|
switch (_a.label) {
|
|
217
235
|
case 0:
|
|
218
|
-
_a.trys.push([0, ,
|
|
236
|
+
_a.trys.push([0, , 6, 7]);
|
|
219
237
|
destroyPlatformBeforeBootstrappingTheNewOne();
|
|
220
|
-
return [
|
|
221
|
-
|
|
238
|
+
if (!hasDoneArgument) return [3 /*break*/, 3];
|
|
239
|
+
return [4 /*yield*/, fn((/**
|
|
240
|
+
* @param {?=} error
|
|
241
|
+
* @return {?}
|
|
242
|
+
*/
|
|
243
|
+
function (error) {
|
|
244
|
+
if (error) {
|
|
245
|
+
(/** @type {?} */ (reject))(error);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
(/** @type {?} */ (resolve))();
|
|
249
|
+
}
|
|
250
|
+
}))];
|
|
251
|
+
case 1:
|
|
252
|
+
_a.sent();
|
|
253
|
+
return [4 /*yield*/, (/** @type {?} */ (whenDoneIsCalledPromise))];
|
|
222
254
|
case 2:
|
|
255
|
+
_a.sent();
|
|
256
|
+
return [3 /*break*/, 5];
|
|
257
|
+
case 3: return [4 /*yield*/, fn()];
|
|
258
|
+
case 4:
|
|
259
|
+
_a.sent();
|
|
260
|
+
_a.label = 5;
|
|
261
|
+
case 5: return [3 /*break*/, 7];
|
|
262
|
+
case 6:
|
|
223
263
|
resetPlatformAfterBootstrapping();
|
|
224
264
|
return [7 /*endfinally*/];
|
|
225
|
-
case
|
|
265
|
+
case 7: return [2 /*return*/];
|
|
226
266
|
}
|
|
227
267
|
});
|
|
228
268
|
});
|
|
229
269
|
});
|
|
230
270
|
}
|
|
231
271
|
|
|
272
|
+
/**
|
|
273
|
+
* @fileoverview added by tsickle
|
|
274
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
275
|
+
*/
|
|
276
|
+
/// <reference types="jest" />
|
|
277
|
+
/// <reference types="jest" />
|
|
278
|
+
/**
|
|
279
|
+
* @template T
|
|
280
|
+
* @param {?} fn
|
|
281
|
+
* @return {?}
|
|
282
|
+
*/
|
|
283
|
+
function skipConsoleLogging(fn) {
|
|
284
|
+
/** @type {?} */
|
|
285
|
+
var consoleSpies = [
|
|
286
|
+
jest.spyOn(console, 'log').mockImplementation((/**
|
|
287
|
+
* @return {?}
|
|
288
|
+
*/
|
|
289
|
+
function () { })),
|
|
290
|
+
jest.spyOn(console, 'warn').mockImplementation((/**
|
|
291
|
+
* @return {?}
|
|
292
|
+
*/
|
|
293
|
+
function () { })),
|
|
294
|
+
jest.spyOn(console, 'error').mockImplementation((/**
|
|
295
|
+
* @return {?}
|
|
296
|
+
*/
|
|
297
|
+
function () { })),
|
|
298
|
+
jest.spyOn(console, 'info').mockImplementation((/**
|
|
299
|
+
* @return {?}
|
|
300
|
+
*/
|
|
301
|
+
function () { }))
|
|
302
|
+
];
|
|
303
|
+
/**
|
|
304
|
+
* @return {?}
|
|
305
|
+
*/
|
|
306
|
+
function restoreSpies() {
|
|
307
|
+
consoleSpies.forEach((/**
|
|
308
|
+
* @param {?} spy
|
|
309
|
+
* @return {?}
|
|
310
|
+
*/
|
|
311
|
+
function (spy) { return spy.mockRestore(); }));
|
|
312
|
+
}
|
|
313
|
+
/** @type {?} */
|
|
314
|
+
var restoreSpyAsync = false;
|
|
315
|
+
try {
|
|
316
|
+
/** @type {?} */
|
|
317
|
+
var returnValue = fn();
|
|
318
|
+
if (returnValue instanceof Promise) {
|
|
319
|
+
restoreSpyAsync = true;
|
|
320
|
+
return (/** @type {?} */ (returnValue.finally((/**
|
|
321
|
+
* @return {?}
|
|
322
|
+
*/
|
|
323
|
+
function () { return restoreSpies(); }))));
|
|
324
|
+
}
|
|
325
|
+
return returnValue;
|
|
326
|
+
}
|
|
327
|
+
finally {
|
|
328
|
+
if (!restoreSpyAsync) {
|
|
329
|
+
restoreSpies();
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
232
334
|
/**
|
|
233
335
|
* @fileoverview added by tsickle
|
|
234
336
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -239,5 +341,5 @@ function freshPlatform(fn) {
|
|
|
239
341
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
240
342
|
*/
|
|
241
343
|
|
|
242
|
-
export { NgxsTestBed, freshPlatform };
|
|
344
|
+
export { NgxsTestBed, freshPlatform, skipConsoleLogging };
|
|
243
345
|
//# sourceMappingURL=ngxs-store-internals-testing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-store-internals-testing.js","sources":["ng://@ngxs/store/internals/testing/helpers/ngxs-test.component.ts","ng://@ngxs/store/internals/testing/helpers/ngxs-test.module.ts","ng://@ngxs/store/internals/testing/ngxs.setup.ts","ng://@ngxs/store/internals/testing/fresh-platform.ts"],"sourcesContent":["import { AfterViewInit, Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-root',\r\n template: ''\r\n})\r\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\r\n public ngOnInit(): void {}\r\n public ngAfterViewInit(): void {}\r\n}\r\n","import { ApplicationRef, NgModule } from '@angular/core';\r\nimport { BrowserModule } from '@angular/platform-browser';\r\n\r\nimport { NgxsTestComponent } from './ngxs-test.component';\r\n\r\n@NgModule({\r\n imports: [BrowserModule],\r\n declarations: [NgxsTestComponent],\r\n entryComponents: [NgxsTestComponent]\r\n})\r\nexport class NgxsTestModule {\r\n public static ngDoBootstrap(app: ApplicationRef): void {\r\n app.bootstrap(NgxsTestComponent);\r\n }\r\n}\r\n","import { ApplicationRef } from '@angular/core';\r\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\r\nimport {\r\n BrowserDynamicTestingModule,\r\n platformBrowserDynamicTesting\r\n} from '@angular/platform-browser-dynamic/testing';\r\nimport { NgxsModule, Store } from '@ngxs/store';\r\n\r\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\r\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\r\n\r\nexport class NgxsTestBed {\r\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\r\n this.resetTestBed();\r\n\r\n if (options.before) {\r\n options.before();\r\n }\r\n\r\n TestBed.configureTestingModule({\r\n imports: [\r\n NgxsTestModule,\r\n NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),\r\n ...(options.imports || [])\r\n ]\r\n }).compileComponents();\r\n\r\n NgxsTestBed.ngxsBootstrap();\r\n\r\n return {\r\n get store(): Store {\r\n return TestBed.inject(Store);\r\n },\r\n get getTestBed(): TestBedStatic {\r\n return TestBed;\r\n }\r\n };\r\n }\r\n\r\n private static ngxsBootstrap(): void {\r\n NgxsTestBed.createRootNode();\r\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\r\n }\r\n\r\n private static resetTestBed(): void {\r\n TestBed.resetTestEnvironment();\r\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\r\n }\r\n\r\n private static createRootNode(selector = 'app-root'): void {\r\n const document = TestBed.inject(DOCUMENT);\r\n const adapter = new BrowserDomAdapter();\r\n const root = adapter.createElement(selector);\r\n document.body.appendChild(root);\r\n }\r\n}\r\n","import { TestBed } from '@angular/core/testing';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\r\nimport { destroyPlatform, createPlatform } from '@angular/core';\r\n\r\nfunction createRootElement() {\r\n const document = TestBed.inject(DOCUMENT);\r\n const root = getDOM().createElement('app-root', document);\r\n document.body.appendChild(root);\r\n}\r\n\r\nfunction removeRootElement() {\r\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\r\n try {\r\n document.body.removeChild(root);\r\n } catch {}\r\n}\r\n\r\nfunction destroyPlatformBeforeBootstrappingTheNewOne() {\r\n destroyPlatform();\r\n createRootElement();\r\n}\r\n\r\n// As we create our custom platform via `bootstrapModule`\r\n// we have to destroy it after assetions and revert\r\n// the previous one\r\nfunction resetPlatformAfterBootstrapping() {\r\n removeRootElement();\r\n destroyPlatform();\r\n createPlatform(TestBed);\r\n}\r\n\r\nexport function freshPlatform(fn:
|
|
1
|
+
{"version":3,"file":"ngxs-store-internals-testing.js","sources":["ng://@ngxs/store/internals/testing/helpers/ngxs-test.component.ts","ng://@ngxs/store/internals/testing/helpers/ngxs-test.module.ts","ng://@ngxs/store/internals/testing/ngxs.setup.ts","ng://@ngxs/store/internals/testing/fresh-platform.ts","ng://@ngxs/store/internals/testing/skip-console-logging.ts"],"sourcesContent":["import { AfterViewInit, Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-root',\r\n template: ''\r\n})\r\nexport class NgxsTestComponent implements OnInit, AfterViewInit {\r\n public ngOnInit(): void {}\r\n public ngAfterViewInit(): void {}\r\n}\r\n","import { ApplicationRef, NgModule } from '@angular/core';\r\nimport { BrowserModule } from '@angular/platform-browser';\r\n\r\nimport { NgxsTestComponent } from './ngxs-test.component';\r\n\r\n@NgModule({\r\n imports: [BrowserModule],\r\n declarations: [NgxsTestComponent],\r\n entryComponents: [NgxsTestComponent]\r\n})\r\nexport class NgxsTestModule {\r\n public static ngDoBootstrap(app: ApplicationRef): void {\r\n app.bootstrap(NgxsTestComponent);\r\n }\r\n}\r\n","import { ApplicationRef } from '@angular/core';\r\nimport { TestBed, TestBedStatic } from '@angular/core/testing';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { ɵBrowserDomAdapter as BrowserDomAdapter } from '@angular/platform-browser';\r\nimport {\r\n BrowserDynamicTestingModule,\r\n platformBrowserDynamicTesting\r\n} from '@angular/platform-browser-dynamic/testing';\r\nimport { NgxsModule, Store } from '@ngxs/store';\r\n\r\nimport { NgxsTestModule } from './helpers/ngxs-test.module';\r\nimport { NgxsOptionsTesting, NgxsTesting } from './symbol';\r\n\r\nexport class NgxsTestBed {\r\n public static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting {\r\n this.resetTestBed();\r\n\r\n if (options.before) {\r\n options.before();\r\n }\r\n\r\n TestBed.configureTestingModule({\r\n imports: [\r\n NgxsTestModule,\r\n NgxsModule.forRoot(options.states || [], options.ngxsOptions || {}),\r\n ...(options.imports || [])\r\n ]\r\n }).compileComponents();\r\n\r\n NgxsTestBed.ngxsBootstrap();\r\n\r\n return {\r\n get store(): Store {\r\n return TestBed.inject(Store);\r\n },\r\n get getTestBed(): TestBedStatic {\r\n return TestBed;\r\n }\r\n };\r\n }\r\n\r\n private static ngxsBootstrap(): void {\r\n NgxsTestBed.createRootNode();\r\n NgxsTestModule.ngDoBootstrap(TestBed.inject(ApplicationRef));\r\n }\r\n\r\n private static resetTestBed(): void {\r\n TestBed.resetTestEnvironment();\r\n TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());\r\n }\r\n\r\n private static createRootNode(selector = 'app-root'): void {\r\n const document = TestBed.inject(DOCUMENT);\r\n const adapter = new BrowserDomAdapter();\r\n const root = adapter.createElement(selector);\r\n document.body.appendChild(root);\r\n }\r\n}\r\n","import { TestBed } from '@angular/core/testing';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\r\nimport { VERSION, destroyPlatform, createPlatform } from '@angular/core';\r\n\r\nfunction createRootElement() {\r\n const document = TestBed.inject(DOCUMENT);\r\n const root = getDOM().createElement('app-root', document);\r\n document.body.appendChild(root);\r\n}\r\n\r\nfunction removeRootElement() {\r\n const root: Element = document.getElementsByTagName('app-root').item(0)!;\r\n try {\r\n document.body.removeChild(root);\r\n } catch {}\r\n}\r\n\r\nfunction destroyPlatformBeforeBootstrappingTheNewOne() {\r\n destroyPlatform();\r\n createRootElement();\r\n}\r\n\r\n// As we create our custom platform via `bootstrapModule`\r\n// we have to destroy it after assetions and revert\r\n// the previous one\r\nfunction resetPlatformAfterBootstrapping() {\r\n removeRootElement();\r\n destroyPlatform();\r\n const version = +VERSION.major;\r\n // https://github.com/angular/angular/commit/e250db4f261741b04ee4cbad4dec41a8908a12aa\r\n if (version < 14) {\r\n createPlatform(TestBed);\r\n }\r\n}\r\n\r\nexport function freshPlatform(fn: (done?: VoidFunction) => Promise<void>) {\r\n let resolve: VoidFunction | null = null;\r\n let reject: ((error: Error) => void) | null = null;\r\n let whenDoneIsCalledPromise: Promise<void> | null = null;\r\n\r\n const hasDoneArgument = fn.length === 1;\r\n\r\n if (hasDoneArgument) {\r\n whenDoneIsCalledPromise = new Promise<void>((_resolve, _reject) => {\r\n resolve = _resolve;\r\n reject = _reject;\r\n });\r\n }\r\n\r\n return async function testWithAFreshPlatform() {\r\n try {\r\n destroyPlatformBeforeBootstrappingTheNewOne();\r\n\r\n if (hasDoneArgument) {\r\n await fn((error?: Error) => {\r\n if (error) {\r\n reject!(error);\r\n } else {\r\n resolve!();\r\n }\r\n });\r\n await whenDoneIsCalledPromise!;\r\n } else {\r\n await fn();\r\n }\r\n } finally {\r\n resetPlatformAfterBootstrapping();\r\n }\r\n };\r\n}\r\n","/// <reference types=\"jest\" />\r\n\r\nexport function skipConsoleLogging<T extends (...args: any[]) => any>(fn: T): ReturnType<T> {\r\n const consoleSpies = [\r\n jest.spyOn(console, 'log').mockImplementation(() => {}),\r\n jest.spyOn(console, 'warn').mockImplementation(() => {}),\r\n jest.spyOn(console, 'error').mockImplementation(() => {}),\r\n jest.spyOn(console, 'info').mockImplementation(() => {})\r\n ];\r\n function restoreSpies() {\r\n consoleSpies.forEach(spy => spy.mockRestore());\r\n }\r\n let restoreSpyAsync = false;\r\n try {\r\n const returnValue = fn();\r\n if (returnValue instanceof Promise) {\r\n restoreSpyAsync = true;\r\n return returnValue.finally(() => restoreSpies()) as ReturnType<T>;\r\n }\r\n return returnValue;\r\n } finally {\r\n if (!restoreSpyAsync) {\r\n restoreSpies();\r\n }\r\n }\r\n}\r\n"],"names":["BrowserDomAdapter","getDOM"],"mappings":";;;;;;;;;;;;AAAA,AAEA;IAAA;KAOC;;;;IAFQ,oCAAQ;;;IAAf,eAA0B;;;;IACnB,2CAAe;;;IAAtB,eAAiC;;gBANlC,SAAS,SAAC;oBACT,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE,EAAE;iBACb;;IAID,wBAAC;CAPD,IAOC;;;;;;ACTD,AAKA;IAAA;KASC;;;;;IAHe,4BAAa;;;;IAA3B,UAA4B,GAAmB;QAC7C,GAAG,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;KAClC;;gBARF,QAAQ,SAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,eAAe,EAAE,CAAC,iBAAiB,CAAC;iBACrC;;IAKD,qBAAC;CATD,IASC;;;;;;;ICDD;KA4CC;;;;;IA3Ce,kCAAsB;;;;IAApC,UAAqC,OAA2B;QAC9D,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,OAAO,CAAC,MAAM,EAAE,CAAC;SAClB;QAED,OAAO,CAAC,sBAAsB,CAAC;YAC7B,OAAO;g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AE,EAAA;;wBAAV,SAAU,CAAC;;;;wBAGb,+BAA+B,EAAE,CAAC;;;;;;KAErC,EAAC;CACH;;;;;;;;;;;;;ACpED,SAAgB,kBAAkB,CAAoC,EAAK;;QACnE,YAAY,GAAG;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,kBAAkB;;;QAAC,eAAQ,EAAC;QACvD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,kBAAkB;;;QAAC,eAAQ,EAAC;QACxD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,kBAAkB;;;QAAC,eAAQ,EAAC;QACzD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,kBAAkB;;;QAAC,eAAQ,EAAC;KACzD;;;;IACD,SAAS,YAAY;QACnB,YAAY,CAAC,OAAO;;;;QAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,WAAW,EAAE,GAAA,EAAC,CAAC;KAChD;;QACG,eAAe,GAAG,KAAK;IAC3B,IAAI;;YACI,WAAW,GAAG,EAAE,EAAE;QACxB,IAAI,WAAW,YAAY,OAAO,EAAE;YAClC,eAAe,GAAG,IAAI,CAAC;YACvB,0BAAO,WAAW,CAAC,OAAO;;;YAAC,cAAM,OAAA,YAAY,EAAE,GAAA,EAAC,GAAkB;SACnE;QACD,OAAO,WAAW,CAAC;KACpB;YAAS;QACR,IAAI,CAAC,eAAe,EAAE;YACpB,YAAY,EAAE,CAAC;SAChB;KACF;CACF;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,79 @@
|
|
|
1
|
-
import {
|
|
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
|
+
* @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');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @fileoverview added by tsickle
|
|
26
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
27
|
+
*/
|
|
28
|
+
var NgxsBootstrapper = /** @class */ (function () {
|
|
29
|
+
function NgxsBootstrapper() {
|
|
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
|
+
Object.defineProperty(NgxsBootstrapper.prototype, "appBootstrapped$", {
|
|
36
|
+
get: /**
|
|
37
|
+
* @return {?}
|
|
38
|
+
*/
|
|
39
|
+
function () {
|
|
40
|
+
return this.bootstrap$.asObservable();
|
|
41
|
+
},
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
47
|
+
* to the tree of views, that's a signal that application has been fully rendered
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
51
|
+
* to the tree of views, that's a signal that application has been fully rendered
|
|
52
|
+
* @return {?}
|
|
53
|
+
*/
|
|
54
|
+
NgxsBootstrapper.prototype.bootstrap = /**
|
|
55
|
+
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
56
|
+
* to the tree of views, that's a signal that application has been fully rendered
|
|
57
|
+
* @return {?}
|
|
58
|
+
*/
|
|
59
|
+
function () {
|
|
60
|
+
this.bootstrap$.next(true);
|
|
61
|
+
this.bootstrap$.complete();
|
|
62
|
+
};
|
|
63
|
+
NgxsBootstrapper.decorators = [
|
|
64
|
+
{ type: Injectable }
|
|
65
|
+
];
|
|
66
|
+
return NgxsBootstrapper;
|
|
67
|
+
}());
|
|
68
|
+
if (false) {
|
|
69
|
+
/**
|
|
70
|
+
* Use `ReplaySubject`, thus we can get cached value even if the stream is completed
|
|
71
|
+
* @type {?}
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
NgxsBootstrapper.prototype.bootstrap$;
|
|
75
|
+
}
|
|
76
|
+
|
|
4
77
|
/**
|
|
5
78
|
* @fileoverview added by tsickle
|
|
6
79
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -72,97 +145,6 @@ function memoize(func, equalityCheck) {
|
|
|
72
145
|
return (/** @type {?} */ (memoized));
|
|
73
146
|
}
|
|
74
147
|
|
|
75
|
-
/**
|
|
76
|
-
* @fileoverview added by tsickle
|
|
77
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
78
|
-
*/
|
|
79
|
-
/**
|
|
80
|
-
* @return {?}
|
|
81
|
-
*/
|
|
82
|
-
function _isAngularInTestMode() {
|
|
83
|
-
/** @type {?} */
|
|
84
|
-
var platformRef = getPlatform();
|
|
85
|
-
if (!platformRef)
|
|
86
|
-
return false;
|
|
87
|
-
/** @type {?} */
|
|
88
|
-
var compilerOptions = platformRef.injector.get(COMPILER_OPTIONS, null);
|
|
89
|
-
if (!compilerOptions)
|
|
90
|
-
return false;
|
|
91
|
-
/** @type {?} */
|
|
92
|
-
var isInTestMode = compilerOptions.some((/**
|
|
93
|
-
* @param {?} item
|
|
94
|
-
* @return {?}
|
|
95
|
-
*/
|
|
96
|
-
function (item) {
|
|
97
|
-
/** @type {?} */
|
|
98
|
-
var providers = (item && item.providers) || [];
|
|
99
|
-
return providers.some((/**
|
|
100
|
-
* @param {?} provider
|
|
101
|
-
* @return {?}
|
|
102
|
-
*/
|
|
103
|
-
function (provider) {
|
|
104
|
-
return ((provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||
|
|
105
|
-
false);
|
|
106
|
-
}));
|
|
107
|
-
}));
|
|
108
|
-
return isInTestMode;
|
|
109
|
-
}
|
|
110
|
-
/** @type {?} */
|
|
111
|
-
var isAngularInTestMode = memoize(_isAngularInTestMode);
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* @fileoverview added by tsickle
|
|
115
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
116
|
-
*/
|
|
117
|
-
var NgxsBootstrapper = /** @class */ (function () {
|
|
118
|
-
function NgxsBootstrapper() {
|
|
119
|
-
/**
|
|
120
|
-
* Use `ReplaySubject`, thus we can get cached value even if the stream is completed
|
|
121
|
-
*/
|
|
122
|
-
this.bootstrap$ = new ReplaySubject(1);
|
|
123
|
-
}
|
|
124
|
-
Object.defineProperty(NgxsBootstrapper.prototype, "appBootstrapped$", {
|
|
125
|
-
get: /**
|
|
126
|
-
* @return {?}
|
|
127
|
-
*/
|
|
128
|
-
function () {
|
|
129
|
-
return this.bootstrap$.asObservable();
|
|
130
|
-
},
|
|
131
|
-
enumerable: true,
|
|
132
|
-
configurable: true
|
|
133
|
-
});
|
|
134
|
-
/**
|
|
135
|
-
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
136
|
-
* to the tree of views, that's a signal that application has been fully rendered
|
|
137
|
-
*/
|
|
138
|
-
/**
|
|
139
|
-
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
140
|
-
* to the tree of views, that's a signal that application has been fully rendered
|
|
141
|
-
* @return {?}
|
|
142
|
-
*/
|
|
143
|
-
NgxsBootstrapper.prototype.bootstrap = /**
|
|
144
|
-
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
145
|
-
* to the tree of views, that's a signal that application has been fully rendered
|
|
146
|
-
* @return {?}
|
|
147
|
-
*/
|
|
148
|
-
function () {
|
|
149
|
-
this.bootstrap$.next(true);
|
|
150
|
-
this.bootstrap$.complete();
|
|
151
|
-
};
|
|
152
|
-
NgxsBootstrapper.decorators = [
|
|
153
|
-
{ type: Injectable }
|
|
154
|
-
];
|
|
155
|
-
return NgxsBootstrapper;
|
|
156
|
-
}());
|
|
157
|
-
if (false) {
|
|
158
|
-
/**
|
|
159
|
-
* Use `ReplaySubject`, thus we can get cached value even if the stream is completed
|
|
160
|
-
* @type {?}
|
|
161
|
-
* @private
|
|
162
|
-
*/
|
|
163
|
-
NgxsBootstrapper.prototype.bootstrap$;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
148
|
/**
|
|
167
149
|
* @fileoverview added by tsickle
|
|
168
150
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -221,6 +203,208 @@ var NGXS_STATE_CONTEXT_FACTORY = new InjectionToken('Internals.StateContextFacto
|
|
|
221
203
|
*/
|
|
222
204
|
var NGXS_STATE_FACTORY = new InjectionToken('Internals.StateFactory');
|
|
223
205
|
|
|
206
|
+
/**
|
|
207
|
+
* @fileoverview added by tsickle
|
|
208
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
209
|
+
*/
|
|
210
|
+
// Angular doesn't export `NG_FACTORY_DEF`.
|
|
211
|
+
/** @type {?} */
|
|
212
|
+
var NG_FACTORY_DEF = 'ɵfac';
|
|
213
|
+
// A `Symbol` which is used to save the `Injector` onto the class instance.
|
|
214
|
+
/** @type {?} */
|
|
215
|
+
var InjectorInstance = Symbol('InjectorInstance');
|
|
216
|
+
// A `Symbol` which is used to determine if factory has been decorated previously or not.
|
|
217
|
+
/** @type {?} */
|
|
218
|
+
var FactoryHasBeenDecorated = Symbol('FactoryHasBeenDecorated');
|
|
219
|
+
// A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot
|
|
220
|
+
// be retrieved within the `constructor` since it's set after the `factory()` is called.
|
|
221
|
+
/** @type {?} */
|
|
222
|
+
var InjectorNotifier = Symbol('InjectorNotifier');
|
|
223
|
+
/**
|
|
224
|
+
* @record
|
|
225
|
+
*/
|
|
226
|
+
function PrototypeWithInjectorNotifier() { }
|
|
227
|
+
if (false) {
|
|
228
|
+
/* Skipping unnamed member:
|
|
229
|
+
[InjectorNotifier]?: ReplaySubject<boolean>;*/
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* @param {?} target
|
|
233
|
+
* @return {?}
|
|
234
|
+
*/
|
|
235
|
+
function ensureInjectorNotifierIsCaptured(target) {
|
|
236
|
+
if (target[InjectorNotifier]) {
|
|
237
|
+
return (/** @type {?} */ (target[InjectorNotifier]));
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
/** @type {?} */
|
|
241
|
+
var injectorNotifier$_1 = new ReplaySubject(1);
|
|
242
|
+
Object.defineProperty(target, InjectorNotifier, {
|
|
243
|
+
get: (/**
|
|
244
|
+
* @return {?}
|
|
245
|
+
*/
|
|
246
|
+
function () { return injectorNotifier$_1; })
|
|
247
|
+
});
|
|
248
|
+
return injectorNotifier$_1;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
252
|
+
/**
|
|
253
|
+
* @param {?} target
|
|
254
|
+
* @return {?}
|
|
255
|
+
*/
|
|
256
|
+
function ensureLocalInjectorCaptured(target) {
|
|
257
|
+
if (FactoryHasBeenDecorated in target.constructor.prototype) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
/** @type {?} */
|
|
261
|
+
var constructor = target.constructor;
|
|
262
|
+
// Means we're in AOT mode.
|
|
263
|
+
if (typeof constructor[NG_FACTORY_DEF] === 'function') {
|
|
264
|
+
decorateFactory(constructor);
|
|
265
|
+
}
|
|
266
|
+
else if (ngDevMode) {
|
|
267
|
+
// We're running in JIT mode and that means we're not able to get the compiled definition
|
|
268
|
+
// on the class inside the property decorator during the current message loop tick. We have
|
|
269
|
+
// to wait for the next message loop tick. Note that this is safe since this Promise will be
|
|
270
|
+
// resolved even before the `APP_INITIALIZER` is resolved.
|
|
271
|
+
// The below code also will be executed only in development mode, since it's never recommended
|
|
272
|
+
// to use the JIT compiler in production mode (by setting "aot: false").
|
|
273
|
+
decorateFactoryLater(constructor);
|
|
274
|
+
}
|
|
275
|
+
target.constructor.prototype[FactoryHasBeenDecorated] = true;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* @template T
|
|
279
|
+
* @param {?} instance
|
|
280
|
+
* @param {?} token
|
|
281
|
+
* @return {?}
|
|
282
|
+
*/
|
|
283
|
+
function localInject(instance, token) {
|
|
284
|
+
/** @type {?} */
|
|
285
|
+
var injector = instance[InjectorInstance];
|
|
286
|
+
return injector ? injector.get(token) : null;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* @param {?} constructor
|
|
290
|
+
* @return {?}
|
|
291
|
+
*/
|
|
292
|
+
function decorateFactory(constructor) {
|
|
293
|
+
/** @type {?} */
|
|
294
|
+
var factory = constructor[NG_FACTORY_DEF];
|
|
295
|
+
if (typeof factory !== 'function') {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
// Let's try to get any definition.
|
|
299
|
+
// Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first
|
|
300
|
+
// Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).
|
|
301
|
+
/** @type {?} */
|
|
302
|
+
var def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;
|
|
303
|
+
/** @type {?} */
|
|
304
|
+
var decoratedFactory = (/**
|
|
305
|
+
* @return {?}
|
|
306
|
+
*/
|
|
307
|
+
function () {
|
|
308
|
+
/** @type {?} */
|
|
309
|
+
var instance = factory();
|
|
310
|
+
// Caretaker note: `inject()` won't work here.
|
|
311
|
+
// We can use the `directiveInject` only during the component
|
|
312
|
+
// construction, since Angular captures the currently active injector.
|
|
313
|
+
// We're not able to use this function inside the getter (when the `selectorId` property is
|
|
314
|
+
// requested for the first time), since the currently active injector will be null.
|
|
315
|
+
instance[InjectorInstance] = ɵɵdirectiveInject(
|
|
316
|
+
// We're using `INJECTOR` token except of the `Injector` class since the compiler
|
|
317
|
+
// throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.
|
|
318
|
+
// Caretaker note: that this is the same way of getting the injector.
|
|
319
|
+
INJECTOR);
|
|
320
|
+
// Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.
|
|
321
|
+
/** @type {?} */
|
|
322
|
+
var injectorNotifier$ = instance[InjectorNotifier];
|
|
323
|
+
if (injectorNotifier$) {
|
|
324
|
+
injectorNotifier$.next(true);
|
|
325
|
+
injectorNotifier$.complete();
|
|
326
|
+
}
|
|
327
|
+
return instance;
|
|
328
|
+
});
|
|
329
|
+
// If we've found any definition then it's enough to override the `def.factory` since Angular
|
|
330
|
+
// code uses the `def.factory` and then fallbacks to `ɵfac`.
|
|
331
|
+
if (def) {
|
|
332
|
+
def.factory = decoratedFactory;
|
|
333
|
+
}
|
|
334
|
+
// `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular
|
|
335
|
+
// still uses the `ɵfac`.
|
|
336
|
+
Object.defineProperty(constructor, NG_FACTORY_DEF, {
|
|
337
|
+
get: (/**
|
|
338
|
+
* @return {?}
|
|
339
|
+
*/
|
|
340
|
+
function () { return decoratedFactory; })
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* @param {?} constructor
|
|
345
|
+
* @return {?}
|
|
346
|
+
*/
|
|
347
|
+
function decorateFactoryLater(constructor) {
|
|
348
|
+
// This function actually will be tree-shaken away when building for production since it's guarded with `ngDevMode`.
|
|
349
|
+
// We're having the `try-catch` here because of the `SyncTestZoneSpec`, which throws
|
|
350
|
+
// an error when micro or macrotask is used within a synchronous test. E.g. `Cannot call
|
|
351
|
+
// Promise.then from within a sync test`.
|
|
352
|
+
try {
|
|
353
|
+
Promise.resolve().then((/**
|
|
354
|
+
* @return {?}
|
|
355
|
+
*/
|
|
356
|
+
function () {
|
|
357
|
+
decorateFactory(constructor);
|
|
358
|
+
}));
|
|
359
|
+
}
|
|
360
|
+
catch (_a) {
|
|
361
|
+
// This is kind of a "hack", but we try to be backwards-compatible,
|
|
362
|
+
// tho this `catch` block will only be executed when tests are run with Jasmine or Jest.
|
|
363
|
+
ɵglobal.process &&
|
|
364
|
+
ɵglobal.process.nextTick &&
|
|
365
|
+
ɵglobal.process.nextTick((/**
|
|
366
|
+
* @return {?}
|
|
367
|
+
*/
|
|
368
|
+
function () {
|
|
369
|
+
decorateFactory(constructor);
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* @record
|
|
375
|
+
*/
|
|
376
|
+
function Definition() { }
|
|
377
|
+
if (false) {
|
|
378
|
+
/** @type {?} */
|
|
379
|
+
Definition.prototype.factory;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* @record
|
|
383
|
+
*/
|
|
384
|
+
function ConstructorWithDefinitionAndFactory() { }
|
|
385
|
+
if (false) {
|
|
386
|
+
/** @type {?|undefined} */
|
|
387
|
+
ConstructorWithDefinitionAndFactory.prototype.ɵprov;
|
|
388
|
+
/** @type {?|undefined} */
|
|
389
|
+
ConstructorWithDefinitionAndFactory.prototype.ɵpipe;
|
|
390
|
+
/** @type {?|undefined} */
|
|
391
|
+
ConstructorWithDefinitionAndFactory.prototype.ɵcmp;
|
|
392
|
+
/** @type {?|undefined} */
|
|
393
|
+
ConstructorWithDefinitionAndFactory.prototype.ɵdir;
|
|
394
|
+
/* Skipping unnamed member:
|
|
395
|
+
[NG_FACTORY_DEF]?: Factory;*/
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* @record
|
|
399
|
+
*/
|
|
400
|
+
function PrivateInstance() { }
|
|
401
|
+
if (false) {
|
|
402
|
+
/* Skipping unnamed member:
|
|
403
|
+
[InjectorInstance]?: Injector;*/
|
|
404
|
+
/* Skipping unnamed member:
|
|
405
|
+
[InjectorNotifier]?: ReplaySubject<boolean>;*/
|
|
406
|
+
}
|
|
407
|
+
|
|
224
408
|
/**
|
|
225
409
|
* @fileoverview added by tsickle
|
|
226
410
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -231,5 +415,5 @@ var NGXS_STATE_FACTORY = new InjectionToken('Internals.StateFactory');
|
|
|
231
415
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
232
416
|
*/
|
|
233
417
|
|
|
234
|
-
export { INITIAL_STATE_TOKEN, InitialState, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, NgxsBootstrapper, isAngularInTestMode, memoize };
|
|
418
|
+
export { INITIAL_STATE_TOKEN, InitialState, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, NgxsBootstrapper, ensureInjectorNotifierIsCaptured, ensureLocalInjectorCaptured, isAngularInTestMode, localInject, memoize };
|
|
235
419
|
//# 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":";;;;;;;;;;;;AAA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QAChB,OAAO,KAAK,CAAC;KACd;IAVc,kBAAK,GAAgB,EAAE,CAAC;IAWzC,mBAAC;CAZD,IAYC;;;;;;IAXC,mBAAuC;;;;;;;ACNzC;;;;AAKA,IAAa,0BAA0B,GAAwB,IAAI,cAAc,CAC/E,+BAA+B,CAChC;;;;;AAKD,IAAa,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;\r\ndeclare const jasmine: unknown;\r\ndeclare const jest: unknown;\r\ndeclare const Mocha: unknown;\r\n\r\nexport function isAngularInTestMode(): boolean {\r\n // This is safe to check for these properties in the following way since `typeof` does not\r\n // throw an exception if the value does not exist in the scope.\r\n // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).\r\n // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into\r\n // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.\r\n // this will return undefined `global.jest`, but `jest` will not equal undefined.\r\n return (\r\n typeof __karma__ !== 'undefined' ||\r\n typeof jasmine !== 'undefined' ||\r\n typeof jest !== 'undefined' ||\r\n typeof Mocha !== 'undefined'\r\n );\r\n}\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","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 { 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","import {\r\n InjectionToken,\r\n Injector,\r\n INJECTOR,\r\n Type,\r\n ɵɵdirectiveInject,\r\n ɵglobal\r\n} from '@angular/core';\r\nimport { ReplaySubject } from 'rxjs';\r\n\r\n// Will be provided through Terser global definitions by Angular CLI\r\n// during the production build. This is how Angular does tree-shaking internally.\r\ndeclare const ngDevMode: boolean;\r\n\r\n// Angular doesn't export `NG_FACTORY_DEF`.\r\nconst NG_FACTORY_DEF = 'ɵfac';\r\n\r\n// A `Symbol` which is used to save the `Injector` onto the class instance.\r\nconst InjectorInstance: unique symbol = Symbol('InjectorInstance');\r\n\r\n// A `Symbol` which is used to determine if factory has been decorated previously or not.\r\nconst FactoryHasBeenDecorated: unique symbol = Symbol('FactoryHasBeenDecorated');\r\n\r\n// A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot\r\n// be retrieved within the `constructor` since it's set after the `factory()` is called.\r\nconst InjectorNotifier: unique symbol = Symbol('InjectorNotifier');\r\n\r\ninterface PrototypeWithInjectorNotifier extends Object {\r\n [InjectorNotifier]?: ReplaySubject<boolean>;\r\n}\r\n\r\nexport function ensureInjectorNotifierIsCaptured(\r\n target: PrototypeWithInjectorNotifier | PrivateInstance\r\n): ReplaySubject<boolean> {\r\n if (target[InjectorNotifier]) {\r\n return target[InjectorNotifier]!;\r\n } else {\r\n const injectorNotifier$ = new ReplaySubject<boolean>(1);\r\n Object.defineProperty(target, InjectorNotifier, {\r\n get: () => injectorNotifier$\r\n });\r\n return injectorNotifier$;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/ban-types\r\nexport function ensureLocalInjectorCaptured(target: Object): void {\r\n if (FactoryHasBeenDecorated in target.constructor.prototype) {\r\n return;\r\n }\r\n\r\n const constructor: ConstructorWithDefinitionAndFactory = target.constructor;\r\n // Means we're in AOT mode.\r\n if (typeof constructor[NG_FACTORY_DEF] === 'function') {\r\n decorateFactory(constructor);\r\n } else if (ngDevMode) {\r\n // We're running in JIT mode and that means we're not able to get the compiled definition\r\n // on the class inside the property decorator during the current message loop tick. We have\r\n // to wait for the next message loop tick. Note that this is safe since this Promise will be\r\n // resolved even before the `APP_INITIALIZER` is resolved.\r\n // The below code also will be executed only in development mode, since it's never recommended\r\n // to use the JIT compiler in production mode (by setting \"aot: false\").\r\n decorateFactoryLater(constructor);\r\n }\r\n\r\n target.constructor.prototype[FactoryHasBeenDecorated] = true;\r\n}\r\n\r\nexport function localInject<T>(\r\n instance: PrivateInstance,\r\n token: InjectionToken<T> | Type<T>\r\n): T | null {\r\n const injector: Injector | undefined = instance[InjectorInstance];\r\n return injector ? injector.get(token) : null;\r\n}\r\n\r\nfunction decorateFactory(constructor: ConstructorWithDefinitionAndFactory): void {\r\n const factory = constructor[NG_FACTORY_DEF];\r\n\r\n if (typeof factory !== 'function') {\r\n return;\r\n }\r\n\r\n // Let's try to get any definition.\r\n // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first\r\n // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).\r\n const def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;\r\n\r\n const decoratedFactory = () => {\r\n const instance = factory();\r\n // Caretaker note: `inject()` won't work here.\r\n // We can use the `directiveInject` only during the component\r\n // construction, since Angular captures the currently active injector.\r\n // We're not able to use this function inside the getter (when the `selectorId` property is\r\n // requested for the first time), since the currently active injector will be null.\r\n instance[InjectorInstance] = ɵɵdirectiveInject(\r\n // We're using `INJECTOR` token except of the `Injector` class since the compiler\r\n // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.\r\n // Caretaker note: that this is the same way of getting the injector.\r\n INJECTOR\r\n );\r\n\r\n // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.\r\n const injectorNotifier$ = instance[InjectorNotifier];\r\n if (injectorNotifier$) {\r\n injectorNotifier$.next(true);\r\n injectorNotifier$.complete();\r\n }\r\n\r\n return instance;\r\n };\r\n\r\n // If we've found any definition then it's enough to override the `def.factory` since Angular\r\n // code uses the `def.factory` and then fallbacks to `ɵfac`.\r\n if (def) {\r\n def.factory = decoratedFactory;\r\n }\r\n\r\n // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular\r\n // still uses the `ɵfac`.\r\n Object.defineProperty(constructor, NG_FACTORY_DEF, {\r\n get: () => decoratedFactory\r\n });\r\n}\r\n\r\nfunction decorateFactoryLater(constructor: ConstructorWithDefinitionAndFactory): void {\r\n // This function actually will be tree-shaken away when building for production since it's guarded with `ngDevMode`.\r\n // We're having the `try-catch` here because of the `SyncTestZoneSpec`, which throws\r\n // an error when micro or macrotask is used within a synchronous test. E.g. `Cannot call\r\n // Promise.then from within a sync test`.\r\n try {\r\n Promise.resolve().then(() => {\r\n decorateFactory(constructor);\r\n });\r\n } catch {\r\n // This is kind of a \"hack\", but we try to be backwards-compatible,\r\n // tho this `catch` block will only be executed when tests are run with Jasmine or Jest.\r\n ɵglobal.process &&\r\n ɵglobal.process.nextTick &&\r\n ɵglobal.process.nextTick(() => {\r\n decorateFactory(constructor);\r\n });\r\n }\r\n}\r\n\r\n// We could've used `ɵɵFactoryDef` but we try to be backwards-compatible,\r\n// since it's not exported in older Angular versions.\r\ntype Factory = () => PrivateInstance;\r\n\r\n// We could've used `ɵɵInjectableDef`, `ɵɵPipeDef`, etc. We try to be backwards-compatible\r\n// since they're not exported in older Angular versions.\r\ninterface Definition {\r\n factory: Factory | null;\r\n}\r\n\r\ninterface ConstructorWithDefinitionAndFactory extends Function {\r\n // Provider definition for the `@Injectable()` class.\r\n ɵprov?: Definition;\r\n // Pipe definition for the `@Pipe()` class.\r\n ɵpipe?: Definition;\r\n // Component definition for the `@Component()` class.\r\n ɵcmp?: Definition;\r\n // Directive definition for the `@Directive()` class.\r\n ɵdir?: Definition;\r\n [NG_FACTORY_DEF]?: Factory;\r\n}\r\n\r\ninterface PrivateInstance {\r\n [InjectorInstance]?: Injector;\r\n [InjectorNotifier]?: ReplaySubject<boolean>;\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;AAKA,SAAgB,mBAAmB;;;;;;;IAOjC,QACE,OAAO,SAAS,KAAK,WAAW;QAChC,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,IAAI,KAAK,WAAW;QAC3B,OAAO,KAAK,KAAK,WAAW,EAC5B;CACH;;;;;;AClBD;IAGA;;;;QAKU,eAAU,GAAG,IAAI,aAAa,CAAU,CAAC,CAAC,CAAC;KAcpD;IAZC,sBAAI,8CAAgB;;;;QAApB;YACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;SACvC;;;OAAA;;;;;;;;;;IAMD,oCAAS;;;;;IAAT;QACE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC5B;;gBAlBF,UAAU;;IAmBX,uBAAC;CAnBD,IAmBC;;;;;;;IAdC,sCAAmD;;;;;;;;;;;;ACRrD,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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