octane 0.6.2 → 0.7.0

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 (200) hide show
  1. package/dist/cjs/constants.cjs +3 -0
  2. package/dist/cjs/dom-binding-handoff.cjs +2 -1
  3. package/dist/cjs/dom-binding-protocol.cjs +4 -3
  4. package/dist/cjs/dom-binding-styles.cjs +3 -2
  5. package/dist/cjs/dom-bindings.cjs +24 -23
  6. package/dist/cjs/error-codes.client.generated.cjs +7 -1
  7. package/dist/cjs/error-codes.server.generated.cjs +27 -1
  8. package/dist/cjs/hydration/event-capture.cjs +2 -1
  9. package/dist/cjs/independent-hydration-protocol.cjs +3 -2
  10. package/dist/cjs/index.cjs +2 -0
  11. package/dist/cjs/runtime.cjs +866 -370
  12. package/dist/cjs/runtime.server.cjs +250 -62
  13. package/dist/cjs/server/index.cjs +2 -0
  14. package/dist/cjs/server/rpc-stream.cjs +19 -12
  15. package/dist/cjs/server/streamed-signals.cjs +18 -1
  16. package/dist/cjs/shared-value-helpers.cjs +24 -2
  17. package/dist/cjs/signals/control-binding.cjs +7 -6
  18. package/dist/cjs/signals/derived-facade.cjs +2 -1
  19. package/dist/cjs/signals/document-owner.cjs +4 -3
  20. package/dist/cjs/signals/facade.cjs +10 -9
  21. package/dist/cjs/signals/graph.cjs +5 -4
  22. package/dist/cjs/signals/native-read-client.cjs +4 -3
  23. package/dist/cjs/signals/owner-context.cjs +4 -3
  24. package/dist/cjs/signals/query-attempt-observer.cjs +2 -1
  25. package/dist/cjs/signals/query-facade.cjs +2 -1
  26. package/dist/cjs/signals/scalar-computations.cjs +2 -1
  27. package/dist/cjs/signals/transition-action.cjs +10 -9
  28. package/dist/cjs/signals/transition-candidate.cjs +2 -1
  29. package/dist/cjs/version.cjs +1 -1
  30. package/dist/compiler/arm-exits.js +151 -0
  31. package/dist/compiler/compile-universal.js +262 -65
  32. package/dist/compiler/compile.js +1929 -306
  33. package/dist/compiler/deferred-snapshots.js +791 -0
  34. package/dist/compiler/strong-mode.js +59 -10
  35. package/dist/constants.d.ts +5 -1
  36. package/dist/constants.js +2 -0
  37. package/dist/error-codes.client.generated.d.ts +1 -0
  38. package/dist/error-codes.client.generated.js +5 -0
  39. package/dist/error-codes.server.generated.d.ts +5 -0
  40. package/dist/error-codes.server.generated.js +25 -0
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +2 -0
  43. package/dist/node/aria-diagnostics.js +92 -0
  44. package/dist/node/behavior-form-submissions.js +228 -0
  45. package/dist/node/behavior-root-types.js +0 -0
  46. package/dist/node/behavior-root.js +746 -0
  47. package/dist/node/class-names.js +25 -0
  48. package/dist/node/compatibility.js +10 -0
  49. package/dist/node/component-flags.js +23 -0
  50. package/dist/node/constants.js +115 -0
  51. package/dist/node/context-epoch.js +13 -0
  52. package/dist/node/context-identity.js +46 -0
  53. package/dist/node/css.js +80 -0
  54. package/dist/node/data-encoding.js +134 -0
  55. package/dist/node/devtools-hook.js +229 -0
  56. package/dist/node/dom-binding-claims.js +4 -0
  57. package/dist/node/dom-binding-classes.js +152 -0
  58. package/dist/node/dom-binding-controls.js +6 -0
  59. package/dist/node/dom-binding-handoff.js +77 -0
  60. package/dist/node/dom-binding-program.js +1617 -0
  61. package/dist/node/dom-binding-projections.js +204 -0
  62. package/dist/node/dom-binding-protocol.js +130 -0
  63. package/dist/node/dom-binding-signals.js +135 -0
  64. package/dist/node/dom-binding-styles.js +280 -0
  65. package/dist/node/dom-bindings.js +1087 -0
  66. package/dist/node/dom-focused-move.js +46 -0
  67. package/dist/node/dom-stage.js +878 -0
  68. package/dist/node/dom-tables.js +382 -0
  69. package/dist/node/error-codes.client.generated.js +1071 -0
  70. package/dist/node/error-codes.server.generated.js +761 -0
  71. package/dist/node/error-message.js +27 -0
  72. package/dist/node/event-names.js +15 -0
  73. package/dist/node/form-diagnostics.js +96 -0
  74. package/dist/node/form-submission.js +43 -0
  75. package/dist/node/has-own.js +4 -0
  76. package/dist/node/head-ownership.js +31 -0
  77. package/dist/node/hook-slot-cache.js +91 -0
  78. package/dist/node/host-property-diagnostics.js +189 -0
  79. package/dist/node/html-tree-validation.js +193 -0
  80. package/dist/node/hydration/condition.js +15 -0
  81. package/dist/node/hydration/control-capture.js +237 -0
  82. package/dist/node/hydration/document-lifecycle.js +89 -0
  83. package/dist/node/hydration/event-capture.js +362 -0
  84. package/dist/node/hydration/idle.js +23 -0
  85. package/dist/node/hydration/independent-island.js +317 -0
  86. package/dist/node/hydration/index.js +74 -0
  87. package/dist/node/hydration/interaction-config.js +61 -0
  88. package/dist/node/hydration/interaction.js +35 -0
  89. package/dist/node/hydration/load.js +15 -0
  90. package/dist/node/hydration/media.js +33 -0
  91. package/dist/node/hydration/native-intent.js +68 -0
  92. package/dist/node/hydration/never.js +12 -0
  93. package/dist/node/hydration/stream-delivery.js +345 -0
  94. package/dist/node/hydration/stream-receiver.js +190 -0
  95. package/dist/node/hydration/stream-result-receiver.js +276 -0
  96. package/dist/node/hydration/streamed-signals.js +186 -0
  97. package/dist/node/hydration/types.js +0 -0
  98. package/dist/node/hydration/visible.js +69 -0
  99. package/dist/node/hydration-markers.js +44 -0
  100. package/dist/node/independent-hydration-protocol.js +91 -0
  101. package/dist/node/index.js +463 -0
  102. package/dist/node/internal/client.js +7 -0
  103. package/dist/node/internal/context.js +5 -0
  104. package/dist/node/internal/server.js +5 -0
  105. package/dist/node/internal/signal-read.js +4 -0
  106. package/dist/node/method-dep.js +25 -0
  107. package/dist/node/profiling.js +432 -0
  108. package/dist/node/public-types.js +0 -0
  109. package/dist/node/react/fiber-adapter.js +57 -0
  110. package/dist/node/react/index.js +397 -0
  111. package/dist/node/react/react-compat-envelope.js +78 -0
  112. package/dist/node/react/react-compat-server.js +129 -0
  113. package/dist/node/react/react-compat-shared.js +104 -0
  114. package/dist/node/react/react-compat.js +223 -0
  115. package/dist/node/react/server.js +81 -0
  116. package/dist/node/react/shared.js +75 -0
  117. package/dist/node/renderer-bridge.js +35 -0
  118. package/dist/node/resize-observer.js +105 -0
  119. package/dist/node/resource-hint-diagnostics.js +67 -0
  120. package/dist/node/runtime-tags.js +22 -0
  121. package/dist/node/runtime.js +29364 -0
  122. package/dist/node/runtime.server.js +8200 -0
  123. package/dist/node/sanitize-url.js +34 -0
  124. package/dist/node/server/early-signals.js +54 -0
  125. package/dist/node/server/index.js +338 -0
  126. package/dist/node/server/rpc-batch.js +129 -0
  127. package/dist/node/server/rpc-stream.js +132 -0
  128. package/dist/node/server/rpc.js +48 -0
  129. package/dist/node/server/signal-query-observation.js +134 -0
  130. package/dist/node/server/streamed-region.js +31 -0
  131. package/dist/node/server/streamed-signals.js +574 -0
  132. package/dist/node/server-call.js +75 -0
  133. package/dist/node/server-rpc-batch-client.js +119 -0
  134. package/dist/node/server-rpc-client.js +108 -0
  135. package/dist/node/server-rpc-protocol.js +109 -0
  136. package/dist/node/server-rpc-stream-client.js +98 -0
  137. package/dist/node/shared-value-helpers.js +60 -0
  138. package/dist/node/signals/actions.js +463 -0
  139. package/dist/node/signals/client.js +22 -0
  140. package/dist/node/signals/computations.js +452 -0
  141. package/dist/node/signals/control-binding.js +388 -0
  142. package/dist/node/signals/control-handoff.js +12 -0
  143. package/dist/node/signals/derived-facade.js +25 -0
  144. package/dist/node/signals/document-owner.js +48 -0
  145. package/dist/node/signals/early-values.js +124 -0
  146. package/dist/node/signals/encoding.js +6 -0
  147. package/dist/node/signals/engine.js +668 -0
  148. package/dist/node/signals/errors.js +54 -0
  149. package/dist/node/signals/facade.js +441 -0
  150. package/dist/node/signals/graph.js +817 -0
  151. package/dist/node/signals/handle-protocol.js +11 -0
  152. package/dist/node/signals/index.js +87 -0
  153. package/dist/node/signals/native-read-client.js +319 -0
  154. package/dist/node/signals/native-read-collector.js +132 -0
  155. package/dist/node/signals/native-read-events.js +45 -0
  156. package/dist/node/signals/native-read-inspection.js +20 -0
  157. package/dist/node/signals/native-read-retry.js +30 -0
  158. package/dist/node/signals/native-read-seeds.js +243 -0
  159. package/dist/node/signals/native-read-server.js +99 -0
  160. package/dist/node/signals/owner-context.js +88 -0
  161. package/dist/node/signals/query-attempt-observer.js +42 -0
  162. package/dist/node/signals/query-facade.js +41 -0
  163. package/dist/node/signals/read-protocol.js +125 -0
  164. package/dist/node/signals/requests.js +716 -0
  165. package/dist/node/signals/scalar-computations.js +57 -0
  166. package/dist/node/signals/scope-streams.js +147 -0
  167. package/dist/node/signals/server.js +22 -0
  168. package/dist/node/signals/transition-action.js +555 -0
  169. package/dist/node/signals/transition-candidate.js +101 -0
  170. package/dist/node/signals/transition-coordinator.js +255 -0
  171. package/dist/node/signals/transition-state.js +82 -0
  172. package/dist/node/signals/types.js +20 -0
  173. package/dist/node/static/index.js +10 -0
  174. package/dist/node/stream-protocol.js +114 -0
  175. package/dist/node/streamed-signals-protocol.js +130 -0
  176. package/dist/node/style-values.js +96 -0
  177. package/dist/node/sub-slot.js +35 -0
  178. package/dist/node/testing.js +14 -0
  179. package/dist/node/trusted-html.js +6 -0
  180. package/dist/node/tsrx-iterable.js +5 -0
  181. package/dist/node/tsrx-spread.js +10 -0
  182. package/dist/node/universal-core.js +10138 -0
  183. package/dist/node/universal-dom-boundary.js +237 -0
  184. package/dist/node/universal-native.js +28 -0
  185. package/dist/node/universal.js +17 -0
  186. package/dist/node/version.js +4 -0
  187. package/dist/runtime.d.ts +219 -8
  188. package/dist/runtime.js +714 -220
  189. package/dist/runtime.server.d.ts +33 -2
  190. package/dist/runtime.server.js +217 -29
  191. package/dist/server/index.d.ts +1 -1
  192. package/dist/server/index.js +2 -0
  193. package/dist/server/rpc-stream.js +19 -12
  194. package/dist/server/streamed-signals.js +18 -1
  195. package/dist/shared-value-helpers.d.ts +11 -0
  196. package/dist/shared-value-helpers.js +21 -1
  197. package/dist/universal-core.d.ts +3 -1
  198. package/dist/universal-core.js +178 -50
  199. package/dist/version.js +1 -1
  200. package/package.json +62 -1
