@demiurgejs/core 0.1.0 → 0.1.1
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.
- package/dist/browser/file-router.d.ts +5 -0
- package/dist/browser/file-router.d.ts.map +1 -1
- package/dist/chunks/{ssr-O3d7Q73U.js → ssr-BJejKlkZ.js} +57 -55
- package/dist/chunks/ssr-BJejKlkZ.js.map +1 -0
- package/dist/chunks/static-files-DUjHw-4H.js +11 -0
- package/dist/chunks/static-files-DUjHw-4H.js.map +1 -0
- package/dist/chunks/{streaming-27pwhjGC.js → streaming-DN1DnbRE.js} +2 -2
- package/dist/chunks/{streaming-27pwhjGC.js.map → streaming-DN1DnbRE.js.map} +1 -1
- package/dist/chunks/{testing-BBnJ5WUR.js → testing-DR3eQAvY.js} +127 -126
- package/dist/chunks/testing-DR3eQAvY.js.map +1 -0
- package/dist/document/render.d.ts +1 -0
- package/dist/document/render.d.ts.map +1 -1
- package/dist/index.js +284 -274
- package/dist/index.js.map +1 -1
- package/dist/internal/testing.js +1 -1
- package/dist/node/index.js +86 -85
- package/dist/node/index.js.map +1 -1
- package/dist/node/static.d.ts.map +1 -1
- package/dist/router/manifest.d.ts +3 -1
- package/dist/router/manifest.d.ts.map +1 -1
- package/dist/static/index.d.ts +5 -0
- package/dist/static/index.d.ts.map +1 -1
- package/dist/static/index.js +245 -124
- package/dist/static/index.js.map +1 -1
- package/dist/static-files.d.ts +5 -0
- package/dist/static-files.d.ts.map +1 -0
- package/dist/vite/index.js +445 -279
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/chunks/ssr-O3d7Q73U.js.map +0 -1
- package/dist/chunks/testing-BBnJ5WUR.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as H } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as W, useState as I, useRef as k, useEffect as C, useMemo as _, createElement as f, useContext as V, Component as G } from "react";
|
|
3
|
-
import { e as K, H as Y, f as Z } from "./chunks/ssr-
|
|
4
|
-
import { r as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { a as
|
|
3
|
+
import { e as K, H as Y, f as Z } from "./chunks/ssr-BJejKlkZ.js";
|
|
4
|
+
import { r as pr } from "./chunks/ssr-BJejKlkZ.js";
|
|
5
|
+
import { g as Q, t as X, p as D, s as J, i as ee, c as P, l as te, j as L, k as re, N as z, m as ne, n as ae, o as ie, q as oe, H as se, u as ce, B as ue, v as le, w as fe, x as de, y as he, z as me, R as pe, A } from "./chunks/testing-DR3eQAvY.js";
|
|
6
|
+
import { C as wr, D as yr, E as vr, F as br, G as Sr, I as Er, J as Rr, K as $r, b as xr, L as Ar, d as Tr, M as Ir, O as kr, P as Cr, Q as Dr, S as zr, T as Or, U as Pr, V as Lr, W as Nr, X as Ur, h as Mr, Y as Fr, Z as jr, _ as qr, $ as Br, a0 as Hr, a1 as Wr, a2 as _r, a3 as Vr, a4 as Gr, a5 as Kr, a6 as Yr, a7 as Zr, a8 as Qr, a9 as Xr, aa as Jr, ab as en, ac as tn, ad as rn, ae as nn, af as an, ag as on, ah as sn, ai as cn, aj as un, ak as ln, al as fn, am as dn, an as hn, ao as mn, ap as pn } from "./chunks/testing-DR3eQAvY.js";
|
|
7
|
+
import { a as wn, c as yn, d as vn } from "./chunks/index-BnX9Qxbm.js";
|
|
8
8
|
import "react-dom/server";
|
|
9
|
-
function
|
|
9
|
+
function Ut(e) {
|
|
10
10
|
return {
|
|
11
11
|
entries: e
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Mt(e) {
|
|
15
15
|
return [
|
|
16
16
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
17
17
|
`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.entries.some((r) => r.alternates?.length) ? ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' : ""}>`,
|
|
@@ -21,13 +21,13 @@ function Ut(e) {
|
|
|
21
21
|
].join(`
|
|
22
22
|
`);
|
|
23
23
|
}
|
|
24
|
-
function Mt(e) {
|
|
25
|
-
return e;
|
|
26
|
-
}
|
|
27
24
|
function Ft(e) {
|
|
28
25
|
return e;
|
|
29
26
|
}
|
|
30
27
|
function jt(e) {
|
|
28
|
+
return e;
|
|
29
|
+
}
|
|
30
|
+
function qt(e) {
|
|
31
31
|
const t = [];
|
|
32
32
|
for (const r of e.rules ?? []) {
|
|
33
33
|
for (const n of b(r.userAgent))
|
|
@@ -46,18 +46,18 @@ function jt(e) {
|
|
|
46
46
|
`;
|
|
47
47
|
}
|
|
48
48
|
function ge(e) {
|
|
49
|
-
const t = e.width ?? 1200, r = e.height ?? 630, n = e.background ?? "#101820", a = e.foreground ?? "#ffffff", i = $(e.title, 120),
|
|
49
|
+
const t = e.width ?? 1200, r = e.height ?? 630, n = e.background ?? "#101820", a = e.foreground ?? "#ffffff", i = $(e.title, 120), s = e.subtitle ? $(e.subtitle, 160) : void 0, o = e.brand ? $(e.brand, 80) : void 0;
|
|
50
50
|
return be(t, r), [
|
|
51
51
|
`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" role="img" aria-label="${p(i)}">`,
|
|
52
52
|
` <rect width="100%" height="100%" fill="${p(n)}" />`,
|
|
53
|
-
|
|
54
|
-
` <text x="72" y="${
|
|
55
|
-
|
|
53
|
+
o ? ` <text x="72" y="96" fill="${p(a)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="32" font-weight="700">${w(o)}</text>` : null,
|
|
54
|
+
` <text x="72" y="${s ? 300 : 340}" fill="${p(a)}" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="76" font-weight="800">${w(i)}</text>`,
|
|
55
|
+
s ? ` <text x="72" y="392" fill="${p(a)}" fill-opacity="0.78" font-family="Inter, ui-sans-serif, system-ui, sans-serif" font-size="38" font-weight="500">${w(s)}</text>` : null,
|
|
56
56
|
"</svg>"
|
|
57
57
|
].filter((u) => !!u).join(`
|
|
58
58
|
`);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Bt(e) {
|
|
61
61
|
return new Response(ge(e), {
|
|
62
62
|
headers: {
|
|
63
63
|
"cache-control": "public, max-age=31536000, immutable",
|
|
@@ -105,7 +105,7 @@ function be(e, t) {
|
|
|
105
105
|
if (!Number.isSafeInteger(t) || t <= 0)
|
|
106
106
|
throw new Error("OG image height must be a positive integer.");
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Ht(e) {
|
|
109
109
|
return Q(
|
|
110
110
|
async (t) => {
|
|
111
111
|
const r = e.input ? await e.input(t) : void 0, n = {
|
|
@@ -131,7 +131,7 @@ function Bt(e) {
|
|
|
131
131
|
}
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
|
-
const
|
|
134
|
+
const Wt = {
|
|
135
135
|
async formData({ request: e }) {
|
|
136
136
|
return await e.formData();
|
|
137
137
|
},
|
|
@@ -145,7 +145,7 @@ const Ht = {
|
|
|
145
145
|
async function Se(e, t) {
|
|
146
146
|
return e instanceof Response ? e : await X(e, t);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function _t(e) {
|
|
149
149
|
return typeof e == "function" ? {
|
|
150
150
|
kind: "page",
|
|
151
151
|
render: { mode: "ssr" },
|
|
@@ -158,7 +158,7 @@ function Wt(e) {
|
|
|
158
158
|
view: e.view
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
const
|
|
161
|
+
const Vt = {
|
|
162
162
|
hmac(e) {
|
|
163
163
|
return {
|
|
164
164
|
kind: "response",
|
|
@@ -187,10 +187,10 @@ async function Ee(e, t, r) {
|
|
|
187
187
|
t,
|
|
188
188
|
n,
|
|
189
189
|
r.prefix
|
|
190
|
-
),
|
|
191
|
-
if (!
|
|
190
|
+
), s = $e(i, a);
|
|
191
|
+
if (!s)
|
|
192
192
|
return !1;
|
|
193
|
-
const
|
|
193
|
+
const o = await globalThis.crypto.subtle.importKey(
|
|
194
194
|
"raw",
|
|
195
195
|
new TextEncoder().encode(r.secret),
|
|
196
196
|
{
|
|
@@ -202,8 +202,8 @@ async function Ee(e, t, r) {
|
|
|
202
202
|
);
|
|
203
203
|
return await globalThis.crypto.subtle.verify(
|
|
204
204
|
"HMAC",
|
|
205
|
-
s,
|
|
206
205
|
o,
|
|
206
|
+
s,
|
|
207
207
|
Uint8Array.from(e).buffer
|
|
208
208
|
);
|
|
209
209
|
}
|
|
@@ -229,7 +229,7 @@ function $e(e, t) {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
const xe = "24h", Ae = 1e4;
|
|
232
|
-
function
|
|
232
|
+
function Gt(e = {}) {
|
|
233
233
|
const t = e.now ?? Date.now, r = e.defaultTtl ?? xe, n = e.maximumEntries ?? Ae;
|
|
234
234
|
if (!Number.isSafeInteger(n) || n <= 0)
|
|
235
235
|
throw new Error(
|
|
@@ -240,13 +240,13 @@ function Vt(e = {}) {
|
|
|
240
240
|
throw new Error("Demiurge idempotency defaultTtl must be finite.");
|
|
241
241
|
const i = /* @__PURE__ */ new Map();
|
|
242
242
|
return {
|
|
243
|
-
async run(
|
|
244
|
-
const
|
|
243
|
+
async run(s) {
|
|
244
|
+
const o = J(s.key), u = t();
|
|
245
245
|
Te(i, u);
|
|
246
|
-
const d = i.get(
|
|
246
|
+
const d = i.get(o);
|
|
247
247
|
if (d && (d.pending || d.expiresAt > u))
|
|
248
248
|
return {
|
|
249
|
-
key:
|
|
249
|
+
key: o,
|
|
250
250
|
replayed: !0,
|
|
251
251
|
value: await d.value
|
|
252
252
|
};
|
|
@@ -254,21 +254,21 @@ function Vt(e = {}) {
|
|
|
254
254
|
throw new Error(
|
|
255
255
|
"Demiurge idempotency store is at capacity with in-flight mutations."
|
|
256
256
|
);
|
|
257
|
-
const g = Promise.resolve().then(
|
|
257
|
+
const g = Promise.resolve().then(s.fn), c = {
|
|
258
258
|
expiresAt: Number.POSITIVE_INFINITY,
|
|
259
259
|
pending: !0,
|
|
260
260
|
value: g
|
|
261
261
|
};
|
|
262
|
-
i.set(
|
|
262
|
+
i.set(o, c);
|
|
263
263
|
try {
|
|
264
264
|
const l = await g;
|
|
265
|
-
return c.pending = !1, c.expiresAt = t() + D(
|
|
266
|
-
key:
|
|
265
|
+
return c.pending = !1, c.expiresAt = t() + D(s.ttl ?? r), {
|
|
266
|
+
key: o,
|
|
267
267
|
replayed: !1,
|
|
268
268
|
value: l
|
|
269
269
|
};
|
|
270
270
|
} catch (l) {
|
|
271
|
-
throw i.get(
|
|
271
|
+
throw i.get(o) === c && i.delete(o), l;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
};
|
|
@@ -284,13 +284,13 @@ function Ie(e) {
|
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function Kt(e, t) {
|
|
288
288
|
return e.run(t);
|
|
289
289
|
}
|
|
290
290
|
function ke(e) {
|
|
291
|
-
const t =
|
|
291
|
+
const t = P(e.routes), r = e.loadNavigationData ?? U;
|
|
292
292
|
return function() {
|
|
293
|
-
const [a, i] = I(() => S()), [
|
|
293
|
+
const [a, i] = I(() => S()), [s, o] = I(
|
|
294
294
|
() => e.initialMatch ?? { status: "loading" }
|
|
295
295
|
), u = k(!!e.initialMatch), d = k(0);
|
|
296
296
|
C(() => {
|
|
@@ -305,13 +305,13 @@ function ke(e) {
|
|
|
305
305
|
return u.current = !1, () => {
|
|
306
306
|
c = !0;
|
|
307
307
|
};
|
|
308
|
-
|
|
309
|
-
v() && !l && m &&
|
|
308
|
+
o({ status: "loading" }), te(t, a.pathname).then((m) => {
|
|
309
|
+
v() && !l && m && o({ loading: m, status: "loading" });
|
|
310
310
|
}).catch(() => {
|
|
311
311
|
});
|
|
312
312
|
const T = new Request(a.href, { signal: R.signal });
|
|
313
313
|
return Promise.resolve(r(T)).then(
|
|
314
|
-
(m) =>
|
|
314
|
+
(m) => L(
|
|
315
315
|
t,
|
|
316
316
|
a.pathname,
|
|
317
317
|
T,
|
|
@@ -320,7 +320,7 @@ function ke(e) {
|
|
|
320
320
|
{ documentContributions: !1 }
|
|
321
321
|
)
|
|
322
322
|
).then((m) => {
|
|
323
|
-
l = !0, v() &&
|
|
323
|
+
l = !0, v() && o(m);
|
|
324
324
|
}).catch(async (m) => {
|
|
325
325
|
if (l = !0, !v() || R.signal.aborted)
|
|
326
326
|
return;
|
|
@@ -328,7 +328,7 @@ function ke(e) {
|
|
|
328
328
|
t,
|
|
329
329
|
a.pathname
|
|
330
330
|
);
|
|
331
|
-
v() &&
|
|
331
|
+
v() && o({
|
|
332
332
|
Error: B,
|
|
333
333
|
error: m,
|
|
334
334
|
pathname: a.pathname,
|
|
@@ -345,18 +345,18 @@ function ke(e) {
|
|
|
345
345
|
const l = S();
|
|
346
346
|
window.history.pushState(null, "", c);
|
|
347
347
|
const h = S();
|
|
348
|
-
i(h), l.pathname === h.pathname && l.search === h.search && l.hash !== h.hash &&
|
|
348
|
+
i(h), l.pathname === h.pathname && l.search === h.search && l.hash !== h.hash && Ne(h.hash);
|
|
349
349
|
}
|
|
350
350
|
}),
|
|
351
351
|
[]
|
|
352
352
|
);
|
|
353
353
|
return f(M.Provider, {
|
|
354
354
|
value: g,
|
|
355
|
-
children: f(
|
|
355
|
+
children: f(Oe, {
|
|
356
356
|
key: `${a.pathname}${a.search}`,
|
|
357
357
|
Loading: e.loading,
|
|
358
358
|
NotFound: e.notFound,
|
|
359
|
-
match:
|
|
359
|
+
match: s
|
|
360
360
|
})
|
|
361
361
|
});
|
|
362
362
|
};
|
|
@@ -369,21 +369,21 @@ function De(e) {
|
|
|
369
369
|
if (e)
|
|
370
370
|
return e.status === "ready" ? e.match.pathname : e.status === "loading" ? void 0 : e.pathname;
|
|
371
371
|
}
|
|
372
|
-
async function
|
|
372
|
+
async function Yt(e) {
|
|
373
373
|
const t = e.root ?? document.getElementById("root");
|
|
374
374
|
if (!t)
|
|
375
375
|
throw new Error(
|
|
376
376
|
"Demiurge expected a #root element in the framework document."
|
|
377
377
|
);
|
|
378
|
-
const r =
|
|
378
|
+
const r = P(e.routes), n = e.loadNavigationData ?? U, a = e.initialData ?? K(document), i = await L(
|
|
379
379
|
r,
|
|
380
380
|
window.location.pathname,
|
|
381
381
|
new Request(window.location.href),
|
|
382
382
|
a ?? await n(new Request(window.location.href)),
|
|
383
383
|
void 0,
|
|
384
384
|
{ documentContributions: !1 }
|
|
385
|
-
),
|
|
386
|
-
|
|
385
|
+
), s = Ce(i, t), o = ke(
|
|
386
|
+
s ? {
|
|
387
387
|
...e,
|
|
388
388
|
initialMatch: i,
|
|
389
389
|
loadNavigationData: n,
|
|
@@ -393,28 +393,38 @@ async function Kt(e) {
|
|
|
393
393
|
loadNavigationData: n,
|
|
394
394
|
navigation: a?.navigation ?? e.navigation
|
|
395
395
|
}
|
|
396
|
-
), { createRoot: u, hydrateRoot: d } =
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
), { createRoot: u, hydrateRoot: d } = ze(
|
|
397
|
+
await import("react-dom/client")
|
|
398
|
+
);
|
|
399
|
+
if (s && t.hasAttribute(Y)) {
|
|
400
|
+
d(t, f(o));
|
|
399
401
|
return;
|
|
400
402
|
}
|
|
401
|
-
t.replaceChildren(), u(t).render(f(
|
|
403
|
+
t.replaceChildren(), u(t).render(f(o));
|
|
402
404
|
}
|
|
403
|
-
function
|
|
404
|
-
const t =
|
|
405
|
+
function ze(e) {
|
|
406
|
+
const t = typeof e.createRoot == "function" && typeof e.hydrateRoot == "function" ? e : e.default;
|
|
407
|
+
if (!t || typeof t.createRoot != "function" || typeof t.hydrateRoot != "function")
|
|
408
|
+
throw new Error(
|
|
409
|
+
"Demiurge could not load the React DOM client from the Vite module."
|
|
410
|
+
);
|
|
411
|
+
return t;
|
|
412
|
+
}
|
|
413
|
+
function Zt(e) {
|
|
414
|
+
const t = Me(), r = ee(e);
|
|
405
415
|
return /* @__PURE__ */ H(
|
|
406
416
|
"a",
|
|
407
417
|
{
|
|
408
418
|
className: e.className,
|
|
409
419
|
href: r,
|
|
410
420
|
onClick: (n) => {
|
|
411
|
-
t.navigation === "server" &&
|
|
421
|
+
t.navigation === "server" && Ue(n) && (n.preventDefault(), t.push(r));
|
|
412
422
|
},
|
|
413
423
|
children: e.children
|
|
414
424
|
}
|
|
415
425
|
);
|
|
416
426
|
}
|
|
417
|
-
function
|
|
427
|
+
function Oe({
|
|
418
428
|
Loading: e,
|
|
419
429
|
NotFound: t,
|
|
420
430
|
match: r
|
|
@@ -440,8 +450,8 @@ function ze({
|
|
|
440
450
|
pathname: r.pathname,
|
|
441
451
|
status: N(r.error)
|
|
442
452
|
}) : null;
|
|
443
|
-
const { data: n, error: a, page: i, layouts:
|
|
444
|
-
(c, l) => f(l, { path:
|
|
453
|
+
const { data: n, error: a, page: i, layouts: s, path: o, pathname: u } = r.match, d = f(i, { data: n, path: o, pathname: u }), g = s.reduceRight(
|
|
454
|
+
(c, l) => f(l, { path: o, pathname: u, children: c }),
|
|
445
455
|
d
|
|
446
456
|
);
|
|
447
457
|
return f(Pe, {
|
|
@@ -492,8 +502,8 @@ async function U(e) {
|
|
|
492
502
|
}
|
|
493
503
|
if (n === ie)
|
|
494
504
|
return { hasData: !0 };
|
|
495
|
-
if (n ===
|
|
496
|
-
const a = await Le(r), i =
|
|
505
|
+
if (n === oe || !r.ok) {
|
|
506
|
+
const a = await Le(r), i = se.includes(
|
|
497
507
|
r.status
|
|
498
508
|
) ? r.status : 500;
|
|
499
509
|
throw ce(i, {
|
|
@@ -512,7 +522,7 @@ async function Le(e) {
|
|
|
512
522
|
return;
|
|
513
523
|
}
|
|
514
524
|
}
|
|
515
|
-
function
|
|
525
|
+
function Ne(e) {
|
|
516
526
|
queueMicrotask(() => {
|
|
517
527
|
if (!e) {
|
|
518
528
|
window.scrollTo?.(0, 0);
|
|
@@ -527,7 +537,7 @@ function Oe(e) {
|
|
|
527
537
|
document.getElementById(t)?.scrollIntoView?.();
|
|
528
538
|
});
|
|
529
539
|
}
|
|
530
|
-
function
|
|
540
|
+
function Ue(e) {
|
|
531
541
|
return e.button === 0 && !e.metaKey && !e.altKey && !e.ctrlKey && !e.shiftKey;
|
|
532
542
|
}
|
|
533
543
|
const M = W({
|
|
@@ -536,36 +546,36 @@ const M = W({
|
|
|
536
546
|
window.location.href = e;
|
|
537
547
|
}
|
|
538
548
|
});
|
|
539
|
-
function
|
|
549
|
+
function Me() {
|
|
540
550
|
return V(M);
|
|
541
551
|
}
|
|
542
|
-
const
|
|
543
|
-
function
|
|
552
|
+
const Fe = "/_demiurge/image";
|
|
553
|
+
function Qt(e) {
|
|
544
554
|
return e;
|
|
545
555
|
}
|
|
546
|
-
function
|
|
556
|
+
function Xt(e, t = {}) {
|
|
547
557
|
return F(e, t) !== null;
|
|
548
558
|
}
|
|
549
|
-
function
|
|
559
|
+
function Jt(e, t = {}) {
|
|
550
560
|
const r = F(e.src, t);
|
|
551
561
|
if (!r)
|
|
552
562
|
throw new Error(`Image source "${e.src}" is not allowed by the image policy.`);
|
|
553
|
-
x("width", e.width), x("height", e.height),
|
|
554
|
-
const n = e.format ?? "auto", i =
|
|
555
|
-
const u = Math.round(e.height / e.width *
|
|
563
|
+
x("width", e.width), x("height", e.height), We(e.quality);
|
|
564
|
+
const n = e.format ?? "auto", i = _e(e.width, e.widths).map((o) => {
|
|
565
|
+
const u = Math.round(e.height / e.width * o);
|
|
556
566
|
return {
|
|
557
567
|
format: n,
|
|
558
568
|
height: u,
|
|
559
|
-
src:
|
|
569
|
+
src: Ve({
|
|
560
570
|
format: n,
|
|
561
|
-
optimizerPath: t.optimizerPath ??
|
|
571
|
+
optimizerPath: t.optimizerPath ?? Fe,
|
|
562
572
|
quality: e.quality,
|
|
563
573
|
src: e.src,
|
|
564
|
-
width:
|
|
574
|
+
width: o
|
|
565
575
|
}),
|
|
566
|
-
width:
|
|
576
|
+
width: o
|
|
567
577
|
};
|
|
568
|
-
}),
|
|
578
|
+
}), s = i[0];
|
|
569
579
|
return {
|
|
570
580
|
alt: e.alt,
|
|
571
581
|
decoding: "async",
|
|
@@ -574,8 +584,8 @@ function Xt(e, t = {}) {
|
|
|
574
584
|
loading: e.priority ? "eager" : "lazy",
|
|
575
585
|
sizes: e.sizes,
|
|
576
586
|
source: r,
|
|
577
|
-
src:
|
|
578
|
-
srcSet: i.map((
|
|
587
|
+
src: s.src,
|
|
588
|
+
srcSet: i.map((o) => `${o.src} ${o.width}w`).join(", "),
|
|
579
589
|
variants: i,
|
|
580
590
|
width: e.width
|
|
581
591
|
};
|
|
@@ -589,41 +599,41 @@ function F(e, t) {
|
|
|
589
599
|
} catch {
|
|
590
600
|
return null;
|
|
591
601
|
}
|
|
592
|
-
return r.protocol !== "https:" && r.protocol !== "http:" ? null :
|
|
602
|
+
return r.protocol !== "https:" && r.protocol !== "http:" ? null : je(r, t.remote ?? []) ? { kind: "remote", src: r.toString() } : null;
|
|
593
603
|
}
|
|
594
|
-
function
|
|
604
|
+
function je(e, t) {
|
|
595
605
|
return t.some(
|
|
596
|
-
(r) => typeof r == "string" ?
|
|
606
|
+
(r) => typeof r == "string" ? qe(e, r) : Be(e, r)
|
|
597
607
|
);
|
|
598
608
|
}
|
|
599
|
-
function
|
|
609
|
+
function qe(e, t) {
|
|
600
610
|
try {
|
|
601
611
|
return e.origin === new URL(t).origin;
|
|
602
612
|
} catch {
|
|
603
613
|
return !1;
|
|
604
614
|
}
|
|
605
615
|
}
|
|
606
|
-
function qe(e, t) {
|
|
607
|
-
return t.protocol && e.protocol !== t.protocol || e.hostname !== t.hostname || t.port !== void 0 && e.port !== t.port ? !1 : t.pathname ? Be(e.pathname, t.pathname) : !0;
|
|
608
|
-
}
|
|
609
616
|
function Be(e, t) {
|
|
617
|
+
return t.protocol && e.protocol !== t.protocol || e.hostname !== t.hostname || t.port !== void 0 && e.port !== t.port ? !1 : t.pathname ? He(e.pathname, t.pathname) : !0;
|
|
618
|
+
}
|
|
619
|
+
function He(e, t) {
|
|
610
620
|
return t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : e === t;
|
|
611
621
|
}
|
|
612
622
|
function x(e, t) {
|
|
613
623
|
if (!Number.isInteger(t) || t <= 0)
|
|
614
624
|
throw new Error(`Image ${e} must be a positive integer.`);
|
|
615
625
|
}
|
|
616
|
-
function
|
|
626
|
+
function We(e) {
|
|
617
627
|
if (e !== void 0 && (!Number.isInteger(e) || e < 1 || e > 100))
|
|
618
628
|
throw new Error("Image quality must be an integer between 1 and 100.");
|
|
619
629
|
}
|
|
620
|
-
function
|
|
630
|
+
function _e(e, t) {
|
|
621
631
|
const r = t ?? [e, e * 2], n = [...new Set(r)];
|
|
622
632
|
for (const a of n)
|
|
623
633
|
x("width", a);
|
|
624
634
|
return n.sort((a, i) => a - i);
|
|
625
635
|
}
|
|
626
|
-
function
|
|
636
|
+
function Ve({
|
|
627
637
|
format: e,
|
|
628
638
|
optimizerPath: t,
|
|
629
639
|
quality: r,
|
|
@@ -636,7 +646,7 @@ function _e({
|
|
|
636
646
|
});
|
|
637
647
|
return r !== void 0 && i.set("q", String(r)), e !== "auto" && i.set("f", e), `${t}?${i.toString()}`;
|
|
638
648
|
}
|
|
639
|
-
const
|
|
649
|
+
const er = {
|
|
640
650
|
google(e) {
|
|
641
651
|
return {
|
|
642
652
|
display: e.display ?? "swap",
|
|
@@ -662,26 +672,26 @@ const Jt = {
|
|
|
662
672
|
};
|
|
663
673
|
}
|
|
664
674
|
};
|
|
665
|
-
function
|
|
675
|
+
function tr(e) {
|
|
666
676
|
return [...e];
|
|
667
677
|
}
|
|
668
|
-
function
|
|
678
|
+
function rr(e) {
|
|
669
679
|
return e.filter((t) => t.src).map((t) => ({
|
|
670
680
|
as: "font",
|
|
671
681
|
crossOrigin: "anonymous",
|
|
672
682
|
href: t.src,
|
|
673
683
|
kind: "link",
|
|
674
684
|
rel: "preload",
|
|
675
|
-
type:
|
|
685
|
+
type: Ge(t.src)
|
|
676
686
|
}));
|
|
677
687
|
}
|
|
678
|
-
function
|
|
688
|
+
function nr(e) {
|
|
679
689
|
return e.filter((t) => t.source === "local" && t.src).map((t) => {
|
|
680
690
|
const r = t.src;
|
|
681
691
|
return [
|
|
682
692
|
"@font-face {",
|
|
683
|
-
` font-family: "${
|
|
684
|
-
` src: url("${
|
|
693
|
+
` font-family: "${O(t.family)}";`,
|
|
694
|
+
` src: url("${O(r)}") format("${Ke(r)}");`,
|
|
685
695
|
` font-style: ${t.style};`,
|
|
686
696
|
` font-weight: ${t.weight};`,
|
|
687
697
|
` font-display: ${t.display};`,
|
|
@@ -691,18 +701,18 @@ function rr(e) {
|
|
|
691
701
|
}).join(`
|
|
692
702
|
`);
|
|
693
703
|
}
|
|
694
|
-
function
|
|
704
|
+
function Ge(e) {
|
|
695
705
|
return e.split("?")[0].split("#")[0].split(".").pop()?.toLowerCase() === "woff" ? "font/woff" : "font/woff2";
|
|
696
706
|
}
|
|
697
|
-
function
|
|
707
|
+
function Ke(e) {
|
|
698
708
|
return e.split("?")[0].split("#")[0].split(".").pop()?.toLowerCase() === "woff" ? "woff" : "woff2";
|
|
699
709
|
}
|
|
700
|
-
function
|
|
710
|
+
function O(e) {
|
|
701
711
|
return e.replace(/[\\"]/g, "\\$&");
|
|
702
712
|
}
|
|
703
|
-
const
|
|
713
|
+
const ar = {
|
|
704
714
|
plausible(e) {
|
|
705
|
-
const t =
|
|
715
|
+
const t = Ye(e.domain), r = Ze(e.endpoint ?? "https://plausible.io");
|
|
706
716
|
return {
|
|
707
717
|
connectSrc: r.origin,
|
|
708
718
|
consent: e.consent ?? !1,
|
|
@@ -719,13 +729,13 @@ const nr = {
|
|
|
719
729
|
};
|
|
720
730
|
}
|
|
721
731
|
};
|
|
722
|
-
function
|
|
732
|
+
function Ye(e) {
|
|
723
733
|
const t = e.trim();
|
|
724
734
|
if (!t || t.includes("/") || t.includes(" "))
|
|
725
735
|
throw new Error("Analytics domain must be a hostname without a path.");
|
|
726
736
|
return t;
|
|
727
737
|
}
|
|
728
|
-
function
|
|
738
|
+
function Ze(e) {
|
|
729
739
|
let t;
|
|
730
740
|
try {
|
|
731
741
|
t = new URL(e);
|
|
@@ -736,7 +746,7 @@ function Ye(e) {
|
|
|
736
746
|
throw new Error("Analytics endpoint must use HTTPS.");
|
|
737
747
|
return t;
|
|
738
748
|
}
|
|
739
|
-
function
|
|
749
|
+
function ir(e = {}) {
|
|
740
750
|
return {
|
|
741
751
|
async request(t) {
|
|
742
752
|
await E({ kind: "request", signal: t }, e);
|
|
@@ -755,20 +765,20 @@ function ar(e = {}) {
|
|
|
755
765
|
async function E(e, t) {
|
|
756
766
|
await t.onEvent?.(e), e.kind === "request" ? await t.request?.(e.signal) : e.kind === "server-start" ? await t.serverStart?.(e.signal) : e.kind === "trace" ? await t.trace?.(e.signal) : await t.webVitals?.(e.signal);
|
|
757
767
|
}
|
|
758
|
-
const
|
|
759
|
-
function
|
|
760
|
-
const t = [], r = e.document, n = r ?
|
|
761
|
-
r &&
|
|
762
|
-
const a = e.route ?
|
|
763
|
-
return r?.scripts && (
|
|
768
|
+
const Qe = /* @__PURE__ */ new Set(["DELETE", "PATCH", "POST", "PUT"]);
|
|
769
|
+
function or(e = {}) {
|
|
770
|
+
const t = [], r = e.document, n = r ? et(r.policy, r.headers, t) : {};
|
|
771
|
+
r && Xe(r.policy, t);
|
|
772
|
+
const a = e.route ? ct(e.route, t) : void 0;
|
|
773
|
+
return r?.scripts && (tt(
|
|
764
774
|
r.policy.csp,
|
|
765
775
|
r.scripts,
|
|
766
776
|
r.headers,
|
|
767
777
|
t
|
|
768
778
|
), r.scriptDependencies && t.push(
|
|
769
|
-
...
|
|
779
|
+
...Je(
|
|
770
780
|
r.scripts,
|
|
771
|
-
|
|
781
|
+
rt(r.scriptDependencies)
|
|
772
782
|
)
|
|
773
783
|
)), {
|
|
774
784
|
findings: t,
|
|
@@ -776,7 +786,7 @@ function ir(e = {}) {
|
|
|
776
786
|
route: a
|
|
777
787
|
};
|
|
778
788
|
}
|
|
779
|
-
function
|
|
789
|
+
function Xe(e, t) {
|
|
780
790
|
if (!e.trustedTypes || e.trustedTypes.mode !== "report-only")
|
|
781
791
|
return;
|
|
782
792
|
const r = e.csp || void 0, n = !!r?.reportUri?.length, a = e.headers?.reportingEndpoints, i = !!(r?.reportTo && a && a[r.reportTo]);
|
|
@@ -786,10 +796,10 @@ function Qe(e, t) {
|
|
|
786
796
|
severity: "warning"
|
|
787
797
|
});
|
|
788
798
|
}
|
|
789
|
-
function
|
|
799
|
+
function Je(e, t = {}) {
|
|
790
800
|
const r = t.requirePurpose ?? !0, n = [];
|
|
791
801
|
for (const a of e) {
|
|
792
|
-
const i =
|
|
802
|
+
const i = ft(a);
|
|
793
803
|
i && (r && !a.purpose && n.push({
|
|
794
804
|
code: "script-purpose-missing",
|
|
795
805
|
message: `Third-party script ${a.src} should declare a purpose for audits and consent flows.`,
|
|
@@ -802,7 +812,7 @@ function Xe(e, t = {}) {
|
|
|
802
812
|
code: "script-third-party-before-interactive",
|
|
803
813
|
message: `Third-party script ${a.src} runs before the app is interactive and should be justified by policy.`,
|
|
804
814
|
severity: "warning"
|
|
805
|
-
}),
|
|
815
|
+
}), dt(i) && n.push({
|
|
806
816
|
code: "script-gtm-wide-trust-boundary",
|
|
807
817
|
message: "Google Tag Manager can load additional scripts at runtime and should be treated as a wide trust boundary.",
|
|
808
818
|
severity: "warning"
|
|
@@ -810,7 +820,7 @@ function Xe(e, t = {}) {
|
|
|
810
820
|
}
|
|
811
821
|
return n;
|
|
812
822
|
}
|
|
813
|
-
function
|
|
823
|
+
function et(e, t, r) {
|
|
814
824
|
try {
|
|
815
825
|
return Object.fromEntries(de(e, t));
|
|
816
826
|
} catch (n) {
|
|
@@ -821,12 +831,12 @@ function Je(e, t, r) {
|
|
|
821
831
|
}), {};
|
|
822
832
|
}
|
|
823
833
|
}
|
|
824
|
-
function
|
|
834
|
+
function tt(e, t, r, n) {
|
|
825
835
|
if (!e)
|
|
826
836
|
return;
|
|
827
|
-
const a =
|
|
837
|
+
const a = nt(e);
|
|
828
838
|
for (const i of t) {
|
|
829
|
-
if (
|
|
839
|
+
if (at(a) && !i.nonce) {
|
|
830
840
|
n.push({
|
|
831
841
|
code: "csp-script-missing-nonce",
|
|
832
842
|
message: `Document script ${i.src} needs a nonce for the effective script-src policy.`,
|
|
@@ -834,26 +844,26 @@ function et(e, t, r, n) {
|
|
|
834
844
|
});
|
|
835
845
|
continue;
|
|
836
846
|
}
|
|
837
|
-
i.nonce && r?.nonce && i.nonce === r.nonce ||
|
|
847
|
+
i.nonce && r?.nonce && i.nonce === r.nonce || it(a, i.src) || n.push({
|
|
838
848
|
code: "csp-script-src-blocked",
|
|
839
849
|
message: `Document script ${i.src} is not allowed by the effective script-src policy.`,
|
|
840
850
|
severity: "error"
|
|
841
851
|
});
|
|
842
852
|
}
|
|
843
853
|
}
|
|
844
|
-
function
|
|
854
|
+
function rt(e) {
|
|
845
855
|
return typeof e == "boolean" ? {} : e;
|
|
846
856
|
}
|
|
847
|
-
function
|
|
857
|
+
function nt(e) {
|
|
848
858
|
return e.scriptSrc ?? e.defaultSrc ?? [];
|
|
849
859
|
}
|
|
850
|
-
function
|
|
860
|
+
function at(e) {
|
|
851
861
|
return e.some((t) => t.includes("'nonce-{nonce}'"));
|
|
852
862
|
}
|
|
853
|
-
function
|
|
854
|
-
return e.includes("*") ? !0 : e.includes("'none'") || e.some((r) => r.startsWith("'nonce-")) ? !1 : e.includes("'self'") &&
|
|
863
|
+
function it(e, t) {
|
|
864
|
+
return e.includes("*") ? !0 : e.includes("'none'") || e.some((r) => r.startsWith("'nonce-")) ? !1 : e.includes("'self'") && ot(t) || t.startsWith("https:") && e.includes("https:") || t.startsWith("http:") && e.includes("http:") ? !0 : e.some((r) => st(r, t));
|
|
855
865
|
}
|
|
856
|
-
function
|
|
866
|
+
function ot(e) {
|
|
857
867
|
return e.startsWith("/") && !e.startsWith("//");
|
|
858
868
|
}
|
|
859
869
|
function st(e, t) {
|
|
@@ -866,14 +876,14 @@ function st(e, t) {
|
|
|
866
876
|
return !1;
|
|
867
877
|
}
|
|
868
878
|
}
|
|
869
|
-
function
|
|
870
|
-
return
|
|
879
|
+
function ct(e, t) {
|
|
880
|
+
return ut(e.cors, t), lt(e.method, e.security, t), {
|
|
871
881
|
cors: e.cors,
|
|
872
882
|
method: e.method,
|
|
873
883
|
security: e.security
|
|
874
884
|
};
|
|
875
885
|
}
|
|
876
|
-
function
|
|
886
|
+
function ut(e, t) {
|
|
877
887
|
if (e)
|
|
878
888
|
try {
|
|
879
889
|
he(e);
|
|
@@ -885,8 +895,8 @@ function ct(e, t) {
|
|
|
885
895
|
});
|
|
886
896
|
}
|
|
887
897
|
}
|
|
888
|
-
function
|
|
889
|
-
|
|
898
|
+
function lt(e, t, r) {
|
|
899
|
+
Qe.has(e) && (t?.csrf === !1 && r.push({
|
|
890
900
|
code: "csrf-disabled",
|
|
891
901
|
message: "CSRF protection is explicitly disabled for this unsafe route.",
|
|
892
902
|
severity: "info"
|
|
@@ -900,7 +910,7 @@ function ut(e, t, r) {
|
|
|
900
910
|
severity: "warning"
|
|
901
911
|
}));
|
|
902
912
|
}
|
|
903
|
-
function
|
|
913
|
+
function ft(e) {
|
|
904
914
|
try {
|
|
905
915
|
const t = new URL(e.src);
|
|
906
916
|
if (t.protocol === "http:" || t.protocol === "https:")
|
|
@@ -910,23 +920,23 @@ function lt(e) {
|
|
|
910
920
|
}
|
|
911
921
|
return null;
|
|
912
922
|
}
|
|
913
|
-
function
|
|
923
|
+
function dt(e) {
|
|
914
924
|
return e.hostname === "www.googletagmanager.com" && (e.pathname === "/gtm.js" || e.pathname === "/ns.html");
|
|
915
925
|
}
|
|
916
|
-
class
|
|
926
|
+
class ht extends Error {
|
|
917
927
|
issues;
|
|
918
928
|
constructor(t) {
|
|
919
|
-
super(
|
|
929
|
+
super(bt(t)), this.name = "EnvValidationError", this.issues = t;
|
|
920
930
|
}
|
|
921
931
|
}
|
|
922
932
|
function sr(e) {
|
|
923
933
|
return e;
|
|
924
934
|
}
|
|
925
|
-
function
|
|
935
|
+
function cr(e, t) {
|
|
926
936
|
const r = [], n = {};
|
|
927
937
|
for (const a of Object.keys(e)) {
|
|
928
|
-
const i = e[a],
|
|
929
|
-
if (
|
|
938
|
+
const i = e[a], s = t[String(a)];
|
|
939
|
+
if (s === void 0 || s === "") {
|
|
930
940
|
if (i.optional) {
|
|
931
941
|
n[a] = void 0;
|
|
932
942
|
continue;
|
|
@@ -939,20 +949,20 @@ function or(e, t) {
|
|
|
939
949
|
continue;
|
|
940
950
|
}
|
|
941
951
|
try {
|
|
942
|
-
n[a] = i.parse(String(a),
|
|
943
|
-
} catch (
|
|
952
|
+
n[a] = i.parse(String(a), s);
|
|
953
|
+
} catch (o) {
|
|
944
954
|
r.push({
|
|
945
955
|
code: "invalid",
|
|
946
956
|
key: String(a),
|
|
947
|
-
message:
|
|
957
|
+
message: o instanceof Error ? o.message : `Environment variable ${String(a)} is invalid.`
|
|
948
958
|
});
|
|
949
959
|
}
|
|
950
960
|
}
|
|
951
961
|
if (r.length)
|
|
952
|
-
throw new
|
|
962
|
+
throw new ht(r);
|
|
953
963
|
return n;
|
|
954
964
|
}
|
|
955
|
-
function
|
|
965
|
+
function mt(e = {}) {
|
|
956
966
|
return y(e, !1, (t, r) => {
|
|
957
967
|
if (r === "true" || r === "1")
|
|
958
968
|
return !0;
|
|
@@ -961,7 +971,7 @@ function ht(e = {}) {
|
|
|
961
971
|
throw new Error(`Environment variable ${t} must be true, false, 1, or 0.`);
|
|
962
972
|
});
|
|
963
973
|
}
|
|
964
|
-
function
|
|
974
|
+
function pt(e, t = {}) {
|
|
965
975
|
return y(t, !1, (r, n) => {
|
|
966
976
|
if (e.includes(n))
|
|
967
977
|
return n;
|
|
@@ -970,7 +980,7 @@ function mt(e, t = {}) {
|
|
|
970
980
|
);
|
|
971
981
|
});
|
|
972
982
|
}
|
|
973
|
-
function
|
|
983
|
+
function gt(e = {}) {
|
|
974
984
|
return y(e, !1, (t, r) => {
|
|
975
985
|
if (!/^-?\d+$/.test(r))
|
|
976
986
|
throw new Error(`Environment variable ${t} must be an integer.`);
|
|
@@ -988,21 +998,21 @@ function pt(e = {}) {
|
|
|
988
998
|
return n;
|
|
989
999
|
});
|
|
990
1000
|
}
|
|
991
|
-
function
|
|
1001
|
+
function wt(e = {}) {
|
|
992
1002
|
return y(
|
|
993
1003
|
e,
|
|
994
1004
|
!0,
|
|
995
1005
|
(t, r) => j(t, r, e)
|
|
996
1006
|
);
|
|
997
1007
|
}
|
|
998
|
-
function
|
|
1008
|
+
function yt(e = {}) {
|
|
999
1009
|
return y(
|
|
1000
1010
|
e,
|
|
1001
1011
|
!1,
|
|
1002
1012
|
(t, r) => j(t, r, e)
|
|
1003
1013
|
);
|
|
1004
1014
|
}
|
|
1005
|
-
function
|
|
1015
|
+
function vt(e = {}) {
|
|
1006
1016
|
return y(e, !1, (t, r) => {
|
|
1007
1017
|
let n;
|
|
1008
1018
|
try {
|
|
@@ -1017,13 +1027,13 @@ function yt(e = {}) {
|
|
|
1017
1027
|
return n;
|
|
1018
1028
|
});
|
|
1019
1029
|
}
|
|
1020
|
-
const
|
|
1021
|
-
boolean:
|
|
1022
|
-
enum:
|
|
1023
|
-
integer:
|
|
1024
|
-
secret:
|
|
1025
|
-
string:
|
|
1026
|
-
url:
|
|
1030
|
+
const ur = {
|
|
1031
|
+
boolean: mt,
|
|
1032
|
+
enum: pt,
|
|
1033
|
+
integer: gt,
|
|
1034
|
+
secret: wt,
|
|
1035
|
+
string: yt,
|
|
1036
|
+
url: vt
|
|
1027
1037
|
};
|
|
1028
1038
|
function y(e, t, r) {
|
|
1029
1039
|
return {
|
|
@@ -1039,10 +1049,10 @@ function j(e, t, r) {
|
|
|
1039
1049
|
);
|
|
1040
1050
|
return t;
|
|
1041
1051
|
}
|
|
1042
|
-
function
|
|
1052
|
+
function bt(e) {
|
|
1043
1053
|
return e.length === 1 ? e[0].message : `Environment validation failed with ${e.length} issues.`;
|
|
1044
1054
|
}
|
|
1045
|
-
function
|
|
1055
|
+
function lr(e = {}) {
|
|
1046
1056
|
return async function(r) {
|
|
1047
1057
|
if (r.method.toUpperCase() !== "POST")
|
|
1048
1058
|
return new Response(null, {
|
|
@@ -1051,25 +1061,25 @@ function ur(e = {}) {
|
|
|
1051
1061
|
},
|
|
1052
1062
|
status: 405
|
|
1053
1063
|
});
|
|
1054
|
-
const n =
|
|
1064
|
+
const n = Et(r);
|
|
1055
1065
|
if (n)
|
|
1056
1066
|
return n;
|
|
1057
|
-
const a =
|
|
1067
|
+
const a = Rt(e, r);
|
|
1058
1068
|
if (a)
|
|
1059
1069
|
return a;
|
|
1060
1070
|
e.maxBodySize !== void 0 && (r = me({ maxBodySize: e.maxBodySize }, r));
|
|
1061
1071
|
let i;
|
|
1062
1072
|
try {
|
|
1063
1073
|
i = await r.json();
|
|
1064
|
-
} catch (
|
|
1065
|
-
return
|
|
1074
|
+
} catch (o) {
|
|
1075
|
+
return o instanceof pe ? new Response("Security report body too large.", { status: 413 }) : new Response("Invalid security report JSON.", {
|
|
1066
1076
|
status: 400
|
|
1067
1077
|
});
|
|
1068
1078
|
}
|
|
1069
|
-
const
|
|
1070
|
-
for (let
|
|
1071
|
-
await e.onReport?.(o
|
|
1072
|
-
index:
|
|
1079
|
+
const s = $t(i);
|
|
1080
|
+
for (let o = 0; o < s.length; o += 1)
|
|
1081
|
+
await e.onReport?.(s[o], {
|
|
1082
|
+
index: o,
|
|
1073
1083
|
request: r
|
|
1074
1084
|
});
|
|
1075
1085
|
return new Response(null, {
|
|
@@ -1077,20 +1087,20 @@ function ur(e = {}) {
|
|
|
1077
1087
|
});
|
|
1078
1088
|
};
|
|
1079
1089
|
}
|
|
1080
|
-
const
|
|
1090
|
+
const St = /* @__PURE__ */ new Set([
|
|
1081
1091
|
"application/csp-report",
|
|
1082
1092
|
"application/reports+json"
|
|
1083
1093
|
]);
|
|
1084
|
-
function
|
|
1094
|
+
function Et(e) {
|
|
1085
1095
|
const t = e.headers.get("content-type");
|
|
1086
1096
|
if (!t)
|
|
1087
1097
|
return null;
|
|
1088
1098
|
const r = t.split(";", 1)[0]?.trim().toLowerCase();
|
|
1089
|
-
return r &&
|
|
1099
|
+
return r && St.has(r) ? null : new Response("Unsupported security report Content-Type.", {
|
|
1090
1100
|
status: 415
|
|
1091
1101
|
});
|
|
1092
1102
|
}
|
|
1093
|
-
function
|
|
1103
|
+
function Rt(e, t) {
|
|
1094
1104
|
if (e.maxBodySize === void 0)
|
|
1095
1105
|
return null;
|
|
1096
1106
|
const r = t.headers.get("content-length");
|
|
@@ -1107,24 +1117,24 @@ function Et(e, t) {
|
|
|
1107
1117
|
status: 400
|
|
1108
1118
|
});
|
|
1109
1119
|
}
|
|
1110
|
-
function Rt(e) {
|
|
1111
|
-
return Array.isArray(e) ? e : $t(e) && "csp-report" in e ? [e["csp-report"]] : [e];
|
|
1112
|
-
}
|
|
1113
1120
|
function $t(e) {
|
|
1121
|
+
return Array.isArray(e) ? e : xt(e) && "csp-report" in e ? [e["csp-report"]] : [e];
|
|
1122
|
+
}
|
|
1123
|
+
function xt(e) {
|
|
1114
1124
|
return typeof e == "object" && e !== null;
|
|
1115
1125
|
}
|
|
1116
|
-
function
|
|
1126
|
+
function fr(e, t) {
|
|
1117
1127
|
const r = {}, n = [];
|
|
1118
1128
|
let a = 0;
|
|
1119
|
-
for (const [i,
|
|
1120
|
-
const
|
|
1121
|
-
r[i] =
|
|
1129
|
+
for (const [i, s] of Object.entries(t.files)) {
|
|
1130
|
+
const o = e.getAll(i).filter(It);
|
|
1131
|
+
r[i] = o, s.required && o.length === 0 && n.push({
|
|
1122
1132
|
code: "file-missing",
|
|
1123
1133
|
field: i,
|
|
1124
1134
|
message: `Upload field ${i} requires at least one file.`
|
|
1125
1135
|
});
|
|
1126
|
-
for (const u of
|
|
1127
|
-
a += u.size,
|
|
1136
|
+
for (const u of o)
|
|
1137
|
+
a += u.size, At(i, u, s, n);
|
|
1128
1138
|
}
|
|
1129
1139
|
return t.maxTotalSize !== void 0 && a > A(t.maxTotalSize) && n.push({
|
|
1130
1140
|
code: "total-upload-too-large",
|
|
@@ -1137,24 +1147,24 @@ function lr(e, t) {
|
|
|
1137
1147
|
totalSize: a
|
|
1138
1148
|
};
|
|
1139
1149
|
}
|
|
1140
|
-
function
|
|
1150
|
+
function At(e, t, r, n) {
|
|
1141
1151
|
r.maxSize !== void 0 && t.size > A(r.maxSize) && n.push({
|
|
1142
1152
|
code: "file-too-large",
|
|
1143
1153
|
field: e,
|
|
1144
1154
|
message: `Upload field ${e} contains ${t.name || "a file"} larger than ${r.maxSize}.`
|
|
1145
|
-
}), r.types?.length && !
|
|
1155
|
+
}), r.types?.length && !Tt(t.type, r.types) && n.push({
|
|
1146
1156
|
code: "file-type-not-allowed",
|
|
1147
1157
|
field: e,
|
|
1148
1158
|
message: `Upload field ${e} contains ${t.name || "a file"} with disallowed type ${t.type || "unknown"}.`
|
|
1149
1159
|
});
|
|
1150
1160
|
}
|
|
1151
|
-
function
|
|
1161
|
+
function Tt(e, t) {
|
|
1152
1162
|
return t.some((r) => r.endsWith("/*") ? e.startsWith(r.slice(0, -1)) : e === r);
|
|
1153
1163
|
}
|
|
1154
|
-
function
|
|
1164
|
+
function It(e) {
|
|
1155
1165
|
return e instanceof File;
|
|
1156
1166
|
}
|
|
1157
|
-
function
|
|
1167
|
+
function kt(e, t) {
|
|
1158
1168
|
const r = t.headers.get("origin");
|
|
1159
1169
|
if (!r)
|
|
1160
1170
|
return {
|
|
@@ -1171,7 +1181,7 @@ function It(e, t) {
|
|
|
1171
1181
|
origin: r,
|
|
1172
1182
|
reason: "invalid-origin"
|
|
1173
1183
|
};
|
|
1174
|
-
const a =
|
|
1184
|
+
const a = Ct(e, n, t);
|
|
1175
1185
|
return {
|
|
1176
1186
|
allowed: a,
|
|
1177
1187
|
expected: e.origins,
|
|
@@ -1179,17 +1189,17 @@ function It(e, t) {
|
|
|
1179
1189
|
reason: a ? void 0 : "origin-not-allowed"
|
|
1180
1190
|
};
|
|
1181
1191
|
}
|
|
1182
|
-
function
|
|
1183
|
-
return !e ||
|
|
1192
|
+
function dr(e, t) {
|
|
1193
|
+
return !e || kt(e, t).allowed ? null : new Response("WebSocket origin not allowed.", {
|
|
1184
1194
|
status: 403
|
|
1185
1195
|
});
|
|
1186
1196
|
}
|
|
1187
|
-
function
|
|
1197
|
+
function Ct(e, t, r) {
|
|
1188
1198
|
return e.origins === "same-origin" ? t === new URL(r.url).origin : e.origins.some(
|
|
1189
|
-
(n) =>
|
|
1199
|
+
(n) => Dt(n, t)
|
|
1190
1200
|
);
|
|
1191
1201
|
}
|
|
1192
|
-
function
|
|
1202
|
+
function Dt(e, t) {
|
|
1193
1203
|
return e === "null" ? t === "null" : q(e) === t;
|
|
1194
1204
|
}
|
|
1195
1205
|
function q(e) {
|
|
@@ -1211,108 +1221,108 @@ function q(e) {
|
|
|
1211
1221
|
}
|
|
1212
1222
|
}
|
|
1213
1223
|
export {
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1224
|
+
ht as EnvValidationError,
|
|
1225
|
+
se as HTTP_ERROR_STATUSES,
|
|
1226
|
+
wr as HttpError,
|
|
1227
|
+
Zt as Link,
|
|
1228
|
+
Ht as action,
|
|
1229
|
+
Wt as actionInput,
|
|
1230
|
+
ar as analytics,
|
|
1231
|
+
wn as assertAdapterCapabilities,
|
|
1232
|
+
Je as auditScriptDependencies,
|
|
1233
|
+
yn as checkAdapterCapabilities,
|
|
1234
|
+
kt as checkWebSocketOrigin,
|
|
1235
|
+
yr as createCache,
|
|
1236
|
+
vr as createCorsHeaders,
|
|
1237
|
+
br as createCsrfCookie,
|
|
1238
|
+
Sr as createCsrfToken,
|
|
1229
1239
|
ke as createFileRouter,
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1240
|
+
Er as createInvalidation,
|
|
1241
|
+
Rr as createMemoryCache,
|
|
1242
|
+
$r as createMemoryCacheStore,
|
|
1243
|
+
Gt as createMemoryIdempotencyStore,
|
|
1244
|
+
xr as createMemoryRateLimitStore,
|
|
1245
|
+
Ar as createRequestHandler,
|
|
1246
|
+
or as createSecurityAudit,
|
|
1237
1247
|
de as createSecurityHeaders,
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1248
|
+
lr as createSecurityReportHandler,
|
|
1249
|
+
Tr as cspHash,
|
|
1250
|
+
vn as defineAdapter,
|
|
1241
1251
|
sr as defineEnvSchema,
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1252
|
+
tr as defineFonts,
|
|
1253
|
+
Qt as defineImages,
|
|
1254
|
+
ir as defineInstrumentation,
|
|
1255
|
+
Ir as defineLinks,
|
|
1256
|
+
kr as defineMetadata,
|
|
1257
|
+
jt as defineOgImage,
|
|
1258
|
+
Ft as defineRobots,
|
|
1259
|
+
Cr as defineRoutePolicy,
|
|
1260
|
+
Dr as defineScripts,
|
|
1261
|
+
zr as defineSecurityPolicy,
|
|
1262
|
+
Ut as defineSitemap,
|
|
1263
|
+
Or as defineTags,
|
|
1254
1264
|
Pr as enforceAllowedMethods,
|
|
1255
1265
|
Lr as enforceCsrfProtection,
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1266
|
+
Nr as enforceRateLimit,
|
|
1267
|
+
Ur as enforceRequestSecurity,
|
|
1268
|
+
dr as enforceWebSocketOrigin,
|
|
1269
|
+
ur as env,
|
|
1270
|
+
er as font,
|
|
1271
|
+
rr as fontPreloadLinks,
|
|
1272
|
+
Mr as handleRequestWithManifest,
|
|
1263
1273
|
ee as href,
|
|
1264
|
-
|
|
1274
|
+
Fr as html,
|
|
1265
1275
|
ce as httpError,
|
|
1266
|
-
|
|
1267
|
-
|
|
1276
|
+
Yt as hydrateFileRouter,
|
|
1277
|
+
Xt as isAllowedImageSource,
|
|
1268
1278
|
le as isHttpError,
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1279
|
+
jr as issueCsrfToken,
|
|
1280
|
+
qr as json,
|
|
1281
|
+
Br as jsonl,
|
|
1282
|
+
Hr as link,
|
|
1283
|
+
Wr as mergeRoutePolicies,
|
|
1284
|
+
_r as mergeRouteSecurityPolicies,
|
|
1285
|
+
Vr as mergeSecurityPolicies,
|
|
1286
|
+
Gr as meta,
|
|
1287
|
+
Kr as modulePreload,
|
|
1288
|
+
Yr as notFound,
|
|
1289
|
+
_t as page,
|
|
1280
1290
|
A as parseBodySize,
|
|
1281
1291
|
D as parseCacheDuration,
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1292
|
+
Zr as parseCookieHeader,
|
|
1293
|
+
Qr as parseRateLimitWindow,
|
|
1294
|
+
Jt as planImageTransform,
|
|
1295
|
+
Xr as preconnect,
|
|
1296
|
+
Jr as preload,
|
|
1297
|
+
en as query,
|
|
1298
|
+
tn as redirect,
|
|
1299
|
+
nr as renderFontFaceCss,
|
|
1300
|
+
Bt as renderOgImageResponse,
|
|
1291
1301
|
ge as renderOgImageSvg,
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1302
|
+
pr as renderPageResponse,
|
|
1303
|
+
qt as renderRobots,
|
|
1304
|
+
Mt as renderSitemap,
|
|
1305
|
+
rn as resolveLinks,
|
|
1306
|
+
nn as resolveMetadata,
|
|
1307
|
+
an as resolveScripts,
|
|
1298
1308
|
Q as response,
|
|
1299
|
-
|
|
1309
|
+
Kt as runIdempotentMutation,
|
|
1300
1310
|
fe as script,
|
|
1301
|
-
|
|
1311
|
+
on as security,
|
|
1302
1312
|
J as serializeCacheKey,
|
|
1303
1313
|
sn as serializeCacheNamespace,
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1314
|
+
cn as serializeCacheTag,
|
|
1315
|
+
un as serverTiming,
|
|
1316
|
+
ln as sse,
|
|
1317
|
+
fn as stream,
|
|
1318
|
+
dn as structuredData,
|
|
1319
|
+
hn as tag,
|
|
1320
|
+
mn as text,
|
|
1311
1321
|
X as toResponse,
|
|
1312
1322
|
he as validateCorsPolicy,
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1323
|
+
cr as validateEnv,
|
|
1324
|
+
pn as validateRateLimitPolicy,
|
|
1325
|
+
fr as validateUploads,
|
|
1326
|
+
Vt as webhook
|
|
1317
1327
|
};
|
|
1318
1328
|
//# sourceMappingURL=index.js.map
|