@qwik.dev/core 2.0.0-beta.4 → 2.0.0-beta.40

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 (151) hide show
  1. package/dist/backpatch/index.d.ts +2 -0
  2. package/dist/backpatch/index.mjs +5 -0
  3. package/dist/backpatch/package.json +8 -0
  4. package/dist/backpatch-executor.debug.js +59 -0
  5. package/dist/backpatch-executor.js +1 -0
  6. package/dist/build/package.json +1 -1
  7. package/dist/cli.mjs +12974 -0
  8. package/dist/core-internal.d.ts +1615 -810
  9. package/dist/core.min.mjs +9 -1
  10. package/dist/core.mjs +14792 -9192
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/core.prod.mjs +10482 -5382
  13. package/dist/insights/index.qwik.mjs +82 -71
  14. package/dist/insights/vite/index.mjs +79 -81
  15. package/dist/loader/index.mjs +2 -2
  16. package/dist/loader/package.json +1 -1
  17. package/dist/optimizer.d.ts +77 -288
  18. package/dist/optimizer.mjs +2966 -4088
  19. package/dist/out-of-order-executor.debug.js +140 -0
  20. package/dist/out-of-order-executor.js +1 -0
  21. package/dist/preloader.mjs +172 -192
  22. package/dist/qwikloader.debug.js +403 -244
  23. package/dist/qwikloader.js +1 -1
  24. package/dist/server-modules.d.ts +1 -0
  25. package/dist/server.d.ts +54 -249
  26. package/dist/server.mjs +2332 -1407
  27. package/dist/server.prod.mjs +3844 -0
  28. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +3 -3
  29. package/dist/starters/adapters/aws-lambda/package.json +3 -2
  30. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -6
  31. package/dist/starters/adapters/azure-swa/adapters/azure-swa/{vite.config.mts → vite.config.ts} +3 -3
  32. package/dist/starters/adapters/azure-swa/package.json +3 -2
  33. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -3
  34. package/dist/starters/adapters/bun/adapters/bun/{vite.config.mts → vite.config.ts} +4 -4
  35. package/dist/starters/adapters/bun/package.json +3 -2
  36. package/dist/starters/adapters/bun/src/entry.bun.ts +37 -10
  37. package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +3 -3
  38. package/dist/starters/adapters/cloud-run/package.json +3 -2
  39. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +23 -7
  40. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +3 -3
  41. package/dist/starters/adapters/cloudflare-pages/package.json +3 -2
  42. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -3
  43. package/dist/starters/adapters/cloudflare-workers/README.md +52 -0
  44. package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +15 -0
  45. package/dist/starters/adapters/cloudflare-workers/gitignore +3 -0
  46. package/dist/starters/adapters/cloudflare-workers/package.json +31 -0
  47. package/dist/starters/adapters/cloudflare-workers/public/.assetsignore +4 -0
  48. package/dist/starters/adapters/cloudflare-workers/public/_headers +11 -0
  49. package/dist/starters/adapters/cloudflare-workers/public/_redirects +1 -0
  50. package/dist/starters/adapters/cloudflare-workers/src/entry.cloudflare-pages.tsx +23 -0
  51. package/dist/starters/adapters/cloudflare-workers/worker-configuration.d.ts +5 -0
  52. package/dist/starters/adapters/cloudflare-workers/wrangler.jsonc +41 -0
  53. package/dist/starters/adapters/deno/adapters/deno/{vite.config.mts → vite.config.ts} +3 -3
  54. package/dist/starters/adapters/deno/package.json +3 -2
  55. package/dist/starters/adapters/deno/src/entry.deno.ts +43 -10
  56. package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +3 -3
  57. package/dist/starters/adapters/express/package.json +4 -3
  58. package/dist/starters/adapters/express/src/entry.express.tsx +22 -7
  59. package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +3 -3
  60. package/dist/starters/adapters/fastify/package.json +5 -4
  61. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +21 -1
  62. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +11 -4
  63. package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +3 -3
  64. package/dist/starters/adapters/firebase/package.json +3 -2
  65. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
  66. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/{vite.config.mts → vite.config.ts} +3 -3
  67. package/dist/starters/adapters/netlify-edge/package.json +5 -4
  68. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -3
  69. package/dist/starters/adapters/node-server/adapters/node-server/{vite.config.mts → vite.config.ts} +3 -3
  70. package/dist/starters/adapters/node-server/package.json +3 -2
  71. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +22 -6
  72. package/dist/starters/adapters/{static/adapters/static/vite.config.mts → ssg/adapters/ssg/vite.config.ts} +4 -4
  73. package/dist/starters/adapters/ssg/package.json +20 -0
  74. package/dist/starters/adapters/vercel-edge/README.md +2 -2
  75. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/{vite.config.mts → vite.config.ts} +3 -3
  76. package/dist/starters/adapters/vercel-edge/package.json +3 -2
  77. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -3
  78. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  79. package/dist/starters/features/auth/package.json +1 -1
  80. package/dist/starters/features/compiled-i18n/package.json +37 -0
  81. package/dist/starters/features/compiled-i18n/src/components/locale-selector/locale-selector.tsx +30 -0
  82. package/dist/starters/features/compiled-i18n/src/entry.ssr.tsx +31 -0
  83. package/dist/starters/features/compiled-i18n/src/routes/plugin@compiled-i18n.ts +28 -0
  84. package/dist/starters/features/csr/index.html +27 -0
  85. package/dist/starters/features/csr/package.json +29 -0
  86. package/dist/starters/features/csr/src/root.tsx +15 -0
  87. package/dist/starters/features/csr/vite.config.ts +13 -0
  88. package/dist/starters/features/cypress/src/actions/example.action.ts +5 -0
  89. package/dist/starters/features/cypress/src/components/example/example.cy.tsx +50 -8
  90. package/dist/starters/features/cypress/src/components/example/example.tsx +13 -3
  91. package/dist/starters/features/cypress/src/loaders/example.loader.ts +5 -0
  92. package/dist/starters/features/drizzle/package.json +1 -1
  93. package/dist/starters/features/pandacss/package.json +1 -1
  94. package/dist/starters/features/postcss/postcss.config.js +1 -1
  95. package/dist/starters/features/storybook/.storybook/tsconfig.json +0 -1
  96. package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
  97. package/dist/starters/features/tailwind/package.json +2 -2
  98. package/dist/starters/features/tailwind/prettier.config.js +10 -0
  99. package/dist/starters/features/tailwind-v3/package.json +1 -1
  100. package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
  101. package/dist/starters/features/vitest/package.json +1 -1
  102. package/dist/testing/index.d.ts +1000 -7
  103. package/dist/testing/index.mjs +16487 -11656
  104. package/dist/testing/package.json +1 -1
  105. package/dist/worker/index.d.mts +21 -0
  106. package/dist/worker/index.mjs +251 -0
  107. package/dist/worker/package.json +9 -0
  108. package/dist/worker/worker.js +13 -0
  109. package/dist/worker/worker.node.js +15 -0
  110. package/dist/worker/worker.shared.js +63 -0
  111. package/handlers.mjs +21 -1
  112. package/package.json +40 -56
  113. package/public.d.ts +14 -2
  114. package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
  115. package/server.d.ts +2 -0
  116. package/worker.d.ts +2 -0
  117. package/bindings/qwik.darwin-arm64.node +0 -0
  118. package/bindings/qwik.darwin-x64.node +0 -0
  119. package/bindings/qwik.linux-x64-gnu.node +0 -0
  120. package/bindings/qwik.wasm.cjs +0 -471
  121. package/bindings/qwik.wasm.mjs +0 -464
  122. package/bindings/qwik.win32-x64-msvc.node +0 -0
  123. package/bindings/qwik_wasm_bg.wasm +0 -0
  124. package/dist/build/index.cjs +0 -35
  125. package/dist/build/index.cjs.map +0 -7
  126. package/dist/build/index.dev.cjs +0 -37
  127. package/dist/build/index.dev.cjs.map +0 -7
  128. package/dist/build/index.prod.cjs +0 -37
  129. package/dist/build/index.prod.cjs.map +0 -7
  130. package/dist/cli.cjs +0 -5545
  131. package/dist/core.cjs +0 -11870
  132. package/dist/core.cjs.map +0 -1
  133. package/dist/core.prod.cjs +0 -5723
  134. package/dist/insights/index.qwik.cjs +0 -1
  135. package/dist/insights/vite/index.cjs +0 -1
  136. package/dist/loader/index.cjs +0 -4
  137. package/dist/optimizer.cjs +0 -4020
  138. package/dist/preloader.cjs +0 -269
  139. package/dist/server.cjs +0 -3040
  140. package/dist/starters/adapters/static/package.json +0 -19
  141. package/dist/starters/features/localize/package.json +0 -37
  142. package/dist/starters/features/localize/src/entry.ssr.tsx +0 -30
  143. package/dist/starters/features/localize/src/locales/message.en.json +0 -8
  144. package/dist/starters/features/localize/src/locales/message.it.json +0 -8
  145. package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +0 -94
  146. package/dist/starters/features/localize/src/routes/[locale]/index.tsx +0 -52
  147. package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +0 -12
  148. package/dist/starters/features/playwright/playwright-report/index.html +0 -22026
  149. package/dist/starters/features/tailwind/.prettierrc.js +0 -3
  150. package/dist/testing/index.cjs +0 -33388
  151. /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