@@ -102,6 +102,7 @@ __export(runtime_exports, {
102
102
  createRoot: () => createRoot,
103
103
  createScopedElement: () => createScopedElement,
104
104
  createScopedValue: () => createScopedValue,
105
+ deferRecord: () => deferRecord,
105
106
  delegateCaptureEvents: () => delegateCaptureEvents,
106
107
  delegateEvents: () => delegateEvents,
107
108
  descriptorChildren: () => descriptorChildren,
@@ -159,6 +160,7 @@ __export(runtime_exports, {
159
160
  isChildrenBlock: () => isChildrenBlock,
160
161
  isHydratingStyle: () => isHydratingStyle,
161
162
  isInActScope: () => isInActScope,
163
+ isRenderCall: () => isRenderCall,
162
164
  isValidElement: () => isValidElement,
163
165
  keyedForBlock: () => keyedForBlock,
164
166
  lazy: () => lazy,
@@ -287,6 +289,7 @@ __export(runtime_exports, {
287
289
  textHole: () => textHole,
288
290
  textHoleUpdate: () => textHoleUpdate,
289
291
  textSlot: () => textSlot,
292
+ textareaText: () => textareaText,
290
293
  tryBlock: () => tryBlock,
291
294
  updateFreshClassAttr: () => updateFreshClassAttr,
292
295
  updateFreshClassName: () => updateFreshClassName,
@@ -366,6 +369,7 @@ var import_early_values = require("./signals/early-values.cjs");
366
369
  var import_types = require("./signals/types.cjs");
367
370
  var import_read_protocol2 = require("./signals/read-protocol.cjs");
368
371
  var import_css = require("./css.cjs");
372
+ const __octaneDev = process.env.NODE_ENV !== "production";
369
373
  let PROFILE_COMPONENT_OVERRIDE = null;
370
374
  function withProfileComponentOverride(target, component, run) {
371
375
  const previous = PROFILE_COMPONENT_OVERRIDE;
@@ -383,16 +387,16 @@ function profileTrackComponent(subject, fallback) {
383
387
  override !== null && override.target === fallback ? override.component : fallback
384
388
  );
385
389
  }
386
- function profilePortalComponent(rawBody) {
390
+ function profilePortalComponent(rawBody, body) {
387
391
  if (typeof rawBody === "function" && (0, import_profiling.__profileHasComponentMetadata)(rawBody)) return rawBody;
388
392
  const descriptor = rawBody;
389
- return descriptor != null && descriptor.$$kind === import_runtime_tags.ELEMENT_TAG && typeof descriptor.type === "function" ? descriptor.type : null;
393
+ return descriptor != null && descriptor.$$kind === import_runtime_tags.ELEMENT_TAG && descriptor.type === body ? body : null;
390
394
  }
391
395
  function ensureHooks(scope) {
392
396
  return scope.hooks ?? (scope.hooks = /* @__PURE__ */ new Map());
393
397
  }
394
398
  function registerHookCleanup(scope, cleanup) {
395
- if (process.env.NODE_ENV !== "production") {
399
+ if (__octaneDev) {
396
400
  if (scope.block.body?.[HMR] !== void 0) {
397
401
  cleanup[HMR] = true;
398
402
  }
@@ -1153,6 +1157,7 @@ function siteLoc(scope, slotKey) {
1153
1157
  if (lc === void 0) return "";
1154
1158
  return `${scope.locFile ?? "<unknown>"}:${lc[0]}:${lc[1]}`;
1155
1159
  }
1160
+ const COMPONENT_SOURCE_LOCS = !__octaneDev ? null : /* @__PURE__ */ new WeakMap();
1156
1161
  function componentSourceLoc(body) {
1157
1162
  if (typeof body !== "function") return void 0;
1158
1163
  try {
@@ -1160,13 +1165,17 @@ function componentSourceLoc(body) {
1160
1165
  if (typeof stamped === "string") return stamped;
1161
1166
  } catch {
1162
1167
  }
1168
+ const cache = COMPONENT_SOURCE_LOCS;
1169
+ if (cache !== null && cache.has(body)) return cache.get(body);
1170
+ let loc;
1163
1171
  try {
1164
1172
  const source = Function.prototype.toString.call(body);
1165
1173
  const match = /["']__octane_loc:([^"'\\\s]+)["']/.exec(source);
1166
- if (match !== null) return decodeURIComponent(match[1]);
1174
+ if (match !== null) loc = decodeURIComponent(match[1]);
1167
1175
  } catch {
1168
1176
  }
1169
- return void 0;
1177
+ cache?.set(body, loc);
1178
+ return loc;
1170
1179
  }
1171
1180
  function isHydrationSuppressed(el) {
1172
1181
  return el !== null && el.__oct_suppress === true;
@@ -1176,14 +1185,14 @@ function hydrationMismatchMode(el) {
1176
1185
  return el.__oct_loc !== void 0 ? 2 : 0;
1177
1186
  }
1178
1187
  function warnHydrationValueMismatch(loc, what, serverVal, clientVal) {
1179
- if (process.env.NODE_ENV === "production") return;
1188
+ if (!__octaneDev) return;
1180
1189
  if (!loc) return;
1181
1190
  console.error(
1182
1191
  `Octane hydration mismatch at ${loc}: server rendered ${what} ${JSON.stringify(serverVal)} but the client rendered ${JSON.stringify(clientVal)}. The client value was used. If this difference is intentional (e.g. a timestamp or random id), add suppressHydrationWarning to the element.`
1183
1192
  );
1184
1193
  }
1185
1194
  function warnHydrationKeptServerValue(loc, what, serverVal, clientVal) {
1186
- if (process.env.NODE_ENV === "production" || !loc) return;
1195
+ if (!__octaneDev || !loc) return;
1187
1196
  console.error(
1188
1197
  `Octane hydration mismatch at ${loc}: server rendered ${what} ${JSON.stringify(serverVal)} but the client rendered ${JSON.stringify(clientVal)}. The server value was kept. If this difference is intentional, add suppressHydrationWarning to the element.`
1189
1198
  );
@@ -1201,7 +1210,7 @@ function describeHydrationNode(node) {
1201
1210
  return "a node";
1202
1211
  }
1203
1212
  function warnHydrationStructuralMismatch(loc, expected, actual) {
1204
- if (process.env.NODE_ENV === "production") return;
1213
+ if (!__octaneDev) return;
1205
1214
  if (!loc) return;
1206
1215
  console.error(
1207
1216
  `Octane hydration mismatch at ${loc}: the client expected ${expected} but the server rendered ${actual}. The mismatched subtree was rebuilt on the client.`
@@ -1213,7 +1222,7 @@ function hydrationNodeMatches(server, template2, partialStyles, path = "") {
1213
1222
  const s = server;
1214
1223
  const t = template2;
1215
1224
  if (s.localName !== t.localName) return false;
1216
- if (process.env.NODE_ENV === "production") return true;
1225
+ if (!__octaneDev) return true;
1217
1226
  const tAttrs = (STAGED_DOM?.view(t) ?? t).attributes;
1218
1227
  for (let i = 0; i < tAttrs.length; i++) {
1219
1228
  const a = tAttrs[i];
@@ -1242,6 +1251,10 @@ function hydrationNodeMatches(server, template2, partialStyles, path = "") {
1242
1251
  }
1243
1252
  return true;
1244
1253
  }
1254
+ function fragmentRootMatches(server, fragment, partialStyles) {
1255
+ const first = getFirstChild(fragment);
1256
+ return first.nodeType === 8 || hydrationNodeMatches(server, first, partialStyles, "0");
1257
+ }
1245
1258
  function removeHydrationRange(start, end) {
1246
1259
  let n = start;
1247
1260
  while (n !== null) {
@@ -2503,7 +2516,7 @@ function suspendRootRender(block, wakeable, attempt) {
2503
2516
  owner.retry();
2504
2517
  });
2505
2518
  };
2506
- wakeable.then(ping, ping);
2519
+ resumeOnSettle(wakeable, ping);
2507
2520
  return true;
2508
2521
  }
2509
2522
  const BINDING_BAG_ARITY = /* @__PURE__ */ Symbol();
@@ -3114,8 +3127,8 @@ function vtScopeForBlock(block) {
3114
3127
  const host = vtScopeHost(ancestor);
3115
3128
  if (host === null) return null;
3116
3129
  if (ancestor !== block) {
3117
- const parent2 = block.parentNode;
3118
- if (parent2 !== host && !(STAGED_DOM?.view(host) ?? host).contains(parent2)) {
3130
+ const parent = block.parentNode;
3131
+ if (parent !== host && !(STAGED_DOM?.view(host) ?? host).contains(parent)) {
3119
3132
  const elements = vtRangeElements(block);
3120
3133
  if (elements.length === 0 || elements.some(
3121
3134
  (element) => element !== host && !(STAGED_DOM?.view(host) ?? host).contains(element)
@@ -3125,10 +3138,14 @@ function vtScopeForBlock(block) {
3125
3138
  }
3126
3139
  return host;
3127
3140
  }
3128
- const parent = block.parentNode;
3129
- const physical = vtClosestScope(parent);
3130
- if (physical !== null) return physical;
3131
- return parent.nodeType === 9 ? parent : parent.ownerDocument;
3141
+ for (let current = block; current !== null; current = current.parentBlock) {
3142
+ const parent = current.parentNode;
3143
+ const physical = vtClosestScope(parent);
3144
+ if (physical !== null) return physical;
3145
+ const owner = parent.nodeType === 9 ? parent : parent.ownerDocument;
3146
+ if (owner.defaultView !== null) return owner;
3147
+ }
3148
+ return null;
3132
3149
  }
3133
3150
  function vtCaptureElements(block, owner) {
3134
3151
  return vtRangeElements(block).filter((element) => {
@@ -3176,7 +3193,7 @@ function vtPrepareScopeBoundary(block) {
3176
3193
  const state = vtBoundaryState(block);
3177
3194
  if (state.scopeHost !== null && state.scopeHost !== host) vtReleaseScopeBoundary(block);
3178
3195
  if (host === null) {
3179
- if (process.env.NODE_ENV !== "production" && block.vt?.scope === "element" && !inInactiveSubtree(block) && !VT_INVALID_SCOPE_WARNED.has(block)) {
3196
+ if (__octaneDev && block.vt?.scope === "element" && !inInactiveSubtree(block) && !VT_INVALID_SCOPE_WARNED.has(block)) {
3180
3197
  VT_INVALID_SCOPE_WARNED.add(block);
3181
3198
  console.error(
3182
3199
  'ViewTransition scope="element" requires exactly one host element without non-whitespace text siblings. This declaration will commit without its own animation.'
@@ -3984,7 +4001,7 @@ const ACT_DRAIN_LIMIT = NESTED_UPDATE_LIMIT + 50;
3984
4001
  let UPDATE_CHAIN_ID = 0;
3985
4002
  let PASSIVE_UPDATE_COUNTS = null;
3986
4003
  function countPassiveUpdate(block) {
3987
- if (process.env.NODE_ENV === "production") return;
4004
+ if (!__octaneDev) return;
3988
4005
  const counts = PASSIVE_UPDATE_COUNTS ??= /* @__PURE__ */ new WeakMap();
3989
4006
  let state = counts.get(block);
3990
4007
  if (state === void 0 || state.chain !== UPDATE_CHAIN_ID) {
@@ -4014,7 +4031,7 @@ function componentName(block) {
4014
4031
  return body.displayName || body.name || "Unknown";
4015
4032
  }
4016
4033
  function warnCrossComponentRenderUpdate(target, source) {
4017
- if (process.env.NODE_ENV === "production") return;
4034
+ if (!__octaneDev) return;
4018
4035
  const warnings = CROSS_RENDER_WARNINGS ??= /* @__PURE__ */ new WeakMap();
4019
4036
  let sources = warnings.get(target.body);
4020
4037
  if (sources === void 0) warnings.set(target.body, sources = /* @__PURE__ */ new WeakSet());
@@ -4026,12 +4043,12 @@ function warnCrossComponentRenderUpdate(target, source) {
4026
4043
  }
4027
4044
  function scheduleRender(block) {
4028
4045
  if (block.disposed) return;
4029
- if (process.env.NODE_ENV !== "production" && CURRENT_EFFECT_PHASE === INSERTION) {
4046
+ if (__octaneDev && CURRENT_EFFECT_PHASE === INSERTION) {
4030
4047
  console.error(
4031
4048
  "useInsertionEffect must not schedule state updates. Move this work to a layout or passive effect."
4032
4049
  );
4033
4050
  }
4034
- if (process.env.NODE_ENV !== "production" && isActEnvironment() && actScopeDepth === 0 && !syncFlush) {
4051
+ if (__octaneDev && isActEnvironment() && actScopeDepth === 0 && !syncFlush) {
4035
4052
  console.error(
4036
4053
  `An update to ${componentName(block)} was not wrapped in act(...).
4037
4054
 
@@ -4653,7 +4670,7 @@ function flushWork() {
4653
4670
  }
4654
4671
  }
4655
4672
  function vtCheckNames(group) {
4656
- if (process.env.NODE_ENV === "production") return;
4673
+ if (!__octaneDev) return;
4657
4674
  const names = /* @__PURE__ */ new Map();
4658
4675
  for (const rec of group.recs)
4659
4676
  for (const el of rec.els) {
@@ -4837,6 +4854,8 @@ function vtFinalizeGroup(group, types) {
4837
4854
  while (ancestor !== null && !active.has(ancestor))
4838
4855
  ancestor = vtNearestBoundaryAncestor(ancestor);
4839
4856
  if (ancestor === null) vtCancelOldCapture(rec, cancelledAnimations);
4857
+ else if (visibleAfter.has(rec.block))
4858
+ vtApplyStyles(rec, vtResolveClass(rec.props, "update", types));
4840
4859
  }
4841
4860
  vtCheckNames(group);
4842
4861
  const root = owner.documentElement;
@@ -5310,7 +5329,7 @@ function drainPassivesBeforeRender() {
5310
5329
  }
5311
5330
  }
5312
5331
  function flushSync(fn) {
5313
- if (process.env.NODE_ENV !== "production" && (CURRENT_BLOCK !== null || EFFECT_BODY_DEPTH > 0 || REF_CALLBACK_DEPTH > 0)) {
5332
+ if (__octaneDev && (CURRENT_BLOCK !== null || EFFECT_BODY_DEPTH > 0 || REF_CALLBACK_DEPTH > 0)) {
5314
5333
  console.error(
5315
5334
  "flushSync was called while rendering or running a lifecycle callback. Move the call to an event or scheduled task."
5316
5335
  );
@@ -6404,7 +6423,7 @@ function runEffectBody(e) {
6404
6423
  reportEffectError(e.scope.block, err);
6405
6424
  return;
6406
6425
  }
6407
- if (process.env.NODE_ENV !== "production" && cleanup !== void 0 && typeof cleanup !== "function") {
6426
+ if (__octaneDev && cleanup !== void 0 && typeof cleanup !== "function") {
6408
6427
  const name = e.phase === PASSIVE ? "useEffect" : e.phase === LAYOUT ? "useLayoutEffect" : "useInsertionEffect";
6409
6428
  const thenable = cleanup !== null && typeof cleanup.then === "function";
6410
6429
  console.error(
@@ -7050,12 +7069,12 @@ function renderReturnedValue(block, out, reset) {
7050
7069
  block.parentNode,
7051
7070
  d.type,
7052
7071
  d.props,
7072
+ d.__octaneInvocationSite,
7053
7073
  block.endMarker,
7054
- d.key ?? void 0,
7055
7074
  true,
7056
7075
  void 0,
7057
- activeHydration() !== null && elementKeyWasProvided(d),
7058
- d.__octaneInvocationSite
7076
+ d.key ?? void 0,
7077
+ activeHydration() !== null && elementKeyWasProvided(d)
7059
7078
  )
7060
7079
  );
7061
7080
  } else {
@@ -7065,32 +7084,21 @@ function renderReturnedValue(block, out, reset) {
7065
7084
  block.parentNode,
7066
7085
  d.type,
7067
7086
  d.props,
7087
+ d.__octaneInvocationSite,
7068
7088
  block.endMarker,
7069
- d.key ?? void 0,
7070
7089
  true,
7071
7090
  void 0,
7072
- activeHydration() !== null && elementKeyWasProvided(d),
7073
- d.__octaneInvocationSite
7091
+ d.key ?? void 0,
7092
+ activeHydration() !== null && elementKeyWasProvided(d)
7074
7093
  );
7075
7094
  }
7076
7095
  } else {
7077
7096
  const returnHydration = activeHydration();
7078
- if (returnHydration !== null && block.slots[0] === void 0 && block.startMarker !== null && block.endMarker !== null && block.startMarker !== block.endMarker && block.startMarker.nodeType === 8 && block.endMarker.nodeType === 8 && (getNextSibling(block.startMarker) === block.endMarker || returnHydration.isUnframedRootRange(block.startMarker, block.endMarker))) {
7079
- const borrowed = {
7080
- __kind: "childSlot",
7081
- start: block.startMarker,
7082
- end: block.endMarker,
7083
- ownerHost: null,
7084
- borrowed: true,
7085
- compactable: false,
7086
- block: null,
7087
- text: null,
7088
- currentComp: null,
7089
- currentIsBodyFn: false,
7090
- forSlot: null,
7091
- hostNode: null,
7092
- portal: null
7093
- };
7097
+ if (returnHydration !== null && block.slots[0] === void 0 && block.startMarker !== null && block.endMarker !== null && block.startMarker !== block.endMarker && block.startMarker.nodeType === 8 && block.endMarker.nodeType === 8 && (getNextSibling(block.startMarker) === block.endMarker || returnHydration.isUnframedRootRange(block.startMarker, block.endMarker) || isComponentDescriptor && returnHydration.holdsServerText(block))) {
7098
+ const borrowed = returnHydration.lendRange(
7099
+ block.startMarker,
7100
+ block.endMarker
7101
+ );
7094
7102
  block.slots[0] = borrowed;
7095
7103
  registerSlot(block, borrowed);
7096
7104
  }
@@ -7198,7 +7206,7 @@ class LiteBlockImpl {
7198
7206
  this.signalInstanceResolved = void 0;
7199
7207
  }
7200
7208
  }
7201
- function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invocationSite) {
7209
+ function componentSlotLite(parentScope, slotKey, host, comp, props, invocationSite, anchor) {
7202
7210
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
7203
7211
  if (parentScope === SHARED_BODY_SCOPE) {
7204
7212
  componentSlotImpl(
@@ -7228,8 +7236,8 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invo
7228
7236
  host,
7229
7237
  comp,
7230
7238
  props,
7231
- anchor,
7232
- invocationSite
7239
+ invocationSite,
7240
+ anchor
7233
7241
  );
7234
7242
  return;
7235
7243
  }
@@ -7298,9 +7306,9 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invo
7298
7306
  }
7299
7307
  if (hydration !== null && adoptedClose !== null) hydration.node = getNextSibling(adoptedClose);
7300
7308
  }
7301
- function suspendFreshLiteComponent(hydration, parentScope, slotKey, host, comp, props, anchor, invocationSite) {
7309
+ function suspendFreshLiteComponent(hydration, parentScope, slotKey, host, comp, props, invocationSite, anchor) {
7302
7310
  hydration.suspend(
7303
- () => componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invocationSite)
7311
+ () => componentSlotLite(parentScope, slotKey, host, comp, props, invocationSite, anchor)
7304
7312
  );
7305
7313
  }
7306
7314
  let TEARDOWN_DEPTH = 0;
@@ -8094,7 +8102,7 @@ function depsChanged(prev, next, hook = false) {
8094
8102
  let length = prev.length;
8095
8103
  if (length !== next.length) {
8096
8104
  if (!hook) return true;
8097
- if (process.env.NODE_ENV !== "production") {
8105
+ if (__octaneDev) {
8098
8106
  console.error(
8099
8107
  `The dependency array must keep the same length between renders (previous: ${length}, next: ${next.length}).`
8100
8108
  );
@@ -8308,7 +8316,7 @@ function useMemo(compute, deps, slot) {
8308
8316
  const scope = CURRENT_SCOPE;
8309
8317
  const entry = readMemoEntry(scope, s, d);
8310
8318
  if (entry !== null) return entry.value;
8311
- const value = process.env.NODE_ENV !== "production" ? computeMemoWithDiagnostics(compute, d) : compute.apply(null, d ?? []);
8319
+ const value = __octaneDev ? computeMemoWithDiagnostics(compute, d) : compute.apply(null, d ?? []);
8312
8320
  return publishMemoEntry(scope, s, d, value);
8313
8321
  }
8314
8322
  function useCallback(fn, deps, slot) {
@@ -8533,7 +8541,7 @@ function useSyncExternalStore(subscribe, getSnapshot, serverSnapshotOrSlot = voi
8533
8541
  const subs = usesSubslots(slot);
8534
8542
  const readSnapshot = activeHydration() !== null && getServerSnapshot !== void 0 ? getServerSnapshot : getSnapshot;
8535
8543
  const value = readSnapshot();
8536
- if (process.env.NODE_ENV !== "production" && !DID_WARN_UNCACHED_SNAPSHOT && !Object.is(value, readSnapshot())) {
8544
+ if (__octaneDev && !DID_WARN_UNCACHED_SNAPSHOT && !Object.is(value, readSnapshot())) {
8537
8545
  DID_WARN_UNCACHED_SNAPSHOT = true;
8538
8546
  console.error(
8539
8547
  "The " + (readSnapshot === getSnapshot ? "getSnapshot" : "getServerSnapshot") + " result must be cached to avoid an infinite update loop."
@@ -8555,7 +8563,7 @@ function useSyncExternalStore(subscribe, getSnapshot, serverSnapshotOrSlot = voi
8555
8563
  } : () => scheduleStoreRender(block),
8556
8564
  onStoreChange: () => {
8557
8565
  if (block.disposed) return;
8558
- if (CURRENT_BLOCK === null && block.pending && block.pendingMode === "urgent" && !block.pendingDeferred && !(typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) && (process.env.NODE_ENV === "production" || !isActEnvironment() || actScopeDepth !== 0 || syncFlush)) {
8566
+ if (CURRENT_BLOCK === null && block.pending && block.pendingMode === "urgent" && !block.pendingDeferred && !(typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) && (!__octaneDev || !isActEnvironment() || actScopeDepth !== 0 || syncFlush)) {
8559
8567
  return;
8560
8568
  }
8561
8569
  if (checkStoreChanged(created)) created.forceUpdate();
@@ -8641,7 +8649,7 @@ function initializeContext(ctx, defaultValue) {
8641
8649
  ctx.defaultValue = defaultValue;
8642
8650
  ctx.$$version = 0;
8643
8651
  (0, import_context_identity.registerContext)(ctx);
8644
- if (process.env.NODE_ENV !== "production") {
8652
+ if (__octaneDev) {
8645
8653
  (0, import_context_identity.defineRemovedContextMembers)(ctx);
8646
8654
  }
8647
8655
  return ctx;
@@ -8986,7 +8994,7 @@ function preserveSuspendedHydrateActivation(state, hydration, thenable) {
8986
8994
  state.serverActivationStarted = false;
8987
8995
  scheduleRender(state.parentBlock);
8988
8996
  };
8989
- thenable.then(resume, resume);
8997
+ resumeOnSettle(thenable, resume);
8990
8998
  }
8991
8999
  function hydrateStrategyType(when) {
8992
9000
  return typeof when === "function" ? "dynamic" : when?._t ?? "dynamic";
@@ -10039,7 +10047,7 @@ const ErrorBoundary = /* @__PURE__ */ (0, import_component_flags.markComponentFl
10039
10047
  );
10040
10048
  const TsrxErrorBoundary = ErrorBoundary;
10041
10049
  function use(usable) {
10042
- if (process.env.NODE_ENV !== "production" && devMemoComputeDepth !== 0) {
10050
+ if (__octaneDev && devMemoComputeDepth !== 0) {
10043
10051
  console.error(
10044
10052
  "Do not call use() inside a useMemo() factory. Cached factories can skip context or promise reads; call use() before useMemo() and memoize the returned value instead."
10045
10053
  );
@@ -10464,7 +10472,7 @@ function useThenable(thenable, replaceOnResume = false) {
10464
10472
  throw new SuspenseException(thenable);
10465
10473
  }
10466
10474
  if (stored !== void 0 && RESUME_REPLAY && !replaceOnResume) {
10467
- if (process.env.NODE_ENV !== "production") warnUncachedUsePromise(block);
10475
+ if (__octaneDev) warnUncachedUsePromise(block);
10468
10476
  if (stored.status === "fulfilled") return stored.value;
10469
10477
  if (stored.status === "rejected") throw stored.reason;
10470
10478
  throw new SuspenseException(stored);
@@ -10473,10 +10481,18 @@ function useThenable(thenable, replaceOnResume = false) {
10473
10481
  trackThenable(thenable);
10474
10482
  if (thenable.status === "fulfilled") return thenable.value;
10475
10483
  if (thenable.status === "rejected") throw thenable.reason;
10476
- if (process.env.NODE_ENV !== "production" && RESUME_REPLAY && idx > 0 && state[idx - 1] !== void 0)
10484
+ if (__octaneDev && RESUME_REPLAY && idx > 0 && state[idx - 1] !== void 0)
10477
10485
  warnUseWaterfall(block, idx);
10478
10486
  throw new SuspenseException(thenable);
10479
10487
  }
10488
+ let SETTLED_WAKEABLES = null;
10489
+ function resumeOnSettle(wakeable, retry) {
10490
+ const onSettle = SETTLED_WAKEABLES?.has(wakeable) === true ? () => void setTimeout(retry, 0) : () => {
10491
+ (SETTLED_WAKEABLES ??= /* @__PURE__ */ new WeakSet()).add(wakeable);
10492
+ retry();
10493
+ };
10494
+ wakeable.then(onSettle, onSettle);
10495
+ }
10480
10496
  function trackThenable(thenable) {
10481
10497
  if (thenable.status !== void 0) return;
10482
10498
  thenable.status = "pending";
@@ -10498,7 +10514,7 @@ function devHintsEnabled() {
10498
10514
  }
10499
10515
  const warnedUncached = /* @__PURE__ */ new WeakSet();
10500
10516
  function warnUncachedUsePromise(block) {
10501
- if (process.env.NODE_ENV === "production") return;
10517
+ if (!__octaneDev) return;
10502
10518
  if (!devHintsEnabled() || warnedUncached.has(block)) return;
10503
10519
  warnedUncached.add(block);
10504
10520
  console.error(
@@ -10507,7 +10523,7 @@ function warnUncachedUsePromise(block) {
10507
10523
  }
10508
10524
  const warnedWaterfall = /* @__PURE__ */ new WeakSet();
10509
10525
  function warnUseWaterfall(block, idx) {
10510
- if (process.env.NODE_ENV === "production") return;
10526
+ if (!__octaneDev) return;
10511
10527
  if (!devHintsEnabled() || warnedWaterfall.has(block)) return;
10512
10528
  warnedWaterfall.add(block);
10513
10529
  console.error(
@@ -10763,7 +10779,7 @@ function warmChild(comp, props) {
10763
10779
  const plan = comp.__warm;
10764
10780
  if (typeof plan !== "function") return;
10765
10781
  if (WARM_DEPTH >= WARM_DEPTH_CAP) {
10766
- if (process.env.NODE_ENV !== "production" && devHintsEnabled()) {
10782
+ if (__octaneDev && devHintsEnabled()) {
10767
10783
  console.error(
10768
10784
  `warmChild: fetch-tree warm walk exceeded ${WARM_DEPTH_CAP} levels \u2014 stopping speculative prefetch here (rendering is unaffected). Is a recursive component missing its termination guard?`
10769
10785
  );
@@ -11273,7 +11289,7 @@ function initDomOperations() {
11273
11289
  seedExpando(elementProto, DANGER_HTML_SPREAD_CHILD, false);
11274
11290
  seedExpando(elementProto, DEOPT_DESC, false);
11275
11291
  seedExpando(elementProto, DEFAULT_VALUE_BASELINE, false);
11276
- if (process.env.NODE_ENV !== "production") {
11292
+ if (__octaneDev) {
11277
11293
  seedExpando(elementProto, "__oct_loc");
11278
11294
  }
11279
11295
  }
@@ -11329,16 +11345,16 @@ function template(html, ns = 0, frag = 0) {
11329
11345
  }
11330
11346
  };
11331
11347
  }
11332
- function templateRootDescriptor(html) {
11333
- if (html.charCodeAt(0) !== 60) return 3;
11334
- const c = html.charCodeAt(1);
11348
+ function templateRootDescriptor(html, at = 0) {
11349
+ if (html.charCodeAt(at) !== 60) return 3;
11350
+ const c = html.charCodeAt(at + 1);
11335
11351
  if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90)) return 8;
11336
- let i = 2;
11352
+ let i = at + 2;
11337
11353
  for (; i < html.length; i++) {
11338
11354
  const cc = html.charCodeAt(i);
11339
11355
  if (cc === 62 || cc === 47 || cc <= 32) break;
11340
11356
  }
11341
- return html.slice(1, i);
11357
+ return html.slice(at + 1, i);
11342
11358
  }
11343
11359
  function lazyRootDescriptor(lazy2) {
11344
11360
  const root = lazy2.root;
@@ -11354,6 +11370,16 @@ function lazyRootMatches(server, lazy2) {
11354
11370
  if (server.nodeType !== 1) return false;
11355
11371
  return server.localName === root;
11356
11372
  }
11373
+ function lazyFragmentRootMatches(server, lazy2) {
11374
+ const root = lazy2.frag !== 0 ? lazyRootDescriptor(lazy2) : templateRootDescriptor(
11375
+ lazy2.html,
11376
+ 13
11377
+ /* '<octane-frag>'.length */
11378
+ );
11379
+ if (root === 8) return true;
11380
+ if (root === 3) return server.nodeType === 3;
11381
+ return server.nodeType === 1 && server.localName === root;
11382
+ }
11357
11383
  function resolveLazyTemplate(lazy2) {
11358
11384
  let ns;
11359
11385
  if (lazy2.ns === 3) {
@@ -11370,6 +11396,8 @@ function resolveLazyTemplate(lazy2) {
11370
11396
  return parsed;
11371
11397
  }
11372
11398
  let currentHydration = null;
11399
+ let HYDRATION_REBUILT = null;
11400
+ let HYDRATION_REBUILT_HOSTS = null;
11373
11401
  function activeHydration() {
11374
11402
  const hydration = currentHydration;
11375
11403
  return hydration !== null && hydration.isActive() ? hydration : null;
@@ -11377,6 +11405,31 @@ function activeHydration() {
11377
11405
  function isRendererHydrationStyle(node) {
11378
11406
  return node.nodeType === 1 && node.localName === "style" && (STAGED_DOM?.view(node) ?? node).hasAttribute("data-octane");
11379
11407
  }
11408
+ function isFloatHeadResource(node) {
11409
+ if (node.nodeType !== 1) return false;
11410
+ const el = STAGED_DOM?.view(node) ?? node;
11411
+ const tag = el.localName;
11412
+ return (tag === "link" || tag === "style" || tag === "script") && (el.hasAttribute("data-precedence") || el.hasAttribute("data-oct-hint") || el.hasAttribute("data-oct-res"));
11413
+ }
11414
+ function skipFoldedHeadPrefix(container, node) {
11415
+ const head = container.nodeType === 9 ? null : container.ownerDocument.head;
11416
+ while (node !== null) {
11417
+ if (node.nodeType === 10 || isRendererHydrationStyle(node) || isFloatHeadResource(node)) {
11418
+ node = getNextSibling(node);
11419
+ continue;
11420
+ }
11421
+ const el = head !== null && node.nodeType === 8 ? getNextSibling(node) : null;
11422
+ const end = el === null ? null : getNextSibling(el);
11423
+ if (end === null || end.nodeType !== 8) return node;
11424
+ const key = (STAGED_DOM?.view(node) ?? node).data;
11425
+ if (!key.startsWith("rnh-") || (STAGED_DOM?.view(end) ?? end).data !== "/" + key)
11426
+ return node;
11427
+ const next = getNextSibling(end);
11428
+ (STAGED_DOM?.view(head) ?? head).append(node, el, end);
11429
+ node = next;
11430
+ }
11431
+ return null;
11432
+ }
11380
11433
  class HydrationCapability {
11381
11434
  constructor(rootBlock, node, seeds) {
11382
11435
  this.rootBlock = rootBlock;
@@ -11406,6 +11459,8 @@ class HydrationCapability {
11406
11459
  textWarnings = /* @__PURE__ */ new Map();
11407
11460
  /** Skip component-frame adoption until the declared container owner. */
11408
11461
  passthroughRanges = false;
11462
+ /** A slot lent a server range whose first render has yet to claim it. */
11463
+ lentSlot = null;
11409
11464
  nativeAdoption;
11410
11465
  retryPresentation;
11411
11466
  presentation;
@@ -11454,14 +11509,155 @@ class HydrationCapability {
11454
11509
  }
11455
11510
  /** DEV-only: every caller is dev-gated, so prod must not retain the describer. */
11456
11511
  describe(node) {
11457
- return process.env.NODE_ENV === "production" ? "" : describeHydrationNode(node);
11512
+ return !__octaneDev ? "" : describeHydrationNode(node);
11458
11513
  }
11459
11514
  warnStructural(loc, expected, actual) {
11460
11515
  warnHydrationStructuralMismatch(loc, expected, actual);
11461
11516
  }
11517
+ /**
11518
+ * A slot for the range `start`…`end` that a list item or a returning
11519
+ * component adopted, lent to the child slot that renders its value, so that
11520
+ * the value hydrates inside that range rather than claiming a range of its
11521
+ * own. The slot's first render claims the server range as an adopted one.
11522
+ */
11523
+ lendRange(start, end) {
11524
+ const slot = {
11525
+ __kind: "childSlot",
11526
+ start,
11527
+ end,
11528
+ ownerHost: null,
11529
+ borrowed: true,
11530
+ compactable: false,
11531
+ block: null,
11532
+ text: null,
11533
+ currentComp: null,
11534
+ currentIsBodyFn: false,
11535
+ forSlot: null,
11536
+ hostNode: null,
11537
+ portal: null
11538
+ };
11539
+ if (this.isOpen(start)) this.lentSlot = slot;
11540
+ return slot;
11541
+ }
11542
+ /**
11543
+ * Before a child slot's first hydrating render of the server range
11544
+ * `start`…`end`, which it adopted or was lent, check that `value` can adopt
11545
+ * what the range holds. A host descriptor serializes as exactly one element
11546
+ * of its tag. A list (`list`, from prepareDeoptList) frames or self-delimits
11547
+ * each of its items, so it neither leaves the range empty nor opens it with
11548
+ * text, unless it has no items, and then the range is empty. A portal does
11549
+ * not open it with text either. Anything else is server content the client
11550
+ * cannot adopt: what the server rendered for another value, or invalid
11551
+ * nesting that the HTML parser repaired (`<p><div></div></p>` arrives as
11552
+ * `<p></p><div></div><p></p>`, all inside the range). Discard it, as
11553
+ * renderBranchSlot's rebuild does. Returns whether it did, in which case the
11554
+ * caller builds the value as a client mount would.
11555
+ */
11556
+ claimRange(scope, slotKey, start, end, value, list) {
11557
+ const rebuilt = HYDRATION_REBUILT?.has(end) === true;
11558
+ const type = list === null && isHostDescriptor(value) ? value.type : null;
11559
+ if (!rebuilt && type === null && list === null && value?.$$kind !== import_runtime_tags.PORTAL_TAG)
11560
+ return false;
11561
+ const first = getNextSibling(start);
11562
+ const matches = type !== null && first !== end && first.nodeType === 1 && isHostElementOfType(first, type);
11563
+ if (!rebuilt && (type !== null ? matches && getNextSibling(first) === end : list !== null && first === end ? list.items.length === 0 : first.nodeType !== 3 && list?.items.length !== 0))
11564
+ return false;
11565
+ return this.discard(
11566
+ scope,
11567
+ slotKey,
11568
+ first,
11569
+ end,
11570
+ // Items that render nothing differ from an empty range only in the
11571
+ // frames the server would have given them: rebuild those quietly.
11572
+ rebuilt || list !== null && first === end && !list.items.some((item) => item != null && typeof item !== "boolean" && item !== ""),
11573
+ __octaneDev ? type !== null ? matches ? `the end of <${type}>` : `<${type}>` : list?.items.length === 0 ? "nothing" : list !== null ? "a renderable list range" : "a portal" : "",
11574
+ matches ? getNextSibling(first) : first === end ? null : first
11575
+ );
11576
+ }
11577
+ /**
11578
+ * A child slot's first hydrating render without a server range of its own,
11579
+ * such as a return slot's when its component's range holds server text. A
11580
+ * list, a fragment, a keyed or lone element, and a portal never serialize as
11581
+ * bare text, so a lone text node before `end` in `parent` is what the server
11582
+ * rendered for a primitive, which the value cannot adopt. Discard it; returns
11583
+ * whether it did. An earlier attempt that did so left its own content there.
11584
+ */
11585
+ discardServerText(scope, slotKey, parent, end, value, list) {
11586
+ const text = this.node;
11587
+ if (end !== null && HYDRATION_REBUILT?.has(end) === true) {
11588
+ let node = text;
11589
+ while (node !== null && node !== end) node = getNextSibling(node);
11590
+ return this.discard(scope, slotKey, node === end ? text : null, end, true, "", null);
11591
+ }
11592
+ if (text === null || text.nodeType !== 3 || !(list || value?.$$kind === import_runtime_tags.PORTAL_TAG || isHostDescriptor(value)) || domNode(text).parentNode !== parent || getNextSibling(text) !== end)
11593
+ return false;
11594
+ return this.discard(
11595
+ scope,
11596
+ slotKey,
11597
+ text,
11598
+ end,
11599
+ false,
11600
+ __octaneDev ? list ? "a renderable list range" : value.$$kind === import_runtime_tags.PORTAL_TAG ? "a portal" : `<${value.type}>` : "",
11601
+ text
11602
+ );
11603
+ }
11604
+ /**
11605
+ * A list item's first hydrating render where the server content at the
11606
+ * cursor cannot be that item: the server rendered fewer items, a bare item
11607
+ * where this one needs a range of its own, or an item of another tag.
11608
+ * Discard the list's server content from the cursor to its `end`, so that
11609
+ * this item and every later one build as a client mount would. The list
11610
+ * reports once, and an earlier attempt that rebuilt it left its own content.
11611
+ */
11612
+ discardItems(end, expected) {
11613
+ const from = this.node;
11614
+ let node = from;
11615
+ while (node !== null && node !== end) node = getNextSibling(node);
11616
+ const stale = node === end && from !== end ? from : null;
11617
+ this.discard(null, 0, stale, end, HYDRATION_REBUILT?.has(end) === true, expected, stale);
11618
+ }
11619
+ /**
11620
+ * STRUCTURAL recovery for a list where the SERVER rendered MORE items than the
11621
+ * client now renders: after its first fill adopts the client's items, the
11622
+ * cursor sits on the first unconsumed server item (or at `end`). Discard
11623
+ * everything between the cursor and `end` so the extra server items don't
11624
+ * linger. Only when the cursor precedes `end`; stops AT `end`.
11625
+ */
11626
+ discardLeftoverItems(end) {
11627
+ const from = this.node;
11628
+ if (from === end) return;
11629
+ let node = from;
11630
+ while (node !== null && node !== end) node = getNextSibling(node);
11631
+ if (node === null) return;
11632
+ if (!this.staleServerValues)
11633
+ noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(56)));
11634
+ removeRange(from, end);
11635
+ }
11636
+ /**
11637
+ * Remove the server content from `from` up to `end` that a child slot's
11638
+ * value cannot adopt, and point the cursor at `end`. Reports the structural
11639
+ * mismatch (`expected`, and the `actual` server node, describe it in
11640
+ * development) unless it is `quiet`, as it is when an earlier attempt already
11641
+ * rebuilt this content, or the captures legitimately changed before a dormant
11642
+ * boundary activated. Remembers `end` for later attempts.
11643
+ */
11644
+ discard(scope, slotKey, from, end, quiet, expected, actual) {
11645
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11646
+ if (!quiet && !this.staleServerValues) {
11647
+ noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(51)));
11648
+ if (__octaneDev) {
11649
+ const loc = scope !== null && (siteLoc(scope, slotKey) || componentSourceLoc(scope.block.body)) || domNode(from ?? end).parentNode?.__oct_loc;
11650
+ if (loc) warnHydrationStructuralMismatch(loc, expected, describeHydrationNode(actual));
11651
+ }
11652
+ }
11653
+ removeRange(from, end);
11654
+ if (end !== null) (HYDRATION_REBUILT ??= /* @__PURE__ */ new WeakSet()).add(end);
11655
+ this.node = end;
11656
+ return true;
11657
+ }
11462
11658
  recordTextMismatch(node, loc, server) {
11463
11659
  if (this.staleServerValues) return;
11464
- if (process.env.NODE_ENV === "production" && ROOT_ERROR_HANDLERS === null) return;
11660
+ if (!__octaneDev && ROOT_ERROR_HANDLERS === null) return;
11465
11661
  if (!this.textWarnings.has(node)) this.textWarnings.set(node, { loc, server });
11466
11662
  }
11467
11663
  flushTextWarnings() {
@@ -11470,7 +11666,7 @@ class HydrationCapability {
11470
11666
  const client = (STAGED_DOM?.view(node) ?? node).nodeValue;
11471
11667
  if (pending.server !== client) {
11472
11668
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(61)), this.rootBlock);
11473
- if (process.env.NODE_ENV !== "production")
11669
+ if (__octaneDev)
11474
11670
  warnHydrationValueMismatch(pending.loc, "text", pending.server, client);
11475
11671
  }
11476
11672
  }
@@ -11479,6 +11675,35 @@ class HydrationCapability {
11479
11675
  removeRange(start, end) {
11480
11676
  removeHydrationRange(start, end);
11481
11677
  }
11678
+ /**
11679
+ * Runs before the first hydrating render of a text or empty value `str` in a
11680
+ * child slot that adopted the server's `<!--[-->…<!--]-->` range. The value
11681
+ * serializes as at most one text node there, which the slot adopts when it
11682
+ * leads the range. Anything else in the range is server content the client
11683
+ * cannot adopt, such as an element or component the server rendered for a
11684
+ * value the client renders as text or nothing. Discard it and report the
11685
+ * recovery, as claimRange does for a host descriptor.
11686
+ */
11687
+ discardUnadoptedText(scope, slotKey, state, str) {
11688
+ const end = state.end;
11689
+ const first = getNextSibling(state.start);
11690
+ const kept = str !== "" && first.nodeType === 3;
11691
+ const stale = kept ? getNextSibling(first) : first;
11692
+ if (stale === end) return;
11693
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11694
+ if (!this.staleServerValues) {
11695
+ noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(51)));
11696
+ if (__octaneDev) {
11697
+ const loc = siteLoc(scope, slotKey);
11698
+ if (loc) {
11699
+ const client = str === "" ? "nothing" : `text ${JSON.stringify(str)}`;
11700
+ this.warnStructural(loc, kept ? `the end of ${client}` : client, this.describe(stale));
11701
+ }
11702
+ }
11703
+ }
11704
+ removeRange(stale, end);
11705
+ if (!kept) this.node = end;
11706
+ }
11482
11707
  parseSeeds(raw) {
11483
11708
  return parseSeedJson(raw);
11484
11709
  }
@@ -11574,6 +11799,14 @@ class HydrationCapability {
11574
11799
  isUnframedRootRange(start, end) {
11575
11800
  return this.unframedRootRanges.get(start) === end;
11576
11801
  }
11802
+ /**
11803
+ * Whether `block`'s server range holds only unclaimed text at the cursor:
11804
+ * what the server rendered for a primitive.
11805
+ */
11806
+ holdsServerText(block) {
11807
+ const text = this.node;
11808
+ return text !== null && text.nodeType === 3 && getNextSibling(block.startMarker) === text && getNextSibling(text) === block.endMarker;
11809
+ }
11577
11810
  /** Record the first node outside a root-owned range exactly once. */
11578
11811
  claimRootRemainder(node) {
11579
11812
  if (this.rootRemainder === void 0) this.rootRemainder = node;
@@ -11628,7 +11861,7 @@ class HydrationCapability {
11628
11861
  abandonRoot(diagnostic) {
11629
11862
  if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11630
11863
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(52)));
11631
- if (process.env.NODE_ENV !== "production" && diagnostic !== void 0) {
11864
+ if (__octaneDev && diagnostic !== void 0) {
11632
11865
  const [loc, expected, actual] = diagnostic();
11633
11866
  if (loc) warnHydrationStructuralMismatch(loc, expected, actual);
11634
11867
  }
@@ -11671,7 +11904,7 @@ class HydrationCapability {
11671
11904
  if (template2 === null) template2 = resolveLazyTemplate(lazy2);
11672
11905
  if (!this.staleServerValues) {
11673
11906
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(51)));
11674
- if (process.env.NODE_ENV !== "production")
11907
+ if (__octaneDev)
11675
11908
  warnHydrationStructuralMismatch(
11676
11909
  loc ?? componentSourceLoc(CURRENT_BLOCK?.body) ?? CURRENT_SCOPE?.locFile,
11677
11910
  "a non-empty fragment",
@@ -11686,7 +11919,7 @@ class HydrationCapability {
11686
11919
  if (remainder === void 0) {
11687
11920
  const fragment = template2;
11688
11921
  this.abandonRoot(
11689
- process.env.NODE_ENV !== "production" ? () => [
11922
+ __octaneDev ? () => [
11690
11923
  componentSourceLoc(this.rootBlock.body),
11691
11924
  `a fragment starting with ${describeHydrationNode(getFirstChild(fragment))}`,
11692
11925
  describeHydrationNode(cursor)
@@ -11706,7 +11939,7 @@ class HydrationCapability {
11706
11939
  if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11707
11940
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(51)));
11708
11941
  if (template2 === null) template2 = resolveLazyTemplate(lazy2);
11709
- if (process.env.NODE_ENV !== "production" && loc)
11942
+ if (__octaneDev && loc)
11710
11943
  warnHydrationStructuralMismatch(
11711
11944
  loc,
11712
11945
  describeHydrationNode(template2),
@@ -11716,14 +11949,7 @@ class HydrationCapability {
11716
11949
  const target = CURRENT_BLOCK?.parentNode;
11717
11950
  if (!claimsRoot && target != null && (STAGED_DOM?.view(cursor) ?? cursor).parentNode !== target)
11718
11951
  return this.freshClone(template2);
11719
- if (isBlockOpen(cursor)) {
11720
- const close = this.close(cursor);
11721
- this.node = getNextSibling(close);
11722
- removeHydrationRange(cursor, close);
11723
- } else {
11724
- this.node = getNextSibling(cursor);
11725
- (STAGED_DOM?.view(cursor) ?? cursor).remove();
11726
- }
11952
+ this.discardCursor(cursor);
11727
11953
  if (claimsRoot)
11728
11954
  this.claimRootRemainder(
11729
11955
  framedRemainder === void 0 ? unframedRemainder ?? null : framedRemainder
@@ -11731,7 +11957,9 @@ class HydrationCapability {
11731
11957
  return this.freshClone(template2);
11732
11958
  }
11733
11959
  if (isFragment) {
11734
- return { __oct_vfrag: true, firstChild: cursor };
11960
+ if (claimsRoot || (template2 !== null ? fragmentRootMatches(cursor, template2, partialStyles) : lazyFragmentRootMatches(cursor, lazy2)))
11961
+ return { __oct_vfrag: true, firstChild: cursor };
11962
+ return this.rebuildFragment(template2 ?? resolveLazyTemplate(lazy2), cursor, loc);
11735
11963
  }
11736
11964
  if (claimsRoot)
11737
11965
  this.claimRootRemainder(
@@ -11739,6 +11967,52 @@ class HydrationCapability {
11739
11967
  );
11740
11968
  return cursor;
11741
11969
  }
11970
+ /**
11971
+ * The server rendered something other than this nested fragment at the
11972
+ * cursor (a text value, another component's roots). Report it once and build
11973
+ * the fragment on the client. The fragment's block owns the server nodes from
11974
+ * the cursor up to its end marker, where drainFrag inserts the fresh roots, so
11975
+ * discard them. When the end marker does not follow the cursor inside the
11976
+ * block's range, discard only the cursor node or its range, as a single-root
11977
+ * mismatch does.
11978
+ */
11979
+ rebuildFragment(template2, cursor, loc) {
11980
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11981
+ if (!this.staleServerValues) {
11982
+ noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(51)));
11983
+ if (__octaneDev)
11984
+ warnHydrationStructuralMismatch(
11985
+ loc ?? componentSourceLoc(CURRENT_BLOCK?.body) ?? CURRENT_SCOPE?.locFile,
11986
+ `a fragment starting with ${describeHydrationNode(getFirstChild(template2))}`,
11987
+ describeHydrationNode(cursor)
11988
+ );
11989
+ }
11990
+ const block = CURRENT_SCOPE?.block;
11991
+ const parent = block?.parentNode;
11992
+ const end = block?.endMarker ?? null;
11993
+ if (parent == null || cursor === end || (STAGED_DOM?.view(cursor) ?? cursor).parentNode !== parent)
11994
+ return this.freshClone(template2);
11995
+ let node = cursor;
11996
+ if (end !== null)
11997
+ while (node !== null && node !== end && node !== block.startMarker)
11998
+ node = getNextSibling(node);
11999
+ if (node === end) {
12000
+ this.node = end;
12001
+ removeHydrationRange(cursor, (STAGED_DOM?.view(end) ?? end).previousSibling);
12002
+ } else this.discardCursor(cursor);
12003
+ return this.freshClone(template2);
12004
+ }
12005
+ /** Discard a mismatched server node (or the marker range it opens) and step past it. */
12006
+ discardCursor(cursor) {
12007
+ if (isBlockOpen(cursor)) {
12008
+ const close = this.close(cursor);
12009
+ this.node = getNextSibling(close);
12010
+ removeHydrationRange(cursor, close);
12011
+ } else {
12012
+ this.node = getNextSibling(cursor);
12013
+ (STAGED_DOM?.view(cursor) ?? cursor).remove();
12014
+ }
12015
+ }
11742
12016
  /** Remove server siblings left after the root's complete client shape was adopted. */
11743
12017
  finishRoot() {
11744
12018
  if (this.abandoned) return;
@@ -11747,7 +12021,7 @@ class HydrationCapability {
11747
12021
  remainder = getNextSibling(remainder);
11748
12022
  if (remainder === null) return;
11749
12023
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(53)), this.rootBlock);
11750
- if (process.env.NODE_ENV !== "production")
12024
+ if (__octaneDev)
11751
12025
  warnHydrationStructuralMismatch(
11752
12026
  componentSourceLoc(this.rootBlock.body),
11753
12027
  "the end of the root",
@@ -11762,6 +12036,18 @@ class HydrationCapability {
11762
12036
  this.node = null;
11763
12037
  this.rootRemainder = null;
11764
12038
  }
12039
+ /**
12040
+ * Whether the server framed `el`'s only child in a `<!--[-->…<!--]-->` range
12041
+ * holding something other than one text node or nothing. htext unwraps a
12042
+ * text-only frame; any other framed content belongs to a child slot.
12043
+ */
12044
+ framesSlotContent(el) {
12045
+ const first = getFirstChild(el);
12046
+ if (!this.isOpen(first)) return false;
12047
+ let next = getNextSibling(first);
12048
+ if (next !== null && next.nodeType === 3) next = getNextSibling(next);
12049
+ return !this.isClose(next);
12050
+ }
11765
12051
  htext(el, text, loc) {
11766
12052
  const first = getFirstChild(el);
11767
12053
  if (first !== null && first.nodeType === 3) {
@@ -11772,7 +12058,7 @@ class HydrationCapability {
11772
12058
  }
11773
12059
  if (getNextSibling(first) !== null) {
11774
12060
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(62)), this.rootBlock);
11775
- if (process.env.NODE_ENV !== "production") {
12061
+ if (__octaneDev) {
11776
12062
  warnHydrationStructuralMismatch(
11777
12063
  loc || el.__oct_loc,
11778
12064
  "the end of the text element",
@@ -11797,6 +12083,78 @@ class HydrationCapability {
11797
12083
  (STAGED_DOM?.view(el) ?? el).appendChild(created);
11798
12084
  return created;
11799
12085
  }
12086
+ /**
12087
+ * childTextHole's first hydrating render of an element, a component, or a
12088
+ * list. The server frames such a value in a `<!--[-->…<!--]-->` range, which
12089
+ * the hole's child slot adopts from the cursor. Anything else in the host is
12090
+ * the text, or nothing, that the server rendered for a primitive value, which
12091
+ * none of these values can adopt: discard it, report the recovery, and build
12092
+ * the value as a client mount would. A textarea's text is its default value,
12093
+ * which its value props own, so it stays. `render` is the hole's childSlot
12094
+ * call, passed in so that hydration alone never retains the child-slot graph.
12095
+ */
12096
+ hydrateOnlyChild(scope, slotKey, el, render) {
12097
+ let stale = getFirstChild(el);
12098
+ const rebuilt = HYDRATION_REBUILT_HOSTS?.has(el) === true;
12099
+ if (!rebuilt && this.isOpen(stale)) {
12100
+ this.node = stale;
12101
+ render();
12102
+ return;
12103
+ }
12104
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
12105
+ if (stale !== null) {
12106
+ if (el.localName === "textarea") stale = getNextSibling(stale);
12107
+ else if (!rebuilt && !this.staleServerValues) {
12108
+ noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(51)), this.rootBlock);
12109
+ if (__octaneDev)
12110
+ warnHydrationStructuralMismatch(
12111
+ siteLoc(scope, slotKey) || el.__oct_loc,
12112
+ "a renderable range",
12113
+ describeHydrationNode(stale)
12114
+ );
12115
+ }
12116
+ }
12117
+ while (stale !== null) {
12118
+ const next = getNextSibling(stale);
12119
+ (STAGED_DOM?.view(el) ?? el).removeChild(stale);
12120
+ stale = next;
12121
+ }
12122
+ (HYDRATION_REBUILT_HOSTS ??= /* @__PURE__ */ new WeakSet()).add(el);
12123
+ this.suspend(render);
12124
+ }
12125
+ /**
12126
+ * htext's counterpart for an only-child hole whose first hydrating value
12127
+ * renders nothing (`null`, `undefined`, a boolean, or `''`). The server
12128
+ * serializes that as no children, or as an empty `<!--[--><!--]-->` frame,
12129
+ * which unwraps like htext's text-only frame. Anything else is server content
12130
+ * the client renders no node for, so a later value would land beside it.
12131
+ * Discard it and report the recovery as htext reports extra children.
12132
+ * A textarea's text is its default value, which its value props own.
12133
+ */
12134
+ hempty(el, loc) {
12135
+ const first = getFirstChild(el);
12136
+ if (first === null || el.localName === "textarea") return;
12137
+ const next = getNextSibling(first);
12138
+ const framed = this.isOpen(first);
12139
+ if (framed && this.isClose(next) && getNextSibling(next) === null) {
12140
+ (STAGED_DOM?.view(first) ?? first).remove();
12141
+ (STAGED_DOM?.view(next) ?? next).remove();
12142
+ return;
12143
+ }
12144
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
12145
+ if (!this.staleServerValues) {
12146
+ noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(62)), this.rootBlock);
12147
+ if (__octaneDev) {
12148
+ warnHydrationStructuralMismatch(
12149
+ loc || el.__oct_loc,
12150
+ "nothing",
12151
+ describeHydrationNode(framed && next !== null ? next : first)
12152
+ );
12153
+ }
12154
+ }
12155
+ for (let n = getFirstChild(el); n !== null; n = getFirstChild(el))
12156
+ (STAGED_DOM?.view(el) ?? el).removeChild(n);
12157
+ }
11800
12158
  htextSwap(posNode, text) {
11801
12159
  if (isEmptyTextSlot(posNode)) {
11802
12160
  const empty = (STAGED_DOM?.view(document) ?? document).createTextNode("");
@@ -11818,7 +12176,7 @@ class HydrationCapability {
11818
12176
  const suppressed = isHydrationSuppressed(host);
11819
12177
  if (text !== "" && !suppressed) {
11820
12178
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(54)));
11821
- if (process.env.NODE_ENV !== "production") {
12179
+ if (__octaneDev) {
11822
12180
  warnHydrationStructuralMismatch(
11823
12181
  host && host.__oct_loc,
11824
12182
  `text ${JSON.stringify(text)}`,
@@ -11862,7 +12220,7 @@ class HydrationCapability {
11862
12220
  const mode = hydrationMismatchMode(el);
11863
12221
  if (mode === 0) return true;
11864
12222
  if (mode === 1) return false;
11865
- if (process.env.NODE_ENV !== "production" && !this.staleServerValues)
12223
+ if (__octaneDev && !this.staleServerValues)
11866
12224
  warnHydrationValueMismatch(el.__oct_loc, `attribute \`${name}\``, server, next);
11867
12225
  return true;
11868
12226
  }
@@ -11874,7 +12232,7 @@ class HydrationCapability {
11874
12232
  if (import_dom_binding_claims.domBindingClaims.get(el)?.get("class") === rawServer) return false;
11875
12233
  if (mode === 0) return true;
11876
12234
  if (mode === 1) return false;
11877
- if (process.env.NODE_ENV !== "production" && !this.staleServerValues)
12235
+ if (__octaneDev && !this.staleServerValues)
11878
12236
  warnHydrationValueMismatch(el.__oct_loc, "attribute `class`", server, next);
11879
12237
  return true;
11880
12238
  }
@@ -11931,7 +12289,7 @@ class HydrationCapability {
11931
12289
  if (before === expected && hadStyleAttribute === expectsStyleAttribute) return true;
11932
12290
  if (expectsStyleAttribute) style.cssText = expected;
11933
12291
  else (STAGED_DOM?.view(el) ?? el).removeAttribute("style");
11934
- if (mode === 2 && process.env.NODE_ENV !== "production" && !this.staleServerValues) {
12292
+ if (mode === 2 && __octaneDev && !this.staleServerValues) {
11935
12293
  warnHydrationValueMismatch(el.__oct_loc, "style", before, expected);
11936
12294
  }
11937
12295
  return true;
@@ -12043,7 +12401,7 @@ function clone(node, loc, partialStyles) {
12043
12401
  const lazy2 = node.nodeType === void 0 ? (STAGED_DOM?.view(node) ?? node)[LAZY_TEMPLATE] : void 0;
12044
12402
  if (lazy2 !== void 0) {
12045
12403
  const hydration2 = activeHydration();
12046
- if (process.env.NODE_ENV === "production" && hydration2 !== null) {
12404
+ if (!__octaneDev && hydration2 !== null) {
12047
12405
  return hydration2.cloneLazy(lazy2, loc);
12048
12406
  }
12049
12407
  const parsed = resolveLazyTemplate(lazy2);
@@ -12165,6 +12523,43 @@ function htextSwap(posNode, value) {
12165
12523
  (STAGED_DOM?.view(parent) ?? parent).replaceChild(t, posNode);
12166
12524
  return t;
12167
12525
  }
12526
+ function rejectTextareaChild(child2) {
12527
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(336, (0, import_shared_value_helpers.describeTextareaChild)(child2, isElementDescriptor)));
12528
+ }
12529
+ function textareaPartText(part, textHole2) {
12530
+ return textHole2 ? coerceText(part) : (0, import_shared_value_helpers.textareaChildText)(part, rejectTextareaChild);
12531
+ }
12532
+ function joinTextareaParts(parts, textHoles, read) {
12533
+ let text = "";
12534
+ for (let i = 0; i < parts.length; i++) {
12535
+ const part = parts[i];
12536
+ text += textareaPartText(
12537
+ isSignalHandle(part) ? read(part) : part,
12538
+ textHoles !== void 0 && textHoles.charCodeAt(i) === 116
12539
+ // 't'
12540
+ );
12541
+ }
12542
+ return text;
12543
+ }
12544
+ function textareaText(parts, textHoles) {
12545
+ let handles;
12546
+ for (const part of parts) if (isSignalHandle(part)) (handles ??= []).push(part);
12547
+ if (handles === void 0) return joinTextareaParts(parts, textHoles, readSignalBinding);
12548
+ const signals = handles;
12549
+ return {
12550
+ [import_types.SIGNAL_HANDLE]: true,
12551
+ kind: "derived",
12552
+ key: signals.map((handle) => handle.key).join("+"),
12553
+ [import_types.SIGNAL_BINDING_READ]: () => joinTextareaParts(parts, textHoles, readSignalBinding),
12554
+ get: () => joinTextareaParts(parts, textHoles, (handle) => handle.get()),
12555
+ [import_types.SIGNAL_BINDING_SUBSCRIBE](notify, onRetire) {
12556
+ const stops = signals.map((handle) => handle[import_types.SIGNAL_BINDING_SUBSCRIBE](notify, onRetire));
12557
+ return () => {
12558
+ for (const stop of stops) stop();
12559
+ };
12560
+ }
12561
+ };
12562
+ }
12168
12563
  function bindingText(posNode, value, marker) {
12169
12564
  const text = coerceText(value);
12170
12565
  const hydration = activeHydration();
@@ -12469,9 +12864,9 @@ function preparePresentationSignalBinding(args, frame, text = false) {
12469
12864
  if (witness >= 0)
12470
12865
  frame.witnesses.set(handle, finishNativeReadWitness(witness, readCompleted));
12471
12866
  }
12472
- if (text && (current !== null && (typeof current === "object" || typeof current === "function") || typeof args[7] !== "string"))
12867
+ if (text && (current !== null && (typeof current === "object" || typeof current === "function") || typeof args[8] !== "string"))
12473
12868
  presentationMiss(false);
12474
- const prepared = text ? bindingText(element, current, args[7]) : preparedPresentationAttribute(element, name, current, attributeKind);
12869
+ const prepared = text ? bindingText(element, current, args[8]) : preparedPresentationAttribute(element, name, current, attributeKind);
12475
12870
  if (handle === null) {
12476
12871
  if (text) {
12477
12872
  frame.writes.get(element)?.delete("signalText");
@@ -12761,8 +13156,7 @@ function presentationStructure(writer, kind, marker, ...args) {
12761
13156
  if (frame?.revision === void 0) return writer(...args);
12762
13157
  const hydration = activeHydration();
12763
13158
  if (hydration === null) presentationMiss(false);
12764
- const anchorIndex = kind === "if" ? 6 : 5;
12765
- const start = hydration.resolveOpen(args[anchorIndex] ?? null, args[2]);
13159
+ const start = hydration.resolveOpen(args[6] ?? null, args[2]);
12766
13160
  if (kind === "if") {
12767
13161
  const arm = args[3] ? args[4] === null ? -1 : 0 : args[5] === null ? -1 : 1;
12768
13162
  const range2 = presentationRange(frame, start, marker + arm, kind);
@@ -13085,7 +13479,7 @@ function updateDirectSignalBinding(binding) {
13085
13479
  runWithBlockSignalOwner(binding.scope, () => {
13086
13480
  const value = readSignalBinding(binding.handle);
13087
13481
  if (!Object.is(binding.value, value)) writeDirectSignalBinding(binding, value);
13088
- if (process.env.NODE_ENV !== "production" && STAGED_DOM === null && binding.target.nodeType === 1)
13482
+ if (__octaneDev && STAGED_DOM === null && binding.target.nodeType === 1)
13089
13483
  drainDevFormDiagnostics(binding.target);
13090
13484
  });
13091
13485
  } catch {
@@ -13255,8 +13649,8 @@ function bindDirectSignal(scope, previous, target, value, site, policy, name, at
13255
13649
  }
13256
13650
  return binding;
13257
13651
  }
13258
- function bindSignalText(scope, previous, position, value, site, onlyChild = false, seededText = void 0, bindingMarker, previousValue) {
13259
- if (previous instanceof Text && arguments.length > 8 && previousValue === value && !isSignalHandle(value))
13652
+ function bindSignalText(scope, previous, position, value, site, onlyChild = false, previousValue, seededText = void 0, bindingMarker) {
13653
+ if (previous instanceof Text && arguments.length > 6 && previousValue === value && !isSignalHandle(value))
13260
13654
  return previous;
13261
13655
  if (previous === void 0 && bindingMarker !== void 0) {
13262
13656
  const existing = activeHydration() !== null ? getNextSibling(position) : null;
@@ -13775,15 +14169,16 @@ class FragmentInstance {
13775
14169
  }
13776
14170
  /**
13777
14171
  * Blur the focused element only when a logical fragment child owns it,
13778
- * including children rendered into foreign portal containers.
14172
+ * including children rendered into foreign portal containers. Each child is
14173
+ * checked against its own focus root, so shadow-root and iframe portal
14174
+ * children resolve to the owned element rather than their host or frame.
13779
14175
  */
13780
14176
  blur() {
13781
14177
  if (this._destroyed) return;
13782
- const doc = this._startMarker.ownerDocument || document;
13783
- const active = doc.activeElement;
13784
- if (!active || active === doc.body) return;
13785
14178
  for (const child2 of fragmentDirectChildren(this)) {
13786
- if (child2 === active || (STAGED_DOM?.view(child2) ?? child2).contains(active)) {
14179
+ const root = (STAGED_DOM?.view(child2) ?? child2).getRootNode();
14180
+ const active = root.activeElement;
14181
+ if (active && (child2 === active || (STAGED_DOM?.view(child2) ?? child2).contains(active))) {
13787
14182
  (STAGED_DOM?.view(active) ?? active).blur();
13788
14183
  return;
13789
14184
  }
@@ -13846,7 +14241,7 @@ class FragmentInstance {
13846
14241
  */
13847
14242
  observeUsing(observer) {
13848
14243
  if (this._destroyed) return;
13849
- if (process.env.NODE_ENV !== "production") {
14244
+ if (__octaneDev) {
13850
14245
  let hasText = false;
13851
14246
  let hasElement = false;
13852
14247
  for (const child2 of this._children) {
@@ -13874,7 +14269,7 @@ class FragmentInstance {
13874
14269
  unobserveUsing(observer) {
13875
14270
  if (this._destroyed) return;
13876
14271
  if (this._observers === null || !this._observers.has(observer)) {
13877
- if (process.env.NODE_ENV !== "production") {
14272
+ if (__octaneDev) {
13878
14273
  console.error(
13879
14274
  "You are calling unobserveUsing() with an observer that is not being observed with this fragment instance. First attach the observer with observeUsing()"
13880
14275
  );
@@ -14150,6 +14545,10 @@ const HTML_NS = "http://www.w3.org/1999/xhtml";
14150
14545
  function isHtmlCustomElement(el) {
14151
14546
  return el.namespaceURI === HTML_NS && el.localName.indexOf("-") !== -1;
14152
14547
  }
14548
+ function isHostElementOfType(el, type) {
14549
+ const name = el.localName;
14550
+ return name === type || name === type.toLowerCase() && el.namespaceURI === HTML_NS;
14551
+ }
14153
14552
  function inferTagNs(tag, inherited) {
14154
14553
  if (tag === "svg") return SVG_NS;
14155
14554
  if (tag === "math") return MATHML_NS;
@@ -14175,7 +14574,7 @@ function attrNamespace(name) {
14175
14574
  }
14176
14575
  function setAttribute(el, name, value) {
14177
14576
  if (name === "innerText" || name === "textContent") return;
14178
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0 && !isHtmlCustomElement(el) && typeof el.__oct_custom_is !== "string") {
14577
+ if (__octaneDev && el.__oct_loc !== void 0 && !isHtmlCustomElement(el) && typeof el.__oct_custom_is !== "string") {
14179
14578
  const warning = (0, import_aria_diagnostics.isAriaAttributeName)(name) ? (0, import_aria_diagnostics.ariaAttributeWarning)(name, el.localName) : (0, import_host_property_diagnostics.hostPropertyWarning)(name, value, el.localName, el.namespaceURI === SVG_NS);
14180
14579
  if (warning !== null) devWarnAttributeOnce(el, name, warning);
14181
14580
  }
@@ -14185,13 +14584,13 @@ function setAttribute(el, name, value) {
14185
14584
  }
14186
14585
  if (name === "suppressContentEditableWarning") return;
14187
14586
  if (name === "suppressNativeChangeWarning") {
14188
- if (process.env.NODE_ENV !== "production") {
14587
+ if (__octaneDev) {
14189
14588
  el.__oct_native_change_suppressed = value === true;
14190
14589
  }
14191
14590
  return;
14192
14591
  }
14193
14592
  if (name === "__octaneNativeChangeDiagnostic") {
14194
- if (process.env.NODE_ENV !== "production") {
14593
+ if (__octaneDev) {
14195
14594
  setNativeChangeDiagnosticMetadata(el, value);
14196
14595
  }
14197
14596
  return;
@@ -14224,7 +14623,7 @@ function setAttribute(el, name, value) {
14224
14623
  if (name === "autoFocus" && !isHtmlCustomElement(el)) {
14225
14624
  return setAutoFocus(el, value);
14226
14625
  }
14227
- if (process.env.NODE_ENV !== "production" && name === "autofocus" && el.__oct_loc !== void 0) {
14626
+ if (__octaneDev && name === "autofocus" && el.__oct_loc !== void 0) {
14228
14627
  devWarnAttributeOnce(
14229
14628
  el,
14230
14629
  name,
@@ -14238,7 +14637,7 @@ function setAttribute(el, name, value) {
14238
14637
  if (t === "input" || t === "textarea" || t === "select") {
14239
14638
  return setDefaultValue(el, value);
14240
14639
  }
14241
- } else if (process.env.NODE_ENV !== "production" && name === "defaultvalue" && el.__oct_loc !== void 0) {
14640
+ } else if (__octaneDev && name === "defaultvalue" && el.__oct_loc !== void 0) {
14242
14641
  devWarnAttributeOnce(
14243
14642
  el,
14244
14643
  name,
@@ -14250,7 +14649,7 @@ function setAttribute(el, name, value) {
14250
14649
  if (name === "defaultChecked" && el.localName === "input") {
14251
14650
  return setDefaultChecked(el, value);
14252
14651
  }
14253
- if (process.env.NODE_ENV !== "production" && name === "defaultchecked" && el.__oct_loc !== void 0) {
14652
+ if (__octaneDev && name === "defaultchecked" && el.__oct_loc !== void 0) {
14254
14653
  devWarnAttributeOnce(
14255
14654
  el,
14256
14655
  name,
@@ -14295,7 +14694,7 @@ function setAttribute(el, name, value) {
14295
14694
  return;
14296
14695
  }
14297
14696
  if (!import_constants.VALID_ATTR_NAME.test(name)) {
14298
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0) {
14697
+ if (__octaneDev && el.__oct_loc !== void 0) {
14299
14698
  devWarnAttributeOnce(el, name, `Invalid attribute name: \`${name}\` (skipped).`);
14300
14699
  }
14301
14700
  return;
@@ -14363,7 +14762,7 @@ function devValidateHostProps(el, props) {
14363
14762
  }
14364
14763
  }
14365
14764
  function setPlainAttribute(el, name, value) {
14366
- if (process.env.NODE_ENV !== "production") return setAttribute(el, name, value);
14765
+ if (__octaneDev) return setAttribute(el, name, value);
14367
14766
  const type = typeof value;
14368
14767
  const next = value == null || type === "boolean" || type === "function" || type === "symbol" ? null : String(value);
14369
14768
  const hydration = activeHydration();
@@ -14373,7 +14772,7 @@ function setPlainAttribute(el, name, value) {
14373
14772
  else (STAGED_DOM?.view(el) ?? el).setAttribute(name, next);
14374
14773
  }
14375
14774
  function setURLAttribute(el, name, value) {
14376
- if (process.env.NODE_ENV !== "production") return setAttribute(el, name, value);
14775
+ if (__octaneDev) return setAttribute(el, name, value);
14377
14776
  const type = typeof value;
14378
14777
  let next = value == null || type === "boolean" || type === "function" || type === "symbol" ? null : String(value);
14379
14778
  if (next !== null) {
@@ -14393,7 +14792,7 @@ function setStringData(el, name, value) {
14393
14792
  if (value == null || t === "function" || t === "symbol") {
14394
14793
  next = null;
14395
14794
  } else {
14396
- if (process.env.NODE_ENV !== "production" && t === "object" && el.__oct_loc !== void 0 && value.toString === Object.prototype.toString) {
14795
+ if (__octaneDev && t === "object" && el.__oct_loc !== void 0 && value.toString === Object.prototype.toString) {
14397
14796
  devWarnAttributeOnce(
14398
14797
  el,
14399
14798
  name,
@@ -14409,7 +14808,7 @@ function setStringData(el, name, value) {
14409
14808
  else (STAGED_DOM?.view(el) ?? el).setAttribute(name, next);
14410
14809
  }
14411
14810
  function setBooleanAttribute(el, name, value) {
14412
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0) {
14811
+ if (__octaneDev && el.__oct_loc !== void 0) {
14413
14812
  const warning = (0, import_host_property_diagnostics.booleanAttributeStringWarning)(name, value);
14414
14813
  if (warning !== null) devWarnAttributeOnce(el, name, warning);
14415
14814
  }
@@ -14422,7 +14821,7 @@ function setBooleanAttribute(el, name, value) {
14422
14821
  else (STAGED_DOM?.view(el) ?? el).setAttribute(name, next);
14423
14822
  }
14424
14823
  function setAriaAttribute(el, name, value) {
14425
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0 && !isHtmlCustomElement(el)) {
14824
+ if (__octaneDev && el.__oct_loc !== void 0 && !isHtmlCustomElement(el)) {
14426
14825
  const warning = (0, import_aria_diagnostics.ariaAttributeWarning)(name, el.localName);
14427
14826
  if (warning !== null) devWarnAttributeOnce(el, name, warning);
14428
14827
  }
@@ -14441,7 +14840,7 @@ function coerceAttrValue(el, name, value) {
14441
14840
  if (t === "boolean" && (0, import_constants.isEnumeratedBooleanAttr)(name)) return value ? "true" : "false";
14442
14841
  if (t === "boolean" && name.startsWith("data-")) return value ? "true" : "false";
14443
14842
  if (t === "function" || t === "symbol") {
14444
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0 && !isHtmlCustomElement(el)) {
14843
+ if (__octaneDev && el.__oct_loc !== void 0 && !isHtmlCustomElement(el)) {
14445
14844
  if (t === "function" && name.length > 2 && name.charCodeAt(0) === 111 && name.charCodeAt(1) === 110) {
14446
14845
  devWarnAttributeOnce(
14447
14846
  el,
@@ -14461,7 +14860,7 @@ function coerceAttrValue(el, name, value) {
14461
14860
  if (!isHtmlCustomElement(el)) {
14462
14861
  const lower = name.toLowerCase();
14463
14862
  if (import_constants.BOOLEAN_ATTR_PROPS.has(lower)) {
14464
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0) {
14863
+ if (__octaneDev && el.__oct_loc !== void 0) {
14465
14864
  const warning = (0, import_host_property_diagnostics.booleanAttributeStringWarning)(name, value);
14466
14865
  if (warning !== null) devWarnAttributeOnce(el, name, warning);
14467
14866
  }
@@ -14471,7 +14870,7 @@ function coerceAttrValue(el, name, value) {
14471
14870
  return value ? "" : null;
14472
14871
  }
14473
14872
  if (t === "boolean") {
14474
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0) {
14873
+ if (__octaneDev && el.__oct_loc !== void 0) {
14475
14874
  devWarnAttributeOnce(
14476
14875
  el,
14477
14876
  name,
@@ -14489,14 +14888,14 @@ function coerceAttrValue(el, name, value) {
14489
14888
  }
14490
14889
  }
14491
14890
  if (value == null || value === false) return null;
14492
- if (process.env.NODE_ENV !== "production" && t === "object" && el.__oct_loc !== void 0 && value.toString === Object.prototype.toString) {
14891
+ if (__octaneDev && t === "object" && el.__oct_loc !== void 0 && value.toString === Object.prototype.toString) {
14493
14892
  devWarnAttributeOnce(
14494
14893
  el,
14495
14894
  name,
14496
14895
  `The provided \`${name}\` attribute is an object; it will stringify to "[object Object]". Pass a string (or a value with a meaningful toString) instead.`
14497
14896
  );
14498
14897
  }
14499
- if (process.env.NODE_ENV !== "production" && t === "number" && Number.isNaN(value) && el.__oct_loc !== void 0) {
14898
+ if (__octaneDev && t === "number" && Number.isNaN(value) && el.__oct_loc !== void 0) {
14500
14899
  devWarnAttributeOnce(
14501
14900
  el,
14502
14901
  name,
@@ -14504,7 +14903,7 @@ function coerceAttrValue(el, name, value) {
14504
14903
  );
14505
14904
  }
14506
14905
  let v;
14507
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0 && !isHtmlCustomElement(el)) {
14906
+ if (__octaneDev && el.__oct_loc !== void 0 && !isHtmlCustomElement(el)) {
14508
14907
  try {
14509
14908
  v = value === true ? "" : String(value);
14510
14909
  } catch (error) {
@@ -14515,7 +14914,7 @@ function coerceAttrValue(el, name, value) {
14515
14914
  v = value === true ? "" : String(value);
14516
14915
  }
14517
14916
  if (v === "" && (name === "src" || name === "href" && el.nodeName !== "A" && el.nodeName !== "AREA" || name === "data" && el.nodeName === "OBJECT")) {
14518
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0 && !isHtmlCustomElement(el)) {
14917
+ if (__octaneDev && el.__oct_loc !== void 0 && !isHtmlCustomElement(el)) {
14519
14918
  devWarnAttributeOnce(el, "empty:" + name, (0, import_host_property_diagnostics.emptyResourceUrlWarning)(name));
14520
14919
  }
14521
14920
  return null;
@@ -14644,7 +15043,7 @@ function applyStyleValue(el, style, value, prev) {
14644
15043
  function applyStyleProperty(el, style, name, value) {
14645
15044
  const prop = (0, import_css.styleName)(name);
14646
15045
  let s;
14647
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0) {
15046
+ if (__octaneDev && el.__oct_loc !== void 0) {
14648
15047
  (0, import_css.devWarnStyleProperty)(name, value, false);
14649
15048
  try {
14650
15049
  s = (0, import_constants.cssStyleValue)(name, value);
@@ -14705,11 +15104,11 @@ function removeHostProp(el, name, prevValue) {
14705
15104
  } else if (name === "suppressHydrationWarning") {
14706
15105
  el.__oct_suppress = false;
14707
15106
  } else if (name === "suppressNativeChangeWarning") {
14708
- if (process.env.NODE_ENV !== "production") {
15107
+ if (__octaneDev) {
14709
15108
  el.__oct_native_change_suppressed = false;
14710
15109
  }
14711
15110
  } else if (name === "__octaneNativeChangeDiagnostic") {
14712
- if (process.env.NODE_ENV !== "production") setNativeChangeDiagnosticMetadata(el, void 0);
15111
+ if (__octaneDev) setNativeChangeDiagnosticMetadata(el, void 0);
14713
15112
  } else {
14714
15113
  const actionName = formActionAttributeName(el, name);
14715
15114
  if (actionName !== null) {
@@ -14798,7 +15197,7 @@ function resolveHostPropSources(el, sources, props, readStyle) {
14798
15197
  if (previous.lastOrder >= writer.lastOrder) continue;
14799
15198
  needsWinningOrderSort = true;
14800
15199
  }
14801
- writer.name = process.env.NODE_ENV !== "production" && (rawName === "tabIndex" || rawName === "htmlFor") ? rawName : name;
15200
+ writer.name = __octaneDev && (rawName === "tabIndex" || rawName === "htmlFor") ? rawName : name;
14802
15201
  values.set(identity, writer);
14803
15202
  }
14804
15203
  if (classMerges !== null) {
@@ -14838,7 +15237,8 @@ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false,
14838
15237
  props.get("defaultValue")?.value,
14839
15238
  props.get("checked")?.value,
14840
15239
  props.get("defaultChecked")?.value,
14841
- props.get("multiple")?.value
15240
+ props.get("multiple")?.value,
15241
+ hasNestedChildren || props.has("children")
14842
15242
  );
14843
15243
  return resolved;
14844
15244
  }
@@ -14917,7 +15317,7 @@ function updateSignalHostPropSources(binding) {
14917
15317
  binding.hasNestedChildren,
14918
15318
  binding.readStyle
14919
15319
  );
14920
- if (process.env.NODE_ENV !== "production" && STAGED_DOM === null)
15320
+ if (__octaneDev && STAGED_DOM === null)
14921
15321
  drainDevFormDiagnostics(binding.element);
14922
15322
  });
14923
15323
  } catch {
@@ -15227,17 +15627,17 @@ function isAggregatedFormControlProp(el, name) {
15227
15627
  return false;
15228
15628
  }
15229
15629
  function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = false, skipFormControls = false) {
15230
- if (process.env.NODE_ENV !== "production" && value != null) {
15630
+ if (__octaneDev && value != null) {
15231
15631
  devValidateAriaProps(el, Object(value));
15232
15632
  devValidateHostProps(el, Object(value));
15233
15633
  }
15234
15634
  if (value != null && Object.prototype.propertyIsEnumerable.call(Object(value), "suppressHydrationWarning")) {
15235
15635
  el.__oct_suppress = value.suppressHydrationWarning === true;
15236
15636
  }
15237
- if (process.env.NODE_ENV !== "production" && value != null && Object.prototype.propertyIsEnumerable.call(Object(value), "suppressNativeChangeWarning")) {
15637
+ if (__octaneDev && value != null && Object.prototype.propertyIsEnumerable.call(Object(value), "suppressNativeChangeWarning")) {
15238
15638
  el.__oct_native_change_suppressed = value.suppressNativeChangeWarning === true;
15239
15639
  }
15240
- if (process.env.NODE_ENV !== "production" && value != null && Object.prototype.propertyIsEnumerable.call(Object(value), "__octaneNativeChangeDiagnostic")) {
15640
+ if (__octaneDev && value != null && Object.prototype.propertyIsEnumerable.call(Object(value), "__octaneNativeChangeDiagnostic")) {
15241
15641
  setNativeChangeDiagnosticMetadata(el, value.__octaneNativeChangeDiagnostic);
15242
15642
  }
15243
15643
  if (!skipDangerouslySetInnerHTML) {
@@ -15265,7 +15665,7 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
15265
15665
  }
15266
15666
  }
15267
15667
  if (value == null) {
15268
- if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, mountScope);
15668
+ if (__octaneDev) queueDevFormDiagnostic(el, mountScope);
15269
15669
  return;
15270
15670
  }
15271
15671
  const hydration = prev === void 0 ? activeHydration() : null;
@@ -15320,14 +15720,14 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
15320
15720
  setEventHandler(
15321
15721
  el,
15322
15722
  ev.key,
15323
- process.env.NODE_ENV !== "production" ? devEventListener(k, v) : v
15723
+ __octaneDev ? devEventListener(k, v) : v
15324
15724
  );
15325
15725
  continue;
15326
15726
  }
15327
15727
  if (prev !== void 0 && k === "autoFocus" && !isHtmlCustomElement(el)) continue;
15328
15728
  setAttribute(el, k, v);
15329
15729
  }
15330
- if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, mountScope);
15730
+ if (__octaneDev) queueDevFormDiagnostic(el, mountScope);
15331
15731
  }
15332
15732
  const _injectedStyles = /* @__PURE__ */ new Set();
15333
15733
  function journalHeadEventListeners(state) {
@@ -15465,7 +15865,7 @@ function headBlock(scope, slot, key, tag, attrs, text) {
15465
15865
  const ev = k.length > 2 && k[0] === "o" && k[1] === "n" ? eventSlot(k) : null;
15466
15866
  if (ev !== null) {
15467
15867
  const v = attrs[k];
15468
- const listener = process.env.NODE_ENV !== "production" ? devEventListener(k, v) : v;
15868
+ const listener = __octaneDev ? devEventListener(k, v) : v;
15469
15869
  const hs = state.handlers;
15470
15870
  const prevH = hs?.get(k);
15471
15871
  if (prevH === listener) continue;
@@ -15564,7 +15964,7 @@ function isHandlerBundle(slot) {
15564
15964
  return typeof slot === "object" && slot !== null && slot[EVENT_SLOT_KIND] === HANDLER_BUNDLE_KIND;
15565
15965
  }
15566
15966
  function devEventListener(name, listener) {
15567
- if (process.env.NODE_ENV === "production") return listener;
15967
+ if (!__octaneDev) return listener;
15568
15968
  if (listener == null || typeof listener === "function") return listener;
15569
15969
  if (listener === false) {
15570
15970
  console.error(
@@ -15580,7 +15980,7 @@ If you used to conditionally omit it with ${name}={condition && value}, pass ${n
15580
15980
  return { [EVENT_SLOT_KIND]: INVALID_EVENT_LISTENER_KIND, name, value: listener };
15581
15981
  }
15582
15982
  function isInvalidEventListenerSlot(slot) {
15583
- return process.env.NODE_ENV !== "production" && typeof slot === "object" && slot !== null && slot[EVENT_SLOT_KIND] === INVALID_EVENT_LISTENER_KIND;
15983
+ return __octaneDev && typeof slot === "object" && slot !== null && slot[EVENT_SLOT_KIND] === INVALID_EVENT_LISTENER_KIND;
15584
15984
  }
15585
15985
  function isUsableEventSlot(slot) {
15586
15986
  return typeof slot === "function" || isHandlerBundle(slot);
@@ -16249,7 +16649,7 @@ function fireEventSlot(slot, event, recorded) {
16249
16649
  slot(event);
16250
16650
  return;
16251
16651
  }
16252
- if (process.env.NODE_ENV !== "production" && isInvalidEventListenerSlot(slot)) {
16652
+ if (__octaneDev && isInvalidEventListenerSlot(slot)) {
16253
16653
  invokeInvalidEventListener(`\`${slot.name}\``, slot.value, event);
16254
16654
  return;
16255
16655
  }
@@ -16550,7 +16950,7 @@ function requestFormReset(form) {
16550
16950
  (PENDING_FORM_RESETS ??= /* @__PURE__ */ new Set()).add(form);
16551
16951
  return;
16552
16952
  }
16553
- if (process.env.NODE_ENV !== "production")
16953
+ if (__octaneDev)
16554
16954
  console.error(
16555
16955
  "requestFormReset was called outside a transition or action. To fix, move to an action, or wrap with startTransition."
16556
16956
  );
@@ -16566,7 +16966,7 @@ function flushFormResets() {
16566
16966
  function setFormAction(el, name, value, _prev) {
16567
16967
  if (typeof value === "function") {
16568
16968
  (STAGED_DOM?.view(el) ?? el).$$formAction = value;
16569
- if (process.env.NODE_ENV !== "production") queueFormActionAuthoringDiagnostic(el);
16969
+ if (__octaneDev) queueFormActionAuthoringDiagnostic(el);
16570
16970
  if (!el.$$formSubmitWired) {
16571
16971
  el.$$formSubmitWired = true;
16572
16972
  FORM_SUBMIT_DRIVER = handleFormSubmit;
@@ -16634,7 +17034,7 @@ let activationCheckable = null;
16634
17034
  let CHECKED_RESTORE = null;
16635
17035
  let SELECT_SYNCS = [];
16636
17036
  let SELECT_DEFAULT_SYNCS = [];
16637
- let DEV_FORM_CHECKS = process.env.NODE_ENV === "production" ? null : [];
17037
+ let DEV_FORM_CHECKS = !__octaneDev ? null : [];
16638
17038
  const DEV_FORM_CHECK_MARK = /* @__PURE__ */ Symbol("octane.devFormCheck");
16639
17039
  const DEV_FORM_CHECK_LINEAR_LIMIT = 8;
16640
17040
  let DEV_FORM_CHECK_GENERATION = 1;
@@ -16745,7 +17145,8 @@ function armControlledBase(el) {
16745
17145
  compositionEndTask: void 0,
16746
17146
  queued: false,
16747
17147
  formSeen: false,
16748
- formMultiple: false
17148
+ formMultiple: false,
17149
+ formChildren: false
16749
17150
  };
16750
17151
  (STAGED_DOM?.view(el) ?? el).$$ctrl = ctrl;
16751
17152
  delegateEvents(RESTORE_EVENT_LIST);
@@ -16772,7 +17173,7 @@ function valueNeedsWrite(el, raw) {
16772
17173
  return (STAGED_DOM?.view(el) ?? el).value !== toControlledString(raw);
16773
17174
  }
16774
17175
  function devWarnControlledFlip(el, toControlled) {
16775
- if (process.env.NODE_ENV === "production") return;
17176
+ if (!__octaneDev) return;
16776
17177
  if (el.__oct_loc === void 0) return;
16777
17178
  console.error(
16778
17179
  `A component is changing ${toControlled ? "an uncontrolled" : "a controlled"} ${el.localName} to be ${toControlled ? "controlled" : "uncontrolled"}. This is likely caused by the value changing from ${toControlled ? "undefined to a defined value" : "a defined value to undefined"}, which should not happen. Decide between using a controlled or uncontrolled ${el.localName} for the lifetime of the component (controlled: \`value\`/\`checked\`; uncontrolled: \`defaultValue\`/\`defaultChecked\`).`
@@ -16814,7 +17215,7 @@ function hasPotentialFormDiagnostic(el) {
16814
17215
  return ctrl !== void 0 && ctrl.v !== UNCONTROLLED || isUsableEventSlot(el.$$change) || isUsableEventSlot((STAGED_DOM?.view(el) ?? el)["$$capture:change"]);
16815
17216
  }
16816
17217
  function queueDevFormDiagnostic(el, scope, force = false) {
16817
- if (process.env.NODE_ENV === "production") return;
17218
+ if (!__octaneDev) return;
16818
17219
  const q = DEV_FORM_CHECKS;
16819
17220
  if (q === null || !force && !hasDevFormDiagnosticContext(el, scope)) return;
16820
17221
  if (!force && !hasPotentialFormDiagnostic(el)) return;
@@ -16833,7 +17234,7 @@ function queueDevFormDiagnostic(el, scope, force = false) {
16833
17234
  host[DEV_FORM_CHECK_MARK] = DEV_FORM_CHECK_GENERATION;
16834
17235
  }
16835
17236
  function queueFormAuthoringDiagnostic(el, kind, selected) {
16836
- if (process.env.NODE_ENV === "production") return;
17237
+ if (!__octaneDev) return;
16837
17238
  const state = ensureDevFormDiagnosticState(el);
16838
17239
  if (kind === "textarea-children") state.authoringChildren = "textarea";
16839
17240
  else if (kind === "option-children") state.authoringChildren = "option";
@@ -16844,22 +17245,22 @@ function queueFormAuthoringDiagnostic(el, kind, selected) {
16844
17245
  queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0, true);
16845
17246
  }
16846
17247
  function queueFormActionAuthoringDiagnostic(el) {
16847
- if (process.env.NODE_ENV === "production") return;
17248
+ if (!__octaneDev) return;
16848
17249
  if (!hasDevFormDiagnosticContext(el, CURRENT_SCOPE ?? void 0)) return;
16849
17250
  ensureDevFormDiagnosticState(el);
16850
17251
  queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0, true);
16851
17252
  }
16852
17253
  function queueNativeChangeDiagnostic(el) {
16853
- if (process.env.NODE_ENV !== "production")
17254
+ if (__octaneDev)
16854
17255
  queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0, true);
16855
17256
  }
16856
17257
  function markNativeChangeDiagnosticStatic(el) {
16857
- if (process.env.NODE_ENV === "production") return;
17258
+ if (!__octaneDev) return;
16858
17259
  ensureDevFormDiagnosticState(el).staticNativeChange = true;
16859
17260
  queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0, true);
16860
17261
  }
16861
17262
  function setNativeChangeDiagnosticMetadata(el, value) {
16862
- if (process.env.NODE_ENV === "production") return;
17263
+ if (!__octaneDev) return;
16863
17264
  if (value === "static") {
16864
17265
  markNativeChangeDiagnosticStatic(el);
16865
17266
  return;
@@ -16876,17 +17277,17 @@ function setValue(el, value) {
16876
17277
  const first = !ctrl.sawV;
16877
17278
  ctrl.sawV = true;
16878
17279
  if (value == null) {
16879
- if (process.env.NODE_ENV !== "production" && !first && ctrl.v !== UNCONTROLLED)
17280
+ if (__octaneDev && !first && ctrl.v !== UNCONTROLLED)
16880
17281
  devWarnControlledFlip(el, false);
16881
17282
  ctrl.v = UNCONTROLLED;
16882
- if (process.env.NODE_ENV !== "production")
17283
+ if (__octaneDev)
16883
17284
  queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0);
16884
17285
  return;
16885
17286
  }
16886
17287
  const s = toControlledString(value);
16887
17288
  if (first) {
16888
17289
  ctrl.v = value;
16889
- if (process.env.NODE_ENV !== "production")
17290
+ if (__octaneDev)
16890
17291
  queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0);
16891
17292
  const hydration = activeHydration();
16892
17293
  if (hydration !== null && !hydration.isFresh(el)) return;
@@ -16895,11 +17296,11 @@ function setValue(el, value) {
16895
17296
  (STAGED_DOM?.view(input) ?? input).defaultValue = s;
16896
17297
  return;
16897
17298
  }
16898
- if (process.env.NODE_ENV !== "production" && ctrl.v === UNCONTROLLED)
17299
+ if (__octaneDev && ctrl.v === UNCONTROLLED)
16899
17300
  devWarnControlledFlip(el, true);
16900
17301
  const prev = ctrl.v;
16901
17302
  ctrl.v = value;
16902
- if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0);
17303
+ if (__octaneDev) queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0);
16903
17304
  if (!(ctrl.composing && Object.is(prev, value)) && valueNeedsWrite(input, value))
16904
17305
  (STAGED_DOM?.view(input) ?? input).value = s;
16905
17306
  if ((STAGED_DOM?.view(input) ?? input).defaultValue !== s) {
@@ -16913,10 +17314,10 @@ function setCheckedState(input, value, ctrl) {
16913
17314
  const first = !ctrl.sawC;
16914
17315
  ctrl.sawC = true;
16915
17316
  if (value == null) {
16916
- if (process.env.NODE_ENV !== "production" && !first && ctrl.c !== -1)
17317
+ if (__octaneDev && !first && ctrl.c !== -1)
16917
17318
  devWarnControlledFlip(input, false);
16918
17319
  ctrl.c = -1;
16919
- if (process.env.NODE_ENV !== "production")
17320
+ if (__octaneDev)
16920
17321
  queueDevFormDiagnostic(input, CURRENT_SCOPE ?? void 0);
16921
17322
  return;
16922
17323
  }
@@ -16924,7 +17325,7 @@ function setCheckedState(input, value, ctrl) {
16924
17325
  CHECKED_RESTORE ??= restoreCheckedState;
16925
17326
  if (first) {
16926
17327
  ctrl.c = b;
16927
- if (process.env.NODE_ENV !== "production")
17328
+ if (__octaneDev)
16928
17329
  queueDevFormDiagnostic(input, CURRENT_SCOPE ?? void 0);
16929
17330
  const hydration = activeHydration();
16930
17331
  if (hydration !== null && !hydration.isFresh(input)) {
@@ -16937,10 +17338,10 @@ function setCheckedState(input, value, ctrl) {
16937
17338
  ctrl.sawDC = true;
16938
17339
  return;
16939
17340
  }
16940
- if (process.env.NODE_ENV !== "production" && ctrl.c === -1) devWarnControlledFlip(input, true);
17341
+ if (__octaneDev && ctrl.c === -1) devWarnControlledFlip(input, true);
16941
17342
  const changed = b !== ctrl.c;
16942
17343
  ctrl.c = b;
16943
- if (process.env.NODE_ENV !== "production")
17344
+ if (__octaneDev)
16944
17345
  queueDevFormDiagnostic(input, CURRENT_SCOPE ?? void 0);
16945
17346
  if ((changed || !inActivationWindow(input)) && (STAGED_DOM?.view(input) ?? input).checked !== b)
16946
17347
  (STAGED_DOM?.view(input) ?? input).checked = b;
@@ -16971,18 +17372,18 @@ function setSelectValue(el, value) {
16971
17372
  const first = !ctrl.sawV;
16972
17373
  ctrl.sawV = true;
16973
17374
  if (value == null) {
16974
- if (process.env.NODE_ENV !== "production" && !first && ctrl.sv !== null)
17375
+ if (__octaneDev && !first && ctrl.sv !== null)
16975
17376
  devWarnControlledFlip(el, false);
16976
17377
  ctrl.sv = null;
16977
- if (process.env.NODE_ENV !== "production")
17378
+ if (__octaneDev)
16978
17379
  queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0);
16979
17380
  return;
16980
17381
  }
16981
- if (process.env.NODE_ENV !== "production" && !first && ctrl.sv === null)
17382
+ if (__octaneDev && !first && ctrl.sv === null)
16982
17383
  devWarnControlledFlip(el, true);
16983
17384
  if ((STAGED_DOM?.view(sel) ?? sel).multiple) {
16984
17385
  if (!Array.isArray(value)) {
16985
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0) {
17386
+ if (__octaneDev && el.__oct_loc !== void 0) {
16986
17387
  console.error(
16987
17388
  "The `value` prop supplied to <select> must be an array if `multiple` is true."
16988
17389
  );
@@ -16994,7 +17395,7 @@ function setSelectValue(el, value) {
16994
17395
  ctrl.sv = set;
16995
17396
  } else {
16996
17397
  if (Array.isArray(value)) {
16997
- if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0) {
17398
+ if (__octaneDev && el.__oct_loc !== void 0) {
16998
17399
  console.error(
16999
17400
  "The `value` prop supplied to <select> must be a scalar value if `multiple` is false."
17000
17401
  );
@@ -17003,7 +17404,7 @@ function setSelectValue(el, value) {
17003
17404
  }
17004
17405
  ctrl.sv = toControlledString(value);
17005
17406
  }
17006
- if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0);
17407
+ if (__octaneDev) queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0);
17007
17408
  const hydration = activeHydration();
17008
17409
  if (hydration !== null && !hydration.isFresh(el)) return;
17009
17410
  projectSelectValue(sel, ctrl.sv, false);
@@ -17208,7 +17609,7 @@ function setFormControlSources(el, sources) {
17208
17609
  }
17209
17610
  applyFormControlValues(el, tag, value, defaultValue, checked, defaultChecked, multiple);
17210
17611
  }
17211
- function applyFormControlValues(el, tag, value, defaultValue, checked, defaultChecked, multiple) {
17612
+ function applyFormControlValues(el, tag, value, defaultValue, checked, defaultChecked, multiple, hasChildren = false) {
17212
17613
  const ctrl = armControlled(el);
17213
17614
  const first = !ctrl.formSeen;
17214
17615
  const previousMultiple = ctrl.formMultiple;
@@ -17217,7 +17618,7 @@ function applyFormControlValues(el, tag, value, defaultValue, checked, defaultCh
17217
17618
  journalBag();
17218
17619
  }
17219
17620
  ctrl.formSeen = true;
17220
- if (process.env.NODE_ENV !== "production" && hasDevFormDiagnosticContext(el, CURRENT_SCOPE ?? void 0)) {
17621
+ if (__octaneDev && hasDevFormDiagnosticContext(el, CURRENT_SCOPE ?? void 0)) {
17221
17622
  const diagnostic = ensureDevFormDiagnosticState(el);
17222
17623
  diagnostic.authoringProps = { value, defaultValue, checked, defaultChecked, multiple };
17223
17624
  if (value !== void 0 && defaultValue !== void 0 || tag === "input" && checked !== void 0 && defaultChecked !== void 0) {
@@ -17238,10 +17639,12 @@ function applyFormControlValues(el, tag, value, defaultValue, checked, defaultCh
17238
17639
  }
17239
17640
  if (tag === "textarea") {
17240
17641
  const textarea = el;
17642
+ const childrenOwned = ctrl.formChildren;
17643
+ ctrl.formChildren = hasChildren;
17241
17644
  setValue(textarea, value);
17242
17645
  if (value == null) {
17243
17646
  if (defaultValue != null) setDefaultValue(textarea, defaultValue, first);
17244
- else if (!first && (STAGED_DOM?.view(textarea) ?? textarea).defaultValue !== "")
17647
+ else if (!first && !childrenOwned && (STAGED_DOM?.view(textarea) ?? textarea).defaultValue !== "")
17245
17648
  (STAGED_DOM?.view(textarea) ?? textarea).defaultValue = "";
17246
17649
  }
17247
17650
  return;
@@ -17330,7 +17733,7 @@ function formDiagnosticOutcome(el) {
17330
17733
  };
17331
17734
  }
17332
17735
  function drainDevFormDiagnostics(target) {
17333
- if (process.env.NODE_ENV === "production") return;
17736
+ if (!__octaneDev) return;
17334
17737
  let q = DEV_FORM_CHECKS;
17335
17738
  if (q === null || q.length === 0) return;
17336
17739
  if (target !== void 0) {
@@ -17592,7 +17995,8 @@ function portal(parentScope, slotKey, target, body, props, host, env, fragmentOw
17592
17995
  if (prev !== state) {
17593
17996
  journalRootProperty(parentScope.slots, slotKey, parentScope.slots[slotKey]);
17594
17997
  parentScope.slots[slotKey] = state;
17595
- registerSlot(parentScope, state);
17998
+ if (prev === void 0) registerSlot(parentScope, state);
17999
+ else replacePortalSlot(parentScope, prev, state);
17596
18000
  }
17597
18001
  if (fragmentOwners !== void 0 && fragmentAnchor !== void 0) {
17598
18002
  registerFragmentPortalOwners(state, fragmentOwners, fragmentAnchor);
@@ -17612,6 +18016,16 @@ function portal(parentScope, slotKey, target, body, props, host, env, fragmentOw
17612
18016
  }
17613
18017
  }
17614
18018
  }
18019
+ function replacePortalSlot(scope, prev, state) {
18020
+ const slots = scope._slots;
18021
+ const index = slots === null ? -1 : slots.indexOf(prev);
18022
+ if (index === -1) {
18023
+ registerSlot(scope, state);
18024
+ return;
18025
+ }
18026
+ journalRootProperty(slots, index, prev);
18027
+ slots[index] = state;
18028
+ }
17615
18029
  function prepareFragmentPortalInterleaving(portal2) {
17616
18030
  const start = portal2.start;
17617
18031
  const end = portal2.end;
@@ -17759,8 +18173,9 @@ function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, e
17759
18173
  );
17760
18174
  }
17761
18175
  const norm = normalizePortalBody(rawBody, rawProps);
18176
+ const childType = portalChildType(rawBody, norm.body);
17762
18177
  let state = prev;
17763
- if (state === null || state.target !== target || state.key !== key) {
18178
+ if (state === null || state.target !== target || state.key !== key || state.childType !== childType) {
17764
18179
  if (state !== null) teardownPortalState(state);
17765
18180
  const start = (STAGED_DOM?.view(document) ?? document).createComment("portal");
17766
18181
  const end = (STAGED_DOM?.view(document) ?? document).createComment("/portal");
@@ -17779,9 +18194,9 @@ function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, e
17779
18194
  renderReturnedValue
17780
18195
  );
17781
18196
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
17782
- (0, import_profiling.__profileTrackComponent)(block, profilePortalComponent(rawBody));
18197
+ (0, import_profiling.__profileTrackComponent)(block, profilePortalComponent(rawBody, norm.body));
17783
18198
  }
17784
- state = { __kind: "portalSlotSlot", block, target, key, host, start, end };
18199
+ state = { __kind: "portalSlotSlot", block, target, key, childType, host, start, end };
17785
18200
  registerPortalEventRange(target, state);
17786
18201
  activityPortalCreated?.(block);
17787
18202
  registerDelegationTarget(target);
@@ -17805,7 +18220,7 @@ function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, e
17805
18220
  state.block.props = norm.props;
17806
18221
  state.block.extra = env;
17807
18222
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
17808
- (0, import_profiling.__profileTrackComponent)(state.block, profilePortalComponent(rawBody));
18223
+ (0, import_profiling.__profileTrackComponent)(state.block, profilePortalComponent(rawBody, norm.body));
17809
18224
  }
17810
18225
  renderBlock(state.block);
17811
18226
  }
@@ -17850,7 +18265,7 @@ function normalizePortalBody(rawBody, rawProps) {
17850
18265
  if (typeof rawBody === "function") {
17851
18266
  return { body: rawBody, props: rawProps };
17852
18267
  }
17853
- if (rawBody != null && rawBody.$$kind === import_runtime_tags.ELEMENT_TAG && typeof rawBody.type === "function") {
18268
+ if (rawBody != null && rawBody.$$kind === import_runtime_tags.ELEMENT_TAG && typeof rawBody.type === "function" && rawBody.key === null) {
17854
18269
  return {
17855
18270
  body: rawBody.type,
17856
18271
  props: rawBody.props
@@ -17861,6 +18276,9 @@ function normalizePortalBody(rawBody, rawProps) {
17861
18276
  props: rawBody
17862
18277
  };
17863
18278
  }
18279
+ function portalChildType(rawBody, body) {
18280
+ return typeof rawBody === "function" ? null : body;
18281
+ }
17864
18282
  function genericPortalBody(value, scope) {
17865
18283
  childSlot(scope, 0, scope.parentNode, value, scope.endMarker);
17866
18284
  }
@@ -17888,7 +18306,7 @@ const SCOPED_CHILDREN_PROPERTY = {
17888
18306
  };
17889
18307
  function hasElementConfigKey(config) {
17890
18308
  if (config == null || typeof config !== "object" && typeof config !== "function") return false;
17891
- if (process.env.NODE_ENV !== "production" && import_has_own.hasOwnProp.call(config, "key")) {
18309
+ if (__octaneDev && import_has_own.hasOwnProp.call(config, "key")) {
17892
18310
  const own = Object.getOwnPropertyDescriptor(config, "key");
17893
18311
  if (own?.get != null && own.get.isReactWarning) return false;
17894
18312
  }
@@ -17981,7 +18399,7 @@ function scopedElementRecord(type, props, key, ref, resolve, invocationSite) {
17981
18399
  return descriptor;
17982
18400
  }
17983
18401
  function finalizeElementDescriptor(descriptor) {
17984
- if (process.env.NODE_ENV !== "production") {
18402
+ if (__octaneDev) {
17985
18403
  Object.freeze(descriptor.props);
17986
18404
  Object.freeze(descriptor);
17987
18405
  }
@@ -18026,6 +18444,12 @@ const SCOPED_VALUE_PROPERTIES = {
18026
18444
  function createScopedValue(readElement) {
18027
18445
  return scopedValueDescriptor(createScopedResolver(readElement));
18028
18446
  }
18447
+ function isRenderCall(scope) {
18448
+ return scope === CURRENT_SCOPE && scope !== null;
18449
+ }
18450
+ function deferRecord(read, ...locals) {
18451
+ return createScopedValue(() => read(...locals));
18452
+ }
18029
18453
  function nativeCreateScopedValue(readElement) {
18030
18454
  return scopedValueDescriptor(createNativeScopedResolver(readElement));
18031
18455
  }
@@ -18042,7 +18466,7 @@ function scopedValueDescriptor(resolve) {
18042
18466
  "__octaneInvocationSite",
18043
18467
  SCOPED_VALUE_PROPERTIES.__octaneInvocationSite
18044
18468
  );
18045
- if (process.env.NODE_ENV !== "production") Object.freeze(descriptor);
18469
+ if (__octaneDev) Object.freeze(descriptor);
18046
18470
  return descriptor;
18047
18471
  }
18048
18472
  function createScopedElement(type, props, readChildren, invocationSite) {
@@ -18091,7 +18515,7 @@ function createElementFromConfig(invocationSite, type, props, children = EMPTY_A
18091
18515
  let kids = hasPositional ? children.length === 1 ? children[0] : children : src?.children;
18092
18516
  if (children.length > 1) {
18093
18517
  POSITIONAL_CHILDREN.add(children);
18094
- if (process.env.NODE_ENV !== "production") Object.freeze(children);
18518
+ if (__octaneDev) Object.freeze(children);
18095
18519
  }
18096
18520
  const p = copyElementConfig(src);
18097
18521
  if (hasPositional) p.children = kids;
@@ -18407,7 +18831,7 @@ const Children = {
18407
18831
  }
18408
18832
  };
18409
18833
  const NO_KEY = /* @__PURE__ */ Symbol("NO_KEY");
18410
- function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
18834
+ function componentSlot(parentScope, slotKey, domParent, comp, props, invocationSite, anchor, singleRoot, inherit, key, hasKey) {
18411
18835
  const dispatch = activityDescriptorDispatch;
18412
18836
  const activity = dispatch !== null && comp === dispatch.type;
18413
18837
  if (!activity && typeof comp !== "function" && typeof comp !== "string") {
@@ -18447,7 +18871,7 @@ function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key
18447
18871
  invocationSite
18448
18872
  );
18449
18873
  }
18450
- function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
18874
+ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, invocationSite, anchor, singleRoot, inherit, key, hasKey) {
18451
18875
  if (typeof comp !== "function") throw invalidElementTypeError(comp);
18452
18876
  componentSlotImpl(
18453
18877
  null,
@@ -18556,7 +18980,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
18556
18980
  const stale = hydrationCursor;
18557
18981
  const loc = siteLoc(parentScope, slotKey);
18558
18982
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(55)));
18559
- if (process.env.NODE_ENV !== "production" && loc) {
18983
+ if (__octaneDev && loc) {
18560
18984
  warnHydrationStructuralMismatch(loc, "a component range", describeHydrationNode(stale));
18561
18985
  }
18562
18986
  let node = stale;
@@ -19119,7 +19543,7 @@ function deoptKey(item, index) {
19119
19543
  const element = item != null && item.$$kind === import_runtime_tags.ELEMENT_TAG;
19120
19544
  if (item?.$$kind === import_runtime_tags.PORTAL_TAG && item.key != null) return item.key;
19121
19545
  if (element && item.key != null && !ELEMENTS_MISSING_LIST_KEY.has(item)) return item.key;
19122
- if (element && process.env.NODE_ENV !== "production" && activeHydration() === null) {
19546
+ if (element && __octaneDev && activeHydration() === null) {
19123
19547
  warnMissingListKey(CURRENT_BLOCK);
19124
19548
  }
19125
19549
  return element && item.key != null ? item.key : index;
@@ -19162,7 +19586,7 @@ function applyDeoptProp(el, name, v, ownerBlock) {
19162
19586
  setEventHandler(
19163
19587
  el,
19164
19588
  ev.key,
19165
- process.env.NODE_ENV !== "production" ? devEventListener(name, v) : v
19589
+ __octaneDev ? devEventListener(name, v) : v
19166
19590
  );
19167
19591
  if (ev.capture) {
19168
19592
  if (!_delegatedCapture.has(ev.type)) delegateCaptureEvents([ev.type]);
@@ -19181,7 +19605,7 @@ function hasDangerHTML(props) {
19181
19605
  return true;
19182
19606
  }
19183
19607
  function hasHostPropContent(descriptor) {
19184
- return hasDangerHTML(descriptor.props) || descriptor.type === "textarea" && (descriptor.props?.value != null || descriptor.props?.defaultValue != null);
19608
+ return hasDangerHTML(descriptor.props) || isTextareaTag(descriptor.type) && (descriptor.props?.value != null || descriptor.props?.defaultValue != null);
19185
19609
  }
19186
19610
  function markInputCheckedness(input) {
19187
19611
  (STAGED_DOM?.view(input) ?? input).checked = (STAGED_DOM?.view(input) ?? input).checked;
@@ -19190,7 +19614,7 @@ function markInputCheckedness(input) {
19190
19614
  function applyDeoptProps(el, props, ownerBlock) {
19191
19615
  if (props == null) {
19192
19616
  if (el.localName === "input") markInputCheckedness(el);
19193
- if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, ownerBlock);
19617
+ if (__octaneDev) queueDevFormDiagnostic(el, ownerBlock);
19194
19618
  return;
19195
19619
  }
19196
19620
  let needsCheckedInitialization = el.localName === "input";
@@ -19206,7 +19630,7 @@ function applyDeoptProps(el, props, ownerBlock) {
19206
19630
  applyDeoptProp(el, name, value, ownerBlock);
19207
19631
  }
19208
19632
  if (needsCheckedInitialization) markInputCheckedness(el);
19209
- if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, ownerBlock);
19633
+ if (__octaneDev) queueDevFormDiagnostic(el, ownerBlock);
19210
19634
  }
19211
19635
  function patchDeoptProps(el, prevProps, nextProps, ownerBlock) {
19212
19636
  const prevRef = prevProps != null ? prevProps.ref : void 0;
@@ -19236,7 +19660,7 @@ function patchDeoptProps(el, prevProps, nextProps, ownerBlock) {
19236
19660
  }
19237
19661
  }
19238
19662
  }
19239
- if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, ownerBlock);
19663
+ if (__octaneDev) queueDevFormDiagnostic(el, ownerBlock);
19240
19664
  }
19241
19665
  function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
19242
19666
  const block = scope.block;
@@ -19294,7 +19718,7 @@ function applyHostProps(el, props, scope, state) {
19294
19718
  state.props = props;
19295
19719
  if (props == null) {
19296
19720
  if (needsCheckedInitialization) markInputCheckedness(el);
19297
- if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, scope);
19721
+ if (__octaneDev) queueDevFormDiagnostic(el, scope);
19298
19722
  return;
19299
19723
  }
19300
19724
  for (const name in props) {
@@ -19331,18 +19755,18 @@ function applyHostProps(el, props, scope, state) {
19331
19755
  } else if (!_delegated.has(ev.type)) {
19332
19756
  delegateEvents([ev.type]);
19333
19757
  }
19334
- const handler = process.env.NODE_ENV !== "production" ? devEventListener(name, v) : v;
19758
+ const handler = __octaneDev ? devEventListener(name, v) : v;
19335
19759
  if (!compareLive || (STAGED_DOM?.view(el) ?? el)[ev.key] !== handler)
19336
19760
  setEventHandler(el, ev.key, handler);
19337
19761
  } else if (prev === void 0 || name !== "autoFocus" || isHtmlCustomElement(el)) {
19338
- if (compareLive && (process.env.NODE_ENV === "production" || el.__oct_loc === void 0) && typeof v === "string" && (name === "id" || name === "title" || name === "role" || name === "for" || name === "htmlFor" || name.startsWith("data-") || name.startsWith("aria-")) && (STAGED_DOM?.view(el) ?? el).getAttribute(name === "htmlFor" ? "for" : name) === v)
19762
+ if (compareLive && (!__octaneDev || el.__oct_loc === void 0) && typeof v === "string" && (name === "id" || name === "title" || name === "role" || name === "for" || name === "htmlFor" || name.startsWith("data-") || name.startsWith("aria-")) && (STAGED_DOM?.view(el) ?? el).getAttribute(name === "htmlFor" ? "for" : name) === v)
19339
19763
  continue;
19340
19764
  setAttribute(el, name, v);
19341
19765
  }
19342
19766
  }
19343
19767
  }
19344
19768
  if (needsCheckedInitialization) markInputCheckedness(el);
19345
- if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, scope);
19769
+ if (__octaneDev) queueDevFormDiagnostic(el, scope);
19346
19770
  }
19347
19771
  const DEOPT_DESC = /* @__PURE__ */ Symbol("octane.deoptDesc");
19348
19772
  function hasDeoptOwnedChild(el) {
@@ -19614,7 +20038,7 @@ function reconcileDeoptNode(prev, value, ownerBlock, ns) {
19614
20038
  if (isHostDescriptor(value)) {
19615
20039
  const elNs = inferTagNs(value.type, ns);
19616
20040
  let el;
19617
- if (prev !== null && prev.nodeType === 1 && prev.localName === value.type && prev.namespaceURI === (elNs ?? HTML_NS)) {
20041
+ if (prev !== null && prev.nodeType === 1 && isHostElementOfType(prev, value.type) && prev.namespaceURI === (elNs ?? HTML_NS)) {
19618
20042
  el = prev;
19619
20043
  patchDeoptProps(el, getDeoptDesc(el)?.props ?? null, value.props, ownerBlock);
19620
20044
  } else {
@@ -19624,7 +20048,11 @@ function reconcileDeoptNode(prev, value, ownerBlock, ns) {
19624
20048
  }
19625
20049
  setDeoptDesc(el, value);
19626
20050
  if (!hasHostPropContent(value)) {
19627
- reconcileDeoptChildren(el, value.children, ownerBlock);
20051
+ reconcileDeoptChildren(
20052
+ el,
20053
+ isHtmlTextareaType(value.type, elNs) ? (0, import_shared_value_helpers.textareaChildText)(value.children, rejectTextareaChild) : value.children,
20054
+ ownerBlock
20055
+ );
19628
20056
  }
19629
20057
  return el;
19630
20058
  }
@@ -19685,7 +20113,7 @@ function reconcileDeoptChildren(el, children, ownerBlock) {
19685
20113
  }
19686
20114
  const stampedKey = scan.$$deoptKey;
19687
20115
  const descriptor = stampedKey === void 0 ? getDeoptDesc(scan) : void 0;
19688
- if (stampedKey === void 0 && descriptor === void 0 && !(hydrationOwnsUnstamped ??= activeHydration() !== null)) {
20116
+ if (stampedKey === void 0 && descriptor === void 0 && (!(hydrationOwnsUnstamped ??= activeHydration() !== null) || isTextSeparator(scan))) {
19689
20117
  hasForeign = true;
19690
20118
  scan = getNextSibling(scan);
19691
20119
  continue;
@@ -19764,7 +20192,7 @@ function nextDeoptOwnedChild(scan, adoptHydrationChildren) {
19764
20192
  scan = nodeAfterPortalRange(scan, rangeEnd);
19765
20193
  continue;
19766
20194
  }
19767
- if (!adoptHydrationChildren && scan.$$deoptKey === void 0 && getDeoptDesc(scan) === void 0) {
20195
+ if (adoptHydrationChildren ? isTextSeparator(scan) : scan.$$deoptKey === void 0 && getDeoptDesc(scan) === void 0) {
19768
20196
  scan = getNextSibling(scan);
19769
20197
  continue;
19770
20198
  }
@@ -19797,7 +20225,7 @@ function deoptItemBody(item, scope) {
19797
20225
  let transfer = null;
19798
20226
  if (stale != null) {
19799
20227
  journalRootProperty(block, "deoptNode", block.deoptNode);
19800
- if (scope.slots[0] === void 0 && stale.nodeType === 1 && isHostDescriptor(item) && stale.localName === item.type && (STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode) {
20228
+ if (scope.slots[0] === void 0 && stale.nodeType === 1 && isHostDescriptor(item) && isHostElementOfType(stale, item.type) && (STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode) {
19801
20229
  transfer = stale;
19802
20230
  } else if ((STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode) {
19803
20231
  if (ROOT_RENDER_TRANSACTION !== null) {
@@ -19816,21 +20244,7 @@ function deoptItemBody(item, scope) {
19816
20244
  block.deoptNode = null;
19817
20245
  }
19818
20246
  if (hydration !== null && scope.slots[0] === void 0 && hydration.isOpen(block.startMarker)) {
19819
- const seeded = {
19820
- __kind: "childSlot",
19821
- start: block.startMarker,
19822
- end: block.endMarker,
19823
- ownerHost: null,
19824
- borrowed: true,
19825
- compactable: false,
19826
- block: null,
19827
- text: null,
19828
- currentComp: null,
19829
- currentIsBodyFn: false,
19830
- forSlot: null,
19831
- hostNode: null,
19832
- portal: null
19833
- };
20247
+ const seeded = hydration.lendRange(block.startMarker, block.endMarker);
19834
20248
  scope.slots[0] = seeded;
19835
20249
  registerSlot(scope, seeded);
19836
20250
  }
@@ -19947,12 +20361,10 @@ function mappedDeoptItemBody(item, scope) {
19947
20361
  block.parentNode,
19948
20362
  item.type,
19949
20363
  item.props,
20364
+ item.__octaneInvocationSite,
19950
20365
  block.endMarker,
19951
- void 0,
19952
- true,
19953
20366
  true,
19954
- void 0,
19955
- item.__octaneInvocationSite
20367
+ true
19956
20368
  );
19957
20369
  return;
19958
20370
  }
@@ -19990,11 +20402,31 @@ function descNeedsBlocks(value) {
19990
20402
  if (value.$$kind === import_runtime_tags.PORTAL_TAG) return true;
19991
20403
  return false;
19992
20404
  }
20405
+ function isTextareaTag(type) {
20406
+ return type === "textarea" || type.length === 8 && type.toLowerCase() === "textarea";
20407
+ }
20408
+ function isHtmlTextareaType(type, elNs) {
20409
+ return elNs === void 0 && isTextareaTag(type);
20410
+ }
20411
+ function deoptHostChildren(block, el, d, elNs, adopt = false) {
20412
+ if (!isHtmlTextareaType(d.type, elNs)) {
20413
+ childSlot(block, 0, el, d.children, null, false, el);
20414
+ return;
20415
+ }
20416
+ const text = adopt ? null : getFirstChild(el);
20417
+ childTextHole(
20418
+ block,
20419
+ 0,
20420
+ el,
20421
+ (0, import_shared_value_helpers.textareaChildText)(d.children, rejectTextareaChild),
20422
+ text?.nodeType === 3 ? text : null
20423
+ );
20424
+ }
19993
20425
  function hostElementBody(d, block) {
19994
20426
  let el = block.deoptNode;
19995
20427
  const hydration = activeHydration();
19996
20428
  const elNs = inferTagNs(d.type, deoptChildNamespace(block.parentNode));
19997
- if (el === null && hydration !== null && hydration.node !== null && hydration.node.nodeType === 1 && hydration.node.localName === d.type && (elNs === void 0 || hydration.node.namespaceURI === elNs)) {
20429
+ if (el === null && hydration !== null && hydration.node !== null && hydration.node.nodeType === 1 && isHostElementOfType(hydration.node, d.type) && (elNs === void 0 || hydration.node.namespaceURI === elNs)) {
19998
20430
  el = hydration.node;
19999
20431
  block.deoptNode = el;
20000
20432
  applyDeoptProps(el, d.props, block);
@@ -20002,13 +20434,13 @@ function hostElementBody(d, block) {
20002
20434
  const savedCursor = getNextSibling(hydration.node);
20003
20435
  if (!hasHostPropContent(d)) {
20004
20436
  hydration.node = getFirstChild(el);
20005
- childSlot(block, 0, el, d.children, null, false, el);
20437
+ deoptHostChildren(block, el, d, elNs, true);
20006
20438
  }
20007
20439
  hydration.node = savedCursor;
20008
20440
  return;
20009
20441
  }
20010
20442
  if (el === null && hydration !== null && hydration.node !== null) {
20011
- if (process.env.NODE_ENV !== "production") {
20443
+ if (__octaneDev) {
20012
20444
  const mmLoc = domNode(hydration.node).parentNode?.__oct_loc;
20013
20445
  if (mmLoc)
20014
20446
  hydration.warnStructural(mmLoc, `<${String(d.type)}>`, hydration.describe(hydration.node));
@@ -20030,11 +20462,11 @@ function hostElementBody(d, block) {
20030
20462
  applyDeoptProps(el, d.props, block);
20031
20463
  setDeoptDesc(el, d);
20032
20464
  if (!hasHostPropContent(d)) {
20033
- hydration.suspend(() => childSlot(block, 0, el, d.children, null, false, el));
20465
+ hydration.suspend(() => deoptHostChildren(block, el, d, elNs));
20034
20466
  }
20035
20467
  return;
20036
20468
  }
20037
- if (el === null || el.localName !== d.type || elNs !== void 0 && el.namespaceURI !== elNs) {
20469
+ if (el === null || !isHostElementOfType(el, d.type) || elNs !== void 0 && el.namespaceURI !== elNs) {
20038
20470
  if (el !== null) {
20039
20471
  const retired = el;
20040
20472
  if (ROOT_RENDER_TRANSACTION !== null) {
@@ -20070,7 +20502,7 @@ function hostElementBody(d, block) {
20070
20502
  patchDeoptProps(el, getDeoptDesc(el)?.props ?? null, d.props, block);
20071
20503
  }
20072
20504
  setDeoptDesc(el, d);
20073
- if (!hasHostPropContent(d)) childSlot(block, 0, el, d.children, null, false, el);
20505
+ if (!hasHostPropContent(d)) deoptHostChildren(block, el, d, elNs);
20074
20506
  }
20075
20507
  function hostStringTagBody(d, block) {
20076
20508
  const tag = d.type;
@@ -20078,7 +20510,7 @@ function hostStringTagBody(d, block) {
20078
20510
  const hydration = activeHydration();
20079
20511
  const elNs = inferTagNs(tag, deoptChildNamespace(block.parentNode));
20080
20512
  if (el === null) {
20081
- if (hydration !== null && hydration.node !== null && hydration.node.nodeType === 1 && hydration.node.localName === tag && (elNs === void 0 || hydration.node.namespaceURI === elNs)) {
20513
+ if (hydration !== null && hydration.node !== null && hydration.node.nodeType === 1 && isHostElementOfType(hydration.node, tag) && (elNs === void 0 || hydration.node.namespaceURI === elNs)) {
20082
20514
  el = hydration.node;
20083
20515
  block.deoptNode = el;
20084
20516
  applyDeoptProps(el, d.props, block);
@@ -20093,7 +20525,7 @@ function hostStringTagBody(d, block) {
20093
20525
  }
20094
20526
  if (hydration !== null && hydration.node !== null) {
20095
20527
  noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(51)));
20096
- if (process.env.NODE_ENV !== "production") {
20528
+ if (__octaneDev) {
20097
20529
  const mmLoc = domNode(hydration.node).parentNode?.__oct_loc;
20098
20530
  if (mmLoc) hydration.warnStructural(mmLoc, `<${tag}>`, hydration.describe(hydration.node));
20099
20531
  }
@@ -20198,7 +20630,7 @@ function buildDeoptAdoptQueue(oldChildren, start, end) {
20198
20630
  if (cursor === null || cursor === end) break;
20199
20631
  const t = typeof v;
20200
20632
  const isText = t === "string" || t === "number" || t === "bigint";
20201
- const compatible = isText ? cursor.nodeType === 3 : isHostDescriptor(v) ? cursor.nodeType === 1 && cursor.localName === v.type : false;
20633
+ const compatible = isText ? cursor.nodeType === 3 : isHostDescriptor(v) ? cursor.nodeType === 1 && isHostElementOfType(cursor, v.type) : false;
20202
20634
  if (!compatible) break;
20203
20635
  queue.push({ key: keys[i], node: cursor });
20204
20636
  cursor = getNextSibling(cursor);
@@ -20326,7 +20758,7 @@ function mapSlot(scopeOrItems, slotOrMethod, domParent, items, method, native, c
20326
20758
  callback = native;
20327
20759
  native = mapSlot(items, method);
20328
20760
  }
20329
- if (process.env.NODE_ENV !== "production" && ((flags ?? 0) & 64) !== 0 && items?.length > 0)
20761
+ if (__octaneDev && ((flags ?? 0) & 64) !== 0 && items?.length > 0)
20330
20762
  warnMissingListKey(scopeOrItems.block);
20331
20763
  if (ownEnd === 1) ownEnd = true;
20332
20764
  if (native === true) {
@@ -20623,6 +21055,7 @@ function renderPreparedChildList(state, parentBlock, domParent, preparedList, hy
20623
21055
  if (passthroughStart !== null || passthroughEnd !== null) state.forSlot = null;
20624
21056
  throw error;
20625
21057
  }
21058
+ if (hydration !== null && !passthroughList) hydration.discardLeftoverItems(state.forSlot.end);
20626
21059
  } else {
20627
21060
  reconcileKeyed(
20628
21061
  parentBlock,
@@ -20873,7 +21306,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20873
21306
  const component = pureHost || preparedList !== null ? null : isHostDescriptor(value) ? hostElementBody : valueComponent;
20874
21307
  const unchangedList = preparedList !== null && state.forSlot !== null;
20875
21308
  const unchangedComponent = state.block !== null && component !== null && (component === state.currentComp || typeof value === "function" && state.currentIsBodyFn);
20876
- const unchangedHost = pureHost && state.hostNode !== null && state.block === null && state.hostNode.nodeType === 1 && state.hostNode.localName === value.type;
21309
+ const unchangedHost = pureHost && state.hostNode !== null && state.block === null && state.hostNode.nodeType === 1 && isHostElementOfType(state.hostNode, value.type);
20877
21310
  const primitive = value == null || typeof value !== "object" && typeof value !== "function";
20878
21311
  const text = primitive ? coerceChildText(value) : null;
20879
21312
  const unchangedText = primitive && state.block === null && state.forSlot === null && state.hostNode === null && state.portal === null && state.text === null === (text === "");
@@ -20889,7 +21322,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20889
21322
  if (!unframedMatch) {
20890
21323
  const rootHydration = hydration;
20891
21324
  rootHydration.abandonRoot(
20892
- process.env.NODE_ENV !== "production" ? () => [
21325
+ __octaneDev ? () => [
20893
21326
  componentSourceLoc(parentBlock.body),
20894
21327
  preparedList === null ? "a renderable root" : "a renderable list range",
20895
21328
  rootHydration.describe(cursor)
@@ -20915,6 +21348,8 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20915
21348
  return;
20916
21349
  }
20917
21350
  }
21351
+ let adoptedRange = false;
21352
+ let rebuild = false;
20918
21353
  if (state === void 0) {
20919
21354
  const transaction = ROOT_RENDER_TRANSACTION;
20920
21355
  if (transaction !== null && !transaction.aborted && !ROOT_RENDER_ROLLBACK && parentScope.mounted && !isCreatedInRootRender(transaction, parentBlock)) {
@@ -20935,6 +21370,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20935
21370
  end = hydration.close(anchor);
20936
21371
  if (parentBlock === hydration.rootBlock) hydration.claimRootRemainder(getNextSibling(end));
20937
21372
  hydration.node = getNextSibling(start);
21373
+ adoptedRange = true;
20938
21374
  } else if (hydration !== null && hydration.isOpen(hydration.node)) {
20939
21375
  start = hydration.node;
20940
21376
  end = hydration.close(hydration.node);
@@ -20943,6 +21379,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20943
21379
  hydration.claimRootRemainder(getNextSibling(end));
20944
21380
  }
20945
21381
  hydration.node = getNextSibling(start);
21382
+ adoptedRange = true;
20946
21383
  } else if (bindingMarker !== void 0) {
20947
21384
  start = (STAGED_DOM?.view(document) ?? document).createComment(bindingMarker);
20948
21385
  end = ownEnd && anchor != null ? anchor : (STAGED_DOM?.view(document) ?? document).createComment(import_constants.HYDRATION_END);
@@ -20961,6 +21398,15 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20961
21398
  end = null;
20962
21399
  } else {
20963
21400
  start = null;
21401
+ if (hydration !== null && ownsHost === void 0)
21402
+ rebuild = hydration.discardServerText(
21403
+ parentScope,
21404
+ slotKey,
21405
+ domParent,
21406
+ anchor ?? null,
21407
+ value,
21408
+ preparedList !== null && compiledMapBody === void 0 && mappedFallback !== true
21409
+ );
20964
21410
  end = (STAGED_DOM?.view(document) ?? document).createComment("");
20965
21411
  (STAGED_DOM?.view(domParent) ?? domParent).insertBefore(end, anchor ?? null);
20966
21412
  if (hydration !== null && parentBlock === hydration.rootBlock)
@@ -20984,7 +21430,19 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20984
21430
  };
20985
21431
  parentScope.slots[slotKey] = state;
20986
21432
  registerSlot(parentScope, state);
21433
+ } else if (hydration !== null && hydration.lentSlot === state) {
21434
+ hydration.lentSlot = null;
21435
+ adoptedRange = true;
20987
21436
  }
21437
+ if (adoptedRange)
21438
+ rebuild = hydration.claimRange(
21439
+ parentScope,
21440
+ slotKey,
21441
+ state.start,
21442
+ state.end,
21443
+ value,
21444
+ compiledMapBody === void 0 && mappedFallback !== true ? preparedList : null
21445
+ );
20988
21446
  if (compactable === true) state.compactable = true;
20989
21447
  let upgradeChildren = void 0;
20990
21448
  let upgradeArmed = false;
@@ -21040,6 +21498,21 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
21040
21498
  return;
21041
21499
  }
21042
21500
  if (preparedList !== null) {
21501
+ if (rebuild) {
21502
+ const slot = state;
21503
+ hydration.suspend(
21504
+ () => renderPreparedChildList(
21505
+ slot,
21506
+ parentBlock,
21507
+ domParent,
21508
+ preparedList,
21509
+ null,
21510
+ upgradeArmed,
21511
+ upgradeChildren
21512
+ )
21513
+ );
21514
+ return;
21515
+ }
21043
21516
  renderPreparedChildList(
21044
21517
  state,
21045
21518
  parentBlock,
@@ -21251,7 +21724,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
21251
21724
  return;
21252
21725
  }
21253
21726
  }
21254
- if (hydration === null && comp === hostElementBody && state.block === null && state.hostNode !== null && state.hostNode.nodeType === 1 && state.hostNode.localName === props.type && state.hostNode.namespaceURI === (inferTagNs(props.type, deoptChildNamespace(domParent)) ?? HTML_NS) && !hasDangerHTML(props.props) && !hasDangerHTML(getDeoptDesc(state.hostNode)?.props ?? null)) {
21727
+ if (hydration === null && comp === hostElementBody && state.block === null && state.hostNode !== null && state.hostNode.nodeType === 1 && isHostElementOfType(state.hostNode, props.type) && state.hostNode.namespaceURI === (inferTagNs(props.type, deoptChildNamespace(domParent)) ?? HTML_NS) && !hasDangerHTML(props.props) && !hasDangerHTML(getDeoptDesc(state.hostNode)?.props ?? null)) {
21255
21728
  const el = state.hostNode;
21256
21729
  state.hostNode = null;
21257
21730
  state.currentComp = comp;
@@ -21372,7 +21845,11 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
21372
21845
  b.memoInChain = true;
21373
21846
  }
21374
21847
  state.block = b;
21375
- renderBlock(b);
21848
+ if (rebuild) {
21849
+ hydration.suspend(() => renderBlock(b));
21850
+ } else {
21851
+ renderBlock(b);
21852
+ }
21376
21853
  if (hydration !== null && !state.borrowed && state.end !== null) {
21377
21854
  hydration.node = getNextSibling(state.end);
21378
21855
  }
@@ -21381,6 +21858,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
21381
21858
  if (value !== null && typeof value === "object") throw invalidChildError(value);
21382
21859
  if (state.block !== null || state.hostNode !== null) clearChildContent(state);
21383
21860
  const str = coerceChildText(value);
21861
+ if (adoptedRange) hydration.discardUnadoptedText(parentScope, slotKey, state, str);
21384
21862
  if (str === "") {
21385
21863
  if (state.text !== null) {
21386
21864
  if (ROOT_RENDER_TRANSACTION !== null) clearChildContent(state);
@@ -21466,17 +21944,22 @@ function childTextHole(parentScope, slotKey, domParent, value, cachedNode) {
21466
21944
  throw new Error((0, import_error_codes_client_generated.formatClientError)(26, domParent.localName));
21467
21945
  }
21468
21946
  if (dangerouslySetInnerHTMLOwnsChild(domParent, value)) return null;
21469
- const vt = typeof value;
21947
+ let vt = typeof value;
21470
21948
  const state = parentScope.slots[slotKey];
21949
+ if (state === void 0 && (vt === "object" || vt === "function") && domParent.nodeType === 1 && domParent.localName === "textarea" && domParent.namespaceURI === HTML_NS && !isSignalHandle(value)) {
21950
+ value = (0, import_shared_value_helpers.textareaChildText)(value, rejectTextareaChild);
21951
+ vt = "string";
21952
+ }
21471
21953
  if (ROOT_RENDER_TRANSACTION !== null && state === void 0 && parentScope.mounted) {
21472
21954
  journalBag();
21473
21955
  journalRootRange(domParent, null, null);
21474
21956
  journalRootProperty(parentScope.slots, slotKey, parentScope.slots[slotKey]);
21475
21957
  }
21476
- if (state === void 0 && vt !== "object" && vt !== "function") {
21958
+ if (state === void 0 && (value === null || vt !== "object" && vt !== "function")) {
21477
21959
  const str = value == null || value === false || value === true ? "" : vt === "string" ? value : String(value);
21478
21960
  if (str === "") {
21479
21961
  if (cachedNode !== null) (STAGED_DOM?.view(cachedNode) ?? cachedNode).remove();
21962
+ else activeHydration()?.hempty(domParent, siteLoc(parentScope, slotKey));
21480
21963
  return null;
21481
21964
  }
21482
21965
  if (cachedNode !== null) {
@@ -21484,16 +21967,25 @@ function childTextHole(parentScope, slotKey, domParent, value, cachedNode) {
21484
21967
  return cachedNode;
21485
21968
  }
21486
21969
  const hydration2 = activeHydration();
21487
- if (hydration2 !== null) return hydration2.htext(domParent, str, siteLoc(parentScope, slotKey));
21488
- const tn = (STAGED_DOM?.view(document) ?? document).createTextNode(str);
21489
- (STAGED_DOM?.view(domParent) ?? domParent).appendChild(tn);
21490
- return tn;
21970
+ if (hydration2 === null) {
21971
+ const tn = (STAGED_DOM?.view(document) ?? document).createTextNode(str);
21972
+ (STAGED_DOM?.view(domParent) ?? domParent).appendChild(tn);
21973
+ return tn;
21974
+ }
21975
+ if (!hydration2.framesSlotContent(domParent))
21976
+ return hydration2.htext(domParent, str, siteLoc(parentScope, slotKey));
21491
21977
  }
21492
21978
  if (state === void 0 && cachedNode !== null)
21493
21979
  (STAGED_DOM?.view(cachedNode) ?? cachedNode).remove();
21494
21980
  const hydration = activeHydration();
21495
- if (hydration !== null && state === void 0) hydration.node = getFirstChild(domParent);
21496
- childSlot(parentScope, slotKey, domParent, value, null, false, domParent);
21981
+ if (hydration !== null && state === void 0)
21982
+ hydration.hydrateOnlyChild(
21983
+ parentScope,
21984
+ slotKey,
21985
+ domParent,
21986
+ () => childSlot(parentScope, slotKey, domParent, value, null, false, domParent)
21987
+ );
21988
+ else childSlot(parentScope, slotKey, domParent, value, null, false, domParent);
21497
21989
  const s = parentScope.slots[slotKey];
21498
21990
  return s.block === null && s.forSlot === null && s.hostNode === null ? s.text : null;
21499
21991
  }
@@ -21814,8 +22306,11 @@ function hmr(fn) {
21814
22306
  }
21815
22307
  };
21816
22308
  function wrapper(props, scope, extra) {
21817
- if (scope !== void 0) meta.liveBlocks.add(scope.block);
21818
- return meta.fn(props, scope, extra);
22309
+ if (scope === CURRENT_SCOPE && scope !== null) {
22310
+ meta.liveBlocks.add(scope.block);
22311
+ return meta.fn(props, scope, extra);
22312
+ }
22313
+ return Reflect.apply(meta.fn, this, arguments);
21819
22314
  }
21820
22315
  Object.defineProperty(wrapper, HMR, {
21821
22316
  get() {
@@ -22223,7 +22718,7 @@ function mountPassthroughPending(state, thenable) {
22223
22718
  setTryBranch(state, -1);
22224
22719
  scheduleRender(state.parentBlock);
22225
22720
  };
22226
- thenable.then(retry, retry);
22721
+ resumeOnSettle(thenable, retry);
22227
22722
  }
22228
22723
  function renderPassthroughTry(state) {
22229
22724
  if (state.branch === 0 && state.block !== null) {
@@ -22880,7 +23375,7 @@ function renderInitialSuspenseHydration(state, initial) {
22880
23375
  return;
22881
23376
  scheduleRender(state.parentBlock);
22882
23377
  };
22883
- suspended.then(resume, resume);
23378
+ resumeOnSettle(suspended, resume);
22884
23379
  return;
22885
23380
  }
22886
23381
  initialSuspenseHydrations?.delete(state);
@@ -23949,7 +24444,7 @@ function attachResume(state, thenable) {
23949
24444
  commitResume(state);
23950
24445
  }
23951
24446
  };
23952
- thenable.then(retry, retry);
24447
+ resumeOnSettle(thenable, retry);
23953
24448
  }
23954
24449
  function startTransition(fn) {
23955
24450
  runTransition(fn);
@@ -24113,7 +24608,8 @@ function useActionState(action, initialState, permalinkOrSlot, slot) {
24113
24608
  }
24114
24609
  };
24115
24610
  const dispatch = ((payload) => {
24116
- const outsideTransition = process.env.NODE_ENV !== "production" && transitionActionBatchForUpdate() === null && ACTIVE_SUBMIT_DISPATCH?.intercepted !== true;
24611
+ const outsideTransition = __octaneDev && transitionActionBatchForUpdate() === null && ACTIVE_SUBMIT_DISPATCH?.intercepted !== true;
24612
+ const run = slotRef.action;
24117
24613
  slotRef.pendingCount++;
24118
24614
  setPending(true);
24119
24615
  slotRef.chain = slotRef.chain.then(
@@ -24125,8 +24621,8 @@ function useActionState(action, initialState, permalinkOrSlot, slot) {
24125
24621
  startTransition(() => {
24126
24622
  let p;
24127
24623
  try {
24128
- const result = slotRef.action(prevState, payload);
24129
- if (process.env.NODE_ENV !== "production" && outsideTransition && result != null && typeof result.then === "function") {
24624
+ const result = run(prevState, payload);
24625
+ if (__octaneDev && outsideTransition && result != null && typeof result.then === "function") {
24130
24626
  console.error(
24131
24627
  "An async useActionState action was dispatched outside a transition or action. Use an action/formAction prop or wrap the dispatch in startTransition."
24132
24628
  );
@@ -24221,6 +24717,9 @@ function useFormStatus(slot) {
24221
24717
  }
24222
24718
  return s.form ? FORM_STATUS.get(s.form) ?? IDLE_FORM_STATUS : IDLE_FORM_STATUS;
24223
24719
  }
24720
+ function basicOptimisticReducer(state, value) {
24721
+ return typeof value === "function" ? value(state) : value;
24722
+ }
24224
24723
  function useOptimistic(passthrough, updateFnOrSlot, slot) {
24225
24724
  let updateFn;
24226
24725
  if (typeof updateFnOrSlot === "symbol") slot = updateFnOrSlot;
@@ -24244,10 +24743,9 @@ function useOptimistic(passthrough, updateFnOrSlot, slot) {
24244
24743
  };
24245
24744
  const slotRef = {
24246
24745
  queue: [],
24247
- updateFn,
24248
24746
  armed: false,
24249
24747
  add: (value) => {
24250
- if (process.env.NODE_ENV !== "production" && TRANSITION_DEPTH === 0 && ASYNC_TRANSITION_COUNT === 0) {
24748
+ if (__octaneDev && TRANSITION_DEPTH === 0 && ASYNC_TRANSITION_COUNT === 0) {
24251
24749
  console.error(
24252
24750
  "An optimistic update was dispatched outside a transition or action. Wrap it in startTransition or call it from an action."
24253
24751
  );
@@ -24273,11 +24771,9 @@ function useOptimistic(passthrough, updateFnOrSlot, slot) {
24273
24771
  TRANSITION_LISTENERS.add(listener);
24274
24772
  registerHookCleanup(scope, () => TRANSITION_LISTENERS.delete(listener));
24275
24773
  }
24276
- s.updateFn = updateFn;
24277
24774
  let optimistic = passthrough;
24278
- for (let i = 0; i < s.queue.length; i++) {
24279
- optimistic = s.updateFn ? s.updateFn(optimistic, s.queue[i]) : s.queue[i];
24280
- }
24775
+ const reduce = updateFn ?? basicOptimisticReducer;
24776
+ for (let i = 0; i < s.queue.length; i++) optimistic = reduce(optimistic, s.queue[i]);
24281
24777
  return [optimistic, s.add];
24282
24778
  }
24283
24779
  function spawnDeferredSwap(s) {
@@ -24866,7 +25362,7 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
24866
25362
  if (innerEnd !== state.end && getNextSibling(innerEnd) !== state.end) {
24867
25363
  if (PRESENTATION_HYDRATION?.revision !== void 0)
24868
25364
  throw new Error((0, import_error_codes_client_generated.formatClientError)(75));
24869
- if (process.env.NODE_ENV !== "production") {
25365
+ if (__octaneDev) {
24870
25366
  const mmLoc = siteLoc(parentScope, slotKey);
24871
25367
  if (mmLoc)
24872
25368
  hydration.warnStructural(
@@ -24910,7 +25406,7 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
24910
25406
  }
24911
25407
  } else if (hydration !== null && getNextSibling(state.start) !== state.end) {
24912
25408
  if (PRESENTATION_HYDRATION?.revision !== void 0) throw new Error((0, import_error_codes_client_generated.formatClientError)(75));
24913
- if (process.env.NODE_ENV !== "production") {
25409
+ if (__octaneDev) {
24914
25410
  const mmLoc = siteLoc(parentScope, slotKey);
24915
25411
  if (mmLoc)
24916
25412
  hydration.warnStructural(
@@ -24935,7 +25431,13 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
24935
25431
  );
24936
25432
  state.block = b;
24937
25433
  state.markerlessBefore = before;
24938
- renderBlock(b);
25434
+ try {
25435
+ renderBlock(b);
25436
+ } catch (error) {
25437
+ if ((before ? getNextSibling(before) : getFirstChild(domParent)) !== after)
25438
+ finalizeMarkerlessBranch(state, domParent, b, marker, before, after);
25439
+ throw error;
25440
+ }
24939
25441
  finalizeMarkerlessBranch(state, domParent, b, marker, before, after);
24940
25442
  replaceSharedBlockBoundary(
24941
25443
  parentBlock,
@@ -25263,7 +25765,7 @@ function suspendHiddenActivity(state, thenable) {
25263
25765
  if (state.pendingThenable !== thenable || !state.hidden || blockSubtreeDisposed(block)) return;
25264
25766
  scheduleRender(block);
25265
25767
  };
25266
- thenable.then(retry, retry);
25768
+ resumeOnSettle(thenable, retry);
25267
25769
  }
25268
25770
  function renderHiddenActivity(state, replay = false, block = state.block) {
25269
25771
  const previousReplay = RESUME_REPLAY;
@@ -25724,7 +26226,7 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
25724
26226
  if (TRANSITION_JOURNAL !== null) journalForSlot(state);
25725
26227
  let suspendForEmpty = false;
25726
26228
  if (hydration !== null && (serverMarkerState === 1 || serverMarkerState === -1 && hydration.isOpen(getNextSibling(state.start)))) {
25727
- if (process.env.NODE_ENV !== "production") {
26229
+ if (__octaneDev) {
25728
26230
  const mmLoc = siteLoc(parentScope, slotKey) || domParent.__oct_loc;
25729
26231
  if (mmLoc) hydration.warnStructural(mmLoc, "an empty list (@empty)", "a populated list");
25730
26232
  }
@@ -25760,7 +26262,7 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
25760
26262
  state.emptyBlock = null;
25761
26263
  }
25762
26264
  if (!isEmpty && hydration !== null && (serverMarkerState === 0 || serverMarkerState === -1 && ((flags || 0) & 16) === 0 && getNextSibling(state.start) !== null && getNextSibling(state.start) !== state.end && !hydration.isOpen(getNextSibling(state.start)))) {
25763
- if (process.env.NODE_ENV !== "production") {
26265
+ if (__octaneDev) {
25764
26266
  const mmLoc = siteLoc(parentScope, slotKey) || domParent.__oct_loc;
25765
26267
  if (mmLoc) hydration.warnStructural(mmLoc, "a populated list", "an empty list (@empty)");
25766
26268
  }
@@ -25796,7 +26298,7 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
25796
26298
  (f & 2) !== 0,
25797
26299
  (f & 16) !== 0
25798
26300
  );
25799
- if (hydration !== null) discardLeftoverHydrationItems(state.end, hydration);
26301
+ if (hydration !== null) hydration.discardLeftoverItems(state.end);
25800
26302
  } else {
25801
26303
  reconcileKeyed(
25802
26304
  parentBlock,
@@ -26042,13 +26544,6 @@ function fastMapSlot(scopeOrItems, slotOrMethod, domParent, items, method, nativ
26042
26544
  true
26043
26545
  );
26044
26546
  }
26045
- function discardLeftoverHydrationItems(end, hydration) {
26046
- const n = hydration.node;
26047
- if (n === null || n === end || (STAGED_DOM?.view(n) ?? n).parentNode !== (STAGED_DOM?.view(end) ?? end).parentNode)
26048
- return;
26049
- noteRecoverableHydrationError(() => new Error((0, import_error_codes_client_generated.formatClientError)(56)));
26050
- removeRange(n, end);
26051
- }
26052
26547
  function removeRange(from, end) {
26053
26548
  let n = from;
26054
26549
  while (n !== null && n !== end) {
@@ -26178,7 +26673,7 @@ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, single
26178
26673
  const newLen = items.length;
26179
26674
  const observeKey = parentBlock.idState.renderOwner?.signalOwner !== void 0 ? trackSignalRetryListKeys(parentBlock, state, newLen, keySource) : void 0;
26180
26675
  if (newLen === 0) return;
26181
- if (process.env.NODE_ENV !== "production") {
26676
+ if (__octaneDev) {
26182
26677
  keySource = checkedListKey(keySource, normalizeKey);
26183
26678
  normalizeKey = false;
26184
26679
  }
@@ -26361,7 +26856,7 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
26361
26856
  return;
26362
26857
  }
26363
26858
  const observeKey = parentBlock.idState.renderOwner?.signalOwner !== void 0 ? trackSignalRetryListKeys(parentBlock, state, newLen, keySource) : void 0;
26364
- if (process.env.NODE_ENV !== "production") {
26859
+ if (__octaneDev) {
26365
26860
  keySource = checkedListKey(keySource, normalizeKey);
26366
26861
  normalizeKey = false;
26367
26862
  }
@@ -26798,87 +27293,65 @@ function batchClearItems(state, oldItems, ownedRootClear = false) {
26798
27293
  function mountItem(parentBlock, parentNode, anchor, item, index, key, body, forSlot, singleRoot, ssrMarkerless, adoptNode = null) {
26799
27294
  const hydration = activeHydration();
26800
27295
  if (hydration !== null) {
26801
- if (ssrMarkerless && !hydration.isOpen(hydration.node) && (singleRoot !== 2 || forSlot.plainDeopt !== true || isHostDescriptor(item) && !descNeedsBlocks(item))) {
26802
- if (hydration.node !== null && hydration.node !== forSlot.end && (singleRoot !== 2 || forSlot.plainDeopt !== true || hydration.node.nodeType === 1 && domNode(hydration.node).parentNode === parentNode)) {
26803
- const root = hydration.node;
26804
- const block3 = createBlock(
27296
+ const node = hydration.node;
27297
+ if (ssrMarkerless && !hydration.isOpen(node) && (singleRoot !== 2 || forSlot.plainDeopt !== true || isHostDescriptor(item) && !descNeedsBlocks(item))) {
27298
+ if (node !== null && node !== forSlot.end && (singleRoot !== 2 || forSlot.plainDeopt !== true || node.nodeType === 1 && domNode(node).parentNode === parentNode && isHostElementOfType(node, item.type))) {
27299
+ const block2 = createBlock(
26805
27300
  "control-flow",
26806
27301
  parentBlock,
26807
27302
  parentNode,
26808
- root,
26809
- root,
27303
+ node,
27304
+ node,
26810
27305
  body,
26811
27306
  item,
26812
27307
  forSlot.env
26813
27308
  );
26814
- block3.forSlot = forSlot;
26815
- block3.key = key;
26816
- block3.itemIndex = index;
26817
- if (singleRoot === 2 && forSlot.plainDeopt === true) block3.deoptNode = root;
26818
- renderBlock(block3);
26819
- hydration.node = domNode(block3.endMarker)?.nextSibling ?? getNextSibling(root);
26820
- return block3;
26821
- }
26822
- if (process.env.NODE_ENV !== "production") {
26823
- const mmLoc = parentNode.__oct_loc;
26824
- if (mmLoc)
26825
- hydration.warnStructural(mmLoc, "another list item", hydration.describe(hydration.node));
26826
- }
26827
- return hydration.suspend(
26828
- () => mountItem(
26829
- parentBlock,
26830
- parentNode,
26831
- anchor,
26832
- item,
26833
- index,
26834
- key,
26835
- body,
26836
- forSlot,
26837
- singleRoot,
26838
- ssrMarkerless
26839
- )
26840
- );
26841
- }
26842
- if (!hydration.isOpen(hydration.node)) {
26843
- if (process.env.NODE_ENV !== "production") {
26844
- const mmLoc = parentNode.__oct_loc;
26845
- if (mmLoc)
26846
- hydration.warnStructural(mmLoc, "another list item", hydration.describe(hydration.node));
26847
- }
26848
- return hydration.suspend(
26849
- () => mountItem(
26850
- parentBlock,
26851
- parentNode,
26852
- anchor,
26853
- item,
26854
- index,
26855
- key,
26856
- body,
26857
- forSlot,
26858
- singleRoot,
26859
- ssrMarkerless
26860
- )
27309
+ block2.forSlot = forSlot;
27310
+ block2.key = key;
27311
+ block2.itemIndex = index;
27312
+ if (singleRoot === 2 && forSlot.plainDeopt === true) block2.deoptNode = node;
27313
+ renderBlock(block2);
27314
+ hydration.node = domNode(block2.endMarker)?.nextSibling ?? getNextSibling(node);
27315
+ return block2;
27316
+ }
27317
+ } else if (hydration.isOpen(node)) {
27318
+ const itemEnd = hydration.close(node);
27319
+ hydration.node = getNextSibling(node);
27320
+ const block2 = createBlock(
27321
+ "control-flow",
27322
+ parentBlock,
27323
+ parentNode,
27324
+ node,
27325
+ itemEnd,
27326
+ body,
27327
+ item,
27328
+ forSlot.env
26861
27329
  );
26862
- }
26863
- const itemStart = hydration.node;
26864
- const itemEnd = hydration.close(itemStart);
26865
- hydration.node = getNextSibling(itemStart);
26866
- const block2 = createBlock(
26867
- "control-flow",
26868
- parentBlock,
26869
- parentNode,
26870
- itemStart,
26871
- itemEnd,
26872
- body,
26873
- item,
26874
- forSlot.env
27330
+ block2.forSlot = forSlot;
27331
+ block2.key = key;
27332
+ block2.itemIndex = index;
27333
+ renderBlock(block2);
27334
+ hydration.node = getNextSibling(itemEnd);
27335
+ return block2;
27336
+ }
27337
+ hydration.discardItems(
27338
+ forSlot.end,
27339
+ __octaneDev ? forSlot.plainDeopt === true && isHostDescriptor(item) && !descNeedsBlocks(item) ? `<${item.type}>` : "another list item" : ""
27340
+ );
27341
+ return hydration.suspend(
27342
+ () => mountItem(
27343
+ parentBlock,
27344
+ parentNode,
27345
+ anchor,
27346
+ item,
27347
+ index,
27348
+ key,
27349
+ body,
27350
+ forSlot,
27351
+ singleRoot,
27352
+ ssrMarkerless
27353
+ )
26875
27354
  );
26876
- block2.forSlot = forSlot;
26877
- block2.key = key;
26878
- block2.itemIndex = index;
26879
- renderBlock(block2);
26880
- hydration.node = getNextSibling(itemEnd);
26881
- return block2;
26882
27355
  }
26883
27356
  if (singleRoot === true || singleRoot === 2 && isHostDescriptor(item) && !descNeedsBlocks(item)) {
26884
27357
  if (adoptNode !== null) {
@@ -26913,7 +27386,12 @@ function mountItem(parentBlock, parentNode, anchor, item, index, key, body, forS
26913
27386
  block2.forSlot = forSlot;
26914
27387
  block2.key = key;
26915
27388
  block2.itemIndex = index;
26916
- renderBlock(block2);
27389
+ try {
27390
+ renderBlock(block2);
27391
+ } catch (error) {
27392
+ discardThrownItem(block2, error, anchor);
27393
+ throw error;
27394
+ }
26917
27395
  const root = (STAGED_DOM?.view(anchor) ?? anchor).previousSibling;
26918
27396
  block2.startMarker = root;
26919
27397
  block2.endMarker = root;
@@ -26948,12 +27426,21 @@ function mountItem(parentBlock, parentNode, anchor, item, index, key, body, forS
26948
27426
  try {
26949
27427
  renderBlock(block);
26950
27428
  } catch (error) {
26951
- if (isSuspenseException(error)) retainDiscardedWarmMemos(block);
26952
- unmountBlock(block, !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block));
27429
+ discardThrownItem(block, error, null);
26953
27430
  throw error;
26954
27431
  }
26955
27432
  return block;
26956
27433
  }
27434
+ function discardThrownItem(block, error, selfMarkedAnchor) {
27435
+ const bag = block.slots[0];
27436
+ if (selfMarkedAnchor !== null && bag != null && bag.__kind === void 0) {
27437
+ const root = (STAGED_DOM?.view(selfMarkedAnchor) ?? selfMarkedAnchor).previousSibling;
27438
+ block.startMarker = root;
27439
+ block.endMarker = root;
27440
+ }
27441
+ if (isSuspenseException(error)) retainDiscardedWarmMemos(block);
27442
+ unmountBlock(block, !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block));
27443
+ }
26957
27444
  function moveBlockBefore(block, anchor) {
26958
27445
  const parent = domNode(block.startMarker).parentNode;
26959
27446
  const end = block.endMarker;
@@ -27527,7 +28014,7 @@ function clearRootContainer(container) {
27527
28014
  }
27528
28015
  }
27529
28016
  function claimRootContainer(container) {
27530
- if (process.env.NODE_ENV === "production") return null;
28017
+ if (!__octaneDev) return null;
27531
28018
  const owners = ROOT_CONTAINER_OWNERS ??= /* @__PURE__ */ new WeakMap();
27532
28019
  if (owners.has(container)) {
27533
28020
  console.error(
@@ -27545,7 +28032,7 @@ function releaseRootContainer(container, token) {
27545
28032
  }
27546
28033
  function warnCreateRootElementOption(options) {
27547
28034
  if (isElementDescriptor(options)) {
27548
- if (process.env.NODE_ENV !== "production") {
28035
+ if (__octaneDev) {
27549
28036
  console.error(
27550
28037
  "You passed a JSX element to createRoot. You probably meant to call root.render instead. Example usage:\n\n let root = createRoot(domContainer);\n root.render(<App />);"
27551
28038
  );
@@ -27555,7 +28042,7 @@ function warnCreateRootElementOption(options) {
27555
28042
  return options;
27556
28043
  }
27557
28044
  function warnRootRenderSecondArgument(second, container) {
27558
- if (process.env.NODE_ENV === "production") return;
28045
+ if (!__octaneDev) return;
27559
28046
  if (typeof second === "function") {
27560
28047
  console.error(
27561
28048
  "does not support the second callback argument. To execute a side effect after rendering, declare it in a component body with useEffect()."
@@ -27571,14 +28058,14 @@ function warnRootRenderSecondArgument(second, container) {
27571
28058
  }
27572
28059
  }
27573
28060
  function warnRootUnmountArgument() {
27574
- if (process.env.NODE_ENV !== "production") {
28061
+ if (__octaneDev) {
27575
28062
  console.error(
27576
28063
  "does not support a callback argument. To execute a side effect after rendering, declare it in a component body with useEffect()."
27577
28064
  );
27578
28065
  }
27579
28066
  }
27580
28067
  function warnRootLifecycleUnmount() {
27581
- if (process.env.NODE_ENV !== "production") {
28068
+ if (__octaneDev) {
27582
28069
  console.error(
27583
28070
  "Attempted to synchronously unmount a root while Octane was already rendering. Octane cannot finish unmounting the root until the current render has completed, which may lead to a race condition."
27584
28071
  );
@@ -27586,7 +28073,7 @@ function warnRootLifecycleUnmount() {
27586
28073
  }
27587
28074
  let HTML_NESTING_WARNINGS = null;
27588
28075
  function devHtmlNesting(childTag, ancestors, childLocation, ancestorLocation) {
27589
- if (process.env.NODE_ENV !== "production") {
28076
+ if (__octaneDev) {
27590
28077
  const activeBlock = CURRENT_SCOPE?.block ?? CURRENT_BLOCK;
27591
28078
  let message = null;
27592
28079
  if (ancestors.length === 0) {
@@ -27631,7 +28118,7 @@ function devHtmlNesting(childTag, ancestors, childLocation, ancestorLocation) {
27631
28118
  }
27632
28119
  }
27633
28120
  function validateRootHtmlNesting(container, body) {
27634
- if (process.env.NODE_ENV !== "production") {
28121
+ if (__octaneDev) {
27635
28122
  if (container.nodeType !== 1) return;
27636
28123
  const element = container;
27637
28124
  if (componentSourceLoc(body) === void 0 || element.namespaceURI !== "http://www.w3.org/1999/xhtml" || element.localName === "div" || element.localName === "body" || element.localName === "html" || element.localName.includes("-")) {
@@ -27785,7 +28272,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
27785
28272
  try {
27786
28273
  renderBlock(mountedRoot);
27787
28274
  if (QUEUE.length > 0) drainHydrationRenderPhaseUpdates(mountedRoot);
27788
- if (process.env.NODE_ENV !== "production") {
28275
+ if (__octaneDev) {
27789
28276
  validateRootHtmlNesting(container, body);
27790
28277
  }
27791
28278
  } catch (error) {
@@ -27852,7 +28339,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
27852
28339
  } else {
27853
28340
  body = ROOT_RENDERABLE_BODY;
27854
28341
  if (typeof bodyOrElement === "symbol") {
27855
- if (process.env.NODE_ENV !== "production") {
28342
+ if (__octaneDev) {
27856
28343
  console.error(
27857
28344
  `Symbols are not valid as an Octane child.
27858
28345
  root.render(${String(bodyOrElement)})`
@@ -27900,7 +28387,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
27900
28387
  if (!inFlush && CURRENT_BLOCK === null && !inNestedUpdateCallback() && EFFECT_EVENT_LIFECYCLE_DEPTH === 0) {
27901
28388
  UPDATE_CHAIN_ID++;
27902
28389
  }
27903
- if (process.env.NODE_ENV !== "production" && !renderOwner.preservePresentation && (inFlush || CURRENT_BLOCK !== null || EFFECT_BODY_DEPTH > 0 || EFFECT_EVENT_LIFECYCLE_DEPTH > 0)) {
28390
+ if (__octaneDev && !renderOwner.preservePresentation && (inFlush || CURRENT_BLOCK !== null || EFFECT_BODY_DEPTH > 0 || EFFECT_EVENT_LIFECYCLE_DEPTH > 0)) {
27904
28391
  warnRootLifecycleUnmount();
27905
28392
  }
27906
28393
  unmounted = true;
@@ -28032,7 +28519,7 @@ function hydrateRootWithOutputHandler(container, bodyOrElement, propsOrOptions,
28032
28519
  }
28033
28520
  rootOptions = propsOrOptions;
28034
28521
  } else if (bodyOrElement === void 0) {
28035
- if (process.env.NODE_ENV !== "production") {
28522
+ if (__octaneDev) {
28036
28523
  console.error(
28037
28524
  "Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)"
28038
28525
  );
@@ -28171,9 +28658,7 @@ function hydrateRootWithOutputHandler(container, bodyOrElement, propsOrOptions,
28171
28658
  createdInRootRender(rootBlock);
28172
28659
  journalRootProperty(idState, "next", idState.next);
28173
28660
  idState.next = rootOptions?.identifierSeed ?? 0;
28174
- let firstNode = getFirstChild(container);
28175
- while (firstNode !== null && (firstNode.nodeType === 10 || isRendererHydrationStyle(firstNode)))
28176
- firstNode = getNextSibling(firstNode);
28661
+ const firstNode = skipFoldedHeadPrefix(container, getFirstChild(container));
28177
28662
  const hydration = new HydrationCapability(rootBlock, firstNode, seeds);
28178
28663
  if (bindingLeases?.length) {
28179
28664
  const attempted = rootBlock;
@@ -28322,7 +28807,15 @@ function createIndependentHydrateActivator(body) {
28322
28807
  tryBlock(scope, 0, scope.block.parentNode, content, null, null, scope.block.endMarker);
28323
28808
  };
28324
28809
  const adapter = (_props, scope) => {
28325
- componentSlotVoid(scope, 0, scope.block.parentNode, framed, void 0, scope.block.endMarker);
28810
+ componentSlotVoid(
28811
+ scope,
28812
+ 0,
28813
+ scope.block.parentNode,
28814
+ framed,
28815
+ void 0,
28816
+ void 0,
28817
+ scope.block.endMarker
28818
+ );
28326
28819
  };
28327
28820
  const root = hydrateRoot(element, adapter, captures, {
28328
28821
  identifierPrefix: manifest.boundaryId + "-",
@@ -28415,7 +28908,7 @@ function applyHintAttrs(el, opts) {
28415
28908
  }
28416
28909
  }
28417
28910
  function preload(href, options) {
28418
- if (process.env.NODE_ENV !== "production") {
28911
+ if (__octaneDev) {
28419
28912
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preload", href, options);
28420
28913
  if (warning !== null) console.error(warning);
28421
28914
  }
@@ -28452,7 +28945,7 @@ function preload(href, options) {
28452
28945
  });
28453
28946
  }
28454
28947
  function preinit(href, options) {
28455
- if (process.env.NODE_ENV !== "production") {
28948
+ if (__octaneDev) {
28456
28949
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preinit", href, options);
28457
28950
  if (warning !== null) console.error(warning);
28458
28951
  }
@@ -28476,7 +28969,7 @@ function preinit(href, options) {
28476
28969
  }
28477
28970
  }
28478
28971
  function preconnect(href, options) {
28479
- if (process.env.NODE_ENV !== "production") {
28972
+ if (__octaneDev) {
28480
28973
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preconnect", href, options);
28481
28974
  if (warning !== null) console.error(warning);
28482
28975
  }
@@ -28497,7 +28990,7 @@ function preconnect(href, options) {
28497
28990
  });
28498
28991
  }
28499
28992
  function prefetchDNS(href) {
28500
- if (process.env.NODE_ENV !== "production") {
28993
+ if (__octaneDev) {
28501
28994
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("prefetchDNS", href, arguments[1], arguments.length > 1);
28502
28995
  if (warning !== null) console.error(warning);
28503
28996
  }
@@ -28512,7 +29005,7 @@ function prefetchDNS(href) {
28512
29005
  });
28513
29006
  }
28514
29007
  function preloadModule(href, options) {
28515
- if (process.env.NODE_ENV !== "production") {
29008
+ if (__octaneDev) {
28516
29009
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preloadModule", href, options);
28517
29010
  if (warning !== null) console.error(warning);
28518
29011
  }
@@ -28533,7 +29026,7 @@ function preloadModule(href, options) {
28533
29026
  });
28534
29027
  }
28535
29028
  function preinitModule(href, options) {
28536
- if (process.env.NODE_ENV !== "production") {
29029
+ if (__octaneDev) {
28537
29030
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preinitModule", href, options);
28538
29031
  if (warning !== null) console.error(warning);
28539
29032
  }
@@ -28641,7 +29134,7 @@ function warnInvalidStylesheetResource(reason) {
28641
29134
  );
28642
29135
  }
28643
29136
  function stylesheetResource(attrs, invalidReason) {
28644
- if (process.env.NODE_ENV !== "production" && invalidReason !== void 0) {
29137
+ if (__octaneDev && invalidReason !== void 0) {
28645
29138
  warnInvalidStylesheetResource(invalidReason);
28646
29139
  return;
28647
29140
  }
@@ -28665,13 +29158,13 @@ function styleResource(attrs, css, development) {
28665
29158
  if (typeof href !== "string" || href === "") return;
28666
29159
  const state = resourceState();
28667
29160
  if (state.sheets.has(href)) return;
28668
- if (process.env.NODE_ENV !== "production" && development === true && hasHeadHint("preload:style:" + href)) {
29161
+ if (__octaneDev && development === true && hasHeadHint("preload:style:" + href)) {
28669
29162
  console.error(
28670
29163
  'A <style> resource with href "' + href + '" follows a stylesheet preload for the same href. Inline styles cannot consume a stylesheet preload; remove the preload or use a stylesheet link.'
28671
29164
  );
28672
29165
  }
28673
29166
  const precedence = attrs.precedence == null ? "" : String(attrs.precedence);
28674
- if (process.env.NODE_ENV !== "production" && /<\/style/i.test(css)) {
29167
+ if (__octaneDev && /<\/style/i.test(css)) {
28675
29168
  console.error(
28676
29169
  'A <style href precedence> resource contains "</style"; server rendering will skip it. Load it as a stylesheet link instead.'
28677
29170
  );
@@ -28789,6 +29282,7 @@ function scriptResource(attrs) {
28789
29282
  createRoot,
28790
29283
  createScopedElement,
28791
29284
  createScopedValue,
29285
+ deferRecord,
28792
29286
  delegateCaptureEvents,
28793
29287
  delegateEvents,
28794
29288
  descriptorChildren,
@@ -28846,6 +29340,7 @@ function scriptResource(attrs) {
28846
29340
  isChildrenBlock,
28847
29341
  isHydratingStyle,
28848
29342
  isInActScope,
29343
+ isRenderCall,
28849
29344
  isValidElement,
28850
29345
  keyedForBlock,
28851
29346
  lazy,
@@ -28974,6 +29469,7 @@ function scriptResource(attrs) {
28974
29469
  textHole,
28975
29470
  textHoleUpdate,
28976
29471
  textSlot,
29472
+ textareaText,
28977
29473
  tryBlock,
28978
29474
  updateFreshClassAttr,
28979
29475
  updateFreshClassName,