marko 6.3.20 → 6.3.22

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 (66) hide show
  1. package/cheatsheet.md +29 -3
  2. package/dist/common/accessor.d.ts +21 -75
  3. package/dist/common/accessor.debug.d.ts +21 -75
  4. package/dist/common/constants/accessor-prefix.d.ts +16 -0
  5. package/dist/common/constants/accessor-prefix.debug.d.ts +16 -0
  6. package/dist/common/constants/accessor-prop.d.ts +30 -0
  7. package/dist/common/constants/accessor-prop.debug.d.ts +30 -0
  8. package/dist/common/constants/closure-signal-prop.d.ts +6 -0
  9. package/dist/common/constants/closure-signal-prop.debug.d.ts +6 -0
  10. package/dist/common/constants/controlled-type.d.ts +9 -0
  11. package/dist/common/constants/keyed-scopes-prop.d.ts +4 -0
  12. package/dist/common/constants/keyed-scopes-prop.debug.d.ts +4 -0
  13. package/dist/common/constants/load-signal-value.d.ts +5 -0
  14. package/dist/common/constants/load-signal-value.debug.d.ts +5 -0
  15. package/dist/common/constants/node-type.d.ts +7 -0
  16. package/dist/common/constants/pending-render-prop.d.ts +9 -0
  17. package/dist/common/constants/pending-render-prop.debug.d.ts +9 -0
  18. package/dist/common/constants/renderer-prop.d.ts +12 -0
  19. package/dist/common/constants/renderer-prop.debug.d.ts +12 -0
  20. package/dist/common/constants/resume-symbol.d.ts +10 -0
  21. package/dist/common/constants/walk-code.d.ts +17 -0
  22. package/dist/common/constants/walk-range-size.d.ts +7 -0
  23. package/dist/common/types.d.ts +15 -45
  24. package/dist/debug/dom.js +291 -225
  25. package/dist/debug/dom.mjs +291 -225
  26. package/dist/debug/html.js +187 -41
  27. package/dist/debug/html.mjs +187 -42
  28. package/dist/dom/compat.d.ts +1 -1
  29. package/dist/dom/control-flow.d.ts +1 -1
  30. package/dist/dom/renderer.d.ts +2 -2
  31. package/dist/dom/scope.d.ts +1 -1
  32. package/dist/dom.js +8 -6
  33. package/dist/dom.mjs +8 -6
  34. package/dist/html/constants/char.d.ts +11 -0
  35. package/dist/html/constants/flush-status.d.ts +6 -0
  36. package/dist/html/constants/mark.d.ts +6 -0
  37. package/dist/html/constants/runtime-key.d.ts +7 -0
  38. package/dist/html/writer.d.ts +20 -23
  39. package/dist/html.d.ts +1 -1
  40. package/dist/html.js +131 -29
  41. package/dist/html.mjs +131 -29
  42. package/dist/translator/core/if.d.ts +7 -7
  43. package/dist/translator/core/index.d.ts +7 -7
  44. package/dist/translator/index.d.ts +9 -9
  45. package/dist/translator/index.js +245 -139
  46. package/dist/translator/interop/constants/feature-type.d.ts +5 -0
  47. package/dist/translator/interop/index.d.ts +2 -2
  48. package/dist/translator/util/body-to-text-literal.d.ts +2 -2
  49. package/dist/translator/util/constants/binding-type.d.ts +10 -0
  50. package/dist/translator/util/constants/compile-stage.d.ts +8 -0
  51. package/dist/translator/util/constants/content-type.d.ts +8 -0
  52. package/dist/translator/util/constants/step.d.ts +5 -0
  53. package/dist/translator/util/constants/tag-name-type.d.ts +7 -0
  54. package/dist/translator/util/is-static.d.ts +1 -1
  55. package/dist/translator/util/references.d.ts +9 -12
  56. package/dist/translator/util/sections.d.ts +4 -8
  57. package/dist/translator/util/signals.d.ts +1 -0
  58. package/dist/translator/util/tag-name-type.d.ts +4 -7
  59. package/dist/translator/util/walks.d.ts +4 -6
  60. package/dist/translator/visitors/constants/sibling-text.d.ts +7 -0
  61. package/dist/translator/visitors/placeholder.d.ts +2 -6
  62. package/dist/translator/visitors/program/index.d.ts +1 -0
  63. package/dist/translator/visitors/tag/constants/class-hydration.d.ts +5 -0
  64. package/dist/translator/visitors/tag/dynamic-tag.d.ts +2 -4
  65. package/package.json +16 -16
  66. package/tags-html.d.ts +98 -22
