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

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 (36) hide show
  1. package/lib/adapters/azure-swa/vite/index.cjs +2 -2
  2. package/lib/adapters/azure-swa/vite/index.mjs +73 -69
  3. package/lib/adapters/bun-server/vite/index.cjs +2 -2
  4. package/lib/adapters/bun-server/vite/index.mjs +77 -73
  5. package/lib/adapters/cloud-run/vite/index.cjs +2 -2
  6. package/lib/adapters/cloud-run/vite/index.mjs +104 -100
  7. package/lib/adapters/cloudflare-pages/vite/{index-DwovcBp3.js → index-Bg_9YkM5.js} +1 -1
  8. package/lib/adapters/cloudflare-pages/vite/{index-C455V8_A.cjs → index-C1aDmh1S.cjs} +1 -1
  9. package/lib/adapters/cloudflare-pages/vite/index-CHT9Y93A.js +254 -0
  10. package/lib/adapters/cloudflare-pages/vite/{index-DKcVHRBy.cjs → index-Ck7KvpK1.cjs} +1 -1
  11. package/lib/adapters/cloudflare-pages/vite/{index-D3HITboM.js → index-Cp1cjAds.js} +1 -1
  12. package/lib/adapters/cloudflare-pages/vite/index-D9RL9dvJ.cjs +5 -0
  13. package/lib/adapters/cloudflare-pages/vite/index.cjs +1 -1
  14. package/lib/adapters/cloudflare-pages/vite/index.mjs +1 -1
  15. package/lib/adapters/deno-server/vite/index.cjs +2 -2
  16. package/lib/adapters/deno-server/vite/index.mjs +81 -77
  17. package/lib/adapters/netlify-edge/vite/index.cjs +3 -3
  18. package/lib/adapters/netlify-edge/vite/index.mjs +119 -115
  19. package/lib/adapters/node-server/vite/index.cjs +2 -2
  20. package/lib/adapters/node-server/vite/index.mjs +78 -74
  21. package/lib/adapters/shared/vite/index.cjs +2 -2
  22. package/lib/adapters/shared/vite/index.mjs +108 -104
  23. package/lib/adapters/ssg/vite/index.cjs +2 -2
  24. package/lib/adapters/ssg/vite/index.mjs +100 -96
  25. package/lib/adapters/vercel-edge/vite/index.cjs +2 -2
  26. package/lib/adapters/vercel-edge/vite/index.mjs +114 -110
  27. package/lib/index.qwik.cjs +39 -33
  28. package/lib/index.qwik.mjs +39 -33
  29. package/lib/middleware/request-handler/index.cjs +8 -8
  30. package/lib/middleware/request-handler/index.mjs +598 -587
  31. package/lib/vite/index.cjs +17 -17
  32. package/lib/vite/index.d.ts +3 -3
  33. package/lib/vite/index.mjs +242 -230
  34. package/package.json +4 -4
  35. package/lib/adapters/cloudflare-pages/vite/index-BIeHg2Cj.cjs +0 -5
  36. package/lib/adapters/cloudflare-pages/vite/index-bogwy7wh.js +0 -250
@@ -1,164 +1,167 @@
1
- import { _serialize as D, _UNINITIALIZED as ye, _deserialize as ee, _verifySerializable as Se } from "@qwik.dev/core/internal";
1
+ import { _serialize as q, _UNINITIALIZED as ye, _deserialize as te, _verifySerializable as Qe } from "@qwik.dev/core/internal";
2
2
  import "@qwik.dev/core";
