marko 6.4.5 → 6.4.6
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/errors.d.ts +2 -1
- package/dist/common/helpers.d.ts +7 -7
- package/dist/debug/dom/catch.feat.js +3 -3
- package/dist/debug/dom/catch.feat.mjs +3 -3
- 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 +5 -5
- package/dist/debug/dom/controllable.feat.mjs +5 -5
- 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-CUxvM4i9.js → dom-CNgQ6lj9.js} +52 -52
- package/dist/debug/{dom-BeY1nGUb.mjs → dom-o9jQjchF.mjs} +43 -43
- package/dist/debug/dom.js +4 -4
- package/dist/debug/dom.mjs +4 -4
- package/dist/debug/html.js +721 -652
- package/dist/debug/html.mjs +721 -652
- package/dist/dom/catch.feat.js +4 -4
- package/dist/dom/catch.feat.mjs +3 -3
- package/dist/dom/control-flow.d.ts +2 -2
- 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.d.ts +4 -4
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +2 -2
- package/dist/dom/dom.d.ts +5 -5
- 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 +2 -2
- 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 +1 -1
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/signals.d.ts +4 -1
- package/dist/{dom-Diu8MpmL.js → dom-60R4bRWD.js} +40 -40
- package/dist/{dom-DefWmvQB.mjs → dom-Ci2W4l1P.mjs} +33 -33
- package/dist/dom.js +6 -6
- package/dist/dom.mjs +4 -4
- package/dist/html/assets.d.ts +1 -1
- package/dist/html/compat.d.ts +2 -1
- package/dist/html/control-flow.d.ts +20 -0
- package/dist/html/serializer.d.ts +63 -16
- package/dist/html/writer.d.ts +47 -35
- package/dist/html.d.ts +2 -1
- package/dist/html.js +517 -467
- package/dist/html.mjs +517 -467
- package/dist/translator/core/for.d.ts +0 -4
- package/dist/translator/core/return.d.ts +0 -3
- package/dist/translator/core/style.d.ts +2 -2
- package/dist/translator/index.js +7934 -7978
- package/dist/translator/util/analyze-errors.d.ts +2 -1
- package/dist/translator/util/assert.d.ts +8 -1
- package/dist/translator/util/bindings.d.ts +13 -9
- package/dist/translator/util/body-to-text.d.ts +9 -0
- package/dist/translator/util/branch-tag.d.ts +10 -3
- package/dist/translator/util/build-string-expression.d.ts +4 -0
- package/dist/translator/util/content-derives.d.ts +7 -0
- package/dist/translator/util/entry-builder.d.ts +6 -2
- package/dist/translator/util/finalize-references.d.ts +3 -2
- package/dist/translator/util/generate-uid.d.ts +3 -2
- package/dist/translator/util/get-root.d.ts +3 -3
- package/dist/translator/util/get-tag-name.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +10 -8
- package/dist/translator/util/module-read.d.ts +0 -3
- package/dist/translator/util/module-registrations.d.ts +44 -0
- package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
- package/dist/translator/util/optional.d.ts +6 -1
- package/dist/translator/util/params-tree.d.ts +18 -0
- package/dist/translator/util/reasons.d.ts +10 -8
- package/dist/translator/util/references.d.ts +21 -27
- package/dist/translator/util/runtime.d.ts +0 -12
- package/dist/translator/util/scope-accessor.d.ts +0 -1
- package/dist/translator/util/scope-read.d.ts +3 -0
- package/dist/translator/util/section-renderer.d.ts +4 -0
- package/dist/translator/util/sections.d.ts +16 -16
- package/dist/translator/util/setup-work.d.ts +2 -1
- package/dist/translator/util/signals.d.ts +14 -12
- package/dist/translator/util/simplify-fn.d.ts +1 -0
- package/dist/translator/util/slots.d.ts +2 -2
- package/dist/translator/util/solve-reasons.d.ts +1 -3
- package/dist/translator/util/sources.d.ts +2 -1
- package/dist/translator/util/statement-tag.d.ts +2 -0
- package/dist/translator/util/static-text.d.ts +2 -1
- package/dist/translator/util/structure.d.ts +0 -10
- package/dist/translator/util/tag-facts.d.ts +8 -1
- package/dist/translator/util/tag-import.d.ts +20 -0
- package/dist/translator/util/tag-name-type.d.ts +9 -2
- package/dist/translator/util/to-only-or-block.d.ts +3 -0
- package/dist/translator/util/to-property-name.d.ts +2 -0
- package/dist/translator/util/translate-attrs.d.ts +7 -5
- package/dist/translator/util/translate-var.d.ts +2 -0
- package/dist/translator/util/traverse.d.ts +1 -2
- package/dist/translator/util/visitors.d.ts +4 -1
- package/dist/translator/util/with-previous-location.d.ts +1 -1
- package/dist/translator/util/write-guard.d.ts +2 -2
- package/dist/translator/util/writer.d.ts +1 -2
- package/dist/translator/visitors/export-declaration.d.ts +2 -3
- package/dist/translator/visitors/function.d.ts +0 -35
- package/dist/translator/visitors/import-declaration.d.ts +0 -16
- package/dist/translator/visitors/placeholder.d.ts +2 -1
- package/dist/translator/visitors/program/html.d.ts +0 -1
- package/dist/translator/visitors/program/index.d.ts +4 -5
- package/dist/translator/visitors/tag/custom-tag.d.ts +0 -14
- package/dist/translator/visitors/tag/native-tag.d.ts +3 -12
- package/package.json +3 -3
- package/dist/translator/util/binding-has-prop.d.ts +0 -8
- package/dist/translator/util/binding-prop-tree.d.ts +0 -18
- package/dist/translator/util/body-to-text-literal.d.ts +0 -9
- package/dist/translator/util/import-reference.d.ts +0 -3
- package/dist/translator/util/normalize-string-expression.d.ts +0 -4
- package/dist/translator/util/plugin-hooks.d.ts +0 -4
- package/dist/translator/util/resolve-relative-to-entry.d.ts +0 -2
- package/dist/translator/util/set-tag-derived-from.d.ts +0 -7
- package/dist/translator/util/to-first-expression-or-block.d.ts +0 -2
- package/dist/translator/util/to-first-statement-or-block.d.ts +0 -2
package/dist/html.mjs
CHANGED
|
@@ -244,10 +244,10 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
244
244
|
if (ch === "\0") return "\\x00";
|
|
245
245
|
let code = ch.charCodeAt(0);
|
|
246
246
|
return code >= 55296 && code <= 57343 ? "\\u" + code.toString(16).padStart(4, "0") : match;
|
|
247
|
-
}, 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"),
|
|
248
|
-
let { state } = $chunk.boundary, target = $chunk.
|
|
249
|
-
return state.
|
|
250
|
-
},
|
|
247
|
+
}, 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) => {
|
|
248
|
+
let { state } = $chunk.boundary, target = $chunk.channel, scope = scopeWithId(state, scopeId);
|
|
249
|
+
return state.needsWalkerRuntime = !0, countResumeWrite($chunk), writeAsyncVisits($chunk), Object.assign(scope, partialScope), state.queueScope(target, scopeId, partialScope), scope;
|
|
250
|
+
}, ALL_GROUPS = 715827883, NOOP$2 = () => {}, 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)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard, tagVar) => {
|
|
251
251
|
let shouldResume = markerGuard !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
252
252
|
if (typeof renderer == "string") {
|
|
253
253
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
@@ -267,7 +267,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
267
267
|
} else {
|
|
268
268
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
269
269
|
if (renderer) try {
|
|
270
|
-
return _set_scope_reason(shouldResume ?
|
|
270
|
+
return _set_scope_reason(shouldResume ? ALL_GROUPS : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
271
271
|
...inputOrArgs,
|
|
272
272
|
content
|
|
273
273
|
} : inputOrArgs);
|
|
@@ -280,9 +280,9 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
280
280
|
}
|
|
281
281
|
return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: rendererKey(renderer) }) : _scope_id(), result;
|
|
282
282
|
}, patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
|
|
283
|
-
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs,
|
|
283
|
+
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, markerGuard, tagVar) => {
|
|
284
284
|
let patched = patch(tag, scopeId, accessor);
|
|
285
|
-
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs,
|
|
285
|
+
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, markerGuard, tagVar);
|
|
286
286
|
};
|
|
287
287
|
})(_dynamic_tag), CONSUMED_RESULT_MESSAGE = "Cannot read from a consumed render result", _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kHead = Symbol(), SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
288
288
|
$global,
|
|
@@ -320,7 +320,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
320
320
|
return function() {
|
|
321
321
|
let compatRegistered = COMPAT_REGISTRY.get(this);
|
|
322
322
|
if (!compatRegistered) {
|
|
323
|
-
let registered =
|
|
323
|
+
let registered = REGISTRY.get(this);
|
|
324
324
|
if (registered) {
|
|
325
325
|
let scopeId = registered.scope ? getScopeId(registered.scope) : void 0;
|
|
326
326
|
scopeId !== void 0 && _script(scopeId, SET_SCOPE_REGISTER_ID), COMPAT_REGISTRY.set(this, compatRegistered = [registered.id, scopeId]);
|
|
@@ -352,7 +352,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
352
352
|
flushScript(chunk, reorders) {
|
|
353
353
|
let { boundary } = chunk, { state } = boundary, html = "", scripts = "";
|
|
354
354
|
if (reorders) for (let reorder of reorders) state.reorder(reorder);
|
|
355
|
-
if (boundary.flush() === 0 && ({html, scripts} = chunk.
|
|
355
|
+
if (boundary.flush() === 0 && ({html, scripts} = chunk.flush(boundary)), boundary.aborted) throw boundary.reason;
|
|
356
356
|
if (boundary.count) throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
357
357
|
return {
|
|
358
358
|
html,
|
|
@@ -379,7 +379,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
379
379
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
380
380
|
}
|
|
381
381
|
}), head.render(() => {
|
|
382
|
-
_set_scope_reason(willRerender ?
|
|
382
|
+
_set_scope_reason(willRerender ? ALL_GROUPS : 0);
|
|
383
383
|
try {
|
|
384
384
|
renderer(normalizedInput);
|
|
385
385
|
} finally {
|
|
@@ -412,7 +412,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
412
412
|
registerClassFunctions(input) {
|
|
413
413
|
for (let key in input) {
|
|
414
414
|
let value = input[key];
|
|
415
|
-
typeof value == "function" && !
|
|
415
|
+
typeof value == "function" && !REGISTRY.has(value) && register(RENDER_BODY_ID, value);
|
|
416
416
|
}
|
|
417
417
|
},
|
|
418
418
|
registerClassFunction($global, id, fn, hostId) {
|
|
@@ -439,10 +439,10 @@ function* attrTagIterator() {
|
|
|
439
439
|
}
|
|
440
440
|
//#endregion
|
|
441
441
|
//#region src/common/helpers.ts
|
|
442
|
-
function
|
|
442
|
+
function stringifyClassEntry(name, value) {
|
|
443
443
|
return value ? name : "";
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function stringifyStyleEntry(name, value) {
|
|
446
446
|
return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
|
|
447
447
|
}
|
|
448
448
|
function escapeStyleAttr(str) {
|
|
@@ -456,17 +456,17 @@ function escapeStyleValue(str) {
|
|
|
456
456
|
function isEventHandler(name) {
|
|
457
457
|
return /^on[A-Z-]/.test(name);
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function getEventType(name) {
|
|
460
460
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
461
461
|
}
|
|
462
462
|
function hasKeys(obj) {
|
|
463
463
|
for (let _ in obj) return !0;
|
|
464
464
|
return !1;
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function isNullishOrFalse(value) {
|
|
467
467
|
return value == null || value === !1;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function isNotNullishOrFalse(value) {
|
|
470
470
|
return value != null && value !== !1;
|
|
471
471
|
}
|
|
472
472
|
function isPromise(value) {
|
|
@@ -486,25 +486,6 @@ function _el_read_error() {}
|
|
|
486
486
|
function _hoist_read_error() {}
|
|
487
487
|
function _assert_hoist(value) {}
|
|
488
488
|
//#endregion
|
|
489
|
-
//#region src/common/for.ts
|
|
490
|
-
function forIn(obj, cb) {
|
|
491
|
-
for (let key in obj) cb(key, obj[key]);
|
|
492
|
-
}
|
|
493
|
-
function forOf(list, cb) {
|
|
494
|
-
if (list) {
|
|
495
|
-
let i = 0;
|
|
496
|
-
for (let item of list) cb(item, i++);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
function forTo(to, from, step, cb) {
|
|
500
|
-
let start = from || 0, delta = step || 1;
|
|
501
|
-
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
502
|
-
}
|
|
503
|
-
function forUntil(until, from, step, cb) {
|
|
504
|
-
let start = from || 0, delta = step || 1;
|
|
505
|
-
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
506
|
-
}
|
|
507
|
-
//#endregion
|
|
508
489
|
//#region src/common/opt.ts
|
|
509
490
|
function reduce(opt, cb, acc) {
|
|
510
491
|
if (opt) {
|
|
@@ -534,14 +515,44 @@ var State$1 = class {
|
|
|
534
515
|
buf = [];
|
|
535
516
|
strs = /* @__PURE__ */ new Map();
|
|
536
517
|
refs = /* @__PURE__ */ new WeakMap();
|
|
537
|
-
|
|
518
|
+
deferredRefs = /* @__PURE__ */ new Set();
|
|
538
519
|
boundary;
|
|
539
520
|
channel = void 0;
|
|
540
521
|
channelDeps = null;
|
|
541
|
-
|
|
522
|
+
queuedCalls = [];
|
|
523
|
+
queuedReadyCalls = [];
|
|
524
|
+
scopeRef(scope, scopeId) {
|
|
525
|
+
return this.refs.get(scope) || newScopeReference(this, scope, scopeId);
|
|
526
|
+
}
|
|
527
|
+
writeScopeProps(props, ref) {
|
|
528
|
+
return writeObjectProps(this, props, ref);
|
|
529
|
+
}
|
|
530
|
+
scopesCursor(scopeId) {
|
|
531
|
+
return scopeId + ",";
|
|
532
|
+
}
|
|
533
|
+
writeTrailing(scopesIndex) {
|
|
534
|
+
let { buf } = this;
|
|
535
|
+
return ~scopesIndex && (buf[scopesIndex] = "_([" + buf[scopesIndex], buf.push("])")), writeDeferred(this), ",0)";
|
|
536
|
+
}
|
|
537
|
+
wrapPayload(result, extras) {
|
|
538
|
+
let arrow = this.wroteUndefined ? "(_,$)=>" : "_=>";
|
|
539
|
+
return this.wroteUndefined = !1, extras ? arrow + result : arrow + "[" + result + "]";
|
|
540
|
+
}
|
|
541
|
+
writeScopedRegistration(val, parent, accessor, registered) {
|
|
542
|
+
let ref = new Reference(parent, accessor, this.flushId, this.buf.length);
|
|
543
|
+
ref.channel = this.channel, this.refs.set(val, ref);
|
|
544
|
+
let scope = registered.scope, scopeId = scope[K_SCOPE_ID];
|
|
545
|
+
trackScope(this, scope, scopeId);
|
|
546
|
+
let locals = registered.locals?.(this.boundary.state.scope);
|
|
547
|
+
if (locals) {
|
|
548
|
+
this.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
549
|
+
for (let local of locals) this.buf.push(","), writePlainObject(this, local, newArgReference(this, ref, local));
|
|
550
|
+
} else this.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
551
|
+
this.buf.push(")");
|
|
552
|
+
}
|
|
542
553
|
}, Reference = class {
|
|
543
554
|
assignments = null;
|
|
544
|
-
|
|
555
|
+
deferredMembers = null;
|
|
545
556
|
scopeId = void 0;
|
|
546
557
|
channel = void 0;
|
|
547
558
|
parent;
|
|
@@ -553,136 +564,121 @@ var State$1 = class {
|
|
|
553
564
|
constructor(parent, accessor, flushId, pos = null, id = null) {
|
|
554
565
|
this.parent = parent, this.accessor = accessor, this.flushId = flushId, this.pos = pos, this.id = id;
|
|
555
566
|
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
return
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
stringifyScopes(flushes, boundary, channel) {
|
|
565
|
-
try {
|
|
566
|
-
return this.#state.boundary = boundary, this.#state.channel = channel, writeScopesRoot(this.#state, flushes);
|
|
567
|
-
} catch (err) {
|
|
568
|
-
return abortRender(boundary, err), "";
|
|
569
|
-
} finally {
|
|
570
|
-
this.#state.flushId++, this.#state.buf = [];
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
written(val) {
|
|
574
|
-
return this.#state.refs.has(val);
|
|
575
|
-
}
|
|
576
|
-
takeChannelDeps() {
|
|
577
|
-
let deps = this.#state.channelDeps;
|
|
578
|
-
return this.#state.channelDeps = null, deps;
|
|
579
|
-
}
|
|
580
|
-
writeCall(value, object, property, channel) {
|
|
581
|
-
this.#state.mutated.push({
|
|
582
|
-
value,
|
|
583
|
-
object,
|
|
584
|
-
property,
|
|
585
|
-
channel
|
|
586
|
-
});
|
|
567
|
+
};
|
|
568
|
+
function stringifyScopes(state, flushes, boundary, channel) {
|
|
569
|
+
try {
|
|
570
|
+
return state.boundary = boundary, state.channel = channel, writeScopesRoot(state, flushes);
|
|
571
|
+
} catch (err) {
|
|
572
|
+
return abortRender(boundary, err), "";
|
|
573
|
+
} finally {
|
|
574
|
+
state.flushId++, state.buf = [];
|
|
587
575
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
576
|
+
}
|
|
577
|
+
function pendingReadyChannel(state) {
|
|
578
|
+
let calls = state.queuedReadyCalls;
|
|
579
|
+
return calls.length ? calls[0].channel : void 0;
|
|
580
|
+
}
|
|
581
|
+
function takeChannelDeps(state) {
|
|
582
|
+
let deps = state.channelDeps;
|
|
583
|
+
return state.channelDeps = null, deps;
|
|
584
|
+
}
|
|
585
|
+
function queueCall(state, value, object, method, channel) {
|
|
586
|
+
(channel?.readyId ? state.queuedReadyCalls : state.queuedCalls).push({
|
|
587
|
+
method,
|
|
588
|
+
value,
|
|
589
|
+
object,
|
|
590
|
+
channel,
|
|
591
|
+
valueId: null
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
function dropQueuedCall(state, value, object, method, channel) {
|
|
595
|
+
let queuedCalls = channel?.readyId ? state.queuedReadyCalls : state.queuedCalls;
|
|
596
|
+
for (let i = 0; i < queuedCalls.length; i++) {
|
|
597
|
+
let call = queuedCalls[i];
|
|
598
|
+
if (call.value === value && call.object === object && call.method === method) return queuedCalls.splice(i, 1), !0;
|
|
595
599
|
}
|
|
596
|
-
|
|
597
|
-
|
|
600
|
+
return !1;
|
|
601
|
+
}
|
|
602
|
+
function register(id, val, scope, locals, access = "_._" + toAccess(toObjectKey(id))) {
|
|
598
603
|
return REGISTRY.set(val, {
|
|
599
604
|
id,
|
|
600
605
|
scope,
|
|
601
606
|
locals,
|
|
602
|
-
access
|
|
607
|
+
access
|
|
603
608
|
}), val;
|
|
604
609
|
}
|
|
605
|
-
function getRegistered(val) {
|
|
606
|
-
let registered = REGISTRY.get(val);
|
|
607
|
-
if (registered) return {
|
|
608
|
-
id: registered.id,
|
|
609
|
-
scope: registered.scope
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
610
|
function writeScopesRoot(state, flushes) {
|
|
613
|
-
let { buf } = state, nextSlotId = -1,
|
|
611
|
+
let { buf } = state, nextSlotId = -1, scopesIndex = -1;
|
|
614
612
|
for (let flush of flushes) {
|
|
615
|
-
let scopeId = flush[0], scope = flush[1], ref = state.
|
|
616
|
-
|
|
613
|
+
let scopeId = flush[0], scope = flush[1], ref = state.scopeRef(scope, scopeId), openIndex = buf.push("") - 1;
|
|
614
|
+
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();
|
|
617
615
|
}
|
|
618
616
|
let extras = "";
|
|
619
|
-
(state.
|
|
617
|
+
(state.deferredRefs.size || hasChannelCalls(state)) && (extras = state.writeTrailing(scopesIndex));
|
|
620
618
|
let result = extras && "(";
|
|
621
619
|
for (let chunk of buf) result += chunk;
|
|
622
|
-
|
|
623
|
-
let arrow = state.wroteUndefined ? "(_,$)=>" : "_=>";
|
|
624
|
-
return state.wroteUndefined = !1, extras ? arrow + result : arrow + "[" + result + "]";
|
|
620
|
+
return result += extras, result ? state.wrapPayload(result, extras) : "";
|
|
625
621
|
}
|
|
626
|
-
function
|
|
622
|
+
function writeDeferred(state) {
|
|
627
623
|
let sep = state.buf.length ? "," : "";
|
|
628
|
-
if (state.
|
|
629
|
-
let pending = state.
|
|
630
|
-
state.
|
|
624
|
+
if (state.deferredRefs.size) {
|
|
625
|
+
let pending = state.deferredRefs;
|
|
626
|
+
state.deferredRefs = /* @__PURE__ */ new Set();
|
|
631
627
|
let buf = "", hasCalls = !1;
|
|
632
|
-
for (let ref of pending) ref.assignments && (buf += sep + assignmentsToString(ref.assignments, ref.id), ref.assignments = null, sep = ","), hasCalls ||= ref.
|
|
633
|
-
if (buf && state.buf.push(buf), hasCalls) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
state.buf.push((state.buf.length ? "," : "") + ref.id + "." + method + "(");
|
|
637
|
-
for (let a = 0; a < args.length; a++) a && state.buf.push(","), writeCallArg(state, args[a]);
|
|
638
|
-
state.buf.push(")");
|
|
639
|
-
}
|
|
640
|
-
ref.calls = null;
|
|
641
|
-
}
|
|
628
|
+
for (let ref of pending) ref.assignments && (buf += sep + assignmentsToString(ref.assignments, ref.id), ref.assignments = null, sep = ","), hasCalls ||= ref.deferredMembers !== null;
|
|
629
|
+
if (buf && state.buf.push(buf), hasCalls) for (let ref of pending) {
|
|
630
|
+
let members = ref.deferredMembers;
|
|
631
|
+
members && (writeDeferredMembers(state, ref.id, members), ref.deferredMembers = null);
|
|
642
632
|
}
|
|
643
633
|
}
|
|
644
|
-
|
|
634
|
+
let readyId = state.channel?.readyId, calls = state.queuedCalls;
|
|
635
|
+
if (readyId) {
|
|
636
|
+
calls = [];
|
|
645
637
|
let remaining = [];
|
|
646
|
-
for (let
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
state
|
|
638
|
+
for (let call of state.queuedReadyCalls) (call.channel.readyId === readyId ? calls : remaining).push(call);
|
|
639
|
+
state.queuedReadyCalls = remaining;
|
|
640
|
+
} else calls.length && (state.queuedCalls = []);
|
|
641
|
+
for (let call of calls) {
|
|
642
|
+
let objectStartIndex = state.buf.push(state.buf.length === 0 ? "" : ",");
|
|
643
|
+
if (writeProp(state, call.object, null, "")) {
|
|
644
|
+
let objectRef = state.refs.get(call.object);
|
|
645
|
+
!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(")"));
|
|
646
|
+
} else state.buf.push("void 0");
|
|
647
|
+
state.buf.push("." + call.method + "("), call.value !== void 0 && writeCallArg(state, call.value, call.valueId), state.buf.push(")");
|
|
648
|
+
}
|
|
649
|
+
state.deferredRefs.size && writeDeferred(state);
|
|
650
|
+
}
|
|
651
|
+
function writeDeferredMembers(state, id, { collection, first, rest }) {
|
|
652
|
+
if (collection instanceof Map) {
|
|
653
|
+
writeDeferredEntry(state, id, first);
|
|
654
|
+
for (let entry of rest) writeDeferredEntry(state, id, entry);
|
|
655
|
+
} else {
|
|
656
|
+
writeDeferredMember(state, id, first);
|
|
657
|
+
for (let member of rest) writeDeferredMember(state, id, member);
|
|
666
658
|
}
|
|
667
|
-
state.pendingAssignments.size && writeAssigned(state);
|
|
668
659
|
}
|
|
669
|
-
function
|
|
660
|
+
function writeDeferredEntry(state, id, [key, value]) {
|
|
661
|
+
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(")");
|
|
662
|
+
}
|
|
663
|
+
function writeDeferredMember(state, id, member) {
|
|
664
|
+
state.buf.push("," + id + ".add("), member !== void 0 && writeCallArg(state, member, null), state.buf.push(")");
|
|
665
|
+
}
|
|
666
|
+
function writeCallArg(state, val, valueId) {
|
|
667
|
+
let startIndex = state.buf.length;
|
|
670
668
|
if (val === void 0) state.wroteUndefined = !0, state.buf.push("$");
|
|
671
669
|
else if (writeProp(state, val, null, "")) {
|
|
672
|
-
let ref = state.
|
|
673
|
-
ref &&
|
|
670
|
+
let ref = typeof val == "string" ? state.strs.get(val) : state.refs.get(val);
|
|
671
|
+
ref && !ref.id && ref.scopeId === void 0 && !isAncestorChannelRef(state, ref) && (ref.id = valueId || nextRefAccess(state), state.buf[startIndex] = ref.id + "=" + state.buf[startIndex]);
|
|
674
672
|
} else state.buf.push("void 0");
|
|
675
673
|
}
|
|
676
|
-
function
|
|
677
|
-
return
|
|
674
|
+
function hasChannelCalls(state) {
|
|
675
|
+
return hasMatchingCalls(state, state.channel?.readyId);
|
|
678
676
|
}
|
|
679
|
-
function
|
|
680
|
-
|
|
677
|
+
function hasMatchingCalls(state, readyId) {
|
|
678
|
+
if (!readyId) return state.queuedCalls.length > 0;
|
|
679
|
+
for (let call of state.queuedReadyCalls) if (call.channel.readyId === readyId) return !0;
|
|
681
680
|
return !1;
|
|
682
681
|
}
|
|
683
|
-
function mutationMatchesReadyId(mutation, readyId) {
|
|
684
|
-
return mutation.channel?.readyId ? mutation.channel.readyId === readyId : !readyId;
|
|
685
|
-
}
|
|
686
682
|
function writeProp(state, val, parent, accessor) {
|
|
687
683
|
switch (typeof val) {
|
|
688
684
|
case "string": return writeString(state, val, parent, accessor);
|
|
@@ -697,7 +693,7 @@ function writeProp(state, val, parent, accessor) {
|
|
|
697
693
|
}
|
|
698
694
|
function writeReferenceOr(state, write, val, parent, accessor) {
|
|
699
695
|
let ref = state.refs.get(val);
|
|
700
|
-
if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (
|
|
696
|
+
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;
|
|
701
697
|
let registered = REGISTRY.get(val);
|
|
702
698
|
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));
|
|
703
699
|
}
|
|
@@ -714,19 +710,7 @@ function quoteRegisterId(id) {
|
|
|
714
710
|
}
|
|
715
711
|
function writeRegistered(state, val, parent, accessor, registered) {
|
|
716
712
|
let { scope } = registered;
|
|
717
|
-
|
|
718
|
-
let ref = new Reference(parent, accessor, state.flushId, state.buf.length);
|
|
719
|
-
ref.channel = state.channel, state.refs.set(val, ref);
|
|
720
|
-
let scopeId = scope[K_SCOPE_ID];
|
|
721
|
-
trackScope(state, scope, scopeId);
|
|
722
|
-
let locals = registered.locals?.(state.boundary.state.scope);
|
|
723
|
-
if (locals) {
|
|
724
|
-
state.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
725
|
-
for (let local of locals) state.buf.push(","), writePlainObject(state, local, newArgReference(state, ref, local));
|
|
726
|
-
} else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
727
|
-
state.buf.push(")");
|
|
728
|
-
} else state.buf.push(registered.access);
|
|
729
|
-
return !0;
|
|
713
|
+
return scope ? state.writeScopedRegistration(val, parent, accessor, registered) : state.buf.push(registered.access), !0;
|
|
730
714
|
}
|
|
731
715
|
function writeString(state, val, parent, accessor) {
|
|
732
716
|
if (val.length > 12) {
|
|
@@ -862,7 +846,7 @@ function writeRegExp(state, val) {
|
|
|
862
846
|
}
|
|
863
847
|
function writePromise(state, val, ref) {
|
|
864
848
|
let { boundary, channel } = state, pId = nextRefAccess(state), handle = newAsyncHandle(state, ref, pId);
|
|
865
|
-
return state.buf.push("(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()"), val.then((v) =>
|
|
849
|
+
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;
|
|
866
850
|
}
|
|
867
851
|
function newAsyncHandle(state, parent, id) {
|
|
868
852
|
let handle = {}, handleRef = new Reference(parent, null, state.flushId, null, id);
|
|
@@ -870,23 +854,25 @@ function newAsyncHandle(state, parent, id) {
|
|
|
870
854
|
}
|
|
871
855
|
function writeMap(state, val, ref) {
|
|
872
856
|
if (!val.size) return state.buf.push("new Map"), !0;
|
|
873
|
-
let items = [], assignments, needsId,
|
|
857
|
+
let items = [], assignments, needsId, i = 0, entries = val.entries();
|
|
874
858
|
if (val.size < 25) {
|
|
875
|
-
for (let
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
859
|
+
for (let entry of entries) {
|
|
860
|
+
let [itemKey, itemValue] = entry;
|
|
861
|
+
if (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) {
|
|
862
|
+
if (deferMembers(state, ref, val, entry, entries), !i) return state.buf.push("new Map"), !0;
|
|
863
|
+
break;
|
|
879
864
|
}
|
|
880
|
-
itemKey === val && (itemKey = void 0, (assignments ||= []).push("a[" + i + "][0]")), itemValue === val && (itemValue = void 0, (assignments ||= []).push("a[" + i + "][1]")), needsId ||=
|
|
865
|
+
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]);
|
|
881
866
|
}
|
|
882
867
|
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);
|
|
883
868
|
} else {
|
|
884
|
-
for (let
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
869
|
+
for (let entry of entries) {
|
|
870
|
+
let [itemKey, itemValue] = entry;
|
|
871
|
+
if (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue)) {
|
|
872
|
+
if (deferMembers(state, ref, val, entry, entries), !i) return state.buf.push("new Map"), !0;
|
|
873
|
+
break;
|
|
888
874
|
}
|
|
889
|
-
itemKey === val && (itemKey = 0, (assignments ||= []).push("a[" + i + "]")), itemValue === val && (itemValue = 0, (assignments ||= []).push("a[" + (i + 1) + "]")), needsId ||=
|
|
875
|
+
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);
|
|
890
876
|
}
|
|
891
877
|
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);
|
|
892
878
|
}
|
|
@@ -894,13 +880,13 @@ function writeMap(state, val, ref) {
|
|
|
894
880
|
}
|
|
895
881
|
function writeSet(state, val, ref) {
|
|
896
882
|
if (!val.size) return state.buf.push("new Set"), !0;
|
|
897
|
-
let items = [], assignments, needsId,
|
|
898
|
-
for (let item of
|
|
899
|
-
if (
|
|
900
|
-
|
|
901
|
-
|
|
883
|
+
let items = [], assignments, needsId, i = 0, members = val.values();
|
|
884
|
+
for (let item of members) {
|
|
885
|
+
if (item !== val && isAncestorMember(state, ref, item)) {
|
|
886
|
+
if (deferMembers(state, ref, val, item, members), !i) return state.buf.push("new Set"), !0;
|
|
887
|
+
break;
|
|
902
888
|
}
|
|
903
|
-
item === val ? (item = 0, (assignments ||= []).push("i[" + i + "]")) : needsId ||=
|
|
889
|
+
item === val ? (item = 0, (assignments ||= []).push("i[" + i + "]")) : needsId ||= isReusableMember(item), i = items.push(item);
|
|
904
890
|
}
|
|
905
891
|
return writeArrayArg(state, ref, items, assignments && "((s,i)=>(" + assignmentsToString(assignments, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId), !0;
|
|
906
892
|
}
|
|
@@ -909,11 +895,12 @@ function isAncestorMember(state, container, member) {
|
|
|
909
895
|
let ref = state.refs.get(member);
|
|
910
896
|
return ref !== void 0 && isCircular(container, ref);
|
|
911
897
|
}
|
|
912
|
-
function
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
898
|
+
function deferMembers(state, ref, collection, first, rest) {
|
|
899
|
+
ensureRefAccess(state, ref), ref.deferredMembers = {
|
|
900
|
+
collection,
|
|
901
|
+
first,
|
|
902
|
+
rest
|
|
903
|
+
}, state.deferredRefs.add(ref);
|
|
917
904
|
}
|
|
918
905
|
function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
919
906
|
if (assignsPrefix || needsId) {
|
|
@@ -925,14 +912,14 @@ function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
|
925
912
|
function newArgReference(state, parent, val) {
|
|
926
913
|
for (let key in val) {
|
|
927
914
|
let member = val[key];
|
|
928
|
-
if (
|
|
915
|
+
if (isReusableMember(member) && !(typeof member == "string" ? state.strs.has(member) : state.refs.has(member))) {
|
|
929
916
|
let ref = new Reference(parent, null, state.flushId, null, nextRefAccess(state));
|
|
930
917
|
return state.buf.push(ref.id + "="), ref;
|
|
931
918
|
}
|
|
932
919
|
}
|
|
933
920
|
return new Reference(parent, null, state.flushId, state.buf.length);
|
|
934
921
|
}
|
|
935
|
-
function
|
|
922
|
+
function isReusableMember(val) {
|
|
936
923
|
switch (typeof val) {
|
|
937
924
|
case "object": return val !== null && val[K_SCOPE_ID] === void 0;
|
|
938
925
|
case "function":
|
|
@@ -985,7 +972,7 @@ function writeAggregateError(state, val, ref) {
|
|
|
985
972
|
let inlined = writeProp(state, val.errors, ref, "errors");
|
|
986
973
|
if (inlined || state.buf.push("[]"), val.message ? state.buf.push("," + quote(val.message + "", 0) + ")") : state.buf.push(")"), inlined) {
|
|
987
974
|
let errorsRef = state.refs.get(val.errors);
|
|
988
|
-
errorsRef?.id && (state.
|
|
975
|
+
errorsRef?.id && (state.deferredRefs.add(errorsRef), addAssignment(errorsRef, accessId(state, ref) + toAccess("errors")));
|
|
989
976
|
}
|
|
990
977
|
return !0;
|
|
991
978
|
}
|
|
@@ -1014,7 +1001,7 @@ function writeRequest(state, val, ref) {
|
|
|
1014
1001
|
let options = "";
|
|
1015
1002
|
val.cache !== "default" && (options += sep + "cache:" + quote(val.cache, 0), sep = ","), val.credentials !== "same-origin" && (options += sep + "credentials:" + quote(val.credentials, 0), sep = ",");
|
|
1016
1003
|
let seenHeaders = state.refs.get(val.headers);
|
|
1017
|
-
if (seenHeaders) options += sep + "headers:" +
|
|
1004
|
+
if (seenHeaders) options += sep + "headers:" + ensureRefAccess(state, seenHeaders), sep = ",";
|
|
1018
1005
|
else {
|
|
1019
1006
|
state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
|
|
1020
1007
|
let headers = stringEntriesToHeadersInit(val.headers);
|
|
@@ -1026,7 +1013,7 @@ function writeResponse(state, val, ref) {
|
|
|
1026
1013
|
let sep = "", options = "";
|
|
1027
1014
|
val.status !== 200 && (options += "status:" + val.status, sep = ","), val.statusText && (options += sep + "statusText:" + quote(val.statusText, 0), sep = ",");
|
|
1028
1015
|
let seenHeaders = state.refs.get(val.headers);
|
|
1029
|
-
if (seenHeaders) options += sep + "headers:" +
|
|
1016
|
+
if (seenHeaders) options += sep + "headers:" + ensureRefAccess(state, seenHeaders);
|
|
1030
1017
|
else {
|
|
1031
1018
|
state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
|
|
1032
1019
|
let headers = stringEntriesToHeadersInit(val.headers);
|
|
@@ -1049,9 +1036,9 @@ function writeTemporal(state, val, name) {
|
|
|
1049
1036
|
function writeReadableStream(state, val, ref) {
|
|
1050
1037
|
if (val.locked) return !1;
|
|
1051
1038
|
let { boundary, channel } = state, reader = val.getReader(), iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1052
|
-
done ?
|
|
1039
|
+
done ? queueAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (reader.read().then(onFulfilled, onRejected), boundary.startAsync(), queueAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1053
1040
|
}, onRejected = (reason) => {
|
|
1054
|
-
|
|
1041
|
+
queueAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1055
1042
|
};
|
|
1056
1043
|
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;
|
|
1057
1044
|
}
|
|
@@ -1064,7 +1051,7 @@ function writeGenerator(state, iter, ref) {
|
|
|
1064
1051
|
returnValue = value;
|
|
1065
1052
|
break;
|
|
1066
1053
|
}
|
|
1067
|
-
needsId ||=
|
|
1054
|
+
needsId ||= isReusableMember(value), yields.push(value);
|
|
1068
1055
|
}
|
|
1069
1056
|
if (returnValue === void 0 && !yields.length) return state.buf.push("(function*(){})()"), !0;
|
|
1070
1057
|
let heldReturn = returnValue !== void 0 && isAncestorMember(state, ref, returnValue);
|
|
@@ -1075,18 +1062,18 @@ function writeGenerator(state, iter, ref) {
|
|
|
1075
1062
|
if (heldReturn) {
|
|
1076
1063
|
let holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
1077
1064
|
state.buf.push("," + holder.id + "={}"), writeProp(state, returnValue, holder, "v");
|
|
1078
|
-
} else if (returnValue !== void 0 && (state.buf.push(","), writeProp(state, returnValue, ref, "") &&
|
|
1065
|
+
} else if (returnValue !== void 0 && (state.buf.push(","), writeProp(state, returnValue, ref, "") && isReusableMember(returnValue))) {
|
|
1079
1066
|
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1080
|
-
retRef &&
|
|
1067
|
+
retRef && ensureRefAccess(state, retRef);
|
|
1081
1068
|
}
|
|
1082
1069
|
return state.buf.push(")"), !0;
|
|
1083
1070
|
}
|
|
1084
1071
|
function writeAsyncGenerator(state, iter, ref) {
|
|
1085
1072
|
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
1086
1073
|
let { boundary, channel } = state, iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1087
|
-
done ?
|
|
1074
|
+
done ? queueAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (iter.next().then(onFulfilled, onRejected), boundary.startAsync(), queueAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1088
1075
|
}, onRejected = (reason) => {
|
|
1089
|
-
|
|
1076
|
+
queueAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1090
1077
|
};
|
|
1091
1078
|
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;
|
|
1092
1079
|
}
|
|
@@ -1114,11 +1101,11 @@ function writeMaybeIterableProps(state, val, ref) {
|
|
|
1114
1101
|
}
|
|
1115
1102
|
return sep;
|
|
1116
1103
|
}
|
|
1117
|
-
function
|
|
1118
|
-
boundary.aborted || (state.
|
|
1104
|
+
function queueAsyncCall(state, boundary, handle, method, value, channel, valueId = null) {
|
|
1105
|
+
boundary.aborted || ((channel?.readyId ? state.queuedReadyCalls : state.queuedCalls).push({
|
|
1106
|
+
method,
|
|
1119
1107
|
value,
|
|
1120
1108
|
object: handle,
|
|
1121
|
-
property: method,
|
|
1122
1109
|
channel,
|
|
1123
1110
|
valueId
|
|
1124
1111
|
}), boundary.endAsync());
|
|
@@ -1219,16 +1206,16 @@ function quote(str, startPos) {
|
|
|
1219
1206
|
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
1220
1207
|
}
|
|
1221
1208
|
function writeRef(state, ref) {
|
|
1222
|
-
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(
|
|
1209
|
+
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));
|
|
1223
1210
|
}
|
|
1224
|
-
function
|
|
1225
|
-
return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) :
|
|
1211
|
+
function ensureRefAccess(state, ref) {
|
|
1212
|
+
return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : claimRefAccess(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
|
|
1226
1213
|
}
|
|
1227
1214
|
function accessId(state, ref) {
|
|
1228
|
-
let id =
|
|
1215
|
+
let id = ensureRefAccess(state, ref);
|
|
1229
1216
|
return id === ref.id || ref.scopeId !== void 0 ? id : "(" + id + ")";
|
|
1230
1217
|
}
|
|
1231
|
-
function
|
|
1218
|
+
function claimRefAccess(state, ref) {
|
|
1232
1219
|
let { pos } = ref;
|
|
1233
1220
|
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)));
|
|
1234
1221
|
}
|
|
@@ -1295,10 +1282,10 @@ function patchIteratorNext(proto) {
|
|
|
1295
1282
|
//#endregion
|
|
1296
1283
|
//#region src/html/attrs.ts
|
|
1297
1284
|
function _attr_class(value) {
|
|
1298
|
-
return stringAttr("class", toDelimitedString(value, " ",
|
|
1285
|
+
return stringAttr("class", toDelimitedString(value, " ", stringifyClassEntry));
|
|
1299
1286
|
}
|
|
1300
1287
|
function _attr_style(value) {
|
|
1301
|
-
return stringAttr("style", toDelimitedString(value, ";",
|
|
1288
|
+
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleEntry));
|
|
1302
1289
|
}
|
|
1303
1290
|
function _attr_option_value(value) {
|
|
1304
1291
|
let valueAttr = _attr("value", value), selectedValue = getContext(kSelectedValue);
|
|
@@ -1324,7 +1311,7 @@ function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeT
|
|
|
1324
1311
|
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
1325
1312
|
}
|
|
1326
1313
|
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1327
|
-
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType),
|
|
1314
|
+
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType), isNotNullishOrFalse(checked) ? " checked" : "";
|
|
1328
1315
|
}
|
|
1329
1316
|
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1330
1317
|
let valueAttr = _attr("value", value);
|
|
@@ -1337,7 +1324,7 @@ function getCheckedValueRef(checkedValue) {
|
|
|
1337
1324
|
}
|
|
1338
1325
|
}
|
|
1339
1326
|
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1340
|
-
let normalizedOpen =
|
|
1327
|
+
let normalizedOpen = isNotNullishOrFalse(open);
|
|
1341
1328
|
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1342
1329
|
}
|
|
1343
1330
|
function _attr_nonce() {
|
|
@@ -1348,7 +1335,7 @@ function _style_html(decls) {
|
|
|
1348
1335
|
return `<style${_attr_nonce()} class=${id}>.${id}~*{${decls}}</style>`;
|
|
1349
1336
|
}
|
|
1350
1337
|
function _attr(name, value) {
|
|
1351
|
-
return
|
|
1338
|
+
return isNullishOrFalse(value) ? "" : stringifyAttr(name, value);
|
|
1352
1339
|
}
|
|
1353
1340
|
function _attr_and(name, value, attr) {
|
|
1354
1341
|
return value ? attr : _attr(name, value);
|
|
@@ -1384,7 +1371,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1384
1371
|
case "style":
|
|
1385
1372
|
result += _attr_style(value);
|
|
1386
1373
|
break;
|
|
1387
|
-
default: name && !(
|
|
1374
|
+
default: name && !(isNullishOrFalse(value) || skip.test(name) || name === "content" && tagName !== "meta") && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, { ["I" + nodeAccessor]: events })), events[getEventType(name)] = value) : result += stringifyAttr(name, value));
|
|
1388
1375
|
}
|
|
1389
1376
|
}
|
|
1390
1377
|
return result;
|
|
@@ -1395,7 +1382,7 @@ function _attrs_content(data, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
|
1395
1382
|
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1396
1383
|
let partial = {};
|
|
1397
1384
|
for (let name in data) {
|
|
1398
|
-
let key = isEventHandler(name) ? `on-${
|
|
1385
|
+
let key = isEventHandler(name) ? `on-${getEventType(name)}` : name;
|
|
1399
1386
|
skip[key] || (partial[key] = data[name]);
|
|
1400
1387
|
}
|
|
1401
1388
|
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
@@ -1416,7 +1403,7 @@ function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, s
|
|
|
1416
1403
|
function stringAttr(name, value) {
|
|
1417
1404
|
return value && " " + name + attrAssignment(value);
|
|
1418
1405
|
}
|
|
1419
|
-
function
|
|
1406
|
+
function stringifyAttr(name, value) {
|
|
1420
1407
|
switch (typeof value) {
|
|
1421
1408
|
case "string": return " " + name + attrAssignment(value);
|
|
1422
1409
|
case "boolean": return " " + name;
|
|
@@ -1447,18 +1434,7 @@ function normalizedValueMatches(a, b) {
|
|
|
1447
1434
|
return !1;
|
|
1448
1435
|
}
|
|
1449
1436
|
function normalizeStrAttrValue(value) {
|
|
1450
|
-
return
|
|
1451
|
-
}
|
|
1452
|
-
//#endregion
|
|
1453
|
-
//#region src/html/for.ts
|
|
1454
|
-
function forOfBy(by, item, index) {
|
|
1455
|
-
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
|
1456
|
-
}
|
|
1457
|
-
function forInBy(by, name, value) {
|
|
1458
|
-
return by ? by(name, value) : name;
|
|
1459
|
-
}
|
|
1460
|
-
function forStepBy(by, index) {
|
|
1461
|
-
return by ? by(index) : index;
|
|
1437
|
+
return isNotNullishOrFalse(value) && value !== !0 ? value + "" : "";
|
|
1462
1438
|
}
|
|
1463
1439
|
//#endregion
|
|
1464
1440
|
//#region src/html/inlined-runtimes.ts
|
|
@@ -1504,11 +1480,11 @@ function _scope_id() {
|
|
|
1504
1480
|
function _peek_scope_id() {
|
|
1505
1481
|
return $chunk.boundary.state.scopeId;
|
|
1506
1482
|
}
|
|
1507
|
-
function withContext(key, value, cb, cbValue) {
|
|
1483
|
+
function withContext(key, value, cb, cbValue, cbValue2) {
|
|
1508
1484
|
let ctx = $chunk.context ||= { [kPendingContexts]: 0 }, prev = ctx[key];
|
|
1509
1485
|
ctx[kPendingContexts]++, ctx[key] = value;
|
|
1510
1486
|
try {
|
|
1511
|
-
return cb(cbValue);
|
|
1487
|
+
return cb(cbValue, cbValue2);
|
|
1512
1488
|
} finally {
|
|
1513
1489
|
ctx[kPendingContexts]--, ctx[key] = prev;
|
|
1514
1490
|
}
|
|
@@ -1522,11 +1498,11 @@ function captureContext(chunk) {
|
|
|
1522
1498
|
function isInResumedBranch() {
|
|
1523
1499
|
return $chunk?.context?.[kBranchId] !== void 0;
|
|
1524
1500
|
}
|
|
1525
|
-
function withBranchId(branchId, cb, cbValue) {
|
|
1526
|
-
return withContext(kBranchId, branchId, cb, cbValue);
|
|
1501
|
+
function withBranchId(branchId, cb, cbValue, cbValue2) {
|
|
1502
|
+
return withContext(kBranchId, branchId, cb, cbValue, cbValue2);
|
|
1527
1503
|
}
|
|
1528
|
-
function
|
|
1529
|
-
return withContext(
|
|
1504
|
+
function withAsyncContent(async, cb, value) {
|
|
1505
|
+
return withContext(kAsyncContent, async, cb, value);
|
|
1530
1506
|
}
|
|
1531
1507
|
function _html(html) {
|
|
1532
1508
|
$chunk.writeHTML(html);
|
|
@@ -1544,7 +1520,7 @@ function mayDrop(written) {
|
|
|
1544
1520
|
return !1;
|
|
1545
1521
|
}
|
|
1546
1522
|
function _script(scopeId, registryId, markerGuard) {
|
|
1547
|
-
markerGuard === 0 && ($chunk.
|
|
1523
|
+
markerGuard === 0 && ($chunk.channel.readyId || $chunk.context?.[kAsyncContent]) && _resume_branch(scopeId), $chunk.boundary.state.queueEffect(scopeId, registryId);
|
|
1548
1524
|
}
|
|
1549
1525
|
function _trailers(html) {
|
|
1550
1526
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -1562,24 +1538,24 @@ function _hoist(scopeId, id) {
|
|
|
1562
1538
|
let getter = () => void 0;
|
|
1563
1539
|
return getter[Symbol.iterator] = _hoist_read_error, _resume(getter, id, scopeId);
|
|
1564
1540
|
}
|
|
1565
|
-
function _el_resume(scopeId, accessor,
|
|
1566
|
-
if (
|
|
1541
|
+
function _el_resume(scopeId, accessor, markerGuard) {
|
|
1542
|
+
if (markerGuard === 0) return "";
|
|
1567
1543
|
let { state } = $chunk.boundary;
|
|
1568
|
-
return state.
|
|
1544
|
+
return state.needsWalkerRuntime = !0, state.mark("$", scopeId + " " + accessor);
|
|
1569
1545
|
}
|
|
1570
|
-
function _text_resume(scopeId, accessor, val,
|
|
1571
|
-
return markText(scopeId, accessor, _escape(val),
|
|
1546
|
+
function _text_resume(scopeId, accessor, val, markerGuard) {
|
|
1547
|
+
return markText(scopeId, accessor, _escape(val), markerGuard);
|
|
1572
1548
|
}
|
|
1573
|
-
function _html_resume(scopeId, accessor, val,
|
|
1549
|
+
function _html_resume(scopeId, accessor, val, markerGuard) {
|
|
1574
1550
|
let html = _unescaped(val);
|
|
1575
|
-
if (
|
|
1551
|
+
if (markerGuard === 0 || !~html.indexOf("<")) return markText(scopeId, accessor, html, markerGuard);
|
|
1576
1552
|
let { state } = $chunk.boundary;
|
|
1577
|
-
return state.
|
|
1553
|
+
return state.needsWalkerRuntime = !0, state.mark("&", "") + html + state.mark("'", scopeId + " " + accessor);
|
|
1578
1554
|
}
|
|
1579
|
-
function markText(scopeId, accessor, text,
|
|
1580
|
-
if (
|
|
1555
|
+
function markText(scopeId, accessor, text, markerGuard) {
|
|
1556
|
+
if (markerGuard === 0) return text;
|
|
1581
1557
|
let { state } = $chunk.boundary;
|
|
1582
|
-
return state.
|
|
1558
|
+
return state.needsWalkerRuntime = !0, text ? (markerGuard === 2 ? "<!>" : "") + text + state.mark("$", scopeId + " " + accessor) : state.mark("%", scopeId + " " + accessor);
|
|
1583
1559
|
}
|
|
1584
1560
|
function _resume_branch(scopeId) {
|
|
1585
1561
|
let branchId = $chunk.context?.[kBranchId];
|
|
@@ -1588,7 +1564,7 @@ function _resume_branch(scopeId) {
|
|
|
1588
1564
|
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
1589
1565
|
let shouldResume = markerGuard !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
|
|
1590
1566
|
if (render) try {
|
|
1591
|
-
_set_scope_reason(shouldResume ?
|
|
1567
|
+
_set_scope_reason(shouldResume ? ALL_GROUPS : 0), shouldResume ? withBranchId(branchId, render) : render();
|
|
1592
1568
|
} finally {
|
|
1593
1569
|
_set_scope_reason(void 0);
|
|
1594
1570
|
}
|
|
@@ -1607,83 +1583,8 @@ function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, node
|
|
|
1607
1583
|
nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
|
|
1608
1584
|
}
|
|
1609
1585
|
function writeScopePassive(scopeId, partialScope) {
|
|
1610
|
-
let target = $chunk.
|
|
1611
|
-
return Object.assign(scope, partialScope),
|
|
1612
|
-
}
|
|
1613
|
-
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
1614
|
-
display ? resumesMarker(markerGuard, branchExprGuard, parentEndTag) && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1615
|
-
}
|
|
1616
|
-
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1617
|
-
let branchId = _scope_id(), wrap = !display;
|
|
1618
|
-
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1619
|
-
}
|
|
1620
|
-
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1621
|
-
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
1622
|
-
let itemKey = forOfBy(by, item, index);
|
|
1623
|
-
each(itemKey, itemKey === index, () => cb(item, index));
|
|
1624
|
-
}) : forOf(list, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1625
|
-
}
|
|
1626
|
-
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1627
|
-
forBranches(by, (each) => each ? forIn(obj, (key, value) => {
|
|
1628
|
-
each(forInBy(by, key, value), !1, () => cb(key, value));
|
|
1629
|
-
}) : forIn(obj, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1630
|
-
}
|
|
1631
|
-
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1632
|
-
forBranches(by, (each) => {
|
|
1633
|
-
let index = 0;
|
|
1634
|
-
return each ? forTo(to, from, step, (value) => {
|
|
1635
|
-
let itemKey = forStepBy(by, value);
|
|
1636
|
-
each(itemKey, itemKey === index++, () => cb(value));
|
|
1637
|
-
}) : forTo(to, from, step, cb);
|
|
1638
|
-
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1639
|
-
}
|
|
1640
|
-
function _for_until(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1641
|
-
forBranches(by, (each) => {
|
|
1642
|
-
let index = 0;
|
|
1643
|
-
return each ? forUntil(to, from, step, (value) => {
|
|
1644
|
-
let itemKey = forStepBy(by, value);
|
|
1645
|
-
each(itemKey, itemKey === index++, () => cb(value));
|
|
1646
|
-
}) : forUntil(to, from, step, cb);
|
|
1647
|
-
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1648
|
-
}
|
|
1649
|
-
function forBranches(by, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1650
|
-
if (branchGuard === 0) {
|
|
1651
|
-
iterate(0), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
1652
|
-
return;
|
|
1653
|
-
}
|
|
1654
|
-
let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
|
|
1655
|
-
iterate((itemKey, sameAsIndex, render) => {
|
|
1656
|
-
let branchId = _peek_scope_id();
|
|
1657
|
-
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
1658
|
-
render();
|
|
1659
|
-
let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
|
|
1660
|
-
resumeMarker || (loopScopes = push(loopScopes, branchScope));
|
|
1661
|
-
});
|
|
1662
|
-
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1663
|
-
}
|
|
1664
|
-
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1665
|
-
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 ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
1666
|
-
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1667
|
-
["D" + accessor]: branchIndex || void 0,
|
|
1668
|
-
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
1669
|
-
}), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1670
|
-
}
|
|
1671
|
-
function deferBranchStart(chunk) {
|
|
1672
|
-
let beforeBranch = chunk.html;
|
|
1673
|
-
return chunk.html = "", beforeBranch;
|
|
1674
|
-
}
|
|
1675
|
-
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1676
|
-
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1677
|
-
}
|
|
1678
|
-
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
1679
|
-
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
1680
|
-
}
|
|
1681
|
-
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
1682
|
-
let endTag = parentEndTag || "";
|
|
1683
|
-
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
1684
|
-
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
1685
|
-
$chunk.writeHTML(mark + endTag);
|
|
1686
|
-
} else markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1586
|
+
let target = $chunk.channel, scope = _scope_with_id(scopeId);
|
|
1587
|
+
return Object.assign(scope, partialScope), $chunk.boundary.state.queuePassiveScope(target, scopeId, partialScope), scope;
|
|
1687
1588
|
}
|
|
1688
1589
|
function _existing_scope(scopeId) {
|
|
1689
1590
|
return writeScope(scopeId, {});
|
|
@@ -1697,13 +1598,13 @@ function scopeWithId(state, scopeId) {
|
|
|
1697
1598
|
}
|
|
1698
1599
|
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
1699
1600
|
if (subscribers) {
|
|
1700
|
-
let { boundary,
|
|
1701
|
-
!
|
|
1601
|
+
let { boundary, channel } = $chunk, { serializer } = boundary.state;
|
|
1602
|
+
!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);
|
|
1702
1603
|
}
|
|
1703
1604
|
return scope;
|
|
1704
1605
|
}
|
|
1705
|
-
function
|
|
1706
|
-
return
|
|
1606
|
+
function getGroupReason(reason, group) {
|
|
1607
|
+
return reason === 715827883 ? 1 : typeof reason == "number" ? group < 15 ? reason >>> 1 + 2 * group & 3 : 0 : reason[group] ?? 0;
|
|
1707
1608
|
}
|
|
1708
1609
|
function _set_scope_reason(reason) {
|
|
1709
1610
|
$chunk.boundary.state.scopeReason = reason;
|
|
@@ -1712,148 +1613,65 @@ function _scope_reason() {
|
|
|
1712
1613
|
let reason = $chunk.boundary.state.scopeReason;
|
|
1713
1614
|
return $chunk.boundary.state.scopeReason = void 0, reason;
|
|
1714
1615
|
}
|
|
1715
|
-
function _write_if(
|
|
1716
|
-
return
|
|
1616
|
+
function _write_if(reason, group) {
|
|
1617
|
+
return reason && getGroupReason(reason, group) ? 1 : void 0;
|
|
1717
1618
|
}
|
|
1718
|
-
function _write_guard(
|
|
1719
|
-
return _write_if(
|
|
1619
|
+
function _write_guard(reason, group) {
|
|
1620
|
+
return _write_if(reason, group) || 0;
|
|
1720
1621
|
}
|
|
1721
1622
|
function writeWaitReady(readyId, renderer, input) {
|
|
1722
1623
|
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context, {
|
|
1723
1624
|
readyId,
|
|
1724
|
-
parent: chunk.
|
|
1625
|
+
parent: chunk.channel,
|
|
1725
1626
|
resumes: "",
|
|
1726
1627
|
writeScopes: {},
|
|
1727
1628
|
flushScopes: !1
|
|
1728
1629
|
}), bodyEnd = body.render(renderer, input);
|
|
1729
1630
|
if (boundary.aborted) throw boundary.reason;
|
|
1730
|
-
body === bodyEnd ? (chunk.writeHTML(body.html), body.deferOwnReady(), chunk.deferredReady = push(chunk.deferredReady, body)) : (bodyEnd.next =
|
|
1731
|
-
}
|
|
1732
|
-
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
1733
|
-
let resumeMarker = markerGuard !== 0;
|
|
1734
|
-
if (!isPromise(promise)) {
|
|
1735
|
-
if (resumeMarker) {
|
|
1736
|
-
let branchId = _peek_scope_id();
|
|
1737
|
-
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, content, promise), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1738
|
-
} else content(promise);
|
|
1739
|
-
return;
|
|
1740
|
-
}
|
|
1741
|
-
let chunk = $chunk, { boundary } = chunk, startId = _peek_scope_id(), after = chunk.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1742
|
-
chunk.async = !0, captureContext(chunk), boundary.startAsync(), promise.then((value) => {
|
|
1743
|
-
if (chunk.async && (chunk.async = !1, !boundary.aborted)) {
|
|
1744
|
-
let { state } = boundary;
|
|
1745
|
-
chunk.render(() => {
|
|
1746
|
-
if (resumeMarker) {
|
|
1747
|
-
let branchId = _peek_scope_id();
|
|
1748
|
-
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withIsAsync({ parent: getAsyncContent(chunk) }, content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1749
|
-
} else {
|
|
1750
|
-
let renderedSince = _peek_scope_id() !== startId, async = { parent: getAsyncContent(chunk) };
|
|
1751
|
-
withIsAsync(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;
|
|
1752
|
-
}
|
|
1753
|
-
}), !chunk.async && boundary.pendingReorders?.delete(chunk) && state.reorder(chunk), boundary.endAsync();
|
|
1754
|
-
}
|
|
1755
|
-
}, (err) => {
|
|
1756
|
-
chunk.async = !1, boundary.abort(err);
|
|
1757
|
-
});
|
|
1758
|
-
}
|
|
1759
|
-
function _try(scopeId, accessor, content, placeholderContent, catchContent, placeholderId, catchId) {
|
|
1760
|
-
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)), renderersWritten = tryBoundary(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content, catchContent, branchId, renderers), rendered = chunk !== $chunk || boundary.resumeWrites !== resumeWrites;
|
|
1761
|
-
applyBranchStart(chunk, beforeBranch, rendered), rendered && (renderersWritten || renderers(), $chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId)));
|
|
1631
|
+
body === bodyEnd ? (chunk.writeHTML(body.html), body.deferOwnReady(), chunk.deferredReady = push(chunk.deferredReady, body)) : (bodyEnd.next = chunk.forkRest(boundary), chunk.next = body);
|
|
1762
1632
|
}
|
|
1763
|
-
function
|
|
1764
|
-
let
|
|
1765
|
-
|
|
1766
|
-
chunk.append(body);
|
|
1767
|
-
return;
|
|
1768
|
-
}
|
|
1769
|
-
chunk.next = $chunk = chunk.fork(boundary, chunk.next), captureContext(chunk), chunk.placeholder = {
|
|
1770
|
-
body,
|
|
1771
|
-
render: placeholder,
|
|
1772
|
-
branchId,
|
|
1773
|
-
scopeId,
|
|
1774
|
-
placeholderBranchId
|
|
1775
|
-
};
|
|
1633
|
+
function deferBranchStart(chunk) {
|
|
1634
|
+
let beforeBranch = chunk.html;
|
|
1635
|
+
return chunk.html = "", beforeBranch;
|
|
1776
1636
|
}
|
|
1777
|
-
function
|
|
1778
|
-
|
|
1779
|
-
catchContent && (catchBoundary.withinCatch = !0);
|
|
1780
|
-
let body = chunk.fork(catchBoundary, null), bodyEnd = body.render(() => withBranchId(branchId, content));
|
|
1781
|
-
if (catchBoundary.aborted) {
|
|
1782
|
-
if (!catchContent) throw catchBoundary.reason;
|
|
1783
|
-
return catchContent(catchBoundary.reason), !0;
|
|
1784
|
-
}
|
|
1785
|
-
if (body === bodyEnd) return chunk.append(body), !1;
|
|
1786
|
-
let renderersAtSettle = !catchBoundary.resumeWrites, bodyNext = bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1787
|
-
chunk.next = body, boundary.startAsync();
|
|
1788
|
-
let reorderId = catchContent ? state.nextReorderId() : "";
|
|
1789
|
-
return reorderId && (chunk.catchRange = {
|
|
1790
|
-
id: reorderId,
|
|
1791
|
-
end: bodyEnd
|
|
1792
|
-
}, captureContext(chunk)), catchBoundary.onNext = () => {
|
|
1793
|
-
if (!boundary.aborted) {
|
|
1794
|
-
if (catchBoundary.aborted) {
|
|
1795
|
-
if (!reorderId) {
|
|
1796
|
-
boundary.abort(catchBoundary.reason);
|
|
1797
|
-
return;
|
|
1798
|
-
}
|
|
1799
|
-
let streamed = !chunk.catchRange, catchChunk = chunk.fork(boundary, null);
|
|
1800
|
-
chunk.catchRange = null, renderersAtSettle || catchChunk.render(clearTryRenderers, branchId);
|
|
1801
|
-
let inOrder = catchChunk === catchChunk.render(catchContent, catchBoundary.reason);
|
|
1802
|
-
if (boundary.aborted) return;
|
|
1803
|
-
if ((bodyEnd.consumed || !inOrder) && (catchChunk.reorderBranch = branchId), bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
1804
|
-
else {
|
|
1805
|
-
let reorder = null;
|
|
1806
|
-
inOrder ? streamed && (reorder = chunk.fork(boundary, null)) : reorder = catchChunk, reorder && (reorder.reorderId = reorderId);
|
|
1807
|
-
let endMarker = state.mark("!", reorderId), cut = body;
|
|
1808
|
-
for (; cut.consumed;) cut = cut.next;
|
|
1809
|
-
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);
|
|
1810
|
-
}
|
|
1811
|
-
boundary.endAsync();
|
|
1812
|
-
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), chunk.catchRange = null, boundary.endAsync());
|
|
1813
|
-
}
|
|
1814
|
-
}, renderersAtSettle;
|
|
1637
|
+
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1638
|
+
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1815
1639
|
}
|
|
1816
1640
|
function unsubscribe(subscribed, serializer) {
|
|
1817
1641
|
for (let i = 0; i < subscribed.length; i += 3) {
|
|
1818
1642
|
let subscribers = subscribed[i], scope = subscribed[i + 1];
|
|
1819
|
-
|
|
1643
|
+
if (!serializer.refs.has(subscribers)) subscribers.delete(scope);
|
|
1644
|
+
else {
|
|
1645
|
+
let channel = subscribed[i + 2];
|
|
1646
|
+
dropQueuedCall(serializer, scope, subscribers, "add", channel) || queueCall(serializer, scope, subscribers, "delete", channel);
|
|
1647
|
+
}
|
|
1820
1648
|
}
|
|
1821
1649
|
}
|
|
1822
|
-
function clearTryRenderers(branchId) {
|
|
1823
|
-
writeScope(branchId, {
|
|
1824
|
-
E: 0,
|
|
1825
|
-
Q: _scope_with_id(branchId).Q && 0
|
|
1826
|
-
});
|
|
1827
|
-
}
|
|
1828
|
-
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
1829
|
-
writeScope(branchId, {
|
|
1830
|
-
E: catchContent,
|
|
1831
|
-
Q: placeholderContent
|
|
1832
|
-
});
|
|
1833
|
-
}
|
|
1834
1650
|
function countResumeWrite(chunk) {
|
|
1835
1651
|
for (let boundary = chunk.boundary; boundary; boundary = boundary.parent) boundary.resumeWrites++;
|
|
1652
|
+
}
|
|
1653
|
+
function writeAsyncVisits(chunk) {
|
|
1836
1654
|
for (let async = getAsyncContent(chunk); async && !async.resumed; async = async.parent) async.resumed = !0, async.end?.writeHTML(async.visit);
|
|
1837
1655
|
}
|
|
1838
1656
|
function getAsyncContent(chunk) {
|
|
1839
|
-
return chunk.context?.[
|
|
1657
|
+
return chunk.context?.[kAsyncContent];
|
|
1840
1658
|
}
|
|
1841
1659
|
var State = class {
|
|
1842
1660
|
tagId = 1;
|
|
1843
1661
|
scopeId = 1;
|
|
1844
1662
|
reorderId = 1;
|
|
1845
1663
|
readyGate = 1;
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1664
|
+
hasWrittenGlobals = !1;
|
|
1665
|
+
needsWalkerRuntime = !1;
|
|
1666
|
+
hasWalkerRuntime = !1;
|
|
1667
|
+
hasWrittenReady = !1;
|
|
1850
1668
|
hasReorderRuntime = !1;
|
|
1851
1669
|
hasWrittenResume = !1;
|
|
1852
1670
|
walkOnNextFlush = !1;
|
|
1853
1671
|
trailerHTML = "";
|
|
1854
1672
|
resumes = "";
|
|
1855
1673
|
nonceAttr = "";
|
|
1856
|
-
serializer = new
|
|
1674
|
+
serializer = new State$1();
|
|
1857
1675
|
writeReorders = null;
|
|
1858
1676
|
scopes = /* @__PURE__ */ new Map();
|
|
1859
1677
|
scope = (scopeId) => scopeWithId(this, scopeId);
|
|
@@ -1865,13 +1683,36 @@ var State = class {
|
|
|
1865
1683
|
constructor($global) {
|
|
1866
1684
|
this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
1867
1685
|
}
|
|
1868
|
-
|
|
1686
|
+
joinFlush(html, scripts, pending) {
|
|
1869
1687
|
let { $global, nonceAttr } = this, { __flush__ } = $global;
|
|
1870
1688
|
return scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), pending ? html : html + this.trailerHTML;
|
|
1871
1689
|
}
|
|
1872
1690
|
walkScript() {
|
|
1873
1691
|
return this.runtimePrefix + ".w()";
|
|
1874
1692
|
}
|
|
1693
|
+
addResumes(channel, resumes) {
|
|
1694
|
+
channel.resumes = concatSequence(channel.resumes, resumes);
|
|
1695
|
+
}
|
|
1696
|
+
queueScope(target, scopeId, partialScope) {
|
|
1697
|
+
let pending = target.writeScopes[scopeId];
|
|
1698
|
+
pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0;
|
|
1699
|
+
}
|
|
1700
|
+
queuePassiveScope(target, scopeId, partialScope) {
|
|
1701
|
+
let passive = target.passiveScopes ||= {};
|
|
1702
|
+
passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope);
|
|
1703
|
+
}
|
|
1704
|
+
queueEffect(scopeId, registryId) {
|
|
1705
|
+
this.needsWalkerRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1706
|
+
}
|
|
1707
|
+
serializeFlush(boundary) {
|
|
1708
|
+
flushSerializer(boundary, this);
|
|
1709
|
+
}
|
|
1710
|
+
runtimeScript() {
|
|
1711
|
+
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,d:t,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 + "\")";
|
|
1712
|
+
}
|
|
1713
|
+
keepsTryMarks(chunk, resumeWrites) {
|
|
1714
|
+
return chunk !== $chunk || chunk.boundary.resumeWrites !== resumeWrites;
|
|
1715
|
+
}
|
|
1875
1716
|
resumeScript(resumes) {
|
|
1876
1717
|
return this.hasWrittenResume ? this.runtimePrefix + ".r.push(" + resumes + ")" : (this.hasWrittenResume = !0, this.runtimePrefix + ".r=[" + resumes + "]");
|
|
1877
1718
|
}
|
|
@@ -1884,11 +1725,11 @@ var State = class {
|
|
|
1884
1725
|
return $global.runtimeId + $global.renderId;
|
|
1885
1726
|
}
|
|
1886
1727
|
reorder(chunk) {
|
|
1887
|
-
this.writeReorders ? this.writeReorders.push(chunk) : (this.
|
|
1728
|
+
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsWalkerRuntime = !0, this.writeReorders = [chunk]);
|
|
1888
1729
|
}
|
|
1889
|
-
|
|
1730
|
+
readyScript(id, resumes) {
|
|
1890
1731
|
let readyKey = toObjectKey(id);
|
|
1891
|
-
return this.readyIds?.has(id) ? this.readyAccess(readyKey) + ".push(" + resumes + ")" : ((this.readyIds ||= /* @__PURE__ */ new Set()).add(id), this.
|
|
1732
|
+
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 + "]}"));
|
|
1892
1733
|
}
|
|
1893
1734
|
readyAccess(readyKey) {
|
|
1894
1735
|
return this.runtimePrefix + ".b" + toAccess(readyKey);
|
|
@@ -1930,7 +1771,7 @@ var State = class {
|
|
|
1930
1771
|
this.abort(event.target.reason);
|
|
1931
1772
|
}
|
|
1932
1773
|
flush() {
|
|
1933
|
-
return this.aborted ||
|
|
1774
|
+
return this.aborted || this.state.serializeFlush(this), this.count ? 1 : this.aborted ? 2 : 0;
|
|
1934
1775
|
}
|
|
1935
1776
|
startAsync() {
|
|
1936
1777
|
this.aborted || this.count++;
|
|
@@ -1955,18 +1796,21 @@ var State = class {
|
|
|
1955
1796
|
boundary;
|
|
1956
1797
|
next;
|
|
1957
1798
|
context;
|
|
1958
|
-
|
|
1959
|
-
constructor(boundary, next, context,
|
|
1960
|
-
this.boundary = boundary, this.next = next, this.context = context, this.
|
|
1799
|
+
channel;
|
|
1800
|
+
constructor(boundary, next, context, channel) {
|
|
1801
|
+
this.boundary = boundary, this.next = next, this.context = context, this.channel = channel;
|
|
1961
1802
|
}
|
|
1962
1803
|
fork(boundary, next) {
|
|
1963
|
-
return new Chunk(boundary, next, this.context, this.
|
|
1804
|
+
return new Chunk(boundary, next, this.context, this.channel);
|
|
1805
|
+
}
|
|
1806
|
+
forkRest(boundary) {
|
|
1807
|
+
return $chunk = this.fork(boundary, this.next);
|
|
1964
1808
|
}
|
|
1965
1809
|
writeHTML(html) {
|
|
1966
1810
|
this.html += html;
|
|
1967
1811
|
}
|
|
1968
1812
|
writeEffect(scopeId, registryId) {
|
|
1969
|
-
countResumeWrite(this), this.lastEffect === registryId ? this.effects = concatEffects(this.effects, scopeId + "") : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1813
|
+
countResumeWrite(this), writeAsyncVisits(this), this.lastEffect === registryId ? this.effects = concatEffects(this.effects, scopeId + "") : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1970
1814
|
}
|
|
1971
1815
|
writeScript(script) {
|
|
1972
1816
|
this.scripts = concatScripts(this.scripts, script);
|
|
@@ -1983,7 +1827,7 @@ var State = class {
|
|
|
1983
1827
|
return this.deferredReady = null, deferredReady;
|
|
1984
1828
|
}
|
|
1985
1829
|
deferOwnReady() {
|
|
1986
|
-
if (this.
|
|
1830
|
+
if (this.channel.readyId && (this.effects || this.scripts || this.channel.flushScopes)) {
|
|
1987
1831
|
let deferred = this.fork(this.boundary, null);
|
|
1988
1832
|
deferred.effects = this.effects, deferred.scripts = this.scripts, this.effects = this.scripts = this.lastEffect = "", this.deferredReady = concat(deferred, this.deferredReady);
|
|
1989
1833
|
}
|
|
@@ -2021,9 +1865,9 @@ var State = class {
|
|
|
2021
1865
|
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId + "";
|
|
2022
1866
|
this.writeHTML(state.mark("!^", reorderId));
|
|
2023
1867
|
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
2024
|
-
if (this.render(
|
|
1868
|
+
if (this.render(withBranchId, placeholderBranchId, placeholder.render) !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.boundary.aborted) return !0;
|
|
2025
1869
|
let stateful = this.effects !== effects;
|
|
2026
|
-
return applyBranchStart(this, beforeBranch, stateful), stateful && (this.render(
|
|
1870
|
+
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;
|
|
2027
1871
|
}
|
|
2028
1872
|
markCatchRange() {
|
|
2029
1873
|
let { catchRange } = this;
|
|
@@ -2039,14 +1883,14 @@ var State = class {
|
|
|
2039
1883
|
consume(boundary) {
|
|
2040
1884
|
this.renderPlaceholders(boundary);
|
|
2041
1885
|
let cur = this, html = "", effects = "", scripts = "", effectsEnd, heldEffects = this.heldEffects, deferredReady;
|
|
2042
|
-
for (this.heldEffects = null, this.
|
|
2043
|
-
return cur.deferOwnReady(), effects && (cur.
|
|
1886
|
+
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;
|
|
1887
|
+
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;
|
|
2044
1888
|
}
|
|
2045
|
-
render(content, val) {
|
|
1889
|
+
render(content, val, val2) {
|
|
2046
1890
|
let prev = $chunk;
|
|
2047
1891
|
$chunk = this;
|
|
2048
1892
|
try {
|
|
2049
|
-
return content(val), $chunk;
|
|
1893
|
+
return content(val, val2), $chunk;
|
|
2050
1894
|
} catch (err) {
|
|
2051
1895
|
return this.boundary.abort(err), this;
|
|
2052
1896
|
} finally {
|
|
@@ -2054,35 +1898,35 @@ var State = class {
|
|
|
2054
1898
|
}
|
|
2055
1899
|
}
|
|
2056
1900
|
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
2057
|
-
let {
|
|
1901
|
+
let { channel } = this, { readyId } = channel, scripts = "", held = this.takeDeferredReady();
|
|
2058
1902
|
if (held) for (let chunk of Array.isArray(held) ? held : [held]) chunk.boundary.aborted || (scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk)));
|
|
2059
1903
|
if (readyId && !this.async) {
|
|
2060
1904
|
let { state } = boundary;
|
|
2061
|
-
flushSerializer(boundary,
|
|
2062
|
-
let deps = state.serializer
|
|
2063
|
-
if (
|
|
2064
|
-
state.
|
|
1905
|
+
flushSerializer(boundary, channel);
|
|
1906
|
+
let deps = takeChannelDeps(state.serializer), effects = holdEffects ? "" : this.effects, { resumes } = channel, chunkScripts = this.scripts;
|
|
1907
|
+
if (channel.resumes = this.scripts = "", effects && (this.effects = this.lastEffect = ""), resumes || effects) {
|
|
1908
|
+
state.needsWalkerRuntime = !0;
|
|
2065
1909
|
let batch = concatSequence(depsMarker(deps), concatSequence(resumes, effects && `"${effects}"`));
|
|
2066
1910
|
if (reservations) {
|
|
2067
1911
|
let gate = state.readyGate++;
|
|
2068
|
-
reservations.push(state.
|
|
2069
|
-
} else scripts = concatScripts(scripts, state.
|
|
1912
|
+
reservations.push(state.readyScript(readyId, gate + "")), scripts = concatScripts(scripts, "(b=>b.splice(b.indexOf(" + gate + "),1," + batch + "))(" + state.readyAccess(toObjectKey(readyId)) + ")");
|
|
1913
|
+
} else scripts = concatScripts(scripts, state.readyScript(readyId, batch));
|
|
2070
1914
|
}
|
|
2071
1915
|
scripts = concatScripts(scripts, chunkScripts);
|
|
2072
1916
|
}
|
|
2073
1917
|
return scripts;
|
|
2074
1918
|
}
|
|
2075
|
-
|
|
2076
|
-
let { state } = boundary, {
|
|
1919
|
+
flush(boundary) {
|
|
1920
|
+
let { state } = boundary, { runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
2077
1921
|
needsWalk && (state.walkOnNextFlush = !1), flushSerializer(boundary, state);
|
|
2078
1922
|
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
2079
|
-
for (let channel; !boundary.aborted && (channel = state.serializer
|
|
2080
|
-
let resumes = state.serializer
|
|
2081
|
-
state.
|
|
1923
|
+
for (let channel; !boundary.aborted && (channel = pendingReadyChannel(state.serializer));) {
|
|
1924
|
+
let resumes = stringifyScopes(state.serializer, [], boundary, channel), deps = takeChannelDeps(state.serializer);
|
|
1925
|
+
state.needsWalkerRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.readyScript(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
2082
1926
|
}
|
|
2083
1927
|
readyResumeScripts && (needsWalk = !0);
|
|
2084
1928
|
let effects = this.async ? "" : joinHeldEffects(this.takeHeldEffects(), this.effects), { html, scripts } = this;
|
|
2085
|
-
html && state.hasReorderRuntime && (html = state.mark("*", "") + html), state.
|
|
1929
|
+
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, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\"");
|
|
2086
1930
|
let reordered = "", needsResumeArray = !1;
|
|
2087
1931
|
if (state.writeReorders) {
|
|
2088
1932
|
for (let reorderedChunk of state.writeReorders) {
|
|
@@ -2108,9 +1952,9 @@ var State = class {
|
|
|
2108
1952
|
}
|
|
2109
1953
|
flushHTML(boundary) {
|
|
2110
1954
|
let { state } = boundary;
|
|
2111
|
-
this.
|
|
1955
|
+
this.flush(boundary);
|
|
2112
1956
|
let { html, scripts } = this;
|
|
2113
|
-
return this.html = this.scripts = "", state.
|
|
1957
|
+
return this.html = this.scripts = "", state.joinFlush(html, scripts, boundary.count);
|
|
2114
1958
|
}
|
|
2115
1959
|
};
|
|
2116
1960
|
function renderReorderPlaceholders(reorder, reorders) {
|
|
@@ -2129,7 +1973,7 @@ function followHeldEffects(chunk) {
|
|
|
2129
1973
|
held !== chunk && (held.effects = concatEffects(held.effects, chunk.effects), chunk.effects = "");
|
|
2130
1974
|
}
|
|
2131
1975
|
function lastHeldOf(held, cur) {
|
|
2132
|
-
return cur.
|
|
1976
|
+
return cur.channel === held.channel && cur.boundary === held.boundary ? cur : held;
|
|
2133
1977
|
}
|
|
2134
1978
|
function holdEffectsOn(heldEffects, chunk, effects) {
|
|
2135
1979
|
return chunk.effects = effects, push(heldEffects, chunk);
|
|
@@ -2139,7 +1983,7 @@ function isWithin(boundary, outer) {
|
|
|
2139
1983
|
return !!boundary;
|
|
2140
1984
|
}
|
|
2141
1985
|
function holdReorderEffects(head, boundary, effects) {
|
|
2142
|
-
head.
|
|
1986
|
+
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);
|
|
2143
1987
|
}
|
|
2144
1988
|
function joinHeldEffects(heldEffects, effects) {
|
|
2145
1989
|
return concatEffects(reduce(heldEffects, joinUncaught, ""), effects);
|
|
@@ -2147,16 +1991,16 @@ function joinHeldEffects(heldEffects, effects) {
|
|
|
2147
1991
|
function joinUncaught(joined, held) {
|
|
2148
1992
|
return held.boundary.aborted ? joined : concatEffects(joined, held.effects);
|
|
2149
1993
|
}
|
|
2150
|
-
function flushSerializer(boundary,
|
|
2151
|
-
let { state } = boundary, { serializer } = state, pending = serializer.
|
|
2152
|
-
if (
|
|
2153
|
-
let { writeScopes, passiveScopes } =
|
|
1994
|
+
function flushSerializer(boundary, channel) {
|
|
1995
|
+
let { state } = boundary, { serializer } = state, pending = hasMatchingCalls(serializer, channel.readyId);
|
|
1996
|
+
if (channel.flushScopes || pending) {
|
|
1997
|
+
let { writeScopes, passiveScopes } = channel, flushes = [];
|
|
2154
1998
|
if (passiveScopes) for (let key in passiveScopes) {
|
|
2155
1999
|
let props = writeScopes[key];
|
|
2156
2000
|
props && (writeScopes[key] = Object.assign(passiveScopes[key], props), delete passiveScopes[key]);
|
|
2157
2001
|
}
|
|
2158
|
-
if (!
|
|
2159
|
-
state.
|
|
2002
|
+
if (!channel.readyId && !state.hasWrittenGlobals) {
|
|
2003
|
+
state.hasWrittenGlobals = !0;
|
|
2160
2004
|
let globals = getFilteredGlobals(state.$global);
|
|
2161
2005
|
globals && flushes.push([
|
|
2162
2006
|
0,
|
|
@@ -2172,12 +2016,12 @@ function flushSerializer(boundary, serializeState) {
|
|
|
2172
2016
|
props
|
|
2173
2017
|
]);
|
|
2174
2018
|
}
|
|
2175
|
-
(flushes.length || pending) && (
|
|
2019
|
+
(flushes.length || pending) && (channel.readyId && !state.hasWrittenGlobals && flushSerializerGlobals(boundary), state.addResumes(channel, stringifyScopes(serializer, flushes, boundary, channel))), channel.writeScopes = {}, channel.flushScopes = !1, pending && (state.walkOnNextFlush = !0);
|
|
2176
2020
|
}
|
|
2177
2021
|
}
|
|
2178
2022
|
function flushSerializerGlobals(boundary) {
|
|
2179
2023
|
let { state } = boundary, globals = getFilteredGlobals(state.$global);
|
|
2180
|
-
globals && (state.
|
|
2024
|
+
globals && (state.hasWrittenGlobals = !0, state.needsWalkerRuntime = !0, state.resumes = concatSequence(state.resumes, stringifyScopes(state.serializer, [[
|
|
2181
2025
|
0,
|
|
2182
2026
|
globals,
|
|
2183
2027
|
globals
|
|
@@ -2461,11 +2305,11 @@ function writeLoadAsset(assetId, flush, triggers) {
|
|
|
2461
2305
|
let g = $global();
|
|
2462
2306
|
writeAsset(g, addAsset(g, assetId, flush, triggers));
|
|
2463
2307
|
}
|
|
2464
|
-
function withPageAssets(template,
|
|
2308
|
+
function withPageAssets(template, flush, assetId, runtimeId) {
|
|
2465
2309
|
return Object.assign((input) => {
|
|
2466
2310
|
let g = $global();
|
|
2467
2311
|
runtimeId && (g[kAssets] || (g.runtimeId = runtimeId));
|
|
2468
|
-
let asset = addAsset(g, assetId,
|
|
2312
|
+
let asset = addAsset(g, assetId, flush);
|
|
2469
2313
|
return g.__flush__ ? (writeAsset(g, asset), writeWaitReady(assetId, template, input)) : (g.__flush__ = flushPage, template(input));
|
|
2470
2314
|
}, template);
|
|
2471
2315
|
}
|
|
@@ -2536,6 +2380,212 @@ function toObjectExpression(options) {
|
|
|
2536
2380
|
//#endregion
|
|
2537
2381
|
//#region src/common/compat-meta.ts
|
|
2538
2382
|
//#endregion
|
|
2383
|
+
//#region src/common/for.ts
|
|
2384
|
+
function forIn(obj, cb) {
|
|
2385
|
+
for (let key in obj) cb(key, obj[key]);
|
|
2386
|
+
}
|
|
2387
|
+
function forOf(list, cb) {
|
|
2388
|
+
if (list) {
|
|
2389
|
+
let i = 0;
|
|
2390
|
+
for (let item of list) cb(item, i++);
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
function forTo(to, from, step, cb) {
|
|
2394
|
+
let start = from || 0, delta = step || 1;
|
|
2395
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
2396
|
+
}
|
|
2397
|
+
function forUntil(until, from, step, cb) {
|
|
2398
|
+
let start = from || 0, delta = step || 1;
|
|
2399
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
2400
|
+
}
|
|
2401
|
+
//#endregion
|
|
2402
|
+
//#region src/html/for.ts
|
|
2403
|
+
function forOfBy(by, item, index) {
|
|
2404
|
+
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
|
2405
|
+
}
|
|
2406
|
+
function forInBy(by, name, value) {
|
|
2407
|
+
return by ? by(name, value) : name;
|
|
2408
|
+
}
|
|
2409
|
+
function forStepBy(by, index) {
|
|
2410
|
+
return by ? by(index) : index;
|
|
2411
|
+
}
|
|
2412
|
+
//#endregion
|
|
2413
|
+
//#region src/html/control-flow.ts
|
|
2414
|
+
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
2415
|
+
display ? resumesMarker(markerGuard, branchExprGuard, parentEndTag) && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
2416
|
+
}
|
|
2417
|
+
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2418
|
+
let branchId = _scope_id(), wrap = !display;
|
|
2419
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
2420
|
+
}
|
|
2421
|
+
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2422
|
+
forBranches(by, cb, iterateForOf(list, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2423
|
+
}
|
|
2424
|
+
function iterateForOf(list, cb, by) {
|
|
2425
|
+
return (each) => each ? forOf(list, (item, index) => {
|
|
2426
|
+
let itemKey = forOfBy(by, item, index);
|
|
2427
|
+
each(itemKey, itemKey === index, item, index);
|
|
2428
|
+
}) : forOf(list, cb);
|
|
2429
|
+
}
|
|
2430
|
+
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2431
|
+
forBranches(by, cb, iterateForIn(obj, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2432
|
+
}
|
|
2433
|
+
function iterateForIn(obj, cb, by) {
|
|
2434
|
+
return (each) => each ? forIn(obj, (key, value) => {
|
|
2435
|
+
each(forInBy(by, key, value), !1, key, value);
|
|
2436
|
+
}) : forIn(obj, cb);
|
|
2437
|
+
}
|
|
2438
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2439
|
+
forBranches(by, cb, iterateForTo(to, from, step, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2440
|
+
}
|
|
2441
|
+
function iterateForTo(to, from, step, cb, by) {
|
|
2442
|
+
return (each) => {
|
|
2443
|
+
let index = 0;
|
|
2444
|
+
return each ? forTo(to, from, step, (value) => {
|
|
2445
|
+
let itemKey = forStepBy(by, value);
|
|
2446
|
+
each(itemKey, itemKey === index++, value);
|
|
2447
|
+
}) : forTo(to, from, step, cb);
|
|
2448
|
+
};
|
|
2449
|
+
}
|
|
2450
|
+
function _for_until(until, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2451
|
+
forBranches(by, cb, iterateForUntil(until, from, step, cb, by), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
2452
|
+
}
|
|
2453
|
+
function iterateForUntil(until, from, step, cb, by) {
|
|
2454
|
+
return (each) => {
|
|
2455
|
+
let index = 0;
|
|
2456
|
+
return each ? forUntil(until, from, step, (value) => {
|
|
2457
|
+
let itemKey = forStepBy(by, value);
|
|
2458
|
+
each(itemKey, itemKey === index++, value);
|
|
2459
|
+
}) : forUntil(until, from, step, cb);
|
|
2460
|
+
};
|
|
2461
|
+
}
|
|
2462
|
+
function forBranches(by, cb, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2463
|
+
if (branchGuard === 0) {
|
|
2464
|
+
iterate(0), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
2465
|
+
return;
|
|
2466
|
+
}
|
|
2467
|
+
let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
|
|
2468
|
+
iterate((itemKey, sameAsIndex, a, b) => {
|
|
2469
|
+
let branchId = _peek_scope_id();
|
|
2470
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, cb, a, b);
|
|
2471
|
+
let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
|
|
2472
|
+
resumeMarker || (loopScopes = push(loopScopes, branchScope));
|
|
2473
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
2474
|
+
}
|
|
2475
|
+
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2476
|
+
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 ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
2477
|
+
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
2478
|
+
["D" + accessor]: branchIndex || void 0,
|
|
2479
|
+
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
2480
|
+
}), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
2481
|
+
}
|
|
2482
|
+
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
2483
|
+
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
2484
|
+
}
|
|
2485
|
+
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
2486
|
+
let endTag = parentEndTag || "";
|
|
2487
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
2488
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
2489
|
+
$chunk.writeHTML(mark + endTag);
|
|
2490
|
+
} else markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
2491
|
+
}
|
|
2492
|
+
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
2493
|
+
let resumeMarker = markerGuard !== 0;
|
|
2494
|
+
if (!isPromise(promise)) {
|
|
2495
|
+
if (resumeMarker) {
|
|
2496
|
+
let branchId = _peek_scope_id();
|
|
2497
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, content, promise), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
2498
|
+
} else content(promise);
|
|
2499
|
+
return;
|
|
2500
|
+
}
|
|
2501
|
+
let chunk = $chunk, { boundary } = chunk, startId = _peek_scope_id(), after = chunk.next = chunk.forkRest(boundary);
|
|
2502
|
+
chunk.async = !0, captureContext(chunk), boundary.startAsync(), promise.then((value) => {
|
|
2503
|
+
if (chunk.async && (chunk.async = !1, !boundary.aborted)) {
|
|
2504
|
+
let { state } = boundary;
|
|
2505
|
+
chunk.render(() => {
|
|
2506
|
+
if (resumeMarker) {
|
|
2507
|
+
let branchId = _peek_scope_id();
|
|
2508
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withAsyncContent({ parent: getAsyncContent(chunk) }, content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
2509
|
+
} else {
|
|
2510
|
+
let renderedSince = _peek_scope_id() !== startId, async = { parent: getAsyncContent(chunk) };
|
|
2511
|
+
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;
|
|
2512
|
+
}
|
|
2513
|
+
}), !chunk.async && boundary.pendingReorders?.delete(chunk) && state.reorder(chunk), boundary.endAsync();
|
|
2514
|
+
}
|
|
2515
|
+
}, (err) => {
|
|
2516
|
+
chunk.async = !1, boundary.abort(err);
|
|
2517
|
+
});
|
|
2518
|
+
}
|
|
2519
|
+
function _try(scopeId, accessor, content, placeholderContent, catchContent, placeholderId, catchId) {
|
|
2520
|
+
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);
|
|
2521
|
+
applyBranchStart(chunk, beforeBranch, keepsMarks), keepsMarks && (writesRenderers || renderers(), $chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId)));
|
|
2522
|
+
}
|
|
2523
|
+
function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
|
|
2524
|
+
let chunk = $chunk, { boundary } = chunk, body = chunk.fork(boundary, null);
|
|
2525
|
+
if (body === body.render(content)) {
|
|
2526
|
+
chunk.append(body);
|
|
2527
|
+
return;
|
|
2528
|
+
}
|
|
2529
|
+
chunk.next = chunk.forkRest(boundary), captureContext(chunk), chunk.placeholder = {
|
|
2530
|
+
body,
|
|
2531
|
+
render: placeholder,
|
|
2532
|
+
branchId,
|
|
2533
|
+
scopeId,
|
|
2534
|
+
placeholderBranchId
|
|
2535
|
+
};
|
|
2536
|
+
}
|
|
2537
|
+
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
2538
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, bodyBoundary = new Boundary(state, void 0, boundary);
|
|
2539
|
+
catchContent && (bodyBoundary.withinCatch = !0);
|
|
2540
|
+
let body = chunk.fork(bodyBoundary, null), bodyEnd = body.render(withBranchId, branchId, content);
|
|
2541
|
+
if (bodyBoundary.aborted) {
|
|
2542
|
+
if (!catchContent) throw bodyBoundary.reason;
|
|
2543
|
+
return catchContent(bodyBoundary.reason), !0;
|
|
2544
|
+
}
|
|
2545
|
+
if (body === bodyEnd) return chunk.append(body), !1;
|
|
2546
|
+
let renderersAtSettle = !bodyBoundary.resumeWrites, bodyNext = bodyEnd.next = chunk.forkRest(boundary);
|
|
2547
|
+
chunk.next = body, boundary.startAsync();
|
|
2548
|
+
let reorderId = catchContent ? state.nextReorderId() : "";
|
|
2549
|
+
return reorderId && (chunk.catchRange = {
|
|
2550
|
+
id: reorderId,
|
|
2551
|
+
end: bodyEnd
|
|
2552
|
+
}, captureContext(chunk)), bodyBoundary.onNext = () => {
|
|
2553
|
+
if (!boundary.aborted) {
|
|
2554
|
+
if (bodyBoundary.aborted) {
|
|
2555
|
+
if (!reorderId) {
|
|
2556
|
+
boundary.abort(bodyBoundary.reason);
|
|
2557
|
+
return;
|
|
2558
|
+
}
|
|
2559
|
+
let streamed = !chunk.catchRange, catchChunk = chunk.fork(boundary, null);
|
|
2560
|
+
chunk.catchRange = null, renderersAtSettle || catchChunk.render(clearTryRenderers, branchId);
|
|
2561
|
+
let inOrder = catchChunk === catchChunk.render(catchContent, bodyBoundary.reason);
|
|
2562
|
+
if (boundary.aborted) return;
|
|
2563
|
+
if ((bodyEnd.consumed || !inOrder) && (catchChunk.reorderBranch = branchId), bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
2564
|
+
else {
|
|
2565
|
+
let reorder = null;
|
|
2566
|
+
inOrder ? streamed && (reorder = chunk.fork(boundary, null)) : reorder = catchChunk, reorder && (reorder.reorderId = reorderId);
|
|
2567
|
+
let endMarker = state.mark("!", reorderId), cut = body;
|
|
2568
|
+
for (; cut.consumed;) cut = cut.next;
|
|
2569
|
+
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);
|
|
2570
|
+
}
|
|
2571
|
+
boundary.endAsync();
|
|
2572
|
+
} else bodyBoundary.count ? boundary.onNext() : (renderersAtSettle && bodyBoundary.resumeWrites && bodyEnd.render(renderers), chunk.catchRange = null, boundary.endAsync());
|
|
2573
|
+
}
|
|
2574
|
+
}, renderersAtSettle;
|
|
2575
|
+
}
|
|
2576
|
+
function clearTryRenderers(branchId) {
|
|
2577
|
+
writeScope(branchId, {
|
|
2578
|
+
E: 0,
|
|
2579
|
+
Q: _scope_with_id(branchId).Q && 0
|
|
2580
|
+
});
|
|
2581
|
+
}
|
|
2582
|
+
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
2583
|
+
writeScope(branchId, {
|
|
2584
|
+
E: catchContent,
|
|
2585
|
+
Q: placeholderContent
|
|
2586
|
+
});
|
|
2587
|
+
}
|
|
2588
|
+
//#endregion
|
|
2539
2589
|
//#region src/html/compat.ts
|
|
2540
2590
|
function drainClassFunctions($global, writeScope) {
|
|
2541
2591
|
let pending = pendingClassFunctions.get($global), scopeByHost = {};
|