sibujs 4.14.1 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/browser.cjs +297 -45
  2. package/dist/browser.js +6 -7
  3. package/dist/build.cjs +2189 -573
  4. package/dist/build.js +16 -15
  5. package/dist/cdn.dev.global.js +13 -12
  6. package/dist/cdn.full.dev.global.js +14 -13
  7. package/dist/cdn.full.global.js +12 -12
  8. package/dist/cdn.global.js +12 -12
  9. package/dist/{chunk-4XCWNGRY.js → chunk-2VKTFA7C.js} +1 -1
  10. package/dist/{chunk-YPLQQTWS.js → chunk-4AEFGRYW.js} +1 -1
  11. package/dist/{chunk-VIAVYBNQ.js → chunk-6IV5ZRG6.js} +5 -7
  12. package/dist/{chunk-KTJC7QPA.js → chunk-75EAQH3U.js} +2 -2
  13. package/dist/{chunk-LJ2LR5P4.js → chunk-7JO7DPSS.js} +4 -4
  14. package/dist/{chunk-B2NLNZ3E.js → chunk-AQH7WDSE.js} +6 -8
  15. package/dist/{chunk-S37PZD6I.js → chunk-BF3WBJJQ.js} +60 -10
  16. package/dist/{chunk-LJMX4SQ7.js → chunk-BG4BP44S.js} +3 -3
  17. package/dist/{chunk-ZYK4NZZA.js → chunk-D44TAGCT.js} +2 -2
  18. package/dist/{chunk-OPRQW4LI.js → chunk-DAEXQJQA.js} +1 -1
  19. package/dist/chunk-DNCQDFJJ.js +22 -0
  20. package/dist/{chunk-WFMMSMA5.js → chunk-DNCT2UXB.js} +4 -4
  21. package/dist/{chunk-TOV4PN3P.js → chunk-DRWOD7RZ.js} +4 -4
  22. package/dist/chunk-DS5V2PRE.js +64 -0
  23. package/dist/{chunk-L2IPKGUJ.js → chunk-EHSJESRN.js} +595 -123
  24. package/dist/{chunk-LAHX7XFG.js → chunk-GFM5WWPU.js} +252 -5
  25. package/dist/{chunk-52XFPGSN.js → chunk-HTPOIAAL.js} +1 -1
  26. package/dist/{chunk-3HEX6QJQ.js → chunk-I2R5QALY.js} +2 -4
  27. package/dist/{chunk-FCWOMATN.js → chunk-IUBV5WO5.js} +1 -1
  28. package/dist/{chunk-TZNR6E6D.js → chunk-KIDETDMU.js} +5 -7
  29. package/dist/{chunk-TS6JDK7Y.js → chunk-KPAXG5IR.js} +7 -9
  30. package/dist/{chunk-FFXZ6ELZ.js → chunk-LGUXYHTZ.js} +3 -3
  31. package/dist/{chunk-NIHGSXOX.js → chunk-LQWLPQOK.js} +6 -8
  32. package/dist/{chunk-YIXMS546.js → chunk-MINLMJUY.js} +5 -8
  33. package/dist/{chunk-OLMZF4RU.js → chunk-OURTGOJT.js} +8 -10
  34. package/dist/{chunk-55TAOW5M.js → chunk-TQ24Y3IV.js} +2 -2
  35. package/dist/{chunk-LUZXFMKH.js → chunk-UM3M5PXS.js} +8 -8
  36. package/dist/{chunk-ZKI4SDZ2.js → chunk-VSTX3XSX.js} +205 -15
  37. package/dist/{chunk-3T7TWMSD.js → chunk-XPDZ2LDR.js} +2 -2
  38. package/dist/{chunk-RBRITLFL.js → chunk-Y7JM7GY2.js} +5 -7
  39. package/dist/{chunk-LZKKMDQF.js → chunk-YAFITBOK.js} +1269 -162
  40. package/dist/data.cjs +285 -33
  41. package/dist/data.js +6 -7
  42. package/dist/devtools.cjs +289 -39
  43. package/dist/devtools.js +5 -6
  44. package/dist/{dispose-EIHHHDC7.js → dispose-3WDBYJMH.js} +3 -1
  45. package/dist/ecosystem.cjs +345 -61
  46. package/dist/ecosystem.d.cts +1 -1
  47. package/dist/ecosystem.d.ts +1 -1
  48. package/dist/ecosystem.js +10 -10
  49. package/dist/extras.cjs +525 -247
  50. package/dist/extras.d.cts +1 -1
  51. package/dist/extras.d.ts +1 -1
  52. package/dist/extras.js +27 -27
  53. package/dist/index.cjs +2134 -515
  54. package/dist/index.d.cts +628 -211
  55. package/dist/index.d.ts +628 -211
  56. package/dist/index.js +22 -15
  57. package/dist/motion.cjs +286 -30
  58. package/dist/motion.js +4 -4
  59. package/dist/patterns.cjs +301 -43
  60. package/dist/patterns.js +6 -6
  61. package/dist/performance.cjs +286 -36
  62. package/dist/performance.js +9 -9
  63. package/dist/plugins.cjs +1194 -290
  64. package/dist/plugins.d.cts +3 -1
  65. package/dist/plugins.d.ts +3 -1
  66. package/dist/plugins.js +20 -19
  67. package/dist/{renderRoute-fxgsm2Ir.d.ts → renderRoute-B84MONaO.d.cts} +2 -2
  68. package/dist/{renderRoute-DP20XwMS.d.cts → renderRoute-_yxPuEQY.d.ts} +2 -2
  69. package/dist/{routeHead-CE9SV-cH.d.cts → routeHead-DLxlq15W.d.cts} +94 -0
  70. package/dist/{routeHead-DzVxPviY.d.ts → routeHead-w8nANZ3M.d.ts} +94 -0
  71. package/dist/{ssr-HHU3DAD2.js → ssr-EF3IUHTE.js} +6 -6
  72. package/dist/ssr-dom.cjs +21 -8
  73. package/dist/ssr-dom.js +2 -1
  74. package/dist/ssr.cjs +807 -169
  75. package/dist/ssr.d.cts +5 -3
  76. package/dist/ssr.d.ts +5 -3
  77. package/dist/ssr.js +16 -15
  78. package/dist/{tagFactory-DkytnJws.d.cts → tagFactory-BfEh69VF.d.cts} +7 -0
  79. package/dist/{tagFactory-Bnd_Nph9.d.ts → tagFactory-pSYiLYyh.d.ts} +7 -0
  80. package/dist/testing.cjs +774 -131
  81. package/dist/testing.d.cts +4 -2
  82. package/dist/testing.d.ts +4 -2
  83. package/dist/testing.js +18 -17
  84. package/dist/track-core-0edROAF5.d.ts +187 -0
  85. package/dist/track-core-DN5fYLWi.d.cts +187 -0
  86. package/dist/ui.cjs +293 -43
  87. package/dist/ui.js +10 -12
  88. package/dist/widgets.cjs +285 -27
  89. package/dist/widgets.js +7 -7
  90. package/package.json +1 -1
  91. package/dist/chunk-7ZHH77QA.js +0 -9
package/dist/plugins.cjs CHANGED
@@ -751,6 +751,17 @@ var init_elementPolicy = __esm({
751
751
  }
752
752
  });
753
753
 
754
+ // src/utils/globalSingleton.ts
755
+ function globalSingleton(key, create) {
756
+ const g2 = globalThis;
757
+ return g2[key] ?? (g2[key] = create());
758
+ }
759
+ var init_globalSingleton = __esm({
760
+ "src/utils/globalSingleton.ts"() {
761
+ "use strict";
762
+ }
763
+ });
764
+
754
765
  // src/core/rendering/adoptScope.ts
755
766
  function inAdoptScope() {
756
767
  return current?.s.on === true;
@@ -889,6 +900,7 @@ __export(dispose_exports, {
889
900
  registerDisposer: () => registerDisposer,
890
901
  replaceChildrenSafely: () => replaceChildrenSafely,
891
902
  reportDrainRunaway: () => reportDrainRunaway,
903
+ stageReplaceChildren: () => stageReplaceChildren,
892
904
  unregisterDisposer: () => unregisterDisposer,
893
905
  withDisposerRollback: () => withDisposerRollback
894
906
  });
@@ -922,7 +934,7 @@ function registerDisposer(node, teardown) {
922
934
  elementDisposers.set(node, disposers);
923
935
  }
924
936
  disposers.push(teardown);
925
- if (DEV) activeBindingCount++;
937
+ if (DEV) bindings.count++;
926
938
  const capture = resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
927
939
  if (capture) capture.entries.push([node, teardown]);
928
940
  }
@@ -975,7 +987,7 @@ function unregisterDisposer(node, teardown) {
975
987
  const index = disposers.indexOf(teardown);
976
988
  if (index === -1) return false;
977
989
  disposers.splice(index, 1);
978
- if (DEV) activeBindingCount--;
990
+ if (DEV) bindings.count--;
979
991
  if (disposers.length === 0) elementDisposers.delete(node);
980
992
  return true;
981
993
  }
@@ -999,17 +1011,17 @@ function disposeNodeOwn(node) {
999
1011
  let executed = 0;
1000
1012
  let runaway = false;
1001
1013
  while (!runaway) {
1002
- const pending = elementDisposers.get(node);
1003
- if (!pending || pending.length === 0) break;
1004
- const snapshot = pending.slice();
1014
+ const pending2 = elementDisposers.get(node);
1015
+ if (!pending2 || pending2.length === 0) break;
1016
+ const snapshot = pending2.slice();
1005
1017
  elementDisposers.delete(node);
1006
- if (DEV) activeBindingCount -= snapshot.length;
1018
+ if (DEV) bindings.count -= snapshot.length;
1007
1019
  for (let i2 = 0; i2 < snapshot.length; i2++) {
1008
1020
  if (executed >= MAX_DRAIN_TEARDOWNS) {
1009
1021
  const rest = snapshot.slice(i2);
1010
1022
  const added = elementDisposers.get(node);
1011
1023
  elementDisposers.set(node, added ? rest.concat(added) : rest);
1012
- if (DEV) activeBindingCount += rest.length;
1024
+ if (DEV) bindings.count += rest.length;
1013
1025
  reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
1014
1026
  runaway = true;
1015
1027
  break;
@@ -1048,26 +1060,69 @@ function replaceChildrenSafely(parent, ...next) {
1048
1060
  }
1049
1061
  parent.replaceChildren(...next);
1050
1062
  }
1063
+ function stageReplaceChildren(parent, next) {
1064
+ const done = /* @__PURE__ */ new Set();
1065
+ const adopted = () => {
1066
+ if (!isHydrating() || next.length === 0 || next[0] !== parent.firstChild) return false;
1067
+ for (let i2 = 1; i2 < next.length; i2++) if (next[i2 - 1].nextSibling !== next[i2]) return false;
1068
+ return true;
1069
+ };
1070
+ const outgoing = () => {
1071
+ if (adopted()) {
1072
+ const out = [];
1073
+ for (let n = next[next.length - 1].nextSibling; n !== null; n = n.nextSibling) out.push(n);
1074
+ return out;
1075
+ }
1076
+ for (let i2 = 0; i2 < next.length; i2++) next[i2].parentNode?.removeChild(next[i2]);
1077
+ return Array.from(parent.childNodes);
1078
+ };
1079
+ return {
1080
+ teardown: () => {
1081
+ let ran = false;
1082
+ for (const node of outgoing()) {
1083
+ if (done.has(node)) continue;
1084
+ done.add(node);
1085
+ ran = true;
1086
+ dispose(node);
1087
+ }
1088
+ return ran;
1089
+ },
1090
+ insert: () => {
1091
+ if (!adopted()) {
1092
+ parent.replaceChildren(...next);
1093
+ return;
1094
+ }
1095
+ const last = next[next.length - 1];
1096
+ while (last.nextSibling) parent.removeChild(last.nextSibling);
1097
+ }
1098
+ };
1099
+ }
1051
1100
  function checkLeaks(warnThreshold = 0) {
1052
1101
  if (!DEV) return 0;
1053
- if (warnThreshold > 0 && activeBindingCount > warnThreshold) {
1102
+ if (warnThreshold > 0 && bindings.count > warnThreshold) {
1054
1103
  devWarn(
1055
- `checkLeaks: ${activeBindingCount} active DOM bindings detected. Expected \u2264${warnThreshold}. This may indicate a component was removed from the DOM without calling dispose().`
1104
+ `checkLeaks: ${bindings.count} active DOM bindings detected. Expected \u2264${warnThreshold}. This may indicate a component was removed from the DOM without calling dispose().`
1056
1105
  );
1057
1106
  }
1058
- return activeBindingCount;
1107
+ return bindings.count;
1059
1108
  }
1060
- var elementDisposers, MAX_DRAIN_TEARDOWNS, activeBindingCount, registrationCaptures;
1109
+ var state2, elementDisposers, MAX_DRAIN_TEARDOWNS, bindings, registrationCaptures;
1061
1110
  var init_dispose = __esm({
1062
1111
  "src/core/rendering/dispose.ts"() {
1063
1112
  "use strict";
1113
+ init_globalSingleton();
1064
1114
  init_dev();
1065
1115
  init_errors();
1066
1116
  init_hydrationHooks();
1067
- elementDisposers = /* @__PURE__ */ new WeakMap();
1117
+ state2 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.disposers.v1"), () => ({
1118
+ disposers: /* @__PURE__ */ new WeakMap(),
1119
+ captures: [],
1120
+ bindings: { count: 0 }
1121
+ }));
1122
+ elementDisposers = state2.disposers;
1068
1123
  MAX_DRAIN_TEARDOWNS = 1e4;
1069
- activeBindingCount = 0;
1070
- registrationCaptures = [];
1124
+ bindings = state2.bindings;
1125
+ registrationCaptures = state2.captures;
1071
1126
  }
1072
1127
  });
1073
1128
 
@@ -1222,6 +1277,178 @@ function bindOwnerScope(fn) {
1222
1277
  if (scope === null) return fn;
1223
1278
  return (...args) => runWithOwnerScope(scope, () => fn(...args));
1224
1279
  }
1280
+ function ownerState(tok) {
1281
+ let state5 = ACTIVE;
1282
+ for (let t2 = tok; t2 !== null; ) {
1283
+ const o = t2.sub;
1284
+ if (o === null) return ENDED;
1285
+ if (o._frozen === true) state5 = PAUSED;
1286
+ t2 = o._owner ?? null;
1287
+ }
1288
+ return state5;
1289
+ }
1290
+ function queueStateCheck() {
1291
+ if (stateCheckQueued || stateWatchers.size === 0) return;
1292
+ stateCheckQueued = true;
1293
+ queueMicrotask(() => {
1294
+ stateCheckQueued = false;
1295
+ for (const watcher of [...stateWatchers]) {
1296
+ if (!stateWatchers.has(watcher)) continue;
1297
+ const state5 = watcher.check.state();
1298
+ if (state5 === ENDED) stateWatchers.delete(watcher);
1299
+ if (state5 === ENDED || state5 === watcher.last) continue;
1300
+ watcher.last = state5;
1301
+ try {
1302
+ watcher.listener(state5);
1303
+ } catch (err) {
1304
+ reportError(err, { phase: "effect" });
1305
+ }
1306
+ }
1307
+ });
1308
+ }
1309
+ function captureFrozen() {
1310
+ const tok = currentStructOwner;
1311
+ if (tok === null) return ALWAYS_ACTIVE;
1312
+ const state5 = () => ownerState(tok);
1313
+ const check = Object.assign(() => state5() !== ACTIVE, {
1314
+ state: state5,
1315
+ wait: (onActive, onEnd) => {
1316
+ const now = state5();
1317
+ if (now !== PAUSED) {
1318
+ (now === ACTIVE ? onActive : onEnd)();
1319
+ return NOOP;
1320
+ }
1321
+ const waiter = { check, onActive, onEnd };
1322
+ waiters.add(waiter);
1323
+ return () => {
1324
+ waiters.delete(waiter);
1325
+ };
1326
+ },
1327
+ onEnd: (onEnd) => {
1328
+ if (state5() === ENDED) {
1329
+ onEnd();
1330
+ return NOOP;
1331
+ }
1332
+ const watcher = { check, onActive: NOOP, onEnd };
1333
+ endWatchers.add(watcher);
1334
+ return () => {
1335
+ endWatchers.delete(watcher);
1336
+ };
1337
+ },
1338
+ run: (fn) => {
1339
+ const prev = currentStructOwner;
1340
+ currentStructOwner = tok.sub === null ? null : tok;
1341
+ try {
1342
+ return fn();
1343
+ } finally {
1344
+ currentStructOwner = prev;
1345
+ }
1346
+ },
1347
+ onChange: (listener) => {
1348
+ const last = state5();
1349
+ if (last === ENDED) return NOOP;
1350
+ const watcher = { check, last, listener };
1351
+ stateWatchers.add(watcher);
1352
+ return () => {
1353
+ stateWatchers.delete(watcher);
1354
+ };
1355
+ },
1356
+ within: (owner) => {
1357
+ const target = owner.run(() => currentStructOwner);
1358
+ if (target === null) return false;
1359
+ for (let t2 = tok; t2 !== null; ) {
1360
+ if (t2 === target) return true;
1361
+ const o = t2.sub;
1362
+ if (o === null) return false;
1363
+ t2 = o._owner ?? null;
1364
+ }
1365
+ return false;
1366
+ }
1367
+ });
1368
+ return check;
1369
+ }
1370
+ function holdSubtree(root) {
1371
+ heldRoots.add(root);
1372
+ return () => {
1373
+ if (heldRoots.delete(root)) settleHeld();
1374
+ };
1375
+ }
1376
+ function isHeld(sub2) {
1377
+ if (frozenOwners !== 0 && hasFrozenOwner(sub2)) return true;
1378
+ if (heldRoots.size !== 0) {
1379
+ const node = sub2._errorNode;
1380
+ if (node != null) {
1381
+ for (const root of heldRoots) if (root.contains(node)) return true;
1382
+ }
1383
+ }
1384
+ return false;
1385
+ }
1386
+ function notifyEnded() {
1387
+ for (const watcher of stateWatchers) if (watcher.check.state() === ENDED) stateWatchers.delete(watcher);
1388
+ let ended = null;
1389
+ for (const watcher of endWatchers) {
1390
+ if (watcher.check.state() !== ENDED) continue;
1391
+ endWatchers.delete(watcher);
1392
+ (ended ?? (ended = [])).push(watcher);
1393
+ }
1394
+ if (ended === null) return;
1395
+ for (const watcher of ended) {
1396
+ try {
1397
+ watcher.onEnd();
1398
+ } catch (err) {
1399
+ reportError(err, { phase: "cleanup" });
1400
+ }
1401
+ }
1402
+ }
1403
+ function dropReleasedSkipped() {
1404
+ for (const sub2 of skippedWhileHeld) {
1405
+ if (sub2._disposed === true || sub2.depsHead == null) skippedWhileHeld.delete(sub2);
1406
+ }
1407
+ }
1408
+ function settleHeld() {
1409
+ for (const sub2 of skippedWhileHeld) {
1410
+ if (sub2._disposed === true) skippedWhileHeld.delete(sub2);
1411
+ else if (!isHeld(sub2)) {
1412
+ skippedWhileHeld.delete(sub2);
1413
+ if (!pendingSet.has(sub2)) {
1414
+ pendingSet.add(sub2);
1415
+ pendingQueue.push(sub2);
1416
+ }
1417
+ }
1418
+ }
1419
+ if (frozenOwners === 0 && heldRoots.size === 0) skippedWhileHeld.clear();
1420
+ let ready = null;
1421
+ for (const waiter of waiters) {
1422
+ if (waiter.check.state() === PAUSED) continue;
1423
+ waiters.delete(waiter);
1424
+ (ready ?? (ready = [])).push(waiter);
1425
+ }
1426
+ if (ready !== null) {
1427
+ const settle = ready;
1428
+ queueMicrotask(() => {
1429
+ for (const waiter of settle) {
1430
+ const state5 = waiter.check.state();
1431
+ if (state5 === PAUSED) waiters.add(waiter);
1432
+ else
1433
+ try {
1434
+ (state5 === ACTIVE ? waiter.onActive : waiter.onEnd)();
1435
+ } catch (err) {
1436
+ reportError(err, { phase: "effect" });
1437
+ }
1438
+ }
1439
+ });
1440
+ }
1441
+ if (pendingQueue.length > 0) drainNotificationQueue();
1442
+ }
1443
+ function hasFrozenOwner(sub2) {
1444
+ for (let t2 = sub2._owner ?? null; t2 !== null; ) {
1445
+ const o = t2.sub;
1446
+ if (o === null) return false;
1447
+ if (o._frozen === true) return true;
1448
+ t2 = o._owner ?? null;
1449
+ }
1450
+ return false;
1451
+ }
1225
1452
  function retrack(effectFn, subscriber) {
1226
1453
  const prev = currentSubscriber;
1227
1454
  let savedDepth = 0;
@@ -1328,6 +1555,20 @@ function structuralBinding(commit, ownerNode) {
1328
1555
  } finally {
1329
1556
  currentStructOwner = prev;
1330
1557
  }
1558
+ },
1559
+ freeze: () => {
1560
+ const s2 = sub2;
1561
+ if (s2._disposed || s2._frozen) return;
1562
+ s2._frozen = true;
1563
+ frozenOwners++;
1564
+ queueStateCheck();
1565
+ },
1566
+ thaw: () => {
1567
+ if (!sub2._frozen) return;
1568
+ sub2._frozen = false;
1569
+ frozenOwners--;
1570
+ queueStateCheck();
1571
+ settleHeld();
1331
1572
  }
1332
1573
  };
