@ngxs/store 3.7.4-dev.master-a63a5af → 3.7.4-dev.master-c961545

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 (48) hide show
  1. package/bundles/ngxs-store-internals.umd.js +0 -241
  2. package/bundles/ngxs-store-internals.umd.js.map +1 -1
  3. package/bundles/ngxs-store-internals.umd.min.js +1 -1
  4. package/bundles/ngxs-store-internals.umd.min.js.map +1 -1
  5. package/bundles/ngxs-store.umd.js +30 -112
  6. package/bundles/ngxs-store.umd.js.map +1 -1
  7. package/bundles/ngxs-store.umd.min.js +1 -1
  8. package/bundles/ngxs-store.umd.min.js.map +1 -1
  9. package/esm2015/internals/index.js +1 -2
  10. package/esm2015/internals/ngxs-store-internals.js +2 -2
  11. package/esm2015/ngxs-store.js +5 -4
  12. package/esm2015/src/decorators/select/select-factory.js +2 -6
  13. package/esm2015/src/decorators/select/select.js +11 -39
  14. package/esm2015/src/decorators/select/symbols.js +11 -55
  15. package/esm2015/src/internal/state-operations.js +3 -12
  16. package/esm2015/src/module.js +3 -1
  17. package/esm2015/src/modules/ngxs-root.module.js +5 -8
  18. package/esm2015/src/symbols.js +4 -3
  19. package/esm5/internals/index.js +1 -2
  20. package/esm5/internals/ngxs-store-internals.js +2 -2
  21. package/esm5/ngxs-store.js +5 -4
  22. package/esm5/src/decorators/select/select-factory.js +2 -6
  23. package/esm5/src/decorators/select/select.js +5 -40
  24. package/esm5/src/decorators/select/symbols.js +11 -55
  25. package/esm5/src/internal/state-operations.js +3 -12
  26. package/esm5/src/module.js +3 -1
  27. package/esm5/src/modules/ngxs-root.module.js +4 -7
  28. package/esm5/src/symbols.js +4 -3
  29. package/fesm2015/ngxs-store-internals.js +2 -240
  30. package/fesm2015/ngxs-store-internals.js.map +1 -1
  31. package/fesm2015/ngxs-store.js +32 -108
  32. package/fesm2015/ngxs-store.js.map +1 -1
  33. package/fesm5/ngxs-store-internals.js +2 -240
  34. package/fesm5/ngxs-store-internals.js.map +1 -1
  35. package/fesm5/ngxs-store.js +25 -108
  36. package/fesm5/ngxs-store.js.map +1 -1
  37. package/internals/index.d.ts +0 -1
  38. package/internals/ngxs-store-internals.metadata.json +1 -1
  39. package/ngxs-store.d.ts +5 -4
  40. package/ngxs-store.metadata.json +1 -1
  41. package/package.json +1 -1
  42. package/src/decorators/select/select.d.ts +1 -0
  43. package/src/decorators/select/symbols.d.ts +2 -6
  44. package/src/modules/ngxs-root.module.d.ts +2 -2
  45. package/src/symbols.d.ts +3 -2
  46. package/esm2015/internals/decorator-injector-adapter.js +0 -242
  47. package/esm5/internals/decorator-injector-adapter.js +0 -242
  48. package/internals/decorator-injector-adapter.d.ts +0 -15
@@ -206,253 +206,12 @@
206
206
  */
207
207
  var NGXS_STATE_FACTORY = new core.InjectionToken('Internals.StateFactory');
208
208
 
209
- /**
210
- * @fileoverview added by tsickle
211
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
212
- */
213
- // Angular doesn't export `NG_FACTORY_DEF`.
214
- /** @type {?} */
215
- var NG_FACTORY_DEF = 'ɵfac';
216
- // A `Symbol` which is used to save the `Injector` onto the class instance.
217
- /** @type {?} */
218
- var InjectorInstance = Symbol('InjectorInstance');
219
- // A `Symbol` which is used to determine if factory has been decorated previously or not.
220
- /** @type {?} */
221
- var FactoryHasBeenDecorated = Symbol('FactoryHasBeenDecorated');
222
- // A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot
223
- // be retrieved within the `constructor` since it's set after the `factory()` is called.
224
- /** @type {?} */
225
- var InjectorNotifier = Symbol('InjectorNotifier');
226
- /**
227
- * @record
228
- */
229
- function PrototypeWithInjectorNotifier() { }
230
- if (false) {
231
- /* Skipping unnamed member:
232
- [InjectorNotifier]?: ReplaySubject<boolean>;*/
233
- }
234
- /**
235
- * @param {?} target
236
- * @return {?}
237
- */
238
- function ensureInjectorNotifierIsCaptured(target) {
239
- if (target[InjectorNotifier]) {
240
- return (/** @type {?} */ (target[InjectorNotifier]));
241
- }
242
- else {
243
- /** @type {?} */
244
- var injectorNotifier$_1 = new rxjs.ReplaySubject(1);
245
- Object.defineProperty(target, InjectorNotifier, {
246
- get: (/**
247
- * @return {?}
248
- */
249
- function () { return injectorNotifier$_1; })
250
- });
251
- return injectorNotifier$_1;
252
- }
253
- }
254
- // eslint-disable-next-line @typescript-eslint/ban-types
255
- /**
256
- * @param {?} target
257
- * @return {?}
258
- */
259
- function ensureLocalInjectorCaptured(target) {
260
- if (FactoryHasBeenDecorated in target.constructor.prototype) {
261
- return;
262
- }
263
- /** @type {?} */
264
- var constructor = target.constructor;
265
- // The factory is set later by the Angular compiler in JIT mode, and we're not able to patch the factory now.
266
- // We can't use any asynchronous code like `Promise.resolve().then(...)` since this is not functional in unit
267
- // tests that are being run in `SyncTestZoneSpec`.
268
- // Given the following example:
269
- // @Component()
270
- // class BaseComponent {}
271
- // @Component()
272
- // class MainComponent extends BaseComponent {
273
- // @Select(AnimalsState) animals$: Observable<string[]>;
274
- // }
275
- // In this example, the factory will be defined for the `BaseComponent`, but will not be defined for the `MainComponent`.
276
- // If we try to decorate the factory immediately, we'll get `Cannot redefine property` exception when Angular will try to define
277
- // an original factory for the `MainComponent`.
278
- // Note: the factory is defined statically in the code in AOT mode.
279
- // AppComponent.ɵfac = function AppComponent_Factory(t) {
280
- // return new (t || AppComponent)();
281
- // };
282
- // __decorate([Select], AppComponent.prototype, 'animals$', void 0);
283
- /** @type {?} */
284
- var isJitModeOrIsAngularInTestMode = isAngularInTestMode() || !!(core.ɵglobal.ng && core.ɵglobal.ng.ɵcompilerFacade);
285
- // If we're in development mode AND we're running unit tests or there's a compiler facade exposed,
286
- // then patch `Object.defineProperty`. The compiler facade is exposed in JIT mode.
287
- if (ngDevMode && isJitModeOrIsAngularInTestMode) {
288
- patchObjectDefineProperty();
289
- }
290
- else {
291
- decorateFactory(constructor);
292
- }
293
- target.constructor.prototype[FactoryHasBeenDecorated] = true;
294
- }
295
- /**
296
- * @template T
297
- * @param {?} instance
298
- * @param {?} token
299
- * @return {?}
300
- */
301
- function localInject(instance, token) {
302
- /** @type {?} */
303
- var injector = instance[InjectorInstance];
304
- return injector ? injector.get(token) : null;
305
- }
306
- /**
307
- * @param {?} constructor
308
- * @return {?}
309
- */
310
- function decorateFactory(constructor) {
311
- /** @type {?} */
312
- var factory = constructor[NG_FACTORY_DEF];
313
- if (typeof factory !== 'function') {
314
- return;
315
- }
316
- // Let's try to get any definition.
317
- // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first
318
- // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).
319
- /** @type {?} */
320
- var def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;
321
- /** @type {?} */
322
- var decoratedFactory = (/**
323
- * @return {?}
324
- */
325
- function () {
326
- /** @type {?} */
327
- var instance = factory();
328
- // Caretaker note: `inject()` won't work here.
329
- // We can use the `directiveInject` only during the component
330
- // construction, since Angular captures the currently active injector.
331
- // We're not able to use this function inside the getter (when the `selectorId` property is
332
- // requested for the first time), since the currently active injector will be null.
333
- instance[InjectorInstance] = core.ɵɵdirectiveInject(
334
- // We're using `INJECTOR` token except of the `Injector` class since the compiler
335
- // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.
336
- // Caretaker note: that this is the same way of getting the injector.
337
- core.INJECTOR);
338
- // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.
339
- /** @type {?} */
340
- var injectorNotifier$ = instance[InjectorNotifier];
341
- if (injectorNotifier$) {
342
- injectorNotifier$.next(true);
343
- injectorNotifier$.complete();
344
- }
345
- return instance;
346
- });
347
- // If we've found any definition then it's enough to override the `def.factory` since Angular
348
- // code uses the `def.factory` and then fallbacks to `ɵfac`.
349
- if (def) {
350
- def.factory = decoratedFactory;
351
- }
352
- // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular
353
- // still uses the `ɵfac`.
354
- Object.defineProperty(constructor, NG_FACTORY_DEF, {
355
- get: (/**
356
- * @return {?}
357
- */
358
- function () { return decoratedFactory; })
359
- });
360
- }
361
- // Note: this function will be tree-shaken in production.
362
- var ɵ0 = /**
363
- * @return {?}
364
- */
365
- function () {
366
- /** @type {?} */
367
- var objectDefinePropertyPatched = false;
368
- return (/**
369
- * @return {?}
370
- */
371
- function () {
372
- if (objectDefinePropertyPatched) {
373
- return;
374
- }
375
- /** @type {?} */
376
- var defineProperty = Object.defineProperty;
377
- // We should not be patching globals, but there's no other way to know when it's appropriate
378
- // to decorate the original factory. There're different edge cases, e.g., when the class extends
379
- // another class, the factory will be defined for the base class but not for the child class.
380
- // The patching will be done only during the development and in JIT mode.
381
- Object.defineProperty = (/**
382
- * @template T
383
- * @param {?} object
384
- * @param {?} propertyKey
385
- * @param {?} attributes
386
- * @return {?}
387
- */
388
- function (object, propertyKey, attributes) {
389
- // Angular calls `Object.defineProperty(target, 'ɵfac', { get: ..., configurable: true })` when defining a factory function.
390
- // We only want to intercept `ɵfac` key.
391
- // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original
392
- // implementation and then decorate the factory.
393
- // // https://github.com/angular/angular/blob/3a60063a54d850c50ce962a8a39ce01cfee71398/packages/core/src/render3/jit/pipe.ts#L21-L39
394
- if (propertyKey !== NG_FACTORY_DEF ||
395
- // We also call `Object.defineProperty(target, 'ɵfac', ...)`, but we don't set `configurable` property.
396
- (propertyKey === NG_FACTORY_DEF && !attributes.configurable)) {
397
- return (/** @type {?} */ (defineProperty.call(this, object, propertyKey, attributes)));
398
- }
399
- else {
400
- // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original
401
- // implementation and then decorate the factory.
402
- defineProperty.call(this, object, propertyKey, attributes);
403
- decorateFactory((/** @type {?} */ (((/** @type {?} */ (object))))));
404
- return object;
405
- }
406
- });
407
- objectDefinePropertyPatched = true;
408
- });
409
- };
410
- /** @type {?} */
411
- var patchObjectDefineProperty = ((ɵ0))();
412
- /**
413
- * @record
414
- */
415
- function Definition() { }
416
- if (false) {
417
- /** @type {?} */
418
- Definition.prototype.factory;
419
- }
420
- /**
421
- * @record
422
- */
423
- function ConstructorWithDefinitionAndFactory() { }
424
- if (false) {
425
- /** @type {?|undefined} */
426
- ConstructorWithDefinitionAndFactory.prototype.ɵprov;
427
- /** @type {?|undefined} */
428
- ConstructorWithDefinitionAndFactory.prototype.ɵpipe;
429
- /** @type {?|undefined} */
430
- ConstructorWithDefinitionAndFactory.prototype.ɵcmp;
431
- /** @type {?|undefined} */
432
- ConstructorWithDefinitionAndFactory.prototype.ɵdir;
433
- /* Skipping unnamed member:
434
- [NG_FACTORY_DEF]?: Factory;*/
435
- }
436
- /**
437
- * @record
438
- */
439
- function PrivateInstance() { }
440
- if (false) {
441
- /* Skipping unnamed member:
442
- [InjectorInstance]?: Injector;*/
443
- /* Skipping unnamed member:
444
- [InjectorNotifier]?: ReplaySubject<boolean>;*/
445
- }
446
-
447
209
  exports.INITIAL_STATE_TOKEN = INITIAL_STATE_TOKEN;
448
210
  exports.InitialState = InitialState;
449
211
  exports.NGXS_STATE_CONTEXT_FACTORY = NGXS_STATE_CONTEXT_FACTORY;
450
212
  exports.NGXS_STATE_FACTORY = NGXS_STATE_FACTORY;
451
213
  exports.NgxsBootstrapper = NgxsBootstrapper;
452
- exports.ensureInjectorNotifierIsCaptured = ensureInjectorNotifierIsCaptured;
453
- exports.ensureLocalInjectorCaptured = ensureLocalInjectorCaptured;
454
214
  exports.isAngularInTestMode = isAngularInTestMode;
455
- exports.localInject = localInject;
456
215
  exports.memoize = memoize;
457
216
 
458
217
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1 +1 @@
1
- {"version":3,"file":"ngxs-store-internals.umd.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 ɵglobal,\n ɵɵdirectiveInject\n} from '@angular/core';\nimport { ReplaySubject } from 'rxjs';\n\nimport { isAngularInTestMode } from './angular';\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\n // The factory is set later by the Angular compiler in JIT mode, and we're not able to patch the factory now.\n // We can't use any asynchronous code like `Promise.resolve().then(...)` since this is not functional in unit\n // tests that are being run in `SyncTestZoneSpec`.\n // Given the following example:\n // @Component()\n // class BaseComponent {}\n // @Component()\n // class MainComponent extends BaseComponent {\n // @Select(AnimalsState) animals$: Observable<string[]>;\n // }\n // In this example, the factory will be defined for the `BaseComponent`, but will not be defined for the `MainComponent`.\n // If we try to decorate the factory immediately, we'll get `Cannot redefine property` exception when Angular will try to define\n // an original factory for the `MainComponent`.\n\n // Note: the factory is defined statically in the code in AOT mode.\n // AppComponent.ɵfac = function AppComponent_Factory(t) {\n // return new (t || AppComponent)();\n // };\n // __decorate([Select], AppComponent.prototype, 'animals$', void 0);\n\n const isJitModeOrIsAngularInTestMode =\n isAngularInTestMode() || !!(ɵglobal.ng && ɵglobal.ng.ɵcompilerFacade);\n\n // If we're in development mode AND we're running unit tests or there's a compiler facade exposed,\n // then patch `Object.defineProperty`. The compiler facade is exposed in JIT mode.\n if (ngDevMode && isJitModeOrIsAngularInTestMode) {\n patchObjectDefineProperty();\n } else {\n decorateFactory(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\n// Note: this function will be tree-shaken in production.\nconst patchObjectDefineProperty = (() => {\n let objectDefinePropertyPatched = false;\n return () => {\n if (objectDefinePropertyPatched) {\n return;\n }\n const defineProperty = Object.defineProperty;\n // We should not be patching globals, but there's no other way to know when it's appropriate\n // to decorate the original factory. There're different edge cases, e.g., when the class extends\n // another class, the factory will be defined for the base class but not for the child class.\n // The patching will be done only during the development and in JIT mode.\n Object.defineProperty = function<T>(\n object: T,\n propertyKey: PropertyKey,\n attributes: PropertyDescriptor & ThisType<any>\n ) {\n // Angular calls `Object.defineProperty(target, 'ɵfac', { get: ..., configurable: true })` when defining a factory function.\n // We only want to intercept `ɵfac` key.\n // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original\n // implementation and then decorate the factory.\n // // https://github.com/angular/angular/blob/3a60063a54d850c50ce962a8a39ce01cfee71398/packages/core/src/render3/jit/pipe.ts#L21-L39\n if (\n propertyKey !== NG_FACTORY_DEF ||\n // We also call `Object.defineProperty(target, 'ɵfac', ...)`, but we don't set `configurable` property.\n (propertyKey === NG_FACTORY_DEF && !attributes.configurable)\n ) {\n return defineProperty.call(this, object, propertyKey, attributes) as T;\n } else {\n // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original\n // implementation and then decorate the factory.\n defineProperty.call(this, object, propertyKey, attributes);\n decorateFactory((object as unknown) as ConstructorWithDefinitionAndFactory);\n return object;\n }\n };\n objectDefinePropertyPatched = true;\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 [InjectorInstance]?: Injector;\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n"],"names":["ReplaySubject","Injectable","InjectionToken","ɵglobal","ɵɵdirectiveInject","INJECTOR"],"mappings":";;;;;;;;;;;;;IAKA,SAAgB,mBAAmB;;;;;;;QAOjC,QACE,OAAO,SAAS,KAAK,WAAW;YAChC,OAAO,OAAO,KAAK,WAAW;YAC9B,OAAO,IAAI,KAAK,WAAW;YAC3B,OAAO,KAAK,KAAK,WAAW,EAC5B;KACH;;;;;;AClBD;QAGA;;;;YAKU,eAAU,GAAG,IAAIA,kBAAa,CAAU,CAAC,CAAC,CAAC;SAcpD;QAZC,sBAAI,8CAAgB;;;;YAApB;gBACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;aACvC;;;WAAA;;;;;;;;;;QAMD,oCAAS;;;;;QAAT;YACE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3B,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;SAC5B;;oBAlBFC,eAAU;;QAmBX,uBAAC;KAnBD,IAmBC;;;;;;;QAdC,sCAAmD;;;;;;;;;;;;ICRrD,SAAS,oBAAoB,CAAC,CAAM,EAAE,CAAM;QAC1C,OAAO,CAAC,KAAK,CAAC,CAAC;KAChB;;;;;;;IAED,SAAS,0BAA0B,CACjC,aAA0C,EAC1C,IAAuB,EACvB,IAAuB;QAEvB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;YACjE,OAAO,KAAK,CAAC;SACd;;;YAGK,MAAM,GAAG,IAAI,CAAC,MAAM;QAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE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CAAC,GAAM;iBACxE;qBAAM;;;oBAGL,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;oBAC3D,eAAe,wCAAE,MAAM,MAAoD,CAAC;oBAC5E,OAAO,MAAM,CAAC;iBACf;aACF,CAAA,CAAC;YACF,2BAA2B,GAAG,IAAI,CAAC;SACpC,EAAC;KACH;;QArCK,yBAAyB,GAAG,QAqC9B;;;;IAQJ,yBAEC;;;QADC,6BAAwB;;;;;IAG1B,kDAUC;;;QARC,oDAAmB;;QAEnB,oDAAmB;;QAEnB,mDAAkB;;QAElB,mDAAkB;;;;;;;IAIpB,8BAGC;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ngxs-store-internals.umd.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"],"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"],"names":["ReplaySubject","Injectable","InjectionToken"],"mappings":";;;;;;;;;;;;;IAKA,SAAgB,mBAAmB;;;;;;;QAOjC,QACE,OAAO,SAAS,KAAK,WAAW;YAChC,OAAO,OAAO,KAAK,WAAW;YAC9B,OAAO,IAAI,KAAK,WAAW;YAC3B,OAAO,KAAK,KAAK,WAAW,EAC5B;KACH;;;;;;AClBD;QAGA;;;;YAKU,eAAU,GAAG,IAAIA,kBAAa,CAAU,CAAC,CAAC,CAAC;SAcpD;QAZC,sBAAI,8CAAgB;;;;YAApB;gBACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;aACvC;;;WAAA;;;;;;;;;;QAMD,oCAAS;;;;;QAAT;YACE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3B,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;SAC5B;;oBAlBFC,eAAU;;QAmBX,uBAAC;KAnBD,IAmBC;;;;;;;QAdC,sCAAmD;;;;;;;;;;;;ICRrD,SAAS,oBAAoB,CAAC,CAAM,EAAE,CAAM;QAC1C,OAAO,CAAC,KAAK,CAAC,CAAC;KAChB;;;;;;;IAED,SAAS,0BAA0B,CACjC,aAA0C,EAC1C,IAAuB,EACvB,IAAuB;QAEvB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;YACjE,OAAO,KAAK,CAAC;SACd;;;YAGK,MAAM,GAAG,IAAI,CAAC,MAAM;QAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,E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c,CACvE,wBAAwB,CACzB;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs")):"function"==typeof define&&define.amd?define("@ngxs/store/internals",["exports","@angular/core","rxjs"],t):t(((e=e||self).ngxs=e.ngxs||{},e.ngxs.store=e.ngxs.store||{},e.ngxs.store.internals={}),e.ng.core,e.rxjs)}(this,(function(e,t,n){"use strict";function r(){return"undefined"!=typeof __karma__||"undefined"!=typeof jasmine||"undefined"!=typeof jest||"undefined"!=typeof Mocha}var o=function(){function e(){this.bootstrap$=new n.ReplaySubject(1)}return Object.defineProperty(e.prototype,"appBootstrapped$",{get:function(){return this.bootstrap$.asObservable()},enumerable:!0,configurable:!0}),e.prototype.bootstrap=function(){this.bootstrap$.next(!0),this.bootstrap$.complete()},e.decorators=[{type:t.Injectable}],e}();function i(e,t){return e===t}var u=new t.InjectionToken("INITIAL_STATE_TOKEN"),c=function(){function e(){}return e.set=function(e){this.value=e},e.pop=function(){var e=this.value;return this.value={},e},e.value={},e}();var a=new t.InjectionToken("Internals.StateContextFactory"),f=new t.InjectionToken("Internals.StateFactory"),l="ɵfac",s=Symbol("InjectorInstance"),p=Symbol("FactoryHasBeenDecorated"),d=Symbol("InjectorNotifier");function y(e){var n=e[l];if("function"==typeof n){var r=e.ɵprov||e.ɵpipe||e.ɵcmp||e.ɵdir,o=function(){var e=n();e[s]=t.ɵɵdirectiveInject(t.INJECTOR);var r=e[d];return r&&(r.next(!0),r.complete()),e};r&&(r.factory=o),Object.defineProperty(e,l,{get:function(){return o}})}}var b,g=(b=!1,function(){if(!b){var e=Object.defineProperty;Object.defineProperty=function(t,n,r){return n!==l||n===l&&!r.configurable?e.call(this,t,n,r):(e.call(this,t,n,r),y(t),t)},b=!0}});e.INITIAL_STATE_TOKEN=u,e.InitialState=c,e.NGXS_STATE_CONTEXT_FACTORY=a,e.NGXS_STATE_FACTORY=f,e.NgxsBootstrapper=o,e.ensureInjectorNotifierIsCaptured=function(e){if(e[d])return e[d];var t=new n.ReplaySubject(1);return Object.defineProperty(e,d,{get:function(){return t}}),t},e.ensureLocalInjectorCaptured=function(e){if(!(p in e.constructor.prototype)){var n=e.constructor,o=r()||!(!t.ɵglobal.ng||!t.ɵglobal.ng.ɵcompilerFacade);ngDevMode&&o?g():y(n),e.constructor.prototype[p]=!0}},e.isAngularInTestMode=r,e.localInject=function(e,t){var n=e[s];return n?n.get(t):null},e.memoize=function(e,t){void 0===t&&(t=i);var n=null,r=null;function o(){return function(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}(t,n,arguments)||(r=e.apply(null,arguments)),n=arguments,r}return o.reset=function(){n=null,r=null},o},Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("rxjs")):"function"==typeof define&&define.amd?define("@ngxs/store/internals",["exports","@angular/core","rxjs"],n):n(((e=e||self).ngxs=e.ngxs||{},e.ngxs.store=e.ngxs.store||{},e.ngxs.store.internals={}),e.ng.core,e.rxjs)}(this,(function(e,n,t){"use strict";var r=function(){function e(){this.bootstrap$=new t.ReplaySubject(1)}return Object.defineProperty(e.prototype,"appBootstrapped$",{get:function(){return this.bootstrap$.asObservable()},enumerable:!0,configurable:!0}),e.prototype.bootstrap=function(){this.bootstrap$.next(!0),this.bootstrap$.complete()},e.decorators=[{type:n.Injectable}],e}();function o(e,n){return e===n}var u=new n.InjectionToken("INITIAL_STATE_TOKEN"),i=function(){function e(){}return e.set=function(e){this.value=e},e.pop=function(){var e=this.value;return this.value={},e},e.value={},e}();var s=new n.InjectionToken("Internals.StateContextFactory"),a=new n.InjectionToken("Internals.StateFactory");e.INITIAL_STATE_TOKEN=u,e.InitialState=i,e.NGXS_STATE_CONTEXT_FACTORY=s,e.NGXS_STATE_FACTORY=a,e.NgxsBootstrapper=r,e.isAngularInTestMode=function(){return"undefined"!=typeof __karma__||"undefined"!=typeof jasmine||"undefined"!=typeof jest||"undefined"!=typeof Mocha},e.memoize=function(e,n){void 0===n&&(n=o);var t=null,r=null;function u(){return function(e,n,t){if(null===n||null===t||n.length!==t.length)return!1;for(var r=n.length,o=0;o<r;o++)if(!e(n[o],t[o]))return!1;return!0}(n,t,arguments)||(r=e.apply(null,arguments)),t=arguments,r}return u.reset=function(){t=null,r=null},u},Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=ngxs-store-internals.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"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"],"names":["isAngularInTestMode","__karma__","jasmine","jest","Mocha","NgxsBootstrapper","this","bootstrap$","ReplaySubject","Object","defineProperty","prototype","asObservable","bootstrap","next","complete","Injectable","defaultEqualityCheck","a","b","INITIAL_STATE_TOKEN","InjectionToken","InitialState","set","state","value","pop","NGXS_STATE_CONTEXT_FACTORY","NGXS_STATE_FACTORY","NG_FACTORY_DEF","InjectorInstance","Symbol","FactoryHasBeenDecorated","InjectorNotifier","decorateFactory","constructor","factory","def","ɵprov","ɵpipe","ɵcmp","ɵdir","decoratedFactory","instance","ɵɵdirectiveInject","INJECTOR","injectorNotifier$","get","objectDefinePropertyPatched","patchObjectDefineProperty","object","propertyKey","attributes","configurable","call","target","injectorNotifier$_1","isJitModeOrIsAngularInTestMode","ɵglobal","ng","ɵcompilerFacade","ngDevMode","token","injector","func","equalityCheck","lastArgs","lastResult","memoized","prev","length","i","areArgumentsShallowlyEqual","arguments","apply","reset"],"mappings":"iXAKA,SAAgBA,IAOd,MACuB,oBAAdC,WACY,oBAAZC,SACS,oBAATC,MACU,oBAAVC,MChB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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 ɵglobal,\n ɵɵdirectiveInject\n} from '@angular/core';\nimport { ReplaySubject } from 'rxjs';\n\nimport { isAngularInTestMode } from './angular';\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\n // The factory is set later by the Angular compiler in JIT mode, and we're not able to patch the factory now.\n // We can't use any asynchronous code like `Promise.resolve().then(...)` since this is not functional in unit\n // tests that are being run in `SyncTestZoneSpec`.\n // Given the following example:\n // @Component()\n // class BaseComponent {}\n // @Component()\n // class MainComponent extends BaseComponent {\n // @Select(AnimalsState) animals$: Observable<string[]>;\n // }\n // In this example, the factory will be defined for the `BaseComponent`, but will not be defined for the `MainComponent`.\n // If we try to decorate the factory immediately, we'll get `Cannot redefine property` exception when Angular will try to define\n // an original factory for the `MainComponent`.\n\n // Note: the factory is defined statically in the code in AOT mode.\n // AppComponent.ɵfac = function AppComponent_Factory(t) {\n // return new (t || AppComponent)();\n // };\n // __decorate([Select], AppComponent.prototype, 'animals$', void 0);\n\n const isJitModeOrIsAngularInTestMode =\n isAngularInTestMode() || !!(ɵglobal.ng && ɵglobal.ng.ɵcompilerFacade);\n\n // If we're in development mode AND we're running unit tests or there's a compiler facade exposed,\n // then patch `Object.defineProperty`. The compiler facade is exposed in JIT mode.\n if (ngDevMode && isJitModeOrIsAngularInTestMode) {\n patchObjectDefineProperty();\n } else {\n decorateFactory(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\n// Note: this function will be tree-shaken in production.\nconst patchObjectDefineProperty = (() => {\n let objectDefinePropertyPatched = false;\n return () => {\n if (objectDefinePropertyPatched) {\n return;\n }\n const defineProperty = Object.defineProperty;\n // We should not be patching globals, but there's no other way to know when it's appropriate\n // to decorate the original factory. There're different edge cases, e.g., when the class extends\n // another class, the factory will be defined for the base class but not for the child class.\n // The patching will be done only during the development and in JIT mode.\n Object.defineProperty = function<T>(\n object: T,\n propertyKey: PropertyKey,\n attributes: PropertyDescriptor & ThisType<any>\n ) {\n // Angular calls `Object.defineProperty(target, 'ɵfac', { get: ..., configurable: true })` when defining a factory function.\n // We only want to intercept `ɵfac` key.\n // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original\n // implementation and then decorate the factory.\n // // https://github.com/angular/angular/blob/3a60063a54d850c50ce962a8a39ce01cfee71398/packages/core/src/render3/jit/pipe.ts#L21-L39\n if (\n propertyKey !== NG_FACTORY_DEF ||\n // We also call `Object.defineProperty(target, 'ɵfac', ...)`, but we don't set `configurable` property.\n (propertyKey === NG_FACTORY_DEF && !attributes.configurable)\n ) {\n return defineProperty.call(this, object, propertyKey, attributes) as T;\n } else {\n // If the property is `ɵfac` AND `configurable` equals `true`, then let's call the original\n // implementation and then decorate the factory.\n defineProperty.call(this, object, propertyKey, attributes);\n decorateFactory((object as unknown) as ConstructorWithDefinitionAndFactory);\n return object;\n }\n };\n objectDefinePropertyPatched = true;\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 [InjectorInstance]?: Injector;\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n"]}
1
+ {"version":3,"sources":["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/angular.ts"],"names":["NgxsBootstrapper","this","bootstrap$","ReplaySubject","Object","defineProperty","prototype","asObservable","bootstrap","next","complete","Injectable","defaultEqualityCheck","a","b","INITIAL_STATE_TOKEN","InjectionToken","InitialState","set","state","value","pop","NGXS_STATE_CONTEXT_FACTORY","NGXS_STATE_FACTORY","__karma__","jasmine","jest","Mocha","func","equalityCheck","lastArgs","lastResult","memoized","prev","length","i","areArgumentsShallowlyEqual","arguments","apply","reset"],"mappings":"iXAAA,IAAAA,EAAA,WAGA,SAAAA,IAKUC,KAAAC,WAAa,IAAIC,EAAAA,cAAuB,GAclD,OAZEC,OAAAC,eAAIL,EAAAM,UAAA,mBAAgB,KAApB,WACE,OAAOL,KAAKC,WAAWK,gDAOzBP,EAAAM,UAAAE,UAAA,WACEP,KAAKC,WAAWO,MAAK,GACrBR,KAAKC,WAAWQ,gCAjBnBC,EAAAA,aAmBDX,EAtBA,GCAA,SAASY,EAAqBC,EAAQC,GACpC,OAAOD,IAAMC,ECEf,IAAaC,EAAsB,IAAIC,EAAAA,eAAoB,uBAE3DC,EAAA,WAAA,SAAAA,KAYA,OATgBA,EAAAC,IAAd,SAAkBC,GAChBlB,KAAKmB,MAAQD,GAGDF,EAAAI,IAAd,eACQF,EAAqBlB,KAAKmB,MAEhC,OADAnB,KAAKmB,MAAQ,GACND,GATMF,EAAAG,MAAqB,GAWtCH,EAZA,GCAA,IAAaK,EAAkD,IAAIN,EAAAA,eACjE,iCAMWO,EAA0C,IAAIP,EAAAA,eACzD,oKCRF,WAOE,MACuB,oBAAdQ,WACY,oBAAZC,SACS,oBAATC,MACU,oBAAVC,iBHcX,SACEC,EACAC,QAAA,IAAAA,IAAAA,EAAAjB,OAEIkB,EAA8B,KAC9BC,EAAkB,KAEtB,SAASC,IAOP,OAxCJ,SACEH,EACAI,EACAxB,GAEA,GAAa,OAATwB,GAA0B,OAATxB,GAAiBwB,EAAKC,SAAWzB,EAAKyB,OACzD,OAAO,EAKT,QADMA,EAASD,EAAKC,OACXC,EAAI,EAAGA,EAAID,EAAQC,IAC1B,IAAKN,EAAcI,EAAKE,GAAI1B,EAAK0B,IAC/B,OAAO,EAIX,OAAO,EAiBAC,CAA2BP,EAAeC,EAAUO,aAEvDN,EAAa,EAAiBO,MAAM,KAAMD,YAG5CP,EAAWO,UACJN,EAOT,OALA,EAAgBQ,MAAK,WAEnBT,EAAW,KACXC,EAAa,MAEf","sourcesContent":["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","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"]}
@@ -474,8 +474,9 @@
474
474
  * - Object.freeze on the state and actions to guarantee immutability
475
475
  * (default: false)
476
476
  *
477
- * @deprecated This property is no longer necessary when the Ivy compiler is used.
478
- * We'll determine the development mode through the `ngDevMode`. It's still essential with View Engine.
477
+ * Note: this property will be accounted only in development mode when using the Ivy compiler.
478
+ * It makes sense to use it only during development to ensure there're no state mutations.
479
+ * When building for production, the Object.freeze will be tree-shaken away.
479
480
  * @type {?}
480
481
  */
481
482
  NgxsConfig.prototype.developmentMode;
@@ -2346,21 +2347,13 @@
2346
2347
  */
2347
2348
  function (actionOrActions) { return _this._dispatcher.dispatch(actionOrActions); })
