octane 0.2.8 → 0.2.11

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.
@@ -72,6 +72,7 @@ __export(runtime_exports, {
72
72
  compilerCacheContext: () => compilerCacheContext,
73
73
  compilerCacheImmutableArrayFilter: () => compilerCacheImmutableArrayFilter,
74
74
  compilerCacheMappedArray: () => compilerCacheMappedArray,
75
+ compilerMemoRegion: () => compilerMemoRegion,
75
76
  compilerOwnsContextProvider: () => compilerOwnsContextProvider,
76
77
  componentSlot: () => componentSlot,
77
78
  componentSlotLite: () => componentSlotLite,
@@ -96,8 +97,10 @@ __export(runtime_exports, {
96
97
  evt0: () => evt0,
97
98
  evt0u: () => evt0u,
98
99
  evt1: () => evt1,
100
+ evt1e: () => evt1e,
99
101
  evt1u: () => evt1u,
100
102
  evt2: () => evt2,
103
+ evt2e: () => evt2e,
101
104
  evt2u: () => evt2u,
102
105
  evtN: () => evtN,
103
106
  evtNu: () => evtNu,
@@ -131,6 +134,7 @@ __export(runtime_exports, {
131
134
  injectStyle: () => injectStyle,
132
135
  invokeManualHook: () => invokeManualHook,
133
136
  isChildrenBlock: () => isChildrenBlock,
137
+ isHydratingStyle: () => isHydratingStyle,
134
138
  isInActScope: () => isInActScope,
135
139
  isValidElement: () => isValidElement,
136
140
  keyedForBlock: () => keyedForBlock,
@@ -223,15 +227,20 @@ __export(runtime_exports, {
223
227
  setHTML: () => setHTML,
224
228
  setHostPropSources: () => setHostPropSources,
225
229
  setIsOctaneActEnvironment: () => setIsOctaneActEnvironment,
230
+ setPlainAttribute: () => setPlainAttribute,
231
+ setPlainAttributeIfChanged: () => setPlainAttributeIfChanged,
226
232
  setScriptText: () => setScriptText,
227
233
  setSelectValue: () => setSelectValue,
228
234
  setSpread: () => setSpread,
229
235
  setStringData: () => setStringData,
230
236
  setStringDataIfChanged: () => setStringDataIfChanged,
231
237
  setStyle: () => setStyle,
238
+ setStyleProperties: () => setStyleProperties,
232
239
  setStyleProperty: () => setStyleProperty,
233
240
  setText: () => setText,
234
241
  setTransitionFallbackTimeout: () => setTransitionFallbackTimeout,
242
+ setURLAttribute: () => setURLAttribute,
243
+ setURLAttributeIfChanged: () => setURLAttributeIfChanged,
235
244
  setValue: () => setValue,
236
245
  sibling: () => sibling,
237
246
  snapshotSpread: () => snapshotSpread,
@@ -275,6 +284,7 @@ __export(runtime_exports, {
275
284
  withSlot: () => withSlot
276
285
  });
277
286
  module.exports = __toCommonJS(runtime_exports);
287
+ var import_hook_slot_cache = require("./hook-slot-cache.cjs");
278
288
  var import_constants = require("./constants.cjs");
279
289
  var import_event_names = require("./event-names.cjs");
280
290
  var import_has_own = require("./has-own.cjs");
@@ -650,6 +660,7 @@ let NEXT_WARM_EPISODE = 1;
650
660
  let CURRENT_WARM_EPISODE = 0;
651
661
  const RENDERER_REGION_OWNER = /* @__PURE__ */ Symbol.for("octane.renderer-region.owner");
652
662
  const RENDERER_REGION_DOM_OWNERS = /* @__PURE__ */ new WeakMap();
663
+ let RENDERER_REGION_OWNER_COUNT = 0;
653
664
  const RENDERER_REGION_DOM_BINDINGS = /* @__PURE__ */ new WeakMap();
654
665
  const DOM_ROOT_DISPOSERS = /* @__PURE__ */ new WeakMap();
655
666
  let EFFECT_BODY_DEPTH = 0;
@@ -1339,6 +1350,8 @@ const JOURNAL_PROP = 3;
1339
1350
  const JOURNAL_CREATED = 4;
1340
1351
  const JOURNAL_RENDER = 5;
1341
1352
  const JOURNAL_UNDO = 6;
1353
+ const JOURNAL_RETIRED = 7;
1354
+ const JOURNAL_INPUTS = 8;
1342
1355
  let TRANSITION_JOURNAL = null;
1343
1356
  let TRANSITION_JOURNAL_BAGS = null;
1344
1357
  let TRANSITION_JOURNAL_CHECKPOINT = 0;
@@ -1485,9 +1498,7 @@ function retireRootBlock(block) {
1485
1498
  const retired = transaction.retired ??= /* @__PURE__ */ new Set();
1486
1499
  if (!retired.has(block)) {
1487
1500
  retired.add(block);
1488
- journalUndo(() => {
1489
- retired.delete(block);
1490
- });
1501
+ TRANSITION_JOURNAL.push(JOURNAL_RETIRED, retired, block, null);
1491
1502
  }
1492
1503
  if (block.pending) {
1493
1504
  journalRootProperty(block, "pending", block.pending);
@@ -1611,6 +1622,8 @@ function rollbackRootRender(transaction) {
1611
1622
  if (transaction.log[i] === JOURNAL_UNDO) transaction.log[i + 1]();
1612
1623
  else if (transaction.log[i] === JOURNAL_CREATED)
1613
1624
  undoCreatedInRootRender(transaction.log[i + 1], transaction.log[i + 2]);
1625
+ else if (transaction.log[i] === JOURNAL_RETIRED)
1626
+ transaction.log[i + 1].delete(transaction.log[i + 2]);
1614
1627
  }
1615
1628
  transaction.log.length = 0;
1616
1629
  }
@@ -2075,8 +2088,8 @@ function collectBlockRange(block) {
2075
2088
  }
2076
2089
  return nodes;
2077
2090
  }
2078
- function journalText(node) {
2079
- TRANSITION_JOURNAL.push(JOURNAL_TEXT, node, node.nodeValue, null);
2091
+ function journalText(node, previous) {
2092
+ TRANSITION_JOURNAL.push(JOURNAL_TEXT, node, previous, null);
2080
2093
  journalBag();
2081
2094
  }
2082
2095
  function journalAttr(el, name) {
@@ -2137,9 +2150,16 @@ function rollbackTransitionJournal(checkpoint, owner) {
2137
2150
  case JOURNAL_PROP:
2138
2151
  target[a] = b;
2139
2152
  break;
2153
+ case JOURNAL_INPUTS:
2154
+ target.extra = b;
2155
+ target.props = a;
2156
+ break;
2140
2157
  case JOURNAL_CREATED:
2141
2158
  undoCreatedInRootRender(target, a);
2142
2159
  break;
2160
+ case JOURNAL_RETIRED:
2161
+ target.delete(a);
2162
+ break;
2143
2163
  case JOURNAL_RENDER:
2144
2164
  if (!target.disposed && (target === owner || blockIsAncestorOf(owner, target))) {
2145
2165
  invalidateRender(target, owner);
@@ -2149,10 +2169,16 @@ function rollbackTransitionJournal(checkpoint, owner) {
2149
2169
  target();
2150
2170
  break;
2151
2171
  default:
2152
- for (const key of Object.keys(target)) {
2153
- if (!Object.prototype.hasOwnProperty.call(a, key)) delete target[key];
2172
+ for (const key of Reflect.ownKeys(target)) {
2173
+ if (!Object.prototype.hasOwnProperty.call(a, key) && Object.prototype.propertyIsEnumerable.call(target, key))
2174
+ delete target[key];
2175
+ }
2176
+ for (const key of Reflect.ownKeys(a)) {
2177
+ if (typeof key === "symbol") {
2178
+ if (Reflect.set(target, key, a[key]) || Object.is(target[key], a[key])) continue;
2179
+ }
2180
+ target[key] = a[key];
2154
2181
  }
2155
- for (const key of Object.keys(a)) target[key] = a[key];
2156
2182
  if (b !== null) target.length = b;
2157
2183
  TRANSITION_JOURNAL_BAGS.delete(target);
2158
2184
  }
@@ -2464,13 +2490,17 @@ function scheduleRenderCleanup(schedule, receiver, cleanup, onDiscard) {
2464
2490
  }
2465
2491
  function createOffscreenCapture() {
2466
2492
  return {
2493
+ rootTransaction: false,
2467
2494
  renderRoot: null,
2468
2495
  renderedBlocks: null,
2469
2496
  effects: [[], [], []],
2470
2497
  events: [],
2471
2498
  eventActions: [],
2472
2499
  refs: [],
2473
- stores: []
2500
+ detaches: void 0,
2501
+ stores: [],
2502
+ suspenseCommits: void 0,
2503
+ renderCleanups: void 0
2474
2504
  };
2475
2505
  }
2476
2506
  let EFFECT_EVENT_RENDER_TARGET = effectEventQueue;
@@ -2652,29 +2682,34 @@ function drainHydrationRenderPhaseUpdates(root) {
2652
2682
  }
2653
2683
  }
2654
2684
  }
2655
- function sortWaveByDepth(wave) {
2656
- const queued = new Set(wave);
2657
- const depth = /* @__PURE__ */ new Map();
2658
- const path = [];
2685
+ function sortWaveByDepth(wave, drainId) {
2686
+ const stamp = -drainId;
2659
2687
  for (let i = 0; i < wave.length; i++) {
2660
- let current = wave[i];
2661
- let knownDepth;
2662
- while (current !== null) {
2663
- knownDepth = depth.get(current);
2664
- if (knownDepth !== void 0) break;
2665
- path.push(current);
2688
+ const start = wave[i];
2689
+ if (start.drainStamp === stamp) continue;
2690
+ let current = start;
2691
+ let depth = 0;
2692
+ while (current !== null && current.drainStamp !== stamp) {
2693
+ depth++;
2666
2694
  current = current.parentBlock;
2667
2695
  }
2668
- let currentDepth = knownDepth ?? -1;
2669
- while (path.length > 0) {
2670
- const block = path.pop();
2671
- currentDepth++;
2672
- if (queued.has(block)) depth.set(block, currentDepth);
2696
+ depth += current === null ? -1 : current.drainRenders;
2697
+ current = start;
2698
+ while (current !== null && current.drainStamp !== stamp) {
2699
+ if (current.drainStamp !== void 0) {
2700
+ current.drainStamp = stamp;
2701
+ current.drainRenders = depth;
2702
+ }
2703
+ depth--;
2704
+ current = current.parentBlock;
2673
2705
  }
2674
2706
  }
2675
- wave.sort((a, b) => depth.get(a) - depth.get(b));
2707
+ wave.sort(compareWaveDepth);
2676
2708
  return wave;
2677
2709
  }
2710
+ function compareWaveDepth(a, b) {
2711
+ return a.drainRenders - b.drainRenders;
2712
+ }
2678
2713
  let SCHEDULED_VISIBILITY_DRIVER = null;
2679
2714
  function ensureScheduledVisibilityDriver() {
2680
2715
  SCHEDULED_VISIBILITY_DRIVER ??= {
@@ -2698,7 +2733,7 @@ function drainQueue() {
2698
2733
  let pendingError = null;
2699
2734
  let activitiesToRehide = null;
2700
2735
  const drainId = ++DRAIN_ID;
2701
- if (QUEUE.length > 1) sortWaveByDepth(QUEUE);
2736
+ if (QUEUE.length > 1) sortWaveByDepth(QUEUE, drainId);
2702
2737
  for (let i = 0; i < QUEUE.length; i++) {
2703
2738
  const block = QUEUE[i];
2704
2739
  if (!block.pending && !block.nestedUpdateError) continue;
@@ -3462,7 +3497,15 @@ function drainRefDetaches() {
3462
3497
  function drainRefAttaches() {
3463
3498
  if (refAttachQueue.length === 0) return;
3464
3499
  const q = refAttachQueue.splice(0);
3465
- q.sort((a, b) => comparePostOrder(a.block, 0, b.block, 0));
3500
+ if (q.length > 1) {
3501
+ const parent = q[0].block?.parentBlock ?? null;
3502
+ for (let i = 1; i < q.length; i++) {
3503
+ if ((q[i].block?.parentBlock ?? null) !== parent) {
3504
+ q.sort(compareRefPostOrder);
3505
+ break;
3506
+ }
3507
+ }
3508
+ }
3466
3509
  for (const r of q) {
3467
3510
  if (blockSubtreeDisposed(r.block)) continue;
3468
3511
  if (NATIVE_READ_DRIVER !== null && !NATIVE_READ_DRIVER.publicationCurrent(r)) {
@@ -3741,6 +3784,9 @@ function compareEffectPostOrder(a, b) {
3741
3784
  if (a.scope === b.scope) return a.order - b.order || a.seq - b.seq;
3742
3785
  return comparePostOrder(a.scope.block, a.seq, b.scope.block, b.seq);
3743
3786
  }
3787
+ function compareRefPostOrder(a, b) {
3788
+ return comparePostOrder(a.block, 0, b.block, 0);
3789
+ }
3744
3790
  function finishEffectCommit() {
3745
3791
  if (--EFFECT_COMMIT_DEPTH !== 0 || COMMIT_PHASE_ERRORS === null) return;
3746
3792
  const errors = COMMIT_PHASE_ERRORS;
@@ -4036,6 +4082,7 @@ class BlockImpl {
4036
4082
  this.deoptNode = null;
4037
4083
  this.deoptRefs = false;
4038
4084
  this.slots = [];
4085
+ this.compilerMemo = null;
4039
4086
  this.forSlot = null;
4040
4087
  this.prevSibling = null;
4041
4088
  this.nextSibling = null;
@@ -4072,6 +4119,7 @@ class ScopeImpl {
4072
4119
  this.$$ctxCacheOwner = null;
4073
4120
  this.mounted = false;
4074
4121
  this.slots = [];
4122
+ this.compilerMemo = null;
4075
4123
  }
4076
4124
  }
4077
4125
  function createBlock(kind, parentBlock, parentNode, startMarker, endMarker, body, props, extra, outputHandler = null) {
@@ -4529,6 +4577,22 @@ class LiteBlockImpl {
4529
4577
  }
4530
4578
  function componentSlotLite(parentScope, slotKey, host, comp, props, anchor) {
4531
4579
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
4580
+ if (parentScope === SHARED_BODY_SCOPE) {
4581
+ componentSlotImpl(
4582
+ null,
4583
+ parentScope,
4584
+ slotKey,
4585
+ host,
4586
+ comp,
4587
+ comp,
4588
+ props,
4589
+ props,
4590
+ anchor,
4591
+ void 0,
4592
+ 2
4593
+ );
4594
+ return;
4595
+ }
4532
4596
  const hydration = activeHydration();
4533
4597
  let scope = parentScope.slots[slotKey];
4534
4598
  let adoptedOpen = null;
@@ -4840,10 +4904,7 @@ function resolveSlot(slot) {
4840
4904
  const n = slotStack.length;
4841
4905
  if (n === 0) return slot;
4842
4906
  if (slot === void 0 && n === 1) return slotStack[0];
4843
- let key = "@octane:hook:";
4844
- for (let i = 0; i < n; i++) key = appendSlotKey(key, slotStack[i]);
4845
- if (slot !== void 0) key = appendSlotKey(key, slot);
4846
- const resolved = Symbol.for(key);
4907
+ const resolved = (0, import_hook_slot_cache.resolveHookPath)(slotStack, slot, false);
4847
4908
  return typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ ? (0, import_profiling.__profileResolveHook)(resolved, typeof slot === "symbol" ? slot : void 0) : resolved;
4848
4909
  }
4849
4910
  function nativeLocalHook(name, initialize, dispose, slot) {
@@ -4860,7 +4921,11 @@ function nativeLocalHook(name, initialize, dispose, slot) {
4860
4921
  return cell.nativeValue;
4861
4922
  }
4862
4923
  function useState(initial, slot) {
4863
- if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && (slotStack.length === 0 || MANUAL_HOOK_DRIVER?.active === true)) {
4924
+ const s = readStateHook(initial, slot, arguments.length === 1);
4925
+ return [s.value, s.setter];
4926
+ }
4927
+ function readStateHook(initial, slot, loneArgument) {
4928
+ if (slot === void 0 && typeof initial === "symbol" && loneArgument && (slotStack.length === 0 || MANUAL_HOOK_DRIVER?.active === true)) {
4864
4929
  slot = initial;
4865
4930
  initial = void 0;
4866
4931
  }
@@ -4934,7 +4999,13 @@ function useState(initial, slot) {
4934
4999
  if (!block.disposed && typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
4935
5000
  (0, import_profiling.__profileSchedule)(block, "state", slot);
4936
5001
  scheduleRender(block);
4937
- }
5002
+ },
5003
+ updates: void 0,
5004
+ renderTransition: void 0,
5005
+ urgentTransition: void 0,
5006
+ getter: void 0,
5007
+ pendingActionBatch: void 0,
5008
+ pendingActionValue: void 0
4938
5009
  };
4939
5010
  ensureHooks(scope).set(slot, s);
4940
5011
  }
@@ -4951,7 +5022,7 @@ function useState(initial, slot) {
4951
5022
  s.updates = void 0;
4952
5023
  }
4953
5024
  }
4954
- return [s.value, s.setter];
5025
+ return s;
4955
5026
  }
4956
5027
  function readQueuedState(state) {
4957
5028
  const transition = state.renderTransition;
@@ -5026,21 +5097,14 @@ function endUrgentTransitionCell(snapshot) {
5026
5097
  entry.baseValue = cell.value;
5027
5098
  }
5028
5099
  function __useStateWithGetter(initial, slot) {
5029
- if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && (slotStack.length === 0 || MANUAL_HOOK_DRIVER?.active === true)) {
5030
- slot = initial;
5031
- initial = void 0;
5032
- }
5033
- const pair = useState(initial, slot);
5034
- const resolved = resolveSlot(slot);
5035
- if (resolved === void 0) missingSlot("useState");
5036
- const s = CURRENT_SCOPE.hooks.get(resolved);
5100
+ const s = readStateHook(initial, slot, arguments.length === 1);
5037
5101
  const getter = s.getter ?? (s.getter = () => {
5038
5102
  const batch = s.pendingActionBatch;
5039
5103
  if (batch === void 0) return readQueuedState(s);
5040
5104
  const update = batch.updates.get(s);
5041
5105
  return update === void 0 ? readQueuedState(s) : readQueuedTransition(update, false);
5042
5106
  });
5043
- return [pair[0], pair[1], getter];
5107
+ return [s.value, s.setter, getter];
5044
5108
  }
5045
5109
  let HIDDEN_REVEAL_ACTIONS = null;
5046
5110
  function deferHiddenRevealAction(boundary, action) {
@@ -5239,6 +5303,10 @@ function __useLinkedStateWithGetter(source, reconcile, options, slot) {
5239
5303
  return [pair[0], pair[1], getter];
5240
5304
  }
5241
5305
  function useReducer(reducer, initialArg, initOrSlot, slot) {
5306
+ const s = readReducerHook(reducer, initialArg, initOrSlot, slot);
5307
+ return [s.value, s.dispatch];
5308
+ }
5309
+ function readReducerHook(reducer, initialArg, initOrSlot, slot) {
5242
5310
  let init;
5243
5311
  if (typeof initOrSlot === "symbol") {
5244
5312
  slot = initOrSlot;
@@ -5293,7 +5361,13 @@ function useReducer(reducer, initialArg, initOrSlot, slot) {
5293
5361
  if (!block.disposed && typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
5294
5362
  (0, import_profiling.__profileSchedule)(block, "reducer", slot);
5295
5363
  scheduleRender(block);
5296
- }
5364
+ },
5365
+ renderPhaseActions: void 0,
5366
+ renderTransition: void 0,
5367
+ urgentTransition: void 0,
5368
+ getter: void 0,
5369
+ pendingActionBatch: void 0,
5370
+ pendingActionValue: void 0
5297
5371
  };
5298
5372
  ensureHooks(scope).set(slot, s);
5299
5373
  } else {
@@ -5312,7 +5386,7 @@ function useReducer(reducer, initialArg, initOrSlot, slot) {
5312
5386
  }
5313
5387
  }
5314
5388
  }
5315
- return [s.value, s.dispatch];
5389
+ return s;
5316
5390
  }
5317
5391
  function readQueuedReducer(state) {
5318
5392
  let value = state.renderTransition === void 0 ? state.value : readQueuedTransition(
@@ -5325,18 +5399,14 @@ function readQueuedReducer(state) {
5325
5399
  return value;
5326
5400
  }
5327
5401
  function __useReducerWithGetter(reducer, initialArg, initOrSlot, slot) {
5328
- const resolvedInput = typeof initOrSlot === "symbol" ? initOrSlot : slot;
5329
- const pair = useReducer(reducer, initialArg, initOrSlot, slot);
5330
- const resolved = resolveSlot(resolvedInput);
5331
- if (resolved === void 0) missingSlot("useReducer");
5332
- const s = CURRENT_SCOPE.hooks.get(resolved);
5402
+ const s = readReducerHook(reducer, initialArg, initOrSlot, slot);
5333
5403
  const getter = s.getter ?? (s.getter = () => {
5334
5404
  const batch = s.pendingActionBatch;
5335
5405
  if (batch === void 0) return readQueuedReducer(s);
5336
5406
  const update = batch.updates.get(s);
5337
5407
  return update === void 0 ? readQueuedReducer(s) : readQueuedTransition(update, false, s.reducer);
5338
5408
  });
5339
- return [pair[0], pair[1], getter];
5409
+ return [s.value, s.dispatch, getter];
5340
5410
  }
5341
5411
  function depsChanged(prev, next, hook = false) {
5342
5412
  if (prev === void 0 || next === void 0) return true;
@@ -5512,7 +5582,9 @@ function adoptMemoEntry(scope, slot, deps) {
5512
5582
  const entry = {
5513
5583
  deps,
5514
5584
  value: adopted.value,
5515
- warmEpisode: CURRENT_WARM_EPISODE
5585
+ warmEpisode: CURRENT_WARM_EPISODE,
5586
+ warmRecord: void 0,
5587
+ nativeWitness: void 0
5516
5588
  };
5517
5589
  if (ACTIVE_TRANSITION_ATTEMPT !== null) journalMemoEntry(scope, slot, entry);
5518
5590
  ensureHooks(scope).set(slot, entry);
@@ -5527,8 +5599,13 @@ function readMemoEntry(scope, slot, deps) {
5527
5599
  return WARM_EVER && deps !== void 0 ? adoptMemoEntry(scope, slot, deps) : null;
5528
5600
  }
5529
5601
  function publishMemoEntry(scope, slot, deps, value, nativeWitness) {
5530
- const entry = { deps, value };
5531
- if (nativeWitness !== void 0) entry.nativeWitness = nativeWitness;
5602
+ const entry = {
5603
+ deps,
5604
+ value,
5605
+ warmEpisode: void 0,
5606
+ warmRecord: void 0,
5607
+ nativeWitness
5608
+ };
5532
5609
  if (ACTIVE_TRANSITION_ATTEMPT !== null) journalMemoEntry(scope, slot, entry);
5533
5610
  ensureHooks(scope).set(slot, entry);
5534
5611
  if (deps !== void 0 && recordRealWarmMemo(slot, deps, entry)) {
@@ -5560,8 +5637,25 @@ function useCallback(fn, deps, slot) {
5560
5637
  return entry === null ? publishMemoEntry(scope, s, d, fn) : entry.value;
5561
5638
  }
5562
5639
  const hookMemoEqual = Object.is;
5640
+ function compilerMemoRegion(scope, bodyId) {
5641
+ const region = scope.compilerMemo;
5642
+ if (region !== null && region.bodyId === bodyId) return region;
5643
+ return createCompilerMemoRegion(scope, bodyId, region);
5644
+ }
5645
+ function createCompilerMemoRegion(scope, bodyId, first) {
5646
+ if (first === null)
5647
+ return scope.compilerMemo = { bodyId, auto: void 0, hooks: void 0, overflow: null };
5648
+ let overflow = first.overflow;
5649
+ if (overflow === null) first.overflow = overflow = /* @__PURE__ */ new Map();
5650
+ let region = overflow.get(bodyId);
5651
+ if (region === void 0) {
5652
+ region = { bodyId, auto: void 0, hooks: void 0, overflow: null };
5653
+ overflow.set(bodyId, region);
5654
+ }
5655
+ return region;
5656
+ }
5563
5657
  function hookMemoCreate(size) {
5564
- return new Array(size).fill(void 0);
5658
+ return new Array(size).fill(null);
5565
5659
  }
5566
5660
  function hookMemoPublish0(cells, base, value) {
5567
5661
  if (ACTIVE_TRANSITION_ATTEMPT !== null) journalHookMemoCells(cells, base, [true, value]);
@@ -5749,11 +5843,12 @@ function scheduleStoreRender(block) {
5749
5843
  }
5750
5844
  }
5751
5845
  let DID_WARN_UNCACHED_SNAPSHOT = false;
5752
- function useSyncExternalStore(subscribe, getSnapshot, ...rest) {
5753
- let slot = rest[rest.length - 1];
5846
+ function useSyncExternalStore(subscribe, getSnapshot, serverSnapshotOrSlot = void 0, lastSlot) {
5847
+ const count = arguments.length;
5848
+ let slot = count > 4 ? arguments[count - 1] : count === 4 ? lastSlot : serverSnapshotOrSlot;
5754
5849
  slot = resolveSlot(slot);
5755
5850
  if (slot === void 0) missingSlot("useSyncExternalStore");
5756
- const getServerSnapshot = rest.length >= 2 ? rest[0] : void 0;
5851
+ const getServerSnapshot = count >= 4 ? serverSnapshotOrSlot : void 0;
5757
5852
  const subs = usesSubslots(slot);
5758
5853
  const readSnapshot = activeHydration() !== null && getServerSnapshot !== void 0 ? getServerSnapshot : getSnapshot;
5759
5854
  const value = readSnapshot();
@@ -5772,6 +5867,7 @@ function useSyncExternalStore(subscribe, getSnapshot, ...rest) {
5772
5867
  getSnapshot,
5773
5868
  pending: value,
5774
5869
  subscribe,
5870
+ effectDeps: null,
5775
5871
  forceUpdate: typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ ? () => {
5776
5872
  if (!block.disposed) (0, import_profiling.__profileSchedule)(block, "external-store", slot);
5777
5873
  scheduleStoreRender(block);
@@ -5787,6 +5883,7 @@ function useSyncExternalStore(subscribe, getSnapshot, ...rest) {
5787
5883
  queued: false
5788
5884
  };
5789
5885
  inst = created;
5886
+ created.effectDeps = [created, subscribe];
5790
5887
  ensureHooks(scope).set(subs.inst, inst);
5791
5888
  enqueueStoreSync(inst, value, subscribe);
5792
5889
  } else {
@@ -5795,7 +5892,8 @@ function useSyncExternalStore(subscribe, getSnapshot, ...rest) {
5795
5892
  enqueueStoreSync(inst, value, subscribe);
5796
5893
  }
5797
5894
  }
5798
- useEffect(subscribeToStore, [inst, subscribe], subs.effect);
5895
+ if (inst.effectDeps[1] !== subscribe) inst.effectDeps = [inst, subscribe];
5896
+ useEffect(subscribeToStore, inst.effectDeps, subs.effect);
5799
5897
  return value;
5800
5898
  }
5801
5899
  function useEffectEvent(fn, slot) {
@@ -5863,18 +5961,50 @@ function renderClientContextProvider(context, props, renderScope) {
5863
5961
  const ctx = context;
5864
5962
  const scope = renderScope;
5865
5963
  provideContext(scope, ctx, props.value);
5866
- if (props.children != null) {
5867
- const dialect = typeof props.children === "function" ? 1 : 2;
5964
+ const children = props.children;
5965
+ if (children != null) {
5966
+ const dialect = typeof children === "function" ? children[CHILDREN_BODY] ?? children : 2;
5868
5967
  const previous = scope.hooks?.get(CHILDREN_DIALECT_SLOT);
5869
5968
  if (previous !== dialect) {
5870
- if (previous !== void 0) {
5969
+ if (previous !== void 0 && (previous === 2 || dialect === 2)) {
5871
5970
  resetScopeChildren(scope);
5872
5971
  if (scope.block.disposed) return;
5972
+ } else if (previous !== void 0) {
5973
+ invalidateSharedBodyOutput(scope);
5974
+ if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
5975
+ const hooks = scope.hooks;
5976
+ journalUndo(() => hooks.set(CHILDREN_DIALECT_SLOT, previous));
5977
+ }
5873
5978
  }
5874
5979
  ensureHooks(scope).set(CHILDREN_DIALECT_SLOT, dialect);
5875
5980
  }
5876
- childrenAsBody(props.children)(void 0, scope, void 0);
5981
+ renderSharedBody(childrenAsBody(children), void 0, scope, void 0);
5982
+ }
5983
+ }
5984
+ let SHARED_BODY_SCOPE = null;
5985
+ function renderSharedBody(body, props, scope, extra) {
5986
+ const previous = SHARED_BODY_SCOPE;
5987
+ SHARED_BODY_SCOPE = scope;
5988
+ try {
5989
+ return body(props, scope, extra);
5990
+ } finally {
5991
+ SHARED_BODY_SCOPE = previous;
5992
+ }
5993
+ }
5994
+ function invalidateSharedBodyOutput(scope) {
5995
+ const first = scope.compilerMemo;
5996
+ if (first === null) return;
5997
+ invalidateSharedBodyMemoRegion(first);
5998
+ if (first.overflow !== null) {
5999
+ for (const region of first.overflow.values()) invalidateSharedBodyMemoRegion(region);
6000
+ }
6001
+ }
6002
+ function invalidateSharedBodyMemoRegion(region) {
6003
+ if (region.auto === void 0) return;
6004
+ if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
6005
+ TRANSITION_JOURNAL.push(JOURNAL_PROP, region, "auto", region.auto);
5877
6006
  }
6007
+ region.auto = void 0;
5878
6008
  }
5879
6009
  function provideContext(scope, context, value) {
5880
6010
  if (scope.$$ctxValues === null) scope.$$ctxValues = /* @__PURE__ */ new Map();
@@ -5894,13 +6024,15 @@ function provideContext(scope, context, value) {
5894
6024
  values.set(context, value);
5895
6025
  }
5896
6026
  const CHILDREN_BLOCK = /* @__PURE__ */ Symbol.for("octane.childrenBlock");
6027
+ const CHILDREN_BODY = /* @__PURE__ */ Symbol.for("octane.childrenBody");
5897
6028
  function markSingleRoot(component) {
5898
6029
  component.$$singleRoot = true;
5899
6030
  return component;
5900
6031
  }
5901
- function markChildrenBlock(fn) {
6032
+ function markChildrenBlock(fn, body) {
5902
6033
  if (typeof fn === "function") {
5903
6034
  fn[CHILDREN_BLOCK] = true;
6035
+ if (body !== void 0) fn[CHILDREN_BODY] = body;
5904
6036
  }
5905
6037
  return fn;
5906
6038
  }
@@ -5989,6 +6121,7 @@ function resetHmrBlock(block) {
5989
6121
  block._slots = null;
5990
6122
  block.refFields = null;
5991
6123
  block.slots = [];
6124
+ block.compilerMemo = null;
5992
6125
  block.deoptNode = null;
5993
6126
  });
5994
6127
  const hooks = block.hooks;
@@ -6020,6 +6153,7 @@ function resetScopeChildren(scope) {
6020
6153
  scope.effectSlots = null;
6021
6154
  scope.hooks = null;
6022
6155
  scope.slots = [];
6156
+ scope.compilerMemo = null;
6023
6157
  scope.refFields = null;
6024
6158
  } finally {
6025
6159
  if (--TEARDOWN_DEPTH === 0) dispatchTeardownErrors();
@@ -7026,13 +7160,12 @@ function useContext(context) {
7026
7160
  }
7027
7161
  const DEFAULT_CTX = /* @__PURE__ */ Symbol("octane.ctx.default");
7028
7162
  function rendererRegionOwnerForBlock(block) {
7163
+ if (RENDERER_REGION_OWNER_COUNT === 0) return null;
7029
7164
  let current = block;
7030
- while (current !== null) {
7031
- const bridge = RENDERER_REGION_DOM_OWNERS.get(current);
7032
- if (bridge !== void 0 && bridge.active) return bridge;
7033
- current = current.parentBlock;
7034
- }
7035
- return null;
7165
+ while (current !== null && current.parentBlock !== null) current = current.parentBlock;
7166
+ if (current === null) return null;
7167
+ const bridge = RENDERER_REGION_DOM_OWNERS.get(current);
7168
+ return bridge !== void 0 && bridge.active ? bridge : null;
7036
7169
  }
7037
7170
  function rendererRegionTryHandler(block) {
7038
7171
  const bridge = rendererRegionOwnerForBlock(block);
@@ -7074,12 +7207,14 @@ function bindRendererRegionOwner(props) {
7074
7207
  root.$$ctxCache = null;
7075
7208
  root.$$ctxCacheOwner = null;
7076
7209
  if (previous === void 0) {
7210
+ RENDERER_REGION_OWNER_COUNT++;
7077
7211
  (root.cleanups ??= []).push(() => {
7078
7212
  const current = RENDERER_REGION_DOM_BINDINGS.get(root);
7079
7213
  if (current === void 0) return;
7080
7214
  current.release();
7081
7215
  RENDERER_REGION_DOM_BINDINGS.delete(root);
7082
7216
  RENDERER_REGION_DOM_OWNERS.delete(root);
7217
+ RENDERER_REGION_OWNER_COUNT--;
7083
7218
  });
7084
7219
  }
7085
7220
  }
@@ -7109,6 +7244,12 @@ function scopedReadsChanged(reads) {
7109
7244
  }
7110
7245
  return false;
7111
7246
  }
7247
+ function replayScopedContextReads(reads, block) {
7248
+ for (const [context, version] of reads) {
7249
+ if (block !== null) recordContextDependency(block, context);
7250
+ if (SCOPED_READ_TRACKING) (SCOPED_READS ??= /* @__PURE__ */ new Map()).set(context, version);
7251
+ }
7252
+ }
7112
7253
  function createScopedResolver(read) {
7113
7254
  let resolved = false;
7114
7255
  let resolvedScope = null;
@@ -7123,18 +7264,22 @@ function createScopedResolver(read) {
7123
7264
  SCOPED_READ_TRACKING = true;
7124
7265
  SCOPED_READS = null;
7125
7266
  let next;
7267
+ let nextReads;
7126
7268
  try {
7127
7269
  next = read();
7128
7270
  } finally {
7129
- resolvedReads = SCOPED_READS;
7271
+ nextReads = SCOPED_READS;
7130
7272
  SCOPED_READ_TRACKING = previousTracking;
7131
7273
  SCOPED_READS = previousReads;
7274
+ if (previousTracking && nextReads !== null) replayScopedContextReads(nextReads, null);
7132
7275
  }
7133
7276
  resolvedScope = scope;
7277
+ resolvedReads = nextReads;
7134
7278
  resolvedValue = next;
7135
7279
  resolved = true;
7136
- } else if (resolvedScope !== scope) {
7280
+ } else {
7137
7281
  resolvedScope = scope;
7282
+ if (resolvedReads !== null) replayScopedContextReads(resolvedReads, CURRENT_BLOCK);
7138
7283
  }
7139
7284
  return resolvedValue;
7140
7285
  };
@@ -7169,6 +7314,7 @@ function createNativeScopedResolver(read) {
7169
7314
  nextReads = SCOPED_READS;
7170
7315
  SCOPED_READ_TRACKING = previousTracking;
7171
7316
  SCOPED_READS = previousReads;
7317
+ if (previousTracking && nextReads !== null) replayScopedContextReads(nextReads, null);
7172
7318
  nextWitness = finishNativeReadWitness(witnessToken, readCompleted);
7173
7319
  }
7174
7320
  resolvedScope = scope;
@@ -7178,6 +7324,7 @@ function createNativeScopedResolver(read) {
7178
7324
  resolved = true;
7179
7325
  } else {
7180
7326
  resolvedScope = scope;
7327
+ if (resolvedReads !== null) replayScopedContextReads(resolvedReads, CURRENT_BLOCK);
7181
7328
  if (collecting) replayNativeReadWitness(resolvedWitness);
7182
7329
  }
7183
7330
  completed = true;
@@ -7562,21 +7709,6 @@ function retainDiscardedWarmMemos(scope) {
7562
7709
  }
7563
7710
  forEachSubtreeChild(scope, retainDiscardedWarmMemos);
7564
7711
  }
7565
- function runWarm(fn, owner = CURRENT_BLOCK) {
7566
- const cache = warmCacheForOwner(owner);
7567
- WARM_EVER = true;
7568
- const prev = CURRENT_WARM;
7569
- const prevClaims = CURRENT_WARM_CLAIMS;
7570
- CURRENT_WARM = cache;
7571
- CURRENT_WARM_CLAIMS = /* @__PURE__ */ new Set();
7572
- try {
7573
- fn();
7574
- } catch {
7575
- } finally {
7576
- CURRENT_WARM = prev;
7577
- CURRENT_WARM_CLAIMS = prevClaims;
7578
- }
7579
- }
7580
7712
  function blockIsAncestor(ancestor, block) {
7581
7713
  for (let current = block; current !== null; current = current.parentBlock) {
7582
7714
  if (current === ancestor) return true;
@@ -7585,24 +7717,29 @@ function blockIsAncestor(ancestor, block) {
7585
7717
  }
7586
7718
  function runActiveWarmPlans(local) {
7587
7719
  const block = CURRENT_BLOCK;
7588
- let plans = null;
7720
+ const end = ACTIVE_WARM_PLANS.length;
7721
+ let first = 0;
7589
7722
  let owner = block;
7590
- for (let i = 0; i < ACTIVE_WARM_PLANS.length; i += 3) {
7591
- const planBlock = ACTIVE_WARM_PLANS[i];
7592
- if (!blockIsAncestor(planBlock, block)) continue;
7593
- (plans ??= []).push(i);
7594
- if (plans.length === 1) owner = planBlock;
7595
- }
7596
- if (plans === null && local === void 0) return;
7597
- runWarm(() => {
7598
- if (plans !== null) {
7599
- for (let i = 0; i < plans.length; i++) {
7600
- CURRENT_WARM_CLAIMS = /* @__PURE__ */ new Set();
7601
- try {
7602
- const index = plans[i];
7603
- ACTIVE_WARM_PLANS[index + 1](ACTIVE_WARM_PLANS[index + 2]);
7604
- } catch {
7605
- }
7723
+ for (; first < end; first += 3) {
7724
+ const planBlock = ACTIVE_WARM_PLANS[first];
7725
+ if (blockIsAncestor(planBlock, block)) {
7726
+ owner = planBlock;
7727
+ break;
7728
+ }
7729
+ }
7730
+ if (first === end && local === void 0) return;
7731
+ const cache = warmCacheForOwner(owner);
7732
+ WARM_EVER = true;
7733
+ const previous = CURRENT_WARM;
7734
+ const previousClaims = CURRENT_WARM_CLAIMS;
7735
+ CURRENT_WARM = cache;
7736
+ try {
7737
+ for (let i = first; i < end; i += 3) {
7738
+ if (i !== first && !blockIsAncestor(ACTIVE_WARM_PLANS[i], block)) continue;
7739
+ CURRENT_WARM_CLAIMS = /* @__PURE__ */ new Set();
7740
+ try {
7741
+ ACTIVE_WARM_PLANS[i + 1](ACTIVE_WARM_PLANS[i + 2]);
7742
+ } catch {
7606
7743
  }
7607
7744
  }
7608
7745
  if (local !== void 0) {
@@ -7612,7 +7749,11 @@ function runActiveWarmPlans(local) {
7612
7749
  } catch {
7613
7750
  }
7614
7751
  }
7615
- }, owner);
7752
+ } catch {
7753
+ } finally {
7754
+ CURRENT_WARM = previous;
7755
+ CURRENT_WARM_CLAIMS = previousClaims;
7756
+ }
7616
7757
  }
7617
7758
  function activeMemoMatch(slot, deps, accept) {
7618
7759
  for (let block = CURRENT_BLOCK; block !== null; block = block.parentBlock) {
@@ -7845,6 +7986,7 @@ function adoptNativeMemoEntry(scope, slot, deps) {
7845
7986
  deps,
7846
7987
  value: adopted.value,
7847
7988
  warmEpisode: CURRENT_WARM_EPISODE,
7989
+ warmRecord: void 0,
7848
7990
  nativeWitness: adopted.nativeWitness
7849
7991
  };
7850
7992
  if (ACTIVE_TRANSITION_ATTEMPT !== null) journalMemoEntry(scope, slot, entry);
@@ -8006,6 +8148,14 @@ function memoPublishAlways(slot, value) {
8006
8148
  return publishMemoEntry(CURRENT_SCOPE, slot, void 0, value);
8007
8149
  }
8008
8150
  const LAZY_COMPONENT = /* @__PURE__ */ Symbol.for("octane.lazy");
8151
+ const LAZY_BODY_CHECK = /* @__PURE__ */ Symbol.for("octane.lazyBodyCheck");
8152
+ function markLazyBodyCheck(body, check) {
8153
+ Object.defineProperty(body, LAZY_BODY_CHECK, {
8154
+ get() {
8155
+ return this === body ? check : void 0;
8156
+ }
8157
+ });
8158
+ }
8009
8159
  function resolveLazyModule(mod) {
8010
8160
  let comp = mod;
8011
8161
  if (mod != null) {
@@ -8033,6 +8183,7 @@ function lazy(load) {
8033
8183
  let displayName;
8034
8184
  let resolvedName = "Lazy";
8035
8185
  let lazyWrapper;
8186
+ const bodySlot = /* @__PURE__ */ Symbol();
8036
8187
  const initializeLazy = () => {
8037
8188
  if (status !== "uninitialized") return;
8038
8189
  try {
@@ -8064,6 +8215,18 @@ function lazy(load) {
8064
8215
  };
8065
8216
  const callResolvedComponent = (props, scope, extra) => {
8066
8217
  const comp = resolveLazyModule(result);
8218
+ const previousBody = scope.hooks?.get(bodySlot);
8219
+ if (previousBody !== comp) {
8220
+ if (previousBody !== void 0) invalidateSharedBodyOutput(scope);
8221
+ const hooks = ensureHooks(scope);
8222
+ if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
8223
+ journalUndo(() => {
8224
+ if (previousBody === void 0) hooks.delete(bodySlot);
8225
+ else hooks.set(bodySlot, previousBody);
8226
+ });
8227
+ }
8228
+ hooks.set(bodySlot, comp);
8229
+ }
8067
8230
  resolvedName = comp.displayName || comp.name || "Lazy";
8068
8231
  if (comp.__memo === true) {
8069
8232
  if (!memoMetadataInstalled) {
@@ -8073,12 +8236,18 @@ function lazy(load) {
8073
8236
  }
8074
8237
  });
8075
8238
  Object.defineProperty(lazyWrapper, "__compare", {
8076
- value: (prev, next) => {
8239
+ value: (prev, next, renderScope) => {
8077
8240
  const current = resolveLazyModule(result);
8241
+ if (renderScope.hooks?.get(bodySlot) !== current || current.__memo !== true)
8242
+ return false;
8078
8243
  const compare = current.__compare;
8079
8244
  const previous = (0, import_shared_value_helpers.resolveLazyDefaultProps)(current, prev);
8080
8245
  const incoming = (0, import_shared_value_helpers.resolveLazyDefaultProps)(current, next);
8081
- return compare ? compare(previous, incoming) : shallowEqualProps(previous, incoming);
8246
+ return compare ? current[LAZY_BODY_CHECK] !== void 0 ? compare(
8247
+ previous,
8248
+ incoming,
8249
+ renderScope
8250
+ ) : compare(previous, incoming) : shallowEqualProps(previous, incoming);
8082
8251
  }
8083
8252
  });
8084
8253
  memoMetadataInstalled = true;
@@ -8089,7 +8258,7 @@ function lazy(load) {
8089
8258
  (0, import_profiling.__profileComponentSource)(lazyWrapper, comp);
8090
8259
  profiledComponent = comp;
8091
8260
  }
8092
- return comp((0, import_shared_value_helpers.resolveLazyDefaultProps)(comp, props), scope, extra);
8261
+ return renderSharedBody(comp, (0, import_shared_value_helpers.resolveLazyDefaultProps)(comp, props), scope, extra);
8093
8262
  };
8094
8263
  lazyWrapper = (props, scope, extra) => {
8095
8264
  if (status === "fulfilled") {
@@ -8114,6 +8283,13 @@ function lazy(load) {
8114
8283
  throw new SuspenseException(thenable);
8115
8284
  };
8116
8285
  markWarm(lazyWrapper, initializeLazy);
8286
+ markLazyBodyCheck(lazyWrapper, (scope) => {
8287
+ if (status !== "fulfilled") return false;
8288
+ const current = resolveLazyModule(result);
8289
+ if (scope.hooks?.get(bodySlot) !== current) return false;
8290
+ const nestedCheck = current[LAZY_BODY_CHECK];
8291
+ return nestedCheck === void 0 || nestedCheck(scope);
8292
+ });
8117
8293
  Object.defineProperty(lazyWrapper, LAZY_COMPONENT, {
8118
8294
  get() {
8119
8295
  return this === lazyWrapper;
@@ -8189,6 +8365,19 @@ function initDomOperations() {
8189
8365
  }
8190
8366
  }
8191
8367
  const LAZY_TEMPLATE = /* @__PURE__ */ Symbol("octane.lazy-template");
8368
+ function fragmentTemplate(wrapper) {
8369
+ for (const descendant of wrapper.querySelectorAll("*")) {
8370
+ if (descendant.localName.includes("-") || descendant.hasAttribute("is")) {
8371
+ wrapper.__oct_frag = true;
8372
+ return wrapper;
8373
+ }
8374
+ }
8375
+ const fragment = document.createDocumentFragment();
8376
+ let child2;
8377
+ while ((child2 = wrapper.firstChild) !== null) fragment.appendChild(child2);
8378
+ fragment.__oct_frag = true;
8379
+ return fragment;
8380
+ }
8192
8381
  function parseTemplate(html, ns, frag) {
8193
8382
  initDomOperations();
8194
8383
  const t = document.createElement("template");
@@ -8196,7 +8385,7 @@ function parseTemplate(html, ns, frag) {
8196
8385
  t.innerHTML = frag ? `<octane-frag>${html}</octane-frag>` : html;
8197
8386
  const root = t.content.firstChild;
8198
8387
  if (root.nodeType === 1 && root.localName === "octane-frag") {
8199
- root.__oct_frag = true;
8388
+ return fragmentTemplate(root);
8200
8389
  }
8201
8390
  return root;
8202
8391
  }
@@ -8204,8 +8393,7 @@ function parseTemplate(html, ns, frag) {
8204
8393
  t.innerHTML = `<${wrap}>${html}</${wrap}>`;
8205
8394
  const wrapEl = t.content.firstChild;
8206
8395
  if (frag) {
8207
- wrapEl.__oct_frag = true;
8208
- return wrapEl;
8396
+ return fragmentTemplate(wrapEl);
8209
8397
  }
8210
8398
  return wrapEl.firstChild;
8211
8399
  }
@@ -8216,7 +8404,7 @@ function template(html, ns = 0, frag = 0) {
8216
8404
  html,
8217
8405
  ns: ns === 1 ? 1 : ns === 2 ? 2 : ns === 3 ? 3 : 0,
8218
8406
  frag,
8219
- parsed: [],
8407
+ parsed: [null, null, null],
8220
8408
  root: 0
8221
8409
  }
8222
8410
  };
@@ -8255,7 +8443,7 @@ function resolveLazyTemplate(lazy2) {
8255
8443
  ns = lazy2.ns;
8256
8444
  }
8257
8445
  let parsed = lazy2.parsed[ns];
8258
- if (parsed === void 0) {
8446
+ if (parsed === null) {
8259
8447
  parsed = parseTemplate(lazy2.html, ns, lazy2.frag);
8260
8448
  lazy2.parsed[ns] = parsed;
8261
8449
  }
@@ -8731,7 +8919,7 @@ class HydrationCapability {
8731
8919
  this.classWrites.clear();
8732
8920
  }
8733
8921
  }
8734
- applyStyle(el, value, _prev, staticCss) {
8922
+ applyStyle(el, value, _prev, staticCss, entries) {
8735
8923
  const mode = hydrationMismatchMode(el);
8736
8924
  if (mode === 1) return true;
8737
8925
  const style = el.style;
@@ -8739,7 +8927,14 @@ class HydrationCapability {
8739
8927
  const before = style.cssText;
8740
8928
  const expectedStyle = document.createElement("div").style;
8741
8929
  if (staticCss !== void 0) expectedStyle.cssText = staticCss;
8742
- applyStyleValue(el, expectedStyle, value, void 0);
8930
+ if (entries === void 0) applyStyleValue(el, expectedStyle, value, void 0);
8931
+ else {
8932
+ for (let i = 0; i < entries.length; i += 2) {
8933
+ const entry = entries[i + 1];
8934
+ if (entry != null && typeof entry !== "boolean")
8935
+ applyStyleProperty(el, expectedStyle, entries[i], entry);
8936
+ }
8937
+ }
8743
8938
  const expected = expectedStyle.cssText;
8744
8939
  const expectsStyleAttribute = expected !== "";
8745
8940
  if (before === expected && hadStyleAttribute === expectsStyleAttribute) return true;
@@ -8862,6 +9057,10 @@ function clone(node, loc, partialStyles) {
8862
9057
  }
8863
9058
  function drainFrag(root, parent, anchor) {
8864
9059
  if (activeHydration() !== null && root.__oct_vfrag === true) return;
9060
+ if (root.nodeType === 11) {
9061
+ parent.insertBefore(root, anchor);
9062
+ return;
9063
+ }
8865
9064
  let c;
8866
9065
  while ((c = getFirstChild(root)) !== null) parent.insertBefore(c, anchor);
8867
9066
  }
@@ -8942,10 +9141,17 @@ function isTextParserNormalizedMatch(server, client) {
8942
9141
  function isAttributeParserNormalizedMatch(server, client) {
8943
9142
  return server !== null && normalizeParserText(server) === normalizeParserText(client);
8944
9143
  }
8945
- function htext(el, value) {
9144
+ function htext(el, value, seeded = void 0) {
8946
9145
  const text = coerceText(value);
8947
9146
  const hydration = activeHydration();
8948
9147
  if (hydration !== null) return hydration.htext(el, text);
9148
+ if (seeded === 1) {
9149
+ const first = getFirstChild(el);
9150
+ if (first !== null && first.nodeType === 3) {
9151
+ first.nodeValue = text;
9152
+ return first;
9153
+ }
9154
+ }
8949
9155
  const t = document.createTextNode(text);
8950
9156
  el.appendChild(t);
8951
9157
  return t;
@@ -8956,8 +9162,7 @@ function htextSwap(posNode, value) {
8956
9162
  if (hydration !== null) return hydration.htextSwap(posNode, text);
8957
9163
  const t = document.createTextNode(text);
8958
9164
  const parent = posNode.parentNode;
8959
- parent.insertBefore(t, posNode);
8960
- parent.removeChild(posNode);
9165
+ parent.replaceChild(t, posNode);
8961
9166
  return t;
8962
9167
  }
8963
9168
  function hydrationMarkerMultiplicity(data, open) {
@@ -9042,14 +9247,15 @@ let hiddenTextWriter = null;
9042
9247
  let hiddenStyleWriter = null;
9043
9248
  function updateTextValue(node, value) {
9044
9249
  if (hiddenTextWriter !== null && hiddenTextWriter(node, value)) return;
9045
- if (node.nodeValue !== value) {
9046
- if (TRANSITION_JOURNAL !== null) journalText(node);
9250
+ const previous = node.nodeValue;
9251
+ if (previous !== value) {
9252
+ if (TRANSITION_JOURNAL !== null) journalText(node, previous);
9047
9253
  node.nodeValue = value;
9048
9254
  }
9049
9255
  }
9050
9256
  function setText(node, value) {
9051
9257
  VIEW_TRANSITION_DRIVER?.markDirty();
9052
- if (TRANSITION_JOURNAL !== null) journalText(node);
9258
+ if (TRANSITION_JOURNAL !== null) journalText(node, node.nodeValue);
9053
9259
  const text = coerceText(value);
9054
9260
  if (hiddenTextWriter !== null && hiddenTextWriter(node, text)) return;
9055
9261
  node.nodeValue = text;
@@ -9059,6 +9265,16 @@ function setAttributeIfChanged(value, previous, el, name) {
9059
9265
  setAttribute(el, name, value);
9060
9266
  return value;
9061
9267
  }
9268
+ function setPlainAttributeIfChanged(value, previous, el, name) {
9269
+ if (previous === value) return previous;
9270
+ setPlainAttribute(el, name, value);
9271
+ return value;
9272
+ }
9273
+ function setURLAttributeIfChanged(value, previous, el, name) {
9274
+ if (previous === value) return previous;
9275
+ setURLAttribute(el, name, value);
9276
+ return value;
9277
+ }
9062
9278
  function setStringDataIfChanged(value, previous, el, name) {
9063
9279
  if (previous === value) return previous;
9064
9280
  setStringData(el, name, value);
@@ -10033,6 +10249,31 @@ function devValidateHostProps(el, props) {
10033
10249
  console.error((0, import_host_property_diagnostics.invalidHostPropertiesWarning)(invalid, el.localName));
10034
10250
  }
10035
10251
  }
10252
+ function setPlainAttribute(el, name, value) {
10253
+ if (process.env.NODE_ENV !== "production") return setAttribute(el, name, value);
10254
+ const type = typeof value;
10255
+ const next = value == null || type === "boolean" || type === "function" || type === "symbol" ? null : String(value);
10256
+ const hydration = activeHydration();
10257
+ if (hydration !== null && !hydration.allowAttribute(el, name, next)) return;
10258
+ if (TRANSITION_JOURNAL !== null) journalAttr(el, name);
10259
+ if (next === null) el.removeAttribute(name);
10260
+ else el.setAttribute(name, next);
10261
+ }
10262
+ function setURLAttribute(el, name, value) {
10263
+ if (process.env.NODE_ENV !== "production") return setAttribute(el, name, value);
10264
+ const type = typeof value;
10265
+ let next = value == null || type === "boolean" || type === "function" || type === "symbol" ? null : String(value);
10266
+ if (next !== null) {
10267
+ if (next === "" && (name === "src" || name === "href" && el.nodeName !== "A" && el.nodeName !== "AREA" || name === "data" && el.nodeName === "OBJECT"))
10268
+ next = null;
10269
+ else next = (0, import_sanitize_url.sanitizeURL)(next);
10270
+ }
10271
+ const hydration = activeHydration();
10272
+ if (hydration !== null && !hydration.allowAttribute(el, name, next)) return;
10273
+ if (TRANSITION_JOURNAL !== null) journalAttr(el, name);
10274
+ if (next === null) el.removeAttribute(name);
10275
+ else el.setAttribute(name, next);
10276
+ }
10036
10277
  function setStringData(el, name, value) {
10037
10278
  const t = typeof value;
10038
10279
  let next;
@@ -10198,6 +10439,9 @@ function setDeoptClass(el, value) {
10198
10439
  }
10199
10440
  }
10200
10441
  const IMPORTANT_SUFFIX = "!important";
10442
+ function isHydratingStyle() {
10443
+ return activeHydration() !== null;
10444
+ }
10201
10445
  function setStyle(el, value, prev) {
10202
10446
  const style = el.style;
10203
10447
  const hydration = activeHydration();
@@ -10220,6 +10464,26 @@ function setStyleProperty(el, name, value, staticCss, previous) {
10220
10464
  if (remove) style.removeProperty((0, import_css.styleName)(name));
10221
10465
  else applyStyleProperty(el, style, name, value);
10222
10466
  }
10467
+ function setStyleProperties(el, entries, staticCss) {
10468
+ const hydration = activeHydration();
10469
+ if (hydration !== null) {
10470
+ hydration.applyStyle(el, null, void 0, staticCss, entries);
10471
+ return;
10472
+ }
10473
+ const style = el.style;
10474
+ let journaled = false;
10475
+ for (let i = 0; i < entries.length; i += 2) {
10476
+ const value = entries[i + 1];
10477
+ if (value == null || typeof value === "boolean") continue;
10478
+ if (!journaled && TRANSITION_JOURNAL !== null) {
10479
+ journalAttr(el, "style");
10480
+ journaled = true;
10481
+ }
10482
+ const name = entries[i];
10483
+ if (hiddenStyleWriter !== null && hiddenStyleWriter(el, value, void 0, name)) continue;
10484
+ applyStyleProperty(el, style, name, value);
10485
+ }
10486
+ }
10223
10487
  function applyStyleValue(el, style, value, prev) {
10224
10488
  if (value == null || value === false || value === "") {
10225
10489
  if (prev && typeof prev === "object") {
@@ -10285,9 +10549,12 @@ function jsxEventName(rest) {
10285
10549
  if (rest === "Blur") return "focusout";
10286
10550
  return rest.toLowerCase();
10287
10551
  }
10552
+ let PARSED_EVENT_SLOTS;
10288
10553
  function eventSlot(name, el) {
10289
10554
  if (!isEventKey(name) || el !== void 0 && isHtmlCustomElement(el) && !(0, import_event_names.isDelegatedEventProp)(name))
10290
10555
  return null;
10556
+ const cached = PARSED_EVENT_SLOTS?.get(name);
10557
+ if (cached !== void 0) return cached;
10291
10558
  let rest = name.slice(2);
10292
10559
  let capture = false;
10293
10560
  if (rest.length > 7 && rest.endsWith("Capture") && name !== "onGotPointerCapture" && name !== "onLostPointerCapture") {
@@ -10295,7 +10562,9 @@ function eventSlot(name, el) {
10295
10562
  rest = rest.slice(0, rest.length - 7);
10296
10563
  }
10297
10564
  const type = jsxEventName(rest);
10298
- return { type, key: capture ? CAPTURE_PREFIX + type : "$$" + type, capture };
10565
+ const slot = { type, key: capture ? CAPTURE_PREFIX + type : "$$" + type, capture };
10566
+ if ((0, import_event_names.isDelegatedEventProp)(name)) (PARSED_EVENT_SLOTS ??= /* @__PURE__ */ new Map()).set(name, slot);
10567
+ return slot;
10299
10568
  }
10300
10569
  function removeHostProp(el, name, prevValue) {
10301
10570
  if (name === "class" || name === "className") {
@@ -10352,14 +10621,10 @@ function isHostPropIdentityKey(name) {
10352
10621
  return isEventKey(name);
10353
10622
  }
10354
10623
  function normalizedHostProp(el, rawName) {
10355
- if (rawName === "class" || rawName === "className") return ["class", "class"];
10624
+ if (rawName === "class" || rawName === "className") return "class";
10356
10625
  const actionName = formActionAttributeName(el, rawName);
10357
- if (actionName !== null) return [actionName, actionName];
10358
- if (isHostPropIdentityKey(rawName)) return [rawName, rawName];
10359
- let name = rawName;
10360
- if (!isHtmlCustomElement(el)) name = import_constants.ATTRIBUTE_ALIASES.get(name) ?? name;
10361
- const identity = el.namespaceURI === "http://www.w3.org/1999/xhtml" ? name.toLowerCase() : name;
10362
- return [identity, name];
10626
+ if (actionName !== null) return actionName;
10627
+ return isHtmlCustomElement(el) ? rawName : import_constants.ATTRIBUTE_ALIASES.get(rawName) ?? rawName;
10363
10628
  }
10364
10629
  function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false) {
10365
10630
  const props = /* @__PURE__ */ new Map();
@@ -10369,12 +10634,12 @@ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false)
10369
10634
  if (typeof rawName !== "string") return;
10370
10635
  const order = sourceOrder++;
10371
10636
  const previous = props.get(rawName);
10372
- props.set(rawName, {
10373
- rawName,
10374
- value,
10375
- firstOrder: previous?.firstOrder ?? order,
10376
- lastOrder: order
10377
- });
10637
+ if (previous !== void 0) {
10638
+ previous.value = value;
10639
+ previous.lastOrder = order;
10640
+ } else {
10641
+ props.set(rawName, { name: rawName, value, firstOrder: order, lastOrder: order });
10642
+ }
10378
10643
  }
10379
10644
  for (const source of sources) {
10380
10645
  if (!source[0]) {
@@ -10393,46 +10658,55 @@ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false)
10393
10658
  }
10394
10659
  }
10395
10660
  const values = /* @__PURE__ */ new Map();
10661
+ const html = el.namespaceURI === "http://www.w3.org/1999/xhtml";
10396
10662
  let needsWinningOrderSort = false;
10397
10663
  for (const writer of props.values()) {
10398
- if (writer.rawName === "key") continue;
10399
- const [identity, name] = normalizedHostProp(el, writer.rawName);
10664
+ const rawName = writer.name;
10665
+ if (rawName === "key") continue;
10666
+ const identityKey = isHostPropIdentityKey(rawName);
10667
+ const name = identityKey ? rawName : normalizedHostProp(el, rawName);
10668
+ const identity = html && !identityKey ? name.toLowerCase() : name;
10400
10669
  const previous = values.get(identity);
10401
10670
  if (previous !== void 0) {
10402
- if (previous[3] >= writer.lastOrder) continue;
10671
+ if (previous.lastOrder >= writer.lastOrder) continue;
10403
10672
  needsWinningOrderSort = true;
10404
10673
  }
10405
- values.set(identity, [
10406
- process.env.NODE_ENV !== "production" && (writer.rawName === "tabIndex" || writer.rawName === "htmlFor") ? writer.rawName : name,
10407
- writer.value,
10408
- writer.firstOrder,
10409
- writer.lastOrder
10410
- ]);
10674
+ writer.name = process.env.NODE_ENV !== "production" && (rawName === "tabIndex" || rawName === "htmlFor") ? rawName : name;
10675
+ values.set(identity, writer);
10411
10676
  }
10412
10677
  if (classMerges !== null) {
10413
10678
  for (const extra of classMerges) {
10414
- const [identity, name] = normalizedHostProp(el, extra.rawName);
10415
- const previous = values.get(identity);
10679
+ const previous = values.get("class");
10416
10680
  if (previous !== void 0) {
10417
- values.set(identity, [
10418
- previous[0],
10419
- (0, import_css.mergeClass)(previous[1], extra.value),
10420
- previous[2],
10421
- extra.order
10422
- ]);
10423
- continue;
10681
+ previous.value = (0, import_css.mergeClass)(previous.value, extra.value);
10682
+ previous.lastOrder = extra.order;
10683
+ } else {
10684
+ values.set("class", {
10685
+ name: "class",
10686
+ value: extra.value,
10687
+ firstOrder: extra.order,
10688
+ lastOrder: extra.order
10689
+ });
10424
10690
  }
10425
- values.set(identity, [name, extra.value, extra.order, extra.order]);
10426
10691
  }
10427
10692
  }
10428
10693
  const resolved = /* @__PURE__ */ Object.create(null);
10429
- const ordered = [...values.values()];
10430
- if (needsWinningOrderSort) ordered.sort((a, b) => a[2] - b[2]);
10431
- for (const [name, value] of ordered) resolved[name] = value;
10432
- const formHost = el.localName === "input" || el.localName === "textarea" || el.localName === "select";
10694
+ const ordered = needsWinningOrderSort ? [...values.values()].sort((a, b) => a.firstOrder - b.firstOrder) : values.values();
10695
+ for (const { name, value } of ordered) resolved[name] = value;
10696
+ const tag = el.localName;
10697
+ const formHost = tag === "input" || tag === "textarea" || tag === "select";
10433
10698
  setSpread(el, resolved, prev, scope, true, formHost);
10434
10699
  setDangerouslySetInnerHTMLSources(el, sources, hasNestedChildren);
10435
- if (formHost) setFormControlSources(el, sources);
10700
+ if (formHost)
10701
+ applyFormControlValues(
10702
+ el,
10703
+ tag,
10704
+ props.get("value")?.value,
10705
+ props.get("defaultValue")?.value,
10706
+ props.get("checked")?.value,
10707
+ props.get("defaultChecked")?.value,
10708
+ props.get("multiple")?.value
10709
+ );
10436
10710
  return resolved;
10437
10711
  }
10438
10712
  function isAggregatedFormControlProp(el, name) {
@@ -10526,9 +10800,9 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
10526
10800
  );
10527
10801
  continue;
10528
10802
  }
10803
+ if (v === pv && !isControlledHostProp(el, k)) continue;
10529
10804
  const ev = eventSlot(k, el);
10530
10805
  if (ev) {
10531
- if (v === pv) continue;
10532
10806
  if (ev.capture) {
10533
10807
  if (!_delegatedCapture.has(ev.type)) delegateCaptureEvents([ev.type]);
10534
10808
  } else if (!_delegated.has(ev.type)) {
@@ -10541,7 +10815,6 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
10541
10815
  );
10542
10816
  continue;
10543
10817
  }
10544
- if (v === pv && !isControlledHostProp(el, k)) continue;
10545
10818
  if (prev !== void 0 && k === "autoFocus" && !isHtmlCustomElement(el)) continue;
10546
10819
  setAttribute(el, k, v);
10547
10820
  }
@@ -10619,6 +10892,27 @@ function rootIdentifierPrefix(block) {
10619
10892
  while (block.parentBlock !== null) block = block.parentBlock;
10620
10893
  return block.idState.prefix;
10621
10894
  }
10895
+ function setHeadAttribute(el, name, value) {
10896
+ switch (name) {
10897
+ case "name":
10898
+ case "content":
10899
+ case "lang":
10900
+ case "media":
10901
+ case "id":
10902
+ case "title":
10903
+ case "type":
10904
+ break;
10905
+ default:
10906
+ return setAttribute(el, name, value);
10907
+ }
10908
+ const next = coerceAttrValue(el, name, value);
10909
+ const hydration = activeHydration();
10910
+ if (hydration !== null && !hydration.allowAttribute(el, name, next)) return;
10911
+ if (el.getAttribute(name) === next) return;
10912
+ if (TRANSITION_JOURNAL !== null) journalAttr(el, name);
10913
+ if (next === null) el.removeAttribute(name);
10914
+ else el.setAttribute(name, next);
10915
+ }
10622
10916
  function headBlock(scope, slot, key, tag, attrs, text) {
10623
10917
  if (typeof document === "undefined") return;
10624
10918
  let state = scope.slots[slot];
@@ -10678,7 +10972,7 @@ function headBlock(scope, slot, key, tag, attrs, text) {
10678
10972
  continue;
10679
10973
  }
10680
10974
  names.push(k);
10681
- setAttribute(el, k, attrs[k]);
10975
+ setHeadAttribute(el, k, attrs[k]);
10682
10976
  }
10683
10977
  state.attrNames = names;
10684
10978
  } else {
@@ -10816,6 +11110,16 @@ function evt2u(d, fn, a0, a1) {
10816
11110
  d.a0 = a0;
10817
11111
  d.a1 = a1;
10818
11112
  }
11113
+ function evt1e(el, key, fn, a0) {
11114
+ const d = { fn, args: -1, a0, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND };
11115
+ setEventHandler(el, key, d);
11116
+ return d;
11117
+ }
11118
+ function evt2e(el, key, fn, a0, a1) {
11119
+ const d = { fn, args: -2, a0, a1, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND };
11120
+ setEventHandler(el, key, d);
11121
+ return d;
11122
+ }
10819
11123
  function evtN(el, key, fn, args) {
10820
11124
  const d = { fn, args, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND };
10821
11125
  setEventHandler(el, key, d);
@@ -10827,7 +11131,16 @@ function evtNu(d, fn, args) {
10827
11131
  d.fn = fn;
10828
11132
  d.args = args;
10829
11133
  }
10830
- const _delegated = /* @__PURE__ */ new Set();
11134
+ const EVENT_BUBBLE = 1;
11135
+ const EVENT_CAPTURE = 2;
11136
+ const EVENT_NATIVE_CAPTURE = 4;
11137
+ const EVENT_TARGET_ONLY = 8;
11138
+ const EVENT_DISCRETE = 16;
11139
+ const EVENT_RESTORE = 32;
11140
+ const EVENT_DISABLED_MOUSE = 64;
11141
+ const EVENT_DISABLED_ENTER = 128;
11142
+ const EVENT_CUSTOM_NATIVE_ONLY = 256;
11143
+ const _delegated = /* @__PURE__ */ new Map();
10831
11144
  const _delegationTargets = /* @__PURE__ */ new Map();
10832
11145
  const _portalEventRanges = /* @__PURE__ */ new WeakMap();
10833
11146
  let portalEventTargetCount = 0;
@@ -10885,7 +11198,7 @@ function prepareDelegatedEvent(event, listener) {
10885
11198
  }
10886
11199
  return path;
10887
11200
  }
10888
- const _delegatedCapture = /* @__PURE__ */ new Set();
11201
+ const _delegatedCapture = /* @__PURE__ */ new Map();
10889
11202
  const EMULATED_BUBBLING_EVENTS = [
10890
11203
  "abort",
10891
11204
  "beforetoggle",
@@ -10956,7 +11269,9 @@ function delegateEvents(eventNames) {
10956
11269
  for (let i = 0; i < eventNames.length; i++) {
10957
11270
  const name = eventNames[i];
10958
11271
  if (_delegated.has(name)) continue;
10959
- _delegated.add(name);
11272
+ const type = _delegatedCapture.get(name) ?? createDelegatedEventType(name);
11273
+ type.flags |= EVENT_BUBBLE;
11274
+ _delegated.set(name, type);
10960
11275
  if (canSeed) seedExpando(Element.prototype, "$$" + name);
10961
11276
  for (const target of _delegationTargets.keys()) {
10962
11277
  if (delegatedCapture(name) && _delegatedCapture.has(name)) continue;
@@ -10980,7 +11295,9 @@ function delegateCaptureEvents(eventNames) {
10980
11295
  for (let i = 0; i < eventNames.length; i++) {
10981
11296
  const name = eventNames[i];
10982
11297
  if (_delegatedCapture.has(name)) continue;
10983
- _delegatedCapture.add(name);
11298
+ const type = _delegated.get(name) ?? createDelegatedEventType(name);
11299
+ type.flags |= EVENT_CAPTURE;
11300
+ _delegatedCapture.set(name, type);
10984
11301
  if (canSeed) seedExpando(Element.prototype, CAPTURE_PREFIX + name);
10985
11302
  for (const target of _delegationTargets.keys()) {
10986
11303
  if (_delegated.has(name)) continue;
@@ -11001,7 +11318,7 @@ function registerDelegationTarget(target, root = false) {
11001
11318
  if (target.onclick == null && target.nodeType === 1) {
11002
11319
  target.onclick = noop;
11003
11320
  }
11004
- for (const name of _delegated) {
11321
+ for (const name of _delegated.keys()) {
11005
11322
  target.addEventListener(
11006
11323
  name,
11007
11324
  dispatchDelegated,
@@ -11015,7 +11332,7 @@ function registerDelegationTarget(target, root = false) {
11015
11332
  );
11016
11333
  }
11017
11334
  }
11018
- for (const name of _delegatedCapture) {
11335
+ for (const name of _delegatedCapture.keys()) {
11019
11336
  if (_delegated.has(name)) continue;
11020
11337
  target.addEventListener(
11021
11338
  name,
@@ -11031,11 +11348,11 @@ function unregisterDelegationTarget(target, root = false) {
11031
11348
  if (!prev) return;
11032
11349
  if (prev === 1) {
11033
11350
  _delegationTargets.delete(target);
11034
- for (const name of _delegated) {
11351
+ for (const name of _delegated.keys()) {
11035
11352
  target.removeEventListener(name, dispatchDelegated, delegatedCapture(name));
11036
11353
  if (!delegatedCapture(name)) target.removeEventListener(name, dispatchDelegatedCapture, true);
11037
11354
  }
11038
- for (const name of _delegatedCapture) {
11355
+ for (const name of _delegatedCapture.keys()) {
11039
11356
  target.removeEventListener(
11040
11357
  name,
11041
11358
  delegatedCapture(name) ? dispatchDelegated : dispatchDelegatedCapture,
@@ -11101,18 +11418,33 @@ const DISCRETE_EVENTS = /* @__PURE__ */ new Set([
11101
11418
  "volumechange"
11102
11419
  ]);
11103
11420
  let _dispatchDepth = 0;
11421
+ function createDelegatedEventType(name) {
11422
+ return {
11423
+ name,
11424
+ bubbleKey: "$$" + name,
11425
+ captureKey: CAPTURE_PREFIX + name,
11426
+ flags: (delegatedCapture(name) ? EVENT_NATIVE_CAPTURE : 0) | (TARGET_ONLY_DELEGATED.has(name) ? EVENT_TARGET_ONLY : 0) | (DISCRETE_EVENTS.has(name) ? EVENT_DISCRETE : 0) | (RESTORE_EVENTS.has(name) ? EVENT_RESTORE : 0) | (name === "click" || name === "dblclick" || name === "mousedown" || name === "mousemove" || name === "mouseup" ? EVENT_DISABLED_MOUSE : 0) | (name === "mouseenter" ? EVENT_DISABLED_ENTER : 0) | (name === "invalid" || EMULATED_BUBBLING_EVENTS.includes(name) ? EVENT_CUSTOM_NATIVE_ONLY : 0)
11427
+ };
11428
+ }
11104
11429
  const DELEGATED_BUBBLE_VERSION = /* @__PURE__ */ Symbol("octane.bubbleVersion");
11105
- const PROPAGATION_FLAGS = /* @__PURE__ */ Symbol("octane.propagationFlags");
11106
- const NATIVE_STOP_PROPAGATION = /* @__PURE__ */ Symbol("octane.stopPropagation");
11107
- const NATIVE_STOP_IMMEDIATE = /* @__PURE__ */ Symbol("octane.stopImmediatePropagation");
11430
+ const DELEGATED_EVENT_FRAMES = [];
11431
+ let delegatedEventFrameDepth = 0;
11432
+ function delegatedFrameFor(event) {
11433
+ for (let index = delegatedEventFrameDepth - 1; index >= 0; index--) {
11434
+ const frame = DELEGATED_EVENT_FRAMES[index];
11435
+ if (frame.event === event) return frame;
11436
+ }
11437
+ }
11108
11438
  function stopDelegatedPropagation() {
11109
- if (this[PROPAGATION_FLAGS] !== void 0) this[PROPAGATION_FLAGS] |= 1;
11110
- const stop = this[NATIVE_STOP_PROPAGATION] || this.stopPropagation;
11439
+ const frame = delegatedFrameFor(this);
11440
+ if (frame !== void 0) frame.flags |= 1;
11441
+ const stop = frame?.stop || this.stopPropagation;
11111
11442
  (stop === stopDelegatedPropagation ? Event.prototype.stopPropagation : stop).call(this);
11112
11443
  }
11113
11444
  function stopImmediateNativePropagation() {
11114
- if (this[PROPAGATION_FLAGS] !== void 0) this[PROPAGATION_FLAGS] |= 2;
11115
- const stop = this[NATIVE_STOP_IMMEDIATE] || this.stopImmediatePropagation;
11445
+ const frame = delegatedFrameFor(this);
11446
+ if (frame !== void 0) frame.flags |= 2;
11447
+ const stop = frame?.immediate || this.stopImmediatePropagation;
11116
11448
  (stop === stopImmediateNativePropagation ? Event.prototype.stopImmediatePropagation : stop).call(
11117
11449
  this
11118
11450
  );
@@ -11135,11 +11467,18 @@ function installPropagationMethod(event, name, previous, descriptor) {
11135
11467
  }
11136
11468
  }
11137
11469
  function beginDelegatedPropagation(event, stop, immediate) {
11138
- event[PROPAGATION_FLAGS] = 0;
11139
- event[NATIVE_STOP_PROPAGATION] = event.stopPropagation;
11470
+ let frame = DELEGATED_EVENT_FRAMES[delegatedEventFrameDepth];
11471
+ if (frame === void 0) {
11472
+ frame = { event: null, flags: 0, stop: null, immediate: null, currentTarget: null };
11473
+ DELEGATED_EVENT_FRAMES.push(frame);
11474
+ }
11475
+ delegatedEventFrameDepth++;
11476
+ frame.event = event;
11477
+ frame.flags = 0;
11478
+ frame.stop = event.stopPropagation;
11140
11479
  installPropagationMethod(event, "stopPropagation", stop, STOP_PROPAGATION_DESCRIPTOR);
11141
11480
  if (immediate !== null) {
11142
- event[NATIVE_STOP_IMMEDIATE] = event.stopImmediatePropagation;
11481
+ frame.immediate = event.stopImmediatePropagation;
11143
11482
  installPropagationMethod(
11144
11483
  event,
11145
11484
  "stopImmediatePropagation",
@@ -11147,30 +11486,32 @@ function beginDelegatedPropagation(event, stop, immediate) {
11147
11486
  STOP_IMMEDIATE_DESCRIPTOR
11148
11487
  );
11149
11488
  }
11489
+ return frame;
11150
11490
  }
11151
11491
  function endDelegatedPropagation(event, stop, immediate) {
11492
+ const frame = DELEGATED_EVENT_FRAMES[--delegatedEventFrameDepth];
11493
+ frame.event = null;
11494
+ frame.stop = null;
11495
+ frame.immediate = null;
11496
+ frame.currentTarget = null;
11152
11497
  if (stop === void 0) delete event.stopPropagation;
11153
11498
  else Object.defineProperty(event, "stopPropagation", stop);
11154
11499
  if (immediate !== null) {
11155
11500
  if (immediate === void 0) delete event.stopImmediatePropagation;
11156
11501
  else Object.defineProperty(event, "stopImmediatePropagation", immediate);
11157
- delete event[NATIVE_STOP_IMMEDIATE];
11158
11502
  }
11159
- delete event[PROPAGATION_FLAGS];
11160
- delete event[NATIVE_STOP_PROPAGATION];
11161
11503
  }
11162
- const CURRENT_TARGET_NODE = /* @__PURE__ */ Symbol("octane.currentTarget");
11163
11504
  const CURRENT_TARGET_DESCRIPTOR = {
11164
11505
  configurable: true,
11165
11506
  get() {
11166
- return this[CURRENT_TARGET_NODE];
11507
+ return delegatedFrameFor(this)?.currentTarget;
11167
11508
  }
11168
11509
  };
11169
11510
  const CAPTURE_PATH = [];
11170
11511
  const CAPTURE_SLOTS = [];
11171
- function snapshotDelegatedSlots(base, key, event) {
11172
- const type = event.type;
11173
- const suppressDisabled = type === "click" || type === "dblclick" || type === "mousedown" || type === "mousemove" || type === "mouseup" || type === "mouseenter" && key[2] !== "c";
11512
+ function snapshotDelegatedSlots(base, type, capture) {
11513
+ const key = capture ? type.captureKey : type.bubbleKey;
11514
+ const suppressDisabled = (type.flags & EVENT_DISABLED_MOUSE) !== 0 || !capture && (type.flags & EVENT_DISABLED_ENTER) !== 0;
11174
11515
  for (let index = base; index < CAPTURE_PATH.length; index++) {
11175
11516
  const node = CAPTURE_PATH[index];
11176
11517
  const slot = node[key];
@@ -11183,9 +11524,9 @@ function preserveDispatchedBundle(bundle) {
11183
11524
  if (CAPTURE_SLOTS[index] === bundle) {
11184
11525
  if (snapshot === void 0) {
11185
11526
  const args = bundle.args;
11186
- snapshot = typeof args !== "number" ? { fn: bundle.fn, args: args.slice(), [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND } : args === 1 ? { fn: bundle.fn, args: 1, a0: bundle.a0, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND } : {
11527
+ snapshot = typeof args !== "number" ? { fn: bundle.fn, args: args.slice(), [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND } : args === 1 || args === -1 ? { fn: bundle.fn, args, a0: bundle.a0, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND } : {
11187
11528
  fn: bundle.fn,
11188
- args: 2,
11529
+ args,
11189
11530
  a0: bundle.a0,
11190
11531
  a1: bundle.a1,
11191
11532
  [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND
@@ -11246,13 +11587,14 @@ function buildDelegatedPath(event, listener, path = event.composedPath()) {
11246
11587
  const output = CAPTURE_PATH;
11247
11588
  const base = output.length;
11248
11589
  const epoch = event[EVENT_ROOT_EPOCH] ?? eventRootEpoch;
11590
+ const mayHavePortal = portalEventTargetCount !== 0 || epoch !== eventRootEpoch;
11249
11591
  const listenerIndex = path.indexOf(listener);
11250
11592
  if (listenerIndex < 0) return 0;
11251
11593
  if (_delegationTargets.size === 1 && epoch === eventRootEpoch && isEventRoot(listener, epoch)) {
11252
11594
  let i = 0;
11253
11595
  for (; i < listenerIndex; i++) {
11254
11596
  const node = eventPathNode(path[i]);
11255
- if (node === null || node.$$portalParent != null) break;
11597
+ if (node === null || mayHavePortal && node.$$portalParent != null) break;
11256
11598
  output.push(node);
11257
11599
  }
11258
11600
  if (i === listenerIndex) return output.length - base;
@@ -11279,7 +11621,7 @@ function buildDelegatedPath(event, listener, path = event.composedPath()) {
11279
11621
  break;
11280
11622
  }
11281
11623
  output.push(node);
11282
- const logicalParent = node.$$portalParent;
11624
+ const logicalParent = mayHavePortal ? node.$$portalParent : void 0;
11283
11625
  if (logicalParent != null) {
11284
11626
  const container = node.$$portalContainer;
11285
11627
  if (container == null) {
@@ -11351,8 +11693,12 @@ function fireEventSlot(slot, event) {
11351
11693
  }
11352
11694
  } else if (a === 1) {
11353
11695
  bundle.fn(bundle.a0);
11354
- } else {
11696
+ } else if (a === 2) {
11355
11697
  bundle.fn(bundle.a0, bundle.a1);
11698
+ } else if (a === -1) {
11699
+ bundle.fn(event, bundle.a0);
11700
+ } else {
11701
+ bundle.fn(event, bundle.a0, bundle.a1);
11356
11702
  }
11357
11703
  return;
11358
11704
  }
@@ -11389,32 +11735,31 @@ function reportListenerError(err) {
11389
11735
  console.error(err);
11390
11736
  }
11391
11737
  function maybeFlushDiscrete(type) {
11392
- if (_dispatchDepth === 0 && DISCRETE_EVENTS.has(type) && pendingRestores.length > 0) {
11738
+ if (_dispatchDepth === 0 && (type.flags & EVENT_DISCRETE) !== 0 && pendingRestores.length > 0) {
11393
11739
  if (!inFlush && hasPendingWork()) {
11394
11740
  if (VIEW_TRANSITION_DRIVER?.queueAllTransition() === true) flush();
11395
11741
  else flushSync(noop);
11396
11742
  }
11397
11743
  restoreControlledStates();
11398
11744
  }
11399
- if (type === "click") activationCheckable = null;
11745
+ if (type.name === "click") activationCheckable = null;
11400
11746
  }
11401
- function finishCaptureDispatch(event) {
11402
- const type = event.type;
11403
- if (!event.bubbles || event.cancelBubble || !_delegated.has(type)) {
11404
- if (event.bubbles && _delegated.has(type)) maybeEnqueueRestore(event);
11747
+ function finishCaptureDispatch(event, type) {
11748
+ if (!event.bubbles || event.cancelBubble || (type.flags & EVENT_BUBBLE) === 0) {
11749
+ if (event.bubbles && (type.flags & EVENT_BUBBLE) !== 0) maybeEnqueueRestore(event, type);
11405
11750
  maybeFlushDiscrete(type);
11406
11751
  return;
11407
11752
  }
11408
- if (!DISCRETE_EVENTS.has(type)) return;
11753
+ if ((type.flags & EVENT_DISCRETE) === 0) return;
11409
11754
  if (pendingRestores.length === 0) {
11410
- if (!RESTORE_EVENTS.has(type)) return;
11755
+ if ((type.flags & EVENT_RESTORE) === 0) return;
11411
11756
  const tag = event.target?.localName;
11412
11757
  if (tag !== "input" && tag !== "textarea" && tag !== "select") return;
11413
11758
  }
11414
11759
  const bubbleVersion = event[DELEGATED_BUBBLE_VERSION];
11415
11760
  const fallback = () => {
11416
11761
  if (event[DELEGATED_BUBBLE_VERSION] === bubbleVersion) {
11417
- maybeEnqueueRestore(event);
11762
+ maybeEnqueueRestore(event, type);
11418
11763
  maybeFlushDiscrete(type);
11419
11764
  }
11420
11765
  };
@@ -11422,12 +11767,13 @@ function finishCaptureDispatch(event) {
11422
11767
  else queueMicrotask(fallback);
11423
11768
  }
11424
11769
  function dispatchDelegated(event) {
11425
- const nativeCapture = delegatedCapture(event.type);
11770
+ const type = _delegated.get(event.type) ?? _delegatedCapture.get(event.type);
11771
+ if (type === void 0) return;
11772
+ const nativeCapture = (type.flags & EVENT_NATIVE_CAPTURE) !== 0;
11426
11773
  let path = nativeCapture ? prepareDelegatedEvent(event, this) : void 0;
11427
11774
  event[DELEGATED_BUBBLE_VERSION] = (event[DELEGATED_BUBBLE_VERSION] || 0) + 1;
11428
- maybeEnqueueRestore(event);
11429
- const key = "$$" + event.type;
11430
- const targetOnly = TARGET_ONLY_DELEGATED.has(event.type);
11775
+ maybeEnqueueRestore(event, type);
11776
+ const targetOnly = (type.flags & EVENT_TARGET_ONLY) !== 0;
11431
11777
  _dispatchDepth++;
11432
11778
  const node = event.target;
11433
11779
  const prevSubmitRec = ACTIVE_SUBMIT_DISPATCH;
@@ -11437,27 +11783,28 @@ function dispatchDelegated(event) {
11437
11783
  const pathBase = CAPTURE_PATH.length;
11438
11784
  let stop;
11439
11785
  let propagationStarted = false;
11786
+ let frame;
11440
11787
  try {
11441
- if (nativeCapture && _delegatedCapture.has(event.type)) {
11788
+ if (nativeCapture && (type.flags & EVENT_CAPTURE) !== 0) {
11442
11789
  path ??= event.composedPath();
11443
- if (dispatchDelegatedCapture.call(this, event, path)) return;
11790
+ if (dispatchDelegatedCapture.call(this, event, path, type)) return;
11444
11791
  }
11445
- if (!_delegated.has(event.type)) return;
11446
- if (node?.nodeType === 1 && isHtmlCustomElement(node) && (event.type === "invalid" || EMULATED_BUBBLING_EVENTS.includes(event.type)))
11792
+ if ((type.flags & EVENT_BUBBLE) === 0) return;
11793
+ if (node?.nodeType === 1 && isHtmlCustomElement(node) && (type.flags & EVENT_CUSTOM_NATIVE_ONLY) !== 0)
11447
11794
  return;
11448
11795
  buildDelegatedPath(event, this, path);
11449
- snapshotDelegatedSlots(pathBase, key, event);
11796
+ snapshotDelegatedSlots(pathBase, type, false);
11450
11797
  stop = Object.getOwnPropertyDescriptor(event, "stopPropagation");
11451
11798
  propagationStarted = true;
11452
- beginDelegatedPropagation(event, stop, null);
11799
+ frame = beginDelegatedPropagation(event, stop, null);
11453
11800
  for (let i = pathBase; i < CAPTURE_PATH.length; i++) {
11454
11801
  const current = CAPTURE_PATH[i];
11455
11802
  if (targetOnly && current !== event.target) break;
11456
11803
  const slot = CAPTURE_SLOTS[i];
11457
11804
  if (slot != null) {
11458
- setCurrentTarget(event, current);
11805
+ setCurrentTarget(event, current, frame);
11459
11806
  fireEventSlot(slot, event);
11460
- if ((event[PROPAGATION_FLAGS] & 1) !== 0) break;
11807
+ if ((frame.flags & 1) !== 0) break;
11461
11808
  }
11462
11809
  if (targetOnly) break;
11463
11810
  }
@@ -11479,36 +11826,36 @@ function dispatchDelegated(event) {
11479
11826
  reportListenerError(error);
11480
11827
  }
11481
11828
  _dispatchDepth--;
11482
- maybeFlushDiscrete(event.type);
11829
+ maybeFlushDiscrete(type);
11483
11830
  }
11484
11831
  }
11485
- function dispatchDelegatedCapture(event, path) {
11832
+ function dispatchDelegatedCapture(event, path, type = _delegated.get(event.type) ?? _delegatedCapture.get(event.type)) {
11486
11833
  path ??= prepareDelegatedEvent(event, this);
11487
- if (!_delegatedCapture.has(event.type)) return false;
11834
+ if (type === void 0 || (type.flags & EVENT_CAPTURE) === 0) return false;
11488
11835
  path ??= event.composedPath();
11489
- if (!event.bubbles || !_delegated.has(event.type)) maybeEnqueueRestore(event);
11490
- const key = CAPTURE_PREFIX + event.type;
11836
+ if (!event.bubbles || (type.flags & EVENT_BUBBLE) === 0) maybeEnqueueRestore(event, type);
11491
11837
  const pathBase = CAPTURE_PATH.length;
11492
11838
  buildDelegatedPath(event, this, path);
11493
- snapshotDelegatedSlots(pathBase, key, event);
11839
+ snapshotDelegatedSlots(pathBase, type, true);
11494
11840
  const stop = Object.getOwnPropertyDescriptor(event, "stopPropagation");
11495
- const immediate = delegatedCapture(event.type) ? Object.getOwnPropertyDescriptor(event, "stopImmediatePropagation") : null;
11841
+ const immediate = (type.flags & EVENT_NATIVE_CAPTURE) !== 0 ? Object.getOwnPropertyDescriptor(event, "stopImmediatePropagation") : null;
11496
11842
  const wasCancelled = event.cancelBubble;
11497
11843
  let stopped = false;
11498
11844
  _dispatchDepth++;
11499
11845
  const nativeBatch = (0, import_native_read_events.beginNativeEventBatch)(event);
11846
+ let frame;
11500
11847
  try {
11501
- beginDelegatedPropagation(event, stop, immediate);
11848
+ frame = beginDelegatedPropagation(event, stop, immediate);
11502
11849
  for (let i = CAPTURE_PATH.length - 1; i >= pathBase; i--) {
11503
11850
  const slot = CAPTURE_SLOTS[i];
11504
11851
  if (slot != null) {
11505
- setCurrentTarget(event, CAPTURE_PATH[i]);
11852
+ setCurrentTarget(event, CAPTURE_PATH[i], frame);
11506
11853
  fireEventSlot(slot, event);
11507
- if ((event[PROPAGATION_FLAGS] & 1) !== 0) break;
11854
+ if ((frame.flags & 1) !== 0) break;
11508
11855
  }
11509
11856
  }
11510
11857
  } finally {
11511
- stopped = event[PROPAGATION_FLAGS] !== 0 || !wasCancelled && event.cancelBubble;
11858
+ stopped = frame?.flags !== 0 || !wasCancelled && event.cancelBubble;
11512
11859
  CAPTURE_PATH.length = pathBase;
11513
11860
  CAPTURE_SLOTS.length = pathBase;
11514
11861
  endDelegatedPropagation(event, stop, immediate);
@@ -11517,26 +11864,25 @@ function dispatchDelegatedCapture(event, path) {
11517
11864
  (0, import_native_read_events.endNativeEventBatch)(
11518
11865
  event,
11519
11866
  nativeBatch,
11520
- event.bubbles && !event.cancelBubble && _delegated.has(event.type),
11867
+ event.bubbles && !event.cancelBubble && (type.flags & EVENT_BUBBLE) !== 0,
11521
11868
  reportListenerError
11522
11869
  );
11523
11870
  } catch (error) {
11524
11871
  reportListenerError(error);
11525
11872
  }
11526
11873
  _dispatchDepth--;
11527
- finishCaptureDispatch(event);
11874
+ finishCaptureDispatch(event, type);
11528
11875
  }
11529
11876
  return stopped;
11530
11877
  }
11531
11878
  function noop() {
11532
11879
  }
11533
- function setCurrentTarget(event, node) {
11534
- event[CURRENT_TARGET_NODE] = node;
11880
+ function setCurrentTarget(event, node, frame) {
11881
+ frame.currentTarget = node;
11535
11882
  Object.defineProperty(event, "currentTarget", CURRENT_TARGET_DESCRIPTOR);
11536
11883
  }
11537
11884
  function clearCurrentTarget(event) {
11538
11885
  delete event.currentTarget;
11539
- delete event[CURRENT_TARGET_NODE];
11540
11886
  }
11541
11887
  const IDLE_FORM_STATUS = { pending: false, data: null, method: null, action: null };
11542
11888
  const FORM_STATUS = /* @__PURE__ */ new WeakMap();
@@ -12062,20 +12408,22 @@ function projectSelectValue(sel, sv, setDefaultSelected) {
12062
12408
  }
12063
12409
  if (typeof sv !== "string") {
12064
12410
  for (let i = 0; i < options.length; i++) {
12065
- const selected = sv.has(options[i].value);
12066
- if (options[i].selected !== selected) options[i].selected = selected;
12067
- if (setDefaultSelected) options[i].defaultSelected = selected;
12411
+ const option = options[i];
12412
+ const selected = sv.has(option.value);
12413
+ if (option.selected !== selected) option.selected = selected;
12414
+ if (setDefaultSelected) option.defaultSelected = selected;
12068
12415
  }
12069
12416
  return;
12070
12417
  }
12071
12418
  let defaultOption = null;
12072
12419
  for (let i = 0; i < options.length; i++) {
12073
- if (options[i].value === sv) {
12074
- options[i].selected = true;
12075
- if (setDefaultSelected) options[i].defaultSelected = true;
12420
+ const option = options[i];
12421
+ if (option.value === sv) {
12422
+ option.selected = true;
12423
+ if (setDefaultSelected) option.defaultSelected = true;
12076
12424
  return;
12077
12425
  }
12078
- if (defaultOption === null && !options[i].disabled) defaultOption = options[i];
12426
+ if (defaultOption === null && !option.disabled) defaultOption = option;
12079
12427
  }
12080
12428
  if (defaultOption !== null) defaultOption.selected = true;
12081
12429
  }
@@ -12197,46 +12545,47 @@ function setFormControlSources(el, sources) {
12197
12545
  let defaultChecked;
12198
12546
  let multiple;
12199
12547
  const tag = el.localName;
12200
- const assign = (name, next) => {
12201
- switch (name) {
12202
- case "value":
12203
- value = next;
12204
- break;
12205
- case "defaultValue":
12206
- defaultValue = next;
12207
- break;
12208
- case "checked":
12209
- if (tag === "input") checked = next;
12210
- break;
12211
- case "defaultChecked":
12212
- if (tag === "input") defaultChecked = next;
12213
- break;
12214
- case "multiple":
12215
- if (tag === "select") multiple = next;
12216
- break;
12217
- }
12218
- };
12219
12548
  for (let i = 0; i < sources.length; i++) {
12220
12549
  const source = sources[i];
12221
12550
  if (!source[0]) {
12222
- assign(source[1], source[2]);
12551
+ const name = source[1];
12552
+ const next = source[2];
12553
+ switch (name) {
12554
+ case "value":
12555
+ value = next;
12556
+ break;
12557
+ case "defaultValue":
12558
+ defaultValue = next;
12559
+ break;
12560
+ case "checked":
12561
+ if (tag === "input") checked = next;
12562
+ break;
12563
+ case "defaultChecked":
12564
+ if (tag === "input") defaultChecked = next;
12565
+ break;
12566
+ case "multiple":
12567
+ if (tag === "select") multiple = next;
12568
+ break;
12569
+ }
12223
12570
  continue;
12224
12571
  }
12225
12572
  const spread = source[1];
12226
12573
  if (spread == null || typeof spread !== "object" && typeof spread !== "function") continue;
12227
12574
  const object = Object(spread);
12228
- if (Object.prototype.propertyIsEnumerable.call(object, "value")) assign("value", object.value);
12575
+ if (Object.prototype.propertyIsEnumerable.call(object, "value")) value = object.value;
12229
12576
  if (Object.prototype.propertyIsEnumerable.call(object, "defaultValue"))
12230
- assign("defaultValue", object.defaultValue);
12577
+ defaultValue = object.defaultValue;
12231
12578
  if (tag === "input") {
12232
- if (Object.prototype.propertyIsEnumerable.call(object, "checked"))
12233
- assign("checked", object.checked);
12579
+ if (Object.prototype.propertyIsEnumerable.call(object, "checked")) checked = object.checked;
12234
12580
  if (Object.prototype.propertyIsEnumerable.call(object, "defaultChecked"))
12235
- assign("defaultChecked", object.defaultChecked);
12581
+ defaultChecked = object.defaultChecked;
12236
12582
  } else if (tag === "select" && Object.prototype.propertyIsEnumerable.call(object, "multiple")) {
12237
- assign("multiple", object.multiple);
12583
+ multiple = object.multiple;
12238
12584
  }
12239
12585
  }
12586
+ applyFormControlValues(el, tag, value, defaultValue, checked, defaultChecked, multiple);
12587
+ }
12588
+ function applyFormControlValues(el, tag, value, defaultValue, checked, defaultChecked, multiple) {
12240
12589
  const ctrl = armControlled(el);
12241
12590
  const first = !ctrl.formSeen;
12242
12591
  const previousMultiple = ctrl.formMultiple;
@@ -12485,9 +12834,9 @@ function isControlledHostProp(el, name) {
12485
12834
  const t = el.localName;
12486
12835
  return t === "input" || t === "textarea" || t === "select";
12487
12836
  }
12488
- function maybeEnqueueRestore(event) {
12837
+ function maybeEnqueueRestore(event, type) {
12489
12838
  const t = event.target;
12490
- if (t === null || t.$$ctrl === void 0 || !RESTORE_EVENTS.has(event.type)) return;
12839
+ if (t === null || t.$$ctrl === void 0 || (type.flags & EVENT_RESTORE) === 0) return;
12491
12840
  const ctrl = t.$$ctrl;
12492
12841
  if (event.type === "input" && ctrl.compositionEndTask !== void 0) {
12493
12842
  const inputEvent = event;
@@ -12556,6 +12905,7 @@ function registerPortalEventRange(target, portal2) {
12556
12905
  ranges = /* @__PURE__ */ new Set();
12557
12906
  _portalEventRanges.set(target, ranges);
12558
12907
  portalEventTargetCount++;
12908
+ eventRootEpoch++;
12559
12909
  }
12560
12910
  ranges.add(portal2);
12561
12911
  portal2.start.$$portalEventRange = portal2;
@@ -12572,6 +12922,7 @@ function unregisterPortalEventRange(target, portal2) {
12572
12922
  if (ranges.size === 0) {
12573
12923
  _portalEventRanges.delete(target);
12574
12924
  portalEventTargetCount--;
12925
+ eventRootEpoch++;
12575
12926
  }
12576
12927
  }
12577
12928
  function portal(parentScope, slotKey, target, body, props, host, env, fragmentOwners, fragmentAnchor) {
@@ -14055,8 +14406,9 @@ function applyDeoptProp(el, name, v, ownerBlock) {
14055
14406
  ev.key,
14056
14407
  process.env.NODE_ENV !== "production" ? devEventListener(name, v) : v
14057
14408
  );
14058
- if (ev.capture) delegateCaptureEvents([ev.type]);
14059
- else delegateEvents([ev.type]);
14409
+ if (ev.capture) {
14410
+ if (!_delegatedCapture.has(ev.type)) delegateCaptureEvents([ev.type]);
14411
+ } else if (!_delegated.has(ev.type)) delegateEvents([ev.type]);
14060
14412
  } else {
14061
14413
  setAttribute(el, name, v);
14062
14414
  }
@@ -14133,7 +14485,15 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
14133
14485
  let state = scope.slots[slot];
14134
14486
  if (state === void 0) {
14135
14487
  const el2 = document.createElement(tag);
14136
- state = { el: el2, anchor: null, ref: void 0 };
14488
+ state = {
14489
+ el: el2,
14490
+ anchor: null,
14491
+ ref: void 0,
14492
+ props: void 0,
14493
+ body: void 0,
14494
+ latest: void 0,
14495
+ childScope: void 0
14496
+ };
14137
14497
  scope.slots[slot] = state;
14138
14498
  const childScope = new ScopeImpl(scope, block);
14139
14499
  state.childScope = childScope;
@@ -14156,6 +14516,7 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
14156
14516
  }
14157
14517
  function applyHostProps(el, props, scope, state) {
14158
14518
  const prev = state.props;
14519
+ const compareLive = prev !== void 0 && activeHydration() === null && !isHtmlCustomElement(el);
14159
14520
  let needsCheckedInitialization = prev === void 0 && el.localName === "input";
14160
14521
  if (ROOT_RENDER_TRANSACTION !== null && prev !== props) journalObjectOnce(state);
14161
14522
  if (prev != null) {
@@ -14199,7 +14560,9 @@ function applyHostProps(el, props, scope, state) {
14199
14560
  state.ref = v;
14200
14561
  }
14201
14562
  } else if (name === "className" || name === "class") {
14202
- setDeoptClass(el, v);
14563
+ if (!compareLive || typeof v !== "string" || el.getAttribute("class") !== v) {
14564
+ setDeoptClass(el, v);
14565
+ }
14203
14566
  } else if (name === "style") {
14204
14567
  setStyle(el, v, prev != null ? prev.style : void 0);
14205
14568
  } else {
@@ -14210,12 +14573,11 @@ function applyHostProps(el, props, scope, state) {
14210
14573
  } else if (!_delegated.has(ev.type)) {
14211
14574
  delegateEvents([ev.type]);
14212
14575
  }
14213
- setEventHandler(
14214
- el,
14215
- ev.key,
14216
- process.env.NODE_ENV !== "production" ? devEventListener(name, v) : v
14217
- );
14576
+ const handler = process.env.NODE_ENV !== "production" ? devEventListener(name, v) : v;
14577
+ if (!compareLive || el[ev.key] !== handler) setEventHandler(el, ev.key, handler);
14218
14578
  } else if (prev === void 0 || name !== "autoFocus" || isHtmlCustomElement(el)) {
14579
+ 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-")) && el.getAttribute(name === "htmlFor" ? "for" : name) === v)
14580
+ continue;
14219
14581
  setAttribute(el, name, v);
14220
14582
  }
14221
14583
  }
@@ -14240,12 +14602,35 @@ function hasDeoptOwnedChild(el) {
14240
14602
  function getDeoptDesc(n) {
14241
14603
  return n[DEOPT_DESC];
14242
14604
  }
14605
+ function sameDeoptDesc(previous, next, children) {
14606
+ return previous !== void 0 && previous.type === next.type && previous.props === next.props && previous.key === next.key && previous.ref === next.ref && previous.children === children;
14607
+ }
14608
+ function unchangedScopedHostDescriptor(block, d) {
14609
+ const resolve = d[SCOPED_VALUE_RECORD];
14610
+ if (resolve === void 0 && d[SCOPED_CHILDREN_RESOLVER] === void 0) return true;
14611
+ const next = resolve === void 0 ? d : resolve();
14612
+ const previous = block.deoptNode === null ? void 0 : getDeoptDesc(block.deoptNode);
14613
+ return previous === next || sameDeoptDesc(previous, next, next.children);
14614
+ }
14243
14615
  function setDeoptDesc(el, d) {
14244
14616
  const resolveScopedRecord = d[SCOPED_VALUE_RECORD];
14617
+ let record = resolveScopedRecord === void 0 ? d : resolveScopedRecord();
14618
+ if (record[SCOPED_CHILDREN_RESOLVER] !== void 0) {
14619
+ const children = record.children;
14620
+ const previous = getDeoptDesc(el);
14621
+ record = sameDeoptDesc(previous, record, children) ? previous : {
14622
+ $$kind: ELEMENT_TAG,
14623
+ type: record.type,
14624
+ props: record.props,
14625
+ key: record.key,
14626
+ ref: record.ref,
14627
+ children
14628
+ };
14629
+ }
14245
14630
  if (TRANSITION_JOURNAL !== null) {
14246
14631
  TRANSITION_JOURNAL.push(JOURNAL_PROP, el, DEOPT_DESC, getDeoptDesc(el));
14247
14632
  }
14248
- el[DEOPT_DESC] = resolveScopedRecord === void 0 ? d : resolveScopedRecord();
14633
+ el[DEOPT_DESC] = record;
14249
14634
  }
14250
14635
  function isFragmentDescriptor(value) {
14251
14636
  return isElementDescriptor(value) && value.type === Fragment;
@@ -14311,47 +14696,43 @@ function deoptWrapperKind(value) {
14311
14696
  return POSITIONAL_CHILDREN.has(value) ? "fragment" : "array";
14312
14697
  }
14313
14698
  const DEOPT_KEY_STRINGIFY = JSON.stringify;
14314
- function nestedImplicitKeyPrefix(path) {
14699
+ const DEOPT_KEY_STRING = String;
14700
+ function nestedDeoptKeyPrefix(path) {
14315
14701
  if (JSON.stringify !== DEOPT_KEY_STRINGIFY || "toJSON" in path) return null;
14316
14702
  for (let i = 0; i < path.length; i++) {
14317
14703
  const type = typeof path[i];
14318
14704
  if (type !== "string" && type !== "number") return null;
14319
14705
  }
14320
- return "[" + JSON.stringify(path) + ',"index",';
14706
+ return "[" + JSON.stringify(path) + ",";
14321
14707
  }
14322
- function appendScopedDeoptKey(outKeys, path, item, index, key, implicitPrefix) {
14708
+ function appendScopedDeoptKey(outKeys, path, item, index, key, keyPrefix) {
14323
14709
  const explicit = (isElementDescriptor(item) || item?.$$kind === PORTAL_TAG) && item.key != null;
14324
14710
  if (path.length === 0) {
14325
14711
  outKeys.push(explicit ? "k" + String(key) : index);
14326
- return implicitPrefix;
14712
+ return keyPrefix;
14327
14713
  }
14328
- if (!explicit) {
14329
- if (implicitPrefix === void 0) implicitPrefix = nestedImplicitKeyPrefix(path);
14330
- if (implicitPrefix !== null && JSON.stringify === DEOPT_KEY_STRINGIFY && !("toJSON" in path)) {
14331
- outKeys.push(implicitPrefix + index + "]");
14332
- return implicitPrefix;
14714
+ if (keyPrefix !== null && (!explicit || typeof key === "string" && String === DEOPT_KEY_STRING) && JSON.stringify === DEOPT_KEY_STRINGIFY && !("toJSON" in path)) {
14715
+ if (keyPrefix === void 0) keyPrefix = nestedDeoptKeyPrefix(path);
14716
+ if (keyPrefix !== null) {
14717
+ outKeys.push(
14718
+ explicit ? keyPrefix + '"key",' + JSON.stringify(String(key)) + "]" : keyPrefix + '"index",' + index + "]"
14719
+ );
14720
+ return keyPrefix;
14333
14721
  }
14334
14722
  }
14335
14723
  outKeys.push(JSON.stringify([path, explicit ? "key" : "index", explicit ? String(key) : index]));
14336
- return implicitPrefix;
14724
+ return null;
14337
14725
  }
14338
14726
  function flattenReactChildContainer(outItems, outKeys, children, kind, path) {
14339
14727
  const keyFn = kind === "fragment" ? deoptKeyPositional : deoptKey;
14340
14728
  const count = children.length;
14341
- let implicitPrefix = count > 1 ? void 0 : null;
14729
+ let keyPrefix = count > 1 ? void 0 : null;
14342
14730
  for (let i = 0; i < count; i++) {
14343
14731
  const item = children[i];
14344
14732
  if (isFragmentDescriptor(item)) {
14345
14733
  if (item.ref != null || import_has_own.hasOwnProp.call(item.props, "ref")) {
14346
14734
  outItems.push(fragmentRefDescriptor(item));
14347
- implicitPrefix = appendScopedDeoptKey(
14348
- outKeys,
14349
- path,
14350
- item,
14351
- i,
14352
- keyFn(item, i),
14353
- implicitPrefix
14354
- );
14735
+ keyPrefix = appendScopedDeoptKey(outKeys, path, item, i, keyFn(item, i), keyPrefix);
14355
14736
  continue;
14356
14737
  }
14357
14738
  const nested = fragmentDescriptorChildren(item);
@@ -14374,7 +14755,7 @@ function flattenReactChildContainer(outItems, outKeys, children, kind, path) {
14374
14755
  continue;
14375
14756
  }
14376
14757
  outItems.push(item);
14377
- implicitPrefix = appendScopedDeoptKey(outKeys, path, item, i, keyFn(item, i), implicitPrefix);
14758
+ keyPrefix = appendScopedDeoptKey(outKeys, path, item, i, keyFn(item, i), keyPrefix);
14378
14759
  }
14379
14760
  }
14380
14761
  function singleDeoptKey(item, key) {
@@ -14505,9 +14886,9 @@ function reconcileDeoptChildren(el, children, ownerBlock) {
14505
14886
  const next = [];
14506
14887
  const nextKeys = [];
14507
14888
  flattenDeoptChildrenKeyed(next, nextKeys, children, "");
14508
- const existing = el.childNodes;
14889
+ const firstChild = getFirstChild(el);
14509
14890
  const journal = ROOT_RENDER_TRANSACTION !== null && el.parentNode !== null && (ownerBlock.mounted || ROOT_RENDER_TRANSACTION.hydrating || ROOT_RENDER_TRANSACTION.retainedCreated?.has(ownerBlock));
14510
- if (existing.length === 0) {
14891
+ if (firstChild === null) {
14511
14892
  for (let i = 0; i < next.length; i++) {
14512
14893
  const node = reconcileDeoptNode(null, next[i], ownerBlock, childNs);
14513
14894
  if (node !== null) {
@@ -14526,7 +14907,7 @@ function reconcileDeoptChildren(el, children, ownerBlock) {
14526
14907
  let hydrationOwnsUnstamped;
14527
14908
  let byKey = null;
14528
14909
  const unstamped = [];
14529
- let scan = getFirstChild(el);
14910
+ let scan = firstChild;
14530
14911
  while (scan !== null) {
14531
14912
  const rangeEnd = scan.$$portalEnd;
14532
14913
  if (rangeEnd != null) {
@@ -14588,9 +14969,10 @@ function reconcileDeoptChildren(el, children, ownerBlock) {
14588
14969
  }
14589
14970
  }
14590
14971
  }
14972
+ let cursor = getFirstChild(el);
14591
14973
  for (let i = 0; i < result.length; i++) {
14592
14974
  const want = result[i];
14593
- const at = hasForeign ? liveOwnedChildAt(el, i, hydrationOwnsUnstamped === true) : existing[i] ?? null;
14975
+ const at = hasForeign ? nextDeoptOwnedChild(cursor, hydrationOwnsUnstamped === true) : cursor;
14594
14976
  if (at !== want) {
14595
14977
  if (journal) journalRootChildren(el);
14596
14978
  if (renderingFocus === null) el.insertBefore(want, at);
@@ -14599,6 +14981,7 @@ function reconcileDeoptChildren(el, children, ownerBlock) {
14599
14981
  moveFocusedNodeBefore(el, want, at, renderingFocus);
14600
14982
  }
14601
14983
  }
14984
+ cursor = getNextSibling(want);
14602
14985
  }
14603
14986
  }
14604
14987
  function nodeAfterPortalRange(start, end) {
@@ -14606,9 +14989,7 @@ function nodeAfterPortalRange(start, end) {
14606
14989
  while (m !== null && m !== end) m = getNextSibling(m);
14607
14990
  return getNextSibling(m ?? start);
14608
14991
  }
14609
- function liveOwnedChildAt(el, index, adoptHydrationChildren = false) {
14610
- let i = 0;
14611
- let scan = getFirstChild(el);
14992
+ function nextDeoptOwnedChild(scan, adoptHydrationChildren) {
14612
14993
  while (scan !== null) {
14613
14994
  const rangeEnd = scan.$$portalEnd;
14614
14995
  if (rangeEnd != null) {
@@ -14619,9 +15000,7 @@ function liveOwnedChildAt(el, index, adoptHydrationChildren = false) {
14619
15000
  scan = getNextSibling(scan);
14620
15001
  continue;
14621
15002
  }
14622
- if (i === index) return scan;
14623
- i++;
14624
- scan = getNextSibling(scan);
15003
+ return scan;
14625
15004
  }
14626
15005
  return null;
14627
15006
  }
@@ -14994,8 +15373,28 @@ function teardownChildForSlot(state) {
14994
15373
  state.forSlot = null;
14995
15374
  }
14996
15375
  let DEOPT_UPGRADE = null;
15376
+ function adoptedDeoptChildren(value, cursor) {
15377
+ if (Array.isArray(value)) {
15378
+ const copy = [];
15379
+ const length = value.length;
15380
+ for (let index = 0; index < length; index++) {
15381
+ copy[index] = adoptedDeoptChildren(value[index], cursor);
15382
+ }
15383
+ if (POSITIONAL_CHILDREN.has(value)) POSITIONAL_CHILDREN.add(copy);
15384
+ return copy;
15385
+ }
15386
+ if (value == null || value === false || value === true || value === "") return value;
15387
+ const type = typeof value;
15388
+ const element = isElementDescriptor(value);
15389
+ if (!element && type !== "string" && type !== "number" && type !== "bigint") return value;
15390
+ const node = cursor.node;
15391
+ if (node === null || node === cursor.end) return value;
15392
+ cursor.node = node.nextSibling;
15393
+ return element ? getDeoptDesc(node) ?? value : value;
15394
+ }
14997
15395
  function buildDeoptAdoptQueue(oldChildren, start, end) {
14998
- const prepared = prepareDeoptList(oldChildren, true);
15396
+ const accepted = adoptedDeoptChildren(oldChildren, { node: start.nextSibling, end });
15397
+ const prepared = prepareDeoptList(accepted, true);
14999
15398
  const { items, keys } = prepared;
15000
15399
  const queue = [];
15001
15400
  let cursor = start.nextSibling;
@@ -15274,7 +15673,9 @@ function renderPreparedChildList(state, parentBlock, domParent, preparedList, hy
15274
15673
  emptyBlock: null,
15275
15674
  env: void 0,
15276
15675
  adopt: null,
15277
- plainDeopt: false
15676
+ plainDeopt: false,
15677
+ mappedNative: void 0,
15678
+ selectionItems: void 0
15278
15679
  };
15279
15680
  if (upgradeArmed) {
15280
15681
  state.forSlot.adopt = buildDeoptAdoptQueue(upgradeChildren, state.start, state.end);
@@ -15282,14 +15683,15 @@ function renderPreparedChildList(state, parentBlock, domParent, preparedList, hy
15282
15683
  }
15283
15684
  const { items, keys } = preparedList;
15284
15685
  const markerlessMappedFallback = mappedFallback === true && hydration !== null && !hydration.isOpen(hydration.node);
15285
- const getKey = compiledMapKey ? (item, index) => "k" + String(compiledMapKey(item, index)) : (_item, i) => keys[i];
15686
+ const keySource = compiledMapKey || keys;
15687
+ const normalizeKey = !!compiledMapKey;
15286
15688
  const wasMappedNative = state.forSlot.mappedNative === true;
15287
15689
  let body = compiledMapBody || (mappedFallback === true ? mappedDeoptItemBody : deoptItemBody);
15288
15690
  if (compiledMapBody === void 0 && wasMappedNative && state.forSlot.size > 0) {
15289
15691
  for (let index = 0; index < items.length; index++) {
15290
15692
  const item = items[index];
15291
15693
  if (!isHostDescriptor(item)) continue;
15292
- const block = state.forSlot.items.get(getKey(item, index));
15694
+ const block = state.forSlot.items.get(readListKey(keySource, item, index, normalizeKey));
15293
15695
  if (block !== void 0 && block.startMarker !== null && block.startMarker === block.endMarker && block.startMarker.nodeType === 1 && block.startMarker.localName === item.type) {
15294
15696
  const root = block.startMarker;
15295
15697
  const text = root.firstChild;
@@ -15367,23 +15769,25 @@ function renderPreparedChildList(state, parentBlock, domParent, preparedList, hy
15367
15769
  parentBlock,
15368
15770
  state.forSlot,
15369
15771
  items,
15370
- getKey,
15772
+ keySource,
15371
15773
  body,
15372
15774
  compiledMapBody === void 0 ? 2 : (fastFlags & 2) !== 0,
15373
- ssrMarkerless
15775
+ ssrMarkerless,
15776
+ normalizeKey
15374
15777
  );
15375
15778
  } else {
15376
15779
  reconcileKeyed(
15377
15780
  parentBlock,
15378
15781
  state.forSlot,
15379
15782
  items,
15380
- getKey,
15783
+ keySource,
15381
15784
  body,
15382
15785
  pure,
15383
15786
  compiledMapBody === void 0 ? 2 : (fastFlags & 2) !== 0,
15384
15787
  lite,
15385
15788
  (fastFlags & 8) !== 0,
15386
- ssrMarkerless
15789
+ ssrMarkerless,
15790
+ normalizeKey
15387
15791
  );
15388
15792
  }
15389
15793
  if (state.forSlot.adopt !== null) {
@@ -15736,7 +16140,10 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
15736
16140
  }
15737
16141
  if (state.block !== null && comp === state.currentComp) {
15738
16142
  if (tryMemoBail(state.block, comp, props)) return;
15739
- if (props === state.block.props && tryImplicitBail(state.block)) return;
16143
+ if (props === state.block.props && // Deferred host shells can change their complete record or children.
16144
+ // Compare the accepted resolution before accepting the shell's identity.
16145
+ (comp !== hostElementBody || unchangedScopedHostDescriptor(state.block, props)) && tryImplicitBail(state.block))
16146
+ return;
15740
16147
  if (state.block.props !== props) journalRootProperty(state.block, "props", state.block.props);
15741
16148
  state.block.props = props;
15742
16149
  renderBlock(state.block);
@@ -16065,7 +16472,7 @@ function tryMemoBail(block, comp, props) {
16065
16472
  if (comp.__memo !== true) return false;
16066
16473
  if (!block.mounted || block.renderStatus !== RENDER_VALID) return false;
16067
16474
  const compare = comp.__compare;
16068
- const equal = compare ? compare(block.props, props) : shallowEqualProps(block.props, props);
16475
+ const equal = compare ? comp[LAZY_BODY_CHECK] !== void 0 ? compare(block.props, props, block) : compare(block.props, props) : shallowEqualProps(block.props, props);
16069
16476
  if (!equal) return false;
16070
16477
  if (ctxDirectChanged(block)) return false;
16071
16478
  if (ctxDepsChanged(block)) refreshContextConsumers(block);
@@ -16078,6 +16485,8 @@ function tryMemoBail(block, comp, props) {
16078
16485
  function tryImplicitBail(block) {
16079
16486
  if (block.$$implicitBail !== true) return false;
16080
16487
  if (!block.mounted || block.renderStatus !== RENDER_VALID) return false;
16488
+ const checkLazyBody = block.body[LAZY_BODY_CHECK];
16489
+ if (checkLazyBody !== void 0 && !checkLazyBody(block)) return false;
16081
16490
  if (ctxDirectChanged(block)) return false;
16082
16491
  if (ctxDepsChanged(block)) refreshContextConsumers(block);
16083
16492
  restampCtxDeps(block);
@@ -16265,7 +16674,14 @@ function memo(component, arePropsEqual) {
16265
16674
  Object.defineProperty(memoWrapper, "defaultProps", MEMO_DEFAULT_PROPS_DESCRIPTOR);
16266
16675
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
16267
16676
  (0, import_profiling.__profileComponentSource)(memoWrapper, component);
16268
- if (arePropsEqual) Object.defineProperty(memoWrapper, "__compare", { value: arePropsEqual });
16677
+ const checkLazyBody = component[LAZY_BODY_CHECK];
16678
+ if (checkLazyBody !== void 0) {
16679
+ markLazyBodyCheck(memoWrapper, checkLazyBody);
16680
+ Object.defineProperty(memoWrapper, "__compare", {
16681
+ value: (prev, next, scope) => checkLazyBody(scope) && (arePropsEqual ? arePropsEqual(prev, next) : shallowEqualProps(prev, next))
16682
+ });
16683
+ } else if (arePropsEqual)
16684
+ Object.defineProperty(memoWrapper, "__compare", { value: arePropsEqual });
16269
16685
  return memoWrapper;
16270
16686
  }
16271
16687
  const HMR = /* @__PURE__ */ Symbol.for("octane.hmr");
@@ -17053,6 +17469,8 @@ function tryBlock(parentScope, slotKey, domParent, tryBody, catchBody, pendingBo
17053
17469
  state.catchBody = catchBody;
17054
17470
  state.pendingBody = pendingBody;
17055
17471
  state.propagateSuspense = propagateSuspense;
17472
+ if (ACTIVE_TRANSITION_ATTEMPT !== null && state.env !== env)
17473
+ TRANSITION_JOURNAL.push(JOURNAL_PROP, state, "env", state.env);
17056
17474
  state.env = env;
17057
17475
  }
17058
17476
  const s = state;
@@ -18719,12 +19137,13 @@ function hasHeldDeferredSwap(slot) {
18719
19137
  }
18720
19138
  return false;
18721
19139
  }
18722
- function useDeferredValue(value, ...rest) {
18723
- let slot = rest[rest.length - 1];
19140
+ function useDeferredValue(value, initialValueOrSlot = void 0, lastSlot) {
19141
+ const count = arguments.length;
19142
+ let slot = count > 3 ? arguments[count - 1] : count === 3 ? lastSlot : initialValueOrSlot;
18724
19143
  slot = resolveSlot(slot);
18725
19144
  if (slot === void 0) missingSlot("useDeferredValue");
18726
- const initialValue = rest.length >= 2 ? rest[0] : void 0;
18727
- const hasInitial = rest.length >= 2;
19145
+ const hasInitial = count >= 3;
19146
+ const initialValue = hasInitial ? initialValueOrSlot : void 0;
18728
19147
  const scope = CURRENT_SCOPE;
18729
19148
  const block = CURRENT_BLOCK;
18730
19149
  const hidden = inInactiveSubtree(block);
@@ -20006,7 +20425,9 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
20006
20425
  // Compiled `@for` slots never read this — they never pass the de-opt
20007
20426
  // sentinel — but both ForSlot literals declare it so every slot shares
20008
20427
  // one hidden class and the stamp in childSlot transitions nothing.
20009
- plainDeopt: false
20428
+ plainDeopt: false,
20429
+ mappedNative: void 0,
20430
+ selectionItems: void 0
20010
20431
  };
20011
20432
  parentScope.slots[slotKey] = state;
20012
20433
  registerSlot(parentScope, state);
@@ -20444,8 +20865,8 @@ function updateSurvivor(block, newItem, newIdx, itemBody, pure, lite, indexIndep
20444
20865
  block.itemIndex = newIdx;
20445
20866
  block.body = itemBody;
20446
20867
  } else {
20447
- if (journal && block.props !== newItem) journalRootProperty(block, "props", block.props);
20448
- if (journal && block.extra !== env) journalRootProperty(block, "extra", block.extra);
20868
+ if (journal && (block.props !== newItem || block.extra !== env))
20869
+ TRANSITION_JOURNAL.push(JOURNAL_INPUTS, block, block.props, block.extra);
20449
20870
  block.props = newItem;
20450
20871
  block.body = itemBody;
20451
20872
  block.itemIndex = newIdx;
@@ -20457,15 +20878,15 @@ function updateSurvivor(block, newItem, newIdx, itemBody, pure, lite, indexIndep
20457
20878
  }
20458
20879
  }
20459
20880
  }
20460
- function consumeAdoptQueuePrefix(adopt, count) {
20461
- if (count < adopt.length) adopt.copyWithin(0, count);
20462
- adopt.length -= count;
20881
+ function readListKey(keySource, item, index, normalizeKey) {
20882
+ if (typeof keySource !== "function") return keySource[index];
20883
+ return normalizeKey ? "k" + String(keySource(item, index)) : keySource(item, index);
20463
20884
  }
20464
- function checkedListKey(getKey) {
20885
+ function checkedListKey(keySource, normalizeKey) {
20465
20886
  const seen = /* @__PURE__ */ new Map();
20466
20887
  let warned = false;
20467
20888
  return (item, index) => {
20468
- const key = getKey(item, index);
20889
+ const key = readListKey(keySource, item, index, normalizeKey);
20469
20890
  if (!warned && seen.has(key) && seen.get(key) !== index) {
20470
20891
  warned = true;
20471
20892
  const label = typeof key === "object" || typeof key === "function" ? "[object identity]" : String(key);
@@ -20476,29 +20897,46 @@ function checkedListKey(getKey) {
20476
20897
  return key;
20477
20898
  };
20478
20899
  }
20479
- function mountItemsLinear(parentBlock, state, items, getKey, itemBody, singleRoot, ssrMarkerless) {
20900
+ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, singleRoot, ssrMarkerless, normalizeKey = false) {
20480
20901
  const newLen = items.length;
20481
20902
  if (newLen === 0) return;
20482
- if (process.env.NODE_ENV !== "production") getKey = checkedListKey(getKey);
20903
+ if (process.env.NODE_ENV !== "production") {
20904
+ keySource = checkedListKey(keySource, normalizeKey);
20905
+ normalizeKey = false;
20906
+ }
20483
20907
  if (TRANSITION_JOURNAL !== null) journalForSlot(state);
20484
20908
  const oldItems = state.items;
20485
20909
  const parentNode = state.end.parentNode;
20486
20910
  const adopt = state.adopt;
20487
- let adoptIndex = 0;
20911
+ let adoptByKey = null;
20912
+ let adoptedNodes = null;
20913
+ if (adopt !== null) {
20914
+ adoptByKey = /* @__PURE__ */ new Map();
20915
+ for (let index = 0; index < adopt.length; index++) {
20916
+ const entry = adopt[index];
20917
+ if (!adoptByKey.has(entry.key)) adoptByKey.set(entry.key, entry);
20918
+ }
20919
+ }
20488
20920
  let prev = null;
20489
20921
  try {
20490
20922
  for (let i = 0; i < newLen; i++) {
20491
20923
  const item = items[i];
20492
- const key = getKey(item, i);
20924
+ const key = readListKey(keySource, item, i, normalizeKey);
20493
20925
  let adoptNode = null;
20494
20926
  let anchor = state.end;
20495
- if (adopt !== null && adoptIndex < adopt.length) {
20496
- const candidate = adopt[adoptIndex];
20497
- if (candidate.key === key) {
20927
+ if (adoptByKey !== null) {
20928
+ anchor = prev === null ? state.start.nextSibling : prev.endMarker.nextSibling;
20929
+ const candidate = adoptByKey.get(key);
20930
+ if (candidate !== void 0) {
20498
20931
  adoptNode = candidate.node;
20499
- adoptIndex++;
20500
- } else {
20501
- anchor = candidate.node;
20932
+ adoptByKey.delete(key);
20933
+ (adoptedNodes ??= /* @__PURE__ */ new Set()).add(adoptNode);
20934
+ if (adoptNode !== anchor) {
20935
+ if (renderingFocus !== null) {
20936
+ captureFocusedMovement(parentNode, renderingFocus);
20937
+ moveFocusedNodeBefore(parentNode, adoptNode, anchor, renderingFocus);
20938
+ } else parentNode.insertBefore(adoptNode, anchor);
20939
+ }
20502
20940
  }
20503
20941
  }
20504
20942
  const block = mountItem(
@@ -20536,19 +20974,38 @@ function mountItemsLinear(parentBlock, state, items, getKey, itemBody, singleRoo
20536
20974
  state.size = 0;
20537
20975
  throw error;
20538
20976
  }
20539
- if (adoptIndex !== 0) consumeAdoptQueuePrefix(adopt, adoptIndex);
20977
+ if (adoptByKey !== null) {
20978
+ let remaining = 0;
20979
+ for (let index = 0; index < adopt.length; index++) {
20980
+ const entry = adopt[index];
20981
+ if (!adoptedNodes?.has(entry.node)) adopt[remaining++] = entry;
20982
+ }
20983
+ adopt.length = remaining;
20984
+ }
20540
20985
  }
20541
- function reconcileKeyed(parentBlock, state, items, getKey, itemBody, pure, singleRoot, lite = false, indexIndependent = false, ssrMarkerless = false) {
20986
+ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, singleRoot, lite = false, indexIndependent = false, ssrMarkerless = false, normalizeKey = false) {
20542
20987
  const oldItems = state.items;
20543
20988
  const oldSize = state.size;
20544
20989
  const newLen = items.length;
20545
20990
  const parentNode = state.end.parentNode;
20546
20991
  let journalShape = TRANSITION_JOURNAL !== null;
20547
20992
  if (oldSize === 0) {
20548
- mountItemsLinear(parentBlock, state, items, getKey, itemBody, singleRoot, ssrMarkerless);
20993
+ mountItemsLinear(
20994
+ parentBlock,
20995
+ state,
20996
+ items,
20997
+ keySource,
20998
+ itemBody,
20999
+ singleRoot,
21000
+ ssrMarkerless,
21001
+ normalizeKey
21002
+ );
20549
21003
  return;
20550
21004
  }
20551
- if (process.env.NODE_ENV !== "production") getKey = checkedListKey(getKey);
21005
+ if (process.env.NODE_ENV !== "production") {
21006
+ keySource = checkedListKey(keySource, normalizeKey);
21007
+ normalizeKey = false;
21008
+ }
20552
21009
  if (newLen === 0) {
20553
21010
  const ownedRootClear = journalShape && canDeferRootOwnedListClear(state);
20554
21011
  if (ownedRootClear && (TRANSITION_JOURNAL_BAGS.get(state) ?? -1) < TRANSITION_JOURNAL_CHECKPOINT)
@@ -20563,7 +21020,7 @@ function reconcileKeyed(parentBlock, state, items, getKey, itemBody, pure, singl
20563
21020
  let oldFirst = state.head;
20564
21021
  let prefixLen = 0;
20565
21022
  while (oldFirst !== null && prefixLen < newLen) {
20566
- const newKey = getKey(items[prefixLen], prefixLen);
21023
+ const newKey = readListKey(keySource, items[prefixLen], prefixLen, normalizeKey);
20567
21024
  if (oldFirst.key !== newKey) break;
20568
21025
  const block = oldFirst;
20569
21026
  updateSurvivor(
@@ -20584,7 +21041,7 @@ function reconcileKeyed(parentBlock, state, items, getKey, itemBody, pure, singl
20584
21041
  let newEnd = newLen - 1;
20585
21042
  let oldRemain = oldSize - prefixLen;
20586
21043
  while (oldLast !== null && oldRemain > 0 && newEnd >= prefixLen) {
20587
- const newKey = getKey(items[newEnd], newEnd);
21044
+ const newKey = readListKey(keySource, items[newEnd], newEnd, normalizeKey);
20588
21045
  if (oldLast.key !== newKey) break;
20589
21046
  const block = oldLast;
20590
21047
  updateSurvivor(block, items[newEnd], newEnd, itemBody, pure, lite, indexIndependent, state.env);
@@ -20607,7 +21064,7 @@ function reconcileKeyed(parentBlock, state, items, getKey, itemBody, pure, singl
20607
21064
  let prev = beforeMiddle;
20608
21065
  for (let i = prefixLen; i <= newEnd; i++) {
20609
21066
  const item = items[i];
20610
- const key = getKey(item, i);
21067
+ const key = readListKey(keySource, item, i, normalizeKey);
20611
21068
  const block = mountItem(
20612
21069
  parentBlock,
20613
21070
  parentNode,
@@ -20652,10 +21109,10 @@ function reconcileKeyed(parentBlock, state, items, getKey, itemBody, pure, singl
20652
21109
  return;
20653
21110
  }
20654
21111
  const newMidLen = newEnd - prefixLen + 1;
20655
- const newKeys = new Array(newMidLen);
21112
+ const newKeys = [];
20656
21113
  const newKeysToIdx = /* @__PURE__ */ new Map();
20657
21114
  for (let i = 0; i < newMidLen; i++) {
20658
- const key = getKey(items[prefixLen + i], prefixLen + i);
21115
+ const key = readListKey(keySource, items[prefixLen + i], prefixLen + i, normalizeKey);
20659
21116
  newKeys[i] = key;
20660
21117
  newKeysToIdx.set(key, i);
20661
21118
  }
@@ -22667,6 +23124,7 @@ function scriptResource(attrs) {
22667
23124
  compilerCacheContext,
22668
23125
  compilerCacheImmutableArrayFilter,
22669
23126
  compilerCacheMappedArray,
23127
+ compilerMemoRegion,
22670
23128
  compilerOwnsContextProvider,
22671
23129
  componentSlot,
22672
23130
  componentSlotLite,
@@ -22691,8 +23149,10 @@ function scriptResource(attrs) {
22691
23149
  evt0,
22692
23150
  evt0u,
22693
23151
  evt1,
23152
+ evt1e,
22694
23153
  evt1u,
22695
23154
  evt2,
23155
+ evt2e,
22696
23156
  evt2u,
22697
23157
  evtN,
22698
23158
  evtNu,
@@ -22726,6 +23186,7 @@ function scriptResource(attrs) {
22726
23186
  injectStyle,
22727
23187
  invokeManualHook,
22728
23188
  isChildrenBlock,
23189
+ isHydratingStyle,
22729
23190
  isInActScope,
22730
23191
  isValidElement,
22731
23192
  keyedForBlock,
@@ -22818,15 +23279,20 @@ function scriptResource(attrs) {
22818
23279
  setHTML,
22819
23280
  setHostPropSources,
22820
23281
  setIsOctaneActEnvironment,
23282
+ setPlainAttribute,
23283
+ setPlainAttributeIfChanged,
22821
23284
  setScriptText,
22822
23285
  setSelectValue,
22823
23286
  setSpread,
22824
23287
  setStringData,
22825
23288
  setStringDataIfChanged,
22826
23289
  setStyle,
23290
+ setStyleProperties,
22827
23291
  setStyleProperty,
22828
23292
  setText,
22829
23293
  setTransitionFallbackTimeout,
23294
+ setURLAttribute,
23295
+ setURLAttributeIfChanged,
22830
23296
  setValue,
22831
23297
  sibling,
22832
23298
  snapshotSpread,