@angular/core 21.1.3 → 21.2.0-next.1

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 (76) hide show
  1. package/fesm2022/_attribute-chunk.mjs +1 -1
  2. package/fesm2022/_attribute-chunk.mjs.map +1 -1
  3. package/fesm2022/_debug_node-chunk.mjs +34 -33
  4. package/fesm2022/_debug_node-chunk.mjs.map +1 -1
  5. package/fesm2022/_effect-chunk.mjs +1 -1
  6. package/fesm2022/_effect-chunk.mjs.map +1 -1
  7. package/fesm2022/_linked_signal-chunk.mjs +2 -5
  8. package/fesm2022/_linked_signal-chunk.mjs.map +1 -1
  9. package/fesm2022/_not_found-chunk.mjs +1 -1
  10. package/fesm2022/_not_found-chunk.mjs.map +1 -1
  11. package/fesm2022/_resource-chunk.mjs +19 -2
  12. package/fesm2022/_resource-chunk.mjs.map +1 -1
  13. package/fesm2022/_untracked-chunk.mjs +2 -2
  14. package/fesm2022/_untracked-chunk.mjs.map +1 -1
  15. package/fesm2022/_weak_ref-chunk.mjs +1 -1
  16. package/fesm2022/_weak_ref-chunk.mjs.map +1 -1
  17. package/fesm2022/core.mjs +36 -6
  18. package/fesm2022/core.mjs.map +1 -1
  19. package/fesm2022/primitives-di.mjs +1 -1
  20. package/fesm2022/primitives-di.mjs.map +1 -1
  21. package/fesm2022/primitives-event-dispatch.mjs +2 -2
  22. package/fesm2022/primitives-event-dispatch.mjs.map +1 -1
  23. package/fesm2022/primitives-signals.mjs +1 -1
  24. package/fesm2022/primitives-signals.mjs.map +1 -1
  25. package/fesm2022/rxjs-interop.mjs +1 -1
  26. package/fesm2022/rxjs-interop.mjs.map +1 -1
  27. package/fesm2022/testing.mjs +1 -1
  28. package/fesm2022/testing.mjs.map +1 -1
  29. package/package.json +2 -2
  30. package/resources/best-practices.md +0 -1
  31. package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +1 -1
  32. package/schematics/bundles/application-config-core.cjs +1 -1
  33. package/schematics/bundles/apply_import_manager-CxA_YYgB.cjs +1 -1
  34. package/schematics/bundles/bootstrap-options-migration.cjs +1 -1
  35. package/schematics/bundles/cleanup-unused-imports.cjs +1 -1
  36. package/schematics/bundles/common-to-standalone-migration.cjs +1 -1
  37. package/schematics/bundles/compiler_host-CY14HvaP.cjs +1 -1
  38. package/schematics/bundles/control-flow-migration.cjs +1 -1
  39. package/schematics/bundles/imports-CVmcbVA9.cjs +1 -1
  40. package/schematics/bundles/index-BtLcQH8g.cjs +1 -1
  41. package/schematics/bundles/inject-migration.cjs +1 -1
  42. package/schematics/bundles/leading_space-BTPRV0wu.cjs +1 -1
  43. package/schematics/bundles/{migrate_ts_type_references-CV7qdt5t.cjs → migrate_ts_type_references-MWoZx-Cb.cjs} +11 -10
  44. package/schematics/bundles/ng_component_template-BOuKAnQd.cjs +1 -1
  45. package/schematics/bundles/ng_decorators-DYy6II6x.cjs +1 -1
  46. package/schematics/bundles/ngclass-to-class-migration.cjs +1 -1
  47. package/schematics/bundles/ngstyle-to-style-migration.cjs +1 -1
  48. package/schematics/bundles/nodes-ZSQ7WZRB.cjs +1 -1
  49. package/schematics/bundles/output-migration.cjs +1 -1
  50. package/schematics/bundles/parse_html-C8eKA9px.cjs +1 -1
  51. package/schematics/bundles/project_paths-D2V-Uh2L.cjs +1 -1
  52. package/schematics/bundles/project_tsconfig_paths-DkkMibv-.cjs +1 -1
  53. package/schematics/bundles/property_name-BCpALNpZ.cjs +1 -1
  54. package/schematics/bundles/route-lazy-loading.cjs +1 -1
  55. package/schematics/bundles/router-current-navigation.cjs +1 -1
  56. package/schematics/bundles/router-last-successful-navigation.cjs +1 -1
  57. package/schematics/bundles/router-testing-module-migration.cjs +1 -1
  58. package/schematics/bundles/self-closing-tags-migration.cjs +1 -1
  59. package/schematics/bundles/signal-input-migration.cjs +2 -2
  60. package/schematics/bundles/signal-queries-migration.cjs +2 -2
  61. package/schematics/bundles/signals.cjs +2 -2
  62. package/schematics/bundles/standalone-migration.cjs +1 -1
  63. package/schematics/bundles/symbol-DZeHSR-V.cjs +1 -1
  64. package/types/_api-chunk.d.ts +25 -2
  65. package/types/_chrome_dev_tools_performance-chunk.d.ts +1 -1
  66. package/types/_discovery-chunk.d.ts +2 -2
  67. package/types/_effect-chunk.d.ts +1 -1
  68. package/types/_event_dispatcher-chunk.d.ts +2 -2
  69. package/types/_formatter-chunk.d.ts +1 -1
  70. package/types/_weak_ref-chunk.d.ts +1 -1
  71. package/types/core.d.ts +34 -4
  72. package/types/primitives-di.d.ts +1 -1
  73. package/types/primitives-event-dispatch.d.ts +3 -3
  74. package/types/primitives-signals.d.ts +1 -1
  75. package/types/rxjs-interop.d.ts +1 -1
  76. package/types/testing.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.3
