@qwik.dev/core 2.0.0-beta.36 → 2.0.0-beta.38

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,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-beta.36-dev+3268fab
3
+ * @qwik.dev/core/testing 2.0.0-beta.38-dev+0339f17
4
4
  * Copyright QwikDev. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -21426,7 +21426,7 @@ import { _isJSXNode, _isStringifiable } from "@qwik.dev/core/internal";
21426
21426
  import { expect } from "vitest";
21427
21427
 
21428
21428
  // packages/qwik/src/core/client/vnode-utils.ts
21429
- import { isDev as isDev27 } from "@qwik.dev/core/build";
21429
+ import { isDev as isDev26 } from "@qwik.dev/core/build";
21430
21430
 
21431
21431
  // packages/qwik/src/core/shared/utils/qdev.ts
21432
21432
  var qDev = globalThis.qDev !== false;
@@ -21619,8 +21619,8 @@ See https://qwik.dev/docs/core/tasks/#use-method-rules`,
21619
21619
  // 27
21620
21620
  "Cannot coerce a Signal, use `.value` instead",
21621
21621
  // 28
21622
- "useComputed$ QRL {{0}} {{1}} cannot return a Promise",
21623
- // 29
21622
+ "",
21623
+ // 29 (cleared: useComputed$ now supports async functions)
21624
21624
  `===
21625
21625
  Qwik version {{0}} already imported while importing {{1}}.
21626
21626
  This can lead to issues due to duplicated shared structures.
@@ -21636,8 +21636,14 @@ Verify that the Qwik libraries you're using are in "resolve.noExternal[]" and in
21636
21636
  // 33
21637
21637
  "Serialization Error: Cannot serialize function: {{0}}",
21638
21638
  // 34
21639
- "Cannot read .value of a clientOnly async signal during SSR. Use .loading to check state, or provide an initial value."
21639
+ "Cannot read .value of a clientOnly async signal during SSR. Use .loading to check state, or provide an initial value.",
21640
21640
  // 35
21641
+ "Invalid element name for SSR {{0}}",
21642
+ // 36
21643
+ "Invalid serialized Promise dependency",
21644
+ // 37
21645
+ "Invalid serialized Uint8Array payload"
21646
+ // 38
21641
21647
  ];
21642
21648
  let text = MAP[code2] ?? "";
21643
21649
  if (parts.length) {
@@ -21739,6 +21745,7 @@ var QScopedStyle = "q:sstyle";
21739
21745
  var QCtxAttr = "q:ctx";
21740
21746
  var QBackRefs = "q:brefs";
21741
21747
  var QFuncsPrefix = "qFuncs_";
21748
+ var QwikEvContainerReady = 0;
21742
21749
  var getQFuncs = (document2, hash) => {
21743
21750
  return document2[QFuncsPrefix + hash] || [];
21744
21751
  };
@@ -21749,6 +21756,7 @@ var QBaseAttr = "q:base";
21749
21756
  var QLocaleAttr = "q:locale";
21750
21757
  var QManifestHashAttr = "q:manifest-hash";
21751
21758
  var QInstanceAttr = "q:instance";
21759
+ var QStatePrewarmAttr = "q:prewarm";
21752
21760
  var QContainerIsland = "q:container-island";
21753
21761
  var QContainerIslandEnd = "/" + QContainerIsland;
21754
21762
  var QIgnore = "q:ignore";
@@ -21933,7 +21941,7 @@ function retryOnPromise(fn, onError = justThrow) {
21933
21941
  }
21934
21942
 
21935
21943
  // packages/qwik/src/core/client/dom-container.ts
21936
- import { isDev as isDev24 } from "@qwik.dev/core/build";
21944
+ import { isDev as isDev23 } from "@qwik.dev/core/build";
21937
21945
 
21938
21946
  // packages/qwik/src/core/shared/utils/event-names.ts
21939
21947
  var EVENT_SUFFIX = "$";
@@ -22039,7 +22047,7 @@ Object.freeze(EMPTY_ARRAY);
22039
22047
  Object.freeze(EMPTY_OBJ);
22040
22048
 
22041
22049
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
22042
- import { isBrowser as isBrowser3, isDev as isDev23 } from "@qwik.dev/core/build";
22050
+ import { isBrowser as isBrowser3, isDev as isDev22 } from "@qwik.dev/core/build";
22043
22051
 
22044
22052
  // packages/qwik/src/core/shared/qrl/qrl-class-dev.ts
22045
22053
  import { isBrowser } from "@qwik.dev/core/build";
@@ -22050,7 +22058,7 @@ var initLazyRefDev = (lazy) => {
22050
22058
  }
22051
22059
  };
22052
22060
  var initQrlClassDev = (lazy, captures, qrl) => {
22053
- if (captures && typeof captures === "object") {
22061
+ if (Array.isArray(captures)) {
22054
22062
  for (let i2 = 0; i2 < captures.length; i2++) {
22055
22063
  const item = captures[i2];
22056
22064
  verifySerializable(item, "Captured variable in the closure can not be serialized");
@@ -22084,7 +22092,7 @@ var setupHmr = (LazyRefClass, setGetLazyRef) => {
22084
22092
  params.push(`t=${t}`);
22085
22093
  return `${path}?${params.join("&")}`;
22086
22094
  };
22087
- document.addEventListener("qHmr", (ev) => {
22095
+ const hmrHandler = (ev) => {
22088
22096
  const files = ev.detail.files;
22089
22097
  const t = ev.detail.t || document.__hmrT || Date.now();
22090
22098
  let didReload = false;
@@ -22120,7 +22128,6 @@ var setupHmr = (LazyRefClass, setGetLazyRef) => {
22120
22128
  }
22121
22129
  if (didReload) {
22122
22130
  lazy.$ref$ = void 0;
22123
- document.__hmrDone = document.__hmrT;
22124
22131
  if (lazy.qrls) {
22125
22132
  for (const qrlRef of lazy.qrls) {
22126
22133
  const qrl = qrlRef.deref();
@@ -22135,7 +22142,8 @@ var setupHmr = (LazyRefClass, setGetLazyRef) => {
22135
22142
  }
22136
22143
  }
22137
22144
  }
22138
- });
22145
+ };
22146
+ document.addEventListener("qHmr", hmrHandler, true);
22139
22147
  };
22140
22148
 
22141
22149
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
@@ -22182,16 +22190,24 @@ function qrlToString(serializationContext, qrl, raw) {
22182
22190
  symbol = String(serializationContext.$addSyncFn$(null, 0, fn));
22183
22191
  }
22184
22192
  const captures = qrl.getCaptured();
22185
- let captureIds = null;
22193
+ let captureDeltas = null;
22186
22194
  if (captures && captures.length > 0) {
22187
- captureIds = captures.map((ref) => `${serializationContext.$addRoot$(ref)}`).join(" ");
22195
+ let previous = 0;
22196
+ let output = "";
22197
+ for (let i2 = 0; i2 < captures.length; i2++) {
22198
+ const captureId = serializationContext.$addRoot$(captures[i2]);
22199
+ const delta = captureId - previous;
22200
+ previous = captureId;
22201
+ output += (i2 === 0 ? "" : " ") + delta;
22202
+ }
22203
+ captureDeltas = output;
22188
22204
  }
22189
22205
  if (raw) {
22190
- return [chunk, symbol, captureIds];
22206
+ return [chunk, symbol, captureDeltas];
22191
22207
  }
22192
22208
  let qrlStringInline = `${chunk}#${symbol}`;
22193
- if (captureIds) {
22194
- qrlStringInline += `#${captureIds}`;
22209
+ if (captureDeltas) {
22210
+ qrlStringInline += `#${captureDeltas}`;
22195
22211
  }
22196
22212
  return qrlStringInline;
22197
22213
  }
@@ -22208,8 +22224,12 @@ function createQRLWithBackChannel(chunk, symbol, captures, container) {
22208
22224
  return createQRL(chunk, symbol, null, qrlImporter, captures, container);
22209
22225
  }
22210
22226
  function parseQRL(qrl, container) {
22211
- const [chunk, symbol, captures] = qrl.split("#");
22212
- return createQRLWithBackChannel(chunk, symbol, captures || null, container);
22227
+ const firstHash = qrl.indexOf("#");
22228
+ const secondHash = qrl.indexOf("#", firstHash + 1);
22229
+ const chunk = qrl.slice(0, firstHash);
22230
+ const symbol = secondHash === -1 ? qrl.slice(firstHash + 1) : qrl.slice(firstHash + 1, secondHash);
22231
+ const captures = secondHash !== -1 && secondHash + 1 < qrl.length ? qrl.slice(secondHash + 1) : null;
22232
+ return createQRLWithBackChannel(chunk, symbol, captures, container);
22213
22233
  }
22214
22234
  var QRL_RUNTIME_CHUNK = "mock-chunk";
22215
22235
 
@@ -22219,7 +22239,16 @@ function runEventHandlerQRL(handler, event, element, ctx) {
22219
22239
  return;
22220
22240
  }
22221
22241
  if (!ctx) {
22222
- ctx = newInvokeContextFromDOM(event, element);
22242
+ const container2 = getDomContainer(element);
22243
+ return whenContainerDataReady(
22244
+ container2,
22245
+ () => runEventHandlerQRL(
22246
+ handler,
22247
+ event,
22248
+ element,
22249
+ newInvokeContextFromDOM(event, element, container2)
22250
+ )
22251
+ );
22223
22252
  }
22224
22253
  const container = ctx.$container$;
22225
22254
  const hostElement = ctx.$hostElement$;
@@ -22463,7 +22492,7 @@ var PropsProxyHandler = class {
22463
22492
  addPropsProxyEffect(this, prop);
22464
22493
  }
22465
22494
  }
22466
- return value instanceof WrappedSignalImpl && value.$flags$ & 4 /* UNWRAP */ ? value.value : value;
22495
+ return value instanceof WrappedSignalImpl ? value.value : value;
22467
22496
  }
