@qwik.dev/router 2.0.0-beta.10 → 2.0.0-beta.13

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 (140) hide show
  1. package/lib/adapters/azure-swa/vite/index.cjs +61 -5
  2. package/lib/adapters/azure-swa/vite/index.mjs +26 -201
  3. package/lib/adapters/bun-server/vite/index.cjs +27 -5
  4. package/lib/adapters/bun-server/vite/index.mjs +14 -196
  5. package/lib/adapters/cloud-run/vite/index.cjs +24 -5
  6. package/lib/adapters/cloud-run/vite/index.mjs +13 -195
  7. package/lib/adapters/cloudflare-pages/vite/index.cjs +65 -1
  8. package/lib/adapters/cloudflare-pages/vite/index.mjs +63 -4
  9. package/lib/adapters/deno-server/vite/index.cjs +39 -5
  10. package/lib/adapters/deno-server/vite/index.mjs +16 -198
  11. package/lib/adapters/netlify-edge/vite/index.cjs +88 -6
  12. package/lib/adapters/netlify-edge/vite/index.mjs +56 -240
  13. package/lib/adapters/node-server/vite/index.cjs +27 -5
  14. package/lib/adapters/node-server/vite/index.mjs +14 -196
  15. package/lib/adapters/shared/vite/index.cjs +303 -2
  16. package/lib/adapters/shared/vite/index.d.ts +4 -4
  17. package/lib/adapters/shared/vite/index.mjs +248 -143
  18. package/lib/adapters/ssg/vite/index.cjs +19 -5
  19. package/lib/adapters/ssg/vite/index.mjs +11 -193
  20. package/lib/adapters/vercel-edge/vite/index.cjs +81 -5
  21. package/lib/adapters/vercel-edge/vite/index.d.ts +1 -1
  22. package/lib/adapters/vercel-edge/vite/index.mjs +48 -229
  23. package/lib/chunks/error-handler.cjs +58 -0
  24. package/lib/chunks/error-handler.mjs +59 -0
  25. package/lib/chunks/format-error.cjs +136 -0
  26. package/lib/chunks/format-error.mjs +137 -0
  27. package/lib/chunks/fs.cjs +274 -0
  28. package/lib/chunks/fs.mjs +275 -0
  29. package/lib/chunks/index.cjs +877 -0
  30. package/lib/chunks/index.mjs +876 -0
  31. package/lib/chunks/mime-types.cjs +52 -0
  32. package/lib/chunks/mime-types.mjs +53 -0
  33. package/lib/chunks/routing.qwik.cjs +452 -0
  34. package/lib/chunks/routing.qwik.mjs +453 -0
  35. package/lib/chunks/types.qwik.cjs +24 -0
  36. package/lib/chunks/types.qwik.mjs +25 -0
  37. package/lib/index.d.ts +9 -3
  38. package/lib/index.qwik.cjs +543 -1001
  39. package/lib/index.qwik.mjs +512 -972
  40. package/lib/middleware/aws-lambda/index.cjs +52 -1
  41. package/lib/middleware/aws-lambda/index.mjs +37 -26
  42. package/lib/middleware/azure-swa/index.cjs +92 -1
  43. package/lib/middleware/azure-swa/index.mjs +64 -46
  44. package/lib/middleware/bun/index.cjs +143 -1
  45. package/lib/middleware/bun/index.mjs +103 -117
  46. package/lib/middleware/cloudflare-pages/index.cjs +96 -1
  47. package/lib/middleware/cloudflare-pages/index.mjs +68 -47
  48. package/lib/middleware/deno/index.cjs +130 -1
  49. package/lib/middleware/deno/index.mjs +93 -112
  50. package/lib/middleware/firebase/index.cjs +33 -1
  51. package/lib/middleware/firebase/index.mjs +25 -16
  52. package/lib/middleware/netlify-edge/index.cjs +71 -1
  53. package/lib/middleware/netlify-edge/index.mjs +52 -36
  54. package/lib/middleware/node/index.cjs +219 -1
  55. package/lib/middleware/node/index.mjs +178 -165
  56. package/lib/middleware/request-handler/index.cjs +1488 -18
  57. package/lib/middleware/request-handler/index.d.ts +20 -2
  58. package/lib/middleware/request-handler/index.mjs +1225 -873
  59. package/lib/middleware/vercel-edge/index.cjs +98 -1
  60. package/lib/middleware/vercel-edge/index.mjs +71 -47
  61. package/lib/service-worker/index.cjs +5 -0
  62. package/lib/service-worker/index.mjs +5 -0
  63. package/lib/ssg/index.cjs +15 -1
  64. package/lib/ssg/index.mjs +12 -19
  65. package/lib/vite/index.cjs +2006 -27
  66. package/lib/vite/index.d.ts +9 -9
  67. package/lib/vite/index.mjs +1597 -1216
  68. package/package.json +9 -8
  69. package/lib/adapters/azure-swa/vite/index-BqUeglYs.cjs +0 -1
  70. package/lib/adapters/azure-swa/vite/index-CBIchDYq.js +0 -651
  71. package/lib/adapters/azure-swa/vite/index-ClHGw5z1.js +0 -6
  72. package/lib/adapters/azure-swa/vite/index-CrwlB95_.js +0 -22
  73. package/lib/adapters/azure-swa/vite/index-DTIOTwZo.cjs +0 -11
  74. package/lib/adapters/azure-swa/vite/index-vQuPcef3.cjs +0 -1
  75. package/lib/adapters/bun-server/vite/index-BqUeglYs.cjs +0 -1
  76. package/lib/adapters/bun-server/vite/index-CBIchDYq.js +0 -651
  77. package/lib/adapters/bun-server/vite/index-ClHGw5z1.js +0 -6
  78. package/lib/adapters/bun-server/vite/index-CrwlB95_.js +0 -22
  79. package/lib/adapters/bun-server/vite/index-DTIOTwZo.cjs +0 -11
  80. package/lib/adapters/bun-server/vite/index-vQuPcef3.cjs +0 -1
  81. package/lib/adapters/cloud-run/vite/index-BqUeglYs.cjs +0 -1
  82. package/lib/adapters/cloud-run/vite/index-CBIchDYq.js +0 -651
  83. package/lib/adapters/cloud-run/vite/index-ClHGw5z1.js +0 -6
  84. package/lib/adapters/cloud-run/vite/index-CrwlB95_.js +0 -22
  85. package/lib/adapters/cloud-run/vite/index-DTIOTwZo.cjs +0 -11
  86. package/lib/adapters/cloud-run/vite/index-vQuPcef3.cjs +0 -1
  87. package/lib/adapters/cloudflare-pages/vite/index-BIeHg2Cj.cjs +0 -5
  88. package/lib/adapters/cloudflare-pages/vite/index-C455V8_A.cjs +0 -1
  89. package/lib/adapters/cloudflare-pages/vite/index-ClHGw5z1.js +0 -6
  90. package/lib/adapters/cloudflare-pages/vite/index-D3HITboM.js +0 -645
  91. package/lib/adapters/cloudflare-pages/vite/index-DKcVHRBy.cjs +0 -11
  92. package/lib/adapters/cloudflare-pages/vite/index-DwovcBp3.js +0 -22
  93. package/lib/adapters/cloudflare-pages/vite/index-bogwy7wh.js +0 -250
  94. package/lib/adapters/cloudflare-pages/vite/index-vQuPcef3.cjs +0 -1
  95. package/lib/adapters/deno-server/vite/index-BqUeglYs.cjs +0 -1
  96. package/lib/adapters/deno-server/vite/index-CBIchDYq.js +0 -651
  97. package/lib/adapters/deno-server/vite/index-ClHGw5z1.js +0 -6
  98. package/lib/adapters/deno-server/vite/index-CrwlB95_.js +0 -22
  99. package/lib/adapters/deno-server/vite/index-DTIOTwZo.cjs +0 -11
  100. package/lib/adapters/deno-server/vite/index-vQuPcef3.cjs +0 -1
  101. package/lib/adapters/netlify-edge/vite/index-BqUeglYs.cjs +0 -1
  102. package/lib/adapters/netlify-edge/vite/index-CBIchDYq.js +0 -651
  103. package/lib/adapters/netlify-edge/vite/index-ClHGw5z1.js +0 -6
  104. package/lib/adapters/netlify-edge/vite/index-CrwlB95_.js +0 -22
  105. package/lib/adapters/netlify-edge/vite/index-DTIOTwZo.cjs +0 -11
  106. package/lib/adapters/netlify-edge/vite/index-vQuPcef3.cjs +0 -1
  107. package/lib/adapters/node-server/vite/index-BqUeglYs.cjs +0 -1
  108. package/lib/adapters/node-server/vite/index-CBIchDYq.js +0 -651
  109. package/lib/adapters/node-server/vite/index-ClHGw5z1.js +0 -6
  110. package/lib/adapters/node-server/vite/index-CrwlB95_.js +0 -22
  111. package/lib/adapters/node-server/vite/index-DTIOTwZo.cjs +0 -11
  112. package/lib/adapters/node-server/vite/index-vQuPcef3.cjs +0 -1
  113. package/lib/adapters/shared/vite/index-BqUeglYs.cjs +0 -1
  114. package/lib/adapters/shared/vite/index-CBIchDYq.js +0 -651
  115. package/lib/adapters/shared/vite/index-ClHGw5z1.js +0 -6
  116. package/lib/adapters/shared/vite/index-CrwlB95_.js +0 -22
  117. package/lib/adapters/shared/vite/index-DTIOTwZo.cjs +0 -11
  118. package/lib/adapters/shared/vite/index-vQuPcef3.cjs +0 -1
  119. package/lib/adapters/ssg/vite/index-BqUeglYs.cjs +0 -1
  120. package/lib/adapters/ssg/vite/index-CBIchDYq.js +0 -651
  121. package/lib/adapters/ssg/vite/index-ClHGw5z1.js +0 -6
  122. package/lib/adapters/ssg/vite/index-CrwlB95_.js +0 -22
  123. package/lib/adapters/ssg/vite/index-DTIOTwZo.cjs +0 -11
  124. package/lib/adapters/ssg/vite/index-vQuPcef3.cjs +0 -1
  125. package/lib/adapters/vercel-edge/vite/index-BqUeglYs.cjs +0 -1
  126. package/lib/adapters/vercel-edge/vite/index-CBIchDYq.js +0 -651
  127. package/lib/adapters/vercel-edge/vite/index-ClHGw5z1.js +0 -6
  128. package/lib/adapters/vercel-edge/vite/index-CrwlB95_.js +0 -22
  129. package/lib/adapters/vercel-edge/vite/index-DTIOTwZo.cjs +0 -11
  130. package/lib/adapters/vercel-edge/vite/index-vQuPcef3.cjs +0 -1
  131. package/lib/service-worker.cjs +0 -1
  132. package/lib/service-worker.mjs +0 -5
  133. package/lib/ssg/deno.cjs +0 -1
  134. package/lib/ssg/deno.mjs +0 -6
  135. package/lib/ssg/index-CBIchDYq.js +0 -651
  136. package/lib/ssg/index-ClHGw5z1.js +0 -6
  137. package/lib/ssg/index-DTIOTwZo.cjs +0 -11
  138. package/lib/ssg/index-vQuPcef3.cjs +0 -1
  139. package/lib/ssg/node.cjs +0 -11
  140. package/lib/ssg/node.mjs +0 -651
@@ -1,235 +1,29 @@
1
1
  import { jsx, Fragment, jsxs } from "@qwik.dev/core/jsx-runtime";
2
- import { component$, useErrorBoundary, useOnWindow, $, Slot, createAsyncComputed$, isBrowser, createContextId, useContext, implicit$FirstArg, noSerialize, useVisibleTask$, useServerData, useSignal, untrack, sync$, isDev, withLocale, event$, useStyles$, isServer, useStore, useContextProvider, useTask$, getLocale, jsx as jsx$1, SkipRender, createElement } from "@qwik.dev/core";
3
- import { p } from "@qwik.dev/core/preloader";
4
- import { _deserialize, _UNINITIALIZED, _getContextContainer, SerializerSymbol, _getContextElement, _hasStoreEffects, _getQContainerElement, forceStoreEffects, _waitUntilRendered, _resolveContextWithoutSequentialScope, _getContextEvent, _serialize } from "@qwik.dev/core/internal";
2
+ import { component$, useErrorBoundary, useOnWindow, $, Slot, createContextId, useContext, implicit$FirstArg, noSerialize, useVisibleTask$, useServerData, useSignal, untrack, sync$, isDev, withLocale, event$, isServer, useStyles$, useStore, isBrowser, useContextProvider, useTask$, getLocale, jsx as jsx$1, SkipRender, createElement } from "@qwik.dev/core";
3
+ import { g as getClientNavPath, s as shouldPreload, p as preloadRouteBundles, l as loadClientData, i as isPromise, a as isSamePath, c as createLoaderSignal, t as toUrl, b as isSameOrigin, d as loadRoute, D as DEFAULT_LOADERS_SERIALIZATION_STRATEGY, C as CLIENT_DATA_CACHE, Q as Q_ROUTE, e as clientNavigate, f as deepFreeze, h as QFN_KEY, j as QACTION_KEY, k as QDATA_KEY } from "./chunks/routing.qwik.mjs";
5
4
  import * as qwikRouterConfig from "@qwik-router-config";