2
+ * @license Angular v21.2.0-next.1
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"_effect-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/graph.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/equality.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/computed.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/errors.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/signal.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/untracked.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/effect.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * The currently active consumer `ReactiveNode`, if running code in a reactive context.\n *\n * Change this via `setActiveConsumer`.\n */\nlet activeConsumer: ReactiveNode | null = null;\nlet inNotificationPhase = false;\n\nexport type Version = number & {__brand: 'Version'};\n\n/**\n * Global epoch counter. Incremented whenever a source signal is set.\n */\nlet epoch: Version = 1 as Version;\n\nexport type ReactiveHookFn = (node: ReactiveNode) => void;\n\n/**\n * If set, called after a producer `ReactiveNode` is created.\n */\nlet postProducerCreatedFn: ReactiveHookFn | null = null;\n\n/**\n * Symbol used to tell `Signal`s apart from other functions.\n *\n * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.\n */\nexport const SIGNAL: unique symbol = /* @__PURE__ */ Symbol('SIGNAL');\n\nexport function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null {\n const prev = activeConsumer;\n activeConsumer = consumer;\n return prev;\n}\n\nexport function getActiveConsumer(): ReactiveNode | null {\n return activeConsumer;\n}\n\nexport function isInNotificationPhase(): boolean {\n return inNotificationPhase;\n}\n\nexport interface Reactive {\n [SIGNAL]: ReactiveNode;\n}\n\nexport function isReactive(value: unknown): value is Reactive {\n return (value as Partial<Reactive>)[SIGNAL] !== undefined;\n}\n\nexport const REACTIVE_NODE: ReactiveNode = {\n version: 0 as Version,\n lastCleanEpoch: 0 as Version,\n dirty: false,\n producers: undefined,\n producersTail: undefined,\n consumers: undefined,\n consumersTail: undefined,\n recomputing: false,\n consumerAllowSignalWrites: false,\n consumerIsAlwaysLive: false,\n kind: 'unknown',\n producerMustRecompute: () => false,\n producerRecomputeValue: () => {},\n consumerMarkedDirty: () => {},\n consumerOnSignalRead: () => {},\n};\n\ninterface ReactiveLink {\n producer: ReactiveNode;\n consumer: ReactiveNode;\n lastReadVersion: number;\n prevConsumer: ReactiveLink | undefined;\n nextConsumer: ReactiveLink | undefined;\n nextProducer: ReactiveLink | undefined;\n}\n\nexport type ReactiveNodeKind =\n | 'signal'\n | 'computed'\n | 'effect'\n | 'template'\n | 'linkedSignal'\n | 'afterRenderEffectPhase'\n | 'unknown';\n\n/**\n * A producer and/or consumer which participates in the reactive graph.\n *\n * Producer `ReactiveNode`s which are accessed when a consumer `ReactiveNode` is the\n * `activeConsumer` are tracked as dependencies of that consumer.\n *\n * Certain consumers are also tracked as \"live\" consumers and create edges in the other direction,\n * from producer to consumer. These edges are used to propagate change notifications when a\n * producer's value is updated.\n *\n * A `ReactiveNode` may be both a producer and consumer.\n */\nexport interface ReactiveNode {\n /**\n * Version of the value that this node produces.\n *\n * This is incremented whenever a new value is produced by this node which is not equal to the\n * previous value (by whatever definition of equality is in use).\n */\n version: Version;\n\n /**\n * Epoch at which this node is verified to be clean.\n *\n * This allows skipping of some polling operations in the case where no signals have been set\n * since this node was last read.\n */\n lastCleanEpoch: Version;\n\n /**\n * Whether this node (in its consumer capacity) is dirty.\n *\n * Only live consumers become dirty, when receiving a change notification from a dependency\n * producer.\n */\n dirty: boolean;\n\n /**\n * Whether this node is currently rebuilding its producer list.\n */\n recomputing: boolean;\n\n /**\n * Producers which are dependencies of this consumer.\n */\n producers: ReactiveLink | undefined;\n\n /**\n * Points to the last linked list node in the `producers` linked list.\n *\n * When this node is recomputing, this is used to track the producers that we have accessed so far.\n */\n producersTail: ReactiveLink | undefined;\n\n /**\n * Linked list of consumers of this producer that are \"live\" (they require push notifications).\n *\n * The length of this list is effectively our reference count for this node.\n */\n consumers: ReactiveLink | undefined;\n consumersTail: ReactiveLink | undefined;\n\n /**\n * Whether writes to signals are allowed when this consumer is the `activeConsumer`.\n *\n * This is used to enforce guardrails such as preventing writes to writable signals in the\n * computation function of computed signals, which is supposed to be pure.\n */\n consumerAllowSignalWrites: boolean;\n\n readonly consumerIsAlwaysLive: boolean;\n\n /**\n * Tracks whether producers need to recompute their value independently of the reactive graph (for\n * example, if no initial value has been computed).\n */\n producerMustRecompute(node: unknown): boolean;\n producerRecomputeValue(node: unknown): void;\n consumerMarkedDirty(node: unknown): void;\n\n /**\n * Called when a signal is read within this consumer.\n */\n consumerOnSignalRead(node: unknown): void;\n\n /**\n * A debug name for the reactive node. Used in Angular DevTools to identify the node.\n */\n debugName?: string;\n\n /**\n * Kind of node. Example: 'signal', 'computed', 'input', 'effect'.\n *\n * ReactiveNode has this as 'unknown' by default, but derived node types should override this to\n * make available the kind of signal that particular instance of a ReactiveNode represents.\n *\n * Used in Angular DevTools to identify the kind of signal.\n */\n kind: ReactiveNodeKind;\n}\n\n/**\n * Called by implementations when a producer's signal is read.\n */\nexport function producerAccessed(node: ReactiveNode): void {\n if (inNotificationPhase) {\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? `Assertion error: signal read during notification phase`\n : '',\n );\n }\n\n if (activeConsumer === null) {\n // Accessed outside of a reactive context, so nothing to record.\n return;\n }\n\n activeConsumer.consumerOnSignalRead(node);\n\n const prevProducerLink = activeConsumer.producersTail;\n\n // If the last producer we accessed is the same as the current one, we can skip adding a new\n // link\n if (prevProducerLink !== undefined && prevProducerLink.producer === node) {\n return;\n }\n\n let nextProducerLink: ReactiveLink | undefined = undefined;\n const isRecomputing = activeConsumer.recomputing;\n if (isRecomputing) {\n // If we're incrementally rebuilding the producers list, we want to check if the next producer\n // in the list is the same as the one we're trying to add.\n\n // If the previous producer is defined, then the next producer is just the one that follows it.\n // Otherwise, we should check the head of the producers list (the first node that we accessed the last time this consumer was run).\n nextProducerLink =\n prevProducerLink !== undefined ? prevProducerLink.nextProducer : activeConsumer.producers;\n if (nextProducerLink !== undefined && nextProducerLink.producer === node) {\n // If the next producer is the same as the one we're trying to add, we can just update the\n // last read version, update the tail of the producers list of this rerun, and return.\n activeConsumer.producersTail = nextProducerLink;\n nextProducerLink.lastReadVersion = node.version;\n return;\n }\n }\n\n const prevConsumerLink = node.consumersTail;\n\n // If the producer we're accessing already has a link to this consumer, we can skip adding a new\n // link. This can short circuit the creation of a new link in the case where the consumer reads alternating ReeactiveNodes\n if (\n prevConsumerLink !== undefined &&\n prevConsumerLink.consumer === activeConsumer &&\n // However, we have to make sure that the link we've discovered isn't from a node that is incrementally rebuilding its producer list\n (!isRecomputing || isValidLink(prevConsumerLink, activeConsumer))\n ) {\n // If we found an existing link to the consumer we can just return.\n return;\n }\n\n // If we got here, it means that we need to create a new link between the producer and the consumer.\n const isLive = consumerIsLive(activeConsumer);\n const newLink = {\n producer: node,\n consumer: activeConsumer,\n // instead of eagerly destroying the previous link, we delay until we've finished recomputing\n // the producers list, so that we can destroy all of the old links at once.\n nextProducer: nextProducerLink,\n prevConsumer: prevConsumerLink,\n lastReadVersion: node.version,\n nextConsumer: undefined,\n };\n activeConsumer.producersTail = newLink;\n if (prevProducerLink !== undefined) {\n prevProducerLink.nextProducer = newLink;\n } else {\n activeConsumer.producers = newLink;\n }\n\n if (isLive) {\n producerAddLiveConsumer(node, newLink);\n }\n}\n\n/**\n * Increment the global epoch counter.\n *\n * Called by source producers (that is, not computeds) whenever their values change.\n */\nexport function producerIncrementEpoch(): void {\n epoch++;\n}\n\n/**\n * Ensure this producer's `version` is up-to-date.\n */\nexport function producerUpdateValueVersion(node: ReactiveNode): void {\n if (consumerIsLive(node) && !node.dirty) {\n // A live consumer will be marked dirty by producers, so a clean state means that its version\n // is guaranteed to be up-to-date.\n return;\n }\n\n if (!node.dirty && node.lastCleanEpoch === epoch) {\n // Even non-live consumers can skip polling if they previously found themselves to be clean at\n // the current epoch, since their dependencies could not possibly have changed (such a change\n // would've increased the epoch).\n return;\n }\n\n if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {\n // None of our producers report a change since the last time they were read, so no\n // recomputation of our value is necessary, and we can consider ourselves clean.\n producerMarkClean(node);\n return;\n }\n\n node.producerRecomputeValue(node);\n\n // After recomputing the value, we're no longer dirty.\n producerMarkClean(node);\n}\n\n/**\n * Propagate a dirty notification to live consumers of this producer.\n */\nexport function producerNotifyConsumers(node: ReactiveNode): void {\n if (node.consumers === undefined) {\n return;\n }\n\n // Prevent signal reads when we're updating the graph\n const prev = inNotificationPhase;\n inNotificationPhase = true;\n try {\n for (\n let link: ReactiveLink | undefined = node.consumers;\n link !== undefined;\n link = link.nextConsumer\n ) {\n const consumer = link.consumer;\n if (!consumer.dirty) {\n consumerMarkDirty(consumer);\n }\n }\n } finally {\n inNotificationPhase = prev;\n }\n}\n\n/**\n * Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,\n * based on the current consumer context.\n */\nexport function producerUpdatesAllowed(): boolean {\n return activeConsumer?.consumerAllowSignalWrites !== false;\n}\n\nexport function consumerMarkDirty(node: ReactiveNode): void {\n node.dirty = true;\n producerNotifyConsumers(node);\n node.consumerMarkedDirty?.(node);\n}\n\nexport function producerMarkClean(node: ReactiveNode): void {\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context and set\n * it as the active consumer.\n *\n * Must be called by subclasses which represent reactive computations, before those computations\n * begin.\n */\nexport function consumerBeforeComputation(node: ReactiveNode | null): ReactiveNode | null {\n if (node) resetConsumerBeforeComputation(node);\n\n return setActiveConsumer(node);\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context.\n *\n * We expose this mainly for code where we manually batch effects into a single\n * consumer. In those cases we may wish to \"reopen\" a consumer multiple times\n * in initial render before finalizing it. Most code should just call\n * `consumerBeforeComputation` instead of calling this directly.\n */\nexport function resetConsumerBeforeComputation(node: ReactiveNode): void {\n node.producersTail = undefined;\n node.recomputing = true;\n}\n\n/**\n * Finalize this consumer's state and set previous consumer as the active consumer after a\n * reactive computation has run.\n *\n * Must be called by subclasses which represent reactive computations, after those computations\n * have finished.\n */\nexport function consumerAfterComputation(\n node: ReactiveNode | null,\n prevConsumer: ReactiveNode | null,\n): void {\n setActiveConsumer(prevConsumer);\n\n if (node) finalizeConsumerAfterComputation(node);\n}\n\n/**\n * Finalize this consumer's state after a reactive computation has run.\n *\n * We expose this mainly for code where we manually batch effects into a single\n * consumer. In those cases we may wish to \"reopen\" a consumer multiple times\n * in initial render before finalizing it. Most code should just call\n * `consumerAfterComputation` instead of calling this directly.\n */\nexport function finalizeConsumerAfterComputation(node: ReactiveNode): void {\n node.recomputing = false;\n\n // We've finished incrementally rebuilding the producers list, now if there are any producers\n // that are after producersTail, they are stale and should be removed.\n const producersTail = node.producersTail as ReactiveLink | undefined;\n let toRemove = producersTail !== undefined ? producersTail.nextProducer : node.producers;\n if (toRemove !== undefined) {\n if (consumerIsLive(node)) {\n // For each stale link, we first unlink it from the producers list of consumers\n do {\n toRemove = producerRemoveLiveConsumerLink(toRemove);\n } while (toRemove !== undefined);\n }\n\n // Now, we can truncate the producers list to remove all stale links.\n if (producersTail !== undefined) {\n producersTail.nextProducer = undefined;\n } else {\n node.producers = undefined;\n }\n }\n}\n\n/**\n * Determine whether this consumer has any dependencies which have changed since the last time\n * they were read.\n */\nexport function consumerPollProducersForChange(node: ReactiveNode): boolean {\n // Poll producers for change.\n for (let link = node.producers; link !== undefined; link = link.nextProducer) {\n const producer = link.producer;\n const seenVersion = link.lastReadVersion;\n\n // First check the versions. A mismatch means that the producer's value is known to have\n // changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n\n // The producer's version is the same as the last time we read it, but it might itself be\n // stale. Force the producer to recompute its version (calculating a new value if necessary).\n producerUpdateValueVersion(producer);\n\n // Now when we do this check, `producer.version` is guaranteed to be up to date, so if the\n // versions still match then it has not changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Disconnect this consumer from the graph.\n */\nexport function consumerDestroy(node: ReactiveNode): void {\n if (consumerIsLive(node)) {\n // Drop all connections from the graph to this node.\n let link = node.producers;\n while (link !== undefined) {\n link = producerRemoveLiveConsumerLink(link);\n }\n }\n\n // Truncate all the linked lists to drop all connection from this node to the graph.\n node.producers = undefined;\n node.producersTail = undefined;\n node.consumers = undefined;\n node.consumersTail = undefined;\n}\n\n/**\n * Add `consumer` as a live consumer of this node.\n *\n * Note that this operation is potentially transitive. If this node becomes live, then it becomes\n * a live consumer of all of its current producers.\n */\nfunction producerAddLiveConsumer(node: ReactiveNode, link: ReactiveLink): void {\n const consumersTail = node.consumersTail;\n const wasLive = consumerIsLive(node);\n if (consumersTail !== undefined) {\n link.nextConsumer = consumersTail.nextConsumer;\n consumersTail.nextConsumer = link;\n } else {\n link.nextConsumer = undefined;\n node.consumers = link;\n }\n link.prevConsumer = consumersTail;\n node.consumersTail = link;\n if (!wasLive) {\n for (\n let link: ReactiveLink | undefined = node.producers;\n link !== undefined;\n link = link.nextProducer\n ) {\n producerAddLiveConsumer(link.producer, link);\n }\n }\n}\n\nfunction producerRemoveLiveConsumerLink(link: ReactiveLink): ReactiveLink | undefined {\n const producer = link.producer;\n const nextProducer = link.nextProducer;\n const nextConsumer = link.nextConsumer;\n const prevConsumer = link.prevConsumer;\n link.nextConsumer = undefined;\n link.prevConsumer = undefined;\n if (nextConsumer !== undefined) {\n nextConsumer.prevConsumer = prevConsumer;\n } else {\n producer.consumersTail = prevConsumer;\n }\n if (prevConsumer !== undefined) {\n prevConsumer.nextConsumer = nextConsumer;\n } else {\n producer.consumers = nextConsumer;\n if (!consumerIsLive(producer)) {\n let producerLink = producer.producers;\n while (producerLink !== undefined) {\n producerLink = producerRemoveLiveConsumerLink(producerLink);\n }\n }\n }\n return nextProducer;\n}\n\nfunction consumerIsLive(node: ReactiveNode): boolean {\n return node.consumerIsAlwaysLive || node.consumers !== undefined;\n}\n\nexport function runPostProducerCreatedFn(node: ReactiveNode): void {\n postProducerCreatedFn?.(node);\n}\n\nexport function setPostProducerCreatedFn(fn: ReactiveHookFn | null): ReactiveHookFn | null {\n const prev = postProducerCreatedFn;\n postProducerCreatedFn = fn;\n return prev;\n}\n\n// While a ReactiveNode is recomputing, it may not have destroyed previous links\n// This allows us to check if a given link will be destroyed by a reactivenode if it were to finish running immediately without accesing any more producers\nfunction isValidLink(checkLink: ReactiveLink, consumer: ReactiveNode): boolean {\n const producersTail = consumer.producersTail;\n if (producersTail !== undefined) {\n let link = consumer.producers!;\n do {\n if (link === checkLink) {\n return true;\n }\n if (link === producersTail) {\n break;\n }\n link = link.nextProducer!;\n } while (link !== undefined);\n }\n return false;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * A comparison function which can determine if two values are equal.\n */\nexport type ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * The default equality function used for `signal` and `computed`, which uses referential equality.\n */\nexport function defaultEquals<T>(a: T, b: T) {\n return Object.is(a, b);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n setActiveConsumer,\n SIGNAL,\n runPostProducerCreatedFn,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * A computation, which derives a value from a declarative reactive expression.\n *\n * `Computed`s are both producers and consumers of reactivity.\n */\nexport interface ComputedNode<T> extends ReactiveNode {\n /**\n * Current value of the computation, or one of the sentinel values above (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: T;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The computation function which will produce a new value.\n */\n computation: () => T;\n\n equal: ValueEqualityFn<T>;\n}\n\nexport type ComputedGetter<T> = (() => T) & {\n [SIGNAL]: ComputedNode<T>;\n};\n\n/**\n * Create a computed signal which derives a reactive value from an expression.\n */\nexport function createComputed<T>(\n computation: () => T,\n equal?: ValueEqualityFn<T>,\n): ComputedGetter<T> {\n const node: ComputedNode<T> = Object.create(COMPUTED_NODE);\n node.computation = computation;\n\n if (equal !== undefined) {\n node.equal = equal;\n }\n\n const computed = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n\n (computed as ComputedGetter<T>)[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n const debugName = node.debugName ? ' (' + node.debugName + ')' : '';\n computed.toString = () => `[Computed${debugName}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n\n return computed as unknown as ComputedGetter<T>;\n}\n\n/**\n * A dedicated symbol used before a computed value has been calculated for the first time.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const UNSET: any = /* @__PURE__ */ Symbol('UNSET');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * is in progress. Used to detect cycles in computation chains.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const COMPUTING: any = /* @__PURE__ */ Symbol('COMPUTING');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * failed. The thrown error is cached until the computation gets dirty again.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const ERRORED: any = /* @__PURE__ */ Symbol('ERRORED');\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst COMPUTED_NODE = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n kind: 'computed',\n\n producerMustRecompute(node: ComputedNode<unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: ComputedNode<unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',\n );\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n let wasEqual = false;\n try {\n newValue = node.computation();\n // We want to mark this node as errored if calling `equal` throws; however, we don't want\n // to track any reactive reads inside `equal`.\n setActiveConsumer(null);\n wasEqual =\n oldValue !== UNSET &&\n oldValue !== ERRORED &&\n newValue !== ERRORED &&\n node.equal(oldValue, newValue);\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (wasEqual) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {SignalNode} from './signal';\n\nfunction defaultThrowError(): never {\n throw new Error();\n}\n\nlet throwInvalidWriteToSignalErrorFn: <T>(node: SignalNode<T>) => never = defaultThrowError;\n\nexport function throwInvalidWriteToSignalError<T>(node: SignalNode<T>) {\n throwInvalidWriteToSignalErrorFn(node);\n}\n\nexport function setThrowInvalidWriteToSignalError(fn: <T>(node: SignalNode<T>) => never): void {\n throwInvalidWriteToSignalErrorFn = fn;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {throwInvalidWriteToSignalError} from './errors';\nimport {\n producerAccessed,\n producerIncrementEpoch,\n producerNotifyConsumers,\n producerUpdatesAllowed,\n REACTIVE_NODE,\n ReactiveNode,\n ReactiveHookFn,\n runPostProducerCreatedFn,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * If set, called after `WritableSignal`s are updated.\n *\n * This hook can be used to achieve various effects, such as running effects synchronously as part\n * of setting a signal.\n */\nlet postSignalSetFn: ReactiveHookFn | null = null;\n\nexport interface SignalNode<T> extends ReactiveNode {\n value: T;\n equal: ValueEqualityFn<T>;\n}\n\nexport type SignalBaseGetter<T> = (() => T) & {readonly [SIGNAL]: unknown};\nexport type SignalSetter<T> = (newValue: T) => void;\nexport type SignalUpdater<T> = (updateFn: (value: T) => T) => void;\n\n// Note: Closure *requires* this to be an `interface` and not a type, which is why the\n// `SignalBaseGetter` type exists to provide the correct shape.\nexport interface SignalGetter<T> extends SignalBaseGetter<T> {\n readonly [SIGNAL]: SignalNode<T>;\n}\n\n/**\n * Creates a `Signal` getter, setter, and updater function.\n */\nexport function createSignal<T>(\n initialValue: T,\n equal?: ValueEqualityFn<T>,\n): [SignalGetter<T>, SignalSetter<T>, SignalUpdater<T>] {\n const node: SignalNode<T> = Object.create(SIGNAL_NODE);\n node.value = initialValue;\n if (equal !== undefined) {\n node.equal = equal;\n }\n const getter = (() => signalGetFn(node)) as SignalGetter<T>;\n (getter as any)[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n const debugName = node.debugName ? ' (' + node.debugName + ')' : '';\n getter.toString = () => `[Signal${debugName}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n const set = (newValue: T) => signalSetFn(node, newValue);\n const update = (updateFn: (value: T) => T) => signalUpdateFn(node, updateFn);\n return [getter, set, update];\n}\n\nexport function setPostSignalSetFn(fn: ReactiveHookFn | null): ReactiveHookFn | null {\n const prev = postSignalSetFn;\n postSignalSetFn = fn;\n return prev;\n}\n\nexport function signalGetFn<T>(node: SignalNode<T>): T {\n producerAccessed(node);\n return node.value;\n}\n\nexport function signalSetFn<T>(node: SignalNode<T>, newValue: T) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError(node);\n }\n\n if (!node.equal(node.value, newValue)) {\n node.value = newValue;\n signalValueChanged(node);\n }\n}\n\nexport function signalUpdateFn<T>(node: SignalNode<T>, updater: (value: T) => T): void {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError(node);\n }\n\n signalSetFn(node, updater(node.value));\n}\n\nexport function runPostSignalSetFn<T>(node: SignalNode<T>): void {\n postSignalSetFn?.(node);\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nexport const SIGNAL_NODE: SignalNode<unknown> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n equal: defaultEquals,\n value: undefined,\n kind: 'signal',\n };\n})();\n\nfunction signalValueChanged<T>(node: SignalNode<T>): void {\n node.version++;\n producerIncrementEpoch();\n producerNotifyConsumers(node);\n postSignalSetFn?.(node);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {setActiveConsumer} from './graph';\n\n/**\n * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function\n * can, optionally, return a value.\n */\nexport function untracked<T>(nonReactiveReadsFn: () => T): T {\n const prevConsumer = setActiveConsumer(null);\n // We are not trying to catch any particular errors here, just making sure that the consumers\n // stack is restored in case of errors.\n try {\n return nonReactiveReadsFn();\n } finally {\n setActiveConsumer(prevConsumer);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerPollProducersForChange,\n REACTIVE_NODE,\n ReactiveNode,\n} from './graph';\n\n/**\n * An effect can, optionally, register a cleanup function. If registered, the cleanup is executed\n * before the next effect run. The cleanup function makes it possible to \"cancel\" any work that the\n * previous effect run might have started.\n */\nexport type EffectCleanupFn = () => void;\n\n/**\n * A callback passed to the effect function that makes it possible to register cleanup logic.\n */\nexport type EffectCleanupRegisterFn = (cleanupFn: EffectCleanupFn) => void;\n\nexport interface BaseEffectNode extends ReactiveNode {\n fn: () => void;\n destroy(): void;\n cleanup(): void;\n run(): void;\n}\n\nexport const BASE_EFFECT_NODE: Omit<BaseEffectNode, 'fn' | 'destroy' | 'cleanup' | 'run'> =\n /* @__PURE__ */ (() => ({\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: true,\n dirty: true,\n kind: 'effect',\n }))();\n\nexport function runEffect(node: BaseEffectNode) {\n node.dirty = false;\n if (node.version > 0 && !consumerPollProducersForChange(node)) {\n return;\n }\n node.version++;\n const prevNode = consumerBeforeComputation(node);\n try {\n node.cleanup();\n node.fn();\n } finally {\n consumerAfterComputation(node, prevNode);\n }\n}\n"],"names":["activeConsumer","inNotificationPhase","epoch","postProducerCreatedFn","SIGNAL","Symbol","setActiveConsumer","consumer","prev","getActiveConsumer","isInNotificationPhase","isReactive","value","undefined","REACTIVE_NODE","version","lastCleanEpoch","dirty","producers","producersTail","consumers","consumersTail","recomputing","consumerAllowSignalWrites","consumerIsAlwaysLive","kind","producerMustRecompute","producerRecomputeValue","consumerMarkedDirty","consumerOnSignalRead","producerAccessed","node","Error","ngDevMode","prevProducerLink","producer","nextProducerLink","isRecomputing","nextProducer","lastReadVersion","prevConsumerLink","isValidLink","isLive","consumerIsLive","newLink","prevConsumer","nextConsumer","producerAddLiveConsumer","producerIncrementEpoch","producerUpdateValueVersion","consumerPollProducersForChange","producerMarkClean","producerNotifyConsumers","link","consumerMarkDirty","producerUpdatesAllowed","consumerBeforeComputation","resetConsumerBeforeComputation","consumerAfterComputation","finalizeConsumerAfterComputation","toRemove","producerRemoveLiveConsumerLink","seenVersion","consumerDestroy","wasLive","producerLink","runPostProducerCreatedFn","setPostProducerCreatedFn","fn","checkLink","defaultEquals","a","b","Object","is","createComputed","computation","equal","create","COMPUTED_NODE","computed","ERRORED","error","debugName","toString","String","UNSET","COMPUTING","oldValue","newValue","wasEqual","err","defaultThrowError","throwInvalidWriteToSignalErrorFn","throwInvalidWriteToSignalError","setThrowInvalidWriteToSignalError","postSignalSetFn","createSignal","initialValue","SIGNAL_NODE","getter","signalGetFn","set","signalSetFn","update","updateFn","signalUpdateFn","setPostSignalSetFn","signalValueChanged","updater","runPostSignalSetFn","untracked","nonReactiveReadsFn","BASE_EFFECT_NODE","runEffect","prevNode","cleanup"],"mappings":";;;;;;AAiBA,IAAIA,cAAc,GAAwB,IAAI;AAC9C,IAAIC,mBAAmB,GAAG,KAAK;AAO/B,IAAIC,KAAK,GAAY,CAAY;AAOjC,IAAIC,qBAAqB,GAA0B,IAAI;MAO1CC,MAAM,kBAAkCC,MAAM,CAAC,QAAQ;AAE9D,SAAUC,iBAAiBA,CAACC,QAA6B,EAAA;EAC7D,MAAMC,IAAI,GAAGR,cAAc;AAC3BA,EAAAA,cAAc,GAAGO,QAAQ;AACzB,EAAA,OAAOC,IAAI;AACb;SAEgBC,iBAAiBA,GAAA;AAC/B,EAAA,OAAOT,cAAc;AACvB;SAEgBU,qBAAqBA,GAAA;AACnC,EAAA,OAAOT,mBAAmB;AAC5B;AAMM,SAAUU,UAAUA,CAACC,KAAc,EAAA;AACvC,EAAA,OAAQA,KAA2B,CAACR,MAAM,CAAC,KAAKS,SAAS;AAC3D;AAEO,MAAMC,aAAa,GAAiB;AACzCC,EAAAA,OAAO,EAAE,CAAY;AACrBC,EAAAA,cAAc,EAAE,CAAY;AAC5BC,EAAAA,KAAK,EAAE,KAAK;AACZC,EAAAA,SAAS,EAAEL,SAAS;AACpBM,EAAAA,aAAa,EAAEN,SAAS;AACxBO,EAAAA,SAAS,EAAEP,SAAS;AACpBQ,EAAAA,aAAa,EAAER,SAAS;AACxBS,EAAA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BAAgB,kBACX,CAAC,OAAO;AACtB,EAAA,GAAGnG,aAAa;AAChBU,EAAAA,oBAAoB,EAAE,IAAI;AAC1BD,EAAAA,yBAAyB,EAAE,IAAI;AAC/BN,EAAAA,KAAK,EAAE,IAAI;AACXQ,EAAAA,IAAI,EAAE;CACP,CAAC;AAEE,SAAUyF,SAASA,CAACnF,IAAoB,EAAA;EAC5CA,IAAI,CAACd,KAAK,GAAG,KAAK;EAClB,IAAIc,IAAI,CAAChB,OAAO,GAAG,CAAC,IAAI,CAACmC,8BAA8B,CAACnB,IAAI,CAAC,EAAE;AAC7D,IAAA;AACF;EACAA,IAAI,CAAChB,OAAO,EAAE;AACd,EAAA,MAAMoG,QAAQ,GAAG3D,yBAAyB,CAACzB,IAAI,CAAC;EAChD,IAAI;IACFA,IAAI,CAACqF,OAAO,EAAE;IACdrF,IAAI,CAACqC,EAAE,EAAE;AACX,GAAA,SAAU;AACRV,IAAAA,wBAAwB,CAAC3B,IAAI,EAAEoF,QAAQ,CAAC;AAC1C;AACF;;;;"}
1
+ {"version":3,"file":"_effect-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/graph.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/equality.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/computed.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/errors.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/signal.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/untracked.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/effect.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * The currently active consumer `ReactiveNode`, if running code in a reactive context.\n *\n * Change this via `setActiveConsumer`.\n */\nlet activeConsumer: ReactiveNode | null = null;\nlet inNotificationPhase = false;\n\nexport type Version = number & {__brand: 'Version'};\n\n/**\n * Global epoch counter. Incremented whenever a source signal is set.\n */\nlet epoch: Version = 1 as Version;\n\nexport type ReactiveHookFn = (node: ReactiveNode) => void;\n\n/**\n * If set, called after a producer `ReactiveNode` is created.\n */\nlet postProducerCreatedFn: ReactiveHookFn | null = null;\n\n/**\n * Symbol used to tell `Signal`s apart from other functions.\n *\n * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.\n */\nexport const SIGNAL: unique symbol = /* @__PURE__ */ Symbol('SIGNAL');\n\nexport function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null {\n const prev = activeConsumer;\n activeConsumer = consumer;\n return prev;\n}\n\nexport function getActiveConsumer(): ReactiveNode | null {\n return activeConsumer;\n}\n\nexport function isInNotificationPhase(): boolean {\n return inNotificationPhase;\n}\n\nexport interface Reactive {\n [SIGNAL]: ReactiveNode;\n}\n\nexport function isReactive(value: unknown): value is Reactive {\n return (value as Partial<Reactive>)[SIGNAL] !== undefined;\n}\n\nexport const REACTIVE_NODE: ReactiveNode = {\n version: 0 as Version,\n lastCleanEpoch: 0 as Version,\n dirty: false,\n producers: undefined,\n producersTail: undefined,\n consumers: undefined,\n consumersTail: undefined,\n recomputing: false,\n consumerAllowSignalWrites: false,\n consumerIsAlwaysLive: false,\n kind: 'unknown',\n producerMustRecompute: () => false,\n producerRecomputeValue: () => {},\n consumerMarkedDirty: () => {},\n consumerOnSignalRead: () => {},\n};\n\ninterface ReactiveLink {\n producer: ReactiveNode;\n consumer: ReactiveNode;\n lastReadVersion: number;\n prevConsumer: ReactiveLink | undefined;\n nextConsumer: ReactiveLink | undefined;\n nextProducer: ReactiveLink | undefined;\n}\n\nexport type ReactiveNodeKind =\n | 'signal'\n | 'computed'\n | 'effect'\n | 'template'\n | 'linkedSignal'\n | 'afterRenderEffectPhase'\n | 'unknown';\n\n/**\n * A producer and/or consumer which participates in the reactive graph.\n *\n * Producer `ReactiveNode`s which are accessed when a consumer `ReactiveNode` is the\n * `activeConsumer` are tracked as dependencies of that consumer.\n *\n * Certain consumers are also tracked as \"live\" consumers and create edges in the other direction,\n * from producer to consumer. These edges are used to propagate change notifications when a\n * producer's value is updated.\n *\n * A `ReactiveNode` may be both a producer and consumer.\n */\nexport interface ReactiveNode {\n /**\n * Version of the value that this node produces.\n *\n * This is incremented whenever a new value is produced by this node which is not equal to the\n * previous value (by whatever definition of equality is in use).\n */\n version: Version;\n\n /**\n * Epoch at which this node is verified to be clean.\n *\n * This allows skipping of some polling operations in the case where no signals have been set\n * since this node was last read.\n */\n lastCleanEpoch: Version;\n\n /**\n * Whether this node (in its consumer capacity) is dirty.\n *\n * Only live consumers become dirty, when receiving a change notification from a dependency\n * producer.\n */\n dirty: boolean;\n\n /**\n * Whether this node is currently rebuilding its producer list.\n */\n recomputing: boolean;\n\n /**\n * Producers which are dependencies of this consumer.\n */\n producers: ReactiveLink | undefined;\n\n /**\n * Points to the last linked list node in the `producers` linked list.\n *\n * When this node is recomputing, this is used to track the producers that we have accessed so far.\n */\n producersTail: ReactiveLink | undefined;\n\n /**\n * Linked list of consumers of this producer that are \"live\" (they require push notifications).\n *\n * The length of this list is effectively our reference count for this node.\n */\n consumers: ReactiveLink | undefined;\n consumersTail: ReactiveLink | undefined;\n\n /**\n * Whether writes to signals are allowed when this consumer is the `activeConsumer`.\n *\n * This is used to enforce guardrails such as preventing writes to writable signals in the\n * computation function of computed signals, which is supposed to be pure.\n */\n consumerAllowSignalWrites: boolean;\n\n readonly consumerIsAlwaysLive: boolean;\n\n /**\n * Tracks whether producers need to recompute their value independently of the reactive graph (for\n * example, if no initial value has been computed).\n */\n producerMustRecompute(node: unknown): boolean;\n producerRecomputeValue(node: unknown): void;\n consumerMarkedDirty(node: unknown): void;\n\n /**\n * Called when a signal is read within this consumer.\n */\n consumerOnSignalRead(node: unknown): void;\n\n /**\n * A debug name for the reactive node. Used in Angular DevTools to identify the node.\n */\n debugName?: string;\n\n /**\n * Kind of node. Example: 'signal', 'computed', 'input', 'effect'.\n *\n * ReactiveNode has this as 'unknown' by default, but derived node types should override this to\n * make available the kind of signal that particular instance of a ReactiveNode represents.\n *\n * Used in Angular DevTools to identify the kind of signal.\n */\n kind: ReactiveNodeKind;\n}\n\n/**\n * Called by implementations when a producer's signal is read.\n */\nexport function producerAccessed(node: ReactiveNode): void {\n if (inNotificationPhase) {\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? `Assertion error: signal read during notification phase`\n : '',\n );\n }\n\n if (activeConsumer === null) {\n // Accessed outside of a reactive context, so nothing to record.\n return;\n }\n\n activeConsumer.consumerOnSignalRead(node);\n\n const prevProducerLink = activeConsumer.producersTail;\n\n // If the last producer we accessed is the same as the current one, we can skip adding a new\n // link\n if (prevProducerLink !== undefined && prevProducerLink.producer === node) {\n return;\n }\n\n let nextProducerLink: ReactiveLink | undefined = undefined;\n const isRecomputing = activeConsumer.recomputing;\n if (isRecomputing) {\n // If we're incrementally rebuilding the producers list, we want to check if the next producer\n // in the list is the same as the one we're trying to add.\n\n // If the previous producer is defined, then the next producer is just the one that follows it.\n // Otherwise, we should check the head of the producers list (the first node that we accessed the last time this consumer was run).\n nextProducerLink =\n prevProducerLink !== undefined ? prevProducerLink.nextProducer : activeConsumer.producers;\n if (nextProducerLink !== undefined && nextProducerLink.producer === node) {\n // If the next producer is the same as the one we're trying to add, we can just update the\n // last read version, update the tail of the producers list of this rerun, and return.\n activeConsumer.producersTail = nextProducerLink;\n nextProducerLink.lastReadVersion = node.version;\n return;\n }\n }\n\n const prevConsumerLink = node.consumersTail;\n\n // If the producer we're accessing already has a link to this consumer, we can skip adding a new\n // link. This can short circuit the creation of a new link in the case where the consumer reads alternating ReeactiveNodes\n if (\n prevConsumerLink !== undefined &&\n prevConsumerLink.consumer === activeConsumer &&\n // However, we have to make sure that the link we've discovered isn't from a node that is incrementally rebuilding its producer list\n (!isRecomputing || isValidLink(prevConsumerLink, activeConsumer))\n ) {\n // If we found an existing link to the consumer we can just return.\n return;\n }\n\n // If we got here, it means that we need to create a new link between the producer and the consumer.\n const isLive = consumerIsLive(activeConsumer);\n const newLink = {\n producer: node,\n consumer: activeConsumer,\n // instead of eagerly destroying the previous link, we delay until we've finished recomputing\n // the producers list, so that we can destroy all of the old links at once.\n nextProducer: nextProducerLink,\n prevConsumer: prevConsumerLink,\n lastReadVersion: node.version,\n nextConsumer: undefined,\n };\n activeConsumer.producersTail = newLink;\n if (prevProducerLink !== undefined) {\n prevProducerLink.nextProducer = newLink;\n } else {\n activeConsumer.producers = newLink;\n }\n\n if (isLive) {\n producerAddLiveConsumer(node, newLink);\n }\n}\n\n/**\n * Increment the global epoch counter.\n *\n * Called by source producers (that is, not computeds) whenever their values change.\n */\nexport function producerIncrementEpoch(): void {\n epoch++;\n}\n\n/**\n * Ensure this producer's `version` is up-to-date.\n */\nexport function producerUpdateValueVersion(node: ReactiveNode): void {\n if (consumerIsLive(node) && !node.dirty) {\n // A live consumer will be marked dirty by producers, so a clean state means that its version\n // is guaranteed to be up-to-date.\n return;\n }\n\n if (!node.dirty && node.lastCleanEpoch === epoch) {\n // Even non-live consumers can skip polling if they previously found themselves to be clean at\n // the current epoch, since their dependencies could not possibly have changed (such a change\n // would've increased the epoch).\n return;\n }\n\n if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {\n // None of our producers report a change since the last time they were read, so no\n // recomputation of our value is necessary, and we can consider ourselves clean.\n producerMarkClean(node);\n return;\n }\n\n node.producerRecomputeValue(node);\n\n // After recomputing the value, we're no longer dirty.\n producerMarkClean(node);\n}\n\n/**\n * Propagate a dirty notification to live consumers of this producer.\n */\nexport function producerNotifyConsumers(node: ReactiveNode): void {\n if (node.consumers === undefined) {\n return;\n }\n\n // Prevent signal reads when we're updating the graph\n const prev = inNotificationPhase;\n inNotificationPhase = true;\n try {\n for (\n let link: ReactiveLink | undefined = node.consumers;\n link !== undefined;\n link = link.nextConsumer\n ) {\n const consumer = link.consumer;\n if (!consumer.dirty) {\n consumerMarkDirty(consumer);\n }\n }\n } finally {\n inNotificationPhase = prev;\n }\n}\n\n/**\n * Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,\n * based on the current consumer context.\n */\nexport function producerUpdatesAllowed(): boolean {\n return activeConsumer?.consumerAllowSignalWrites !== false;\n}\n\nexport function consumerMarkDirty(node: ReactiveNode): void {\n node.dirty = true;\n producerNotifyConsumers(node);\n node.consumerMarkedDirty?.(node);\n}\n\nexport function producerMarkClean(node: ReactiveNode): void {\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context and set\n * it as the active consumer.\n *\n * Must be called by subclasses which represent reactive computations, before those computations\n * begin.\n */\nexport function consumerBeforeComputation(node: ReactiveNode | null): ReactiveNode | null {\n if (node) resetConsumerBeforeComputation(node);\n\n return setActiveConsumer(node);\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context.\n *\n * We expose this mainly for code where we manually batch effects into a single\n * consumer. In those cases we may wish to \"reopen\" a consumer multiple times\n * in initial render before finalizing it. Most code should just call\n * `consumerBeforeComputation` instead of calling this directly.\n */\nexport function resetConsumerBeforeComputation(node: ReactiveNode): void {\n node.producersTail = undefined;\n node.recomputing = true;\n}\n\n/**\n * Finalize this consumer's state and set previous consumer as the active consumer after a\n * reactive computation has run.\n *\n * Must be called by subclasses which represent reactive computations, after those computations\n * have finished.\n */\nexport function consumerAfterComputation(\n node: ReactiveNode | null,\n prevConsumer: ReactiveNode | null,\n): void {\n setActiveConsumer(prevConsumer);\n\n if (node) finalizeConsumerAfterComputation(node);\n}\n\n/**\n * Finalize this consumer's state after a reactive computation has run.\n *\n * We expose this mainly for code where we manually batch effects into a single\n * consumer. In those cases we may wish to \"reopen\" a consumer multiple times\n * in initial render before finalizing it. Most code should just call\n * `consumerAfterComputation` instead of calling this directly.\n */\nexport function finalizeConsumerAfterComputation(node: ReactiveNode): void {\n node.recomputing = false;\n\n // We've finished incrementally rebuilding the producers list, now if there are any producers\n // that are after producersTail, they are stale and should be removed.\n const producersTail = node.producersTail as ReactiveLink | undefined;\n let toRemove = producersTail !== undefined ? producersTail.nextProducer : node.producers;\n if (toRemove !== undefined) {\n if (consumerIsLive(node)) {\n // For each stale link, we first unlink it from the producers list of consumers\n do {\n toRemove = producerRemoveLiveConsumerLink(toRemove);\n } while (toRemove !== undefined);\n }\n\n // Now, we can truncate the producers list to remove all stale links.\n if (producersTail !== undefined) {\n producersTail.nextProducer = undefined;\n } else {\n node.producers = undefined;\n }\n }\n}\n\n/**\n * Determine whether this consumer has any dependencies which have changed since the last time\n * they were read.\n */\nexport function consumerPollProducersForChange(node: ReactiveNode): boolean {\n // Poll producers for change.\n for (let link = node.producers; link !== undefined; link = link.nextProducer) {\n const producer = link.producer;\n const seenVersion = link.lastReadVersion;\n\n // First check the versions. A mismatch means that the producer's value is known to have\n // changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n\n // The producer's version is the same as the last time we read it, but it might itself be\n // stale. Force the producer to recompute its version (calculating a new value if necessary).\n producerUpdateValueVersion(producer);\n\n // Now when we do this check, `producer.version` is guaranteed to be up to date, so if the\n // versions still match then it has not changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Disconnect this consumer from the graph.\n */\nexport function consumerDestroy(node: ReactiveNode): void {\n if (consumerIsLive(node)) {\n // Drop all connections from the graph to this node.\n let link = node.producers;\n while (link !== undefined) {\n link = producerRemoveLiveConsumerLink(link);\n }\n }\n\n // Truncate all the linked lists to drop all connection from this node to the graph.\n node.producers = undefined;\n node.producersTail = undefined;\n node.consumers = undefined;\n node.consumersTail = undefined;\n}\n\n/**\n * Add `consumer` as a live consumer of this node.\n *\n * Note that this operation is potentially transitive. If this node becomes live, then it becomes\n * a live consumer of all of its current producers.\n */\nfunction producerAddLiveConsumer(node: ReactiveNode, link: ReactiveLink): void {\n const consumersTail = node.consumersTail;\n const wasLive = consumerIsLive(node);\n if (consumersTail !== undefined) {\n link.nextConsumer = consumersTail.nextConsumer;\n consumersTail.nextConsumer = link;\n } else {\n link.nextConsumer = undefined;\n node.consumers = link;\n }\n link.prevConsumer = consumersTail;\n node.consumersTail = link;\n if (!wasLive) {\n for (\n let link: ReactiveLink | undefined = node.producers;\n link !== undefined;\n link = link.nextProducer\n ) {\n producerAddLiveConsumer(link.producer, link);\n }\n }\n}\n\nfunction producerRemoveLiveConsumerLink(link: ReactiveLink): ReactiveLink | undefined {\n const producer = link.producer;\n const nextProducer = link.nextProducer;\n const nextConsumer = link.nextConsumer;\n const prevConsumer = link.prevConsumer;\n link.nextConsumer = undefined;\n link.prevConsumer = undefined;\n if (nextConsumer !== undefined) {\n nextConsumer.prevConsumer = prevConsumer;\n } else {\n producer.consumersTail = prevConsumer;\n }\n if (prevConsumer !== undefined) {\n prevConsumer.nextConsumer = nextConsumer;\n } else {\n producer.consumers = nextConsumer;\n if (!consumerIsLive(producer)) {\n let producerLink = producer.producers;\n while (producerLink !== undefined) {\n producerLink = producerRemoveLiveConsumerLink(producerLink);\n }\n }\n }\n return nextProducer;\n}\n\nfunction consumerIsLive(node: ReactiveNode): boolean {\n return node.consumerIsAlwaysLive || node.consumers !== undefined;\n}\n\nexport function runPostProducerCreatedFn(node: ReactiveNode): void {\n postProducerCreatedFn?.(node);\n}\n\nexport function setPostProducerCreatedFn(fn: ReactiveHookFn | null): ReactiveHookFn | null {\n const prev = postProducerCreatedFn;\n postProducerCreatedFn = fn;\n return prev;\n}\n\n// While a ReactiveNode is recomputing, it may not have destroyed previous links\n// This allows us to check if a given link will be destroyed by a reactivenode if it were to finish running immediately without accesing any more producers\nfunction isValidLink(checkLink: ReactiveLink, consumer: ReactiveNode): boolean {\n const producersTail = consumer.producersTail;\n if (producersTail !== undefined) {\n let link = consumer.producers!;\n do {\n if (link === checkLink) {\n return true;\n }\n if (link === producersTail) {\n break;\n }\n link = link.nextProducer!;\n } while (link !== undefined);\n }\n return false;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * A comparison function which can determine if two values are equal.\n */\nexport type ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * The default equality function used for `signal` and `computed`, which uses referential equality.\n */\nexport function defaultEquals<T>(a: T, b: T) {\n return Object.is(a, b);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n setActiveConsumer,\n SIGNAL,\n runPostProducerCreatedFn,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * A computation, which derives a value from a declarative reactive expression.\n *\n * `Computed`s are both producers and consumers of reactivity.\n */\nexport interface ComputedNode<T> extends ReactiveNode {\n /**\n * Current value of the computation, or one of the sentinel values above (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: T;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The computation function which will produce a new value.\n */\n computation: () => T;\n\n equal: ValueEqualityFn<T>;\n}\n\nexport type ComputedGetter<T> = (() => T) & {\n [SIGNAL]: ComputedNode<T>;\n};\n\n/**\n * Create a computed signal which derives a reactive value from an expression.\n */\nexport function createComputed<T>(\n computation: () => T,\n equal?: ValueEqualityFn<T>,\n): ComputedGetter<T> {\n const node: ComputedNode<T> = Object.create(COMPUTED_NODE);\n node.computation = computation;\n\n if (equal !== undefined) {\n node.equal = equal;\n }\n\n const computed = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n\n (computed as ComputedGetter<T>)[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n const debugName = node.debugName ? ' (' + node.debugName + ')' : '';\n computed.toString = () => `[Computed${debugName}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n\n return computed as unknown as ComputedGetter<T>;\n}\n\n/**\n * A dedicated symbol used before a computed value has been calculated for the first time.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const UNSET: any = /* @__PURE__ */ Symbol('UNSET');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * is in progress. Used to detect cycles in computation chains.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const COMPUTING: any = /* @__PURE__ */ Symbol('COMPUTING');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * failed. The thrown error is cached until the computation gets dirty again.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const ERRORED: any = /* @__PURE__ */ Symbol('ERRORED');\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst COMPUTED_NODE = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n kind: 'computed',\n\n producerMustRecompute(node: ComputedNode<unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: ComputedNode<unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',\n );\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n let wasEqual = false;\n try {\n newValue = node.computation();\n // We want to mark this node as errored if calling `equal` throws; however, we don't want\n // to track any reactive reads inside `equal`.\n setActiveConsumer(null);\n wasEqual =\n oldValue !== UNSET &&\n oldValue !== ERRORED &&\n newValue !== ERRORED &&\n node.equal(oldValue, newValue);\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (wasEqual) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {SignalNode} from './signal';\n\nfunction defaultThrowError(): never {\n throw new Error();\n}\n\nlet throwInvalidWriteToSignalErrorFn: <T>(node: SignalNode<T>) => never = defaultThrowError;\n\nexport function throwInvalidWriteToSignalError<T>(node: SignalNode<T>) {\n throwInvalidWriteToSignalErrorFn(node);\n}\n\nexport function setThrowInvalidWriteToSignalError(fn: <T>(node: SignalNode<T>) => never): void {\n throwInvalidWriteToSignalErrorFn = fn;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {throwInvalidWriteToSignalError} from './errors';\nimport {\n producerAccessed,\n producerIncrementEpoch,\n producerNotifyConsumers,\n producerUpdatesAllowed,\n REACTIVE_NODE,\n ReactiveNode,\n ReactiveHookFn,\n runPostProducerCreatedFn,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * If set, called after `WritableSignal`s are updated.\n *\n * This hook can be used to achieve various effects, such as running effects synchronously as part\n * of setting a signal.\n */\nlet postSignalSetFn: ReactiveHookFn | null = null;\n\nexport interface SignalNode<T> extends ReactiveNode {\n value: T;\n equal: ValueEqualityFn<T>;\n}\n\nexport type SignalBaseGetter<T> = (() => T) & {readonly [SIGNAL]: unknown};\nexport type SignalSetter<T> = (newValue: T) => void;\nexport type SignalUpdater<T> = (updateFn: (value: T) => T) => void;\n\n// Note: Closure *requires* this to be an `interface` and not a type, which is why the\n// `SignalBaseGetter` type exists to provide the correct shape.\nexport interface SignalGetter<T> extends SignalBaseGetter<T> {\n readonly [SIGNAL]: SignalNode<T>;\n}\n\n/**\n * Creates a `Signal` getter, setter, and updater function.\n */\nexport function createSignal<T>(\n initialValue: T,\n equal?: ValueEqualityFn<T>,\n): [SignalGetter<T>, SignalSetter<T>, SignalUpdater<T>] {\n const node: SignalNode<T> = Object.create(SIGNAL_NODE);\n node.value = initialValue;\n if (equal !== undefined) {\n node.equal = equal;\n }\n const getter = (() => signalGetFn(node)) as SignalGetter<T>;\n (getter as any)[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n const debugName = node.debugName ? ' (' + node.debugName + ')' : '';\n getter.toString = () => `[Signal${debugName}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n const set = (newValue: T) => signalSetFn(node, newValue);\n const update = (updateFn: (value: T) => T) => signalUpdateFn(node, updateFn);\n return [getter, set, update];\n}\n\nexport function setPostSignalSetFn(fn: ReactiveHookFn | null): ReactiveHookFn | null {\n const prev = postSignalSetFn;\n postSignalSetFn = fn;\n return prev;\n}\n\nexport function signalGetFn<T>(node: SignalNode<T>): T {\n producerAccessed(node);\n return node.value;\n}\n\nexport function signalSetFn<T>(node: SignalNode<T>, newValue: T) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError(node);\n }\n\n if (!node.equal(node.value, newValue)) {\n node.value = newValue;\n signalValueChanged(node);\n }\n}\n\nexport function signalUpdateFn<T>(node: SignalNode<T>, updater: (value: T) => T): void {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError(node);\n }\n\n signalSetFn(node, updater(node.value));\n}\n\nexport function runPostSignalSetFn<T>(node: SignalNode<T>): void {\n postSignalSetFn?.(node);\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nexport const SIGNAL_NODE: SignalNode<unknown> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n equal: defaultEquals,\n value: undefined,\n kind: 'signal',\n };\n})();\n\nfunction signalValueChanged<T>(node: SignalNode<T>): void {\n node.version++;\n producerIncrementEpoch();\n producerNotifyConsumers(node);\n postSignalSetFn?.(node);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {setActiveConsumer} from './graph';\n\n/**\n * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function\n * can, optionally, return a value.\n */\nexport function untracked<T>(nonReactiveReadsFn: () => T): T {\n const prevConsumer = setActiveConsumer(null);\n // We are not trying to catch any particular errors here, just making sure that the consumers\n // stack is restored in case of errors.\n try {\n return nonReactiveReadsFn();\n } finally {\n setActiveConsumer(prevConsumer);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerPollProducersForChange,\n REACTIVE_NODE,\n ReactiveNode,\n} from './graph';\n\n/**\n * An effect can, optionally, register a cleanup function. If registered, the cleanup is executed\n * before the next effect run. The cleanup function makes it possible to \"cancel\" any work that the\n * previous effect run might have started.\n */\nexport type EffectCleanupFn = () => void;\n\n/**\n * A callback passed to the effect function that makes it possible to register cleanup logic.\n */\nexport type EffectCleanupRegisterFn = (cleanupFn: EffectCleanupFn) => void;\n\nexport interface BaseEffectNode extends ReactiveNode {\n fn: () => void;\n destroy(): void;\n cleanup(): void;\n run(): void;\n}\n\nexport const BASE_EFFECT_NODE: Omit<BaseEffectNode, 'fn' | 'destroy' | 'cleanup' | 'run'> =\n /* @__PURE__ */ (() => ({\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: true,\n dirty: true,\n kind: 'effect',\n }))();\n\nexport function runEffect(node: BaseEffectNode) {\n node.dirty = false;\n if (node.version > 0 && !consumerPollProducersForChange(node)) {\n return;\n }\n node.version++;\n const prevNode = consumerBeforeComputation(node);\n try {\n node.cleanup();\n node.fn();\n } finally {\n consumerAfterComputation(node, prevNode);\n }\n}\n"],"names":["activeConsumer","inNotificationPhase","epoch","postProducerCreatedFn","SIGNAL","Symbol","setActiveConsumer","consumer","prev","getActiveConsumer","isInNotificationPhase","isReactive","value","undefined","REACTIVE_NODE","version","lastCleanEpoch","dirty","producers","producersTail","consumers","consumersTail","recomputing","consumerAllowSignalWrites","consumerIsAlwaysLive","kind","producerMustRecompute","producerRecomputeValue","consumerMarkedDirty","consumerOnSignalRead","producerAccessed","node","Error","ngDevMode","prevProducerLink","producer","nextProducerLink","isRecomputing","nextProducer","lastReadVersion","prevConsumerLink","isValidLink","isLive","consumerIsLive","newLink","prevConsumer","nextConsumer","producerAddLiveConsumer","producerIncrementEpoch","producerUpdateValueVersion","consumerPollProducersForChange","producerMarkClean","producerNotifyConsumers","link","consumerMarkDirty","producerUpdatesAllowed","consumerBeforeComputation","resetConsumerBeforeComputation","consumerAfterComputation","finalizeConsumerAfterComputation","toRemove","producerRemoveLiveConsumerLink","seenVersion","consumerDestroy","wasLive","producerLink","runPostProducerCreatedFn","setPostProducerCreatedFn","fn","checkLink","defaultEquals","a","b","Object","is","createComputed","computation","equal","create","COMPUTED_NODE","computed","ERRORED","error","debugName","toString","String","UNSET","COMPUTING","oldValue","newValue","wasEqual","err","defaultThrowError","throwInvalidWriteToSignalErrorFn","throwInvalidWriteToSignalError","setThrowInvalidWriteToSignalError","postSignalSetFn","createSignal","initialValue","SIGNAL_NODE","getter","signalGetFn","set","signalSetFn","update","updateFn","signalUpdateFn","setPostSignalSetFn","signalValueChanged","updater","runPostSignalSetFn","untracked","nonReactiveReadsFn","BASE_EFFECT_NODE","runEffect","prevNode","cleanup"],"mappings":";;;;;;AAiBA,IAAIA,cAAc,GAAwB,IAAI;AAC9C,IAAIC,mBAAmB,GAAG,KAAK;AAO/B,IAAIC,KAAK,GAAY,CAAY;AAOjC,IAAIC,qBAAqB,GAA0B,IAAI;MAO1CC,MAAM,kBAAkCC,MAAM,CAAC,QAAQ;AAE9D,SAAUC,iBAAiBA,CAACC,QAA6B,EAAA;EAC7D,MAAMC,IAAI,GAAGR,cAAc;AAC3BA,EAAAA,cAAc,GAAGO,QAAQ;AACzB,EAAA,OAAOC,IAAI;AACb;SAEgBC,iBAAiBA,GAAA;AAC/B,EAAA,OAAOT,cAAc;AACvB;SAEgBU,qBAAqBA,GAAA;AACnC,EAAA,OAAOT,mBAAmB;AAC5B;AAMM,SAAUU,UAAUA,CAACC,KAAc,EAAA;AACvC,EAAA,OAAQA,KAA2B,CAACR,MAAM,CAAC,KAAKS,SAAS;AAC3D;AAEO,MAAMC,aAAa,GAAiB;AACzCC,EAAAA,OAAO,EAAE,CAAY;AACrBC,EAAAA,cAAc,EAAE,CAAY;AAC5BC,EAAAA,KAAK,EAAE,KAAK;AACZC,EAAAA,SAAS,EAAEL,SAAS;AACpBM,EAAAA,aAAa,EAAEN,SAAS;AACxBO,EAAAA,SAAS,EAAEP,SAAS;AACpBQ,EAAAA,aAAa,EAAER,SAAS;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oE,MAAAA,gBAAgB,kBACX,CAAC,OAAO;AACtB,EAAA,GAAGnG,aAAa;AAChBU,EAAAA,oBAAoB,EAAE,IAAI;AAC1BD,EAAAA,yBAAyB,EAAE,IAAI;AAC/BN,EAAAA,KAAK,EAAE,IAAI;AACXQ,EAAAA,IAAI,EAAE;CACP,CAAC;AAEE,SAAUyF,SAASA,CAACnF,IAAoB,EAAA;EAC5CA,IAAI,CAACd,KAAK,GAAG,KAAK;EAClB,IAAIc,IAAI,CAAChB,OAAO,GAAG,CAAC,IAAI,CAACmC,8BAA8B,CAACnB,IAAI,CAAC,EAAE;AAC7D,IAAA;AACF;EACAA,IAAI,CAAChB,OAAO,EAAE;AACd,EAAA,MAAMoG,QAAQ,GAAG3D,yBAAyB,CAACzB,IAAI,CAAC;EAChD,IAAI;IACFA,IAAI,CAACqF,OAAO,EAAE;IACdrF,IAAI,CAACqC,EAAE,EAAE;AACX,GAAA,SAAU;AACRV,IAAAA,wBAAwB,CAAC3B,IAAI,EAAEoF,QAAQ,CAAC;AAC1C;AACF;;;;"}
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @license Angular v21.1.3
2
+ * @license Angular v21.2.0-next.1
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { SIGNAL, runPostProducerCreatedFn, producerUpdateValueVersion, signalSetFn, producerMarkClean, ERRORED, signalUpdateFn, REACTIVE_NODE, UNSET, defaultEquals, COMPUTING, consumerBeforeComputation, consumerAfterComputation, producerAccessed } from './_effect-chunk.mjs';
7
+ import { SIGNAL, runPostProducerCreatedFn, producerUpdateValueVersion, signalSetFn, producerMarkClean, signalUpdateFn, REACTIVE_NODE, UNSET, defaultEquals, COMPUTING, consumerBeforeComputation, ERRORED, consumerAfterComputation, producerAccessed } from './_effect-chunk.mjs';
8
8
 