22468
22497
  set(_, prop, value) {
22469
22498
  if (prop === _OWNER) {
@@ -22604,8 +22633,8 @@ var isPropsProxy = (obj) => {
22604
22633
  return obj && _VAR_PROPS in obj;
22605
22634
  };
22606
22635
 
22607
- // packages/qwik/src/core/reactive-primitives/impl/async-signal-impl.ts
22608
- import { isBrowser as isBrowser2, isDev as isDev11, isServer as isServer5 } from "@qwik.dev/core/build";
22636
+ // packages/qwik/src/core/reactive-primitives/impl/computed-signal-impl.ts
22637
+ import { isBrowser as isBrowser2, isDev as isDev10, isServer as isServer5 } from "@qwik.dev/core/build";
22609
22638
 
22610
22639
  // packages/qwik/src/core/reactive-primitives/subscriber.ts
22611
22640
  import { isServer as isServer4 } from "@qwik.dev/core/build";
@@ -22691,87 +22720,9 @@ var cleanupFn = (target, handleError) => {
22691
22720
  };
22692
22721
 
22693
22722
  // packages/qwik/src/core/reactive-primitives/impl/computed-signal-impl.ts
22694
- import { isDev as isDev10 } from "@qwik.dev/core/build";
22695
22723
  var DEBUG2 = false;
22696
22724
  var log2 = (...args) => console.log("COMPUTED SIGNAL", ...args.map(qwikDebugToString));
22697
- var _a2, _b;
22698
- var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF, _b) {
22699
- constructor(container, fn, flags = 1 /* INVALID */ | 16 /* SERIALIZATION_STRATEGY_ALWAYS */) {
22700
- super(container || tryGetInvokeContext()?.$container$, NEEDS_COMPUTATION);
22701
- /**
22702
- * The compute function is stored here.
22703
- *
22704
- * The computed functions must be executed synchronously (because of this we need to eagerly
22705
- * resolve the QRL during the mark dirty phase so that any call to it will be synchronous). )
22706
- */
22707
- __publicField(this, "$computeQrl$");
22708
- __publicField(this, "$flags$");
22709
- __publicField(this, _a2);
22710
- this.$computeQrl$ = fn;
22711
- this.$flags$ = flags;
22712
- }
22713
- invalidate() {
22714
- this.$flags$ |= 1 /* INVALID */;
22715
- const ctx = newInvokeContext();
22716
- ctx.$container$ = this.$container$ || void 0;
22717
- const running = retryOnPromise(invokeApply.bind(this, ctx, this.$computeIfNeeded$));
22718
- if (running) {
22719
- running.catch((err) => {
22720
- if (this.$container$) {
22721
- this.$container$.handleError(err, null);
22722
- } else {
22723
- console.error("Error during computation", err);
22724
- }
22725
- });
22726
- }
22727
- }
22728
- get untrackedValue() {
22729
- this.$computeIfNeeded$();
22730
- isDev10 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
22731
- return this.$untrackedValue$;
22732
- }
22733
- set untrackedValue(value) {
22734
- this.$untrackedValue$ = value;
22735
- }
22736
- $computeIfNeeded$() {
22737
- if (!(this.$flags$ & 1 /* INVALID */)) {
22738
- return;
22739
- }
22740
- const computeQrl = this.$computeQrl$;
22741
- throwIfQRLNotResolved(computeQrl);
22742
- const ctx = tryGetInvokeContext();
22743
- const previousEffectSubscription = ctx?.$effectSubscriber$;
22744
- if (ctx) {
22745
- const effectSubscriber = getSubscriber(this, "." /* VNODE */);
22746
- clearEffectSubscription(this.$container$, effectSubscriber);
22747
- ctx.$effectSubscriber$ = effectSubscriber;
22748
- }
22749
- try {
22750
- const untrackedValue = computeQrl.getFn(ctx)();
22751
- if (isPromise(untrackedValue)) {
22752
- throw qError(29 /* computedNotSync */, [
22753
- computeQrl.dev ? computeQrl.dev.file : "",
22754
- computeQrl.$hash$
22755
- ]);
22756
- }
22757
- DEBUG2 && log2("Signal.$compute$", untrackedValue);
22758
- this.$flags$ &= ~1 /* INVALID */;
22759
- super.value = untrackedValue;
22760
- } finally {
22761
- if (ctx) {
22762
- ctx.$effectSubscriber$ = previousEffectSubscription;
22763
- }
22764
- }
22765
- }
22766
- };
22767
-
22768
- // packages/qwik/src/core/reactive-primitives/impl/async-signal-impl.ts
22769
- var DEBUG3 = false;
22770
- var log3 = (...args) => (
22771
- // eslint-disable-next-line no-console
22772
- console.log("ASYNC COMPUTED SIGNAL", ...args.map(qwikDebugToString))
22773
- );
22774
- var AsyncJob = class {
22725
+ var Job = class {
22775
22726
  constructor($signal$, info, $infoVersion$) {
22776
22727
  this.$signal$ = $signal$;
22777
22728
  /** First holds the compute promise and then the cleanup promise */
@@ -22791,8 +22742,8 @@ var AsyncJob = class {
22791
22742
  }
22792
22743
  /** Backward compatible cache method for resource */
22793
22744
  cache() {
22794
- isDev11 && console.error(
22795
- "useResource cache() method does not do anything. Use `useAsync$` instead of `useResource$`, use the `expires` option for polling behavior."
22745
+ isDev10 && console.error(
22746
+ "useResource cache() method does not do anything. Use `useComputed$` instead of `useResource$`, use the `expires` option for polling behavior."
22796
22747
  );
22797
22748
  }
22798
22749
  get previous() {
@@ -22807,39 +22758,44 @@ var AsyncJob = class {
22807
22758
  }
22808
22759
  }
22809
22760
  };
22810
- var _a3, _b2;
22811
- var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BACK_REF, _b2) {
22761
+ var _a2, _b;
22762
+ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF, _b) {
22812
22763
  constructor(container, fn, flags = 1 /* INVALID */ | 16 /* SERIALIZATION_STRATEGY_ALWAYS */, options) {
22813
- super(container, fn, flags);
22814
- __publicField(this, "$untrackedLoading$", false);
22815
- __publicField(this, "$untrackedError$");
22816
- __publicField(this, "$current$", null);
22817
- __publicField(this, _a3);
22764
+ super(container || tryGetInvokeContext()?.$container$, NEEDS_COMPUTATION);
22765
+ /**
22766
+ * The compute function is stored here.
22767
+ *
22768
+ * Sync computed functions must be executed synchronously (because of this we need to eagerly
22769
+ * resolve the QRL during the mark dirty phase so that any call to it will be synchronous).
22770
+ */
22771
+ __publicField(this, "$computeQrl$");
22772
+ __publicField(this, "$flags$");
22773
+ __publicField(this, _a2);
22774
+ this.$computeQrl$ = fn;
22775
+ this.$flags$ = flags;
22818
22776
  if (!options) {
22819
22777
  return;
22820
22778
  }
22821
22779
  const initial = options.initial;
22822
22780
  if (initial !== void 0) {
22823
- const initialValue = typeof initial === "function" ? initial() : initial;
22824
- this.$untrackedValue$ = initialValue;
22781
+ this.$untrackedValue$ = typeof initial === "function" ? initial() : initial;
22825
22782
  }
22826
22783
  const concurrency = options.concurrency;
22827
22784
  if (concurrency !== void 0 && concurrency >= 0 && concurrency !== 1) {
22828
22785
  this.$concurrency$ = concurrency;
22829
22786
  this.$jobs$ = [];
22830
22787
  }
22831
- const timeout = options.timeout;
22832
- if (timeout) {
22833
- this.$timeoutMs$ = timeout;
22788
+ if (options.timeout) {
22789
+ this.$timeoutMs$ = options.timeout;
22834
22790
  }
22835
22791
  if (options.eagerCleanup) {
22836
22792
  this.$flags$ |= 32 /* EAGER_CLEANUP */;
22837
22793
  }
22838
22794
  if (options.clientOnly) {
22839
- this.$flags$ |= 64 /* CLIENT_ONLY */;
22795
+ this.$flags$ |= 64 /* CLIENT_ONLY */ | 512 /* ASYNC_MODE */;
22840
22796
  }
22841
22797
  if (options.allowStale === false) {
22842
- if (isDev11 && initial !== void 0) {
22798
+ if (isDev10 && initial !== void 0) {
22843
22799
  throw new Error(
22844
22800
  "allowStale: false and initial cannot be used together. allowStale: false clears the value on invalidation, which conflicts with providing an initial value."
22845
22801
  );
@@ -22854,27 +22810,28 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
22854
22810
  this.$flags$ |= 256 /* NO_POLL */;
22855
22811
  }
22856
22812
  }
22857
- get untrackedValue() {
22858
- this.$computeIfNeeded$();
22859
- if (this.$current$?.$promise$) {
22860
- if (this.$untrackedValue$ === NEEDS_COMPUTATION || (qTest ? isServerPlatform() : isServer5)) {
22861
- DEBUG3 && log3("Throwing promise while computing initial value", this);
22862
- throw this.$current$?.$promise$;
22863
- }
22864
- DEBUG3 && log3("Returning stale value", this.$untrackedValue$, "while computing", this.$current$);
22865
- return this.$untrackedValue$;
22813
+ invalidate(info) {
22814
+ if (arguments.length > 0) {
22815
+ this.$info$ = info;
22816
+ this.$infoVersion$ = this.$infoVersion$ === void 0 ? 1 : this.$infoVersion$ + 1;
22866
22817
  }
22867
- if (this.$untrackedError$) {
22868
- DEBUG3 && log3("Throwing error while reading value", this);
22869
- throw this.$untrackedError$;
22818
+ if (this.$flags$ & 512 /* ASYNC_MODE */) {
22819
+ this.$setInvalid$(true, this.$flags$ & 128 /* CLEAR_ON_INVALIDATE */);
22820
+ return;
22870
22821
  }
22871
- if ((qTest ? isServerPlatform() : isServer5) && this.$flags$ & 64 /* CLIENT_ONLY */ && this.$untrackedValue$ === NEEDS_COMPUTATION) {
22872
- throw qError(35 /* asyncClientOnlyValueDuringSSR */);
22822
+ this.$flags$ |= 1 /* INVALID */;
22823
+ const ctx = newInvokeContext();
22824
+ ctx.$container$ = this.$container$ || void 0;
22825
+ const running = retryOnPromise(invokeApply.bind(this, ctx, this.$computeIfNeeded$));
22826
+ if (isPromise(running)) {
22827
+ running.catch((err) => {
22828
+ if (this.$container$) {
22829
+ this.$container$.handleError(err, null);
22830
+ } else {
22831
+ console.error("Error during computation", err);
22832
+ }
22833
+ });
22873
22834
  }
22874
- return this.$untrackedValue$;
22875
- }
22876
- set untrackedValue(value) {
22877
- this.$untrackedValue$ = value;
22878
22835
  }
22879
22836
  /**
22880
22837
  * Read the value, subscribing if in a tracking context. Triggers computation if needed.
@@ -22892,32 +22849,62 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
22892
22849
  }
22893
22850
  set value(value) {
22894
22851
  this.$flags$ &= ~1 /* INVALID */;
22895
- this.untrackedLoading = false;
22896
22852
  this.untrackedError = void 0;
22897
- this.$info$ = void 0;
22898
- if (this.$jobs$) {
22899
- for (let i2 = 0; i2 < this.$jobs$.length; i2++) {
22900
- this.$jobs$[i2].$canWrite$ = false;
22853
+ if (this.$flags$ & 512 /* ASYNC_MODE */) {
22854
+ this.untrackedPending = false;
22855
+ this.$info$ = void 0;
22856
+ if (this.$jobs$) {
22857
+ for (let i2 = 0; i2 < this.$jobs$.length; i2++) {
22858
+ this.$jobs$[i2].$canWrite$ = false;
22859
+ }
22860
+ } else if (this.$current$) {
22861
+ this.$current$.$canWrite$ = false;
22901
22862
  }
22902
- } else if (this.$current$) {
22903
- this.$current$.$canWrite$ = false;
22863
+ this.$clearNextPoll$();
22864
+ super.value = value;
22865
+ this.$scheduleNextPoll$();
22866
+ return;
22904
22867
  }
22905
- this.$clearNextPoll$();
22906
22868
  super.value = value;
22907
- this.$scheduleNextPoll$();
22869
+ }
22870
+ get untrackedValue() {
22871
+ this.$computeIfNeeded$();
22872
+ if (this.$current$?.$promise$) {
22873
+ if (this.$untrackedValue$ === NEEDS_COMPUTATION || (qTest ? isServerPlatform() : isServer5)) {
22874
+ DEBUG2 && log2("Throwing promise while computing initial value", this);
22875
+ throw this.$current$?.$promise$;
22876
+ }
22877
+ DEBUG2 && log2("Returning stale value", this.$untrackedValue$, "while computing", this.$current$);
22878
+ return this.$untrackedValue$;
22879
+ }
22880
+ if (this.$untrackedError$) {
22881
+ DEBUG2 && log2("Throwing error while reading value", this);
22882
+ throw this.$untrackedError$;
22883
+ }
22884
+ if ((qTest ? isServerPlatform() : isServer5) && this.$flags$ & 64 /* CLIENT_ONLY */ && this.$untrackedValue$ === NEEDS_COMPUTATION) {
22885
+ throw qError(35 /* asyncClientOnlyValueDuringSSR */);
22886
+ }
22887
+ isDev10 && !(this.$flags$ & 512 /* ASYNC_MODE */) && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
22888
+ return this.$untrackedValue$;
22889
+ }
22890
+ set untrackedValue(value) {
22891
+ this.$untrackedValue$ = value;
22908
22892
  }
22909
22893
  /**
22910
22894
  * Loading is true if the signal is still waiting for the promise to resolve, false if the promise
22911
- * has resolved or rejected.
22895
+ * has resolved or rejected (or the compute function is synchronous).
22912
22896
  *
22913
- * Accessing .loading will trigger computation if needed, since it's often used like
22914
- * `signal.loading ? <Loading /> : signal.value`.
22897
+ * Accessing `.pending` will trigger computation if needed, since it's often used like
22898
+ *
22899
+ * ```ts
22900
+ * signal.pending ? <Loading /> : signal.value
22901
+ * ```
22915
22902
  */
22916
- get loading() {
22917
- const val = this.untrackedLoading;
22903
+ get pending() {
22904
+ const val = this.untrackedPending;
22918
22905
  const ctx = tryGetInvokeContext();
22919
22906
  if (ctx && (this.$container$ || (this.$container$ = ctx.$container$ || null))) {
22920
- isDev11 && assertTrue(
22907
+ isDev10 && assertTrue(
22921
22908
  !ctx.$container$ || ctx.$container$ === this.$container$,
22922
22909
  "Do not use signals across containers"
22923
22910
  );
@@ -22930,27 +22917,46 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
22930
22917
  }
22931
22918
  return val;
22932
22919
  }
22933
- set untrackedLoading(value) {
22934
- if (value !== this.$untrackedLoading$) {
22935
- this.$untrackedLoading$ = value;
22936
- DEBUG3 && log3("Set untrackedLoading", value);
22920
+ set untrackedPending(value) {
22921
+ if (value !== !!this.$untrackedPending$) {
22922
+ this.$untrackedPending$ = value;
22923
+ DEBUG2 && log2("Set untrackedPending", value);
22937
22924
  scheduleEffects(this.$container$, this, this.$loadingEffects$);
22938
22925
  }
22939
22926
  }
22940
- get untrackedLoading() {
22927
+ get untrackedPending() {
22941
22928
  this.$computeIfNeeded$();
22942
22929
  if ((qTest ? isServerPlatform() : isServer5) && this.$current$?.$promise$) {
22943
- DEBUG3 && log3("Throwing loading promise for SSR");
22930
+ DEBUG2 && log2("Throwing loading promise for SSR");
22944
22931
  throw this.$current$?.$promise$;
22945
22932
  }
22946
- return this.$untrackedLoading$;
22933
+ return !!this.$untrackedPending$;
22934
+ }
22935
+ /** @deprecated Use `pending` instead */
22936
+ get loading() {
22937
+ return this.pending;
22947
22938
  }
22948
- /** The error that occurred when the signal was resolved. */
22939
+ /** @deprecated Use `untrackedPending` instead */
22940
+ get untrackedLoading() {
22941
+ return this.untrackedPending;
22942
+ }
22943
+ set untrackedLoading(value) {
22944
+ this.untrackedPending = value;
22945
+ }
22946
+ /**
22947
+ * The error the compute function threw or rejected with.
22948
+ *
22949
+ * Accessing .error will trigger computation if needed, since it's often used like
22950
+ *
22951
+ * ```ts
22952
+ * signal.error ? <Failed /> : signal.value
22953
+ * ```
22954
+ */
22949
22955
  get error() {
22950
22956
  const val = this.untrackedError;
22951
22957
  const ctx = tryGetInvokeContext();
22952
22958
  if (ctx && (this.$container$ || (this.$container$ = ctx.$container$ || null))) {
22953
- isDev11 && assertTrue(
22959
+ isDev10 && assertTrue(
22954
22960
  !ctx.$container$ || ctx.$container$ === this.$container$,
22955
22961
  "Do not use signals across containers"
22956
22962
  );
@@ -22970,6 +22976,10 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
22970
22976
  }
22971
22977
  }
22972
22978
  get untrackedError() {
22979
+ this.$computeIfNeeded$();
22980
+ if ((qTest ? isServerPlatform() : isServer5) && this.$current$?.$promise$) {
22981
+ throw this.$current$?.$promise$;
22982
+ }
22973
22983
  return this.$untrackedError$;
22974
22984
  }
22975
22985
  get expires() {
@@ -23009,14 +23019,6 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
23009
23019
  }
23010
23020
  this.expires = Math.abs(value);
23011
23021
  }
23012
- /** Invalidates the signal, causing it to re-compute its value. */
23013
- async invalidate(info) {
23014
- if (arguments.length > 0) {
23015
- this.$info$ = info;
23016
- this.$infoVersion$ = this.$infoVersion$ === void 0 ? 1 : this.$infoVersion$ + 1;
23017
- }
23018
- this.$setInvalid$(true, this.$flags$ & 128 /* CLEAR_ON_INVALIDATE */);
23019
- }
23020
23022
  $setInvalid$(allowRecalc, mustClear) {
23021
23023
  this.$flags$ |= 1 /* INVALID */;
23022
23024
  this.$clearNextPoll$();
@@ -23059,8 +23061,81 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
23059
23061
  if (!(this.$flags$ & 1 /* INVALID */)) {
23060
23062
  return;
23061
23063
  }
23064
+ if (this.$flags$ & 512 /* ASYNC_MODE */) {
23065
+ return this.$computeAsync$();
23066
+ }
23067
+ const computeQrl = this.$computeQrl$;
23068
+ throwIfQRLNotResolved(computeQrl);
23069
+ const prevJob = this.$current$;
23070
+ if (prevJob && !prevJob.$cleanupRequested$) {
23071
+ prevJob.$cleanupRequested$ = true;
23072
+ prevJob.$abortController$?.abort();
23073
+ this.$runCleanupCallbacks$(prevJob);
23074
+ }
23075
+ const running = new Job(this, this.$info$, this.$infoVersion$);
23076
+ this.$current$ = running;
23077
+ let result;
23078
+ try {
23079
+ result = this.$invokeComputeFn$(computeQrl.resolved, running);
23080
+ } catch (err) {
23081
+ if (isPromise(err)) {
23082
+ throw err;
23083
+ }
23084
+ if (running.$infoVersion$ === this.$infoVersion$) {
23085
+ this.$info$ = void 0;
23086
+ }
23087
+ this.$flags$ &= ~1 /* INVALID */;
23088
+ this.$setError$(running, err);
23089
+ return;
23090
+ }
23091
+ if (isPromise(result)) {
23092
+ this.$flags$ |= 512 /* ASYNC_MODE */;
23093
+ this.$flags$ &= ~1 /* INVALID */;
23094
+ let first = result;
23095
+ const compute = () => {
23096
+ const r = first ?? this.$invokeComputeFn$(this.$computeQrl$.resolved, running);
23097
+ first = void 0;
23098
+ return r;
23099
+ };
23100
+ running.$promise$ = this.$settleComputation$(running, () => retryOnPromise(compute));
23101
+ return;
23102
+ }
23103
+ DEBUG2 && log2("Signal.$compute$", result);
23104
+ if (running.$infoVersion$ === this.$infoVersion$) {
23105
+ this.$info$ = void 0;
23106
+ }
23107
+ this.$flags$ &= ~1 /* INVALID */;
23108
+ this.untrackedError = void 0;
23109
+ super.value = result;
23110
+ }
23111
+ /**
23112
+ * Invoke the compute fn with the ComputeCtx argument. CTX_ARG signals (useAsync$, useResource$)
23113
+ * only track via its explicit track(). Computeds auto-track every synchronous read instead; after
23114
+ * the first await they must use the explicit track() too.
23115
+ */
23116
+ $invokeComputeFn$(fn, job) {
23117
+ const computeFn = fn;
23118
+ if (this.$flags$ & 1024 /* CTX_ARG */) {
23119
+ let iCtx = tryGetInvokeContext();
23120
+ if (iCtx?.$effectSubscriber$) {
23121
+ iCtx = { ...iCtx, $effectSubscriber$: void 0 };
23122
+ }
23123
+ return invokeApply(iCtx, computeFn, [job]);
23124
+ }
23125
+ const container = this.$container$ || (this.$container$ = tryGetInvokeContext()?.$container$ || null);
23126
+ const subscriber = getSubscriber(this, "." /* VNODE */);
23127
+ if (container) {
23128
+ clearEffectSubscription(container, subscriber);
23129
+ }
23130
+ const ctx = newInvokeContext();
23131
+ ctx.$container$ = container || void 0;
23132
+ ctx.$effectSubscriber$ = subscriber;
23133
+ return invokeApply(ctx, computeFn, [job]);
23134
+ }
23135
+ /** Start an async computation (the async engine; assumes the INVALID flag is set) */
23136
+ $computeAsync$() {
23062
23137
  if ((qTest ? isServerPlatform() : isServer5) && this.$flags$ & 64 /* CLIENT_ONLY */) {
23063
- this.$untrackedLoading$ = true;
23138
+ this.$untrackedPending$ = true;
23064
23139
  this.$container$?.serializationCtx.$eagerResume$.add(this);
23065
23140
  return;
23066
23141
  }
@@ -23072,13 +23147,13 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
23072
23147
  }
23073
23148
  const limit = this.$concurrency$ === 0 ? Number.POSITIVE_INFINITY : this.$concurrency$ ?? 1;
23074
23149
  if (this.$jobs$ ? this.$jobs$.length >= limit : current?.$promise$) {
23075
- DEBUG3 && log3(`Concurrency limit ${limit} reached, not starting new computation`);
23150
+ DEBUG2 && log2(`Concurrency limit ${limit} reached, not starting new computation`);
23076
23151
  this.$flags$ |= 1 /* INVALID */;
23077
23152
  return;
23078
23153
  }
23079
- DEBUG3 && log3("Starting new async computation");
23154
+ DEBUG2 && log2("Starting new async computation");
23080
23155
  const infoVersion = this.$infoVersion$;
23081
- const running = new AsyncJob(this, this.$info$, infoVersion);
23156
+ const running = new Job(this, this.$info$, infoVersion);
23082
23157
  this.$current$ = running;
23083
23158
  if (this.$jobs$) {
23084
23159
  this.$jobs$.push(running);
@@ -23086,29 +23161,36 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
23086
23161
  running.$promise$ = this.$runComputation$(running);
23087
23162
  }
23088
23163
  async $runComputation$(running) {
23089
- const isCurrent = () => running === this.$current$;
23090
23164
  let fn = this.$computeQrl$.resolved;
23091
23165
  if (!fn) {
23092
- this.untrackedLoading = true;
23166
+ this.untrackedPending = true;
23093
23167
  fn = await this.$computeQrl$.resolve();
23094
23168
  if (running.$abortController$?.signal.aborted) {
23095
- DEBUG3 && log3("Computation aborted before it started");
23169
+ DEBUG2 && log2("Computation aborted before it started");
23096
23170
  running.$promise$ = null;
23097
23171
  return;
23098
23172
  }
23099
23173
  }
23174
+ if (this.$timeoutMs$) {
23175
+ this.$computationTimeoutId$ = setTimeout(() => {
23176
+ const error = new Error(`timeout ${this.$timeoutMs$}ms`);
23177
+ this.$setError$(running, error);
23178
+ running.$abortController$?.abort(error);
23179
+ }, this.$timeoutMs$);
23180
+ }
23181
+ return this.$settleComputation$(
23182
+ running,
23183
+ () => retryOnPromise(() => this.$invokeComputeFn$(fn, running))
23184
+ );
23185
+ }
23186
+ /** Await the computation and publish its result, error, and loading transitions. */
23187
+ async $settleComputation$(running, compute) {
23188
+ const isCurrent = () => running === this.$current$;
23100
23189
  try {
23101
- if (this.$timeoutMs$) {
23102
- this.$computationTimeoutId$ = setTimeout(() => {
23103
- const error = new Error(`timeout ${this.$timeoutMs$}ms`);
23104
- this.$setError$(running, error);
23105
- running.$abortController$?.abort(error);
23106
- }, this.$timeoutMs$);
23107
- }
23108
- const valuePromise = retryOnPromise(fn.bind(null, running));
23190
+ const valuePromise = compute();
23109
23191
  let value;
23110
23192
  if (isPromise(valuePromise)) {
23111
- this.untrackedLoading = true;
23193
+ this.untrackedPending = true;
23112
23194
  value = await valuePromise;
23113
23195
  } else {
23114
23196
  value = valuePromise;
@@ -23126,13 +23208,13 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
23126
23208
  }
23127
23209
  }
23128
23210
  }
23129
- DEBUG3 && log3("Promise resolved", value);
23211
+ DEBUG2 && log2("Promise resolved", value);
23130
23212
  this.untrackedError = void 0;
23131
23213
  super.value = value;
23132
23214
  }
23133
23215
  } catch (err) {
23134
23216
  running.$promise$ = null;
23135
- DEBUG3 && log3("Error caught in promise.catch", err);
23217
+ DEBUG2 && log2("Error caught in promise.catch", err);
23136
23218
  this.$setError$(running, err);
23137
23219
  }
23138
23220
  if (isCurrent()) {
@@ -23141,10 +23223,10 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
23141
23223
  this.$info$ = void 0;
23142
23224
  }
23143
23225
  if (this.$flags$ & 1 /* INVALID */) {
23144
- DEBUG3 && log3("Computation finished but signal is invalid, re-running");
23226
+ DEBUG2 && log2("Computation finished but signal is invalid, re-running");
23145
23227
  this.$computeIfNeeded$();
23146
23228
  } else {
23147
- this.untrackedLoading = false;
23229
+ this.untrackedPending = false;
23148
23230
  this.$scheduleNextPoll$();
23149
23231
  }
23150
23232
  }
@@ -23204,15 +23286,14 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
23204
23286
  if (job.$cleanupRequested$) {
23205
23287
  return;
23206
23288
  }
23207
- DEBUG3 && log3("Requesting cleanups for job", job);
23289
+ DEBUG2 && log2("Requesting cleanups for job", job);
23208
23290
  job.$cleanupRequested$ = true;
23209
23291
  job.$abortController$?.abort(reason);
23210
23292
  job.$promise$ = maybeThen(job.$promise$, () => this.$runCleanups$(job));
23211
23293
  }
23212
- /** Clean up and trigger signal compute once complete */
23213
- $runCleanups$(job) {
23294
+ /** Run a job's cleanup callbacks, returning a promise when any of them are async. */
23295
+ $runCleanupCallbacks$(job) {
23214
23296
  const cleanups = job.$cleanups$;
23215
- DEBUG3 && log3("cleanup start", job);
23216
23297
  const onError = (err) => {
23217
23298
  const handleError = this.$container$?.handleError;
23218
23299
  if (handleError) {
@@ -23221,24 +23302,9 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
23221
23302
  console.error("Error in async signal cleanup", err);
23222
23303
  }
23223
23304
  };
23224
- const onDone = () => {
23225
- job.$promise$ = null;
23226
- if (cleanups) {
23227
- cleanups.length = 0;
23228
- }
23229
- DEBUG3 && log3("cleanup finished", job);
23230
- const jobs = this.$jobs$;
23231
- if (jobs) {
23232
- const idx = jobs.indexOf(job);
23233
- if (idx !== -1) {
23234
- jobs.splice(idx, 1);
23235
- }
23236
- }
23237
- this.$computeIfNeeded$();
23238
- };
23239
23305
  let promiseChain = void 0;
23240
23306
  if (cleanups) {
23241
- DEBUG3 && log3("cleanup start for real", job);
23307
+ DEBUG2 && log2("cleanup start for real", job);
23242
23308
  for (let i2 = 0; i2 < cleanups.length; i2++) {
23243
23309
  try {
23244
23310
  const result = cleanups[i2]();
@@ -23249,7 +23315,26 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
23249
23315
  onError(err);
23250
23316
  }
23251
23317
  }
23318
+ cleanups.length = 0;
23252
23319
  }
23320
+ return promiseChain;
23321
+ }
23322
+ /** Clean up and trigger signal compute once complete */
23323
+ $runCleanups$(job) {
23324
+ DEBUG2 && log2("cleanup start", job);
23325
+ const onDone = () => {
23326
+ job.$promise$ = null;
23327
+ DEBUG2 && log2("cleanup finished", job);
23328
+ const jobs = this.$jobs$;
23329
+ if (jobs) {
23330
+ const idx = jobs.indexOf(job);
23331
+ if (idx !== -1) {
23332
+ jobs.splice(idx, 1);
23333
+ }
23334
+ }
23335
+ this.$computeIfNeeded$();
23336
+ };
23337
+ const promiseChain = this.$runCleanupCallbacks$(job);
23253
23338
  if (promiseChain) {
23254
23339
  return promiseChain.then(onDone);
23255
23340
  } else {
@@ -23278,8 +23363,8 @@ var implicit$FirstArg = (fn) => {
23278
23363
  };
23279
23364
 
23280
23365
  // packages/qwik/src/core/reactive-primitives/impl/serializer-signal-impl.ts
23281
- var DEBUG4 = false;
23282
- var log4 = (...args) => console.log("SERIALIZER SIGNAL", ...args.map(qwikDebugToString));
23366
+ var DEBUG3 = false;
23367
+ var log3 = (...args) => console.log("SERIALIZER SIGNAL", ...args.map(qwikDebugToString));
23283
23368
  var SerializerSignalImpl = class extends ComputedSignalImpl {
23284
23369
  constructor(container, argQrl) {
23285
23370
  super(
@@ -23306,7 +23391,7 @@ var SerializerSignalImpl = class extends ComputedSignalImpl {
23306
23391
  );
23307
23392
  this.$didInitialize$ = true;
23308
23393
  this.$flags$ &= ~1 /* INVALID */;
23309
- DEBUG4 && log4("SerializerSignal.$compute$", untrackedValue);
23394
+ DEBUG3 && log3("SerializerSignal.$compute$", untrackedValue);
23310
23395
  const didChange = this.$didInitialize$ && untrackedValue !== "undefined" || untrackedValue !== this.$untrackedValue$;
23311
23396
  if (didChange) {
23312
23397
  this.$untrackedValue$ = untrackedValue;
@@ -23315,6 +23400,13 @@ var SerializerSignalImpl = class extends ComputedSignalImpl {
23315
23400
  }
23316
23401
  };
23317
23402
 
23403
+ // packages/qwik/src/core/reactive-primitives/impl/async-signal-impl.ts
23404
+ var AsyncSignalImpl = class extends ComputedSignalImpl {
23405
+ constructor(container, fn, flags = 1 /* INVALID */ | 16 /* SERIALIZATION_STRATEGY_ALWAYS */, options) {
23406
+ super(container, fn, flags | 512 /* ASYNC_MODE */ | 1024 /* CTX_ARG */, options);
23407
+ }
23408
+ };
23409
+
23318
23410
  // packages/qwik/src/core/reactive-primitives/signal-api.ts
23319
23411
  var createSerializerSignal = (arg) => {
23320
23412
  return new SerializerSignalImpl(null, arg);
@@ -23432,8 +23524,11 @@ function setCursorPosition(container, cursorData, position) {
23432
23524
  }
23433
23525
  }
23434
23526
  function mergeCursors(container, newCursorData, oldCursor) {
23435
- removeCursorFromQueue(oldCursor, container);
23436
23527
  const oldCursorData = getCursorData(oldCursor);
23528
+ if (!oldCursorData || oldCursorData === newCursorData) {
23529
+ return;
23530
+ }
23531
+ removeCursorFromQueue(oldCursor, container);
23437
23532
  mergeCursorData(newCursorData, oldCursorData);
23438
23533
  }
23439
23534
  function mergeCursorData(newCursorData, oldCursorData) {
@@ -23492,7 +23587,7 @@ function setCursorData(vNode, cursorData) {
23492
23587
  }
23493
23588
 
23494
23589
  // packages/qwik/src/core/client/vnode-diff.ts
23495
- import { isDev as isDev14 } from "@qwik.dev/core/build";
23590
+ import { isDev as isDev13 } from "@qwik.dev/core/build";
23496
23591
 
23497
23592
  // packages/qwik/src/core/reactive-primitives/subscription-data.ts
23498
23593
  var SubscriptionData = class {
@@ -23503,11 +23598,11 @@ var SubscriptionData = class {
23503
23598
  };
23504
23599
 
23505
23600
  // packages/qwik/src/core/shared/component.public.ts
23506
- import { isDev as isDev12 } from "@qwik.dev/core/build";
23601
+ import { isDev as isDev11 } from "@qwik.dev/core/build";
23507
23602
  var componentQrl = (componentQrl3) => {
23508
23603
  function QwikComponent(props, key, flags = 0) {
23509
- isDev12 && assertQrl(componentQrl3);
23510
- isDev12 && assertNumber(flags, "The Qwik Component was not invoked correctly");
23604
+ isDev11 && assertQrl(componentQrl3);
23605
+ isDev11 && assertNumber(flags, "The Qwik Component was not invoked correctly");
23511
23606
  const hash = qTest ? "sX" : componentQrl3.$hash$.slice(0, 4);
23512
23607
  const finalKey = hash + ":" + (key ? key : "");
23513
23608
  const InnerCmp = () => {
@@ -23602,9 +23697,9 @@ var SSRRaw = () => null;
23602
23697
  var SSRComment = () => null;
23603
23698
 
23604
23699
  // packages/qwik/src/core/client/vnode-namespace.ts
23605
- import { isDev as isDev13 } from "@qwik.dev/core/build";
23700
+ import { isDev as isDev12 } from "@qwik.dev/core/build";
23606
23701
  var isForeignObjectElement = (elementName) => {
23607
- return isDev13 ? elementName.toLowerCase() === "foreignobject" : elementName === "foreignObject";
23702
+ return isDev12 ? elementName.toLowerCase() === "foreignobject" : elementName === "foreignObject";
23608
23703
  };
23609
23704
  var isSvgElement = (elementName) => elementName === "svg" || isForeignObjectElement(elementName);
23610
23705
  var isMathElement = (elementName) => elementName === "math";
@@ -24663,8 +24758,8 @@ function runDiff(diffContext, jsxNode, vStartNode, vCurrent = vnode_getFirstChil
24663
24758
  }
24664
24759
  function diff(diffContext, jsxNode, vStartNode, vCurrent = vnode_getFirstChild(vStartNode), vEnd = null, forceCreationMode = false) {
24665
24760
  const previousCreationMode = diffContext.$isCreationMode$;
24666
- isDev14 && assertFalse(vnode_isVNode(jsxNode), "JSXNode should not be a VNode");
24667
- isDev14 && assertTrue(vnode_isVNode(vStartNode), "vStartNode should be a VNode");
24761
+ isDev13 && assertFalse(vnode_isVNode(jsxNode), "JSXNode should not be a VNode");
24762
+ isDev13 && assertTrue(vnode_isVNode(vStartNode), "vStartNode should be a VNode");
24668
24763
  diffContext.$isCreationMode$ = forceCreationMode || previousCreationMode;
24669
24764
  diffContext.$vParent$ = vStartNode;
24670
24765
  diffContext.$vNewNode$ = null;
@@ -24678,7 +24773,7 @@ function diff(diffContext, jsxNode, vStartNode, vCurrent = vnode_getFirstChild(v
24678
24773
  }
24679
24774
  while (diffContext.$stack$.length) {
24680
24775
  while (diffContext.$jsxIdx$ < diffContext.$jsxCount$) {
24681
- isDev14 && assertFalse(
24776
+ isDev13 && assertFalse(
24682
24777
  diffContext.$vParent$ === diffContext.$vCurrent$,
24683
24778
  "Parent and current can't be the same"
24684
24779
  );
@@ -24719,9 +24814,8 @@ function diff(diffContext, jsxNode, vStartNode, vCurrent = vnode_getFirstChild(v
24719
24814
  diffContext,
24720
24815
  diffContext.$jsxValue$.children,
24721
24816
  true,
24722
- // special case for projection, we don't want to expect no children
24723
- // because the projection's children are not removed
24724
- false
24817
+ /* isProjection */
24818
+ true
24725
24819
  );
24726
24820
  } else if (type === SSRComment) {
24727
24821
  expectNoMore(diffContext);
@@ -24810,18 +24904,22 @@ function advance(diffContext) {
24810
24904
  diffContext.$vCurrent$ = peekNextSiblingWithinBoundary(diffContext, diffContext.$vCurrent$);
24811
24905
  }
24812
24906
  }
24813
- function descend(diffContext, children, descendVNode, shouldExpectNoChildren = true) {
24814
- if (shouldExpectNoChildren && (children == null || descendVNode && isArray(children) && children.length === 0)) {
24907
+ function descend(diffContext, children, descendVNode, isProjection = false) {
24908
+ if (!isProjection && (children == null || descendVNode && isArray(children) && children.length === 0)) {
24815
24909
  expectNoChildren(diffContext);
24816
24910
  return;
24817
24911
  }
24818
24912
  stackPush(diffContext, children, descendVNode);
24819
24913
  if (descendVNode) {
24820
- isDev14 && assertDefined(
24914
+ isDev13 && assertDefined(
24821
24915
  diffContext.$vCurrent$ || diffContext.$vNewNode$,
24822
24916
  "Expecting vCurrent to be defined."
24823
24917
  );
24824
- const creationMode = diffContext.$isCreationMode$ || !!diffContext.$vNewNode$ || !vnode_getFirstChild(diffContext.$vCurrent$);
24918
+ const creationMode = (
24919
+ // a projection keeps its children across re-renders, so it never inherits
24920
+ // creation mode from a not-yet-rendered host; create only if new or empty
24921
+ !isProjection && diffContext.$isCreationMode$ || !!diffContext.$vNewNode$ || !vnode_getFirstChild(diffContext.$vCurrent$)
24922
+ );
24825
24923
  diffContext.$isCreationMode$ = creationMode;
24826
24924
  diffContext.$vSideBuffer$ = null;
24827
24925
  diffContext.$vSiblings$ = null;
@@ -24944,8 +25042,8 @@ function expectProjection(diffContext) {
24944
25042
  diffContext.$vCurrent$ = diffContext.$vCurrent$ && diffContext.$vCurrent$.flags & 32 /* Deleted */ ? null : diffContext.$vCurrent$;
24945
25043
  if (diffContext.$vCurrent$ == null) {
24946
25044
  diffContext.$vNewNode$ = vnode_newVirtual();
24947
- isDev14 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* Projection */);
24948
- isDev14 && vnode_setProp(diffContext.$vNewNode$, "q:code", "expectProjection");
25045
+ isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* Projection */);
25046
+ isDev13 && vnode_setProp(diffContext.$vNewNode$, "q:code", "expectProjection");
24949
25047
  vnode_setProp(diffContext.$vNewNode$, QSlot, slotName);
24950
25048
  diffContext.$vNewNode$.slotParent = diffContext.$vParent$;
24951
25049
  vnode_setProp(diffContext.$vParent$, slotName, diffContext.$vNewNode$);
@@ -24974,7 +25072,7 @@ function expectSlot(diffContext) {
24974
25072
  cursorBoundary
24975
25073
  );
24976
25074
  vHost && vnode_setProp(vHost, slotNameKey, diffContext.$vNewNode$);
24977
- isDev14 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* Projection */);
25075
+ isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* Projection */);
24978
25076
  vnode_insertBefore(
24979
25077
  diffContext.$journal$,
24980
25078
  diffContext.$vParent$,
@@ -24994,7 +25092,7 @@ function expectSlot(diffContext) {
24994
25092
  cursorBoundary
24995
25093
  );
24996
25094
  vHost && vnode_setProp(vHost, slotNameKey, diffContext.$vNewNode$);
24997
- isDev14 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* Projection */);
25095
+ isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "P" /* Projection */);
24998
25096
  vnode_inflateProjectionTrailingText(
24999
25097
  diffContext.$journal$,
25000
25098
  diffContext.$vNewNode$
@@ -25076,7 +25174,7 @@ function expectNoChildren(diffContext, removeDOM = true) {
25076
25174
  }
25077
25175
  function expectNoMore(diffContext) {
25078
25176
  const boundary = getLevelBoundary(diffContext);
25079
- isDev14 && assertFalse(
25177
+ isDev13 && assertFalse(
25080
25178
  diffContext.$vParent$ === diffContext.$vCurrent$,
25081
25179
  "Parent and current can't be the same"
25082
25180
  );
@@ -25137,7 +25235,7 @@ function applyConstInnerHtml(element, value) {
25137
25235
  }
25138
25236
  function applyConstTextareaValue(element, value, currentFile) {
25139
25237
  if (value && typeof value !== "string") {
25140
- if (isDev14) {
25238
+ if (isDev13) {
25141
25239
  throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
25142
25240
  }
25143
25241
  return true;
@@ -25272,7 +25370,7 @@ function expectElement(diffContext, jsx2, elementName) {
25272
25370
  const jsxProps = jsx2.varProps;
25273
25371
  const vNode = diffContext.$vNewNode$ || diffContext.$vCurrent$;
25274
25372
  if (jsxProps) {
25275
- diffProps(diffContext, vNode, jsxProps, isDev14 && getFileLocationFromJsx(jsx2.dev) || null);
25373
+ diffProps(diffContext, vNode, jsxProps, isDev13 && getFileLocationFromJsx(jsx2.dev) || null);
25276
25374
  }
25277
25375
  }
25278
25376
  function diffProps(diffContext, vnode, newAttrs, currentFile) {
@@ -25280,14 +25378,17 @@ function diffProps(diffContext, vnode, newAttrs, currentFile) {
25280
25378
  vnode_ensureElementInflated(diffContext.$container$, vnode);
25281
25379
  }
25282
25380
  const oldAttrs = vnode.props;
25381
+ const isHtml = (vnode.flags & 1536 /* NAMESPACE_MASK */) === 0 /* NS_html */;
25283
25382
  for (const key in newAttrs) {
25284
25383
  const newValue = newAttrs[key];
25285
- if (oldAttrs && _hasOwnProperty3.call(oldAttrs, key)) {
25286
- const oldValue = oldAttrs[key];
25287
- if (newValue !== oldValue) {
25288
- if (newValue instanceof WrappedSignalImpl && oldValue instanceof WrappedSignalImpl && areWrappedSignalsEqual(newValue, oldValue)) {
25289
- continue;
25290
- }
25384
+ const oldKey = oldAttrs && isHtml && !_hasOwnProperty3.call(oldAttrs, key) ? key.toLowerCase() : key;
25385
+ if (oldAttrs && _hasOwnProperty3.call(oldAttrs, oldKey)) {
25386
+ const oldValue = oldAttrs[oldKey];
25387
+ if (oldKey !== key) {
25388
+ vnode_setProp(vnode, oldKey, null);
25389
+ vnode_setProp(vnode, key, oldValue);
25390
+ }
25391
+ if (!areDiffValuesEqual(newValue, oldValue)) {
25291
25392
  patchProperty(diffContext, vnode, key, newValue, currentFile);
25292
25393
  }
25293
25394
  } else if (newValue != null) {
@@ -25532,7 +25633,7 @@ function expectVirtual(diffContext, type, jsxKey) {
25532
25633
  getInsertBefore(diffContext)
25533
25634
  );
25534
25635
  diffContext.$vNewNode$.key = jsxKey;
25535
- isDev14 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, type);
25636
+ isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, type);
25536
25637
  return;
25537
25638
  }
25538
25639
  if (moveOrCreateKeyedNode(
@@ -25550,7 +25651,7 @@ function expectVirtual(diffContext, type, jsxKey) {
25550
25651
  getInsertBefore(diffContext)
25551
25652
  );
25552
25653
  diffContext.$vNewNode$.key = jsxKey;
25553
- isDev14 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, type);
25654
+ isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, type);
25554
25655
  }
25555
25656
  }
25556
25657
  function expectComponent(diffContext, component) {
@@ -25662,7 +25763,7 @@ function insertNewComponent(diffContext, host, componentQRL, jsxProps) {
25662
25763
  getInsertBefore(diffContext)
25663
25764
  );
25664
25765
  const jsxNode = diffContext.$jsxValue$;
25665
- isDev14 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "C" /* Component */);
25766
+ isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "C" /* Component */);
25666
25767
  vnode_setProp(diffContext.$vNewNode$, OnRenderProp, componentQRL);
25667
25768
  vnode_setProp(diffContext.$vNewNode$, ELEMENT_PROPS, jsxProps);
25668
25769
  diffContext.$vNewNode$.key = jsxNode.key;
@@ -25675,7 +25776,7 @@ function insertNewInlineComponent(diffContext) {
25675
25776
  getInsertBefore(diffContext)
25676
25777
  );
25677
25778
  const jsxNode = diffContext.$jsxValue$;
25678
- isDev14 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "I" /* InlineComponent */);
25779
+ isDev13 && vnode_setProp(diffContext.$vNewNode$, DEBUG_TYPE, "I" /* InlineComponent */);
25679
25780
  vnode_setProp(diffContext.$vNewNode$, ELEMENT_PROPS, jsxNode.props);
25680
25781
  if (jsxNode.key) {
25681
25782
  diffContext.$vNewNode$.key = jsxNode.key;
@@ -25754,10 +25855,21 @@ function handleChangedProps(src, dst, propsHandler, container, triggerEffects =
25754
25855
  if (key === "children" || key === QBackRefs) {
25755
25856
  continue;
25756
25857
  }
25757
- if (!dst || src[key] !== dst[key]) {
25858
+ const newValue = src[key];
25859
+ const oldValue = dst?.[key];
25860
+ if (!dst || !(areDiffValuesEqual(newValue, oldValue) || areSignalValuesEqual(newValue, oldValue))) {
25861
+ if (key === "class") {
25862
+ if (areClassValuesEqual(newValue, oldValue)) {
25863
+ continue;
25864
+ }
25865
+ } else if (key === "style") {
25866
+ if (areStyleValuesEqual(newValue, oldValue)) {
25867
+ continue;
25868
+ }
25869
+ }
25758
25870
  if (triggerEffects) {
25759
25871
  if (dst) {
25760
- dst[key] = src[key];
25872
+ dst[key] = newValue;
25761
25873
  }
25762
25874
  const didTigger = triggerPropsProxyEffect(propsHandler, key);
25763
25875
  if (!didTigger) {
@@ -25821,10 +25933,12 @@ function cleanup(container, journal, vNode, cursorRoot = null) {
25821
25933
  obj.$flags$ |= 16 /* NEEDS_CLEANUP */;
25822
25934
  markVNodeDirty(container, vCursor, 128 /* CLEANUP */, cursorRoot);
25823
25935
  continue;
25824
- } else if (obj instanceof SignalImpl || isStore(obj)) {
25825
- clearAllEffects(container, obj);
25936
+ } else if (obj instanceof ComputedSignalImpl || obj instanceof WrappedSignalImpl) {
25937
+ if (!(obj.$flags$ & 4 /* PRESERVE_ON_SEQ_CLEANUP */)) {
25938
+ clearAllEffects(container, obj);
25939
+ }
25826
25940
  }
25827
- if (objIsTask || obj instanceof AsyncSignalImpl) {
25941
+ if (objIsTask || obj instanceof ComputedSignalImpl && (obj.$flags$ & 512 /* ASYNC_MODE */ || obj.$current$)) {
25828
25942
  cleanupDestroyable(obj);
25829
25943
  }
25830
25944
  }
@@ -25916,6 +26030,35 @@ function cleanupStaleUnclaimedProjection(container, journal, projection) {
25916
26030
  function markVNodeAsDeleted(vCursor) {
25917
26031
  vCursor.flags |= 32 /* Deleted */;
25918
26032
  }
26033
+ function areDiffValuesEqual(newValue, oldValue) {
26034
+ if (newValue === oldValue) {
26035
+ return true;
26036
+ }
26037
+ return newValue instanceof WrappedSignalImpl && oldValue instanceof WrappedSignalImpl && areWrappedSignalsEqual(oldValue, newValue);
26038
+ }
26039
+ function areSignalValuesEqual(newValue, oldValue) {
26040
+ if (newValue === oldValue) {
26041
+ return true;
26042
+ }
26043
+ if (isSignal(newValue) && isSignal(oldValue)) {
26044
+ const unwrappedNew = newValue instanceof WrappedSignalImpl ? newValue.$unwrapIfSignal$() : newValue;
26045
+ const unwrappedOld = oldValue instanceof WrappedSignalImpl ? oldValue.$unwrapIfSignal$() : oldValue;
26046
+ return untrack(() => unwrappedNew.value === unwrappedOld.value);
26047
+ }
26048
+ return false;
26049
+ }
26050
+ function areStyleValuesEqual(newValue, oldValue) {
26051
+ if (newValue === oldValue) {
26052
+ return true;
26053
+ }
26054
+ return stringifyStyle(newValue) === stringifyStyle(oldValue);
26055
+ }
26056
+ function areClassValuesEqual(newValue, oldValue) {
26057
+ if (newValue === oldValue) {
26058
+ return true;
26059
+ }
26060
+ return serializeClass(newValue) === serializeClass(oldValue);
26061
+ }
25919
26062
  function areWrappedSignalsEqual(oldSignal, newSignal) {
25920
26063
  if (oldSignal === newSignal) {
25921
26064
  return true;
@@ -25950,7 +26093,7 @@ function containsWrappedSignal(data, signal) {
25950
26093
  }
25951
26094
 
25952
26095
  // packages/qwik/src/core/shared/component-execution.ts
25953
- import { isDev as isDev15, isServer as isServer6 } from "@qwik.dev/core/build";
26096
+ import { isDev as isDev14, isServer as isServer6 } from "@qwik.dev/core/build";
25954
26097
  var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
25955
26098
  const iCtx = newRenderInvokeContext(
25956
26099
  container.$locale$,
@@ -25966,7 +26109,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
25966
26109
  let isInlineComponent = false;
25967
26110
  if (componentQRL === null) {
25968
26111
  componentQRL = container.getHostProp(renderHost, OnRenderProp);
25969
- isDev15 && assertDefined(componentQRL, "No Component found at this location");
26112
+ isDev14 && assertDefined(componentQRL, "No Component found at this location");
25970
26113
  }
25971
26114
  if (isQrl(componentQRL)) {
25972
26115
  props = props || container.getHostProp(renderHost, ELEMENT_PROPS) || EMPTY_OBJ;
@@ -26047,7 +26190,7 @@ function addUseOnEvents(container, jsx2, useOnEvents) {
26047
26190
  }
26048
26191
  targetElement = placeholderElement;
26049
26192
  } else {
26050
- if (isDev15) {
26193
+ if (isDev14) {
26051
26194
  const sourceLocation = getUseOnSourceLocation(useOnEvents[key].qrls);
26052
26195
  logWarn(
26053
26196
  'You are trying to add an event "' + key + '" using `useOn` hook, but a node to which you can add an event is not found. Please make sure that the component outputs a DOM element.' + (sourceLocation ? ` Offending \`useOn\`: ${sourceLocation}.` : "")
@@ -26059,7 +26202,7 @@ function addUseOnEvents(container, jsx2, useOnEvents) {
26059
26202
  if (targetElement) {
26060
26203
  if (targetElement.type === "script" && key === qVisibleEvent) {
26061
26204
  eventKey = "q-d:qinit";
26062
- if (isDev15) {
26205
+ if (isDev14) {
26063
26206
  const sourceLocation = getUseOnSourceLocation(useOnEvents[key].qrls);
26064
26207
  logWarn(
26065
26208
  `You are trying to add the event "${key}" using the \`useVisibleTask$\` hook with the "intersection-observer" strategy, but this only works when the component outputs a DOM element. Falling back to "document-ready" instead.` + (sourceLocation ? ` Offending \`useVisibleTask$\`: ${sourceLocation}.` : "")
@@ -26172,7 +26315,7 @@ function createPlaceholderScriptNode() {
26172
26315
  }
26173
26316
 
26174
26317
  // packages/qwik/src/core/client/reconcile-keyed-loop.ts
26175
- import { isDev as isDev16 } from "@qwik.dev/core/build";
26318
+ import { isDev as isDev15 } from "@qwik.dev/core/build";
26176
26319
  function collectChildren(first, last = null) {
26177
26320
  const children = [];
26178
26321
  let child = first;
@@ -26187,7 +26330,7 @@ function collectChildren(first, last = null) {
26187
26330
  }
26188
26331
  function renderKeyedRow(item, index, key, renderItem) {
26189
26332
  const jsx2 = renderItem(item, index);
26190
- if (isDev16 && !isJSXNode(jsx2)) {
26333
+ if (isDev15 && !isJSXNode(jsx2)) {
26191
26334
  throw new Error("Each item$ must return a single JSX node");
26192
26335
  }
26193
26336
  jsx2.key = key;
@@ -26413,7 +26556,7 @@ function reconcileKeyedLoopToParent(container, journal, parent, cursor, items, k
26413
26556
  );
26414
26557
  return maybeThen(result, () => {
26415
26558
  const firstInserted = firstInsertedBeforeAnchor(parent, anchor, blockLength);
26416
- if (isDev16 && !firstInserted) {
26559
+ if (isDev15 && !firstInserted) {
26417
26560
  throw new Error("Failed to insert keyed loop block");
26418
26561
  }
26419
26562
  anchor = firstInserted;
@@ -26525,12 +26668,15 @@ function executeNodeDiff(vNode, container, journal, cursor) {
26525
26668
  return vnode_diff(container, journal, jsx2, domVNode, cursor, null);
26526
26669
  }
26527
26670
  function executeComponentChore(vNode, container, journal, cursor) {
26528
- vNode.dirty &= ~4 /* COMPONENT */;
26529
26671
  const host = vNode;
26530
26672
  const componentQRL = container.getHostProp(
26531
26673
  host,
26532
26674
  OnRenderProp
26533
26675
  );
26676
+ if (componentQRL && !componentQRL.resolved) {
26677
+ return componentQRL.resolve();
26678
+ }
26679
+ vNode.dirty &= ~4 /* COMPONENT */;
26534
26680
  if (!componentQRL) {
26535
26681
  return;
26536
26682
  }
@@ -26708,7 +26854,7 @@ function executeReconcile(vNode, container, journal, cursor) {
26708
26854
  }
26709
26855
 
26710
26856
  // packages/qwik/src/core/shared/cursor/cursor-flush.ts
26711
- var DEBUG5 = false;
26857
+ var DEBUG4 = false;
26712
26858
  function executeFlushPhase(cursor, container) {
26713
26859
  const cursorData = getCursorData(cursor);
26714
26860
  const journal = cursorData.journal;
@@ -26726,7 +26872,7 @@ var fastInsertBefore = (insertBeforeParent, target, insertBefore) => {
26726
26872
  _insertBefore.call(insertBeforeParent, target, insertBefore);
26727
26873
  };
26728
26874
  function _flushJournal(journal) {
26729
- DEBUG5 && console.warn("walkCursor: flushing journal", vnode_journalToString(journal));
26875
+ DEBUG4 && console.warn("walkCursor: flushing journal", vnode_journalToString(journal));
26730
26876
  let batchParent = null;
26731
26877
  let batchBefore = null;
26732
26878
  let batchNodes = null;
@@ -26835,7 +26981,7 @@ function executeAfterFlush(container, cursorData) {
26835
26981
  cursorData.afterFlushTasks = null;
26836
26982
  return;
26837
26983
  }
26838
- DEBUG5 && console.warn(
26984
+ DEBUG4 && console.warn(
26839
26985
  "walkCursor: executeAfterFlush",
26840
26986
  visibleTasks.map((t) => t.$qrl$.$symbol$)
26841
26987
  );
@@ -26864,8 +27010,21 @@ var createMacroTask = (fn) => {
26864
27010
  let macroTask;
26865
27011
  if (typeof MessageChannel !== "undefined") {
26866
27012
  const channel = new MessageChannel();
27013
+ let active = true;
26867
27014
  channel.port1.onmessage = () => fn();
26868
- macroTask = () => channel.port2.postMessage(null);
27015
+ macroTask = () => {
27016
+ if (active) {
27017
+ channel.port2.postMessage(null);
27018
+ }
27019
+ };
27020
+ macroTask.$destroy$ = () => {
27021
+ if (active) {
27022
+ active = false;
27023
+ channel.port1.onmessage = null;
27024
+ channel.port1.close();
27025
+ channel.port2.close();
27026
+ }
27027
+ };
26869
27028
  } else {
26870
27029
  macroTask = () => setTimeout(fn);
26871
27030
  }
@@ -26873,8 +27032,8 @@ var createMacroTask = (fn) => {
26873
27032
  };
26874
27033
 
26875
27034
  // packages/qwik/src/core/shared/cursor/cursor-walker.ts
26876
- import { isDev as isDev17, isServer as isServer7 } from "@qwik.dev/core/build";
26877
- var DEBUG6 = false;
27035
+ import { isDev as isDev16, isServer as isServer7 } from "@qwik.dev/core/build";
27036
+ var DEBUG5 = false;
26878
27037
  var nextMicroTask = createMicroTask(processCursorQueue);
26879
27038
  var nextMacroTask = createMacroTask(processCursorQueue);
26880
27039
  var isNextTickScheduled = false;
@@ -26910,7 +27069,7 @@ function walkCursor(cursor, until) {
26910
27069
  return;
26911
27070
  }
26912
27071
  const container = cursorData.container;
26913
- isDev17 && assertDefined(container, "Cursor container not found");
27072
+ isDev16 && assertDefined(container, "Cursor container not found");
26914
27073
  if (!cursor.dirty) {
26915
27074
  finishWalk(container, cursor, cursorData, isRunningOnServer);
26916
27075
  return;
@@ -26919,8 +27078,8 @@ function walkCursor(cursor, until) {
26919
27078
  let currentVNode = null;
26920
27079
  let count = 0;
26921
27080
  while (currentVNode = cursorData.position) {
26922
- DEBUG6 && console.warn("walkCursor", currentVNode.toString());
26923
- if (DEBUG6 && count++ > 1e3) {
27081
+ DEBUG5 && console.warn("walkCursor", currentVNode.toString());
27082
+ if (DEBUG5 && count++ > 1e3) {
26924
27083
  throw new Error("Infinite loop detected in cursor walker");
26925
27084
  }
26926
27085
  if (cursorData.promise) {
@@ -26974,7 +27133,7 @@ function walkCursor(cursor, until) {
26974
27133
  container.handleError(error, currentVNode);
26975
27134
  }
26976
27135
  if (result && isPromise(result)) {
26977
- DEBUG6 && console.warn("walkCursor: blocking promise", currentVNode.toString());
27136
+ DEBUG5 && console.warn("walkCursor: blocking promise", currentVNode.toString());
26978
27137
  addCursorBoundary(cursorData, currentVNode);
26979
27138
  const blockingPromise2 = result;
26980
27139
  cursorData.promise = blockingPromise2;
@@ -26998,7 +27157,7 @@ function walkCursor(cursor, until) {
26998
27157
  return true;
26999
27158
  }
27000
27159
  }
27001
- isDev17 && assertFalse(
27160
+ isDev16 && assertFalse(
27002
27161
  !!(cursor.dirty & 1023 /* DIRTY_MASK */ && !cursorData.position),
27003
27162
  "Cursor is still dirty and position is not set after walking"
27004
27163
  );
@@ -27007,7 +27166,7 @@ function walkCursor(cursor, until) {
27007
27166
  function finishWalk(container, cursor, cursorData, isServer12) {
27008
27167
  if (!(cursor.dirty & 1023 /* DIRTY_MASK */)) {
27009
27168
  removeCursorFromQueue(cursor, container);
27010
- DEBUG6 && console.warn("walkCursor: cursor done", cursor.toString());
27169
+ DEBUG5 && console.warn("walkCursor: cursor done", cursor.toString());
27011
27170
  if (!isServer12) {
27012
27171
  executeFlushPhase(cursor, container);
27013
27172
  }
@@ -27022,7 +27181,7 @@ function finishWalk(container, cursor, cursorData, isServer12) {
27022
27181
  }
27023
27182
  }
27024
27183
  function resolveCursor(container) {
27025
- DEBUG6 && console.warn(`walkCursor: cursor resolved, ${container.$pendingCount$} remaining`);
27184
+ DEBUG5 && console.warn(`walkCursor: cursor resolved, ${container.$pendingCount$} remaining`);
27026
27185
  container.$checkPendingCount$();
27027
27186
  }
27028
27187
  function tryDescendDirtyChildren(container, cursorData, currentVNode, cursor) {
@@ -27114,6 +27273,10 @@ function splitCursorBoundary(container, vNode) {
27114
27273
 
27115
27274
  // packages/qwik/src/core/shared/cursor/cursor.ts
27116
27275
  function addCursor(container, root, priority) {
27276
+ if (isCursor(root)) {
27277
+ triggerCursors();
27278
+ return root;
27279
+ }
27117
27280
  const cursorData = {
27118
27281
  afterFlushTasks: null,
27119
27282
  extraPromises: null,
@@ -27276,10 +27439,10 @@ function addVNodeOperation(journal, operation) {
27276
27439
  }
27277
27440
 
27278
27441
  // packages/qwik/src/core/reactive-primitives/impl/wrapped-signal-impl.ts
27279
- import { isDev as isDev18 } from "@qwik.dev/core/build";
27280
- var _a4, _b3;
27281
- var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a4 = _EFFECT_BACK_REF, _b3) {
27282
- constructor(container, fn, args, fnStr, flags = 1 /* INVALID */ | 4 /* UNWRAP */) {
27442
+ import { isDev as isDev17 } from "@qwik.dev/core/build";
27443
+ var _a3, _b2;
27444
+ var WrappedSignalImpl = class extends (_b2 = SignalImpl, _a3 = _EFFECT_BACK_REF, _b2) {
27445
+ constructor(container, fn, args, fnStr, flags = 1 /* INVALID */) {
27283
27446
  super(container, NEEDS_COMPUTATION);
27284
27447
  __publicField(this, "$args$");
27285
27448
  __publicField(this, "$func$");
@@ -27288,7 +27451,7 @@ var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a4 = _EFFECT_BACK_REF,
27288
27451
  __publicField(this, "$hostElement$");
27289
27452
  // important: don't use implemnets BackRef here
27290
27453
  // it causes v8 optimizations eager bailouts, because of not consistent class shape
27291
- __publicField(this, _a4);
27454
+ __publicField(this, _a3);
27292
27455
  this.$args$ = args;
27293
27456
  this.$func$ = fn;
27294
27457
  this.$funcStr$ = fnStr;
@@ -27311,7 +27474,7 @@ var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a4 = _EFFECT_BACK_REF,
27311
27474
  }
27312
27475
  get untrackedValue() {
27313
27476
  this.$computeIfNeeded$();
27314
- isDev18 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
27477
+ isDev17 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
27315
27478
  return this.$untrackedValue$;
27316
27479
  }
27317
27480
  $computeIfNeeded$() {
@@ -27364,10 +27527,11 @@ function clearEffectSubscription(container, effect) {
27364
27527
  return;
27365
27528
  }
27366
27529
  for (const producer of backRefs) {
27367
- if (producer instanceof AsyncSignalImpl) {
27368
- clearAsyncSignal(producer, effect);
27369
- } else if (producer instanceof SignalImpl) {
27530
+ if (producer instanceof SignalImpl) {
27370
27531
  clearSignal(container, producer, effect);
27532
+ if (producer instanceof ComputedSignalImpl) {
27533
+ clearAsyncSignalEffects(producer, effect);
27534
+ }
27371
27535
  } else if (isPropsProxy(producer)) {
27372
27536
  const propsHandler = producer[_PROPS_HANDLER];
27373
27537
  clearStoreOrProps(propsHandler, effect);
@@ -27389,11 +27553,7 @@ function clearSignal(container, producer, effect) {
27389
27553
  clearAllEffects(container, producer);
27390
27554
  }
27391
27555
  }
27392
- function clearAsyncSignal(producer, effect) {
27393
- const effects = producer.$effects$;
27394
- if (effects && effects.has(effect)) {
27395
- effects.delete(effect);
27396
- }
27556
+ function clearAsyncSignalEffects(producer, effect) {
27397
27557
  const pendingEffects = producer.$loadingEffects$;
27398
27558
  if (pendingEffects && pendingEffects.has(effect)) {
27399
27559
  pendingEffects.delete(effect);
@@ -27463,13 +27623,12 @@ var runTask = (task, container, host) => {
27463
27623
  return result;
27464
27624
  };
27465
27625
  var Task = class extends BackRef {
27466
- constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
27626
+ constructor($flags$, $index$, $el$, $qrl$, $destroy$) {
27467
27627
  super();
27468
27628
  this.$flags$ = $flags$;
27469
27629
  this.$index$ = $index$;
27470
27630
  this.$el$ = $el$;
27471
27631
  this.$qrl$ = $qrl$;
27472
- this.$state$ = $state$;
27473
27632
  this.$destroy$ = $destroy$;
27474
27633
  __publicField(this, "$destroyPromise$");
27475
27634
  __publicField(this, "$taskPromise$", null);
@@ -27480,7 +27639,7 @@ var isTask = (value) => {
27480
27639
  };
27481
27640
 
27482
27641
  // packages/qwik/src/core/shared/cursor/ssr-chore-execution.ts
27483
- import { isDev as isDev19 } from "@qwik.dev/core/build";
27642
+ import { isDev as isDev18 } from "@qwik.dev/core/build";
27484
27643
  function _executeSsrChores(container, ssrNode) {
27485
27644
  if (!(ssrNode.flags & 1 /* Updatable */)) {
27486
27645
  if (ssrNode.dirty & 16 /* NODE_PROPS */) {
@@ -27489,7 +27648,8 @@ function _executeSsrChores(container, ssrNode) {
27489
27648
  if (ssrNode.dirty & 32 /* COMPUTE */) {
27490
27649
  executeCompute(ssrNode, container);
27491
27650
  }
27492
- if (isDev19 && ssrNode.dirty & 1023 /* DIRTY_MASK */) {
27651
+ if (isDev18 && ssrNode.dirty & 1023 /* DIRTY_MASK */ && !(ssrNode.flags & 2 /* WarnedStreamedChore */)) {
27652
+ ssrNode.flags |= 2 /* WarnedStreamedChore */;
27493
27653
  const warningMessage = `A chore was scheduled on a host element that has already been streamed to the client.
27494
27654
  This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
27495
27655
 
@@ -27588,22 +27748,27 @@ var getAsyncLocalStorage = () => {
27588
27748
  };
27589
27749
 
27590
27750
  // packages/qwik/src/core/shared/jsx/bind-handlers.ts
27591
- var maybeScopeFromQL = (captureIds, element) => {
27592
- if (typeof captureIds === "string") {
27751
+ var withScopeFromQL = (captureDeltas, element, callback) => {
27752
+ if (typeof captureDeltas === "string") {
27593
27753
  const container = getDomContainer(element);
27594
- setCaptures(deserializeCaptures(container, captureIds));
27754
+ return whenContainerDataReady(container, () => {
27755
+ setCaptures(deserializeCaptureDeltas(container, captureDeltas));
27756
+ return callback();
27757
+ });
27595
27758
  }
27596
- return null;
27759
+ return callback();
27597
27760
  };
27598
27761
  function _val(_, element) {
27599
- maybeScopeFromQL(this, element);
27600
- const signal = _captures[0];
27601
- signal.value = element.type === "number" ? element.valueAsNumber : element.value;
27762
+ return withScopeFromQL(this, element, () => {
27763
+ const signal = _captures[0];
27764
+ signal.value = element.type === "number" ? element.valueAsNumber : element.value;
27765
+ });
27602
27766
  }
27603
27767
  function _chk(_, element) {
27604
- maybeScopeFromQL(this, element);
27605
- const signal = _captures[0];
27606
- signal.value = element.checked;
27768
+ return withScopeFromQL(this, element, () => {
27769
+ const signal = _captures[0];
27770
+ signal.value = element.checked;
27771
+ });
27607
27772
  }
27608
27773
 
27609
27774
  // packages/qwik/src/core/shared/serdes/subscription-patch.ts
@@ -27627,6 +27792,7 @@ var stringifyRootRefPath = (path) => {
27627
27792
  };
27628
27793
  var writeStringRootRef = (writer, id) => writer.write(String(id));
27629
27794
  var writeStringRootRefPath = (writer, path) => writer.write(stringifyRootRefPath(path));
27795
+ var writeStringRootRefDelta = (writer, id, base2) => writer.write(String(id - base2));
27630
27796
  var createStringStreamWriter = (write) => ({
27631
27797
  write,
27632
27798
  writeRootRef(id) {
@@ -27634,11 +27800,14 @@ var createStringStreamWriter = (write) => ({
27634
27800
  },
27635
27801
  writeRootRefPath(path) {
27636
27802
  return writeStringRootRefPath(this, path);
27803
+ },
27804
+ writeRootRefDelta(id, base2) {
27805
+ return writeStringRootRefDelta(this, id, base2);
27637
27806
  }
27638
27807
  });
27639
27808
 
27640
27809
  // packages/qwik/src/core/shared/serdes/serialize.ts
27641
- import { isDev as isDev20 } from "@qwik.dev/core/build";
27810
+ import { isDev as isDev19 } from "@qwik.dev/core/build";
27642
27811
 
27643
27812
  // packages/qwik/src/core/shared/ssr-const.ts
27644
27813
  var LT = "<";
@@ -27778,6 +27947,36 @@ var Serializer = class {
27778
27947
  }
27779
27948
  return Number(key);
27780
27949
  }
27950
+ rebaseQrlCaptureDeltas$(baseRootId, captureDeltas) {
27951
+ let previousCaptureId = 0;
27952
+ let previousOutputBase = baseRootId;
27953
+ const deltaList = captureDeltas.split(" ");
27954
+ for (let i2 = 0; i2 < deltaList.length; i2++) {
27955
+ const captureId = previousCaptureId + Number(deltaList[i2]);
27956
+ deltaList[i2] = String(captureId - previousOutputBase);
27957
+ previousCaptureId = captureId;
27958
+ previousOutputBase = captureId;
27959
+ }
27960
+ return deltaList.join(" ");
27961
+ }
27962
+ outputShortStringConstant$(value) {
27963
+ switch (value) {
27964
+ case ":":
27965
+ this.output(3 /* Constant */, 18 /* Colon */);
27966
+ return true;
27967
+ case ".":
27968
+ this.output(3 /* Constant */, 19 /* Dot */);
27969
+ return true;
27970
+ case "id":
27971
+ this.output(3 /* Constant */, 20 /* Id */);
27972
+ return true;
27973
+ case "ref":
27974
+ this.output(3 /* Constant */, 21 /* Ref */);
27975
+ return true;
27976
+ default:
27977
+ return false;
27978
+ }
27979
+ }
27781
27980
  outputString(value) {
27782
27981
  const s = this.stringNeedsJsonEscape$(value) ? JSON.stringify(value) : QUOTE + value + QUOTE;
27783
27982
  let angleBracketIdx = -1;
@@ -27795,6 +27994,9 @@ var Serializer = class {
27795
27994
  writeRootRefPath(path) {
27796
27995
  this.$writer$.writeRootRefPath(path);
27797
27996
  }
27997
+ writeRootRefDelta(id, base2) {
27998
+ this.$writer$.writeRootRefDelta(id, base2);
27999
+ }
27798
28000
  outputStringChunks(chunks) {
27799
28001
  this.$writer$.write(QUOTE);
27800
28002
  for (let i2 = 0; i2 < chunks.length; i2++) {
@@ -27803,6 +28005,8 @@ var Serializer = class {
27803
28005
  this.$writer$.write(chunk);
27804
28006
  } else if (typeof chunk === "number") {
27805
28007
  this.writeRootRef(chunk);
28008
+ } else if ("base" in chunk) {
28009
+ this.writeRootRefDelta(chunk.id, chunk.base);
27806
28010
  } else {
27807
28011
  this.writeRootRefPath(chunk.path);
27808
28012
  }
@@ -27910,6 +28114,8 @@ var Serializer = class {
27910
28114
  case "string":
27911
28115
  if (value.length === 0) {
27912
28116
  this.output(3 /* Constant */, 4 /* EmptyString */);
28117
+ } else if (this.outputShortStringConstant$(value)) {
28118
+ break;
27913
28119
  } else {
27914
28120
  if (value.length < 4 || this.getSeenRefOrOutput(value, index)) {
27915
28121
  this.output(0 /* Plain */, value);
@@ -27930,6 +28136,8 @@ var Serializer = class {
27930
28136
  this.output(3 /* Constant */, 9 /* UNINITIALIZED */);
27931
28137
  } else if (value === explicitUndefined) {
27932
28138
  this.output(3 /* Constant */, 0 /* Undefined */);
28139
+ } else {
28140
+ throw qError(20 /* serializeErrorUnknownType */, [typeof value]);
27933
28141
  }
27934
28142
  break;
27935
28143
  case "function":
@@ -27939,29 +28147,38 @@ var Serializer = class {
27939
28147
  this.output(3 /* Constant */, 11 /* Fragment */);
27940
28148
  } else if (isQrl(value)) {
27941
28149
  if (this.getSeenRefOrOutput(value, index)) {
27942
- const [chunk, symbol, captures] = qrlToString(
28150
+ const [chunk, symbol, captureDeltasFromZero] = qrlToString(
27943
28151
  this.$serializationContext$,
27944
28152
  value,
27945
28153
  true
27946
28154
  );
27947
28155
  let data;
27948
28156
  if (chunk !== "") {
27949
- data = [
27950
- this.$serializationContext$.$addRoot$(chunk),
27951
- "#",
27952
- this.$serializationContext$.$addRoot$(symbol)
27953
- ];
27954
- if (captures) {
27955
- const captureIds = captures.split(" ");
28157
+ const chunkRootId = this.$serializationContext$.$addRoot$(chunk);
28158
+ const symbolRootId = this.$serializationContext$.$addRoot$(symbol);
28159
+ const captureDeltas = captureDeltasFromZero ? this.rebaseQrlCaptureDeltas$(symbolRootId, captureDeltasFromZero) : null;
28160
+ data = [chunkRootId, "#", { id: symbolRootId, base: chunkRootId }];
28161
+ if (captureDeltasFromZero) {
28162
+ let previousRootId = 0;
28163
+ let previousOutputBase = symbolRootId;
28164
+ let start = 0;
27956
28165
  data.push("#");
27957
- for (let i2 = 0; i2 < captureIds.length; i2++) {
27958
- if (i2 > 0) {
27959
- data.push(" ");
28166
+ for (let i2 = 0; i2 <= captureDeltasFromZero.length; i2++) {
28167
+ if (i2 === captureDeltasFromZero.length || captureDeltasFromZero[i2] === " ") {
28168
+ if (i2 > start) {
28169
+ const captureId = previousRootId + Number(captureDeltasFromZero.slice(start, i2));
28170
+ if (start > 0) {
28171
+ data.push(" ");
28172
+ }
28173
+ data.push({ id: captureId, base: previousOutputBase });
28174
+ previousRootId = captureId;
28175
+ previousOutputBase = captureId;
28176
+ }
28177
+ start = i2 + 1;
27960
28178
  }
27961
- data.push(Number(captureIds[i2]));
27962
28179
  }
27963
28180
  }
27964
- const qrlKey = data.join("");
28181
+ const qrlKey = `${chunkRootId}#${symbolRootId - chunkRootId}${captureDeltas ? "#" + captureDeltas : ""}`;
27965
28182
  const existing = this.$qrlMap$.get(qrlKey);
27966
28183
  if (existing) {
27967
28184
  const ref = this.$serializationContext$.$addRoot$(existing);
@@ -28017,12 +28234,21 @@ var Serializer = class {
28017
28234
  value[_PROPS_HANDLER].$effects$
28018
28235
  ]);
28019
28236
  } else if (value instanceof SubscriptionData) {
28020
- this.output(39 /* SubscriptionData */, [
28021
- value.data.$scopedStyleIdPrefix$,
28022
- value.data.$isConst$
28023
- ]);
28237
+ const { $scopedStyleIdPrefix$, $isConst$ } = value.data;
28238
+ if ($scopedStyleIdPrefix$ === null) {
28239
+ this.output(
28240
+ $isConst$ ? 42 /* SubscriptionDataConstTrue */ : 43 /* SubscriptionDataConstFalse */,
28241
+ 0
28242
+ );
28243
+ } else {
28244
+ this.output(39 /* SubscriptionData */, [$scopedStyleIdPrefix$, $isConst$]);
28245
+ }
28024
28246
  } else if (value instanceof EffectSubscription) {
28025
- this.output(40 /* EffectSubscription */, [value.consumer, value.property, value.data]);
28247
+ if (value.data === null) {
28248
+ this.output(44 /* EffectSubscriptionNoData */, [value.consumer, value.property]);
28249
+ } else {
28250
+ this.output(40 /* EffectSubscription */, [value.consumer, value.property, value.data]);
28251
+ }
28026
28252
  } else if (value instanceof SubscriptionPatch) {
28027
28253
  this.output(41 /* SubscriptionPatch */, [value.rootId, value.subscriptions]);
28028
28254
  } else if (isStore(value)) {
@@ -28074,7 +28300,7 @@ var Serializer = class {
28074
28300
  }
28075
28301
  }
28076
28302
  }
28077
- this.output(5 /* Object */, out.length ? out : 0);
28303
+ this.output(5 /* Object */, out.length ? out : EMPTY_OBJECT_PAYLOAD);
28078
28304
  }
28079
28305
  } else if (this.$serializationContext$.$isDomRef$(value)) {
28080
28306
  this.$serializationContext$.$markSsrNodeForSerialization$(
@@ -28114,12 +28340,13 @@ var Serializer = class {
28114
28340
  const shouldNeverSerialize = value.$flags$ & 8 /* SERIALIZATION_STRATEGY_NEVER */;
28115
28341
  const isInvalid = value.$flags$ & 1 /* INVALID */;
28116
28342
  const isSkippable = fastSkipSerialize(value.$untrackedValue$);
28117
- const isAsync = value instanceof AsyncSignalImpl;
28343
+ const isAsync = !!(value.$flags$ & 512 /* ASYNC_MODE */);
28344
+ const isErrored = isAsync && !!value.$untrackedError$;
28118
28345
  const expires = isAsync && value.$expires$ !== 0 ? value.$expires$ : void 0;
28119
28346
  const concurrency = isAsync && value.$concurrency$ !== 1 ? value.$concurrency$ : void 0;
28120
28347
  const timeout = isAsync && value.$timeoutMs$ !== 0 ? value.$timeoutMs$ : void 0;
28121
28348
  const asyncFlags = isAsync && value.$flags$ & ~24 /* SERIALIZATION_ALL_STRATEGIES */ || void 0;
28122
- if (isInvalid || isSkippable) {
28349
+ if (isInvalid || isSkippable || isErrored) {
28123
28350
  v = NEEDS_COMPUTATION;
28124
28351
  } else if (shouldAlwaysSerialize) {
28125
28352
  v = value.$untrackedValue$;
@@ -28152,28 +28379,12 @@ var Serializer = class {
28152
28379
  this.output(6 /* URL */, value.href);
28153
28380
  } else if (value instanceof Date) {
28154
28381
  this.output(7 /* Date */, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
28155
- } else if (this.$hasTemporal$ && value instanceof Temporal.Duration) {
28156
- this.output(15 /* TemporalDuration */, value.toJSON());
28157
- } else if (this.$hasTemporal$ && value instanceof Temporal.Instant) {
28158
- this.output(16 /* TemporalInstant */, value.toJSON());
28159
- } else if (this.$hasTemporal$ && value instanceof Temporal.PlainDate) {
28160
- this.output(17 /* TemporalPlainDate */, value.toJSON());
28161
- } else if (this.$hasTemporal$ && value instanceof Temporal.PlainDateTime) {
28162
- this.output(18 /* TemporalPlainDateTime */, value.toJSON());
28163
- } else if (this.$hasTemporal$ && value instanceof Temporal.PlainMonthDay) {
28164
- this.output(19 /* TemporalPlainMonthDay */, value.toJSON());
28165
- } else if (this.$hasTemporal$ && value instanceof Temporal.PlainTime) {
28166
- this.output(20 /* TemporalPlainTime */, value.toJSON());
28167
- } else if (this.$hasTemporal$ && value instanceof Temporal.PlainYearMonth) {
28168
- this.output(21 /* TemporalPlainYearMonth */, value.toJSON());
28169
- } else if (this.$hasTemporal$ && value instanceof Temporal.ZonedDateTime) {
28170
- this.output(22 /* TemporalZonedDateTime */, value.toJSON());
28171
28382
  } else if (value instanceof RegExp) {
28172
28383
  this.output(8 /* Regex */, value.toString());
28173
28384
  } else if (value instanceof Error) {
28174
28385
  const out = [value.message];
28175
28386
  out.push(...Object.entries(value).flat());
28176
- if (isDev20) {
28387
+ if (isDev19) {
28177
28388
  out.push("stack", value.stack);
28178
28389
  }
28179
28390
  this.output(23 /* Error */, out);
@@ -28227,7 +28438,7 @@ var Serializer = class {
28227
28438
  }
28228
28439
  this.output(37 /* JSXNode */, out);
28229
28440
  } else if (value instanceof Task) {
28230
- const out = [value.$qrl$, value.$flags$, value.$index$, value.$el$, value.$state$];
28441
+ const out = [value.$qrl$, value.$flags$, value.$index$, value.$el$];
28231
28442
  while (out[out.length - 1] === void 0) {
28232
28443
  out.pop();
28233
28444
  }
@@ -28271,6 +28482,22 @@ var Serializer = class {
28271
28482
  }
28272
28483
  this.output(2 /* ForwardRef */, this.getForwardRefId(forwardRefId));
28273
28484
  }
28485
+ } else if (this.$hasTemporal$ && value instanceof Temporal.Duration) {
28486
+ this.output(15 /* TemporalDuration */, value.toJSON());
28487
+ } else if (this.$hasTemporal$ && value instanceof Temporal.Instant) {
28488
+ this.output(16 /* TemporalInstant */, value.toJSON());
28489
+ } else if (this.$hasTemporal$ && value instanceof Temporal.PlainDate) {
28490
+ this.output(17 /* TemporalPlainDate */, value.toJSON());
28491
+ } else if (this.$hasTemporal$ && value instanceof Temporal.PlainDateTime) {
28492
+ this.output(18 /* TemporalPlainDateTime */, value.toJSON());
28493
+ } else if (this.$hasTemporal$ && value instanceof Temporal.PlainMonthDay) {
28494
+ this.output(19 /* TemporalPlainMonthDay */, value.toJSON());
28495
+ } else if (this.$hasTemporal$ && value instanceof Temporal.PlainTime) {
28496
+ this.output(20 /* TemporalPlainTime */, value.toJSON());
28497
+ } else if (this.$hasTemporal$ && value instanceof Temporal.PlainYearMonth) {
28498
+ this.output(21 /* TemporalPlainYearMonth */, value.toJSON());
28499
+ } else if (this.$hasTemporal$ && value instanceof Temporal.ZonedDateTime) {
28500
+ this.output(22 /* TemporalZonedDateTime */, value.toJSON());
28274
28501
  } else if (vnode_isVNode(value)) {
28275
28502
  this.output(3 /* Constant */, 0 /* Undefined */);
28276
28503
  } else {
@@ -28420,7 +28647,7 @@ var discoverValuesForVNodeData = (vnodeData, callback) => {
28420
28647
  if (isSsrAttrs(value)) {
28421
28648
  for (const key in value) {
28422
28649
  const attrValue = value[key];
28423
- if (attrValue == null || typeof attrValue === "string" || typeof attrValue === "number" && key === ELEMENT_ID || key === ELEMENT_PROPS && isObjectEmpty(attrValue)) {
28650
+ if (attrValue == null || typeof attrValue === "string" || typeof attrValue === "number" && key === ELEMENT_ID || key === ELEMENT_PROPS && (isObjectEmpty(attrValue) || shouldSkipComponentProps(value, attrValue))) {
28424
28651
  continue;
28425
28652
  }
28426
28653
  callback(attrValue);
@@ -28429,6 +28656,19 @@ var discoverValuesForVNodeData = (vnodeData, callback) => {
28429
28656
  }
28430
28657
  };
28431
28658
  var isSsrAttrs = (value) => typeof value === "object" && value !== null && !isObjectEmpty(value);
28659
+ var shouldSkipComponentProps = (attrs, value, isDevMode = isDev19) => {
28660
+ if (isDevMode || !Object.prototype.hasOwnProperty.call(attrs, OnRenderProp)) {
28661
+ return false;
28662
+ }
28663
+ const owner = value[_OWNER];
28664
+ return isObjectEmpty(owner.varProps) && !hasPropsEffects(value) && !hasComponentBackRef(attrs[QBackRefs]);
28665
+ };
28666
+ var hasPropsEffects = (propsProxy) => {
28667
+ return !!propsProxy[_PROPS_HANDLER].$effects$?.size;
28668
+ };
28669
+ var hasComponentBackRef = (backRefs) => {
28670
+ return backRefs instanceof Map && backRefs.has(":" /* COMPONENT */);
28671
+ };
28432
28672
  function isObjectLiteral(obj) {
28433
28673
  const prototype = Object.getPrototypeOf(obj);
28434
28674
  return prototype == null || prototype === Object.prototype || prototype === Array.prototype;
@@ -28686,7 +28926,7 @@ var _SharedContainer = class {
28686
28926
  };
28687
28927
 
28688
28928
  // packages/qwik/src/core/shared/serdes/preprocess-state.ts
28689
- function preprocessState(data, container, segmentId, startIndex = 0) {
28929
+ function* preprocessStateIterator(data, container, startIndex = 0) {
28690
28930
  const isRootDeepRef = (type, value) => {
28691
28931
  return type === 1 /* RootRef */ && typeof value === "string" && value.indexOf(" ") !== -1;
28692
28932
  };
@@ -28728,23 +28968,103 @@ function preprocessState(data, container, segmentId, startIndex = 0) {
28728
28968
  } else if (isForwardRefsMap(data[i2])) {
28729
28969
  container.$forwardRefs$ = data[i2 + 1];
28730
28970
  }
28971
+ yield;
28731
28972
  }
28732
28973
  }
28733
28974
 
28734
28975
  // packages/qwik/src/core/shared/serdes/serdes.public.ts
28735
- import { isDev as isDev21 } from "@qwik.dev/core/build";
28976
+ import { isDev as isDev20 } from "@qwik.dev/core/build";
28977
+
28978
+ // packages/qwik/src/core/client/yielding-iterator.ts
28979
+ var YIELD_INTERVAL = 10;
28980
+ var scheduleYieldingIterator = (state) => {
28981
+ if (!state.$scheduled$) {
28982
+ state.$scheduled$ = true;
28983
+ state.$schedule$();
28984
+ }
28985
+ };
28986
+ var runYieldingIterator = (state, onDone, onError) => {
28987
+ state.$scheduled$ = false;
28988
+ const deadline = performance.now() + YIELD_INTERVAL;
28989
+ let count = 0;
28990
+ try {
28991
+ while (true) {
28992
+ const result = state.$iterator$.next();
28993
+ if (result.done) {
28994
+ onDone(result.value);
28995
+ return;
28996
+ }
28997
+ if ((++count & 31) === 0 && performance.now() >= deadline) {
28998
+ scheduleYieldingIterator(state);
28999
+ return;
29000
+ }
29001
+ }
29002
+ } catch (error) {
29003
+ onError(error);
29004
+ }
29005
+ };
29006
+ var createYieldingIteratorState = (iterator, onDone, onError) => {
29007
+ const state = {
29008
+ $iterator$: iterator,
29009
+ $schedule$: void 0,
29010
+ $scheduled$: false
29011
+ };
29012
+ const schedule = createMacroTask(() => {
29013
+ runYieldingIterator(
29014
+ state,
29015
+ (value) => {
29016
+ schedule.$destroy$?.();
29017
+ onDone(value);
29018
+ },
29019
+ (error) => {
29020
+ schedule.$destroy$?.();
29021
+ onError(error);
29022
+ }
29023
+ );
29024
+ });
29025
+ state.$schedule$ = schedule;
29026
+ return state;
29027
+ };
29028
+
29029
+ // packages/qwik/src/core/shared/serdes/serdes.public.ts
28736
29030
  function getObjectById(id, stateData) {
28737
29031
  if (typeof id === "string") {
28738
29032
  id = parseInt(id, 10);
28739
29033
  return stateData[id];
28740
29034
  }
28741
- isDev21 && assertTrue(id < stateData.length, `Invalid reference ${id} >= ${stateData.length}`);
29035
+ isDev20 && assertTrue(id < stateData.length, `Invalid reference ${id} >= ${stateData.length}`);
28742
29036
  return stateData[id];
28743
29037
  }
28744
29038
 
28745
29039
  // packages/qwik/src/core/shared/serdes/allocate.ts
28746
29040
  var resolvers = /* @__PURE__ */ new WeakMap();
28747
- var pendingStoreTargets = /* @__PURE__ */ new Map();
29041
+ var BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
29042
+ var BASE64_REGEXP = /^[A-Za-z0-9+/]*$/;
29043
+ var isCanonicalBase64 = (value) => {
29044
+ if (typeof value !== "string" || !BASE64_REGEXP.test(value)) {
29045
+ return false;
29046
+ }
29047
+ const rest = value.length % 4;
29048
+ if (rest === 0) {
29049
+ return true;
29050
+ }
29051
+ if (rest === 1) {
29052
+ return false;
29053
+ }
29054
+ const lastValue = BASE64_ALPHABET.indexOf(value[value.length - 1]);
29055
+ return (lastValue & (rest === 2 ? 15 : 3)) === 0;
29056
+ };
29057
+ var beginDeserialization = (container) => {
29058
+ const ownsPendingStoreTargets = container.$pendingStoreTargets$ === void 0;
29059
+ container.$pendingStoreTargets$ ?? (container.$pendingStoreTargets$ = /* @__PURE__ */ new Map());
29060
+ return ownsPendingStoreTargets;
29061
+ };
29062
+ var endDeserialization = (container, ownsPendingStoreTargets) => {
29063
+ if (ownsPendingStoreTargets) {
29064
+ container.$pendingStoreTargets$.clear();
29065
+ container.$pendingStoreTargets$ = void 0;
29066
+ }
29067
+ };
28748
29068
  var allocate = (container, typeId, value) => {
28749
29069
  switch (typeId) {
28750
29070
  case 0 /* Plain */:
@@ -28769,13 +29089,18 @@ var allocate = (container, typeId, value) => {
28769
29089
  case 9 /* QRL */: {
28770
29090
  let qrl;
28771
29091
  if (typeof value === "string") {
28772
- const [chunkId, symbolId, captureIds] = value.split("#");
28773
- const chunk = container.$getObjectById$(chunkId);
28774
- const symbol = container.$getObjectById$(symbolId);
29092
+ const serializedQrl = value;
29093
+ const firstHash = serializedQrl.indexOf("#");
29094
+ const secondHash = serializedQrl.indexOf("#", firstHash + 1);
29095
+ const chunkRootId = Number(serializedQrl.slice(0, firstHash));
29096
+ const symbolDelta = secondHash === -1 ? Number(serializedQrl.slice(firstHash + 1)) : Number(serializedQrl.slice(firstHash + 1, secondHash));
29097
+ const symbolRootId = chunkRootId + symbolDelta;
29098
+ const chunk = container.$getObjectById$(chunkRootId);
29099
+ const symbol = container.$getObjectById$(symbolRootId);
28775
29100
  qrl = createQRLWithBackChannel(
28776
29101
  chunk,
28777
29102
  symbol,
28778
- captureIds || null,
29103
+ secondHash !== -1 ? serializedQrl : null,
28779
29104
  container
28780
29105
  );
28781
29106
  } else {
@@ -28784,7 +29109,7 @@ var allocate = (container, typeId, value) => {
28784
29109
  return qrl;
28785
29110
  }
28786
29111
  case 28 /* Task */:
28787
- return new Task(-1, -1, null, null, null, null);
29112
+ return new Task(-1, -1, null, null, null);
28788
29113
  case 6 /* URL */:
28789
29114
  return new URL(value);
28790
29115
  case 7 /* Date */:
@@ -28829,7 +29154,7 @@ var allocate = (container, typeId, value) => {
28829
29154
  const storeValue = allocate(container, t, v);
28830
29155
  const store = getOrCreateStore(storeValue, 0 /* NONE */, container);
28831
29156
  if (needsInflation(t)) {
28832
- pendingStoreTargets.set(storeValue, { t, v });
29157
+ container.$pendingStoreTargets$.set(storeValue, { t, v });
28833
29158
  }
28834
29159
  data[0] = 0 /* Plain */;
28835
29160
  data[1] = storeValue;
@@ -28858,12 +29183,16 @@ var allocate = (container, typeId, value) => {
28858
29183
  promise.catch(() => {
28859
29184
  });
28860
29185
  return promise;
28861
- case 27 /* Uint8Array */:
29186
+ case 27 /* Uint8Array */: {
29187
+ if (!isCanonicalBase64(value)) {
29188
+ throw qError(38 /* invalidUint8ArrayPayload */);
29189
+ }
28862
29190
  const encodedLength = value.length;
28863
- const blocks = encodedLength >>> 2;
28864
- const rest = encodedLength & 3;
29191
+ const blocks = Math.floor(encodedLength / 4);
29192
+ const rest = encodedLength % 4;
28865
29193
  const decodedLength = blocks * 3 + (rest ? rest - 1 : 0);
28866
29194
  return new Uint8Array(decodedLength);
29195
+ }
28867
29196
  case 38 /* PropsProxy */:
28868
29197
  return createPropsProxy(null);
28869
29198
  case 10 /* VNode */:
@@ -28878,7 +29207,12 @@ var allocate = (container, typeId, value) => {
28878
29207
  }
28879
29208
  case 39 /* SubscriptionData */:
28880
29209
  return new SubscriptionData({});
29210
+ case 42 /* SubscriptionDataConstTrue */:
29211
+ return new SubscriptionData({ $scopedStyleIdPrefix$: null, $isConst$: true });
29212
+ case 43 /* SubscriptionDataConstFalse */:
29213
+ return new SubscriptionData({ $scopedStyleIdPrefix$: null, $isConst$: false });
28881
29214
  case 40 /* EffectSubscription */:
29215
+ case 44 /* EffectSubscriptionNoData */:
28882
29216
  return new EffectSubscription(null, null, null, null);
28883
29217
  case 41 /* SubscriptionPatch */:
28884
29218
  return new SubscriptionPatch();
@@ -28907,114 +29241,214 @@ var isSafeObjectKV = (key, value) => {
28907
29241
  return typeof key === "string" && key !== "__proto__" && (typeof value !== "function" || !dangerousObjectKeys.has(key));
28908
29242
  };
28909
29243
  var inflate = (container, target, typeId, data) => {
29244
+ const ownsPendingStoreTargets = beginDeserialization(container);
29245
+ try {
29246
+ const iterator = inflateIterator(container, target, typeId, data);
29247
+ while (!iterator.next().done) {
29248
+ }
29249
+ } finally {
29250
+ endDeserialization(container, ownsPendingStoreTargets);
29251
+ }
29252
+ };
29253
+ function* eagerDeserializeArrayIterator(container, data, output = Array(data.length / 2)) {
29254
+ for (let i2 = 0; i2 < data.length; i2 += 2) {
29255
+ output[i2 / 2] = yield* deserializeDataIterator(container, data[i2], data[i2 + 1]);
29256
+ yield;
29257
+ }
29258
+ return output;
29259
+ }
29260
+ function* eagerDeserializeStateIterator(container, data, output = Array(data.length / 2)) {
29261
+ const ownsPendingStoreTargets = beginDeserialization(container);
29262
+ const length = data.length / 2;
29263
+ const allocated = new Uint8Array(length);
29264
+ const previousGetObjectById = container.$getObjectById$;
29265
+ const allocateRoot = (index) => {
29266
+ if (!allocated[index]) {
29267
+ allocated[index] = 1;
29268
+ const typeIndex = index * 2;
29269
+ const typeId = data[typeIndex];
29270
+ const value = data[typeIndex + 1];
29271
+ output[index] = typeId === 0 /* Plain */ ? value : allocate(container, typeId, value);
29272
+ }
29273
+ return output[index];
29274
+ };
29275
+ container.$getObjectById$ = (id) => allocateRoot(typeof id === "string" ? parseInt(id, 10) : id);
29276
+ try {
29277
+ for (let i2 = 0; i2 < length; i2++) {
29278
+ allocateRoot(i2);
29279
+ yield;
29280
+ }
29281
+ for (let i2 = 0; i2 < length; i2++) {
29282
+ const typeIndex = i2 * 2;
29283
+ const typeId = data[typeIndex];
29284
+ const value = data[typeIndex + 1];
29285
+ const propValue = output[i2];
29286
+ data[typeIndex] = 0 /* Plain */;
29287
+ data[typeIndex + 1] = propValue;
29288
+ if (needsInflation(typeId)) {
29289
+ yield* inflateIterator(container, propValue, typeId, value);
29290
+ }
29291
+ yield;
29292
+ }
29293
+ } finally {
29294
+ container.$getObjectById$ = previousGetObjectById;
29295
+ endDeserialization(container, ownsPendingStoreTargets);
29296
+ }
29297
+ return output;
29298
+ }
29299
+ function* deserializeDataIterator(container, typeId, value) {
29300
+ if (typeId === 0 /* Plain */) {
29301
+ return value;
29302
+ }
29303
+ const propValue = allocate(container, typeId, value);
29304
+ if (needsInflation(typeId)) {
29305
+ yield* inflateIterator(container, propValue, typeId, value);
29306
+ }
29307
+ return propValue;
29308
+ }
29309
+ function* inflateIterator(container, target, typeId, data) {
28910
29310
  if (typeId === 0 /* Plain */) {
28911
29311
  return;
28912
29312
  }
29313
+ if (typeId === 5 /* Object */ && data !== EMPTY_OBJECT_PAYLOAD && !Array.isArray(data)) {
29314
+ throw new Error("Invalid Object payload");
29315
+ }
28913
29316
  if (typeId !== 4 /* Array */ && Array.isArray(data)) {
28914
- data = _eagerDeserializeArray(container, data);
29317
+ data = yield* eagerDeserializeArrayIterator(container, data);
28915
29318
  }
28916
29319
  switch (typeId) {
28917
29320
  case 4 /* Array */:
28918
- _eagerDeserializeArray(container, data, target);
29321
+ yield* eagerDeserializeArrayIterator(container, data, target);
28919
29322
  break;
28920
29323
  case 5 /* Object */:
28921
- if (data === 0) {
29324
+ if (data === EMPTY_OBJECT_PAYLOAD) {
28922
29325
  break;
28923
29326
  }
28924
- for (let i3 = 0; i3 < data.length; i3 += 2) {
28925
- const key = data[i3];
28926
- const value = data[i3 + 1];
29327
+ for (let i2 = 0; i2 < data.length; i2 += 2) {
29328
+ const key = data[i2];
29329
+ const value = data[i2 + 1];
28927
29330
  if (!isSafeObjectKV(key, value)) {
28928
29331
  continue;
28929
29332
  }
28930
29333
  target[key] = value;
28931
29334
  }
28932
29335
  break;
28933
- case 28 /* Task */:
29336
+ case 25 /* Set */: {
29337
+ const set = target;
29338
+ const d = data;
29339
+ for (let i2 = 0; i2 < d.length; i2++) {
29340
+ set.add(d[i2]);
29341
+ yield;
29342
+ }
29343
+ break;
29344
+ }
29345
+ case 26 /* Map */: {
29346
+ const map = target;
29347
+ const d = data;
29348
+ for (let i2 = 0; i2 < d.length; i2++) {
29349
+ map.set(d[i2++], d[i2]);
29350
+ yield;
29351
+ }
29352
+ break;
29353
+ }
29354
+ case 24 /* Promise */: {
29355
+ const promise = target;
29356
+ const [resolved, result] = data;
29357
+ const [resolve, reject] = resolvers.get(promise);
29358
+ if (resolved) {
29359
+ if (resolvers.has(result)) {
29360
+ throw qError(37 /* invalidPromiseDependency */);
29361
+ }
29362
+ resolve(result);
29363
+ } else {
29364
+ reject(result);
29365
+ }
29366
+ break;
29367
+ }
29368
+ case 23 /* Error */: {
29369
+ const d = data;
29370
+ target.message = d[0];
29371
+ for (let i2 = 1; i2 < d.length; i2 += 2) {
29372
+ const key = d[i2];
29373
+ const value = d[i2 + 1];
29374
+ if (isSafeObjectKV(key, value)) {
29375
+ target[key] = value;
29376
+ }
29377
+ yield;
29378
+ }
29379
+ break;
29380
+ }
29381
+ case 28 /* Task */: {
28934
29382
  const task = target;
28935
29383
  const v = data;
28936
29384
  task.$qrl$ = v[0];
28937
29385
  task.$flags$ = v[1];
28938
29386
  task.$index$ = v[2];
28939
29387
  task.$el$ = v[3];
28940
- task.$state$ = v[4];
28941
29388
  break;
29389
+ }
28942
29390
  case 29 /* Component */:
28943
29391
  target[SERIALIZABLE_STATE][0] = data[0];
28944
29392
  break;
28945
- case 35 /* Store */: {
28946
- const store = unwrapStore(target);
28947
- const storeTarget = pendingStoreTargets.get(store);
28948
- if (storeTarget) {
28949
- pendingStoreTargets.delete(store);
28950
- inflate(container, store, storeTarget.t, storeTarget.v);
28951
- }
28952
- const [, flags, effects] = data;
28953
- const storeHandler = getStoreHandler(target);
28954
- storeHandler.$flags$ = flags;
28955
- storeHandler.$effects$ = effects;
28956
- restoreEffectBackRefForEffectsMap(storeHandler.$effects$, store);
28957
- break;
28958
- }
28959
29393
  case 30 /* Signal */: {
28960
29394
  const signal = target;
28961
- const d2 = data;
28962
- signal.$untrackedValue$ = d2[0];
28963
- signal.$effects$ = new Set(d2.slice(1));
29395
+ const d = data;
29396
+ signal.$untrackedValue$ = d[0];
29397
+ signal.$effects$ = new Set(d.slice(1));
28964
29398
  restoreEffectBackRefForEffects(signal.$effects$, signal);
28965
29399
  break;
28966
29400
  }
28967
29401
  case 31 /* WrappedSignal */: {
28968
29402
  const signal = target;
28969
- const d2 = data;
28970
- signal.$func$ = container.getSyncFn(d2[0]);
28971
- signal.$args$ = d2[1];
29403
+ const d = data;
29404
+ signal.$func$ = container.getSyncFn(d[0]);
29405
+ signal.$args$ = d[1];
28972
29406
  signal.$untrackedValue$ = NEEDS_COMPUTATION;
28973
- signal.$flags$ = d2[2];
29407
+ signal.$flags$ = d[2];
28974
29408
  signal.$flags$ |= 1 /* INVALID */;
28975
- signal.$hostElement$ = d2[3];
28976
- signal.$effects$ = new Set(d2.slice(4));
29409
+ signal.$hostElement$ = d[3];
29410
+ signal.$effects$ = new Set(d.slice(4));
28977
29411
  inflateWrappedSignalValue(signal);
28978
29412
  restoreEffectBackRefForEffects(signal.$effects$, signal);
28979
29413
  break;
28980
29414
  }
28981
29415
  case 33 /* AsyncSignal */: {
28982
29416
  const asyncSignal = target;
28983
- const d2 = data;
28984
- asyncSignal.$computeQrl$ = d2[0];
28985
- if (d2[1]) {
28986
- asyncSignal.$effects$ = new Set(d2[1]);
29417
+ const d = data;
29418
+ asyncSignal.$computeQrl$ = d[0];
29419
+ if (d[1]) {
29420
+ asyncSignal.$effects$ = new Set(d[1]);
28987
29421
  }
28988
- if (d2[2]) {
28989
- asyncSignal.$loadingEffects$ = new Set(d2[2]);
29422
+ if (d[2]) {
29423
+ asyncSignal.$loadingEffects$ = new Set(d[2]);
28990
29424
  }
28991
- if (d2[3]) {
28992
- asyncSignal.$errorEffects$ = new Set(d2[3]);
29425
+ if (d[3]) {
29426
+ asyncSignal.$errorEffects$ = new Set(d[3]);
28993
29427
  }
28994
- if (d2[4]) {
28995
- asyncSignal.$untrackedError$ = d2[4];
29428
+ if (d[4]) {
29429
+ asyncSignal.$untrackedError$ = d[4];
28996
29430
  }
28997
- asyncSignal.$flags$ = d2[5] ?? 0;
29431
+ asyncSignal.$flags$ = d[5] ?? 0;
28998
29432
  if (asyncSignal.$flags$ & 64 /* CLIENT_ONLY */) {
28999
- asyncSignal.$untrackedLoading$ = true;
29433
+ asyncSignal.$untrackedPending$ = true;
29000
29434
  }
29001
- const hasValue = d2.length > 6;
29435
+ const hasValue = d.length > 6;
29002
29436
  if (hasValue) {
29003
- asyncSignal.$untrackedValue$ = d2[6];
29437
+ asyncSignal.$untrackedValue$ = d[6];
29004
29438
  }
29005
29439
  if (asyncSignal.$untrackedValue$ === NEEDS_COMPUTATION) {
29006
29440
  asyncSignal.$flags$ |= 1 /* INVALID */;
29007
29441
  }
29008
- const rawExpires = d2[7] ?? 0;
29442
+ const rawExpires = d[7] ?? 0;
29009
29443
  asyncSignal.expires = Math.abs(rawExpires);
29010
29444
  if (rawExpires < 0) {
29011
29445
  asyncSignal.$flags$ |= 256 /* NO_POLL */;
29012
29446
  }
29013
- if (d2[8] !== void 0 && d2[8] !== 1) {
29014
- asyncSignal.$concurrency$ = d2[8] ?? 1;
29447
+ if (d[8] !== void 0 && d[8] !== 1) {
29448
+ asyncSignal.$concurrency$ = d[8] ?? 1;
29015
29449
  asyncSignal.$jobs$ = [];
29016
29450
  }
29017
- asyncSignal.$timeoutMs$ = d2[9] ?? 0;
29451
+ asyncSignal.$timeoutMs$ = d[9] ?? 0;
29018
29452
  restoreEffectBackRefForEffects(asyncSignal.$effects$, asyncSignal);
29019
29453
  restoreEffectBackRefForEffects(asyncSignal.$loadingEffects$, asyncSignal);
29020
29454
  restoreEffectBackRefForEffects(asyncSignal.$errorEffects$, asyncSignal);
@@ -29024,17 +29458,17 @@ var inflate = (container, target, typeId, data) => {
29024
29458
  case 34 /* SerializerSignal */:
29025
29459
  case 32 /* ComputedSignal */: {
29026
29460
  const computed = target;
29027
- const d2 = data;
29028
- computed.$computeQrl$ = d2[0];
29461
+ const d = data;
29462
+ computed.$computeQrl$ = d[0];
29029
29463
  const p = computed.$computeQrl$.resolve(container).catch(() => {
29030
29464
  });
29031
29465
  loading = loading.finally(() => p);
29032
- if (d2[1]) {
29033
- computed.$effects$ = new Set(d2[1]);
29466
+ if (d[1]) {
29467
+ computed.$effects$ = new Set(d[1]);
29034
29468
  }
29035
- const hasValue = d2.length > 2;
29469
+ const hasValue = d.length > 2;
29036
29470
  if (hasValue) {
29037
- computed.$untrackedValue$ = d2[2];
29471
+ computed.$untrackedValue$ = d[2];
29038
29472
  }
29039
29473
  if (typeId !== 34 /* SerializerSignal */ && computed.$untrackedValue$ !== NEEDS_COMPUTATION) {
29040
29474
  computed.$flags$ &= ~1 /* INVALID */;
@@ -29042,19 +29476,12 @@ var inflate = (container, target, typeId, data) => {
29042
29476
  restoreEffectBackRefForEffects(computed.$effects$, computed);
29043
29477
  break;
29044
29478
  }
29045
- case 23 /* Error */: {
29046
- const d2 = data;
29047
- target.message = d2[0];
29048
- for (let i3 = 1; i3 < d2.length; i3 += 2) {
29049
- target[d2[i3]] = d2[i3 + 1];
29050
- }
29051
- break;
29052
- }
29053
29479
  case 36 /* FormData */: {
29054
29480
  const formData = target;
29055
- const d2 = data;
29056
- for (let i3 = 0; i3 < d2.length; i3++) {
29057
- formData.append(d2[i3++], d2[i3]);
29481
+ const d = data;
29482
+ for (let i2 = 0; i2 < d.length; i2++) {
29483
+ formData.append(d[i2++], d[i2]);
29484
+ yield;
29058
29485
  }
29059
29486
  break;
29060
29487
  }
@@ -29069,48 +29496,14 @@ var inflate = (container, target, typeId, data) => {
29069
29496
  jsx2.toSort = !!toSort;
29070
29497
  break;
29071
29498
  }
29072
- case 25 /* Set */: {
29073
- const set = target;
29074
- const d2 = data;
29075
- for (let i3 = 0; i3 < d2.length; i3++) {
29076
- set.add(d2[i3]);
29077
- }
29078
- break;
29079
- }
29080
- case 26 /* Map */: {
29081
- const map = target;
29082
- const d2 = data;
29083
- for (let i3 = 0; i3 < d2.length; i3++) {
29084
- map.set(d2[i3++], d2[i3]);
29085
- }
29086
- break;
29087
- }
29088
- case 24 /* Promise */: {
29089
- const promise = target;
29090
- const [resolved, result] = data;
29091
- const [resolve, reject] = resolvers.get(promise);
29092
- if (resolved) {
29093
- resolve(result);
29094
- } else {
29095
- reject(result);
29096
- }
29097
- break;
29098
- }
29099
- case 27 /* Uint8Array */:
29100
- const bytes = target;
29101
- const buf = atob(data);
29102
- let i2 = 0;
29103
- for (let j = 0; j < buf.length; j++) {
29104
- const s = buf[j];
29105
- bytes[i2++] = s.charCodeAt(0);
29106
- }
29107
- break;
29108
- case 38 /* PropsProxy */:
29499
+ case 38 /* PropsProxy */: {
29109
29500
  const propsProxy = target;
29110
29501
  const d = data;
29111
29502
  let owner = d[0];
29112
29503
  if (owner === _UNINITIALIZED) {
29113
- owner = new JSXNodeImpl(Fragment, d[1], d[2], null, 0, null);
29504
+ owner = new JSXNodeImpl(Fragment, null, null, null, 0, null);
29505
+ owner.varProps = d[1];
29506
+ owner.constProps = d[2];
29114
29507
  owner._proxy = propsProxy;
29115
29508
  }
29116
29509
  propsProxy[_OWNER] = owner;
@@ -29118,47 +29511,69 @@ var inflate = (container, target, typeId, data) => {
29118
29511
  propsHandler.$effects$ = d[3];
29119
29512
  restoreEffectBackRefForEffectsMap(propsHandler.$effects$, propsProxy);
29120
29513
  break;
29514
+ }
29121
29515
  case 39 /* SubscriptionData */: {
29122
29516
  const effectData = target;
29123
29517
  effectData.data.$scopedStyleIdPrefix$ = data[0];
29124
29518
  effectData.data.$isConst$ = data[1];
29125
29519
  break;
29126
29520
  }
29521
+ case 42 /* SubscriptionDataConstTrue */:
29522
+ case 43 /* SubscriptionDataConstFalse */:
29523
+ break;
29127
29524
  case 40 /* EffectSubscription */: {
29128
29525
  const effectSub = target;
29129
- const d2 = data;
29130
- effectSub.consumer = d2[0];
29131
- effectSub.property = d2[1];
29132
- effectSub.data = d2[2];
29526
+ const d = data;
29527
+ effectSub.consumer = d[0];
29528
+ effectSub.property = d[1];
29529
+ effectSub.data = d[2];
29133
29530
  restoreEffectBackRefForConsumer(effectSub);
29134
29531
  break;
29135
29532
  }
29136
29533
  case 41 /* SubscriptionPatch */: {
29137
29534
  const patch = target;
29138
- const d2 = data;
29139
- patch.rootId = d2[0];
29140
- patch.subscriptions = d2[1];
29535
+ const d = data;
29536
+ patch.rootId = d[0];
29537
+ patch.subscriptions = d[1];
29538
+ break;
29539
+ }
29540
+ case 44 /* EffectSubscriptionNoData */: {
29541
+ const effectSub = target;
29542
+ const d = data;
29543
+ effectSub.consumer = d[0];
29544
+ effectSub.property = d[1];
29545
+ effectSub.data = null;
29546
+ restoreEffectBackRefForConsumer(effectSub);
29547
+ break;
29548
+ }
29549
+ case 27 /* Uint8Array */: {
29550
+ const bytes = target;
29551
+ const buf = atob(data);
29552
+ for (let j = 0; j < buf.length; j++) {
29553
+ bytes[j] = buf.charCodeAt(j);
29554
+ if ((j & 31) === 31) {
29555
+ yield;
29556
+ }
29557
+ }
29558
+ break;
29559
+ }
29560
+ case 35 /* Store */: {
29561
+ const store = unwrapStore(target);
29562
+ const storeTarget = container.$pendingStoreTargets$.get(store);
29563
+ if (storeTarget) {
29564
+ container.$pendingStoreTargets$.delete(store);
29565
+ yield* inflateIterator(container, store, storeTarget.t, storeTarget.v);
29566
+ }
29567
+ const [, flags, effects] = data;
29568
+ const storeHandler = getStoreHandler(target);
29569
+ storeHandler.$flags$ = flags;
29570
+ storeHandler.$effects$ = effects;
29571
+ restoreEffectBackRefForEffectsMap(storeHandler.$effects$, store);
29141
29572
  break;
29142
29573
  }
29143
29574
  default:
29144
29575
  throw qError(16 /* serializeErrorNotImplemented */, [typeId]);
29145
29576
  }
29146
- };
29147
- var _eagerDeserializeArray = (container, data, output = Array(data.length / 2)) => {
29148
- for (let i2 = 0; i2 < data.length; i2 += 2) {
29149
- output[i2 / 2] = deserializeData(container, data[i2], data[i2 + 1]);
29150
- }
29151
- return output;
29152
- };
29153
- function deserializeData(container, typeId, value) {
29154
- if (typeId === 0 /* Plain */) {
29155
- return value;
29156
- }
29157
- const propValue = allocate(container, typeId, value);
29158
- if (needsInflation(typeId)) {
29159
- inflate(container, propValue, typeId, value);
29160
- }
29161
- return propValue;
29162
29577
  }
29163
29578
  function inflateWrappedSignalValue(signal) {
29164
29579
  if (signal.$hostElement$ !== null && vnode_isVNode(signal.$hostElement$)) {
@@ -29187,13 +29602,13 @@ function inflateWrappedSignalValue(signal) {
29187
29602
  }
29188
29603
  }
29189
29604
  function restoreEffectBackRefForConsumer(effect) {
29190
- var _a6;
29605
+ var _a5;
29191
29606
  const isServerSide = qTest ? isServerPlatform() : isServer9;
29192
29607
  const consumerBackRef = effect.consumer;
29193
29608
  if (isServerSide && !consumerBackRef) {
29194
29609
  return;
29195
29610
  }
29196
- consumerBackRef[_a6 = _EFFECT_BACK_REF] || (consumerBackRef[_a6] = /* @__PURE__ */ new Map());
29611
+ consumerBackRef[_a5 = _EFFECT_BACK_REF] || (consumerBackRef[_a5] = /* @__PURE__ */ new Map());
29197
29612
  consumerBackRef[_EFFECT_BACK_REF].set(effect.property, effect);
29198
29613
  }
29199
29614
  function restoreEffectBackRefForEffects(effects, consumer) {
@@ -29213,9 +29628,9 @@ function restoreEffectBackRefForEffectsMap(effectsMap, consumer) {
29213
29628
  }
29214
29629
 
29215
29630
  // packages/qwik/src/core/shared/vnode/vnode.ts
29216
- import { isDev as isDev22 } from "@qwik.dev/core/build";
29217
- var _a5;
29218
- _a5 = _EFFECT_BACK_REF;
29631
+ import { isDev as isDev21 } from "@qwik.dev/core/build";
29632
+ var _a4;
29633
+ _a4 = _EFFECT_BACK_REF;
29219
29634
  var VNode = class {
29220
29635
  constructor(flags, parent, previousSibling, nextSibling, props) {
29221
29636
  this.flags = flags;
@@ -29223,7 +29638,7 @@ var VNode = class {
29223
29638
  this.previousSibling = previousSibling;
29224
29639
  this.nextSibling = nextSibling;
29225
29640
  this.props = props;
29226
- __publicField(this, _a5);
29641
+ __publicField(this, _a4);
29227
29642
  __publicField(this, "slotParent", null);
29228
29643
  __publicField(this, "dirty", 0 /* NONE */);
29229
29644
  __publicField(this, "dirtyChildren", null);
@@ -29231,7 +29646,7 @@ var VNode = class {
29231
29646
  }
29232
29647
  // TODO: this creates debug issues
29233
29648
  toString() {
29234
- if (isDev22) {
29649
+ if (isDev21) {
29235
29650
  return vnode_toString.call(this);
29236
29651
  }
29237
29652
  return Object.prototype.toString.call(this);
@@ -29301,7 +29716,7 @@ var LazyRef = class {
29301
29716
  return this.$ref$;
29302
29717
  }
29303
29718
  if (this.$chunk$ === "") {
29304
- isDev23 && assertDefined(this.$container$, "Sync QRL must have container element");
29719
+ isDev22 && assertDefined(this.$container$, "Sync QRL must have container element");
29305
29720
  const hash = this.$container$.$instanceHash$;
29306
29721
  const doc = this.$container$.element?.ownerDocument || document;
29307
29722
  const qFuncs2 = getQFuncs(doc, hash);
@@ -29343,7 +29758,7 @@ var QRLClass = class {
29343
29758
  this.$container$ = container;
29344
29759
  }
29345
29760
  }
29346
- if ($lazy$.$ref$ != null && typeof this.$captures$ !== "string" && !isPromise($lazy$.$ref$)) {
29761
+ if ($lazy$.$ref$ != null && (!this.$captures$ || typeof this.$captures$ !== "string") && !isPromise($lazy$.$ref$)) {
29347
29762
  this.resolved = bindCaptures(this, $lazy$.$ref$);
29348
29763
  }
29349
29764
  }
@@ -29489,27 +29904,45 @@ var _captures = null;
29489
29904
  var setCaptures = (captures) => {
29490
29905
  _captures = captures;
29491
29906
  };
29492
- var deserializeCaptures = (container, captures) => {
29907
+ var deserializeCaptureDeltas = (container, deltaString, startIndex = 0, previousRootId) => {
29493
29908
  const refs = [];
29494
- const captureIds = captures.split(" ");
29495
- for (let i2 = 0; i2 < captureIds.length; i2++) {
29496
- const id = captureIds[i2];
29497
- refs.push(container.$getObjectById$(id));
29909
+ let previous = previousRootId;
29910
+ let start = startIndex;
29911
+ for (let i2 = startIndex; i2 <= deltaString.length; i2++) {
29912
+ if (i2 === deltaString.length || deltaString.charCodeAt(i2) === 32) {
29913
+ if (i2 > start) {
29914
+ const delta = Number(deltaString.slice(start, i2));
29915
+ previous = previous === void 0 ? delta : previous + delta;
29916
+ refs.push(container.$getObjectById$(previous));
29917
+ }
29918
+ start = i2 + 1;
29919
+ }
29498
29920
  }
29499
29921
  return refs;
29500
29922
  };
29923
+ var deserializeQrlCaptureDeltas = (container, qrlString) => {
29924
+ const firstHash = qrlString.indexOf("#");
29925
+ if (firstHash === -1) {
29926
+ return deserializeCaptureDeltas(container, qrlString);
29927
+ }
29928
+ const secondHash = qrlString.indexOf("#", firstHash + 1);
29929
+ const previousRootId = Number(qrlString.slice(0, firstHash)) + Number(qrlString.slice(firstHash + 1, secondHash));
29930
+ return deserializeCaptureDeltas(container, qrlString, secondHash + 1, previousRootId);
29931
+ };
29501
29932
  var ensureQrlCaptures = (qrl) => {
29502
- _captures = qrl.$captures$;
29933
+ const serializedCaptures = qrl.$captures$;
29503
29934
  const container = qrl.$container$;
29504
- if (typeof _captures === "string") {
29935
+ if (typeof serializedCaptures === "string") {
29505
29936
  if (!container) {
29506
29937
  throw qError(13 /* qrlMissingContainer */);
29507
29938
  }
29508
29939
  const prevLoading = loading;
29509
- _captures = qrl.$captures$ = deserializeCaptures(container, _captures);
29940
+ _captures = qrl.$captures$ = deserializeQrlCaptureDeltas(container, serializedCaptures);
29510
29941
  if (loading !== prevLoading) {
29511
29942
  return loading;
29512
29943
  }
29944
+ } else {
29945
+ _captures = serializedCaptures || null;
29513
29946
  }
29514
29947
  };
29515
29948
  var bindCaptures = (qrl, ref) => {
@@ -29882,6 +30315,7 @@ var Slot = (props) => {
29882
30315
 
29883
30316
  // packages/qwik/src/core/shared/serdes/constants.ts
29884
30317
  var explicitUndefined = /* @__PURE__ */ Symbol("undefined");
30318
+ var EMPTY_OBJECT_PAYLOAD = 0;
29885
30319
  var _constants = [
29886
30320
  void 0,
29887
30321
  null,
@@ -29900,7 +30334,11 @@ var _constants = [
29900
30334
  -Infinity,
29901
30335
  Number.MAX_SAFE_INTEGER,
29902
30336
  Number.MAX_SAFE_INTEGER - 1,
29903
- Number.MIN_SAFE_INTEGER
30337
+ Number.MIN_SAFE_INTEGER,
30338
+ ":",
30339
+ ".",
30340
+ "id",
30341
+ "ref"
29904
30342
  ];
29905
30343
 
29906
30344
  // packages/qwik/src/core/shared/serdes/deser-proxy.ts
@@ -29944,14 +30382,19 @@ var DeserializationHandler = class {
29944
30382
  return value;
29945
30383
  }
29946
30384
  const container = this.$container$;
29947
- const propValue = allocate(container, typeId, value);
29948
- Reflect.set(target, property, propValue);
29949
- this.$data$[idx] = 0 /* Plain */;
29950
- this.$data$[idx + 1] = propValue;
29951
- if (needsInflation(typeId)) {
29952
- inflate(container, propValue, typeId, value);
30385
+ const ownsPendingStoreTargets = beginDeserialization(container);
30386
+ try {
30387
+ const propValue = allocate(container, typeId, value);
30388
+ Reflect.set(target, property, propValue);
30389
+ this.$data$[idx] = 0 /* Plain */;
30390
+ this.$data$[idx + 1] = propValue;
30391
+ if (needsInflation(typeId)) {
30392
+ inflate(container, propValue, typeId, value);
30393
+ }
30394
+ return propValue;
30395
+ } finally {
30396
+ endDeserialization(container, ownsPendingStoreTargets);
29953
30397
  }
29954
- return propValue;
29955
30398
  }
29956
30399
  has(target, property) {
29957
30400
  if (property === SERIALIZER_PROXY_UNWRAP) {
@@ -30025,13 +30468,13 @@ var mergeSubscriptionSet = (container, producer, backRef, rootEffects, patchEffe
30025
30468
 
30026
30469
  // packages/qwik/src/core/client/process-segment-state.ts
30027
30470
  var processedStatePatchScripts = /* @__PURE__ */ new WeakMap();
30028
- var processSegmentStateScripts = (container, segmentId) => {
30471
+ function* processSegmentStateScriptsIterator(container, segmentId) {
30029
30472
  if (!__EXPERIMENTAL__.suspense) {
30030
30473
  return;
30031
30474
  }
30032
30475
  const stateContainer = container;
30033
30476
  const qwikStates = stateContainer.element.querySelectorAll(
30034
- `${stateScriptSelector(stateContainer.$instanceHash$)}${QStatePatchAttrSelector}`
30477
+ `script[type="qwik/state"][q\\:instance="${stateContainer.$instanceHash$}"]${QStatePatchAttrSelector}`
30035
30478
  );
30036
30479
  const processedScripts = getProcessedStatePatchScripts(container);
30037
30480
  for (let i2 = 0; i2 < qwikStates.length; i2++) {
@@ -30043,9 +30486,10 @@ var processSegmentStateScripts = (container, segmentId) => {
30043
30486
  continue;
30044
30487
  }
30045
30488
  processedScripts.add(stateScript);
30046
- processStatePatch(container, stateContainer, stateScript.textContent);
30489
+ yield* processStatePatch(container, stateContainer, stateScript.textContent);
30490
+ yield;
30047
30491
  }
30048
- };
30492
+ }
30049
30493
  var getProcessedStatePatchScripts = (container) => {
30050
30494
  let processedScripts = processedStatePatchScripts.get(container);
30051
30495
  if (!processedScripts) {
@@ -30054,23 +30498,21 @@ var getProcessedStatePatchScripts = (container) => {
30054
30498
  }
30055
30499
  return processedScripts;
30056
30500
  };
30057
- var stateScriptSelector = (instanceHash) => {
30058
- return `script[type="qwik/state"][q\\:instance="${instanceHash}"]`;
30059
- };
30060
- var processStatePatch = (container, stateContainer, textContent) => {
30061
- if (textContent) {
30062
- const [rootStart, rawStateData, forwardRefs, subscriptionPatchRootId] = JSON.parse(
30063
- textContent
30064
- );
30065
- appendStatePatchRoots(container, stateContainer, rootStart, rawStateData);
30066
- mergeForwardRefs(stateContainer, forwardRefs || void 0);
30067
- applySubscriptionPatches(
30068
- container,
30069
- subscriptionPatchRootId === void 0 ? void 0 : stateContainer.$getObjectById$(subscriptionPatchRootId)
30070
- );
30501
+ function* processStatePatch(container, stateContainer, textContent) {
30502
+ if (!textContent) {
30503
+ return;
30071
30504
  }
30072
- };
30073
- var appendStatePatchRoots = (container, stateContainer, rootStart, rawStateData) => {
30505
+ const [rootStart, rawStateData, forwardRefs, subscriptionPatchRootId] = JSON.parse(
30506
+ textContent
30507
+ );
30508
+ yield* appendStatePatchRoots(container, stateContainer, rootStart, rawStateData);
30509
+ mergeForwardRefs(stateContainer, forwardRefs || void 0);
30510
+ applySubscriptionPatches(
30511
+ container,
30512
+ subscriptionPatchRootId === void 0 ? void 0 : stateContainer.$getObjectById$(subscriptionPatchRootId)
30513
+ );
30514
+ }
30515
+ function* appendStatePatchRoots(container, stateContainer, rootStart, rawStateData) {
30074
30516
  const currentRootCount = stateContainer.$rawStateData$.length / 2;
30075
30517
  if (rootStart !== currentRootCount) {
30076
30518
  if (qDev) {
@@ -30082,15 +30524,16 @@ var appendStatePatchRoots = (container, stateContainer, rootStart, rawStateData)
30082
30524
  }
30083
30525
  for (let i2 = 0; i2 < rawStateData.length; i2++) {
30084
30526
  stateContainer.$rawStateData$[rootStart * 2 + i2] = rawStateData[i2];
30527
+ yield;
30085
30528
  }
30086
- preprocessState(stateContainer.$rawStateData$, container, void 0, rootStart * 2);
30529
+ yield* preprocessStateIterator(stateContainer.$rawStateData$, container, rootStart * 2);
30087
30530
  stateContainer.$stateData$ = wrapDeserializerProxy(
30088
30531
  container,
30089
30532
  stateContainer.$rawStateData$
30090
30533
  );
30091
30534
  stateContainer.$stateData$.length = stateContainer.$rawStateData$.length / 2;
30092
30535
  stateContainer.$rootForwardRefs$ = stateContainer.$forwardRefs$;
30093
- };
30536
+ }
30094
30537
  var mergeForwardRefs = (stateContainer, forwardRefs) => {
30095
30538
  if (!forwardRefs) {
30096
30539
  return;
@@ -30106,33 +30549,144 @@ var mergeForwardRefs = (stateContainer, forwardRefs) => {
30106
30549
  };
30107
30550
 
30108
30551
  // packages/qwik/src/core/client/process-vnode-data.ts
30552
+ var Q_SUSPENSE_RESOLVED = "q:r";
30553
+ var Q_PATCH = "q:patch";
30554
+ function processVNodeData(document2, containerElement) {
30555
+ const qDocument = document2;
30556
+ if (containerElement?.qVNodeRefs) {
30557
+ return;
30558
+ }
30559
+ if (qDocument.qVNodeDataStarted && !qDocument.qVNodeDataProcessed) {
30560
+ return;
30561
+ }
30562
+ qDocument.qVNodeDataStarted = true;
30563
+ qDocument.qVNodeData || (qDocument.qVNodeData = /* @__PURE__ */ new WeakMap());
30564
+ enqueueProcessVNodeDataJob(qDocument, processRootVNodeData(document2));
30565
+ }
30109
30566
  function processOutOfOrderSegmentVNodeData(document2, segmentId, contentNode) {
30110
30567
  if (!__EXPERIMENTAL__.suspense || !contentNode) {
30111
30568
  return;
30112
30569
  }
30113
30570
  const qContainerElement = contentNode.closest("[q\\:container]");
30114
- const script = qContainerElement?.querySelector(
30571
+ if (!qContainerElement) {
30572
+ return;
30573
+ }
30574
+ const script = qContainerElement.querySelector(
30115
30575
  `script[type="qwik/vnode"][q\\:r="${segmentId}"]:not([q\\:patch])`
30116
30576
  );
30117
- processVNodeDataImpl(
30577
+ const patches = qContainerElement.querySelectorAll(
30578
+ `script[type="qwik/vnode"][q\\:r="${segmentId}"][q\\:patch]`
30579
+ );
30580
+ enqueueProcessVNodeDataJob(
30118
30581
  document2,
30119
- segmentId,
30120
- qContainerElement,
30121
- contentNode,
30122
- script?.textContent || void 0
30582
+ processOutOfOrderSegmentVNodeDataIterator(
30583
+ document2,
30584
+ segmentId,
30585
+ qContainerElement,
30586
+ contentNode,
30587
+ script?.textContent || void 0,
30588
+ patches
30589
+ )
30123
30590
  );
30124
- const patches = qContainerElement?.querySelectorAll(
30125
- `script[type="qwik/vnode"][q\\:r="${segmentId}"][q\\:patch]`
30591
+ }
30592
+ var onVNodeDataReady = (document2, callback) => {
30593
+ const qDocument = document2;
30594
+ if (qDocument.qVNodeDataReady) {
30595
+ callback();
30596
+ } else {
30597
+ (qDocument.qVNodeDataCallbacks || (qDocument.qVNodeDataCallbacks = [])).push(callback);
30598
+ }
30599
+ };
30600
+ function enqueueProcessVNodeDataJob(qDocument, iterator) {
30601
+ const state = qDocument.qVNodeDataState || (qDocument.qVNodeDataState = {
30602
+ $queue$: [],
30603
+ $active$: null
30604
+ });
30605
+ qDocument.qProcessVNodeDataPatch || (qDocument.qProcessVNodeDataPatch = (script) => enqueueProcessVNodeDataJob(qDocument, processVNodeDataPatch(qDocument, script)));
30606
+ qDocument.qVNodeDataReady = false;
30607
+ state.$queue$.push(iterator);
30608
+ scheduleProcessVNodeData(qDocument, state);
30609
+ }
30610
+ function scheduleProcessVNodeData(qDocument, state) {
30611
+ if (state.$active$) {
30612
+ return;
30613
+ }
30614
+ const iterator = state.$queue$.shift();
30615
+ if (!iterator) {
30616
+ markVNodeDataReady(qDocument);
30617
+ return;
30618
+ }
30619
+ state.$active$ = createYieldingIteratorState(
30620
+ runProcessVNodeData(qDocument, state, iterator),
30621
+ () => {
30622
+ if (qDocument.qVNodeDataState === state) {
30623
+ state.$active$ = null;
30624
+ scheduleProcessVNodeData(qDocument, state);
30625
+ }
30626
+ },
30627
+ (error) => {
30628
+ state.$active$ = null;
30629
+ logError(error);
30630
+ markVNodeDataReady(qDocument);
30631
+ }
30126
30632
  );
30127
- for (let i2 = 0; patches && i2 < patches.length; i2++) {
30128
- document2.qProcessVNodeDataPatch?.(patches[i2]);
30633
+ scheduleYieldingIterator(state.$active$);
30634
+ }
30635
+ function* runProcessVNodeData(qDocument, state, iterator) {
30636
+ while (qDocument.qVNodeDataState === state) {
30637
+ if (iterator.next().done) {
30638
+ return;
30639
+ }
30640
+ yield;
30129
30641
  }
30130
30642
  }
30131
- function processVNodeData(document2) {
30132
- processVNodeDataImpl(document2);
30133
- document2.qVNodeDataProcessed = true;
30643
+ function markVNodeDataReady(document2) {
30644
+ if (document2.qVNodeDataReady) {
30645
+ return;
30646
+ }
30647
+ document2.qVNodeDataReady = true;
30648
+ document2.qVNodeDataState = void 0;
30649
+ const callbacks = document2.qVNodeDataCallbacks;
30650
+ document2.qVNodeDataCallbacks = void 0;
30651
+ if (callbacks) {
30652
+ for (let i2 = 0; i2 < callbacks.length; i2++) {
30653
+ callbacks[i2]();
30654
+ }
30655
+ }
30656
+ }
30657
+ function* processRootVNodeData(document2) {
30658
+ yield* processVNodeDataImpl(document2);
30659
+ const qDocument = document2;
30660
+ qDocument.qVNodeDataProcessed = true;
30661
+ qDocument.qVNodeDataStarted = false;
30134
30662
  }
30135
- function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentContent, segmentVNodeData) {
30663
+ function* processOutOfOrderSegmentVNodeDataIterator(document2, segmentId, segmentContainer, segmentContent, segmentVNodeData, patches) {
30664
+ yield* processVNodeDataImpl(
30665
+ document2,
30666
+ segmentId,
30667
+ segmentContainer,
30668
+ segmentContent,
30669
+ segmentVNodeData
30670
+ );
30671
+ for (let i2 = 0; i2 < patches.length; i2++) {
30672
+ yield* processVNodeDataPatch(document2, patches[i2]);
30673
+ }
30674
+ }
30675
+ function* processVNodeDataPatch(document2, script) {
30676
+ const qContainerElement = script?.closest("[q\\:container]");
30677
+ const patchSegment = script?.getAttribute(Q_SUSPENSE_RESOLVED);
30678
+ const contentNode = qContainerElement && (patchSegment ? qContainerElement.querySelector(`[q\\:rp="${patchSegment}"]`) : qContainerElement);
30679
+ if (qContainerElement && contentNode) {
30680
+ yield* processVNodeDataImpl(
30681
+ document2,
30682
+ patchSegment || void 0,
30683
+ qContainerElement,
30684
+ contentNode,
30685
+ script.textContent
30686
+ );
30687
+ }
30688
+ }
30689
+ function* processVNodeDataImpl(document2, segmentId, segmentContainer, segmentContent, segmentVNodeData) {
30136
30690
  const Q_CONTAINER = "q:container";
30137
30691
  const Q_CONTAINER_END = "/" + Q_CONTAINER;
30138
30692
  const Q_PROPS_SEPARATOR2 = ":";
@@ -30141,9 +30695,22 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30141
30695
  const Q_IGNORE_END = "/" + Q_IGNORE;
30142
30696
  const Q_CONTAINER_ISLAND = "q:container-island";
30143
30697
  const Q_CONTAINER_ISLAND_END = "/" + Q_CONTAINER_ISLAND;
30144
- const Q_SUSPENSE_RESOLVED = "q:r";
30145
30698
  const Q_SUSPENSE_RESULT_PARENT = "q:rp";
30146
- const Q_PATCH = "q:patch";
30699
+ let NodeType;
30700
+ ((NodeType2) => {
30701
+ NodeType2[NodeType2["CONTAINER_MASK"] = 1] = "CONTAINER_MASK";
30702
+ NodeType2[NodeType2["ELEMENT"] = 2] = "ELEMENT";
30703
+ NodeType2[NodeType2["ELEMENT_CONTAINER"] = 3] = "ELEMENT_CONTAINER";
30704
+ NodeType2[NodeType2["ELEMENT_SHADOW_ROOT_WRAPPER"] = 6] = "ELEMENT_SHADOW_ROOT_WRAPPER";
30705
+ NodeType2[NodeType2["ELEMENT_SUSPENSE_RESULT_PARENT"] = 130] = "ELEMENT_SUSPENSE_RESULT_PARENT";
30706
+ NodeType2[NodeType2["COMMENT_SKIP_START"] = 9] = "COMMENT_SKIP_START";
30707
+ NodeType2[NodeType2["COMMENT_SKIP_END"] = 8] = "COMMENT_SKIP_END";
30708
+ NodeType2[NodeType2["COMMENT_IGNORE_START"] = 16] = "COMMENT_IGNORE_START";
30709
+ NodeType2[NodeType2["COMMENT_IGNORE_END"] = 32] = "COMMENT_IGNORE_END";
30710
+ NodeType2[NodeType2["COMMENT_ISLAND_START"] = 65] = "COMMENT_ISLAND_START";
30711
+ NodeType2[NodeType2["COMMENT_ISLAND_END"] = 64] = "COMMENT_ISLAND_END";
30712
+ NodeType2[NodeType2["OTHER"] = 0] = "OTHER";
30713
+ })(NodeType || (NodeType = {}));
30147
30714
  const qDocument = document2;
30148
30715
  const vNodeDataMap = qDocument.qVNodeData || (qDocument.qVNodeData = /* @__PURE__ */ new WeakMap());
30149
30716
  const prototype = document2.body;
@@ -30159,7 +30726,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30159
30726
  const getAttribute = prototype.getAttribute;
30160
30727
  const hasAttribute = prototype.hasAttribute;
30161
30728
  const getNodeType = getter(prototype, "nodeType");
30162
- const attachVnodeDataAndRefs = (element) => {
30729
+ const attachVnodeDataAndRefs = function* (element) {
30163
30730
  const scripts = element.querySelectorAll('script[type="qwik/vnode"]');
30164
30731
  for (let i2 = 0; i2 < scripts.length; i2++) {
30165
30732
  const script = scripts[i2];
@@ -30167,6 +30734,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30167
30734
  qContainer.qVNodeRefs || (qContainer.qVNodeRefs = /* @__PURE__ */ new Map());
30168
30735
  if (script.hasAttribute(Q_PATCH)) {
30169
30736
  qDocument.qProcessVNodeDataPatch?.(script);
30737
+ yield;
30170
30738
  continue;
30171
30739
  }
30172
30740
  const scriptContent = script.textContent;
@@ -30176,29 +30744,18 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30176
30744
  } else {
30177
30745
  qContainer.qVnodeData = scriptContent;
30178
30746
  }
30747
+ yield;
30179
30748
  }
30180
30749
  const shadowRoots = element.querySelectorAll("[q\\:shadowroot]");
30181
30750
  for (let i2 = 0; i2 < shadowRoots.length; i2++) {
30182
30751
  const parent = shadowRoots[i2];
30183
30752
  const shadowRoot = parent.shadowRoot;
30184
- shadowRoot && attachVnodeDataAndRefs(shadowRoot);
30753
+ if (shadowRoot) {
30754
+ yield* attachVnodeDataAndRefs(shadowRoot);
30755
+ }
30756
+ yield;
30185
30757
  }
30186
30758
  };
30187
- let NodeType;
30188
- ((NodeType2) => {
30189
- NodeType2[NodeType2["CONTAINER_MASK"] = 1] = "CONTAINER_MASK";
30190
- NodeType2[NodeType2["ELEMENT"] = 2] = "ELEMENT";
30191
- NodeType2[NodeType2["ELEMENT_CONTAINER"] = 3] = "ELEMENT_CONTAINER";
30192
- NodeType2[NodeType2["ELEMENT_SHADOW_ROOT_WRAPPER"] = 6] = "ELEMENT_SHADOW_ROOT_WRAPPER";
30193
- NodeType2[NodeType2["ELEMENT_SUSPENSE_RESULT_PARENT"] = 130] = "ELEMENT_SUSPENSE_RESULT_PARENT";
30194
- NodeType2[NodeType2["COMMENT_SKIP_START"] = 9] = "COMMENT_SKIP_START";
30195
- NodeType2[NodeType2["COMMENT_SKIP_END"] = 8] = "COMMENT_SKIP_END";
30196
- NodeType2[NodeType2["COMMENT_IGNORE_START"] = 16] = "COMMENT_IGNORE_START";
30197
- NodeType2[NodeType2["COMMENT_IGNORE_END"] = 32] = "COMMENT_IGNORE_END";
30198
- NodeType2[NodeType2["COMMENT_ISLAND_START"] = 65] = "COMMENT_ISLAND_START";
30199
- NodeType2[NodeType2["COMMENT_ISLAND_END"] = 64] = "COMMENT_ISLAND_END";
30200
- NodeType2[NodeType2["OTHER"] = 0] = "OTHER";
30201
- })(NodeType || (NodeType = {}));
30202
30759
  const getFastNodeType = (node) => {
30203
30760
  const nodeType = getNodeType.call(node);
30204
30761
  if (nodeType === 1) {
@@ -30235,7 +30792,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30235
30792
  }
30236
30793
  return node;
30237
30794
  };
30238
- const walkContainer = (walker2, containerNode, node, exitNode, vData, qVNodeRefs, qContainerElement, segmentId2) => {
30795
+ const walkContainer = function* (walker2, containerNode, node, exitNode, vData, qVNodeRefs, qContainerElement, segmentId2) {
30239
30796
  const isSegment = __EXPERIMENTAL__.suspense && segmentId2 !== void 0;
30240
30797
  const vData_length = vData.length;
30241
30798
  let elementIdx = 0;
@@ -30256,6 +30813,9 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30256
30813
  }
30257
30814
  return elementsToSkip;
30258
30815
  };
30816
+ if (!node) {
30817
+ return;
30818
+ }
30259
30819
  do {
30260
30820
  if (node === exitNode) {
30261
30821
  return;
@@ -30268,7 +30828,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30268
30828
  while (cursor && !(nextNode = nextSibling(cursor))) {
30269
30829
  cursor = cursor.parentNode;
30270
30830
  }
30271
- walkContainer(
30831
+ yield* walkContainer(
30272
30832
  walker2,
30273
30833
  container,
30274
30834
  node,
@@ -30304,13 +30864,13 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30304
30864
  throw new Error(`<!--${node?.nodeValue}--> not closed!`);
30305
30865
  }
30306
30866
  } while (getFastNodeType(nextNode) !== 8 /* COMMENT_SKIP_END */);
30307
- walkContainer(walker2, node, node, nextNode, "", null, qContainerElement);
30867
+ yield* walkContainer(walker2, node, node, nextNode, "", null, qContainerElement);
30308
30868
  } else if (nodeType === 6 /* ELEMENT_SHADOW_ROOT_WRAPPER */) {
30309
30869
  nextNode = nextSibling(node);
30310
30870
  const shadowRootContainer = node;
30311
30871
  const shadowRoot = shadowRootContainer?.shadowRoot;
30312
30872
  if (shadowRoot) {
30313
- walkContainer(
30873
+ yield* walkContainer(
30314
30874
  // we need to create a new walker for the shadow root
30315
30875
  document2.createTreeWalker(
30316
30876
  shadowRoot,
@@ -30374,16 +30934,21 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30374
30934
  }
30375
30935
  elementIdx++;
30376
30936
  if (__EXPERIMENTAL__.suspense && contentBoundaryId !== null) {
30377
- processSuspenseContentSegment(qContainerElement, node, contentBoundaryId);
30937
+ yield* processSuspenseContentSegment(
30938
+ qContainerElement,
30939
+ node,
30940
+ contentBoundaryId
30941
+ );
30378
30942
  nextNode = nextSibling(node);
30379
30943
  if (nextNode) {
30380
30944
  walker2.currentNode = nextNode;
30381
30945
  }
30382
30946
  }
30383
30947
  }
30948
+ yield;
30384
30949
  } while (node = nextNode || walker2.nextNode());
30385
30950
  };
30386
- const processVNodeDataScope = (qContainerElement, contentNode, vData, scopeSegmentId) => {
30951
+ const processVNodeDataScope = function* (qContainerElement, contentNode, vData, scopeSegmentId) {
30387
30952
  qContainerElement.qVNodeRefs || (qContainerElement.qVNodeRefs = /* @__PURE__ */ new Map());
30388
30953
  const scopeWalker = document2.createTreeWalker(
30389
30954
  document2,
@@ -30391,7 +30956,7 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30391
30956
  /* NodeFilter.SHOW_COMMENT */
30392
30957
  );
30393
30958
  scopeWalker.currentNode = contentNode;
30394
- walkContainer(
30959
+ yield* walkContainer(
30395
30960
  scopeWalker,
30396
30961
  contentNode,
30397
30962
  contentNode,
@@ -30402,39 +30967,33 @@ function processVNodeDataImpl(document2, segmentId, segmentContainer, segmentCon
30402
30967
  scopeSegmentId
30403
30968
  );
30404
30969
  };
30405
- const processSuspenseContentSegment = __EXPERIMENTAL__.suspense ? (qContainerElement, contentNode, boundaryId, vData) => {
30970
+ const processSuspenseContentSegment = function* (qContainerElement, contentNode, boundaryId, vData) {
30406
30971
  vData || (vData = qContainerElement?.qSegmentVnodeData?.get(boundaryId));
30407
30972
  if (qContainerElement && vData) {
30408
- processVNodeDataScope(qContainerElement, contentNode, vData, boundaryId);
30409
- }
30410
- } : null;
30411
- qDocument.qProcessVNodeDataPatch = (script) => {
30412
- const qContainerElement = script?.closest("[q\\:container]");
30413
- const patchSegment = script?.getAttribute(Q_SUSPENSE_RESOLVED);
30414
- const contentNode = qContainerElement && (patchSegment ? qContainerElement.querySelector(`[q\\:rp="${patchSegment}"]`) : qContainerElement);
30415
- if (qContainerElement && contentNode) {
30416
- processVNodeDataScope(
30417
- qContainerElement,
30418
- contentNode,
30419
- script.textContent,
30420
- patchSegment || void 0
30421
- );
30973
+ yield* processVNodeDataScope(qContainerElement, contentNode, vData, boundaryId);
30422
30974
  }
30423
30975
  };
30424
- if (__EXPERIMENTAL__.suspense && segmentId !== void 0) {
30425
- if (segmentContainer && segmentContent && segmentVNodeData) {
30426
- segmentContainer.qVNodeRefs || (segmentContainer.qVNodeRefs = /* @__PURE__ */ new Map());
30427
- processSuspenseContentSegment(segmentContainer, segmentContent, segmentId, segmentVNodeData);
30976
+ if (segmentContainer && segmentContent && segmentVNodeData !== void 0) {
30977
+ segmentContainer.qVNodeRefs || (segmentContainer.qVNodeRefs = /* @__PURE__ */ new Map());
30978
+ if (__EXPERIMENTAL__.suspense && segmentId !== void 0) {
30979
+ yield* processSuspenseContentSegment(
30980
+ segmentContainer,
30981
+ segmentContent,
30982
+ segmentId,
30983
+ segmentVNodeData
30984
+ );
30985
+ } else {
30986
+ yield* processVNodeDataScope(segmentContainer, segmentContent, segmentVNodeData);
30428
30987
  }
30429
30988
  return;
30430
30989
  }
30431
- attachVnodeDataAndRefs(document2);
30990
+ yield* attachVnodeDataAndRefs(document2);
30432
30991
  const walker = document2.createTreeWalker(
30433
30992
  document2,
30434
30993
  1 | 128
30435
30994
  /* NodeFilter.SHOW_COMMENT */
30436
30995
  );
30437
- walkContainer(walker, null, walker.firstChild(), null, "", null, null);
30996
+ yield* walkContainer(walker, null, walker.firstChild(), null, "", null, null);
30438
30997
  }
30439
30998
  var isSeparator = (ch) => (
30440
30999
  /* `!` */
@@ -30464,6 +31023,90 @@ var findVDataSectionEnd = (vData, start, end) => {
30464
31023
  return start;
30465
31024
  };
30466
31025
 
31026
+ // packages/qwik/src/core/client/process-state-data.ts
31027
+ function isContainerReady(container) {
31028
+ return container.$containerDataProcessState$ === 3 /* ProcessingStateDone */;
31029
+ }
31030
+ function processContainerStateData(container, iterator) {
31031
+ const state = container.$containerStateDataState$ || (container.$containerStateDataState$ = {
31032
+ $queue$: [],
31033
+ $active$: null
31034
+ });
31035
+ container.$containerDataProcessState$ = 2 /* ProcessingState */;
31036
+ state.$queue$.push(iterator);
31037
+ scheduleProcessContainerStateData(container, state);
31038
+ }
31039
+ var onContainerDataReady = (container, callback) => {
31040
+ const domContainer = container;
31041
+ const checkReady = () => {
31042
+ if (!isContainerReady(domContainer)) {
31043
+ (domContainer.$containerStateReadyCallbacks$ || (domContainer.$containerStateReadyCallbacks$ = [])).push(checkReady);
31044
+ return;
31045
+ }
31046
+ onVNodeDataReady(domContainer.document, () => {
31047
+ if (isContainerReady(domContainer)) {
31048
+ callback();
31049
+ } else {
31050
+ checkReady();
31051
+ }
31052
+ });
31053
+ };
31054
+ checkReady();
31055
+ };
31056
+ var whenContainerDataReady = (container, callback) => {
31057
+ const domContainer = container;
31058
+ if (isContainerReady(domContainer) && domContainer.document.qVNodeDataReady) {
31059
+ return callback();
31060
+ }
31061
+ return new Promise((resolve, reject) => {
31062
+ onContainerDataReady(domContainer, () => {
31063
+ try {
31064
+ resolve(callback());
31065
+ } catch (error) {
31066
+ reject(error);
31067
+ }
31068
+ });
31069
+ });
31070
+ };
31071
+ function scheduleProcessContainerStateData(container, state) {
31072
+ if (state.$active$) {
31073
+ return;
31074
+ }
31075
+ const iterator = state.$queue$.shift();
31076
+ if (!iterator) {
31077
+ markContainerDataReady(container);
31078
+ return;
31079
+ }
31080
+ state.$active$ = createYieldingIteratorState(
31081
+ iterator,
31082
+ () => {
31083
+ state.$active$ = null;
31084
+ scheduleProcessContainerStateData(container, state);
31085
+ },
31086
+ (error) => {
31087
+ state.$active$ = null;
31088
+ logError(error);
31089
+ markContainerDataReady(container);
31090
+ }
31091
+ );
31092
+ scheduleYieldingIterator(state.$active$);
31093
+ }
31094
+ function markContainerDataReady(container) {
31095
+ const state = container.$containerDataProcessState$;
31096
+ if (state !== 2 /* ProcessingState */) {
31097
+ return;
31098
+ }
31099
+ container.$containerDataProcessState$ = 3 /* ProcessingStateDone */;
31100
+ container.$containerStateDataState$ = void 0;
31101
+ const callbacks = container.$containerStateReadyCallbacks$;
31102
+ container.$containerStateReadyCallbacks$ = void 0;
31103
+ if (callbacks) {
31104
+ for (let i2 = 0; i2 < callbacks.length; i2++) {
31105
+ callbacks[i2]();
31106
+ }
31107
+ }
31108
+ }
31109
+
30467
31110
  // packages/qwik/src/core/client/dom-container.ts
30468
31111
  function getDomContainer(element) {
30469
31112
  const qContainerElement = _getQContainerElement(element);
@@ -30484,8 +31127,14 @@ function getOutOfOrderStreamingScript(boundaryId, content) {
30484
31127
  const qContainerElement = content?.closest(QContainerSelector);
30485
31128
  const qContainer = qContainerElement?.qContainer;
30486
31129
  if (qContainer) {
30487
- processOutOfOrderSegmentVNodeData(qContainer.element.ownerDocument, segmentId, content);
30488
- processSegmentStateScripts(qContainer, segmentId);
31130
+ const document2 = qContainer.element.ownerDocument;
31131
+ processOutOfOrderSegmentVNodeData(document2, segmentId, content);
31132
+ onVNodeDataReady(document2, () => {
31133
+ qContainer.element.qContainer === qContainer && processContainerStateData(
31134
+ qContainer,
31135
+ processSegmentStateScriptsIterator(qContainer, segmentId)
31136
+ );
31137
+ });
30489
31138
  }
30490
31139
  }
30491
31140
  var DomContainer = class extends _SharedContainer {
@@ -30501,6 +31150,9 @@ var DomContainer = class extends _SharedContainer {
30501
31150
  __publicField(this, "$instanceHash$");
30502
31151
  __publicField(this, "$forwardRefs$", null);
30503
31152
  __publicField(this, "vNodeLocate", (id) => vnode_locate(this.rootVNode, id));
31153
+ __publicField(this, "$containerDataProcessState$", 0 /* NotStarted */);
31154
+ __publicField(this, "$containerStateReadyCallbacks$");
31155
+ __publicField(this, "$containerStateDataState$");
30504
31156
  __publicField(this, "$rawStateData$");
30505
31157
  __publicField(this, "$stateData$");
30506
31158
  __publicField(this, "$rootForwardRefs$", null);
@@ -30512,7 +31164,8 @@ var DomContainer = class extends _SharedContainer {
30512
31164
  if (!this.qContainer) {
30513
31165
  throw qError(25 /* elementWithoutContainer */);
30514
31166
  }
30515
- this.document = element.ownerDocument;
31167
+ const document2 = element.ownerDocument;
31168
+ this.document = document2;
30516
31169
  this.element = element;
30517
31170
  this.$buildBase$ = element.getAttribute(QBaseAttr);
30518
31171
  this.$instanceHash$ = element.getAttribute(QInstanceAttr);
@@ -30520,23 +31173,48 @@ var DomContainer = class extends _SharedContainer {
30520
31173
  this.rootVNode = vnode_newUnMaterializedElement(this.element);
30521
31174
  this.$rawStateData$ = [];
30522
31175
  this.$stateData$ = [];
30523
- const document2 = this.element.ownerDocument;
30524
- if (!document2.qVNodeDataProcessed) {
30525
- processVNodeData(document2);
30526
- }
30527
31176
  if (__EXPERIMENTAL__.suspense && document2.querySelector("template[q\\:r]")) {
30528
31177
  document2.qProcessOOOS || (document2.qProcessOOOS = getOutOfOrderStreamingScript);
30529
31178
  }
30530
31179
  this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
30531
31180
  this.$setServerData$();
30532
- element.setAttribute(QContainerAttr, "resumed" /* RESUMED */);
30533
31181
  element.qContainer = this;
30534
31182
  element.qDestroy = () => this.$destroy$();
30535
- this.$processRootStateScript$();
31183
+ this.$containerDataProcessState$ = 1 /* ProcessingVNode */;
31184
+ processVNodeData(document2, element);
31185
+ onVNodeDataReady(document2, () => {
31186
+ if (this.$containerDataProcessState$ === 1 /* ProcessingVNode */) {
31187
+ processContainerStateData(this, this.$processContainerData$());
31188
+ }
31189
+ });
31190
+ }
31191
+ *$processContainerData$() {
31192
+ const element = this.element;
31193
+ if (element.qContainer !== this) {
31194
+ return;
31195
+ }
31196
+ const rootState = element.querySelector(
31197
+ `script[type="qwik/state"][q\\:instance="${this.$instanceHash$}"]:not(${QStatePatchAttrSelector})`
31198
+ ) || element.querySelector(
31199
+ `script[type="qwik/state"]:not([q\\:instance]):not(${QStatePatchAttrSelector})`
31200
+ );
31201
+ if (rootState) {
31202
+ this.$rawStateData$ = JSON.parse(rootState.textContent);
31203
+ yield* preprocessStateIterator(this.$rawStateData$, this);
31204
+ this.$rootForwardRefs$ = this.$forwardRefs$;
31205
+ const rootCount = this.$rawStateData$.length / 2;
31206
+ const statePrewarm = element.getAttribute(QStatePrewarmAttr);
31207
+ if (statePrewarm !== null && rootCount > 0 && rootCount >= Number(statePrewarm)) {
31208
+ this.$stateData$ = yield* eagerDeserializeStateIterator(this, this.$rawStateData$);
31209
+ } else {
31210
+ this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
31211
+ }
31212
+ }
30536
31213
  if (__EXPERIMENTAL__.suspense) {
30537
- processSegmentStateScripts(this);
31214
+ yield* processSegmentStateScriptsIterator(this);
30538
31215
  }
30539
31216
  this.$hoistStyles$();
31217
+ element.setAttribute(QContainerAttr, "resumed" /* RESUMED */);
30540
31218
  if (!qTest && element.isConnected) {
30541
31219
  element.dispatchEvent(new CustomEvent("qresume", { bubbles: true }));
30542
31220
  }
@@ -30556,9 +31234,15 @@ var DomContainer = class extends _SharedContainer {
30556
31234
  }
30557
31235
  el.removeAttribute(QContainerAttr);
30558
31236
  const document2 = el.ownerDocument;
31237
+ this.$containerStateDataState$ = void 0;
31238
+ this.$containerDataProcessState$ = 0 /* NotStarted */;
30559
31239
  const hasContainers = document2.querySelector(QContainerSelector) !== null;
30560
31240
  if (!hasContainers) {
30561
31241
  document2.qVNodeData = void 0;
31242
+ document2.qVNodeDataStarted = void 0;
31243
+ document2.qVNodeDataReady = void 0;
31244
+ document2.qVNodeDataState = void 0;
31245
+ document2.qVNodeDataCallbacks = void 0;
30562
31246
  document2.qVNodeDataProcessed = void 0;
30563
31247
  document2.qProcessVNodeDataPatch = void 0;
30564
31248
  }
@@ -30568,20 +31252,6 @@ var DomContainer = class extends _SharedContainer {
30568
31252
  }
30569
31253
  }
30570
31254
  }
30571
- $processRootStateScript$() {
30572
- const rootState = this.element.querySelector(
30573
- `${this.$stateScriptSelector$()}:not(${QStatePatchAttrSelector})`
30574
- );
30575
- if (rootState) {
30576
- this.$rawStateData$ = JSON.parse(rootState.textContent);
30577
- preprocessState(this.$rawStateData$, this);
30578
- this.$rootForwardRefs$ = this.$forwardRefs$;
30579
- this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
30580
- }
30581
- }
30582
- $stateScriptSelector$() {
30583
- return `script[type="qwik/state"][q\\:instance="${this.$instanceHash$}"]`;
30584
- }
30585
31255
  /**
30586
31256
  * The first time we render we need to hoist the styles. (Meaning we need to move all styles from
30587
31257
  * component inline to <head>)
@@ -30710,7 +31380,7 @@ var DomContainer = class extends _SharedContainer {
30710
31380
  }
30711
31381
  getSyncFn(id) {
30712
31382
  const fn = this.$qFuncs$[id];
30713
- isDev24 && assertTrue(typeof fn === "function", "Invalid reference: " + id);
31383
+ isDev23 && assertTrue(typeof fn === "function", "Invalid reference: " + id);
30714
31384
  return fn;
30715
31385
  }
30716
31386
  $appendStyle$(content, styleId, host, scoped) {
@@ -30789,8 +31459,7 @@ function invokeApply(context, fn, args) {
30789
31459
  _context = previousContext;
30790
31460
  }
30791
31461
  }
30792
- var newInvokeContextFromDOM = (event, element) => {
30793
- const domContainer = getDomContainer(element);
31462
+ var newInvokeContextFromDOM = (event, element, domContainer = getDomContainer(element)) => {
30794
31463
  const hostElement = vnode_locate(domContainer.rootVNode, element);
30795
31464
  const locale = domContainer.$locale$;
30796
31465
  locale && setLocale(locale);
@@ -30862,9 +31531,9 @@ var trackSignalAndAssignHost = (value, host, property, container, data) => {
30862
31531
  };
30863
31532
 
30864
31533
  // packages/qwik/src/core/reactive-primitives/impl/store.ts
30865
- import { isDev as isDev25, isServer as isServer11 } from "@qwik.dev/core/build";
30866
- var DEBUG7 = false;
30867
- var log5 = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
31534
+ import { isDev as isDev24, isServer as isServer11 } from "@qwik.dev/core/build";
31535
+ var DEBUG6 = false;
31536
+ var log4 = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
30868
31537
  var getStoreHandler = (value) => {
30869
31538
  return value[STORE_HANDLER];
30870
31539
  };
@@ -30923,7 +31592,7 @@ var StoreHandler2 = class {
30923
31592
  }
30924
31593
  this.$container$ = ctx.$container$;
30925
31594
  } else {
30926
- isDev25 && assertTrue(
31595
+ isDev24 && assertTrue(
30927
31596
  !ctx.$container$ || isSameContainer(ctx.$container$, this.$container$),
30928
31597
  "Do not use signals across containers"
30929
31598
  );
@@ -30958,11 +31627,11 @@ var StoreHandler2 = class {
30958
31627
  if (prop in target) {
30959
31628
  const oldValue = target[prop];
30960
31629
  if (newValue !== oldValue) {
30961
- DEBUG7 && log5("Store.set", oldValue, "->", newValue, pad("\n" + this.toString(), " "));
31630
+ DEBUG6 && log4("Store.set", oldValue, "->", newValue, pad("\n" + this.toString(), " "));
30962
31631
  setNewValueAndTriggerEffects(prop, newValue, target, this);
30963
31632
  }
30964
31633
  } else {
30965
- DEBUG7 && log5("Store.set", "create property", newValue, pad("\n" + this.toString(), " "));
31634
+ DEBUG6 && log4("Store.set", "create property", newValue, pad("\n" + this.toString(), " "));
30966
31635
  setNewValueAndTriggerEffects(prop, newValue, target, this);
30967
31636
  }
30968
31637
  return true;
@@ -31045,7 +31714,7 @@ function addStoreEffect(target, prop, store, effectSubscription, renderContainer
31045
31714
  }
31046
31715
  addQrlToSerializationCtx(effectSubscription, serializationContainer);
31047
31716
  }
31048
- DEBUG7 && log5(
31717
+ DEBUG6 && log4(
31049
31718
  "sub",
31050
31719
  pad(
31051
31720
  "\n" + [...store.$effects$?.entries() || []].map(([key, value]) => `${String(key)}: ${String(value)}`).join(","),
@@ -31275,9 +31944,9 @@ var NoSerializeSymbol = /* @__PURE__ */ Symbol("noSerialize");
31275
31944
  var SerializerSymbol = /* @__PURE__ */ Symbol("serialize");
31276
31945
 
31277
31946
  // packages/qwik/src/core/reactive-primitives/utils.ts
31278
- import { isBrowser as isBrowser4, isDev as isDev26 } from "@qwik.dev/core/build";
31279
- var DEBUG8 = false;
31280
- var log6 = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
31947
+ import { isBrowser as isBrowser4, isDev as isDev25 } from "@qwik.dev/core/build";
31948
+ var DEBUG7 = false;
31949
+ var log5 = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
31281
31950
  var throwIfQRLNotResolved = (qrl) => {
31282
31951
  const resolved = qrl.resolved;
31283
31952
  if (!resolved) {
@@ -31322,7 +31991,7 @@ var scheduleEffects = (container, signal, effects) => {
31322
31991
  const scheduleEffect = (effectSubscription) => {
31323
31992
  const consumer = effectSubscription.consumer;
31324
31993
  const property = effectSubscription.property;
31325
- isDev26 && assertDefined(container, "Container must be defined.");
31994
+ isDev25 && assertDefined(container, "Container must be defined.");
31326
31995
  if (isTask(consumer)) {
31327
31996
  consumer.$flags$ |= 4 /* DIRTY */;
31328
31997
  markVNodeDirty(container, consumer.$el$, 1 /* TASKS */);
@@ -31364,7 +32033,7 @@ var scheduleEffects = (container, signal, effects) => {
31364
32033
  scheduleEffect(effectsSnapshot[i2]);
31365
32034
  }
31366
32035
  }
31367
- DEBUG8 && log6("done scheduling");
32036
+ DEBUG7 && log5("done scheduling");
31368
32037
  };
31369
32038
  var isSerializerObj = (obj) => {
31370
32039
  return isObject(obj) && typeof obj[SerializerSymbol] === "function";
@@ -31506,7 +32175,7 @@ var createFastGetter = (propName) => {
31506
32175
 
31507
32176
  // packages/qwik/src/core/client/vnode-utils.ts
31508
32177
  var vnode_newElement = (element, elementName, key = null) => {
31509
- isDev27 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
32178
+ isDev26 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
31510
32179
  const vnode = new ElementVNode(
31511
32180
  key,
31512
32181
  1 /* Element */ | 8 /* Inflated */ | -1 << 12 /* shift */,
@@ -31524,7 +32193,7 @@ var vnode_newElement = (element, elementName, key = null) => {
31524
32193
  return vnode;
31525
32194
  };
31526
32195
  var vnode_newUnMaterializedElement = (element) => {
31527
- isDev27 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
32196
+ isDev26 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
31528
32197
  const vnode = new ElementVNode(
31529
32198
  null,
31530
32199
  1 /* Element */ | -1 << 12 /* shift */,
@@ -31542,7 +32211,7 @@ var vnode_newUnMaterializedElement = (element) => {
31542
32211
  return vnode;
31543
32212
  };
31544
32213
  var vnode_newSharedText = (previousTextNode, sharedTextNode, textContent) => {
31545
- isDev27 && sharedTextNode && assertEqual(fastNodeType(sharedTextNode), 3, "Expecting text node.");
32214
+ isDev26 && sharedTextNode && assertEqual(fastNodeType(sharedTextNode), 3, "Expecting text node.");
31546
32215
  const vnode = new TextVNode(
31547
32216
  4 /* Text */ | -1 << 12 /* shift */,
31548
32217
  // Flag
@@ -31574,10 +32243,10 @@ var vnode_newText = (textNode, textContent) => {
31574
32243
  textContent
31575
32244
  // Text Content
31576
32245
  );
31577
- isDev27 && assertEqual(fastNodeType(textNode), 3, "Expecting text node.");
31578
- isDev27 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
31579
- isDev27 && assertTrue(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
31580
- isDev27 && assertFalse(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
32246
+ isDev26 && assertEqual(fastNodeType(textNode), 3, "Expecting text node.");
32247
+ isDev26 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
32248
+ isDev26 && assertTrue(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
32249
+ isDev26 && assertFalse(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
31581
32250
  return vnode;
31582
32251
  };
31583
32252
  var vnode_newVirtual = () => {
@@ -31592,9 +32261,9 @@ var vnode_newVirtual = () => {
31592
32261
  null,
31593
32262
  null
31594
32263
  );
31595
- isDev27 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
31596
- isDev27 && assertFalse(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
31597
- isDev27 && assertTrue(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
32264
+ isDev26 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
32265
+ isDev26 && assertFalse(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
32266
+ isDev26 && assertTrue(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
31598
32267
  return vnode;
31599
32268
  };
31600
32269
  var vnode_isVNode = (vNode) => {
@@ -31604,12 +32273,12 @@ var vnode_isElementVNode = (vNode) => {
31604
32273
  return (vNode.flags & 1 /* Element */) === 1 /* Element */;
31605
32274
  };
31606
32275
  var vnode_isElementOrTextVNode = (vNode) => {
31607
- isDev27 && assertDefined(vNode, "Missing vNode");
32276
+ isDev26 && assertDefined(vNode, "Missing vNode");
31608
32277
  const flag = vNode.flags;
31609
32278
  return (flag & 5 /* ELEMENT_OR_TEXT_MASK */) !== 0;
31610
32279
  };
31611
32280
  var vnode_isMaterialized = (vNode) => {
31612
- isDev27 && assertDefined(vNode, "Missing vNode");
32281
+ isDev26 && assertDefined(vNode, "Missing vNode");
31613
32282
  const flag = vNode.flags;
31614
32283
  return (flag & 1 /* Element */) === 1 /* Element */ && vNode.firstChild !== void 0 && vNode.lastChild !== void 0;
31615
32284
  };
@@ -31620,26 +32289,26 @@ var vnode_isVirtualVNode = (vNode) => {
31620
32289
  return (vNode.flags & 2 /* Virtual */) === 2 /* Virtual */;
31621
32290
  };
31622
32291
  var vnode_isProjection = (vNode) => {
31623
- isDev27 && assertDefined(vNode, "Missing vNode");
32292
+ isDev26 && assertDefined(vNode, "Missing vNode");
31624
32293
  const flag = vNode.flags;
31625
32294
  return (flag & 2 /* Virtual */) === 2 /* Virtual */ && vnode_getProp(vNode, QSlot, null) !== null;
31626
32295
  };
31627
32296
  var ensureTextVNode = (vNode) => {
31628
- isDev27 && assertTrue(
32297
+ isDev26 && assertTrue(
31629
32298
  vnode_isTextVNode(vNode),
31630
32299
  "Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)
31631
32300
  );
31632
32301
  return vNode;
31633
32302
  };
31634
32303
  var ensureElementOrVirtualVNode = (vNode) => {
31635
- isDev27 && assertDefined(vNode, "Missing vNode");
31636
- isDev27 && assertTrue(
32304
+ isDev26 && assertDefined(vNode, "Missing vNode");
32305
+ isDev26 && assertTrue(
31637
32306
  (vNode.flags & 3 /* ELEMENT_OR_VIRTUAL_MASK */) !== 0,
31638
32307
  "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode)
31639
32308
  );
31640
32309
  };
31641
32310
  var ensureElementVNode = (vNode) => {
31642
- isDev27 && assertTrue(
32311
+ isDev26 && assertTrue(
31643
32312
  vnode_isElementVNode(vNode),
31644
32313
  "Expecting ElementVNode was: " + vnode_getNodeTypeName(vNode)
31645
32314
  );
@@ -31880,7 +32549,7 @@ var vnode_ensureTextInflated = (journal, vnode) => {
31880
32549
  const flags = textVNode.flags;
31881
32550
  if ((flags & 8 /* Inflated */) === 0) {
31882
32551
  const parentNode = vnode_getDomParent(vnode, true);
31883
- isDev27 && assertDefined(parentNode, "Missing parent node.");
32552
+ isDev26 && assertDefined(parentNode, "Missing parent node.");
31884
32553
  const sharedTextNode = textVNode.node;
31885
32554
  const doc = fastOwnerDocument(parentNode);
31886
32555
  let vCursor = vnode_getDomSibling(vnode, false, true);
@@ -31930,7 +32599,7 @@ var vnode_locate = (rootVNode, id) => {
31930
32599
  let refElement;
31931
32600
  const localId = typeof id === "string" ? id : "";
31932
32601
  if (typeof id === "string") {
31933
- isDev27 && assertDefined(qVNodeRefs, "Missing qVNodeRefs.");
32602
+ isDev26 && assertDefined(qVNodeRefs, "Missing qVNodeRefs.");
31934
32603
  elementOffset = parseInt(localId);
31935
32604
  refElement = qVNodeRefs.get(elementOffset);
31936
32605
  } else {
@@ -31947,12 +32616,12 @@ var vnode_locate = (rootVNode, id) => {
31947
32616
  return vNode;
31948
32617
  }
31949
32618
  }
31950
- isDev27 && assertDefined(
32619
+ isDev26 && assertDefined(
31951
32620
  refElement,
31952
32621
  "Missing refElement " + (typeof id === "string" ? `for id ${id}` : "")
31953
32622
  );
31954
32623
  if (!vnode_isVNode(refElement)) {
31955
- isDev27 && assertTrue(
32624
+ isDev26 && assertTrue(
31956
32625
  containerElement.contains(refElement),
31957
32626
  `Couldn't find the element inside the container while locating the VNode.`
31958
32627
  );
@@ -32001,10 +32670,10 @@ var vnode_locate = (rootVNode, id) => {
32001
32670
  };
32002
32671
  var vnode_getChildWithIdx = (vNode, childIdx) => {
32003
32672
  let child = vnode_getFirstChild(vNode);
32004
- isDev27 && assertDefined(child, "Missing child.");
32673
+ isDev26 && assertDefined(child, "Missing child.");
32005
32674
  while (child.flags >>> 12 /* shift */ !== childIdx) {
32006
32675
  child = child.nextSibling;
32007
- isDev27 && assertDefined(child, "Missing child.");
32676
+ isDev26 && assertDefined(child, "Missing child.");
32008
32677
  }
32009
32678
  return child;
32010
32679
  };
@@ -32012,7 +32681,7 @@ var vNodeStack = [];
32012
32681
  var vnode_getVNodeForChildNode = (vNode, childElement) => {
32013
32682
  ensureElementVNode(vNode);
32014
32683
  let child = vnode_getFirstChild(vNode);
32015
- isDev27 && assertDefined(child, "Missing child.");
32684
+ isDev26 && assertDefined(child, "Missing child.");
32016
32685
  while (child && (child instanceof ElementVNode ? child.node !== childElement : true)) {
32017
32686
  if (vnode_isVirtualVNode(child)) {
32018
32687
  const next = child.nextSibling;
@@ -32031,13 +32700,13 @@ var vnode_getVNodeForChildNode = (vNode, childElement) => {
32031
32700
  child = next || vNodeStack.pop();
32032
32701
  }
32033
32702
  }
32034
- isDev27 && assertDefined(child, "Missing child.");
32703
+ isDev26 && assertDefined(child, "Missing child.");
32035
32704
  }
32036
32705
  while (vNodeStack.length) {
32037
32706
  vNodeStack.pop();
32038
32707
  }
32039
32708
  ensureElementVNode(child);
32040
- isDev27 && assertEqual(child.node, childElement, "Child not found.");
32709
+ isDev26 && assertEqual(child.node, childElement, "Child not found.");
32041
32710
  return child;
32042
32711
  };
32043
32712
  var indexOfAlphanumeric = (id, length) => {
@@ -32295,7 +32964,7 @@ var vnode_getDomParentVNode = (vnode, includeProjection) => {
32295
32964
  return vnode;
32296
32965
  };
32297
32966
  var vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
32298
- isDev27 && assertEqual(vParent, vToRemove.parent, "Parent mismatch.");
32967
+ isDev26 && assertEqual(vParent, vToRemove.parent, "Parent mismatch.");
32299
32968
  if (vnode_isTextVNode(vToRemove)) {
32300
32969
  vnode_ensureTextInflated(journal, vToRemove);
32301
32970
  }
@@ -32328,7 +32997,7 @@ var vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
32328
32997
  vToRemove.nextSibling = null;
32329
32998
  };
32330
32999
  var vnode_truncate = (journal, vParent, vDelete, removeDOM = true) => {
32331
- isDev27 && assertDefined(vDelete, "Missing vDelete.");
33000
+ isDev26 && assertDefined(vDelete, "Missing vDelete.");
32332
33001
  const parent = vnode_getDomParent(vParent, true);
32333
33002
  if (parent && removeDOM) {
32334
33003
  if (vnode_isElementOrTextVNode(vParent)) {
@@ -32431,8 +33100,8 @@ var ensureMaterialized = (vnode) => {
32431
33100
  vFirstChild = vnode_materialize(vParent);
32432
33101
  }
32433
33102
  }
32434
- isDev27 && assertTrue(vParent.firstChild !== void 0, "Did not materialize.");
32435
- isDev27 && assertTrue(vParent.lastChild !== void 0, "Did not materialize.");
33103
+ isDev26 && assertTrue(vParent.firstChild !== void 0, "Did not materialize.");
33104
+ isDev26 && assertTrue(vParent.lastChild !== void 0, "Did not materialize.");
32436
33105
  return vFirstChild;
32437
33106
  };
32438
33107
  var _fastHasAttribute = null;
@@ -32604,7 +33273,7 @@ var materializeFromDOM = (vParent, firstChild, vData, segmentId) => {
32604
33273
  }
32605
33274
  const id = consumeValue();
32606
33275
  container.$setRawState$(parseInt(id, 10), vParent);
32607
- isDev27 && vnode_setProp(vParent, ELEMENT_ID, id);
33276
+ isDev26 && vnode_setProp(vParent, ELEMENT_ID, id);
32608
33277
  } else if (peek() === VNodeDataChar.BACK_REFS) {
32609
33278
  if (!container) {
32610
33279
  container = getDomContainer(vParent.node);
@@ -32669,8 +33338,17 @@ var processVNodeData2 = (vData, callback) => {
32669
33338
  }
32670
33339
  return vData.substring(start, nextToConsumeIdx);
32671
33340
  };
33341
+ const consumeEncodedValue = () => {
33342
+ if (getChar(nextToConsumeIdx + 1) !== VNodeDataChar.SEPARATOR) {
33343
+ return consumeValue();
33344
+ }
33345
+ consume();
33346
+ const value = decodeURIComponent(decodeVNodeDataString(consumeValue()));
33347
+ consume();
33348
+ return value;
33349
+ };
32672
33350
  while (peek() !== 0) {
32673
- callback(peek, consumeValue, consume, getChar, nextToConsumeIdx);
33351
+ callback(peek, consumeValue, consume, getChar, nextToConsumeIdx, consumeEncodedValue);
32674
33352
  }
32675
33353
  };
32676
33354
  var vnode_getAttrKeys = (container, vnode) => {
@@ -32855,12 +33533,12 @@ function materializeFromVNodeData(vParent, vData, element, child, segmentId) {
32855
33533
  return !nodeIsElement || nodeIsElement && shouldSkipElement(node);
32856
33534
  };
32857
33535
  let components = null;
32858
- processVNodeData2(vData, (peek, consumeValue, consume, getChar, nextToConsumeIdx) => {
33536
+ processVNodeData2(vData, (peek, consumeValue, consume, getChar, dataIdx, consumeEncodedValue) => {
32859
33537
  if (isNumber(peek())) {
32860
33538
  while (shouldSkipNode(child)) {
32861
33539
  child = fastNextSibling(child);
32862
33540
  if (!child) {
32863
- throw qError(27 /* materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
33541
+ throw qError(27 /* materializeVNodeDataError */, [vData, peek(), dataIdx]);
32864
33542
  }
32865
33543
  }
32866
33544
  combinedText = null;
@@ -32881,7 +33559,7 @@ function materializeFromVNodeData(vParent, vData, element, child, segmentId) {
32881
33559
  ) {
32882
33560
  child = fastNextSibling(child);
32883
33561
  if (!child && value > 0) {
32884
- throw qError(27 /* materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
33562
+ throw qError(27 /* materializeVNodeDataError */, [vData, peek(), dataIdx]);
32885
33563
  }
32886
33564
  }
32887
33565
  }
@@ -32896,20 +33574,11 @@ function materializeFromVNodeData(vParent, vData, element, child, segmentId) {
32896
33574
  }
32897
33575
  const id = consumeValue();
32898
33576
  container.$setRawState$(parseInt(id, 10), vParent);
32899
- isDev27 && vnode_setProp(vParent, ELEMENT_ID, id);
33577
+ isDev26 && vnode_setProp(vParent, ELEMENT_ID, id);
32900
33578
  } else if (peek() === VNodeDataChar.PROPS) {
32901
33579
  vnode_setProp(vParent, ELEMENT_PROPS, consumeValue());
32902
33580
  } else if (peek() === VNodeDataChar.KEY) {
32903
- const isEscapedValue = getChar(nextToConsumeIdx + 1) === VNodeDataChar.SEPARATOR;
32904
- let value;
32905
- if (isEscapedValue) {
32906
- consume();
32907
- value = decodeURIComponent(decodeVNodeDataString(consumeValue()));
32908
- consume();
32909
- } else {
32910
- value = consumeValue();
32911
- }
32912
- vParent.key = value;
33581
+ vParent.key = consumeEncodedValue();
32913
33582
  } else if (peek() === VNodeDataChar.SEQ) {
32914
33583
  vnode_setProp(vParent, ELEMENT_SEQ, consumeValue());
32915
33584
  } else if (peek() === VNodeDataChar.SEQ_IDX) {
@@ -32936,7 +33605,7 @@ function materializeFromVNodeData(vParent, vData, element, child, segmentId) {
32936
33605
  } else if (peek() === VNodeDataChar.SEPARATOR) {
32937
33606
  const keyValue = consumeValue();
32938
33607
  const key = decodeVNodeDataString(keyValue);
32939
- const valueSeparatorIdx = nextToConsumeIdx + keyValue.length + 1;
33608
+ const valueSeparatorIdx = dataIdx + keyValue.length + 1;
32940
33609
  const isEscapedValue = getChar(valueSeparatorIdx + 1) === VNodeDataChar.SEPARATOR;
32941
33610
  let value;
32942
33611
  if (isEscapedValue) {
@@ -32956,8 +33625,7 @@ function materializeFromVNodeData(vParent, vData, element, child, segmentId) {
32956
33625
  vFirst = stack.pop();
32957
33626
  vParent = stack.pop();
32958
33627
  } else if (peek() === VNodeDataChar.SLOT) {
32959
- const value = decodeVNodeDataString(consumeValue());
32960
- vnode_setProp(vParent, QSlot, value);
33628
+ vnode_setProp(vParent, QSlot, consumeEncodedValue());
32961
33629
  } else {
32962
33630
  while (isElement(child) && shouldSkipElement(child)) {
32963
33631
  child = fastNextSibling(child);
@@ -34530,7 +35198,7 @@ import {
34530
35198
  _vnode_toString
34531
35199
  } from "@qwik.dev/core/internal";
34532
35200
  import { expect as expect2 } from "vitest";
34533
- import { _dumpState, _preprocessState as preprocessState2 } from "@qwik.dev/core/internal";
35201
+ import { _dumpState, _preprocessState as preprocessState } from "@qwik.dev/core/internal";
34534
35202
  import { useContextProvider } from "../core.mjs";
34535
35203
 
34536
35204
  // packages/qwik/src/core/preloader/bundle-graph.ts
@@ -34573,7 +35241,7 @@ import { getClientManifest } from "../core.mjs";
34573
35241
 
34574
35242
  // packages/qwik/src/server/platform.ts
34575
35243
  import { setPlatform } from "../core.mjs";
34576
- import { isDev as isDev28 } from "@qwik.dev/core/build";
35244
+ import { isDev as isDev27 } from "@qwik.dev/core/build";
34577
35245
  var getDevSegmentPath = (mapper, hash, symbolName, parent) => {
34578
35246
  const existing = mapper?.[hash];
34579
35247
  if (existing) {
@@ -34595,9 +35263,9 @@ var getDevSegmentPath = (mapper, hash, symbolName, parent) => {
34595
35263
  function createPlatform3(opts, resolvedManifest) {
34596
35264
  const mapper = resolvedManifest?.mapper;
34597
35265
  const mapperFn = opts.symbolMapper ? opts.symbolMapper : (symbolName, _chunk, parent) => {
34598
- if (mapper || isDev28 && import.meta.env?.MODE !== "test") {
35266
+ if (mapper || isDev27 && import.meta.env?.MODE !== "test") {
34599
35267
  const hash = getSymbolHash2(symbolName);
34600
- const result = !isDev28 ? mapper[hash] : getDevSegmentPath(mapper, hash, symbolName, parent);
35268
+ const result = !isDev27 ? mapper[hash] : getDevSegmentPath(mapper, hash, symbolName, parent);
34601
35269
  if (!result) {
34602
35270
  if (hash === SYNC_QRL) {
34603
35271
  return [hash, ""];
@@ -34644,7 +35312,7 @@ var getSymbolHash2 = (symbolName) => {
34644
35312
  };
34645
35313
 
34646
35314
  // packages/qwik/src/server/ssr-container.ts
34647
- import { isDev as isDev30 } from "@qwik.dev/core/build";
35315
+ import { isDev as isDev29 } from "@qwik.dev/core/build";
34648
35316
  import {
34649
35317
  _SubscriptionData as SubscriptionData2,
34650
35318
  _SharedContainer as _SharedContainer2,
@@ -34909,7 +35577,7 @@ import {
34909
35577
  _EMPTY_OBJ,
34910
35578
  _EFFECT_BACK_REF as _EFFECT_BACK_REF2
34911
35579
  } from "@qwik.dev/core/internal";
34912
- import { isDev as isDev29 } from "@qwik.dev/core/build";
35580
+ import { isDev as isDev28 } from "@qwik.dev/core/build";
34913
35581
  var SsrNode = class {
34914
35582
  constructor(parentComponent, id, attributesIndex, cleanupQueue, vnodeData, currentFile) {
34915
35583
  this.parentComponent = parentComponent;
@@ -34934,7 +35602,7 @@ var SsrNode = class {
34934
35602
  this.flags = 1 /* Updatable */;
34935
35603
  this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] : _EMPTY_OBJ;
34936
35604
  this.parentComponent?.addChild(this);
34937
- if (isDev29 && id.indexOf("undefined") != -1) {
35605
+ if (isDev28 && id.indexOf("undefined") != -1) {
34938
35606
  throw new Error(`Invalid SSR node id: ${id}`);
34939
35607
  }
34940
35608
  }
@@ -34999,7 +35667,7 @@ var SsrNode = class {
34999
35667
  }
35000
35668
  }
35001
35669
  toString() {
35002
- if (isDev29) {
35670
+ if (isDev28) {
35003
35671
  let stringifiedAttrs = "";
35004
35672
  for (const key in this.attrs) {
35005
35673
  const value = this.attrs[key];
@@ -35092,6 +35760,10 @@ var renderSSRChunks = (chunks, remap) => {
35092
35760
  const chunk = chunks[i2];
35093
35761
  if (typeof chunk === "string") {
35094
35762
  out += chunk;
35763
+ } else if (chunk.type === "root-ref-delta") {
35764
+ const id = remap ? remap[chunk.localId] ?? chunk.localId : chunk.localId;
35765
+ const base2 = remap ? remap[chunk.localBaseId] ?? chunk.localBaseId : chunk.localBaseId;
35766
+ out += String(id - base2);
35095
35767
  } else {
35096
35768
  const localId = chunk.type === "root-ref" ? chunk.localId : chunk.localPath[0];
35097
35769
  out += String(remap ? remap[localId] ?? localId : localId);
@@ -35119,6 +35791,9 @@ var StringSSRWriter = class {
35119
35791
  writeRootRefPath(path) {
35120
35792
  writeStringRootRefPath(this, path);
35121
35793
  }
35794
+ writeRootRefDelta(id, base2) {
35795
+ writeStringRootRefDelta(this, id, base2);
35796
+ }
35122
35797
  clear() {
35123
35798
  this.buffer.length = 0;
35124
35799
  }
@@ -35139,6 +35814,9 @@ var StringBufferSegmentWriter = class {
35139
35814
  writeRootRefPath(path) {
35140
35815
  this.chunks.push({ type: "root-ref-path", localPath: path });
35141
35816
  }
35817
+ writeRootRefDelta(id, base2) {
35818
+ this.chunks.push({ type: "root-ref-delta", localId: id, localBaseId: base2 });
35819
+ }
35142
35820
  clear() {
35143
35821
  this.chunks.length = 0;
35144
35822
  }
@@ -35278,6 +35956,7 @@ function encodeAsAlphanumeric(value) {
35278
35956
  }
35279
35957
 
35280
35958
  // packages/qwik/src/server/ssr-container.ts
35959
+ var VALID_ELEMENT_NAME = /^[A-Za-z][A-Za-z0-9._:-]*$/;
35281
35960
  var NO_SCRIPT_HERE_ELEMENTS = /* @__PURE__ */ new Set([
35282
35961
  "script",
35283
35962
  "style",
@@ -35663,11 +36342,17 @@ var SSRContainer = class extends _SharedContainer2 {
35663
36342
  containerAttributes[QContainerAttr] = "paused" /* PAUSED */;
35664
36343
  containerAttributes[QRuntimeAttr] = "2";
35665
36344
  containerAttributes[QVersionAttr] = this.$version$ ?? "dev";
35666
- containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (isDev30 ? "ssr-dev" : "ssr");
36345
+ containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (isDev29 ? "ssr-dev" : "ssr");
35667
36346
  containerAttributes[QBaseAttr] = this.$buildBase$ || "";
35668
36347
  containerAttributes[QLocaleAttr] = this.$locale$;
35669
36348
  containerAttributes[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
35670
36349
  containerAttributes[QInstanceAttr] = this.$instanceHash$;
36350
+ const statePrewarm = this.renderOptions.statePrewarm;
36351
+ if (typeof statePrewarm === "number") {
36352
+ containerAttributes[QStatePrewarmAttr] = String(statePrewarm);
36353
+ } else {
36354
+ delete containerAttributes[QStatePrewarmAttr];
36355
+ }
35671
36356
  this.$serverData$.containerAttributes = containerAttributes;
35672
36357
  this.openElement(this.tag, null, containerAttributes);
35673
36358
  if (!this.isHtml) {
@@ -35680,6 +36365,9 @@ var SSRContainer = class extends _SharedContainer2 {
35680
36365
  }
35681
36366
  /** Renders opening tag for DOM element */
35682
36367
  openElement(elementName, key, varAttrs, constAttrs = null, styleScopedId = null, currentFile = null, hasMovedCaptures = true) {
36368
+ if (!VALID_ELEMENT_NAME.test(elementName)) {
36369
+ throw qError(36 /* invalidElementName */, [JSON.stringify(elementName)]);
36370
+ }
35683
36371
  const isQwikStyle = isQwikStyleElement(elementName, varAttrs) || isQwikStyleElement(elementName, constAttrs);
35684
36372
  if (NO_SCRIPT_HERE_ELEMENTS.has(elementName)) {
35685
36373
  this.$noScriptHere$++;
@@ -35718,7 +36406,9 @@ var SSRContainer = class extends _SharedContainer2 {
35718
36406
  }
35719
36407
  this.write(" " + Q_PROPS_SEPARATOR);
35720
36408
  if (key !== null) {
35721
- this.write(`="${key}"`);
36409
+ this.write(ATTR_EQUALS_QUOTE);
36410
+ this.write(escapeHTML(key));
36411
+ this.write(QUOTE);
35722
36412
  } else if (qTest) {
35723
36413
  this.write(EMPTY_ATTR);
35724
36414
  }
@@ -35860,7 +36550,7 @@ var SSRContainer = class extends _SharedContainer2 {
35860
36550
  this.markVNodeRefForSerialization(componentFrame.componentNode);
35861
36551
  }
35862
36552
  this.openFragment(
35863
- isDev30 ? {
36553
+ isDev29 ? {
35864
36554
  [DEBUG_TYPE]: "P" /* Projection */,
35865
36555
  [QSlotParent]: componentFrame.componentNode.id,
35866
36556
  [QSlot]: slotName
@@ -35989,14 +36679,13 @@ var SSRContainer = class extends _SharedContainer2 {
35989
36679
  emitRestStateData() {
35990
36680
  this.emitVNodeData();
35991
36681
  this.emitDelayedOutOfOrderSegmentVNodeData();
35992
- if (!isDev30) {
36682
+ if (!isDev29) {
35993
36683
  preloaderPost(this, this.renderOptions, this.$serverData$?.nonce);
35994
36684
  }
35995
36685
  this.emitSyncFnsData();
35996
36686
  this.emitPatchDataIfNeeded();
35997
36687
  this.emitExecutorIfNeeded();
35998
36688
  this.emitQwikLoaderAtBottomIfNeeded();
35999
- this.emitContainerReadyEventIfNeeded();
36000
36689
  }
36001
36690
  emitDelayedOutOfOrderSegmentVNodeData() {
36002
36691
  if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed) {
@@ -36192,6 +36881,7 @@ var SSRContainer = class extends _SharedContainer2 {
36192
36881
  this.write(VNodeDataChar.CONTEXT_CHAR);
36193
36882
  break;
36194
36883
  case QSlot:
36884
+ encodeValue = encodeVNodeDataKey;
36195
36885
  this.write(VNodeDataChar.SLOT_CHAR);
36196
36886
  break;
36197
36887
  default: {
@@ -36215,7 +36905,7 @@ var SSRContainer = class extends _SharedContainer2 {
36215
36905
  }
36216
36906
  }
36217
36907
  emitStateData() {
36218
- if (!this.serializationCtx.$roots$.length) {
36908
+ if (!this.serializationCtx.$roots$.length && !this.serializationCtx.$eagerResume$.size) {
36219
36909
  return;
36220
36910
  }
36221
36911
  const attrs = this.stateScriptAttrs();
@@ -36282,7 +36972,7 @@ var SSRContainer = class extends _SharedContainer2 {
36282
36972
  if (this.renderOptions.serverData?.nonce) {
36283
36973
  scriptAttrs["nonce"] = this.renderOptions.serverData.nonce;
36284
36974
  }
36285
- this.writeScript(scriptAttrs, JSON.stringify(patches));
36975
+ this.writeScript(scriptAttrs, JSON.stringify(patches).replaceAll("<", "\\u003C"));
36286
36976
  }
36287
36977
  }
36288
36978
  emitBackpatchDataAndExecutorIfNeeded() {
@@ -36301,7 +36991,7 @@ var SSRContainer = class extends _SharedContainer2 {
36301
36991
  if (this.renderOptions.serverData?.nonce) {
36302
36992
  scriptAttrs["nonce"] = this.renderOptions.serverData.nonce;
36303
36993
  }
36304
- const backpatchScript = getQwikBackpatchExecutorScript({ debug: isDev30 });
36994
+ const backpatchScript = getQwikBackpatchExecutorScript({ debug: isDev29 });
36305
36995
  this.writeScript(scriptAttrs, backpatchScript);
36306
36996
  }
36307
36997
  emitOutOfOrderExecutorIfNeeded() {
@@ -36311,7 +37001,7 @@ var SSRContainer = class extends _SharedContainer2 {
36311
37001
  this.isOutOfOrderExecutorEmitted = true;
36312
37002
  this.writeScript(
36313
37003
  { type: "text/javascript", nonce: this.renderOptions.serverData?.nonce },
36314
- getQwikOutOfOrderExecutorScript({ debug: isDev30 })
37004
+ getQwikOutOfOrderExecutorScript({ debug: isDev29 })
36315
37005
  );
36316
37006
  }
36317
37007
  emitInlineScript(script) {
@@ -36321,14 +37011,6 @@ var SSRContainer = class extends _SharedContainer2 {
36321
37011
  }
36322
37012
  this.writeScript(scriptAttrs, script);
36323
37013
  }
36324
- emitContainerReadyEventIfNeeded() {
36325
- if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed) {
36326
- return;
36327
- }
36328
- this.emitInlineScript(
36329
- `document.qready||(document.qready={});document.qready["${this.$instanceHash$}"]=1;try{document.dispatchEvent(new CustomEvent("qready",{detail:"${this.$instanceHash$}"}))}catch(e){}`
36330
- );
36331
- }
36332
37014
  writeScript(attrs, body) {
36333
37015
  this.openScript(attrs);
36334
37016
  if (body) {
@@ -36345,7 +37027,7 @@ var SSRContainer = class extends _SharedContainer2 {
36345
37027
  this.write("</script>");
36346
37028
  }
36347
37029
  emitPreloaderPre() {
36348
- if (!isDev30) {
37030
+ if (!isDev29) {
36349
37031
  preloaderPre(this, this.renderOptions.preloader, this.renderOptions.serverData?.nonce);
36350
37032
  }
36351
37033
  }
@@ -36392,21 +37074,24 @@ var SSRContainer = class extends _SharedContainer2 {
36392
37074
  if (this.qlInclude !== 2 /* Done */) {
36393
37075
  this.emitQwikLoaderInline();
36394
37076
  }
36395
- this.emitNewQwikEvents();
37077
+ this.emitNewQwikEvents(true);
36396
37078
  }
36397
37079
  }
36398
- emitNewQwikEvents() {
36399
- const eventNames = [];
37080
+ emitNewQwikEvents(includeContainerReady = false) {
37081
+ const qwikEventItems = [];
36400
37082
  for (const eventName of this.serializationCtx.$eventNames$) {
36401
37083
  if (!this.emittedQwikEventNames.has(eventName)) {
36402
37084
  this.emittedQwikEventNames.add(eventName);
36403
- eventNames.push(JSON.stringify(eventName));
37085
+ qwikEventItems.push(JSON.stringify(eventName));
36404
37086
  }
36405
37087
  }
36406
- this.emitQwikEvents(eventNames);
37088
+ if (includeContainerReady) {
37089
+ qwikEventItems.push(`${QwikEvContainerReady}`, JSON.stringify(this.$instanceHash$));
37090
+ }
37091
+ this.emitQwikEvents(qwikEventItems);
36407
37092
  }
36408
- emitQwikEvents(eventNames) {
36409
- if (eventNames.length > 0) {
37093
+ emitQwikEvents(qwikEventItems) {
37094
+ if (qwikEventItems.length > 0) {
36410
37095
  const scriptAttrs = {};
36411
37096
  const nonce = this.renderOptions.serverData?.nonce;
36412
37097
  if (nonce) {
@@ -36414,7 +37099,7 @@ var SSRContainer = class extends _SharedContainer2 {
36414
37099
  }
36415
37100
  this.openScript(scriptAttrs);
36416
37101
  this.write(`(window._qwikEv||(window._qwikEv=[])).push(`);
36417
- this.writeArray(eventNames, COMMA);
37102
+ this.writeArray(qwikEventItems, COMMA);
36418
37103
  this.write(PAREN_CLOSE);
36419
37104
  this.closeScript();
36420
37105
  }
@@ -36447,7 +37132,7 @@ var SSRContainer = class extends _SharedContainer2 {
36447
37132
  }
36448
37133
  createAndPushFrame(elementName, depthFirstElementIdx, currentFile) {
36449
37134
  let tagNesting = 10 /* ANYTHING */;
36450
- if (isDev30) {
37135
+ if (isDev29) {
36451
37136
  if (!this.currentElementFrame) {
36452
37137
  tagNesting = initialTag(elementName);
36453
37138
  } else {
@@ -36494,7 +37179,7 @@ var SSRContainer = class extends _SharedContainer2 {
36494
37179
  elementName,
36495
37180
  depthFirstElementIdx,
36496
37181
  vNodeData: [0 /* NONE */],
36497
- currentFile: isDev30 ? currentFile || null : null,
37182
+ currentFile: isDev29 ? currentFile || null : null,
36498
37183
  refBase: null
36499
37184
  };
36500
37185
  this.currentElementFrame = frame;
@@ -36521,6 +37206,11 @@ var SSRContainer = class extends _SharedContainer2 {
36521
37206
  this.size += 1 + String(path[i2]).length;
36522
37207
  }
36523
37208
  }
37209
+ writeRootRefDelta(id, base2) {
37210
+ const delta = id - base2;
37211
+ this.size += String(delta).length;
37212
+ this.writer.writeRootRefDelta(id, base2);
37213
+ }
36524
37214
  writeArray(array, separator) {
36525
37215
  for (let i2 = 0; i2 < array.length; i2++) {
36526
37216
  const element = array[i2];
@@ -36535,7 +37225,7 @@ var SSRContainer = class extends _SharedContainer2 {
36535
37225
  for (let key in attrs) {
36536
37226
  let value = attrs[key];
36537
37227
  if (isSSRUnsafeAttr(key)) {
36538
- if (isDev30) {
37228
+ if (isDev29) {
36539
37229
  throw qError(32 /* unsafeAttr */, [key]);
36540
37230
  }
36541
37231
  continue;
@@ -36598,7 +37288,7 @@ var SSRContainer = class extends _SharedContainer2 {
36598
37288
  }
36599
37289
  if (tag === "textarea" && key === "value") {
36600
37290
  if (value && typeof value !== "string") {
36601
- if (isDev30) {
37291
+ if (isDev29) {
36602
37292
  throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
36603
37293
  }
36604
37294
  continue;
@@ -36632,6 +37322,8 @@ var SSRContainer = class extends _SharedContainer2 {
36632
37322
  this.write(escapeHTML(chunk));
36633
37323
  } else if (typeof chunk === "number") {
36634
37324
  this.writeRootRef(chunk);
37325
+ } else if ("base" in chunk) {
37326
+ this.writeRootRefDelta(chunk.id, chunk.base);
36635
37327
  } else {
36636
37328
  this.writeRootRefPath(chunk.path);
36637
37329
  }
@@ -37265,7 +37957,8 @@ async function ssrRenderToDom(jsx2, opts = {}) {
37265
37957
  ];
37266
37958
  const renderOptions = {
37267
37959
  containerTagName: opts.containerTagName,
37268
- qwikLoader: opts.qwikLoader ? "inline" : "never"
37960
+ qwikLoader: opts.qwikLoader ? "inline" : "never",
37961
+ statePrewarm: opts.statePrewarm
37269
37962
  };
37270
37963
  if (opts.stream || opts.streaming) {
37271
37964
  const stream = {
@@ -37307,6 +38000,7 @@ async function ssrRenderToDom(jsx2, opts = {}) {
37307
38000
  if (!isStreaming) {
37308
38001
  emulateExecutionOfOutOfOrderScripts(document2);
37309
38002
  }
38003
+ await whenContainerDataReady(container, () => void 0);
37310
38004
  if (opts.debug) {
37311
38005
  console.log("========================================================");
37312
38006
  console.log("------------------------- SSR --------------------------");
@@ -37315,11 +38009,8 @@ async function ssrRenderToDom(jsx2, opts = {}) {
37315
38009
  console.log("--------------------------------------------------------");
37316
38010
  console.log(_vnode_toString.call(container.rootVNode, Number.MAX_SAFE_INTEGER, "", true));
37317
38011
  console.log("------------------- SERIALIZED STATE -------------------");
37318
- const origState = JSON.parse(
37319
- container.element.querySelector('script[type="qwik/state"]')?.textContent || "[]"
37320
- );
37321
- preprocessState2(origState, container);
37322
- console.log(origState ? _dumpState(origState, true, "", null) : "No state found", "\n");
38012
+ const debugState = getDebugSerializedState(container);
38013
+ console.log(debugState ? _dumpState(debugState, true, "", null) : "No state found", "\n");
37323
38014
  const funcs = container.$qFuncs$;
37324
38015
  console.log("------------------- SERIALIZED QFUNCS -------------------");
37325
38016
  for (let i2 = 0; i2 < funcs.length; i2++) {
@@ -37364,6 +38055,46 @@ async function ssrRenderToDom(jsx2, opts = {}) {
37364
38055
  }
37365
38056
  return { container, document: document2, vNode, getStyles };
37366
38057
  }
38058
+ function getDebugSerializedState(container) {
38059
+ const stateScriptSelector = `script[type="qwik/state"][q\\:instance="${container.$instanceHash$}"]`;
38060
+ const rootStateScript = container.element.querySelector(
38061
+ `${stateScriptSelector}:not(${QStatePatchAttrSelector})`
38062
+ );
38063
+ const patchStateScripts = container.element.querySelectorAll(
38064
+ `${stateScriptSelector}${QStatePatchAttrSelector}`
38065
+ );
38066
+ if (!rootStateScript && patchStateScripts.length === 0) {
38067
+ return null;
38068
+ }
38069
+ const state = JSON.parse(rootStateScript?.textContent || "[]");
38070
+ const patchForwardRefs = [];
38071
+ for (let i2 = 0; i2 < patchStateScripts.length; i2++) {
38072
+ const patchStateText = patchStateScripts[i2].textContent;
38073
+ if (!patchStateText) {
38074
+ continue;
38075
+ }
38076
+ const [rootStart, rawStateData, forwardRefs] = JSON.parse(patchStateText);
38077
+ for (let j = 0; j < rawStateData.length; j++) {
38078
+ state[rootStart * 2 + j] = rawStateData[j];
38079
+ }
38080
+ if (forwardRefs) {
38081
+ patchForwardRefs.push(forwardRefs);
38082
+ }
38083
+ }
38084
+ const debugContainer = { $forwardRefs$: null };
38085
+ preprocessState(state, debugContainer);
38086
+ for (let i2 = 0; i2 < patchForwardRefs.length; i2++) {
38087
+ const rootForwardRefs = debugContainer.$forwardRefs$ || (debugContainer.$forwardRefs$ = []);
38088
+ const forwardRefs = patchForwardRefs[i2];
38089
+ for (let j = 0; j < forwardRefs.length; j++) {
38090
+ const ref = forwardRefs[j];
38091
+ if (ref !== void 0) {
38092
+ rootForwardRefs.push(ref);
38093
+ }
38094
+ }
38095
+ }
38096
+ return state;
38097
+ }
37367
38098
  function isQwikScript(node) {
37368
38099
  const element = node.node;
37369
38100
  return _vnode_getElementName(node) === "script" && (_vnode_getProp(node, "type", null) === "qwik/state" || _vnode_getProp(node, "type", null) === ELEMENT_BACKPATCH_DATA || _vnode_getProp(node, "id", null) === "qwikloader" || element.getAttribute("type") === "qwik/state" || element.getAttribute("type") === ELEMENT_BACKPATCH_DATA || element.getAttribute("id") === "qwikloader" || element.innerHTML.includes("window._qwikEv"));
@@ -37450,6 +38181,7 @@ function renderStyles(getStyles) {
37450
38181
  }
37451
38182
  async function rerenderComponent(element) {
37452
38183
  const container = _getDomContainer2(element);
38184
+ await whenContainerDataReady(container, () => void 0);
37453
38185
  const vElement = container.vNodeLocate(element);
37454
38186
  const host = getHostVNode(vElement);
37455
38187
  markVNodeDirty(container, host, 4 /* COMPONENT */);