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