@demiurgejs/core 0.2.0-beta.2 → 0.2.0-beta.3

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 (106) hide show
  1. package/dist/adapter/testing.js.map +1 -1
  2. package/dist/browser/file-router.d.ts.map +1 -1
  3. package/dist/chunks/{document-shell-D1xo6cEA.js → document-shell-WoM8yZlR.js} +2 -2
  4. package/dist/chunks/{document-shell-D1xo6cEA.js.map → document-shell-WoM8yZlR.js.map} +1 -1
  5. package/dist/chunks/{image-codec-BGTx_t5K.js → image-codec-Di53WpcH.js} +2 -2
  6. package/dist/chunks/{image-codec-BGTx_t5K.js.map → image-codec-Di53WpcH.js.map} +1 -1
  7. package/dist/chunks/{images-B9MqcjSA.js → images-Edar3eU1.js} +2 -2
  8. package/dist/chunks/{images-B9MqcjSA.js.map → images-Edar3eU1.js.map} +1 -1
  9. package/dist/chunks/{request-metadata-D5NrT8ks.js → request-metadata-DaIYq4Ea.js} +214 -179
  10. package/dist/chunks/request-metadata-DaIYq4Ea.js.map +1 -0
  11. package/dist/chunks/{streaming-BQ1bykDo.js → streaming-D0fGAuiO.js} +5 -5
  12. package/dist/chunks/streaming-D0fGAuiO.js.map +1 -0
  13. package/dist/chunks/{testing-B_iMFYz_.js → testing-CRflAw4X.js} +1228 -1074
  14. package/dist/chunks/testing-CRflAw4X.js.map +1 -0
  15. package/dist/data/cache.d.ts +8 -0
  16. package/dist/data/cache.d.ts.map +1 -1
  17. package/dist/data/idempotency.d.ts.map +1 -1
  18. package/dist/data/index.d.ts +3 -1
  19. package/dist/data/index.d.ts.map +1 -1
  20. package/dist/data/testing.d.ts.map +1 -1
  21. package/dist/data/testing.js +94 -72
  22. package/dist/data/testing.js.map +1 -1
  23. package/dist/data/tiered.d.ts +7 -0
  24. package/dist/data/tiered.d.ts.map +1 -0
  25. package/dist/document/deferred-scripts.d.ts.map +1 -1
  26. package/dist/document/hydration.d.ts.map +1 -1
  27. package/dist/document/index.d.ts +1 -0
  28. package/dist/document/index.d.ts.map +1 -1
  29. package/dist/document/trusted-types.d.ts +10 -0
  30. package/dist/document/trusted-types.d.ts.map +1 -0
  31. package/dist/edge/index.js +3 -3
  32. package/dist/index.d.ts +6 -6
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +768 -432
  35. package/dist/index.js.map +1 -1
  36. package/dist/internal/testing.js +9 -9
  37. package/dist/kv/index.d.ts +2 -0
  38. package/dist/kv/index.d.ts.map +1 -1
  39. package/dist/kv/index.js +71 -48
  40. package/dist/kv/index.js.map +1 -1
  41. package/dist/kv/rate-limit-store.d.ts +8 -0
  42. package/dist/kv/rate-limit-store.d.ts.map +1 -0
  43. package/dist/kv/store.d.ts.map +1 -1
  44. package/dist/node/http.d.ts.map +1 -1
  45. package/dist/node/image.d.ts.map +1 -1
  46. package/dist/node/index.d.ts.map +1 -1
  47. package/dist/node/index.js +3 -3
  48. package/dist/node/index.js.map +1 -1
  49. package/dist/node/static.d.ts.map +1 -1
  50. package/dist/node/streaming.d.ts.map +1 -1
  51. package/dist/platform/images.d.ts.map +1 -1
  52. package/dist/platform/index.d.ts +5 -1
  53. package/dist/platform/index.d.ts.map +1 -1
  54. package/dist/platform/observability.d.ts +2 -1
  55. package/dist/platform/observability.d.ts.map +1 -1
  56. package/dist/platform/web-vitals-client.d.ts +32 -0
  57. package/dist/platform/web-vitals-client.d.ts.map +1 -0
  58. package/dist/platform/web-vitals.d.ts +78 -0
  59. package/dist/platform/web-vitals.d.ts.map +1 -0
  60. package/dist/redis/index.d.ts +2 -0
  61. package/dist/redis/index.d.ts.map +1 -1
  62. package/dist/redis/index.js +84 -46
  63. package/dist/redis/index.js.map +1 -1
  64. package/dist/redis/rate-limit-store.d.ts +8 -0
  65. package/dist/redis/rate-limit-store.d.ts.map +1 -0
  66. package/dist/redis/store.d.ts.map +1 -1
  67. package/dist/route/action.d.ts.map +1 -1
  68. package/dist/route/middleware.d.ts.map +1 -1
  69. package/dist/route/response.d.ts.map +1 -1
  70. package/dist/router/index.d.ts +1 -1
  71. package/dist/router/index.d.ts.map +1 -1
  72. package/dist/router/manifest.d.ts +1 -0
  73. package/dist/router/manifest.d.ts.map +1 -1
  74. package/dist/security/cookies.d.ts +26 -0
  75. package/dist/security/cookies.d.ts.map +1 -0
  76. package/dist/security/env.d.ts.map +1 -1
  77. package/dist/security/fetch-metadata.d.ts +29 -0
  78. package/dist/security/fetch-metadata.d.ts.map +1 -0
  79. package/dist/security/index.d.ts +5 -1
  80. package/dist/security/index.d.ts.map +1 -1
  81. package/dist/security/policy.d.ts.map +1 -1
  82. package/dist/security/rate-limit.d.ts +6 -3
  83. package/dist/security/rate-limit.d.ts.map +1 -1
  84. package/dist/security/request.d.ts.map +1 -1
  85. package/dist/security/types.d.ts +72 -3
  86. package/dist/security/types.d.ts.map +1 -1
  87. package/dist/server/index.d.ts +1 -1
  88. package/dist/server/index.d.ts.map +1 -1
  89. package/dist/server/request-handler.d.ts +6 -2
  90. package/dist/server/request-handler.d.ts.map +1 -1
  91. package/dist/static/index.d.ts.map +1 -1
  92. package/dist/static/index.js +4 -4
  93. package/dist/static/index.js.map +1 -1
  94. package/dist/vite/index.d.ts +3 -0
  95. package/dist/vite/index.d.ts.map +1 -1
  96. package/dist/vite/index.js +1030 -666
  97. package/dist/vite/index.js.map +1 -1
  98. package/dist/vite/plugin.d.ts +2 -0
  99. package/dist/vite/plugin.d.ts.map +1 -1
  100. package/dist/vite/policy-verification.d.ts.map +1 -1
  101. package/dist/vite/route-audit.d.ts +50 -0
  102. package/dist/vite/route-audit.d.ts.map +1 -0
  103. package/package.json +1 -1
  104. package/dist/chunks/request-metadata-D5NrT8ks.js.map +0 -1
  105. package/dist/chunks/streaming-BQ1bykDo.js.map +0 -1
  106. package/dist/chunks/testing-B_iMFYz_.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { renderToString as N } from "react-dom/server";
