@qwik.dev/core 2.0.0-alpha.8 → 2.0.0-alpha.9

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.
Files changed (38) hide show
  1. package/bindings/qwik.darwin-arm64.node +0 -0
  2. package/bindings/qwik.darwin-x64.node +0 -0
  3. package/bindings/qwik.linux-x64-gnu.node +0 -0
  4. package/bindings/qwik.win32-x64-msvc.node +0 -0
  5. package/bindings/qwik_wasm_bg.wasm +0 -0
  6. package/dist/build/package.json +1 -1
  7. package/dist/cli.cjs +2 -2
  8. package/dist/core-internal.d.ts +234 -22
  9. package/dist/core.cjs +7305 -7418
  10. package/dist/core.cjs.map +1 -1
  11. package/dist/core.min.mjs +1 -1
  12. package/dist/core.mjs +7299 -7418
  13. package/dist/core.mjs.map +1 -1
  14. package/dist/core.prod.cjs +1546 -1662
  15. package/dist/core.prod.mjs +2713 -2852
  16. package/dist/insights/index.qwik.cjs +1815 -1933
  17. package/dist/insights/index.qwik.mjs +1815 -1933
  18. package/dist/insights/insights.d.ts +1 -1
  19. package/dist/loader/package.json +1 -1
  20. package/dist/optimizer.cjs +47 -17
  21. package/dist/optimizer.d.ts +1 -1
  22. package/dist/optimizer.mjs +45 -17
  23. package/dist/prefetch/package.json +1 -1
  24. package/dist/server.cjs +12 -11
  25. package/dist/server.mjs +12 -11
  26. package/dist/starters/features/auth/package.json +1 -1
  27. package/dist/starters/features/tailwind/package.json +2 -2
  28. package/dist/starters/features/tailwind-v3/.vscode/settings.json +3 -0
  29. package/dist/starters/features/tailwind-v3/package.json +21 -0
  30. package/dist/starters/features/tailwind-v3/postcss.config.cjs +6 -0
  31. package/dist/starters/features/tailwind-v3/src/global.css +7 -0
  32. package/dist/starters/features/tailwind-v3/tailwind.config.js +8 -0
  33. package/dist/testing/index.cjs +5461 -5373
  34. package/dist/testing/index.d.ts +2 -1
  35. package/dist/testing/index.mjs +5475 -5389
  36. package/dist/testing/package.json +1 -1
  37. package/package.json +3 -3
  38. package/public.d.ts +6 -0
@@ -8,7 +8,7 @@ var isServer = !isBrowser;
8
8
  var isDev = false;
9
9
  /**
10
10
  * @license
11
- * @qwik.dev/core 2.0.0-alpha.8-dev+66037b5
11
+ * @qwik.dev/core 2.0.0-alpha.9-dev+56ed5bd
12
12
  * Copyright QwikDev. All Rights Reserved.
13
13
  * Use of this source code is governed by an MIT-style license that can be
14
14
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -33,10 +33,6 @@ function assertTrue() {
33
33
  function assertFalse() {
34
34
  }
35
35
  const codeToText = (code) => `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
36
- var QError;
37
- !function(QError2) {
38
- QError2[QError2.stringifyClassOrStyle = 0] = "stringifyClassOrStyle", QError2[QError2.schedulerNotFound = 1] = "schedulerNotFound", QError2[QError2.trackObjectWithoutProp = 2] = "trackObjectWithoutProp", QError2[QError2.verifySerializable = 3] = "verifySerializable", QError2[QError2.UNUSED_4 = 4] = "UNUSED_4", QError2[QError2.cannotRenderOverExistingContainer = 5] = "cannotRenderOverExistingContainer", QError2[QError2.UNUSED_6 = 6] = "UNUSED_6", QError2[QError2.UNUSED_7 = 7] = "UNUSED_7", QError2[QError2.UNUSED_8 = 8] = "UNUSED_8", QError2[QError2.UNUSED_9 = 9] = "UNUSED_9", QError2[QError2.qrlIsNotFunction = 10] = "qrlIsNotFunction", QError2[QError2.dynamicImportFailed = 11] = "dynamicImportFailed", QError2[QError2.unknownTypeArgument = 12] = "unknownTypeArgument", QError2[QError2.notFoundContext = 13] = "notFoundContext", QError2[QError2.useMethodOutsideContext = 14] = "useMethodOutsideContext", QError2[QError2.UNUSED_15 = 15] = "UNUSED_15", QError2[QError2.UNUSED_16 = 16] = "UNUSED_16", QError2[QError2.UNUSED_17 = 17] = "UNUSED_17", QError2[QError2.UNUSED_18 = 18] = "UNUSED_18", QError2[QError2.UNUSED_19 = 19] = "UNUSED_19", QError2[QError2.useInvokeContext = 20] = "useInvokeContext", QError2[QError2.UNUSED_21 = 21] = "UNUSED_21", QError2[QError2.UNUSED_22 = 22] = "UNUSED_22", QError2[QError2.UNUSED_23 = 23] = "UNUSED_23", QError2[QError2.UNUSED_24 = 24] = "UNUSED_24", QError2[QError2.UNUSED_25 = 25] = "UNUSED_25", QError2[QError2.UNUSED_26 = 26] = "UNUSED_26", QError2[QError2.UNUSED_27 = 27] = "UNUSED_27", QError2[QError2.invalidContext = 28] = "invalidContext", QError2[QError2.tagError = 29] = "tagError", QError2[QError2.qrlMissingContainer = 30] = "qrlMissingContainer", QError2[QError2.qrlMissingChunk = 31] = "qrlMissingChunk", QError2[QError2.invalidRefValue = 32] = "invalidRefValue", QError2[QError2.serializeErrorNotImplemented = 33] = "serializeErrorNotImplemented", QError2[QError2.serializeErrorExpectedVNode = 34] = "serializeErrorExpectedVNode", QError2[QError2.serializeErrorCannotAllocate = 35] = "serializeErrorCannotAllocate", QError2[QError2.serializeErrorMissingRootId = 36] = "serializeErrorMissingRootId", QError2[QError2.serializeErrorUnknownType = 37] = "serializeErrorUnknownType", QError2[QError2.serializeErrorUnvisited = 38] = "serializeErrorUnvisited", QError2[QError2.serializeErrorMissingChunk = 39] = "serializeErrorMissingChunk", QError2[QError2.wrongTextareaValue = 40] = "wrongTextareaValue", QError2[QError2.containerNotFound = 41] = "containerNotFound", QError2[QError2.elementWithoutContainer = 42] = "elementWithoutContainer", QError2[QError2.invalidVNodeType = 43] = "invalidVNodeType", QError2[QError2.materializeVNodeDataError = 44] = "materializeVNodeDataError", QError2[QError2.cannotCoerceSignal = 45] = "cannotCoerceSignal", QError2[QError2.computedNotSync = 46] = "computedNotSync", QError2[QError2.computedReadOnly = 47] = "computedReadOnly", QError2[QError2.wrappedReadOnly = 48] = "wrappedReadOnly", QError2[QError2.unsafeAttr = 49] = "unsafeAttr";
39
- }(QError || (QError = {}));
40
36
  const qError = (code, errorMessageArgs = []) => {
41
37
  const text = codeToText(code, ...errorMessageArgs);
42
38
  return logErrorAndStop(text, ...errorMessageArgs);
@@ -47,23 +43,6 @@ const getSymbolHash = (symbolName) => {
47
43
  const index = symbolName.lastIndexOf("_");
48
44
  return index > -1 ? symbolName.slice(index + 1) : symbolName;
49
45
  };
50
- var VirtualType;
51
- !function(VirtualType2) {
52
- VirtualType2.Virtual = "V", VirtualType2.Fragment = "F", VirtualType2.WrappedSignal = "S", VirtualType2.Awaited = "A", VirtualType2.Component = "C", VirtualType2.InlineComponent = "I", VirtualType2.Projection = "P";
53
- }(VirtualType || (VirtualType = {}));
54
- ({
55
- [VirtualType.Virtual]: "\x1B[34mVirtual\x1B[0m",
56
- [VirtualType.Fragment]: "\x1B[34mFragment\x1B[0m",
57
- [VirtualType.WrappedSignal]: "\x1B[34mSignal\x1B[0m",
58
- [VirtualType.Awaited]: "\x1B[34mAwaited\x1B[0m",
59
- [VirtualType.Component]: "\x1B[34mComponent\x1B[0m",
60
- [VirtualType.InlineComponent]: "\x1B[34mInlineComponent\x1B[0m",
61
- [VirtualType.Projection]: "\x1B[34mProjection\x1B[0m"
62
- });
63
- var QContainerValue;
64
- !function(QContainerValue2) {
65
- QContainerValue2.PAUSED = "paused", QContainerValue2.RESUMED = "resumed", QContainerValue2.HTML = "html", QContainerValue2.TEXT = "text";
66
- }(QContainerValue || (QContainerValue = {}));
67
46
  const QSlot = "q:slot";
68
47
  const QSlotS = "q:s";
69
48
  const QStyle = "q:style";
@@ -75,7 +54,7 @@ const QContainerIslandEnd = "/" + QContainerIsland;
75
54
  const QIgnore = "q:ignore";
76
55
  const QIgnoreEnd = "/q:ignore";
77
56
  const QTemplate = "q:template";
78
- const QContainerSelector = "[q\\:container]:not([q\\:container=" + QContainerValue.HTML + "]):not([q\\:container=" + QContainerValue.TEXT + "])";
57
+ const QContainerSelector = "[q\\:container]:not([q\\:container=html]):not([q\\:container=text])";
79
58
  const HTML_NS = "http://www.w3.org/1999/xhtml";
80
59
  const SVG_NS = "http://www.w3.org/2000/svg";
81
60
  const MATH_NS = "http://www.w3.org/1998/Math/MathML";
@@ -91,10 +70,10 @@ const createPlatform = () => ({
91
70
  }
92
71
  }
93
72
  if (!url) {
94
- throw qError(QError.qrlMissingChunk, [symbolName]);
73
+ throw qError(31, [symbolName]);
95
74
  }
96
75
  if (!containerEl) {
97
- throw qError(QError.qrlMissingContainer, [url, symbolName]);
76
+ throw qError(30, [url, symbolName]);
98
77
  }
99
78
  const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
100
79
  const urlCopy = new URL(urlDoc);
@@ -158,276 +137,400 @@ const isSerializableObject = (v) => {
158
137
  const isArray = (v) => Array.isArray(v);
159
138
  const isString = (v) => "string" == typeof v;
160
139
  const isFunction = (v) => "function" == typeof v;
161
- var VNodeDataFlag;
162
- !function(VNodeDataFlag2) {
163
- VNodeDataFlag2[VNodeDataFlag2.NONE = 0] = "NONE", VNodeDataFlag2[VNodeDataFlag2.TEXT_DATA = 1] = "TEXT_DATA", VNodeDataFlag2[VNodeDataFlag2.VIRTUAL_NODE = 2] = "VIRTUAL_NODE", VNodeDataFlag2[VNodeDataFlag2.ELEMENT_NODE = 4] = "ELEMENT_NODE", VNodeDataFlag2[VNodeDataFlag2.REFERENCE = 8] = "REFERENCE", VNodeDataFlag2[VNodeDataFlag2.SERIALIZE = 16] = "SERIALIZE";
164
- }(VNodeDataFlag || (VNodeDataFlag = {}));
165
- const isQrl = (value) => "function" == typeof value && "function" == typeof value.getSymbol;
166
140
  const EMPTY_ARRAY = [];
167
141
  const EMPTY_OBJ = {};
168
142
  Object.freeze(EMPTY_ARRAY), Object.freeze(EMPTY_OBJ);
169
- var ChoreType;
170
- !function(ChoreType2) {
171
- ChoreType2[ChoreType2.MACRO = 240] = "MACRO", ChoreType2[ChoreType2.MICRO = 15] = "MICRO", ChoreType2[ChoreType2.QRL_RESOLVE = 1] = "QRL_RESOLVE", ChoreType2[ChoreType2.RUN_QRL = 2] = "RUN_QRL", ChoreType2[ChoreType2.TASK = 3] = "TASK", ChoreType2[ChoreType2.NODE_DIFF = 4] = "NODE_DIFF", ChoreType2[ChoreType2.NODE_PROP = 5] = "NODE_PROP", ChoreType2[ChoreType2.COMPONENT = 6] = "COMPONENT", ChoreType2[ChoreType2.RECOMPUTE_AND_SCHEDULE_EFFECTS = 7] = "RECOMPUTE_AND_SCHEDULE_EFFECTS", ChoreType2[ChoreType2.JOURNAL_FLUSH = 16] = "JOURNAL_FLUSH", ChoreType2[ChoreType2.VISIBLE = 32] = "VISIBLE", ChoreType2[ChoreType2.CLEANUP_VISIBLE = 48] = "CLEANUP_VISIBLE", ChoreType2[ChoreType2.WAIT_FOR_ALL = 255] = "WAIT_FOR_ALL";
172
- }(ChoreType || (ChoreType = {}));
173
- const Slot = (props) => _jsxSorted(Virtual, null, {
174
- [QSlotS]: ""
175
- }, props.children, 0, props.name ?? "");
176
- const SkipRender = Symbol("skip render");
177
- const SSRRaw = () => null;
178
- const SSRComment = () => null;
179
143
  const isJsxPropertyAnEventName = (name) => (name.startsWith("on") || name.startsWith("window:on") || name.startsWith("document:on")) && name.endsWith("$");
180
144
  const isHtmlAttributeAnEventName = (name) => name.startsWith("on:") || name.startsWith("on-window:") || name.startsWith("on-document:");
181
- const getEventNameFromJsxProp = (name) => {
182
- if (name.endsWith("$")) {
183
- let idx = -1;
184
- if (name.startsWith("on") ? idx = 2 : name.startsWith("window:on") ? idx = 9 : name.startsWith("document:on") && (idx = 11), -1 != idx) {
185
- const isCaseSensitive = isDashAt(name, idx) && !isDashAt(name, idx + 1);
186
- isCaseSensitive && idx++;
187
- let lastIdx = idx;
188
- let eventName = "";
189
- for (; ; ) {
190
- idx = name.indexOf("-", lastIdx);
191
- const chunk = name.substring(lastIdx, -1 === idx ? name.length - 1 : idx);
192
- if (eventName += isCaseSensitive ? chunk : chunk.toLowerCase(), -1 == idx) {
193
- return eventName;
194
- }
195
- isDashAt(name, idx + 1) ? (eventName += "-", idx++) : (eventName += name.charAt(idx + 1).toUpperCase(), idx++), lastIdx = idx + 1;
196
- }
197
- }
198
- }
199
- return null;
200
- };
201
- const getEventNameScopeFromJsxProp = (name) => {
202
- const index = name.indexOf(":");
203
- return -1 !== index ? name.substring(0, index) : "";
204
- };
205
- const isDashAt = (name, idx) => 45 === name.charCodeAt(idx);
206
- const convertEventNameFromJsxPropToHtmlAttr = (name) => {
207
- if (name.endsWith("$")) {
208
- let prefix = null;
209
- if (name.startsWith("on") ? prefix = "on:" : name.startsWith("window:on") ? prefix = "on-window:" : name.startsWith("document:on") && (prefix = "on-document:"), null !== prefix) {
210
- const eventName = getEventNameFromJsxProp(name);
145
+ function jsxEventToHtmlAttribute(jsxEvent) {
146
+ if (jsxEvent.endsWith("$")) {
147
+ const [prefix, idx] = getEventScopeDataFromJsxEvent(jsxEvent);
148
+ if (-1 !== idx) {
149
+ const eventName = getEventNameFromJsxEvent(jsxEvent);
211
150
  return prefix + fromCamelToKebabCase(eventName);
212
151
  }
213
152
  }
214
153
  return null;
215
- };
216
- const fromCamelToKebabCase = (text) => text.replace(/([A-Z-])/g, "-$1").toLowerCase();
217
- function isPreventDefault(key) {
218
- return key.startsWith("preventdefault:");
219
- }
220
- function getFileLocationFromJsx(jsxDev) {
221
- if (!jsxDev) {
222
- return null;
223
- }
224
- const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
225
- return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
226
154
  }
227
- const styleContent = (styleId) => "⚡️" + styleId;
228
- function hasClassAttr(props) {
229
- for (const key in props) {
230
- if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
231
- return true;
155
+ function getEventNameFromJsxEvent(jsxEvent) {
156
+ if (jsxEvent.endsWith("$")) {
157
+ const [, idx] = getEventScopeDataFromJsxEvent(jsxEvent);
158
+ if (-1 != idx) {
159
+ return jsxEventToEventName(jsxEvent, idx);
232
160
  }
233
161
  }
234
- return false;
235
- }
236
- function isClassAttr(key) {
237
- return "class" === key || "className" === key;
162
+ return null;
238
163
  }
239
- function convertScopedStyleIdsToArray(scopedStyleIds) {
240
- return scopedStyleIds?.split(" ") ?? null;
164
+ function jsxEventToEventName(jsxEvent, startIdx = 0) {
165
+ let lastIdx = startIdx;
166
+ const isCaseSensitive = isDash(jsxEvent.charCodeAt(startIdx));
167
+ isCaseSensitive && lastIdx++;
168
+ let eventName = "";
169
+ const chunk = jsxEvent.substring(lastIdx, jsxEvent.length - 1);
170
+ return "DOMContentLoaded" === chunk ? "DOMContentLoaded" : (eventName += isCaseSensitive ? chunk : chunk.toLowerCase(), eventName);
241
171
  }
242
- function convertStyleIdsToString(scopedStyleIds) {
243
- return Array.from(scopedStyleIds).join(" ");
172
+ function getEventScopeDataFromJsxEvent(eventName) {
173
+ let prefix = null;
174
+ let idx = -1;
175
+ return eventName.startsWith("on") ? (prefix = "on:", idx = 2) : eventName.startsWith("window:on") ? (prefix = "on-window:", idx = 9) : eventName.startsWith("document:on") && (prefix = "on-document:", idx = 11), [prefix, idx];
244
176
  }
245
- const addComponentStylePrefix = (styleId) => {
246
- if (styleId) {
247
- let idx = 0;
248
- do {
249
- styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
250
- } while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
251
- }
252
- return styleId || null;
253
- };
254
- const unitlessNumbers = /* @__PURE__ */ new Set(["animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexShrink", "gridArea", "gridRow", "gridRowEnd", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "MozAnimationIterationCount", "MozBoxFlex", "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp"]);
255
- const isUnitlessNumber = (name) => unitlessNumbers.has(name);
256
- const serializeClass = (obj) => {
257
- if (!obj) {
258
- return "";
259
- }
260
- if (isString(obj)) {
261
- return obj.trim();
262
- }
263
- const classes = [];
264
- if (isArray(obj)) {
265
- for (const o of obj) {
266
- const classList = serializeClass(o);
267
- classList && classes.push(classList);
268
- }
269
- } else {
270
- for (const [key, value] of Object.entries(obj)) {
271
- value && classes.push(key.trim());
272
- }
273
- }
274
- return classes.join(" ");
275
- };
276
- const fromCamelToKebabCaseWithDash = (text) => text.replace(/([A-Z])/g, "-$1").toLowerCase();
277
- const stringifyStyle = (obj) => {
278
- if (null == obj) {
279
- return "";
280
- }
281
- if ("object" == typeof obj) {
282
- if (isArray(obj)) {
283
- throw qError(QError.stringifyClassOrStyle, [obj, "style"]);
284
- }
285
- {
286
- const chunks = [];
287
- for (const key in obj) {
288
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
289
- const value = obj[key];
290
- null != value && "function" != typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(fromCamelToKebabCaseWithDash(key) + ":" + setValueForStyle(key, value)));
291
- }
292
- }
293
- return chunks.join(";");
294
- }
295
- }
296
- return String(obj);
177
+ const isDash = (charCode) => 45 === charCode;
178
+ const getEventNameScopeFromJsxEvent = (name) => {
179
+ const index = name.indexOf(":");
180
+ return -1 !== index ? name.substring(0, index) : "";
297
181
  };
