@qwik.dev/core 2.0.0-beta.1 → 2.0.0-beta.3

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 2.0.0-beta.1-dev+495e8d9
3
+ * @qwik.dev/core 2.0.0-beta.3-dev+aa098fc
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
@@ -50,9 +50,9 @@ const logWarn = () => {
50
50
  const createAndLogError = (asyncThrow, message, ...optionalParams) => {
51
51
  const err = message instanceof Error ? message : new Error(message);
52
52
  return console.error("%cQWIK ERROR", "", err.message, ...optionalParams, err.stack),
53
- asyncThrow && setTimeout((() => {
53
+ asyncThrow && setTimeout(() => {
54
54
  throw err;
55
- }), 0), err;
55
+ }, 0), err;
56
56
  };
57
57
 
58
58
  const codeToText = code => `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
@@ -196,18 +196,18 @@ const createPlatform = () => ({
196
196
  const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
197
197
  const urlCopy = new URL(urlDoc);
198
198
  urlCopy.hash = "";
199
- return import(urlCopy.href).then((mod => mod[symbolName]));
199
+ return import(urlCopy.href).then(mod => mod[symbolName]);
200
200
  },
201
- raf: fn => new Promise((resolve => {
202
- requestAnimationFrame((() => {
201
+ raf: fn => new Promise(resolve => {
202
+ requestAnimationFrame(() => {
203
203
  resolve(fn());
204
- }));
205
- })),
206
- nextTick: fn => new Promise((resolve => {
207
- setTimeout((() => {
204
+ });
205
+ }),
206
+ nextTick: fn => new Promise(resolve => {
207
+ setTimeout(() => {
208
208
  resolve(fn());
209
- }));
210
- })),
209
+ });
210
+ }),
211
211
  chunkForSymbol: (symbolName, chunk) => [ symbolName, chunk ?? "_" ]
212
212
  });
213
213
 
@@ -250,9 +250,9 @@ const shouldNotError = reason => {
250
250
  throwErrorAndStop(reason);
251
251
  };
252
252
 
253
- const delay = timeout => new Promise((resolve => {
253
+ const delay = timeout => new Promise(resolve => {
254
254
  setTimeout(resolve, timeout);
255
- }));
255
+ });
256
256
 
257
257
  function retryOnPromise(fn, retryCount = 0) {
258
258
  const retryOrThrow = e => {
@@ -263,7 +263,7 @@ function retryOnPromise(fn, retryCount = 0) {
263
263
  };
264
264
  try {
265
265
  const result = fn();
266
- return isPromise(result) ? result.catch((e => retryOrThrow(e))) : result;
266
+ return isPromise(result) ? result.catch(e => retryOrThrow(e)) : result;
267
267
  } catch (e) {
268
268
  if (isDev && isServer && e instanceof ReferenceError && e.message.includes("window")) {
269
269
  throw e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message,
@@ -361,7 +361,7 @@ class SignalImpl {
361
361
  this.$untrackedValue$ = value;
362
362
  }
363
363
  get value() {
364
- return setupSignalValueAccess(this, (() => this.$effects$ ||= new Set), (() => this.untrackedValue));
364
+ return setupSignalValueAccess(this, () => this.$effects$ ||= new Set, () => this.untrackedValue);
365
365
  }
366
366
  set value(value) {
367
367
  value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, triggerEffects(this.$container$, this, this.$effects$));
@@ -370,7 +370,7 @@ class SignalImpl {
370
370
  qDev;
371
371
  }
372
372
  toString() {
373
- return isDev ? `[${this.constructor.name}${1 & this.$flags$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e => "\n -> " + pad(qwikDebugToString(e[0]), " "))).join("\n") || "") : this.constructor.name;
373
+ return isDev ? `[${this.constructor.name}${1 & this.$flags$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map(e => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n") || "") : this.constructor.name;
374
374
  }
375
375
  toJSON() {
376
376
  return {
@@ -428,7 +428,7 @@ class WrappedSignalImpl extends SignalImpl {
428
428
  if (!(1 & this.$flags$)) {
429
429
  return !1;
430
430
  }
431
- const untrackedValue = trackSignal((() => this.$func$(...this.$args$)), this, ".", this.$container$);
431
+ const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, ".", this.$container$);
432
432
  const didChange = untrackedValue !== this.$untrackedValue$;
433
433
  return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
434
434
  }
@@ -546,7 +546,7 @@ const trackSignal = (fn, subscriber, property, container, data) => {
546
546
  };
547
547
 
548
548
  const trackSignalAndAssignHost = (value, host, property, container, data) => (value instanceof WrappedSignalImpl && value.$hostElement$ !== host && host && (value.$hostElement$ = host),
549
- trackSignal((() => value.value), host, property, container, data));
549
+ trackSignal(() => value.value, host, property, container, data));
550
550
 
551
551
  const _getContextElement = () => {
552
552
  const iCtx = tryGetInvokeContext();
@@ -696,7 +696,7 @@ const ERROR_CONTEXT = /*#__PURE__*/ createContextId("qk-error");
696
696
 
697
697
  const isRecoverable = err => !(err && err instanceof Error && "plugin" in err);
698
698
 
699
- const version = "2.0.0-beta.1-dev+495e8d9";
699
+ const version = "2.0.0-beta.3-dev+aa098fc";
700
700
 
701
701
  const EMPTY_ARRAY = [];
702
702
 
@@ -727,7 +727,7 @@ const qrl = (chunkOrFn, symbol, lexicalScopeCapture = EMPTY_ARRAY, stackOffset =
727
727
  {
728
728
  const ref = "QWIK-SELF";
729
729
  const frames = new Error(ref).stack.split("\n");
730
- const start = frames.findIndex((f => f.includes(ref)));
730
+ const start = frames.findIndex(f => f.includes(ref));
731
731
  match = frames[start + 2 + stackOffset].match(EXTRACT_FILE_NAME), chunk = match ? match[1] : "main";
732
732
  }
733
733
  }
@@ -869,7 +869,7 @@ class SerializerSignalImpl extends ComputedSignalImpl {
869
869
  const {deserialize, initial} = arg;
870
870
  const update = arg.update;
871
871
  const currentValue = this.$untrackedValue$ === NEEDS_COMPUTATION ? initial : this.$untrackedValue$;
872
- const untrackedValue = trackSignal((() => this.$didInitialize$ ? update?.(currentValue) : deserialize(currentValue)), this, ".", this.$container$);
872
+ const untrackedValue = trackSignal(() => this.$didInitialize$ ? update?.(currentValue) : deserialize(currentValue), this, ".", this.$container$);
873
873
  const didChange = this.$didInitialize$ && "undefined" !== untrackedValue || untrackedValue !== this.$untrackedValue$;
874
874
  return this.$flags$ &= -2, this.$didInitialize$ = !0, didChange && (this.$untrackedValue$ = untrackedValue),
875
875
  didChange;
@@ -1012,7 +1012,7 @@ function getEffects(target, prop, storeEffects) {
1012
1012
  const trackFn = (target, container) => (obj, prop) => {
1013
1013
  const ctx = newInvokeContext();
1014
1014
  return ctx.$effectSubscriber$ = getSubscriber(target, ":"), ctx.$container$ = container || void 0,
1015
- invoke(ctx, (() => {
1015
+ invoke(ctx, () => {
1016
1016
  if (isFunction(obj)) {
1017
1017
  return obj();
1018
1018
  }
@@ -1027,21 +1027,21 @@ const trackFn = (target, container) => (obj, prop) => {
1027
1027
  obj;
1028
1028
  }
1029
1029
  throw qError(2);
1030
- }));
1030
+ });
1031
1031
  };
1032
1032
 
1033
1033
  const cleanupFn = (target, handleError) => {
1034
1034
  let cleanupFns = null;
1035
1035
  return [ fn => {
1036
- "function" == typeof fn && (cleanupFns || (cleanupFns = [], target.$destroy$ = noSerialize((() => {
1037
- target.$destroy$ = null, cleanupFns.forEach((fn => {
1036
+ "function" == typeof fn && (cleanupFns || (cleanupFns = [], target.$destroy$ = noSerialize(() => {
1037
+ target.$destroy$ = null, cleanupFns.forEach(fn => {
1038
1038
  try {
1039
1039
  fn();
1040
1040
  } catch (err) {
1041
1041
  handleError(err);
1042
1042
  }
1043
- }));
1044
- }))), cleanupFns.push(fn));
1043
+ });
1044
+ })), cleanupFns.push(fn));
1045
1045
  }, cleanupFns ?? [] ];
1046
1046
  };
1047
1047
 
@@ -1057,7 +1057,7 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
1057
1057
  super(container, fn, flags);
1058
1058
  }
1059
1059
  get loading() {
1060
- return setupSignalValueAccess(this, (() => this.$loadingEffects$ ||= new Set), (() => this.untrackedLoading));
1060
+ return setupSignalValueAccess(this, () => this.$loadingEffects$ ||= new Set, () => this.untrackedLoading);
1061
1061
  }
1062
1062
  set untrackedLoading(value) {
1063
1063
  value !== this.$untrackedLoading$ && (this.$untrackedLoading$ = value, this.$container$?.$scheduler$(7, null, this, this.$loadingEffects$));
@@ -1066,7 +1066,7 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
1066
1066
  return this.$untrackedLoading$;
1067
1067
  }
1068
1068
  get error() {
1069
- return setupSignalValueAccess(this, (() => this.$errorEffects$ ||= new Set), (() => this.untrackedError));
1069
+ return setupSignalValueAccess(this, () => this.$errorEffects$ ||= new Set, () => this.untrackedError);
1070
1070
  }
1071
1071
  set untrackedError(value) {
1072
1072
  value !== this.$untrackedError$ && (this.$untrackedError$ = value, this.$container$?.$scheduler$(7, null, this, this.$errorEffects$));
@@ -1080,17 +1080,17 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
1080
1080
  }
1081
1081
  const computeQrl = this.$computeQrl$;
1082
1082
  throwIfQRLNotResolved(computeQrl);
1083
- const [cleanup] = cleanupFn(this, (err => this.$container$?.handleError(err, null)));
1083
+ const [cleanup] = cleanupFn(this, err => this.$container$?.handleError(err, null));
1084
1084
  const untrackedValue = this.$promiseValue$ ?? computeQrl.getFn()({
1085
1085
  track: trackFn(this, this.$container$),
1086
1086
  cleanup
1087
1087
  });
1088
1088
  if (isPromise(untrackedValue)) {
1089
- throw this.untrackedLoading = !0, this.untrackedError = null, untrackedValue.then((promiseValue => {
1089
+ throw this.untrackedLoading = !0, this.untrackedError = null, untrackedValue.then(promiseValue => {
1090
1090
  this.$promiseValue$ = promiseValue, this.untrackedLoading = !1, this.untrackedError = null;
1091
- })).catch((err => {
1091
+ }).catch(err => {
1092
1092
  this.untrackedLoading = !1, this.untrackedError = err;
1093
- }));
1093
+ });
1094
1094
  }
1095
1095
  this.$promiseValue$ = null, this.$flags$ &= -2;
1096
1096
  const didChange = untrackedValue !== this.$untrackedValue$;
@@ -1410,24 +1410,24 @@ const executeComponent = (container, renderHost, subscriptionHost, componentQRL,
1410
1410
  const inlineComponent = componentQRL;
1411
1411
  componentFn = () => invokeApply(iCtx, inlineComponent, [ props || EMPTY_OBJ ]);
1412
1412
  }
1413
- const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall((() => (isInlineComponent || (container.setHostProp(renderHost, "q:seqIdx", null),
1414
- container.setHostProp(renderHost, ":onIdx", null), container.setHostProp(renderHost, "q:props", props)),
1415
- vnode_isVNode(renderHost) && clearAllEffects(container, renderHost), componentFn(props))), (jsx => {
1413
+ const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall(() => (isInlineComponent || (container.setHostProp(renderHost, "q:seqIdx", null),
1414
+ container.setHostProp(renderHost, ":onIdx", null)), vnode_isVNode(renderHost) && clearAllEffects(container, renderHost),
1415
+ componentFn(props)), jsx => {
1416
1416
  const useOnEvents = container.getHostProp(renderHost, ":on");
1417
1417
  return useOnEvents ? addUseOnEvents(jsx, useOnEvents) : jsx;
1418
- }), (err => {
1418
+ }, err => {
1419
1419
  if (isPromise(err) && retryCount < 100) {
1420
- return err.then((() => executeComponentWithPromiseExceptionRetry(retryCount++)));
1420
+ return err.then(() => executeComponentWithPromiseExceptionRetry(retryCount++));
1421
1421
  }
1422
1422
  throw err;
1423
- }));
1423
+ });
1424
1424
  return executeComponentWithPromiseExceptionRetry();
1425
1425
  };
1426
1426
 
1427
1427
  function addUseOnEvents(jsx, useOnEvents) {
1428
1428
  const jsxElement = findFirstStringJSX(jsx);
1429
1429
  let jsxResult = jsx;
1430
- return maybeThen(jsxElement, (jsxElement => {
1430
+ return maybeThen(jsxElement, jsxElement => {
1431
1431
  let isInvisibleComponent = !1;
1432
1432
  jsxElement || (isInvisibleComponent = !0);
1433
1433
  for (const key in useOnEvents) {
@@ -1448,7 +1448,7 @@ function addUseOnEvents(jsx, useOnEvents) {
1448
1448
  }
1449
1449
  }
1450
1450
  return jsxResult;
1451
- }));
1451
+ });
1452
1452
  }
1453
1453
 
1454
1454
  function addUseOnEvent(jsxElement, key, value) {
@@ -1472,10 +1472,10 @@ function findFirstStringJSX(jsx) {
1472
1472
  queue.push(...jsx);
1473
1473
  } else {
1474
1474
  if (isPromise(jsx)) {
1475
- return maybeThen(jsx, (jsx => findFirstStringJSX(jsx)));
1475
+ return maybeThen(jsx, jsx => findFirstStringJSX(jsx));
1476
1476
  }
1477
1477
  if (isSignal(jsx)) {
1478
- return findFirstStringJSX(untrack((() => jsx.value)));
1478
+ return findFirstStringJSX(untrack(() => jsx.value));
1479
1479
  }
1480
1480
  }
1481
1481
  }
@@ -1531,7 +1531,12 @@ async function _walkJSX(ssr, value, options) {
1531
1531
  const value = stack.pop();
1532
1532
  if (value instanceof ParentComponentData) {
1533
1533
  options.currentStyleScoped = value.$scopedStyle$, options.parentComponentFrame = value.$componentFrame$;
1534
- } else if (value !== MaybeAsyncSignal) {
1534
+ } else {
1535
+ if (value === MaybeAsyncSignal) {
1536
+ const trackFn = stack.pop();
1537
+ await retryOnPromise(() => stack.push(trackFn()));
1538
+ continue;
1539
+ }
1535
1540
  if ("function" != typeof value) {
1536
1541
  processJSXNode(ssr, enqueue, value, {
1537
1542
  styleScoped: options.currentStyleScoped,
@@ -1544,9 +1549,6 @@ async function _walkJSX(ssr, value, options) {
1544
1549
  }
1545
1550
  await value.apply(ssr);
1546
1551
  }
1547
- } else {
1548
- const trackFn = stack.pop();
1549
- await retryOnPromise((() => stack.push(trackFn())));
1550
1552
  }
1551
1553
  }
1552
1554
  })();
@@ -1569,20 +1571,20 @@ function processJSXNode(ssr, enqueue, value, options) {
1569
1571
  } else if (isSignal(value)) {
1570
1572
  ssr.openFragment(isDev ? [ DEBUG_TYPE, "S" ] : EMPTY_ARRAY);
1571
1573
  const signalNode = ssr.getOrCreateLastNode();
1572
- enqueue(ssr.closeFragment), enqueue((() => trackSignalAndAssignHost(value, signalNode, ".", ssr))),
1574
+ enqueue(ssr.closeFragment), enqueue(() => trackSignalAndAssignHost(value, signalNode, ".", ssr)),
1573
1575
  enqueue(MaybeAsyncSignal);
1574
1576
  } else if (isPromise(value)) {
1575
1577
  ssr.openFragment(isDev ? [ DEBUG_TYPE, "A" ] : EMPTY_ARRAY), enqueue(ssr.closeFragment),
1576
- enqueue(value), enqueue(Promise), enqueue((() => ssr.commentNode("qkssr-f")));
1578
+ enqueue(value), enqueue(Promise), enqueue(() => ssr.commentNode("qkssr-f"));
1577
1579
  } else if (isAsyncGenerator(value)) {
1578
- enqueue((async () => {
1580
+ enqueue(async () => {
1579
1581
  for await (const chunk of value) {
1580
1582
  await _walkJSX(ssr, chunk, {
1581
1583
  currentStyleScoped: options.styleScoped,
1582
1584
  parentComponentFrame: options.parentComponentFrame
1583
1585
  }), ssr.commentNode("qkssr-f");
1584
1586
  }
1585
- }));
1587
+ });
1586
1588
  } else {
1587
1589
  const jsx = value;
1588
1590
  const type = jsx.type;
@@ -1685,10 +1687,10 @@ function toSsrAttrs(record, anotherRecord, serializationCtx, pushMergedEventProp
1685
1687
  }
1686
1688
  const eventValue = setEvent(serializationCtx, key, value);
1687
1689
  eventValue && ssrAttrs.push(jsxEventToHtmlAttribute(key), eventValue);
1688
- } else {
1689
- isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(serializationCtx, key),
1690
- value = serializeAttribute(key, value, styleScopedId), ssrAttrs.push(key, value));
1690
+ continue;
1691
1691
  }
1692
+ isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(serializationCtx, key),
1693
+ value = serializeAttribute(key, value, styleScopedId), ssrAttrs.push(key, value));
1692
1694
  }
1693
1695
  return null != key && ssrAttrs.push("q:key", key), ssrAttrs;
1694
1696
  }
@@ -1772,26 +1774,26 @@ const useTaskQrl = qrl => {
1772
1774
  const task = new Task(10, i, iCtx.$hostElement$, qrl, void 0, null);
1773
1775
  set(task);
1774
1776
  const promise = iCtx.$container$.$scheduler$(3, task);
1775
- isPromise(promise) && promise.catch((() => {}));
1777
+ isPromise(promise) && promise.catch(() => {});
1776
1778
  };
1777
1779
 
1778
1780
  const runTask = (task, container, host) => {
1779
1781
  task.$flags$ &= -9, cleanupTask(task);
1780
1782
  const iCtx = newInvokeContext(container.$locale$, host, void 0, "qTask");
1781
1783
  iCtx.$container$ = container;
1782
- const taskFn = task.$qrl$.getFn(iCtx, (() => clearAllEffects(container, task)));
1784
+ const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
1783
1785
  const track = trackFn(task, container);
1784
- const [cleanup] = cleanupFn(task, (reason => container.handleError(reason, host)));
1786
+ const [cleanup] = cleanupFn(task, reason => container.handleError(reason, host));
1785
1787
  const taskApi = {
1786
1788
  track,
1787
1789
  cleanup
1788
1790
  };
1789
- return safeCall((() => taskFn(taskApi)), cleanup, (err => {
1791
+ return safeCall(() => taskFn(taskApi), cleanup, err => {
1790
1792
  if (isPromise(err)) {
1791
- return err.then((() => runTask(task, container, host)));
1793
+ return err.then(() => runTask(task, container, host));
1792
1794
  }
1793
1795
  throw err;
1794
- }));
1796
+ });
1795
1797
  };
1796
1798
 
1797
1799
  const cleanupTask = task => {
@@ -1835,11 +1837,11 @@ const _jsxSorted = (type, varProps, constProps, children, flags, key) => {
1835
1837
 
1836
1838
  const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
1837
1839
  let sortedProps;
1838
- return sortedProps = varProps ? Object.fromEntries(untrack((() => Object.entries(varProps))).filter((entry => {
1840
+ return sortedProps = varProps ? Object.fromEntries(untrack(() => Object.entries(varProps)).filter(entry => {
1839
1841
  const attr = entry[0];
1840
1842
  return "children" === attr ? (children ??= entry[1], !1) : "key" === attr ? (key = entry[1],
1841
1843
  !1) : !constProps || !(attr in constProps) || /^on[A-Z].*\$$/.test(attr);
1842
- })).sort((([a], [b]) => a < b ? -1 : 1))) : "string" == typeof type ? EMPTY_OBJ : {},
1844
+ }).sort(([a], [b]) => a < b ? -1 : 1)) : "string" == typeof type ? EMPTY_OBJ : {},
1843
1845
  constProps && "children" in constProps && (children = constProps.children, constProps.children = void 0),
1844
1846
  _jsxSorted(type, sortedProps, constProps, children, flags, key, dev);
1845
1847
  };
@@ -1910,10 +1912,10 @@ const Fragment = props => props.children;
1910
1912
 
1911
1913
  const jsxDEV = (type, props, key, _isStatic, opts) => {
1912
1914
  const processed = null == key ? null : String(key);
1913
- const children = untrack((() => {
1915
+ const children = untrack(() => {
1914
1916
  const c = props.children;
1915
1917
  return "string" == typeof type && delete props.children, c;
1916
- }));
1918
+ });
1917
1919
  isString(type) && "className" in props && (props.class = props.className, delete props.className);
1918
1920
  const node = new JSXNodeImpl(type, props, null, children, 0, processed);
1919
1921
  return node.dev = {
@@ -2000,7 +2002,7 @@ const mapApp_findIndx = (array, key, start) => {
2000
2002
 
2001
2003
  const mapArray_set = (array, key, value, start) => {
2002
2004
  const indx = mapApp_findIndx(array, key, start);
2003
- indx >= 0 ? null == value ? array.splice(indx, 2) : array[indx + 1] = value : null != value && array.splice(~indx, 0, key, value);
2005
+ indx >= 0 ? null == value ? array.splice(indx, 2) : array[indx + 1] = value : null != value && array.splice(-1 ^ indx, 0, key, value);
2004
2006
  };
2005
2007
 
2006
2008
  const mapArray_get = (array, key, start) => {
@@ -2198,7 +2200,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2198
2200
  const jsxNode = asyncQueue.shift();
2199
2201
  const vHostNode = asyncQueue.shift();
2200
2202
  if (isPromise(jsxNode)) {
2201
- return jsxNode.then((jsxNode => (diff(jsxNode, vHostNode), drainAsyncQueue())));
2203
+ return jsxNode.then(jsxNode => (diff(jsxNode, vHostNode), drainAsyncQueue()));
2202
2204
  }
2203
2205
  diff(jsxNode, vHostNode);
2204
2206
  }
@@ -2285,7 +2287,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2285
2287
  }
2286
2288
  function expectProjection() {
2287
2289
  const slotName = jsxValue.key;
2288
- vCurrent = vnode_getProp(vParent, slotName, (id => vnode_locate(container.rootVNode, id))),
2290
+ vCurrent = vnode_getProp(vParent, slotName, id => vnode_locate(container.rootVNode, id)),
2289
2291
  vCurrent = vCurrent && 32 & vCurrent[0] ? null : vCurrent, null == vCurrent && (vNewNode = vnode_newVirtual(),
2290
2292
  isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P"), isDev && vnode_setProp(vNewNode, "q:code", "expectProjection"),
2291
2293
  vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, "q:sparent", vParent),
@@ -2351,43 +2353,43 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2351
2353
  htmlEvent && vnode_setAttr(journal, vNewNode, htmlEvent, "");
2352
2354
  }
2353
2355
  needsQDispatchEventPatch = !0;
2354
- } else {
2355
- if ("ref" === key) {
2356
- if (isSignal(value)) {
2357
- value.value = element;
2358
- continue;
2359
- }
2360
- if ("function" == typeof value) {
2361
- value(element);
2362
- continue;
2363
- }
2364
- if (null == value) {
2365
- continue;
2366
- }
2367
- throw qError(15, [ currentFile ]);
2368
- }
2356
+ continue;
2357
+ }
2358
+ if ("ref" === key) {
2369
2359
  if (isSignal(value)) {
2370
- const signalData = new SubscriptionData({
2371
- $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2372
- $isConst$: !0
2373
- });
2374
- value = trackSignalAndAssignHost(value, vNewNode, key, container, signalData);
2360
+ value.value = element;
2361
+ continue;
2375
2362
  }
2376
- if (key !== dangerouslySetInnerHTML) {
2377
- if ("textarea" !== elementName || "value" !== key) {
2378
- value = serializeAttribute(key, value, scopedStyleIdPrefix), null != value && element.setAttribute(key, String(value));
2379
- } else {
2380
- if (value && "string" != typeof value) {
2381
- if (isDev) {
2382
- throw qError(23, [ currentFile, value ]);
2383
- }
2384
- continue;
2363
+ if ("function" == typeof value) {
2364
+ value(element);
2365
+ continue;
2366
+ }
2367
+ if (null == value) {
2368
+ continue;
2369
+ }
2370
+ throw qError(15, [ currentFile ]);
2371
+ }
2372
+ if (isSignal(value)) {
2373
+ const signalData = new SubscriptionData({
2374
+ $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2375
+ $isConst$: !0
2376
+ });
2377
+ value = trackSignalAndAssignHost(value, vNewNode, key, container, signalData);
2378
+ }
2379
+ if (key !== dangerouslySetInnerHTML) {
2380
+ if ("textarea" !== elementName || "value" !== key) {
2381
+ value = serializeAttribute(key, value, scopedStyleIdPrefix), null != value && element.setAttribute(key, String(value));
2382
+ } else {
2383
+ if (value && "string" != typeof value) {
2384
+ if (isDev) {
2385
+ throw qError(23, [ currentFile, value ]);
2385
2386
  }
2386
- element.value = escapeHTML(value || "");
2387
+ continue;
2387
2388
  }
2388
- } else {
2389
- element.innerHTML = value, element.setAttribute("q:container", "html");
2389
+ element.value = escapeHTML(value || "");
2390
2390
  }
2391
+ } else {
2392
+ element.innerHTML = value, element.setAttribute("q:container", "html");
2391
2393
  }
2392
2394
  }
2393
2395
  }
@@ -2484,12 +2486,12 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2484
2486
  const eventProp = ":" + scope.substring(1) + ":" + eventName;
2485
2487
  const qrls = [ vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null) ];
2486
2488
  let returnValue = !1;
2487
- return qrls.flat(2).forEach((qrl => {
2489
+ return qrls.flat(2).forEach(qrl => {
2488
2490
  if (qrl) {
2489
2491
  const value = container.$scheduler$(2, vNode, qrl, [ event, element ]);
2490
2492
  returnValue = returnValue || !0 === value;
2491
2493
  }
2492
- })), returnValue;
2494
+ }), returnValue;
2493
2495
  }));
2494
2496
  }
2495
2497
  function registerQwikLoaderEvent(eventName) {
@@ -2541,9 +2543,12 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2541
2543
  host = vNewNode, shouldRender = !0) : (vNewNode = retrieveChildWithKey(null, lookupKey),
2542
2544
  vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : (insertNewComponent(host, componentQRL, jsxProps),
2543
2545
  shouldRender = !0), host = vNewNode), host) {
2544
- const vNodeProps = vnode_getProp(host, "q:props", container.$getObjectById$);
2545
- shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps), shouldRender && (host[0] &= -33,
2546
- container.$scheduler$(6, host, componentQRL, jsxProps));
2546
+ let vNodeProps = vnode_getProp(host, "q:props", container.$getObjectById$);
2547
+ const propsAreDifferent = propsDiffer(jsxProps, vNodeProps);
2548
+ shouldRender = shouldRender || propsAreDifferent, shouldRender && (propsAreDifferent && (vNodeProps ? (vNodeProps[_CONST_PROPS] = jsxProps[_CONST_PROPS],
2549
+ vNodeProps[_VAR_PROPS] = jsxProps[_VAR_PROPS]) : jsxProps && (vnode_setProp(host, "q:props", jsxProps),
2550
+ vNodeProps = jsxProps)), vnode_setProp(host, "q:renderFn", componentQRL), host[0] &= -33,
2551
+ container.$scheduler$(6, host, componentQRL, vNodeProps));
2547
2552
  }
2548
2553
  !function(children, host) {
2549
2554
  const projectionChildren = Array.isArray(children) ? children : [ children ];
@@ -2784,7 +2789,7 @@ function getResourceValueAsPromise(props) {
2784
2789
  return Promise.resolve(resource._error).then(useBindInvokeContext(props.onRejected));
2785
2790
  }
2786
2791
  {
2787
- const resolvedValue = untrack((() => resource._resolved));
2792
+ const resolvedValue = untrack(() => resource._resolved);
2788
2793
  if (void 0 !== resolvedValue) {
2789
2794
  return Promise.resolve(resolvedValue).then(useBindInvokeContext(props.onResolved));
2790
2795
  }
@@ -2818,11 +2823,11 @@ const runResource = (task, container, host) => {
2818
2823
  task.$flags$ &= -9, cleanupTask(task);
2819
2824
  const iCtx = newInvokeContext(container.$locale$, host, void 0, "qResource");
2820
2825
  iCtx.$container$ = container;
2821
- const taskFn = task.$qrl$.getFn(iCtx, (() => clearAllEffects(container, task)));
2826
+ const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
2822
2827
  const resource = task.$state$;
2823
2828
  assertDefined(resource, 'useResource: when running a resource, "task.resource" must be a defined.', task);
2824
2829
  const track = trackFn(task, container);
2825
- const [cleanup, cleanups] = cleanupFn(task, (reason => container.handleError(reason, host)));
2830
+ const [cleanup, cleanups] = cleanupFn(task, reason => container.handleError(reason, host));
2826
2831
  const resourceTarget = unwrapStore(resource);
2827
2832
  const opts = {
2828
2833
  track,
@@ -2840,29 +2845,29 @@ const runResource = (task, container, host) => {
2840
2845
  resource.loading = !1, resource._state = "resolved", resource._resolved = value,
2841
2846
  resource._error = void 0, resolve(value)) : (done = !0, resource.loading = !1, resource._state = "rejected",
2842
2847
  resource._error = value, reject(value)), !0);
2843
- cleanups.push((() => {
2844
- if (!0 === untrack((() => resource.loading))) {
2845
- const value = untrack((() => resource._resolved));
2848
+ cleanups.push(() => {
2849
+ if (!0 === untrack(() => resource.loading)) {
2850
+ const value = untrack(() => resource._resolved);
2846
2851
  setState(!0, value);
2847
2852
  }
2848
- })), invoke(iCtx, (() => {
2853
+ }), invoke(iCtx, () => {
2849
2854
  resource._state = "pending", resource.loading = !isServerPlatform();
2850
- (resource.value = new Promise(((r, re) => {
2855
+ (resource.value = new Promise((r, re) => {
2851
2856
  resolve = r, reject = re;
2852
- }))).catch(ignoreErrorToPreventNodeFromCrashing);
2853
- }));
2854
- const promise = safeCall((() => Promise.resolve(taskFn(opts))), (value => {
2857
+ })).catch(ignoreErrorToPreventNodeFromCrashing);
2858
+ });
2859
+ const promise = safeCall(() => Promise.resolve(taskFn(opts)), value => {
2855
2860
  setState(!0, value);
2856
- }), (err => {
2861
+ }, err => {
2857
2862
  if (isPromise(err)) {
2858
- return err.then((() => runResource(task, container, host)));
2863
+ return err.then(() => runResource(task, container, host));
2859
2864
  }
2860
2865
  setState(!1, err);
2861
- }));
2866
+ });
2862
2867
  const timeout = resourceTarget._timeout;
2863
- return timeout > 0 ? Promise.race([ promise, delay(timeout).then((() => {
2868
+ return timeout > 0 ? Promise.race([ promise, delay(timeout).then(() => {
2864
2869
  setState(!1, new Error("timeout")) && cleanupTask(task);
2865
- })) ]) : promise;
2870
+ }) ]) : promise;
2866
2871
  };
2867
2872
 
2868
2873
  const ignoreErrorToPreventNodeFromCrashing = () => {};
@@ -2878,10 +2883,10 @@ const vnode_documentPosition = (a, b, rootVNode) => {
2878
2883
  let aDepth = -1;
2879
2884
  let bDepth = -1;
2880
2885
  for (;a; ) {
2881
- a = (aVNodePath[++aDepth] = a)[1] || rootVNode && vnode_getProp(a, "q:sparent", (id => vnode_locate(rootVNode, id)));
2886
+ a = (aVNodePath[++aDepth] = a)[1] || rootVNode && vnode_getProp(a, "q:sparent", id => vnode_locate(rootVNode, id));
2882
2887
  }
2883
2888
  for (;b; ) {
2884
- b = (bVNodePath[++bDepth] = b)[1] || rootVNode && vnode_getProp(b, "q:sparent", (id => vnode_locate(rootVNode, id)));
2889
+ b = (bVNodePath[++bDepth] = b)[1] || rootVNode && vnode_getProp(b, "q:sparent", id => vnode_locate(rootVNode, id));
2885
2890
  }
2886
2891
  for (;aDepth >= 0 && bDepth >= 0; ) {
2887
2892
  if ((a = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
@@ -2897,7 +2902,7 @@ const vnode_documentPosition = (a, b, rootVNode) => {
2897
2902
  return -1;
2898
2903
  }
2899
2904
  } while (cursor);
2900
- return rootVNode && vnode_getProp(b, "q:sparent", (id => vnode_locate(rootVNode, id))) ? -1 : 1;
2905
+ return rootVNode && vnode_getProp(b, "q:sparent", id => vnode_locate(rootVNode, id)) ? -1 : 1;
2901
2906
  }
2902
2907
  aDepth--, bDepth--;
2903
2908
  }
@@ -2931,9 +2936,9 @@ const ssrNodeDocumentPosition = (a, b) => {
2931
2936
 
2932
2937
  const DEBUG = !1;
2933
2938
 
2934
- const getPromise = chore => chore.$promise$ ||= new Promise((resolve => {
2939
+ const getPromise = chore => chore.$promise$ ||= new Promise(resolve => {
2935
2940
  chore.$resolve$ = resolve;
2936
- }));
2941
+ });
2937
2942
 
2938
2943
  const createScheduler = (container, scheduleDrain, journalFlush) => {
2939
2944
  const choreQueue = [];
@@ -2983,11 +2988,11 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
2983
2988
  return sortedArray.splice(~idx, 0, value), value;
2984
2989
  }
2985
2990
  const existing = sortedArray[idx];
2986
- 4 === existing.$type$ && (existing.$payload$ = value.$payload$);
2991
+ existing.$payload$ !== value.$payload$ && (existing.$payload$ = value.$payload$);
2987
2992
  existing.$executed$ && (existing.$executed$ = !1);
2988
2993
  return existing;
2989
2994
  }(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = !0,
2990
- schedule(16), scheduleDrain()?.catch?.((() => {})));
2995
+ schedule(16), scheduleDrain()?.catch?.(() => {}));
2991
2996
  return runLater ? getPromise(chore) : drainUpTo(chore, isServer);
2992
2997
  };
2993
2998
  function drainUpTo(runUptoChore, isServer) {
@@ -2997,9 +3002,9 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
2997
3002
  throw new Error("drainUpTo: max retries reached");
2998
3003
  }
2999
3004
  if (currentChore) {
3000
- return getPromise(currentChore).then((() => drainUpTo(runUptoChore, isServer))).catch((e => {
3005
+ return getPromise(currentChore).then(() => drainUpTo(runUptoChore, isServer)).catch(e => {
3001
3006
  container.handleError(e, currentChore?.$host$);
3002
- }));
3007
+ });
3003
3008
  }
3004
3009
  const nextChore = choreQueue[0];
3005
3010
  if (nextChore.$executed$) {
@@ -3027,27 +3032,27 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
3027
3032
  break;
3028
3033
 
3029
3034
  case 6:
3030
- returnValue = safeCall((() => executeComponent(container, host, host, chore.$target$, chore.$payload$)), (jsx => {
3035
+ returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), jsx => {
3031
3036
  if (isServer) {
3032
3037
  return jsx;
3033
3038
  }
3034
3039
  {
3035
3040
  const styleScopedId = container.getHostProp(host, "q:sstyle");
3036
- return retryOnPromise((() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId))));
3041
+ return retryOnPromise(() => vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId)));
3037
3042
  }
3038
- }), (err => container.handleError(err, host)));
3043
+ }, err => container.handleError(err, host));
3039
3044
  break;
3040
3045
 
3041
3046
  case 2:
3042
3047
  {
3043
3048
  const fn = chore.$target$.getFn();
3044
- const result = retryOnPromise((() => fn(...chore.$payload$)));
3049
+ const result = retryOnPromise(() => fn(...chore.$payload$));
3045
3050
  if (isPromise(result)) {
3046
- const handled = result.finally((() => {
3051
+ const handled = result.finally(() => {
3047
3052
  qrlRuns.splice(qrlRuns.indexOf(handled), 1);
3048
- })).catch((error => {
3053
+ }).catch(error => {
3049
3054
  container.handleError(error, chore.$host$);
3050
- }));
3055
+ });
3051
3056
  return qrlRuns.push(handled), chore.$returnValue$ = handled, chore.$resolve$?.(handled),
3052
3057
  currentChore = null, void (chore.$executed$ = !0);
3053
3058
  }
@@ -3076,7 +3081,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
3076
3081
  {
3077
3082
  const parentVirtualNode = chore.$target$;
3078
3083
  let jsx = chore.$payload$;
3079
- isSignal(jsx) && (jsx = jsx.value), returnValue = retryOnPromise((() => vnode_diff(container, jsx, parentVirtualNode, null)));
3084
+ isSignal(jsx) && (jsx = jsx.value), returnValue = retryOnPromise(() => vnode_diff(container, jsx, parentVirtualNode, null));
3080
3085
  }
3081
3086
  break;
3082
3087
 
@@ -3109,18 +3114,19 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
3109
3114
  {
3110
3115
  const target = chore.$target$;
3111
3116
  const effects = chore.$payload$;
3112
- if (target instanceof ComputedSignalImpl || target instanceof WrappedSignalImpl) {
3117
+ const ctx = newInvokeContext();
3118
+ if (ctx.$container$ = container, target instanceof ComputedSignalImpl || target instanceof WrappedSignalImpl) {
3113
3119
  const forceRunEffects = target.$forceRunEffects$;
3114
- if (target.$forceRunEffects$ = !1, !target.$effects$?.size) {
3120
+ if (target.$forceRunEffects$ = !1, !effects?.size) {
3115
3121
  break;
3116
3122
  }
3117
- returnValue = retryOnPromise((() => {
3118
- (target.$computeIfNeeded$() || forceRunEffects) && triggerEffects(container, target, effects);
3119
- }));
3123
+ returnValue = maybeThen(retryOnPromise(() => invoke.call(target, ctx, target.$computeIfNeeded$)), didChange => {
3124
+ if (didChange || forceRunEffects) {
3125
+ return retryOnPromise(() => triggerEffects(container, target, effects));
3126
+ }
3127
+ });
3120
3128
  } else {
3121
- returnValue = retryOnPromise((() => {
3122
- triggerEffects(container, target, effects);
3123
- }));
3129
+ returnValue = retryOnPromise(() => triggerEffects(container, target, effects));
3124
3130
  }
3125
3131
  }
3126
3132
  }
@@ -3131,7 +3137,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
3131
3137
  currentChore = null, chore.$executed$ = !0, error ? container.handleError(error, host) : (chore.$returnValue$ = value,
3132
3138
  chore.$resolve$?.(value));
3133
3139
  };
3134
- isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after, (error => after(void 0, error))),
3140
+ isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after, error => after(void 0, error)),
3135
3141
  chore.$resolve$?.(chore.$promise$), chore.$resolve$ = void 0) : after(returnValue);
3136
3142
  }
3137
3143
  function choreComparator(a, b, rootVNode) {
@@ -3163,7 +3169,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
3163
3169
  return microTypeDiff;
3164
3170
  }
3165
3171
  const idxDiff = toNumber(a.$idx$) - toNumber(b.$idx$);
3166
- return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$ || a.$payload$ !== b.$payload$ || b === currentChore ? 1 : 0;
3172
+ return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$ ? isQrl(a.$target$) && isQrl(b.$target$) && a.$target$.$hash$ === b.$target$.$hash$ ? 0 : 1 : b === currentChore ? 1 : 0;
3167
3173
  }
3168
3174
  };
3169
3175
 
@@ -3199,9 +3205,9 @@ function debugChoreToString(chore) {
3199
3205
  function debugTrace(action, arg, currentChore, queue) {
3200
3206
  const lines = [ "===========================\nScheduler: " + action ];
3201
3207
  arg && !("$type$" in arg) && lines.push(" arg: " + String(arg).replaceAll(/\n.*/gim, "")),
3202
- queue && queue.forEach((chore => {
3208
+ queue && queue.forEach(chore => {
3203
3209
  lines.push(` ${chore === arg ? ">>>" : " "} > ` + (chore === currentChore ? "[running] " : "") + debugChoreToString(chore));
3204
- })), console.log(lines.join("\n") + "\n");
3210
+ }), console.log(lines.join("\n") + "\n");
3205
3211
  }
3206
3212
 
3207
3213
  class _SharedContainer {
@@ -3266,14 +3272,14 @@ function processVNodeData$1(document) {
3266
3272
  };
3267
3273
  })(prototype, "nodeType");
3268
3274
  const attachVnodeDataAndRefs = element => {
3269
- Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script => {
3275
+ Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach(script => {
3270
3276
  script.setAttribute("type", "x-qwik/vnode");
3271
3277
  const qContainerElement = script.closest("[q\\:container]");
3272
3278
  qContainerElement.qVnodeData = script.textContent, qContainerElement.qVNodeRefs = new Map;
3273
- })), element.querySelectorAll("[q\\:shadowroot]").forEach((parent => {
3279
+ }), element.querySelectorAll("[q\\:shadowroot]").forEach(parent => {
3274
3280
  const shadowRoot = parent.shadowRoot;
3275
3281
  shadowRoot && attachVnodeDataAndRefs(shadowRoot);
3276
- }));
3282
+ });
3277
3283
  };
3278
3284
  attachVnodeDataAndRefs(document);
3279
3285
  const getFastNodeType = node => {
@@ -3451,7 +3457,7 @@ class DomContainer extends _SharedContainer {
3451
3457
  $styleIds$=null;
3452
3458
  $renderCount$=0;
3453
3459
  constructor(element) {
3454
- if (super((() => this.scheduleRender()), (() => vnode_applyJournal(this.$journal$)), {}, element.getAttribute("q:locale")),
3460
+ if (super(() => this.scheduleRender(), () => vnode_applyJournal(this.$journal$), {}, element.getAttribute("q:locale")),
3455
3461
  this.qContainer = element.getAttribute("q:container"), !this.qContainer) {
3456
3462
  throw qError(25);
3457
3463
  }
@@ -3534,22 +3540,22 @@ class DomContainer extends _SharedContainer {
3534
3540
  return vnode_getProp(vNode, name, getObjectById);
3535
3541
  }
3536
3542
  scheduleRender() {
3537
- return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick((() => this.processChores())),
3538
- this.renderDone.finally((() => emitEvent("qrender", {
3543
+ return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick(() => this.processChores()),
3544
+ this.renderDone.finally(() => emitEvent("qrender", {
3539
3545
  instanceHash: this.$instanceHash$,
3540
3546
  renderCount: this.$renderCount$
3541
- })));
3547
+ }));
3542
3548
  }
3543
3549
  processChores() {
3544
3550
  let renderCount = this.$renderCount$;
3545
3551
  const result = this.$scheduler$(255);
3546
3552
  if (isPromise(result)) {
3547
- return result.then((async () => {
3553
+ return result.then(async () => {
3548
3554
  for (;renderCount !== this.$renderCount$; ) {
3549
3555
  renderCount = this.$renderCount$, await this.$scheduler$(255);
3550
3556
  }
3551
3557
  this.renderDone = null;
3552
- }));
3558
+ });
3553
3559
  }
3554
3560
  renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
3555
3561
  }
@@ -3576,9 +3582,9 @@ class DomContainer extends _SharedContainer {
3576
3582
  const scopedStyleIds = new Set(convertScopedStyleIdsToArray(scopedStyleIdsString));
3577
3583
  scopedStyleIds.add(styleId), this.setHostProp(host, "q:sstyle", convertStyleIdsToString(scopedStyleIds));
3578
3584
  }
3579
- if (null == this.$styleIds$ && (this.$styleIds$ = new Set, this.element.querySelectorAll(QStyleSelector).forEach((style => {
3585
+ if (null == this.$styleIds$ && (this.$styleIds$ = new Set, this.element.querySelectorAll(QStyleSelector).forEach(style => {
3580
3586
  this.$styleIds$.add(style.getAttribute(QStyle));
3581
- }))), !this.$styleIds$.has(styleId)) {
3587
+ })), !this.$styleIds$.has(styleId)) {
3582
3588
  this.$styleIds$.add(styleId);
3583
3589
  const styleElement = this.document.createElement("style");
3584
3590
  styleElement.setAttribute(QStyle, styleId), styleElement.textContent = content,
@@ -3721,7 +3727,7 @@ function qwikDebugToString(value) {
3721
3727
  return value;
3722
3728
  }
3723
3729
 
3724
- const pad = (text, prefix) => String(text).split("\n").map(((line, idx) => (idx ? prefix : "") + line)).join("\n");
3730
+ const pad = (text, prefix) => String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
3725
3731
 
3726
3732
  const jsxToString = value => {
3727
3733
  if (isJSXNode(value)) {
@@ -3731,9 +3737,9 @@ const jsxToString = value => {
3731
3737
  str += " " + key + "=" + qwikDebugToString(val);
3732
3738
  }
3733
3739
  const children = value.children;
3734
- null != children ? (str += ">", Array.isArray(children) ? children.forEach((child => {
3740
+ null != children ? (str += ">", Array.isArray(children) ? children.forEach(child => {
3735
3741
  str += jsxToString(child);
3736
- })) : str += jsxToString(children), str += "</" + value.type + ">") : str += "/>";
3742
+ }) : str += jsxToString(children), str += "</" + value.type + ">") : str += "/>";
3737
3743
  }
3738
3744
  return str;
3739
3745
  }
@@ -4371,7 +4377,7 @@ const materializeFromDOM = (vParent, firstChild, vData) => {
4371
4377
  }
4372
4378
  if (vParent[5] = vChild || null, vParent[4] = vFirstChild, vData) {
4373
4379
  let container = null;
4374
- processVNodeData(vData, ((peek, consumeValue) => {
4380
+ processVNodeData(vData, (peek, consumeValue) => {
4375
4381
  if (peek() === VNodeDataChar.ID) {
4376
4382
  container || (container = getDomContainer(vParent[6]));
4377
4383
  const id = consumeValue();
@@ -4380,7 +4386,7 @@ const materializeFromDOM = (vParent, firstChild, vData) => {
4380
4386
  peek() === VNodeDataChar.BACK_REFS ? (container || (container = getDomContainer(vParent[6])),
4381
4387
  setEffectBackRefFromVNodeData(vParent, consumeValue(), container)) : consumeValue();
4382
4388
  }
4383
- }));
4389
+ });
4384
4390
  }
4385
4391
  return vFirstChild;
4386
4392
  };
@@ -4400,7 +4406,8 @@ const processVNodeData = (vData, callback) => {
4400
4406
  let nextToConsumeIdx = 0;
4401
4407
  let ch = 0;
4402
4408
  let peekCh = 0;
4403
- const peek = () => 0 !== peekCh ? peekCh : peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
4409
+ const getChar = idx => idx < vData.length ? vData.charCodeAt(idx) : 0;
4410
+ const peek = () => 0 !== peekCh ? peekCh : peekCh = getChar(nextToConsumeIdx);
4404
4411
  const consume = () => (ch = peek(), peekCh = 0, nextToConsumeIdx++, ch);
4405
4412
  const consumeValue = () => {
4406
4413
  consume();
@@ -4411,7 +4418,7 @@ const processVNodeData = (vData, callback) => {
4411
4418
  return vData.substring(start, nextToConsumeIdx);
4412
4419
  };
4413
4420
  for (;0 !== peek(); ) {
4414
- callback(peek, consumeValue, consume, nextToConsumeIdx);
4421
+ callback(peek, consumeValue, consume, getChar, nextToConsumeIdx);
4415
4422
  }
4416
4423
  };
4417
4424
 
@@ -4444,7 +4451,7 @@ const vnode_setAttr = (journal, vnode, key, value) => {
4444
4451
  journal && journal.push(2, vnode[6], key, value);
4445
4452
  }
4446
4453
  null == value ? props.splice(idx, 2) : props[idx + 1] = value;
4447
- } else if (null != value && (props.splice(~idx, 0, key, value), 1 & type)) {
4454
+ } else if (null != value && (props.splice(-1 ^ idx, 0, key, value), 1 & type)) {
4448
4455
  journal && journal.push(2, vnode[6], key, value);
4449
4456
  }
4450
4457
  }
@@ -4478,7 +4485,7 @@ const vnode_setProp = (vnode, key, value) => {
4478
4485
  ensureElementOrVirtualVNode(vnode);
4479
4486
  const props = vnode_getProps(vnode);
4480
4487
  const idx = mapApp_findIndx(props, key, 0);
4481
- idx >= 0 ? props[idx + 1] = value : null != value && props.splice(~idx, 0, key, value);
4488
+ idx >= 0 ? props[idx + 1] = value : null != value && props.splice(-1 ^ idx, 0, key, value);
4482
4489
  };
4483
4490
 
4484
4491
  const vnode_getPropStartIndex = vnode => {
@@ -4516,12 +4523,12 @@ function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1
4516
4523
  strings.push(qwikDebugToString(vnode_getText(vnode)));
4517
4524
  } else if (vnode_isVirtualVNode(vnode)) {
4518
4525
  const attrs = [ "[" + String(vnode[0] >>> 8) + "]" ];
4519
- vnode_getAttrKeys(vnode).forEach((key => {
4526
+ vnode_getAttrKeys(vnode).forEach(key => {
4520
4527
  if (key !== DEBUG_TYPE) {
4521
4528
  const value = vnode_getAttr(vnode, key);
4522
4529
  attrs.push(" " + key + "=" + qwikDebugToString(value));
4523
4530
  }
4524
- }));
4531
+ });
4525
4532
  const name = (colorize ? "" : "") + (VirtualTypeName[vnode_getAttr(vnode, DEBUG_TYPE) || "V"] || VirtualTypeName.V) + (colorize ? "" : "");
4526
4533
  strings.push("<" + name + attrs.join("") + ">");
4527
4534
  const child = vnode_getFirstChild(vnode);
@@ -4531,10 +4538,10 @@ function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1
4531
4538
  const tag = vnode_getElementName(vnode);
4532
4539
  const attrs = [];
4533
4540
  const keys = vnode_getAttrKeys(vnode);
4534
- keys.forEach((key => {
4541
+ keys.forEach(key => {
4535
4542
  const value = vnode_getAttr(vnode, key);
4536
4543
  attrs.push(" " + key + "=" + qwikDebugToString(value));
4537
- }));
4544
+ });
4538
4545
  const node = vnode_getNode(vnode);
4539
4546
  if (node) {
4540
4547
  const vnodeData = node.ownerDocument.qVNodeData?.get(node);
@@ -4576,16 +4583,13 @@ function materializeFromVNodeData(vParent, vData, element, child) {
4576
4583
  let textIdx = 0;
4577
4584
  let combinedText = null;
4578
4585
  let container = null;
4579
- return processVNodeData(vData, ((peek, consumeValue, consume, nextToConsumeIdx) => {
4586
+ return processVNodeData(vData, (peek, consumeValue, consume, getChar, nextToConsumeIdx) => {
4580
4587
  if (isNumber(peek())) {
4581
- for (;!isElement(child); ) {
4588
+ for (;!isElement(child) || isQStyleElement(child); ) {
4582
4589
  if (!(child = fastNextSibling(child))) {
4583
4590
  throw qError(27, [ vData, peek(), nextToConsumeIdx ]);
4584
4591
  }
4585
4592
  }
4586
- for (;isQStyleElement(child); ) {
4587
- child = fastNextSibling(child);
4588
- }
4589
4593
  combinedText = null, previousTextNode = null;
4590
4594
  let value = 0;
4591
4595
  for (;isNumber(peek()); ) {
@@ -4605,7 +4609,9 @@ function materializeFromVNodeData(vParent, vData, element, child) {
4605
4609
  } else if (peek() === VNodeDataChar.PROPS) {
4606
4610
  vnode_setAttr(null, vParent, "q:props", consumeValue());
4607
4611
  } else if (peek() === VNodeDataChar.KEY) {
4608
- vnode_setAttr(null, vParent, "q:key", consumeValue());
4612
+ let value;
4613
+ getChar(nextToConsumeIdx + 1) === VNodeDataChar.SEPARATOR ? (consume(), value = decodeURI(consumeValue()),
4614
+ consume()) : value = consumeValue(), vnode_setAttr(null, vParent, "q:key", value);
4609
4615
  } else if (peek() === VNodeDataChar.SEQ) {
4610
4616
  vnode_setAttr(null, vParent, "q:seq", consumeValue());
4611
4617
  } else if (peek() === VNodeDataChar.SEQ_IDX) {
@@ -4629,6 +4635,9 @@ function materializeFromVNodeData(vParent, vData, element, child) {
4629
4635
  } else if (peek() === VNodeDataChar.SLOT) {
4630
4636
  vnode_setAttr(null, vParent, QSlot, consumeValue());
4631
4637
  } else {
4638
+ for (;isQStyleElement(child); ) {
4639
+ child = fastNextSibling(child);
4640
+ }
4632
4641
  const textNode = child && 3 === fastNodeType(child) ? child : null;
4633
4642
  null === combinedText && (combinedText = textNode ? textNode.nodeValue : null, textIdx = 0);
4634
4643
  let length = 0;
@@ -4640,7 +4649,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
4640
4649
  addVNode(previousTextNode = vnode_newSharedText(previousTextNode, textNode, text)),
4641
4650
  textIdx += length;
4642
4651
  }
4643
- })), vParent[5] = vLast, vFirst;
4652
+ }), vParent[5] = vLast, vFirst;
4644
4653
  }
4645
4654
 
4646
4655
  const vnode_getType = vnode => {
@@ -4663,7 +4672,7 @@ const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
4663
4672
  let projectionDepth = 1;
4664
4673
  for (;projectionDepth--; ) {
4665
4674
  for (;vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
4666
- const qSlotParent = vnode_getProp(vHost, "q:sparent", (id => vnode_locate(rootVNode, id)));
4675
+ const qSlotParent = vnode_getProp(vHost, "q:sparent", id => vnode_locate(rootVNode, id));
4667
4676
  const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
4668
4677
  vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
4669
4678
  }
@@ -5048,10 +5057,10 @@ const allocate = (container, typeId, value) => {
5048
5057
  case 16:
5049
5058
  let resolve;
5050
5059
  let reject;
5051
- const promise = new Promise(((res, rej) => {
5060
+ const promise = new Promise((res, rej) => {
5052
5061
  resolve = res, reject = rej;
5053
- }));
5054
- return resolvers.set(promise, [ resolve, reject ]), promise.catch((() => {})), promise;
5062
+ });
5063
+ return resolvers.set(promise, [ resolve, reject ]), promise.catch(() => {}), promise;
5055
5064
 
5056
5065
  case 19:
5057
5066
  const encodedLength = value.length;
@@ -5089,7 +5098,7 @@ function parseQRL(qrl) {
5089
5098
  const captureEnd = qrl.indexOf("]", captureStart);
5090
5099
  const chunk = qrl.slice(0, hashIdx > -1 ? hashIdx : captureStart);
5091
5100
  const symbol = captureStart > -1 ? qrl.slice(hashIdx + 1, captureStart) : qrl.slice(hashIdx + 1);
5092
- const captureIds = captureStart > -1 && captureEnd > -1 ? qrl.slice(captureStart + 1, captureEnd).split(" ").filter((v => v.length)).map((s => parseInt(s, 10))) : null;
5101
+ const captureIds = captureStart > -1 && captureEnd > -1 ? qrl.slice(captureStart + 1, captureEnd).split(" ").filter(v => v.length).map(s => parseInt(s, 10)) : null;
5093
5102
  let qrlRef = null;
5094
5103
  if (chunk === QRL_RUNTIME_CHUNK) {
5095
5104
  const backChannel = globalThis.__qrl_back_channel__;
@@ -5100,7 +5109,7 @@ function parseQRL(qrl) {
5100
5109
 
5101
5110
  function inflateQRL(container, qrl) {
5102
5111
  const captureIds = qrl.$capture$;
5103
- return qrl.$captureRef$ = captureIds ? captureIds.map((id => container.$getObjectById$(id))) : null,
5112
+ return qrl.$captureRef$ = captureIds ? captureIds.map(id => container.$getObjectById$(id)) : null,
5104
5113
  container.element && qrl.$setContainer$(container.element), qrl;
5105
5114
  }
5106
5115
 
@@ -5262,9 +5271,9 @@ async function serialize(serializationContext) {
5262
5271
  }
5263
5272
  $writer$.write(0 === lastIdx ? s : s.slice(lastIdx));
5264
5273
  } else {
5265
- depth++, outputArray(value, ((valueItem, idx) => {
5274
+ depth++, outputArray(value, (valueItem, idx) => {
5266
5275
  $discoverRoots$(serializationContext, valueItem, parent, idx), writeValue(valueItem);
5267
- })), depth--;
5276
+ }), depth--;
5268
5277
  }
5269
5278
  };
5270
5279
  const addPreloadQrl = qrl => {
@@ -5348,7 +5357,7 @@ async function serialize(serializationContext) {
5348
5357
  } else if (isStore(value)) {
5349
5358
  if (isResource(value)) {
5350
5359
  serializationContext.$resources$.add(value);
5351
- const forwardRefId = $resolvePromise$(value.value, $addRoot$, ((resolved, resolvedValue) => new PromiseResult(23, resolved, resolvedValue, getStoreHandler(value).$effects$)));
5360
+ const forwardRefId = $resolvePromise$(value.value, $addRoot$, (resolved, resolvedValue) => new PromiseResult(23, resolved, resolvedValue, getStoreHandler(value).$effects$));
5352
5361
  output(1, forwardRefId);
5353
5362
  } else {
5354
5363
  const storeHandler = getStoreHandler(value);
@@ -5372,7 +5381,7 @@ async function serialize(serializationContext) {
5372
5381
  } else if (isSerializerObj(value)) {
5373
5382
  const result = value[SerializerSymbol](value);
5374
5383
  if (isPromise(result)) {
5375
- const forwardRef = $resolvePromise$(result, $addRoot$, ((resolved, resolvedValue) => new PromiseResult(29, resolved, resolvedValue, null, null)));
5384
+ const forwardRef = $resolvePromise$(result, $addRoot$, (resolved, resolvedValue) => new PromiseResult(29, resolved, resolvedValue, null, null));
5376
5385
  output(1, forwardRef);
5377
5386
  } else {
5378
5387
  depth--, writeValue(result), depth++;
@@ -5392,7 +5401,7 @@ async function serialize(serializationContext) {
5392
5401
  } else if (value instanceof SignalImpl) {
5393
5402
  if (value instanceof SerializerSignalImpl) {
5394
5403
  addPreloadQrl(value.$computeQrl$);
5395
- const forwardRefId = $resolvePromise$($getCustomSerializerPromise$(value, value.$untrackedValue$), $addRoot$, ((resolved, resolvedValue) => new PromiseResult(29, resolved, resolvedValue, value.$effects$, value.$computeQrl$)));
5404
+ const forwardRefId = $resolvePromise$($getCustomSerializerPromise$(value, value.$untrackedValue$), $addRoot$, (resolved, resolvedValue) => new PromiseResult(29, resolved, resolvedValue, value.$effects$, value.$computeQrl$));
5396
5405
  return void output(1, forwardRefId);
5397
5406
  }
5398
5407
  const v = value instanceof ComputedSignalImpl && (1 & value.$flags$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
@@ -5422,14 +5431,14 @@ async function serialize(serializationContext) {
5422
5431
  const rootIndex = $addRoot$(value);
5423
5432
  serializationContext.$setProp$(value, "q:id", String(rootIndex)), output(10, value.id);
5424
5433
  const vNodeData = value.vnodeData;
5425
- if (vNodeData && (discoverValuesForVNodeData(vNodeData, (vNodeDataValue => $addRoot$(vNodeDataValue))),
5434
+ if (vNodeData && (discoverValuesForVNodeData(vNodeData, vNodeDataValue => $addRoot$(vNodeDataValue)),
5426
5435
  vNodeData[0] |= 16), value.children) {
5427
5436
  for (const child of value.children) {
5428
5437
  const childVNodeData = child.vnodeData;
5429
5438
  if (childVNodeData) {
5430
5439
  for (const value of childVNodeData) {
5431
5440
  if (isSsrAttrs(value)) {
5432
- const backRefKeyIndex = value.findIndex((v => "q:brefs" === v));
5441
+ const backRefKeyIndex = value.findIndex(v => "q:brefs" === v);
5433
5442
  -1 !== backRefKeyIndex && $addRoot$(value[backRefKeyIndex + 1]);
5434
5443
  }
5435
5444
  }
@@ -5439,9 +5448,9 @@ async function serialize(serializationContext) {
5439
5448
  }
5440
5449
  } else if ("undefined" != typeof FormData && value instanceof FormData) {
5441
5450
  const array = [];
5442
- value.forEach(((value, key) => {
5451
+ value.forEach((value, key) => {
5443
5452
  array.push(key, "string" == typeof value ? value : value.name);
5444
- })), output(32, array);
5453
+ }), output(32, array);
5445
5454
  } else if (value instanceof URLSearchParams) {
5446
5455
  output(13, value.toString());
5447
5456
  } else if (value instanceof Set) {
@@ -5461,7 +5470,7 @@ async function serialize(serializationContext) {
5461
5470
  }
5462
5471
  output(22, out);
5463
5472
  } else if (isPromise(value)) {
5464
- const forwardRefId = $resolvePromise$(value, $addRoot$, ((resolved, resolvedValue) => new PromiseResult(16, resolved, resolvedValue)));
5473
+ const forwardRefId = $resolvePromise$(value, $addRoot$, (resolved, resolvedValue) => new PromiseResult(16, resolved, resolvedValue));
5465
5474
  output(1, forwardRefId);
5466
5475
  } else if (value instanceof PromiseResult) {
5467
5476
  if (23 === value.$type$) {
@@ -5495,11 +5504,11 @@ async function serialize(serializationContext) {
5495
5504
  };
5496
5505
  function $resolvePromise$(promise, $addRoot$, classCreator) {
5497
5506
  const forwardRefId = forwardRefsId++;
5498
- return promise.then((resolvedValue => {
5507
+ return promise.then(resolvedValue => {
5499
5508
  promises.delete(promise), forwardRefs[forwardRefId] = $addRoot$(classCreator(!0, resolvedValue));
5500
- })).catch((err => {
5509
+ }).catch(err => {
5501
5510
  promises.delete(promise), forwardRefs[forwardRefId] = $addRoot$(classCreator(!1, err));
5502
- })), promises.add(promise), forwardRefId;
5511
+ }), promises.add(promise), forwardRefId;
5503
5512
  }
5504
5513
  await (async () => {
5505
5514
  $writer$.write("[");
@@ -5518,20 +5527,20 @@ async function serialize(serializationContext) {
5518
5527
  }
5519
5528
  lastRootsLength = rootsLength, rootsLength = serializationContext.$roots$.length;
5520
5529
  }
5521
- forwardRefs.length && ($writer$.write(","), $writer$.write("2,"), outputArray(forwardRefs, (value => {
5530
+ forwardRefs.length && ($writer$.write(","), $writer$.write("2,"), outputArray(forwardRefs, value => {
5522
5531
  $writer$.write(String(value));
5523
- }))), $writer$.write("]");
5532
+ })), $writer$.write("]");
5524
5533
  })();
5525
5534
  }
5526
5535
 
5527
5536
  function $getCustomSerializerPromise$(signal, value) {
5528
- return new Promise((resolve => {
5529
- signal.$computeQrl$.resolve().then((arg => {
5537
+ return new Promise(resolve => {
5538
+ signal.$computeQrl$.resolve().then(arg => {
5530
5539
  let data;
5531
5540
  arg.serialize ? data = arg.serialize(value) : SerializerSymbol in value && (data = value[SerializerSymbol](value)),
5532
5541
  void 0 === data && (data = NEEDS_COMPUTATION), resolve(data);
5533
- }));
5534
- }));
5542
+ });
5543
+ });
5535
5544
  }
5536
5545
 
5537
5546
  function filterEffectBackRefs(effectBackRef) {
@@ -5585,7 +5594,7 @@ function qrlToString(serializationContext, value) {
5585
5594
  }
5586
5595
 
5587
5596
  async function _serialize(data) {
5588
- const serializationContext = createSerializationContext(null, null, (() => ""), (() => ""), (() => {}), new WeakMap);
5597
+ const serializationContext = createSerializationContext(null, null, () => "", () => "", () => {}, new WeakMap);
5589
5598
  for (const root of data) {
5590
5599
  serializationContext.$addRoot$(root);
5591
5600
  }
@@ -5639,6 +5648,7 @@ function _createDeserializeContainer(stateData, element) {
5639
5648
  }
5640
5649
 
5641
5650
  function preprocessState(data, container) {
5651
+ const isRootDeepRef = (type, value) => 0 === type && "string" == typeof value;
5642
5652
  const isForwardRefsMap = type => 2 === type;
5643
5653
  const isPreloadQrlType = type => 21 === type;
5644
5654
  const processRootRef = index => {
@@ -5659,10 +5669,9 @@ function preprocessState(data, container) {
5659
5669
  data[index + 1] = object;
5660
5670
  };
5661
5671
  for (let i = 0; i < data.length; i += 2) {
5662
- value = data[i + 1], 0 === data[i] && "string" == typeof value ? processRootRef(i) : isForwardRefsMap(data[i]) ? container.$forwardRefs$ = data[i + 1] : isPreloadQrlType(data[i]) && (container.$initialQRLsIndexes$ ||= [],
5672
+ isRootDeepRef(data[i], data[i + 1]) ? processRootRef(i) : isForwardRefsMap(data[i]) ? container.$forwardRefs$ = data[i + 1] : isPreloadQrlType(data[i]) && (container.$initialQRLsIndexes$ ||= [],
5663
5673
  container.$initialQRLsIndexes$.push(i / 2));
5664
5674
  }
5665
- var value;
5666
5675
  }
5667
5676
 
5668
5677
  function shouldTrackObj(obj) {
@@ -5692,7 +5701,7 @@ const canSerialize = (value, seen = new WeakSet) => {
5692
5701
  const proto = Object.getPrototypeOf(value);
5693
5702
  if (isStore(value) && (value = getStoreTarget(value)), proto == Object.prototype) {
5694
5703
  for (const key in value) {
5695
- if (!canSerialize(untrack((() => value[key])), seen)) {
5704
+ if (!canSerialize(untrack(() => value[key]), seen)) {
5696
5705
  return !1;
5697
5706
  }
5698
5707
  }
@@ -5760,7 +5769,7 @@ const _typeIdNames = [ "RootRef", "ForwardRef", "ForwardRefs", "Constant", "Numb
5760
5769
 
5761
5770
  const circularProofJson = (obj, indent) => {
5762
5771
  const seen = new WeakSet;
5763
- return JSON.stringify(obj, ((key, value) => {
5772
+ return JSON.stringify(obj, (key, value) => {
5764
5773
  if ("object" == typeof value && null !== value) {
5765
5774
  if (seen.has(value)) {
5766
5775
  return `[Circular ${value.constructor.name}]`;
@@ -5768,7 +5777,7 @@ const circularProofJson = (obj, indent) => {
5768
5777
  seen.add(value);
5769
5778
  }
5770
5779
  return value;
5771
- }), indent);
5780
+ }, indent);
5772
5781
  };
5773
5782
 
5774
5783
  const printRaw = (value, prefix) => {
@@ -5795,7 +5804,7 @@ const dumpState = (state, color = !1, prefix = "", limit = 20) => {
5795
5804
  value.length > 120 && (value = value.slice(0, 120) + '"...')) : 2 === key ? value = `[\n${prefix} ${value.join(`\n${prefix} `)}\n${prefix}]` : Array.isArray(value) && (value = value.length ? `[\n${dumpState(value, color, `${prefix} `)}\n${prefix}]` : "[]"),
5796
5805
  out.push(`${RED}${typeIdToName(key)}${RESET} ${value}`));
5797
5806
  }
5798
- const result = out.map(((v, i) => `${prefix}${isRoot ? `${i} ` : ""}${v}`)).join("\n");
5807
+ const result = out.map((v, i) => `${prefix}${isRoot ? `${i} ` : ""}${v}`).join("\n");
5799
5808
  if (isRoot) {
5800
5809
  const count = hasRaw ? "" : `(${JSON.stringify(state).length} chars)`;
5801
5810
  return hasRaw = !1, `\n${result}\n${count}`;
@@ -5841,12 +5850,12 @@ const _verifySerializable = (value, seen, ctx, preMessage) => {
5841
5850
  }
5842
5851
  if (isArray(unwrapped)) {
5843
5852
  let expectIndex = 0;
5844
- return unwrapped.forEach(((v, i) => {
5853
+ return unwrapped.forEach((v, i) => {
5845
5854
  if (i !== expectIndex) {
5846
5855
  throw qError(3, [ unwrapped ]);
5847
5856
  }
5848
5857
  _verifySerializable(v, seen, ctx + "[" + i + "]"), expectIndex = i + 1;
5849
- })), value;
5858
+ }), value;
5850
5859
  }
5851
5860
  if (isSerializableObject(unwrapped)) {
5852
5861
  for (const [key, item] of Object.entries(unwrapped)) {
@@ -5891,6 +5900,8 @@ const NoSerializeSymbol = Symbol("noSerialize");
5891
5900
 
5892
5901
  const SerializerSymbol = Symbol("serialize");
5893
5902
 
5903
+ const resolvedSymbol = Symbol("resolved");
5904
+
5894
5905
  const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
5895
5906
  let _containerEl;
5896
5907
  const qrl = async function(...args) {
@@ -5901,12 +5912,12 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
5901
5912
  function bindFnToContext(currentCtx, beforeFn) {
5902
5913
  const bound = (...args) => {
5903
5914
  if (!qrl.resolved) {
5904
- return retryOnPromise((() => qrl.resolve())).then((fn => {
5915
+ return retryOnPromise(() => qrl.resolve()).then(fn => {
5905
5916
  if (!isFunction(fn)) {
5906
5917
  throw qError(5);
5907
5918
  }
5908
5919
  return bound(...args);
5909
- }));
5920
+ });
5910
5921
  }
5911
5922
  if (beforeFn && !1 === beforeFn()) {
5912
5923
  return;
@@ -5940,7 +5951,8 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
5940
5951
  return context = newInvokeContext(), context.$qrl$ = qrl, context.$event$ = this,
5941
5952
  invoke.call(this, context, fn, ...args);
5942
5953
  };
5943
- const resolve = async containerEl => {
5954
+ symbolFn && resolvedSymbol in symbolFn && (symbolRef = symbolFn[resolvedSymbol]);
5955
+ const resolve = symbolRef ? async () => symbolRef : async containerEl => {
5944
5956
  if (null !== symbolRef) {
5945
5957
  return symbolRef;
5946
5958
  }
@@ -5954,14 +5966,17 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
5954
5966
  const start = now();
5955
5967
  const ctx = tryGetInvokeContext();
5956
5968
  if (null !== symbolFn) {
5957
- symbolRef = symbolFn().then((module => qrl.resolved = wrapFn(symbolRef = module[symbol])));
5969
+ symbolRef = symbolFn().then(module => {
5970
+ const resolved = wrapFn(symbolRef = module[symbol]);
5971
+ return symbolFn[resolvedSymbol] = resolved, qrl.resolved = resolved, resolved;
5972
+ });
5958
5973
  } else {
5959
5974
  const imported = getPlatform().importSymbol(_containerEl, chunk, symbol);
5960
- symbolRef = maybeThen(imported, (ref => qrl.resolved = wrapFn(symbolRef = ref)));
5975
+ symbolRef = maybeThen(imported, ref => qrl.resolved = wrapFn(symbolRef = ref));
5961
5976
  }
5962
- return "object" == typeof symbolRef && isPromise(symbolRef) && symbolRef.then((() => emitUsedSymbol(symbol, ctx?.$element$, start)), (err => {
5977
+ return isPromise(symbolRef) && symbolRef.then(() => emitUsedSymbol(symbol, ctx?.$element$, start), err => {
5963
5978
  console.error(`qrl ${symbol} failed to load`, err), symbolRef = null;
5964
- })), symbolRef;
5979
+ }), symbolRef;
5965
5980
  };
5966
5981
  const createOrReuseInvocationContext = invoke => null == invoke ? newInvokeContext() : isArray(invoke) ? newInvokeContextFromTuple(invoke) : invoke;
5967
5982
  const hash = getSymbolHash(symbol);
@@ -5970,7 +5985,6 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
5970
5985
  getHash: () => hash,
5971
5986
  getCaptured: () => captureRef,
5972
5987
  resolve,
5973
- $resolveLazy$: containerEl => null !== symbolRef ? symbolRef : resolve(containerEl),
5974
5988
  $setContainer$: setContainer,
5975
5989
  $chunk$: chunk,
5976
5990
  $symbol$: symbol,
@@ -5980,7 +5994,7 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
5980
5994
  $captureRef$: captureRef,
5981
5995
  dev: null,
5982
5996
  resolved: void 0
5983
- }), symbolRef && (symbolRef = maybeThen(symbolRef, (resolved => qrl.resolved = wrapFn(symbolRef = resolved)))),
5997
+ }), symbolRef && (symbolRef = maybeThen(symbolRef, resolved => qrl.resolved = wrapFn(symbolRef = resolved))),
5984
5998
  isDev && Object.defineProperty(qrl, "_devOnlySymbolRef", {
5985
5999
  get: () => symbolRef
5986
6000
  }), isBrowser && symbol && p(symbol, .8), qrl;
@@ -6295,7 +6309,7 @@ const STRINGS_COMMENTS = [ [ ANY, 39, 14 ], [ ANY, 34, 15 ], [ ANY, 47, 16, "*"
6295
6309
  const STATE_MACHINE = [ [ [ ANY, 42, starSelector ], [ ANY, OPEN_BRACKET, 7 ], [ ANY, COLON, pseudoElement, ":", "before", "after", "first-letter", "first-line" ], [ ANY, COLON, pseudoGlobal, "global" ], [ ANY, COLON, 3, "has", "host-context", "not", "where", "is", "matches", "any" ], [ ANY, COLON, 4 ], [ ANY, IDENT, 1 ], [ ANY, DOT, 1 ], [ ANY, HASH, 1 ], [ ANY, 64, atRuleSelector, "keyframe" ], [ ANY, 64, atRuleBlock, "media", "supports", "container" ], [ ANY, 64, atRuleInert ], [ ANY, 123, 13 ], [ 47, 42, 16 ], [ ANY, 59, EXIT ], [ ANY, 125, EXIT ], [ ANY, CLOSE_PARENTHESIS, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, 40, rule ], [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, 40, 8 ], [ ANY, NOT_IDENT, EXIT_INSERT_SCOPE ] ], [ [ ANY, 40, rule ], [ ANY, NOT_IDENT, EXIT ] ], [ [ ANY, NOT_IDENT, EXIT ] ], [ [ ANY, 93, EXIT_INSERT_SCOPE ], [ ANY, 39, 14 ], [ ANY, 34, 15 ] ], [ [ ANY, CLOSE_PARENTHESIS, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, 125, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, 125, EXIT ], [ WHITESPACE, IDENT, 1 ], [ ANY, COLON, pseudoGlobal, "global" ], [ ANY, 123, 13 ], ...STRINGS_COMMENTS ], [ [ ANY, 123, rule ], [ ANY, 59, EXIT ], ...STRINGS_COMMENTS ], [ [ ANY, 59, EXIT ], [ ANY, 123, 9 ], ...STRINGS_COMMENTS ], [ [ ANY, 125, EXIT ], [ ANY, 123, 13 ], [ ANY, 40, 8 ], ...STRINGS_COMMENTS ], [ [ ANY, 39, EXIT ] ], [ [ ANY, 34, EXIT ] ], [ [ 42, 47, EXIT ] ] ];
6296
6310
 
6297
6311
  const useStylesQrl = styles => ({
6298
- styleId: _useStyles(styles, (str => str), !1)
6312
+ styleId: _useStyles(styles, str => str, !1)
6299
6313
  });
6300
6314
 
6301
6315
  const useStyles$ = /*#__PURE__*/ implicit$FirstArg(useStylesQrl);
@@ -6314,13 +6328,10 @@ const _useStyles = (styleQrl, transform, scoped) => {
6314
6328
  }
6315
6329
  const styleId = styleKey(styleQrl, i);
6316
6330
  const host = iCtx.$hostElement$;
6317
- set(styleId);
6318
- const value = styleQrl.$resolveLazy$(iCtx.$element$);
6319
- if (isPromise(value)) {
6320
- throw value.then((val => iCtx.$container$.$appendStyle$(transform(val, styleId), styleId, host, scoped))),
6321
- value;
6331
+ if (set(styleId), !styleQrl.resolved) {
6332
+ throw styleQrl.resolve().then(val => iCtx.$container$.$appendStyle$(transform(val, styleId), styleId, host, scoped));
6322
6333
  }
6323
- return iCtx.$container$.$appendStyle$(transform(value, styleId), styleId, host, scoped),
6334
+ return iCtx.$container$.$appendStyle$(transform(styleQrl.resolved, styleId), styleId, host, scoped),
6324
6335
  styleId;
6325
6336
  };
6326
6337
 
@@ -6346,7 +6357,7 @@ const createEventName = (event, eventScope) => {
6346
6357
 
6347
6358
  const _useOn = (eventName, eventQrl) => {
6348
6359
  const {isAdded, addEvent} = useOnEventsSequentialScope();
6349
- isAdded || eventQrl && (Array.isArray(eventName) ? eventName.forEach((event => addEvent(event, eventQrl))) : addEvent(eventName, eventQrl));
6360
+ isAdded || eventQrl && (Array.isArray(eventName) ? eventName.forEach(event => addEvent(event, eventQrl)) : addEvent(eventName, eventQrl));
6350
6361
  };
6351
6362
 
6352
6363
  const useOnEventsSequentialScope = () => {
@@ -6370,10 +6381,10 @@ const useOnEventsSequentialScope = () => {
6370
6381
  };
6371
6382
  };
6372
6383
 
6373
- const useSignal = initialState => useConstant((() => {
6384
+ const useSignal = initialState => useConstant(() => {
6374
6385
  const value = isFunction(initialState) && !isQwikComponent(initialState) ? invoke(void 0, initialState) : initialState;
6375
6386
  return createSignal(value);
6376
- }));
6387
+ });
6377
6388
 
6378
6389
  const useConstant = value => {
6379
6390
  const {val, set} = useSequentialScope();
@@ -6406,7 +6417,7 @@ const useVisibleTaskQrl = (qrl, opts) => {
6406
6417
  }
6407
6418
  assertQrl(qrl);
6408
6419
  const task = new Task(1, i, iCtx.$hostElement$, qrl, void 0, null);
6409
- set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl.$resolveLazy$(iCtx.$element$),
6420
+ set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl.resolve(iCtx.$element$),
6410
6421
  iCtx.$container$.$scheduler$(32, task));
6411
6422
  };
6412
6423
 
@@ -6455,11 +6466,11 @@ const PrefetchServiceWorker = opts => {
6455
6466
  };
6456
6467
 
6457
6468
  const PREFETCH_CODE = /*#__PURE__*/ (c => {
6458
- "getRegistrations" in c && c.getRegistrations().then((registrations => {
6459
- registrations.forEach((registration => {
6469
+ "getRegistrations" in c && c.getRegistrations().then(registrations => {
6470
+ registrations.forEach(registration => {
6460
6471
  registration.active && registration.active.scriptURL.endsWith("_URL_") && registration.unregister().catch(console.error);
6461
- }));
6462
- }));
6472
+ });
6473
+ });
6463
6474
  }).toString();
6464
6475
 
6465
6476
  const PrefetchGraph = () => null;