@solidjs/web 2.0.0-rc.21 → 2.0.0-rc.23

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.
@@ -1,4 +1,4 @@
1
- import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';
1
+ import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, createRoot, $PROXY, runWithOwner, createOwner, onCleanup, createComponent, omit, getNextChildId } from 'solid-js';
2
2
  export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
3
  import { sharedConfig, ssrSanitizeError, beginEdgesRender, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
4
4
  export { ssrScope as scope } from 'solid-js/internal';
@@ -295,6 +295,24 @@ function traceMetaMarkup(record) {
295
295
  }
296
296
  return markup;
297
297
  }
298
+ function sharedCacheMayStore(cacheControl, cdnCacheControl) {
299
+ return mayStore(cacheControl, true) || mayStore(cdnCacheControl, false);
300
+ }
301
+ const DIRECTIVE = /([^\s=,]+)\s*(=\s*(?:"(?:[^"\\]|\\.)*"?|[^,]*))?/g;
302
+ function mayStore(value, asks) {
303
+ if (value === null) return false;
304
+ let shared = !asks;
305
+ for (const [, directive, argument] of value.matchAll(DIRECTIVE)) {
306
+ const name = directive.toLowerCase();
307
+ if (name === "no-store" || name === "private" && !argument) return false;
308
+ if (name === "public" || name === "s-maxage") shared = true;
309
+ }
310
+ return shared;
311
+ }
312
+ function withholdForSharedCache(record, event) {
313
+ const headers = event && event.response && event.response.headers;
314
+ if (record.emit && headers && sharedCacheMayStore(headers.get("Cache-Control"), headers.get("CDN-Cache-Control"))) record.emit = false;
315
+ }
298
316
 
299
317
  const RECORDS = Symbol.for("@solidjs/signals/observe/records");
300
318
  function records() {
@@ -367,7 +385,15 @@ function rewriteTree(value, visit, withPath) {
367
385
  } catch (err) {
368
386
  if (err !== CYCLE) throw err;
369
387
  }
370
- return clone(value, visit, path, state.memo || (state.memo = new Map()));
388
+ const memo = state.memo || (state.memo = new Map());
389
+ const marks = {
390
+ at: new Map(),
391
+ stack: [],
392
+ changed: new Set(),
393
+ next: 0
394
+ };
395
+ mark(value, visit, path, memo, marks);
396
+ return clone(value, memo, marks.changed);
371
397
  }