2348
2349
  };
2349
- // We have to have that duplication since this will allow us to tree-shake `ensureStateAndActionsAreImmutable`
2350
- // and `deepFreeze` in Ivy production build.
2351
- // The below `if` condition checks 2 things:
2352
- // 1) if we're in View Engine (`ngDevMode` is `undefined`)
2353
- // 2) if we're running tests, we should fallback to `config.developmentMode` to be backwards-compatible
2354
- if (typeof ngDevMode === 'undefined' || (ngDevMode && internals.isAngularInTestMode())) {
2350
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
2355
2351
  return this._config.developmentMode
2356
2352
  ? ensureStateAndActionsAreImmutable(rootStateOperations)
2357
2353
  : rootStateOperations;
2358
2354
  }
2359
2355
  else {
2360
- // If we're in Ivy and not running tests, then tree-shake `ensureStateAndActionsAreImmutable` and `deepFreeze`.
2361
- return ngDevMode
2362
- ? ensureStateAndActionsAreImmutable(rootStateOperations)
2363
- : rootStateOperations;
2356
+ return rootStateOperations;
2364
2357
  }
2365
2358
  };
2366
2359
  /**
@@ -3927,14 +3920,13 @@
3927
3920
  SelectFactory.store = null;
3928
3921
  SelectFactory.config = null;
3929
3922
  SelectFactory.decorators = [
3930
- { type: core.Injectable, args: [{ providedIn: 'root' },] }
3923
+ { type: core.Injectable }
3931
3924
  ];
3932
3925
  /** @nocollapse */
