@demiurgejs/core 0.1.1 → 0.2.0-beta.2
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/README.md +5 -0
- package/bin/demiurge.mjs +51 -0
- package/dist/adapter/testing.d.ts +33 -0
- package/dist/adapter/testing.d.ts.map +1 -0
- package/dist/adapter/testing.js +251 -0
- package/dist/adapter/testing.js.map +1 -0
- package/dist/browser/file-router.d.ts.map +1 -1
- package/dist/chunks/document-shell-D1xo6cEA.js +35 -0
- package/dist/chunks/document-shell-D1xo6cEA.js.map +1 -0
- package/dist/chunks/image-codec-BGTx_t5K.js +141 -0
- package/dist/chunks/image-codec-BGTx_t5K.js.map +1 -0
- package/dist/chunks/images-B9MqcjSA.js +339 -0
- package/dist/chunks/images-B9MqcjSA.js.map +1 -0
- package/dist/chunks/request-metadata-D5NrT8ks.js +642 -0
- package/dist/chunks/request-metadata-D5NrT8ks.js.map +1 -0
- package/dist/chunks/streaming-BQ1bykDo.js +469 -0
- package/dist/chunks/streaming-BQ1bykDo.js.map +1 -0
- package/dist/chunks/{testing-DR3eQAvY.js → testing-B_iMFYz_.js} +2376 -1927
- package/dist/chunks/testing-B_iMFYz_.js.map +1 -0
- package/dist/cli.d.ts +42 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +173 -0
- package/dist/cli.js.map +1 -0
- package/dist/document/deferred-scripts.d.ts +11 -0
- package/dist/document/deferred-scripts.d.ts.map +1 -0
- package/dist/document/index.d.ts +4 -2
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/render.d.ts +1 -1
- package/dist/document/render.d.ts.map +1 -1
- package/dist/document/scripts.d.ts +34 -1
- package/dist/document/scripts.d.ts.map +1 -1
- package/dist/edge/assets.d.ts +14 -0
- package/dist/edge/assets.d.ts.map +1 -0
- package/dist/edge/index.d.ts +19 -0
- package/dist/edge/index.d.ts.map +1 -0
- package/dist/edge/index.js +286 -0
- package/dist/edge/index.js.map +1 -0
- package/dist/edge/stores.d.ts +8 -0
- package/dist/edge/stores.d.ts.map +1 -0
- package/dist/edge/streaming.d.ts +7 -0
- package/dist/edge/streaming.d.ts.map +1 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +894 -1043
- package/dist/index.js.map +1 -1
- package/dist/internal/testing.js +12 -11
- package/dist/internal/testing.js.map +1 -1
- package/dist/kv/index.d.ts +3 -0
- package/dist/kv/index.d.ts.map +1 -0
- package/dist/kv/index.js +103 -0
- package/dist/kv/index.js.map +1 -0
- package/dist/kv/store.d.ts +28 -0
- package/dist/kv/store.d.ts.map +1 -0
- package/dist/node/font.d.ts +5 -0
- package/dist/node/font.d.ts.map +1 -0
- package/dist/node/image.d.ts +15 -0
- package/dist/node/image.d.ts.map +1 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +25 -23
- package/dist/node/index.js.map +1 -1
- package/dist/node/streaming.d.ts +2 -0
- package/dist/node/streaming.d.ts.map +1 -1
- package/dist/platform/analytics.d.ts +58 -5
- package/dist/platform/analytics.d.ts.map +1 -1
- package/dist/platform/font-assets.d.ts +19 -0
- package/dist/platform/font-assets.d.ts.map +1 -0
- package/dist/platform/fonts.d.ts +14 -4
- package/dist/platform/fonts.d.ts.map +1 -1
- package/dist/platform/image-codec.d.ts +15 -0
- package/dist/platform/image-codec.d.ts.map +1 -0
- package/dist/platform/image-url.d.ts +17 -0
- package/dist/platform/image-url.d.ts.map +1 -0
- package/dist/platform/image.d.ts +8 -0
- package/dist/platform/image.d.ts.map +1 -0
- package/dist/platform/images.d.ts +15 -0
- package/dist/platform/images.d.ts.map +1 -1
- package/dist/platform/index.d.ts +8 -5
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/redis/index.d.ts +3 -0
- package/dist/redis/index.d.ts.map +1 -0
- package/dist/redis/index.js +171 -0
- package/dist/redis/index.js.map +1 -0
- package/dist/redis/store.d.ts +8 -0
- package/dist/redis/store.d.ts.map +1 -0
- package/dist/route/action.d.ts +11 -11
- package/dist/route/action.d.ts.map +1 -1
- package/dist/route/index.d.ts +2 -1
- package/dist/route/index.d.ts.map +1 -1
- package/dist/route/middleware.d.ts +7 -0
- package/dist/route/middleware.d.ts.map +1 -0
- package/dist/route/page.d.ts +2 -2
- package/dist/route/page.d.ts.map +1 -1
- package/dist/route/response.d.ts +19 -19
- package/dist/route/response.d.ts.map +1 -1
- package/dist/route/types.d.ts +55 -31
- package/dist/route/types.d.ts.map +1 -1
- package/dist/route/webhook.d.ts +1 -1
- package/dist/router/manifest.d.ts +1 -0
- package/dist/router/manifest.d.ts.map +1 -1
- package/dist/routing/generate.d.ts +2 -0
- package/dist/routing/generate.d.ts.map +1 -1
- package/dist/routing/index.d.ts +1 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/types.d.ts +2 -0
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/security/cors.d.ts.map +1 -1
- package/dist/security/index.d.ts +4 -2
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/policy.d.ts +5 -1
- package/dist/security/policy.d.ts.map +1 -1
- package/dist/security/types.d.ts +34 -13
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/verification.d.ts +8 -0
- package/dist/security/verification.d.ts.map +1 -0
- package/dist/server/document-shell.d.ts +12 -0
- package/dist/server/document-shell.d.ts.map +1 -0
- package/dist/server/errors.d.ts.map +1 -1
- package/dist/server/not-found.d.ts.map +1 -1
- package/dist/server/render-tree.d.ts +6 -1
- package/dist/server/render-tree.d.ts.map +1 -1
- package/dist/server/request-handler.d.ts +4 -1
- package/dist/server/request-handler.d.ts.map +1 -1
- package/dist/server/ssr.d.ts +1 -0
- package/dist/server/ssr.d.ts.map +1 -1
- package/dist/static/images.d.ts +13 -0
- package/dist/static/images.d.ts.map +1 -0
- package/dist/static/index.d.ts +18 -0
- package/dist/static/index.d.ts.map +1 -1
- package/dist/static/index.js +677 -129
- package/dist/static/index.js.map +1 -1
- package/dist/static/preview.d.ts +8 -0
- package/dist/static/preview.d.ts.map +1 -0
- package/dist/static/vercel.d.ts +34 -0
- package/dist/static/vercel.d.ts.map +1 -0
- package/dist/vite/index.d.ts +3 -2
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +782 -329
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugin.d.ts +20 -0
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/vite/policy-verification.d.ts +10 -0
- package/dist/vite/policy-verification.d.ts.map +1 -0
- package/package.json +38 -2
- package/dist/chunks/index-BnX9Qxbm.js +0 -44
- package/dist/chunks/index-BnX9Qxbm.js.map +0 -1
- package/dist/chunks/ssr-BJejKlkZ.js +0 -275
- package/dist/chunks/ssr-BJejKlkZ.js.map +0 -1
- package/dist/chunks/streaming-DN1DnbRE.js +0 -343
- package/dist/chunks/streaming-DN1DnbRE.js.map +0 -1
- package/dist/chunks/testing-DR3eQAvY.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,33 +1,93 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { jsx as z } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as _, useState as T, useRef as I, useEffect as D, useMemo as V, createElement as f, useContext as W, Component as K } from "react";
|
|
3
|
+
import { g as G, H as Z, h as N, i as Y, j as A } from "./chunks/request-metadata-D5NrT8ks.js";
|
|
4
|
+
import { k as jt, l as Ft, m as Ht, d as Bt, n as qt, o as _t, q as Vt, t as Wt, u as Kt, p as Gt, a as Zt, v as Yt, w as Xt } from "./chunks/request-metadata-D5NrT8ks.js";
|
|
5
|
+
import { p as C, l as X, n as J, t as Q, o as ee, R as te, q as $, u as re, k as M, w as ne, x as P, y as ae, N as O, z as ie, A as oe, B as se, C as ce, H as ue, D as le, E as fe, F as de } from "./chunks/testing-B_iMFYz_.js";
|
|
6
|
+
import { G as Qt, I as er, J as tr, K as rr, L as nr, M as ar, O as ir, P as or, Q as sr, d as cr, c as ur, S as lr, f as fr, e as dr, T as mr, U as hr, V as pr, W as gr, X as wr, Y as yr, Z as vr, _ as br, $ as Sr, h as Er, a0 as Rr, a1 as Ar, a2 as xr, a3 as $r, a4 as kr, a5 as Tr, a6 as Ir, m as Dr, a7 as Nr, a8 as Cr, a9 as Or, aa as Lr, ab as zr, ac as Mr, ad as Pr, s as Ur, ae as jr, af as Fr, ag as Hr, ah as Br, ai as qr, aj as _r, ak as Vr, al as Wr, v as Kr, g as Gr, a as Zr } from "./chunks/testing-B_iMFYz_.js";
|
|
7
|
+
import { k as me } from "./chunks/images-B9MqcjSA.js";
|
|
8
|
+
import { d as Xr, l as Jr, m as Qr, n as en, f as tn, o as rn, q as nn, a as an, s as on, t as sn, b as cn, h as un, j as ln, r as fn } from "./chunks/images-B9MqcjSA.js";
|
|
8
9
|
import "react-dom/server";
|
|
9
|
-
|
|
10
|
+
const he = "24h", pe = 1e4;
|
|
11
|
+
function mt(e = {}) {
|
|
12
|
+
const t = e.now ?? Date.now, r = e.defaultTtl ?? he, n = e.maximumEntries ?? pe;
|
|
13
|
+
if (!Number.isSafeInteger(n) || n <= 0)
|
|
14
|
+
throw new Error(
|
|
15
|
+
"Demiurge idempotency maximumEntries must be a positive integer."
|
|
16
|
+
);
|
|
17
|
+
const a = C(r);
|
|
18
|
+
if (!Number.isFinite(a))
|
|
19
|
+
throw new Error("Demiurge idempotency defaultTtl must be finite.");
|
|
20
|
+
const i = /* @__PURE__ */ new Map();
|
|
21
|
+
return {
|
|
22
|
+
async run(s) {
|
|
23
|
+
const o = X(s.key), u = t();
|
|
24
|
+
ge(i, u);
|
|
25
|
+
const d = i.get(o);
|
|
26
|
+
if (d && (d.pending || d.expiresAt > u))
|
|
27
|
+
return {
|
|
28
|
+
key: o,
|
|
29
|
+
replayed: !0,
|
|
30
|
+
value: await d.value
|
|
31
|
+
};
|
|
32
|
+
if (i.size >= n && we(i), i.size >= n)
|
|
33
|
+
throw new Error(
|
|
34
|
+
"Demiurge idempotency store is at capacity with in-flight mutations."
|
|
35
|
+
);
|
|
36
|
+
const g = Promise.resolve().then(s.fn), c = {
|
|
37
|
+
expiresAt: Number.POSITIVE_INFINITY,
|
|
38
|
+
pending: !0,
|
|
39
|
+
value: g
|
|
40
|
+
};
|
|
41
|
+
i.set(o, c);
|
|
42
|
+
try {
|
|
43
|
+
const l = await g;
|
|
44
|
+
return c.pending = !1, c.expiresAt = t() + C(s.ttl ?? r), {
|
|
45
|
+
key: o,
|
|
46
|
+
replayed: !1,
|
|
47
|
+
value: l
|
|
48
|
+
};
|
|
49
|
+
} catch (l) {
|
|
50
|
+
throw i.get(o) === c && i.delete(o), l;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function ge(e, t) {
|
|
56
|
+
for (const [r, n] of e)
|
|
57
|
+
!n.pending && n.expiresAt <= t && e.delete(r);
|
|
58
|
+
}
|
|
59
|
+
function we(e) {
|
|
60
|
+
for (const [t, r] of e)
|
|
61
|
+
if (!r.pending) {
|
|
62
|
+
e.delete(t);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function ht(e, t) {
|
|
67
|
+
return e.run(t);
|
|
68
|
+
}
|
|
69
|
+
function pt(e) {
|
|
10
70
|
return {
|
|
11
71
|
entries: e
|
|
12
72
|
};
|
|
13
73
|
}
|
|
14
|
-
function
|
|
74
|
+
function gt(e) {
|
|
15
75
|
return [
|
|
16
76
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
17
77
|
`<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"' : ""}>`,
|
|
18
|
-
...e.entries.map(
|
|
78
|
+
...e.entries.map(ve),
|
|
19
79
|
"</urlset>",
|
|
20
80
|
""
|
|
21
81
|
].join(`
|
|
22
82
|
`);
|
|
23
83
|
}
|
|
24
|
-
function
|
|
84
|
+
function wt(e) {
|
|
25
85
|
return e;
|
|
26
86
|
}
|
|
27
|
-
function
|
|
87
|
+
function yt(e) {
|
|
28
88
|
return e;
|
|
29
89
|
}
|
|
30
|
-
function
|
|
90
|
+
function vt(e) {
|
|
31
91
|
const t = [];
|
|
32
92
|
for (const r of e.rules ?? []) {
|
|
33
93
|
for (const n of b(r.userAgent))
|
|
@@ -45,9 +105,9 @@ function qt(e) {
|
|
|
45
105
|
`).replace(/\n+$/, "")}
|
|
46
106
|
`;
|
|
47
107
|
}
|
|
48
|
-
function
|
|
49
|
-
const t = e.width ?? 1200, r = e.height ?? 630, n = e.background ?? "#101820", a = e.foreground ?? "#ffffff", i =
|
|
50
|
-
return
|
|
108
|
+
function ye(e) {
|
|
109
|
+
const t = e.width ?? 1200, r = e.height ?? 630, n = e.background ?? "#101820", a = e.foreground ?? "#ffffff", i = x(e.title, 120), s = e.subtitle ? x(e.subtitle, 160) : void 0, o = e.brand ? x(e.brand, 80) : void 0;
|
|
110
|
+
return Ee(t, r), [
|
|
51
111
|
`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" role="img" aria-label="${p(i)}">`,
|
|
52
112
|
` <rect width="100%" height="100%" fill="${p(n)}" />`,
|
|
53
113
|
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,
|
|
@@ -57,21 +117,21 @@ function ge(e) {
|
|
|
57
117
|
].filter((u) => !!u).join(`
|
|
58
118
|
`);
|
|
59
119
|
}
|
|
60
|
-
function
|
|
61
|
-
return new Response(
|
|
120
|
+
function bt(e) {
|
|
121
|
+
return new Response(ye(e), {
|
|
62
122
|
headers: {
|
|
63
123
|
"cache-control": "public, max-age=31536000, immutable",
|
|
64
124
|
"content-type": "image/svg+xml; charset=utf-8"
|
|
65
125
|
}
|
|
66
126
|
});
|
|
67
127
|
}
|
|
68
|
-
function
|
|
128
|
+
function ve(e) {
|
|
69
129
|
return [
|
|
70
130
|
" <url>",
|
|
71
131
|
` <loc>${w(e.url)}</loc>`,
|
|
72
|
-
e.lastModified ? ` <lastmod>${w(
|
|
132
|
+
e.lastModified ? ` <lastmod>${w(be(e.lastModified))}</lastmod>` : null,
|
|
73
133
|
e.changeFrequency ? ` <changefreq>${e.changeFrequency}</changefreq>` : null,
|
|
74
|
-
e.priority !== void 0 ? ` <priority>${
|
|
134
|
+
e.priority !== void 0 ? ` <priority>${Se(e.priority)}</priority>` : null,
|
|
75
135
|
...(e.alternates ?? []).map(
|
|
76
136
|
(t) => ` <xhtml:link rel="alternate" hreflang="${p(t.hrefLang)}" href="${p(t.href)}" />`
|
|
77
137
|
),
|
|
@@ -79,10 +139,10 @@ function we(e) {
|
|
|
79
139
|
].filter((t) => !!t).join(`
|
|
80
140
|
`);
|
|
81
141
|
}
|
|
82
|
-
function
|
|
142
|
+
function be(e) {
|
|
83
143
|
return e instanceof Date ? e.toISOString() : e;
|
|
84
144
|
}
|
|
85
|
-
function
|
|
145
|
+
function Se(e) {
|
|
86
146
|
if (e < 0 || e > 1)
|
|
87
147
|
throw new Error("Sitemap entry priority must be between 0 and 1.");
|
|
88
148
|
return String(e);
|
|
@@ -96,22 +156,22 @@ function w(e) {
|
|
|
96
156
|
function p(e) {
|
|
97
157
|
return w(e).replaceAll('"', """).replaceAll("'", "'");
|
|
98
158
|
}
|
|
99
|
-
function
|
|
159
|
+
function x(e, t) {
|
|
100
160
|
return e.length > t ? `${e.slice(0, t - 3)}...` : e;
|
|
101
161
|
}
|
|
102
|
-
function
|
|
162
|
+
function Ee(e, t) {
|
|
103
163
|
if (!Number.isSafeInteger(e) || e <= 0)
|
|
104
164
|
throw new Error("OG image width must be a positive integer.");
|
|
105
165
|
if (!Number.isSafeInteger(t) || t <= 0)
|
|
106
166
|
throw new Error("OG image height must be a positive integer.");
|
|
107
167
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
168
|
+
function St(e) {
|
|
169
|
+
return J(
|
|
110
170
|
async (t) => {
|
|
111
171
|
const r = e.input ? await e.input(t) : void 0, n = {
|
|
112
172
|
...t,
|
|
113
173
|
input: r
|
|
114
|
-
}, a = async () => await
|
|
174
|
+
}, a = async () => await Re(
|
|
115
175
|
await e.handler(n),
|
|
116
176
|
t
|
|
117
177
|
);
|
|
@@ -131,7 +191,7 @@ function Ht(e) {
|
|
|
131
191
|
}
|
|
132
192
|
);
|
|
133
193
|
}
|
|
134
|
-
const
|
|
194
|
+
const Et = {
|
|
135
195
|
async formData({ request: e }) {
|
|
136
196
|
return await e.formData();
|
|
137
197
|
},
|
|
@@ -142,10 +202,10 @@ const Wt = {
|
|
|
142
202
|
return await e.text();
|
|
143
203
|
}
|
|
144
204
|
};
|
|
145
|
-
async function
|
|
146
|
-
return e instanceof Response ? e : await
|
|
205
|
+
async function Re(e, t) {
|
|
206
|
+
return e instanceof Response ? e : await Q(e, t);
|
|
147
207
|
}
|
|
148
|
-
function
|
|
208
|
+
function Rt(e) {
|
|
149
209
|
return typeof e == "function" ? {
|
|
150
210
|
kind: "page",
|
|
151
211
|
render: { mode: "ssr" },
|
|
@@ -158,7 +218,10 @@ function _t(e) {
|
|
|
158
218
|
view: e.view
|
|
159
219
|
};
|
|
160
220
|
}
|
|
161
|
-
|
|
221
|
+
function At(e) {
|
|
222
|
+
return e;
|
|
223
|
+
}
|
|
224
|
+
const xt = {
|
|
162
225
|
hmac(e) {
|
|
163
226
|
return {
|
|
164
227
|
kind: "response",
|
|
@@ -166,7 +229,7 @@ const Vt = {
|
|
|
166
229
|
const r = new Uint8Array(await t.request.arrayBuffer()), n = t.request.headers.get(
|
|
167
230
|
e.header ?? "x-webhook-signature"
|
|
168
231
|
);
|
|
169
|
-
return n ? await
|
|
232
|
+
return n ? await Ae(r, n, e) ? await e.handler({
|
|
170
233
|
...t,
|
|
171
234
|
rawBody: r,
|
|
172
235
|
text: () => new TextDecoder().decode(r)
|
|
@@ -182,8 +245,8 @@ const Vt = {
|
|
|
182
245
|
};
|
|
183
246
|
}
|
|
184
247
|
};
|
|
185
|
-
async function
|
|
186
|
-
const n = r.algorithm ?? "SHA-256", a = r.encoding ?? "hex", i =
|
|
248
|
+
async function Ae(e, t, r) {
|
|
249
|
+
const n = r.algorithm ?? "SHA-256", a = r.encoding ?? "hex", i = xe(
|
|
187
250
|
t,
|
|
188
251
|
n,
|
|
189
252
|
r.prefix
|
|
@@ -207,7 +270,7 @@ async function Ee(e, t, r) {
|
|
|
207
270
|
Uint8Array.from(e).buffer
|
|
208
271
|
);
|
|
209
272
|
}
|
|
210
|
-
function
|
|
273
|
+
function xe(e, t, r) {
|
|
211
274
|
const n = e.trim(), a = r === void 0 ? `${t.toLowerCase().replace("-", "")}=` : r;
|
|
212
275
|
return a !== !1 && n.startsWith(a) ? n.slice(a.length).trim() : n;
|
|
213
276
|
}
|
|
@@ -228,514 +291,709 @@ function $e(e, t) {
|
|
|
228
291
|
return null;
|
|
229
292
|
}
|
|
230
293
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
"Demiurge idempotency maximumEntries must be a positive integer."
|
|
237
|
-
);
|
|
238
|
-
const a = D(r);
|
|
239
|
-
if (!Number.isFinite(a))
|
|
240
|
-
throw new Error("Demiurge idempotency defaultTtl must be finite.");
|
|
241
|
-
const i = /* @__PURE__ */ new Map();
|
|
242
|
-
return {
|
|
243
|
-
async run(s) {
|
|
244
|
-
const o = J(s.key), u = t();
|
|
245
|
-
Te(i, u);
|
|
246
|
-
const d = i.get(o);
|
|
247
|
-
if (d && (d.pending || d.expiresAt > u))
|
|
248
|
-
return {
|
|
249
|
-
key: o,
|
|
250
|
-
replayed: !0,
|
|
251
|
-
value: await d.value
|
|
252
|
-
};
|
|
253
|
-
if (i.size >= n && Ie(i), i.size >= n)
|
|
254
|
-
throw new Error(
|
|
255
|
-
"Demiurge idempotency store is at capacity with in-flight mutations."
|
|
256
|
-
);
|
|
257
|
-
const g = Promise.resolve().then(s.fn), c = {
|
|
258
|
-
expiresAt: Number.POSITIVE_INFINITY,
|
|
259
|
-
pending: !0,
|
|
260
|
-
value: g
|
|
261
|
-
};
|
|
262
|
-
i.set(o, c);
|
|
263
|
-
try {
|
|
264
|
-
const l = await g;
|
|
265
|
-
return c.pending = !1, c.expiresAt = t() + D(s.ttl ?? r), {
|
|
266
|
-
key: o,
|
|
267
|
-
replayed: !1,
|
|
268
|
-
value: l
|
|
269
|
-
};
|
|
270
|
-
} catch (l) {
|
|
271
|
-
throw i.get(o) === c && i.delete(o), l;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
function Te(e, t) {
|
|
277
|
-
for (const [r, n] of e)
|
|
278
|
-
!n.pending && n.expiresAt <= t && e.delete(r);
|
|
279
|
-
}
|
|
280
|
-
function Ie(e) {
|
|
281
|
-
for (const [t, r] of e)
|
|
282
|
-
if (!r.pending) {
|
|
283
|
-
e.delete(t);
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
294
|
+
class ke extends Error {
|
|
295
|
+
issues;
|
|
296
|
+
constructor(t) {
|
|
297
|
+
super(Le(t)), this.name = "EnvValidationError", this.issues = t;
|
|
298
|
+
}
|
|
286
299
|
}
|
|
287
|
-
function
|
|
288
|
-
return e
|
|
300
|
+
function $t(e) {
|
|
301
|
+
return e;
|
|
289
302
|
}
|
|
290
|
-
function
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
i(S());
|
|
303
|
+
function kt(e, t) {
|
|
304
|
+
const r = [], n = {};
|
|
305
|
+
for (const a of Object.keys(e)) {
|
|
306
|
+
const i = e[a], s = t[String(a)];
|
|
307
|
+
if (s === void 0 || s === "") {
|
|
308
|
+
if (i.optional) {
|
|
309
|
+
n[a] = void 0;
|
|
310
|
+
continue;
|
|
299
311
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
312
|
+
r.push({
|
|
313
|
+
code: "missing",
|
|
314
|
+
key: String(a),
|
|
315
|
+
message: `Environment variable ${String(a)} is required.`
|
|
316
|
+
});
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
n[a] = i.parse(String(a), s);
|
|
321
|
+
} catch (o) {
|
|
322
|
+
r.push({
|
|
323
|
+
code: "invalid",
|
|
324
|
+
key: String(a),
|
|
325
|
+
message: o instanceof Error ? o.message : `Environment variable ${String(a)} is invalid.`
|
|
311
326
|
});
|
|
312
|
-
const T = new Request(a.href, { signal: R.signal });
|
|
313
|
-
return Promise.resolve(r(T)).then(
|
|
314
|
-
(m) => L(
|
|
315
|
-
t,
|
|
316
|
-
a.pathname,
|
|
317
|
-
T,
|
|
318
|
-
m,
|
|
319
|
-
void 0,
|
|
320
|
-
{ documentContributions: !1 }
|
|
321
|
-
)
|
|
322
|
-
).then((m) => {
|
|
323
|
-
l = !0, v() && o(m);
|
|
324
|
-
}).catch(async (m) => {
|
|
325
|
-
if (l = !0, !v() || R.signal.aborted)
|
|
326
|
-
return;
|
|
327
|
-
const B = await re(
|
|
328
|
-
t,
|
|
329
|
-
a.pathname
|
|
330
|
-
);
|
|
331
|
-
v() && o({
|
|
332
|
-
Error: B,
|
|
333
|
-
error: m,
|
|
334
|
-
pathname: a.pathname,
|
|
335
|
-
status: "error"
|
|
336
|
-
});
|
|
337
|
-
}), () => {
|
|
338
|
-
c = !0, R.abort();
|
|
339
|
-
};
|
|
340
|
-
}, [a.pathname, a.search]);
|
|
341
|
-
const g = _(
|
|
342
|
-
() => ({
|
|
343
|
-
navigation: e.navigation ?? "server",
|
|
344
|
-
push(c) {
|
|
345
|
-
const l = S();
|
|
346
|
-
window.history.pushState(null, "", c);
|
|
347
|
-
const h = S();
|
|
348
|
-
i(h), l.pathname === h.pathname && l.search === h.search && l.hash !== h.hash && Ne(h.hash);
|
|
349
|
-
}
|
|
350
|
-
}),
|
|
351
|
-
[]
|
|
352
|
-
);
|
|
353
|
-
return f(M.Provider, {
|
|
354
|
-
value: g,
|
|
355
|
-
children: f(Oe, {
|
|
356
|
-
key: `${a.pathname}${a.search}`,
|
|
357
|
-
Loading: e.loading,
|
|
358
|
-
NotFound: e.notFound,
|
|
359
|
-
match: s
|
|
360
|
-
})
|
|
361
|
-
});
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
function Ce(e, t) {
|
|
365
|
-
const r = t.getAttribute(Z);
|
|
366
|
-
return e.status === "not-found" ? r === "not-found" : e.status === "ready" && r === null;
|
|
367
|
-
}
|
|
368
|
-
function De(e) {
|
|
369
|
-
if (e)
|
|
370
|
-
return e.status === "ready" ? e.match.pathname : e.status === "loading" ? void 0 : e.pathname;
|
|
371
|
-
}
|
|
372
|
-
async function Yt(e) {
|
|
373
|
-
const t = e.root ?? document.getElementById("root");
|
|
374
|
-
if (!t)
|
|
375
|
-
throw new Error(
|
|
376
|
-
"Demiurge expected a #root element in the framework document."
|
|
377
|
-
);
|
|
378
|
-
const r = P(e.routes), n = e.loadNavigationData ?? U, a = e.initialData ?? K(document), i = await L(
|
|
379
|
-
r,
|
|
380
|
-
window.location.pathname,
|
|
381
|
-
new Request(window.location.href),
|
|
382
|
-
a ?? await n(new Request(window.location.href)),
|
|
383
|
-
void 0,
|
|
384
|
-
{ documentContributions: !1 }
|
|
385
|
-
), s = Ce(i, t), o = ke(
|
|
386
|
-
s ? {
|
|
387
|
-
...e,
|
|
388
|
-
initialMatch: i,
|
|
389
|
-
loadNavigationData: n,
|
|
390
|
-
navigation: a?.navigation ?? e.navigation
|
|
391
|
-
} : {
|
|
392
|
-
...e,
|
|
393
|
-
loadNavigationData: n,
|
|
394
|
-
navigation: a?.navigation ?? e.navigation
|
|
395
327
|
}
|
|
396
|
-
), { createRoot: u, hydrateRoot: d } = ze(
|
|
397
|
-
await import("react-dom/client")
|
|
398
|
-
);
|
|
399
|
-
if (s && t.hasAttribute(Y)) {
|
|
400
|
-
d(t, f(o));
|
|
401
|
-
return;
|
|
402
328
|
}
|
|
403
|
-
|
|
329
|
+
if (r.length)
|
|
330
|
+
throw new ke(r);
|
|
331
|
+
return n;
|
|
404
332
|
}
|
|
405
|
-
function
|
|
406
|
-
|
|
407
|
-
|
|
333
|
+
function Te(e = {}) {
|
|
334
|
+
return y(e, !1, (t, r) => {
|
|
335
|
+
if (r === "true" || r === "1")
|
|
336
|
+
return !0;
|
|
337
|
+
if (r === "false" || r === "0")
|
|
338
|
+
return !1;
|
|
339
|
+
throw new Error(`Environment variable ${t} must be true, false, 1, or 0.`);
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
function Ie(e, t = {}) {
|
|
343
|
+
return y(t, !1, (r, n) => {
|
|
344
|
+
if (e.includes(n))
|
|
345
|
+
return n;
|
|
408
346
|
throw new Error(
|
|
409
|
-
|
|
347
|
+
`Environment variable ${r} must be one of: ${e.join(", ")}.`
|
|
410
348
|
);
|
|
411
|
-
|
|
349
|
+
});
|
|
412
350
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
351
|
+
function De(e = {}) {
|
|
352
|
+
return y(e, !1, (t, r) => {
|
|
353
|
+
if (!/^-?\d+$/.test(r))
|
|
354
|
+
throw new Error(`Environment variable ${t} must be an integer.`);
|
|
355
|
+
const n = Number(r);
|
|
356
|
+
if (!Number.isSafeInteger(n))
|
|
357
|
+
throw new Error(`Environment variable ${t} must be a safe integer.`);
|
|
358
|
+
if (e.min !== void 0 && n < e.min)
|
|
359
|
+
throw new Error(
|
|
360
|
+
`Environment variable ${t} must be greater than or equal to ${e.min}.`
|
|
361
|
+
);
|
|
362
|
+
if (e.max !== void 0 && n > e.max)
|
|
363
|
+
throw new Error(
|
|
364
|
+
`Environment variable ${t} must be less than or equal to ${e.max}.`
|
|
365
|
+
);
|
|
366
|
+
return n;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
function Ne(e = {}) {
|
|
370
|
+
return y(
|
|
371
|
+
e,
|
|
372
|
+
!0,
|
|
373
|
+
(t, r) => U(t, r, e)
|
|
425
374
|
);
|
|
426
375
|
}
|
|
427
|
-
function
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (r.status === "loading") {
|
|
433
|
-
const c = r.loading ?? e;
|
|
434
|
-
return c ? f(c) : null;
|
|
435
|
-
}
|
|
436
|
-
if (r.status === "not-found") {
|
|
437
|
-
const c = r.notFound ?? t ?? ue;
|
|
438
|
-
return r.layouts.reduceRight(
|
|
439
|
-
(l, h) => f(h, {
|
|
440
|
-
children: l,
|
|
441
|
-
path: {},
|
|
442
|
-
pathname: r.pathname
|
|
443
|
-
}),
|
|
444
|
-
f(c, { pathname: r.pathname })
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
if (r.status === "error")
|
|
448
|
-
return r.Error ? f(r.Error, {
|
|
449
|
-
error: r.error,
|
|
450
|
-
pathname: r.pathname,
|
|
451
|
-
status: N(r.error)
|
|
452
|
-
}) : null;
|
|
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 }),
|
|
455
|
-
d
|
|
376
|
+
function Ce(e = {}) {
|
|
377
|
+
return y(
|
|
378
|
+
e,
|
|
379
|
+
!1,
|
|
380
|
+
(t, r) => U(t, r, e)
|
|
456
381
|
);
|
|
457
|
-
return f(Pe, {
|
|
458
|
-
Error: a,
|
|
459
|
-
children: g,
|
|
460
|
-
pathname: u
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
class Pe extends G {
|
|
464
|
-
static getDerivedStateFromError(t) {
|
|
465
|
-
return { error: t };
|
|
466
|
-
}
|
|
467
|
-
state = {};
|
|
468
|
-
componentDidUpdate(t) {
|
|
469
|
-
this.state.error !== void 0 && t.pathname !== this.props.pathname && this.setState({ error: void 0 });
|
|
470
|
-
}
|
|
471
|
-
render() {
|
|
472
|
-
return this.state.error !== void 0 ? this.props.Error ? f(this.props.Error, {
|
|
473
|
-
error: this.state.error,
|
|
474
|
-
pathname: this.props.pathname,
|
|
475
|
-
status: N(this.state.error)
|
|
476
|
-
}) : null : this.props.children;
|
|
477
|
-
}
|
|
478
382
|
}
|
|
479
|
-
function
|
|
480
|
-
return
|
|
383
|
+
function Oe(e = {}) {
|
|
384
|
+
return y(e, !1, (t, r) => {
|
|
385
|
+
let n;
|
|
386
|
+
try {
|
|
387
|
+
n = new URL(r);
|
|
388
|
+
} catch {
|
|
389
|
+
throw new Error(`Environment variable ${t} must be a valid URL.`);
|
|
390
|
+
}
|
|
391
|
+
if (e.protocols?.length && !e.protocols.includes(n.protocol))
|
|
392
|
+
throw new Error(
|
|
393
|
+
`Environment variable ${t} must use one of these protocols: ${e.protocols.join(", ")}.`
|
|
394
|
+
);
|
|
395
|
+
return n;
|
|
396
|
+
});
|
|
481
397
|
}
|
|
482
|
-
|
|
398
|
+
const Tt = {
|
|
399
|
+
boolean: Te,
|
|
400
|
+
enum: Ie,
|
|
401
|
+
integer: De,
|
|
402
|
+
secret: Ne,
|
|
403
|
+
string: Ce,
|
|
404
|
+
url: Oe
|
|
405
|
+
};
|
|
406
|
+
function y(e, t, r) {
|
|
483
407
|
return {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
search: window.location.search
|
|
408
|
+
optional: e.optional ?? !1,
|
|
409
|
+
parse: r,
|
|
410
|
+
sensitive: t
|
|
488
411
|
};
|
|
489
412
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
})), n = r.headers.get(z);
|
|
497
|
-
if (n === ae) {
|
|
498
|
-
const a = await r.json();
|
|
499
|
-
if (a.hasData !== !0)
|
|
500
|
-
throw new Error("Demiurge received malformed navigation route data.");
|
|
501
|
-
return { data: a.data, hasData: !0 };
|
|
502
|
-
}
|
|
503
|
-
if (n === ie)
|
|
504
|
-
return { hasData: !0 };
|
|
505
|
-
if (n === oe || !r.ok) {
|
|
506
|
-
const a = await Le(r), i = se.includes(
|
|
507
|
-
r.status
|
|
508
|
-
) ? r.status : 500;
|
|
509
|
-
throw ce(i, {
|
|
510
|
-
detail: typeof a?.detail == "string" ? a.detail : void 0,
|
|
511
|
-
title: typeof a?.title == "string" ? a.title : void 0
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
throw new Error(
|
|
515
|
-
"Demiurge expected a navigation data response from the application server."
|
|
516
|
-
);
|
|
413
|
+
function U(e, t, r) {
|
|
414
|
+
if (r.minLength !== void 0 && t.length < r.minLength)
|
|
415
|
+
throw new Error(
|
|
416
|
+
`Environment variable ${e} must be at least ${r.minLength} characters.`
|
|
417
|
+
);
|
|
418
|
+
return t;
|
|
517
419
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
return await e.json();
|
|
521
|
-
} catch {
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
420
|
+
function Le(e) {
|
|
421
|
+
return e.length === 1 ? e[0].message : `Environment validation failed with ${e.length} issues.`;
|
|
524
422
|
}
|
|
525
|
-
function
|
|
526
|
-
|
|
527
|
-
if (
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
423
|
+
function It(e = {}) {
|
|
424
|
+
return async function(r) {
|
|
425
|
+
if (r.method.toUpperCase() !== "POST")
|
|
426
|
+
return new Response(null, {
|
|
427
|
+
headers: {
|
|
428
|
+
allow: "POST"
|
|
429
|
+
},
|
|
430
|
+
status: 405
|
|
431
|
+
});
|
|
432
|
+
const n = Me(r);
|
|
433
|
+
if (n)
|
|
434
|
+
return n;
|
|
435
|
+
const a = Pe(e, r);
|
|
436
|
+
if (a)
|
|
437
|
+
return a;
|
|
438
|
+
e.maxBodySize !== void 0 && (r = ee({ maxBodySize: e.maxBodySize }, r));
|
|
439
|
+
let i;
|
|
532
440
|
try {
|
|
533
|
-
|
|
534
|
-
} catch {
|
|
535
|
-
|
|
441
|
+
i = await r.json();
|
|
442
|
+
} catch (o) {
|
|
443
|
+
return o instanceof te ? new Response("Security report body too large.", { status: 413 }) : new Response("Invalid security report JSON.", {
|
|
444
|
+
status: 400
|
|
445
|
+
});
|
|
536
446
|
}
|
|
537
|
-
|
|
447
|
+
const s = Ue(i);
|
|
448
|
+
for (let o = 0; o < s.length; o += 1)
|
|
449
|
+
await e.onReport?.(s[o], {
|
|
450
|
+
index: o,
|
|
451
|
+
request: r
|
|
452
|
+
});
|
|
453
|
+
return new Response(null, {
|
|
454
|
+
status: 204
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
const ze = /* @__PURE__ */ new Set([
|
|
459
|
+
"application/csp-report",
|
|
460
|
+
"application/reports+json"
|
|
461
|
+
]);
|
|
462
|
+
function Me(e) {
|
|
463
|
+
const t = e.headers.get("content-type");
|
|
464
|
+
if (!t)
|
|
465
|
+
return null;
|
|
466
|
+
const r = t.split(";", 1)[0]?.trim().toLowerCase();
|
|
467
|
+
return r && ze.has(r) ? null : new Response("Unsupported security report Content-Type.", {
|
|
468
|
+
status: 415
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
function Pe(e, t) {
|
|
472
|
+
if (e.maxBodySize === void 0)
|
|
473
|
+
return null;
|
|
474
|
+
const r = t.headers.get("content-length");
|
|
475
|
+
if (!r)
|
|
476
|
+
return null;
|
|
477
|
+
if (!/^\d+$/.test(r))
|
|
478
|
+
return new Response("Invalid Content-Length.", {
|
|
479
|
+
status: 400
|
|
480
|
+
});
|
|
481
|
+
const n = Number(r);
|
|
482
|
+
return Number.isSafeInteger(n) ? n > $(e.maxBodySize) ? new Response("Security report body too large.", {
|
|
483
|
+
status: 413
|
|
484
|
+
}) : null : new Response("Invalid Content-Length.", {
|
|
485
|
+
status: 400
|
|
538
486
|
});
|
|
539
487
|
}
|
|
540
488
|
function Ue(e) {
|
|
541
|
-
return e
|
|
489
|
+
return Array.isArray(e) ? e : je(e) && "csp-report" in e ? [e["csp-report"]] : [e];
|
|
542
490
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
491
|
+
function je(e) {
|
|
492
|
+
return typeof e == "object" && e !== null;
|
|
493
|
+
}
|
|
494
|
+
function Dt(e, t) {
|
|
495
|
+
const r = {}, n = [];
|
|
496
|
+
let a = 0;
|
|
497
|
+
for (const [i, s] of Object.entries(t.files)) {
|
|
498
|
+
const o = e.getAll(i).filter(Be);
|
|
499
|
+
r[i] = o, s.required && o.length === 0 && n.push({
|
|
500
|
+
code: "file-missing",
|
|
501
|
+
field: i,
|
|
502
|
+
message: `Upload field ${i} requires at least one file.`
|
|
503
|
+
});
|
|
504
|
+
for (const u of o)
|
|
505
|
+
a += u.size, Fe(i, u, s, n);
|
|
547
506
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
507
|
+
return t.maxTotalSize !== void 0 && a > $(t.maxTotalSize) && n.push({
|
|
508
|
+
code: "total-upload-too-large",
|
|
509
|
+
field: "*",
|
|
510
|
+
message: `Uploaded files exceed the maximum total size of ${t.maxTotalSize}.`
|
|
511
|
+
}), {
|
|
512
|
+
files: r,
|
|
513
|
+
issues: n,
|
|
514
|
+
ok: n.length === 0,
|
|
515
|
+
totalSize: a
|
|
516
|
+
};
|
|
551
517
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
518
|
+
function Fe(e, t, r, n) {
|
|
519
|
+
r.maxSize !== void 0 && t.size > $(r.maxSize) && n.push({
|
|
520
|
+
code: "file-too-large",
|
|
521
|
+
field: e,
|
|
522
|
+
message: `Upload field ${e} contains ${t.name || "a file"} larger than ${r.maxSize}.`
|
|
523
|
+
}), r.types?.length && !He(t.type, r.types) && n.push({
|
|
524
|
+
code: "file-type-not-allowed",
|
|
525
|
+
field: e,
|
|
526
|
+
message: `Upload field ${e} contains ${t.name || "a file"} with disallowed type ${t.type || "unknown"}.`
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
function He(e, t) {
|
|
530
|
+
return t.some((r) => r.endsWith("/*") ? e.startsWith(r.slice(0, -1)) : e === r);
|
|
555
531
|
}
|
|
556
|
-
function
|
|
557
|
-
return
|
|
532
|
+
function Be(e) {
|
|
533
|
+
return e instanceof File;
|
|
558
534
|
}
|
|
559
|
-
function
|
|
560
|
-
const r =
|
|
535
|
+
function qe(e, t) {
|
|
536
|
+
const r = t.headers.get("origin");
|
|
561
537
|
if (!r)
|
|
562
|
-
throw new Error(`Image source "${e.src}" is not allowed by the image policy.`);
|
|
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);
|
|
566
538
|
return {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
539
|
+
allowed: !!e.allowMissingOrigin,
|
|
540
|
+
expected: e.origins,
|
|
541
|
+
origin: r,
|
|
542
|
+
reason: e.allowMissingOrigin ? void 0 : "missing-origin"
|
|
543
|
+
};
|
|
544
|
+
const n = j(r);
|
|
545
|
+
if (!n)
|
|
546
|
+
return {
|
|
547
|
+
allowed: !1,
|
|
548
|
+
expected: e.origins,
|
|
549
|
+
origin: r,
|
|
550
|
+
reason: "invalid-origin"
|
|
577
551
|
};
|
|
578
|
-
|
|
552
|
+
const a = _e(e, n, t);
|
|
579
553
|
return {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
loading: e.priority ? "eager" : "lazy",
|
|
585
|
-
sizes: e.sizes,
|
|
586
|
-
source: r,
|
|
587
|
-
src: s.src,
|
|
588
|
-
srcSet: i.map((o) => `${o.src} ${o.width}w`).join(", "),
|
|
589
|
-
variants: i,
|
|
590
|
-
width: e.width
|
|
554
|
+
allowed: a,
|
|
555
|
+
expected: e.origins,
|
|
556
|
+
origin: n,
|
|
557
|
+
reason: a ? void 0 : "origin-not-allowed"
|
|
591
558
|
};
|
|
592
559
|
}
|
|
593
|
-
function
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
try {
|
|
598
|
-
r = new URL(e);
|
|
599
|
-
} catch {
|
|
600
|
-
return null;
|
|
601
|
-
}
|
|
602
|
-
return r.protocol !== "https:" && r.protocol !== "http:" ? null : je(r, t.remote ?? []) ? { kind: "remote", src: r.toString() } : null;
|
|
560
|
+
function Nt(e, t) {
|
|
561
|
+
return !e || qe(e, t).allowed ? null : new Response("WebSocket origin not allowed.", {
|
|
562
|
+
status: 403
|
|
563
|
+
});
|
|
603
564
|
}
|
|
604
|
-
function
|
|
605
|
-
return t.some(
|
|
606
|
-
(
|
|
565
|
+
function _e(e, t, r) {
|
|
566
|
+
return e.origins === "same-origin" ? t === new URL(r.url).origin : e.origins.some(
|
|
567
|
+
(n) => Ve(n, t)
|
|
607
568
|
);
|
|
608
569
|
}
|
|
609
|
-
function
|
|
570
|
+
function Ve(e, t) {
|
|
571
|
+
return e === "null" ? t === "null" : j(e) === t;
|
|
572
|
+
}
|
|
573
|
+
function j(e) {
|
|
574
|
+
if (e === "null")
|
|
575
|
+
return e;
|
|
610
576
|
try {
|
|
611
|
-
|
|
577
|
+
if (e !== e.trim())
|
|
578
|
+
return null;
|
|
579
|
+
const t = e.indexOf("://");
|
|
580
|
+
if (t === -1)
|
|
581
|
+
return null;
|
|
582
|
+
const r = e.slice(t + 3);
|
|
583
|
+
if (!r || /[/?#]/.test(r))
|
|
584
|
+
return null;
|
|
585
|
+
const n = new URL(e);
|
|
586
|
+
return n.protocol !== "http:" && n.protocol !== "https:" || n.username || n.password ? null : n.origin;
|
|
612
587
|
} catch {
|
|
613
|
-
return
|
|
588
|
+
return null;
|
|
614
589
|
}
|
|
615
590
|
}
|
|
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) {
|
|
620
|
-
return t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : e === t;
|
|
621
|
-
}
|
|
622
|
-
function x(e, t) {
|
|
623
|
-
if (!Number.isInteger(t) || t <= 0)
|
|
624
|
-
throw new Error(`Image ${e} must be a positive integer.`);
|
|
625
|
-
}
|
|
626
591
|
function We(e) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
}
|
|
704
|
-
function Ge(e) {
|
|
705
|
-
|
|
592
|
+
const t = M(e.routes), r = e.loadNavigationData ?? H;
|
|
593
|
+
return function() {
|
|
594
|
+
const [a, i] = T(() => S()), [s, o] = T(
|
|
595
|
+
() => e.initialMatch ?? { status: "loading" }
|
|
596
|
+
), u = I(!!e.initialMatch), d = I(0);
|
|
597
|
+
D(() => {
|
|
598
|
+
function c() {
|
|
599
|
+
i(S());
|
|
600
|
+
}
|
|
601
|
+
return window.addEventListener("popstate", c), () => window.removeEventListener("popstate", c);
|
|
602
|
+
}, []), D(() => {
|
|
603
|
+
let c = !1, l = !1;
|
|
604
|
+
const m = ++d.current, R = new AbortController(), v = () => !c && m === d.current;
|
|
605
|
+
if (u.current && Ge(e.initialMatch) === a.pathname)
|
|
606
|
+
return u.current = !1, () => {
|
|
607
|
+
c = !0;
|
|
608
|
+
};
|
|
609
|
+
o({ status: "loading" }), ne(t, a.pathname).then((h) => {
|
|
610
|
+
v() && !l && h && o({ loading: h, status: "loading" });
|
|
611
|
+
}).catch(() => {
|
|
612
|
+
});
|
|
613
|
+
const k = new Request(a.href, { signal: R.signal });
|
|
614
|
+
return Promise.resolve(r(k)).then(
|
|
615
|
+
(h) => P(
|
|
616
|
+
t,
|
|
617
|
+
a.pathname,
|
|
618
|
+
k,
|
|
619
|
+
h,
|
|
620
|
+
void 0,
|
|
621
|
+
{ documentContributions: !1 }
|
|
622
|
+
)
|
|
623
|
+
).then((h) => {
|
|
624
|
+
l = !0, v() && o(h);
|
|
625
|
+
}).catch(async (h) => {
|
|
626
|
+
if (l = !0, !v() || R.signal.aborted)
|
|
627
|
+
return;
|
|
628
|
+
const q = await ae(
|
|
629
|
+
t,
|
|
630
|
+
a.pathname
|
|
631
|
+
);
|
|
632
|
+
v() && o({
|
|
633
|
+
Error: q,
|
|
634
|
+
error: h,
|
|
635
|
+
pathname: a.pathname,
|
|
636
|
+
status: "error"
|
|
637
|
+
});
|
|
638
|
+
}), () => {
|
|
639
|
+
c = !0, R.abort();
|
|
640
|
+
};
|
|
641
|
+
}, [a.pathname, a.search]);
|
|
642
|
+
const g = V(
|
|
643
|
+
() => ({
|
|
644
|
+
navigation: e.navigation ?? "server",
|
|
645
|
+
push(c) {
|
|
646
|
+
const l = S();
|
|
647
|
+
window.history.pushState(null, "", c);
|
|
648
|
+
const m = S();
|
|
649
|
+
i(m), l.pathname === m.pathname && l.search === m.search && l.hash !== m.hash && Qe(m.hash);
|
|
650
|
+
}
|
|
651
|
+
}),
|
|
652
|
+
[]
|
|
653
|
+
);
|
|
654
|
+
return f(B.Provider, {
|
|
655
|
+
value: g,
|
|
656
|
+
children: f(Ye, {
|
|
657
|
+
key: `${a.pathname}${a.search}`,
|
|
658
|
+
Loading: e.loading,
|
|
659
|
+
NotFound: e.notFound,
|
|
660
|
+
match: s
|
|
661
|
+
})
|
|
662
|
+
});
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
function Ke(e, t) {
|
|
666
|
+
const r = t.getAttribute(Y);
|
|
667
|
+
return e.status === "not-found" ? r === "not-found" : e.status === "ready" && r === null;
|
|
668
|
+
}
|
|
669
|
+
function Ge(e) {
|
|
670
|
+
if (e)
|
|
671
|
+
return e.status === "ready" ? e.match.pathname : e.status === "loading" ? void 0 : e.pathname;
|
|
672
|
+
}
|
|
673
|
+
async function Ct(e) {
|
|
674
|
+
const t = e.root ?? document.getElementById("root");
|
|
675
|
+
if (!t)
|
|
676
|
+
throw new Error(
|
|
677
|
+
"Demiurge expected a #root element in the framework document."
|
|
678
|
+
);
|
|
679
|
+
const r = M(e.routes), n = e.loadNavigationData ?? H, a = e.initialData ?? G(document), i = await P(
|
|
680
|
+
r,
|
|
681
|
+
window.location.pathname,
|
|
682
|
+
new Request(window.location.href),
|
|
683
|
+
a ?? await n(new Request(window.location.href)),
|
|
684
|
+
void 0,
|
|
685
|
+
{ documentContributions: !1 }
|
|
686
|
+
), s = Ke(i, t), o = We(
|
|
687
|
+
s ? {
|
|
688
|
+
...e,
|
|
689
|
+
initialMatch: i,
|
|
690
|
+
loadNavigationData: n,
|
|
691
|
+
navigation: a?.navigation ?? e.navigation
|
|
692
|
+
} : {
|
|
693
|
+
...e,
|
|
694
|
+
loadNavigationData: n,
|
|
695
|
+
navigation: a?.navigation ?? e.navigation
|
|
696
|
+
}
|
|
697
|
+
), { createRoot: u, hydrateRoot: d } = Ze(
|
|
698
|
+
await import("react-dom/client")
|
|
699
|
+
);
|
|
700
|
+
if (s && t.hasAttribute(Z)) {
|
|
701
|
+
d(t, f(o)), N();
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
t.replaceChildren(), u(t).render(f(o)), N();
|
|
705
|
+
}
|
|
706
|
+
function Ze(e) {
|
|
707
|
+
const t = typeof e.createRoot == "function" && typeof e.hydrateRoot == "function" ? e : e.default;
|
|
708
|
+
if (!t || typeof t.createRoot != "function" || typeof t.hydrateRoot != "function")
|
|
709
|
+
throw new Error(
|
|
710
|
+
"Demiurge could not load the React DOM client from the Vite module."
|
|
711
|
+
);
|
|
712
|
+
return t;
|
|
713
|
+
}
|
|
714
|
+
function Ot(e) {
|
|
715
|
+
const t = tt(), r = re(e);
|
|
716
|
+
return /* @__PURE__ */ z(
|
|
717
|
+
"a",
|
|
718
|
+
{
|
|
719
|
+
className: e.className,
|
|
720
|
+
href: r,
|
|
721
|
+
onClick: (n) => {
|
|
722
|
+
t.navigation === "server" && et(n) && (n.preventDefault(), t.push(r));
|
|
723
|
+
},
|
|
724
|
+
children: e.children
|
|
725
|
+
}
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
function Ye({
|
|
729
|
+
Loading: e,
|
|
730
|
+
NotFound: t,
|
|
731
|
+
match: r
|
|
732
|
+
}) {
|
|
733
|
+
if (r.status === "loading") {
|
|
734
|
+
const c = r.loading ?? e;
|
|
735
|
+
return c ? f(c) : null;
|
|
736
|
+
}
|
|
737
|
+
if (r.status === "not-found") {
|
|
738
|
+
const c = r.notFound ?? t ?? fe;
|
|
739
|
+
return r.layouts.reduceRight(
|
|
740
|
+
(l, m) => f(m, {
|
|
741
|
+
children: l,
|
|
742
|
+
path: {},
|
|
743
|
+
pathname: r.pathname
|
|
744
|
+
}),
|
|
745
|
+
f(c, { pathname: r.pathname })
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
if (r.status === "error")
|
|
749
|
+
return r.Error ? f(r.Error, {
|
|
750
|
+
error: r.error,
|
|
751
|
+
pathname: r.pathname,
|
|
752
|
+
status: F(r.error)
|
|
753
|
+
}) : null;
|
|
754
|
+
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(
|
|
755
|
+
(c, l) => f(l, { path: o, pathname: u, children: c }),
|
|
756
|
+
d
|
|
757
|
+
);
|
|
758
|
+
return f(Xe, {
|
|
759
|
+
Error: a,
|
|
760
|
+
children: g,
|
|
761
|
+
pathname: u
|
|
762
|
+
});
|
|
706
763
|
}
|
|
707
|
-
|
|
708
|
-
|
|
764
|
+
class Xe extends K {
|
|
765
|
+
static getDerivedStateFromError(t) {
|
|
766
|
+
return { error: t };
|
|
767
|
+
}
|
|
768
|
+
state = {};
|
|
769
|
+
componentDidUpdate(t) {
|
|
770
|
+
this.state.error !== void 0 && t.pathname !== this.props.pathname && this.setState({ error: void 0 });
|
|
771
|
+
}
|
|
772
|
+
render() {
|
|
773
|
+
return this.state.error !== void 0 ? this.props.Error ? f(this.props.Error, {
|
|
774
|
+
error: this.state.error,
|
|
775
|
+
pathname: this.props.pathname,
|
|
776
|
+
status: F(this.state.error)
|
|
777
|
+
}) : null : this.props.children;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
function F(e) {
|
|
781
|
+
return de(e) ? e.status : 500;
|
|
782
|
+
}
|
|
783
|
+
function S() {
|
|
784
|
+
return {
|
|
785
|
+
hash: window.location.hash,
|
|
786
|
+
href: window.location.href,
|
|
787
|
+
pathname: window.location.pathname,
|
|
788
|
+
search: window.location.search
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
async function H(e) {
|
|
792
|
+
const t = new Headers(e.headers);
|
|
793
|
+
t.set("accept", "application/json"), t.set(O, ie);
|
|
794
|
+
const r = await fetch(new Request(e, {
|
|
795
|
+
credentials: "same-origin",
|
|
796
|
+
headers: t
|
|
797
|
+
})), n = r.headers.get(O);
|
|
798
|
+
if (n === oe) {
|
|
799
|
+
const a = await r.json();
|
|
800
|
+
if (a.hasData !== !0)
|
|
801
|
+
throw new Error("Demiurge received malformed navigation route data.");
|
|
802
|
+
return { data: a.data, hasData: !0 };
|
|
803
|
+
}
|
|
804
|
+
if (n === se)
|
|
805
|
+
return { hasData: !0 };
|
|
806
|
+
if (n === ce || !r.ok) {
|
|
807
|
+
const a = await Je(r), i = ue.includes(
|
|
808
|
+
r.status
|
|
809
|
+
) ? r.status : 500;
|
|
810
|
+
throw le(i, {
|
|
811
|
+
detail: typeof a?.detail == "string" ? a.detail : void 0,
|
|
812
|
+
title: typeof a?.title == "string" ? a.title : void 0
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
throw new Error(
|
|
816
|
+
"Demiurge expected a navigation data response from the application server."
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
async function Je(e) {
|
|
820
|
+
try {
|
|
821
|
+
return await e.json();
|
|
822
|
+
} catch {
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
function Qe(e) {
|
|
827
|
+
queueMicrotask(() => {
|
|
828
|
+
if (!e) {
|
|
829
|
+
window.scrollTo?.(0, 0);
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
let t;
|
|
833
|
+
try {
|
|
834
|
+
t = decodeURIComponent(e.slice(1));
|
|
835
|
+
} catch {
|
|
836
|
+
t = e.slice(1);
|
|
837
|
+
}
|
|
838
|
+
document.getElementById(t)?.scrollIntoView?.();
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
function et(e) {
|
|
842
|
+
return e.button === 0 && !e.metaKey && !e.altKey && !e.ctrlKey && !e.shiftKey;
|
|
709
843
|
}
|
|
710
|
-
|
|
711
|
-
|
|
844
|
+
const B = _({
|
|
845
|
+
navigation: "document",
|
|
846
|
+
push(e) {
|
|
847
|
+
window.location.href = e;
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
function tt() {
|
|
851
|
+
return W(B);
|
|
852
|
+
}
|
|
853
|
+
function Lt({ className: e, id: t, policy: r, ...n }) {
|
|
854
|
+
const a = me(n, r);
|
|
855
|
+
return /* @__PURE__ */ z(
|
|
856
|
+
"img",
|
|
857
|
+
{
|
|
858
|
+
alt: a.alt,
|
|
859
|
+
className: e,
|
|
860
|
+
decoding: a.decoding,
|
|
861
|
+
fetchPriority: a.fetchPriority,
|
|
862
|
+
height: a.height,
|
|
863
|
+
id: t,
|
|
864
|
+
loading: a.loading,
|
|
865
|
+
sizes: a.sizes,
|
|
866
|
+
src: a.src,
|
|
867
|
+
srcSet: a.srcSet,
|
|
868
|
+
width: a.width
|
|
869
|
+
}
|
|
870
|
+
);
|
|
712
871
|
}
|
|
713
|
-
const
|
|
872
|
+
const rt = "https://js.sentry-cdn.com", zt = {
|
|
873
|
+
/**
|
|
874
|
+
* Plausible loads one script and posts events to its own API. The snippet
|
|
875
|
+
* carries configuration in `data-domain`, so no inline code is involved.
|
|
876
|
+
* `endpoint` accepts a same-origin path prefix for a proxied deployment.
|
|
877
|
+
*/
|
|
714
878
|
plausible(e) {
|
|
715
|
-
const t =
|
|
879
|
+
const t = nt(e.domain), r = L(e.endpoint ?? "https://plausible.io");
|
|
716
880
|
return {
|
|
717
|
-
connectSrc: r.origin,
|
|
718
881
|
consent: e.consent ?? !1,
|
|
719
882
|
domain: t,
|
|
720
883
|
kind: "analytics",
|
|
884
|
+
needs: {
|
|
885
|
+
connect: [r.source],
|
|
886
|
+
script: [r.source]
|
|
887
|
+
},
|
|
721
888
|
provider: "plausible",
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
889
|
+
scripts: [
|
|
890
|
+
A({
|
|
891
|
+
dataApi: `${r.base}/api/event`,
|
|
892
|
+
dataDomain: t,
|
|
893
|
+
defer: !0,
|
|
894
|
+
needs: { connect: [r.source] },
|
|
895
|
+
purpose: "analytics",
|
|
896
|
+
src: `${r.base}/js/script.js`,
|
|
897
|
+
strategy: e.strategy ?? "afterInteractive"
|
|
898
|
+
})
|
|
899
|
+
]
|
|
900
|
+
};
|
|
901
|
+
},
|
|
902
|
+
/**
|
|
903
|
+
* The Sentry loader script carries the DSN in its own filename, so a page
|
|
904
|
+
* needs no inline configuration call. Events go to the DSN host, which is
|
|
905
|
+
* why the integration also declares a `connect-src` need.
|
|
906
|
+
*/
|
|
907
|
+
sentry(e) {
|
|
908
|
+
const t = ot(e.dsn), r = it(
|
|
909
|
+
e.loaderHost ?? rt,
|
|
910
|
+
"Sentry loader host"
|
|
911
|
+
);
|
|
912
|
+
return {
|
|
913
|
+
consent: e.consent ?? !1,
|
|
914
|
+
ingestOrigin: t.origin,
|
|
915
|
+
kind: "analytics",
|
|
916
|
+
needs: {
|
|
917
|
+
connect: [t.origin],
|
|
918
|
+
script: [r]
|
|
919
|
+
},
|
|
920
|
+
projectId: t.projectId,
|
|
921
|
+
provider: "sentry",
|
|
922
|
+
scripts: [
|
|
923
|
+
A({
|
|
924
|
+
crossOrigin: "anonymous",
|
|
925
|
+
needs: { connect: [t.origin] },
|
|
926
|
+
purpose: "error-monitoring",
|
|
927
|
+
src: `${r}/${t.publicKey}.min.js`,
|
|
928
|
+
// Errors thrown before the app is interactive are the ones an
|
|
929
|
+
// application can least afford to lose.
|
|
930
|
+
strategy: e.strategy ?? "beforeInteractive"
|
|
931
|
+
})
|
|
932
|
+
]
|
|
933
|
+
};
|
|
934
|
+
},
|
|
935
|
+
/**
|
|
936
|
+
* OpenTelemetry publishes no hosted browser loader. Browser instrumentation
|
|
937
|
+
* is application code bundled from npm packages, so this helper describes
|
|
938
|
+
* the part a policy has to know about: the OTLP endpoint the exporter posts
|
|
939
|
+
* to, and an optional same-origin entry script that starts the SDK.
|
|
940
|
+
*/
|
|
941
|
+
openTelemetry(e) {
|
|
942
|
+
const t = L(e.endpoint), r = e.script;
|
|
943
|
+
if (r !== void 0 && !r.startsWith("/"))
|
|
944
|
+
throw new Error(
|
|
945
|
+
"OpenTelemetry browser instrumentation must be a same-origin script path."
|
|
946
|
+
);
|
|
947
|
+
return {
|
|
948
|
+
consent: e.consent ?? !1,
|
|
949
|
+
endpoint: t.base || "/",
|
|
950
|
+
kind: "analytics",
|
|
951
|
+
needs: r ? { connect: [t.source], script: ["'self'"] } : { connect: [t.source] },
|
|
952
|
+
provider: "opentelemetry",
|
|
953
|
+
scripts: r ? [
|
|
954
|
+
A({
|
|
955
|
+
needs: { connect: [t.source] },
|
|
956
|
+
purpose: "observability",
|
|
957
|
+
src: r,
|
|
958
|
+
strategy: e.strategy ?? "module"
|
|
959
|
+
})
|
|
960
|
+
] : []
|
|
729
961
|
};
|
|
962
|
+
},
|
|
963
|
+
/** Merges the CSP needs of every integration into one route policy. */
|
|
964
|
+
policy(...e) {
|
|
965
|
+
const t = {};
|
|
966
|
+
for (const r of e)
|
|
967
|
+
for (const n of ["connect", "img", "script"]) {
|
|
968
|
+
const a = r.needs[n];
|
|
969
|
+
!a || a.length === 0 || (t[n] = [.../* @__PURE__ */ new Set([...t[n] ?? [], ...a])]);
|
|
970
|
+
}
|
|
971
|
+
return { security: { needs: t } };
|
|
972
|
+
},
|
|
973
|
+
/** Collects the script contributions of every integration. */
|
|
974
|
+
scripts(...e) {
|
|
975
|
+
return e.flatMap((t) => [...t.scripts]);
|
|
730
976
|
}
|
|
731
977
|
};
|
|
732
|
-
function
|
|
978
|
+
function nt(e) {
|
|
733
979
|
const t = e.trim();
|
|
734
980
|
if (!t || t.includes("/") || t.includes(" "))
|
|
735
981
|
throw new Error("Analytics domain must be a hostname without a path.");
|
|
736
982
|
return t;
|
|
737
983
|
}
|
|
738
|
-
function
|
|
984
|
+
function L(e) {
|
|
985
|
+
if (e.startsWith("/")) {
|
|
986
|
+
if (e.startsWith("//"))
|
|
987
|
+
throw new Error("Analytics endpoint must not be a scheme-relative URL.");
|
|
988
|
+
return {
|
|
989
|
+
base: e === "/" ? "" : e.replace(/\/+$/, ""),
|
|
990
|
+
source: "'self'"
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
const t = at(e);
|
|
994
|
+
return { base: t.origin, source: t.origin };
|
|
995
|
+
}
|
|
996
|
+
function at(e) {
|
|
739
997
|
let t;
|
|
740
998
|
try {
|
|
741
999
|
t = new URL(e);
|
|
@@ -746,7 +1004,40 @@ function Ze(e) {
|
|
|
746
1004
|
throw new Error("Analytics endpoint must use HTTPS.");
|
|
747
1005
|
return t;
|
|
748
1006
|
}
|
|
749
|
-
function
|
|
1007
|
+
function it(e, t) {
|
|
1008
|
+
let r;
|
|
1009
|
+
try {
|
|
1010
|
+
r = new URL(e);
|
|
1011
|
+
} catch {
|
|
1012
|
+
throw new Error(`${t} must be an absolute URL.`);
|
|
1013
|
+
}
|
|
1014
|
+
if (r.protocol !== "https:")
|
|
1015
|
+
throw new Error(`${t} must use HTTPS.`);
|
|
1016
|
+
return r.origin;
|
|
1017
|
+
}
|
|
1018
|
+
function ot(e) {
|
|
1019
|
+
let t;
|
|
1020
|
+
try {
|
|
1021
|
+
t = new URL(e);
|
|
1022
|
+
} catch {
|
|
1023
|
+
throw new Error("Sentry DSN must be an absolute URL.");
|
|
1024
|
+
}
|
|
1025
|
+
if (t.protocol !== "https:")
|
|
1026
|
+
throw new Error("Sentry DSN must use HTTPS.");
|
|
1027
|
+
const r = t.pathname.replace(/^\//, "");
|
|
1028
|
+
if (!t.username || t.password)
|
|
1029
|
+
throw new Error(
|
|
1030
|
+
"Sentry DSN must carry a public key and no secret key."
|
|
1031
|
+
);
|
|
1032
|
+
if (!/^[A-Za-z0-9_-]+$/.test(r))
|
|
1033
|
+
throw new Error("Sentry DSN must end with a project identifier.");
|
|
1034
|
+
return {
|
|
1035
|
+
origin: t.origin,
|
|
1036
|
+
projectId: r,
|
|
1037
|
+
publicKey: t.username
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
function Mt(e = {}) {
|
|
750
1041
|
return {
|
|
751
1042
|
async request(t) {
|
|
752
1043
|
await E({ kind: "request", signal: t }, e);
|
|
@@ -765,564 +1056,124 @@ function ir(e = {}) {
|
|
|
765
1056
|
async function E(e, t) {
|
|
766
1057
|
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);
|
|
767
1058
|
}
|
|
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(
|
|
774
|
-
r.policy.csp,
|
|
775
|
-
r.scripts,
|
|
776
|
-
r.headers,
|
|
777
|
-
t
|
|
778
|
-
), r.scriptDependencies && t.push(
|
|
779
|
-
...Je(
|
|
780
|
-
r.scripts,
|
|
781
|
-
rt(r.scriptDependencies)
|
|
782
|
-
)
|
|
783
|
-
)), {
|
|
784
|
-
findings: t,
|
|
785
|
-
headers: n,
|
|
786
|
-
route: a
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
function Xe(e, t) {
|
|
790
|
-
if (!e.trustedTypes || e.trustedTypes.mode !== "report-only")
|
|
791
|
-
return;
|
|
792
|
-
const r = e.csp || void 0, n = !!r?.reportUri?.length, a = e.headers?.reportingEndpoints, i = !!(r?.reportTo && a && a[r.reportTo]);
|
|
793
|
-
!n && !i && t.push({
|
|
794
|
-
code: "report-only-target-missing",
|
|
795
|
-
message: "Trusted Types report-only mode has no deliverable target. Configure CSP reportTo with a matching Reporting-Endpoints member, reportUri for compatibility, or both.",
|
|
796
|
-
severity: "warning"
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
function Je(e, t = {}) {
|
|
800
|
-
const r = t.requirePurpose ?? !0, n = [];
|
|
801
|
-
for (const a of e) {
|
|
802
|
-
const i = ft(a);
|
|
803
|
-
i && (r && !a.purpose && n.push({
|
|
804
|
-
code: "script-purpose-missing",
|
|
805
|
-
message: `Third-party script ${a.src} should declare a purpose for audits and consent flows.`,
|
|
806
|
-
severity: "warning"
|
|
807
|
-
}), t.requireIntegrity && !a.integrity && n.push({
|
|
808
|
-
code: "script-integrity-missing",
|
|
809
|
-
message: `Third-party script ${a.src} should declare an integrity hash or an explicit trust-boundary exception.`,
|
|
810
|
-
severity: "warning"
|
|
811
|
-
}), a.strategy === "beforeInteractive" && !t.allowBeforeInteractiveThirdParty && n.push({
|
|
812
|
-
code: "script-third-party-before-interactive",
|
|
813
|
-
message: `Third-party script ${a.src} runs before the app is interactive and should be justified by policy.`,
|
|
814
|
-
severity: "warning"
|
|
815
|
-
}), dt(i) && n.push({
|
|
816
|
-
code: "script-gtm-wide-trust-boundary",
|
|
817
|
-
message: "Google Tag Manager can load additional scripts at runtime and should be treated as a wide trust boundary.",
|
|
818
|
-
severity: "warning"
|
|
819
|
-
}));
|
|
820
|
-
}
|
|
821
|
-
return n;
|
|
822
|
-
}
|
|
823
|
-
function et(e, t, r) {
|
|
824
|
-
try {
|
|
825
|
-
return Object.fromEntries(de(e, t));
|
|
826
|
-
} catch (n) {
|
|
827
|
-
return r.push({
|
|
828
|
-
code: "security-header-render-failed",
|
|
829
|
-
message: n instanceof Error ? n.message : "Security headers failed to render.",
|
|
830
|
-
severity: "error"
|
|
831
|
-
}), {};
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
function tt(e, t, r, n) {
|
|
835
|
-
if (!e)
|
|
836
|
-
return;
|
|
837
|
-
const a = nt(e);
|
|
838
|
-
for (const i of t) {
|
|
839
|
-
if (at(a) && !i.nonce) {
|
|
840
|
-
n.push({
|
|
841
|
-
code: "csp-script-missing-nonce",
|
|
842
|
-
message: `Document script ${i.src} needs a nonce for the effective script-src policy.`,
|
|
843
|
-
severity: "error"
|
|
844
|
-
});
|
|
845
|
-
continue;
|
|
846
|
-
}
|
|
847
|
-
i.nonce && r?.nonce && i.nonce === r.nonce || it(a, i.src) || n.push({
|
|
848
|
-
code: "csp-script-src-blocked",
|
|
849
|
-
message: `Document script ${i.src} is not allowed by the effective script-src policy.`,
|
|
850
|
-
severity: "error"
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
function rt(e) {
|
|
855
|
-
return typeof e == "boolean" ? {} : e;
|
|
856
|
-
}
|
|
857
|
-
function nt(e) {
|
|
858
|
-
return e.scriptSrc ?? e.defaultSrc ?? [];
|
|
859
|
-
}
|
|
860
|
-
function at(e) {
|
|
861
|
-
return e.some((t) => t.includes("'nonce-{nonce}'"));
|
|
862
|
-
}
|
|
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));
|
|
865
|
-
}
|
|
866
|
-
function ot(e) {
|
|
867
|
-
return e.startsWith("/") && !e.startsWith("//");
|
|
868
|
-
}
|
|
869
|
-
function st(e, t) {
|
|
870
|
-
if (e.startsWith("'"))
|
|
871
|
-
return !1;
|
|
872
|
-
try {
|
|
873
|
-
const r = new URL(e), n = new URL(t);
|
|
874
|
-
return n.protocol === r.protocol && n.hostname === r.hostname && n.port === r.port && (r.pathname === "/" || n.pathname.startsWith(r.pathname));
|
|
875
|
-
} catch {
|
|
876
|
-
return !1;
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
function ct(e, t) {
|
|
880
|
-
return ut(e.cors, t), lt(e.method, e.security, t), {
|
|
881
|
-
cors: e.cors,
|
|
882
|
-
method: e.method,
|
|
883
|
-
security: e.security
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
function ut(e, t) {
|
|
887
|
-
if (e)
|
|
888
|
-
try {
|
|
889
|
-
he(e);
|
|
890
|
-
} catch (r) {
|
|
891
|
-
t.push({
|
|
892
|
-
code: "cors-invalid",
|
|
893
|
-
message: r instanceof Error ? r.message : "CORS policy is invalid.",
|
|
894
|
-
severity: "error"
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
function lt(e, t, r) {
|
|
899
|
-
Qe.has(e) && (t?.csrf === !1 && r.push({
|
|
900
|
-
code: "csrf-disabled",
|
|
901
|
-
message: "CSRF protection is explicitly disabled for this unsafe route.",
|
|
902
|
-
severity: "info"
|
|
903
|
-
}), t?.rateLimit || r.push({
|
|
904
|
-
code: "rate-limit-missing",
|
|
905
|
-
message: "Unsafe routes should declare rate limiting.",
|
|
906
|
-
severity: "warning"
|
|
907
|
-
}), t?.request?.maxBodySize || r.push({
|
|
908
|
-
code: "request-body-limit-missing",
|
|
909
|
-
message: "Unsafe routes should declare a request body size limit.",
|
|
910
|
-
severity: "warning"
|
|
911
|
-
}));
|
|
912
|
-
}
|
|
913
|
-
function ft(e) {
|
|
914
|
-
try {
|
|
915
|
-
const t = new URL(e.src);
|
|
916
|
-
if (t.protocol === "http:" || t.protocol === "https:")
|
|
917
|
-
return t;
|
|
918
|
-
} catch {
|
|
919
|
-
return null;
|
|
920
|
-
}
|
|
921
|
-
return null;
|
|
922
|
-
}
|
|
923
|
-
function dt(e) {
|
|
924
|
-
return e.hostname === "www.googletagmanager.com" && (e.pathname === "/gtm.js" || e.pathname === "/ns.html");
|
|
925
|
-
}
|
|
926
|
-
class ht extends Error {
|
|
927
|
-
issues;
|
|
928
|
-
constructor(t) {
|
|
929
|
-
super(bt(t)), this.name = "EnvValidationError", this.issues = t;
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
function sr(e) {
|
|
933
|
-
return e;
|
|
934
|
-
}
|
|
935
|
-
function cr(e, t) {
|
|
936
|
-
const r = [], n = {};
|
|
937
|
-
for (const a of Object.keys(e)) {
|
|
938
|
-
const i = e[a], s = t[String(a)];
|
|
939
|
-
if (s === void 0 || s === "") {
|
|
940
|
-
if (i.optional) {
|
|
941
|
-
n[a] = void 0;
|
|
942
|
-
continue;
|
|
943
|
-
}
|
|
944
|
-
r.push({
|
|
945
|
-
code: "missing",
|
|
946
|
-
key: String(a),
|
|
947
|
-
message: `Environment variable ${String(a)} is required.`
|
|
948
|
-
});
|
|
949
|
-
continue;
|
|
950
|
-
}
|
|
951
|
-
try {
|
|
952
|
-
n[a] = i.parse(String(a), s);
|
|
953
|
-
} catch (o) {
|
|
954
|
-
r.push({
|
|
955
|
-
code: "invalid",
|
|
956
|
-
key: String(a),
|
|
957
|
-
message: o instanceof Error ? o.message : `Environment variable ${String(a)} is invalid.`
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
if (r.length)
|
|
962
|
-
throw new ht(r);
|
|
963
|
-
return n;
|
|
964
|
-
}
|
|
965
|
-
function mt(e = {}) {
|
|
966
|
-
return y(e, !1, (t, r) => {
|
|
967
|
-
if (r === "true" || r === "1")
|
|
968
|
-
return !0;
|
|
969
|
-
if (r === "false" || r === "0")
|
|
970
|
-
return !1;
|
|
971
|
-
throw new Error(`Environment variable ${t} must be true, false, 1, or 0.`);
|
|
972
|
-
});
|
|
973
|
-
}
|
|
974
|
-
function pt(e, t = {}) {
|
|
975
|
-
return y(t, !1, (r, n) => {
|
|
976
|
-
if (e.includes(n))
|
|
977
|
-
return n;
|
|
978
|
-
throw new Error(
|
|
979
|
-
`Environment variable ${r} must be one of: ${e.join(", ")}.`
|
|
980
|
-
);
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
function gt(e = {}) {
|
|
984
|
-
return y(e, !1, (t, r) => {
|
|
985
|
-
if (!/^-?\d+$/.test(r))
|
|
986
|
-
throw new Error(`Environment variable ${t} must be an integer.`);
|
|
987
|
-
const n = Number(r);
|
|
988
|
-
if (!Number.isSafeInteger(n))
|
|
989
|
-
throw new Error(`Environment variable ${t} must be a safe integer.`);
|
|
990
|
-
if (e.min !== void 0 && n < e.min)
|
|
991
|
-
throw new Error(
|
|
992
|
-
`Environment variable ${t} must be greater than or equal to ${e.min}.`
|
|
993
|
-
);
|
|
994
|
-
if (e.max !== void 0 && n > e.max)
|
|
995
|
-
throw new Error(
|
|
996
|
-
`Environment variable ${t} must be less than or equal to ${e.max}.`
|
|
997
|
-
);
|
|
998
|
-
return n;
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
function wt(e = {}) {
|
|
1002
|
-
return y(
|
|
1003
|
-
e,
|
|
1004
|
-
!0,
|
|
1005
|
-
(t, r) => j(t, r, e)
|
|
1006
|
-
);
|
|
1007
|
-
}
|
|
1008
|
-
function yt(e = {}) {
|
|
1009
|
-
return y(
|
|
1010
|
-
e,
|
|
1011
|
-
!1,
|
|
1012
|
-
(t, r) => j(t, r, e)
|
|
1013
|
-
);
|
|
1014
|
-
}
|
|
1015
|
-
function vt(e = {}) {
|
|
1016
|
-
return y(e, !1, (t, r) => {
|
|
1017
|
-
let n;
|
|
1018
|
-
try {
|
|
1019
|
-
n = new URL(r);
|
|
1020
|
-
} catch {
|
|
1021
|
-
throw new Error(`Environment variable ${t} must be a valid URL.`);
|
|
1022
|
-
}
|
|
1023
|
-
if (e.protocols?.length && !e.protocols.includes(n.protocol))
|
|
1024
|
-
throw new Error(
|
|
1025
|
-
`Environment variable ${t} must use one of these protocols: ${e.protocols.join(", ")}.`
|
|
1026
|
-
);
|
|
1027
|
-
return n;
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
|
-
const ur = {
|
|
1031
|
-
boolean: mt,
|
|
1032
|
-
enum: pt,
|
|
1033
|
-
integer: gt,
|
|
1034
|
-
secret: wt,
|
|
1035
|
-
string: yt,
|
|
1036
|
-
url: vt
|
|
1037
|
-
};
|
|
1038
|
-
function y(e, t, r) {
|
|
1039
|
-
return {
|
|
1040
|
-
optional: e.optional ?? !1,
|
|
1041
|
-
parse: r,
|
|
1042
|
-
sensitive: t
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
function j(e, t, r) {
|
|
1046
|
-
if (r.minLength !== void 0 && t.length < r.minLength)
|
|
1047
|
-
throw new Error(
|
|
1048
|
-
`Environment variable ${e} must be at least ${r.minLength} characters.`
|
|
1049
|
-
);
|
|
1050
|
-
return t;
|
|
1051
|
-
}
|
|
1052
|
-
function bt(e) {
|
|
1053
|
-
return e.length === 1 ? e[0].message : `Environment validation failed with ${e.length} issues.`;
|
|
1054
|
-
}
|
|
1055
|
-
function lr(e = {}) {
|
|
1056
|
-
return async function(r) {
|
|
1057
|
-
if (r.method.toUpperCase() !== "POST")
|
|
1058
|
-
return new Response(null, {
|
|
1059
|
-
headers: {
|
|
1060
|
-
allow: "POST"
|
|
1061
|
-
},
|
|
1062
|
-
status: 405
|
|
1063
|
-
});
|
|
1064
|
-
const n = Et(r);
|
|
1065
|
-
if (n)
|
|
1066
|
-
return n;
|
|
1067
|
-
const a = Rt(e, r);
|
|
1068
|
-
if (a)
|
|
1069
|
-
return a;
|
|
1070
|
-
e.maxBodySize !== void 0 && (r = me({ maxBodySize: e.maxBodySize }, r));
|
|
1071
|
-
let i;
|
|
1072
|
-
try {
|
|
1073
|
-
i = await r.json();
|
|
1074
|
-
} catch (o) {
|
|
1075
|
-
return o instanceof pe ? new Response("Security report body too large.", { status: 413 }) : new Response("Invalid security report JSON.", {
|
|
1076
|
-
status: 400
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
const s = $t(i);
|
|
1080
|
-
for (let o = 0; o < s.length; o += 1)
|
|
1081
|
-
await e.onReport?.(s[o], {
|
|
1082
|
-
index: o,
|
|
1083
|
-
request: r
|
|
1084
|
-
});
|
|
1085
|
-
return new Response(null, {
|
|
1086
|
-
status: 204
|
|
1087
|
-
});
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
const St = /* @__PURE__ */ new Set([
|
|
1091
|
-
"application/csp-report",
|
|
1092
|
-
"application/reports+json"
|
|
1093
|
-
]);
|
|
1094
|
-
function Et(e) {
|
|
1095
|
-
const t = e.headers.get("content-type");
|
|
1096
|
-
if (!t)
|
|
1097
|
-
return null;
|
|
1098
|
-
const r = t.split(";", 1)[0]?.trim().toLowerCase();
|
|
1099
|
-
return r && St.has(r) ? null : new Response("Unsupported security report Content-Type.", {
|
|
1100
|
-
status: 415
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
function Rt(e, t) {
|
|
1104
|
-
if (e.maxBodySize === void 0)
|
|
1105
|
-
return null;
|
|
1106
|
-
const r = t.headers.get("content-length");
|
|
1107
|
-
if (!r)
|
|
1108
|
-
return null;
|
|
1109
|
-
if (!/^\d+$/.test(r))
|
|
1110
|
-
return new Response("Invalid Content-Length.", {
|
|
1111
|
-
status: 400
|
|
1112
|
-
});
|
|
1113
|
-
const n = Number(r);
|
|
1114
|
-
return Number.isSafeInteger(n) ? n > A(e.maxBodySize) ? new Response("Security report body too large.", {
|
|
1115
|
-
status: 413
|
|
1116
|
-
}) : null : new Response("Invalid Content-Length.", {
|
|
1117
|
-
status: 400
|
|
1118
|
-
});
|
|
1119
|
-
}
|
|
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) {
|
|
1124
|
-
return typeof e == "object" && e !== null;
|
|
1125
|
-
}
|
|
1126
|
-
function fr(e, t) {
|
|
1127
|
-
const r = {}, n = [];
|
|
1128
|
-
let a = 0;
|
|
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({
|
|
1132
|
-
code: "file-missing",
|
|
1133
|
-
field: i,
|
|
1134
|
-
message: `Upload field ${i} requires at least one file.`
|
|
1135
|
-
});
|
|
1136
|
-
for (const u of o)
|
|
1137
|
-
a += u.size, At(i, u, s, n);
|
|
1138
|
-
}
|
|
1139
|
-
return t.maxTotalSize !== void 0 && a > A(t.maxTotalSize) && n.push({
|
|
1140
|
-
code: "total-upload-too-large",
|
|
1141
|
-
field: "*",
|
|
1142
|
-
message: `Uploaded files exceed the maximum total size of ${t.maxTotalSize}.`
|
|
1143
|
-
}), {
|
|
1144
|
-
files: r,
|
|
1145
|
-
issues: n,
|
|
1146
|
-
ok: n.length === 0,
|
|
1147
|
-
totalSize: a
|
|
1148
|
-
};
|
|
1149
|
-
}
|
|
1150
|
-
function At(e, t, r, n) {
|
|
1151
|
-
r.maxSize !== void 0 && t.size > A(r.maxSize) && n.push({
|
|
1152
|
-
code: "file-too-large",
|
|
1153
|
-
field: e,
|
|
1154
|
-
message: `Upload field ${e} contains ${t.name || "a file"} larger than ${r.maxSize}.`
|
|
1155
|
-
}), r.types?.length && !Tt(t.type, r.types) && n.push({
|
|
1156
|
-
code: "file-type-not-allowed",
|
|
1157
|
-
field: e,
|
|
1158
|
-
message: `Upload field ${e} contains ${t.name || "a file"} with disallowed type ${t.type || "unknown"}.`
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
function Tt(e, t) {
|
|
1162
|
-
return t.some((r) => r.endsWith("/*") ? e.startsWith(r.slice(0, -1)) : e === r);
|
|
1163
|
-
}
|
|
1164
|
-
function It(e) {
|
|
1165
|
-
return e instanceof File;
|
|
1166
|
-
}
|
|
1167
|
-
function kt(e, t) {
|
|
1168
|
-
const r = t.headers.get("origin");
|
|
1169
|
-
if (!r)
|
|
1170
|
-
return {
|
|
1171
|
-
allowed: !!e.allowMissingOrigin,
|
|
1172
|
-
expected: e.origins,
|
|
1173
|
-
origin: r,
|
|
1174
|
-
reason: e.allowMissingOrigin ? void 0 : "missing-origin"
|
|
1175
|
-
};
|
|
1176
|
-
const n = q(r);
|
|
1177
|
-
if (!n)
|
|
1178
|
-
return {
|
|
1179
|
-
allowed: !1,
|
|
1180
|
-
expected: e.origins,
|
|
1181
|
-
origin: r,
|
|
1182
|
-
reason: "invalid-origin"
|
|
1183
|
-
};
|
|
1184
|
-
const a = Ct(e, n, t);
|
|
1185
|
-
return {
|
|
1186
|
-
allowed: a,
|
|
1187
|
-
expected: e.origins,
|
|
1188
|
-
origin: n,
|
|
1189
|
-
reason: a ? void 0 : "origin-not-allowed"
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1192
|
-
function dr(e, t) {
|
|
1193
|
-
return !e || kt(e, t).allowed ? null : new Response("WebSocket origin not allowed.", {
|
|
1194
|
-
status: 403
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
function Ct(e, t, r) {
|
|
1198
|
-
return e.origins === "same-origin" ? t === new URL(r.url).origin : e.origins.some(
|
|
1199
|
-
(n) => Dt(n, t)
|
|
1200
|
-
);
|
|
1201
|
-
}
|
|
1202
|
-
function Dt(e, t) {
|
|
1203
|
-
return e === "null" ? t === "null" : q(e) === t;
|
|
1204
|
-
}
|
|
1205
|
-
function q(e) {
|
|
1206
|
-
if (e === "null")
|
|
1207
|
-
return e;
|
|
1208
|
-
try {
|
|
1209
|
-
if (e !== e.trim())
|
|
1210
|
-
return null;
|
|
1211
|
-
const t = e.indexOf("://");
|
|
1212
|
-
if (t === -1)
|
|
1213
|
-
return null;
|
|
1214
|
-
const r = e.slice(t + 3);
|
|
1215
|
-
if (!r || /[/?#]/.test(r))
|
|
1216
|
-
return null;
|
|
1217
|
-
const n = new URL(e);
|
|
1218
|
-
return n.protocol !== "http:" && n.protocol !== "https:" || n.username || n.password ? null : n.origin;
|
|
1219
|
-
} catch {
|
|
1220
|
-
return null;
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
1059
|
export {
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
lr as
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1060
|
+
ke as EnvValidationError,
|
|
1061
|
+
ue as HTTP_ERROR_STATUSES,
|
|
1062
|
+
Qt as HttpError,
|
|
1063
|
+
Lt as Image,
|
|
1064
|
+
Ot as Link,
|
|
1065
|
+
jt as Script,
|
|
1066
|
+
St as action,
|
|
1067
|
+
Et as actionInput,
|
|
1068
|
+
zt as analytics,
|
|
1069
|
+
Ft as assertAdapterCapabilities,
|
|
1070
|
+
er as auditScriptDependencies,
|
|
1071
|
+
Ht as checkAdapterCapabilities,
|
|
1072
|
+
qe as checkWebSocketOrigin,
|
|
1073
|
+
tr as createCache,
|
|
1074
|
+
rr as createCorsHeaders,
|
|
1075
|
+
nr as createCsrfCookie,
|
|
1076
|
+
ar as createCsrfToken,
|
|
1077
|
+
We as createFileRouter,
|
|
1078
|
+
ir as createInvalidation,
|
|
1079
|
+
or as createMemoryCache,
|
|
1080
|
+
sr as createMemoryCacheStore,
|
|
1081
|
+
mt as createMemoryIdempotencyStore,
|
|
1082
|
+
cr as createMemoryRateLimitStore,
|
|
1083
|
+
ur as createRequestHandler,
|
|
1084
|
+
lr as createSecurityAudit,
|
|
1085
|
+
fr as createSecurityHeaders,
|
|
1086
|
+
It as createSecurityReportHandler,
|
|
1087
|
+
dr as cspHash,
|
|
1088
|
+
mr as cspNonce,
|
|
1089
|
+
Xr as defaultFontPath,
|
|
1090
|
+
Bt as defineAdapter,
|
|
1091
|
+
$t as defineEnvSchema,
|
|
1092
|
+
Jr as defineFonts,
|
|
1093
|
+
Qr as defineImages,
|
|
1094
|
+
Mt as defineInstrumentation,
|
|
1095
|
+
qt as defineLinks,
|
|
1096
|
+
hr as defineMetadata,
|
|
1097
|
+
At as defineMiddleware,
|
|
1098
|
+
yt as defineOgImage,
|
|
1099
|
+
wt as defineRobots,
|
|
1100
|
+
pr as defineRoutePolicy,
|
|
1101
|
+
_t as defineScripts,
|
|
1102
|
+
gr as defineSecurityPolicy,
|
|
1103
|
+
pt as defineSitemap,
|
|
1104
|
+
wr as defineTags,
|
|
1105
|
+
yr as enforceAllowedMethods,
|
|
1106
|
+
vr as enforceCsrfProtection,
|
|
1107
|
+
br as enforceRateLimit,
|
|
1108
|
+
Sr as enforceRequestSecurity,
|
|
1109
|
+
Nt as enforceWebSocketOrigin,
|
|
1110
|
+
Tt as env,
|
|
1111
|
+
en as font,
|
|
1112
|
+
tn as fontAssetFileName,
|
|
1113
|
+
rn as fontAssetUrl,
|
|
1114
|
+
nn as fontLinks,
|
|
1115
|
+
an as fontMediaType,
|
|
1116
|
+
on as fontPreloadLinks,
|
|
1117
|
+
sn as fontSources,
|
|
1118
|
+
cn as fontStylesheetUrl,
|
|
1119
|
+
Vt as getScriptWorker,
|
|
1120
|
+
Er as handleRequestWithManifest,
|
|
1121
|
+
re as href,
|
|
1122
|
+
Rr as html,
|
|
1123
|
+
le as httpError,
|
|
1124
|
+
Ct as hydrateFileRouter,
|
|
1125
|
+
un as isAllowedImageSource,
|
|
1126
|
+
de as isHttpError,
|
|
1127
|
+
Ar as issueCsrfToken,
|
|
1128
|
+
xr as json,
|
|
1129
|
+
$r as jsonl,
|
|
1130
|
+
kr as link,
|
|
1131
|
+
Tr as mergeRoutePolicies,
|
|
1132
|
+
Ir as mergeRouteSecurityPolicies,
|
|
1133
|
+
Dr as mergeSecurityPolicies,
|
|
1134
|
+
Nr as meta,
|
|
1135
|
+
Wt as modulePreload,
|
|
1136
|
+
Cr as notFound,
|
|
1137
|
+
Rt as page,
|
|
1138
|
+
$ as parseBodySize,
|
|
1139
|
+
C as parseCacheDuration,
|
|
1140
|
+
Or as parseCookieHeader,
|
|
1141
|
+
ln as parseImageOptimizerRequest,
|
|
1142
|
+
Lr as parseRateLimitWindow,
|
|
1143
|
+
me as planImageTransform,
|
|
1144
|
+
Kt as preconnect,
|
|
1145
|
+
Gt as preload,
|
|
1146
|
+
zr as query,
|
|
1147
|
+
Mr as redirect,
|
|
1148
|
+
fn as renderFontFaceCss,
|
|
1149
|
+
bt as renderOgImageResponse,
|
|
1150
|
+
ye as renderOgImageSvg,
|
|
1151
|
+
Zt as renderPageResponse,
|
|
1152
|
+
vt as renderRobots,
|
|
1153
|
+
gt as renderSitemap,
|
|
1154
|
+
Yt as resolveLinks,
|
|
1155
|
+
Pr as resolveMetadata,
|
|
1156
|
+
Xt as resolveScripts,
|
|
1157
|
+
J as response,
|
|
1158
|
+
ht as runIdempotentMutation,
|
|
1159
|
+
A as script,
|
|
1160
|
+
Ur as security,
|
|
1161
|
+
X as serializeCacheKey,
|
|
1162
|
+
jr as serializeCacheNamespace,
|
|
1163
|
+
Fr as serializeCacheTag,
|
|
1164
|
+
Hr as serverTiming,
|
|
1165
|
+
Br as sse,
|
|
1166
|
+
N as startDeferredScripts,
|
|
1167
|
+
qr as stream,
|
|
1168
|
+
_r as structuredData,
|
|
1169
|
+
Vr as tag,
|
|
1170
|
+
Wr as text,
|
|
1171
|
+
Q as toResponse,
|
|
1172
|
+
Kr as validateCorsPolicy,
|
|
1173
|
+
kt as validateEnv,
|
|
1174
|
+
Gr as validateRateLimitPolicy,
|
|
1175
|
+
Zr as validateRouteModules,
|
|
1176
|
+
Dt as validateUploads,
|
|
1177
|
+
xt as webhook
|
|
1327
1178
|
};
|
|
1328
1179
|
//# sourceMappingURL=index.js.map
|