372
398
  function shape(value) {
373
399
  return Array.isArray(value) ? 1 : Object.getPrototypeOf(value) === Object.prototype ? 2 : 0;
@@ -415,28 +441,73 @@ function cow(value, visit, path, depth, state) {
415
441
  if (ancestors !== undefined) ancestors.delete(value);
416
442
  return out;
417
443
  }
418
- function clone(value, visit, path, memo) {
419
- if (memo.has(value)) return memo.get(value);
444
+ function mark(value, visit, path, memo, m) {
445
+ const seen = m.at.get(value);
446
+ if (seen !== undefined) return seen;
447
+ if (memo.has(value)) return -1;
420
448
  const r = visit(value, path);
421
449
  if (r !== DESCEND) {
422
450
  memo.set(value, r);
423
- return r;
451
+ return -1;
424
452
  }
425
453
  const s = shape(value);
426
- if (s === 0) return value;
427
- const out = s === 1 ? value.slice() : {
454
+ if (s === 0) return -1;
455
+ const index = m.next++;
456
+ let low = index;
457
+ let changed = false;
458
+ let open = false;
459
+ const keys = s === 1 ? value : Object.keys(value);
460
+ for (let i = 0; i < keys.length; i++) {
461
+ const k = s === 1 ? i : keys[i];
462
+ const c = value[k];
463
+ if (c === null || typeof c !== "object") continue;
464
+ if (!open) {
465
+ open = true;
466
+ m.at.set(value, index);
467
+ m.stack.push(value);
468
+ }
469
+ const l = mark(c, visit, undefined , memo, m);
470
+ if (l >= 0 && l < low) low = l;
471
+ if (memo.has(c) && memo.get(c) !== c || l === Infinity && m.changed.has(c)) changed = true;
472
+ }
473
+ if (!open) return -1;
474
+ if (low === index) {
475
+ m.at.set(value, Infinity);
476
+ if (m.stack[m.stack.length - 1] === value) {
477
+ m.stack.pop();
478
+ if (changed) m.changed.add(value);
479
+ return Infinity;
480
+ }
481
+ const members = m.stack.splice(m.stack.lastIndexOf(value));
482
+ if (!changed) for (const n of members) if (m.changed.has(n)) {
483
+ changed = true;
484
+ break;
485
+ }
486
+ for (const n of members) {
487
+ m.at.set(n, Infinity);
488
+ if (changed) m.changed.add(n);
489
+ }
490
+ return Infinity;
491
+ }
492
+ if (changed) m.changed.add(value);
493
+ return low;
494
+ }
495
+ function clone(value, memo, changed) {
496
+ if (memo.has(value)) return memo.get(value);
497
+ if (!changed.has(value)) return value;
498
+ const out = Array.isArray(value) ? value.slice() : {
428
499
  ...value
429
500
  };
430
501
  memo.set(value, out);
431
- if (s === 1) {
502
+ if (Array.isArray(value)) {
432
503
  for (let i = 0; i < value.length; i++) {
433
504
  const c = value[i];
434
- if (c !== null && typeof c === "object") out[i] = clone(c, visit, undefined , memo);
505
+ if (c !== null && typeof c === "object") out[i] = clone(c, memo, changed);
435
506
  }
436
507
  } else {
437
508
  for (const k of Object.keys(value)) {
438
509
  const c = value[k];
439
- if (c !== null && typeof c === "object") out[k] = clone(c, visit, undefined , memo);
510
+ if (c !== null && typeof c === "object") out[k] = clone(c, memo, changed);
440
511
  }
441
512
  }
442
513
  return out;
@@ -576,7 +647,7 @@ function createKeyedSerializer(serialize, onError, onDone) {
576
647
  stream = serialize(key, value, {
577
648
  onError: onError && (err => {
578
649
  failed = true;
579
- onError(err);
650
+ onError(err, key);
580
651
  if (cancel) {
581
652
  cancel();
582
653
  settle();
@@ -649,7 +720,7 @@ function createHydrationSerializer({
649
720
  });
650
721
  return createKeyedSerializer(late ? late(serialize, refs, onData, scopeId) : serialize, onError, onDone);
651
722
  }
652
- function rejectUnserializedKey(serialize, refs, onData, scopeId) {
723
+ function rejectUnserializedKey(serialize, refs, onData, scopeId, plain) {
653
724
  let taken = 0;
654
725
  let fresh = [];
655
726
  const set = refs.set;
@@ -672,8 +743,9 @@ function rejectUnserializedKey(serialize, refs, onData, scopeId) {
672
743
  if (ref instanceof Promise) ids.add(id + 1);else if (isStream(ref) || Object.getPrototypeOf(ref) === Object.prototype && !Object.keys(ref).length) ids.add(id);
673
744
  }
674
745
  if (!ids.size) return;
675
- const body = "for(const i of[" + [...ids] + "]){const v=$R[i];v&&(v.f?v.f(e):v.throw&&v.throw(e))}";
676
- const message = JSON.stringify("Serialization failed: the hydration value for key " + JSON.stringify(key) + " could not be serialized on the server").replace(/[<\u2028\u2029]/g, c => KEY_ESCAPES[c]);
746
+ const text = plain && plain(key);
747
+ const body = "for(const i of[" + [...ids] + "]){const v=$R[i];v&&(v.f?" + (text === undefined ? "v.f(e)" : "(v.f(e),v.p.s||(v.p.s=2,v.p.v=e))") + ":v.throw&&v.throw(e))}";
748
+ const message = JSON.stringify(text === undefined ? "Serialization failed: the hydration value for key " + JSON.stringify(key) + " could not be serialized on the server" : text).replace(/[<\u2028\u2029]/g, c => KEY_ESCAPES[c]);
677
749
  onData("($R=>{const e=new Error(" + message + ");" + body + "})(" + (scopeId == null ? "$R" : '$R["' + serializeKey(scopeId) + '"]') + ")");
678
750
  };
679
751
  return serialize(key, value, {
@@ -1279,6 +1351,7 @@ function preloadInvalid(field, message, value) {
1279
1351
  }
1280
1352
  });
1281
1353
  }
1354
+ const SSR_NODE = /*#__PURE__*/Symbol.for("solid.ssrNode");
1282
1355
  function unrecognizedInsert(node) {
1283
1356
  devCheck({
1284
1357
  code: "UNRECOGNIZED_INSERT_VALUE",
@@ -1875,7 +1948,8 @@ function tagInfo(tag) {
1875
1948
  textarea: tag === "textarea",
1876
1949
  raw: tag === "script" || tag === "style",
1877
1950
  formDefaults,
1878
- formAttributes
1951
+ formAttributes,
1952
+ sel: tag === "select" ? 1 : tag === "option" ? 2 : 0
1879
1953
  };
1880
1954
  if (tagInfos.size < 512) tagInfos.set(tag, info);
1881
1955
  }
@@ -1976,8 +2050,9 @@ function renderToString(code, options = {}) {
1976
2050
  serializeFragmentAssets("", tracking.boundaryModules, sharedConfig.context, renderId);
1977
2051
  closed = true;
1978
2052
  serializer.close();
2053
+ withholdForSharedCache(context.trace, requestEvent);
1979
2054
  const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
1980
- const document = withShellEnd(assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead, tracking.lowModules), context, renderId, nonce, noScripts);
2055
+ const document = withShellEnd(assembleDocument(html, tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead, tracking.lowModules), context, renderId, nonce, noScripts);
1981
2056
  if (render) render.shell();
1982
2057
  if (requestEvent && requestEvent.response) {
1983
2058
  commitResponseStub(requestEvent.response, {
@@ -2064,7 +2139,8 @@ function renderToStream(code, options = {}) {
2064
2139
  if (render) settleRender(render, rootOwner, disconnect ? "abandoned" : "error");
2065
2140
  const sink = writable;
2066
2141
  buffer = {
2067
- write() {}
2142
+ write() {},
2143
+ flush() {}
2068
2144
  };
2069
2145
  writable = {
2070
2146
  end() {}
@@ -2158,24 +2234,64 @@ function renderToStream(code, options = {}) {
2158
2234
  let stableOrder = false;
2159
2235
  let parkedWrites = null;
2160
2236
  const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
2161
- let writing = 0;
2162
2237
  let stranded = false;
2163
- const handOver = (id, value) => {
2164
- writing++;
2165
- try {
2166
- serializer.write(id, value);
2167
- } finally {
2168
- writing--;
2238
+ let writingRecord = false;
2239
+ let recordFailed = false;
2240
+ const plainRecords = new WeakMap();
2241
+ const caught = new Set();
2242
+ let unclaimed = null;
2243
+ const rejected = new Map();
2244
+ const plainMessage = (id, value) => value != null && typeof value.message === "string" ? value.message : `The error record for key ${JSON.stringify(id)} could not be serialized on the server`;
2245
+ const plainFor = (id, value) => {
2246
+ const keyed = value !== null && typeof value === "object";
2247
+ let plain = keyed && plainRecords.get(value);
2248
+ if (!plain) {
2249
+ plain = new Error(plainMessage(id, value));
2250
+ if (keyed) plainRecords.set(value, plain);
2169
2251
  }
2252
+ return plain;
2170
2253
  };
2171
- const write = (id, value) => {
2172
- if (stableOrder && !dead) (parkedWrites ||= []).push([id, value]);else handOver(id, value);
2254
+ const claim = () => {
2255
+ if (unclaimed) {
2256
+ for (const reason of unclaimed) if (!caught.has(reason)) stranded = true;
2257
+ unclaimed = null;
2258
+ }
2259
+ return stranded;
2260
+ };
2261
+ const claimLater = reason => {
2262
+ if (firstFlushed || stranded || caught.has(reason)) return;
2263
+ if (!unclaimed) {
2264
+ unclaimed = new Set();
2265
+ deferFlush(() => {
2266
+ if (!rootHoles && claim()) abandon();
2267
+ });
2268
+ }
2269
+ unclaimed.add(reason);
2270
+ };
2271
+ const handOver = (id, value, error) => {
2272
+ if (!error || options.serializer) return serializer.write(id, value);
2273
+ let plain = value !== null && typeof value === "object" && plainRecords.get(value);
2274
+ if (!plain) {
2275
+ recordFailed = false;
2276
+ writingRecord = true;
2277
+ try {
2278
+ serializer.write(id, value);
2279
+ } finally {
2280
+ writingRecord = false;
2281
+ }
2282
+ if (!recordFailed) return;
2283
+ plain = plainFor(id, value);
2284
+ }
2285
+ serializer.write(id, plain);
2286
+ };
2287
+ const write = (id, value, error) => {
2288
+ if (stableOrder && !dead) (parkedWrites ||= []).push([id, value, error]);else handOver(id, value, error);
2173
2289
  };
2174
2290
  const flushParkedWrites = () => {
2175
2291
  if (!parkedWrites) return;
2176
2292
  const writes = parkedWrites.sort(byKey);
2177
2293
  parkedWrites = null;
2178
- for (let i = 0; i < writes.length; i++) handOver(writes[i][0], writes[i][1]);
2294
+ for (let i = 0; i < writes.length; i++) handOver(writes[i][0], writes[i][1], writes[i][2]);
2179
2295
  };
2180
2296
  const flushStubBatch = () => {
2181
2297
  if (!stubBatch) return;
@@ -2200,7 +2316,7 @@ function renderToStream(code, options = {}) {
2200
2316
  const onDone = () => {
2201
2317
  if (dead) return;
2202
2318
  writeTasks();
2203
- if (stranded) return abandon();
2319
+ if (claim()) return abandon();
2204
2320
  lastBlockingSize = blockingPromises.size;
2205
2321
  doShell();
2206
2322
  onCompleteAll && onCompleteAll({
@@ -2263,11 +2379,19 @@ function renderToStream(code, options = {}) {
2263
2379
  plugins: options.plugins,
2264
2380
  onData: payload => sink.data(payload),
2265
2381
  onDone,
2266
- onError: err => {
2267
- reportFailure(err, "serialize");
2268
- if (!writing && !options.serializer && !firstFlushed) stranded = true;
2382
+ onError: (err, key) => {
2383
+ const rejection = !options.serializer && !writingRecord && rejected.has(key);
2384
+ const reason = rejection && rejected.get(key);
2385
+ if (!rejection || reason === null || typeof reason !== "object" || !plainRecords.has(reason)) reportFailure(err, "serialize");
2386
+ if (writingRecord) recordFailed = true;else if (rejection) {
2387
+ plainFor(key, reason);
2388
+ claimLater(reason);
2389
+ } else if (!options.serializer && !firstFlushed && !stranded) {
2390
+ stranded = true;
2391
+ deferFlush(() => abandon());
2392
+ }
2269
2393
  },
2270
- late: rejectUnserializedKey
2394
+ late: (serialize, refs, onData, scopeId) => rejectUnserializedKey(serialize, refs, onData, scopeId, key => !firstFlushed && rejected.has(key) ? plainMessage(key, rejected.get(key)) : undefined)
2271
2395
  });
2272
2396
  let rootAssetsSerialized = false;
2273
2397
  const serializeRootAssets = () => {
@@ -2346,7 +2470,10 @@ function renderToStream(code, options = {}) {
2346
2470
  raced.catch(() => {});
2347
2471
  pendingSerialized.set(id, settle);
2348
2472
  const drop = () => pendingSerialized.delete(id);
2349
- p.then(drop, drop);
2473
+ p.then(drop, reason => {
2474
+ drop();
2475
+ rejected.set(id, reason);
2476
+ });
2350
2477
  return raced;
2351
2478
  };
2352
2479
  const abandonSubtree = (key, error) => {
@@ -2509,12 +2636,17 @@ function renderToStream(code, options = {}) {
2509
2636
  const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
2510
2637
  html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
2511
2638
  },
2512
- serialize(id, p, deferStream) {
2639
+ serialize(id, p, deferStream, errorRecord) {
2513
2640
  p = guardChannel(p);
2514
2641
  if (p && typeof p === "object" && typeof p.then === "function") {
2515
2642
  if (!firstFlushed && deferStream) {
2516
2643
  blockingPromises.add(p);
2517
- p.then(d => write(id, d)).catch(e => write(id, e));
2644
+ p.then(d => write(id, d)).catch(e => {
2645
+ rejected.set(id, e);
2646
+ const r = Promise.reject(e);
2647
+ r.catch(() => {});
2648
+ write(id, r);
2649
+ });
2518
2650
  return;
2519
2651
  }
2520
2652
  p = trackSerialized(id, p);
@@ -2523,7 +2655,7 @@ function renderToStream(code, options = {}) {
2523
2655
  return;
2524
2656
  }
2525
2657
  }
2526
- write(id, p);
2658
+ write(id, p, errorRecord);
2527
2659
  },
2528
2660
  escape: escape,
2529
2661
  resolve: resolveSSRNode,
@@ -2597,7 +2729,7 @@ function renderToStream(code, options = {}) {
2597
2729
  const styles = collectStreamStyles(key, tracking, headStyles);
2598
2730
  const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
2599
2731
  if (headOps) emitHeadOps(key, headOps);
2600
- sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : error ? "" : " "), {
2732
+ sink.fragment(key, value !== undefined ? value : error ? "" : " ", {
2601
2733
  styles,
2602
2734
  revealGroup,
2603
2735
  error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
@@ -2628,6 +2760,10 @@ function renderToStream(code, options = {}) {
2628
2760
  context.failRender = failRender;
2629
2761
  context.errorPolicy = options.onError;
2630
2762
  context._errorScope = errorScope;
2763
+ context.contained = (error, wire) => {
2764
+ caught.add(error);
2765
+ caught.add(wire);
2766
+ };
2631
2767
  context.flushed = () => firstFlushed;
2632
2768
  context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
2633
2769
  render = timeDocument(context, context.trace, "stream", requestEvent);
@@ -2743,9 +2879,10 @@ function renderToStream(code, options = {}) {
2743
2879
  }
2744
2880
  serializeRootAssets();
2745
2881
  flushStubBatch();
2882
+ withholdForSharedCache(context.trace, requestEvent);
2746
2883
  const head = renderShellHead(headRegistry, nonce, k => registry.has(k), noScripts, traceMetaMarkup(context.trace));
2747
2884
  if (render) render.shell();
2748
- sink.shell(resolveSSRSelectValues(html), {
2885
+ sink.shell(html, {
2749
2886
  preloads: tracking.emittedAssets,
2750
2887
  preloadLinks: tracking.preloadLinks,
2751
2888
  inlineStyles: tracking.inlineStyles,
@@ -2821,7 +2958,7 @@ function renderToStream(code, options = {}) {
2821
2958
  return;
2822
2959
  }
2823
2960
  if (!shellCompleted) return flush();
2824
- if (stranded) return abandon();
2961
+ if (claim()) return abandon();
2825
2962
  const encoder = new TextEncoder();
2826
2963
  const writer = w.getWriter();
2827
2964
  let pendingWrites = Promise.resolve();
@@ -2921,7 +3058,7 @@ function renderToStream(code, options = {}) {
2921
3058
  return;
2922
3059
  }
2923
3060
  if (!shellCompleted) return flush();
2924
- if (stranded) return abandon();
3061
+ if (claim()) return abandon();
2925
3062
  const sink = guardSink(w);
2926
3063
  buffer = writable = coalesceWrites(sink.write, sink.end);
2927
3064
  buffer.write(tmp);
@@ -2987,6 +3124,8 @@ function buildAsyncWrap(err, node) {
2987
3124
  fn.$rw = true;
2988
3125
  if (suppress) fn.$lhSuppress = true;
2989
3126
  if (node.$lhSkip) fn.$lhSkip = true;
3127
+ if (node.$lhInTag) fn.$lhInTag = true;
3128
+ if (node.$lhAttr) fn.$lhAttr = node.$lhAttr;
2990
3129
  if (node.$lhBinding) fn.$lhBinding = node.$lhBinding;
2991
3130
  return {
2992
3131
  fn,
@@ -3199,7 +3338,8 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3199
3338
  t: [""],
3200
3339
  h: [],
3201
3340
  p: [],
3202
- rows: null
3341
+ rows: null,
3342
+ $: SSR_NODE
3203
3343
  };
3204
3344
  try {
3205
3345
  result.rows = resolveValue(holeValue(hole), result);
@@ -3298,16 +3438,41 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3298
3438
  },
3299
3439
  nest(hole) {
3300
3440
  const s = engine.scope;
3301
- if (!s || s.h === hole || hole.$lhSkip || inScope && !inScope()) return undefined;
3441
+ if (!s || s.h === hole || hole.$lhSkip || hole.$lhInTag || inScope && !inScope()) return undefined;
3302
3442
  engine.scope = scopeFor(hole);
3303
3443
  return s;
3304
3444
  },
3305
3445
  content(hole) {
3446
+ if (hole.$lhInTag) {
3447
+ const cap = hole.$lhAttr;
3448
+ if (!cap || cap.adopted || engine.suppressed || engine.sweeping) return null;
3449
+ const r = tryResolveFunctionHole(hole);
3450
+ if (typeof r !== "string") {
3451
+ const res = {
3452
+ t: [""],
3453
+ h: [],
3454
+ p: [],
3455
+ $: SSR_NODE
3456
+ };
3457
+ appendResolvedNode(res, r);
3458
+ return res;
3459
+ }
3460
+ if (--cap.waiting === 0 && !cap.closed) {
3461
+ try {
3462
+ cap.base = attrPartsText(cap.parts);
3463
+ } catch (err) {
3464
+ cap.base = null;
3465
+ }
3466
+ if (cap.base !== null) engine.attr(cap);
3467
+ }
3468
+ return r;
3469
+ }
3306
3470
  if (hole.$lhSuppress) {
3307
3471
  const r = {
3308
3472
  t: [""],
3309
3473
  h: [],
3310
- p: []
3474
+ p: [],
3475
+ $: SSR_NODE
3311
3476
  };
3312
3477
  let rows = null;
3313
3478
  const b = hole.$lhBinding;
@@ -3412,7 +3577,8 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3412
3577
  const r = {
3413
3578
  t: [""],
3414
3579
  h: [],
3415
- p: []
3580
+ p: [],
3581
+ $: SSR_NODE
3416
3582
  };
3417
3583
  engine.suppressed++;
3418
3584
  try {
@@ -3431,13 +3597,15 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3431
3597
  res = {
3432
3598
  t: ["", ""],
3433
3599
  h: [escalated.fn],
3434
- p: [escalated.p]
3600
+ p: [escalated.p],
3601
+ $: SSR_NODE
3435
3602
  };
3436
3603
  } else {
3437
3604
  res = {
3438
3605
  t: [""],
3439
3606
  h: [],
3440
- p: []
3607
+ p: [],
3608
+ $: SSR_NODE
3441
3609
  };
3442
3610
  try {
3443
3611
  rows = resolveValue(value, res);
@@ -3467,20 +3635,59 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3467
3635
  t[t.length - 1] += close;
3468
3636
  sink.openBinding(key, b);
3469
3637
  return {
3470
- t,
3638
+ t: t,
3471
3639
  h: res.h,
3472
- p: res.p
3640
+ p: res.p,
3641
+ $: SSR_NODE
3473
3642
  };
3474
3643
  },
3475
3644
  mint() {
3476
3645
  return nextId++;
3477
3646
  },
3647
+ open(text, off, hole) {
3648
+ const pending = hole && hole.$lhAttr;
3649
+ let inject;
3650
+ let id;
3651
+ if (pending && !pending.adopted && text.startsWith(pending.inject, off)) {
3652
+ pending.adopted = true;
3653
+ ({
3654
+ id,
3655
+ inject
3656
+ } = pending);
3657
+ } else {
3658
+ id = nextId++;
3659
+ inject = ` data-lha="${id}"`;
3660
+ text = text.slice(0, off) + inject + text.slice(off);
3661
+ }
3662
+ const prefix = text.slice(off + inject.length);
3663
+ return {
3664
+ id,
3665
+ parts: [prefix],
3666
+ base: prefix,
3667
+ inject,
3668
+ waiting: 0,
3669
+ text
3670
+ };
3671
+ },
3672
+ retry(fn, cap) {
3673
+ if (typeof fn !== "function") return;
3674
+ fn.$lhInTag = true;
3675
+ if (cap) {
3676
+ fn.$lhAttr = cap;
3677
+ cap.waiting++;
3678
+ }
3679
+ },
3478
3680
  active() {
3479
3681
  return (!inScope || inScope()) && !(settled && settled());
3480
3682
  },
3481
3683
  attr(cap) {
3482
- const owner = getOwner();
3483
- const holeCtx = sharedConfig.context;
3684
+ if (cap.waiting) {
3685
+ cap.owner = getOwner();
3686
+ cap.ctx = sharedConfig.context;
3687
+ return;
3688
+ }
3689
+ const owner = cap.owner !== undefined ? cap.owner : getOwner();
3690
+ const holeCtx = cap.ctx !== undefined ? cap.ctx : sharedConfig.context;
3484
3691
  const b = {
3485
3692
  key: "lha:" + cap.id,
3486
3693
  children: [],
@@ -3495,29 +3702,7 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3495
3702
  engine.gateHit = false;
3496
3703
  let html = "";
3497
3704
  try {
3498
- let group = null;
3499
- let groupVal = null;
3500
- const run = () => {
3501
- for (const part of cap.parts) {
3502
- if (typeof part === "string") {
3503
- html += part;
3504
- continue;
3505
- }
3506
- let v;
3507
- if (part.g) {
3508
- if (group !== part.g) {
3509
- group = part.g;
3510
- groupVal = part.g();
3511
- }
3512
- v = groupVal[part.i];
3513
- } else {
3514
- v = part.f();
3515
- }
3516
- const vt = typeof v;
3517
- if (vt === "string" || vt === "number") html += v;
3518
- }
3519
- };
3520
- swept(owner, holeCtx, run);
3705
+ swept(owner, holeCtx, () => html = attrPartsText(cap.parts));
3521
3706
  } catch (err) {
3522
3707
  if (ssrHandleError(err, true)) {
3523
3708
  if (!engine.sweptOwners) return;
@@ -3631,10 +3816,35 @@ function rowPatch(a, b) {
3631
3816
  }
3632
3817
  }
3633
3818
  }
3819
+ function attrPartsText(parts) {
3820
+ let html = "";
3821
+ let group = null;
3822
+ let groupVal = null;
3823
+ for (const part of parts) {
3824
+ if (typeof part === "string") {
3825
+ html += part;
3826
+ continue;
3827
+ }
3828
+ let v;
3829
+ if (part.g) {
3830
+ if (group !== part.g) {
3831
+ group = part.g;
3832
+ groupVal = part.g();
3833
+ }
3834
+ v = groupVal[part.i];
3835
+ } else {
3836
+ v = part.f();
3837
+ }
3838
+ const vt = typeof v;
3839
+ if (vt === "string" || vt === "number") html += v;
3840
+ }
3841
+ return html;
3842
+ }
3634
3843
  function ssr(t) {
3635
3844
  const len = arguments.length;
3636
3845
  if (len === 1) return {
3637
- t
3846
+ t: t,
3847
+ $: SSR_NODE
3638
3848
  };
3639
3849
  let s = t[0];
3640
3850
  let result = null;
@@ -3650,30 +3860,18 @@ function ssr(t) {
3650
3860
  seg: -1,
3651
3861
  off: hp.openOff[0]
3652
3862
  };
3653
- const captureStart = () => {
3863
+ const captureStart = hole => {
3654
3864
  if (cap) return true;
3655
3865
  if (!lastOpen || live.suppressed || live.sweeping || !live.active()) return false;
3866
+ if (lastOpen.r === null && result !== null && result.t.length === 1) {
3867
+ lastOpen.r = result;
3868
+ lastOpen.seg = 0;
3869
+ }
3656
3870
  if (lastOpen.r !== result || result !== null && lastOpen.seg !== result.t.length - 1) {
3657
3871
  return false;
3658
3872
  }
3659
- const id = live.mint();
3660
- const inject = ` data-lha="${id}"`;
3661
- let prefix;
3662
- if (result === null) {
3663
- s = s.slice(0, lastOpen.off) + inject + s.slice(lastOpen.off);
3664
- prefix = s.slice(lastOpen.off + inject.length);
3665
- } else {
3666
- const seg = result.t[lastOpen.seg];
3667
- result.t[lastOpen.seg] = seg.slice(0, lastOpen.off) + inject + seg.slice(lastOpen.off);
3668
- prefix = result.t[lastOpen.seg].slice(lastOpen.off + inject.length);
3669
- }
3670
- cap = {
3671
- id,
3672
- parts: [prefix],
3673
- base: prefix,
3674
- at: lastOpen.seg,
3675
- inject
3676
- };
3873
+ cap = live.open(result === null ? s : result.t[lastOpen.seg], lastOpen.off, hole);
3874
+ if (result === null) s = cap.text;else result.t[lastOpen.seg] = cap.text;
3677
3875
  return true;
3678
3876
  };
3679
3877
  for (let i = 1; i < len; i++) {
@@ -3704,7 +3902,8 @@ function ssr(t) {
3704
3902
  result = {
3705
3903
  t: [s],
3706
3904
  h: [],
3707
- p: []
3905
+ p: [],
3906
+ $: SSR_NODE
3708
3907
  };
3709
3908
  s = "";
3710
3909
  }
@@ -3714,18 +3913,23 @@ function ssr(t) {
3714
3913
  if (Array.isArray(lastGroupVal)) {
3715
3914
  value = lastGroupVal[lastGroupIdx++];
3716
3915
  hasValue = true;
3717
- if (live && !hp.pos[i - 1] && captureStart()) {
3916
+ if (live && !hp.pos[i - 1] && captureStart(hole)) {
3718
3917
  cap.parts.push({
3719
3918
  g: hole,
3720
3919
  i: lastGroupIdx - 1
3721
3920
  });
3722
3921
  }
3723
3922
  } else {
3724
- if (cap) {
3725
- result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
3726
- cap = null;
3923
+ const slot = ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++);
3924
+ if (live && !hp.pos[i - 1]) {
3925
+ const capturing = captureStart(hole);
3926
+ if (capturing) cap.parts.push({
3927
+ g: hole,
3928
+ i: lastGroupIdx - 1
3929
+ });
3930
+ live.retry(slot, capturing && cap);
3727
3931
  }
3728
- result.h.push(ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++));
3932
+ result.h.push(slot);
3729
3933
  result.p.push(lastGroupVal.p);
3730
3934
  result.t.push("");
3731
3935
  }
@@ -3745,7 +3949,8 @@ function ssr(t) {
3745
3949
  result = {
3746
3950
  t: [s],
3747
3951
  h: [],
3748
- p: []
3952
+ p: [],
3953
+ $: SSR_NODE
3749
3954
  };
3750
3955
  s = "";
3751
3956
  if (rs.merge !== undefined) mergeTemplateInto(result, rs.merge);else resolveSSRNode(rs.bail, result);
@@ -3763,7 +3968,8 @@ function ssr(t) {
3763
3968
  result = {
3764
3969
  t: [s],
3765
3970
  h: [],
3766
- p: []
3971
+ p: [],
3972
+ $: SSR_NODE
3767
3973
  };
3768
3974
  s = "";
3769
3975
  }
@@ -3771,28 +3977,27 @@ function ssr(t) {
3771
3977
  }
3772
3978
  } else if (result !== null) {
3773
3979
  const inTag = live && !hp.pos[i - 1];
3774
- const capturing = inTag && captureStart();
3980
+ const capturing = inTag && captureStart(hole);
3775
3981
  const li = capturing ? result.t.length - 1 : 0;
3776
3982
  const before = capturing ? result.t[li].length : 0;
3983
+ const pushed = result.h.length;
3777
3984
  if (live) live.suppressed++;
3778
3985
  try {
3779
3986
  resolveSSRNode(hole, result);
3780
3987
  } finally {
3781
3988
  if (live) live.suppressed--;
3782
3989
  }
3990
+ if (inTag) {
3991
+ for (let k = pushed; k < result.h.length; k++) live.retry(result.h[k], capturing && cap);
3992
+ }
3783
3993
  if (capturing) {
3784
- if (result.t.length - 1 === li) {
3785
- cap.base += result.t[li].slice(before);
3786
- cap.parts.push({
3787
- f: hole
3788
- });
3789
- } else {
3790
- result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
3791
- cap = null;
3792
- }
3994
+ if (result.t.length - 1 === li) cap.base += result.t[li].slice(before);
3995
+ cap.parts.push({
3996
+ f: hole
3997
+ });
3793
3998
  }
3794
3999
  } else {
3795
- const capturing = live && !hp.pos[i - 1] && captureStart();
4000
+ const capturing = live && !hp.pos[i - 1] && captureStart(hole);
3796
4001
  const scope = live && hp.pos[i - 1] && live.nest(hole);
3797
4002
  const r = tryResolveFunctionHole(hole);
3798
4003
  if (scope) live.scope = scope;
@@ -3805,17 +4010,18 @@ function ssr(t) {
3805
4010
  });
3806
4011
  }
3807
4012
  } else {
3808
- if (capturing) {
3809
- s = s.replace(cap.inject, "");
3810
- cap = null;
3811
- }
3812
4013
  result = {
3813
4014
  t: [s],
3814
4015
  h: [],
3815
- p: []
4016
+ p: [],
4017
+ $: SSR_NODE
3816
4018
  };
3817
4019
  s = "";
3818
4020
  appendResolvedNode(result, r);
4021
+ if (capturing) cap.parts.push({
4022
+ f: hole
4023
+ });
4024
+ if (live && !hp.pos[i - 1]) for (const h of result.h) live.retry(h, capturing && cap);
3819
4025
  }
3820
4026
  }
3821
4027
  if (devNext !== undefined) checkUnscopedHole(devNext, t, i - 1, hole);
@@ -3829,7 +4035,8 @@ function ssr(t) {
3829
4035
  result = {
3830
4036
  t: [s],
3831
4037
  h: [],
3832
- p: []
4038
+ p: [],
4039
+ $: SSR_NODE
3833
4040
  };
3834
4041
  s = "";
3835
4042
  appendResolvedNode(result, r);
@@ -3865,7 +4072,8 @@ function ssr(t) {
3865
4072
  if (result === null) s += next;else result.t[result.t.length - 1] += next;
3866
4073
  }
3867
4074
  if (result === null) return {
3868
- t: s
4075
+ t: s,
4076
+ $: SSR_NODE
3869
4077
  };
3870
4078
  return result;
3871
4079
  }
@@ -3927,14 +4135,14 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3927
4135
  let i = 0;
3928
4136
  for (; i < props.length; i++) {
3929
4137
  const s = props[i];
3930
- if (s == null || typeof s === "function" || $PROXY in s) break;
4138
+ if (!s || typeof s === "function" || $PROXY in s) break;
3931
4139
  }
3932
4140
  if (i === props.length) sources = props;else {
3933
4141
  viewKeys = [];
3934
4142
  owners = [];
3935
4143
  collectSpreadSources(props, viewKeys, owners);
3936
4144
  }
3937
- } else if (props == null) {
4145
+ } else if (!props) {
3938
4146
  props = {};
3939
4147
  } else if ($PROXY in props) {
3940
4148
  if (viewOf(props) !== undefined) {
@@ -3945,6 +4153,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3945
4153
  }
3946
4154
  const info = tagInfo(tag);
3947
4155
  const skipChildren = info.isVoid;
4156
+ let sel, optValue, optOwn;
3948
4157
  let result = info.open + hk;
3949
4158
  let childOwner = null;
3950
4159
  const last = sources === null ? 0 : sources.length - 1;
@@ -3963,6 +4172,11 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3963
4172
  for (let j = s + 1; j <= last; j++) {
3964
4173
  if (keysOf[j].includes(prop)) continue nextKey;
3965
4174
  }
4175
+ if (info.sel === 1 && prop === "value") {
4176
+ const value = props[prop];
4177
+ sel = ssrSelect(value);
4178
+ continue;
4179
+ }
3966
4180
  if (info.textarea && (prop === "value" || prop === "defaultValue")) {
3967
4181
  const value = props[prop];
3968
4182
  if (value !== null) children = escape(value);
@@ -3982,6 +4196,9 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3982
4196
  const value = props[key];
3983
4197
  if (value == undefined || prop.startsWith("prop:") || prop === "ref" || isEventName(prop)) continue;
3984
4198
  if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
4199
+ if (info.sel === 2) {
4200
+ if (prop === "value") optValue = value;else if (prop === "selected" && value) optOwn = true;
4201
+ }
3985
4202
  if (prop === "style") {
3986
4203
  result += ` style="${ssrStyle(value)}"`;
3987
4204
  } else if (prop === "class") {
@@ -3996,10 +4213,11 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3996
4213
  if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
3997
4214
  if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
3998
4215
  if (skipChildren) return {
3999
- t: result + " />"
4216
+ t: result + " />",
4217
+ $: SSR_NODE
4000
4218
  };
4001
- if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
4002
- if (typeof children === "function") children = children();
4219
+ if (sel !== undefined) children = ssrIn(sel, () => spreadChildren(info, childOwner, children));else children = spreadChildren(info, childOwner, children);
4220
+ if (info.sel === 2) result += ssrOption(optValue !== undefined || typeof children !== "string" ? optValue : children.replace(/&lt;/g, "<").replace(/&amp;/g, "&").replace(/\s+/g, " ").trim(), undefined, optOwn);
4003
4221
  let thunk = null;
4004
4222
  if (typeof children === "function" && (ctx === undefined || !ctx.liveHoles)) {
4005
4223
  thunk = children;
@@ -4010,7 +4228,8 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
4010
4228
  const res = {
4011
4229
  t: [""],
4012
4230
  h: [],
4013
- p: []
4231
+ p: [],
4232
+ $: SSR_NODE
4014
4233
  };
4015
4234
  pushSSRAsyncHole(res, err, thunk);
4016
4235
  return ssr([result + ">", info.close], res);
@@ -4018,19 +4237,23 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
4018
4237
  }
4019
4238
  const ct = typeof children;
4020
4239
  if (ct === "string" || ct === "number") return {
4021
- t: result + ">" + children + info.close
4240
+ t: result + ">" + children + info.close,
4241
+ $: SSR_NODE
4022
4242
  };
4023
4243
  if (children == null || ct === "boolean") return {
4024
- t: result + ">" + info.close
4244
+ t: result + ">" + info.close,
4245
+ $: SSR_NODE
4025
4246
  };
4026
- if (ct === "object" && !children.h && typeof children.t === "string") return {
4027
- t: result + ">" + children.t + info.close
4247
+ if (ct === "object" && children.$ === SSR_NODE && !children.h && typeof children.t === "string") return {
4248
+ t: result + ">" + children.t + info.close,
4249
+ $: SSR_NODE
4028
4250
  };
4029
4251
  if (thunk === null) return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
4030
4252
  const res = {
4031
4253
  t: [""],
4032
4254
  h: [],
4033
- p: []
4255
+ p: [],
4256
+ $: SSR_NODE
4034
4257
  };
4035
4258
  try {
4036
4259
  resolveSSRNode(children, res, false, true);
@@ -4039,11 +4262,15 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
4039
4262
  }
4040
4263
  return ssr([result + ">", info.close], res);
4041
4264
  }
4265
+ function spreadChildren(info, childOwner, children) {
4266
+ if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
4267
+ return typeof children === "function" ? children() : children;
4268
+ }
4042
4269
  function collectSpreadSources(props, viewKeys, owners) {
4043
4270
  for (let i = 0; i < props.length; i++) {
4044
4271
  let s = props[i];
4045
4272
  if (typeof s === "function") s = s();
4046
- if (s != null) sourceOwners(s, viewKeys, owners);
4273
+ if (s) sourceOwners(s, viewKeys, owners);
4047
4274
  }
4048
4275
  }
4049
4276
  function spreadFormAttribute(prop, info, keys, keysOf, skip) {
@@ -4081,110 +4308,37 @@ function ssrLinkClaim(attrs) {
4081
4308
  if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
4082
4309
  return ctx.linkClaim(attrs);
4083
4310
  }
4084
- function decodeSSREntities(s) {
4085
- return s.indexOf("&") < 0 ? s : s.replace(/&quot;/g, '"').replace(/&lt;/g, "<").replace(/&amp;/g, "&");
4311
+ const SELECT = Symbol();
4312
+ function ssrSelect(value) {
4313
+ const owner = createOwner({
4314
+ transparent: true
4315
+ });
4316
+ const state = {
4317
+ v: value,
4318
+ d: false,
4319
+ o: owner
4320
+ };
4321
+ owner._context = {
4322
+ ...owner._context,
4323
+ [SELECT]: state
4324
+ };
4325
+ return state;
4086
4326
  }
4087
- const SELECT_VALUE_ATTR = /\svalue(?:="([^"]*)")?(?=[\s>]|$)/;
4088
- function tagEnd(html, i) {
4089
- for (let j = i + 1; j < html.length; j++) {
4090
- const c = html.charCodeAt(j);
4091
- if (c === 34) {
4092
- j = html.indexOf('"', j + 1);
4093
- if (j < 0) return -1;
4094
- } else if (c === 62) return j;
4095
- }
4096
- return -1;
4327
+ function ssrIn(state, fn) {
4328
+ return runWithOwner(state.o, fn);
4097
4329
  }
4098
- function optionText(html, from) {
4099
- let t = "";
4100
- let i = from;
4101
- for (;;) {
4102
- const lt = html.indexOf("<", i);
4103
- if (lt < 0) return t + html.slice(i);
4104
- t += html.slice(i, lt);
4105
- if (!html.startsWith("<!--", lt)) return t;
4106
- const ce = html.indexOf("-->", lt);
4107
- if (ce < 0) return t;
4108
- i = ce + 3;
4109
- }
4110
- }
4111
- function tagIs(html, i, name) {
4112
- if (!html.startsWith(name, i + 1)) return false;
4113
- const c = html.charCodeAt(i + 1 + name.length);
4114
- return c === 32 || c === 62 || c === 9 || c === 10 || c === 13;
4115
- }
4116
- let selectValuesActive = false;
4117
- function ssrSelectValues() {
4118
- selectValuesActive = true;
4119
- }
4120
- function resolveSSRSelectValues(html) {
4121
- if (!selectValuesActive) return html;
4122
- let cand = html.indexOf("<select");
4123
- if (cand < 0) return html;
4124
- let out = "";
4125
- let idx = 0;
4126
- while (cand >= 0) {
4127
- if (!tagIs(html, cand, "select")) {
4128
- cand = html.indexOf("<select", cand + 7);
4129
- continue;
4130
- }
4131
- const e0 = tagEnd(html, cand);
4132
- if (e0 < 0) break;
4133
- const open = html.slice(cand, e0 + 1);
4134
- const m = SELECT_VALUE_ATTR.exec(open);
4135
- if (!m) {
4136
- cand = html.indexOf("<select", e0 + 1);
4137
- continue;
4138
- }
4139
- const bound = decodeSSREntities(m[1] ?? "");
4140
- const sel = {
4141
- values: /\smultiple(?=[\s>=])/.test(open) ? bound.split(",") : [bound],
4142
- strip: cand + m.index,
4143
- stripEnd: cand + m.index + m[0].length,
4144
- body: e0 + 1,
4145
- marks: [],
4146
- defaulted: false
4147
- };
4148
- let committed = false;
4149
- let i = html.indexOf("<", e0 + 1);
4150
- while (i >= 0) {
4151
- let e;
4152
- if (html.charCodeAt(i + 1) === 33) {
4153
- e = html.charCodeAt(i + 2) === 45 ? html.indexOf("-->", i) : html.indexOf(">", i);
4154
- if (e < 0) break;
4155
- if (html.charCodeAt(i + 2) === 45) e += 2;
4156
- } else {
4157
- e = tagEnd(html, i);
4158
- if (e < 0) break;
4159
- if (html.startsWith("</select>", i)) {
4160
- out += html.slice(idx, sel.strip) + html.slice(sel.stripEnd, sel.body);
4161
- let seg = sel.body;
4162
- if (!sel.defaulted) {
4163
- for (let k = 0; k < sel.marks.length; k++) {
4164
- out += html.slice(seg, sel.marks[k]) + " selected";
4165
- seg = sel.marks[k];
4166
- }
4167
- }
4168
- out += html.slice(seg, i);
4169
- idx = i;
4170
- committed = true;
4171
- break;
4172
- } else if (tagIs(html, i, "option")) {
4173
- const attrs = html.slice(i + 7, e);
4174
- if (/\sselected(?=[\s=]|$)/.test(attrs)) sel.defaulted = true;else {
4175
- const vm = SELECT_VALUE_ATTR.exec(attrs);
4176
- const value = vm ? decodeSSREntities(vm[1] ?? "") : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
4177
- if (sel.values.includes(value)) sel.marks.push(e);
4178
- }
4179
- }
4180
- }
4181
- i = html.indexOf("<", e + 1);
4182
- }
4183
- if (!committed) break;
4184
- cand = html.indexOf("<select", idx);
4330
+ function ssrOption(value, state, own) {
4331
+ if (state === undefined) {
4332
+ const o = getOwner();
4333
+ if (!o || !(state = o._context[SELECT])) return "";
4185
4334
  }
4186
- if (idx === 0) return html;
4187
- return out + html.slice(idx);
4335
+ if (own) return state.d = true, "";
4336
+ if (state.d) return "";
4337
+ if (typeof value === "function") value = value();
4338
+ if (value == null) return "";
4339
+ value = String(value);
4340
+ const v = state.v;
4341
+ return v != null && (v.map ? v.some(x => x != null && String(x) === value) : String(v) === value) ? " selected" : "";
4188
4342
  }
4189
4343
  function escape(s, attr) {
4190
4344
  const t = typeof s;
@@ -4292,7 +4446,7 @@ function tryJoinPlainSSRArray(nodes) {
4292
4446
  let out = "";
4293
4447
  for (let i = 0, len = nodes.length; i < len; i++) {
4294
4448
  const node = nodes[i];
4295
- if (node == null || typeof node !== "object" || node.h || typeof node.t !== "string") {
4449
+ if (node == null || typeof node !== "object" || node.$ !== SSR_NODE || node.h || typeof node.t !== "string") {
4296
4450
  return undefined;
4297
4451
  }
4298
4452
  out += node.t;
@@ -4520,13 +4674,13 @@ function tryResolveString(node, nested) {
4520
4674
  }
4521
4675
  return s;
4522
4676
  }
4523
- if (node.h && node.h.length > 0) return {
4524
- merge: node
4525
- };
4526
- if (node.t === undefined) {
4677
+ if (node.$ !== SSR_NODE) {
4527
4678
  unrecognizedInsert(node);
4528
4679
  return "";
4529
4680
  }
4681
+ if (node.h && node.h.length > 0) return {
4682
+ merge: node
4683
+ };
4530
4684
  ssrTextTail = false;
4531
4685
  return Array.isArray(node.t) ? node.t[0] : node.t;
4532
4686
  }
@@ -4546,7 +4700,8 @@ function tryResolveString(node, nested) {
4546
4700
  function resolveSSRNode(node, result = {
4547
4701
  t: [""],
4548
4702
  h: [],
4549
- p: []
4703
+ p: [],
4704
+ $: SSR_NODE
4550
4705
  }, top, nested) {
4551
4706
  if (!nested) ssrTextTail = false;
4552
4707
  const t = typeof node;
@@ -4565,7 +4720,9 @@ function resolveSSRNode(node, result = {
4565
4720
  if (slotLive) slotLive.suppressed--;
4566
4721
  }
4567
4722
  } else if (t === "object") {
4568
- if (node.h) {
4723
+ if (node.$ !== SSR_NODE) {
4724
+ unrecognizedInsert(node);
4725
+ } else if (node.h) {
4569
4726
  result.t[result.t.length - 1] += node.t[0];
4570
4727
  if (node.t.length > 1) {
4571
4728
  result.t.push(...node.t.slice(1));
@@ -4573,10 +4730,10 @@ function resolveSSRNode(node, result = {
4573
4730
  result.p.push(...node.p);
4574
4731
  }
4575
4732
  ssrTextTail = false;
4576
- } else if (node.t !== undefined) {
4733
+ } else {
4577
4734
  result.t[result.t.length - 1] += node.t;
4578
4735
  ssrTextTail = false;
4579
- } else unrecognizedInsert(node);
4736
+ }
4580
4737
  } else if (t === "function") {
4581
4738
  const live = sharedConfig.context && sharedConfig.context.liveHoles;
4582
4739
  let liveNode = null;
@@ -5013,6 +5170,10 @@ function registerElementClaim() {
5013
5170
  return noopCleanup;
5014
5171
  }
5015
5172
  function noopCleanup() {}
5173
+ function setTrustedTypesPolicy() {}
5174
+ function trustedHTML(html) {
5175
+ return html;
5176
+ }
5016
5177
  function claimElement(node) {
5017
5178
  return node;
5018
5179
  }
@@ -5162,4 +5323,4 @@ function httpHeader(name, value, options) {
5162
5323
  }
5163
5324
  }
5164
5325
 
5165
- export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStatefulProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
5326
+ export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, notSup as heldRead, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStatefulProperty, notSup as setStyleProperty, setTrustedTypesPolicy, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrIn, ssrLinkClaim, ssrOption, ssrSelect, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as strictHandler, notSup as style, takeHydrationValue, notSup as template, trustedHTML, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };