@qwik.dev/core 2.0.0-alpha.3 → 2.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/server 2.0.0-alpha.3-dev+418fd6d
3
+ * @qwik.dev/core/server 2.0.0-alpha.4-dev+374e0d6
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
@@ -56,7 +56,7 @@ __export(server_exports, {
56
56
  versions: () => versions
57
57
  });
58
58
  module.exports = __toCommonJS(server_exports);
59
- var import_core4 = require("@qwik.dev/core");
59
+ var import_core5 = require("@qwik.dev/core");
60
60
 
61
61
  // packages/qwik/src/server/platform.ts
62
62
  var import_core = require("@qwik.dev/core");
@@ -167,7 +167,7 @@ var logWarn = (message, ...optionalParams) => {
167
167
  };
168
168
  var createAndLogError = (asyncThrow, message, ...optionalParams) => {
169
169
  const err = message instanceof Error ? message : new Error(message);
170
- console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
170
+ !qTest && console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
171
171
  asyncThrow && !qTest && setTimeout(() => {
172
172
  throw err;
173
173
  }, 0);
@@ -180,24 +180,24 @@ var codeToText = (code, ...parts) => {
180
180
  const MAP = [
181
181
  "Error while serializing class or style attributes",
182
182
  // 0
183
- "Can not serialize a HTML Node that is not an Element",
184
- // 1
185
- "Runtime but no instance found on element.",
186
- // 2
187
- "Only primitive and object literals can be serialized",
183
+ "",
184
+ // 1 unused
185
+ "",
186
+ // 2 unused
187
+ "Only primitive and object literals can be serialized. {{0}}",
188
188
  // 3
189
- "Crash while rendering",
190
- // 4
189
+ "",
190
+ // 4 unused
191
191
  "You can render over a existing q:container. Skipping render().",
192
192
  // 5
193
- "Set property {{0}}",
194
- // 6
195
- "Only function's and 'string's are supported.",
196
- // 7
197
- "Only objects can be wrapped in 'QObject'",
198
- // 8
199
- `Only objects literals can be wrapped in 'QObject'`,
200
- // 9
193
+ "",
194
+ // 6 unused
195
+ "",
196
+ // 7 unused
197
+ "",
198
+ // 8 unused
199
+ "",
200
+ // 9 unused
201
201
  "QRL is not a function",
202
202
  // 10
203
203
  "Dynamic import not found",
@@ -208,43 +208,81 @@ var codeToText = (code, ...parts) => {
208
208
  // 13
209
209
  "Invoking 'use*()' method outside of invocation context.",
210
210
  // 14
211
- "Cant access renderCtx for existing context",
212
- // 15
213
- "Cant access document for existing context",
214
- // 16
215
- "props are immutable",
216
- // 17
217
- "<div> component can only be used at the root of a Qwik component$()",
218
- // 18
219
- "Props are immutable by default.",
220
- // 19
211
+ "",
212
+ // 15 unused
213
+ "",
214
+ // 16 unused
215
+ "",
216
+ // 17 unused
217
+ "",
218
+ // 18 unused
219
+ "",
220
+ // 19 unused
221
221
  `Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.
222
222
  See https://qwik.dev/docs/components/tasks/#use-method-rules`,
223
223
  // 20
224
- "Container is already paused. Skipping",
225
- // 21
226
224
  "",
227
- // 22 -- unused
228
- "When rendering directly on top of Document, the root node must be a <html>",
229
- // 23
230
- "A <html> node must have 2 children. The first one <head> and the second one a <body>",
231
- // 24
232
- 'Invalid JSXNode type "{{0}}". It must be either a function or a string. Found:',
233
- // 25
234
- "Tracking value changes can only be done to useStore() objects and component props",
235
- // 26
236
- "Missing Object ID for captured object",
237
- // 27
225
+ // 21 unused
226
+ "",
227
+ // 22 unused
228
+ "",
229
+ // 23 unused
230
+ "",
231
+ // 24 unused
232
+ "",
233
+ // 25 unused
234
+ "",
235
+ // 26 unused
236
+ "",
237
+ // 27 unused
238
238
  'The provided Context reference "{{0}}" is not a valid context created by createContextId()',
239
239
  // 28
240
- "<html> is the root container, it can not be rendered inside a component",
240
+ "SsrError(tag): {{0}}",
241
241
  // 29
242
242
  "QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.",
243
243
  // 30
244
244
  "QRLs can not be dynamically resolved, because it does not have a chunk path",
245
245
  // 31
246
- "The JSX ref attribute must be a Signal"
246
+ "The JSX ref attribute must be a Signal",
247
247
  // 32
248
+ "Serialization Error: Deserialization of data type {{0}} is not implemented",
249
+ // 33
250
+ "Serialization Error: Expected vnode for ref prop, but got {{0}}",
251
+ // 34
252
+ "Serialization Error: Cannot allocate data type {{0}}",
253
+ // 35
254
+ "Serialization Error: Missing root id for {{0}}",
255
+ // 36
256
+ "Serialization Error: Serialization of data type {{0}} is not implemented",
257
+ // 37
258
+ "Serialization Error: Unvisited {{0}}",
259
+ // 38
260
+ "Serialization Error: Missing QRL chunk for {{0}}",
261
+ // 39
262
+ "The value of the textarea must be a string",
263
+ // 40
264
+ "Unable to find q:container",
265
+ // 41
266
+ "Element must have 'q:container' attribute.",
267
+ // 42
268
+ "Unknown vnode type {{0}}.",
269
+ // 43
270
+ "Materialize error: missing element: {{0}} {{1}} {{2}}",
271
+ // 44
272
+ "SsrError: {{0}}",
273
+ // 45
274
+ "Cannot coerce a Signal, use `.value` instead",
275
+ // 46
276
+ "useComputedSignal$ QRL {{0}} {{1}} returned a Promise",
277
+ // 47
278
+ "ComputedSignal is read-only",
279
+ // 48
280
+ "WrappedSignal is read-only",
281
+ // 49
282
+ "SsrError: Promises not expected here.",
283
+ // 50
284
+ "Attribute value is unsafe for SSR"
285
+ // 51
248
286
  ];
249
287
  let text = MAP[code] ?? "";
250
288
  if (parts.length) {
@@ -256,19 +294,14 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
256
294
  return v;
257
295
  });
258
296
  }
259
- return `Code(${code}): ${text}`;
297
+ return `Code(Q${code}): ${text}`;
260
298
  } else {
261
- return `Code(${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
299
+ return `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
262
300
  }
263
301
  };
264
- var QError_stringifyClassOrStyle = 0;
265
- var QError_verifySerializable = 3;
266
- var QError_qrlIsNotFunction = 10;
267
- var QError_qrlMissingContainer = 30;
268
- var QError_qrlMissingChunk = 31;
269
- var qError = (code, ...parts) => {
270
- const text = codeToText(code, ...parts);
271
- return logErrorAndStop(text, ...parts);
302
+ var qError = (code, errorMessageArgs = []) => {
303
+ const text = codeToText(code, ...errorMessageArgs);
304
+ return logErrorAndStop(text, ...errorMessageArgs);
272
305
  };
273
306
 
274
307
  // packages/qwik/src/core/shared/utils/event-names.ts
@@ -447,7 +480,7 @@ var isUnitlessNumber = (name) => {
447
480
  };
448
481
 
449
482
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
450
- var import_build9 = require("@qwik.dev/core/build");
483
+ var import_build8 = require("@qwik.dev/core/build");
451
484
 
452
485
  // packages/qwik/src/core/shared/error/assert.ts
453
486
  var ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
@@ -507,10 +540,10 @@ var createPlatform2 = () => {
507
540
  }
508
541
  }
509
542
  if (!url) {
510
- throw qError(QError_qrlMissingChunk, symbolName);
543
+ throw qError(31 /* qrlMissingChunk */, [symbolName]);
511
544
  }
512
545
  if (!containerEl) {
513
- throw qError(QError_qrlMissingContainer, url, symbolName);
546
+ throw qError(30 /* qrlMissingContainer */, [url, symbolName]);
514
547
  }
515
548
  const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
516
549
  const urlCopy = new URL(urlDoc);
@@ -587,7 +620,7 @@ var maybeThenPassError = (valueOrPromise, thenFn) => {
587
620
  return isPromise(valueOrPromise) ? valueOrPromise.then(thenFn) : thenFn(valueOrPromise);
588
621
  };
589
622
  var shouldNotError = (reason) => {
590
- throwErrorAndStop("QWIK ERROR:", reason);
623
+ throwErrorAndStop(reason);
591
624
  };
592
625
  var delay = (timeout) => {
593
626
  return new Promise((resolve) => {
@@ -608,260 +641,6 @@ function retryOnPromise(fn, retryCount = 0) {
608
641
  // packages/qwik/src/build/index.dev.ts
609
642
  var isDev = true;
610
643
 
611
- // packages/qwik/src/server/ssr-node.ts
612
- var import_core2 = require("@qwik.dev/core");
613
- var import_build2 = require("@qwik.dev/core/build");
614
- var SsrNode = class {
615
- constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
616
- this.attrs = attrs;
617
- this.cleanupQueue = cleanupQueue;
618
- this.vnodeData = vnodeData;
619
- var _a;
620
- this.currentComponentNode = currentComponentNode;
621
- (_a = this.currentComponentNode) == null ? void 0 : _a.addChildVNodeData(this.vnodeData);
622
- this.nodeType = nodeType;
623
- this.id = id;
624
- if (import_build2.isDev && id.indexOf("undefined") != -1) {
625
- throw new Error(`Invalid SSR node id: ${id}`);
626
- }
627
- }
628
- __brand__;
629
- static ELEMENT_NODE = 1;
630
- static TEXT_NODE = 3;
631
- static DOCUMENT_NODE = 9;
632
- static DOCUMENT_FRAGMENT_NODE = 11;
633
- /** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
634
- nodeType;
635
- /**
636
- * ID which the deserialize will use to retrieve the node.
637
- *
638
- * @param refId - Unique id for the node.
639
- */
640
- id;
641
- /** Local props which don't serialize; */
642
- locals = null;
643
- currentComponentNode;
644
- childrenVNodeData = null;
645
- setProp(name, value) {
646
- if (this.attrs === import_core2._EMPTY_ARRAY) {
647
- this.attrs = [];
648
- }
649
- if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
650
- mapArray_set(this.locals || (this.locals = []), name, value, 0);
651
- } else {
652
- mapArray_set(this.attrs, name, value, 0);
653
- }
654
- if (name == ELEMENT_SEQ && value) {
655
- this.cleanupQueue.push(value);
656
- }
657
- }
658
- getProp(name) {
659
- if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
660
- return this.locals ? mapArray_get(this.locals, name, 0) : null;
661
- } else {
662
- return mapArray_get(this.attrs, name, 0);
663
- }
664
- }
665
- removeProp(name) {
666
- if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
667
- if (this.locals) {
668
- mapApp_remove(this.locals, name, 0);
669
- }
670
- } else {
671
- mapApp_remove(this.attrs, name, 0);
672
- }
673
- }
674
- addChildVNodeData(child) {
675
- if (!this.childrenVNodeData) {
676
- this.childrenVNodeData = [];
677
- }
678
- this.childrenVNodeData.push(child);
679
- }
680
- toString() {
681
- let stringifiedAttrs = "";
682
- for (let i = 0; i < this.attrs.length; i += 2) {
683
- const key = this.attrs[i];
684
- const value = this.attrs[i + 1];
685
- stringifiedAttrs += `${key}=`;
686
- stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
687
- if (i < this.attrs.length - 2) {
688
- stringifiedAttrs += ", ";
689
- }
690
- }
691
- return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
692
- }
693
- };
694
- var DomRef = class {
695
- constructor($ssrNode$) {
696
- this.$ssrNode$ = $ssrNode$;
697
- }
698
- };
699
- var SsrComponentFrame = class {
700
- constructor(componentNode) {
701
- this.componentNode = componentNode;
702
- }
703
- slots = [];
704
- projectionDepth = 0;
705
- scopedStyleIds = /* @__PURE__ */ new Set();
706
- projectionScopedStyle = null;
707
- projectionComponentFrame = null;
708
- distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
709
- this.projectionScopedStyle = projectionScopedStyle;
710
- this.projectionComponentFrame = projectionComponentFrame;
711
- if ((0, import_core2._isJSXNode)(children)) {
712
- const slotName = this.getSlotName(children);
713
- mapArray_set(this.slots, slotName, children, 0);
714
- } else if (Array.isArray(children)) {
715
- const defaultSlot = [];
716
- for (let i = 0; i < children.length; i++) {
717
- const child = children[i];
718
- if ((0, import_core2._isJSXNode)(child)) {
719
- const slotName = this.getSlotName(child);
720
- if (slotName === QDefaultSlot) {
721
- defaultSlot.push(child);
722
- } else {
723
- this.updateSlot(slotName, child);
724
- }
725
- } else {
726
- defaultSlot.push(child);
727
- }
728
- }
729
- defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
730
- } else {
731
- mapArray_set(this.slots, QDefaultSlot, children, 0);
732
- }
733
- }
734
- updateSlot(slotName, child) {
735
- let existingSlots = mapArray_get(this.slots, slotName, 0);
736
- if (existingSlots === null) {
737
- existingSlots = child;
738
- } else if (Array.isArray(existingSlots)) {
739
- existingSlots.push(child);
740
- } else {
741
- existingSlots = [existingSlots, child];
742
- }
743
- mapArray_set(this.slots, slotName, existingSlots, 0);
744
- }
745
- getSlotName(jsx2) {
746
- if (jsx2.props[QSlot]) {
747
- return jsx2.props[QSlot];
748
- }
749
- return QDefaultSlot;
750
- }
751
- hasSlot(slotName) {
752
- return mapArray_get(this.slots, slotName, 0) !== null;
753
- }
754
- consumeChildrenForSlot(projectionNode, slotName) {
755
- const children = mapApp_remove(this.slots, slotName, 0);
756
- if (children !== null) {
757
- this.componentNode.setProp(slotName, projectionNode.id);
758
- projectionNode.setProp(QSlotParent, this.componentNode.id);
759
- }
760
- return children;
761
- }
762
- releaseUnclaimedProjections(unclaimedProjections) {
763
- if (this.slots.length) {
764
- unclaimedProjections.push(this);
765
- unclaimedProjections.push(this.projectionScopedStyle);
766
- unclaimedProjections.push.apply(unclaimedProjections, this.slots);
767
- }
768
- }
769
- };
770
-
771
- // packages/qwik/src/server/vnode-data.ts
772
- var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
773
- var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
774
- var EMPTY_ARRAY = [];
775
- function vNodeData_incrementElementCount(vNodeData) {
776
- const length = vNodeData.length;
777
- const lastValue = length > 1 ? vNodeData[length - 1] : 0;
778
- if (lastValue >= 0) {
779
- vNodeData.push(-1);
780
- } else {
781
- vNodeData[length - 1] = lastValue - 1;
782
- }
783
- }
784
- function vNodeData_addTextSize(vNodeData, size) {
785
- const length = vNodeData.length;
786
- const lastValue = length > 1 ? vNodeData[length - 1] : 0;
787
- if (length > 1 && lastValue >= 0) {
788
- vNodeData[0] |= 1 /* TEXT_DATA */;
789
- }
790
- vNodeData.push(size);
791
- if (size == 0) {
792
- vNodeData[0] |= 1 /* TEXT_DATA */;
793
- }
794
- }
795
- function vNodeData_openFragment(vNodeData, attrs) {
796
- vNodeData.push(attrs, OPEN_FRAGMENT);
797
- vNodeData[0] |= 2 /* VIRTUAL_NODE */;
798
- }
799
- function vNodeData_closeFragment(vNodeData) {
800
- vNodeData.push(CLOSE_FRAGMENT);
801
- }
802
- function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
803
- vNodeData[0] |= 4 /* REFERENCE */;
804
- if (vNodeData.length == 1) {
805
- return new SsrNode(
806
- currentComponentNode,
807
- SsrNode.ELEMENT_NODE,
808
- String(depthFirstElementIdx),
809
- EMPTY_ARRAY,
810
- cleanupQueue,
811
- vNodeData
812
- );
813
- } else {
814
- let fragmentAttrs = EMPTY_ARRAY;
815
- const stack2 = [SsrNode.ELEMENT_NODE, -1];
816
- for (let i = 1; i < vNodeData.length; i++) {
817
- const value = vNodeData[i];
818
- if (Array.isArray(value)) {
819
- fragmentAttrs = value;
820
- i++;
821
- stack2[stack2.length - 1]++;
822
- stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
823
- } else if (value === CLOSE_FRAGMENT) {
824
- stack2.pop();
825
- stack2.pop();
826
- fragmentAttrs = EMPTY_ARRAY;
827
- } else if (value < 0) {
828
- const numberOfElements = 0 - value;
829
- stack2[stack2.length - 1] += numberOfElements;
830
- } else {
831
- stack2[stack2.length - 1]++;
832
- }
833
- }
834
- let refId = String(depthFirstElementIdx);
835
- for (let i = 1; i < stack2.length; i += 2) {
836
- const childCount = stack2[i];
837
- if (childCount >= 0) {
838
- refId += encodeAsAlphanumeric(childCount);
839
- }
840
- }
841
- const type = stack2[stack2.length - 2];
842
- return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
843
- }
844
- }
845
- var ALPHANUMERIC = [];
846
- function encodeAsAlphanumeric(value) {
847
- while (ALPHANUMERIC.length <= value) {
848
- let value2 = ALPHANUMERIC.length;
849
- let text = "";
850
- do {
851
- text = String.fromCharCode(
852
- (text.length === 0 ? 65 : 97) + value2 % 26
853
- /* A-Z */
854
- ) + text;
855
- value2 = Math.floor(
856
- value2 / 26
857
- /* A-Z */
858
- );
859
- } while (value2 !== 0);
860
- ALPHANUMERIC.push(text);
861
- }
862
- return ALPHANUMERIC[value];
863
- }
864
-
865
644
  // packages/qwik/src/core/shared/types.ts
