marko 6.4.11 → 6.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/attr-tag.d.ts +1 -0
- package/dist/common/errors.d.ts +2 -0
- package/dist/common/helpers.d.ts +2 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/compat.feat.js +143 -0
- package/dist/debug/dom/compat.feat.mjs +141 -0
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-mQ5mPBTF.js → dom-CtXOr4Nm.js} +68 -31
- package/dist/debug/{dom-DjUZd-9y.mjs → dom-DaHYZpf2.mjs} +51 -26
- package/dist/debug/dom.js +4 -127
- package/dist/debug/dom.mjs +2 -119
- package/dist/debug/html/compat.feat.js +222 -0
- package/dist/debug/html/compat.feat.mjs +220 -0
- package/dist/debug/html-DMo6pc_h.mjs +3931 -0
- package/dist/debug/html-DfZjMkhx.js +4513 -0
- package/dist/debug/html.js +83 -4220
- package/dist/debug/html.mjs +1 -4133
- package/dist/dom/catch.feat.js +4 -4
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
- package/dist/dom/compat.feat.js +101 -0
- package/dist/dom/compat.feat.mjs +100 -0
- package/dist/dom/control-flow.d.ts +0 -1
- package/dist/dom/controllable-input.feat.js +2 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +2 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +2 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +2 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dom.d.ts +2 -1
- package/dist/dom/dynamic-tag-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +3 -3
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/resume.d.ts +3 -1
- package/dist/{dom-B8j2453O.js → dom-BB-Te-3z.js} +125 -130
- package/dist/{dom-HEWdZCCb.mjs → dom-BO-0hzLZ.mjs} +13 -18
- package/dist/dom.d.ts +0 -1
- package/dist/dom.js +21 -95
- package/dist/dom.mjs +3 -72
- package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
- package/dist/html/compat.feat.js +165 -0
- package/dist/html/compat.feat.mjs +164 -0
- package/dist/html/dynamic-tag.d.ts +1 -2
- package/dist/html/writer.d.ts +2 -1
- package/dist/html-DMDc0zKs.mjs +2404 -0
- package/dist/html-DrHsybFm.js +2880 -0
- package/dist/html.d.ts +0 -1
- package/dist/html.js +2 -2566
- package/dist/html.mjs +3 -2561
- package/dist/translator/index.js +297 -285
- package/dist/translator/util/assert.d.ts +2 -0
- package/dist/translator/util/branch-tag.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +4 -1
- package/dist/translator/util/optional.d.ts +0 -1
- package/dist/translator/util/reasons.d.ts +0 -1
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/util/sections.d.ts +5 -1
- package/dist/translator/util/tag-facts.d.ts +2 -0
- package/dist/translator/util/translate-attrs.d.ts +1 -4
- package/dist/translator/visitors/program/index.d.ts +2 -2
- package/index.d.ts +2 -7
- package/package.json +4 -4
|
@@ -0,0 +1,2404 @@
|
|
|
1
|
+
let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\", classAPIRenderer, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (/* @__PURE__ */ (function* () {})()).constructor, AsyncGenerator = (/* @__PURE__ */ (async function* () {})()).constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = /* @__PURE__ */ (() => {
|
|
2
|
+
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
3
|
+
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
4
|
+
let symbol = Symbol[name];
|
|
5
|
+
typeof symbol == "symbol" && KNOWN_SYMBOLS.set(symbol, "Symbol." + name);
|
|
6
|
+
}
|
|
7
|
+
return KNOWN_SYMBOLS;
|
|
8
|
+
})(), KNOWN_FUNCTIONS = /* @__PURE__ */ new Map([
|
|
9
|
+
[AggregateError, "AggregateError"],
|
|
10
|
+
[Array, "Array"],
|
|
11
|
+
[Array.from, "Array.from"],
|
|
12
|
+
[Array.isArray, "Array.isArray"],
|
|
13
|
+
[Array.of, "Array.of"],
|
|
14
|
+
[ArrayBuffer, "ArrayBuffer"],
|
|
15
|
+
[ArrayBuffer.isView, "ArrayBuffer.isView"],
|
|
16
|
+
[Atomics.add, "Atomics.add"],
|
|
17
|
+
[Atomics.and, "Atomics.and"],
|
|
18
|
+
[Atomics.compareExchange, "Atomics.compareExchange"],
|
|
19
|
+
[Atomics.exchange, "Atomics.exchange"],
|
|
20
|
+
[Atomics.isLockFree, "Atomics.isLockFree"],
|
|
21
|
+
[Atomics.load, "Atomics.load"],
|
|
22
|
+
[Atomics.notify, "Atomics.notify"],
|
|
23
|
+
[Atomics.or, "Atomics.or"],
|
|
24
|
+
[Atomics.store, "Atomics.store"],
|
|
25
|
+
[Atomics.sub, "Atomics.sub"],
|
|
26
|
+
[Atomics.wait, "Atomics.wait"],
|
|
27
|
+
[BigInt, "BigInt"],
|
|
28
|
+
[BigInt.asIntN, "BigInt.asIntN"],
|
|
29
|
+
[BigInt.asUintN, "BigInt.asUintN"],
|
|
30
|
+
[BigInt64Array, "BigInt64Array"],
|
|
31
|
+
[BigInt64Array.from, "BigInt64Array.from"],
|
|
32
|
+
[BigInt64Array.of, "BigInt64Array.of"],
|
|
33
|
+
[BigUint64Array, "BigUint64Array"],
|
|
34
|
+
[BigUint64Array.from, "BigUint64Array.from"],
|
|
35
|
+
[BigUint64Array.of, "BigUint64Array.of"],
|
|
36
|
+
[Boolean, "Boolean"],
|
|
37
|
+
[console.assert, "console.assert"],
|
|
38
|
+
[console.clear, "console.clear"],
|
|
39
|
+
[console.count, "console.count"],
|
|
40
|
+
[console.countReset, "console.countReset"],
|
|
41
|
+
[console.debug, "console.debug"],
|
|
42
|
+
[console.dir, "console.dir"],
|
|
43
|
+
[console.dirxml, "console.dirxml"],
|
|
44
|
+
[console.error, "console.error"],
|
|
45
|
+
[console.group, "console.group"],
|
|
46
|
+
[console.groupCollapsed, "console.groupCollapsed"],
|
|
47
|
+
[console.groupEnd, "console.groupEnd"],
|
|
48
|
+
[console.info, "console.info"],
|
|
49
|
+
[console.log, "console.log"],
|
|
50
|
+
[console.table, "console.table"],
|
|
51
|
+
[console.time, "console.time"],
|
|
52
|
+
[console.timeEnd, "console.timeEnd"],
|
|
53
|
+
[console.timeLog, "console.timeLog"],
|
|
54
|
+
[console.timeStamp, "console.timeStamp"],
|
|
55
|
+
[console.trace, "console.trace"],
|
|
56
|
+
[console.warn, "console.warn"],
|
|
57
|
+
[DataView, "DataView"],
|
|
58
|
+
[Date, "Date"],
|
|
59
|
+
[Date.now, "Date.now"],
|
|
60
|
+
[Date.parse, "Date.parse"],
|
|
61
|
+
[Date.UTC, "Date.UTC"],
|
|
62
|
+
[decodeURI, "decodeURI"],
|
|
63
|
+
[decodeURIComponent, "decodeURIComponent"],
|
|
64
|
+
[encodeURI, "encodeURI"],
|
|
65
|
+
[encodeURIComponent, "encodeURIComponent"],
|
|
66
|
+
[Error, "Error"],
|
|
67
|
+
[EvalError, "EvalError"],
|
|
68
|
+
[Float32Array, "Float32Array"],
|
|
69
|
+
[Float32Array.from, "Float32Array.from"],
|
|
70
|
+
[Float32Array.of, "Float32Array.of"],
|
|
71
|
+
[Float64Array, "Float64Array"],
|
|
72
|
+
[Float64Array.from, "Float64Array.from"],
|
|
73
|
+
[Float64Array.of, "Float64Array.of"],
|
|
74
|
+
[Function, "Function"],
|
|
75
|
+
[globalThis.atob, "atob"],
|
|
76
|
+
[globalThis.btoa, "btoa"],
|
|
77
|
+
[globalThis.clearInterval, "clearInterval"],
|
|
78
|
+
[globalThis.clearTimeout, "clearTimeout"],
|
|
79
|
+
[globalThis.crypto?.getRandomValues, "crypto.getRandomValues"],
|
|
80
|
+
[globalThis.crypto?.randomUUID, "crypto.randomUUID"],
|
|
81
|
+
[globalThis.fetch, "fetch"],
|
|
82
|
+
[globalThis.performance?.now, "performance.now"],
|
|
83
|
+
[globalThis.queueMicrotask, "queueMicrotask"],
|
|
84
|
+
[globalThis.setInterval, "setInterval"],
|
|
85
|
+
[globalThis.setTimeout, "setTimeout"],
|
|
86
|
+
[globalThis.structuredClone, "structuredClone"],
|
|
87
|
+
[globalThis.URL, "URL"],
|
|
88
|
+
[globalThis.URLSearchParams, "URLSearchParams"],
|
|
89
|
+
[globalThis.WritableStream, "WritableStream"],
|
|
90
|
+
[Int16Array, "Int16Array"],
|
|
91
|
+
[Int16Array.from, "Int16Array.from"],
|
|
92
|
+
[Int16Array.of, "Int16Array.of"],
|
|
93
|
+
[Int32Array, "Int32Array"],
|
|
94
|
+
[Int32Array.from, "Int32Array.from"],
|
|
95
|
+
[Int32Array.of, "Int32Array.of"],
|
|
96
|
+
[Int8Array, "Int8Array"],
|
|
97
|
+
[Int8Array.from, "Int8Array.from"],
|
|
98
|
+
[Int8Array.of, "Int8Array.of"],
|
|
99
|
+
[Intl.Collator, "Intl.Collator"],
|
|
100
|
+
[Intl.DateTimeFormat, "Intl.DateTimeFormat"],
|
|
101
|
+
[Intl.DisplayNames, "Intl.DisplayNames"],
|
|
102
|
+
[Intl.getCanonicalLocales, "Intl.getCanonicalLocales"],
|
|
103
|
+
[Intl.ListFormat, "Intl.ListFormat"],
|
|
104
|
+
[Intl.Locale, "Intl.Locale"],
|
|
105
|
+
[Intl.NumberFormat, "Intl.NumberFormat"],
|
|
106
|
+
[Intl.PluralRules, "Intl.PluralRules"],
|
|
107
|
+
[Intl.RelativeTimeFormat, "Intl.RelativeTimeFormat"],
|
|
108
|
+
[Intl.Segmenter, "Intl.Segmenter"],
|
|
109
|
+
[Intl.supportedValuesOf, "Intl.supportedValuesOf"],
|
|
110
|
+
[isFinite, "isFinite"],
|
|
111
|
+
[isNaN, "isNaN"],
|
|
112
|
+
[JSON.parse, "JSON.parse"],
|
|
113
|
+
[JSON.stringify, "JSON.stringify"],
|
|
114
|
+
[Map, "Map"],
|
|
115
|
+
[Map.groupBy, "Map.groupBy"],
|
|
116
|
+
[Math.abs, "Math.abs"],
|
|
117
|
+
[Math.acos, "Math.acos"],
|
|
118
|
+
[Math.acosh, "Math.acosh"],
|
|
119
|
+
[Math.asin, "Math.asin"],
|
|
120
|
+
[Math.asinh, "Math.asinh"],
|
|
121
|
+
[Math.atan, "Math.atan"],
|
|
122
|
+
[Math.atan2, "Math.atan2"],
|
|
123
|
+
[Math.atanh, "Math.atanh"],
|
|
124
|
+
[Math.cbrt, "Math.cbrt"],
|
|
125
|
+
[Math.ceil, "Math.ceil"],
|
|
126
|
+
[Math.clz32, "Math.clz32"],
|
|
127
|
+
[Math.cos, "Math.cos"],
|
|
128
|
+
[Math.cosh, "Math.cosh"],
|
|
129
|
+
[Math.exp, "Math.exp"],
|
|
130
|
+
[Math.expm1, "Math.expm1"],
|
|
131
|
+
[Math.floor, "Math.floor"],
|
|
132
|
+
[Math.fround, "Math.fround"],
|
|
133
|
+
[Math.hypot, "Math.hypot"],
|
|
134
|
+
[Math.imul, "Math.imul"],
|
|
135
|
+
[Math.log, "Math.log"],
|
|
136
|
+
[Math.log10, "Math.log10"],
|
|
137
|
+
[Math.log1p, "Math.log1p"],
|
|
138
|
+
[Math.log2, "Math.log2"],
|
|
139
|
+
[Math.max, "Math.max"],
|
|
140
|
+
[Math.min, "Math.min"],
|
|
141
|
+
[Math.pow, "Math.pow"],
|
|
142
|
+
[Math.random, "Math.random"],
|
|
143
|
+
[Math.round, "Math.round"],
|
|
144
|
+
[Math.sign, "Math.sign"],
|
|
145
|
+
[Math.sin, "Math.sin"],
|
|
146
|
+
[Math.sinh, "Math.sinh"],
|
|
147
|
+
[Math.sqrt, "Math.sqrt"],
|
|
148
|
+
[Math.tan, "Math.tan"],
|
|
149
|
+
[Math.tanh, "Math.tanh"],
|
|
150
|
+
[Math.trunc, "Math.trunc"],
|
|
151
|
+
[Number, "Number"],
|
|
152
|
+
[Number.isFinite, "Number.isFinite"],
|
|
153
|
+
[Number.isInteger, "Number.isInteger"],
|
|
154
|
+
[Number.isNaN, "Number.isNaN"],
|
|
155
|
+
[Number.isSafeInteger, "Number.isSafeInteger"],
|
|
156
|
+
[Number.parseFloat, "Number.parseFloat"],
|
|
157
|
+
[Number.parseInt, "Number.parseInt"],
|
|
158
|
+
[Object, "Object"],
|
|
159
|
+
[Object.assign, "Object.assign"],
|
|
160
|
+
[Object.create, "Object.create"],
|
|
161
|
+
[Object.defineProperties, "Object.defineProperties"],
|
|
162
|
+
[Object.defineProperty, "Object.defineProperty"],
|
|
163
|
+
[Object.entries, "Object.entries"],
|
|
164
|
+
[Object.freeze, "Object.freeze"],
|
|
165
|
+
[Object.fromEntries, "Object.fromEntries"],
|
|
166
|
+
[Object.getOwnPropertyDescriptor, "Object.getOwnPropertyDescriptor"],
|
|
167
|
+
[Object.getOwnPropertyDescriptors, "Object.getOwnPropertyDescriptors"],
|
|
168
|
+
[Object.getOwnPropertyNames, "Object.getOwnPropertyNames"],
|
|
169
|
+
[Object.getOwnPropertySymbols, "Object.getOwnPropertySymbols"],
|
|
170
|
+
[Object.getPrototypeOf, "Object.getPrototypeOf"],
|
|
171
|
+
[Object.is, "Object.is"],
|
|
172
|
+
[Object.isExtensible, "Object.isExtensible"],
|
|
173
|
+
[Object.isFrozen, "Object.isFrozen"],
|
|
174
|
+
[Object.isSealed, "Object.isSealed"],
|
|
175
|
+
[Object.keys, "Object.keys"],
|
|
176
|
+
[Object.preventExtensions, "Object.preventExtensions"],
|
|
177
|
+
[Object.seal, "Object.seal"],
|
|
178
|
+
[Object.setPrototypeOf, "Object.setPrototypeOf"],
|
|
179
|
+
[Object.values, "Object.values"],
|
|
180
|
+
[parseFloat, "parseFloat"],
|
|
181
|
+
[parseInt, "parseInt"],
|
|
182
|
+
[Promise, "Promise"],
|
|
183
|
+
[Proxy, "Proxy"],
|
|
184
|
+
[RangeError, "RangeError"],
|
|
185
|
+
[ReferenceError, "ReferenceError"],
|
|
186
|
+
[Reflect.apply, "Reflect.apply"],
|
|
187
|
+
[Reflect.construct, "Reflect.construct"],
|
|
188
|
+
[Reflect.defineProperty, "Reflect.defineProperty"],
|
|
189
|
+
[Reflect.deleteProperty, "Reflect.deleteProperty"],
|
|
190
|
+
[Reflect.get, "Reflect.get"],
|
|
191
|
+
[Reflect.getOwnPropertyDescriptor, "Reflect.getOwnPropertyDescriptor"],
|
|
192
|
+
[Reflect.getPrototypeOf, "Reflect.getPrototypeOf"],
|
|
193
|
+
[Reflect.has, "Reflect.has"],
|
|
194
|
+
[Reflect.isExtensible, "Reflect.isExtensible"],
|
|
195
|
+
[Reflect.ownKeys, "Reflect.ownKeys"],
|
|
196
|
+
[Reflect.preventExtensions, "Reflect.preventExtensions"],
|
|
197
|
+
[Reflect.set, "Reflect.set"],
|
|
198
|
+
[Reflect.setPrototypeOf, "Reflect.setPrototypeOf"],
|
|
199
|
+
[RegExp, "RegExp"],
|
|
200
|
+
[Set, "Set"],
|
|
201
|
+
[String, "String"],
|
|
202
|
+
[String.fromCharCode, "String.fromCharCode"],
|
|
203
|
+
[String.fromCodePoint, "String.fromCodePoint"],
|
|
204
|
+
[String.raw, "String.raw"],
|
|
205
|
+
[Symbol, "Symbol"],
|
|
206
|
+
[Symbol.for, "Symbol.for"],
|
|
207
|
+
[SyntaxError, "SyntaxError"],
|
|
208
|
+
[TypeError, "TypeError"],
|
|
209
|
+
[Uint16Array, "Uint16Array"],
|
|
210
|
+
[Uint16Array.from, "Uint16Array.from"],
|
|
211
|
+
[Uint16Array.of, "Uint16Array.of"],
|
|
212
|
+
[Uint32Array, "Uint32Array"],
|
|
213
|
+
[Uint32Array.from, "Uint32Array.from"],
|
|
214
|
+
[Uint32Array.of, "Uint32Array.of"],
|
|
215
|
+
[Uint8Array, "Uint8Array"],
|
|
216
|
+
[Uint8Array.from, "Uint8Array.from"],
|
|
217
|
+
[Uint8Array.of, "Uint8Array.of"],
|
|
218
|
+
[Uint8ClampedArray, "Uint8ClampedArray"],
|
|
219
|
+
[Uint8ClampedArray.from, "Uint8ClampedArray.from"],
|
|
220
|
+
[Uint8ClampedArray.of, "Uint8ClampedArray.of"],
|
|
221
|
+
[URIError, "URIError"],
|
|
222
|
+
[WeakMap, "WeakMap"],
|
|
223
|
+
[WeakSet, "WeakSet"]
|
|
224
|
+
]), KNOWN_OBJECTS = /* @__PURE__ */ new Map([
|
|
225
|
+
[Atomics, "Atomics"],
|
|
226
|
+
[console, "console"],
|
|
227
|
+
[globalThis, "globalThis"],
|
|
228
|
+
[globalThis.crypto, "crypto"],
|
|
229
|
+
[Intl, "Intl"],
|
|
230
|
+
[JSON, "JSON"],
|
|
231
|
+
[Math, "Math"],
|
|
232
|
+
[Reflect, "Reflect"]
|
|
233
|
+
]), unsafeRegExpSourceReg = /\\[\s\S]|[<\0\ud800-\udfff]/gu, unsafeRegExpSourceDetect = /[<\0\ud800-\udfff]/u, replaceUnsafeRegExpSourceChar = (match) => {
|
|
234
|
+
let ch = match.length === 3 ? "" : match[match.length - 1];
|
|
235
|
+
if (ch === "<") return "\\x3C";
|
|
236
|
+
if (ch === "\0") return "\\x00";
|
|
237
|
+
let code = ch.charCodeAt(0);
|
|
238
|
+
return code >= 55296 && code <= 57343 ? "\\u" + code.toString(16).padStart(4, "0") : match;
|
|
239
|
+
}, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kAsyncContent = Symbol("Async Content"), writeScope = (scopeId, partialScope) => {
|
|
240
|
+
let { state } = $chunk.boundary, target = $chunk.channel, scope = scopeWithId(state, scopeId);
|
|
241
|
+
return state.needsWalkerRuntime = !0, countResumeWrite($chunk), writeAsyncVisits($chunk), Object.assign(scope, partialScope), state.queueScope(target, scopeId, partialScope), scope;
|
|
242
|
+
}, ALL_GROUPS = 715827883, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, unsafeXMLReg = /[<&\r]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : c === "<" ? "<" : " ", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\u003C$1") : str, unsafeScriptTemplateLiteralReg = /[`\\\r]|\$\{|<(?=\/?script|!--)/gi, replaceUnsafeScriptTemplateLiteral = (c) => c === "<" ? "\\x3C" : c === "\r" ? "\\r" : "\\" + c, quoteScriptTemplateLiteral = (str) => "`" + (unsafeScriptTemplateLiteralReg.test(str) ? str.replace(unsafeScriptTemplateLiteralReg, replaceUnsafeScriptTemplateLiteral) : str) + "`", unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kHead = Symbol();
|
|
243
|
+
// src/common/helpers.ts
|
|
244
|
+
function stringifyClassEntry(name, value) {
|
|
245
|
+
return value ? name : "";
|
|
246
|
+
}
|
|
247
|
+
function stringifyStyleEntry(name, value) {
|
|
248
|
+
return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
|
|
249
|
+
}
|
|
250
|
+
function escapeStyleAttr(str) {
|
|
251
|
+
return unsafeStyleAttrReg.test(str) ? str.replace(unsafeStyleAttrReg, replaceUnsafeStyleAttr) : str;
|
|
252
|
+
}
|
|
253
|
+
function escapeStyleValue(str) {
|
|
254
|
+
let closers = "", result = str.replace(/[\\"'{};<>]|\/(?=\*)/g, (c) => c === "<" ? "\\3C " : c === ";" ? "\\3B " : c === "{" ? "\\7B " : "\\" + c);
|
|
255
|
+
for (let c of result) c === "(" ? closers = ")" + closers : c === "[" ? closers = "]" + closers : c === closers[0] && (closers = closers.slice(1));
|
|
256
|
+
return result + closers;
|
|
257
|
+
}
|
|
258
|
+
function toDelimitedString(val, delimiter, stringify) {
|
|
259
|
+
let str = "", sep = "", part;
|
|
260
|
+
if (val) {
|
|
261
|
+
if (typeof val != "object") str += val;
|
|
262
|
+
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
263
|
+
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
264
|
+
}
|
|
265
|
+
return str;
|
|
266
|
+
}
|
|
267
|
+
function isEventHandler(name) {
|
|
268
|
+
return /^on[A-Z-]/.test(name);
|
|
269
|
+
}
|
|
270
|
+
function getEventType(name) {
|
|
271
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
272
|
+
}
|
|
273
|
+
function hasKeys(obj) {
|
|
274
|
+
for (let _ in obj) return !0;
|
|
275
|
+
return !1;
|
|
276
|
+
}
|
|
277
|
+
function isNullishOrFalse(value) {
|
|
278
|
+
return value == null || value === !1;
|
|
279
|
+
}
|
|
280
|
+
function isNotNullishOrFalse(value) {
|
|
281
|
+
return value != null && value !== !1;
|
|
282
|
+
}
|
|
283
|
+
function isPromise(value) {
|
|
284
|
+
return value != null && typeof value.then == "function";
|
|
285
|
+
}
|
|
286
|
+
function setClassAPIRenderer(render) {
|
|
287
|
+
classAPIRenderer = render;
|
|
288
|
+
}
|
|
289
|
+
function normalizeDynamicRenderer(value) {
|
|
290
|
+
if (value) {
|
|
291
|
+
if (typeof value == "string") return value;
|
|
292
|
+
let normalized = value.content || value.default || value;
|
|
293
|
+
if (classAPIRenderer) return classAPIRenderer(normalized);
|
|
294
|
+
if ("a" in normalized) return normalized;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// src/common/errors.ts
|
|
298
|
+
function _assert_class_toggles(classes, toggles) {}
|
|
299
|
+
function _el_read_error() {}
|
|
300
|
+
function _hoist_read_error() {}
|
|
301
|
+
function _signal_read_error() {}
|
|
302
|
+
function _assert_hoist(value) {}
|
|
303
|
+
// src/common/opt.ts
|
|
304
|
+
function toArray(opt) {
|
|
305
|
+
return opt ? Array.isArray(opt) ? opt : [opt] : [];
|
|
306
|
+
}
|
|
307
|
+
function reduce(opt, cb, acc) {
|
|
308
|
+
if (opt) {
|
|
309
|
+
if (Array.isArray(opt)) for (let item of opt) acc = cb(acc, item);
|
|
310
|
+
else acc = cb(acc, opt);
|
|
311
|
+
}
|
|
312
|
+
return acc;
|
|
313
|
+
}
|
|
314
|
+
function push(opt, item) {
|
|
315
|
+
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
316
|
+
}
|
|
317
|
+
function concat(opt, other) {
|
|
318
|
+
if (!opt) return other;
|
|
319
|
+
if (!other) return opt;
|
|
320
|
+
if (Array.isArray(opt)) {
|
|
321
|
+
if (Array.isArray(other)) for (let item of other) opt.push(item);
|
|
322
|
+
else opt.push(other);
|
|
323
|
+
return opt;
|
|
324
|
+
}
|
|
325
|
+
return Array.isArray(other) ? [opt, ...other] : [opt, other];
|
|
326
|
+
}
|
|
327
|
+
patchIteratorNext(Generator.prototype), patchIteratorNext(AsyncGenerator.prototype);
|
|
328
|
+
var State$1 = class {
|
|
329
|
+
ids = 0;
|
|
330
|
+
flushId = 0;
|
|
331
|
+
wroteUndefined = !1;
|
|
332
|
+
buf = [];
|
|
333
|
+
strs = /* @__PURE__ */ new Map();
|
|
334
|
+
refs = /* @__PURE__ */ new WeakMap();
|
|
335
|
+
deferredRefs = /* @__PURE__ */ new Set();
|
|
336
|
+
boundary;
|
|
337
|
+
channel = void 0;
|
|
338
|
+
channelDeps = null;
|
|
339
|
+
queuedCalls = [];
|
|
340
|
+
queuedReadyCalls = [];
|
|
341
|
+
scopeRef(scope, scopeId) {
|
|
342
|
+
return this.refs.get(scope) || newScopeReference(this, scope, scopeId);
|
|
343
|
+
}
|
|
344
|
+
writeScopeProps(props, ref) {
|
|
345
|
+
return writeObjectProps(this, props, ref);
|
|
346
|
+
}
|
|
347
|
+
scopesCursor(scopeId) {
|
|
348
|
+
return scopeId + ",";
|
|
349
|
+
}
|
|
350
|
+
writeTrailing(scopesIndex) {
|
|
351
|
+
let { buf } = this;
|
|
352
|
+
return ~scopesIndex && (buf[scopesIndex] = "_([" + buf[scopesIndex], buf.push("])")), writeDeferred(this), ",0)";
|
|
353
|
+
}
|
|
354
|
+
wrapPayload(result, extras) {
|
|
355
|
+
let arrow = this.wroteUndefined ? "(_,$)=>" : "_=>";
|
|
356
|
+
return this.wroteUndefined = !1, extras ? arrow + result : arrow + "[" + result + "]";
|
|
357
|
+
}
|
|
358
|
+
writeScopedRegistration(val, parent, accessor, registered) {
|
|
359
|
+
let ref = new Reference(parent, accessor, this.flushId, this.buf.length);
|
|
360
|
+
ref.channel = this.channel, this.refs.set(val, ref);
|
|
361
|
+
let scope = registered.scope, scopeId = scope[K_SCOPE_ID];
|
|
362
|
+
trackScope(this, scope, scopeId);
|
|
363
|
+
let locals = registered.locals?.(this.boundary.state.scope);
|
|
364
|
+
if (locals) {
|
|
365
|
+
this.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
366
|
+
for (let local of locals) this.buf.push(","), writePlainObject(this, local, newArgReference(this, ref, local));
|
|
367
|
+
} else this.buf.push("_(" + scopeId + "," + quoteRegistryId(registered.id));
|
|
368
|
+
this.buf.push(")");
|
|
369
|
+
}
|
|
370
|
+
}, Reference = class {
|
|
371
|
+
assignments = null;
|
|
372
|
+
deferredMembers = null;
|
|
373
|
+
scopeId = void 0;
|
|
374
|
+
channel = void 0;
|
|
375
|
+
parent;
|
|
376
|
+
accessor;
|
|
377
|
+
flushId;
|
|
378
|
+
pos;
|
|
379
|
+
id;
|
|
380
|
+
path = null;
|
|
381
|
+
constructor(parent, accessor, flushId, pos = null, id = null) {
|
|
382
|
+
this.parent = parent, this.accessor = accessor, this.flushId = flushId, this.pos = pos, this.id = id;
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
function stringifyScopes(state, flushes, boundary, channel) {
|
|
386
|
+
try {
|
|
387
|
+
return state.boundary = boundary, state.channel = channel, writeScopesRoot(state, flushes);
|
|
388
|
+
} catch (err) {
|
|
389
|
+
return abortRender(boundary, err), "";
|
|
390
|
+
} finally {
|
|
391
|
+
state.flushId++, state.buf = [];
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
function pendingReadyChannel(state) {
|
|
395
|
+
let calls = state.queuedReadyCalls;
|
|
396
|
+
return calls.length ? calls[0].channel : void 0;
|
|
397
|
+
}
|
|
398
|
+
function takeChannelDeps(state) {
|
|
399
|
+
let deps = state.channelDeps;
|
|
400
|
+
return state.channelDeps = null, deps;
|
|
401
|
+
}
|
|
402
|
+
function queueCall(state, value, object, method, channel) {
|
|
403
|
+
(channel?.readyId ? state.queuedReadyCalls : state.queuedCalls).push({
|
|
404
|
+
method,
|
|
405
|
+
value,
|
|
406
|
+
object,
|
|
407
|
+
channel,
|
|
408
|
+
valueId: null
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
function dropQueuedCall(state, value, object, method, channel) {
|
|
412
|
+
let queuedCalls = channel?.readyId ? state.queuedReadyCalls : state.queuedCalls;
|
|
413
|
+
for (let i = 0; i < queuedCalls.length; i++) {
|
|
414
|
+
let call = queuedCalls[i];
|
|
415
|
+
if (call.value === value && call.object === object && call.method === method) return queuedCalls.splice(i, 1), !0;
|
|
416
|
+
}
|
|
417
|
+
return !1;
|
|
418
|
+
}
|
|
419
|
+
function register(id, val, scope, locals, access = "_._" + toAccess(toObjectKey(id))) {
|
|
420
|
+
return REGISTRY.set(val, {
|
|
421
|
+
id,
|
|
422
|
+
scope,
|
|
423
|
+
locals,
|
|
424
|
+
access
|
|
425
|
+
}), val;
|
|
426
|
+
}
|
|
427
|
+
function writeScopesRoot(state, flushes) {
|
|
428
|
+
let { buf } = state, nextSlotId = -1, scopesIndex = -1;
|
|
429
|
+
for (let flush of flushes) {
|
|
430
|
+
let scopeId = flush[0], scope = flush[1], ref = state.scopeRef(scope, scopeId), openIndex = buf.push("") - 1;
|
|
431
|
+
state.writeScopeProps(flush[2], ref) ? (buf[openIndex] = nextSlotId === -1 ? state.scopesCursor(scopeId) + "{" : (scopeId === nextSlotId ? "" : "," + (scopeId - nextSlotId)) + ",{", scopesIndex === -1 && (scopesIndex = openIndex), nextSlotId = scopeId + 1, buf.push("}")) : buf.pop();
|
|
432
|
+
}
|
|
433
|
+
let extras = "";
|
|
434
|
+
(state.deferredRefs.size || hasMatchingCalls(state, state.channel?.readyId)) && (extras = state.writeTrailing(scopesIndex));
|
|
435
|
+
let result = extras && "(";
|
|
436
|
+
for (let chunk of buf) result += chunk;
|
|
437
|
+
return result += extras, result ? state.wrapPayload(result, extras) : "";
|
|
438
|
+
}
|
|
439
|
+
function writeDeferred(state) {
|
|
440
|
+
let sep = state.buf.length ? "," : "";
|
|
441
|
+
if (state.deferredRefs.size) {
|
|
442
|
+
let pending = state.deferredRefs;
|
|
443
|
+
state.deferredRefs = /* @__PURE__ */ new Set();
|
|
444
|
+
let buf = "", hasCalls = !1;
|
|
445
|
+
for (let ref of pending) ref.assignments && (buf += sep + assignmentsToString(ref.assignments, ref.id), ref.assignments = null, sep = ","), hasCalls ||= ref.deferredMembers !== null;
|
|
446
|
+
if (buf && state.buf.push(buf), hasCalls) for (let ref of pending) {
|
|
447
|
+
let members = ref.deferredMembers;
|
|
448
|
+
members && (writeDeferredMembers(state, ref.id, members), ref.deferredMembers = null);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
let readyId = state.channel?.readyId, calls = state.queuedCalls;
|
|
452
|
+
if (readyId) {
|
|
453
|
+
calls = [];
|
|
454
|
+
let remaining = [];
|
|
455
|
+
for (let call of state.queuedReadyCalls) (call.channel.readyId === readyId ? calls : remaining).push(call);
|
|
456
|
+
state.queuedReadyCalls = remaining;
|
|
457
|
+
} else calls.length && (state.queuedCalls = []);
|
|
458
|
+
for (let call of calls) {
|
|
459
|
+
let objectStartIndex = state.buf.push(state.buf.length === 0 ? "" : ",");
|
|
460
|
+
if (writeProp(state, call.object, null, "")) {
|
|
461
|
+
let objectRef = state.refs.get(call.object);
|
|
462
|
+
!objectRef.id && !isAncestorChannelRef(state, objectRef) ? (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex], state.buf.push(")")) : objectRef.id && state.buf[objectStartIndex] !== objectRef.id && (state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex], state.buf.push(")"));
|
|
463
|
+
} else state.buf.push("void 0");
|
|
464
|
+
state.buf.push("." + call.method + "("), call.value !== void 0 && writeCallArg(state, call.value, call.valueId), state.buf.push(")");
|
|
465
|
+
}
|
|
466
|
+
state.deferredRefs.size && writeDeferred(state);
|
|
467
|
+
}
|
|
468
|
+
function writeDeferredMembers(state, id, { collection, first, rest }) {
|
|
469
|
+
if (collection instanceof Map) {
|
|
470
|
+
writeDeferredEntry(state, id, first);
|
|
471
|
+
for (let entry of rest) writeDeferredEntry(state, id, entry);
|
|
472
|
+
} else {
|
|
473
|
+
writeDeferredMember(state, id, first);
|
|
474
|
+
for (let member of rest) writeDeferredMember(state, id, member);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function writeDeferredEntry(state, id, [key, value]) {
|
|
478
|
+
state.buf.push("," + id + ".set("), (key !== void 0 || value !== void 0) && writeCallArg(state, key, null), value !== void 0 && (state.buf.push(","), writeCallArg(state, value, null)), state.buf.push(")");
|
|
479
|
+
}
|
|
480
|
+
function writeDeferredMember(state, id, member) {
|
|
481
|
+
state.buf.push("," + id + ".add("), member !== void 0 && writeCallArg(state, member, null), state.buf.push(")");
|
|
482
|
+
}
|
|
483
|
+
function writeCallArg(state, val, valueId) {
|
|
484
|
+
let startIndex = state.buf.length;
|
|
485
|
+
if (val === void 0) state.wroteUndefined = !0, state.buf.push("$");
|
|
486
|
+
else if (writeProp(state, val, null, "")) {
|
|
487
|
+
let ref = typeof val == "string" ? state.strs.get(val) : state.refs.get(val);
|
|
488
|
+
ref && !ref.id && ref.scopeId === void 0 && !isAncestorChannelRef(state, ref) && (ref.id = valueId || nextRefAccess(state), state.buf[startIndex] = ref.id + "=" + state.buf[startIndex]);
|
|
489
|
+
} else state.buf.push("void 0");
|
|
490
|
+
}
|
|
491
|
+
function hasMatchingCalls(state, readyId) {
|
|
492
|
+
if (!readyId) return state.queuedCalls.length > 0;
|
|
493
|
+
for (let call of state.queuedReadyCalls) if (call.channel.readyId === readyId) return !0;
|
|
494
|
+
return !1;
|
|
495
|
+
}
|
|
496
|
+
function writeProp(state, val, parent, accessor) {
|
|
497
|
+
switch (typeof val) {
|
|
498
|
+
case "string": return writeString(state, val, parent, accessor);
|
|
499
|
+
case "number": return writeNumber(state, val);
|
|
500
|
+
case "boolean": return writeBoolean(state, val);
|
|
501
|
+
case "bigint": return writeBigInt(state, val);
|
|
502
|
+
case "symbol": return writeSymbol(state, val, parent, accessor);
|
|
503
|
+
case "function": return writeFunction(state, val, parent, accessor);
|
|
504
|
+
case "object": return writeObject(state, val, parent, accessor);
|
|
505
|
+
default: return !1;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function writeReferenceOr(state, write, val, parent, accessor) {
|
|
509
|
+
let ref = state.refs.get(val);
|
|
510
|
+
if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureRefAccess(state, ref), state.deferredRefs.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (writeRef(state, ref), !0) : !1;
|
|
511
|
+
let registered = REGISTRY.get(val);
|
|
512
|
+
return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(val, ref = new Reference(parent, accessor, state.flushId, state.buf.length)), ref.channel = state.channel, write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
|
|
513
|
+
}
|
|
514
|
+
function trackScope(state, val, scopeId) {
|
|
515
|
+
let ref = state.refs.get(val);
|
|
516
|
+
ref ? trackChannel(state, ref) : newScopeReference(state, val, scopeId);
|
|
517
|
+
}
|
|
518
|
+
function newScopeReference(state, val, scopeId) {
|
|
519
|
+
let ref = new Reference(null, null, state.flushId);
|
|
520
|
+
return ref.scopeId = scopeId, ref.channel = state.channel, state.refs.set(val, ref), ref;
|
|
521
|
+
}
|
|
522
|
+
function quoteRegistryId(id) {
|
|
523
|
+
return "\"" + id + "\"";
|
|
524
|
+
}
|
|
525
|
+
function writeRegistered(state, val, parent, accessor, registered) {
|
|
526
|
+
let { scope } = registered;
|
|
527
|
+
return scope ? state.writeScopedRegistration(val, parent, accessor, registered) : state.buf.push(registered.access), !0;
|
|
528
|
+
}
|
|
529
|
+
function writeString(state, val, parent, accessor) {
|
|
530
|
+
if (val.length > 12) {
|
|
531
|
+
let ref = state.strs.get(val);
|
|
532
|
+
if (ref) {
|
|
533
|
+
if (trackChannel(state, ref)) return writeRef(state, ref), !0;
|
|
534
|
+
} else {
|
|
535
|
+
let ref = new Reference(parent, accessor, state.flushId, state.buf.length);
|
|
536
|
+
ref.channel = state.channel, state.strs.set(val, ref);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return state.buf.push(quote(val, 0)), !0;
|
|
540
|
+
}
|
|
541
|
+
function writeNumber(state, val) {
|
|
542
|
+
return state.buf.push(val + ""), !0;
|
|
543
|
+
}
|
|
544
|
+
function writeBoolean(state, val) {
|
|
545
|
+
return state.buf.push(val ? "!0" : "!1"), !0;
|
|
546
|
+
}
|
|
547
|
+
function writeBigInt(state, val) {
|
|
548
|
+
return state.buf.push(val + "n"), !0;
|
|
549
|
+
}
|
|
550
|
+
function writeFunction(state, val, parent, accessor) {
|
|
551
|
+
let wellKnownFunction = KNOWN_FUNCTIONS.get(val);
|
|
552
|
+
return wellKnownFunction ? (state.buf.push(wellKnownFunction), !0) : writeReferenceOr(state, writeNever, val, parent, accessor);
|
|
553
|
+
}
|
|
554
|
+
function writeSymbol(state, val, parent, accessor) {
|
|
555
|
+
let wellKnownSymbol = KNOWN_SYMBOLS.get(val);
|
|
556
|
+
if (wellKnownSymbol) return state.buf.push(wellKnownSymbol), !0;
|
|
557
|
+
let key = Symbol.keyFor(val);
|
|
558
|
+
return key === void 0 ? writeReferenceOr(state, writeUnknownSymbol, val, parent, accessor) : (state.buf.push("Symbol.for(" + quote(key, 0) + ")"), !0);
|
|
559
|
+
}
|
|
560
|
+
function writeUnknownSymbol(state) {
|
|
561
|
+
return state.buf.push("Symbol()"), !0;
|
|
562
|
+
}
|
|
563
|
+
function writeNever(state, val, ref) {
|
|
564
|
+
return !1;
|
|
565
|
+
}
|
|
566
|
+
function writeNull(state) {
|
|
567
|
+
return state.buf.push("null"), !0;
|
|
568
|
+
}
|
|
569
|
+
function writeObject(state, val, parent, accessor) {
|
|
570
|
+
if (val === null) return writeNull(state);
|
|
571
|
+
let scopeId = val[K_SCOPE_ID];
|
|
572
|
+
if (scopeId !== void 0) return trackScope(state, val, scopeId), state.buf.push("_(" + scopeId + ")"), !0;
|
|
573
|
+
let wellKnownObject = KNOWN_OBJECTS.get(val);
|
|
574
|
+
return wellKnownObject ? (state.buf.push(wellKnownObject), !0) : writeReferenceOr(state, writeUnknownObject, val, parent, accessor);
|
|
575
|
+
}
|
|
576
|
+
function writeUnknownObject(state, val, ref) {
|
|
577
|
+
let proto = Object.getPrototypeOf(val);
|
|
578
|
+
if (proto === objectProto) return writePlainObject(state, val, ref);
|
|
579
|
+
if (proto === arrayProto) return writeArray(state, val, ref);
|
|
580
|
+
let constructor = proto?.constructor;
|
|
581
|
+
switch (constructor) {
|
|
582
|
+
case void 0: return writeNullObject(state, val, ref);
|
|
583
|
+
case Object: return writePlainObject(state, val, ref);
|
|
584
|
+
case Array: return writeArray(state, val, ref);
|
|
585
|
+
case Date: return writeDate(state, val);
|
|
586
|
+
case RegExp: return writeRegExp(state, val);
|
|
587
|
+
case Promise: return writePromise(state, val, ref);
|
|
588
|
+
case Map: return writeMap(state, val, ref);
|
|
589
|
+
case Set: return writeSet(state, val, ref);
|
|
590
|
+
case Generator: return writeGenerator(state, val, ref);
|
|
591
|
+
case AsyncGenerator: return writeAsyncGenerator(state, val, ref);
|
|
592
|
+
case Error:
|
|
593
|
+
case EvalError:
|
|
594
|
+
case RangeError:
|
|
595
|
+
case ReferenceError:
|
|
596
|
+
case SyntaxError:
|
|
597
|
+
case TypeError:
|
|
598
|
+
case URIError: return writeError(state, val, constructor.name, ref);
|
|
599
|
+
case AggregateError: return writeAggregateError(state, val, ref);
|
|
600
|
+
case ArrayBuffer: return writeArrayBuffer(state, val);
|
|
601
|
+
case Int8Array:
|
|
602
|
+
case Uint8Array:
|
|
603
|
+
case Uint8ClampedArray:
|
|
604
|
+
case Int16Array:
|
|
605
|
+
case Uint16Array:
|
|
606
|
+
case Int32Array:
|
|
607
|
+
case Uint32Array:
|
|
608
|
+
case Float32Array:
|
|
609
|
+
case Float64Array:
|
|
610
|
+
case BigInt64Array:
|
|
611
|
+
case BigUint64Array: return writeTypedArray(state, val, constructor.name, ref);
|
|
612
|
+
case DataView: return writeDataView(state, val, ref);
|
|
613
|
+
case WeakSet: return writeWeakSet(state);
|
|
614
|
+
case WeakMap: return writeWeakMap(state);
|
|
615
|
+
case globalThis.URL: return writeURL(state, val);
|
|
616
|
+
case globalThis.URLSearchParams: return writeURLSearchParams(state, val);
|
|
617
|
+
case globalThis.Headers: return writeHeaders(state, val);
|
|
618
|
+
case globalThis.FormData: return writeFormData(state, val, ref);
|
|
619
|
+
case globalThis.ReadableStream: return writeReadableStream(state, val, ref);
|
|
620
|
+
case globalThis.Request: return writeRequest(state, val, ref);
|
|
621
|
+
case globalThis.Response: return writeResponse(state, val, ref);
|
|
622
|
+
case globalThis.Intl?.NumberFormat: return writeIntl(state, val, "NumberFormat", ref);
|
|
623
|
+
case globalThis.Intl?.DateTimeFormat: return writeIntl(state, val, "DateTimeFormat", ref);
|
|
624
|
+
case globalThis.Intl?.Collator: return writeIntl(state, val, "Collator", ref);
|
|
625
|
+
case globalThis.Intl?.PluralRules: return writeIntl(state, val, "PluralRules", ref);
|
|
626
|
+
case globalThis.Intl?.RelativeTimeFormat: return writeIntl(state, val, "RelativeTimeFormat", ref);
|
|
627
|
+
case globalThis.Intl?.ListFormat: return writeIntl(state, val, "ListFormat", ref);
|
|
628
|
+
case globalThis.Intl?.DisplayNames: return writeIntl(state, val, "DisplayNames", ref);
|
|
629
|
+
case globalThis.Intl?.Segmenter: return writeIntl(state, val, "Segmenter", ref);
|
|
630
|
+
case globalThis.Intl?.DurationFormat: return writeIntl(state, val, "DurationFormat", ref);
|
|
631
|
+
case globalThis.Intl?.Locale: return writeIntlLocale(state, val);
|
|
632
|
+
case globalThis.Temporal?.Instant: return writeTemporal(state, val, "Instant");
|
|
633
|
+
case globalThis.Temporal?.Duration: return writeTemporal(state, val, "Duration");
|
|
634
|
+
case globalThis.Temporal?.PlainDate: return writeTemporal(state, val, "PlainDate");
|
|
635
|
+
case globalThis.Temporal?.PlainDateTime: return writeTemporal(state, val, "PlainDateTime");
|
|
636
|
+
case globalThis.Temporal?.PlainMonthDay: return writeTemporal(state, val, "PlainMonthDay");
|
|
637
|
+
case globalThis.Temporal?.PlainTime: return writeTemporal(state, val, "PlainTime");
|
|
638
|
+
case globalThis.Temporal?.PlainYearMonth: return writeTemporal(state, val, "PlainYearMonth");
|
|
639
|
+
case globalThis.Temporal?.ZonedDateTime: return writeTemporal(state, val, "ZonedDateTime");
|
|
640
|
+
}
|
|
641
|
+
return !1;
|
|
642
|
+
}
|
|
643
|
+
function writePlainObject(state, val, ref) {
|
|
644
|
+
return state.buf.push("{"), writeMaybeIterableProps(state, val, ref), state.buf.push("}"), !0;
|
|
645
|
+
}
|
|
646
|
+
function writeArray(state, val, ref) {
|
|
647
|
+
let sep = "[";
|
|
648
|
+
for (let i = 0; i < val.length; i++) {
|
|
649
|
+
let item = val[i];
|
|
650
|
+
state.buf.push(sep), sep = ",", item === void 0 ? (state.wroteUndefined = !0, state.buf.push("$")) : writeProp(state, item, ref, "" + i);
|
|
651
|
+
}
|
|
652
|
+
return sep === "[" ? state.buf.push("[]") : state.buf.push("]"), !0;
|
|
653
|
+
}
|
|
654
|
+
function writeDate(state, val) {
|
|
655
|
+
return state.buf.push("new Date(" + +val + ")"), !0;
|
|
656
|
+
}
|
|
657
|
+
function writeRegExp(state, val) {
|
|
658
|
+
let { source } = val;
|
|
659
|
+
return source.includes("<") ? state.buf.push(`RegExp(${quote(source, 0)}${val.flags ? ",\"" + val.flags + "\"" : ""})`) : state.buf.push("/" + (unsafeRegExpSourceDetect.test(source) ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags), !0;
|
|
660
|
+
}
|
|
661
|
+
function writePromise(state, val, ref) {
|
|
662
|
+
let { boundary, channel } = state, pId = nextRefAccess(state), handle = newAsyncHandle(state, ref, pId);
|
|
663
|
+
return state.buf.push("(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()"), val.then((v) => queueAsyncCall(state, boundary, handle, "f", v, channel, pId), (v) => queueAsyncCall(state, boundary, handle, "r", v, channel, pId)), boundary.startAsync(), !0;
|
|
664
|
+
}
|
|
665
|
+
function newAsyncHandle(state, parent, id) {
|
|
666
|
+
let handle = {}, handleRef = new Reference(parent, null, state.flushId, null, id);
|
|
667
|
+
return handleRef.channel = state.channel, state.refs.set(handle, handleRef), handle;
|
|
668
|
+
}
|
|
669
|
+
function writeMap(state, val, ref) {
|
|
670
|
+
if (!val.size) return state.buf.push("new Map"), !0;
|
|
671
|
+
let items = [], assignments, needsId, i = 0, entries = val.entries();
|
|
672
|
+
if (val.size < 25) {
|
|
673
|
+
for (let entry of entries) {
|
|
674
|
+
let [itemKey, itemValue] = entry;
|
|
675
|
+
if (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) {
|
|
676
|
+
if (deferMembers(state, ref, val, entry, entries), !i) return state.buf.push("new Map"), !0;
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
itemKey === val && (itemKey = void 0, (assignments ||= []).push("a[" + i + "][0]")), itemValue === val && (itemValue = void 0, (assignments ||= []).push("a[" + i + "][1]")), needsId ||= isReusableMember(itemKey) || isReusableMember(itemValue), i = items.push(itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]);
|
|
680
|
+
}
|
|
681
|
+
writeArrayArg(state, ref, items, assignments && "((m,a)=>(" + assignmentsToString(assignments, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map,", "new Map(", needsId);
|
|
682
|
+
} else {
|
|
683
|
+
for (let entry of entries) {
|
|
684
|
+
let [itemKey, itemValue] = entry;
|
|
685
|
+
if (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) {
|
|
686
|
+
if (deferMembers(state, ref, val, entry, entries), !i) return state.buf.push("new Map"), !0;
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
itemKey === val && (itemKey = 0, (assignments ||= []).push("a[" + i + "]")), itemValue === val && (itemValue = 0, (assignments ||= []).push("a[" + (i + 1) + "]")), needsId ||= isReusableMember(itemKey) || isReusableMember(itemValue), i = items.push(itemKey, itemValue);
|
|
690
|
+
}
|
|
691
|
+
writeArrayArg(state, ref, items, assignments && "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignmentsToString(assignments, "new Map") + "))(", "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(", needsId);
|
|
692
|
+
}
|
|
693
|
+
return !0;
|
|
694
|
+
}
|
|
695
|
+
function writeSet(state, val, ref) {
|
|
696
|
+
if (!val.size) return state.buf.push("new Set"), !0;
|
|
697
|
+
let items = [], assignments, needsId, i = 0, members = val.values();
|
|
698
|
+
for (let item of members) {
|
|
699
|
+
if (item !== val && isAncestorMember(state, ref, item)) {
|
|
700
|
+
if (deferMembers(state, ref, val, item, members), !i) return state.buf.push("new Set"), !0;
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
item === val ? (item = 0, (assignments ||= []).push("i[" + i + "]")) : needsId ||= isReusableMember(item), i = items.push(item);
|
|
704
|
+
}
|
|
705
|
+
return writeArrayArg(state, ref, items, assignments && "((s,i)=>(" + assignmentsToString(assignments, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId), !0;
|
|
706
|
+
}
|
|
707
|
+
function isAncestorMember(state, container, member) {
|
|
708
|
+
if (member === null || typeof member != "object" && typeof member != "function") return !1;
|
|
709
|
+
let ref = state.refs.get(member);
|
|
710
|
+
return ref !== void 0 && isCircular(container, ref);
|
|
711
|
+
}
|
|
712
|
+
function deferMembers(state, ref, collection, first, rest) {
|
|
713
|
+
ensureRefAccess(state, ref), ref.deferredMembers = {
|
|
714
|
+
collection,
|
|
715
|
+
first,
|
|
716
|
+
rest
|
|
717
|
+
}, state.deferredRefs.add(ref);
|
|
718
|
+
}
|
|
719
|
+
function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
720
|
+
if (assignsPrefix || needsId) {
|
|
721
|
+
let arrayRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
722
|
+
state.buf.push((assignsPrefix || plainPrefix) + arrayRef.id + "="), writeArray(state, items, arrayRef);
|
|
723
|
+
} else state.buf.push(plainPrefix), writeArray(state, items, new Reference(ref, null, state.flushId, state.buf.length));
|
|
724
|
+
state.buf.push(")");
|
|
725
|
+
}
|
|
726
|
+
function newArgReference(state, parent, val) {
|
|
727
|
+
for (let key in val) {
|
|
728
|
+
let member = val[key];
|
|
729
|
+
if (isReusableMember(member) && !(typeof member == "string" ? state.strs.has(member) : state.refs.has(member))) {
|
|
730
|
+
let ref = new Reference(parent, null, state.flushId, null, nextRefAccess(state));
|
|
731
|
+
return state.buf.push(ref.id + "="), ref;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return new Reference(parent, null, state.flushId, state.buf.length);
|
|
735
|
+
}
|
|
736
|
+
function isReusableMember(val) {
|
|
737
|
+
switch (typeof val) {
|
|
738
|
+
case "object": return val !== null && val[K_SCOPE_ID] === void 0;
|
|
739
|
+
case "function":
|
|
740
|
+
case "symbol": return !0;
|
|
741
|
+
case "string": return val.length > 12;
|
|
742
|
+
default: return !1;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
function canWriteBuffer(state, buffer, ref) {
|
|
746
|
+
return Object.getPrototypeOf(buffer)?.constructor === ArrayBuffer;
|
|
747
|
+
}
|
|
748
|
+
function writeDataView(state, val, ref) {
|
|
749
|
+
let { buffer } = val;
|
|
750
|
+
if (!canWriteBuffer(state, buffer, ref)) return !1;
|
|
751
|
+
let needsLength = val.byteOffset + val.byteLength < buffer.byteLength;
|
|
752
|
+
return state.buf.push("new DataView("), writeProp(state, buffer, ref, "buffer"), state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.byteLength : "") : "") + ")"), !0;
|
|
753
|
+
}
|
|
754
|
+
function writeArrayBuffer(state, val) {
|
|
755
|
+
let result;
|
|
756
|
+
if (val.byteLength) {
|
|
757
|
+
let view = new Int8Array(val);
|
|
758
|
+
result = hasOnlyZeros(view) ? "new ArrayBuffer(" + val.byteLength + ")" : "new Int8Array(" + typedArrayToInitString(view) + ").buffer";
|
|
759
|
+
} else result = "new ArrayBuffer";
|
|
760
|
+
return state.buf.push(result), !0;
|
|
761
|
+
}
|
|
762
|
+
function writeTypedArray(state, val, name, ref) {
|
|
763
|
+
if (val.byteOffset || val.byteLength < val.buffer.byteLength || state.refs.has(val.buffer)) {
|
|
764
|
+
if (!canWriteBuffer(state, val.buffer, ref)) return !1;
|
|
765
|
+
let needsLength = val.byteOffset + val.byteLength < val.buffer.byteLength;
|
|
766
|
+
state.buf.push("new " + name + "("), writeProp(state, val.buffer, ref, "buffer"), state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.length : "") : "") + ")");
|
|
767
|
+
} else state.refs.set(val.buffer, new Reference(ref, "buffer", state.flushId, null)), state.buf.push("new " + name + (val.length === 0 ? "" : "(" + (hasOnlyZeros(val) ? val.length : typedArrayToInitString(val)) + ")"));
|
|
768
|
+
return !0;
|
|
769
|
+
}
|
|
770
|
+
function writeWeakSet(state) {
|
|
771
|
+
return state.buf.push("new WeakSet"), !0;
|
|
772
|
+
}
|
|
773
|
+
function writeWeakMap(state) {
|
|
774
|
+
return state.buf.push("new WeakMap"), !0;
|
|
775
|
+
}
|
|
776
|
+
function writeError(state, val, name, ref) {
|
|
777
|
+
let result = "new " + name + "(" + quote(val.message + "", 0);
|
|
778
|
+
if (val.cause !== void 0) {
|
|
779
|
+
let pos = state.buf.push(result + ",{cause:") - 1;
|
|
780
|
+
writeProp(state, val.cause, ref, "cause") ? state.buf.push("})") : state.buf[pos] = state.buf[pos].slice(0, -8) + ")";
|
|
781
|
+
} else state.buf.push(result + ")");
|
|
782
|
+
return !0;
|
|
783
|
+
}
|
|
784
|
+
function writeAggregateError(state, val, ref) {
|
|
785
|
+
state.buf.push("new AggregateError(");
|
|
786
|
+
let inlined = writeProp(state, val.errors, ref, "errors");
|
|
787
|
+
if (inlined || state.buf.push("[]"), val.message ? state.buf.push("," + quote(val.message + "", 0) + ")") : state.buf.push(")"), inlined) {
|
|
788
|
+
let errorsRef = state.refs.get(val.errors);
|
|
789
|
+
errorsRef?.id && (state.deferredRefs.add(errorsRef), addAssignment(errorsRef, accessId(state, ref) + toAccess("errors")));
|
|
790
|
+
}
|
|
791
|
+
return !0;
|
|
792
|
+
}
|
|
793
|
+
function writeURL(state, val) {
|
|
794
|
+
return state.buf.push("new URL(" + quote(val.toString(), 0) + ")"), !0;
|
|
795
|
+
}
|
|
796
|
+
function writeURLSearchParams(state, val) {
|
|
797
|
+
let str = val.toString();
|
|
798
|
+
return str ? state.buf.push("new URLSearchParams(" + quote(str, 0) + ")") : state.buf.push("new URLSearchParams"), !0;
|
|
799
|
+
}
|
|
800
|
+
function writeHeaders(state, val) {
|
|
801
|
+
let headers = stringEntriesToHeadersInit(val);
|
|
802
|
+
return state.buf.push("new Headers" + (headers ? "(" + headers + ")" : "")), !0;
|
|
803
|
+
}
|
|
804
|
+
function writeFormData(state, val, ref) {
|
|
805
|
+
let sep = "[", valStr = "";
|
|
806
|
+
for (let [key, value] of val) {
|
|
807
|
+
if (typeof value != "string") return !1;
|
|
808
|
+
valStr += sep + quote(key, 0) + "," + quote(value, 0), sep = ",";
|
|
809
|
+
}
|
|
810
|
+
return sep === "[" ? state.buf.push("new FormData") : state.buf.push(valStr + "].reduce((f,v,i,a)=>i%2&&f.append(a[i-1],v)||f,new FormData)"), !0;
|
|
811
|
+
}
|
|
812
|
+
function writeRequest(state, val, ref) {
|
|
813
|
+
let sep = "", bodySerialized = !1, hasBody = val.body && !val.bodyUsed && val.duplex === "half";
|
|
814
|
+
state.buf.push("new Request(" + quote(val.url, 0)), hasBody && (state.buf.push(",{body:"), writeProp(state, val.body, ref, "body") ? (state.buf.push(",duplex:\"half\""), sep = ",", bodySerialized = !0) : state.buf.pop());
|
|
815
|
+
let options = "";
|
|
816
|
+
val.cache !== "default" && (options += sep + "cache:" + quote(val.cache, 0), sep = ","), val.credentials !== "same-origin" && (options += sep + "credentials:" + quote(val.credentials, 0), sep = ",");
|
|
817
|
+
let headers = headersOption(state, val.headers, ref);
|
|
818
|
+
return headers && (options += sep + "headers:" + headers, sep = ","), val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)), state.buf.push(bodySerialized ? options + "})" : options ? ",{" + options + "})" : ")"), !0;
|
|
819
|
+
}
|
|
820
|
+
function writeResponse(state, val, ref) {
|
|
821
|
+
let sep = "", options = "";
|
|
822
|
+
val.status !== 200 && (options += "status:" + val.status, sep = ","), val.statusText && (options += sep + "statusText:" + quote(val.statusText, 0), sep = ",");
|
|
823
|
+
let headers = headersOption(state, val.headers, ref);
|
|
824
|
+
return headers && (options += sep + "headers:" + headers), !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;
|
|
825
|
+
}
|
|
826
|
+
function headersOption(state, headers, ref) {
|
|
827
|
+
let seen = state.refs.get(headers);
|
|
828
|
+
return seen ? ensureRefAccess(state, seen) : (state.refs.set(headers, new Reference(ref, "headers", state.flushId, null)), stringEntriesToHeadersInit(headers));
|
|
829
|
+
}
|
|
830
|
+
function writeIntl(state, val, name, ref) {
|
|
831
|
+
let { locale, ...options } = val.resolvedOptions();
|
|
832
|
+
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
833
|
+
let optionsRef = newArgReference(state, ref, options);
|
|
834
|
+
return state.buf.push("{"), writeObjectProps(state, options, optionsRef), state.buf.push("})"), !0;
|
|
835
|
+
}
|
|
836
|
+
function writeIntlLocale(state, val) {
|
|
837
|
+
return state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")"), !0;
|
|
838
|
+
}
|
|
839
|
+
function writeTemporal(state, val, name) {
|
|
840
|
+
return state.buf.push("Temporal." + name + ".from(" + quote(val.toString(), 0) + ")"), !0;
|
|
841
|
+
}
|
|
842
|
+
function writeReadableStream(state, val, ref) {
|
|
843
|
+
if (val.locked) return !1;
|
|
844
|
+
let { boundary, channel } = state, reader = val.getReader(), iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
845
|
+
done ? queueAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (reader.read().then(onFulfilled, onRejected), boundary.startAsync(), queueAsyncCall(state, boundary, handle, "f", value, channel));
|
|
846
|
+
}, onRejected = (reason) => {
|
|
847
|
+
queueAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
848
|
+
};
|
|
849
|
+
return state.buf.push("new ReadableStream({start(c){(async(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()]))=>{for(i of a)v=await i,i==l?c.close():c.enqueue(v)})(" + iterId + "={}).catch(e=>c.error(e))}})"), reader.read().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
|
850
|
+
}
|
|
851
|
+
function writeGenerator(state, iter, ref) {
|
|
852
|
+
if (iter[kTouchedIterator]) return state.buf.push("(function*(){}())"), !0;
|
|
853
|
+
let yields = [], returnValue, needsId;
|
|
854
|
+
for (;;) {
|
|
855
|
+
let { value, done } = iter.next();
|
|
856
|
+
if (done) {
|
|
857
|
+
returnValue = value;
|
|
858
|
+
break;
|
|
859
|
+
}
|
|
860
|
+
needsId ||= isReusableMember(value), yields.push(value);
|
|
861
|
+
}
|
|
862
|
+
if (returnValue === void 0 && !yields.length) return state.buf.push("(function*(){})()"), !0;
|
|
863
|
+
let heldReturn = returnValue !== void 0 && isAncestorMember(state, ref, returnValue);
|
|
864
|
+
if (state.buf.push(returnValue === void 0 ? "(function*(a){yield*a})(" : heldReturn ? "(function*(a,r){yield*a;return r.v})(" : "(function*(a,r){yield*a;return r})("), needsId) {
|
|
865
|
+
let arrayRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
866
|
+
state.buf.push(arrayRef.id + "="), writeArray(state, yields, arrayRef);
|
|
867
|
+
} else writeArray(state, yields, new Reference(ref, null, state.flushId, state.buf.length));
|
|
868
|
+
if (heldReturn) {
|
|
869
|
+
let holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
870
|
+
state.buf.push("," + holder.id + "={}"), writeProp(state, returnValue, holder, "v");
|
|
871
|
+
} else if (returnValue !== void 0 && (state.buf.push(","), writeProp(state, returnValue, ref, "") && isReusableMember(returnValue))) {
|
|
872
|
+
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
873
|
+
retRef && ensureRefAccess(state, retRef);
|
|
874
|
+
}
|
|
875
|
+
return state.buf.push(")"), !0;
|
|
876
|
+
}
|
|
877
|
+
function writeAsyncGenerator(state, iter, ref) {
|
|
878
|
+
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
879
|
+
let { boundary, channel } = state, iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
880
|
+
done ? queueAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (iter.next().then(onFulfilled, onRejected), boundary.startAsync(), queueAsyncCall(state, boundary, handle, "f", value, channel));
|
|
881
|
+
}, onRejected = (reason) => {
|
|
882
|
+
queueAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
883
|
+
};
|
|
884
|
+
return state.buf.push("(async function*(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()])){for(i of a)v=await i,i!=l&&(yield v);return v})(" + iterId + "={})"), iter.next().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
|
885
|
+
}
|
|
886
|
+
function writeNullObject(state, val, ref) {
|
|
887
|
+
return state.buf.push("{"), state.buf.push(writeMaybeIterableProps(state, val, ref) + "__proto__:null}"), !0;
|
|
888
|
+
}
|
|
889
|
+
function writeObjectProps(state, val, ref) {
|
|
890
|
+
let sep = "";
|
|
891
|
+
for (let key in val) if (hasOwnProperty.call(val, key)) {
|
|
892
|
+
let escapedKey = toObjectKey(key);
|
|
893
|
+
state.buf.push(sep + escapedKey + ":"), writeProp(state, val[key], ref, escapedKey) ? sep = "," : state.buf.pop();
|
|
894
|
+
}
|
|
895
|
+
return sep;
|
|
896
|
+
}
|
|
897
|
+
function writeMaybeIterableProps(state, val, ref) {
|
|
898
|
+
let sep = writeObjectProps(state, val, ref);
|
|
899
|
+
if (hasSymbolIterator(val)) {
|
|
900
|
+
let yieldSelf = "", iterArr = [];
|
|
901
|
+
for (let item of val) item === val && !(yieldSelf || iterArr.length) ? yieldSelf = "yield this;" : iterArr.push(item);
|
|
902
|
+
if (iterArr.length) {
|
|
903
|
+
let iterRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
904
|
+
state.buf.push(sep + "*[(" + iterRef.id + "="), writeArray(state, iterArr, iterRef), state.buf.push(",Symbol.iterator)](){" + yieldSelf + "yield*" + iterRef.id + "}");
|
|
905
|
+
} else state.buf.push(sep + "*[Symbol.iterator](){" + yieldSelf.slice(0, -1) + "}");
|
|
906
|
+
sep = ",";
|
|
907
|
+
}
|
|
908
|
+
return sep;
|
|
909
|
+
}
|
|
910
|
+
function queueAsyncCall(state, boundary, handle, method, value, channel, valueId = null) {
|
|
911
|
+
boundary.aborted || ((channel?.readyId ? state.queuedReadyCalls : state.queuedCalls).push({
|
|
912
|
+
method,
|
|
913
|
+
value,
|
|
914
|
+
object: handle,
|
|
915
|
+
channel,
|
|
916
|
+
valueId
|
|
917
|
+
}), boundary.endAsync());
|
|
918
|
+
}
|
|
919
|
+
function trackChannel(state, ref) {
|
|
920
|
+
let refReadyId = ref.channel?.readyId;
|
|
921
|
+
if (!refReadyId || refReadyId === state.channel?.readyId) return !0;
|
|
922
|
+
let cur = state.channel?.parent;
|
|
923
|
+
for (; cur;) {
|
|
924
|
+
if (cur.readyId === refReadyId) return (state.channelDeps ||= /* @__PURE__ */ new Set()).add(refReadyId), !0;
|
|
925
|
+
cur = cur.parent;
|
|
926
|
+
}
|
|
927
|
+
return !1;
|
|
928
|
+
}
|
|
929
|
+
function isAncestorChannelRef(state, ref) {
|
|
930
|
+
return ref.channel?.readyId !== state.channel?.readyId;
|
|
931
|
+
}
|
|
932
|
+
function abortRender(boundary, err) {
|
|
933
|
+
for (; boundary.parent;) boundary = boundary.parent;
|
|
934
|
+
boundary.abort(err);
|
|
935
|
+
}
|
|
936
|
+
function isCircular(parent, ref) {
|
|
937
|
+
let cur = parent;
|
|
938
|
+
for (; cur;) {
|
|
939
|
+
if (cur === ref) return !0;
|
|
940
|
+
cur = cur.parent;
|
|
941
|
+
}
|
|
942
|
+
return !1;
|
|
943
|
+
}
|
|
944
|
+
function toObjectKey(name) {
|
|
945
|
+
if (name === "") return "\"\"";
|
|
946
|
+
if (name === "__proto__") return "[\"__proto__\"]";
|
|
947
|
+
let len = name.length, c0 = name.charCodeAt(0);
|
|
948
|
+
if (c0 >= 48 && c0 <= 57) {
|
|
949
|
+
if (c0 === 48) {
|
|
950
|
+
if (len !== 1) return quote(name, 1);
|
|
951
|
+
} else {
|
|
952
|
+
for (let i = 1; i < len; i++) {
|
|
953
|
+
let c = name.charCodeAt(i);
|
|
954
|
+
if (c < 48 || c > 57) return quote(name, i);
|
|
955
|
+
}
|
|
956
|
+
if (len > 15 && "" + +name !== name) return quote(name, 0);
|
|
957
|
+
}
|
|
958
|
+
} else if (c0 >= 97 && c0 <= 122 || c0 >= 65 && c0 <= 90 || c0 === 95 || c0 === 36) for (let i = 1; i < len; i++) {
|
|
959
|
+
let c = name.charCodeAt(i);
|
|
960
|
+
if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95 || c === 36)) return quote(name, i);
|
|
961
|
+
}
|
|
962
|
+
else return quote(name, 0);
|
|
963
|
+
return name;
|
|
964
|
+
}
|
|
965
|
+
function toAccess(accessor) {
|
|
966
|
+
let start = accessor[0];
|
|
967
|
+
return start === "[" ? accessor : start === "\"" || start >= "0" && start <= "9" ? "[" + accessor + "]" : "." + accessor;
|
|
968
|
+
}
|
|
969
|
+
function quote(str, startPos) {
|
|
970
|
+
if (!unsafeQuoteReg.test(str)) return "\"" + str + "\"";
|
|
971
|
+
let result = "", lastPos = 0;
|
|
972
|
+
for (let i = startPos; i < str.length; i++) {
|
|
973
|
+
let replacement, code = str.charCodeAt(i);
|
|
974
|
+
switch (code) {
|
|
975
|
+
case 34:
|
|
976
|
+
replacement = "\\\"";
|
|
977
|
+
break;
|
|
978
|
+
case 92:
|
|
979
|
+
replacement = "\\\\";
|
|
980
|
+
break;
|
|
981
|
+
case 60:
|
|
982
|
+
replacement = "\\x3C";
|
|
983
|
+
break;
|
|
984
|
+
case 10:
|
|
985
|
+
replacement = "\\n";
|
|
986
|
+
break;
|
|
987
|
+
case 13:
|
|
988
|
+
replacement = "\\r";
|
|
989
|
+
break;
|
|
990
|
+
case 8232:
|
|
991
|
+
replacement = "\\u2028";
|
|
992
|
+
break;
|
|
993
|
+
case 8233:
|
|
994
|
+
replacement = "\\u2029";
|
|
995
|
+
break;
|
|
996
|
+
case 0:
|
|
997
|
+
replacement = "\\x00";
|
|
998
|
+
break;
|
|
999
|
+
default:
|
|
1000
|
+
if (code < 55296 || code > 57343) continue;
|
|
1001
|
+
if (code < 56320) {
|
|
1002
|
+
let next = str.charCodeAt(i + 1);
|
|
1003
|
+
if (next >= 56320 && next <= 57343) {
|
|
1004
|
+
i++;
|
|
1005
|
+
continue;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
replacement = "\\u" + code.toString(16);
|
|
1009
|
+
}
|
|
1010
|
+
result += str.slice(lastPos, i) + replacement, lastPos = i + 1;
|
|
1011
|
+
}
|
|
1012
|
+
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
1013
|
+
}
|
|
1014
|
+
function writeRef(state, ref) {
|
|
1015
|
+
ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) && !isAncestorChannelRef(state, ref) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId, state.buf.push(ref.path)) : state.buf.push(ensureRefAccess(state, ref));
|
|
1016
|
+
}
|
|
1017
|
+
function ensureRefAccess(state, ref) {
|
|
1018
|
+
return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : claimRefAccess(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
|
|
1019
|
+
}
|
|
1020
|
+
function accessId(state, ref) {
|
|
1021
|
+
let id = ensureRefAccess(state, ref);
|
|
1022
|
+
return id === ref.id || ref.scopeId !== void 0 ? id : "(" + id + ")";
|
|
1023
|
+
}
|
|
1024
|
+
function claimRefAccess(state, ref) {
|
|
1025
|
+
let { pos } = ref;
|
|
1026
|
+
return pos !== null && ref.flushId === state.flushId ? (ref.id = nextRefAccess(state), pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id) : isAncestorChannelRef(state, ref) ? ref.path || accessPath(state, ref) : (ref.id = nextRefAccess(state), ref.id + "=" + (ref.path || accessPath(state, ref)));
|
|
1027
|
+
}
|
|
1028
|
+
function accessPath(state, ref) {
|
|
1029
|
+
let cur = ref, accessPrevValue = "";
|
|
1030
|
+
do {
|
|
1031
|
+
accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
|
|
1032
|
+
let parent = cur.parent;
|
|
1033
|
+
if (parent.id) return trackChannel(state, parent), parent.id + accessPrevValue;
|
|
1034
|
+
if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
|
|
1035
|
+
cur = parent;
|
|
1036
|
+
} while (cur);
|
|
1037
|
+
return accessPrevValue;
|
|
1038
|
+
}
|
|
1039
|
+
function assignmentsToString(assignments, value) {
|
|
1040
|
+
return assignments.length > 100 ? "($=>(" + assignments.join("=$,") + "=$))(" + value + ")" : assignments.join("=") + "=" + value;
|
|
1041
|
+
}
|
|
1042
|
+
function addAssignment(ref, assign) {
|
|
1043
|
+
ref.assignments ? ref.assignments.push(assign) : ref.assignments = [assign];
|
|
1044
|
+
}
|
|
1045
|
+
function nextRefAccess(state) {
|
|
1046
|
+
return "_." + nextId(state);
|
|
1047
|
+
}
|
|
1048
|
+
function nextId(state) {
|
|
1049
|
+
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = state.ids++, r = c[n % 53];
|
|
1050
|
+
for (n = n / 53 | 0; n; n >>>= 6) r += c[n & 63];
|
|
1051
|
+
return r === "name" ? nextId(state) : r;
|
|
1052
|
+
}
|
|
1053
|
+
function hasSymbolIterator(value) {
|
|
1054
|
+
return Symbol.iterator in value;
|
|
1055
|
+
}
|
|
1056
|
+
function stringEntriesToHeadersInit(entries) {
|
|
1057
|
+
let list = [...entries];
|
|
1058
|
+
if (!list.length) return "";
|
|
1059
|
+
let duplicate = !1, seen = /* @__PURE__ */ new Set();
|
|
1060
|
+
for (let [key] of list) {
|
|
1061
|
+
if (seen.has(key)) {
|
|
1062
|
+
duplicate = !0;
|
|
1063
|
+
break;
|
|
1064
|
+
}
|
|
1065
|
+
seen.add(key);
|
|
1066
|
+
}
|
|
1067
|
+
let result = "", sep = "";
|
|
1068
|
+
for (let [key, value] of list) result += duplicate ? sep + "[" + quote(key, 0) + "," + quote(value, 0) + "]" : sep + toObjectKey(key) + ":" + quote(value, 0), sep = ",";
|
|
1069
|
+
return duplicate ? "[" + result + "]" : "{" + result + "}";
|
|
1070
|
+
}
|
|
1071
|
+
function typedArrayToInitString(view) {
|
|
1072
|
+
let suffix = typeof view[0] == "bigint" ? "n" : "", result = "[", sep = "";
|
|
1073
|
+
for (let i = 0; i < view.length; i++) result += sep + view[i] + suffix, sep = ",";
|
|
1074
|
+
return result += "]", result;
|
|
1075
|
+
}
|
|
1076
|
+
function hasOnlyZeros(typedArray) {
|
|
1077
|
+
let zero = typeof typedArray[0] == "bigint" ? 0n : 0;
|
|
1078
|
+
for (let i = 0; i < typedArray.length; i++) if (typedArray[i] !== zero) return !1;
|
|
1079
|
+
return !0;
|
|
1080
|
+
}
|
|
1081
|
+
function patchIteratorNext(proto) {
|
|
1082
|
+
if (proto.next[kTouchedIterator]) return;
|
|
1083
|
+
let { next } = proto;
|
|
1084
|
+
proto.next = function(value) {
|
|
1085
|
+
return this[kTouchedIterator] = 1, next.call(this, value);
|
|
1086
|
+
}, proto.next[kTouchedIterator] = !0;
|
|
1087
|
+
}
|
|
1088
|
+
// src/html/attrs.ts
|
|
1089
|
+
function _attr_class(value) {
|
|
1090
|
+
return stringAttr("class", toDelimitedString(value, " ", stringifyClassEntry));
|
|
1091
|
+
}
|
|
1092
|
+
function _attr_style(value) {
|
|
1093
|
+
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleEntry));
|
|
1094
|
+
}
|
|
1095
|
+
function _attr_option_value(value) {
|
|
1096
|
+
let valueAttr = _attr("value", value), selectedValue = getContext(kSelectedValue);
|
|
1097
|
+
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1098
|
+
}
|
|
1099
|
+
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1100
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value ?? "", content);
|
|
1101
|
+
}
|
|
1102
|
+
function _attrs_select_value(scopeId, nodeAccessor, data, content) {
|
|
1103
|
+
data && ("value" in data || data.valueChange) ? _attr_select_value(scopeId, nodeAccessor, data.value, data.valueChange, content, 1) : content();
|
|
1104
|
+
}
|
|
1105
|
+
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1106
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _textarea_value(value);
|
|
1107
|
+
}
|
|
1108
|
+
function _attrs_textarea_value(scopeId, nodeAccessor, data) {
|
|
1109
|
+
return _attr_textarea_value(scopeId, nodeAccessor, data?.value, data?.valueChange, 1);
|
|
1110
|
+
}
|
|
1111
|
+
function _textarea_value(value) {
|
|
1112
|
+
let escaped = _escape(normalizeStrAttrValue(value));
|
|
1113
|
+
return escaped[0] === "\n" ? "\n" + escaped : escaped;
|
|
1114
|
+
}
|
|
1115
|
+
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1116
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
1117
|
+
}
|
|
1118
|
+
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1119
|
+
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType), isNotNullishOrFalse(checked) ? " checked" : "";
|
|
1120
|
+
}
|
|
1121
|
+
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1122
|
+
let valueAttr = _attr("value", value);
|
|
1123
|
+
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1124
|
+
}
|
|
1125
|
+
function getCheckedValueRef(checkedValue) {
|
|
1126
|
+
if (Array.isArray(checkedValue)) {
|
|
1127
|
+
let ref = checkedValuesRefs.get(checkedValue);
|
|
1128
|
+
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1132
|
+
let normalizedOpen = isNotNullishOrFalse(open);
|
|
1133
|
+
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1134
|
+
}
|
|
1135
|
+
function _attr_nonce() {
|
|
1136
|
+
return getState().nonceAttr;
|
|
1137
|
+
}
|
|
1138
|
+
function _style_html(decls) {
|
|
1139
|
+
let id = _id();
|
|
1140
|
+
return `<style${_attr_nonce()} class=${id}>.${id}~*{${decls}}</style>`;
|
|
1141
|
+
}
|
|
1142
|
+
function _attr(name, value) {
|
|
1143
|
+
return isNullishOrFalse(value) ? "" : stringifyAttr(name, value);
|
|
1144
|
+
}
|
|
1145
|
+
function _attr_and(name, value, attr) {
|
|
1146
|
+
return value ? attr : _attr(name, value);
|
|
1147
|
+
}
|
|
1148
|
+
function _attr_or(name, value, attr) {
|
|
1149
|
+
return value ? _attr(name, value) : attr;
|
|
1150
|
+
}
|
|
1151
|
+
function _attr_nullish(name, value, attr) {
|
|
1152
|
+
return value == null ? attr : _attr(name, value);
|
|
1153
|
+
}
|
|
1154
|
+
function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1155
|
+
let result = "", skip = /[\s/>"'=]/, events;
|
|
1156
|
+
switch (data && tagName) {
|
|
1157
|
+
case "input":
|
|
1158
|
+
data.checkedChange ? (result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1), skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/) : "checkedValue" in data || data.checkedValueChange ? (result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1), skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/) : data.valueChange && (result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1159
|
+
break;
|
|
1160
|
+
case "select":
|
|
1161
|
+
case "textarea":
|
|
1162
|
+
("value" in data || data.valueChange) && (skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1163
|
+
break;
|
|
1164
|
+
case "option":
|
|
1165
|
+
"value" in data && (result += _attr_option_value(data.value), skip = /^value$|[\s/>"'=]/);
|
|
1166
|
+
break;
|
|
1167
|
+
case "details":
|
|
1168
|
+
case "dialog": data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange, 1), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1169
|
+
}
|
|
1170
|
+
for (let name in data) {
|
|
1171
|
+
let value = data[name];
|
|
1172
|
+
switch (name) {
|
|
1173
|
+
case "class":
|
|
1174
|
+
result += _attr_class(value);
|
|
1175
|
+
break;
|
|
1176
|
+
case "style":
|
|
1177
|
+
result += _attr_style(value);
|
|
1178
|
+
break;
|
|
1179
|
+
default: name && !(isNullishOrFalse(value) || name === "content" && tagName !== "meta" || skip.test(name)) && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, { ["I" + nodeAccessor]: events })), events[getEventType(name)] = value) : result += stringifyAttr(name, value));
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
return result;
|
|
1183
|
+
}
|
|
1184
|
+
function _attrs_content(data, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1185
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1186
|
+
}
|
|
1187
|
+
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1188
|
+
let partial = {};
|
|
1189
|
+
for (let name in data) {
|
|
1190
|
+
let key = isEventHandler(name) ? `on-${getEventType(name)}` : name;
|
|
1191
|
+
skip[key] || (partial[key] = data[name]);
|
|
1192
|
+
}
|
|
1193
|
+
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1194
|
+
}
|
|
1195
|
+
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1196
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1197
|
+
}
|
|
1198
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1199
|
+
writeScope(scopeId, serializeType ? {
|
|
1200
|
+
["F" + nodeAccessor]: type,
|
|
1201
|
+
["G" + nodeAccessor]: value,
|
|
1202
|
+
["E" + nodeAccessor]: valueChange
|
|
1203
|
+
} : {
|
|
1204
|
+
["G" + nodeAccessor]: value,
|
|
1205
|
+
["E" + nodeAccessor]: valueChange
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
function stringAttr(name, value) {
|
|
1209
|
+
return value && " " + name + attrAssignment(value);
|
|
1210
|
+
}
|
|
1211
|
+
function stringifyAttr(name, value) {
|
|
1212
|
+
switch (typeof value) {
|
|
1213
|
+
case "string": return " " + name + attrAssignment(value);
|
|
1214
|
+
case "boolean": return " " + name;
|
|
1215
|
+
case "number": return " " + name + "=" + value;
|
|
1216
|
+
}
|
|
1217
|
+
return " " + name + attrAssignment(value + "");
|
|
1218
|
+
}
|
|
1219
|
+
function attrAssignment(value) {
|
|
1220
|
+
return value ? needsQuotedAttr.test(value) ? value[needsQuotedAttr.lastIndex - 1] === (needsQuotedAttr.lastIndex = 0, "\"") ? "='" + escapeSingleQuotedAttrValue(value) + "'" : "=\"" + escapeDoubleQuotedAttrValue(value) + "\"" : "=" + value : "";
|
|
1221
|
+
}
|
|
1222
|
+
function escapeSingleQuotedAttrValue(value) {
|
|
1223
|
+
return singleQuoteAttrReplacements.test(value) ? value.replace(singleQuoteAttrReplacements, replaceUnsafeSingleQuoteAttrChar) : value;
|
|
1224
|
+
}
|
|
1225
|
+
function replaceUnsafeSingleQuoteAttrChar(match) {
|
|
1226
|
+
return match === "'" ? "'" : match === "\r" ? " " : "&";
|
|
1227
|
+
}
|
|
1228
|
+
function escapeDoubleQuotedAttrValue(value) {
|
|
1229
|
+
return doubleQuoteAttrReplacements.test(value) ? value.replace(doubleQuoteAttrReplacements, replaceUnsafeDoubleQuoteAttrChar) : value;
|
|
1230
|
+
}
|
|
1231
|
+
function replaceUnsafeDoubleQuoteAttrChar(match) {
|
|
1232
|
+
return match === "\"" ? """ : match === "\r" ? " " : "&";
|
|
1233
|
+
}
|
|
1234
|
+
function normalizedValueMatches(a, b) {
|
|
1235
|
+
let value = normalizeStrAttrValue(b);
|
|
1236
|
+
if (Array.isArray(a)) {
|
|
1237
|
+
for (let item of a) if (normalizeStrAttrValue(item) === value) return !0;
|
|
1238
|
+
} else if (normalizeStrAttrValue(a) === value) return !0;
|
|
1239
|
+
return !1;
|
|
1240
|
+
}
|
|
1241
|
+
function normalizeStrAttrValue(value) {
|
|
1242
|
+
return isNotNullishOrFalse(value) && value !== !0 ? value + "" : "";
|
|
1243
|
+
}
|
|
1244
|
+
// src/html/inlined-runtimes.ts
|
|
1245
|
+
// src/html/writer.ts
|
|
1246
|
+
function getChunk() {
|
|
1247
|
+
return $chunk;
|
|
1248
|
+
}
|
|
1249
|
+
function withChunk(chunk, cb) {
|
|
1250
|
+
let prev = $chunk;
|
|
1251
|
+
$chunk = chunk;
|
|
1252
|
+
try {
|
|
1253
|
+
return cb();
|
|
1254
|
+
} finally {
|
|
1255
|
+
$chunk = prev;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
function getContext(key) {
|
|
1259
|
+
return $chunk.context?.[key];
|
|
1260
|
+
}
|
|
1261
|
+
function getState() {
|
|
1262
|
+
return $chunk.boundary.state;
|
|
1263
|
+
}
|
|
1264
|
+
function rendererKey(renderer) {
|
|
1265
|
+
return renderer?.e === void 0 ? renderer?.a || renderer : renderer.a + " " + renderer.e;
|
|
1266
|
+
}
|
|
1267
|
+
function getScopeId(scope) {
|
|
1268
|
+
return scope[K_SCOPE_ID];
|
|
1269
|
+
}
|
|
1270
|
+
function getScopeById(scopeId) {
|
|
1271
|
+
return $chunk.boundary.state.scopes.get(scopeId);
|
|
1272
|
+
}
|
|
1273
|
+
function $global() {
|
|
1274
|
+
return $chunk.boundary.state.$global;
|
|
1275
|
+
}
|
|
1276
|
+
function _id() {
|
|
1277
|
+
let state = $chunk.boundary.state, { $global } = state;
|
|
1278
|
+
return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
|
|
1279
|
+
}
|
|
1280
|
+
function _scope_id() {
|
|
1281
|
+
return $chunk.boundary.state.scopeId++;
|
|
1282
|
+
}
|
|
1283
|
+
function _peek_scope_id() {
|
|
1284
|
+
return $chunk.boundary.state.scopeId;
|
|
1285
|
+
}
|
|
1286
|
+
function withContext(key, value, cb, cbValue, cbValue2) {
|
|
1287
|
+
let ctx = $chunk.context ||= { [kPendingContexts]: 0 }, prev = ctx[key];
|
|
1288
|
+
ctx[kPendingContexts]++, ctx[key] = value;
|
|
1289
|
+
try {
|
|
1290
|
+
return cb(cbValue, cbValue2);
|
|
1291
|
+
} finally {
|
|
1292
|
+
ctx[kPendingContexts]--, ctx[key] = prev;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
function captureContext(chunk) {
|
|
1296
|
+
chunk.context?.[kPendingContexts] && (chunk.context = {
|
|
1297
|
+
...chunk.context,
|
|
1298
|
+
[kPendingContexts]: 0
|
|
1299
|
+
});
|
|
1300
|
+
}
|
|
1301
|
+
function isInResumedBranch() {
|
|
1302
|
+
return $chunk?.context?.[kBranchId] !== void 0;
|
|
1303
|
+
}
|
|
1304
|
+
function withBranchId(branchId, cb, cbValue, cbValue2) {
|
|
1305
|
+
return withContext(kBranchId, branchId, cb, cbValue, cbValue2);
|
|
1306
|
+
}
|
|
1307
|
+
function withAsyncContent(async, cb, value) {
|
|
1308
|
+
return withContext(kAsyncContent, async, cb, value);
|
|
1309
|
+
}
|
|
1310
|
+
function _html(html) {
|
|
1311
|
+
$chunk.writeHTML(html);
|
|
1312
|
+
}
|
|
1313
|
+
function writeScript(script) {
|
|
1314
|
+
$chunk.writeScript(script);
|
|
1315
|
+
}
|
|
1316
|
+
function catchableBoundary() {
|
|
1317
|
+
let { boundary } = $chunk;
|
|
1318
|
+
return boundary.withinCatch ? boundary : null;
|
|
1319
|
+
}
|
|
1320
|
+
function mayDrop(written) {
|
|
1321
|
+
let { boundary } = $chunk;
|
|
1322
|
+
for (let cur = written; cur && !isWithin(boundary, cur); cur = cur.parent) if (cur.aborted || cur.count) return !0;
|
|
1323
|
+
return !1;
|
|
1324
|
+
}
|
|
1325
|
+
function _script(scopeId, registryId, markerGuard) {
|
|
1326
|
+
markerGuard === 0 && ($chunk.channel.readyId || getAsyncContent($chunk)) && _resume_branch(scopeId), $chunk.boundary.state.queueEffect(scopeId, registryId);
|
|
1327
|
+
}
|
|
1328
|
+
function _trailers(html) {
|
|
1329
|
+
$chunk.boundary.state.trailerHTML += html;
|
|
1330
|
+
}
|
|
1331
|
+
function _resume(val, id, scopeId, locals) {
|
|
1332
|
+
return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId), locals);
|
|
1333
|
+
}
|
|
1334
|
+
function _resume_locals(val, id, locals, ownerScopeId) {
|
|
1335
|
+
return ownerScopeId !== void 0 && (locals._ = _scope_with_id(ownerScopeId)), register(id, val, writeScope(_scope_id(), locals));
|
|
1336
|
+
}
|
|
1337
|
+
function _el(scopeId, id) {
|
|
1338
|
+
return _resume(() => void 0, id, scopeId);
|
|
1339
|
+
}
|
|
1340
|
+
function _hoist(scopeId, id) {
|
|
1341
|
+
let getter = () => void 0;
|
|
1342
|
+
return getter[Symbol.iterator] = _hoist_read_error, _resume(getter, id, scopeId);
|
|
1343
|
+
}
|
|
1344
|
+
function _el_mark(scopeId, accessor, markerGuard) {
|
|
1345
|
+
if (markerGuard === 0) return "";
|
|
1346
|
+
let { state } = $chunk.boundary;
|
|
1347
|
+
return state.needsWalkerRuntime = !0, state.mark("$", scopeId + " " + accessor);
|
|
1348
|
+
}
|
|
1349
|
+
function _text_mark(scopeId, accessor, val, markerGuard) {
|
|
1350
|
+
return markText(scopeId, accessor, _escape(val), markerGuard);
|
|
1351
|
+
}
|
|
1352
|
+
function _html_mark(scopeId, accessor, val, markerGuard) {
|
|
1353
|
+
let html = _unescaped(val);
|
|
1354
|
+
if (markerGuard === 0 || !~html.indexOf("<")) return markText(scopeId, accessor, html, markerGuard);
|
|
1355
|
+
let { state } = $chunk.boundary;
|
|
1356
|
+
return state.needsWalkerRuntime = !0, state.mark("&", "") + html + state.mark("'", scopeId + " " + accessor);
|
|
1357
|
+
}
|
|
1358
|
+
function markText(scopeId, accessor, text, markerGuard) {
|
|
1359
|
+
if (markerGuard === 0) return text;
|
|
1360
|
+
let { state } = $chunk.boundary;
|
|
1361
|
+
return state.needsWalkerRuntime = !0, text ? (markerGuard === 2 ? "<!>" : "") + text + state.mark("$", scopeId + " " + accessor) : state.mark("%", scopeId + " " + accessor);
|
|
1362
|
+
}
|
|
1363
|
+
function _resume_branch(scopeId) {
|
|
1364
|
+
let branchId = getContext(kBranchId);
|
|
1365
|
+
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1366
|
+
}
|
|
1367
|
+
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
1368
|
+
let shouldResume = markerGuard !== 0;
|
|
1369
|
+
content = content?.content || content, classAPIRenderer && content && (content = classAPIRenderer(content));
|
|
1370
|
+
let branchId = _peek_scope_id();
|
|
1371
|
+
if (content) try {
|
|
1372
|
+
_set_scope_reason(shouldResume ? ALL_GROUPS : 0), shouldResume ? withBranchId(branchId, content) : content();
|
|
1373
|
+
} finally {
|
|
1374
|
+
_set_scope_reason(void 0);
|
|
1375
|
+
}
|
|
1376
|
+
_peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1377
|
+
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1378
|
+
["D" + nodeAccessor]: rendererKey(content)
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
|
|
1382
|
+
writeScopePassive(parentScopeId, { [scopeOffsetAccessor]: _scope_id() });
|
|
1383
|
+
let childScope = writeScopePassive(childScopeId, { T: _resume({}, registryId, parentScopeId) });
|
|
1384
|
+
nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
|
|
1385
|
+
}
|
|
1386
|
+
function writeScopePassive(scopeId, partialScope) {
|
|
1387
|
+
let target = $chunk.channel, scope = _scope_with_id(scopeId);
|
|
1388
|
+
return Object.assign(scope, partialScope), $chunk.boundary.state.queuePassiveScope(target, scopeId, partialScope), scope;
|
|
1389
|
+
}
|
|
1390
|
+
function _existing_scope(scopeId) {
|
|
1391
|
+
return writeScope(scopeId, {});
|
|
1392
|
+
}
|
|
1393
|
+
function _scope_with_id(scopeId) {
|
|
1394
|
+
return scopeWithId($chunk.boundary.state, scopeId);
|
|
1395
|
+
}
|
|
1396
|
+
function scopeWithId(state, scopeId) {
|
|
1397
|
+
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1398
|
+
return scope || scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId }), scope;
|
|
1399
|
+
}
|
|
1400
|
+
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
1401
|
+
if (subscribers) {
|
|
1402
|
+
let { boundary, channel } = $chunk, { serializer } = boundary.state;
|
|
1403
|
+
!channel.readyId && !serializer.refs.has(subscribers) ? subscribers.add(scope) : resumeId ? _script(scope[K_SCOPE_ID], resumeId, markerGuard) : queueCall(serializer, scope, subscribers, "add", channel), boundary.withinCatch && (boundary.subscribed ||= []).push(subscribers, scope, channel);
|
|
1404
|
+
}
|
|
1405
|
+
return scope;
|
|
1406
|
+
}
|
|
1407
|
+
function getGroupReason(reason, group) {
|
|
1408
|
+
return reason === 715827883 ? 1 : typeof reason == "number" ? group < 15 ? reason >>> 1 + 2 * group & 3 : 0 : reason[group] ?? 0;
|
|
1409
|
+
}
|
|
1410
|
+
function _set_scope_reason(reason) {
|
|
1411
|
+
$chunk.boundary.state.scopeReason = reason;
|
|
1412
|
+
}
|
|
1413
|
+
function _scope_reason() {
|
|
1414
|
+
let reason = $chunk.boundary.state.scopeReason;
|
|
1415
|
+
return $chunk.boundary.state.scopeReason = void 0, reason;
|
|
1416
|
+
}
|
|
1417
|
+
function _write_if(reason, group) {
|
|
1418
|
+
return reason && getGroupReason(reason, group) ? 1 : void 0;
|
|
1419
|
+
}
|
|
1420
|
+
function _write_guard(reason, group) {
|
|
1421
|
+
return _write_if(reason, group) || 0;
|
|
1422
|
+
}
|
|
1423
|
+
function writeWaitReady(readyId, renderer, input) {
|
|
1424
|
+
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context, {
|
|
1425
|
+
readyId,
|
|
1426
|
+
parent: chunk.channel,
|
|
1427
|
+
resumes: "",
|
|
1428
|
+
writeScopes: {},
|
|
1429
|
+
flushScopes: !1
|
|
1430
|
+
}), bodyEnd = body.render(renderer, input);
|
|
1431
|
+
if (boundary.aborted) throw boundary.reason;
|
|
1432
|
+
body === bodyEnd ? (chunk.writeHTML(body.html), body.deferOwnReady(), chunk.deferredReady = push(chunk.deferredReady, body)) : (bodyEnd.next = chunk.forkRest(boundary), chunk.next = body);
|
|
1433
|
+
}
|
|
1434
|
+
function deferBranchStart(chunk) {
|
|
1435
|
+
let beforeBranch = chunk.html;
|
|
1436
|
+
return chunk.html = "", beforeBranch;
|
|
1437
|
+
}
|
|
1438
|
+
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1439
|
+
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1440
|
+
}
|
|
1441
|
+
function unsubscribe(subscribed, serializer) {
|
|
1442
|
+
for (let i = 0; i < subscribed.length; i += 3) {
|
|
1443
|
+
let subscribers = subscribed[i], scope = subscribed[i + 1];
|
|
1444
|
+
if (!serializer.refs.has(subscribers)) subscribers.delete(scope);
|
|
1445
|
+
else {
|
|
1446
|
+
let channel = subscribed[i + 2];
|
|
1447
|
+
dropQueuedCall(serializer, scope, subscribers, "add", channel) || queueCall(serializer, scope, subscribers, "delete", channel);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
function countResumeWrite(chunk) {
|
|
1452
|
+
for (let boundary = chunk.boundary; boundary; boundary = boundary.parent) boundary.resumeWrites++;
|
|
1453
|
+
}
|
|
1454
|
+
function writeAsyncVisits(chunk) {
|
|
1455
|
+
for (let async = getAsyncContent(chunk); async && !async.resumed; async = async.parent) async.resumed = !0, async.end?.writeHTML(async.visit);
|
|
1456
|
+
}
|
|
1457
|
+
function getAsyncContent(chunk) {
|
|
1458
|
+
return chunk.context?.[kAsyncContent];
|
|
1459
|
+
}
|
|
1460
|
+
var State = class {
|
|
1461
|
+
tagId = 1;
|
|
1462
|
+
scopeId = 1;
|
|
1463
|
+
reorderId = 1;
|
|
1464
|
+
readyGate = 1;
|
|
1465
|
+
hasWrittenGlobals = !1;
|
|
1466
|
+
needsWalkerRuntime = !1;
|
|
1467
|
+
hasWalkerRuntime = !1;
|
|
1468
|
+
hasWrittenReady = !1;
|
|
1469
|
+
hasReorderRuntime = !1;
|
|
1470
|
+
hasWrittenResume = !1;
|
|
1471
|
+
walkOnNextFlush = !1;
|
|
1472
|
+
trailerHTML = "";
|
|
1473
|
+
resumes = "";
|
|
1474
|
+
nonceAttr = "";
|
|
1475
|
+
serializer = new State$1();
|
|
1476
|
+
writeReorders = null;
|
|
1477
|
+
scopes = /* @__PURE__ */ new Map();
|
|
1478
|
+
scope = (scopeId) => scopeWithId(this, scopeId);
|
|
1479
|
+
flushScopes = !1;
|
|
1480
|
+
writeScopes = {};
|
|
1481
|
+
readyIds = null;
|
|
1482
|
+
readyPositions = null;
|
|
1483
|
+
scopeReason;
|
|
1484
|
+
$global;
|
|
1485
|
+
constructor($global) {
|
|
1486
|
+
this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
1487
|
+
}
|
|
1488
|
+
joinFlush(html, scripts, pending) {
|
|
1489
|
+
let { $global, nonceAttr } = this, { __flush__ } = $global;
|
|
1490
|
+
return scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), pending ? html : html + this.trailerHTML;
|
|
1491
|
+
}
|
|
1492
|
+
walkScript() {
|
|
1493
|
+
return this.runtimePrefix + ".w()";
|
|
1494
|
+
}
|
|
1495
|
+
addResumes(channel, resumes) {
|
|
1496
|
+
channel.resumes = concatSequence(channel.resumes, resumes);
|
|
1497
|
+
}
|
|
1498
|
+
queueScope(target, scopeId, partialScope) {
|
|
1499
|
+
let pending = target.writeScopes[scopeId];
|
|
1500
|
+
pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0;
|
|
1501
|
+
}
|
|
1502
|
+
queuePassiveScope(target, scopeId, partialScope) {
|
|
1503
|
+
let passive = target.passiveScopes ||= {};
|
|
1504
|
+
passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope);
|
|
1505
|
+
}
|
|
1506
|
+
queueEffect(scopeId, registryId) {
|
|
1507
|
+
this.needsWalkerRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1508
|
+
}
|
|
1509
|
+
serializeFlush(boundary) {
|
|
1510
|
+
flushSerializer(boundary, this);
|
|
1511
|
+
}
|
|
1512
|
+
runtimeScript() {
|
|
1513
|
+
return "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + this.$global.runtimeId + "\")(\"" + this.$global.renderId + "\")";
|
|
1514
|
+
}
|
|
1515
|
+
keepsTryMarks(chunk, resumeWrites) {
|
|
1516
|
+
return chunk !== $chunk || chunk.boundary.resumeWrites !== resumeWrites;
|
|
1517
|
+
}
|
|
1518
|
+
resumeScript(resumes) {
|
|
1519
|
+
return this.hasWrittenResume ? this.runtimePrefix + ".r.push(" + resumes + ")" : (this.hasWrittenResume = !0, this.runtimePrefix + ".r=[" + resumes + "]");
|
|
1520
|
+
}
|
|
1521
|
+
get runtimePrefix() {
|
|
1522
|
+
let { $global } = this;
|
|
1523
|
+
return $global.runtimeId + "." + $global.renderId;
|
|
1524
|
+
}
|
|
1525
|
+
get commentPrefix() {
|
|
1526
|
+
let { $global } = this;
|
|
1527
|
+
return $global.runtimeId + $global.renderId;
|
|
1528
|
+
}
|
|
1529
|
+
reorder(chunk) {
|
|
1530
|
+
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsWalkerRuntime = !0, this.writeReorders = [chunk]);
|
|
1531
|
+
}
|
|
1532
|
+
readyScript(id, resumes) {
|
|
1533
|
+
let readyKey = toObjectKey(id);
|
|
1534
|
+
return this.readyIds?.has(id) ? this.readyAccess(readyKey) + ".push(" + resumes + ")" : ((this.readyIds ||= /* @__PURE__ */ new Set()).add(id), this.hasWrittenReady ? this.readyAccess(readyKey) + "=[" + resumes + "]" : (this.hasWrittenReady = !0, this.runtimePrefix + ".b={" + readyKey + ":[" + resumes + "]}"));
|
|
1535
|
+
}
|
|
1536
|
+
readyAccess(readyKey) {
|
|
1537
|
+
return this.runtimePrefix + ".b" + toAccess(readyKey);
|
|
1538
|
+
}
|
|
1539
|
+
nextReorderId() {
|
|
1540
|
+
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = this.reorderId++, r = c[n % 54];
|
|
1541
|
+
for (n = n / 54 | 0; n; n >>>= 6) r += c[n & 63];
|
|
1542
|
+
return r;
|
|
1543
|
+
}
|
|
1544
|
+
mark(code, str) {
|
|
1545
|
+
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1546
|
+
}
|
|
1547
|
+
};
|
|
1548
|
+
function NOOP() {}
|
|
1549
|
+
var Boundary = class {
|
|
1550
|
+
onNext = NOOP;
|
|
1551
|
+
count = 0;
|
|
1552
|
+
resumeWrites = 0;
|
|
1553
|
+
state;
|
|
1554
|
+
parent;
|
|
1555
|
+
aborted = !1;
|
|
1556
|
+
reason;
|
|
1557
|
+
subscribed;
|
|
1558
|
+
pendingReorders;
|
|
1559
|
+
children;
|
|
1560
|
+
withinCatch = !1;
|
|
1561
|
+
constructor(state, signal, parent) {
|
|
1562
|
+
this.state = state, this.parent = parent, parent ? (this.withinCatch = parent.withinCatch, parent.aborted ? this.abort(parent.reason) : (parent.children ||= []).push(this)) : signal && (signal.aborted ? this.abort(signal.reason) : signal.addEventListener("abort", this));
|
|
1563
|
+
}
|
|
1564
|
+
abort(reason) {
|
|
1565
|
+
if (this.aborted) return;
|
|
1566
|
+
let { state } = this;
|
|
1567
|
+
if (this.aborted = !0, this.reason = reason, this.subscribed && unsubscribe(this.subscribed, state.serializer), this.pendingReorders) {
|
|
1568
|
+
for (let reorder of this.pendingReorders) state.reorder(reorder);
|
|
1569
|
+
this.pendingReorders = void 0;
|
|
1570
|
+
}
|
|
1571
|
+
if (this.count = 0, this.state = new State(state.$global), this.children) for (let child of this.children) child.abort(reason);
|
|
1572
|
+
this.onNext();
|
|
1573
|
+
}
|
|
1574
|
+
handleEvent(event) {
|
|
1575
|
+
this.abort(event.target.reason);
|
|
1576
|
+
}
|
|
1577
|
+
flush() {
|
|
1578
|
+
return this.aborted || this.state.serializeFlush(this), this.count ? 1 : this.aborted ? 2 : 0;
|
|
1579
|
+
}
|
|
1580
|
+
startAsync() {
|
|
1581
|
+
this.aborted || this.count++;
|
|
1582
|
+
}
|
|
1583
|
+
endAsync() {
|
|
1584
|
+
this.aborted || (this.count--, this.onNext());
|
|
1585
|
+
}
|
|
1586
|
+
}, Chunk = class Chunk {
|
|
1587
|
+
html = "";
|
|
1588
|
+
scripts = "";
|
|
1589
|
+
effects = "";
|
|
1590
|
+
lastEffect = "";
|
|
1591
|
+
async = !1;
|
|
1592
|
+
consumed = !1;
|
|
1593
|
+
reorderId = null;
|
|
1594
|
+
reorderBranch = 0;
|
|
1595
|
+
deferredReady = null;
|
|
1596
|
+
heldEffects = null;
|
|
1597
|
+
deferredReorder = null;
|
|
1598
|
+
catchRange = null;
|
|
1599
|
+
placeholder = null;
|
|
1600
|
+
boundary;
|
|
1601
|
+
next;
|
|
1602
|
+
context;
|
|
1603
|
+
channel;
|
|
1604
|
+
constructor(boundary, next, context, channel) {
|
|
1605
|
+
this.boundary = boundary, this.next = next, this.context = context, this.channel = channel;
|
|
1606
|
+
}
|
|
1607
|
+
fork(boundary, next) {
|
|
1608
|
+
return new Chunk(boundary, next, this.context, this.channel);
|
|
1609
|
+
}
|
|
1610
|
+
forkRest(boundary) {
|
|
1611
|
+
return $chunk = this.fork(boundary, this.next);
|
|
1612
|
+
}
|
|
1613
|
+
writeHTML(html) {
|
|
1614
|
+
this.html += html;
|
|
1615
|
+
}
|
|
1616
|
+
writeEffect(scopeId, registryId) {
|
|
1617
|
+
countResumeWrite(this), writeAsyncVisits(this), this.lastEffect === registryId ? this.effects = concatEffects(this.effects, scopeId + "") : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1618
|
+
}
|
|
1619
|
+
writeScript(script) {
|
|
1620
|
+
this.scripts = concatScripts(this.scripts, script);
|
|
1621
|
+
}
|
|
1622
|
+
append(chunk) {
|
|
1623
|
+
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
|
|
1624
|
+
}
|
|
1625
|
+
takeHeldEffects() {
|
|
1626
|
+
let { heldEffects } = this;
|
|
1627
|
+
return this.heldEffects = null, heldEffects;
|
|
1628
|
+
}
|
|
1629
|
+
takeDeferredReady() {
|
|
1630
|
+
let { deferredReady } = this;
|
|
1631
|
+
return this.deferredReady = null, deferredReady;
|
|
1632
|
+
}
|
|
1633
|
+
deferOwnReady() {
|
|
1634
|
+
if (this.channel.readyId && (this.effects || this.scripts || this.channel.flushScopes)) {
|
|
1635
|
+
let deferred = this.fork(this.boundary, null);
|
|
1636
|
+
deferred.effects = this.effects, deferred.scripts = this.scripts, this.effects = this.scripts = this.lastEffect = "", this.deferredReady = concat(deferred, this.deferredReady);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
renderPlaceholders(boundary) {
|
|
1640
|
+
let { state } = boundary;
|
|
1641
|
+
restart: for (;;) {
|
|
1642
|
+
let reorders = null;
|
|
1643
|
+
for (let cur = this; cur.next && !cur.async; cur = cur.next) {
|
|
1644
|
+
if (cur.renderPlaceholder(state)) {
|
|
1645
|
+
if (boundary.aborted) return;
|
|
1646
|
+
continue restart;
|
|
1647
|
+
}
|
|
1648
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
1649
|
+
}
|
|
1650
|
+
if (state.writeReorders) {
|
|
1651
|
+
for (let reorder of state.writeReorders) if ((reorders = renderReorderPlaceholders(reorder, reorders)) === !1) {
|
|
1652
|
+
if (boundary.aborted) return;
|
|
1653
|
+
continue restart;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
for (let i = 0; reorders && i < reorders.length; i++) if ((reorders = renderReorderPlaceholders(reorders[i], reorders)) === !1) {
|
|
1657
|
+
if (boundary.aborted) return;
|
|
1658
|
+
continue restart;
|
|
1659
|
+
}
|
|
1660
|
+
return;
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
renderPlaceholder(state) {
|
|
1664
|
+
let { placeholder } = this;
|
|
1665
|
+
if (!placeholder || (this.placeholder = null, this.boundary.aborted)) return !1;
|
|
1666
|
+
let { body } = placeholder, end = body;
|
|
1667
|
+
for (; end.next && !end.async;) end = end.next;
|
|
1668
|
+
if (!end.async) return end.next = this.next, this.next = body, !1;
|
|
1669
|
+
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId + "";
|
|
1670
|
+
this.writeHTML(state.mark("!^", reorderId));
|
|
1671
|
+
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
1672
|
+
if (this.render(withBranchId, placeholderBranchId, placeholder.render) !== this && this.boundary.abort(/* @__PURE__ */ Error()), this.boundary.aborted) return !0;
|
|
1673
|
+
let stateful = this.effects !== effects;
|
|
1674
|
+
return applyBranchStart(this, beforeBranch, stateful), stateful && (this.render(writeScope, branchId, { P: scopeWithId(state, placeholderBranchId) }), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), dismissChunk(end, body).writeEffect(branchId, "_f")), this.writeHTML(state.mark("!", reorderId)), this.deferredReorder = body, !1;
|
|
1675
|
+
}
|
|
1676
|
+
markCatchRange() {
|
|
1677
|
+
let { catchRange } = this;
|
|
1678
|
+
if (catchRange) {
|
|
1679
|
+
let { state } = this.boundary;
|
|
1680
|
+
this.catchRange = null, this.writeHTML(state.mark("!^", catchRange.id)), catchRange.end.writeHTML(state.mark("!", catchRange.id));
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
queueDeferredReorder() {
|
|
1684
|
+
let { deferredReorder } = this;
|
|
1685
|
+
deferredReorder && (this.deferredReorder = null, deferredReorder.boundary.state.reorder(deferredReorder));
|
|
1686
|
+
}
|
|
1687
|
+
consume(boundary) {
|
|
1688
|
+
this.renderPlaceholders(boundary);
|
|
1689
|
+
let cur = this, html = "", effects = "", scripts = "", effectsEnd, heldEffects = this.heldEffects, deferredReady;
|
|
1690
|
+
for (this.heldEffects = null, this.channel.readyId && this.effects && followHeldEffects(this); cur.next && !cur.async;) cur.markCatchRange(), cur.queueDeferredReorder(), html += cur.html, cur.channel.readyId ? deferredReady = push(deferredReady, cur) : (cur.effects && (effectsEnd && effectsEnd.boundary !== cur.boundary && (heldEffects = holdEffectsOn(heldEffects, effectsEnd, effects), effects = ""), effectsEnd = cur, effects = concatEffects(effects, cur.effects)), scripts = concatScripts(scripts, cur.scripts)), deferredReady = concat(deferredReady, cur.takeDeferredReady()), cur.consumed = !0, cur = cur.next;
|
|
1691
|
+
return cur.deferOwnReady(), effects && (cur.channel.readyId ? heldEffects = holdEffectsOn(heldEffects, effectsEnd, effects) : effectsEnd.boundary === cur.boundary ? (cur.effects = concatEffects(effects, cur.effects), cur.lastEffect ||= effectsEnd.lastEffect) : (heldEffects = holdEffectsOn(heldEffects, effectsEnd, effects), isWithin(cur.boundary, effectsEnd.boundary) && (cur.lastEffect ||= effectsEnd.lastEffect))), cur.heldEffects = heldEffects, cur.deferredReady = concat(deferredReady, cur.deferredReady), cur.html = html + cur.html, cur.scripts = concatScripts(scripts, cur.scripts), cur;
|
|
1692
|
+
}
|
|
1693
|
+
render(content, val, val2) {
|
|
1694
|
+
let prev = $chunk;
|
|
1695
|
+
$chunk = this;
|
|
1696
|
+
try {
|
|
1697
|
+
return content(val, val2), $chunk;
|
|
1698
|
+
} catch (err) {
|
|
1699
|
+
return this.boundary.abort(err), this;
|
|
1700
|
+
} finally {
|
|
1701
|
+
$chunk = prev;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
1705
|
+
let { channel } = this, { readyId } = channel, scripts = "", held = this.takeDeferredReady();
|
|
1706
|
+
if (held) for (let chunk of toArray(held)) chunk.boundary.aborted || (scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk)));
|
|
1707
|
+
if (readyId && !this.async) {
|
|
1708
|
+
let { state } = boundary, effects = holdEffects ? "" : this.effects;
|
|
1709
|
+
effects && flushSerializerGlobals(boundary), flushSerializer(boundary, channel);
|
|
1710
|
+
let deps = takeChannelDeps(state.serializer), { resumes } = channel, chunkScripts = this.scripts;
|
|
1711
|
+
if (channel.resumes = this.scripts = "", effects && (this.effects = this.lastEffect = ""), resumes || effects) {
|
|
1712
|
+
state.needsWalkerRuntime = !0;
|
|
1713
|
+
let batch = concatSequence(readyBatch(state, channel, deps, resumes), effects && `"${effects}"`);
|
|
1714
|
+
if (reservations) {
|
|
1715
|
+
let gate = state.readyGate++;
|
|
1716
|
+
reservations.push(state.readyScript(readyId, gate + "")), scripts = concatScripts(scripts, "(b=>b.splice(b.indexOf(" + gate + "),1," + batch + "))(" + state.readyAccess(toObjectKey(readyId)) + ")");
|
|
1717
|
+
} else scripts = concatScripts(scripts, state.readyScript(readyId, batch));
|
|
1718
|
+
}
|
|
1719
|
+
scripts = concatScripts(scripts, chunkScripts);
|
|
1720
|
+
}
|
|
1721
|
+
return scripts;
|
|
1722
|
+
}
|
|
1723
|
+
flush(boundary) {
|
|
1724
|
+
let { state } = boundary, { runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1725
|
+
needsWalk && (state.walkOnNextFlush = !1), flushSerializer(boundary, state);
|
|
1726
|
+
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
1727
|
+
for (let channel; !boundary.aborted && (channel = pendingReadyChannel(state.serializer));) {
|
|
1728
|
+
let resumes = stringifyScopes(state.serializer, [], boundary, channel), deps = takeChannelDeps(state.serializer);
|
|
1729
|
+
state.needsWalkerRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.readyScript(channel.readyId, readyBatch(state, channel, deps, resumes)));
|
|
1730
|
+
}
|
|
1731
|
+
readyResumeScripts && (needsWalk = !0);
|
|
1732
|
+
let effects = this.async ? "" : joinHeldEffects(this.takeHeldEffects(), this.effects), { html, scripts } = this;
|
|
1733
|
+
html && state.hasReorderRuntime && (html = state.mark("*", "") + html), state.needsWalkerRuntime && !state.hasWalkerRuntime && (state.hasWalkerRuntime = !0, scripts = concatScripts(scripts, state.runtimeScript())), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, flushSerializerGlobals(boundary), state.resumes = concatSequence(state.resumes, "\"" + effects + "\""));
|
|
1734
|
+
let reordered = "", needsResumeArray = !1;
|
|
1735
|
+
if (state.writeReorders) {
|
|
1736
|
+
for (let reorderedChunk of state.writeReorders) {
|
|
1737
|
+
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=e=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:1,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=i=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
1738
|
+
let { reorderId, reorderBranch } = reorderedChunk, rootBranch = reorderBranch || +reorderId, readyReservations = [], reorderHTML = "", reorderEffects = "", effectsBoundary = reorderedChunk.boundary, reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
1739
|
+
for (reorderedChunk.reorderId = null; cur;) {
|
|
1740
|
+
cur.markCatchRange(), cur.queueDeferredReorder(), cur.deferOwnReady();
|
|
1741
|
+
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(boundary, readyReservations, this.async);
|
|
1742
|
+
if (this.deferredReady = concat(this.deferredReady, cur.takeDeferredReady()), cur.consumed = !0, reorderHTML += cur.html, this.async && cur.effects && cur.boundary !== effectsBoundary && (reorderEffects &&= (holdReorderEffects(this, effectsBoundary, reorderEffects), ""), effectsBoundary = cur.boundary), reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, concatScripts(readyResumeScripts, cur.scripts)), cur.async) {
|
|
1743
|
+
reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId());
|
|
1744
|
+
let holeBranch = cur.context?.[kBranchId];
|
|
1745
|
+
cur.reorderBranch = holeBranch > rootBranch ? holeBranch : reorderBranch, (cur.boundary.pendingReorders ||= /* @__PURE__ */ new Set()).add(cur), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null;
|
|
1746
|
+
}
|
|
1747
|
+
cur = next;
|
|
1748
|
+
}
|
|
1749
|
+
reorderEffects && (this.async ? holdReorderEffects(this, effectsBoundary, reorderEffects) : (needsResumeArray = !0, reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")));
|
|
1750
|
+
for (let reservation of readyReservations) reordered = concatScripts(reordered, reservation);
|
|
1751
|
+
reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + (reorderBranch ? state.mark("*", reorderBranch + "") : "") + reorderHTML + "</t>";
|
|
1752
|
+
}
|
|
1753
|
+
state.writeReorders = null;
|
|
1754
|
+
}
|
|
1755
|
+
return (state.resumes || needsResumeArray && !state.hasWrittenResume) && (scripts = concatScripts(scripts, state.resumeScript(state.resumes))), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, state.walkScript())), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
|
|
1756
|
+
}
|
|
1757
|
+
flushHTML(boundary) {
|
|
1758
|
+
let { state } = boundary;
|
|
1759
|
+
this.flush(boundary);
|
|
1760
|
+
let { html, scripts } = this;
|
|
1761
|
+
return this.html = this.scripts = "", state.joinFlush(html, scripts, boundary.count);
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
function renderReorderPlaceholders(reorder, reorders) {
|
|
1765
|
+
if (!reorder.boundary.aborted) for (let cur = reorder; cur; cur = cur.next) {
|
|
1766
|
+
if (cur.renderPlaceholder(reorder.boundary.state)) return !1;
|
|
1767
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
1768
|
+
}
|
|
1769
|
+
return reorders;
|
|
1770
|
+
}
|
|
1771
|
+
function dismissChunk(end, body) {
|
|
1772
|
+
if (end.boundary !== body.boundary) for (; end.next;) end = end.next;
|
|
1773
|
+
return end;
|
|
1774
|
+
}
|
|
1775
|
+
function followHeldEffects(chunk) {
|
|
1776
|
+
let held = reduce(chunk.deferredReady, lastHeldOf, chunk);
|
|
1777
|
+
held !== chunk && (held.effects = concatEffects(held.effects, chunk.effects), chunk.effects = "");
|
|
1778
|
+
}
|
|
1779
|
+
function lastHeldOf(held, cur) {
|
|
1780
|
+
return cur.channel === held.channel && cur.boundary === held.boundary ? cur : held;
|
|
1781
|
+
}
|
|
1782
|
+
function holdEffectsOn(heldEffects, chunk, effects) {
|
|
1783
|
+
return chunk.effects = effects, push(heldEffects, chunk);
|
|
1784
|
+
}
|
|
1785
|
+
function isWithin(boundary, outer) {
|
|
1786
|
+
for (; boundary && boundary !== outer;) boundary = boundary.parent;
|
|
1787
|
+
return !!boundary;
|
|
1788
|
+
}
|
|
1789
|
+
function holdReorderEffects(head, boundary, effects) {
|
|
1790
|
+
head.channel.readyId || (head.effects && (head.heldEffects = holdEffectsOn(head.heldEffects, head.fork(head.boundary, null), head.effects)), head.effects = head.lastEffect = ""), head.heldEffects = holdEffectsOn(head.heldEffects, head.fork(boundary, null), effects);
|
|
1791
|
+
}
|
|
1792
|
+
function joinHeldEffects(heldEffects, effects) {
|
|
1793
|
+
return concatEffects(reduce(heldEffects, joinUncaught, ""), effects);
|
|
1794
|
+
}
|
|
1795
|
+
function joinUncaught(joined, held) {
|
|
1796
|
+
return held.boundary.aborted ? joined : concatEffects(joined, held.effects);
|
|
1797
|
+
}
|
|
1798
|
+
function flushSerializer(boundary, channel) {
|
|
1799
|
+
let { state } = boundary, { serializer } = state, pending = hasMatchingCalls(serializer, channel.readyId);
|
|
1800
|
+
if (channel.flushScopes || pending) {
|
|
1801
|
+
let { writeScopes, passiveScopes } = channel, flushes = [];
|
|
1802
|
+
if (passiveScopes) for (let key in passiveScopes) {
|
|
1803
|
+
let props = writeScopes[key];
|
|
1804
|
+
props && (writeScopes[key] = Object.assign(passiveScopes[key], props), delete passiveScopes[key]);
|
|
1805
|
+
}
|
|
1806
|
+
if (!channel.readyId && !state.hasWrittenGlobals) {
|
|
1807
|
+
state.hasWrittenGlobals = !0;
|
|
1808
|
+
let globals = getFilteredGlobals(state.$global);
|
|
1809
|
+
globals && flushes.push([
|
|
1810
|
+
0,
|
|
1811
|
+
globals,
|
|
1812
|
+
globals
|
|
1813
|
+
]);
|
|
1814
|
+
}
|
|
1815
|
+
for (let key in writeScopes) {
|
|
1816
|
+
let scopeId = +key, props = writeScopes[scopeId];
|
|
1817
|
+
hasKeys(props) && flushes.push([
|
|
1818
|
+
scopeId,
|
|
1819
|
+
state.scopes.get(scopeId),
|
|
1820
|
+
props
|
|
1821
|
+
]);
|
|
1822
|
+
}
|
|
1823
|
+
(flushes.length || pending) && (channel.readyId && flushSerializerGlobals(boundary), state.addResumes(channel, stringifyScopes(serializer, flushes, boundary, channel))), channel.writeScopes = {}, channel.flushScopes = !1, pending && (state.walkOnNextFlush = !0);
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
function flushSerializerGlobals(boundary) {
|
|
1827
|
+
let { state } = boundary;
|
|
1828
|
+
if (state.hasWrittenGlobals) return;
|
|
1829
|
+
state.hasWrittenGlobals = !0;
|
|
1830
|
+
let globals = getFilteredGlobals(state.$global);
|
|
1831
|
+
globals && (state.needsWalkerRuntime = !0, state.resumes = concatSequence(state.resumes, stringifyScopes(state.serializer, [[
|
|
1832
|
+
0,
|
|
1833
|
+
globals,
|
|
1834
|
+
globals
|
|
1835
|
+
]], boundary)));
|
|
1836
|
+
}
|
|
1837
|
+
function readyBatch(state, channel, deps, resumes) {
|
|
1838
|
+
let readyId = channel.readyId, positions = state.readyPositions ||= {}, own = positions[readyId] ||= { [readyId]: 0 }, wait = "";
|
|
1839
|
+
for (let cur = channel.parent; cur.readyId; cur = cur.parent) {
|
|
1840
|
+
let id = cur.readyId, position = deps?.has(id) ? positions[id][id] : 0;
|
|
1841
|
+
own[id] >= position || (own[id] = position, wait += (wait ? "," : "{") + toObjectKey(id) + ":" + position);
|
|
1842
|
+
}
|
|
1843
|
+
return resumes && own[readyId]++, concatSequence(wait && wait + "}", resumes);
|
|
1844
|
+
}
|
|
1845
|
+
function getFilteredGlobals($global) {
|
|
1846
|
+
let serializedGlobals = $global.serializedGlobals;
|
|
1847
|
+
if (!serializedGlobals) return 0;
|
|
1848
|
+
let filtered = 0;
|
|
1849
|
+
if (Array.isArray(serializedGlobals)) for (let key of serializedGlobals) {
|
|
1850
|
+
let value = $global[key];
|
|
1851
|
+
value !== void 0 && ((filtered ||= {})[key] = value);
|
|
1852
|
+
}
|
|
1853
|
+
else for (let key in serializedGlobals) if (serializedGlobals[key]) {
|
|
1854
|
+
let value = $global[key];
|
|
1855
|
+
value !== void 0 && ((filtered ||= {})[key] = value);
|
|
1856
|
+
}
|
|
1857
|
+
return filtered;
|
|
1858
|
+
}
|
|
1859
|
+
function concatEffects(a, b) {
|
|
1860
|
+
return a ? b ? a + " " + b : a : b;
|
|
1861
|
+
}
|
|
1862
|
+
function concatSequence(a, b) {
|
|
1863
|
+
return a ? b ? a + "," + b : a : b;
|
|
1864
|
+
}
|
|
1865
|
+
function concatScripts(a, b) {
|
|
1866
|
+
return a ? b ? a + ";" + b : a : b;
|
|
1867
|
+
}
|
|
1868
|
+
function queueTick(cb) {
|
|
1869
|
+
tickQueue ? tickQueue.add(cb) : (tickQueue = /* @__PURE__ */ new Set([cb]), tick(flushTickQueue));
|
|
1870
|
+
}
|
|
1871
|
+
function offTick(cb) {
|
|
1872
|
+
tickQueue?.delete(cb);
|
|
1873
|
+
}
|
|
1874
|
+
function flushTickQueue() {
|
|
1875
|
+
let queue = tickQueue;
|
|
1876
|
+
tickQueue = void 0;
|
|
1877
|
+
for (let cb of queue) try {
|
|
1878
|
+
cb(!0);
|
|
1879
|
+
} catch (err) {
|
|
1880
|
+
tick(() => {
|
|
1881
|
+
throw err;
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
// src/html/content.ts
|
|
1886
|
+
function _to_text(val) {
|
|
1887
|
+
return val || val === 0 ? val + "" : "";
|
|
1888
|
+
}
|
|
1889
|
+
function _unescaped(val) {
|
|
1890
|
+
return val ? val + "" : val === 0 ? "0" : "";
|
|
1891
|
+
}
|
|
1892
|
+
function _escape(val) {
|
|
1893
|
+
return val || val === 0 ? typeof val == "number" ? val + "" : escapeXMLStr(val + "") : "";
|
|
1894
|
+
}
|
|
1895
|
+
function _escape_script(val) {
|
|
1896
|
+
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
1897
|
+
}
|
|
1898
|
+
function _escape_style(val) {
|
|
1899
|
+
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
1900
|
+
}
|
|
1901
|
+
function _escape_style_value(val) {
|
|
1902
|
+
return val || val === 0 ? escapeStyleValue(val + "") : "";
|
|
1903
|
+
}
|
|
1904
|
+
function escapeCommentStr(str) {
|
|
1905
|
+
return unsafeCommentReg.test(str) && (str = str.replace(unsafeCommentReg, ">")), str.startsWith(getState().commentPrefix) ? "&#" + str.charCodeAt(0) + ";" + str.slice(1) : str;
|
|
1906
|
+
}
|
|
1907
|
+
function _escape_comment(val) {
|
|
1908
|
+
return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
|
|
1909
|
+
}
|
|
1910
|
+
// src/html/dynamic-tag.ts
|
|
1911
|
+
function _dynamic_tag(scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard, tagVar) {
|
|
1912
|
+
let shouldResume = markerGuard !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
1913
|
+
if (typeof renderer == "string") {
|
|
1914
|
+
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
1915
|
+
if (rendered = !0, _scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
1916
|
+
let renderContent = content || input.content;
|
|
1917
|
+
renderer === "textarea" ? _html(_attrs_textarea_value(branchId, "a", input)) : renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _attr_content("a", branchId, renderContent, markerGuard) : void 0, 1) : renderContent && _attr_content("a", branchId, renderContent, markerGuard), _html(`</${renderer}>`);
|
|
1918
|
+
}
|
|
1919
|
+
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
1920
|
+
needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId)), result = _el(scopeId, "-" + accessor);
|
|
1921
|
+
} else {
|
|
1922
|
+
let chunk = $chunk, beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
1923
|
+
if (renderer) try {
|
|
1924
|
+
return _set_scope_reason(shouldResume ? ALL_GROUPS : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
1925
|
+
...inputOrArgs,
|
|
1926
|
+
content
|
|
1927
|
+
} : inputOrArgs);
|
|
1928
|
+
} finally {
|
|
1929
|
+
_set_scope_reason(void 0);
|
|
1930
|
+
}
|
|
1931
|
+
else content && content();
|
|
1932
|
+
};
|
|
1933
|
+
result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId, beforeBranch !== void 0 && (applyBranchStart(chunk, beforeBranch, rendered), _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : ""))), renderer && _existing_scope(branchId));
|
|
1934
|
+
}
|
|
1935
|
+
return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: rendererKey(renderer) }) : _scope_id(), result;
|
|
1936
|
+
}
|
|
1937
|
+
function _content(id, fn, scopeId) {
|
|
1938
|
+
return fn.a = id, fn.e = scopeId, fn;
|
|
1939
|
+
}
|
|
1940
|
+
function _content_resume(id, fn, scopeId, locals) {
|
|
1941
|
+
return _resume(_content(id, fn, scopeId), id, scopeId, locals);
|
|
1942
|
+
}
|
|
1943
|
+
// src/html/template.ts
|
|
1944
|
+
function render(input = {}) {
|
|
1945
|
+
return startRender(this, input, State);
|
|
1946
|
+
}
|
|
1947
|
+
function startRender(template, input, StateClass) {
|
|
1948
|
+
let { $global } = input;
|
|
1949
|
+
$global ? ({$global, ...input} = input, $global = {
|
|
1950
|
+
runtimeId: "M",
|
|
1951
|
+
renderId: getDefaultRenderId(template),
|
|
1952
|
+
...$global
|
|
1953
|
+
}) : $global = {
|
|
1954
|
+
runtimeId: "M",
|
|
1955
|
+
renderId: getDefaultRenderId(template)
|
|
1956
|
+
};
|
|
1957
|
+
let state = new StateClass($global), head = new Chunk(new Boundary(state, $global.signal), null, null, state);
|
|
1958
|
+
return template.i ? head.render(() => writeWaitReady(template.a, template, input)) : head.render(template, input), new ServerRendered(head);
|
|
1959
|
+
}
|
|
1960
|
+
function getDefaultRenderId(template) {
|
|
1961
|
+
if (template.i) {
|
|
1962
|
+
let ENCODE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789", n = Math.random() * 4294967296 >>> 0, r = ENCODE_CHARS[n % 52];
|
|
1963
|
+
for (n = n / 52 | 0; n; n = n / 63 | 0) r += ENCODE_CHARS[n % 63];
|
|
1964
|
+
return r;
|
|
1965
|
+
}
|
|
1966
|
+
return "_";
|
|
1967
|
+
}
|
|
1968
|
+
var ServerRendered = class {
|
|
1969
|
+
#head;
|
|
1970
|
+
#cachedPromise = null;
|
|
1971
|
+
constructor(head) {
|
|
1972
|
+
this.#head = head;
|
|
1973
|
+
}
|
|
1974
|
+
[Symbol.asyncIterator]() {
|
|
1975
|
+
let resolve, reject, value = "", done = !1, aborted = !1, reason, boundary = this.#read((html) => {
|
|
1976
|
+
if (value += html, resolve) {
|
|
1977
|
+
let settle = resolve;
|
|
1978
|
+
resolve = reject = void 0, settle({
|
|
1979
|
+
value,
|
|
1980
|
+
done
|
|
1981
|
+
}), value = "";
|
|
1982
|
+
}
|
|
1983
|
+
}, (err) => {
|
|
1984
|
+
if (aborted = !0, reason = err, reject) {
|
|
1985
|
+
let settle = reject;
|
|
1986
|
+
resolve = reject = void 0, settle(err);
|
|
1987
|
+
}
|
|
1988
|
+
}, () => {
|
|
1989
|
+
if (done = !0, resolve) {
|
|
1990
|
+
let settle = resolve;
|
|
1991
|
+
resolve = reject = void 0, settle({
|
|
1992
|
+
value,
|
|
1993
|
+
done: !value
|
|
1994
|
+
}), value = "";
|
|
1995
|
+
}
|
|
1996
|
+
});
|
|
1997
|
+
return {
|
|
1998
|
+
next() {
|
|
1999
|
+
if (aborted) return Promise.reject(reason);
|
|
2000
|
+
if (value) {
|
|
2001
|
+
let result = {
|
|
2002
|
+
value,
|
|
2003
|
+
done: !1
|
|
2004
|
+
};
|
|
2005
|
+
return value = "", Promise.resolve(result);
|
|
2006
|
+
}
|
|
2007
|
+
return done ? Promise.resolve({
|
|
2008
|
+
value: "",
|
|
2009
|
+
done
|
|
2010
|
+
}) : new Promise(exec);
|
|
2011
|
+
},
|
|
2012
|
+
throw(error) {
|
|
2013
|
+
return done || aborted || boundary?.abort(error), Promise.resolve({
|
|
2014
|
+
value: "",
|
|
2015
|
+
done: !0
|
|
2016
|
+
});
|
|
2017
|
+
},
|
|
2018
|
+
return(value) {
|
|
2019
|
+
return done || aborted || boundary?.abort(/* @__PURE__ */ Error()), Promise.resolve({
|
|
2020
|
+
value,
|
|
2021
|
+
done: !0
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
2024
|
+
};
|
|
2025
|
+
function exec(_resolve, _reject) {
|
|
2026
|
+
resolve = _resolve, reject = _reject;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
pipe(stream) {
|
|
2030
|
+
this.#read((html) => {
|
|
2031
|
+
stream.write(html), stream.flush?.();
|
|
2032
|
+
}, (err) => {
|
|
2033
|
+
let socket = "socket" in stream && stream.socket;
|
|
2034
|
+
if (socket && typeof socket.destroySoon == "function" ? socket.destroySoon() : stream.destroy ? stream.destroy() : stream.end(), !stream.emit?.("error", err)) throw err;
|
|
2035
|
+
}, () => {
|
|
2036
|
+
stream.end();
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
toReadable() {
|
|
2040
|
+
let cancelled = !1, started = !1, boundary, encoder = new TextEncoder();
|
|
2041
|
+
return new ReadableStream({
|
|
2042
|
+
pull: (ctrl) => {
|
|
2043
|
+
started || (started = !0, boundary = this.#read((html) => {
|
|
2044
|
+
ctrl.enqueue(encoder.encode(html));
|
|
2045
|
+
}, (err) => {
|
|
2046
|
+
boundary = void 0, cancelled || ctrl.error(err);
|
|
2047
|
+
}, () => {
|
|
2048
|
+
boundary = void 0, ctrl.close();
|
|
2049
|
+
}));
|
|
2050
|
+
},
|
|
2051
|
+
cancel: (reason) => {
|
|
2052
|
+
cancelled = !0, boundary?.abort(reason);
|
|
2053
|
+
}
|
|
2054
|
+
}, { highWaterMark: 0 });
|
|
2055
|
+
}
|
|
2056
|
+
then(onfulfilled, onrejected) {
|
|
2057
|
+
return this.#promise().then(onfulfilled, onrejected);
|
|
2058
|
+
}
|
|
2059
|
+
catch(onrejected) {
|
|
2060
|
+
return this.#promise().catch(onrejected);
|
|
2061
|
+
}
|
|
2062
|
+
finally(onfinally) {
|
|
2063
|
+
return this.#promise().finally(onfinally);
|
|
2064
|
+
}
|
|
2065
|
+
#promise() {
|
|
2066
|
+
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
2067
|
+
let head = this.#head;
|
|
2068
|
+
if (this.#head = null, !head) return reject(/* @__PURE__ */ Error());
|
|
2069
|
+
let { boundary } = head, html = "";
|
|
2070
|
+
(boundary.onNext = () => {
|
|
2071
|
+
switch (!boundary.count && boundary.flush()) {
|
|
2072
|
+
case 2:
|
|
2073
|
+
settle(boundary), reject(boundary.reason);
|
|
2074
|
+
break;
|
|
2075
|
+
case 0:
|
|
2076
|
+
if (head = head.consume(boundary), boundary.aborted) break;
|
|
2077
|
+
html += head.flushHTML(boundary), boundary.count || boundary.aborted || (settle(boundary), resolve(html));
|
|
2078
|
+
}
|
|
2079
|
+
})();
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
#read(onWrite, onAbort, onClose) {
|
|
2083
|
+
let tick = !0, flushing = !1, again = !1, head = this.#head;
|
|
2084
|
+
if (this.#head = null, !head) {
|
|
2085
|
+
onAbort(/* @__PURE__ */ Error());
|
|
2086
|
+
return;
|
|
2087
|
+
}
|
|
2088
|
+
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
2089
|
+
if (flushing) again = !0;
|
|
2090
|
+
else {
|
|
2091
|
+
flushing = !0;
|
|
2092
|
+
do {
|
|
2093
|
+
again = !1;
|
|
2094
|
+
let status = boundary.flush();
|
|
2095
|
+
if (status === 2) {
|
|
2096
|
+
tick || offTick(onNext), settle(boundary), onAbort(boundary.reason);
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2099
|
+
if (write || status === 0) {
|
|
2100
|
+
if (head = head.consume(boundary), boundary.aborted) continue;
|
|
2101
|
+
let html = head.flushHTML(boundary);
|
|
2102
|
+
if (boundary.aborted) continue;
|
|
2103
|
+
if (html && onWrite(html), !boundary.count) {
|
|
2104
|
+
tick || offTick(onNext), settle(boundary), onClose();
|
|
2105
|
+
return;
|
|
2106
|
+
}
|
|
2107
|
+
write && (tick = !0);
|
|
2108
|
+
} else tick && (tick = !1, queueTick(onNext));
|
|
2109
|
+
} while (again);
|
|
2110
|
+
flushing = !1;
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
return onNext(), boundary;
|
|
2114
|
+
}
|
|
2115
|
+
toString() {
|
|
2116
|
+
let head = this.#head;
|
|
2117
|
+
if (this.#head = null, !head) throw /* @__PURE__ */ Error();
|
|
2118
|
+
let { boundary } = head, html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
|
|
2119
|
+
if (boundary.count && boundary.abort(/* @__PURE__ */ Error()), settle(boundary), boundary.aborted) throw boundary.reason;
|
|
2120
|
+
return html;
|
|
2121
|
+
}
|
|
2122
|
+
};
|
|
2123
|
+
function settle(boundary) {
|
|
2124
|
+
boundary.onNext = NOOP, boundary.state.$global.signal?.removeEventListener("abort", boundary);
|
|
2125
|
+
}
|
|
2126
|
+
// src/html/assets.ts
|
|
2127
|
+
function withLoadAssets(template, id, flush, assetId, triggers) {
|
|
2128
|
+
let renderer = (input) => (writeLoadAsset(assetId, flush, triggers), writeWaitReady(assetId, template(), input));
|
|
2129
|
+
return _template(id, renderer), renderer;
|
|
2130
|
+
}
|
|
2131
|
+
function writeLoadAsset(assetId, flush, triggers) {
|
|
2132
|
+
let g = $global();
|
|
2133
|
+
writeAsset(g, addAsset(g, assetId, flush, triggers));
|
|
2134
|
+
}
|
|
2135
|
+
function withPageAssets(template, flush, assetId, runtimeId) {
|
|
2136
|
+
return Object.assign((input) => {
|
|
2137
|
+
let g = $global();
|
|
2138
|
+
runtimeId && (g[kAssets] || (g.runtimeId = runtimeId));
|
|
2139
|
+
let asset = addAsset(g, assetId, flush);
|
|
2140
|
+
return g.__flush__ ? (writeAsset(g, asset), writeWaitReady(assetId, template, input)) : (g.__flush__ = flushPage, template(input));
|
|
2141
|
+
}, template);
|
|
2142
|
+
}
|
|
2143
|
+
function _flush_head() {
|
|
2144
|
+
let g = $global();
|
|
2145
|
+
return g[kAssets] ? (g[kHead] = !0, takeAssets(g, catchableBoundary())) : "";
|
|
2146
|
+
}
|
|
2147
|
+
function flushPage(g, html) {
|
|
2148
|
+
return takeAssets(g, null) + html;
|
|
2149
|
+
}
|
|
2150
|
+
function takeAssets(g, at) {
|
|
2151
|
+
let block = "", defer = "";
|
|
2152
|
+
for (let asset of g[kAssets]) asset.htmlAt === void 0 && (asset.htmlAt = at, block += blockHTML(g, asset), asset.triggers || (defer += deferHTML(g, asset)));
|
|
2153
|
+
return block + defer;
|
|
2154
|
+
}
|
|
2155
|
+
function writeAsset(g, asset) {
|
|
2156
|
+
if (needsWrite(asset.htmlAt) && (asset.htmlAt = void 0, g[kHead] || g.__flush__ !== flushPage)) {
|
|
2157
|
+
let block = blockHTML(g, asset);
|
|
2158
|
+
_html(block + (asset.triggers ? "" : deferHTML(g, asset))), block && isInResumedBranch() && writeScript(`document.head.insertAdjacentHTML("beforeend",${quoteScriptTemplateLiteral(block)})`), asset.htmlAt = catchableBoundary();
|
|
2159
|
+
}
|
|
2160
|
+
if (asset.triggers && needsWrite(asset.scriptAt)) {
|
|
2161
|
+
let defer = deferHTML(g, asset);
|
|
2162
|
+
defer && writeScript(asset.script ||= triggerScript(asset.id, defer, asset.triggers)), asset.scriptAt = catchableBoundary();
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
function needsWrite(at) {
|
|
2166
|
+
return at === void 0 || at !== null && mayDrop(at);
|
|
2167
|
+
}
|
|
2168
|
+
function blockHTML(g, asset) {
|
|
2169
|
+
return asset.block ??= asset.flush(g, "block", asset.id);
|
|
2170
|
+
}
|
|
2171
|
+
function deferHTML(g, asset) {
|
|
2172
|
+
return asset.defer ??= asset.flush(g, "defer", asset.id);
|
|
2173
|
+
}
|
|
2174
|
+
function addAsset(g, id, flush, triggers) {
|
|
2175
|
+
let assets = g[kAssets] ||= [], asset = assets.find((a) => a.id === id);
|
|
2176
|
+
return asset || assets.push(asset = {
|
|
2177
|
+
id,
|
|
2178
|
+
flush,
|
|
2179
|
+
triggers,
|
|
2180
|
+
block: void 0,
|
|
2181
|
+
defer: void 0,
|
|
2182
|
+
script: void 0,
|
|
2183
|
+
htmlAt: void 0,
|
|
2184
|
+
scriptAt: void 0
|
|
2185
|
+
}), asset;
|
|
2186
|
+
}
|
|
2187
|
+
function triggerScript(id, html, triggers) {
|
|
2188
|
+
let htmlStr = quoteScriptTemplateLiteral(html), exprs = triggers.map(triggerExpression);
|
|
2189
|
+
return `((h,d,l=$=>{d||document.head.append(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(${htmlStr})`;
|
|
2190
|
+
}
|
|
2191
|
+
function triggerExpression(trigger) {
|
|
2192
|
+
let options = trigger.options && toObjectExpression(trigger.options);
|
|
2193
|
+
switch (trigger.type) {
|
|
2194
|
+
case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
|
|
2195
|
+
case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
|
|
2196
|
+
case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
|
|
2197
|
+
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
function querySelectorOrLoad(selector) {
|
|
2201
|
+
return `document.querySelector(${JSON.stringify(selector)})||l()`;
|
|
2202
|
+
}
|
|
2203
|
+
function toObjectExpression(options) {
|
|
2204
|
+
let result = "{", sep = "";
|
|
2205
|
+
for (let key in options) Object.hasOwn(options, key) && (result += sep + toObjectKey(key) + ":" + JSON.stringify(options[key]), sep = ",");
|
|
2206
|
+
return result + "}";
|
|
2207
|
+
}
|
|
2208
|
+
// src/common/for.ts
|
|
2209
|
+
function forIn(obj, cb) {
|
|
2210
|
+
for (let key in obj) cb(key, obj[key]);
|
|
2211
|
+
}
|
|
2212
|
+
function forOf(list, cb) {
|
|
2213
|
+
if (list) {
|
|
2214
|
+
let i = 0;
|
|
2215
|
+
for (let item of list) cb(item, i++);
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
function forTo(to, from, step, cb) {
|
|
2219
|
+
let start = from || 0, delta = step || 1;
|
|
2220
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
2221
|
+
}
|
|
2222
|
+
function forUntil(until, from, step, cb) {
|
|
2223
|
+
let start = from || 0, delta = step || 1;
|
|
2224
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
2225
|
+
}
|
|
2226
|
+
// src/html/for.ts
|
|
2227
|
+
function forOfBy(by, item, index) {
|
|
2228
|
+
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
|
2229
|
+
}
|
|
2230
|
+
function forInBy(by, name, value) {
|
|
2231
|
+
return by ? by(name, value) : name;
|
|
2232
|
+
}
|
|
2233
|
+
function forStepBy(by, index) {
|
|
2234
|
+
return by ? by(index) : index;
|
|
2235
|
+
}
|
|
2236
|
+
// src/html/control-flow.ts
|
|
2237
|
+
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
2238
|
+
display ? resumesMarker(markerGuard, branchExprGuard, parentEndTag) && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
2239
|
+
}
|
|
2240
|
+
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2241
|
+
let branchId = _scope_id(), wrap = !display;
|
|
2242
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
2243
|
+
}
|
|
2244
|
+
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2245
|
+
forBranches(by, cb, iterateForOf(list, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2246
|
+
}
|
|
2247
|
+
function iterateForOf(list, cb, by) {
|
|
2248
|
+
return (each) => each ? forOf(list, (item, index) => {
|
|
2249
|
+
let itemKey = forOfBy(by, item, index);
|
|
2250
|
+
each(itemKey, itemKey === index, item, index);
|
|
2251
|
+
}) : forOf(list, cb);
|
|
2252
|
+
}
|
|
2253
|
+
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2254
|
+
forBranches(by, cb, iterateForIn(obj, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2255
|
+
}
|
|
2256
|
+
function iterateForIn(obj, cb, by) {
|
|
2257
|
+
return (each) => each ? forIn(obj, (key, value) => {
|
|
2258
|
+
each(forInBy(by, key, value), !1, key, value);
|
|
2259
|
+
}) : forIn(obj, cb);
|
|
2260
|
+
}
|
|
2261
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2262
|
+
forBranches(by, cb, iterateForTo(to, from, step, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2263
|
+
}
|
|
2264
|
+
function iterateForTo(to, from, step, cb, by) {
|
|
2265
|
+
return (each) => {
|
|
2266
|
+
let index = 0;
|
|
2267
|
+
return each ? forTo(to, from, step, (value) => {
|
|
2268
|
+
let itemKey = forStepBy(by, value);
|
|
2269
|
+
each(itemKey, itemKey === index++, value);
|
|
2270
|
+
}) : forTo(to, from, step, cb);
|
|
2271
|
+
};
|
|
2272
|
+
}
|
|
2273
|
+
function _for_until(until, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2274
|
+
forBranches(by, cb, iterateForUntil(until, from, step, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2275
|
+
}
|
|
2276
|
+
function iterateForUntil(until, from, step, cb, by) {
|
|
2277
|
+
return (each) => {
|
|
2278
|
+
let index = 0;
|
|
2279
|
+
return each ? forUntil(until, from, step, (value) => {
|
|
2280
|
+
let itemKey = forStepBy(by, value);
|
|
2281
|
+
each(itemKey, itemKey === index++, value);
|
|
2282
|
+
}) : forUntil(until, from, step, cb);
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
function forBranches(by, cb, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2286
|
+
if (branchGuard === 0) {
|
|
2287
|
+
iterate(0), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
2288
|
+
return;
|
|
2289
|
+
}
|
|
2290
|
+
let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
|
|
2291
|
+
iterate((itemKey, sameAsIndex, a, b) => {
|
|
2292
|
+
let branchId = _peek_scope_id();
|
|
2293
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), resumeMarker ? withBranchId(branchId, cb, a, b) : cb(a, b);
|
|
2294
|
+
let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
|
|
2295
|
+
resumeMarker || (loopScopes = push(loopScopes, branchScope));
|
|
2296
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
2297
|
+
}
|
|
2298
|
+
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2299
|
+
let resumeBranch = branchGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), branchId = _peek_scope_id(), chunk = $chunk, beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0, branchIndex = resumeBranch && resumeMarker ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
2300
|
+
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
2301
|
+
["D" + accessor]: branchIndex || void 0,
|
|
2302
|
+
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
2303
|
+
}), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
2304
|
+
}
|
|
2305
|
+
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
2306
|
+
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
2307
|
+
}
|
|
2308
|
+
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
2309
|
+
let endTag = parentEndTag || "";
|
|
2310
|
+
resumesMarker(markerGuard, branchExprGuard, parentEndTag) ? $chunk.writeHTML($chunk.boundary.state.mark(singleNode ? parentEndTag ? "}" : "|" : parentEndTag ? ")" : "]", scopeId + " " + accessor + branchIds) + endTag) : markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_mark(scopeId, accessor));
|
|
2311
|
+
}
|
|
2312
|
+
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
2313
|
+
let resumeMarker = markerGuard !== 0;
|
|
2314
|
+
if (!isPromise(promise)) {
|
|
2315
|
+
if (resumeMarker) {
|
|
2316
|
+
let branchId = _peek_scope_id();
|
|
2317
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, content, promise), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
2318
|
+
} else content(promise);
|
|
2319
|
+
return;
|
|
2320
|
+
}
|
|
2321
|
+
let chunk = $chunk, { boundary } = chunk, startId = _peek_scope_id(), after = chunk.next = chunk.forkRest(boundary);
|
|
2322
|
+
chunk.async = !0, captureContext(chunk), boundary.startAsync(), promise.then((value) => {
|
|
2323
|
+
if (chunk.async && (chunk.async = !1, !boundary.aborted)) {
|
|
2324
|
+
let { state } = boundary;
|
|
2325
|
+
chunk.render(() => {
|
|
2326
|
+
if (resumeMarker) {
|
|
2327
|
+
let branchId = _peek_scope_id();
|
|
2328
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withAsyncContent({ parent: getAsyncContent(chunk) }, content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
2329
|
+
} else {
|
|
2330
|
+
let renderedSince = _peek_scope_id() !== startId, async = { parent: getAsyncContent(chunk) };
|
|
2331
|
+
withAsyncContent(async, content, value), async.visit = renderedSince && (after.html || after.next) ? $chunk.boundary.state.mark("]", scopeId + " " + accessor) : "", async.resumed && $chunk.writeHTML(async.visit), async.end = $chunk;
|
|
2332
|
+
}
|
|
2333
|
+
}), !chunk.async && boundary.pendingReorders?.delete(chunk) && state.reorder(chunk), boundary.endAsync();
|
|
2334
|
+
}
|
|
2335
|
+
}, (err) => {
|
|
2336
|
+
chunk.async = !1, boundary.abort(err);
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
function _try(scopeId, accessor, content, placeholderContent, catchContent, placeholderId, catchId) {
|
|
2340
|
+
let placeholderBranchId = placeholderContent ? _scope_id() : 0, branchId = _peek_scope_id(), chunk = $chunk, { boundary } = chunk, { state } = boundary, { resumeWrites } = boundary, beforeBranch = deferBranchStart(chunk), renderers = () => writeTryRenderers(branchId, catchContent && _resume(catchContent, catchId), placeholderContent && _resume(placeholderContent, placeholderId)), writesRenderers = tryBoundary(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content, catchContent, branchId, renderers), keepsMarks = state.keepsTryMarks(chunk, resumeWrites);
|
|
2341
|
+
applyBranchStart(chunk, beforeBranch, keepsMarks), keepsMarks && (writesRenderers || renderers(), $chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId)));
|
|
2342
|
+
}
|
|
2343
|
+
function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
|
|
2344
|
+
let chunk = $chunk, { boundary } = chunk, body = chunk.fork(boundary, null);
|
|
2345
|
+
body === body.render(content) ? chunk.append(body) : (chunk.next = chunk.forkRest(boundary), captureContext(chunk), chunk.placeholder = {
|
|
2346
|
+
body,
|
|
2347
|
+
render: placeholder,
|
|
2348
|
+
branchId,
|
|
2349
|
+
scopeId,
|
|
2350
|
+
placeholderBranchId
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
2354
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, bodyBoundary = new Boundary(state, void 0, boundary);
|
|
2355
|
+
catchContent && (bodyBoundary.withinCatch = !0);
|
|
2356
|
+
let body = chunk.fork(bodyBoundary, null), bodyEnd = body.render(withBranchId, branchId, content);
|
|
2357
|
+
if (bodyBoundary.aborted) {
|
|
2358
|
+
if (!catchContent) throw bodyBoundary.reason;
|
|
2359
|
+
return catchContent(bodyBoundary.reason), !0;
|
|
2360
|
+
}
|
|
2361
|
+
if (body === bodyEnd) return chunk.append(body), !1;
|
|
2362
|
+
let renderersAtSettle = !bodyBoundary.resumeWrites, bodyNext = bodyEnd.next = chunk.forkRest(boundary);
|
|
2363
|
+
chunk.next = body, boundary.startAsync();
|
|
2364
|
+
let reorderId = catchContent ? state.nextReorderId() : "";
|
|
2365
|
+
return reorderId && (chunk.catchRange = {
|
|
2366
|
+
id: reorderId,
|
|
2367
|
+
end: bodyEnd
|
|
2368
|
+
}, captureContext(chunk)), bodyBoundary.onNext = () => {
|
|
2369
|
+
if (!boundary.aborted) {
|
|
2370
|
+
if (bodyBoundary.aborted) {
|
|
2371
|
+
if (!reorderId) {
|
|
2372
|
+
boundary.abort(bodyBoundary.reason);
|
|
2373
|
+
return;
|
|
2374
|
+
}
|
|
2375
|
+
let streamed = !chunk.catchRange, catchChunk = chunk.fork(boundary, null);
|
|
2376
|
+
chunk.catchRange = null, renderersAtSettle || catchChunk.render(clearTryRenderers, branchId);
|
|
2377
|
+
let inOrder = catchChunk === catchChunk.render(catchContent, bodyBoundary.reason);
|
|
2378
|
+
if (boundary.aborted) return;
|
|
2379
|
+
if ((bodyEnd.consumed || !inOrder) && (catchChunk.reorderBranch = branchId), bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
2380
|
+
else {
|
|
2381
|
+
let reorder = null;
|
|
2382
|
+
inOrder ? streamed && (reorder = chunk.fork(boundary, null)) : reorder = catchChunk, reorder && (reorder.reorderId = reorderId);
|
|
2383
|
+
let endMarker = state.mark("!", reorderId), cut = body;
|
|
2384
|
+
for (; cut.consumed;) cut = cut.next;
|
|
2385
|
+
cut.async = !1, cut.next = inOrder ? catchChunk : bodyNext, cut.html = streamed ? endMarker : inOrder ? "" : state.mark("!^", reorderId) + endMarker, cut.scripts = cut.effects = cut.lastEffect = "", cut.placeholder = cut.reorderId = cut.catchRange = null, cut.deferredReorder = reorder, inOrder && (catchChunk.next = bodyNext);
|
|
2386
|
+
}
|
|
2387
|
+
boundary.endAsync();
|
|
2388
|
+
} else bodyBoundary.count ? boundary.onNext() : (renderersAtSettle && bodyBoundary.resumeWrites && bodyEnd.render(renderers), chunk.catchRange = null, boundary.endAsync());
|
|
2389
|
+
}
|
|
2390
|
+
}, renderersAtSettle;
|
|
2391
|
+
}
|
|
2392
|
+
function clearTryRenderers(branchId) {
|
|
2393
|
+
writeScope(branchId, {
|
|
2394
|
+
E: 0,
|
|
2395
|
+
Q: _scope_with_id(branchId).Q && 0
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
2399
|
+
writeScope(branchId, {
|
|
2400
|
+
E: catchContent,
|
|
2401
|
+
Q: placeholderContent
|
|
2402
|
+
});
|
|
2403
|
+
}
|
|
2404
|
+
export { _subscribe as $, $global as A, _attrs_select_value as At, _hoist as B, _signal_read_error as Bt, _escape_comment as C, _attr_select_value as Ct, _to_text as D, _attrs_content as Dt, _escape_style_value as E, _attrs as Et, State as F, register as Ft, _resume as G, _html_mark as H, _attr_content as I, _assert_class_toggles as It, _scope_id as J, _resume_branch as K, _el as L, _assert_hoist as Lt, Boundary as M, _style_html as Mt, Chunk as N, _textarea_value as Nt, _unescaped as O, _attrs_partial as Ot, NOOP as P, REGISTRY as Pt, _set_scope_reason as Q, _el_mark as R, _el_read_error as Rt, _escape as S, _attr_or as St, _escape_style as T, _attr_textarea_value as Tt, _id as U, _html as V, setClassAPIRenderer as Vt, _peek_scope_id as W, _scope_with_id as X, _scope_reason as Y, _script as Z, writeLoadAsset as _, _attr_input_checkedValue as _t, _for_until as a, getChunk as at, _content_resume as b, _attr_nullish as bt, _show_start as c, joinHeldEffects as ct, forOf as d, writeScript as dt, _text_mark as et, forTo as f, _attr as ft, withPageAssets as g, _attr_input_checked as gt, withLoadAssets as h, _attr_details_or_dialog_open as ht, _for_to as i, _write_if as it, ALL_GROUPS as j, _attrs_textarea_value as jt, $chunk as k, _attrs_partial_content as kt, _try as l, withChunk as lt, _flush_head as m, _attr_class as mt, _for_in as n, _var as nt, _if as o, getScopeId as ot, forUntil as p, _attr_and as pt, _resume_locals as q, _for_of as r, _write_guard as rt, _show_end as s, isInResumedBranch as st, _await as t, _trailers as tt, forIn as u, writeScope as ut, _template as v, _attr_input_value as vt, _escape_script as w, _attr_style as wt, _dynamic_tag as x, _attr_option_value as xt, _content as y, _attr_nonce as yt, _existing_scope as z, _hoist_read_error as zt };
|