2
- import { createContext as L, useContext as q, useEffect as j, createElement as f } from "react";
3
- const F = {
1
+ import { renderToString as q } from "react-dom/server";
2
+ import { createContext as J, useContext as j, useEffect as G, createElement as f } from "react";
3
+ const W = {
4
4
  backgroundLifetime: !1,
5
5
  crossOriginIsolationHeaders: !1,
6
6
  nonceInjection: !1,
@@ -10,16 +10,16 @@ const F = {
10
10
  webSocket: !1,
11
11
  webTransport: !1
12
12
  };
13
- function _e(e) {
13
+ function Ue(e) {
14
14
  return {
15
15
  capabilities: {
16
- ...F,
16
+ ...W,
17
17
  ...e.capabilities
18
18
  },
19
19
  name: e.name
20
20
  };
21
21
  }
22
- function J(e, t) {
22
+ function H(e, t) {
23
23
  const r = [...new Set(t)], n = r.filter(
24
24
  (o) => !e.capabilities[o]
25
25
  );
@@ -30,21 +30,21 @@ function J(e, t) {
30
30
  required: r
31
31
  };
32
32
  }
33
- function xe(e, t) {
34
- const r = J(e, t);
33
+ function Me(e, t) {
34
+ const r = H(e, t);
35
35
  if (!r.ok)
36
36
  throw new Error(
37
37
  `Adapter "${e.name}" does not support required capabilities: ${r.missing.join(", ")}.`
38
38
  );
39
39
  return r;
40
40
  }
41
- const x = "__demiurge_data", G = "data-demiurge-hydrate", H = "data-demiurge-fallback";
42
- function W(e, t = {}) {
43
- return Y(
41
+ const x = "__demiurge_data", Y = "data-demiurge-hydrate", K = "data-demiurge-fallback";
42
+ function z(e, t = {}) {
43
+ return V(
44
44
  JSON.stringify({ data: e, hasData: !0, ...t })
45
45
  );
46
46
  }
47
- function Oe(e) {
47
+ function Be(e) {
48
48
  const t = e.getElementById(x), r = t?.tagName === "TEMPLATE" ? t.content.textContent : t?.textContent;
49
49
  if (r)
50
50
  try {
@@ -56,61 +56,92 @@ function Oe(e) {
56
56
  );
57
57
  }
58
58
  }
59
- function Y(e) {
59
+ function V(e) {
60
60
  return e.replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
61
61
  }
62
- const O = "text/demiurge-script", p = "data-demiurge-script", y = "data-demiurge-script-src", h = "data-demiurge-script-type", R = "data-demiurge-script-started", z = 2e3, K = [
62
+ const E = "demiurge", k = /* @__PURE__ */ new WeakMap();
63
+ function T(e, t) {
64
+ return Q(e)?.createScriptURL(t) ?? t;
65
+ }
66
+ function Q(e) {
67
+ if (!e)
68
+ return null;
69
+ const t = k.get(e);
70
+ if (t !== void 0)
71
+ return t;
72
+ const r = X(e);
73
+ return k.set(e, r), r;
74
+ }
75
+ function X(e) {
76
+ const t = e.trustedTypes;
77
+ if (!t || typeof t.createPolicy != "function")
78
+ return null;
79
+ try {
80
+ return t.createPolicy(E, {
81
+ // The framework passes only a URL that the server rendered into its own
82
+ // placeholder attribute. `script-src` and `worker-src` still govern that
83
+ // URL, so this policy adds a type without widening the source rules.
84
+ createScriptURL: (r) => r
85
+ });
86
+ } catch (r) {
87
+ return console.error(
88
+ `Demiurge could not create the ${JSON.stringify(E)} Trusted Types policy. Add ${JSON.stringify(E)} to the document trusted-types directive.`,
89
+ r
90
+ ), null;
91
+ }
92
+ }
93
+ const U = "text/demiurge-script", p = "data-demiurge-script", y = "data-demiurge-script-src", h = "data-demiurge-script-type", D = "data-demiurge-script-started", Z = 2e3, ee = [
63
94
  "data-api",
64
95
  "data-demiurge-script-placement",
65
96
  "data-domain",
66
97
  "id",
67
98
  "integrity",
68
99
  "referrerpolicy"
69
- ], P = /* @__PURE__ */ new Map();
70
- function A(e) {
100
+ ], M = /* @__PURE__ */ new Map();
101
+ function R(e) {
71
102
  return e === "idle" || e === "worker";
72
103
  }
73
- function V(e) {
104
+ function te(e) {
74
105
  const t = e ?? (typeof document > "u" ? void 0 : document);
75
106
  if (!t)
76
107
  return;
77
108
  const r = t.querySelectorAll(
78
- `script[${p}]:not([${R}])`
109
+ `script[${p}]:not([${D}])`
79
110
  );
80
111
  for (const n of [...r]) {
81
112
  const o = n.getAttribute(p);
82
113
  if (!(o !== "idle" && o !== "worker")) {
83
- if (n.setAttribute(R, ""), o === "worker") {
84
- Z(n);
114
+ if (n.setAttribute(D, ""), o === "worker") {
115
+ oe(n);
85
116
  continue;
86
117
  }
87
- Q(n, () => X(n));
118
+ re(n, () => ne(n));
88
119
  }
89
120
  }
90
121
  }
91
- function Pe(e) {
92
- return P.get(e);
122
+ function Fe(e) {
123
+ return M.get(e);
93
124
  }
94
- function Q(e, t) {
125
+ function re(e, t) {
95
126
  const r = e.ownerDocument.defaultView;
96
127
  if (r && typeof r.requestIdleCallback == "function") {
97
- r.requestIdleCallback(() => t(), { timeout: z });
128
+ r.requestIdleCallback(() => t(), { timeout: Z });
98
129
  return;
99
130
  }
100
131
  (r ?? globalThis).setTimeout(t, 1);
101
132
  }
102
- function X(e) {
133
+ function ne(e) {
103
134
  const t = e.ownerDocument, r = e.getAttribute(y);
104
135
  if (!r)
105
136
  return;
106
137
  const n = t.createElement("script"), o = e.getAttribute(h);
107
- for (const s of K) {
138
+ for (const s of ee) {
108
139
  const c = e.getAttribute(s);
109
140
  c !== null && n.setAttribute(s, c);
110
141
  }
111
- e.removeAttribute("id"), o && (n.type = o), n.async = !0, n.nonce = e.nonce, n.src = r, t.head.appendChild(n);
142
+ e.removeAttribute("id"), o && (n.type = o), n.async = !0, n.nonce = e.nonce, n.src = T(t.defaultView, r), t.head.appendChild(n);
112
143
  }
113
- function Z(e) {
144
+ function oe(e) {
114
145
  const t = e.getAttribute(y), r = e.ownerDocument.defaultView;
115
146
  if (!t)
116
147
  return;
@@ -122,9 +153,11 @@ function Z(e) {
122
153
  }
123
154
  const n = e.getAttribute(h);
124
155
  try {
125
- P.set(
156
+ M.set(
126
157
  t,
127
- new r.Worker(t, { type: n === "module" ? "module" : "classic" })
158
+ new r.Worker(T(r, t), {
159
+ type: n === "module" ? "module" : "classic"
160
+ })
128
161
  );
129
162
  } catch (o) {
130
163
  console.error(
@@ -133,16 +166,16 @@ function Z(e) {
133
166
  );
134
167
  }
135
168
  }
136
- const ee = /* @__PURE__ */ new Set([
169
+ const ie = /* @__PURE__ */ new Set([
137
170
  "afterInteractive",
138
171
  "beforeInteractive",
139
172
  "idle",
140
173
  "module",
141
174
  "worker"
142
- ]), u = Symbol("demiurge.scriptPlacement"), B = L(
175
+ ]), a = Symbol("demiurge.scriptPlacement"), B = J(
143
176
  void 0
144
177
  );
145
- function te(e = {}) {
178
+ function ce(e = {}) {
146
179
  let t = !1;
147
180
  const r = [...e.scripts ?? []], n = new Set(r.map((c) => c.src)), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
148
181
  return {
@@ -162,7 +195,7 @@ function te(e = {}) {
162
195
  if (o.add(c.src), !t)
163
196
  return s.set(c.src, {
164
197
  ...c,
165
- [u]: "hoisted"
198
+ [a]: "hoisted"
166
199
  }), "hoist";
167
200
  if (c.strategy === "beforeInteractive" && (e.dev ?? !1))
168
201
  throw new Error(
@@ -171,34 +204,34 @@ function te(e = {}) {
171
204
  return "render";
172
205
  },
173
206
  scripts() {
174
- return M([...r, ...s.values()]);
207
+ return F([...r, ...s.values()]);
175
208
  }
176
209
  };
177
210
  }
178
- function Be(e) {
179
- const t = q(B), r = oe(e);
180
- if (j(() => {
181
- A(r.strategy) && V();
211
+ function Le(e) {
212
+ const t = j(B), r = ae(e);
213
+ if (G(() => {
214
+ R(r.strategy) && te();
182
215
  }), !t) {
183
216
  if (typeof document > "u")
184
217
  throw new Error(
185
218
  `The script ${JSON.stringify(r.src)} rendered outside a Demiurge document render context. A server render must wrap its component tree with the script render context.`
186
219
  );
187
- return re(r.src) ? null : v({
220
+ return se(r.src) ? null : v({
188
221
  ...r,
189
- [u]: "in-place"
190
- }, ne());
222
+ [a]: "in-place"
223
+ }, ue());
191
224
  }
192
225
  return t.register(r) !== "render" ? null : v({
193
226
  ...r,
194
- [u]: "in-place"
227
+ [a]: "in-place"
195
228
  }, t.nonce);
196
229
  }
197
230
  function v(e, t) {
198
- return A(e.strategy) ? f("script", {
231
+ return R(e.strategy) ? f("script", {
199
232
  "data-api": e.dataApi,
200
233
  [p]: e.strategy,
201
- "data-demiurge-script-placement": e[u],
234
+ "data-demiurge-script-placement": e[a],
202
235
  [y]: e.src,
203
236
  [h]: e.type,
204
237
  "data-domain": e.dataDomain,
@@ -206,23 +239,23 @@ function v(e, t) {
206
239
  integrity: e.integrity,
207
240
  nonce: e.nonce ?? t,
208
241
  referrerPolicy: e.referrerPolicy,
209
- type: O
242
+ type: U
210
243
  }) : f("script", {
211
244
  async: e.async,
212
245
  crossOrigin: e.crossOrigin,
213
246
  "data-api": e.dataApi,
214
247
  "data-domain": e.dataDomain,
215
- "data-demiurge-script-placement": e[u],
248
+ "data-demiurge-script-placement": e[a],
216
249
  defer: e.defer,
217
250
  id: e.id,
218
251
  integrity: e.integrity,
219
252
  nonce: e.nonce ?? t,
220
253
  referrerPolicy: e.referrerPolicy,
221
254
  src: e.src,
222
- type: e.type ?? ae(e.strategy)
255
+ type: e.type ?? pe(e.strategy)
223
256
  });
224
257
  }
225
- function re(e) {
258
+ function se(e) {
226
259
  if (typeof document > "u")
227
260
  return !1;
228
261
  const t = new URL(e, document.baseURI).href;
@@ -230,16 +263,16 @@ function re(e) {
230
263
  (r) => r.src === t && r.dataset.demiurgeScriptPlacement !== "in-place"
231
264
  );
232
265
  }
233
- function ne() {
266
+ function ue() {
234
267
  if (!(typeof document > "u"))
235
268
  return [...document.scripts].reverse().find((e) => e.nonce)?.nonce;
236
269
  }
237
- function Me(e) {
270
+ function Ne(e) {
238
271
  return e;
239
272
  }
240
- function oe(e) {
273
+ function ae(e) {
241
274
  const t = e.strategy ?? "afterInteractive";
242
- if (!ee.has(t))
275
+ if (!ie.has(t))
243
276
  throw new Error(
244
277
  `Unsupported script strategy ${JSON.stringify(t)}. Demiurge supports "beforeInteractive", "module", "afterInteractive", "idle", and "worker".`
245
278
  );
@@ -257,10 +290,10 @@ function oe(e) {
257
290
  strategy: t
258
291
  };
259
292
  }
260
- function ie(e, t) {
293
+ function de(e, t) {
261
294
  return f(B.Provider, { value: e, children: t });
262
295
  }
263
- async function Te(e, t) {
296
+ async function qe(e, t) {
264
297
  const r = [];
265
298
  for (const n of e) {
266
299
  if (!n)
@@ -268,18 +301,18 @@ async function Te(e, t) {
268
301
  const o = typeof n == "function" ? await n(t) : n;
269
302
  r.push(...o);
270
303
  }
271
- return M(ce(r));
304
+ return F(le(r));
272
305
  }
273
- function ce(e) {
306
+ function le(e) {
274
307
  const t = /* @__PURE__ */ new Map();
275
308
  for (const r of e)
276
- t.set(D(r), {
277
- ...t.get(D(r)),
309
+ t.set(I(r), {
310
+ ...t.get(I(r)),
278
311
  ...r
279
312
  });
280
313
  return [...t.values()];
281
314
  }
282
- function D(e) {
315
+ function I(e) {
283
316
  return [
284
317
  e.src,
285
318
  e.type ?? "",
@@ -287,27 +320,27 @@ function D(e) {
287
320
  e.strategy
288
321
  ].join("\0");
289
322
  }
290
- function se(e, t) {
291
- return k(e.strategy) - k(t.strategy) || e.src.localeCompare(t.src);
323
+ function fe(e, t) {
324
+ return C(e.strategy) - C(t.strategy) || e.src.localeCompare(t.src);
292
325
  }
293
- function M(e) {
294
- return e.sort(se);
326
+ function F(e) {
327
+ return e.sort(fe);
295
328
  }
296
- function ae(e) {
329
+ function pe(e) {
297
330
  return e === "module" ? "module" : void 0;
298
331
  }
299
- function k(e) {
332
+ function C(e) {
300
333
  return e === "beforeInteractive" ? 0 : e === "module" ? 1 : e === "afterInteractive" ? 2 : e === "idle" ? 3 : 4;
301
334
  }
302
- const ue = "data-demiurge-structured-data";
303
- function de(e) {
335
+ const me = "data-demiurge-structured-data";
336
+ function ye(e) {
304
337
  if (e.body) {
305
- const { html: t, ...r } = e.body, { prefix: n, suffix: o } = le({ ...e, body: r });
338
+ const { html: t, ...r } = e.body, { prefix: n, suffix: o } = he({ ...e, body: r });
306
339
  return `${n}${t}${o}`;
307
340
  }
308
- return fe(e);
341
+ return $e(e);
309
342
  }
310
- function le({
343
+ function he({
311
344
  body: e,
312
345
  entrySrc: t,
313
346
  lang: r = "en",
@@ -316,22 +349,22 @@ function le({
316
349
  nonce: s,
317
350
  scripts: c = [],
318
351
  styles: $ = [],
319
- title: w = "Demiurge App"
352
+ title: S = "Demiurge App"
320
353
  }) {
321
- const g = o?.title ?? w, l = [
322
- ...c.filter((S) => S[u] !== "hoisted").map((S) => ` ${E(S, s)}`),
323
- ye(e.data, e.navigation),
324
- ...t ? [T(t, s)] : []
354
+ const w = o?.title ?? S, l = [
355
+ ...c.filter((g) => g[a] !== "hoisted").map((g) => ` ${b(g, s)}`),
356
+ ge(e.data, e.navigation),
357
+ ...t ? [L(t, s)] : []
325
358
  ].join(`
326
359
  `);
327
360
  return {
328
361
  prefix: `<!doctype html>
329
- <html lang="${a(r)}">
362
+ <html lang="${u(r)}">
330
363
  <head>
331
- ${U({ links: n, metadata: o, nonce: s, scripts: c, styles: $, title: g })}
364
+ ${N({ links: n, metadata: o, nonce: s, scripts: c, styles: $, title: w })}
332
365
  </head>
333
366
  <body>
334
- ${me(e)}`,
367
+ ${we(e)}`,
335
368
  suffix: `</div>
336
369
  ${l}
337
370
  </body>
@@ -339,7 +372,7 @@ ${l}
339
372
  `
340
373
  };
341
374
  }
342
- function fe({
375
+ function $e({
343
376
  entrySrc: e,
344
377
  lang: t = "en",
345
378
  links: r = [],
@@ -349,37 +382,37 @@ function fe({
349
382
  styles: c = [],
350
383
  title: $ = "Demiurge App"
351
384
  }) {
352
- const w = n?.title ?? $, g = [
353
- pe(),
354
- ...s.filter((l) => l[u] !== "hoisted").map((l) => ` ${E(l, o)}`),
355
- ...e ? [T(e, o)] : []
385
+ const S = n?.title ?? $, w = [
386
+ Se(),
387
+ ...s.filter((l) => l[a] !== "hoisted").map((l) => ` ${b(l, o)}`),
388
+ ...e ? [L(e, o)] : []
356
389
  ].join(`
357
390
  `);
358
391
  return `<!doctype html>
359
- <html lang="${a(t)}">
392
+ <html lang="${u(t)}">
360
393
  <head>
361
- ${U({ links: r, metadata: n, nonce: o, scripts: s, styles: c, title: w })}
394
+ ${N({ links: r, metadata: n, nonce: o, scripts: s, styles: c, title: S })}
362
395
  </head>
363
396
  <body>
364
- ${g}
397
+ ${w}
365
398
  </body>
366
399
  </html>
367
400
  `;
368
401
  }
369
- function pe(e) {
402
+ function Se(e) {
370
403
  return ' <div id="root"></div>';
371
404
  }
372
- function me(e) {
373
- const t = e.fallback ? ` ${H}="${a(e.fallback)}"` : "";
374
- return ` <div id="root" ${G}=""${t}>`;
405
+ function we(e) {
406
+ const t = e.fallback ? ` ${K}="${u(e.fallback)}"` : "";
407
+ return ` <div id="root" ${Y}=""${t}>`;
375
408
  }
376
- function ye(e, t) {
377
- return ` <template id="${x}">${W(e, { navigation: t })}</template>`;
409
+ function ge(e, t) {
410
+ return ` <template id="${x}">${z(e, { navigation: t })}</template>`;
378
411
  }
379
- function T(e, t) {
380
- return ` <script type="module" src="${a(e)}"${i("nonce", t)}><\/script>`;
412
+ function L(e, t) {
413
+ return ` <script type="module" src="${u(e)}"${i("nonce", t)}><\/script>`;
381
414
  }
382
- function U({
415
+ function N({
383
416
  links: e,
384
417
  metadata: t,
385
418
  nonce: r,
@@ -396,7 +429,7 @@ function U({
396
429
  content: t?.viewport ?? "width=device-width, initial-scale=1.0",
397
430
  name: "viewport"
398
431
  }),
399
- ` <title>${a(s)}</title>`,
432
+ ` <title>${u(s)}</title>`,
400
433
  ...t?.description ? [
401
434
  d({
402
435
  content: t.description,
@@ -404,26 +437,26 @@ function U({
404
437
  })
405
438
  ] : [],
406
439
  ...t?.canonical ? [
407
- b({
440
+ A({
408
441
  href: t.canonical,
409
442
  rel: "canonical"
410
443
  })
411
444
  ] : [],
412
- ...he(t),
413
- ...$e(t),
414
- ...(t?.custom ?? []).map(we),
445
+ ...Ee(t),
446
+ ...Ae(t),
447
+ ...(t?.custom ?? []).map(Re),
415
448
  ...(t?.structuredData ?? []).map(
416
- (c) => ge(c, r)
449
+ (c) => be(c, r)
417
450
  ),
418
451
  ...o.map(
419
- (c) => ` <link rel="stylesheet" href="${a(c)}" />`
452
+ (c) => ` <link rel="stylesheet" href="${u(c)}" />`
420
453
  ),
421
- ...e.map(b),
422
- ...n.filter((c) => c[u] === "hoisted").map((c) => ` ${E(c, r)}`)
454
+ ...e.map(A),
455
+ ...n.filter((c) => c[a] === "hoisted").map((c) => ` ${b(c, r)}`)
423
456
  ].join(`
424
457
  `);
425
458
  }
426
- function he(e) {
459
+ function Ee(e) {
427
460
  if (!e?.robots)
428
461
  return [];
429
462
  const t = [
@@ -437,7 +470,7 @@ function he(e) {
437
470
  })
438
471
  ];
439
472
  }
440
- function $e(e) {
473
+ function Ae(e) {
441
474
  return e?.openGraph ? [
442
475
  e.openGraph.title ? d({
443
476
  content: e.openGraph.title,
@@ -453,46 +486,46 @@ function $e(e) {
453
486
  }) : null
454
487
  ].filter((t) => !!t) : [];
455
488
  }
456
- function we(e) {
457
- return e.kind === "link" ? b(e) : d(e);
489
+ function Re(e) {
490
+ return e.kind === "link" ? A(e) : d(e);
458
491
  }
459
- function ge(e, t) {
460
- return ` <script type="application/ld+json"${t ? "" : ` ${ue}`}${i("nonce", t)}>${Ae(JSON.stringify(e.value))}<\/script>`;
492
+ function be(e, t) {
493
+ return ` <script type="application/ld+json"${t ? "" : ` ${me}`}${i("nonce", t)}>${ve(JSON.stringify(e.value))}<\/script>`;
461
494
  }
462
495
  function d(e) {
463
496
  if (e.name === "charset")
464
- return ` <meta charset="${a(e.content)}" />`;
465
- const t = e.name ? ` name="${a(e.name)}"` : "", r = e.property ? ` property="${a(e.property)}"` : "";
466
- return ` <meta${t}${r} content="${a(e.content)}" />`;
497
+ return ` <meta charset="${u(e.content)}" />`;
498
+ const t = e.name ? ` name="${u(e.name)}"` : "", r = e.property ? ` property="${u(e.property)}"` : "";
499
+ return ` <meta${t}${r} content="${u(e.content)}" />`;
467
500
  }
468
- function b(e) {
501
+ function A(e) {
469
502
  return ` <link${i("rel", e.rel)}${i("href", e.href)}${i("as", e.as)}${i("type", e.type)}${i("crossorigin", e.crossOrigin)}${i("hreflang", e.hrefLang)} />`;
470
503
  }
471
- function E(e, t) {
472
- return A(e.strategy) ? Se(e, t) : `<script${i("id", e.id)}${i("src", e.src)}${i("type", e.type ?? be(e.strategy))}${i("nonce", e.nonce ?? t)}${i("integrity", e.integrity)}${i("crossorigin", e.crossOrigin)}${i("referrerpolicy", e.referrerPolicy)}${i("data-api", e.dataApi)}${i("data-domain", e.dataDomain)}${i("data-demiurge-script-placement", e[u])}${I("async", e.async)}${I("defer", e.defer)}><\/script>`;
504
+ function b(e, t) {
505
+ return R(e.strategy) ? ke(e, t) : `<script${i("id", e.id)}${i("src", e.src)}${i("type", e.type ?? De(e.strategy))}${i("nonce", e.nonce ?? t)}${i("integrity", e.integrity)}${i("crossorigin", e.crossOrigin)}${i("referrerpolicy", e.referrerPolicy)}${i("data-api", e.dataApi)}${i("data-domain", e.dataDomain)}${i("data-demiurge-script-placement", e[a])}${P("async", e.async)}${P("defer", e.defer)}><\/script>`;
473
506
  }
474
- function Se(e, t) {
475
- return `<script${i("id", e.id)}${i("type", O)}${i("nonce", e.nonce ?? t)}${i("integrity", e.integrity)}${i("crossorigin", e.crossOrigin)}${i("referrerpolicy", e.referrerPolicy)}${i("data-api", e.dataApi)}${i("data-domain", e.dataDomain)}${i(p, e.strategy)}${i(y, e.src)}${i(h, e.type)}${i("data-demiurge-script-placement", e[u])}><\/script>`;
507
+ function ke(e, t) {
508
+ return `<script${i("id", e.id)}${i("type", U)}${i("nonce", e.nonce ?? t)}${i("integrity", e.integrity)}${i("crossorigin", e.crossOrigin)}${i("referrerpolicy", e.referrerPolicy)}${i("data-api", e.dataApi)}${i("data-domain", e.dataDomain)}${i(p, e.strategy)}${i(y, e.src)}${i(h, e.type)}${i("data-demiurge-script-placement", e[a])}><\/script>`;
476
509
  }
477
- function be(e) {
510
+ function De(e) {
478
511
  return e === "module" ? "module" : void 0;
479
512
  }
480
513
  function i(e, t) {
481
- return t ? ` ${e}="${a(t)}"` : "";
514
+ return t ? ` ${e}="${u(t)}"` : "";
482
515
  }
483
- function I(e, t) {
516
+ function P(e, t) {
484
517
  return t ? ` ${e}` : "";
485
518
  }
486
- function a(e) {
519
+ function u(e) {
487
520
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
488
521
  }
489
- function Ae(e) {
522
+ function ve(e) {
490
523
  return e.replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
491
524
  }
492
- function Ue(e) {
525
+ function Je(e) {
493
526
  return e;
494
527
  }
495
- function Ne(e, t = {}) {
528
+ function je(e, t = {}) {
496
529
  return {
497
530
  ...t,
498
531
  href: e,
@@ -500,7 +533,7 @@ function Ne(e, t = {}) {
500
533
  rel: "preconnect"
501
534
  };
502
535
  }
503
- function Le(e, t) {
536
+ function Ge(e, t) {
504
537
  return {
505
538
  ...t,
506
539
  href: e,
@@ -508,14 +541,14 @@ function Le(e, t) {
508
541
  rel: "preload"
509
542
  };
510
543
  }
511
- function qe(e) {
544
+ function We(e) {
512
545
  return {
513
546
  href: e,
514
547
  kind: "link",
515
548
  rel: "modulepreload"
516
549
  };
517
550
  }
518
- async function je(e, t) {
551
+ async function He(e, t) {
519
552
  const r = [];
520
553
  for (const n of e) {
521
554
  if (!n)
@@ -523,18 +556,18 @@ async function je(e, t) {
523
556
  const o = typeof n == "function" ? await n(t) : n;
524
557
  r.push(...o);
525
558
  }
526
- return Ee(r).sort(Re);
559
+ return Ie(r).sort(Ce);
527
560
  }
528
- function Ee(e) {
561
+ function Ie(e) {
529
562
  const t = /* @__PURE__ */ new Map();
530
563
  for (const r of e)
531
- t.set(C(r), {
532
- ...t.get(C(r)),
564
+ t.set(_(r), {
565
+ ...t.get(_(r)),
533
566
  ...r
534
567
  });
535
568
  return [...t.values()];
536
569
  }
537
- function C(e) {
570
+ function _(e) {
538
571
  return [
539
572
  e.rel,
540
573
  e.href,
@@ -543,13 +576,13 @@ function C(e) {
543
576
  e.crossOrigin ?? ""
544
577
  ].join("\0");
545
578
  }
546
- function Re(e, t) {
547
- return _(e.rel) - _(t.rel) || e.href.localeCompare(t.href);
579
+ function Ce(e, t) {
580
+ return O(e.rel) - O(t.rel) || e.href.localeCompare(t.href);
548
581
  }
549
- function _(e) {
582
+ function O(e) {
550
583
  return e === "preconnect" ? 0 : e === "preload" ? 1 : e === "modulepreload" ? 2 : 3;
551
584
  }
552
- function ve(e, t) {
585
+ function Pe(e, t) {
553
586
  const r = f(e.page, {
554
587
  data: e.data,
555
588
  path: e.path,
@@ -562,18 +595,18 @@ function ve(e, t) {
562
595
  }),
563
596
  r
564
597
  );
565
- return t ? ie(t, n) : n;
598
+ return t ? de(t, n) : n;
566
599
  }
567
- function De(e, t = {}) {
568
- return te({
600
+ function _e(e, t = {}) {
601
+ return ce({
569
602
  dev: t.dev,
570
603
  nonce: t.nonce,
571
604
  scripts: e.scripts
572
605
  });
573
606
  }
574
- function ke(e, t = {}) {
575
- const r = De(e, t), n = N(ve(e, r));
576
- return de({
607
+ function Oe(e, t = {}) {
608
+ const r = _e(e, t), n = q(Pe(e, r));
609
+ return ye({
577
610
  body: {
578
611
  data: e.data,
579
612
  html: n,
@@ -589,8 +622,8 @@ function ke(e, t = {}) {
589
622
  title: t.title
590
623
  });
591
624
  }
592
- function Fe(e, t = {}) {
593
- const r = ke(e, t);
625
+ function Ye(e, t = {}) {
626
+ const r = Oe(e, t);
594
627
  return new Response(r, {
595
628
  headers: {
596
629
  "content-type": "text/html; charset=utf-8"
@@ -598,45 +631,47 @@ function Fe(e, t = {}) {
598
631
  });
599
632
  }
600
633
  const m = /* @__PURE__ */ new WeakMap();
601
- function Je(e) {
634
+ function Ke(e) {
602
635
  return m.get(e);
603
636
  }
604
- function Ge(e, t) {
637
+ function ze(e, t) {
605
638
  m.set(e, t);
606
639
  }
607
- function He(e, t) {
640
+ function Ve(e, t) {
608
641
  const r = m.get(e);
609
642
  r && m.set(t, r);
610
643
  }
611
644
  export {
612
- He as A,
613
- G as H,
614
- ue as S,
615
- Fe as a,
616
- ve as b,
617
- De as c,
618
- _e as d,
619
- de as e,
620
- ke as f,
621
- Oe as g,
622
- V as h,
623
- H as i,
624
- oe as j,
625
- Be as k,
626
- xe as l,
627
- J as m,
628
- Ue as n,
629
- Me as o,
630
- Le as p,
631
- Pe as q,
632
- le as r,
633
- Ge as s,
634
- qe as t,
635
- Ne as u,
645
+ Ke as A,
646
+ Ve as B,
647
+ E as F,
648
+ Y as H,
649
+ me as S,
650
+ Ye as a,
651
+ Pe as b,
652
+ _e as c,
653
+ Ue as d,
654
+ ye as e,
655
+ Oe as f,
656
+ Be as g,
657
+ te as h,
658
+ K as i,
659
+ ae as j,
660
+ Le as k,
661
+ Me as l,
662
+ H as m,
663
+ T as n,
664
+ Je as o,
665
+ Ge as p,
666
+ Ne as q,
667
+ he as r,
668
+ ze as s,
669
+ Fe as t,
670
+ We as u,
636
671
  je as v,
637
- Te as w,
638
- te as x,
639
- ie as y,
640
- Je as z
672
+ He as w,
673
+ qe as x,
674
+ ce as y,
675
+ de as z
641
676
  };
642
- //# sourceMappingURL=request-metadata-D5NrT8ks.js.map
677
+ //# sourceMappingURL=request-metadata-DaIYq4Ea.js.map