@angular/core 16.0.0-next.1 → 16.0.0-next.2

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 (54) hide show
  1. package/esm2020/src/application_config.mjs +21 -0
  2. package/esm2020/src/application_init.mjs +21 -30
  3. package/esm2020/src/application_ref.mjs +31 -31
  4. package/esm2020/src/application_tokens.mjs +2 -13
  5. package/esm2020/src/change_detection/change_detection.mjs +2 -2
  6. package/esm2020/src/change_detection/constants.mjs +1 -49
  7. package/esm2020/src/core.mjs +4 -3
  8. package/esm2020/src/core_private_export.mjs +5 -7
  9. package/esm2020/src/core_render3_private_export.mjs +2 -1
  10. package/esm2020/src/debug/debug_node.mjs +1 -5
  11. package/esm2020/src/hydration/annotate.mjs +140 -0
  12. package/esm2020/src/hydration/api.mjs +120 -0
  13. package/esm2020/src/hydration/error_handling.mjs +29 -0
  14. package/esm2020/src/hydration/interfaces.mjs +10 -0
  15. package/esm2020/src/hydration/node_lookup_utils.mjs +75 -0
  16. package/esm2020/src/hydration/skip_hydration.mjs +34 -0
  17. package/esm2020/src/hydration/tokens.mjs +25 -0
  18. package/esm2020/src/hydration/utils.mjs +131 -0
  19. package/esm2020/src/linker/template_ref.mjs +4 -4
  20. package/esm2020/src/render3/component_ref.mjs +16 -9
  21. package/esm2020/src/render3/i18n/i18n_util.mjs +3 -3
  22. package/esm2020/src/render3/instructions/element.mjs +48 -6
  23. package/esm2020/src/render3/instructions/element_container.mjs +54 -9
  24. package/esm2020/src/render3/instructions/listener.mjs +3 -3
  25. package/esm2020/src/render3/instructions/shared.mjs +25 -8
  26. package/esm2020/src/render3/instructions/template.mjs +2 -2
  27. package/esm2020/src/render3/instructions/text.mjs +36 -5
  28. package/esm2020/src/render3/interfaces/node.mjs +1 -1
  29. package/esm2020/src/render3/interfaces/renderer_dom.mjs +1 -1
  30. package/esm2020/src/render3/interfaces/view.mjs +3 -2
  31. package/esm2020/src/render3/jit/directive.mjs +1 -2
  32. package/esm2020/src/render3/node_manipulation.mjs +12 -1
  33. package/esm2020/src/render3/state.mjs +45 -1
  34. package/esm2020/src/transfer_state.mjs +15 -10
  35. package/esm2020/src/util/lang.mjs +1 -11
  36. package/esm2020/src/util/ng_dev_mode.mjs +3 -1
  37. package/esm2020/src/version.mjs +1 -1
  38. package/esm2020/testing/src/logger.mjs +3 -3
  39. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  40. package/fesm2015/core.mjs +1127 -517
  41. package/fesm2015/core.mjs.map +1 -1
  42. package/fesm2015/testing.mjs +677 -90
  43. package/fesm2015/testing.mjs.map +1 -1
  44. package/fesm2020/core.mjs +1119 -515
  45. package/fesm2020/core.mjs.map +1 -1
  46. package/fesm2020/testing.mjs +671 -90
  47. package/fesm2020/testing.mjs.map +1 -1
  48. package/index.d.ts +174 -92
  49. package/package.json +2 -2
  50. package/schematics/migrations/relative-link-resolution/bundle.js +7 -7
  51. package/schematics/migrations/router-link-with-href/bundle.js +10 -10
  52. package/schematics/ng-generate/standalone-migration/bundle.js +693 -668
  53. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  54. package/testing/index.d.ts +1 -1
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.1
2
+ * @license Angular v16.0.0-next.2
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -555,6 +555,8 @@ function ngDevModeResetPerfCounters() {
555
555
  rendererAppendChild: 0,
556
556
  rendererInsertBefore: 0,
557
557
  rendererCreateComment: 0,
558
+ hydratedNodes: 0,
559
+ hydratedComponents: 0,
558
560
  };
559
561
  // Make sure to refer to ngDevMode as ['ngDevMode'] for closure.
560
562
  const allowNgDevModeTrue = locationString.indexOf('ngDevMode=false') === -1;
@@ -855,54 +857,6 @@ var ChangeDetectionStrategy;
855
857
  */
856
858
  ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
857
859
  })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
858
- /**
859
- * Defines the possible states of the default change detector.
860
- * @see `ChangeDetectorRef`
861
- */
862
- var ChangeDetectorStatus;
863
- (function (ChangeDetectorStatus) {
864
- /**
865
- * A state in which, after calling `detectChanges()`, the change detector
866
- * state becomes `Checked`, and must be explicitly invoked or reactivated.
867
- */
868
- ChangeDetectorStatus[ChangeDetectorStatus["CheckOnce"] = 0] = "CheckOnce";
869
- /**
870
- * A state in which change detection is skipped until the change detector mode
871
- * becomes `CheckOnce`.
872
- */
873
- ChangeDetectorStatus[ChangeDetectorStatus["Checked"] = 1] = "Checked";
874
- /**
875
- * A state in which change detection continues automatically until explicitly
876
- * deactivated.
877
- */
878
- ChangeDetectorStatus[ChangeDetectorStatus["CheckAlways"] = 2] = "CheckAlways";
879
- /**
880
- * A state in which a change detector sub tree is not a part of the main tree and
881
- * should be skipped.
882
- */
883
- ChangeDetectorStatus[ChangeDetectorStatus["Detached"] = 3] = "Detached";
884
- /**
885
- * Indicates that the change detector encountered an error checking a binding
886
- * or calling a directive lifecycle method and is now in an inconsistent state. Change
887
- * detectors in this state do not detect changes.
888
- */
889
- ChangeDetectorStatus[ChangeDetectorStatus["Errored"] = 4] = "Errored";
890
- /**
891
- * Indicates that the change detector has been destroyed.
892
- */
893
- ChangeDetectorStatus[ChangeDetectorStatus["Destroyed"] = 5] = "Destroyed";
894
- })(ChangeDetectorStatus || (ChangeDetectorStatus = {}));
895
- /**
896
- * Reports whether a given strategy is currently the default for change detection.
897
- * @param changeDetectionStrategy The strategy to check.
898
- * @returns True if the given strategy is the current default, false otherwise.
899
- * @see `ChangeDetectorStatus`
900
- * @see `ChangeDetectorRef`
901
- */
902
- function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
903
- return changeDetectionStrategy == null ||
904
- changeDetectionStrategy === ChangeDetectionStrategy.Default;
905
- }
906
860
 
907
861
  /**
908
862
  * Defines the CSS styles encapsulation policies for the {@link Component} decorator's
@@ -1338,6 +1292,7 @@ const QUERIES = 19;
1338
1292
  const ID = 20;
1339
1293
  const EMBEDDED_VIEW_INJECTOR = 21;
1340
1294
  const ON_DESTROY_HOOKS = 22;
1295
+ const HYDRATION = 23;
1341
1296
  /**
1342
1297
  * Size of LView's header. Necessary to adjust for it when setting slots.
1343
1298
  *
@@ -1345,7 +1300,7 @@ const ON_DESTROY_HOOKS = 22;
1345
1300
  * instruction index into `LView` index. All other indexes should be in the `LView` index space and
1346
1301
  * there should be no need to refer to `HEADER_OFFSET` anywhere else.
1347
1302
  */
1348
- const HEADER_OFFSET = 23;
1303
+ const HEADER_OFFSET = 24;
1349
1304
  // Note: This hack is necessary so we don't erroneously get a circular dependency
1350
1305
  // failure based on types.
1351
1306
  const unusedValueExportToPlacateAjd$3 = 1;
