marko 6.3.51 → 6.3.52

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 (67) hide show
  1. package/dist/debug/dom/catch.feat.js +1 -1
  2. package/dist/debug/dom/catch.feat.mjs +1 -1
  3. package/dist/debug/dom/controllable-input.feat.js +1 -1
  4. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  5. package/dist/debug/dom/controllable-open.feat.js +1 -1
  6. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-select.feat.js +1 -1
  8. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  10. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable.feat.js +1 -1
  12. package/dist/debug/dom/controllable.feat.mjs +1 -1
  13. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
  14. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
  15. package/dist/debug/dom/placeholder.feat.js +2 -2
  16. package/dist/debug/dom/placeholder.feat.mjs +2 -2
  17. package/dist/debug/{dom-BAGeiafn.js → dom-BJKb8-wr.js} +22 -27
  18. package/dist/debug/{dom-C55iHvof.mjs → dom-Dq_Yu7MS.mjs} +19 -18
  19. package/dist/debug/dom.js +10 -10
  20. package/dist/debug/dom.mjs +10 -10
  21. package/dist/debug/html.js +56 -40
  22. package/dist/debug/html.mjs +56 -40
  23. package/dist/dom/catch.feat.js +3 -3
  24. package/dist/dom/catch.feat.mjs +1 -1
  25. package/dist/dom/controllable-input.feat.js +1 -1
  26. package/dist/dom/controllable-input.feat.mjs +1 -1
  27. package/dist/dom/controllable-open.feat.js +1 -1
  28. package/dist/dom/controllable-open.feat.mjs +1 -1
  29. package/dist/dom/controllable-select.feat.js +1 -1
  30. package/dist/dom/controllable-select.feat.mjs +1 -1
  31. package/dist/dom/controllable-textarea.feat.js +1 -1
  32. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  33. package/dist/dom/controllable.feat.js +1 -1
  34. package/dist/dom/controllable.feat.mjs +1 -1
  35. package/dist/dom/dynamic-tag-var.feat.js +3 -2
  36. package/dist/dom/dynamic-tag-var.feat.mjs +4 -3
  37. package/dist/dom/placeholder.feat.js +3 -3
  38. package/dist/dom/placeholder.feat.mjs +2 -2
  39. package/dist/dom/resume.d.ts +1 -2
  40. package/dist/{dom-BNmfm4st.js → dom-CzGPOsST.js} +62 -71
  41. package/dist/{dom-BsAS26Ze.mjs → dom-CzfddxCE.mjs} +15 -19
  42. package/dist/dom.d.ts +1 -1
  43. package/dist/dom.js +30 -30
  44. package/dist/dom.mjs +10 -10
  45. package/dist/html/template.d.ts +3 -1
  46. package/dist/html/writer.d.ts +6 -1
  47. package/dist/html.js +40 -25
  48. package/dist/html.mjs +40 -25
  49. package/dist/translator/core/await.d.ts +0 -7
  50. package/dist/translator/core/try.d.ts +0 -7
  51. package/dist/translator/index.d.ts +1 -1
  52. package/dist/translator/index.js +1888 -1656
  53. package/dist/translator/util/binding-has-prop.d.ts +1 -1
  54. package/dist/translator/util/cyclic-memo.d.ts +4 -0
  55. package/dist/translator/util/evaluate.d.ts +2 -0
  56. package/dist/translator/util/optional.d.ts +21 -7
  57. package/dist/translator/util/references.d.ts +53 -21
  58. package/dist/translator/util/runtime.d.ts +3 -1
  59. package/dist/translator/util/sections.d.ts +10 -11
  60. package/dist/translator/util/serialize-guard.d.ts +10 -0
  61. package/dist/translator/util/serialize-reasons.d.ts +10 -11
  62. package/dist/translator/util/set-tag-sections-downstream.d.ts +3 -2
  63. package/dist/translator/util/tag-name-type.d.ts +8 -3
  64. package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -2
  65. package/index.d.ts +0 -5
  66. package/package.json +3 -3
  67. package/tags-html.d.ts +2 -0