@@ -0,0 +1,3844 @@
1
+ /**
2
+ * @license
3
+ * @qwik.dev/core/server 2.0.0-beta.40-dev+a459d55
4
+ * Copyright QwikDev. All Rights Reserved.
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
7
+ */
8
+ // packages/qwik/src/server/index.ts
9
+ import { setPlatform as setPlatform2 } from "@qwik.dev/core";
10
+
11
+ // packages/qwik/src/server/platform.ts
12
+ import { setPlatform as mi } from "@qwik.dev/core";
13
+
14
+ import { isDev as isDev6 } from "@qwik.dev/core/build";
15
+
16
+ // packages/qwik/src/core/client/util-mapArray.ts
17
+ import { isDev as isDev2 } from "@qwik.dev/core/build";
18
+
19
+ // packages/qwik/src/core/shared/error/assert.ts
20
+ import { isDev as je } from "@qwik.dev/core/build";
21
+
22
+ // packages/qwik/src/core/shared/utils/qdev.ts
23
+ var qDev = globalThis.qDev !== false;
24
+
25
+ var qInspector = globalThis.qInspector === true;
26
+
27
+ var qDynamicPlatform = globalThis.qDynamicPlatform !== false;
28
+
29
+ var qTest = globalThis.qTest === true;
30
+
31
+ var qRuntimeQrl = globalThis.qRuntimeQrl === true;
32
+
33
+ // packages/qwik/src/core/shared/utils/log.ts
34
+ var STYLE = qDev ? `background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;` : "";
35
+
36
+ var throwErrorAndStop = (t, ...e) => {
37
+ const n = De(false, t, ...e);
38
+ debugger;
39
+ throw n;
40
+ };
41
+
42
+ var logErrorAndStop = (t, ...e) => {
43
+ const n = De(qDev, t, ...e);
44
+ debugger;
45
+ return n;
46
+ };
47
+
48
+ var De = (t, e, ...n) => {
49
+ const r = e instanceof Error ? e : new Error(e);
50
+ !qTest && console.error("%cQWIK ERROR", STYLE, r.message, ...n, r.stack);
51
+ t && !qTest && setTimeout(() => {
52
+ throw r;
53
+ }, 0);
54
+ return r;
55
+ };
56
+
57
+ // packages/qwik/src/core/shared/error/assert.ts
58
+ var ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
59
+
60
+ function assertTrue(t, e, ...n) {
61
+ if (je) {
62
+ if (t === true) {
63
+ return;
64
+ }
65
+ throwErrorAndStop(ASSERT_DISCLAIMER + e, ...n);
66
+ }
67
+ }
68
+
69
+ // packages/qwik/src/core/client/util-mapArray.ts
70
+ var Xe = (t, e, n) => {
71
+ isDev2 && assertTrue(n % 2 === 0, "Expecting even number.");
72
+ let r = n >> 1;
73
+ let s = t.length - 2 >> 1;
74
+ while (r <= s) {
75
+ const n = r + (s - r >> 1);
76
+ const i = t[n << 1];
77
+ if (i === e) {
78
+ return n << 1;
79
+ }
80
+ if (i < e) {
81
+ r = n + 1;
82
+ } else {
83
+ s = n - 1;
84
+ }
85
+ }
86
+ return r << 1 ^ -1;
87
+ };
88
+
89
+ var We = (t, e, n, r, s = false) => {
90
+ const i = Xe(t, e, r);
91
+ if (i >= 0) {
92
+ if (n == null && !s) {
93
+ t.splice(i, 2);
94
+ } else {
95
+ t[i + 1] = n;
96
+ }
97
+ } else if (n != null || s) {
98
+ t.splice(i ^ -1, 0, e, n);
99
+ }
100
+ };
101
+
102
+ var mapApp_remove = (t, e, n) => {
103
+ const r = Xe(t, e, n);
104
+ let s = null;
105
+ if (r >= 0) {
106
+ s = t[r + 1];
107
+ t.splice(r, 2);
108
+ return s;
109
+ }
110
+ return s;
111
+ };
112
+
113
+ var Ue = (t, e, n) => {
114
+ const r = Xe(t, e, n);
115
+ if (r >= 0) {
116
+ return t[r + 1];
117
+ } else {
118
+ return null;
119
+ }
120
+ };
121
+
122
+ var Ve = (t, e, n) => Xe(t, e, n) >= 0;
123
+
124
+ // packages/qwik/src/core/shared/error/error.ts
125
+ import { isDev as isDev3 } from "@qwik.dev/core/build";
126
+
127
+ // packages/qwik/src/core/shared/utils/types.ts
128
+ var Be = t => typeof t === "object" && t !== null;
129
+
130
+ var He = t => Array.isArray(t);
131
+
132
+ var Qe = t => typeof t === "string";
133
+
134
+ // packages/qwik/src/core/shared/error/error.ts
135
+ var baseUrl = "https://qwikdev-build-v2.qwik-8nx.pages.dev/docs/errors/#q";
136
+
137
+ var codeToText = (t, ...e) => {
138
+ if (isDev3) {
139
+ const n = [ "Error while serializing class or style attributes",
140
+ // 0
141
+ "Scheduler not found",
142
+ // 1
143
+ "track() received object, without prop to track",
144
+ // 2
145
+ "Only primitive and object literals can be serialized. {{0}}",
146
+ // 3
147
+ "You can render over a existing q:container. Skipping render().",
148
+ // 4
149
+ "QRL is not a function",
150
+ // 5
151
+ "Dynamic import {{0}} not found",
152
+ // 6
153
+ "Unknown type argument",
154
+ // 7
155
+ `Actual value for useContext({{0}}) can not be found, make sure some ancestor component has set a value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was serialized.`,
156
+ // 8
157
+ "Invoking 'use*()' method outside of invocation context.",
158
+ // 9
159
+ `Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.\nSee https://qwik.dev/docs/core/tasks/#use-method-rules`,
160
+ // 10
161
+ 'The provided Context reference "{{0}}" is not a valid context created by createContextId()',
162
+ // 11
163
+ "SsrError(tag): {{0}}",
164
+ // 12
165
+ "QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.",
166
+ // 13
167
+ "QRLs can not be dynamically resolved, because it does not have a chunk path",
168
+ // 14
169
+ "{{0}}\nThe JSX ref attribute must be a Signal",
170
+ // 15
171
+ "Serialization Error: Deserialization of data type {{0}} is not implemented",
172
+ // 16
173
+ "Serialization Error: Expected vnode for ref prop, but got {{0}}",
174
+ // 17
175
+ "Serialization Error: Cannot allocate data type {{0}}",
176
+ // 18
177
+ "Serialization Error: Missing root id for {{0}}",
178
+ // 19
179
+ "Serialization Error: Serialization of data type {{0}} is not implemented",
180
+ // 20
181
+ "Serialization Error: Unvisited {{0}}",
182
+ // 21
183
+ "Serialization Error: Missing QRL chunk for {{0}}",
184
+ // 22
185
+ "{{0}}\nThe value of the textarea must be a string found {{1}}",
186
+ // 23
187
+ "Unable to find q:container",
188
+ // 24
189
+ "Element must have 'q:container' attribute.",
190
+ // 25
191
+ "Unknown vnode type {{0}}.",
192
+ // 26
193
+ "Materialize error: missing element: {{0}} {{1}} {{2}}",
194
+ // 27
195
+ "Cannot coerce a Signal, use `.value` instead",
196
+ // 28
197
+ "",
198
+ // 29 (cleared: useComputed$ now supports async functions)
199
+ `===\nQwik version {{0}} already imported while importing {{1}}.\nThis can lead to issues due to duplicated shared structures.\nVerify that the Qwik libraries you're using are in "resolve.noExternal[]" and in "optimizeDeps.exclude".\n===\n`,
200
+ // 30
201
+ "WrappedSignal is read-only",
202
+ // 31
203
+ "Attribute value is unsafe for SSR {{0}}",
204
+ // 32
205
+ "SerializerSymbol function returned rejected promise",
206
+ // 33
207
+ "Serialization Error: Cannot serialize function: {{0}}",
208
+ // 34
209
+ "Cannot read .value of a clientOnly async signal during SSR. Use .loading to check state, or provide an initial value.",
210
+ // 35
211
+ "Invalid element name for SSR {{0}}",
212
+ // 36
213
+ "Invalid serialized Promise dependency",
214
+ // 37
215
+ "Invalid serialized Uint8Array payload" ];
216
+ let r = n[t] ?? "";
217
+ if (e.length) {
218
+ r = r.replaceAll(/{{(\d+)}}/g, (t, n) => {
219
+ let r = e[n];
220
+ if (r && Be(r) && r.constructor === Object) {
221
+ r = JSON.stringify(r).slice(0, 50);
222
+ }
223
+ return r;
224
+ });
225
+ }
226
+ return `Code(Q${t}): ${r}`;
227
+ } else {
228
+ return `Code(Q${t}) ${baseUrl}${t}`;
229
+ }
230
+ };
231
+
232
+ var Ye = (t, e = []) => {
233
+ const n = codeToText(t, ...e);
234
+ return logErrorAndStop(n, ...e);
235
+ };
236
+
237
+ // packages/qwik/src/core/shared/qrl/qrl-utils.ts
238
+ import { isDev as isDev4 } from "@qwik.dev/core/build";
239
+
240
+ var Ge = "<sync>";
241
+
242
+ // packages/qwik/src/core/shared/types.ts
243
+ var Ze = "q:type";
244
+
245
+ // packages/qwik/src/core/shared/vnode-data-types.ts
246
+ var VNodeDataSeparator = {
247
+ REFERENCE_CH:
248
+ /* ***** */ `~`,
249
+ // `~` is a reference to the node. Save it.
250
+ REFERENCE:
251
+ /* ******** */ 126,
252
+ // `~` is a reference to the node. Save it.
253
+ ADVANCE_1_CH:
254
+ /* ***** */ `!`,
255
+ // `!` is vNodeData separator skipping 0. (ie next vNode)
256
+ ADVANCE_1:
257
+ /* ********* */ 33,
258
+ // `!` is vNodeData separator skipping 0. (ie next vNode)
259
+ ADVANCE_2_CH:
260
+ /* ***** */ `"`,
261
+ // `"` is vNodeData separator skipping 1.
262
+ ADVANCE_2:
263
+ /* ********* */ 34,
264
+ // `"` is vNodeData separator skipping 1.
265
+ ADVANCE_4_CH:
266
+ /* ***** */ `#`,
267
+ // `#` is vNodeData separator skipping 2.
268
+ ADVANCE_4:
269
+ /* ********* */ 35,
270
+ // `#` is vNodeData separator skipping 2.
271
+ ADVANCE_8_CH:
272
+ /* ***** */ `$`,
273
+ // `$` is vNodeData separator skipping 4.
274
+ ADVANCE_8:
275
+ /* ********* */ 36,
276
+ // `$` is vNodeData separator skipping 4.
277
+ ADVANCE_16_CH:
278
+ /* **** */ `%`,
279
+ // `%` is vNodeData separator skipping 8.
280
+ ADVANCE_16:
281
+ /* ******** */ 37,
282
+ // `%` is vNodeData separator skipping 8.
283
+ ADVANCE_32_CH:
284
+ /* **** */ `&`,
285
+ // `&` is vNodeData separator skipping 16.
286
+ ADVANCE_32:
287
+ /* ******** */ 38,
288
+ // `&` is vNodeData separator skipping 16.
289
+ ADVANCE_64_CH:
290
+ /* **** */ `'`,
291
+ // `'` is vNodeData separator skipping 32.
292
+ ADVANCE_64:
293
+ /* ******** */ 39,
294
+ // `'` is vNodeData separator skipping 32.
295
+ ADVANCE_128_CH:
296
+ /* *** */ `(`,
297
+ // `(` is vNodeData separator skipping 64.
298
+ ADVANCE_128:
299
+ /* ******* */ 40,
300
+ // `(` is vNodeData separator skipping 64.
301
+ ADVANCE_256_CH:
302
+ /* *** */ `)`,
303
+ // `)` is vNodeData separator skipping 128.
304
+ ADVANCE_256:
305
+ /* ******* */ 41,
306
+ // `)` is vNodeData separator skipping 128.
307
+ ADVANCE_512_CH:
308
+ /* *** */ `*`,
309
+ // `*` is vNodeData separator skipping 256.
310
+ ADVANCE_512:
311
+ /* ******* */ 42,
312
+ // `*` is vNodeData separator skipping 256.
313
+ ADVANCE_1024_CH:
314
+ /* ** */ `+`,
315
+ // `+` is vNodeData separator skipping 512.
316
+ ADVANCE_1024:
317
+ /* ****** */ 43,
318
+ // `+` is vNodeData separator skipping 512.
319
+ ADVANCE_2048_CH:
320
+ /* * */ ",",
321
+ // ',' is vNodeData separator skipping 1024.
322
+ ADVANCE_2048:
323
+ /* ****** */ 44,
324
+ // ',' is vNodeData separator skipping 1024.
325
+ ADVANCE_4096_CH:
326
+ /* * */ `-`,
327
+ // `-` is vNodeData separator skipping 2048.
328
+ ADVANCE_4096:
329
+ /* ****** */ 45,
330
+ // `-` is vNodeData separator skipping 2048.
331
+ ADVANCE_8192_CH:
332
+ /* * */ `.`,
333
+ // `.` is vNodeData separator skipping 4096.
334
+ ADVANCE_8192:
335
+ /* ****** */ 46
336
+ };
337
+
338
+ var VNodeDataChar = {
339
+ OPEN:
340
+ /* ************** */ 123,
341
+ // `{` is the start of the VNodeData for a virtual element.
342
+ OPEN_CHAR:
343
+ /* ****** */ "{",
344
+ CLOSE:
345
+ /* ************* */ 125,
346
+ // `}` is the end of the VNodeData for a virtual element.
347
+ CLOSE_CHAR:
348
+ /* ***** */ "}",
349
+ SCOPED_STYLE:
350
+ /* ******* */ 59,
351
+ // `;` - `q:sstyle` - Style attribute.
352
+ SCOPED_STYLE_CHAR:
353
+ ";",
354
+ RENDER_FN:
355
+ /* ********** */ 60,
356
+ // `<` - `q:renderFn' - Component QRL render function (body)
357
+ RENDER_FN_CHAR:
358
+ /* ** */ "<",
359
+ RENDER_HASH_PREFIX:
360
+ /* **/ 95,
361
+ // `_` after `<` identifies a component hash.
362
+ RENDER_HASH_PREFIX_CHAR: "_",
363
+ ID:
364
+ /* ***************** */ 61,
365
+ // `=` - `q:id` - ID of the element.
366
+ ID_CHAR:
367
+ /* ********* */ "=",
368
+ PROPS:
369
+ /* ************** */ 62,
370
+ // `>` - `q:props' - Component Props
371
+ PROPS_CHAR:
372
+ /* ****** */ ">",
373
+ SLOT_PARENT:
374
+ /* ******** */ 63,
375
+ // `?` - `q:sparent` - Slot parent.
376
+ SLOT_PARENT_CHAR:
377
+ "?",
378
+ KEY:
379
+ /* **************** */ 64,
380
+ // `@` - `q:key` - Element key.
381
+ KEY_CHAR:
382
+ /* ******** */ "@",
383
+ SEQ:
384
+ /* **************** */ 91,
385
+ // `[` - `q:seq' - Seq value from `useSequentialScope()`
386
+ SEQ_CHAR:
387
+ /* ******** */ "[",
388
+ DON_T_USE:
389
+ /* ********** */ 92,
390
+ // `\` - SKIP because `\` is used as escaping
391
+ DON_T_USE_CHAR: "\\",
392
+ CONTEXT:
393
+ /* ************ */ 93,
394
+ // `]` - `q:ctx' - Component context/props
395
+ CONTEXT_CHAR:
396
+ /* **** */ "]",
397
+ SEQ_IDX:
398
+ /* ************ */ 94,
399
+ // `^` - `q:seqIdx' - Sequential scope id
400
+ SEQ_IDX_CHAR:
401
+ /* **** */ "^",
402
+ BACK_REFS:
403
+ /* ********** */ 96,
404
+ // '`' - `q:brefs' - Effect dependencies/subscriptions
405
+ BACK_REFS_CHAR:
406
+ /* ** */ "`",
407
+ SEPARATOR:
408
+ /* ********* */ 124,
409
+ // `|` - Separator char to encode any key/value pairs.
410
+ SEPARATOR_CHAR:
411
+ /* ** */ "|",
412
+ SLOT:
413
+ /* ************** */ 126,
414
+ // `~` - `q:slot' - Slot name
415
+ SLOT_CHAR:
416
+ /* ******* */ "~"
417
+ };
418
+
419
+ var ir = (t, e) => {
420
+ const n = parseInt(t, 10) - 1;
421
+ const r = n + e;
422
+ return -(r * (r + 1) / 2 + e + 1);
423
+ };
424
+
425
+ // packages/qwik/src/core/shared/utils/character-escaping.ts
426
+ function escapeHTML(t) {
427
+ let e = "";
428
+ const n = t.length;
429
+ let r = 0;
430
+ let s = r;
431
+ for (;r < n; r++) {
432
+ const n = t.charCodeAt(r);
433
+ if (n === 60) {
434
+ e += t.substring(s, r) + "&lt;";
435
+ } else if (n === 62) {
436
+ e += t.substring(s, r) + "&gt;";
437
+ } else if (n === 38) {
438
+ e += t.substring(s, r) + "&amp;";
439
+ } else if (n === 34) {
440
+ e += t.substring(s, r) + "&quot;";
441
+ } else if (n === 39) {
442
+ e += t.substring(s, r) + "&#39;";
443
+ } else {
444
+ continue;
445
+ }
446
+ s = r + 1;
447
+ }
448
+ if (s === 0) {
449
+ return t;
450
+ } else {
451
+ return e + t.substring(s);
452
+ }
453
+ }
454
+
455
+ function encodeVNodeDataString(t) {
456
+ let e = "";
457
+ const n = t.length;
458
+ let r = 0;
459
+ let s = r;
460
+ for (;r < n; r++) {
461
+ const n = t.charCodeAt(r);
462
+ if (n >= VNodeDataSeparator.ADVANCE_1 && n <= VNodeDataSeparator.ADVANCE_8192) {
463
+ e += t.substring(s, r) + "\\" + t.charAt(r);
464
+ } else {
465
+ continue;
466
+ }
467
+ s = r + 1;
468
+ }
469
+ if (s === 0) {
470
+ return t;
471
+ } else {
472
+ return e + t.substring(s);
473
+ }
474
+ }
475
+
476
+ function encodeVNodeDataKey(t) {
477
+ const e = encodeURI(t);
478
+ let n = "";
479
+ const r = e.length;
480
+ let s = 0;
481
+ let i = s;
482
+ for (;s < r; s++) {
483
+ const t = e.charCodeAt(s);
484
+ let r = null;
485
+ if (t === 59) {
486
+ r = "%3B";
487
+ } else if (t === 61) {
488
+ r = "%3D";
489
+ } else if (t === 63) {
490
+ r = "%3F";
491
+ } else if (t === 64) {
492
+ r = "%40";
493
+ } else if (t === 126) {
494
+ r = "%7E";
495
+ } else {
496
+ continue;
497
+ }
498
+ n += e.substring(i, s) + r;
499
+ i = s + 1;
500
+ }
501
+ if (i === 0) {
502
+ return e;
503
+ } else {
504
+ return n + e.substring(i);
505
+ }
506
+ }
507
+
508
+ // packages/qwik/src/core/shared/utils/markers.ts
509
+ var sr = "q:renderFn";
510
+
511
+ var cr = "q:slot";
512
+
513
+ var QSlotParent = "q:sparent";
514
+
515
+ var QStatePatchAttr = "q:patch";
516
+
517
+ var hr = "q:r";
518
+
519
+ var dr = "q:style";
520
+
521
+ var pr = "style[q\\:style]";
522
+
523
+ var QStyleSSelector = "style[q\\:sstyle]";
524
+
525
+ var $r = pr + "," + QStyleSSelector;
526
+
527
+ var yr = "q:sstyle";
528
+
529
+ var mr = "q:ctx";
530
+
531
+ var wr = "q:brefs";
532
+
533
+ var QwikEvContainerReady = 0;
534
+
535
+ var QRenderAttr = "q:render";
536
+
537
+ var QRuntimeAttr = "q:runtime";
538
+
539
+ var QVersionAttr = "q:version";
540
+
541
+ var br = "q:base";
542
+
543
+ var QLocaleAttr = "q:locale";
544
+
545
+ var QManifestHashAttr = "q:manifest-hash";
546
+
547
+ var QInstanceAttr = "q:instance";
548
+
549
+ var QStatePrewarmAttr = "q:prewarm";
550
+
551
+ var _r = "q:container-island";
552
+
553
+ var gr = "/" + _r;
554
+
555
+ var Sr = "q:ignore";
556
+
557
+ var Er = "/" + Sr;
558
+
559
+ var kr = "q:container";
560
+
561
+ var Rr = "/" + kr;
562
+
563
+ var Pr = "q:template";
564
+
565
+ var qr = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
566
+
567
+ var QDefaultSlot = "";
568
+
569
+ var Ir = "q:id";
570
+
571
+ var Nr = "q:key";
572
+
573
+ var Cr = "q:props";
574
+
575
+ var Or = "q:seq";
576
+
577
+ var jr = "q:seqIdx";
578
+
579
+ var ELEMENT_BACKPATCH_DATA = "qwik/backpatch";
580
+
581
+ var Lr = "q:p";
582
+
583
+ var Fr = "q:ps";
584
+
585
+ var Dr = ":";
586
+
587
+ var Xr = Dr + "on";
588
+
589
+ var Wr = Dr + "onIdx";
590
+
591
+ var Ur = Dr + "onFlags";
592
+
593
+ var Vr = Dr + "cursorBoundary";
594
+
595
+ var zr = Dr + "nearestCursorBoundary";
596
+
597
+ var Br = ":";
598
+
599
+ var Hr = "dangerouslySetInnerHTML";
600
+
601
+ // packages/qwik/src/core/shared/utils/promises.ts
602
+ import { isDev as isDev5, isServer as Ce } from "@qwik.dev/core/build";
603
+
604
+ var Jr = 100;
605
+
606
+ var Yr = t => !!t && typeof t == "object" && typeof t.then === "function";
607
+
608
+ var Kr = (t, e) => Yr(t) ? t.then(e) : e(t);
609
+
610
+ var checkError = t => {
611
+ if (Ce && t instanceof ReferenceError && t.message.includes("window")) {
612
+ t.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + t.message;
613
+ }
614
+ };
615
+
616
+ var ti = t => {
617
+ throw t;
618
+ };
619
+
620
+ function n(t, e = ti) {
621
+ let n = false;
622
+ let r;
623
+ try {
624
+ r = t();
625
+ n = true;
626
+ } catch (t) {
627
+ r = t;
628
+ }
629
+ if (!Yr(r)) {
630
+ if (n) {
631
+ return r;
632
+ }
633
+ isDev5 && checkError(r);
634
+ return e(r);
635
+ }
636
+ let s = Jr;
637
+ const i = async n => {
638
+ while (Yr(n)) {
639
+ try {
640
+ await n;
641
+ return await t();
642
+ } catch (t) {
643
+ if (Yr(t)) {
644
+ if (! --s) {
645
+ n = new Error("Exceeded max retry count in retryOnPromise");
646
+ break;
647
+ } else {
648
+ n = t;
649
+ }
650
+ } else {
651
+ n = t;
652
+ break;
653
+ }
654
+ }
655
+ }
656
+ isDev5 && checkError(n);
657
+ return e(n);
658
+ };
659
+ return n ? r.catch(i) : i(r);
660
+ }
661
+
662
+ // packages/qwik/src/core/shared/utils/scoped-styles.ts
663
+ function isClassAttr(t) {
664
+ return t === "class";
665
+ }
666
+
667
+ function convertStyleIdsToString(t) {
668
+ return Array.from(t).join(" ");
669
+ }
670
+
671
+ // packages/qwik/src/core/shared/utils/event-names.ts
672
+ var ri = t => t.charCodeAt(0) === 113 && t.charCodeAt(1) === 45 && (t.charCodeAt(3) === 58 || t.charCodeAt(3) === 112 && t.charCodeAt(4) === 58);
673
+
674
+ function isPreventDefault(t) {
675
+ return t.startsWith("preventdefault:");
676
+ }
677
+
678
+ // packages/qwik/src/core/shared/utils/unitless_number.ts
679
+ var li = /* @__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",
680
+ // Known Prefixed Properties
681
+ "MozBoxFlex",
682
+ // TODO: Remove these since they shouldn't be used in modern code
683
+ "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp" ]);
684
+
685
+ var isUnitlessNumber = t => li.has(t);
686
+
687
+ // packages/qwik/src/core/shared/utils/styles.ts
688
+ var ci = t => {
689
+ if (!t) {
690
+ return "";
691
+ }
692
+ if (Qe(t)) {
693
+ return t.trim();
694
+ }
695
+ const e = [];
696
+ if (He(t)) {
697
+ for (let n = 0; n < t.length; n++) {
698
+ const r = t[n];
699
+ const s = ci(r);
700
+ if (s) {
701
+ e.push(s);
702
+ }
703
+ }
704
+ } else {
705
+ for (const [n, r] of Object.entries(t)) {
706
+ if (r) {
707
+ e.push(n.trim());
708
+ }
709
+ }
710
+ }
711
+ return e.join(" ");
712
+ };
713
+
714
+ var fi = t => t.replace(/([A-Z])/g, "-$1").toLowerCase();
715
+
716
+ var ai = t => {
717
+ if (t == null) {
718
+ return "";
719
+ }
720
+ if (typeof t == "object") {
721
+ if (He(t)) {
722
+ throw Ye(0 /* stringifyClassOrStyle */ , [ t, "style" ]);
723
+ } else {
724
+ const e = [];
725
+ for (const n in t) {
726
+ if (Object.prototype.hasOwnProperty.call(t, n)) {
727
+ const r = t[n];
728
+ if (r != null && typeof r !== "function") {
729
+ if (n.startsWith("--")) {
730
+ e.push(n + ":" + r);
731
+ } else {
732
+ e.push(fi(n) + ":" + hi(n, r));
733
+ }
734
+ }
735
+ }
736
+ }
737
+ return e.join(";");
738
+ }
739
+ }
740
+ return String(t);
741
+ };
742
+
743
+ var serializeBooleanOrNumberAttribute = t => t != null ? String(t) : null;
744
+
745
+ function r(t, e, n) {
746
+ if (isClassAttr(t)) {
747
+ const t = ci(e);
748
+ e = n ? n + (t.length ? " " + t : t) : t;
749
+ } else if (t === "style") {
750
+ e = ai(e);
751
+ } else if (isEnumeratedBooleanAttribute(t) || typeof e === "number") {
752
+ e = serializeBooleanOrNumberAttribute(e);
753
+ } else if (e === false || e == null) {
754
+ e = null;
755
+ } else if (e === true && isPreventDefault(t)) {
756
+ e = "";
757
+ }
758
+ return e;
759
+ }
760
+
761
+ function isEnumeratedBooleanAttribute(t) {
762
+ return isAriaAttribute(t) || [ "spellcheck", "draggable", "contenteditable" ].includes(t);
763
+ }
764
+
765
+ var hi = (t, e) => {
766
+ if (typeof e === "number" && e !== 0 && !isUnitlessNumber(t)) {
767
+ return e + "px";
768
+ }
769
+ return e;
770
+ };
771
+
772
+ function isAriaAttribute(t) {
773
+ return t.startsWith("aria-");
774
+ }
775
+
776
+ // packages/qwik/src/core/preloader/bundle-graph.ts
777
+ var base;
778
+
779
+ var graph;
780
+
781
+ var parseBundleGraph = t => {
782
+ const e = /* @__PURE__ */ new Map;
783
+ let n = 0;
784
+ while (n < t.length) {
785
+ const r = t[n++];
786
+ const s = [];
787
+ let i;
788
+ let o = 1;
789
+ while (i = t[n], typeof i === "number") {
790
+ if (i < 0) {
791
+ o = -i / 10;
792
+ } else {
793
+ s.push({
794
+ fn: t[i],
795
+ mn: o,
796
+ wn: 1
797
+ });
798
+ }
799
+ n++;
800
+ }
801
+ e.set(r, s);
802
+ }
803
+ return e;
804
+ };
805
+
806
+ var initPreloader = t => {
807
+ if (base != null || !t) {
808
+ return;
809
+ }
810
+ base = "";
811
+ graph = parseBundleGraph(t);
812
+ };
813
+
814
+ // packages/qwik/src/core/shared/utils/objects.ts
815
+ var Oi = t => {
816
+ for (const e in t) {
817
+ if (Object.prototype.hasOwnProperty.call(t, e)) {
818
+ return false;
819
+ }
820
+ }
821
+ return true;
822
+ };
823
+
824
+ // packages/qwik/src/core/ssr/stream-writer.ts
825
+ var stringifyRootRefPath = t => {
826
+ let e = String(t[0]);
827
+ for (let n = 1; n < t.length; n++) {
828
+ e += " " + t[n];
829
+ }
830
+ return e;
831
+ };
832
+
833
+ var writeStringRootRef = (t, e) => t.write(String(e));
834
+
835
+ var writeStringRootRefPath = (t, e) => t.write(stringifyRootRefPath(e));
836
+
837
+ var writeStringRootRefDelta = (t, e, n) => t.write(String(e - n));
838
+
839
+ var ji = t => ({
840
+ write: t,
841
+ writeRootRef(t) {
842
+ return writeStringRootRef(this, t);
843
+ },
844
+ writeRootRefPath(t) {
845
+ return writeStringRootRefPath(this, t);
846
+ },
847
+ writeRootRefDelta(t, e) {
848
+ return writeStringRootRefDelta(this, t, e);
849
+ }
850
+ });
851
+
852
+ // packages/qwik/src/core/shared/ssr-const.ts
853
+ var LT = "<";
854
+
855
+ var GT = ">";
856
+
857
+ var CLOSE_TAG = "</";
858
+
859
+ var Ga = " ";
860
+
861
+ var ATTR_EQUALS_QUOTE = '="';
862
+
863
+ var Li = '"';
864
+
865
+ var EMPTY_ATTR = '=""';
866
+
867
+ var Fi = "[";
868
+
869
+ var Di = "]";
870
+
871
+ var PAREN_CLOSE = ")";
872
+
873
+ var Xi = ",";
874
+
875
+ // packages/qwik/src/server/platform.ts
876
+ var getDevSegmentPath = (t, e, n, r) => {
877
+ const s = t?.[e];
878
+ if (s) {
879
+ return s;
880
+ }
881
+ if (n === Ge) {
882
+ return [ n, "" ];
883
+ }
884
+ if (!r) {
885
+ if (n.startsWith("_") && n.length < 6) {
886
+ return [ n, `${import.meta.env?.BASE_URL}@qwik-handlers` ];
887
+ }
888
+ console.error("qwik symbolMapper: unknown qrl requested without parent:", n);
889
+ return [ n, `${import.meta.env?.BASE_URL}${n}.js` ];
890
+ }
891
+ const i = `${import.meta.env?.BASE_URL}${r.startsWith("/") ? r.slice(1) : r}_${n}.js`;
892
+ return [ n, i ];
893
+ };
894
+
895
+ function pi(t, e) {
896
+ const n = e?.mapper;
897
+ const r = t.symbolMapper ? t.symbolMapper : (t, e, r) => {
898
+ if (n || isDev6 && import.meta.env?.MODE !== "test") {
899
+ const e = sd(t);
900
+ const s = !isDev6 ? n[e] : getDevSegmentPath(n, e, t, r);
901
+ if (!s) {
902
+ if (e === Ge) {
903
+ return [ e, "" ];
904
+ }
905
+ const s = globalThis.__qwik_reg_symbols?.has(e);
906
+ if (s) {
907
+ return [ t, "_" ];
908
+ }
909
+ console.error("Cannot resolve symbol", t, "in", n, r);
910
+ }
911
+ return s;
912
+ }
913
+ };
914
+ const s = {
915
+ isServer: true,
916
+ async importSymbol(t, e, n) {
917
+ const r = sd(n);
918
+ const s = globalThis.__qwik_reg_symbols?.get(r);
919
+ if (s) {
920
+ return s;
921
+ }
922
+ throw Ye(6 /* dynamicImportFailed */ , [ n ]);
923
+ },
924
+ raf: () => {
925
+ console.error("server can not rerender");
926
+ return Promise.resolve();
927
+ },
928
+ chunkForSymbol(t, e, s) {
929
+ return r(t, n, s);
930
+ }
931
+ };
932
+ return s;
933
+ }
934
+
935
+ async function setServerPlatform(t, e) {
936
+ const n = pi(t, e);
937
+ mi(n);
938
+ }
939
+
940
+ var sd = t => {
941
+ const e = t.lastIndexOf("_");
942
+ if (e > -1) {
943
+ return t.slice(e + 1);
944
+ }
945
+ return t;
946
+ };
947
+
948
+ // packages/qwik/src/server/ssr-render.ts
949
+ import { getClientManifest as Ea } from "@qwik.dev/core";
950
+
951
+ // packages/qwik/src/server/ssr-container.ts
952
+ import { isDev as isDev8 } from "@qwik.dev/core/build";
953
+
954
+ import { _SubscriptionData as Gs, _SharedContainer as Cc, _jsxSorted as fo, _jsxSplit as ao, _res as _, _setEvent, _walkJSX as zn, _createQRL as la, isSignal as Tu } from "@qwik.dev/core/internal";
955
+
956
+ // packages/qwik/src/server/ooos-utils.ts
957
+ import { _SubscriptionPatch as Ku } from "@qwik.dev/core/internal";
958
+
959
+ var recordExternalRootEffect = (t, e, n, r, s, i, o, a) => {
960
+ if (!r || o !== null && !a) {
961
+ return;
962
+ }
963
+ let l = s;
964
+ if (o !== null && s && (typeof s === "object" || typeof s === "function")) {
965
+ l = n.get(s) || s;
966
+ }
967
+ const c = t.Ne(l);
968
+ e.Rt(l);
969
+ e.Rt(i);
970
+ if (o !== null && typeof o !== "string") {
971
+ e.Rt(o);
972
+ }
973
+ r.push({
974
+ rootObj: l,
975
+ rootId: c,
976
+ effect: i,
977
+ prop: o
978
+ });
979
+ };
980
+
981
+ var collectSubscriptionPatches = (t, e, n) => {
982
+ if (!e?.length) {
983
+ return;
984
+ }
985
+ const r = [];
986
+ const s = /* @__PURE__ */ new Map;
987
+ for (let i = 0; i < e.length; i++) {
988
+ const o = e[i];
989
+ const a = o.rootId === void 0 ? t.Ne(o.rootObj) : o.rootId;
990
+ if (a === void 0 || a >= n) {
991
+ continue;
992
+ }
993
+ let l = s.get(a);
994
+ if (!l) {
995
+ l = new Ku(a, o.prop === null ? /* @__PURE__ */ new Set : /* @__PURE__ */ new Map);
996
+ s.set(a, l);
997
+ r.push(l);
998
+ }
999
+ const c = l.subscriptions;
1000
+ if (o.prop === null) {
1001
+ if (c instanceof Set) {
1002
+ c.add(o.effect);
1003
+ }
1004
+ } else {
1005
+ if (c instanceof Map) {
1006
+ let t = c.get(o.prop);
1007
+ if (!t) {
1008
+ t = /* @__PURE__ */ new Set;
1009
+ c.set(o.prop, t);
1010
+ }
1011
+ t.add(o.effect);
1012
+ }
1013
+ }
1014
+ }
1015
+ return r.length ? r : void 0;
1016
+ };
1017
+
1018
+ // packages/qwik/src/server/preload-impl.ts
1019
+ import { getPlatform as wi } from "@qwik.dev/core";
1020
+
1021
+ var simplifyPath = (t, e) => {
1022
+ if (e == null) {
1023
+ return null;
1024
+ }
1025
+ const n = `${t}${e}`.split("/");
1026
+ const r = [];
1027
+ for (let t = 0; t < n.length; t++) {
1028
+ const e = n[t];
1029
+ if (e === ".." && r.length > 0) {
1030
+ r.pop();
1031
+ } else {
1032
+ r.push(e);
1033
+ }
1034
+ }
1035
+ return r.join("/");
1036
+ };
1037
+
1038
+ var getBase = t => {
1039
+ let e = t.De;
1040
+ if (import.meta.env?.DEV && !qTest) {
1041
+ e = import.meta.env?.BASE_URL;
1042
+ }
1043
+ return e;
1044
+ };
1045
+
1046
+ var preloaderPre = (t, e, n) => {
1047
+ const {resolvedManifest: r} = t;
1048
+ const s = getBase(t);
1049
+ const i = simplifyPath(s, r?.manifest?.preloader);
1050
+ let o = r?.manifest.bundleGraphAsset;
1051
+ if (o) {
1052
+ o = (import.meta.env?.BASE_URL || "/") + o;
1053
+ }
1054
+ if (!(import.meta.env?.DEV && !qTest) && i && o && e !== false) {
1055
+ const r = t.resolvedManifest?.manifest.bundleGraph;
1056
+ initPreloader(r);
1057
+ const a = [];
1058
+ if (e) {
1059
+ if (e.maxIdlePreloads) {
1060
+ a.push(`P:${e.maxIdlePreloads}`);
1061
+ }
1062
+ }
1063
+ const l = a.length ? `,{${a.join(",")}}` : "";
1064
+ const c = {
1065
+ rel: "modulepreload",
1066
+ href: i
1067
+ };
1068
+ if (n) {
1069
+ c["nonce"] = n;
1070
+ }
1071
+ t.openElement("link", null, c, null, null, null);
1072
+ t.closeElement();
1073
+ t.openElement("link", null, {
1074
+ rel: "preload",
1075
+ href: o,
1076
+ as: "fetch",
1077
+ crossorigin: "anonymous"
1078
+ }, null, null, null);
1079
+ t.closeElement();
1080
+ const u = `let b=fetch("${o}");import("${i}").then(({l})=>l(${JSON.stringify(s)},b${l}));`;
1081
+ const h = {
1082
+ type: "module",
1083
+ async: true,
1084
+ crossorigin: "anonymous"
1085
+ };
1086
+ if (n) {
1087
+ h["nonce"] = n;
1088
+ }
1089
+ t.writeScript(h, u);
1090
+ }
1091
+ const a = simplifyPath(s, r?.manifest.core);
1092
+ if (a) {
1093
+ const e = {
1094
+ rel: "modulepreload",
1095
+ href: a
1096
+ };
1097
+ if (n) {
1098
+ e["nonce"] = n;
1099
+ }
1100
+ t.openElement("link", null, e, null, null, null);
1101
+ t.closeElement();
1102
+ }
1103
+ };
1104
+
1105
+ var includePreloader = (t, e, n, r) => {
1106
+ if (n.length === 0 || e === false) {
1107
+ return null;
1108
+ }
1109
+ const {ssrPreloads: s} = normalizePreLoaderOptions(typeof e === "boolean" ? void 0 : e);
1110
+ let i = s;
1111
+ const o = getBase(t);
1112
+ const a = [];
1113
+ const {resolvedManifest: l} = t;
1114
+ if (i) {
1115
+ const t = l?.manifest.preloader;
1116
+ const e = l?.manifest.core;
1117
+ for (let r = 0; r < n.length; r++) {
1118
+ const s = n[r];
1119
+ if (s === t || s === e) {
1120
+ continue;
1121
+ }
1122
+ a.push(s);
1123
+ if (--i === 0) {
1124
+ break;
1125
+ }
1126
+ }
1127
+ }
1128
+ const c = simplifyPath(o, l?.manifest.preloader);
1129
+ const u = a.length ?
1130
+ /**
1131
+ * We only use modulepreload links because they behave best. Older browsers can rely on the
1132
+ * preloader which does feature detection and which will be available soon after inserting these
1133
+ * links.
1134
+ */ `${JSON.stringify(a)}.map((l,e)=>{e=document.createElement('link');e.rel='modulepreload';e.href=${JSON.stringify(o)}+l;document.head.appendChild(e)});` : "";
1135
+ let h = u;
1136
+ if (c) {
1137
+ h += `window.addEventListener('load',f=>{f=_=>import("${c}").then(({p})=>p(${JSON.stringify(n)}));try{requestIdleCallback(f,{timeout:2000})}catch(e){setTimeout(f,200)}})`;
1138
+ }
1139
+ if (h) {
1140
+ const e = {
1141
+ type: "module",
1142
+ async: "true",
1143
+ "q:type": "preload"
1144
+ };
1145
+ if (r) {
1146
+ e["nonce"] = r;
1147
+ }
1148
+ t.writeScript(e, h);
1149
+ }
1150
+ return null;
1151
+ };
1152
+
1153
+ var preloaderPost = (t, e, n) => {
1154
+ if (import.meta.env?.DEV && !qTest) {
1155
+ return;
1156
+ }
1157
+ if (e.preloader !== false) {
1158
+ const r = Array.from(t.serializationCtx.It);
1159
+ const s = getBundles(r);
1160
+ includePreloader(t, e.preloader, s, n);
1161
+ }
1162
+ };
1163
+
1164
+ function normalizePreLoaderOptions(t) {
1165
+ return {
1166
+ ...preLoaderOptionsDefault,
1167
+ ...t
1168
+ };
1169
+ }
1170
+
1171
+ var getBundles = t => {
1172
+ const e = wi();
1173
+ const n = t?.map(t => {
1174
+ const n = t.gt;
1175
+ const r = t.St;
1176
+ const s = e.chunkForSymbol(n, r, t.dev?.file);
1177
+ if (s) {
1178
+ return s[1];
1179
+ }
1180
+ return r;
1181
+ }).filter(Boolean);
1182
+ return [ ...new Set(n) ];
1183
+ };
1184
+
1185
+ var preLoaderOptionsDefault = {
1186
+ ssrPreloads: 7,
1187
+ maxIdlePreloads: 25
1188
+ };
1189
+
1190
+ // packages/qwik/src/server/scripts.ts
1191
+ var QWIK_LOADER_DEFAULT_MINIFIED = 'var e,t,n,r=document,o=window,s="w",i="wp",a="d",c="dp",l="e",p="ep",u="capture:",d="readystatechange",f=0,h=new Set,q=new Set([r]),b=new Map,g={},m=(e,t)=>Array.from(e.querySelectorAll(t)),v=e=>{const t=[];return q.forEach(n=>t.push(...m(n,e))),t},w=(e,t,n,r=!1,o=!1)=>e.addEventListener(t,n,{capture:r,passive:o}),y=e=>{H(e);const t=m(e,"[q\\\\:shadowroot]");for(let e=0;e<t.length;e++){const n=t[e].shadowRoot;n&&y(n)}},A=e=>e&&"function"==typeof e.then,E=async e=>{for(let t=0;t<e.length;t++)await e[t]()},S=e=>{if(e.length){const t=()=>E(e);n=n?n.then(t,t):t()}},C=e=>{if(void 0===e._qwikjson_){let t=(e===r.documentElement?r.body:e).lastElementChild;for(;t;){if("SCRIPT"===t.tagName&&"qwik/json"===t.getAttribute("type")){e._qwikjson_=JSON.parse(t.textContent.replace(/\\\\x3C(\\/?script)/gi,"<$1"));break}t=t.previousElementSibling}}},_=e=>{g[e]=1,I(d)},k=e=>{const t=e.getAttribute("q:instance");return"paused"===e.getAttribute("q:container")&&"loading"===r.readyState&&!g[t]&&new Promise(e=>{w(r,d,()=>{("loading"!==r.readyState||g[t])&&e()})})},$=(e,t)=>new CustomEvent(e,{detail:t}),I=(e,t)=>{r.dispatchEvent($(e,t))},N=e=>e.replace(/([A-Z-])/g,e=>"-"+e.toLowerCase()),R=e=>e.replace(/-./g,e=>e[1].toUpperCase()),T=e=>{const t=e.indexOf(":");return{scope:e.slice(0,t),eventName:R(e.slice(t+1))}},x=e=>2===e.length,B=e=>e.charAt(0),L=e=>!!e&&1===e.nodeType,U=(e,t,n)=>e.hasAttribute(n)&&(!!e._qDispatch?.[t]||e.hasAttribute("q-"+t)),j=(e,t,n,o,s,i,a,c=!0)=>{const l={qBase:n,symbol:i,element:t,reqTime:a};if(!s){const t=(r["qFuncs_"+e.getAttribute("q:instance")]||[])[+i];if(!t&&c){const e=Error("sym:"+i);I("qerror",{importError:"sync",error:e,...l}),console.error(e)}return t}const p=`${i}|${n}|${s}`,u=b.get(p);if(u)return u;const d=new URL(s,o).href,f=import(d);return C(e),f.then(e=>{const t=e[i];if(t)b.set(p,t),I("qsymbol",l);else{const e=Error(`${i} not in ${d}`);I("qerror",{importError:"no-symbol",error:e,...l}),console.error(e)}return t},e=>{I("qerror",{importError:"async",error:e,...l}),console.error(e)})},D=(e,t,n,o,s,i=!0)=>{let a=!1;s&&(i&&e.hasAttribute("preventdefault:"+s)&&t.preventDefault(),e.hasAttribute("stoppropagation:"+s)&&t.stopPropagation());const c=e._qDispatch?.[n];if(c){if("function"==typeof c){const n=()=>c(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}else if(c.length)for(let n=0;n<c.length;n++){const r=c[n];if(r){const n=()=>r(t,e);if(a)o.push(async()=>{const e=n();A(e)&&await e});else{const e=n();A(e)&&(a=!0,o.push(()=>e))}}}return}const l=e.getAttribute("q-"+n);if(l){const n=e.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),s=n.getAttribute("q:base"),i=new URL(s,r.baseURI),c=l.split("|"),p=k(n);for(let r=0;r<c.length;r++){const l=c[r],u=performance.now(),[d,f,h]=l.split("#"),q=n=>{if(n&&e.isConnected){const r=t=>{I("qerror",{error:t,qBase:s,symbol:f,element:e,reqTime:u})};try{const o=n.call(h,t,e);if(A(o))return o.catch(r)}catch(e){return r(e)}}},b=(t=!0)=>j(n,e,s,i,d,f,u,t),g=p?void 0:b();if(p)a=!0,o.push(async()=>{await p,await q(await b(!1)||await b())});else if(A(g))a=!0,o.push(()=>g.then(q));else if(a)a=!0,o.push(async()=>{await q(g||await b())});else{const e=q(g);A(e)&&(a=!0,o.push(()=>e))}}}},O=(e,t=l,n=!0)=>{const r=N(e.type),o=t+":"+r,s=u+r,i=[],a=[],c=[];let p=e.target;for(;p;)L(p)?(i.push(p),a.push(U(p,o,s)),p=p.parentElement):p=p.parentElement;for(let t=i.length-1;t>=0;t--)if(a[t]&&(D(i[t],e,o,c,r,n),e.cancelBubble))return void S(c);for(let t=0;t<i.length;t++)if(!a[t]&&(D(i[t],e,o,c,r,n),!e.bubbles||e.cancelBubble))return void S(c);S(c)},P=e=>O(e,p,!1),F=(e,t,n=!0)=>{const r=N(t.type),o=e+":"+r,s=v("[q-"+CSS.escape(o)+"]"),i=[];for(let e=0;e<s.length;e++){const a=s[e];D(a,t,o,i,r,n)}S(i)},J=e=>{F(a,e)},M=e=>{F(c,e,!1)},Z=e=>{F(s,e)},z=e=>{F(i,e,!1)},G=()=>{const n=r.readyState;if("interactive"==n||"complete"==n){if(t=1,q.forEach(y),h.has("d:qinit")){h.delete("d:qinit");const e=$("qinit"),t=v("[q-d\\\\:qinit]"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,"d:qinit",n),o.removeAttribute("q-d:qinit")}S(n)}if(h.has("d:qidle")&&(h.delete("d:qidle"),(o.requestIdleCallback??o.setTimeout).bind(o)(()=>{const e=$("qidle"),t=v("[q-d\\\\:qidle]"),n=[];for(let r=0;r<t.length;r++){const o=t[r];D(o,e,"d:qidle",n),o.removeAttribute("q-d:qidle")}S(n)})),h.has("e:qvisible")){e||(e=new IntersectionObserver(t=>{const n=[];for(let r=0;r<t.length;r++){const o=t[r];o.isIntersecting&&(e.unobserve(o.target),D(o.target,$("qvisible",o),"e:qvisible",n))}S(n)}));const t=v("[q-e\\\\:qvisible]:not([q\\\\:observed])");for(let n=0;n<t.length;n++){const r=t[n];e.observe(r),r.setAttribute("q:observed","true")}}}},H=(...e)=>{for(let n=0;n<e.length;n++){const r=e[n];if(r===f)_(e[++n]);else if("string"==typeof r){if(!h.has(r)){h.add(r);const{scope:e,eventName:n}=T(r),i=x(e),c=B(e);c===s?w(o,n,i?z:Z,!0,i):q.forEach(e=>w(e,n,c===a?i?M:J:i?P:O,!0,i)),1!==t||"e:qvisible"!==r&&"d:qinit"!==r&&"d:qidle"!==r||G()}}else q.has(r)||(h.forEach(e=>{const{scope:t,eventName:n}=T(e),o=x(t),i=B(t);i!==s&&w(r,n,i===a?o?M:J:o?P:O,!0,o)}),q.add(r))}},K=o._qwikEv;K?.roots||(Array.isArray(K)?H(...K):H("e:click","e:input"),o._qwikEv={events:h,roots:q,push:H},w(r,d,G),G())';
1192
+
1193
+ var QWIK_LOADER_DEFAULT_DEBUG = '//#region packages/qwik/src/qwikloader.ts\nvar doc = document;\nvar win = window;\nvar windowPrefix = "w";\nvar passiveWindowPrefix = "wp";\nvar documentPrefix = "d";\nvar passiveDocumentPrefix = "dp";\nvar elementPrefix = "e";\nvar passiveElementPrefix = "ep";\nvar capturePrefix = "capture:";\nvar readyStateChange = "readystatechange";\nvar QwikEvContainerReady = 0;\nvar events = /* @__PURE__ */ new Set();\nvar roots = /* @__PURE__ */ new Set([doc]);\nvar symbols = /* @__PURE__ */ new Map();\nvar readyContainers = {};\nvar observer;\nvar hasInitialized;\nvar queuedTasks;\nvar nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nvar querySelectorAll = (query) => {\n\tconst elements = [];\n\troots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n\treturn elements;\n};\nvar addEventListener = (el, eventName, handler, capture = false, passive = false) => el.addEventListener(eventName, handler, {\n\tcapture,\n\tpassive\n});\nvar findShadowRoots = (fragment) => {\n\taddEventOrRoot(fragment);\n\tconst shadowRoots = nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]");\n\tfor (let i = 0; i < shadowRoots.length; i++) {\n\t\tconst shadowRoot = shadowRoots[i].shadowRoot;\n\t\tshadowRoot && findShadowRoots(shadowRoot);\n\t}\n};\nvar isPromise = (promise) => promise && typeof promise.then === "function";\nvar runTasks = async (tasks) => {\n\tfor (let i = 0; i < tasks.length; i++) await tasks[i]();\n};\nvar queueTasks = (tasks) => {\n\tif (tasks.length) {\n\t\tconst run = () => runTasks(tasks);\n\t\tqueuedTasks = queuedTasks ? queuedTasks.then(run, run) : run();\n\t}\n};\nvar resolveContainer = (containerEl) => {\n\tif (containerEl._qwikjson_ === void 0) {\n\t\tlet script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n\t\twhile (script) {\n\t\t\tif (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n\t\t\t\tcontainerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tscript = script.previousElementSibling;\n\t\t}\n\t}\n};\nvar markContainerReady = (hash) => {\n\treadyContainers[hash] = 1;\n\temitEvent(readyStateChange);\n};\nvar waitForContainerReady = (container) => {\n\tconst hash = container.getAttribute("q:instance");\n\treturn container.getAttribute("q:container") === "paused" && doc.readyState === "loading" && !readyContainers[hash] && new Promise((resolve) => {\n\t\tconst ready = () => {\n\t\t\tif (doc.readyState !== "loading" || readyContainers[hash]) resolve();\n\t\t};\n\t\taddEventListener(doc, readyStateChange, ready);\n\t});\n};\nvar createEvent = (eventName, detail) => new CustomEvent(eventName, { detail });\nvar emitEvent = (eventName, detail) => {\n\tdoc.dispatchEvent(createEvent(eventName, detail));\n};\nvar camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => "-" + a.toLowerCase());\nvar kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nvar parseKebabEvent = (event) => {\n\tconst separatorIndex = event.indexOf(":");\n\treturn {\n\t\tscope: event.slice(0, separatorIndex),\n\t\teventName: kebabToCamel(event.slice(separatorIndex + 1))\n\t};\n};\nvar isPassiveScope = (scope) => scope.length === 2;\nvar getRootScope = (scope) => scope.charAt(0);\nvar isElementNode = (node) => !!node && node.nodeType === 1;\nvar isCaptureHandlerElement = (element, scopedKebabName, captureAttribute) => element.hasAttribute(captureAttribute) && (!!element._qDispatch?.[scopedKebabName] || element.hasAttribute("q-" + scopedKebabName));\nvar resolveHandler = (container, element, qBase, base, chunk, symbol, reqTime, reportSyncError = true) => {\n\tconst eventData = {\n\t\tqBase,\n\t\tsymbol,\n\t\telement,\n\t\treqTime\n\t};\n\tif (!chunk) {\n\t\tconst handler = (doc["qFuncs_" + container.getAttribute("q:instance")] || [])[+symbol];\n\t\tif (!handler && reportSyncError) {\n\t\t\tconst error = /* @__PURE__ */ new Error("sym:" + symbol);\n\t\t\temitEvent("qerror", {\n\t\t\t\timportError: "sync",\n\t\t\t\terror,\n\t\t\t\t...eventData\n\t\t\t});\n\t\t\tconsole.error(error);\n\t\t}\n\t\treturn handler;\n\t}\n\tconst key = `${symbol}|${qBase}|${chunk}`;\n\tconst handler = symbols.get(key);\n\tif (handler) return handler;\n\tconst href = new URL(chunk, base).href;\n\tconst module = import(\n\t\t\t\thref\n);\n\tresolveContainer(container);\n\treturn module.then((module) => {\n\t\tconst handler = module[symbol];\n\t\tif (!handler) {\n\t\t\tconst error = /* @__PURE__ */ new Error(`${symbol} not in ${href}`);\n\t\t\temitEvent("qerror", {\n\t\t\t\timportError: "no-symbol",\n\t\t\t\terror,\n\t\t\t\t...eventData\n\t\t\t});\n\t\t\tconsole.error(error);\n\t\t} else {\n\t\t\tsymbols.set(key, handler);\n\t\t\temitEvent("qsymbol", eventData);\n\t\t}\n\t\treturn handler;\n\t}, (error) => {\n\t\temitEvent("qerror", {\n\t\t\timportError: "async",\n\t\t\terror,\n\t\t\t...eventData\n\t\t});\n\t\tconsole.error(error);\n\t});\n};\n/**\n* Dispatch an event by invoking QRL handlers. If there are multiple handlers, they are awaited in\n* order.\n*/\nvar dispatch = (element, ev, scopedKebabName, tasks, kebabName, allowPreventDefault = true) => {\n\tlet defer = false;\n\tif (kebabName) {\n\t\tif (allowPreventDefault && element.hasAttribute("preventdefault:" + kebabName)) ev.preventDefault();\n\t\tif (element.hasAttribute("stoppropagation:" + kebabName)) ev.stopPropagation();\n\t}\n\tconst handlers = element._qDispatch?.[scopedKebabName];\n\tif (handlers) {\n\t\tif (typeof handlers === "function") {\n\t\t\tconst run = () => handlers(ev, element);\n\t\t\tif (defer) tasks.push(async () => {\n\t\t\t\tconst result = run();\n\t\t\t\tif (isPromise(result)) await result;\n\t\t\t});\n\t\t\telse {\n\t\t\t\tconst result = run();\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tdefer = true;\n\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (handlers.length) for (let i = 0; i < handlers.length; i++) {\n\t\t\tconst handler = handlers[i];\n\t\t\tif (handler) {\n\t\t\t\tconst run = () => handler(ev, element);\n\t\t\t\tif (defer) tasks.push(async () => {\n\t\t\t\t\tconst result = run();\n\t\t\t\t\tif (isPromise(result)) await result;\n\t\t\t\t});\n\t\t\t\telse {\n\t\t\t\t\tconst result = run();\n\t\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\t\tdefer = true;\n\t\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\tconst attrValue = element.getAttribute("q-" + scopedKebabName);\n\tif (attrValue) {\n\t\tconst container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n\t\tconst qBase = container.getAttribute("q:base");\n\t\tconst base = new URL(qBase, doc.baseURI);\n\t\tconst qrls = attrValue.split("|");\n\t\tconst waitForReady = waitForContainerReady(container);\n\t\tfor (let i = 0; i < qrls.length; i++) {\n\t\t\tconst qrl = qrls[i];\n\t\t\tconst reqTime = performance.now();\n\t\t\tconst [chunk, symbol, capturedIds] = qrl.split("#");\n\t\t\tconst run = (handler) => {\n\t\t\t\tif (handler && element.isConnected) {\n\t\t\t\t\tconst onError = (error) => {\n\t\t\t\t\t\temitEvent("qerror", {\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\tqBase,\n\t\t\t\t\t\t\tsymbol,\n\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\treqTime\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = handler.call(capturedIds, ev, element);\n\t\t\t\t\t\tif (isPromise(result)) return result.catch(onError);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn onError(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst resolve = (reportSyncError = true) => resolveHandler(container, element, qBase, base, chunk, symbol, reqTime, reportSyncError);\n\t\t\tconst handler = waitForReady ? void 0 : resolve();\n\t\t\tif (waitForReady) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(async () => {\n\t\t\t\t\tawait waitForReady;\n\t\t\t\t\tawait run(await resolve(false) || await resolve());\n\t\t\t\t});\n\t\t\t} else if (isPromise(handler)) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(() => handler.then(run));\n\t\t\t} else if (defer) {\n\t\t\t\tdefer = true;\n\t\t\t\ttasks.push(async () => {\n\t\t\t\t\tawait run(handler || await resolve());\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst result = run(handler);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tdefer = true;\n\t\t\t\t\ttasks.push(() => result);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n/**\n* Event handler responsible for processing element events.\n*\n* If browser emits an event, the `eventProcessor` walks the DOM tree looking for corresponding\n* `(${event.type})`. If found the event\'s URL is parsed and `import()`ed.\n*\n* @param ev - Browser event.\n*/\nvar processElementEvent = (ev, scope = elementPrefix, allowPreventDefault = true) => {\n\tconst kebabName = camelToKebab(ev.type);\n\tconst scopedKebabName = scope + ":" + kebabName;\n\tconst captureAttribute = capturePrefix + kebabName;\n\tconst elements = [];\n\tconst captureHandlers = [];\n\tconst tasks = [];\n\tlet current = ev.target;\n\twhile (current) if (isElementNode(current)) {\n\t\telements.push(current);\n\t\tcaptureHandlers.push(isCaptureHandlerElement(current, scopedKebabName, captureAttribute));\n\t\tcurrent = current.parentElement;\n\t} else current = current.parentElement;\n\tfor (let i = elements.length - 1; i >= 0; i--) if (captureHandlers[i]) {\n\t\tdispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t\tif (ev.cancelBubble) {\n\t\t\tqueueTasks(tasks);\n\t\t\treturn;\n\t\t}\n\t}\n\tfor (let i = 0; i < elements.length; i++) if (!captureHandlers[i]) {\n\t\tdispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t\tif (!ev.bubbles || ev.cancelBubble) {\n\t\t\tqueueTasks(tasks);\n\t\t\treturn;\n\t\t}\n\t}\n\tqueueTasks(tasks);\n};\nvar processPassiveElementEvent = (ev) => processElementEvent(ev, passiveElementPrefix, false);\nvar broadcast = (scope, ev, allowPreventDefault = true) => {\n\tconst kebabName = camelToKebab(ev.type);\n\tconst scopedKebabName = scope + ":" + kebabName;\n\tconst elements = querySelectorAll("[q-" + CSS.escape(scopedKebabName) + "]");\n\tconst tasks = [];\n\tfor (let i = 0; i < elements.length; i++) {\n\t\tconst el = elements[i];\n\t\tdispatch(el, ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n\t}\n\tqueueTasks(tasks);\n};\n/**\n* Event handler responsible for processing browser events.\n*\n* If browser emits an event, the `eventProcessor` walks the DOM tree looking for corresponding\n* `(${event.type})`. If found the event\'s URL is parsed and `import()`ed.\n*\n* @param ev - Browser event.\n*/\nvar processDocumentEvent = (ev) => {\n\tbroadcast(documentPrefix, ev);\n};\nvar processPassiveDocumentEvent = (ev) => {\n\tbroadcast(passiveDocumentPrefix, ev, false);\n};\nvar processWindowEvent = (ev) => {\n\tbroadcast(windowPrefix, ev);\n};\nvar processPassiveWindowEvent = (ev) => {\n\tbroadcast(passiveWindowPrefix, ev, false);\n};\n/**\n* Called when the document is ready and whenever a container is added, so make this idempotent. For\n* qidle and qinit we remove the attributes immediately, and for qvisible we add an attribute\n*/\nvar processReadyStateChange = () => {\n\tconst readyState = doc.readyState;\n\tif (readyState == "interactive" || readyState == "complete") {\n\t\thasInitialized = 1;\n\t\troots.forEach(findShadowRoots);\n\t\tif (events.has("d:qinit")) {\n\t\t\tevents.delete("d:qinit");\n\t\t\tconst ev = createEvent("qinit");\n\t\t\tconst elements = querySelectorAll("[q-d\\\\:qinit]");\n\t\t\tconst tasks = [];\n\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\tconst el = elements[i];\n\t\t\t\tdispatch(el, ev, "d:qinit", tasks);\n\t\t\t\tel.removeAttribute("q-d:qinit");\n\t\t\t}\n\t\t\tqueueTasks(tasks);\n\t\t}\n\t\tif (events.has("d:qidle")) {\n\t\t\tevents.delete("d:qidle");\n\t\t\t(win.requestIdleCallback ?? win.setTimeout).bind(win)(() => {\n\t\t\t\tconst ev = createEvent("qidle");\n\t\t\t\tconst elements = querySelectorAll("[q-d\\\\:qidle]");\n\t\t\t\tconst tasks = [];\n\t\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\t\tconst el = elements[i];\n\t\t\t\t\tdispatch(el, ev, "d:qidle", tasks);\n\t\t\t\t\tel.removeAttribute("q-d:qidle");\n\t\t\t\t}\n\t\t\t\tqueueTasks(tasks);\n\t\t\t});\n\t\t}\n\t\tif (events.has("e:qvisible")) {\n\t\t\tobserver || (observer = new IntersectionObserver((entries) => {\n\t\t\t\tconst tasks = [];\n\t\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\t\tconst entry = entries[i];\n\t\t\t\t\tif (entry.isIntersecting) {\n\t\t\t\t\t\tobserver.unobserve(entry.target);\n\t\t\t\t\t\tdispatch(entry.target, createEvent("qvisible", entry), "e:qvisible", tasks);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tqueueTasks(tasks);\n\t\t\t}));\n\t\t\tconst elements = querySelectorAll("[q-e\\\\:qvisible]:not([q\\\\:observed])");\n\t\t\tfor (let i = 0; i < elements.length; i++) {\n\t\t\t\tconst el = elements[i];\n\t\t\t\tobserver.observe(el);\n\t\t\t\tel.setAttribute("q:observed", "true");\n\t\t\t}\n\t\t}\n\t}\n};\nvar addEventOrRoot = (...eventNames) => {\n\tfor (let i = 0; i < eventNames.length; i++) {\n\t\tconst eventNameOrRoot = eventNames[i];\n\t\tif (eventNameOrRoot === QwikEvContainerReady) markContainerReady(eventNames[++i]);\n\t\telse if (typeof eventNameOrRoot === "string") {\n\t\t\tif (!events.has(eventNameOrRoot)) {\n\t\t\t\tevents.add(eventNameOrRoot);\n\t\t\t\tconst { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n\t\t\t\tconst passive = isPassiveScope(scope);\n\t\t\t\tconst rootScope = getRootScope(scope);\n\t\t\t\tif (rootScope === windowPrefix) addEventListener(win, eventName, passive ? processPassiveWindowEvent : processWindowEvent, true, passive);\n\t\t\t\telse roots.forEach((root) => addEventListener(root, eventName, rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent, true, passive));\n\t\t\t\tif (hasInitialized === 1 && (eventNameOrRoot === "e:qvisible" || eventNameOrRoot === "d:qinit" || eventNameOrRoot === "d:qidle")) processReadyStateChange();\n\t\t\t}\n\t\t} else if (!roots.has(eventNameOrRoot)) {\n\t\t\tevents.forEach((kebabEventName) => {\n\t\t\t\tconst { scope, eventName } = parseKebabEvent(kebabEventName);\n\t\t\t\tconst passive = isPassiveScope(scope);\n\t\t\t\tconst rootScope = getRootScope(scope);\n\t\t\t\tif (rootScope !== windowPrefix) addEventListener(eventNameOrRoot, eventName, rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent, true, passive);\n\t\t\t});\n\t\t\troots.add(eventNameOrRoot);\n\t\t}\n\t}\n};\nvar _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n\tif (Array.isArray(_qwikEv)) addEventOrRoot(..._qwikEv);\n\telse addEventOrRoot("e:click", "e:input");\n\twin._qwikEv = {\n\t\tevents,\n\t\troots,\n\t\tpush: addEventOrRoot\n\t};\n\taddEventListener(doc, readyStateChange, processReadyStateChange);\n\tprocessReadyStateChange();\n}\n//#endregion';
1194
+
1195
+ var QWIK_BACKPATCH_EXECUTOR_MINIFIED = `var t='script[type="qwik/backpatch"]';function e(e,n){const o=n||e.querySelector("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");if(o){const n=o.querySelectorAll(t),r=n[n.length-1];if(r){const t=JSON.parse(r.textContent||"[]"),n=e.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);let c=n.currentNode,i=c.hasAttribute(":")?0:-1;for(let e=0;e<t.length;e+=3){const o=t[e],r=t[e+1];let l=t[e+2];for(;i<o&&(c=n.nextNode(),c);)c.hasAttribute(":")&&i++;const a=c;null==l||!1===l?a.removeAttribute(r):("boolean"==typeof l&&(l=""),a.setAttribute(r,l))}}}}var n=document.currentScript;if(n){const t=n.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");t&&e(document,t)}`;
1196
+
1197
+ var QWIK_BACKPATCH_EXECUTOR_DEBUG = '//#region packages/qwik/src/backpatch-executor-shared.ts\n/**\n* Shared backpatch executor logic that can be imported by both the inline script\n* (backpatch-executor.ts) and test utilities.\n*/\nvar BACKPATCH_DATA_SELECTOR = "script[type=\\"qwik/backpatch\\"]";\n/**\n* Execute backpatch operations on a document.\n*\n* @param doc - The document to execute backpatch on\n* @param containerElement - Optional specific container element (if not provided, will search for\n* it)\n*/\nfunction executeBackpatch(doc, containerElement) {\n\tconst container = containerElement || doc.querySelector("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n\tif (container) {\n\t\tconst scripts = container.querySelectorAll(BACKPATCH_DATA_SELECTOR);\n\t\tconst script = scripts[scripts.length - 1];\n\t\tif (script) {\n\t\t\tconst data = JSON.parse(script.textContent || "[]");\n\t\t\tconst walker = doc.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);\n\t\t\tlet currentNode = walker.currentNode;\n\t\t\tlet currentNodeIdx = currentNode.hasAttribute(":") ? 0 : -1;\n\t\t\tfor (let i = 0; i < data.length; i += 3) {\n\t\t\t\tconst elementIdx = data[i];\n\t\t\t\tconst attrName = data[i + 1];\n\t\t\t\tlet value = data[i + 2];\n\t\t\t\twhile (currentNodeIdx < elementIdx) {\n\t\t\t\t\tcurrentNode = walker.nextNode();\n\t\t\t\t\tif (!currentNode) break;\n\t\t\t\t\tif (currentNode.hasAttribute(":")) currentNodeIdx++;\n\t\t\t\t}\n\t\t\t\tconst element = currentNode;\n\t\t\t\tif (value == null || value === false) element.removeAttribute(attrName);\n\t\t\t\telse {\n\t\t\t\t\tif (typeof value === "boolean") value = "";\n\t\t\t\t\telement.setAttribute(attrName, value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n//#endregion\n//#region packages/qwik/src/backpatch-executor.ts\n/**\n* Qwik Backpatch Executor\n*\n* This script executes the backpatch operations by finding the backpatch data script within the\n* same container and applying the patches to the DOM elements.\n*\n* This is the inline script version that auto-executes when loaded in the browser. The actual logic\n* is in backpatch-executor-shared.ts for reusability.\n*/\nvar executorScript = document.currentScript;\nif (executorScript) {\n\tconst container = executorScript.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n\tif (container) executeBackpatch(document, container);\n}\n//#endregion';
1198
+
1199
+ var QWIK_OUT_OF_ORDER_EXECUTOR_MINIFIED = `var t='template[q\\\\:r="',e="q:r",r='[q\\\\:rp="',n="q:g",l="q:i",o="q:o",i="[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])",u=u=>{const s=new WeakMap,c=()=>{const t=u.currentScript;return t&&t.closest(i)||u},f=(t,e,r,n)=>{let l=s.get(t);return l||s.set(t,l={}),l[e]||(l[e]={r:{},n:0,t:r,o:n})},a=(t,e)=>t?(e&&e.style&&(e.style.display="none"),t.style&&(t.style.display="contents"),1):0,q=t=>{const e=t.o;let r,n,l=0;if("p"===e)for(const e in t.r)r=t.r[e],r[0]&&a(r[0],r[1])&&(r[0]=0,l++);else if("s"===e)for(n=t.n;(r=t.r[n])&&r[0]&&a(r[0],r[1]);n++)r[0]=0,l++,t.n=n+1;else if("r"===e){if(t.t<0)return 0;for(t.n<0&&(t.n=t.t-1),n=t.n;(r=t.r[n])&&r[0]&&a(r[0],r[1]);n--)r[0]=0,l++,t.n=n-1}else{if(t.t<0)return 0;for(n=0;n<t.t;n++)if(r=t.r[n],!r)return 0;for(n=0;n<t.t;n++)r=t.r[n],r[0]&&a(r[0],r[1])&&(r[0]=0,l++)}return l},p=i=>{const s=c(),p=((r,n)=>{const l=u.currentScript,o=l?l.previousElementSibling:null;if(o&&"template"===o.localName&&o.getAttribute(e)===n+"")return o;const i=r.querySelectorAll(t+n+'"]');return i.length?i[i.length-1]:null})(s,i);if(!p)return;const g=((e,n,l)=>{if(!l)return null;const o=((t,e)=>t.querySelector(r+e+'"]'))(e,n),i=o?((e,r)=>e.querySelector(t+r+'"]'))(o,n):null,u=i?i.parentNode:null;return i&&o&&u?(u.insertBefore(l.content,i),i.remove(),l.remove(),[o,o.previousElementSibling]):null})(s,i,p);if(!g)return;((t,e)=>{var r;const n=u;null===(r=n.qProcessOOOS)||void 0===r||r.call(n,t,e)})(i,g[0]||null);const m=p.getAttribute(n);if(m){const t=+(p.getAttribute(l)||0),e=f(s,m,-1,p.getAttribute(o)||"p");return e.r[t]=g,void q(e)}a(g[0]||null,g[1])};p.g=(t,e,r)=>{const n=f(c(),t,e,r);n.t=e,n.o=r,"r"===n.o&&0===n.n&&(n.n=e-1),q(n)},p.d=u,globalThis.qO=p};u(document)`;
1200
+
1201
+ var QWIK_OUT_OF_ORDER_EXECUTOR_DEBUG = '//#region packages/qwik/src/out-of-order-executor-shared.ts\n/** Shared out-of-order Suspense executor logic for the inline script and source tests. */\nvar Q_RESOLVED_SELECTOR = "template[q\\\\:r=\\"";\nvar Q_RESOLVED_ATTR = "q:r";\nvar Q_RESULT_PARENT_SELECTOR = "[q\\\\:rp=\\"";\nvar Q_GROUP_ATTR = "q:g";\nvar Q_INDEX_ATTR = "q:i";\nvar Q_ORDER_ATTR = "q:o";\nvar Q_CONTAINER_SELECTOR = "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])";\nvar installOutOfOrderExecutor = (doc) => {\n\tconst groups = /* @__PURE__ */ new WeakMap();\n\tconst process = (boundaryId, content) => {\n\t\tvar _executorDoc$qProcess;\n\t\tconst executorDoc = doc;\n\t\t(_executorDoc$qProcess = executorDoc.qProcessOOOS) === null || _executorDoc$qProcess === void 0 || _executorDoc$qProcess.call(executorDoc, boundaryId, content);\n\t};\n\tconst getScope = () => {\n\t\tconst script = doc.currentScript;\n\t\treturn script ? script.closest(Q_CONTAINER_SELECTOR) || doc : doc;\n\t};\n\tconst group = (scope, groupId, total, order) => {\n\t\tlet scopedGroups = groups.get(scope);\n\t\tif (!scopedGroups) groups.set(scope, scopedGroups = {});\n\t\treturn scopedGroups[groupId] || (scopedGroups[groupId] = {\n\t\t\tr: {},\n\t\t\tn: 0,\n\t\t\tt: total,\n\t\t\to: order\n\t\t});\n\t};\n\tconst getResolvedTemplate = (scope, boundaryId) => {\n\t\tconst currentScript = doc.currentScript;\n\t\tconst previousElement = currentScript ? currentScript.previousElementSibling : null;\n\t\tif (previousElement && previousElement.localName === "template" && previousElement.getAttribute(Q_RESOLVED_ATTR) === String(boundaryId)) return previousElement;\n\t\tconst templates = scope.querySelectorAll(Q_RESOLVED_SELECTOR + boundaryId + "\\"]");\n\t\treturn templates.length ? templates[templates.length - 1] : null;\n\t};\n\tconst getPlaceholderTemplate = (content, boundaryId) => {\n\t\treturn content.querySelector(Q_RESOLVED_SELECTOR + boundaryId + "\\"]");\n\t};\n\tconst getResultParent = (scope, boundaryId) => {\n\t\treturn scope.querySelector(Q_RESULT_PARENT_SELECTOR + boundaryId + "\\"]");\n\t};\n\tconst reveal = (content, fallback) => {\n\t\tif (!content) return 0;\n\t\tif (fallback && fallback.style) fallback.style.display = "none";\n\t\tif (content.style) content.style.display = "contents";\n\t\treturn 1;\n\t};\n\tconst move = (scope, boundaryId, resolved) => {\n\t\tif (!resolved) return null;\n\t\tconst content = getResultParent(scope, boundaryId);\n\t\tconst placeholder = content ? getPlaceholderTemplate(content, boundaryId) : null;\n\t\tconst parent = placeholder ? placeholder.parentNode : null;\n\t\tif (!placeholder || !content || !parent) return null;\n\t\tparent.insertBefore(resolved.content, placeholder);\n\t\tplaceholder.remove();\n\t\tresolved.remove();\n\t\treturn [content, content.previousElementSibling];\n\t};\n\tconst flush = (group) => {\n\t\tconst order = group.o;\n\t\tlet entry;\n\t\tlet index;\n\t\tlet swapped = 0;\n\t\tif (order === "p") for (const key in group.r) {\n\t\t\tentry = group.r[key];\n\t\t\tif (entry[0] && reveal(entry[0], entry[1])) {\n\t\t\t\tentry[0] = 0;\n\t\t\t\tswapped++;\n\t\t\t}\n\t\t}\n\t\telse if (order === "s") for (index = group.n; (entry = group.r[index]) && entry[0]; index++) {\n\t\t\tif (!reveal(entry[0], entry[1])) break;\n\t\t\tentry[0] = 0;\n\t\t\tswapped++;\n\t\t\tgroup.n = index + 1;\n\t\t}\n\t\telse if (order === "r") {\n\t\t\tif (group.t < 0) return 0;\n\t\t\tif (group.n < 0) group.n = group.t - 1;\n\t\t\tfor (index = group.n; (entry = group.r[index]) && entry[0]; index--) {\n\t\t\t\tif (!reveal(entry[0], entry[1])) break;\n\t\t\t\tentry[0] = 0;\n\t\t\t\tswapped++;\n\t\t\t\tgroup.n = index - 1;\n\t\t\t}\n\t\t} else {\n\t\t\tif (group.t < 0) return 0;\n\t\t\tfor (index = 0; index < group.t; index++) {\n\t\t\t\tentry = group.r[index];\n\t\t\t\tif (!entry) return 0;\n\t\t\t}\n\t\t\tfor (index = 0; index < group.t; index++) {\n\t\t\t\tentry = group.r[index];\n\t\t\t\tif (entry[0] && reveal(entry[0], entry[1])) {\n\t\t\t\t\tentry[0] = 0;\n\t\t\t\t\tswapped++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn swapped;\n\t};\n\tconst qO = ((boundaryId) => {\n\t\tconst scope = getScope();\n\t\tconst resolved = getResolvedTemplate(scope, boundaryId);\n\t\tif (!resolved) return;\n\t\tconst entry = move(scope, boundaryId, resolved);\n\t\tif (!entry) return;\n\t\tprocess(boundaryId, entry[0] || null);\n\t\tconst groupId = resolved.getAttribute(Q_GROUP_ATTR);\n\t\tif (groupId) {\n\t\t\tconst index = +(resolved.getAttribute(Q_INDEX_ATTR) || 0);\n\t\t\tconst currentGroup = group(scope, groupId, -1, resolved.getAttribute(Q_ORDER_ATTR) || "p");\n\t\t\tcurrentGroup.r[index] = entry;\n\t\t\tflush(currentGroup);\n\t\t\treturn;\n\t\t}\n\t\treveal(entry[0] || null, entry[1]);\n\t});\n\tqO.g = (groupId, total, order) => {\n\t\tconst currentGroup = group(getScope(), groupId, total, order);\n\t\tcurrentGroup.t = total;\n\t\tcurrentGroup.o = order;\n\t\tif (currentGroup.o === "r" && currentGroup.n === 0) currentGroup.n = total - 1;\n\t\tflush(currentGroup);\n\t};\n\tqO.d = doc;\n\tglobalThis.qO = qO;\n};\n//#endregion\n//#region packages/qwik/src/out-of-order-executor.ts\n/**\n* Qwik Out-of-Order Suspense Executor\n*\n* This is the inline script entry. The actual logic lives in out-of-order-executor-shared.ts so\n* source tests can install the same executor.\n*/\ninstallOutOfOrderExecutor(document);\n//#endregion';
1202
+
1203
+ function getQwikLoaderScript(t = {}) {
1204
+ return t.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
1205
+ }
1206
+
1207
+ var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
1208
+
1209
+ var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
1210
+
1211
+ function getQwikPrefetchWorkerScript(t = {}) {
1212
+ return t.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
1213
+ }
1214
+
1215
+ function getQwikBackpatchExecutorScript(t = {}) {
1216
+ return t.debug ? QWIK_BACKPATCH_EXECUTOR_DEBUG : QWIK_BACKPATCH_EXECUTOR_MINIFIED;
1217
+ }
1218
+
1219
+ function getQwikOutOfOrderExecutorScript(t = {}) {
1220
+ if (!__EXPERIMENTAL__.suspense) {
1221
+ return "";
1222
+ }
1223
+ const e = t.debug ? QWIK_OUT_OF_ORDER_EXECUTOR_DEBUG : QWIK_OUT_OF_ORDER_EXECUTOR_MINIFIED;
1224
+ return `if(!globalThis.qO||globalThis.qO.d!==document){${e}\n}`;
1225
+ }
1226
+
1227
+ // packages/qwik/src/server/ssr-node.ts
1228
+ import { _isJSXNode as to, _EMPTY_OBJ, _EFFECT_BACK_REF as Vi } from "@qwik.dev/core/internal";
1229
+
1230
+ import { isDev as isDev7 } from "@qwik.dev/core/build";
1231
+
1232
+ var SsrNode = class {
1233
+ constructor(t, e, n, r, s, i) {
1234
+ this.parentComponent = t;
1235
+ this.attributesIndex = n;
1236
+ this.cleanupQueue = r;
1237
+ this.vnodeData = s;
1238
+ this.currentFile = i;
1239
+ this.id = e;
1240
+ this.flags = 1 /* Updatable */;
1241
+ this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] : _EMPTY_OBJ;
1242
+ this.parentComponent?.addChild(this);
1243
+ if (isDev7 && e.indexOf("undefined") != -1) {
1244
+ throw new Error(`Invalid SSR node id: ${e}`);
1245
+ }
1246
+ }
1247
+ parentComponent;
1248
+ attributesIndex;
1249
+ cleanupQueue;
1250
+ vnodeData;
1251
+ currentFile;
1252
+ __brand__="SsrNode";
1253
+ /**
1254
+ * ID which the deserialize will use to retrieve the node.
1255
+ *
1256
+ * @param id - Unique id for the node.
1257
+ */
1258
+ id;
1259
+ flags;
1260
+ dirty=0 /* NONE */;
1261
+ children=null;
1262
+ attrs;
1263
+ /** Local props which don't serialize; */
1264
+ localProps=null;
1265
+ get [Vi]() {
1266
+ return this.getProp(wr);
1267
+ }
1268
+ setProp(t, e) {
1269
+ if (this.attrs === _EMPTY_OBJ) {
1270
+ this.setEmptyArrayAsVNodeDataAttributes();
1271
+ }
1272
+ if (t.startsWith(Dr)) {
1273
+ (this.localProps ||= {})[t] = e;
1274
+ } else {
1275
+ this.attrs[t] = e;
1276
+ }
1277
+ if (t == Or && e) {
1278
+ this.cleanupQueue.push(e);
1279
+ }
1280
+ }
1281
+ setEmptyArrayAsVNodeDataAttributes() {
1282
+ if (this.attributesIndex >= 0) {
1283
+ this.vnodeData[this.attributesIndex] = {};
1284
+ this.attrs = this.vnodeData[this.attributesIndex];
1285
+ } else {
1286
+ const t = this.vnodeData.length > 1 ? 1 : 0;
1287
+ this.vnodeData.splice(t, 0, {});
1288
+ this.attributesIndex = t;
1289
+ this.attrs = this.vnodeData[this.attributesIndex];
1290
+ }
1291
+ }
1292
+ getProp(t) {
1293
+ if (t.startsWith(Dr)) {
1294
+ return this.localProps ? this.localProps[t] ?? null : null;
1295
+ } else {
1296
+ return this.attrs[t] ?? null;
1297
+ }
1298
+ }
1299
+ removeProp(t) {
1300
+ if (t.startsWith(Dr)) {
1301
+ if (this.localProps) {
1302
+ delete this.localProps[t];
1303
+ }
1304
+ } else {
1305
+ delete this.attrs[t];
1306
+ }
1307
+ }
1308
+ addChild(t) {
1309
+ if (!this.children) {
1310
+ this.children = [];
1311
+ }
1312
+ this.children.push(t);
1313
+ }
1314
+ setTreeNonUpdatable() {
1315
+ if (this.flags & 1 /* Updatable */) {
1316
+ this.flags &= ~1 /* Updatable */;
1317
+ if (this.children) {
1318
+ for (let t = 0; t < this.children.length; t++) {
1319
+ const e = this.children[t];
1320
+ e.setTreeNonUpdatable();
1321
+ }
1322
+ }
1323
+ }
1324
+ }
1325
+ toString() {
1326
+ if (isDev7) {
1327
+ let t = "";
1328
+ for (const e in this.attrs) {
1329
+ const n = this.attrs[e];
1330
+ t += `${e}=`;
1331
+ t += `${typeof n === "string" || typeof n === "number" ? JSON.stringify(n) : "*"}`;
1332
+ t += ", ";
1333
+ }
1334
+ return `<SSRNode id="${this.id}" ${t} />`;
1335
+ } else {
1336
+ return `<SSRNode id="${this.id}" />`;
1337
+ }
1338
+ }
1339
+ };
1340
+
1341
+ var DomRef = class {
1342
+ constructor(t) {
1343
+ this.he = t;
1344
+ }
1345
+ he;
1346
+ __brand__="DomRef";
1347
+ };
1348
+
1349
+ var SsrComponentFrame = class {
1350
+ constructor(t) {
1351
+ this.componentNode = t;
1352
+ }
1353
+ componentNode;
1354
+ slots=[];
1355
+ projectionDepth=0;
1356
+ scopedStyleIds=/* @__PURE__ */ new Set;
1357
+ projectionScopedStyle=null;
1358
+ projectionComponentFrame=null;
1359
+ distributeChildrenIntoSlots(t, e, n) {
1360
+ this.projectionScopedStyle = e;
1361
+ this.projectionComponentFrame = n;
1362
+ if (to(t)) {
1363
+ const e = this.getSlotName(t);
1364
+ We(this.slots, e, t, 0);
1365
+ } else if (Array.isArray(t) && t.length > 0) {
1366
+ const e = [];
1367
+ for (let n = 0; n < t.length; n++) {
1368
+ const r = t[n];
1369
+ if (to(r)) {
1370
+ const t = this.getSlotName(r);
1371
+ if (t === QDefaultSlot) {
1372
+ e.push(r);
1373
+ } else {
1374
+ this.updateSlot(t, r);
1375
+ }
1376
+ } else {
1377
+ e.push(r);
1378
+ }
1379
+ }
1380
+ e.length > 0 && We(this.slots, QDefaultSlot, e, 0);
1381
+ } else {
1382
+ We(this.slots, QDefaultSlot, t, 0);
1383
+ }
1384
+ }
1385
+ updateSlot(t, e) {
1386
+ let n = Ue(this.slots, t, 0);
1387
+ if (n === null) {
1388
+ n = e;
1389
+ } else if (Array.isArray(n)) {
1390
+ n.push(e);
1391
+ } else {
1392
+ n = [ n, e ];
1393
+ }
1394
+ We(this.slots, t, n, 0);
1395
+ }
1396
+ getSlotName(t) {
1397
+ if (t.props[cr]) {
1398
+ return t.props[cr];
1399
+ }
1400
+ return QDefaultSlot;
1401
+ }
1402
+ hasSlot(t) {
1403
+ return Ve(this.slots, t, 0);
1404
+ }
1405
+ claimChildrenForSlot(t) {
1406
+ return mapApp_remove(this.slots, t, 0);
1407
+ }
1408
+ consumeChildrenForSlot(t, e) {
1409
+ const n = this.claimChildrenForSlot(e);
1410
+ this.componentNode.setProp(e, t.id);
1411
+ t.setProp(QSlotParent, this.componentNode.id);
1412
+ return n;
1413
+ }
1414
+ };
1415
+
1416
+ // packages/qwik/src/server/ssr-stream-writer.ts
1417
+ var renderSSRChunks = (t, e) => {
1418
+ let n = "";
1419
+ for (let r = 0; r < t.length; r++) {
1420
+ const s = t[r];
1421
+ if (typeof s === "string") {
1422
+ n += s;
1423
+ } else if (s.type === "root-ref-delta") {
1424
+ const t = e ? e[s.localId] ?? s.localId : s.localId;
1425
+ const r = e ? e[s.localBaseId] ?? s.localBaseId : s.localBaseId;
1426
+ n += String(t - r);
1427
+ } else {
1428
+ const t = s.type === "root-ref" ? s.localId : s.localPath[0];
1429
+ n += String(e ? e[t] ?? t : t);
1430
+ if (s.type !== "root-ref-path") {
1431
+ continue;
1432
+ }
1433
+ const r = s.localPath;
1434
+ for (let t = 1; t < r.length; t++) {
1435
+ n += " " + r[t];
1436
+ }
1437
+ }
1438
+ }
1439
+ return n;
1440
+ };
1441
+
1442
+ var StringSSRWriter = class {
1443
+ buffer=[];
1444
+ write(t) {
1445
+ this.buffer.push(t);
1446
+ }
1447
+ writeRootRef(t) {
1448
+ writeStringRootRef(this, t);
1449
+ }
1450
+ writeRootRefPath(t) {
1451
+ writeStringRootRefPath(this, t);
1452
+ }
1453
+ writeRootRefDelta(t, e) {
1454
+ writeStringRootRefDelta(this, t, e);
1455
+ }
1456
+ clear() {
1457
+ this.buffer.length = 0;
1458
+ }
1459
+ toString(t) {
1460
+ return this.buffer.join("");
1461
+ }
1462
+ };
1463
+
1464
+ var StringBufferSegmentWriter = class {
1465
+ chunks=[];
1466
+ write(t) {
1467
+ this.chunks.push(t);
1468
+ }
1469
+ writeRootRef(t) {
1470
+ this.chunks.push({
1471
+ type: "root-ref",
1472
+ localId: t
1473
+ });
1474
+ }
1475
+ writeRootRefPath(t) {
1476
+ this.chunks.push({
1477
+ type: "root-ref-path",
1478
+ localPath: t
1479
+ });
1480
+ }
1481
+ writeRootRefDelta(t, e) {
1482
+ this.chunks.push({
1483
+ type: "root-ref-delta",
1484
+ localId: t,
1485
+ localBaseId: e
1486
+ });
1487
+ }
1488
+ clear() {
1489
+ this.chunks.length = 0;
1490
+ }
1491
+ extract() {
1492
+ const t = this.chunks;
1493
+ this.chunks = [];
1494
+ return t;
1495
+ }
1496
+ toString(t) {
1497
+ return renderSSRChunks(this.chunks, t);
1498
+ }
1499
+ };
1500
+
1501
+ // packages/qwik/src/server/tag-nesting.ts
1502
+ var allowedContent = t => {
1503
+ switch (t) {
1504
+ case 2 /* TEXT */ :
1505
+ return [ "text content", null ];
1506
+
1507
+ case 0 /* NOT_ALLOWED */ :
1508
+ return [ "no content", null ];
1509
+
1510
+ case 32 /* HTML */ :
1511
+ return [ "html content", "<head>, <body>" ];
1512
+
1513
+ case 64 /* HEAD */ :
1514
+ return [ "head content", "<title>, <script>, <noscript>, <style>, <meta>, <link>, <base>, <template>" ];
1515
+
1516
+ case 130 /* BODY */ :
1517
+ return [ "body content", "all tags allowed here" ];
1518
+
1519
+ case 4 /* EMPTY */ :
1520
+ return [ "no-content element", null ];
1521
+
1522
+ case 10 /* ANYTHING */ :
1523
+ return [ "any content", null ];
1524
+
1525
+ case 4096 /* TABLE */ :
1526
+ return [ "table", "<caption>, <colgroup>, <tbody>, <thead>, <tfoot>" ];
1527
+
1528
+ case 8192 /* TABLE_BODY */ :
1529
+ return [ "table body", "<tr>" ];
1530
+
1531
+ case 16384 /* TABLE_ROW */ :
1532
+ return [ "table row", "<td>, <th>" ];
1533
+
1534
+ case 32768 /* TABLE_COLGROUP */ :
1535
+ return [ "table column group", "<col>" ];
1536
+
1537
+ case 258 /* PHRASING_ANY */ :
1538
+ case 514 /* PHRASING_INSIDE_INPUT */ :
1539
+ case 1026 /* PHRASING_CONTAINER */ :
1540
+ return [ "phrasing content", "<a>, <b>, <img>, <input> ... (no <div>, <p> ...)" ];
1541
+
1542
+ case 2050 /* PICTURE */ :
1543
+ return [ "picture content", "<source>, <img>" ];
1544
+
1545
+ case 4098 /* BUTTON */ :
1546
+ return [ "button content", "phrasing content except interactive elements" ];
1547
+
1548
+ case 1 /* DOCUMENT */ :
1549
+ return [ "document", "<html>" ];
1550
+ }
1551
+ };
1552
+
1553
+ var initialTag = t => {
1554
+ switch (t) {
1555
+ case "html":
1556
+ return 32 /* HTML */;
1557
+
1558
+ case "head":
1559
+ return 64 /* HEAD */;
1560
+
1561
+ case "body":
1562
+ return 130 /* BODY */;
1563
+
1564
+ default:
1565
+ return isTagAllowed(10 /* ANYTHING */ , t);
1566
+ }
1567
+ };
1568
+
1569
+ function isTagAllowed(t, e) {
1570
+ switch (t) {
1571
+ case 2 /* TEXT */ :
1572
+ case 0 /* NOT_ALLOWED */ :
1573
+ return 0 /* NOT_ALLOWED */;
1574
+
1575
+ case 32 /* HTML */ :
1576
+ return isInHtml(e);
1577
+
1578
+ case 64 /* HEAD */ :
1579
+ return isInHead(e);
1580
+
1581
+ case 130 /* BODY */ :
1582
+ case 10 /* ANYTHING */ :
1583
+ case 1026 /* PHRASING_CONTAINER */ :
1584
+ return isInAnything(e);
1585
+
1586
+ case 4096 /* TABLE */ :
1587
+ return isInTable(e);
1588
+
1589
+ case 8192 /* TABLE_BODY */ :
1590
+ return isInTableBody(e);
1591
+
1592
+ case 16384 /* TABLE_ROW */ :
1593
+ return isInTableRow(e);
1594
+
1595
+ case 32768 /* TABLE_COLGROUP */ :
1596
+ return isInTableColGroup(e);
1597
+
1598
+ case 258 /* PHRASING_ANY */ :
1599
+ return isInPhrasing(e, true);
1600
+
1601
+ case 514 /* PHRASING_INSIDE_INPUT */ :
1602
+ return isInPhrasing(e, false);
1603
+
1604
+ case 2050 /* PICTURE */ :
1605
+ return isInPicture(e);
1606
+
1607
+ case 4098 /* BUTTON */ :
1608
+ return isInButton(e);
1609
+
1610
+ case 1 /* DOCUMENT */ :
1611
+ if (e === "html") {
1612
+ return 32 /* HTML */;
1613
+ }
1614
+ }
1615
+ return 0 /* NOT_ALLOWED */;
1616
+ }
1617
+
1618
+ function isInHtml(t) {
1619
+ switch (t) {
1620
+ case "head":
1621
+ return 64 /* HEAD */;
1622
+
1623
+ case "body":
1624
+ return 130 /* BODY */;
1625
+
1626
+ default:
1627
+ return 0 /* NOT_ALLOWED */;
1628
+ }
1629
+ }
1630
+
1631
+ function isInHead(t) {
1632
+ switch (t) {
1633
+ case "title":
1634
+ case "script":
1635
+ case "noscript":
1636
+ case "style":
1637
+ return 2 /* TEXT */;
1638
+
1639
+ case "meta":
1640
+ case "link":
1641
+ case "base":
1642
+ return 4 /* EMPTY */;
1643
+
1644
+ case "template":
1645
+ return 10 /* ANYTHING */;
1646
+
1647
+ default:
1648
+ return 0 /* NOT_ALLOWED */;
1649
+ }
1650
+ }
1651
+
1652
+ function isSelfClosingTag(t) {
1653
+ switch (t) {
1654
+ case "area":
1655
+ case "base":
1656
+ case "basefont":
1657
+ case "bgsound":
1658
+ case "br":
1659
+ case "col":
1660
+ case "embed":
1661
+ case "frame":
1662
+ case "hr":
1663
+ case "img":
1664
+ case "input":
1665
+ case "keygen":
1666
+ case "link":
1667
+ case "meta":
1668
+ case "param":
1669
+ case "source":
1670
+ case "track":
1671
+ case "wbr":
1672
+ return true;
1673
+
1674
+ default:
1675
+ return false;
1676
+ }
1677
+ }
1678
+
1679
+ function isInAnything(t) {
1680
+ if (isSelfClosingTag(t)) {
1681
+ return 4 /* EMPTY */;
1682
+ }
1683
+ switch (t) {
1684
+ case "script":
1685
+ case "style":
1686
+ case "noscript":
1687
+ case "noframes":
1688
+ return 2 /* TEXT */;
1689
+
1690
+ case "p":
1691
+ case "pre":
1692
+ return 258 /* PHRASING_ANY */;
1693
+
1694
+ case "table":
1695
+ return 4096 /* TABLE */;
1696
+
1697
+ case "html":
1698
+ case "head":
1699
+ case "body":
1700
+ return 0 /* NOT_ALLOWED */;
1701
+
1702
+ case "button":
1703
+ return 4098 /* BUTTON */;
1704
+
1705
+ case "input":
1706
+ case "textarea":
1707
+ return 514 /* PHRASING_INSIDE_INPUT */;
1708
+
1709
+ case "picture":
1710
+ return 2050 /* PICTURE */;
1711
+
1712
+ default:
1713
+ return 10 /* ANYTHING */;
1714
+ }
1715
+ }
1716
+
1717
+ function isInTable(t) {
1718
+ switch (t) {
1719
+ case "caption":
1720
+ return 10 /* ANYTHING */;
1721
+
1722
+ case "colgroup":
1723
+ return 32768 /* TABLE_COLGROUP */;
1724
+
1725
+ case "thead":
1726
+ case "tbody":
1727
+ case "tfoot":
1728
+ return 8192 /* TABLE_BODY */;
1729
+
1730
+ case "script":
1731
+ return 2 /* TEXT */;
1732
+
1733
+ default:
1734
+ return 0 /* NOT_ALLOWED */;
1735
+ }
1736
+ }
1737
+
1738
+ function isInTableBody(t) {
1739
+ switch (t) {
1740
+ case "tr":
1741
+ return 16384 /* TABLE_ROW */;
1742
+
1743
+ case "script":
1744
+ return 2 /* TEXT */;
1745
+
1746
+ default:
1747
+ return 0 /* NOT_ALLOWED */;
1748
+ }
1749
+ }
1750
+
1751
+ function isInTableRow(t) {
1752
+ switch (t) {
1753
+ case "td":
1754
+ case "th":
1755
+ return 10 /* ANYTHING */;
1756
+
1757
+ case "script":
1758
+ return 2 /* TEXT */;
1759
+
1760
+ default:
1761
+ return 0 /* NOT_ALLOWED */;
1762
+ }
1763
+ }
1764
+
1765
+ function isInTableColGroup(t) {
1766
+ switch (t) {
1767
+ case "col":
1768
+ return 4 /* EMPTY */;
1769
+
1770
+ case "script":
1771
+ return 2 /* TEXT */;
1772
+
1773
+ default:
1774
+ return 0 /* NOT_ALLOWED */;
1775
+ }
1776
+ }
1777
+
1778
+ function isInPicture(t) {
1779
+ switch (t) {
1780
+ case "source":
1781
+ return 4 /* EMPTY */;
1782
+
1783
+ case "img":
1784
+ return 4 /* EMPTY */;
1785
+
1786
+ case "script":
1787
+ return 2 /* TEXT */;
1788
+
1789
+ default:
1790
+ return 0 /* NOT_ALLOWED */;
1791
+ }
1792
+ }
1793
+
1794
+ function isInButton(t) {
1795
+ switch (t) {
1796
+ case "button":
1797
+ case "input":
1798
+ case "textarea":
1799
+ case "select":
1800
+ case "a":
1801
+ return 0 /* NOT_ALLOWED */;
1802
+
1803
+ case "picture":
1804
+ return 2050 /* PICTURE */;
1805
+
1806
+ default:
1807
+ return isInPhrasing(t, false);
1808
+ }
1809
+ }
1810
+
1811
+ function isInPhrasing(t, e) {
1812
+ switch (t) {
1813
+ case "svg":
1814
+ case "math":
1815
+ return 1026 /* PHRASING_CONTAINER */;
1816
+
1817
+ case "input":
1818
+ case "textarea":
1819
+ return e ? 514 /* PHRASING_INSIDE_INPUT */ : 0 /* NOT_ALLOWED */;
1820
+
1821
+ case "a":
1822
+ case "abbr":
1823
+ case "area":
1824
+ case "audio":
1825
+ case "b":
1826
+ case "bdi":
1827
+ case "bdo":
1828
+ case "br":
1829
+ case "button":
1830
+ case "canvas":
1831
+ case "cite":
1832
+ case "code":
1833
+ case "command":
1834
+ case "data":
1835
+ case "datalist":
1836
+ case "del":
1837
+ case "dfn":
1838
+ case "em":
1839
+ case "embed":
1840
+ case "i":
1841
+ case "iframe":
1842
+ case "img":
1843
+ case "ins":
1844
+ case "itemprop":
1845
+ case "kbd":
1846
+ case "keygen":
1847
+ case "label":
1848
+ case "link":
1849
+ case "map":
1850
+ case "mark":
1851
+ case "meta":
1852
+ case "meter":
1853
+ case "noscript":
1854
+ case "object":
1855
+ case "option":
1856
+ case "output":
1857
+ case "progress":
1858
+ case "q":
1859
+ case "ruby":
1860
+ case "s":
1861
+ case "samp":
1862
+ case "select":
1863
+ case "slot":
1864
+ case "small":
1865
+ case "span":
1866
+ case "strong":
1867
+ case "sub":
1868
+ case "sup":
1869
+ case "template":
1870
+ case "time":
1871
+ case "u":
1872
+ case "var":
1873
+ case "video":
1874
+ case "wbr":
1875
+ return e ? 258 /* PHRASING_ANY */ : 514 /* PHRASING_INSIDE_INPUT */;
1876
+
1877
+ case "script":
1878
+ case "style":
1879
+ return 2 /* TEXT */;
1880
+
1881
+ case "picture":
1882
+ return 2050 /* PICTURE */;
1883
+
1884
+ default:
1885
+ return 0 /* NOT_ALLOWED */;
1886
+ }
1887
+ }
1888
+
1889
+ // packages/qwik/src/server/utils.ts
1890
+ function createTimer() {
1891
+ if (typeof performance === "undefined") {
1892
+ return () => 0;
1893
+ }
1894
+ const t = performance.now();
1895
+ return () => {
1896
+ const e = performance.now();
1897
+ const n = e - t;
1898
+ return n / 1e6;
1899
+ };
1900
+ }
1901
+
1902
+ function getBuildBase(t) {
1903
+ let e = t.base;
1904
+ if (typeof t.base === "function") {
1905
+ e = t.base(t);
1906
+ }
1907
+ if (typeof e === "string") {
1908
+ if (!e.endsWith("/")) {
1909
+ e += "/";
1910
+ }
1911
+ return e;
1912
+ }
1913
+ return `${import.meta.env?.BASE_URL || "/"}build/`;
1914
+ }
1915
+
1916
+ var versions = {
1917
+ qwik: "2.0.0-beta.40-dev+a459d55",
1918
+ qwikDom: "2.1.19"
1919
+ };
1920
+
1921
+ // packages/qwik/src/server/vnode-data.ts
1922
+ var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
1923
+
1924
+ var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
1925
+
1926
+ var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
1927
+
1928
+ function vNodeData_incrementElementCount(t) {
1929
+ const e = t.length;
1930
+ const n = e > 1 ? t[e - 1] : 0;
1931
+ if (n >= 0) {
1932
+ t.push(-1);
1933
+ } else {
1934
+ t[e - 1] = n - 1;
1935
+ }
1936
+ }
1937
+
1938
+ function vNodeData_addTextSize(t, e) {
1939
+ const n = t.length;
1940
+ const r = n > 1 ? t[n - 1] : 0;
1941
+ if (n > 1 && r >= 0) {
1942
+ t[0] |= 1 /* TEXT_DATA */;
1943
+ }
1944
+ t.push(e);
1945
+ if (e == 0) {
1946
+ t[0] |= 1 /* TEXT_DATA */;
1947
+ }
1948
+ }
1949
+
1950
+ function vNodeData_openFragment(t, e) {
1951
+ t.push(e, OPEN_FRAGMENT);
1952
+ t[0] |= 2 /* VIRTUAL_NODE */;
1953
+ }
1954
+
1955
+ function vNodeData_closeFragment(t) {
1956
+ t.push(CLOSE_FRAGMENT);
1957
+ }
1958
+
1959
+ function vNodeData_openElement(t) {
1960
+ t.push({}, WRITE_ELEMENT_ATTRS);
1961
+ t[0] |= 4 /* ELEMENT_NODE */;
1962
+ }
1963
+
1964
+ function vNodeData_createSsrNodeReference(t, e, n, r, s) {
1965
+ e[0] |= 8 /* REFERENCE */;
1966
+ const i = [ -1 ];
1967
+ let o = -1;
1968
+ for (let t = 1; t < e.length; t++) {
1969
+ const n = e[t];
1970
+ if (typeof n === "object" && n !== null) {
1971
+ o = t;
1972
+ t++;
1973
+ if (e[t] !== WRITE_ELEMENT_ATTRS) {
1974
+ i[i.length - 1]++;
1975
+ i.push(-1);
1976
+ }
1977
+ } else if (n === CLOSE_FRAGMENT) {
1978
+ i.pop();
1979
+ } else if (n < 0) {
1980
+ const t = 0 - n;
1981
+ i[i.length - 1] += t;
1982
+ } else {
1983
+ i[i.length - 1]++;
1984
+ }
1985
+ }
1986
+ let a = String(n);
1987
+ if (e[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
1988
+ for (let t = 0; t < i.length; t++) {
1989
+ const e = i[t];
1990
+ if (e >= 0) {
1991
+ a += encodeAsAlphanumeric(e);
1992
+ }
1993
+ }
1994
+ }
1995
+ return new SsrNode(t, a, o, r, e, s);
1996
+ }
1997
+
1998
+ var ALPHANUMERIC = [];
1999
+
2000
+ function encodeAsAlphanumeric(t) {
2001
+ while (ALPHANUMERIC.length <= t) {
2002
+ let t = ALPHANUMERIC.length;
2003
+ let e = "";
2004
+ do {
2005
+ e = String.fromCharCode((e.length === 0 ? 65 : 97) + t % 26
2006
+ /* A-Z */) + e;
2007
+ t = Math.floor(t / 26
2008
+ /* A-Z */);
2009
+ } while (t !== 0);
2010
+ ALPHANUMERIC.push(e);
2011
+ }
2012
+ return ALPHANUMERIC[t];
2013
+ }
2014
+
2015
+ // packages/qwik/src/server/ssr-container.ts
2016
+ var VALID_ELEMENT_NAME = /^[A-Za-z][A-Za-z0-9._:-]*$/;
2017
+
2018
+ var NO_SCRIPT_HERE_ELEMENTS = /* @__PURE__ */ new Set([ "script", "style", "textarea", "title", "iframe", "noframes", "noscript", "xmp", "template", "svg", "math" ]);
2019
+
2020
+ function ssrCreateContainer(t) {
2021
+ t.renderOptions ||= {};
2022
+ return new SSRContainer({
2023
+ tagName: t.tagName || "div",
2024
+ writer: t.writer || new StringSSRWriter,
2025
+ streamHandler: t.streamHandler,
2026
+ locale: t.locale || "",
2027
+ timing: t.timing || {
2028
+ firstFlush: 0,
2029
+ render: 0,
2030
+ snapshot: 0
2031
+ },
2032
+ buildBase: t.buildBase || "/build/",
2033
+ resolvedManifest: t.resolvedManifest || {
2034
+ mapper: {},
2035
+ manifest: {
2036
+ manifestHash: "dev",
2037
+ mapping: {}
2038
+ }
2039
+ },
2040
+ renderOptions: t.renderOptions
2041
+ });
2042
+ }
2043
+
2044
+ var noopStreamHandler = {
2045
+ flush() {},
2046
+ waitForPendingFlush() {},
2047
+ streamBlockStart() {},
2048
+ streamBlockEnd() {}
2049
+ };
2050
+
2051
+ var QTemplateProps = {
2052
+ hidden: true,
2053
+ "aria-hidden": true
2054
+ };
2055
+
2056
+ var SSRContainer = class extends Cc {
2057
+ tag;
2058
+ isHtml;
2059
+ writer;
2060
+ streamHandler;
2061
+ timing;
2062
+ size=0;
2063
+ resolvedManifest;
2064
+ symbolToChunkResolver;
2065
+ renderOptions;
2066
+ outOfOrderStreaming;
2067
+ serializationCtx;
2068
+ // Sometimes there is no app state, but framework metadata still points to a vnode id.
2069
+ // For example, an OOOS segment can point outside the segment to a root vnode through
2070
+ // q:sparent, so root vnode data must still be emitted for the client ref table.
2071
+ hasVNodeRefsForSerialization=false;
2072
+ /**
2073
+ * We use this to append additional nodes in the head node
2074
+ *
2075
+ * - From manifest injections
2076
+ * - From useStyles and useScopedStyles hooks
2077
+ */
2078
+ additionalHeadNodes=new Array;
2079
+ /**
2080
+ * We use this to append additional nodes in the body node
2081
+ *
2082
+ * - From manifest injections
2083
+ */
2084
+ additionalBodyNodes=new Array;
2085
+ lastNode=null;
2086
+ currentComponentNode=null;
2087
+ styleIds=/* @__PURE__ */ new Set;
2088
+ isBackpatchExecutorEmitted=false;
2089
+ isOutOfOrderExecutorEmitted=false;
2090
+ backpatchMap=/* @__PURE__ */ new Map;
2091
+ currentElementFrame=null;
2092
+ renderTimer;
2093
+ /**
2094
+ * Current element index.
2095
+ *
2096
+ * This number must match the depth-first traversal of the DOM elements as returned by the
2097
+ * https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
2098
+ */
2099
+ depthFirstElementCount=-1;
2100
+ vNodeDatas=[];
2101
+ vNodeDataOffset=0;
2102
+ componentStack=[];
2103
+ cleanupQueue=[];
2104
+ emitContainerDataFrame=null;
2105
+ Ht=randomStr();
2106
+ // Temporary flag to find missing roots after the state was serialized
2107
+ t=false;
2108
+ qlInclude;
2109
+ promiseAttributes=null;
2110
+ vnodeSegment=null;
2111
+ i=0 /* NotReady */;
2112
+ // OOOS related fields
2113
+ outOfOrderId=0;
2114
+ outOfOrderUsed=false;
2115
+ outOfOrderPendingSegments=[];
2116
+ outOfOrderSegments=[];
2117
+ rootContainerReadyPromise=null;
2118
+ resolveRootContainerReady=null;
2119
+ renderQueue=Promise.resolve();
2120
+ emittedQwikEventNames=/* @__PURE__ */ new Set;
2121
+ emittedSyncFnCount=0;
2122
+ rootContainerSerializedRootCount=0;
2123
+ emittedVNodeDataOwners=null;
2124
+ constructor(t) {
2125
+ super(t.renderOptions.serverData ?? {}, t.locale);
2126
+ this.symbolToChunkResolver = t => {
2127
+ const e = t.lastIndexOf("_");
2128
+ const n = this.resolvedManifest.mapper[e == -1 ? t : t.substring(e + 1)];
2129
+ return n ? n[1] : "";
2130
+ };
2131
+ this.serializationCtx = this.serializationCtxFactory(SsrNode, DomRef, this.symbolToChunkResolver, t.writer);
2132
+ this.renderTimer = createTimer();
2133
+ this.tag = t.tagName;
2134
+ this.isHtml = t.tagName === "html";
2135
+ this.writer = t.writer;
2136
+ this.streamHandler = t.streamHandler;
2137
+ this.timing = t.timing;
2138
+ this.De = t.buildBase;
2139
+ this.resolvedManifest = t.resolvedManifest;
2140
+ this.renderOptions = t.renderOptions;
2141
+ const e = this.renderOptions.streaming?.outOfOrder === true;
2142
+ if (!__EXPERIMENTAL__.suspense) {
2143
+ if (e) {
2144
+ throw new Error('Out-of-order Suspense streaming requires `experimental: ["suspense"]` in the `qwikVite` plugin.');
2145
+ }
2146
+ this.outOfOrderStreaming = false;
2147
+ } else {
2148
+ this.outOfOrderStreaming = e;
2149
+ }
2150
+ this.Fe = 1e5;
2151
+ const n = this.renderOptions.qwikLoader;
2152
+ this.qlInclude = n ? typeof n === "object" ? n.include === "never" ? 2 /* Done */ : 0 /* Module */ : n === "inline" ? 1 /* Inline */ : n === "never" ? 2 /* Done */ : 0 /* Module */ : 0 /* Module */;
2153
+ if (this.qlInclude === 0 /* Module */) {
2154
+ const t = this.resolvedManifest?.manifest.qwikLoader;
2155
+ if (!t) {
2156
+ this.qlInclude = 1 /* Inline */;
2157
+ }
2158
+ }
2159
+ this.m();
2160
+ }
2161
+ ensureProjectionResolved(t) {}
2162
+ handleError(t, e) {
2163
+ throw t;
2164
+ }
2165
+ addBackpatchEntry(t, e, n) {
2166
+ const r = parseInt(t, 10);
2167
+ const s = {
2168
+ attrName: e,
2169
+ value: n
2170
+ };
2171
+ const i = this.backpatchMap.get(r) || [];
2172
+ i.push(s);
2173
+ this.backpatchMap.set(r, i);
2174
+ }
2175
+ async render(t) {
2176
+ this.openContainer();
2177
+ await this.renderJSX(t, {
2178
+ currentStyleScoped: null,
2179
+ parentComponentFrame: this.getComponentFrame()
2180
+ });
2181
+ await this.closeContainer();
2182
+ }
2183
+ async renderJSX(t, e) {
2184
+ await zn(this, t, e);
2185
+ }
2186
+ v() {
2187
+ return this.i === 2 /* OOOSReady */;
2188
+ }
2189
+ /** Queue OOOS serialization/write work that must not overlap with root state serialization. */ S(t) {
2190
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
2191
+ return t();
2192
+ }
2193
+ if (this.i === 0 /* NotReady */) {
2194
+ return t();
2195
+ }
2196
+ const e = this.i === 1 /* DataStreamStarted */ ? this.renderQueue.then(() => this.A()).then(t) : this.renderQueue.then(t);
2197
+ this.renderQueue = e.catch(() => {});
2198
+ return e;
2199
+ }
2200
+ A() {
2201
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || this.v()) {
2202
+ return;
2203
+ }
2204
+ return this.rootContainerReadyPromise ||= new Promise(t => {
2205
+ this.resolveRootContainerReady = t;
2206
+ });
2207
+ }
2208
+ C() {
2209
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || this.v()) {
2210
+ return;
2211
+ }
2212
+ this.rootContainerSerializedRootCount = this.serializationCtx.le.length;
2213
+ this.i = 2 /* OOOSReady */;
2214
+ this.resolveRootContainerReady?.();
2215
+ this.resolveRootContainerReady = null;
2216
+ this.rootContainerReadyPromise = null;
2217
+ }
2218
+ nextOutOfOrderId() {
2219
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
2220
+ return 0;
2221
+ }
2222
+ this.outOfOrderUsed = true;
2223
+ return ++this.outOfOrderId;
2224
+ }
2225
+ emitOutOfOrderSegmentScripts(t) {
2226
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !t) {
2227
+ return;
2228
+ }
2229
+ this.write(t);
2230
+ }
2231
+ async segment(t, e, n) {
2232
+ if (!__EXPERIMENTAL__.suspense) {
2233
+ throw new Error('Out-of-order Suspense streaming requires `experimental: ["suspense"]` in the `qwikVite` plugin.');
2234
+ }
2235
+ if (!this.outOfOrderStreaming) {
2236
+ throw new Error("Out-of-order Suspense streaming requires `streaming.outOfOrder` to be `true`.");
2237
+ }
2238
+ this.markVNodeRefForSerialization(n.parentComponentFrame?.componentNode);
2239
+ const r = new StringBufferSegmentWriter;
2240
+ const s = this.createSegmentContainer(t, r);
2241
+ this.outOfOrderSegments.push(s);
2242
+ try {
2243
+ await s.renderJSX(e, n);
2244
+ await s.resolvePromiseAttributes();
2245
+ const t = r.extract();
2246
+ return {
2247
+ container: s,
2248
+ writer: r,
2249
+ htmlChunks: t
2250
+ };
2251
+ } catch (t) {
2252
+ this.removeOutOfOrderSegment(s);
2253
+ throw t;
2254
+ }
2255
+ }
2256
+ I() {
2257
+ let t = this;
2258
+ while (t instanceof SSRSegmentContainer) {
2259
+ t = t.Le;
2260
+ }
2261
+ return t;
2262
+ }
2263
+ createSegmentContainer(t, e) {
2264
+ const n = this.I();
2265
+ const r = this.getOrCreateLastNode();
2266
+ this.addRoot(r);
2267
+ this.markVNodeRefForSerialization(r);
2268
+ const s = {
2269
+ tagNesting: 10 /* ANYTHING */ ,
2270
+ parent: null,
2271
+ elementName: "#segment",
2272
+ depthFirstElementIdx: -1,
2273
+ // OOOS inserts this synthetic root under the Suspense content host on the client.
2274
+ vNodeData: [ 16 /* SERIALIZE */ ],
2275
+ currentFile: null,
2276
+ refBase: r.id
2277
+ };
2278
+ const i = new SSRSegmentContainer({
2279
+ tagName: this.tag,
2280
+ writer: e,
2281
+ streamHandler: noopStreamHandler,
2282
+ locale: this.en,
2283
+ timing: this.timing,
2284
+ buildBase: this.De || "/build/",
2285
+ resolvedManifest: this.resolvedManifest,
2286
+ renderOptions: this.renderOptions
2287
+ }, n);
2288
+ const o = i;
2289
+ o.Bn = true;
2290
+ o.yt = this.yt;
2291
+ i.serializationCtx = i.serializationCtxFactory(SsrNode, DomRef, this.symbolToChunkResolver, e);
2292
+ i.serializationCtx.Et = this.serializationCtx.Et.bind(this.serializationCtx);
2293
+ i.currentElementFrame = s;
2294
+ i.currentComponentNode = this.currentComponentNode;
2295
+ i.depthFirstElementCount = 0;
2296
+ i.vNodeDatas = [ s.vNodeData ];
2297
+ i.componentStack = this.componentStack.slice();
2298
+ i.vnodeSegment = t;
2299
+ i.styleIds = this.styleIds;
2300
+ i.emittedQwikEventNames = this.emittedQwikEventNames;
2301
+ i.qlInclude = 2 /* Done */;
2302
+ i.Ht = this.Ht;
2303
+ o._didAddQwikLoader = true;
2304
+ return i;
2305
+ }
2306
+ queueOutOfOrderSegment(t) {
2307
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
2308
+ return;
2309
+ }
2310
+ this.outOfOrderPendingSegments.push(t);
2311
+ }
2312
+ removeOutOfOrderSegment(t) {
2313
+ const e = this.outOfOrderSegments;
2314
+ for (let n = 0; n < e.length; n++) {
2315
+ if (e[n] === t) {
2316
+ e.splice(n, 1);
2317
+ return;
2318
+ }
2319
+ }
2320
+ }
2321
+ setContext(t, e, n) {
2322
+ const r = t;
2323
+ let s = r.getProp(mr);
2324
+ if (s == null) {
2325
+ r.setProp(mr, s = []);
2326
+ }
2327
+ We(s, e.id, n, 0, true);
2328
+ this.addRoot(r);
2329
+ }
2330
+ resolveContext(t, e) {
2331
+ let n = t;
2332
+ while (n) {
2333
+ const t = n.getProp(mr);
2334
+ if (t != null && Ve(t, e.id, 0)) {
2335
+ return Ue(t, e.id, 0);
2336
+ }
2337
+ n = n.parentComponent;
2338
+ }
2339
+ return void 0;
2340
+ }
2341
+ getParentHost(t) {
2342
+ const e = t;
2343
+ return e.parentComponent;
2344
+ }
2345
+ setHostProp(t, e, n) {
2346
+ const r = t;
2347
+ return r.setProp(e, n);
2348
+ }
2349
+ getHostProp(t, e) {
2350
+ const n = t;
2351
+ return n.getProp(e);
2352
+ }
2353
+ /**
2354
+ * Renders opening tag for container. It could be a html tag for regular apps or custom element
2355
+ * for micro-frontends
2356
+ */ openContainer() {
2357
+ if (this.tag == "html") {
2358
+ this.write("<!DOCTYPE html>");
2359
+ }
2360
+ const t = this.renderOptions.containerAttributes || {};
2361
+ const e = t[QRenderAttr];
2362
+ t[kr] = "paused" /* PAUSED */;
2363
+ t[QRuntimeAttr] = "2";
2364
+ t[QVersionAttr] = this.je ?? "dev";
2365
+ t[QRenderAttr] = (e ? e + "-" : "") + (isDev8 ? "ssr-dev" : "ssr");
2366
+ t[br] = this.De || "";
2367
+ t[QLocaleAttr] = this.en;
2368
+ t[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
2369
+ t[QInstanceAttr] = this.Ht;
2370
+ const n = this.renderOptions.statePrewarm;
2371
+ if (typeof n === "number") {
2372
+ t[QStatePrewarmAttr] = String(n);
2373
+ } else {
2374
+ delete t[QStatePrewarmAttr];
2375
+ }
2376
+ this.un.containerAttributes = t;
2377
+ this.openElement(this.tag, null, t);
2378
+ if (!this.isHtml) {
2379
+ this.emitContainerDataFrame = this.currentElementFrame;
2380
+ }
2381
+ }
2382
+ /** Renders closing tag for current container */ closeContainer() {
2383
+ return this.closeElement();
2384
+ }
2385
+ Tt=0;
2386
+ /** Renders opening tag for DOM element */
2387
+ openElement(t, e, n, r = null, s = null, i = null, o = true) {
2388
+ if (!VALID_ELEMENT_NAME.test(t)) {
2389
+ throw Ye(36 /* invalidElementName */ , [ JSON.stringify(t) ]);
2390
+ }
2391
+ const a = isQwikStyleElement(t, n) || isQwikStyleElement(t, r);
2392
+ if (NO_SCRIPT_HERE_ELEMENTS.has(t)) {
2393
+ this.Tt++;
2394
+ }
2395
+ if (
2396
+ // don't append qwik loader before qwik style elements
2397
+ // it will confuse the resuming, because styles are expected to be the first nodes in subtree
2398
+ !a && this.qlInclude === 1 /* Inline */) {
2399
+ if (this.Tt === 0 && this.size > 30 * 1024 && t !== "body") {
2400
+ this.emitQwikLoaderInline();
2401
+ }
2402
+ }
2403
+ let l = void 0;
2404
+ this.lastNode = null;
2405
+ if (!a && this.currentElementFrame) {
2406
+ vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
2407
+ }
2408
+ this.createAndPushFrame(t, this.depthFirstElementCount++, i);
2409
+ if (this.isHtml && t === "body" && this.emitContainerDataFrame === null) {
2410
+ this.emitContainerDataFrame = this.currentElementFrame;
2411
+ }
2412
+ vNodeData_openElement(this.currentElementFrame.vNodeData);
2413
+ this.write(LT);
2414
+ this.write(t);
2415
+ const c = this.getOrCreateLastNode();
2416
+ if (n) {
2417
+ l = this.writeAttrs(t, n, false, s, i, o);
2418
+ }
2419
+ this.write(" " + Br);
2420
+ if (e !== null) {
2421
+ this.write(ATTR_EQUALS_QUOTE);
2422
+ this.write(escapeHTML(e));
2423
+ this.write(Li);
2424
+ } else if (qTest) {
2425
+ this.write(EMPTY_ATTR);
2426
+ }
2427
+ if (r && !Oi(r)) {
2428
+ l = this.writeAttrs(t, r, true, s, i, o) || l;
2429
+ }
2430
+ this.write(GT);
2431
+ if (c) {
2432
+ c.setTreeNonUpdatable();
2433
+ }
2434
+ return l;
2435
+ }
2436
+ /** Renders closing tag for DOM element */ closeElement() {
2437
+ if (this.currentElementFrame === this.emitContainerDataFrame) {
2438
+ this.emitContainerDataFrame = null;
2439
+ this.onRenderDone();
2440
+ const t = createTimer();
2441
+ return Kr(Kr(this.emitContainerData(), () => this._closeElement()), () => {
2442
+ this.timing.snapshot = t();
2443
+ });
2444
+ }
2445
+ this._closeElement();
2446
+ }
2447
+ onRenderDone() {
2448
+ this.drainCleanupQueue();
2449
+ this.timing.render = this.renderTimer();
2450
+ }
2451
+ /** Drain cleanup queue and cleanup tasks etc. */ drainCleanupQueue() {
2452
+ let t = this.cleanupQueue.pop();
2453
+ while (t) {
2454
+ for (let e = 0; e < t.length; e++) {
2455
+ const n = t[e];
2456
+ if (hasDestroy(n)) {
2457
+ n.cn();
2458
+ }
2459
+ }
2460
+ t = this.cleanupQueue.pop();
2461
+ }
2462
+ }
2463
+ _closeElement() {
2464
+ const t = this.popFrame();
2465
+ const e = t.elementName;
2466
+ if (!isSelfClosingTag(e)) {
2467
+ this.write(CLOSE_TAG);
2468
+ this.write(e);
2469
+ this.write(GT);
2470
+ }
2471
+ this.lastNode = null;
2472
+ if (NO_SCRIPT_HERE_ELEMENTS.has(e)) {
2473
+ this.Tt--;
2474
+ }
2475
+ }
2476
+ /** Writes opening data to vNodeData for fragment boundaries */ openFragment(t) {
2477
+ this.lastNode = null;
2478
+ vNodeData_openFragment(this.currentElementFrame.vNodeData, t);
2479
+ this.getOrCreateLastNode();
2480
+ }
2481
+ /** Writes closing data to vNodeData for fragment boundaries */ closeFragment() {
2482
+ vNodeData_closeFragment(this.currentElementFrame.vNodeData);
2483
+ if (this.currentComponentNode) {
2484
+ this.currentComponentNode.setTreeNonUpdatable();
2485
+ }
2486
+ this.lastNode = null;
2487
+ }
2488
+ openProjection(t) {
2489
+ this.openFragment(t);
2490
+ const e = this.getComponentFrame();
2491
+ if (e) {
2492
+ const t = this.getOrCreateLastNode();
2493
+ this.markVNodeRefForSerialization(t);
2494
+ if (!this.vnodeSegment) {
2495
+ this.addRoot(e.componentNode);
2496
+ } else {
2497
+ this.markVNodeRefForSerialization(e.componentNode);
2498
+ }
2499
+ e.projectionDepth++;
2500
+ }
2501
+ }
2502
+ closeProjection() {
2503
+ const t = this.getComponentFrame();
2504
+ if (t) {
2505
+ t.projectionDepth--;
2506
+ }
2507
+ this.closeFragment();
2508
+ }
2509
+ /** Writes opening data to vNodeData for component boundaries */ openComponent(t) {
2510
+ this.openFragment(t);
2511
+ this.currentComponentNode = this.getOrCreateLastNode();
2512
+ this.componentStack.push(new SsrComponentFrame(this.currentComponentNode));
2513
+ }
2514
+ /**
2515
+ * Returns the current component frame.
2516
+ *
2517
+ * @param projectionDepth - How many levels of projection to skip. This is needed when projections
2518
+ * are nested inside other projections we need to have a way to read from a frame above.
2519
+ * @returns
2520
+ */ getComponentFrame(t = 0) {
2521
+ const e = this.componentStack.length;
2522
+ const n = e - t - 1;
2523
+ return n >= 0 ? this.componentStack[n] : null;
2524
+ }
2525
+ getParentComponentFrame() {
2526
+ const t = this.getComponentFrame()?.projectionDepth || 0;
2527
+ return this.getComponentFrame(t);
2528
+ }
2529
+ /** Writes closing data to vNodeData for component boundaries and emit unclaimed projections inline */ async closeComponent() {
2530
+ const t = this.componentStack.pop();
2531
+ await this.emitUnclaimedProjectionForComponent(t);
2532
+ this.closeFragment();
2533
+ this.currentComponentNode = this.currentComponentNode?.parentComponent || null;
2534
+ }
2535
+ async emitUnclaimedProjectionForComponent(t) {
2536
+ if (t.slots.length === 0) {
2537
+ return;
2538
+ }
2539
+ this.openElement(Pr, null, QTemplateProps, null);
2540
+ const e = t.projectionScopedStyle;
2541
+ for (let n = 0; n < t.slots.length; n += 2) {
2542
+ const r = t.slots[n];
2543
+ const s = t.slots[n + 1];
2544
+ if (this.vnodeSegment) {
2545
+ this.markVNodeRefForSerialization(t.componentNode);
2546
+ }
2547
+ this.openFragment(isDev8 ? {
2548
+ [Ze]: "P" /* Projection */ ,
2549
+ [QSlotParent]: t.componentNode.id,
2550
+ [cr]: r
2551
+ } : {
2552
+ [QSlotParent]: t.componentNode.id,
2553
+ [cr]: r
2554
+ });
2555
+ const i = this.getOrCreateLastNode();
2556
+ i.vnodeData[0] |= 16 /* SERIALIZE */;
2557
+ t.componentNode.setProp(r, i.id);
2558
+ await this.renderJSX(s, {
2559
+ currentStyleScoped: e,
2560
+ parentComponentFrame: t.projectionComponentFrame
2561
+ });
2562
+ this.closeFragment();
2563
+ }
2564
+ this.closeElement();
2565
+ }
2566
+ /** Write a text node with correct escaping. Save the length of the text node in the vNodeData. */ textNode(t) {
2567
+ this.write(escapeHTML(t));
2568
+ vNodeData_addTextSize(this.currentElementFrame.vNodeData, t.length);
2569
+ this.lastNode = null;
2570
+ }
2571
+ htmlNode(t) {
2572
+ this.write(t);
2573
+ }
2574
+ commentNode(t) {
2575
+ this.write("\x3c!--" + t + "--\x3e");
2576
+ }
2577
+ addRoot(t) {
2578
+ if (this.t) {
2579
+ const e = this.serializationCtx.Ne(t);
2580
+ return e;
2581
+ }
2582
+ return this.serializationCtx.Rt(t);
2583
+ }
2584
+ getOrCreateLastNode() {
2585
+ if (!this.lastNode) {
2586
+ const t = this.currentElementFrame;
2587
+ const e = t.depthFirstElementIdx + 1;
2588
+ const n = t.refBase ?? (this.vnodeSegment ? ir(this.vnodeSegment, e) : e + this.vNodeDataOffset);
2589
+ this.lastNode = vNodeData_createSsrNodeReference(this.currentComponentNode, t.vNodeData, n, this.cleanupQueue, t.currentFile);
2590
+ }
2591
+ return this.lastNode;
2592
+ }
2593
+ addUnclaimedProjection(t, e, n) {
2594
+ t.slots.push(e, n);
2595
+ }
2596
+ m() {
2597
+ const t = this.resolvedManifest.manifest.injections;
2598
+ if (!t) {
2599
+ return;
2600
+ }
2601
+ for (let e = 0; e < t.length; e++) {
2602
+ const n = t[e];
2603
+ const r = ao(n.tag, null, n.attributes || {}, null, 0, null);
2604
+ if (n.location === "head") {
2605
+ this.additionalHeadNodes.push(r);
2606
+ } else {
2607
+ this.additionalBodyNodes.push(r);
2608
+ }
2609
+ }
2610
+ }
2611
+ Ye(t, e, n, r) {
2612
+ if (r) {
2613
+ const t = this.getComponentFrame(0);
2614
+ t.scopedStyleIds.add(e);
2615
+ const r = convertStyleIdsToString(t.scopedStyleIds);
2616
+ this.setHostProp(n, yr, r);
2617
+ }
2618
+ if (!this.styleIds.has(e)) {
2619
+ this.styleIds.add(e);
2620
+ if (this.currentElementFrame?.elementName === "html") {
2621
+ this.additionalHeadNodes.push(fo("style", null, {
2622
+ dangerouslySetInnerHTML: t,
2623
+ [dr]: e
2624
+ }, null, 0, e));
2625
+ } else {
2626
+ this._styleNode(e, t);
2627
+ }
2628
+ }
2629
+ }
2630
+ _styleNode(t, e) {
2631
+ this.openElement("style", null, {
2632
+ [dr]: t
2633
+ });
2634
+ this.write(e);
2635
+ this.closeElement();
2636
+ }
2637
+ ft(t) {
2638
+ if (this.isHtml && this.currentElementFrame?.elementName === "html") {
2639
+ this.additionalHeadNodes.push(t);
2640
+ return true;
2641
+ }
2642
+ return false;
2643
+ }
2644
+ ////////////////////////////////////
2645
+ emitContainerData() {
2646
+ const t = this.renderOptions.streaming?.inOrder?.strategy === "disabled";
2647
+ const e = !t || __EXPERIMENTAL__.suspense && this.outOfOrderStreaming && this.outOfOrderUsed;
2648
+ return Kr(Kr(e ? this.streamHandler.flush() : void 0, () => this.resolvePromiseAttributes()), () => {
2649
+ this.i = 1 /* DataStreamStarted */;
2650
+ return Kr(this.emitStateData(), () => {
2651
+ this.t = true;
2652
+ return Kr(this.emitRestStateData(), () => this.emitOutOfOrderSegmentsAndData());
2653
+ });
2654
+ });
2655
+ }
2656
+ emitRestStateData() {
2657
+ this.emitVNodeData();
2658
+ this.emitDelayedOutOfOrderSegmentVNodeData();
2659
+ if (!isDev8) {
2660
+ preloaderPost(this, this.renderOptions, this.un?.nonce);
2661
+ }
2662
+ this.emitSyncFnsData();
2663
+ this.emitPatchDataIfNeeded();
2664
+ this.emitExecutorIfNeeded();
2665
+ this.emitQwikLoaderAtBottomIfNeeded();
2666
+ }
2667
+ emitDelayedOutOfOrderSegmentVNodeData() {
2668
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed) {
2669
+ return;
2670
+ }
2671
+ for (let t = 0; t < this.outOfOrderSegments.length; t++) {
2672
+ const e = this.outOfOrderSegments[t];
2673
+ if (e.F === 1 /* EarlyFinalized */) {
2674
+ e.rr();
2675
+ t--;
2676
+ }
2677
+ }
2678
+ }
2679
+ emitOutOfOrderSegmentsAndData() {
2680
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed) {
2681
+ return;
2682
+ }
2683
+ this.emitOutOfOrderExecutorIfNeeded();
2684
+ return Kr(this.streamHandler.flush(), async () => {
2685
+ this.C();
2686
+ if (this.outOfOrderPendingSegments.length) {
2687
+ await Promise.all(this.outOfOrderPendingSegments);
2688
+ }
2689
+ });
2690
+ }
2691
+ /**
2692
+ * Serialize the vNodeData into a string and emit it as a script tag.
2693
+ *
2694
+ * ## Encoding:
2695
+ *
2696
+ * - Alphabetical characters are text node lengths.
2697
+ * - Numbers are element counts.
2698
+ * - `{` is start of virtual node.
2699
+ * - `}` is end of virtual node.
2700
+ * - `~` Store as reference for data deserialization.
2701
+ * - `!"#$%&'()*+'-./` are separators (sequential characters in ASCII table)
2702
+ *
2703
+ * Attribute and separators encoding described here:
2704
+ * `packages/qwik/src/core/v2/shared/vnode-data-types.ts`
2705
+ *
2706
+ * NOTE: Not every element will need vNodeData. So we need to encode how many elements should be
2707
+ * skipped. By choosing different separators we can encode different numbers of elements to skip.
2708
+ */ emitVNodeData(t) {
2709
+ this.I().markVNodeDataOwnerEmitted(t);
2710
+ if (!t && !this.serializationCtx.le.length && !this.hasVNodeRefsForSerialization) {
2711
+ return;
2712
+ }
2713
+ this.emitVNodeDataScript(t, this.vNodeDatas.entries());
2714
+ }
2715
+ emitVNodeDataScript(t, e, n = false) {
2716
+ const r = {
2717
+ type: "qwik/vnode"
2718
+ };
2719
+ if (__EXPERIMENTAL__.suspense && this.outOfOrderStreaming && t) {
2720
+ r[hr] = t;
2721
+ }
2722
+ if (n) {
2723
+ r[QStatePatchAttr] = true;
2724
+ }
2725
+ this.openScript(r);
2726
+ const s = [];
2727
+ let i = 0;
2728
+ for (const [t, n] of e) {
2729
+ const e = n[0];
2730
+ if (e & 16 /* SERIALIZE */) {
2731
+ i = this.emitVNodeSeparators(i, t);
2732
+ if (e & 8 /* REFERENCE */) {
2733
+ this.write(VNodeDataSeparator.REFERENCE_CH);
2734
+ }
2735
+ if (e & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */ | 4 /* ELEMENT_NODE */)) {
2736
+ let t = null;
2737
+ let e = 0;
2738
+ for (let r = 1; r < n.length; r++) {
2739
+ const i = n[r];
2740
+ if (typeof i === "object" && i !== null) {
2741
+ s.push(t);
2742
+ t = i;
2743
+ } else if (i === OPEN_FRAGMENT) {
2744
+ e++;
2745
+ this.write(VNodeDataChar.OPEN_CHAR);
2746
+ } else if (i === CLOSE_FRAGMENT) {
2747
+ if (t) {
2748
+ this.writeFragmentAttrs(t);
2749
+ t = s.pop();
2750
+ }
2751
+ e--;
2752
+ this.write(VNodeDataChar.CLOSE_CHAR);
2753
+ } else if (i === WRITE_ELEMENT_ATTRS) {
2754
+ if (t && !Oi(t)) {
2755
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2756
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2757
+ this.writeFragmentAttrs(t);
2758
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2759
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2760
+ t = s.pop();
2761
+ }
2762
+ } else if (i >= 0) {
2763
+ this.write(encodeAsAlphanumeric(i));
2764
+ } else {
2765
+ this.write(String(0 - i));
2766
+ }
2767
+ }
2768
+ while (e-- > 0) {
2769
+ if (t) {
2770
+ this.writeFragmentAttrs(t);
2771
+ t = s.pop();
2772
+ }
2773
+ this.write(VNodeDataChar.CLOSE_CHAR);
2774
+ }
2775
+ }
2776
+ }
2777
+ }
2778
+ this.closeScript();
2779
+ if (n && !t) {
2780
+ this.emitInlineScript("document.qProcessVNodeDataPatch&&document.qProcessVNodeDataPatch(document.currentScript.previousElementSibling)");
2781
+ }
2782
+ }
2783
+ markVNodeRefForSerialization(t) {
2784
+ if (t) {
2785
+ this.hasVNodeRefsForSerialization = true;
2786
+ t.vnodeData[0] |= 16 /* SERIALIZE */ | 8 /* REFERENCE */;
2787
+ }
2788
+ }
2789
+ markVNodeDataOwnerEmitted(t) {
2790
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming) {
2791
+ return;
2792
+ }
2793
+ (this.emittedVNodeDataOwners ||= /* @__PURE__ */ new Set).add(t);
2794
+ }
2795
+ isVNodeDataOwnerEmitted(t) {
2796
+ return this.emittedVNodeDataOwners?.has(t) === true;
2797
+ }
2798
+ getVNodeDataOwnerFromNodeId(t) {
2799
+ const e = parseInt(t, 10);
2800
+ if (e >= 0) {
2801
+ return {
2802
+ owner: void 0,
2803
+ localIndex: e
2804
+ };
2805
+ }
2806
+ const n = -e - 1;
2807
+ const r = Math.floor((Math.sqrt(8 * n + 1) - 1) / 2);
2808
+ const s = r * (r + 1) / 2;
2809
+ const i = n - s;
2810
+ const o = r - i;
2811
+ return {
2812
+ owner: String(o + 1),
2813
+ localIndex: i
2814
+ };
2815
+ }
2816
+ writeFragmentAttrs(t) {
2817
+ for (const e in t) {
2818
+ const n = t[e];
2819
+ let r = n;
2820
+ let s;
2821
+ let i = null;
2822
+ if (e === Ir && typeof n === "number") {
2823
+ s = n;
2824
+ r = String(n);
2825
+ } else if (typeof n !== "string") {
2826
+ s = this.addRoot(n);
2827
+ if (s === void 0) {
2828
+ if (e === sr) {
2829
+ this.write(VNodeDataChar.RENDER_FN_CHAR);
2830
+ this.write(VNodeDataChar.RENDER_HASH_PREFIX_CHAR);
2831
+ this.write(encodeVNodeDataString(encodeVNodeDataKey(n.ot)));
2832
+ }
2833
+ continue;
2834
+ }
2835
+ r = String(s);
2836
+ }
2837
+ switch (e) {
2838
+ case yr:
2839
+ this.write(VNodeDataChar.SCOPED_STYLE_CHAR);
2840
+ break;
2841
+
2842
+ case sr:
2843
+ this.write(VNodeDataChar.RENDER_FN_CHAR);
2844
+ break;
2845
+
2846
+ case Ir:
2847
+ this.write(VNodeDataChar.ID_CHAR);
2848
+ break;
2849
+
2850
+ case Cr:
2851
+ this.write(VNodeDataChar.PROPS_CHAR);
2852
+ break;
2853
+
2854
+ case Nr:
2855
+ i = encodeVNodeDataKey;
2856
+ this.write(VNodeDataChar.KEY_CHAR);
2857
+ break;
2858
+
2859
+ case Or:
2860
+ this.write(VNodeDataChar.SEQ_CHAR);
2861
+ break;
2862
+
2863
+ case jr:
2864
+ this.write(VNodeDataChar.SEQ_IDX_CHAR);
2865
+ break;
2866
+
2867
+ case wr:
2868
+ this.write(VNodeDataChar.BACK_REFS_CHAR);
2869
+ break;
2870
+
2871
+ case QSlotParent:
2872
+ this.write(VNodeDataChar.SLOT_PARENT_CHAR);
2873
+ break;
2874
+
2875
+ // Skipping `\` character for now because it is used for escaping.
2876
+ case mr:
2877
+ this.write(VNodeDataChar.CONTEXT_CHAR);
2878
+ break;
2879
+
2880
+ case cr:
2881
+ i = encodeVNodeDataKey;
2882
+ this.write(VNodeDataChar.SLOT_CHAR);
2883
+ break;
2884
+
2885
+ default:
2886
+ {
2887
+ i = encodeURI;
2888
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2889
+ this.write(encodeVNodeDataString(encodeVNodeDataKey(e)));
2890
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2891
+ }
2892
+ }
2893
+ const o = encodeVNodeDataString(i ? i(r) : r);
2894
+ const a = i ? o !== r : false;
2895
+ if (a) {
2896
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2897
+ this.write(o);
2898
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2899
+ } else if (typeof s === "number") {
2900
+ this.writeRootRef(s);
2901
+ } else {
2902
+ this.write(r);
2903
+ }
2904
+ }
2905
+ }
2906
+ emitStateData() {
2907
+ if (!this.serializationCtx.le.length && !this.serializationCtx.Te.size) {
2908
+ return;
2909
+ }
2910
+ const t = this.stateScriptAttrs();
2911
+ this.openScript(t);
2912
+ this.serializationCtx.re(this.writer);
2913
+ return Kr(this.serializationCtx.Ut(), () => {
2914
+ this.closeScript();
2915
+ });
2916
+ }
2917
+ /** Add q-d:qidle attribute to eagerly resume some state if needed */ stateScriptAttrs() {
2918
+ const t = {
2919
+ type: "qwik/state",
2920
+ [QInstanceAttr]: this.Ht
2921
+ };
2922
+ const e = this.serializationCtx.Te;
2923
+ if (e.size > 0) {
2924
+ t["q-d:qidle"] = la(null, "_res", _, null, [ ...e ]);
2925
+ }
2926
+ return t;
2927
+ }
2928
+ emitSyncFnsData(t = false) {
2929
+ const e = this.serializationCtx.Re;
2930
+ const n = t ? this.emittedSyncFnCount : 0;
2931
+ if (e.length > n) {
2932
+ const r = {
2933
+ "q:func": "qwik/json"
2934
+ };
2935
+ if (this.renderOptions.serverData?.nonce) {
2936
+ r["nonce"] = this.renderOptions.serverData.nonce;
2937
+ }
2938
+ this.openScript(r);
2939
+ if (t) {
2940
+ const t = Q_FUNCS_PREFIX.replace("HASH", this.Ht).slice(0, -1);
2941
+ this.write(`(${t}||(${t}=[])).push(`);
2942
+ } else {
2943
+ this.write(Q_FUNCS_PREFIX.replace("HASH", this.Ht));
2944
+ }
2945
+ if (!t) {
2946
+ this.write(Fi);
2947
+ }
2948
+ this.writeArray(t ? e.slice(n) : e, Xi);
2949
+ if (!t) {
2950
+ this.write(Di);
2951
+ }
2952
+ if (t) {
2953
+ this.write(")");
2954
+ }
2955
+ this.closeScript();
2956
+ this.emittedSyncFnCount = e.length;
2957
+ }
2958
+ }
2959
+ emitPatchDataIfNeeded() {
2960
+ const t = [];
2961
+ for (const [e, n] of this.backpatchMap) {
2962
+ for (let r = 0; r < n.length; r++) {
2963
+ const s = n[r];
2964
+ t.push(e, s.attrName, Tu(s.value) ? s.value.untrackedValue : s.value);
2965
+ }
2966
+ }
2967
+ this.backpatchMap.clear();
2968
+ if (t.length > 0) {
2969
+ this.isBackpatchExecutorEmitted = true;
2970
+ const e = {
2971
+ type: ELEMENT_BACKPATCH_DATA
2972
+ };
2973
+ if (this.renderOptions.serverData?.nonce) {
2974
+ e["nonce"] = this.renderOptions.serverData.nonce;
2975
+ }
2976
+ this.writeScript(e, JSON.stringify(t).replaceAll("<", "\\u003C"));
2977
+ }
2978
+ }
2979
+ emitBackpatchDataAndExecutorIfNeeded() {
2980
+ if (this.backpatchMap.size === 0) {
2981
+ return;
2982
+ }
2983
+ this.emitPatchDataIfNeeded();
2984
+ this.emitExecutorIfNeeded();
2985
+ }
2986
+ emitExecutorIfNeeded() {
2987
+ if (!this.isBackpatchExecutorEmitted) {
2988
+ return;
2989
+ }
2990
+ this.isBackpatchExecutorEmitted = false;
2991
+ const t = {
2992
+ type: "text/javascript"
2993
+ };
2994
+ if (this.renderOptions.serverData?.nonce) {
2995
+ t["nonce"] = this.renderOptions.serverData.nonce;
2996
+ }
2997
+ const e = getQwikBackpatchExecutorScript({
2998
+ debug: isDev8
2999
+ });
3000
+ this.writeScript(t, e);
3001
+ }
3002
+ emitOutOfOrderExecutorIfNeeded() {
3003
+ if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed || this.isOutOfOrderExecutorEmitted) {
3004
+ return;
3005
+ }
3006
+ this.isOutOfOrderExecutorEmitted = true;
3007
+ this.writeScript({
3008
+ type: "text/javascript",
3009
+ nonce: this.renderOptions.serverData?.nonce
3010
+ }, getQwikOutOfOrderExecutorScript({
3011
+ debug: isDev8
3012
+ }));
3013
+ }
3014
+ emitInlineScript(t) {
3015
+ const e = {
3016
+ type: "text/javascript"
3017
+ };
3018
+ if (this.renderOptions.serverData?.nonce) {
3019
+ e["nonce"] = this.renderOptions.serverData.nonce;
3020
+ }
3021
+ this.writeScript(e, t);
3022
+ }
3023
+ writeScript(t, e) {
3024
+ this.openScript(t);
3025
+ if (e) {
3026
+ this.write(e);
3027
+ }
3028
+ this.closeScript();
3029
+ }
3030
+ openScript(t) {
3031
+ this.write("<script");
3032
+ this.writeAttrs("script", t, true, null, null, true);
3033
+ this.write(GT);
3034
+ }
3035
+ closeScript() {
3036
+ this.write("<\/script>");
3037
+ }
3038
+ emitPreloaderPre() {
3039
+ if (!isDev8) {
3040
+ preloaderPre(this, this.renderOptions.preloader, this.renderOptions.serverData?.nonce);
3041
+ }
3042
+ }
3043
+ isStatic() {
3044
+ return !(__EXPERIMENTAL__.suspense && this.outOfOrderStreaming && this.outOfOrderUsed) && this.serializationCtx.It.size === 0;
3045
+ }
3046
+ emitQwikLoaderAtTopIfNeeded() {
3047
+ if (this.qlInclude === 0 /* Module */) {
3048
+ this.qlInclude = 2 /* Done */;
3049
+ const t = this.De + this.resolvedManifest.manifest.qwikLoader;
3050
+ const e = {
3051
+ rel: "modulepreload",
3052
+ href: t
3053
+ };
3054
+ const n = this.renderOptions.serverData?.nonce;
3055
+ if (n) {
3056
+ e["nonce"] = n;
3057
+ }
3058
+ this.openElement("link", null, e);
3059
+ this.closeElement();
3060
+ const r = {
3061
+ async: true,
3062
+ type: "module",
3063
+ src: t
3064
+ };
3065
+ if (n) {
3066
+ r["nonce"] = n;
3067
+ }
3068
+ this.writeScript(r);
3069
+ }
3070
+ }
3071
+ emitQwikLoaderInline() {
3072
+ this.qlInclude = 2 /* Done */;
3073
+ const t = getQwikLoaderScript({
3074
+ debug: this.renderOptions.debug
3075
+ });
3076
+ const e = {
3077
+ id: "qwikloader",
3078
+ async: true,
3079
+ type: "module"
3080
+ };
3081
+ if (this.renderOptions.serverData?.nonce) {
3082
+ e["nonce"] = this.renderOptions.serverData.nonce;
3083
+ }
3084
+ this.writeScript(e, t);
3085
+ }
3086
+ emitQwikLoaderAtBottomIfNeeded() {
3087
+ if (!this.isStatic()) {
3088
+ if (this.qlInclude !== 2 /* Done */) {
3089
+ this.emitQwikLoaderInline();
3090
+ }
3091
+ this.emitNewQwikEvents(true);
3092
+ }
3093
+ }
3094
+ emitNewQwikEvents(t = false) {
3095
+ const e = [];
3096
+ for (const t of this.serializationCtx.xt) {
3097
+ if (!this.emittedQwikEventNames.has(t)) {
3098
+ this.emittedQwikEventNames.add(t);
3099
+ e.push(JSON.stringify(t));
3100
+ }
3101
+ }
3102
+ if (t) {
3103
+ e.push(`${QwikEvContainerReady}`, JSON.stringify(this.Ht));
3104
+ }
3105
+ this.emitQwikEvents(e);
3106
+ }
3107
+ emitQwikEvents(t) {
3108
+ if (t.length > 0) {
3109
+ const e = {};
3110
+ const n = this.renderOptions.serverData?.nonce;
3111
+ if (n) {
3112
+ e["nonce"] = n;
3113
+ }
3114
+ this.openScript(e);
3115
+ this.write(`(window._qwikEv||(window._qwikEv=[])).push(`);
3116
+ this.writeArray(t, Xi);
3117
+ this.write(PAREN_CLOSE);
3118
+ this.closeScript();
3119
+ }
3120
+ }
3121
+ // Keep in sync with process-vnode-data.unit.ts
3122
+ emitVNodeSeparators(t, e) {
3123
+ let n = e - t;
3124
+ while (n != 0) {
3125
+ if (n >= 8192) {
3126
+ this.write(VNodeDataSeparator.ADVANCE_8192_CH);
3127
+ n -= 8192;
3128
+ } else {
3129
+ n & 4096 && this.write(VNodeDataSeparator.ADVANCE_4096_CH);
3130
+ n & 2048 && this.write(VNodeDataSeparator.ADVANCE_2048_CH);
3131
+ n & 1024 && this.write(VNodeDataSeparator.ADVANCE_1024_CH);
3132
+ n & 512 && this.write(VNodeDataSeparator.ADVANCE_512_CH);
3133
+ n & 256 && this.write(VNodeDataSeparator.ADVANCE_256_CH);
3134
+ n & 128 && this.write(VNodeDataSeparator.ADVANCE_128_CH);
3135
+ n & 64 && this.write(VNodeDataSeparator.ADVANCE_64_CH);
3136
+ n & 32 && this.write(VNodeDataSeparator.ADVANCE_32_CH);
3137
+ n & 16 && this.write(VNodeDataSeparator.ADVANCE_16_CH);
3138
+ n & 8 && this.write(VNodeDataSeparator.ADVANCE_8_CH);
3139
+ n & 4 && this.write(VNodeDataSeparator.ADVANCE_4_CH);
3140
+ n & 2 && this.write(VNodeDataSeparator.ADVANCE_2_CH);
3141
+ n & 1 && this.write(VNodeDataSeparator.ADVANCE_1_CH);
3142
+ n = 0;
3143
+ }
3144
+ }
3145
+ return e;
3146
+ }
3147
+ createAndPushFrame(t, e, n) {
3148
+ let r = 10 /* ANYTHING */;
3149
+ if (isDev8) {
3150
+ if (!this.currentElementFrame) {
3151
+ r = initialTag(t);
3152
+ } else {
3153
+ let e = this.currentElementFrame;
3154
+ const s = e.tagNesting;
3155
+ r = isTagAllowed(s, t);
3156
+ if (r === 0 /* NOT_ALLOWED */) {
3157
+ const r = [];
3158
+ while (e) {
3159
+ r.unshift(e);
3160
+ e = e.parent;
3161
+ }
3162
+ const i = [];
3163
+ if (n) {
3164
+ i.push(`Error found in file: ${n}`);
3165
+ }
3166
+ i.push(`HTML rules do not allow '<${t}>' at this location.`, ` (The HTML parser will try to recover by auto-closing or inserting additional tags which will confuse Qwik when it resumes.)`, ` Offending tag: <${t}>`, ` Existing tag context:`);
3167
+ let o = " ";
3168
+ let a = "";
3169
+ for (let t = 0; t < r.length; t++) {
3170
+ const e = r[t];
3171
+ const [n, s] = allowedContent(e.tagNesting);
3172
+ i.push(`${o}<${e.elementName}>${a !== n ? ` [${n}]${s ? ` -> ${s}` : ""}` : ""}`);
3173
+ a = n;
3174
+ o += " ";
3175
+ }
3176
+ i.push(`${o}<${t}> <= is not allowed as a child of ${allowedContent(s)[0]}.`);
3177
+ throw newTagError(i.join("\n"));
3178
+ }
3179
+ }
3180
+ }
3181
+ const s = {
3182
+ tagNesting: r,
3183
+ parent: this.currentElementFrame,
3184
+ elementName: t,
3185
+ depthFirstElementIdx: e,
3186
+ vNodeData: [ 0 /* NONE */ ],
3187
+ currentFile: isDev8 ? n || null : null,
3188
+ refBase: null
3189
+ };
3190
+ this.currentElementFrame = s;
3191
+ this.vNodeDatas.push(s.vNodeData);
3192
+ }
3193
+ popFrame() {
3194
+ const t = this.currentElementFrame;
3195
+ this.currentElementFrame = t.parent;
3196
+ return t;
3197
+ }
3198
+ ////////////////////////////////////
3199
+ write(t) {
3200
+ this.size += t.length;
3201
+ this.writer.write(t);
3202
+ }
3203
+ writeRootRef(t) {
3204
+ this.size += String(t).length;
3205
+ this.writer.writeRootRef(t);
3206
+ }
3207
+ writeRootRefPath(t) {
3208
+ this.size += String(t[0]).length;
3209
+ this.writer.writeRootRefPath(t);
3210
+ for (let e = 1; e < t.length; e++) {
3211
+ this.size += 1 + String(t[e]).length;
3212
+ }
3213
+ }
3214
+ writeRootRefDelta(t, e) {
3215
+ const n = t - e;
3216
+ this.size += String(n).length;
3217
+ this.writer.writeRootRefDelta(t, e);
3218
+ }
3219
+ writeArray(t, e) {
3220
+ for (let n = 0; n < t.length; n++) {
3221
+ const r = t[n];
3222
+ if (n > 0) {
3223
+ this.write(e);
3224
+ }
3225
+ this.write(r);
3226
+ }
3227
+ }
3228
+ writeAttrs(t, e, s, i, o, a) {
3229
+ let l = void 0;
3230
+ for (let c in e) {
3231
+ let u = e[c];
3232
+ if (isSSRUnsafeAttr(c)) {
3233
+ if (isDev8) {
3234
+ throw Ye(32 /* unsafeAttr */ , [ c ]);
3235
+ }
3236
+ continue;
3237
+ }
3238
+ if (ri(c)) {
3239
+ u = _setEvent(this.serializationCtx, c, u, a);
3240
+ } else if (c === "ref") {
3241
+ const t = this.getOrCreateLastNode();
3242
+ if (Tu(u)) {
3243
+ u.Ct = new DomRef(t);
3244
+ continue;
3245
+ } else if (typeof u === "function") {
3246
+ u(new DomRef(t));
3247
+ continue;
3248
+ } else if (u == null) {
3249
+ continue;
3250
+ } else {
3251
+ throw Ye(15 /* invalidRefValue */ , [ o ]);
3252
+ }
3253
+ } else if (c === Lr || c === Fr) {
3254
+ const t = this.addRoot(u);
3255
+ if (t === void 0) {
3256
+ continue;
3257
+ }
3258
+ u = typeof t === "number" ? [ t ] : String(t);
3259
+ } else if (Tu(u)) {
3260
+ const t = this.getOrCreateLastNode();
3261
+ const e = new Gs({
3262
+ j: i,
3263
+ rt: s
3264
+ });
3265
+ const r = u;
3266
+ u = n(() => this.trackSignalValue(r, t, c, e));
3267
+ }
3268
+ if (Yr(u)) {
3269
+ const t = this.getOrCreateLastNode();
3270
+ this.addPromiseAttribute(u);
3271
+ u.then(e => {
3272
+ this.addBackpatchEntry(t.id, c, r(c, e, i));
3273
+ });
3274
+ continue;
3275
+ }
3276
+ if (c === Hr) {
3277
+ if (u) {
3278
+ l = String(u);
3279
+ c = kr;
3280
+ u = "html" /* HTML */;
3281
+ }
3282
+ if (t === "style") {
3283
+ continue;
3284
+ }
3285
+ } else if (isPreventDefault(c)) {
3286
+ addPreventDefaultEventToSerializationContext(this.serializationCtx, c);
3287
+ }
3288
+ if (t === "textarea" && c === "value") {
3289
+ if (u && typeof u !== "string") {
3290
+ if (isDev8) {
3291
+ throw Ye(23 /* wrongTextareaValue */ , [ o, u ]);
3292
+ }
3293
+ continue;
3294
+ }
3295
+ l = escapeHTML(u || "");
3296
+ c = kr;
3297
+ u = "text" /* TEXT */;
3298
+ }
3299
+ const h = r(c, u, i);
3300
+ if (h != null && h !== false) {
3301
+ this.write(Ga);
3302
+ this.write(c);
3303
+ if (h !== true) {
3304
+ this.write(ATTR_EQUALS_QUOTE);
3305
+ if (Array.isArray(h)) {
3306
+ this.writeEscapedChunks(h);
3307
+ } else {
3308
+ const t = escapeHTML(String(h));
3309
+ this.write(t);
3310
+ }
3311
+ this.write(Li);
3312
+ }
3313
+ }
3314
+ }
3315
+ return l;
3316
+ }
3317
+ writeEscapedChunks(t) {
3318
+ for (let e = 0; e < t.length; e++) {
3319
+ const n = t[e];
3320
+ if (typeof n === "string") {
3321
+ this.write(escapeHTML(n));
3322
+ } else if (typeof n === "number") {
3323
+ this.writeRootRef(n);
3324
+ } else if ("base" in n) {
3325
+ this.writeRootRefDelta(n.id, n.base);
3326
+ } else {
3327
+ this.writeRootRefPath(n.path);
3328
+ }
3329
+ }
3330
+ }
3331
+ addPromiseAttribute(t) {
3332
+ this.promiseAttributes ||= [];
3333
+ this.promiseAttributes.push(t);
3334
+ }
3335
+ async resolvePromiseAttributes() {
3336
+ if (this.promiseAttributes) {
3337
+ await Promise.all(this.promiseAttributes);
3338
+ this.promiseAttributes = null;
3339
+ }
3340
+ }
3341
+ };
3342
+
3343
+ var SSRSegmentContainer = class extends SSRContainer {
3344
+ constructor(t, e) {
3345
+ super(t);
3346
+ this.Le = e;
3347
+ }
3348
+ Le;
3349
+ F=0 /* Rendering */;
3350
+ sr=null;
3351
+ subscriptionPatchRecords=[];
3352
+ pendingVNodeDataPatches=null;
3353
+ _n(t, e, n, r) {
3354
+ recordExternalRootEffect(this.Le.serializationCtx, this.serializationCtx, this.Le.yt, this.subscriptionPatchRecords, t, e, n, r);
3355
+ }
3356
+ async P(t, e) {
3357
+ const n = this.Le;
3358
+ const r = n.v();
3359
+ const s = this.serializationCtx;
3360
+ try {
3361
+ const i = this.ir(n, s);
3362
+ this.ar(n, s);
3363
+ const o = this.lr(n, r, s);
3364
+ if (r && (i.newRootLocalIds.length > 0 || o !== void 0)) {
3365
+ s.ve = n.serializationCtx.ee;
3366
+ await this.emitStatePatchData(t, i.newRootStart, i.newRootLocalIds, o);
3367
+ n.serializationCtx.ge = n.serializationCtx.le.length + (n.serializationCtx._e ? 1 : 0);
3368
+ n.serializationCtx.ee += s.ee;
3369
+ }
3370
+ this.emitPendingVNodeDataPatches();
3371
+ if (r) {
3372
+ this.t = true;
3373
+ this.emitVNodeData(t);
3374
+ const e = this.serializationCtx;
3375
+ this.serializationCtx = n.serializationCtx;
3376
+ this.emittedSyncFnCount = n.emittedSyncFnCount;
3377
+ this.emitSyncFnsData(true);
3378
+ n.emittedSyncFnCount = this.emittedSyncFnCount;
3379
+ this.serializationCtx = e;
3380
+ this.emitNewQwikEvents();
3381
+ }
3382
+ this.emitPatchDataIfNeeded();
3383
+ this.drainCleanupQueue();
3384
+ const a = i.rootIdMap;
3385
+ if (r) {
3386
+ this.F = 2 /* Done */;
3387
+ } else {
3388
+ this.sr = a;
3389
+ this.F = 1 /* EarlyFinalized */;
3390
+ }
3391
+ return {
3392
+ html: renderSSRChunks(e.htmlChunks, a),
3393
+ scripts: e.writer.toString(a)
3394
+ };
3395
+ } finally {
3396
+ if (this.F !== 1 /* EarlyFinalized */) {
3397
+ s.qe = void 0;
3398
+ n.removeOutOfOrderSegment(this);
3399
+ }
3400
+ n.serializationCtx.re(n.writer);
3401
+ }
3402
+ }
3403
+ rr() {
3404
+ try {
3405
+ this.emitVNodeData(this.vnodeSegment);
3406
+ this.emitPendingVNodeDataPatches();
3407
+ this.Le.emitOutOfOrderSegmentScripts(this.writer.toString(this.sr));
3408
+ this.F = 2 /* Done */;
3409
+ this.Le.removeOutOfOrderSegment(this);
3410
+ } finally {
3411
+ this.serializationCtx.qe = void 0;
3412
+ }
3413
+ }
3414
+ markVNodeDataForSerialization(t, e = 16 /* SERIALIZE */) {
3415
+ const n = t.vnodeData[0];
3416
+ const r = n | e;
3417
+ if (r !== n) {
3418
+ t.vnodeData[0] = r;
3419
+ this.queueLateVNodeDataPatch(t, r & ~n);
3420
+ }
3421
+ }
3422
+ queueLateVNodeDataPatch(t, e) {
3423
+ if (!(e & (16 /* SERIALIZE */ | 8 /* REFERENCE */))) {
3424
+ return;
3425
+ }
3426
+ const n = this.getVNodeDataOwnerFromNodeId(t.id);
3427
+ if (!this.I().isVNodeDataOwnerEmitted(n.owner)) {
3428
+ return;
3429
+ }
3430
+ let r = (this.pendingVNodeDataPatches ||= /* @__PURE__ */ new Map).get(n.owner);
3431
+ if (!r) {
3432
+ this.pendingVNodeDataPatches.set(n.owner, r = /* @__PURE__ */ new Map);
3433
+ }
3434
+ r.set(n.localIndex, t.vnodeData);
3435
+ }
3436
+ emitPendingVNodeDataPatches() {
3437
+ const t = this.pendingVNodeDataPatches;
3438
+ this.pendingVNodeDataPatches = null;
3439
+ if (!t) {
3440
+ return;
3441
+ }
3442
+ for (const [e, n] of t) {
3443
+ if (n.size === 0) {
3444
+ continue;
3445
+ }
3446
+ const t = Array.from(n).sort((t, e) => t[0] - e[0]);
3447
+ this.emitVNodeDataScript(e, t, true);
3448
+ }
3449
+ }
3450
+ ir(t, e) {
3451
+ const n = this.commitSegmentRoots(t, e);
3452
+ e.qe = (e, r, s) => {
3453
+ this.commitSegmentRoot(t, e, r, s, n);
3454
+ };
3455
+ return n;
3456
+ }
3457
+ lr(t, e, n) {
3458
+ let r = void 0;
3459
+ const s = e ? this.collectSubscriptionPatches(t, t.rootContainerSerializedRootCount) : void 0;
3460
+ if (s) {
3461
+ r = n.Rt(s);
3462
+ }
3463
+ return r;
3464
+ }
3465
+ commitSegmentRoots(t, e) {
3466
+ const n = [];
3467
+ const r = t.v() ? t.serializationCtx.ge : t.serializationCtx.le.length;
3468
+ const s = [];
3469
+ const i = {
3470
+ rootIdMap: n,
3471
+ newRootStart: r,
3472
+ newRootLocalIds: s
3473
+ };
3474
+ this.promoteSharedSegmentRoots(t, e, i);
3475
+ const o = e.le;
3476
+ const a = e.Pe;
3477
+ for (let e = 0; e < o.length; e++) {
3478
+ const n = a[e];
3479
+ this.commitSegmentRoot(t, e, o[e], n, i);
3480
+ }
3481
+ return i;
3482
+ }
3483
+ promoteSharedSegmentRoots(t, e, n) {
3484
+ const r = e.le;
3485
+ const s = e.Pe;
3486
+ for (let e = 0; e < s.length; e++) {
3487
+ const i = s[e];
3488
+ if (this.isRootOrUsedByOtherLiveSegment(t, i)) {
3489
+ this.commitSegmentRoot(t, e, r[e], i, n);
3490
+ }
3491
+ }
3492
+ }
3493
+ isRootOrUsedByOtherLiveSegment(t, e) {
3494
+ if (t.serializationCtx.Ne(e) !== void 0) {
3495
+ return true;
3496
+ }
3497
+ const n = t.outOfOrderSegments;
3498
+ for (let t = 0; t < n.length; t++) {
3499
+ const r = n[t];
3500
+ if (r === this) {
3501
+ continue;
3502
+ }
3503
+ const s = r.serializationCtx.Pe;
3504
+ for (let t = 0; t < s.length; t++) {
3505
+ if (s[t] === e) {
3506
+ return true;
3507
+ }
3508
+ }
3509
+ }
3510
+ return false;
3511
+ }
3512
+ commitSegmentRoot(t, e, n, r, s) {
3513
+ if (s.rootIdMap[e] !== void 0) {
3514
+ return;
3515
+ }
3516
+ let i = t.serializationCtx.Ne(r);
3517
+ if (i === void 0) {
3518
+ i = t.serializationCtx.Ie(n, r);
3519
+ s.newRootLocalIds.push(e);
3520
+ this.seedCommittedRootForLiveSegments(t, r);
3521
+ }
3522
+ const o = t.serializationCtx;
3523
+ s.rootIdMap[e] = t.v() && i >= o.be ? i + (o._e ? 1 : 0) : i;
3524
+ }
3525
+ seedCommittedRootForLiveSegments(t, e) {
3526
+ const n = t.outOfOrderSegments;
3527
+ for (let t = 0; t < n.length; t++) {
3528
+ const r = n[t];
3529
+ if (r !== this && r.F === 0 /* Rendering */) {
3530
+ r.serializationCtx.Rt(e);
3531
+ }
3532
+ }
3533
+ }
3534
+ ar(t, e) {
3535
+ for (const n of e.xt) {
3536
+ t.serializationCtx.xt.add(n);
3537
+ }
3538
+ for (const n of e.It) {
3539
+ t.serializationCtx.It.add(n);
3540
+ }
3541
+ }
3542
+ collectSubscriptionPatches(t, e) {
3543
+ return collectSubscriptionPatches(t.serializationCtx, this.subscriptionPatchRecords, e);
3544
+ }
3545
+ emitStatePatchData(t, e, n, r) {
3546
+ const s = this.statePatchScriptAttrs(t);
3547
+ this.openScript(s);
3548
+ this.serializationCtx.re(this.writer);
3549
+ this.serializationCtx.ae = this.markVNodeDataForSerialization.bind(this);
3550
+ return Kr(this.serializationCtx.Me(e, n, r, 0), () => {
3551
+ this.closeScript();
3552
+ });
3553
+ }
3554
+ statePatchScriptAttrs(t) {
3555
+ const e = this.stateScriptAttrs();
3556
+ e[QStatePatchAttr] = true;
3557
+ if (t) {
3558
+ e[hr] = t;
3559
+ }
3560
+ return e;
3561
+ }
3562
+ };
3563
+
3564
+ var isQwikStyleElement = (t, e) => {
3565
+ if (t === "style" && e != null) {
3566
+ return Object.prototype.hasOwnProperty.call(e, dr) || Object.prototype.hasOwnProperty.call(e, yr);
3567
+ }
3568
+ return false;
3569
+ };
3570
+
3571
+ function newTagError(t) {
3572
+ return Ye(12 /* tagError */ , [ t ]);
3573
+ }
3574
+
3575
+ function hasDestroy(t) {
3576
+ return t && typeof t === "object" && typeof t.cn === "function";
3577
+ }
3578
+
3579
+ function isSSRUnsafeAttr(t) {
3580
+ for (let e = 0; e < t.length; e++) {
3581
+ const n = t.charCodeAt(e);
3582
+ if (n === 62 || n === 47 || n === 61 || n === 34 || n === 39 || n === 9 || n === 10 || n === 12 || n === 32) {
3583
+ return true;
3584
+ }
3585
+ }
3586
+ return false;
3587
+ }
3588
+
3589
+ function randomStr() {
3590
+ return (Math.random().toString(36) + "000000").slice(2, 8);
3591
+ }
3592
+
3593
+ function addPreventDefaultEventToSerializationContext(t, e) {
3594
+ const n = "e" + e.substring(14);
3595
+ if (n) {
3596
+ t.xt.add(n);
3597
+ }
3598
+ }
3599
+
3600
+ // packages/qwik/src/server/ssr-stream-handler.ts
3601
+ var StreamHandler = class {
3602
+ constructor(t, e) {
3603
+ this.opts = t;
3604
+ this.timing = e;
3605
+ this.inOrderStreaming = t.streaming?.inOrder ?? {
3606
+ strategy: "auto",
3607
+ maximumInitialChunk: 2e4,
3608
+ maximumChunk: 1e4
3609
+ };
3610
+ this.nativeStream = t.stream;
3611
+ this.stream = this.setupStreamWriter();
3612
+ }
3613
+ opts;
3614
+ timing;
3615
+ bufferSize=0;
3616
+ buffer="";
3617
+ networkFlushes=0;
3618
+ inOrderStreaming;
3619
+ streamBlockDepth=0;
3620
+ streamBlockBuffer="";
3621
+ streamBlockBufferSize=0;
3622
+ nativeStream;
3623
+ firstFlushTimer=createTimer();
3624
+ pendingFlush;
3625
+ flushQueued=false;
3626
+ stream;
3627
+ setupStreamWriter() {
3628
+ const t = this;
3629
+ let e;
3630
+ switch (this.inOrderStreaming.strategy) {
3631
+ case "disabled":
3632
+ e = ji(e => {
3633
+ if (e === void 0 || e === null) {
3634
+ return;
3635
+ }
3636
+ t.enqueue(e);
3637
+ });
3638
+ break;
3639
+
3640
+ case "direct":
3641
+ {
3642
+ const n = this.nativeStream;
3643
+ e = ji(e => {
3644
+ if (e === void 0 || e === null) {
3645
+ return;
3646
+ }
3647
+ if (t.pendingFlush) {
3648
+ const r = t.pendingFlush.then(() => n.write(e));
3649
+ return t.trackPendingFlush(r);
3650
+ }
3651
+ return t.trackPendingFlush(n.write(e));
3652
+ });
3653
+ break;
3654
+ }
3655
+
3656
+ default:
3657
+ case "auto":
3658
+ {
3659
+ const n = this.inOrderStreaming.maximumChunk ?? 0;
3660
+ const r = this.inOrderStreaming.maximumInitialChunk ?? 0;
3661
+ e = ji(e => {
3662
+ if (e === void 0 || e === null) {
3663
+ return;
3664
+ }
3665
+ t.enqueue(e);
3666
+ if (t.streamBlockDepth === 0) {
3667
+ const e = t.networkFlushes === 0 ? r : n;
3668
+ if (t.bufferSize >= e) {
3669
+ return t.flush();
3670
+ }
3671
+ }
3672
+ });
3673
+ break;
3674
+ }
3675
+ }
3676
+ return e;
3677
+ }
3678
+ enqueue(t) {
3679
+ const e = t.length;
3680
+ if (this.streamBlockDepth > 0) {
3681
+ this.streamBlockBuffer += t;
3682
+ this.streamBlockBufferSize += e;
3683
+ } else {
3684
+ this.bufferSize += e;
3685
+ this.buffer += t;
3686
+ }
3687
+ }
3688
+ trackPendingFlush(t) {
3689
+ if (!Yr(t)) {
3690
+ return;
3691
+ }
3692
+ const e = Promise.resolve(t).finally(() => {
3693
+ if (this.pendingFlush === e) {
3694
+ this.pendingFlush = void 0;
3695
+ }
3696
+ });
3697
+ this.pendingFlush = e;
3698
+ return e;
3699
+ }
3700
+ flushBuffer() {
3701
+ const t = this.buffer;
3702
+ this.buffer = "";
3703
+ this.bufferSize = 0;
3704
+ this.networkFlushes++;
3705
+ if (this.networkFlushes === 1) {
3706
+ this.timing.firstFlush = this.firstFlushTimer();
3707
+ }
3708
+ return this.trackPendingFlush(this.nativeStream.write(t));
3709
+ }
3710
+ flush() {
3711
+ if (!this.buffer) {
3712
+ return this.waitForPendingFlush();
3713
+ }
3714
+ if (this.pendingFlush) {
3715
+ if (!this.flushQueued) {
3716
+ this.flushQueued = true;
3717
+ const t = this.pendingFlush.then(() => {
3718
+ this.flushQueued = false;
3719
+ this.pendingFlush = void 0;
3720
+ return this.flush();
3721
+ });
3722
+ this.pendingFlush = t.finally(() => {
3723
+ if (this.pendingFlush === t) {
3724
+ this.pendingFlush = void 0;
3725
+ }
3726
+ });
3727
+ }
3728
+ return this.pendingFlush;
3729
+ }
3730
+ return this.flushBuffer();
3731
+ }
3732
+ waitForPendingFlush() {
3733
+ return this.pendingFlush;
3734
+ }
3735
+ streamBlockStart() {
3736
+ this.streamBlockDepth++;
3737
+ }
3738
+ streamBlockEnd() {
3739
+ this.streamBlockDepth--;
3740
+ if (this.streamBlockDepth === 0 && this.streamBlockBuffer) {
3741
+ this.buffer += this.streamBlockBuffer;
3742
+ this.bufferSize += this.streamBlockBufferSize;
3743
+ this.streamBlockBuffer = "";
3744
+ this.streamBlockBufferSize = 0;
3745
+ return this.flush();
3746
+ }
3747
+ }
3748
+ };
3749
+
3750
+ // packages/qwik/src/server/ssr-render.ts
3751
+ var renderToString = async (t, e = {}) => {
3752
+ const n = new StringSSRWriter;
3753
+ const r = await renderToStream(t, {
3754
+ ...e,
3755
+ stream: n
3756
+ });
3757
+ return {
3758
+ isStatic: r.isStatic,
3759
+ timing: r.timing,
3760
+ manifest: r.manifest,
3761
+ snapshotResult: r.snapshotResult,
3762
+ html: n.toString()
3763
+ };
3764
+ };
3765
+
3766
+ var renderToStream = async (t, e) => {
3767
+ if (__EXPERIMENTAL__.suspense && e.streaming?.outOfOrder === void 0) {
3768
+ e = {
3769
+ ...e,
3770
+ streaming: {
3771
+ ...e.streaming,
3772
+ outOfOrder: true
3773
+ }
3774
+ };
3775
+ }
3776
+ const n = {
3777
+ firstFlush: 0,
3778
+ render: 0,
3779
+ snapshot: 0
3780
+ };
3781
+ const r = e.containerTagName ?? "html";
3782
+ const s = getBuildBase(e);
3783
+ const i = resolveManifest(e.manifest);
3784
+ const o = typeof e.locale === "function" ? e.locale(e) : e.serverData?.locale || e.locale || e.containerAttributes?.locale || "";
3785
+ const a = new StreamHandler(e, n);
3786
+ const l = ssrCreateContainer({
3787
+ tagName: r,
3788
+ locale: o,
3789
+ writer: a.stream,
3790
+ streamHandler: a,
3791
+ timing: n,
3792
+ buildBase: s,
3793
+ resolvedManifest: i,
3794
+ renderOptions: e
3795
+ });
3796
+ await setServerPlatform(e, i);
3797
+ await l.render(t);
3798
+ await l.l;
3799
+ await a.flush();
3800
+ const c = {
3801
+ flushes: a.networkFlushes,
3802
+ manifest: i?.manifest,
3803
+ size: l.size,
3804
+ isStatic: false,
3805
+ timing: n
3806
+ };
3807
+ return c;
3808
+ };
3809
+
3810
+ function resolveManifest(t) {
3811
+ const e = Ea();
3812
+ const n = t ? {
3813
+ ...e,
3814
+ ...t
3815
+ } : e;
3816
+ if (!n || "mapper" in n) {
3817
+ return n;
3818
+ }
3819
+ if (n.mapping) {
3820
+ const t = {};
3821
+ for (const e in n.mapping) {
3822
+ const r = n.mapping[e];
3823
+ t[sd(e)] = [ e, r ];
3824
+ }
3825
+ return {
3826
+ mapper: t,
3827
+ manifest: n,
3828
+ injections: n.injections || []
3829
+ };
3830
+ }
3831
+ return void 0;
3832
+ }
3833
+
3834
+ var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
3835
+
3836
+ // packages/qwik/src/server/index.ts
3837
+ async function setServerPlatform2(t) {
3838
+ const e = pi({
3839
+ manifest: t
3840
+ }, resolveManifest(t));
3841
+ setPlatform2(e);
3842
+ }
3843
+
3844
+ export { getQwikBackpatchExecutorScript, getQwikLoaderScript, getQwikPrefetchWorkerScript, renderToStream, renderToString, resolveManifest, setServerPlatform2 as setServerPlatform, versions };