6
- import { z } from "zod";
5
+ import { _getContextContainer, SerializerSymbol, _UNINITIALIZED, _getContextElement, _hasStoreEffects, _getQContainerElement, forceStoreEffects, _waitUntilRendered, _getContextEvent, _serialize, _deserialize, _resolveContextWithoutSequentialScope } from "@qwik.dev/core/internal";
6
+ import { _asyncRequestStore } from "@qwik.dev/router/middleware/request-handler";
7
+ import * as v from "valibot";
8
+ import * as z from "zod";
7
9
  import { z as z2 } from "zod";
8
10
  import swRegister from "@qwik-router-sw-register";
9
11
  import { renderToStream } from "@qwik.dev/core/server";
12
+ import "@qwik.dev/core/preloader";
13
+ import "./chunks/types.qwik.mjs";
10
14
  const ErrorBoundary = component$((props) => {
11
- const store2 = useErrorBoundary();
12
- useOnWindow("qerror", $((e) => {
13
- store2.error = e.detail.error;
14
- }));
15
- if (store2.error && props.fallback$) {
16
- return /* @__PURE__ */ jsx(Fragment, {
17
- children: props.fallback$(store2.error)
18
- });
15
+ const store = useErrorBoundary();
16
+ useOnWindow(
17
+ "qerror",
18
+ $((e) => {
19
+ store.error = e.detail.error;
20
+ })
21
+ );
22
+ if (store.error && props.fallback$) {
23
+ return /* @__PURE__ */ jsx(Fragment, { children: props.fallback$(store.error) });
19
24
  }
20
25
  return /* @__PURE__ */ jsx(Slot, {});
21
26
  });
22
- const MODULE_CACHE = /* @__PURE__ */ new WeakMap();
23
- const CLIENT_DATA_CACHE = /* @__PURE__ */ new Map();
24
- const QACTION_KEY = "qaction";
25
- const QLOADER_KEY = "qloaders";
26
- const QFN_KEY = "qfunc";
27
- const QDATA_KEY = "qdata";
28
- const Q_ROUTE = "q:route";
29
- const DEFAULT_LOADERS_SERIALIZATION_STRATEGY = globalThis.__DEFAULT_LOADERS_SERIALIZATION_STRATEGY__ || "never";
30
- const MAX_Q_DATA_RETRY_COUNT = 3;
31
- const loadClientData = async (url, element, opts, retryCount = 0) => {
32
- const pagePathname = url.pathname;
33
- const pageSearch = url.search;
34
- const clientDataPath = getClientDataPath(pagePathname, pageSearch, {
35
- actionId: opts?.action?.id,
36
- loaderIds: opts?.loaderIds
37
- });
38
- let qData;
39
- if (!opts?.action) {
40
- qData = CLIENT_DATA_CACHE.get(clientDataPath);
41
- }
42
- if (opts?.preloadRouteBundles !== false) {
43
- preloadRouteBundles(pagePathname, 0.8);
44
- }
45
- let resolveFn;
46
- if (!qData) {
47
- const fetchOptions = getFetchOptions(opts?.action, opts?.clearCache);
48
- if (opts?.action) {
49
- opts.action.data = void 0;
50
- }
51
- qData = fetch(clientDataPath, fetchOptions).then((rsp) => {
52
- if (rsp.status === 404 && opts?.loaderIds && retryCount < MAX_Q_DATA_RETRY_COUNT) {
53
- opts.loaderIds = void 0;
54
- return loadClientData(url, element, opts, retryCount + 1);
55
- }
56
- if (rsp.redirected) {
57
- const redirectedURL = new URL(rsp.url);
58
- const isQData = redirectedURL.pathname.endsWith("/q-data.json");
59
- if (!isQData || redirectedURL.origin !== location.origin) {
60
- location.href = redirectedURL.href;
61
- return;
62
- }
63
- }
64
- if ((rsp.headers.get("content-type") || "").includes("json")) {
65
- return rsp.text().then((text) => {
66
- const [clientData] = _deserialize(text, element);
67
- if (!clientData) {
68
- location.href = url.href;
69
- return;
70
- }
71
- if (opts?.clearCache) {
72
- CLIENT_DATA_CACHE.delete(clientDataPath);
73
- }
74
- if (clientData.redirect) {
75
- location.href = clientData.redirect;
76
- } else if (opts?.action) {
77
- const { action } = opts;
78
- const actionData = clientData.loaders[action.id];
79
- resolveFn = () => {
80
- action.resolve({
81
- status: rsp.status,
82
- result: actionData
83
- });
84
- };
85
- }
86
- return clientData;
87
- });
88
- } else {
89
- if (opts?.isPrefetch !== true) {
90
- location.href = url.href;
91
- }
92
- return void 0;
93
- }
94
- });
95
- if (!opts?.action) {
96
- CLIENT_DATA_CACHE.set(clientDataPath, qData);
97
- }
98
- }
99
- return qData.then((v) => {
100
- if (!v) {
101
- CLIENT_DATA_CACHE.delete(clientDataPath);
102
- }
103
- resolveFn && resolveFn();
104
- return v;
105
- });
106
- };
107
- const getFetchOptions = (action, noCache) => {
108
- const actionData = action?.data;
109
- if (!actionData) {
110
- if (noCache) {
111
- return {
112
- cache: "no-cache",
113
- headers: {
114
- "Cache-Control": "no-cache",
115
- Pragma: "no-cache"
116
- }
117
- };
118
- }
119
- return void 0;
120
- }
121
- if (actionData instanceof FormData) {
122
- return {
123
- method: "POST",
124
- body: actionData
125
- };
126
- } else {
127
- return {
128
- method: "POST",
129
- body: JSON.stringify(actionData),
130
- headers: {
131
- "Content-Type": "application/json; charset=UTF-8"
132
- }
133
- };
134
- }
135
- };
136
- const toPath = (url) => url.pathname + url.search + url.hash;
137
- const toUrl = (url, baseUrl) => new URL(url, baseUrl.href);
138
- const isSameOrigin = (a, b) => a.origin === b.origin;
139
- const withSlash = (path) => path.endsWith("/") ? path : path + "/";
140
- const isSamePathname = ({ pathname: a }, { pathname: b }) => {
141
- const lDiff = Math.abs(a.length - b.length);
142
- return lDiff === 0 ? a === b : lDiff === 1 && withSlash(a) === withSlash(b);
143
- };
144
- const isSameSearchQuery = (a, b) => a.search === b.search;
145
- const isSamePath = (a, b) => isSameSearchQuery(a, b) && isSamePathname(a, b);
146
- const getClientDataPath = (pathname, pageSearch, options) => {
147
- let search = pageSearch ?? "";
148
- if (options?.actionId) {
149
- search += (search ? "&" : "?") + QACTION_KEY + "=" + encodeURIComponent(options.actionId);
150
- }
151
- if (options?.loaderIds) {
152
- for (const loaderId of options.loaderIds) {
153
- search += (search ? "&" : "?") + QLOADER_KEY + "=" + encodeURIComponent(loaderId);
154
- }
155
- }
156
- return pathname + (pathname.endsWith("/") ? "" : "/") + "q-data.json" + search;
157
- };
158
- const getClientNavPath = (props, baseUrl) => {
159
- const href = props.href;
160
- if (typeof href === "string" && typeof props.target !== "string" && !props.reload) {
161
- try {
162
- const linkUrl = toUrl(href.trim(), baseUrl.url);
163
- const currentUrl = toUrl("", baseUrl.url);
164
- if (isSameOrigin(linkUrl, currentUrl)) {
165
- return toPath(linkUrl);
166
- }
167
- } catch (e) {
168
- console.error(e);
169
- }
170
- } else if (props.reload) {
171
- return toPath(toUrl("", baseUrl.url));
172
- }
173
- return null;
174
- };
175
- const shouldPreload = (clientNavPath, currentLoc) => {
176
- if (clientNavPath) {
177
- const prefetchUrl = toUrl(clientNavPath, currentLoc.url);
178
- const currentUrl = toUrl("", currentLoc.url);
179
- return !isSamePathname(prefetchUrl, currentUrl);
180
- }
181
- return false;
182
- };
183
- const isPromise = (value) => {
184
- return value && typeof value.then === "function";
185
- };
186
- const createLoaderSignal = (loadersObject, loaderId, url, serializationStrategy, container) => {
187
- return createAsyncComputed$(async () => {
188
- if (isBrowser && loadersObject[loaderId] === _UNINITIALIZED) {
189
- const data = await loadClientData(url, void 0, {
190
- loaderIds: [
191
- loaderId
192
- ]
193
- });
194
- loadersObject[loaderId] = data?.loaders[loaderId] ?? _UNINITIALIZED;
195
- }
196
- return loadersObject[loaderId];
197
- }, {
198
- container,
199
- serializationStrategy
200
- });
201
- };
202
- const clientNavigate = (win, navType, fromURL, toURL, replaceState = false) => {
203
- if (navType !== "popstate") {
204
- const samePath = isSamePath(fromURL, toURL);
205
- const sameHash = fromURL.hash === toURL.hash;
206
- if (!samePath || !sameHash) {
207
- const newState = {
208
- _qRouterScroll: newScrollState()
209
- };
210
- if (replaceState) {
211
- win.history.replaceState(newState, "", toPath(toURL));
212
- } else {
213
- win.history.pushState(newState, "", toPath(toURL));
214
- }
215
- }
216
- }
217
- };
218
- const newScrollState = () => {
219
- return {
220
- x: 0,
221
- y: 0,
222
- w: 0,
223
- h: 0
224
- };
225
- };
226
- const preloadRouteBundles = (path, probability = 0.8) => {
227
- if (isBrowser) {
228
- path = path.endsWith("/") ? path : path + "/";
229
- path = path.length > 1 && path.startsWith("/") ? path.slice(1) : path;
230
- p(path, probability);
231
- }
232
- };
233
27
  const RouteStateContext = /* @__PURE__ */ createContextId("qc-s");
234
28
  const ContentContext = /* @__PURE__ */ createContextId("qc-c");
235
29
  const ContentInternalContext = /* @__PURE__ */ createContextId("qc-ic");
@@ -237,7 +31,6 @@ const DocumentHeadContext = /* @__PURE__ */ createContextId("qc-h");
237
31
  const RouteLocationContext = /* @__PURE__ */ createContextId("qc-l");
238
32
  const RouteNavigateContext = /* @__PURE__ */ createContextId("qc-n");
239
33
  const RouteActionContext = /* @__PURE__ */ createContextId("qc-a");
240
- const RouteInternalContext = /* @__PURE__ */ createContextId("qc-ir");
241
34
  const RoutePreventNavigateContext = /* @__PURE__ */ createContextId("qc-p");
242
35
  const useContent = () => useContext(ContentContext);
243
36
  const useDocumentHead = () => useContext(DocumentHeadContext);
@@ -245,7 +38,9 @@ const useLocation = () => useContext(RouteLocationContext);
245
38
  const useNavigate = () => useContext(RouteNavigateContext);
246
39
  const usePreventNavigateQrl = (fn) => {
247
40
  if (!__EXPERIMENTAL__.preventNavigate) {
248
- throw new Error('usePreventNavigate$ is experimental and must be enabled with `experimental: ["preventNavigate"]` in the `qwikVite` plugin.');
41
+ throw new Error(
42
+ 'usePreventNavigate$ is experimental and must be enabled with `experimental: ["preventNavigate"]` in the `qwikVite` plugin.'
43
+ );
249
44
  }
250
45
  const registerPreventNav = useContext(RoutePreventNavigateContext);
251
46
  useVisibleTask$(() => registerPreventNav(fn));
@@ -258,14 +53,22 @@ const Link = component$((props) => {
258
53
  const loc = useLocation();
259
54
  const originalHref = props.href;
260
55
  const anchorRef = useSignal();
261
- const { onClick$, prefetch: prefetchProp, reload, replaceState, scroll, ...linkProps } = /* @__PURE__ */ (() => props)();
262
- const clientNavPath = untrack(() => getClientNavPath({
263
- ...linkProps,
264
- reload
265
- }, loc));
56
+ const {
57
+ onClick$,
58
+ prefetch: prefetchProp,
59
+ reload,
60
+ replaceState,
61
+ scroll,
62
+ ...linkProps
63
+ } = /* @__PURE__ */ (() => props)();
64
+ const clientNavPath = untrack(() => getClientNavPath({ ...linkProps, reload }, loc));
266
65
  linkProps.href = clientNavPath || originalHref;
267
- const prefetchData = untrack(() => !!clientNavPath && prefetchProp !== false && prefetchProp !== "js" || void 0);
268
- const prefetch = untrack(() => prefetchData || !!clientNavPath && prefetchProp !== false && shouldPreload(clientNavPath, loc));
66
+ const prefetchData = untrack(
67
+ () => !!clientNavPath && prefetchProp !== false && prefetchProp !== "js" || void 0
68
+ );
69
+ const prefetch = untrack(
70
+ () => prefetchData || !!clientNavPath && prefetchProp !== false && shouldPreload(clientNavPath, loc)
71
+ );
269
72
  const handlePrefetch = prefetch ? $((_, elm) => {
270
73
  if (navigator.connection?.saveData) {
271
74
  return;
@@ -290,11 +93,7 @@ const Link = component$((props) => {
290
93
  if (event.defaultPrevented) {
291
94
  if (elm.href) {
292
95
  elm.setAttribute("aria-pressed", "true");
293
- nav(elm.href, {
294
- forceReload: reload,
295
- replaceState,
296
- scroll
297
- }).then(() => {
96
+ nav(elm.href, { forceReload: reload, replaceState, scroll }).then(() => {
298
97
  elm.removeAttribute("aria-pressed");
299
98
  });
300
99
  }
@@ -310,7 +109,9 @@ const Link = component$((props) => {
310
109
  if (handler) {
311
110
  const event = new CustomEvent("qvisible");
312
111
  if (Array.isArray(handler)) {
313
- handler.flat(10).forEach((handler2) => handler2?.(event, anchorRef.value));
112
+ handler.flat(10).forEach(
113
+ (handler2) => handler2?.(event, anchorRef.value)
114
+ );
314
115
  } else {
315
116
  handler?.(event, anchorRef.value);
316
117
  }
@@ -319,37 +120,36 @@ const Link = component$((props) => {
319
120
  handlePrefetch?.(void 0, anchorRef.value);
320
121
  }
321
122
  });
322
- return /* @__PURE__ */ jsx("a", {
323
- ref: anchorRef,
324
- "q:link": !!clientNavPath,
325
- ...linkProps,
326
- onClick$: [
327
- preventDefault,
328
- handlePreload,
329
- onClick$,
330
- handleClientSideNavigation
331
- ],
332
- "data-prefetch": prefetchData,
333
- onMouseOver$: [
334
- linkProps.onMouseOver$,
335
- handlePrefetch
336
- ],
337
- onFocus$: [
338
- linkProps.onFocus$,
339
- handlePrefetch
340
- ],
341
- // We need to prevent the onQVisible$ from being called twice since it is handled in the visible task
342
- onQVisible$: [],
343
- children: /* @__PURE__ */ jsx(Slot, {})
344
- });
123
+ return /* @__PURE__ */ jsx(
124
+ "a",
125
+ {
126
+ ref: anchorRef,
127
+ ...{ "q:link": !!clientNavPath },
128
+ ...linkProps,
129
+ onClick$: [
130
+ preventDefault,
131
+ handlePreload,
132
+ // needs to be in between preventDefault and onClick$ to ensure it starts asap.
133
+ onClick$,
134
+ handleClientSideNavigation
135
+ ],
136
+ "data-prefetch": prefetchData,
137
+ onMouseOver$: [linkProps.onMouseOver$, handlePrefetch],
138
+ onFocus$: [linkProps.onFocus$, handlePrefetch],
139
+ onQVisible$: [],
140
+ children: /* @__PURE__ */ jsx(Slot, {})
141
+ }
142
+ );
345
143
  });
346
- const resolveHead = (endpoint, routeLocation, contentModules, locale, defaults) => {
144
+ const resolveHead = (endpoint, routeLocation, contentModules, locale, defaults) => withLocale(locale, () => {
347
145
  const head = createDocumentHead(defaults);
348
- const getData = (loaderOrAction) => {
146
+ const getData = ((loaderOrAction) => {
349
147
  const id = loaderOrAction.__id;
350
148
  if (loaderOrAction.__brand === "server_loader") {
351
149
  if (!(id in endpoint.loaders)) {
352
- throw new Error("You can not get the returned data of a loader that has not been executed for this request.");
150
+ throw new Error(
151
+ "You can not get the returned data of a loader that has not been executed for this request."
152
+ );
353
153
  }
354
154
  }
355
155
  const data = endpoint.loaders[id];
@@ -357,25 +157,31 @@ const resolveHead = (endpoint, routeLocation, contentModules, locale, defaults)
357
157
  throw new Error("Loaders returning a promise can not be resolved for the head function.");
358
158
  }
359
159
  return data;
360
- };
361
- const headProps = {
362
- head,
363
- withLocale: (fn) => withLocale(locale, fn),
364
- resolveValue: getData,
365
- ...routeLocation
366
- };
367
- for (let i = contentModules.length - 1; i >= 0; i--) {
368
- const contentModuleHead = contentModules[i] && contentModules[i].head;
160
+ });
161
+ const fns = [];
162
+ for (const contentModule of contentModules) {
163
+ const contentModuleHead = contentModule?.head;
369
164
  if (contentModuleHead) {
370
165
  if (typeof contentModuleHead === "function") {
371
- resolveDocumentHead(head, withLocale(locale, () => contentModuleHead(headProps)));
166
+ fns.unshift(contentModuleHead);
372
167
  } else if (typeof contentModuleHead === "object") {
373
168
  resolveDocumentHead(head, contentModuleHead);
374
169
  }
375
170
  }
376
171
  }
377
- return headProps.head;
378
- };
172
+ if (fns.length) {
173
+ const headProps = {
174
+ head,
175
+ withLocale: (fn) => fn(),
176
+ resolveValue: getData,
177
+ ...routeLocation
178
+ };
179
+ for (const fn of fns) {
180
+ resolveDocumentHead(head, fn(headProps));
181
+ }
182
+ }
183
+ return head;
184
+ });
379
185
  const resolveDocumentHead = (resolvedHead, updatedHead) => {
380
186
  if (typeof updatedHead.title === "string") {
381
187
  resolvedHead.title = updatedHead.title;
@@ -402,220 +208,12 @@ const mergeArray = (existingArr, newArr) => {
402
208
  };
403
209
  const createDocumentHead = (defaults) => ({
404
210
  title: defaults?.title || "",
405
- meta: [
406
- ...defaults?.meta || []
407
- ],
408
- links: [
409
- ...defaults?.links || []
410
- ],
411
- styles: [
412
- ...defaults?.styles || []
413
- ],
414
- scripts: [
415
- ...defaults?.scripts || []
416
- ],
417
- frontmatter: {
418
- ...defaults?.frontmatter
419
- }
211
+ meta: [...defaults?.meta || []],
212
+ links: [...defaults?.links || []],
213
+ styles: [...defaults?.styles || []],
214
+ scripts: [...defaults?.scripts || []],
215
+ frontmatter: { ...defaults?.frontmatter }
420
216
  });
421
- function matchRoute(route, path) {
422
- const routeIdx = startIdxSkipSlash(route);
423
- const routeLength = lengthNoTrailingSlash(route);
424
- const pathIdx = startIdxSkipSlash(path);
425
- const pathLength = lengthNoTrailingSlash(path);
426
- return matchRoutePart(route, routeIdx, routeLength, path, pathIdx, pathLength);
427
- }
428
- function matchRoutePart(route, routeIdx, routeLength, path, pathIdx, pathLength) {
429
- if (path.startsWith("/build/")) {
430
- return null;
431
- }
432
- let params = null;
433
- while (routeIdx < routeLength) {
434
- const routeCh = route.charCodeAt(routeIdx++);
435
- const pathCh = path.charCodeAt(pathIdx++);
436
- if (routeCh === 91) {
437
- const isMany = isThreeDots(route, routeIdx);
438
- const paramNameStart = routeIdx + (isMany ? 3 : 0);
439
- const paramNameEnd = scan(route, paramNameStart, routeLength, 93);
440
- const paramName = route.substring(paramNameStart, paramNameEnd);
441
- const paramSuffixEnd = scan(route, paramNameEnd + 1, routeLength, 47);
442
- const suffix = route.substring(paramNameEnd + 1, paramSuffixEnd);
443
- routeIdx = paramNameEnd + 1;
444
- const paramValueStart = pathIdx - 1;
445
- if (isMany) {
446
- const match = recursiveScan(paramName, suffix, path, paramValueStart, pathLength, route, routeIdx + suffix.length + 1, routeLength);
447
- if (match) {
448
- return Object.assign(params || (params = {}), match);
449
- }
450
- }
451
- const paramValueEnd = scan(path, paramValueStart, pathLength, 47, suffix);
452
- if (paramValueEnd == -1) {
453
- return null;
454
- }
455
- const paramValue = path.substring(paramValueStart, paramValueEnd);
456
- if (!isMany && !suffix && !paramValue) {
457
- return null;
458
- }
459
- pathIdx = paramValueEnd;
460
- (params || (params = {}))[paramName] = decodeURIComponent(paramValue);
461
- } else if (routeCh !== pathCh) {
462
- if (!(isNaN(pathCh) && isRestParameter(route, routeIdx))) {
463
- return null;
464
- }
465
- }
466
- }
467
- if (allConsumed(route, routeIdx) && allConsumed(path, pathIdx)) {
468
- return params || {};
469
- } else {
470
- return null;
471
- }
472
- }
473
- function isRestParameter(text, idx) {
474
- return text.charCodeAt(idx) === 91 && isThreeDots(text, idx + 1);
475
- }
476
- function lengthNoTrailingSlash(text) {
477
- const length = text.length;
478
- return length > 1 && text.charCodeAt(length - 1) === 47 ? length - 1 : length;
479
- }
480
- function allConsumed(text, idx) {
481
- const length = text.length;
482
- return idx >= length || idx == length - 1 && text.charCodeAt(idx) === 47;
483
- }
484
- function startIdxSkipSlash(text) {
485
- return text.charCodeAt(0) === 47 ? 1 : 0;
486
- }
487
- function isThreeDots(text, idx) {
488
- return text.charCodeAt(idx) === 46 && text.charCodeAt(idx + 1) === 46 && text.charCodeAt(idx + 2) === 46;
489
- }
490
- function scan(text, idx, end, ch, suffix = "") {
491
- while (idx < end && text.charCodeAt(idx) !== ch) {
492
- idx++;
493
- }
494
- const suffixLength = suffix.length;
495
- for (let i = 0; i < suffixLength; i++) {
496
- if (text.charCodeAt(idx - suffixLength + i) !== suffix.charCodeAt(i)) {
497
- return -1;
498
- }
499
- }
500
- return idx - suffixLength;
501
- }
502
- function recursiveScan(paramName, suffix, path, pathStart, pathLength, route, routeStart, routeLength) {
503
- if (path.charCodeAt(pathStart) === 47) {
504
- pathStart++;
505
- }
506
- let pathIdx = pathLength;
507
- const sep = suffix + "/";
508
- while (pathIdx >= pathStart) {
509
- const match = matchRoutePart(route, routeStart, routeLength, path, pathIdx, pathLength);
510
- if (match) {
511
- let value = path.substring(pathStart, Math.min(pathIdx, pathLength));
512
- if (value.endsWith(sep)) {
513
- value = value.substring(0, value.length - sep.length);
514
- }
515
- match[paramName] = decodeURIComponent(value);
516
- return match;
517
- }
518
- const newPathIdx = lastIndexOf(path, pathStart, sep, pathIdx, pathStart - 1) + sep.length;
519
- if (pathIdx === newPathIdx) {
520
- break;
521
- }
522
- pathIdx = newPathIdx;
523
- }
524
- return null;
525
- }
526
- function lastIndexOf(text, start, match, searchIdx, notFoundIdx) {
527
- let idx = text.lastIndexOf(match, searchIdx);
528
- if (idx == searchIdx - match.length) {
529
- idx = text.lastIndexOf(match, searchIdx - match.length - 1);
530
- }
531
- return idx > start ? idx : notFoundIdx;
532
- }
533
- var RouteDataProp = /* @__PURE__ */ (function(RouteDataProp2) {
534
- RouteDataProp2[RouteDataProp2["RouteName"] = 0] = "RouteName";
535
- RouteDataProp2[RouteDataProp2["Loaders"] = 1] = "Loaders";
536
- RouteDataProp2[RouteDataProp2["OriginalPathname"] = 2] = "OriginalPathname";
537
- RouteDataProp2[RouteDataProp2["RouteBundleNames"] = 3] = "RouteBundleNames";
538
- return RouteDataProp2;
539
- })({});
540
- var MenuDataProp = /* @__PURE__ */ (function(MenuDataProp2) {
541
- MenuDataProp2[MenuDataProp2["Pathname"] = 0] = "Pathname";
542
- MenuDataProp2[MenuDataProp2["MenuLoader"] = 1] = "MenuLoader";
543
- return MenuDataProp2;
544
- })({});
545
- const deepFreeze = (obj) => {
546
- if (obj == null) {
547
- return obj;
548
- }
549
- Object.getOwnPropertyNames(obj).forEach((prop) => {
550
- const value = obj[prop];
551
- if (value && typeof value === "object" && !Object.isFrozen(value)) {
552
- deepFreeze(value);
553
- }
554
- });
555
- return Object.freeze(obj);
556
- };
557
- const loadRoute = async (routes, menus, cacheModules, pathname) => {
558
- if (!Array.isArray(routes)) {
559
- return null;
560
- }
561
- for (const routeData of routes) {
562
- const routeName = routeData[RouteDataProp.RouteName];
563
- const params = matchRoute(routeName, pathname);
564
- if (!params) {
565
- continue;
566
- }
567
- const loaders = routeData[RouteDataProp.Loaders];
568
- const routeBundleNames = routeData[RouteDataProp.RouteBundleNames];
569
- const modules = new Array(loaders.length);
570
- const pendingLoads = [];
571
- loaders.forEach((moduleLoader, i) => {
572
- loadModule(moduleLoader, pendingLoads, (routeModule) => modules[i] = routeModule, cacheModules);
573
- });
574
- const menuLoader = getMenuLoader(menus, pathname);
575
- let menu = void 0;
576
- loadModule(menuLoader, pendingLoads, (menuModule) => menu = menuModule?.default, cacheModules);
577
- if (pendingLoads.length > 0) {
578
- await Promise.all(pendingLoads);
579
- }
580
- return [
581
- routeName,
582
- params,
583
- modules,
584
- deepFreeze(menu),
585
- routeBundleNames
586
- ];
587
- }
588
- return null;
589
- };
590
- const loadModule = (moduleLoader, pendingLoads, moduleSetter, cacheModules) => {
591
- if (typeof moduleLoader === "function") {
592
- const loadedModule = MODULE_CACHE.get(moduleLoader);
593
- if (loadedModule) {
594
- moduleSetter(loadedModule);
595
- } else {
596
- const moduleOrPromise = moduleLoader();
597
- if (typeof moduleOrPromise.then === "function") {
598
- pendingLoads.push(moduleOrPromise.then((loadedModule2) => {
599
- if (cacheModules !== false) {
600
- MODULE_CACHE.set(moduleLoader, loadedModule2);
601
- }
602
- moduleSetter(loadedModule2);
603
- }));
604
- } else if (moduleOrPromise) {
605
- moduleSetter(moduleOrPromise);
606
- }
607
- }
608
- }
609
- };
610
- const getMenuLoader = (menus, pathname) => {
611
- if (menus) {
612
- pathname = pathname.endsWith("/") ? pathname : pathname + "/";
613
- const menu = menus.find((m) => m[MenuDataProp.Pathname] === pathname || pathname.startsWith(m[MenuDataProp.Pathname] + (pathname.endsWith("/") ? "" : "/")));
614
- if (menu) {
615
- return menu[MenuDataProp.MenuLoader];
616
- }
617
- }
618
- };
619
217
  function callRestoreScrollOnDocument() {
620
218
  if (document.__q_scroll_restore__) {
621
219
  document.__q_scroll_restore__();
@@ -660,21 +258,11 @@ const saveScrollHistory = (scrollState) => {
660
258
  history.replaceState(state, "");
661
259
  };
662
260
  const spaInit = event$((_, el) => {
663
- const win = window;
664
- const spa = "_qRouterSPA";
665
- const initPopstate = "_qRouterInitPopstate";
666
- const initAnchors = "_qRouterInitAnchors";
667
- const initVisibility = "_qRouterInitVisibility";
668
- const initScroll = "_qRouterInitScroll";
669
- if (!win[spa] && !win[initPopstate] && !win[initAnchors] && !win[initVisibility] && !win[initScroll]) {
261
+ if (!window._qRouterSPA && !window._qRouterInitPopstate) {
670
262
  const currentPath = location.pathname + location.search;
671
- const historyPatch = "_qRouterHistoryPatch";
672
- const scrollEnabled = "_qRouterScrollEnabled";
673
- const debounceTimeout = "_qRouterScrollDebounce";
674
- const scrollHistory = "_qRouterScroll";
675
263
  const checkAndScroll = (scrollState) => {
676
264
  if (scrollState) {
677
- win.scrollTo(scrollState.x, scrollState.y);
265
+ window.scrollTo(scrollState.x, scrollState.y);
678
266
  }
679
267
  };
680
268
  const currentScrollState2 = () => {
@@ -688,16 +276,16 @@ const spaInit = event$((_, el) => {
688
276
  };
689
277
  const saveScrollState = (scrollState) => {
690
278
  const state = history.state || {};
691
- state[scrollHistory] = scrollState || currentScrollState2();
279
+ state._qRouterScroll = scrollState || currentScrollState2();
692
280
  history.replaceState(state, "");
693
281
  };
694
282
  saveScrollState();
695
- win[initPopstate] = () => {
696
- if (win[spa]) {
283
+ window._qRouterInitPopstate = () => {
284
+ if (window._qRouterSPA) {
697
285
  return;
698
286
  }
699
- win[scrollEnabled] = false;
700
- clearTimeout(win[debounceTimeout]);
287
+ window._qRouterScrollEnabled = false;
288
+ clearTimeout(window._qRouterScrollDebounce);
701
289
  if (currentPath !== location.pathname + location.search) {
702
290
  const getContainer = (el2) => el2.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])");
703
291
  const container = getContainer(el);
@@ -707,33 +295,31 @@ const spaInit = event$((_, el) => {
707
295
  id: "qc--n"
708
296
  });
709
297
  if (nav) {
710
- nav(location.href, {
711
- type: "popstate"
712
- });
298
+ nav(location.href, { type: "popstate" });
713
299
  } else {
714
300
  location.reload();
715
301
  }
716
302
  } else {
717
303
  if (history.scrollRestoration === "manual") {
718
- const scrollState = history.state?.[scrollHistory];
304
+ const scrollState = history.state?._qRouterScroll;
719
305
  checkAndScroll(scrollState);
720
- win[scrollEnabled] = true;
306
+ window._qRouterScrollEnabled = true;
721
307
  }
722
308
  }
723
309
  };
724
- if (!win[historyPatch]) {
725
- win[historyPatch] = true;
310
+ if (!window._qRouterHistoryPatch) {
311
+ window._qRouterHistoryPatch = true;
726
312
  const pushState = history.pushState;
727
313
  const replaceState = history.replaceState;
728
314
  const prepareState = (state) => {
729
315
  if (state === null || typeof state === "undefined") {
730
316
  state = {};
731
317
  } else if (state?.constructor !== Object) {
732
- state = {
733
- _data: state
734
- };
318
+ state = { _data: state };
735
319
  if (isDev) {
736
- console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`");
320
+ console.warn(
321
+ "In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"
322
+ );
737
323
  }
738
324
  }
739
325
  state._qRouterScroll = state._qRouterScroll || currentScrollState2();
@@ -748,8 +334,8 @@ const spaInit = event$((_, el) => {
748
334
  return replaceState.call(history, state, title, url);
749
335
  };
750
336
  }
751
- win[initAnchors] = (event) => {
752
- if (win[spa] || event.defaultPrevented) {
337
+ window._qRouterInitAnchors = (event) => {
338
+ if (window._qRouterSPA || event.defaultPrevented) {
753
339
  return;
754
340
  }
755
341
  const target = event.target.closest("a[href]");
@@ -768,13 +354,9 @@ const spaInit = event$((_, el) => {
768
354
  if (dest.href.endsWith("#")) {
769
355
  window.scrollTo(0, 0);
770
356
  } else {
771
- win[scrollEnabled] = false;
772
- clearTimeout(win[debounceTimeout]);
773
- saveScrollState({
774
- ...currentScrollState2(),
775
- x: 0,
776
- y: 0
777
- });
357
+ window._qRouterScrollEnabled = false;
358
+ clearTimeout(window._qRouterScrollDebounce);
359
+ saveScrollState({ ...currentScrollState2(), x: 0, y: 0 });
778
360
  location.reload();
779
361
  }
780
362
  } else {
@@ -787,30 +369,28 @@ const spaInit = event$((_, el) => {
787
369
  }
788
370
  }
789
371
  };
790
- win[initVisibility] = () => {
791
- if (!win[spa] && win[scrollEnabled] && document.visibilityState === "hidden") {
372
+ window._qRouterInitVisibility = () => {
373
+ if (!window._qRouterSPA && window._qRouterScrollEnabled && document.visibilityState === "hidden") {
792
374
  saveScrollState();
793
375
  }
794
376
  };
795
- win[initScroll] = () => {
796
- if (win[spa] || !win[scrollEnabled]) {
377
+ window._qRouterInitScroll = () => {
378
+ if (window._qRouterSPA || !window._qRouterScrollEnabled) {
797
379
  return;
798
380
  }
799
- clearTimeout(win[debounceTimeout]);
800
- win[debounceTimeout] = setTimeout(() => {
381
+ clearTimeout(window._qRouterScrollDebounce);
382
+ window._qRouterScrollDebounce = setTimeout(() => {
801
383
  saveScrollState();
802
- win[debounceTimeout] = void 0;
384
+ window._qRouterScrollDebounce = void 0;
803
385
  }, 200);
804
386
  };
805
- win[scrollEnabled] = true;
387
+ window._qRouterScrollEnabled = true;
806
388
  setTimeout(() => {
807
- win.addEventListener("popstate", win[initPopstate]);
808
- win.addEventListener("scroll", win[initScroll], {
809
- passive: true
810
- });
811
- document.body.addEventListener("click", win[initAnchors]);
812
- if (!win.navigation) {
813
- document.addEventListener("visibilitychange", win[initVisibility], {
389
+ window.addEventListener("popstate", window._qRouterInitPopstate);
390
+ window.addEventListener("scroll", window._qRouterInitScroll, { passive: true });
391
+ document.addEventListener("click", window._qRouterInitAnchors);
392
+ if (!window.navigation) {
393
+ document.addEventListener("visibilitychange", window._qRouterInitVisibility, {
814
394
  passive: true
815
395
  });
816
396
  }
@@ -828,47 +408,40 @@ const startViewTransition = (params) => {
828
408
  } catch {
829
409
  transition = document.startViewTransition(params.update);
830
410
  }
831
- const event = new CustomEvent("qviewtransition", {
832
- detail: transition
833
- });
411
+ const event = new CustomEvent("qviewtransition", { detail: transition });
834
412
  document.dispatchEvent(event);
835
413
  return transition;
836
414
  } else {
837
415
  params.update?.();
838
416
  }
839
417
  };
418
+ const transitionCss = "@layer qwik{@supports selector(html:active-view-transition-type(type)){html:active-view-transition-type(qwik-navigation){:root{view-transition-name:none}}}@supports not selector(html:active-view-transition-type(type)){:root{view-transition-name:none}}}";
840
419
  const QWIK_CITY_SCROLLER = "_qCityScroller";
841
420
  const QWIK_ROUTER_SCROLLER = "_qRouterScroller";
842
421
  const preventNav = {};
843
- const internalState = {
844
- navCount: 0
845
- };
422
+ const internalState = { navCount: 0 };
846
423
  const useQwikRouter = (props) => {
847
- useStyles$(`
848
- @layer qwik {
849
- @supports selector(html:active-view-transition-type(type)) {
850
- html:active-view-transition-type(qwik-navigation) {
851
- :root{view-transition-name:none}
852
- }
853
- }
854
- @supports not selector(html:active-view-transition-type(type)) {
855
- :root{view-transition-name:none}
856
- }
857
- }
858
- `);
424
+ if (!isServer) {
425
+ throw new Error(
426
+ "useQwikRouter can only run during SSR on the server. If you are seeing this, it means you are re-rendering the root of your application. Fix that or use the <QwikRouterProvider> component around the root of your application."
427
+ );
428
+ }
429
+ useStyles$(transitionCss);
859
430
  const env = useQwikRouterEnv();
860
431
  if (!env?.params) {
861
- throw new Error(`Missing Qwik Router Env Data for help visit https://github.com/QwikDev/qwik/issues/6237`);
432
+ throw new Error(
433
+ `Missing Qwik Router Env Data for help visit https://github.com/QwikDev/qwik/issues/6237`
434
+ );
862
435
  }
863
436
  const urlEnv = useServerData("url");
864
437
  if (!urlEnv) {
865
438
  throw new Error(`Missing Qwik URL Env Data`);
866
439
  }
867
440
  const serverHead = useServerData("documentHead");
868
- if (isServer) {
869
- if (env.ev.originalUrl.pathname !== env.ev.url.pathname && !__EXPERIMENTAL__.enableRequestRewrite) {
870
- throw new Error(`enableRequestRewrite is an experimental feature and is not enabled. Please enable the feature flag by adding \`experimental: ["enableRequestRewrite"]\` to your qwikVite plugin options.`);
871
- }
441
+ if (env.ev.originalUrl.pathname !== env.ev.url.pathname && !__EXPERIMENTAL__.enableRequestRewrite) {
442
+ throw new Error(
443
+ `enableRequestRewrite is an experimental feature and is not enabled. Please enable the feature flag by adding \`experimental: ["enableRequestRewrite"]\` to your qwikVite plugin options.`
444
+ );
872
445
  }
873
446
  const url = new URL(urlEnv);
874
447
  const routeLocationTarget = {
@@ -877,9 +450,7 @@ const useQwikRouter = (props) => {
877
450
  isNavigating: false,
878
451
  prevUrl: void 0
879
452
  };
880
- const routeLocation = useStore(routeLocationTarget, {
881
- deep: false
882
- });
453
+ const routeLocation = useStore(routeLocationTarget, { deep: false });
883
454
  const navResolver = {};
884
455
  const container = _getContextContainer();
885
456
  const getSerializationStrategy = (loaderId) => {
@@ -889,23 +460,29 @@ const useQwikRouter = (props) => {
889
460
  const loaderState = {};
890
461
  for (const [key, value] of Object.entries(env.response.loaders)) {
891
462
  loadersObject[key] = value;
892
- loaderState[key] = createLoaderSignal(loadersObject, key, url, getSerializationStrategy(key), container);
463
+ loaderState[key] = createLoaderSignal(
464
+ loadersObject,
465
+ key,
466
+ url,
467
+ getSerializationStrategy(key),
468
+ container
469
+ );
893
470
  }
894
471
  loadersObject[SerializerSymbol] = (obj) => {
895
472
  const loadersSerializationObject = {};
896
- for (const [k, v] of Object.entries(obj)) {
897
- loadersSerializationObject[k] = getSerializationStrategy(k) === "always" ? v : _UNINITIALIZED;
473
+ for (const [k, v2] of Object.entries(obj)) {
474
+ loadersSerializationObject[k] = getSerializationStrategy(k) === "always" ? v2 : _UNINITIALIZED;
898
475
  }
899
476
  return loadersSerializationObject;
900
477
  };
901
478
  const routeInternal = useSignal({
902
479
  type: "initial",
903
480
  dest: url,
904
- forceReload: false,
905
- replaceState: false,
906
481
  scroll: true
907
482
  });
908
- const documentHead = useStore(() => createDocumentHead(serverHead));
483
+ const documentHead = useStore(
484
+ () => createDocumentHead(serverHead)
485
+ );
909
486
  const content = useStore({
910
487
  headings: void 0,
911
488
  menu: void 0
@@ -913,14 +490,16 @@ const useQwikRouter = (props) => {
913
490
  const contentInternal = useSignal();
914
491
  const currentActionId = env.response.action;
915
492
  const currentAction = currentActionId ? env.response.loaders[currentActionId] : void 0;
916
- const actionState = useSignal(currentAction ? {
917
- id: currentActionId,
918
- data: env.response.formData,
919
- output: {
920
- result: currentAction,
921
- status: env.response.status
922
- }
923
- } : void 0);
493
+ const actionState = useSignal(
494
+ currentAction ? {
495
+ id: currentActionId,
496
+ data: env.response.formData,
497
+ output: {
498
+ result: currentAction,
499
+ status: env.response.status
500
+ }
501
+ } : void 0
502
+ );
924
503
  const registerPreventNav = $((fn$) => {
925
504
  if (!isBrowser) {
926
505
  return;
@@ -930,9 +509,9 @@ const useQwikRouter = (props) => {
930
509
  if (!preventNav.$cbs$) {
931
510
  return;
932
511
  }
933
- const prevents = [
934
- ...preventNav.$cbs$.values()
935
- ].map((cb) => cb.resolved ? cb.resolved() : cb());
512
+ const prevents = [...preventNav.$cbs$.values()].map(
513
+ (cb) => cb.resolved ? cb.resolved() : cb()
514
+ );
936
515
  if (prevents.some(Boolean)) {
937
516
  event.preventDefault();
938
517
  event.returnValue = true;
@@ -952,17 +531,22 @@ const useQwikRouter = (props) => {
952
531
  };
953
532
  });
954
533
  const goto = $(async (path, opt) => {
955
- const { type = "link", forceReload = path === void 0, replaceState = false, scroll = true } = typeof opt === "object" ? opt : {
956
- forceReload: opt
957
- };
534
+ const {
535
+ type = "link",
536
+ forceReload = path === void 0,
537
+ // Hack for nav() because this API is already set.
538
+ replaceState = false,
539
+ scroll = true
540
+ } = typeof opt === "object" ? opt : { forceReload: opt };
958
541
  internalState.navCount++;
542
+ if (isBrowser && type === "link" && routeInternal.value.type === "initial") {
543
+ routeInternal.value.dest = new URL(window.location.href);
544
+ }
959
545
  const lastDest = routeInternal.value.dest;
960
546
  const dest = path === void 0 ? lastDest : typeof path === "number" ? path : toUrl(path, routeLocation.url);
961
547
  if (preventNav.$cbs$ && (forceReload || typeof dest === "number" || !isSamePath(dest, lastDest) || !isSameOrigin(dest, lastDest))) {
962
548
  const ourNavId = internalState.navCount;
963
- const prevents = await Promise.all([
964
- ...preventNav.$cbs$.values()
965
- ].map((cb) => cb(dest)));
549
+ const prevents = await Promise.all([...preventNav.$cbs$.values()].map((cb) => cb(dest)));
966
550
  if (ourNavId !== internalState.navCount || prevents.some(Boolean)) {
967
551
  if (ourNavId === internalState.navCount && type === "popstate") {
968
552
  history.pushState(null, "", lastDest);
@@ -991,7 +575,9 @@ const useQwikRouter = (props) => {
991
575
  if (!scroller) {
992
576
  scroller = document.getElementById(QWIK_CITY_SCROLLER);
993
577
  if (scroller && isDev) {
994
- console.warn(`Please update your scroller ID to "${QWIK_ROUTER_SCROLLER}" as "${QWIK_CITY_SCROLLER}" is deprecated and will be removed in V3`);
578
+ console.warn(
579
+ `Please update your scroller ID to "${QWIK_ROUTER_SCROLLER}" as "${QWIK_CITY_SCROLLER}" is deprecated and will be removed in V3`
580
+ );
995
581
  }
996
582
  }
997
583
  if (!scroller) {
@@ -1013,7 +599,12 @@ const useQwikRouter = (props) => {
1013
599
  };
1014
600
  if (isBrowser) {
1015
601
  loadClientData(dest, _getContextElement());
1016
- loadRoute(qwikRouterConfig.routes, qwikRouterConfig.menus, qwikRouterConfig.cacheModules, dest.pathname);
602
+ loadRoute(
603
+ qwikRouterConfig.routes,
604
+ qwikRouterConfig.menus,
605
+ qwikRouterConfig.cacheModules,
606
+ dest.pathname
607
+ );
1017
608
  }
1018
609
  actionState.value = void 0;
1019
610
  routeLocation.isNavigating = true;
@@ -1028,14 +619,11 @@ const useQwikRouter = (props) => {
1028
619
  useContextProvider(RouteNavigateContext, goto);
1029
620
  useContextProvider(RouteStateContext, loaderState);
1030
621
  useContextProvider(RouteActionContext, actionState);
1031
- useContextProvider(RouteInternalContext, routeInternal);
1032
622
  useContextProvider(RoutePreventNavigateContext, registerPreventNav);
1033
623
  useTask$(({ track }) => {
1034
624
  async function run() {
1035
- const [navigation, action] = track(() => [
1036
- routeInternal.value,
1037
- actionState.value
1038
- ]);
625
+ const navigation = track(routeInternal);
626
+ const action = track(actionState);
1039
627
  const locale = getLocale("");
1040
628
  const prevUrl = routeLocation.url;
1041
629
  const navType = action ? "form" : navigation.type;
@@ -1057,17 +645,19 @@ const useQwikRouter = (props) => {
1057
645
  } else if (!globalThis.__NO_TRAILING_SLASH__) {
1058
646
  trackUrl.pathname += "/";
1059
647
  }
1060
- let loadRoutePromise = loadRoute(qwikRouterConfig.routes, qwikRouterConfig.menus, qwikRouterConfig.cacheModules, trackUrl.pathname);
648
+ let loadRoutePromise = loadRoute(
649
+ qwikRouterConfig.routes,
650
+ qwikRouterConfig.menus,
651
+ qwikRouterConfig.cacheModules,
652
+ trackUrl.pathname
653
+ );
1061
654
  elm = _getContextElement();
1062
655
  const pageData = clientPageData = await loadClientData(trackUrl, elm, {
1063
656
  action,
1064
657
  clearCache: true
1065
658
  });
1066
659
  if (!pageData) {
1067
- routeInternal.untrackedValue = {
1068
- type: navType,
1069
- dest: trackUrl
1070
- };
660
+ routeInternal.untrackedValue = { type: navType, dest: trackUrl };
1071
661
  return;
1072
662
  }
1073
663
  const newHref = pageData.href;
@@ -1120,11 +710,14 @@ const useQwikRouter = (props) => {
1120
710
  }
1121
711
  routeLocationTarget.params = params;
1122
712
  }
1123
- routeInternal.untrackedValue = {
1124
- type: navType,
1125
- dest: trackUrl
1126
- };
1127
- const resolvedHead = resolveHead(clientPageData, routeLocation, contentModules, locale, serverHead);
713
+ routeInternal.untrackedValue = { type: navType, dest: trackUrl };
714
+ const resolvedHead = resolveHead(
715
+ clientPageData,
716
+ routeLocation,
717
+ contentModules,
718
+ locale,
719
+ serverHead
720
+ );
1128
721
  content.headings = pageModule.headings;
1129
722
  content.menu = menu;
1130
723
  contentInternal.untrackedValue = noSerialize(contentModules);
@@ -1140,7 +733,8 @@ const useQwikRouter = (props) => {
1140
733
  scrollState = getScrollHistory();
1141
734
  }
1142
735
  const scroller = document.getElementById(QWIK_ROUTER_SCROLLER) ?? document.documentElement;
1143
- if (navigation.scroll && (!navigation.forceReload || !isSamePath(trackUrl, prevUrl)) && (navType === "link" || navType === "popstate") || navType === "form" && !isSamePath(trackUrl, prevUrl)) {
736
+ if (navigation.scroll && (!navigation.forceReload || !isSamePath(trackUrl, prevUrl)) && (navType === "link" || navType === "popstate") || // Action might have responded with a redirect.
737
+ navType === "form" && !isSamePath(trackUrl, prevUrl)) {
1144
738
  document.__q_scroll_restore__ = () => restoreScroll(navType, trackUrl, prevUrl, scroller, scrollState);
1145
739
  }
1146
740
  const loaders = clientPageData?.loaders;
@@ -1151,39 +745,44 @@ const useQwikRouter = (props) => {
1151
745
  const awaitedValue = await value;
1152
746
  loadersObject[key] = awaitedValue;
1153
747
  if (!signal) {
1154
- loaderState[key] = createLoaderSignal(loadersObject, key, trackUrl, DEFAULT_LOADERS_SERIALIZATION_STRATEGY, container2);
748
+ loaderState[key] = createLoaderSignal(
749
+ loadersObject,
750
+ key,
751
+ trackUrl,
752
+ DEFAULT_LOADERS_SERIALIZATION_STRATEGY,
753
+ container2
754
+ );
1155
755
  } else {
1156
756
  signal.invalidate();
1157
757
  }
1158
758
  }
1159
759
  }
1160
760
  CLIENT_DATA_CACHE.clear();
1161
- const win = window;
1162
- if (!win._qRouterSPA) {
1163
- win._qRouterSPA = true;
761
+ if (!window._qRouterSPA) {
762
+ window._qRouterSPA = true;
1164
763
  history.scrollRestoration = "manual";
1165
- win.addEventListener("popstate", () => {
1166
- win._qRouterScrollEnabled = false;
1167
- clearTimeout(win._qRouterScrollDebounce);
764
+ window.addEventListener("popstate", () => {
765
+ window._qRouterScrollEnabled = false;
766
+ clearTimeout(window._qRouterScrollDebounce);
1168
767
  goto(location.href, {
1169
768
  type: "popstate"
1170
769
  });
1171
770
  });
1172
- win.removeEventListener("popstate", win._qRouterInitPopstate);
1173
- win._qRouterInitPopstate = void 0;
1174
- if (!win._qRouterHistoryPatch) {
1175
- win._qRouterHistoryPatch = true;
771
+ window.removeEventListener("popstate", window._qRouterInitPopstate);
772
+ window._qRouterInitPopstate = void 0;
773
+ if (!window._qRouterHistoryPatch) {
774
+ window._qRouterHistoryPatch = true;
1176
775
  const pushState = history.pushState;
1177
776
  const replaceState2 = history.replaceState;
1178
777
  const prepareState = (state) => {
1179
778
  if (state === null || typeof state === "undefined") {
1180
779
  state = {};
1181
780
  } else if (state?.constructor !== Object) {
1182
- state = {
1183
- _data: state
1184
- };
781
+ state = { _data: state };
1185
782
  if (isDev) {
1186
- console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`");
783
+ console.warn(
784
+ "In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"
785
+ );
1187
786
  }
1188
787
  }
1189
788
  state._qRouterScroll = state._qRouterScroll || currentScrollState(scroller);
@@ -1198,7 +797,7 @@ const useQwikRouter = (props) => {
1198
797
  return replaceState2.call(history, state, title, url2);
1199
798
  };
1200
799
  }
1201
- document.body.addEventListener("click", (event) => {
800
+ document.addEventListener("click", (event) => {
1202
801
  if (event.defaultPrevented) {
1203
802
  return;
1204
803
  }
@@ -1213,8 +812,8 @@ const useQwikRouter = (props) => {
1213
812
  if (dest.href !== prev.href) {
1214
813
  history.pushState(null, "", dest);
1215
814
  }
1216
- win._qRouterScrollEnabled = false;
1217
- clearTimeout(win._qRouterScrollDebounce);
815
+ window._qRouterScrollEnabled = false;
816
+ clearTimeout(window._qRouterScrollDebounce);
1218
817
  saveScrollHistory({
1219
818
  ...currentScrollState(scroller),
1220
819
  x: 0,
@@ -1227,43 +826,49 @@ const useQwikRouter = (props) => {
1227
826
  }
1228
827
  }
1229
828
  });
1230
- document.body.removeEventListener("click", win._qRouterInitAnchors);
1231
- win._qRouterInitAnchors = void 0;
829
+ document.removeEventListener("click", window._qRouterInitAnchors);
830
+ window._qRouterInitAnchors = void 0;
1232
831
  if (!window.navigation) {
1233
- document.addEventListener("visibilitychange", () => {
1234
- if ((win._qRouterScrollEnabled || win._qCityScrollEnabled) && document.visibilityState === "hidden") {
1235
- if (win._qCityScrollEnabled) {
1236
- console.warn('"_qCityScrollEnabled" is deprecated. Use "_qRouterScrollEnabled" instead.');
832
+ document.addEventListener(
833
+ "visibilitychange",
834
+ () => {
835
+ if ((window._qRouterScrollEnabled || window._qCityScrollEnabled) && document.visibilityState === "hidden") {
836
+ if (window._qCityScrollEnabled) {
837
+ console.warn(
838
+ '"_qCityScrollEnabled" is deprecated. Use "_qRouterScrollEnabled" instead.'
839
+ );
840
+ }
841
+ const scrollState2 = currentScrollState(scroller);
842
+ saveScrollHistory(scrollState2);
1237
843
  }
844
+ },
845
+ { passive: true }
846
+ );
847
+ document.removeEventListener("visibilitychange", window._qRouterInitVisibility);
848
+ window._qRouterInitVisibility = void 0;
849
+ }
850
+ window.addEventListener(
851
+ "scroll",
852
+ () => {
853
+ if (!window._qRouterScrollEnabled && !window._qCityScrollEnabled) {
854
+ return;
855
+ }
856
+ clearTimeout(window._qRouterScrollDebounce);
857
+ window._qRouterScrollDebounce = setTimeout(() => {
1238
858
  const scrollState2 = currentScrollState(scroller);
1239
859
  saveScrollHistory(scrollState2);
1240
- }
1241
- }, {
1242
- passive: true
1243
- });
1244
- document.removeEventListener("visibilitychange", win._qRouterInitVisibility);
1245
- win._qRouterInitVisibility = void 0;
1246
- }
1247
- win.addEventListener("scroll", () => {
1248
- if (!win._qRouterScrollEnabled && !win._qCityScrollEnabled) {
1249
- return;
1250
- }
1251
- clearTimeout(win._qRouterScrollDebounce);
1252
- win._qRouterScrollDebounce = setTimeout(() => {
1253
- const scrollState2 = currentScrollState(scroller);
1254
- saveScrollHistory(scrollState2);
1255
- win._qRouterScrollDebounce = void 0;
1256
- }, 200);
1257
- }, {
1258
- passive: true
1259
- });
1260
- removeEventListener("scroll", win._qRouterInitScroll);
1261
- win._qRouterInitScroll = void 0;
860
+ window._qRouterScrollDebounce = void 0;
861
+ }, 200);
862
+ },
863
+ { passive: true }
864
+ );
865
+ removeEventListener("scroll", window._qRouterInitScroll);
866
+ window._qRouterInitScroll = void 0;
1262
867
  spaInit.resolve();
1263
868
  }
1264
869
  if (navType !== "popstate") {
1265
- win._qRouterScrollEnabled = false;
1266
- clearTimeout(win._qRouterScrollDebounce);
870
+ window._qRouterScrollEnabled = false;
871
+ clearTimeout(window._qRouterScrollDebounce);
1267
872
  const scrollState2 = currentScrollState(scroller);
1268
873
  saveScrollHistory(scrollState2);
1269
874
  }
@@ -1278,9 +883,7 @@ const useQwikRouter = (props) => {
1278
883
  } else {
1279
884
  const viewTransition = startViewTransition({
1280
885
  update: navigate,
1281
- types: [
1282
- "qwik-navigation"
1283
- ]
886
+ types: ["qwik-navigation"]
1284
887
  });
1285
888
  if (!viewTransition) {
1286
889
  return Promise.resolve();
@@ -1293,7 +896,7 @@ const useQwikRouter = (props) => {
1293
896
  container2.setAttribute(Q_ROUTE, routeName);
1294
897
  const scrollState2 = currentScrollState(scroller);
1295
898
  saveScrollHistory(scrollState2);
1296
- win._qRouterScrollEnabled = true;
899
+ window._qRouterScrollEnabled = true;
1297
900
  if (isBrowser) {
1298
901
  callRestoreScrollOnDocument();
1299
902
  }
@@ -1327,31 +930,27 @@ const QwikCityProvider = QwikRouterProvider;
1327
930
  const useQwikMockRouter = (props) => {
1328
931
  const urlEnv = props.url ?? "http://localhost/";
1329
932
  const url = new URL(urlEnv);
1330
- const routeLocation = useStore({
1331
- url,
1332
- params: props.params ?? {},
1333
- isNavigating: false,
1334
- prevUrl: void 0
1335
- }, {
1336
- deep: false
1337
- });
933
+ const routeLocation = useStore(
934
+ {
935
+ url,
936
+ params: props.params ?? {},
937
+ isNavigating: false,
938
+ prevUrl: void 0
939
+ },
940
+ { deep: false }
941
+ );
1338
942
  const loaderState = {};
1339
- const routeInternal = useSignal({
1340
- type: "initial",
1341
- dest: url
1342
- });
1343
943
  const goto = props.goto ?? $(async () => {
1344
944
  console.warn("QwikRouterMockProvider: goto not provided");
1345
945
  });
1346
- const documentHead = useStore(createDocumentHead, {
1347
- deep: false
1348
- });
1349
- const content = useStore({
1350
- headings: void 0,
1351
- menu: void 0
1352
- }, {
1353
- deep: false
1354
- });
946
+ const documentHead = useStore(createDocumentHead, { deep: false });
947
+ const content = useStore(
948
+ {
949
+ headings: void 0,
950
+ menu: void 0
951
+ },
952
+ { deep: false }
953
+ );
1355
954
  const contentInternal = useSignal();
1356
955
  const actionState = useSignal();
1357
956
  useContextProvider(ContentContext, content);
@@ -1361,7 +960,6 @@ const useQwikMockRouter = (props) => {
1361
960
  useContextProvider(RouteNavigateContext, goto);
1362
961
  useContextProvider(RouteStateContext, loaderState);
1363
962
  useContextProvider(RouteActionContext, actionState);
1364
- useContextProvider(RouteInternalContext, routeInternal);
1365
963
  };
1366
964
  const QwikRouterMockProvider = component$((props) => {
1367
965
  useQwikMockRouter(props);
@@ -1385,10 +983,11 @@ const RouterOutlet = component$(() => {
1385
983
  });
1386
984
  }
1387
985
  }
1388
- return /* @__PURE__ */ jsxs(Fragment, {
1389
- children: [
1390
- cmp,
1391
- !__EXPERIMENTAL__.noSPA && /* @__PURE__ */ jsx("script", {
986
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
987
+ cmp,
988
+ !__EXPERIMENTAL__.noSPA && /* @__PURE__ */ jsx(
989
+ "script",
990
+ {
1392
991
  "document:onQCInit$": spaInit,
1393
992
  "document:onQInit$": sync$(() => {
1394
993
  ((w, h) => {
@@ -1402,83 +1001,13 @@ const RouterOutlet = component$(() => {
1402
1001
  }
1403
1002
  })(window, history);
1404
1003
  })
1405
- })
1406
- ]
1407
- });
1004
+ }
1005
+ )
1006
+ ] });
1408
1007
  }
1409
1008
  return SkipRender;
1410
1009
  });
1411
- var store;
1412
- function getGlobalConfig(config2) {
1413
- return {
1414
- lang: config2?.lang ?? store?.lang,
1415
- message: config2?.message,
1416
- abortEarly: config2?.abortEarly ?? store?.abortEarly,
1417
- abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
1418
- };
1419
- }
1420
- function getDotPath(issue) {
1421
- if (issue.path) {
1422
- let key = "";
1423
- for (const item of issue.path) {
1424
- if (typeof item.key === "string" || typeof item.key === "number") {
1425
- if (key) {
1426
- key += `.${item.key}`;
1427
- } else {
1428
- key += item.key;
1429
- }
1430
- } else {
1431
- return null;
1432
- }
1433
- }
1434
- return key;
1435
- }
1436
- return null;
1437
- }
1438
- function flatten(issues) {
1439
- const flatErrors = {};
1440
- for (const issue of issues) {
1441
- if (issue.path) {
1442
- const dotPath = getDotPath(issue);
1443
- if (dotPath) {
1444
- if (!flatErrors.nested) {
1445
- flatErrors.nested = {};
1446
- }
1447
- if (flatErrors.nested[dotPath]) {
1448
- flatErrors.nested[dotPath].push(issue.message);
1449
- } else {
1450
- flatErrors.nested[dotPath] = [issue.message];
1451
- }
1452
- } else {
1453
- if (flatErrors.other) {
1454
- flatErrors.other.push(issue.message);
1455
- } else {
1456
- flatErrors.other = [issue.message];
1457
- }
1458
- }
1459
- } else {
1460
- if (flatErrors.root) {
1461
- flatErrors.root.push(issue.message);
1462
- } else {
1463
- flatErrors.root = [issue.message];
1464
- }
1465
- }
1466
- }
1467
- return flatErrors;
1468
- }
1469
- async function safeParseAsync(schema, input, config2) {
1470
- const dataset = await schema._run(
1471
- { typed: false, value: input },
1472
- getGlobalConfig(config2)
1473
- );
1474
- return {
1475
- typed: dataset.typed,
1476
- success: !dataset.issues,
1477
- output: dataset.value,
1478
- issues: dataset.issues
1479
- };
1480
- }
1481
- const routeActionQrl = (actionQrl, ...rest) => {
1010
+ const routeActionQrl = ((actionQrl, ...rest) => {
1482
1011
  const { id, validators } = getValidators(rest, actionQrl);
1483
1012
  function action() {
1484
1013
  const loc = useLocation();
@@ -1544,16 +1073,15 @@ Action.run() can only be called on the browser, for example when a user clicks a
1544
1073
  if (form.getAttribute("data-spa-reset") === "true") {
1545
1074
  form.reset();
1546
1075
  }
1547
- const detail = {
1548
- status,
1549
- value: result
1550
- };
1551
- form.dispatchEvent(new CustomEvent("submitcompleted", {
1552
- bubbles: false,
1553
- cancelable: false,
1554
- composed: false,
1555
- detail
1556
- }));
1076
+ const detail = { status, value: result };
1077
+ form.dispatchEvent(
1078
+ new CustomEvent("submitcompleted", {
1079
+ bubbles: false,
1080
+ cancelable: false,
1081
+ composed: false,
1082
+ detail
1083
+ })
1084
+ );
1557
1085
  }
1558
1086
  return {
1559
1087
  status,
@@ -1570,8 +1098,8 @@ Action.run() can only be called on the browser, for example when a user clicks a
1570
1098
  action.__id = id;
1571
1099
  Object.freeze(action);
1572
1100
  return action;
1573
- };
1574
- const globalActionQrl = (actionQrl, ...rest) => {
1101
+ });
1102
+ const globalActionQrl = ((actionQrl, ...rest) => {
1575
1103
  const action = routeActionQrl(actionQrl, ...rest);
1576
1104
  if (isServer) {
1577
1105
  if (typeof globalThis._qwikActionsMap === "undefined") {
@@ -1580,10 +1108,14 @@ const globalActionQrl = (actionQrl, ...rest) => {
1580
1108
  globalThis._qwikActionsMap.set(action.__id, action);
1581
1109
  }
1582
1110
  return action;
1583
- };
1584
- const routeAction$ = /* @__PURE__ */ implicit$FirstArg(routeActionQrl);
1585
- const globalAction$ = /* @__PURE__ */ implicit$FirstArg(globalActionQrl);
1586
- const routeLoaderQrl = (loaderQrl, ...rest) => {
1111
+ });
1112
+ const routeAction$ = /* @__PURE__ */ implicit$FirstArg(
1113
+ routeActionQrl
1114
+ );
1115
+ const globalAction$ = /* @__PURE__ */ implicit$FirstArg(
1116
+ globalActionQrl
1117
+ );
1118
+ const routeLoaderQrl = ((loaderQrl, ...rest) => {
1587
1119
  const { id, validators, serializationStrategy } = getValidators(rest, loaderQrl);
1588
1120
  function loader() {
1589
1121
  const state = _resolveContextWithoutSequentialScope(RouteStateContext);
@@ -1603,18 +1135,19 @@ const routeLoaderQrl = (loaderQrl, ...rest) => {
1603
1135
  loader.__validators = validators;
1604
1136
  loader.__id = id;
1605
1137
  loader.__serializationStrategy = serializationStrategy;
1138
+ loader.__expires = -1;
1606
1139
  Object.freeze(loader);
1607
1140
  return loader;
1608
- };
1141
+ });
1609
1142
  const routeLoader$ = /* @__PURE__ */ implicit$FirstArg(routeLoaderQrl);
1610
- const validatorQrl = (validator) => {
1143
+ const validatorQrl = ((validator) => {
1611
1144
  if (isServer) {
1612
1145
  return {
1613
1146
  validate: validator
1614
1147
  };
1615
1148
  }
1616
1149
  return void 0;
1617
- };
1150
+ });
1618
1151
  const validator$ = /* @__PURE__ */ implicit$FirstArg(validatorQrl);
1619
1152
  const flattenValibotIssues = (issues) => {
1620
1153
  return issues.reduce((acc, issue) => {
@@ -1637,7 +1170,9 @@ const flattenValibotIssues = (issues) => {
1637
1170
  };
1638
1171
  const valibotQrl = (qrl) => {
1639
1172
  if (!__EXPERIMENTAL__.valibot) {
1640
- throw new Error('Valibot is an experimental feature and is not enabled. Please enable the feature flag by adding `experimental: ["valibot"]` to your qwikVite plugin options.');
1173
+ throw new Error(
1174
+ 'Valibot is an experimental feature and is not enabled. Please enable the feature flag by adding `experimental: ["valibot"]` to your qwikVite plugin options.'
1175
+ );
1641
1176
  }
1642
1177
  if (isServer) {
1643
1178
  return {
@@ -1645,7 +1180,7 @@ const valibotQrl = (qrl) => {
1645
1180
  async validate(ev, inputData) {
1646
1181
  const schema = await qrl.resolve().then((obj) => typeof obj === "function" ? obj(ev) : obj);
1647
1182
  const data = inputData ?? await ev.parseBody();
1648
- const result = await safeParseAsync(schema, data);
1183
+ const result = await v.safeParseAsync(schema, data);
1649
1184
  if (result.success) {
1650
1185
  return {
1651
1186
  success: true,
@@ -1659,7 +1194,7 @@ const valibotQrl = (qrl) => {
1659
1194
  success: false,
1660
1195
  status: 400,
1661
1196
  error: {
1662
- formErrors: flatten(result.issues).root ?? [],
1197
+ formErrors: v.flatten(result.issues).root ?? [],
1663
1198
  fieldErrors: flattenValibotIssues(result.issues)
1664
1199
  }
1665
1200
  };
@@ -1671,9 +1206,7 @@ const valibotQrl = (qrl) => {
1671
1206
  };
1672
1207
  const valibot$ = /* @__PURE__ */ implicit$FirstArg(valibotQrl);
1673
1208
  const flattenZodIssues = (issues) => {
1674
- issues = Array.isArray(issues) ? issues : [
1675
- issues
1676
- ];
1209
+ issues = Array.isArray(issues) ? issues : [issues];
1677
1210
  return issues.reduce((acc, issue) => {
1678
1211
  const isExpectingArray = "expected" in issue && issue.expected === "array";
1679
1212
  const hasArrayType = issue.path.some((path) => typeof path === "number") || isExpectingArray;
@@ -1740,93 +1273,96 @@ const serverQrl = (qrl, options) => {
1740
1273
  const headers = options?.headers || {};
1741
1274
  const origin = options?.origin || "";
1742
1275
  const fetchOptions = options?.fetchOptions || {};
1743
- function rpc() {
1744
- return $(async function(...args) {
1745
- const abortSignal = args.length > 0 && args[0] instanceof AbortSignal ? args.shift() : void 0;
1746
- if (isServer) {
1747
- let requestEvent = globalThis.qcAsyncRequestStore?.getStore();
1748
- if (!requestEvent) {
1749
- const contexts = [
1750
- useQwikRouterEnv()?.ev,
1751
- this,
1752
- _getContextEvent()
1753
- ];
1754
- requestEvent = contexts.find((v2) => v2 && Object.prototype.hasOwnProperty.call(v2, "sharedMap") && Object.prototype.hasOwnProperty.call(v2, "cookie"));
1276
+ return $(async function(...args) {
1277
+ const abortSignal = args.length > 0 && args[0] instanceof AbortSignal ? args.shift() : void 0;
1278
+ if (isServer) {
1279
+ let requestEvent = _asyncRequestStore?.getStore();
1280
+ if (!requestEvent) {
1281
+ const contexts = [useQwikRouterEnv()?.ev, this, _getContextEvent()];
1282
+ requestEvent = contexts.find(
1283
+ (v2) => v2 && Object.prototype.hasOwnProperty.call(v2, "sharedMap") && Object.prototype.hasOwnProperty.call(v2, "cookie")
1284
+ );
1285
+ }
1286
+ return qrl.apply(requestEvent, isDev ? deepFreeze(args) : args);
1287
+ } else {
1288
+ const ctxElm = _getContextElement();
1289
+ const filteredArgs = args.map((arg) => {
1290
+ if (arg instanceof SubmitEvent && arg.target instanceof HTMLFormElement) {
1291
+ return new FormData(arg.target);
1292
+ } else if (arg instanceof Event) {
1293
+ return null;
1294
+ } else if (arg instanceof Node) {
1295
+ return null;
1755
1296
  }
1756
- return qrl.apply(requestEvent, isDev ? deepFreeze(args) : args);
1297
+ return arg;
1298
+ });
1299
+ const qrlHash = qrl.getHash();
1300
+ let query = "";
1301
+ const config = {
1302
+ ...fetchOptions,
1303
+ method,
1304
+ headers: {
1305
+ ...headers,
1306
+ "Content-Type": "application/qwik-json",
1307
+ Accept: "application/json, application/qwik-json, text/qwik-json-stream, text/plain",
1308
+ // Required so we don't call accidentally
1309
+ "X-QRL": qrlHash
1310
+ },
1311
+ signal: abortSignal
1312
+ };
1313
+ const captured = qrl.getCaptured();
1314
+ let toSend;
1315
+ if (captured?.length) {
1316
+ toSend = [filteredArgs, captured];
1757
1317
  } else {
1758
- const ctxElm = _getContextElement();
1759
- const filteredArgs = args.map((arg) => {
1760
- if (arg instanceof SubmitEvent && arg.target instanceof HTMLFormElement) {
1761
- return new FormData(arg.target);
1762
- } else if (arg instanceof Event) {
1763
- return null;
1764
- } else if (arg instanceof Node) {
1765
- return null;
1766
- }
1767
- return arg;
1768
- });
1769
- const qrlHash = qrl.getHash();
1770
- let query = "";
1771
- const config = {
1772
- ...fetchOptions,
1773
- method,
1774
- headers: {
1775
- ...headers,
1776
- "Content-Type": "application/qwik-json",
1777
- Accept: "application/json, application/qwik-json, text/qwik-json-stream, text/plain",
1778
- // Required so we don't call accidentally
1779
- "X-QRL": qrlHash
1780
- },
1781
- signal: abortSignal
1782
- };
1783
- const body = await _serialize([
1784
- qrl,
1785
- ...filteredArgs
1786
- ]);
1787
- if (method === "GET") {
1788
- query += `&${QDATA_KEY}=${encodeURIComponent(body)}`;
1789
- } else {
1790
- config.body = body;
1791
- }
1792
- const res = await fetch(`${origin}?${QFN_KEY}=${qrlHash}${query}`, config);
1793
- const contentType = res.headers.get("Content-Type");
1794
- if (res.ok && contentType === "text/qwik-json-stream" && res.body) {
1795
- return (async function* () {
1796
- try {
1797
- for await (const result of deserializeStream(res.body, ctxElm ?? document.documentElement, abortSignal)) {
1798
- yield result;
1799
- }
1800
- } finally {
1801
- if (!abortSignal?.aborted) {
1802
- await res.body.cancel();
1803
- }
1318
+ toSend = filteredArgs.length ? [filteredArgs] : [];
1319
+ }
1320
+ const body = await _serialize(toSend);
1321
+ if (method === "GET") {
1322
+ query += `&${QDATA_KEY}=${encodeURIComponent(body)}`;
1323
+ } else {
1324
+ config.body = body;
1325
+ }
1326
+ const res = await fetch(`${origin}?${QFN_KEY}=${qrlHash}${query}`, config);
1327
+ const contentType = res.headers.get("Content-Type");
1328
+ if (res.ok && contentType === "text/qwik-json-stream" && res.body) {
1329
+ return (async function* () {
1330
+ try {
1331
+ for await (const result of deserializeStream(
1332
+ res.body,
1333
+ ctxElm ?? document.documentElement,
1334
+ abortSignal
1335
+ )) {
1336
+ yield result;
1337
+ }
1338
+ } finally {
1339
+ if (!abortSignal?.aborted) {
1340
+ await res.body.cancel();
1804
1341
  }
1805
- })();
1806
- } else if (contentType === "application/qwik-json") {
1807
- const str = await res.text();
1808
- const [obj] = _deserialize(str, ctxElm ?? document.documentElement);
1809
- if (res.status >= 400) {
1810
- throw obj;
1811
- }
1812
- return obj;
1813
- } else if (contentType === "application/json") {
1814
- const obj = await res.json();
1815
- if (res.status >= 400) {
1816
- throw obj;
1817
- }
1818
- return obj;
1819
- } else if (contentType === "text/plain" || contentType === "text/html") {
1820
- const str = await res.text();
1821
- if (res.status >= 400) {
1822
- throw str;
1823
1342
  }
1824
- return str;
1343
+ })();
1344
+ } else if (contentType === "application/qwik-json") {
1345
+ const str = await res.text();
1346
+ const [obj] = _deserialize(str, ctxElm ?? document.documentElement);
1347
+ if (res.status >= 400) {
1348
+ throw obj;
1825
1349
  }
1350
+ return obj;
1351
+ } else if (contentType === "application/json") {
1352
+ const obj = await res.json();
1353
+ if (res.status >= 400) {
1354
+ throw obj;
1355
+ }
1356
+ return obj;
1357
+ } else if (contentType === "text/plain" || contentType === "text/html") {
1358
+ const str = await res.text();
1359
+ if (res.status >= 400) {
1360
+ throw str;
1361
+ }
1362
+ return str;
1826
1363
  }
1827
- });
1828
- }
1829
- return rpc();
1364
+ }
1365
+ });
1830
1366
  };
1831
1367
  const server$ = /* @__PURE__ */ implicit$FirstArg(serverQrl);
1832
1368
  const getValidators = (rest, qrl) => {
@@ -1877,9 +1413,7 @@ const deserializeStream = async function* (stream, ctxElm, abortSignal) {
1877
1413
  if (result.done) {
1878
1414
  break;
1879
1415
  }
1880
- buffer += decoder.decode(result.value, {
1881
- stream: true
1882
- });
1416
+ buffer += decoder.decode(result.value, { stream: true });
1883
1417
  const lines = buffer.split(/\n/);
1884
1418
  buffer = lines.pop();
1885
1419
  for (const line of lines) {
@@ -1891,95 +1425,106 @@ const deserializeStream = async function* (stream, ctxElm, abortSignal) {
1891
1425
  reader.releaseLock();
1892
1426
  }
1893
1427
  };
1894
- const ServiceWorkerRegister = (props) => /* @__PURE__ */ jsx("script", {
1895
- type: "module",
1896
- dangerouslySetInnerHTML: swRegister,
1897
- nonce: props.nonce
1898
- });
1428
+ const ServiceWorkerRegister = (props) => /* @__PURE__ */ jsx("script", { type: "module", dangerouslySetInnerHTML: swRegister, nonce: props.nonce });
1899
1429
  const Form = ({ action, spaReset, reloadDocument, onSubmit$, ...rest }, key) => {
1900
1430
  if (action) {
1901
1431
  const isArrayApi = Array.isArray(onSubmit$);
1902
1432
  if (isArrayApi) {
1903
- return jsx$1("form", {
1433
+ return jsx$1(
1434
+ "form",
1435
+ {
1436
+ ...rest,
1437
+ action: action.actionPath,
1438
+ "preventdefault:submit": !reloadDocument,
1439
+ onSubmit$: [
1440
+ ...onSubmit$,
1441
+ // action.submit "submitcompleted" event for onSubmitCompleted$ events
1442
+ !reloadDocument ? $((evt) => {
1443
+ if (!action.submitted) {
1444
+ return action.submit(evt);
1445
+ }
1446
+ }) : void 0
1447
+ ],
1448
+ method: "post",
1449
+ ["data-spa-reset"]: spaReset ? "true" : void 0
1450
+ },
1451
+ key
1452
+ );
1453
+ }
1454
+ return jsx$1(
1455
+ "form",
1456
+ {
1904
1457
  ...rest,
1905
1458
  action: action.actionPath,
1906
1459
  "preventdefault:submit": !reloadDocument,
1907
1460
  onSubmit$: [
1908
- ...onSubmit$,
1461
+ // Since v2, this fires before the action is executed so it can be prevented
1462
+ onSubmit$,
1909
1463
  // action.submit "submitcompleted" event for onSubmitCompleted$ events
1910
- !reloadDocument ? $((evt) => {
1911
- if (!action.submitted) {
1912
- return action.submit(evt);
1913
- }
1914
- }) : void 0
1464
+ !reloadDocument ? action.submit : void 0
1915
1465
  ],
1916
1466
  method: "post",
1917
1467
  ["data-spa-reset"]: spaReset ? "true" : void 0
1918
- }, key);
1919
- }
1920
- return jsx$1("form", {
1921
- ...rest,
1922
- action: action.actionPath,
1923
- "preventdefault:submit": !reloadDocument,
1924
- onSubmit$: [
1925
- // Since v2, this fires before the action is executed so it can be prevented
1926
- onSubmit$,
1927
- // action.submit "submitcompleted" event for onSubmitCompleted$ events
1928
- !reloadDocument ? action.submit : void 0
1929
- ],
1930
- method: "post",
1931
- ["data-spa-reset"]: spaReset ? "true" : void 0
1932
- }, key);
1468
+ },
1469
+ key
1470
+ );
1933
1471
  } else {
1934
- return /* @__PURE__ */ jsx(GetForm, {
1935
- spaReset,
1936
- reloadDocument,
1937
- onSubmit$,
1938
- ...rest
1939
- }, key);
1472
+ return /* @__PURE__ */ jsx(
1473
+ GetForm,
1474
+ {
1475
+ spaReset,
1476
+ reloadDocument,
1477
+ onSubmit$,
1478
+ ...rest
1479
+ },
1480
+ key
1481
+ );
1940
1482
  }
1941
1483
  };
1942
- const GetForm = component$(({ action: _0, spaReset, reloadDocument, onSubmit$, ...rest }) => {
1943
- const nav = useNavigate();
1944
- return /* @__PURE__ */ jsx("form", {
1945
- action: "get",
1946
- "preventdefault:submit": !reloadDocument,
1947
- "data-spa-reset": spaReset ? "true" : void 0,
1948
- ...rest,
1949
- onSubmit$: [
1950
- ...Array.isArray(onSubmit$) ? onSubmit$ : [
1951
- onSubmit$
1952
- ],
1953
- $(async (_evt, form) => {
1954
- const formData = new FormData(form);
1955
- const params = new URLSearchParams();
1956
- formData.forEach((value, key) => {
1957
- if (typeof value === "string") {
1958
- params.append(key, value);
1959
- }
1960
- });
1961
- await nav("?" + params.toString(), {
1962
- type: "form",
1963
- forceReload: true
1964
- });
1965
- }),
1966
- $((_evt, form) => {
1967
- if (form.getAttribute("data-spa-reset") === "true") {
1968
- form.reset();
1969
- }
1970
- form.dispatchEvent(new CustomEvent("submitcompleted", {
1971
- bubbles: false,
1972
- cancelable: false,
1973
- composed: false,
1974
- detail: {
1975
- status: 200
1976
- }
1977
- }));
1978
- })
1979
- ],
1980
- children: /* @__PURE__ */ jsx(Slot, {})
1981
- });
1982
- });
1484
+ const GetForm = component$(
1485
+ ({ action: _0, spaReset, reloadDocument, onSubmit$, ...rest }) => {
1486
+ const nav = useNavigate();
1487
+ return /* @__PURE__ */ jsx(
1488
+ "form",
1489
+ {
1490
+ action: "get",
1491
+ "preventdefault:submit": !reloadDocument,
1492
+ "data-spa-reset": spaReset ? "true" : void 0,
1493
+ ...rest,
1494
+ onSubmit$: [
1495
+ ...Array.isArray(onSubmit$) ? onSubmit$ : [onSubmit$],
1496
+ $(async (_evt, form) => {
1497
+ const formData = new FormData(form);
1498
+ const params = new URLSearchParams();
1499
+ formData.forEach((value, key) => {
1500
+ if (typeof value === "string") {
1501
+ params.append(key, value);
1502
+ }
1503
+ });
1504
+ await nav("?" + params.toString(), { type: "form", forceReload: true });
1505
+ }),
1506
+ $((_evt, form) => {
1507
+ if (form.getAttribute("data-spa-reset") === "true") {
1508
+ form.reset();
1509
+ }
1510
+ form.dispatchEvent(
1511
+ new CustomEvent("submitcompleted", {
1512
+ bubbles: false,
1513
+ cancelable: false,
1514
+ composed: false,
1515
+ detail: {
1516
+ status: 200
1517
+ }
1518
+ })
1519
+ );
1520
+ })
1521
+ // end of array
1522
+ ],
1523
+ children: /* @__PURE__ */ jsx(Slot, {})
1524
+ }
1525
+ );
1526
+ }
1527
+ );
1983
1528
  const untypedAppUrl = function appUrl(route, params, paramsPrefix = "") {
1984
1529
  const path = route.split("/");
1985
1530
  for (let i = 0; i < path.length; i++) {
@@ -2017,48 +1562,43 @@ function omitProps(obj, keys) {
2017
1562
  return omittedObj;
2018
1563
  }
2019
1564
  const createRenderer = (getOptions) => {
2020
- return (opts) => {
1565
+ return ((opts) => {
2021
1566
  const { jsx: jsx2, options } = getOptions(opts);
2022
1567
  return renderToStream(jsx2, options);
2023
- };
1568
+ });
2024
1569
  };
2025
1570
  const DocumentHeadTags = component$((props) => {
2026
1571
  let head = useDocumentHead();
2027
1572
  if (props) {
2028
- head = {
2029
- ...head,
2030
- ...props
2031
- };
1573
+ head = { ...head, ...props };
2032
1574
  }
2033
- return /* @__PURE__ */ jsxs(Fragment, {
2034
- children: [
2035
- head.title && /* @__PURE__ */ jsx("title", {
2036
- children: head.title
2037
- }),
2038
- head.meta.map((m) => /* @__PURE__ */ jsx("meta", {
2039
- ...m
2040
- })),
2041
- head.links.map((l) => /* @__PURE__ */ jsx("link", {
2042
- ...l
2043
- })),
2044
- head.styles.map((s) => {
2045
- const props2 = s.props || s;
2046
- return /* @__PURE__ */ createElement("style", {
1575
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1576
+ head.title && /* @__PURE__ */ jsx("title", { children: head.title }),
1577
+ head.meta.map((m) => /* @__PURE__ */ jsx("meta", { ...m })),
1578
+ head.links.map((l) => /* @__PURE__ */ jsx("link", { ...l })),
1579
+ head.styles.map((s) => {
1580
+ const props2 = s.props || s;
1581
+ return /* @__PURE__ */ createElement(
1582
+ "style",
1583
+ {
2047
1584
  ...props2,
2048
1585
  dangerouslySetInnerHTML: s.style || props2.dangerouslySetInnerHTML,
2049
1586
  key: s.key
2050
- });
2051
- }),
2052
- head.scripts.map((s) => {
2053
- const props2 = s.props || s;
2054
- return /* @__PURE__ */ createElement("script", {
1587
+ }
1588
+ );
1589
+ }),
1590
+ head.scripts.map((s) => {
1591
+ const props2 = s.props || s;
1592
+ return /* @__PURE__ */ createElement(
1593
+ "script",
1594
+ {
2055
1595
  ...props2,
2056
1596
  dangerouslySetInnerHTML: s.script || props2.dangerouslySetInnerHTML,
2057
1597
  key: s.key
2058
- });
2059
- })
2060
- ]
2061
- });
1598
+ }
1599
+ );
1600
+ })
1601
+ ] });
2062
1602
  });
2063
1603
  export {
2064
1604
  DocumentHeadTags,