marko 6.0.166 → 6.0.168
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/debug/dom.js +1 -1
- package/dist/debug/dom.mjs +1 -1
- package/dist/debug/html.js +4 -2
- package/dist/debug/html.mjs +4 -2
- package/dist/html/writer.d.ts +1 -1
- package/dist/html.js +396 -390
- package/dist/html.mjs +395 -389
- package/dist/translator/index.js +2 -1
- package/package.json +1 -1
package/dist/html.mjs
CHANGED
|
@@ -4,9 +4,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
4
4
|
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
|
-
}, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str, unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor,
|
|
8
|
-
return MutationType[MutationType.call = 0] = "call", MutationType[MutationType.assign = 1] = "assign", MutationType;
|
|
9
|
-
}(MutationType || {}), REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
7
|
+
}, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str, unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
10
8
|
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
11
9
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
12
10
|
let symbol = Symbol[name];
|
|
@@ -240,221 +238,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
240
238
|
[JSON, "JSON"],
|
|
241
239
|
[Math, "Math"],
|
|
242
240
|
[Reflect, "Reflect"]
|
|
243
|
-
]),
|
|
244
|
-
ids = 0;
|
|
245
|
-
flush = 0;
|
|
246
|
-
registerInstanceId = 0;
|
|
247
|
-
flushed = !1;
|
|
248
|
-
wroteUndefined = !1;
|
|
249
|
-
buf = [];
|
|
250
|
-
strs = /* @__PURE__ */ new Map();
|
|
251
|
-
refs = /* @__PURE__ */ new WeakMap();
|
|
252
|
-
assigned = /* @__PURE__ */ new Set();
|
|
253
|
-
registered = [];
|
|
254
|
-
boundary = void 0;
|
|
255
|
-
mutated = [];
|
|
256
|
-
}, Reference = class {
|
|
257
|
-
registered = null;
|
|
258
|
-
assigns = null;
|
|
259
|
-
constructor(parent, accessor, flush, pos = null, id = null) {
|
|
260
|
-
this.parent = parent, this.accessor = accessor, this.flush = flush, this.pos = pos, this.id = id, this.parent = parent, this.accessor = accessor, this.flush = flush, this.pos = pos, this.id = id;
|
|
261
|
-
}
|
|
262
|
-
}, Serializer = class {
|
|
263
|
-
#state = new State$1();
|
|
264
|
-
get flushed() {
|
|
265
|
-
return this.#state.flushed;
|
|
266
|
-
}
|
|
267
|
-
stringify(val, boundary) {
|
|
268
|
-
try {
|
|
269
|
-
return this.#state.flushed = !1, this.#state.boundary = boundary, writeRoot(this.#state, val);
|
|
270
|
-
} finally {
|
|
271
|
-
this.#state.flush++, this.#state.buf = [];
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
nextId() {
|
|
275
|
-
return nextId(this.#state);
|
|
276
|
-
}
|
|
277
|
-
symbol(id) {
|
|
278
|
-
let symbol = Symbol();
|
|
279
|
-
return this.#state.refs.set(symbol, new Reference(null, null, 0, null, id)), symbol;
|
|
280
|
-
}
|
|
281
|
-
writeCall(value, object, property, spread) {
|
|
282
|
-
let state = this.#state;
|
|
283
|
-
state.mutated.push({
|
|
284
|
-
type: 0,
|
|
285
|
-
value,
|
|
286
|
-
object,
|
|
287
|
-
property,
|
|
288
|
-
spread
|
|
289
|
-
}), state.flushed = !0;
|
|
290
|
-
}
|
|
291
|
-
writeAssign(value, object, property) {
|
|
292
|
-
let state = this.#state;
|
|
293
|
-
state.mutated.push({
|
|
294
|
-
type: 1,
|
|
295
|
-
value,
|
|
296
|
-
object,
|
|
297
|
-
property
|
|
298
|
-
}), state.flushed = !0;
|
|
299
|
-
}
|
|
300
|
-
register(id, val, scope) {
|
|
301
|
-
return register(id, val, scope, scope ? ++this.#state.registerInstanceId : 0);
|
|
302
|
-
}
|
|
303
|
-
}, $chunk, NOOP$2 = () => {}, K_SCOPE_ID = Symbol("Scope ID"), K_SCOPE_REFERENCED = Symbol("Scope Referenced"), Mark = /* @__PURE__ */ function(Mark) {
|
|
304
|
-
return Mark.Placeholder = "!^", Mark.PlaceholderEnd = "!", Mark.ReorderMarker = "#", Mark;
|
|
305
|
-
}(Mark || {}), RuntimeKey = /* @__PURE__ */ function(RuntimeKey) {
|
|
306
|
-
return RuntimeKey.Walk = ".w", RuntimeKey.Resume = ".r", RuntimeKey.Blocking = ".b", RuntimeKey.Scripts = ".j", RuntimeKey;
|
|
307
|
-
}(RuntimeKey || {}), kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope), State = class {
|
|
308
|
-
tagId = 1;
|
|
309
|
-
scopeId = 1;
|
|
310
|
-
reorderId = 1;
|
|
311
|
-
lastSerializedScopeId = this.scopeId;
|
|
312
|
-
hasGlobals = !1;
|
|
313
|
-
needsMainRuntime = !1;
|
|
314
|
-
hasMainRuntime = !1;
|
|
315
|
-
hasReorderRuntime = !1;
|
|
316
|
-
hasWrittenResume = !1;
|
|
317
|
-
walkOnNextFlush = !1;
|
|
318
|
-
trailerHTML = "";
|
|
319
|
-
resumes = "";
|
|
320
|
-
nonceAttr = "";
|
|
321
|
-
serializer = new Serializer();
|
|
322
|
-
writeReorders = null;
|
|
323
|
-
scopes = /* @__PURE__ */ new Map();
|
|
324
|
-
writeScopes = null;
|
|
325
|
-
ensureReady = null;
|
|
326
|
-
serializeReason;
|
|
327
|
-
constructor($global) {
|
|
328
|
-
this.$global = $global, this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
329
|
-
}
|
|
330
|
-
get runtimePrefix() {
|
|
331
|
-
let { $global } = this;
|
|
332
|
-
return $global.runtimeId + "." + $global.renderId;
|
|
333
|
-
}
|
|
334
|
-
get commentPrefix() {
|
|
335
|
-
let { $global } = this;
|
|
336
|
-
return $global.runtimeId + $global.renderId;
|
|
337
|
-
}
|
|
338
|
-
reorder(chunk) {
|
|
339
|
-
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
|
|
340
|
-
}
|
|
341
|
-
nextReorderId() {
|
|
342
|
-
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = this.reorderId++, r = c[n % 54];
|
|
343
|
-
for (n = n / 54 | 0; n; n >>>= 6) r += c[n & 63];
|
|
344
|
-
return r;
|
|
345
|
-
}
|
|
346
|
-
mark(code, str) {
|
|
347
|
-
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
348
|
-
}
|
|
349
|
-
}, Boundary = class extends AbortController {
|
|
350
|
-
onNext = NOOP$2;
|
|
351
|
-
count = 0;
|
|
352
|
-
constructor(state, parent) {
|
|
353
|
-
super(), this.state = state, this.state = state, this.signal.addEventListener("abort", () => {
|
|
354
|
-
this.count = 0, this.state = new State(this.state.$global), this.onNext();
|
|
355
|
-
}), parent && (parent.aborted ? this.abort(parent.reason) : parent.addEventListener("abort", () => {
|
|
356
|
-
this.abort(parent.reason);
|
|
357
|
-
}));
|
|
358
|
-
}
|
|
359
|
-
flush() {
|
|
360
|
-
return this.signal.aborted || flushSerializer(this), this.count ? 1 : this.signal.aborted ? 2 : 0;
|
|
361
|
-
}
|
|
362
|
-
startAsync() {
|
|
363
|
-
this.signal.aborted || this.count++;
|
|
364
|
-
}
|
|
365
|
-
endAsync(chunk) {
|
|
366
|
-
!this.signal.aborted && this.count && (this.count--, chunk?.reorderId && this.state.reorder(chunk), this.onNext());
|
|
367
|
-
}
|
|
368
|
-
}, Chunk = class {
|
|
369
|
-
html = "";
|
|
370
|
-
scripts = "";
|
|
371
|
-
effects = "";
|
|
372
|
-
lastEffect = "";
|
|
373
|
-
async = !1;
|
|
374
|
-
consumed = !1;
|
|
375
|
-
needsWalk = !1;
|
|
376
|
-
reorderId = null;
|
|
377
|
-
placeholderBody = null;
|
|
378
|
-
placeholderRender = null;
|
|
379
|
-
placeholderBranchId = null;
|
|
380
|
-
constructor(boundary, next, context) {
|
|
381
|
-
this.boundary = boundary, this.next = next, this.context = context, this.boundary = boundary, this.next = next, this.context = context;
|
|
382
|
-
}
|
|
383
|
-
writeHTML(html) {
|
|
384
|
-
this.html += html;
|
|
385
|
-
}
|
|
386
|
-
writeEffect(scopeId, registryId) {
|
|
387
|
-
this.lastEffect === registryId ? this.effects += " " + scopeId : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
388
|
-
}
|
|
389
|
-
writeScript(script) {
|
|
390
|
-
this.scripts = concatScripts(this.scripts, script);
|
|
391
|
-
}
|
|
392
|
-
append(chunk) {
|
|
393
|
-
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect;
|
|
394
|
-
}
|
|
395
|
-
flushPlaceholder() {
|
|
396
|
-
if (this.placeholderBody) {
|
|
397
|
-
let body = this.placeholderBody.consume();
|
|
398
|
-
if (body.async) {
|
|
399
|
-
let { state } = this.boundary, reorderId = body.reorderId = this.placeholderBranchId ? this.placeholderBranchId + "" : state.nextReorderId();
|
|
400
|
-
this.placeholderBranchId = null, this.writeHTML(state.mark("!^", reorderId));
|
|
401
|
-
let after = this.render(this.placeholderRender);
|
|
402
|
-
after !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), after.writeHTML(state.mark("!", reorderId)), state.reorder(body);
|
|
403
|
-
} else body.next = this.next, this.next = body;
|
|
404
|
-
this.placeholderRender = this.placeholderBody = null;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
consume() {
|
|
408
|
-
let cur = this, needsWalk = cur.needsWalk;
|
|
409
|
-
if (cur.next && !cur.async) {
|
|
410
|
-
let html = "", effects = "", scripts = "", lastEffect = "";
|
|
411
|
-
do
|
|
412
|
-
cur.flushPlaceholder(), needsWalk ||= cur.needsWalk, html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
|
|
413
|
-
while (cur.next && !cur.async);
|
|
414
|
-
cur.needsWalk = needsWalk, cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
|
|
415
|
-
}
|
|
416
|
-
return cur;
|
|
417
|
-
}
|
|
418
|
-
render(content, val) {
|
|
419
|
-
let prev = $chunk;
|
|
420
|
-
$chunk = this;
|
|
421
|
-
try {
|
|
422
|
-
return content(val), $chunk;
|
|
423
|
-
} catch (err) {
|
|
424
|
-
return this.boundary.abort(err), this;
|
|
425
|
-
} finally {
|
|
426
|
-
$chunk = prev;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
flushScript() {
|
|
430
|
-
let { boundary, effects } = this, { state } = boundary, { $global, runtimePrefix, nonceAttr } = state, { html, scripts } = this, needsWalk = state.walkOnNextFlush;
|
|
431
|
-
if (needsWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[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,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}}),self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), state.ensureReady && state.hasMainRuntime) {
|
|
432
|
-
let first = !0;
|
|
433
|
-
for (let id in state.ensureReady) state.ensureReady[id] && (state.ensureReady[id] = 0, scripts = first ? concatScripts(scripts, "(" + runtimePrefix + ".b={})" + toAccess(toObjectKey(id)) + "=1") : concatScripts(scripts, runtimePrefix + ".b" + toAccess(toObjectKey(id)) + "=1")), first = !1;
|
|
434
|
-
}
|
|
435
|
-
if (effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\""), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]"))), state.writeReorders) {
|
|
436
|
-
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", 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.d.head.append(e.d.querySelector(\"style[\"+e.i+\"]\")||\"\"),e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
437
|
-
for (let reorderedChunk of state.writeReorders) {
|
|
438
|
-
let { reorderId } = reorderedChunk, reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
439
|
-
for (reorderedChunk.reorderId = null;;) {
|
|
440
|
-
cur.flushPlaceholder();
|
|
441
|
-
let { next } = cur;
|
|
442
|
-
if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next) cur = next;
|
|
443
|
-
else break;
|
|
444
|
-
}
|
|
445
|
-
reorderEffects && (state.hasWrittenResume || (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[]")), reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")), scripts = concatScripts(scripts, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
446
|
-
}
|
|
447
|
-
state.writeReorders = null;
|
|
448
|
-
}
|
|
449
|
-
return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
|
|
450
|
-
}
|
|
451
|
-
flushHTML() {
|
|
452
|
-
let { boundary } = this, { state } = boundary;
|
|
453
|
-
this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
|
|
454
|
-
let { scripts } = this, { $global, nonceAttr } = state, { __flush__ } = $global, { html } = this;
|
|
455
|
-
return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), boundary.count || (html += state.trailerHTML), html;
|
|
456
|
-
}
|
|
457
|
-
}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g, doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g, needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/g, SET_SCOPE_REGISTER_ID = "$C_s", voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
241
|
+
]), $chunk, NOOP$2 = () => {}, K_SCOPE_ID = Symbol("Scope ID"), K_SCOPE_REFERENCED = Symbol("Scope Referenced"), kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope), tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g, doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g, needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/g, SET_SCOPE_REGISTER_ID = "$C_s", voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
458
242
|
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
459
243
|
if (typeof renderer == "string") {
|
|
460
244
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
@@ -570,175 +354,44 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
570
354
|
registerRenderBody(fn) {
|
|
571
355
|
register("$C_b", fn);
|
|
572
356
|
}
|
|
573
|
-
}, _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer))
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
[
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
done: !0
|
|
612
|
-
});
|
|
613
|
-
},
|
|
614
|
-
return(value) {
|
|
615
|
-
return done || aborted || boundary?.abort(/* @__PURE__ */ Error("Iterator returned before consumed.")), Promise.resolve({
|
|
616
|
-
value,
|
|
617
|
-
done: !0
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
function exec(_resolve, _reject) {
|
|
622
|
-
resolve = _resolve, reject = _reject;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
pipe(stream) {
|
|
626
|
-
this.#read((html) => {
|
|
627
|
-
stream.write(html);
|
|
628
|
-
}, (err) => {
|
|
629
|
-
let socket = "socket" in stream && stream.socket;
|
|
630
|
-
if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err)) throw err;
|
|
631
|
-
}, () => {
|
|
632
|
-
stream.end();
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
toReadable() {
|
|
636
|
-
let cancelled = !1, boundary, encoder = new TextEncoder();
|
|
637
|
-
return new ReadableStream({
|
|
638
|
-
start: (ctrl) => {
|
|
639
|
-
boundary = this.#read((html) => {
|
|
640
|
-
ctrl.enqueue(encoder.encode(html));
|
|
641
|
-
}, (err) => {
|
|
642
|
-
boundary = void 0, cancelled || ctrl.error(err);
|
|
643
|
-
}, () => {
|
|
644
|
-
boundary = void 0, ctrl.close();
|
|
645
|
-
});
|
|
646
|
-
},
|
|
647
|
-
cancel: (reason) => {
|
|
648
|
-
cancelled = !0, boundary?.abort(reason);
|
|
649
|
-
}
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
then(onfulfilled, onrejected) {
|
|
653
|
-
return this.#promise().then(onfulfilled, onrejected);
|
|
654
|
-
}
|
|
655
|
-
catch(onrejected) {
|
|
656
|
-
return this.#promise().catch(onrejected);
|
|
657
|
-
}
|
|
658
|
-
finally(onfinally) {
|
|
659
|
-
return this.#promise().finally(onfinally);
|
|
660
|
-
}
|
|
661
|
-
#promise() {
|
|
662
|
-
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
663
|
-
let head = this.#head;
|
|
664
|
-
if (this.#head = null, !head) return reject(/* @__PURE__ */ Error("Cannot read from a consumed render result"));
|
|
665
|
-
let { boundary } = head;
|
|
666
|
-
(boundary.onNext = () => {
|
|
667
|
-
switch (!boundary.count && boundary.flush()) {
|
|
668
|
-
case 2:
|
|
669
|
-
boundary.onNext = NOOP, reject(boundary.signal.reason);
|
|
670
|
-
break;
|
|
671
|
-
case 0:
|
|
672
|
-
resolve(head.consume().flushHTML());
|
|
673
|
-
break;
|
|
674
|
-
}
|
|
675
|
-
})();
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
#read(onWrite, onAbort, onClose) {
|
|
679
|
-
let tick = !0, head = this.#head;
|
|
680
|
-
if (this.#head = null, !head) {
|
|
681
|
-
onAbort(/* @__PURE__ */ Error("Cannot read from a consumed render result"));
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
685
|
-
let status = boundary.flush();
|
|
686
|
-
if (status === 2) tick || offTick(onNext), boundary.onNext = NOOP, onAbort(boundary.signal.reason);
|
|
687
|
-
else if (write || status === 0) {
|
|
688
|
-
let html = (head = head.consume()).flushHTML();
|
|
689
|
-
html && onWrite(html), status === 0 ? (tick || offTick(onNext), onClose()) : tick = !0;
|
|
690
|
-
} else tick && (tick = !1, queueTick(onNext));
|
|
691
|
-
};
|
|
692
|
-
return onNext(), boundary;
|
|
693
|
-
}
|
|
694
|
-
toString() {
|
|
695
|
-
let head = this.#head;
|
|
696
|
-
if (this.#head = null, !head) throw Error("Cannot read from a consumed render result");
|
|
697
|
-
let { boundary } = head;
|
|
698
|
-
switch (boundary.flush()) {
|
|
699
|
-
case 2: throw boundary.signal.reason;
|
|
700
|
-
case 1: throw Error("Cannot consume asynchronous render with 'toString'");
|
|
701
|
-
}
|
|
702
|
-
return head.consume().flushHTML();
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
//#region src/common/attr-tag.ts
|
|
706
|
-
function attrTag(attrs) {
|
|
707
|
-
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
708
|
-
}
|
|
709
|
-
function attrTags(first, attrs) {
|
|
710
|
-
return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
|
|
711
|
-
}
|
|
712
|
-
function* attrTagIterator() {
|
|
713
|
-
yield this, yield* this[rest];
|
|
714
|
-
}
|
|
715
|
-
//#endregion
|
|
716
|
-
//#region src/common/errors.ts
|
|
717
|
-
function _el_read_error() {}
|
|
718
|
-
function _hoist_read_error() {}
|
|
719
|
-
function _assert_hoist(value) {}
|
|
720
|
-
//#endregion
|
|
721
|
-
//#region src/common/helpers.ts
|
|
722
|
-
function stringifyClassObject(name, value) {
|
|
723
|
-
return value ? name : "";
|
|
724
|
-
}
|
|
725
|
-
function stringifyStyleObject(name, value) {
|
|
726
|
-
return value || value === 0 ? name + ":" + value : "";
|
|
727
|
-
}
|
|
728
|
-
function isEventHandler(name) {
|
|
729
|
-
return /^on[A-Z-]/.test(name);
|
|
730
|
-
}
|
|
731
|
-
function getEventHandlerName(name) {
|
|
732
|
-
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
733
|
-
}
|
|
734
|
-
function isVoid(value) {
|
|
735
|
-
return value == null || value === !1;
|
|
736
|
-
}
|
|
737
|
-
function normalizeDynamicRenderer(value) {
|
|
738
|
-
if (value) {
|
|
739
|
-
if (typeof value == "string") return value;
|
|
740
|
-
let normalized = value.content || value.default || value;
|
|
741
|
-
if ("a" in normalized) return normalized;
|
|
357
|
+
}, _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer));
|
|
358
|
+
//#region src/common/attr-tag.ts
|
|
359
|
+
function attrTag(attrs) {
|
|
360
|
+
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
361
|
+
}
|
|
362
|
+
function attrTags(first, attrs) {
|
|
363
|
+
return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
|
|
364
|
+
}
|
|
365
|
+
function* attrTagIterator() {
|
|
366
|
+
yield this, yield* this[rest];
|
|
367
|
+
}
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/common/errors.ts
|
|
370
|
+
function _el_read_error() {}
|
|
371
|
+
function _hoist_read_error() {}
|
|
372
|
+
function _assert_hoist(value) {}
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/common/helpers.ts
|
|
375
|
+
function stringifyClassObject(name, value) {
|
|
376
|
+
return value ? name : "";
|
|
377
|
+
}
|
|
378
|
+
function stringifyStyleObject(name, value) {
|
|
379
|
+
return value || value === 0 ? name + ":" + value : "";
|
|
380
|
+
}
|
|
381
|
+
function isEventHandler(name) {
|
|
382
|
+
return /^on[A-Z-]/.test(name);
|
|
383
|
+
}
|
|
384
|
+
function getEventHandlerName(name) {
|
|
385
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
386
|
+
}
|
|
387
|
+
function isVoid(value) {
|
|
388
|
+
return value == null || value === !1;
|
|
389
|
+
}
|
|
390
|
+
function normalizeDynamicRenderer(value) {
|
|
391
|
+
if (value) {
|
|
392
|
+
if (typeof value == "string") return value;
|
|
393
|
+
let normalized = value.content || value.default || value;
|
|
394
|
+
if ("a" in normalized) return normalized;
|
|
742
395
|
}
|
|
743
396
|
}
|
|
744
397
|
//#endregion
|
|
@@ -794,6 +447,69 @@ function forStepBy(by, index) {
|
|
|
794
447
|
return by ? by(index) : index;
|
|
795
448
|
}
|
|
796
449
|
patchIteratorNext(Generator.prototype), patchIteratorNext(AsyncGenerator.prototype);
|
|
450
|
+
var MutationType = /* @__PURE__ */ function(MutationType) {
|
|
451
|
+
return MutationType[MutationType.call = 0] = "call", MutationType[MutationType.assign = 1] = "assign", MutationType;
|
|
452
|
+
}(MutationType || {}), State$1 = class {
|
|
453
|
+
ids = 0;
|
|
454
|
+
flush = 0;
|
|
455
|
+
registerInstanceId = 0;
|
|
456
|
+
flushed = !1;
|
|
457
|
+
wroteUndefined = !1;
|
|
458
|
+
buf = [];
|
|
459
|
+
strs = /* @__PURE__ */ new Map();
|
|
460
|
+
refs = /* @__PURE__ */ new WeakMap();
|
|
461
|
+
assigned = /* @__PURE__ */ new Set();
|
|
462
|
+
registered = [];
|
|
463
|
+
boundary = void 0;
|
|
464
|
+
mutated = [];
|
|
465
|
+
}, Reference = class {
|
|
466
|
+
registered = null;
|
|
467
|
+
assigns = null;
|
|
468
|
+
constructor(parent, accessor, flush, pos = null, id = null) {
|
|
469
|
+
this.parent = parent, this.accessor = accessor, this.flush = flush, this.pos = pos, this.id = id, this.parent = parent, this.accessor = accessor, this.flush = flush, this.pos = pos, this.id = id;
|
|
470
|
+
}
|
|
471
|
+
}, Serializer = class {
|
|
472
|
+
#state = new State$1();
|
|
473
|
+
get flushed() {
|
|
474
|
+
return this.#state.flushed;
|
|
475
|
+
}
|
|
476
|
+
stringify(val, boundary) {
|
|
477
|
+
try {
|
|
478
|
+
return this.#state.flushed = !1, this.#state.boundary = boundary, writeRoot(this.#state, val);
|
|
479
|
+
} finally {
|
|
480
|
+
this.#state.flush++, this.#state.buf = [];
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
nextId() {
|
|
484
|
+
return nextId(this.#state);
|
|
485
|
+
}
|
|
486
|
+
symbol(id) {
|
|
487
|
+
let symbol = Symbol();
|
|
488
|
+
return this.#state.refs.set(symbol, new Reference(null, null, 0, null, id)), symbol;
|
|
489
|
+
}
|
|
490
|
+
writeCall(value, object, property, spread) {
|
|
491
|
+
let state = this.#state;
|
|
492
|
+
state.mutated.push({
|
|
493
|
+
type: 0,
|
|
494
|
+
value,
|
|
495
|
+
object,
|
|
496
|
+
property,
|
|
497
|
+
spread
|
|
498
|
+
}), state.flushed = !0;
|
|
499
|
+
}
|
|
500
|
+
writeAssign(value, object, property) {
|
|
501
|
+
let state = this.#state;
|
|
502
|
+
state.mutated.push({
|
|
503
|
+
type: 1,
|
|
504
|
+
value,
|
|
505
|
+
object,
|
|
506
|
+
property
|
|
507
|
+
}), state.flushed = !0;
|
|
508
|
+
}
|
|
509
|
+
register(id, val, scope) {
|
|
510
|
+
return register(id, val, scope, scope ? ++this.#state.registerInstanceId : 0);
|
|
511
|
+
}
|
|
512
|
+
};
|
|
797
513
|
function register(id, val, scope, instanceId) {
|
|
798
514
|
return REGISTRY.set(val, {
|
|
799
515
|
id,
|
|
@@ -1263,6 +979,11 @@ function compareRegisteredReferences(a, b) {
|
|
|
1263
979
|
}
|
|
1264
980
|
//#endregion
|
|
1265
981
|
//#region src/html/writer.ts
|
|
982
|
+
var Mark = /* @__PURE__ */ function(Mark) {
|
|
983
|
+
return Mark.Placeholder = "!^", Mark.PlaceholderEnd = "!", Mark.ReorderMarker = "#", Mark;
|
|
984
|
+
}(Mark || {}), RuntimeKey = /* @__PURE__ */ function(RuntimeKey) {
|
|
985
|
+
return RuntimeKey.Walk = ".w", RuntimeKey.Resume = ".r", RuntimeKey.Blocking = ".b", RuntimeKey.Scripts = ".j", RuntimeKey;
|
|
986
|
+
}(RuntimeKey || {});
|
|
1266
987
|
function getChunk() {
|
|
1267
988
|
return $chunk;
|
|
1268
989
|
}
|
|
@@ -1304,8 +1025,10 @@ function withContext(key, value, cb, cbValue) {
|
|
|
1304
1025
|
ctx[kPendingContexts]--, ctx[key] = prev;
|
|
1305
1026
|
}
|
|
1306
1027
|
}
|
|
1307
|
-
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
|
|
1308
|
-
_scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id()
|
|
1028
|
+
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
|
|
1029
|
+
_scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id();
|
|
1030
|
+
let childScope = _scope_with_id(childScopeId);
|
|
1031
|
+
childScope.T = _resume({}, registryId, parentScopeId), nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
|
|
1309
1032
|
}
|
|
1310
1033
|
function _resume(val, id, scopeId) {
|
|
1311
1034
|
return scopeId === void 0 ? register(id, val) : $chunk.boundary.state.serializer.register(id, val, _scope_with_id(scopeId));
|
|
@@ -1528,6 +1251,157 @@ function tryCatch(content, catchContent) {
|
|
|
1528
1251
|
} else catchBoundary.count ? boundary.onNext() : boundary.endAsync();
|
|
1529
1252
|
};
|
|
1530
1253
|
}
|
|
1254
|
+
var State = class {
|
|
1255
|
+
tagId = 1;
|
|
1256
|
+
scopeId = 1;
|
|
1257
|
+
reorderId = 1;
|
|
1258
|
+
lastSerializedScopeId = this.scopeId;
|
|
1259
|
+
hasGlobals = !1;
|
|
1260
|
+
needsMainRuntime = !1;
|
|
1261
|
+
hasMainRuntime = !1;
|
|
1262
|
+
hasReorderRuntime = !1;
|
|
1263
|
+
hasWrittenResume = !1;
|
|
1264
|
+
walkOnNextFlush = !1;
|
|
1265
|
+
trailerHTML = "";
|
|
1266
|
+
resumes = "";
|
|
1267
|
+
nonceAttr = "";
|
|
1268
|
+
serializer = new Serializer();
|
|
1269
|
+
writeReorders = null;
|
|
1270
|
+
scopes = /* @__PURE__ */ new Map();
|
|
1271
|
+
writeScopes = null;
|
|
1272
|
+
ensureReady = null;
|
|
1273
|
+
serializeReason;
|
|
1274
|
+
constructor($global) {
|
|
1275
|
+
this.$global = $global, this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
1276
|
+
}
|
|
1277
|
+
get runtimePrefix() {
|
|
1278
|
+
let { $global } = this;
|
|
1279
|
+
return $global.runtimeId + "." + $global.renderId;
|
|
1280
|
+
}
|
|
1281
|
+
get commentPrefix() {
|
|
1282
|
+
let { $global } = this;
|
|
1283
|
+
return $global.runtimeId + $global.renderId;
|
|
1284
|
+
}
|
|
1285
|
+
reorder(chunk) {
|
|
1286
|
+
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
|
|
1287
|
+
}
|
|
1288
|
+
nextReorderId() {
|
|
1289
|
+
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = this.reorderId++, r = c[n % 54];
|
|
1290
|
+
for (n = n / 54 | 0; n; n >>>= 6) r += c[n & 63];
|
|
1291
|
+
return r;
|
|
1292
|
+
}
|
|
1293
|
+
mark(code, str) {
|
|
1294
|
+
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1295
|
+
}
|
|
1296
|
+
}, Boundary = class extends AbortController {
|
|
1297
|
+
onNext = NOOP$2;
|
|
1298
|
+
count = 0;
|
|
1299
|
+
constructor(state, parent) {
|
|
1300
|
+
super(), this.state = state, this.state = state, this.signal.addEventListener("abort", () => {
|
|
1301
|
+
this.count = 0, this.state = new State(this.state.$global), this.onNext();
|
|
1302
|
+
}), parent && (parent.aborted ? this.abort(parent.reason) : parent.addEventListener("abort", () => {
|
|
1303
|
+
this.abort(parent.reason);
|
|
1304
|
+
}));
|
|
1305
|
+
}
|
|
1306
|
+
flush() {
|
|
1307
|
+
return this.signal.aborted || flushSerializer(this), this.count ? 1 : this.signal.aborted ? 2 : 0;
|
|
1308
|
+
}
|
|
1309
|
+
startAsync() {
|
|
1310
|
+
this.signal.aborted || this.count++;
|
|
1311
|
+
}
|
|
1312
|
+
endAsync(chunk) {
|
|
1313
|
+
!this.signal.aborted && this.count && (this.count--, chunk?.reorderId && this.state.reorder(chunk), this.onNext());
|
|
1314
|
+
}
|
|
1315
|
+
}, Chunk = class {
|
|
1316
|
+
html = "";
|
|
1317
|
+
scripts = "";
|
|
1318
|
+
effects = "";
|
|
1319
|
+
lastEffect = "";
|
|
1320
|
+
async = !1;
|
|
1321
|
+
consumed = !1;
|
|
1322
|
+
needsWalk = !1;
|
|
1323
|
+
reorderId = null;
|
|
1324
|
+
placeholderBody = null;
|
|
1325
|
+
placeholderRender = null;
|
|
1326
|
+
placeholderBranchId = null;
|
|
1327
|
+
constructor(boundary, next, context) {
|
|
1328
|
+
this.boundary = boundary, this.next = next, this.context = context, this.boundary = boundary, this.next = next, this.context = context;
|
|
1329
|
+
}
|
|
1330
|
+
writeHTML(html) {
|
|
1331
|
+
this.html += html;
|
|
1332
|
+
}
|
|
1333
|
+
writeEffect(scopeId, registryId) {
|
|
1334
|
+
this.lastEffect === registryId ? this.effects += " " + scopeId : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1335
|
+
}
|
|
1336
|
+
writeScript(script) {
|
|
1337
|
+
this.scripts = concatScripts(this.scripts, script);
|
|
1338
|
+
}
|
|
1339
|
+
append(chunk) {
|
|
1340
|
+
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect;
|
|
1341
|
+
}
|
|
1342
|
+
flushPlaceholder() {
|
|
1343
|
+
if (this.placeholderBody) {
|
|
1344
|
+
let body = this.placeholderBody.consume();
|
|
1345
|
+
if (body.async) {
|
|
1346
|
+
let { state } = this.boundary, reorderId = body.reorderId = this.placeholderBranchId ? this.placeholderBranchId + "" : state.nextReorderId();
|
|
1347
|
+
this.placeholderBranchId = null, this.writeHTML(state.mark("!^", reorderId));
|
|
1348
|
+
let after = this.render(this.placeholderRender);
|
|
1349
|
+
after !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), after.writeHTML(state.mark("!", reorderId)), state.reorder(body);
|
|
1350
|
+
} else body.next = this.next, this.next = body;
|
|
1351
|
+
this.placeholderRender = this.placeholderBody = null;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
consume() {
|
|
1355
|
+
let cur = this, needsWalk = cur.needsWalk;
|
|
1356
|
+
if (cur.next && !cur.async) {
|
|
1357
|
+
let html = "", effects = "", scripts = "", lastEffect = "";
|
|
1358
|
+
do
|
|
1359
|
+
cur.flushPlaceholder(), needsWalk ||= cur.needsWalk, html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
|
|
1360
|
+
while (cur.next && !cur.async);
|
|
1361
|
+
cur.needsWalk = needsWalk, cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
|
|
1362
|
+
}
|
|
1363
|
+
return cur;
|
|
1364
|
+
}
|
|
1365
|
+
render(content, val) {
|
|
1366
|
+
let prev = $chunk;
|
|
1367
|
+
$chunk = this;
|
|
1368
|
+
try {
|
|
1369
|
+
return content(val), $chunk;
|
|
1370
|
+
} catch (err) {
|
|
1371
|
+
return this.boundary.abort(err), this;
|
|
1372
|
+
} finally {
|
|
1373
|
+
$chunk = prev;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
flushScript() {
|
|
1377
|
+
let { boundary, effects } = this, { state } = boundary, { $global, runtimePrefix, nonceAttr } = state, { html, scripts } = this, needsWalk = state.walkOnNextFlush;
|
|
1378
|
+
if (needsWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[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,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}}),self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), state.ensureReady && state.hasMainRuntime) {
|
|
1379
|
+
let first = !0;
|
|
1380
|
+
for (let id in state.ensureReady) state.ensureReady[id] && (state.ensureReady[id] = 0, scripts = first ? concatScripts(scripts, "(" + runtimePrefix + ".b={})" + toAccess(toObjectKey(id)) + "=1") : concatScripts(scripts, runtimePrefix + ".b" + toAccess(toObjectKey(id)) + "=1")), first = !1;
|
|
1381
|
+
}
|
|
1382
|
+
if (effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\""), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]"))), state.writeReorders) {
|
|
1383
|
+
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", 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.d.head.append(e.d.querySelector(\"style[\"+e.i+\"]\")||\"\"),e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
1384
|
+
for (let reorderedChunk of state.writeReorders) {
|
|
1385
|
+
let { reorderId } = reorderedChunk, reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1386
|
+
for (reorderedChunk.reorderId = null;;) {
|
|
1387
|
+
cur.flushPlaceholder();
|
|
1388
|
+
let { next } = cur;
|
|
1389
|
+
if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next) cur = next;
|
|
1390
|
+
else break;
|
|
1391
|
+
}
|
|
1392
|
+
reorderEffects && (state.hasWrittenResume || (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[]")), reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")), scripts = concatScripts(scripts, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1393
|
+
}
|
|
1394
|
+
state.writeReorders = null;
|
|
1395
|
+
}
|
|
1396
|
+
return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
|
|
1397
|
+
}
|
|
1398
|
+
flushHTML() {
|
|
1399
|
+
let { boundary } = this, { state } = boundary;
|
|
1400
|
+
this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
|
|
1401
|
+
let { scripts } = this, { $global, nonceAttr } = state, { __flush__ } = $global, { html } = this;
|
|
1402
|
+
return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), boundary.count || (html += state.trailerHTML), html;
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1531
1405
|
function flushSerializer(boundary) {
|
|
1532
1406
|
let { state } = boundary, { writeScopes, serializer } = state, { flushed } = serializer;
|
|
1533
1407
|
if (writeScopes || flushed) {
|
|
@@ -1768,6 +1642,138 @@ function getDefaultRenderId(template) {
|
|
|
1768
1642
|
}
|
|
1769
1643
|
return "_";
|
|
1770
1644
|
}
|
|
1645
|
+
var ServerRendered = class {
|
|
1646
|
+
#head;
|
|
1647
|
+
#cachedPromise = null;
|
|
1648
|
+
constructor(head) {
|
|
1649
|
+
this.#head = head;
|
|
1650
|
+
}
|
|
1651
|
+
[Symbol.asyncIterator]() {
|
|
1652
|
+
let resolve, reject, value = "", done = !1, aborted = !1, reason, boundary = this.#read((html) => {
|
|
1653
|
+
value += html, resolve && (resolve({
|
|
1654
|
+
value,
|
|
1655
|
+
done
|
|
1656
|
+
}), value = "");
|
|
1657
|
+
}, (err) => {
|
|
1658
|
+
aborted = !0, reason = err, reject && reject(err);
|
|
1659
|
+
}, () => {
|
|
1660
|
+
done = !0, resolve && (resolve({
|
|
1661
|
+
value,
|
|
1662
|
+
done: !value
|
|
1663
|
+
}), value = "");
|
|
1664
|
+
});
|
|
1665
|
+
return {
|
|
1666
|
+
next() {
|
|
1667
|
+
if (aborted) return Promise.reject(reason);
|
|
1668
|
+
if (value) {
|
|
1669
|
+
let result = {
|
|
1670
|
+
value,
|
|
1671
|
+
done: !1
|
|
1672
|
+
};
|
|
1673
|
+
return value = "", Promise.resolve(result);
|
|
1674
|
+
} else if (done) return Promise.resolve({
|
|
1675
|
+
value: "",
|
|
1676
|
+
done
|
|
1677
|
+
});
|
|
1678
|
+
else return new Promise(exec);
|
|
1679
|
+
},
|
|
1680
|
+
throw(error) {
|
|
1681
|
+
return done || aborted || boundary?.abort(error), Promise.resolve({
|
|
1682
|
+
value: "",
|
|
1683
|
+
done: !0
|
|
1684
|
+
});
|
|
1685
|
+
},
|
|
1686
|
+
return(value) {
|
|
1687
|
+
return done || aborted || boundary?.abort(/* @__PURE__ */ Error("Iterator returned before consumed.")), Promise.resolve({
|
|
1688
|
+
value,
|
|
1689
|
+
done: !0
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
function exec(_resolve, _reject) {
|
|
1694
|
+
resolve = _resolve, reject = _reject;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
pipe(stream) {
|
|
1698
|
+
this.#read((html) => {
|
|
1699
|
+
stream.write(html);
|
|
1700
|
+
}, (err) => {
|
|
1701
|
+
let socket = "socket" in stream && stream.socket;
|
|
1702
|
+
if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err)) throw err;
|
|
1703
|
+
}, () => {
|
|
1704
|
+
stream.end();
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
toReadable() {
|
|
1708
|
+
let cancelled = !1, boundary, encoder = new TextEncoder();
|
|
1709
|
+
return new ReadableStream({
|
|
1710
|
+
start: (ctrl) => {
|
|
1711
|
+
boundary = this.#read((html) => {
|
|
1712
|
+
ctrl.enqueue(encoder.encode(html));
|
|
1713
|
+
}, (err) => {
|
|
1714
|
+
boundary = void 0, cancelled || ctrl.error(err);
|
|
1715
|
+
}, () => {
|
|
1716
|
+
boundary = void 0, ctrl.close();
|
|
1717
|
+
});
|
|
1718
|
+
},
|
|
1719
|
+
cancel: (reason) => {
|
|
1720
|
+
cancelled = !0, boundary?.abort(reason);
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
then(onfulfilled, onrejected) {
|
|
1725
|
+
return this.#promise().then(onfulfilled, onrejected);
|
|
1726
|
+
}
|
|
1727
|
+
catch(onrejected) {
|
|
1728
|
+
return this.#promise().catch(onrejected);
|
|
1729
|
+
}
|
|
1730
|
+
finally(onfinally) {
|
|
1731
|
+
return this.#promise().finally(onfinally);
|
|
1732
|
+
}
|
|
1733
|
+
#promise() {
|
|
1734
|
+
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
1735
|
+
let head = this.#head;
|
|
1736
|
+
if (this.#head = null, !head) return reject(/* @__PURE__ */ Error("Cannot read from a consumed render result"));
|
|
1737
|
+
let { boundary } = head;
|
|
1738
|
+
(boundary.onNext = () => {
|
|
1739
|
+
switch (!boundary.count && boundary.flush()) {
|
|
1740
|
+
case 2:
|
|
1741
|
+
boundary.onNext = NOOP, reject(boundary.signal.reason);
|
|
1742
|
+
break;
|
|
1743
|
+
case 0:
|
|
1744
|
+
resolve(head.consume().flushHTML());
|
|
1745
|
+
break;
|
|
1746
|
+
}
|
|
1747
|
+
})();
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
#read(onWrite, onAbort, onClose) {
|
|
1751
|
+
let tick = !0, head = this.#head;
|
|
1752
|
+
if (this.#head = null, !head) {
|
|
1753
|
+
onAbort(/* @__PURE__ */ Error("Cannot read from a consumed render result"));
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1756
|
+
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
1757
|
+
let status = boundary.flush();
|
|
1758
|
+
if (status === 2) tick || offTick(onNext), boundary.onNext = NOOP, onAbort(boundary.signal.reason);
|
|
1759
|
+
else if (write || status === 0) {
|
|
1760
|
+
let html = (head = head.consume()).flushHTML();
|
|
1761
|
+
html && onWrite(html), status === 0 ? (tick || offTick(onNext), onClose()) : tick = !0;
|
|
1762
|
+
} else tick && (tick = !1, queueTick(onNext));
|
|
1763
|
+
};
|
|
1764
|
+
return onNext(), boundary;
|
|
1765
|
+
}
|
|
1766
|
+
toString() {
|
|
1767
|
+
let head = this.#head;
|
|
1768
|
+
if (this.#head = null, !head) throw Error("Cannot read from a consumed render result");
|
|
1769
|
+
let { boundary } = head;
|
|
1770
|
+
switch (boundary.flush()) {
|
|
1771
|
+
case 2: throw boundary.signal.reason;
|
|
1772
|
+
case 1: throw Error("Cannot consume asynchronous render with 'toString'");
|
|
1773
|
+
}
|
|
1774
|
+
return head.consume().flushHTML();
|
|
1775
|
+
}
|
|
1776
|
+
};
|
|
1771
1777
|
function NOOP() {}
|
|
1772
1778
|
//#endregion
|
|
1773
1779
|
export { $global, _assert_hoist, _attr, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _subscribe, _template, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil };
|