@qwik.dev/core 2.0.0-beta.30 → 2.0.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-beta.30-dev+5421ed4
3
+ * @qwik.dev/core/testing 2.0.0-beta.31-dev+906321a
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
@@ -24287,7 +24287,106 @@ Object.freeze(EMPTY_ARRAY);
24287
24287
  Object.freeze(EMPTY_OBJ);
24288
24288
 
24289
24289
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
24290
- import { isBrowser as isBrowser3, isDev as isDev20 } from "@qwik.dev/core/build";
24290
+ import { isBrowser as isBrowser4, isDev as isDev20 } from "@qwik.dev/core/build";
24291
+
24292
+ // packages/qwik/src/core/shared/qrl/qrl-class-dev.ts
24293
+ import { isBrowser } from "@qwik.dev/core/build";
24294
+ var initLazyRefDev = (lazy) => {
24295
+ lazy.dev = null;
24296
+ if (typeof document !== "undefined") {
24297
+ lazy.qrls = /* @__PURE__ */ new Set();
24298
+ }
24299
+ };
24300
+ var initQrlClassDev = (lazy, captures, qrl) => {
24301
+ if (captures && typeof captures === "object") {
24302
+ for (let i = 0; i < captures.length; i++) {
24303
+ const item = captures[i];
24304
+ verifySerializable(item, "Captured variable in the closure can not be serialized");
24305
+ }
24306
+ }
24307
+ if (lazy.qrls) {
24308
+ lazy.qrls.add(new WeakRef(qrl));
24309
+ }
24310
+ };
24311
+ var setupHmr = (LazyRefClass, setGetLazyRef) => {
24312
+ if (!(isBrowser && import.meta.hot)) {
24313
+ return;
24314
+ }
24315
+ const allLazyRefs = /* @__PURE__ */ new Map();
24316
+ setGetLazyRef((chunk, symbol, symbolFn, ref, container) => {
24317
+ let lazyRef = allLazyRefs.get(symbol);
24318
+ if (!lazyRef) {
24319
+ lazyRef = new LazyRefClass(chunk, symbol, symbolFn, ref, container);
24320
+ if (chunk !== "") {
24321
+ allLazyRefs.set(symbol, lazyRef);
24322
+ }
24323
+ }
24324
+ return lazyRef;
24325
+ });
24326
+ const bustTimestamp = (url, t) => {
24327
+ const [path, query] = url.split("?", 2);
24328
+ if (!query) {
24329
+ return `${path}?t=${t}`;
24330
+ }
24331
+ const params = query.split("&").filter((p) => !p.startsWith("t="));
24332
+ params.push(`t=${t}`);
24333
+ return `${path}?${params.join("&")}`;
24334
+ };
24335
+ document.addEventListener("qHmr", (ev) => {
24336
+ const files = ev.detail.files;
24337
+ const t = ev.detail.t || document.__hmrT || Date.now();
24338
+ let didReload = false;
24339
+ for (const lazy of allLazyRefs.values()) {
24340
+ const devFile = lazy.dev?.file || lazy.$chunk$;
24341
+ if (!devFile || !files.some((file) => devFile.startsWith(file))) {
24342
+ continue;
24343
+ }
24344
+ const chunk = lazy.$chunk$;
24345
+ if (chunk) {
24346
+ lazy.$chunk$ = bustTimestamp(chunk, t);
24347
+ didReload = true;
24348
+ }
24349
+ const fnStr = lazy.$symbolFn$?.toString();
24350
+ if (fnStr) {
24351
+ const newStr = fnStr.replace(/import\((['"])(.+?)\1\)/, (match, p1, p2) => {
24352
+ const newPath = bustTimestamp(p2, t);
24353
+ return `import(${p1}${newPath}${p1})`;
24354
+ });
24355
+ if (newStr !== fnStr) {
24356
+ try {
24357
+ lazy.$symbolFn$ = new Function(`return (${newStr})`)();
24358
+ didReload = true;
24359
+ } catch (err) {
24360
+ console.error(`Failed to update symbolFn for ${lazy.$symbol$}`, err);
24361
+ }
24362
+ } else {
24363
+ console.warn(
24364
+ `Couldn't find import() in symbolFn for ${lazy.$symbol$}, cannot update it for HMR`,
24365
+ fnStr
24366
+ );
24367
+ }
24368
+ }
24369
+ if (didReload) {
24370
+ lazy.$ref$ = void 0;
24371
+ document.__hmrDone = document.__hmrT;
24372
+ if (lazy.qrls) {
24373
+ for (const qrlRef of lazy.qrls) {
24374
+ const qrl = qrlRef.deref();
24375
+ if (qrl) {
24376
+ if (qrl.resolved) {
24377
+ qrl.resolved = void 0;
24378
+ }
24379
+ } else {
24380
+ lazy.qrls.delete(qrlRef);
24381
+ }
24382
+ }
24383
+ }
24384
+ }
24385
+ }
24386
+ });
24387
+ };
24388
+
24389
+ // packages/qwik/src/core/shared/qrl/qrl-class.ts
24291
24390
  import { p as preload } from "@qwik.dev/core/preloader";
24292
24391
 
24293
24392
  // packages/qwik/src/core/shared/serdes/inflate.ts
@@ -24738,7 +24837,7 @@ var isPropsProxy = (obj) => {
24738
24837
  };
24739
24838
 
24740
24839
  // packages/qwik/src/core/reactive-primitives/impl/async-signal-impl.ts
24741
- import { isBrowser, isDev as isDev10, isServer as isServer5 } from "@qwik.dev/core/build";
24840
+ import { isBrowser as isBrowser2, isDev as isDev10, isServer as isServer5 } from "@qwik.dev/core/build";
24742
24841
 
24743
24842
  // packages/qwik/src/core/reactive-primitives/subscriber.ts
24744
24843
  import { isServer as isServer4 } from "@qwik.dev/core/build";
@@ -24800,7 +24899,8 @@ var cleanupFn = (target, handleError) => {
24800
24899
  target.$destroy$ = () => {
24801
24900
  target.$destroy$ = null;
24802
24901
  let cleanupPromises = null;
24803
- for (const fn2 of cleanupFns) {
24902
+ for (let i = 0; i < cleanupFns.length; i++) {
24903
+ const fn2 = cleanupFns[i];
24804
24904
  try {
24805
24905
  const result2 = fn2();
24806
24906
  if (isPromise(result2)) {
@@ -24904,8 +25004,10 @@ var log3 = (...args) => (
24904
25004
  console.log("ASYNC COMPUTED SIGNAL", ...args.map(qwikDebugToString))
24905
25005
  );
24906
25006
  var AsyncJob = class {
24907
- constructor($signal$) {
25007
+ constructor($signal$, info, $infoVersion$) {
24908
25008
  this.$signal$ = $signal$;
25009
+ this.info = info;
25010
+ this.$infoVersion$ = $infoVersion$;
24909
25011
  /** First holds the compute promise and then the cleanup promise */
24910
25012
  __publicField(this, "$promise$", null);
24911
25013
  __publicField(this, "$cleanupRequested$", false);
@@ -24952,6 +25054,8 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
24952
25054
  __publicField(this, "$concurrency$", 1);
24953
25055
  __publicField(this, "$interval$", 0);
24954
25056
  __publicField(this, "$timeoutMs$");
25057
+ __publicField(this, "$info$");
25058
+ __publicField(this, "$infoVersion$", 0);
24955
25059
  __publicField(this, _a3);
24956
25060
  const interval = options?.interval;
24957
25061
  const concurrency = options?.concurrency ?? 1;
@@ -25001,6 +25105,32 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
25001
25105
  set untrackedValue(value) {
25002
25106
  this.$untrackedValue$ = value;
25003
25107
  }
25108
+ /**
25109
+ * Read the value, subscribing if in a tracking context. Triggers computation if needed.
25110
+ *
25111
+ * Setting the value will mark the signal as not loading and clear any error, and prevent any
25112
+ * pending computations from writing their results.
25113
+ *
25114
+ * If you want to set the value without affecting loading or error state, set `untrackedValue`
25115
+ * instead and make sure to trigger effects manually if needed.
25116
+ *
25117
+ * If you want to abort pending computations when setting, you have to call `abort()` manually.
25118
+ */
25119
+ get value() {
25120
+ return super.value;
25121
+ }
25122
+ set value(value) {
25123
+ this.$flags$ &= ~1 /* INVALID */;
25124
+ this.untrackedLoading = false;
25125
+ this.untrackedError = void 0;
25126
+ this.$info$ = void 0;
25127
+ for (let i = 0; i < this.$jobs$.length; i++) {
25128
+ this.$jobs$[i].$canWrite$ = false;
25129
+ }
25130
+ this.$clearNextPoll$();
25131
+ super.value = value;
25132
+ this.$scheduleNextPoll$();
25133
+ }
25004
25134
  /**
25005
25135
  * Loading is true if the signal is still waiting for the promise to resolve, false if the promise
25006
25136
  * has resolved or rejected.
@@ -25073,14 +25203,18 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
25073
25203
  set interval(value) {
25074
25204
  this.$clearNextPoll$();
25075
25205
  this.$interval$ = value;
25076
- if (this.$interval$ > 0 && this.$effects$?.size) {
25206
+ if (this.$interval$ !== 0 && this.$hasSubscribers$()) {
25077
25207
  this.$scheduleNextPoll$();
25078
25208
  }
25079
25209
  }
25080
25210
  /** Invalidates the signal, causing it to re-compute its value. */
25081
- async invalidate() {
25211
+ async invalidate(info) {
25082
25212
  this.$flags$ |= 1 /* INVALID */;
25083
25213
  this.$clearNextPoll$();
25214
+ if (arguments.length > 0) {
25215
+ this.$info$ = info;
25216
+ this.$infoVersion$++;
25217
+ }
25084
25218
  if (this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size) {
25085
25219
  await true;
25086
25220
  this.$computeIfNeeded$();
@@ -25097,7 +25231,7 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
25097
25231
  if (!(this.$flags$ & 32 /* EAGER_CLEANUP */) || this.$hasSubscribers$()) {
25098
25232
  return;
25099
25233
  }
25100
- if (!(import.meta.env.TEST ? !isServerPlatform() : isBrowser)) {
25234
+ if (!(import.meta.env.TEST ? !isServerPlatform() : isBrowser2)) {
25101
25235
  return;
25102
25236
  }
25103
25237
  setTimeout(() => {
@@ -25134,7 +25268,8 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
25134
25268
  }
25135
25269
  DEBUG3 && log3("Starting new async computation");
25136
25270
  this.$flags$ &= ~1 /* INVALID */;
25137
- const running = new AsyncJob(this);
25271
+ const infoVersion = this.$infoVersion$;
25272
+ const running = new AsyncJob(this, this.$info$, infoVersion);
25138
25273
  this.$current$ = running;
25139
25274
  this.$jobs$.push(running);
25140
25275
  running.$promise$ = this.$runComputation$(running);
@@ -25154,7 +25289,8 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
25154
25289
  }
25155
25290
  }, this.$timeoutMs$);
25156
25291
  }
25157
- const value = await retryOnPromise(fn.bind(null, running));
25292
+ const valuePromise = retryOnPromise(fn.bind(null, running));
25293
+ const value = isPromise(valuePromise) ? await valuePromise : valuePromise;
25158
25294
  running.$promise$ = null;
25159
25295
  if (running.$canWrite$) {
25160
25296
  const index = this.$jobs$.indexOf(running);
@@ -25165,7 +25301,7 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
25165
25301
  }
25166
25302
  DEBUG3 && log3("Promise resolved", value);
25167
25303
  this.untrackedError = void 0;
25168
- this.value = value;
25304
+ super.value = value;
25169
25305
  }
25170
25306
  } catch (err) {
25171
25307
  running.$promise$ = null;
@@ -25176,6 +25312,9 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
25176
25312
  }
25177
25313
  if (isCurrent()) {
25178
25314
  clearTimeout(this.$computationTimeoutId$);
25315
+ if (running.$infoVersion$ === this.$infoVersion$) {
25316
+ this.$info$ = void 0;
25317
+ }
25179
25318
  if (this.$flags$ & 1 /* INVALID */) {
25180
25319
  DEBUG3 && log3("Computation finished but signal is invalid, re-running");
25181
25320
  this.$computeIfNeeded$();
@@ -25201,11 +25340,19 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a3 = _EFFECT_BAC
25201
25340
  }
25202
25341
  }
25203
25342
  $scheduleNextPoll$() {
25204
- if ((import.meta.env.TEST ? !isServerPlatform() : isBrowser) && this.$interval$ > 0) {
25205
- this.$clearNextPoll$();
25343
+ if (!(import.meta.env.TEST ? !isServerPlatform() : isBrowser2) || this.$interval$ === 0) {
25344
+ return;
25345
+ }
25346
+ this.$clearNextPoll$();
25347
+ if (this.$interval$ < 0) {
25348
+ this.$pollTimeoutId$ = setTimeout(() => {
25349
+ this.$pollTimeoutId$ = void 0;
25350
+ this.$flags$ |= 1 /* INVALID */;
25351
+ }, -this.$interval$);
25352
+ } else {
25206
25353
  this.$pollTimeoutId$ = setTimeout(this.invalidate.bind(this), this.$interval$);
25207
- this.$pollTimeoutId$?.unref?.();
25208
25354
  }
25355
+ this.$pollTimeoutId$?.unref?.();
25209
25356
  }
25210
25357
  $hasSubscribers$() {
25211
25358
  return !!(this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size);
@@ -25398,6 +25545,7 @@ function removeCursorFromQueue(cursor, container, keepCursorFlag) {
25398
25545
  var cursorDatas = /* @__PURE__ */ new WeakMap();
25399
25546
  var NODE_PROPS_DATA_KEY = ":nodeProps";
25400
25547
  var NODE_DIFF_DATA_KEY = ":nodeDiff";
25548
+ var ERROR_DATA_KEY = ":errorData";
25401
25549
  var HOST_SIGNAL = ":signal";
25402
25550
  function setCursorPosition(container, cursorData, position) {
25403
25551
  cursorData.position = position;
@@ -25770,13 +25918,15 @@ var vnode_getElementNamespaceFlags = (element) => {
25770
25918
  };
25771
25919
  function cloneDomTreeWithNamespace(element, elementName, namespace, deep = false) {
25772
25920
  const newElement = element.ownerDocument.createElementNS(namespace, elementName);
25773
- for (const attr of element.attributes) {
25921
+ for (let i = 0; i < element.attributes.length; i++) {
25922
+ const attr = element.attributes[i];
25774
25923
  if (attr.name !== Q_PROPS_SEPARATOR) {
25775
25924
  newElement.setAttribute(attr.name, attr.value);
25776
25925
  }
25777
25926
  }
25778
25927
  if (deep) {
25779
- for (const child of element.childNodes) {
25928
+ for (let i = 0; i < element.childNodes.length; i++) {
25929
+ const child = element.childNodes[i];
25780
25930
  const nodeType = child.nodeType;
25781
25931
  if (nodeType === 3) {
25782
25932
  newElement.appendChild(child.cloneNode());
@@ -26415,7 +26565,8 @@ var serializeClass = (obj) => {
26415
26565
  }
26416
26566
  const classes = [];
26417
26567
  if (isArray(obj)) {
26418
- for (const o of obj) {
26568
+ for (let i = 0; i < obj.length; i++) {
26569
+ const o = obj[i];
26419
26570
  const classList = serializeClass(o);
26420
26571
  if (classList) {
26421
26572
  classes.push(classList);
@@ -27038,15 +27189,16 @@ function getSlotNameKey(diffContext, vHost) {
27038
27189
  return directGetPropsProxyProp(jsxNode, "name") || QDefaultSlot;
27039
27190
  }
27040
27191
  function cleanupSideBuffer(diffContext) {
27041
- if (diffContext.$vSideBuffer$) {
27042
- for (const vNode of diffContext.$vSideBuffer$.values()) {
27192
+ const sideBuffer = diffContext.$vSideBuffer$;
27193
+ if (sideBuffer) {
27194
+ for (const vNode of sideBuffer.values()) {
27043
27195
  if (vNode.flags & 32 /* Deleted */) {
27044
27196
  continue;
27045
27197
  }
27046
27198
  cleanup(diffContext.$container$, diffContext.$journal$, vNode, diffContext.$cursor$);
27047
27199
  vnode_remove(diffContext.$journal$, diffContext.$vParent$, vNode, true);
27048
27200
  }
27049
- diffContext.$vSideBuffer$.clear();
27201
+ sideBuffer.clear();
27050
27202
  diffContext.$vSideBuffer$ = null;
27051
27203
  }
27052
27204
  diffContext.$vCurrent$ = null;
@@ -27849,7 +28001,9 @@ function cleanup(container, journal, vNode, cursorRoot = null) {
27849
28001
  }
27850
28002
  const attrs = vCursor.props;
27851
28003
  if (attrs) {
27852
- for (const key of Object.keys(attrs)) {
28004
+ const keys = Object.keys(attrs);
28005
+ for (let i = 0; i < keys.length; i++) {
28006
+ const key = keys[i];
27853
28007
  if (isSlotProp(key)) {
27854
28008
  const value = attrs[key];
27855
28009
  if (value) {
@@ -27948,7 +28102,8 @@ function containsWrappedSignal(data, signal) {
27948
28102
  if (!(signal instanceof WrappedSignalImpl)) {
27949
28103
  return false;
27950
28104
  }
27951
- for (const item of data) {
28105
+ for (let i = 0; i < data.length; i++) {
28106
+ const item = data[i];
27952
28107
  if (item instanceof WrappedSignalImpl && areWrappedSignalsEqual(item, signal)) {
27953
28108
  return true;
27954
28109
  }
@@ -28218,7 +28373,8 @@ function executeTasks(vNode, container, cursorData) {
28218
28373
  return;
28219
28374
  }
28220
28375
  let taskPromise;
28221
- for (const item of elementSeq) {
28376
+ for (let i = 0; i < elementSeq.length; i++) {
28377
+ const item = elementSeq[i];
28222
28378
  if (item instanceof Task) {
28223
28379
  const task = item;
28224
28380
  if (!(task.$flags$ & 4 /* DIRTY */)) {
@@ -28249,6 +28405,36 @@ function setNodeDiffPayload(vNode, payload) {
28249
28405
  const props = vNode.props || (vNode.props = {});
28250
28406
  props[NODE_DIFF_DATA_KEY] = payload;
28251
28407
  }
28408
+ function getErrorPayload(vNode) {
28409
+ const props = vNode.props;
28410
+ return props?.[ERROR_DATA_KEY] ?? null;
28411
+ }
28412
+ function setErrorPayload(vNode, error) {
28413
+ const props = vNode.props || (vNode.props = {});
28414
+ props[ERROR_DATA_KEY] = error;
28415
+ }
28416
+ function executeErrorWrap(vNode, journal) {
28417
+ vNode.dirty &= ~256 /* ERROR_WRAP */;
28418
+ const err = getErrorPayload(vNode);
28419
+ if (!err) {
28420
+ return;
28421
+ }
28422
+ setErrorPayload(vNode, null);
28423
+ const vHost = vNode;
28424
+ const vHostParent = vHost.parent;
28425
+ const vHostNextSibling = vHost.nextSibling;
28426
+ const vErrorDiv = vnode_createErrorDiv(journal, document, vHost, err);
28427
+ const insertHost = vnode_isElementVNode(vHost) ? vHostParent || vHost : vHost;
28428
+ const insertBefore = insertHost === vHost ? null : vHostNextSibling;
28429
+ vnode_insertElementBefore(
28430
+ journal,
28431
+ insertHost,
28432
+ vErrorDiv,
28433
+ insertBefore
28434
+ );
28435
+ vNode.dirty &= ~32 /* CHILDREN */;
28436
+ vNode.dirtyChildren = null;
28437
+ }
28252
28438
  function executeNodeDiff(vNode, container, journal, cursor) {
28253
28439
  vNode.dirty &= ~2 /* NODE_DIFF */;
28254
28440
  const domVNode = vNode;
@@ -28358,7 +28544,8 @@ function executeCleanup(vNode, container) {
28358
28544
  if (!elementSeq || elementSeq.length === 0) {
28359
28545
  return;
28360
28546
  }
28361
- for (const item of elementSeq) {
28547
+ for (let i = 0; i < elementSeq.length; i++) {
28548
+ const item = elementSeq[i];
28362
28549
  if (item instanceof Task) {
28363
28550
  if (item.$flags$ & 16 /* NEEDS_CLEANUP */) {
28364
28551
  item.$flags$ &= ~16 /* NEEDS_CLEANUP */;
@@ -28557,8 +28744,8 @@ function executeAfterFlush(container, cursorData) {
28557
28744
  visibleTasks.map((t) => t.$qrl$.$symbol$)
28558
28745
  );
28559
28746
  let visibleTaskPromise;
28560
- for (const visibleTask of visibleTasks) {
28561
- const task = visibleTask;
28747
+ for (let i = 0; i < visibleTasks.length; i++) {
28748
+ const task = visibleTasks[i];
28562
28749
  const result2 = runTask(task, container, task.$el$);
28563
28750
  if (isPromise(result2)) {
28564
28751
  visibleTaskPromise = visibleTaskPromise ? visibleTaskPromise.then(() => result2) : result2;
@@ -28597,7 +28784,7 @@ var createMacroTask = (fn) => {
28597
28784
  };
28598
28785
 
28599
28786
  // packages/qwik/src/core/shared/cursor/cursor-walker.ts
28600
- import { isBrowser as isBrowser2, isDev as isDev16, isServer as isServer7 } from "@qwik.dev/core/build";
28787
+ import { isBrowser as isBrowser3, isDev as isDev16, isServer as isServer7 } from "@qwik.dev/core/build";
28601
28788
  var DEBUG6 = false;
28602
28789
  var nextMicroTask = createMicroTask(processCursorQueue);
28603
28790
  var nextMacroTask = createMacroTask(processCursorQueue);
@@ -28650,7 +28837,7 @@ function walkCursor(cursor, options) {
28650
28837
  if (cursorData.promise) {
28651
28838
  return;
28652
28839
  }
28653
- if (!(currentVNode.dirty & 255 /* DIRTY_MASK */)) {
28840
+ if (!(currentVNode.dirty & 511 /* DIRTY_MASK */)) {
28654
28841
  setCursorPosition(container, cursorData, getNextVNode(currentVNode, cursor));
28655
28842
  continue;
28656
28843
  }
@@ -28664,7 +28851,7 @@ function walkCursor(cursor, options) {
28664
28851
  continue;
28665
28852
  }
28666
28853
  }
28667
- currentVNode.dirty &= ~255 /* DIRTY_MASK */;
28854
+ currentVNode.dirty &= ~511 /* DIRTY_MASK */;
28668
28855
  setCursorPosition(container, cursorData, getNextVNode(currentVNode, cursor));
28669
28856
  continue;
28670
28857
  }
@@ -28688,6 +28875,8 @@ function walkCursor(cursor, options) {
28688
28875
  currentVNode = next;
28689
28876
  continue;
28690
28877
  }
28878
+ } else if (currentVNode.dirty & 256 /* ERROR_WRAP */) {
28879
+ executeErrorWrap(currentVNode, journal);
28691
28880
  }
28692
28881
  } catch (error) {
28693
28882
  container.handleError(error, currentVNode);
@@ -28706,7 +28895,7 @@ function walkCursor(cursor, options) {
28706
28895
  });
28707
28896
  return;
28708
28897
  }
28709
- if (isBrowser2) {
28898
+ if (isBrowser3) {
28710
28899
  const elapsed = performance.now() - startTime;
28711
28900
  if (elapsed >= timeBudget) {
28712
28901
  scheduleYield();
@@ -28715,16 +28904,16 @@ function walkCursor(cursor, options) {
28715
28904
  }
28716
28905
  }
28717
28906
  isDev16 && assertFalse(
28718
- !!(cursor.dirty & 255 /* DIRTY_MASK */ && !cursorData.position),
28907
+ !!(cursor.dirty & 511 /* DIRTY_MASK */ && !cursorData.position),
28719
28908
  "Cursor is still dirty and position is not set after walking"
28720
28909
  );
28721
28910
  finishWalk(container, cursor, cursorData, isRunningOnServer);
28722
28911
  }
28723
- function finishWalk(container, cursor, cursorData, isServer13) {
28724
- if (!(cursor.dirty & 255 /* DIRTY_MASK */)) {
28912
+ function finishWalk(container, cursor, cursorData, isServer15) {
28913
+ if (!(cursor.dirty & 511 /* DIRTY_MASK */)) {
28725
28914
  removeCursorFromQueue(cursor, container);
28726
28915
  DEBUG6 && console.warn("walkCursor: cursor done", cursor.toString());
28727
- if (!isServer13) {
28916
+ if (!isServer15) {
28728
28917
  executeFlushPhase(cursor, container);
28729
28918
  }
28730
28919
  if (cursorData.extraPromises) {
@@ -28768,7 +28957,7 @@ function partitionDirtyChildren(dirtyChildren, parent) {
28768
28957
  }
28769
28958
  function getNextVNode(vNode, cursor) {
28770
28959
  if (vNode === cursor) {
28771
- if (cursor.dirty & 255 /* DIRTY_MASK */) {
28960
+ if (cursor.dirty & 511 /* DIRTY_MASK */) {
28772
28961
  return cursor;
28773
28962
  }
28774
28963
  return null;
@@ -28780,7 +28969,7 @@ function getNextVNode(vNode, cursor) {
28780
28969
  parent = vNode.parent;
28781
28970
  }
28782
28971
  if (!parent) {
28783
- if (cursor.dirty & 255 /* DIRTY_MASK */) {
28972
+ if (cursor.dirty & 511 /* DIRTY_MASK */) {
28784
28973
  return cursor;
28785
28974
  }
28786
28975
  return null;
@@ -28791,7 +28980,7 @@ function getNextVNode(vNode, cursor) {
28791
28980
  let count = len;
28792
28981
  while (count-- > 0) {
28793
28982
  const nextVNode = dirtyChildren[index];
28794
- if (nextVNode.dirty & 255 /* DIRTY_MASK */) {
28983
+ if (nextVNode.dirty & 511 /* DIRTY_MASK */) {
28795
28984
  parent.nextDirtyChildIndex = (index + 1) % len;
28796
28985
  return nextVNode;
28797
28986
  }
@@ -28854,7 +29043,7 @@ function propagateToCursorRoot(vNode, cursorRoot) {
28854
29043
  reusablePath.push(vNode);
28855
29044
  let current = vNode.slotParent || vNode.parent;
28856
29045
  while (current) {
28857
- const isDirty = current.dirty & 255 /* DIRTY_MASK */;
29046
+ const isDirty = current.dirty & 511 /* DIRTY_MASK */;
28858
29047
  const currentIsCursor = isCursor(current);
28859
29048
  if (current === cursorRoot || isDirty) {
28860
29049
  propagatePath(current);
@@ -28908,8 +29097,8 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
28908
29097
  }
28909
29098
  return;
28910
29099
  }
28911
- const isRealDirty = bits & 255 /* DIRTY_MASK */;
28912
- if ((isRealDirty ? prevDirty & 255 /* DIRTY_MASK */ : prevDirty) || vNode === cursorRoot) {
29100
+ const isRealDirty = bits & 511 /* DIRTY_MASK */;
29101
+ if ((isRealDirty ? prevDirty & 511 /* DIRTY_MASK */ : prevDirty) || vNode === cursorRoot) {
28913
29102
  return;
28914
29103
  }
28915
29104
  const parent = vNode.slotParent || vNode.parent;
@@ -28917,7 +29106,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
28917
29106
  propagateToCursorRoot(vNode, cursorRoot);
28918
29107
  return;
28919
29108
  }
28920
- if (parent && parent.dirty & 255 /* DIRTY_MASK */) {
29109
+ if (parent && parent.dirty & 511 /* DIRTY_MASK */) {
28921
29110
  if (isRealDirty) {
28922
29111
  parent.dirty |= 32 /* CHILDREN */;
28923
29112
  }
@@ -29164,7 +29353,7 @@ function _executeSsrChores(container, ssrNode) {
29164
29353
  if (ssrNode.dirty & 16 /* COMPUTE */) {
29165
29354
  executeCompute(ssrNode, container);
29166
29355
  }
29167
- if (ssrNode.dirty & 255 /* DIRTY_MASK */) {
29356
+ if (ssrNode.dirty & 511 /* DIRTY_MASK */) {
29168
29357
  const warningMessage = `A chore was scheduled on a host element that has already been streamed to the client.
29169
29358
  This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
29170
29359
 
@@ -29175,7 +29364,7 @@ function _executeSsrChores(container, ssrNode) {
29175
29364
  This is often caused by modifying a signal in an already rendered component during SSR.`;
29176
29365
  logWarn(warningMessage);
29177
29366
  }
29178
- ssrNode.dirty &= ~255 /* DIRTY_MASK */;
29367
+ ssrNode.dirty &= ~511 /* DIRTY_MASK */;
29179
29368
  return;
29180
29369
  }
29181
29370
  let promise = null;
@@ -29189,7 +29378,7 @@ function _executeSsrChores(container, ssrNode) {
29189
29378
  const result2 = executeReconcileChore(container, ssrNode);
29190
29379
  promise = promise ? promise.then(() => result2) : result2;
29191
29380
  }
29192
- ssrNode.dirty &= ~(255 /* DIRTY_MASK */ & ~4 /* COMPONENT */);
29381
+ ssrNode.dirty &= ~(511 /* DIRTY_MASK */ & ~4 /* COMPONENT */);
29193
29382
  if (promise) {
29194
29383
  return promise;
29195
29384
  }
@@ -29201,7 +29390,8 @@ function executeTasksChore(container, ssrNode) {
29201
29390
  return null;
29202
29391
  }
29203
29392
  let promise = null;
29204
- for (const item of elementSeq) {
29393
+ for (let i = 0; i < elementSeq.length; i++) {
29394
+ const item = elementSeq[i];
29205
29395
  if (item instanceof Task) {
29206
29396
  const task = item;
29207
29397
  if (!(task.$flags$ & 4 /* DIRTY */)) {
@@ -29615,7 +29805,7 @@ var Serializer = class {
29615
29805
  const isInvalid = value.$flags$ & 1 /* INVALID */;
29616
29806
  const isSkippable = fastSkipSerialize(value.$untrackedValue$);
29617
29807
  const isAsync = value instanceof AsyncSignalImpl;
29618
- const interval = isAsync && value.$interval$ > 0 ? value.$interval$ : void 0;
29808
+ const interval = isAsync && value.$interval$ !== 0 ? value.$interval$ : void 0;
29619
29809
  const concurrency = isAsync && value.$concurrency$ !== 1 ? value.$concurrency$ : void 0;
29620
29810
  const timeout = isAsync && value.$timeoutMs$ !== 0 ? value.$timeoutMs$ : void 0;
29621
29811
  const asyncFlags = isAsync && value.$flags$ & ~24 /* SERIALIZATION_ALL_STRATEGIES */ || void 0;
@@ -29684,15 +29874,6 @@ var Serializer = class {
29684
29874
  const child = value.children[i];
29685
29875
  const childVNodeData = child.vnodeData;
29686
29876
  if (childVNodeData) {
29687
- for (let i2 = 0; i2 < childVNodeData.length; i2++) {
29688
- const value2 = childVNodeData[i2];
29689
- if (isSsrAttrs(value2)) {
29690
- const backRefs = tryGetBackRefs(value2);
29691
- if (backRefs) {
29692
- this.$serializationContext$.$addRoot$(backRefs);
29693
- }
29694
- }
29695
- }
29696
29877
  childVNodeData[0] |= 16 /* SERIALIZE */;
29697
29878
  }
29698
29879
  }
@@ -29898,9 +30079,6 @@ function serializeWrappingFn(serializationContext, value) {
29898
30079
  );
29899
30080
  return [syncFnId, value.$args$];
29900
30081
  }
29901
- function tryGetBackRefs(props) {
29902
- return Object.prototype.hasOwnProperty.call(props, QBackRefs) ? props[QBackRefs] : void 0;
29903
- }
29904
30082
  var SerializationWeakRef = class {
29905
30083
  constructor($obj$) {
29906
30084
  this.$obj$ = $obj$;
@@ -30408,7 +30586,8 @@ var inflate = (container, target, typeId, data) => {
30408
30586
  const bytes = target;
30409
30587
  const buf = atob(data);
30410
30588
  let i = 0;
30411
- for (const s of buf) {
30589
+ for (let j = 0; j < buf.length; j++) {
30590
+ const s = buf[j];
30412
30591
  bytes[i++] = s.charCodeAt(0);
30413
30592
  }
30414
30593
  break;
@@ -30558,6 +30737,9 @@ var ElementVNode = class extends VirtualVNode {
30558
30737
  };
30559
30738
 
30560
30739
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
30740
+ var getLazyRef = (chunk, symbol, symbolFn, ref, container) => {
30741
+ return new LazyRef(chunk, symbol, symbolFn, ref, container);
30742
+ };
30561
30743
  var LazyRef = class {
30562
30744
  constructor($chunk$, $symbol$, $symbolFn$, $ref$, container) {
30563
30745
  this.$chunk$ = $chunk$;
@@ -30565,18 +30747,14 @@ var LazyRef = class {
30565
30747
  this.$symbolFn$ = $symbolFn$;
30566
30748
  this.$ref$ = $ref$;
30567
30749
  __publicField(this, "$container$");
30568
- // Don't allocate dev property immediately so that in prod we don't have this property
30569
- __publicField(this, "dev");
30570
30750
  if ($ref$) {
30571
30751
  this.$setRef$($ref$);
30572
30752
  }
30573
30753
  if (container && !$ref$ && typeof $chunk$ === "string" && !$symbolFn$) {
30574
30754
  this.$container$ = container;
30575
30755
  }
30576
- if (qDev) {
30577
- this.dev = null;
30578
- }
30579
- if (isBrowser3 && $chunk$) {
30756
+ qDev && initLazyRefDev(this);
30757
+ if (isBrowser4 && $chunk$) {
30580
30758
  preload($chunk$, 0.8);
30581
30759
  }
30582
30760
  }
@@ -30608,7 +30786,7 @@ var LazyRef = class {
30608
30786
  const qFuncs2 = getQFuncs(doc2, hash2);
30609
30787
  return this.$ref$ = qFuncs2[Number(this.$symbol$)];
30610
30788
  }
30611
- if (isBrowser3 && this.$chunk$) {
30789
+ if (isBrowser4 && this.$chunk$) {
30612
30790
  preload(this.$chunk$, 1);
30613
30791
  }
30614
30792
  const symbol = this.$symbol$;
@@ -30621,6 +30799,9 @@ var LazyRef = class {
30621
30799
  return this.$ref$;
30622
30800
  }
30623
30801
  };
30802
+ isBrowser4 && import.meta.hot && setupHmr(LazyRef, (fn) => {
30803
+ getLazyRef = fn;
30804
+ });
30624
30805
  var QRL_STATE = /* @__PURE__ */ Symbol("qrl-state");
30625
30806
  var getInstance = (instance) => {
30626
30807
  return instance?.[QRL_STATE] ?? instance;
@@ -30637,13 +30818,7 @@ var QRLClass = class {
30637
30818
  if (typeof $captures$ === "string") {
30638
30819
  this.$container$ = container;
30639
30820
  }
30640
- if (qDev) {
30641
- if ($captures$ && typeof $captures$ === "object") {
30642
- for (const item of $captures$) {
30643
- verifySerializable(item, "Captured variable in the closure can not be serialized");
30644
- }
30645
- }
30646
- }
30821
+ qDev && initQrlClassDev($lazy$, $captures$, this);
30647
30822
  }
30648
30823
  if ($lazy$.$ref$ != null && typeof this.$captures$ !== "string" && !isPromise($lazy$.$ref$)) {
30649
30824
  this.resolved = bindCaptures(this, $lazy$.$ref$);
@@ -30755,6 +30930,13 @@ var QRL_FUNCTION_PROTO = Object.create(Function.prototype, {
30755
30930
  return this[QRL_STATE].$lazy$.dev;
30756
30931
  }
30757
30932
  },
30933
+ ...qDev ? {
30934
+ $setDev$: {
30935
+ value(dev) {
30936
+ this[QRL_STATE].$lazy$.dev = dev;
30937
+ }
30938
+ }
30939
+ } : void 0,
30758
30940
  $callFn$: {
30759
30941
  value: qrlCallFn
30760
30942
  },
@@ -30786,7 +30968,9 @@ var setCaptures = (captures) => {
30786
30968
  };
30787
30969
  var deserializeCaptures = (container, captures) => {
30788
30970
  const refs = [];
30789
- for (const id of captures.split(" ")) {
30971
+ const captureIds = captures.split(" ");
30972
+ for (let i = 0; i < captureIds.length; i++) {
30973
+ const id = captureIds[i];
30790
30974
  refs.push(container.$getObjectById$(id));
30791
30975
  }
30792
30976
  return refs;
@@ -30848,7 +31032,7 @@ var $resolve$ = (qrl, container) => {
30848
31032
  return maybePromise;
30849
31033
  };
30850
31034
  var createQRL = (chunk, symbol, symbolRef, symbolFn, captures, container) => {
30851
- const lazy = new LazyRef(chunk, symbol, symbolFn, symbolRef, container);
31035
+ const lazy = getLazyRef(chunk, symbol, symbolFn, symbolRef, container);
30852
31036
  const qrl = new QRLClass(lazy, captures, container);
30853
31037
  return makeQrlFn(qrl);
30854
31038
  };
@@ -31247,15 +31431,19 @@ function processVNodeData(document2) {
31247
31431
  const hasAttribute = prototype.hasAttribute;
31248
31432
  const getNodeType = getter(prototype, "nodeType");
31249
31433
  const attachVnodeDataAndRefs = (element) => {
31250
- Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script2) => {
31434
+ const scripts = element.querySelectorAll('script[type="qwik/vnode"]');
31435
+ for (let i = 0; i < scripts.length; i++) {
31436
+ const script2 = scripts[i];
31251
31437
  const qContainerElement = script2.closest("[q\\:container]");
31252
31438
  qContainerElement.qVnodeData = script2.textContent;
31253
31439
  qContainerElement.qVNodeRefs = /* @__PURE__ */ new Map();
31254
- });
31255
- element.querySelectorAll("[q\\:shadowroot]").forEach((parent) => {
31440
+ }
31441
+ const shadowRoots = element.querySelectorAll("[q\\:shadowroot]");
31442
+ for (let i = 0; i < shadowRoots.length; i++) {
31443
+ const parent = shadowRoots[i];
31256
31444
  const shadowRoot = parent.shadowRoot;
31257
31445
  shadowRoot && attachVnodeDataAndRefs(shadowRoot);
31258
- });
31446
+ }
31259
31447
  };
31260
31448
  attachVnodeDataAndRefs(document2);
31261
31449
  let NodeType;
@@ -31582,22 +31770,8 @@ var DomContainer = class extends _SharedContainer {
31582
31770
  handleError(err, host) {
31583
31771
  if (qDev && host) {
31584
31772
  if (typeof document !== "undefined") {
31585
- const createErrorWrapper = () => {
31586
- const vHost = host;
31587
- const vHostParent = vHost.parent;
31588
- const vHostNextSibling = vHost.nextSibling;
31589
- const journal = [];
31590
- const vErrorDiv = vnode_createErrorDiv(journal, document, vHost, err);
31591
- const insertHost = vnode_isElementVNode(vHost) ? vHostParent || vHost : vHost;
31592
- const insertBefore = insertHost === vHost ? null : vHostNextSibling;
31593
- vnode_insertElementBefore(
31594
- journal,
31595
- insertHost,
31596
- vErrorDiv,
31597
- insertBefore
31598
- );
31599
- };
31600
- this.$renderPromise$ ? this.$renderPromise$.then(createErrorWrapper) : createErrorWrapper();
31773
+ setErrorPayload(host, err);
31774
+ markVNodeDirty(this, host, 256 /* ERROR_WRAP */);
31601
31775
  }
31602
31776
  if (err && err instanceof Error) {
31603
31777
  if (!("hostElement" in err)) {
@@ -31673,7 +31847,9 @@ var DomContainer = class extends _SharedContainer {
31673
31847
  vNode.flags |= 16 /* Resolved */;
31674
31848
  const props = vNode.props;
31675
31849
  if (props) {
31676
- for (const prop of Object.keys(props)) {
31850
+ const propKeys = Object.keys(props);
31851
+ for (let i = 0; i < propKeys.length; i++) {
31852
+ const prop = propKeys[i];
31677
31853
  if (isSlotProp(prop)) {
31678
31854
  const value = props[prop];
31679
31855
  if (typeof value == "string") {
@@ -31699,9 +31875,11 @@ var DomContainer = class extends _SharedContainer {
31699
31875
  }
31700
31876
  if (this.$styleIds$ == null) {
31701
31877
  this.$styleIds$ = /* @__PURE__ */ new Set();
31702
- this.element.querySelectorAll(QStyleSelector).forEach((style) => {
31878
+ const styleElements = this.document.querySelectorAll(QStyleSelector);
31879
+ for (let i = 0; i < styleElements.length; i++) {
31880
+ const style = styleElements[i];
31703
31881
  this.$styleIds$.add(style.getAttribute(QStyle));
31704
- });
31882
+ }
31705
31883
  }
31706
31884
  if (!this.$styleIds$.has(styleId)) {
31707
31885
  this.$styleIds$.add(styleId);
@@ -32073,6 +32251,9 @@ var canSerialize = (value, seen = /* @__PURE__ */ new WeakSet()) => {
32073
32251
  return true;
32074
32252
  } else if (proto == Array.prototype) {
32075
32253
  for (let i = 0; i < value.length; i++) {
32254
+ if (!(i in value)) {
32255
+ return false;
32256
+ }
32076
32257
  if (!canSerialize(value[i], seen)) {
32077
32258
  return false;
32078
32259
  }
@@ -32086,6 +32267,8 @@ var canSerialize = (value, seen = /* @__PURE__ */ new WeakSet()) => {
32086
32267
  return true;
32087
32268
  } else if (isJSXNode(value)) {
32088
32269
  return true;
32270
+ } else if (isSerializerObj(value)) {
32271
+ return true;
32089
32272
  } else if (value instanceof Error) {
32090
32273
  return true;
32091
32274
  } else if (value instanceof URL) {
@@ -32292,16 +32475,23 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
32292
32475
  }
32293
32476
  if (isArray(unwrapped)) {
32294
32477
  let expectIndex = 0;
32295
- unwrapped.forEach((v, i) => {
32478
+ for (let i = 0; i < unwrapped.length; i++) {
32479
+ if (!(i in unwrapped)) {
32480
+ throw qError(3 /* verifySerializable */, [unwrapped]);
32481
+ }
32482
+ const v = unwrapped[i];
32296
32483
  if (i !== expectIndex) {
32297
32484
  throw qError(3 /* verifySerializable */, [unwrapped]);
32298
32485
  }
32299
32486
  _verifySerializable(v, seen, ctx + "[" + i + "]");
32300
32487
  expectIndex = i + 1;
32301
- });
32488
+ }
32302
32489
  return value;
32303
32490
  }
32304
- if (unwrapped.__brand) {
32491
+ if (unwrapped instanceof VNode) {
32492
+ return value;
32493
+ }
32494
+ if (unwrapped.__brand || unwrapped.__brand__) {
32305
32495
  return value;
32306
32496
  }
32307
32497
  if (isSerializableObject(unwrapped)) {
@@ -32387,7 +32577,7 @@ var addQrlToSerializationCtx = (effectSubscriber, container) => {
32387
32577
  }
32388
32578
  };
32389
32579
  var scheduleEffects = (container, signal, effects) => {
32390
- const isBrowser6 = import.meta.env.TEST ? !isServerPlatform() : !isServer12;
32580
+ const isBrowser8 = import.meta.env.TEST ? !isServerPlatform() : !isServer12;
32391
32581
  if (effects) {
32392
32582
  const scheduleEffect = (effectSubscription) => {
32393
32583
  const consumer = effectSubscription.consumer;
@@ -32401,7 +32591,7 @@ var scheduleEffects = (container, signal, effects) => {
32401
32591
  } else if (property === ":" /* COMPONENT */) {
32402
32592
  markVNodeDirty(container, consumer, 4 /* COMPONENT */);
32403
32593
  } else if (property === "." /* VNODE */) {
32404
- if (isBrowser6) {
32594
+ if (isBrowser8) {
32405
32595
  setNodeDiffPayload(consumer, signal);
32406
32596
  markVNodeDirty(container, consumer, 2 /* NODE_DIFF */);
32407
32597
  }
@@ -32414,7 +32604,7 @@ var scheduleEffects = (container, signal, effects) => {
32414
32604
  scopedStyleIdPrefix: data.$scopedStyleIdPrefix$,
32415
32605
  value: signal
32416
32606
  };
32417
- if (isBrowser6) {
32607
+ if (isBrowser8) {
32418
32608
  setNodePropData(consumer, property, payload);
32419
32609
  } else {
32420
32610
  const node = consumer;
@@ -32510,16 +32700,19 @@ var jsxToString = (value) => {
32510
32700
  }
32511
32701
  let str = "<" + value.type;
32512
32702
  if (value.props) {
32513
- for (const [key, val] of Object.entries(value.props)) {
32703
+ const propsEntries = Object.entries(value.props);
32704
+ for (let i = 0; i < propsEntries.length; i++) {
32705
+ const [key, val] = propsEntries[i];
32514
32706
  str += " " + key + "=" + qwikDebugToString(val);
32515
32707
  }
32516
32708
  const children = value.children;
32517
32709
  if (children != null) {
32518
32710
  str += ">";
32519
32711
  if (Array.isArray(children)) {
32520
- children.forEach((child) => {
32712
+ for (let i = 0; i < children.length; i++) {
32713
+ const child = children[i];
32521
32714
  str += jsxToString(child);
32522
- });
32715
+ }
32523
32716
  } else {
32524
32717
  str += jsxToString(children);
32525
32718
  }
@@ -33780,12 +33973,14 @@ function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings
33780
33973
  attrs.push(` dirty:${vnode.dirty}`);
33781
33974
  }
33782
33975
  if (container) {
33783
- vnode_getAttrKeys(container, vnode).forEach((key) => {
33976
+ const attrKeys = vnode_getAttrKeys(container, vnode);
33977
+ for (let i = 0; i < attrKeys.length; i++) {
33978
+ const key = attrKeys[i];
33784
33979
  if (key !== DEBUG_TYPE && key !== debugStyleScopeIdPrefixAttr) {
33785
33980
  const value = vnode_getProp(vnode, key, null);
33786
33981
  attrs.push(" " + key + "=" + qwikDebugToString(value));
33787
33982
  }
33788
- });
33983
+ }
33789
33984
  }
33790
33985
  const name = (colorize ? NAME_COL_PREFIX : "") + (VirtualTypeName[vnode_getProp(vnode, DEBUG_TYPE, null) || "V" /* Virtual */] || VirtualTypeName["V" /* Virtual */]) + (colorize ? NAME_COL_SUFFIX : "");
33791
33986
  strings.push("<" + name + attrs.join("") + ">");
@@ -33807,7 +34002,8 @@ function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings
33807
34002
  attrs.push(` dirtyChildren[${vnode.dirtyChildren.length}]`);
33808
34003
  }
33809
34004
  const keys = container ? vnode_getAttrKeys(container, vnode) : [];
33810
- for (const key of keys) {
34005
+ for (let i = 0; i < keys.length; i++) {
34006
+ const key = keys[i];
33811
34007
  const value = vnode_getProp(vnode, key, null);
33812
34008
  attrs.push(" " + key + "=" + qwikDebugToString(value));
33813
34009
  }
@@ -34140,9 +34336,12 @@ var MockShadowRoot = class extends import_domino.default.impl.DocumentFragment {
34140
34336
  this.ownerDocument = host.ownerDocument;
34141
34337
  }
34142
34338
  append(...nodes) {
34143
- for (const node of nodes) {
34339
+ for (let i = 0; i < nodes.length; i++) {
34340
+ const node = nodes[i];
34144
34341
  if (node.nodeType === 11) {
34145
- for (const child of Array.from(node.childNodes)) {
34342
+ const childNodes = Array.from(node.childNodes);
34343
+ for (let j = 0; j < childNodes.length; j++) {
34344
+ const child = childNodes[j];
34146
34345
  this.appendChild(child);
34147
34346
  }
34148
34347
  } else {
@@ -34665,9 +34864,10 @@ function diffJsxVNode(received, expected, path = [], container, isSsr) {
34665
34864
  receivedElement && propsAdd(allProps, constPropsFromElement(receivedElement));
34666
34865
  path.push(tagToString(expected.type));
34667
34866
  allProps.sort();
34668
- allProps.forEach((prop) => {
34867
+ for (let i = 0; i < allProps.length; i++) {
34868
+ const prop = allProps[i];
34669
34869
  if (isJsxPropertyAnEventName(prop) || isHtmlAttributeAnEventName(prop)) {
34670
- return;
34870
+ continue;
34671
34871
  }
34672
34872
  const propLowerCased = prop.toLowerCase();
34673
34873
  let convertNullToUndefined = false;
@@ -34691,7 +34891,7 @@ function diffJsxVNode(received, expected, path = [], container, isSsr) {
34691
34891
  diffs.push(" EXPECTED: " + JSON.stringify(expectedValue));
34692
34892
  diffs.push(" RECEIVED: " + JSON.stringify(receivedValue));
34693
34893
  }
34694
- });
34894
+ }
34695
34895
  diffJsxVNodeChildren(received, expected, path, container, isSsr, diffs);
34696
34896
  } else if (isSsr && isSkippableNode(expected)) {
34697
34897
  diffJsxVNodeChildren(received, expected, path, container, isSsr, diffs);
@@ -34745,7 +34945,8 @@ function getFilteredJSXChildren(children, isSsr, data) {
34745
34945
  }
34746
34946
  };
34747
34947
  function processChildren(children2) {
34748
- for (const child of children2) {
34948
+ for (let i = 0; i < children2.length; i++) {
34949
+ const child = children2[i];
34749
34950
  if (typeof child === "string" || typeof child === "number") {
34750
34951
  if (child !== "") {
34751
34952
  data.mergedText = typeof data.mergedText === "string" ? data.mergedText + child : String(child);
@@ -34805,9 +35006,11 @@ function jsxToHTML(jsx2, pad2 = "") {
34805
35006
  const html = [];
34806
35007
  if (jsx2.type) {
34807
35008
  html.push(pad2, "<", tagToString(jsx2.type), ">\n");
34808
- getJSXChildren(jsx2).forEach((jsx3) => {
35009
+ const children = getJSXChildren(jsx2);
35010
+ for (let i = 0; i < children.length; i++) {
35011
+ const jsx3 = children[i];
34809
35012
  html.push(jsxToHTML(jsx3, pad2 + " "));
34810
- });
35013
+ }
34811
35014
  html.push(pad2, "</", tagToString(jsx2.type), ">\n");
34812
35015
  } else {
34813
35016
  html.push(pad2, JSON.stringify(jsx2), "\n");
@@ -34839,7 +35042,8 @@ function walkJSX(jsx2, apply) {
34839
35042
  if (_isJSXNode(jsx2)) {
34840
35043
  apply.enter(jsx2);
34841
35044
  if (Array.isArray(jsx2.children)) {
34842
- for (const child of jsx2.children) {
35045
+ for (let i = 0; i < jsx2.children.length; i++) {
35046
+ const child = jsx2.children[i];
34843
35047
  processChild(child);
34844
35048
  }
34845
35049
  } else if (jsx2.children) {
@@ -34935,11 +35139,12 @@ function constPropsFromElement(element) {
34935
35139
  return props;
34936
35140
  }
34937
35141
  function propsAdd(existing, incoming) {
34938
- for (const prop of incoming) {
35142
+ for (let i = 0; i < incoming.length; i++) {
35143
+ const prop = incoming[i];
34939
35144
  if (prop !== "children") {
34940
35145
  let found = false;
34941
- for (let i = 0; i < existing.length; i++) {
34942
- if (existing[i].toLowerCase() === prop.toLowerCase()) {
35146
+ for (let j = 0; j < existing.length; j++) {
35147
+ if (existing[j].toLowerCase() === prop.toLowerCase()) {
34943
35148
  found = true;
34944
35149
  break;
34945
35150
  }
@@ -34990,7 +35195,9 @@ var ElementFixture = class {
34990
35195
  this.parent.innerHTML = options.html;
34991
35196
  this.host = this.parent.firstElementChild;
34992
35197
  assertDefined(this.host, "host element must be defined");
34993
- this.host.querySelectorAll('script[q\\:func="qwik/json"]').forEach((script2) => {
35198
+ const scripts = this.host.querySelectorAll('script[q\\:func="qwik/json"]');
35199
+ for (let i = 0; i < scripts.length; i++) {
35200
+ const script2 = scripts[i];
34994
35201
  const code2 = script2.textContent;
34995
35202
  if (code2?.match(Q_FUNCS_PREFIX)) {
34996
35203
  const equal = code2.indexOf("=");
@@ -34999,7 +35206,7 @@ var ElementFixture = class {
34999
35206
  const hash2 = container.getAttribute(QInstanceAttr);
35000
35207
  document[QFuncsPrefix + hash2] = qFuncs2;
35001
35208
  }
35002
- });
35209
+ }
35003
35210
  this.child = null;
35004
35211
  } else {
35005
35212
  this.host = this.document.createElement(options.tagName || "host");
@@ -35032,7 +35239,8 @@ async function trigger(root, queryOrElement, eventName, eventPayload = {}, optio
35032
35239
  }
35033
35240
  const elements = typeof queryOrElement === "string" ? Array.from(root.querySelectorAll(queryOrElement)) : [queryOrElement];
35034
35241
  let container = null;
35035
- for (const element of elements) {
35242
+ for (let i = 0; i < elements.length; i++) {
35243
+ const element = elements[i];
35036
35244
  if (!element) {
35037
35245
  continue;
35038
35246
  }
@@ -35075,7 +35283,8 @@ var dispatch = async (element, event, scopedKebabName, kebabName) => {
35075
35283
  if (typeof handlers === "function") {
35076
35284
  await handlers(event, element);
35077
35285
  } else if (handlers.length) {
35078
- for (const handler of handlers) {
35286
+ for (let i = 0; i < handlers.length; i++) {
35287
+ const handler = handlers[i];
35079
35288
  if (handler) {
35080
35289
  await handler(event, element);
35081
35290
  }
@@ -35085,7 +35294,9 @@ var dispatch = async (element, event, scopedKebabName, kebabName) => {
35085
35294
  } else if (element.hasAttribute("q-" + scopedKebabName)) {
35086
35295
  const qrls = element.getAttribute("q-" + scopedKebabName);
35087
35296
  try {
35088
- for (const qrl of qrls.split("|")) {
35297
+ const qrlsArray = qrls.split("|");
35298
+ for (let i = 0; i < qrlsArray.length; i++) {
35299
+ const qrl = qrlsArray[i];
35089
35300
  const [chunk, symbol, captures] = qrl.split("#");
35090
35301
  let fn;
35091
35302
  if (chunk) {
@@ -35180,7 +35391,8 @@ function toPath(url) {
35180
35391
  }
35181
35392
  const path = fileURLToPath(String(normalizedUrl));
35182
35393
  const importPaths = [path, ...testExts.map((ext) => path + ext)];
35183
- for (const importPath of importPaths) {
35394
+ for (let i = 0; i < importPaths.length; i++) {
35395
+ const importPath = importPaths[i];
35184
35396
  if (existsSync(importPath)) {
35185
35397
  return importPath;
35186
35398
  }
@@ -35234,19 +35446,24 @@ import { fileURLToPath as fileURLToPath2 } from "url";
35234
35446
  import { expect as expect2 } from "vitest";
35235
35447
 
35236
35448
  // packages/qwik/src/core/preloader/queue.ts
35237
- import { isBrowser as isBrowser5 } from "@qwik.dev/core/build";
35449
+ import { isBrowser as isBrowser7 } from "@qwik.dev/core/build";
35450
+
35451
+ // packages/qwik/src/core/preloader/bundle-graph.ts
35452
+ import { isServer as isServer14 } from "@qwik.dev/core/build";
35238
35453
 
35239
35454
  // packages/qwik/src/core/preloader/constants.ts
35240
- import { isBrowser as isBrowser4 } from "@qwik.dev/core/build";
35241
- var doc = isBrowser4 ? document : void 0;
35455
+ import { isServer as isServer13 } from "@qwik.dev/core/build";
35456
+ var isBrowser5 = import.meta.env.TEST ? !isServerPlatform() : !isServer13;
35457
+ var doc = isBrowser5 ? document : void 0;
35242
35458
  var config = {
35243
35459
  $DEBUG$: false,
35244
35460
  $maxIdlePreloads$: 25,
35245
35461
  $invPreloadProbability$: 0.65
35246
35462
  };
35247
- var rel = isBrowser4 && doc.createElement("link").relList.supports("modulepreload") ? "modulePreload" : "preload";
35248
- var loadStart = Date.now();
35463
+ var rel = isBrowser5 && doc.createElement("link").relList?.supports?.("modulepreload") ? "modulePreload" : "preload";
35464
+ var loadStart = performance.now();
35249
35465
  var isJSRegex = /\.[mc]?js$/;
35466
+ var yieldInterval = 1e3 / 60;
35250
35467
 
35251
35468
  // packages/qwik/src/core/preloader/types.ts
35252
35469
  var BundleImportState_None = 0;
@@ -35258,13 +35475,14 @@ var BundleImportState_Loaded = 4;
35258
35475
  // packages/qwik/src/core/preloader/bundle-graph.ts
35259
35476
  var base;
35260
35477
  var graph;
35478
+ var isBrowser6 = import.meta.env.TEST ? !isServerPlatform() : !isServer14;
35261
35479
  var makeBundle = (name, deps) => {
35262
35480
  return {
35263
35481
  $name$: name,
35264
35482
  $state$: isJSRegex.test(name) ? BundleImportState_None : BundleImportState_Alias,
35265
35483
  $deps$: shouldResetFactor ? deps?.map((d) => ({ ...d, $factor$: 1 })) : deps,
35266
35484
  $inverseProbability$: 1,
35267
- $createdTs$: Date.now(),
35485
+ $createdTs$: performance.now(),
35268
35486
  $waitedMs$: 0,
35269
35487
  $loadedMs$: 0
35270
35488
  };
@@ -35333,9 +35551,16 @@ var shouldResetFactor;
35333
35551
  var queueDirty;
35334
35552
  var preloadCount = 0;
35335
35553
  var queue = [];
35554
+ var nextTriggerMacroTask = createMacroTask(trigger2);
35555
+ var nextAdjustmentMacroTask = createMacroTask(processPendingAdjustments);
35556
+ var isTriggerScheduled = false;
35557
+ var isAdjustmentScheduled = false;
35558
+ var isProcessingAdjustments = false;
35559
+ var shouldYieldInBrowser = import.meta.env.TEST ? !isServerPlatform() : isBrowser7;
35560
+ var adjustmentStack = [];
35336
35561
  var log7 = (...args) => {
35337
35562
  console.log(
35338
- `Preloader ${Date.now() - loadStart}ms ${preloadCount}/${queue.length} queued>`,
35563
+ `Preloader ${performance.now() - loadStart}ms ${preloadCount}/${queue.length} queued>`,
35339
35564
  ...args
35340
35565
  );
35341
35566
  };
@@ -35345,6 +35570,10 @@ var resetQueue = () => {
35345
35570
  shouldResetFactor = true;
35346
35571
  preloadCount = 0;
35347
35572
  queue.length = 0;
35573
+ adjustmentStack.length = 0;
35574
+ isTriggerScheduled = false;
35575
+ isAdjustmentScheduled = false;
35576
+ isProcessingAdjustments = false;
35348
35577
  };
35349
35578
  var sortQueue = () => {
35350
35579
  if (queueDirty) {
@@ -35356,7 +35585,8 @@ var getQueue = () => {
35356
35585
  sortQueue();
35357
35586
  let probability = 0.4;
35358
35587
  const result2 = [];
35359
- for (const b of queue) {
35588
+ for (let i = 0; i < queue.length; i++) {
35589
+ const b = queue[i];
35360
35590
  const nextProbability = Math.round((1 - b.$inverseProbability$) * 10);
35361
35591
  if (nextProbability !== probability) {
35362
35592
  probability = nextProbability;
@@ -35366,11 +35596,14 @@ var getQueue = () => {
35366
35596
  }
35367
35597
  return result2;
35368
35598
  };
35369
- var trigger2 = () => {
35599
+ function trigger2() {
35600
+ isTriggerScheduled = false;
35370
35601
  if (!queue.length) {
35371
35602
  return;
35372
35603
  }
35373
35604
  sortQueue();
35605
+ const deadline = performance.now() + yieldInterval;
35606
+ let shouldYield = false;
35374
35607
  while (queue.length) {
35375
35608
  const bundle = queue[0];
35376
35609
  const inverseProbability = bundle.$inverseProbability$;
@@ -35382,10 +35615,18 @@ var trigger2 = () => {
35382
35615
  if (probability >= 0.99 || preloadCount < allowedPreloads) {
35383
35616
  queue.shift();
35384
35617
  preloadOne(bundle);
35618
+ if (performance.now() >= deadline) {
35619
+ shouldYield = true;
35620
+ break;
35621
+ }
35385
35622
  } else {
35386
35623
  break;
35387
35624
  }
35388
35625
  }
35626
+ if (shouldYield && queue.length && !isTriggerScheduled) {
35627
+ isTriggerScheduled = true;
35628
+ nextTriggerMacroTask();
35629
+ }
35389
35630
  if (config.$DEBUG$ && !queue.length) {
35390
35631
  const loaded = [...bundles.values()].filter((b) => b.$state$ > BundleImportState_None);
35391
35632
  const waitTime = loaded.reduce((acc, b) => acc + b.$waitedMs$, 0);
@@ -35394,13 +35635,112 @@ var trigger2 = () => {
35394
35635
  `>>>> done ${loaded.length}/${bundles.size} total: ${waitTime}ms waited, ${loadTime}ms loaded`
35395
35636
  );
35396
35637
  }
35638
+ }
35639
+ var enqueueAdjustment = (bundle, inverseProbability, context, seen) => {
35640
+ adjustmentStack.unshift({
35641
+ $bundle$: bundle,
35642
+ $inverseProbability$: inverseProbability,
35643
+ $seen$: seen,
35644
+ $context$: context
35645
+ });
35397
35646
  };
35647
+ var processAdjustmentFrame = () => {
35648
+ const frame = adjustmentStack[adjustmentStack.length - 1];
35649
+ const bundle = frame.$bundle$;
35650
+ if (frame.$deps$) {
35651
+ const index = frame.$index$;
35652
+ if (index >= frame.$deps$.length) {
35653
+ adjustmentStack.pop();
35654
+ return false;
35655
+ }
35656
+ const dep = frame.$deps$[index];
35657
+ frame.$index$ = index + 1;
35658
+ const depBundle = getBundle(dep.$name$);
35659
+ if (depBundle.$inverseProbability$ === 0) {
35660
+ return true;
35661
+ }
35662
+ const probability = 1 - bundle.$inverseProbability$;
35663
+ let newInverseProbability;
35664
+ if (probability === 1 || probability >= 0.99 && frame.$context$.$depsCount$ < 100) {
35665
+ frame.$context$.$depsCount$++;
35666
+ newInverseProbability = Math.min(0.01, 1 - dep.$importProbability$);
35667
+ } else {
35668
+ const newInverseImportProbability = 1 - dep.$importProbability$ * probability;
35669
+ const prevAdjust = dep.$factor$;
35670
+ const factor = newInverseImportProbability / prevAdjust;
35671
+ newInverseProbability = Math.max(0.02, depBundle.$inverseProbability$ * factor);
35672
+ dep.$factor$ = factor;
35673
+ }
35674
+ adjustmentStack.push({
35675
+ $bundle$: depBundle,
35676
+ $inverseProbability$: newInverseProbability,
35677
+ $seen$: frame.$seen$,
35678
+ $context$: frame.$context$
35679
+ });
35680
+ return true;
35681
+ }
35682
+ if (frame.$seen$?.has(bundle)) {
35683
+ adjustmentStack.pop();
35684
+ return false;
35685
+ }
35686
+ const previousInverseProbability = bundle.$inverseProbability$;
35687
+ bundle.$inverseProbability$ = frame.$inverseProbability$;
35688
+ if (previousInverseProbability - bundle.$inverseProbability$ < 0.01) {
35689
+ adjustmentStack.pop();
35690
+ return false;
35691
+ }
35692
+ if (
35693
+ // don't queue until we have initialized the preloader
35694
+ base != null && bundle.$state$ < BundleImportState_Preload
35695
+ ) {
35696
+ if (bundle.$state$ === BundleImportState_None) {
35697
+ bundle.$state$ = BundleImportState_Queued;
35698
+ queue.push(bundle);
35699
+ config.$DEBUG$ && log7(`queued ${Math.round((1 - bundle.$inverseProbability$) * 100)}%`, bundle.$name$);
35700
+ }
35701
+ queueDirty = true;
35702
+ }
35703
+ if (bundle.$deps$?.length) {
35704
+ const seen = frame.$seen$ || /* @__PURE__ */ new Set();
35705
+ seen.add(bundle);
35706
+ frame.$seen$ = seen;
35707
+ frame.$deps$ = bundle.$deps$;
35708
+ frame.$index$ = 0;
35709
+ return false;
35710
+ }
35711
+ adjustmentStack.pop();
35712
+ return false;
35713
+ };
35714
+ function processPendingAdjustments() {
35715
+ if (isProcessingAdjustments || !adjustmentStack.length) {
35716
+ return;
35717
+ }
35718
+ isAdjustmentScheduled = false;
35719
+ isProcessingAdjustments = true;
35720
+ const deadline = shouldYieldInBrowser ? performance.now() + yieldInterval : 0;
35721
+ let processed = false;
35722
+ while (adjustmentStack.length) {
35723
+ processed = true;
35724
+ const checkDeadline = processAdjustmentFrame();
35725
+ if (shouldYieldInBrowser && checkDeadline && performance.now() >= deadline) {
35726
+ if (!isAdjustmentScheduled) {
35727
+ isAdjustmentScheduled = true;
35728
+ nextAdjustmentMacroTask();
35729
+ }
35730
+ break;
35731
+ }
35732
+ }
35733
+ isProcessingAdjustments = false;
35734
+ if (processed && shouldYieldInBrowser) {
35735
+ nextTriggerMacroTask();
35736
+ }
35737
+ }
35398
35738
  var preloadOne = (bundle) => {
35399
35739
  if (bundle.$state$ >= BundleImportState_Preload) {
35400
35740
  return;
35401
35741
  }
35402
35742
  preloadCount++;
35403
- const start = Date.now();
35743
+ const start = performance.now();
35404
35744
  bundle.$waitedMs$ = start - bundle.$createdTs$;
35405
35745
  bundle.$state$ = BundleImportState_Preload;
35406
35746
  config.$DEBUG$ && log7(
@@ -35413,89 +35753,58 @@ var preloadOne = (bundle) => {
35413
35753
  link.as = "script";
35414
35754
  link.onload = link.onerror = () => {
35415
35755
  preloadCount--;
35416
- const end = Date.now();
35756
+ const end = performance.now();
35417
35757
  bundle.$loadedMs$ = end - start;
35418
35758
  bundle.$state$ = BundleImportState_Loaded;
35419
35759
  config.$DEBUG$ && log7(`>> done after ${bundle.$loadedMs$}ms`, bundle.$name$);
35420
35760
  link.remove();
35421
- trigger2();
35761
+ nextTriggerMacroTask();
35422
35762
  };
35423
35763
  doc.head.appendChild(link);
35424
35764
  };
35425
35765
  var adjustProbabilities = (bundle, newInverseProbability, seen) => {
35426
- if (seen?.has(bundle)) {
35427
- return;
35428
- }
35429
- const previousInverseProbability = bundle.$inverseProbability$;
35430
- bundle.$inverseProbability$ = newInverseProbability;
35431
- if (previousInverseProbability - bundle.$inverseProbability$ < 0.01) {
35432
- return;
35433
- }
35434
- if (
35435
- // don't queue until we have initialized the preloader
35436
- base != null && bundle.$state$ < BundleImportState_Preload
35437
- ) {
35438
- if (bundle.$state$ === BundleImportState_None) {
35439
- bundle.$state$ = BundleImportState_Queued;
35440
- queue.push(bundle);
35441
- config.$DEBUG$ && log7(`queued ${Math.round((1 - bundle.$inverseProbability$) * 100)}%`, bundle.$name$);
35442
- }
35443
- queueDirty = true;
35444
- }
35445
- if (bundle.$deps$) {
35446
- seen || (seen = /* @__PURE__ */ new Set());
35447
- seen.add(bundle);
35448
- const probability = 1 - bundle.$inverseProbability$;
35449
- for (const dep of bundle.$deps$) {
35450
- const depBundle = getBundle(dep.$name$);
35451
- if (depBundle.$inverseProbability$ === 0) {
35452
- continue;
35453
- }
35454
- let newInverseProbability2;
35455
- if (probability === 1 || probability >= 0.99 && depsCount < 100) {
35456
- depsCount++;
35457
- newInverseProbability2 = Math.min(0.01, 1 - dep.$importProbability$);
35458
- } else {
35459
- const newInverseImportProbability = 1 - dep.$importProbability$ * probability;
35460
- const prevAdjust = dep.$factor$;
35461
- const factor = newInverseImportProbability / prevAdjust;
35462
- newInverseProbability2 = Math.max(0.02, depBundle.$inverseProbability$ * factor);
35463
- dep.$factor$ = factor;
35464
- }
35465
- adjustProbabilities(depBundle, newInverseProbability2, seen);
35466
- }
35766
+ enqueueAdjustment(bundle, newInverseProbability, { $depsCount$: 0 }, seen);
35767
+ if (shouldYieldInBrowser) {
35768
+ nextAdjustmentMacroTask();
35769
+ } else {
35770
+ processPendingAdjustments();
35467
35771
  }
35468
35772
  };
35469
- var handleBundle = (name, inverseProbability) => {
35773
+ var handleBundle = (name, inverseProbability, context) => {
35470
35774
  const bundle = getBundle(name);
35471
35775
  if (bundle && bundle.$inverseProbability$ > inverseProbability) {
35472
- adjustProbabilities(bundle, inverseProbability);
35776
+ if (context) {
35777
+ enqueueAdjustment(bundle, inverseProbability, context);
35778
+ } else {
35779
+ adjustProbabilities(bundle, inverseProbability);
35780
+ }
35473
35781
  }
35474
35782
  };
35475
- var depsCount;
35476
35783
  var preload2 = (name, probability) => {
35477
35784
  if (!name?.length) {
35478
35785
  return;
35479
35786
  }
35480
- depsCount = 0;
35481
35787
  let inverseProbability = probability ? 1 - probability : 0.4;
35788
+ const context = { $depsCount$: 0 };
35482
35789
  if (Array.isArray(name)) {
35483
35790
  for (let i = name.length - 1; i >= 0; i--) {
35484
35791
  const item = name[i];
35485
35792
  if (typeof item === "number") {
35486
35793
  inverseProbability = 1 - item / 10;
35487
35794
  } else {
35488
- handleBundle(item, inverseProbability);
35795
+ handleBundle(item, inverseProbability, context);
35489
35796
  }
35490
35797
  }
35491
35798
  } else {
35492
- handleBundle(name, inverseProbability);
35799
+ handleBundle(name, inverseProbability, context);
35493
35800
  }
35494
- if (isBrowser5) {
35495
- trigger2();
35801
+ if (shouldYieldInBrowser) {
35802
+ nextAdjustmentMacroTask();
35803
+ } else {
35804
+ processPendingAdjustments();
35496
35805
  }
35497
35806
  };
35498
- if (isBrowser5) {
35807
+ if (import.meta.env.TEST ? !isServerPlatform() : isBrowser7) {
35499
35808
  document.addEventListener("qsymbol", (ev) => {
35500
35809
  const { symbol, href } = ev.detail;
35501
35810
  if (href) {
@@ -35629,7 +35938,8 @@ function flattenPrefetchResources(prefetchResources) {
35629
35938
  const urls = [];
35630
35939
  const addPrefetchResource = (prefetchResources2) => {
35631
35940
  if (prefetchResources2) {
35632
- for (const prefetchResource of prefetchResources2) {
35941
+ for (let i = 0; i < prefetchResources2.length; i++) {
35942
+ const prefetchResource = prefetchResources2[i];
35633
35943
  if (!urls.includes(prefetchResource.url)) {
35634
35944
  urls.push(prefetchResource.url);
35635
35945
  if (prefetchResource.imports) {
@@ -35676,8 +35986,8 @@ function getPreloadPaths(qrls, opts, resolvedManifest) {
35676
35986
  }
35677
35987
  }
35678
35988
  const symbols = /* @__PURE__ */ new Set();
35679
- for (const qrl of qrls) {
35680
- const symbol = getSymbolHash2(qrl.$symbol$);
35989
+ for (let i = 0; i < qrls.length; i++) {
35990
+ const symbol = getSymbolHash2(qrls[i].$symbol$);
35681
35991
  if (symbol && symbol.length >= 10) {
35682
35992
  symbols.add(symbol);
35683
35993
  }
@@ -35690,8 +36000,8 @@ var expandBundles = (names, resolvedManifest) => {
35690
36000
  }
35691
36001
  resetQueue();
35692
36002
  let probability = 0.99;
35693
- for (const name of names) {
35694
- preload2(name, probability);
36003
+ for (let i = 0; i < names.length; i++) {
36004
+ preload2(names[i], probability);
35695
36005
  probability *= 0.95;
35696
36006
  }
35697
36007
  return getQueue();
@@ -35704,7 +36014,8 @@ var simplifyPath = (base2, path) => {
35704
36014
  }
35705
36015
  const segments = `${base2}${path}`.split("/");
35706
36016
  const simplified = [];
35707
- for (const segment of segments) {
36017
+ for (let i = 0; i < segments.length; i++) {
36018
+ const segment = segments[i];
35708
36019
  if (segment === ".." && simplified.length > 0) {
35709
36020
  simplified.pop();
35710
36021
  } else {
@@ -35806,7 +36117,8 @@ var includePreloader = (container, options, referencedBundles, nonce) => {
35806
36117
  const expandedBundles = expandBundles(referencedBundles, resolvedManifest);
35807
36118
  let probability = 4;
35808
36119
  const tenXMinProbability = ssrPreloadProbability * 10;
35809
- for (const hrefOrProbability of expandedBundles) {
36120
+ for (let i = 0; i < expandedBundles.length; i++) {
36121
+ const hrefOrProbability = expandedBundles[i];
35810
36122
  if (typeof hrefOrProbability === "string") {
35811
36123
  if (probability < tenXMinProbability) {
35812
36124
  break;
@@ -35970,7 +36282,8 @@ var SsrNode = class {
35970
36282
  if (this.flags & 1 /* Updatable */) {
35971
36283
  this.flags &= ~1 /* Updatable */;
35972
36284
  if (this.children) {
35973
- for (const child of this.children) {
36285
+ for (let i = 0; i < this.children.length; i++) {
36286
+ const child = this.children[i];
35974
36287
  child.setTreeNonUpdatable();
35975
36288
  }
35976
36289
  }
@@ -36365,6 +36678,9 @@ var SSRContainer = class extends _SharedContainer2 {
36365
36678
  /** Renders opening tag for DOM element */
36366
36679
  openElement(elementName, key, varAttrs, constAttrs = null, styleScopedId = null, currentFile = null, hasMovedCaptures = true) {
36367
36680
  const isQwikStyle = isQwikStyleElement(elementName, varAttrs) || isQwikStyleElement(elementName, constAttrs);
36681
+ if (elementName === "noscript" || elementName === "template" || elementName === "script") {
36682
+ this.$noScriptHere$++;
36683
+ }
36368
36684
  if (
36369
36685
  // don't append qwik loader before qwik style elements
36370
36686
  // it will confuse the resuming, because styles are expected to be the first nodes in subtree
@@ -36372,8 +36688,6 @@ var SSRContainer = class extends _SharedContainer2 {
36372
36688
  ) {
36373
36689
  if (this.$noScriptHere$ === 0 && this.size > 30 * 1024 && elementName !== "body") {
36374
36690
  this.emitQwikLoaderInline();
36375
- } else if (elementName === "noscript" || elementName === "template") {
36376
- this.$noScriptHere$++;
36377
36691
  }
36378
36692
  }
36379
36693
  let innerHTML = void 0;
@@ -36462,10 +36776,8 @@ var SSRContainer = class extends _SharedContainer2 {
36462
36776
  this.write(GT);
36463
36777
  }
36464
36778
  this.lastNode = null;
36465
- if (this.qlInclude === 1 /* Inline */) {
36466
- if (elementName === "noscript" || elementName === "template") {
36467
- this.$noScriptHere$--;
36468
- }
36779
+ if (elementName === "noscript" || elementName === "template" || elementName === "script") {
36780
+ this.$noScriptHere$--;
36469
36781
  }
36470
36782
  }
36471
36783
  /** Writes opening data to vNodeData for fragment boundaries */
@@ -36828,7 +37140,8 @@ var SSRContainer = class extends _SharedContainer2 {
36828
37140
  emitPatchDataIfNeeded() {
36829
37141
  const patches = [];
36830
37142
  for (const [elementIndex, backpatchEntries] of this.backpatchMap) {
36831
- for (const backpatchEntry of backpatchEntries) {
37143
+ for (let i = 0; i < backpatchEntries.length; i++) {
37144
+ const backpatchEntry = backpatchEntries[i];
36832
37145
  patches.push(
36833
37146
  elementIndex,
36834
37147
  backpatchEntry.attrName,
@@ -36980,7 +37293,8 @@ var SSRContainer = class extends _SharedContainer2 {
36980
37293
  );
36981
37294
  let indent = " ";
36982
37295
  let lastName = "";
36983
- for (const frame3 of frames) {
37296
+ for (let i = 0; i < frames.length; i++) {
37297
+ const frame3 = frames[i];
36984
37298
  const [name, example] = allowedContent(frame3.tagNesting);
36985
37299
  text.push(
36986
37300
  `${indent}<${frame3.elementName}>${lastName !== name ? ` [${name}]${example ? ` -> ${example}` : ""}` : ""}`
@@ -36991,7 +37305,7 @@ var SSRContainer = class extends _SharedContainer2 {
36991
37305
  text.push(
36992
37306
  `${indent}<${elementName}> <= is not allowed as a child of ${allowedContent(previousTagNesting)[0]}.`
36993
37307
  );
36994
- throw newTagError(text.join("\n"));
37308
+ throw newTagError(text.map(escapeHTML).join("\n"));
36995
37309
  }
36996
37310
  }
36997
37311
  }
@@ -37319,9 +37633,10 @@ function resolveManifest(manifest) {
37319
37633
  }
37320
37634
  if (mergedManifest.mapping) {
37321
37635
  const mapper = {};
37322
- Object.entries(mergedManifest.mapping).forEach(([symbol, bundleFilename]) => {
37636
+ for (const symbol in mergedManifest.mapping) {
37637
+ const bundleFilename = mergedManifest.mapping[symbol];
37323
37638
  mapper[getSymbolHash2(symbol)] = [symbol, bundleFilename];
37324
- });
37639
+ }
37325
37640
  return {
37326
37641
  mapper,
37327
37642
  manifest: mergedManifest,
@@ -37356,7 +37671,9 @@ async function domRender(jsx2, opts = {}) {
37356
37671
  function getStylesFactory(document2) {
37357
37672
  return () => {
37358
37673
  const styles = {};
37359
- Array.from(document2.querySelectorAll("style")).forEach((style) => {
37674
+ const styleElements = document2.querySelectorAll("style");
37675
+ for (let i = 0; i < styleElements.length; i++) {
37676
+ const style = styleElements[i];
37360
37677
  const id = style.hasAttribute(QStyle) ? style.getAttribute(QStyle) : style.getAttribute(QScopedStyle) ? style.getAttribute(QScopedStyle) : null;
37361
37678
  if (id !== null) {
37362
37679
  const text = style.textContent;
@@ -37367,7 +37684,7 @@ function getStylesFactory(document2) {
37367
37684
  styles[id] = text;
37368
37685
  }
37369
37686
  }
37370
- });
37687
+ }
37371
37688
  return styles;
37372
37689
  };
37373
37690
  }
@@ -37439,7 +37756,8 @@ async function ssrRenderToDom(jsx2, opts = {}) {
37439
37756
  child = child.nextSibling;
37440
37757
  }
37441
37758
  vnode_insertBefore(journal, containerVNode, fragment, insertBefore);
37442
- for (const child2 of childrenToMove) {
37759
+ for (let i = 0; i < childrenToMove.length; i++) {
37760
+ const child2 = childrenToMove[i];
37443
37761
  vnode_moveToVirtual(fragment, child2, null);
37444
37762
  }
37445
37763
  vNode = fragment;