9
9
  function createLinkedSignal(sourceFn, computationFn, equalityFn) {
10
10
  const node = Object.create(LINKED_SIGNAL_NODE);
@@ -37,9 +37,6 @@ function linkedSignalSetFn(node, newValue) {
37
37
  }
38
38
  function linkedSignalUpdateFn(node, updater) {
39
39
  producerUpdateValueVersion(node);
40
- if (node.value === ERRORED) {
41
- throw node.error;
42
- }
43
40
  signalUpdateFn(node, updater);
44
41
  producerMarkClean(node);
45
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"_linked_signal-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/linked_signal.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {COMPUTING, ERRORED, UNSET} from './computed';\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerMarkClean,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n runPostProducerCreatedFn,\n SIGNAL,\n} from './graph';\nimport {signalSetFn, signalUpdateFn} from './signal';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\nexport type ComputationFn<S, D> = (source: S, previous?: PreviousValue<S, D>) => D;\nexport type PreviousValue<S, D> = {source: S; value: D};\n\nexport interface LinkedSignalNode<S, D> extends ReactiveNode {\n /**\n * Value of the source signal that was used to derive the computed value.\n */\n sourceValue: S;\n\n /**\n * Current state value, or one of the sentinel values (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: D;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The source function represents reactive dependency based on which the linked state is reset.\n */\n source: () => S;\n\n /**\n * The computation function which will produce a new value based on the source and, optionally - previous values.\n */\n computation: ComputationFn<S, D>;\n\n equal: ValueEqualityFn<D>;\n}\n\nexport type LinkedSignalGetter<S, D> = (() => D) & {\n [SIGNAL]: LinkedSignalNode<S, D>;\n};\n\nexport function createLinkedSignal<S, D>(\n sourceFn: () => S,\n computationFn: ComputationFn<S, D>,\n equalityFn?: ValueEqualityFn<D>,\n): LinkedSignalGetter<S, D> {\n const node: LinkedSignalNode<S, D> = Object.create(LINKED_SIGNAL_NODE);\n\n node.source = sourceFn;\n node.computation = computationFn;\n if (equalityFn != undefined) {\n node.equal = equalityFn;\n }\n\n const linkedSignalGetter = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n\n const getter = linkedSignalGetter as LinkedSignalGetter<S, D>;\n getter[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n const debugName = node.debugName ? ' (' + node.debugName + ')' : '';\n getter.toString = () => `[LinkedSignal${debugName}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n\n return getter;\n}\n\nexport function linkedSignalSetFn<S, D>(node: LinkedSignalNode<S, D>, newValue: D) {\n producerUpdateValueVersion(node);\n signalSetFn(node, newValue);\n producerMarkClean(node);\n}\n\nexport function linkedSignalUpdateFn<S, D>(\n node: LinkedSignalNode<S, D>,\n updater: (value: D) => D,\n): void {\n producerUpdateValueVersion(node);\n // update() on a linked signal can't work if the current state is ERRORED, as there's no value.\n if (node.value === ERRORED) {\n throw node.error;\n }\n signalUpdateFn(node, updater);\n producerMarkClean(node);\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nexport const LINKED_SIGNAL_NODE: object = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n kind: 'linkedSignal',\n\n producerMustRecompute(node: LinkedSignalNode<unknown, unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: LinkedSignalNode<unknown, unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',\n );\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n try {\n const newSourceValue = node.source();\n const prev =\n oldValue === UNSET || oldValue === ERRORED\n ? undefined\n : {\n source: node.sourceValue,\n value: oldValue,\n };\n newValue = node.computation(newSourceValue, prev);\n node.sourceValue = newSourceValue;\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n"],"names":["createLinkedSignal","sourceFn","computationFn","equalityFn","node","Object","create","LINKED_SIGNAL_NODE","source","computation","undefined","equal","linkedSignalGetter","producerUpdateValueVersion","producerAccessed","value","ERRORED","error","getter","SIGNAL","ngDevMode","debugName","toString","String","runPostProducerCreatedFn","linkedSignalSetFn","newValue","signalSetFn","producerMarkClean","linkedSignalUpdateFn","updater","signalUpdateFn","REACTIVE_NODE","UNSET","dirty","defaultEquals","kind","producerMustRecompute","COMPUTING","producerRecomputeValue","Error","oldValue","prevConsumer","consumerBeforeComputation","newSourceValue","prev","sourceValue","err","consumerAfterComputation","version"],"mappings":";;;;;;;;SAiEgBA,kBAAkBA,CAChCC,QAAiB,EACjBC,aAAkC,EAClCC,UAA+B,EAAA;AAE/B,EAAA,MAAMC,IAAI,GAA2BC,MAAM,CAACC,MAAM,CAACC,kBAAkB,CAAC;EAEtEH,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jDzC,IAAI,CAAC0C,WAAW,GAAGF,cAAc;OACnC,CAAE,OAAOG,GAAG,EAAE;AACZrB,QAAAA,QAAQ,GAAGV,OAAO;QAClBZ,IAAI,CAACa,KAAK,GAAG8B,GAAG;AAClB,OAAA,SAAU;AACRC,QAAAA,wBAAwB,CAAC5C,IAAI,EAAEsC,YAAY,CAAC;AAC9C;AAEA,MAAA,IAAID,QAAQ,KAAKR,KAAK,IAAIP,QAAQ,KAAKV,OAAO,IAAIZ,IAAI,CAACO,KAAK,CAAC8B,QAAQ,EAAEf,QAAQ,CAAC,EAAE;QAGhFtB,IAAI,CAACW,KAAK,GAAG0B,QAAQ;AACrB,QAAA;AACF;MAEArC,IAAI,CAACW,KAAK,GAAGW,QAAQ;MACrBtB,IAAI,CAAC6C,OAAO,EAAE;AAChB;GACD;AACH,CAAC,GAAG;;;;"}
1
+ {"version":3,"file":"_linked_signal-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/linked_signal.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {COMPUTING, ERRORED, UNSET} from './computed';\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerMarkClean,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n runPostProducerCreatedFn,\n SIGNAL,\n} from './graph';\nimport {signalSetFn, signalUpdateFn} from './signal';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\nexport type ComputationFn<S, D> = (source: S, previous?: PreviousValue<S, D>) => D;\nexport type PreviousValue<S, D> = {source: S; value: D};\n\nexport interface LinkedSignalNode<S, D> extends ReactiveNode {\n /**\n * Value of the source signal that was used to derive the computed value.\n */\n sourceValue: S;\n\n /**\n * Current state value, or one of the sentinel values (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: D;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The source function represents reactive dependency based on which the linked state is reset.\n */\n source: () => S;\n\n /**\n * The computation function which will produce a new value based on the source and, optionally - previous values.\n */\n computation: ComputationFn<S, D>;\n\n equal: ValueEqualityFn<D>;\n}\n\nexport type LinkedSignalGetter<S, D> = (() => D) & {\n [SIGNAL]: LinkedSignalNode<S, D>;\n};\n\nexport function createLinkedSignal<S, D>(\n sourceFn: () => S,\n computationFn: ComputationFn<S, D>,\n equalityFn?: ValueEqualityFn<D>,\n): LinkedSignalGetter<S, D> {\n const node: LinkedSignalNode<S, D> = Object.create(LINKED_SIGNAL_NODE);\n\n node.source = sourceFn;\n node.computation = computationFn;\n if (equalityFn != undefined) {\n node.equal = equalityFn;\n }\n\n const linkedSignalGetter = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n\n const getter = linkedSignalGetter as LinkedSignalGetter<S, D>;\n getter[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n const debugName = node.debugName ? ' (' + node.debugName + ')' : '';\n getter.toString = () => `[LinkedSignal${debugName}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n\n return getter;\n}\n\nexport function linkedSignalSetFn<S, D>(node: LinkedSignalNode<S, D>, newValue: D) {\n producerUpdateValueVersion(node);\n signalSetFn(node, newValue);\n producerMarkClean(node);\n}\n\nexport function linkedSignalUpdateFn<S, D>(\n node: LinkedSignalNode<S, D>,\n updater: (value: D) => D,\n): void {\n producerUpdateValueVersion(node);\n signalUpdateFn(node, updater);\n producerMarkClean(node);\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nexport const LINKED_SIGNAL_NODE: object = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n kind: 'linkedSignal',\n\n producerMustRecompute(node: LinkedSignalNode<unknown, unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: LinkedSignalNode<unknown, unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',\n );\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n try {\n const newSourceValue = node.source();\n const prev =\n oldValue === UNSET || oldValue === ERRORED\n ? undefined\n : {\n source: node.sourceValue,\n value: oldValue,\n };\n newValue = node.computation(newSourceValue, prev);\n node.sourceValue = newSourceValue;\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n"],"names":["createLinkedSignal","sourceFn","computationFn","equalityFn","node","Object","create","LINKED_SIGNAL_NODE","source","computation","undefined","equal","linkedSignalGetter","producerUpdateValueVersion","producerAccessed","value","ERRORED","error","getter","SIGNAL","ngDevMode","debugName","toString","String","runPostProducerCreatedFn","linkedSignalSetFn","newValue","signalSetFn","producerMarkClean","linkedSignalUpdateFn","updater","signalUpdateFn","REACTIVE_NODE","UNSET","dirty","defaultEquals","kind","producerMustRecompute","COMPUTING","producerRecomputeValue","Error","oldValue","prevConsumer","consumerBeforeComputation","newSourceValue","prev","sourceValue","err","consumerAfterComputation","version"],"mappings":";;;;;;;;SAiEgBA,kBAAkBA,CAChCC,QAAiB,EACjBC,aAAkC,EAClCC,UAA+B,EAAA;AAE/B,EAAA,MAAMC,IAAI,GAA2BC,MAAM,CAACC,MAAM,CAACC,kBAAkB,CAAC;EAEtEH,IAAI,CAACI,MAAM,GAAGP,QAAQ;EACtBG,IAAI,CAACK,WAAW,GAAGP,aAAa;EAChC,IAAIC,UAAU,IAAIO,SAAS,EAAE;IAC3BN,IAAI,CAACO,KAAK,GAAGR,UAAU;AACzB;EAEA,MAAMS,kBAAkB,GAAGA,MAAK;IAE9BC,0BAA0B,CAACT,IAAI,CAAC;IAGhCU,gBAAgB,CAACV,IAAI,CAAC;AAEtB,IAAA,IAAIA,IAAI,CAACW,KAAK,KAAKC,OAAO,EAAE;MAC1B,MAAMZ,IAAI,CAACa,KAAK;AAClB;IAEA,OAAOb,IAAI,CAACW,KAAK;GAClB;EAED,MAAMG,MAAM,GAAGN,kBAA8C;AAC7DM,EAAAA,MAAM,CAACC,MAAM,CAAC,GAAGf,IAAI;AACrB,EAAA,IAAI,OAAOgB,SAAS,KAAK,WAAW,IAAIA,SAAS,EAAE;AACjD,IAAA,MAAMC,SAAS,GAAGjB,IAAI,CAACiB,SAAS,GAAG,IAAI,GAAGjB,IAAI,CAACiB,SAAS,GAAG,GAAG,GAAG,EAAE;AACnEH,IAAAA,MAAM,CAACI,QAAQ,GAAG,MAAM,CAAgBD,aAAAA,EAAAA,SAAS,CAAKE,EAAAA,EAAAA,MAAM,CAACnB,IAAI,CAACW,KAAK,CAAC,CAAG,CAAA,CAAA;AAC7E;EAEAS,wBAAwB,CAACpB,IAAI,CAAC;AAE9B,EAAA,OAAOc,MAAM;AACf;AAEgB,SAAAO,iBAAiBA,CAAOrB,IAA4B,EAAEsB,QAAW,EAAA;EAC/Eb,0BAA0B,CAACT,IA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N,SAAS,GACT;UACEF,MAAM,EAAEJ,IAAI,CAAC0C,WAAW;AACxB/B,UAAAA,KAAK,EAAE0B;SACR;QACPf,QAAQ,GAAGtB,IAAI,CAACK,WAAW,CAACmC,cAAc,EAAEC,IAAI,CAAC;QACjDzC,IAAI,CAAC0C,WAAW,GAAGF,cAAc;OACnC,CAAE,OAAOG,GAAG,EAAE;AACZrB,QAAAA,QAAQ,GAAGV,OAAO;QAClBZ,IAAI,CAACa,KAAK,GAAG8B,GAAG;AAClB,OAAA,SAAU;AACRC,QAAAA,wBAAwB,CAAC5C,IAAI,EAAEsC,YAAY,CAAC;AAC9C;AAEA,MAAA,IAAID,QAAQ,KAAKR,KAAK,IAAIP,QAAQ,KAAKV,OAAO,IAAIZ,IAAI,CAACO,KAAK,CAAC8B,QAAQ,EAAEf,QAAQ,CAAC,EAAE;QAGhFtB,IAAI,CAACW,KAAK,GAAG0B,QAAQ;AACrB,QAAA;AACF;MAEArC,IAAI,CAACW,KAAK,GAAGW,QAAQ;MACrBtB,IAAI,CAAC6C,OAAO,EAAE;AAChB;GACD;AACH,CAAC,GAAG;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.3
2
+ * @license Angular v21.2.0-next.1
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"_not_found-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/injector.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/not_found.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Constructor, InjectionToken} from './injection_token';\nimport {NotFound} from './not_found';\n\nexport interface Injector {\n retrieve<T>(token: InjectionToken<T>, options?: unknown): T | NotFound;\n}\n\n/**\n * Current injector value used by `inject`.\n * - `undefined`: it is an error to call `inject`\n * - `null`: `inject` can be called but there is no injector (limp-mode).\n * - Injector instance: Use the injector for resolution.\n */\nlet _currentInjector: Injector | undefined | null = undefined;\n\nexport function getCurrentInjector(): Injector | undefined | null {\n return _currentInjector;\n}\n\nexport function setCurrentInjector(\n injector: Injector | null | undefined,\n): Injector | undefined | null {\n const former = _currentInjector;\n _currentInjector = injector;\n return former;\n}\n\nexport function inject<T>(token: InjectionToken<T> | Constructor<T>): T;\nexport function inject<T>(\n token: InjectionToken<T> | Constructor<T>,\n options?: unknown,\n): T | NotFound {\n const currentInjector = getCurrentInjector();\n if (!currentInjector) {\n throw new Error('Current injector is not set.');\n }\n if (!(token as InjectionToken<T>).ɵprov) {\n throw new Error('Token is not an injectable');\n }\n return currentInjector.retrieve(token as InjectionToken<T>, options);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Value returned if the key-value pair couldn't be found in the context\n * hierarchy.\n */\nexport const NOT_FOUND: unique symbol = Symbol('NotFound');\n\n/**\n * Error thrown when the key-value pair couldn't be found in the context\n * hierarchy. Context can be attached below.\n */\nexport class NotFoundError extends Error {\n override readonly name: string = 'ɵNotFound';\n constructor(message: string) {\n super(message);\n }\n}\n\n/**\n * Type guard for checking if an unknown value is a NotFound.\n */\nexport function isNotFound(e: unknown): e is NotFound {\n return e === NOT_FOUND || (e as NotFoundError)?.name === 'ɵNotFound';\n}\n\n/**\n * Type union of NotFound and NotFoundError.\n */\nexport type NotFound = typeof NOT_FOUND | NotFoundError;\n"],"names":["_currentInjector","undefined","getCurrentInjector","setCurrentInjector","injector","former","inject","token","options","currentInjector","Error","ɵprov","retrieve","NOT_FOUND","Symbol","NotFoundError","name","constructor","message","isNotFound","e"],"mappings":";;;;;;AAqBA,IAAIA,gBAAgB,GAAgCC,SAAS;SAE7CC,kBAAkBA,GAAA;AAChC,EAAA,OAAOF,gBAAgB;AACzB;AAEM,SAAUG,kBAAkBA,CAChCC,QAAqC,EAAA;EAErC,MAAMC,MAAM,GAAGL,gBAAgB;AAC/BA,EAAAA,gBAAgB,GAAGI,QAAQ;AAC3B,EAAA,OAAOC,MAAM;AACf;AAGgB,SAAAC,MAAMA,CACpBC,KAAyC,EACzCC,OAAiB,EAAA;AAEjB,EAAA,MAAMC,eAAe,GAAGP,kBAAkB,EAAE;EAC5C,IAAI,CAACO,eAAe,EAAE;AACpB,IAAA,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC;AACjD;AACA,EAAA,IAAI,CAAEH,KAA2B,CAACI,KAAK,EAAE;AACvC,IAAA,MAAM,IAAID,KAAK,CAAC,4BAA4B,CAAC;AAC/C;AACA,EAAA,OAAOD,eAAe,CAACG,QAAQ,CAACL,KAA0B,EAAEC,OAAO,CAAC;AACtE;;MCpCaK,SAAS,GAAkBC,MAAM,CAAC,UAAU;AAMnD,MAAOC,aAAc,SAAQL,KAAK,CAAA;AACpBM,EAAAA,IAAI,GAAW,WAAW;EAC5CC,WAAAA,CAAYC,OAAe,EAAA;IACzB,KAAK,CAACA,OAAO,CAAC;AAChB;AACD;AAKK,SAAUC,UAAUA,CAACC,CAAU,EAAA;EACnC,OAAOA,CAAC,KAAKP,SAAS,IAAKO,CAAmB,EAAEJ,IAAI,KAAK,WAAW;AACtE;;;;"}
1
+ {"version":3,"file":"_not_found-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/injector.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/not_found.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Constructor, InjectionToken} from './injection_token';\nimport {NotFound} from './not_found';\n\nexport interface Injector {\n retrieve<T>(token: InjectionToken<T>, options?: unknown): T | NotFound;\n}\n\n/**\n * Current injector value used by `inject`.\n * - `undefined`: it is an error to call `inject`\n * - `null`: `inject` can be called but there is no injector (limp-mode).\n * - Injector instance: Use the injector for resolution.\n */\nlet _currentInjector: Injector | undefined | null = undefined;\n\nexport function getCurrentInjector(): Injector | undefined | null {\n return _currentInjector;\n}\n\nexport function setCurrentInjector(\n injector: Injector | null | undefined,\n): Injector | undefined | null {\n const former = _currentInjector;\n _currentInjector = injector;\n return former;\n}\n\nexport function inject<T>(token: InjectionToken<T> | Constructor<T>): T;\nexport function inject<T>(\n token: InjectionToken<T> | Constructor<T>,\n options?: unknown,\n): T | NotFound {\n const currentInjector = getCurrentInjector();\n if (!currentInjector) {\n throw new Error('Current injector is not set.');\n }\n if (!(token as InjectionToken<T>).ɵprov) {\n throw new Error('Token is not an injectable');\n }\n return currentInjector.retrieve(token as InjectionToken<T>, options);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Value returned if the key-value pair couldn't be found in the context\n * hierarchy.\n */\nexport const NOT_FOUND: unique symbol = Symbol('NotFound');\n\n/**\n * Error thrown when the key-value pair couldn't be found in the context\n * hierarchy. Context can be attached below.\n */\nexport class NotFoundError extends Error {\n override readonly name: string = 'ɵNotFound';\n constructor(message: string) {\n super(message);\n }\n}\n\n/**\n * Type guard for checking if an unknown value is a NotFound.\n */\nexport function isNotFound(e: unknown): e is NotFound {\n return e === NOT_FOUND || (e as NotFoundError)?.name === 'ɵNotFound';\n}\n\n/**\n * Type union of NotFound and NotFoundError.\n */\nexport type NotFound = typeof NOT_FOUND | NotFoundError;\n"],"names":["_currentInjector","undefined","getCurrentInjector","setCurrentInjector","injector","former","inject","token","options","currentInjector","Error","ɵprov","retrieve","NOT_FOUND","Symbol","NotFoundError","name","constructor","message","isNotFound","e"],"mappings":";;;;;;AAqBA,IAAIA,gBAAgB,GAAgCC,SAAS;SAE7CC,kBAAkBA,GAAA;AAChC,EAAA,OAAOF,gBAAgB;AACzB;AAEM,SAAUG,kBAAkBA,CAChCC,QAAqC,EAAA;EAErC,MAAMC,MAAM,GAAGL,gBAAgB;AAC/BA,EAAAA,gBAAgB,GAAGI,QAAQ;AAC3B,EAAA,OAAOC,MAAM;AACf;AAGgB,SAAAC,MAAMA,CACpBC,KAAyC,EACzCC,OAAiB,EAAA;AAEjB,EAAA,MAAMC,eAAe,GAAGP,kBAAkB,EAAE;EAC5C,IAAI,CAACO,eAAe,EAAE;AACpB,IAAA,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC;AACjD;AACA,EAAA,IAAI,CAAEH,KAA2B,CAACI,KAAK,EAAE;AACvC,IAAA,MAAM,IAAID,KAAK,CAAC,4BAA4B,CAAC;AAC/C;AACA,EAAA,OAAOD,eAAe,CAACG,QAAQ,CAACL,KAA0B,EAAEC,OAAO,CAAC;AACtE;;MCpCaK,SAAS,GAAkBC,MAAM,CAAC,UAAU;AAMnD,MAAOC,aAAc,SAAQL,KAAK,CAAA;AACpBM,EAAAA,IAAI,GAAW,WAAW;EAC5CC,WAAAA,CAAYC,OAAe,EAAA;IACzB,KAAK,CAACA,OAAO,CAAC;AAChB;AACD;AAKK,SAAUC,UAAUA,CAACC,CAAU,EAAA;EACnC,OAAOA,CAAC,KAAKP,SAAS,IAAKO,CAAmB,EAAEJ,IAAI,KAAK,WAAW;AACtE;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.3
2
+ * @license Angular v21.2.0-next.1
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -121,6 +121,23 @@ class BaseWritableResource {
121
121
  }