3933
3926
  SelectFactory.ctorParameters = function () { return [
3934
3927
  { type: Store },
3935
3928
  { type: NgxsConfig }
3936
3929
  ]; };
3937
- /** @nocollapse */ SelectFactory.ngInjectableDef = core.defineInjectable({ factory: function SelectFactory_Factory() { return new SelectFactory(core.inject(Store), core.inject(NgxsConfig)); }, token: SelectFactory, providedIn: "root" });
3938
3930
  return SelectFactory;
3939
3931
  }());
3940
3932
  if (false) {
@@ -4007,11 +3999,8 @@
4007
3999
  * @ignore
4008
4000
  */
4009
4001
  var NgxsRootModule = /** @class */ (function () {
4010
- function NgxsRootModule(factory, internalStateOperations, _store, injector, states, lifecycleStateManager) {
4002
+ function NgxsRootModule(factory, internalStateOperations, _store, _select, states, lifecycleStateManager) {
4011
4003
  if (states === void 0) { states = []; }
4012
- // If the user is running View Engine then we create the `SelectFactory` instance,
4013
- // otherwise it'll be tree-shaken away in Ivy.
4014
- !core.ɵivyEnabled && injector.get(SelectFactory);
4015
4004
  // Add stores to the state graph and return their defaults
4016
4005
  /** @type {?} */
4017
4006
  var results = factory.addAndReturnDefaults(states);
@@ -4029,7 +4018,7 @@
4029
4018
  { type: StateFactory },
4030
4019
  { type: InternalStateOperations },
4031
4020
  { type: Store },
4032
- { type: core.Injector },
4021
+ { type: SelectFactory },
4033
4022
  { type: Array, decorators: [{ type: core.Optional }, { type: core.Inject, args: [ROOT_STATE_TOKEN,] }] },
4034
4023
  { type: LifecycleStateManager }
4035
4024
  ]; };
@@ -4136,6 +4125,7 @@
4136
4125
  InternalNgxsExecutionStrategy,
4137
4126
  Store,
4138
4127
  StateStream,
4128
+ SelectFactory,
4139
4129
  PluginManager
4140
4130
  ], states, NgxsModule.ngxsTokenProviders(states, options))
4141
4131
  };
