octane 0.2.6 → 0.2.7

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.
package/dist/runtime.js CHANGED
@@ -888,7 +888,9 @@ function beginTransitionAttempt(block) {
888
888
  TRANSITION_JOURNAL ??= [];
889
889
  TRANSITION_JOURNAL_BAGS ??= /* @__PURE__ */ new Map();
890
890
  TRANSITION_JOURNAL_WINDOWS.push(TRANSITION_JOURNAL_CHECKPOINT);
891
+ TRANSITION_JOURNAL_BAG_WINDOWS.push(TRANSITION_JOURNAL_BAG_WINDOW);
891
892
  TRANSITION_JOURNAL_CHECKPOINT = TRANSITION_JOURNAL.length;
893
+ TRANSITION_JOURNAL_BAG_WINDOW = ++NEXT_TRANSITION_JOURNAL_BAG_WINDOW;
892
894
  TRANSITION_JOURNAL_DEPTH++;
893
895
  const capture = WIP_CAPTURE;
894
896
  const effects = capture?.effects ?? effectQueues;
@@ -964,6 +966,7 @@ function endTransitionAttempt(attempt) {
964
966
  if (!continuing) scheduleRender(attempt.origin);
965
967
  }
966
968
  TRANSITION_JOURNAL_CHECKPOINT = TRANSITION_JOURNAL_WINDOWS.pop();
969
+ TRANSITION_JOURNAL_BAG_WINDOW = TRANSITION_JOURNAL_BAG_WINDOWS.pop();
967
970
  if (--TRANSITION_JOURNAL_DEPTH === 0) {
968
971
  TRANSITION_JOURNAL = null;
969
972
  TRANSITION_JOURNAL_BAGS = null;
@@ -1059,7 +1062,7 @@ function keepsRootTransition(owner, includePromoted = false) {
1059
1062
  }
1060
1063
  function holdRootTransition(owner, transaction, attempt) {
1061
1064
  const previous = owner.transition;
1062
- if (attempt === null || !attempt.origin.mounted || attempt.origin.disposed || transaction.created?.has(attempt.origin) || attempt.heldSlots !== null && attempt.heldSlots.size !== 0) {
1065
+ if (attempt === null || !attempt.origin.mounted || attempt.origin.disposed || isCreatedInRootRender(transaction, attempt.origin) || attempt.heldSlots !== null && attempt.heldSlots.size !== 0) {
1063
1066
  if (previous !== void 0 && !rootTransitionCellsIntact(previous))
1064
1067
  discardRootTransition(owner);
1065
1068
  return false;
@@ -1161,16 +1164,21 @@ const JOURNAL_TEXT = 0;
1161
1164
  const JOURNAL_ATTR = 1;
1162
1165
  const JOURNAL_BAG = 2;
1163
1166
  const JOURNAL_PROP = 3;
1167
+ const JOURNAL_CREATED = 4;
1164
1168
  const JOURNAL_RENDER = 5;
1165
1169
  const JOURNAL_UNDO = 6;
1166
1170
  let TRANSITION_JOURNAL = null;
1167
1171
  let TRANSITION_JOURNAL_BAGS = null;
1168
1172
  let TRANSITION_JOURNAL_CHECKPOINT = 0;
1169
1173
  const TRANSITION_JOURNAL_WINDOWS = [];
1174
+ let TRANSITION_JOURNAL_BAG_WINDOW = 0;
1175
+ let NEXT_TRANSITION_JOURNAL_BAG_WINDOW = 0;
1176
+ const TRANSITION_JOURNAL_BAG_WINDOWS = [];
1170
1177
  let TRANSITION_JOURNAL_DEPTH = 0;
1171
1178
  let ROOT_RENDER_TRANSACTION = null;
1172
1179
  let ROOT_RENDER_TRANSACTIONS = [];
1173
1180
  let ROOT_RENDER_ROLLBACK = false;
1181
+ let NEXT_ROOT_RENDER_CREATED_STAMP = 0;
1174
1182
  function getRootRenderRetryKey(scope, retryOnly = false) {
1175
1183
  const owner = scope.block.idState.renderOwner;
1176
1184
  if (owner === void 0 || owner.disposed || retryOnly && !owner.transaction?.rootRequest)
@@ -1191,6 +1199,8 @@ function beginRootRender(owner) {
1191
1199
  bags: /* @__PURE__ */ new Map(),
1192
1200
  capture,
1193
1201
  created: null,
1202
+ createdStamp: ++NEXT_ROOT_RENDER_CREATED_STAMP,
1203
+ bagWindow: ++NEXT_TRANSITION_JOURNAL_BAG_WINDOW,
1194
1204
  retainedCreated: null,
1195
1205
  retired: null,
1196
1206
  structures: null,
@@ -1208,6 +1218,7 @@ function beginRootRender(owner) {
1208
1218
  log: TRANSITION_JOURNAL,
1209
1219
  bags: TRANSITION_JOURNAL_BAGS,
1210
1220
  checkpoint: TRANSITION_JOURNAL_CHECKPOINT,
1221
+ bagWindow: TRANSITION_JOURNAL_BAG_WINDOW,
1211
1222
  depth: TRANSITION_JOURNAL_DEPTH,
1212
1223
  parked: PARKED_ITEMS,
1213
1224
  capture: WIP_CAPTURE
@@ -1216,6 +1227,7 @@ function beginRootRender(owner) {
1216
1227
  TRANSITION_JOURNAL = transaction.log;
1217
1228
  TRANSITION_JOURNAL_BAGS = transaction.bags;
1218
1229
  TRANSITION_JOURNAL_CHECKPOINT = 0;
1230
+ TRANSITION_JOURNAL_BAG_WINDOW = transaction.bagWindow;
1219
1231
  TRANSITION_JOURNAL_DEPTH = 1;
1220
1232
  PARKED_ITEMS = transaction.parked;
1221
1233
  WIP_CAPTURE = transaction.capture;
@@ -1228,6 +1240,7 @@ function endRootRender(frame) {
1228
1240
  TRANSITION_JOURNAL = frame.log;
1229
1241
  TRANSITION_JOURNAL_BAGS = frame.bags;
1230
1242
  TRANSITION_JOURNAL_CHECKPOINT = frame.checkpoint;
1243
+ TRANSITION_JOURNAL_BAG_WINDOW = frame.bagWindow;
1231
1244
  TRANSITION_JOURNAL_DEPTH = frame.depth;
1232
1245
  PARKED_ITEMS = frame.parked;
1233
1246
  WIP_CAPTURE = frame.capture;
@@ -1235,9 +1248,9 @@ function endRootRender(frame) {
1235
1248
  function journalUndo(undo) {
1236
1249
  TRANSITION_JOURNAL.push(JOURNAL_UNDO, undo, null, null);
1237
1250
  }
1238
- function journalRootProperty(target, key) {
1251
+ function journalRootProperty(target, key, oldValue) {
1239
1252
  if (ROOT_RENDER_TRANSACTION === null || ROOT_RENDER_ROLLBACK) return;
1240
- TRANSITION_JOURNAL.push(JOURNAL_PROP, target, key, target[key]);
1253
+ TRANSITION_JOURNAL.push(JOURNAL_PROP, target, key, oldValue);
1241
1254
  }
1242
1255
  function journalRootSlot(state, parent, before, after) {
1243
1256
  const transaction = ROOT_RENDER_TRANSACTION;
@@ -1305,7 +1318,7 @@ function retireRootBlock(block) {
1305
1318
  });
1306
1319
  }
1307
1320
  if (block.pending) {
1308
- journalRootProperty(block, "pending");
1321
+ journalRootProperty(block, "pending", block.pending);
1309
1322
  block.pending = false;
1310
1323
  }
1311
1324
  }
@@ -1342,7 +1355,7 @@ function deferRootRange(parent, first, last, cleanup, finalize) {
1342
1355
  }
1343
1356
  function deferRootUnmount(block, detachDom) {
1344
1357
  const transaction = ROOT_RENDER_TRANSACTION;
1345
- if (transaction === null || transaction.aborted || ROOT_RENDER_ROLLBACK || block.idState.renderOwner !== transaction.owner || !block.mounted || transaction.created?.has(block))
1358
+ if (transaction === null || transaction.aborted || ROOT_RENDER_ROLLBACK || block.idState.renderOwner !== transaction.owner || !block.mounted || isCreatedInRootRender(transaction, block))
1346
1359
  return false;
1347
1360
  retireRootBlock(block);
1348
1361
  const start = block.startMarker;
@@ -1389,18 +1402,24 @@ function deferRootUnmount(block, detachDom) {
1389
1402
  if (detachDom && parent !== null) for (const node of nodes) parent.removeChild(node);
1390
1403
  return true;
1391
1404
  }
1405
+ function isCreatedInRootRender(transaction, block) {
1406
+ return block.createdStamp === transaction.createdStamp;
1407
+ }
1408
+ function undoCreatedInRootRender(block, transaction) {
1409
+ const refCheckpoint = refDetachQueue.length;
1410
+ unmountBlock(
1411
+ block,
1412
+ (!transaction.hydrating || block.kind === "portal") && !transaction.retainedCreated?.has(block)
1413
+ );
1414
+ refDetachQueue.length = refCheckpoint;
1415
+ }
1392
1416
  function createdInRootRender(block) {
1393
1417
  const transaction = ROOT_RENDER_TRANSACTION;
1394
- if (transaction === null || ROOT_RENDER_ROLLBACK || transaction.created?.has(block)) return;
1395
- (transaction.created ??= /* @__PURE__ */ new Set()).add(block);
1396
- journalUndo(() => {
1397
- const checkpoint = refDetachQueue.length;
1398
- unmountBlock(
1399
- block,
1400
- (!transaction.hydrating || block.kind === "portal") && !transaction.retainedCreated?.has(block)
1401
- );
1402
- refDetachQueue.length = checkpoint;
1403
- });
1418
+ if (transaction === null || ROOT_RENDER_ROLLBACK || isCreatedInRootRender(transaction, block))
1419
+ return;
1420
+ block.createdStamp = transaction.createdStamp;
1421
+ (transaction.created ??= []).push(block);
1422
+ TRANSITION_JOURNAL.push(JOURNAL_CREATED, block, transaction, null);
1404
1423
  }
1405
1424
  function preserveRootCreatedDom(block) {
1406
1425
  if (ROOT_RENDER_TRANSACTION !== null)
@@ -1418,6 +1437,8 @@ function rollbackRootRender(transaction) {
1418
1437
  else {
1419
1438
  for (let i = transaction.log.length - 4; i >= 0; i -= 4) {
1420
1439
  if (transaction.log[i] === JOURNAL_UNDO) transaction.log[i + 1]();
1440
+ else if (transaction.log[i] === JOURNAL_CREATED)
1441
+ undoCreatedInRootRender(transaction.log[i + 1], transaction.log[i + 2]);
1421
1442
  }
1422
1443
  transaction.log.length = 0;
1423
1444
  }
@@ -1494,7 +1515,7 @@ function suspendRootRender(block, wakeable, attempt) {
1494
1515
  if (TRANSITION_SWAP_DRIVER === null || !TRANSITION_SWAP_DRIVER.holdRoot(owner, transaction, attempt)) {
1495
1516
  if (WARM_EVER && transaction.created !== null) {
1496
1517
  for (const created of transaction.created) {
1497
- if (created.parentBlock === null || !transaction.created.has(created.parentBlock))
1518
+ if (created.parentBlock === null || !isCreatedInRootRender(transaction, created.parentBlock))
1498
1519
  retainDiscardedWarmMemos(created);
1499
1520
  }
1500
1521
  }
@@ -1516,11 +1537,116 @@ function suspendRootRender(block, wakeable, attempt) {
1516
1537
  wakeable.then(ping, ping);
1517
1538
  return true;
1518
1539
  }
1540
+ const BINDING_BAG_ARITY = /* @__PURE__ */ Symbol();
1541
+ function cloneBag0(bag) {
1542
+ return { ...bag };
1543
+ }
1544
+ function cloneBag1(bag) {
1545
+ return { ...bag };
1546
+ }
1547
+ function cloneBag2(bag) {
1548
+ return { ...bag };
1549
+ }
1550
+ function cloneBag3(bag) {
1551
+ return { ...bag };
1552
+ }
1553
+ function cloneBag4(bag) {
1554
+ return { ...bag };
1555
+ }
1556
+ function cloneBag5(bag) {
1557
+ return { ...bag };
1558
+ }
1559
+ function cloneBag6(bag) {
1560
+ return { ...bag };
1561
+ }
1562
+ function cloneBag7(bag) {
1563
+ return { ...bag };
1564
+ }
1565
+ function cloneBag8(bag) {
1566
+ return { ...bag };
1567
+ }
1568
+ function cloneBag9(bag) {
1569
+ return { ...bag };
1570
+ }
1571
+ function cloneBag10(bag) {
1572
+ return { ...bag };
1573
+ }
1574
+ function cloneBag11(bag) {
1575
+ return { ...bag };
1576
+ }
1577
+ function cloneBag12(bag) {
1578
+ return { ...bag };
1579
+ }
1580
+ function cloneBag13(bag) {
1581
+ return { ...bag };
1582
+ }
1583
+ function cloneBag14(bag) {
1584
+ return { ...bag };
1585
+ }
1586
+ function cloneBag15(bag) {
1587
+ return { ...bag };
1588
+ }
1589
+ function cloneBag16(bag) {
1590
+ return { ...bag };
1591
+ }
1592
+ function cloneBindingBag(bag, arity) {
1593
+ switch (arity) {
1594
+ case 0:
1595
+ return cloneBag0(bag);
1596
+ case 1:
1597
+ return cloneBag1(bag);
1598
+ case 2:
1599
+ return cloneBag2(bag);
1600
+ case 3:
1601
+ return cloneBag3(bag);
1602
+ case 4:
1603
+ return cloneBag4(bag);
1604
+ case 5:
1605
+ return cloneBag5(bag);
1606
+ case 6:
1607
+ return cloneBag6(bag);
1608
+ case 7:
1609
+ return cloneBag7(bag);
1610
+ case 8:
1611
+ return cloneBag8(bag);
1612
+ case 9:
1613
+ return cloneBag9(bag);
1614
+ case 10:
1615
+ return cloneBag10(bag);
1616
+ case 11:
1617
+ return cloneBag11(bag);
1618
+ case 12:
1619
+ return cloneBag12(bag);
1620
+ case 13:
1621
+ return cloneBag13(bag);
1622
+ case 14:
1623
+ return cloneBag14(bag);
1624
+ case 15:
1625
+ return cloneBag15(bag);
1626
+ case 16:
1627
+ return cloneBag16(bag);
1628
+ default:
1629
+ return { ...bag };
1630
+ }
1631
+ }
1519
1632
  function journalBag() {
1520
1633
  const scope = CURRENT_SCOPE;
1521
1634
  if (scope === null) return;
1635
+ const transaction = ROOT_RENDER_TRANSACTION;
1636
+ if (transaction !== null && !transaction.hydrating && transaction.retainedCreated === null && TRANSITION_JOURNAL_DEPTH === 1 && scope.block.createdStamp === transaction.createdStamp)
1637
+ return;
1522
1638
  const bag = scope.slots[0];
1523
- if (bag === null || typeof bag !== "object" || bag.__kind !== void 0) return;
1639
+ if (bag === null || typeof bag !== "object") return;
1640
+ const arity = bag[BINDING_BAG_ARITY];
1641
+ if (arity !== void 0) {
1642
+ const window2 = TRANSITION_JOURNAL_BAG_WINDOW;
1643
+ if (bag.__journalWindow === window2) return;
1644
+ const snapshot = cloneBindingBag(bag, arity);
1645
+ TRANSITION_JOURNAL.push(JOURNAL_BAG, bag, snapshot, null);
1646
+ bag.__journalWindow = window2;
1647
+ return;
1648
+ }
1649
+ if (bag.__kind !== void 0) return;
1524
1650
  journalObjectOnce(bag);
1525
1651
  }
1526
1652
  function journalObjectOnce(obj) {
@@ -1581,10 +1707,31 @@ function journalControlledOption(option, withDefault) {
1581
1707
  TRANSITION_JOURNAL.push(JOURNAL_PROP, option, "defaultSelected", option.defaultSelected);
1582
1708
  }
1583
1709
  let PARKED_ITEMS = null;
1584
- function parkItemForHold(block) {
1585
- const nodes = [];
1710
+ function retainedForSlotNodes(state, retained) {
1711
+ const parked = PARKED_ITEMS;
1712
+ if (parked !== null) {
1713
+ for (const item of parked) {
1714
+ const previous = item.block;
1715
+ if (previous.forSlot !== state && !(previous.exclusiveMarkers && previous.startMarker === state.start && previous.endMarker === state.end))
1716
+ continue;
1717
+ for (const node of item.nodes) (retained ??= /* @__PURE__ */ new Set()).add(node);
1718
+ }
1719
+ }
1720
+ const retired = ROOT_RENDER_TRANSACTION.retired;
1721
+ if (retired !== null) {
1722
+ for (const row of retired) {
1723
+ if (row.forSlot !== state) continue;
1724
+ const start = row.startMarker;
1725
+ if (start !== null && start === row.endMarker) (retained ??= /* @__PURE__ */ new Set()).add(start);
1726
+ }
1727
+ }
1728
+ return retained;
1729
+ }
1730
+ function parkItemForHold(block, owningList) {
1586
1731
  const retainConnected = ROOT_RENDER_TRANSACTION !== null && !ROOT_RENDER_ROLLBACK;
1587
1732
  if (retainConnected) retireRootBlock(block);
1733
+ const excluded = owningList !== void 0 && retainConnected ? retainedForSlotNodes(owningList, null) : null;
1734
+ const nodes = [];
1588
1735
  const start = block.startMarker;
1589
1736
  const end = block.endMarker;
1590
1737
  if (start && end) {
@@ -1593,11 +1740,22 @@ function parkItemForHold(block) {
1593
1740
  const exclusive = block.exclusiveMarkers;
1594
1741
  let n = exclusive ? start.nextSibling : start;
1595
1742
  const stop = exclusive ? end : end.nextSibling;
1596
- while (n !== null && n !== stop) {
1597
- const next = getNextSibling(n);
1598
- if (!retainConnected) parent.removeChild(n);
1599
- nodes.push(n);
1600
- n = next;
1743
+ if (excluded === null) {
1744
+ while (n !== null && n !== stop) {
1745
+ const next = getNextSibling(n);
1746
+ if (!retainConnected) parent.removeChild(n);
1747
+ nodes.push(n);
1748
+ n = next;
1749
+ }
1750
+ } else {
1751
+ while (n !== null && n !== stop) {
1752
+ const next = getNextSibling(n);
1753
+ if (!excluded.has(n)) {
1754
+ if (!retainConnected) parent.removeChild(n);
1755
+ nodes.push(n);
1756
+ }
1757
+ n = next;
1758
+ }
1601
1759
  }
1602
1760
  }
1603
1761
  }
@@ -1622,14 +1780,19 @@ function journalForSlot(state) {
1622
1780
  }
1623
1781
  const chain = [];
1624
1782
  for (let b = state.head; b !== null; b = b.nextSibling) {
1625
- chain.push([b, b.nextSibling, b.prevSibling]);
1783
+ chain.push(b);
1784
+ }
1785
+ let mapOrder = null;
1786
+ let index = 0;
1787
+ for (const block of state.items.values()) {
1788
+ if (mapOrder === null && chain[index] !== block) mapOrder = chain.slice(0, index);
1789
+ mapOrder?.push(block);
1790
+ index++;
1626
1791
  }
1792
+ if (mapOrder === null && index !== chain.length) mapOrder = chain.slice(0, index);
1627
1793
  const snapshot = {
1628
- head: state.head,
1629
- tail: state.tail,
1630
- size: state.size,
1631
1794
  empty: state.emptyBlock,
1632
- entries: [...state.items]
1795
+ mapOrder
1633
1796
  };
1634
1797
  journalUndo(() => {
1635
1798
  restoreForSlot(state, snapshot, chain);
@@ -1655,31 +1818,36 @@ function journalForOwnedListClear(state) {
1655
1818
  }
1656
1819
  function restoreForSlot(state, snapshot, chain) {
1657
1820
  const preservedMap = chain === null ? snapshot.entries : null;
1658
- const kept = chain === null ? null : /* @__PURE__ */ new Set();
1659
- if (chain !== null) for (let i = 0; i < chain.length; i++) kept.add(chain[i][0]);
1821
+ const kept = chain === null ? null : new Set(chain);
1660
1822
  for (let b = state.head; b !== null; b = b.nextSibling) {
1661
1823
  if (preservedMap !== null || !kept.has(b)) unmountBlock(b, false);
1662
1824
  }
1663
1825
  if (state.end.parentNode === null) return;
1664
- state.head = snapshot.head;
1665
- state.tail = snapshot.tail;
1666
- state.size = snapshot.size;
1826
+ state.head = chain === null ? snapshot.head : chain[0] ?? null;
1827
+ state.tail = chain === null ? snapshot.tail : chain[chain.length - 1] ?? null;
1828
+ state.size = chain === null ? snapshot.size : chain.length;
1667
1829
  if (preservedMap !== null) state.items = preservedMap;
1668
1830
  else {
1669
1831
  const originalChain = chain;
1670
1832
  state.items.clear();
1671
- for (let i = 0; i < snapshot.entries.length; i++) {
1672
- state.items.set(snapshot.entries[i][0], snapshot.entries[i][1]);
1673
- }
1674
1833
  for (let i = 0; i < originalChain.length; i++) {
1675
- originalChain[i][0].nextSibling = originalChain[i][1];
1676
- originalChain[i][0].prevSibling = originalChain[i][2];
1834
+ const block = originalChain[i];
1835
+ block.nextSibling = originalChain[i + 1] ?? null;
1836
+ block.prevSibling = originalChain[i - 1] ?? null;
1837
+ }
1838
+ const keyOrder = snapshot.mapOrder ?? originalChain;
1839
+ for (let i = 0; i < keyOrder.length; i++) {
1840
+ const block = keyOrder[i];
1841
+ state.items.set(block.key, block);
1677
1842
  }
1678
1843
  }
1679
1844
  const nodes = [];
1680
1845
  for (let b = state.head; b !== null; b = b.nextSibling) {
1681
- const range = takeParkedItem(b) ?? collectBlockRange(b);
1682
- for (const node of range) nodes.push(node);
1846
+ const parked = takeParkedItem(b);
1847
+ if (parked !== null) for (const node of parked) nodes.push(node);
1848
+ else if (b.startMarker !== null && b.startMarker === b.endMarker) {
1849
+ nodes.push(b.startMarker);
1850
+ } else for (const node of collectBlockRange(b)) nodes.push(node);
1683
1851
  }
1684
1852
  if (state.emptyBlock !== snapshot.empty) {
1685
1853
  if (state.emptyBlock !== null) unmountBlock(state.emptyBlock, false);
@@ -1692,6 +1860,7 @@ function restoreForSlot(state, snapshot, chain) {
1692
1860
  }
1693
1861
  const parent = state.end.parentNode;
1694
1862
  const keptNodes = new Set(nodes);
1863
+ if (ROOT_RENDER_TRANSACTION !== null) retainedForSlotNodes(state, keptNodes);
1695
1864
  let current = state.start.nextSibling;
1696
1865
  while (current !== null && current !== state.end) {
1697
1866
  const next = current.nextSibling;
@@ -1748,13 +1917,16 @@ function armTransitionJournal(state) {
1748
1917
  TRANSITION_JOURNAL ??= [];
1749
1918
  TRANSITION_JOURNAL_BAGS ??= /* @__PURE__ */ new Map();
1750
1919
  TRANSITION_JOURNAL_WINDOWS.push(TRANSITION_JOURNAL_CHECKPOINT);
1920
+ TRANSITION_JOURNAL_BAG_WINDOWS.push(TRANSITION_JOURNAL_BAG_WINDOW);
1751
1921
  TRANSITION_JOURNAL_CHECKPOINT = TRANSITION_JOURNAL.length;
1922
+ TRANSITION_JOURNAL_BAG_WINDOW = ++NEXT_TRANSITION_JOURNAL_BAG_WINDOW;
1752
1923
  TRANSITION_JOURNAL_DEPTH++;
1753
1924
  return TRANSITION_JOURNAL.length;
1754
1925
  }
1755
1926
  function disarmTransitionJournal(checkpoint) {
1756
1927
  if (checkpoint < 0) return;
1757
1928
  TRANSITION_JOURNAL_CHECKPOINT = TRANSITION_JOURNAL_WINDOWS.pop();
1929
+ TRANSITION_JOURNAL_BAG_WINDOW = TRANSITION_JOURNAL_BAG_WINDOWS.pop();
1758
1930
  if (--TRANSITION_JOURNAL_DEPTH === 0) {
1759
1931
  TRANSITION_JOURNAL = null;
1760
1932
  TRANSITION_JOURNAL_BAGS = null;
@@ -1793,6 +1965,9 @@ function rollbackTransitionJournal(checkpoint, owner) {
1793
1965
  case JOURNAL_PROP:
1794
1966
  target[a] = b;
1795
1967
  break;
1968
+ case JOURNAL_CREATED:
1969
+ undoCreatedInRootRender(target, a);
1970
+ break;
1796
1971
  case JOURNAL_RENDER:
1797
1972
  if (!target.disposed && (target === owner || blockIsAncestorOf(owner, target))) {
1798
1973
  invalidateRender(target, owner);
@@ -3056,7 +3231,7 @@ function replaceRef(scope, previous, next, target) {
3056
3231
  if (TRANSITION_JOURNAL !== null) {
3057
3232
  journalBag();
3058
3233
  if (Object.prototype.hasOwnProperty.call(target, "_currentRef"))
3059
- journalRootProperty(target, "_currentRef");
3234
+ journalRootProperty(target, "_currentRef", target._currentRef);
3060
3235
  }
3061
3236
  if (previous != null) queueRefDetach(previous, target);
3062
3237
  if (next != null) queueRefAttach(scope, next, target);
@@ -3376,8 +3551,17 @@ function blockIsAncestorOf(anc, node) {
3376
3551
  }
3377
3552
  function comparePostOrder(aBlock, aSeq, bBlock, bSeq) {
3378
3553
  if (aBlock !== bBlock && aBlock !== null && bBlock !== null) {
3379
- if (blockIsAncestorOf(aBlock, bBlock)) return 1;
3380
- if (blockIsAncestorOf(bBlock, aBlock)) return -1;
3554
+ const aParent = aBlock.parentBlock;
3555
+ const bParent = bBlock.parentBlock;
3556
+ if (aParent === bBlock) return -1;
3557
+ if (bParent === aBlock) return 1;
3558
+ if (aParent === bParent) return aSeq - bSeq;
3559
+ for (let b = bParent; b !== null; b = b.parentBlock) {
3560
+ if (b === aBlock) return 1;
3561
+ }
3562
+ for (let a = aParent; a !== null; a = a.parentBlock) {
3563
+ if (a === bBlock) return -1;
3564
+ }
3381
3565
  }
3382
3566
  return aSeq - bSeq;
3383
3567
  }
@@ -3467,6 +3651,7 @@ function runEffectBody(e) {
3467
3651
  }
3468
3652
  function nativeEffectPublicationCurrent(entry, slot) {
3469
3653
  if (NATIVE_READ_DRIVER?.publicationCurrent(entry) !== false) return true;
3654
+ if (ROOT_RENDER_TRANSACTION !== null) journalObjectOnce(slot);
3470
3655
  slot.deps = void 0;
3471
3656
  slot.active = slot.connectedFn !== null;
3472
3657
  invalidateRender(entry.scope.block, entry.scope.block);
@@ -3633,86 +3818,6 @@ function schedulePostPaint(cb) {
3633
3818
  }
3634
3819
  }
3635
3820
  class BlockImpl {
3636
- // Hot fields first (touched by every renderBlock / reconcile iteration).
3637
- body;
3638
- props;
3639
- extra;
3640
- outputHandler;
3641
- memoInChain;
3642
- parentNode;
3643
- parentBlock;
3644
- idState;
3645
- startMarker;
3646
- endMarker;
3647
- exclusiveMarkers;
3648
- itemIndex;
3649
- // Scheduler / lifecycle.
3650
- pending;
3651
- disposed;
3652
- mounted;
3653
- renderStatus;
3654
- pendingMode;
3655
- currentRenderMode;
3656
- pendingDeferred;
3657
- currentRenderDeferred;
3658
- inactive;
3659
- // Hooks + cleanups (per-block state).
3660
- hooks;
3661
- cleanups;
3662
- effectSlots;
3663
- children;
3664
- _slots;
3665
- refFields;
3666
- $$ctxValues;
3667
- // Contexts whose value this block's subtree consumes — stamped on this block
3668
- // AND its memo ancestors by useContextInternal. The TRANSITIVE signal: a
3669
- // changed version here means "a consumer somewhere at/below me needs the new
3670
- // value", so the memo bailout descends rather than skipping.
3671
- $$ctxReads;
3672
- // Contexts this block's OWN render directly read (its own body, or an inline
3673
- // lite descendant that shares this block). The DIRECT signal: a changed
3674
- // version here means THIS block must re-run; if only $$ctxReads changed, the
3675
- // block can bail its body and refresh just its consuming child blocks.
3676
- $$ctxDirect;
3677
- // Resolved-provider cache for `use(ctx)` — see Scope.$$ctxCache.
3678
- $$ctxCache;
3679
- // Armed for React's IMPLICIT same-element bailout (beginWork's
3680
- // oldProps === newProps skip). Set at value-position component mounts
3681
- // (childSlot) — the only sites that can receive a cached descriptor back.
3682
- // Arming makes the block a stamping target (like __memo) so the bail's lazy
3683
- // consumer refresh has the context deps it needs.
3684
- $$implicitBail;
3685
- // __thenableIdx is reset every renderBlock so pre-init costs nothing.
3686
- __thenableIdx;
3687
- // Render-loop guard bookkeeping (see the Block interface).
3688
- drainStamp;
3689
- drainRenders;
3690
- crossRenderUpdate;
3691
- nestedUpdateChain;
3692
- nestedUpdateCount;
3693
- nestedUpdateError;
3694
- effectEventRenderVersion;
3695
- effectEventCompletedVersion;
3696
- // De-opt host node managed by this Block (deoptItemBody / hostElementBody), reused
3697
- // across renders. Null for all other blocks; declared so the shape stays monomorphic.
3698
- deoptNode;
3699
- // A de-opt descriptor with a `ref` was stamped in this subtree (see Block).
3700
- deoptRefs;
3701
- // Per-scope dense slot array (binding bag + control-flow/component/child slots),
3702
- // indexed by compile-time slot index. Keeps the scope shape monomorphic.
3703
- slots;
3704
- // For-block item bookkeeping.
3705
- forSlot;
3706
- prevSibling;
3707
- nextSibling;
3708
- key;
3709
- // ViewTransition boundary props (null on every other block — see Block).
3710
- vt;
3711
- // Scope contract: a Block is its own scope.
3712
- parent;
3713
- block;
3714
- // Metadata.
3715
- kind;
3716
3821
  constructor(kind, parentBlock, parentNode, startMarker, endMarker, body, props, extra, outputHandler) {
3717
3822
  this.body = body;
3718
3823
  this.props = props;
@@ -3766,24 +3871,19 @@ class BlockImpl {
3766
3871
  this.parent = null;
3767
3872
  this.block = this;
3768
3873
  this.kind = kind;
3874
+ this.createdStamp = 0;
3875
+ this.__warmEpisode = void 0;
3876
+ this.__thenableDone = void 0;
3877
+ this.__thenables = void 0;
3878
+ this.$$tryHandler = void 0;
3879
+ this.__suspenseHandler = void 0;
3880
+ this.__trySlot = void 0;
3881
+ this.__activitySlot = void 0;
3882
+ this.__warmCache = void 0;
3883
+ this.__warmCacheEpisode = void 0;
3769
3884
  }
3770
3885
  }
3771
3886
  class ScopeImpl {
3772
- block;
3773
- parent;
3774
- hooks;
3775
- cleanups;
3776
- effectSlots;
3777
- children;
3778
- _slots;
3779
- refFields;
3780
- $$ctxValues;
3781
- $$ctxReads;
3782
- $$ctxCache;
3783
- mounted;
3784
- // Per-scope dense slot array (binding bag + control-flow/component/child slots),
3785
- // indexed by compile-time slot index. Keeps the scope shape monomorphic.
3786
- slots;
3787
3887
  constructor(parent, block) {
3788
3888
  this.block = block;
3789
3889
  this.parent = parent;
@@ -3793,11 +3893,11 @@ class ScopeImpl {
3793
3893
  this.children = null;
3794
3894
  this._slots = null;
3795
3895
  this.refFields = null;
3796
- this.slots = [];
3797
3896
  this.$$ctxValues = null;
3798
3897
  this.$$ctxReads = null;
3799
3898
  this.$$ctxCache = null;
3800
3899
  this.mounted = false;
3900
+ this.slots = [];
3801
3901
  }
3802
3902
  }
3803
3903
  function createBlock(kind, parentBlock, parentNode, startMarker, endMarker, body, props, extra, outputHandler = null) {
@@ -4202,7 +4302,7 @@ function disposeReturnSlot(block, state) {
4202
4302
  if (state.forSlot.emptyBlock !== null) retireRootBlock(state.forSlot.emptyBlock);
4203
4303
  }
4204
4304
  deferRootRange(parent, first, last, () => unmountSlot(state, false));
4205
- journalRootProperty(block.slots, "0");
4305
+ journalRootProperty(block.slots, 0, block.slots[0]);
4206
4306
  const registry = block._slots;
4207
4307
  if (registry !== null) {
4208
4308
  const index = registry.indexOf(state);
@@ -4245,11 +4345,6 @@ function disposeReturnSlot(block, state) {
4245
4345
  block.slots[0] = void 0;
4246
4346
  }
4247
4347
  class LiteBlockImpl {
4248
- parentNode;
4249
- endMarker;
4250
- parentBlock;
4251
- $$ctxValues;
4252
- idState;
4253
4348
  constructor(parentNode, endMarker, parentBlock) {
4254
4349
  this.parentNode = parentNode;
4255
4350
  this.endMarker = endMarker;
@@ -4394,7 +4489,7 @@ function unmountBlockInner(block, detachDom) {
4394
4489
  function registerSlot(scope, slot) {
4395
4490
  const slots = scope._slots;
4396
4491
  const transaction = ROOT_RENDER_TRANSACTION;
4397
- if (transaction !== null && scope.mounted && !transaction.created?.has(scope.block)) {
4492
+ if (transaction !== null && scope.mounted && !isCreatedInRootRender(transaction, scope.block)) {
4398
4493
  journalUndo(() => {
4399
4494
  unmountSlot(slot, true);
4400
4495
  const index = scope.slots.indexOf(slot);
@@ -5105,9 +5200,9 @@ function finishEffectRender(scope) {
5105
5200
  for (let i = 0; i < effects.length; i++) {
5106
5201
  const effect = effects[i];
5107
5202
  if (effect.renderVersion === CURRENT_EFFECT_RENDER_VERSION) continue;
5108
- if (ROOT_RENDER_TRANSACTION !== null) journalObjectOnce(effect);
5109
5203
  if (effect.phase === INSERTION) invalidateInsertionReplay(effect);
5110
5204
  if (!effect.active) continue;
5205
+ if (ROOT_RENDER_TRANSACTION !== null) journalObjectOnce(effect);
5111
5206
  effect.deps = void 0;
5112
5207
  effect.active = false;
5113
5208
  const revision = ++effect.revision;
@@ -8572,55 +8667,55 @@ function commitBag(scope, root, bag) {
8572
8667
  return bag;
8573
8668
  }
8574
8669
  function bag0(s, r) {
8575
- return commitBag(s, r, {});
8670
+ return commitBag(s, r, { __journalWindow: 0, [BINDING_BAG_ARITY]: 0 });
8576
8671
  }
8577
8672
  function bag1(s, r, a) {
8578
- return commitBag(s, r, { a });
8673
+ return commitBag(s, r, { a, __journalWindow: 0, [BINDING_BAG_ARITY]: 1 });
8579
8674
  }
8580
8675
  function bag2(s, r, a, b) {
8581
- return commitBag(s, r, { a, b });
8676
+ return commitBag(s, r, { a, b, __journalWindow: 0, [BINDING_BAG_ARITY]: 2 });
8582
8677
  }
8583
8678
  function bag3(s, r, a, b, c) {
8584
- return commitBag(s, r, { a, b, c });
8679
+ return commitBag(s, r, { a, b, c, __journalWindow: 0, [BINDING_BAG_ARITY]: 3 });
8585
8680
  }
8586
8681
  function bag4(s, r, a, b, c, d) {
8587
- return commitBag(s, r, { a, b, c, d });
8682
+ return commitBag(s, r, { a, b, c, d, __journalWindow: 0, [BINDING_BAG_ARITY]: 4 });
8588
8683
  }
8589
8684
  function bag5(s, r, a, b, c, d, e) {
8590
- return commitBag(s, r, { a, b, c, d, e });
8685
+ return commitBag(s, r, { a, b, c, d, e, __journalWindow: 0, [BINDING_BAG_ARITY]: 5 });
8591
8686
  }
8592
8687
  function bag6(s, r, a, b, c, d, e, f) {
8593
- return commitBag(s, r, { a, b, c, d, e, f });
8688
+ return commitBag(s, r, { a, b, c, d, e, f, __journalWindow: 0, [BINDING_BAG_ARITY]: 6 });
8594
8689
  }
8595
8690
  function bag7(s, r, a, b, c, d, e, f, g) {
8596
- return commitBag(s, r, { a, b, c, d, e, f, g });
8691
+ return commitBag(s, r, { a, b, c, d, e, f, g, __journalWindow: 0, [BINDING_BAG_ARITY]: 7 });
8597
8692
  }
8598
8693
  function bag8(s, r, a, b, c, d, e, f, g, h) {
8599
- return commitBag(s, r, { a, b, c, d, e, f, g, h });
8694
+ return commitBag(s, r, { a, b, c, d, e, f, g, h, __journalWindow: 0, [BINDING_BAG_ARITY]: 8 });
8600
8695
  }
8601
8696
  function bag9(s, r, a, b, c, d, e, f, g, h, i) {
8602
- return commitBag(s, r, { a, b, c, d, e, f, g, h, i });
8697
+ return commitBag(s, r, { a, b, c, d, e, f, g, h, i, __journalWindow: 0, [BINDING_BAG_ARITY]: 9 });
8603
8698
  }
8604
8699
  function bag10(s, r, a, b, c, d, e, f, g, h, i, j) {
8605
- return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j });
8700
+ return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, __journalWindow: 0, [BINDING_BAG_ARITY]: 10 });
8606
8701
  }
8607
8702
  function bag11(s, r, a, b, c, d, e, f, g, h, i, j, k) {
8608
- return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k });
8703
+ return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, __journalWindow: 0, [BINDING_BAG_ARITY]: 11 });
8609
8704
  }
8610
8705
  function bag12(s, r, a, b, c, d, e, f, g, h, i, j, k, l) {
8611
- return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l });
8706
+ return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l, __journalWindow: 0, [BINDING_BAG_ARITY]: 12 });
8612
8707
  }
8613
8708
  function bag13(s, r, a, b, c, d, e, f, g, h, i, j, k, l, m) {
8614
- return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l, m });
8709
+ return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l, m, __journalWindow: 0, [BINDING_BAG_ARITY]: 13 });
8615
8710
  }
8616
8711
  function bag14(s, r, a, b, c, d, e, f, g, h, i, j, k, l, m, n) {
8617
- return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l, m, n });
8712
+ return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l, m, n, __journalWindow: 0, [BINDING_BAG_ARITY]: 14 });
8618
8713
  }
8619
8714
  function bag15(s, r, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) {
8620
- return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o });
8715
+ return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, __journalWindow: 0, [BINDING_BAG_ARITY]: 15 });
8621
8716
  }
8622
8717
  function bag16(s, r, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
8623
- return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p });
8718
+ return commitBag(s, r, { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, __journalWindow: 0, [BINDING_BAG_ARITY]: 16 });
8624
8719
  }
8625
8720
  function bagOf(s, r, bag) {
8626
8721
  return commitBag(s, r, bag);
@@ -8779,6 +8874,16 @@ function setClassAttrIfChanged(value, previous, el) {
8779
8874
  setClassAttr(el, value);
8780
8875
  return value;
8781
8876
  }
8877
+ function updateFreshClassName(value, previous, el) {
8878
+ const next = normalizeClass(value);
8879
+ if (previous !== next) setClassName(el, next);
8880
+ return next;
8881
+ }
8882
+ function updateFreshClassAttr(value, previous, el) {
8883
+ const next = normalizeClass(value);
8884
+ if (previous !== next) setClassAttr(el, next);
8885
+ return next;
8886
+ }
8782
8887
  function setScriptText(el, value) {
8783
8888
  const text = value == null ? "" : String(value);
8784
8889
  const first = el.firstChild;
@@ -8854,7 +8959,7 @@ function validateDangerouslySetInnerHTMLValue(value) {
8854
8959
  }
8855
8960
  function setDangerouslySetInnerHTML(el, value) {
8856
8961
  validateDangerouslySetInnerHTMLValue(value);
8857
- journalRootProperty(el, DANGER_HTML_ACTIVE);
8962
+ journalRootProperty(el, DANGER_HTML_ACTIVE, el[DANGER_HTML_ACTIVE]);
8858
8963
  const wasActive = el[DANGER_HTML_ACTIVE] === true;
8859
8964
  if (value == null) {
8860
8965
  el[DANGER_HTML_ACTIVE] = false;
@@ -8913,9 +9018,9 @@ function setDangerouslySetInnerHTMLSources(el, sources, ignoreSourceChildren = f
8913
9018
  if (hasOwnProp.call(el, DANGER_HTML_RESOLVED_VALUE) && Object.is(el[DANGER_HTML_RESOLVED_VALUE], resolved) && Object.is(el[DANGER_HTML_RESOLVED_CHILD], resolvedChild)) {
8914
9019
  return;
8915
9020
  }
8916
- journalRootProperty(el, DANGER_HTML_SPREAD_CHILD);
8917
- journalRootProperty(el, DANGER_HTML_RESOLVED_VALUE);
8918
- journalRootProperty(el, DANGER_HTML_RESOLVED_CHILD);
9021
+ journalRootProperty(el, DANGER_HTML_SPREAD_CHILD, el[DANGER_HTML_SPREAD_CHILD]);
9022
+ journalRootProperty(el, DANGER_HTML_RESOLVED_VALUE, el[DANGER_HTML_RESOLVED_VALUE]);
9023
+ journalRootProperty(el, DANGER_HTML_RESOLVED_CHILD, el[DANGER_HTML_RESOLVED_CHILD]);
8919
9024
  el[DANGER_HTML_SPREAD_CHILD] = resolvedChild;
8920
9025
  setDangerouslySetInnerHTML(el, resolved);
8921
9026
  el[DANGER_HTML_RESOLVED_VALUE] = resolved;
@@ -10240,15 +10345,42 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
10240
10345
  if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, mountScope);
10241
10346
  }
10242
10347
  const _injectedStyles = /* @__PURE__ */ new Set();
10243
- function removeHeadEventListeners(state, attrs) {
10348
+ function journalHeadEventListeners(state) {
10349
+ const before = state.handlers === void 0 ? null : new Map(state.handlers);
10350
+ journalUndo(() => {
10351
+ const handlers = state.handlers;
10352
+ if (handlers !== void 0) {
10353
+ for (const [name, listener] of handlers) {
10354
+ const event = eventSlot(name);
10355
+ state.el.removeEventListener(event.type, listener, event.capture);
10356
+ }
10357
+ handlers.clear();
10358
+ }
10359
+ if (before !== null) {
10360
+ const restored = handlers ?? (state.handlers = /* @__PURE__ */ new Map());
10361
+ for (const [name, listener] of before) {
10362
+ const event = eventSlot(name);
10363
+ state.el.addEventListener(event.type, listener, event.capture);
10364
+ restored.set(name, listener);
10365
+ }
10366
+ }
10367
+ });
10368
+ }
10369
+ function removeHeadEventListeners(state, attrs, journalChanges = false) {
10244
10370
  const handlers = state.handlers;
10245
- if (handlers === void 0) return;
10371
+ if (handlers === void 0) return false;
10372
+ let journaled = false;
10246
10373
  for (const [name, listener] of handlers) {
10247
10374
  if (attrs !== null && name in attrs) continue;
10375
+ if (journalChanges && !journaled) {
10376
+ journalHeadEventListeners(state);
10377
+ journaled = true;
10378
+ }
10248
10379
  const event = eventSlot(name);
10249
10380
  state.el.removeEventListener(event.type, listener, event.capture);
10250
10381
  handlers.delete(name);
10251
10382
  }
10383
+ return journaled;
10252
10384
  }
10253
10385
  function adoptServerHeadEl(head, key, tag) {
10254
10386
  const closeKey = "/" + key;
@@ -10310,7 +10442,7 @@ function headBlock(scope, slot, key, tag, attrs, text) {
10310
10442
  journalObjectOnce(state);
10311
10443
  journalBag();
10312
10444
  }
10313
- if (state.handlers !== void 0) removeHeadEventListeners(state, attrs);
10445
+ let journaledHandlers = state.handlers !== void 0 && removeHeadEventListeners(state, attrs, TRANSITION_JOURNAL !== null);
10314
10446
  const previousNames = state.attrNames;
10315
10447
  if (previousNames !== void 0) {
10316
10448
  for (let i = 0; i < previousNames.length; i++) {
@@ -10328,13 +10460,15 @@ function headBlock(scope, slot, key, tag, attrs, text) {
10328
10460
  const hs = state.handlers;
10329
10461
  const prevH = hs?.get(k);
10330
10462
  if (prevH === listener) continue;
10463
+ const nextH = typeof listener === "function" ? listener : void 0;
10464
+ if (TRANSITION_JOURNAL !== null && !journaledHandlers && (prevH !== void 0 || nextH !== void 0)) {
10465
+ journalHeadEventListeners(state);
10466
+ journaledHandlers = true;
10467
+ }
10331
10468
  if (prevH !== void 0) el.removeEventListener(ev.type, prevH, ev.capture);
10332
- if (typeof listener === "function") {
10333
- el.addEventListener(ev.type, listener, ev.capture);
10334
- (hs ?? (state.handlers = /* @__PURE__ */ new Map())).set(
10335
- k,
10336
- listener
10337
- );
10469
+ if (nextH !== void 0) {
10470
+ el.addEventListener(ev.type, nextH, ev.capture);
10471
+ (hs ?? (state.handlers = /* @__PURE__ */ new Map())).set(k, nextH);
10338
10472
  } else {
10339
10473
  hs?.delete(k);
10340
10474
  }
@@ -10447,7 +10581,7 @@ function setEventHandler(el, key, handler) {
10447
10581
  el[key] = handler;
10448
10582
  }
10449
10583
  function evt0(el, key, fn) {
10450
- const d = { [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND, fn, args: EMPTY_ARGS };
10584
+ const d = { fn, args: EMPTY_ARGS, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND };
10451
10585
  setEventHandler(el, key, d);
10452
10586
  return d;
10453
10587
  }
@@ -10457,37 +10591,30 @@ function evt0u(d, fn) {
10457
10591
  d.fn = fn;
10458
10592
  }
10459
10593
  function evt1(el, key, fn, a0) {
10460
- const d = { [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND, fn, args: [a0] };
10594
+ const d = { fn, args: 1, a0, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND };
10461
10595
  setEventHandler(el, key, d);
10462
10596
  return d;
10463
10597
  }
10464
10598
  function evt1u(d, fn, a0) {
10465
10599
  if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
10466
- if (TRANSITION_JOURNAL !== null) {
10467
- journalObjectOnce(d);
10468
- journalObjectOnce(d.args);
10469
- }
10600
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
10470
10601
  d.fn = fn;
10471
- d.args[0] = a0;
10602
+ d.a0 = a0;
10472
10603
  }
10473
10604
  function evt2(el, key, fn, a0, a1) {
10474
- const d = { [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND, fn, args: [a0, a1] };
10605
+ const d = { fn, args: 2, a0, a1, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND };
10475
10606
  setEventHandler(el, key, d);
10476
10607
  return d;
10477
10608
  }
10478
10609
  function evt2u(d, fn, a0, a1) {
10479
10610
  if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
10480
- if (TRANSITION_JOURNAL !== null) {
10481
- journalObjectOnce(d);
10482
- journalObjectOnce(d.args);
10483
- }
10611
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
10484
10612
  d.fn = fn;
10485
- const a = d.args;
10486
- a[0] = a0;
10487
- a[1] = a1;
10613
+ d.a0 = a0;
10614
+ d.a1 = a1;
10488
10615
  }
10489
10616
  function evtN(el, key, fn, args) {
10490
- const d = { [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND, fn, args };
10617
+ const d = { fn, args, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND };
10491
10618
  setEventHandler(el, key, d);
10492
10619
  return d;
10493
10620
  }
@@ -10847,11 +10974,17 @@ function preserveDispatchedBundle(bundle) {
10847
10974
  let snapshot;
10848
10975
  for (let index = 0; index < CAPTURE_SLOTS.length; index++) {
10849
10976
  if (CAPTURE_SLOTS[index] === bundle) {
10850
- CAPTURE_SLOTS[index] = snapshot ??= {
10851
- [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND,
10852
- fn: bundle.fn,
10853
- args: bundle.args.slice()
10854
- };
10977
+ if (snapshot === void 0) {
10978
+ const args = bundle.args;
10979
+ 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 } : {
10980
+ fn: bundle.fn,
10981
+ args: 2,
10982
+ a0: bundle.a0,
10983
+ a1: bundle.a1,
10984
+ [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND
10985
+ };
10986
+ }
10987
+ CAPTURE_SLOTS[index] = snapshot;
10855
10988
  }
10856
10989
  }
10857
10990
  }
@@ -10881,8 +11014,8 @@ function resolvePortalEventOwner(node) {
10881
11014
  }
10882
11015
  if (owner === void 0) return;
10883
11016
  if (ROOT_RENDER_TRANSACTION !== null) {
10884
- journalRootProperty(node, "$$portalParent");
10885
- journalRootProperty(node, "$$portalContainer");
11017
+ journalRootProperty(node, "$$portalParent", node.$$portalParent);
11018
+ journalRootProperty(node, "$$portalContainer", node.$$portalContainer);
10886
11019
  }
10887
11020
  node.$$portalParent = owner.host;
10888
11021
  node.$$portalContainer = target;
@@ -10995,18 +11128,24 @@ function fireEventSlot(slot, event) {
10995
11128
  if (isHandlerBundle(slot)) {
10996
11129
  const bundle = slot;
10997
11130
  const a = bundle.args;
10998
- switch (a.length) {
10999
- case 0:
11000
- bundle.fn();
11001
- break;
11002
- case 1:
11003
- bundle.fn(a[0]);
11004
- break;
11005
- case 2:
11006
- bundle.fn(a[0], a[1]);
11007
- break;
11008
- default:
11009
- bundle.fn.apply(null, a);
11131
+ if (typeof a !== "number") {
11132
+ switch (a.length) {
11133
+ case 0:
11134
+ bundle.fn();
11135
+ break;
11136
+ case 1:
11137
+ bundle.fn(a[0]);
11138
+ break;
11139
+ case 2:
11140
+ bundle.fn(a[0], a[1]);
11141
+ break;
11142
+ default:
11143
+ bundle.fn.apply(null, a);
11144
+ }
11145
+ } else if (a === 1) {
11146
+ bundle.fn(bundle.a0);
11147
+ } else {
11148
+ bundle.fn(bundle.a0, bundle.a1);
11010
11149
  }
11011
11150
  return;
11012
11151
  }
@@ -12240,7 +12379,7 @@ function portal(parentScope, slotKey, target, body, props, host, env, fragmentOw
12240
12379
  key
12241
12380
  );
12242
12381
  if (prev !== state) {
12243
- journalRootProperty(parentScope.slots, String(slotKey));
12382
+ journalRootProperty(parentScope.slots, slotKey, parentScope.slots[slotKey]);
12244
12383
  parentScope.slots[slotKey] = state;
12245
12384
  registerSlot(parentScope, state);
12246
12385
  }
@@ -12441,11 +12580,13 @@ function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, e
12441
12580
  }
12442
12581
  renderBlock(block);
12443
12582
  } else {
12444
- if (state.host !== host) journalRootProperty(state, "host");
12583
+ if (state.host !== host) journalRootProperty(state, "host", state.host);
12445
12584
  state.host = host;
12446
- if (state.block.body !== norm.body) journalRootProperty(state.block, "body");
12447
- if (state.block.props !== norm.props) journalRootProperty(state.block, "props");
12448
- if (state.block.extra !== env) journalRootProperty(state.block, "extra");
12585
+ if (state.block.body !== norm.body)
12586
+ journalRootProperty(state.block, "body", state.block.body);
12587
+ if (state.block.props !== norm.props)
12588
+ journalRootProperty(state.block, "props", state.block.props);
12589
+ if (state.block.extra !== env) journalRootProperty(state.block, "extra", state.block.extra);
12449
12590
  state.block.body = norm.body;
12450
12591
  state.block.props = norm.props;
12451
12592
  state.block.extra = env;
@@ -12477,7 +12618,7 @@ function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, e
12477
12618
  }
12478
12619
  function teardownPortalState(state) {
12479
12620
  const transaction = ROOT_RENDER_TRANSACTION;
12480
- if (transaction !== null && !transaction.aborted && !ROOT_RENDER_ROLLBACK && state.block?.mounted && !transaction.created?.has(state.block) && state.target !== null) {
12621
+ if (transaction !== null && !transaction.aborted && !ROOT_RENDER_ROLLBACK && state.block?.mounted && !isCreatedInRootRender(transaction, state.block) && state.target !== null) {
12481
12622
  deferRootRange(state.target, state.start, state.end, () => teardownPortalState(state));
12482
12623
  return;
12483
12624
  }
@@ -13069,13 +13210,14 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
13069
13210
  }
13070
13211
  }
13071
13212
  if ((hasKey === true || key !== void 0) && !state.keyed) {
13072
- if (!journaledSlot) journalRootProperty(state, "keyed");
13213
+ if (!journaledSlot) journalRootProperty(state, "keyed", state.keyed);
13073
13214
  state.keyed = true;
13074
13215
  }
13075
13216
  if (keyChanged) {
13076
13217
  state.currentComp = null;
13077
13218
  }
13078
- if (!journaledSlot && !Object.is(state.prevKey, nextKey)) journalRootProperty(state, "prevKey");
13219
+ if (!journaledSlot && !Object.is(state.prevKey, nextKey))
13220
+ journalRootProperty(state, "prevKey", state.prevKey);
13079
13221
  state.prevKey = nextKey;
13080
13222
  if (replacing) {
13081
13223
  const swapDriver = TRANSITION_SWAP_DRIVER;
@@ -13086,7 +13228,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
13086
13228
  const suspenseSwap = canSwapOffscreen && !transitionMode && committedSuspense;
13087
13229
  const probeOnly = suspenseSwap && !transitionMode;
13088
13230
  const rootTransaction = ROOT_RENDER_TRANSACTION;
13089
- if (rootTransaction !== null && !committedSuspense && hydration === null && state.block !== null && state.block.mounted && !rootTransaction.created?.has(state.block)) {
13231
+ if (rootTransaction !== null && !committedSuspense && hydration === null && state.block !== null && state.block.mounted && !isCreatedInRootRender(rootTransaction, state.block)) {
13090
13232
  const oldBlock = state.block;
13091
13233
  const oldStart = oldBlock.startMarker;
13092
13234
  const oldEnd = oldBlock.endMarker;
@@ -13240,7 +13382,8 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
13240
13382
  }
13241
13383
  } else if (state.block) {
13242
13384
  if (tryMemoBail(state.block, identity, props)) return;
13243
- if (state.block.props !== renderProps) journalRootProperty(state.block, "props");
13385
+ if (state.block.props !== renderProps)
13386
+ journalRootProperty(state.block, "props", state.block.props);
13244
13387
  state.block.props = renderProps;
13245
13388
  renderBlock(state.block);
13246
13389
  }
@@ -13803,7 +13946,7 @@ function renderFragmentRefDescriptor(descriptor, scope) {
13803
13946
  block.slots[1] = instance;
13804
13947
  block.refFields = ["f", "a", ""];
13805
13948
  } else if (instance._currentRef !== descriptor.ref) {
13806
- journalRootProperty(instance, "_currentRef");
13949
+ journalRootProperty(instance, "_currentRef", instance._currentRef);
13807
13950
  if (instance._currentRef != null) queueRefDetach(instance._currentRef, instance);
13808
13951
  if (descriptor.ref != null) queueRefAttach(scope, descriptor.ref, instance);
13809
13952
  instance._currentRef = descriptor.ref;
@@ -14109,8 +14252,8 @@ function deoptItemBody(item, scope) {
14109
14252
  const p = sm.parentNode;
14110
14253
  if (ROOT_RENDER_TRANSACTION !== null) {
14111
14254
  journalRootRange(p, sm.previousSibling, sm.nextSibling);
14112
- journalRootProperty(block, "startMarker");
14113
- journalRootProperty(block, "endMarker");
14255
+ journalRootProperty(block, "startMarker", block.startMarker);
14256
+ journalRootProperty(block, "endMarker", block.endMarker);
14114
14257
  }
14115
14258
  const s = document.createComment("it");
14116
14259
  const e = document.createComment("/it");
@@ -14123,7 +14266,7 @@ function deoptItemBody(item, scope) {
14123
14266
  const stale = block.deoptNode;
14124
14267
  let transfer = null;
14125
14268
  if (stale != null) {
14126
- journalRootProperty(block, "deoptNode");
14269
+ journalRootProperty(block, "deoptNode", block.deoptNode);
14127
14270
  if (scope.slots[0] === void 0 && stale.nodeType === 1 && isHostDescriptor(item) && stale.localName === item.type && stale.parentNode === block.parentNode) {
14128
14271
  transfer = stale;
14129
14272
  } else if (stale.parentNode === block.parentNode) {
@@ -14205,7 +14348,7 @@ function deoptItemBody(item, scope) {
14205
14348
  }
14206
14349
  const node = reconcileDeoptNode(prev, item, block, deoptChildNamespace(block.parentNode));
14207
14350
  if (node !== prev) {
14208
- journalRootProperty(block, "deoptNode");
14351
+ journalRootProperty(block, "deoptNode", block.deoptNode);
14209
14352
  if (prev != null && prev !== node && prev.parentNode === block.parentNode) {
14210
14353
  if (ROOT_RENDER_TRANSACTION !== null)
14211
14354
  journalRootRange(block.parentNode, prev.previousSibling, prev.nextSibling);
@@ -14233,8 +14376,8 @@ function deoptItemBody(item, scope) {
14233
14376
  block.parentNode.insertBefore(node, endM);
14234
14377
  }
14235
14378
  if (prev !== null && block.startMarker === prev) {
14236
- journalRootProperty(block, "startMarker");
14237
- journalRootProperty(block, "endMarker");
14379
+ journalRootProperty(block, "startMarker", block.startMarker);
14380
+ journalRootProperty(block, "endMarker", block.endMarker);
14238
14381
  block.startMarker = node;
14239
14382
  block.endMarker = node;
14240
14383
  }
@@ -14347,7 +14490,7 @@ function hostElementBody(d, block) {
14347
14490
  const retired = el;
14348
14491
  if (ROOT_RENDER_TRANSACTION !== null) {
14349
14492
  journalRootRange(block.parentNode, retired.previousSibling, retired.nextSibling);
14350
- journalRootProperty(block, "deoptNode");
14493
+ journalRootProperty(block, "deoptNode", block.deoptNode);
14351
14494
  }
14352
14495
  const childState = block.slots[0];
14353
14496
  if (childState !== void 0) {
@@ -14969,7 +15112,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
14969
15112
  }
14970
15113
  if (state === void 0) {
14971
15114
  const transaction = ROOT_RENDER_TRANSACTION;
14972
- if (transaction !== null && !transaction.aborted && !ROOT_RENDER_ROLLBACK && parentScope.mounted && !transaction.created?.has(parentBlock)) {
15115
+ if (transaction !== null && !transaction.aborted && !ROOT_RENDER_ROLLBACK && parentScope.mounted && !isCreatedInRootRender(transaction, parentBlock)) {
14973
15116
  journalBag();
14974
15117
  const after = ownsHost === void 0 ? anchor ?? null : null;
14975
15118
  const before = ownsHost === void 0 ? after === null ? domParent.lastChild : after.previousSibling : null;
@@ -15201,8 +15344,8 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
15201
15344
  }
15202
15345
  if (wasImplicitlyArmed && taggedChildren && comp === state.currentComp && tryImplicitBail(state.block))
15203
15346
  return;
15204
- if (state.block.body !== comp) journalRootProperty(state.block, "body");
15205
- if (state.currentComp !== comp) journalRootProperty(state, "currentComp");
15347
+ if (state.block.body !== comp) journalRootProperty(state.block, "body", state.block.body);
15348
+ if (state.currentComp !== comp) journalRootProperty(state, "currentComp", state.currentComp);
15206
15349
  state.block.body = comp;
15207
15350
  renderBlock(state.block);
15208
15351
  state.currentComp = comp;
@@ -15211,7 +15354,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
15211
15354
  if (state.block !== null && comp === state.currentComp) {
15212
15355
  if (tryMemoBail(state.block, comp, props)) return;
15213
15356
  if (props === state.block.props && tryImplicitBail(state.block)) return;
15214
- if (state.block.props !== props) journalRootProperty(state.block, "props");
15357
+ if (state.block.props !== props) journalRootProperty(state.block, "props", state.block.props);
15215
15358
  state.block.props = props;
15216
15359
  renderBlock(state.block);
15217
15360
  return;
@@ -15332,7 +15475,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
15332
15475
  const oldEnd = state.end;
15333
15476
  state.start = r.wip.start;
15334
15477
  state.end = r.wip.end;
15335
- journalRootProperty(r.wip.block, "exclusiveMarkers");
15478
+ journalRootProperty(r.wip.block, "exclusiveMarkers", r.wip.block.exclusiveMarkers);
15336
15479
  r.wip.block.exclusiveMarkers = true;
15337
15480
  replaceSharedBlockBoundary(parentBlock, oldStart, oldEnd, state.start, state.end);
15338
15481
  deferRootRange(domParent, oldStart, oldStart);
@@ -15473,7 +15616,7 @@ function childTextHole(parentScope, slotKey, domParent, value, cachedNode) {
15473
15616
  if (ROOT_RENDER_TRANSACTION !== null && state === void 0 && parentScope.mounted) {
15474
15617
  journalBag();
15475
15618
  journalRootRange(domParent, null, null);
15476
- journalRootProperty(parentScope.slots, String(slotKey));
15619
+ journalRootProperty(parentScope.slots, slotKey, parentScope.slots[slotKey]);
15477
15620
  }
15478
15621
  if (state === void 0 && vt !== "object" && vt !== "function") {
15479
15622
  const str = value == null || value === false || value === true ? "" : vt === "string" ? value : String(value);
@@ -16565,7 +16708,7 @@ function renderVisibleTry(state, source) {
16565
16708
  const journalCheckpoint = armTransitionJournal(state);
16566
16709
  const previousCapture = WIP_CAPTURE;
16567
16710
  const capture = journalCheckpoint < 0 ? null : createOffscreenCapture();
16568
- const effectDeps = capture === null ? null : snapshotSubtreeEffectDeps(block);
16711
+ const effectDeps = capture !== null && (ROOT_RENDER_TRANSACTION === null || state.propagateSuspense || (block.pendingMode ?? CURRENT_BLOCK?.currentRenderMode) !== "transition" || block.pending && block.pendingMode === "transition" && CURRENT_BLOCK !== null && CURRENT_BLOCK.currentRenderMode === "urgent" && blockIsAncestor(CURRENT_BLOCK, block) && TRANSITION_SWAP_DRIVER !== null) ? snapshotSubtreeEffectDeps(block) : null;
16569
16712
  const refDetachCheckpoint = refDetachQueue.length;
16570
16713
  let didThrow = false;
16571
16714
  let renderError;
@@ -16582,7 +16725,7 @@ function renderVisibleTry(state, source) {
16582
16725
  if (didThrow) {
16583
16726
  if (capture !== null) {
16584
16727
  refDetachQueue.splice(refDetachCheckpoint);
16585
- restoreSubtreeEffectDeps(block, effectDeps);
16728
+ if (effectDeps !== null) restoreSubtreeEffectDeps(block, effectDeps);
16586
16729
  discardOffscreenCapture(capture);
16587
16730
  }
16588
16731
  if (isHostContextRequest(renderError) || renderError instanceof NativeAdoptionMiss)
@@ -17102,6 +17245,7 @@ function invalidatePendingSuspenseEffects(owner) {
17102
17245
  if (block.disposed || block !== owner && !blockIsAncestorOf(owner, block)) continue;
17103
17246
  const effect = pending.scope.hooks?.get(pending.slot);
17104
17247
  if (effect === void 0 || effect.revision !== pending.revision) continue;
17248
+ if (ROOT_RENDER_TRANSACTION !== null) journalObjectOnce(effect);
17105
17249
  effect.revision++;
17106
17250
  effect.active = effect.connectedFn !== null;
17107
17251
  effect.deps = effect.connectedFn === null ? void 0 : effect.connectedArgs;
@@ -17143,7 +17287,7 @@ function hideTryContentAndMountPendingInner(state, resumeThenable) {
17143
17287
  const persistent = state.tryBlock;
17144
17288
  const uncommittedRefs = discardSubtreeRefAttaches(persistent);
17145
17289
  invalidatePendingSuspenseEffects(persistent);
17146
- journalRootProperty(persistent, "inactive");
17290
+ journalRootProperty(persistent, "inactive", persistent.inactive);
17147
17291
  persistent.inactive = true;
17148
17292
  const action = () => deactivateSuspensePrimary(state, persistent, uncommittedRefs);
17149
17293
  if (WIP_CAPTURE === null) effectEventCommitActions.push(action);
@@ -17514,6 +17658,7 @@ function reconnectBailedEffects(block) {
17514
17658
  const queue = context.queues[effect.phase];
17515
17659
  if (replay !== null) {
17516
17660
  const last = replay[replay.length - 1];
17661
+ if (ROOT_RENDER_TRANSACTION !== null) journalObjectOnce(effect);
17517
17662
  effect.active = last.fn !== null;
17518
17663
  effect.deps = last.fn === null ? void 0 : last.args;
17519
17664
  const revision = ++effect.revision;
@@ -18462,8 +18607,8 @@ function replaceSharedBlockBoundary(parent, oldStart, oldEnd, newStart, newEnd)
18462
18607
  if (oldStart === null || oldEnd === null) return;
18463
18608
  let block = parent;
18464
18609
  while (block !== null && block.startMarker === oldStart && block.endMarker === oldEnd) {
18465
- journalRootProperty(block, "startMarker");
18466
- journalRootProperty(block, "endMarker");
18610
+ journalRootProperty(block, "startMarker", block.startMarker);
18611
+ journalRootProperty(block, "endMarker", block.endMarker);
18467
18612
  block.startMarker = newStart;
18468
18613
  block.endMarker = newEnd;
18469
18614
  block = block.parentBlock;
@@ -18529,7 +18674,7 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
18529
18674
  }
18530
18675
  const liveEnd = provisionalAfter === null && state.start === null && state.block !== null && state.block.endMarker !== null ? state.block.endMarker : state.end;
18531
18676
  const rootTransaction = ROOT_RENDER_TRANSACTION;
18532
- if (rootTransaction !== null && !committedSuspense && hydration === null && state.block !== null && state.block.mounted && !rootTransaction.created?.has(state.block)) {
18677
+ if (rootTransaction !== null && !committedSuspense && hydration === null && state.block !== null && state.block.mounted && !isCreatedInRootRender(rootTransaction, state.block)) {
18533
18678
  const oldBlock2 = state.block;
18534
18679
  const oldStart = oldBlock2.startMarker;
18535
18680
  const oldEnd = oldBlock2.endMarker;
@@ -18590,7 +18735,7 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
18590
18735
  if (!borrowed) {
18591
18736
  replaceSharedBlockBoundary(parentBlock, oldStart, oldEnd, r.wip.start, r.wip.end);
18592
18737
  }
18593
- journalRootProperty(r.wip.block, "exclusiveMarkers");
18738
+ journalRootProperty(r.wip.block, "exclusiveMarkers", r.wip.block.exclusiveMarkers);
18594
18739
  r.wip.block.exclusiveMarkers = true;
18595
18740
  spliceWipCapture(r.wip);
18596
18741
  deferRootReplacement(oldBlock2, domParent, first, last);
@@ -18770,8 +18915,8 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
18770
18915
  replaceSharedBlockBoundary(parentBlock, oldBlockStart, oldBlockEnd, s, e);
18771
18916
  }
18772
18917
  } else if (state.block) {
18773
- if (state.block.body !== body) journalRootProperty(state.block, "body");
18774
- if (state.block.extra !== env) journalRootProperty(state.block, "extra");
18918
+ if (state.block.body !== body) journalRootProperty(state.block, "body", state.block.body);
18919
+ if (state.block.extra !== env) journalRootProperty(state.block, "extra", state.block.extra);
18775
18920
  state.block.body = body;
18776
18921
  state.block.extra = env;
18777
18922
  renderBlock(state.block);
@@ -19477,7 +19622,8 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
19477
19622
  registerSlot(parentScope, state);
19478
19623
  }
19479
19624
  const serverMarkerState = hydration?.markerState(state.start) ?? -1;
19480
- if (state.env !== deps) journalRootProperty(state, "env");
19625
+ if (ROOT_RENDER_TRANSACTION !== null && state.env !== deps)
19626
+ journalRootProperty(state, "env", state.env);
19481
19627
  state.env = deps;
19482
19628
  const isEmpty = items.length === 0;
19483
19629
  if (isEmpty && emptyBody) {
@@ -19485,8 +19631,10 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
19485
19631
  reconcileKeyed(parentBlock, state, items, getKey, itemBody, false, false);
19486
19632
  }
19487
19633
  if (state.emptyBlock) {
19488
- if (state.emptyBlock.body !== emptyBody) journalRootProperty(state.emptyBlock, "body");
19489
- if (state.emptyBlock.extra !== state.env) journalRootProperty(state.emptyBlock, "extra");
19634
+ if (state.emptyBlock.body !== emptyBody)
19635
+ journalRootProperty(state.emptyBlock, "body", state.emptyBlock.body);
19636
+ if (state.emptyBlock.extra !== state.env)
19637
+ journalRootProperty(state.emptyBlock, "extra", state.emptyBlock.extra);
19490
19638
  state.emptyBlock.body = emptyBody;
19491
19639
  state.emptyBlock.extra = state.env;
19492
19640
  renderBlock(state.emptyBlock);
@@ -19525,7 +19673,7 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
19525
19673
  if (state.emptyBlock) {
19526
19674
  if (itemRemovalDefers()) {
19527
19675
  journalForSlot(state);
19528
- parkItemForHold(state.emptyBlock);
19676
+ parkItemForHold(state.emptyBlock, state);
19529
19677
  } else unmountBlock(state.emptyBlock);
19530
19678
  state.emptyBlock = null;
19531
19679
  }
@@ -19551,7 +19699,8 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
19551
19699
  } else {
19552
19700
  lite = !requiresScope;
19553
19701
  }
19554
- if (state.cachedDeps !== deps) journalRootProperty(state, "cachedDeps");
19702
+ if (ROOT_RENDER_TRANSACTION !== null && state.cachedDeps !== deps)
19703
+ journalRootProperty(state, "cachedDeps", state.cachedDeps);
19555
19704
  state.cachedDeps = deps;
19556
19705
  }
19557
19706
  }
@@ -19619,7 +19768,8 @@ function keyedForBlock(parentScope, slotKey, domParent, items, getKey, itemBody,
19619
19768
  );
19620
19769
  if (TRANSITION_JOURNAL === null || ROOT_RENDER_TRANSACTION !== null) {
19621
19770
  const rendered = parentScope.slots[slotKey];
19622
- if (rendered.selectionItems !== items) journalRootProperty(rendered, "selectionItems");
19771
+ if (rendered.selectionItems !== items)
19772
+ journalRootProperty(rendered, "selectionItems", rendered.selectionItems);
19623
19773
  rendered.selectionItems = items;
19624
19774
  }
19625
19775
  }
@@ -19639,14 +19789,16 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
19639
19789
  let previous = null;
19640
19790
  let current = null;
19641
19791
  if (TRANSITION_JOURNAL !== null) journalForSlot(state);
19642
- if (state.env !== deps) journalRootProperty(state, "env");
19792
+ if (ROOT_RENDER_TRANSACTION !== null && state.env !== deps)
19793
+ journalRootProperty(state, "env", state.env);
19643
19794
  state.env = deps;
19644
19795
  if (((flags || 0) & 4) !== 0 && deps !== void 0) {
19645
- if (state.cachedDeps !== deps) journalRootProperty(state, "cachedDeps");
19796
+ if (ROOT_RENDER_TRANSACTION !== null && state.cachedDeps !== deps)
19797
+ journalRootProperty(state, "cachedDeps", state.cachedDeps);
19646
19798
  state.cachedDeps = deps;
19647
19799
  }
19648
19800
  if (mapped) {
19649
- if (state.mappedNative !== true) journalRootProperty(state, "mappedNative");
19801
+ if (state.mappedNative !== true) journalRootProperty(state, "mappedNative", state.mappedNative);
19650
19802
  state.mappedNative = true;
19651
19803
  }
19652
19804
  try {
@@ -19756,7 +19908,8 @@ function fastKeyedForBlock(parentScope, slotKey, domParent, items, getKey, itemB
19756
19908
  return;
19757
19909
  }
19758
19910
  mountFastHostItems(parentScope, state, parent, items, getKey, itemBody, flags, deps, false);
19759
- if (state.selectionItems !== items) journalRootProperty(state, "selectionItems");
19911
+ if (state.selectionItems !== items)
19912
+ journalRootProperty(state, "selectionItems", state.selectionItems);
19760
19913
  state.selectionItems = items;
19761
19914
  }
19762
19915
  function fastMapSlot(scopeOrItems, slotOrMethod, domParent, items, method, native, callback, getKey, itemBody, flags, deps, anchor, ownEnd) {
@@ -19833,8 +19986,10 @@ function tryUpdateKeyedSelection(state, items, itemBody, previousDeps, deps, sel
19833
19986
  }
19834
19987
  const previous = previousDeps[selectionIndex];
19835
19988
  const next = deps[selectionIndex];
19836
- if (state.cachedDeps !== deps) journalRootProperty(state, "cachedDeps");
19837
- if (state.env !== deps) journalRootProperty(state, "env");
19989
+ if (ROOT_RENDER_TRANSACTION !== null && state.cachedDeps !== deps)
19990
+ journalRootProperty(state, "cachedDeps", state.cachedDeps);
19991
+ if (ROOT_RENDER_TRANSACTION !== null && state.env !== deps)
19992
+ journalRootProperty(state, "env", state.env);
19838
19993
  state.cachedDeps = deps;
19839
19994
  state.env = deps;
19840
19995
  if (Object.is(previous, next)) return true;
@@ -19847,8 +20002,8 @@ function tryUpdateKeyedSelection(state, items, itemBody, previousDeps, deps, sel
19847
20002
  second = swap;
19848
20003
  }
19849
20004
  if (first !== void 0) {
19850
- if (first.body !== itemBody) journalRootProperty(first, "body");
19851
- if (first.extra !== deps) journalRootProperty(first, "extra");
20005
+ if (first.body !== itemBody) journalRootProperty(first, "body", first.body);
20006
+ if (first.extra !== deps) journalRootProperty(first, "extra", first.extra);
19852
20007
  first.body = itemBody;
19853
20008
  first.extra = deps;
19854
20009
  if (selectionBody !== void 0 && first._slots === null) {
@@ -19858,8 +20013,8 @@ function tryUpdateKeyedSelection(state, items, itemBody, previousDeps, deps, sel
19858
20013
  }
19859
20014
  }
19860
20015
  if (second !== void 0) {
19861
- if (second.body !== itemBody) journalRootProperty(second, "body");
19862
- if (second.extra !== deps) journalRootProperty(second, "extra");
20016
+ if (second.body !== itemBody) journalRootProperty(second, "body", second.body);
20017
+ if (second.extra !== deps) journalRootProperty(second, "extra", second.extra);
19863
20018
  second.body = itemBody;
19864
20019
  second.extra = deps;
19865
20020
  if (selectionBody !== void 0 && second._slots === null) {
@@ -19891,14 +20046,16 @@ const MAX_KEYED_REORDER_SCRATCH = 16384;
19891
20046
  let keyedReorderSources = null;
19892
20047
  let keyedLisPredecessors = null;
19893
20048
  function updateSurvivor(block, newItem, newIdx, itemBody, pure, lite, indexIndependent, env) {
19894
- if (block.itemIndex !== newIdx) journalRootProperty(block, "itemIndex");
19895
- if (block.body !== itemBody) journalRootProperty(block, "body");
20049
+ const journal = ROOT_RENDER_TRANSACTION !== null && !ROOT_RENDER_ROLLBACK;
20050
+ if (journal && block.itemIndex !== newIdx)
20051
+ journalRootProperty(block, "itemIndex", block.itemIndex);
20052
+ if (journal && block.body !== itemBody) journalRootProperty(block, "body", block.body);
19896
20053
  if (pure && block.props === newItem && (indexIndependent || block.itemIndex === newIdx)) {
19897
20054
  block.itemIndex = newIdx;
19898
20055
  block.body = itemBody;
19899
20056
  } else {
19900
- if (block.props !== newItem) journalRootProperty(block, "props");
19901
- if (block.extra !== env) journalRootProperty(block, "extra");
20057
+ if (journal && block.props !== newItem) journalRootProperty(block, "props", block.props);
20058
+ if (journal && block.extra !== env) journalRootProperty(block, "extra", block.extra);
19902
20059
  block.props = newItem;
19903
20060
  block.body = itemBody;
19904
20061
  block.itemIndex = newIdx;
@@ -19939,7 +20096,6 @@ function mountItemsLinear(parentBlock, state, items, getKey, itemBody, singleRoo
19939
20096
  const adopt = state.adopt;
19940
20097
  let adoptIndex = 0;
19941
20098
  let prev = null;
19942
- const mounted = [];
19943
20099
  try {
19944
20100
  for (let i = 0; i < newLen; i++) {
19945
20101
  const item = items[i];
@@ -19967,7 +20123,6 @@ function mountItemsLinear(parentBlock, state, items, getKey, itemBody, singleRoo
19967
20123
  ssrMarkerless,
19968
20124
  adoptNode
19969
20125
  );
19970
- mounted.push(block);
19971
20126
  oldItems.set(key, block);
19972
20127
  block.key = key;
19973
20128
  block.prevSibling = prev;
@@ -19979,8 +20134,9 @@ function mountItemsLinear(parentBlock, state, items, getKey, itemBody, singleRoo
19979
20134
  state.tail = prev;
19980
20135
  state.size = newLen;
19981
20136
  } catch (error) {
19982
- for (let i = mounted.length - 1; i >= 0; i--) {
19983
- const block = mounted[i];
20137
+ while (prev !== null) {
20138
+ const block = prev;
20139
+ prev = block.prevSibling;
19984
20140
  oldItems.delete(block.key);
19985
20141
  if (isSuspenseException(error)) retainDiscardedWarmMemos(block);
19986
20142
  unmountBlock(block, !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block));
@@ -20362,7 +20518,7 @@ function deferRootOwnedListClear(state, certified = false) {
20362
20518
  newlyRetired.push(block);
20363
20519
  }
20364
20520
  if (block.pending) {
20365
- journalRootProperty(block, "pending");
20521
+ journalRootProperty(block, "pending", block.pending);
20366
20522
  block.pending = false;
20367
20523
  }
20368
20524
  }
@@ -21281,7 +21437,8 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
21281
21437
  const block = rootBlock;
21282
21438
  renderOwner.request = (renderMode) => {
21283
21439
  renderOwner.transaction.rootRequest = true;
21284
- if (block.props !== props) journalRootProperty(block, "props");
21440
+ const previousProps = block.props;
21441
+ if (previousProps !== props) journalRootProperty(block, "props", previousProps);
21285
21442
  block.props = props;
21286
21443
  block.pendingMode = renderMode;
21287
21444
  renderBlock(block);
@@ -21301,7 +21458,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
21301
21458
  const previousRoot = rootBlock;
21302
21459
  const previousBody = currentBody;
21303
21460
  const previousKey = currentKey;
21304
- const staged = container.nodeType !== 9 && previousRoot !== null && previousRoot.mounted && !previousRoot.disposed && !renderOwner.transaction.created?.has(previousRoot);
21461
+ const staged = container.nodeType !== 9 && previousRoot !== null && previousRoot.mounted && !previousRoot.disposed && !isCreatedInRootRender(renderOwner.transaction, previousRoot);
21305
21462
  const oldFirst = staged ? container.firstChild : null;
21306
21463
  const oldLast = staged ? container.lastChild : null;
21307
21464
  journalUndo(() => {
@@ -21645,7 +21802,7 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
21645
21802
  owner.transaction.rootRequest = true;
21646
21803
  owner.transaction.hydrating = true;
21647
21804
  createdInRootRender(rootBlock);
21648
- journalRootProperty(idState, "next");
21805
+ journalRootProperty(idState, "next", idState.next);
21649
21806
  idState.next = 0;
21650
21807
  let firstNode = container.firstChild;
21651
21808
  while (firstNode !== null && (firstNode.nodeType === 10 || isRendererHydrationStyle(firstNode)))
@@ -22290,6 +22447,8 @@ export {
22290
22447
  textHoleUpdate,
22291
22448
  textSlot,
22292
22449
  tryBlock,
22450
+ updateFreshClassAttr,
22451
+ updateFreshClassName,
22293
22452
  use,
22294
22453
  useActionState,
22295
22454
  useBatch,