298
- const serializeBooleanOrNumberAttribute = (value) => null != value ? String(value) : null;
299
- function serializeAttribute(key, value, styleScopedId) {
300
- if (isClassAttr(key)) {
301
- const serializedClass = serializeClass(value);
302
- value = styleScopedId ? styleScopedId + (serializedClass.length ? " " + serializedClass : serializedClass) : serializedClass;
303
- } else {
304
- "style" === key ? value = stringifyStyle(value) : isEnumeratedBooleanAttribute(key) || "number" == typeof value ? value = serializeBooleanOrNumberAttribute(value) : false === value || null == value ? value = null : true === value && isPreventDefault(key) && (value = "");
305
- }
306
- return value;
307
- }
308
- function isEnumeratedBooleanAttribute(key) {
309
- return isAriaAttribute(key) || ["spellcheck", "draggable", "contenteditable"].includes(key);
182
+ function isPreventDefault(key) {
183
+ return key.startsWith("preventdefault:");
310
184
  }
311
- const setValueForStyle = (styleName, value) => "number" != typeof value || 0 === value || isUnitlessNumber(styleName) ? value : value + "px";
312
- function isAriaAttribute(prop) {
313
- return prop.startsWith("aria-");
185
+ const fromCamelToKebabCase = (text) => text.replace(/([A-Z-])/g, "-$1").toLowerCase();
186
+ const createContextId = (name) => /* @__PURE__ */ Object.freeze({
187
+ id: fromCamelToKebabCase(name)
188
+ });
189
+ const ERROR_CONTEXT = /* @__PURE__ */ createContextId("qk-error");
190
+ const version = "2.0.0-alpha.9-dev+56ed5bd";
191
+ const Slot = (props) => _jsxSorted(Virtual, null, {
192
+ [QSlotS]: ""
193
+ }, props.children, 0, props.name ?? "");
194
+ const SkipRender = Symbol("skip render");
195
+ const SSRRaw = () => null;
196
+ const SSRComment = () => null;
197
+ const NEEDS_COMPUTATION = Symbol("invalid");
198
+ const _EFFECT_BACK_REF = Symbol("backRef");
199
+ function getSubscriber(effect, prop, data) {
200
+ effect[_EFFECT_BACK_REF] || (isServer && isSsrNode(effect) ? effect.setProp("q:brefs", /* @__PURE__ */ new Map()) : effect[_EFFECT_BACK_REF] = /* @__PURE__ */ new Map());
201
+ const subMap = effect[_EFFECT_BACK_REF];
202
+ let sub = subMap.get(prop);
203
+ return sub || (sub = [effect, prop], subMap.set(prop, sub)), data && (sub[3] = data), sub;
314
204
  }
315
- const STORE_TARGET = Symbol("store.target");
316
- const STORE_HANDLER = Symbol("store.handler");
317
- const STORE_ALL_PROPS = Symbol("store.all");
318
- var StoreFlags;
319
- !function(StoreFlags2) {
320
- StoreFlags2[StoreFlags2.NONE = 0] = "NONE", StoreFlags2[StoreFlags2.RECURSIVE = 1] = "RECURSIVE", StoreFlags2[StoreFlags2.IMMUTABLE = 2] = "IMMUTABLE";
321
- }(StoreFlags || (StoreFlags = {}));
322
- const getStoreHandler = (value) => value[STORE_HANDLER];
323
- const getStoreTarget = (value) => value?.[STORE_TARGET] || null;
324
- const unwrapStore = (value) => getStoreTarget(value) || value;
325
- const isStore = (value) => STORE_TARGET in value;
326
- function createStore(container, obj, flags) {
327
- return new Proxy(obj, new StoreHandler(flags, container || null));
205
+ function isSsrNode(value) {
206
+ return "__brand__" in value && "currentComponentNode" in value;
328
207
  }
329
- const getOrCreateStore = (obj, flags, container) => {
330
- if (isSerializableObject(obj) && container) {
331
- let store = container.$storeProxyMap$.get(obj);
332
- return store || (store = createStore(container, obj, flags), container.$storeProxyMap$.set(obj, store)), store;
208
+ const throwIfQRLNotResolved = (qrl2) => {
209
+ if (!qrl2.resolved) {
210
+ throw qrl2.resolve();
333
211
  }
334
- return obj;
335
212
  };
336
- class StoreHandler {
337
- constructor($flags$, $container$) {
338
- __publicField(this, "$flags$");
339
- __publicField(this, "$container$");
213
+ const isSignal = (value) => value instanceof SignalImpl;
214
+ class SubscriptionData {
215
+ constructor(data) {
216
+ __publicField(this, "data");
217
+ this.data = data;
218
+ }
219
+ }
220
+ class SignalImpl {
221
+ constructor(container, value) {
222
+ __publicField(this, "$untrackedValue$");
340
223
  __publicField(this, "$effects$", null);
341
- this.$flags$ = $flags$, this.$container$ = $container$;
224
+ __publicField(this, "$container$", null);
225
+ this.$container$ = container, this.$untrackedValue$ = value;
342
226
  }
343
- toString() {
344
- return "[Store]";
227
+ get untrackedValue() {
228
+ return this.$untrackedValue$;
345
229
  }
346
- get(target, prop) {
347
- if ("symbol" == typeof prop) {
348
- return prop === STORE_TARGET ? target : prop === STORE_HANDLER ? this : target[prop];
349
- }
230
+ set untrackedValue(value) {
231
+ this.$untrackedValue$ = value;
232
+ }
233
+ get value() {
350
234
  const ctx = tryGetInvokeContext();
351
- const value = target[prop];
352
235
  if (ctx) {
353
236
  if (null === this.$container$) {
354
237
  if (!ctx.$container$) {
355
- return value;
238
+ return this.untrackedValue;
356
239
  }
357
240
  this.$container$ = ctx.$container$;
358
241
  } else {
359
242
  assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$);
360
243
  }
361
244
  const effectSubscriber = ctx.$effectSubscriber$;
362
- effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
363
- }
364
- if ("toString" === prop && value === Object.prototype.toString) {
365
- return this.toString;
366
- }
367
- return this.$flags$ & StoreFlags.RECURSIVE && "object" == typeof value && null !== value && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target) ? getOrCreateStore(value, this.$flags$, this.$container$) : value;
368
- }
369
- set(target, prop, value) {
370
- if ("symbol" == typeof prop) {
371
- return target[prop] = value, true;
372
- }
373
- const newValue = this.$flags$ & StoreFlags.RECURSIVE ? unwrapStore(value) : value;
374
- if (prop in target) {
375
- newValue !== target[prop] && setNewValueAndTriggerEffects(prop, newValue, target, this);
376
- } else {
377
- setNewValueAndTriggerEffects(prop, newValue, target, this);
245
+ if (effectSubscriber) {
246
+ const effects = this.$effects$ || (this.$effects$ = /* @__PURE__ */ new Set());
247
+ ensureContainsSubscription(effects, effectSubscriber), ensureContainsBackRef(effectSubscriber, this), addQrlToSerializationCtx(effectSubscriber, this.$container$);
248
+ }
378
249
  }
379
- return true;
250
+ return this.untrackedValue;
380
251
  }
381
- deleteProperty(target, prop) {
382
- return "string" == typeof prop && delete target[prop] && (triggerEffects(this.$container$, this, getEffects(target, prop, this.$effects$)), true);
252
+ set value(value) {
253
+ value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, triggerEffects(this.$container$, this, this.$effects$));
383
254
  }
384
- has(target, prop) {
385
- if (prop === STORE_TARGET) {
386
- return true;
387
- }
388
- if ("string" == typeof prop) {
389
- const ctx = tryGetInvokeContext();
390
- if (ctx) {
391
- const effectSubscriber = ctx.$effectSubscriber$;
392
- effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
393
- }
394
- }
395
- return Object.prototype.hasOwnProperty.call(target, prop);
255
+ valueOf() {
396
256
  }
397
- ownKeys(target) {
398
- const ctx = tryGetInvokeContext();
399
- const effectSubscriber = ctx?.$effectSubscriber$;
400
- return effectSubscriber && addStoreEffect(target, STORE_ALL_PROPS, this, effectSubscriber), Reflect.ownKeys(target);
257
+ toString() {
258
+ return this.constructor.name;
401
259
  }
402
- getOwnPropertyDescriptor(target, prop) {
403
- const descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
404
- return Array.isArray(target) || "symbol" == typeof prop || descriptor && !descriptor.configurable ? descriptor : {
405
- enumerable: true,
406
- configurable: true
260
+ toJSON() {
261
+ return {
262
+ value: this.$untrackedValue$
407
263
  };
408
264
  }
409
265
  }
410
- function addStoreEffect(target, prop, store, effectSubscription) {
411
- const effectsMap = store.$effects$ || (store.$effects$ = /* @__PURE__ */ new Map());
412
- let effects = effectsMap.get(prop);
413
- effects || (effects = /* @__PURE__ */ new Set(), effectsMap.set(prop, effects)), ensureContainsSubscription(effects, effectSubscription), ensureContainsBackRef(effectSubscription, target), addQrlToSerializationCtx(effectSubscription, store.$container$);
414
- }
415
- function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
416
- target[prop] = value, triggerEffects(currentStore.$container$, currentStore, getEffects(target, prop, currentStore.$effects$));
417
- }
418
- function getEffects(target, prop, storeEffects) {
419
- let effectsToTrigger;
420
- if (storeEffects) {
421
- if (Array.isArray(target)) {
422
- for (const effects of storeEffects.values()) {
423
- effectsToTrigger || (effectsToTrigger = /* @__PURE__ */ new Set());
424
- for (const effect of effects) {
425
- effectsToTrigger.add(effect);
426
- }
427
- }
428
- } else {
429
- effectsToTrigger = storeEffects.get(prop);
430
- }
266
+ const ensureContainsSubscription = (array, effectSubscription) => {
267
+ array.add(effectSubscription);
268
+ };
269
+ const ensureContainsBackRef = (array, value) => {
270
+ array[2] || (array[2] = /* @__PURE__ */ new Set()), array[2].add(value);
271
+ };
272
+ const addQrlToSerializationCtx = (effectSubscriber, container) => {
273
+ if (container && !isDomContainer(container)) {
274
+ const effect = effectSubscriber[0];
275
+ const property = effectSubscriber[1];
276
+ let qrl2 = null;
277
+ isTask(effect) ? qrl2 = effect.$qrl$ : effect instanceof ComputedSignalImpl ? qrl2 = effect.$computeQrl$ : ":" === property && (qrl2 = container.getHostProp(effect, "q:renderFn")), qrl2 && container.serializationCtx.$eventQrls$.add(qrl2);
278
+ }
279
+ };
280
+ const triggerEffects = (container, signal, effects) => {
281
+ const isBrowser2 = isDomContainer(container);
282
+ if (effects) {
283
+ const scheduleEffect = (effectSubscription) => {
284
+ const consumer = effectSubscription[0];
285
+ const property = effectSubscription[1];
286
+ if (isTask(consumer)) {
287
+ consumer.$flags$ |= 8;
288
+ let choreType = 3;
289
+ 1 & consumer.$flags$ && (choreType = 32), container.$scheduler$(choreType, consumer);
290
+ } else if (consumer instanceof SignalImpl) {
291
+ consumer instanceof ComputedSignalImpl && (consumer.$computeQrl$.resolved || container.$scheduler$(1, null, consumer.$computeQrl$)), consumer.$invalidate$();
292
+ } else if (":" === property) {
293
+ const host = consumer;
294
+ const qrl2 = container.getHostProp(host, "q:renderFn");
295
+ const props = container.getHostProp(host, "q:props");
296
+ container.$scheduler$(6, host, qrl2, props);
297
+ } else if (isBrowser2) {
298
+ if ("." === property) {
299
+ container.$scheduler$(4, consumer, consumer, signal);
300
+ } else {
301
+ const effectData = effectSubscription[3];
302
+ if (effectData instanceof SubscriptionData) {
303
+ const payload = {
304
+ ...effectData.data,
305
+ $value$: signal
306
+ };
307
+ container.$scheduler$(5, consumer, property, payload);
308
+ }
309
+ }
310
+ }
311
+ };
312
+ for (const effect of effects) {
313
+ scheduleEffect(effect);
314
+ }
315
+ }
316
+ };
317
+ class ComputedSignalImpl extends (_b = SignalImpl, _a = _EFFECT_BACK_REF, _b) {
318
+ constructor(container, fn, flags = 1) {
319
+ super(container, NEEDS_COMPUTATION);
320
+ __publicField(this, "$computeQrl$");
321
+ __publicField(this, "$flags$");
322
+ __publicField(this, "$forceRunEffects$", false);
323
+ __publicField(this, _a, null);
324
+ this.$computeQrl$ = fn, this.$flags$ = flags;
325
+ }
326
+ $invalidate$() {
327
+ this.$flags$ |= 1, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(7, null, this);
328
+ }
329
+ force() {
330
+ this.$forceRunEffects$ = true, this.$container$?.$scheduler$(7, null, this);
331
+ }
332
+ get untrackedValue() {
333
+ const didChange = this.$computeIfNeeded$();
334
+ return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
335
+ }
336
+ $computeIfNeeded$() {
337
+ if (!(1 & this.$flags$)) {
338
+ return false;
339
+ }
340
+ const computeQrl = this.$computeQrl$;
341
+ throwIfQRLNotResolved(computeQrl);
342
+ const ctx = tryGetInvokeContext();
343
+ const previousEffectSubscription = ctx?.$effectSubscriber$;
344
+ ctx && (ctx.$effectSubscriber$ = getSubscriber(this, "."));
345
+ try {
346
+ const untrackedValue = computeQrl.getFn(ctx)();
347
+ if (isPromise(untrackedValue)) {
348
+ throw qError(46, [computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$]);
349
+ }
350
+ this.$flags$ &= -2;
351
+ const didChange = untrackedValue !== this.$untrackedValue$;
352
+ return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
353
+ } finally {
354
+ ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
355
+ }
356
+ }
357
+ set value(_) {
358
+ throw qError(47);
359
+ }
360
+ get value() {
361
+ return super.value;
362
+ }
363
+ }
364
+ class WrappedSignal extends (_d = SignalImpl, _c = _EFFECT_BACK_REF, _d) {
365
+ constructor(container, fn, args, fnStr, flags = 3) {
366
+ super(container, NEEDS_COMPUTATION);
367
+ __publicField(this, "$args$");
368
+ __publicField(this, "$func$");
369
+ __publicField(this, "$funcStr$");
370
+ __publicField(this, "$flags$");
371
+ __publicField(this, "$hostElement$", null);
372
+ __publicField(this, "$forceRunEffects$", false);
373
+ __publicField(this, _c, null);
374
+ this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr, this.$flags$ = flags;
375
+ }
376
+ $invalidate$() {
377
+ this.$flags$ |= 1, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(7, this.$hostElement$, this);
378
+ }
379
+ force() {
380
+ this.$flags$ |= 1, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
381
+ }
382
+ get untrackedValue() {
383
+ const didChange = this.$computeIfNeeded$();
384
+ return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
385
+ }
386
+ $computeIfNeeded$() {
387
+ if (!(1 & this.$flags$)) {
388
+ return false;
389
+ }
390
+ const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, ".", this.$container$);
391
+ const didChange = untrackedValue !== this.$untrackedValue$;
392
+ return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
393
+ }
394
+ set value(_) {
395
+ throw qError(48);
396
+ }
397
+ get value() {
398
+ return super.value;
399
+ }
400
+ }
401
+ class SerializerSignalImpl extends ComputedSignalImpl {
402
+ constructor(container, argQrl) {
403
+ super(container, argQrl);
404
+ __publicField(this, "$didInitialize$", false);
405
+ }
406
+ $computeIfNeeded$() {
407
+ if (!(1 & this.$flags$)) {
408
+ return false;
409
+ }
410
+ throwIfQRLNotResolved(this.$computeQrl$);
411
+ let arg = this.$computeQrl$.resolved;
412
+ "function" == typeof arg && (arg = arg());
413
+ const { deserialize, initial } = arg;
414
+ const update = arg.update;
415
+ const currentValue = this.$untrackedValue$ === NEEDS_COMPUTATION ? initial : this.$untrackedValue$;
416
+ const untrackedValue = trackSignal(() => this.$didInitialize$ ? update?.(currentValue) : deserialize(currentValue), this, ".", this.$container$);
417
+ const didChange = this.$didInitialize$ && "undefined" !== untrackedValue || untrackedValue !== this.$untrackedValue$;
418
+ return this.$flags$ &= -2, this.$didInitialize$ = true, didChange && (this.$untrackedValue$ = untrackedValue), didChange;
419
+ }
420
+ }
421
+ const isSerializerObj = (obj) => "object" == typeof obj && null !== obj && "function" == typeof obj[SerializerSymbol];
422
+ const STORE_TARGET = Symbol("store.target");
423
+ const STORE_HANDLER = Symbol("store.handler");
424
+ const STORE_ALL_PROPS = Symbol("store.all");
425
+ const getStoreHandler = (value) => value[STORE_HANDLER];
426
+ const getStoreTarget = (value) => value?.[STORE_TARGET] || null;
427
+ const unwrapStore = (value) => getStoreTarget(value) || value;
428
+ const isStore = (value) => STORE_TARGET in value;
429
+ function createStore(container, obj, flags) {
430
+ return new Proxy(obj, new StoreHandler(flags, container || null));
431
+ }
432
+ const getOrCreateStore = (obj, flags, container) => {
433
+ if (isSerializableObject(obj) && container) {
434
+ let store = container.$storeProxyMap$.get(obj);
435
+ return store || (store = createStore(container, obj, flags), container.$storeProxyMap$.set(obj, store)), store;
436
+ }
437
+ return obj;
438
+ };
439
+ class StoreHandler {
440
+ constructor($flags$, $container$) {
441
+ __publicField(this, "$flags$");
442
+ __publicField(this, "$container$");
443
+ __publicField(this, "$effects$", null);
444
+ this.$flags$ = $flags$, this.$container$ = $container$;
445
+ }
446
+ toString() {
447
+ return "[Store]";
448
+ }
449
+ get(target, prop) {
450
+ if ("symbol" == typeof prop) {
451
+ return prop === STORE_TARGET ? target : prop === STORE_HANDLER ? this : target[prop];
452
+ }
453
+ const ctx = tryGetInvokeContext();
454
+ const value = target[prop];
455
+ if (ctx) {
456
+ if (null === this.$container$) {
457
+ if (!ctx.$container$) {
458
+ return value;
459
+ }
460
+ this.$container$ = ctx.$container$;
461
+ } else {
462
+ assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$);
463
+ }
464
+ const effectSubscriber = ctx.$effectSubscriber$;
465
+ effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
466
+ }
467
+ if ("toString" === prop && value === Object.prototype.toString) {
468
+ return this.toString;
469
+ }
470
+ return 1 & this.$flags$ && "object" == typeof value && null !== value && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target) ? getOrCreateStore(value, this.$flags$, this.$container$) : value;
471
+ }
472
+ set(target, prop, value) {
473
+ if ("symbol" == typeof prop) {
474
+ return target[prop] = value, true;
475
+ }
476
+ const newValue = 1 & this.$flags$ ? unwrapStore(value) : value;
477
+ if (prop in target) {
478
+ newValue !== target[prop] && setNewValueAndTriggerEffects(prop, newValue, target, this);
479
+ } else {
480
+ setNewValueAndTriggerEffects(prop, newValue, target, this);
481
+ }
482
+ return true;
483
+ }
484
+ deleteProperty(target, prop) {
485
+ return "string" == typeof prop && delete target[prop] && (triggerEffects(this.$container$, this, getEffects(target, prop, this.$effects$)), true);
486
+ }
487
+ has(target, prop) {
488
+ if (prop === STORE_TARGET) {
489
+ return true;
490
+ }
491
+ if ("string" == typeof prop) {
492
+ const ctx = tryGetInvokeContext();
493
+ if (ctx) {
494
+ const effectSubscriber = ctx.$effectSubscriber$;
495
+ effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
496
+ }
497
+ }
498
+ return Object.prototype.hasOwnProperty.call(target, prop);
499
+ }
500
+ ownKeys(target) {
501
+ const ctx = tryGetInvokeContext();
502
+ const effectSubscriber = ctx?.$effectSubscriber$;
503
+ return effectSubscriber && addStoreEffect(target, STORE_ALL_PROPS, this, effectSubscriber), Reflect.ownKeys(target);
504
+ }
505
+ getOwnPropertyDescriptor(target, prop) {
506
+ const descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
507
+ return Array.isArray(target) || "symbol" == typeof prop || descriptor && !descriptor.configurable ? descriptor : {
508
+ enumerable: true,
509
+ configurable: true
510
+ };
511
+ }
512
+ }
513
+ function addStoreEffect(target, prop, store, effectSubscription) {
514
+ const effectsMap = store.$effects$ || (store.$effects$ = /* @__PURE__ */ new Map());
515
+ let effects = effectsMap.get(prop);
516
+ effects || (effects = /* @__PURE__ */ new Set(), effectsMap.set(prop, effects)), ensureContainsSubscription(effects, effectSubscription), ensureContainsBackRef(effectSubscription, target), addQrlToSerializationCtx(effectSubscription, store.$container$);
517
+ }
518
+ function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
519
+ target[prop] = value, triggerEffects(currentStore.$container$, currentStore, getEffects(target, prop, currentStore.$effects$));
520
+ }
521
+ function getEffects(target, prop, storeEffects) {
522
+ let effectsToTrigger;
523
+ if (storeEffects) {
524
+ if (Array.isArray(target)) {
525
+ for (const effects of storeEffects.values()) {
526
+ effectsToTrigger || (effectsToTrigger = /* @__PURE__ */ new Set());
527
+ for (const effect of effects) {
528
+ effectsToTrigger.add(effect);
529
+ }
530
+ }
531
+ } else {
532
+ effectsToTrigger = storeEffects.get(prop);
533
+ }
431
534
  }
432
535
  const storeArrayValue = storeEffects?.get(STORE_ALL_PROPS);
433
536
  if (storeArrayValue) {
@@ -438,12 +541,10 @@ function getEffects(target, prop, storeEffects) {
438
541
  }
439
542
  return effectsToTrigger || null;
440
543
  }
441
- const NEEDS_COMPUTATION = Symbol("invalid");
442
- const _EFFECT_BACK_REF = Symbol("backRef");
443
- _a = _EFFECT_BACK_REF;
544
+ _e = _EFFECT_BACK_REF;
444
545
  class BackRef {
445
546
  constructor() {
446
- __publicField(this, _a, null);
547
+ __publicField(this, _e, null);
447
548
  }
448
549
  }
449
550
  function clearAllEffects(container, consumer) {
@@ -451,12 +552,12 @@ function clearAllEffects(container, consumer) {
451
552
  const effects = consumer[_EFFECT_BACK_REF];
452
553
  if (effects) {
453
554
  for (const [, effect] of effects) {
454
- const backRefs = effect[EffectSubscriptionProp.BACK_REF];
555
+ const backRefs = effect[2];
455
556
  if (!backRefs) {
456
557
  return;
457
558
  }
458
559
  for (const producer of backRefs) {
459
- if (producer instanceof Signal) {
560
+ if (producer instanceof SignalImpl) {
460
561
  clearSignal(container, producer, effect);
461
562
  } else if (container.$storeProxyMap$.has(producer)) {
462
563
  const target = container.$storeProxyMap$.get(producer);
@@ -478,21 +579,8 @@ function clearStore(producer, effect) {
478
579
  }
479
580
  }
480
581
  }
481
- function getSubscriber(effect, prop, data) {
482
- effect[_EFFECT_BACK_REF] || (isServer && isSsrNode(effect) ? effect.setProp("q:brefs", /* @__PURE__ */ new Map()) : effect[_EFFECT_BACK_REF] = /* @__PURE__ */ new Map());
483
- const subMap = effect[_EFFECT_BACK_REF];
484
- let sub = subMap.get(prop);
485
- return sub || (sub = [effect, prop], subMap.set(prop, sub)), data && (sub[EffectSubscriptionProp.DATA] = data), sub;
486
- }
487
- function isSsrNode(value) {
488
- return "__brand__" in value && "currentComponentNode" in value;
489
- }
490
- var TaskFlags;
491
- !function(TaskFlags2) {
492
- TaskFlags2[TaskFlags2.VISIBLE_TASK = 1] = "VISIBLE_TASK", TaskFlags2[TaskFlags2.TASK = 2] = "TASK", TaskFlags2[TaskFlags2.RESOURCE = 4] = "RESOURCE", TaskFlags2[TaskFlags2.DIRTY = 8] = "DIRTY";
493
- }(TaskFlags || (TaskFlags = {}));
494
582
  const runTask = (task, container, host) => {
495
- task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
583
+ task.$flags$ &= -9, cleanupTask(task);
496
584
  const iCtx = newInvokeContext(container.$locale$, host, void 0, "qTask");
497
585
  iCtx.$container$ = container;
498
586
  const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
@@ -511,7 +599,7 @@ const runTask = (task, container, host) => {
511
599
  const taskApi = {
512
600
  track: (obj, prop) => {
513
601
  const ctx = newInvokeContext();
514
- return ctx.$effectSubscriber$ = getSubscriber(task, EffectProperty.COMPONENT), ctx.$container$ = container, invoke(ctx, () => {
602
+ return ctx.$effectSubscriber$ = getSubscriber(task, ":"), ctx.$container$ = container, invoke(ctx, () => {
515
603
  if (isFunction(obj)) {
516
604
  return obj();
517
605
  }
@@ -524,7 +612,7 @@ const runTask = (task, container, host) => {
524
612
  if (isStore(obj)) {
525
613
  return addStoreEffect(getStoreTarget(obj), STORE_ALL_PROPS, getStoreHandler(obj), ctx.$effectSubscriber$), obj;
526
614
  }
527
- throw qError(QError.trackObjectWithoutProp);
615
+ throw qError(2);
528
616
  });
529
617
  },
530
618
  cleanup: cleanup2
@@ -560,25 +648,33 @@ class Task extends BackRef {
560
648
  }
561
649
  }
562
650
  const isTask = (value) => value instanceof Task;
563
- var VNodeFlags;
564
- var VNodeFlagsIndex;
565
- var VNodeProps;
566
- var ElementVNodeProps;
567
- var TextVNodeProps;
568
- var VirtualVNodeProps;
569
- !function(VNodeFlags2) {
570
- VNodeFlags2[VNodeFlags2.Element = 1] = "Element", VNodeFlags2[VNodeFlags2.Virtual = 2] = "Virtual", VNodeFlags2[VNodeFlags2.ELEMENT_OR_VIRTUAL_MASK = 3] = "ELEMENT_OR_VIRTUAL_MASK", VNodeFlags2[VNodeFlags2.ELEMENT_OR_TEXT_MASK = 5] = "ELEMENT_OR_TEXT_MASK", VNodeFlags2[VNodeFlags2.TYPE_MASK = 7] = "TYPE_MASK", VNodeFlags2[VNodeFlags2.INFLATED_TYPE_MASK = 15] = "INFLATED_TYPE_MASK", VNodeFlags2[VNodeFlags2.Text = 4] = "Text", VNodeFlags2[VNodeFlags2.Inflated = 8] = "Inflated", VNodeFlags2[VNodeFlags2.Resolved = 16] = "Resolved", VNodeFlags2[VNodeFlags2.Deleted = 32] = "Deleted", VNodeFlags2[VNodeFlags2.NAMESPACE_MASK = 192] = "NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NEGATED_NAMESPACE_MASK = -193] = "NEGATED_NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NS_html = 0] = "NS_html", VNodeFlags2[VNodeFlags2.NS_svg = 64] = "NS_svg", VNodeFlags2[VNodeFlags2.NS_math = 128] = "NS_math";
571
- }(VNodeFlags || (VNodeFlags = {})), function(VNodeFlagsIndex2) {
572
- VNodeFlagsIndex2[VNodeFlagsIndex2.mask = -256] = "mask", VNodeFlagsIndex2[VNodeFlagsIndex2.negated_mask = 255] = "negated_mask", VNodeFlagsIndex2[VNodeFlagsIndex2.shift = 8] = "shift";
573
- }(VNodeFlagsIndex || (VNodeFlagsIndex = {})), function(VNodeProps2) {
574
- VNodeProps2[VNodeProps2.flags = 0] = "flags", VNodeProps2[VNodeProps2.parent = 1] = "parent", VNodeProps2[VNodeProps2.previousSibling = 2] = "previousSibling", VNodeProps2[VNodeProps2.nextSibling = 3] = "nextSibling";
575
- }(VNodeProps || (VNodeProps = {})), function(ElementVNodeProps2) {
576
- ElementVNodeProps2[ElementVNodeProps2.firstChild = 4] = "firstChild", ElementVNodeProps2[ElementVNodeProps2.lastChild = 5] = "lastChild", ElementVNodeProps2[ElementVNodeProps2.element = 6] = "element", ElementVNodeProps2[ElementVNodeProps2.elementName = 7] = "elementName", ElementVNodeProps2[ElementVNodeProps2.PROPS_OFFSET = 8] = "PROPS_OFFSET";
577
- }(ElementVNodeProps || (ElementVNodeProps = {})), function(TextVNodeProps2) {
578
- TextVNodeProps2[TextVNodeProps2.node = 4] = "node", TextVNodeProps2[TextVNodeProps2.text = 5] = "text";
579
- }(TextVNodeProps || (TextVNodeProps = {})), function(VirtualVNodeProps2) {
580
- VirtualVNodeProps2[VirtualVNodeProps2.firstChild = 4] = "firstChild", VirtualVNodeProps2[VirtualVNodeProps2.lastChild = 5] = "lastChild", VirtualVNodeProps2[VirtualVNodeProps2.PROPS_OFFSET = 6] = "PROPS_OFFSET";
581
- }(VirtualVNodeProps || (VirtualVNodeProps = {}));
651
+ const styleContent = (styleId) => "⚡️" + styleId;
652
+ function hasClassAttr(props) {
653
+ for (const key in props) {
654
+ if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
655
+ return true;
656
+ }
657
+ }
658
+ return false;
659
+ }
660
+ function isClassAttr(key) {
661
+ return "class" === key || "className" === key;
662
+ }
663
+ function convertScopedStyleIdsToArray(scopedStyleIds) {
664
+ return scopedStyleIds?.split(" ") ?? null;
665
+ }
666
+ function convertStyleIdsToString(scopedStyleIds) {
667
+ return Array.from(scopedStyleIds).join(" ");
668
+ }
669
+ const addComponentStylePrefix = (styleId) => {
670
+ if (styleId) {
671
+ let idx = 0;
672
+ do {
673
+ styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
674
+ } while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
675
+ }
676
+ return styleId || null;
677
+ };
582
678
  const mapApp_findIndx = (array, key, start) => {
583
679
  let bottom = start >> 1;
584
680
  let top = array.length - 2 >> 1;
@@ -603,15 +699,15 @@ const mapArray_get = (array, key, start) => {
603
699
  const isForeignObjectElement = (elementName) => "foreignObject" === elementName;
604
700
  const isSvgElement = (elementName) => "svg" === elementName || isForeignObjectElement(elementName);
605
701
  const isMathElement = (elementName) => "math" === elementName;
606
- const vnode_isDefaultNamespace = (vnode) => !(vnode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK);
702
+ const vnode_isDefaultNamespace = (vnode) => !(192 & vnode[0]);
607
703
  const vnode_getElementNamespaceFlags = (element) => {
608
704
  switch (fastNamespaceURI(element)) {
609
705
  case SVG_NS:
610
- return VNodeFlags.NS_svg;
706
+ return 64;
611
707
  case MATH_NS:
612
- return VNodeFlags.NS_math;
708
+ return 128;
613
709
  default:
614
- return VNodeFlags.NS_html;
710
+ return 0;
615
711
  }
616
712
  };
617
713
  function vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild) {
@@ -624,11 +720,11 @@ function vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNo
624
720
  for (let i = 0; i < children.length; i++) {
625
721
  const childVNode = children[i];
626
722
  if (vnode_isTextVNode(childVNode)) {
627
- domChildren.push(childVNode[TextVNodeProps.node]);
723
+ domChildren.push(childVNode[4]);
628
724
  continue;
629
725
  }
630
- if ((childVNode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK) == (domParentVNode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK)) {
631
- domChildren.push(childVNode[ElementVNodeProps.element]);
726
+ if ((192 & childVNode[0]) == (192 & domParentVNode[0])) {
727
+ domChildren.push(childVNode[6]);
632
728
  continue;
633
729
  }
634
730
  const newChildElement = vnode_cloneElementWithNamespace(childVNode, domParentVNode, elementNamespace, elementNamespaceFlag);
@@ -656,7 +752,7 @@ function vnode_cloneElementWithNamespace(elementVNode, parentVNode, namespace, n
656
752
  let childElement = null;
657
753
  let newChildElement = null;
658
754
  if (vnode_isElementVNode(vCursor)) {
659
- childElement = vCursor[ElementVNodeProps.element];
755
+ childElement = vCursor[6];
660
756
  const childElementTag = vnode_getElementName(vCursor);
661
757
  const vCursorParent = vnode_getParent(vCursor);
662
758
  const vCursorDomParent = null == rootElement ? parentVNode : vCursorParent && vnode_getDomParentVNode(vCursorParent);
@@ -666,7 +762,7 @@ function vnode_cloneElementWithNamespace(elementVNode, parentVNode, namespace, n
666
762
  }
667
763
  newChildElement = cloneElementWithNamespace(childElement, childElementTag, namespace), childElement.remove(), null == rootElement && (rootElement = newChildElement), parentElement && parentElement.appendChild(newChildElement);
668
764
  const vFirstChild = vnode_getFirstChild(vCursor);
669
- if (vCursor[ElementVNodeProps.element] = newChildElement, vCursor[VNodeProps.flags] &= VNodeFlags.NEGATED_NAMESPACE_MASK, vCursor[VNodeProps.flags] |= namespaceFlag, vFirstChild) {
765
+ if (vCursor[6] = newChildElement, vCursor[0] &= -193, vCursor[0] |= namespaceFlag, vFirstChild) {
670
766
  vCursor = vFirstChild, parentElement = newChildElement;
671
767
  continue;
672
768
  }
@@ -706,23 +802,23 @@ function vnode_cloneElementWithNamespace(elementVNode, parentVNode, namespace, n
706
802
  return rootElement;
707
803
  }
708
804
  function isSvg(tagOrVNode) {
709
- return "string" == typeof tagOrVNode ? isSvgElement(tagOrVNode) : !!(tagOrVNode[VNodeProps.flags] & VNodeFlags.NS_svg);
805
+ return "string" == typeof tagOrVNode ? isSvgElement(tagOrVNode) : !!(64 & tagOrVNode[0]);
710
806
  }
711
807
  function isMath(tagOrVNode) {
712
- return "string" == typeof tagOrVNode ? isMathElement(tagOrVNode) : !!(tagOrVNode[VNodeProps.flags] & VNodeFlags.NS_math);
808
+ return "string" == typeof tagOrVNode ? isMathElement(tagOrVNode) : !!(128 & tagOrVNode[0]);
713
809
  }
714
810
  function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
715
811
  const parentIsDefaultNamespace = !domParentVNode || !!vnode_getElementName(domParentVNode) && vnode_isDefaultNamespace(domParentVNode);
716
812
  const parentIsForeignObject = !parentIsDefaultNamespace && isForeignObjectElement(vnode_getElementName(domParentVNode));
717
813
  let elementNamespace = HTML_NS;
718
- let elementNamespaceFlag = VNodeFlags.NS_html;
814
+ let elementNamespaceFlag = 0;
719
815
  const isElementVNodeOrString = "string" == typeof tagOrVNode || vnode_isElementVNode(tagOrVNode);
720
816
  if (isElementVNodeOrString && isSvg(tagOrVNode)) {
721
- elementNamespace = SVG_NS, elementNamespaceFlag = VNodeFlags.NS_svg;
817
+ elementNamespace = SVG_NS, elementNamespaceFlag = 64;
722
818
  } else if (isElementVNodeOrString && isMath(tagOrVNode)) {
723
- elementNamespace = MATH_NS, elementNamespaceFlag = VNodeFlags.NS_math;
819
+ elementNamespace = MATH_NS, elementNamespaceFlag = 128;
724
820
  } else if (domParentVNode && !parentIsForeignObject && !parentIsDefaultNamespace) {
725
- elementNamespace = !!(domParentVNode[VNodeProps.flags] & VNodeFlags.NS_svg) ? SVG_NS : !!(domParentVNode[VNodeProps.flags] & VNodeFlags.NS_math) ? MATH_NS : HTML_NS, elementNamespaceFlag = domParentVNode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK;
821
+ elementNamespace = !!(64 & domParentVNode[0]) ? SVG_NS : !!(128 & domParentVNode[0]) ? MATH_NS : HTML_NS, elementNamespaceFlag = 192 & domParentVNode[0];
726
822
  }
727
823
  return {
728
824
  elementNamespace,
@@ -732,7 +828,7 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
732
828
  const executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
733
829
  const iCtx = newInvokeContext(container.$locale$, subscriptionHost || void 0, void 0, "qRender");
734
830
  let componentFn;
735
- subscriptionHost && (iCtx.$effectSubscriber$ = getSubscriber(subscriptionHost, EffectProperty.COMPONENT), iCtx.$container$ = container), container.ensureProjectionResolved(renderHost);
831
+ subscriptionHost && (iCtx.$effectSubscriber$ = getSubscriber(subscriptionHost, ":"), iCtx.$container$ = container), container.ensureProjectionResolved(renderHost);
736
832
  let isInlineComponent = false;
737
833
  if (null === componentQRL && assertDefined(componentQRL = container.getHostProp(renderHost, "q:renderFn")), isQrl$1(componentQRL)) {
738
834
  (props = props || container.getHostProp(renderHost, "q:props") || EMPTY_OBJ).children && delete props.children, componentFn = componentQRL.getFn(iCtx);
@@ -851,16 +947,84 @@ function escapeHTML(html) {
851
947
  }
852
948
  return 0 === lastIdx ? html : escapedHTML + html.substring(lastIdx);
853
949
  }
854
- const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
855
- let journal = container.$journal$;
856
- const stack2 = [];
857
- const asyncQueue = [];
858
- let vParent = null;
859
- let vCurrent = null;
860
- let vNewNode = null;
861
- let vSiblings = null;
862
- let vSiblingsIdx = -1;
863
- let jsxChildren = null;
950
+ const unitlessNumbers = /* @__PURE__ */ new Set(["animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexShrink", "gridArea", "gridRow", "gridRowEnd", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "MozAnimationIterationCount", "MozBoxFlex", "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp"]);
951
+ const isUnitlessNumber = (name) => unitlessNumbers.has(name);
952
+ const serializeClass = (obj) => {
953
+ if (!obj) {
954
+ return "";
955
+ }
956
+ if (isString(obj)) {
957
+ return obj.trim();
958
+ }
959
+ const classes = [];
960
+ if (isArray(obj)) {
961
+ for (const o of obj) {
962
+ const classList = serializeClass(o);
963
+ classList && classes.push(classList);
964
+ }
965
+ } else {
966
+ for (const [key, value] of Object.entries(obj)) {
967
+ value && classes.push(key.trim());
968
+ }
969
+ }
970
+ return classes.join(" ");
971
+ };
972
+ const fromCamelToKebabCaseWithDash = (text) => text.replace(/([A-Z])/g, "-$1").toLowerCase();
973
+ const stringifyStyle = (obj) => {
974
+ if (null == obj) {
975
+ return "";
976
+ }
977
+ if ("object" == typeof obj) {
978
+ if (isArray(obj)) {
979
+ throw qError(0, [obj, "style"]);
980
+ }
981
+ {
982
+ const chunks = [];
983
+ for (const key in obj) {
984
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
985
+ const value = obj[key];
986
+ null != value && "function" != typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(fromCamelToKebabCaseWithDash(key) + ":" + setValueForStyle(key, value)));
987
+ }
988
+ }
989
+ return chunks.join(";");
990
+ }
991
+ }
992
+ return String(obj);
993
+ };
994
+ const serializeBooleanOrNumberAttribute = (value) => null != value ? String(value) : null;
995
+ function serializeAttribute(key, value, styleScopedId) {
996
+ if (isClassAttr(key)) {
997
+ const serializedClass = serializeClass(value);
998
+ value = styleScopedId ? styleScopedId + (serializedClass.length ? " " + serializedClass : serializedClass) : serializedClass;
999
+ } else {
1000
+ "style" === key ? value = stringifyStyle(value) : isEnumeratedBooleanAttribute(key) || "number" == typeof value ? value = serializeBooleanOrNumberAttribute(value) : false === value || null == value ? value = null : true === value && isPreventDefault(key) && (value = "");
1001
+ }
1002
+ return value;
1003
+ }
1004
+ function isEnumeratedBooleanAttribute(key) {
1005
+ return isAriaAttribute(key) || ["spellcheck", "draggable", "contenteditable"].includes(key);
1006
+ }
1007
+ const setValueForStyle = (styleName, value) => "number" != typeof value || 0 === value || isUnitlessNumber(styleName) ? value : value + "px";
1008
+ function isAriaAttribute(prop) {
1009
+ return prop.startsWith("aria-");
1010
+ }
1011
+ function getFileLocationFromJsx(jsxDev) {
1012
+ if (!jsxDev) {
1013
+ return null;
1014
+ }
1015
+ const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
1016
+ return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
1017
+ }
1018
+ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1019
+ let journal = container.$journal$;
1020
+ const stack2 = [];
1021
+ const asyncQueue = [];
1022
+ let vParent = null;
1023
+ let vCurrent = null;
1024
+ let vNewNode = null;
1025
+ let vSiblings = null;
1026
+ let vSiblingsArray = null;
1027
+ let jsxChildren = null;
864
1028
  let jsxValue = null;
865
1029
  let jsxIdx = 0;
866
1030
  let jsxCount = 0;
@@ -886,12 +1050,12 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
886
1050
  if (Array.isArray(jsxValue)) {
887
1051
  descend(jsxValue, false);
888
1052
  } else if (isSignal(jsxValue)) {
889
- vCurrent && clearAllEffects(container, vCurrent), expectVirtual(VirtualType.WrappedSignal, null), descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, EffectProperty.VNODE, container), true);
1053
+ vCurrent && clearAllEffects(container, vCurrent), expectVirtual("S", null), descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, ".", container), true);
890
1054
  } else if (isPromise(jsxValue)) {
891
- expectVirtual(VirtualType.Awaited, null), asyncQueue.push(jsxValue, vNewNode || vCurrent);
1055
+ expectVirtual("A", null), asyncQueue.push(jsxValue, vNewNode || vCurrent);
892
1056
  } else if (isJSXNode(jsxValue)) {
893
1057
  const type = jsxValue.type;
894
- "string" == typeof type ? (expectNoMoreTextNodes(), expectElement(jsxValue, type), descend(jsxValue.children, true)) : "function" == typeof type && (type === Fragment ? (expectNoMoreTextNodes(), expectVirtual(VirtualType.Fragment, jsxValue.key), descend(jsxValue.children, true)) : type === Slot ? (expectNoMoreTextNodes(), expectSlot() || descend(jsxValue.children, true)) : type === Projection ? (expectProjection(), descend(jsxValue.children, true)) : type === SSRComment || type === SSRRaw ? expectNoMore() : (expectNoMoreTextNodes(), expectComponent(type)));
1058
+ "string" == typeof type ? (expectNoMoreTextNodes(), expectElement(jsxValue, type), descend(jsxValue.children, true)) : "function" == typeof type && (type === Fragment ? (expectNoMoreTextNodes(), expectVirtual("F", jsxValue.key), descend(jsxValue.children, true)) : type === Slot ? (expectNoMoreTextNodes(), expectSlot() || descend(jsxValue.children, true)) : type === Projection ? (expectProjection(), descend(jsxValue.children, true)) : type === SSRComment || type === SSRRaw ? expectNoMore() : (expectNoMoreTextNodes(), expectComponent(type)));
895
1059
  }
896
1060
  } else {
897
1061
  jsxValue === SkipRender ? journal = [] : expectText("");
@@ -914,17 +1078,13 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
914
1078
  }
915
1079
  }
916
1080
  function peekNextSibling() {
917
- if (null !== vSiblings) {
918
- const idx = vSiblingsIdx + SiblingsArray.NextVNode;
919
- return idx < vSiblings.length ? vSiblings[idx] : null;
920
- }
921
1081
  return vCurrent ? vnode_getNextSibling(vCurrent) : null;
922
1082
  }
923
1083
  function advanceToNextSibling() {
924
- vCurrent = peekNextSibling(), null !== vSiblings && (vSiblingsIdx += SiblingsArray.Size);
1084
+ vCurrent = peekNextSibling();
925
1085
  }
926
1086
  function descend(children, descendVNode) {
927
- null != children ? (stackPush(children, descendVNode), descendVNode && (vSiblings = null, vSiblingsIdx = -1, vParent = vNewNode || vCurrent, vCurrent = vnode_getFirstChild(vParent), vNewNode = null), shouldAdvance = false) : function() {
1087
+ null != children ? (stackPush(children, descendVNode), descendVNode && (vSiblings = null, vSiblingsArray = null, vParent = vNewNode || vCurrent, vCurrent = vnode_getFirstChild(vParent), vNewNode = null), shouldAdvance = false) : function() {
928
1088
  const vFirstChild = vCurrent && vnode_getFirstChild(vCurrent);
929
1089
  if (null !== vFirstChild) {
930
1090
  let vChild = vFirstChild;
@@ -936,24 +1096,17 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
936
1096
  }();
937
1097
  }
938
1098
  function ascend() {
939
- stack2.pop() && (vSiblingsIdx = stack2.pop(), vSiblings = stack2.pop(), vNewNode = stack2.pop(), vCurrent = stack2.pop(), vParent = stack2.pop()), jsxValue = stack2.pop(), jsxCount = stack2.pop(), jsxIdx = stack2.pop(), jsxChildren = stack2.pop(), advance();
1099
+ stack2.pop() && (vSiblings = stack2.pop(), vSiblingsArray = stack2.pop(), vNewNode = stack2.pop(), vCurrent = stack2.pop(), vParent = stack2.pop()), jsxValue = stack2.pop(), jsxCount = stack2.pop(), jsxIdx = stack2.pop(), jsxChildren = stack2.pop(), advance();
940
1100
  }
941
1101
  function stackPush(children, descendVNode) {
942
- stack2.push(jsxChildren, jsxIdx, jsxCount, jsxValue), descendVNode && stack2.push(vParent, vCurrent, vNewNode, vSiblings, vSiblingsIdx), stack2.push(descendVNode), Array.isArray(children) ? (jsxIdx = 0, jsxCount = children.length, jsxChildren = children, jsxValue = jsxCount > 0 ? children[0] : null) : void 0 === children ? (jsxIdx = 0, jsxValue = null, jsxChildren = null, jsxCount = 0) : (jsxIdx = 0, jsxValue = children, jsxChildren = null, jsxCount = 1);
1102
+ stack2.push(jsxChildren, jsxIdx, jsxCount, jsxValue), descendVNode && stack2.push(vParent, vCurrent, vNewNode, vSiblingsArray, vSiblings), stack2.push(descendVNode), Array.isArray(children) ? (jsxIdx = 0, jsxCount = children.length, jsxChildren = children, jsxValue = jsxCount > 0 ? children[0] : null) : void 0 === children ? (jsxIdx = 0, jsxValue = null, jsxChildren = null, jsxCount = 0) : (jsxIdx = 0, jsxValue = children, jsxChildren = null, jsxCount = 1);
943
1103
  }
944
1104
  function getInsertBefore() {
945
- if (vNewNode) {
946
- return vCurrent;
947
- }
948
- if (null !== vSiblings) {
949
- const nextIdx = vSiblingsIdx + SiblingsArray.NextVNode;
950
- return nextIdx < vSiblings.length ? vSiblings[nextIdx] : null;
951
- }
952
- return peekNextSibling();
1105
+ return vNewNode ? vCurrent : peekNextSibling();
953
1106
  }
954
1107
  function expectProjection() {
955
1108
  const slotName = jsxValue.key;
956
- vCurrent = vnode_getProp(vParent, slotName, (id) => vnode_locate(container.rootVNode, id)), vCurrent = vCurrent && vCurrent[VNodeProps.flags] & VNodeFlags.Deleted ? null : vCurrent, null == vCurrent && (vNewNode = vnode_newVirtual(), vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, "q:sparent", vParent), vnode_setProp(vParent, slotName, vNewNode));
1109
+ vCurrent = vnode_getProp(vParent, slotName, (id) => vnode_locate(container.rootVNode, id)), vCurrent = vCurrent && 32 & vCurrent[0] ? null : vCurrent, null == vCurrent && (vNewNode = vnode_newVirtual(), vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, "q:sparent", vParent), vnode_setProp(vParent, slotName, vNewNode));
957
1110
  }
958
1111
  function expectSlot() {
959
1112
  const vHost = vnode_getProjectionParentComponent(vParent, container.rootVNode);
@@ -963,21 +1116,13 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
963
1116
  if (constProps && "object" == typeof constProps && "name" in constProps) {
964
1117
  const constValue = constProps.name;
965
1118
  if (vHost2 && constValue instanceof WrappedSignal) {
966
- return trackSignalAndAssignHost(constValue, vHost2, EffectProperty.COMPONENT, container);
1119
+ return trackSignalAndAssignHost(constValue, vHost2, ":", container);
967
1120
  }
968
1121
  }
969
1122
  return directGetPropsProxyProp(jsxNode2, "name") || "";
970
1123
  }(vHost);
971
1124
  const vProjectedNode = vHost ? vnode_getProp(vHost, slotNameKey, null) : null;
972
- if (null == vProjectedNode) {
973
- return vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), false;
974
- }
975
- if (vProjectedNode === vCurrent) ;
976
- else {
977
- const parent = vnode_getParent(vProjectedNode);
978
- !(!parent || vnode_isElementVNode(parent) && vnode_getElementName(parent) === QTemplate) && vParent !== parent && vnode_remove(journal, parent, vProjectedNode, false), vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
979
- }
980
- return true;
1125
+ return null == vProjectedNode ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), false) : (vProjectedNode === vCurrent || (vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), isDev), true);
981
1126
  }
982
1127
  function expectNoMore() {
983
1128
  if (null !== vCurrent) {
@@ -999,7 +1144,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
999
1144
  const domParentVNode = vnode_getDomParentVNode(vParent);
1000
1145
  const { elementNamespace, elementNamespaceFlag } = getNewElementNamespaceData(domParentVNode, elementName2);
1001
1146
  const element2 = container.document.createElementNS(elementNamespace, elementName2);
1002
- return vNewNode = vnode_newElement(element2, elementName2), vNewNode[VNodeProps.flags] |= elementNamespaceFlag, element2;
1147
+ return vNewNode = vnode_newElement(element2, elementName2), vNewNode[0] |= elementNamespaceFlag, element2;
1003
1148
  }(elementName);
1004
1149
  const { constProps } = jsx2;
1005
1150
  let needsQDispatchEventPatch = false;
@@ -1007,10 +1152,10 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1007
1152
  for (const key2 in constProps) {
1008
1153
  let value = constProps[key2];
1009
1154
  if (isJsxPropertyAnEventName(key2)) {
1010
- const eventName = getEventNameFromJsxProp(key2);
1011
- const scope = getEventNameScopeFromJsxProp(key2);
1155
+ const eventName = getEventNameFromJsxEvent(key2);
1156
+ const scope = getEventNameScopeFromJsxEvent(key2);
1012
1157
  if (eventName && (vnode_setProp(vNewNode, HANDLER_PREFIX + ":" + scope + ":" + eventName, value), registerQwikLoaderEvent(eventName)), scope) {
1013
- const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key2);
1158
+ const htmlEvent = jsxEventToHtmlAttribute(key2);
1014
1159
  htmlEvent && vnode_setAttr(journal, vNewNode, htmlEvent, "");
1015
1160
  }
1016
1161
  needsQDispatchEventPatch = true;
@@ -1027,7 +1172,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1027
1172
  if (null == value) {
1028
1173
  continue;
1029
1174
  }
1030
- throw qError(QError.invalidRefValue, [currentFile]);
1175
+ throw qError(32, [currentFile]);
1031
1176
  }
1032
1177
  if (isSignal(value)) {
1033
1178
  const signalData = new SubscriptionData({
@@ -1046,7 +1191,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1046
1191
  element.value = escapeHTML(value || "");
1047
1192
  }
1048
1193
  } else {
1049
- element.innerHTML = value, element.setAttribute("q:container", QContainerValue.HTML);
1194
+ element.innerHTML = value, element.setAttribute("q:container", "html");
1050
1195
  }
1051
1196
  }
1052
1197
  }
@@ -1060,7 +1205,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1060
1205
  const jsxKey = jsx2.key;
1061
1206
  let needsQDispatchEventPatch = false;
1062
1207
  const currentFile = getFileLocationFromJsx(jsx2.dev);
1063
- isSameElementName && jsxKey === getKey(vCurrent) || (vNewNode = retrieveChildWithKey(elementName, jsxKey), null === vNewNode ? needsQDispatchEventPatch = createNewElement(jsx2, elementName) : (vnode_insertBefore(journal, vParent, vNewNode, vCurrent), vCurrent = vNewNode, vNewNode = null, null !== vSiblings && (vSiblingsIdx -= SiblingsArray.Size)));
1208
+ isSameElementName && jsxKey === getKey(vCurrent) || (vNewNode = retrieveChildWithKey(elementName, jsxKey), null === vNewNode ? needsQDispatchEventPatch = createNewElement(jsx2, elementName) : (vnode_insertBefore(journal, vParent, vNewNode, vCurrent), vCurrent = vNewNode, vNewNode = null));
1064
1209
  const jsxAttrs = [];
1065
1210
  const props = jsx2.varProps;
1066
1211
  for (const key in props) {
@@ -1069,7 +1214,8 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1069
1214
  }
1070
1215
  null !== jsxKey && mapArray_set(jsxAttrs, "q:key", jsxKey, 0);
1071
1216
  const vNode = vNewNode || vCurrent;
1072
- if (needsQDispatchEventPatch = function(vnode, srcAttrs, currentFile2) {
1217
+ const element = vNode[6];
1218
+ element.vNode = new WeakRef(vNode), needsQDispatchEventPatch = function(vnode, srcAttrs, currentFile2) {
1073
1219
  vnode_ensureElementInflated(vnode);
1074
1220
  const dstAttrs = vnode_getProps(vnode);
1075
1221
  let srcIdx = 0;
@@ -1084,17 +1230,14 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1084
1230
  vnode_setProp(vnode, key, value);
1085
1231
  } else {
1086
1232
  if ("ref" === key) {
1087
- const element = vnode_getNode(vnode);
1233
+ const element2 = vnode_getNode(vnode);
1088
1234
  if (isSignal(value)) {
1089
- return void (value.value = element);
1235
+ return void (value.value = element2);
1090
1236
  }
1091
1237
  if ("function" == typeof value) {
1092
- return void value(element);
1093
- }
1094
- if (null == value) {
1095
- return;
1238
+ return void value(element2);
1096
1239
  }
1097
- throw qError(QError.invalidRefValue, [currentFile2]);
1240
+ throw qError(32, [currentFile2]);
1098
1241
  }
1099
1242
  if (isSignal(value)) {
1100
1243
  const signalData = new SubscriptionData({
@@ -1103,14 +1246,14 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1103
1246
  });
1104
1247
  value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
1105
1248
  }
1106
- vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix)), null === value && (dstLength = dstAttrs.length);
1249
+ vnode_setAttr(journal, vnode, key, null !== value ? serializeAttribute(key, value, scopedStyleIdPrefix) : null), null === value && (dstLength = dstAttrs.length);
1107
1250
  }
1108
1251
  };
1109
1252
  const recordJsxEvent = (key, value) => {
1110
- const eventName = getEventNameFromJsxProp(key);
1111
- const scope = getEventNameScopeFromJsxProp(key);
1253
+ const eventName = getEventNameFromJsxEvent(key);
1254
+ const scope = getEventNameScopeFromJsxEvent(key);
1112
1255
  if (eventName && (record(":" + scope + ":" + eventName, value), registerQwikLoaderEvent(eventName)), scope) {
1113
- const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key);
1256
+ const htmlEvent = jsxEventToHtmlAttribute(key);
1114
1257
  htmlEvent && record(htmlEvent, "");
1115
1258
  }
1116
1259
  };
@@ -1118,32 +1261,29 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1118
1261
  if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith("q:")) {
1119
1262
  dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1120
1263
  } else if (null == srcKey) {
1121
- dstKey && isHtmlAttributeAnEventName(dstKey) ? (patchEventDispatch = true, dstIdx++) : (record(dstKey, null), dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1264
+ dstKey && isHtmlAttributeAnEventName(dstKey) ? dstIdx++ : (record(dstKey, null), dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1122
1265
  } else if (null == dstKey) {
1123
1266
  isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = true, recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]), srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1124
1267
  } else if (srcKey == dstKey) {
1125
1268
  const srcValue = srcAttrs[srcIdx++];
1126
1269
  srcValue !== dstAttrs[dstIdx++] && record(dstKey, srcValue), srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1127
1270
  } else {
1128
- srcKey < dstKey ? (isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = true, recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]), srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null) : (isHtmlAttributeAnEventName(dstKey) ? (patchEventDispatch = true, dstIdx++) : (record(dstKey, null), dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null);
1271
+ srcKey < dstKey ? (isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = true, recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]), srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstLength = dstAttrs.length, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null) : (isHtmlAttributeAnEventName(dstKey) ? (patchEventDispatch = true, dstIdx++) : (record(dstKey, null), dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null);
1129
1272
  }
1130
1273
  }
1131
1274
  return patchEventDispatch;
1132
- }(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch, needsQDispatchEventPatch) {
1133
- const element = vnode_getNode(vNode);
1134
- element.qDispatchEvent || (element.qDispatchEvent = (event, scope) => {
1135
- const eventName = event.type;
1136
- const eventProp = ":" + scope.substring(1) + ":" + eventName;
1137
- const qrls = [vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null)];
1138
- let returnValue = false;
1139
- return qrls.flat(2).forEach((qrl2) => {
1140
- if (qrl2) {
1141
- const value = container.$scheduler$(ChoreType.RUN_QRL, vNode, qrl2, [event, element]);
1142
- returnValue = returnValue || true === value;
1143
- }
1144
- }), returnValue;
1145
- });
1146
- }
1275
+ }(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch, needsQDispatchEventPatch && (element.qDispatchEvent || (element.qDispatchEvent = (event, scope) => {
1276
+ const eventName = event.type;
1277
+ const eventProp = ":" + scope.substring(1) + ":" + eventName;
1278
+ const qrls = [vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null)];
1279
+ let returnValue = false;
1280
+ return qrls.flat(2).forEach((qrl2) => {
1281
+ if (qrl2) {
1282
+ const value = container.$scheduler$(2, vNode, qrl2, [event, element]);
1283
+ returnValue = returnValue || true === value;
1284
+ }
1285
+ }), returnValue;
1286
+ }));
1147
1287
  }
1148
1288
  function registerQwikLoaderEvent(eventName) {
1149
1289
  const window2 = container.document.defaultView;
@@ -1151,26 +1291,29 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1151
1291
  }
1152
1292
  function retrieveChildWithKey(nodeName, key) {
1153
1293
  let vNodeWithKey = null;
1154
- if (-1 === vSiblingsIdx) {
1155
- vSiblings = [], vSiblingsIdx = 0;
1294
+ if (null === vSiblings) {
1295
+ vSiblings = /* @__PURE__ */ new Map(), vSiblingsArray = [];
1156
1296
  let vNode = vCurrent;
1157
1297
  for (; vNode; ) {
1158
1298
  const name = vnode_isElementVNode(vNode) ? vnode_getElementName(vNode) : null;
1159
1299
  const vKey = getKey(vNode) || getComponentHash(vNode, container.$getObjectById$);
1160
- null === vNodeWithKey && vKey == key && name == nodeName ? vNodeWithKey = vNode : vSiblings.push(name, vKey, vNode), vNode = vnode_getNextSibling(vNode);
1300
+ null === vNodeWithKey && vKey == key && name == nodeName ? vNodeWithKey = vNode : null === vKey ? vSiblingsArray.push(name, vNode) : vSiblings.set(name + ":" + vKey, vNode), vNode = vnode_getNextSibling(vNode);
1161
1301
  }
1162
- } else {
1163
- for (let idx = vSiblingsIdx; idx < vSiblings.length; idx += SiblingsArray.Size) {
1164
- if (vSiblings[idx + SiblingsArray.Key] === key && vSiblings[idx + SiblingsArray.Name] === nodeName) {
1165
- vNodeWithKey = vSiblings[idx + SiblingsArray.VNode], vSiblings?.splice(idx, SiblingsArray.Size);
1302
+ } else if (null === key) {
1303
+ for (let i = 0; i < vSiblingsArray.length; i += 2) {
1304
+ if (vSiblingsArray[i] === nodeName) {
1305
+ vNodeWithKey = vSiblingsArray[i + 1], vSiblingsArray.splice(i, 2);
1166
1306
  break;
1167
1307
  }
1168
1308
  }
1309
+ } else {
1310
+ const vSibling = vSiblings.get(nodeName + ":" + key);
1311
+ vSibling && (vNodeWithKey = vSibling, vSiblings.delete(nodeName + ":" + key));
1169
1312
  }
1170
1313
  return vNodeWithKey;
1171
1314
  }
1172
1315
  function expectVirtual(type, jsxKey) {
1173
- vCurrent && vnode_isVirtualVNode(vCurrent) && getKey(vCurrent) === jsxKey || (null === jsxKey || (vNewNode = retrieveChildWithKey(null, jsxKey), null == vNewNode) ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, "q:key", jsxKey), isDev) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent && getInsertBefore()));
1316
+ vCurrent && vnode_isVirtualVNode(vCurrent) && getKey(vCurrent) === jsxKey && jsxKey || (null === jsxKey || (vNewNode = retrieveChildWithKey(null, jsxKey), null == vNewNode) ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, "q:key", jsxKey), isDev) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent && getInsertBefore()));
1174
1317
  }