@@ -4414,37 +4404,30 @@
4414
4404
  /**
4415
4405
  * @template T
4416
4406
  * @param {?} selector
4417
- * @param {?} store
4418
4407
  * @return {?}
4419
4408
  */
4420
- function createSelectObservable(selector, store) {
4421
- // We're doing this stuff to tree-shake the `SelectFactory` when the user
4422
- // is running Ivy since NGXS will select the state from the provided `store` argument.
4423
- return core.ɵivyEnabled
4424
- ? createSelectObservableIvy(selector, store)
4425
- : createSelectObservableViewEngine(selector);
4409
+ function createSelectObservable(selector) {
4410
+ if (!SelectFactory.store) {
4411
+ throwSelectFactoryNotConnectedError();
4412
+ }
4413
+ return (/** @type {?} */ (SelectFactory.store)).select(selector);
4426
4414
  }
4427
4415
  /**
4428
- * @param {?} config
4429
4416
  * @param {?} name
4430
4417
  * @param {?=} rawSelector
4431
4418
  * @param {?=} paths
4432
4419
  * @return {?}
4433
4420
  */
4434
- function createSelectorFn(config, name, rawSelector, paths) {
4421
+ function createSelectorFn(name, rawSelector, paths) {
4435
4422
  if (paths === void 0) { paths = []; }
4436
- rawSelector = rawSelector || removeDollarAtTheEnd(name);
4437
- if (typeof rawSelector !== 'string') {
4438
- return rawSelector;
4439
- }
4440
- else {
4423
+ rawSelector = !rawSelector ? removeDollarAtTheEnd(name) : rawSelector;
4424
+ if (typeof rawSelector === 'string') {
4441
4425
  /** @type {?} */
4442
4426
  var propsArray = paths.length
4443
4427
  ? __spread([rawSelector], paths) : rawSelector.split('.');
4444
- return core.ɵivyEnabled
4445
- ? createSelectorFnIvy(propsArray, config)
4446
- : createSelectorFnViewEngine(propsArray);
4428
+ return propGetter(propsArray, (/** @type {?} */ (SelectFactory.config)));
4447
4429
  }
4430
+ return rawSelector;
4448
4431
  }
4449
4432
  /**
4450
4433
  * \@example If `foo$` => make it just `foo`
@@ -4458,42 +4441,6 @@
4458
4441
  var dollarAtTheEnd = name.charCodeAt(lastCharIndex) === DOLLAR_CHAR_CODE;
4459
4442
  return dollarAtTheEnd ? name.slice(0, lastCharIndex) : name;
4460
4443
  }
4461
- /**
4462
- * @template T
4463
- * @param {?} selector
4464
- * @param {?} store
4465
- * @return {?}
4466
- */
4467
- function createSelectObservableIvy(selector, store) {
4468
- return ngDevMode && !store ? throwSelectFactoryNotConnectedError() : (/** @type {?} */ (store)).select(selector);
4469
- }
4470
- /**
4471
- * @template T
4472
- * @param {?} selector
4473
- * @return {?}
4474
- */
4475
- function createSelectObservableViewEngine(selector) {
4476
- return SelectFactory.store
4477
- ? SelectFactory.store.select(selector)
4478
- : throwSelectFactoryNotConnectedError();
4479
- }
4480
- /**
4481
- * @param {?} propsArray
4482
- * @param {?} config
4483
- * @return {?}
4484
- */
4485
- function createSelectorFnIvy(propsArray, config) {
4486
- return ngDevMode && !config
4487
- ? throwSelectFactoryNotConnectedError()
4488
- : propGetter(propsArray, (/** @type {?} */ (config)));
4489
- }
4490
- /**
4491
- * @param {?} propsArray
4492
- * @return {?}
4493
- */
4494
- function createSelectorFnViewEngine(propsArray) {
4495
- return propGetter(propsArray, (/** @type {?} */ (SelectFactory.config)));
4496
- }
4497
4444
 
4498
4445
  /**
4499
4446
  * @fileoverview added by tsickle
@@ -4501,6 +4448,7 @@
4501
4448
  */
4502
4449
  /**
4503
4450
  * Decorator for selecting a slice of state from the store.
4451
+ * @deprecated
4504
4452
  * @template T
4505
4453
  * @param {?=} rawSelector
4506
4454
  * @param {...?} paths
@@ -4518,17 +4466,13 @@
4518
4466
  */
4519
4467
  function (target, key) {
4520
4468
  var _a;
4469
+ console.warn("\n The @Select decorator has been deprecated due to the following reasons:\n 1) Lack of type-safety (compare to 'store.select()')\n 2) Not compatible with server-side rendering because it uses a global 'Store' instance, which might change between renders\n 3) Not compatible with module federation\n Consider replacing it the with store.select.\n ");
4521
4470
  /** @type {?} */
4522
4471
  var name = key.toString();
4523
4472
  /** @type {?} */
4524
4473
  var selectorId = "__" + name + "__selector";
4525
4474
  /** @type {?} */
4526
- var selector = null;
4527
- /** @type {?} */
4528
- var injectorNotifier$ = null;
4529
- if (core.ɵivyEnabled) {
4530
- injectorNotifier$ = internals.ensureInjectorNotifierIsCaptured(target);
4531
- }
4475
+ var selector = createSelectorFn(name, rawSelector, paths);
4532
4476
  Object.defineProperties(target, (_a = {},
4533
4477
  _a[selectorId] = {
4534
4478
  writable: true,
@@ -4542,37 +4486,10 @@
4542
4486
  * @return {?}
4543
4487
  */
4544
4488
  function () {
4545
- var _this = this;
4546
- if (this[selectorId]) {
4547
- return this[selectorId];
4548
- }
4549
- // The `localInject` will be tree-shaken away in apps that
4550
- // still use the View Engine.
4551
- if (core.ɵivyEnabled) {
4552
- this[selectorId] = (/** @type {?} */ (injectorNotifier$)).pipe(operators.mergeMap((/**
4553
- * @return {?}
4554
- */
4555
- function () {
4556
- /** @type {?} */
4557
- var store = internals.localInject(_this, Store);
4558
- /** @type {?} */
4559
- var config = internals.localInject(_this, NgxsConfig);
4560
- selector = selector || createSelectorFn(config, name, rawSelector, paths);
4561
- return createSelectObservable(selector, store);
4562
- })));
4563
- }
4564
- else {
4565
- selector = selector || createSelectorFn(null, name, rawSelector, paths);
4566
- this[selectorId] = createSelectObservable(selector, null);
4567
- }
4568
- return this[selectorId];
4489
+ return this[selectorId] || (this[selectorId] = createSelectObservable(selector));
4569
4490
  }
4570
4491
  },
4571
4492
  _a));
4572
- // Keep this `if` guard here so the below stuff will be tree-shaken away in apps that still use the View Engine.
4573
- if (core.ɵivyEnabled) {
4574
- internals.ensureLocalInjectorCaptured(target);
4575
- }
4576
4493
  });
4577
4494
  }
4578
4495
 
@@ -4828,12 +4745,13 @@
4828
4745
  exports.ɵo = InternalStateOperations;
4829
4746
  exports.ɵp = PluginManager;
4830
4747
  exports.ɵq = InternalNgxsExecutionStrategy;
4831
- exports.ɵs = ensureStoreMetadata;
4832
- exports.ɵt = getStoreMetadata;
4833
- exports.ɵu = ensureSelectorMetadata;
4834
- exports.ɵv = getSelectorMetadata;
4835
- exports.ɵw = LifecycleStateManager;
4836
- exports.ɵx = NgxsFeatureModule;
4748
+ exports.ɵr = SelectFactory;
4749
+ exports.ɵt = ensureStoreMetadata;
4750
+ exports.ɵu = getStoreMetadata;
4751
+ exports.ɵv = ensureSelectorMetadata;
4752
+ exports.ɵw = getSelectorMetadata;
4753
+ exports.ɵx = LifecycleStateManager;
4754
+ exports.ɵy = NgxsFeatureModule;
4837
4755
 
4838
4756
  Object.defineProperty(exports, '__esModule', { value: true });
4839
4757