@@ -1,6 +1,8 @@
1
1
  import { _hoist_read_error } from "../common/errors";
2
2
  import { type Opt } from "../common/opt";
3
3
  import { type $Global, type Accessor, type Falsy, ResumeSymbol } from "../common/types";
4
+ import * as FlushStatus from "./constants/flush-status";
5
+ import * as Mark from "./constants/mark";
4
6
  import { K_SCOPE_ID, Serializer } from "./serializer";
5
7
  import type { ServerRenderer } from "./template";
6
8
  export type PartialScope = Record<Accessor, unknown>;
@@ -36,6 +38,7 @@ export declare function writeScript(script: string): void;
36
38
  export declare function _script(scopeId: number, registryId: string): void;
37
39
  export declare function _trailers(html: string): void;
38
40
  export declare function _resume<T extends WeakKey>(val: T, id: string, scopeId?: number): T;
41
+ export declare function _resume_locals<T extends WeakKey>(val: T, id: string, locals: Record<string, unknown>, ownerScopeId?: number): T;
39
42
  export declare function _el(scopeId: number, id: string): () => void;
40
43
  export declare function _hoist(scopeId: number, id: string): {
41
44
  (): void;
@@ -73,16 +76,9 @@ export declare function _try(scopeId: number, accessor: Accessor, content: () =>
73
76
  content?(err: unknown): void;
74
77
  };
75
78
  }): void;