@@ -568,6 +568,7 @@ var Reference = class {
568
568
  flushId;
569
569
  pos;
570
570
  id;
571
+ path = null;
571
572
  constructor(parent, accessor, flushId, pos = null, id = null) {
572
573
  this.parent = parent;
573
574
  this.accessor = accessor;
@@ -791,7 +792,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
791
792
  addAssignment(ref, accessId(state, parent) + toAccess(accessor));
792
793
  return false;
793
794
  }
794
- state.buf.push(ensureId(state, ref));
795
+ writeRef(state, ref);
795
796
  return true;
796
797
  }
797
798
  const registered = REGISTRY.get(val);
@@ -835,7 +836,7 @@ function writeString(state, val, parent, accessor) {
835
836
  const ref = state.strs.get(val);
836
837
  if (ref) {
837
838
  if (trackChannel(state, ref)) {
838
- state.buf.push(ensureId(state, ref));
839
+ writeRef(state, ref);
839
840
  return true;
840
841
  }
841
842
  } else {
@@ -1660,6 +1661,15 @@ function quote(str, startPos) {
1660
1661
  }
1661
1662
  return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
1662
1663
  }
1664
+ function writeRef(state, ref) {
1665
+ if (ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId)) {
1666
+ ref.path = accessPath(state, ref);
1667
+ ref.pos = state.buf.length;
1668
+ ref.flushId = state.flushId;
1669
+ ref.channel = state.channel;
1670
+ state.buf.push(ref.path);
1671
+ } else state.buf.push(ensureId(state, ref));
1672
+ }
1663
1673
  function ensureId(state, ref) {
1664
1674
  if (ref.scopeId !== void 0) {
1665
1675
  trackChannel(state, ref);
@@ -1684,24 +1694,21 @@ function assignId(state, ref) {
1684
1694
  return ref.id;
1685
1695
  }
1686
1696
  ref.channel = state.channel;
1697
+ return ref.id + "=" + (ref.path || accessPath(state, ref));
1698
+ }
1699
+ function accessPath(state, ref) {
1687
1700
  let cur = ref;
1688
1701
  let accessPrevValue = "";
1689
1702
  do {
1690
1703
  accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
1691
1704
  const parent = cur.parent;
1692
1705
  if (parent.id) {
1693
- if (trackChannel(state, parent) || !parent.parent) {
1694
- accessPrevValue = parent.id + accessPrevValue;
1695
- break;
1696
- }
1697
- }
1698
- if (parent.flushId === state.flushId || parent.scopeId !== void 0) {
1699
- accessPrevValue = accessId(state, parent) + accessPrevValue;
1700
- break;
1706
+ if (trackChannel(state, parent) || !parent.parent) return parent.id + accessPrevValue;
1701
1707
  }
1708
+ if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
1702
1709
  cur = parent;
1703
1710
  } while (cur);
1704
- return ref.id + "=" + accessPrevValue;
1711
+ return accessPrevValue;
1705
1712
  }
1706
1713
  function assignmentsToString(assignments, value) {
1707
1714
  if (assignments.length > 100) return "($=>(" + assignments.join("=$,") + "=$))(" + value + ")";
@@ -2226,6 +2233,10 @@ function _subscribe(subscribers, scope) {
2226
2233
  }
2227
2234
  return scope;
2228
2235
  }
2236
+ const CLIENT_ALL = 715827882;
2237
+ function maskGroup(mask, group) {
2238
+ return mask === 715827882 ? 1 : typeof mask === "number" ? mask >>> 1 + 2 * group & 3 : mask[group] ?? 0;
2239
+ }
2229
2240
  function _set_serialize_reason(reason) {
2230
2241
  $chunk.boundary.state.serializeReason = reason;
2231
2242
  }
@@ -2235,7 +2246,7 @@ function _scope_reason() {
2235
2246
  return reason;
2236
2247
  }
2237
2248
  function _serialize_if(condition, key) {
2238
- return condition && (condition === 1 || (typeof condition === "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
2249
+ return condition && maskGroup(condition, key) ? 1 : void 0;
2239
2250
  }
2240
2251
  function _serialize_guard(condition, key) {
2241
2252
  return _serialize_if(condition, key) || 0;
@@ -2437,6 +2448,24 @@ var State = class {
2437
2448
  this.$global = $global;
2438
2449
  if ($global.cspNonce) this.nonceAttr = " nonce" + attrAssignment($global.cspNonce);
2439
2450
  }
2451
+ flushChunk(html, scripts, pending) {
2452
+ const { $global, nonceAttr } = this;
2453
+ const { __flush__ } = $global;
2454
+ if (scripts) html += "<script" + nonceAttr + ">" + scripts + "<\/script>";
2455
+ if (__flush__) {
2456
+ $global.__flush__ = void 0;
2457
+ html = __flush__($global, html);
2458
+ }
2459
+ return pending ? html : html + this.trailerHTML;
2460
+ }
2461
+ walkScript() {
2462
+ return this.runtimePrefix + ".w()";
2463
+ }
2464
+ resumeScript(resumes) {
2465
+ if (this.hasWrittenResume) return this.runtimePrefix + ".r.push(" + resumes + ")";
2466
+ this.hasWrittenResume = true;
2467
+ return this.runtimePrefix + ".r=[" + resumes + "]";
2468
+ }
2440
2469
  get runtimePrefix() {
2441
2470
  const { $global } = this;
2442
2471
  return $global.runtimeId + "." + $global.renderId;
@@ -2548,6 +2577,7 @@ var Chunk = class Chunk {
2548
2577
  }
2549
2578
  append(chunk) {
2550
2579
  this.html += chunk.html;
2580
+ this.needsWalk ||= chunk.needsWalk;
2551
2581
  this.effects = concatEffects(this.effects, chunk.effects);
2552
2582
  this.scripts = concatScripts(this.scripts, chunk.scripts);
2553
2583
  this.lastEffect = chunk.lastEffect || this.lastEffect;
@@ -2750,17 +2780,9 @@ var Chunk = class Chunk {
2750
2780
  state.writeReorders = carried;
2751
2781
  }
2752
2782
  flushSerializer(boundary, state);
2753
- if (state.resumes) if (state.hasWrittenResume) scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")");
2754
- else {
2755
- state.hasWrittenResume = true;
2756
- scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]");
2757
- }
2758
- else if (needsResumeArray && !state.hasWrittenResume) {
2759
- state.hasWrittenResume = true;
2760
- scripts = concatScripts(scripts, runtimePrefix + ".r=[]");
2761
- }
2783
+ if (state.resumes || needsResumeArray && !state.hasWrittenResume) scripts = concatScripts(scripts, state.resumeScript(state.resumes));
2762
2784
  scripts = concatScripts(scripts, reordered);
2763
- if (needsWalk) scripts = concatScripts(scripts, runtimePrefix + ".w()");
2785
+ if (needsWalk) scripts = concatScripts(scripts, state.walkScript());
2764
2786
  this.html = html;
2765
2787
  this.scripts = scripts;
2766
2788
  if (!this.async) this.effects = this.lastEffect = "";
@@ -2775,18 +2797,9 @@ var Chunk = class Chunk {
2775
2797
  state.walkOnNextFlush = true;
2776
2798
  }
2777
2799
  this.flushScript();
2778
- const { scripts } = this;
2779
- const { $global, nonceAttr } = state;
2780
- const { __flush__ } = $global;
2781
- let { html } = this;
2800
+ const { html, scripts } = this;
2782
2801
  this.html = this.scripts = "";
2783
- if (scripts) html += "<script" + nonceAttr + ">" + scripts + "<\/script>";
2784
- if (__flush__) {
2785
- $global.__flush__ = void 0;
2786
- html = __flush__($global, html);
2787
- }
2788
- if (!boundary.count) html += state.trailerHTML;
2789
- return html;
2802
+ return state.flushChunk(html, scripts, boundary.count);
2790
2803
  }
2791
2804
  };
2792
2805
  function flushSerializer(boundary, serializeState) {
@@ -3172,7 +3185,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
3172
3185
  const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
3173
3186
  const render = () => {
3174
3187
  if (renderer) try {
3175
- _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? 1 : 0);
3188
+ _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0);
3176
3189
  return inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
3177
3190
  ...inputOrArgs,
3178
3191
  content
@@ -3222,24 +3235,27 @@ const _template = (templateId, renderer, page) => {
3222
3235
  return _content_resume(templateId, renderer);
3223
3236
  };
3224
3237
  function render(input = {}) {
3238
+ return startRender(this, input, State);
3239
+ }
3240
+ function startRender(template, input, StateClass) {
3225
3241
  let { $global } = input;
3226
3242
  if ($global) {
3227
3243
  ({$global, ...input} = input);
3228
3244
  $global = {
3229
3245
  runtimeId: "M",
3230
- renderId: getDefaultRenderId(this),
3246
+ renderId: getDefaultRenderId(template),
3231
3247
  ...$global
3232
3248
  };
3233
3249
  if (!String($global.runtimeId).match(/^[_a-z][_a-z0-9]*$/i)) throw new Error(`Invalid runtimeId: "${$global.runtimeId}". The runtimeId must start with a letter or underscore and only contain letters, numbers, and underscores.`);
3234
3250
  if (!String($global.renderId).match(/^[_a-z][_a-z0-9]*$/i)) throw new Error(`Invalid renderId: "${$global.renderId}". The renderId must start with a letter or underscore and only contain letters, numbers, and underscores.`);
3235
3251
  } else $global = {
3236
3252
  runtimeId: "M",
3237
- renderId: getDefaultRenderId(this)
3253
+ renderId: getDefaultRenderId(template)
3238
3254
  };
3239
- const state = new State($global);
3255
+ const state = new StateClass($global);
3240
3256
  const head = new Chunk(new Boundary(state, $global.signal), null, null, state);
3241
- if (this["embed"]) head.render(() => writeWaitReady(this["id"], this, input));
3242
- else head.render(this, input);
3257
+ if (template["embed"]) head.render(() => writeWaitReady(template["id"], template, input));
3258
+ else head.render(template, input);
3243
3259
  return new ServerRendered(head);
3244
3260
  }
3245
3261
  function getDefaultRenderId(template) {
@@ -3638,7 +3654,7 @@ const compat = {
3638
3654
  writeScope(scopeId, { m5c: component.id });
3639
3655
  _script(scopeId, SET_SCOPE_REGISTER_ID);
3640
3656
  }
3641
- _set_serialize_reason(willRerender ? 1 : 0);
3657
+ _set_serialize_reason(willRerender ? CLIENT_ALL : 0);
3642
3658
  try {
3643
3659
  renderer(normalizedInput);
3644
3660
  } finally {
@@ -566,6 +566,7 @@ var Reference = class {
566
566
  flushId;
567
567
  pos;
568
568
  id;
569
+ path = null;
569
570
  constructor(parent, accessor, flushId, pos = null, id = null) {
570
571
  this.parent = parent;
571
572
  this.accessor = accessor;
@@ -789,7 +790,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
789
790
  addAssignment(ref, accessId(state, parent) + toAccess(accessor));
790
791
  return false;
791
792
  }
792
- state.buf.push(ensureId(state, ref));
793
+ writeRef(state, ref);
793
794
  return true;
794
795
  }
795
796
  const registered = REGISTRY.get(val);
@@ -833,7 +834,7 @@ function writeString(state, val, parent, accessor) {
833
834
  const ref = state.strs.get(val);
834
835
  if (ref) {
835
836
  if (trackChannel(state, ref)) {
836
- state.buf.push(ensureId(state, ref));
837
+ writeRef(state, ref);
837
838
  return true;
838
839
  }
839
840
  } else {
@@ -1658,6 +1659,15 @@ function quote(str, startPos) {
1658
1659
  }
1659
1660
  return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
1660
1661
  }
1662
+ function writeRef(state, ref) {
1663
+ if (ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId)) {
1664
+ ref.path = accessPath(state, ref);
1665
+ ref.pos = state.buf.length;
1666
+ ref.flushId = state.flushId;
1667
+ ref.channel = state.channel;
1668
+ state.buf.push(ref.path);
1669
+ } else state.buf.push(ensureId(state, ref));
1670
+ }
1661
1671
  function ensureId(state, ref) {
1662
1672
  if (ref.scopeId !== void 0) {
1663
1673
  trackChannel(state, ref);
@@ -1682,24 +1692,21 @@ function assignId(state, ref) {
1682
1692
  return ref.id;
1683
1693
  }
1684
1694
  ref.channel = state.channel;
1695
+ return ref.id + "=" + (ref.path || accessPath(state, ref));
1696
+ }
1697
+ function accessPath(state, ref) {
1685
1698
  let cur = ref;
1686
1699
  let accessPrevValue = "";
1687
1700
  do {
1688
1701
  accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
1689
1702
  const parent = cur.parent;
1690
1703
  if (parent.id) {
1691
- if (trackChannel(state, parent) || !parent.parent) {
1692
- accessPrevValue = parent.id + accessPrevValue;
1693
- break;
1694
- }
1695
- }
1696
- if (parent.flushId === state.flushId || parent.scopeId !== void 0) {
1697
- accessPrevValue = accessId(state, parent) + accessPrevValue;
1698
- break;
1704
+ if (trackChannel(state, parent) || !parent.parent) return parent.id + accessPrevValue;
1699
1705
  }
1706
+ if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
1700
1707
  cur = parent;
1701
1708
  } while (cur);
1702
- return ref.id + "=" + accessPrevValue;
1709
+ return accessPrevValue;
1703
1710
  }
1704
1711
  function assignmentsToString(assignments, value) {
1705
1712
  if (assignments.length > 100) return "($=>(" + assignments.join("=$,") + "=$))(" + value + ")";
@@ -2224,6 +2231,10 @@ function _subscribe(subscribers, scope) {
2224
2231
  }
2225
2232
  return scope;
2226
2233
  }
2234
+ const CLIENT_ALL = 715827882;
2235
+ function maskGroup(mask, group) {
2236
+ return mask === 715827882 ? 1 : typeof mask === "number" ? mask >>> 1 + 2 * group & 3 : mask[group] ?? 0;
2237
+ }
2227
2238
  function _set_serialize_reason(reason) {
2228
2239
  $chunk.boundary.state.serializeReason = reason;
2229
2240
  }
@@ -2233,7 +2244,7 @@ function _scope_reason() {
2233
2244
  return reason;
2234
2245
  }
2235
2246
  function _serialize_if(condition, key) {
2236
- return condition && (condition === 1 || (typeof condition === "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
2247
+ return condition && maskGroup(condition, key) ? 1 : void 0;
2237
2248
  }
2238
2249
  function _serialize_guard(condition, key) {
2239
2250
  return _serialize_if(condition, key) || 0;
@@ -2435,6 +2446,24 @@ var State = class {
2435
2446
  this.$global = $global;
2436
2447
  if ($global.cspNonce) this.nonceAttr = " nonce" + attrAssignment($global.cspNonce);
2437
2448
  }
2449
+ flushChunk(html, scripts, pending) {
2450
+ const { $global, nonceAttr } = this;
2451
+ const { __flush__ } = $global;
2452
+ if (scripts) html += "<script" + nonceAttr + ">" + scripts + "<\/script>";
2453
+ if (__flush__) {
2454
+ $global.__flush__ = void 0;
2455
+ html = __flush__($global, html);
2456
+ }
2457
+ return pending ? html : html + this.trailerHTML;
2458
+ }
2459
+ walkScript() {
2460
+ return this.runtimePrefix + ".w()";
2461
+ }
2462
+ resumeScript(resumes) {
2463
+ if (this.hasWrittenResume) return this.runtimePrefix + ".r.push(" + resumes + ")";
2464
+ this.hasWrittenResume = true;
2465
+ return this.runtimePrefix + ".r=[" + resumes + "]";
2466
+ }
2438
2467
  get runtimePrefix() {
2439
2468
  const { $global } = this;
2440
2469
  return $global.runtimeId + "." + $global.renderId;
@@ -2546,6 +2575,7 @@ var Chunk = class Chunk {
2546
2575
  }
2547
2576
  append(chunk) {
2548
2577
  this.html += chunk.html;
2578
+ this.needsWalk ||= chunk.needsWalk;
2549
2579
  this.effects = concatEffects(this.effects, chunk.effects);
2550
2580
  this.scripts = concatScripts(this.scripts, chunk.scripts);
2551
2581
  this.lastEffect = chunk.lastEffect || this.lastEffect;
@@ -2748,17 +2778,9 @@ var Chunk = class Chunk {
2748
2778
  state.writeReorders = carried;
2749
2779
  }
2750
2780
  flushSerializer(boundary, state);
2751
- if (state.resumes) if (state.hasWrittenResume) scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")");
2752
- else {
2753
- state.hasWrittenResume = true;
2754
- scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]");
2755
- }
2756
- else if (needsResumeArray && !state.hasWrittenResume) {
2757
- state.hasWrittenResume = true;
2758
- scripts = concatScripts(scripts, runtimePrefix + ".r=[]");
2759
- }
2781
+ if (state.resumes || needsResumeArray && !state.hasWrittenResume) scripts = concatScripts(scripts, state.resumeScript(state.resumes));
2760
2782
  scripts = concatScripts(scripts, reordered);
2761
- if (needsWalk) scripts = concatScripts(scripts, runtimePrefix + ".w()");
2783
+ if (needsWalk) scripts = concatScripts(scripts, state.walkScript());
2762
2784
  this.html = html;
2763
2785
  this.scripts = scripts;
2764
2786
  if (!this.async) this.effects = this.lastEffect = "";
@@ -2773,18 +2795,9 @@ var Chunk = class Chunk {
2773
2795
  state.walkOnNextFlush = true;
2774
2796
  }
2775
2797
  this.flushScript();
2776
- const { scripts } = this;
2777
- const { $global, nonceAttr } = state;
2778
- const { __flush__ } = $global;
2779
- let { html } = this;
2798
+ const { html, scripts } = this;
2780
2799
  this.html = this.scripts = "";
2781
- if (scripts) html += "<script" + nonceAttr + ">" + scripts + "<\/script>";
2782
- if (__flush__) {
2783
- $global.__flush__ = void 0;
2784
- html = __flush__($global, html);
2785
- }
2786
- if (!boundary.count) html += state.trailerHTML;
2787
- return html;
2800
+ return state.flushChunk(html, scripts, boundary.count);
2788
2801
  }
2789
2802
  };
2790
2803
  function flushSerializer(boundary, serializeState) {
@@ -3170,7 +3183,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
3170
3183
  const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
3171
3184
  const render = () => {
3172
3185
  if (renderer) try {
3173
- _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? 1 : 0);
3186
+ _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0);
3174
3187
  return inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
3175
3188
  ...inputOrArgs,
3176
3189
  content
@@ -3220,24 +3233,27 @@ const _template = (templateId, renderer, page) => {
3220
3233
  return _content_resume(templateId, renderer);
3221
3234
  };
3222
3235
  function render(input = {}) {
3236
+ return startRender(this, input, State);
3237
+ }
3238
+ function startRender(template, input, StateClass) {
3223
3239
  let { $global } = input;
3224
3240
  if ($global) {
3225
3241
  ({$global, ...input} = input);
3226
3242
  $global = {
3227
3243
  runtimeId: "M",
3228
- renderId: getDefaultRenderId(this),
3244
+ renderId: getDefaultRenderId(template),
3229
3245
  ...$global
3230
3246
  };
3231
3247
  if (!String($global.runtimeId).match(/^[_a-z][_a-z0-9]*$/i)) throw new Error(`Invalid runtimeId: "${$global.runtimeId}". The runtimeId must start with a letter or underscore and only contain letters, numbers, and underscores.`);
3232
3248
  if (!String($global.renderId).match(/^[_a-z][_a-z0-9]*$/i)) throw new Error(`Invalid renderId: "${$global.renderId}". The renderId must start with a letter or underscore and only contain letters, numbers, and underscores.`);
3233
3249
  } else $global = {
3234
3250
  runtimeId: "M",
3235
- renderId: getDefaultRenderId(this)
3251
+ renderId: getDefaultRenderId(template)
3236
3252
  };
3237
- const state = new State($global);
3253
+ const state = new StateClass($global);
3238
3254
  const head = new Chunk(new Boundary(state, $global.signal), null, null, state);
3239
- if (this["embed"]) head.render(() => writeWaitReady(this["id"], this, input));
3240
- else head.render(this, input);
3255
+ if (template["embed"]) head.render(() => writeWaitReady(template["id"], template, input));
3256
+ else head.render(template, input);
3241
3257
  return new ServerRendered(head);
3242
3258
  }
3243
3259
  function getDefaultRenderId(template) {
@@ -3636,7 +3652,7 @@ const compat = {
3636
3652
  writeScope(scopeId, { m5c: component.id });
3637
3653
  _script(scopeId, SET_SCOPE_REGISTER_ID);
3638
3654
  }
3639
- _set_serialize_reason(willRerender ? 1 : 0);
3655
+ _set_serialize_reason(willRerender ? CLIENT_ALL : 0);
3640
3656
  try {
3641
3657
  renderer(normalizedInput);
3642
3658
  } finally {
@@ -1,12 +1,12 @@
1
- let require_control_flow = require("../dom-BNmfm4st.js"), handlePendingTry = (fn, scope, branch) => {
1
+ let require_control_flow = require("../dom-CzGPOsST.js"), handlePendingTry = (fn, scope, branch) => {
2
2
  for (; branch;) {
3
3
  if (branch.O?.i) return (branch.J ||= []).push(fn, scope);
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
7
  //#region src/dom/catch.feat.ts
8
- require_control_flow.en((runEffects) => (effects, checkPending = require_control_flow.tn.has(effects)) => {
9
- if (checkPending || require_control_flow.$t.has(effects)) {
8
+ require_control_flow.$t((runEffects) => (effects, checkPending = require_control_flow.en.has(effects)) => {
9
+ if (checkPending || require_control_flow.Qt.has(effects)) {
10
10
  let i = 0, fn, scope, branch;
11
11
  for (; i < effects.length;) fn = effects[i++], scope = effects[i++], (branch = scope.F)?.H !== 0 && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope);
12
12
  } else runEffects(effects);
@@ -4,7 +4,7 @@ let handlePendingTry = (fn, scope, branch) => {
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
- import { $t as caughtError, en as installCatch, g as renderCatch, tn as placeholderShown } from "../dom-BsAS26Ze.mjs";
7
+ import { $t as installCatch, Qt as caughtError, en as placeholderShown, g as renderCatch } from "../dom-CzfddxCE.mjs";
8
8
  //#region src/dom/catch.feat.ts
9
9
  installCatch((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
10
10
  if (checkPending || caughtError.has(effects)) {
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-BNmfm4st.js");
1
+ let require_control_flow = require("../dom-CzGPOsST.js");
2
2
  require_control_flow.z[0] = require_control_flow.T, require_control_flow.z[1] = require_control_flow.C, require_control_flow.z[2] = require_control_flow.A;
3
3
  //#endregion
@@ -1,3 +1,3 @@
1
- import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
1
+ import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-CzfddxCE.mjs";
2
2
  controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-BNmfm4st.js");
1
+ let require_control_flow = require("../dom-CzGPOsST.js");
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  require_control_flow.z[4] = require_control_flow.y;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
1
+ import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-CzfddxCE.mjs";
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-BNmfm4st.js");
1
+ let require_control_flow = require("../dom-CzGPOsST.js");
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  require_control_flow.z[3] = require_control_flow.N;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { N as _attr_select_value_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
1
+ import { N as _attr_select_value_script, z as controllableScripts } from "../dom-CzfddxCE.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-BNmfm4st.js");
1
+ let require_control_flow = require("../dom-CzGPOsST.js");
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  require_control_flow.z[2] = require_control_flow.A;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { A as _attr_input_value_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
1
+ import { A as _attr_input_value_script, z as controllableScripts } from "../dom-CzfddxCE.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-BNmfm4st.js");
1
+ let require_control_flow = require("../dom-CzGPOsST.js");
2
2
  require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.R.INPUT = require_control_flow.P, require_control_flow.R.TEXTAREA = require_control_flow.L, require_control_flow.R.SELECT = require_control_flow.I, require_control_flow.R.DETAILS = require_control_flow.R.DIALOG = require_control_flow.F;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-BsAS26Ze.mjs";
1
+ import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-CzfddxCE.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -1,3 +1,4 @@
1
- let require_control_flow = require("../dom-BNmfm4st.js"), elementGetter = (branch) => () => branch.S;
2
- require_control_flow.m((branch) => branch.T(elementGetter(branch))), require_control_flow.gt("_e", elementGetter);
1
+ let require_control_flow = require("../dom-CzGPOsST.js"), elementGetter = require_control_flow.gt._e = (branch) => () => branch.S;
2
+ //#region src/dom/dynamic-tag-var.feat.ts
3
+ require_control_flow.m((branch) => branch.T(elementGetter(branch)));
3
4
  //#endregion
@@ -1,4 +1,5 @@
1
- let elementGetter = (branch) => () => branch.S;
2
- import { gt as _resume, m as installDynamicTagVar } from "../dom-BsAS26Ze.mjs";
3
- installDynamicTagVar((branch) => branch.T(elementGetter(branch))), _resume("_e", elementGetter);
1
+ let elementGetter = _resumed._e = (branch) => () => branch.S;
2
+ import { gt as _resumed, m as installDynamicTagVar } from "../dom-CzfddxCE.mjs";
3
+ //#region src/dom/dynamic-tag-var.feat.ts
4
+ installDynamicTagVar((branch) => branch.T(elementGetter(branch)));
4
5
  //#endregion
@@ -1,6 +1,6 @@
1
- let require_control_flow = require("../dom-BNmfm4st.js");
1
+ let require_control_flow = require("../dom-CzGPOsST.js");
2
2
  //#region src/dom/placeholder.feat.ts
3
- require_control_flow.Ct._f = (tryBranch) => {
4
- tryBranch.P &&= (require_control_flow.Kt(tryBranch.P), 0);
3
+ require_control_flow.gt._f = (tryBranch) => {
4
+ tryBranch.P &&= (require_control_flow.Gt(tryBranch.P), 0);
5
5
  };
6
6
  //#endregion
@@ -1,6 +1,6 @@
1
- import { Ct as registeredValues, Kt as destroyBranch } from "../dom-BsAS26Ze.mjs";
1
+ import { Gt as destroyBranch, gt as _resumed } from "../dom-CzfddxCE.mjs";
2
2
  //#region src/dom/placeholder.feat.ts
3
- registeredValues._f = (tryBranch) => {
3
+ _resumed._f = (tryBranch) => {
4
4
  tryBranch.P &&= (destroyBranch(tryBranch.P), 0);
5
5
  };
6
6
  //#endregion
@@ -23,7 +23,7 @@ export interface RenderData {
23
23
  j?: never;
24
24
  p?: Record<string | number, AwaitCounter>;
25
25
  }
26
- export declare const registeredValues: Record<string, unknown>;
26
+ export declare const _resumed: Record<string, unknown>;
27
27
  export declare function ready(readyId: string): void;
28
28
  export declare function readyFailed(readyId: string): void;
29
29
  export declare function withLazy<T>(runtime: T): T;
@@ -31,7 +31,6 @@ export declare function initEmbedded(readyId: string, runtimeId?: string): void;
31
31
  export declare function init(runtimeId?: string): void;
32
32
  export declare let isResuming: undefined | 0 | 1;
33
33
  export declare function getRegisteredWithScope(id: string, scope?: Scope): unknown;
34
- export declare function _resume<T>(id: string, obj: T): T;
35
34
  export declare function _var_resume<T extends Signal<unknown>>(id: string, signal: T): T;
36
35
  export declare function _el(id: string, accessor: EncodedAccessor): (scope: Scope) => () => any;
37
36
  export {};