1333
1574
  }
@@ -1356,20 +1597,34 @@ function createBinding(commit, ownerNode, structural) {
1356
1597
  subscriber._errorNode = ownerNode;
1357
1598
  subscriber._tok = null;
1358
1599
  subscriber._owner = null;
1600
+ subscriber._frozen = false;
1359
1601
  if (structural) subscriber._tok = { sub: subscriber };
1360
1602
  try {
1361
1603
  run();
1362
1604
  } catch (err) {
1363
1605
  subscriber._disposed = true;
1364
1606
  subscriber._errorNode = void 0;
1365
- if (subscriber._tok != null) subscriber._tok.sub = null;
1607
+ if (subscriber._tok != null) {
1608
+ subscriber._tok.sub = null;
1609
+ if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
1610
+ }
1366
1611
  cleanup(subscriber);
1367
1612
  throw err;
1368
1613
  }
1369
1614
  subscriber._dispose = () => {
1370
1615
  subscriber._disposed = true;
1616
+ const wasFrozen = subscriber._frozen === true;
1617
+ if (wasFrozen) {
1618
+ subscriber._frozen = false;
1619
+ frozenOwners--;
1620
+ }
1371
1621
  subscriber._errorNode = void 0;
1372
- if (subscriber._tok != null) subscriber._tok.sub = null;
1622
+ if (subscriber._tok != null) {
1623
+ subscriber._tok.sub = null;
1624
+ if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
1625
+ if (skippedWhileHeld.size !== 0) dropReleasedSkipped();
1626
+ if (wasFrozen || waiters.size !== 0) settleHeld();
1627
+ }
1373
1628
  cleanup(subscriber);
1374
1629
  };
1375
1630
  return subscriber;
@@ -1475,6 +1730,10 @@ function runPendingOwners(sub2) {
1475
1730
  }
1476
1731
  }