3
- import { ServerError as F, RedirectMessage as H, RewriteMessage as we, AbortMessage as pe } from "@qwik.dev/router/middleware/request-handler";
4
- const ne = /* @__PURE__ */ new WeakMap(), te = "qaction", v = "qloaders", Qe = "qfunc", re = "qdata", je = "q:route";
5
- function Ee(e, t) {
6
- const n = ae(e), r = ie(e), o = ae(t), i = ie(t);
7
- return Re(e, n, r, t, o, i);
3
+ import { ServerError as D, RedirectMessage as H, RewriteMessage as we, AbortMessage as pe } from "@qwik.dev/router/middleware/request-handler";
4
+ const re = /* @__PURE__ */ new WeakMap(), ie = "qaction", J = "qloaders", Ee = "qfunc", oe = "qdata", je = "q:route";
5
+ function ze(e, n) {
6
+ const t = ce(e), r = ae(e), i = ce(n), o = ae(n);
7
+ return Re(e, t, r, n, i, o);
8
8
  }
9
- function Re(e, t, n, r, o, i) {
9
+ function Re(e, n, t, r, i, o) {
10
10
  if (r.startsWith("/build/"))
11
11
  return null;
12
12
  let a = null;
13
- for (; t < n; ) {
14
- const s = e.charCodeAt(t++), c = r.charCodeAt(o++);
15
- if (s === 91) {
16
- const f = be(e, t), l = t + (f ? 3 : 0), u = B(
13
+ for (; n < t; ) {
14
+ const c = e.charCodeAt(n++), s = r.charCodeAt(i++);
15
+ if (c === 91) {
16
+ const l = be(e, n), f = n + (l ? 3 : 0), u = z(
17
17
  e,
18
- l,
19
- n,
18
+ f,
19
+ t,
20
20
  93
21
21
  /* CLOSE_BRACKET */
22
- ), h = e.substring(l, u), y = B(
22
+ ), m = e.substring(f, u), p = z(
23
23
  e,
24
24
  u + 1,
25
- n,
25
+ t,
26
26
  47
27
27
  /* SLASH */
28
- ), w = e.substring(u + 1, y);
29
- t = u + 1;
30
- const R = o - 1;
31
- if (f) {
32
- const M = ze(
33
- h,
34
- w,
28
+ ), g = e.substring(u + 1, p);
29
+ n = u + 1;
30
+ const w = i - 1;
31
+ if (l) {
32
+ const R = Be(
33
+ m,
34
+ g,
35
35
  r,
36
- R,
37
- i,
36
+ w,
37
+ o,
38
38
  e,
39
- t + w.length + 1,
40
- n
39
+ n + g.length + 1,
40
+ t
41
41
  );
42
- if (M)
43
- return Object.assign(a || (a = {}), M);
42
+ if (R)
43
+ return Object.assign(a || (a = {}), R);
44
44
  }
45
- const p = B(r, R, i, 47, w);
46
- if (p == -1)
45
+ const b = z(r, w, o, 47, g);
46
+ if (b == -1)
47
47
  return null;
48
- const T = r.substring(R, p);
49
- if (!f && !w && !T)
48
+ const M = r.substring(w, b);
49
+ if (!l && !g && !M)
50
50
  return null;
51
- o = p, (a || (a = {}))[h] = decodeURIComponent(T);
52
- } else if (s !== c && !(isNaN(c) && Ge(e, t)))
51
+ i = b, (a || (a = {}))[m] = decodeURIComponent(M);
52
+ } else if (c !== s && !(isNaN(s) && Ge(e, n)))
53
53
  return null;
54
54
  }
55
- return oe(e, t) && oe(r, o) ? a || {} : null;
55
+ return se(e, n) && se(r, i) ? a || {} : null;
56
56
  }
57
- function Ge(e, t) {
58
- return e.charCodeAt(t) === 91 && be(e, t + 1);
57
+ function Ge(e, n) {
58
+ return e.charCodeAt(n) === 91 && be(e, n + 1);
59
59
  }
60
- function ie(e) {
61
- const t = e.length;
62
- return t > 1 && e.charCodeAt(t - 1) === 47 ? t - 1 : t;
63
- }
64
- function oe(e, t) {
60
+ function ae(e) {
65
61
  const n = e.length;
66
- return t >= n || t == n - 1 && e.charCodeAt(t) === 47;
62
+ return n > 1 && e.charCodeAt(n - 1) === 47 ? n - 1 : n;
67
63
  }
68
- function ae(e) {
64
+ function se(e, n) {
65
+ const t = e.length;
66
+ return n >= t || n == t - 1 && e.charCodeAt(n) === 47;
67
+ }
68
+ function ce(e) {
69
69
  return e.charCodeAt(0) === 47 ? 1 : 0;
70
70
  }
71
- function be(e, t) {
72
- return e.charCodeAt(t) === 46 && e.charCodeAt(t + 1) === 46 && e.charCodeAt(t + 2) === 46;
71
+ function be(e, n) {
72
+ return e.charCodeAt(n) === 46 && e.charCodeAt(n + 1) === 46 && e.charCodeAt(n + 2) === 46;
73
73
  }
74
- function B(e, t, n, r, o = "") {
75
- for (; t < n && e.charCodeAt(t) !== r; )
76
- t++;
77
- const i = o.length;
78
- for (let a = 0; a < i; a++)
79
- if (e.charCodeAt(t - i + a) !== o.charCodeAt(a))
74
+ function z(e, n, t, r, i = "") {
75
+ for (; n < t && e.charCodeAt(n) !== r; )
76
+ n++;
77
+ const o = i.length;
78
+ for (let a = 0; a < o; a++)
79
+ if (e.charCodeAt(n - o + a) !== i.charCodeAt(a))
80
80
  return -1;
81
- return t - i;
81
+ return n - o;
82
82
  }
83
- function ze(e, t, n, r, o, i, a, s) {
84
- n.charCodeAt(r) === 47 && r++;
85
- let c = o;
86
- const f = t + "/";
87
- for (; c >= r; ) {
88
- const l = Re(i, a, s, n, c, o);
89
- if (l) {
90
- let h = n.substring(r, Math.min(c, o));
91
- return h.endsWith(f) && (h = h.substring(0, h.length - f.length)), l[e] = decodeURIComponent(h), l;
83
+ function Be(e, n, t, r, i, o, a, c) {
84
+ t.charCodeAt(r) === 47 && r++;
85
+ let s = i;
86
+ const l = n + "/";
87
+ for (; s >= r; ) {
88
+ const f = Re(o, a, c, t, s, i);
89
+ if (f) {
90
+ let m = t.substring(r, Math.min(s, i));
91
+ return m.endsWith(l) && (m = m.substring(0, m.length - l.length)), f[e] = decodeURIComponent(m), f;
92
92
  }
93
- const u = Be(n, r, f, c, r - 1) + f.length;
94
- if (c === u)
93
+ const u = Ke(t, r, l, s, r - 1) + l.length;
94
+ if (s === u)
95
95
  break;
96
- c = u;
96
+ s = u;
97
97
  }
98
98
  return null;
99
99
  }
100
- function Be(e, t, n, r, o) {
101
- let i = e.lastIndexOf(n, r);
102
- return i == r - n.length && (i = e.lastIndexOf(n, r - n.length - 1)), i > t ? i : o;
100
+ function Ke(e, n, t, r, i) {
101
+ let o = e.lastIndexOf(t, r);
102
+ return o == r - t.length && (o = e.lastIndexOf(t, r - t.length - 1)), o > n ? o : i;
103
103
  }
104
- var k = /* @__PURE__ */ ((e) => (e[e.RouteName = 0] = "RouteName", e[e.Loaders = 1] = "Loaders", e[e.OriginalPathname = 2] = "OriginalPathname", e[e.RouteBundleNames = 3] = "RouteBundleNames", e))(k || {}), $ = /* @__PURE__ */ ((e) => (e[e.Pathname = 0] = "Pathname", e[e.MenuLoader = 1] = "MenuLoader", e))($ || {}), L = /* @__PURE__ */ ((e) => (e[e.RouteName = 0] = "RouteName", e[e.Params = 1] = "Params", e[e.Mods = 2] = "Mods", e[e.Menu = 3] = "Menu", e[e.RouteBundleNames = 4] = "RouteBundleNames", e))(L || {});
105
- const Ae = (e) => e == null ? e : (Object.getOwnPropertyNames(e).forEach((t) => {
106
- const n = e[t];
107
- n && typeof n == "object" && !Object.isFrozen(n) && Ae(n);
108
- }), Object.freeze(e)), Ke = async (e, t, n, r) => {
104
+ var W = /* @__PURE__ */ ((e) => (e[e.RouteName = 0] = "RouteName", e[e.Loaders = 1] = "Loaders", e[e.OriginalPathname = 2] = "OriginalPathname", e[e.RouteBundleNames = 3] = "RouteBundleNames", e))(W || {}), $ = /* @__PURE__ */ ((e) => (e[e.Pathname = 0] = "Pathname", e[e.MenuLoader = 1] = "MenuLoader", e))($ || {}), L = /* @__PURE__ */ ((e) => (e[e.RouteName = 0] = "RouteName", e[e.Params = 1] = "Params", e[e.Mods = 2] = "Mods", e[e.Menu = 3] = "Menu", e[e.RouteBundleNames = 4] = "RouteBundleNames", e))(L || {});
105
+ const Ae = (e) => e == null ? e : (Object.getOwnPropertyNames(e).forEach((n) => {
106
+ const t = e[n];
107
+ t && typeof t == "object" && !Object.isFrozen(t) && Ae(t);
108
+ }), Object.freeze(e)), ve = async (e, n, t, r, i) => {
109
109
  if (!Array.isArray(e))
110
110
  return null;
111
111
  for (const o of e) {
112
- const i = o[k.RouteName], a = Ee(i, r);
113
- if (!a)
112
+ const a = o[W.RouteName], c = ze(a, r);
113
+ if (!c)
114
114
  continue;
115
- const s = o[k.Loaders], c = o[k.RouteBundleNames], f = new Array(s.length), l = [];
116
- s.forEach((y, w) => {
117
- se(
118
- y,
119
- l,
120
- (R) => f[w] = R,
121
- n
115
+ const s = o[W.Loaders], l = o[W.RouteBundleNames], f = new Array(s.length), u = [];
116
+ s.forEach((p, g) => {
117
+ le(
118
+ p,
119
+ u,
120
+ (w) => f[g] = w,
121
+ t
122
122
  );
123
123
  });
124
- const u = Je(t, r);
125
- let h;
126
- return se(
127
- u,
128
- l,
129
- (y) => h = y?.default,
130
- n
131
- ), l.length > 0 && await Promise.all(l), [i, a, f, Ae(h), c];
124
+ let m;
125
+ if (!i) {
126
+ const p = Je(n, r);
127
+ le(
128
+ p,
129
+ u,
130
+ (g) => m = g?.default,
131
+ t
132
+ );
133
+ }
134
+ return u.length > 0 && await Promise.all(u), [a, c, f, Ae(m), l];
132
135
  }
133
136
  return null;
134
- }, se = (e, t, n, r) => {
137
+ }, le = (e, n, t, r) => {
135
138
  if (typeof e == "function") {
136
- const o = ne.get(e);
137
- if (o)
138
- n(o);
139
+ const i = re.get(e);
140
+ if (i)
141
+ t(i);
139
142
  else {
140
- const i = e();
141
- typeof i.then == "function" ? t.push(
142
- i.then((a) => {
143
- r !== !1 && ne.set(e, a), n(a);
143
+ const o = e();
144
+ typeof o.then == "function" ? n.push(
145
+ o.then((a) => {
146
+ r !== !1 && re.set(e, a), t(a);
144
147
  })
145
- ) : i && n(i);
148
+ ) : o && t(o);
146
149
  }
147
150
  }
148
- }, Je = (e, t) => {
151
+ }, Je = (e, n) => {
149
152
  if (e) {
150
- t = t.endsWith("/") ? t : t + "/";
151
- const n = e.find(
152
- (r) => r[$.Pathname] === t || t.startsWith(r[$.Pathname] + (t.endsWith("/") ? "" : "/"))
153
+ n = n.endsWith("/") ? n : n + "/";
154
+ const t = e.find(
155
+ (r) => r[$.Pathname] === n || n.startsWith(r[$.Pathname])
153
156
  );
154
- if (n)
155
- return n[$.MenuLoader];
157
+ if (t)
158
+ return t[$.MenuLoader];
156
159
  }
157
160
  };
158
- var V = /* @__PURE__ */ ((e) => (e[e.Continue = 100] = "Continue", e[e.SwitchingProtocols = 101] = "SwitchingProtocols", e[e.Processing = 102] = "Processing", e[e.Ok = 200] = "Ok", e[e.Created = 201] = "Created", e[e.Accepted = 202] = "Accepted", e[e.NonAuthoritativeInformation = 203] = "NonAuthoritativeInformation", e[e.NoContent = 204] = "NoContent", e[e.ResetContent = 205] = "ResetContent", e[e.PartialContent = 206] = "PartialContent", e[e.MultiStatus = 207] = "MultiStatus", e[e.AlreadyReported = 208] = "AlreadyReported", e[e.ImUsed = 226] = "ImUsed", e[e.MultipleChoices = 300] = "MultipleChoices", e[e.MovedPermanently = 301] = "MovedPermanently", e[e.Found = 302] = "Found", e[e.SeeOther = 303] = "SeeOther", e[e.NotModified = 304] = "NotModified", e[e.UseProxy = 305] = "UseProxy", e[e.SwitchProxy = 306] = "SwitchProxy", e[e.TemporaryRedirect = 307] = "TemporaryRedirect", e[e.PermanentRedirect = 308] = "PermanentRedirect", e[e.BadRequest = 400] = "BadRequest", e[e.Unauthorized = 401] = "Unauthorized", e[e.PaymentRequired = 402] = "PaymentRequired", e[e.Forbidden = 403] = "Forbidden", e[e.NotFound = 404] = "NotFound", e[e.MethodNotAllowed = 405] = "MethodNotAllowed", e[e.NotAcceptable = 406] = "NotAcceptable", e[e.ProxyAuthenticationRequired = 407] = "ProxyAuthenticationRequired", e[e.RequestTimeout = 408] = "RequestTimeout", e[e.Conflict = 409] = "Conflict", e[e.Gone = 410] = "Gone", e[e.LengthRequired = 411] = "LengthRequired", e[e.PreconditionFailed = 412] = "PreconditionFailed", e[e.PayloadTooLarge = 413] = "PayloadTooLarge", e[e.UriTooLong = 414] = "UriTooLong", e[e.UnsupportedMediaType = 415] = "UnsupportedMediaType", e[e.RangeNotSatisfiable = 416] = "RangeNotSatisfiable", e[e.ExpectationFailed = 417] = "ExpectationFailed", e[e.IAmATeapot = 418] = "IAmATeapot", e[e.MisdirectedRequest = 421] = "MisdirectedRequest", e[e.UnprocessableEntity = 422] = "UnprocessableEntity", e[e.Locked = 423] = "Locked", e[e.FailedDependency = 424] = "FailedDependency", e[e.UpgradeRequired = 426] = "UpgradeRequired", e[e.PreconditionRequired = 428] = "PreconditionRequired", e[e.TooManyRequests = 429] = "TooManyRequests", e[e.RequestHeaderFieldsTooLarge = 431] = "RequestHeaderFieldsTooLarge", e[e.UnavailableForLegalReasons = 451] = "UnavailableForLegalReasons", e[e.InternalServerError = 500] = "InternalServerError", e[e.NotImplemented = 501] = "NotImplemented", e[e.BadGateway = 502] = "BadGateway", e[e.ServiceUnavailable = 503] = "ServiceUnavailable", e[e.GatewayTimeout = 504] = "GatewayTimeout", e[e.HttpVersionNotSupported = 505] = "HttpVersionNotSupported", e[e.VariantAlsoNegotiates = 506] = "VariantAlsoNegotiates", e[e.InsufficientStorage = 507] = "InsufficientStorage", e[e.LoopDetected = 508] = "LoopDetected", e[e.NotExtended = 510] = "NotExtended", e[e.NetworkAuthenticationRequired = 511] = "NetworkAuthenticationRequired", e))(V || {});
161
+ var Y = /* @__PURE__ */ ((e) => (e[e.Continue = 100] = "Continue", e[e.SwitchingProtocols = 101] = "SwitchingProtocols", e[e.Processing = 102] = "Processing", e[e.Ok = 200] = "Ok", e[e.Created = 201] = "Created", e[e.Accepted = 202] = "Accepted", e[e.NonAuthoritativeInformation = 203] = "NonAuthoritativeInformation", e[e.NoContent = 204] = "NoContent", e[e.ResetContent = 205] = "ResetContent", e[e.PartialContent = 206] = "PartialContent", e[e.MultiStatus = 207] = "MultiStatus", e[e.AlreadyReported = 208] = "AlreadyReported", e[e.ImUsed = 226] = "ImUsed", e[e.MultipleChoices = 300] = "MultipleChoices", e[e.MovedPermanently = 301] = "MovedPermanently", e[e.Found = 302] = "Found", e[e.SeeOther = 303] = "SeeOther", e[e.NotModified = 304] = "NotModified", e[e.UseProxy = 305] = "UseProxy", e[e.SwitchProxy = 306] = "SwitchProxy", e[e.TemporaryRedirect = 307] = "TemporaryRedirect", e[e.PermanentRedirect = 308] = "PermanentRedirect", e[e.BadRequest = 400] = "BadRequest", e[e.Unauthorized = 401] = "Unauthorized", e[e.PaymentRequired = 402] = "PaymentRequired", e[e.Forbidden = 403] = "Forbidden", e[e.NotFound = 404] = "NotFound", e[e.MethodNotAllowed = 405] = "MethodNotAllowed", e[e.NotAcceptable = 406] = "NotAcceptable", e[e.ProxyAuthenticationRequired = 407] = "ProxyAuthenticationRequired", e[e.RequestTimeout = 408] = "RequestTimeout", e[e.Conflict = 409] = "Conflict", e[e.Gone = 410] = "Gone", e[e.LengthRequired = 411] = "LengthRequired", e[e.PreconditionFailed = 412] = "PreconditionFailed", e[e.PayloadTooLarge = 413] = "PayloadTooLarge", e[e.UriTooLong = 414] = "UriTooLong", e[e.UnsupportedMediaType = 415] = "UnsupportedMediaType", e[e.RangeNotSatisfiable = 416] = "RangeNotSatisfiable", e[e.ExpectationFailed = 417] = "ExpectationFailed", e[e.IAmATeapot = 418] = "IAmATeapot", e[e.MisdirectedRequest = 421] = "MisdirectedRequest", e[e.UnprocessableEntity = 422] = "UnprocessableEntity", e[e.Locked = 423] = "Locked", e[e.FailedDependency = 424] = "FailedDependency", e[e.UpgradeRequired = 426] = "UpgradeRequired", e[e.PreconditionRequired = 428] = "PreconditionRequired", e[e.TooManyRequests = 429] = "TooManyRequests", e[e.RequestHeaderFieldsTooLarge = 431] = "RequestHeaderFieldsTooLarge", e[e.UnavailableForLegalReasons = 451] = "UnavailableForLegalReasons", e[e.InternalServerError = 500] = "InternalServerError", e[e.NotImplemented = 501] = "NotImplemented", e[e.BadGateway = 502] = "BadGateway", e[e.ServiceUnavailable = 503] = "ServiceUnavailable", e[e.GatewayTimeout = 504] = "GatewayTimeout", e[e.HttpVersionNotSupported = 505] = "HttpVersionNotSupported", e[e.VariantAlsoNegotiates = 506] = "VariantAlsoNegotiates", e[e.InsufficientStorage = 507] = "InsufficientStorage", e[e.LoopDetected = 508] = "LoopDetected", e[e.NotExtended = 510] = "NotExtended", e[e.NetworkAuthenticationRequired = 511] = "NetworkAuthenticationRequired", e))(Y || {});
159
162
  const Ye = (e) => e && typeof e.then == "function";
160
- function ve(e) {
161
- const t = [];
163
+ function Ve(e) {
164
+ const n = [];
162
165
  return e === "day" ? e = 3600 * 24 : e === "week" ? e = 3600 * 24 * 7 : e === "month" ? e = 3600 * 24 * 30 : e === "year" ? e = 3600 * 24 * 365 : e === "private" ? e = {
163
166
  private: !0,
164
167
  noCache: !0
@@ -171,64 +174,64 @@ function ve(e) {
171
174
  }), typeof e == "number" && (e = {
172
175
  maxAge: e,
173
176
  sMaxAge: e
174
- }), e.immutable && t.push("immutable"), e.maxAge && t.push(`max-age=${e.maxAge}`), e.sMaxAge && t.push(`s-maxage=${e.sMaxAge}`), e.noStore && t.push("no-store"), e.noCache && t.push("no-cache"), e.private && t.push("private"), e.public && t.push("public"), e.staleWhileRevalidate && t.push(`stale-while-revalidate=${e.staleWhileRevalidate}`), e.staleIfError && t.push(`stale-if-error=${e.staleIfError}`), t.join(", ");
177
+ }), e.immutable && n.push("immutable"), e.maxAge && n.push(`max-age=${e.maxAge}`), e.sMaxAge && n.push(`s-maxage=${e.sMaxAge}`), e.noStore && n.push("no-store"), e.noCache && n.push("no-cache"), e.private && n.push("private"), e.public && n.push("public"), e.staleWhileRevalidate && n.push(`stale-while-revalidate=${e.staleWhileRevalidate}`), e.staleIfError && n.push(`stale-if-error=${e.staleIfError}`), n.join(", ");
175
178
  }
176
- const Ve = {
179
+ const Xe = {
177
180
  lax: "Lax",
178
181
  Lax: "Lax",
179
182
  None: "None",
180
183
  none: "None",
181
184
  strict: "Strict",
182
185
  Strict: "Strict"
183
- }, Xe = {
186
+ }, Ze = {
184
187
  seconds: 1,
185
188
  minutes: 60,
186
189
  hours: 3600,
187
190
  days: 3600 * 24,
188
191
  weeks: 3600 * 24 * 7
189
- }, ce = (e, t, n) => {
190
- const r = [`${e}=${t}`];
191
- typeof n.domain == "string" && r.push(`Domain=${n.domain}`), typeof n.maxAge == "number" ? r.push(`Max-Age=${n.maxAge}`) : Array.isArray(n.maxAge) ? r.push(`Max-Age=${n.maxAge[0] * Xe[n.maxAge[1]]}`) : typeof n.expires == "number" || typeof n.expires == "string" ? r.push(`Expires=${n.expires}`) : n.expires instanceof Date && r.push(`Expires=${n.expires.toUTCString()}`), n.httpOnly && r.push("HttpOnly"), typeof n.path == "string" && r.push(`Path=${n.path}`);
192
- const o = He(n.sameSite);
193
- return o && r.push(`SameSite=${o}`), n.secure && r.push("Secure"), r.join("; ");
192
+ }, de = (e, n, t) => {
193
+ const r = [`${e}=${n}`];
194
+ typeof t.domain == "string" && r.push(`Domain=${t.domain}`), typeof t.maxAge == "number" ? r.push(`Max-Age=${t.maxAge}`) : Array.isArray(t.maxAge) ? r.push(`Max-Age=${t.maxAge[0] * Ze[t.maxAge[1]]}`) : typeof t.expires == "number" || typeof t.expires == "string" ? r.push(`Expires=${t.expires}`) : t.expires instanceof Date && r.push(`Expires=${t.expires.toUTCString()}`), t.httpOnly && r.push("HttpOnly"), typeof t.path == "string" && r.push(`Path=${t.path}`);
195
+ const i = en(t.sameSite);
196
+ return i && r.push(`SameSite=${i}`), t.secure && r.push("Secure"), r.join("; ");
194
197
  };
195
- function le(e) {
198
+ function fe(e) {
196
199
  try {
197
200
  return decodeURIComponent(e);
198
201
  } catch {
199
202
  return e;
200
203
  }
201
204
  }
202
- const Ze = (e) => {
203
- const t = {};
205
+ const He = (e) => {
206
+ const n = {};
204
207
  if (typeof e == "string" && e !== "") {
205
- const n = e.split(";");
206
- for (const r of n) {
207
- const o = r.indexOf("=");
208
- o !== -1 && (t[le(r.slice(0, o).trim())] = le(r.slice(o + 1).trim()));
208
+ const t = e.split(";");
209
+ for (const r of t) {
210
+ const i = r.indexOf("=");
211
+ i !== -1 && (n[fe(r.slice(0, i).trim())] = fe(r.slice(i + 1).trim()));
209
212
  }
210
213
  }
211
- return t;
214
+ return n;
212
215
  };
213
- function He(e) {
216
+ function en(e) {
214
217
  if (e === !0)
215
218
  return "Strict";
216
219
  if (e === !1)
217
220
  return "None";
218
221
  if (e)
219
- return Ve[e];
222
+ return Xe[e];
220
223
  }
221
- const x = Symbol("request-cookies"), q = Symbol("response-cookies"), _ = Symbol("live-cookies");
222
- class en {
224
+ const x = Symbol("request-cookies"), k = Symbol("response-cookies"), T = Symbol("live-cookies");
225
+ class nn {
223
226
  [x];
224
- [q] = {};
225
- [_] = {};
227
+ [k] = {};
228
+ [T] = {};
226
229
  appendCounter = 0;
227
- constructor(t) {
228
- this[x] = Ze(t), this[_] = { ...this[x] };
230
+ constructor(n) {
231
+ this[x] = He(n), this[T] = { ...this[x] };
229
232
  }
230
- get(t, n = !0) {
231
- const r = this[n ? _ : x][t];
233
+ get(n, t = !0) {
234
+ const r = this[t ? T : x][n];
232
235
  return r ? {
233
236
  value: r,
234
237
  json() {
@@ -239,71 +242,71 @@ class en {
239
242
  }
240
243
  } : null;
241
244
  }
242
- getAll(t = !0) {
243
- return Object.keys(this[t ? _ : x]).reduce(
244
- (n, r) => (n[r] = this.get(r), n),
245
+ getAll(n = !0) {
246
+ return Object.keys(this[n ? T : x]).reduce(
247
+ (t, r) => (t[r] = this.get(r), t),
245
248
  {}
246
249
  );
247
250
  }
248
- has(t, n = !0) {
249
- return !!this[n ? _ : x][t];
251
+ has(n, t = !0) {
252
+ return !!this[t ? T : x][n];
250
253
  }
251
- set(t, n, r = {}) {
252
- this[_][t] = typeof n == "string" ? n : JSON.stringify(n);
253
- const o = typeof n == "string" ? n : encodeURIComponent(JSON.stringify(n));
254
- this[q][t] = ce(t, o, r);
254
+ set(n, t, r = {}) {
255
+ this[T][n] = typeof t == "string" ? t : JSON.stringify(t);
256
+ const i = typeof t == "string" ? t : encodeURIComponent(JSON.stringify(t));
257
+ this[k][n] = de(n, i, r);
255
258
  }
256
- append(t, n, r = {}) {
257
- this[_][t] = typeof n == "string" ? n : JSON.stringify(n);
258
- const o = typeof n == "string" ? n : encodeURIComponent(JSON.stringify(n));
259
- this[q][++this.appendCounter] = ce(
260
- t,
261
- o,
259
+ append(n, t, r = {}) {
260
+ this[T][n] = typeof t == "string" ? t : JSON.stringify(t);
261
+ const i = typeof t == "string" ? t : encodeURIComponent(JSON.stringify(t));
262
+ this[k][++this.appendCounter] = de(
263
+ n,
264
+ i,
262
265
  r
263
266
  );
264
267
  }
265
- delete(t, n) {
266
- this.set(t, "deleted", { ...n, maxAge: 0 }), this[_][t] = null;
268
+ delete(n, t) {
269
+ this.set(n, "deleted", { ...t, maxAge: 0 }), this[T][n] = null;
267
270
  }
268
271
  headers() {
269
- return Object.values(this[q]);
272
+ return Object.values(this[k]);
270
273
  }
271
274
  }
272
- const Un = (e, t) => {
273
- const n = t.headers();
274
- if (n.length > 0) {
275
+ const kn = (e, n) => {
276
+ const t = n.headers();
277
+ if (t.length > 0) {
275
278
  const r = new Headers(e);
276
- for (const o of n)
277
- r.append("Set-Cookie", o);
279
+ for (const i of t)
280
+ r.append("Set-Cookie", i);
278
281
  return r;
279
282
  }
280
283
  return e;
281
284
  };
282
- function K(e, t) {
283
- let n = "Server Error";
284
- return t != null && (typeof t.message == "string" ? n = t.message : n = String(t)), "<html>" + _e(e, n) + "</html>";
285
+ function G(e, n) {
286
+ let t = "Server Error";
287
+ return n != null && (typeof n.message == "string" ? t = n.message : t = String(n)), "<html>" + _e(e, t) + "</html>";
285
288
  }
286
- function _e(e, t) {
287
- typeof e != "number" && (e = 500), typeof t == "string" ? t = tn(t) : t = "";
288
- const n = typeof t == "string" ? "600px" : "300px", r = e >= 500 ? on : rn;
289
+ function _e(e, n) {
290
+ typeof e != "number" && (e = 500), typeof n == "string" ? n = rn(n) : n = "";
291
+ const t = typeof n == "string" ? "600px" : "300px", r = e >= 500 ? an : on;
289
292
  return `
290
293
  <head>
291
294
  <meta charset="utf-8">
292
295
  <meta http-equiv="Status" content="${e}">
293
- <title>${e} ${t}</title>
296
+ <title>${e} ${n}</title>
294
297
  <meta name="viewport" content="width=device-width,initial-scale=1">
295
298
  <style>
296
299
  body { color: ${r}; background-color: #fafafa; padding: 30px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
297
- p { max-width: ${n}; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px ${r}; overflow: hidden; }
300
+ p { max-width: ${t}; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px ${r}; overflow: hidden; }
298
301
  strong { display: inline-block; padding: 15px; background: ${r}; color: white; }
299
302
  span { display: inline-block; padding: 15px; }
300
303
  </style>
301
304
  </head>
302
- <body><p><strong>${e}</strong> <span>${t}</span></p></body>
305
+ <body><p><strong>${e}</strong> <span>${n}</span></p></body>
303
306
  `;
304
307
  }
305
- const nn = /[&<>]/g, tn = (e) => e.replace(nn, (t) => {
306
- switch (t) {
308
+ const tn = /[&<>]/g, rn = (e) => e.replace(tn, (n) => {
309
+ switch (n) {
307
310
  case "&":
308
311
  return "&amp;";
309
312
  case "<":
@@ -313,146 +316,147 @@ const nn = /[&<>]/g, tn = (e) => e.replace(nn, (t) => {
313
316
  default:
314
317
  return "";
315
318
  }
316
- }), rn = "#006ce9", on = "#713fc2";
317
- let S;
319
+ }), on = "#006ce9", an = "#713fc2";
320
+ let F;
318
321
  import("node:async_hooks").then((e) => {
319
- const t = e.AsyncLocalStorage;
320
- S = new t(), globalThis.qcAsyncRequestStore = S;
322
+ const n = e.AsyncLocalStorage;
323
+ F = new n(), globalThis.qcAsyncRequestStore = F;
321
324
  }).catch((e) => {
322
325
  console.warn(
323
326
  "AsyncLocalStorage not available, continuing without it. This might impact concurrent server calls.",
324
327
  e
325
328
  );
326
329
  });
327
- function an(e, t, n, r, o = "/") {
328
- let i;
329
- const a = new Promise((c) => i = c), s = cn(
330
+ function sn(e, n, t, r, i = "/") {
331
+ let o;
332
+ const a = new Promise((s) => o = s), c = ln(
330
333
  e,
331
- t,
332
334
  n,
333
- o,
334
- i
335
+ t,
336
+ i,
337
+ o
335
338
  );
336
339
  return {
337
340
  response: a,
338
- requestEv: s,
339
- completion: S ? S.run(s, de, s, r, i) : de(s, r, i)
341
+ requestEv: c,
342
+ completion: F ? F.run(c, ue, c, r, o) : ue(c, r, o)
340
343
  };
341
344
  }
342
- async function de(e, t, n) {
345
+ async function ue(e, n, t) {
343
346
  try {
344
347
  ((a) => new URL(a.pathname + a.search, a))(e.originalUrl);
345
348
  } catch {
346
349
  const a = "Resource Not Found";
347
350
  e.status(404);
348
- const s = K(404, a);
349
- return e.html(404, s), new F(404, a);
351
+ const c = G(404, a);
352
+ return e.html(404, c), new D(404, a);
350
353
  }
351
354
  let r = 1;
352
- async function o() {
355
+ async function i() {
353
356
  try {
354
357
  await e.next();
355
- } catch (i) {
356
- if (i instanceof H)
358
+ } catch (o) {
359
+ if (o instanceof H)
357
360
  await e.getWritableStream().close();
358
- else if (i instanceof we) {
361
+ else if (o instanceof we) {
359
362
  if (r > 50)
360
363
  throw new Error("Infinite rewrite loop");
361
364
  r += 1;
362
365
  const a = new URL(e.url);
363
- a.pathname = i.pathname;
364
- const { loadedRoute: s, requestHandlers: c } = await t(a);
365
- return e.resetRoute(s, c, a), await o();
366
- } else if (i instanceof F) {
366
+ a.pathname = o.pathname;
367
+ const { loadedRoute: c, requestHandlers: s } = await n(a);
368
+ return e.resetRoute(c, s, a), await i();
369
+ } else if (o instanceof D) {
367
370
  if (!e.headersSent) {
368
- const a = i.status, s = e.request.headers.get("Accept");
369
- if (s && !s.includes("text/html"))
370
- e.headers.set("Content-Type", "application/qwik-json"), e.send(a, await D([i.data]));
371
+ const a = o.status, c = e.request.headers.get("Accept");
372
+ if (c && !c.includes("text/html"))
373
+ e.headers.set("Content-Type", "application/qwik-json"), e.send(a, await q([o.data]));
371
374
  else {
372
- const c = K(i.status, i.data);
373
- e.html(a, c);
375
+ const s = G(o.status, o.data);
376
+ e.html(a, s);
374
377
  }
375
378
  }
376
- } else if (!(i instanceof pe)) {
377
- if (P(e) !== "dev")
379
+ } else if (!(o instanceof pe)) {
380
+ if (I(e) !== "dev")
378
381
  try {
379
382
  e.headersSent || (e.headers.set("content-type", "text/html; charset=utf-8"), e.cacheControl({ noCache: !0 }), e.status(500));
380
383
  const a = e.getWritableStream();
381
384
  if (!a.locked) {
382
- const s = a.getWriter();
383
- await s.write(E.encode(K(500, "Internal Server Error"))), await s.close();
385
+ const c = a.getWriter();
386
+ await c.write(E.encode(G(500, "Internal Server Error"))), await c.close();
384
387
  }
385
388
  } catch {
386
389
  console.error("Unable to render error page");
387
390
  }
388
- return i;
391
+ return o;
389
392
  }
390
393
  }
391
394
  }
392
395
  try {
393
- return await o();
396
+ return await i();
394
397
  } finally {
395
- e.isDirty() || n(null);
398
+ e.isDirty() || t(null);
396
399
  }
397
400
  }
398
- function fe(e) {
399
- if (e.endsWith(C)) {
400
- const t = e.length - Te + (globalThis.__NO_TRAILING_SLASH__ ? 0 : 1);
401
+ function V(e) {
402
+ const n = e.endsWith(C);
403
+ if (n) {
404
+ const t = e.length - C.length + (globalThis.__NO_TRAILING_SLASH__ ? 0 : 1);
401
405
  e = e.slice(0, t), e === "" && (e = "/");
402
406
  }
403
- return e;
407
+ return { pathname: e, isInternal: n };
404
408
  }
405
- const O = "@isQData", C = "/q-data.json", Te = C.length, Me = Symbol("RequestEvLoaders"), Ne = Symbol("RequestEvMode"), xe = Symbol("RequestEvRoute"), Ce = Symbol(
409
+ const ee = "@isQData", C = "/q-data.json", Te = Symbol("RequestEvLoaders"), Me = Symbol("RequestEvMode"), Ne = Symbol("RequestEvRoute"), xe = Symbol(
406
410
  "RequestEvLoaderSerializationStrategyMap"
407
- ), Pe = "@routeName", j = "@actionId", Ie = "@actionFormData", sn = "@nonce", Le = "@rewrite", X = "@serverTiming", Oe = "qData";
408
- function cn(e, t, n, r, o) {
409
- const { request: i, platform: a, env: s } = e, c = /* @__PURE__ */ new Map(), f = new en(i.headers.get("cookie")), l = new Headers(), u = new URL(i.url);
410
- u.pathname.endsWith(C) && (u.pathname = u.pathname.slice(0, -Te), !globalThis.__NO_TRAILING_SLASH__ && !u.pathname.endsWith("/") && (u.pathname += "/"), c.set(O, !0));
411
- let h = -1, y = null, w, R = e.locale, p = 200;
412
- const T = async () => {
413
- for (h++; h < n.length; ) {
414
- const d = n[h], m = globalThis.qcAsyncRequestStore, g = m?.run ? m.run(b, d, b) : d(b);
415
- Ye(g) && await g, h++;
411
+ ), Ce = "@routeName", Q = "@actionId", Ie = "@actionFormData", cn = "@nonce", Pe = "@rewrite", X = "@serverTiming", Le = "qData";
412
+ function ln(e, n, t, r, i) {
413
+ const { request: o, platform: a, env: c } = e, s = /* @__PURE__ */ new Map(), l = new nn(o.headers.get("cookie")), f = new Headers(), u = new URL(o.url), { pathname: m, isInternal: p } = V(u.pathname);
414
+ p && (u.pathname = m, s.set(ee, !0));
415
+ let g = -1, w = null, b, M = e.locale, R = 200;
416
+ const qe = async () => {
417
+ for (g++; g < t.length; ) {
418
+ const d = t[g], h = d(A);
419
+ Ye(h) && await h, g++;
416
420
  }
417
- }, M = (d, m, g = u) => {
418
- t = d, n = m, u.pathname = g.pathname, u.search = g.search, h = -1;
421
+ }, De = (d, h, y = u) => {
422
+ n = d, t = h, u.pathname = y.pathname, u.search = y.search, g = -1;
419
423
  }, N = () => {
420
- if (y !== null)
424
+ if (w !== null)
421
425
  throw new Error("Response already sent");
422
- }, W = (d, m) => {
426
+ }, U = (d, h) => {
423
427
  if (N(), typeof d == "number") {
424
- p = d;
425
- const A = b.getWritableStream().getWriter();
426
- A.write(typeof m == "string" ? E.encode(m) : m), A.close();
427
- } else if (p = d.status, d.headers.forEach((g, A) => {
428
- A.toLowerCase() !== "set-cookie" && l.append(A, g);
429
- }), d.headers.getSetCookie().forEach((g) => {
430
- const A = g.indexOf("=");
431
- if (A === -1)
428
+ R = d;
429
+ const _ = A.getWritableStream().getWriter();
430
+ _.write(typeof h == "string" ? E.encode(h) : h), _.close();
431
+ } else if (R = d.status, d.headers.forEach((y, _) => {
432
+ _.toLowerCase() !== "set-cookie" && f.append(_, y);
433
+ }), d.headers.getSetCookie().forEach((y) => {
434
+ const _ = y.indexOf("=");
435
+ if (_ === -1)
432
436
  return;
433
- const De = g.slice(0, A).trim(), Fe = g.slice(A + 1).trim();
434
- f.set(De, Fe);
437
+ const Fe = y.slice(0, _).trim(), Se = y.slice(_ + 1).trim();
438
+ l.set(Fe, Se);
435
439
  }), d.body) {
436
- const g = b.getWritableStream();
437
- d.body.pipeTo(g);
440
+ const y = A.getWritableStream();
441
+ d.body.pipeTo(y);
438
442
  } else
439
- b.getWritableStream().getWriter().close();
440
- return z();
441
- }, z = () => (h = ue, new pe()), I = {}, b = {
442
- [Me]: I,
443
- [Ce]: /* @__PURE__ */ new Map(),
444
- [Ne]: e.mode,
445
- get [xe]() {
446
- return t;
443
+ A.getWritableStream().getWriter().close();
444
+ return ne();
445
+ }, ne = () => (g = B, new pe()), P = {}, A = {
446
+ [Te]: P,
447
+ [xe]: /* @__PURE__ */ new Map(),
448
+ [Me]: e.mode,
449
+ get [Ne]() {
450
+ return n;
447
451
  },
448
- cookie: f,
449
- headers: l,
450
- env: s,
451
- method: i.method,
452
- signal: i.signal,
452
+ cookie: l,
453
+ headers: f,
454
+ env: c,
455
+ method: o.method,
456
+ signal: o.signal,
453
457
  originalUrl: new URL(u),
454
458
  get params() {
455
- return t?.[L.Params] ?? {};
459
+ return n?.[L.Params] ?? {};
456
460
  },
457
461
  get pathname() {
458
462
  return u.pathname;
@@ -461,348 +465,351 @@ function cn(e, t, n, r, o) {
461
465
  get query() {
462
466
  return u.searchParams;
463
467
  },
464
- request: i,
468
+ request: o,
465
469
  url: u,
466
470
  basePathname: r,
467
- sharedMap: c,
471
+ sharedMap: s,
468
472
  get headersSent() {
469
- return y !== null;
473
+ return w !== null;
470
474
  },
471
475
  get exited() {
472
- return h >= ue;
476
+ return g >= B;
473
477
  },
474
478
  get clientConn() {
475
479
  return e.getClientConn();
476
480
  },
477
- next: T,
478
- resetRoute: M,
479
- exit: z,
480
- cacheControl: (d, m = "Cache-Control") => {
481
- N(), l.set(m, ve(d));
481
+ next: qe,
482
+ resetRoute: De,
483
+ exit: ne,
484
+ cacheControl: (d, h = "Cache-Control") => {
485
+ N(), f.set(h, Ve(d));
482
486
  },
483
487
  resolveValue: (async (d) => {
484
- const m = d.__id;
488
+ const h = d.__id;
485
489
  if (d.__brand === "server_loader") {
486
- if (!(m in I))
490
+ if (!(h in P))
487
491
  throw new Error(
488
492
  "You can not get the returned data of a loader that has not been executed for this request."
489
493
  );
490
- if (I[m] === ye) {
491
- const g = P(b) === "dev";
492
- await We(d, I, b, g);
494
+ if (P[h] === ye) {
495
+ const y = I(A) === "dev";
496
+ await Ue(d, P, A, y);
493
497
  }
494
498
  }
495
- return I[m];
499
+ return P[h];
496
500
  }),
497
- status: (d) => typeof d == "number" ? (N(), p = d, d) : p,
498
- locale: (d) => (typeof d == "string" && (R = d), R || ""),
499
- error: (d, m) => (p = d, l.delete("Cache-Control"), new F(d, m)),
500
- redirect: (d, m) => {
501
- if (N(), p = d, m) {
502
- const g = m.replace(/([^:])\/{2,}/g, "$1/");
503
- m !== g && console.warn(`Redirect URL ${m} is invalid, fixing to ${g}`), l.set("Location", g);
501
+ status: (d) => typeof d == "number" ? (N(), R = d, d) : R,
502
+ locale: (d) => (typeof d == "string" && (M = d), M || ""),
503
+ error: (d, h) => (R = d, f.delete("Cache-Control"), new D(d, h)),
504
+ redirect: (d, h) => {
505
+ if (N(), R = d, h) {
506
+ if (/([^:])\/{2,}/.test(h)) {
507
+ const y = h.replace(/([^:])\/{2,}/g, "$1/");
508
+ console.warn(`Redirect URL ${h} is invalid, fixing to ${y}`), h = y;
509
+ }
510
+ f.set("Location", h);
504
511
  }
505
- return l.delete("Cache-Control"), d > 301 && l.set("Cache-Control", "no-store"), z(), new H();
512
+ return f.delete("Cache-Control"), d > 301 && f.set("Cache-Control", "no-store"), g = B, new H();
506
513
  },
507
514
  rewrite: (d) => {
508
515
  if (N(), d.startsWith("http"))
509
516
  throw new Error("Rewrite does not support absolute urls");
510
- return c.set(Le, !0), new we(d.replace(/\/+/g, "/"));
517
+ return s.set(Pe, !0), new we(d.replace(/\/+/g, "/"));
511
518
  },
512
519
  defer: (d) => typeof d == "function" ? d : () => d,
513
- fail: (d, m) => (N(), p = d, l.delete("Cache-Control"), {
520
+ fail: (d, h) => (N(), R = d, f.delete("Cache-Control"), {
514
521
  failed: !0,
515
- ...m
522
+ ...h
516
523
  }),
517
- text: (d, m) => (l.set("Content-Type", "text/plain; charset=utf-8"), W(d, m)),
518
- html: (d, m) => (l.set("Content-Type", "text/html; charset=utf-8"), W(d, m)),
519
- parseBody: async () => w !== void 0 ? w : w = dn(b, c),
520
- json: (d, m) => (l.set("Content-Type", "application/json; charset=utf-8"), W(d, JSON.stringify(m))),
521
- send: W,
522
- isDirty: () => y !== null,
524
+ text: (d, h) => (f.set("Content-Type", "text/plain; charset=utf-8"), U(d, h)),
525
+ html: (d, h) => (f.set("Content-Type", "text/html; charset=utf-8"), U(d, h)),
526
+ parseBody: async () => b !== void 0 ? b : b = fn(A, s),
527
+ json: (d, h) => (f.set("Content-Type", "application/json; charset=utf-8"), U(d, JSON.stringify(h))),
528
+ send: U,
529
+ isDirty: () => w !== null,
523
530
  getWritableStream: () => {
524
- if (y === null) {
531
+ if (w === null) {
525
532
  if (e.mode === "dev") {
526
- const d = c.get(X);
527
- d && l.set(
533
+ const d = s.get(X);
534
+ d && f.set(
528
535
  "Server-Timing",
529
- d.map(([m, g]) => `${m};dur=${g}`).join(",")
536
+ d.map(([h, y]) => `${h};dur=${y}`).join(",")
530
537
  );
531
538
  }
532
- y = e.getWritableStream(
533
- p,
534
- l,
539
+ w = e.getWritableStream(
540
+ R,
535
541
  f,
536
- o,
537
- b
542
+ l,
543
+ i,
544
+ A
538
545
  );
539
546
  }
540
- return y;
547
+ return w;
541
548
  }
542
549
  };
543
- return Object.freeze(b);
550
+ return Object.freeze(A);
544
551
  }
545
- function U(e) {
546
- return e[Me];
552
+ function O(e) {
553
+ return e[Te];
547
554
  }
548
- function Ue(e) {
549
- return e[Ce];
550
- }
551
- function ln(e) {
555
+ function Oe(e) {
552
556
  return e[xe];
553
557
  }
554
- function P(e) {
558
+ function dn(e) {
555
559
  return e[Ne];
556
560
  }
557
- const ue = Number.MAX_SAFE_INTEGER, dn = async ({ request: e, method: t, query: n }, r) => {
558
- const o = e.headers.get("content-type")?.split(/[;,]/, 1)[0].trim() ?? "";
559
- if (o === "application/x-www-form-urlencoded" || o === "multipart/form-data") {
560
- const i = await e.formData();
561
- return r.set(Ie, i), fn(i);
561
+ function I(e) {
562
+ return e[Me];
563
+ }
564
+ const B = Number.MAX_SAFE_INTEGER, fn = async ({ request: e, method: n, query: t }, r) => {
565
+ const i = e.headers.get("content-type")?.split(/[;,]/, 1)[0].trim() ?? "";
566
+ if (i === "application/x-www-form-urlencoded" || i === "multipart/form-data") {
567
+ const o = await e.formData();
568
+ return r.set(Ie, o), un(o);
562
569
  } else {
563
- if (o === "application/json")
570
+ if (i === "application/json")
564
571
  return await e.json();
565
- if (o === "application/qwik-json") {
566
- if (t === "GET" && n.has(re)) {
567
- const i = n.get(re);
568
- if (i)
572
+ if (i === "application/qwik-json") {
573
+ if (n === "GET" && t.has(oe)) {
574
+ const o = t.get(oe);
575
+ if (o)
569
576
  try {
570
- return ee(decodeURIComponent(i));
577
+ return te(decodeURIComponent(o));
571
578
  } catch {
572
579
  }
573
580
  }
574
- return ee(await e.text());
581
+ return te(await e.text());
575
582
  }
576
583
  }
577
- }, fn = (e) => [...e.entries()].reduce((n, [r, o]) => (r.split(".").reduce((i, a, s, c) => {
584
+ }, un = (e) => [...e.entries()].reduce((t, [r, i]) => (r.split(".").reduce((o, a, c, s) => {
578
585
  if (a.endsWith("[]")) {
579
- const f = a.slice(0, -2);
580
- return i[f] = i[f] || [], i[f] = [...i[f], o];
586
+ const l = a.slice(0, -2);
587
+ return o[l] = o[l] || [], o[l] = [...o[l], i];
581
588
  }
582
- return s < c.length - 1 ? i[a] = i[a] || (Number.isNaN(+c[s + 1]) ? {} : []) : i[a] = o;
583
- }, n), n), {});
584
- function un(e) {
585
- const { params: t, request: n, status: r, locale: o, originalUrl: i } = e, a = {};
586
- n.headers.forEach((T, M) => a[M] = T);
587
- const s = e.sharedMap.get(j), c = e.sharedMap.get(Ie), f = e.sharedMap.get(Pe), l = e.sharedMap.get(sn), u = e.request.headers, h = new URL(i.pathname + i.search, i), y = u.get("X-Forwarded-Host"), w = u.get("X-Forwarded-Proto");
588
- y && (h.port = "", h.host = y), w && (h.protocol = w);
589
- const R = U(e), p = Ue(e);
589
+ return c < s.length - 1 ? o[a] = o[a] || (Number.isNaN(+s[c + 1]) ? {} : []) : o[a] = i;
590
+ }, t), t), {});
591
+ function hn(e) {
592
+ const { params: n, request: t, status: r, locale: i, originalUrl: o } = e, a = {};
593
+ t.headers.forEach((M, R) => a[R] = M);
594
+ const c = e.sharedMap.get(Q), s = e.sharedMap.get(Ie), l = e.sharedMap.get(Ce), f = e.sharedMap.get(cn), u = e.request.headers, m = new URL(o.pathname + o.search, o), p = u.get("X-Forwarded-Host"), g = u.get("X-Forwarded-Proto");
595
+ p && (m.port = "", m.host = p), g && (m.protocol = g);
596
+ const w = O(e), b = Oe(e);
590
597
  return {
591
- url: h.href,
598
+ url: m.href,
592
599
  requestHeaders: a,
593
- locale: o(),
594
- nonce: l,
600
+ locale: i(),
601
+ nonce: f,
595
602
  containerAttributes: {
596
- [je]: f
603
+ [je]: l
597
604
  },
598
605
  qwikrouter: {
599
- routeName: f,
606
+ routeName: l,
600
607
  ev: e,
601
- params: { ...t },
602
- loadedRoute: ln(e),
608
+ params: { ...n },
609
+ loadedRoute: dn(e),
603
610
  response: {
604
611
  status: r(),
605
- loaders: R,
606
- loadersSerializationStrategy: p,
607
- action: s,
608
- formData: c
612
+ loaders: w,
613
+ loadersSerializationStrategy: b,
614
+ action: c,
615
+ formData: s
609
616
  }
610
617
  }
611
618
  };
612
619
  }
613
- const hn = (e, t, n, r, o) => {
614
- const i = [], a = [], s = [], c = !!(t && bn(t[L.Mods]));
615
- if (e && he(
616
- i,
620
+ const mn = (e, n, t, r, i, o) => {
621
+ const a = [], c = [], s = [], l = !!(n && An(n[L.Mods]));
622
+ if (o && s.push(Nn), e && he(
617
623
  a,
624
+ c,
618
625
  s,
619
626
  e,
620
- c,
621
- n
622
- ), t) {
623
- const f = t[L.RouteName];
624
- r && (n === "POST" || n === "PUT" || n === "PATCH" || n === "DELETE") && (r === "lax-proto" ? s.unshift(An) : s.unshift(_n)), c && ((n === "POST" || n === "GET") && s.push(wn), s.push(pn), s.push(Nn));
625
- const l = t[L.Mods];
626
- s.push(Mn), he(
627
- i,
627
+ l,
628
+ t
629
+ ), n) {
630
+ const f = n[L.RouteName];
631
+ r && (t === "POST" || t === "PUT" || t === "PATCH" || t === "DELETE") && (r === "lax-proto" ? s.unshift(_n) : s.unshift(Tn)), l && ((t === "POST" || t === "GET") && s.push(pn), s.push(Rn), o && s.push(xn));
632
+ const u = n[L.Mods];
633
+ he(
628
634
  a,
635
+ c,
629
636
  s,
637
+ u,
630
638
  l,
631
- c,
632
- n
633
- ), c && (s.push((u) => {
634
- u.sharedMap.set(Pe, f);
635
- }), s.push(mn(a)), s.push(gn(i)), s.push(o));
639
+ t
640
+ ), l && (s.push((m) => {
641
+ m.sharedMap.set(Ce, f);
642
+ }), s.push(gn(c)), s.push(yn(a)), s.push(i));
636
643
  }
637
644
  return s;
638
- }, he = (e, t, n, r, o, i) => {
645
+ }, he = (e, n, t, r, i, o) => {
639
646
  for (const a of r) {
640
- typeof a.onRequest == "function" ? n.push(a.onRequest) : Array.isArray(a.onRequest) && n.push(...a.onRequest);
641
- let s;
642
- switch (i) {
647
+ typeof a.onRequest == "function" ? t.push(a.onRequest) : Array.isArray(a.onRequest) && t.push(...a.onRequest);
648
+ let c;
649
+ switch (o) {
643
650
  case "GET": {
644
- s = a.onGet;
651
+ c = a.onGet;
645
652
  break;
646
653
  }
647
654
  case "POST": {
648
- s = a.onPost;
655
+ c = a.onPost;
649
656
  break;
650
657
  }
651
658
  case "PUT": {
652
- s = a.onPut;
659
+ c = a.onPut;
653
660
  break;
654
661
  }
655
662
  case "PATCH": {
656
- s = a.onPatch;
663
+ c = a.onPatch;
657
664
  break;
658
665
  }
659
666
  case "DELETE": {
660
- s = a.onDelete;
667
+ c = a.onDelete;
661
668
  break;
662
669
  }
663
670
  case "OPTIONS": {
664
- s = a.onOptions;
671
+ c = a.onOptions;
665
672
  break;
666
673
  }
667
674
  case "HEAD": {
668
- s = a.onHead;
675
+ c = a.onHead;
669
676
  break;
670
677
  }
671
678
  }
672
- if (typeof s == "function" ? n.push(s) : Array.isArray(s) && n.push(...s), o)
673
- for (const c of Object.values(a))
674
- typeof c == "function" && (c.__brand === "server_loader" ? e.push(c) : c.__brand === "server_action" && t.push(c));
679
+ if (typeof c == "function" ? t.push(c) : Array.isArray(c) && t.push(...c), i)
680
+ for (const s of Object.values(a))
681
+ typeof s == "function" && (s.__brand === "server_loader" ? e.push(s) : s.__brand === "server_action" && n.push(s));
675
682
  }
676
683
  };
677
- function mn(e) {
678
- return async (t) => {
679
- const n = t;
680
- if (n.headersSent) {
681
- n.exit();
684
+ function gn(e) {
685
+ return async (n) => {
686
+ const t = n;
687
+ if (t.headersSent) {
688
+ t.exit();
682
689
  return;
683
690
  }
684
- const { method: r } = n, o = U(n), i = P(n) === "dev";
685
- if (i && r === "GET" && n.query.has(te) && console.warn(
691
+ const { method: r } = t, i = O(t), o = I(t) === "dev";
692
+ if (o && r === "GET" && t.query.has(ie) && console.warn(
686
693
  `Seems like you are submitting a Qwik Action via GET request. Qwik Actions should be submitted via POST request.
687
694
  Make sure your <form> has method="POST" attribute, like this: <form method="POST">`
688
695
  ), r === "POST") {
689
- const a = n.query.get(te);
696
+ const a = t.query.get(ie);
690
697
  if (a) {
691
- const s = globalThis._qwikActionsMap, c = e.find((f) => f.__id === a) ?? s?.get(a);
692
- if (c) {
693
- n.sharedMap.set(j, a);
694
- const f = await n.parseBody();
695
- if (!f || typeof f != "object")
698
+ const c = globalThis._qwikActionsMap, s = e.find((l) => l.__id === a) ?? c?.get(a);
699
+ if (s) {
700
+ t.sharedMap.set(Q, a);
701
+ const l = await t.parseBody();
702
+ if (!l || typeof l != "object")
696
703
  throw new Error(
697
704
  `Expected request data for the action id ${a} to be an object`
698
705
  );
699
- const l = await qe(n, c.__validators, f, i);
700
- if (!l.success)
701
- o[a] = n.fail(l.status ?? 500, l.error);
706
+ const f = await ke(t, s.__validators, l, o);
707
+ if (!f.success)
708
+ i[a] = t.fail(f.status ?? 500, f.error);
702
709
  else {
703
- const u = i ? await G(
704
- n,
705
- c.__qrl.getHash(),
706
- () => c.__qrl.call(n, l.data, n)
707
- ) : await c.__qrl.call(n, l.data, n);
708
- i && Q(u, c.__qrl), o[a] = u;
710
+ const u = o ? await j(
711
+ t,
712
+ s.__qrl.getHash(),
713
+ () => s.__qrl.call(t, f.data, t)
714
+ ) : await s.__qrl.call(t, f.data, t);
715
+ o && S(u, s.__qrl), i[a] = u;
709
716
  }
710
717
  }
711
718
  }
712
719
  }
713
720
  };
714
721
  }
715
- function gn(e) {
716
- return async (t) => {
717
- const n = t;
718
- if (n.headersSent) {
719
- n.exit();
722
+ function yn(e) {
723
+ return async (n) => {
724
+ const t = n;
725
+ if (t.headersSent) {
726
+ t.exit();
720
727
  return;
721
728
  }
722
- const r = U(n), o = P(n) === "dev";
729
+ const r = O(t), i = I(t) === "dev";
723
730
  if (e.length > 0) {
724
- let i = [];
725
- if (n.query.has(v)) {
726
- const s = n.query.getAll(v);
727
- for (const c of e)
728
- s.includes(c.__id) ? i.push(c) : r[c.__id] = ye;
731
+ let o = [];
732
+ if (t.query.has(J)) {
733
+ const c = t.query.getAll(J);
734
+ for (const s of e)
735
+ c.includes(s.__id) ? o.push(s) : r[s.__id] = ye;
729
736
  } else
730
- i = e;
731
- const a = i.map(
732
- (s) => We(s, r, n, o)
737
+ o = e;
738
+ const a = o.map(
739
+ (c) => Ue(c, r, t, i)
733
740
  );
734
741
  await Promise.all(a);
735
742
  }
736
743
  };
737
744
  }
738
- async function We(e, t, n, r) {
739
- const o = e.__id;
740
- return t[o] = qe(
741
- n,
745
+ async function Ue(e, n, t, r) {
746
+ const i = e.__id;
747
+ return n[i] = ke(
748
+ t,
742
749
  e.__validators,
743
750
  void 0,
744
751
  // data
745
752
  r
746
- ).then((a) => a.success ? r ? G(
747
- n,
753
+ ).then((a) => a.success ? r ? j(
754
+ t,
748
755
  e.__qrl.getHash(),
749
- () => e.__qrl.call(n, n)
750
- ) : e.__qrl.call(n, n) : n.fail(a.status ?? 500, a.error)).then((a) => (typeof a == "function" ? t[o] = a() : (r && Q(a, e.__qrl), t[o] = a), a)), Ue(n).set(o, e.__serializationStrategy), t[o];
756
+ () => e.__qrl.call(t, t)
757
+ ) : e.__qrl.call(t, t) : t.fail(a.status ?? 500, a.error)).then((a) => (typeof a == "function" ? n[i] = a() : (r && S(a, e.__qrl), n[i] = a), a)), Oe(t).set(i, e.__serializationStrategy), n[i];
751
758
  }
752
- async function qe(e, t, n, r) {
753
- let o = {
759
+ async function ke(e, n, t, r) {
760
+ let i = {
754
761
  success: !0,
755
- data: n
762
+ data: t
756
763
  };
757
- if (t)
758
- for (const i of t)
759
- if (r ? o = await G(
764
+ if (n)
765
+ for (const o of n)
766
+ if (r ? i = await j(
760
767
  e,
761
768
  "validator$",
762
- () => i.validate(e, n)
763
- ) : o = await i.validate(e, n), o.success)
764
- n = o.data;
769
+ () => o.validate(e, t)
770
+ ) : i = await o.validate(e, t), i.success)
771
+ t = i.data;
765
772
  else
766
- return o;
767
- return o;
773
+ return i;
774
+ return i;
768
775
  }
769
- function yn(e) {
776
+ function wn(e) {
770
777
  return e ? typeof e == "object" && Symbol.asyncIterator in e : !1;
771
778
  }
772
- async function wn(e) {
773
- const t = e.query.get(Qe);
774
- if (t && e.request.headers.get("X-QRL") === t && e.request.headers.get("Content-Type") === "application/qwik-json") {
779
+ async function pn(e) {
780
+ const n = e.query.get(Ee);
781
+ if (n && e.request.headers.get("X-QRL") === n && e.request.headers.get("Content-Type") === "application/qwik-json") {
775
782
  e.exit();
776
- const n = P(e) === "dev", r = await e.parseBody();
783
+ const t = I(e) === "dev", r = await e.parseBody();
777
784
  if (Array.isArray(r)) {
778
- const [o, ...i] = r;
779
- if (Rn(o) && o.getHash() === t) {
785
+ const [i, ...o] = r;
786
+ if (bn(i) && i.getHash() === n) {
780
787
  let a;
781
788
  try {
782
- n ? a = await G(
789
+ t ? a = await j(
783
790
  e,
784
- `server_${o.getSymbol()}`,
785
- () => o.apply(e, i)
786
- ) : a = await o.apply(e, i);
787
- } catch (s) {
788
- throw s instanceof F ? e.error(s.status, s.data) : e.error(500, "Invalid request");
791
+ `server_${i.getSymbol()}`,
792
+ () => i.apply(e, o)
793
+ ) : a = await i.apply(e, o);
794
+ } catch (c) {
795
+ throw c instanceof D ? e.error(c.status, c.data) : e.error(500, "Invalid request");
789
796
  }
790
- if (yn(a)) {
797
+ if (wn(a)) {
791
798
  e.headers.set("Content-Type", "text/qwik-json-stream");
792
- const c = e.getWritableStream().getWriter();
793
- for await (const f of a) {
794
- n && Q(f, o);
795
- const l = await D([f]);
799
+ const s = e.getWritableStream().getWriter();
800
+ for await (const l of a) {
801
+ t && S(l, i);
802
+ const f = await q([l]);
796
803
  if (e.signal.aborted)
797
804
  break;
798
- await c.write(E.encode(`${l}
805
+ await s.write(E.encode(`${f}
799
806
  `));
800
807
  }
801
- c.close();
808
+ s.close();
802
809
  } else {
803
- Q(a, o), e.headers.set("Content-Type", "application/qwik-json");
804
- const s = await D([a]);
805
- e.send(200, s);
810
+ S(a, i), e.headers.set("Content-Type", "application/qwik-json");
811
+ const c = await q([a]);
812
+ e.send(200, c);
806
813
  }
807
814
  return;
808
815
  }
@@ -810,93 +817,91 @@ async function wn(e) {
810
817
  throw e.error(500, "Invalid request");
811
818
  }
812
819
  }
813
- function pn(e) {
814
- const { basePathname: t, originalUrl: n, sharedMap: r } = e, { pathname: o, search: i } = n;
815
- if (!r.has(O) && o !== t && !o.endsWith(".html")) {
820
+ function Rn(e) {
821
+ const { basePathname: n, originalUrl: t, sharedMap: r } = e, { pathname: i, search: o } = t;
822
+ if (!r.has(ee) && i !== n && !i.endsWith(".html")) {
816
823
  if (globalThis.__NO_TRAILING_SLASH__) {
817
- if (o.endsWith("/"))
824
+ if (i.endsWith("/"))
818
825
  throw e.redirect(
819
- V.MovedPermanently,
820
- o.slice(0, o.length - 1) + i
826
+ Y.MovedPermanently,
827
+ i.slice(0, i.length - 1) + o
821
828
  );
822
- } else if (!o.endsWith("/"))
823
- throw e.redirect(V.MovedPermanently, o + "/" + i);
829
+ } else if (!i.endsWith("/"))
830
+ throw e.redirect(Y.MovedPermanently, i + "/" + o);
824
831
  }
825
832
  }
826
- function Q(e, t) {
833
+ function S(e, n) {
827
834
  try {
828
- Se(e, void 0);
829
- } catch (n) {
830
- throw n instanceof Error && t.dev && (n.loc = t.dev), n;
835
+ Qe(e, void 0);
836
+ } catch (t) {
837
+ throw t instanceof Error && n.dev && (t.loc = n.dev), t;
831
838
  }
832
839
  }
833
- const Rn = (e) => typeof e == "function" && typeof e.getSymbol == "function";
834
- function bn(e) {
835
- const t = e[e.length - 1];
836
- return t && typeof t.default == "function";
840
+ const bn = (e) => typeof e == "function" && typeof e.getSymbol == "function";
841
+ function An(e) {
842
+ const n = e[e.length - 1];
843
+ return n && typeof n.default == "function";
837
844
  }
838
845
  function Z(e) {
839
846
  e = new URL(e), e.pathname.endsWith(C) && (e.pathname = e.pathname.slice(0, -C.length)), globalThis.__NO_TRAILING_SLASH__ ? e.pathname.endsWith("/") && (e.pathname = e.pathname.slice(0, -1)) : e.pathname.endsWith("/") || (e.pathname += "/");
840
- const t = e.search.slice(1).replaceAll(/&?q(action|data|func|loaders)=[^&]+/g, "");
841
- return `${e.pathname}${t ? `?${t}` : ""}${e.hash}`;
847
+ const n = e.search.slice(1).replaceAll(/&?q(action|data|func|loaders)=[^&]+/g, "");
848
+ return `${e.pathname}${n ? `?${n}` : ""}${e.hash}`;
842
849
  }
843
850
  const E = /* @__PURE__ */ new TextEncoder();
844
- function An(e) {
845
- ke(e, "lax-proto");
846
- }
847
851
  function _n(e) {
848
- ke(e);
852
+ We(e, "lax-proto");
849
853
  }
850
- function ke(e, t) {
851
- if (Cn(
854
+ function Tn(e) {
855
+ We(e);
856
+ }
857
+ function We(e, n) {
858
+ if (In(
852
859
  e.request.headers,
853
860
  "application/x-www-form-urlencoded",
854
861
  "multipart/form-data",
855
862
  "text/plain"
856
863
  )) {
857
- const r = e.request.headers.get("origin"), o = e.url.origin;
858
- let i = r !== o;
859
- if (i && t && r?.replace(/^http(s)?/g, "") === o.replace(/^http(s)?/g, "") && (i = !1), i)
864
+ const r = e.request.headers.get("origin"), i = e.url.origin;
865
+ let o = r !== i;
866
+ if (o && n && r?.replace(/^http(s)?/g, "") === i.replace(/^http(s)?/g, "") && (o = !1), o)
860
867
  throw e.error(
861
868
  403,
862
869
  `CSRF check failed. Cross-site ${e.method} form submissions are forbidden.
863
- The request origin "${r}" does not match the server origin "${o}".`
870
+ The request origin "${r}" does not match the server origin "${i}".`
864
871
  );
865
872
  }
866
873
  }
867
- function Tn(e) {
868
- return async (t) => {
869
- if (t.headersSent || t.sharedMap.has(O))
874
+ function Mn(e) {
875
+ return async (n) => {
876
+ if (n.headersSent || n.sharedMap.has(ee))
870
877
  return;
871
- t.request.headers.forEach((l, u) => l);
872
- const r = t.headers;
878
+ n.request.headers.forEach((f, u) => f);
879
+ const r = n.headers;
873
880
  r.has("Content-Type") || r.set("Content-Type", "text/html; charset=utf-8");
874
- const { readable: o, writable: i } = new TextEncoderStream(), a = t.getWritableStream(), s = o.pipeTo(a, { preventClose: !0 }), c = i.getWriter(), f = t.status();
881
+ const { readable: i, writable: o } = new TextEncoderStream(), a = n.getWritableStream(), c = i.pipeTo(a, { preventClose: !0 }), s = o.getWriter(), l = n.status();
875
882
  try {
876
- const l = P(t) === "static", u = un(t), h = await e({
877
- base: t.basePathname + "build/",
878
- stream: c,
883
+ const f = I(n) === "static", u = hn(n), m = await e({
884
+ base: n.basePathname + "build/",
885
+ stream: s,
879
886
  serverData: u,
880
887
  containerAttributes: {
881
- "q:render": l ? "static" : "",
888
+ "q:render": f ? "static" : "",
882
889
  ...u.containerAttributes
883
890
  }
884
- }), y = {
885
- loaders: U(t),
886
- action: t.sharedMap.get(j),
887
- status: f !== 200 ? f : 200,
888
- href: Z(t.url)
891
+ }), p = {
892
+ loaders: O(n),
893
+ action: n.sharedMap.get(Q),
894
+ status: l !== 200 ? l : 200,
895
+ href: Z(n.url)
889
896
  };
890
- typeof h.html == "string" && await c.write(h.html), t.sharedMap.set(Oe, y);
897
+ typeof m.html == "string" && await s.write(m.html), n.sharedMap.set(Le, p);
891
898
  } finally {
892
- await c.ready, await c.close(), await s;
899
+ await s.ready, await s.close(), await c;
893
900
  }
894
901
  await a.close();
895
902
  };
896
903
  }
897
- async function Mn(e) {
898
- if (!e.sharedMap.has(O))
899
- return;
904
+ async function Nn(e) {
900
905
  try {
901
906
  await e.next();
902
907
  } catch (i) {
@@ -905,9 +910,9 @@ async function Mn(e) {
905
910
  }
906
911
  if (e.headersSent)
907
912
  return;
908
- const n = e.status(), r = e.headers.get("Location");
909
- if (n >= 301 && n <= 308 && r) {
910
- const i = xn(r);
913
+ const n = e.status(), t = e.headers.get("Location");
914
+ if (n >= 301 && n <= 308 && t) {
915
+ const i = Cn(t);
911
916
  if (i) {
912
917
  e.headers.set("Location", i), e.getWritableStream().close();
913
918
  return;
@@ -915,177 +920,183 @@ async function Mn(e) {
915
920
  e.status(200), e.headers.delete("Location");
916
921
  }
917
922
  }
918
- async function Nn(e) {
919
- if (!e.sharedMap.has(O) || (await e.next(), e.headersSent || e.exited))
923
+ async function xn(e) {
924
+ if (await e.next(), e.headersSent || e.exited)
920
925
  return;
921
- const n = e.status(), r = e.headers.get("Location");
922
- e.request.headers.forEach((l, u) => l), e.headers.set("Content-Type", "application/json; charset=utf-8");
923
- let o = U(e);
924
- const i = e.query.getAll(v), a = i.length > 0;
925
- if (a) {
926
+ const n = e.status(), t = e.headers.get("Location");
927
+ e.request.headers.forEach((l, f) => l), e.headers.set("Content-Type", "application/json; charset=utf-8");
928
+ let r = O(e);
929
+ const i = e.query.getAll(J), o = i.length > 0;
930
+ if (o) {
926
931
  const l = {};
927
- for (const u of i) {
928
- const h = o[u];
929
- l[u] = h;
932
+ for (const f of i) {
933
+ const u = r[f];
934
+ l[f] = u;
930
935
  }
931
- o = l;
936
+ r = l;
932
937
  }
933
- const s = a ? {
938
+ const a = o ? {
934
939
  // send minimal data to the client
935
- loaders: o,
940
+ loaders: r,
936
941
  status: n !== 200 ? n : 200,
937
942
  href: Z(e.url)
938
943
  } : {
939
- loaders: o,
940
- action: e.sharedMap.get(j),
944
+ loaders: r,
945
+ action: e.sharedMap.get(Q),
941
946
  status: n !== 200 ? n : 200,
942
947
  href: Z(e.url),
943
- redirect: r ?? void 0,
944
- isRewrite: e.sharedMap.get(Le)
945
- }, c = e.getWritableStream().getWriter(), f = await D([s]);
946
- c.write(E.encode(f)), e.sharedMap.set(Oe, s), c.close();
948
+ redirect: t ?? void 0,
949
+ isRewrite: e.sharedMap.get(Pe)
950
+ }, c = e.getWritableStream().getWriter(), s = await q([a]);
951
+ c.write(E.encode(s)), e.sharedMap.set(Le, a), c.close();
947
952
  }
948
- function xn(e) {
953
+ function Cn(e) {
949
954
  if (e.startsWith("/")) {
950
- const t = C, n = new URL(e, "http://localhost");
951
- return (n.pathname.endsWith("/") ? n.pathname.slice(0, -1) : n.pathname) + (t.startsWith("/") ? "" : "/") + t + n.search;
955
+ if (!e.includes(C)) {
956
+ const n = new URL(e, "http://localhost");
957
+ return (n.pathname.endsWith("/") ? n.pathname.slice(0, -1) : n.pathname) + C + n.search;
958
+ }
959
+ return e;
952
960
  } else
953
961
  return;
954
962
  }
955
963
  function me() {
956
964
  return typeof performance < "u" ? performance.now() : 0;
957
965
  }
958
- async function G(e, t, n) {
966
+ async function j(e, n, t) {
959
967
  const r = me();
960
968
  try {
961
- return await n();
969
+ return await t();
962
970
  } finally {
963
- const o = me() - r;
964
- let i = e.sharedMap.get(X);
965
- i || e.sharedMap.set(X, i = []), i.push([t, o]);
971
+ const i = me() - r;
972
+ let o = e.sharedMap.get(X);
973
+ o || e.sharedMap.set(X, o = []), o.push([n, i]);
966
974
  }
967
975
  }
968
- function Cn(e, ...t) {
969
- const n = e.get("content-type")?.split(/;/, 1)[0].trim() ?? "";
970
- return t.includes(n);
976
+ function In(e, ...n) {
977
+ const t = e.get("content-type")?.split(/;/, 1)[0].trim() ?? "";
978
+ return n.includes(t);
971
979
  }
972
- let J;
973
- async function Wn(e, t) {
974
- const { render: n, checkOrigin: r } = t;
975
- let { qwikRouterConfig: o } = t;
976
- if (o || (J || (J = await import("@qwik-router-config")), o = J), !o)
980
+ let K;
981
+ async function Wn(e, n) {
982
+ const { render: t, checkOrigin: r } = n;
983
+ let { qwikRouterConfig: i } = n;
984
+ if (i || (K || (K = await import("@qwik-router-config")), i = K), !i)
977
985
  throw new Error("qwikRouterConfig is required.");
978
- const i = e.url.pathname, a = fe(i), s = await ge(
986
+ const { pathname: o, isInternal: a } = V(e.url.pathname), c = await ge(
987
+ i,
979
988
  o,
980
- a,
981
989
  e.request.method,
982
990
  r ?? !0,
983
- n
991
+ t,
992
+ a
984
993
  );
985
- if (s) {
986
- const [c, f] = s;
987
- return an(
994
+ if (c) {
995
+ const [s, l] = c;
996
+ return sn(
988
997
  e,
989
- c,
990
- f,
998
+ s,
999
+ l,
991
1000
  async (u) => {
992
- const h = fe(u.pathname), y = await ge(
993
- o,
994
- h,
1001
+ const { pathname: m } = V(u.pathname), p = await ge(
1002
+ i,
1003
+ m,
995
1004
  e.request.method,
996
1005
  r ?? !0,
997
- n
1006
+ t,
1007
+ a
998
1008
  );
999
- if (y) {
1000
- const [w, R] = y;
1001
- return { loadedRoute: w, requestHandlers: R };
1009
+ if (p) {
1010
+ const [g, w] = p;
1011
+ return { loadedRoute: g, requestHandlers: w };
1002
1012
  } else
1003
1013
  return { loadedRoute: null, requestHandlers: [] };
1004
1014
  },
1005
- o.basePathname
1015
+ i.basePathname
1006
1016
  );
1007
1017
  }
1008
1018
  return null;
1009
1019
  }
1010
- async function ge(e, t, n, r, o) {
1011
- const { routes: i, serverPlugins: a, menus: s, cacheModules: c } = e, f = await Ke(i, s, c, t), l = hn(
1012
- a,
1020
+ async function ge(e, n, t, r, i, o) {
1021
+ const { routes: a, serverPlugins: c, menus: s, cacheModules: l } = e, f = await ve(a, s, l, n, o), u = mn(
1022
+ c,
1013
1023
  f,
1014
- n,
1024
+ t,
1015
1025
  r,
1016
- Tn(o)
1026
+ Mn(i),
1027
+ o
1017
1028
  );
1018
- return l.length > 0 ? [f, l] : null;
1029
+ return u.length > 0 ? [f, u] : null;
1019
1030
  }
1020
1031
  const Pn = [
1021
1032
  // Will be replaced in post-build with the 404s generated by SSG
1022
1033
  "__QWIK_ROUTER_NOT_FOUND_ARRAY__"
1023
1034
  ];
1024
- function qn(e) {
1025
- for (const [t, n] of Pn)
1026
- if (e.startsWith(t))
1027
- return n;
1035
+ function $n(e) {
1036
+ for (const [n, t] of Pn)
1037
+ if (e.startsWith(n))
1038
+ return t;
1028
1039
  return _e(404, "Resource Not Found");
1029
1040
  }
1030
- const Y = /* @__PURE__ */ new Set(["__QWIK_ROUTER_STATIC_PATHS_ARRAY__"]);
1031
- function kn(e, t) {
1041
+ const v = /* @__PURE__ */ new Set(["__QWIK_ROUTER_STATIC_PATHS_ARRAY__"]);
1042
+ function qn(e, n) {
1032
1043
  if (e.toUpperCase() !== "GET")
1033
1044
  return !1;
1034
- const n = t.pathname;
1035
- if (n.startsWith("/" + (globalThis.__QWIK_BUILD_DIR__ || "build") + "/") || n.startsWith("/" + (globalThis.__QWIK_ASSETS_DIR__ || "assets") + "/") || Y.has(n))
1045
+ const t = n.pathname;
1046
+ if (t.startsWith("/" + (globalThis.__QWIK_BUILD_DIR__ || "build") + "/") || t.startsWith("/" + (globalThis.__QWIK_ASSETS_DIR__ || "assets") + "/") || v.has(t))
1036
1047
  return !0;
1037
- if (n.endsWith("/q-data.json")) {
1038
- const r = n.replace(/\/q-data.json$/, "");
1039
- if (Y.has(r + "/") || Y.has(r))
1048
+ if (t.endsWith("/q-data.json")) {
1049
+ const r = t.replace(/\/q-data.json$/, "");
1050
+ if (v.has(r + "/") || v.has(r))
1040
1051
  return !0;
1041
1052
  }
1042
1053
  return !1;
1043
1054
  }
1044
- class $n extends Error {
1045
- constructor(t, n) {
1046
- super(typeof n == "string" ? n : void 0), this.status = t, this.data = n;
1055
+ class Dn extends Error {
1056
+ constructor(n, t) {
1057
+ super(typeof t == "string" ? t : void 0), this.status = n, this.data = t;
1047
1058
  }
1048
1059
  }
1049
1060
  class $e {
1050
1061
  }
1051
- class Dn extends $e {
1052
- }
1053
1062
  class Fn extends $e {
1054
- constructor(t) {
1055
- super(), this.pathname = t;
1063
+ }
1064
+ class Sn extends $e {
1065
+ constructor(n) {
1066
+ super(), this.pathname = n;
1056
1067
  }
1057
1068
  }
1058
- class Sn {
1069
+ class Qn {
1059
1070
  #e = null;
1060
1071
  #n = new TextEncoder();
1061
1072
  #t = new TransformStream({
1062
- transform: (t, n) => {
1063
- t = String(t);
1073
+ transform: (n, t) => {
1074
+ n = String(n);
1064
1075
  let r = "";
1065
- for (let o = 0; o < t.length; o++) {
1066
- const i = t[o], a = i.charCodeAt(0);
1076
+ for (let i = 0; i < n.length; i++) {
1077
+ const o = n[i], a = o.charCodeAt(0);
1067
1078
  if (this.#e !== null) {
1068
- const s = this.#e;
1079
+ const c = this.#e;
1069
1080
  if (this.#e = null, 56320 <= a && a <= 57343) {
1070
- r += s + i;
1081
+ r += c + o;
1071
1082
  continue;
1072
1083
  }
1073
1084
  r += "�";
1074
1085
  }
1075
1086
  if (55296 <= a && a <= 56319) {
1076
- this.#e = i;
1087
+ this.#e = o;
1077
1088
  continue;
1078
1089
  }
1079
1090
  if (56320 <= a && a <= 57343) {
1080
1091
  r += "�";
1081
1092
  continue;
1082
1093
  }
1083
- r += i;
1094
+ r += o;
1084
1095
  }
1085
- r && n.enqueue(this.#n.encode(r));
1096
+ r && t.enqueue(this.#n.encode(r));
1086
1097
  },
1087
- flush: (t) => {
1088
- this.#e !== null && t.enqueue(new Uint8Array([239, 191, 189]));
1098
+ flush: (n) => {
1099
+ this.#e !== null && n.enqueue(new Uint8Array([239, 191, 189]));
1089
1100
  }
1090
1101
  });
1091
1102
  get encoding() {
@@ -1103,14 +1114,14 @@ class Sn {
1103
1114
  }
1104
1115
  export {
1105
1116
  $e as AbortMessage,
1106
- Dn as RedirectMessage,
1107
- Oe as RequestEvShareQData,
1108
- Fn as RewriteMessage,
1109
- $n as ServerError,
1110
- Sn as _TextEncoderStream_polyfill,
1111
- K as getErrorHtml,
1112
- qn as getNotFound,
1113
- kn as isStaticPath,
1114
- Un as mergeHeadersCookies,
1117
+ Fn as RedirectMessage,
1118
+ Le as RequestEvShareQData,
1119
+ Sn as RewriteMessage,
1120
+ Dn as ServerError,
1121
+ Qn as _TextEncoderStream_polyfill,
1122
+ G as getErrorHtml,
1123
+ $n as getNotFound,
1124
+ qn as isStaticPath,
1125
+ kn as mergeHeadersCookies,
1115
1126
  Wn as requestHandler
1116
1127
  };