866
645
  var DEBUG_TYPE = "q:type";
867
646
  var START = "\x1B[34m";
@@ -949,6 +728,7 @@ var ELEMENT_KEY = "q:key";
949
728
  var ELEMENT_PROPS = "q:props";
950
729
  var ELEMENT_SEQ = "q:seq";
951
730
  var ELEMENT_SEQ_IDX = "q:seqIdx";
731
+ var Q_PREFIX = "q:";
952
732
  var NON_SERIALIZABLE_MARKER_PREFIX = ":";
953
733
  var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
954
734
  var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
@@ -966,7 +746,7 @@ function setLocale(locale) {
966
746
  }
967
747
 
968
748
  // packages/qwik/src/core/client/vnode.ts
969
- var import_build7 = require("@qwik.dev/core/build");
749
+ var import_build6 = require("@qwik.dev/core/build");
970
750
 
971
751
  // packages/qwik/src/server/utils.ts
972
752
  var import_meta = {};
@@ -995,12 +775,12 @@ function getBuildBase(opts) {
995
775
  return `${import_meta.env.BASE_URL}build/`;
996
776
  }
997
777
  var versions = {
998
- qwik: "2.0.0-alpha.3-dev+418fd6d",
778
+ qwik: "2.0.0-alpha.4-dev+374e0d6",
999
779
  qwikDom: "2.1.19"
1000
780
  };
1001
781
 
1002
782
  // packages/qwik/src/server/prefetch-strategy.ts
