octane 0.2.12 → 0.2.13

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 (243) hide show
  1. package/README.md +5 -0
  2. package/dist/behavior-root.d.ts +13 -3
  3. package/dist/behavior-root.js +28 -5
  4. package/dist/cjs/behavior-root.cjs +32 -6
  5. package/dist/cjs/class-names.cjs +49 -0
  6. package/dist/cjs/constants.cjs +9 -0
  7. package/dist/cjs/css.cjs +6 -27
  8. package/dist/cjs/data-encoding.cjs +160 -0
  9. package/dist/cjs/dom-binding-handoff.cjs +93 -0
  10. package/dist/cjs/dom-binding-protocol.cjs +115 -0
  11. package/dist/cjs/dom-binding-styles.cjs +292 -0
  12. package/dist/cjs/dom-bindings.cjs +700 -0
  13. package/dist/cjs/dom-focused-move.cjs +66 -0
  14. package/dist/cjs/dom-tables.cjs +4 -94
  15. package/dist/cjs/error-codes.client.generated.cjs +33 -0
  16. package/dist/cjs/error-codes.server.generated.cjs +19 -0
  17. package/dist/cjs/hydration/control-capture.cjs +244 -0
  18. package/dist/cjs/hydration/event-capture.cjs +125 -43
  19. package/dist/cjs/hydration/interaction-config.cjs +50 -2
  20. package/dist/cjs/hydration-markers.cjs +37 -0
  21. package/dist/cjs/independent-hydration-protocol.cjs +106 -0
  22. package/dist/cjs/index.cjs +6 -0
  23. package/dist/cjs/runtime.cjs +2791 -215
  24. package/dist/cjs/runtime.server.cjs +716 -76
  25. package/dist/cjs/server/early-signals.cjs +45 -0
  26. package/dist/cjs/server/index.cjs +44 -0
  27. package/dist/cjs/server/rpc-batch.cjs +149 -0
  28. package/dist/cjs/server/rpc-stream.cjs +146 -0
  29. package/dist/cjs/server/rpc.cjs +34 -15
  30. package/dist/cjs/server/signal-query-observation.cjs +158 -0
  31. package/dist/cjs/server/streamed-region.cjs +52 -0
  32. package/dist/cjs/server/streamed-signals.cjs +512 -0
  33. package/dist/cjs/server-call.cjs +103 -0
  34. package/dist/cjs/server-rpc-batch-client.cjs +141 -0
  35. package/dist/cjs/server-rpc-client.cjs +94 -27
  36. package/dist/cjs/server-rpc-protocol.cjs +141 -0
  37. package/dist/cjs/server-rpc-stream-client.cjs +118 -0
  38. package/dist/cjs/signals/actions.cjs +474 -0
  39. package/dist/cjs/signals/client.cjs +4 -1
  40. package/dist/cjs/signals/computations.cjs +460 -0
  41. package/dist/cjs/signals/control-binding.cjs +368 -0
  42. package/dist/cjs/signals/derived-facade.cjs +50 -0
  43. package/dist/cjs/signals/document-owner.cjs +71 -0
  44. package/dist/cjs/signals/early-values.cjs +155 -0
  45. package/dist/cjs/signals/encoding.cjs +6 -95
  46. package/dist/cjs/signals/engine.cjs +276 -12
  47. package/dist/cjs/signals/errors.cjs +18 -0
  48. package/dist/cjs/signals/facade.cjs +477 -0
  49. package/dist/cjs/signals/graph.cjs +163 -20
  50. package/dist/cjs/signals/handle-protocol.cjs +36 -0
  51. package/dist/cjs/signals/index.cjs +81 -2
  52. package/dist/cjs/signals/native-read-client.cjs +10 -0
  53. package/dist/cjs/signals/owner-context.cjs +112 -0
  54. package/dist/cjs/signals/query-attempt-observer.cjs +68 -0
  55. package/dist/cjs/signals/query-facade.cjs +72 -0
  56. package/dist/cjs/signals/read-protocol.cjs +32 -0
  57. package/dist/cjs/signals/requests.cjs +287 -14
  58. package/dist/cjs/signals/scalar-computations.cjs +76 -0
  59. package/dist/cjs/signals/server.cjs +4 -1
  60. package/dist/cjs/signals/transition-candidate.cjs +567 -0
  61. package/dist/cjs/signals/transition-state.cjs +106 -0
  62. package/dist/cjs/signals/types.cjs +50 -0
  63. package/dist/cjs/stream-protocol.cjs +3 -0
  64. package/dist/cjs/streamed-signals-protocol.cjs +159 -0
  65. package/dist/cjs/style-values.cjs +122 -0
  66. package/dist/cjs/version.cjs +1 -1
  67. package/dist/class-names.d.ts +5 -0
  68. package/dist/class-names.js +25 -0
  69. package/dist/compiler/bundler.js +34 -6
  70. package/dist/compiler/compile.js +2234 -559
  71. package/dist/compiler/dom-binding-program.js +935 -0
  72. package/dist/compiler/dom-binding-request.js +57 -0
  73. package/dist/compiler/dom-bindings.js +2245 -0
  74. package/dist/compiler/hook-deps.js +26 -0
  75. package/dist/compiler/hydrate-boundaries.js +358 -15
  76. package/dist/compiler/index.d.ts +38 -1
  77. package/dist/compiler/index.js +1 -0
  78. package/dist/compiler/native-attribute-reads.js +127 -0
  79. package/dist/compiler/native-read-diagnostics.js +48 -9
  80. package/dist/compiler/native-read-types.js +55 -32
  81. package/dist/compiler/server-context.js +118 -0
  82. package/dist/compiler/signal-attempt-reads.js +479 -0
  83. package/dist/compiler/signal-declarations.js +557 -0
  84. package/dist/compiler/signal-start-reads.js +413 -0
  85. package/dist/compiler/slot-hooks.js +57 -10
  86. package/dist/compiler/template-ir.js +200 -0
  87. package/dist/compiler/typescript.d.ts +2 -0
  88. package/dist/compiler/typescript.js +2 -0
  89. package/dist/compiler/vite.d.ts +3 -1
  90. package/dist/compiler/vite.js +122 -4
  91. package/dist/compiler/volar.d.ts +6 -1
  92. package/dist/compiler/volar.js +674 -143
  93. package/dist/constants.d.ts +1 -0
  94. package/dist/constants.js +10 -0
  95. package/dist/css.d.ts +2 -5
  96. package/dist/css.js +2 -23
  97. package/dist/data-encoding.d.ts +9 -0
  98. package/dist/data-encoding.js +134 -0
  99. package/dist/dom-binding-classes.d.ts +15 -0
  100. package/dist/dom-binding-classes.js +129 -0
  101. package/dist/dom-binding-controls.d.ts +2 -0
  102. package/dist/dom-binding-controls.js +6 -0
  103. package/dist/dom-binding-handoff.d.ts +55 -0
  104. package/dist/dom-binding-handoff.js +62 -0
  105. package/dist/dom-binding-program.d.ts +300 -0
  106. package/dist/dom-binding-program.js +1625 -0
  107. package/dist/dom-binding-projections.d.ts +15 -0
  108. package/dist/dom-binding-projections.js +187 -0
  109. package/dist/dom-binding-protocol.d.ts +13 -0
  110. package/dist/dom-binding-protocol.js +88 -0
  111. package/dist/dom-binding-signals.d.ts +21 -0
  112. package/dist/dom-binding-signals.js +109 -0
  113. package/dist/dom-binding-styles.d.ts +17 -0
  114. package/dist/dom-binding-styles.js +272 -0
  115. package/dist/dom-bindings.d.ts +89 -0
  116. package/dist/dom-bindings.js +670 -0
  117. package/dist/dom-focused-move.d.ts +6 -0
  118. package/dist/dom-focused-move.js +42 -0
  119. package/dist/dom-tables.d.ts +1 -3
  120. package/dist/dom-tables.js +1 -91
  121. package/dist/error-codes.client.generated.d.ts +9 -0
  122. package/dist/error-codes.client.generated.js +33 -0
  123. package/dist/error-codes.server.generated.d.ts +5 -0
  124. package/dist/error-codes.server.generated.js +19 -0
  125. package/dist/hydration/control-capture.d.ts +62 -0
  126. package/dist/hydration/control-capture.js +223 -0
  127. package/dist/hydration/document-lifecycle.d.ts +23 -0
  128. package/dist/hydration/document-lifecycle.js +80 -0
  129. package/dist/hydration/event-capture.d.ts +20 -1
  130. package/dist/hydration/event-capture.js +128 -42
  131. package/dist/hydration/independent-island.d.ts +45 -0
  132. package/dist/hydration/independent-island.js +233 -0
  133. package/dist/hydration/index.d.ts +8 -1
  134. package/dist/hydration/index.js +55 -1
  135. package/dist/hydration/interaction-config.d.ts +5 -0
  136. package/dist/hydration/interaction-config.js +44 -1
  137. package/dist/hydration/stream-delivery.d.ts +32 -0
  138. package/dist/hydration/stream-delivery.js +333 -0
  139. package/dist/hydration/stream-receiver.d.ts +26 -0
  140. package/dist/hydration/stream-receiver.js +204 -0
  141. package/dist/hydration/stream-result-receiver.d.ts +70 -0
  142. package/dist/hydration/stream-result-receiver.js +246 -0
  143. package/dist/hydration/streamed-signals.d.ts +44 -0
  144. package/dist/hydration/streamed-signals.js +186 -0
  145. package/dist/hydration/types.d.ts +6 -0
  146. package/dist/hydration-markers.d.ts +7 -0
  147. package/dist/hydration-markers.js +10 -0
  148. package/dist/independent-hydration-protocol.d.ts +31 -0
  149. package/dist/independent-hydration-protocol.js +80 -0
  150. package/dist/index.d.ts +2 -0
  151. package/dist/index.js +4 -0
  152. package/dist/internal/signal-read.d.ts +1 -0
  153. package/dist/internal/signal-read.js +4 -0
  154. package/dist/jsx-runtime.d.ts +45 -6
  155. package/dist/public-types.d.ts +15 -1
  156. package/dist/runtime.d.ts +259 -21
  157. package/dist/runtime.js +2812 -220
  158. package/dist/runtime.server.d.ts +86 -6
  159. package/dist/runtime.server.js +712 -76
  160. package/dist/server/early-signals.d.ts +14 -0
  161. package/dist/server/early-signals.js +34 -0
  162. package/dist/server/index.d.ts +10 -2
  163. package/dist/server/index.js +48 -1
  164. package/dist/server/rpc-batch.d.ts +17 -0
  165. package/dist/server/rpc-batch.js +129 -0
  166. package/dist/server/rpc-stream.d.ts +9 -0
  167. package/dist/server/rpc-stream.js +125 -0
  168. package/dist/server/rpc.d.ts +5 -1
  169. package/dist/server/rpc.js +37 -13
  170. package/dist/server/signal-query-observation.d.ts +3 -0
  171. package/dist/server/signal-query-observation.js +134 -0
  172. package/dist/server/streamed-region.d.ts +15 -0
  173. package/dist/server/streamed-region.js +30 -0
  174. package/dist/server/streamed-signals.d.ts +45 -0
  175. package/dist/server/streamed-signals.js +488 -0
  176. package/dist/server-call.d.ts +41 -0
  177. package/dist/server-call.js +75 -0
  178. package/dist/server-rpc-batch-client.d.ts +7 -0
  179. package/dist/server-rpc-batch-client.js +119 -0
  180. package/dist/server-rpc-client.d.ts +3 -1
  181. package/dist/server-rpc-client.js +99 -27
  182. package/dist/server-rpc-protocol.d.ts +47 -0
  183. package/dist/server-rpc-protocol.js +109 -0
  184. package/dist/server-rpc-stream-client.d.ts +5 -0
  185. package/dist/server-rpc-stream-client.js +98 -0
  186. package/dist/signals/actions.d.ts +12 -0
  187. package/dist/signals/actions.js +466 -0
  188. package/dist/signals/client.d.ts +2 -0
  189. package/dist/signals/client.js +1 -0
  190. package/dist/signals/computations.d.ts +37 -0
  191. package/dist/signals/computations.js +455 -0
  192. package/dist/signals/control-binding.d.ts +31 -0
  193. package/dist/signals/control-binding.js +353 -0
  194. package/dist/signals/derived-facade.d.ts +3 -0
  195. package/dist/signals/derived-facade.js +25 -0
  196. package/dist/signals/document-owner.d.ts +10 -0
  197. package/dist/signals/document-owner.js +43 -0
  198. package/dist/signals/early-values.d.ts +24 -0
  199. package/dist/signals/early-values.js +124 -0
  200. package/dist/signals/encoding.d.ts +1 -3
  201. package/dist/signals/encoding.js +3 -93
  202. package/dist/signals/engine.d.ts +53 -4
  203. package/dist/signals/engine.js +275 -16
  204. package/dist/signals/errors.d.ts +7 -0
  205. package/dist/signals/errors.js +16 -0
  206. package/dist/signals/facade.d.ts +74 -0
  207. package/dist/signals/facade.js +452 -0
  208. package/dist/signals/graph.d.ts +50 -5
  209. package/dist/signals/graph.js +170 -19
  210. package/dist/signals/handle-protocol.d.ts +4 -0
  211. package/dist/signals/handle-protocol.js +11 -0
  212. package/dist/signals/index.d.ts +12 -3
  213. package/dist/signals/index.js +71 -2
  214. package/dist/signals/native-read-client.d.ts +3 -0
  215. package/dist/signals/native-read-client.js +10 -0
  216. package/dist/signals/owner-context.d.ts +22 -0
  217. package/dist/signals/owner-context.js +77 -0
  218. package/dist/signals/query-attempt-observer.d.ts +49 -0
  219. package/dist/signals/query-attempt-observer.js +41 -0
  220. package/dist/signals/query-facade.d.ts +3 -0
  221. package/dist/signals/query-facade.js +49 -0
  222. package/dist/signals/read-protocol.d.ts +32 -3
  223. package/dist/signals/read-protocol.js +26 -0
  224. package/dist/signals/requests.d.ts +38 -5
  225. package/dist/signals/requests.js +298 -15
  226. package/dist/signals/scalar-computations.d.ts +2 -0
  227. package/dist/signals/scalar-computations.js +60 -0
  228. package/dist/signals/server.d.ts +2 -0
  229. package/dist/signals/server.js +1 -0
  230. package/dist/signals/transition-candidate.d.ts +71 -0
  231. package/dist/signals/transition-candidate.js +557 -0
  232. package/dist/signals/transition-state.d.ts +51 -0
  233. package/dist/signals/transition-state.js +70 -0
  234. package/dist/signals/types.d.ts +95 -5
  235. package/dist/signals/types.js +20 -0
  236. package/dist/stream-protocol.d.ts +0 -5
  237. package/dist/stream-protocol.js +3 -0
  238. package/dist/streamed-signals-protocol.d.ts +60 -0
  239. package/dist/streamed-signals-protocol.js +130 -0
  240. package/dist/style-values.d.ts +3 -0
  241. package/dist/style-values.js +96 -0
  242. package/dist/version.js +1 -1
  243. package/package.json +37 -1