@@ -1796,6 +1751,7 @@ function storeLViewOnDestroy(lView, onDestroyCallback) {
1796
1751
  const instructionState = {
1797
1752
  lFrame: createLFrame(null),
1798
1753
  bindingsEnabled: true,
1754
+ skipHydrationRootTNode: null,
1799
1755
  };
1800
1756
  /**
1801
1757
  * In this mode, any changes in bindings will throw an ExpressionChangedAfterChecked error.
@@ -1826,6 +1782,21 @@ function decreaseElementDepthCount() {
1826
1782
  function getBindingsEnabled() {
1827
1783
  return instructionState.bindingsEnabled;
1828
1784
  }
1785
+ /**
1786
+ * Returns true if currently inside a skip hydration block.
1787
+ * @returns boolean
1788
+ */
1789
+ function isInSkipHydrationBlock() {
1790
+ return instructionState.skipHydrationRootTNode !== null;
1791
+ }
1792
+ /**
1793
+ * Returns true if this is the root TNode of the skip hydration block.
1794
+ * @param tNode the current TNode
1795
+ * @returns boolean
1796
+ */
1797
+ function isSkipHydrationRootTNode(tNode) {
1798
+ return instructionState.skipHydrationRootTNode === tNode;
1799
+ }
1829
1800
  /**
1830
1801
  * Enables directive matching on elements.
1831
1802
  *
@@ -1848,6 +1819,13 @@ function getBindingsEnabled() {
1848
1819
  function ɵɵenableBindings() {
1849
1820
  instructionState.bindingsEnabled = true;
1850
1821
  }
1822
+ /**
1823
+ * Sets a flag to specify that the TNode is in a skip hydration block.
1824
+ * @param tNode the current TNode
1825
+ */
1826
+ function enterSkipHydrationBlock(tNode) {
1827
+ instructionState.skipHydrationRootTNode = tNode;
1828
+ }
1851
1829
  /**
1852
1830
  * Disables directive matching on element.
1853
1831
  *
@@ -1870,6 +1848,12 @@ function ɵɵenableBindings() {
1870
1848
  function ɵɵdisableBindings() {
1871
1849
  instructionState.bindingsEnabled = false;
1872
1850
  }
1851
+ /**
1852
+ * Clears the root skip hydration node when leaving a skip hydration block.
1853
+ */
1854
+ function leaveSkipHydrationBlock() {
1855
+ instructionState.skipHydrationRootTNode = null;
1856
+ }
1873
1857
  /**
1874
1858
  * Return the current `LView`.
1875
1859
  */
@@ -2294,6 +2278,21 @@ function namespaceHTMLInternal() {
2294
2278
  function getNamespace$1() {
2295
2279
  return instructionState.lFrame.currentNamespace;
2296
2280
  }
2281
+ let _wasLastNodeCreated = true;
2282
+ /**
2283
+ * Retrieves a global flag that indicates whether the most recent DOM node
2284
+ * was created or hydrated.
2285
+ */
2286
+ function wasLastNodeCreated() {
2287
+ return _wasLastNodeCreated;
2288
+ }
2289
+ /**
2290
+ * Sets a global flag to indicate whether the most recent DOM node
2291
+ * was created or hydrated.
2292
+ */
2293
+ function lastNodeWasCreated(flag) {
2294
+ _wasLastNodeCreated = flag;
2295
+ }
2297
2296
 
2298
2297
  /**
2299
2298
  * Adds all directive lifecycle hooks from the given `DirectiveDef` to the given `TView`.
@@ -6318,6 +6317,17 @@ function nativeRemoveNode(renderer, rNode, isHostElement) {
6318
6317
  nativeRemoveChild(renderer, nativeParent, rNode, isHostElement);
6319
6318
  }
6320
6319
  }
6320
+ /**
6321
+ * Removes the contents of a given RElement using a given renderer.
6322
+ *
6323
+ * @param renderer A renderer to be used
6324
+ * @param rElement the native RElement to be cleared
6325
+ */
6326
+ function clearElementContents(renderer, rElement) {
6327
+ while (rElement.firstChild) {
6328
+ nativeRemoveChild(renderer, rElement, rElement.firstChild, false);
6329
+ }
6330
+ }
6321
6331
  /**
6322
6332
  * Performs the operation of `action` on the node. Typically this involves inserting or removing
6323
6333
  * nodes on the LView or projection boundary.
@@ -8222,176 +8232,501 @@ function forEachSingleProvider(providers, fn) {
8222
8232
  }
8223
8233
 
8224
8234
  /**
8225
- * Represents a component created by a `ComponentFactory`.
8226
- * Provides access to the component instance and related objects,
8227
- * and provides the means of destroying the instance.
8235
+ * A [DI token](guide/glossary#di-token "DI token definition") representing a unique string ID, used
8236
+ * primarily for prefixing application attributes and CSS styles when
8237
+ * {@link ViewEncapsulation#Emulated ViewEncapsulation.Emulated} is being used.
8238
+ *
8239
+ * BY default, the value is randomly generated and assigned to the application by Angular.
8240
+ * To provide a custom ID value, use a DI provider <!-- TODO: provider --> to configure
8241
+ * the root {@link Injector} that uses this token.
8228
8242
  *
8229
8243
  * @publicApi
8230
8244
  */
8231
- class ComponentRef$1 {
8245
+ const APP_ID = new InjectionToken('AppId', {
8246
+ providedIn: 'root',
8247
+ factory: _appIdRandomProviderFactory,
8248
+ });
8249
+ function _appIdRandomProviderFactory() {
8250
+ return `${_randomChar()}${_randomChar()}${_randomChar()}`;
8232
8251
  }
8233
8252
  /**
8234
- * Base class for a factory that can create a component dynamically.
8235
- * Instantiate a factory for a given type of component with `resolveComponentFactory()`.
8236
- * Use the resulting `ComponentFactory.create()` method to create a component of that type.
8237
- *
8238
- * @see [Dynamic Components](guide/dynamic-component-loader)
8239
- *
8253
+ * Providers that generate a random `APP_ID_TOKEN`.
8240
8254
  * @publicApi
8241
- *
8242
- * @deprecated Angular no longer requires Component factories. Please use other APIs where
8243
- * Component class can be used directly.
8244
8255
  */
8245
- class ComponentFactory$1 {
8246
- }
8247
-
8248
- function noComponentFactoryError(component) {
8249
- const error = Error(`No component factory found for ${stringify(component)}. Did you add it to @NgModule.entryComponents?`);
8250
- error[ERROR_COMPONENT] = component;
8251
- return error;
8252
- }
8253
- const ERROR_COMPONENT = 'ngComponent';
8254
- function getComponent$1(error) {
8255
- return error[ERROR_COMPONENT];
8256
- }
8257
- class _NullComponentFactoryResolver {
8258
- resolveComponentFactory(component) {
8259
- throw noComponentFactoryError(component);
8260
- }
8256
+ const APP_ID_RANDOM_PROVIDER = {
8257
+ provide: APP_ID,
8258
+ useFactory: _appIdRandomProviderFactory,
8259
+ deps: [],
8260
+ };
8261
+ function _randomChar() {
8262
+ return String.fromCharCode(97 + Math.floor(Math.random() * 25));
8261
8263
  }
8262
8264
  /**
8263
- * A simple registry that maps `Components` to generated `ComponentFactory` classes
8264
- * that can be used to create instances of components.
8265
- * Use to obtain the factory for a given component type,
8266
- * then use the factory's `create()` method to create a component of that type.
8267
- *
8268
- * Note: since v13, dynamic component creation via
8269
- * [`ViewContainerRef.createComponent`](api/core/ViewContainerRef#createComponent)
8270
- * does **not** require resolving component factory: component class can be used directly.
8271
- *
8265
+ * A function that is executed when a platform is initialized.
8272
8266
  * @publicApi
8273
- *
8274
- * @deprecated Angular no longer requires Component factories. Please use other APIs where
8275
- * Component class can be used directly.
8276
8267
  */
8277
- class ComponentFactoryResolver$1 {
8278
- }
8279
- ComponentFactoryResolver$1.NULL = ( /* @__PURE__ */new _NullComponentFactoryResolver());
8280
-
8268
+ const PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
8281
8269
  /**
8282
- * Creates an ElementRef from the most recent node.
8283
- *
8284
- * @returns The ElementRef instance to use
8270
+ * A token that indicates an opaque platform ID.
8271
+ * @publicApi
8285
8272
  */
8286
- function injectElementRef() {
8287
- return createElementRef(getCurrentTNode(), getLView());
8288
- }
8273
+ const PLATFORM_ID = new InjectionToken('Platform ID', {
8274
+ providedIn: 'platform',
8275
+ factory: () => 'unknown', // set a default platform name, when none set explicitly
8276
+ });
8289
8277
  /**
8290
- * Creates an ElementRef given a node.
8291
- *
8292
- * @param tNode The node for which you'd like an ElementRef
8293
- * @param lView The view to which the node belongs
8294
- * @returns The ElementRef instance to use
8278
+ * A [DI token](guide/glossary#di-token "DI token definition") that indicates the root directory of
8279
+ * the application
8280
+ * @publicApi
8295
8281
  */
8296
- function createElementRef(tNode, lView) {
8297
- return new ElementRef(getNativeByTNode(tNode, lView));
8298
- }
8282
+ const PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
8283
+ // We keep this token here, rather than the animations package, so that modules that only care
8284
+ // about which animations module is loaded (e.g. the CDK) can retrieve it without having to
8285
+ // include extra dependencies. See #44970 for more context.
8299
8286
  /**
8300
- * A wrapper around a native element inside of a View.
8301
- *
8302
- * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
8303
- * element.
8304
- *
8305
- * @security Permitting direct access to the DOM can make your application more vulnerable to
8306
- * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
8307
- * [Security Guide](https://g.co/ng/security).
8308
- *
8287
+ * A [DI token](guide/glossary#di-token "DI token definition") that indicates which animations
8288
+ * module has been loaded.
8309
8289
  * @publicApi
8310
8290
  */
8311
- // Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
8312
- // i.e. users have to ask for what they need. With that, we can build better analysis tools
8313
- // and could do better codegen in the future.
8314
- class ElementRef {
8315
- constructor(nativeElement) {
8316
- this.nativeElement = nativeElement;
8317
- }
8291
+ const ANIMATION_MODULE_TYPE = new InjectionToken('AnimationModuleType');
8292
+
8293
+ function escapeTransferStateContent(text) {
8294
+ const escapedText = {
8295
+ '&': '&a;',
8296
+ '"': '&q;',
8297
+ '\'': '&s;',
8298
+ '<': '&l;',
8299
+ '>': '&g;',
8300
+ };
8301
+ return text.replace(/[&"'<>]/g, s => escapedText[s]);
8318
8302
  }
8319
- /**
8320
- * @internal
8321
- * @nocollapse
8322
- */
8323
- ElementRef.__NG_ELEMENT_ID__ = injectElementRef;
8324
- /**
8325
- * Unwraps `ElementRef` and return the `nativeElement`.
8326
- *
8327
- * @param value value to unwrap
8328
- * @returns `nativeElement` if `ElementRef` otherwise returns value as is.
8329
- */
8330
- function unwrapElementRef(value) {
8331
- return value instanceof ElementRef ? value.nativeElement : value;
8303
+ function unescapeTransferStateContent(text) {
8304
+ const unescapedText = {
8305
+ '&a;': '&',
8306
+ '&q;': '"',
8307
+ '&s;': '\'',
8308
+ '&l;': '<',
8309
+ '&g;': '>',
8310
+ };
8311
+ return text.replace(/&[^;]+;/g, s => unescapedText[s]);
8332
8312
  }
8333
-
8334
8313
  /**
8335
- * Creates and initializes a custom renderer that implements the `Renderer2` base class.
8314
+ * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
8336
8315
  *
8337
- * @publicApi
8338
- */
8339
- class RendererFactory2 {
8340
- }
8341
- /**
8342
- * Extend this base class to implement custom rendering. By default, Angular
8343
- * renders a template into DOM. You can use custom rendering to intercept
8344
- * rendering calls, or to render to something other than DOM.
8316
+ * Example:
8345
8317
  *
8346
- * Create your custom renderer using `RendererFactory2`.
8318
+ * ```
8319
+ * const COUNTER_KEY = makeStateKey<number>('counter');
8320
+ * let value = 10;
8347
8321
  *
8348
- * Use a custom renderer to bypass Angular's templating and
8349
- * make custom UI changes that can't be expressed declaratively.
8350
- * For example if you need to set a property or an attribute whose name is
8351
- * not statically known, use the `setProperty()` or
8352
- * `setAttribute()` method.
8322
+ * transferState.set(COUNTER_KEY, value);
8323
+ * ```
8353
8324
  *
8354
8325
  * @publicApi
8355
8326
  */
8356
- class Renderer2 {
8327
+ function makeStateKey(key) {
8328
+ return key;
8357
8329
  }
8358
- /**
8359
- * @internal
8360
- * @nocollapse
8361
- */
8362
- Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
8363
- /** Injects a Renderer2 for the current component. */
8364
- function injectRenderer2() {
8365
- // We need the Renderer to be based on the component that it's being injected into, however since
8366
- // DI happens before we've entered its view, `getLView` will return the parent view instead.
8367
- const lView = getLView();
8368
- const tNode = getCurrentTNode();
8369
- const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
8370
- return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
8330
+ function initTransferState() {
8331
+ const transferState = new TransferState();
8332
+ transferState.store = retrieveTransferredState(getDocument(), inject(APP_ID));
8333
+ return transferState;
8371
8334
  }
8372
-
8373
8335
  /**
8374
- * Sanitizer is used by the views to sanitize potentially dangerous values.
8336
+ * A key value store that is transferred from the application on the server side to the application
8337
+ * on the client side.
8375
8338
  *
8376
- * @publicApi
8377
- */
8378
- class Sanitizer {
8379
- }
8380
- /** @nocollapse */
8381
- Sanitizer.ɵprov = ɵɵdefineInjectable({
8382
- token: Sanitizer,
8383
- providedIn: 'root',
8384
- factory: () => null,
8385
- });
8386
-
8387
- /**
8388
- * @description Represents the version of Angular
8339
+ * The `TransferState` is available as an injectable token.
8340
+ * On the client, just inject this token using DI and use it, it will be lazily initialized.
8341
+ * On the server it's already included if `renderApplication` function is used. Otherwise, import
8342
+ * the `ServerTransferStateModule` module to make the `TransferState` available.
8343
+ *
8344
+ * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
8345
+ * boolean, number, string, null and non-class objects will be serialized and deserialized in a
8346
+ * non-lossy manner.
8389
8347
  *
8390
8348
  * @publicApi
8391
8349
  */
8392
- class Version {
8393
- constructor(full) {
8394
- this.full = full;
8350
+ class TransferState {
8351
+ constructor() {
8352
+ /** @internal */
8353
+ this.store = {};
8354
+ this.onSerializeCallbacks = {};
8355
+ }
8356
+ /**
8357
+ * Get the value corresponding to a key. Return `defaultValue` if key is not found.
8358
+ */
8359
+ get(key, defaultValue) {
8360
+ return this.store[key] !== undefined ? this.store[key] : defaultValue;
8361
+ }
8362
+ /**
8363
+ * Set the value corresponding to a key.
8364
+ */
8365
+ set(key, value) {
8366
+ this.store[key] = value;
8367
+ }
8368
+ /**
8369
+ * Remove a key from the store.
8370
+ */
8371
+ remove(key) {
8372
+ delete this.store[key];
8373
+ }
8374
+ /**
8375
+ * Test whether a key exists in the store.
8376
+ */
8377
+ hasKey(key) {
8378
+ return this.store.hasOwnProperty(key);
8379
+ }
8380
+ /**
8381
+ * Indicates whether the state is empty.
8382
+ */
8383
+ get isEmpty() {
8384
+ return Object.keys(this.store).length === 0;
8385
+ }
8386
+ /**
8387
+ * Register a callback to provide the value for a key when `toJson` is called.
8388
+ */
8389
+ onSerialize(key, callback) {
8390
+ this.onSerializeCallbacks[key] = callback;
8391
+ }
8392
+ /**
8393
+ * Serialize the current state of the store to JSON.
8394
+ */
8395
+ toJson() {
8396
+ // Call the onSerialize callbacks and put those values into the store.
8397
+ for (const key in this.onSerializeCallbacks) {
8398
+ if (this.onSerializeCallbacks.hasOwnProperty(key)) {
8399
+ try {
8400
+ this.store[key] = this.onSerializeCallbacks[key]();
8401
+ }
8402
+ catch (e) {
8403
+ console.warn('Exception in onSerialize callback: ', e);
8404
+ }
8405
+ }
8406
+ }
8407
+ return JSON.stringify(this.store);
8408
+ }
8409
+ }
8410
+ /** @nocollapse */
8411
+ TransferState.ɵprov =
8412
+ /** @pureOrBreakMyCode */ ɵɵdefineInjectable({
8413
+ token: TransferState,
8414
+ providedIn: 'root',
8415
+ factory: initTransferState,
8416
+ });
8417
+ function retrieveTransferredState(doc, appId) {
8418
+ // Locate the script tag with the JSON data transferred from the server.
8419
+ // The id of the script tag is set to the Angular appId + 'state'.
8420
+ const script = doc.getElementById(appId + '-state');
8421
+ let initialState = {};
8422
+ if (script && script.textContent) {
8423
+ try {
8424
+ // Avoid using any here as it triggers lint errors in google3 (any is not allowed).
8425
+ initialState = JSON.parse(unescapeTransferStateContent(script.textContent));
8426
+ }
8427
+ catch (e) {
8428
+ console.warn('Exception while restoring TransferState for app ' + appId, e);
8429
+ }
8430
+ }
8431
+ return initialState;
8432
+ }
8433
+
8434
+ /* Represents a key in NghDom that holds information about <ng-container>s. */
8435
+ const ELEMENT_CONTAINERS = 'e';
8436
+
8437
+ /**
8438
+ * The name of the key used in the TransferState collection,
8439
+ * where hydration information is located.
8440
+ */
8441
+ const TRANSFER_STATE_TOKEN_ID = '__ɵnghData__';
8442
+ /**
8443
+ * Lookup key used to reference DOM hydration data (ngh) in `TransferState`.
8444
+ */
8445
+ const NGH_DATA_KEY = makeStateKey(TRANSFER_STATE_TOKEN_ID);
8446
+ /**
8447
+ * The name of the attribute that would be added to host component
8448
+ * nodes and contain a reference to a particular slot in transferred
8449
+ * state that contains the necessary hydration info for this component.
8450
+ */
8451
+ const NGH_ATTR_NAME = 'ngh';
8452
+ /**
8453
+ * Reference to a function that reads `ngh` attribute value from a given RNode
8454
+ * and retrieves hydration information from the TransferState using that value
8455
+ * as an index. Returns `null` by default, when hydration is not enabled.
8456
+ *
8457
+ * @param rNode Component's host element.
8458
+ * @param injector Injector that this component has access to.
8459
+ */
8460
+ let _retrieveHydrationInfoImpl = (rNode, injector) => null;
8461
+ function retrieveHydrationInfoImpl(rNode, injector) {
8462
+ var _a;
8463
+ const nghAttrValue = rNode.getAttribute(NGH_ATTR_NAME);
8464
+ if (nghAttrValue == null)
8465
+ return null;
8466
+ let data = {};
8467
+ // An element might have an empty `ngh` attribute value (e.g. `<comp ngh="" />`),
8468
+ // which means that no special annotations are required. Do not attempt to read
8469
+ // from the TransferState in this case.
8470
+ if (nghAttrValue !== '') {
8471
+ const transferState = injector.get(TransferState, null, { optional: true });
8472
+ if (transferState !== null) {
8473
+ const nghData = transferState.get(NGH_DATA_KEY, []);
8474
+ // The nghAttrValue is always a number referencing an index
8475
+ // in the hydration TransferState data.
8476
+ data = nghData[Number(nghAttrValue)];
8477
+ // If the `ngh` attribute exists and has a non-empty value,
8478
+ // the hydration info *must* be present in the TransferState.
8479
+ // If there is no data for some reasons, this is an error.
8480
+ ngDevMode && assertDefined(data, 'Unable to retrieve hydration info from the TransferState.');
8481
+ }
8482
+ }
8483
+ const dehydratedView = {
8484
+ data,
8485
+ firstChild: (_a = rNode.firstChild) !== null && _a !== void 0 ? _a : null,
8486
+ };
8487
+ // The `ngh` attribute is cleared from the DOM node now
8488
+ // that the data has been retrieved.
8489
+ rNode.removeAttribute(NGH_ATTR_NAME);
8490
+ // Note: don't check whether this node was claimed for hydration,
8491
+ // because this node might've been previously claimed while processing
8492
+ // template instructions.
8493
+ ngDevMode && markRNodeAsClaimedByHydration(rNode, /* checkIfAlreadyClaimed */ false);
8494
+ ngDevMode && ngDevMode.hydratedComponents++;
8495
+ return dehydratedView;
8496
+ }
8497
+ /**
8498
+ * Sets the implementation for the `retrieveNghInfo` function.
8499
+ */
8500
+ function enableRetrieveHydrationInfoImpl() {
8501
+ _retrieveHydrationInfoImpl = retrieveHydrationInfoImpl;
8502
+ }
8503
+ /**
8504
+ * Retrieves hydration info by reading the value from the `ngh` attribute
8505
+ * and accessing a corresponding slot in TransferState storage.
8506
+ */
8507
+ function retrieveHydrationInfo(rNode, injector) {
8508
+ return _retrieveHydrationInfoImpl(rNode, injector);
8509
+ }
8510
+ /**
8511
+ * Retrieves an instance of a component LView from a given ViewRef.
8512
+ * Returns an instance of a component LView or `null` in case of an embedded view.
8513
+ */
8514
+ function getComponentLViewForHydration(viewRef) {
8515
+ // Reading an internal field from `ViewRef` instance.
8516
+ let lView = viewRef._lView;
8517
+ const tView = lView[TVIEW];
8518
+ // A registered ViewRef might represent an instance of an
8519
+ // embedded view, in which case we do not need to annotate it.
8520
+ if (tView.type === 2 /* TViewType.Embedded */) {
8521
+ return null;
8522
+ }
8523
+ // Check if it's a root view and if so, retrieve component's
8524
+ // LView from the first slot after the header.
8525
+ if (isRootView(lView)) {
8526
+ lView = lView[HEADER_OFFSET];
8527
+ }
8528
+ return lView;
8529
+ }
8530
+ /**
8531
+ * Marks a node as "claimed" by hydration process.
8532
+ * This is needed to make assessments in tests whether
8533
+ * the hydration process handled all nodes.
8534
+ */
8535
+ function markRNodeAsClaimedByHydration(node, checkIfAlreadyClaimed = true) {
8536
+ if (!ngDevMode) {
8537
+ throw new Error('Calling `markRNodeAsClaimedByHydration` in prod mode ' +
8538
+ 'is not supported and likely a mistake.');
8539
+ }
8540
+ if (checkIfAlreadyClaimed && isRNodeClaimedForHydration(node)) {
8541
+ throw new Error('Trying to claim a node, which was claimed already.');
8542
+ }
8543
+ node.__claimed = true;
8544
+ ngDevMode.hydratedNodes++;
8545
+ }
8546
+ function isRNodeClaimedForHydration(node) {
8547
+ return !!node.__claimed;
8548
+ }
8549
+ function storeNgContainerInfo(hydrationInfo, index, firstChild) {
8550
+ var _a;
8551
+ (_a = hydrationInfo.ngContainers) !== null && _a !== void 0 ? _a : (hydrationInfo.ngContainers = {});
8552
+ hydrationInfo.ngContainers[index] = { firstChild };
8553
+ }
8554
+ function getNgContainerSize(hydrationInfo, index) {
8555
+ var _a, _b;
8556
+ return (_b = (_a = hydrationInfo.data[ELEMENT_CONTAINERS]) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : null;
8557
+ }
8558
+
8559
+ /**
8560
+ * Represents a component created by a `ComponentFactory`.
8561
+ * Provides access to the component instance and related objects,
8562
+ * and provides the means of destroying the instance.
8563
+ *
8564
+ * @publicApi
8565
+ */
8566
+ class ComponentRef$1 {
8567
+ }
8568
+ /**
8569
+ * Base class for a factory that can create a component dynamically.
8570
+ * Instantiate a factory for a given type of component with `resolveComponentFactory()`.
8571
+ * Use the resulting `ComponentFactory.create()` method to create a component of that type.
8572
+ *
8573
+ * @see [Dynamic Components](guide/dynamic-component-loader)
8574
+ *
8575
+ * @publicApi
8576
+ *
8577
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
8578
+ * Component class can be used directly.
8579
+ */
8580
+ class ComponentFactory$1 {
8581
+ }
8582
+
8583
+ function noComponentFactoryError(component) {
8584
+ const error = Error(`No component factory found for ${stringify(component)}. Did you add it to @NgModule.entryComponents?`);
8585
+ error[ERROR_COMPONENT] = component;
8586
+ return error;
8587
+ }
8588
+ const ERROR_COMPONENT = 'ngComponent';
8589
+ function getComponent$1(error) {
8590
+ return error[ERROR_COMPONENT];
8591
+ }
8592
+ class _NullComponentFactoryResolver {
8593
+ resolveComponentFactory(component) {
8594
+ throw noComponentFactoryError(component);
8595
+ }
8596
+ }
8597
+ /**
8598
+ * A simple registry that maps `Components` to generated `ComponentFactory` classes
8599
+ * that can be used to create instances of components.
8600
+ * Use to obtain the factory for a given component type,
8601
+ * then use the factory's `create()` method to create a component of that type.
8602
+ *
8603
+ * Note: since v13, dynamic component creation via
8604
+ * [`ViewContainerRef.createComponent`](api/core/ViewContainerRef#createComponent)
8605
+ * does **not** require resolving component factory: component class can be used directly.
8606
+ *
8607
+ * @publicApi
8608
+ *
8609
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
8610
+ * Component class can be used directly.
8611
+ */
8612
+ class ComponentFactoryResolver$1 {
8613
+ }
8614
+ ComponentFactoryResolver$1.NULL = ( /* @__PURE__ */new _NullComponentFactoryResolver());
8615
+
8616
+ /**
8617
+ * Creates an ElementRef from the most recent node.
8618
+ *
8619
+ * @returns The ElementRef instance to use
8620
+ */
8621
+ function injectElementRef() {
8622
+ return createElementRef(getCurrentTNode(), getLView());
8623
+ }
8624
+ /**
8625
+ * Creates an ElementRef given a node.
8626
+ *
8627
+ * @param tNode The node for which you'd like an ElementRef
8628
+ * @param lView The view to which the node belongs
8629
+ * @returns The ElementRef instance to use
8630
+ */
8631
+ function createElementRef(tNode, lView) {
8632
+ return new ElementRef(getNativeByTNode(tNode, lView));
8633
+ }
8634
+ /**
8635
+ * A wrapper around a native element inside of a View.
8636
+ *
8637
+ * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
8638
+ * element.
8639
+ *
8640
+ * @security Permitting direct access to the DOM can make your application more vulnerable to
8641
+ * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
8642
+ * [Security Guide](https://g.co/ng/security).
8643
+ *
8644
+ * @publicApi
8645
+ */
8646
+ // Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
8647
+ // i.e. users have to ask for what they need. With that, we can build better analysis tools
8648
+ // and could do better codegen in the future.
8649
+ class ElementRef {
8650
+ constructor(nativeElement) {
8651
+ this.nativeElement = nativeElement;
8652
+ }
8653
+ }
8654
+ /**
8655
+ * @internal
8656
+ * @nocollapse
8657
+ */
8658
+ ElementRef.__NG_ELEMENT_ID__ = injectElementRef;
8659
+ /**
8660
+ * Unwraps `ElementRef` and return the `nativeElement`.
8661
+ *
8662
+ * @param value value to unwrap
8663
+ * @returns `nativeElement` if `ElementRef` otherwise returns value as is.
8664
+ */
8665
+ function unwrapElementRef(value) {
8666
+ return value instanceof ElementRef ? value.nativeElement : value;
8667
+ }
8668
+
8669
+ /**
8670
+ * Creates and initializes a custom renderer that implements the `Renderer2` base class.
8671
+ *
8672
+ * @publicApi
8673
+ */
8674
+ class RendererFactory2 {
8675
+ }
8676
+ /**
8677
+ * Extend this base class to implement custom rendering. By default, Angular
8678
+ * renders a template into DOM. You can use custom rendering to intercept
8679
+ * rendering calls, or to render to something other than DOM.
8680
+ *
8681
+ * Create your custom renderer using `RendererFactory2`.
8682
+ *
8683
+ * Use a custom renderer to bypass Angular's templating and
8684
+ * make custom UI changes that can't be expressed declaratively.
8685
+ * For example if you need to set a property or an attribute whose name is
8686
+ * not statically known, use the `setProperty()` or
8687
+ * `setAttribute()` method.
8688
+ *
8689
+ * @publicApi
8690
+ */
8691
+ class Renderer2 {
8692
+ }
8693
+ /**
8694
+ * @internal
8695
+ * @nocollapse
8696
+ */
8697
+ Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
8698
+ /** Injects a Renderer2 for the current component. */
8699
+ function injectRenderer2() {
8700
+ // We need the Renderer to be based on the component that it's being injected into, however since
8701
+ // DI happens before we've entered its view, `getLView` will return the parent view instead.
8702
+ const lView = getLView();
8703
+ const tNode = getCurrentTNode();
8704
+ const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
8705
+ return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
8706
+ }
8707
+
8708
+ /**
8709
+ * Sanitizer is used by the views to sanitize potentially dangerous values.
8710
+ *
8711
+ * @publicApi
8712
+ */
8713
+ class Sanitizer {
8714
+ }
8715
+ /** @nocollapse */
8716
+ Sanitizer.ɵprov = ɵɵdefineInjectable({
8717
+ token: Sanitizer,
8718
+ providedIn: 'root',
8719
+ factory: () => null,
8720
+ });
8721
+
8722
+ /**
8723
+ * @description Represents the version of Angular
8724
+ *
8725
+ * @publicApi
8726
+ */
8727
+ class Version {
8728
+ constructor(full) {
8729
+ this.full = full;
8395
8730
  this.major = full.split('.')[0];
8396
8731
  this.minor = full.split('.')[1];
8397
8732
  this.patch = full.split('.').slice(2).join('.');
@@ -8400,7 +8735,7 @@ class Version {
8400
8735
  /**
8401
8736
  * @publicApi
8402
8737
  */
8403
- const VERSION = new Version('16.0.0-next.1');
8738
+ const VERSION = new Version('16.0.0-next.2');
8404
8739
 
8405
8740
  // This default value is when checking the hierarchy for a token.
8406
8741
  //
@@ -8481,6 +8816,23 @@ class ErrorHandler {
8481
8816
  }
8482
8817
  }
8483
8818
 
8819
+ const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
8820
+ /**
8821
+ * Internal token that specifies whether hydration is enabled.
8822
+ */
8823
+ const IS_HYDRATION_FEATURE_ENABLED = new InjectionToken(NG_DEV_MODE$1 ? 'IS_HYDRATION_FEATURE_ENABLED' : '');
8824
+ // By default (in client rendering mode), we remove all the contents
8825
+ // of the host element and render an application after that.
8826
+ const PRESERVE_HOST_CONTENT_DEFAULT = false;
8827
+ /**
8828
+ * Internal token that indicates whether host element content should be
8829
+ * retained during the bootstrap.
8830
+ */
8831
+ const PRESERVE_HOST_CONTENT = new InjectionToken(NG_DEV_MODE$1 ? 'PRESERVE_HOST_CONTENT' : '', {
8832
+ providedIn: 'root',
8833
+ factory: () => PRESERVE_HOST_CONTENT_DEFAULT,
8834
+ });
8835
+
8484
8836
  function normalizeDebugBindingName(name) {
8485
8837
  // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
8486
8838
  name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
@@ -10180,7 +10532,7 @@ function renderChildComponents(hostLView, components) {
10180
10532
  renderComponent(hostLView, components[i]);
10181
10533
  }
10182
10534
  }
10183
- function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector, embeddedViewInjector) {
10535
+ function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector, embeddedViewInjector, hydrationInfo) {
10184
10536
  const lView = tView.blueprint.slice();
10185
10537
  lView[HOST] = host;
10186
10538
  lView[FLAGS] = flags | 4 /* LViewFlags.CreationMode */ | 64 /* LViewFlags.Attached */ | 8 /* LViewFlags.FirstLViewPass */;
@@ -10200,6 +10552,7 @@ function createLView(parentLView, tView, context, flags, host, tHostNode, render
10200
10552
  lView[INJECTOR$1] = injector || parentLView && parentLView[INJECTOR$1] || null;
10201
10553
  lView[T_HOST] = tHostNode;
10202
10554
  lView[ID] = getUniqueLViewId();
10555
+ lView[HYDRATION] = hydrationInfo;
10203
10556
  lView[EMBEDDED_VIEW_INJECTOR] = embeddedViewInjector;
10204
10557
  ngDevMode &&
10205
10558
  assertEqual(tView.type == 2 /* TViewType.Embedded */ ? parentLView !== null : true, true, 'Embedded views must have parentLView');
@@ -10641,10 +10994,19 @@ function createViewBlueprint(bindingStartIndex, initialViewLength) {
10641
10994
  * @param rendererFactory Factory function to create renderer instance.
10642
10995
  * @param elementOrSelector Render element or CSS selector to locate the element.
10643
10996
  * @param encapsulation View Encapsulation defined for component that requests host element.
10644
- */
10645
- function locateHostElement(renderer, elementOrSelector, encapsulation) {
10646
- // When using native Shadow DOM, do not clear host element to allow native slot projection
10647
- const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
10997
+ * @param injector Root view injector instance.
10998
+ */
10999
+ function locateHostElement(renderer, elementOrSelector, encapsulation, injector) {
11000
+ // Note: we use default value for the `PRESERVE_HOST_CONTENT` here even though it's a
11001
+ // tree-shakable one (providedIn:'root'). This code path can be triggered during dynamic component
11002
+ // creation (after calling ViewContainerRef.createComponent) when an injector instance can be
11003
+ // provided. The injector instance might be disconnected from the main DI tree, thus the
11004
+ // `PRESERVE_HOST_CONTENT` woild not be able to instantiate. In this case, the default value will
11005
+ // be used.
11006
+ const preserveHostContent = injector.get(PRESERVE_HOST_CONTENT, PRESERVE_HOST_CONTENT_DEFAULT);
11007
+ // When using native Shadow DOM, do not clear host element to allow native slot
11008
+ // projection.
11009
+ const preserveContent = preserveHostContent || encapsulation === ViewEncapsulation$1.ShadowDom;
10648
11010
  return renderer.selectRootElement(elementOrSelector, preserveContent);
10649
11011
  }
10650
11012
  /**
@@ -10701,7 +11063,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
10701
11063
  initialInputs: undefined,
10702
11064
  inputs: null,
10703
11065
  outputs: null,
10704
- tViews: null,
11066
+ tView: null,
10705
11067
  next: null,
10706
11068
  prev: null,
10707
11069
  projectionNext: null,
@@ -11245,7 +11607,7 @@ function addComponentLogic(lView, hostTNode, def) {
11245
11607
  // Only component views should be added to the view tree directly. Embedded views are
11246
11608
  // accessed through their containers because they may be removed / re-added later.
11247
11609
  const rendererFactory = lView[RENDERER_FACTORY];
11248
- const componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, native, hostTNode, rendererFactory, rendererFactory.createRenderer(native, def), null, null, null));
11610
+ const componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, native, hostTNode, rendererFactory, rendererFactory.createRenderer(native, def), null, null, null, null));
11249
11611
  // Component view will always be created before any injected LContainers,
11250
11612
  // so this is a regular element, wrap it with the component view
11251
11613
  lView[hostTNode.index] = componentView;
@@ -11490,6 +11852,11 @@ function renderComponent(hostLView, componentHostIdx) {
11490
11852
  const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
11491
11853
  const componentTView = componentView[TVIEW];
11492
11854
  syncViewWithBlueprint(componentTView, componentView);
11855
+ const hostRNode = componentView[HOST];
11856
+ // Populate an LView with hydration info retrieved from the DOM via TransferState.
11857
+ if (hostRNode !== null && componentView[HYDRATION] === null) {
11858
+ componentView[HYDRATION] = retrieveHydrationInfo(hostRNode, componentView[INJECTOR$1]);
11859
+ }
11493
11860
  renderView(componentTView, componentView, componentView[CONTEXT]);
11494
11861
  }
11495
11862
  /**
@@ -12190,13 +12557,13 @@ class ComponentFactory extends ComponentFactory$1 {
12190
12557
  // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
12191
12558
  const elementName = this.componentDef.selectors[0][0] || 'div';
12192
12559
  const hostRNode = rootSelectorOrNode ?
12193
- locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
12560
+ locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation, rootViewInjector) :
12194
12561
  createElementNode(hostRenderer, elementName, getNamespace(elementName));
12195
12562
  const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
12196
12563
  16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
12197
12564
  // Create the root view. Uses empty TView and ContentTemplate.
12198
12565
  const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
12199
- const rootLView = createLView(null, rootTView, null, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
12566
+ const rootLView = createLView(null, rootTView, null, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null, null);
12200
12567
  // rootView is the parent when bootstrapping
12201
12568
  // TODO(misko): it looks like we are entering view here but we don't really need to as
12202
12569
  // `renderView` does that. However as the code is written it is needed because
@@ -12307,7 +12674,7 @@ function createRootComponentTNode(lView, rNode) {
12307
12674
  /**
12308
12675
  * Creates the root component view and the root component node.
12309
12676
  *
12310
- * @param rNode Render host element.
12677
+ * @param hostRNode Render host element.
12311
12678
  * @param rootComponentDef ComponentDef
12312
12679
  * @param rootView The parent view where the host node is stored
12313
12680
  * @param rendererFactory Factory to be used for creating child renderers.
@@ -12316,11 +12683,17 @@ function createRootComponentTNode(lView, rNode) {
12316
12683
  *
12317
12684
  * @returns Component view created
12318
12685
  */
12319
- function createRootComponentView(tNode, rNode, rootComponentDef, rootDirectives, rootView, rendererFactory, hostRenderer, sanitizer) {
12686
+ function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirectives, rootView, rendererFactory, hostRenderer, sanitizer) {
12320
12687
  const tView = rootView[TVIEW];
12321
- applyRootComponentStyling(rootDirectives, tNode, rNode, hostRenderer);
12322
- const viewRenderer = rendererFactory.createRenderer(rNode, rootComponentDef);
12323
- const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, rootComponentDef.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[tNode.index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
12688
+ applyRootComponentStyling(rootDirectives, tNode, hostRNode, hostRenderer);
12689
+ // Hydration info is on the host element and needs to be retreived
12690
+ // and passed to the component LView.
12691
+ let hydrationInfo = null;
12692
+ if (hostRNode !== null) {
12693
+ hydrationInfo = retrieveHydrationInfo(hostRNode, rootView[INJECTOR$1]);
12694
+ }
12695
+ const viewRenderer = rendererFactory.createRenderer(hostRNode, rootComponentDef);
12696
+ const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, rootComponentDef.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[tNode.index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null, hydrationInfo);
12324
12697
  if (tView.firstCreatePass) {
12325
12698
  markAsComponentHost(tView, tNode, rootDirectives.length - 1);
12326
12699
  }
@@ -13482,7 +13855,7 @@ function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, t
13482
13855
  const tNode = getOrCreateTNode(tView, index, 4 /* TNodeType.Container */, tagName || null, getConstant(tViewConsts, attrsIndex));
13483
13856
  resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
13484
13857
  registerPostOrderHooks(tView, tNode);
13485
- const embeddedTView = tNode.tViews = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
13858
+ const embeddedTView = tNode.tView = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
13486
13859
  if (tView.queries !== null) {
13487
13860
  tView.queries.template(tView, tNode);
13488
13861
  embeddedTView.queries = tView.queries.embeddedTView(tNode);
@@ -13552,6 +13925,122 @@ function ɵɵreference(index) {
13552
13925
  return load(contextLView, HEADER_OFFSET + index);
13553
13926
  }
13554
13927
 
13928
+ /**
13929
+ * Verifies whether a given node matches an expected criteria,
13930
+ * based on internal data structure state.
13931
+ */
13932
+ function validateMatchingNode(node, nodeType, tagName, lView, tNode) {
13933
+ if (node.nodeType !== nodeType ||
13934
+ (node.nodeType === Node.ELEMENT_NODE &&
13935
+ node.tagName.toLowerCase() !== (tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase()))) {
13936
+ // TODO: improve error message and use RuntimeError instead.
13937
+ throw new Error(`Unexpected node found during hydration.`);
13938
+ }
13939
+ }
13940
+ /**
13941
+ * Verifies whether next sibling node exists.
13942
+ */
13943
+ function validateSiblingNodeExists(node) {
13944
+ if (!node.nextSibling) {
13945
+ // TODO: improve error message and use RuntimeError instead.
13946
+ throw new Error(`Unexpected state: insufficient number of sibling nodes.`);
13947
+ }
13948
+ }
13949
+
13950
+ /** Whether current TNode is a first node in an <ng-container>. */
13951
+ function isFirstElementInNgContainer(tNode) {
13952
+ var _a;
13953
+ return !tNode.prev && ((_a = tNode.parent) === null || _a === void 0 ? void 0 : _a.type) === 8 /* TNodeType.ElementContainer */;
13954
+ }
13955
+ /** Returns first element from a DOM segment that corresponds to this <ng-container>. */
13956
+ function getDehydratedNgContainer(hydrationInfo, tContainerNode) {
13957
+ var _a;
13958
+ const noOffsetIndex = tContainerNode.index - HEADER_OFFSET;
13959
+ const ngContainer = (_a = hydrationInfo.ngContainers) === null || _a === void 0 ? void 0 : _a[noOffsetIndex];
13960
+ ngDevMode &&
13961
+ assertDefined(ngContainer, 'Unexpected state: no hydration info available for a given TNode, ' +
13962
+ 'which represents an element container.');
13963
+ return ngContainer;
13964
+ }
13965
+ /**
13966
+ * Locate a node in DOM tree that corresponds to a given TNode.
13967
+ *
13968
+ * @param hydrationInfo The hydration annotation data
13969
+ * @param tView the current tView
13970
+ * @param lView the current lView
13971
+ * @param tNode the current tNode
13972
+ * @returns an RNode that represents a given tNode
13973
+ */
13974
+ function locateNextRNode(hydrationInfo, tView, lView, tNode) {
13975
+ var _a, _b;
13976
+ let native = null;
13977
+ if (tView.firstChild === tNode) {
13978
+ // We create a first node in this view, so we use a reference
13979
+ // to the first child in this DOM segment.
13980
+ native = hydrationInfo.firstChild;
13981
+ }
13982
+ else {
13983
+ // Locate a node based on a previous sibling or a parent node.
13984
+ const previousTNodeParent = tNode.prev === null;
13985
+ const previousTNode = ((_a = tNode.prev) !== null && _a !== void 0 ? _a : tNode.parent);
13986
+ ngDevMode &&
13987
+ assertDefined(previousTNode, 'Unexpected state: current TNode does not have a connection ' +
13988
+ 'to the previous node or a parent node.');
13989
+ const previousRElement = getNativeByTNode(previousTNode, lView);
13990
+ if (isFirstElementInNgContainer(tNode)) {
13991
+ const ngContainer = getDehydratedNgContainer(hydrationInfo, tNode.parent);
13992
+ native = (_b = ngContainer.firstChild) !== null && _b !== void 0 ? _b : null;
13993
+ }
13994
+ else {
13995
+ if (previousTNodeParent) {
13996
+ native = previousRElement.firstChild;
13997
+ }
13998
+ else {
13999
+ native = previousRElement.nextSibling;
14000
+ }
14001
+ }
14002
+ }
14003
+ return native;
14004
+ }
14005
+ /**
14006
+ * Skips over a specified number of nodes and returns the next sibling node after that.
14007
+ */
14008
+ function siblingAfter(skip, from) {
14009
+ let currentNode = from;
14010
+ for (let i = 0; i < skip; i++) {
14011
+ ngDevMode && validateSiblingNodeExists(currentNode);
14012
+ currentNode = currentNode.nextSibling;
14013
+ }
14014
+ return currentNode;
14015
+ }
14016
+
14017
+ /**
14018
+ * The name of an attribute that can be added to the hydration boundary node
14019
+ * (component host node) to disable hydration for the content within that boundary.
14020
+ */
14021
+ const SKIP_HYDRATION_ATTR_NAME = 'ngSkipHydration';
14022
+ /**
14023
+ * Helper function to check if a given node has the 'ngSkipHydration' attribute
14024
+ */
14025
+ function hasNgSkipHydrationAttr(tNode) {
14026
+ const SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = SKIP_HYDRATION_ATTR_NAME.toLowerCase();
14027
+ const attrs = tNode.mergedAttrs;
14028
+ if (attrs === null)
14029
+ return false;
14030
+ // only ever look at the attribute name and skip the values
14031
+ for (let i = 0; i < attrs.length; i += 2) {
14032
+ const value = attrs[i];
14033
+ // This is a marker, which means that the static attributes section is over,
14034
+ // so we can exit early.
14035
+ if (typeof value === 'number')
14036
+ return false;
14037
+ if (typeof value === 'string' && value.toLowerCase() === SKIP_HYDRATION_ATTR_NAME_LOWER_CASE) {
14038
+ return true;
14039
+ }
14040
+ }
14041
+ return false;
14042
+ }
14043
+
13555
14044
  /**
13556
14045
  * Update a property on a selected element.
13557
14046
  *
@@ -13636,14 +14125,15 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
13636
14125
  const tNode = tView.firstCreatePass ?
13637
14126
  elementStartFirstCreatePass(adjustedIndex, tView, lView, name, attrsIndex, localRefsIndex) :
13638
14127
  tView.data[adjustedIndex];
13639
- const native = lView[adjustedIndex] = createElementNode(renderer, name, getNamespace$1());
14128
+ const native = _locateOrCreateElementNode(tView, lView, tNode, renderer, name);
14129
+ lView[adjustedIndex] = native;
13640
14130
  const hasDirectives = isDirectiveHost(tNode);
13641
14131
  if (ngDevMode && tView.firstCreatePass) {
13642
14132
  validateElementIsKnown(native, lView, tNode.value, tView.schemas, hasDirectives);
13643
14133
  }
13644
14134
  setCurrentTNode(tNode, true);
13645
14135
  setupStaticAttributes(renderer, native, tNode);
13646
- if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
14136
+ if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */ && wasLastNodeCreated()) {
13647
14137
  // In the i18n case, the translation may have removed this element, so only add it if it is not
13648
14138
  // detached. See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
13649
14139
  appendChild(tView, lView, native, tNode);
@@ -13683,6 +14173,9 @@ function ɵɵelementEnd() {
13683
14173
  }
13684
14174
  const tNode = currentTNode;
13685
14175
  ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */);
14176
+ if (isSkipHydrationRootTNode(tNode)) {
14177
+ leaveSkipHydrationBlock();
14178
+ }
13686
14179
  decreaseElementDepthCount();
13687
14180
  const tView = getTView();
13688
14181
  if (tView.firstCreatePass) {
@@ -13715,6 +14208,40 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
13715
14208
  ɵɵelementEnd();
13716
14209
  return ɵɵelement;
13717
14210
  }
14211
+ let _locateOrCreateElementNode = (tView, lView, tNode, renderer, name) => {
14212
+ lastNodeWasCreated(true);
14213
+ return createElementNode(renderer, name, getNamespace$1());
14214
+ };
14215
+ /**
14216
+ * Enables hydration code path (to lookup existing elements in DOM)
14217
+ * in addition to the regular creation mode of element nodes.
14218
+ */
14219
+ function locateOrCreateElementNodeImpl(tView, lView, tNode, renderer, name) {
14220
+ const hydrationInfo = lView[HYDRATION];
14221
+ const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock();
14222
+ lastNodeWasCreated(isNodeCreationMode);
14223
+ // Regular creation mode.
14224
+ if (isNodeCreationMode) {
14225
+ return createElementNode(renderer, name, getNamespace$1());
14226
+ }
14227
+ // Hydration mode, looking up an existing element in DOM.
14228
+ const native = locateNextRNode(hydrationInfo, tView, lView, tNode);
14229
+ ngDevMode &&
14230
+ validateMatchingNode(native, Node.ELEMENT_NODE, name, lView, tNode);
14231
+ ngDevMode && markRNodeAsClaimedByHydration(native);
14232
+ // Checks if the skip hydration attribute is present during hydration so we know to
14233
+ // skip attempting to hydrate this block.
14234
+ if (hydrationInfo && hasNgSkipHydrationAttr(tNode)) {
14235
+ enterSkipHydrationBlock(tNode);
14236
+ // Since this isn't hydratable, we need to empty the node
14237
+ // so there's no duplicate content after render
14238
+ clearElementContents(renderer, native);
14239
+ }
14240
+ return native;
14241
+ }
14242
+ function enableLocateOrCreateElementNodeImpl() {
14243
+ _locateOrCreateElementNode = locateOrCreateElementNodeImpl;
14244
+ }
13718
14245
 
13719
14246
  function elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, localRefsIndex) {
13720
14247
  ngDevMode && ngDevMode.firstCreatePass++;
@@ -13760,10 +14287,12 @@ function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
13760
14287
  tView.data[adjustedIndex];
13761
14288
  setCurrentTNode(tNode, true);
13762
14289
  ngDevMode && ngDevMode.rendererCreateComment++;
13763
- const native = lView[adjustedIndex] =
13764
- lView[RENDERER].createComment(ngDevMode ? 'ng-container' : '');
13765
- appendChild(tView, lView, native, tNode);
13766
- attachPatchData(native, lView);
14290
+ const comment = _locateOrCreateElementContainerNode(tView, lView, tNode, index);
14291
+ lView[adjustedIndex] = comment;
14292
+ if (wasLastNodeCreated()) {
14293
+ appendChild(tView, lView, comment, tNode);
14294
+ }
14295
+ attachPatchData(comment, lView);
13767
14296
  if (isDirectiveHost(tNode)) {
13768
14297
  createDirectivesInstances(tView, lView, tNode);
13769
14298
  executeContentQueries(tView, tNode, lView);
@@ -13815,6 +14344,46 @@ function ɵɵelementContainer(index, attrsIndex, localRefsIndex) {
13815
14344
  ɵɵelementContainerEnd();
13816
14345
  return ɵɵelementContainer;
13817
14346
  }
14347
+ let _locateOrCreateElementContainerNode = (tView, lView, tNode, index) => {
14348
+ lastNodeWasCreated(true);
14349
+ return createCommentNode(lView[RENDERER], ngDevMode ? 'ng-container' : '');
14350
+ };
14351
+ /**
14352
+ * Enables hydration code path (to lookup existing elements in DOM)
14353
+ * in addition to the regular creation mode of comment nodes that
14354
+ * represent <ng-container>'s anchor.
14355
+ */
14356
+ function locateOrCreateElementContainerNode(tView, lView, tNode, index) {
14357
+ let comment;
14358
+ const hydrationInfo = lView[HYDRATION];
14359
+ const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock();
14360
+ lastNodeWasCreated(isNodeCreationMode);
14361
+ // Regular creation mode.
14362
+ if (isNodeCreationMode) {
14363
+ return createCommentNode(lView[RENDERER], ngDevMode ? 'ng-container' : '');
14364
+ }
14365
+ // Hydration mode, looking up existing elements in DOM.
14366
+ const currentRNode = locateNextRNode(hydrationInfo, tView, lView, tNode);
14367
+ const ngContainerSize = getNgContainerSize(hydrationInfo, index);
14368
+ ngDevMode &&
14369
+ assertNumber(ngContainerSize, 'Unexpected state: hydrating an <ng-container>, ' +
14370
+ 'but no hydration info is available.');
14371
+ if (ngContainerSize > 0) {
14372
+ storeNgContainerInfo(hydrationInfo, index, currentRNode);
14373
+ comment = siblingAfter(ngContainerSize, currentRNode);
14374
+ }
14375
+ else {
14376
+ // If <ng-container> has no nodes,
14377
+ // the current node is an anchor (comment) node.
14378
+ comment = currentRNode;
14379
+ }
14380
+ ngDevMode && validateMatchingNode(comment, Node.COMMENT_NODE, null, lView, tNode);
14381
+ ngDevMode && markRNodeAsClaimedByHydration(comment);
14382
+ return comment;
14383
+ }
14384
+ function enableLocateOrCreateElementContainerNodeImpl() {
14385
+ _locateOrCreateElementContainerNode = locateOrCreateElementContainerNode;
14386
+ }
13818
14387
 
13819
14388
  /**
13820
14389
  * Returns the current OpaqueViewState instance.
@@ -13843,16 +14412,6 @@ function isPromise(obj) {
13843
14412
  function isSubscribable(obj) {
13844
14413
  return !!obj && typeof obj.subscribe === 'function';
13845
14414
  }
13846
- /**
13847
- * Determine if the argument is an Observable
13848
- *
13849
- * Strictly this tests that the `obj` is `Subscribable`, since `Observable`
13850
- * types need additional methods, such as `lift()`. But it is adequate for our
13851
- * needs since within the Angular framework code we only ever need to use the
13852
- * `subscribe()` method, and RxJS has mechanisms to wrap `Subscribable` objects
13853
- * into `Observable` as needed.
13854
- */
13855
- const isObservable = isSubscribable;
13856
14415
 
13857
14416
  /**
13858
14417
  * Adds an event listener to the current node.
@@ -14015,7 +14574,7 @@ function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn,
14015
14574
  const minifiedName = props[i + 1];
14016
14575
  const directiveInstance = lView[index];
14017
14576
  const output = directiveInstance[minifiedName];
14018
- if (ngDevMode && !isObservable(output)) {
14577
+ if (ngDevMode && !isSubscribable(output)) {
14019
14578
  throw new Error(`@Output ${minifiedName} not initialized in '${directiveInstance.constructor.name}'.`);
14020
14579
  }
14021
14580
  const subscription = output.subscribe(listenerFn);
@@ -16159,11 +16718,39 @@ function ɵɵtext(index, value = '') {
16159
16718
  const tNode = tView.firstCreatePass ?
16160
16719
  getOrCreateTNode(tView, adjustedIndex, 1 /* TNodeType.Text */, value, null) :
16161
16720
  tView.data[adjustedIndex];
16162
- const textNative = lView[adjustedIndex] = createTextNode(lView[RENDERER], value);
16163
- appendChild(tView, lView, textNative, tNode);
16721
+ const textNative = _locateOrCreateTextNode(tView, lView, tNode, value);
16722
+ lView[adjustedIndex] = textNative;
16723
+ if (wasLastNodeCreated()) {
16724
+ appendChild(tView, lView, textNative, tNode);
16725
+ }
16164
16726
  // Text nodes are self closing.
16165
16727
  setCurrentTNode(tNode, false);
16166
16728
  }
16729
+ let _locateOrCreateTextNode = (tView, lView, tNode, value) => {
16730
+ lastNodeWasCreated(true);
16731
+ return createTextNode(lView[RENDERER], value);
16732
+ };
16733
+ /**
16734
+ * Enables hydration code path (to lookup existing elements in DOM)
16735
+ * in addition to the regular creation mode of text nodes.
16736
+ */
16737
+ function locateOrCreateTextNodeImpl(tView, lView, tNode, value) {
16738
+ const hydrationInfo = lView[HYDRATION];
16739
+ const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock();
16740
+ lastNodeWasCreated(isNodeCreationMode);
16741
+ // Regular creation mode.
16742
+ if (isNodeCreationMode) {
16743
+ return createTextNode(lView[RENDERER], value);
16744
+ }
16745
+ // Hydration mode, looking up an existing element in DOM.
16746
+ const textNative = locateNextRNode(hydrationInfo, tView, lView, tNode);
16747
+ ngDevMode && validateMatchingNode(textNative, Node.TEXT_NODE, null, lView, tNode);
16748
+ ngDevMode && markRNodeAsClaimedByHydration(textNative);
16749
+ return textNative;
16750
+ }
16751
+ function enableLocateOrCreateTextNodeImpl() {
16752
+ _locateOrCreateTextNode = locateOrCreateTextNodeImpl;
16753
+ }
16167
16754
 
16168
16755
  /**
16169
16756
  *
@@ -17841,7 +18428,7 @@ function getTIcu(tView, index) {
17841
18428
  if (value === null || typeof value === 'string')
17842
18429
  return null;
17843
18430
  if (ngDevMode &&
17844
- !(value.hasOwnProperty('tViews') || value.hasOwnProperty('currentCaseLViewIndex'))) {
18431
+ !(value.hasOwnProperty('tView') || value.hasOwnProperty('currentCaseLViewIndex'))) {
17845
18432
  throwError('We expect to get \'null\'|\'TIcu\'|\'TIcuContainer\', but got: ' + value);
17846
18433
  }
17847
18434
  // Here the `value.hasOwnProperty('currentCaseLViewIndex')` is a polymorphic read as it can be
@@ -17870,7 +18457,7 @@ function getTIcu(tView, index) {
17870
18457
  function setTIcu(tView, index, tIcu) {
17871
18458
  const tNode = tView.data[index];
17872
18459
  ngDevMode &&
17873
- assertEqual(tNode === null || tNode.hasOwnProperty('tViews'), true, 'We expect to get \'null\'|\'TIcuContainer\'');
18460
+ assertEqual(tNode === null || tNode.hasOwnProperty('tView'), true, 'We expect to get \'null\'|\'TIcuContainer\'');
17874
18461
  if (tNode === null) {
17875
18462
  tView.data[index] = tIcu;
17876
18463
  }
@@ -21166,8 +21753,8 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
21166
21753
  this.elementRef = elementRef;
21167
21754
  }
21168
21755
  createEmbeddedView(context, injector) {
21169
- const embeddedTView = this._declarationTContainer.tViews;
21170
- const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* LViewFlags.CheckAlways */, null, embeddedTView.declTNode, null, null, null, null, injector || null);
21756
+ const embeddedTView = this._declarationTContainer.tView;
21757
+ const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* LViewFlags.CheckAlways */, null, embeddedTView.declTNode, null, null, null, null, injector || null, null);
21171
21758
  const declarationLContainer = this._declarationLView[this._declarationTContainer.index];
21172
21759
  ngDevMode && assertLContainer(declarationLContainer);
21173
21760
  embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
@@ -21196,7 +21783,7 @@ function injectTemplateRef() {
21196
21783
  */
21197
21784
  function createTemplateRef(hostTNode, hostLView) {
21198
21785
  if (hostTNode.type & 4 /* TNodeType.Container */) {
21199
- ngDevMode && assertDefined(hostTNode.tViews, 'TView must be allocated');
21786
+ ngDevMode && assertDefined(hostTNode.tView, 'TView must be allocated');
21200
21787
  return new R3TemplateRef(hostLView, hostTNode, createElementRef(hostTNode, hostLView));
21201
21788
  }
21202
21789
  return null;
@@ -22753,7 +23340,7 @@ function compileComponent(type, metadata) {
22753
23340
  // * for NgModule-based components, they're set when the NgModule which declares the
22754
23341
  // component resolves in the module scoping queue
22755
23342
  // * for standalone components, they're set just below, after `compileComponent`.
22756
- declarations: [], changeDetection: metadata.changeDetection, encapsulation, interpolation: metadata.interpolation, viewProviders: metadata.viewProviders || null, isStandalone: !!metadata.standalone });
23343
+ declarations: [], changeDetection: metadata.changeDetection, encapsulation, interpolation: metadata.interpolation, viewProviders: metadata.viewProviders || null });
22757
23344
  compilationDepth++;
22758
23345
  try {
22759
23346
  if (meta.usesInheritance) {
@@ -23278,10 +23865,6 @@ const NgModule = makeDecorator('NgModule', (ngModule) => ngModule, undefined, un
23278
23865
  * to be used by the decorator versions of these annotations.
23279
23866
  */
23280
23867
 
23281
- function noop(...args) {
23282
- // Do nothing.
23283
- }
23284
-
23285
23868
  /*
23286
23869
  * This file exists to support compilation of @angular/core in Ivy mode.
23287
23870
  *
@@ -23379,140 +23962,61 @@ const APP_INITIALIZER = new InjectionToken('Application Initializer');
23379
23962
  * @publicApi
23380
23963
  */
23381
23964
  class ApplicationInitStatus {
23382
- constructor(appInits) {
23383
- this.appInits = appInits;
23384
- this.resolve = noop;
23385
- this.reject = noop;
23965
+ constructor() {
23966
+ var _a;
23386
23967
  this.initialized = false;
23387
- this.done = false;
23388
- // TODO: Throw RuntimeErrorCode.INVALID_MULTI_PROVIDER if appInits is not an array
23389
- this.donePromise = new Promise((res, rej) => {
23390
- this.resolve = res;
23391
- this.reject = rej;
23392
- });
23393
- }
23394
- /** @internal */
23395
- runInitializers() {
23396
- if (this.initialized) {
23397
- return;
23398
- }
23399
- const asyncInitPromises = [];
23400
- const complete = () => {
23401
- this.done = true;
23402
- this.resolve();
23403
- };
23404
- if (this.appInits) {
23405
- for (let i = 0; i < this.appInits.length; i++) {
23406
- const initResult = this.appInits[i]();
23407
- if (isPromise(initResult)) {
23408
- asyncInitPromises.push(initResult);
23409
- }
23410
- else if (isObservable(initResult)) {
23411
- const observableAsPromise = new Promise((resolve, reject) => {
23412
- initResult.subscribe({ complete: resolve, error: reject });
23413
- });
23414
- asyncInitPromises.push(observableAsPromise);
23415
- }
23416
- }
23417
- }
23418
- Promise.all(asyncInitPromises)
23419
- .then(() => {
23420
- complete();
23421
- })
23422
- .catch(e => {
23423
- this.reject(e);
23424
- });
23425
- if (asyncInitPromises.length === 0) {
23426
- complete();
23427
- }
23428
- this.initialized = true;
23429
- }
23430
- }
23431
- ApplicationInitStatus.ɵfac = function ApplicationInitStatus_Factory(t) { return new (t || ApplicationInitStatus)(ɵɵinject(APP_INITIALIZER, 8)); };
23432
- ApplicationInitStatus.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationInitStatus, factory: ApplicationInitStatus.ɵfac, providedIn: 'root' });
23433
- (function () {
23434
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationInitStatus, [{
23435
- type: Injectable,
23436
- args: [{ providedIn: 'root' }]
23437
- }], function () {
23438
- return [{ type: undefined, decorators: [{
23439
- type: Inject,
23440
- args: [APP_INITIALIZER]
23441
- }, {
23442
- type: Optional
23443
- }] }];
23444
- }, null);
23445
- })();
23446
-
23447
- /**
23448
- * A [DI token](guide/glossary#di-token "DI token definition") representing a unique string ID, used
23449
- * primarily for prefixing application attributes and CSS styles when
23450
- * {@link ViewEncapsulation#Emulated ViewEncapsulation.Emulated} is being used.
23451
- *
23452
- * BY default, the value is randomly generated and assigned to the application by Angular.
23453
- * To provide a custom ID value, use a DI provider <!-- TODO: provider --> to configure
23454
- * the root {@link Injector} that uses this token.
23455
- *
23456
- * @publicApi
23457
- */
23458
- const APP_ID = new InjectionToken('AppId', {
23459
- providedIn: 'root',
23460
- factory: _appIdRandomProviderFactory,
23461
- });
23462
- function _appIdRandomProviderFactory() {
23463
- return `${_randomChar()}${_randomChar()}${_randomChar()}`;
23464
- }
23465
- /**
23466
- * Providers that generate a random `APP_ID_TOKEN`.
23467
- * @publicApi
23468
- */
23469
- const APP_ID_RANDOM_PROVIDER = {
23470
- provide: APP_ID,
23471
- useFactory: _appIdRandomProviderFactory,
23472
- deps: [],
23473
- };
23474
- function _randomChar() {
23475
- return String.fromCharCode(97 + Math.floor(Math.random() * 25));
23476
- }
23477
- /**
23478
- * A function that is executed when a platform is initialized.
23479
- * @publicApi
23480
- */
23481
- const PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
23482
- /**
23483
- * A token that indicates an opaque platform ID.
23484
- * @publicApi
23485
- */
23486
- const PLATFORM_ID = new InjectionToken('Platform ID', {
23487
- providedIn: 'platform',
23488
- factory: () => 'unknown', // set a default platform name, when none set explicitly
23489
- });
23490
- /**
23491
- * A [DI token](guide/glossary#di-token "DI token definition") that provides a set of callbacks to
23492
- * be called for every component that is bootstrapped.
23493
- *
23494
- * Each callback must take a `ComponentRef` instance and return nothing.
23495
- *
23496
- * `(componentRef: ComponentRef) => void`
23497
- *
23498
- * @publicApi
23499
- */
23500
- const APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
23501
- /**
23502
- * A [DI token](guide/glossary#di-token "DI token definition") that indicates the root directory of
23503
- * the application
23504
- * @publicApi
23505
- */
23506
- const PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
23507
- // We keep this token here, rather than the animations package, so that modules that only care
23508
- // about which animations module is loaded (e.g. the CDK) can retrieve it without having to
23509
- // include extra dependencies. See #44970 for more context.
23510
- /**
23511
- * A [DI token](guide/glossary#di-token "DI token definition") that indicates which animations
23512
- * module has been loaded.
23513
- * @publicApi
23514
- */
23515
- const ANIMATION_MODULE_TYPE = new InjectionToken('AnimationModuleType');
23968
+ this.done = false;
23969
+ this.donePromise = new Promise((res, rej) => {
23970
+ this.resolve = res;
23971
+ this.reject = rej;
23972
+ });
23973
+ // TODO: Throw RuntimeErrorCode.INVALID_MULTI_PROVIDER if appInits is not an array
23974
+ this.appInits = (_a = inject(APP_INITIALIZER, { optional: true })) !== null && _a !== void 0 ? _a : [];
23975
+ }
23976
+ /** @internal */
23977
+ runInitializers() {
23978
+ if (this.initialized) {
23979
+ return;
23980
+ }
23981
+ const asyncInitPromises = [];
23982
+ for (const appInits of this.appInits) {
23983
+ const initResult = appInits();
23984
+ if (isPromise(initResult)) {
23985
+ asyncInitPromises.push(initResult);
23986
+ }
23987
+ else if (isSubscribable(initResult)) {
23988
+ const observableAsPromise = new Promise((resolve, reject) => {
23989
+ initResult.subscribe({ complete: resolve, error: reject });
23990
+ });
23991
+ asyncInitPromises.push(observableAsPromise);
23992
+ }
23993
+ }
23994
+ const complete = () => {
23995
+ // @ts-expect-error overwriting a readonly
23996
+ this.done = true;
23997
+ this.resolve();
23998
+ };
23999
+ Promise.all(asyncInitPromises)
24000
+ .then(() => {
24001
+ complete();
24002
+ })
24003
+ .catch(e => {
24004
+ this.reject(e);
24005
+ });
24006
+ if (asyncInitPromises.length === 0) {
24007
+ complete();
24008
+ }
24009
+ this.initialized = true;
24010
+ }
24011
+ }
24012
+ ApplicationInitStatus.ɵfac = function ApplicationInitStatus_Factory(t) { return new (t || ApplicationInitStatus)(); };
24013
+ ApplicationInitStatus.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationInitStatus, factory: ApplicationInitStatus.ɵfac, providedIn: 'root' });
24014
+ (function () {
24015
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationInitStatus, [{
24016
+ type: Injectable,
24017
+ args: [{ providedIn: 'root' }]
24018
+ }], null, null);
24019
+ })();
23516
24020
 
23517
24021
  class Console {
23518
24022
  log(message) {
@@ -23907,6 +24411,10 @@ function scheduleMicroTask(fn) {
23907
24411
  }
23908
24412
  }
23909
24413
 
24414
+ function noop(...args) {
24415
+ // Do nothing.
24416
+ }
24417
+
23910
24418
  function getNativeRequestAnimationFrame() {
23911
24419
  let nativeRequestAnimationFrame = _global['requestAnimationFrame'];
23912
24420
  let nativeCancelAnimationFrame = _global['cancelAnimationFrame'];
@@ -24635,6 +25143,7 @@ function setTestabilityGetter(getter) {
24635
25143
  }
24636
25144
  let _testabilityGetter;
24637
25145
 
25146
+ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
24638
25147
  let _platformInjector = null;
24639
25148
  /**
24640
25149
  * Internal token to indicate whether having multiple bootstrapped platform should be allowed (only
@@ -24648,7 +25157,17 @@ const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
24648
25157
  * entire class tree-shakeable.
24649
25158
  */
24650
25159
  const PLATFORM_DESTROY_LISTENERS = new InjectionToken('PlatformDestroyListeners');
24651
- const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
25160
+ /**
25161
+ * A [DI token](guide/glossary#di-token "DI token definition") that provides a set of callbacks to
25162
+ * be called for every component that is bootstrapped.
25163
+ *
25164
+ * Each callback must take a `ComponentRef` instance and return nothing.
25165
+ *
25166
+ * `(componentRef: ComponentRef) => void`
25167
+ *
25168
+ * @publicApi
25169
+ */
25170
+ const APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
24652
25171
  function compileNgModuleFactory(injector, options, moduleType) {
24653
25172
  ngDevMode && assertNgModuleType(moduleType);
24654
25173
  const moduleFactory = new NgModuleFactory(moduleType);
@@ -24667,7 +25186,7 @@ function compileNgModuleFactory(injector, options, moduleType) {
24667
25186
  if (isComponentResourceResolutionQueueEmpty()) {
24668
25187
  return Promise.resolve(moduleFactory);
24669
25188
  }
24670
- const compilerProviders = _mergeArrays(compilerOptions.map(o => o.providers));
25189
+ const compilerProviders = compilerOptions.flatMap((option) => { var _a; return (_a = option.providers) !== null && _a !== void 0 ? _a : []; });
24671
25190
  // In case there are no compiler providers, we just return the module factory as
24672
25191
  // there won't be any resource loader. This can happen with Ivy, because AOT compiled
24673
25192
  // modules can be still passed through "bootstrapModule". In that case we shouldn't
@@ -24740,9 +25259,7 @@ function createOrReusePlatformInjector(providers = []) {
24740
25259
  }
24741
25260
  function runPlatformInitializers(injector) {
24742
25261
  const inits = injector.get(PLATFORM_INITIALIZER, null);
24743
- if (inits) {
24744
- inits.forEach((init) => init());
24745
- }
25262
+ inits === null || inits === void 0 ? void 0 : inits.forEach((init) => init());
24746
25263
  }
24747
25264
  /**
24748
25265
  * Internal create application API that implements the core application creation logic and optional
@@ -24767,7 +25284,7 @@ function internalCreateApplication(config) {
24767
25284
  // bootstrap level as well as providers passed to the bootstrap call by a user.
24768
25285
  const allAppProviders = [
24769
25286
  { provide: NgZone, useValue: ngZone },
24770
- ...(appProviders || []), //
25287
+ ...(appProviders || []),
24771
25288
  ];
24772
25289
  const envInjector = createEnvironmentInjector(allAppProviders, platformInjector, 'Environment Injector');
24773
25290
  const exceptionHandler = envInjector.get(ErrorHandler, null);
@@ -25038,21 +25555,21 @@ PlatformRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: PlatformRef, fa
25038
25555
  // `NgZoneOptions` that are recognized by the NgZone constructor. Passing no options will result in
25039
25556
  // a set of default options returned.
25040
25557
  function getNgZoneOptions(options) {
25558
+ var _a, _b;
25041
25559
  return {
25042
25560
  enableLongStackTrace: typeof ngDevMode === 'undefined' ? false : !!ngDevMode,
25043
- shouldCoalesceEventChangeDetection: !!(options && options.ngZoneEventCoalescing) || false,
25044
- shouldCoalesceRunChangeDetection: !!(options && options.ngZoneRunCoalescing) || false,
25561
+ shouldCoalesceEventChangeDetection: (_a = options === null || options === void 0 ? void 0 : options.ngZoneEventCoalescing) !== null && _a !== void 0 ? _a : false,
25562
+ shouldCoalesceRunChangeDetection: (_b = options === null || options === void 0 ? void 0 : options.ngZoneRunCoalescing) !== null && _b !== void 0 ? _b : false,
25045
25563
  };
25046
25564
  }
25047
- function getNgZone(ngZoneToUse, options) {
25048
- let ngZone;
25565
+ function getNgZone(ngZoneToUse = 'zone.js', options) {
25049
25566
  if (ngZoneToUse === 'noop') {
25050
- ngZone = new NoopNgZone();
25567
+ return new NoopNgZone();
25051
25568
  }
25052
- else {
25053
- ngZone = (ngZoneToUse === 'zone.js' ? undefined : ngZoneToUse) || new NgZone(options);
25569
+ if (ngZoneToUse === 'zone.js') {
25570
+ return new NgZone(options);
25054
25571
  }
25055
- return ngZone;
25572
+ return ngZoneToUse;
25056
25573
  }
25057
25574
  function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
25058
25575
  try {
@@ -25074,12 +25591,9 @@ function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
25074
25591
  }
25075
25592
  function optionsReducer(dst, objs) {
25076
25593
  if (Array.isArray(objs)) {
25077
- dst = objs.reduce(optionsReducer, dst);
25594
+ return objs.reduce(optionsReducer, dst);
25078
25595
  }
25079
- else {
25080
- dst = Object.assign(Object.assign({}, dst), objs);
25081
- }
25082
- return dst;
25596
+ return Object.assign(Object.assign({}, dst), objs);
25083
25597
  }
25084
25598
  /**
25085
25599
  * A reference to an Angular application running on a page.
@@ -25194,11 +25708,12 @@ class ApplicationRef {
25194
25708
  this._exceptionHandler = _exceptionHandler;
25195
25709
  /** @internal */
25196
25710
  this._bootstrapListeners = [];
25197
- this._views = [];
25198
25711
  this._runningTick = false;
25199
25712
  this._stable = true;
25200
25713
  this._destroyed = false;
25201
25714
  this._destroyListeners = [];
25715
+ /** @internal */
25716
+ this._views = [];
25202
25717
  /**
25203
25718
  * Get a list of component types registered to this application.
25204
25719
  * This list is populated even before the component is created.
@@ -25255,8 +25770,7 @@ class ApplicationRef {
25255
25770
  unstableSub.unsubscribe();
25256
25771
  };
25257
25772
  });
25258
- this.isStable =
25259
- merge$1(isCurrentlyStable, isStable.pipe(share()));
25773
+ this.isStable = merge$1(isCurrentlyStable, isStable.pipe(share()));
25260
25774
  }
25261
25775
  /**
25262
25776
  * Bootstrap a component onto the element identified by its selector or, optionally, to a
@@ -25487,11 +26001,6 @@ function _lastDefined(args) {
25487
26001
  }
25488
26002
  return undefined;
25489
26003
  }
25490
- function _mergeArrays(parts) {
25491
- const result = [];
25492
- parts.forEach((part) => part && result.push(...part));
25493
- return result;
25494
- }
25495
26004
 
25496
26005
  /**
25497
26006
  * Returns whether Angular is in development mode.
@@ -26298,10 +26807,6 @@ function getDebugNode(nativeNode) {
26298
26807
  }
26299
26808
  return null;
26300
26809
  }
26301
- // TODO: cleanup all references to this function and remove it.
26302
- function getDebugNodeR2(_nativeNode) {
26303
- return null;
26304
- }
26305
26810
  function getAllDebugNodes() {
26306
26811
  return Array.from(_nativeNodeToDebugNode.values());
26307
26812
  }
@@ -27391,141 +27896,235 @@ ApplicationModule.ɵinj = /*@__PURE__*/ ɵɵdefineInjector({});
27391
27896
  }], function () { return [{ type: ApplicationRef }]; }, null);
27392
27897
  })();
27393
27898
 
27394
- function escapeTransferStateContent(text) {
27395
- const escapedText = {
27396
- '&': '&a;',
27397
- '"': '&q;',
27398
- '\'': '&s;',
27399
- '<': '&l;',
27400
- '>': '&g;',
27401
- };
27402
- return text.replace(/[&"'<>]/g, s => escapedText[s]);
27899
+ /**
27900
+ * A collection that tracks all serialized views (`ngh` DOM annotations)
27901
+ * to avoid duplication. An attempt to add a duplicate view results in the
27902
+ * collection returning the index of the previously collected serialized view.
27903
+ * This reduces the number of annotations needed for a given page.
27904
+ */
27905
+ class SerializedViewCollection {
27906
+ constructor() {
27907
+ this.views = [];
27908
+ this.indexByContent = new Map();
27909
+ }
27910
+ add(serializedView) {
27911
+ const viewAsString = JSON.stringify(serializedView);
27912
+ if (!this.indexByContent.has(viewAsString)) {
27913
+ const index = this.views.length;
27914
+ this.views.push(serializedView);
27915
+ this.indexByContent.set(viewAsString, index);
27916
+ return index;
27917
+ }
27918
+ return this.indexByContent.get(viewAsString);
27919
+ }
27920
+ getAll() {
27921
+ return this.views;
27922
+ }
27403
27923
  }
27404
- function unescapeTransferStateContent(text) {
27405
- const unescapedText = {
27406
- '&a;': '&',
27407
- '&q;': '"',
27408
- '&s;': '\'',
27409
- '&l;': '<',
27410
- '&g;': '>',
27411
- };
27412
- return text.replace(/&[^;]+;/g, s => unescapedText[s]);
27924
+ /**
27925
+ * Computes the number of root nodes in a given view
27926
+ * (or child nodes in a given container if a tNode is provided).
27927
+ */
27928
+ function calcNumRootNodes(tView, lView, tNode) {
27929
+ const rootNodes = [];
27930
+ collectNativeNodes(tView, lView, tNode, rootNodes);
27931
+ return rootNodes.length;
27413
27932
  }
27414
27933
  /**
27415
- * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
27934
+ * Annotates all components bootstrapped in a given ApplicationRef
27935
+ * with info needed for hydration.
27416
27936
  *
27417
- * Example:
27937
+ * @param appRef An instance of an ApplicationRef.
27938
+ * @param doc A reference to the current Document instance.
27939
+ */
27940
+ function annotateForHydration(appRef, doc) {
27941
+ const serializedViewCollection = new SerializedViewCollection();
27942
+ const viewRefs = appRef._views;
27943
+ for (const viewRef of viewRefs) {
27944
+ const lView = getComponentLViewForHydration(viewRef);
27945
+ // An `lView` might be `null` if a `ViewRef` represents
27946
+ // an embedded view (not a component view).
27947
+ if (lView !== null) {
27948
+ const hostElement = lView[HOST];
27949
+ if (hostElement) {
27950
+ const context = {
27951
+ serializedViewCollection,
27952
+ };
27953
+ annotateHostElementForHydration(hostElement, lView, context);
27954
+ }
27955
+ }
27956
+ }
27957
+ const allSerializedViews = serializedViewCollection.getAll();
27958
+ if (allSerializedViews.length > 0) {
27959
+ const transferState = appRef.injector.get(TransferState);
27960
+ transferState.set(NGH_DATA_KEY, allSerializedViews);
27961
+ }
27962
+ }
27963
+ /**
27964
+ * Serializes the lView data into a SerializedView object that will later be added
27965
+ * to the TransferState storage and referenced using the `ngh` attribute on a host
27966
+ * element.
27418
27967
  *
27419
- * ```
27420
- * const COUNTER_KEY = makeStateKey<number>('counter');
27421
- * let value = 10;
27968
+ * @param lView the lView we are serializing
27969
+ * @param context the hydration context
27970
+ * @returns the `SerializedView` object containing the data to be added to the host node
27971
+ */
27972
+ function serializeLView(lView, context) {
27973
+ var _a;
27974
+ const ngh = {};
27975
+ const tView = lView[TVIEW];
27976
+ // Iterate over DOM element references in an LView.
27977
+ for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
27978
+ const tNode = tView.data[i];
27979
+ const noOffsetIndex = i - HEADER_OFFSET;
27980
+ // Local refs (e.g. <div #localRef>) take up an extra slot in LViews
27981
+ // to store the same element. In this case, there is no information in
27982
+ // a corresponding slot in TNode data structure. If that's the case, just
27983
+ // skip this slot and move to the next one.
27984
+ if (!tNode) {
27985
+ continue;
27986
+ }
27987
+ if (isLContainer(lView[i])) {
27988
+ // TODO: serialization of LContainers will be added
27989
+ // in followup PRs.
27990
+ }
27991
+ else if (Array.isArray(lView[i])) {
27992
+ // This is a component, annotate the host node with an `ngh` attribute.
27993
+ const targetNode = unwrapRNode(lView[i][HOST]);
27994
+ if (!targetNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME)) {
27995
+ annotateHostElementForHydration(targetNode, lView[i], context);
27996
+ }
27997
+ }
27998
+ else {
27999
+ // <ng-container> case
28000
+ if (tNode.type & 8 /* TNodeType.ElementContainer */) {
28001
+ // An <ng-container> is represented by the number of
28002
+ // top-level nodes. This information is needed to skip over
28003
+ // those nodes to reach a corresponding anchor node (comment node).
28004
+ (_a = ngh[ELEMENT_CONTAINERS]) !== null && _a !== void 0 ? _a : (ngh[ELEMENT_CONTAINERS] = {});
28005
+ ngh[ELEMENT_CONTAINERS][noOffsetIndex] = calcNumRootNodes(tView, lView, tNode.child);
28006
+ }
28007
+ }
28008
+ }
28009
+ return ngh;
28010
+ }
28011
+ /**
28012
+ * Physically adds the `ngh` attribute and serialized data to the host element.
27422
28013
  *
27423
- * transferState.set(COUNTER_KEY, value);
27424
- * ```
28014
+ * @param element The Host element to be annotated
28015
+ * @param lView The associated LView
28016
+ * @param context The hydration context
28017
+ */
28018
+ function annotateHostElementForHydration(element, lView, context) {
28019
+ const ngh = serializeLView(lView, context);
28020
+ const index = context.serializedViewCollection.add(ngh);
28021
+ const renderer = lView[RENDERER];
28022
+ renderer.setAttribute(element, NGH_ATTR_NAME, index.toString());
28023
+ }
28024
+
28025
+ /**
28026
+ * Indicates whether the hydration-related code was added,
28027
+ * prevents adding it multiple times.
28028
+ */
28029
+ let isHydrationSupportEnabled = false;
28030
+ /**
28031
+ * Brings the necessary hydration code in tree-shakable manner.
28032
+ * The code is only present when the `provideHydrationSupport` is
28033
+ * invoked. Otherwise, this code is tree-shaken away during the
28034
+ * build optimization step.
27425
28035
  *
27426
- * @publicApi
28036
+ * This technique allows us to swap implementations of methods so
28037
+ * tree shaking works appropriately when hydration is disabled or
28038
+ * enabled. It brings in the appropriate version of the method that
28039
+ * supports hydration only when enabled.
27427
28040
  */
27428
- function makeStateKey(key) {
27429
- return key;
28041
+ function enableHydrationRuntimeSupport() {
28042
+ if (!isHydrationSupportEnabled) {
28043
+ isHydrationSupportEnabled = true;
28044
+ enableRetrieveHydrationInfoImpl();
28045
+ enableLocateOrCreateElementNodeImpl();
28046
+ enableLocateOrCreateTextNodeImpl();
28047
+ enableLocateOrCreateElementContainerNodeImpl();
28048
+ }
27430
28049
  }
27431
28050
  /**
27432
- * A key value store that is transferred from the application on the server side to the application
27433
- * on the client side.
28051
+ * Detects whether the code is invoked in a browser.
28052
+ * Later on, this check should be replaced with a tree-shakable
28053
+ * flag (e.g. `!isServer`).
28054
+ */
28055
+ function isBrowser() {
28056
+ return inject(PLATFORM_ID) === 'browser';
28057
+ }
28058
+ /**
28059
+ * Returns a set of providers required to setup hydration support
28060
+ * for an application that is server side rendered.
27434
28061
  *
27435
- * The `TransferState` is available as an injectable token.
27436
- * On the client, just inject this token using DI and use it, it will be lazily initialized.
27437
- * On the server it's already included if `renderApplication` function is used. Otherwise, import
27438
- * the `ServerTransferStateModule` module to make the `TransferState` available.
28062
+ * ## NgModule-based bootstrap
27439
28063
  *
27440
- * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
27441
- * boolean, number, string, null and non-class objects will be serialized and deserialized in a
27442
- * non-lossy manner.
28064
+ * You can add the function call to the root AppModule of an application:
28065
+ * ```
28066
+ * import {provideHydrationSupport} from '@angular/core';
28067
+ *
28068
+ * @NgModule({
28069
+ * providers: [
28070
+ * // ... other providers ...
28071
+ * provideHydrationSupport()
28072
+ * ],
28073
+ * declarations: [AppComponent],
28074
+ * bootstrap: [AppComponent]
28075
+ * })
28076
+ * class AppModule {}
28077
+ * ```
28078
+ *
28079
+ * ## Standalone-based bootstrap
28080
+ *
28081
+ * Add the function to the `bootstrapApplication` call:
28082
+ * ```
28083
+ * import {provideHydrationSupport} from '@angular/core';
28084
+ *
28085
+ * bootstrapApplication(RootComponent, {
28086
+ * providers: [
28087
+ * // ... other providers ...
28088
+ * provideHydrationSupport()
28089
+ * ]
28090
+ * });
28091
+ * ```
28092
+ *
28093
+ * The function sets up an internal flag that would be recognized during
28094
+ * the server side rendering time as well, so there is no need to
28095
+ * configure or change anything in NgUniversal to enable the feature.
27443
28096
  *
27444
28097
  * @publicApi
28098
+ * @developerPreview
27445
28099
  */
27446
- class TransferState {
27447
- constructor() {
27448
- this.store = {};
27449
- this.onSerializeCallbacks = {};
27450
- this.store = retrieveTransferredState(getDocument(), inject(APP_ID));
27451
- }
27452
- /**
27453
- * Get the value corresponding to a key. Return `defaultValue` if key is not found.
27454
- */
27455
- get(key, defaultValue) {
27456
- return this.store[key] !== undefined ? this.store[key] : defaultValue;
27457
- }
27458
- /**
27459
- * Set the value corresponding to a key.
27460
- */
27461
- set(key, value) {
27462
- this.store[key] = value;
27463
- }
27464
- /**
27465
- * Remove a key from the store.
27466
- */
27467
- remove(key) {
27468
- delete this.store[key];
27469
- }
27470
- /**
27471
- * Test whether a key exists in the store.
27472
- */
27473
- hasKey(key) {
27474
- return this.store.hasOwnProperty(key);
27475
- }
27476
- /**
27477
- * Indicates whether the state is empty.
27478
- */
27479
- get isEmpty() {
27480
- return Object.keys(this.store).length === 0;
27481
- }
27482
- /**
27483
- * Register a callback to provide the value for a key when `toJson` is called.
27484
- */
27485
- onSerialize(key, callback) {
27486
- this.onSerializeCallbacks[key] = callback;
27487
- }
27488
- /**
27489
- * Serialize the current state of the store to JSON.
27490
- */
27491
- toJson() {
27492
- // Call the onSerialize callbacks and put those values into the store.
27493
- for (const key in this.onSerializeCallbacks) {
27494
- if (this.onSerializeCallbacks.hasOwnProperty(key)) {
27495
- try {
27496
- this.store[key] = this.onSerializeCallbacks[key]();
27497
- }
27498
- catch (e) {
27499
- console.warn('Exception in onSerialize callback: ', e);
28100
+ function provideHydrationSupport() {
28101
+ return makeEnvironmentProviders([
28102
+ {
28103
+ provide: ENVIRONMENT_INITIALIZER,
28104
+ useValue: () => {
28105
+ // Since this function is used across both server and client,
28106
+ // make sure that the runtime code is only added when invoked
28107
+ // on the client. Moving forward, the `isBrowser` check should
28108
+ // be replaced with a tree-shakable alternative (e.g. `isServer`
28109
+ // flag).
28110
+ if (isBrowser()) {
28111
+ enableHydrationRuntimeSupport();
27500
28112
  }
27501
- }
27502
- }
27503
- return JSON.stringify(this.store);
27504
- }
27505
- }
27506
- TransferState.ɵfac = function TransferState_Factory(t) { return new (t || TransferState)(); };
27507
- TransferState.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: TransferState, factory: TransferState.ɵfac, providedIn: 'root' });
27508
- (function () {
27509
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TransferState, [{
27510
- type: Injectable,
27511
- args: [{ providedIn: 'root' }]
27512
- }], function () { return []; }, null);
27513
- })();
27514
- function retrieveTransferredState(doc, appId) {
27515
- // Locate the script tag with the JSON data transferred from the server.
27516
- // The id of the script tag is set to the Angular appId + 'state'.
27517
- const script = doc.getElementById(appId + '-state');
27518
- let initialState = {};
27519
- if (script && script.textContent) {
27520
- try {
27521
- // Avoid using any here as it triggers lint errors in google3 (any is not allowed).
27522
- initialState = JSON.parse(unescapeTransferStateContent(script.textContent));
27523
- }
27524
- catch (e) {
27525
- console.warn('Exception while restoring TransferState for app ' + appId, e);
28113
+ },
28114
+ multi: true,
28115
+ },
28116
+ {
28117
+ provide: IS_HYDRATION_FEATURE_ENABLED,
28118
+ useValue: true,
28119
+ },
28120
+ {
28121
+ provide: PRESERVE_HOST_CONTENT,
28122
+ // Preserve host element content only in a browser
28123
+ // environment. On a server, an application is rendered
28124
+ // from scratch, so the host content needs to be empty.
28125
+ useFactory: () => isBrowser(),
27526
28126
  }
27527
- }
27528
- return initialState;
28127
+ ]);
27529
28128
  }
27530
28129
 
27531
28130
  /** Coerces a value (typically a string) to a boolean. */
@@ -27533,9 +28132,6 @@ function coerceToBoolean(value) {
27533
28132
  return typeof value === 'boolean' ? value : (value != null && value !== 'false');
27534
28133
  }
27535
28134
 
27536
- // TODO(alxhub): allows tests to compile, can be removed when tests have been updated.
27537
- const ɵivyEnabled = true;
27538
-
27539
28135
  /**
27540
28136
  * Compiles a partial directive declaration object into a full directive definition object.
27541
28137
  *
@@ -28239,6 +28835,20 @@ function reflectComponentType(component) {
28239
28835
  };
28240
28836
  }
28241
28837
 
28838
+ /**
28839
+ * Merge multiple application configurations from left to right.
28840
+ *
28841
+ * @param configs Two or more configurations to be merged.
28842
+ * @returns A merged [ApplicationConfig](api/core/ApplicationConfig).
28843
+ *
28844
+ * @publicApi
28845
+ */
28846
+ function mergeApplicationConfig(...configs) {
28847
+ return configs.reduce((prev, curr) => {
28848
+ return Object.assign(prev, curr, { providers: [...prev.providers, ...curr.providers] });
28849
+ }, { providers: [] });
28850
+ }
28851
+
28242
28852
  /**
28243
28853
  * @module
28244
28854
  * @description
@@ -28274,5 +28884,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
28274
28884
  * Generated bundle index. Do not edit.
28275
28885
  */
28276
28886
 
28277
- export { ANALYZE_FOR_ENTRY_COMPONENTS, ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, DestroyRef, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, Host, HostBinding, HostListener, INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, Pipe, PlatformRef, Query, QueryList, ReflectiveInjector, ReflectiveKey, Renderer2, RendererFactory2, RendererStyleFlags2, ResolvedReflectiveFactory, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef, asNativeElements, assertPlatform, computed, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, effect, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, isDevMode, isSignal, isStandalone, makeEnvironmentProviders, platformCore, reflectComponentType, resolveForwardRef, setTestabilityGetter, signal, untracked, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, APP_ID_RANDOM_PROVIDER as ɵAPP_ID_RANDOM_PROVIDER, ChangeDetectorStatus as ɵChangeDetectorStatus, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, TransferState as ɵTransferState, ViewRef$1 as ɵViewRef, XSS_SECURITY_URL as ɵXSS_SECURITY_URL, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, coerceToBoolean as ɵcoerceToBoolean, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, detectChanges as ɵdetectChanges, devModeEqual as ɵdevModeEqual, escapeTransferStateContent as ɵescapeTransferStateContent, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, getDebugNode as ɵgetDebugNode, getDebugNodeR2 as ɵgetDebugNodeR2, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, isBoundToModule as ɵisBoundToModule, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy, isEnvironmentProviders as ɵisEnvironmentProviders, isInjectable as ɵisInjectable, isListLikeIterable as ɵisListLikeIterable, isNgModule as ɵisNgModule, isObservable as ɵisObservable, isPromise as ɵisPromise, isSubscribable as ɵisSubscribable, ɵivyEnabled, makeDecorator as ɵmakeDecorator, makeStateKey as ɵmakeStateKey, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, publishDefaultGlobalUtils$1 as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, registerLocaleData as ɵregisterLocaleData, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setClassMetadata as ɵsetClassMetadata, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, unescapeTransferStateContent as ɵunescapeTransferStateContent, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵɵCopyDefinitionFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵStandaloneFeature, ɵɵadvance, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcontentQuery, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryRefresh, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵvalidateIframeAttribute, ɵɵviewQuery };
28887
+ export { ANALYZE_FOR_ENTRY_COMPONENTS, ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, DestroyRef, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, Host, HostBinding, HostListener, INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, Pipe, PlatformRef, Query, QueryList, ReflectiveInjector, ReflectiveKey, Renderer2, RendererFactory2, RendererStyleFlags2, ResolvedReflectiveFactory, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef, asNativeElements, assertPlatform, computed, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, effect, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, isDevMode, isSignal, isStandalone, makeEnvironmentProviders, mergeApplicationConfig, platformCore, reflectComponentType, resolveForwardRef, setTestabilityGetter, signal, untracked, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, APP_ID_RANDOM_PROVIDER as ɵAPP_ID_RANDOM_PROVIDER, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, IS_HYDRATION_FEATURE_ENABLED as ɵIS_HYDRATION_FEATURE_ENABLED, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, TransferState as ɵTransferState, ViewRef$1 as ɵViewRef, XSS_SECURITY_URL as ɵXSS_SECURITY_URL, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, annotateForHydration as ɵannotateForHydration, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, coerceToBoolean as ɵcoerceToBoolean, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, detectChanges as ɵdetectChanges, devModeEqual as ɵdevModeEqual, escapeTransferStateContent as ɵescapeTransferStateContent, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, getComponentDef as ɵgetComponentDef, getDebugNode as ɵgetDebugNode, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, isBoundToModule as ɵisBoundToModule, isEnvironmentProviders as ɵisEnvironmentProviders, isInjectable as ɵisInjectable, isNgModule as ɵisNgModule, isPromise as ɵisPromise, isSubscribable as ɵisSubscribable, makeDecorator as ɵmakeDecorator, makeStateKey as ɵmakeStateKey, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, provideHydrationSupport as ɵprovideHydrationSupport, publishDefaultGlobalUtils$1 as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, registerLocaleData as ɵregisterLocaleData, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setClassMetadata as ɵsetClassMetadata, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, unescapeTransferStateContent as ɵunescapeTransferStateContent, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵɵCopyDefinitionFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵStandaloneFeature, ɵɵadvance, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcontentQuery, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryRefresh, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵvalidateIframeAttribute, ɵɵviewQuery };
28278
28888
  //# sourceMappingURL=core.mjs.map