1175
1318
  function expectComponent(component) {
1176
1319
  const componentMeta = component[SERIALIZABLE_STATE];
@@ -1183,9 +1326,9 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1183
1326
  const componentHash = componentQRL.$hash$;
1184
1327
  const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
1185
1328
  const lookupKey = jsxNode2.key || componentHash;
1186
- if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash || (insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true), host) {
1329
+ if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash && jsxNode2.key || (insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true), host) {
1187
1330
  const vNodeProps = vnode_getProp(host, "q:props", container.$getObjectById$);
1188
- shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps), shouldRender && (host[VNodeProps.flags] &= ~VNodeFlags.Deleted, container.$scheduler$(ChoreType.COMPONENT, host, componentQRL, jsxProps));
1331
+ shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps), shouldRender && (host[0] &= -33, container.$scheduler$(6, host, componentQRL, jsxProps));
1189
1332
  }
1190
1333
  !function(children, host2) {
1191
1334
  const projectionChildren = Array.isArray(children) ? children : [children];
@@ -1293,21 +1436,21 @@ function cleanup(container, vNode) {
1293
1436
  }
1294
1437
  let vParent = null;
1295
1438
  for (; ; ) {
1296
- const type = vCursor[VNodeProps.flags];
1297
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
1298
- if (clearAllEffects(container, vCursor), markVNodeAsDeleted(vCursor), type & VNodeFlags.Virtual) {
1439
+ const type = vCursor[0];
1440
+ if (3 & type) {
1441
+ if (clearAllEffects(container, vCursor), markVNodeAsDeleted(vCursor), 2 & type) {
1299
1442
  const seq = container.getHostProp(vCursor, "q:seq");
1300
1443
  if (seq) {
1301
1444
  for (let i = 0; i < seq.length; i++) {
1302
1445
  const obj = seq[i];
1303
1446
  if (isTask(obj)) {
1304
1447
  const task = obj;
1305
- clearAllEffects(container, task), task.$flags$ & TaskFlags.VISIBLE_TASK ? container.$scheduler$(ChoreType.CLEANUP_VISIBLE, task) : cleanupTask(task);
1448
+ clearAllEffects(container, task), 1 & task.$flags$ ? container.$scheduler$(48, task) : cleanupTask(task);
1306
1449
  }
1307
1450
  }
1308
1451
  }
1309
1452
  }
1310
- if (type & VNodeFlags.Virtual && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
1453
+ if (2 & type && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
1311
1454
  const attrs = vnode_getProps(vCursor);
1312
1455
  for (let i = 0; i < attrs.length; i += 2) {
1313
1456
  if (isSlotProp(attrs[i])) {
@@ -1339,7 +1482,7 @@ function cleanup(container, vNode) {
1339
1482
  }
1340
1483
  }
1341
1484
  } else {
1342
- type & VNodeFlags.Text && markVNodeAsDeleted(vCursor);
1485
+ 4 & type && markVNodeAsDeleted(vCursor);
1343
1486
  }
1344
1487
  if (vCursor === vNode) {
1345
1488
  return;
@@ -1368,17 +1511,13 @@ function cleanup(container, vNode) {
1368
1511
  function cleanupStaleUnclaimedProjection(journal, projection) {
1369
1512
  const projectionParent = vnode_getParent(projection);
1370
1513
  if (projectionParent) {
1371
- projectionParent[VNodeProps.flags] & VNodeFlags.Element && vnode_getElementName(projectionParent) === QTemplate && vnode_remove(journal, projectionParent, projection, true);
1514
+ 1 & projectionParent[0] && vnode_getElementName(projectionParent) === QTemplate && vnode_remove(journal, projectionParent, projection, true);
1372
1515
  }
1373
1516
  }
1374
1517
  function markVNodeAsDeleted(vCursor) {
1375
- vCursor[VNodeProps.flags] |= VNodeFlags.Deleted;
1518
+ vCursor[0] |= 32;
1376
1519
  }
1377
1520
  const HANDLER_PREFIX = ":";
1378
- var SiblingsArray;
1379
- !function(SiblingsArray2) {
1380
- SiblingsArray2[SiblingsArray2.Name = 0] = "Name", SiblingsArray2[SiblingsArray2.Key = 1] = "Key", SiblingsArray2[SiblingsArray2.VNode = 2] = "VNode", SiblingsArray2[SiblingsArray2.Size = 3] = "Size", SiblingsArray2[SiblingsArray2.NextVNode = 5] = "NextVNode";
1381
- }(SiblingsArray || (SiblingsArray = {}));
1382
1521
  const _createResourceReturn = (opts) => ({
1383
1522
  __brand: "resource",
1384
1523
  value: void 0,
@@ -1391,10 +1530,10 @@ const _createResourceReturn = (opts) => ({
1391
1530
  });
1392
1531
  const createResourceReturn = (container, opts, initialPromise) => {
1393
1532
  const result = _createResourceReturn();
1394
- return result.value = initialPromise, createStore(container, result, StoreFlags.RECURSIVE);
1533
+ return result.value = initialPromise, createStore(container, result, 1);
1395
1534
  };
1396
1535
  const runResource = (task, container, host) => {
1397
- task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
1536
+ task.$flags$ &= -9, cleanupTask(task);
1398
1537
  const iCtx = newInvokeContext(container.$locale$, host, void 0, "qResource");
1399
1538
  iCtx.$container$ = container;
1400
1539
  const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
@@ -1413,7 +1552,7 @@ const runResource = (task, container, host) => {
1413
1552
  const opts = {
1414
1553
  track: (obj, prop) => {
1415
1554
  const ctx = newInvokeContext();
1416
- return ctx.$effectSubscriber$ = getSubscriber(task, EffectProperty.COMPONENT), ctx.$container$ = container, invoke(ctx, () => isFunction(obj) ? obj() : prop ? obj[prop] : isSignal(obj) ? obj.value : obj);
1555
+ return ctx.$effectSubscriber$ = getSubscriber(task, ":"), ctx.$container$ = container, invoke(ctx, () => isFunction(obj) ? obj() : prop ? obj[prop] : isSignal(obj) ? obj.value : obj);
1417
1556
  },
1418
1557
  cleanup(fn) {
1419
1558
  "function" == typeof fn && cleanups.push(fn);
@@ -1463,10 +1602,10 @@ const vnode_documentPosition = (a2, b, rootVNode) => {
1463
1602
  let aDepth = -1;
1464
1603
  let bDepth = -1;
1465
1604
  for (; a2; ) {
1466
- a2 = (aVNodePath[++aDepth] = a2)[VNodeProps.parent] || rootVNode && vnode_getProp(a2, "q:sparent", (id) => vnode_locate(rootVNode, id));
1605
+ a2 = (aVNodePath[++aDepth] = a2)[1] || rootVNode && vnode_getProp(a2, "q:sparent", (id) => vnode_locate(rootVNode, id));
1467
1606
  }
1468
1607
  for (; b; ) {
1469
- b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, "q:sparent", (id) => vnode_locate(rootVNode, id));
1608
+ b = (bVNodePath[++bDepth] = b)[1] || rootVNode && vnode_getProp(b, "q:sparent", (id) => vnode_locate(rootVNode, id));
1470
1609
  }
1471
1610
  for (; aDepth >= 0 && bDepth >= 0; ) {
1472
1611
  if ((a2 = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
@@ -1520,14 +1659,14 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1520
1659
  let drainScheduled = false;
1521
1660
  return function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
1522
1661
  const isServer3 = !isDomContainer(container);
1523
- const isComponentSsr = isServer3 && type === ChoreType.COMPONENT;
1524
- const runLater = type !== ChoreType.WAIT_FOR_ALL && !isComponentSsr && type !== ChoreType.RUN_QRL;
1525
- const isTask2 = type === ChoreType.TASK || type === ChoreType.VISIBLE || type === ChoreType.CLEANUP_VISIBLE;
1526
- const isClientOnly = type === ChoreType.JOURNAL_FLUSH || type === ChoreType.NODE_DIFF || type === ChoreType.NODE_PROP;
1662
+ const isComponentSsr = isServer3 && 6 === type;
1663
+ const runLater = 255 !== type && !isComponentSsr && 2 !== type;
1664
+ const isTask2 = 3 === type || 32 === type || 48 === type;
1665
+ const isClientOnly = 16 === type || 4 === type || 5 === type;
1527
1666
  if (isServer3 && isClientOnly) {
1528
1667
  return;
1529
1668
  }
1530
- isTask2 && (hostOrTask.$flags$ |= TaskFlags.DIRTY);
1669
+ isTask2 && (hostOrTask.$flags$ |= 8);
1531
1670
  let chore = {
1532
1671
  $type$: type,
1533
1672
  $idx$: isTask2 ? hostOrTask.$index$ : "string" == typeof targetOrQrl ? targetOrQrl : 0,
@@ -1561,10 +1700,10 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1561
1700
  return sortedArray.splice(~idx, 0, value), value;
1562
1701
  }
1563
1702
  const existing = sortedArray[idx];
1564
- existing.$type$ === ChoreType.NODE_DIFF && (existing.$payload$ = value.$payload$);
1703
+ 4 === existing.$type$ && (existing.$payload$ = value.$payload$);
1565
1704
  existing.$executed$ && (existing.$executed$ = false);
1566
1705
  return existing;
1567
- }(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = true, schedule(ChoreType.JOURNAL_FLUSH), scheduleDrain()?.catch?.(() => {
1706
+ }(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = true, schedule(16), scheduleDrain()?.catch?.(() => {
1568
1707
  }));
1569
1708
  return runLater ? getPromise(chore) : drainUpTo(chore, isServer3);
1570
1709
  };
@@ -1585,7 +1724,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1585
1724
  break;
1586
1725
  }
1587
1726
  } else {
1588
- vNodeAlreadyDeleted(nextChore) && nextChore.$type$ !== ChoreType.CLEANUP_VISIBLE ? choreQueue.shift() : executeChore(nextChore, isServer3);
1727
+ vNodeAlreadyDeleted(nextChore) && 48 !== nextChore.$type$ ? choreQueue.shift() : executeChore(nextChore, isServer3);
1589
1728
  }
1590
1729
  }
1591
1730
  return runUptoChore.$returnValue$;
@@ -1596,13 +1735,13 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1596
1735
  let returnValue = null;
1597
1736
  try {
1598
1737
  switch (chore.$type$) {
1599
- case ChoreType.WAIT_FOR_ALL:
1738
+ case 255:
1600
1739
  isServer3 && (drainScheduled = false);
1601
1740
  break;
1602
- case ChoreType.JOURNAL_FLUSH:
1741
+ case 16:
1603
1742
  returnValue = journalFlush(), drainScheduled = false;
1604
1743
  break;
1605
- case ChoreType.COMPONENT:
1744
+ case 6:
1606
1745
  returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), (jsx2) => {
1607
1746
  if (isServer3) {
1608
1747
  return jsx2;
@@ -1613,7 +1752,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1613
1752
  }
1614
1753
  }, (err) => container.handleError(err, host));
1615
1754
  break;
1616
- case ChoreType.RUN_QRL:
1755
+ case 2:
1617
1756
  {
1618
1757
  const fn = chore.$target$.getFn();
1619
1758
  const result = retryOnPromise(() => fn(...chore.$payload$));
@@ -1628,11 +1767,11 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1628
1767
  returnValue = null;
1629
1768
  }
1630
1769
  break;
1631
- case ChoreType.TASK:
1632
- case ChoreType.VISIBLE:
1770
+ case 3:
1771
+ case 32:
1633
1772
  {
1634
1773
  const payload = chore.$payload$;
1635
- if (payload.$flags$ & TaskFlags.RESOURCE) {
1774
+ if (4 & payload.$flags$) {
1636
1775
  const result = runResource(payload, container, host);
1637
1776
  returnValue = isServer3 ? result : null;
1638
1777
  } else {
@@ -1640,17 +1779,17 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1640
1779
  }
1641
1780
  }
1642
1781
  break;
1643
- case ChoreType.CLEANUP_VISIBLE:
1782
+ case 48:
1644
1783
  cleanupTask(chore.$payload$);
1645
1784
  break;
1646
- case ChoreType.NODE_DIFF:
1785
+ case 4:
1647
1786
  {
1648
1787
  const parentVirtualNode = chore.$target$;
1649
1788
  let jsx2 = chore.$payload$;
1650
1789
  isSignal(jsx2) && (jsx2 = jsx2.value), returnValue = retryOnPromise(() => vnode_diff(container, jsx2, parentVirtualNode, null));
1651
1790
  }
1652
1791
  break;
1653
- case ChoreType.NODE_PROP:
1792
+ case 5:
1654
1793
  {
1655
1794
  const virtualNode = chore.$host$;
1656
1795
  const payload = chore.$payload$;
@@ -1661,19 +1800,19 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1661
1800
  const property = chore.$idx$;
1662
1801
  const serializedValue = serializeAttribute(property, value, payload.$scopedStyleIdPrefix$);
1663
1802
  if (isConst) {
1664
- journal.push(VNodeJournalOpCode.SetAttribute, virtualNode[ElementVNodeProps.element], property, serializedValue);
1803
+ journal.push(2, virtualNode[6], property, serializedValue);
1665
1804
  } else {
1666
1805
  vnode_setAttr(journal, virtualNode, property, serializedValue);
1667
1806
  }
1668
1807
  }
1669
1808
  break;
1670
- case ChoreType.QRL_RESOLVE:
1809
+ case 1:
1671
1810
  {
1672
1811
  const target = chore.$target$;
1673
1812
  returnValue = target.resolved ? null : target.resolve();
1674
1813
  }
1675
1814
  break;
1676
- case ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS: {
1815
+ case 7: {
1677
1816
  const target = chore.$target$;
1678
1817
  const forceRunEffects = target.$forceRunEffects$;
1679
1818
  if (target.$forceRunEffects$ = false, !target.$effects$?.size) {
@@ -1693,7 +1832,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1693
1832
  isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after, (error) => after(void 0, error)), chore.$resolve$?.(chore.$promise$), chore.$resolve$ = void 0) : after(returnValue);
1694
1833
  }
1695
1834
  function choreComparator(a2, b, rootVNode) {
1696
- const macroTypeDiff = (a2.$type$ & ChoreType.MACRO) - (b.$type$ & ChoreType.MACRO);
1835
+ const macroTypeDiff = (240 & a2.$type$) - (240 & b.$type$);
1697
1836
  if (0 !== macroTypeDiff) {
1698
1837
  return macroTypeDiff;
1699
1838
  }
@@ -1716,7 +1855,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1716
1855
  }
1717
1856
  }
1718
1857
  }
1719
- const microTypeDiff = (a2.$type$ & ChoreType.MICRO) - (b.$type$ & ChoreType.MICRO);
1858
+ const microTypeDiff = (15 & a2.$type$) - (15 & b.$type$);
1720
1859
  if (0 !== microTypeDiff) {
1721
1860
  return microTypeDiff;
1722
1861
  }
@@ -1726,217 +1865,8 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1726
1865
  };
1727
1866
  const toNumber = (value) => "number" == typeof value ? value : -1;
1728
1867
  function vNodeAlreadyDeleted(chore) {
1729
- return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[VNodeProps.flags] & VNodeFlags.Deleted);
1730
- }
1731
- var SignalFlags;
1732
- var WrappedSignalFlags;
1733
- !function(SignalFlags2) {
1734
- SignalFlags2[SignalFlags2.INVALID = 1] = "INVALID";
1735
- }(SignalFlags || (SignalFlags = {})), function(WrappedSignalFlags2) {
1736
- WrappedSignalFlags2[WrappedSignalFlags2.UNWRAP = 2] = "UNWRAP";
1737
- }(WrappedSignalFlags || (WrappedSignalFlags = {}));
1738
- const throwIfQRLNotResolved = (qrl2) => {
1739
- if (!qrl2.resolved) {
1740
- throw qrl2.resolve();
1741
- }
1742
- };
1743
- const isSignal = (value) => value instanceof Signal;
1744
- class SubscriptionData {
1745
- constructor(data) {
1746
- __publicField(this, "data");
1747
- this.data = data;
1748
- }
1749
- }
1750
- var EffectSubscriptionProp;
1751
- var EffectProperty;
1752
- !function(EffectSubscriptionProp2) {
1753
- EffectSubscriptionProp2[EffectSubscriptionProp2.CONSUMER = 0] = "CONSUMER", EffectSubscriptionProp2[EffectSubscriptionProp2.PROPERTY = 1] = "PROPERTY", EffectSubscriptionProp2[EffectSubscriptionProp2.BACK_REF = 2] = "BACK_REF", EffectSubscriptionProp2[EffectSubscriptionProp2.DATA = 3] = "DATA";
1754
- }(EffectSubscriptionProp || (EffectSubscriptionProp = {})), function(EffectProperty2) {
1755
- EffectProperty2.COMPONENT = ":", EffectProperty2.VNODE = ".";
1756
- }(EffectProperty || (EffectProperty = {}));
1757
- class Signal {
1758
- constructor(container, value) {
1759
- __publicField(this, "$untrackedValue$");
1760
- __publicField(this, "$effects$", null);
1761
- __publicField(this, "$container$", null);
1762
- this.$container$ = container, this.$untrackedValue$ = value;
1763
- }
1764
- get untrackedValue() {
1765
- return this.$untrackedValue$;
1766
- }
1767
- set untrackedValue(value) {
1768
- this.$untrackedValue$ = value;
1769
- }
1770
- get value() {
1771
- const ctx = tryGetInvokeContext();
1772
- if (ctx) {
1773
- if (null === this.$container$) {
1774
- if (!ctx.$container$) {
1775
- return this.untrackedValue;
1776
- }
1777
- this.$container$ = ctx.$container$;
1778
- } else {
1779
- assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$);
1780
- }
1781
- const effectSubscriber = ctx.$effectSubscriber$;
1782
- if (effectSubscriber) {
1783
- const effects = this.$effects$ || (this.$effects$ = /* @__PURE__ */ new Set());
1784
- ensureContainsSubscription(effects, effectSubscriber), ensureContainsBackRef(effectSubscriber, this), addQrlToSerializationCtx(effectSubscriber, this.$container$);
1785
- }
1786
- }
1787
- return this.untrackedValue;
1788
- }
1789
- set value(value) {
1790
- value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, triggerEffects(this.$container$, this, this.$effects$));
1791
- }
1792
- valueOf() {
1793
- }
1794
- toString() {
1795
- return `[${this.constructor.name}${this.$flags$ & SignalFlags.INVALID ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e) => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n") || "");
1796
- }
1797
- toJSON() {
1798
- return {
1799
- value: this.$untrackedValue$
1800
- };
1801
- }
1802
- }
1803
- const ensureContainsSubscription = (array, effectSubscription) => {
1804
- array.add(effectSubscription);
1805
- };
1806
- const ensureContainsBackRef = (array, value) => {
1807
- var _a2;
1808
- array[_a2 = EffectSubscriptionProp.BACK_REF] || (array[_a2] = /* @__PURE__ */ new Set()), array[EffectSubscriptionProp.BACK_REF].add(value);
1809
- };
1810
- const addQrlToSerializationCtx = (effectSubscriber, container) => {
1811
- if (container && !isDomContainer(container)) {
1812
- const effect = effectSubscriber[EffectSubscriptionProp.CONSUMER];
1813
- const property = effectSubscriber[EffectSubscriptionProp.PROPERTY];
1814
- let qrl2 = null;
1815
- isTask(effect) ? qrl2 = effect.$qrl$ : effect instanceof ComputedSignal ? qrl2 = effect.$computeQrl$ : property === EffectProperty.COMPONENT && (qrl2 = container.getHostProp(effect, "q:renderFn")), qrl2 && container.serializationCtx.$eventQrls$.add(qrl2);
1816
- }
1817
- };
1818
- const triggerEffects = (container, signal, effects) => {
1819
- const isBrowser2 = isDomContainer(container);
1820
- if (effects) {
1821
- const scheduleEffect = (effectSubscription) => {
1822
- const consumer = effectSubscription[EffectSubscriptionProp.CONSUMER];
1823
- const property = effectSubscription[EffectSubscriptionProp.PROPERTY];
1824
- if (isTask(consumer)) {
1825
- consumer.$flags$ |= TaskFlags.DIRTY;
1826
- let choreType = ChoreType.TASK;
1827
- consumer.$flags$ & TaskFlags.VISIBLE_TASK && (choreType = ChoreType.VISIBLE), container.$scheduler$(choreType, consumer);
1828
- } else if (consumer instanceof Signal) {
1829
- consumer instanceof ComputedSignal && (consumer.$computeQrl$.resolved || container.$scheduler$(ChoreType.QRL_RESOLVE, null, consumer.$computeQrl$)), consumer.$invalidate$();
1830
- } else if (property === EffectProperty.COMPONENT) {
1831
- const host = consumer;
1832
- const qrl2 = container.getHostProp(host, "q:renderFn");
1833
- const props = container.getHostProp(host, "q:props");
1834
- container.$scheduler$(ChoreType.COMPONENT, host, qrl2, props);
1835
- } else if (isBrowser2) {
1836
- if (property === EffectProperty.VNODE) {
1837
- container.$scheduler$(ChoreType.NODE_DIFF, consumer, consumer, signal);
1838
- } else {
1839
- const effectData = effectSubscription[EffectSubscriptionProp.DATA];
1840
- if (effectData instanceof SubscriptionData) {
1841
- const payload = {
1842
- ...effectData.data,
1843
- $value$: signal
1844
- };
1845
- container.$scheduler$(ChoreType.NODE_PROP, consumer, property, payload);
1846
- }
1847
- }
1848
- }
1849
- };
1850
- for (const effect of effects) {
1851
- scheduleEffect(effect);
1852
- }
1853
- }
1854
- };
1855
- class ComputedSignal extends (_c = Signal, _b = _EFFECT_BACK_REF, _c) {
1856
- constructor(container, fn, flags = SignalFlags.INVALID) {
1857
- super(container, NEEDS_COMPUTATION);
1858
- __publicField(this, "$computeQrl$");
1859
- __publicField(this, "$flags$");
1860
- __publicField(this, "$forceRunEffects$", false);
1861
- __publicField(this, _b, null);
1862
- this.$computeQrl$ = fn, this.$flags$ = flags;
1863
- }
1864
- $invalidate$() {
1865
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, null, this);
1866
- }
1867
- force() {
1868
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1869
- }
1870
- get untrackedValue() {
1871
- const didChange = this.$computeIfNeeded$();
1872
- return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
1873
- }
1874
- $computeIfNeeded$() {
1875
- if (!(this.$flags$ & SignalFlags.INVALID)) {
1876
- return false;
1877
- }
1878
- const computeQrl = this.$computeQrl$;
1879
- throwIfQRLNotResolved(computeQrl);
1880
- const ctx = tryGetInvokeContext();
1881
- const previousEffectSubscription = ctx?.$effectSubscriber$;
1882
- ctx && (ctx.$effectSubscriber$ = getSubscriber(this, EffectProperty.VNODE));
1883
- try {
1884
- const untrackedValue = computeQrl.getFn(ctx)();
1885
- if (isPromise(untrackedValue)) {
1886
- throw qError(QError.computedNotSync, [computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$]);
1887
- }
1888
- this.$flags$ &= ~SignalFlags.INVALID;
1889
- const didChange = untrackedValue !== this.$untrackedValue$;
1890
- return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
1891
- } finally {
1892
- ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
1893
- }
1894
- }
1895
- get value() {
1896
- return super.value;
1897
- }
1898
- set value(_) {
1899
- throw qError(QError.computedReadOnly);
1900
- }
1901
- }
1902
- class WrappedSignal extends (_e = Signal, _d = _EFFECT_BACK_REF, _e) {
1903
- constructor(container, fn, args, fnStr, flags = SignalFlags.INVALID | WrappedSignalFlags.UNWRAP) {
1904
- super(container, NEEDS_COMPUTATION);
1905
- __publicField(this, "$args$");
1906
- __publicField(this, "$func$");
1907
- __publicField(this, "$funcStr$");
1908
- __publicField(this, "$flags$");
1909
- __publicField(this, "$hostElement$", null);
1910
- __publicField(this, "$forceRunEffects$", false);
1911
- __publicField(this, _d, null);
1912
- this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr, this.$flags$ = flags;
1913
- }
1914
- $invalidate$() {
1915
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, this.$hostElement$, this);
1916
- }
1917
- force() {
1918
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1919
- }
1920
- get untrackedValue() {
1921
- const didChange = this.$computeIfNeeded$();
1922
- return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
1923
- }
1924
- $computeIfNeeded$() {
1925
- if (!(this.$flags$ & SignalFlags.INVALID)) {
1926
- return false;
1927
- }
1928
- const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, EffectProperty.VNODE, this.$container$);
1929
- const didChange = untrackedValue !== this.$untrackedValue$;
1930
- return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
1931
- }
1932
- get value() {
1933
- return super.value;
1934
- }
1935
- set value(_) {
1936
- throw qError(QError.wrappedReadOnly);
1937
- }
1868
+ return !!(chore.$host$ && vnode_isVNode(chore.$host$) && 32 & chore.$host$[0]);
1938
1869
  }
1939
- const version = "2.0.0-alpha.8-dev+66037b5";
1940
1870
  class _SharedContainer {
1941
1871
  constructor(scheduleDrain, journalFlush, serverData, locale) {
1942
1872
  __publicField(this, "$version$");
@@ -1947,6 +1877,7 @@ class _SharedContainer {
1947
1877
  __publicField(this, "$serverData$");
1948
1878
  __publicField(this, "$currentUniqueId$", 0);
1949
1879
  __publicField(this, "$instanceHash$", null);
1880
+ __publicField(this, "$buildBase$", null);
1950
1881
  this.$serverData$ = serverData, this.$locale$ = locale, this.$version$ = version, this.$storeProxyMap$ = /* @__PURE__ */ new WeakMap(), this.$getObjectById$ = () => {
1951
1882
  throw Error("Not implemented");
1952
1883
  }, this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
@@ -1958,155 +1889,6 @@ class _SharedContainer {
1958
1889
  return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
1959
1890
  }
1960
1891
  }
1961
- const _jsxSorted = (type, varProps, constProps, children, flags, key) => {
1962
- const processed = null == key ? null : String(key);
1963
- const node = new JSXNodeImpl(type, varProps || {}, constProps || null, children, flags, processed);
1964
- return node;
1965
- };
1966
- const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
1967
- let sortedProps;
1968
- return sortedProps = varProps ? Object.fromEntries(untrack(() => Object.entries(varProps)).filter((entry) => {
1969
- const attr = entry[0];
1970
- return "children" === attr ? (children ?? (children = entry[1]), false) : "key" === attr ? (key = entry[1], false) : !constProps;
1971
- }).sort(([a2], [b]) => a2 < b ? -1 : 1)) : "string" == typeof type ? EMPTY_OBJ : {}, _jsxSorted(type, sortedProps, constProps, children, flags, key);
1972
- };
1973
- const jsx = (type, props, key) => _jsxSplit(type, props, null, null, 0, null);
1974
- const isPropsProxy = (obj) => obj && void 0 !== obj[_VAR_PROPS];
1975
- class JSXNodeImpl {
1976
- constructor(type, varProps, constProps, children, flags, key = null) {
1977
- __publicField(this, "type");
1978
- __publicField(this, "varProps");
1979
- __publicField(this, "constProps");
1980
- __publicField(this, "children");
1981
- __publicField(this, "flags");
1982
- __publicField(this, "key");
1983
- __publicField(this, "dev");
1984
- __publicField(this, "_proxy", null);
1985
- this.type = type, this.varProps = varProps, this.constProps = constProps, this.children = children, this.flags = flags, this.key = key;
1986
- }
1987
- get props() {
1988
- return this._proxy || (this._proxy = createPropsProxy(this.varProps, this.constProps, this.children)), this._proxy;
1989
- }
1990
- }
1991
- const Virtual = (props) => props.children;
1992
- const isJSXNode = (n) => n instanceof JSXNodeImpl;
1993
- const Fragment = (props) => props.children;
1994
- function createPropsProxy(varProps, constProps, children) {
1995
- return new Proxy({}, new PropsProxyHandler(varProps, constProps, children));
1996
- }
1997
- class PropsProxyHandler {
1998
- constructor($varProps$, $constProps$, $children$) {
1999
- __publicField(this, "$varProps$");
2000
- __publicField(this, "$constProps$");
2001
- __publicField(this, "$children$");
2002
- this.$varProps$ = $varProps$, this.$constProps$ = $constProps$, this.$children$ = $children$;
2003
- }
2004
- get(_, prop) {
2005
- if (prop === _CONST_PROPS) {
2006
- return this.$constProps$;
2007
- }
2008
- if (prop === _VAR_PROPS) {
2009
- return this.$varProps$;
2010
- }
2011
- if (null != this.$children$ && "children" === prop) {
2012
- return this.$children$;
2013
- }
2014
- const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
2015
- return value instanceof WrappedSignal && value.$flags$ & WrappedSignalFlags.UNWRAP ? value.value : value;
2016
- }
2017
- set(_, prop, value) {
2018
- return prop === _CONST_PROPS ? (this.$constProps$ = value, true) : prop === _VAR_PROPS ? (this.$varProps$ = value, true) : (this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] = value : this.$varProps$[prop] = value, true);
2019
- }
2020
- deleteProperty(_, prop) {
2021
- if ("string" != typeof prop) {
2022
- return false;
2023
- }
2024
- let didDelete = delete this.$varProps$[prop];
2025
- return this.$constProps$ && (didDelete = delete this.$constProps$[prop] || didDelete), null != this.$children$ && "children" === prop && (this.$children$ = null), didDelete;
2026
- }
2027
- has(_, prop) {
2028
- return "children" === prop && null != this.$children$ || prop === _CONST_PROPS || prop === _VAR_PROPS || prop in this.$varProps$ || !!this.$constProps$ && prop in this.$constProps$;
2029
- }
2030
- getOwnPropertyDescriptor(target, p) {
2031
- return {
2032
- configurable: true,
2033
- enumerable: true,
2034
- value: "children" === p && null != this.$children$ ? this.$children$ : this.$constProps$ && p in this.$constProps$ ? this.$constProps$[p] : this.$varProps$[p]
2035
- };
2036
- }
2037
- ownKeys() {
2038
- const out = Object.keys(this.$varProps$);
2039
- if (null != this.$children$ && -1 === out.indexOf("children") && out.push("children"), this.$constProps$) {
2040
- for (const key in this.$constProps$) {
2041
- -1 === out.indexOf(key) && out.push(key);
2042
- }
2043
- }
2044
- return out;
2045
- }
2046
- }
2047
- const directGetPropsProxyProp = (jsx2, prop) => jsx2.constProps && prop in jsx2.constProps ? jsx2.constProps[prop] : jsx2.varProps[prop];
2048
- const stringifyPath = [];
2049
- function qwikDebugToString(value) {
2050
- if (null === value) {
2051
- return "null";
2052
- }
2053
- if (void 0 === value) {
2054
- return "undefined";
2055
- }
2056
- if ("string" == typeof value) {
2057
- return '"' + value + '"';
2058
- }
2059
- if ("number" == typeof value || "boolean" == typeof value) {
2060
- return String(value);
2061
- }
2062
- if (isTask(value)) {
2063
- return `Task(${qwikDebugToString(value.$qrl$)})`;
2064
- }
2065
- if (isQrl(value)) {
2066
- return `Qrl(${value.$symbol$})`;
2067
- }
2068
- if ("object" == typeof value || "function" == typeof value) {
2069
- if (stringifyPath.includes(value)) {
2070
- return "*";
2071
- }
2072
- try {
2073
- if (stringifyPath.push(value), Array.isArray(value)) {
2074
- return vnode_isVNode(value) ? "(" + vnode_getProp(value, "q:type", null) + ")" : value.map(qwikDebugToString);
2075
- }
2076
- if (isSignal(value)) {
2077
- return value instanceof WrappedSignal ? "WrappedSignal" : value instanceof ComputedSignal ? "ComputedSignal" : "Signal";
2078
- }
2079
- if (isStore(value)) {
2080
- return "Store";
2081
- }
2082
- if (isJSXNode(value)) {
2083
- return jsxToString(value);
2084
- }
2085
- } finally {
2086
- stringifyPath.pop();
2087
- }
2088
- }
2089
- return value;
2090
- }
2091
- const pad = (text, prefix) => String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
2092
- const jsxToString = (value) => {
2093
- if (isJSXNode(value)) {
2094
- let type = value.type;
2095
- "function" == typeof type && (type = type.name || "Component");
2096
- let str = "<" + value.type;
2097
- if (value.props) {
2098
- for (const [key, val] of Object.entries(value.props)) {
2099
- str += " " + key + "=" + qwikDebugToString(val);
2100
- }
2101
- const children = value.children;
2102
- null != children ? (str += ">", Array.isArray(children) ? children.forEach((child) => {
2103
- str += jsxToString(child);
2104
- }) : str += jsxToString(children), str += "</" + value.type + ">") : str += "/>";
2105
- }
2106
- return str;
2107
- }
2108
- return String(value);
2109
- };
2110
1892
  const VNodeDataSeparator = {
2111
1893
  REFERENCE_CH: "~",
2112
1894
  REFERENCE: 126,
@@ -2171,1132 +1953,1216 @@ const VNodeDataChar = {
2171
1953
  SLOT: 126,
2172
1954
  SLOT_CHAR: "~"
2173
1955
  };
2174
- const mergeMaps = (map1, map2) => {
2175
- for (const [k, v] of map2) {
2176
- map1.set(k, v);
2177
- }
2178
- return map1;
2179
- };
2180
- var VNodeJournalOpCode;
2181
- !function(VNodeJournalOpCode2) {
2182
- VNodeJournalOpCode2[VNodeJournalOpCode2.SetText = 1] = "SetText", VNodeJournalOpCode2[VNodeJournalOpCode2.SetAttribute = 2] = "SetAttribute", VNodeJournalOpCode2[VNodeJournalOpCode2.HoistStyles = 3] = "HoistStyles", VNodeJournalOpCode2[VNodeJournalOpCode2.Remove = 4] = "Remove", VNodeJournalOpCode2[VNodeJournalOpCode2.Insert = 5] = "Insert";
2183
- }(VNodeJournalOpCode || (VNodeJournalOpCode = {}));
2184
- const vnode_newElement = (element, elementName) => {
2185
- assertEqual(fastNodeType(element));
2186
- const vnode = VNodeArray.createElement(VNodeFlags.Element | VNodeFlags.Inflated | -1 << VNodeFlagsIndex.shift, null, null, null, null, null, element, elementName);
2187
- return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2188
- };
2189
- const vnode_newUnMaterializedElement = (element) => {
2190
- assertEqual(fastNodeType(element));
2191
- const vnode = VNodeArray.createElement(VNodeFlags.Element | -1 << VNodeFlagsIndex.shift, null, null, null, void 0, void 0, element, void 0);
2192
- return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2193
- };
2194
- const vnode_newSharedText = (previousTextNode, sharedTextNode, textContent) => {
2195
- sharedTextNode && assertEqual(fastNodeType(sharedTextNode));
2196
- const vnode = VNodeArray.createText(VNodeFlags.Text | -1 << VNodeFlagsIndex.shift, null, previousTextNode, null, sharedTextNode, textContent);
2197
- return assertFalse(vnode_isElementVNode(vnode)), assertTrue(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2198
- };
2199
- const vnode_newText = (textNode, textContent) => {
2200
- const vnode = VNodeArray.createText(VNodeFlags.Text | VNodeFlags.Inflated | -1 << VNodeFlagsIndex.shift, null, null, null, textNode, textContent);
2201
- return assertEqual(fastNodeType(textNode)), assertFalse(vnode_isElementVNode(vnode)), assertTrue(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2202
- };
2203
- const vnode_newVirtual = () => {
2204
- const vnode = VNodeArray.createVirtual(VNodeFlags.Virtual | -1 << VNodeFlagsIndex.shift, null, null, null, null, null);
2205
- return assertFalse(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertTrue(vnode_isVirtualVNode(vnode)), vnode;
2206
- };
2207
- const vnode_isVNode = (vNode) => vNode instanceof VNodeArray;
2208
- const vnode_isElementVNode = (vNode) => {
2209
- return (vNode[VNodeProps.flags] & VNodeFlags.Element) === VNodeFlags.Element;
2210
- };
2211
- const vnode_isElementOrTextVNode = (vNode) => {
2212
- return !!(vNode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK);
2213
- };
2214
- const vnode_isTextVNode = (vNode) => {
2215
- return (vNode[VNodeProps.flags] & VNodeFlags.Text) === VNodeFlags.Text;
2216
- };
2217
- const vnode_isVirtualVNode = (vNode) => {
2218
- return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual;
2219
- };
2220
- const vnode_isProjection = (vNode) => {
2221
- return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual && null !== vnode_getProp(vNode, QSlot, null);
2222
- };
2223
- const ensureTextVNode = (vNode) => (assertTrue(vnode_isTextVNode(vNode), "Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2224
- const ensureElementOrVirtualVNode = (vNode) => {
2225
- assertTrue(!!(vNode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK), "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode));
2226
- };
2227
- const ensureElementVNode = (vNode) => (assertTrue(vnode_isElementVNode(vNode), "Expecting ElementVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2228
- const vnode_getNodeTypeName = (vNode) => {
2229
- if (vNode) {
2230
- switch (vNode[VNodeProps.flags] & VNodeFlags.TYPE_MASK) {
2231
- case VNodeFlags.Element:
2232
- return "Element";
2233
- case VNodeFlags.Virtual:
2234
- return "Virtual";
2235
- case VNodeFlags.Text:
2236
- return "Text";
1956
+ function processVNodeData$1(document2) {
1957
+ const vNodeDataMap = document2.qVNodeData || (document2.qVNodeData = /* @__PURE__ */ new WeakMap());
1958
+ const prototype = document2.body;
1959
+ const getAttribute = prototype.getAttribute;
1960
+ const hasAttribute = prototype.hasAttribute;
1961
+ const getNodeType = ((prototype2, name) => {
1962
+ let getter;
1963
+ for (; prototype2 && !(getter = Object.getOwnPropertyDescriptor(prototype2, name)?.get); ) {
1964
+ prototype2 = Object.getPrototypeOf(prototype2);
2237
1965
  }
2238
- }
2239
- return "<unknown>";
2240
- };
2241
- const vnode_ensureElementInflated = (vnode) => {
2242
- if ((vnode[VNodeProps.flags] & VNodeFlags.INFLATED_TYPE_MASK) === VNodeFlags.Element) {
2243
- const elementVNode = vnode;
2244
- elementVNode[VNodeProps.flags] ^= VNodeFlags.Inflated;
2245
- const element = elementVNode[ElementVNodeProps.element];
2246
- const attributes = element.attributes;
2247
- const props = vnode_getProps(elementVNode);
2248
- for (let idx = 0; idx < attributes.length; idx++) {
2249
- const attr = attributes[idx];
2250
- const key = attr.name;
2251
- if (":" === key || !key) {
2252
- break;
2253
- }
2254
- if (key.startsWith("q:container")) {
2255
- attr.value === QContainerValue.HTML ? mapArray_set(props, dangerouslySetInnerHTML, element.innerHTML, 0) : attr.value === QContainerValue.TEXT && "value" in element && mapArray_set(props, "value", element.value, 0);
2256
- } else if (!key.startsWith("on:")) {
2257
- mapArray_set(props, key, attr.value, 0);
1966
+ return getter || function() {
1967
+ return this[name];
1968
+ };
1969
+ })(prototype, "nodeType");
1970
+ const attachVnodeDataAndRefs = (element) => {
1971
+ Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script) => {
1972
+ script.setAttribute("type", "x-qwik/vnode");
1973
+ const qContainerElement = script.closest("[q\\:container]");
1974
+ qContainerElement.qVnodeData = script.textContent, qContainerElement.qVNodeRefs = /* @__PURE__ */ new Map();
1975
+ }), element.querySelectorAll("[q\\:shadowroot]").forEach((parent) => {
1976
+ const shadowRoot = parent.shadowRoot;
1977
+ shadowRoot && attachVnodeDataAndRefs(shadowRoot);
1978
+ });
1979
+ };
1980
+ attachVnodeDataAndRefs(document2);
1981
+ const getFastNodeType = (node) => {
1982
+ const nodeType = getNodeType.call(node);
1983
+ if (1 === nodeType) {
1984
+ if (null === getAttribute.call(node, "q:container")) {
1985
+ if (hasAttribute.call(node, "q:shadowroot")) {
1986
+ return 6;
1987
+ }
1988
+ return hasAttribute.call(node, ":") ? 2 : 0;
2258
1989
  }
1990
+ return 3;
2259
1991
  }
2260
- }
2261
- };
2262
- function vnode_walkVNode(vNode) {
2263
- let vCursor = vNode;
2264
- if (vnode_isTextVNode(vNode)) {
2265
- return;
2266
- }
2267
- let vParent = null;
2268
- for (; ; ) {
2269
- const vFirstChild = vnode_getFirstChild(vCursor);
2270
- if (vFirstChild) {
2271
- vCursor = vFirstChild;
2272
- continue;
2273
- }
2274
- if (vCursor === vNode) {
2275
- return;
2276
- }
2277
- const vNextSibling = vnode_getNextSibling(vCursor);
2278
- if (vNextSibling) {
2279
- vCursor = vNextSibling;
2280
- } else {
2281
- for (vParent = vnode_getParent(vCursor); vParent; ) {
2282
- if (vParent === vNode) {
2283
- return;
2284
- }
2285
- const vNextParentSibling = vnode_getNextSibling(vParent);
2286
- if (vNextParentSibling) {
2287
- vCursor = vNextParentSibling;
2288
- break;
2289
- }
2290
- vParent = vnode_getParent(vParent);
1992
+ if (8 === nodeType) {
1993
+ const nodeValue = node.nodeValue || "";
1994
+ if (nodeValue.startsWith("q:container-island")) {
1995
+ return 65;
2291
1996
  }
2292
- if (null == vParent) {
2293
- return;
1997
+ if (nodeValue.startsWith("q:ignore")) {
1998
+ return 16;
2294
1999
  }
2295
- }
2296
- }
2297
- }
2298
- function vnode_getDOMChildNodes(journal, root, isVNode = false, childNodes = []) {
2299
- if (vnode_isElementOrTextVNode(root)) {
2300
- return vnode_isTextVNode(root) && vnode_ensureTextInflated(journal, root), childNodes.push(isVNode ? root : vnode_getNode(root)), childNodes;
2301
- }
2302
- let vNode = vnode_getFirstChild(root);
2303
- for (; vNode; ) {
2304
- vnode_isElementVNode(vNode) ? childNodes.push(isVNode ? vNode : vnode_getNode(vNode)) : vnode_isTextVNode(vNode) ? (vnode_ensureTextInflated(journal, vNode), childNodes.push(isVNode ? vNode : vnode_getNode(vNode))) : vnode_getDOMChildNodes(journal, vNode, !!isVNode, childNodes), vNode = vnode_getNextSibling(vNode);
2305
- }
2306
- return childNodes;
2307
- }
2308
- const vnode_getDomSibling = (vNode, nextDirection, descend) => {
2309
- const childProp = nextDirection ? VirtualVNodeProps.firstChild : VirtualVNodeProps.lastChild;
2310
- const siblingProp = nextDirection ? VNodeProps.nextSibling : VNodeProps.previousSibling;
2311
- let cursor = vNode;
2312
- for (; descend && cursor && vnode_isVirtualVNode(cursor); ) {
2313
- const child = cursor[childProp];
2314
- if (!child) {
2315
- break;
2316
- }
2317
- if (child[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK) {
2318
- return child;
2319
- }
2320
- cursor = child;
2321
- }
2322
- for (; cursor; ) {
2323
- let sibling = cursor[siblingProp];
2324
- if (sibling && sibling[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK) {
2325
- return sibling;
2326
- }
2327
- if (!sibling) {
2328
- let virtual = cursor[VNodeProps.parent];
2329
- if (virtual && !vnode_isVirtualVNode(virtual)) {
2330
- return null;
2000
+ if (nodeValue.startsWith("q:container")) {
2001
+ return 5;
2331
2002
  }
2332
- for (; virtual && !(sibling = virtual[siblingProp]); ) {
2333
- if (virtual = virtual[VNodeProps.parent], virtual && !vnode_isVirtualVNode(virtual)) {
2334
- return null;
2335
- }
2003
+ if (nodeValue.startsWith("/q:container-island")) {
2004
+ return 128;
2336
2005
  }
2337
- if (!sibling) {
2338
- return null;
2006
+ if (nodeValue.startsWith("/q:ignore")) {
2007
+ return 32;
2339
2008
  }
2340
- if (vnode_isTextVNode(sibling) && virtual && vnode_isElementVNode(virtual)) {
2341
- return null;
2009
+ if (nodeValue.startsWith("/q:container")) {
2010
+ return 8;
2342
2011
  }
2343
2012
  }
2344
- for (; sibling; ) {
2345
- if (cursor = sibling, cursor[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK && vnode_getNode(cursor)) {
2346
- return cursor;
2013
+ return 0;
2014
+ };
2015
+ const isSeparator = (ch) => VNodeDataSeparator.ADVANCE_1 <= ch && ch <= VNodeDataSeparator.ADVANCE_8192;
2016
+ const findVDataSectionEnd = (vData, start, end) => {
2017
+ let depth = 0;
2018
+ for (; start < end; ) {
2019
+ const ch = vData.charCodeAt(start);
2020
+ if (0 === depth && isSeparator(ch)) {
2021
+ break;
2347
2022
  }
2348
- sibling = cursor[childProp];
2023
+ ch === VNodeDataChar.OPEN ? depth++ : ch === VNodeDataChar.CLOSE && depth--, start++;
2349
2024
  }
2350
- }
2351
- return null;
2352
- };
2353
- const vnode_ensureInflatedIfText = (journal, vNode) => {
2354
- vnode_isTextVNode(vNode) && vnode_ensureTextInflated(journal, vNode);
2355
- };
2356
- const vnode_ensureTextInflated = (journal, vnode) => {
2357
- const textVNode = ensureTextVNode(vnode);
2358
- if (!(textVNode[VNodeProps.flags] & VNodeFlags.Inflated)) {
2359
- const parentNode = vnode_getDomParent(vnode);
2360
- const sharedTextNode = textVNode[TextVNodeProps.node];
2361
- const doc = parentNode.ownerDocument;
2362
- let cursor = vnode_getDomSibling(vnode, false, true);
2363
- const insertBeforeNode = sharedTextNode || vnode_getDomSibling(vnode, true, true)?.[ElementVNodeProps.element] || null;
2364
- let lastPreviousTextNode = insertBeforeNode;
2365
- for (; cursor && vnode_isTextVNode(cursor); ) {
2366
- if (!(cursor[VNodeProps.flags] & VNodeFlags.Inflated)) {
2367
- const textNode = doc.createTextNode(cursor[TextVNodeProps.text]);
2368
- journal.push(VNodeJournalOpCode.Insert, parentNode, lastPreviousTextNode, textNode), lastPreviousTextNode = textNode, cursor[TextVNodeProps.node] = textNode, cursor[VNodeProps.flags] |= VNodeFlags.Inflated;
2369
- }
2370
- cursor = vnode_getDomSibling(cursor, false, true);
2025
+ return start;
2026
+ };
2027
+ const nextSibling = (node) => {
2028
+ for (; node && (node = node.nextSibling) && 0 === getFastNodeType(node); ) {
2371
2029
  }
2372
- for (cursor = vnode; cursor && vnode_isTextVNode(cursor); ) {
2373
- const next = vnode_getDomSibling(cursor, true, true);
2374
- const isLastNode = !next || !vnode_isTextVNode(next);
2375
- if (!(cursor[VNodeProps.flags] & VNodeFlags.Inflated)) {
2376
- if (isLastNode && sharedTextNode) {
2377
- journal.push(VNodeJournalOpCode.SetText, sharedTextNode, cursor[TextVNodeProps.text]);
2378
- } else {
2379
- const textNode = doc.createTextNode(cursor[TextVNodeProps.text]);
2380
- journal.push(VNodeJournalOpCode.Insert, parentNode, insertBeforeNode, textNode), cursor[TextVNodeProps.node] = textNode;
2030
+ return node;
2031
+ };
2032
+ const firstChild = (node) => {
2033
+ for (; node && (node = node.firstChild) && 0 === getFastNodeType(node); ) {
2034
+ }
2035
+ return node;
2036
+ };
2037
+ const walkContainer = (walker2, containerNode, node, exitNode, vData, qVNodeRefs) => {
2038
+ const vData_length = vData.length;
2039
+ let elementIdx = 0;
2040
+ let vNodeElementIndex = -1;
2041
+ let vData_start = 0;
2042
+ let vData_end = 0;
2043
+ let ch = 0;
2044
+ let needsToStoreRef = -1;
2045
+ let nextNode = null;
2046
+ const howManyElementsToSkip = () => {
2047
+ let elementsToSkip = 0;
2048
+ for (; isSeparator(ch = vData.charCodeAt(vData_start)) && (elementsToSkip += 1 << ch - VNodeDataSeparator.ADVANCE_1, vData_start++, !(vData_start >= vData_length)); ) {
2049
+ }
2050
+ return elementsToSkip;
2051
+ };
2052
+ do {
2053
+ if (node === exitNode) {
2054
+ return;
2055
+ }
2056
+ nextNode = null;
2057
+ const nodeType = node == containerNode ? 2 : getFastNodeType(node);
2058
+ if (3 === nodeType) {
2059
+ const container = node;
2060
+ let cursor = node;
2061
+ for (; cursor && !(nextNode = nextSibling(cursor)); ) {
2062
+ cursor = cursor.parentNode;
2381
2063
  }
2382
- cursor[VNodeProps.flags] |= VNodeFlags.Inflated;
2064
+ walkContainer(walker2, container, node, nextNode, container.qVnodeData || "", container.qVNodeRefs);
2065
+ } else if (16 === nodeType) {
2066
+ let islandNode = node;
2067
+ do {
2068
+ if (islandNode = walker2.nextNode(), !islandNode) {
2069
+ throw new Error(`Island inside <!--${node?.nodeValue}--> not found!`);
2070
+ }
2071
+ } while (65 !== getFastNodeType(islandNode));
2072
+ nextNode = null;
2073
+ } else if (128 === nodeType) {
2074
+ nextNode = node;
2075
+ do {
2076
+ if (nextNode = walker2.nextNode(), !nextNode) {
2077
+ throw new Error("Ignore block not closed!");
2078
+ }
2079
+ } while (32 !== getFastNodeType(nextNode));
2080
+ nextNode = null;
2081
+ } else if (5 === nodeType) {
2082
+ nextNode = node;
2083
+ do {
2084
+ if (nextNode = nextSibling(nextNode), !nextNode) {
2085
+ throw new Error(`<!--${node?.nodeValue}--> not closed!`);
2086
+ }
2087
+ } while (8 !== getFastNodeType(nextNode));
2088
+ walkContainer(walker2, node, node, nextNode, "", null);
2089
+ } else if (6 === nodeType) {
2090
+ nextNode = nextSibling(node);
2091
+ const shadowRootContainer = node;
2092
+ const shadowRoot = shadowRootContainer?.shadowRoot;
2093
+ shadowRoot && walkContainer(document2.createTreeWalker(shadowRoot, 129), null, firstChild(shadowRoot), null, "", null);
2383
2094
  }
2384
- cursor = next;
2385
- }
2095
+ if (!(2 & ~nodeType)) {
2096
+ if (vNodeElementIndex < elementIdx) {
2097
+ if (-1 === vNodeElementIndex && (vNodeElementIndex = 0), vData_start = vData_end, vData_start < vData_length) {
2098
+ vNodeElementIndex += howManyElementsToSkip();
2099
+ ch === VNodeDataSeparator.REFERENCE && (needsToStoreRef = vNodeElementIndex, vData_start++, ch = vData_start < vData_length ? vData.charCodeAt(vData_end) : VNodeDataSeparator.ADVANCE_1), vData_end = findVDataSectionEnd(vData, vData_start, vData_length);
2100
+ } else {
2101
+ vNodeElementIndex = Number.MAX_SAFE_INTEGER;
2102
+ }
2103
+ }
2104
+ if (elementIdx === vNodeElementIndex) {
2105
+ needsToStoreRef === elementIdx && qVNodeRefs.set(elementIdx, node);
2106
+ const instructions = vData.substring(vData_start, vData_end);
2107
+ vNodeDataMap.set(node, instructions);
2108
+ }
2109
+ elementIdx++;
2110
+ }
2111
+ } while (node = nextNode || walker2.nextNode());
2112
+ };
2113
+ const walker = document2.createTreeWalker(document2, 129);
2114
+ walkContainer(walker, null, walker.firstChild(), null, "", null);
2115
+ }
2116
+ function getDomContainer(element) {
2117
+ const qContainerElement = _getQContainerElement(element);
2118
+ if (!qContainerElement) {
2119
+ throw qError(41);
2386
2120
  }
2387
- };
2388
- const vnode_locate = (rootVNode, id) => {
2389
- ensureElementVNode(rootVNode);
2390
- let vNode = rootVNode;
2391
- const containerElement = rootVNode[ElementVNodeProps.element];
2392
- const { qVNodeRefs } = containerElement;
2393
- let elementOffset = -1;
2394
- let refElement;
2395
- if ("string" == typeof id ? (elementOffset = parseInt(id), refElement = qVNodeRefs.get(elementOffset)) : refElement = id, vnode_isVNode(refElement)) {
2396
- vNode = refElement;
2397
- } else {
2398
- assertTrue(containerElement.contains(refElement));
2399
- let parent = refElement;
2400
- const elementPath = [refElement];
2401
- for (; parent && parent !== containerElement; ) {
2402
- parent = parent.parentElement, elementPath.push(parent);
2121
+ return getDomContainerFromQContainerElement(qContainerElement);
2122
+ }
2123
+ function getDomContainerFromQContainerElement(qContainerElement) {
2124
+ let container = qContainerElement.qContainer;
2125
+ return container || (container = new DomContainer(qContainerElement)), container;
2126
+ }
2127
+ function _getQContainerElement(element) {
2128
+ return (Array.isArray(element) ? vnode_getDomParent(element) : element).closest(QContainerSelector);
2129
+ }
2130
+ const isDomContainer = (container) => container instanceof DomContainer;
2131
+ class DomContainer extends _SharedContainer {
2132
+ constructor(element) {
2133
+ super(() => this.scheduleRender(), () => vnode_applyJournal(this.$journal$), {}, element.getAttribute("q:locale"));
2134
+ __publicField(this, "element");
2135
+ __publicField(this, "qContainer");
2136
+ __publicField(this, "qManifestHash");
2137
+ __publicField(this, "rootVNode");
2138
+ __publicField(this, "document");
2139
+ __publicField(this, "$journal$");
2140
+ __publicField(this, "renderDone", null);
2141
+ __publicField(this, "$rawStateData$");
2142
+ __publicField(this, "$storeProxyMap$", /* @__PURE__ */ new WeakMap());
2143
+ __publicField(this, "$qFuncs$");
2144
+ __publicField(this, "$instanceHash$");
2145
+ __publicField(this, "vNodeLocate", (id) => vnode_locate(this.rootVNode, id));
2146
+ __publicField(this, "$stateData$");
2147
+ __publicField(this, "$styleIds$", null);
2148
+ __publicField(this, "$renderCount$", 0);
2149
+ __publicField(this, "$getObjectById$", (id) => ("string" == typeof id && (id = parseFloat(id)), assertTrue(id < this.$rawStateData$.length / 2, `Invalid reference: ${id} >= ${this.$rawStateData$.length / 2}`), this.$stateData$[id]));
2150
+ if (this.qContainer = element.getAttribute("q:container"), !this.qContainer) {
2151
+ throw qError(42);
2403
2152
  }
2404
- for (let i = elementPath.length - 2; i >= 0; i--) {
2405
- vNode = vnode_getVNodeForChildNode(vNode, elementPath[i]);
2153
+ this.$journal$ = [3, element.ownerDocument], this.document = element.ownerDocument, this.element = element, this.$buildBase$ = element.getAttribute("q:base"), this.$instanceHash$ = element.getAttribute("q:instance"), this.qManifestHash = element.getAttribute("q:manifest-hash"), this.rootVNode = vnode_newUnMaterializedElement(this.element), this.$rawStateData$ = [], this.$stateData$ = [];
2154
+ const document2 = this.element.ownerDocument;
2155
+ document2.qVNodeData || processVNodeData$1(document2), this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY, this.$setServerData$(), element.setAttribute("q:container", "resumed"), element.qContainer = this;
2156
+ const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
2157
+ if (0 !== qwikStates.length) {
2158
+ this.$rawStateData$ = JSON.parse(qwikStates[qwikStates.length - 1].textContent), this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
2406
2159
  }
2407
- -1 != elementOffset && qVNodeRefs.set(elementOffset, vNode);
2408
2160
  }
2409
- if ("string" == typeof id) {
2410
- const idLength = id.length;
2411
- let idx = indexOfAlphanumeric(id, idLength);
2412
- let childIdx = 0;
2413
- for (; idx < idLength; ) {
2414
- const ch = id.charCodeAt(idx);
2415
- childIdx *= 26, ch >= 97 ? childIdx += ch - 97 : (childIdx += ch - 65, vNode = vnode_getChildWithIdx(vNode, childIdx), childIdx = 0), idx++;
2416
- }
2161
+ $setRawState$(id, vParent) {
2162
+ this.$stateData$[id] = vParent;
2417
2163
  }
2418
- return vNode;
2419
- };
2420
- const vnode_getChildWithIdx = (vNode, childIdx) => {
2421
- let child = vnode_getFirstChild(vNode);
2422
- for (assertDefined(); child[VNodeProps.flags] >>> VNodeFlagsIndex.shift !== childIdx; ) {
2423
- child = vnode_getNextSibling(child);
2164
+ parseQRL(qrl2) {
2165
+ return inflateQRL(this, parseQRL(qrl2));
2424
2166
  }
2425
- return child;
2426
- };
2427
- const vNodeStack = [];
2428
- const vnode_getVNodeForChildNode = (vNode, childElement) => {
2429
- ensureElementVNode(vNode);
2430
- let child = vnode_getFirstChild(vNode);
2431
- for (assertDefined(); child && child[ElementVNodeProps.element] !== childElement; ) {
2432
- if (vnode_isVirtualVNode(child)) {
2433
- const next = vnode_getNextSibling(child);
2434
- const firstChild = vnode_getFirstChild(child);
2435
- firstChild ? (next && vNodeStack.push(next), child = firstChild) : child = next || (vNodeStack.length ? vNodeStack.pop() : null);
2436
- } else {
2437
- const next = vnode_getNextSibling(child);
2438
- child = next || (next || vNodeStack.pop());
2167
+ handleError(err, host) {
2168
+ const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
2169
+ if (!errorStore) {
2170
+ throw err;
2439
2171
  }
2172
+ errorStore.error = err;
2440
2173
  }
2441
- for (; vNodeStack.length; ) {
2442
- vNodeStack.pop();
2174
+ setContext(host, context, value) {
2175
+ let ctx = this.getHostProp(host, "q:ctx");
2176
+ ctx || this.setHostProp(host, "q:ctx", ctx = []), mapArray_set(ctx, context.id, value, 0);
2443
2177
  }
2444
- return ensureElementVNode(child), assertEqual(child[ElementVNodeProps.element]), child;
2445
- };
2446
- const indexOfAlphanumeric = (id, length) => {
2447
- let idx = 0;
2448
- for (; idx < length; ) {
2449
- if (!(id.charCodeAt(idx) <= 57)) {
2450
- return idx;
2178
+ resolveContext(host, contextId) {
2179
+ for (; host; ) {
2180
+ const ctx = this.getHostProp(host, "q:ctx");
2181
+ if (ctx) {
2182
+ const value = mapArray_get(ctx, contextId.id, 0);
2183
+ if (value) {
2184
+ return value;
2185
+ }
2186
+ }
2187
+ host = this.getParentHost(host);
2451
2188
  }
2452
- idx++;
2453
2189
  }
2454
- return length;
2455
- };
2456
- const parseBoolean = (value) => "false" !== value && Boolean(value);
2457
- const isBooleanAttr = (element, key) => ("allowfullscreen" == key || "async" == key || "autofocus" == key || "autoplay" == key || "checked" == key || "controls" == key || "default" == key || "defer" == key || "disabled" == key || "formnovalidate" == key || "inert" == key || "ismap" == key || "itemscope" == key || "loop" == key || "multiple" == key || "muted" == key || "nomodule" == key || "novalidate" == key || "open" == key || "playsinline" == key || "readonly" == key || "required" == key || "reversed" == key || "selected" == key) && key in element;
2458
- const vnode_applyJournal = (journal) => {
2459
- let idx = 0;
2460
- const length = journal.length;
2461
- for (; idx < length; ) {
2462
- switch (journal[idx++]) {
2463
- case VNodeJournalOpCode.SetText:
2464
- journal[idx++].nodeValue = journal[idx++];
2465
- break;
2466
- case VNodeJournalOpCode.SetAttribute:
2467
- const element = journal[idx++];
2468
- let key = journal[idx++];
2469
- "className" === key && (key = "class");
2470
- const value = journal[idx++];
2471
- isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : key === dangerouslySetInnerHTML ? element.innerHTML = value : null == value || false === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
2472
- break;
2473
- case VNodeJournalOpCode.HoistStyles:
2474
- const document2 = journal[idx++];
2475
- const head = document2.head;
2476
- const styles = document2.querySelectorAll(QStylesAllSelector);
2477
- for (let i = 0; i < styles.length; i++) {
2478
- head.appendChild(styles[i]);
2479
- }
2480
- break;
2481
- case VNodeJournalOpCode.Remove:
2482
- const removeParent = journal[idx++];
2483
- let nodeToRemove;
2484
- for (; idx < length && "number" != typeof (nodeToRemove = journal[idx]); ) {
2485
- removeParent.removeChild(nodeToRemove), idx++;
2486
- }
2487
- break;
2488
- case VNodeJournalOpCode.Insert:
2489
- const insertParent = journal[idx++];
2490
- const insertBefore = journal[idx++];
2491
- let newChild;
2492
- for (; idx < length && "number" != typeof (newChild = journal[idx]); ) {
2493
- insertParent.insertBefore(newChild, insertBefore), idx++;
2190
+ getParentHost(host) {
2191
+ let vNode = vnode_getParent(host);
2192
+ for (; vNode; ) {
2193
+ if (vnode_isVirtualVNode(vNode)) {
2194
+ if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
2195
+ return vNode;
2494
2196
  }
2197
+ vNode = vnode_getParent(vNode) || vnode_getProp(vNode, "q:sparent", this.vNodeLocate);
2198
+ } else {
2199
+ vNode = vnode_getParent(vNode);
2200
+ }
2495
2201
  }
2202
+ return null;
2496
2203
  }
2497
- journal.length = 0;
2498
- };
2499
- const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
2500
- ensureElementOrVirtualVNode(parent), vnode_isElementVNode(parent) && ensureMaterialized(parent), newChild === insertBefore && (insertBefore = null);
2501
- let adjustedInsertBefore = null;
2502
- null == insertBefore ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, true, false)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, true, true) : insertBefore, adjustedInsertBefore && vnode_ensureInflatedIfText(journal, adjustedInsertBefore);
2503
- const domParentVNode = vnode_getDomParentVNode(parent);
2504
- const parentNode = domParentVNode && domParentVNode[ElementVNodeProps.element];
2505
- if (parentNode) {
2506
- const domChildren = vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild);
2507
- domChildren.length && journal.push(VNodeJournalOpCode.Insert, parentNode, vnode_getNode(adjustedInsertBefore), ...domChildren);
2508
- }
2509
- const newChildCurrentParent = newChild[VNodeProps.parent];
2510
- newChildCurrentParent && (newChild[VNodeProps.previousSibling] || newChild[VNodeProps.nextSibling] || vnode_isElementVNode(newChildCurrentParent) && newChildCurrentParent !== parent) && vnode_remove(journal, newChildCurrentParent, newChild, false);
2511
- const vNext = insertBefore;
2512
- const vPrevious = vNext ? vNext[VNodeProps.previousSibling] : parent[ElementVNodeProps.lastChild];
2513
- vNext ? vNext[VNodeProps.previousSibling] = newChild : parent[ElementVNodeProps.lastChild] = newChild, vPrevious ? vPrevious[VNodeProps.nextSibling] = newChild : parent[ElementVNodeProps.firstChild] = newChild, newChild[VNodeProps.previousSibling] = vPrevious, newChild[VNodeProps.nextSibling] = vNext, newChild[VNodeProps.parent] = parent;
2514
- };
2515
- const vnode_getDomParent = (vnode) => (vnode = vnode_getDomParentVNode(vnode)) && vnode[ElementVNodeProps.element];
2516
- const vnode_getDomParentVNode = (vnode) => {
2517
- for (; vnode && !vnode_isElementVNode(vnode); ) {
2518
- vnode = vnode[VNodeProps.parent];
2204
+ setHostProp(host, name, value) {
2205
+ vnode_setProp(host, name, value);
2519
2206
  }
2520
- return vnode;
2521
- };
2522
- const vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
2523
- assertEqual(vParent, vnode_getParent(vToRemove)), vnode_isTextVNode(vToRemove) && vnode_ensureTextInflated(journal, vToRemove);
2524
- const vPrevious = vToRemove[VNodeProps.previousSibling];
2525
- const vNext = vToRemove[VNodeProps.nextSibling];
2526
- if (vPrevious ? vPrevious[VNodeProps.nextSibling] = vNext : vParent[ElementVNodeProps.firstChild] = vNext, vNext ? vNext[VNodeProps.previousSibling] = vPrevious : vParent[ElementVNodeProps.lastChild] = vPrevious, vToRemove[VNodeProps.previousSibling] = null, vToRemove[VNodeProps.nextSibling] = null, removeDOM) {
2527
- const domParent = vnode_getDomParent(vParent);
2528
- if (vnode_getAttr(vParent, dangerouslySetInnerHTML)) {
2529
- return;
2207
+ getHostProp(host, name) {
2208
+ const vNode = host;
2209
+ let getObjectById2 = null;
2210
+ switch (name) {
2211
+ case "q:seq":
2212
+ case "q:props":
2213
+ case "q:renderFn":
2214
+ case "q:ctx":
2215
+ case "q:brefs":
2216
+ getObjectById2 = this.$getObjectById$;
2217
+ break;
2218
+ case "q:seqIdx":
2219
+ case ":onIdx":
2220
+ getObjectById2 = parseInt;
2530
2221
  }
2531
- const children = vnode_getDOMChildNodes(journal, vToRemove);
2532
- domParent && children.length && journal.push(VNodeJournalOpCode.Remove, domParent, ...children);
2222
+ return vnode_getProp(vNode, name, getObjectById2);
2533
2223
  }
2534
- };
2535
- const vnode_truncate = (journal, vParent, vDelete) => {
2536
- const parent = vnode_getDomParent(vParent);
2537
- const children = vnode_getDOMChildNodes(journal, vDelete);
2538
- parent && children.length && journal.push(VNodeJournalOpCode.Remove, parent, ...children);
2539
- const vPrevious = vDelete[VNodeProps.previousSibling];
2540
- vPrevious ? vPrevious[VNodeProps.nextSibling] = null : vParent[ElementVNodeProps.firstChild] = null, vParent[ElementVNodeProps.lastChild] = vPrevious;
2541
- };
2542
- const vnode_getElementName = (vnode) => {
2543
- const elementVNode = ensureElementVNode(vnode);
2544
- let elementName = elementVNode[ElementVNodeProps.elementName];
2545
- if (void 0 === elementName) {
2546
- const element = elementVNode[ElementVNodeProps.element];
2547
- const nodeName = fastNodeName(element);
2548
- elementName = elementVNode[ElementVNodeProps.elementName] = nodeName, elementVNode[VNodeProps.flags] |= vnode_getElementNamespaceFlags(element);
2224
+ scheduleRender() {
2225
+ return this.$renderCount$++, this.renderDone || (this.renderDone = getPlatform().nextTick(() => this.processChores())), this.renderDone.finally(() => emitEvent("qrender", {
2226
+ instanceHash: this.$instanceHash$,
2227
+ renderCount: this.$renderCount$
2228
+ }));
2549
2229
  }
2550
- return elementName;
2551
- };
2552
- const vnode_getText = (vnode) => {
2553
- const textVNode = ensureTextVNode(vnode);
2554
- let text = textVNode[TextVNodeProps.text];
2555
- return void 0 === text && (text = textVNode[TextVNodeProps.text] = textVNode[TextVNodeProps.node].nodeValue), text;
2556
- };
2557
- const vnode_setText = (journal, textVNode, text) => {
2558
- vnode_ensureTextInflated(journal, textVNode);
2559
- journal.push(VNodeJournalOpCode.SetText, textVNode[TextVNodeProps.node], textVNode[TextVNodeProps.text] = text);
2560
- };
2561
- const vnode_getFirstChild = (vnode) => {
2562
- if (vnode_isTextVNode(vnode)) {
2563
- return null;
2230
+ processChores() {
2231
+ let renderCount = this.$renderCount$;
2232
+ const result = this.$scheduler$(255);
2233
+ if (isPromise(result)) {
2234
+ return result.then(async () => {
2235
+ for (; renderCount !== this.$renderCount$; ) {
2236
+ renderCount = this.$renderCount$, await this.$scheduler$(255);
2237
+ }
2238
+ this.renderDone = null;
2239
+ });
2240
+ }
2241
+ renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
2564
2242
  }
2565
- let vFirstChild = vnode[ElementVNodeProps.firstChild];
2566
- return void 0 === vFirstChild && (vFirstChild = ensureMaterialized(vnode)), vFirstChild;
2567
- };
2568
- const vnode_materialize = (vNode) => {
2569
- const element = vNode[ElementVNodeProps.element];
2570
- const firstChild = fastFirstChild(element);
2571
- const vNodeData = element.ownerDocument?.qVNodeData?.get(element);
2572
- return materialize(vNode, element, firstChild, vNodeData);
2573
- };
2574
- const materialize = (vNode, element, firstChild, vNodeData) => {
2575
- if (vNodeData) {
2576
- if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
2577
- const elementVNodeDataStartIdx = 1;
2578
- let elementVNodeDataEndIdx = 1;
2579
- for (; vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR; ) {
2580
- elementVNodeDataEndIdx++;
2581
- }
2582
- const elementVNodeData = vNodeData.substring(elementVNodeDataStartIdx, elementVNodeDataEndIdx);
2583
- vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
2584
- const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
2585
- if (!vNodeData) {
2586
- return vFirstChild;
2243
+ ensureProjectionResolved(vNode) {
2244
+ if (!(16 & vNode[0])) {
2245
+ vNode[0] |= 16;
2246
+ const props = vnode_getProps(vNode);
2247
+ for (let i = 0; i < props.length; i += 2) {
2248
+ if (isSlotProp(props[i])) {
2249
+ const value = props[i + 1];
2250
+ "string" == typeof value && (props[i + 1] = this.vNodeLocate(value));
2251
+ }
2587
2252
  }
2588
2253
  }
2589
- return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
2590
2254
  }
2591
- return materializeFromDOM(vNode, firstChild);
2592
- };
2593
- const ensureMaterialized = (vnode) => {
2594
- const vParent = ensureElementVNode(vnode);
2595
- let vFirstChild = vParent[ElementVNodeProps.firstChild];
2596
- if (void 0 === vFirstChild) {
2597
- vFirstChild = vParent[VNodeProps.parent] && shouldIgnoreChildren(vParent[ElementVNodeProps.element]) ? vParent[ElementVNodeProps.firstChild] = vParent[ElementVNodeProps.lastChild] = null : vnode_materialize(vParent);
2255
+ getSyncFn(id) {
2256
+ const fn = this.$qFuncs$[id];
2257
+ return fn;
2598
2258
  }
2599
- return assertTrue(void 0 !== vParent[ElementVNodeProps.firstChild]), assertTrue(void 0 !== vParent[ElementVNodeProps.lastChild]), vFirstChild;
2600
- };
2601
- let _fastHasAttribute = null;
2602
- const shouldIgnoreChildren = (node) => (_fastHasAttribute || (_fastHasAttribute = node.hasAttribute), _fastHasAttribute.call(node, "q:container"));
2603
- let _fastNodeType = null;
2604
- const fastNodeType = (node) => (_fastNodeType || (_fastNodeType = fastGetter(node, "nodeType")), _fastNodeType.call(node));
2605
- const fastIsTextOrElement = (node) => {
2606
- const type = fastNodeType(node);
2607
- return 3 === type || 1 === type;
2608
- };
2609
- let _fastNextSibling = null;
2610
- const fastNextSibling = (node) => {
2611
- for (_fastNextSibling || (_fastNextSibling = fastGetter(node, "nextSibling")), _fastFirstChild || (_fastFirstChild = fastGetter(node, "firstChild")); node; ) {
2612
- if (null !== (node = _fastNextSibling.call(node))) {
2613
- const type = fastNodeType(node);
2614
- if (3 === type || 1 === type) {
2615
- break;
2616
- }
2617
- if (8 === type) {
2618
- const nodeValue = node.nodeValue;
2619
- if (nodeValue?.startsWith(QIgnore)) {
2620
- return getNodeAfterCommentNode(node, QContainerIsland, _fastNextSibling, _fastFirstChild);
2621
- }
2622
- if (node.nodeValue?.startsWith(QContainerIslandEnd)) {
2623
- return getNodeAfterCommentNode(node, QIgnoreEnd, _fastNextSibling, _fastFirstChild);
2624
- }
2625
- if (nodeValue?.startsWith("q:container")) {
2626
- for (; node && (node = _fastNextSibling.call(node)) && (8 !== fastNodeType(node) || !node.nodeValue?.startsWith("/q:container")); ) {
2627
- }
2628
- }
2629
- }
2259
+ $appendStyle$(content, styleId, host, scoped) {
2260
+ if (scoped) {
2261
+ const scopedStyleIdsString = this.getHostProp(host, "q:sstyle");
2262
+ const scopedStyleIds = new Set(convertScopedStyleIdsToArray(scopedStyleIdsString));
2263
+ scopedStyleIds.add(styleId), this.setHostProp(host, "q:sstyle", convertStyleIdsToString(scopedStyleIds));
2264
+ }
2265
+ if (null == this.$styleIds$ && (this.$styleIds$ = /* @__PURE__ */ new Set(), this.element.querySelectorAll(QStyleSelector).forEach((style) => {
2266
+ this.$styleIds$.add(style.getAttribute(QStyle));
2267
+ })), !this.$styleIds$.has(styleId)) {
2268
+ this.$styleIds$.add(styleId);
2269
+ const styleElement = this.document.createElement("style");
2270
+ styleElement.setAttribute(QStyle, styleId), styleElement.textContent = content, this.$journal$.push(5, this.document.head, null, styleElement);
2630
2271
  }
2631
2272
  }
2632
- return node;
2633
- };
2634
- function getNodeAfterCommentNode(node, commentValue, nextSibling, firstChild) {
2635
- for (; node; ) {
2636
- if (node.nodeValue?.startsWith(commentValue)) {
2637
- return node = nextSibling.call(node) || null;
2273
+ $setServerData$() {
2274
+ const containerAttributes = {};
2275
+ const attrs = this.element.attributes;
2276
+ if (attrs) {
2277
+ for (let index = 0; index < attrs.length; index++) {
2278
+ const attr = attrs[index];
2279
+ ":" !== attr.name && (containerAttributes[attr.name] = attr.value);
2280
+ }
2638
2281
  }
2639
- let nextNode = firstChild.call(node);
2640
- nextNode || (nextNode = nextSibling.call(node)), nextNode || (nextNode = fastParentNode(node), nextNode && (nextNode = nextSibling.call(nextNode))), node = nextNode;
2282
+ this.$serverData$ = {
2283
+ containerAttributes
2284
+ };
2641
2285
  }
2642
- return null;
2643
2286
  }
2644
- let _fastParentNode = null;
2645
- const fastParentNode = (node) => (_fastParentNode || (_fastParentNode = fastGetter(node, "parentNode")), _fastParentNode.call(node));
2646
- let _fastFirstChild = null;
2647
- const fastFirstChild = (node) => {
2648
- for (_fastFirstChild || (_fastFirstChild = fastGetter(node, "firstChild")), node = node && _fastFirstChild.call(node); node && !fastIsTextOrElement(node); ) {
2649
- node = fastNextSibling(node);
2287
+ let _context;
2288
+ const tryGetInvokeContext = () => {
2289
+ if (!_context) {
2290
+ const context = "undefined" != typeof document && document && document.__q_context__;
2291
+ if (!context) {
2292
+ return;
2293
+ }
2294
+ return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
2650
2295
  }
2651
- return node;
2296
+ return _context;
2652
2297
  };
2653
- let _fastNamespaceURI = null;
2654
- const fastNamespaceURI = (element) => (_fastNamespaceURI || (_fastNamespaceURI = fastGetter(element, "namespaceURI")), _fastNamespaceURI.call(element));
2655
- let _fastNodeName = null;
2656
- const fastNodeName = (element) => (_fastNodeName || (_fastNodeName = fastGetter(element, "nodeName")), _fastNodeName.call(element));
2657
- const fastGetter = (prototype, name) => {
2658
- let getter;
2659
- for (; prototype && !(getter = Object.getOwnPropertyDescriptor(prototype, name)?.get); ) {
2660
- prototype = Object.getPrototypeOf(prototype);
2298
+ function invoke(context, fn, ...args) {
2299
+ return invokeApply.call(this, context, fn, args);
2300
+ }
2301
+ function invokeApply(context, fn, args) {
2302
+ const previousContext = _context;
2303
+ let returnValue;
2304
+ try {
2305
+ _context = context, returnValue = fn.apply(this, args);
2306
+ } finally {
2307
+ _context = previousContext;
2661
2308
  }
2662
- return getter || function() {
2663
- return this[name];
2664
- };
2309
+ return returnValue;
2310
+ }
2311
+ const newInvokeContextFromTuple = ([element, event, url]) => {
2312
+ const domContainer = getDomContainer(element);
2313
+ const hostElement = vnode_locate(domContainer.rootVNode, element);
2314
+ const locale = domContainer.$locale$;
2315
+ return newInvokeContext(locale, hostElement, element, event, url);
2665
2316
  };
2666
- const isQStyleElement = (node) => isElement(node) && "STYLE" === node.nodeName && (node.hasAttribute("q:sstyle") || node.hasAttribute(QStyle));
2667
- const materializeFromDOM = (vParent, firstChild, vData) => {
2668
- let vFirstChild = null;
2669
- const skipStyleElements = () => {
2670
- for (; isQStyleElement(child); ) {
2671
- child = fastNextSibling(child);
2672
- }
2317
+ const newInvokeContext = (locale, hostElement, element, event, url) => {
2318
+ const ctx = {
2319
+ $url$: url,
2320
+ $i$: 0,
2321
+ $hostElement$: hostElement,
2322
+ $element$: element,
2323
+ $event$: event,
2324
+ $qrl$: void 0,
2325
+ $effectSubscriber$: void 0,
2326
+ $locale$: locale || ("object" == typeof event && event && "locale" in event ? event.locale : void 0),
2327
+ $container$: void 0
2673
2328
  };
2674
- let child = firstChild;
2675
- skipStyleElements();
2676
- let vChild = null;
2677
- for (; child; ) {
2678
- const nodeType = fastNodeType(child);
2679
- let vNextChild = null;
2680
- 3 === nodeType ? vNextChild = vnode_newText(child, child.textContent ?? void 0) : 1 === nodeType && (vNextChild = vnode_newUnMaterializedElement(child)), vNextChild && (vNextChild[VNodeProps.parent] = vParent, vChild && (vChild[VNodeProps.nextSibling] = vNextChild), vNextChild[VNodeProps.previousSibling] = vChild, vChild = vNextChild), vFirstChild || (vParent[ElementVNodeProps.firstChild] = vFirstChild = vChild), child = fastNextSibling(child), skipStyleElements();
2681
- }
2682
- if (vParent[ElementVNodeProps.lastChild] = vChild || null, vParent[ElementVNodeProps.firstChild] = vFirstChild, vData) {
2683
- let container = null;
2684
- processVNodeData$1(vData, (peek, consumeValue) => {
2685
- if (peek() === VNodeDataChar.ID) {
2686
- container || (container = getDomContainer(vParent[ElementVNodeProps.element]));
2687
- const id = consumeValue();
2688
- container.$setRawState$(parseInt(id), vParent);
2689
- } else {
2690
- peek() === VNodeDataChar.BACK_REFS ? (container || (container = getDomContainer(vParent[ElementVNodeProps.element])), setEffectBackRefFromVNodeData(vParent, consumeValue(), container)) : consumeValue();
2691
- }
2692
- });
2693
- }
2694
- return vFirstChild;
2329
+ return ctx;
2695
2330
  };
2696
- function setEffectBackRefFromVNodeData(vParent, value, container) {
2697
- const deserializedSubMap = container.$getObjectById$(value);
2698
- if (vParent[_EFFECT_BACK_REF]) {
2699
- mergeMaps(vParent[_EFFECT_BACK_REF], deserializedSubMap);
2700
- } else {
2701
- Object.defineProperty(vParent, _EFFECT_BACK_REF, {
2702
- value: deserializedSubMap
2703
- });
2704
- }
2705
- }
2706
- const processVNodeData$1 = (vData, callback) => {
2707
- let nextToConsumeIdx = 0;
2708
- let ch = 0;
2709
- let peekCh = 0;
2710
- const peek = () => 0 !== peekCh ? peekCh : peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
2711
- const consume = () => (ch = peek(), peekCh = 0, nextToConsumeIdx++, ch);
2712
- const consumeValue = () => {
2713
- consume();
2714
- const start = nextToConsumeIdx;
2715
- for (; peek() <= 58 && 0 !== peekCh || 95 === peekCh || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122; ) {
2716
- consume();
2717
- }
2718
- return vData.substring(start, nextToConsumeIdx);
2719
- };
2720
- for (; 0 !== peek(); ) {
2721
- callback(peek, consumeValue, consume, nextToConsumeIdx);
2722
- }
2723
- };
2724
- const vnode_getNextSibling = (vnode) => vnode[VNodeProps.nextSibling];
2725
- const vnode_getPreviousSibling = (vnode) => vnode[VNodeProps.previousSibling];
2726
- const vnode_setAttr = (journal, vnode, key, value) => {
2727
- const type = vnode[VNodeProps.flags];
2728
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
2729
- vnode_ensureElementInflated(vnode);
2730
- const props = vnode_getProps(vnode);
2731
- const idx = mapApp_findIndx(props, key, 0);
2732
- if (idx >= 0) {
2733
- if (props[idx + 1] != value && type & VNodeFlags.Element) {
2734
- journal && journal.push(VNodeJournalOpCode.SetAttribute, vnode[ElementVNodeProps.element], key, value);
2735
- }
2736
- null == value ? props.splice(idx, 2) : props[idx + 1] = value;
2737
- } else if (null != value && (props.splice(~idx, 0, key, value), type & VNodeFlags.Element)) {
2738
- journal && journal.push(VNodeJournalOpCode.SetAttribute, vnode[ElementVNodeProps.element], key, value);
2739
- }
2740
- }
2741
- };
2742
- const vnode_getAttr = (vnode, key) => {
2743
- if (vnode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
2744
- vnode_ensureElementInflated(vnode);
2745
- const props = vnode_getProps(vnode);
2746
- return mapArray_get(props, key, 0);
2331
+ const untrack = (fn) => invoke(void 0, fn);
2332
+ const trackInvocation = /* @__PURE__ */ newInvokeContext(void 0, void 0, void 0, "qRender");
2333
+ const trackSignal = (fn, subscriber, property, container, data) => {
2334
+ const previousSubscriber = trackInvocation.$effectSubscriber$;
2335
+ const previousContainer = trackInvocation.$container$;
2336
+ try {
2337
+ return trackInvocation.$effectSubscriber$ = getSubscriber(subscriber, property, data), trackInvocation.$container$ = container, invoke(trackInvocation, fn);
2338
+ } finally {
2339
+ trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
2747
2340
  }
2748
- return null;
2749
2341
  };
2750
- const vnode_getProp = (vnode, key, getObject) => {
2751
- const type = vnode[VNodeProps.flags];
2752
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
2753
- type & VNodeFlags.Element && vnode_ensureElementInflated(vnode);
2754
- const props = vnode_getProps(vnode);
2755
- const idx = mapApp_findIndx(props, key, 0);
2756
- if (idx >= 0) {
2757
- let value = props[idx + 1];
2758
- return "string" == typeof value && getObject && (props[idx + 1] = value = getObject(value)), value;
2759
- }
2760
- }
2761
- return null;
2342
+ const trackSignalAndAssignHost = (value, host, property, container, data) => (value instanceof WrappedSignal && value.$hostElement$ !== host && host && (value.$hostElement$ = host), trackSignal(() => value.value, host, property, container, data));
2343
+ const _jsxSorted = (type, varProps, constProps, children, flags, key) => {
2344
+ const processed = null == key ? null : String(key);
2345
+ const node = new JSXNodeImpl(type, varProps || {}, constProps || null, children, flags, processed);
2346
+ return node;
2762
2347
  };
2763
- const vnode_setProp = (vnode, key, value) => {
2764
- ensureElementOrVirtualVNode(vnode);
2765
- const props = vnode_getProps(vnode);
2766
- const idx = mapApp_findIndx(props, key, 0);
2767
- idx >= 0 ? props[idx + 1] = value : null != value && props.splice(~idx, 0, key, value);
2348
+ const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
2349
+ let sortedProps;
2350
+ return sortedProps = varProps ? Object.fromEntries(untrack(() => Object.entries(varProps)).filter((entry) => {
2351
+ const attr = entry[0];
2352
+ return "children" === attr ? (children ?? (children = entry[1]), false) : "key" === attr ? (key = entry[1], false) : !constProps;
2353
+ }).sort(([a2], [b]) => a2 < b ? -1 : 1)) : "string" == typeof type ? EMPTY_OBJ : {}, _jsxSorted(type, sortedProps, constProps, children, flags, key);
2768
2354
  };
2769
- const vnode_getPropStartIndex = (vnode) => {
2770
- const type = vnode[VNodeProps.flags] & VNodeFlags.TYPE_MASK;
2771
- if (type === VNodeFlags.Element) {
2772
- return ElementVNodeProps.PROPS_OFFSET;
2355
+ const jsx = (type, props, key) => _jsxSplit(type, props, null, null, 0, null);
2356
+ const isPropsProxy = (obj) => obj && void 0 !== obj[_VAR_PROPS];
2357
+ class JSXNodeImpl {
2358
+ constructor(type, varProps, constProps, children, flags, key = null) {
2359
+ __publicField(this, "type");
2360
+ __publicField(this, "varProps");
2361
+ __publicField(this, "constProps");
2362
+ __publicField(this, "children");
2363
+ __publicField(this, "flags");
2364
+ __publicField(this, "key");
2365
+ __publicField(this, "dev");
2366
+ __publicField(this, "_proxy", null);
2367
+ this.type = type, this.varProps = varProps, this.constProps = constProps, this.children = children, this.flags = flags, this.key = key;
2773
2368
  }
2774
- if (type === VNodeFlags.Virtual) {
2775
- return VirtualVNodeProps.PROPS_OFFSET;
2369
+ get props() {
2370
+ return this._proxy || (this._proxy = createPropsProxy(this.varProps, this.constProps, this.children)), this._proxy;
2776
2371
  }
2777
- throw qError(QError.invalidVNodeType, [type]);
2778
- };
2779
- const vnode_getProps = (vnode) => vnode[vnode_getPropStartIndex(vnode)];
2780
- const vnode_getParent = (vnode) => vnode[VNodeProps.parent] || null;
2781
- const vnode_getNode = (vnode) => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[ElementVNodeProps.element] : (assertTrue(vnode_isTextVNode(vnode)), vnode[TextVNodeProps.node]);
2782
- const isNumber = (ch) => 48 <= ch && ch <= 57;
2783
- const isLowercase = (ch) => 97 <= ch && ch <= 122;
2784
- const stack = [];
2785
- function materializeFromVNodeData(vParent, vData, element, child) {
2786
- let idx = 0;
2787
- let vFirst = null;
2788
- let vLast = null;
2789
- let previousTextNode = null;
2790
- const addVNode = (node) => {
2791
- node[VNodeProps.flags] = node[VNodeProps.flags] & VNodeFlagsIndex.negated_mask | idx << VNodeFlagsIndex.shift, idx++, vLast && (vLast[VNodeProps.nextSibling] = node), node[VNodeProps.previousSibling] = vLast, node[VNodeProps.parent] = vParent, vFirst || (vParent[ElementVNodeProps.firstChild] = vFirst = node), vLast = node;
2792
- };
2793
- let textIdx = 0;
2794
- let combinedText = null;
2795
- let container = null;
2796
- return processVNodeData$1(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
2797
- if (isNumber(peek())) {
2798
- for (; !isElement(child); ) {
2799
- if (!(child = fastNextSibling(child))) {
2800
- throw qError(QError.materializeVNodeDataError, [vData, peek(), nextToConsumeIdx]);
2801
- }
2802
- }
2803
- for (; isQStyleElement(child); ) {
2804
- child = fastNextSibling(child);
2805
- }
2806
- combinedText = null, previousTextNode = null;
2807
- let value = 0;
2808
- for (; isNumber(peek()); ) {
2809
- value *= 10, value += consume() - 48;
2810
- }
2811
- for (; value--; ) {
2812
- addVNode(vnode_newUnMaterializedElement(child)), child = fastNextSibling(child);
2813
- }
2814
- } else if (peek() === VNodeDataChar.SCOPED_STYLE) {
2815
- vnode_setAttr(null, vParent, "q:sstyle", consumeValue());
2816
- } else if (peek() === VNodeDataChar.RENDER_FN) {
2817
- vnode_setAttr(null, vParent, "q:renderFn", consumeValue());
2818
- } else if (peek() === VNodeDataChar.ID) {
2819
- container || (container = getDomContainer(element));
2820
- const id = consumeValue();
2821
- container.$setRawState$(parseInt(id), vParent);
2822
- } else if (peek() === VNodeDataChar.PROPS) {
2823
- vnode_setAttr(null, vParent, "q:props", consumeValue());
2824
- } else if (peek() === VNodeDataChar.KEY) {
2825
- vnode_setAttr(null, vParent, "q:key", consumeValue());
2826
- } else if (peek() === VNodeDataChar.SEQ) {
2827
- vnode_setAttr(null, vParent, "q:seq", consumeValue());
2828
- } else if (peek() === VNodeDataChar.SEQ_IDX) {
2829
- vnode_setAttr(null, vParent, "q:seqIdx", consumeValue());
2830
- } else if (peek() === VNodeDataChar.BACK_REFS) {
2831
- container || (container = getDomContainer(element)), setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
2832
- } else if (peek() === VNodeDataChar.SLOT_PARENT) {
2833
- vnode_setProp(vParent, "q:sparent", consumeValue());
2834
- } else if (peek() === VNodeDataChar.CONTEXT) {
2835
- vnode_setAttr(null, vParent, "q:ctx", consumeValue());
2836
- } else if (peek() === VNodeDataChar.OPEN) {
2837
- consume(), addVNode(vnode_newVirtual()), stack.push(vParent, vFirst, vLast, previousTextNode, idx), idx = 0, vParent = vLast, vFirst = vLast = null;
2838
- } else if (peek() === VNodeDataChar.SEPARATOR) {
2839
- const key = consumeValue();
2840
- const value = consumeValue();
2841
- vnode_setAttr(null, vParent, key, value);
2842
- } else if (peek() === VNodeDataChar.CLOSE) {
2843
- consume(), vParent[ElementVNodeProps.lastChild] = vLast, idx = stack.pop(), previousTextNode = stack.pop(), vLast = stack.pop(), vFirst = stack.pop(), vParent = stack.pop();
2844
- } else if (peek() === VNodeDataChar.SLOT) {
2845
- vnode_setAttr(null, vParent, QSlot, consumeValue());
2846
- } else {
2847
- const textNode = child && 3 === fastNodeType(child) ? child : null;
2848
- null === combinedText && (combinedText = textNode ? textNode.nodeValue : null, textIdx = 0);
2849
- let length = 0;
2850
- for (; isLowercase(peek()); ) {
2851
- length += consume() - 97, length *= 26;
2852
- }
2853
- length += consume() - 65;
2854
- const text = null === combinedText ? "" : combinedText.substring(textIdx, textIdx + length);
2855
- addVNode(previousTextNode = vnode_newSharedText(previousTextNode, textNode, text)), textIdx += length;
2856
- }
2857
- }), vParent[ElementVNodeProps.lastChild] = vLast, vFirst;
2858
2372
  }
2859
- const vnode_getType = (vnode) => {
2860
- const type = vnode[VNodeProps.flags];
2861
- if (type & VNodeFlags.Element) {
2862
- return 1;
2863
- }
2864
- if (type & VNodeFlags.Virtual) {
2865
- return 11;
2866
- }
2867
- if (type & VNodeFlags.Text) {
2868
- return 3;
2373
+ const Virtual = (props) => props.children;
2374
+ const isJSXNode = (n) => n instanceof JSXNodeImpl;
2375
+ const Fragment = (props) => props.children;
2376
+ function createPropsProxy(varProps, constProps, children) {
2377
+ return new Proxy({}, new PropsProxyHandler(varProps, constProps, children));
2378
+ }
2379
+ class PropsProxyHandler {
2380
+ constructor($varProps$, $constProps$, $children$) {
2381
+ __publicField(this, "$varProps$");
2382
+ __publicField(this, "$constProps$");
2383
+ __publicField(this, "$children$");
2384
+ this.$varProps$ = $varProps$, this.$constProps$ = $constProps$, this.$children$ = $children$;
2869
2385
  }
2870
- throw qError(QError.invalidVNodeType, [type]);
2871
- };
2872
- const isElement = (node) => node && "object" == typeof node && 1 === fastNodeType(node);
2873
- const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
2874
- let projectionDepth = 1;
2875
- for (; projectionDepth--; ) {
2876
- for (; vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
2877
- const qSlotParent = vnode_getProp(vHost, "q:sparent", (id) => vnode_locate(rootVNode, id));
2878
- const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
2879
- vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
2386
+ get(_, prop) {
2387
+ if (prop === _CONST_PROPS) {
2388
+ return this.$constProps$;
2880
2389
  }
2881
- projectionDepth > 0 && (vHost = vnode_getParent(vHost));
2390
+ if (prop === _VAR_PROPS) {
2391
+ return this.$varProps$;
2392
+ }
2393
+ if (null != this.$children$ && "children" === prop) {
2394
+ return this.$children$;
2395
+ }
2396
+ const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
2397
+ return value instanceof WrappedSignal && 2 & value.$flags$ ? value.value : value;
2882
2398
  }
2883
- return vHost;
2884
- };
2885
- const VNodeArray = class VNode extends Array {
2886
- static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
2887
- return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName, []);
2399
+ set(_, prop, value) {
2400
+ return prop === _CONST_PROPS ? (this.$constProps$ = value, true) : prop === _VAR_PROPS ? (this.$varProps$ = value, true) : (this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] = value : this.$varProps$[prop] = value, true);
2888
2401
  }
2889
- static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
2890
- return new VNode(flags, parent, previousSibling, nextSibling, textNode, text);
2402
+ deleteProperty(_, prop) {
2403
+ if ("string" != typeof prop) {
2404
+ return false;
2405
+ }
2406
+ let didDelete = delete this.$varProps$[prop];
2407
+ return this.$constProps$ && (didDelete = delete this.$constProps$[prop] || didDelete), null != this.$children$ && "children" === prop && (this.$children$ = null), didDelete;
2891
2408
  }
2892
- static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
2893
- return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, []);
2409
+ has(_, prop) {
2410
+ return "children" === prop && null != this.$children$ || prop === _CONST_PROPS || prop === _VAR_PROPS || prop in this.$varProps$ || !!this.$constProps$ && prop in this.$constProps$;
2894
2411
  }
2895
- constructor(flags, parent, previousSibling, nextSibling, ...rest) {
2896
- super(flags, parent, previousSibling, nextSibling, ...rest);
2412
+ getOwnPropertyDescriptor(_, p) {
2413
+ return {
2414
+ configurable: true,
2415
+ enumerable: true,
2416
+ value: "children" === p && null != this.$children$ ? this.$children$ : this.$constProps$ && p in this.$constProps$ ? this.$constProps$[p] : this.$varProps$[p]
2417
+ };
2897
2418
  }
2898
- };
2899
- let _context;
2900
- const tryGetInvokeContext = () => {
2901
- if (!_context) {
2902
- const context = "undefined" != typeof document && document && document.__q_context__;
2903
- if (!context) {
2904
- return;
2419
+ ownKeys() {
2420
+ const out = Object.keys(this.$varProps$);
2421
+ if (null != this.$children$ && -1 === out.indexOf("children") && out.push("children"), this.$constProps$) {
2422
+ for (const key in this.$constProps$) {
2423
+ -1 === out.indexOf(key) && out.push(key);
2424
+ }
2905
2425
  }
2906
- return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
2426
+ return out;
2907
2427
  }
2908
- return _context;
2909
- };
2910
- function invoke(context, fn, ...args) {
2911
- return invokeApply.call(this, context, fn, args);
2912
2428
  }
2913
- function invokeApply(context, fn, args) {
2914
- const previousContext = _context;
2915
- let returnValue;
2916
- try {
2917
- _context = context, returnValue = fn.apply(this, args);
2918
- } finally {
2919
- _context = previousContext;
2429
+ const directGetPropsProxyProp = (jsx2, prop) => jsx2.constProps && prop in jsx2.constProps ? jsx2.constProps[prop] : jsx2.varProps[prop];
2430
+ const mergeMaps = (map1, map2) => {
2431
+ for (const [k, v] of map2) {
2432
+ map1.set(k, v);
2920
2433
  }
2921
- return returnValue;
2922
- }
2923
- const newInvokeContextFromTuple = ([element, event, url]) => {
2924
- const domContainer = getDomContainer(element);
2925
- const container = domContainer.element;
2926
- const vNode = container ? vnode_locate(domContainer.rootVNode, element) : void 0;
2927
- const locale = container?.getAttribute("q:locale") || void 0;
2928
- return newInvokeContext(locale, vNode, element, event, url);
2434
+ return map1;
2929
2435
  };
2930
- const newInvokeContext = (locale, hostElement, element, event, url) => {
2931
- const ctx = {
2932
- $url$: url,
2933
- $i$: 0,
2934
- $hostElement$: hostElement,
2935
- $element$: element,
2936
- $event$: event,
2937
- $qrl$: void 0,
2938
- $effectSubscriber$: void 0,
2939
- $locale$: locale || ("object" == typeof event && event && "locale" in event ? event.locale : void 0),
2940
- $container$: void 0
2941
- };
2942
- return ctx;
2436
+ const vnode_newElement = (element, elementName) => {
2437
+ assertEqual(fastNodeType(element));
2438
+ const vnode = VNodeArray.createElement(-247, null, null, null, null, null, element, elementName);
2439
+ return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), element.vNode = new WeakRef(vnode), vnode;
2943
2440
  };
2944
- const untrack = (fn) => invoke(void 0, fn);
2945
- const trackInvocation = /* @__PURE__ */ newInvokeContext(void 0, void 0, void 0, "qRender");
2946
- const trackSignal = (fn, subscriber, property, container, data) => {
2947
- const previousSubscriber = trackInvocation.$effectSubscriber$;
2948
- const previousContainer = trackInvocation.$container$;
2949
- try {
2950
- return trackInvocation.$effectSubscriber$ = getSubscriber(subscriber, property, data), trackInvocation.$container$ = container, invoke(trackInvocation, fn);
2951
- } finally {
2952
- trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
2441
+ const vnode_newUnMaterializedElement = (element) => {
2442
+ assertEqual(fastNodeType(element));
2443
+ const vnode = VNodeArray.createElement(-255, null, null, null, void 0, void 0, element, void 0);
2444
+ return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), element.vNode = new WeakRef(vnode), vnode;
2445
+ };
2446
+ const vnode_newSharedText = (previousTextNode, sharedTextNode, textContent) => {
2447
+ sharedTextNode && assertEqual(fastNodeType(sharedTextNode));
2448
+ const vnode = VNodeArray.createText(-252, null, previousTextNode, null, sharedTextNode, textContent);
2449
+ return assertFalse(vnode_isElementVNode(vnode)), assertTrue(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2450
+ };
2451
+ const vnode_newText = (textNode, textContent) => {
2452
+ const vnode = VNodeArray.createText(-244, null, null, null, textNode, textContent);
2453
+ return assertEqual(fastNodeType(textNode)), assertFalse(vnode_isElementVNode(vnode)), assertTrue(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2454
+ };
2455
+ const vnode_newVirtual = () => {
2456
+ const vnode = VNodeArray.createVirtual(-254, null, null, null, null, null);
2457
+ return assertFalse(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertTrue(vnode_isVirtualVNode(vnode)), vnode;
2458
+ };
2459
+ const vnode_isVNode = (vNode) => vNode instanceof VNodeArray;
2460
+ const vnode_isElementVNode = (vNode) => {
2461
+ return !(1 & ~vNode[0]);
2462
+ };
2463
+ const vnode_isElementOrTextVNode = (vNode) => {
2464
+ return !!(5 & vNode[0]);
2465
+ };
2466
+ const vnode_isTextVNode = (vNode) => {
2467
+ return !(4 & ~vNode[0]);
2468
+ };
2469
+ const vnode_isVirtualVNode = (vNode) => {
2470
+ return !(2 & ~vNode[0]);
2471
+ };
2472
+ const vnode_isProjection = (vNode) => {
2473
+ return !(2 & ~vNode[0]) && null !== vnode_getProp(vNode, QSlot, null);
2474
+ };
2475
+ const ensureTextVNode = (vNode) => (assertTrue(vnode_isTextVNode(vNode), "Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2476
+ const ensureElementOrVirtualVNode = (vNode) => {
2477
+ assertTrue(!!(3 & vNode[0]), "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode));
2478
+ };
2479
+ const ensureElementVNode = (vNode) => (assertTrue(vnode_isElementVNode(vNode), "Expecting ElementVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2480
+ const vnode_getNodeTypeName = (vNode) => {
2481
+ if (vNode) {
2482
+ switch (7 & vNode[0]) {
2483
+ case 1:
2484
+ return "Element";
2485
+ case 2:
2486
+ return "Virtual";
2487
+ case 4:
2488
+ return "Text";
2489
+ }
2953
2490
  }
2491
+ return "<unknown>";
2954
2492
  };
2955
- const trackSignalAndAssignHost = (value, host, property, container, data) => (value instanceof WrappedSignal && value.$hostElement$ !== host && host && (value.$hostElement$ = host), trackSignal(() => value.value, host, property, container, data));
2956
- const createContextId = (name) => /* @__PURE__ */ Object.freeze({
2957
- id: fromCamelToKebabCase(name)
2958
- });
2959
- const ERROR_CONTEXT = /* @__PURE__ */ createContextId("qk-error");
2960
- function processVNodeData(document2) {
2961
- const vNodeDataMap = document2.qVNodeData || (document2.qVNodeData = /* @__PURE__ */ new WeakMap());
2962
- const prototype = document2.body;
2963
- const getAttribute = prototype.getAttribute;
2964
- const hasAttribute = prototype.hasAttribute;
2965
- const getNodeType = ((prototype2, name) => {
2966
- let getter;
2967
- for (; prototype2 && !(getter = Object.getOwnPropertyDescriptor(prototype2, name)?.get); ) {
2968
- prototype2 = Object.getPrototypeOf(prototype2);
2493
+ const vnode_ensureElementInflated = (vnode) => {
2494
+ if (1 == (15 & vnode[0])) {
2495
+ const elementVNode = vnode;
2496
+ elementVNode[0] ^= 8;
2497
+ const element = elementVNode[6];
2498
+ const attributes = element.attributes;
2499
+ const props = vnode_getProps(elementVNode);
2500
+ for (let idx = 0; idx < attributes.length; idx++) {
2501
+ const attr = attributes[idx];
2502
+ const key = attr.name;
2503
+ if (":" === key || !key) {
2504
+ break;
2505
+ }
2506
+ if (key.startsWith("q:container")) {
2507
+ "html" === attr.value ? mapArray_set(props, dangerouslySetInnerHTML, element.innerHTML, 0) : "text" === attr.value && "value" in element && mapArray_set(props, "value", element.value, 0);
2508
+ } else if (!key.startsWith("on:")) {
2509
+ mapArray_set(props, key, attr.value, 0);
2510
+ }
2969
2511
  }
2970
- return getter || function() {
2971
- return this[name];
2972
- };
2973
- })(prototype, "nodeType");
2974
- const attachVnodeDataAndRefs = (element) => {
2975
- Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script) => {
2976
- script.setAttribute("type", "x-qwik/vnode");
2977
- const qContainerElement = script.closest("[q\\:container]");
2978
- qContainerElement.qVnodeData = script.textContent, qContainerElement.qVNodeRefs = /* @__PURE__ */ new Map();
2979
- }), element.querySelectorAll("[q\\:shadowroot]").forEach((parent) => {
2980
- const shadowRoot = parent.shadowRoot;
2981
- shadowRoot && attachVnodeDataAndRefs(shadowRoot);
2982
- });
2983
- };
2984
- let NodeType;
2985
- attachVnodeDataAndRefs(document2), function(NodeType2) {
2986
- NodeType2[NodeType2.CONTAINER_MASK = 1] = "CONTAINER_MASK", NodeType2[NodeType2.ELEMENT = 2] = "ELEMENT", NodeType2[NodeType2.ELEMENT_CONTAINER = 3] = "ELEMENT_CONTAINER", NodeType2[NodeType2.ELEMENT_SHADOW_ROOT = 6] = "ELEMENT_SHADOW_ROOT", NodeType2[NodeType2.COMMENT_SKIP_START = 5] = "COMMENT_SKIP_START", NodeType2[NodeType2.COMMENT_SKIP_END = 8] = "COMMENT_SKIP_END", NodeType2[NodeType2.COMMENT_IGNORE_START = 16] = "COMMENT_IGNORE_START", NodeType2[NodeType2.COMMENT_IGNORE_END = 32] = "COMMENT_IGNORE_END", NodeType2[NodeType2.COMMENT_ISLAND_START = 65] = "COMMENT_ISLAND_START", NodeType2[NodeType2.COMMENT_ISLAND_END = 128] = "COMMENT_ISLAND_END", NodeType2[NodeType2.OTHER = 0] = "OTHER";
2987
- }(NodeType || (NodeType = {}));
2988
- const getFastNodeType = (node) => {
2989
- const nodeType = getNodeType.call(node);
2990
- if (1 === nodeType) {
2991
- if (null === getAttribute.call(node, "q:container")) {
2992
- if (hasAttribute.call(node, "q:shadowroot")) {
2993
- return NodeType.ELEMENT_SHADOW_ROOT;
2512
+ }
2513
+ };
2514
+ function vnode_walkVNode(vNode) {
2515
+ let vCursor = vNode;
2516
+ if (vnode_isTextVNode(vNode)) {
2517
+ return;
2518
+ }
2519
+ let vParent = null;
2520
+ for (; ; ) {
2521
+ const vFirstChild = vnode_getFirstChild(vCursor);
2522
+ if (vFirstChild) {
2523
+ vCursor = vFirstChild;
2524
+ continue;
2525
+ }
2526
+ if (vCursor === vNode) {
2527
+ return;
2528
+ }
2529
+ const vNextSibling = vnode_getNextSibling(vCursor);
2530
+ if (vNextSibling) {
2531
+ vCursor = vNextSibling;
2532
+ } else {
2533
+ for (vParent = vnode_getParent(vCursor); vParent; ) {
2534
+ if (vParent === vNode) {
2535
+ return;
2536
+ }
2537
+ const vNextParentSibling = vnode_getNextSibling(vParent);
2538
+ if (vNextParentSibling) {
2539
+ vCursor = vNextParentSibling;
2540
+ break;
2994
2541
  }
2995
- return hasAttribute.call(node, ":") ? NodeType.ELEMENT : NodeType.OTHER;
2542
+ vParent = vnode_getParent(vParent);
2543
+ }
2544
+ if (null == vParent) {
2545
+ return;
2996
2546
  }
2997
- return NodeType.ELEMENT_CONTAINER;
2998
2547
  }
2999
- if (8 === nodeType) {
3000
- const nodeValue = node.nodeValue || "";
3001
- if (nodeValue.startsWith("q:container-island")) {
3002
- return NodeType.COMMENT_ISLAND_START;
2548
+ }
2549
+ }
2550
+ function vnode_getDOMChildNodes(journal, root, isVNode = false, childNodes = []) {
2551
+ if (vnode_isElementOrTextVNode(root)) {
2552
+ return vnode_isTextVNode(root) && vnode_ensureTextInflated(journal, root), childNodes.push(isVNode ? root : vnode_getNode(root)), childNodes;
2553
+ }
2554
+ let vNode = vnode_getFirstChild(root);
2555
+ for (; vNode; ) {
2556
+ vnode_isElementVNode(vNode) ? childNodes.push(isVNode ? vNode : vnode_getNode(vNode)) : vnode_isTextVNode(vNode) ? (vnode_ensureTextInflated(journal, vNode), childNodes.push(isVNode ? vNode : vnode_getNode(vNode))) : vnode_getDOMChildNodes(journal, vNode, !!isVNode, childNodes), vNode = vnode_getNextSibling(vNode);
2557
+ }
2558
+ return childNodes;
2559
+ }
2560
+ const vnode_getDomSibling = (vNode, nextDirection, descend) => {
2561
+ const childProp = nextDirection ? 4 : 5;
2562
+ const siblingProp = nextDirection ? 3 : 2;
2563
+ let cursor = vNode;
2564
+ for (; descend && cursor && vnode_isVirtualVNode(cursor); ) {
2565
+ const child = cursor[childProp];
2566
+ if (!child) {
2567
+ break;
2568
+ }
2569
+ if (5 & child[0]) {
2570
+ return child;
2571
+ }
2572
+ cursor = child;
2573
+ }
2574
+ for (; cursor; ) {
2575
+ let sibling = cursor[siblingProp];
2576
+ if (sibling && 5 & sibling[0]) {
2577
+ return sibling;
2578
+ }
2579
+ if (!sibling) {
2580
+ let virtual = cursor[1];
2581
+ if (virtual && !vnode_isVirtualVNode(virtual)) {
2582
+ return null;
3003
2583
  }
3004
- if (nodeValue.startsWith("q:ignore")) {
3005
- return NodeType.COMMENT_IGNORE_START;
2584
+ for (; virtual && !(sibling = virtual[siblingProp]); ) {
2585
+ if (virtual = virtual[1], virtual && !vnode_isVirtualVNode(virtual)) {
2586
+ return null;
2587
+ }
3006
2588
  }
3007
- if (nodeValue.startsWith("q:container")) {
3008
- return NodeType.COMMENT_SKIP_START;
2589
+ if (!sibling) {
2590
+ return null;
3009
2591
  }
3010
- if (nodeValue.startsWith("/q:container-island")) {
3011
- return NodeType.COMMENT_ISLAND_END;
2592
+ if (vnode_isTextVNode(sibling) && virtual && vnode_isElementVNode(virtual)) {
2593
+ return null;
3012
2594
  }
3013
- if (nodeValue.startsWith("/q:ignore")) {
3014
- return NodeType.COMMENT_IGNORE_END;
2595
+ }
2596
+ for (; sibling; ) {
2597
+ if (cursor = sibling, 5 & cursor[0] && vnode_getNode(cursor)) {
2598
+ return cursor;
3015
2599
  }
3016
- if (nodeValue.startsWith("/q:container")) {
3017
- return NodeType.COMMENT_SKIP_END;
2600
+ sibling = cursor[childProp];
2601
+ }
2602
+ }
2603
+ return null;
2604
+ };
2605
+ const vnode_ensureInflatedIfText = (journal, vNode) => {
2606
+ vnode_isTextVNode(vNode) && vnode_ensureTextInflated(journal, vNode);
2607
+ };
2608
+ const vnode_ensureTextInflated = (journal, vnode) => {
2609
+ const textVNode = ensureTextVNode(vnode);
2610
+ if (!(8 & textVNode[0])) {
2611
+ const parentNode = vnode_getDomParent(vnode);
2612
+ const sharedTextNode = textVNode[4];
2613
+ const doc = parentNode.ownerDocument;
2614
+ let cursor = vnode_getDomSibling(vnode, false, true);
2615
+ const insertBeforeNode = sharedTextNode || vnode_getDomSibling(vnode, true, true)?.[6] || null;
2616
+ let lastPreviousTextNode = insertBeforeNode;
2617
+ for (; cursor && vnode_isTextVNode(cursor); ) {
2618
+ if (!(8 & cursor[0])) {
2619
+ const textNode = doc.createTextNode(cursor[5]);
2620
+ journal.push(5, parentNode, lastPreviousTextNode, textNode), lastPreviousTextNode = textNode, cursor[4] = textNode, cursor[0] |= 8;
3018
2621
  }
2622
+ cursor = vnode_getDomSibling(cursor, false, true);
3019
2623
  }
3020
- return NodeType.OTHER;
3021
- };
3022
- const isSeparator = (ch) => VNodeDataSeparator.ADVANCE_1 <= ch && ch <= VNodeDataSeparator.ADVANCE_8192;
3023
- const findVDataSectionEnd = (vData, start, end) => {
3024
- let depth = 0;
3025
- for (; start < end; ) {
3026
- const ch = vData.charCodeAt(start);
3027
- if (0 === depth && isSeparator(ch)) {
3028
- break;
2624
+ for (cursor = vnode; cursor && vnode_isTextVNode(cursor); ) {
2625
+ const next = vnode_getDomSibling(cursor, true, true);
2626
+ const isLastNode = !next || !vnode_isTextVNode(next);
2627
+ if (!(8 & cursor[0])) {
2628
+ if (isLastNode && sharedTextNode) {
2629
+ journal.push(1, sharedTextNode, cursor[5]);
2630
+ } else {
2631
+ const textNode = doc.createTextNode(cursor[5]);
2632
+ journal.push(5, parentNode, insertBeforeNode, textNode), cursor[4] = textNode;
2633
+ }
2634
+ cursor[0] |= 8;
3029
2635
  }
3030
- ch === VNodeDataChar.OPEN ? depth++ : ch === VNodeDataChar.CLOSE && depth--, start++;
2636
+ cursor = next;
3031
2637
  }
3032
- return start;
3033
- };
3034
- const nextSibling = (node) => {
3035
- for (; node && (node = node.nextSibling) && getFastNodeType(node) === NodeType.OTHER; ) {
2638
+ }
2639
+ };
2640
+ const vnode_locate = (rootVNode, id) => {
2641
+ ensureElementVNode(rootVNode);
2642
+ let vNode = rootVNode;
2643
+ const containerElement = rootVNode[6];
2644
+ const { qVNodeRefs } = containerElement;
2645
+ let elementOffset = -1;
2646
+ let refElement;
2647
+ if ("string" == typeof id) {
2648
+ elementOffset = parseInt(id), refElement = qVNodeRefs.get(elementOffset);
2649
+ } else {
2650
+ refElement = id;
2651
+ const vNode2 = refElement.vNode?.deref();
2652
+ if (vNode2) {
2653
+ return vNode2;
3036
2654
  }
3037
- return node;
3038
- };
3039
- const firstChild = (node) => {
3040
- for (; node && (node = node.firstChild) && getFastNodeType(node) === NodeType.OTHER; ) {
2655
+ }
2656
+ if (vnode_isVNode(refElement)) {
2657
+ vNode = refElement;
2658
+ } else {
2659
+ assertTrue(containerElement.contains(refElement));
2660
+ let parent = refElement;
2661
+ const elementPath = [refElement];
2662
+ for (; parent && parent !== containerElement; ) {
2663
+ parent = parent.parentElement, elementPath.push(parent);
3041
2664
  }
3042
- return node;
3043
- };
3044
- const walkContainer = (walker2, containerNode, node, exitNode, vData, qVNodeRefs) => {
3045
- const vData_length = vData.length;
3046
- let elementIdx = 0;
3047
- let vNodeElementIndex = -1;
3048
- let vData_start = 0;
3049
- let vData_end = 0;
3050
- let ch = 0;
3051
- let needsToStoreRef = -1;
3052
- let nextNode = null;
3053
- const howManyElementsToSkip = () => {
3054
- let elementsToSkip = 0;
3055
- for (; isSeparator(ch = vData.charCodeAt(vData_start)) && (elementsToSkip += 1 << ch - VNodeDataSeparator.ADVANCE_1, vData_start++, !(vData_start >= vData_length)); ) {
3056
- }
3057
- return elementsToSkip;
3058
- };
3059
- do {
3060
- if (node === exitNode) {
3061
- return;
3062
- }
3063
- nextNode = null;
3064
- const nodeType = node == containerNode ? NodeType.ELEMENT : getFastNodeType(node);
3065
- if (nodeType === NodeType.ELEMENT_CONTAINER) {
3066
- const container = node;
3067
- let cursor = node;
3068
- for (; cursor && !(nextNode = nextSibling(cursor)); ) {
3069
- cursor = cursor.parentNode;
2665
+ for (let i = elementPath.length - 2; i >= 0; i--) {
2666
+ vNode = vnode_getVNodeForChildNode(vNode, elementPath[i]);
2667
+ }
2668
+ -1 != elementOffset && qVNodeRefs.set(elementOffset, vNode);
2669
+ }
2670
+ if ("string" == typeof id) {
2671
+ const idLength = id.length;
2672
+ let idx = indexOfAlphanumeric(id, idLength);
2673
+ let childIdx = 0;
2674
+ for (; idx < idLength; ) {
2675
+ const ch = id.charCodeAt(idx);
2676
+ childIdx *= 26, ch >= 97 ? childIdx += ch - 97 : (childIdx += ch - 65, vNode = vnode_getChildWithIdx(vNode, childIdx), childIdx = 0), idx++;
2677
+ }
2678
+ }
2679
+ return vNode;
2680
+ };
2681
+ const vnode_getChildWithIdx = (vNode, childIdx) => {
2682
+ let child = vnode_getFirstChild(vNode);
2683
+ for (assertDefined(); child[0] >>> 8 !== childIdx; ) {
2684
+ child = vnode_getNextSibling(child);
2685
+ }
2686
+ return child;
2687
+ };
2688
+ const vNodeStack = [];
2689
+ const vnode_getVNodeForChildNode = (vNode, childElement) => {
2690
+ ensureElementVNode(vNode);
2691
+ let child = vnode_getFirstChild(vNode);
2692
+ for (assertDefined(); child && child[6] !== childElement; ) {
2693
+ if (vnode_isVirtualVNode(child)) {
2694
+ const next = vnode_getNextSibling(child);
2695
+ const firstChild = vnode_getFirstChild(child);
2696
+ firstChild ? (next && vNodeStack.push(next), child = firstChild) : child = next || (vNodeStack.length ? vNodeStack.pop() : null);
2697
+ } else {
2698
+ const next = vnode_getNextSibling(child);
2699
+ child = next || (next || vNodeStack.pop());
2700
+ }
2701
+ }
2702
+ for (; vNodeStack.length; ) {
2703
+ vNodeStack.pop();
2704
+ }
2705
+ return ensureElementVNode(child), assertEqual(child[6]), child;
2706
+ };
2707
+ const indexOfAlphanumeric = (id, length) => {
2708
+ let idx = 0;
2709
+ for (; idx < length; ) {
2710
+ if (!(id.charCodeAt(idx) <= 57)) {
2711
+ return idx;
2712
+ }
2713
+ idx++;
2714
+ }
2715
+ return length;
2716
+ };
2717
+ const parseBoolean = (value) => "false" !== value && Boolean(value);
2718
+ const isBooleanAttr = (element, key) => ("allowfullscreen" == key || "async" == key || "autofocus" == key || "autoplay" == key || "checked" == key || "controls" == key || "default" == key || "defer" == key || "disabled" == key || "formnovalidate" == key || "inert" == key || "ismap" == key || "itemscope" == key || "loop" == key || "multiple" == key || "muted" == key || "nomodule" == key || "novalidate" == key || "open" == key || "playsinline" == key || "readonly" == key || "required" == key || "reversed" == key || "selected" == key) && key in element;
2719
+ const vnode_applyJournal = (journal) => {
2720
+ let idx = 0;
2721
+ const length = journal.length;
2722
+ for (; idx < length; ) {
2723
+ switch (journal[idx++]) {
2724
+ case 1:
2725
+ journal[idx++].nodeValue = journal[idx++];
2726
+ break;
2727
+ case 2:
2728
+ const element = journal[idx++];
2729
+ let key = journal[idx++];
2730
+ "className" === key && (key = "class");
2731
+ const value = journal[idx++];
2732
+ isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : key === dangerouslySetInnerHTML ? (element.innerHTML = value, element.setAttribute("q:container", "html")) : null == value || false === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
2733
+ break;
2734
+ case 3:
2735
+ const document2 = journal[idx++];
2736
+ const head = document2.head;
2737
+ const styles = document2.querySelectorAll(QStylesAllSelector);
2738
+ for (let i = 0; i < styles.length; i++) {
2739
+ head.appendChild(styles[i]);
3070
2740
  }
3071
- walkContainer(walker2, container, node, nextNode, container.qVnodeData || "", container.qVNodeRefs);
3072
- } else if (nodeType === NodeType.COMMENT_IGNORE_START) {
3073
- let islandNode = node;
3074
- do {
3075
- if (islandNode = walker2.nextNode(), !islandNode) {
3076
- throw new Error(`Island inside <!--${node?.nodeValue}--> not found!`);
3077
- }
3078
- } while (getFastNodeType(islandNode) !== NodeType.COMMENT_ISLAND_START);
3079
- nextNode = null;
3080
- } else if (nodeType === NodeType.COMMENT_ISLAND_END) {
3081
- nextNode = node;
3082
- do {
3083
- if (nextNode = walker2.nextNode(), !nextNode) {
3084
- throw new Error("Ignore block not closed!");
3085
- }
3086
- } while (getFastNodeType(nextNode) !== NodeType.COMMENT_IGNORE_END);
3087
- nextNode = null;
3088
- } else if (nodeType === NodeType.COMMENT_SKIP_START) {
3089
- nextNode = node;
3090
- do {
3091
- if (nextNode = nextSibling(nextNode), !nextNode) {
3092
- throw new Error(`<!--${node?.nodeValue}--> not closed!`);
3093
- }
3094
- } while (getFastNodeType(nextNode) !== NodeType.COMMENT_SKIP_END);
3095
- walkContainer(walker2, node, node, nextNode, "", null);
3096
- } else if (nodeType === NodeType.ELEMENT_SHADOW_ROOT) {
3097
- nextNode = nextSibling(node);
3098
- const shadowRootContainer = node;
3099
- const shadowRoot = shadowRootContainer?.shadowRoot;
3100
- shadowRoot && walkContainer(document2.createTreeWalker(shadowRoot, 129), null, firstChild(shadowRoot), null, "", null);
3101
- }
3102
- if ((nodeType & NodeType.ELEMENT) === NodeType.ELEMENT) {
3103
- if (vNodeElementIndex < elementIdx) {
3104
- if (-1 === vNodeElementIndex && (vNodeElementIndex = 0), vData_start = vData_end, vData_start < vData_length) {
3105
- vNodeElementIndex += howManyElementsToSkip();
3106
- ch === VNodeDataSeparator.REFERENCE && (needsToStoreRef = vNodeElementIndex, vData_start++, ch = vData_start < vData_length ? vData.charCodeAt(vData_end) : VNodeDataSeparator.ADVANCE_1), vData_end = findVDataSectionEnd(vData, vData_start, vData_length);
3107
- } else {
3108
- vNodeElementIndex = Number.MAX_SAFE_INTEGER;
3109
- }
2741
+ break;
2742
+ case 4:
2743
+ const removeParent = journal[idx++];
2744
+ let nodeToRemove;
2745
+ for (; idx < length && "number" != typeof (nodeToRemove = journal[idx]); ) {
2746
+ removeParent.removeChild(nodeToRemove), idx++;
3110
2747
  }
3111
- if (elementIdx === vNodeElementIndex) {
3112
- needsToStoreRef === elementIdx && qVNodeRefs.set(elementIdx, node);
3113
- const instructions = vData.substring(vData_start, vData_end);
3114
- vNodeDataMap.set(node, instructions);
2748
+ break;
2749
+ case 5:
2750
+ const insertParent = journal[idx++];
2751
+ const insertBefore = journal[idx++];
2752
+ let newChild;
2753
+ for (; idx < length && "number" != typeof (newChild = journal[idx]); ) {
2754
+ insertParent.insertBefore(newChild, insertBefore), idx++;
3115
2755
  }
3116
- elementIdx++;
2756
+ }
2757
+ }
2758
+ journal.length = 0;
2759
+ };
2760
+ const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
2761
+ ensureElementOrVirtualVNode(parent), vnode_isElementVNode(parent) && ensureMaterialized(parent);
2762
+ const newChildCurrentParent = newChild[1];
2763
+ if (newChild === insertBefore) {
2764
+ if (newChildCurrentParent) {
2765
+ return;
2766
+ }
2767
+ insertBefore = null;
2768
+ }
2769
+ newChildCurrentParent && (newChild[2] || newChild[3] || newChildCurrentParent !== parent) && vnode_remove(journal, newChildCurrentParent, newChild, false);
2770
+ let adjustedInsertBefore = null;
2771
+ null == insertBefore ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, true, false)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, true, true) : insertBefore, adjustedInsertBefore && vnode_ensureInflatedIfText(journal, adjustedInsertBefore);
2772
+ const domParentVNode = vnode_getDomParentVNode(parent);
2773
+ const parentNode = domParentVNode && domParentVNode[6];
2774
+ if (parentNode) {
2775
+ const domChildren = vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild);
2776
+ domChildren.length && journal.push(5, parentNode, vnode_getNode(adjustedInsertBefore), ...domChildren);
2777
+ }
2778
+ const vNext = insertBefore;
2779
+ const vPrevious = vNext ? vNext[2] : parent[5];
2780
+ vNext ? vNext[2] = newChild : parent[5] = newChild, vPrevious ? vPrevious[3] = newChild : parent[4] = newChild, newChild[2] = vPrevious, newChild[3] = vNext, newChild[1] = parent;
2781
+ };
2782
+ const vnode_getDomParent = (vnode) => (vnode = vnode_getDomParentVNode(vnode)) && vnode[6];
2783
+ const vnode_getDomParentVNode = (vnode) => {
2784
+ for (; vnode && !vnode_isElementVNode(vnode); ) {
2785
+ vnode = vnode[1];
2786
+ }
2787
+ return vnode;
2788
+ };
2789
+ const vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
2790
+ if (assertEqual(vParent, vnode_getParent(vToRemove)), vnode_isTextVNode(vToRemove) && vnode_ensureTextInflated(journal, vToRemove), removeDOM) {
2791
+ const domParent = vnode_getDomParent(vParent);
2792
+ if (vnode_getAttr(vParent, dangerouslySetInnerHTML)) {
2793
+ return;
2794
+ }
2795
+ const children = vnode_getDOMChildNodes(journal, vToRemove);
2796
+ domParent && children.length && journal.push(4, domParent, ...children);
2797
+ }
2798
+ const vPrevious = vToRemove[2];
2799
+ const vNext = vToRemove[3];
2800
+ vPrevious ? vPrevious[3] = vNext : vParent[4] = vNext, vNext ? vNext[2] = vPrevious : vParent[5] = vPrevious, vToRemove[2] = null, vToRemove[3] = null;
2801
+ };
2802
+ const vnode_truncate = (journal, vParent, vDelete) => {
2803
+ const parent = vnode_getDomParent(vParent);
2804
+ const children = vnode_getDOMChildNodes(journal, vDelete);
2805
+ parent && children.length && journal.push(4, parent, ...children);
2806
+ const vPrevious = vDelete[2];
2807
+ vPrevious ? vPrevious[3] = null : vParent[4] = null, vParent[5] = vPrevious;
2808
+ };
2809
+ const vnode_getElementName = (vnode) => {
2810
+ const elementVNode = ensureElementVNode(vnode);
2811
+ let elementName = elementVNode[7];
2812
+ if (void 0 === elementName) {
2813
+ const element = elementVNode[6];
2814
+ const nodeName = fastNodeName(element).toLowerCase();
2815
+ elementName = elementVNode[7] = nodeName, elementVNode[0] |= vnode_getElementNamespaceFlags(element);
2816
+ }
2817
+ return elementName;
2818
+ };
2819
+ const vnode_getText = (vnode) => {
2820
+ const textVNode = ensureTextVNode(vnode);
2821
+ let text = textVNode[5];
2822
+ return void 0 === text && (text = textVNode[5] = textVNode[4].nodeValue), text;
2823
+ };
2824
+ const vnode_setText = (journal, textVNode, text) => {
2825
+ vnode_ensureTextInflated(journal, textVNode);
2826
+ journal.push(1, textVNode[4], textVNode[5] = text);
2827
+ };
2828
+ const vnode_getFirstChild = (vnode) => {
2829
+ if (vnode_isTextVNode(vnode)) {
2830
+ return null;
2831
+ }
2832
+ let vFirstChild = vnode[4];
2833
+ return void 0 === vFirstChild && (vFirstChild = ensureMaterialized(vnode)), vFirstChild;
2834
+ };
2835
+ const vnode_materialize = (vNode) => {
2836
+ const element = vNode[6];
2837
+ const firstChild = fastFirstChild(element);
2838
+ const vNodeData = element.ownerDocument?.qVNodeData?.get(element);
2839
+ return materialize(vNode, element, firstChild, vNodeData);
2840
+ };
2841
+ const materialize = (vNode, element, firstChild, vNodeData) => {
2842
+ if (vNodeData) {
2843
+ if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
2844
+ const elementVNodeDataStartIdx = 1;
2845
+ let elementVNodeDataEndIdx = 1;
2846
+ for (; vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR; ) {
2847
+ elementVNodeDataEndIdx++;
3117
2848
  }
3118
- } while (node = nextNode || walker2.nextNode());
3119
- };
3120
- const walker = document2.createTreeWalker(document2, 129);
3121
- walkContainer(walker, null, walker.firstChild(), null, "", null);
3122
- }
3123
- function getDomContainer(element) {
3124
- const qContainerElement = _getQContainerElement(element);
3125
- if (!qContainerElement) {
3126
- throw qError(QError.containerNotFound);
2849
+ const elementVNodeData = vNodeData.substring(elementVNodeDataStartIdx, elementVNodeDataEndIdx);
2850
+ vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
2851
+ const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
2852
+ if (!vNodeData) {
2853
+ return vFirstChild;
2854
+ }
2855
+ }
2856
+ return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
3127
2857
  }
3128
- return getDomContainerFromQContainerElement(qContainerElement);
3129
- }
3130
- function getDomContainerFromQContainerElement(qContainerElement) {
3131
- const qElement = qContainerElement;
3132
- let container = qElement.qContainer;
3133
- if (!container) {
3134
- container = new DomContainer(qElement);
3135
- const containerAttributes = {};
3136
- if (qElement) {
3137
- const attrs = qElement.attributes;
3138
- if (attrs) {
3139
- for (let index = 0; index < attrs.length; index++) {
3140
- const attr = attrs[index];
3141
- ":" !== attr.name && (containerAttributes[attr.name] = attr.value);
2858
+ return materializeFromDOM(vNode, firstChild);
2859
+ };
2860
+ const ensureMaterialized = (vnode) => {
2861
+ const vParent = ensureElementVNode(vnode);
2862
+ let vFirstChild = vParent[4];
2863
+ if (void 0 === vFirstChild) {
2864
+ vFirstChild = vParent[1] && shouldIgnoreChildren(vParent[6]) ? vParent[4] = vParent[5] = null : vnode_materialize(vParent);
2865
+ }
2866
+ return assertTrue(void 0 !== vParent[4]), assertTrue(void 0 !== vParent[5]), vFirstChild;
2867
+ };
2868
+ let _fastHasAttribute = null;
2869
+ const shouldIgnoreChildren = (node) => (_fastHasAttribute || (_fastHasAttribute = node.hasAttribute), _fastHasAttribute.call(node, "q:container"));
2870
+ let _fastNodeType = null;
2871
+ const fastNodeType = (node) => (_fastNodeType || (_fastNodeType = fastGetter(node, "nodeType")), _fastNodeType.call(node));
2872
+ const fastIsTextOrElement = (node) => {
2873
+ const type = fastNodeType(node);
2874
+ return 3 === type || 1 === type;
2875
+ };
2876
+ let _fastNextSibling = null;
2877
+ const fastNextSibling = (node) => {
2878
+ for (_fastNextSibling || (_fastNextSibling = fastGetter(node, "nextSibling")), _fastFirstChild || (_fastFirstChild = fastGetter(node, "firstChild")); node; ) {
2879
+ if (null !== (node = _fastNextSibling.call(node))) {
2880
+ const type = fastNodeType(node);
2881
+ if (3 === type || 1 === type) {
2882
+ break;
2883
+ }
2884
+ if (8 === type) {
2885
+ const nodeValue = node.nodeValue;
2886
+ if (nodeValue?.startsWith(QIgnore)) {
2887
+ return getNodeAfterCommentNode(node, QContainerIsland, _fastNextSibling, _fastFirstChild);
2888
+ }
2889
+ if (node.nodeValue?.startsWith(QContainerIslandEnd)) {
2890
+ return getNodeAfterCommentNode(node, QIgnoreEnd, _fastNextSibling, _fastFirstChild);
2891
+ }
2892
+ if (nodeValue?.startsWith("q:container")) {
2893
+ for (; node && (node = _fastNextSibling.call(node)) && (8 !== fastNodeType(node) || !node.nodeValue?.startsWith("/q:container")); ) {
2894
+ }
3142
2895
  }
3143
2896
  }
3144
2897
  }
3145
- container.$serverData$ = {
3146
- containerAttributes
3147
- }, qElement.setAttribute("q:container", QContainerValue.RESUMED), qElement.qContainer = container;
3148
2898
  }
3149
- return container;
3150
- }
3151
- function _getQContainerElement(element) {
3152
- return (Array.isArray(element) ? vnode_getDomParent(element) : element).closest(QContainerSelector);
3153
- }
3154
- const isDomContainer = (container) => container instanceof DomContainer;
3155
- class DomContainer extends _SharedContainer {
3156
- constructor(element) {
3157
- super(() => this.scheduleRender(), () => vnode_applyJournal(this.$journal$), {}, element.getAttribute("q:locale"));
3158
- __publicField(this, "element");
3159
- __publicField(this, "qContainer");
3160
- __publicField(this, "qBase");
3161
- __publicField(this, "qManifestHash");
3162
- __publicField(this, "rootVNode");
3163
- __publicField(this, "document");
3164
- __publicField(this, "$journal$");
3165
- __publicField(this, "renderDone", null);
3166
- __publicField(this, "$rawStateData$");
3167
- __publicField(this, "$storeProxyMap$", /* @__PURE__ */ new WeakMap());
3168
- __publicField(this, "$qFuncs$");
3169
- __publicField(this, "$instanceHash$");
3170
- __publicField(this, "vNodeLocate", (id) => vnode_locate(this.rootVNode, id));
3171
- __publicField(this, "$stateData$");
3172
- __publicField(this, "$styleIds$", null);
3173
- __publicField(this, "$renderCount$", 0);
3174
- __publicField(this, "$getObjectById$", (id) => ("string" == typeof id && (id = parseFloat(id)), assertTrue(id < this.$rawStateData$.length / 2, `Invalid reference: ${id} >= ${this.$rawStateData$.length / 2}`), this.$stateData$[id]));
3175
- if (this.qContainer = element.getAttribute("q:container"), !this.qContainer) {
3176
- throw qError(QError.elementWithoutContainer);
3177
- }
3178
- this.$journal$ = [VNodeJournalOpCode.HoistStyles, element.ownerDocument], this.document = element.ownerDocument, this.element = element, this.qBase = element.getAttribute("q:base"), this.$instanceHash$ = element.getAttribute("q:instance"), this.qManifestHash = element.getAttribute("q:manifest-hash"), this.rootVNode = vnode_newUnMaterializedElement(this.element), this.$rawStateData$ = null, this.$stateData$ = null;
3179
- const document2 = this.element.ownerDocument;
3180
- document2.qVNodeData || processVNodeData(document2), this.$rawStateData$ = [], this.$stateData$ = [];
3181
- const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
3182
- if (0 !== qwikStates.length) {
3183
- this.$rawStateData$ = JSON.parse(qwikStates[qwikStates.length - 1].textContent), this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
2899
+ return node;
2900
+ };
2901
+ function getNodeAfterCommentNode(node, commentValue, nextSibling, firstChild) {
2902
+ for (; node; ) {
2903
+ if (node.nodeValue?.startsWith(commentValue)) {
2904
+ return node = nextSibling.call(node) || null;
3184
2905
  }
3185
- this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
2906
+ let nextNode = firstChild.call(node);
2907
+ nextNode || (nextNode = nextSibling.call(node)), nextNode || (nextNode = fastParentNode(node), nextNode && (nextNode = nextSibling.call(nextNode))), node = nextNode;
3186
2908
  }
3187
- $setRawState$(id, vParent) {
3188
- this.$stateData$[id] = vParent;
2909
+ return null;
2910
+ }
2911
+ let _fastParentNode = null;
2912
+ const fastParentNode = (node) => (_fastParentNode || (_fastParentNode = fastGetter(node, "parentNode")), _fastParentNode.call(node));
2913
+ let _fastFirstChild = null;
2914
+ const fastFirstChild = (node) => {
2915
+ for (_fastFirstChild || (_fastFirstChild = fastGetter(node, "firstChild")), node = node && _fastFirstChild.call(node); node && !fastIsTextOrElement(node); ) {
2916
+ node = fastNextSibling(node);
3189
2917
  }
3190
- parseQRL(qrl2) {
3191
- return inflateQRL(this, parseQRL(qrl2));
2918
+ return node;
2919
+ };
2920
+ let _fastNamespaceURI = null;
2921
+ const fastNamespaceURI = (element) => (_fastNamespaceURI || (_fastNamespaceURI = fastGetter(element, "namespaceURI")), _fastNamespaceURI.call(element));
2922
+ let _fastNodeName = null;
2923
+ const fastNodeName = (element) => (_fastNodeName || (_fastNodeName = fastGetter(element, "nodeName")), _fastNodeName.call(element));
2924
+ const fastGetter = (prototype, name) => {
2925
+ let getter;
2926
+ for (; prototype && !(getter = Object.getOwnPropertyDescriptor(prototype, name)?.get); ) {
2927
+ prototype = Object.getPrototypeOf(prototype);
3192
2928
  }
3193
- handleError(err, host) {
3194
- const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
3195
- if (!errorStore) {
3196
- throw err;
2929
+ return getter || function() {
2930
+ return this[name];
2931
+ };
2932
+ };
2933
+ const isQStyleElement = (node) => isElement(node) && "STYLE" === node.nodeName && (node.hasAttribute("q:sstyle") || node.hasAttribute(QStyle));
2934
+ const materializeFromDOM = (vParent, firstChild, vData) => {
2935
+ let vFirstChild = null;
2936
+ const skipStyleElements = () => {
2937
+ for (; isQStyleElement(child); ) {
2938
+ child = fastNextSibling(child);
3197
2939
  }
3198
- errorStore.error = err;
3199
- }
3200
- setContext(host, context, value) {
3201
- let ctx = this.getHostProp(host, "q:ctx");
3202
- ctx || this.setHostProp(host, "q:ctx", ctx = []), mapArray_set(ctx, context.id, value, 0);
2940
+ };
2941
+ let child = firstChild;
2942
+ skipStyleElements();
2943
+ let vChild = null;
2944
+ for (; child; ) {
2945
+ const nodeType = fastNodeType(child);
2946
+ let vNextChild = null;
2947
+ 3 === nodeType ? vNextChild = vnode_newText(child, child.textContent ?? void 0) : 1 === nodeType && (vNextChild = vnode_newUnMaterializedElement(child)), vNextChild && (vNextChild[1] = vParent, vChild && (vChild[3] = vNextChild), vNextChild[2] = vChild, vChild = vNextChild), vFirstChild || (vParent[4] = vFirstChild = vChild), child = fastNextSibling(child), skipStyleElements();
3203
2948
  }
3204
- resolveContext(host, contextId) {
3205
- for (; host; ) {
3206
- const ctx = this.getHostProp(host, "q:ctx");
3207
- if (ctx) {
3208
- const value = mapArray_get(ctx, contextId.id, 0);
3209
- if (value) {
3210
- return value;
3211
- }
2949
+ if (vParent[5] = vChild || null, vParent[4] = vFirstChild, vData) {
2950
+ let container = null;
2951
+ processVNodeData(vData, (peek, consumeValue) => {
2952
+ if (peek() === VNodeDataChar.ID) {
2953
+ container || (container = getDomContainer(vParent[6]));
2954
+ const id = consumeValue();
2955
+ container.$setRawState$(parseInt(id), vParent);
2956
+ } else {
2957
+ peek() === VNodeDataChar.BACK_REFS ? (container || (container = getDomContainer(vParent[6])), setEffectBackRefFromVNodeData(vParent, consumeValue(), container)) : consumeValue();
3212
2958
  }
3213
- host = this.getParentHost(host);
2959
+ });
2960
+ }
2961
+ return vFirstChild;
2962
+ };
2963
+ function setEffectBackRefFromVNodeData(vParent, value, container) {
2964
+ const deserializedSubMap = container.$getObjectById$(value);
2965
+ if (vParent[_EFFECT_BACK_REF]) {
2966
+ mergeMaps(vParent[_EFFECT_BACK_REF], deserializedSubMap);
2967
+ } else {
2968
+ Object.defineProperty(vParent, _EFFECT_BACK_REF, {
2969
+ value: deserializedSubMap
2970
+ });
2971
+ }
2972
+ }
2973
+ const processVNodeData = (vData, callback) => {
2974
+ let nextToConsumeIdx = 0;
2975
+ let ch = 0;
2976
+ let peekCh = 0;
2977
+ const peek = () => 0 !== peekCh ? peekCh : peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
2978
+ const consume = () => (ch = peek(), peekCh = 0, nextToConsumeIdx++, ch);
2979
+ const consumeValue = () => {
2980
+ consume();
2981
+ const start = nextToConsumeIdx;
2982
+ for (; peek() <= 58 && 0 !== peekCh || 95 === peekCh || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122; ) {
2983
+ consume();
3214
2984
  }
2985
+ return vData.substring(start, nextToConsumeIdx);
2986
+ };
2987
+ for (; 0 !== peek(); ) {
2988
+ callback(peek, consumeValue, consume, nextToConsumeIdx);
3215
2989
  }
3216
- getParentHost(host) {
3217
- let vNode = vnode_getParent(host);
3218
- for (; vNode; ) {
3219
- if (vnode_isVirtualVNode(vNode)) {
3220
- if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
3221
- return vNode;
3222
- }
3223
- vNode = vnode_getParent(vNode) || vnode_getProp(vNode, "q:sparent", this.vNodeLocate);
3224
- } else {
3225
- vNode = vnode_getParent(vNode);
2990
+ };
2991
+ const vnode_getNextSibling = (vnode) => vnode[3];
2992
+ const vnode_getPreviousSibling = (vnode) => vnode[2];
2993
+ const vnode_setAttr = (journal, vnode, key, value) => {
2994
+ const type = vnode[0];
2995
+ if (3 & type) {
2996
+ vnode_ensureElementInflated(vnode);
2997
+ const props = vnode_getProps(vnode);
2998
+ const idx = mapApp_findIndx(props, key, 0);
2999
+ if (idx >= 0) {
3000
+ if (props[idx + 1] != value && 1 & type) {
3001
+ journal && journal.push(2, vnode[6], key, value);
3226
3002
  }
3003
+ null == value ? props.splice(idx, 2) : props[idx + 1] = value;
3004
+ } else if (null != value && (props.splice(~idx, 0, key, value), 1 & type)) {
3005
+ journal && journal.push(2, vnode[6], key, value);
3227
3006
  }
3228
- return null;
3229
3007
  }
3230
- setHostProp(host, name, value) {
3231
- vnode_setProp(host, name, value);
3008
+ };
3009
+ const vnode_getAttr = (vnode, key) => {
3010
+ if (3 & vnode[0]) {
3011
+ vnode_ensureElementInflated(vnode);
3012
+ const props = vnode_getProps(vnode);
3013
+ return mapArray_get(props, key, 0);
3232
3014
  }
3233
- getHostProp(host, name) {
3234
- const vNode = host;
3235
- let getObjectById2 = null;
3236
- switch (name) {
3237
- case "q:seq":
3238
- case "q:props":
3239
- case "q:renderFn":
3240
- case "q:ctx":
3241
- case "q:brefs":
3242
- getObjectById2 = this.$getObjectById$;
3243
- break;
3244
- case "q:seqIdx":
3245
- case ":onIdx":
3246
- getObjectById2 = parseInt;
3015
+ return null;
3016
+ };
3017
+ const vnode_getProp = (vnode, key, getObject) => {
3018
+ const type = vnode[0];
3019
+ if (3 & type) {
3020
+ 1 & type && vnode_ensureElementInflated(vnode);
3021
+ const props = vnode_getProps(vnode);
3022
+ const idx = mapApp_findIndx(props, key, 0);
3023
+ if (idx >= 0) {
3024
+ let value = props[idx + 1];
3025
+ return "string" == typeof value && getObject && (props[idx + 1] = value = getObject(value)), value;
3247
3026
  }
3248
- return vnode_getProp(vNode, name, getObjectById2);
3249
3027
  }
3250
- scheduleRender() {
3251
- return this.$renderCount$++, this.renderDone || (this.renderDone = getPlatform().nextTick(() => this.processChores())), this.renderDone.finally(() => emitEvent("qrender", {
3252
- instanceHash: this.$instanceHash$,
3253
- renderCount: this.$renderCount$
3254
- }));
3028
+ return null;
3029
+ };
3030
+ const vnode_setProp = (vnode, key, value) => {
3031
+ ensureElementOrVirtualVNode(vnode);
3032
+ const props = vnode_getProps(vnode);
3033
+ const idx = mapApp_findIndx(props, key, 0);
3034
+ idx >= 0 ? props[idx + 1] = value : null != value && props.splice(~idx, 0, key, value);
3035
+ };
3036
+ const vnode_getPropStartIndex = (vnode) => {
3037
+ const type = 7 & vnode[0];
3038
+ if (1 === type) {
3039
+ return 8;
3255
3040
  }
3256
- processChores() {
3257
- let renderCount = this.$renderCount$;
3258
- const result = this.$scheduler$(ChoreType.WAIT_FOR_ALL);
3259
- if (isPromise(result)) {
3260
- return result.then(async () => {
3261
- for (; renderCount !== this.$renderCount$; ) {
3262
- renderCount = this.$renderCount$, await this.$scheduler$(ChoreType.WAIT_FOR_ALL);
3263
- }
3264
- this.renderDone = null;
3265
- });
3266
- }
3267
- renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
3041
+ if (2 === type) {
3042
+ return 6;
3268
3043
  }
3269
- ensureProjectionResolved(vNode) {
3270
- if (!(vNode[VNodeProps.flags] & VNodeFlags.Resolved)) {
3271
- vNode[VNodeProps.flags] |= VNodeFlags.Resolved;
3272
- const props = vnode_getProps(vNode);
3273
- for (let i = 0; i < props.length; i += 2) {
3274
- if (isSlotProp(props[i])) {
3275
- const value = props[i + 1];
3276
- "string" == typeof value && (props[i + 1] = this.vNodeLocate(value));
3044
+ throw qError(43, [type]);
3045
+ };
3046
+ const vnode_getProps = (vnode) => vnode[vnode_getPropStartIndex(vnode)];
3047
+ const vnode_getParent = (vnode) => vnode[1] || null;
3048
+ const vnode_getNode = (vnode) => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[6] : (assertTrue(vnode_isTextVNode(vnode)), vnode[4]);
3049
+ const isNumber = (ch) => 48 <= ch && ch <= 57;
3050
+ const isLowercase = (ch) => 97 <= ch && ch <= 122;
3051
+ const stack = [];
3052
+ function materializeFromVNodeData(vParent, vData, element, child) {
3053
+ let idx = 0;
3054
+ let vFirst = null;
3055
+ let vLast = null;
3056
+ let previousTextNode = null;
3057
+ const addVNode = (node) => {
3058
+ node[0] = 255 & node[0] | idx << 8, idx++, vLast && (vLast[3] = node), node[2] = vLast, node[1] = vParent, vFirst || (vParent[4] = vFirst = node), vLast = node;
3059
+ };
3060
+ let textIdx = 0;
3061
+ let combinedText = null;
3062
+ let container = null;
3063
+ return processVNodeData(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
3064
+ if (isNumber(peek())) {
3065
+ for (; !isElement(child); ) {
3066
+ if (!(child = fastNextSibling(child))) {
3067
+ throw qError(44, [vData, peek(), nextToConsumeIdx]);
3277
3068
  }
3278
3069
  }
3070
+ for (; isQStyleElement(child); ) {
3071
+ child = fastNextSibling(child);
3072
+ }
3073
+ combinedText = null, previousTextNode = null;
3074
+ let value = 0;
3075
+ for (; isNumber(peek()); ) {
3076
+ value *= 10, value += consume() - 48;
3077
+ }
3078
+ for (; value--; ) {
3079
+ addVNode(vnode_newUnMaterializedElement(child)), child = fastNextSibling(child);
3080
+ }
3081
+ } else if (peek() === VNodeDataChar.SCOPED_STYLE) {
3082
+ vnode_setAttr(null, vParent, "q:sstyle", consumeValue());
3083
+ } else if (peek() === VNodeDataChar.RENDER_FN) {
3084
+ vnode_setAttr(null, vParent, "q:renderFn", consumeValue());
3085
+ } else if (peek() === VNodeDataChar.ID) {
3086
+ container || (container = getDomContainer(element));
3087
+ const id = consumeValue();
3088
+ container.$setRawState$(parseInt(id), vParent);
3089
+ } else if (peek() === VNodeDataChar.PROPS) {
3090
+ vnode_setAttr(null, vParent, "q:props", consumeValue());
3091
+ } else if (peek() === VNodeDataChar.KEY) {
3092
+ vnode_setAttr(null, vParent, "q:key", consumeValue());
3093
+ } else if (peek() === VNodeDataChar.SEQ) {
3094
+ vnode_setAttr(null, vParent, "q:seq", consumeValue());
3095
+ } else if (peek() === VNodeDataChar.SEQ_IDX) {
3096
+ vnode_setAttr(null, vParent, "q:seqIdx", consumeValue());
3097
+ } else if (peek() === VNodeDataChar.BACK_REFS) {
3098
+ container || (container = getDomContainer(element)), setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
3099
+ } else if (peek() === VNodeDataChar.SLOT_PARENT) {
3100
+ vnode_setProp(vParent, "q:sparent", consumeValue());
3101
+ } else if (peek() === VNodeDataChar.CONTEXT) {
3102
+ vnode_setAttr(null, vParent, "q:ctx", consumeValue());
3103
+ } else if (peek() === VNodeDataChar.OPEN) {
3104
+ consume(), addVNode(vnode_newVirtual()), stack.push(vParent, vFirst, vLast, previousTextNode, idx), idx = 0, vParent = vLast, vFirst = vLast = null;
3105
+ } else if (peek() === VNodeDataChar.SEPARATOR) {
3106
+ const key = consumeValue();
3107
+ const value = consumeValue();
3108
+ vnode_setAttr(null, vParent, key, value);
3109
+ } else if (peek() === VNodeDataChar.CLOSE) {
3110
+ consume(), vParent[5] = vLast, idx = stack.pop(), previousTextNode = stack.pop(), vLast = stack.pop(), vFirst = stack.pop(), vParent = stack.pop();
3111
+ } else if (peek() === VNodeDataChar.SLOT) {
3112
+ vnode_setAttr(null, vParent, QSlot, consumeValue());
3113
+ } else {
3114
+ const textNode = child && 3 === fastNodeType(child) ? child : null;
3115
+ null === combinedText && (combinedText = textNode ? textNode.nodeValue : null, textIdx = 0);
3116
+ let length = 0;
3117
+ for (; isLowercase(peek()); ) {
3118
+ length += consume() - 97, length *= 26;
3119
+ }
3120
+ length += consume() - 65;
3121
+ const text = null === combinedText ? "" : combinedText.substring(textIdx, textIdx + length);
3122
+ addVNode(previousTextNode = vnode_newSharedText(previousTextNode, textNode, text)), textIdx += length;
3279
3123
  }
3124
+ }), vParent[5] = vLast, vFirst;
3125
+ }
3126
+ const vnode_getType = (vnode) => {
3127
+ const type = vnode[0];
3128
+ if (1 & type) {
3129
+ return 1;
3280
3130
  }
3281
- getSyncFn(id) {
3282
- const fn = this.$qFuncs$[id];
3283
- return fn;
3131
+ if (2 & type) {
3132
+ return 11;
3284
3133
  }
3285
- $appendStyle$(content, styleId, host, scoped) {
3286
- if (scoped) {
3287
- const scopedStyleIdsString = this.getHostProp(host, "q:sstyle");
3288
- const scopedStyleIds = new Set(convertScopedStyleIdsToArray(scopedStyleIdsString));
3289
- scopedStyleIds.add(styleId), this.setHostProp(host, "q:sstyle", convertStyleIdsToString(scopedStyleIds));
3290
- }
3291
- if (null == this.$styleIds$ && (this.$styleIds$ = /* @__PURE__ */ new Set(), this.element.querySelectorAll(QStyleSelector).forEach((style) => {
3292
- this.$styleIds$.add(style.getAttribute(QStyle));
3293
- })), !this.$styleIds$.has(styleId)) {
3294
- this.$styleIds$.add(styleId);
3295
- const styleElement = this.document.createElement("style");
3296
- styleElement.setAttribute(QStyle, styleId), styleElement.textContent = content, this.$journal$.push(VNodeJournalOpCode.Insert, this.document.head, null, styleElement);
3134
+ if (4 & type) {
3135
+ return 3;
3136
+ }
3137
+ throw qError(43, [type]);
3138
+ };
3139
+ const isElement = (node) => node && "object" == typeof node && 1 === fastNodeType(node);
3140
+ const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
3141
+ let projectionDepth = 1;
3142
+ for (; projectionDepth--; ) {
3143
+ for (; vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
3144
+ const qSlotParent = vnode_getProp(vHost, "q:sparent", (id) => vnode_locate(rootVNode, id));
3145
+ const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
3146
+ vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
3297
3147
  }
3148
+ projectionDepth > 0 && (vHost = vnode_getParent(vHost));
3298
3149
  }
3299
- }
3150
+ return vHost;
3151
+ };
3152
+ const VNodeArray = class VNode extends Array {
3153
+ static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
3154
+ return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName, []);
3155
+ }
3156
+ static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
3157
+ return new VNode(flags, parent, previousSibling, nextSibling, textNode, text);
3158
+ }
3159
+ static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
3160
+ return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, []);
3161
+ }
3162
+ constructor(flags, parent, previousSibling, nextSibling, ...rest) {
3163
+ super(flags, parent, previousSibling, nextSibling, ...rest);
3164
+ }
3165
+ };
3300
3166
  const deserializedProxyMap = /* @__PURE__ */ new WeakMap();
3301
3167
  const isDeserializerProxy = (value) => "object" == typeof value && null !== value && SERIALIZER_PROXY_UNWRAP in value;
3302
3168
  const SERIALIZER_PROXY_UNWRAP = Symbol("UNWRAP");
@@ -3334,7 +3200,7 @@ class DeserializationHandler {
3334
3200
  }
3335
3201
  const container = this.$container$;
3336
3202
  let propValue = allocate(container, typeId, value);
3337
- return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)), Reflect.set(target, property, propValue), this.$data$[idx] = void 0, this.$data$[idx + 1] = propValue, propValue;
3203
+ return typeId >= 12 && (propValue = inflate(container, propValue, typeId, value)), Reflect.set(target, property, propValue), this.$data$[idx] = void 0, this.$data$[idx + 1] = propValue, propValue;
3338
3204
  }
3339
3205
  has(target, property) {
3340
3206
  return property === SERIALIZER_PROXY_UNWRAP || Object.prototype.hasOwnProperty.call(target, property);
@@ -3364,13 +3230,13 @@ const inflate = (container, target, typeId, data) => {
3364
3230
  if (void 0 === typeId) {
3365
3231
  return target;
3366
3232
  }
3367
- switch (typeId !== TypeIds.Object && Array.isArray(data) && (data = _eagerDeserializeArray(container, data)), typeId) {
3368
- case TypeIds.Object:
3233
+ switch (13 !== typeId && Array.isArray(data) && (data = _eagerDeserializeArray(container, data)), typeId) {
3234
+ case 13:
3369
3235
  for (let i2 = 0; i2 < data.length; i2 += 4) {
3370
3236
  const key = deserializeData(container, data[i2], data[i2 + 1]);
3371
3237
  const valType = data[i2 + 2];
3372
3238
  const valData = data[i2 + 3];
3373
- valType === TypeIds.RootRef || valType >= TypeIds.Error ? Object.defineProperty(target, key, {
3239
+ 0 === valType || valType >= 12 ? Object.defineProperty(target, key, {
3374
3240
  get() {
3375
3241
  const value = deserializeData(container, valType, valData);
3376
3242
  return target[key] = value, value;
@@ -3388,54 +3254,56 @@ const inflate = (container, target, typeId, data) => {
3388
3254
  }) : target[key] = deserializeData(container, valType, valData);
3389
3255
  }
3390
3256
  break;
3391
- case TypeIds.QRL:
3257
+ case 18:
3392
3258
  inflateQRL(container, target);
3393
3259
  break;
3394
- case TypeIds.Task:
3260
+ case 19:
3395
3261
  const task = target;
3396
3262
  const v = data;
3397
3263
  task.$qrl$ = inflateQRL(container, v[0]), task.$flags$ = v[1], task.$index$ = v[2], task.$el$ = v[3], task[_EFFECT_BACK_REF] = v[4], task.$state$ = v[5];
3398
3264
  break;
3399
- case TypeIds.Resource:
3265
+ case 20:
3400
3266
  const [resolved, result, effects] = data;
3401
3267
  const resource = target;
3402
3268
  resolved ? (resource.value = Promise.resolve(result), resource._resolved = result, resource._state = "resolved") : (resource.value = Promise.reject(result), resource._error = result, resource._state = "rejected"), getStoreHandler(target).$effects$ = effects;
3403
3269
  break;
3404
- case TypeIds.Component:
3270
+ case 21:
3405
3271
  target[SERIALIZABLE_STATE][0] = data[0];
3406
3272
  break;
3407
- case TypeIds.Store:
3408
- case TypeIds.StoreArray: {
3273
+ case 26:
3274
+ case 27: {
3409
3275
  const [value, flags, effects2] = data;
3410
3276
  const store = getOrCreateStore(value, flags, container);
3411
3277
  getStoreHandler(store).$effects$ = effects2, target = store;
3412
3278
  break;
3413
3279
  }
3414
- case TypeIds.Signal: {
3280
+ case 22: {
3415
3281
  const signal = target;
3416
3282
  const d = data;
3417
3283
  signal.$untrackedValue$ = d[0], signal.$effects$ = new Set(d.slice(1));
3418
3284
  break;
3419
3285
  }
3420
- case TypeIds.WrappedSignal: {
3286
+ case 23: {
3421
3287
  const signal = target;
3422
3288
  const d = data;
3423
3289
  signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal[_EFFECT_BACK_REF] = d[2], signal.$untrackedValue$ = d[3], signal.$flags$ = d[4], signal.$hostElement$ = d[5], signal.$effects$ = new Set(d.slice(6));
3424
3290
  break;
3425
3291
  }
3426
- case TypeIds.ComputedSignal: {
3292
+ case 25:
3293
+ case 24: {
3427
3294
  const computed = target;
3428
3295
  const d = data;
3429
- computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$flags$ |= SignalFlags.INVALID, computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
3296
+ computed.$computeQrl$ = d[0], computed.$effects$ = new Set(d[1]);
3297
+ d.length > 2 ? (computed.$untrackedValue$ = d[2], 25 === typeId && (computed.$flags$ |= 1)) : (computed.$flags$ |= 1, computed.$computeQrl$.resolve(), container.$scheduler$?.(1, null, computed.$computeQrl$));
3430
3298
  break;
3431
3299
  }
3432
- case TypeIds.Error: {
3300
+ case 12: {
3433
3301
  const d = data;
3434
3302
  target.message = d[0];
3435
3303
  const second = d[1];
3436
3304
  if (second && Array.isArray(second)) {
3437
3305
  for (let i2 = 0; i2 < second.length; i2++) {
3438
- target[second[i2++]] = d[i2];
3306
+ target[second[i2++]] = second[i2];
3439
3307
  }
3440
3308
  target.stack = d[2];
3441
3309
  } else {
@@ -3443,7 +3311,7 @@ const inflate = (container, target, typeId, data) => {
3443
3311
  }
3444
3312
  break;
3445
3313
  }
3446
- case TypeIds.FormData: {
3314
+ case 28: {
3447
3315
  const formData = target;
3448
3316
  const d = data;
3449
3317
  for (let i2 = 0; i2 < d.length; i2++) {
@@ -3451,13 +3319,13 @@ const inflate = (container, target, typeId, data) => {
3451
3319
  }
3452
3320
  break;
3453
3321
  }
3454
- case TypeIds.JSXNode: {
3322
+ case 29: {
3455
3323
  const jsx2 = target;
3456
3324
  const [type, varProps, constProps, children, flags, key] = data;
3457
3325
  jsx2.type = type, jsx2.varProps = varProps, jsx2.constProps = constProps, jsx2.children = children, jsx2.flags = flags, jsx2.key = key;
3458
3326
  break;
3459
3327
  }
3460
- case TypeIds.Set: {
3328
+ case 15: {
3461
3329
  const set = target;
3462
3330
  const d = data;
3463
3331
  for (let i2 = 0; i2 < d.length; i2++) {
@@ -3465,7 +3333,7 @@ const inflate = (container, target, typeId, data) => {
3465
3333
  }
3466
3334
  break;
3467
3335
  }
3468
- case TypeIds.Map: {
3336
+ case 16: {
3469
3337
  const map = target;
3470
3338
  const d = data;
3471
3339
  for (let i2 = 0; i2 < d.length; i2++) {
@@ -3473,14 +3341,14 @@ const inflate = (container, target, typeId, data) => {
3473
3341
  }
3474
3342
  break;
3475
3343
  }
3476
- case TypeIds.Promise: {
3344
+ case 14: {
3477
3345
  const promise = target;
3478
3346
  const [resolved2, result2] = data;
3479
3347
  const [resolve, reject] = resolvers.get(promise);
3480
3348
  resolved2 ? resolve(result2) : reject(result2);
3481
3349
  break;
3482
3350
  }
3483
- case TypeIds.Uint8Array:
3351
+ case 17:
3484
3352
  const bytes = target;
3485
3353
  const buf = atob(data);
3486
3354
  let i = 0;
@@ -3488,17 +3356,17 @@ const inflate = (container, target, typeId, data) => {
3488
3356
  bytes[i++] = s.charCodeAt(0);
3489
3357
  }
3490
3358
  break;
3491
- case TypeIds.PropsProxy:
3359
+ case 30:
3492
3360
  const propsProxy = target;
3493
3361
  propsProxy[_VAR_PROPS] = 0 === data ? {} : data[0], propsProxy[_CONST_PROPS] = data[1];
3494
3362
  break;
3495
- case TypeIds.EffectData: {
3363
+ case 31: {
3496
3364
  const effectData = target;
3497
3365
  effectData.data.$scopedStyleIdPrefix$ = data[0], effectData.data.$isConst$ = data[1];
3498
3366
  break;
3499
3367
  }
3500
3368
  default:
3501
- throw qError(QError.serializeErrorNotImplemented, [typeId]);
3369
+ throw qError(33, [typeId]);
3502
3370
  }
3503
3371
  return target;
3504
3372
  };
@@ -3508,59 +3376,60 @@ const allocate = (container, typeId, value) => {
3508
3376
  return typeId;
3509
3377
  }
3510
3378
  switch (typeId) {
3511
- case TypeIds.RootRef:
3379
+ case 0:
3512
3380
  return container.$getObjectById$(value);
3513
- case TypeIds.Constant:
3381
+ case 1:
3514
3382
  return _constants[value];
3515
- case TypeIds.Number:
3383
+ case 2:
3384
+ case 3:
3516
3385
  return value;
3517
- case TypeIds.Array:
3386
+ case 4:
3518
3387
  return wrapDeserializerProxy(container, value);
3519
- case TypeIds.Object:
3388
+ case 13:
3520
3389
  return {};
3521
- case TypeIds.QRL:
3390
+ case 18:
3522
3391
  return parseQRL(container.$getObjectById$(value));
3523
- case TypeIds.Task:
3392
+ case 19:
3524
3393
  return new Task(-1, -1, null, null, null, null);
3525
- case TypeIds.Resource: {
3394
+ case 20: {
3526
3395
  const res = createResourceReturn(container, void 0, void 0);
3527
3396
  return res.loading = false, res;
3528
3397
  }
3529
- case TypeIds.URL:
3398
+ case 5:
3530
3399
  return new URL(value);
3531
- case TypeIds.Date:
3400
+ case 6:
3532
3401
  return new Date(value);
3533
- case TypeIds.Regex:
3402
+ case 7:
3534
3403
  const idx = value.lastIndexOf("/");
3535
3404
  return new RegExp(value.slice(1, idx), value.slice(idx + 1));
3536
- case TypeIds.Error:
3405
+ case 12:
3537
3406
  return new Error();
3538
- case TypeIds.Component:
3407
+ case 21:
3539
3408
  return componentQrl(null);
3540
- case TypeIds.Signal:
3541
- return new Signal(container, 0);
3542
- case TypeIds.WrappedSignal:
3409
+ case 22:
3410
+ return new SignalImpl(container, 0);
3411
+ case 23:
3543
3412
  return new WrappedSignal(container, null, null, null);
3544
- case TypeIds.ComputedSignal:
3545
- return new ComputedSignal(container, null);
3546
- case TypeIds.Store:
3547
- case TypeIds.StoreArray:
3413
+ case 24:
3414
+ return new ComputedSignalImpl(container, null);
3415
+ case 25:
3416
+ return new SerializerSignalImpl(container, null);
3417
+ case 26:
3418
+ case 27:
3548
3419
  return null;
3549
- case TypeIds.URLSearchParams:
3420
+ case 11:
3550
3421
  return new URLSearchParams(value);
3551
- case TypeIds.FormData:
3422
+ case 28:
3552
3423
  return new FormData();
3553
- case TypeIds.JSXNode:
3424
+ case 29:
3554
3425
  return new JSXNodeImpl(null, null, null, null, -1, null);
3555
- case TypeIds.BigInt:
3426
+ case 10:
3556
3427
  return BigInt(value);
3557
- case TypeIds.Set:
3428
+ case 15:
3558
3429
  return /* @__PURE__ */ new Set();
3559
- case TypeIds.Map:
3430
+ case 16:
3560
3431
  return /* @__PURE__ */ new Map();
3561
- case TypeIds.String:
3562
- return value;
3563
- case TypeIds.Promise:
3432
+ case 14:
3564
3433
  let resolve;
3565
3434
  let reject;
3566
3435
  const promise = new Promise((res, rej) => {
@@ -3568,24 +3437,24 @@ const allocate = (container, typeId, value) => {
3568
3437
  });
3569
3438
  return resolvers.set(promise, [resolve, reject]), promise.catch(() => {
3570
3439
  }), promise;
3571
- case TypeIds.Uint8Array:
3440
+ case 17:
3572
3441
  const encodedLength = value.length;
3573
3442
  const rest = 3 & encodedLength;
3574
3443
  return new Uint8Array(3 * (encodedLength >>> 2) + (rest ? rest - 1 : 0));
3575
- case TypeIds.PropsProxy:
3444
+ case 30:
3576
3445
  return createPropsProxy(null, null);
3577
- case TypeIds.VNode:
3446
+ case 8:
3578
3447
  return retrieveVNodeOrDocument(container, value);
3579
- case TypeIds.RefVNode:
3448
+ case 9:
3580
3449
  const vNode = retrieveVNodeOrDocument(container, value);
3581
3450
  if (vnode_isVNode(vNode)) {
3582
3451
  return vnode_getNode(vNode);
3583
3452
  }
3584
- throw qError(QError.serializeErrorExpectedVNode, [typeof vNode]);
3585
- case TypeIds.EffectData:
3453
+ throw qError(34, [typeof vNode]);
3454
+ case 31:
3586
3455
  return new SubscriptionData({});
3587
3456
  default:
3588
- throw qError(QError.serializeErrorCannotAllocate, [typeId]);
3457
+ throw qError(35, [typeId]);
3589
3458
  }
3590
3459
  };
3591
3460
  function retrieveVNodeOrDocument(container, value) {
@@ -3647,7 +3516,7 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3647
3516
  $getRootId$: (obj) => {
3648
3517
  const id = map.get(obj);
3649
3518
  if (!id || -1 === id) {
3650
- throw qError(QError.serializeErrorMissingRootId, [obj]);
3519
+ throw qError(36, [obj]);
3651
3520
  }
3652
3521
  return id;
3653
3522
  },
@@ -3698,9 +3567,12 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3698
3567
  obj.forEach((v, k) => {
3699
3568
  discoveredValues.push(k, v);
3700
3569
  });
3701
- } else if (obj instanceof Signal) {
3702
- const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$flags$ & SignalFlags.INVALID || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
3703
- v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(obj.$effects$), obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal && (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), discoveredValues.push(obj.$computeQrl$));
3570
+ } else if (obj instanceof SignalImpl) {
3571
+ const toSerialize = obj instanceof ComputedSignalImpl && !(obj instanceof SerializerSignalImpl) && (1 & obj.$flags$ || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
3572
+ toSerialize !== NEEDS_COMPUTATION && (obj instanceof SerializerSignalImpl ? promises.push(obj.$computeQrl$.resolve().then((arg) => {
3573
+ let data;
3574
+ arg.serialize ? data = arg.serialize(toSerialize) : SerializerSymbol in toSerialize && (data = toSerialize[SerializerSymbol](toSerialize)), void 0 === data && (data = NEEDS_COMPUTATION), serializationResults.set(obj, data), discoveredValues.push(data);
3575
+ })) : discoveredValues.push(toSerialize)), obj.$effects$ && discoveredValues.push(obj.$effects$), obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignalImpl && (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), discoveredValues.push(obj.$computeQrl$));
3704
3576
  } else if (obj instanceof Task) {
3705
3577
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$), discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
3706
3578
  } else if (isSsrNode2(obj)) {
@@ -3713,8 +3585,6 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3713
3585
  discoveredValues.push(obj.$ssrNode$.id);
3714
3586
  } else if (isJSXNode(obj)) {
3715
3587
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
3716
- } else if (Array.isArray(obj)) {
3717
- discoveredValues.push(...obj);
3718
3588
  } else if (isQrl$1(obj)) {
3719
3589
  obj.$captureRef$ && obj.$captureRef$.length && discoveredValues.push(...obj.$captureRef$);
3720
3590
  } else if (isPropsProxy(obj)) {
@@ -3727,9 +3597,14 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3727
3597
  }), promises.push(obj);
3728
3598
  } else if (obj instanceof SubscriptionData) {
3729
3599
  discoveredValues.push(obj.data);
3600
+ } else if (Array.isArray(obj)) {
3601
+ discoveredValues.push(...obj);
3602
+ } else if (isSerializerObj(obj)) {
3603
+ const result = obj[SerializerSymbol](obj);
3604
+ serializationResults.set(obj, result), discoveredValues.push(result);
3730
3605
  } else {
3731
3606
  if (!isObjectLiteral(obj)) {
3732
- throw qError(QError.serializeErrorUnknownType, [obj]);
3607
+ throw qError(37, [obj]);
3733
3608
  }
3734
3609
  Object.entries(obj).forEach(([key, value]) => {
3735
3610
  discoveredValues.push(key, value);
@@ -3776,6 +3651,7 @@ const discoverEffectBackRefs = (effectsBackRefs, discoveredValues) => {
3776
3651
  effectsBackRefs && discoveredValues.push(effectsBackRefs);
3777
3652
  };
3778
3653
  const promiseResults = /* @__PURE__ */ new WeakMap();
3654
+ const serializationResults = /* @__PURE__ */ new WeakMap();
3779
3655
  function serialize(serializationContext) {
3780
3656
  const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
3781
3657
  let depth = -1;
@@ -3802,46 +3678,46 @@ function serialize(serializationContext) {
3802
3678
  };
3803
3679
  const writeValue = (value, idx) => {
3804
3680
  if (fastSkipSerialize(value)) {
3805
- output(TypeIds.Constant, Constants.Undefined);
3681
+ output(1, 0);
3806
3682
  } else if ("bigint" == typeof value) {
3807
- output(TypeIds.BigInt, value.toString());
3683
+ output(10, value.toString());
3808
3684
  } else if ("boolean" == typeof value) {
3809
- output(TypeIds.Constant, value ? Constants.True : Constants.False);
3685
+ output(1, value ? 2 : 3);
3810
3686
  } else if ("function" == typeof value) {
3811
3687
  if (value === Slot) {
3812
- output(TypeIds.Constant, Constants.Slot);
3688
+ output(1, 9);
3813
3689
  } else if (value === Fragment) {
3814
- output(TypeIds.Constant, Constants.Fragment);
3690
+ output(1, 10);
3815
3691
  } else if (isQrl$1(value)) {
3816
3692
  const qrl2 = qrlToString(serializationContext, value);
3817
3693
  const id = serializationContext.$addRoot$(qrl2);
3818
- output(TypeIds.QRL, id);
3694
+ output(18, id);
3819
3695
  } else if (isQwikComponent(value)) {
3820
3696
  const [qrl2] = value[SERIALIZABLE_STATE];
3821
- serializationContext.$renderSymbols$.add(qrl2.$symbol$), output(TypeIds.Component, [qrl2]);
3697
+ serializationContext.$renderSymbols$.add(qrl2.$symbol$), output(21, [qrl2]);
3822
3698
  } else {
3823
- console.error("Cannot serialize function (ignoring for now): " + value.toString()), output(TypeIds.Constant, Constants.Undefined);
3699
+ console.error("Cannot serialize function (ignoring for now): " + value.toString()), output(1, 0);
3824
3700
  }
3825
3701
  } else if ("number" == typeof value) {
3826
- Number.isNaN(value) ? output(TypeIds.Constant, Constants.NaN) : Number.isFinite(value) ? value === Number.MAX_SAFE_INTEGER ? output(TypeIds.Constant, Constants.MaxSafeInt) : value === Number.MAX_SAFE_INTEGER - 1 ? output(TypeIds.Constant, Constants.AlmostMaxSafeInt) : value === Number.MIN_SAFE_INTEGER ? output(TypeIds.Constant, Constants.MinSafeInt) : output(TypeIds.Number, value) : output(TypeIds.Constant, value < 0 ? Constants.NegativeInfinity : Constants.PositiveInfinity);
3702
+ Number.isNaN(value) ? output(1, 11) : Number.isFinite(value) ? value === Number.MAX_SAFE_INTEGER ? output(1, 14) : value === Number.MAX_SAFE_INTEGER - 1 ? output(1, 15) : value === Number.MIN_SAFE_INTEGER ? output(1, 16) : output(2, value) : output(1, value < 0 ? 13 : 12);
3827
3703
  } else if ("object" == typeof value) {
3828
- value === EMPTY_ARRAY ? output(TypeIds.Constant, Constants.EMPTY_ARRAY) : value === EMPTY_OBJ ? output(TypeIds.Constant, Constants.EMPTY_OBJ) : (depth++, null === value ? output(TypeIds.Constant, Constants.Null) : writeObjectValue(value, idx), depth--);
3704
+ value === EMPTY_ARRAY ? output(1, 5) : value === EMPTY_OBJ ? output(1, 6) : null === value ? output(1, 1) : (depth++, writeObjectValue(value, idx), depth--);
3829
3705
  } else if ("string" == typeof value) {
3830
3706
  if (0 === value.length) {
3831
- output(TypeIds.Constant, Constants.EmptyString);
3707
+ output(1, 4);
3832
3708
  } else {
3833
3709
  const seen = depth > 1 && serializationContext.$wasSeen$(value);
3834
- "number" == typeof seen && seen >= 0 ? output(TypeIds.RootRef, seen) : output(TypeIds.String, value);
3710
+ "number" == typeof seen && seen >= 0 ? output(0, seen) : output(3, value);
3835
3711
  }
3836
3712
  } else if (void 0 === value) {
3837
- output(TypeIds.Constant, Constants.Undefined);
3713
+ output(1, 0);
3838
3714
  } else if (value === NEEDS_COMPUTATION) {
3839
- output(TypeIds.Constant, Constants.NEEDS_COMPUTATION);
3715
+ output(1, 7);
3840
3716
  } else {
3841
3717
  if (value !== STORE_ALL_PROPS) {
3842
- throw qError(QError.serializeErrorUnknownType, [typeof value]);
3718
+ throw qError(37, [typeof value]);
3843
3719
  }
3844
- output(TypeIds.Constant, Constants.STORE_ALL_PROPS);
3720
+ output(1, 8);
3845
3721
  }
3846
3722
  };
3847
3723
  const writeObjectValue = (value, idx) => {
@@ -3849,24 +3725,24 @@ function serialize(serializationContext) {
3849
3725
  if (depth > 2) {
3850
3726
  const seen = serializationContext.$wasSeen$(value);
3851
3727
  if ("number" == typeof seen && seen >= 0) {
3852
- return void output(TypeIds.RootRef, seen);
3728
+ return void output(0, seen);
3853
3729
  }
3854
3730
  }
3855
3731
  if (isPropsProxy(value)) {
3856
3732
  const varProps = value[_VAR_PROPS];
3857
3733
  const constProps = value[_CONST_PROPS];
3858
3734
  const out = constProps ? [varProps, constProps] : Object.keys(varProps).length ? [varProps] : 0;
3859
- output(TypeIds.PropsProxy, out);
3735
+ output(30, out);
3860
3736
  } else if (value instanceof SubscriptionData) {
3861
- output(TypeIds.EffectData, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
3737
+ output(31, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
3862
3738
  } else if (isStore(value)) {
3863
3739
  if (isResource(value)) {
3864
3740
  serializationContext.$resources$.add(value);
3865
3741
  const res = promiseResults.get(value.value);
3866
3742
  if (!res) {
3867
- throw qError(QError.serializeErrorUnvisited, ["resource"]);
3743
+ throw qError(38, ["resource"]);
3868
3744
  }
3869
- output(TypeIds.Resource, [...res, getStoreHandler(value).$effects$]);
3745
+ output(20, [...res, getStoreHandler(value).$effects$]);
3870
3746
  } else {
3871
3747
  const storeHandler = getStoreHandler(value);
3872
3748
  const storeTarget = getStoreTarget(value);
@@ -3884,93 +3760,104 @@ function serialize(serializationContext) {
3884
3760
  for (; null == out[out.length - 1]; ) {
3885
3761
  out.pop();
3886
3762
  }
3887
- output(Array.isArray(storeTarget) ? TypeIds.StoreArray : TypeIds.Store, out);
3763
+ output(Array.isArray(storeTarget) ? 27 : 26, out);
3764
+ }
3765
+ } else if (isSerializerObj(value)) {
3766
+ let result = serializationResults.get(value);
3767
+ if (isPromise(result)) {
3768
+ const promiseResult = promiseResults.get(result);
3769
+ if (!promiseResult[0]) {
3770
+ throw console.error(promiseResult[1]), qError(50);
3771
+ }
3772
+ result = promiseResult[1];
3888
3773
  }
3774
+ depth--, writeValue(result, idx), depth++;
3889
3775
  } else if (isObjectLiteral(value)) {
3890
3776
  if (Array.isArray(value)) {
3891
- output(TypeIds.Array, value);
3777
+ output(4, value);
3892
3778
  } else {
3893
3779
  const out = [];
3894
3780
  for (const key in value) {
3895
3781
  Object.prototype.hasOwnProperty.call(value, key) && !fastSkipSerialize(value[key]) && out.push(key, value[key]);
3896
3782
  }
3897
- output(TypeIds.Object, out);
3783
+ output(13, out);
3898
3784
  }
3899
3785
  } else if ($isDomRef$(value)) {
3900
- value.$ssrNode$.vnodeData[0] |= VNodeDataFlag.SERIALIZE, output(TypeIds.RefVNode, value.$ssrNode$.id);
3901
- } else if (value instanceof Signal) {
3902
- const v = value instanceof ComputedSignal && (value.$flags$ & SignalFlags.INVALID || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
3786
+ value.$ssrNode$.vnodeData[0] |= 16, output(9, value.$ssrNode$.id);
3787
+ } else if (value instanceof SignalImpl) {
3788
+ const isSerialized = value instanceof SerializerSignalImpl;
3789
+ const v = !isSerialized && value instanceof ComputedSignalImpl && (1 & value.$flags$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
3903
3790
  if (value instanceof WrappedSignal) {
3904
- output(TypeIds.WrappedSignal, [...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$flags$, value.$hostElement$, ...value.$effects$ || []]);
3905
- } else if (value instanceof ComputedSignal) {
3791
+ output(23, [...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$flags$, value.$hostElement$, ...value.$effects$ || []]);
3792
+ } else if (value instanceof ComputedSignalImpl) {
3906
3793
  const out = [value.$computeQrl$, value.$effects$];
3907
- v !== NEEDS_COMPUTATION && out.push(v), output(TypeIds.ComputedSignal, out);
3794
+ v !== NEEDS_COMPUTATION && out.push(isSerialized ? serializationResults.get(value) : v), output(isSerialized ? 25 : 24, out);
3908
3795
  } else {
3909
- output(TypeIds.Signal, [v, ...value.$effects$ || []]);
3796
+ output(22, [v, ...value.$effects$ || []]);
3910
3797
  }
3911
3798
  } else if (value instanceof URL) {
3912
- output(TypeIds.URL, value.href);
3799
+ output(5, value.href);
3913
3800
  } else if (value instanceof Date) {
3914
- output(TypeIds.Date, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
3801
+ output(6, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
3915
3802
  } else if (value instanceof RegExp) {
3916
- output(TypeIds.Regex, value.toString());
3803
+ output(7, value.toString());
3917
3804
  } else if (value instanceof Error) {
3918
3805
  const out = [value.message];
3919
3806
  const extraProps = Object.entries(value).flat();
3920
- extraProps.length && out.push(extraProps), out.push(value.stack), output(TypeIds.Error, out);
3807
+ extraProps.length && out.push(extraProps), out.push(value.stack), output(12, out);
3921
3808
  } else if ($isSsrNode$(value)) {
3922
3809
  if (isRootObject) {
3923
- $setProp$(value, "q:id", String(idx)), output(TypeIds.VNode, value.id);
3810
+ $setProp$(value, "q:id", String(idx)), output(8, value.id);
3924
3811
  const vNodeData = value.vnodeData;
3925
- if (vNodeData && (serializationContext.$prepVNodeData$?.(vNodeData), vNodeData[0] |= VNodeDataFlag.SERIALIZE), value.childrenVNodeData) {
3812
+ if (vNodeData && (serializationContext.$prepVNodeData$?.(vNodeData), vNodeData[0] |= 16), value.childrenVNodeData) {
3926
3813
  for (const vNodeData2 of value.childrenVNodeData) {
3927
- vNodeData2[0] |= VNodeDataFlag.SERIALIZE;
3814
+ vNodeData2[0] |= 16;
3928
3815
  }
3929
3816
  }
3930
3817
  } else {
3931
- serializationContext.$addRoot$(value), output(TypeIds.RootRef, serializationContext.$roots$.length - 1);
3818
+ serializationContext.$addRoot$(value), output(0, serializationContext.$roots$.length - 1);
3932
3819
  }
3933
3820
  } else if ("undefined" != typeof FormData && value instanceof FormData) {
3934
3821
  const array = [];
3935
3822
  value.forEach((value2, key) => {
3936
3823
  array.push(key, "string" == typeof value2 ? value2 : value2.name);
3937
- }), output(TypeIds.FormData, array);
3824
+ }), output(28, array);
3938
3825
  } else if (value instanceof URLSearchParams) {
3939
- output(TypeIds.URLSearchParams, value.toString());
3826
+ output(11, value.toString());
3940
3827
  } else if (value instanceof Set) {
3941
- output(TypeIds.Set, [...value.values()]);
3828
+ output(15, [...value.values()]);
3942
3829
  } else if (value instanceof Map) {
3943
3830
  const combined = [];
3944
3831
  for (const [k, v] of value.entries()) {
3945
3832
  combined.push(k, v);
3946
3833
  }
3947
- output(TypeIds.Map, combined);
3834
+ output(16, combined);
3948
3835
  } else if (isJSXNode(value)) {
3949
- output(TypeIds.JSXNode, [value.type, value.varProps, value.constProps, value.children, value.flags, value.key]);
3836
+ output(29, [value.type, value.varProps, value.constProps, value.children, value.flags, value.key]);
3950
3837
  } else if (value instanceof Task) {
3951
3838
  const out = [value.$qrl$, value.$flags$, value.$index$, value.$el$, value[_EFFECT_BACK_REF], value.$state$];
3952
3839
  for (; null == out[out.length - 1]; ) {
3953
3840
  out.pop();
3954
3841
  }
3955
- output(TypeIds.Task, out);
3842
+ output(19, out);
3956
3843
  } else if (isPromise(value)) {
3957
3844
  const res = promiseResults.get(value);
3958
3845
  if (!res) {
3959
- throw qError(QError.serializeErrorUnvisited, ["promise"]);
3846
+ throw qError(38, ["promise"]);
3960
3847
  }
3961
- output(TypeIds.Promise, res);
3848
+ output(14, res);
3962
3849
  } else if (value instanceof Uint8Array) {
3963
3850
  let buf = "";
3964
3851
  for (const c of value) {
3965
3852
  buf += String.fromCharCode(c);
3966
3853
  }
3967
3854
  const out = btoa(buf).replace(/=+$/, "");
3968
- output(TypeIds.Uint8Array, out);
3855
+ output(17, out);
3969
3856
  } else {
3970
3857
  if (!vnode_isVNode(value)) {
3971
- throw qError(QError.serializeErrorUnknownType, [typeof value]);
3858
+ throw qError(37, [typeof value]);
3972
3859
  }
3973
- output(TypeIds.Constant, Constants.Undefined);
3860
+ output(1, 0);
3974
3861
  }
3975
3862
  };
3976
3863
  writeValue(serializationContext.$roots$, -1);
@@ -3979,7 +3866,7 @@ function filterEffectBackRefs(effectBackRef) {
3979
3866
  let effectBackRefToSerialize = null;
3980
3867
  if (effectBackRef) {
3981
3868
  for (const [effectProp, effect] of effectBackRef) {
3982
- effect[EffectSubscriptionProp.BACK_REF] && (effectBackRefToSerialize || (effectBackRefToSerialize = /* @__PURE__ */ new Map()), effectBackRefToSerialize.set(effectProp, effect));
3869
+ effect[2] && (effectBackRefToSerialize || (effectBackRefToSerialize = /* @__PURE__ */ new Map()), effectBackRefToSerialize.set(effectProp, effect));
3983
3870
  }
3984
3871
  }
3985
3872
  return effectBackRefToSerialize;
@@ -4005,7 +3892,7 @@ function qrlToString(serializationContext, value) {
4005
3892
  backChannel || (backChannel = globalThis[QRL_RUNTIME_CHUNK] = /* @__PURE__ */ new Map()), backChannel.set(value.$symbol$, value._devOnlySymbolRef), chunk || (chunk = QRL_RUNTIME_CHUNK);
4006
3893
  }
4007
3894
  if (!chunk) {
4008
- throw qError(QError.qrlMissingChunk, [value.$symbol$]);
3895
+ throw qError(31, [value.$symbol$]);
4009
3896
  }
4010
3897
  chunk.startsWith("./") && (chunk = chunk.slice(2));
4011
3898
  }
@@ -4026,7 +3913,7 @@ function deserializeData(container, typeId, value) {
4026
3913
  return value;
4027
3914
  }
4028
3915
  let propValue = allocate(container, typeId, value);
4029
- return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)), propValue;
3916
+ return typeId >= 12 && (propValue = inflate(container, propValue, typeId, value)), propValue;
4030
3917
  }
4031
3918
  function shouldTrackObj(obj) {
4032
3919
  return "object" == typeof obj && null !== obj || "string" == typeof obj && obj.length > 1;
@@ -4038,18 +3925,13 @@ function isObjectLiteral(obj) {
4038
3925
  function isResource(value) {
4039
3926
  return "__brand" in value && "resource" === value.__brand;
4040
3927
  }
4041
- const frameworkType = (obj) => "object" == typeof obj && null !== obj && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl$1(obj);
3928
+ const frameworkType = (obj) => "object" == typeof obj && null !== obj && (obj instanceof SignalImpl || obj instanceof Task || isJSXNode(obj)) || isQrl$1(obj);
4042
3929
  const QRL_RUNTIME_CHUNK = "mock-chunk";
4043
- var TypeIds;
4044
- var Constants;
4045
- !function(TypeIds2) {
4046
- TypeIds2[TypeIds2.RootRef = 0] = "RootRef", TypeIds2[TypeIds2.Constant = 1] = "Constant", TypeIds2[TypeIds2.Number = 2] = "Number", TypeIds2[TypeIds2.String = 3] = "String", TypeIds2[TypeIds2.Array = 4] = "Array", TypeIds2[TypeIds2.URL = 5] = "URL", TypeIds2[TypeIds2.Date = 6] = "Date", TypeIds2[TypeIds2.Regex = 7] = "Regex", TypeIds2[TypeIds2.VNode = 8] = "VNode", TypeIds2[TypeIds2.RefVNode = 9] = "RefVNode", TypeIds2[TypeIds2.BigInt = 10] = "BigInt", TypeIds2[TypeIds2.URLSearchParams = 11] = "URLSearchParams", TypeIds2[TypeIds2.Error = 12] = "Error", TypeIds2[TypeIds2.Object = 13] = "Object", TypeIds2[TypeIds2.Promise = 14] = "Promise", TypeIds2[TypeIds2.Set = 15] = "Set", TypeIds2[TypeIds2.Map = 16] = "Map", TypeIds2[TypeIds2.Uint8Array = 17] = "Uint8Array", TypeIds2[TypeIds2.QRL = 18] = "QRL", TypeIds2[TypeIds2.Task = 19] = "Task", TypeIds2[TypeIds2.Resource = 20] = "Resource", TypeIds2[TypeIds2.Component = 21] = "Component", TypeIds2[TypeIds2.Signal = 22] = "Signal", TypeIds2[TypeIds2.WrappedSignal = 23] = "WrappedSignal", TypeIds2[TypeIds2.ComputedSignal = 24] = "ComputedSignal", TypeIds2[TypeIds2.Store = 25] = "Store", TypeIds2[TypeIds2.StoreArray = 26] = "StoreArray", TypeIds2[TypeIds2.FormData = 27] = "FormData", TypeIds2[TypeIds2.JSXNode = 28] = "JSXNode", TypeIds2[TypeIds2.PropsProxy = 29] = "PropsProxy", TypeIds2[TypeIds2.EffectData = 30] = "EffectData";
4047
- }(TypeIds || (TypeIds = {})), function(Constants2) {
4048
- Constants2[Constants2.Undefined = 0] = "Undefined", Constants2[Constants2.Null = 1] = "Null", Constants2[Constants2.True = 2] = "True", Constants2[Constants2.False = 3] = "False", Constants2[Constants2.EmptyString = 4] = "EmptyString", Constants2[Constants2.EMPTY_ARRAY = 5] = "EMPTY_ARRAY", Constants2[Constants2.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants2[Constants2.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION", Constants2[Constants2.STORE_ALL_PROPS = 8] = "STORE_ALL_PROPS", Constants2[Constants2.Slot = 9] = "Slot", Constants2[Constants2.Fragment = 10] = "Fragment", Constants2[Constants2.NaN = 11] = "NaN", Constants2[Constants2.PositiveInfinity = 12] = "PositiveInfinity", Constants2[Constants2.NegativeInfinity = 13] = "NegativeInfinity", Constants2[Constants2.MaxSafeInt = 14] = "MaxSafeInt", Constants2[Constants2.AlmostMaxSafeInt = 15] = "AlmostMaxSafeInt", Constants2[Constants2.MinSafeInt = 16] = "MinSafeInt";
4049
- }(Constants || (Constants = {}));
4050
3930
  const noSerializeSet = /* @__PURE__ */ new WeakSet();
4051
- const fastSkipSerialize = (obj) => noSerializeSet.has(obj);
3931
+ const fastSkipSerialize = (obj) => "object" == typeof obj && obj && (NoSerializeSymbol in obj || noSerializeSet.has(obj));
4052
3932
  const noSerialize = (input) => (null != input && noSerializeSet.add(input), input);
3933
+ const NoSerializeSymbol = Symbol("noSerialize");
3934
+ const SerializerSymbol = Symbol("serialize");
4053
3935
  const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
4054
3936
  let _containerEl;
4055
3937
  const qrl2 = async function(...args) {
@@ -4062,7 +3944,7 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
4062
3944
  if (!qrl2.resolved) {
4063
3945
  return qrl2.resolve().then((fn) => {
4064
3946
  if (!isFunction(fn)) {
4065
- throw qError(QError.qrlIsNotFunction);
3947
+ throw qError(10);
4066
3948
  }
4067
3949
  return bound(...args);
4068
3950
  });