1003
- var import_build3 = require("@qwik.dev/core/build");
783
+ var import_build2 = require("@qwik.dev/core/build");
1004
784
  function getPrefetchResources(qrls, opts, resolvedManifest) {
1005
785
  if (!resolvedManifest) {
1006
786
  return [];
@@ -1038,7 +818,7 @@ function getAutoPrefetch(qrls, resolvedManifest, buildBase) {
1038
818
  return prefetchResources;
1039
819
  }
1040
820
  function addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName) {
1041
- const url = import_build3.isDev ? bundleFileName : buildBase + bundleFileName;
821
+ const url = import_build2.isDev ? bundleFileName : buildBase + bundleFileName;
1042
822
  let prefetchResource = urls.get(url);
1043
823
  if (!prefetchResource) {
1044
824
  prefetchResource = {
@@ -1062,13 +842,13 @@ var isQrl = (value) => {
1062
842
  };
1063
843
 
1064
844
  // packages/qwik/src/core/shared/utils/flyweight.ts
1065
- var EMPTY_ARRAY2 = [];
845
+ var EMPTY_ARRAY = [];
1066
846
  var EMPTY_OBJ = {};
1067
- Object.freeze(EMPTY_ARRAY2);
847
+ Object.freeze(EMPTY_ARRAY);
1068
848
  Object.freeze(EMPTY_OBJ);
1069
849
 
1070
850
  // packages/qwik/src/core/ssr/ssr-render-jsx.ts
1071
- var import_build6 = require("@qwik.dev/core/build");
851
+ var import_build5 = require("@qwik.dev/core/build");
1072
852
 
1073
853
  // packages/qwik/src/core/shared/jsx/slot.public.ts
1074
854
  var Slot = (props) => {
@@ -1256,8 +1036,11 @@ var Subscriber = class {
1256
1036
  function isSubscriber(value) {
1257
1037
  return value instanceof Subscriber || value instanceof WrappedSignal;
1258
1038
  }
1259
- function clearVNodeEffectDependencies(value) {
1260
- const effects = vnode_getProp(value, QSubscribers, null);
1039
+ function clearVNodeEffectDependencies(container, value) {
1040
+ if (vnode_isElementVNode(value)) {
1041
+ ensureMaterialized(value);
1042
+ }
1043
+ const effects = vnode_getProp(value, QSubscribers, container.$getObjectById$);
1261
1044
  if (!effects) {
1262
1045
  return;
1263
1046
  }
@@ -1285,15 +1068,24 @@ function clearEffects(subscriber, value) {
1285
1068
  return false;
1286
1069
  }
1287
1070
  const effectSubscriptions = subscriber.$effects$;
1288
- if (!effectSubscriptions) {
1289
- return false;
1071
+ const hostElement = subscriber.$hostElement$;
1072
+ if (hostElement && hostElement === value) {
1073
+ subscriber.$hostElement$ = null;
1290
1074
  }
1291
1075
  let subscriptionRemoved = false;
1292
- for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
1293
- const effect = effectSubscriptions[i];
1294
- if (effect[0 /* EFFECT */] === value) {
1295
- effectSubscriptions.splice(i, 1);
1296
- subscriptionRemoved = true;
1076
+ if (effectSubscriptions) {
1077
+ for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
1078
+ const effect = effectSubscriptions[i];
1079
+ if (effect[0 /* EFFECT */] === value) {
1080
+ effectSubscriptions.splice(i, 1);
1081
+ subscriptionRemoved = true;
1082
+ }
1083
+ }
1084
+ }
1085
+ const args = subscriber.$args$;
1086
+ if (args) {
1087
+ for (let i = args.length - 1; i >= 0; i--) {
1088
+ clearEffects(args[i], subscriber);
1297
1089
  }
1298
1090
  }
1299
1091
  return subscriptionRemoved;
@@ -1447,7 +1239,7 @@ var ignoreErrorToPreventNodeFromCrashing = (err) => {
1447
1239
  };
1448
1240
 
1449
1241
  // packages/qwik/src/core/client/vnode-diff.ts
1450
- var import_build5 = require("@qwik.dev/core/build");
1242
+ var import_build4 = require("@qwik.dev/core/build");
1451
1243
 
1452
1244
  // packages/qwik/src/core/client/vnode-namespace.ts
1453
1245
  var isForeignObjectElement = (elementName) => elementName.toLowerCase() === "foreignobject";
@@ -1619,7 +1411,7 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
1619
1411
  }
1620
1412
 
1621
1413
  // packages/qwik/src/core/shared/component-execution.ts
1622
- var import_build4 = require("@qwik.dev/core/build");
1414
+ var import_build3 = require("@qwik.dev/core/build");
1623
1415
  var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
1624
1416
  const iCtx = newInvokeContext(container.$locale$, subscriptionHost, void 0, RenderEvent);
1625
1417
  iCtx.$effectSubscriber$ = [subscriptionHost, ":" /* COMPONENT */];
@@ -1655,7 +1447,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
1655
1447
  }
1656
1448
  }
1657
1449
  if (vnode_isVNode(renderHost)) {
1658
- clearVNodeEffectDependencies(renderHost);
1450
+ clearVNodeEffectDependencies(container, renderHost);
1659
1451
  }
1660
1452
  return componentFn(props);
1661
1453
  },
@@ -1698,7 +1490,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
1698
1490
  if (jsxElement2) {
1699
1491
  addUseOnEvent(jsxElement2, key, useOnEvents[key]);
1700
1492
  }
1701
- } else if (import_build4.isDev) {
1493
+ } else if (import_build3.isDev) {
1702
1494
  logWarn(
1703
1495
  '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 has a valid element node. '
1704
1496
  );
@@ -1729,7 +1521,7 @@ function findFirstStringJSX(jsx2) {
1729
1521
  const queue = [jsx2];
1730
1522
  while (queue.length) {
1731
1523
  const jsx3 = queue.shift();
1732
- if (isJSXNode2(jsx3)) {
1524
+ if (isJSXNode(jsx3)) {
1733
1525
  if (typeof jsx3.type === "string") {
1734
1526
  return jsx3;
1735
1527
  }
@@ -1748,7 +1540,7 @@ function findFirstStringJSX(jsx2) {
1748
1540
  return null;
1749
1541
  }
1750
1542
  function addScriptNodeForInvisibleComponents(jsx2) {
1751
- if (isJSXNode2(jsx2)) {
1543
+ if (isJSXNode(jsx2)) {
1752
1544
  const jsxElement = new JSXNodeImpl(
1753
1545
  "script",
1754
1546
  {},
@@ -1847,12 +1639,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1847
1639
  descend(jsxValue, false);
1848
1640
  } else if (isSignal(jsxValue)) {
1849
1641
  if (vCurrent) {
1850
- clearVNodeEffectDependencies(vCurrent);
1642
+ clearVNodeEffectDependencies(container, vCurrent);
1851
1643
  }
1852
1644
  expectVirtual("S" /* WrappedSignal */, null);
1853
1645
  descend(
1854
- trackSignal(
1855
- () => jsxValue.value,
1646
+ trackSignalAndAssignHost(
1647
+ jsxValue,
1856
1648
  vNewNode || vCurrent,
1857
1649
  "." /* VNODE */,
1858
1650
  container
@@ -1862,7 +1654,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1862
1654
  } else if (isPromise(jsxValue)) {
1863
1655
  expectVirtual("A" /* Awaited */, null);
1864
1656
  asyncQueue.push(jsxValue, vNewNode || vCurrent);
1865
- } else if (isJSXNode2(jsxValue)) {
1657
+ } else if (isJSXNode(jsxValue)) {
1866
1658
  const type = jsxValue.type;
1867
1659
  if (typeof type === "string") {
1868
1660
  expectNoMoreTextNodes();
@@ -2019,7 +1811,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2019
1811
  for (let i = 0; i < projectionChildren.length; i++) {
2020
1812
  const child = projectionChildren[i];
2021
1813
  const slotName = String(
2022
- isJSXNode2(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
1814
+ isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
2023
1815
  );
2024
1816
  const idx = mapApp_findIndx(projections, slotName, 0);
2025
1817
  let jsxBucket;
@@ -2049,8 +1841,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2049
1841
  );
2050
1842
  if (vCurrent == null) {
2051
1843
  vNewNode = vnode_newVirtual();
2052
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
2053
- import_build5.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection");
1844
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
1845
+ import_build4.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection");
2054
1846
  vnode_setProp(vNewNode, QSlot, slotName);
2055
1847
  vnode_setProp(vNewNode, QSlotParent, vParent);
2056
1848
  vnode_setProp(vParent, slotName, vNewNode);
@@ -2076,8 +1868,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2076
1868
  );
2077
1869
  vnode_setProp(vNewNode, QSlot, slotNameKey);
2078
1870
  vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
2079
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
2080
- import_build5.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
1871
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
1872
+ import_build4.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
2081
1873
  return false;
2082
1874
  } else if (vProjectedNode === vCurrent) {
2083
1875
  } else {
@@ -2089,8 +1881,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2089
1881
  );
2090
1882
  vnode_setProp(vNewNode, QSlot, slotNameKey);
2091
1883
  vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
2092
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
2093
- import_build5.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
1884
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
1885
+ import_build4.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
2094
1886
  }
2095
1887
  return true;
2096
1888
  }
@@ -2100,7 +1892,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2100
1892
  if (constProps && typeof constProps == "object" && "name" in constProps) {
2101
1893
  const constValue = constProps.name;
2102
1894
  if (vHost && constValue instanceof WrappedSignal) {
2103
- return trackSignal(() => constValue.value, vHost, ":" /* COMPONENT */, container);
1895
+ return trackSignalAndAssignHost(constValue, vHost, ":" /* COMPONENT */, container);
2104
1896
  }
2105
1897
  }
2106
1898
  return directGetPropsProxyProp(jsxNode2, "name") || QDefaultSlot;
@@ -2182,12 +1974,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2182
1974
  }
2183
1975
  }
2184
1976
  if (isSignal(value)) {
2185
- const signalData = new EffectData({
1977
+ const signalData = new EffectPropData({
2186
1978
  $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2187
1979
  $isConst$: true
2188
1980
  });
2189
- value = trackSignal(
2190
- () => value.value,
1981
+ value = trackSignalAndAssignHost(
1982
+ value,
2191
1983
  vNewNode,
2192
1984
  key2,
2193
1985
  container,
@@ -2201,8 +1993,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2201
1993
  }
2202
1994
  if (elementName === "textarea" && key2 === "value") {
2203
1995
  if (typeof value !== "string") {
2204
- if (import_build5.isDev) {
2205
- throwErrorAndStop("The value of the textarea must be a string");
1996
+ if (import_build4.isDev) {
1997
+ throw qError(40 /* wrongTextareaValue */);
2206
1998
  }
2207
1999
  continue;
2208
2000
  }
@@ -2334,7 +2126,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2334
2126
  }
2335
2127
  };
2336
2128
  while (srcKey !== null || dstKey !== null) {
2337
- if ((dstKey == null ? void 0 : dstKey.startsWith(HANDLER_PREFIX)) || dstKey == ELEMENT_KEY) {
2129
+ if ((dstKey == null ? void 0 : dstKey.startsWith(HANDLER_PREFIX)) || (dstKey == null ? void 0 : dstKey.startsWith(Q_PREFIX))) {
2338
2130
  dstIdx++;
2339
2131
  dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
2340
2132
  } else if (srcKey == null) {
@@ -2445,7 +2237,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2445
2237
  vCurrent && getInsertBefore()
2446
2238
  );
2447
2239
  vnode_setProp(vNewNode, ELEMENT_KEY, jsxKey);
2448
- import_build5.isDev && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type);
2240
+ import_build4.isDev && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type);
2449
2241
  }
2450
2242
  function expectComponent(component) {
2451
2243
  const componentMeta = component[SERIALIZABLE_STATE];
@@ -2520,7 +2312,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2520
2312
  }
2521
2313
  function insertNewComponent(host, componentQRL, jsxProps) {
2522
2314
  if (host) {
2523
- clearVNodeEffectDependencies(host);
2315
+ clearVNodeEffectDependencies(container, host);
2524
2316
  }
2525
2317
  vnode_insertBefore(
2526
2318
  journal,
@@ -2529,7 +2321,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2529
2321
  vCurrent && getInsertBefore()
2530
2322
  );
2531
2323
  const jsxNode2 = jsxValue;
2532
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "C" /* Component */);
2324
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "C" /* Component */);
2533
2325
  container.setHostProp(vNewNode, OnRenderProp, componentQRL);
2534
2326
  container.setHostProp(vNewNode, ELEMENT_PROPS, jsxProps);
2535
2327
  container.setHostProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
@@ -2542,7 +2334,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2542
2334
  vCurrent && getInsertBefore()
2543
2335
  );
2544
2336
  const jsxNode2 = jsxValue;
2545
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
2337
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
2546
2338
  vnode_setProp(vNewNode, ELEMENT_PROPS, jsxNode2.props);
2547
2339
  if (jsxNode2.key) {
2548
2340
  vnode_setProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
@@ -2586,8 +2378,8 @@ function propsDiffer(src, dst) {
2586
2378
  if (!src || !dst) {
2587
2379
  return true;
2588
2380
  }
2589
- let srcKeys = removeChildrenKey(Object.keys(src));
2590
- let dstKeys = removeChildrenKey(Object.keys(dst));
2381
+ let srcKeys = removePropsKeys(Object.keys(src), ["children", QSubscribers]);
2382
+ let dstKeys = removePropsKeys(Object.keys(dst), ["children", QSubscribers]);
2591
2383
  if (srcKeys.length !== dstKeys.length) {
2592
2384
  return true;
2593
2385
  }
@@ -2602,10 +2394,13 @@ function propsDiffer(src, dst) {
2602
2394
  }
2603
2395
  return false;
2604
2396
  }
2605
- function removeChildrenKey(keys) {
2606
- const childrenIdx = keys.indexOf("children");
2607
- if (childrenIdx !== -1) {
2608
- keys.splice(childrenIdx, 1);
2397
+ function removePropsKeys(keys, propKeys) {
2398
+ for (let i = propKeys.length - 1; i >= 0; i--) {
2399
+ const propKey = propKeys[i];
2400
+ const propIdx = keys.indexOf(propKey);
2401
+ if (propIdx !== -1) {
2402
+ keys.splice(propIdx, 1);
2403
+ }
2609
2404
  }
2610
2405
  return keys;
2611
2406
  }
@@ -2618,9 +2413,9 @@ function cleanup(container, vNode) {
2618
2413
  do {
2619
2414
  const type = vCursor[0 /* flags */];
2620
2415
  if (type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) {
2416
+ clearVNodeEffectDependencies(container, vCursor);
2417
+ markVNodeAsDeleted(vCursor);
2621
2418
  if (type & 2 /* Virtual */) {
2622
- clearVNodeEffectDependencies(vCursor);
2623
- markVNodeAsDeleted(vCursor);
2624
2419
  const seq = container.getHostProp(vCursor, ELEMENT_SEQ);
2625
2420
  if (seq) {
2626
2421
  for (let i = 0; i < seq.length; i++) {
@@ -2629,7 +2424,7 @@ function cleanup(container, vNode) {
2629
2424
  const task = obj;
2630
2425
  clearSubscriberEffectDependencies(task);
2631
2426
  if (task.$flags$ & 1 /* VISIBLE_TASK */) {
2632
- container.$scheduler$(80 /* CLEANUP_VISIBLE */, task);
2427
+ container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
2633
2428
  } else {
2634
2429
  cleanupTask(task);
2635
2430
  }
@@ -2720,8 +2515,8 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2720
2515
  let journalFlushScheduled = false;
2721
2516
  return schedule;
2722
2517
  function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
2723
- const runLater = type !== 127 /* WAIT_FOR_ALL */ && type !== 16 /* WAIT_FOR_COMPONENTS */ && type !== 6 /* COMPONENT_SSR */;
2724
- const isTask2 = type === 3 /* TASK */ || type === 64 /* VISIBLE */ || type === 2 /* RESOURCE */ || type === 80 /* CLEANUP_VISIBLE */;
2518
+ const runLater = type !== 255 /* WAIT_FOR_ALL */ && type !== 6 /* COMPONENT_SSR */;
2519
+ const isTask2 = type === 3 /* TASK */ || type === 32 /* VISIBLE */ || type === 2 /* RESOURCE */ || type === 48 /* CLEANUP_VISIBLE */;
2725
2520
  if (isTask2) {
2726
2521
  hostOrTask.$flags$ |= 8 /* DIRTY */;
2727
2522
  }
@@ -2741,7 +2536,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2741
2536
  chore = sortedInsert(choreQueue, chore);
2742
2537
  if (!journalFlushScheduled && runLater) {
2743
2538
  journalFlushScheduled = true;
2744
- schedule(48 /* JOURNAL_FLUSH */);
2539
+ schedule(16 /* JOURNAL_FLUSH */);
2745
2540
  scheduleDrain();
2746
2541
  }
2747
2542
  if (runLater) {
@@ -2768,7 +2563,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2768
2563
  }
2769
2564
  const isDeletedVNode = vNodeAlreadyDeleted(nextChore);
2770
2565
  if (isDeletedVNode && // we need to process cleanup tasks for deleted nodes
2771
- nextChore.$type$ !== 80 /* CLEANUP_VISIBLE */) {
2566
+ nextChore.$type$ !== 48 /* CLEANUP_VISIBLE */) {
2772
2567
  DEBUG2 && debugTrace("skip chore", nextChore, currentChore, choreQueue);
2773
2568
  continue;
2774
2569
  }
@@ -2781,13 +2576,14 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2781
2576
  return runUptoChore.$returnValue$;
2782
2577
  }
2783
2578
  function executeChore(chore) {
2579
+ var _a;
2784
2580
  const host = chore.$host$;
2785
2581
  DEBUG2 && debugTrace("execute", chore, currentChore, choreQueue);
2786
2582
  assertEqual(currentChore, null, "Chore already running.");
2787
2583
  currentChore = chore;
2788
2584
  let returnValue = null;
2789
2585
  switch (chore.$type$) {
2790
- case 48 /* JOURNAL_FLUSH */:
2586
+ case 16 /* JOURNAL_FLUSH */:
2791
2587
  returnValue = journalFlush();
2792
2588
  journalFlushScheduled = false;
2793
2589
  break;
@@ -2824,10 +2620,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2824
2620
  case 3 /* TASK */:
2825
2621
  returnValue = runTask(chore.$payload$, container, host);
2826
2622
  break;
2827
- case 64 /* VISIBLE */:
2623
+ case 32 /* VISIBLE */:
2828
2624
  returnValue = runTask(chore.$payload$, container, host);
2829
2625
  break;
2830
- case 80 /* CLEANUP_VISIBLE */:
2626
+ case 48 /* CLEANUP_VISIBLE */:
2831
2627
  const task = chore.$payload$;
2832
2628
  cleanupTask(task);
2833
2629
  break;
@@ -2862,13 +2658,27 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2862
2658
  returnValue = !target.resolved ? target.resolve() : null;
2863
2659
  break;
2864
2660
  }
2661
+ case 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */: {
2662
+ const target = chore.$target$;
2663
+ const forceRunEffects = target.$forceRunEffects$;
2664
+ target.$forceRunEffects$ = false;
2665
+ if (!((_a = target.$effects$) == null ? void 0 : _a.length)) {
2666
+ break;
2667
+ }
2668
+ returnValue = retryOnPromise(() => {
2669
+ if (target.$computeIfNeeded$() || forceRunEffects) {
2670
+ triggerEffects(container, target, target.$effects$);
2671
+ }
2672
+ });
2673
+ break;
2674
+ }
2865
2675
  }
2866
2676
  return maybeThenPassError(returnValue, (value) => {
2867
- var _a;
2677
+ var _a2;
2868
2678
  DEBUG2 && debugTrace("execute.DONE", null, currentChore, choreQueue);
2869
2679
  if (currentChore) {
2870
2680
  currentChore.$executed$ = true;
2871
- (_a = currentChore.$resolve$) == null ? void 0 : _a.call(currentChore, value);
2681
+ (_a2 = currentChore.$resolve$) == null ? void 0 : _a2.call(currentChore, value);
2872
2682
  }
2873
2683
  currentChore = null;
2874
2684
  return chore.$returnValue$ = value;
@@ -2887,11 +2697,11 @@ function vNodeAlreadyDeleted(chore) {
2887
2697
  return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
2888
2698
  }
2889
2699
  function choreComparator(a, b, shouldThrowOnHostMismatch) {
2890
- const macroTypeDiff = (a.$type$ & 112 /* MACRO */) - (b.$type$ & 112 /* MACRO */);
2700
+ const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
2891
2701
  if (macroTypeDiff !== 0) {
2892
2702
  return macroTypeDiff;
2893
2703
  }
2894
- if (a.$type$ !== 48 /* JOURNAL_FLUSH */) {
2704
+ if (a.$type$ !== 16 /* JOURNAL_FLUSH */) {
2895
2705
  const aHost = a.$host$;
2896
2706
  const bHost = b.$host$;
2897
2707
  if (aHost !== bHost && aHost !== null && bHost !== null) {
@@ -2906,7 +2716,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
2906
2716
  This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
2907
2717
  Problematic Node: ${aHost.toString()}`;
2908
2718
  if (shouldThrowOnHostMismatch) {
2909
- throwErrorAndStop(errorMessage);
2719
+ throw qError(45 /* serverHostMismatch */, [errorMessage]);
2910
2720
  }
2911
2721
  logWarn(errorMessage);
2912
2722
  return null;
@@ -2920,7 +2730,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
2920
2730
  if (idxDiff !== 0) {
2921
2731
  return idxDiff;
2922
2732
  }
2923
- if (a.$target$ !== b.$target$ && (a.$type$ === 1 /* QRL_RESOLVE */ && b.$type$ === 1 /* QRL_RESOLVE */ || a.$type$ === 5 /* NODE_PROP */ && b.$type$ === 5 /* NODE_PROP */)) {
2733
+ if (a.$target$ !== b.$target$ && (a.$type$ === 1 /* QRL_RESOLVE */ && b.$type$ === 1 /* QRL_RESOLVE */ || a.$type$ === 5 /* NODE_PROP */ && b.$type$ === 5 /* NODE_PROP */ || a.$type$ === 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */ && b.$type$ === 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */)) {
2924
2734
  return 1;
2925
2735
  }
2926
2736
  }
@@ -2963,11 +2773,11 @@ function debugChoreToString(chore) {
2963
2773
  [5 /* NODE_PROP */]: "NODE_PROP",
2964
2774
  [7 /* COMPONENT */]: "COMPONENT",
2965
2775
  [6 /* COMPONENT_SSR */]: "COMPONENT_SSR",
2966
- [48 /* JOURNAL_FLUSH */]: "JOURNAL_FLUSH",
2967
- [64 /* VISIBLE */]: "VISIBLE",
2968
- [80 /* CLEANUP_VISIBLE */]: "CLEANUP_VISIBLE",
2969
- [127 /* WAIT_FOR_ALL */]: "WAIT_FOR_ALL",
2970
- [16 /* WAIT_FOR_COMPONENTS */]: "WAIT_FOR_COMPONENTS"
2776
+ [8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */]: "RECOMPUTE_SIGNAL",
2777
+ [16 /* JOURNAL_FLUSH */]: "JOURNAL_FLUSH",
2778
+ [32 /* VISIBLE */]: "VISIBLE",
2779
+ [48 /* CLEANUP_VISIBLE */]: "CLEANUP_VISIBLE",
2780
+ [255 /* WAIT_FOR_ALL */]: "WAIT_FOR_ALL"
2971
2781
  }[chore.$type$] || "UNKNOWN: " + chore.$type$;
2972
2782
  const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
2973
2783
  const qrlTarget = (_a = chore.$target$) == null ? void 0 : _a.$symbol$;
@@ -3090,7 +2900,7 @@ var throwIfQRLNotResolved = (qrl) => {
3090
2900
  var isSignal = (value) => {
3091
2901
  return value instanceof Signal;
3092
2902
  };
3093
- var EffectData = class {
2903
+ var EffectPropData = class {
3094
2904
  data;
3095
2905
  constructor(data) {
3096
2906
  this.data = data;
@@ -3154,7 +2964,7 @@ var Signal = class {
3154
2964
  // prevent accidental use as value
3155
2965
  valueOf() {
3156
2966
  if (qDev) {
3157
- return throwErrorAndStop("Cannot coerce a Signal, use `.value` instead");
2967
+ throw qError(46 /* cannotCoerceSignal */);
3158
2968
  }
3159
2969
  }
3160
2970
  toString() {
@@ -3187,7 +2997,7 @@ var ensureEffectContainsSubscriber = (effect, subscriber, container) => {
3187
2997
  return;
3188
2998
  }
3189
2999
  effect.$effectDependencies$.push(subscriber);
3190
- } else if (vnode_isVNode(effect) && vnode_isVirtualVNode(effect)) {
3000
+ } else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
3191
3001
  let subscribers = vnode_getProp(
3192
3002
  effect,
3193
3003
  QSubscribers,
@@ -3231,7 +3041,7 @@ var triggerEffects = (container, signal, effects) => {
3231
3041
  DEBUG3 && log2("schedule.effect.task", pad("\n" + String(effect), " "));
3232
3042
  let choreType = 3 /* TASK */;
3233
3043
  if (effect.$flags$ & 1 /* VISIBLE_TASK */) {
3234
- choreType = 64 /* VISIBLE */;
3044
+ choreType = 32 /* VISIBLE */;
3235
3045
  } else if (effect.$flags$ & 4 /* RESOURCE */) {
3236
3046
  choreType = 2 /* RESOURCE */;
3237
3047
  }
@@ -3242,13 +3052,7 @@ var triggerEffects = (container, signal, effects) => {
3242
3052
  container.$scheduler$(1 /* QRL_RESOLVE */, null, effect.$computeQrl$);
3243
3053
  }
3244
3054
  }
3245
- try {
3246
- retryOnPromise(
3247
- () => effect.$invalidate$()
3248
- );
3249
- } catch (e) {
3250
- logError(e);
3251
- }
3055
+ effect.$invalidate$();
3252
3056
  } else if (property === ":" /* COMPONENT */) {
3253
3057
  const host = effect;
3254
3058
  const qrl = container.getHostProp(host, OnRenderProp);
@@ -3261,9 +3065,8 @@ var triggerEffects = (container, signal, effects) => {
3261
3065
  container.$scheduler$(4 /* NODE_DIFF */, host, target, signal);
3262
3066
  } else {
3263
3067
  const host = effect;
3264
- let effectData = effectSubscriptions[2 /* FIRST_BACK_REF_OR_DATA */];
3265
- if (effectData instanceof EffectData) {
3266
- effectData = effectData;
3068
+ const effectData = effectSubscriptions[2 /* FIRST_BACK_REF_OR_DATA */];
3069
+ if (effectData instanceof EffectPropData) {
3267
3070
  const data = effectData.data;
3268
3071
  const payload = {
3269
3072
  ...data,
@@ -3288,6 +3091,7 @@ var ComputedSignal = class extends Signal {
3288
3091
  // We need a separate flag to know when the computation needs running because
3289
3092
  // we need the old value to know if effects need running after computation
3290
3093
  $invalid$ = true;
3094
+ $forceRunEffects$ = false;
3291
3095
  constructor(container, fn) {
3292
3096
  super(container, NEEDS_COMPUTATION);
3293
3097
  this.$computeQrl$ = fn;
@@ -3295,12 +3099,8 @@ var ComputedSignal = class extends Signal {
3295
3099
  $invalidate$() {
3296
3100
  var _a;
3297
3101
  this.$invalid$ = true;
3298
- if (!((_a = this.$effects$) == null ? void 0 : _a.length)) {
3299
- return;
3300
- }
3301
- if (this.$computeIfNeeded$()) {
3302
- triggerEffects(this.$container$, this, this.$effects$);
3303
- }
3102
+ this.$forceRunEffects$ = false;
3103
+ (_a = this.$container$) == null ? void 0 : _a.$scheduler$(8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */, null, this);
3304
3104
  }
3305
3105
  /**
3306
3106
  * Use this to force running subscribers, for example when the calculated value has mutated but
@@ -3308,10 +3108,14 @@ var ComputedSignal = class extends Signal {
3308
3108
  */
3309
3109
  force() {
3310
3110
  this.$invalid$ = true;
3111
+ this.$forceRunEffects$ = false;
3311
3112
  triggerEffects(this.$container$, this, this.$effects$);
3312
3113
  }
3313
3114
  get untrackedValue() {
3314
- this.$computeIfNeeded$();
3115
+ const didChange = this.$computeIfNeeded$();
3116
+ if (didChange) {
3117
+ this.$forceRunEffects$ = didChange;
3118
+ }
3315
3119
  assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
3316
3120
  return this.$untrackedValue$;
3317
3121
  }
@@ -3327,9 +3131,10 @@ var ComputedSignal = class extends Signal {
3327
3131
  try {
3328
3132
  const untrackedValue = computeQrl.getFn(ctx)();
3329
3133
  if (isPromise(untrackedValue)) {
3330
- throwErrorAndStop(
3331
- `useComputedSignal$ QRL ${computeQrl.dev ? `${computeQrl.dev.file} ` : ""}${computeQrl.$hash$} returned a Promise`
3332
- );
3134
+ throw qError(47 /* computedNotSync */, [
3135
+ computeQrl.dev ? computeQrl.dev.file : "",
3136
+ computeQrl.$hash$
3137
+ ]);
3333
3138
  }
3334
3139
  DEBUG3 && log2("Signal.$compute$", untrackedValue);
3335
3140
  this.$invalid$ = false;
@@ -3349,7 +3154,7 @@ var ComputedSignal = class extends Signal {
3349
3154
  return super.value;
3350
3155
  }
3351
3156
  set value(_) {
3352
- throwErrorAndStop("ComputedSignal is read-only");
3157
+ throw qError(48 /* computedReadOnly */);
3353
3158
  }
3354
3159
  };
3355
3160
  var WrappedSignal = class extends Signal {
@@ -3360,6 +3165,8 @@ var WrappedSignal = class extends Signal {
3360
3165
  // we need the old value to know if effects need running after computation
3361
3166
  $invalid$ = true;
3362
3167
  $effectDependencies$ = null;
3168
+ $hostElement$ = null;
3169
+ $forceRunEffects$ = false;
3363
3170
  constructor(container, fn, args, fnStr) {
3364
3171
  super(container, NEEDS_COMPUTATION);
3365
3172
  this.$args$ = args;
@@ -3369,12 +3176,12 @@ var WrappedSignal = class extends Signal {
3369
3176
  $invalidate$() {
3370
3177
  var _a;
3371
3178
  this.$invalid$ = true;
3372
- if (!((_a = this.$effects$) == null ? void 0 : _a.length)) {
3373
- return;
3374
- }
3375
- if (this.$computeIfNeeded$()) {
3376
- triggerEffects(this.$container$, this, this.$effects$);
3377
- }
3179
+ this.$forceRunEffects$ = false;
3180
+ (_a = this.$container$) == null ? void 0 : _a.$scheduler$(
3181
+ 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
3182
+ this.$hostElement$,
3183
+ this
3184
+ );
3378
3185
  }
3379
3186
  /**
3380
3187
  * Use this to force running subscribers, for example when the calculated value has mutated but
@@ -3382,10 +3189,14 @@ var WrappedSignal = class extends Signal {
3382
3189
  */
3383
3190
  force() {
3384
3191
  this.$invalid$ = true;
3192
+ this.$forceRunEffects$ = false;
3385
3193
  triggerEffects(this.$container$, this, this.$effects$);
3386
3194
  }
3387
3195
  get untrackedValue() {
3388
- this.$computeIfNeeded$();
3196
+ const didChange = this.$computeIfNeeded$();
3197
+ if (didChange) {
3198
+ this.$forceRunEffects$ = didChange;
3199
+ }
3389
3200
  assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
3390
3201
  return this.$untrackedValue$;
3391
3202
  }
@@ -3410,12 +3221,12 @@ var WrappedSignal = class extends Signal {
3410
3221
  return super.value;
3411
3222
  }
3412
3223
  set value(_) {
3413
- throwErrorAndStop("WrappedSignal is read-only");
3224
+ throw qError(49 /* wrappedReadOnly */);
3414
3225
  }
3415
3226
  };
3416
3227
 
3417
3228
  // packages/qwik/src/core/version.ts
3418
- var version = "2.0.0-alpha.3-dev+418fd6d";
3229
+ var version = "2.0.0-alpha.4-dev+374e0d6";
3419
3230
 
3420
3231
  // packages/qwik/src/core/shared/shared-container.ts
3421
3232
  var _SharedContainer = class {
@@ -3440,7 +3251,7 @@ var _SharedContainer = class {
3440
3251
  this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
3441
3252
  }
3442
3253
  trackSignalValue(signal, subscriber, property, data) {
3443
- return trackSignal(() => signal.value, subscriber, property, this, data);
3254
+ return trackSignalAndAssignHost(signal, subscriber, property, this, data);
3444
3255
  }
3445
3256
  serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
3446
3257
  return createSerializationContext(
@@ -3562,7 +3373,7 @@ var JSXNodeImpl = class {
3562
3373
  }
3563
3374
  };
3564
3375
  var Virtual = (props) => props.children;
3565
- var isJSXNode2 = (n) => {
3376
+ var isJSXNode = (n) => {
3566
3377
  if (qDev) {
3567
3378
  if (n instanceof JSXNodeImpl) {
3568
3379
  return true;
@@ -3698,7 +3509,7 @@ function qwikDebugToString(value) {
3698
3509
  }
3699
3510
  } else if (isStore(value)) {
3700
3511
  return "Store";
3701
- } else if (isJSXNode2(value)) {
3512
+ } else if (isJSXNode(value)) {
3702
3513
  return jsxToString(value);
3703
3514
  }
3704
3515
  } finally {
@@ -3711,7 +3522,7 @@ var pad = (text, prefix) => {
3711
3522
  return String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
3712
3523
  };
3713
3524
  var jsxToString = (value) => {
3714
- if (isJSXNode2(value)) {
3525
+ if (isJSXNode(value)) {
3715
3526
  let type = value.type;
3716
3527
  if (typeof type === "function") {
3717
3528
  type = type.name || "Component";
@@ -3900,7 +3711,7 @@ var VNodeDataChar = {
3900
3711
  /* ************** */
3901
3712
  123
3902
3713
  ),
3903
- // `{` is the start of the VNodeData.
3714
+ // `{` is the start of the VNodeData for a virtual element.
3904
3715
  OPEN_CHAR: (
3905
3716
  /* ****** */
3906
3717
  "{"
@@ -3909,7 +3720,7 @@ var VNodeDataChar = {
3909
3720
  /* ************* */
3910
3721
  125
3911
3722
  ),
3912
- // `}` is the end of the VNodeData.
3723
+ // `}` is the end of the VNodeData for a virtual element.
3913
3724
  CLOSE_CHAR: (
3914
3725
  /* ***** */
3915
3726
  "}"
@@ -3979,7 +3790,7 @@ var VNodeDataChar = {
3979
3790
  ),
3980
3791
  DON_T_USE: (
3981
3792
  /* ********** */
3982
- 93
3793
+ 92
3983
3794
  ),
3984
3795
  // `\` - SKIP because `\` is used as escaping
3985
3796
  DON_T_USE_CHAR: "\\",
@@ -4001,6 +3812,15 @@ var VNodeDataChar = {
4001
3812
  /* **** */
4002
3813
  "^"
4003
3814
  ),
3815
+ SUBS: (
3816
+ /* *************** */
3817
+ 96
3818
+ ),
3819
+ // '`' - `q:subs' - Effect dependencies/subscriptions
3820
+ SUBS_CHAR: (
3821
+ /* ******* */
3822
+ "`"
3823
+ ),
4004
3824
  SEPARATOR: (
4005
3825
  /* ********* */
4006
3826
  124
@@ -4722,9 +4542,32 @@ var vnode_materialize = (vNode) => {
4722
4542
  const element = vNode[6 /* element */];
4723
4543
  const firstChild = fastFirstChild(element);
4724
4544
  const vNodeData = (_b = (_a = element.ownerDocument) == null ? void 0 : _a.qVNodeData) == null ? void 0 : _b.get(element);
4725
- const vFirstChild = vNodeData ? materializeFromVNodeData(vNode, vNodeData, element, firstChild) : materializeFromDOM(vNode, firstChild);
4545
+ const vFirstChild = materialize(vNode, element, firstChild, vNodeData);
4726
4546
  return vFirstChild;
4727
4547
  };
4548
+ var materialize = (vNode, element, firstChild, vNodeData) => {
4549
+ if (vNodeData) {
4550
+ if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
4551
+ const elementVNodeDataStartIdx = 1;
4552
+ let elementVNodeDataEndIdx = 1;
4553
+ while (vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR) {
4554
+ elementVNodeDataEndIdx++;
4555
+ }
4556
+ const elementVNodeData = vNodeData.substring(
4557
+ elementVNodeDataStartIdx,
4558
+ elementVNodeDataEndIdx
4559
+ );
4560
+ vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
4561
+ const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
4562
+ if (!vNodeData) {
4563
+ return vFirstChild;
4564
+ }
4565
+ }
4566
+ return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
4567
+ } else {
4568
+ return materializeFromDOM(vNode, firstChild);
4569
+ }
4570
+ };
4728
4571
  var ensureMaterialized = (vnode) => {
4729
4572
  const vParent = ensureElementVNode(vnode);
4730
4573
  let vFirstChild = vParent[4 /* firstChild */];
@@ -4849,7 +4692,7 @@ var fastGetter = (prototype, name) => {
4849
4692
  var isQStyleElement = (node) => {
4850
4693
  return isElement(node) && node.nodeName === "STYLE" && (node.hasAttribute(QScopedStyle) || node.hasAttribute(QStyle));
4851
4694
  };
4852
- var materializeFromDOM = (vParent, firstChild) => {
4695
+ var materializeFromDOM = (vParent, firstChild, vData) => {
4853
4696
  let vFirstChild = null;
4854
4697
  const skipStyleElements = () => {
4855
4698
  while (isQStyleElement(child)) {
@@ -4883,8 +4726,54 @@ var materializeFromDOM = (vParent, firstChild) => {
4883
4726
  }
4884
4727
  vParent[5 /* lastChild */] = vChild || null;
4885
4728
  vParent[4 /* firstChild */] = vFirstChild;
4729
+ if (vData) {
4730
+ let container = null;
4731
+ processVNodeData(vData, (peek, consumeValue) => {
4732
+ if (peek() === VNodeDataChar.ID) {
4733
+ if (!container) {
4734
+ container = getDomContainer(vParent[6 /* element */]);
4735
+ }
4736
+ const id = consumeValue();
4737
+ container.$setRawState$(parseInt(id), vParent);
4738
+ import_build6.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
4739
+ } else if (peek() === VNodeDataChar.SUBS) {
4740
+ vnode_setProp(vParent, QSubscribers, consumeValue());
4741
+ } else {
4742
+ consumeValue();
4743
+ }
4744
+ });
4745
+ }
4886
4746
  return vFirstChild;
4887
4747
  };
4748
+ var processVNodeData = (vData, callback) => {
4749
+ let nextToConsumeIdx = 0;
4750
+ let ch = 0;
4751
+ let peekCh = 0;
4752
+ const peek = () => {
4753
+ if (peekCh !== 0) {
4754
+ return peekCh;
4755
+ } else {
4756
+ return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
4757
+ }
4758
+ };
4759
+ const consume = () => {
4760
+ ch = peek();
4761
+ peekCh = 0;
4762
+ nextToConsumeIdx++;
4763
+ return ch;
4764
+ };
4765
+ const consumeValue = () => {
4766
+ consume();
4767
+ const start = nextToConsumeIdx;
4768
+ while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
4769
+ consume();
4770
+ }
4771
+ return vData.substring(start, nextToConsumeIdx);
4772
+ };
4773
+ while (peek() !== 0) {
4774
+ callback(peek, consumeValue, consume, nextToConsumeIdx);
4775
+ }
4776
+ };
4888
4777
  var vnode_getNextSibling = (vnode) => {
4889
4778
  return vnode[3 /* nextSibling */];
4890
4779
  };
@@ -4969,7 +4858,7 @@ var vnode_getPropStartIndex = (vnode) => {
4969
4858
  } else if (type === 2 /* Virtual */) {
4970
4859
  return 6 /* PROPS_OFFSET */;
4971
4860
  }
4972
- throw throwErrorAndStop("Invalid vnode type.");
4861
+ throw qError(43 /* invalidVNodeType */, [type]);
4973
4862
  };
4974
4863
  var vnode_getParent = (vnode) => {
4975
4864
  return vnode[1 /* parent */] || null;
@@ -4984,7 +4873,7 @@ var vnode_getNode = (vnode) => {
4984
4873
  assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
4985
4874
  return vnode[4 /* node */];
4986
4875
  };
4987
- function vnode_toString(depth = 10, offset = "", materialize = false, siblings = false) {
4876
+ function vnode_toString(depth = 10, offset = "", materialize2 = false, siblings = false) {
4988
4877
  var _a;
4989
4878
  let vnode = this;
4990
4879
  if (depth === 0) {
@@ -5037,7 +4926,7 @@ function vnode_toString(depth = 10, offset = "", materialize = false, siblings =
5037
4926
  }
5038
4927
  }
5039
4928
  strings.push("<" + tag + attrs.join("") + ">");
5040
- if (vnode_isMaterialized(vnode) || materialize) {
4929
+ if (vnode_isMaterialized(vnode) || materialize2) {
5041
4930
  const child = vnode_getFirstChild(vnode);
5042
4931
  child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", true, true));
5043
4932
  } else {
@@ -5060,25 +4949,9 @@ var isLowercase = (ch) => (
5060
4949
  var stack = [];
5061
4950
  function materializeFromVNodeData(vParent, vData, element, child) {
5062
4951
  let idx = 0;
5063
- let nextToConsumeIdx = 0;
5064
4952
  let vFirst = null;
5065
4953
  let vLast = null;
5066
4954
  let previousTextNode = null;
5067
- let ch = 0;
5068
- let peekCh = 0;
5069
- const peek = () => {
5070
- if (peekCh !== 0) {
5071
- return peekCh;
5072
- } else {
5073
- return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
5074
- }
5075
- };
5076
- const consume = () => {
5077
- ch = peek();
5078
- peekCh = 0;
5079
- nextToConsumeIdx++;
5080
- return ch;
5081
- };
5082
4955
  const addVNode = (node) => {
5083
4956
  node[0 /* flags */] = node[0 /* flags */] & 255 /* negated_mask */ | idx << 8 /* shift */;
5084
4957
  idx++;
@@ -5090,25 +4963,15 @@ function materializeFromVNodeData(vParent, vData, element, child) {
5090
4963
  }
5091
4964
  vLast = node;
5092
4965
  };
5093
- const consumeValue = () => {
5094
- consume();
5095
- const start = nextToConsumeIdx;
5096
- while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
5097
- consume();
5098
- }
5099
- return vData.substring(start, nextToConsumeIdx);
5100
- };
5101
4966
  let textIdx = 0;
5102
4967
  let combinedText = null;
5103
4968
  let container = null;
5104
- while (peek() !== 0) {
4969
+ processVNodeData(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
5105
4970
  if (isNumber(peek())) {
5106
4971
  while (!isElement(child)) {
5107
4972
  child = fastNextSibling(child);
5108
4973
  if (!child) {
5109
- throwErrorAndStop(
5110
- "Materialize error: missing element: " + vData + " " + peek() + " " + nextToConsumeIdx
5111
- );
4974
+ throw qError(44 /* materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
5112
4975
  }
5113
4976
  }
5114
4977
  while (isQStyleElement(child)) {
@@ -5135,7 +4998,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
5135
4998
  }
5136
4999
  const id = consumeValue();
5137
5000
  container.$setRawState$(parseInt(id), vParent);
5138
- import_build7.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
5001
+ import_build6.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
5139
5002
  } else if (peek() === VNodeDataChar.PROPS) {
5140
5003
  vnode_setAttr(null, vParent, ELEMENT_PROPS, consumeValue());
5141
5004
  } else if (peek() === VNodeDataChar.SLOT_REF) {
@@ -5146,6 +5009,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
5146
5009
  vnode_setAttr(null, vParent, ELEMENT_SEQ, consumeValue());
5147
5010
  } else if (peek() === VNodeDataChar.SEQ_IDX) {
5148
5011
  vnode_setAttr(null, vParent, ELEMENT_SEQ_IDX, consumeValue());
5012
+ } else if (peek() === VNodeDataChar.SUBS) {
5013
+ vnode_setProp(vParent, QSubscribers, consumeValue());
5149
5014
  } else if (peek() === VNodeDataChar.CONTEXT) {
5150
5015
  vnode_setAttr(null, vParent, QCtxAttr, consumeValue());
5151
5016
  } else if (peek() === VNodeDataChar.OPEN) {
@@ -5188,7 +5053,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
5188
5053
  );
5189
5054
  textIdx += length;
5190
5055
  }
5191
- }
5056
+ });
5192
5057
  vParent[5 /* lastChild */] = vLast;
5193
5058
  return vFirst;
5194
5059
  }
@@ -5201,7 +5066,7 @@ var vnode_getType = (vnode) => {
5201
5066
  } else if (type & 4 /* Text */) {
5202
5067
  return 3;
5203
5068
  }
5204
- throw throwErrorAndStop("Unknown vnode type: " + type);
5069
+ throw qError(43 /* invalidVNodeType */, [type]);
5205
5070
  };
5206
5071
  var isElement = (node) => node && typeof node == "object" && fastNodeType(node) === /** Node.ELEMENT_NODE* */
5207
5072
  1;
@@ -5282,7 +5147,7 @@ var VNodeArray = class VNode extends Array {
5282
5147
  constructor(flags, parent, previousSibling, nextSibling) {
5283
5148
  super();
5284
5149
  this.push(flags, parent, previousSibling, nextSibling);
5285
- if (import_build7.isDev) {
5150
+ if (import_build6.isDev) {
5286
5151
  this.toString = vnode_toString;
5287
5152
  }
5288
5153
  }
@@ -5363,6 +5228,12 @@ var trackSignal = (fn, subscriber, property, container, data) => {
5363
5228
  trackInvocation.$container$ = previousContainer;
5364
5229
  }
5365
5230
  };
5231
+ var trackSignalAndAssignHost = (value, host, property, container, data) => {
5232
+ if (value instanceof WrappedSignal && value.$hostElement$ !== host && host) {
5233
+ value.$hostElement$ = host;
5234
+ }
5235
+ return trackSignal(() => value.value, host, property, container, data);
5236
+ };
5366
5237
 
5367
5238
  // packages/qwik/src/core/use/use-context.ts
5368
5239
  var createContextId = (name) => {
@@ -5384,7 +5255,7 @@ var isRecoverable = (err) => {
5384
5255
  };
5385
5256
 
5386
5257
  // packages/qwik/src/core/client/process-vnode-data.ts
5387
- function processVNodeData(document2) {
5258
+ function processVNodeData2(document2) {
5388
5259
  const Q_CONTAINER = "q:container";
5389
5260
  const Q_CONTAINER_END = "/" + Q_CONTAINER;
5390
5261
  const Q_PROPS_SEPARATOR2 = ":";
@@ -5637,7 +5508,7 @@ function processVNodeData(document2) {
5637
5508
  function getDomContainer(element) {
5638
5509
  const qContainerElement = _getQContainerElement(element);
5639
5510
  if (!qContainerElement) {
5640
- throwErrorAndStop("Unable to find q:container.");
5511
+ throw qError(41 /* containerNotFound */);
5641
5512
  }
5642
5513
  return getDomContainerFromQContainerElement(qContainerElement);
5643
5514
  }
@@ -5698,7 +5569,7 @@ var DomContainer = class extends _SharedContainer {
5698
5569
  );
5699
5570
  this.qContainer = element.getAttribute(QContainerAttr);
5700
5571
  if (!this.qContainer) {
5701
- throwErrorAndStop("Element must have 'q:container' attribute.");
5572
+ throw qError(42 /* elementWithoutContainer */);
5702
5573
  }
5703
5574
  this.$journal$ = [
5704
5575
  // The first time we render we need to hoist the styles.
@@ -5719,7 +5590,7 @@ var DomContainer = class extends _SharedContainer {
5719
5590
  this.stateData = null;
5720
5591
  const document2 = this.element.ownerDocument;
5721
5592
  if (!document2.qVNodeData) {
5722
- processVNodeData(document2);
5593
+ processVNodeData2(document2);
5723
5594
  }
5724
5595
  this.$rawStateData$ = [];
5725
5596
  this.stateData = [];
@@ -5729,7 +5600,7 @@ var DomContainer = class extends _SharedContainer {
5729
5600
  this.$rawStateData$ = JSON.parse(lastState.textContent);
5730
5601
  this.stateData = wrapDeserializerProxy(this, this.$rawStateData$);
5731
5602
  }
5732
- this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY2;
5603
+ this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
5733
5604
  }
5734
5605
  $setRawState$(id, vParent) {
5735
5606
  this.stateData[id] = vParent;
@@ -5833,12 +5704,12 @@ var DomContainer = class extends _SharedContainer {
5833
5704
  }
5834
5705
  processChores() {
5835
5706
  let renderCount = this.$renderCount$;
5836
- const result = this.$scheduler$(127 /* WAIT_FOR_ALL */);
5707
+ const result = this.$scheduler$(255 /* WAIT_FOR_ALL */);
5837
5708
  if (isPromise(result)) {
5838
5709
  return result.then(async () => {
5839
5710
  while (renderCount !== this.$renderCount$) {
5840
5711
  renderCount = this.$renderCount$;
5841
- await this.$scheduler$(127 /* WAIT_FOR_ALL */);
5712
+ await this.$scheduler$(255 /* WAIT_FOR_ALL */);
5842
5713
  }
5843
5714
  this.renderDone = null;
5844
5715
  });
@@ -6084,7 +5955,8 @@ var inflate = (container, target, typeId, data) => {
6084
5955
  signal.$args$ = d[1];
6085
5956
  signal.$effectDependencies$ = d[2];
6086
5957
  signal.$untrackedValue$ = d[3];
6087
- signal.$effects$ = d.slice(4);
5958
+ signal.$hostElement$ = d[4];
5959
+ signal.$effects$ = d.slice(5);
6088
5960
  break;
6089
5961
  }
6090
5962
  case 24 /* ComputedSignal */: {
@@ -6181,11 +6053,12 @@ var inflate = (container, target, typeId, data) => {
6181
6053
  break;
6182
6054
  case 30 /* EffectData */: {
6183
6055
  const effectData = target;
6184
- effectData.data = data[0];
6056
+ effectData.data.$scopedStyleIdPrefix$ = data[0];
6057
+ effectData.data.$isConst$ = data[1];
6185
6058
  break;
6186
6059
  }
6187
6060
  default:
6188
- return throwErrorAndStop("Not implemented");
6061
+ throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
6189
6062
  }
6190
6063
  };
6191
6064
  var _constants = [
@@ -6194,7 +6067,7 @@ var _constants = [
6194
6067
  true,
6195
6068
  false,
6196
6069
  "",
6197
- EMPTY_ARRAY2,
6070
+ EMPTY_ARRAY,
6198
6071
  EMPTY_OBJ,
6199
6072
  NEEDS_COMPUTATION,
6200
6073
  Slot,
@@ -6298,12 +6171,12 @@ var allocate = (container, typeId, value) => {
6298
6171
  if (vnode_isVNode(vNode)) {
6299
6172
  return vnode_getNode(vNode);
6300
6173
  } else {
6301
- return throwErrorAndStop("expected vnode for ref prop, but got " + typeof vNode);
6174
+ throw qError(34 /* serializeErrorExpectedVNode */, [typeof vNode]);
6302
6175
  }
6303
6176
  case 30 /* EffectData */:
6304
- return new EffectData(null);
6177
+ return new EffectPropData({});
6305
6178
  default:
6306
- return throwErrorAndStop("unknown allocate type: " + typeId);
6179
+ throw qError(35 /* serializeErrorCannotAllocate */, [typeId]);
6307
6180
  }
6308
6181
  };
6309
6182
  function retrieveVNodeOrDocument(container, value) {
@@ -6377,7 +6250,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
6377
6250
  $getRootId$: (obj) => {
6378
6251
  const id = map.get(obj);
6379
6252
  if (!id || id === -1) {
6380
- return throwErrorAndStop("Missing root id for: ", obj);
6253
+ throw qError(36 /* serializeErrorMissingRootId */, [obj]);
6381
6254
  }
6382
6255
  return id;
6383
6256
  },
@@ -6466,16 +6339,24 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
6466
6339
  if (obj.$args$) {
6467
6340
  discoveredValues.push(...obj.$args$);
6468
6341
  }
6342
+ if (obj.$hostElement$) {
6343
+ discoveredValues.push(obj.$hostElement$);
6344
+ }
6469
6345
  } else if (obj instanceof ComputedSignal) {
6470
6346
  discoveredValues.push(obj.$computeQrl$);
6471
6347
  }
6472
6348
  } else if (obj instanceof Task) {
6473
6349
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
6474
6350
  } else if (isSsrNode(obj)) {
6475
- discoveredValues.push(obj.vnodeData);
6351
+ discoverValuesForVNodeData(obj.vnodeData, discoveredValues);
6352
+ if (obj.childrenVNodeData && obj.childrenVNodeData.length) {
6353
+ for (const data of obj.childrenVNodeData) {
6354
+ discoverValuesForVNodeData(data, discoveredValues);
6355
+ }
6356
+ }
6476
6357
  } else if (isDomRef(obj)) {
6477
6358
  discoveredValues.push(obj.$ssrNode$.id);
6478
- } else if (isJSXNode2(obj)) {
6359
+ } else if (isJSXNode(obj)) {
6479
6360
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
6480
6361
  } else if (Array.isArray(obj)) {
6481
6362
  discoveredValues.push(...obj);
@@ -6495,14 +6376,14 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
6495
6376
  }
6496
6377
  );
6497
6378
  promises.push(obj);
6498
- } else if (obj instanceof EffectData) {
6379
+ } else if (obj instanceof EffectPropData) {
6499
6380
  discoveredValues.push(obj.data);
6500
6381
  } else if (isObjectLiteral(obj)) {
6501
6382
  Object.entries(obj).forEach(([key, value]) => {
6502
6383
  discoveredValues.push(key, value);
6503
6384
  });
6504
6385
  } else {
6505
- return throwErrorAndStop("Unknown type: " + obj);
6386
+ throw qError(37 /* serializeErrorUnknownType */, [obj]);
6506
6387
  }
6507
6388
  };
6508
6389
  for (const root of roots) {
@@ -6527,6 +6408,20 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
6527
6408
  } while (discoveredValues.length);
6528
6409
  }
6529
6410
  };
6411
+ var isSsrAttrs = (value) => Array.isArray(value) && value.length > 0;
6412
+ var discoverValuesForVNodeData = (vnodeData, discoveredValues) => {
6413
+ for (const value of vnodeData) {
6414
+ if (isSsrAttrs(value)) {
6415
+ for (let i = 1; i < value.length; i += 2) {
6416
+ if (value[i - 1] === ELEMENT_KEY) {
6417
+ continue;
6418
+ }
6419
+ const attrValue = value[i];
6420
+ discoveredValues.push(attrValue);
6421
+ }
6422
+ }
6423
+ }
6424
+ };
6530
6425
  var promiseResults = /* @__PURE__ */ new WeakMap();
6531
6426
  function serialize(serializationContext) {
6532
6427
  const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
@@ -6608,7 +6503,7 @@ function serialize(serializationContext) {
6608
6503
  output(2 /* Number */, value);
6609
6504
  }
6610
6505
  } else if (typeof value === "object") {
6611
- if (value === EMPTY_ARRAY2) {
6506
+ if (value === EMPTY_ARRAY) {
6612
6507
  output(1 /* Constant */, 5 /* EMPTY_ARRAY */);
6613
6508
  } else if (value === EMPTY_OBJ) {
6614
6509
  output(1 /* Constant */, 6 /* EMPTY_OBJ */);
@@ -6637,7 +6532,7 @@ function serialize(serializationContext) {
6637
6532
  } else if (value === NEEDS_COMPUTATION) {
6638
6533
  output(1 /* Constant */, 7 /* NEEDS_COMPUTATION */);
6639
6534
  } else {
6640
- throwErrorAndStop("Unknown type: " + typeof value);
6535
+ throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
6641
6536
  }
6642
6537
  };
6643
6538
  const writeObjectValue = (value, idx) => {
@@ -6655,14 +6550,14 @@ function serialize(serializationContext) {
6655
6550
  const constProps = value[_CONST_PROPS];
6656
6551
  const out = constProps ? [varProps, constProps] : Object.keys(varProps).length ? [varProps] : 0;
6657
6552
  output(29 /* PropsProxy */, out);
6658
- } else if (value instanceof EffectData) {
6659
- output(30 /* EffectData */, [value.data]);
6553
+ } else if (value instanceof EffectPropData) {
6554
+ output(30 /* EffectData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
6660
6555
  } else if (isStore(value)) {
6661
6556
  if (isResource(value)) {
6662
6557
  serializationContext.$resources$.add(value);
6663
6558
  const res = promiseResults.get(value.value);
6664
6559
  if (!res) {
6665
- return throwErrorAndStop("Unvisited Resource");
6560
+ throw qError(38 /* serializeErrorUnvisited */, ["resource"]);
6666
6561
  }
6667
6562
  output(20 /* Resource */, [...res, getStoreHandler(value).$effects$]);
6668
6563
  } else {
@@ -6699,7 +6594,7 @@ function serialize(serializationContext) {
6699
6594
  output(13 /* Object */, out);
6700
6595
  }
6701
6596
  } else if ($isDomRef$(value)) {
6702
- value.$ssrNode$.vnodeData[0] |= 8 /* SERIALIZE */;
6597
+ value.$ssrNode$.vnodeData[0] |= 16 /* SERIALIZE */;
6703
6598
  output(9 /* RefVNode */, value.$ssrNode$.id);
6704
6599
  } else if (value instanceof Signal) {
6705
6600
  const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
@@ -6708,6 +6603,7 @@ function serialize(serializationContext) {
6708
6603
  ...serializeWrappingFn(serializationContext, value),
6709
6604
  value.$effectDependencies$,
6710
6605
  v,
6606
+ value.$hostElement$,
6711
6607
  ...value.$effects$ || []
6712
6608
  ]);
6713
6609
  } else if (value instanceof ComputedSignal) {
@@ -6746,11 +6642,11 @@ function serialize(serializationContext) {
6746
6642
  const vNodeData = value.vnodeData;
6747
6643
  if (vNodeData) {
6748
6644
  (_a = serializationContext.$prepVNodeData$) == null ? void 0 : _a.call(serializationContext, vNodeData);
6749
- vNodeData[0] |= 8 /* SERIALIZE */;
6645
+ vNodeData[0] |= 16 /* SERIALIZE */;
6750
6646
  }
6751
6647
  if (value.childrenVNodeData) {
6752
6648
  for (const vNodeData2 of value.childrenVNodeData) {
6753
- vNodeData2[0] |= 8 /* SERIALIZE */;
6649
+ vNodeData2[0] |= 16 /* SERIALIZE */;
6754
6650
  }
6755
6651
  }
6756
6652
  } else {
@@ -6777,7 +6673,7 @@ function serialize(serializationContext) {
6777
6673
  combined.push(k, v);
6778
6674
  }
6779
6675
  output(16 /* Map */, combined);
6780
- } else if (isJSXNode2(value)) {
6676
+ } else if (isJSXNode(value)) {
6781
6677
  output(28 /* JSXNode */, [
6782
6678
  value.type,
6783
6679
  value.varProps,
@@ -6802,7 +6698,7 @@ function serialize(serializationContext) {
6802
6698
  } else if (isPromise(value)) {
6803
6699
  const res = promiseResults.get(value);
6804
6700
  if (!res) {
6805
- return throwErrorAndStop("Unvisited Promise");
6701
+ throw qError(38 /* serializeErrorUnvisited */, ["promise"]);
6806
6702
  }
6807
6703
  output(14 /* Promise */, res);
6808
6704
  } else if (value instanceof Uint8Array) {
@@ -6813,7 +6709,7 @@ function serialize(serializationContext) {
6813
6709
  const out = btoa(buf).replace(/=+$/, "");
6814
6710
  output(17 /* Uint8Array */, out);
6815
6711
  } else {
6816
- return throwErrorAndStop("implement");
6712
+ throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
6817
6713
  }
6818
6714
  };
6819
6715
  writeValue(serializationContext.$roots$, -1);
@@ -6860,7 +6756,7 @@ function qrlToString(serializationContext, value) {
6860
6756
  }
6861
6757
  }
6862
6758
  if (!chunk) {
6863
- throwErrorAndStop("Missing chunk for: " + value.$symbol$);
6759
+ throw qError(31 /* qrlMissingChunk */, [value.$symbol$]);
6864
6760
  }
6865
6761
  if (chunk.startsWith("./")) {
6866
6762
  chunk = chunk.slice(2);
@@ -6915,7 +6811,7 @@ function isResource(value) {
6915
6811
  return "__brand" in value && value.__brand === "resource";
6916
6812
  }
6917
6813
  var frameworkType = (obj) => {
6918
- return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task || isJSXNode2(obj)) || isQrl2(obj);
6814
+ return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl2(obj);
6919
6815
  };
6920
6816
  var canSerialize = (value) => {
6921
6817
  if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
@@ -6945,7 +6841,7 @@ var canSerialize = (value) => {
6945
6841
  return true;
6946
6842
  } else if (isPromise(value)) {
6947
6843
  return true;
6948
- } else if (isJSXNode2(value)) {
6844
+ } else if (isJSXNode(value)) {
6949
6845
  return true;
6950
6846
  } else if (value instanceof Error) {
6951
6847
  return true;
@@ -7011,7 +6907,7 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
7011
6907
  let expectIndex = 0;
7012
6908
  unwrapped.forEach((v, i) => {
7013
6909
  if (i !== expectIndex) {
7014
- throw qError(QError_verifySerializable, unwrapped);
6910
+ throw qError(3 /* verifySerializable */, [unwrapped]);
7015
6911
  }
7016
6912
  _verifySerializable(v, seen, ctx + "[" + i + "]");
7017
6913
  expectIndex = i + 1;
@@ -7051,8 +6947,7 @@ const ${fnName} = $(${String(
7051
6947
 
7052
6948
  Please check out https://qwik.dev/docs/advanced/qrl/ for more information.`;
7053
6949
  }
7054
- console.error("Trying to serialize", value);
7055
- throwErrorAndStop(message);
6950
+ throw qError(3 /* verifySerializable */, [message]);
7056
6951
  }
7057
6952
  return value;
7058
6953
  };
@@ -7104,7 +6999,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
7104
6999
  function bindFnToContext(currentCtx, beforeFn) {
7105
7000
  return (...args) => maybeThen(resolveLazy(), (fn) => {
7106
7001
  if (!isFunction(fn)) {
7107
- throw qError(QError_qrlIsNotFunction);
7002
+ throw qError(10 /* qrlIsNotFunction */);
7108
7003
  }
7109
7004
  if (beforeFn && beforeFn() === false) {
7110
7005
  return;
@@ -7205,7 +7100,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
7205
7100
  if (symbolRef) {
7206
7101
  symbolRef = maybeThen(symbolRef, (resolved) => qrl.resolved = symbolRef = wrapFn(resolved));
7207
7102
  }
7208
- if (import_build9.isDev) {
7103
+ if (import_build8.isDev) {
7209
7104
  Object.defineProperty(qrl, "_devOnlySymbolRef", {
7210
7105
  get() {
7211
7106
  return symbolRef;
@@ -7296,7 +7191,7 @@ var stringifyStyle = (obj) => {
7296
7191
  }
7297
7192
  if (typeof obj == "object") {
7298
7193
  if (isArray(obj)) {
7299
- throw qError(QError_stringifyClassOrStyle, obj, "style");
7194
+ throw qError(0 /* stringifyClassOrStyle */, [obj, "style"]);
7300
7195
  } else {
7301
7196
  const chunks = [];
7302
7197
  for (const key in obj) {
@@ -7359,7 +7254,7 @@ function getValidManifest(manifest) {
7359
7254
  }
7360
7255
 
7361
7256
  // packages/qwik/src/server/ssr-container.ts
7362
- var import_core3 = require("@qwik.dev/core");
7257
+ var import_core4 = require("@qwik.dev/core");
7363
7258
  var import_build10 = require("@qwik.dev/core/build");
7364
7259
 
7365
7260
  // packages/qwik/src/server/prefetch-utils.ts
@@ -7535,6 +7430,166 @@ var PrefetchImplementationDefault = {
7535
7430
  prefetchEvent: "always"
7536
7431
  };
7537
7432
 
7433
+ // packages/qwik/src/server/ssr-node.ts
7434
+ var import_core2 = require("@qwik.dev/core");
7435
+ var import_build9 = require("@qwik.dev/core/build");
7436
+ var SsrNode = class {
7437
+ constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
7438
+ this.attrs = attrs;
7439
+ this.cleanupQueue = cleanupQueue;
7440
+ this.vnodeData = vnodeData;
7441
+ var _a;
7442
+ this.currentComponentNode = currentComponentNode;
7443
+ (_a = this.currentComponentNode) == null ? void 0 : _a.addChildVNodeData(this.vnodeData);
7444
+ this.nodeType = nodeType;
7445
+ this.id = id;
7446
+ if (import_build9.isDev && id.indexOf("undefined") != -1) {
7447
+ throw new Error(`Invalid SSR node id: ${id}`);
7448
+ }
7449
+ }
7450
+ __brand__;
7451
+ static ELEMENT_NODE = 1;
7452
+ static TEXT_NODE = 3;
7453
+ static DOCUMENT_NODE = 9;
7454
+ static DOCUMENT_FRAGMENT_NODE = 11;
7455
+ /** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
7456
+ nodeType;
7457
+ /**
7458
+ * ID which the deserialize will use to retrieve the node.
7459
+ *
7460
+ * @param refId - Unique id for the node.
7461
+ */
7462
+ id;
7463
+ /** Local props which don't serialize; */
7464
+ locals = null;
7465
+ currentComponentNode;
7466
+ childrenVNodeData = null;
7467
+ setProp(name, value) {
7468
+ if (this.attrs === import_core2._EMPTY_ARRAY) {
7469
+ this.attrs = [];
7470
+ }
7471
+ if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
7472
+ mapArray_set(this.locals || (this.locals = []), name, value, 0);
7473
+ } else {
7474
+ mapArray_set(this.attrs, name, value, 0);
7475
+ }
7476
+ if (name == ELEMENT_SEQ && value) {
7477
+ this.cleanupQueue.push(value);
7478
+ }
7479
+ }
7480
+ getProp(name) {
7481
+ if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
7482
+ return this.locals ? mapArray_get(this.locals, name, 0) : null;
7483
+ } else {
7484
+ return mapArray_get(this.attrs, name, 0);
7485
+ }
7486
+ }
7487
+ removeProp(name) {
7488
+ if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
7489
+ if (this.locals) {
7490
+ mapApp_remove(this.locals, name, 0);
7491
+ }
7492
+ } else {
7493
+ mapApp_remove(this.attrs, name, 0);
7494
+ }
7495
+ }
7496
+ addChildVNodeData(child) {
7497
+ if (!this.childrenVNodeData) {
7498
+ this.childrenVNodeData = [];
7499
+ }
7500
+ this.childrenVNodeData.push(child);
7501
+ }
7502
+ toString() {
7503
+ let stringifiedAttrs = "";
7504
+ for (let i = 0; i < this.attrs.length; i += 2) {
7505
+ const key = this.attrs[i];
7506
+ const value = this.attrs[i + 1];
7507
+ stringifiedAttrs += `${key}=`;
7508
+ stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
7509
+ if (i < this.attrs.length - 2) {
7510
+ stringifiedAttrs += ", ";
7511
+ }
7512
+ }
7513
+ return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
7514
+ }
7515
+ };
7516
+ var DomRef = class {
7517
+ constructor($ssrNode$) {
7518
+ this.$ssrNode$ = $ssrNode$;
7519
+ }
7520
+ };
7521
+ var SsrComponentFrame = class {
7522
+ constructor(componentNode) {
7523
+ this.componentNode = componentNode;
7524
+ }
7525
+ slots = [];
7526
+ projectionDepth = 0;
7527
+ scopedStyleIds = /* @__PURE__ */ new Set();
7528
+ projectionScopedStyle = null;
7529
+ projectionComponentFrame = null;
7530
+ distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
7531
+ this.projectionScopedStyle = projectionScopedStyle;
7532
+ this.projectionComponentFrame = projectionComponentFrame;
7533
+ if ((0, import_core2._isJSXNode)(children)) {
7534
+ const slotName = this.getSlotName(children);
7535
+ mapArray_set(this.slots, slotName, children, 0);
7536
+ } else if (Array.isArray(children)) {
7537
+ const defaultSlot = [];
7538
+ for (let i = 0; i < children.length; i++) {
7539
+ const child = children[i];
7540
+ if ((0, import_core2._isJSXNode)(child)) {
7541
+ const slotName = this.getSlotName(child);
7542
+ if (slotName === QDefaultSlot) {
7543
+ defaultSlot.push(child);
7544
+ } else {
7545
+ this.updateSlot(slotName, child);
7546
+ }
7547
+ } else {
7548
+ defaultSlot.push(child);
7549
+ }
7550
+ }
7551
+ defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
7552
+ } else {
7553
+ mapArray_set(this.slots, QDefaultSlot, children, 0);
7554
+ }
7555
+ }
7556
+ updateSlot(slotName, child) {
7557
+ let existingSlots = mapArray_get(this.slots, slotName, 0);
7558
+ if (existingSlots === null) {
7559
+ existingSlots = child;
7560
+ } else if (Array.isArray(existingSlots)) {
7561
+ existingSlots.push(child);
7562
+ } else {
7563
+ existingSlots = [existingSlots, child];
7564
+ }
7565
+ mapArray_set(this.slots, slotName, existingSlots, 0);
7566
+ }
7567
+ getSlotName(jsx2) {
7568
+ if (jsx2.props[QSlot]) {
7569
+ return jsx2.props[QSlot];
7570
+ }
7571
+ return QDefaultSlot;
7572
+ }
7573
+ hasSlot(slotName) {
7574
+ return mapArray_get(this.slots, slotName, 0) !== null;
7575
+ }
7576
+ consumeChildrenForSlot(projectionNode, slotName) {
7577
+ const children = mapApp_remove(this.slots, slotName, 0);
7578
+ if (children !== null) {
7579
+ this.componentNode.setProp(slotName, projectionNode.id);
7580
+ projectionNode.setProp(QSlotParent, this.componentNode.id);
7581
+ }
7582
+ return children;
7583
+ }
7584
+ releaseUnclaimedProjections(unclaimedProjections) {
7585
+ if (this.slots.length) {
7586
+ unclaimedProjections.push(this);
7587
+ unclaimedProjections.push(this.projectionScopedStyle);
7588
+ unclaimedProjections.push.apply(unclaimedProjections, this.slots);
7589
+ }
7590
+ }
7591
+ };
7592
+
7538
7593
  // packages/qwik/src/server/tag-nesting.ts
7539
7594
  var allowedContent = (state) => {
7540
7595
  switch (state) {
@@ -7805,6 +7860,110 @@ function isInPhrasing(text, allowInput) {
7805
7860
  }
7806
7861
  }
7807
7862
 
7863
+ // packages/qwik/src/server/vnode-data.ts
7864
+ var import_core3 = require("@qwik.dev/core");
7865
+ var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
7866
+ var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
7867
+ var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
7868
+ function vNodeData_incrementElementCount(vNodeData) {
7869
+ const length = vNodeData.length;
7870
+ const lastValue = length > 1 ? vNodeData[length - 1] : 0;
7871
+ if (lastValue >= 0) {
7872
+ vNodeData.push(-1);
7873
+ } else {
7874
+ vNodeData[length - 1] = lastValue - 1;
7875
+ }
7876
+ }
7877
+ function vNodeData_addTextSize(vNodeData, size) {
7878
+ const length = vNodeData.length;
7879
+ const lastValue = length > 1 ? vNodeData[length - 1] : 0;
7880
+ if (length > 1 && lastValue >= 0) {
7881
+ vNodeData[0] |= 1 /* TEXT_DATA */;
7882
+ }
7883
+ vNodeData.push(size);
7884
+ if (size == 0) {
7885
+ vNodeData[0] |= 1 /* TEXT_DATA */;
7886
+ }
7887
+ }
7888
+ function vNodeData_openFragment(vNodeData, attrs) {
7889
+ vNodeData.push(attrs, OPEN_FRAGMENT);
7890
+ vNodeData[0] |= 2 /* VIRTUAL_NODE */;
7891
+ }
7892
+ function vNodeData_closeFragment(vNodeData) {
7893
+ vNodeData.push(CLOSE_FRAGMENT);
7894
+ }
7895
+ function vNodeData_openElement(vNodeData) {
7896
+ vNodeData.push([], WRITE_ELEMENT_ATTRS);
7897
+ vNodeData[0] |= 4 /* ELEMENT_NODE */;
7898
+ }
7899
+ function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
7900
+ vNodeData[0] |= 8 /* REFERENCE */;
7901
+ let fragmentAttrs = import_core3._EMPTY_ARRAY;
7902
+ const stack2 = [SsrNode.ELEMENT_NODE, -1];
7903
+ for (let i = 1; i < vNodeData.length; i++) {
7904
+ const value = vNodeData[i];
7905
+ if (Array.isArray(value)) {
7906
+ fragmentAttrs = value;
7907
+ i++;
7908
+ if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
7909
+ stack2[stack2.length - 1]++;
7910
+ stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
7911
+ }
7912
+ } else if (value === CLOSE_FRAGMENT) {
7913
+ stack2.pop();
7914
+ stack2.pop();
7915
+ fragmentAttrs = import_core3._EMPTY_ARRAY;
7916
+ } else if (value < 0) {
7917
+ const numberOfElements = 0 - value;
7918
+ stack2[stack2.length - 1] += numberOfElements;
7919
+ } else {
7920
+ stack2[stack2.length - 1]++;
7921
+ }
7922
+ }
7923
+ let refId = String(depthFirstElementIdx);
7924
+ if (vNodeData[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
7925
+ for (let i = 1; i < stack2.length; i += 2) {
7926
+ const childCount = stack2[i];
7927
+ if (childCount >= 0) {
7928
+ refId += encodeAsAlphanumeric(childCount);
7929
+ }
7930
+ }
7931
+ }
7932
+ const type = stack2[stack2.length - 2];
7933
+ return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
7934
+ }
7935
+ var ALPHANUMERIC = [];
7936
+ function encodeAsAlphanumeric(value) {
7937
+ while (ALPHANUMERIC.length <= value) {
7938
+ let value2 = ALPHANUMERIC.length;
7939
+ let text = "";
7940
+ do {
7941
+ text = String.fromCharCode(
7942
+ (text.length === 0 ? 65 : 97) + value2 % 26
7943
+ /* A-Z */
7944
+ ) + text;
7945
+ value2 = Math.floor(
7946
+ value2 / 26
7947
+ /* A-Z */
7948
+ );
7949
+ } while (value2 !== 0);
7950
+ ALPHANUMERIC.push(text);
7951
+ }
7952
+ return ALPHANUMERIC[value];
7953
+ }
7954
+
7955
+ // packages/qwik/src/server/scripts.ts
7956
+ var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))o.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",o=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\\\:"+n+"]")[c]((o=>g(o,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,o,r,a=r.type)=>{const c="on"+o+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,r],(()=>t[p]))(r,t),o=r.cancelBubble;q(n)&&await n,o&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,o);const h=t[f](c);if(h){const o=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=o[f]("q:base"),c=o[f]("q:version")||"unknown",l=o[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=o.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(o),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[n];if(t[p]){const o=async(a=0)=>{try{e[n]=[t,r,u],A||E("qsymbol",s({},_));const o=m(r,t);q(o)&&await o}catch(e){q(e)&&a<100?e.then((()=>o(a++))):E("qerror",s({error:e},_))}finally{e[n]=k}};o()}}}},E=(t,n)=>{e.dispatchEvent(v(t,n))},A=e=>e[i](/([A-Z])/g,(e=>"-"+e.toLowerCase())),_=async e=>{let t=A(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const o=g(n,"",e,t);let r=e.cancelBubble;q(o)&&await o,r=r||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==r?n.parentElement:null}},k=e=>{m("-window",e,A(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,E("qinit"),(null!=(n=o.requestIdleCallback)?n:o.setTimeout).bind(o)((()=>E("qidle"))),r.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),g(n[l],"",v(b,n)))}));e[c]((e=>t.observe(e)))}},O=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(o,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=o.qwikevents;Array.isArray(t)&&S(...t),o.qwikevents={events:r,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
7957
+ var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
7958
+ function getQwikLoaderScript(opts = {}) {
7959
+ return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
7960
+ }
7961
+ var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
7962
+ var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
7963
+ function getQwikPrefetchWorkerScript(opts = {}) {
7964
+ return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
7965
+ }
7966
+
7808
7967
  // packages/qwik/src/server/ssr-container.ts
7809
7968
  function ssrCreateContainer(opts) {
7810
7969
  opts.renderOptions ||= {};
@@ -7841,7 +8000,7 @@ var StringBufferWriter = class {
7841
8000
  }
7842
8001
  };
7843
8002
  var EMPTY_OBJ2 = {};
7844
- var SSRContainer = class extends import_core3._SharedContainer {
8003
+ var SSRContainer = class extends import_core4._SharedContainer {
7845
8004
  tag;
7846
8005
  writer;
7847
8006
  timing;
@@ -7919,7 +8078,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
7919
8078
  }
7920
8079
  async render(jsx2) {
7921
8080
  this.openContainer();
7922
- await (0, import_core3._walkJSX)(this, jsx2, {
8081
+ await (0, import_core4._walkJSX)(this, jsx2, {
7923
8082
  allowPromises: true,
7924
8083
  currentStyleScoped: null,
7925
8084
  parentComponentFrame: this.getComponentFrame()
@@ -8002,6 +8161,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8002
8161
  vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
8003
8162
  }
8004
8163
  this.createAndPushFrame(elementName, this.depthFirstElementCount++, currentFile);
8164
+ vNodeData_openElement(this.currentElementFrame.vNodeData);
8005
8165
  this.write("<");
8006
8166
  this.write(elementName);
8007
8167
  if (varAttrs) {
@@ -8089,7 +8249,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8089
8249
  this.openFragment(attrs);
8090
8250
  const vNode = (_a = this.currentElementFrame) == null ? void 0 : _a.vNodeData;
8091
8251
  if (vNode) {
8092
- vNode[0] |= 8 /* SERIALIZE */;
8252
+ vNode[0] |= 16 /* SERIALIZE */;
8093
8253
  }
8094
8254
  const componentFrame = this.getComponentFrame();
8095
8255
  if (componentFrame) {
@@ -8174,7 +8334,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8174
8334
  }
8175
8335
  for (let i = 0; i < injections.length; i++) {
8176
8336
  const injection = injections[i];
8177
- const jsxNode = (0, import_core3._jsxSplit)(injection.tag, null, injection.attributes || {}, null, 0, null);
8337
+ const jsxNode = (0, import_core4._jsxSplit)(injection.tag, null, injection.attributes || {}, null, 0, null);
8178
8338
  if (injection.location === "head") {
8179
8339
  this.additionalHeadNodes.push(jsxNode);
8180
8340
  } else {
@@ -8194,7 +8354,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8194
8354
  this.styleIds.add(styleId);
8195
8355
  if (((_a = this.currentElementFrame) == null ? void 0 : _a.elementName) === "html") {
8196
8356
  this.additionalHeadNodes.push(
8197
- (0, import_core3._jsxSorted)(
8357
+ (0, import_core4._jsxSorted)(
8198
8358
  "style",
8199
8359
  null,
8200
8360
  { dangerouslySetInnerHTML: content, [QStyle]: styleId },
@@ -8255,12 +8415,12 @@ var SSRContainer = class extends import_core3._SharedContainer {
8255
8415
  for (let elementIdx = 0; elementIdx < vNodeData.length; elementIdx++) {
8256
8416
  const vNode = vNodeData[elementIdx];
8257
8417
  const flag = vNode[0];
8258
- if (flag & 8 /* SERIALIZE */) {
8418
+ if (flag & 16 /* SERIALIZE */) {
8259
8419
  lastSerializedIdx = this.emitVNodeSeparators(lastSerializedIdx, elementIdx);
8260
- if (flag & 4 /* REFERENCE */) {
8420
+ if (flag & 8 /* REFERENCE */) {
8261
8421
  this.write(VNodeDataSeparator.REFERENCE_CH);
8262
8422
  }
8263
- if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */)) {
8423
+ if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */ | 4 /* ELEMENT_NODE */)) {
8264
8424
  let fragmentAttrs = null;
8265
8425
  let depth = 0;
8266
8426
  for (let i = 1; i < vNode.length; i++) {
@@ -8278,6 +8438,13 @@ var SSRContainer = class extends import_core3._SharedContainer {
8278
8438
  }
8279
8439
  depth--;
8280
8440
  this.write(VNodeDataChar.CLOSE_CHAR);
8441
+ } else if (value === WRITE_ELEMENT_ATTRS) {
8442
+ if (fragmentAttrs && fragmentAttrs.length) {
8443
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
8444
+ writeFragmentAttrs(this.write.bind(this), this.addRoot.bind(this), fragmentAttrs);
8445
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
8446
+ fragmentAttrs = vNodeAttrsStack.pop();
8447
+ }
8281
8448
  } else if (value >= 0) {
8282
8449
  this.write(encodeAsAlphanumeric(value));
8283
8450
  } else {
@@ -8330,6 +8497,9 @@ var SSRContainer = class extends import_core3._SharedContainer {
8330
8497
  case ELEMENT_SEQ_IDX:
8331
8498
  write(VNodeDataChar.SEQ_IDX_CHAR);
8332
8499
  break;
8500
+ case QSubscribers:
8501
+ write(VNodeDataChar.SUBS_CHAR);
8502
+ break;
8333
8503
  // Skipping `\` character for now because it is used for escaping.
8334
8504
  case QCtxAttr:
8335
8505
  write(VNodeDataChar.CONTEXT_CHAR);
@@ -8534,10 +8704,10 @@ var SSRContainer = class extends import_core3._SharedContainer {
8534
8704
  );
8535
8705
  const lastNode = this.getLastNode();
8536
8706
  if (lastNode.vnodeData) {
8537
- lastNode.vnodeData[0] |= 8 /* SERIALIZE */;
8707
+ lastNode.vnodeData[0] |= 16 /* SERIALIZE */;
8538
8708
  }
8539
8709
  ssrComponentNode == null ? void 0 : ssrComponentNode.setProp(value, lastNode.id);
8540
- await (0, import_core3._walkJSX)(this, children, {
8710
+ await (0, import_core4._walkJSX)(this, children, {
8541
8711
  allowPromises: true,
8542
8712
  currentStyleScoped: scopedStyleId,
8543
8713
  parentComponentFrame: null
@@ -8657,7 +8827,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8657
8827
  let styleScopedId = null;
8658
8828
  if (isSSRUnsafeAttr(key)) {
8659
8829
  if (import_build10.isDev) {
8660
- throw new Error("Attribute value is unsafe for SSR");
8830
+ throw qError(51 /* unsafeAttr */);
8661
8831
  }
8662
8832
  continue;
8663
8833
  }
@@ -8668,17 +8838,19 @@ var SSRContainer = class extends import_core3._SharedContainer {
8668
8838
  }
8669
8839
  if (key === "ref") {
8670
8840
  const lastNode = this.getLastNode();
8671
- if ((0, import_core3.isSignal)(value)) {
8841
+ if ((0, import_core4.isSignal)(value)) {
8672
8842
  value.value = new DomRef(lastNode);
8673
8843
  continue;
8674
8844
  } else if (typeof value === "function") {
8675
8845
  value(new DomRef(lastNode));
8676
8846
  continue;
8847
+ } else {
8848
+ throw qError(32 /* invalidRefValue */);
8677
8849
  }
8678
8850
  }
8679
- if ((0, import_core3.isSignal)(value)) {
8851
+ if ((0, import_core4.isSignal)(value)) {
8680
8852
  const lastNode = this.getLastNode();
8681
- const signalData = new import_core3._EffectData({
8853
+ const signalData = new import_core4._EffectData({
8682
8854
  $scopedStyleIdPrefix$: styleScopedId,
8683
8855
  $isConst$: isConst
8684
8856
  });
@@ -8695,7 +8867,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8695
8867
  if (tag === "textarea" && key === "value") {
8696
8868
  if (typeof value !== "string") {
8697
8869
  if (import_build10.isDev) {
8698
- throw new Error("The value of the textarea must be a string");
8870
+ throw qError(40 /* wrongTextareaValue */);
8699
8871
  }
8700
8872
  continue;
8701
8873
  }
@@ -8731,7 +8903,7 @@ var isQwikStyleElement = (tag, attrs) => {
8731
8903
  return false;
8732
8904
  };
8733
8905
  function newTagError(text) {
8734
- return new Error("SsrError(tag): " + text);
8906
+ return qError(29 /* tagError */, [text]);
8735
8907
  }
8736
8908
  function hasDestroy(obj) {
8737
8909
  return obj && typeof obj === "object" && typeof obj.$destroy$ === "function";
@@ -8947,22 +9119,10 @@ function resolveManifest(manifest) {
8947
9119
  }
8948
9120
  var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
8949
9121
 
8950
- // packages/qwik/src/server/scripts.ts
8951
- var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))o.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",o=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\\\:"+n+"]")[c]((o=>g(o,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,o,r,a=r.type)=>{const c="on"+o+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,r],(()=>t[p]))(r,t),o=r.cancelBubble;q(n)&&await n,o&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,o);const h=t[f](c);if(h){const o=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=o[f]("q:base"),c=o[f]("q:version")||"unknown",l=o[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=o.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(o),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[n];if(t[p]){const o=async(a=0)=>{try{e[n]=[t,r,u],A||E("qsymbol",s({},_));const o=m(r,t);q(o)&&await o}catch(e){q(e)&&a<100?e.then((()=>o(a++))):E("qerror",s({error:e},_))}finally{e[n]=k}};o()}}}},E=(t,n)=>{e.dispatchEvent(v(t,n))},A=e=>e[i](/([A-Z])/g,(e=>"-"+e.toLowerCase())),_=async e=>{let t=A(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const o=g(n,"",e,t);let r=e.cancelBubble;q(o)&&await o,r=r||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==r?n.parentElement:null}},k=e=>{m("-window",e,A(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,E("qinit"),(null!=(n=o.requestIdleCallback)?n:o.setTimeout).bind(o)((()=>E("qidle"))),r.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),g(n[l],"",v(b,n)))}));e[c]((e=>t.observe(e)))}},O=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(o,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=o.qwikevents;Array.isArray(t)&&S(...t),o.qwikevents={events:r,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
8952
- var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
8953
- function getQwikLoaderScript(opts = {}) {
8954
- return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
8955
- }
8956
- var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
8957
- var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
8958
- function getQwikPrefetchWorkerScript(opts = {}) {
8959
- return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
8960
- }
8961
-
8962
9122
  // packages/qwik/src/server/index.ts
8963
9123
  async function setServerPlatform2(manifest) {
8964
9124
  const platform = createPlatform({ manifest }, resolveManifest(manifest));
8965
- (0, import_core4.setPlatform)(platform);
9125
+ (0, import_core5.setPlatform)(platform);
8966
9126
  }
8967
9127
  // Annotate the CommonJS export names for ESM import in node:
8968
9128
  0 && (module.exports = {