122
122
  return this.value() !== undefined;
123
123
  });
124
+ _snapshot;
125
+ get snapshot() {
126
+ return this._snapshot ??= computed(() => {
127
+ const status = this.status();
128
+ if (status === 'error') {
129
+ return {
130
+ status: 'error',
131
+ error: this.error()
132
+ };
133
+ } else {
134
+ return {
135
+ status,
136
+ value: this.value()
137
+ };
138
+ }
139
+ });
140
+ }
124
141
  hasValue() {
125
142
  return this.isValueDefined();
126
143
  }
@@ -382,5 +399,5 @@ class ResourceWrappedError extends Error {
382
399
  }
383
400
  }
384
401
 
385
- export { OutputEmitterRef, ResourceImpl, computed, encapsulateResourceError, getOutputDestroyRef, linkedSignal, resource };
402
+ export { OutputEmitterRef, ResourceImpl, ResourceValueError, computed, encapsulateResourceError, getOutputDestroyRef, linkedSignal, resource };
386
403
  //# sourceMappingURL=_resource-chunk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"_resource-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/output/output_emitter_ref.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/computed.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/linked_signal.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/resource/resource.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {setActiveConsumer} from '../../../primitives/signals';\n\nimport {inject} from '../../di/injector_compatibility';\nimport {ErrorHandler} from '../../error_handler';\nimport {formatRuntimeError, RuntimeError, RuntimeErrorCode} from '../../errors';\nimport {DestroyRef} from '../../linker/destroy_ref';\n\nimport {OutputRef, OutputRefSubscription} from './output_ref';\n\n/**\n * An `OutputEmitterRef` is created by the `output()` function and can be\n * used to emit values to consumers of your directive or component.\n *\n * Consumers of your directive/component can bind to the output and\n * subscribe to changes via the bound event syntax. For example:\n *\n * ```html\n * <my-comp (valueChange)=\"processNewValue($event)\" />\n * ```\n *\n * @see [Custom events with outputs](guide/components/outputs)\n *\n * @publicAPI\n */\nexport class OutputEmitterRef<T> implements OutputRef<T> {\n private destroyed = false;\n private listeners: Array<(value: T) => void> | null = null;\n private errorHandler = inject(ErrorHandler, {optional: true});\n\n /** @internal */\n destroyRef: DestroyRef = inject(DestroyRef);\n\n constructor() {\n // Clean-up all listeners and mark as destroyed upon destroy.\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.listeners = null;\n });\n }\n\n subscribe(callback: (value: T) => void): OutputRefSubscription {\n if (this.destroyed) {\n throw new RuntimeError(\n RuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected subscription to destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n );\n }\n\n (this.listeners ??= []).push(callback);\n\n return {\n unsubscribe: () => {\n const idx = this.listeners?.indexOf(callback);\n if (idx !== undefined && idx !== -1) {\n this.listeners?.splice(idx, 1);\n }\n },\n };\n }\n\n /** Emits a new value to the output. */\n emit(value: T): void {\n if (this.destroyed) {\n console.warn(\n formatRuntimeError(\n RuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected emit for destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n ),\n );\n return;\n }\n\n if (this.listeners === null) {\n return;\n }\n\n const previousConsumer = setActiveConsumer(null);\n try {\n for (const listenerFn of this.listeners) {\n try {\n listenerFn(value);\n } catch (err: unknown) {\n this.errorHandler?.handleError(err);\n }\n }\n } finally {\n setActiveConsumer(previousConsumer);\n }\n }\n}\n\n/** Gets the owning `DestroyRef` for the given output. */\nexport function getOutputDestroyRef(ref: OutputRef<unknown>): DestroyRef | undefined {\n return ref.destroyRef;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {createComputed, SIGNAL} from '../../../primitives/signals';\n\nimport {Signal, ValueEqualityFn} from './api';\n\n/**\n * Options passed to the `computed` creation function.\n */\nexport interface CreateComputedOptions<T> {\n /**\n * A comparison function which defines equality for computed values.\n */\n equal?: ValueEqualityFn<T>;\n\n /**\n * A debug name for the computed signal. Used in Angular DevTools to identify the signal.\n */\n debugName?: string;\n}\n\n/**\n * Create a computed `Signal` which derives a reactive value from an expression.\n * @see [Computed signals](guide/signals#computed-signals)\n */\nexport function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T> {\n const getter = createComputed(computation, options?.equal);\n\n if (ngDevMode) {\n getter.toString = () => `[Computed: ${getter()}]`;\n getter[SIGNAL].debugName = options?.debugName;\n }\n\n return getter;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n ComputationFn,\n createLinkedSignal,\n LinkedSignalGetter,\n LinkedSignalNode,\n linkedSignalSetFn,\n linkedSignalUpdateFn,\n SIGNAL,\n} from '../../../primitives/signals';\nimport {Signal, ValueEqualityFn} from './api';\nimport {signalAsReadonlyFn, WritableSignal} from './signal';\n\nconst identityFn = <T>(v: T) => v;\n\n/**\n * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.\n *\n * @publicApi 20.0\n */\nexport function linkedSignal<D>(\n computation: () => D,\n options?: {equal?: ValueEqualityFn<NoInfer<D>>; debugName?: string},\n): WritableSignal<D>;\n\n/**\n * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.\n * This is an advanced API form where the computation has access to the previous value of the signal and the computation result.\n *\n * Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.\n *\n * @publicApi 20.0\n * @see [Dependent state with linkedSignal](guide/signals/linked-signal)\n */\nexport function linkedSignal<S, D>(options: {\n source: () => S;\n computation: (source: NoInfer<S>, previous?: {source: NoInfer<S>; value: NoInfer<D>}) => D;\n equal?: ValueEqualityFn<NoInfer<D>>;\n debugName?: string;\n}): WritableSignal<D>;\n\nexport function linkedSignal<S, D>(\n optionsOrComputation:\n | {\n source: () => S;\n computation: ComputationFn<S, D>;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n }\n | (() => D),\n options?: {equal?: ValueEqualityFn<D>; debugName?: string},\n): WritableSignal<D> {\n if (typeof optionsOrComputation === 'function') {\n const getter = createLinkedSignal<D, D>(\n optionsOrComputation,\n identityFn<D>,\n options?.equal,\n ) as LinkedSignalGetter<D, D> & WritableSignal<D>;\n return upgradeLinkedSignalGetter(getter, options?.debugName);\n } else {\n const getter = createLinkedSignal<S, D>(\n optionsOrComputation.source,\n optionsOrComputation.computation,\n optionsOrComputation.equal,\n );\n return upgradeLinkedSignalGetter(getter, optionsOrComputation.debugName);\n }\n}\n\nfunction upgradeLinkedSignalGetter<S, D>(\n getter: LinkedSignalGetter<S, D>,\n debugName?: string,\n): WritableSignal<D> {\n if (ngDevMode) {\n getter.toString = () => `[LinkedSignal: ${getter()}]`;\n getter[SIGNAL].debugName = debugName;\n }\n\n const node = getter[SIGNAL] as LinkedSignalNode<S, D>;\n const upgradedGetter = getter as LinkedSignalGetter<S, D> & WritableSignal<D>;\n\n upgradedGetter.set = (newValue: D) => linkedSignalSetFn(node, newValue);\n upgradedGetter.update = (updateFn: (value: D) => D) => linkedSignalUpdateFn(node, updateFn);\n upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter as any) as () => Signal<D>;\n\n return upgradedGetter;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {untracked} from '../render3/reactivity/untracked';\nimport {computed} from '../render3/reactivity/computed';\nimport {signal, signalAsReadonlyFn, WritableSignal} from '../render3/reactivity/signal';\nimport {Signal, ValueEqualityFn} from '../render3/reactivity/api';\nimport {effect, EffectRef} from '../render3/reactivity/effect';\nimport {\n ResourceOptions,\n ResourceStatus,\n WritableResource,\n Resource,\n ResourceRef,\n ResourceStreamingLoader,\n StreamingResourceOptions,\n ResourceStreamItem,\n ResourceLoaderParams,\n} from './api';\n\nimport {Injector} from '../di/injector';\nimport {assertInInjectionContext} from '../di/contextual';\nimport {inject} from '../di/injector_compatibility';\nimport {PendingTasks} from '../pending_tasks';\nimport {linkedSignal} from '../render3/reactivity/linked_signal';\nimport {DestroyRef} from '../linker/destroy_ref';\n\n/**\n * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by\n * a loader function, which exposes the result of the loading operation via signals.\n *\n * Note that `resource` is intended for _read_ operations, not operations which perform mutations.\n * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new\n * request object becomes available, which could prematurely abort mutations.\n *\n * @see [Async reactivity with resources](guide/signals/resource)\n *\n * @experimental 19.0\n */\nexport function resource<T, R>(\n options: ResourceOptions<T, R> & {defaultValue: NoInfer<T>},\n): ResourceRef<T>;\n\n/**\n * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by\n * a loader function, which exposes the result of the loading operation via signals.\n *\n * Note that `resource` is intended for _read_ operations, not operations which perform mutations.\n * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new\n * request object becomes available, which could prematurely abort mutations.\n *\n * @experimental 19.0\n * @see [Async reactivity with resources](guide/signals/resource)\n */\nexport function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined>;\nexport function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined> {\n if (ngDevMode && !options?.injector) {\n assertInInjectionContext(resource);\n }\n\n const oldNameForParams = (\n options as ResourceOptions<T, R> & {request: ResourceOptions<T, R>['params']}\n ).request;\n const params = (options.params ?? oldNameForParams ?? (() => null)) as () => R;\n\n return new ResourceImpl<T | undefined, R>(\n params,\n getLoader(options),\n options.defaultValue,\n options.equal ? wrapEqualityFn(options.equal) : undefined,\n options.debugName,\n options.injector ?? inject(Injector),\n );\n}\n\ntype ResourceInternalStatus = 'idle' | 'loading' | 'resolved' | 'local';\n\n/**\n * Internal state of a resource.\n */\ninterface ResourceProtoState<T> {\n extRequest: WrappedRequest;\n\n // For simplicity, status is internally tracked as a subset of the public status enum.\n // Reloading and Error statuses are projected from Loading and Resolved based on other state.\n status: ResourceInternalStatus;\n}\n\ninterface ResourceState<T> extends ResourceProtoState<T> {\n previousStatus: ResourceStatus;\n stream: Signal<ResourceStreamItem<T>> | undefined;\n}\n\ntype WrappedRequest = {request: unknown; reload: number};\n\n/**\n * Base class which implements `.value` as a `WritableSignal` by delegating `.set` and `.update`.\n */\nabstract class BaseWritableResource<T> implements WritableResource<T> {\n readonly value: WritableSignal<T>;\n abstract readonly status: Signal<ResourceStatus>;\n abstract readonly error: Signal<Error | undefined>;\n\n abstract reload(): boolean;\n\n readonly isLoading: Signal<boolean>;\n\n constructor(value: Signal<T>, debugName: string | undefined) {\n this.value = value as WritableSignal<T>;\n this.value.set = this.set.bind(this);\n this.value.update = this.update.bind(this);\n this.value.asReadonly = signalAsReadonlyFn;\n\n this.isLoading = computed(\n () => this.status() === 'loading' || this.status() === 'reloading',\n ngDevMode ? createDebugNameObject(debugName, 'isLoading') : undefined,\n );\n }\n\n abstract set(value: T): void;\n\n private readonly isError = computed(() => this.status() === 'error');\n\n update(updateFn: (value: T) => T): void {\n this.set(updateFn(untracked(this.value)));\n }\n\n // Use a computed here to avoid triggering reactive consumers if the value changes while staying\n // either defined or undefined.\n private readonly isValueDefined = computed(() => {\n // Check if it's in an error state first to prevent the error from bubbling up.\n if (this.isError()) {\n return false;\n }\n\n return this.value() !== undefined;\n });\n\n hasValue(): this is ResourceRef<Exclude<T, undefined>> {\n return this.isValueDefined();\n }\n\n asReadonly(): Resource<T> {\n return this;\n }\n}\n\n/**\n * Implementation for `resource()` which uses a `linkedSignal` to manage the resource's state.\n */\nexport class ResourceImpl<T, R> extends BaseWritableResource<T> implements ResourceRef<T> {\n private readonly pendingTasks: PendingTasks;\n\n /**\n * The current state of the resource. Status, value, and error are derived from this.\n */\n private readonly state: WritableSignal<ResourceState<T>>;\n\n /**\n * Combines the current request with a reload counter which allows the resource to be reloaded on\n * imperative command.\n */\n protected readonly extRequest: WritableSignal<WrappedRequest>;\n private readonly effectRef: EffectRef;\n\n private pendingController: AbortController | undefined;\n private resolvePendingTask: (() => void) | undefined = undefined;\n private destroyed = false;\n private unregisterOnDestroy: () => void;\n\n override readonly status: Signal<ResourceStatus>;\n override readonly error: Signal<Error | undefined>;\n\n constructor(\n request: () => R,\n private readonly loaderFn: ResourceStreamingLoader<T, R>,\n defaultValue: T,\n private readonly equal: ValueEqualityFn<T> | undefined,\n private readonly debugName: string | undefined,\n injector: Injector,\n ) {\n super(\n // Feed a computed signal for the value to `BaseWritableResource`, which will upgrade it to a\n // `WritableSignal` that delegates to `ResourceImpl.set`.\n computed(\n () => {\n const streamValue = this.state().stream?.();\n\n if (!streamValue) {\n return defaultValue;\n }\n\n // Prevents `hasValue()` from throwing an error when a reload happened in the error state\n if (this.state().status === 'loading' && this.error()) {\n return defaultValue;\n }\n\n if (!isResolved(streamValue)) {\n throw new ResourceValueError(this.error()!);\n }\n\n return streamValue.value;\n },\n {equal, ...(ngDevMode ? createDebugNameObject(debugName, 'value') : undefined)},\n ),\n debugName,\n );\n\n // Extend `request()` to include a writable reload signal.\n this.extRequest = linkedSignal({\n source: request,\n computation: (request) => ({request, reload: 0}),\n ...(ngDevMode ? createDebugNameObject(debugName, 'extRequest') : undefined),\n });\n\n // The main resource state is managed in a `linkedSignal`, which allows the resource to change\n // state instantaneously when the request signal changes.\n this.state = linkedSignal<WrappedRequest, ResourceState<T>>({\n // Whenever the request changes,\n source: this.extRequest,\n // Compute the state of the resource given a change in status.\n computation: (extRequest, previous) => {\n const status = extRequest.request === undefined ? 'idle' : 'loading';\n if (!previous) {\n return {\n extRequest,\n status,\n previousStatus: 'idle',\n stream: undefined,\n };\n } else {\n return {\n extRequest,\n status,\n previousStatus: projectStatusOfState(previous.value),\n // If the request hasn't changed, keep the previous stream.\n stream:\n previous.value.extRequest.request === extRequest.request\n ? previous.value.stream\n : undefined,\n };\n }\n },\n ...(ngDevMode ? createDebugNameObject(debugName, 'state') : undefined),\n });\n\n this.effectRef = effect(this.loadEffect.bind(this), {\n injector,\n manualCleanup: true,\n ...(ngDevMode ? createDebugNameObject(debugName, 'loadEffect') : undefined),\n });\n\n this.pendingTasks = injector.get(PendingTasks);\n\n // Cancel any pending request when the resource itself is destroyed.\n this.unregisterOnDestroy = injector.get(DestroyRef).onDestroy(() => this.destroy());\n\n this.status = computed(\n () => projectStatusOfState(this.state()),\n ngDevMode ? createDebugNameObject(debugName, 'status') : undefined,\n );\n\n this.error = computed(\n () => {\n const stream = this.state().stream?.();\n return stream && !isResolved(stream) ? stream.error : undefined;\n },\n ngDevMode ? createDebugNameObject(debugName, 'error') : undefined,\n );\n }\n\n /**\n * Called either directly via `WritableResource.set` or via `.value.set()`.\n */\n override set(value: T): void {\n if (this.destroyed) {\n return;\n }\n\n const error = untracked(this.error);\n const state = untracked(this.state);\n\n if (!error) {\n const current = untracked(this.value);\n if (\n state.status === 'local' &&\n (this.equal ? this.equal(current, value) : current === value)\n ) {\n return;\n }\n }\n\n // Enter Local state with the user-defined value.\n this.state.set({\n extRequest: state.extRequest,\n status: 'local',\n previousStatus: 'local',\n stream: signal(\n {value},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n ),\n });\n\n // We're departing from whatever state the resource was in previously, so cancel any in-progress\n // loading operations.\n this.abortInProgressLoad();\n }\n\n override reload(): boolean {\n // We don't want to restart in-progress loads.\n const {status} = untracked(this.state);\n if (status === 'idle' || status === 'loading') {\n return false;\n }\n\n // Increment the request reload to trigger the `state` linked signal to switch us to `Reload`\n this.extRequest.update(({request, reload}) => ({request, reload: reload + 1}));\n return true;\n }\n\n destroy(): void {\n this.destroyed = true;\n this.unregisterOnDestroy();\n this.effectRef.destroy();\n this.abortInProgressLoad();\n\n // Destroyed resources enter Idle state.\n this.state.set({\n extRequest: {request: undefined, reload: 0},\n status: 'idle',\n previousStatus: 'idle',\n stream: undefined,\n });\n }\n\n private async loadEffect(): Promise<void> {\n const extRequest = this.extRequest();\n\n // Capture the previous status before any state transitions. Note that this is `untracked` since\n // we do not want the effect to depend on the state of the resource, only on the request.\n const {status: currentStatus, previousStatus} = untracked(this.state);\n\n if (extRequest.request === undefined) {\n // Nothing to load (and we should already be in a non-loading state).\n return;\n } else if (currentStatus !== 'loading') {\n // We're not in a loading or reloading state, so this loading request is stale.\n return;\n }\n\n // Cancel any previous loading attempts.\n this.abortInProgressLoad();\n\n // Capturing _this_ load's pending task in a local variable is important here. We may attempt to\n // resolve it twice:\n //\n // 1. when the loading function promise resolves/rejects\n // 2. when cancelling the loading operation\n //\n // After the loading operation is cancelled, `this.resolvePendingTask` no longer represents this\n // particular task, but this `await` may eventually resolve/reject. Thus, when we cancel in\n // response to (1) below, we need to cancel the locally saved task.\n let resolvePendingTask: (() => void) | undefined = (this.resolvePendingTask =\n this.pendingTasks.add());\n\n const {signal: abortSignal} = (this.pendingController = new AbortController());\n\n try {\n // The actual loading is run through `untracked` - only the request side of `resource` is\n // reactive. This avoids any confusion with signals tracking or not tracking depending on\n // which side of the `await` they are.\n const stream = await untracked(() => {\n return this.loaderFn({\n params: extRequest.request as Exclude<R, undefined>,\n // TODO(alxhub): cleanup after g3 removal of `request` alias.\n request: extRequest.request as Exclude<R, undefined>,\n abortSignal,\n previous: {\n status: previousStatus,\n },\n } as ResourceLoaderParams<R>);\n });\n\n // If this request has been aborted, or the current request no longer\n // matches this load, then we should ignore this resolution.\n if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'resolved',\n stream,\n });\n } catch (err) {\n if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'error',\n stream: signal(\n {error: encapsulateResourceError(err)},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n ),\n });\n } finally {\n // Resolve the pending task now that the resource has a value.\n resolvePendingTask?.();\n resolvePendingTask = undefined;\n }\n }\n\n private abortInProgressLoad(): void {\n untracked(() => this.pendingController?.abort());\n this.pendingController = undefined;\n\n // Once the load is aborted, we no longer want to block stability on its resolution.\n this.resolvePendingTask?.();\n this.resolvePendingTask = undefined;\n }\n}\n\n/**\n * Wraps an equality function to handle either value being `undefined`.\n */\nfunction wrapEqualityFn<T>(equal: ValueEqualityFn<T>): ValueEqualityFn<T | undefined> {\n return (a, b) => (a === undefined || b === undefined ? a === b : equal(a, b));\n}\n\nfunction getLoader<T, R>(options: ResourceOptions<T, R>): ResourceStreamingLoader<T, R> {\n if (isStreamingResourceOptions(options)) {\n return options.stream;\n }\n\n return async (params) => {\n try {\n return signal(\n {value: await options.loader(params)},\n ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined,\n );\n } catch (err) {\n return signal(\n {error: encapsulateResourceError(err)},\n ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined,\n );\n }\n };\n}\n\nfunction isStreamingResourceOptions<T, R>(\n options: ResourceOptions<T, R>,\n): options is StreamingResourceOptions<T, R> {\n return !!(options as StreamingResourceOptions<T, R>).stream;\n}\n\n/**\n * Project from a state with `ResourceInternalStatus` to the user-facing `ResourceStatus`\n */\nfunction projectStatusOfState(state: ResourceState<unknown>): ResourceStatus {\n switch (state.status) {\n case 'loading':\n return state.extRequest.reload === 0 ? 'loading' : 'reloading';\n case 'resolved':\n return isResolved(state.stream!()) ? 'resolved' : 'error';\n default:\n return state.status;\n }\n}\n\nfunction isResolved<T>(state: ResourceStreamItem<T>): state is {value: T} {\n return (state as {error: unknown}).error === undefined;\n}\n\n/**\n * Creates a debug name object for an internal signal.\n */\nfunction createDebugNameObject(\n resourceDebugName: string | undefined,\n internalSignalDebugName: string,\n): {debugName?: string} {\n return {\n debugName: `Resource${resourceDebugName ? '#' + resourceDebugName : ''}.${internalSignalDebugName}`,\n };\n}\n\nexport function encapsulateResourceError(error: unknown): Error {\n if (isErrorLike(error)) {\n return error;\n }\n\n return new ResourceWrappedError(error);\n}\n\nexport function isErrorLike(error: unknown): error is Error {\n return (\n error instanceof Error ||\n (typeof error === 'object' &&\n typeof (error as Error).name === 'string' &&\n typeof (error as Error).message === 'string')\n );\n}\n\nclass ResourceValueError extends Error {\n constructor(error: Error) {\n super(\n ngDevMode\n ? `Resource is currently in an error state (see Error.cause for details): ${error.message}`\n : error.message,\n {cause: error},\n );\n }\n}\n\nclass ResourceWrappedError extends Error {\n constructor(error: unknown) {\n super(\n ngDevMode\n ? `Resource returned an error that's not an Error instance: ${String(error)}. Check this error's .cause for the actual error.`\n : String(error),\n {cause: error},\n );\n }\n}\n"],"names":["OutputEmitterRef","destroyed","listeners","errorHandler","inject","ErrorHandler","optional","destroyRef","DestroyRef","constructor","onDestroy","subscribe","callback","RuntimeError","ngDevMode","push","unsubscribe","idx","indexOf","undefined","splice","emit","value","console","warn","formatRuntimeError","previousConsumer","setActiveConsumer","listenerFn","err","handleError","getOutputDestroyRef","ref","computed","computation","options","getter","createComputed","equal","toString","SIGNAL","debugName","identityFn","v","linkedSignal","optionsOrComputation","createLinkedSignal","upgradeLinkedSignalGetter","source","node","upgradedGetter","set","newValue","linkedSignalSetFn","update","updateFn","linkedSignalUpdateFn","asReadonly","signalAsReadonlyFn","bind","resource","injector","assertInInjectionContext","oldNameForParams","request","params","ResourceImpl","getLoader","defaultValue","wrapEqualityFn","Injector","BaseWritableResource","isLoading","status","createDebugNameObject","isError","untracked","isValueDefined","hasValue","loaderFn","pendingTasks","state","extRequest","effectRef","pendingController","resolvePendingTask","unregisterOnDestroy","error","streamValue","stream","isResolved","ResourceValueError","reload","previous","previousStatus","projectStatusOfState","effect","loadEffect","manualCleanup","get","PendingTasks","destroy","current","signal","abortInProgressLoad","currentStatus","add","abortSignal","AbortController","aborted","encapsulateResourceError","abort","a","b","isStreamingResourceOptions","loader","resourceDebugName","internalSignalDebugName","isErrorLike","ResourceWrappedError","Error","name","message","cause","String"],"mappings":";;;;;;;;;;MAgCaA,gBAAgB,CAAA;AACnBC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,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AAYiC,KAAK,IACrB,OAAOjC,KAAK,KAAK,QAAQ,IACxB,OAAQA,KAAe,CAACkC,IAAI,KAAK,QAAQ,IACzC,OAAQlC,KAAe,CAACmC,OAAO,KAAK,QAAS;AAEnD;AAEA,MAAM/B,kBAAmB,SAAQ6B,KAAK,CAAA;EACpC/G,WAAAA,CAAY8E,KAAY,EAAA;AACtB,IAAA,KAAK,CACHzE,SAAS,GACL,CAAA,uEAAA,EAA0EyE,KAAK,CAACmC,OAAO,CAAA,CAAE,GACzFnC,KAAK,CAACmC,OAAO,EACjB;AAACC,MAAAA,KAAK,EAAEpC;AAAM,KAAA,CACf;AACH;AACD;AAED,MAAMgC,oBAAqB,SAAQC,KAAK,CAAA;EACtC/G,WAAAA,CAAY8E,KAAc,EAAA;AACxB,IAAA,KAAK,CACHzE,SAAS,GACL,CAAA,yDAAA,EAA4D8G,MAAM,CAACrC,KAAK,CAAC,CAAA,iDAAA,CAAmD,GAC5HqC,MAAM,CAACrC,KAAK,CAAC,EACjB;AAACoC,MAAAA,KAAK,EAAEpC;AAAM,KAAA,CACf;AACH;AACD;;;;"}