76
- declare enum Mark {
77
- Placeholder = "!^",
78
- PlaceholderEnd = "!",
79
- ReorderMarker = "#"
80
- }
79
+ declare const NOOP: () => void;
80
+ type Mark = Mark.Value;
81
81
  export declare class State implements SerializeState {
82
- $global: $Global & {
83
- renderId: string;
84
- runtimeId: string;
85
- };
86
82
  tagId: number;
87
83
  scopeId: number;
88
84
  reorderId: number;
@@ -104,6 +100,10 @@ export declare class State implements SerializeState {
104
100
  writeScopes: Record<number, PartialScope>;
105
101
  readyIds: Set<string> | null;
106
102
  serializeReason: SerializeReasonValue;
103
+ $global: $Global & {
104
+ renderId: string;
105
+ runtimeId: string;
106
+ };
107
107
  constructor($global: $Global & {
108
108
  renderId: string;
109
109
  runtimeId: string;
@@ -116,26 +116,19 @@ export declare class State implements SerializeState {
116
116
  nextReorderId(): string;
117
117
  mark(code: ResumeSymbol | Mark, str: string): string;
118
118
  }
119
- export declare enum FlushStatus {
120
- complete = 0,
121
- continue = 1,
122
- aborted = 2
123
- }
119
+ type FlushStatus = FlushStatus.Value;
120
+ export { FlushStatus };
124
121
  export declare class Boundary extends AbortController {
125
- state: State;
126
- parent?: Boundary | undefined;
127
- onNext: () => void;
122
+ onNext: typeof NOOP;
128
123
  count: number;
129
- constructor(state: State, signal?: AbortSignal, parent?: Boundary | undefined);
130
- flush(): FlushStatus;
124
+ state: State;
125
+ parent?: Boundary;
126
+ constructor(state: State, signal?: AbortSignal, parent?: Boundary);
127
+ flush(): 0 | 1 | 2;
131
128
  startAsync(): void;
132
129
  endAsync(): void;
133
130
  }
134
131
  export declare class Chunk {
135
- boundary: Boundary;
136
- next: Chunk | null;
137
- context: Record<string | symbol, unknown> | null;
138
- serializeState: SerializeState;
139
132
  html: string;
140
133
  scripts: string;
141
134
  effects: string;
@@ -150,6 +143,10 @@ export declare class Chunk {
150
143
  render: () => void;
151
144
  branchId: number;
152
145
  } | null;
146
+ boundary: Boundary;
147
+ next: Chunk | null;
148
+ context: Record<string | symbol, unknown> | null;
149
+ serializeState: SerializeState;
153
150
  constructor(boundary: Boundary, next: Chunk | null, context: Record<string | symbol, unknown> | null, serializeState: SerializeState);
154
151
  fork(boundary: Boundary, next: Chunk | null): Chunk;
155
152
  writeHTML(html: string): void;
package/dist/html.d.ts CHANGED
@@ -7,4 +7,4 @@ export { _escape, _escape_comment, _escape_script, _escape_style, _escape_style_
7
7
  export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
8
8
  export { forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, } from "./html/for";
9
9
  export { _template } from "./html/template";
10
- export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
10
+ export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
package/dist/html.js CHANGED
@@ -455,14 +455,15 @@ var State$1 = class {
455
455
  channelDeps = null;
456
456
  mutated = [];
457
457
  }, Reference = class {
458
+ assigns = null;
459
+ calls = null;
460
+ scopeId = void 0;
461
+ channel = void 0;
458
462
  parent;
459
463
  accessor;
460
464
  flush;
461
465
  pos;
462
466
  id;
463
- assigns = null;
464
- scopeId = void 0;
465
- channel = void 0;
466
467
  constructor(parent, accessor, flush, pos = null, id = null) {
467
468
  this.parent = parent, this.accessor = accessor, this.flush = flush, this.pos = pos, this.id = id;
468
469
  }
@@ -527,9 +528,20 @@ function writeScopesRoot(state, flushes) {
527
528
  function writeAssigned(state) {
528
529
  let sep = state.buf.length ? "," : "";
529
530
  if (state.assigned.size) {
530
- let buf = "";
531
- for (let ref of state.assigned) buf += sep + assignsToString(ref.assigns, ref.id), ref.assigns = null, sep = ",";
532
- state.buf.push(buf), state.assigned = /* @__PURE__ */ new Set();
531
+ let assigned = state.assigned;
532
+ state.assigned = /* @__PURE__ */ new Set();
533
+ let buf = "", hasCalls = !1;
534
+ for (let ref of assigned) ref.assigns && (buf += sep + assignsToString(ref.assigns, ref.id), ref.assigns = null, sep = ","), hasCalls ||= ref.calls !== null;
535
+ if (buf && state.buf.push(buf), hasCalls) {
536
+ for (let ref of assigned) if (ref.calls) {
537
+ for (let { method, args } of ref.calls) {
538
+ state.buf.push((state.buf.length ? "," : "") + ref.id + "." + method + "(");
539
+ for (let a = 0; a < args.length; a++) a && state.buf.push(","), writeCallArg(state, args[a]);
540
+ state.buf.push(")");
541
+ }
542
+ ref.calls = null;
543
+ }
544
+ }
533
545
  }
534
546
  if (hasChannelMutations(state)) {
535
547
  let remaining = [];
@@ -550,8 +562,12 @@ function writeAssigned(state) {
550
562
  } else state.buf.push("void 0");
551
563
  state.buf.push(")");
552
564
  }
553
- state.mutated = remaining, state.assigned.size && writeAssigned(state);
565
+ state.mutated = remaining;
554
566
  }
567
+ state.assigned.size && writeAssigned(state);
568
+ }
569
+ function writeCallArg(state, val) {
570
+ val === void 0 ? (state.wroteUndefined = !0, state.buf.push("$")) : writeProp(state, val, null, "") || state.buf.push("void 0");
555
571
  }
556
572
  function hasChannelMutations(state) {
557
573
  return hasMatchingMutations(state.mutated, state.channel?.readyId);
@@ -688,6 +704,7 @@ function writeUnknownObject(state, val, ref) {
688
704
  case Float64Array:
689
705
  case BigInt64Array:
690
706
  case BigUint64Array: return writeTypedArray(state, val, ref);
707
+ case DataView: return writeDataView(state, val, ref);
691
708
  case WeakSet: return writeWeakSet(state);
692
709
  case WeakMap: return writeWeakMap(state);
693
710
  case globalThis.URL: return writeURL(state, val);
@@ -697,6 +714,24 @@ function writeUnknownObject(state, val, ref) {
697
714
  case globalThis.ReadableStream: return writeReadableStream(state, val, ref);
698
715
  case globalThis.Request: return writeRequest(state, val, ref);
699
716
  case globalThis.Response: return writeResponse(state, val, ref);
717
+ case globalThis.Intl?.NumberFormat: return writeIntl(state, val, "NumberFormat", ref);
718
+ case globalThis.Intl?.DateTimeFormat: return writeIntl(state, val, "DateTimeFormat", ref);
719
+ case globalThis.Intl?.Collator: return writeIntl(state, val, "Collator", ref);
720
+ case globalThis.Intl?.PluralRules: return writeIntl(state, val, "PluralRules", ref);
721
+ case globalThis.Intl?.RelativeTimeFormat: return writeIntl(state, val, "RelativeTimeFormat", ref);
722
+ case globalThis.Intl?.ListFormat: return writeIntl(state, val, "ListFormat", ref);
723
+ case globalThis.Intl?.DisplayNames: return writeIntl(state, val, "DisplayNames", ref);
724
+ case globalThis.Intl?.Segmenter: return writeIntl(state, val, "Segmenter", ref);
725
+ case globalThis.Intl?.DurationFormat: return writeIntl(state, val, "DurationFormat", ref);
726
+ case globalThis.Intl?.Locale: return writeIntlLocale(state, val);
727
+ case globalThis.Temporal?.Instant: return writeTemporal(state, val, "Instant");
728
+ case globalThis.Temporal?.Duration: return writeTemporal(state, val, "Duration");
729
+ case globalThis.Temporal?.PlainDate: return writeTemporal(state, val, "PlainDate");
730
+ case globalThis.Temporal?.PlainDateTime: return writeTemporal(state, val, "PlainDateTime");
731
+ case globalThis.Temporal?.PlainMonthDay: return writeTemporal(state, val, "PlainMonthDay");
732
+ case globalThis.Temporal?.PlainTime: return writeTemporal(state, val, "PlainTime");
733
+ case globalThis.Temporal?.PlainYearMonth: return writeTemporal(state, val, "PlainYearMonth");
734
+ case globalThis.Temporal?.ZonedDateTime: return writeTemporal(state, val, "ZonedDateTime");
700
735
  }
701
736
  return !1;
702
737
  }
@@ -730,22 +765,51 @@ function newAsyncHandle(state, parent, id) {
730
765
  }
731
766
  function writeMap(state, val, ref) {
732
767
  if (!val.size) return state.buf.push("new Map"), !0;
733
- let items = [], assigns, needsId, i = 0;
768
+ let items = [], assigns, needsId, deferring = !1, i = 0;
734
769
  if (val.size < 25) {
735
- for (let [itemKey, itemValue] of val) itemKey === val && (itemKey = void 0, (assigns ||= []).push("a[" + i + "][0]")), itemValue === val && (itemValue = void 0, (assigns ||= []).push("a[" + i + "][1]")), needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue), i = items.push(itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]);
770
+ for (let [itemKey, itemValue] of val) {
771
+ if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) && (deferring = !0), deferring) {
772
+ deferCall(state, ref, "set", [itemKey, itemValue]);
773
+ continue;
774
+ }
775
+ itemKey === val && (itemKey = void 0, (assigns ||= []).push("a[" + i + "][0]")), itemValue === val && (itemValue = void 0, (assigns ||= []).push("a[" + i + "][1]")), needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue), i = items.push(itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]);
776
+ }
736
777
  writeArrayArg(state, ref, items, assigns && "((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map,", "new Map(", needsId);
737
778
  } else {
738
- for (let [itemKey, itemValue] of val) itemKey === val && (itemKey = 0, (assigns ||= []).push("a[" + i + "]")), itemValue === val && (itemValue = 0, (assigns ||= []).push("a[" + (i + 1) + "]")), needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue), i = items.push(itemKey, itemValue);
779
+ for (let [itemKey, itemValue] of val) {
780
+ if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) && (deferring = !0), deferring) {
781
+ deferCall(state, ref, "set", [itemKey, itemValue]);
782
+ continue;
783
+ }
784
+ itemKey === val && (itemKey = 0, (assigns ||= []).push("a[" + i + "]")), itemValue === val && (itemValue = 0, (assigns ||= []).push("a[" + (i + 1) + "]")), needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue), i = items.push(itemKey, itemValue);
785
+ }
739
786
  writeArrayArg(state, ref, items, assigns && "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(", "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(", needsId);