@@ -60,7 +60,17 @@ __export(runtime_exports, {
60
60
  bagOf: () => bagOf,
61
61
  beginNativeReadScope: () => beginNativeReadScope,
62
62
  beginNativeReadWitness: () => beginNativeReadWitness,
63
+ beginPresentationHydration: () => beginPresentationHydration,
64
+ bindPresentationView: () => bindPresentationView,
63
65
  bindRendererRegionOwner: () => bindRendererRegionOwner,
66
+ bindSignalAttribute: () => bindSignalAttribute,
67
+ bindSignalChecked: () => bindSignalChecked,
68
+ bindSignalChild: () => bindSignalChild,
69
+ bindSignalHostPropSources: () => bindSignalHostPropSources,
70
+ bindSignalText: () => bindSignalText,
71
+ bindSignalValue: () => bindSignalValue,
72
+ bindingChildSlot: () => bindingChildSlot,
73
+ bindingText: () => bindingText,
64
74
  callWithReceiver: () => callWithReceiver,
65
75
  canSplitStyleProperties: () => canSplitStyleProperties,
66
76
  child: () => child,
@@ -80,7 +90,10 @@ __export(runtime_exports, {
80
90
  componentSlotVoid: () => componentSlotVoid,
81
91
  createContext: () => createContext,
82
92
  createElement: () => createElement,
93
+ createElementAt: () => createElementAt,
94
+ createElementFromConfig: () => createElementFromConfig,
83
95
  createHostContextRequest: () => createHostContextRequest,
96
+ createIndependentHydrateActivator: () => createIndependentHydrateActivator,
84
97
  createPortal: () => createPortal,
85
98
  createRoot: () => createRoot,
86
99
  createScopedElement: () => createScopedElement,
@@ -90,10 +103,13 @@ __export(runtime_exports, {
90
103
  descriptorChildren: () => descriptorChildren,
91
104
  devEventListener: () => devEventListener,
92
105
  devHtmlNesting: () => devHtmlNesting,
106
+ documentSignalOwner: () => import_document_owner2.documentSignalOwner,
93
107
  drainFrag: () => drainFrag,
94
108
  drainPassiveEffects: () => drainPassiveEffects,
95
109
  enableNativeReadCollection: () => enableNativeReadCollection,
110
+ enableSignalBindings: () => enableSignalBindings,
96
111
  endNativeReadScope: () => endNativeReadScope,
112
+ endPresentationHydration: () => endPresentationHydration,
97
113
  errorBlock: () => errorBlock,
98
114
  evt0: () => evt0,
99
115
  evt0u: () => evt0u,
@@ -133,6 +149,7 @@ __export(runtime_exports, {
133
149
  hydrateRoot: () => hydrateRoot,
134
150
  ifBlock: () => ifBlock,
135
151
  injectStyle: () => injectStyle,
152
+ installStreamedSignalOwnerActivator: () => import_document_owner2.installStreamedSignalOwnerActivator,
136
153
  invokeManualHook: () => invokeManualHook,
137
154
  isChildrenBlock: () => isChildrenBlock,
138
155
  isHydratingStyle: () => isHydratingStyle,
@@ -142,6 +159,7 @@ __export(runtime_exports, {
142
159
  lazy: () => lazy,
143
160
  manualHook: () => manualHook,
144
161
  mapSlot: () => mapSlot,
162
+ markBindingChildren: () => markBindingChildren,
145
163
  markChildrenBlock: () => markChildrenBlock,
146
164
  markDangerouslySetInnerHTMLChildren: () => markDangerouslySetInnerHTMLChildren,
147
165
  markNativeChangeDiagnosticStatic: () => markNativeChangeDiagnosticStatic,
@@ -162,6 +180,7 @@ __export(runtime_exports, {
162
180
  nativeCreateScopedElement: () => nativeCreateScopedElement,
163
181
  nativeCreateScopedValue: () => nativeCreateScopedValue,
164
182
  nativeLocalHook: () => nativeLocalHook,
183
+ nativeProjectionBinding: () => nativeProjectionBinding,
165
184
  nativePuMemo: () => nativePuMemo,
166
185
  nativePuPub: () => nativePuPub,
167
186
  nativePuTake0: () => nativePuTake0,
@@ -180,6 +199,10 @@ __export(runtime_exports, {
180
199
  preinitModule: () => preinitModule,
181
200
  preload: () => preload,
182
201
  preloadModule: () => preloadModule,
202
+ presentationFailure: () => presentationFailure,
203
+ presentationHostWrite: () => presentationHostWrite,
204
+ presentationStructure: () => presentationStructure,
205
+ presentationWrite: () => presentationWrite,
183
206
  provideContext: () => provideContext,
184
207
  puMiss: () => puMiss,
185
208
  puPub: () => puPub,
@@ -212,6 +235,8 @@ __export(runtime_exports, {
212
235
  setAttribute: () => setAttribute,
213
236
  setAttributeIfChanged: () => setAttributeIfChanged,
214
237
  setAutoFocus: () => setAutoFocus,
238
+ setBindingClass: () => setBindingClass,
239
+ setBindingClassIfChanged: () => setBindingClassIfChanged,
215
240
  setBooleanAttribute: () => setBooleanAttribute,
216
241
  setBooleanAttributeIfChanged: () => setBooleanAttributeIfChanged,
217
242
  setChecked: () => setChecked,
@@ -291,6 +316,8 @@ __export(runtime_exports, {
291
316
  module.exports = __toCommonJS(runtime_exports);
292
317
  var import_hook_slot_cache = require("./hook-slot-cache.cjs");
293
318
  var import_dom_stage = require("./dom-stage.cjs");
319
+ var import_dom_binding_styles = require("./dom-binding-styles.cjs");
320
+ var import_dom_binding_handoff = require("./dom-binding-handoff.cjs");
294
321
  var import_context_epoch = require("./context-epoch.cjs");
295
322
  var import_constants = require("./constants.cjs");
296
323
  var import_event_names = require("./event-names.cjs");
@@ -309,14 +336,23 @@ var import_html_tree_validation = require("./html-tree-validation.cjs");
309
336
  var import_component_flags = require("./component-flags.cjs");
310
337
  var import_error_codes_client_generated = require("./error-codes.client.generated.cjs");
311
338
  var import_form_diagnostics = require("./form-diagnostics.cjs");
339
+ var import_dom_binding_protocol = require("./dom-binding-protocol.cjs");
340
+ var import_dom_focused_move = require("./dom-focused-move.cjs");
312
341
  var import_stream_protocol = require("./stream-protocol.cjs");
313
342
  var import_renderer_bridge = require("./renderer-bridge.cjs");
314
343
  var import_native_read_client = require("./signals/native-read-client.cjs");
315
344
  var import_native_read_collector = require("./signals/native-read-collector.cjs");
316
345
  var import_native_read_retry = require("./signals/native-read-retry.cjs");
346
+ var import_transition_state = require("./signals/transition-state.cjs");
347
+ var import_transition_candidate = require("./signals/transition-candidate.cjs");
317
348
  var import_read_protocol = require("./signals/read-protocol.cjs");
318
349
  var import_native_read_events = require("./signals/native-read-events.cjs");
319
350
  var import_native_read_seeds = require("./signals/native-read-seeds.cjs");
351
+ var import_owner_context = require("./signals/owner-context.cjs");
352
+ var import_document_owner = require("./signals/document-owner.cjs");
353
+ var import_document_owner2 = require("./signals/document-owner.cjs");
354
+ var import_early_values = require("./signals/early-values.cjs");
355
+ var import_types = require("./signals/types.cjs");
320
356
  var import_read_protocol2 = require("./signals/read-protocol.cjs");
321
357
  var import_css = require("./css.cjs");
322
358
  let PROFILE_COMPONENT_OVERRIDE = null;
@@ -355,23 +391,394 @@ function registerHookCleanup(scope, cleanup) {
355
391
  let NATIVE_READ_DRIVER = null;
356
392
  let NATIVE_BLOCK_RETRIES = null;
357
393
  let NATIVE_ADOPTION_RELEASES = null;
394
+ let SIGNAL_BINDINGS_ENABLED = false;
395
+ const SCOPE_SIGNAL_OWNERS = /* @__PURE__ */ new WeakMap();
396
+ const SCOPE_SIGNAL_INSTANCE_KEYS = /* @__PURE__ */ new WeakMap();
397
+ let RETAINED_SIGNAL_OWNERS;
398
+ const SIGNAL_RETRY_LOCATIONS = /* @__PURE__ */ new WeakMap();
399
+ function signalRetryBoundary(block) {
400
+ let current = block;
401
+ while (current !== null) {
402
+ const state = current.__trySlot;
403
+ if (state !== void 0 && !state.propagateSuspense) return state;
404
+ current = current.parentBlock;
405
+ }
406
+ }
407
+ function retireRendererSignalOwner(owner) {
408
+ EFFECT_EVENT_LIFECYCLE_DEPTH++;
409
+ const frame = NATIVE_READ_DRIVER?.pauseLifecycle() ?? -1;
410
+ try {
411
+ (0, import_owner_context.retireSignalOwnerIdentity)(owner);
412
+ } finally {
413
+ if (frame >= 0) NATIVE_READ_DRIVER.resumeLifecycle(frame);
414
+ EFFECT_EVENT_LIFECYCLE_DEPTH--;
415
+ }
416
+ }
417
+ function signalRetrySlot(scope, target) {
418
+ const children = scope.children;
419
+ if (children !== null) {
420
+ for (const child2 of children) {
421
+ if (child2.scope === target) return ["scope", child2.key];
422
+ const nested = signalRetrySlot(child2.scope, target);
423
+ if (nested !== null) return ["scope", child2.key, ...nested];
424
+ }
425
+ }
426
+ const block = target.block;
427
+ for (let index = 0; index < scope.slots.length; index++) {
428
+ const slot = scope.slots[index];
429
+ if (slot === null || typeof slot !== "object") continue;
430
+ if (block.forSlot !== null && (slot === block.forSlot || slot.forSlot === block.forSlot))
431
+ return ["slot", index, "item", block.key];
432
+ if (slot.block === block || slot.tryBlock === block || slot.emptyBlock === block) {
433
+ return [
434
+ "slot",
435
+ index,
436
+ slot.__kind,
437
+ slot.tryBlock === block ? "primary" : slot.branch,
438
+ slot.emptyBlock === block ? "empty" : slot.currentIsBodyFn ? void 0 : slot.currentComp,
439
+ slot.prevKey
440
+ ];
441
+ }
442
+ }
443
+ return null;
444
+ }
445
+ function signalRetryPath(scope, root) {
446
+ if (scope === root) return [];
447
+ const location = SIGNAL_RETRY_LOCATIONS.get(scope);
448
+ let parent = location?.parent ?? scope.parent ?? scope.block.parentBlock;
449
+ while (parent instanceof LiteBlockImpl) parent = parent.parentBlock;
450
+ if (parent === null) return null;
451
+ const segment = location === void 0 ? signalRetrySlot(parent, scope) : ["slot", location.slot, location.kind, location.branch, location.component, location.key];
452
+ if (segment === null) return null;
453
+ const path = signalRetryPath(parent, root);
454
+ return path === null ? null : path.concat(segment);
455
+ }
456
+ function signalRetryNode(cache, path, create) {
457
+ let node = cache.paths;
458
+ for (const key of path) {
459
+ let next = node.children?.get(key);
460
+ if (next === void 0) {
461
+ if (!create) return;
462
+ next = {};
463
+ (node.children ??= /* @__PURE__ */ new Map()).set(key, next);
464
+ }
465
+ node = next;
466
+ }
467
+ return node;
468
+ }
469
+ function retainSignalRetryScope(scope, root, holder, subtree = false) {
470
+ const owner = SCOPE_SIGNAL_OWNERS.get(scope);
471
+ if (owner) {
472
+ const path = signalRetryPath(scope, root);
473
+ if (path !== null) {
474
+ const cache = holder.retrySignalOwners ??= { paths: {}, owners: /* @__PURE__ */ new Set() };
475
+ const node = signalRetryNode(cache, path, true);
476
+ const previous = node.owner;
477
+ node.owner = owner;
478
+ cache.owners.add(owner);
479
+ if (previous !== void 0 && previous !== owner) {
480
+ cache.owners.delete(previous);
481
+ retireRendererSignalOwner(previous);
482
+ }
483
+ }
484
+ }
485
+ if (subtree)
486
+ forEachSubtreeChild(scope, (child2) => retainSignalRetryScope(child2, root, holder, true));
487
+ else if (scope.children !== null)
488
+ for (const child2 of scope.children) retainSignalRetryScope(child2.scope, root, holder);
489
+ }
490
+ function clearSignalRetryOwners(holder) {
491
+ const cache = holder.retrySignalOwners;
492
+ if (cache === void 0) return;
493
+ holder.retrySignalOwners = void 0;
494
+ for (const owner of cache.owners) retireRendererSignalOwner(owner);
495
+ }
496
+ function discardSignalRetryItem(block, error) {
497
+ const previous = RETAINED_SIGNAL_OWNERS;
498
+ if (isSuspenseException(error)) {
499
+ const owner = block.idState.renderOwner;
500
+ const boundary = signalRetryBoundary(block);
501
+ const root = boundary?.tryBlock ?? owner?.current;
502
+ const holder = boundary ?? owner;
503
+ if (holder !== void 0 && root != null) {
504
+ retainSignalRetryScope(block, root, holder, true);
505
+ RETAINED_SIGNAL_OWNERS = holder.retrySignalOwners;
506
+ }
507
+ }
508
+ try {
509
+ unmountBlock(
510
+ block,
511
+ activeHydration() === null && !ROOT_RENDER_TRANSACTION?.hydrating && !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block)
512
+ );
513
+ } finally {
514
+ RETAINED_SIGNAL_OWNERS = previous;
515
+ }
516
+ }
517
+ function signalRetryListPath(scope, state, root) {
518
+ while (scope instanceof LiteBlockImpl) scope = scope.parentBlock;
519
+ for (let index = 0; index < scope.slots.length; index++) {
520
+ const slot = scope.slots[index];
521
+ if (slot === state || slot?.forSlot === state) {
522
+ const path = signalRetryPath(scope, root);
523
+ return path === null ? null : path.concat("slot", index, "item");
524
+ }
525
+ }
526
+ if (scope.children !== null) {
527
+ for (const child2 of scope.children) {
528
+ const path = signalRetryListPath(child2.scope, state, root);
529
+ if (path !== null) return path;
530
+ }
531
+ }
532
+ return null;
533
+ }
534
+ function collectRetiredSignalRetryOwners(node, cache, retired) {
535
+ if (node.owner !== void 0) {
536
+ cache.owners.delete(node.owner);
537
+ retired.push(node.owner);
538
+ node.owner = void 0;
539
+ }
540
+ if (node.children !== void 0)
541
+ for (const child2 of node.children.values())
542
+ collectRetiredSignalRetryOwners(child2, cache, retired);
543
+ }
544
+ function trackSignalRetryListKeys(parent, state, length, source) {
545
+ const boundary = signalRetryBoundary(parent);
546
+ const owner = parent.idState.renderOwner;
547
+ const cache = boundary?.retrySignalOwners ?? owner?.retrySignalOwners;
548
+ const root = boundary?.retrySignalOwners !== void 0 ? boundary.tryBlock : owner?.current;
549
+ if (cache === void 0 || root == null) return;
550
+ const path = signalRetryListPath(parent, state, root);
551
+ const node = path === null ? void 0 : signalRetryNode(cache, path, false);
552
+ if (node?.children === void 0) return;
553
+ const prune = (keys) => {
554
+ const present = new Set(keys);
555
+ const retired = [];
556
+ for (const [key, child2] of node.children) {
557
+ if (present.has(key)) continue;
558
+ node.children.delete(key);
559
+ collectRetiredSignalRetryOwners(child2, cache, retired);
560
+ }
561
+ for (const owner2 of retired) retireRendererSignalOwner(owner2);
562
+ };
563
+ if (typeof source !== "function") {
564
+ prune(source);
565
+ return;
566
+ }
567
+ if (length === 0) {
568
+ prune([]);
569
+ return;
570
+ }
571
+ const observed = /* @__PURE__ */ new Map();
572
+ let complete = false;
573
+ return (index, key) => {
574
+ if (!complete) {
575
+ observed.set(index, key);
576
+ if (observed.size === length) {
577
+ complete = true;
578
+ prune(observed.values());
579
+ }
580
+ }
581
+ };
582
+ }
583
+ function enableSignalBindings(abi = 1, potentialOnly = false) {
584
+ if (abi !== 1) throw new TypeError((0, import_error_codes_client_generated.formatClientError)(74));
585
+ SIGNAL_BINDINGS_ENABLED = true;
586
+ if (!potentialOnly) (0, import_document_owner.enableSignalDocument)(abi);
587
+ }
588
+ function signalIdentityKey(value) {
589
+ if (value === null) return "null";
590
+ const kind = typeof value;
591
+ return kind === "string" || kind === "number" || kind === "bigint" || kind === "boolean" ? kind.charCodeAt(0).toString(36) + ":" + String(value) : kind === "undefined" ? "u:" : "o:" + String(value);
592
+ }
593
+ function rootSignalInstanceKey(ids) {
594
+ return JSON.stringify([ids.signalState?.prefix ?? ids.prefix, "root"]);
595
+ }
596
+ function resolveSignalInstanceKey(scope) {
597
+ const identity = SCOPE_SIGNAL_INSTANCE_KEYS.get(scope);
598
+ if (identity === void 0 || typeof identity === "string") return identity;
599
+ const key = structuralSignalInstanceKey(
600
+ identity.parentScope,
601
+ identity.invocationSite,
602
+ identity.key,
603
+ identity.hasKey
604
+ );
605
+ SCOPE_SIGNAL_INSTANCE_KEYS.set(scope, key);
606
+ return key;
607
+ }
608
+ function structuralSignalInstanceKey(parentScope, invocationSite, key, hasKey) {
609
+ let base = resolveSignalInstanceKey(parentScope);
610
+ const itemKeys = [];
611
+ const visited = /* @__PURE__ */ new Set();
612
+ let scope = parentScope;
613
+ while (base === void 0 && scope !== null) {
614
+ const block2 = scope.block;
615
+ if (!visited.has(block2)) {
616
+ visited.add(block2);
617
+ if (block2.forSlot !== null) itemKeys.push(signalIdentityKey(block2.key));
618
+ base = resolveSignalInstanceKey(block2);
619
+ }
620
+ scope = scope.parent;
621
+ if (base === void 0 && scope !== null) base = resolveSignalInstanceKey(scope);
622
+ }
623
+ let block = parentScope.block;
624
+ while (base === void 0 && block !== null) {
625
+ if (!visited.has(block)) {
626
+ visited.add(block);
627
+ if (block.forSlot !== null) itemKeys.push(signalIdentityKey(block.key));
628
+ }
629
+ base = resolveSignalInstanceKey(block);
630
+ block = block.parentBlock;
631
+ }
632
+ base ??= rootSignalInstanceKey(parentScope.block.idState);
633
+ itemKeys.reverse();
634
+ return base + JSON.stringify([invocationSite ?? "legacy", itemKeys, hasKey ? signalIdentityKey(key) : ""]);
635
+ }
636
+ function stampSignalInstance(scope, parentScope, invocationSite, key, hasKey) {
637
+ if (SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled) {
638
+ SCOPE_SIGNAL_INSTANCE_KEYS.set(scope, { parentScope, invocationSite, key, hasKey });
639
+ }
640
+ }
641
+ function scopeSignalOwner(scope) {
642
+ if (scope === null) return;
643
+ const root = scope.block.idState.renderOwner;
644
+ let documentOwner = root?.signalOwner;
645
+ if (documentOwner === void 0 && import_document_owner.signalDocumentEnabled) {
646
+ documentOwner = (0, import_document_owner.documentSignalOwner)(scope.block.parentNode);
647
+ if (root !== void 0) root.signalOwner = documentOwner;
648
+ }
649
+ if (documentOwner === void 0) return;
650
+ let owner = SCOPE_SIGNAL_OWNERS.get(scope);
651
+ const retired = owner === null;
652
+ if (!owner || owner.documentOwner !== documentOwner) {
653
+ const ids = scope.block.idState;
654
+ owner = void 0;
655
+ const boundary = signalRetryBoundary(scope.block);
656
+ const cache = boundary?.retrySignalOwners ?? root?.retrySignalOwners;
657
+ const retryRoot = boundary?.retrySignalOwners !== void 0 ? boundary.tryBlock : root?.current;
658
+ if (cache !== void 0 && !retired && !scope.block.disposed && retryRoot != null) {
659
+ const path = signalRetryPath(scope, retryRoot);
660
+ const node = path === null ? void 0 : signalRetryNode(cache, path, false);
661
+ if (node?.owner !== void 0) {
662
+ owner = node.owner;
663
+ node.owner = void 0;
664
+ cache.owners.delete(owner);
665
+ }
666
+ }
667
+ if (owner === void 0 || owner.documentOwner !== documentOwner) {
668
+ const identity = {
669
+ scopeKey: documentOwner.scopeKey,
670
+ documentOwner,
671
+ instanceOwner: scope,
672
+ instanceKey: resolveSignalInstanceKey(scope) ?? rootSignalInstanceKey(ids)
673
+ };
674
+ identity.instanceOwner = identity;
675
+ owner = Object.freeze(identity);
676
+ }
677
+ SCOPE_SIGNAL_OWNERS.set(scope, owner);
678
+ if (retired) retireRendererSignalOwner(owner);
679
+ }
680
+ (0, import_early_values.registerSignalOwnerDocument)(owner, scope.block.parentNode.ownerDocument);
681
+ return owner;
682
+ }
683
+ function runWithBlockSignalOwner(scope, callback) {
684
+ const owner = scopeSignalOwner(scope);
685
+ if (owner !== void 0) (0, import_document_owner.streamedSignalOwnerActivator)?.(owner);
686
+ return owner === void 0 || (0, import_owner_context.currentSignalOwner)() === owner ? callback() : (0, import_owner_context.runWithSignalOwner)(owner, callback);
687
+ }
358
688
  function disposeNativeStyleBinding(binding) {
359
689
  if (binding.block !== null) unmountBlock(binding.block, false);
360
690
  binding.block = null;
361
691
  }
362
692
  function nativeStyleBody(props, scope) {
363
- const value = (0, import_read_protocol.readNativeDomStyle)(props.value);
693
+ const value = SIGNAL_BINDINGS_ENABLED ? runWithBlockSignalOwner(scope.parent, () => (0, import_read_protocol.readNativeDomStyle)(props.value)) : (0, import_read_protocol.readNativeDomStyle)(props.value);
364
694
  setStyle(props.el, value, scope.slots[0]);
365
695
  journalRootProperty(scope.slots, 0, scope.slots[0]);
366
696
  scope.slots[0] = value;
367
697
  }
368
698
  function nativeStyleBinding(owner, slotIndex, el, value) {
699
+ nativePresentationBinding(owner, slotIndex, el, nativeStyleBody, { el, value });
700
+ }
701
+ function prepareNativeProjection(props, scope) {
702
+ const prepare = () => {
703
+ const projected = props.compute();
704
+ return props.fields.map((field) => {
705
+ const value = projected?.[field];
706
+ if (field === "style") return (0, import_dom_binding_styles.__normalizeBindingStyle)((0, import_read_protocol.readNativeDomStyle)(value));
707
+ if (field === "class" || field === "className")
708
+ return value == null || value === false ? null : (0, import_css.normalizeClass)(value);
709
+ return coerceAttrValue(props.el, field, value);
710
+ });
711
+ };
712
+ return SIGNAL_BINDINGS_ENABLED ? runWithBlockSignalOwner(scope.parent, prepare) : prepare();
713
+ }
714
+ function publishNativeProjection(props, values, previous) {
715
+ for (let i = 0; i < props.fields.length; i++) {
716
+ const field = props.fields[i];
717
+ const value = values[i];
718
+ if (previous !== void 0 && Object.is(previous[i], value)) continue;
719
+ if (field === "style") setStyle(props.el, value, previous?.[i]);
720
+ else if (field === "class" || field === "className") setClassAttr(props.el, value);
721
+ else setAttribute(props.el, field, value);
722
+ }
723
+ }
724
+ function nativeProjectionBody(props, scope) {
725
+ const values = prepareNativeProjection(props, scope);
726
+ publishNativeProjection(props, values, scope.slots[0]);
727
+ journalRootProperty(scope.slots, 0, scope.slots[0]);
728
+ scope.slots[0] = values;
729
+ }
730
+ function preparedNativeStyleBody(props, scope) {
731
+ const native = (0, import_read_protocol.setNativeAdoptionResolver)(null);
732
+ const witness = beginNativeReadWitness();
733
+ let value;
734
+ let completed = false;
735
+ try {
736
+ value = runWithBlockSignalOwner(
737
+ scope.parent,
738
+ () => (0, import_dom_binding_styles.__normalizeBindingStyle)((0, import_read_protocol.readNativeDomStyle)(props.value))
739
+ );
740
+ completed = true;
741
+ } finally {
742
+ props.frame.witnesses.set(scope, finishNativeReadWitness(witness, completed));
743
+ (0, import_read_protocol.setNativeAdoptionResolver)(native);
744
+ }
745
+ preparePresentationOperation(props.frame, scope, "native", () => {
746
+ setStyle(props.el, value, "");
747
+ scope.block.body = nativeStyleBody;
748
+ });
749
+ journalRootProperty(scope.slots, 0, scope.slots[0]);
750
+ scope.slots[0] = value;
751
+ }
752
+ function preparedNativeProjectionBody(props, scope) {
753
+ const native = (0, import_read_protocol.setNativeAdoptionResolver)(null);
754
+ const witness = beginNativeReadWitness();
755
+ let values;
756
+ let completed = false;
757
+ try {
758
+ values = prepareNativeProjection(props, scope);
759
+ completed = true;
760
+ } finally {
761
+ props.frame.witnesses.set(scope, finishNativeReadWitness(witness, completed));
762
+ (0, import_read_protocol.setNativeAdoptionResolver)(native);
763
+ }
764
+ preparePresentationOperation(props.frame, scope, "native", () => {
765
+ publishNativeProjection(
766
+ props,
767
+ values,
768
+ props.fields.map((field) => field === "style" ? "" : void 0)
769
+ );
770
+ scope.block.body = nativeProjectionBody;
771
+ });
772
+ journalRootProperty(scope.slots, 0, scope.slots[0]);
773
+ scope.slots[0] = values;
774
+ }
775
+ function nativeProjectionBinding(owner, slotIndex, el, compute, fields) {
776
+ nativePresentationBinding(owner, slotIndex, el, nativeProjectionBody, { el, compute, fields });
777
+ }
778
+ function nativePresentationBinding(owner, slotIndex, el, body, props) {
369
779
  let binding = owner.slots[slotIndex];
370
780
  if (binding === void 0) {
371
- const block = createBlock("control-flow", owner.block, el, null, null, nativeStyleBody, {
372
- el,
373
- value
374
- });
781
+ const block = createBlock("control-flow", owner.block, el, null, null, body, props);
375
782
  block.parent = owner;
376
783
  binding = {
377
784
  __kind: "nativeStyleBinding",
@@ -391,7 +798,7 @@ function nativeStyleBinding(owner, slotIndex, el, value) {
391
798
  block.slots[0] = void 0;
392
799
  }
393
800
  journalRootProperty(block, "props", block.props);
394
- block.props = { el, value };
801
+ block.props = props;
395
802
  }
396
803
  renderBlock(binding.block);
397
804
  }
@@ -411,6 +818,15 @@ function beginActiveNativeReadScope(scope) {
411
818
  return block === null ? -1 : NATIVE_READ_DRIVER.beginScope(scope, block);
412
819
  }
413
820
  function scheduleNativeRead(target) {
821
+ const activation = preservedHydrateActivationCount === 0 ? null : pendingHydrateOwner(target);
822
+ if (activation !== null) {
823
+ invalidateRender(target, activation.block);
824
+ if (activation.activationRequested) {
825
+ activation.serverActivationStarted = false;
826
+ scheduleRender(activation.parentBlock);
827
+ }
828
+ return;
829
+ }
414
830
  invalidateRender(target, target);
415
831
  const retainPriority = SCHEDULED_VISIBILITY_DRIVER?.holdsNativeRead(target) === true;
416
832
  if (retainPriority) TRANSITION_DEPTH++;
@@ -426,6 +842,8 @@ function ensureNativeReadDriver() {
426
842
  capture: () => WIP_CAPTURE,
427
843
  cleanup: registerHookCleanup,
428
844
  schedule: scheduleNativeRead,
845
+ prepare: prepareNativeTransitionBlock,
846
+ retire: retireNativeTransitionBlock,
429
847
  suspended: retainNativeRetryReads,
430
848
  replayRefs: (capture, owner) => replayNativeUnpublishedRefs(capture, owner),
431
849
  refDisposed: (entry) => blockSubtreeDisposed(entry.block)
@@ -457,13 +875,13 @@ function inspectDevtoolsName(scope) {
457
875
  }
458
876
  function acceptNativeCapture(capture, owner, replayRootRefs = false) {
459
877
  const driver = NATIVE_READ_DRIVER;
460
- if (driver === null) return;
878
+ if (driver === null) return false;
461
879
  if (DEFERRED_LAYOUT_DRIVER?.stageAction(
462
880
  () => acceptNativeCapture(capture, owner, replayRootRefs)
463
881
  ) === true)
464
- return;
882
+ return true;
465
883
  const native = driver.acceptCapture(capture);
466
- if (owner === void 0) return;
884
+ if (owner === void 0) return false;
467
885
  const replays = replayRootRefs && driver.replayDeferredRefs(capture, owner);
468
886
  if (native || replays || driver.hasPublication(owner)) {
469
887
  driver.stampPublication(owner, [
@@ -474,6 +892,7 @@ function acceptNativeCapture(capture, owner, replayRootRefs = false) {
474
892
  capture.refs
475
893
  ]);
476
894
  }
895
+ return false;
477
896
  }
478
897
  function replayNativeUnpublishedRefs(capture, owner) {
479
898
  const driver = NATIVE_READ_DRIVER;
@@ -511,6 +930,7 @@ function replayNativeReadWitness(witness) {
511
930
  NATIVE_READ_DRIVER?.replay(witness);
512
931
  }
513
932
  function retainNativeRetryReads(block, reads) {
933
+ if (NATIVE_TRANSITION_ATTEMPT !== null) return;
514
934
  for (let current = block; current !== null; current = current.parentBlock) {
515
935
  if (current.__suspenseHandler) {
516
936
  const retries = NATIVE_BLOCK_RETRIES ??= /* @__PURE__ */ new WeakMap();
@@ -667,6 +1087,7 @@ function hydrationNodeMatches(server, template2, partialStyles, path = "") {
667
1087
  const tAttrs = (STAGED_DOM?.view(t) ?? t).attributes;
668
1088
  for (let i = 0; i < tAttrs.length; i++) {
669
1089
  const a = tAttrs[i];
1090
+ if ((STAGED_DOM?.view(a) ?? a).name === import_constants.HYDRATE_INPUT_ATTR) continue;
670
1091
  if ((STAGED_DOM?.view(s) ?? s).getAttribute((STAGED_DOM?.view(a) ?? a).name) !== (STAGED_DOM?.view(a) ?? a).value && !((STAGED_DOM?.view(a) ?? a).name === "style" && partialStyles !== void 0 && partialStyles.includes("|" + path + "|"))) {
671
1092
  return false;
672
1093
  }
@@ -723,22 +1144,24 @@ let COMMIT_PHASE_ERRORS = null;
723
1144
  let REF_CALLBACK_DEPTH = 0;
724
1145
  let STORE_SYNC_DEPTH = 0;
725
1146
  let EFFECT_EVENT_LIFECYCLE_DEPTH = 0;
726
- function runEffectLifecycleCallback(callback) {
1147
+ function runEffectLifecycleCallback(callback, scope = null) {
727
1148
  EFFECT_EVENT_LIFECYCLE_DEPTH++;
728
1149
  const nativeFrame = NATIVE_READ_DRIVER?.pauseLifecycle() ?? -1;
729
1150
  try {
730
- callback();
1151
+ if (import_document_owner.signalDocumentEnabled || scope?.block.idState.renderOwner?.signalOwner !== void 0)
1152
+ runWithBlockSignalOwner(scope, callback);
1153
+ else callback();
731
1154
  } finally {
732
1155
  if (nativeFrame >= 0) NATIVE_READ_DRIVER.resumeLifecycle(nativeFrame);
733
1156
  EFFECT_EVENT_LIFECYCLE_DEPTH--;
734
1157
  }
735
1158
  }
736
- function runEffectCleanupCallback(callback, phase = -1) {
1159
+ function runEffectCleanupCallback(callback, phase = -1, scope = null) {
737
1160
  const previousPhase = CURRENT_EFFECT_PHASE;
738
1161
  CURRENT_EFFECT_PHASE = phase;
739
1162
  EFFECT_BODY_DEPTH++;
740
1163
  try {
741
- runEffectLifecycleCallback(callback);
1164
+ runEffectLifecycleCallback(callback, scope);
742
1165
  } finally {
743
1166
  EFFECT_BODY_DEPTH--;
744
1167
  CURRENT_EFFECT_PHASE = previousPhase;
@@ -773,8 +1196,275 @@ function ensureTransitionSwapDriver() {
773
1196
  rebaseHeld: rebaseHeldTransitionUpdate
774
1197
  };
775
1198
  }
1199
+ let NATIVE_TRANSITION_QUEUE = null;
1200
+ let NATIVE_TRANSITION_ATTEMPT = null;
1201
+ function queueNativeTransition(batch) {
1202
+ (NATIVE_TRANSITION_QUEUE ??= /* @__PURE__ */ new Set()).add(batch);
1203
+ if (!scheduled && !syncFlush) {
1204
+ scheduled = true;
1205
+ queueMicrotask(flush);
1206
+ }
1207
+ }
1208
+ function prepareNativeTransitionBlock(block) {
1209
+ const admission = NATIVE_TRANSITION_ATTEMPT;
1210
+ if (block.disposed || admission.blocks.has(block)) return;
1211
+ const hidden = SCHEDULED_VISIBILITY_DRIVER?.find(block, false);
1212
+ if (hidden?.nativeTransition !== void 0 && hidden.tryBlock !== null) block = hidden.tryBlock;
1213
+ if (admission.blocks.has(block)) return;
1214
+ const owner = block.idState.renderOwner;
1215
+ if (owner === void 0 || owner.disposed) return;
1216
+ const retired = owner.transaction?.retired;
1217
+ if (retired !== void 0 && retired !== null) {
1218
+ for (let current = block; current !== null; current = current.parentBlock)
1219
+ if (retired.has(current)) return;
1220
+ }
1221
+ admission.blocks.add(block);
1222
+ const root = beginRootRender(owner);
1223
+ admission.transactions.add(owner.transaction);
1224
+ const mode = block.pendingMode;
1225
+ block.pendingMode = "transition";
1226
+ const attempt = beginTransitionAttempt(block);
1227
+ if (attempt !== null) admission.attempts.push(attempt);
1228
+ try {
1229
+ invalidateRender(block, block);
1230
+ if (hidden?.nativeTransition !== void 0) {
1231
+ journalObjectOnce(hidden);
1232
+ journalRootProperty(block, "inactive", block.inactive);
1233
+ SCHEDULED_VISIBILITY_DRIVER.reveal(hidden, "transition");
1234
+ } else renderBlock(block);
1235
+ } catch (error) {
1236
+ if (isSuspenseException(error)) {
1237
+ for (let owner2 = block; owner2 !== null; owner2 = owner2.parentBlock) {
1238
+ const handler = owner2.__suspenseHandler;
1239
+ if (handler) {
1240
+ try {
1241
+ handler(error.thenable, block);
1242
+ } catch (suspension) {
1243
+ if (!isSuspenseException(suspension)) throw suspension;
1244
+ }
1245
+ break;
1246
+ }
1247
+ }
1248
+ throw error.thenable;
1249
+ }
1250
+ admission.errorBlock ??= block;
1251
+ throw error;
1252
+ } finally {
1253
+ endTransitionAttempt(attempt);
1254
+ block.pendingMode = mode;
1255
+ endRootRender(root);
1256
+ }
1257
+ }
1258
+ function finishNativeTransition(batch) {
1259
+ batch.nativeWake?.();
1260
+ batch.nativeWake = void 0;
1261
+ batch.native = void 0;
1262
+ for (const block of batch.nativeBlocks ?? [])
1263
+ block.idState.renderOwner?.nativeTransitions?.delete(batch);
1264
+ batch.nativeBlocks = void 0;
1265
+ for (const state of batch.nativeBoundaries?.keys() ?? []) {
1266
+ if (state.nativeTransition !== batch) continue;
1267
+ state.nativeTransition = void 0;
1268
+ if (state.transitionTimeoutId !== null) {
1269
+ clearTimeout(state.transitionTimeoutId);
1270
+ state.transitionTimeoutId = null;
1271
+ }
1272
+ }
1273
+ batch.nativeBoundaries = void 0;
1274
+ NATIVE_TRANSITION_QUEUE?.delete(batch);
1275
+ if (NATIVE_TRANSITION_QUEUE?.size === 0) NATIVE_TRANSITION_QUEUE = null;
1276
+ releaseTransitionHookHolder(batch);
1277
+ }
1278
+ function retireNativeTransitionBlock(block) {
1279
+ if (ROOT_RENDER_ROLLBACK) return;
1280
+ for (const batch of block.idState.renderOwner?.nativeTransitions ?? []) {
1281
+ if (!batch.nativeBlocks?.has(block)) continue;
1282
+ queueNativeTransition(batch);
1283
+ }
1284
+ }
1285
+ function prepareNativeTransitionUpdates(batch) {
1286
+ for (const update of batch.updates.values()) {
1287
+ const { block, slot, state, reducer } = update;
1288
+ const owner = block.idState.renderOwner;
1289
+ if (block.disposed || owner === void 0 || owner.disposed) continue;
1290
+ const frame = beginRootRender(owner);
1291
+ NATIVE_TRANSITION_ATTEMPT.transactions.add(owner.transaction);
1292
+ try {
1293
+ journalObjectOnce(slot);
1294
+ if (state !== void 0) {
1295
+ state.renderTransition = update;
1296
+ state.updates = void 0;
1297
+ } else if (reducer !== void 0) {
1298
+ reducer.renderTransition = update;
1299
+ reducer.renderPhaseActions = void 0;
1300
+ } else slot.value = rebaseTransitionActionUpdate(update);
1301
+ if (slot.pendingActionBatch === batch) {
1302
+ slot.pendingActionBatch = void 0;
1303
+ slot.pendingActionValue = void 0;
1304
+ }
1305
+ } finally {
1306
+ endRootRender(frame);
1307
+ }
1308
+ }
1309
+ }
1310
+ function prepareNativeTransitionHook(batch, hook) {
1311
+ const owner = hook.block.idState.renderOwner;
1312
+ if (hook.block.disposed || owner === void 0 || owner.disposed) return;
1313
+ const frame = beginRootRender(owner);
1314
+ NATIVE_TRANSITION_ATTEMPT.transactions.add(owner.transaction);
1315
+ try {
1316
+ if (batch.hooksPending && hook.pendingBatches === 1) {
1317
+ journalObjectOnce(hook);
1318
+ hook.isPending = false;
1319
+ }
1320
+ } finally {
1321
+ endRootRender(frame);
1322
+ }
1323
+ prepareNativeTransitionBlock(hook.block);
1324
+ }
1325
+ function flushNativeTransitions() {
1326
+ const queue = NATIVE_TRANSITION_QUEUE;
1327
+ if (queue === null) return;
1328
+ NATIVE_TRANSITION_QUEUE = null;
1329
+ for (const batch of queue) {
1330
+ const candidate = batch.native;
1331
+ if (candidate === void 0) continue;
1332
+ batch.nativeWake?.();
1333
+ batch.nativeWake = void 0;
1334
+ try {
1335
+ if (!candidate.validate()) candidate.rebase();
1336
+ } catch {
1337
+ candidate.discard();
1338
+ finishNativeTransition(batch);
1339
+ flushTransitionActionBatch(batch);
1340
+ continue;
1341
+ }
1342
+ if (!candidate.hasWrites()) {
1343
+ candidate.discard();
1344
+ finishNativeTransition(batch);
1345
+ flushTransitionActionBatch(batch);
1346
+ continue;
1347
+ }
1348
+ const admission = {
1349
+ blocks: /* @__PURE__ */ new Set(),
1350
+ transactions: /* @__PURE__ */ new Set(),
1351
+ attempts: [],
1352
+ presentations: [],
1353
+ suspensions: /* @__PURE__ */ new Map()
1354
+ };
1355
+ NATIVE_TRANSITION_ATTEMPT = admission;
1356
+ let outcome;
1357
+ try {
1358
+ outcome = candidate.prepare([
1359
+ () => prepareNativeTransitionUpdates(batch),
1360
+ ...batch.hook === null ? [] : [() => prepareNativeTransitionHook(batch, batch.hook)],
1361
+ ...(batch.hooks ?? []).map((hook) => () => prepareNativeTransitionHook(batch, hook)),
1362
+ ...[...batch.updates.values()].map(
1363
+ (update) => () => prepareNativeTransitionBlock(update.block)
1364
+ ),
1365
+ ...candidate.consumers().filter((consumer) => consumer.active()).map((consumer) => () => {
1366
+ const presentation = consumer.prepare();
1367
+ if (presentation !== void 0) admission.presentations.push(presentation);
1368
+ })
1369
+ ]);
1370
+ } finally {
1371
+ NATIVE_TRANSITION_ATTEMPT = null;
1372
+ }
1373
+ for (const block of batch.nativeBlocks ?? [])
1374
+ block.idState.renderOwner?.nativeTransitions?.delete(batch);
1375
+ batch.nativeBlocks = admission.blocks;
1376
+ for (const transaction of admission.transactions)
1377
+ (transaction.owner.nativeTransitions ??= /* @__PURE__ */ new Set()).add(batch);
1378
+ const valid = outcome.status === "ready" && admission.presentations.every((presentation) => presentation.validate()) && [...admission.transactions].every(
1379
+ (transaction) => !transaction.aborted && !transaction.owner.disposed && currentPresentations(transaction.capture) && (NATIVE_READ_DRIVER === null || NATIVE_READ_DRIVER.validateCapture(transaction.capture))
1380
+ );
1381
+ if (valid && outcome.status === "ready" && outcome.receipt.publish(() => {
1382
+ for (const transaction of admission.transactions) {
1383
+ transaction.nativeAdmitted = true;
1384
+ acceptNativeCapture(transaction.capture, transaction.owner, true);
1385
+ }
1386
+ batch.flushed = true;
1387
+ batch.updates.clear();
1388
+ finishNativeTransition(batch);
1389
+ for (const presentation of admission.presentations) presentation.commit();
1390
+ commitRootRenders();
1391
+ })) {
1392
+ continue;
1393
+ }
1394
+ for (const transaction of admission.transactions) rollbackRootRender(transaction);
1395
+ for (const presentation of admission.presentations) presentation.discard();
1396
+ for (let i = admission.attempts.length - 1; i >= 0; i--) {
1397
+ const swaps = admission.attempts[i].memoSwaps;
1398
+ if (swaps !== null)
1399
+ for (let j = swaps.length - 1; j >= 0; j--) applyTransitionMemoSwap(swaps[j], false);
1400
+ }
1401
+ commitRootRenders();
1402
+ if (outcome.status === "pending") {
1403
+ for (const state of batch.nativeBoundaries?.keys() ?? []) {
1404
+ if (admission.suspensions.has(state)) continue;
1405
+ if (state.nativeTransition === batch) state.nativeTransition = void 0;
1406
+ if (state.transitionTimeoutId !== null) {
1407
+ clearTimeout(state.transitionTimeoutId);
1408
+ state.transitionTimeoutId = null;
1409
+ }
1410
+ }
1411
+ for (const [state, thenable] of admission.suspensions) {
1412
+ state.nativeTransition = batch;
1413
+ if (state.hasResolved && state.branch === 1 && state.pendingBody !== null && TRANSITION_FALLBACK_TIMEOUT_MS !== Infinity && TRANSITION_FALLBACK_TIMEOUT_MS >= 0 && (state.transitionTimeoutId === null || batch.nativeBoundaries?.get(state) !== thenable)) {
1414
+ if (state.transitionTimeoutId !== null) clearTimeout(state.transitionTimeoutId);
1415
+ state.transitionTimeoutId = setTimeout(() => {
1416
+ state.transitionTimeoutId = null;
1417
+ if (state.nativeTransition === batch && !state.parentBlock.disposed && state.branch === 1)
1418
+ SCHEDULED_VISIBILITY_DRIVER.hidePending(state);
1419
+ }, TRANSITION_FALLBACK_TIMEOUT_MS);
1420
+ }
1421
+ }
1422
+ batch.nativeBoundaries = admission.suspensions;
1423
+ batch.nativeWake = candidate.watchPreparation(outcome, () => queueNativeTransition(batch));
1424
+ } else if (outcome.status === "ready" || outcome.status === "invalid" && outcome.reason === "stale") {
1425
+ queueNativeTransition(batch);
1426
+ } else {
1427
+ candidate.discard();
1428
+ finishNativeTransition(batch);
1429
+ for (const update of batch.updates.values()) {
1430
+ if (update.slot.pendingActionBatch === batch) {
1431
+ update.slot.pendingActionBatch = void 0;
1432
+ update.slot.pendingActionValue = void 0;
1433
+ }
1434
+ }
1435
+ batch.updates.clear();
1436
+ batch.flushed = true;
1437
+ if (outcome.status === "error") {
1438
+ if (admission.errorBlock !== void 0 && !admission.errorBlock.disposed)
1439
+ handleResumeError(admission.errorBlock, outcome.error);
1440
+ else reportTransitionError(outcome.error, batch.hook ?? void 0);
1441
+ } else if (outcome.status === "invalid")
1442
+ reportTransitionError(new TypeError((0, import_error_codes_client_generated.formatClientError)(79)), batch.hook ?? void 0);
1443
+ }
1444
+ }
1445
+ }
776
1446
  let ACTIVE_TRANSITION_ACTION_BATCH = null;
777
1447
  let IN_FLIGHT_TRANSITION_ACTION_BATCH = null;
1448
+ let nativeActionResolverInstalled = false;
1449
+ function nativeCandidateForAction(batch) {
1450
+ let candidate = batch.native;
1451
+ if (candidate !== void 0 && !candidate.validate()) {
1452
+ if (candidate.hasWrites()) candidate.rebase();
1453
+ else {
1454
+ candidate.discard();
1455
+ candidate = void 0;
1456
+ }
1457
+ }
1458
+ return candidate ?? (batch.native = new import_transition_candidate.SignalCandidateFrame());
1459
+ }
1460
+ function ensureNativeActionResolver() {
1461
+ if (nativeActionResolverInstalled) return;
1462
+ nativeActionResolverInstalled = true;
1463
+ (0, import_read_protocol.registerNativeActionResolver)(() => {
1464
+ const batch = transitionActionBatchForUpdate();
1465
+ return batch === null ? void 0 : nativeCandidateForAction(batch);
1466
+ });
1467
+ }
778
1468
  function createTransitionActionBatch() {
779
1469
  return {
780
1470
  updates: /* @__PURE__ */ new Map(),
@@ -837,6 +1527,16 @@ function stageTransitionValue(slot, block, operation, value, forceRender = false
837
1527
  }
838
1528
  function flushTransitionActionBatch(batch) {
839
1529
  if (batch.flushed) return;
1530
+ if (batch.native !== void 0) {
1531
+ if (batch.native.hasWrites()) {
1532
+ holdTransitionHookBatch(batch, batch);
1533
+ queueNativeTransition(batch);
1534
+ if (IN_FLIGHT_TRANSITION_ACTION_BATCH === batch) IN_FLIGHT_TRANSITION_ACTION_BATCH = null;
1535
+ return;
1536
+ }
1537
+ batch.native.discard();
1538
+ batch.native = void 0;
1539
+ }
840
1540
  batch.flushed = true;
841
1541
  for (const update of batch.updates.values()) {
842
1542
  const { slot, block, forceRender } = update;
@@ -1502,24 +2202,45 @@ function journalRootSlot(state, parent, before, after) {
1502
2202
  journalUndo(() => {
1503
2203
  structures.delete(state);
1504
2204
  });
1505
- journalRootRange(parent, before, after);
2205
+ if (PRESENTATION_HYDRATION?.revision === void 0) journalRootRange(parent, before, after);
1506
2206
  }
1507
2207
  function journalRootRange(parent, before, after) {
2208
+ const leases = ROOT_RENDER_TRANSACTION?.owner.bindingLeases;
1508
2209
  const nodes = [];
1509
2210
  for (let node = before === null ? getFirstChild(parent) : getNextSibling(before); node !== null && node !== after; node = getNextSibling(node))
1510
2211
  nodes.push(node);
1511
2212
  journalUndo(() => {
2213
+ let restore = nodes;
2214
+ for (const lease of leases ?? []) {
2215
+ if (lease.end === void 0 || !lease.active()) continue;
2216
+ let ancestor = parent;
2217
+ while (ancestor !== null && ancestor.parentNode !== lease.root.parentNode)
2218
+ ancestor = ancestor.parentNode;
2219
+ for (let current2 = lease.root; current2 !== null; current2 = current2.nextSibling) {
2220
+ if (current2 === ancestor) return;
2221
+ if (current2 === lease.end) break;
2222
+ }
2223
+ const start = restore.indexOf(lease.root);
2224
+ const end = restore.indexOf(lease.end);
2225
+ if (start < 0 || end < start || lease.root.parentNode !== parent) continue;
2226
+ const current = [];
2227
+ for (let node2 = lease.root; node2 !== null; node2 = node2.nextSibling) {
2228
+ current.push(node2);
2229
+ if (node2 === lease.end) break;
2230
+ }
2231
+ restore = [...restore.slice(0, start), ...current, ...restore.slice(end + 1)];
2232
+ }
1512
2233
  if (before !== null && (STAGED_DOM?.view(before) ?? before).parentNode !== parent || after !== null && (STAGED_DOM?.view(after) ?? after).parentNode !== parent)
1513
2234
  return;
1514
2235
  let node = before !== null && (STAGED_DOM?.view(before) ?? before).parentNode === parent ? getNextSibling(before) : getFirstChild(parent);
1515
2236
  const anchor = after !== null && (STAGED_DOM?.view(after) ?? after).parentNode === parent ? after : null;
1516
- const retained = new Set(nodes);
2237
+ const retained = new Set(restore);
1517
2238
  while (node !== null && node !== anchor) {
1518
2239
  const next = getNextSibling(node);
1519
2240
  if (!retained.has(node)) (STAGED_DOM?.view(parent) ?? parent).removeChild(node);
1520
2241
  node = next;
1521
2242
  }
1522
- restoreRootNodes(parent, nodes, anchor);
2243
+ restoreRootNodes(parent, restore, anchor);
1523
2244
  });
1524
2245
  }
1525
2246
  function journalRootChildren(parent) {
@@ -1664,6 +2385,7 @@ function createdInRootRender(block) {
1664
2385
  if (transaction === null || ROOT_RENDER_ROLLBACK || isCreatedInRootRender(transaction, block))
1665
2386
  return;
1666
2387
  block.createdStamp = transaction.createdStamp;
2388
+ if (PRESENTATION_HYDRATION?.revision !== void 0) preserveRootCreatedDom(block);
1667
2389
  (transaction.created ??= []).push(block);
1668
2390
  TRANSITION_JOURNAL.push(JOURNAL_CREATED, block, transaction, null);
1669
2391
  }
@@ -1674,6 +2396,8 @@ function preserveRootCreatedDom(block) {
1674
2396
  function rollbackRootRender(transaction) {
1675
2397
  if (transaction.aborted) return;
1676
2398
  transaction.aborted = true;
2399
+ if (transaction.owner.retrySignalOwners !== void 0 && transaction.owner.retrySignalOwners !== RETAINED_SIGNAL_OWNERS)
2400
+ clearSignalRetryOwners(transaction.owner);
1677
2401
  const frame = beginRootRender(transaction.owner);
1678
2402
  const previousRollback = ROOT_RENDER_ROLLBACK;
1679
2403
  ROOT_RENDER_ROLLBACK = true;
@@ -1700,6 +2424,19 @@ function rollbackRootRender(transaction) {
1700
2424
  endRootRender(frame);
1701
2425
  }
1702
2426
  }
2427
+ function retireDetachedBindingLeases(owner) {
2428
+ for (const lease of owner.bindingLeases) {
2429
+ if (owner.bindingContainer.contains(lease.anchor)) continue;
2430
+ owner.bindingLeases.delete(lease);
2431
+ PRESENTATION_PREPARATIONS.delete(lease);
2432
+ (0, import_dom_binding_handoff.releaseBindingHandoff)(lease);
2433
+ try {
2434
+ lease.retire();
2435
+ } catch (error) {
2436
+ if (!reportUncaughtError(owner.current, error)) console.error(error);
2437
+ }
2438
+ }
2439
+ }
1703
2440
  function commitRootRenders() {
1704
2441
  const transactions = ROOT_RENDER_TRANSACTIONS;
1705
2442
  if (transactions.length === 0) return;
@@ -1713,17 +2450,23 @@ function commitRootRenders() {
1713
2450
  if (owner.transition !== void 0) TRANSITION_SWAP_DRIVER.commitRoot(owner, transaction);
1714
2451
  continue;
1715
2452
  }
1716
- if (NATIVE_READ_DRIVER !== null && !NATIVE_READ_DRIVER.validateCapture(transaction.capture)) {
2453
+ if (!transaction.nativeAdmitted && (!currentPresentations(transaction.capture) || NATIVE_READ_DRIVER !== null && !NATIVE_READ_DRIVER.validateCapture(transaction.capture))) {
2454
+ const presentationChanged = !currentPresentations(transaction.capture);
1717
2455
  rollbackRootRender(transaction);
1718
2456
  if (owner.transaction === transaction) owner.transaction = null;
1719
2457
  if (!owner.disposed) {
1720
2458
  owner.wakeable = null;
1721
2459
  owner.generation++;
1722
- owner.retry();
2460
+ if (presentationChanged) retryPresentations(transaction.capture);
2461
+ else owner.retry();
1723
2462
  }
1724
2463
  continue;
1725
2464
  }
1726
2465
  if (owner.transaction === transaction) owner.transaction = null;
2466
+ if (transaction.capture.presentations !== void 0 && STAGED_COMMIT_CAPTURE !== null) {
2467
+ stagedOwnerGuard(STAGED_COMMIT_CAPTURE, owner);
2468
+ STAGED_COMMIT_CAPTURE.owners.get(owner).presentation = transaction;
2469
+ }
1727
2470
  if (transaction.rootRequest && (owner.transition === void 0 || !TRANSITION_SWAP_DRIVER.keepsRoot(owner))) {
1728
2471
  owner.wakeable = null;
1729
2472
  owner.generation++;
@@ -1731,8 +2474,9 @@ function commitRootRenders() {
1731
2474
  if (owner.wakeable === null) {
1732
2475
  owner.retryKey = null;
1733
2476
  owner.nativeRetry?.clear();
2477
+ if (owner.retrySignalOwners !== void 0) clearSignalRetryOwners(owner);
1734
2478
  }
1735
- acceptNativeCapture(transaction.capture, owner, true);
2479
+ const deferredNativeAcceptance = acceptNativeCapture(transaction.capture, owner, true);
1736
2480
  const acceptedGeneration = owner.generation;
1737
2481
  const commits = transaction.commit;
1738
2482
  if (commits !== null) {
@@ -1758,7 +2502,11 @@ function commitRootRenders() {
1758
2502
  discardOffscreenCapture(transaction.capture);
1759
2503
  continue;
1760
2504
  }
1761
- spliceOffscreenCapture(transaction.capture);
2505
+ spliceOffscreenCapture(transaction.capture, deferredNativeAcceptance);
2506
+ if (owner.bindingLeases !== void 0 && owner.bindingLeases.size > 0) {
2507
+ if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => retireDetachedBindingLeases(owner)) !== true)
2508
+ retireDetachedBindingLeases(owner);
2509
+ }
1762
2510
  if (owner.transition !== void 0) TRANSITION_SWAP_DRIVER.commitRoot(owner, transaction);
1763
2511
  } finally {
1764
2512
  finishStagedOwner?.();
@@ -1777,7 +2525,19 @@ function suspendRootRender(block, wakeable, attempt) {
1777
2525
  retainDiscardedWarmMemos(created);
1778
2526
  }
1779
2527
  }
1780
- rollbackRootRender(transaction);
2528
+ const previousRetainedOwners = RETAINED_SIGNAL_OWNERS;
2529
+ const rootBlock = owner.current;
2530
+ if (rootBlock !== null && transaction.created !== null && owner.signalOwner !== void 0) {
2531
+ for (const created of transaction.created) {
2532
+ if (!created.disposed) retainSignalRetryScope(created, rootBlock, owner);
2533
+ }
2534
+ RETAINED_SIGNAL_OWNERS = owner.retrySignalOwners;
2535
+ }
2536
+ try {
2537
+ rollbackRootRender(transaction);
2538
+ } finally {
2539
+ RETAINED_SIGNAL_OWNERS = previousRetainedOwners;
2540
+ }
1781
2541
  }
1782
2542
  owner.wakeable = wakeable;
1783
2543
  const generation = ++owner.generation;
@@ -3459,6 +4219,7 @@ function ensureScheduledVisibilityDriver() {
3459
4219
  find: findScheduledVisibilityOwner,
3460
4220
  holdsNativeRead,
3461
4221
  reveal: attemptHiddenReveal,
4222
+ hidePending: hideTryContentAndMountPending,
3462
4223
  visible: renderVisibleTry,
3463
4224
  rehide: rehideActivityAfterDescendantRender,
3464
4225
  retryActivity: renderHiddenActivity
@@ -3554,16 +4315,22 @@ function drainQueue() {
3554
4315
  } catch (unhandled) {
3555
4316
  const transaction = block.idState.renderOwner?.transaction;
3556
4317
  if (transaction != null) rollbackRootRender(transaction);
3557
- if (!reportUncaughtError(block, unhandled)) {
3558
- if (pendingError === null) pendingError = { err: unhandled, all: [unhandled] };
4318
+ const reported = unhandled instanceof PresentationAdoptionMiss && Object.prototype.hasOwnProperty.call(unhandled, "failure") ? unhandled.failure : unhandled;
4319
+ if (!reportUncaughtError(block, reported)) {
4320
+ if (pendingError === null) pendingError = { err: reported, all: [reported] };
3559
4321
  else {
3560
- pendingError.all.push(unhandled);
4322
+ pendingError.all.push(reported);
3561
4323
  pendingError.err = typeof AggregateError === "function" ? new AggregateError(pendingError.all, (0, import_error_codes_client_generated.formatClientError)(13)) : pendingError.all[0];
3562
4324
  }
3563
4325
  }
3564
4326
  let root = block;
3565
4327
  while (root.parentBlock !== null) root = root.parentBlock;
3566
- if (root.kind === "root" && !root.disposed) unmountBlock(root);
4328
+ if (root.kind === "root" && !root.disposed) {
4329
+ if (unhandled instanceof PresentationAdoptionMiss && root.idState.renderOwner !== void 0) {
4330
+ root.idState.renderOwner.preservePresentation = true;
4331
+ DOM_ROOT_DISPOSERS.get(root)?.();
4332
+ } else unmountBlock(root);
4333
+ }
3567
4334
  }
3568
4335
  } finally {
3569
4336
  endRootRender(rootFrame);
@@ -3576,6 +4343,7 @@ function drainQueue() {
3576
4343
  for (const activity of activitiesToRehide) SCHEDULED_VISIBILITY_DRIVER.rehide(activity);
3577
4344
  }
3578
4345
  commitRootRenders();
4346
+ flushNativeTransitions();
3579
4347
  return pendingError;
3580
4348
  }
3581
4349
  function flush() {
@@ -4331,6 +5099,7 @@ function vtFlush(work = flushWork, queuedOwners, queuedBlocks) {
4331
5099
  beginStagedCommitPublication(stagedCommit);
4332
5100
  try {
4333
5101
  try {
5102
+ rejectStagedPresentations(stagedCommit);
4334
5103
  stage.commit();
4335
5104
  } finally {
4336
5105
  publishStagedCommit(stagedCommit);
@@ -4832,6 +5601,23 @@ function beginStagedCommitPublication(capture) {
4832
5601
  function endStagedCommitPublication(capture) {
4833
5602
  if (PUBLISHING_STAGED_COMMIT === capture) PUBLISHING_STAGED_COMMIT = null;
4834
5603
  }
5604
+ function rejectStagedPresentations(capture) {
5605
+ for (const [owner, receipt] of capture.owners) {
5606
+ const transaction = receipt.presentation;
5607
+ if (transaction === void 0 || owner.disposed || owner.generation !== receipt.generation || currentPresentations(transaction.capture) && (NATIVE_READ_DRIVER === null || NATIVE_READ_DRIVER.validateCapture(transaction.capture)))
5608
+ continue;
5609
+ const pending = owner.transaction;
5610
+ owner.transaction = transaction;
5611
+ try {
5612
+ rollbackRootRender(transaction);
5613
+ } finally {
5614
+ owner.transaction = pending;
5615
+ }
5616
+ owner.generation++;
5617
+ retryPresentations(transaction.capture);
5618
+ if (transaction.rootRequest) owner.retry();
5619
+ }
5620
+ }
4835
5621
  function stagedOwnerGuard(capture, owner) {
4836
5622
  if (owner === void 0) return void 0;
4837
5623
  let receipt = capture.owners.get(owner);
@@ -4993,9 +5779,10 @@ function publishStagedCommit(capture) {
4993
5779
  capture.selects.length = capture.defaults.length = capture.checks.length = capture.autofocus.length = 0;
4994
5780
  capture.bundles.clear();
4995
5781
  capture.controls.clear();
5782
+ capture.signalHosts?.clear();
4996
5783
  commitEffects();
4997
5784
  }
4998
- function runStagedTeardown(cleanup, phase, handler, owner, suppressed) {
5785
+ function runStagedTeardown(cleanup, phase, handler, owner, suppressed, scope) {
4999
5786
  const previousHandler = TEARDOWN_HANDLER;
5000
5787
  const previousOwner = TEARDOWN_BLOCK;
5001
5788
  const previousErrors = TEARDOWN_ERRORS;
@@ -5007,8 +5794,8 @@ function runStagedTeardown(cleanup, phase, handler, owner, suppressed) {
5007
5794
  TEARDOWN_DEPTH++;
5008
5795
  try {
5009
5796
  try {
5010
- if (phase < 0) runEffectLifecycleCallback(cleanup);
5011
- else runEffectCleanupCallback(cleanup, phase);
5797
+ if (phase < 0) runEffectLifecycleCallback(cleanup, scope);
5798
+ else runEffectCleanupCallback(cleanup, phase, scope);
5012
5799
  } catch (error) {
5013
5800
  reportTeardownError(error);
5014
5801
  }
@@ -5083,7 +5870,7 @@ function ensureDeferredLayoutDriver() {
5083
5870
  enqueueStagedAction(capture, action, durable);
5084
5871
  return true;
5085
5872
  },
5086
- stageTeardown(cleanup, phase) {
5873
+ stageTeardown(cleanup, phase, scope) {
5087
5874
  const capture = STAGED_COMMIT_CAPTURE;
5088
5875
  if (capture === null) return false;
5089
5876
  const handler = TEARDOWN_HANDLER;
@@ -5091,7 +5878,7 @@ function ensureDeferredLayoutDriver() {
5091
5878
  const suppressed = REF_DETACH_SUPPRESSION;
5092
5879
  enqueueStagedAction(
5093
5880
  capture,
5094
- () => runStagedTeardown(cleanup, phase, handler, owner, suppressed),
5881
+ () => runStagedTeardown(cleanup, phase, handler, owner, suppressed, scope),
5095
5882
  true
5096
5883
  );
5097
5884
  return true;
@@ -5105,7 +5892,7 @@ function ensureDeferredLayoutDriver() {
5105
5892
  const handler = findTryHandler(scope.block);
5106
5893
  enqueueStagedAction(
5107
5894
  capture,
5108
- () => runStagedTeardown(cleanup, slot.phase, handler, scope.block, null),
5895
+ () => runStagedTeardown(cleanup, slot.phase, handler, scope.block, null, scope),
5109
5896
  true
5110
5897
  );
5111
5898
  }
@@ -5443,7 +6230,7 @@ function drainPassiveEffects() {
5443
6230
  drainPassivePhase();
5444
6231
  }
5445
6232
  function hasPendingWork() {
5446
- return QUEUE.length > 0 || ROOT_RENDER_TRANSACTIONS.length > 0 || effectEventQueue.length > 0 || effectEventCommitActions.length > 0 || effectQueues[INSERTION].length > 0 || effectQueues[LAYOUT].length > 0 || effectQueues[PASSIVE].length > 0 || pendingPassiveUnmounts.length > 0 || storeSyncQueue.length > 0 || NATIVE_ADOPTION_RELEASES !== null || hasControlledSyncs();
6233
+ return QUEUE.length > 0 || ROOT_RENDER_TRANSACTIONS.length > 0 || NATIVE_TRANSITION_QUEUE !== null || effectEventQueue.length > 0 || effectEventCommitActions.length > 0 || effectQueues[INSERTION].length > 0 || effectQueues[LAYOUT].length > 0 || effectQueues[PASSIVE].length > 0 || pendingPassiveUnmounts.length > 0 || storeSyncQueue.length > 0 || NATIVE_ADOPTION_RELEASES !== null || hasControlledSyncs();
5447
6234
  }
5448
6235
  function drainEffectEventUpdates() {
5449
6236
  if (effectEventQueue.length === 0) return;
@@ -5627,7 +6414,7 @@ function fireEffectCleanup(e) {
5627
6414
  if (cleanup) {
5628
6415
  slot.cleanup = void 0;
5629
6416
  try {
5630
- runEffectCleanupCallback(cleanup, e.phase);
6417
+ runEffectCleanupCallback(cleanup, e.phase, e.scope);
5631
6418
  } catch (err) {
5632
6419
  if (err instanceof MaximumUpdateDepthError) throw err;
5633
6420
  reportEffectError(e.scope.block, err);
@@ -5648,7 +6435,7 @@ function runEffectBody(e) {
5648
6435
  CURRENT_EFFECT_PHASE = e.phase;
5649
6436
  EFFECT_BODY_DEPTH++;
5650
6437
  try {
5651
- cleanup = e.fn.apply(null, e.args);
6438
+ cleanup = import_document_owner.signalDocumentEnabled || e.scope.block.idState.renderOwner?.signalOwner !== void 0 ? runWithBlockSignalOwner(e.scope, () => e.fn.apply(null, e.args)) : e.fn.apply(null, e.args);
5652
6439
  } finally {
5653
6440
  EFFECT_BODY_DEPTH--;
5654
6441
  CURRENT_EFFECT_PHASE = previousPhase;
@@ -5756,7 +6543,7 @@ function drainDeferredPassiveUnmounts() {
5756
6543
  const q = pendingPassiveUnmounts.splice(0);
5757
6544
  for (let i = 0; i < q.length; i += 3) {
5758
6545
  try {
5759
- runEffectCleanupCallback(q[i], PASSIVE);
6546
+ runEffectCleanupCallback(q[i], PASSIVE, q[i + 2]);
5760
6547
  } catch (err) {
5761
6548
  if (err instanceof MaximumUpdateDepthError) throw err;
5762
6549
  const handler = q[i + 1];
@@ -5949,6 +6736,14 @@ function captureRenderPhaseUpdate(cell, key) {
5949
6736
  if (!updates.has(cell)) updates.set(cell, { value: cell.value, queue: cell[key]?.slice(), key });
5950
6737
  }
5951
6738
  function renderBlock(block) {
6739
+ if (import_document_owner.signalDocumentEnabled || block.idState.renderOwner?.signalOwner !== void 0) {
6740
+ const owner = scopeSignalOwner(block);
6741
+ if (owner !== void 0) (0, import_document_owner.streamedSignalOwnerActivator)?.(owner);
6742
+ if (owner !== void 0 && (0, import_owner_context.currentSignalOwner)() !== owner) {
6743
+ (0, import_owner_context.runWithSignalOwner)(owner, () => renderBlock(block));
6744
+ return;
6745
+ }
6746
+ }
5952
6747
  const hydration = activeHydration();
5953
6748
  if (hydration !== null && !hydration.owns(block)) {
5954
6749
  hydration.suspend(() => renderBlock(block));
@@ -5967,6 +6762,8 @@ function renderBlock(block) {
5967
6762
  }
5968
6763
  if (++retries > RENDER_PHASE_UPDATE_LIMIT) throw new Error((0, import_error_codes_client_generated.formatClientError)(9));
5969
6764
  }
6765
+ if (import_document_owner.signalDocumentEnabled && block.__trySlot?.tryBlock === block && block.__trySlot.retrySignalOwners !== void 0)
6766
+ clearSignalRetryOwners(block.__trySlot);
5970
6767
  const updates = renderPhaseUpdates;
5971
6768
  if (updates !== null && previousOwner !== null && blockIsAncestorOf(previousOwner, block)) {
5972
6769
  previousUpdates ??= /* @__PURE__ */ new Map();
@@ -5983,6 +6780,8 @@ function renderBlock(block) {
5983
6780
  }
5984
6781
  if (!block.crossRenderUpdate) block.pending = false;
5985
6782
  }
6783
+ if (block.idState.renderOwner?.signalOwner !== void 0 && !block.mounted && block.forSlot !== null && block.forSlot.items.get(block.key) !== block)
6784
+ discardSignalRetryItem(block, error);
5986
6785
  throw error;
5987
6786
  } finally {
5988
6787
  renderPhaseOwner = previousOwner;
@@ -6260,7 +7059,8 @@ function renderReturnedValue(block, out) {
6260
7059
  d.key ?? void 0,
6261
7060
  true,
6262
7061
  void 0,
6263
- activeHydration() !== null && elementKeyWasProvided(d)
7062
+ activeHydration() !== null && elementKeyWasProvided(d),
7063
+ d.__octaneInvocationSite
6264
7064
  )
6265
7065
  );
6266
7066
  } else {
@@ -6274,7 +7074,8 @@ function renderReturnedValue(block, out) {
6274
7074
  d.key ?? void 0,
6275
7075
  true,
6276
7076
  void 0,
6277
- activeHydration() !== null && elementKeyWasProvided(d)
7077
+ activeHydration() !== null && elementKeyWasProvided(d),
7078
+ d.__octaneInvocationSite
6278
7079
  );
6279
7080
  }
6280
7081
  } else {
@@ -6381,7 +7182,7 @@ class LiteBlockImpl {
6381
7182
  this.idState = parentBlock.idState;
6382
7183
  }
6383
7184
  }
6384
- function componentSlotLite(parentScope, slotKey, host, comp, props, anchor) {
7185
+ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invocationSite) {
6385
7186
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
6386
7187
  if (parentScope === SHARED_BODY_SCOPE) {
6387
7188
  componentSlotImpl(
@@ -6395,7 +7196,10 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor) {
6395
7196
  props,
6396
7197
  anchor,
6397
7198
  void 0,
6398
- 2
7199
+ 2,
7200
+ void 0,
7201
+ void 0,
7202
+ invocationSite
6399
7203
  );
6400
7204
  return;
6401
7205
  }
@@ -6423,6 +7227,7 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor) {
6423
7227
  }
6424
7228
  }
6425
7229
  scope.block = new LiteBlockImpl(host, endMarker, parentScope.block);
7230
+ stampSignalInstance(scope, parentScope, invocationSite, void 0, false);
6426
7231
  if (adoptedOpen !== null && adoptedClose !== null) {
6427
7232
  hydration.liteRanges.set(scope, {
6428
7233
  start: adoptedOpen,
@@ -6443,7 +7248,9 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor) {
6443
7248
  let profileThrown;
6444
7249
  const nativeToken = NATIVE_READ_DRIVER === null ? -1 : beginActiveNativeReadScope(scope);
6445
7250
  try {
6446
- comp(props, scope, void 0);
7251
+ if (import_document_owner.signalDocumentEnabled || scope.block.idState.renderOwner?.signalOwner !== void 0)
7252
+ runWithBlockSignalOwner(scope, () => comp(props, scope, void 0));
7253
+ else comp(props, scope, void 0);
6447
7254
  if (!scope.mounted) scope.mounted = true;
6448
7255
  } catch (error) {
6449
7256
  profileDidThrow = true;
@@ -6562,10 +7369,10 @@ function unmountScope(scope, detachDom = true) {
6562
7369
  pendingPassiveUnmounts.push(cleanup, TEARDOWN_HANDLER, TEARDOWN_BLOCK);
6563
7370
  if (!passiveScheduled) schedulePassiveFlush();
6564
7371
  } else {
6565
- if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageTeardown(cleanup, slot.phase) === true)
7372
+ if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageTeardown(cleanup, slot.phase, scope) === true)
6566
7373
  continue;
6567
7374
  try {
6568
- runEffectCleanupCallback(cleanup, slot.phase);
7375
+ runEffectCleanupCallback(cleanup, slot.phase, scope);
6569
7376
  } catch (err) {
6570
7377
  reportTeardownError(err);
6571
7378
  }
@@ -6581,21 +7388,46 @@ function unmountScope(scope, detachDom = true) {
6581
7388
  unmountScopeChildrenAndSlots(scope, detachDom);
6582
7389
  });
6583
7390
  }
6584
- function runScopeCleanups(scope) {
7391
+ function runScopeCleanups(scope, retireUnowned) {
6585
7392
  const c = scope.cleanups;
6586
7393
  if (c !== null)
6587
7394
  for (let i = c.length - 1; i >= 0; i--) {
6588
- if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageTeardown(c[i], -1) === true)
7395
+ if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageTeardown(c[i], -1, scope) === true)
6589
7396
  continue;
6590
7397
  try {
6591
- runEffectLifecycleCallback(c[i]);
7398
+ runEffectLifecycleCallback(c[i], scope);
6592
7399
  } catch (err) {
6593
7400
  reportTeardownError(err);
6594
7401
  }
6595
7402
  }
7403
+ const signalOwner = SCOPE_SIGNAL_OWNERS.get(scope);
7404
+ if (signalOwner) {
7405
+ if (RETAINED_SIGNAL_OWNERS?.owners.has(signalOwner)) return;
7406
+ if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageAction(() => {
7407
+ if (retireUnowned) SCOPE_SIGNAL_OWNERS.set(scope, null);
7408
+ else SCOPE_SIGNAL_OWNERS.delete(scope);
7409
+ retireRendererSignalOwner(signalOwner);
7410
+ }, true))
7411
+ return;
7412
+ if (retireUnowned) SCOPE_SIGNAL_OWNERS.set(scope, null);
7413
+ else SCOPE_SIGNAL_OWNERS.delete(scope);
7414
+ retireRendererSignalOwner(signalOwner);
7415
+ } else if (retireUnowned && signalOwner === false) {
7416
+ if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageAction(() => retireUnownedSignalScope(scope), true))
7417
+ return;
7418
+ retireUnownedSignalScope(scope);
7419
+ }
7420
+ }
7421
+ function retireUnownedSignalScope(scope) {
7422
+ const owner = SCOPE_SIGNAL_OWNERS.get(scope);
7423
+ if (owner === false) SCOPE_SIGNAL_OWNERS.set(scope, null);
7424
+ else if (owner) {
7425
+ SCOPE_SIGNAL_OWNERS.set(scope, null);
7426
+ retireRendererSignalOwner(owner);
7427
+ }
6596
7428
  }
6597
- function unmountScopeChildrenAndSlots(scope, detachDom) {
6598
- runScopeCleanups(scope);
7429
+ function unmountScopeChildrenAndSlots(scope, detachDom, retireUnowned = true) {
7430
+ runScopeCleanups(scope, retireUnowned);
6599
7431
  unmountScopeChildrenAndSlotsOnly(scope, detachDom);
6600
7432
  }
6601
7433
  function unmountScopeChildrenAndSlotsOnly(scope, detachDom) {
@@ -7911,7 +8743,7 @@ function resetHmrBlock(block) {
7911
8743
  const cleanup = cleanups[i];
7912
8744
  if (cleanup[HMR] === true) continue;
7913
8745
  try {
7914
- runEffectLifecycleCallback(cleanup);
8746
+ runEffectLifecycleCallback(cleanup, block);
7915
8747
  } catch (err) {
7916
8748
  reportTeardownError(err);
7917
8749
  }
@@ -7946,7 +8778,7 @@ function resetHmrBlock(block) {
7946
8778
  if (--TEARDOWN_DEPTH === 0) dispatchTeardownErrors();
7947
8779
  }
7948
8780
  }
7949
- function resetScopeChildren(scope) {
8781
+ function resetScopeChildren(scope, detachDom = true) {
7950
8782
  const block = scope.block;
7951
8783
  if (TEARDOWN_DEPTH === 0) {
7952
8784
  TEARDOWN_HANDLER = findTryHandler(block.parentBlock) ?? rendererRegionTryHandler(block);
@@ -7954,12 +8786,13 @@ function resetScopeChildren(scope) {
7954
8786
  }
7955
8787
  TEARDOWN_DEPTH++;
7956
8788
  try {
7957
- unmountScopeChildrenAndSlots(scope, true);
8789
+ unmountScopeChildrenAndSlots(scope, detachDom, false);
7958
8790
  const start = block.startMarker;
7959
- removeRange(
7960
- start !== null ? getNextSibling(start) : getFirstChild(block.parentNode),
7961
- block.endMarker
7962
- );
8791
+ if (detachDom)
8792
+ removeRange(
8793
+ start !== null ? getNextSibling(start) : getFirstChild(block.parentNode),
8794
+ block.endMarker
8795
+ );
7963
8796
  scope.children = null;
7964
8797
  scope.cleanups = null;
7965
8798
  scope._slots = null;
@@ -7991,6 +8824,19 @@ const HYDRATE_STREAM_BOUNDARY_SELECTOR = `template[${import_constants.STREAM_BOU
7991
8824
  const HYDRATE_STREAM_SCAN_MASK = 1 | 128;
7992
8825
  let hydrateStreamWaitCleanups = null;
7993
8826
  let preservedHydrateActivations = null;
8827
+ let preservedHydrateActivationCount = 0;
8828
+ function releasePreservedHydrateActivation(state) {
8829
+ if (preservedHydrateActivations?.delete(state)) preservedHydrateActivationCount--;
8830
+ }
8831
+ function pendingHydrateOwner(target) {
8832
+ let owner = null;
8833
+ for (let block = target; block !== null; block = block.parentBlock) {
8834
+ const state = block.slots[0];
8835
+ if (state?.__kind === "hydrateBlockSlot" && !state.hydrated && preservedHydrateActivations?.has(state))
8836
+ owner = state;
8837
+ }
8838
+ return owner;
8839
+ }
7994
8840
  function findSuspendedHydrateBlock(scope, thenable) {
7995
8841
  const own = scope.block.__thenables;
7996
8842
  if (own !== void 0 && own.includes(thenable)) return scope.block;
@@ -8011,7 +8857,9 @@ function preserveSuspendedHydrateActivation(state, hydration, thenable) {
8011
8857
  source: suspendedBlock === state.block ? null : suspendedBlock,
8012
8858
  cursor: hydration.node
8013
8859
  };
8014
- (preservedHydrateActivations ??= /* @__PURE__ */ new WeakMap()).set(state, activation);
8860
+ const activations = preservedHydrateActivations ??= /* @__PURE__ */ new WeakMap();
8861
+ if (!activations.has(state)) preservedHydrateActivationCount++;
8862
+ activations.set(state, activation);
8015
8863
  const resume = () => {
8016
8864
  if (state.block.disposed || !state.activationRequested || state.activationGeneration !== activation.generation || preservedHydrateActivations?.get(state) !== activation)
8017
8865
  return;
@@ -8255,15 +9103,18 @@ function invalidateHydrateActivation(state) {
8255
9103
  state.replays = [];
8256
9104
  }
8257
9105
  function teardownHydrateBoundary(state) {
9106
+ const preserved = preservedHydrateActivations?.get(state);
9107
+ if (preserved !== void 0) {
9108
+ if (isRecordingTransitionJournal()) journalObjectOnce(state.block);
9109
+ state.block.mounted = false;
9110
+ }
8258
9111
  if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => teardownHydrateBoundary(state), true) === true)
8259
9112
  return;
8260
9113
  cleanupHydrateInstallers(state);
8261
9114
  cleanupHydrateStreamWait(state);
8262
- const preserved = preservedHydrateActivations?.get(state);
8263
9115
  if (preserved !== void 0) {
8264
- preservedHydrateActivations.delete(state);
9116
+ releasePreservedHydrateActivation(state);
8265
9117
  discardOffscreenCapture(preserved.capture);
8266
- state.block.mounted = false;
8267
9118
  }
8268
9119
  state.prefetchAbort?.abort();
8269
9120
  resolveHydrateWaiters(state, "abort");
@@ -8301,7 +9152,7 @@ function hydrateStrategyInteractionEvents(strategy) {
8301
9152
  }
8302
9153
  function queueHydrateIntent(state, intent) {
8303
9154
  if (state.hydrated || resolveHydrateStrategy(state)._t === "never") return;
8304
- state.replays.push(intent);
9155
+ if (!intent.earlyBinding) state.replays.push(intent);
8305
9156
  requestHydrateBoundary(state);
8306
9157
  }
8307
9158
  function handleRegisteredHydrationIntent(state, eventType, intent) {
@@ -8482,6 +9333,7 @@ function requestHydrateBoundary(state) {
8482
9333
  }
8483
9334
  function installHydrateBoundary(state) {
8484
9335
  if (!state.serverPreserved || state.hydrated) return () => void 0;
9336
+ if (state.independent) return () => teardownHydrateBoundary(state);
8485
9337
  const strategy = resolveHydrateStrategy(state);
8486
9338
  if (strategy._t === "never") {
8487
9339
  state.strategyCleanup = null;
@@ -8539,14 +9391,14 @@ function createHydrateSlot(props, scope, boundaryId) {
8539
9391
  import_constants.HYDRATE_WHEN_ATTR,
8540
9392
  hydrateStrategyType(props.when)
8541
9393
  );
8542
- let start;
8543
- let end;
9394
+ if (props.__independent !== void 0)
9395
+ (STAGED_DOM?.view(wrapper) ?? wrapper).setAttribute(import_constants.HYDRATE_INDEPENDENT_ATTR, "");
9396
+ let start = null;
9397
+ let end = null;
8544
9398
  let seedRaw = null;
8545
9399
  let nativeSeedRaw = null;
8546
9400
  let idState = parentBlock.idState;
8547
- if (serverPreserved && hydration.isOpen(getFirstChild(wrapper))) {
8548
- start = getFirstChild(wrapper);
8549
- end = hydration.close(start);
9401
+ if (serverPreserved) {
8550
9402
  const rawCount = (STAGED_DOM?.view(wrapper) ?? wrapper).getAttribute(import_constants.HYDRATE_ID_COUNT_ATTR);
8551
9403
  const parsedCount = rawCount === null ? 0 : Number(rawCount);
8552
9404
  const idCount = Number.isSafeInteger(parsedCount) && parsedCount >= 0 ? parsedCount : 0;
@@ -8556,11 +9408,17 @@ function createHydrateSlot(props, scope, boundaryId) {
8556
9408
  idState = {
8557
9409
  prefix: rootIds.prefix,
8558
9410
  next: childStart,
9411
+ signalState: rootIds.signalState,
8559
9412
  limit: childStart + idCount,
8560
9413
  overflow: rootIds,
8561
9414
  renderOwner: rootIds.renderOwner
8562
9415
  };
8563
9416
  (STAGED_DOM?.view(wrapper) ?? wrapper).removeAttribute(import_constants.HYDRATE_ID_COUNT_ATTR);
9417
+ }
9418
+ if (props.__independent !== void 0) {
9419
+ } else if (serverPreserved && hydration.isOpen(getFirstChild(wrapper))) {
9420
+ start = getFirstChild(wrapper);
9421
+ end = hydration.close(start);
8564
9422
  const seed = findHydrateSeedSidecar(wrapper);
8565
9423
  if (seed !== null) {
8566
9424
  seedRaw = (STAGED_DOM?.view(seed) ?? seed).textContent || "[]";
@@ -8627,17 +9485,19 @@ function createHydrateSlot(props, scope, boundaryId) {
8627
9485
  didNotify: false,
8628
9486
  hasError: false,
8629
9487
  error: void 0,
8630
- replays: []
9488
+ replays: [],
9489
+ independent: props.__independent !== void 0
8631
9490
  };
8632
9491
  if (nativeSeedRaw !== null) state.nativeSeedRaw = nativeSeedRaw;
8633
9492
  scope.slots[0] = state;
8634
9493
  registerSlot(scope, state);
8635
- (0, import_event_capture.registerHydrationIntentBoundary)(wrapper, intentBoundary);
9494
+ if (!state.independent) (0, import_event_capture.registerHydrationIntentBoundary)(wrapper, intentBoundary);
8636
9495
  block.body = hydrateBoundaryBody(state);
8637
9496
  const initialStrategy = resolveHydrateStrategy(state);
8638
- const pendingIntents = (0, import_event_capture.takePendingHydrationIntents)(wrapper);
8639
- if (serverPreserved && pendingIntents !== void 0 && initialStrategy._t !== "never") {
8640
- state.replays.push(...pendingIntents);
9497
+ const pendingIntents = state.independent ? void 0 : (0, import_event_capture.takePendingHydrationIntents)(wrapper);
9498
+ if (state.independent) {
9499
+ } else if (serverPreserved && pendingIntents !== void 0 && initialStrategy._t !== "never") {
9500
+ state.replays.push(...pendingIntents.filter((intent) => !intent.earlyBinding));
8641
9501
  requestHydrateBoundary(state);
8642
9502
  } else if (serverPreserved) {
8643
9503
  const shouldDefer = initialStrategy._d ? initialStrategy._d() : initialStrategy._t !== "load";
@@ -8646,9 +9506,14 @@ function createHydrateSlot(props, scope, boundaryId) {
8646
9506
  return state;
8647
9507
  }
8648
9508
  function activateHydrateBoundary(state) {
9509
+ if (state.start === null || state.end === null) return;
8649
9510
  const block = state.block;
9511
+ let preserved = preservedHydrateActivations?.get(state);
9512
+ if (preserved !== void 0 && !currentPresentations(preserved.capture)) {
9513
+ discardHydratePresentation(state, preserved.capture);
9514
+ preserved = void 0;
9515
+ }
8650
9516
  const activationSlot = block.slots[0];
8651
- const preserved = preservedHydrateActivations?.get(state);
8652
9517
  if (!state.serverPreserved || activationSlot?.__kind === "trySlotSlot" && preserved === void 0) {
8653
9518
  renderBlock(block);
8654
9519
  return;
@@ -8661,6 +9526,13 @@ function activateHydrateBoundary(state) {
8661
9526
  const previousHydration = currentHydration;
8662
9527
  const previousCapture = WIP_CAPTURE;
8663
9528
  const capture = preserved?.capture ?? createOffscreenCapture();
9529
+ if (block.idState.renderOwner?.bindingLeases?.size) {
9530
+ hydration.retryPresentation = () => {
9531
+ if (block.disposed) return;
9532
+ discardHydratePresentation(state, capture);
9533
+ scheduleRender(state.parentBlock);
9534
+ };
9535
+ }
8664
9536
  currentHydration = hydration;
8665
9537
  WIP_CAPTURE = capture;
8666
9538
  const previousNative = (0, import_read_protocol.setNativeAdoptionResolver)(hydration.nativeAdoption?.resolve ?? null);
@@ -8700,10 +9572,19 @@ function activateHydrateBoundary(state) {
8700
9572
  completed = true;
8701
9573
  }
8702
9574
  } catch (error) {
8703
- preservedHydrateActivations?.delete(state);
9575
+ releasePreservedHydrateActivation(state);
8704
9576
  discardOffscreenCapture(capture);
8705
9577
  state.block.mounted = false;
8706
- if (error instanceof import_read_protocol.NativeAdoptionMiss) nativeRecovery = error;
9578
+ if (error instanceof PresentationAdoptionMiss) {
9579
+ discardHydratePresentation(state, capture);
9580
+ if (error.retry && error.lease?.active()) {
9581
+ retryPresentationMiss(error, () => {
9582
+ if (!block.disposed) scheduleRender(state.parentBlock);
9583
+ });
9584
+ return;
9585
+ }
9586
+ throw error;
9587
+ } else if (error instanceof import_read_protocol.NativeAdoptionMiss) nativeRecovery = error;
8707
9588
  else throw error;
8708
9589
  } finally {
8709
9590
  (0, import_read_protocol.setNativeAdoptionResolver)(previousNative);
@@ -8743,10 +9624,30 @@ function activateHydrateBoundary(state) {
8743
9624
  return;
8744
9625
  }
8745
9626
  if (completed) {
8746
- preservedHydrateActivations?.delete(state);
9627
+ releasePreservedHydrateActivation(state);
8747
9628
  spliceOffscreenCapture(capture);
8748
9629
  }
8749
- if (completed && hydration.hasAdjacentRangePair) hydration.coalesce();
9630
+ if (completed && hydration.hasAdjacentRangePair && !hydration.presentation) hydration.coalesce();
9631
+ }
9632
+ function discardHydratePresentation(state, capture) {
9633
+ const refs = [];
9634
+ collectVisibleSubtreeRefs(state.block, refs);
9635
+ discardOffscreenCapture(capture);
9636
+ releasePreservedHydrateActivation(state);
9637
+ for (const frame of capture.presentations ?? [])
9638
+ if (PRESENTATION_PREPARATIONS.get(frame.lease) === frame)
9639
+ PRESENTATION_PREPARATIONS.delete(frame.lease);
9640
+ const previousRollback = ROOT_RENDER_ROLLBACK;
9641
+ ROOT_RENDER_ROLLBACK = true;
9642
+ try {
9643
+ withRefDetachSuppression(refs, () => resetScopeChildren(state.block, false));
9644
+ } finally {
9645
+ ROOT_RENDER_ROLLBACK = previousRollback;
9646
+ }
9647
+ state.block.mounted = false;
9648
+ state.block.deoptNode = null;
9649
+ state.hydrated = false;
9650
+ state.serverActivationStarted = false;
8750
9651
  }
8751
9652
  function cloneHydrationReplayEvent(event, target) {
8752
9653
  const realm = target.ownerDocument.defaultView ?? globalThis;
@@ -8858,8 +9759,11 @@ function initializeHydrateComponent() {
8858
9759
  if (state === void 0) {
8859
9760
  state = createHydrateSlot(props, scope, boundaryId);
8860
9761
  } else {
9762
+ if (state.independent !== (props.__independent !== void 0)) {
9763
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(66));
9764
+ }
8861
9765
  state.props = props;
8862
- if (!state.hydrated) {
9766
+ if (!state.independent && !state.hydrated) {
8863
9767
  const strategy = resolveHydrateStrategy(state);
8864
9768
  if (strategy._t === "never") {
8865
9769
  cleanupHydrateStrategy(state);
@@ -8869,6 +9773,10 @@ function initializeHydrateComponent() {
8869
9773
  }
8870
9774
  }
8871
9775
  }
9776
+ if (state.independent) {
9777
+ useEffect(() => installHydrateBoundary(state), [state], HYDRATE_SETUP_SLOT);
9778
+ return;
9779
+ }
8872
9780
  if (state.hasError) throw state.error;
8873
9781
  if (!state.hydrated && state.activationReady && (!state.serverPreserved || !state.serverActivationStarted)) {
8874
9782
  if (state.serverPreserved) state.serverActivationStarted = true;
@@ -10346,6 +11254,8 @@ class HydrationCapability {
10346
11254
  /** Skip component-frame adoption until the declared container owner. */
10347
11255
  passthroughRanges = false;
10348
11256
  nativeAdoption;
11257
+ retryPresentation;
11258
+ presentation;
10349
11259
  isActive() {
10350
11260
  return this.depth === 0 && !this.abandoned;
10351
11261
  }
@@ -10556,6 +11466,7 @@ class HydrationCapability {
10556
11466
  }
10557
11467
  /** Give up root adoption after an unframed return/fragment mismatch. */
10558
11468
  abandonRoot(expected, actual, loc) {
11469
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
10559
11470
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(52)));
10560
11471
  if (loc) warnHydrationStructuralMismatch(loc, expected, actual);
10561
11472
  let node = this.node;
@@ -10602,11 +11513,13 @@ class HydrationCapability {
10602
11513
  this.claimRootRemainder(framedRemainder === void 0 ? remainder : framedRemainder);
10603
11514
  }
10604
11515
  if (cursor === null) {
11516
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
10605
11517
  if (claimsRoot) this.claimRootRemainder(null);
10606
11518
  if (template2 === null) template2 = resolveLazyTemplate(lazy2);
10607
11519
  return this.freshClone(template2);
10608
11520
  }
10609
11521
  if (!isFragment && (template2 !== null ? !hydrationNodeMatches(cursor, template2, partialStyles) : !lazyRootMatches(cursor, lazy2))) {
11522
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
10610
11523
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(51)));
10611
11524
  if (template2 === null) template2 = resolveLazyTemplate(lazy2);
10612
11525
  if (process.env.NODE_ENV !== "production" && loc)
@@ -10816,6 +11729,10 @@ class HydrationCapability {
10816
11729
  return true;
10817
11730
  }
10818
11731
  coalesce() {
11732
+ const leases = this.rootBlock.idState.renderOwner?.bindingLeases;
11733
+ if (leases !== void 0) {
11734
+ for (const lease of leases) if (lease.revision !== void 0 && lease.active()) return;
11735
+ }
10819
11736
  coalesceHydratedRanges(this.rootBlock, this.liteRanges);
10820
11737
  }
10821
11738
  }
@@ -10929,6 +11846,7 @@ function clone(node, loc, partialStyles) {
10929
11846
  }
10930
11847
  function drainFrag(root, parent, anchor) {
10931
11848
  if (activeHydration() !== null && root.__oct_vfrag === true) return;
11849
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss(false);
10932
11850
  if (root.nodeType === 11) {
10933
11851
  (STAGED_DOM?.view(parent) ?? parent).insertBefore(root, anchor);
10934
11852
  return;
@@ -11039,10 +11957,423 @@ function htextSwap(posNode, value) {
11039
11957
  (STAGED_DOM?.view(parent) ?? parent).replaceChild(t, posNode);
11040
11958
  return t;
11041
11959
  }
11960
+ function bindingText(posNode, value, marker) {
11961
+ const text = coerceText(value);
11962
+ const hydration = activeHydration();
11963
+ const frame = PRESENTATION_HYDRATION;
11964
+ if (frame?.revision !== void 0) {
11965
+ const range = presentationRange(frame, posNode, marker, "text");
11966
+ const existing = getNextSibling(posNode);
11967
+ if (existing === range.end) {
11968
+ const node2 = document.createTextNode(text);
11969
+ preparePresentationOperation(
11970
+ frame,
11971
+ posNode,
11972
+ "text",
11973
+ () => range.end.parentNode.insertBefore(node2, range.end)
11974
+ );
11975
+ return node2;
11976
+ }
11977
+ if (existing?.nodeType !== 3 || getNextSibling(existing) !== range.end) presentationMiss();
11978
+ preparePresentationOperation(frame, existing, "text", () => {
11979
+ if (existing.nodeValue !== text) existing.nodeValue = text;
11980
+ });
11981
+ return existing;
11982
+ }
11983
+ if (hydration !== null && isBlockOpen(posNode)) {
11984
+ const close2 = hydration.close(posNode);
11985
+ const existing = getNextSibling(posNode);
11986
+ if (existing !== close2 && existing?.nodeType === 3 && getNextSibling(existing) === close2) {
11987
+ if ((STAGED_DOM?.view(existing) ?? existing).nodeValue !== text)
11988
+ (STAGED_DOM?.view(existing) ?? existing).nodeValue = text;
11989
+ return existing;
11990
+ }
11991
+ if (existing !== close2) throw new TypeError((0, import_error_codes_client_generated.formatClientError)(72));
11992
+ const node2 = (STAGED_DOM?.view(document) ?? document).createTextNode(text);
11993
+ domNode((STAGED_DOM?.view(close2) ?? close2).parentNode).insertBefore(node2, close2);
11994
+ return node2;
11995
+ }
11996
+ const parent = domNode(posNode).parentNode;
11997
+ const close = (STAGED_DOM?.view(document) ?? document).createComment(import_constants.HYDRATION_END);
11998
+ (STAGED_DOM?.view(posNode) ?? posNode).data = marker;
11999
+ (STAGED_DOM?.view(parent) ?? parent).insertBefore(close, getNextSibling(posNode));
12000
+ const node = (STAGED_DOM?.view(document) ?? document).createTextNode(text);
12001
+ (STAGED_DOM?.view(parent) ?? parent).insertBefore(node, close);
12002
+ return node;
12003
+ }
12004
+ const BINDING_VIEW_ROOT = /* @__PURE__ */ Symbol.for("octane.binding.view-root");
12005
+ let PRESENTATION_HYDRATION = null;
12006
+ const PRESENTATION_PREPARATIONS = /* @__PURE__ */ new WeakMap();
12007
+ class PresentationAdoptionMiss extends Error {
12008
+ constructor(lease, retry, revision = PRESENTATION_HYDRATION?.revision) {
12009
+ super((0, import_error_codes_client_generated.formatClientError)(75));
12010
+ this.lease = lease;
12011
+ this.retry = retry;
12012
+ this.revision = revision;
12013
+ }
12014
+ lease;
12015
+ retry;
12016
+ revision;
12017
+ }
12018
+ function retryPresentationMiss(error, retry) {
12019
+ const revision = error.lease?.revision?.();
12020
+ if (revision !== void 0 && revision >= 0 && revision !== error.revision) queueMicrotask(retry);
12021
+ else error.lease?.afterPublication?.(retry);
12022
+ }
12023
+ function isAdoptionControl(error) {
12024
+ return error instanceof import_read_protocol.NativeAdoptionMiss || error instanceof PresentationAdoptionMiss;
12025
+ }
12026
+ function presentationFailure(error) {
12027
+ const frame = PRESENTATION_HYDRATION;
12028
+ if (frame?.revision !== void 0 && !isSuspenseException(error) && !isAdoptionControl(error)) {
12029
+ const failure = new PresentationAdoptionMiss(frame.lease, false);
12030
+ failure.failure = error;
12031
+ throw failure;
12032
+ }
12033
+ throw error;
12034
+ }
12035
+ function presentationMiss(retry = true) {
12036
+ throw new PresentationAdoptionMiss(PRESENTATION_HYDRATION?.lease, retry);
12037
+ }
12038
+ function currentPresentation(frame) {
12039
+ if (frame.revision === void 0) return true;
12040
+ const lease = frame.lease;
12041
+ return lease.active() && lease.valid?.() !== false && lease.revision?.() === frame.revision && lease.root.parentNode !== null && lease.end?.parentNode === lease.root.parentNode && [...frame.witnesses.values()].every(
12042
+ (witness) => witness === null || (0, import_native_read_collector.validateNativeReadWitness)(witness)
12043
+ );
12044
+ }
12045
+ function currentPresentations(capture) {
12046
+ return capture.presentations?.every((frame) => frame.current(frame)) !== false;
12047
+ }
12048
+ function retryPresentations(capture) {
12049
+ const retries = /* @__PURE__ */ new Set();
12050
+ for (const frame of capture.presentations ?? []) {
12051
+ PRESENTATION_PREPARATIONS.delete(frame.lease);
12052
+ if (frame.hydration?.retryPresentation) retries.add(frame.hydration.retryPresentation);
12053
+ }
12054
+ for (const retry of retries) retry();
12055
+ }
12056
+ function preparePresentationOperation(frame, target, key, write) {
12057
+ let operations = frame.writes.get(target);
12058
+ if (operations === void 0) frame.writes.set(target, operations = /* @__PURE__ */ new Map());
12059
+ operations.set(key, write);
12060
+ }
12061
+ function matchesClosedPresentationKeys(value, keys) {
12062
+ if (value === null || typeof value !== "object" && typeof value !== "function") return false;
12063
+ let index = 0;
12064
+ for (const key of Reflect.ownKeys(value)) {
12065
+ if (typeof key !== "string") return false;
12066
+ if (!Object.prototype.propertyIsEnumerable.call(value, key)) continue;
12067
+ if (keys[index++] !== key) return false;
12068
+ }
12069
+ return index === keys.length;
12070
+ }
12071
+ function hasClosedPresentationView(lease, scope, id) {
12072
+ try {
12073
+ const root = scope.block.startMarker ?? activeHydration()?.node;
12074
+ const proof = root == null ? void 0 : lease.view?.(root);
12075
+ return proof?.id === id && matchesClosedPresentationKeys(scope.block.props, proof.closedProps);
12076
+ } catch {
12077
+ return false;
12078
+ }
12079
+ }
12080
+ function beginPresentationHydration(scope, id, supported = false, structural = false, conditionalRest = false) {
12081
+ const owner = scope.block.idState.renderOwner;
12082
+ if (PRESENTATION_HYDRATION !== null && PRESENTATION_HYDRATION.scope.block.idState.renderOwner === owner) {
12083
+ if (conditionalRest) {
12084
+ if (!supported || !structural || !hasClosedPresentationView(PRESENTATION_HYDRATION.lease, scope, id))
12085
+ presentationMiss(false);
12086
+ } else if (!supported) presentationMiss(false);
12087
+ return null;
12088
+ }
12089
+ if (owner?.bindingLeases === void 0 || WIP_CAPTURE === null) return null;
12090
+ const hydration = activeHydration();
12091
+ const lease = [...owner.bindingLeases].find(
12092
+ (candidate) => candidate.id === id && (candidate.root === scope.block.startMarker || candidate.root === hydration?.node || candidate.root.nodeType === 8 && candidate.root.nextSibling === hydration?.node)
12093
+ );
12094
+ if (lease === void 0) return null;
12095
+ if (conditionalRest ? !supported || !structural || !hasClosedPresentationView(lease, scope, id) : !supported)
12096
+ throw new PresentationAdoptionMiss(lease, false);
12097
+ const revision = lease.revision?.();
12098
+ if (revision !== void 0 && revision >= 0 && lease.valid?.() === false)
12099
+ throw new PresentationAdoptionMiss(lease, false);
12100
+ if (revision !== void 0 && (!structural || revision < 0))
12101
+ throw new PresentationAdoptionMiss(lease, revision < 0, revision);
12102
+ const pending = PRESENTATION_PREPARATIONS.get(lease);
12103
+ const frame = {
12104
+ previous: PRESENTATION_HYDRATION,
12105
+ scope,
12106
+ // A suspended component's cache can skip an unchanged writer on retry.
12107
+ // Carry that same scope's prepared operations, replacing by native channel.
12108
+ writes: pending?.scope === scope ? new Map([...pending.writes].map(([node, writes]) => [node, new Map(writes)])) : /* @__PURE__ */ new Map(),
12109
+ native: (0, import_read_protocol.setNativeAdoptionResolver)(null),
12110
+ readToken: beginNativeReadScope(scope),
12111
+ witnessToken: beginNativeReadWitness(),
12112
+ witnesses: pending?.scope === scope ? new Map(pending.witnesses) : /* @__PURE__ */ new Map(),
12113
+ completed: false,
12114
+ lease,
12115
+ ...revision === void 0 ? {} : { revision, current: currentPresentation },
12116
+ hydration
12117
+ };
12118
+ PRESENTATION_HYDRATION = frame;
12119
+ if (revision !== void 0 && hydration !== null) {
12120
+ hydration.presentation = true;
12121
+ for (let block = scope.block; block !== null; block = block.parentBlock) {
12122
+ preserveRootCreatedDom(block);
12123
+ if (block === hydration.rootBlock) break;
12124
+ }
12125
+ }
12126
+ PRESENTATION_PREPARATIONS.set(lease, frame);
12127
+ if (revision !== void 0) (WIP_CAPTURE.presentations ??= []).push(frame);
12128
+ (WIP_CAPTURE.renderCleanups ??= []).push((discarded) => {
12129
+ if (discarded || !frame.completed || owner.disposed || scope.block.disposed || PRESENTATION_PREPARATIONS.get(lease) !== frame)
12130
+ return;
12131
+ if (!currentPresentation(frame)) {
12132
+ frame.hydration?.retryPresentation?.();
12133
+ return;
12134
+ }
12135
+ PRESENTATION_PREPARATIONS.delete(lease);
12136
+ owner.bindingLeases.delete(lease);
12137
+ (0, import_dom_binding_handoff.releaseBindingHandoff)(lease);
12138
+ let published = false;
12139
+ try {
12140
+ lease.retire(() => {
12141
+ for (const writes of frame.writes.values()) for (const write of writes.values()) write();
12142
+ published = true;
12143
+ });
12144
+ } catch (error) {
12145
+ if (!published) throw error;
12146
+ reportRendererOwnerError(scope, error);
12147
+ } finally {
12148
+ frame.writes.clear();
12149
+ if (published && !owner.disposed && owner.current !== null && [...frame.witnesses.values()].some(
12150
+ (witness) => witness !== null && !(0, import_native_read_collector.validateNativeReadWitness)(witness)
12151
+ )) {
12152
+ owner.generation++;
12153
+ invalidateRender(scope.block);
12154
+ scheduleRender(owner.current);
12155
+ }
12156
+ frame.witnesses.clear();
12157
+ }
12158
+ });
12159
+ return frame;
12160
+ }
12161
+ function endPresentationHydration(frame, completed = true) {
12162
+ if (frame === null) return;
12163
+ frame.completed = completed;
12164
+ frame.witnesses.set(frame.scope, finishNativeReadWitness(frame.witnessToken, completed));
12165
+ endNativeReadScope(frame.readToken, completed);
12166
+ (0, import_read_protocol.setNativeAdoptionResolver)(frame.native);
12167
+ PRESENTATION_HYDRATION = frame.previous;
12168
+ }
12169
+ function preparedPresentationAttribute(el, name, value, kind) {
12170
+ if (kind === "class") return value == null || value === false ? null : (0, import_css.normalizeClass)(value);
12171
+ if (kind === "booleanAttr")
12172
+ return !!value && typeof value !== "function" && typeof value !== "symbol";
12173
+ const result = coerceAttrValue(el, name, value);
12174
+ return result === "" && import_constants.BOOLEAN_ATTR_PROPS.has(name.toLowerCase()) ? true : result;
12175
+ }
12176
+ function preparePresentationSignalAttribute(args, frame) {
12177
+ const [scope, previous, element, name, value, site, attributeKind = "attr"] = args;
12178
+ return runWithBlockSignalOwner(scope, () => {
12179
+ const handle = isSignalHandle(value) ? value : null;
12180
+ const current = handle === null ? value : handle.get();
12181
+ const prepared = preparedPresentationAttribute(element, name, current, attributeKind);
12182
+ if (handle === null) {
12183
+ preparePresentationOperation(
12184
+ frame,
12185
+ element,
12186
+ name,
12187
+ () => writeDirectSignalScalar(element, prepared, "attribute", previous, name, attributeKind)
12188
+ );
12189
+ return value;
12190
+ }
12191
+ const prior = previous;
12192
+ const reusable = prior?.[DIRECT_SIGNAL_BINDING] === true && !prior.disposed && prior.unsubscribe === void 0 && prior.handle === handle && prior.target === element && prior.site === site && prior.name === name && prior.attributeKind === attributeKind;
12193
+ const binding = reusable ? prior : {
12194
+ [DIRECT_SIGNAL_BINDING]: true,
12195
+ scope,
12196
+ target: element,
12197
+ kind: "attribute",
12198
+ site,
12199
+ name,
12200
+ attributeKind,
12201
+ handle,
12202
+ value: current,
12203
+ disposed: false
12204
+ };
12205
+ if (!reusable) registerHookCleanup(scope, () => disposeDirectSignalBinding(binding));
12206
+ preparePresentationOperation(frame, element, name, () => {
12207
+ if (binding.disposed) return;
12208
+ writeDirectSignalScalar(element, prepared, "attribute", previous, name, attributeKind);
12209
+ binding.value = current;
12210
+ runWithBlockSignalOwner(scope, () => activateDirectSignalBinding(binding, void 0));
12211
+ });
12212
+ return binding;
12213
+ });
12214
+ }
12215
+ function presentationHostWrite(writer, ...args) {
12216
+ const frame = PRESENTATION_HYDRATION;
12217
+ if (frame === null) return writer(...args);
12218
+ const [scope, previous, element, sources, site, hasNestedChildren, readStyle, proofs] = args;
12219
+ if (frame.revision === void 0 || !Array.isArray(proofs) || proofs.length === 0)
12220
+ presentationMiss(false);
12221
+ const proven = /* @__PURE__ */ new Set();
12222
+ for (const proof of proofs) {
12223
+ const receipt = frame.lease.rest?.(element, proof.site);
12224
+ const row = sources[proof.source];
12225
+ if (receipt === void 0 || receipt.id !== proof.id || receipt.node !== proof.node || receipt.spread !== proof.spread || row?.[0] !== true || proven.has(proof.source) || !matchesClosedPresentationKeys(row[1], receipt.keys))
12226
+ presentationMiss(false);
12227
+ proven.add(proof.source);
12228
+ }
12229
+ for (let index = 0; index < sources.length; index++)
12230
+ if (sources[index][0] && !proven.has(index)) presentationMiss(false);
12231
+ const prepared = prepareSignalHostPropSources(
12232
+ scope,
12233
+ previous,
12234
+ element,
12235
+ sources,
12236
+ site,
12237
+ hasNestedChildren,
12238
+ readStyle
12239
+ );
12240
+ preparePresentationOperation(frame, element, "hostProps", prepared.publish);
12241
+ return prepared.binding;
12242
+ }
12243
+ function presentationWrite(writer, kind, ...args) {
12244
+ const frame = PRESENTATION_HYDRATION;
12245
+ if (frame === null) return writer(...args);
12246
+ if (kind === "markDangerouslySetInnerHTMLChildren") {
12247
+ const element2 = args[0];
12248
+ if (!frame.writes.get(element2)?.has("hostProps") || element2[DANGER_HTML_ACTIVE] === true)
12249
+ presentationMiss(false);
12250
+ preparePresentationOperation(frame, element2, "hostChildren", () => writer(element2));
12251
+ return void 0;
12252
+ }
12253
+ if (kind === "bindSignalText") {
12254
+ const value = args[3];
12255
+ if (value !== null && (typeof value === "object" || typeof value === "function") || typeof args[7] !== "string")
12256
+ presentationMiss(false);
12257
+ return bindingText(args[2], value, args[7]);
12258
+ }
12259
+ if (kind === "setText") {
12260
+ const text = coerceText(args[1]);
12261
+ preparePresentationOperation(frame, args[0], "text", () => writer(args[0], text));
12262
+ return void 0;
12263
+ }
12264
+ if (kind === "bindSignalAttribute") return preparePresentationSignalAttribute(args, frame);
12265
+ if (kind === "nativeStyleBinding" || kind === "nativeProjectionBinding") {
12266
+ const [owner, slot, el] = args;
12267
+ const style = kind === "nativeStyleBinding";
12268
+ nativePresentationBinding(
12269
+ owner,
12270
+ slot,
12271
+ el,
12272
+ style ? preparedNativeStyleBody : preparedNativeProjectionBody,
12273
+ style ? { el, value: args[3], frame } : { el, compute: args[3], fields: args[4], frame }
12274
+ );
12275
+ return void 0;
12276
+ }
12277
+ const prepared = args.slice();
12278
+ let result;
12279
+ if (kind === "setEventHandler") {
12280
+ preparePresentationOperation(frame, prepared[0], "event:" + prepared[1], () => {
12281
+ writer(...prepared);
12282
+ if (SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled)
12283
+ (SIGNAL_EVENT_OWNERS ??= /* @__PURE__ */ new WeakMap()).set(prepared[0], frame.scope);
12284
+ });
12285
+ return void 0;
12286
+ }
12287
+ if (kind === "setStyle") {
12288
+ prepared[1] = (0, import_dom_binding_styles.__normalizeBindingStyle)(args[1]);
12289
+ prepared[2] = "";
12290
+ } else if (kind === "setStyleProperty") {
12291
+ prepared[2] = args[2] == null || typeof args[2] === "boolean" ? null : (0, import_constants.cssStyleValue)(args[1], args[2]);
12292
+ } else if (kind === "setStyleProperties") {
12293
+ prepared[1] = args[1].map(
12294
+ (value, i) => i % 2 === 0 || value == null || typeof value === "boolean" ? value : (0, import_constants.cssStyleValue)(args[1][i - 1], value)
12295
+ );
12296
+ } else if (kind === "setBindingClass" || kind === "setBindingClassIfChanged") {
12297
+ const index = kind.endsWith("IfChanged") ? 0 : 2;
12298
+ const value = args[index];
12299
+ prepared[index] = [(0, import_css.normalizeClass)(value[0]), value[1].map(import_css.normalizeClass)];
12300
+ result = value;
12301
+ } else {
12302
+ const changed2 = kind.endsWith("IfChanged") || kind.startsWith("updateFresh");
12303
+ const valueIndex = changed2 ? 0 : kind === "setClassName" || kind === "setClassAttr" ? 1 : 2;
12304
+ const element2 = args[changed2 ? 2 : 0];
12305
+ const className = kind.includes("Class");
12306
+ const name = className ? "class" : args[changed2 ? 3 : 1];
12307
+ const attributeKind = className ? "class" : kind.includes("Boolean") ? "booleanAttr" : "attr";
12308
+ prepared[valueIndex] = preparedPresentationAttribute(
12309
+ element2,
12310
+ name,
12311
+ args[valueIndex],
12312
+ attributeKind
12313
+ );
12314
+ result = kind.startsWith("updateFresh") ? prepared[valueIndex] : args[valueIndex];
12315
+ }
12316
+ const changed = kind.endsWith("IfChanged") || kind.startsWith("updateFresh");
12317
+ const element = args[changed ? 2 : 0];
12318
+ const key = kind.includes("Class") ? "class" : kind.startsWith("setStyle") ? kind === "setStyleProperty" ? "style:" + args[1] : "style" : args[changed ? 3 : 1];
12319
+ preparePresentationOperation(frame, element, key, () => {
12320
+ writer(...prepared);
12321
+ });
12322
+ return result;
12323
+ }
12324
+ function bindPresentationView(view, id) {
12325
+ view[BINDING_VIEW_ROOT] = "[b;" + id + ";root";
12326
+ return (0, import_component_flags.markComponentFlags)(view, import_component_flags.COMPONENT_FLAG_BOUNDARY, view.name);
12327
+ }
12328
+ const BINDING_CHILDREN_SITE = /* @__PURE__ */ Symbol.for("octane.binding.children-site");
12329
+ function markBindingChildren(body, site) {
12330
+ body[BINDING_CHILDREN_SITE] = site;
12331
+ return body;
12332
+ }
12333
+ function presentationRange(frame, start, marker, kind) {
12334
+ const range = start === null ? void 0 : frame.lease.ranges?.().get(start);
12335
+ if (frame.lease.revision?.() !== frame.revision || start?.nodeType !== 8 || start.data !== marker || range?.kind !== kind || range.end.parentNode !== start.parentNode || activeHydration()?.close(start) !== range.end)
12336
+ presentationMiss();
12337
+ return range;
12338
+ }
12339
+ function presentationStructure(writer, kind, marker, ...args) {
12340
+ const frame = PRESENTATION_HYDRATION;
12341
+ if (frame?.revision === void 0) return writer(...args);
12342
+ const hydration = activeHydration();
12343
+ if (hydration === null) presentationMiss(false);
12344
+ const anchorIndex = kind === "if" ? 6 : 5;
12345
+ const start = hydration.resolveOpen(args[anchorIndex] ?? null, args[2]);
12346
+ if (kind === "if") {
12347
+ const arm = args[3] ? args[4] === null ? -1 : 0 : args[5] === null ? -1 : 1;
12348
+ const range2 = presentationRange(frame, start, marker + arm, kind);
12349
+ if (range2.arm !== arm) presentationMiss();
12350
+ writer(...args);
12351
+ return;
12352
+ }
12353
+ const range = presentationRange(frame, start, marker, kind);
12354
+ const expected = args[3][BINDING_VIEW_ROOT];
12355
+ if (expected !== "[b;" + range.view + ";root") presentationMiss(false);
12356
+ writer(...args);
12357
+ }
12358
+ function setBindingClass(element, receipt, values) {
12359
+ const snapshot = [(0, import_css.normalizeClass)(values[0]), values[1].map(import_css.normalizeClass)];
12360
+ const classes = [snapshot[0], ...snapshot[1]].filter(Boolean).join(" ");
12361
+ if ((STAGED_DOM?.view(element) ?? element).getAttribute("class") !== classes)
12362
+ setClassAttr(element, classes);
12363
+ const serialized = JSON.stringify(snapshot);
12364
+ if ((STAGED_DOM?.view(element) ?? element).getAttribute(receipt) !== serialized)
12365
+ setStringData(element, receipt, serialized);
12366
+ }
12367
+ function setBindingClassIfChanged(value, previous, element, receipt) {
12368
+ if (value !== previous) setBindingClass(element, receipt, value);
12369
+ return value;
12370
+ }
11042
12371
  function hydrationMarkerMultiplicity(data, open) {
11043
12372
  const marker = open ? import_constants.HYDRATION_START : import_constants.HYDRATION_END;
11044
12373
  if (data === marker) return 1;
11045
12374
  if (open && (data === import_constants.HYDRATION_FOR_EMPTY || data === import_constants.HYDRATION_FOR_ITEMS)) return 1;
12375
+ if (open && (data.startsWith("[b;") || data.startsWith("[f")) && (0, import_dom_binding_protocol.isBindingOpenComment)(data))
12376
+ return 1;
11046
12377
  if (data.length < 2 || data.charCodeAt(0) !== marker.charCodeAt(0)) return 0;
11047
12378
  const first = data.charCodeAt(1);
11048
12379
  if (first < 49 || first > 57) return 0;
@@ -11101,7 +12432,9 @@ function findMatchingClose(open, matches) {
11101
12432
  function ssrForMarkerState(node) {
11102
12433
  if (node.nodeType !== 8) return -1;
11103
12434
  const data = (STAGED_DOM?.view(node) ?? node).data;
11104
- return data === import_constants.HYDRATION_FOR_EMPTY ? 0 : data === import_constants.HYDRATION_FOR_ITEMS ? 1 : -1;
12435
+ if (data === import_constants.HYDRATION_FOR_EMPTY) return 0;
12436
+ if (data === import_constants.HYDRATION_FOR_ITEMS) return 1;
12437
+ return (0, import_dom_binding_protocol.isBindingOpenComment)(data) && data.startsWith("[f") ? data.charCodeAt(2) === 48 ? 0 : 1 : -1;
11105
12438
  }
11106
12439
  function child(node) {
11107
12440
  if (currentHydration !== null) return (STAGED_DOM?.view(node) ?? node).firstChild;
@@ -11134,6 +12467,330 @@ function setText(node, value) {
11134
12467
  if (hiddenTextWriter !== null && hiddenTextWriter(node, text)) return;
11135
12468
  (STAGED_DOM?.view(node) ?? node).nodeValue = text;
11136
12469
  }
12470
+ const DIRECT_SIGNAL_BINDING = /* @__PURE__ */ Symbol("octane.direct-signal-binding");
12471
+ function isSignalHandle(value) {
12472
+ return (typeof value === "object" || typeof value === "function") && value !== null && value[import_types.SIGNAL_HANDLE] === true;
12473
+ }
12474
+ function readSignalBinding(handle) {
12475
+ return handle[import_types.SIGNAL_BINDING_READ]();
12476
+ }
12477
+ function nativeTransitionBindingNotify(binding, notify) {
12478
+ return Object.assign(notify, {
12479
+ [import_read_protocol.NATIVE_TRANSITION_CONSUMER]: {
12480
+ active: () => !binding.disposed && !binding.scope.block.disposed,
12481
+ prepare: () => prepareNativeTransitionBlock(binding.scope.block)
12482
+ }
12483
+ });
12484
+ }
12485
+ function isWritableSignal(value) {
12486
+ return isSignalHandle(value) && value.kind === "signal" && typeof value.set === "function";
12487
+ }
12488
+ function disposeDirectSignalBinding(binding) {
12489
+ if (binding.disposed) return;
12490
+ if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => disposeDirectSignalBinding(binding)) === true)
12491
+ return;
12492
+ binding.disposed = true;
12493
+ binding.unsubscribe?.();
12494
+ retireNativeTransitionBlock(binding.scope.block);
12495
+ binding.controlWriterCleanup?.();
12496
+ if (binding.input !== void 0) {
12497
+ domNode(binding.target).removeEventListener("input", binding.input);
12498
+ }
12499
+ }
12500
+ function directSignalControlValue(binding, snapshot) {
12501
+ if (binding.kind === "checked") return snapshot.checked ?? false;
12502
+ return snapshot.selectedValues ?? snapshot.value;
12503
+ }
12504
+ function validateDirectSignalControl(element, site) {
12505
+ const actual = (STAGED_DOM?.view(element) ?? element).getAttribute(import_constants.HYDRATE_INPUT_ATTR);
12506
+ if (actual === null && activeHydration() === null) {
12507
+ (STAGED_DOM?.view(element) ?? element).setAttribute(import_constants.HYDRATE_INPUT_ATTR, site);
12508
+ return;
12509
+ }
12510
+ if (actual !== site) {
12511
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(67, site));
12512
+ }
12513
+ }
12514
+ function writeDirectSignalBinding(binding, value) {
12515
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(binding);
12516
+ if (binding.kind === "text" || binding.kind === "textOnlyChild") {
12517
+ if (binding.text === void 0) {
12518
+ binding.text = binding.kind === "textOnlyChild" ? htext(binding.target, value) : htextSwap(binding.target, value);
12519
+ } else {
12520
+ setText(binding.text, value);
12521
+ }
12522
+ } else if (binding.kind === "attribute") {
12523
+ const element = binding.target;
12524
+ switch (binding.attributeKind) {
12525
+ case "class":
12526
+ if (element.namespaceURI === HTML_NS) setClassName(element, value);
12527
+ else setClassAttr(element, value);
12528
+ break;
12529
+ case "booleanAttr":
12530
+ setBooleanAttribute(element, binding.name, value);
12531
+ break;
12532
+ case "ariaAttr":
12533
+ setAriaAttribute(element, binding.name, value);
12534
+ break;
12535
+ case "stringData":
12536
+ setStringData(element, binding.name, value);
12537
+ break;
12538
+ default:
12539
+ setAttribute(element, binding.name, value);
12540
+ }
12541
+ } else if (binding.kind === "value") {
12542
+ const element = binding.target;
12543
+ if (element.localName === "select") setSelectValue(element, value);
12544
+ else setValue(element, value);
12545
+ } else {
12546
+ setChecked(binding.target, value);
12547
+ }
12548
+ binding.value = value;
12549
+ }
12550
+ function writeDirectSignalScalar(target, value, kind, previous, name, attributeKind) {
12551
+ if (kind === "text" || kind === "textOnlyChild") {
12552
+ if (previous instanceof Text) {
12553
+ setText(previous, value);
12554
+ return previous;
12555
+ }
12556
+ return kind === "textOnlyChild" ? htext(target, value) : htextSwap(target, value);
12557
+ }
12558
+ if (kind === "attribute") {
12559
+ const element = target;
12560
+ switch (attributeKind) {
12561
+ case "class":
12562
+ if (element.namespaceURI === HTML_NS) setClassName(element, value);
12563
+ else setClassAttr(element, value);
12564
+ break;
12565
+ case "booleanAttr":
12566
+ setBooleanAttribute(element, name, value);
12567
+ break;
12568
+ case "ariaAttr":
12569
+ setAriaAttribute(element, name, value);
12570
+ break;
12571
+ case "stringData":
12572
+ setStringData(element, name, value);
12573
+ break;
12574
+ default:
12575
+ setAttribute(element, name, value);
12576
+ }
12577
+ } else if (kind === "value") {
12578
+ const element = target;
12579
+ if (element.localName === "select") setSelectValue(element, value);
12580
+ else setValue(element, value);
12581
+ } else {
12582
+ setChecked(target, value);
12583
+ }
12584
+ return value;
12585
+ }
12586
+ function updateDirectSignalBinding(binding) {
12587
+ if (binding.disposed || binding.pendingControl || binding.handle === null || binding.scope.block.disposed)
12588
+ return;
12589
+ try {
12590
+ runWithBlockSignalOwner(binding.scope, () => {
12591
+ const value = readSignalBinding(binding.handle);
12592
+ if (!Object.is(binding.value, value)) writeDirectSignalBinding(binding, value);
12593
+ if (process.env.NODE_ENV !== "production" && STAGED_DOM === null && binding.target.nodeType === 1)
12594
+ drainDevFormDiagnostics(binding.target);
12595
+ });
12596
+ } catch {
12597
+ scheduleRender(binding.scope.block);
12598
+ }
12599
+ }
12600
+ function installDirectSignalControl(binding) {
12601
+ if (!isWritableSignal(binding.handle)) return;
12602
+ const element = binding.target;
12603
+ validateDirectSignalControl(element, binding.site);
12604
+ const handle = binding.handle;
12605
+ const input = () => {
12606
+ if (binding.disposed || binding.pendingControl) return;
12607
+ const snapshot = (0, import_event_capture.snapshotHydrationControl)(element);
12608
+ if (snapshot === null) return;
12609
+ (0, import_transition_state.withoutSignalCandidate)(
12610
+ () => runWithBlockSignalOwner(
12611
+ binding.scope,
12612
+ () => handle.set(directSignalControlValue(binding, snapshot))
12613
+ )
12614
+ );
12615
+ };
12616
+ binding.input = input;
12617
+ (STAGED_DOM?.view(element) ?? element).addEventListener("input", input);
12618
+ binding.controlWriterCleanup = (0, import_early_values.registerHydrationControlSignalWriter)(
12619
+ element,
12620
+ binding.kind === "checked" ? "checked" : "value",
12621
+ (value) => (0, import_transition_state.withoutSignalCandidate)(
12622
+ () => runWithBlockSignalOwner(binding.scope, () => {
12623
+ if (!binding.disposed && !binding.pendingControl && isWritableSignal(binding.handle))
12624
+ binding.handle.set(value);
12625
+ })
12626
+ )
12627
+ );
12628
+ }
12629
+ function queueDirectSignalControlAdoption(binding) {
12630
+ enqueueEffectEventCommitAction(() => {
12631
+ if (binding.disposed || binding.scope.block.disposed || !binding.pendingControl) return;
12632
+ (0, import_transition_state.withoutSignalCandidate)(
12633
+ () => runWithBlockSignalOwner(binding.scope, () => {
12634
+ const element = binding.target;
12635
+ const snapshot = (0, import_event_capture.snapshotHydrationControl)(element);
12636
+ if (snapshot.editRevision > 0 && isWritableSignal(binding.handle)) {
12637
+ binding.handle.set(directSignalControlValue(binding, snapshot));
12638
+ }
12639
+ if (binding.disposed || binding.scope.block.disposed) return;
12640
+ if (!(0, import_event_capture.consumeHydrationControl)(element, snapshot.revision)) {
12641
+ queueDirectSignalControlAdoption(binding);
12642
+ return;
12643
+ }
12644
+ binding.pendingControl = false;
12645
+ writeDirectSignalBinding(binding, readSignalBinding(binding.handle));
12646
+ })
12647
+ );
12648
+ });
12649
+ }
12650
+ function activateDirectSignalBinding(binding, revision) {
12651
+ if (binding.disposed) return;
12652
+ if (binding.handle !== null)
12653
+ binding.unsubscribe = binding.handle[import_types.SIGNAL_BINDING_SUBSCRIBE](
12654
+ nativeTransitionBindingNotify(binding, () => updateDirectSignalBinding(binding))
12655
+ );
12656
+ if (revision !== void 0) {
12657
+ installDirectSignalControl(binding);
12658
+ if (!binding.pendingControl) (0, import_event_capture.consumeHydrationControl)(binding.target, revision);
12659
+ }
12660
+ }
12661
+ function createDirectSignalBinding(scope, target, value, site, kind, name, attributeKind, text) {
12662
+ const handle = isSignalHandle(value) ? value : null;
12663
+ const binding = {
12664
+ [DIRECT_SIGNAL_BINDING]: true,
12665
+ scope,
12666
+ kind,
12667
+ target,
12668
+ site,
12669
+ name,
12670
+ attributeKind,
12671
+ handle,
12672
+ value: scope,
12673
+ disposed: false
12674
+ };
12675
+ if (text !== void 0) binding.text = text;
12676
+ const controlSnapshot = kind === "value" || kind === "checked" ? (0, import_event_capture.snapshotHydrationControl)(target) : null;
12677
+ if (controlSnapshot !== null) validateDirectSignalControl(target, site);
12678
+ binding.pendingControl = activeHydration() !== null && isWritableSignal(handle) && controlSnapshot !== null && controlSnapshot.editRevision > 0;
12679
+ const initial = handle === null ? value : readSignalBinding(handle);
12680
+ if (!binding.pendingControl) writeDirectSignalBinding(binding, initial);
12681
+ if (STAGED_COMMIT_CAPTURE !== null) {
12682
+ DEFERRED_LAYOUT_DRIVER.stageAction(() => {
12683
+ runWithBlockSignalOwner(
12684
+ scope,
12685
+ () => activateDirectSignalBinding(binding, controlSnapshot?.revision)
12686
+ );
12687
+ updateDirectSignalBinding(binding);
12688
+ });
12689
+ } else activateDirectSignalBinding(binding, controlSnapshot?.revision);
12690
+ if (binding.pendingControl) queueDirectSignalControlAdoption(binding);
12691
+ registerHookCleanup(scope, () => disposeDirectSignalBinding(binding));
12692
+ return binding;
12693
+ }
12694
+ function bindDirectSignal(scope, previous, target, value, site, kind, name, attributeKind) {
12695
+ const prior = typeof previous === "object" && previous !== null && previous[DIRECT_SIGNAL_BINDING] === true ? previous : null;
12696
+ const handle = isSignalHandle(value) ? value : null;
12697
+ if (handle !== null && (!import_document_owner.signalDocumentEnabled || (0, import_owner_context.currentSignalOwner)() !== SCOPE_SIGNAL_OWNERS.get(scope))) {
12698
+ if (!import_document_owner.signalDocumentEnabled) enableSignalBindings();
12699
+ return runWithBlockSignalOwner(
12700
+ scope,
12701
+ () => bindDirectSignal(scope, previous, target, value, site, kind, name, attributeKind)
12702
+ );
12703
+ }
12704
+ if (handle === null && prior === null) {
12705
+ if (kind === "attribute" && previous === value) {
12706
+ const hydration = value === void 0 ? activeHydration() : null;
12707
+ if (hydration === null || hydration.isFresh(target)) return previous;
12708
+ }
12709
+ if (TRANSITION_JOURNAL !== null) journalBag();
12710
+ const scalarTarget = (kind === "text" || kind === "textOnlyChild") && previous instanceof Text ? previous : target;
12711
+ return writeDirectSignalScalar(scalarTarget, value, kind, previous, name, attributeKind);
12712
+ }
12713
+ if (prior !== null && !prior.disposed && prior.target === target && prior.kind === kind && prior.site === site && prior.name === name && prior.attributeKind === attributeKind && prior.handle === handle) {
12714
+ if (prior.pendingControl) {
12715
+ queueDirectSignalControlAdoption(prior);
12716
+ return prior;
12717
+ }
12718
+ const next = readSignalBinding(handle);
12719
+ if (!Object.is(prior.value, next)) writeDirectSignalBinding(prior, next);
12720
+ return prior;
12721
+ }
12722
+ if (TRANSITION_JOURNAL !== null) journalBag();
12723
+ if (handle === null) {
12724
+ const scalarTarget = kind === "text" || kind === "textOnlyChild" ? prior?.text ?? prior?.target ?? target : target;
12725
+ const token = writeDirectSignalScalar(
12726
+ scalarTarget,
12727
+ value,
12728
+ kind,
12729
+ kind === "text" || kind === "textOnlyChild" ? prior?.text : prior?.value ?? previous,
12730
+ name,
12731
+ attributeKind
12732
+ );
12733
+ if (prior !== null) {
12734
+ const finish = (discarded) => {
12735
+ if (!discarded) disposeDirectSignalBinding(prior);
12736
+ };
12737
+ if (WIP_CAPTURE === null) finish(false);
12738
+ else (WIP_CAPTURE.renderCleanups ??= []).push(finish);
12739
+ }
12740
+ return token;
12741
+ }
12742
+ const signalTarget = (kind === "text" || kind === "textOnlyChild") && previous instanceof Text ? previous : target;
12743
+ const binding = createDirectSignalBinding(
12744
+ scope,
12745
+ signalTarget,
12746
+ value,
12747
+ site,
12748
+ kind,
12749
+ name,
12750
+ attributeKind,
12751
+ kind === "text" || kind === "textOnlyChild" ? prior?.text ?? (previous instanceof Text ? previous : void 0) : void 0
12752
+ );
12753
+ if (prior !== null) {
12754
+ const finish = (discarded) => disposeDirectSignalBinding(discarded ? binding : prior);
12755
+ if (WIP_CAPTURE === null) finish(false);
12756
+ else (WIP_CAPTURE.renderCleanups ??= []).push(finish);
12757
+ }
12758
+ return binding;
12759
+ }
12760
+ function bindSignalText(scope, previous, position, value, site, onlyChild = false, seededText = void 0, bindingMarker, previousValue) {
12761
+ if (previous instanceof Text && arguments.length > 8 && previousValue === value && !isSignalHandle(value))
12762
+ return previous;
12763
+ if (previous === void 0 && bindingMarker !== void 0) {
12764
+ const existing = activeHydration() !== null ? getNextSibling(position) : null;
12765
+ previous = bindingText(
12766
+ position,
12767
+ existing?.nodeType === 3 ? (STAGED_DOM?.view(existing) ?? existing).nodeValue : "",
12768
+ bindingMarker
12769
+ );
12770
+ }
12771
+ if (previous === void 0 && onlyChild && seededText === 1 && activeHydration() === null) {
12772
+ const text = getFirstChild(position);
12773
+ if (text instanceof Text) previous = text;
12774
+ }
12775
+ const prior = previous;
12776
+ return bindDirectSignal(
12777
+ scope,
12778
+ previous,
12779
+ prior?.target ?? (previous instanceof Text ? previous : position),
12780
+ value,
12781
+ site,
12782
+ onlyChild ? "textOnlyChild" : "text"
12783
+ );
12784
+ }
12785
+ function bindSignalAttribute(scope, previous, element, name, value, site, attributeKind = "attr") {
12786
+ return bindDirectSignal(scope, previous, element, value, site, "attribute", name, attributeKind);
12787
+ }
12788
+ function bindSignalValue(scope, previous, element, value, site) {
12789
+ return bindDirectSignal(scope, previous, element, value, site, "value");
12790
+ }
12791
+ function bindSignalChecked(scope, previous, element, value, site) {
12792
+ return bindDirectSignal(scope, previous, element, value, site, "checked");
12793
+ }
11137
12794
  function setAttributeIfChanged(value, previous, el, name) {
11138
12795
  if (previous === value) return previous;
11139
12796
  setAttribute(el, name, value);
@@ -12558,8 +14215,7 @@ function normalizedHostProp(el, rawName) {
12558
14215
  if (actionName !== null) return actionName;
12559
14216
  return isHtmlCustomElement(el) ? rawName : import_constants.ATTRIBUTE_ALIASES.get(rawName) ?? rawName;
12560
14217
  }
12561
- function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false, readStyle) {
12562
- const props = /* @__PURE__ */ new Map();
14218
+ function resolveHostPropSources(el, sources, props, readStyle) {
12563
14219
  let classMerges = null;
12564
14220
  let sourceOrder = 0;
12565
14221
  function record(rawName, value) {
@@ -12583,64 +14239,440 @@ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false,
12583
14239
  record(rawName, source[2]);
12584
14240
  continue;
12585
14241
  }
12586
- const spread = source[1];
12587
- if (spread == null || typeof spread !== "object" && typeof spread !== "function") continue;
12588
- for (const name of Object.keys(Object(spread))) {
12589
- record(name, spread[name]);
14242
+ const spread = source[1];
14243
+ if (spread == null || typeof spread !== "object" && typeof spread !== "function") continue;
14244
+ for (const name of Object.keys(Object(spread))) {
14245
+ record(name, spread[name]);
14246
+ }
14247
+ }
14248
+ const values = /* @__PURE__ */ new Map();
14249
+ const html = el.namespaceURI === "http://www.w3.org/1999/xhtml";
14250
+ let needsWinningOrderSort = false;
14251
+ for (const writer of props.values()) {
14252
+ const rawName = writer.name;
14253
+ if (rawName === "key") continue;
14254
+ const identityKey = isHostPropIdentityKey(rawName);
14255
+ const name = identityKey ? rawName : normalizedHostProp(el, rawName);
14256
+ const identity = html && !identityKey ? name.toLowerCase() : name;
14257
+ const previous = values.get(identity);
14258
+ if (previous !== void 0) {
14259
+ if (previous.lastOrder >= writer.lastOrder) continue;
14260
+ needsWinningOrderSort = true;
14261
+ }
14262
+ writer.name = process.env.NODE_ENV !== "production" && (rawName === "tabIndex" || rawName === "htmlFor") ? rawName : name;
14263
+ values.set(identity, writer);
14264
+ }
14265
+ if (classMerges !== null) {
14266
+ for (const extra of classMerges) {
14267
+ const previous = values.get("class");
14268
+ if (previous !== void 0) {
14269
+ previous.value = (0, import_css.mergeClass)(previous.value, extra.value);
14270
+ previous.lastOrder = extra.order;
14271
+ } else {
14272
+ values.set("class", {
14273
+ name: "class",
14274
+ value: extra.value,
14275
+ firstOrder: extra.order,
14276
+ lastOrder: extra.order
14277
+ });
14278
+ }
14279
+ }
14280
+ }
14281
+ const resolved = /* @__PURE__ */ Object.create(null);
14282
+ const ordered = needsWinningOrderSort ? [...values.values()].sort((a, b) => a.firstOrder - b.firstOrder) : values.values();
14283
+ for (const { name, value } of ordered) resolved[name] = value;
14284
+ if (readStyle !== void 0 && "style" in resolved) resolved.style = readStyle(resolved.style);
14285
+ return resolved;
14286
+ }
14287
+ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false, readStyle, deferControl = false) {
14288
+ const props = /* @__PURE__ */ new Map();
14289
+ const resolved = resolveHostPropSources(el, sources, props, readStyle);
14290
+ const tag = el.localName;
14291
+ const formHost = tag === "input" || tag === "textarea" || tag === "select";
14292
+ setSpread(el, resolved, prev, scope, true, formHost);
14293
+ setDangerouslySetInnerHTMLSources(el, sources, hasNestedChildren);
14294
+ if (formHost && !deferControl)
14295
+ applyFormControlValues(
14296
+ el,
14297
+ tag,
14298
+ props.get("value")?.value,
14299
+ props.get("defaultValue")?.value,
14300
+ props.get("checked")?.value,
14301
+ props.get("defaultChecked")?.value,
14302
+ props.get("multiple")?.value
14303
+ );
14304
+ return resolved;
14305
+ }
14306
+ const SIGNAL_HOST_PROP_SOURCES = /* @__PURE__ */ Symbol("octane.signal-host-prop-sources");
14307
+ function resolveSignalStyle(value, handles, read) {
14308
+ if (isSignalHandle(value)) {
14309
+ handles.add(value);
14310
+ return read(value);
14311
+ }
14312
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
14313
+ let copy;
14314
+ for (const name of Object.keys(value)) {
14315
+ const current = value[name];
14316
+ if (!isSignalHandle(current)) continue;
14317
+ handles.add(current);
14318
+ copy ??= { ...value };
14319
+ copy[name] = read(current);
14320
+ }
14321
+ return copy ?? value;
14322
+ }
14323
+ function resolveSignalHostPropSources(sources, readStyle, read = readSignalBinding) {
14324
+ const handles = /* @__PURE__ */ new Set();
14325
+ let rows;
14326
+ for (let i = 0; i < sources.length; i++) {
14327
+ const source = sources[i];
14328
+ if (!source[0]) {
14329
+ const value = source[1] === "children" || source[1] === "style" && readStyle !== void 0 ? source[2] : source[1] === "style" ? resolveSignalStyle(source[2], handles, read) : isSignalHandle(source[2]) ? (handles.add(source[2]), read(source[2])) : source[2];
14330
+ if (value !== source[2]) {
14331
+ rows ??= sources.slice();
14332
+ rows[i] = [false, source[1], value, source[3]];
14333
+ }
14334
+ continue;
14335
+ }
14336
+ const spread = source[1];
14337
+ if (spread === null || typeof spread !== "object") continue;
14338
+ let copy;
14339
+ for (const name of Object.keys(spread)) {
14340
+ const current = spread[name];
14341
+ const value = name === "children" || name === "style" && readStyle !== void 0 ? current : name === "style" ? resolveSignalStyle(current, handles, read) : isSignalHandle(current) ? (handles.add(current), read(current)) : current;
14342
+ if (value !== current) {
14343
+ copy ??= { ...spread };
14344
+ copy[name] = value;
14345
+ }
14346
+ }
14347
+ if (copy !== void 0) {
14348
+ rows ??= sources.slice();
14349
+ rows[i] = [true, copy];
14350
+ }
14351
+ }
14352
+ return { sources: rows ?? sources, handles };
14353
+ }
14354
+ function winningSignalHostControl(sources, name) {
14355
+ let winner;
14356
+ for (const source of sources) {
14357
+ if (!source[0]) {
14358
+ if (source[1] === name) winner = source[2];
14359
+ continue;
14360
+ }
14361
+ const spread = source[1];
14362
+ if (spread !== null && typeof spread === "object" && Object.prototype.propertyIsEnumerable.call(spread, name)) {
14363
+ winner = spread[name];
14364
+ }
14365
+ }
14366
+ return isSignalHandle(winner) ? winner : null;
14367
+ }
14368
+ function updateSignalHostPropSources(binding) {
14369
+ if (binding.disposed || binding.pendingControl || binding.scope.block.disposed) return;
14370
+ try {
14371
+ runWithBlockSignalOwner(binding.scope, () => {
14372
+ const next = resolveSignalHostPropSources(binding.sources, binding.readStyle);
14373
+ binding.resolved = setHostPropSources(
14374
+ binding.element,
14375
+ next.sources,
14376
+ binding.resolved,
14377
+ binding.scope,
14378
+ binding.hasNestedChildren,
14379
+ binding.readStyle
14380
+ );
14381
+ if (process.env.NODE_ENV !== "production" && STAGED_DOM === null)
14382
+ drainDevFormDiagnostics(binding.element);
14383
+ });
14384
+ } catch {
14385
+ scheduleRender(binding.scope.block);
14386
+ }
14387
+ }
14388
+ function addSignalHostSubscription(binding, handle) {
14389
+ const unsubscribe = handle[import_types.SIGNAL_BINDING_SUBSCRIBE](
14390
+ nativeTransitionBindingNotify(binding, () => updateSignalHostPropSources(binding))
14391
+ );
14392
+ binding.subscriptions.set(handle, unsubscribe);
14393
+ return unsubscribe;
14394
+ }
14395
+ function rebindSignalHostSubscriptions(binding, handles) {
14396
+ for (const [handle, unsubscribe] of binding.subscriptions) {
14397
+ if (handles.has(handle)) continue;
14398
+ unsubscribe();
14399
+ binding.subscriptions.delete(handle);
14400
+ if (TRANSITION_JOURNAL !== null) {
14401
+ journalUndo(() => {
14402
+ if (binding.disposed || binding.scope.block.disposed) return;
14403
+ runWithBlockSignalOwner(binding.scope, () => addSignalHostSubscription(binding, handle));
14404
+ });
14405
+ }
14406
+ }
14407
+ for (const handle of handles) {
14408
+ if (binding.subscriptions.has(handle)) continue;
14409
+ const unsubscribe = addSignalHostSubscription(binding, handle);
14410
+ if (TRANSITION_JOURNAL !== null) {
14411
+ journalUndo(() => {
14412
+ unsubscribe();
14413
+ binding.subscriptions.delete(handle);
14414
+ });
14415
+ }
14416
+ }
14417
+ }
14418
+ function addSignalHostControlWriter(binding, channel) {
14419
+ const cleanup = (0, import_early_values.registerHydrationControlSignalWriter)(binding.element, channel, (next) => {
14420
+ (0, import_transition_state.withoutSignalCandidate)(
14421
+ () => runWithBlockSignalOwner(binding.scope, () => {
14422
+ const handle = winningSignalHostControl(binding.sources, channel);
14423
+ if (!binding.disposed && !binding.pendingControl && isWritableSignal(handle))
14424
+ handle.set(next);
14425
+ })
14426
+ );
14427
+ });
14428
+ binding.controlWriters.set(channel, cleanup);
14429
+ return cleanup;
14430
+ }
14431
+ function syncSignalHostControl(binding) {
14432
+ const element = binding.element;
14433
+ const value = winningSignalHostControl(binding.sources, "value");
14434
+ const checked = winningSignalHostControl(binding.sources, "checked");
14435
+ const writable = isWritableSignal(value) || isWritableSignal(checked);
14436
+ for (const [channel, cleanup] of binding.controlWriters) {
14437
+ if (channel === "value" && isWritableSignal(value) || channel === "checked" && isWritableSignal(checked)) {
14438
+ continue;
14439
+ }
14440
+ cleanup();
14441
+ binding.controlWriters.delete(channel);
14442
+ if (TRANSITION_JOURNAL !== null) {
14443
+ journalUndo(() => {
14444
+ if (!binding.disposed && !binding.scope.block.disposed)
14445
+ addSignalHostControlWriter(binding, channel);
14446
+ });
12590
14447
  }
12591
14448
  }
12592
- const values = /* @__PURE__ */ new Map();
12593
- const html = el.namespaceURI === "http://www.w3.org/1999/xhtml";
12594
- let needsWinningOrderSort = false;
12595
- for (const writer of props.values()) {
12596
- const rawName = writer.name;
12597
- if (rawName === "key") continue;
12598
- const identityKey = isHostPropIdentityKey(rawName);
12599
- const name = identityKey ? rawName : normalizedHostProp(el, rawName);
12600
- const identity = html && !identityKey ? name.toLowerCase() : name;
12601
- const previous = values.get(identity);
12602
- if (previous !== void 0) {
12603
- if (previous.lastOrder >= writer.lastOrder) continue;
12604
- needsWinningOrderSort = true;
14449
+ if (isWritableSignal(value) && !binding.controlWriters.has("value")) {
14450
+ const cleanup = addSignalHostControlWriter(binding, "value");
14451
+ if (TRANSITION_JOURNAL !== null) {
14452
+ journalUndo(() => {
14453
+ cleanup();
14454
+ binding.controlWriters.delete("value");
14455
+ });
12605
14456
  }
12606
- writer.name = process.env.NODE_ENV !== "production" && (rawName === "tabIndex" || rawName === "htmlFor") ? rawName : name;
12607
- values.set(identity, writer);
12608
14457
  }
12609
- if (classMerges !== null) {
12610
- for (const extra of classMerges) {
12611
- const previous = values.get("class");
12612
- if (previous !== void 0) {
12613
- previous.value = (0, import_css.mergeClass)(previous.value, extra.value);
12614
- previous.lastOrder = extra.order;
12615
- } else {
12616
- values.set("class", {
12617
- name: "class",
12618
- value: extra.value,
12619
- firstOrder: extra.order,
12620
- lastOrder: extra.order
14458
+ if (isWritableSignal(checked) && !binding.controlWriters.has("checked")) {
14459
+ const cleanup = addSignalHostControlWriter(binding, "checked");
14460
+ if (TRANSITION_JOURNAL !== null) {
14461
+ journalUndo(() => {
14462
+ cleanup();
14463
+ binding.controlWriters.delete("checked");
14464
+ });
14465
+ }
14466
+ }
14467
+ if (!writable) {
14468
+ if (binding.input !== void 0) {
14469
+ const input2 = binding.input;
14470
+ (STAGED_DOM?.view(element) ?? element).removeEventListener("input", input2);
14471
+ if (TRANSITION_JOURNAL !== null) {
14472
+ journalUndo(() => {
14473
+ if (!binding.disposed && !binding.scope.block.disposed)
14474
+ (STAGED_DOM?.view(element) ?? element).addEventListener("input", input2);
12621
14475
  });
12622
14476
  }
14477
+ binding.input = void 0;
12623
14478
  }
14479
+ return;
12624
14480
  }
12625
- const resolved = /* @__PURE__ */ Object.create(null);
12626
- const ordered = needsWinningOrderSort ? [...values.values()].sort((a, b) => a.firstOrder - b.firstOrder) : values.values();
12627
- for (const { name, value } of ordered) resolved[name] = value;
12628
- if (readStyle !== void 0 && "style" in resolved) resolved.style = readStyle(resolved.style);
12629
- const tag = el.localName;
12630
- const formHost = tag === "input" || tag === "textarea" || tag === "select";
12631
- setSpread(el, resolved, prev, scope, true, formHost);
12632
- setDangerouslySetInnerHTMLSources(el, sources, hasNestedChildren);
12633
- if (formHost)
12634
- applyFormControlValues(
12635
- el,
12636
- tag,
12637
- props.get("value")?.value,
12638
- props.get("defaultValue")?.value,
12639
- props.get("checked")?.value,
12640
- props.get("defaultChecked")?.value,
12641
- props.get("multiple")?.value
14481
+ validateDirectSignalControl(element, binding.site);
14482
+ if (binding.input !== void 0) return;
14483
+ const input = () => {
14484
+ if (binding.disposed || binding.pendingControl) return;
14485
+ const live = (0, import_event_capture.snapshotHydrationControl)(element);
14486
+ if (live === null) return;
14487
+ (0, import_transition_state.withoutSignalCandidate)(
14488
+ () => runWithBlockSignalOwner(binding.scope, () => {
14489
+ const nextValue = winningSignalHostControl(binding.sources, "value");
14490
+ const nextChecked = winningSignalHostControl(binding.sources, "checked");
14491
+ if (isWritableSignal(nextChecked) && live.checked !== void 0)
14492
+ nextChecked.set(live.checked);
14493
+ if (isWritableSignal(nextValue)) nextValue.set(live.selectedValues ?? live.value);
14494
+ })
12642
14495
  );
12643
- return resolved;
14496
+ };
14497
+ binding.input = input;
14498
+ (STAGED_DOM?.view(element) ?? element).addEventListener("input", input);
14499
+ if (TRANSITION_JOURNAL !== null)
14500
+ journalUndo(() => (STAGED_DOM?.view(element) ?? element).removeEventListener("input", input));
14501
+ }
14502
+ function disposeSignalHostPropSources(binding) {
14503
+ if (binding.disposed) return;
14504
+ if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => disposeSignalHostPropSources(binding)) === true)
14505
+ return;
14506
+ binding.disposed = true;
14507
+ for (const unsubscribe of binding.subscriptions.values()) unsubscribe();
14508
+ retireNativeTransitionBlock(binding.scope.block);
14509
+ binding.subscriptions.clear();
14510
+ for (const cleanup of binding.controlWriters.values()) cleanup();
14511
+ binding.controlWriters.clear();
14512
+ if (binding.input !== void 0)
14513
+ domNode(binding.element).removeEventListener("input", binding.input);
14514
+ queueOwnRefDetach(binding.resolved, binding.element);
14515
+ }
14516
+ function queueSignalHostControlAdoption(binding) {
14517
+ enqueueEffectEventCommitAction(() => {
14518
+ if (binding.disposed || binding.scope.block.disposed || !binding.pendingControl) return;
14519
+ (0, import_transition_state.withoutSignalCandidate)(
14520
+ () => runWithBlockSignalOwner(binding.scope, () => {
14521
+ const snapshot = (0, import_event_capture.snapshotHydrationControl)(binding.element);
14522
+ if (snapshot.editRevision > 0) {
14523
+ const checked = winningSignalHostControl(binding.sources, "checked");
14524
+ const value = winningSignalHostControl(binding.sources, "value");
14525
+ if (isWritableSignal(checked) && snapshot.checked !== void 0)
14526
+ checked.set(snapshot.checked);
14527
+ if (isWritableSignal(value)) value.set(snapshot.selectedValues ?? snapshot.value);
14528
+ }
14529
+ if (binding.disposed || binding.scope.block.disposed) return;
14530
+ if (!(0, import_event_capture.consumeHydrationControl)(binding.element, snapshot.revision)) {
14531
+ queueSignalHostControlAdoption(binding);
14532
+ return;
14533
+ }
14534
+ binding.pendingControl = false;
14535
+ updateSignalHostPropSources(binding);
14536
+ })
14537
+ );
14538
+ });
14539
+ }
14540
+ function createSignalHostPropSourcesBinding(scope, element, sources, site, hasNestedChildren, readStyle) {
14541
+ const binding = {
14542
+ [SIGNAL_HOST_PROP_SOURCES]: true,
14543
+ scope,
14544
+ element,
14545
+ site,
14546
+ hasNestedChildren,
14547
+ readStyle,
14548
+ sources,
14549
+ resolved: void 0,
14550
+ subscriptions: /* @__PURE__ */ new Map(),
14551
+ controlWriters: /* @__PURE__ */ new Map(),
14552
+ disposed: false
14553
+ };
14554
+ registerHookCleanup(scope, () => disposeSignalHostPropSources(binding));
14555
+ return binding;
14556
+ }
14557
+ function prepareSignalHostPropSources(scope, previous, element, sources, site, hasNestedChildren = false, readStyle) {
14558
+ if (isHtmlCustomElement(element) || element.hasAttribute("is") || element.localName === "input" || element.localName === "textarea" || element.localName === "select")
14559
+ presentationMiss(false);
14560
+ return runWithBlockSignalOwner(scope, () => {
14561
+ const next = resolveSignalHostPropSources(sources, readStyle, (handle) => handle.get());
14562
+ const writers = /* @__PURE__ */ new Map();
14563
+ const resolved = resolveHostPropSources(element, next.sources, writers, readStyle);
14564
+ for (const name of writers.keys()) {
14565
+ if (name === "ref" || isEventKey(name)) continue;
14566
+ if (isHostPropIdentityKey(name) || name === "is" || name === "muted" || name === "selected" || formActionAttributeName(element, name) !== null)
14567
+ presentationMiss(false);
14568
+ }
14569
+ const prepared = /* @__PURE__ */ Object.create(null);
14570
+ for (const name of Object.keys(resolved)) {
14571
+ const value = resolved[name];
14572
+ prepared[name] = name === "ref" || isEventKey(name) ? value : name === "style" ? (0, import_dom_binding_styles.__normalizeBindingStyle)(value) : preparedPresentationAttribute(
14573
+ element,
14574
+ name,
14575
+ value,
14576
+ name === "class" ? "class" : "attr"
14577
+ );
14578
+ }
14579
+ const prior = previous;
14580
+ const reusable = prior?.[SIGNAL_HOST_PROP_SOURCES] === true && !prior.disposed && prior.resolved === void 0 && prior.scope === scope && prior.element === element && prior.site === site && prior.hasNestedChildren === hasNestedChildren && prior.readStyle === readStyle;
14581
+ const binding = reusable ? prior : createSignalHostPropSourcesBinding(
14582
+ scope,
14583
+ element,
14584
+ sources,
14585
+ site,
14586
+ hasNestedChildren,
14587
+ readStyle
14588
+ );
14589
+ let published = false;
14590
+ return {
14591
+ binding,
14592
+ publish() {
14593
+ if (published || binding.disposed || scope.block.disposed) return;
14594
+ published = true;
14595
+ runWithBlockSignalOwner(scope, () => {
14596
+ setSpread(
14597
+ element,
14598
+ prepared,
14599
+ "style" in prepared ? { style: "" } : void 0,
14600
+ scope,
14601
+ true
14602
+ );
14603
+ binding.sources = sources;
14604
+ binding.resolved = resolved;
14605
+ rebindSignalHostSubscriptions(binding, next.handles);
14606
+ });
14607
+ }
14608
+ };
14609
+ });
14610
+ }
14611
+ function bindSignalHostPropSources(scope, previous, element, sources, site, hasNestedChildren = false, readStyle) {
14612
+ let binding = typeof previous === "object" && previous !== null && previous[SIGNAL_HOST_PROP_SOURCES] === true ? previous : void 0;
14613
+ if (binding === void 0) {
14614
+ binding = createSignalHostPropSourcesBinding(
14615
+ scope,
14616
+ element,
14617
+ sources,
14618
+ site,
14619
+ hasNestedChildren,
14620
+ readStyle
14621
+ );
14622
+ } else if (STAGED_COMMIT_CAPTURE === null) {
14623
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(binding);
14624
+ binding.sources = sources;
14625
+ }
14626
+ const committed = binding;
14627
+ if (STAGED_COMMIT_CAPTURE !== null) {
14628
+ const projections = STAGED_COMMIT_CAPTURE.signalHosts ??= /* @__PURE__ */ new Map();
14629
+ binding = projections.get(committed);
14630
+ if (binding === void 0) {
14631
+ binding = { ...committed };
14632
+ projections.set(committed, binding);
14633
+ if (isRecordingTransitionJournal()) journalUndo(() => projections.delete(committed));
14634
+ } else if (TRANSITION_JOURNAL !== null) journalObjectOnce(binding);
14635
+ binding.sources = sources;
14636
+ }
14637
+ const valueControl = winningSignalHostControl(sources, "value");
14638
+ const checkedControl = winningSignalHostControl(sources, "checked");
14639
+ const controlSnapshot = isWritableSignal(valueControl) || isWritableSignal(checkedControl) ? (0, import_event_capture.snapshotHydrationControl)(element) : null;
14640
+ if (controlSnapshot !== null) {
14641
+ validateDirectSignalControl(element, site);
14642
+ binding.pendingControl ||= activeHydration() !== null && controlSnapshot.editRevision > 0;
14643
+ }
14644
+ const next = resolveSignalHostPropSources(sources, readStyle);
14645
+ binding.resolved = setHostPropSources(
14646
+ element,
14647
+ next.sources,
14648
+ binding.resolved,
14649
+ scope,
14650
+ hasNestedChildren,
14651
+ readStyle,
14652
+ binding.pendingControl
14653
+ );
14654
+ if (STAGED_COMMIT_CAPTURE !== null) {
14655
+ DEFERRED_LAYOUT_DRIVER.stageAction(() => {
14656
+ if (committed.disposed) return;
14657
+ committed.sources = binding.sources;
14658
+ committed.resolved = binding.resolved;
14659
+ committed.pendingControl = binding.pendingControl;
14660
+ runWithBlockSignalOwner(scope, () => {
14661
+ rebindSignalHostSubscriptions(committed, next.handles);
14662
+ syncSignalHostControl(committed);
14663
+ });
14664
+ if (!committed.pendingControl && controlSnapshot !== null)
14665
+ (0, import_event_capture.consumeHydrationControl)(element, controlSnapshot.revision);
14666
+ updateSignalHostPropSources(committed);
14667
+ });
14668
+ } else {
14669
+ rebindSignalHostSubscriptions(binding, next.handles);
14670
+ syncSignalHostControl(binding);
14671
+ if (!binding.pendingControl && controlSnapshot !== null)
14672
+ (0, import_event_capture.consumeHydrationControl)(element, controlSnapshot.revision);
14673
+ }
14674
+ if (binding.pendingControl) queueSignalHostControlAdoption(committed);
14675
+ return committed;
12644
14676
  }
12645
14677
  function isAggregatedFormControlProp(el, name) {
12646
14678
  switch (el.localName) {
@@ -12695,6 +14727,8 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
12695
14727
  if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, mountScope);
12696
14728
  return;
12697
14729
  }
14730
+ const hydration = prev === void 0 ? activeHydration() : null;
14731
+ const initialHydration = hydration !== null && !hydration.isFresh(el);
12698
14732
  for (const k of Object.keys(Object(value))) {
12699
14733
  if (k === "key" || k === "children") continue;
12700
14734
  if (skipDangerouslySetInnerHTML && k === "dangerouslySetInnerHTML") continue;
@@ -12710,7 +14744,7 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
12710
14744
  if (k === "suppressHydrationWarning" || k === "suppressNativeChangeWarning" || k === "__octaneNativeChangeDiagnostic")
12711
14745
  continue;
12712
14746
  if (k === "class" || k === "className") {
12713
- if (v === pv) continue;
14747
+ if (v === pv && !initialHydration) continue;
12714
14748
  setClassAttr(el, v);
12715
14749
  continue;
12716
14750
  }
@@ -12724,7 +14758,7 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
12724
14758
  }
12725
14759
  const actionName = formActionAttributeName(el, k);
12726
14760
  if (actionName !== null) {
12727
- if (v === pv) continue;
14761
+ if (v === pv && !initialHydration) continue;
12728
14762
  setFormAction(
12729
14763
  el,
12730
14764
  actionName,
@@ -12733,9 +14767,10 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
12733
14767
  );
12734
14768
  continue;
12735
14769
  }
12736
- if (v === pv && !isControlledHostProp(el, k)) continue;
14770
+ if (v === pv && !isControlledHostProp(el, k) && !initialHydration) continue;
12737
14771
  const ev = eventSlot(k, el);
12738
14772
  if (ev) {
14773
+ if (v === pv) continue;
12739
14774
  if (ev.capture) {
12740
14775
  if (!_delegatedCapture.has(ev.type)) delegateCaptureEvents([ev.type]);
12741
14776
  } else if (!_delegated.has(ev.type)) {
@@ -13010,6 +15045,7 @@ function isUsableEventSlot(slot) {
13010
15045
  return typeof slot === "function" || isHandlerBundle(slot);
13011
15046
  }
13012
15047
  const EMPTY_ARGS = [];
15048
+ let SIGNAL_EVENT_OWNERS = null;
13013
15049
  function setEventHandler(el, key, handler) {
13014
15050
  if (TRANSITION_JOURNAL !== null) {
13015
15051
  TRANSITION_JOURNAL.push(
@@ -13021,6 +15057,18 @@ function setEventHandler(el, key, handler) {
13021
15057
  journalBag();
13022
15058
  }
13023
15059
  (STAGED_DOM?.view(el) ?? el)[key] = handler;
15060
+ if (SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled) {
15061
+ const owner = (import_owner_context.activeSynchronousSignalOwner !== null || import_owner_context.activeSignalOwnerEnvironment !== void 0 ? (0, import_owner_context.currentExplicitSignalOwner)() : null) ?? (import_document_owner.signalDocumentEnabled || CURRENT_SCOPE?.block.idState.renderOwner?.signalOwner !== void 0 ? CURRENT_SCOPE === null ? (0, import_owner_context.currentSignalOwner)() : SCOPE_SIGNAL_OWNERS.get(CURRENT_SCOPE) || CURRENT_SCOPE : CURRENT_SCOPE);
15062
+ if (owner !== null) {
15063
+ if ((owner instanceof ScopeImpl || owner instanceof BlockImpl) && SCOPE_SIGNAL_OWNERS.get(owner) === void 0)
15064
+ SCOPE_SIGNAL_OWNERS.set(owner, false);
15065
+ if (STAGED_COMMIT_CAPTURE !== null)
15066
+ DEFERRED_LAYOUT_DRIVER.stageAction(
15067
+ () => (SIGNAL_EVENT_OWNERS ??= /* @__PURE__ */ new WeakMap()).set(el, owner)
15068
+ );
15069
+ else (SIGNAL_EVENT_OWNERS ??= /* @__PURE__ */ new WeakMap()).set(el, owner);
15070
+ }
15071
+ }
13024
15072
  }
13025
15073
  function evt0(el, key, fn) {
13026
15074
  const d = { fn, args: EMPTY_ARGS, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND };
@@ -13118,11 +15166,13 @@ function isEventRoot(node, epoch) {
13118
15166
  }
13119
15167
  function prepareDelegatedEvent(event, listener) {
13120
15168
  if (_delegationTargets.size === 1 && portalEventTargetCount === 0) {
15169
+ (0, import_dom_binding_handoff.beginBindingEvent)(event);
13121
15170
  event[EVENT_ROOT_EPOCH] = eventRootEpoch;
13122
15171
  return;
13123
15172
  }
13124
15173
  const path = event.composedPath();
13125
15174
  if (_delegationTargets.size === 1) {
15175
+ (0, import_dom_binding_handoff.beginBindingEvent)(event);
13126
15176
  event[EVENT_ROOT_EPOCH] = eventRootEpoch;
13127
15177
  if (portalEventTargetCount !== 0) {
13128
15178
  preparePortalEventOwners(path, eventRootEpoch);
@@ -13133,6 +15183,7 @@ function prepareDelegatedEvent(event, listener) {
13133
15183
  for (let i = path.length - 1; i >= 0; i--) {
13134
15184
  if (_delegationTargets.has(path[i])) {
13135
15185
  if (path[i] === listener) {
15186
+ (0, import_dom_binding_handoff.beginBindingEvent)(event);
13136
15187
  event[EVENT_ROOT_EPOCH] = eventRootEpoch;
13137
15188
  if (portalEventTargetCount !== 0) {
13138
15189
  preparePortalEventOwners(path, eventRootEpoch);
@@ -13611,12 +15662,12 @@ function buildDelegatedPath(event, listener, path = event.composedPath()) {
13611
15662
  rebaseRootAtStart = true;
13612
15663
  }
13613
15664
  }
13614
- function fireEventSlot(slot, event) {
15665
+ function fireEventSlot(slot, event, currentTarget) {
13615
15666
  const previousScope = CURRENT_SCOPE;
13616
15667
  const previousBlock = CURRENT_BLOCK;
13617
15668
  CURRENT_SCOPE = null;
13618
15669
  CURRENT_BLOCK = null;
13619
- try {
15670
+ const invoke = () => {
13620
15671
  if (typeof slot === "function") {
13621
15672
  slot(event);
13622
15673
  return;
@@ -13654,6 +15705,12 @@ function fireEventSlot(slot, event) {
13654
15705
  return;
13655
15706
  }
13656
15707
  invokeInvalidEventListener(`${event.type} event`, slot, event);
15708
+ };
15709
+ try {
15710
+ const recorded = SIGNAL_EVENT_OWNERS?.get(currentTarget);
15711
+ const owner = recorded instanceof ScopeImpl || recorded instanceof BlockImpl ? scopeSignalOwner(recorded) : recorded;
15712
+ if (owner === void 0 || (0, import_owner_context.currentSignalOwner)() === owner) invoke();
15713
+ else (0, import_owner_context.runWithSignalOwner)(owner, invoke);
13657
15714
  } catch (err) {
13658
15715
  reportListenerError(err);
13659
15716
  } finally {
@@ -13752,9 +15809,9 @@ function dispatchDelegated(event) {
13752
15809
  const current = CAPTURE_PATH[i];
13753
15810
  if (targetOnly && current !== event.target) break;
13754
15811
  const slot = CAPTURE_SLOTS[i];
13755
- if (slot != null) {
15812
+ if (slot != null && !(0, import_dom_binding_handoff.consumeBindingEvent)(event, current, false)) {
13756
15813
  setCurrentTarget(event, current, frame);
13757
- fireEventSlot(slot, event);
15814
+ fireEventSlot(slot, event, current);
13758
15815
  if ((frame.flags & 1) !== 0) break;
13759
15816
  }
13760
15817
  if (targetOnly) break;
@@ -13799,9 +15856,9 @@ function dispatchDelegatedCapture(event, path, type = _delegated.get(event.type)
13799
15856
  frame = beginDelegatedPropagation(event, stop, immediate);
13800
15857
  for (let i = CAPTURE_PATH.length - 1; i >= pathBase; i--) {
13801
15858
  const slot = CAPTURE_SLOTS[i];
13802
- if (slot != null) {
15859
+ if (slot != null && !(0, import_dom_binding_handoff.consumeBindingEvent)(event, CAPTURE_PATH[i], true)) {
13803
15860
  setCurrentTarget(event, CAPTURE_PATH[i], frame);
13804
- fireEventSlot(slot, event);
15861
+ fireEventSlot(slot, event, CAPTURE_PATH[i]);
13805
15862
  if ((frame.flags & 1) !== 0) break;
13806
15863
  }
13807
15864
  }
@@ -14649,7 +16706,7 @@ function formDiagnosticOutcome(el) {
14649
16706
  const ctrl = host.$$ctrl;
14650
16707
  if (isTextEntry(el)) {
14651
16708
  const controlled = ctrl !== void 0 && ctrl.v !== UNCONTROLLED;
14652
- if (hasInput) return null;
16709
+ if (hasInput || (0, import_early_values.hasHydrationControlSignalWriter)(el, "value")) return null;
14653
16710
  if (hasChange) {
14654
16711
  const dev = getDevFormDiagnosticState(el);
14655
16712
  if (host.__oct_native_change_suppressed === true || dev?.staticNativeChange === true)
@@ -14667,7 +16724,8 @@ function formDiagnosticOutcome(el) {
14667
16724
  };
14668
16725
  }
14669
16726
  if (el.localName === "select") {
14670
- if (ctrl === void 0 || ctrl.sv === null || hasInput || hasChange) return null;
16727
+ if (ctrl === void 0 || ctrl.sv === null || hasInput || hasChange || (0, import_early_values.hasHydrationControlSignalWriter)(el, "value"))
16728
+ return null;
14671
16729
  return {
14672
16730
  signature: "controlled-select-missing",
14673
16731
  message: "You provided a `value` prop to a select without an `onInput` or `onChange` handler. This will render a read-only field. Set a usable native handler, `readOnly`, or use `defaultValue` for an uncontrolled field."
@@ -14677,25 +16735,33 @@ function formDiagnosticOutcome(el) {
14677
16735
  const checkable = input.localName === "input" && ((STAGED_DOM?.view(input) ?? input).type === "checkbox" || (STAGED_DOM?.view(input) ?? input).type === "radio");
14678
16736
  if (!checkable || ctrl === void 0 || ctrl.c === -1) return null;
14679
16737
  const hasClick = isUsableEventSlot(host.$$click) || isUsableEventSlot(host["$$capture:click"]);
14680
- if (hasClick || hasInput || hasChange) return null;
16738
+ if (hasClick || hasInput || hasChange || (0, import_early_values.hasHydrationControlSignalWriter)(el, "checked"))
16739
+ return null;
14681
16740
  return {
14682
16741
  signature: `controlled-checkable-missing:${(STAGED_DOM?.view(input) ?? input).type}`,
14683
16742
  message: "You provided a `checked` prop to a checkbox or radio without an `onClick`, `onInput`, or `onChange` handler. This will render a read-only field. Set a usable native handler, `readOnly`, or use `defaultChecked` for an uncontrolled field."
14684
16743
  };
14685
16744
  }
14686
- function drainDevFormDiagnostics() {
16745
+ function drainDevFormDiagnostics(target) {
14687
16746
  if (process.env.NODE_ENV === "production") return;
14688
- const q = DEV_FORM_CHECKS;
16747
+ let q = DEV_FORM_CHECKS;
14689
16748
  if (q === null || q.length === 0) return;
14690
- DEV_FORM_CHECKS = [];
14691
- DEV_FORM_CHECK_GENERATION++;
16749
+ if (target !== void 0) {
16750
+ const index = q.indexOf(target);
16751
+ if (index < 0) return;
16752
+ q.splice(index, 1);
16753
+ delete target[DEV_FORM_CHECK_MARK];
16754
+ q = [target];
16755
+ } else DEV_FORM_CHECKS = [];
16756
+ if (target === void 0) DEV_FORM_CHECK_GENERATION++;
14692
16757
  for (let i = 0; i < q.length; i++) {
14693
16758
  const el = q[i];
14694
16759
  const authoring = getDevFormDiagnosticState(el);
14695
16760
  if (authoring !== void 0) {
14696
16761
  let props = authoring.authoringProps;
14697
16762
  if (authoring.authoringSelected !== void 0) {
14698
- (props ??= /* @__PURE__ */ Object.create(null)).selected = authoring.authoringSelected();
16763
+ const selected = authoring.authoringSelected();
16764
+ (props ??= /* @__PURE__ */ Object.create(null)).selected = typeof selected === "object" && selected !== null && selected[DIRECT_SIGNAL_BINDING] === true ? selected.value : selected;
14699
16765
  }
14700
16766
  const action = el.$$formAction;
14701
16767
  if (typeof action === "function") {
@@ -15322,8 +17388,9 @@ function copyScopedElementConfig(type, config, resolve) {
15322
17388
  SCOPED_ELEMENT_PROPS.add(props);
15323
17389
  return props;
15324
17390
  }
15325
- function scopedElementRecord(type, props, key, ref, resolve) {
17391
+ function scopedElementRecord(type, props, key, ref, resolve, invocationSite) {
15326
17392
  const descriptor = { $$kind: ELEMENT_TAG, type, props, key, ref };
17393
+ if (invocationSite !== void 0) descriptor.__octaneInvocationSite = invocationSite;
15327
17394
  Object.defineProperty(descriptor, SCOPED_CHILDREN_RESOLVER, { value: resolve });
15328
17395
  Object.defineProperty(descriptor, "children", SCOPED_CHILDREN_PROPERTY);
15329
17396
  return descriptor;
@@ -15356,12 +17423,20 @@ function scopedValueRef() {
15356
17423
  function scopedValueChildren() {
15357
17424
  return this[SCOPED_VALUE_RECORD]().children;
15358
17425
  }
17426
+ function scopedValueInvocationSite() {
17427
+ return this[SCOPED_VALUE_RECORD]().__octaneInvocationSite;
17428
+ }
15359
17429
  const SCOPED_VALUE_PROPERTIES = {
15360
17430
  type: { configurable: true, enumerable: true, get: scopedValueType },
15361
17431
  props: { configurable: true, enumerable: true, get: scopedValueProps },
15362
17432
  key: { configurable: true, enumerable: true, get: scopedValueKey },
15363
17433
  ref: { configurable: true, enumerable: true, get: scopedValueRef },
15364
- children: { configurable: true, enumerable: true, get: scopedValueChildren }
17434
+ children: { configurable: true, enumerable: true, get: scopedValueChildren },
17435
+ __octaneInvocationSite: {
17436
+ configurable: true,
17437
+ enumerable: true,
17438
+ get: scopedValueInvocationSite
17439
+ }
15365
17440
  };
15366
17441
  function createScopedValue(readElement) {
15367
17442
  return scopedValueDescriptor(createScopedResolver(readElement));
@@ -15377,16 +17452,26 @@ function scopedValueDescriptor(resolve) {
15377
17452
  Object.defineProperty(descriptor, "key", SCOPED_VALUE_PROPERTIES.key);
15378
17453
  Object.defineProperty(descriptor, "ref", SCOPED_VALUE_PROPERTIES.ref);
15379
17454
  Object.defineProperty(descriptor, "children", SCOPED_VALUE_PROPERTIES.children);
17455
+ Object.defineProperty(
17456
+ descriptor,
17457
+ "__octaneInvocationSite",
17458
+ SCOPED_VALUE_PROPERTIES.__octaneInvocationSite
17459
+ );
15380
17460
  if (process.env.NODE_ENV !== "production") Object.freeze(descriptor);
15381
17461
  return descriptor;
15382
17462
  }
15383
- function createScopedElement(type, props, readChildren) {
15384
- return scopedElementDescriptor(type, props, createScopedResolver(readChildren));
17463
+ function createScopedElement(type, props, readChildren, invocationSite) {
17464
+ return scopedElementDescriptor(type, props, createScopedResolver(readChildren), invocationSite);
15385
17465
  }
15386
- function nativeCreateScopedElement(type, props, readChildren) {
15387
- return scopedElementDescriptor(type, props, createNativeScopedResolver(readChildren));
17466
+ function nativeCreateScopedElement(type, props, readChildren, invocationSite) {
17467
+ return scopedElementDescriptor(
17468
+ type,
17469
+ props,
17470
+ createNativeScopedResolver(readChildren),
17471
+ invocationSite
17472
+ );
15388
17473
  }
15389
- function scopedElementDescriptor(type, props, children) {
17474
+ function scopedElementDescriptor(type, props, children, invocationSite) {
15390
17475
  const src = props ?? null;
15391
17476
  const hasKey = hasElementConfigKey(src);
15392
17477
  const key = hasKey ? "" + src.key : null;
@@ -15396,7 +17481,8 @@ function scopedElementDescriptor(type, props, children) {
15396
17481
  copiedProps,
15397
17482
  key,
15398
17483
  copiedProps.ref !== void 0 ? copiedProps.ref : null,
15399
- children
17484
+ children,
17485
+ invocationSite
15400
17486
  );
15401
17487
  if (key === null && src != null && (typeof src === "object" || typeof src === "function") && "key" in src) {
15402
17488
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
@@ -15404,6 +17490,12 @@ function scopedElementDescriptor(type, props, children) {
15404
17490
  return finalizeElementDescriptor(descriptor);
15405
17491
  }
15406
17492
  function createElement(type, props, ...children) {
17493
+ return createElementFromConfig(void 0, type, props, children);
17494
+ }
17495
+ function createElementAt(invocationSite, type, props, ...children) {
17496
+ return createElementFromConfig(invocationSite, type, props, children);
17497
+ }
17498
+ function createElementFromConfig(invocationSite, type, props, children = EMPTY_ARGS) {
15407
17499
  if (typeof type === "function" && (0, import_renderer_bridge.isRendererContext)(type)) {
15408
17500
  (0, import_renderer_bridge.registerClientRendererBridge)(renderClientContextProvider, flushSync);
15409
17501
  }
@@ -15428,6 +17520,7 @@ function createElement(type, props, ...children) {
15428
17520
  ref: p.ref !== void 0 ? p.ref : null,
15429
17521
  children: kids ?? null
15430
17522
  };
17523
+ if (invocationSite !== void 0) descriptor.__octaneInvocationSite = invocationSite;
15431
17524
  if (key === null && src != null && (typeof src === "object" || typeof src === "function") && "key" in src) {
15432
17525
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
15433
17526
  }
@@ -15507,7 +17600,14 @@ function cloneElement(element, config, ...children) {
15507
17600
  const ref = props.ref !== void 0 ? props.ref : null;
15508
17601
  let descriptor;
15509
17602
  if (keepsScopedChildren && copiedGetter === void 0) {
15510
- descriptor = scopedElementRecord(element.type, props, key, ref, scopedChildren);
17603
+ descriptor = scopedElementRecord(
17604
+ element.type,
17605
+ props,
17606
+ key,
17607
+ ref,
17608
+ scopedChildren,
17609
+ element.__octaneInvocationSite
17610
+ );
15511
17611
  } else {
15512
17612
  descriptor = {
15513
17613
  $$kind: ELEMENT_TAG,
@@ -15517,6 +17617,8 @@ function cloneElement(element, config, ...children) {
15517
17617
  ref,
15518
17618
  children: kids ?? null
15519
17619
  };
17620
+ if (element.__octaneInvocationSite !== void 0)
17621
+ descriptor.__octaneInvocationSite = element.__octaneInvocationSite;
15520
17622
  if (keepsScopedChildren) {
15521
17623
  Object.defineProperty(descriptor, "children", {
15522
17624
  configurable: true,
@@ -15544,7 +17646,8 @@ function cloneAndReplaceElementKey(element, key) {
15544
17646
  element.props,
15545
17647
  key,
15546
17648
  element.ref,
15547
- element[SCOPED_CHILDREN_RESOLVER]
17649
+ element[SCOPED_CHILDREN_RESOLVER],
17650
+ element.__octaneInvocationSite
15548
17651
  );
15549
17652
  } else {
15550
17653
  const copiedGetter = get === SCOPED_VALUE_PROPERTIES.children.get ? () => get.call(element) : get;
@@ -15556,6 +17659,8 @@ function cloneAndReplaceElementKey(element, key) {
15556
17659
  ref: element.ref,
15557
17660
  children: null
15558
17661
  };
17662
+ if (element.__octaneInvocationSite !== void 0)
17663
+ descriptor.__octaneInvocationSite = element.__octaneInvocationSite;
15559
17664
  Object.defineProperty(descriptor, "children", {
15560
17665
  configurable: true,
15561
17666
  enumerable: true,
@@ -15571,6 +17676,8 @@ function cloneAndReplaceElementKey(element, key) {
15571
17676
  ref: element.ref,
15572
17677
  children: element.children
15573
17678
  };
17679
+ if (element.__octaneInvocationSite !== void 0)
17680
+ descriptor.__octaneInvocationSite = element.__octaneInvocationSite;
15574
17681
  }
15575
17682
  if (ELEMENTS_MISSING_LIST_KEY.has(element)) ELEMENTS_MISSING_LIST_KEY.add(descriptor);
15576
17683
  return finalizeElementDescriptor(descriptor);
@@ -15715,7 +17822,7 @@ const Children = {
15715
17822
  }
15716
17823
  };
15717
17824
  const NO_KEY = /* @__PURE__ */ Symbol("NO_KEY");
15718
- function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey) {
17825
+ function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
15719
17826
  const dispatch = activityDescriptorDispatch;
15720
17827
  const activity = dispatch !== null && comp === dispatch.type;
15721
17828
  if (!activity && typeof comp !== "function" && typeof comp !== "string") {
@@ -15751,10 +17858,11 @@ function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key
15751
17858
  key,
15752
17859
  singleRoot,
15753
17860
  inherit,
15754
- hasKey
17861
+ hasKey,
17862
+ invocationSite
15755
17863
  );
15756
17864
  }
15757
- function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey) {
17865
+ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
15758
17866
  if (typeof comp !== "function") throw invalidElementTypeError(comp);
15759
17867
  componentSlotImpl(
15760
17868
  null,
@@ -15769,10 +17877,11 @@ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor,
15769
17877
  key,
15770
17878
  singleRoot,
15771
17879
  inherit,
15772
- hasKey
17880
+ hasKey,
17881
+ invocationSite
15773
17882
  );
15774
17883
  }
15775
- function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body, identity, props, renderProps, anchor, key, singleRoot, inherit, hasKey) {
17884
+ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body, identity, props, renderProps, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
15776
17885
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
15777
17886
  const parentBlock = parentScope.block;
15778
17887
  const hydration = activeHydration();
@@ -15791,7 +17900,8 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15791
17900
  key,
15792
17901
  singleRoot,
15793
17902
  inherit,
15794
- hasKey
17903
+ hasKey,
17904
+ invocationSite
15795
17905
  )
15796
17906
  );
15797
17907
  return;
@@ -15923,6 +18033,15 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15923
18033
  journalRootProperty(state, "prevKey", state.prevKey);
15924
18034
  state.prevKey = nextKey;
15925
18035
  if (replacing) {
18036
+ const signalInstanceKey = SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled ? { parentScope, invocationSite, key, hasKey: key != null } : void 0;
18037
+ const retryLocation = state.block === null || !state.block.mounted || parentBlock.idState.renderOwner?.signalOwner === void 0 ? void 0 : {
18038
+ parent: parentScope,
18039
+ slot: slotKey,
18040
+ kind: state.__kind,
18041
+ branch: void 0,
18042
+ component: identity,
18043
+ key: nextKey
18044
+ };
15926
18045
  const swapDriver = TRANSITION_SWAP_DRIVER;
15927
18046
  const transitionMode = parentBlock.currentRenderMode === "transition";
15928
18047
  const canSwapOffscreen = swapDriver !== null && state.block !== null && state.block.mounted && hydration === null;
@@ -15947,7 +18066,12 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15947
18066
  stageAfter,
15948
18067
  body,
15949
18068
  renderProps,
15950
- outputHandler
18069
+ outputHandler,
18070
+ "dynamic",
18071
+ void 0,
18072
+ false,
18073
+ signalInstanceKey,
18074
+ retryLocation
15951
18075
  );
15952
18076
  if (r.suspended || r.failed) {
15953
18077
  disposeWip(r.wip);
@@ -15978,7 +18102,12 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15978
18102
  state.end,
15979
18103
  body,
15980
18104
  renderProps,
15981
- outputHandler
18105
+ outputHandler,
18106
+ "dynamic",
18107
+ void 0,
18108
+ false,
18109
+ signalInstanceKey,
18110
+ retryLocation
15982
18111
  );
15983
18112
  if (r.suspended || r.failed) {
15984
18113
  transitionSwap.dispose(r.wip);
@@ -16005,7 +18134,12 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
16005
18134
  probeAfter,
16006
18135
  body,
16007
18136
  renderProps,
16008
- outputHandler
18137
+ outputHandler,
18138
+ "dynamic",
18139
+ void 0,
18140
+ false,
18141
+ signalInstanceKey,
18142
+ retryLocation
16009
18143
  );
16010
18144
  transitionSwap.dispose(r.wip);
16011
18145
  if (r.failed) throw r.error;
@@ -16049,6 +18183,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
16049
18183
  void 0,
16050
18184
  outputHandler
16051
18185
  );
18186
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b, signalInstanceKey);
16052
18187
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && typeof identity === "function")
16053
18188
  profileTrackComponent(b, identity);
16054
18189
  state.block = b;
@@ -16078,6 +18213,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
16078
18213
  void 0,
16079
18214
  outputHandler
16080
18215
  );
18216
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b, signalInstanceKey);
16081
18217
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && typeof identity === "function")
16082
18218
  profileTrackComponent(b, identity);
16083
18219
  if (state.inherited) b.exclusiveMarkers = true;
@@ -16097,7 +18233,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
16097
18233
  function coerceChildText(v) {
16098
18234
  return v == null || v === false || v === true ? "" : String(v);
16099
18235
  }
16100
- function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputHandler, kind = "dynamic", env, implicitBail = false) {
18236
+ function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputHandler, kind = "dynamic", env, implicitBail = false, signalInstanceKey, retryLocation) {
16101
18237
  const start = (STAGED_DOM?.view(document) ?? document).createComment("wip");
16102
18238
  const end = (STAGED_DOM?.view(document) ?? document).createComment("/wip");
16103
18239
  const ref = getNextSibling(afterNode);
@@ -16118,6 +18254,8 @@ function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputH
16118
18254
  env,
16119
18255
  outputHandler
16120
18256
  );
18257
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(block, signalInstanceKey);
18258
+ if (retryLocation !== void 0) SIGNAL_RETRY_LOCATIONS.set(block, retryLocation);
16121
18259
  if (implicitBail) {
16122
18260
  block.$$implicitBail = true;
16123
18261
  block.memoInChain = true;
@@ -16138,15 +18276,32 @@ function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputH
16138
18276
  } finally {
16139
18277
  WIP_CAPTURE = prev;
16140
18278
  }
18279
+ const wip = { block, start, end, capture, domParent, refDetachCheckpoint };
18280
+ if (suspended !== null && retryLocation !== void 0) {
18281
+ const owner = parentBlock.idState.renderOwner;
18282
+ const boundary = signalRetryBoundary(parentBlock);
18283
+ const retryRoot = boundary?.tryBlock ?? owner?.current;
18284
+ const holder = boundary ?? owner;
18285
+ if (holder !== void 0 && retryRoot != null) {
18286
+ retainSignalRetryScope(block, retryRoot, holder, true);
18287
+ for (const created of ROOT_RENDER_TRANSACTION?.created ?? [])
18288
+ if (!created.disposed && blockIsAncestorOf(block, created))
18289
+ retainSignalRetryScope(created, retryRoot, holder);
18290
+ wip.retrySignalOwners = holder.retrySignalOwners;
18291
+ }
18292
+ }
16141
18293
  return {
16142
- wip: { block, start, end, capture, domParent, refDetachCheckpoint },
18294
+ wip,
16143
18295
  suspended,
16144
18296
  error,
16145
18297
  failed
16146
18298
  };
16147
18299
  }
16148
- function spliceOffscreenCapture(capture) {
16149
- NATIVE_READ_DRIVER?.spliceCapture(capture, WIP_CAPTURE);
18300
+ function spliceOffscreenCapture(capture, deferredNativeAcceptance = false) {
18301
+ if (capture.presentations !== void 0 && WIP_CAPTURE !== null)
18302
+ (WIP_CAPTURE.presentations ??= []).push(...capture.presentations);
18303
+ if (WIP_CAPTURE !== null || !deferredNativeAcceptance)
18304
+ NATIVE_READ_DRIVER?.spliceCapture(capture, WIP_CAPTURE);
16150
18305
  const rendered = capture.renderedBlocks;
16151
18306
  capture.renderedBlocks = null;
16152
18307
  capture.renderRoot = null;
@@ -16226,10 +18381,13 @@ function commitOffscreen(wip, beforeNode) {
16226
18381
  }
16227
18382
  function disposeWip(wip) {
16228
18383
  const previousCapture = WIP_CAPTURE;
18384
+ const previousRetained = RETAINED_SIGNAL_OWNERS;
18385
+ if (wip.retrySignalOwners !== void 0) RETAINED_SIGNAL_OWNERS = wip.retrySignalOwners;
16229
18386
  WIP_CAPTURE = wip.capture;
16230
18387
  try {
16231
18388
  unmountBlock(wip.block, true);
16232
18389
  } finally {
18390
+ RETAINED_SIGNAL_OWNERS = previousRetained;
16233
18391
  WIP_CAPTURE = previousCapture;
16234
18392
  refDetachQueue.splice(wip.refDetachCheckpoint);
16235
18393
  discardOffscreenCapture(wip.capture);
@@ -17189,7 +19347,9 @@ function mappedDeoptItemBody(item, scope) {
17189
19347
  block.endMarker,
17190
19348
  void 0,
17191
19349
  true,
17192
- true
19350
+ true,
19351
+ void 0,
19352
+ item.__octaneInvocationSite
17193
19353
  );
17194
19354
  return;
17195
19355
  }
@@ -17846,8 +20006,151 @@ function renderPreparedChildList(state, parentBlock, domParent, preparedList, hy
17846
20006
  }
17847
20007
  return;
17848
20008
  }
17849
- function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable, includeKeyedSingle = true, compiledMapBody, compiledMapKey, compiledMapFlags, compiledMapDeps, mappedFallback) {
20009
+ const DIRECT_SIGNAL_CHILD = /* @__PURE__ */ Symbol("octane.direct-signal-child");
20010
+ let IMPLICIT_SIGNAL_CHILD_DEPTH = 0;
20011
+ function disposeDirectSignalChild(binding) {
20012
+ if (binding.disposed) return;
20013
+ binding.disposed = true;
20014
+ binding.unsubscribe?.();
20015
+ retireNativeTransitionBlock(binding.scope.block);
20016
+ }
20017
+ function updateDirectSignalChild(binding) {
20018
+ if (binding.disposed || binding.scope.block.disposed) return;
20019
+ try {
20020
+ runWithBlockSignalOwner(binding.scope, () => {
20021
+ const value = readSignalBinding(binding.handle);
20022
+ if (Object.is(binding.value, value)) return;
20023
+ const state = binding.scope.slots[binding.slotKey];
20024
+ const type = typeof value;
20025
+ const primitive = value == null || type !== "object" && type !== "function";
20026
+ const text = primitive ? coerceChildText(value) : null;
20027
+ if (state === void 0 && binding.text != null && text !== null && text !== "") {
20028
+ setText(binding.text, text);
20029
+ binding.value = value;
20030
+ return;
20031
+ }
20032
+ if (state === binding.state && state?.block === null && state.forSlot === null && state.hostNode === null && state.portal === null && text !== null && text !== "" && state.text !== null) {
20033
+ setText(state.text, text);
20034
+ binding.value = value;
20035
+ return;
20036
+ }
20037
+ scheduleRender(binding.scope.block);
20038
+ });
20039
+ } catch {
20040
+ scheduleRender(binding.scope.block);
20041
+ }
20042
+ }
20043
+ function bindSignalChild(parentScope, previous, slotKey, domParent, value, _site, anchor, ownEnd, ownsHost, compactable, onlyChild, bindingMarker) {
20044
+ const prior = typeof previous === "object" && previous !== null && previous[DIRECT_SIGNAL_CHILD] === true ? previous : null;
20045
+ const cachedText = prior?.text ?? (previous instanceof Text ? previous : null);
20046
+ if (!isSignalHandle(value)) {
20047
+ const text2 = onlyChild ? childTextHole(parentScope, slotKey, domParent, value, cachedText) : (bindingMarker === void 0 ? childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable) : bindingChildSlot(parentScope, slotKey, domParent, value, bindingMarker, anchor, ownEnd), null);
20048
+ if (prior !== null) {
20049
+ if (TRANSITION_JOURNAL !== null) journalBag();
20050
+ const finish = (discarded) => {
20051
+ if (!discarded) disposeDirectSignalChild(prior);
20052
+ };
20053
+ if (WIP_CAPTURE === null) finish(false);
20054
+ else (WIP_CAPTURE.renderCleanups ??= []).push(finish);
20055
+ }
20056
+ return text2;
20057
+ }
20058
+ if (prior !== null && !prior.disposed && prior.handle === value) {
20059
+ const next = readSignalBinding(value);
20060
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(prior);
20061
+ if (onlyChild) prior.text = childTextHole(parentScope, slotKey, domParent, next, cachedText);
20062
+ else if (bindingMarker !== void 0)
20063
+ bindingChildSlot(parentScope, slotKey, domParent, next, bindingMarker, anchor, ownEnd);
20064
+ else childSlot(parentScope, slotKey, domParent, next, anchor, ownEnd, ownsHost, compactable);
20065
+ prior.value = next;
20066
+ prior.state = parentScope.slots[slotKey];
20067
+ return prior;
20068
+ }
20069
+ const initial = readSignalBinding(value);
20070
+ const text = onlyChild ? childTextHole(parentScope, slotKey, domParent, initial, cachedText) : (bindingMarker === void 0 ? childSlot(parentScope, slotKey, domParent, initial, anchor, ownEnd, ownsHost, compactable) : bindingChildSlot(parentScope, slotKey, domParent, initial, bindingMarker, anchor, ownEnd), null);
20071
+ if (TRANSITION_JOURNAL !== null) journalBag();
20072
+ const binding = {
20073
+ [DIRECT_SIGNAL_CHILD]: true,
20074
+ scope: parentScope,
20075
+ slotKey,
20076
+ handle: value,
20077
+ text,
20078
+ state: parentScope.slots[slotKey],
20079
+ value: initial,
20080
+ disposed: false
20081
+ };
20082
+ binding.unsubscribe = value[import_types.SIGNAL_BINDING_SUBSCRIBE](
20083
+ nativeTransitionBindingNotify(binding, () => updateDirectSignalChild(binding))
20084
+ );
20085
+ registerHookCleanup(parentScope, () => disposeDirectSignalChild(binding));
20086
+ if (prior !== null) {
20087
+ const finish = (discarded) => disposeDirectSignalChild(discarded ? binding : prior);
20088
+ if (WIP_CAPTURE === null) finish(false);
20089
+ else (WIP_CAPTURE.renderCleanups ??= []).push(finish);
20090
+ }
20091
+ return binding;
20092
+ }
20093
+ function bindingChildSlot(parentScope, slotKey, domParent, value, marker, anchor, ownEnd) {
20094
+ const frame = PRESENTATION_HYDRATION;
20095
+ if (frame?.revision !== void 0) {
20096
+ const start = activeHydration()?.resolveOpen(anchor ?? null, domParent) ?? null;
20097
+ const range = presentationRange(frame, start, marker, "slot");
20098
+ if (value == null ? range.slot !== void 0 || getNextSibling(start) !== range.end : range.slot === void 0 || typeof value !== "function" || value[BINDING_CHILDREN_SITE] !== range.slot)
20099
+ presentationMiss(false);
20100
+ }
20101
+ childSlot(
20102
+ parentScope,
20103
+ slotKey,
20104
+ domParent,
20105
+ value,
20106
+ anchor,
20107
+ ownEnd,
20108
+ void 0,
20109
+ false,
20110
+ true,
20111
+ void 0,
20112
+ void 0,
20113
+ void 0,
20114
+ void 0,
20115
+ void 0,
20116
+ marker
20117
+ );
20118
+ }
20119
+ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable, includeKeyedSingle = true, compiledMapBody, compiledMapKey, compiledMapFlags, compiledMapDeps, mappedFallback, bindingMarker) {
17850
20120
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
20121
+ if (IMPLICIT_SIGNAL_CHILD_DEPTH === 0) {
20122
+ const existing = parentScope.slots[slotKey];
20123
+ const previous = existing?.implicitSignal;
20124
+ if (isSignalHandle(value) || previous !== void 0) {
20125
+ if (isSignalHandle(value)) enableSignalBindings();
20126
+ IMPLICIT_SIGNAL_CHILD_DEPTH++;
20127
+ let token;
20128
+ try {
20129
+ token = runWithBlockSignalOwner(
20130
+ parentScope,
20131
+ () => bindSignalChild(
20132
+ parentScope,
20133
+ previous,
20134
+ slotKey,
20135
+ domParent,
20136
+ value,
20137
+ `runtime:${slotKey}`,
20138
+ anchor,
20139
+ ownEnd,
20140
+ ownsHost,
20141
+ compactable,
20142
+ void 0,
20143
+ bindingMarker
20144
+ )
20145
+ );
20146
+ } finally {
20147
+ IMPLICIT_SIGNAL_CHILD_DEPTH--;
20148
+ }
20149
+ const state2 = parentScope.slots[slotKey];
20150
+ if (state2 !== void 0) state2.implicitSignal = token;
20151
+ return;
20152
+ }
20153
+ }
17851
20154
  if (value != null && includeKeyedSingle && domParent.nodeType === 1 && import_constants.VOID_ELEMENTS.has(domParent.localName) && !isPortalTarget(parentScope.block, domParent)) {
17852
20155
  throw new Error((0, import_error_codes_client_generated.formatClientError)(26, domParent.localName));
17853
20156
  }
@@ -17870,7 +20173,8 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17870
20173
  compiledMapKey,
17871
20174
  compiledMapFlags,
17872
20175
  compiledMapDeps,
17873
- mappedFallback
20176
+ mappedFallback,
20177
+ bindingMarker
17874
20178
  )
17875
20179
  );
17876
20180
  return;
@@ -17931,7 +20235,8 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17931
20235
  compiledMapKey,
17932
20236
  compiledMapFlags,
17933
20237
  compiledMapDeps,
17934
- mappedFallback
20238
+ mappedFallback,
20239
+ bindingMarker
17935
20240
  );
17936
20241
  return;
17937
20242
  }
@@ -17964,6 +20269,13 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17964
20269
  hydration.claimRootRemainder(getNextSibling(end));
17965
20270
  }
17966
20271
  hydration.node = getNextSibling(start);
20272
+ } else if (bindingMarker !== void 0) {
20273
+ start = (STAGED_DOM?.view(document) ?? document).createComment(bindingMarker);
20274
+ end = ownEnd && anchor != null ? anchor : (STAGED_DOM?.view(document) ?? document).createComment(import_constants.HYDRATION_END);
20275
+ (STAGED_DOM?.view(end) ?? end).data = import_constants.HYDRATION_END;
20276
+ (STAGED_DOM?.view(domParent) ?? domParent).insertBefore(start, anchor ?? null);
20277
+ if (end !== anchor)
20278
+ (STAGED_DOM?.view(domParent) ?? domParent).insertBefore(end, anchor ?? null);
17967
20279
  } else if (ownEnd && anchor != null) {
17968
20280
  start = null;
17969
20281
  end = anchor;
@@ -17993,7 +20305,8 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17993
20305
  currentIsBodyFn: false,
17994
20306
  forSlot: null,
17995
20307
  hostNode: null,
17996
- portal: null
20308
+ portal: null,
20309
+ implicitSignal: void 0
17997
20310
  };
17998
20311
  parentScope.slots[slotKey] = state;
17999
20312
  registerSlot(parentScope, state);
@@ -18095,6 +20408,9 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18095
20408
  let comp = null;
18096
20409
  let props = {};
18097
20410
  let isBodyFn = false;
20411
+ let invocationSite;
20412
+ let componentKey;
20413
+ let componentHasKey = false;
18098
20414
  if (isHostDescriptor(value)) {
18099
20415
  if (pureHost) {
18100
20416
  if (state.block !== null || state.text !== null) clearChildContent(state);
@@ -18164,6 +20480,9 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18164
20480
  }
18165
20481
  comp = activity ? dispatch.body : value.type;
18166
20482
  props = value.props;
20483
+ invocationSite = value.__octaneInvocationSite;
20484
+ componentKey = value.key;
20485
+ componentHasKey = value.key != null;
18167
20486
  }
18168
20487
  if (comp !== null) {
18169
20488
  if (isBodyFn && state.block !== null && state.currentIsBodyFn) {
@@ -18193,6 +20512,15 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18193
20512
  renderBlock(state.block);
18194
20513
  return;
18195
20514
  }
20515
+ const signalInstanceKey = SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled ? { parentScope, invocationSite, key: componentKey, hasKey: componentHasKey } : void 0;
20516
+ const retryLocation = state.block === null && state.hostNode === null && state.text === null || parentBlock.idState.renderOwner?.signalOwner === void 0 ? void 0 : {
20517
+ parent: parentScope,
20518
+ slot: slotKey,
20519
+ kind: state.__kind,
20520
+ branch: void 0,
20521
+ component: isBodyFn ? void 0 : comp,
20522
+ key: void 0
20523
+ };
18196
20524
  const swapDriver = TRANSITION_SWAP_DRIVER;
18197
20525
  const transitionMode = parentBlock.currentRenderMode === "transition";
18198
20526
  const committedSuspense = swapDriver !== null && state.block !== null && state.block.mounted && hydration === null && preservesCommittedSuspense(parentBlock);
@@ -18210,7 +20538,12 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18210
20538
  state.end,
18211
20539
  comp,
18212
20540
  props,
18213
- renderReturnedValue
20541
+ renderReturnedValue,
20542
+ "dynamic",
20543
+ void 0,
20544
+ false,
20545
+ signalInstanceKey,
20546
+ retryLocation
18214
20547
  )
18215
20548
  ) : transitionSwap.render(
18216
20549
  parentBlock,
@@ -18218,7 +20551,12 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18218
20551
  state.end,
18219
20552
  comp,
18220
20553
  props,
18221
- renderReturnedValue
20554
+ renderReturnedValue,
20555
+ "dynamic",
20556
+ void 0,
20557
+ false,
20558
+ signalInstanceKey,
20559
+ retryLocation
18222
20560
  );
18223
20561
  if (r.suspended || r.failed) {
18224
20562
  transitionSwap.dispose(r.wip);
@@ -18255,6 +20593,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18255
20593
  void 0,
18256
20594
  renderReturnedValue
18257
20595
  );
20596
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b2, signalInstanceKey);
18258
20597
  preserveRootCreatedDom(b2);
18259
20598
  if (state.borrowed) b2.exclusiveMarkers = true;
18260
20599
  b2.$$implicitBail = true;
@@ -18286,7 +20625,9 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18286
20625
  renderReturnedValue,
18287
20626
  "dynamic",
18288
20627
  void 0,
18289
- implicitBail
20628
+ implicitBail,
20629
+ signalInstanceKey,
20630
+ retryLocation
18290
20631
  )
18291
20632
  ) : renderOffscreen(
18292
20633
  parentBlock,
@@ -18297,7 +20638,9 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18297
20638
  renderReturnedValue,
18298
20639
  "dynamic",
18299
20640
  void 0,
18300
- implicitBail
20641
+ implicitBail,
20642
+ signalInstanceKey,
20643
+ retryLocation
18301
20644
  );
18302
20645
  if (r.suspended || r.failed) {
18303
20646
  disposeWip(r.wip);
@@ -18346,6 +20689,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18346
20689
  void 0,
18347
20690
  renderReturnedValue
18348
20691
  );
20692
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b, signalInstanceKey);
18349
20693
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && comp !== hostElementBody)
18350
20694
  (0, import_profiling.__profileTrackComponent)(b, !isBodyFn || (0, import_profiling.__profileHasComponentMetadata)(comp) ? comp : null);
18351
20695
  if (state.borrowed) b.exclusiveMarkers = true;
@@ -19074,6 +21418,7 @@ function releaseHiddenText(text, restore = true) {
19074
21418
  }
19075
21419
  }
19076
21420
  function teardownTrySlot(state, detachDom) {
21421
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
19077
21422
  initialSuspenseHydrations?.delete(state);
19078
21423
  cancelSuspenseRetry(state);
19079
21424
  HIDDEN_REVEAL_ACTIONS?.delete(state);
@@ -19144,7 +21489,7 @@ function clearPassthroughTry(state) {
19144
21489
  state.tryBlock = null;
19145
21490
  }
19146
21491
  function mountPassthroughCatch(state, error, reportInline = false) {
19147
- if (error instanceof import_read_protocol.NativeAdoptionMiss) throw error;
21492
+ if (isAdoptionControl(error)) throw error;
19148
21493
  clearPassthroughTry(state);
19149
21494
  state.pendingThenable = null;
19150
21495
  setTryBranch(state, 0);
@@ -19320,7 +21665,7 @@ function errorBlock(parentScope, slotKey, domParent, tryBody, catchBody, anchor,
19320
21665
  try {
19321
21666
  renderBlock(current);
19322
21667
  } catch (error) {
19323
- if (isHostContextRequest(error) || isSuspenseException(error) || error instanceof import_read_protocol.NativeAdoptionMiss)
21668
+ if (isHostContextRequest(error) || isSuspenseException(error) || isAdoptionControl(error))
19324
21669
  throw error;
19325
21670
  switchErrorToCatch(state, error, true);
19326
21671
  }
@@ -19381,7 +21726,7 @@ function errorBlock(parentScope, slotKey, domParent, tryBody, catchBody, anchor,
19381
21726
  renderBlock(body);
19382
21727
  state.hasResolved = true;
19383
21728
  } catch (error) {
19384
- if (isHostContextRequest(error) || isSuspenseException(error) || error instanceof import_read_protocol.NativeAdoptionMiss)
21729
+ if (isHostContextRequest(error) || isSuspenseException(error) || isAdoptionControl(error))
19385
21730
  throw error;
19386
21731
  const adoptServerCatch = hydration?.isRejection(error) === true;
19387
21732
  switchErrorToCatch(
@@ -19398,7 +21743,7 @@ function errorBlock(parentScope, slotKey, domParent, tryBody, catchBody, anchor,
19398
21743
  return state.reset;
19399
21744
  }
19400
21745
  function switchErrorToCatch(state, error, reportInline = false, adoptedStart, adoptedEnd) {
19401
- if (error instanceof import_read_protocol.NativeAdoptionMiss) throw error;
21746
+ if (isAdoptionControl(error)) throw error;
19402
21747
  const frame = beginDetachedBoundaryRender(state);
19403
21748
  try {
19404
21749
  switchErrorToCatchInner(state, error, reportInline, adoptedStart, adoptedEnd);
@@ -19539,6 +21884,8 @@ function tryBlock(parentScope, slotKey, domParent, tryBody, catchBody, pendingBo
19539
21884
  registerSlot(parentScope, newState);
19540
21885
  state = newState;
19541
21886
  } else {
21887
+ if (state.retrySignalOwners !== void 0 && (state.tryBody !== tryBody || state.env !== env && depsChanged(state.env, env)))
21888
+ clearSignalRetryOwners(state);
19542
21889
  state.tryBody = tryBody;
19543
21890
  state.catchBody = catchBody;
19544
21891
  state.pendingBody = pendingBody;
@@ -19610,8 +21957,7 @@ function renderVisibleTry(state, source) {
19610
21957
  if (effectDeps !== null) restoreSubtreeEffectDeps(block, effectDeps);
19611
21958
  discardOffscreenCapture(capture);
19612
21959
  }
19613
- if (isHostContextRequest(renderError) || renderError instanceof import_read_protocol.NativeAdoptionMiss)
19614
- throw renderError;
21960
+ if (isHostContextRequest(renderError) || isAdoptionControl(renderError)) throw renderError;
19615
21961
  if (isSuspenseException(renderError)) {
19616
21962
  if (state.propagateSuspense) throw renderError;
19617
21963
  handleSuspense(state, renderError.thenable, block, journalCheckpoint, source ?? block);
@@ -19653,6 +21999,7 @@ function createTryBody(state, start, end) {
19653
21999
  return block;
19654
22000
  }
19655
22001
  function restartUncommittedTry(state) {
22002
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
19656
22003
  HIDDEN_REVEAL_ACTIONS?.delete(state);
19657
22004
  const old = state.tryBlock;
19658
22005
  const refs = [];
@@ -19773,6 +22120,8 @@ function renderInitialSuspenseHydration(state, initial) {
19773
22120
  hydration.claimRootRemainder(initial.end);
19774
22121
  hydration.protectRootAnchor(initial.end);
19775
22122
  const previousHydration = currentHydration;
22123
+ if (previousHydration?.retryPresentation !== void 0)
22124
+ hydration.retryPresentation = previousHydration.retryPresentation;
19776
22125
  const previousCapture = WIP_CAPTURE;
19777
22126
  const capture = createOffscreenCapture();
19778
22127
  currentHydration = hydration;
@@ -19800,7 +22149,19 @@ function renderInitialSuspenseHydration(state, initial) {
19800
22149
  if (isSuspenseException(error)) suspended = error.thenable;
19801
22150
  const refs = [];
19802
22151
  collectVisibleSubtreeRefs(block, refs);
19803
- withRefDetachSuppression(refs, () => unmountBlock(block, false));
22152
+ const previousRetained = RETAINED_SIGNAL_OWNERS;
22153
+ if (suspended !== null && state.parentBlock.idState.renderOwner?.signalOwner !== void 0) {
22154
+ retainSignalRetryScope(block, block, state, true);
22155
+ for (const created of ROOT_RENDER_TRANSACTION?.created ?? [])
22156
+ if (!created.disposed && blockIsAncestorOf(block, created))
22157
+ retainSignalRetryScope(created, block, state);
22158
+ RETAINED_SIGNAL_OWNERS = state.retrySignalOwners;
22159
+ } else if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
22160
+ try {
22161
+ withRefDetachSuppression(refs, () => unmountBlock(block, false));
22162
+ } finally {
22163
+ RETAINED_SIGNAL_OWNERS = previousRetained;
22164
+ }
19804
22165
  state.block = null;
19805
22166
  state.tryBlock = null;
19806
22167
  discardOffscreenCapture(capture);
@@ -19811,6 +22172,7 @@ function renderInitialSuspenseHydration(state, initial) {
19811
22172
  if (previousHydration !== null) previousHydration.node = state.end;
19812
22173
  }
19813
22174
  if (!failed) {
22175
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
19814
22176
  initialSuspenseHydrations?.delete(state);
19815
22177
  (capture.renderCleanups ??= []).push((discarded) => {
19816
22178
  if (discarded) return;
@@ -19830,7 +22192,7 @@ function renderInitialSuspenseHydration(state, initial) {
19830
22192
  return;
19831
22193
  }
19832
22194
  initialSuspenseHydrations?.delete(state);
19833
- if (failure instanceof import_read_protocol.NativeAdoptionMiss || isHostContextRequest(failure)) throw failure;
22195
+ if (isAdoptionControl(failure) || isHostContextRequest(failure)) throw failure;
19834
22196
  const adoptServerCatch = hydration.isRejection(failure);
19835
22197
  if (!adoptServerCatch) removeRange(getNextSibling(initial.start), initial.end);
19836
22198
  const outerHydration = currentHydration;
@@ -19854,6 +22216,7 @@ function renderInitialSuspenseHydration(state, initial) {
19854
22216
  }
19855
22217
  }
19856
22218
  function mountTry(state) {
22219
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
19857
22220
  cancelSuspenseRetry(state);
19858
22221
  HIDDEN_REVEAL_ACTIONS?.delete(state);
19859
22222
  const wasPending = state.branch === 2;
@@ -19972,7 +22335,7 @@ function mountTry(state) {
19972
22335
  state.hasResolved = true;
19973
22336
  if (wasPending) recordSuspenseCommit(state);
19974
22337
  } catch (err) {
19975
- if (isHostContextRequest(err) || err instanceof import_read_protocol.NativeAdoptionMiss) throw err;
22338
+ if (isHostContextRequest(err) || isAdoptionControl(err)) throw err;
19976
22339
  if (isSuspenseException(err)) {
19977
22340
  if (state.propagateSuspense) throw err;
19978
22341
  handleSuspense(state, err.thenable, b);
@@ -20089,6 +22452,10 @@ function releaseHeldTransition(state) {
20089
22452
  }
20090
22453
  }
20091
22454
  function handleSuspense(state, thenable, sourceBlock, journalCheckpoint = -1, transitionOrigin = sourceBlock) {
22455
+ if (NATIVE_TRANSITION_ATTEMPT !== null) {
22456
+ NATIVE_TRANSITION_ATTEMPT.suspensions.set(state, thenable);
22457
+ throw new SuspenseException(thenable);
22458
+ }
20092
22459
  ensureScheduledVisibilityDriver();
20093
22460
  const isTransition = sourceBlock.currentRenderMode === "transition";
20094
22461
  if (isTransition && state.hasResolved && state.branch === 1 && state.hiddenDom === null) {
@@ -20610,6 +22977,10 @@ function attemptHiddenReveal(state, scheduledMode, reason = "update") {
20610
22977
  }
20611
22978
  }
20612
22979
  function attemptHiddenRevealInner(state, scheduledMode, reason = "update") {
22980
+ if (state.nativeTransition !== void 0 && NATIVE_TRANSITION_ATTEMPT === null) {
22981
+ queueNativeTransition(state.nativeTransition);
22982
+ return;
22983
+ }
20613
22984
  const retryOnly = reason === "retry";
20614
22985
  let tryBlock2 = state.tryBlock;
20615
22986
  if (tryBlock2 === null || tryBlock2.disposed || state.hiddenDom === null) return;
@@ -20671,6 +23042,7 @@ function attemptHiddenRevealInner(state, scheduledMode, reason = "update") {
20671
23042
  if (didThrow) {
20672
23043
  restoreSubtreeEffectDeps(tryBlock2, effectDeps);
20673
23044
  discardOffscreenCapture(hiddenCapture);
23045
+ if (NATIVE_TRANSITION_ATTEMPT !== null) throw thrown;
20674
23046
  if (isSuspenseException(thrown)) {
20675
23047
  deactivateScope(tryBlock2, false);
20676
23048
  hideTryBlock(state);
@@ -20882,6 +23254,7 @@ function startTransition(fn) {
20882
23254
  }
20883
23255
  function runTransition(fn, hook) {
20884
23256
  ensureTransitionSwapDriver();
23257
+ ensureNativeActionResolver();
20885
23258
  TRANSITION_DEPTH++;
20886
23259
  const parentActionBatch = ACTIVE_TRANSITION_ACTION_BATCH;
20887
23260
  const pendingActionBatch = IN_FLIGHT_TRANSITION_ACTION_BATCH;
@@ -20898,7 +23271,18 @@ function runTransition(fn, hook) {
20898
23271
  try {
20899
23272
  tickTransitionCount(1);
20900
23273
  try {
20901
- result = fn();
23274
+ const previousCandidate = import_transition_state.activeCandidate;
23275
+ const nativeResolver = (0, import_read_protocol.setNativeCandidateResolver)(() => {
23276
+ const candidate = nativeCandidateForAction(actionBatch);
23277
+ (0, import_transition_state.swapActiveSignalCandidate)(candidate);
23278
+ return candidate;
23279
+ });
23280
+ try {
23281
+ result = fn();
23282
+ } finally {
23283
+ (0, import_transition_state.swapActiveSignalCandidate)(previousCandidate);
23284
+ (0, import_read_protocol.setNativeCandidateResolver)(nativeResolver);
23285
+ }
20902
23286
  if (result != null && typeof result.then === "function") {
20903
23287
  actionBatch.pendingActions++;
20904
23288
  IN_FLIGHT_TRANSITION_ACTION_BATCH = actionBatch;
@@ -21292,7 +23676,7 @@ function forwardFallbackSuspension(fallbackBlock, error) {
21292
23676
  return true;
21293
23677
  }
21294
23678
  function switchToCatch(state, err, reportInline = false, adoptedStart, adoptedEnd) {
21295
- if (err instanceof import_read_protocol.NativeAdoptionMiss) throw err;
23679
+ if (isAdoptionControl(err)) throw err;
21296
23680
  const frame = beginDetachedBoundaryRender(state);
21297
23681
  try {
21298
23682
  switchToCatchInner(state, err, reportInline, adoptedStart, adoptedEnd);
@@ -21304,6 +23688,7 @@ function switchToCatch(state, err, reportInline = false, adoptedStart, adoptedEn
21304
23688
  }
21305
23689
  }
21306
23690
  function switchToCatchInner(state, err, reportInline, adoptedStart, adoptedEnd) {
23691
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
21307
23692
  cancelSuspenseRetry(state);
21308
23693
  HIDDEN_REVEAL_ACTIONS?.delete(state);
21309
23694
  const hydration = activeHydration();
@@ -21428,7 +23813,7 @@ function findTryHandler(block) {
21428
23813
  return rendererRegionTryHandler(origin);
21429
23814
  }
21430
23815
  function handleRenderError(block, err, attempt = null) {
21431
- if (err instanceof import_read_protocol.NativeAdoptionMiss) throw err;
23816
+ if (isAdoptionControl(err)) throw err;
21432
23817
  if (isHostContextRequest(err)) {
21433
23818
  const bridge = rendererRegionOwnerForBlock(block);
21434
23819
  if (bridge !== null && bridge.routeSuspense(err.thenable)) return;
@@ -21618,7 +24003,17 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
21618
24003
  void 0,
21619
24004
  null,
21620
24005
  "control-flow",
21621
- env
24006
+ env,
24007
+ false,
24008
+ void 0,
24009
+ parentBlock.idState.renderOwner?.signalOwner === void 0 ? void 0 : {
24010
+ parent: parentScope,
24011
+ slot: slotKey,
24012
+ kind: state.__kind,
24013
+ branch: next,
24014
+ component: void 0,
24015
+ key: void 0
24016
+ }
21622
24017
  );
21623
24018
  if (r.suspended || r.failed) {
21624
24019
  disposeWip(r.wip);
@@ -21655,7 +24050,17 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
21655
24050
  void 0,
21656
24051
  null,
21657
24052
  "control-flow",
21658
- env
24053
+ env,
24054
+ false,
24055
+ void 0,
24056
+ parentBlock.idState.renderOwner?.signalOwner === void 0 ? void 0 : {
24057
+ parent: parentScope,
24058
+ slot: slotKey,
24059
+ kind: state.__kind,
24060
+ branch: next,
24061
+ component: void 0,
24062
+ key: void 0
24063
+ }
21659
24064
  );
21660
24065
  if (r.suspended || r.failed) {
21661
24066
  transitionSwap.dispose(r.wip);
@@ -21725,6 +24130,8 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
21725
24130
  inner = getNextSibling(state.start);
21726
24131
  innerEnd = hydration.close(inner);
21727
24132
  if (innerEnd !== state.end && getNextSibling(innerEnd) !== state.end) {
24133
+ if (PRESENTATION_HYDRATION?.revision !== void 0)
24134
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(75));
21728
24135
  if (process.env.NODE_ENV !== "production") {
21729
24136
  const mmLoc = siteLoc(parentScope, slotKey);
21730
24137
  if (mmLoc)
@@ -21768,6 +24175,7 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
21768
24175
  renderBlock(b);
21769
24176
  }
21770
24177
  } else if (hydration !== null && getNextSibling(state.start) !== state.end) {
24178
+ if (PRESENTATION_HYDRATION?.revision !== void 0) throw new Error((0, import_error_codes_client_generated.formatClientError)(75));
21771
24179
  if (process.env.NODE_ENV !== "production") {
21772
24180
  const mmLoc = siteLoc(parentScope, slotKey);
21773
24181
  if (mmLoc)
@@ -22341,7 +24749,8 @@ function detachSubtreeRefs(scope, out, shouldDetach = true, includeHiddenTry = t
22341
24749
  } else if (kind === "s") {
22342
24750
  const el = bag[rm[j + 2]];
22343
24751
  if (el == null) continue;
22344
- const ref = bag[rm[j + 1]]?.ref ?? activityRefs?.get(el)?.connected;
24752
+ const spread = bag[rm[j + 1]];
24753
+ const ref = (spread?.[SIGNAL_HOST_PROP_SOURCES] === true ? spread.resolved : spread)?.ref ?? activityRefs?.get(el)?.connected;
22345
24754
  if (ref == null) continue;
22346
24755
  out.push({ ref, el, scope });
22347
24756
  if (shouldDetach && !refAttachWasDiscarded(uncommitted, el, ref)) {
@@ -22423,7 +24832,7 @@ function deactivateScope(scope, disconnectPassive = true) {
22423
24832
  const cleanup = e.cleanup;
22424
24833
  e.cleanup = void 0;
22425
24834
  try {
22426
- if (!staged) runEffectCleanupCallback(cleanup, e.phase);
24835
+ if (!staged) runEffectCleanupCallback(cleanup, e.phase, scope);
22427
24836
  } catch (err) {
22428
24837
  if (err instanceof MaximumUpdateDepthError) throw err;
22429
24838
  const handler = findTryHandler(scope.block);
@@ -22722,6 +25131,7 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
22722
25131
  );
22723
25132
  current = block;
22724
25133
  block.forSlot = state;
25134
+ block.key = key;
22725
25135
  block.itemIndex = index;
22726
25136
  block.currentRenderMode = renderMode;
22727
25137
  block.currentRenderDeferred = deferred;
@@ -22736,7 +25146,6 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
22736
25146
  block.startMarker = root;
22737
25147
  block.endMarker = root;
22738
25148
  state.items.set(key, block);
22739
- block.key = key;
22740
25149
  block.prevSibling = previous;
22741
25150
  if (previous !== null) previous.nextSibling = block;
22742
25151
  else state.head = block;
@@ -22994,6 +25403,7 @@ function checkedListKey(keySource, normalizeKey) {
22994
25403
  }
22995
25404
  function mountItemsLinear(parentBlock, state, items, keySource, itemBody, singleRoot, ssrMarkerless, normalizeKey = false) {
22996
25405
  const newLen = items.length;
25406
+ const observeKey = parentBlock.idState.renderOwner?.signalOwner !== void 0 ? trackSignalRetryListKeys(parentBlock, state, newLen, keySource) : void 0;
22997
25407
  if (newLen === 0) return;
22998
25408
  if (process.env.NODE_ENV !== "production") {
22999
25409
  keySource = checkedListKey(keySource, normalizeKey);
@@ -23017,6 +25427,7 @@ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, single
23017
25427
  for (let i = 0; i < newLen; i++) {
23018
25428
  const item = items[i];
23019
25429
  const key = readListKey(keySource, item, i, normalizeKey);
25430
+ if (observeKey !== void 0) observeKey(i, key);
23020
25431
  let adoptNode = null;
23021
25432
  let anchor = state.end;
23022
25433
  if (adoptByKey !== null) {
@@ -23040,6 +25451,7 @@ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, single
23040
25451
  anchor,
23041
25452
  item,
23042
25453
  i,
25454
+ key,
23043
25455
  itemBody,
23044
25456
  state,
23045
25457
  singleRoot,
@@ -23047,7 +25459,6 @@ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, single
23047
25459
  adoptNode
23048
25460
  );
23049
25461
  oldItems.set(key, block);
23050
- block.key = key;
23051
25462
  block.prevSibling = prev;
23052
25463
  block.nextSibling = null;
23053
25464
  if (prev) prev.nextSibling = block;
@@ -23062,7 +25473,9 @@ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, single
23062
25473
  prev = block.prevSibling;
23063
25474
  oldItems.delete(block.key);
23064
25475
  if (isSuspenseException(error)) retainDiscardedWarmMemos(block);
23065
- unmountBlock(block, !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block));
25476
+ if (block.idState.renderOwner?.signalOwner !== void 0)
25477
+ discardSignalRetryItem(block, error);
25478
+ else unmountBlock(block, !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block));
23066
25479
  }
23067
25480
  state.head = null;
23068
25481
  state.tail = null;
@@ -23097,6 +25510,7 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23097
25510
  );
23098
25511
  return;
23099
25512
  }
25513
+ const observeKey = parentBlock.idState.renderOwner?.signalOwner !== void 0 ? trackSignalRetryListKeys(parentBlock, state, newLen, keySource) : void 0;
23100
25514
  if (process.env.NODE_ENV !== "production") {
23101
25515
  keySource = checkedListKey(keySource, normalizeKey);
23102
25516
  normalizeKey = false;
@@ -23118,6 +25532,7 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23118
25532
  const newItem = items[prefixLen];
23119
25533
  const newKey = readListKey(keySource, newItem, prefixLen, normalizeKey);
23120
25534
  if (oldFirst.key !== newKey) break;
25535
+ if (observeKey !== void 0) observeKey(prefixLen, newKey);
23121
25536
  const block = oldFirst;
23122
25537
  if (!pure || block.props !== newItem || block.body !== itemBody || block.itemIndex !== prefixLen)
23123
25538
  updateSurvivor(block, newItem, prefixLen, itemBody, pure, lite, indexIndependent, state.env);
@@ -23132,6 +25547,7 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23132
25547
  const newItem = items[newEnd];
23133
25548
  const newKey = readListKey(keySource, newItem, newEnd, normalizeKey);
23134
25549
  if (oldLast.key !== newKey) break;
25550
+ if (observeKey !== void 0) observeKey(newEnd, newKey);
23135
25551
  const block = oldLast;
23136
25552
  if (!pure || block.props !== newItem || block.body !== itemBody || block.itemIndex !== newEnd)
23137
25553
  updateSurvivor(block, newItem, newEnd, itemBody, pure, lite, indexIndependent, state.env);
@@ -23155,19 +25571,20 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23155
25571
  for (let i = prefixLen; i <= newEnd; i++) {
23156
25572
  const item = items[i];
23157
25573
  const key = readListKey(keySource, item, i, normalizeKey);
25574
+ if (observeKey !== void 0) observeKey(i, key);
23158
25575
  const block = mountItem(
23159
25576
  parentBlock,
23160
25577
  parentNode,
23161
25578
  anchor,
23162
25579
  item,
23163
25580
  i,
25581
+ key,
23164
25582
  itemBody,
23165
25583
  state,
23166
25584
  singleRoot,
23167
25585
  ssrMarkerless
23168
25586
  );
23169
25587
  oldItems.set(key, block);
23170
- block.key = key;
23171
25588
  block.prevSibling = prev;
23172
25589
  block.nextSibling = afterMiddle;
23173
25590
  if (prev) prev.nextSibling = block;
@@ -23205,6 +25622,7 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23205
25622
  const key = readListKey(keySource, items[prefixLen + i], prefixLen + i, normalizeKey);
23206
25623
  newKeys[i] = key;
23207
25624
  newKeysToIdx.set(key, i);
25625
+ if (observeKey !== void 0) observeKey(prefixLen + i, key);
23208
25626
  }
23209
25627
  if (beforeMiddle === null && afterMiddle === null && !newKeysToIdx.has(oldFirst.key)) {
23210
25628
  let anySurvivors = false;
@@ -23232,13 +25650,13 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23232
25650
  state.end,
23233
25651
  item,
23234
25652
  i,
25653
+ key,
23235
25654
  itemBody,
23236
25655
  state,
23237
25656
  singleRoot,
23238
25657
  ssrMarkerless
23239
25658
  );
23240
25659
  oldItems.set(key, block);
23241
- block.key = key;
23242
25660
  block.prevSibling = prev;
23243
25661
  block.nextSibling = null;
23244
25662
  if (prev) prev.nextSibling = block;
@@ -23399,13 +25817,13 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23399
25817
  anchor,
23400
25818
  items[targetIdx],
23401
25819
  targetIdx,
25820
+ key,
23402
25821
  itemBody,
23403
25822
  state,
23404
25823
  singleRoot,
23405
25824
  ssrMarkerless
23406
25825
  );
23407
25826
  oldItems.set(key, block);
23408
- block.key = key;
23409
25827
  state.size++;
23410
25828
  } else block = oldItems.get(key);
23411
25829
  block.prevSibling = previous;
@@ -23527,7 +25945,7 @@ function batchClearItems(state, oldItems, ownedRootClear = false) {
23527
25945
  }
23528
25946
  oldItems.clear();
23529
25947
  }
23530
- function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot, singleRoot, ssrMarkerless, adoptNode = null) {
25948
+ function mountItem(parentBlock, parentNode, anchor, item, index, key, body, forSlot, singleRoot, ssrMarkerless, adoptNode = null) {
23531
25949
  const hydration = activeHydration();
23532
25950
  if (hydration !== null) {
23533
25951
  if (ssrMarkerless && !hydration.isOpen(hydration.node) && (singleRoot !== 2 || forSlot.plainDeopt !== true || isHostDescriptor(item) && !descNeedsBlocks(item))) {
@@ -23544,6 +25962,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23544
25962
  forSlot.env
23545
25963
  );
23546
25964
  block3.forSlot = forSlot;
25965
+ block3.key = key;
23547
25966
  block3.itemIndex = index;
23548
25967
  if (singleRoot === 2 && forSlot.plainDeopt === true) block3.deoptNode = root;
23549
25968
  renderBlock(block3);
@@ -23562,6 +25981,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23562
25981
  anchor,
23563
25982
  item,
23564
25983
  index,
25984
+ key,
23565
25985
  body,
23566
25986
  forSlot,
23567
25987
  singleRoot,
@@ -23582,6 +26002,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23582
26002
  anchor,
23583
26003
  item,
23584
26004
  index,
26005
+ key,
23585
26006
  body,
23586
26007
  forSlot,
23587
26008
  singleRoot,
@@ -23603,6 +26024,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23603
26024
  forSlot.env
23604
26025
  );
23605
26026
  block2.forSlot = forSlot;
26027
+ block2.key = key;
23606
26028
  block2.itemIndex = index;
23607
26029
  renderBlock(block2);
23608
26030
  hydration.node = getNextSibling(itemEnd);
@@ -23621,6 +26043,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23621
26043
  forSlot.env
23622
26044
  );
23623
26045
  block3.forSlot = forSlot;
26046
+ block3.key = key;
23624
26047
  block3.itemIndex = index;
23625
26048
  block3.deoptNode = adoptNode;
23626
26049
  preserveRootCreatedDom(block3);
@@ -23638,6 +26061,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23638
26061
  forSlot.env
23639
26062
  );
23640
26063
  block2.forSlot = forSlot;
26064
+ block2.key = key;
23641
26065
  block2.itemIndex = index;
23642
26066
  renderBlock(block2);
23643
26067
  const root = (STAGED_DOM?.view(anchor) ?? anchor).previousSibling;
@@ -23665,6 +26089,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23665
26089
  forSlot.env
23666
26090
  );
23667
26091
  block.forSlot = forSlot;
26092
+ block.key = key;
23668
26093
  block.itemIndex = index;
23669
26094
  if (adoptNode !== null) {
23670
26095
  block.deoptNode = adoptNode;
@@ -23718,8 +26143,29 @@ function moveFocusedNodeBefore(parent, node, anchor, snapshots) {
23718
26143
  } else if (snapshots.focused.ownerDocument === node.ownerDocument) {
23719
26144
  snapshot = snapshots;
23720
26145
  }
26146
+ if (STAGED_DOM === null) {
26147
+ (0, import_dom_focused_move.moveNativeNodeBefore)(
26148
+ parent,
26149
+ node,
26150
+ anchor,
26151
+ snapshot?.focused ?? null,
26152
+ snapshot?.contentEditable ?? false
26153
+ );
26154
+ return;
26155
+ }
23721
26156
  const focused = snapshot?.focused ?? null;
23722
- if (focused === null || node !== focused && (node.nodeType !== 1 || !(STAGED_DOM?.view(node) ?? node).contains(focused))) {
26157
+ let containsFocused = node === focused;
26158
+ if (!containsFocused && focused !== null && node.nodeType === 1) {
26159
+ let candidate = focused;
26160
+ do {
26161
+ if (STAGED_DOM.view(node).contains(candidate)) {
26162
+ containsFocused = true;
26163
+ break;
26164
+ }
26165
+ candidate = STAGED_DOM.view(candidate).getRootNode().host;
26166
+ } while (candidate !== void 0);
26167
+ }
26168
+ if (!containsFocused) {
23723
26169
  (STAGED_DOM?.view(parent) ?? parent).insertBefore(node, anchor);
23724
26170
  return;
23725
26171
  }
@@ -23809,6 +26255,7 @@ function coalesceHydratedRanges(rootBlock, liteRanges) {
23809
26255
  }
23810
26256
  function makeGroup(startNode, endNode, block, liteScope, owner) {
23811
26257
  if (!isBlockOpen(startNode) || !isBlockClose(endNode) || startNode === endNode) return null;
26258
+ if ((0, import_dom_binding_protocol.isBindingOpenComment)((STAGED_DOM?.view(startNode) ?? startNode).data)) return null;
23812
26259
  if ((STAGED_DOM?.view(startNode) ?? startNode).parentNode === null || (STAGED_DOM?.view(startNode) ?? startNode).parentNode !== (STAGED_DOM?.view(endNode) ?? endNode).parentNode)
23813
26260
  return null;
23814
26261
  const openDepth = hydrationMarkerMultiplicity(
@@ -24349,7 +26796,7 @@ function validateRootHtmlNesting(container, body) {
24349
26796
  }
24350
26797
  }
24351
26798
  }
24352
- function makeRoot(container, rootBlock, currentBody, currentKey, idState, outputHandler, ownerToken, errorOptions) {
26799
+ function makeRoot(container, rootBlock, currentBody, currentKey, idState, outputHandler, ownerToken, signalOwner, errorOptions) {
24353
26800
  let root;
24354
26801
  let unmounted = false;
24355
26802
  let nestedRootRenderChain = -1;
@@ -24368,6 +26815,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24368
26815
  };
24369
26816
  const renderOwner = {
24370
26817
  current: rootBlock,
26818
+ signalOwner,
24371
26819
  retry: noop,
24372
26820
  request: null,
24373
26821
  generation: 0,
@@ -24567,6 +27015,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24567
27015
  else VIEW_TRANSITION_DRIVER?.refreshPendingOwner(renderOwner);
24568
27016
  }
24569
27017
  renderOwner.nativeRetry?.clear();
27018
+ if (renderOwner.retrySignalOwners !== void 0) clearSignalRetryOwners(renderOwner);
24570
27019
  renderOwner.retryKey = null;
24571
27020
  renderOwner.request = null;
24572
27021
  if (renderOwner.transaction?.aborted === true) renderOwner.transaction = null;
@@ -24576,6 +27025,15 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24576
27025
  unmount() {
24577
27026
  if (arguments.length > 0) warnRootUnmountArgument();
24578
27027
  if (unmounted) return;
27028
+ let presentationRefs = null;
27029
+ if (renderOwner.bindingLeases !== void 0)
27030
+ for (const lease of renderOwner.bindingLeases) {
27031
+ const frame = PRESENTATION_PREPARATIONS.get(lease);
27032
+ if (frame?.revision !== void 0) {
27033
+ collectVisibleSubtreeRefs(frame.scope, presentationRefs ??= []);
27034
+ }
27035
+ }
27036
+ if (presentationRefs !== null) renderOwner.generation++;
24579
27037
  if (!inFlush && CURRENT_BLOCK === null && !inNestedUpdateCallback() && EFFECT_EVENT_LIFECYCLE_DEPTH === 0) {
24580
27038
  VIEW_TRANSITION_DRIVER?.interrupt();
24581
27039
  if (unmounted) return;
@@ -24583,12 +27041,25 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24583
27041
  if (!inFlush && CURRENT_BLOCK === null && !inNestedUpdateCallback() && EFFECT_EVENT_LIFECYCLE_DEPTH === 0) {
24584
27042
  UPDATE_CHAIN_ID++;
24585
27043
  }
24586
- if (process.env.NODE_ENV !== "production" && (inFlush || CURRENT_BLOCK !== null || EFFECT_BODY_DEPTH > 0 || EFFECT_EVENT_LIFECYCLE_DEPTH > 0)) {
27044
+ if (process.env.NODE_ENV !== "production" && !renderOwner.preservePresentation && (inFlush || CURRENT_BLOCK !== null || EFFECT_BODY_DEPTH > 0 || EFFECT_EVENT_LIFECYCLE_DEPTH > 0)) {
24587
27045
  warnRootLifecycleUnmount();
24588
27046
  }
24589
27047
  unmounted = true;
24590
27048
  renderOwner.disposed = true;
27049
+ if (renderOwner.bindingLeases !== void 0) {
27050
+ for (const lease of renderOwner.bindingLeases) {
27051
+ (0, import_dom_binding_handoff.releaseBindingHandoff)(lease);
27052
+ PRESENTATION_PREPARATIONS.delete(lease);
27053
+ try {
27054
+ if (!renderOwner.preservePresentation) lease.retire();
27055
+ } catch (error) {
27056
+ if (!reportUncaughtError(rootBlock, error)) console.error(error);
27057
+ }
27058
+ }
27059
+ renderOwner.bindingLeases.clear();
27060
+ }
24591
27061
  renderOwner.nativeRetry?.clear();
27062
+ if (renderOwner.retrySignalOwners !== void 0) clearSignalRetryOwners(renderOwner);
24592
27063
  renderOwner.retry = noop;
24593
27064
  if (renderOwner.transition !== void 0) TRANSITION_SWAP_DRIVER.discardRoot(renderOwner);
24594
27065
  renderOwner.generation++;
@@ -24602,13 +27073,9 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24602
27073
  (0, import_devtools_hook.__devtoolsUnregisterRoot)(
24603
27074
  rootBlock
24604
27075
  );
24605
- unmountBlock(
24606
- rootBlock,
24607
- /*detachDom*/
24608
- false
24609
- );
27076
+ withRefDetachSuppression(presentationRefs, () => unmountBlock(rootBlock, false));
24610
27077
  drainRefDetaches();
24611
- clearRootContainer(container);
27078
+ if (!renderOwner.preservePresentation) clearRootContainer(container);
24612
27079
  drainDeferredPassiveUnmounts();
24613
27080
  rootBlock = null;
24614
27081
  currentBody = null;
@@ -24639,20 +27106,24 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24639
27106
  }
24640
27107
  function createRootWithOutputHandler(container, options, outputHandler) {
24641
27108
  assertValidRootContainer(container);
27109
+ if (options?.bindingLeases !== void 0) throw new Error((0, import_error_codes_client_generated.formatClientError)(76));
24642
27110
  options = warnCreateRootElementOption(options);
24643
27111
  const ownerToken = claimRootContainer(container);
24644
27112
  registerDelegationTarget(container, true);
27113
+ const rootPrefix = (options?.identifierPrefix ?? "") + "r" + (nextClientRootId++).toString(36) + "-";
24645
27114
  return makeRoot(
24646
27115
  container,
24647
27116
  null,
24648
27117
  null,
24649
27118
  null,
24650
27119
  {
24651
- prefix: (options?.identifierPrefix ?? "") + "r" + (nextClientRootId++).toString(36) + "-",
24652
- next: 0
27120
+ prefix: rootPrefix,
27121
+ next: 0,
27122
+ signalState: { prefix: options?.signalInstancePrefix ?? rootPrefix, next: 0 }
24653
27123
  },
24654
27124
  outputHandler,
24655
27125
  ownerToken,
27126
+ options?.signalOwner ?? (import_document_owner.signalDocumentEnabled ? (0, import_document_owner.documentSignalOwner)(container) : void 0),
24656
27127
  options
24657
27128
  );
24658
27129
  }
@@ -24692,6 +27163,15 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24692
27163
  body = ROOT_RENDERABLE_BODY;
24693
27164
  props = bodyOrElement;
24694
27165
  }
27166
+ const bindingLeases = rootOptions?.bindingLeases?.map((handle) => {
27167
+ const capability = handle;
27168
+ const lease = capability[import_dom_binding_handoff.BINDING_HANDOFF]?.();
27169
+ if (lease === void 0 || !lease.active() || lease.owner !== void 0 || !container.contains(lease.root))
27170
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(77));
27171
+ return lease;
27172
+ });
27173
+ if (bindingLeases !== void 0 && new Set(bindingLeases).size !== bindingLeases.length)
27174
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(78));
24695
27175
  const nativeSidecar = findHydrateSeedSidecar(container, import_native_read_seeds.NATIVE_SIGNAL_SEED_ATTR);
24696
27176
  const nativeManifest = nativeSidecar === null ? void 0 : (0, import_native_read_seeds.parseNativeSignalManifest)(
24697
27177
  (STAGED_DOM?.view(nativeSidecar) ?? nativeSidecar).textContent || ""
@@ -24719,7 +27199,11 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24719
27199
  }
24720
27200
  const idState = {
24721
27201
  prefix: rootOptions?.identifierPrefix ?? "",
24722
- next: 0
27202
+ next: rootOptions?.identifierSeed ?? 0,
27203
+ signalState: {
27204
+ prefix: rootOptions?.signalInstancePrefix ?? rootOptions?.identifierPrefix ?? "",
27205
+ next: 0
27206
+ }
24723
27207
  };
24724
27208
  rootBlock.idState = idState;
24725
27209
  registerRootErrorHandlers(rootBlock, rootOptions);
@@ -24745,9 +27229,15 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24745
27229
  idState,
24746
27230
  renderReturnedValue,
24747
27231
  ownerToken,
27232
+ rootOptions?.signalOwner ?? (import_document_owner.signalDocumentEnabled ? (0, import_document_owner.documentSignalOwner)(container) : void 0),
24748
27233
  rootOptions
24749
27234
  );
24750
27235
  const owner = idState.renderOwner;
27236
+ if (bindingLeases !== void 0) {
27237
+ owner.bindingLeases = new Set(bindingLeases);
27238
+ owner.bindingContainer = container;
27239
+ for (const lease of bindingLeases) (0, import_dom_binding_handoff.claimBindingHandoff)(lease, owner);
27240
+ }
24751
27241
  const adopt = () => {
24752
27242
  if (owner.disposed) return;
24753
27243
  if (rootBlock.disposed) {
@@ -24771,11 +27261,29 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24771
27261
  owner.transaction.hydrating = true;
24772
27262
  createdInRootRender(rootBlock);
24773
27263
  journalRootProperty(idState, "next", idState.next);
24774
- idState.next = 0;
27264
+ idState.next = rootOptions?.identifierSeed ?? 0;
24775
27265
  let firstNode = getFirstChild(container);
24776
27266
  while (firstNode !== null && (firstNode.nodeType === 10 || isRendererHydrationStyle(firstNode)))
24777
27267
  firstNode = getNextSibling(firstNode);
24778
27268
  const hydration = new HydrationCapability(rootBlock, firstNode, seeds);
27269
+ if (bindingLeases?.some((lease) => lease.revision !== void 0)) {
27270
+ const attempted = rootBlock;
27271
+ hydration.retryPresentation = () => {
27272
+ if (owner.disposed || owner.current !== attempted) return;
27273
+ const refs = [];
27274
+ collectVisibleSubtreeRefs(attempted, refs);
27275
+ withRefDetachSuppression(refs, () => unmountBlock(attempted, false));
27276
+ queueMicrotask(() => {
27277
+ if (!owner.disposed && owner.current === attempted) adopt();
27278
+ });
27279
+ };
27280
+ }
27281
+ if (firstNode?.nodeType === 8 && (STAGED_DOM?.view(firstNode) ?? firstNode).data === body[BINDING_VIEW_ROOT]) {
27282
+ rootBlock.startMarker = firstNode;
27283
+ rootBlock.endMarker = hydration.close(firstNode);
27284
+ hydration.claimRootRemainder(getNextSibling(rootBlock.endMarker));
27285
+ hydration.node = getNextSibling(firstNode);
27286
+ }
24779
27287
  if (nativeManifest !== void 0)
24780
27288
  hydration.nativeAdoption = ownNativeAdoption(rootBlock, nativeManifest);
24781
27289
  hydration.passthroughRanges = body[import_constants.HYDRATION_RANGE_BOUNDARY] === "passthrough";
@@ -24796,7 +27304,22 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24796
27304
  hydration.finishRoot();
24797
27305
  completed = true;
24798
27306
  } catch (error) {
24799
- if (error instanceof import_read_protocol.NativeAdoptionMiss) {
27307
+ if (error instanceof PresentationAdoptionMiss) {
27308
+ rollbackRootRender(owner.transaction);
27309
+ const refs = [];
27310
+ collectVisibleSubtreeRefs(rootBlock, refs);
27311
+ withRefDetachSuppression(refs, () => unmountBlock(rootBlock, false));
27312
+ if (error.retry && error.lease?.active()) {
27313
+ retryPresentationMiss(error, () => {
27314
+ if (!owner.disposed) adopt();
27315
+ });
27316
+ } else {
27317
+ owner.preservePresentation = true;
27318
+ root.unmount();
27319
+ if (!Object.prototype.hasOwnProperty.call(error, "failure")) throw error;
27320
+ if (!reportUncaughtError(rootBlock, error.failure)) throw error.failure;
27321
+ }
27322
+ } else if (error instanceof import_read_protocol.NativeAdoptionMiss) {
24800
27323
  nativeRecovery = error;
24801
27324
  rollbackRootRender(owner.transaction);
24802
27325
  unmountBlock(rootBlock, false);
@@ -24820,13 +27343,13 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24820
27343
  }
24821
27344
  if (nativeRecovery !== void 0 && !owner.disposed) {
24822
27345
  noteRecoverableHydrationError(() => nativeRecovery, rootBlock);
24823
- idState.next = 0;
27346
+ idState.next = rootOptions?.identifierSeed ?? 0;
24824
27347
  if (isElementDescriptor(bodyOrElement)) root.render(bodyOrElement);
24825
27348
  else root.render(body, props);
24826
27349
  return;
24827
27350
  }
24828
27351
  if (!completed) return;
24829
- if (hydration.hasAdjacentRangePair) hydration.coalesce();
27352
+ if (hydration.hasAdjacentRangePair && !hydration.presentation) hydration.coalesce();
24830
27353
  owner.retry = () => {
24831
27354
  if (!rootBlock.disposed) scheduleRender(rootBlock);
24832
27355
  };
@@ -24839,6 +27362,34 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24839
27362
  adopt();
24840
27363
  return root;
24841
27364
  }
27365
+ function createIndependentHydrateActivator(body) {
27366
+ return (context) => {
27367
+ const content = (_props, scope, extra) => {
27368
+ body(context.captures, scope, extra);
27369
+ };
27370
+ const framed = (_props, scope) => {
27371
+ tryBlock(scope, 0, scope.block.parentNode, content, null, null, scope.block.endMarker);
27372
+ };
27373
+ const adapter = (_props, scope) => {
27374
+ componentSlotVoid(scope, 0, scope.block.parentNode, framed, void 0, scope.block.endMarker);
27375
+ };
27376
+ const root = hydrateRoot(context.element, adapter, context.captures, {
27377
+ identifierPrefix: context.manifest.boundaryId + "-",
27378
+ identifierSeed: context.manifest.idSeed,
27379
+ signalInstancePrefix: context.manifest.boundaryId,
27380
+ ...context.signalOwner === void 0 ? {} : { signalOwner: context.signalOwner }
27381
+ });
27382
+ for (const replay of context.intents) {
27383
+ if (!(0, import_event_capture.isHydrationSelectionIntentCurrent)(replay)) continue;
27384
+ const originalTarget = replay.event.target;
27385
+ if (originalTarget === null || originalTarget.nodeType !== 1 || !context.element.contains(originalTarget))
27386
+ continue;
27387
+ const target = originalTarget;
27388
+ target.dispatchEvent(cloneHydrationReplayEvent(replay.event, target));
27389
+ }
27390
+ return root;
27391
+ };
27392
+ }
24842
27393
  const _resourceHints = /* @__PURE__ */ new Set();
24843
27394
  function hasHeadHint(key) {
24844
27395
  if (_resourceHints.has(key)) return true;
@@ -25245,7 +27796,17 @@ function scriptResource(attrs) {
25245
27796
  bagOf,
25246
27797
  beginNativeReadScope,
25247
27798
  beginNativeReadWitness,
27799
+ beginPresentationHydration,
27800
+ bindPresentationView,
25248
27801
  bindRendererRegionOwner,
27802
+ bindSignalAttribute,
27803
+ bindSignalChecked,
27804
+ bindSignalChild,
27805
+ bindSignalHostPropSources,
27806
+ bindSignalText,
27807
+ bindSignalValue,
27808
+ bindingChildSlot,
27809
+ bindingText,
25249
27810
  callWithReceiver,
25250
27811
  canSplitStyleProperties,
25251
27812
  child,
@@ -25265,7 +27826,10 @@ function scriptResource(attrs) {
25265
27826
  componentSlotVoid,
25266
27827
  createContext,
25267
27828
  createElement,
27829
+ createElementAt,
27830
+ createElementFromConfig,
25268
27831
  createHostContextRequest,
27832
+ createIndependentHydrateActivator,
25269
27833
  createPortal,
25270
27834
  createRoot,
25271
27835
  createScopedElement,
@@ -25275,10 +27839,13 @@ function scriptResource(attrs) {
25275
27839
  descriptorChildren,
25276
27840
  devEventListener,
25277
27841
  devHtmlNesting,
27842
+ documentSignalOwner,
25278
27843
  drainFrag,
25279
27844
  drainPassiveEffects,
25280
27845
  enableNativeReadCollection,
27846
+ enableSignalBindings,
25281
27847
  endNativeReadScope,
27848
+ endPresentationHydration,
25282
27849
  errorBlock,
25283
27850
  evt0,
25284
27851
  evt0u,
@@ -25318,6 +27885,7 @@ function scriptResource(attrs) {
25318
27885
  hydrateRoot,
25319
27886
  ifBlock,
25320
27887
  injectStyle,
27888
+ installStreamedSignalOwnerActivator,
25321
27889
  invokeManualHook,
25322
27890
  isChildrenBlock,
25323
27891
  isHydratingStyle,
@@ -25327,6 +27895,7 @@ function scriptResource(attrs) {
25327
27895
  lazy,
25328
27896
  manualHook,
25329
27897
  mapSlot,
27898
+ markBindingChildren,
25330
27899
  markChildrenBlock,
25331
27900
  markDangerouslySetInnerHTMLChildren,
25332
27901
  markNativeChangeDiagnosticStatic,
@@ -25347,6 +27916,7 @@ function scriptResource(attrs) {
25347
27916
  nativeCreateScopedElement,
25348
27917
  nativeCreateScopedValue,
25349
27918
  nativeLocalHook,
27919
+ nativeProjectionBinding,
25350
27920
  nativePuMemo,
25351
27921
  nativePuPub,
25352
27922
  nativePuTake0,
@@ -25365,6 +27935,10 @@ function scriptResource(attrs) {
25365
27935
  preinitModule,
25366
27936
  preload,
25367
27937
  preloadModule,
27938
+ presentationFailure,
27939
+ presentationHostWrite,
27940
+ presentationStructure,
27941
+ presentationWrite,
25368
27942
  provideContext,
25369
27943
  puMiss,
25370
27944
  puPub,
@@ -25397,6 +27971,8 @@ function scriptResource(attrs) {
25397
27971
  setAttribute,
25398
27972
  setAttributeIfChanged,
25399
27973
  setAutoFocus,
27974
+ setBindingClass,
27975
+ setBindingClassIfChanged,
25400
27976
  setBooleanAttribute,
25401
27977
  setBooleanAttributeIfChanged,
25402
27978
  setChecked,