marko 6.3.55 → 6.4.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 (90) hide show
  1. package/cheatsheet.md +3 -2
  2. package/dist/common/accessor.d.ts +3 -0
  3. package/dist/common/accessor.debug.d.ts +3 -0
  4. package/dist/common/constants/accessor-prefix.d.ts +1 -0
  5. package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
  6. package/dist/common/constants/accessor-prop.d.ts +3 -0
  7. package/dist/common/constants/accessor-prop.debug.d.ts +3 -0
  8. package/dist/common/constants/closure-scopes-prop.d.ts +4 -0
  9. package/dist/common/constants/closure-scopes-prop.debug.d.ts +4 -0
  10. package/dist/common/types.d.ts +9 -3
  11. package/dist/debug/dom/catch.feat.js +12 -14
  12. package/dist/debug/dom/catch.feat.mjs +12 -14
  13. package/dist/debug/dom/controllable-input.feat.js +1 -1
  14. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  15. package/dist/debug/dom/controllable-open.feat.js +1 -1
  16. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  17. package/dist/debug/dom/controllable-select.feat.js +1 -1
  18. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  19. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  20. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  21. package/dist/debug/dom/controllable.feat.js +1 -1
  22. package/dist/debug/dom/controllable.feat.mjs +1 -1
  23. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  24. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  25. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  26. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  27. package/dist/debug/dom/lazy.feat.js +4 -0
  28. package/dist/debug/dom/lazy.feat.mjs +4 -0
  29. package/dist/debug/dom/placeholder.feat.js +1 -1
  30. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  31. package/dist/debug/{dom-CI0Vojyk.js → dom-BRO5aArp.js} +248 -193
  32. package/dist/debug/{dom-tl43c2wO.mjs → dom-Btj2QJhk.mjs} +225 -176
  33. package/dist/debug/dom.js +15 -13
  34. package/dist/debug/dom.mjs +15 -13
  35. package/dist/debug/html.js +605 -523
  36. package/dist/debug/html.mjs +604 -524
  37. package/dist/dom/abort-signal.d.ts +2 -0
  38. package/dist/dom/catch.feat.js +6 -7
  39. package/dist/dom/catch.feat.mjs +5 -7
  40. package/dist/dom/control-flow.d.ts +3 -5
  41. package/dist/dom/controllable-input.feat.js +3 -2
  42. package/dist/dom/controllable-input.feat.mjs +1 -1
  43. package/dist/dom/controllable-open.feat.js +3 -2
  44. package/dist/dom/controllable-open.feat.mjs +1 -1
  45. package/dist/dom/controllable-select.feat.js +3 -2
  46. package/dist/dom/controllable-select.feat.mjs +1 -1
  47. package/dist/dom/controllable-textarea.feat.js +3 -2
  48. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  49. package/dist/dom/controllable.feat.js +3 -2
  50. package/dist/dom/controllable.feat.mjs +1 -1
  51. package/dist/dom/dynamic-tag-script.feat.js +3 -2
  52. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  53. package/dist/dom/dynamic-tag-var.feat.js +2 -1
  54. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  55. package/dist/dom/lazy.feat.d.ts +1 -0
  56. package/dist/dom/lazy.feat.js +4 -0
  57. package/dist/dom/lazy.feat.mjs +4 -0
  58. package/dist/dom/load.d.ts +3 -3
  59. package/dist/dom/placeholder.feat.js +4 -3
  60. package/dist/dom/placeholder.feat.mjs +1 -1
  61. package/dist/dom/queue.d.ts +2 -4
  62. package/dist/dom/resume.d.ts +2 -2
  63. package/dist/dom/scope.d.ts +0 -1
  64. package/dist/dom/signals.d.ts +1 -1
  65. package/dist/{dom-4udEPZaj.mjs → dom-B-v8Gw6T.mjs} +122 -92
  66. package/dist/{dom-C1mr-TA7.js → dom-BSsI9OPC.js} +218 -187
  67. package/dist/dom.d.ts +1 -1
  68. package/dist/dom.js +59 -56
  69. package/dist/dom.mjs +35 -33
  70. package/dist/html/attrs.d.ts +2 -0
  71. package/dist/html/writer.d.ts +5 -11
  72. package/dist/html.d.ts +1 -1
  73. package/dist/html.js +367 -327
  74. package/dist/html.mjs +366 -327
  75. package/dist/translator/index.js +866 -748
  76. package/dist/translator/util/binding-has-prop.d.ts +2 -0
  77. package/dist/translator/util/entry-builder.d.ts +2 -0
  78. package/dist/translator/util/generate-uid.d.ts +5 -0
  79. package/dist/translator/util/optional.d.ts +1 -3
  80. package/dist/translator/util/references.d.ts +6 -2
  81. package/dist/translator/util/runtime.d.ts +3 -3
  82. package/dist/translator/util/sections.d.ts +8 -2
  83. package/dist/translator/util/serialize-reasons.d.ts +3 -1
  84. package/dist/translator/util/setup-work.d.ts +5 -0
  85. package/dist/translator/util/signals.d.ts +5 -7
  86. package/dist/translator/util/translate-attrs.d.ts +2 -1
  87. package/dist/translator/visitors/tag/native-tag.d.ts +1 -0
  88. package/package.json +3 -3
  89. package/tags-html.d.ts +4 -3
  90. package/dist/translator/util/setup-statements.d.ts +0 -5
@@ -13,6 +13,7 @@ const KeyedScopes = "KeyedScopes:";
13
13
  const Lifecycle = "Lifecycle:";
14
14
  const Promise$1 = "Promise:";
15
15
  const TagVariableChange$1 = "TagVariableChange:";
16
+ const TryBranch$1 = "TryBranch:";
16
17
  //#endregion
17
18
  //#region src/common/constants/accessor-prop.debug.ts
18
19
  const Global = "$global";
@@ -31,15 +32,21 @@ const Load = "#Load";
31
32
  const LoopKey = "#LoopKey";
32
33
  const ParentBranch = "#ParentBranch";
33
34
  const PendingEffects = "#PendingEffects";
35
+ const PendingEffectScopes = "#PendingEffectScopes";
34
36
  const PendingRenders = "#PendingRenders";
35
37
  const PendingScopes = "#PendingScopes";
36
38
  const PlaceholderBranch = "#PlaceholderBranch";
37
39
  const PlaceholderContent = "#PlaceholderContent";
38
40
  const Renderer = "#Renderer";