740
787
  }
741
788
  return !0;
742
789
  }
743
790
  function writeSet(state, val, ref) {
744
791
  if (!val.size) return state.buf.push("new Set"), !0;
745
- let items = [], assigns, needsId, i = 0;
746
- for (let item of val) item === val ? (item = 0, (assigns ||= []).push("i[" + i + "]")) : needsId ||= isDedupedMember(item), i = items.push(item);
792
+ let items = [], assigns, needsId, deferring = !1, i = 0;
793
+ for (let item of val) {
794
+ if (!deferring && item !== val && isAncestorMember(state, ref, item) && (deferring = !0), deferring) {
795
+ deferCall(state, ref, "add", [item]);
796
+ continue;
797
+ }
798
+ item === val ? (item = 0, (assigns ||= []).push("i[" + i + "]")) : needsId ||= isDedupedMember(item), i = items.push(item);
799
+ }
747
800
  return writeArrayArg(state, ref, items, assigns && "((s,i)=>(" + assignsToString(assigns, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId), !0;
748
801
  }
802
+ function isAncestorMember(state, container, member) {
803
+ if (member === null || typeof member != "object" && typeof member != "function") return !1;
804
+ let ref = state.refs.get(member);
805
+ return ref !== void 0 && isCircular(container, ref);
806
+ }
807
+ function deferCall(state, ref, method, args) {
808
+ ensureId(state, ref), (ref.calls ||= []).push({
809
+ method,
810
+ args
811
+ }), state.assigned.add(ref);
812
+ }
749
813
  function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
750
814
  if (assignsPrefix || needsId) {
751
815
  let arrayRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
@@ -762,6 +826,15 @@ function isDedupedMember(val) {
762
826
  default: return !1;
763
827
  }
764
828
  }
829
+ function canWriteBuffer(state, buffer, ref) {
830
+ return Object.getPrototypeOf(buffer)?.constructor === ArrayBuffer;
831
+ }
832
+ function writeDataView(state, val, ref) {
833
+ let { buffer } = val;
834
+ if (!canWriteBuffer(state, buffer, ref)) return !1;
835
+ let needsLength = val.byteOffset + val.byteLength < buffer.byteLength;
836
+ return state.buf.push("new DataView("), writeProp(state, buffer, ref, "buffer"), state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.byteLength : "") : "") + ")"), !0;
837
+ }
765
838
  function writeArrayBuffer(state, val) {
766
839
  let result;
767
840
  if (val.byteLength) {
@@ -772,6 +845,7 @@ function writeArrayBuffer(state, val) {
772
845
  }
773
846
  function writeTypedArray(state, val, ref) {
774
847
  if (val.byteOffset || val.byteLength < val.buffer.byteLength || state.refs.has(val.buffer)) {
848
+ if (!canWriteBuffer(state, val.buffer, ref)) return !1;
775
849
  let needsLength = val.byteOffset + val.byteLength < val.buffer.byteLength;
776
850
  state.buf.push("new " + val.constructor.name + "("), writeProp(state, val.buffer, ref, "buffer"), state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.length : "") : "") + ")");
777
851
  } else state.refs.set(val.buffer, new Reference(ref, "buffer", state.flush, null)), state.buf.push("new " + val.constructor.name + (val.length === 0 ? "" : "(" + (hasOnlyZeros(val) ? val.length : typedArrayToInitString(val)) + ")"));