1
+ {"version":3,"file":"_resource-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/output/output_emitter_ref.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/computed.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/linked_signal.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/resource/resource.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {setActiveConsumer} from '../../../primitives/signals';\n\nimport {inject} from '../../di/injector_compatibility';\nimport {ErrorHandler} from '../../error_handler';\nimport {formatRuntimeError, RuntimeError, RuntimeErrorCode} from '../../errors';\nimport {DestroyRef} from '../../linker/destroy_ref';\n\nimport {OutputRef, OutputRefSubscription} from './output_ref';\n\n/**\n * An `OutputEmitterRef` is created by the `output()` function and can be\n * used to emit values to consumers of your directive or component.\n *\n * Consumers of your directive/component can bind to the output and\n * subscribe to changes via the bound event syntax. For example:\n *\n * ```html\n * <my-comp (valueChange)=\"processNewValue($event)\" />\n * ```\n *\n * @see [Custom events with outputs](guide/components/outputs)\n *\n * @publicAPI\n */\nexport class OutputEmitterRef<T> implements OutputRef<T> {\n private destroyed = false;\n private listeners: Array<(value: T) => void> | null = null;\n private errorHandler = inject(ErrorHandler, {optional: true});\n\n /** @internal */\n destroyRef: DestroyRef = inject(DestroyRef);\n\n constructor() {\n // Clean-up all listeners and mark as destroyed upon destroy.\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.listeners = null;\n });\n }\n\n subscribe(callback: (value: T) => void): OutputRefSubscription {\n if (this.destroyed) {\n throw new RuntimeError(\n RuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected subscription to destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n );\n }\n\n (this.listeners ??= []).push(callback);\n\n return {\n unsubscribe: () => {\n const idx = this.listeners?.indexOf(callback);\n if (idx !== undefined && idx !== -1) {\n this.listeners?.splice(idx, 1);\n }\n },\n };\n }\n\n /** Emits a new value to the output. */\n emit(value: T): void {\n if (this.destroyed) {\n console.warn(\n formatRuntimeError(\n RuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected emit for destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n ),\n );\n return;\n }\n\n if (this.listeners === null) {\n return;\n }\n\n const previousConsumer = setActiveConsumer(null);\n try {\n for (const listenerFn of this.listeners) {\n try {\n listenerFn(value);\n } catch (err: unknown) {\n this.errorHandler?.handleError(err);\n }\n }\n } finally {\n setActiveConsumer(previousConsumer);\n }\n }\n}\n\n/** Gets the owning `DestroyRef` for the given output. */\nexport function getOutputDestroyRef(ref: OutputRef<unknown>): DestroyRef | undefined {\n return ref.destroyRef;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {createComputed, SIGNAL} from '../../../primitives/signals';\n\nimport {Signal, ValueEqualityFn} from './api';\n\n/**\n * Options passed to the `computed` creation function.\n */\nexport interface CreateComputedOptions<T> {\n /**\n * A comparison function which defines equality for computed values.\n */\n equal?: ValueEqualityFn<T>;\n\n /**\n * A debug name for the computed signal. Used in Angular DevTools to identify the signal.\n */\n debugName?: string;\n}\n\n/**\n * Create a computed `Signal` which derives a reactive value from an expression.\n * @see [Computed signals](guide/signals#computed-signals)\n */\nexport function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T> {\n const getter = createComputed(computation, options?.equal);\n\n if (ngDevMode) {\n getter.toString = () => `[Computed: ${getter()}]`;\n getter[SIGNAL].debugName = options?.debugName;\n }\n\n return getter;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n ComputationFn,\n createLinkedSignal,\n LinkedSignalGetter,\n LinkedSignalNode,\n linkedSignalSetFn,\n linkedSignalUpdateFn,\n SIGNAL,\n} from '../../../primitives/signals';\nimport {Signal, ValueEqualityFn} from './api';\nimport {signalAsReadonlyFn, WritableSignal} from './signal';\n\nconst identityFn = <T>(v: T) => v;\n\n/**\n * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.\n *\n * @publicApi 20.0\n */\nexport function linkedSignal<D>(\n computation: () => D,\n options?: {equal?: ValueEqualityFn<NoInfer<D>>; debugName?: string},\n): WritableSignal<D>;\n\n/**\n * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.\n * This is an advanced API form where the computation has access to the previous value of the signal and the computation result.\n *\n * Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.\n *\n * @publicApi 20.0\n * @see [Dependent state with linkedSignal](guide/signals/linked-signal)\n */\nexport function linkedSignal<S, D>(options: {\n source: () => S;\n computation: (source: NoInfer<S>, previous?: {source: NoInfer<S>; value: NoInfer<D>}) => D;\n equal?: ValueEqualityFn<NoInfer<D>>;\n debugName?: string;\n}): WritableSignal<D>;\n\nexport function linkedSignal<S, D>(\n optionsOrComputation:\n | {\n source: () => S;\n computation: ComputationFn<S, D>;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n }\n | (() => D),\n options?: {equal?: ValueEqualityFn<D>; debugName?: string},\n): WritableSignal<D> {\n if (typeof optionsOrComputation === 'function') {\n const getter = createLinkedSignal<D, D>(\n optionsOrComputation,\n identityFn<D>,\n options?.equal,\n ) as LinkedSignalGetter<D, D> & WritableSignal<D>;\n return upgradeLinkedSignalGetter(getter, options?.debugName);\n } else {\n const getter = createLinkedSignal<S, D>(\n optionsOrComputation.source,\n optionsOrComputation.computation,\n optionsOrComputation.equal,\n );\n return upgradeLinkedSignalGetter(getter, optionsOrComputation.debugName);\n }\n}\n\nfunction upgradeLinkedSignalGetter<S, D>(\n getter: LinkedSignalGetter<S, D>,\n debugName?: string,\n): WritableSignal<D> {\n if (ngDevMode) {\n getter.toString = () => `[LinkedSignal: ${getter()}]`;\n getter[SIGNAL].debugName = debugName;\n }\n\n const node = getter[SIGNAL] as LinkedSignalNode<S, D>;\n const upgradedGetter = getter as LinkedSignalGetter<S, D> & WritableSignal<D>;\n\n upgradedGetter.set = (newValue: D) => linkedSignalSetFn(node, newValue);\n upgradedGetter.update = (updateFn: (value: D) => D) => linkedSignalUpdateFn(node, updateFn);\n upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter as any) as () => Signal<D>;\n\n return upgradedGetter;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {untracked} from '../render3/reactivity/untracked';\nimport {computed} from '../render3/reactivity/computed';\nimport {signal, signalAsReadonlyFn, WritableSignal} from '../render3/reactivity/signal';\nimport {Signal, ValueEqualityFn} from '../render3/reactivity/api';\nimport {effect, EffectRef} from '../render3/reactivity/effect';\nimport {\n ResourceOptions,\n ResourceStatus,\n WritableResource,\n Resource,\n ResourceRef,\n ResourceStreamingLoader,\n StreamingResourceOptions,\n ResourceStreamItem,\n ResourceLoaderParams,\n ResourceSnapshot,\n} from './api';\n\nimport {Injector} from '../di/injector';\nimport {assertInInjectionContext} from '../di/contextual';\nimport {inject} from '../di/injector_compatibility';\nimport {PendingTasks} from '../pending_tasks';\nimport {linkedSignal} from '../render3/reactivity/linked_signal';\nimport {DestroyRef} from '../linker/destroy_ref';\n\n/**\n * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by\n * a loader function, which exposes the result of the loading operation via signals.\n *\n * Note that `resource` is intended for _read_ operations, not operations which perform mutations.\n * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new\n * request object becomes available, which could prematurely abort mutations.\n *\n * @see [Async reactivity with resources](guide/signals/resource)\n *\n * @experimental 19.0\n */\nexport function resource<T, R>(\n options: ResourceOptions<T, R> & {defaultValue: NoInfer<T>},\n): ResourceRef<T>;\n\n/**\n * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by\n * a loader function, which exposes the result of the loading operation via signals.\n *\n * Note that `resource` is intended for _read_ operations, not operations which perform mutations.\n * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new\n * request object becomes available, which could prematurely abort mutations.\n *\n * @experimental 19.0\n * @see [Async reactivity with resources](guide/signals/resource)\n */\nexport function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined>;\nexport function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined> {\n if (ngDevMode && !options?.injector) {\n assertInInjectionContext(resource);\n }\n\n const oldNameForParams = (\n options as ResourceOptions<T, R> & {request: ResourceOptions<T, R>['params']}\n ).request;\n const params = (options.params ?? oldNameForParams ?? (() => null)) as () => R;\n\n return new ResourceImpl<T | undefined, R>(\n params,\n getLoader(options),\n options.defaultValue,\n options.equal ? wrapEqualityFn(options.equal) : undefined,\n options.debugName,\n options.injector ?? inject(Injector),\n );\n}\n\ntype ResourceInternalStatus = 'idle' | 'loading' | 'resolved' | 'local';\n\n/**\n * Internal state of a resource.\n */\ninterface ResourceProtoState<T> {\n extRequest: WrappedRequest;\n\n // For simplicity, status is internally tracked as a subset of the public status enum.\n // Reloading and Error statuses are projected from Loading and Resolved based on other state.\n status: ResourceInternalStatus;\n}\n\ninterface ResourceState<T> extends ResourceProtoState<T> {\n previousStatus: ResourceStatus;\n stream: Signal<ResourceStreamItem<T>> | undefined;\n}\n\ntype WrappedRequest = {request: unknown; reload: number};\n\n/**\n * Base class which implements `.value` as a `WritableSignal` by delegating `.set` and `.update`.\n */\nabstract class BaseWritableResource<T> implements WritableResource<T> {\n readonly value: WritableSignal<T>;\n abstract readonly status: Signal<ResourceStatus>;\n abstract readonly error: Signal<Error | undefined>;\n\n abstract reload(): boolean;\n\n readonly isLoading: Signal<boolean>;\n\n constructor(value: Signal<T>, debugName: string | undefined) {\n this.value = value as WritableSignal<T>;\n this.value.set = this.set.bind(this);\n this.value.update = this.update.bind(this);\n this.value.asReadonly = signalAsReadonlyFn;\n\n this.isLoading = computed(\n () => this.status() === 'loading' || this.status() === 'reloading',\n ngDevMode ? createDebugNameObject(debugName, 'isLoading') : undefined,\n );\n }\n\n abstract set(value: T): void;\n\n private readonly isError = computed(() => this.status() === 'error');\n\n update(updateFn: (value: T) => T): void {\n this.set(updateFn(untracked(this.value)));\n }\n\n // Use a computed here to avoid triggering reactive consumers if the value changes while staying\n // either defined or undefined.\n private readonly isValueDefined = computed(() => {\n // Check if it's in an error state first to prevent the error from bubbling up.\n if (this.isError()) {\n return false;\n }\n\n return this.value() !== undefined;\n });\n\n private _snapshot: Signal<ResourceSnapshot<T>> | undefined;\n get snapshot(): Signal<ResourceSnapshot<T>> {\n return (this._snapshot ??= computed(() => {\n const status = this.status();\n if (status === 'error') {\n return {status: 'error', error: this.error()!};\n } else {\n return {status, value: this.value()};\n }\n }));\n }\n\n hasValue(): this is ResourceRef<Exclude<T, undefined>> {\n return this.isValueDefined();\n }\n\n asReadonly(): Resource<T> {\n return this;\n }\n}\n\n/**\n * Implementation for `resource()` which uses a `linkedSignal` to manage the resource's state.\n */\nexport class ResourceImpl<T, R> extends BaseWritableResource<T> implements ResourceRef<T> {\n private readonly pendingTasks: PendingTasks;\n\n /**\n * The current state of the resource. Status, value, and error are derived from this.\n */\n private readonly state: WritableSignal<ResourceState<T>>;\n\n /**\n * Combines the current request with a reload counter which allows the resource to be reloaded on\n * imperative command.\n */\n protected readonly extRequest: WritableSignal<WrappedRequest>;\n private readonly effectRef: EffectRef;\n\n private pendingController: AbortController | undefined;\n private resolvePendingTask: (() => void) | undefined = undefined;\n private destroyed = false;\n private unregisterOnDestroy: () => void;\n\n override readonly status: Signal<ResourceStatus>;\n override readonly error: Signal<Error | undefined>;\n\n constructor(\n request: () => R,\n private readonly loaderFn: ResourceStreamingLoader<T, R>,\n defaultValue: T,\n private readonly equal: ValueEqualityFn<T> | undefined,\n private readonly debugName: string | undefined,\n injector: Injector,\n ) {\n super(\n // Feed a computed signal for the value to `BaseWritableResource`, which will upgrade it to a\n // `WritableSignal` that delegates to `ResourceImpl.set`.\n computed(\n () => {\n const streamValue = this.state().stream?.();\n\n if (!streamValue) {\n return defaultValue;\n }\n\n // Prevents `hasValue()` from throwing an error when a reload happened in the error state\n if (this.state().status === 'loading' && this.error()) {\n return defaultValue;\n }\n\n if (!isResolved(streamValue)) {\n throw new ResourceValueError(this.error()!);\n }\n\n return streamValue.value;\n },\n {equal, ...(ngDevMode ? createDebugNameObject(debugName, 'value') : undefined)},\n ),\n debugName,\n );\n\n // Extend `request()` to include a writable reload signal.\n this.extRequest = linkedSignal({\n source: request,\n computation: (request) => ({request, reload: 0}),\n ...(ngDevMode ? createDebugNameObject(debugName, 'extRequest') : undefined),\n });\n\n // The main resource state is managed in a `linkedSignal`, which allows the resource to change\n // state instantaneously when the request signal changes.\n this.state = linkedSignal<WrappedRequest, ResourceState<T>>({\n // Whenever the request changes,\n source: this.extRequest,\n // Compute the state of the resource given a change in status.\n computation: (extRequest, previous) => {\n const status = extRequest.request === undefined ? 'idle' : 'loading';\n if (!previous) {\n return {\n extRequest,\n status,\n previousStatus: 'idle',\n stream: undefined,\n };\n } else {\n return {\n extRequest,\n status,\n previousStatus: projectStatusOfState(previous.value),\n // If the request hasn't changed, keep the previous stream.\n stream:\n previous.value.extRequest.request === extRequest.request\n ? previous.value.stream\n : undefined,\n };\n }\n },\n ...(ngDevMode ? createDebugNameObject(debugName, 'state') : undefined),\n });\n\n this.effectRef = effect(this.loadEffect.bind(this), {\n injector,\n manualCleanup: true,\n ...(ngDevMode ? createDebugNameObject(debugName, 'loadEffect') : undefined),\n });\n\n this.pendingTasks = injector.get(PendingTasks);\n\n // Cancel any pending request when the resource itself is destroyed.\n this.unregisterOnDestroy = injector.get(DestroyRef).onDestroy(() => this.destroy());\n\n this.status = computed(\n () => projectStatusOfState(this.state()),\n ngDevMode ? createDebugNameObject(debugName, 'status') : undefined,\n );\n\n this.error = computed(\n () => {\n const stream = this.state().stream?.();\n return stream && !isResolved(stream) ? stream.error : undefined;\n },\n ngDevMode ? createDebugNameObject(debugName, 'error') : undefined,\n );\n }\n\n /**\n * Called either directly via `WritableResource.set` or via `.value.set()`.\n */\n override set(value: T): void {\n if (this.destroyed) {\n return;\n }\n\n const error = untracked(this.error);\n const state = untracked(this.state);\n\n if (!error) {\n const current = untracked(this.value);\n if (\n state.status === 'local' &&\n (this.equal ? this.equal(current, value) : current === value)\n ) {\n return;\n }\n }\n\n // Enter Local state with the user-defined value.\n this.state.set({\n extRequest: state.extRequest,\n status: 'local',\n previousStatus: 'local',\n stream: signal(\n {value},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n ),\n });\n\n // We're departing from whatever state the resource was in previously, so cancel any in-progress\n // loading operations.\n this.abortInProgressLoad();\n }\n\n override reload(): boolean {\n // We don't want to restart in-progress loads.\n const {status} = untracked(this.state);\n if (status === 'idle' || status === 'loading') {\n return false;\n }\n\n // Increment the request reload to trigger the `state` linked signal to switch us to `Reload`\n this.extRequest.update(({request, reload}) => ({request, reload: reload + 1}));\n return true;\n }\n\n destroy(): void {\n this.destroyed = true;\n this.unregisterOnDestroy();\n this.effectRef.destroy();\n this.abortInProgressLoad();\n\n // Destroyed resources enter Idle state.\n this.state.set({\n extRequest: {request: undefined, reload: 0},\n status: 'idle',\n previousStatus: 'idle',\n stream: undefined,\n });\n }\n\n private async loadEffect(): Promise<void> {\n const extRequest = this.extRequest();\n\n // Capture the previous status before any state transitions. Note that this is `untracked` since\n // we do not want the effect to depend on the state of the resource, only on the request.\n const {status: currentStatus, previousStatus} = untracked(this.state);\n\n if (extRequest.request === undefined) {\n // Nothing to load (and we should already be in a non-loading state).\n return;\n } else if (currentStatus !== 'loading') {\n // We're not in a loading or reloading state, so this loading request is stale.\n return;\n }\n\n // Cancel any previous loading attempts.\n this.abortInProgressLoad();\n\n // Capturing _this_ load's pending task in a local variable is important here. We may attempt to\n // resolve it twice:\n //\n // 1. when the loading function promise resolves/rejects\n // 2. when cancelling the loading operation\n //\n // After the loading operation is cancelled, `this.resolvePendingTask` no longer represents this\n // particular task, but this `await` may eventually resolve/reject. Thus, when we cancel in\n // response to (1) below, we need to cancel the locally saved task.\n let resolvePendingTask: (() => void) | undefined = (this.resolvePendingTask =\n this.pendingTasks.add());\n\n const {signal: abortSignal} = (this.pendingController = new AbortController());\n\n try {\n // The actual loading is run through `untracked` - only the request side of `resource` is\n // reactive. This avoids any confusion with signals tracking or not tracking depending on\n // which side of the `await` they are.\n const stream = await untracked(() => {\n return this.loaderFn({\n params: extRequest.request as Exclude<R, undefined>,\n // TODO(alxhub): cleanup after g3 removal of `request` alias.\n request: extRequest.request as Exclude<R, undefined>,\n abortSignal,\n previous: {\n status: previousStatus,\n },\n } as ResourceLoaderParams<R>);\n });\n\n // If this request has been aborted, or the current request no longer\n // matches this load, then we should ignore this resolution.\n if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'resolved',\n stream,\n });\n } catch (err) {\n if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'error',\n stream: signal(\n {error: encapsulateResourceError(err)},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n ),\n });\n } finally {\n // Resolve the pending task now that the resource has a value.\n resolvePendingTask?.();\n resolvePendingTask = undefined;\n }\n }\n\n private abortInProgressLoad(): void {\n untracked(() => this.pendingController?.abort());\n this.pendingController = undefined;\n\n // Once the load is aborted, we no longer want to block stability on its resolution.\n this.resolvePendingTask?.();\n this.resolvePendingTask = undefined;\n }\n}\n\n/**\n * Wraps an equality function to handle either value being `undefined`.\n */\nfunction wrapEqualityFn<T>(equal: ValueEqualityFn<T>): ValueEqualityFn<T | undefined> {\n return (a, b) => (a === undefined || b === undefined ? a === b : equal(a, b));\n}\n\nfunction getLoader<T, R>(options: ResourceOptions<T, R>): ResourceStreamingLoader<T, R> {\n if (isStreamingResourceOptions(options)) {\n return options.stream;\n }\n\n return async (params) => {\n try {\n return signal(\n {value: await options.loader(params)},\n ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined,\n );\n } catch (err) {\n return signal(\n {error: encapsulateResourceError(err)},\n ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined,\n );\n }\n };\n}\n\nfunction isStreamingResourceOptions<T, R>(\n options: ResourceOptions<T, R>,\n): options is StreamingResourceOptions<T, R> {\n return !!(options as StreamingResourceOptions<T, R>).stream;\n}\n\n/**\n * Project from a state with `ResourceInternalStatus` to the user-facing `ResourceStatus`\n */\nfunction projectStatusOfState(state: ResourceState<unknown>): ResourceStatus {\n switch (state.status) {\n case 'loading':\n return state.extRequest.reload === 0 ? 'loading' : 'reloading';\n case 'resolved':\n return isResolved(state.stream!()) ? 'resolved' : 'error';\n default:\n return state.status;\n }\n}\n\nfunction isResolved<T>(state: ResourceStreamItem<T>): state is {value: T} {\n return (state as {error: unknown}).error === undefined;\n}\n\n/**\n * Creates a debug name object for an internal signal.\n */\nfunction createDebugNameObject(\n resourceDebugName: string | undefined,\n internalSignalDebugName: string,\n): {debugName?: string} {\n return {\n debugName: `Resource${resourceDebugName ? '#' + resourceDebugName : ''}.${internalSignalDebugName}`,\n };\n}\n\nexport function encapsulateResourceError(error: unknown): Error {\n if (isErrorLike(error)) {\n return error;\n }\n\n return new ResourceWrappedError(error);\n}\n\nexport function isErrorLike(error: unknown): error is Error {\n return (\n error instanceof Error ||\n (typeof error === 'object' &&\n typeof (error as Error).name === 'string' &&\n typeof (error as Error).message === 'string')\n );\n}\n\nexport class ResourceValueError extends Error {\n constructor(error: Error) {\n super(\n ngDevMode\n ? `Resource is currently in an error state (see Error.cause for details): ${error.message}`\n : error.message,\n {cause: error},\n );\n }\n}\n\nclass ResourceWrappedError extends Error {\n constructor(error: unknown) {\n super(\n ngDevMode\n ? `Resource returned an error that's not an Error instance: ${String(error)}. Check this error's .cause for the actual error.`\n : String(error),\n {cause: error},\n );\n }\n}\n"],"names":["OutputEmitterRef","destroyed","listeners","errorHandler","inject","ErrorHandler","optional","destroyRef","DestroyRef","constructor","onDestroy","subscribe","callback","RuntimeError","ngDevMode","push","unsubscribe","idx","indexOf","undefined","splice","emit","value","console","warn","formatRuntimeError","previousConsumer","setActiveConsumer","listenerFn","err","handleError","getOutputDestroyRef","ref","computed","computation","options","getter","createComputed","equal","toString","SIGNAL","debugName","identityFn","v","linkedSignal","optionsOrComputation","createLinkedSignal","upgradeLinkedSignalGetter","source","node","upgradedGetter","set","newValue","linkedSignalSetFn","update","updateFn","linkedSignalUpdateFn","asReadonly","signalAsReadonlyFn","bind","resource","injector","assertInInjectionContext","oldNameForParams","request","params","ResourceImpl","getLoader","defaultValue","wrapEqualityFn","Injector","BaseWritableResource","isLoading","status","createDebugNameObject","isError","untracked","isValueDefined","_snapshot","snapshot","error","hasValue","loaderFn","pendingTasks","state","extRequest","effectRef","pendingController","resolvePendingTask","unregisterOnDestroy","streamValue","stream","isResolved","ResourceValueError","reload","previous","previousStatus","projectStatusOfState","effect","loadEffect","manualCleanup","get","PendingTasks","destroy","current","signal","abortInProgressLoad","currentStatus","add","abortSignal","AbortController","aborted","encapsulateResourceError","abort","a","b","isStreamingResourceOptions","loader","resourceDebugName","internalSignalDebugName","isErrorLike","ResourceWrappedError","Error","name","message","cause","String"],"mappings":";;;;;;;;;;MAgCaA,gBAAgB,CAAA;AACnBC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,SAAS,GAAqC,IAAI;AAClDC,EAAAA,YAAY,GAAGC,MAAM,CAACC,YAAY,EAAE;AAACC,IAAAA,QAAQ,EAAE;AAAK,GAAA,CAAC;AAG7DC,EAAAA,UAAU,GAAeH,MAAM,CAACI,UAAU,CAAC;AAE3CC,EAAAA,WAAAA,GAAA;AAEE,IAAA,IAAI,CAACF,UAAU,CAACG,SAAS,CAAC,MAAK;MAC7B,IAAI,CAACT,SAAS,GAAG,IAAI;MACrB,IAAI,CAACC,SAAS,GAAG,IAAI;AACvB,KAAC,CAAC;AACJ;EAEAS,SAASA,CAACC,QAA4B,EAAA;IACpC,IAAI,IAAI,CAACX,SAAS,EAAE;MAClB,MAAM,IAAIY,YAAY,CAAA,GAAA,EAEpBC,SAAS,IACP,oDAAoD,GAClD,8CAA8C,CACnD;AACH;IAEA,CAAC,IAAI,CAACZ,SAAS,KAAK,EAAE,EAAEa,IAAI,CAACH,QAAQ,CAAC;IAEtC,OAAO;MACLI,WAAW,EAAEA,MAAK;QAChB,MAAMC,GAAG,GAAG,IAAI,CAACf,SAAS,EAAEgB,OAAO,CAACN,QAAQ,CAAC;QAC7C,IAAIK,GAAG,KAAKE,SAAS,IAAIF,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