41
+ const ReturnValue = "#ReturnValue";
39
42
  const StartNode = "#StartNode";
40
43
  const Subscriptions = "#Subscriptions";
41
44
  const TagVariable = "#TagVariable";
42
45
  const TagVariableChange = "#TagVariableChange";
46
+ const TryBranch = "#TryBranch";
47
+ //#endregion
48
+ //#region src/common/constants/closure-scopes-prop.debug.ts
49
+ const Changed = "Changed";
43
50
  //#endregion
44
51
  //#region src/common/constants/closure-signal-prop.debug.ts
45
52
  const ScopeInstancesAccessor = "scopeInstancesAccessor";
@@ -131,19 +138,21 @@ const toDelimitedString = function toDelimitedString(val, delimiter, stringify)
131
138
  let str = "";
132
139
  let sep = "";
133
140
  let part;
134
- if (val) if (typeof val !== "object") str += val;
135
- else if (Array.isArray(val)) for (const v of val) {
136
- part = toDelimitedString(v, delimiter, stringify);
137
- if (part) {
138
- str += sep + part;
139
- sep = delimiter;
141
+ if (val) {
142
+ if (typeof val !== "object") str += val;
143
+ else if (Array.isArray(val)) for (const v of val) {
144
+ part = toDelimitedString(v, delimiter, stringify);
145
+ if (part) {
146
+ str += sep + part;
147
+ sep = delimiter;
148
+ }
140
149
  }
141
- }
142
- else for (const name in val) {
143
- part = stringify(name, val[name]);
144
- if (part) {
145
- str += sep + part;
146
- sep = delimiter;
150
+ else for (const name in val) {
151
+ part = stringify(name, val[name]);
152
+ if (part) {
153
+ str += sep + part;
154
+ sep = delimiter;
155
+ }
147
156
  }
148
157
  }
149
158
  return str;
@@ -244,7 +253,7 @@ function _hoist_read_error() {
244
253
  throw new Error("Hoisted values can only be read in scripts and event handlers.");
245
254
  }
246
255
  function _assert_hoist(value) {
247
- if (typeof value !== "function") throw new Error(`Hoisted values must be functions, received type "${typeof value}".`);
256
+ if (value !== void 0 && typeof value !== "function") throw new Error(`Hoisted values must be functions, received type "${typeof value}".`);
248
257
  }
249
258
  function assertExclusiveAttrs(attrs, onError = throwErr) {
250
259
  if (attrs) {
@@ -316,8 +325,6 @@ function forUntil(until, from, step, cb) {
316
325
  //#region src/dom/queue.ts
317
326
  let rendering;
318
327
  let runId = 2;
319
- const caughtError = /* @__PURE__ */ new WeakSet();
320
- const placeholderShown = /* @__PURE__ */ new WeakSet();
321
328
  let pendingEffects = [];
322
329
  let pendingRenders = [];
323
330
  const scopeKeyOffset = 1e6;
@@ -394,10 +401,10 @@ let runRender = (render) => {
394
401
  if (!branchesEnabled || render["scope"]["#ClosestBranch"]?.["#Gen"] !== 0) render[Signal](render[Scope], render[Value]);
395
402
  };
396
403
  let catchEnabled;
397
- function installCatch(wrapEffects, wrapRender) {
404
+ function installCatch(catchEffects, wrapRender) {
398
405
  catchEnabled = 1;
399
406
  withBranches();
400
- runEffects = wrapEffects(runEffects);
407
+ runEffects = catchEffects;
401
408
  runRender = wrapRender(runRender);
402
409
  }
403
410
  function runRenders() {
@@ -438,6 +445,12 @@ function $signal(scope, id) {
438
445
  trackCleanup(scope);
439
446
  return ((scope[AbortControllers] ||= {})[id] ||= new AbortController()).signal;
440
447
  }
448
+ /** Runs `abort` as a destroyed scope's `$signal` would fire, without creating one. */
449
+ function trackAbort(scope, id, abort) {
450
+ abortsEnabled = 1;
451
+ trackCleanup(scope);
452
+ (scope[AbortControllers] ||= {})[id] = { abort };
453
+ }
441
454
  /** Enrols `scope` with its branch so destroying the branch cleans it up. */
442
455
  function trackCleanup(scope, subscribers) {
443
456
  const branch = scope[ClosestBranch];
@@ -458,8 +471,10 @@ function toArray(opt) {
458
471
  return opt ? Array.isArray(opt) ? opt : [opt] : [];
459
472
  }
460
473
  function forEach(opt, cb) {
461
- if (opt) if (Array.isArray(opt)) for (const item of opt) cb(item);
462
- else cb(opt);
474
+ if (opt) {
475
+ if (Array.isArray(opt)) for (const item of opt) cb(item);
476
+ else cb(opt);
477
+ }
463
478
  }
464
479
  function push(opt, item) {
465
480
  return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
@@ -534,11 +549,6 @@ function collectScopes(fn) {
534
549
  function skipScope() {
535
550
  return nextScopeId++;
536
551
  }
537
- function findBranchWithKey(scope, key) {
538
- let branch = scope[ClosestBranch];
539
- while (branch && branch[key] == null) branch = branch[ParentBranch];
540
- return branch;
541
- }
542
552
  function destroyBranch(branch) {
543
553
  branch[ParentBranch]?.[BranchScopes]?.delete(branch);
544
554
  destroyNestedScopes(branch);
@@ -629,11 +639,12 @@ function _let_change(id, fn) {
629
639
  const valueChangeAccessor = TagVariableChange$1 + valueAccessor;
630
640
  const base = _let(id, fn);
631
641
  return (scope, value, valueChange) => {
632
- if (rendering) if ((scope[valueChangeAccessor] = valueChange) && (scope[valueAccessor] !== value || !(valueAccessor in scope))) {
633
- scope[valueAccessor] = value;
634
- fn?.(scope);
635
- } else base(scope, value);
636
- else if (scope[valueChangeAccessor]) scope[valueChangeAccessor](value);
642
+ if (rendering) {
643
+ if ((scope[valueChangeAccessor] = valueChange) && (scope[valueAccessor] !== value || !(valueAccessor in scope))) {
644
+ scope[valueAccessor] = value;
645
+ fn?.(scope);
646
+ } else base(scope, value);
647
+ } else if (scope[valueChangeAccessor]) scope[valueChangeAccessor](value);
637
648
  else base(scope, value);
638
649
  return value;
639
650
  };
@@ -648,10 +659,11 @@ function _const(valueAccessor, fn) {
648
659
  }
649
660
  function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id") {
650
661
  return (scope) => {
651
- if (scope["#Gen"] === runId) if (~id in scope) {
652
- if (!--scope[~id]) fn(scope);
653
- } else scope[~id] = defaultPending;
654
- else queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
662
+ if (scope["#Gen"] === runId) {
663
+ if (~id in scope) {
664
+ if (!--scope[~id]) fn(scope);
665
+ } else scope[~id] = defaultPending;
666
+ } else queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
655
667
  };
656
668
  }
657
669
  function _for_closure(ownerLoopNodeAccessor, fn) {
@@ -725,23 +737,22 @@ function _closure(...closureSignals) {
725
737
  for (let i = closureSignals.length; i--;) closureSignals[i][Index] = i;
726
738
  return (scope) => {
727
739
  if (scope[scopeInstances]) {
740
+ scope[scopeInstances][Changed] = 1;
728
741
  for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
729
742
  }
730
743
  };
731
744
  }
732
- function _closure_get(valueAccessor, fn, getOwnerScope, resumeId, ownerValueAccessor) {
745
+ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
733
746
  const closureSignal = ((scope, resumed) => {
734
747
  const ownerScope = getOwnerScope ? getOwnerScope(scope) : scope["_"];
735
748
  scope[closureSignal[SignalIndexAccessor]] = closureSignal[Index];
736
- if (!resumed || ownerValueAccessor in ownerScope) fn(scope);
749
+ if (!resumed) fn(scope);
750
+ else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, closureSignal);
737
751
  subscribeToScopeSet(ownerScope, closureSignal[ScopeInstancesAccessor], scope);
738
752
  });
739
753
  closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
740
754
  closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
741
- if (resumeId) {
742
- ownerValueAccessor = valueAccessor;
743
- _resumed[resumeId] = (scope) => closureSignal(scope, 1);
744
- }
755
+ if (resumeId) _resumed[resumeId] = (scope) => closureSignal(scope, 1);
745
756
  return closureSignal;
746
757
  }
747
758
  function _child_setup(setup) {
@@ -752,9 +763,11 @@ function _child_setup(setup) {
752
763
  return setup;
753
764
  }
754
765
  function _var(scope, childAccessor, signal) {
755
- scope[childAccessor][TagVariable] = (value) => signal(scope, value);
766
+ const childScope = scope[childAccessor];
767
+ childScope[TagVariable] = (value) => signal(scope, value);
768
+ if ("#ReturnValue" in childScope) signal(scope, childScope[ReturnValue]);
756
769
  }
757
- const _return = (scope, value) => scope[TagVariable]?.(value);
770
+ const _return = (scope, value) => scope["#TagVariable"] ? scope[TagVariable](value) : scope[ReturnValue] = value;
758
771
  function _return_change(scope, changeHandler) {
759
772
  scope[TagVariableChange] = changeHandler || void 0;
760
773
  }
@@ -781,7 +794,7 @@ function _script(id, fn) {
781
794
  };
782
795
  }
783
796
  function _global_read($global, key) {
784
- if (!(key in $global)) console.error(`\`$global.${key}\` is not serialized to the client, so this read is \`undefined\`. Add \`${key}\` to \`serializedGlobals\` at the render call.`);
797
+ if (!(key in $global)) console.error(`\`$global.${key}\` is not serialized to the client, so this read is \`undefined\`. Serialized globals are embedded in the page: add \`${key}\` to \`serializedGlobals\` at the render call only if it holds no secrets; otherwise copy the field the client needs into its own \`$global\` key and serialize that.`);
785
798
  return $global[key];
786
799
  }
787
800
  function _el_read(value) {
@@ -790,12 +803,14 @@ function _el_read(value) {
790
803
  }
791
804
  function* traverse(scope, path, args, i = path.length - 1) {
792
805
  if (rendering) _hoist_read_error();
793
- if (scope) if (Symbol.iterator in scope) {
794
- for (const childScope of scope.values()) if (childScope["#Gen"] !== 0) yield* traverse(childScope, path, args, i);
795
- } else {
796
- const item = scope[path[i]];
797
- if (i) yield* traverse(item, path, args, i - 1);
798
- else yield typeof item === "function" ? item(...args) : item;
806
+ if (scope) {
807
+ if (Symbol.iterator in scope) {
808
+ for (const childScope of scope.values()) if (childScope["#Gen"] !== 0) yield* traverse(childScope, path, args, i);
809
+ } else {
810
+ const item = scope[path[i]];
811
+ if (i) yield* traverse(item, path, args, i - 1);
812
+ else yield typeof item === "function" ? item(...args) : item;
813
+ }
799
814
  }
800
815
  }
801
816
  function _hoist(...path) {
@@ -879,9 +894,8 @@ function readyFailed(readyId) {
879
894
  (failedIds ||= /* @__PURE__ */ new Set()).add(readyId);
880
895
  console.error(`The lazy module for "${readyId}" failed to load; its server-rendered content cannot become interactive.`);
881
896
  }
882
- function withLazy(runtime) {
897
+ function withLazy() {
883
898
  lazyEnabled = 1;
884
- return runtime;
885
899
  }
886
900
  function initEmbedded(readyId, runtimeId) {
887
901
  if (!embedRenders) {
@@ -955,7 +969,7 @@ function init(runtimeId = "M") {
955
969
  setParentBranch(branch, branch[ClosestBranch]);
956
970
  if (branch["#AwaitCounter"] = render.p?.[branchId]) branch[AwaitCounter].m = render.m;
957
971
  if (singleNode) {
958
- while (startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling));
972
+ while (startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1);
959
973
  branch["_"] ??= visitScope;
960
974
  branch[EndNode] = branch[StartNode] = startVisit;
961
975
  if (visitType === "(") branch[getDebugKey(0, startVisit)] = startVisit;
@@ -1022,6 +1036,7 @@ function init(runtimeId = "M") {
1022
1036
  let embedAnchor;
1023
1037
  serializeContext._ = _resumed;
1024
1038
  if (render.m) throw new Error(`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`);
1039
+ for (const otherId in curRenders) if (otherId !== renderId && (otherId.startsWith(renderId) || renderId.startsWith(otherId))) console.error(`Marko rendered with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as both ${JSON.stringify(otherId)} and ${JSON.stringify(renderId)}, so one render claims the other's resume comments. Ensure no $global.renderId in a page starts another.`);
1025
1040
  render.m = (effects) => {
1026
1041
  processResumes(render.r, effects);
1027
1042
  if (readyIds && render.b) for (let progress = 1; progress;) {
@@ -1037,13 +1052,14 @@ function init(runtimeId = "M") {
1037
1052
  visitText = visit.data;
1038
1053
  visitType = visitText[lastTokenIndex++];
1039
1054
  visitScope = getScope(nextToken());
1040
- if (dynamicHtmlEnabled && visitType > "%" && visitType <= "'") if (visitType === "&") htmlStart = visit;
1041
- else {
1042
- visitScope[nextToken()] = htmlStart;
1043
- visitScope[DynamicHTMLLastChild + lastToken] = visit;
1044
- if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
1045
- }
1046
- else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
1055
+ if (dynamicHtmlEnabled && visitType > "%" && visitType <= "'") {
1056
+ if (visitType === "&") htmlStart = visit;
1057
+ else {
1058
+ visitScope[nextToken()] = htmlStart;
1059
+ visitScope[DynamicHTMLLastChild + lastToken] = visit;
1060
+ if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
1061
+ }
1062
+ } else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
1047
1063
  else if (lazyEnabled && render.b && visitType > "%") visits[retained++] = visit;
1048
1064
  else {
1049
1065
  visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling;
@@ -1078,7 +1094,7 @@ let isResuming;
1078
1094
  function runResumeEffects(render) {
1079
1095
  try {
1080
1096
  isResuming = 1;
1081
- runEffects(render.m([]), 1);
1097
+ runEffects(render.m([]));
1082
1098
  } finally {
1083
1099
  isResuming = 0;
1084
1100
  }
@@ -1093,7 +1109,7 @@ function _var_resume(id, signal) {
1093
1109
  function _el(id, accessor) {
1094
1110
  return _resumed[id] = (scope) => () => _el_read(scope[accessor]);
1095
1111
  }
1096
- function _resume_dynamic_tag_var(accessor) {
1112
+ function _dynamic_tag_var_resume(accessor) {
1097
1113
  _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => () => {
1098
1114
  const node = scope[accessor];
1099
1115
  return _el_read(node.nodeType === 8 ? node.previousSibling : node);
@@ -1194,8 +1210,10 @@ function _attr(element, name, value) {
1194
1210
  setAttribute(element, name, normalizeAttrValue(value));
1195
1211
  }
1196
1212
  function setAttribute(element, name, value) {
1197
- if (element.getAttribute(name) != value) if (value === void 0) element.removeAttribute(name);
1198
- else element.setAttribute(name, value);
1213
+ if (element.getAttribute(name) != value) {
1214
+ if (value === void 0) element.removeAttribute(name);
1215
+ else element.setAttribute(name, value);
1216
+ }
1199
1217
  }
1200
1218
  function _attr_class(element, value) {
1201
1219
  setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassObject) || void 0);
@@ -1300,7 +1318,6 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
1300
1318
  assertValidAttrName(name);
1301
1319
  if (isEventHandler(name)) (events ||= scope[EventAttributes + nodeAccessor] = {})[getEventHandlerName(name)] = value;
1302
1320
  else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) _attr(el, name, value);
1303
- break;
1304
1321
  }
1305
1322
  }
1306
1323
  }
@@ -1333,8 +1350,10 @@ const _html = /*@__PURE__*/ withDynamicHtml(function _html(scope, value, accesso
1333
1350
  });
1334
1351
  function normalizeClientRender(value) {
1335
1352
  const renderer = normalizeDynamicRenderer(value);
1336
- if (renderer) if (renderer["id"]) return renderer;
1337
- else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
1353
+ if (renderer) {
1354
+ if (renderer["id"]) return renderer;
1355
+ else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
1356
+ }
1338
1357
  }
1339
1358
  function normalizeAttrValue(value) {
1340
1359
  if (isNotVoid(value)) return value === true ? "" : value + "";
@@ -1352,7 +1371,7 @@ function _lifecycle(scope, thisObj, index = 0) {
1352
1371
  Object.assign(thisObj, thisObj.onMount?.());
1353
1372
  for (const prop in snapshot) if (!Object.is(snapshot[prop], thisObj[prop])) throw new Error(`Tried to overwrite existing property "${prop}" in <lifecycle> onMount.`);
1354
1373
  }
1355
- $signal(scope, accessor).onabort = () => thisObj.onDestroy?.();
1374
+ trackAbort(scope, accessor, () => thisObj.onDestroy?.());
1356
1375
  }
1357
1376
  }
1358
1377
  function removeChildNodes(startNode, endNode) {
@@ -1454,8 +1473,10 @@ function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValu
1454
1473
  }
1455
1474
  function _attr_input_checkedValue_script(scope, nodeAccessor) {
1456
1475
  const el = scope[nodeAccessor];
1457
- if (isResuming && el.defaultChecked) if (scope["ControlledValue:" + nodeAccessor]) scope[ControlledValue + nodeAccessor].push(el.value);
1458
- else scope[ControlledValue + nodeAccessor] = el.value;
1476
+ if (isResuming && el.defaultChecked) {
1477
+ if (scope["ControlledValue:" + nodeAccessor]) scope[ControlledValue + nodeAccessor].push(el.value);
1478
+ else scope[ControlledValue + nodeAccessor] = el.value;
1479
+ }
1459
1480
  syncControllableFormInput(el, hasCheckboxChanged, () => {
1460
1481
  const checkedValueChange = scope[ControlledHandler + nodeAccessor];
1461
1482
  if (checkedValueChange) {
@@ -1564,14 +1585,16 @@ function _attr_select_value_script(scope, nodeAccessor) {
1564
1585
  run();
1565
1586
  }
1566
1587
  };
1567
- if (isResuming) if (el.multiple) {
1568
- scope[ControlledValue + nodeAccessor] = [];
1569
- for (const opt of el.options) if (opt.defaultSelected) scope[ControlledValue + nodeAccessor].push(opt.value);
1570
- } else {
1571
- scope[ControlledValue + nodeAccessor] = "";
1572
- for (const opt of el.options) if (opt.defaultSelected) {
1573
- scope[ControlledValue + nodeAccessor] = opt.value;
1574
- break;
1588
+ if (isResuming) {
1589
+ if (el.multiple) {
1590
+ scope[ControlledValue + nodeAccessor] = [];
1591
+ for (const opt of el.options) if (opt.defaultSelected) scope[ControlledValue + nodeAccessor].push(opt.value);
1592
+ } else {
1593
+ scope[ControlledValue + nodeAccessor] = "";
1594
+ for (const opt of el.options) if (opt.defaultSelected) {
1595
+ scope[ControlledValue + nodeAccessor] = opt.value;
1596
+ break;
1597
+ }
1575
1598
  }
1576
1599
  }
1577
1600
  syncControllableFormInput(el, hasSelectChanged, onChange);
@@ -1693,6 +1716,7 @@ function _controllable_open(scope, nodeAccessor, nextAttrs) {
1693
1716
  function _await_promise(nodeAccessor, params) {
1694
1717
  const promiseAccessor = Promise$1 + nodeAccessor;
1695
1718
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1719
+ const tryAccessor = TryBranch$1 + nodeAccessor;
1696
1720
  const resolveAwait = (scope, referenceNode, value) => {
1697
1721
  const awaitBranch = scope[branchAccessor];
1698
1722
  if (awaitBranch["#DetachedAwait"]) {
@@ -1708,80 +1732,73 @@ function _await_promise(nodeAccessor, params) {
1708
1732
  const awaitPromise = (scope, promise) => {
1709
1733
  if (!isPromise(scope[promiseAccessor])) scope[promiseAccessor] = 0;
1710
1734
  let awaitBranch = scope[branchAccessor];
1711
- const tryPlaceholder = (isPromise(promise) || scope[promiseAccessor]) && findBranchWithKey(scope, "#PlaceholderContent");
1712
- const tryBranch = tryPlaceholder || awaitBranch;
1735
+ const tryBranch = scope[tryAccessor] || isPromise(promise) && findTryWithPlaceholder(scope) || awaitBranch;
1713
1736
  if (!tryBranch) {
1714
- const replay = scope[promiseAccessor] = () => replay === scope[promiseAccessor] && awaitPromise(scope, promise);
1715
- const awaitCounter = findBranchWithKey(scope, PlaceholderContent)?.[AwaitCounter];
1737
+ const deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise);
1738
+ const awaitCounter = findTryWithPlaceholder(scope)?.[AwaitCounter];
1716
1739
  if (awaitCounter?.i) {
1717
1740
  const complete = awaitCounter.c;
1718
- awaitCounter.c = () => complete() || queueAsyncRender(scope, replay);
1741
+ awaitCounter.c = () => complete() || queueAsyncRender(scope, deferred);
1719
1742
  }
1720
1743
  return;
1721
1744
  }
1722
- if (!isPromise(promise)) return scope[promiseAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
1745
+ if (!isPromise(promise)) return scope[tryAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
1723
1746
  let awaitCounter = tryBranch[AwaitCounter];
1724
- placeholderShown.add(pendingEffects);
1725
- if (!tryPlaceholder && !awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
1726
- if (tryBranch === scope[branchAccessor]) {
1727
- const anchor = scope[nodeAccessor];
1728
- if (anchor.parentNode) {
1729
- const detachedParent = scope[branchAccessor][StartNode].parentNode;
1730
- if (detachedParent === anchor.parentNode) anchor.remove();
1731
- else anchor.replaceWith(detachedParent);
1732
- }
1733
- }
1734
- });
1735
- if (!scope[promiseAccessor]) {
1736
- if (awaitBranch) awaitBranch[PendingRenders] ||= [];
1737
- if (tryPlaceholder) awaitCounter = addAwaitCounter(scope, tryPlaceholder);
1738
- else scheduleAwaitFrame(awaitCounter, scope, () => {
1739
- if (!awaitBranch["#DetachedAwait"]) {
1740
- awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
1741
- tempDetachBranch(tryBranch);
1742
- }
1747
+ if (!scope[tryAccessor]) {
1748
+ scope[tryAccessor] = tryBranch;
1749
+ trackAbort(scope, promiseAccessor, () => {
1750
+ scope[promiseAccessor] = 0;
1751
+ if (scope[tryAccessor]) queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
1743
1752
  });
1753
+ if (awaitBranch) awaitBranch[PendingRenders] ||= [];
1754
+ if (tryBranch !== awaitBranch) awaitCounter = addAwaitCounter(scope, tryBranch);
1755
+ else {
1756
+ if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
1757
+ if (tryBranch === scope[branchAccessor]) {
1758
+ const anchor = scope[nodeAccessor];
1759
+ if (anchor.parentNode) {
1760
+ const detachedParent = scope[branchAccessor][StartNode].parentNode;
1761
+ if (detachedParent === anchor.parentNode) anchor.remove();
1762
+ else anchor.replaceWith(detachedParent);
1763
+ }
1764
+ }
1765
+ });
1766
+ scheduleAwaitFrame(awaitCounter, scope, () => {
1767
+ if (!awaitBranch["#DetachedAwait"]) {
1768
+ awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
1769
+ tempDetachBranch(tryBranch);
1770
+ }
1771
+ });
1772
+ }
1744
1773
  }
1745
1774
  const thisPromise = scope[promiseAccessor] = promise.then((data) => {
1746
1775
  if (thisPromise === scope[promiseAccessor]) {
1747
1776
  const referenceNode = scope[nodeAccessor];
1748
1777
  scope[promiseAccessor] = 0;
1749
- if (!scope[branchAccessor] || scope["#ClosestBranch"]?.["#Gen"] === 0) {
1750
- if (!scope[branchAccessor]) awaitPromise(scope, data);
1778
+ if (!scope[branchAccessor]) {
1779
+ scope[tryAccessor] = 0;
1780
+ awaitPromise(scope, data);
1751
1781
  awaitCounter.c();
1752
1782
  run();
1753
- return;
1754
- }
1755
- queueAsyncRender(scope, () => {
1756
- awaitBranch = resolveAwait(scope, referenceNode, data);
1757
- const pendingRenders = awaitBranch[PendingRenders];
1758
- awaitBranch[PendingRenders] = 0;
1759
- pendingRenders?.forEach(queuePendingRender);
1760
- placeholderShown.add(pendingEffects);
1761
- awaitCounter.c();
1762
- if (awaitCounter.m) {
1763
- const fnScopes = /* @__PURE__ */ new Map();
1764
- const effects = awaitCounter.m([]);
1765
- for (let i = 0; i < pendingEffects.length;) {
1766
- const fn = pendingEffects[i++];
1767
- let scopes = fnScopes.get(fn);
1768
- if (!scopes) fnScopes.set(fn, scopes = /* @__PURE__ */ new Set());
1769
- scopes.add(pendingEffects[i++]);
1770
- }
1771
- for (let i = 0; i < effects.length;) {
1772
- const fn = effects[i++];
1773
- const scope = effects[i++];
1774
- if (!fnScopes.get(fn)?.has(scope)) queueEffect(scope, fn);
1775
- }
1783
+ } else queueAsyncRender(scope, () => {
1784
+ if (!scope[promiseAccessor]) {
1785
+ awaitBranch = resolveAwait(scope, referenceNode, data);
1786
+ const pendingRenders = awaitBranch[PendingRenders];
1787
+ awaitBranch[PendingRenders] = 0;
1788
+ pendingRenders?.forEach(queuePendingRender);
1789
+ scope[tryAccessor] = 0;
1790
+ queueCompleteAwaitCounter(tryBranch, awaitCounter);
1776
1791
  }
1777
1792
  });
1778
1793
  }
1779
1794
  }, (error) => {
1780
1795
  if (thisPromise === scope[promiseAccessor]) {
1781
- scope[promiseAccessor] = 0;
1782
- if (tryPlaceholder && !awaitCounter.m) awaitCounter.c();
1783
- else awaitCounter.i = 0;
1796
+ scope[promiseAccessor] = scope[tryAccessor] = 0;
1784
1797
  queueAsyncRender(scope, renderCatch, error);
1798
+ if (tryBranch !== awaitBranch && !awaitCounter.m) {
1799
+ if (findTryWithCatch(scope)) queueCompleteAwaitCounter(tryBranch, awaitCounter);
1800
+ else awaitCounter.c();
1801
+ } else awaitCounter.i = 0;
1785
1802
  }
1786
1803
  });
1787
1804
  };
@@ -1797,13 +1814,13 @@ function _await_content(nodeAccessor, template, walks, setup) {
1797
1814
  if (typeof scope[promiseAccessor] === "function") scope[promiseAccessor]();
1798
1815
  };
1799
1816
  }
1800
- function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, PlaceholderContent)) {
1817
+ function addAwaitCounter(scope, tryBranch = findTryWithPlaceholder(scope)) {
1801
1818
  if (!tryBranch) return;
1802
1819
  let awaitCounter = tryBranch[AwaitCounter];
1803
1820
  if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
1804
- placeholderShown.add(pendingEffects);
1805
1821
  scheduleAwaitFrame(awaitCounter, tryBranch, () => {
1806
- insertBranchBefore(tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent], tryBranch["_"], tryBranch[StartNode].parentNode), tryBranch[StartNode].parentNode, tryBranch[StartNode]);
1822
+ (tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent](), tryBranch["_"], tryBranch[StartNode].parentNode))[TryBranch] = tryBranch;
1823
+ insertBranchBefore(tryBranch[PlaceholderBranch], tryBranch[StartNode].parentNode, tryBranch[StartNode]);
1807
1824
  tempDetachBranch(tryBranch);
1808
1825
  });
1809
1826
  return awaitCounter;
@@ -1811,10 +1828,32 @@ function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, Placeholder
1811
1828
  function scheduleAwaitFrame(awaitCounter, scope, render) {
1812
1829
  if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
1813
1830
  }
1831
+ function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
1832
+ queueRender(tryBranch, completeAwaitCounter, -1, awaitCounter, tryBranch["#Id"] + 1e9);
1833
+ }
1834
+ function completeAwaitCounter(_scope, awaitCounter) {
1835
+ awaitCounter.c();
1836
+ if (awaitCounter.m) {
1837
+ const fnScopes = /* @__PURE__ */ new Map();
1838
+ const effects = awaitCounter.m([]);
1839
+ for (let i = 0; i < pendingEffects.length;) {
1840
+ const fn = pendingEffects[i++];
1841
+ let scopes = fnScopes.get(fn);
1842
+ if (!scopes) fnScopes.set(fn, scopes = /* @__PURE__ */ new Set());
1843
+ scopes.add(pendingEffects[i++]);
1844
+ }
1845
+ for (let i = 0; i < effects.length;) {
1846
+ const fn = effects[i++];
1847
+ const scope = effects[i++];
1848
+ if (!fnScopes.get(fn)?.has(scope)) queueEffect(scope, fn);
1849
+ }
1850
+ }
1851
+ }
1814
1852
  function createAwaitCounter(tryBranch, done) {
1815
1853
  const awaitCounter = tryBranch[AwaitCounter] = {
1816
1854
  i: 0,
1817
1855
  c() {
1856
+ if (awaitCounter.i < 1) throw new Error("An await counter completed more counts than it took.");
1818
1857
  if (--awaitCounter.i) return 1;
1819
1858
  done();
1820
1859
  queueEffect(tryBranch, runPendingEffects);
@@ -1822,12 +1861,8 @@ function createAwaitCounter(tryBranch, done) {
1822
1861
  };
1823
1862
  return awaitCounter;
1824
1863
  }
1825
- function runPendingEffects(scope) {
1826
- const effects = scope[PendingEffects];
1827
- if (effects) {
1828
- scope[PendingEffects] = [];
1829
- runEffects(effects, 1);
1830
- }
1864
+ function runPendingEffects(tryBranch) {
1865
+ tryBranch[PendingEffectScopes]?.forEach((scope) => scope[PendingEffects].forEach((fn) => runEffects([fn, scope]), scope[PendingEffects] = null), tryBranch[PendingEffectScopes] = null);
1831
1866
  }
1832
1867
  function dismissPlaceholder(tryBranch) {
1833
1868
  const placeholderBranch = tryBranch[PlaceholderBranch];
@@ -1837,21 +1872,19 @@ function dismissPlaceholder(tryBranch) {
1837
1872
  removeAndDestroyBranch(placeholderBranch);
1838
1873
  }
1839
1874
  }
1840
- function _try(nodeAccessor, template, walks, setup) {
1875
+ function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
1841
1876
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1842
1877
  const renderer = _content("", template, walks, setup)();
1843
- return (scope, input) => {
1844
- if (!scope[branchAccessor]) setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
1878
+ return (scope) => {
1879
+ setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
1845
1880
  const branch = scope[branchAccessor];
1846
- if (branch) {
1847
- branch[BranchAccessor] = nodeAccessor;
1848
- branch[CatchContent] = input.catch && (normalizeDynamicRenderer(input.catch) || 0);
1849
- branch[PlaceholderContent] = normalizeDynamicRenderer(input.placeholder);
1850
- }
1881
+ branch[BranchAccessor] = nodeAccessor;
1882
+ branch[CatchContent] = catchContent;
1883
+ branch[PlaceholderContent] = placeholderContent || void 0;
1851
1884
  };
1852
1885
  }
1853
1886
  function renderCatch(scope, error) {
1854
- const tryWithCatch = findBranchWithKey(scope, CatchContent);
1887
+ const tryWithCatch = findTryWithCatch(scope);
1855
1888
  if (!tryWithCatch) throw error;
1856
1889
  else {
1857
1890
  const owner = tryWithCatch["_"];
@@ -1861,11 +1894,21 @@ function renderCatch(scope, error) {
1861
1894
  owner[BranchScopes$1 + tryWithCatch[BranchAccessor]] = placeholderBranch;
1862
1895
  destroyBranch(tryWithCatch);
1863
1896
  }
1864
- caughtError.add(pendingEffects);
1865
- setConditionalRenderer(owner, tryWithCatch[BranchAccessor], tryWithCatch[CatchContent], createAndSetupBranch);
1866
- tryWithCatch[CatchContent]?.[Params]?.(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], [error]);
1897
+ const catchContent = tryWithCatch[CatchContent]();
1898
+ setConditionalRenderer(owner, tryWithCatch[BranchAccessor], catchContent, createAndSetupBranch);
1899
+ catchContent[Params]?.(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], [error]);
1867
1900
  }
1868
1901
  }
1902
+ function findTryWithPlaceholder(scope) {
1903
+ let branch = scope[ClosestBranch];
1904
+ while (branch && !branch["#PlaceholderContent"]) branch = branch[ParentBranch];
1905
+ return branch;
1906
+ }
1907
+ function findTryWithCatch(scope) {
1908
+ let branch = scope[ClosestBranch];
1909
+ while (branch && !branch["#CatchContent"]) branch = branch["#TryBranch"] || branch["#ParentBranch"];
1910
+ return branch;
1911
+ }
1869
1912
  const _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
1870
1913
  const branchAccessor = ConditionalRenderer + nodeAccessor;
1871
1914
  const branches = [];
@@ -1922,10 +1965,12 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
1922
1965
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
1923
1966
  const renderer = normalizedRenderer || (getContent ? getContent(scope) : void 0);
1924
1967
  setConditionalRenderer(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer);
1925
- if (getTagVar) if (scope[childScopeAccessor]) {
1926
- scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
1927
- if (typeof normalizedRenderer === "string") bindNativeTagVar?.(scope[childScopeAccessor]);
1928
- } else getTagVar()(scope, void 0);
1968
+ if (getTagVar) {
1969
+ if (scope[childScopeAccessor]) {
1970
+ scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
1971
+ if (typeof normalizedRenderer === "string") bindNativeTagVar?.(scope[childScopeAccessor]);
1972
+ } else getTagVar()(scope, void 0);
1973
+ }
1929
1974
  if (typeof renderer === "string") {
1930
1975
  if (getContent) {
1931
1976
  const content = getContent(scope);
@@ -1943,13 +1988,15 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
1943
1988
  if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
1944
1989
  } else {
1945
1990
  normalizedRenderer[LocalClosures]?.(childScope);
1946
- if (normalizedRenderer["params"]) if (inputIsArgs) normalizedRenderer[Params](childScope, normalizedRenderer._ ? args[0] : args);
1947
- else {
1948
- const inputWithContent = getContent ? {
1949
- ...args,
1950
- content: getContent(scope)
1951
- } : args || {};
1952
- normalizedRenderer[Params](childScope, normalizedRenderer._ ? inputWithContent : [inputWithContent]);
1991
+ if (normalizedRenderer["params"]) {
1992
+ if (inputIsArgs) normalizedRenderer[Params](childScope, normalizedRenderer._ ? args[0] : args);
1993
+ else {
1994
+ const inputWithContent = getContent ? {
1995
+ ...args,
1996
+ content: getContent(scope)
1997
+ } : args || {};
1998
+ normalizedRenderer[Params](childScope, normalizedRenderer._ ? inputWithContent : [inputWithContent]);
1999
+ }
1953
2000
  }
1954
2001
  }
1955
2002
  }
@@ -2087,20 +2134,22 @@ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
2087
2134
  let hi;
2088
2135
  let mid;
2089
2136
  for (let i = diffLen; i--;) sources[i] = newScopes[start + i]["#LoopIndex"] ?? -1;
2090
- for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) {
2091
- if (~tail) pred[i] = tails[tail];
2092
- tails[++tail] = i;
2093
- } else {
2094
- lo = 0;
2095
- hi = tail;
2096
- while (lo < hi) {
2097
- mid = (lo + hi) / 2 | 0;
2098
- if (sources[tails[mid]] < sources[i]) lo = mid + 1;
2099
- else hi = mid;
2100
- }
2101
- if (sources[i] < sources[tails[lo]]) {
2102
- if (lo > 0) pred[i] = tails[lo - 1];
2103
- tails[lo] = i;
2137
+ for (let i = 0; i < diffLen; i++) if (~sources[i]) {
2138
+ if (tail < 0 || sources[tails[tail]] < sources[i]) {
2139
+ if (~tail) pred[i] = tails[tail];
2140
+ tails[++tail] = i;
2141
+ } else {
2142
+ lo = 0;
2143
+ hi = tail;
2144
+ while (lo < hi) {
2145
+ mid = (lo + hi) / 2 | 0;
2146
+ if (sources[tails[mid]] < sources[i]) lo = mid + 1;
2147
+ else hi = mid;
2148
+ }
2149
+ if (sources[i] < sources[tails[lo]]) {
2150
+ if (lo > 0) pred[i] = tails[lo - 1];
2151
+ tails[lo] = i;
2152
+ }
2104
2153
  }
2105
2154
  }
2106
2155
  hi = tails[tail];
@@ -2129,4 +2178,4 @@ function byFirstArg(name) {
2129
2178
  return name;
2130
2179
  }
2131
2180
  //#endregion
2132
- export { _attrs_content as $, DYNAMIC_TAG_SCRIPT_REGISTER_ID as $t, _attr_input_value_attribute_default as A, EndNode as An, _closure_get as At, _controllable_textarea as B, _let as Bt, _attr_input_checked as C, Owner as Cn, init as Ct, _attr_input_checked_default as D, Scope as Dn, withLazy as Dt, _attr_input_checkedValue_script as E, Pending as En, readyFailed as Et, _attr_select_value_default as F, PendingEffects as Fn, _global_read as Ft, _attr_class_item as G, _script as Gt, controllableScripts as H, _or as Ht, _attr_select_value_script as I, PendingRenders as In, _hoist as It, _attr_nonce as J, _assert_init as Jt, _attr_class_items as K, _var as Kt, _controllable_input as L, PlaceholderBranch as Ln, _hoist_resume as Lt, _attr_input_value_dynamic_default as M, Global as Mn, _el_read as Mt, _attr_input_value_script as N, Load as Nn, _for_closure as Nt, _attr_input_checked_script as O, AwaitCounter as On, _child_setup as Ot, _attr_select_value as P, ParentBranch as Pn, _for_selector as Pt, _attrs as Q, syncGen as Qt, _controllable_open as R, StartNode as Rn, _id as Rt, _attr_details_or_dialog_open_script as S, Clone as Sn, getRegisteredWithScope as St, _attr_input_checkedValue_default as T, Setup as Tn, ready as Tt, _attr as U, _return as Ut, controllableRenders as V, _let_change as Vt, _attr_class as W, _return_change as Wt, _attr_style_item as X, insertBranchBefore as Xt, _attr_style as Y, destroyBranch as Yt, _attr_style_items as Z, removeAndDestroyBranch as Zt, installDynamicTagVar as _, forUntil as _n, setupBranch as _t, _for_in as a, installCatch as an, _style_rule_item as at, _attr_details_or_dialog_open as b, _call as bn, _resumed as bt, _for_to as c, queueAsyncRender as cn, _text_content as ct, _for_until_unkeyed as d, run as dn, toInsertNode as dt, PLACEHOLDER_DISMISS_REGISTER_ID as en, _attrs_partial as et, _if as f, runEffects as fn, _content as ft, dynamicTagScript as g, forTo as gn, createBranch as gt, addAwaitCounter as h, forOf as hn, createAndSetupBranch as ht, _dynamic_tag_content as i, caughtError as in, _lifecycle as it, _attr_input_value_default as j, Gen$1 as jn, _const as jt, _attr_input_value as k, ClosestBranch as kn, _closure as kt, _for_to_unkeyed as l, queueEffect as ln, _to_text as lt, _try as m, forIn as mn, _content_resume as mt, _await_promise as n, $signal as nn, _attrs_script as nt, _for_of as o, placeholderShown as on, _style_shell as ot, _show as p, runId as pn, _content_closures as pt, _attr_content as q, _var_change as qt, _dynamic_tag as r, $signalReset as rn, _html as rt, _for_of_unkeyed as s, prepareEffects as sn, _text as st, _await_content as t, _on as tn, _attrs_partial_content as tt, _for_until as u, queueRender as un, insertChildNodes as ut, patchDynamicTag as v, _assert_hoist as vn, _el as vt, _attr_input_checkedValue as w, Params as wn, initEmbedded as wt, _attr_details_or_dialog_open_default as x, withBranches as xn, _var_resume as xt, renderCatch as y, _hoist_read_error as yn, _resume_dynamic_tag_var as yt, _controllable_select as z, TagVariable as zn, _if_closure as zt };
2181
+ export { _attrs as $, syncGen as $t, _attr_input_value as A, EndNode as An, _closure as At, _controllable_select as B, TagVariable as Bn, _if_closure as Bt, _attr_details_or_dialog_open_script as C, Owner as Cn, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, Scope as Dn, readyFailed as Dt, _attr_input_checkedValue_default as E, Pending as En, ready as Et, _attr_select_value as F, PendingEffectScopes as Fn, _for_selector as Ft, _attr_class as G, _return_change as Gt, controllableRenders as H, _let_change as Ht, _attr_select_value_default as I, PendingEffects as In, _global_read as It, _attr_content as J, _var_change as Jt, _attr_class_item as K, _script as Kt, _attr_select_value_script as L, PendingRenders as Ln, _hoist as Lt, _attr_input_value_default as M, Global as Mn, _const as Mt, _attr_input_value_dynamic_default as N, Load as Nn, _el_read as Nt, _attr_input_checked_default as O, AwaitCounter as On, withLazy as Ot, _attr_input_value_script as P, ParentBranch as Pn, _for_closure as Pt, _attr_style_items as Q, removeAndDestroyBranch as Qt, _controllable_input as R, PlaceholderBranch as Rn, _hoist_resume as Rt, _attr_details_or_dialog_open_default as S, Clone as Sn, _var_resume as St, _attr_input_checkedValue as T, Setup as Tn, initEmbedded as Tt, controllableScripts as U, _or as Ut, _controllable_textarea as V, _let as Vt, _attr as W, _return as Wt, _attr_style as X, destroyBranch as Xt, _attr_nonce as Y, _assert_init as Yt, _attr_style_item as Z, insertBranchBefore as Zt, installDynamicTagVar as _, forUntil as _n, createBranch as _t, _for_in as a, installCatch as an, _lifecycle as at, runPendingEffects as b, _call as bn, _el as bt, _for_to as c, queueEffect as cn, _text as ct, _for_until_unkeyed as d, run as dn, insertChildNodes as dt, DYNAMIC_TAG_SCRIPT_REGISTER_ID as en, _attrs_content as et, _if as f, runEffects as fn, toInsertNode as ft, dynamicTagScript as g, forTo as gn, createAndSetupBranch as gt, addAwaitCounter as h, forOf as hn, _content_resume as ht, _dynamic_tag_content as i, $signalReset as in, _html as it, _attr_input_value_attribute_default as j, Gen$1 as jn, _closure_get as jt, _attr_input_checked_script as k, ClosestBranch as kn, _child_setup as kt, _for_to_unkeyed as l, queueRender as ln, _text_content as lt, _try as m, forIn as mn, _content_closures as mt, _await_promise as n, _on as nn, _attrs_partial_content as nt, _for_of as o, prepareEffects as on, _style_rule_item as ot, _show as p, runId as pn, _content as pt, _attr_class_items as q, _var as qt, _dynamic_tag as r, $signal as rn, _attrs_script as rt, _for_of_unkeyed as s, queueAsyncRender as sn, _style_shell as st, _await_content as t, PLACEHOLDER_DISMISS_REGISTER_ID as tn, _attrs_partial as tt, _for_until as u, rendering as un, _to_text as ut, patchDynamicTag as v, _assert_hoist as vn, setupBranch as vt, _attr_input_checked as w, Params as wn, init as wt, _attr_details_or_dialog_open as x, withBranches as xn, _resumed as xt, renderCatch as y, _hoist_read_error as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, StartNode as zn, _id as zt };