@@ -845,6 +919,22 @@ function writeResponse(state, val, ref) {
845
919
  }
846
920
  return !val.body || val.bodyUsed ? state.buf.push("new Response" + (options ? "(null,{" + options + "})" : "")) : (state.buf.push("new Response("), state.buf.push((writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")"))), !0;
847
921
  }
922
+ function writeIntl(state, val, name, ref) {
923
+ let { locale, ...options } = val.resolvedOptions(), needsId = !1;
924
+ for (let key in options) if (isDedupedMember(options[key])) {
925
+ needsId = !0;
926
+ break;
927
+ }
928
+ state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
929
+ let optionsRef;
930
+ return needsId ? (optionsRef = new Reference(ref, null, state.flush, null, nextRefAccess(state)), state.buf.push(optionsRef.id + "={")) : (optionsRef = new Reference(ref, null, state.flush, state.buf.length), state.buf.push("{")), writeObjectProps(state, options, optionsRef), state.buf.push("})"), !0;
931
+ }
932
+ function writeIntlLocale(state, val) {
933
+ return state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")"), !0;
934
+ }
935
+ function writeTemporal(state, val, name) {
936
+ return state.buf.push("Temporal." + name + ".from(" + quote(val.toString(), 0) + ")"), !0;
937
+ }
848
938
  function writeReadableStream(state, val, ref) {
849
939
  let { boundary, channel } = state;
850
940
  if (!boundary || val.locked) return !1;
@@ -1201,6 +1291,9 @@ function _trailers(html) {
1201
1291
  function _resume(val, id, scopeId) {
1202
1292
  return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
1203
1293
  }
1294
+ function _resume_locals(val, id, locals, ownerScopeId) {
1295
+ return ownerScopeId !== void 0 && (locals._ = _scope_with_id(ownerScopeId)), register(id, val, writeScope(_scope_id(), locals));
1296
+ }
1204
1297
  function _el(scopeId, id) {
1205
1298
  return _resume(() => void 0, id, scopeId);
1206
1299
  }
@@ -1420,7 +1513,6 @@ function tryCatch(content, catchContent) {
1420
1513
  };
1421
1514
  }
1422
1515
  var State = class {
1423
- $global;
1424
1516
  tagId = 1;
1425
1517
  scopeId = 1;
1426
1518
  reorderId = 1;
@@ -1442,6 +1534,7 @@ var State = class {
1442
1534
  writeScopes = {};
1443
1535
  readyIds = null;
1444
1536
  serializeReason;
1537
+ $global;
1445
1538
  constructor($global) {
1446
1539
  this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
1447
1540
  }
@@ -1472,10 +1565,10 @@ var State = class {
1472
1565
  return "<!--" + this.commentPrefix + code + str + "-->";
1473
1566
  }
1474
1567
  }, Boundary = class extends AbortController {
1475
- state;
1476
- parent;
1477
1568
  onNext = NOOP$2;
1478
1569
  count = 0;
1570
+ state;
1571
+ parent;
1479
1572
  constructor(state, signal, parent) {
1480
1573
  super(), this.state = state, this.parent = parent, this.signal.addEventListener("abort", () => {
1481
1574
  this.count = 0, this.state = new State(this.state.$global), this.onNext();
@@ -1493,10 +1586,6 @@ var State = class {
1493
1586
  !this.signal.aborted && this.count && (this.count--, this.onNext());
1494
1587
  }
1495
1588
  }, Chunk = class Chunk {
1496
- boundary;
1497
- next;
1498
- context;
1499
- serializeState;
1500
1589
  html = "";
1501
1590
  scripts = "";
1502
1591
  effects = "";
@@ -1507,6 +1596,10 @@ var State = class {
1507
1596
  reorderId = null;
1508
1597
  deferredReady = null;
1509
1598
  placeholder = null;
1599
+ boundary;
1600
+ next;
1601
+ context;
1602
+ serializeState;
1510
1603
  constructor(boundary, next, context, serializeState) {
1511
1604
  this.boundary = boundary, this.next = next, this.context = context, this.serializeState = serializeState;
1512
1605
  }
@@ -1901,17 +1994,26 @@ var ServerRendered = class {
1901
1994
  }
1902
1995
  [Symbol.asyncIterator]() {
1903
1996
  let resolve, reject, value = "", done = !1, aborted = !1, reason, boundary = this.#read((html) => {
1904
- value += html, resolve && (resolve({
1905
- value,
1906
- done
1907
- }), value = "");
1997
+ if (value += html, resolve) {
1998
+ let settle = resolve;
1999
+ resolve = reject = void 0, settle({
2000
+ value,
2001
+ done
2002
+ }), value = "";
2003
+ }
1908
2004
  }, (err) => {
1909
- aborted = !0, reason = err, reject && reject(err);
2005
+ if (aborted = !0, reason = err, reject) {
2006
+ let settle = reject;
2007
+ resolve = reject = void 0, settle(err);
2008
+ }
1910
2009
  }, () => {
1911
- done = !0, resolve && (resolve({
1912
- value,
1913
- done: !value
1914
- }), value = "");
2010
+ if (done = !0, resolve) {
2011
+ let settle = resolve;
2012
+ resolve = reject = void 0, settle({
2013
+ value,
2014
+ done: !value
2015
+ }), value = "";
2016
+ }
1915
2017
  });
1916
2018
  return {
1917
2019
  next() {
@@ -2093,4 +2195,4 @@ exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr
2093
2195
  get: function() {
2094
2196
  return _dynamic_tag;
2095
2197
  }
2096
- }), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._sep = _sep, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forInBy = forInBy, exports.forOf = forOf, exports.forOfBy = forOfBy, exports.forStepBy = forStepBy, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
2198
+ }), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._sep = _sep, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forInBy = forInBy, exports.forOf = forOf, exports.forOfBy = forOfBy, exports.forStepBy = forStepBy, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;