1477
1732
  function runQueued(sub2) {
1733
+ if ((frozenOwners !== 0 || heldRoots.size !== 0) && isHeld(sub2)) {
1734
+ skippedWhileHeld.add(sub2);
1735
+ return;
1736
+ }
1478
1737
  if (quarantined.size > 0 && quarantined.has(sub2)) return;
1479
1738
  if (sub2._hasComputedDep === true && !depsChanged(sub2)) return;
1480
1739
  if (tickRepeat(sub2)) {
@@ -1620,7 +1879,7 @@ function forEachSubscriber(signal2, visit) {
1620
1879
  node = node.sigNext;
1621
1880
  }
1622
1881
  }
1623
- var POOL_MAX, nodePool, currentSubscriber, suspendSavedSub, notifyDepth, pendingQueue, pendingSet, propagateStack, suspendDepth, trackingSuspended, currentOwnerScope, currentStructOwner, subscriberEpochCounter, maxSubscriberRepeats, maxDrainIterations, drainEpoch, quarantined;
1882
+ var POOL_MAX, nodePool, currentSubscriber, suspendSavedSub, notifyDepth, pendingQueue, pendingSet, propagateStack, suspendDepth, trackingSuspended, currentOwnerScope, currentStructOwner, frozenOwners, ACTIVE, PAUSED, ENDED, NOOP, skippedWhileHeld, waiters, heldRoots, endWatchers, stateWatchers, stateCheckQueued, ALWAYS_ACTIVE, subscriberEpochCounter, maxSubscriberRepeats, maxDrainIterations, drainEpoch, quarantined;
1624
1883
  var init_track_core = __esm({
1625
1884
  "src/reactivity/track-core.ts"() {
1626
1885
  "use strict";
@@ -1638,6 +1897,29 @@ var init_track_core = __esm({
1638
1897
  trackingSuspended = false;
1639
1898
  currentOwnerScope = null;
1640
1899
  currentStructOwner = null;
1900
+ frozenOwners = 0;
1901
+ ACTIVE = 0;
1902
+ PAUSED = 1;
1903
+ ENDED = 2;
1904
+ NOOP = () => {
1905
+ };
1906
+ skippedWhileHeld = /* @__PURE__ */ new Set();
1907
+ waiters = /* @__PURE__ */ new Set();
1908
+ heldRoots = /* @__PURE__ */ new Set();
1909
+ endWatchers = /* @__PURE__ */ new Set();
1910
+ stateWatchers = /* @__PURE__ */ new Set();
1911
+ stateCheckQueued = false;
1912
+ ALWAYS_ACTIVE = Object.assign(() => false, {
1913
+ state: () => ACTIVE,
1914
+ wait: (onActive) => {
1915
+ onActive();
1916
+ return NOOP;
1917
+ },
1918
+ onEnd: () => NOOP,
1919
+ run: (fn) => fn(),
1920
+ onChange: () => NOOP,
1921
+ within: () => false
1922
+ });
1641
1923
  subscriberEpochCounter = 0;
1642
1924
  maxSubscriberRepeats = 1e3;
1643
1925
  maxDrainIterations = 1e6;
@@ -1681,18 +1963,20 @@ function resolveReactiveApi() {
1681
1963
  runWithOwnerScope,
1682
1964
  bindOwnerScope,
1683
1965
  structuralBinding,
1966
+ captureFrozen,
1967
+ holdSubtree,
1684
1968
  version: _runtimeVersion
1685
1969
  };
1686
1970
  g2[REGISTRY_KEY] = local;
1687
1971
  return local;
1688
1972
  }
1689
- var _runtimeVersion, REGISTRY_KEY, API, suspendTracking2, resumeTracking2, isTrackingSuspended2, untracked2, retrack2, track2, reactiveBinding2, recordDependency2, cleanup2, setMaxSubscriberRepeats2, setMaxDrainIterations2, drainNotificationQueue2, queueSignalNotification2, notifySubscribers2, getSubscriberCount2, getSubscriberDeps2, forEachSubscriber2, getOwnerScope2, runWithOwnerScope2, bindOwnerScope2, structuralBinding2;
1973
+ var _runtimeVersion, REGISTRY_KEY, API, suspendTracking2, resumeTracking2, isTrackingSuspended2, untracked2, retrack2, track2, reactiveBinding2, recordDependency2, cleanup2, setMaxSubscriberRepeats2, setMaxDrainIterations2, drainNotificationQueue2, queueSignalNotification2, notifySubscribers2, getSubscriberCount2, getSubscriberDeps2, forEachSubscriber2, getOwnerScope2, runWithOwnerScope2, bindOwnerScope2, structuralBinding2, captureFrozen2, holdSubtree2;
1690
1974
  var init_track = __esm({
1691
1975
  "src/reactivity/track.ts"() {
1692
1976
  "use strict";
1693
1977
  init_dev();
1694
1978
  init_track_core();
1695
- _runtimeVersion = true ? "4.14.1" : "dev";
1979
+ _runtimeVersion = true ? "4.15.0" : "dev";
1696
1980
  REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
1697
1981
  API = resolveReactiveApi();
1698
1982
  suspendTracking2 = API.suspendTracking;
@@ -1716,30 +2000,46 @@ var init_track = __esm({
1716
2000
  runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
1717
2001
  bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
1718
2002
  structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
2003
+ captureFrozen2 = API.captureFrozen ?? (() => Object.assign(() => false, {
2004
+ state: () => 0,
2005
+ wait: (onActive) => {
2006
+ onActive();
2007
+ return () => {
2008
+ };
2009
+ },
2010
+ onEnd: () => () => {
2011
+ },
2012
+ run: (fn) => fn(),
2013
+ onChange: () => () => {
2014
+ },
2015
+ within: () => false
2016
+ }));
2017
+ holdSubtree2 = API.holdSubtree ?? (() => () => {
2018
+ });
1719
2019
  }
1720
2020
  });
1721
2021
 
1722
2022
  // src/core/rendering/streamBoundary.ts
1723
2023
  function currentBoundary() {
1724
- return slot3.current;
2024
+ return slot2.current;
1725
2025
  }
1726
2026
  function runInBoundary(boundary, fn) {
1727
- const prev = slot3.current;
1728
- slot3.current = boundary;
2027
+ const prev = slot2.current;
2028
+ slot2.current = boundary;
1729
2029
  try {
1730
2030
  return fn();
1731
2031
  } finally {
1732
- slot3.current = prev;
2032
+ slot2.current = prev;
1733
2033
  }
1734
2034
  }
1735
2035
  function setBoundaryHook(hook) {
1736
- slot3.hook = hook;
2036
+ slot2.hook = hook;
1737
2037
  }
1738
- var _a2, slot3;
2038
+ var _a2, slot2;
1739
2039
  var init_streamBoundary = __esm({
1740
2040
  "src/core/rendering/streamBoundary.ts"() {
1741
2041
  "use strict";
1742
- slot3 = globalThis[_a2 = /* @__PURE__ */ Symbol.for("sibujs.streamBoundary.v1")] ?? (globalThis[_a2] = { hook: null, current: null });
2042
+ slot2 = globalThis[_a2 = /* @__PURE__ */ Symbol.for("sibujs.streamBoundary.v1")] ?? (globalThis[_a2] = { hook: null, current: null });
1743
2043
  }
1744
2044
  });
1745
2045
 
@@ -1836,14 +2136,14 @@ function runInSSRContext(fn) {
1836
2136
  }
1837
2137
  function trackPending(promise, label2, hydration = true) {
1838
2138
  const store = getRequestStore();
1839
- const pending = store?.pending;
1840
- const sessions = pending || !hydration ? [] : hydrationOwners();
1841
- if (!pending && sessions.length === 0) return promise;
2139
+ const pending2 = store?.pending;
2140
+ const sessions = pending2 || !hydration ? [] : hydrationOwners();
2141
+ if (!pending2 && sessions.length === 0) return promise;
1842
2142
  const entry = { label: label2, since: Date.now(), boundary: currentBoundary() ?? void 0 };
1843
- pending?.add(entry);
2143
+ pending2?.add(entry);
1844
2144
  const release = holdHydration(sessions, entry);
1845
2145
  const done = () => {
1846
- pending?.delete(entry);
2146
+ pending2?.delete(entry);
1847
2147
  store?.wake?.();
1848
2148
  release();
1849
2149
  };
@@ -1871,14 +2171,28 @@ var init_ssr_context = __esm({
1871
2171
  }
1872
2172
  });
1873
2173
 
1874
- // src/utils/globalSingleton.ts
1875
- function globalSingleton(key, create) {
1876
- const g2 = globalThis;
1877
- return g2[key] ?? (g2[key] = create());
1878
- }
1879
- var init_globalSingleton = __esm({
1880
- "src/utils/globalSingleton.ts"() {
2174
+ // src/utils/styleKey.ts
2175
+ function styleKeyToProperty(key) {
2176
+ let name = cache.get(key);
2177
+ if (name !== void 0) return name;
2178
+ if (key.startsWith("--")) name = key;
2179
+ else if (Object.hasOwn(EXCEPTIONS, key)) name = EXCEPTIONS[key];
2180
+ else {
2181
+ name = key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
2182
+ if (VENDOR_PREFIX.test(name)) name = `-${name}`;
2183
+ }
2184
+ if (cache.size >= CACHE_MAX) cache.clear();
2185
+ cache.set(key, name);
2186
+ return name;
2187
+ }
2188
+ var EXCEPTIONS, VENDOR_PREFIX, cache, CACHE_MAX;
2189
+ var init_styleKey = __esm({
2190
+ "src/utils/styleKey.ts"() {
1881
2191
  "use strict";
2192
+ EXCEPTIONS = { cssFloat: "float" };
2193
+ VENDOR_PREFIX = /^(webkit|moz|ms|o)-/;
2194
+ cache = /* @__PURE__ */ new Map();
2195
+ CACHE_MAX = 1e3;
1882
2196
  }
1883
2197
  });
1884
2198
 
@@ -2019,7 +2333,7 @@ var init_serverHead = __esm({
2019
2333
  // src/utils/embedPolicy.ts
2020
2334
  function currentEmbedAllowlist() {
2021
2335
  const scoped = getRequestStore()?.caches?.get(REQUEST_CACHE)?.get("allowed");
2022
- return scoped ?? state2.allowed;
2336
+ return scoped ?? state4.allowed;
2023
2337
  }
2024
2338
  function resolveEmbedSrc(value, allowed = currentEmbedAllowlist()) {
2025
2339
  if (typeof value !== "string" || sanitizeUrl(value) === "") return null;
@@ -2062,7 +2376,7 @@ function narrowEmbedAllow(value) {
2062
2376
  return granted.filter((feature) => !denied.includes(feature)).join("; ");
2063
2377
  }
2064
2378
  function getEmbedRecord(frame) {
2065
- return state2.frames.get(frame);
2379
+ return state4.frames.get(frame);
2066
2380
  }
2067
2381
  function intersect(current2, permitted, separator) {
2068
2382
  const allowed = permitted.split(separator);
@@ -2107,14 +2421,14 @@ function embedSerializationTail(record, seen) {
2107
2421
  if (seen.fullscreen) tail += ' allowfullscreen=""';
2108
2422
  return tail;
2109
2423
  }
2110
- var state2, REQUEST_CACHE, DEFAULT_EMBED_SANDBOX, EMBED_FEATURES;
2424
+ var state4, REQUEST_CACHE, DEFAULT_EMBED_SANDBOX, EMBED_FEATURES;
2111
2425
  var init_embedPolicy = __esm({
2112
2426
  "src/utils/embedPolicy.ts"() {
2113
2427
  "use strict";
2114
2428
  init_ssr_context();
2115
2429
  init_globalSingleton();
2116
2430
  init_sanitize();
2117
- state2 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.embed.v2"), () => ({
2431
+ state4 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.embed.v2"), () => ({
2118
2432
  allowed: [],
2119
2433
  frames: /* @__PURE__ */ new WeakMap()
2120
2434
  }));
@@ -2277,23 +2591,18 @@ function splitDeclarations(text2) {
2277
2591
  out.push(text2.slice(start));
2278
2592
  return out;
2279
2593
  }
2280
- function toKebab2(prop) {
2281
- if (prop.startsWith("--")) return prop;
2282
- if (Object.hasOwn(CAMEL_EXCEPTIONS, prop)) return CAMEL_EXCEPTIONS[prop];
2283
- return prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`).replace(/^(webkit|moz|ms)-/, "-$1-");
2284
- }
2285
2594
  function styleProxy(style2) {
2286
2595
  return new Proxy(style2, {
2287
2596
  get(target, key, receiver) {
2288
2597
  if (typeof key === "string" && !(key in target)) {
2289
2598
  if (/^\d+$/.test(key)) return target.item(Number(key));
2290
- return target.getPropertyValue(toKebab2(key));
2599
+ return target.getPropertyValue(styleKeyToProperty(key));
2291
2600
  }
2292
2601
  return Reflect.get(target, key, receiver);
2293
2602
  },
2294
2603
  set(target, key, value, receiver) {
2295
2604
  if (typeof key === "string" && !(key in target)) {
2296
- target.setProperty(toKebab2(key), value == null ? "" : String(value));
2605
+ target.setProperty(styleKeyToProperty(key), value == null ? "" : String(value));
2297
2606
  return true;
2298
2607
  }
2299
2608
  return Reflect.set(target, key, value, receiver);
@@ -2335,21 +2644,21 @@ function compileSelector(selector) {
2335
2644
  const tokens = text2.match(/(?:\\.|\[[^\]]*\]|[^\s>])+|>/g) ?? [];
2336
2645
  const compounds = [];
2337
2646
  const combinators = [];
2338
- let pending = " ";
2647
+ let pending2 = " ";
2339
2648
  let scoped = false;
2340
2649
  for (const token of tokens) {
2341
2650
  if (token === ">") {
2342
- pending = ">";
2651
+ pending2 = ">";
2343
2652
  continue;
2344
2653
  }
2345
2654
  if (token === ":scope") {
2346
2655
  scoped = true;
2347
- pending = " ";
2656
+ pending2 = " ";
2348
2657
  continue;
2349
2658
  }
2350
- if (compounds.length > 0) combinators.unshift(pending);
2659
+ if (compounds.length > 0) combinators.unshift(pending2);
2351
2660
  compounds.unshift(parseCompound(token, selector));
2352
- pending = " ";
2661
+ pending2 = " ";
2353
2662
  }
2354
2663
  if (compounds.length === 0) throw syntaxError(selector);
2355
2664
  groups.push({ compounds, combinators, scoped });
@@ -2575,12 +2884,13 @@ function explainServerError(err) {
2575
2884
  function ensureServerDom() {
2576
2885
  if (typeof document === "undefined") installServerDom();
2577
2886
  }
2578
- var HTML_NS3, SVG_NS4, MATHML_NS, ELEMENT_NODE, ATTRIBUTE_NODE, TEXT_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE, warnedSites, NAME_RE, ServerNodeList, observations, ServerMutationObserver, _ServerNode, ServerNode, ServerCharacterData, ServerText, ServerComment, ServerDocumentFragment, ServerAttr, ServerNamedNodeMap, CAMEL_EXCEPTIONS, ServerStyle, ServerTokenList, ServerElement, ServerHTMLElement, ServerInputElement, ServerTextAreaElement, ServerOptionElement, ServerSelectElement, ServerButtonElement, ServerDisableableElement, ServerCanvasElement, ServerDialogElement, ServerMediaElement, ServerTemplateElement, ServerSVGElement, ServerMathMLElement, HTML_CLASSES, NODE_FILTER, ServerTreeWalker, ServerDocument, selectorCache, VOID, INSTALLED, BROWSER_GLOBALS, WATCHED, BROWSER_ONLY_NAMES;
2887
+ var HTML_NS3, SVG_NS4, MATHML_NS, ELEMENT_NODE, ATTRIBUTE_NODE, TEXT_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE, warnedSites, NAME_RE, ServerNodeList, observations, ServerMutationObserver, _ServerNode, ServerNode, ServerCharacterData, ServerText, ServerComment, ServerDocumentFragment, ServerAttr, ServerNamedNodeMap, ServerStyle, ServerTokenList, ServerElement, ServerHTMLElement, ServerInputElement, ServerTextAreaElement, ServerOptionElement, ServerSelectElement, ServerButtonElement, ServerDisableableElement, ServerCanvasElement, ServerDialogElement, ServerMediaElement, ServerTemplateElement, ServerSVGElement, ServerMathMLElement, HTML_CLASSES, NODE_FILTER, ServerTreeWalker, ServerDocument, selectorCache, VOID, INSTALLED, BROWSER_GLOBALS, WATCHED, BROWSER_ONLY_NAMES;
2579
2888
  var init_serverDom = __esm({
2580
2889
  "src/platform/serverDom.ts"() {
2581
2890
  "use strict";
2582
2891
  init_dev();
2583
2892
  init_ssr_context();
2893
+ init_styleKey();
2584
2894
  HTML_NS3 = "http://www.w3.org/1999/xhtml";
2585
2895
  SVG_NS4 = "http://www.w3.org/2000/svg";
2586
2896
  MATHML_NS = "http://www.w3.org/1998/Math/MathML";
@@ -3176,7 +3486,6 @@ var init_serverDom = __esm({
3176
3486
  return this.find((a2) => a2.namespaceURI === (ns || null) && a2.localName === localName) ?? null;
3177
3487
  }
3178
3488
  };
3179
- CAMEL_EXCEPTIONS = { cssFloat: "float" };
3180
3489
  ServerStyle = class {
3181
3490
  constructor(el) {
3182
3491
  this.el = el;
@@ -4264,12 +4573,12 @@ async function hydrateAdopt(component, container, options = {}) {
4264
4573
  inScope(rootScope, () => session.place(container, tree));
4265
4574
  }
4266
4575
  const deadline = Date.now() + (options.timeout ?? 1e4);
4267
- const { pending, wake } = hydration;
4576
+ const { pending: pending2, wake } = hydration;
4268
4577
  for (; ; ) {
4269
4578
  await macrotask();
4270
- if (pending.size === 0) {
4579
+ if (pending2.size === 0) {
4271
4580
  await macrotask();
4272
- if (pending.size === 0) break;
4581
+ if (pending2.size === 0) break;
4273
4582
  continue;
4274
4583
  }
4275
4584
  const remaining = deadline - Date.now();
@@ -4735,9 +5044,9 @@ function installHook() {
4735
5044
  if (hookInstalled) return;
4736
5045
  hookInstalled = true;
4737
5046
  setBoundaryHook((container) => {
4738
- const state3 = requestSlot("stream");
5047
+ const state5 = requestSlot("stream");
4739
5048
  const store = getRequestStore();
4740
- if (!state3 || !store) return null;
5049
+ if (!state5 || !store) return null;
4741
5050
  const id = `sibu-sus-${store.suspenseIdCounter++}`;
4742
5051
  container.setAttribute("data-sibu-suspense-id", id);
4743
5052
  const record = {
@@ -4748,8 +5057,8 @@ function installHook() {
4748
5057
  fallbackHtml: null,
4749
5058
  api: {
4750
5059
  enter: (fn) => {
4751
- if (record.fallbackHtml === null && state3.serialize) {
4752
- record.fallbackHtml = Array.from(container.childNodes, (n) => state3.serialize?.(n) ?? "").join("");
5060
+ if (record.fallbackHtml === null && state5.serialize) {
5061
+ record.fallbackHtml = Array.from(container.childNodes, (n) => state5.serialize?.(n) ?? "").join("");
4753
5062
  }
4754
5063
  return runInBoundary(record.api, fn);
4755
5064
  },
@@ -4759,7 +5068,7 @@ function installHook() {
4759
5068
  }
4760
5069
  }
4761
5070
  };
4762
- state3.boundaries.push(record);
5071
+ state5.boundaries.push(record);
4763
5072
  return record.api;
4764
5073
  });
4765
5074
  }
@@ -4840,9 +5149,9 @@ async function waitFor(ready, deadline, stop2) {
4840
5149
  });
4841
5150
  }
4842
5151
  }
4843
- function pendingFor(pending, boundary) {
4844
- if (!pending) return false;
4845
- for (const work of pending) if (work.boundary === boundary) return true;
5152
+ function pendingFor(pending2, boundary) {
5153
+ if (!pending2) return false;
5154
+ for (const work of pending2) if (work.boundary === boundary) return true;
4846
5155
  return false;
4847
5156
  }
4848
5157
  function streamPage(input2, options = {}) {
@@ -4855,8 +5164,8 @@ function streamPage(input2, options = {}) {
4855
5164
  const MARK_END = "<sibu-stream-end>";
4856
5165
  void runInSSRContext(async () => {
4857
5166
  const store = getRequestStore();
4858
- const state3 = { boundaries: [], serialize: null };
4859
- requestSlot("stream", () => state3);
5167
+ const state5 = { boundaries: [], serialize: null };
5168
+ requestSlot("stream", () => state5);
4860
5169
  const errors = [];
4861
5170
  if (store) store.errors = errors;
4862
5171
  let holder = null;
@@ -4877,13 +5186,13 @@ function streamPage(input2, options = {}) {
4877
5186
  throw explainServerError(err);
4878
5187
  }
4879
5188
  const serialize = (node) => renderToStringWith(node, { marker: options.marker ?? "root", ids });
4880
- state3.serialize = serialize;
5189
+ state5.serialize = serialize;
4881
5190
  holder = document.createDocumentFragment();
4882
5191
  holder.appendChild(root);
4883
5192
  const ready = (b2) => b2.done && !pendingFor(store?.pending, b2.api);
4884
5193
  const serializeWithFallbacks = (node) => {
4885
5194
  const held = [];
4886
- for (const b2 of state3.boundaries) {
5195
+ for (const b2 of state5.boundaries) {
4887
5196
  if (ready(b2) || b2.container === node || !node.contains(b2.container)) continue;
4888
5197
  if (held.some((h) => h.b.container.contains(b2.container))) continue;
4889
5198
  const nodes = Array.from(b2.container.childNodes);
@@ -4905,9 +5214,9 @@ function streamPage(input2, options = {}) {
4905
5214
  await waitFor(() => !pendingFor(store?.pending, void 0), shellDeadline, stopWaiting);
4906
5215
  failIfErrored();
4907
5216
  if (channel.cancelled) return;
4908
- for (const b2 of state3.boundaries) {
5217
+ for (const b2 of state5.boundaries) {
4909
5218
  const inline = (x) => x.done && !pendingFor(store?.pending, x.api);
4910
- const enclosing = state3.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
5219
+ const enclosing = state5.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
4911
5220
  if (inline(b2) && enclosing.every(inline)) b2.emitted = true;
4912
5221
  }
4913
5222
  const shell = serializeWithFallbacks(holder);
@@ -4928,8 +5237,8 @@ function streamPage(input2, options = {}) {
4928
5237
  if (channel.cancelled) return;
4929
5238
  failIfErrored();
4930
5239
  const deadline = Date.now() + (options.timeout ?? 1e4);
4931
- const outstanding = () => state3.boundaries.filter((b2) => !b2.emitted);
4932
- const ancestorsOf = (b2) => state3.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
5240
+ const outstanding = () => state5.boundaries.filter((b2) => !b2.emitted);
5241
+ const ancestorsOf = (b2) => state5.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
4933
5242
  const emittable = (b2) => ready(b2) && ancestorsOf(b2).every((a2) => a2.emitted);
4934
5243
  let bodyClosed = false;
4935
5244
  for (; ; ) {
@@ -4953,7 +5262,7 @@ function streamPage(input2, options = {}) {
4953
5262
  if (channel.cancelled) return;
4954
5263
  failIfErrored();
4955
5264
  }
4956
- for (const b2 of state3.boundaries) {
5265
+ for (const b2 of state5.boundaries) {
4957
5266
  if (b2 === next || !next.container.contains(b2.container) || !ready(b2)) continue;
4958
5267
  const between2 = ancestorsOf(b2).filter((a2) => a2 !== next && next.container.contains(a2.container));
4959
5268
  if (between2.every(ready)) b2.emitted = true;
@@ -5622,12 +5931,12 @@ async function* renderToSuspenseStream(element, pendingBoundaries = [], options)
5622
5931
  function escapeScriptJson(json) {
5623
5932
  return json.replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
5624
5933
  }
5625
- function serializeState(state3, nonce, options) {
5934
+ function serializeState(state5, nonce, options) {
5626
5935
  const globalName = options?.global ?? SSR_DATA_ATTR;
5627
5936
  if (!SAFE_GLOBAL_NAME.test(globalName)) {
5628
5937
  throw new Error(`[SibuJS SSR] serializeState: global must be an identifier (got: ${JSON.stringify(globalName)})`);
5629
5938
  }
5630
- const rawJson = JSON.stringify(state3);
5939
+ const rawJson = JSON.stringify(state5);
5631
5940
  const maxBytes = options?.maxBytes ?? DEFAULT_MAX_SSR_BYTES;
5632
5941
  const byteLen = typeof TextEncoder !== "undefined" ? new TextEncoder().encode(rawJson).byteLength : Buffer.byteLength(rawJson, "utf8");
5633
5942
  if (byteLen > maxBytes) {
@@ -6020,8 +6329,8 @@ function commitSafeAttribute(el, name, value, options) {
6020
6329
  else el.removeAttribute(name);
6021
6330
  return false;
6022
6331
  }
6023
- const pending = value == null || value === false ? null : value === true ? "" : String(value);
6024
- const refusal = contextualAttributeRefusal(el, name, pending, options.reactive ? "reactive" : "runtime");
6332
+ const pending2 = value == null || value === false ? null : value === true ? "" : String(value);
6333
+ const refusal = contextualAttributeRefusal(el, name, pending2, options.reactive ? "reactive" : "runtime");
6025
6334
  if (refusal !== ContextualRefusal.None) {
6026
6335
  warnContextualRefusal(options.label ?? "setSafeAttribute", name, refusal);
6027
6336
  if (ns) el.removeAttributeNS(ns, localName);
@@ -6187,7 +6496,7 @@ function restoreFocusWithin(snapshot, nodes, where, policy) {
6187
6496
  const active = document.activeElement;
6188
6497
  if (active === snapshot.el) return;
6189
6498
  if (active && active !== document.body && active !== document.documentElement) return;
6190
- if (snapshot.el.isConnected) {
6499
+ if (snapshot.el.isConnected && !snapshot.el.closest("[inert]")) {
6191
6500
  refocus(snapshot.el, snapshot);
6192
6501
  return;
6193
6502
  }
@@ -6214,9 +6523,81 @@ function restoreFocusWithin(snapshot, nodes, where, policy) {
6214
6523
  });
6215
6524
  }
6216
6525
 
6526
+ // src/core/rendering/range.ts
6527
+ init_globalSingleton();
6528
+ init_ssr_context();
6529
+ var state3 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.ranges.v1"), () => ({
6530
+ ends: /* @__PURE__ */ new WeakMap(),
6531
+ pending: /* @__PURE__ */ new WeakMap(),
6532
+ registrations: /* @__PURE__ */ new Set(),
6533
+ listeners: /* @__PURE__ */ new Set(),
6534
+ notice: { queued: false, batch: [] }
6535
+ }));
6536
+ var ends = state3.ends;
6537
+ function registerRange(start, last) {
6538
+ ends.set(start, last);
6539
+ }
6540
+ var pending = state3.pending;
6541
+ var NOTHING = () => {
6542
+ };
6543
+ var registrations = state3.registrations;
6544
+ var loadListeners = state3.listeners;
6545
+ var notice = state3.notice;
6546
+ function notifyLoad(settled) {
6547
+ if (loadListeners.size === 0) return;
6548
+ if (settled !== null) notice.batch.push(settled);
6549
+ if (notice.queued) return;
6550
+ notice.queued = true;
6551
+ queueMicrotask(() => {
6552
+ notice.queued = false;
6553
+ const batch2 = notice.batch;
6554
+ notice.batch = [];
6555
+ for (const listener of [...loadListeners]) listener(batch2);
6556
+ });
6557
+ }
6558
+ function beginPending(at, held) {
6559
+ const entry = { at, held, settled: false, cancelled: false, committed: null };
6560
+ registrations.add(entry);
6561
+ notifyLoad(null);
6562
+ const settle = (cancelled, committed) => {
6563
+ if (entry.settled) return;
6564
+ entry.settled = true;
6565
+ entry.cancelled = cancelled;
6566
+ entry.committed = committed;
6567
+ registrations.delete(entry);
6568
+ notifyLoad(entry);
6569
+ };
6570
+ return {
6571
+ entry,
6572
+ done: (committed) => settle(false, committed ?? null),
6573
+ cancel: () => settle(true, null)
6574
+ };
6575
+ }
6576
+ var INERT = { done: NOTHING, cancel: NOTHING };
6577
+ function beginLoading(anchor) {
6578
+ if (isServer()) return INERT;
6579
+ const { done, cancel } = beginPending(anchor, null);
6580
+ return { done: () => done(), cancel };
6581
+ }
6582
+ function registerNodesRange(anchor, nodes) {
6583
+ registerRange(anchor, () => {
6584
+ const parent = anchor.parentNode;
6585
+ const wanted = nodes().filter((n) => n !== null && n.parentNode === parent);
6586
+ let last = null;
6587
+ let left = wanted.length;
6588
+ for (let n = anchor.nextSibling; n !== null && left > 0; n = n.nextSibling) {
6589
+ if (wanted.includes(n)) {
6590
+ last = n;
6591
+ left--;
6592
+ }
6593
+ }
6594
+ return last;
6595
+ });
6596
+ }
6597
+
6217
6598
  // src/reactivity/bindChildNode.ts
6218
6599
  init_track();
6219
- function bindChildNode(placeholder, getter) {
6600
+ function bindChildNode(placeholder, getter, exposeNodes) {
6220
6601
  let lastNodes = [];
6221
6602
  const scope = captureScope();
6222
6603
  function commit() {
@@ -6287,6 +6668,12 @@ function bindChildNode(placeholder, getter) {
6287
6668
  lastNodes = newNodes;
6288
6669
  restoreFocusWithin(focused, newNodes, "bindChildNode");
6289
6670
  }
6671
+ if (exposeNodes) {
6672
+ registerRange(placeholder, () => {
6673
+ for (let i2 = lastNodes.length - 1; i2 >= 0; i2--) if (lastNodes[i2].parentNode !== null) return lastNodes[i2];
6674
+ return null;
6675
+ });
6676
+ }
6290
6677
  return reactiveBinding2(commit, placeholder, true);
6291
6678
  }
6292
6679
 
@@ -6294,6 +6681,7 @@ function bindChildNode(placeholder, getter) {
6294
6681
  init_track();
6295
6682
  init_elementPolicy();
6296
6683
  init_sanitize();
6684
+ init_styleKey();
6297
6685
  init_adoptScope();
6298
6686
  init_dispose();
6299
6687
 
@@ -6323,14 +6711,6 @@ var CLOBBER_RISKY_IDS = /* @__PURE__ */ new Set([
6323
6711
  var warnedLoneStrings = /* @__PURE__ */ new Set();
6324
6712
  var MAX_WARNED_LONE_STRINGS = 100;
6325
6713
  var loneStringCapAnnounced = false;
6326
- var kebabCache = /* @__PURE__ */ new Map();
6327
- function toKebab(prop) {
6328
- let cached = kebabCache.get(prop);
6329
- if (cached !== void 0) return cached;
6330
- cached = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
6331
- kebabCache.set(prop, cached);
6332
- return cached;
6333
- }
6334
6714
  function applyStyle(el, style2) {
6335
6715
  if (typeof style2 === "function") {
6336
6716
  const getter = style2;
@@ -6354,7 +6734,7 @@ function applyStyle(el, style2) {
6354
6734
  if (!Object.hasOwn(value, prop)) continue;
6355
6735
  const val = value[prop];
6356
6736
  if (val == null) continue;
6357
- const name = toKebab(prop);
6737
+ const name = styleKeyToProperty(prop);
6358
6738
  next.push(name);
6359
6739
  decl.setProperty(name, sanitizeCSSDeclaration(name, String(val), { element: el }));
6360
6740
  }
@@ -6374,7 +6754,7 @@ function applyStyle(el, style2) {
6374
6754
  for (const prop in style2) {
6375
6755
  if (!Object.hasOwn(style2, prop)) continue;
6376
6756
  const val = style2[prop];
6377
- const name = toKebab(prop);
6757
+ const name = styleKeyToProperty(prop);
6378
6758
  if (typeof val === "function") {
6379
6759
  const getter = val;
6380
6760
  const teardown = reactiveBinding2(() => {
@@ -6709,7 +7089,7 @@ var details = tagFactory("details");
6709
7089
  var dialog = tagFactory("dialog");
6710
7090
  var menu = tagFactory("menu");
6711
7091
  var summary = tagFactory("summary");
6712
- var slot2 = tagFactory("slot");
7092
+ var slot3 = tagFactory("slot");
6713
7093
  var template = tagFactory("template");
6714
7094
  var base = tagFactory("base");
6715
7095
  var link = tagFactory("link");
@@ -6805,7 +7185,7 @@ function emitDevtools(hook, event, payload) {
6805
7185
  // src/core/signals/signal.ts
6806
7186
  var _g = globalThis;
6807
7187
  function signal(initial, options) {
6808
- const state3 = {
7188
+ const state5 = {
6809
7189
  value: initial,
6810
7190
  __v: 0,
6811
7191
  __sc: 0,
@@ -6818,57 +7198,57 @@ function signal(initial, options) {
6818
7198
  };
6819
7199
  const debugName = DEV ? options?.name : void 0;
6820
7200
  const equalsFn = options?.equals;
6821
- if (debugName) state3.__name = debugName;
7201
+ if (debugName) state5.__name = debugName;
6822
7202
  function get() {
6823
- recordDependency2(state3);
6824
- return state3.value;
7203
+ recordDependency2(state5);
7204
+ return state5.value;
6825
7205
  }
6826
- get.__signal = state3;
7206
+ get.__signal = state5;
6827
7207
  if (debugName) get.__name = debugName;
6828
7208
  let set;
6829
7209
  if (equalsFn) {
6830
7210
  set = (next) => {
6831
- const prev = state3.value;
7211
+ const prev = state5.value;
6832
7212
  const newValue = typeof next === "function" ? next(prev) : next;
6833
7213
  if (equalsFn(prev, newValue)) return;
6834
- state3.value = newValue;
6835
- state3.__v++;
7214
+ state5.value = newValue;
7215
+ state5.__v++;
6836
7216
  if (DEV) {
6837
7217
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
6838
- if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
7218
+ if (hook) emitDevtools(hook, "signal:update", { signal: state5, name: debugName, oldValue: prev, newValue });
6839
7219
  }
6840
- if (!enqueueBatchedSignal(state3)) {
6841
- notifySubscribers2(state3);
7220
+ if (!enqueueBatchedSignal(state5)) {
7221
+ notifySubscribers2(state5);
6842
7222
  }
6843
7223
  };
6844
7224
  } else if (DEV) {
6845
7225
  set = (next) => {
6846
- const prev = state3.value;
7226
+ const prev = state5.value;
6847
7227
  const newValue = typeof next === "function" ? next(prev) : next;
6848
7228
  if (Object.is(newValue, prev)) return;
6849
- state3.value = newValue;
6850
- state3.__v++;
7229
+ state5.value = newValue;
7230
+ state5.__v++;
6851
7231
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
6852
- if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
6853
- if (!enqueueBatchedSignal(state3)) {
6854
- notifySubscribers2(state3);
7232
+ if (hook) emitDevtools(hook, "signal:update", { signal: state5, name: debugName, oldValue: prev, newValue });
7233
+ if (!enqueueBatchedSignal(state5)) {
7234
+ notifySubscribers2(state5);
6855
7235
  }
6856
7236
  };
6857
7237
  } else {
6858
7238
  set = (next) => {
6859
- const prev = state3.value;
7239
+ const prev = state5.value;
6860
7240
  const newValue = typeof next === "function" ? next(prev) : next;
6861
7241
  if (Object.is(newValue, prev)) return;
6862
- state3.value = newValue;
6863
- state3.__v++;
6864
- if (!enqueueBatchedSignal(state3)) {
6865
- notifySubscribers2(state3);
7242
+ state5.value = newValue;
7243
+ state5.__v++;
7244
+ if (!enqueueBatchedSignal(state5)) {
7245
+ notifySubscribers2(state5);
6866
7246
  }
6867
7247
  };
6868
7248
  }
6869
7249
  if (DEV) {
6870
7250
  const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
6871
- if (hook) emitDevtools(hook, "signal:create", { signal: state3, name: debugName, getter: get, initial });
7251
+ if (hook) emitDevtools(hook, "signal:create", { signal: state5, name: debugName, getter: get, initial });
6872
7252
  }
6873
7253
  return [get, set];
6874
7254
  }
@@ -7030,16 +7410,16 @@ function createModuleRegistry() {
7030
7410
  };
7031
7411
  }
7032
7412
  function createBundle(modules) {
7033
- const cache = /* @__PURE__ */ new Map();
7413
+ const cache2 = /* @__PURE__ */ new Map();
7034
7414
  const bundle = {};
7035
7415
  for (const key of Object.keys(modules)) {
7036
7416
  Object.defineProperty(bundle, key, {
7037
7417
  get() {
7038
- if (cache.has(key)) {
7039
- return cache.get(key);
7418
+ if (cache2.has(key)) {
7419
+ return cache2.get(key);
7040
7420
  }
7041
7421
  const value = modules[key]();
7042
- cache.set(key, value);
7422
+ cache2.set(key, value);
7043
7423
  return value;
7044
7424
  },
7045
7425
  enumerable: true,
@@ -7108,7 +7488,7 @@ var CDN_ENTRY_POINTS = {
7108
7488
  };
7109
7489
  var packageInfo = {
7110
7490
  name: "sibujs",
7111
- version: true ? "4.14.1" : "dev",
7491
+ version: true ? "4.15.0" : "dev",
7112
7492
  entryPoints: MODULE_ENTRY_POINTS,
7113
7493
  /**
7114
7494
  * Generate the package.json `exports` map. Module entries resolve to the
@@ -7255,18 +7635,18 @@ function createPluginRegistry() {
7255
7635
  return true;
7256
7636
  };
7257
7637
  installStack.add(p2.name);
7258
- let pending;
7638
+ let pending2;
7259
7639
  try {
7260
- pending = adoptThenable(p2.install(ctx, options));
7640
+ pending2 = adoptThenable(p2.install(ctx, options));
7261
7641
  } finally {
7262
7642
  installStack.delete(p2.name);
7263
7643
  }
7264
- if (!pending) {
7644
+ if (!pending2) {
7265
7645
  if (!commit()) throw new PluginInstallCancelledError(p2.name);
7266
7646
  return;
7267
7647
  }
7268
7648
  if (myGeneration === generation) pendingInstalls.set(p2.name, myGeneration);
7269
- const settled = pending.then(
7649
+ const settled = pending2.then(
7270
7650
  () => {
7271
7651
  if (commit()) return;
7272
7652
  if (pendingInstalls.get(p2.name) === myGeneration) pendingInstalls.delete(p2.name);
@@ -7905,6 +8285,66 @@ function sameAttrs(el, attrs) {
7905
8285
  init_dev();
7906
8286
  init_adoptScope();
7907
8287
  init_dispose();
8288
+
8289
+ // src/core/rendering/heldCommit.ts
8290
+ init_track();
8291
+ var NOOP2 = () => {
8292
+ };
8293
+ function commitWhenActive(slot4, c) {
8294
+ let over = false;
8295
+ let unhold = null;
8296
+ let drop = NOOP2;
8297
+ const finish = () => {
8298
+ over = true;
8299
+ if (slot4.cancel === cancel) slot4.cancel = NOOP2;
8300
+ drop();
8301
+ drop = NOOP2;
8302
+ };
8303
+ const cancel = () => {
8304
+ if (over) return;
8305
+ finish();
8306
+ const release = unhold;
8307
+ unhold = null;
8308
+ try {
8309
+ c.discard();
8310
+ } finally {
8311
+ release?.();
8312
+ }
8313
+ };
8314
+ const attempt = () => {
8315
+ drop = NOOP2;
8316
+ let clean = false;
8317
+ while (!over) {
8318
+ const state5 = c.held.state();
8319
+ if (state5 === 2 || c.owned !== void 0 && !c.owned()) {
8320
+ cancel();
8321
+ return;
8322
+ }
8323
+ if (state5 === 1) {
8324
+ if (c.node !== null && unhold === null) unhold = holdSubtree2(c.node);
8325
+ drop = c.held.wait(attempt, attempt);
8326
+ return;
8327
+ }
8328
+ if (unhold !== null) {
8329
+ const release = unhold;
8330
+ unhold = null;
8331
+ release();
8332
+ continue;
8333
+ }
8334
+ if (!clean) {
8335
+ clean = c.teardown?.() !== true;
8336
+ continue;
8337
+ }
8338
+ finish();
8339
+ c.insert();
8340
+ return;
8341
+ }
8342
+ };
8343
+ slot4.cancel = cancel;
8344
+ attempt();
8345
+ }
8346
+
8347
+ // src/plugins/router.ts
7908
8348
  init_hydrationHooks();
7909
8349
  init_ssr_context();
7910
8350
  init_serverHead();
@@ -8472,15 +8912,15 @@ var _ComponentLoader = class _ComponentLoader {
8472
8912
  const cached = this.planCache.get(cacheKey);
8473
8913
  if (cached && cached.kind === "factory") return cached.component;
8474
8914
  this.assertNotHot(cacheKey);
8475
- let pending = this.moduleLoads.get(cacheKey);
8476
- const owner = pending === void 0;
8477
- if (pending === void 0) {
8478
- pending = plan.load();
8479
- this.moduleLoads.set(cacheKey, pending);
8915
+ let pending2 = this.moduleLoads.get(cacheKey);
8916
+ const owner = pending2 === void 0;
8917
+ if (pending2 === void 0) {
8918
+ pending2 = plan.load();
8919
+ this.moduleLoads.set(cacheKey, pending2);
8480
8920
  }
8481
8921
  let resolved;
8482
8922
  try {
8483
- resolved = await pending;
8923
+ resolved = await pending2;
8484
8924
  } catch (error) {
8485
8925
  this.noteError(cacheKey);
8486
8926
  throw error;
@@ -8502,7 +8942,14 @@ var _ComponentLoader = class _ComponentLoader {
8502
8942
  * is a configuration error, not something to chase.
8503
8943
  */
8504
8944
  async instantiateFactory(component, route2, routePath, scope, depth = 0) {
8505
- const build = () => scope ? runWithOwnerScope2(scope, component) : component();
8945
+ const gate = scope?.gate;
8946
+ if (gate) {
8947
+ while (gate.held()) if (!await gate.until()) throw gate.cancellation();
8948
+ if (scope?.current?.() === false) throw gate.cancellation();
8949
+ }
8950
+ const owner = scope?.owner;
8951
+ const invoke = () => scope ? runWithOwnerScope2(scope, component) : component();
8952
+ const build = owner ? () => owner.run(invoke) : invoke;
8506
8953
  const result = scope?.adopt ? inScope(scope.adopt, build) : build();
8507
8954
  const value = this.isThenable(result) ? await result : result;
8508
8955
  if (this.isElement(value)) return value;
@@ -8711,7 +9158,7 @@ var _SibuRouter = class _SibuRouter {
8711
9158
  return this.loadedPromise;
8712
9159
  }
8713
9160
  createInitialRoute() {
8714
- return {
9161
+ const route2 = {
8715
9162
  path: "/",
8716
9163
  params: {},
8717
9164
  query: {},
@@ -8720,6 +9167,8 @@ var _SibuRouter = class _SibuRouter {
8720
9167
  meta: {},
8721
9168
  matched: []
8722
9169
  };
9170
+ bootstrapRoutes.add(route2);
9171
+ return route2;
8723
9172
  }
8724
9173
  handleLocationChange(skipHistory = true, initialResolution = false) {
8725
9174
  const path2 = this.getCurrentPath();
@@ -8760,8 +9209,31 @@ var _SibuRouter = class _SibuRouter {
8760
9209
  matched
8761
9210
  };
8762
9211
  }
9212
+ /**
9213
+ * Once no navigation is in flight: if the route is still the placeholder
9214
+ * the router started with — every navigation that could have replaced it
9215
+ * was cancelled by a guard, failed, or was a duplicate — that IS the
9216
+ * outcome, and the outlets that rendered nothing for it settle (see
9217
+ * `settleEmpty`). Checked when a navigation has definitively completed,
9218
+ * never from `isReady` (set before the guards run). A navigation still
9219
+ * pending — a newer one, or a guard that never resolves — keeps them
9220
+ * pending; an outlet's enter is bounded by its own deadline then.
9221
+ */
9222
+ settleBootstrap() {
9223
+ if (this.destroyed || this.navigator.isNavigating) return;
9224
+ const current2 = untracked2(() => this.currentRouteGetter());
9225
+ if (!bootstrapRoutes.delete(current2)) return;
9226
+ const waiting = bootstrapWaiters.get(current2);
9227
+ bootstrapWaiters.delete(current2);
9228
+ if (waiting) for (const settle of waiting) settle();
9229
+ }
8763
9230
  // Public API
8764
9231
  async navigate(to, options = {}) {
9232
+ const result = await this.attemptNavigation(to, options);
9233
+ this.settleBootstrap();
9234
+ return result;
9235
+ }
9236
+ async attemptNavigation(to, options) {
8765
9237
  try {
8766
9238
  await this.navigator.navigate(async (signal2) => {
8767
9239
  const targetPath = this.resolvePath(to);
@@ -9015,6 +9487,13 @@ var _SibuRouter = class _SibuRouter {
9015
9487
  /**
9016
9488
  * Create exactly one real instance from an already-resolved plan. With a
9017
9489
  * `scope`, the factory runs in it (see `RouteScope`).
9490
+ *
9491
+ * When the scope belongs to an outlet whose branch is paused (playing a
9492
+ * leave it may still be taken back from), a lazy module that resolves does
9493
+ * not run its factory yet: the promise stays pending and continues once the
9494
+ * branch resumes. If the branch ends, or the outlet's pass was superseded
9495
+ * meanwhile, it rejects with a `DOMException` named `"AbortError"`. Genuine
9496
+ * loader and component failures reject with their own error, as before.
9018
9497
  */
9019
9498
  async instantiateComponent(plan, route2, routePath, scope) {
9020
9499
  return prerenderWait(this.loader.instantiate(plan, route2, routePath, scope), `router:render ${route2.path}`);
@@ -9263,6 +9742,21 @@ var RouteScope = class {
9263
9742
  constructor(route2) {
9264
9743
  /** Creation scope the instance is built in (adopting hydration); see `adoptScope`. */
9265
9744
  this.adopt = null;
9745
+ /**
9746
+ * The outlet's pause gate: while the branch holding the outlet is paused (it
9747
+ * began a leave and may still be taken back), a lazy module that resolves
9748
+ * does not get its factory invoked yet; instantiation waits for the branch
9749
+ * to resume, and is cancelled if it ends.
9750
+ */
9751
+ this.gate = null;
9752
+ /** Whether the outlet pass this instance is for is still the current one. */
9753
+ this.current = null;
9754
+ /**
9755
+ * The instance's structural owner, nested under the outlet's: its factory
9756
+ * runs as it, so what it creates is paused with the branch holding the
9757
+ * outlet, and ends (`lifecycleScope()` work included) with the instance.
9758
+ */
9759
+ this.owner = null;
9266
9760
  this.released = false;
9267
9761
  const [get, set] = signal(route2);
9268
9762
  this.get = get;
@@ -9289,6 +9783,112 @@ var RouteScope = class {
9289
9783
  queueMicrotask(() => this.set(null));
9290
9784
  }
9291
9785
  };
9786
+ var NOOP3 = () => {
9787
+ };
9788
+ var bootstrapRoutes = /* @__PURE__ */ new WeakSet();
9789
+ var bootstrapWaiters = /* @__PURE__ */ new WeakMap();
9790
+ function settleEmpty(route2, loaded, current2) {
9791
+ if (!bootstrapRoutes.has(route2)) {
9792
+ loaded.done();
9793
+ return;
9794
+ }
9795
+ let waiting = bootstrapWaiters.get(route2);
9796
+ if (waiting === void 0) bootstrapWaiters.set(route2, waiting = /* @__PURE__ */ new Set());
9797
+ waiting.add(() => {
9798
+ if (current2()) loaded.done();
9799
+ });
9800
+ }
9801
+ var cancellations = /* @__PURE__ */ new WeakSet();
9802
+ function pauseGate(frozen) {
9803
+ let closed = false;
9804
+ const pending2 = /* @__PURE__ */ new Set();
9805
+ return {
9806
+ held: () => closed || frozen(),
9807
+ until: () => {
9808
+ if (closed) return Promise.resolve(false);
9809
+ return new Promise((resolve) => {
9810
+ const settle = (active) => {
9811
+ pending2.delete(cancel);
9812
+ resolve(active && !closed);
9813
+ };
9814
+ const drop = frozen.wait(
9815
+ () => settle(true),
9816
+ () => settle(false)
9817
+ );
9818
+ const cancel = () => {
9819
+ drop();
9820
+ settle(false);
9821
+ };
9822
+ pending2.add(cancel);
9823
+ });
9824
+ },
9825
+ cancellation: () => {
9826
+ const error = new DOMException("Route instantiation cancelled: its branch was released", "AbortError");
9827
+ cancellations.add(error);
9828
+ return error;
9829
+ },
9830
+ close: () => {
9831
+ closed = true;
9832
+ for (const cancel of [...pending2]) cancel();
9833
+ },
9834
+ run: frozen.run,
9835
+ frozen,
9836
+ closed: () => closed,
9837
+ onClose: (fn) => {
9838
+ pending2.add(fn);
9839
+ return () => {
9840
+ pending2.delete(fn);
9841
+ };
9842
+ }
9843
+ };
9844
+ }
9845
+ function whenActive(gate, fn) {
9846
+ if (!gate.held()) fn();
9847
+ else
9848
+ void gate.until().then((active) => {
9849
+ if (active) whenActive(gate, fn);
9850
+ });
9851
+ }
9852
+ function commitPass(gate, c) {
9853
+ const frozen = gate.frozen;
9854
+ const held = {
9855
+ state: frozen.state,
9856
+ wait: (onActive, onEnd) => {
9857
+ let live = true;
9858
+ const later = (fn) => () => {
9859
+ void Promise.resolve().then(() => {
9860
+ if (live) fn();
9861
+ });
9862
+ };
9863
+ const drop = frozen.wait(later(onActive), later(onEnd));
9864
+ return () => {
9865
+ live = false;
9866
+ drop();
9867
+ };
9868
+ }
9869
+ };
9870
+ return new Promise((resolve, reject) => {
9871
+ const slot4 = { cancel: NOOP3 };
9872
+ const untrack = gate.onClose(() => slot4.cancel());
9873
+ const settle = (fn) => () => {
9874
+ untrack();
9875
+ try {
9876
+ fn();
9877
+ resolve();
9878
+ } catch (error) {
9879
+ reject(error);
9880
+ }
9881
+ };
9882
+ commitWhenActive(slot4, {
9883
+ held,
9884
+ node: c.node,
9885
+ owned: () => !gate.closed() && c.owned(),
9886
+ teardown: c.teardown,
9887
+ insert: settle(c.insert),
9888
+ discard: settle(c.discard)
9889
+ });
9890
+ });
9891
+ }
9292
9892
  function activeRouteScope() {
9293
9893
  const scope = getOwnerScope2();
9294
9894
  return scope instanceof RouteScope ? scope : null;
@@ -9302,14 +9902,27 @@ function scopedRoute(router2) {
9302
9902
  return router2.currentRoute;
9303
9903
  }
9304
9904
  var instanceScopes = /* @__PURE__ */ new WeakMap();
9305
- async function instantiateScoped(router2, plan, routeDef, routePath, route2, adopt = null) {
9905
+ async function instantiateScoped(router2, plan, routeDef, routePath, route2, adopt = null, gate = null, current2 = null) {
9306
9906
  const scope = new RouteScope(route2);
9307
9907
  scope.adopt = adopt;
9308
- const node = await router2.instantiateComponent(plan, routeDef, routePath, scope);
9908
+ scope.gate = gate;
9909
+ scope.current = current2;
9910
+ const owner = gate ? gate.run(() => structuralBinding2(NOOP3)) : structuralBinding2(NOOP3);
9911
+ scope.owner = owner;
9912
+ let node;
9913
+ try {
9914
+ node = await router2.instantiateComponent(plan, routeDef, routePath, scope);
9915
+ } catch (error) {
9916
+ owner.stop();
9917
+ throw error;
9918
+ }
9309
9919
  if (node) {
9310
9920
  instanceScopes.set(node, scope);
9311
- registerDisposer(node, () => scope.release());
9312
- }
9921
+ registerDisposer(node, () => {
9922
+ owner.stop();
9923
+ scope.release();
9924
+ });
9925
+ } else owner.stop();
9313
9926
  return node;
9314
9927
  }
9315
9928
  function updateInstanceRoute(node, route2) {
@@ -9408,6 +10021,8 @@ function instanceKey(owner, records, route2) {
9408
10021
  function Route() {
9409
10022
  const anchor = document.createComment("route-outlet");
9410
10023
  const adoptScope = captureScope();
10024
+ const frozen = captureFrozen2();
10025
+ const gate = pauseGate(frozen);
9411
10026
  let currentNode = null;
9412
10027
  let loadingNode = null;
9413
10028
  let errorNode = null;
@@ -9415,6 +10030,7 @@ function Route() {
9415
10030
  let currentTopRoute = null;
9416
10031
  let currentKey = null;
9417
10032
  let routeTorn = false;
10033
+ const loaded = beginLoading(anchor);
9418
10034
  const commitTarget = (seq) => routeTorn || seq !== navSeq ? null : anchor.parentNode;
9419
10035
  const retryIfDetached = (seq) => {
9420
10036
  if (!routeTorn && seq === navSeq && !anchor.parentNode) attachWait.request();
@@ -9459,24 +10075,54 @@ function Route() {
9459
10075
  loadingNode = null;
9460
10076
  }
9461
10077
  };
9462
- const showError = (error, routeDef) => {
10078
+ const showError = (seq, error, routeDef) => {
9463
10079
  if (!anchor.parentNode) return;
9464
- cleanupNodes();
9465
- errorNode = document.createElement("div");
9466
- errorNode.className = "route-error";
9467
- errorNode.setAttribute("role", "alert");
9468
- errorNode.setAttribute("aria-live", "assertive");
10080
+ const view = errorView(error, routeDef);
10081
+ void commitPass(gate, {
10082
+ node: view,
10083
+ owned: () => !routeTorn && seq === navSeq,
10084
+ discard: () => dispose(view),
10085
+ teardown: () => {
10086
+ if (!anchor.parentNode || !(currentNode || loadingNode || errorNode)) return false;
10087
+ cleanupNodes();
10088
+ return true;
10089
+ },
10090
+ insert: () => {
10091
+ const parent = anchor.parentNode;
10092
+ if (!parent) {
10093
+ dispose(view);
10094
+ unshownFailure = { seq, error, routeDef };
10095
+ attachWait.request();
10096
+ return;
10097
+ }
10098
+ errorNode = view;
10099
+ try {
10100
+ parent.insertBefore(view, anchor.nextSibling);
10101
+ } catch (err) {
10102
+ if (errorNode === view) errorNode = null;
10103
+ release(view);
10104
+ throw err;
10105
+ }
10106
+ if (!routeTorn && seq === navSeq) loaded.done();
10107
+ }
10108
+ }).catch((err) => console.error("[Route] Error view failed:", err));
10109
+ };
10110
+ const errorView = (error, routeDef) => {
10111
+ const errorNode2 = document.createElement("div");
10112
+ errorNode2.className = "route-error";
10113
+ errorNode2.setAttribute("role", "alert");
10114
+ errorNode2.setAttribute("aria-live", "assertive");
9469
10115
  if (routeDef && "component" in routeDef) {
9470
10116
  const src = routeDef.component.toString();
9471
10117
  const importMatch = src.match(/import\(["']([^"']+)["']\)/);
9472
10118
  if (importMatch) {
9473
- errorNode.setAttribute("data-component-source", importMatch[1]);
10119
+ errorNode2.setAttribute("data-component-source", importMatch[1]);
9474
10120
  }
9475
10121
  if (routeDef.component.name) {
9476
- errorNode.setAttribute("data-component-name", routeDef.component.name);
10122
+ errorNode2.setAttribute("data-component-name", routeDef.component.name);
9477
10123
  }
9478
10124
  }
9479
- errorNode.__routeError = error;
10125
+ errorNode2.__routeError = error;
9480
10126
  const title2 = document.createElement("h3");
9481
10127
  title2.textContent = "Route Error";
9482
10128
  title2.className = "route-error-title";
@@ -9495,10 +10141,10 @@ function Route() {
9495
10141
  };
9496
10142
  retryButton.addEventListener("click", onRetryClick);
9497
10143
  registerDisposer(retryButton, () => retryButton.removeEventListener("click", onRetryClick));
9498
- errorNode.appendChild(title2);
9499
- errorNode.appendChild(message);
9500
- errorNode.appendChild(retryButton);
9501
- anchor.parentNode.insertBefore(errorNode, anchor.nextSibling);
10144
+ errorNode2.appendChild(title2);
10145
+ errorNode2.appendChild(message);
10146
+ errorNode2.appendChild(retryButton);
10147
+ return errorNode2;
9502
10148
  };
9503
10149
  const update = async () => {
9504
10150
  routerRevision();
@@ -9511,12 +10157,14 @@ function Route() {
9511
10157
  currentTopRoute = null;
9512
10158
  currentKey = null;
9513
10159
  cleanupNodes();
10160
+ settleEmpty(route2, loaded, () => !routeTorn && seq === navSeq);
9514
10161
  return;
9515
10162
  }
9516
10163
  const routeDef = match.matched[0] || match.route;
9517
10164
  const key = instanceKey(routeDef, [routeDef], route2);
9518
10165
  if (routeDef === currentTopRoute && key === currentKey && currentNode) {
9519
10166
  updateInstanceRoute(currentNode, route2);
10167
+ loaded.done();
9520
10168
  return;
9521
10169
  }
9522
10170
  if ("redirect" in routeDef) {
@@ -9535,6 +10183,7 @@ function Route() {
9535
10183
  showLoading();
9536
10184
  }
9537
10185
  const plan = await _routerRef.current.loadPlan(routeDef, route2.path);
10186
+ while (gate.held()) if (!await gate.until()) return;
9538
10187
  if (!commitTarget(seq)) {
9539
10188
  retryIfDetached(seq);
9540
10189
  return;
@@ -9545,28 +10194,57 @@ function Route() {
9545
10194
  routeDef,
9546
10195
  route2.path,
9547
10196
  route2,
9548
- keyedScope(adoptScope, routeDef.path)
10197
+ keyedScope(adoptScope, routeDef.path),
10198
+ gate,
10199
+ () => commitTarget(seq) !== null
9549
10200
  );
9550
- const parent = commitTarget(seq);
9551
- if (!parent) {
9552
- release(node);
9553
- retryIfDetached(seq);
9554
- return;
9555
- }
9556
- if (node) {
9557
- currentTopRoute = routeDef;
9558
- currentKey = key;
9559
- cleanupNodes();
9560
- parent.insertBefore(node, anchor.nextSibling);
9561
- currentNode = node;
9562
- }
10201
+ await commitPass(gate, {
10202
+ node,
10203
+ owned: () => !routeTorn && seq === navSeq,
10204
+ discard: () => release(node),
10205
+ // The outgoing views go first — only when there is a page to
10206
+ // show, and a parent to show it in.
10207
+ teardown: () => {
10208
+ if (!node || !anchor.parentNode || !(currentNode || loadingNode || errorNode)) return false;
10209
+ cleanupNodes();
10210
+ return true;
10211
+ },
10212
+ insert: () => {
10213
+ const parent = commitTarget(seq);
10214
+ if (!parent) {
10215
+ release(node);
10216
+ retryIfDetached(seq);
10217
+ return;
10218
+ }
10219
+ if (node) {
10220
+ currentTopRoute = routeDef;
10221
+ currentKey = key;
10222
+ currentNode = node;
10223
+ try {
10224
+ parent.insertBefore(node, anchor.nextSibling);
10225
+ } catch (error) {
10226
+ if (currentNode === node) {
10227
+ currentNode = null;
10228
+ currentTopRoute = null;
10229
+ currentKey = null;
10230
+ }
10231
+ release(node);
10232
+ throw error;
10233
+ }
10234
+ }
10235
+ if (!routeTorn && seq === navSeq) loaded.done();
10236
+ }
10237
+ });
9563
10238
  } catch (error) {
10239
+ if (cancellations.has(error)) return;
9564
10240
  if (routeTorn || seq !== navSeq) return;
9565
- hideLoading();
9566
10241
  console.error("[Route] Component error:", error);
10242
+ while (gate.held()) if (!await gate.until()) return;
10243
+ if (routeTorn || seq !== navSeq) return;
10244
+ hideLoading();
9567
10245
  fail(seq, error, routeDef);
9568
10246
  }
9569
- }
10247
+ } else settleEmpty(route2, loaded, () => !routeTorn && seq === navSeq);
9570
10248
  } catch (error) {
9571
10249
  if (seq !== navSeq) return;
9572
10250
  if (routeTorn) return;
@@ -9578,16 +10256,20 @@ function Route() {
9578
10256
  const fail = (seq, error, routeDef) => {
9579
10257
  const err = error instanceof Error ? error : new Error(String(error));
9580
10258
  if (anchor.parentNode) {
9581
- showError(err, routeDef);
10259
+ showError(seq, err, routeDef);
9582
10260
  return;
9583
10261
  }
9584
10262
  unshownFailure = { seq, error: err, routeDef };
9585
10263
  attachWait.request();
9586
10264
  };
9587
10265
  const onAttached = () => {
10266
+ if (gate.held()) {
10267
+ void gate.until().then((active) => active && onAttached());
10268
+ return;
10269
+ }
9588
10270
  const failure = unshownFailure;
9589
10271
  unshownFailure = null;
9590
- if (failure && failure.seq === navSeq) showError(failure.error, failure.routeDef);
10272
+ if (failure && failure.seq === navSeq) showError(failure.seq, failure.error, failure.routeDef);
9591
10273
  else update();
9592
10274
  };
9593
10275
  let routeInitialized = false;
@@ -9597,11 +10279,16 @@ function Route() {
9597
10279
  routeInitialized = true;
9598
10280
  };
9599
10281
  const attachWait = attachRetry(anchor, onAttached);
9600
- const routeTeardown = track2(wrappedUpdate);
10282
+ const routeTeardown = reactiveBinding2(wrappedUpdate, anchor);
9601
10283
  if (!routeInitialized) {
9602
10284
  queueMicrotask(
9603
10285
  bindOwnerScope2(() => {
9604
- if (!routeInitialized && anchor.parentNode) wrappedUpdate();
10286
+ whenActive(
10287
+ gate,
10288
+ bindOwnerScope2(() => {
10289
+ if (!routeInitialized && anchor.parentNode) wrappedUpdate();
10290
+ })
10291
+ );
9605
10292
  })
9606
10293
  );
9607
10294
  }
@@ -9609,6 +10296,8 @@ function Route() {
9609
10296
  if (routeTorn) return;
9610
10297
  routeTorn = true;
9611
10298
  navSeq++;
10299
+ gate.close();
10300
+ loaded.cancel();
9612
10301
  routeTeardown();
9613
10302
  attachWait.cancel();
9614
10303
  unshownFailure = null;
@@ -9616,6 +10305,7 @@ function Route() {
9616
10305
  currentTopRoute = null;
9617
10306
  currentKey = null;
9618
10307
  };
10308
+ registerNodesRange(anchor, () => [currentNode, loadingNode, errorNode]);
9619
10309
  registerDisposer(anchor, routeCleanup);
9620
10310
  routeCleanups.push(routeCleanup);
9621
10311
  return anchor;
@@ -9623,17 +10313,44 @@ function Route() {
9623
10313
  function KeepAliveRoute(options) {
9624
10314
  if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
9625
10315
  const anchor = document.createComment("keep-alive-route");
9626
- const cache = /* @__PURE__ */ new Map();
10316
+ const cache2 = /* @__PURE__ */ new Map();
9627
10317
  const lruOrder = [];
10318
+ const frozen = captureFrozen2();
10319
+ const gate = pauseGate(frozen);
9628
10320
  const routerOpts = _routerRef.current["options"];
9629
10321
  const keepAliveOpt = routerOpts.keepAlive;
9630
10322
  const maxCache = options?.max ?? (typeof keepAliveOpt === "number" ? keepAliveOpt : 20);
9631
10323
  const includeNames = options?.include ?? (Array.isArray(keepAliveOpt) ? keepAliveOpt : void 0);
10324
+ const suspendInactive = options?.suspendInactive === true;
10325
+ const suspended = /* @__PURE__ */ new Map();
10326
+ const suspend = (node) => {
10327
+ if (!suspendInactive || suspended.has(node)) return;
10328
+ const owner = instanceScopes.get(node)?.owner ?? null;
10329
+ owner?.freeze?.();
10330
+ suspended.set(node, { owner, unhold: holdSubtree2(node) });
10331
+ };
10332
+ const activate = (node) => {
10333
+ const paused = suspended.get(node);
10334
+ if (paused === void 0) return;
10335
+ suspended.delete(node);
10336
+ paused.unhold();
10337
+ paused.owner?.thaw?.();
10338
+ };
10339
+ const disposeCached = (node) => {
10340
+ const paused = suspended.get(node);
10341
+ suspended.delete(node);
10342
+ try {
10343
+ disposeOwned(node);
10344
+ } finally {
10345
+ paused?.unhold();
10346
+ }
10347
+ };
9632
10348
  let currentNode = null;
9633
10349
  let currentKey = "";
9634
10350
  let currentCached = false;
9635
10351
  let updateSeq = 0;
9636
10352
  let kaTorn = false;
10353
+ const loaded = beginLoading(anchor);
9637
10354
  const update = async () => {
9638
10355
  routerRevision();
9639
10356
  if (kaTorn || !_routerRef.current) return;
@@ -9641,7 +10358,10 @@ function KeepAliveRoute(options) {
9641
10358
  const router2 = _routerRef.current;
9642
10359
  const route2 = scopedRoute(router2);
9643
10360
  const match = router2["matcher"].match(route2.path);
9644
- if (!match) return;
10361
+ if (!match) {
10362
+ settleEmpty(route2, loaded, () => !kaTorn && seq === updateSeq);
10363
+ return;
10364
+ }
9645
10365
  const { route: routeDef } = match;
9646
10366
  if ("redirect" in routeDef) {
9647
10367
  const redirectPath = typeof routeDef.redirect === "function" ? routeDef.redirect(route2) : routeDef.redirect;
@@ -9652,11 +10372,15 @@ function KeepAliveRoute(options) {
9652
10372
  });
9653
10373
  return;
9654
10374
  }
9655
- if (!("component" in routeDef)) return;
10375
+ if (!("component" in routeDef)) {
10376
+ settleEmpty(route2, loaded, () => !kaTorn && seq === updateSeq);
10377
+ return;
10378
+ }
9656
10379
  const cacheKey = JSON.stringify([route2.path, queryIdentity(route2.queryAll), route2.hash]);
9657
10380
  const shouldCache = !includeNames || routeDef.name != null && includeNames.includes(routeDef.name);
9658
10381
  if (cacheKey === currentKey && currentNode) {
9659
10382
  updateInstanceRoute(currentNode, route2);
10383
+ loaded.done();
9660
10384
  return;
9661
10385
  }
9662
10386
  if (!anchor.parentNode) {
@@ -9665,87 +10389,148 @@ function KeepAliveRoute(options) {
9665
10389
  }
9666
10390
  let node = null;
9667
10391
  let fromCache = false;
9668
- if (shouldCache && cache.has(cacheKey)) {
9669
- node = cache.get(cacheKey);
10392
+ if (shouldCache && cache2.has(cacheKey)) {
10393
+ node = cache2.get(cacheKey);
9670
10394
  fromCache = true;
9671
10395
  } else {
9672
10396
  try {
9673
10397
  const plan = await router2.loadPlan(routeDef, route2.path);
10398
+ while (gate.held()) if (!await gate.until()) return;
9674
10399
  if (kaTorn || seq !== updateSeq) return;
9675
- node = await instantiateScoped(router2, plan, routeDef, route2.path, route2);
10400
+ node = await instantiateScoped(
10401
+ router2,
10402
+ plan,
10403
+ routeDef,
10404
+ route2.path,
10405
+ route2,
10406
+ null,
10407
+ gate,
10408
+ () => !kaTorn && seq === updateSeq
10409
+ );
9676
10410
  } catch (error) {
9677
- if (kaTorn || seq !== updateSeq) return;
10411
+ if (cancellations.has(error) || kaTorn || seq !== updateSeq) return;
9678
10412
  console.error("[KeepAliveRoute] Component error:", error);
10413
+ loaded.cancel();
9679
10414
  return;
9680
10415
  }
9681
- if (!node) return;
9682
- if (kaTorn || seq !== updateSeq) {
9683
- disposeOwned(node);
10416
+ if (!node) {
10417
+ if (!kaTorn && seq === updateSeq) loaded.done();
9684
10418
  return;
9685
10419
  }
9686
10420
  }
9687
- const parent = anchor.parentNode;
9688
- if (!parent) {
10421
+ await commit(seq, node, fromCache, cacheKey, shouldCache, route2);
10422
+ };
10423
+ const commit = (seq, node, fromCache, cacheKey, shouldCache, route2) => commitPass(gate, {
10424
+ node: fromCache ? null : node,
10425
+ owned: () => !kaTorn && seq === updateSeq,
10426
+ discard: () => {
9689
10427
  if (!fromCache) disposeOwned(node);
9690
- attachWait.request();
9691
- return;
9692
- }
9693
- if (currentNode && currentNode !== node) {
9694
- if (currentNode.parentNode) currentNode.parentNode.removeChild(currentNode);
9695
- if (!currentCached) disposeOwned(currentNode);
9696
- }
9697
- if (fromCache) {
9698
- updateInstanceRoute(node, route2);
9699
- const idx = lruOrder.indexOf(cacheKey);
9700
- if (idx !== -1) lruOrder.splice(idx, 1);
9701
- lruOrder.push(cacheKey);
9702
- } else if (shouldCache) {
9703
- cache.set(cacheKey, node);
9704
- lruOrder.push(cacheKey);
9705
- while (lruOrder.length > maxCache) {
10428
+ },
10429
+ // The outgoing view goes first: detached, and disposed unless it is
10430
+ // cached (then paused, with `suspendInactive`). Once only: it is no
10431
+ // longer the current view afterwards.
10432
+ teardown: () => {
10433
+ const outgoing = currentNode;
10434
+ if (outgoing === null || outgoing === node || !anchor.parentNode) return false;
10435
+ const wasCached = currentCached;
10436
+ currentNode = null;
10437
+ currentKey = "";
10438
+ currentCached = false;
10439
+ outgoing.parentNode?.removeChild(outgoing);
10440
+ if (!wasCached) disposeOwned(outgoing);
10441
+ else if (!kaTorn) suspend(outgoing);
10442
+ return true;
10443
+ },
10444
+ insert: () => {
10445
+ const parent = anchor.parentNode;
10446
+ if (!parent) {
10447
+ if (!fromCache) disposeOwned(node);
10448
+ attachWait.request();
10449
+ return;
10450
+ }
10451
+ if (fromCache) {
10452
+ updateInstanceRoute(node, route2);
10453
+ const idx = lruOrder.indexOf(cacheKey);
10454
+ if (idx !== -1) lruOrder.splice(idx, 1);
10455
+ lruOrder.push(cacheKey);
10456
+ } else if (shouldCache) {
10457
+ cache2.set(cacheKey, node);
10458
+ lruOrder.push(cacheKey);
10459
+ }
10460
+ currentNode = node;
10461
+ currentCached = fromCache || shouldCache;
10462
+ currentKey = cacheKey;
10463
+ try {
10464
+ parent.insertBefore(node, anchor.nextSibling);
10465
+ } catch (error) {
10466
+ if (currentNode === node) {
10467
+ currentNode = null;
10468
+ currentKey = "";
10469
+ currentCached = false;
10470
+ }
10471
+ if (!fromCache) {
10472
+ if (cache2.get(cacheKey) === node) {
10473
+ cache2.delete(cacheKey);
10474
+ const at = lruOrder.lastIndexOf(cacheKey);
10475
+ if (at !== -1) lruOrder.splice(at, 1);
10476
+ }
10477
+ disposeOwned(node);
10478
+ }
10479
+ console.error("[KeepAliveRoute] Component error:", error);
10480
+ if (!kaTorn && seq === updateSeq) loaded.cancel();
10481
+ return;
10482
+ }
10483
+ if (kaTorn) return;
10484
+ if (seq === updateSeq) loaded.done();
10485
+ if (fromCache) activate(node);
10486
+ while (!kaTorn && lruOrder.length > maxCache) {
9706
10487
  const evictKey = lruOrder.shift();
9707
10488
  if (evictKey === cacheKey) {
9708
10489
  lruOrder.push(evictKey);
9709
10490
  break;
9710
10491
  }
9711
- const evictNode = cache.get(evictKey);
10492
+ const evictNode = cache2.get(evictKey);
10493
+ cache2.delete(evictKey);
9712
10494
  if (evictNode) {
9713
- disposeOwned(evictNode);
9714
- if (evictNode.parentNode) evictNode.parentNode.removeChild(evictNode);
9715
- cache.delete(evictKey);
10495
+ disposeCached(evictNode);
10496
+ evictNode.parentNode?.removeChild(evictNode);
9716
10497
  }
9717
10498
  }
9718
10499
  }
9719
- currentNode = node;
9720
- currentCached = fromCache || shouldCache;
9721
- currentKey = cacheKey;
9722
- parent.insertBefore(node, anchor.nextSibling);
9723
- };
10500
+ });
9724
10501
  let initialized = false;
9725
10502
  const wrappedUpdate = async () => {
9726
10503
  await update();
9727
10504
  initialized = true;
9728
10505
  };
9729
- const attachWait = attachRetry(anchor, update);
9730
- const kaTeardown = track2(wrappedUpdate);
10506
+ const attachWait = attachRetry(anchor, () => whenActive(gate, update));
10507
+ const kaTeardown = reactiveBinding2(wrappedUpdate, anchor);
9731
10508
  if (!initialized) {
9732
10509
  queueMicrotask(
9733
10510
  bindOwnerScope2(() => {
9734
- if (!initialized && anchor.parentNode) wrappedUpdate();
10511
+ whenActive(
10512
+ gate,
10513
+ bindOwnerScope2(() => {
10514
+ if (!initialized && anchor.parentNode) wrappedUpdate();
10515
+ })
10516
+ );
9735
10517
  })
9736
10518
  );
9737
10519
  }
9738
10520
  const kaCleanup = () => {
9739
10521
  if (kaTorn) return;
9740
10522
  kaTorn = true;
10523
+ gate.close();
10524
+ loaded.cancel();
9741
10525
  updateSeq++;
9742
10526
  kaTeardown();
9743
10527
  attachWait.cancel();
9744
- for (const node of cache.values()) {
9745
- disposeOwned(node);
10528
+ for (const node of cache2.values()) {
10529
+ disposeCached(node);
9746
10530
  if (node.parentNode) node.parentNode.removeChild(node);
9747
10531
  }
9748
- cache.clear();
10532
+ cache2.clear();
10533
+ suspended.clear();
9749
10534
  lruOrder.length = 0;
9750
10535
  if (currentNode?.parentNode) currentNode.parentNode.removeChild(currentNode);
9751
10536
  if (currentNode && !currentCached) disposeOwned(currentNode);
@@ -9753,6 +10538,7 @@ function KeepAliveRoute(options) {
9753
10538
  currentKey = "";
9754
10539
  currentCached = false;
9755
10540
  };
10541
+ registerNodesRange(anchor, () => [currentNode]);
9756
10542
  registerDisposer(anchor, kaCleanup);
9757
10543
  routeCleanups.push(kaCleanup);
9758
10544
  return anchor;
@@ -9828,6 +10614,15 @@ function Suspense(props) {
9828
10614
  const anchor = document.createComment("suspense-boundary");
9829
10615
  let currentNode = null;
9830
10616
  let fallbackNode = null;
10617
+ const frozen = captureFrozen2();
10618
+ let contentOwner = structuralBinding2(NOOP3);
10619
+ let fallbackOwner = null;
10620
+ const endContent = () => {
10621
+ const owner = contentOwner;
10622
+ contentOwner = null;
10623
+ owner?.stop();
10624
+ };
10625
+ const loaded = beginLoading(anchor);
9831
10626
  let isLoading = false;
9832
10627
  let generation = 0;
9833
10628
  let tornDown = false;
@@ -9842,21 +10637,36 @@ function Suspense(props) {
9842
10637
  release(fallbackNode);
9843
10638
  currentNode = null;
9844
10639
  fallbackNode = null;
10640
+ endFallback();
10641
+ };
10642
+ const endFallback = () => {
10643
+ const owner = fallbackOwner;
10644
+ fallbackOwner = null;
10645
+ owner?.stop();
9845
10646
  };
9846
10647
  const showFallback = (myGeneration) => {
9847
10648
  if (fallbackNode || !props.fallback || tornDown) return;
9848
10649
  if (!anchor.parentNode) return;
9849
10650
  let fallback;
9850
10651
  try {
9851
- fallback = typeof props.fallback === "function" ? props.fallback() : props.fallback;
10652
+ const factory = props.fallback;
10653
+ if (typeof factory === "function") {
10654
+ const owner = fallbackOwner = frozen.run(() => structuralBinding2(NOOP3));
10655
+ fallback = owner.run(factory);
10656
+ } else fallback = factory;
9852
10657
  } catch (error) {
9853
10658
  console.error("[Suspense] Fallback error:", error);
10659
+ endFallback();
10660
+ return;
10661
+ }
10662
+ if (!fallback || fallback.nodeType !== 1) {
10663
+ endFallback();
9854
10664
  return;
9855
10665
  }
9856
- if (!fallback || fallback.nodeType !== 1) return;
9857
10666
  const parent = commitTarget(myGeneration);
9858
10667
  if (!parent) {
9859
10668
  release(fallback);
10669
+ endFallback();
9860
10670
  return;
9861
10671
  }
9862
10672
  fallbackNode = fallback;
@@ -9867,7 +10677,9 @@ function Suspense(props) {
9867
10677
  isLoading = true;
9868
10678
  const myGeneration = ++generation;
9869
10679
  try {
9870
- const result = props.nodes();
10680
+ const owner = contentOwner;
10681
+ if (owner === null) return;
10682
+ const result = owner.run(props.nodes);
9871
10683
  let element;
9872
10684
  const isNode = typeof result?.nodeType === "number";
9873
10685
  if (!isNode && result != null && typeof result.then === "function") {
@@ -9876,35 +10688,84 @@ function Suspense(props) {
9876
10688
  } else {
9877
10689
  element = result;
9878
10690
  }
9879
- const parent = commitTarget(myGeneration);
9880
- if (!parent) {
9881
- release(element);
9882
- cleanupNodes();
9883
- return;
9884
- }
9885
- cleanupNodes();
9886
- parent.insertBefore(element, anchor.nextSibling);
9887
- currentNode = element;
10691
+ settle(myGeneration, true, element);
9888
10692
  } catch (error) {
9889
10693
  console.error("[Suspense] Nodes error:", error);
9890
- const parent = commitTarget(myGeneration);
9891
- cleanupNodes();
9892
- if (!parent) return;
9893
- const errorElement = document.createElement("div");
9894
- errorElement.className = "suspense-error";
9895
- errorElement.textContent = error instanceof Error ? error.message : "Failed to load";
9896
- parent.insertBefore(errorElement, anchor.nextSibling);
9897
- currentNode = errorElement;
10694
+ endContent();
10695
+ settle(myGeneration, false, error);
9898
10696
  } finally {
9899
10697
  isLoading = false;
9900
10698
  }
9901
10699
  };
10700
+ const committing = { cancel: NOOP3 };
10701
+ let dropWait = null;
10702
+ const settle = (myGeneration, ok, value) => {
10703
+ let view;
10704
+ if (ok) view = value;
10705
+ else {
10706
+ view = document.createElement("div");
10707
+ view.className = "suspense-error";
10708
+ view.textContent = value instanceof Error ? value.message : "Failed to load";
10709
+ }
10710
+ commitWhenActive(committing, {
10711
+ held: frozen,
10712
+ node: view,
10713
+ owned: () => !tornDown && myGeneration === generation,
10714
+ // Never shown: the content (or what is left of it) is abandoned.
10715
+ discard: () => {
10716
+ release(view);
10717
+ endContent();
10718
+ loaded.cancel();
10719
+ },
10720
+ teardown: () => {
10721
+ if (!anchor.parentNode || !(currentNode || fallbackNode || fallbackOwner)) return false;
10722
+ cleanupNodes();
10723
+ return true;
10724
+ },
10725
+ insert: () => {
10726
+ const parent = commitTarget(myGeneration);
10727
+ if (!parent) {
10728
+ release(view);
10729
+ cleanupNodes();
10730
+ endContent();
10731
+ loaded.cancel();
10732
+ return;
10733
+ }
10734
+ currentNode = view;
10735
+ try {
10736
+ parent.insertBefore(view, anchor.nextSibling);
10737
+ } catch (error) {
10738
+ if (currentNode === view) currentNode = null;
10739
+ release(view);
10740
+ endContent();
10741
+ console.error("[Suspense] Nodes error:", error);
10742
+ if (ok) settle(myGeneration, false, error);
10743
+ else loaded.cancel();
10744
+ return;
10745
+ }
10746
+ if (!tornDown && myGeneration === generation) loaded.done();
10747
+ }
10748
+ });
10749
+ };
10750
+ registerNodesRange(anchor, () => [currentNode, fallbackNode]);
9902
10751
  registerDisposer(anchor, () => {
9903
10752
  tornDown = true;
9904
10753
  generation++;
10754
+ dropWait?.();
10755
+ dropWait = null;
10756
+ committing.cancel();
9905
10757
  cleanupNodes();
10758
+ endContent();
10759
+ loaded.cancel();
9906
10760
  });
9907
- queueMicrotask(bindOwnerScope2(render));
10761
+ const renderInScope = bindOwnerScope2(() => {
10762
+ if (!tornDown) render();
10763
+ });
10764
+ queueMicrotask(
10765
+ bindOwnerScope2(() => {
10766
+ dropWait = frozen.wait(renderInScope, NOOP3);
10767
+ })
10768
+ );
9908
10769
  return anchor;
9909
10770
  }
9910
10771
  var LAZY_MARKER = /* @__PURE__ */ Symbol.for("sibujs:lazy");
@@ -9966,11 +10827,14 @@ function __removeRouterPagehideHandler() {
9966
10827
  function Outlet() {
9967
10828
  const anchor = document.createComment("route-outlet-nested");
9968
10829
  const adoptScope = captureScope();
10830
+ const frozen = captureFrozen2();
10831
+ const gate = pauseGate(frozen);
9969
10832
  let currentNode = null;
9970
10833
  let currentChild = null;
9971
10834
  let currentKey = null;
9972
10835
  let navSeq = 0;
9973
10836
  let outletTorn = false;
10837
+ const loaded = beginLoading(anchor);
9974
10838
  const clearCurrent = () => {
9975
10839
  if (currentNode) {
9976
10840
  disposeOwned(currentNode);
@@ -9996,21 +10860,25 @@ function Outlet() {
9996
10860
  const route2 = scopedRoute(_routerRef.current);
9997
10861
  if (route2.matched.length < 2) {
9998
10862
  clearCurrent();
10863
+ settleEmpty(route2, loaded, () => !outletTorn && seq === navSeq);
9999
10864
  return;
10000
10865
  }
10001
10866
  const childRoute = route2.matched[route2.matched.length - 1];
10002
10867
  if (!childRoute || !("component" in childRoute)) {
10003
10868
  clearCurrent();
10869
+ loaded.done();
10004
10870
  return;
10005
10871
  }
10006
10872
  const key = instanceKey(childRoute, route2.matched.slice(1), route2);
10007
10873
  if (childRoute === currentChild && key === currentKey && currentNode) {
10008
10874
  updateInstanceRoute(currentNode, route2);
10875
+ loaded.done();
10009
10876
  return;
10010
10877
  }
10011
10878
  try {
10012
10879
  const cacheKey = `${route2.path}\0${childRoute.path}`;
10013
10880
  const plan = await _routerRef.current.loadPlan(childRoute, cacheKey);
10881
+ while (gate.held()) if (!await gate.until()) return;
10014
10882
  if (!commitTarget(seq)) {
10015
10883
  retryIfDetached(seq);
10016
10884
  return;
@@ -10021,31 +10889,64 @@ function Outlet() {
10021
10889
  childRoute,
10022
10890
  cacheKey,
10023
10891
  route2,
10024
- keyedScope(adoptScope, childRoute.path)
10892
+ keyedScope(adoptScope, childRoute.path),
10893
+ gate,
10894
+ () => commitTarget(seq) !== null
10025
10895
  );
10026
- const parent = commitTarget(seq);
10027
- if (!parent) {
10028
- release(node);
10029
- retryIfDetached(seq);
10030
- return;
10031
- }
10032
- if (!node) return;
10033
- clearCurrent();
10034
- parent.insertBefore(node, anchor.nextSibling);
10035
- currentNode = node;
10036
- currentChild = childRoute;
10037
- currentKey = key;
10896
+ await commitPass(gate, {
10897
+ node,
10898
+ owned: () => !outletTorn && seq === navSeq,
10899
+ discard: () => release(node),
10900
+ teardown: () => {
10901
+ if (!node || !anchor.parentNode || !currentNode) return false;
10902
+ clearCurrent();
10903
+ return true;
10904
+ },
10905
+ insert: () => {
10906
+ const parent = commitTarget(seq);
10907
+ if (!parent) {
10908
+ release(node);
10909
+ retryIfDetached(seq);
10910
+ return;
10911
+ }
10912
+ if (node) {
10913
+ currentNode = node;
10914
+ currentChild = childRoute;
10915
+ currentKey = key;
10916
+ try {
10917
+ parent.insertBefore(node, anchor.nextSibling);
10918
+ } catch (error) {
10919
+ if (currentNode === node) {
10920
+ currentNode = null;
10921
+ currentChild = null;
10922
+ currentKey = null;
10923
+ }
10924
+ release(node);
10925
+ throw error;
10926
+ }
10927
+ }
10928
+ if (!outletTorn && seq === navSeq) loaded.done();
10929
+ }
10930
+ });
10038
10931
  } catch (error) {
10039
- if (outletTorn || seq !== navSeq) return;
10932
+ if (cancellations.has(error) || outletTorn || seq !== navSeq) return;
10040
10933
  console.error("[Outlet] Failed to render child route:", error);
10934
+ loaded.cancel();
10041
10935
  }
10042
10936
  };
10043
- const attachWait = attachRetry(anchor, update);
10044
- const outletTeardown = track2(update);
10937
+ const attachWait = attachRetry(anchor, () => whenActive(gate, update));
10938
+ const outletTeardown = reactiveBinding2(() => {
10939
+ void update();
10940
+ }, anchor);
10045
10941
  if (!anchor.parentNode) {
10046
10942
  queueMicrotask(
10047
10943
  bindOwnerScope2(() => {
10048
- if (anchor.parentNode) update();
10944
+ whenActive(
10945
+ gate,
10946
+ bindOwnerScope2(() => {
10947
+ if (anchor.parentNode) update();
10948
+ })
10949
+ );
10049
10950
  })
10050
10951
  );
10051
10952
  }
@@ -10053,6 +10954,8 @@ function Outlet() {
10053
10954
  if (outletTorn) return;
10054
10955
  outletTorn = true;
10055
10956
  navSeq++;
10957
+ gate.close();
10958
+ loaded.cancel();
10056
10959
  outletTeardown();
10057
10960
  attachWait.cancel();
10058
10961
  if (currentNode) {
@@ -10063,6 +10966,7 @@ function Outlet() {
10063
10966
  currentChild = null;
10064
10967
  currentKey = null;
10065
10968
  };
10969
+ registerNodesRange(anchor, () => [currentNode]);
10066
10970
  registerDisposer(anchor, outletCleanup);
10067
10971
  routeCleanups.push(outletCleanup);
10068
10972
  return anchor;
@@ -10325,7 +11229,7 @@ function renderRouteToString(url, routes, _options) {
10325
11229
  };
10326
11230
  }
10327
11231
  function renderRouteToDocument(url, routes, options) {
10328
- const { html: html2, state: state3 } = renderRouteToString(url, routes, options);
11232
+ const { html: html2, state: state5 } = renderRouteToString(url, routes, options);
10329
11233
  const opts = options || {};
10330
11234
  const metaTags = (opts.meta || []).map((attrs) => serializeHeadEntry("meta", attrs)).filter(Boolean).join("\n ");
10331
11235
  const linkTags = (opts.links || []).map((attrs) => serializeHeadEntry("link", attrs)).filter(Boolean).join("\n ");
@@ -10334,7 +11238,7 @@ function renderRouteToDocument(url, routes, options) {
10334
11238
  if (!safe) return "";
10335
11239
  return `<script src="${escapeAttrLocal(safe)}"></script>`;
10336
11240
  }).filter(Boolean).join("\n ");
10337
- const stateScript = serializeRouteState(state3, opts.nonce);
11241
+ const stateScript = serializeRouteState(state5, opts.nonce);
10338
11242
  return `<!DOCTYPE html>
10339
11243
  <html>
10340
11244
  <head>
@@ -10352,8 +11256,8 @@ function renderRouteToDocument(url, routes, options) {
10352
11256
  </body>
10353
11257
  </html>`;
10354
11258
  }
10355
- function serializeRouteState(state3, nonce) {
10356
- const json = escapeScriptJson(JSON.stringify(state3));
11259
+ function serializeRouteState(state5, nonce) {
11260
+ const json = escapeScriptJson(JSON.stringify(state5));
10357
11261
  const nonceAttr = nonce ? ` nonce="${escapeAttrLocal(nonce)}"` : "";
10358
11262
  return `<script${nonceAttr}>window.${SSR_ROUTE_STATE_KEY}=${json}</script>`;
10359
11263
  }
@@ -10436,24 +11340,24 @@ function assertCacheSize(name, value) {
10436
11340
  throw new RangeError(`[Startup] ${name} must be a non-negative integer, got ${value}`);
10437
11341
  }
10438
11342
  }
10439
- function makeRoomFor(cache, key, maxSize, isValid) {
11343
+ function makeRoomFor(cache2, key, maxSize, isValid) {
10440
11344
  if (maxSize === 0) return false;
10441
- if (cache.has(key)) return true;
10442
- if (cache.size < maxSize) return true;
10443
- for (const [k, entry] of cache) {
10444
- if (!isValid(entry)) cache.delete(k);
11345
+ if (cache2.has(key)) return true;
11346
+ if (cache2.size < maxSize) return true;
11347
+ for (const [k, entry] of cache2) {
11348
+ if (!isValid(entry)) cache2.delete(k);
10445
11349
  }
10446
- while (cache.size >= maxSize) {
11350
+ while (cache2.size >= maxSize) {
10447
11351
  let oldestKey = null;
10448
11352
  let oldestTime = Infinity;
10449
- for (const [k, entry] of cache) {
11353
+ for (const [k, entry] of cache2) {
10450
11354
  if (entry.timestamp < oldestTime) {
10451
11355
  oldestTime = entry.timestamp;
10452
11356
  oldestKey = k;
10453
11357
  }
10454
11358
  }
10455
11359
  if (oldestKey === null) break;
10456
- cache.delete(oldestKey);
11360
+ cache2.delete(oldestKey);
10457
11361
  }
10458
11362
  return true;
10459
11363
  }
@@ -10461,57 +11365,57 @@ function prerenderRoutes(routes, options) {
10461
11365
  const maxCacheSize = options?.maxCacheSize ?? 50;
10462
11366
  const cacheTTL = options?.cacheTTL ?? 0;
10463
11367
  assertCacheSize("maxCacheSize", maxCacheSize);
10464
- const cache = /* @__PURE__ */ new Map();
11368
+ const cache2 = /* @__PURE__ */ new Map();
10465
11369
  function isValid(entry) {
10466
11370
  if (cacheTTL === 0) return true;
10467
11371
  return Date.now() - entry.timestamp < cacheTTL;
10468
11372
  }
10469
11373
  for (const route2 of routes) {
10470
- if (!makeRoomFor(cache, route2.path, maxCacheSize, isValid)) break;
11374
+ if (!makeRoomFor(cache2, route2.path, maxCacheSize, isValid)) break;
10471
11375
  const html2 = renderToString(route2.component());
10472
- cache.set(route2.path, { html: html2, timestamp: Date.now() });
11376
+ cache2.set(route2.path, { html: html2, timestamp: Date.now() });
10473
11377
  }
10474
11378
  return {
10475
11379
  /** Get cached HTML for a route, or undefined if not cached or expired */
10476
11380
  get(path2) {
10477
- const entry = cache.get(path2);
11381
+ const entry = cache2.get(path2);
10478
11382
  if (!entry) return void 0;
10479
11383
  if (!isValid(entry)) {
10480
- cache.delete(path2);
11384
+ cache2.delete(path2);
10481
11385
  return void 0;
10482
11386
  }
10483
11387
  return entry.html;
10484
11388
  },
10485
11389
  /** Check if a route has been prerendered and is still valid */
10486
11390
  has(path2) {
10487
- const entry = cache.get(path2);
11391
+ const entry = cache2.get(path2);
10488
11392
  if (!entry) return false;
10489
11393
  if (!isValid(entry)) {
10490
- cache.delete(path2);
11394
+ cache2.delete(path2);
10491
11395
  return false;
10492
11396
  }
10493
11397
  return true;
10494
11398
  },
10495
11399
  /** Invalidate a cached route */
10496
11400
  invalidate(path2) {
10497
- cache.delete(path2);
11401
+ cache2.delete(path2);
10498
11402
  },
10499
11403
  /** Clear all cached routes */
10500
11404
  clear() {
10501
- cache.clear();
11405
+ cache2.clear();
10502
11406
  },
10503
11407
  /** Get cache statistics */
10504
11408
  stats() {
10505
11409
  if (cacheTTL > 0) {
10506
- for (const [key, entry] of cache) {
11410
+ for (const [key, entry] of cache2) {
10507
11411
  if (!isValid(entry)) {
10508
- cache.delete(key);
11412
+ cache2.delete(key);
10509
11413
  }
10510
11414
  }
10511
11415
  }
10512
11416
  return {
10513
- size: cache.size,
10514
- routes: Array.from(cache.keys())
11417
+ size: cache2.size,
11418
+ routes: Array.from(cache2.keys())
10515
11419
  };
10516
11420
  }
10517
11421
  };
@@ -10520,7 +11424,7 @@ function createSSRCache(config) {
10520
11424
  const maxSize = config?.maxSize ?? 100;
10521
11425
  const defaultTTL = config?.defaultTTL ?? 6e4;
10522
11426
  assertCacheSize("maxSize", maxSize);
10523
- const cache = /* @__PURE__ */ new Map();
11427
+ const cache2 = /* @__PURE__ */ new Map();
10524
11428
  let hits = 0;
10525
11429
  let misses = 0;
10526
11430
  function isValid(entry) {
@@ -10530,13 +11434,13 @@ function createSSRCache(config) {
10530
11434
  return {
10531
11435
  /** Get cached HTML for a key, or undefined if not cached or expired */
10532
11436
  get(key) {
10533
- const entry = cache.get(key);
11437
+ const entry = cache2.get(key);
10534
11438
  if (!entry) {
10535
11439
  misses++;
10536
11440
  return void 0;
10537
11441
  }
10538
11442
  if (!isValid(entry)) {
10539
- cache.delete(key);
11443
+ cache2.delete(key);
10540
11444
  misses++;
10541
11445
  return void 0;
10542
11446
  }
@@ -10545,8 +11449,8 @@ function createSSRCache(config) {
10545
11449
  },
10546
11450
  /** Cache an HTML string with an optional TTL override */
10547
11451
  set(key, html2, ttl) {
10548
- if (!makeRoomFor(cache, key, maxSize, isValid)) return;
10549
- cache.set(key, {
11452
+ if (!makeRoomFor(cache2, key, maxSize, isValid)) return;
11453
+ cache2.set(key, {
10550
11454
  html: html2,
10551
11455
  timestamp: Date.now(),
10552
11456
  ttl: ttl ?? defaultTTL
@@ -10554,27 +11458,27 @@ function createSSRCache(config) {
10554
11458
  },
10555
11459
  /** Check if a key exists in the cache and is still valid */
10556
11460
  has(key) {
10557
- const entry = cache.get(key);
11461
+ const entry = cache2.get(key);
10558
11462
  if (!entry) return false;
10559
11463
  if (!isValid(entry)) {
10560
- cache.delete(key);
11464
+ cache2.delete(key);
10561
11465
  return false;
10562
11466
  }
10563
11467
  return true;
10564
11468
  },
10565
11469
  /** Invalidate a cached entry */
10566
11470
  invalidate(key) {
10567
- cache.delete(key);
11471
+ cache2.delete(key);
10568
11472
  },
10569
11473
  /** Clear all cached entries and reset statistics */
10570
11474
  clear() {
10571
- cache.clear();
11475
+ cache2.clear();
10572
11476
  hits = 0;
10573
11477
  misses = 0;
10574
11478
  },
10575
11479
  /** Get cache statistics including hit/miss counts */
10576
11480
  stats() {
10577
- return { size: cache.size, hits, misses };
11481
+ return { size: cache2.size, hits, misses };
10578
11482
  }
10579
11483
  };
10580
11484
  }
@@ -10653,7 +11557,7 @@ function createBootSequence() {
10653
11557
 
10654
11558
  // src/plugins/versioning.ts
10655
11559
  init_globalSingleton();
10656
- var VERSION = true ? "4.14.1" : "dev";
11560
+ var VERSION = true ? "4.15.0" : "dev";
10657
11561
  var NUM = "(?:0|[1-9]\\d*)";
10658
11562
  var PRE_ID = `(?:${NUM}|\\d*[a-zA-Z-][0-9a-zA-Z-]*)`;
10659
11563
  var BUILD_ID = "[0-9a-zA-Z-]+";
@@ -10838,9 +11742,9 @@ function createMigrationRunner(config) {
10838
11742
  return serialize(async () => {
10839
11743
  const applied = [];
10840
11744
  const errors = [];
10841
- let pending;
11745
+ let pending2;
10842
11746
  try {
10843
- pending = getPending();
11747
+ pending2 = getPending();
10844
11748
  } catch (e) {
10845
11749
  errors.push({
10846
11750
  version: getAppliedVersion() ?? "",
@@ -10848,7 +11752,7 @@ function createMigrationRunner(config) {
10848
11752
  });
10849
11753
  return { applied, errors };
10850
11754
  }
10851
- for (const migration of pending) {
11755
+ for (const migration of pending2) {
10852
11756
  try {
10853
11757
  await migration.up();
10854
11758
  } catch (e) {