@demiurgejs/core 0.2.0-beta.1 → 0.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -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-WoM8yZlR.js +35 -0
- package/dist/chunks/document-shell-WoM8yZlR.js.map +1 -0
- package/dist/chunks/image-codec-Di53WpcH.js +141 -0
- package/dist/chunks/image-codec-Di53WpcH.js.map +1 -0
- package/dist/chunks/images-Edar3eU1.js +339 -0
- package/dist/chunks/images-Edar3eU1.js.map +1 -0
- package/dist/chunks/request-metadata-DaIYq4Ea.js +677 -0
- package/dist/chunks/request-metadata-DaIYq4Ea.js.map +1 -0
- package/dist/chunks/streaming-D0fGAuiO.js +469 -0
- package/dist/chunks/streaming-D0fGAuiO.js.map +1 -0
- package/dist/chunks/{testing-DBjVCN5v.js → testing-CRflAw4X.js} +1300 -1139
- package/dist/chunks/testing-CRflAw4X.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +63 -54
- package/dist/cli.js.map +1 -1
- package/dist/data/cache.d.ts +8 -0
- package/dist/data/cache.d.ts.map +1 -1
- package/dist/data/idempotency.d.ts.map +1 -1
- package/dist/data/index.d.ts +3 -1
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/testing.d.ts.map +1 -1
- package/dist/data/testing.js +94 -72
- package/dist/data/testing.js.map +1 -1
- package/dist/data/tiered.d.ts +7 -0
- package/dist/data/tiered.d.ts.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/hydration.d.ts.map +1 -1
- package/dist/document/index.d.ts +4 -1
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/render.d.ts.map +1 -1
- package/dist/document/scripts.d.ts +12 -1
- package/dist/document/scripts.d.ts.map +1 -1
- package/dist/document/trusted-types.d.ts +10 -0
- package/dist/document/trusted-types.d.ts.map +1 -0
- 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 +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +895 -556
- package/dist/index.js.map +1 -1
- package/dist/internal/testing.js +6 -6
- package/dist/kv/index.d.ts +5 -0
- package/dist/kv/index.d.ts.map +1 -0
- package/dist/kv/index.js +126 -0
- package/dist/kv/index.js.map +1 -0
- package/dist/kv/rate-limit-store.d.ts +8 -0
- package/dist/kv/rate-limit-store.d.ts.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/http.d.ts.map +1 -1
- 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/static.d.ts.map +1 -1
- 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 +13 -6
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/observability.d.ts +2 -1
- package/dist/platform/observability.d.ts.map +1 -1
- package/dist/platform/web-vitals-client.d.ts +32 -0
- package/dist/platform/web-vitals-client.d.ts.map +1 -0
- package/dist/platform/web-vitals.d.ts +78 -0
- package/dist/platform/web-vitals.d.ts.map +1 -0
- package/dist/redis/index.d.ts +5 -0
- package/dist/redis/index.d.ts.map +1 -0
- package/dist/redis/index.js +209 -0
- package/dist/redis/index.js.map +1 -0
- package/dist/redis/rate-limit-store.d.ts +8 -0
- package/dist/redis/rate-limit-store.d.ts.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.map +1 -1
- package/dist/route/middleware.d.ts.map +1 -1
- package/dist/route/response.d.ts.map +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/manifest.d.ts +1 -0
- package/dist/router/manifest.d.ts.map +1 -1
- package/dist/security/cookies.d.ts +26 -0
- package/dist/security/cookies.d.ts.map +1 -0
- package/dist/security/env.d.ts.map +1 -1
- package/dist/security/fetch-metadata.d.ts +29 -0
- package/dist/security/fetch-metadata.d.ts.map +1 -0
- package/dist/security/index.d.ts +5 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/policy.d.ts +2 -27
- package/dist/security/policy.d.ts.map +1 -1
- package/dist/security/rate-limit.d.ts +6 -3
- package/dist/security/rate-limit.d.ts.map +1 -1
- package/dist/security/request.d.ts.map +1 -1
- package/dist/security/types.d.ts +82 -6
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/verification.d.ts.map +1 -1
- package/dist/server/document-shell.d.ts +12 -0
- package/dist/server/document-shell.d.ts.map +1 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/request-handler.d.ts +6 -2
- package/dist/server/request-handler.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 +8 -0
- package/dist/static/index.d.ts.map +1 -1
- package/dist/static/index.js +421 -313
- package/dist/static/index.js.map +1 -1
- package/dist/static/vercel.d.ts +3 -0
- package/dist/static/vercel.d.ts.map +1 -1
- package/dist/vite/index.d.ts +3 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +1041 -652
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugin.d.ts +9 -0
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/vite/policy-verification.d.ts.map +1 -1
- package/dist/vite/route-audit.d.ts +50 -0
- package/dist/vite/route-audit.d.ts.map +1 -0
- package/package.json +34 -3
- package/dist/chunks/request-metadata-DwEO1EAS.js +0 -477
- package/dist/chunks/request-metadata-DwEO1EAS.js.map +0 -1
- package/dist/chunks/streaming-Ci6vf3BB.js +0 -353
- package/dist/chunks/streaming-Ci6vf3BB.js.map +0 -1
- package/dist/chunks/testing-DBjVCN5v.js.map +0 -1
|
@@ -1,196 +1,218 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createElement as
|
|
3
|
-
import { renderToString as
|
|
4
|
-
import { jsxs as
|
|
5
|
-
const
|
|
1
|
+
import { x as It, w as Ut, y as Qe, z as Xe, e as et, F as Ft, A as Ht, B as jt, l as Wt, a as zt } from "./request-metadata-DaIYq4Ea.js";
|
|
2
|
+
import { createElement as de } from "react";
|
|
3
|
+
import { renderToString as tt } from "react-dom/server";
|
|
4
|
+
import { jsxs as H, jsx as j } from "react/jsx-runtime";
|
|
5
|
+
const Ne = ["build", "private", "public"], Bt = {
|
|
6
6
|
app: "demiurge-memory",
|
|
7
7
|
environment: "local",
|
|
8
8
|
schemaVersion: 1
|
|
9
|
-
},
|
|
10
|
-
function
|
|
9
|
+
}, qt = 1e4, Gt = 3e4;
|
|
10
|
+
function Eo(e) {
|
|
11
11
|
return (...t) => ({
|
|
12
12
|
fn: () => e.fn(...t),
|
|
13
13
|
key: e.key(...t),
|
|
14
|
+
notFoundTtl: e.notFoundTtl,
|
|
14
15
|
scope: e.scope,
|
|
15
16
|
staleWhileRevalidate: e.staleWhileRevalidate,
|
|
16
17
|
tags: e.tags?.(...t),
|
|
17
18
|
ttl: e.ttl
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
class A extends Error {
|
|
22
|
+
constructor(t) {
|
|
23
|
+
super(t ?? "Not found"), this.name = "CacheNotFoundError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function vo(e) {
|
|
27
|
+
throw new A(e);
|
|
28
|
+
}
|
|
29
|
+
function Ro(e) {
|
|
30
|
+
return e instanceof A;
|
|
31
|
+
}
|
|
32
|
+
function bo(e) {
|
|
21
33
|
return { id: e };
|
|
22
34
|
}
|
|
23
|
-
function
|
|
35
|
+
function To(e) {
|
|
24
36
|
return e;
|
|
25
37
|
}
|
|
26
|
-
function
|
|
27
|
-
const t = e.now ?? Date.now, r =
|
|
38
|
+
function rt(e) {
|
|
39
|
+
const t = e.now ?? Date.now, r = Kt(e.refreshLeaseTtl), n = nt(e.namespace), s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
28
40
|
return {
|
|
29
|
-
async get(
|
|
30
|
-
const a =
|
|
41
|
+
async get(i) {
|
|
42
|
+
const a = i.scope ?? "request";
|
|
31
43
|
if (a === "none")
|
|
32
|
-
return await
|
|
33
|
-
const c =
|
|
44
|
+
return await i.fn();
|
|
45
|
+
const c = Le(i.key);
|
|
34
46
|
if (a === "request")
|
|
35
|
-
return await
|
|
36
|
-
const u =
|
|
37
|
-
(
|
|
38
|
-
),
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
return await Jt(s, c, i, t);
|
|
48
|
+
const u = Me(n, a, c), l = (i.tags ?? []).map(
|
|
49
|
+
(m) => Ie(n, a, he(m))
|
|
50
|
+
), f = await e.store.get(u);
|
|
51
|
+
if (f && (f.expiresAt === null || f.expiresAt > t())) {
|
|
52
|
+
if (f.negative)
|
|
53
|
+
throw new A(
|
|
54
|
+
typeof f.value == "string" ? f.value : void 0
|
|
55
|
+
);
|
|
56
|
+
return f.value;
|
|
57
|
+
}
|
|
58
|
+
if (f && Yt(f, t())) {
|
|
59
|
+
const m = Zt(e.store), k = globalThis.crypto.randomUUID();
|
|
60
|
+
if (await m.acquireRefreshLease(
|
|
44
61
|
u,
|
|
45
62
|
k,
|
|
46
63
|
t() + r
|
|
47
64
|
)) {
|
|
48
|
-
const
|
|
65
|
+
const N = Qt({
|
|
49
66
|
key: u,
|
|
50
67
|
now: t,
|
|
51
68
|
onBackgroundError: e.onBackgroundError,
|
|
52
|
-
refreshStore:
|
|
53
|
-
request:
|
|
54
|
-
tags:
|
|
69
|
+
refreshStore: m,
|
|
70
|
+
request: i,
|
|
71
|
+
tags: l,
|
|
55
72
|
token: k
|
|
56
73
|
});
|
|
57
|
-
e.waitUntil?.(
|
|
74
|
+
e.waitUntil?.(N);
|
|
58
75
|
}
|
|
59
|
-
return
|
|
76
|
+
return f.value;
|
|
60
77
|
}
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
return await
|
|
65
|
-
const d = { invalidated: !1 },
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
f && await e.store.delete(u);
|
|
79
|
+
const h = o.get(u);
|
|
80
|
+
if (h)
|
|
81
|
+
return await h.promise;
|
|
82
|
+
const d = { invalidated: !1 }, D = Promise.resolve().then(i.fn).then(
|
|
83
|
+
async (m) => (d.invalidated || await e.store.set(u, {
|
|
84
|
+
expiresAt: Se(t(), i.ttl),
|
|
85
|
+
staleUntil: Ee(
|
|
86
|
+
t(),
|
|
87
|
+
i.ttl,
|
|
88
|
+
i.staleWhileRevalidate
|
|
89
|
+
),
|
|
90
|
+
tags: l,
|
|
91
|
+
value: m
|
|
92
|
+
}), m),
|
|
93
|
+
async (m) => {
|
|
94
|
+
throw !d.invalidated && m instanceof A && await e.store.set(u, st(t(), i, l, m)), m;
|
|
95
|
+
}
|
|
96
|
+
), $ = {
|
|
97
|
+
promise: D,
|
|
76
98
|
state: d,
|
|
77
|
-
tags:
|
|
99
|
+
tags: l
|
|
78
100
|
};
|
|
79
|
-
|
|
101
|
+
o.set(u, $);
|
|
80
102
|
try {
|
|
81
|
-
return await
|
|
103
|
+
return await D;
|
|
82
104
|
} finally {
|
|
83
|
-
|
|
105
|
+
o.get(u) === $ && o.delete(u);
|
|
84
106
|
}
|
|
85
107
|
},
|
|
86
|
-
async invalidateKey(
|
|
87
|
-
const a =
|
|
108
|
+
async invalidateKey(i) {
|
|
109
|
+
const a = Le(i), c = s.delete(a);
|
|
88
110
|
let u = !1;
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
return d && (d.state.invalidated = !0, u = !0), e.store.delete(
|
|
111
|
+
const l = await Promise.all(
|
|
112
|
+
Ne.map((f) => {
|
|
113
|
+
const h = Me(n, f, a), d = o.get(h);
|
|
114
|
+
return d && (d.state.invalidated = !0, u = !0), e.store.delete(h);
|
|
93
115
|
})
|
|
94
116
|
);
|
|
95
|
-
return c || u ||
|
|
117
|
+
return c || u || l.some(Boolean);
|
|
96
118
|
},
|
|
97
|
-
async invalidateTags(
|
|
98
|
-
const a =
|
|
119
|
+
async invalidateTags(i) {
|
|
120
|
+
const a = i.map(he), c = Xt(
|
|
99
121
|
s,
|
|
100
122
|
new Set(a)
|
|
101
123
|
), u = new Set(
|
|
102
|
-
|
|
103
|
-
(
|
|
124
|
+
Ne.flatMap(
|
|
125
|
+
(h) => a.map((d) => Ie(n, h, d))
|
|
104
126
|
)
|
|
105
127
|
);
|
|
106
|
-
let
|
|
107
|
-
for (const
|
|
108
|
-
!
|
|
109
|
-
const
|
|
110
|
-
return c +
|
|
128
|
+
let l = 0;
|
|
129
|
+
for (const h of o.values())
|
|
130
|
+
!h.state.invalidated && h.tags.some((d) => u.has(d)) && (h.state.invalidated = !0, l += 1);
|
|
131
|
+
const f = await e.store.invalidateTags([...u]);
|
|
132
|
+
return c + l + f;
|
|
111
133
|
}
|
|
112
134
|
};
|
|
113
135
|
}
|
|
114
|
-
function
|
|
136
|
+
function we(e = {}) {
|
|
115
137
|
const t = e.now ?? Date.now;
|
|
116
|
-
return
|
|
117
|
-
namespace:
|
|
138
|
+
return rt({
|
|
139
|
+
namespace: Bt,
|
|
118
140
|
now: t,
|
|
119
141
|
onBackgroundError: e.onBackgroundError,
|
|
120
142
|
refreshLeaseTtl: e.refreshLeaseTtl,
|
|
121
|
-
store:
|
|
143
|
+
store: _t({
|
|
122
144
|
maximumEntries: e.maximumEntries,
|
|
123
145
|
now: t
|
|
124
146
|
}),
|
|
125
147
|
waitUntil: e.waitUntil
|
|
126
148
|
});
|
|
127
149
|
}
|
|
128
|
-
function
|
|
129
|
-
const t = e.entries ?? /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), n = e.maximumEntries ??
|
|
150
|
+
function _t(e = {}) {
|
|
151
|
+
const t = e.entries ?? /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), n = e.maximumEntries ?? qt, s = e.now ?? Date.now;
|
|
130
152
|
if (!Number.isSafeInteger(n) || n <= 0)
|
|
131
153
|
throw new Error(
|
|
132
154
|
"Demiurge memory cache maximumEntries must be a positive integer."
|
|
133
155
|
);
|
|
134
|
-
|
|
135
|
-
let
|
|
156
|
+
se(t, r, s()), Vt(t, n);
|
|
157
|
+
let o = oe(t);
|
|
136
158
|
return {
|
|
137
|
-
acquireRefreshLease(
|
|
138
|
-
const u = s(),
|
|
139
|
-
return
|
|
159
|
+
acquireRefreshLease(i, a, c) {
|
|
160
|
+
const u = s(), l = r.get(i);
|
|
161
|
+
return l && l.expiresAt > u ? !1 : (r.set(i, { expiresAt: c, token: a }), !0);
|
|
140
162
|
},
|
|
141
|
-
delete(
|
|
142
|
-
return r.delete(
|
|
163
|
+
delete(i) {
|
|
164
|
+
return r.delete(i), t.delete(i);
|
|
143
165
|
},
|
|
144
|
-
get(
|
|
145
|
-
return s() >=
|
|
166
|
+
get(i) {
|
|
167
|
+
return s() >= o && (se(t, r, s()), o = oe(t)), t.get(i);
|
|
146
168
|
},
|
|
147
|
-
invalidateTags(
|
|
148
|
-
const a = new Set(
|
|
169
|
+
invalidateTags(i) {
|
|
170
|
+
const a = new Set(i);
|
|
149
171
|
let c = 0;
|
|
150
|
-
for (const [u,
|
|
151
|
-
|
|
172
|
+
for (const [u, l] of t)
|
|
173
|
+
l.tags.some((f) => a.has(f)) && (t.delete(u), r.delete(u), c += 1);
|
|
152
174
|
return c;
|
|
153
175
|
},
|
|
154
|
-
publishRefresh(
|
|
155
|
-
const u = r.get(
|
|
156
|
-
return !u || u.token !== a || u.expiresAt <= s() ? !1 : (
|
|
176
|
+
publishRefresh(i, a, c) {
|
|
177
|
+
const u = r.get(i);
|
|
178
|
+
return !u || u.token !== a || u.expiresAt <= s() ? !1 : (Oe(
|
|
157
179
|
t,
|
|
158
180
|
r,
|
|
159
181
|
n,
|
|
160
|
-
|
|
182
|
+
i,
|
|
161
183
|
c
|
|
162
|
-
), r.delete(
|
|
184
|
+
), r.delete(i), c.staleUntil !== null && (o = Math.min(o, c.staleUntil)), !0);
|
|
163
185
|
},
|
|
164
|
-
releaseRefreshLease(
|
|
165
|
-
r.get(
|
|
186
|
+
releaseRefreshLease(i, a) {
|
|
187
|
+
r.get(i)?.token === a && r.delete(i);
|
|
166
188
|
},
|
|
167
|
-
set(
|
|
189
|
+
set(i, a) {
|
|
168
190
|
const c = s();
|
|
169
|
-
c >=
|
|
191
|
+
c >= o && (se(t, r, c), o = oe(t)), r.delete(i), Oe(
|
|
170
192
|
t,
|
|
171
193
|
r,
|
|
172
194
|
n,
|
|
173
|
-
|
|
195
|
+
i,
|
|
174
196
|
a
|
|
175
|
-
), a.staleUntil !== null && (
|
|
197
|
+
), a.staleUntil !== null && (o = Math.min(o, a.staleUntil));
|
|
176
198
|
}
|
|
177
199
|
};
|
|
178
200
|
}
|
|
179
|
-
function
|
|
201
|
+
function se(e, t, r) {
|
|
180
202
|
for (const [n, s] of e)
|
|
181
203
|
s.staleUntil !== null && s.staleUntil <= r && (e.delete(n), t.delete(n));
|
|
182
204
|
}
|
|
183
|
-
function
|
|
205
|
+
function Oe(e, t, r, n, s) {
|
|
184
206
|
if (!e.has(n) && e.size >= r)
|
|
185
207
|
for (; e.size >= r; ) {
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
208
|
+
const o = e.keys().next().value;
|
|
209
|
+
if (o === void 0)
|
|
188
210
|
break;
|
|
189
|
-
e.delete(
|
|
211
|
+
e.delete(o), t.delete(o);
|
|
190
212
|
}
|
|
191
213
|
e.set(n, s);
|
|
192
214
|
}
|
|
193
|
-
function
|
|
215
|
+
function Vt(e, t) {
|
|
194
216
|
for (; e.size > t; ) {
|
|
195
217
|
const r = e.keys().next().value;
|
|
196
218
|
if (r === void 0)
|
|
@@ -198,14 +220,14 @@ function jt(e, t) {
|
|
|
198
220
|
e.delete(r);
|
|
199
221
|
}
|
|
200
222
|
}
|
|
201
|
-
function
|
|
223
|
+
function oe(e) {
|
|
202
224
|
let t = Number.POSITIVE_INFINITY;
|
|
203
225
|
for (const r of e.values())
|
|
204
226
|
r.staleUntil !== null && (t = Math.min(t, r.staleUntil));
|
|
205
227
|
return t;
|
|
206
228
|
}
|
|
207
|
-
function
|
|
208
|
-
const t =
|
|
229
|
+
function nt(e) {
|
|
230
|
+
const t = ie("app", e.app), r = ie(
|
|
209
231
|
"environment",
|
|
210
232
|
e.environment
|
|
211
233
|
);
|
|
@@ -213,13 +235,13 @@ function Xe(e) {
|
|
|
213
235
|
throw new Error(
|
|
214
236
|
"Demiurge cache namespace schemaVersion must be a non-negative integer or string."
|
|
215
237
|
);
|
|
216
|
-
const n =
|
|
238
|
+
const n = ie(
|
|
217
239
|
"schemaVersion",
|
|
218
240
|
String(e.schemaVersion)
|
|
219
241
|
);
|
|
220
242
|
return `${t}:${r}:${n}`;
|
|
221
243
|
}
|
|
222
|
-
function
|
|
244
|
+
function xo(e) {
|
|
223
245
|
return {
|
|
224
246
|
async key(t) {
|
|
225
247
|
return {
|
|
@@ -250,7 +272,7 @@ function si(e) {
|
|
|
250
272
|
}
|
|
251
273
|
};
|
|
252
274
|
}
|
|
253
|
-
function
|
|
275
|
+
function P(e) {
|
|
254
276
|
if (e === void 0)
|
|
255
277
|
return Number.POSITIVE_INFINITY;
|
|
256
278
|
if (typeof e == "number") {
|
|
@@ -264,40 +286,52 @@ function U(e) {
|
|
|
264
286
|
const r = Number(t[1]), n = t[2];
|
|
265
287
|
return n === "h" ? r * 36e5 : n === "m" ? r * 6e4 : n === "s" ? r * 1e3 : r;
|
|
266
288
|
}
|
|
267
|
-
function
|
|
268
|
-
return
|
|
289
|
+
function Le(e) {
|
|
290
|
+
return me(e, /* @__PURE__ */ new Set());
|
|
269
291
|
}
|
|
270
|
-
function
|
|
292
|
+
function he(e) {
|
|
271
293
|
return e.id;
|
|
272
294
|
}
|
|
273
|
-
async function
|
|
295
|
+
async function Jt(e, t, r, n) {
|
|
274
296
|
const s = e.get(t);
|
|
275
297
|
if (s && s.expiresAt > n())
|
|
276
298
|
return await s.value;
|
|
277
|
-
const
|
|
278
|
-
expiresAt: n() +
|
|
279
|
-
tags: (r.tags ?? []).map(
|
|
280
|
-
value:
|
|
299
|
+
const o = Promise.resolve().then(r.fn), i = {
|
|
300
|
+
expiresAt: n() + P(r.ttl),
|
|
301
|
+
tags: (r.tags ?? []).map(he),
|
|
302
|
+
value: o
|
|
281
303
|
};
|
|
282
|
-
e.set(t,
|
|
304
|
+
e.set(t, i);
|
|
283
305
|
try {
|
|
284
|
-
return await
|
|
306
|
+
return await o;
|
|
285
307
|
} catch (a) {
|
|
286
|
-
throw e.get(t) ===
|
|
308
|
+
throw e.get(t) === i && (a instanceof A ? i.expiresAt = n() + P(r.notFoundTtl ?? r.ttl) : e.delete(t)), a;
|
|
287
309
|
}
|
|
288
310
|
}
|
|
289
|
-
function
|
|
311
|
+
function Me(e, t, r) {
|
|
290
312
|
return `${e}:${t}:key:${r}`;
|
|
291
313
|
}
|
|
292
|
-
function
|
|
314
|
+
function Ie(e, t, r) {
|
|
293
315
|
return `${e}:${t}:tag:${r}`;
|
|
294
316
|
}
|
|
295
|
-
function
|
|
296
|
-
const r =
|
|
317
|
+
function Se(e, t) {
|
|
318
|
+
const r = P(t);
|
|
297
319
|
return Number.isFinite(r) ? e + r : null;
|
|
298
320
|
}
|
|
299
|
-
function
|
|
300
|
-
const
|
|
321
|
+
function st(e, t, r, n) {
|
|
322
|
+
const s = t.notFoundTtl ?? t.ttl;
|
|
323
|
+
return {
|
|
324
|
+
expiresAt: Se(e, s),
|
|
325
|
+
negative: !0,
|
|
326
|
+
// Negative entries do not participate in stale-while-revalidate: they
|
|
327
|
+
// expire outright and recompute on the next request.
|
|
328
|
+
staleUntil: Ee(e, s, void 0),
|
|
329
|
+
tags: r,
|
|
330
|
+
value: n.message
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function Ee(e, t, r) {
|
|
334
|
+
const n = P(t);
|
|
301
335
|
if (!Number.isFinite(n)) {
|
|
302
336
|
if (r !== void 0)
|
|
303
337
|
throw new Error(
|
|
@@ -305,32 +339,32 @@ function tt(e, t, r) {
|
|
|
305
339
|
);
|
|
306
340
|
return null;
|
|
307
341
|
}
|
|
308
|
-
return e + n +
|
|
342
|
+
return e + n + P(r ?? 0);
|
|
309
343
|
}
|
|
310
|
-
function
|
|
311
|
-
const t =
|
|
344
|
+
function Kt(e) {
|
|
345
|
+
const t = P(e ?? Gt);
|
|
312
346
|
if (!Number.isFinite(t) || t <= 0)
|
|
313
347
|
throw new Error(
|
|
314
348
|
"Demiurge cache refreshLeaseTtl must be a positive finite duration."
|
|
315
349
|
);
|
|
316
350
|
return t;
|
|
317
351
|
}
|
|
318
|
-
function
|
|
352
|
+
function Yt(e, t) {
|
|
319
353
|
return e.expiresAt !== null && e.expiresAt <= t && (e.staleUntil === null || e.staleUntil > t);
|
|
320
354
|
}
|
|
321
|
-
function
|
|
355
|
+
function Zt(e) {
|
|
322
356
|
if (!e.acquireRefreshLease || !e.publishRefresh || !e.releaseRefreshLease)
|
|
323
357
|
throw new Error(
|
|
324
358
|
"Demiurge staleWhileRevalidate requires a cache store with acquireRefreshLease, publishRefresh, and releaseRefreshLease coordination methods."
|
|
325
359
|
);
|
|
326
360
|
return e;
|
|
327
361
|
}
|
|
328
|
-
async function
|
|
362
|
+
async function Qt(e) {
|
|
329
363
|
try {
|
|
330
364
|
const t = await e.request.fn(), r = e.now();
|
|
331
365
|
await e.refreshStore.publishRefresh(e.key, e.token, {
|
|
332
|
-
expiresAt:
|
|
333
|
-
staleUntil:
|
|
366
|
+
expiresAt: Se(r, e.request.ttl),
|
|
367
|
+
staleUntil: Ee(
|
|
334
368
|
r,
|
|
335
369
|
e.request.ttl,
|
|
336
370
|
e.request.staleWhileRevalidate
|
|
@@ -339,12 +373,20 @@ async function Bt(e) {
|
|
|
339
373
|
value: t
|
|
340
374
|
});
|
|
341
375
|
} catch (t) {
|
|
376
|
+
if (t instanceof A) {
|
|
377
|
+
await e.refreshStore.publishRefresh(
|
|
378
|
+
e.key,
|
|
379
|
+
e.token,
|
|
380
|
+
st(e.now(), e.request, e.tags, t)
|
|
381
|
+
);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
342
384
|
e.onBackgroundError ? e.onBackgroundError(t) : console.error("Demiurge stale cache refresh failed.", t);
|
|
343
385
|
} finally {
|
|
344
386
|
await e.refreshStore.releaseRefreshLease(e.key, e.token);
|
|
345
387
|
}
|
|
346
388
|
}
|
|
347
|
-
function
|
|
389
|
+
function ie(e, t) {
|
|
348
390
|
const r = [...t].some((n) => {
|
|
349
391
|
const s = n.charCodeAt(0);
|
|
350
392
|
return s <= 31 || s === 127;
|
|
@@ -355,13 +397,13 @@ function ne(e, t) {
|
|
|
355
397
|
);
|
|
356
398
|
return t;
|
|
357
399
|
}
|
|
358
|
-
function
|
|
400
|
+
function Xt(e, t) {
|
|
359
401
|
let r = 0;
|
|
360
402
|
for (const [n, s] of e)
|
|
361
|
-
s.tags.some((
|
|
403
|
+
s.tags.some((o) => t.has(o)) && (e.delete(n), r += 1);
|
|
362
404
|
return r;
|
|
363
405
|
}
|
|
364
|
-
function
|
|
406
|
+
function me(e, t) {
|
|
365
407
|
if (e === null || typeof e == "boolean" || typeof e == "string")
|
|
366
408
|
return JSON.stringify(e);
|
|
367
409
|
if (typeof e == "number") {
|
|
@@ -378,18 +420,18 @@ function le(e, t) {
|
|
|
378
420
|
if (t.has(e))
|
|
379
421
|
throw new Error("Demiurge cache keys cannot contain circular references.");
|
|
380
422
|
if (t.add(e), Array.isArray(e)) {
|
|
381
|
-
const
|
|
382
|
-
...Array.from({ length: e.length }, (u,
|
|
423
|
+
const i = Reflect.ownKeys(e), a = [
|
|
424
|
+
...Array.from({ length: e.length }, (u, l) => String(l)),
|
|
383
425
|
"length"
|
|
384
426
|
];
|
|
385
|
-
if (
|
|
386
|
-
const
|
|
387
|
-
return !
|
|
427
|
+
if (i.length !== a.length || i.some((u, l) => u !== a[l]) || a.slice(0, -1).some((u) => {
|
|
428
|
+
const l = Object.getOwnPropertyDescriptor(e, u);
|
|
429
|
+
return !l?.enumerable || !("value" in l);
|
|
388
430
|
}))
|
|
389
431
|
throw t.delete(e), new Error(
|
|
390
432
|
"Demiurge cache key arrays must be dense and cannot contain accessors or custom properties."
|
|
391
433
|
);
|
|
392
|
-
const c = `[${e.map((u) =>
|
|
434
|
+
const c = `[${e.map((u) => me(u, t)).join(",")}]`;
|
|
393
435
|
return t.delete(e), c;
|
|
394
436
|
}
|
|
395
437
|
const r = Object.getPrototypeOf(e);
|
|
@@ -398,107 +440,47 @@ function le(e, t) {
|
|
|
398
440
|
"Demiurge cache keys accept only primitives, arrays, and plain objects."
|
|
399
441
|
);
|
|
400
442
|
const n = Reflect.ownKeys(e);
|
|
401
|
-
if (n.some((
|
|
402
|
-
const a = Object.getOwnPropertyDescriptor(e,
|
|
443
|
+
if (n.some((i) => typeof i == "symbol") || n.some((i) => {
|
|
444
|
+
const a = Object.getOwnPropertyDescriptor(e, i);
|
|
403
445
|
return !a?.enumerable || !("value" in a);
|
|
404
446
|
}))
|
|
405
447
|
throw new Error(
|
|
406
448
|
"Demiurge cache key objects require enumerable string data properties."
|
|
407
449
|
);
|
|
408
|
-
const s = e,
|
|
409
|
-
(
|
|
450
|
+
const s = e, o = `{${Object.keys(s).sort().map(
|
|
451
|
+
(i) => `${JSON.stringify(i)}:${me(s[i], t)}`
|
|
410
452
|
).join(",")}}`;
|
|
411
|
-
return t.delete(e),
|
|
412
|
-
}
|
|
413
|
-
function ii(e) {
|
|
414
|
-
return e;
|
|
415
|
-
}
|
|
416
|
-
function oi(e, t = {}) {
|
|
417
|
-
return {
|
|
418
|
-
...t,
|
|
419
|
-
href: e,
|
|
420
|
-
kind: "link",
|
|
421
|
-
rel: "preconnect"
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
function ai(e, t) {
|
|
425
|
-
return {
|
|
426
|
-
...t,
|
|
427
|
-
href: e,
|
|
428
|
-
kind: "link",
|
|
429
|
-
rel: "preload"
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
function ci(e) {
|
|
433
|
-
return {
|
|
434
|
-
href: e,
|
|
435
|
-
kind: "link",
|
|
436
|
-
rel: "modulepreload"
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
async function _t(e, t) {
|
|
440
|
-
const r = [];
|
|
441
|
-
for (const n of e) {
|
|
442
|
-
if (!n)
|
|
443
|
-
continue;
|
|
444
|
-
const s = typeof n == "function" ? await n(t) : n;
|
|
445
|
-
r.push(...s);
|
|
446
|
-
}
|
|
447
|
-
return Vt(r).sort(Jt);
|
|
448
|
-
}
|
|
449
|
-
function Vt(e) {
|
|
450
|
-
const t = /* @__PURE__ */ new Map();
|
|
451
|
-
for (const r of e)
|
|
452
|
-
t.set(Ne(r), {
|
|
453
|
-
...t.get(Ne(r)),
|
|
454
|
-
...r
|
|
455
|
-
});
|
|
456
|
-
return [...t.values()];
|
|
457
|
-
}
|
|
458
|
-
function Ne(e) {
|
|
459
|
-
return [
|
|
460
|
-
e.rel,
|
|
461
|
-
e.href,
|
|
462
|
-
e.as ?? "",
|
|
463
|
-
e.type ?? "",
|
|
464
|
-
e.crossOrigin ?? ""
|
|
465
|
-
].join("\0");
|
|
466
|
-
}
|
|
467
|
-
function Jt(e, t) {
|
|
468
|
-
return Oe(e.rel) - Oe(t.rel) || e.href.localeCompare(t.href);
|
|
453
|
+
return t.delete(e), o;
|
|
469
454
|
}
|
|
470
|
-
function
|
|
471
|
-
return e === "preconnect" ? 0 : e === "preload" ? 1 : e === "modulepreload" ? 2 : 3;
|
|
472
|
-
}
|
|
473
|
-
function ui(e) {
|
|
455
|
+
function Ao(e) {
|
|
474
456
|
return e;
|
|
475
457
|
}
|
|
476
|
-
function
|
|
458
|
+
function Po(e) {
|
|
477
459
|
return {
|
|
478
460
|
...e,
|
|
479
461
|
kind: "meta"
|
|
480
462
|
};
|
|
481
463
|
}
|
|
482
|
-
function
|
|
464
|
+
function Co(e) {
|
|
483
465
|
return {
|
|
484
466
|
...e,
|
|
485
467
|
kind: "link"
|
|
486
468
|
};
|
|
487
469
|
}
|
|
488
|
-
function
|
|
470
|
+
function Do(e) {
|
|
489
471
|
return {
|
|
490
472
|
kind: "structured-data",
|
|
491
473
|
value: e
|
|
492
474
|
};
|
|
493
475
|
}
|
|
494
|
-
function
|
|
476
|
+
function R(...e) {
|
|
495
477
|
const t = {
|
|
496
478
|
custom: [],
|
|
497
479
|
structuredData: []
|
|
498
480
|
};
|
|
499
|
-
for (const
|
|
500
|
-
|
|
501
|
-
const r =
|
|
481
|
+
for (const o of e)
|
|
482
|
+
o && er(t, o);
|
|
483
|
+
const r = rr(t), n = t.description, s = nr(t.openGraph, r, n);
|
|
502
484
|
return {
|
|
503
485
|
canonical: t.canonical,
|
|
504
486
|
charset: "utf-8",
|
|
@@ -511,8 +493,8 @@ function v(...e) {
|
|
|
511
493
|
viewport: "width=device-width, initial-scale=1"
|
|
512
494
|
};
|
|
513
495
|
}
|
|
514
|
-
function
|
|
515
|
-
|
|
496
|
+
function er(e, t) {
|
|
497
|
+
tr(e, t.title), t.description !== void 0 && (e.description = t.description), t.canonical !== void 0 && (e.canonical = t.canonical), t.robots && (e.robots = {
|
|
516
498
|
...e.robots ?? {},
|
|
517
499
|
...t.robots
|
|
518
500
|
}), t.openGraph && (e.openGraph = {
|
|
@@ -520,7 +502,7 @@ function Kt(e, t) {
|
|
|
520
502
|
...t.openGraph
|
|
521
503
|
}), t.custom && e.custom.push(...t.custom), t.structuredData && e.structuredData.push(...t.structuredData);
|
|
522
504
|
}
|
|
523
|
-
function
|
|
505
|
+
function tr(e, t) {
|
|
524
506
|
if (t !== void 0) {
|
|
525
507
|
if (typeof t == "string") {
|
|
526
508
|
e.title = t;
|
|
@@ -529,10 +511,10 @@ function Yt(e, t) {
|
|
|
529
511
|
t.default !== void 0 && (e.titleDefault = t.default), t.format && (e.titleFormat = t.format);
|
|
530
512
|
}
|
|
531
513
|
}
|
|
532
|
-
function
|
|
514
|
+
function rr(e) {
|
|
533
515
|
return e.title === void 0 ? e.titleDefault : e.titleFormat ? e.titleFormat(e.title) : e.title;
|
|
534
516
|
}
|
|
535
|
-
function
|
|
517
|
+
function nr(e, t, r) {
|
|
536
518
|
if (!(!e && !t && !r))
|
|
537
519
|
return {
|
|
538
520
|
...t ? { title: t } : {},
|
|
@@ -540,7 +522,7 @@ function Qt(e, t, r) {
|
|
|
540
522
|
...e ?? {}
|
|
541
523
|
};
|
|
542
524
|
}
|
|
543
|
-
function
|
|
525
|
+
function ot(e) {
|
|
544
526
|
const t = {
|
|
545
527
|
fallbacks: {
|
|
546
528
|
error: [],
|
|
@@ -553,57 +535,57 @@ function rt(e) {
|
|
|
553
535
|
policies: []
|
|
554
536
|
};
|
|
555
537
|
for (const [r, n] of Object.entries(e)) {
|
|
556
|
-
const s = r.replace(/^\/src\/routes\//, "").replace(/^\.\/routes\//, "").replace(/\.tsx?$/, "").split("/"),
|
|
557
|
-
if (
|
|
538
|
+
const s = r.replace(/^\/src\/routes\//, "").replace(/^\.\/routes\//, "").replace(/\.tsx?$/, "").split("/"), o = s.at(-1);
|
|
539
|
+
if (o === "@layout") {
|
|
558
540
|
t.layouts.push({
|
|
559
541
|
file: r,
|
|
560
542
|
fileSegments: s.slice(0, -1),
|
|
561
|
-
segments:
|
|
543
|
+
segments: v(s.slice(0, -1)),
|
|
562
544
|
load: n
|
|
563
545
|
});
|
|
564
546
|
continue;
|
|
565
547
|
}
|
|
566
|
-
if (
|
|
548
|
+
if (o === "@policy") {
|
|
567
549
|
t.policies.push({
|
|
568
550
|
file: r,
|
|
569
551
|
fileSegments: s.slice(0, -1),
|
|
570
|
-
segments:
|
|
552
|
+
segments: v(s.slice(0, -1)),
|
|
571
553
|
load: n
|
|
572
554
|
});
|
|
573
555
|
continue;
|
|
574
556
|
}
|
|
575
|
-
if (
|
|
557
|
+
if (o === "@middleware") {
|
|
576
558
|
t.middlewares.push({
|
|
577
559
|
file: r,
|
|
578
560
|
fileSegments: s.slice(0, -1),
|
|
579
|
-
segments:
|
|
561
|
+
segments: v(s.slice(0, -1)),
|
|
580
562
|
load: n
|
|
581
563
|
});
|
|
582
564
|
continue;
|
|
583
565
|
}
|
|
584
|
-
if (
|
|
566
|
+
if (o === "@loading") {
|
|
585
567
|
t.fallbacks.loading.push({
|
|
586
568
|
file: r,
|
|
587
569
|
fileSegments: s.slice(0, -1),
|
|
588
|
-
segments:
|
|
570
|
+
segments: v(s.slice(0, -1)),
|
|
589
571
|
load: n
|
|
590
572
|
});
|
|
591
573
|
continue;
|
|
592
574
|
}
|
|
593
|
-
if (
|
|
575
|
+
if (o === "@error") {
|
|
594
576
|
t.fallbacks.error.push({
|
|
595
577
|
file: r,
|
|
596
578
|
fileSegments: s.slice(0, -1),
|
|
597
|
-
segments:
|
|
579
|
+
segments: v(s.slice(0, -1)),
|
|
598
580
|
load: n
|
|
599
581
|
});
|
|
600
582
|
continue;
|
|
601
583
|
}
|
|
602
|
-
if (
|
|
584
|
+
if (o === "@not-found") {
|
|
603
585
|
t.fallbacks.notFound.push({
|
|
604
586
|
file: r,
|
|
605
587
|
fileSegments: s.slice(0, -1),
|
|
606
|
-
segments:
|
|
588
|
+
segments: v(s.slice(0, -1)),
|
|
607
589
|
load: n
|
|
608
590
|
});
|
|
609
591
|
continue;
|
|
@@ -611,12 +593,12 @@ function rt(e) {
|
|
|
611
593
|
t.routes.push({
|
|
612
594
|
file: r,
|
|
613
595
|
fileSegments: s,
|
|
614
|
-
segments:
|
|
615
|
-
score:
|
|
596
|
+
segments: v(s),
|
|
597
|
+
score: Er(s),
|
|
616
598
|
load: n
|
|
617
599
|
});
|
|
618
600
|
}
|
|
619
|
-
return
|
|
601
|
+
return sr(t.routes), t.routes.sort(ar), t.layouts.sort(
|
|
620
602
|
(r, n) => r.fileSegments.length - n.fileSegments.length || r.file.localeCompare(n.file)
|
|
621
603
|
), t.policies.sort(
|
|
622
604
|
(r, n) => r.fileSegments.length - n.fileSegments.length || r.file.localeCompare(n.file)
|
|
@@ -630,48 +612,48 @@ function rt(e) {
|
|
|
630
612
|
(r, n) => r.fileSegments.length - n.fileSegments.length || r.file.localeCompare(n.file)
|
|
631
613
|
), t;
|
|
632
614
|
}
|
|
633
|
-
function
|
|
615
|
+
function sr(e) {
|
|
634
616
|
const t = /* @__PURE__ */ new Map();
|
|
635
617
|
for (const r of e) {
|
|
636
618
|
const n = r.segments.findIndex(
|
|
637
|
-
(
|
|
619
|
+
(i) => i.startsWith("*")
|
|
638
620
|
);
|
|
639
621
|
if (n !== -1 && n !== r.segments.length - 1)
|
|
640
622
|
throw new Error(
|
|
641
623
|
`Catchall route segment in "${r.file}" must be the final URL segment.`
|
|
642
624
|
);
|
|
643
|
-
const s = r.segments.map(
|
|
644
|
-
if (
|
|
625
|
+
const s = r.segments.map(or).join("/"), o = t.get(s);
|
|
626
|
+
if (o)
|
|
645
627
|
throw new Error(
|
|
646
|
-
`Ambiguous routes "${
|
|
628
|
+
`Ambiguous routes "${o.file}" and "${r.file}" have the same runtime shape and both match "${ir(r.segments)}".`
|
|
647
629
|
);
|
|
648
630
|
t.set(s, r);
|
|
649
631
|
}
|
|
650
632
|
}
|
|
651
|
-
function
|
|
633
|
+
function or(e) {
|
|
652
634
|
return e.startsWith("*") ? "*" : e.startsWith(":") ? ":" : `=${e}`;
|
|
653
635
|
}
|
|
654
|
-
function
|
|
636
|
+
function ir(e) {
|
|
655
637
|
return e.length === 0 ? "/" : `/${e.map((t) => t.startsWith(":") || t.startsWith("*") ? "example" : t).join("/")}`;
|
|
656
638
|
}
|
|
657
|
-
function
|
|
639
|
+
function ar(e, t) {
|
|
658
640
|
const r = Math.max(e.segments.length, t.segments.length);
|
|
659
641
|
for (let n = 0; n < r; n += 1) {
|
|
660
|
-
const s =
|
|
642
|
+
const s = Ue(t.segments[n]) - Ue(e.segments[n]);
|
|
661
643
|
if (s !== 0)
|
|
662
644
|
return s;
|
|
663
645
|
}
|
|
664
646
|
return e.file.localeCompare(t.file);
|
|
665
647
|
}
|
|
666
|
-
function
|
|
648
|
+
function Ue(e) {
|
|
667
649
|
return e === void 0 ? 4 : e.startsWith("*") ? 1 : e.startsWith(":") ? 2 : 3;
|
|
668
650
|
}
|
|
669
|
-
async function
|
|
670
|
-
const
|
|
651
|
+
async function it(e, t, r = new Request(`http://demiurge.local${t}`), n, s = we(), o = {}) {
|
|
652
|
+
const i = o.documentContributions ?? !0, a = B(e.routes, t);
|
|
671
653
|
if (!a)
|
|
672
654
|
return {
|
|
673
|
-
...await
|
|
674
|
-
documentContributions:
|
|
655
|
+
...await pe(e, t, {
|
|
656
|
+
documentContributions: i
|
|
675
657
|
}),
|
|
676
658
|
status: "not-found"
|
|
677
659
|
};
|
|
@@ -680,136 +662,136 @@ async function nt(e, t, r = new Request(`http://demiurge.local${t}`), n, s = ge(
|
|
|
680
662
|
), u = await a.route.load();
|
|
681
663
|
if (!u.GET || u.GET.kind !== "page")
|
|
682
664
|
return {
|
|
683
|
-
...await
|
|
684
|
-
fallback:
|
|
665
|
+
...await pe(e, t, {
|
|
666
|
+
fallback: ve(
|
|
685
667
|
e.fallbacks.notFound,
|
|
686
668
|
a.route
|
|
687
669
|
),
|
|
688
|
-
documentContributions:
|
|
670
|
+
documentContributions: i,
|
|
689
671
|
layouts: c
|
|
690
672
|
}),
|
|
691
673
|
status: "not-found"
|
|
692
674
|
};
|
|
693
|
-
const
|
|
675
|
+
const l = u.GET.layout === !1 ? [] : await Promise.all(c.map((d) => d.load())), f = new URL(r.url), h = {
|
|
694
676
|
cache: s,
|
|
695
|
-
context:
|
|
677
|
+
context: o.requestContext ?? {},
|
|
696
678
|
path: a.path,
|
|
697
679
|
pathname: t,
|
|
698
680
|
request: r,
|
|
699
|
-
search:
|
|
700
|
-
url:
|
|
681
|
+
search: f.searchParams,
|
|
682
|
+
url: f
|
|
701
683
|
};
|
|
702
684
|
return {
|
|
703
685
|
status: "ready",
|
|
704
686
|
match: {
|
|
705
|
-
data: u.GET.data && !n?.hasData ? await u.GET.data(
|
|
706
|
-
error: await
|
|
707
|
-
links:
|
|
687
|
+
data: u.GET.data && !n?.hasData ? await u.GET.data(h) : n?.data,
|
|
688
|
+
error: await at(e, a.route),
|
|
689
|
+
links: i ? await Ut(
|
|
708
690
|
[
|
|
709
|
-
...
|
|
691
|
+
...l.map((d) => d.links),
|
|
710
692
|
u.links
|
|
711
693
|
],
|
|
712
|
-
|
|
694
|
+
h
|
|
713
695
|
) : [],
|
|
714
696
|
page: u.GET.view,
|
|
715
|
-
layouts:
|
|
697
|
+
layouts: l.map(
|
|
716
698
|
(d) => d.default
|
|
717
699
|
),
|
|
718
|
-
metadata:
|
|
719
|
-
...
|
|
700
|
+
metadata: i ? R(
|
|
701
|
+
...l.map((d) => d.metadata),
|
|
720
702
|
u.metadata
|
|
721
|
-
) :
|
|
703
|
+
) : R(),
|
|
722
704
|
path: a.path,
|
|
723
705
|
pathname: t,
|
|
724
706
|
render: u.GET.render,
|
|
725
|
-
scripts:
|
|
707
|
+
scripts: i ? await It(
|
|
726
708
|
[
|
|
727
|
-
...
|
|
709
|
+
...l.map((d) => d.scripts),
|
|
728
710
|
u.scripts
|
|
729
711
|
],
|
|
730
|
-
|
|
712
|
+
h
|
|
731
713
|
) : []
|
|
732
714
|
}
|
|
733
715
|
};
|
|
734
716
|
}
|
|
735
|
-
async function
|
|
736
|
-
const r =
|
|
717
|
+
async function $o(e, t = {}) {
|
|
718
|
+
const r = we(), n = [];
|
|
737
719
|
for (const s of e.routes) {
|
|
738
|
-
const
|
|
739
|
-
if (!
|
|
720
|
+
const o = await s.load();
|
|
721
|
+
if (!o.GET || o.GET.kind !== "page" && !t.includeResources)
|
|
740
722
|
continue;
|
|
741
|
-
if (
|
|
723
|
+
if (o.GET.kind === "page" && o.GET.render.mode !== "static")
|
|
742
724
|
throw new Error(
|
|
743
|
-
`Page route "${s.file}" uses render mode "${
|
|
725
|
+
`Page route "${s.file}" uses render mode "${o.GET.render.mode}" and cannot be emitted as static output. Set render: { mode: "static" } or deploy a runtime adapter.`
|
|
744
726
|
);
|
|
745
|
-
const
|
|
746
|
-
if (
|
|
727
|
+
const i = mr(s.segments);
|
|
728
|
+
if (gr(s.segments).length === 0) {
|
|
747
729
|
n.push({
|
|
748
730
|
file: s.file,
|
|
749
731
|
path: {},
|
|
750
|
-
pattern:
|
|
751
|
-
pathname:
|
|
732
|
+
pattern: i,
|
|
733
|
+
pathname: i
|
|
752
734
|
});
|
|
753
735
|
continue;
|
|
754
736
|
}
|
|
755
|
-
if (!
|
|
737
|
+
if (!o.paths)
|
|
756
738
|
throw new Error(
|
|
757
|
-
`Dynamic static route "${s.file}" must export paths for "${
|
|
739
|
+
`Dynamic static route "${s.file}" must export paths for "${i}".`
|
|
758
740
|
);
|
|
759
|
-
const c = await
|
|
741
|
+
const c = await o.paths({ cache: r });
|
|
760
742
|
for (const u of c) {
|
|
761
|
-
const
|
|
743
|
+
const l = yr(s, i, u);
|
|
762
744
|
n.push({
|
|
763
745
|
file: s.file,
|
|
764
|
-
path:
|
|
765
|
-
pattern:
|
|
766
|
-
pathname:
|
|
746
|
+
path: l,
|
|
747
|
+
pattern: i,
|
|
748
|
+
pathname: Sr(s.segments, l)
|
|
767
749
|
});
|
|
768
750
|
}
|
|
769
751
|
}
|
|
770
752
|
return n;
|
|
771
753
|
}
|
|
772
|
-
async function
|
|
773
|
-
const r =
|
|
754
|
+
async function ko(e, t) {
|
|
755
|
+
const r = B(e.routes, t);
|
|
774
756
|
if (r)
|
|
775
|
-
return await
|
|
776
|
-
|
|
757
|
+
return await dr(
|
|
758
|
+
ve(e.fallbacks.loading, r.route)
|
|
777
759
|
);
|
|
778
760
|
}
|
|
779
|
-
async function
|
|
761
|
+
async function cr(e, t) {
|
|
780
762
|
let r;
|
|
781
763
|
try {
|
|
782
|
-
r =
|
|
764
|
+
r = B(e.routes, t);
|
|
783
765
|
} catch (n) {
|
|
784
|
-
if (!(n instanceof
|
|
785
|
-
return await
|
|
766
|
+
if (!(n instanceof Te)) throw n;
|
|
767
|
+
return await be(
|
|
786
768
|
e.fallbacks.error.find(
|
|
787
769
|
(s) => s.fileSegments.length === 0
|
|
788
770
|
)
|
|
789
771
|
);
|
|
790
772
|
}
|
|
791
|
-
return r ? await
|
|
773
|
+
return r ? await at(e, r.route) : await ur(e, t);
|
|
792
774
|
}
|
|
793
|
-
async function
|
|
794
|
-
return await
|
|
795
|
-
|
|
775
|
+
async function at(e, t) {
|
|
776
|
+
return await be(
|
|
777
|
+
ve(e.fallbacks.error, t)
|
|
796
778
|
);
|
|
797
779
|
}
|
|
798
|
-
async function
|
|
799
|
-
return await
|
|
800
|
-
|
|
780
|
+
async function ur(e, t) {
|
|
781
|
+
return await be(
|
|
782
|
+
ct(e.fallbacks.error, t)
|
|
801
783
|
);
|
|
802
784
|
}
|
|
803
|
-
async function
|
|
804
|
-
const s = await (r.fallback ??
|
|
785
|
+
async function pe(e, t, r = {}) {
|
|
786
|
+
const s = await (r.fallback ?? ct(e.fallbacks.notFound, t))?.load(), o = s?.default, i = r.documentContributions ?? !0;
|
|
805
787
|
if (s?.layout === !1)
|
|
806
788
|
return {
|
|
807
789
|
layouts: [],
|
|
808
|
-
metadata:
|
|
809
|
-
notFound:
|
|
790
|
+
metadata: i ? R(s.metadata) : R(),
|
|
791
|
+
notFound: o,
|
|
810
792
|
pathname: t
|
|
811
793
|
};
|
|
812
|
-
const a = r.layouts ??
|
|
794
|
+
const a = r.layouts ?? lr(e, t);
|
|
813
795
|
try {
|
|
814
796
|
const c = await Promise.all(
|
|
815
797
|
a.map((u) => u.load())
|
|
@@ -818,86 +800,86 @@ async function de(e, t, r = {}) {
|
|
|
818
800
|
layouts: c.map(
|
|
819
801
|
(u) => u.default
|
|
820
802
|
),
|
|
821
|
-
metadata:
|
|
803
|
+
metadata: i ? R(
|
|
822
804
|
...c.map((u) => u.metadata),
|
|
823
805
|
s?.metadata
|
|
824
|
-
) :
|
|
825
|
-
notFound:
|
|
806
|
+
) : R(),
|
|
807
|
+
notFound: o,
|
|
826
808
|
pathname: t
|
|
827
809
|
};
|
|
828
810
|
} catch (c) {
|
|
829
811
|
return r.onLayoutError?.(c), {
|
|
830
812
|
layouts: [],
|
|
831
|
-
metadata:
|
|
832
|
-
notFound:
|
|
813
|
+
metadata: i ? R(s?.metadata) : R(),
|
|
814
|
+
notFound: o,
|
|
833
815
|
pathname: t
|
|
834
816
|
};
|
|
835
817
|
}
|
|
836
818
|
}
|
|
837
|
-
function
|
|
838
|
-
const r =
|
|
819
|
+
function lr(e, t) {
|
|
820
|
+
const r = re(t);
|
|
839
821
|
return e.layouts.filter(
|
|
840
|
-
(n) => !n.fileSegments.some(
|
|
822
|
+
(n) => !n.fileSegments.some(te) && Re(n.segments, r)
|
|
841
823
|
);
|
|
842
824
|
}
|
|
843
|
-
function
|
|
844
|
-
const r =
|
|
825
|
+
function fr(e, t) {
|
|
826
|
+
const r = re(t);
|
|
845
827
|
return e.policies.filter(
|
|
846
|
-
(n) => !n.fileSegments.some(
|
|
828
|
+
(n) => !n.fileSegments.some(te) && Re(n.segments, r)
|
|
847
829
|
);
|
|
848
830
|
}
|
|
849
|
-
function
|
|
831
|
+
function ve(e, t) {
|
|
850
832
|
for (let r = e.length - 1; r >= 0; r -= 1) {
|
|
851
833
|
const n = e[r];
|
|
852
834
|
if (T(n.fileSegments, t.fileSegments))
|
|
853
835
|
return n;
|
|
854
836
|
}
|
|
855
837
|
}
|
|
856
|
-
function
|
|
857
|
-
const r =
|
|
838
|
+
function ct(e, t) {
|
|
839
|
+
const r = re(t);
|
|
858
840
|
for (let n = e.length - 1; n >= 0; n -= 1) {
|
|
859
841
|
const s = e[n];
|
|
860
|
-
if (!s.fileSegments.some(
|
|
842
|
+
if (!s.fileSegments.some(te) && Re(s.segments, r))
|
|
861
843
|
return s;
|
|
862
844
|
}
|
|
863
845
|
}
|
|
864
|
-
function
|
|
846
|
+
function Re(e, t) {
|
|
865
847
|
return e.every((r, n) => r.startsWith("*") ? t.length > n : r.startsWith(":") ? !!t[n] : t[n] === r);
|
|
866
848
|
}
|
|
867
|
-
async function
|
|
849
|
+
async function dr(e) {
|
|
868
850
|
return e ? (await e.load()).default : void 0;
|
|
869
851
|
}
|
|
870
|
-
async function
|
|
852
|
+
async function be(e) {
|
|
871
853
|
return e ? (await e.load()).default : void 0;
|
|
872
854
|
}
|
|
873
|
-
function
|
|
874
|
-
const r =
|
|
855
|
+
function B(e, t) {
|
|
856
|
+
const r = re(t);
|
|
875
857
|
for (const n of e) {
|
|
876
|
-
const s =
|
|
858
|
+
const s = hr(n.segments, r);
|
|
877
859
|
if (s)
|
|
878
860
|
return { route: n, path: s };
|
|
879
861
|
}
|
|
880
862
|
return null;
|
|
881
863
|
}
|
|
882
|
-
const
|
|
883
|
-
function
|
|
864
|
+
const No = it, Oo = B;
|
|
865
|
+
function hr(e, t) {
|
|
884
866
|
const r = {};
|
|
885
867
|
for (let n = 0; n < e.length; n += 1) {
|
|
886
|
-
const s = e[n],
|
|
868
|
+
const s = e[n], o = t[n];
|
|
887
869
|
if (s?.startsWith("*"))
|
|
888
870
|
return r[s.slice(1)] = t.slice(n).join("/"), r;
|
|
889
|
-
if (!
|
|
871
|
+
if (!o)
|
|
890
872
|
return null;
|
|
891
873
|
if (s.startsWith(":")) {
|
|
892
|
-
r[s.slice(1)] =
|
|
874
|
+
r[s.slice(1)] = o;
|
|
893
875
|
continue;
|
|
894
876
|
}
|
|
895
|
-
if (s !==
|
|
877
|
+
if (s !== o)
|
|
896
878
|
return null;
|
|
897
879
|
}
|
|
898
880
|
return e.length === t.length ? r : null;
|
|
899
881
|
}
|
|
900
|
-
function
|
|
882
|
+
function Lo(e, t) {
|
|
901
883
|
return e.every(
|
|
902
884
|
(r, n) => t[n] === r
|
|
903
885
|
);
|
|
@@ -907,58 +889,58 @@ function T(e, t) {
|
|
|
907
889
|
(r, n) => t[n] === r
|
|
908
890
|
);
|
|
909
891
|
}
|
|
910
|
-
function
|
|
911
|
-
return e.flatMap((t) =>
|
|
892
|
+
function v(e) {
|
|
893
|
+
return e.flatMap((t) => te(t) ? [] : t === "index" ? [] : t.startsWith("[...") && t.endsWith("]") ? [`*${t.slice(4, -1)}`] : t.startsWith("[") && t.endsWith("]") ? [`:${t.slice(1, -1)}`] : [t]);
|
|
912
894
|
}
|
|
913
|
-
function
|
|
895
|
+
function te(e) {
|
|
914
896
|
return e.startsWith("(") && e.endsWith(")");
|
|
915
897
|
}
|
|
916
|
-
function
|
|
917
|
-
return e.length === 0 ? "/" : `/${e.map(
|
|
898
|
+
function mr(e) {
|
|
899
|
+
return e.length === 0 ? "/" : `/${e.map(pr).join("/")}`;
|
|
918
900
|
}
|
|
919
|
-
function
|
|
901
|
+
function pr(e) {
|
|
920
902
|
return e.startsWith("*") ? `[...${e.slice(1)}]` : e.startsWith(":") ? `[${e.slice(1)}]` : e;
|
|
921
903
|
}
|
|
922
|
-
function
|
|
904
|
+
function gr(e) {
|
|
923
905
|
return e.flatMap((t) => t.startsWith(":") || t.startsWith("*") ? [t.slice(1)] : []);
|
|
924
906
|
}
|
|
925
|
-
function
|
|
907
|
+
function yr(e, t, r) {
|
|
926
908
|
const n = {};
|
|
927
909
|
for (const s of e.segments) {
|
|
928
910
|
if (!s.startsWith(":") && !s.startsWith("*"))
|
|
929
911
|
continue;
|
|
930
|
-
const
|
|
931
|
-
if (
|
|
912
|
+
const o = s.slice(1), i = r[o];
|
|
913
|
+
if (i === void 0)
|
|
932
914
|
throw new Error(
|
|
933
|
-
`Static paths for "${e.file}" must include "${
|
|
915
|
+
`Static paths for "${e.file}" must include "${o}" for "${t}".`
|
|
934
916
|
);
|
|
935
|
-
if (!
|
|
917
|
+
if (!wr(i))
|
|
936
918
|
throw new Error(
|
|
937
|
-
`Static path "${
|
|
919
|
+
`Static path "${o}" for "${e.file}" must be a string, number, or boolean.`
|
|
938
920
|
);
|
|
939
|
-
n[
|
|
921
|
+
n[o] = String(i);
|
|
940
922
|
}
|
|
941
923
|
return n;
|
|
942
924
|
}
|
|
943
|
-
function
|
|
925
|
+
function wr(e) {
|
|
944
926
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
945
927
|
}
|
|
946
|
-
function
|
|
928
|
+
function Sr(e, t) {
|
|
947
929
|
return `/${e.map((n) => n.startsWith("*") ? t[n.slice(1)].split("/").filter(Boolean).map(encodeURIComponent).join("/") : n.startsWith(":") ? encodeURIComponent(t[n.slice(1)]) : encodeURIComponent(n)).filter(Boolean).join("/")}`;
|
|
948
930
|
}
|
|
949
|
-
function
|
|
950
|
-
return
|
|
931
|
+
function Er(e) {
|
|
932
|
+
return v(e).reduce((t, r) => r.startsWith("*") ? t : r.startsWith(":") ? t + 1 : t + 2, 0);
|
|
951
933
|
}
|
|
952
|
-
function
|
|
934
|
+
function re(e) {
|
|
953
935
|
return e.replace(/^\/|\/$/g, "").split("/").filter(Boolean).map((t) => {
|
|
954
936
|
try {
|
|
955
937
|
return decodeURIComponent(t);
|
|
956
938
|
} catch (r) {
|
|
957
|
-
throw new
|
|
939
|
+
throw new Te(e, { cause: r });
|
|
958
940
|
}
|
|
959
941
|
});
|
|
960
942
|
}
|
|
961
|
-
class
|
|
943
|
+
class Te extends URIError {
|
|
962
944
|
pathname;
|
|
963
945
|
constructor(t, r) {
|
|
964
946
|
super(
|
|
@@ -967,35 +949,35 @@ class Ee extends URIError {
|
|
|
967
949
|
), this.name = "MalformedPathnameError", this.pathname = t;
|
|
968
950
|
}
|
|
969
951
|
}
|
|
970
|
-
const C = "x-demiurge-navigation",
|
|
971
|
-
function
|
|
972
|
-
return e.headers.get(C) ===
|
|
952
|
+
const C = "x-demiurge-navigation", vr = "data", Rr = "data", ae = "error", Fe = "not-found";
|
|
953
|
+
function ut(e) {
|
|
954
|
+
return e.headers.get(C) === vr;
|
|
973
955
|
}
|
|
974
|
-
function
|
|
956
|
+
function br(e) {
|
|
975
957
|
return Response.json(
|
|
976
958
|
{ data: e, hasData: !0 },
|
|
977
959
|
{
|
|
978
960
|
headers: {
|
|
979
961
|
"cache-control": "no-store",
|
|
980
|
-
[C]:
|
|
962
|
+
[C]: Rr,
|
|
981
963
|
vary: C
|
|
982
964
|
}
|
|
983
965
|
}
|
|
984
966
|
);
|
|
985
967
|
}
|
|
986
|
-
function
|
|
968
|
+
function _(e, t) {
|
|
987
969
|
return e.headers.set("cache-control", "no-store"), e.headers.set(C, t), e.headers.append("vary", C), e;
|
|
988
970
|
}
|
|
989
|
-
function
|
|
971
|
+
function Tr(e) {
|
|
990
972
|
if (typeof e == "string")
|
|
991
973
|
return e;
|
|
992
|
-
const t =
|
|
974
|
+
const t = xr(Cr(
|
|
993
975
|
e.to,
|
|
994
976
|
"path" in e ? e.path : void 0
|
|
995
|
-
)), r = e.search === void 0 ? t.search :
|
|
977
|
+
)), r = e.search === void 0 ? t.search : Ar(e.search), n = e.hash === void 0 ? t.hash : e.hash ? e.hash.startsWith("#") ? e.hash : `#${e.hash}` : "";
|
|
996
978
|
return `${t.pathname}${r}${n}`;
|
|
997
979
|
}
|
|
998
|
-
function
|
|
980
|
+
function xr(e) {
|
|
999
981
|
const t = e.indexOf("#"), r = t === -1 ? e : e.slice(0, t), n = r.indexOf("?");
|
|
1000
982
|
return {
|
|
1001
983
|
hash: t === -1 ? "" : e.slice(t),
|
|
@@ -1003,133 +985,133 @@ function Er(e) {
|
|
|
1003
985
|
search: n === -1 ? "" : r.slice(n)
|
|
1004
986
|
};
|
|
1005
987
|
}
|
|
1006
|
-
function
|
|
988
|
+
function Ar(e) {
|
|
1007
989
|
if (!e)
|
|
1008
990
|
return "";
|
|
1009
991
|
if (typeof e == "string")
|
|
1010
992
|
return e.startsWith("?") ? e : `?${e}`;
|
|
1011
|
-
const r = (e instanceof URLSearchParams ? e :
|
|
993
|
+
const r = (e instanceof URLSearchParams ? e : Pr(e)).toString();
|
|
1012
994
|
return r ? `?${r}` : "";
|
|
1013
995
|
}
|
|
1014
|
-
function
|
|
996
|
+
function Pr(e) {
|
|
1015
997
|
const t = new URLSearchParams();
|
|
1016
998
|
for (const [r, n] of Object.entries(e)) {
|
|
1017
999
|
const s = Array.isArray(n) ? n : [n];
|
|
1018
|
-
for (const
|
|
1019
|
-
|
|
1000
|
+
for (const o of s)
|
|
1001
|
+
o != null && t.append(r, String(o));
|
|
1020
1002
|
}
|
|
1021
1003
|
return t;
|
|
1022
1004
|
}
|
|
1023
|
-
function
|
|
1005
|
+
function Cr(e, t) {
|
|
1024
1006
|
return t ? e.replace(
|
|
1025
1007
|
/\[(\.\.\.)?([a-zA-Z_$][a-zA-Z0-9_$]*)\]/g,
|
|
1026
1008
|
(r, n, s) => {
|
|
1027
|
-
const
|
|
1028
|
-
if (
|
|
1009
|
+
const o = t[s];
|
|
1010
|
+
if (o === void 0)
|
|
1029
1011
|
throw new Error(`Missing path value for "${s}" in route "${e}".`);
|
|
1030
|
-
return n ? String(
|
|
1012
|
+
return n ? String(o).split("/").filter(Boolean).map((i) => encodeURIComponent(i)).join("/") : encodeURIComponent(String(o));
|
|
1031
1013
|
}
|
|
1032
1014
|
) : e;
|
|
1033
1015
|
}
|
|
1034
|
-
function
|
|
1016
|
+
function Mo(e, t) {
|
|
1035
1017
|
return {
|
|
1036
1018
|
cors: t?.cors,
|
|
1037
1019
|
kind: "json",
|
|
1038
1020
|
security: t?.security,
|
|
1039
|
-
timing:
|
|
1021
|
+
timing: E(t?.timing),
|
|
1040
1022
|
value: e,
|
|
1041
1023
|
init: b(t)
|
|
1042
1024
|
};
|
|
1043
1025
|
}
|
|
1044
|
-
function
|
|
1026
|
+
function Io(e, t) {
|
|
1045
1027
|
return {
|
|
1046
1028
|
cors: t?.cors,
|
|
1047
1029
|
init: b(t),
|
|
1048
1030
|
kind: "jsonl",
|
|
1049
1031
|
lines: e,
|
|
1050
1032
|
security: t?.security,
|
|
1051
|
-
timing:
|
|
1033
|
+
timing: E(t?.timing)
|
|
1052
1034
|
};
|
|
1053
1035
|
}
|
|
1054
|
-
function
|
|
1036
|
+
function Uo(e, t) {
|
|
1055
1037
|
return {
|
|
1056
1038
|
cors: t?.cors,
|
|
1057
1039
|
kind: "text",
|
|
1058
1040
|
security: t?.security,
|
|
1059
|
-
timing:
|
|
1041
|
+
timing: E(t?.timing),
|
|
1060
1042
|
value: e,
|
|
1061
1043
|
init: b(t)
|
|
1062
1044
|
};
|
|
1063
1045
|
}
|
|
1064
|
-
function
|
|
1046
|
+
function Fo(e, t) {
|
|
1065
1047
|
return {
|
|
1066
1048
|
cors: t?.cors,
|
|
1067
1049
|
kind: "html",
|
|
1068
1050
|
security: t?.security,
|
|
1069
|
-
timing:
|
|
1051
|
+
timing: E(t?.timing),
|
|
1070
1052
|
value: e,
|
|
1071
1053
|
init: b(t)
|
|
1072
1054
|
};
|
|
1073
1055
|
}
|
|
1074
|
-
function
|
|
1056
|
+
function Ho(e, t) {
|
|
1075
1057
|
const r = typeof t == "number" ? void 0 : t;
|
|
1076
1058
|
return {
|
|
1077
1059
|
cors: r?.cors,
|
|
1078
1060
|
kind: "redirect",
|
|
1079
1061
|
security: r?.security,
|
|
1080
|
-
timing:
|
|
1081
|
-
to:
|
|
1062
|
+
timing: E(r?.timing),
|
|
1063
|
+
to: Fr(e) ? Tr(e) : e,
|
|
1082
1064
|
init: typeof t == "number" ? { status: t } : b(t)
|
|
1083
1065
|
};
|
|
1084
1066
|
}
|
|
1085
|
-
function
|
|
1067
|
+
function jo(e, t) {
|
|
1086
1068
|
return {
|
|
1087
1069
|
cors: t?.cors,
|
|
1088
1070
|
kind: "not-found",
|
|
1089
1071
|
security: t?.security,
|
|
1090
|
-
timing:
|
|
1072
|
+
timing: E(t?.timing),
|
|
1091
1073
|
body: e,
|
|
1092
1074
|
init: b(t)
|
|
1093
1075
|
};
|
|
1094
1076
|
}
|
|
1095
|
-
function
|
|
1077
|
+
function Wo(e, t) {
|
|
1096
1078
|
return {
|
|
1097
1079
|
cors: t?.cors,
|
|
1098
1080
|
kind: "response",
|
|
1099
1081
|
response: e,
|
|
1100
1082
|
security: t?.security,
|
|
1101
|
-
timing:
|
|
1083
|
+
timing: E(t?.timing)
|
|
1102
1084
|
};
|
|
1103
1085
|
}
|
|
1104
|
-
function
|
|
1086
|
+
function zo(e, t) {
|
|
1105
1087
|
return {
|
|
1106
1088
|
body: e,
|
|
1107
1089
|
cors: t?.cors,
|
|
1108
1090
|
init: b(t),
|
|
1109
1091
|
kind: "stream",
|
|
1110
1092
|
security: t?.security,
|
|
1111
|
-
timing:
|
|
1093
|
+
timing: E(t?.timing)
|
|
1112
1094
|
};
|
|
1113
1095
|
}
|
|
1114
|
-
function
|
|
1096
|
+
function Bo(e, t) {
|
|
1115
1097
|
return {
|
|
1116
1098
|
cors: t?.cors,
|
|
1117
1099
|
events: e,
|
|
1118
1100
|
init: b(t),
|
|
1119
1101
|
kind: "sse",
|
|
1120
1102
|
security: t?.security,
|
|
1121
|
-
timing:
|
|
1103
|
+
timing: E(t?.timing)
|
|
1122
1104
|
};
|
|
1123
1105
|
}
|
|
1124
|
-
function
|
|
1106
|
+
function qo(...e) {
|
|
1125
1107
|
return e;
|
|
1126
1108
|
}
|
|
1127
|
-
async function
|
|
1109
|
+
async function Dr(e, t) {
|
|
1128
1110
|
switch (e.kind) {
|
|
1129
1111
|
case "json":
|
|
1130
|
-
return new Response(JSON.stringify(await
|
|
1112
|
+
return new Response(JSON.stringify(await w(e.value, t)), {
|
|
1131
1113
|
...e.init,
|
|
1132
|
-
headers:
|
|
1114
|
+
headers: ce(
|
|
1133
1115
|
e.init?.headers,
|
|
1134
1116
|
"content-type",
|
|
1135
1117
|
"application/json; charset=utf-8"
|
|
@@ -1137,10 +1119,10 @@ async function Tr(e, t) {
|
|
|
1137
1119
|
});
|
|
1138
1120
|
case "jsonl":
|
|
1139
1121
|
return new Response(
|
|
1140
|
-
|
|
1122
|
+
kr(await w(e.lines, t)),
|
|
1141
1123
|
{
|
|
1142
1124
|
...e.init,
|
|
1143
|
-
headers:
|
|
1125
|
+
headers: K(e.init?.headers, {
|
|
1144
1126
|
"cache-control": "no-cache",
|
|
1145
1127
|
"content-type": "application/x-ndjson; charset=utf-8",
|
|
1146
1128
|
"x-accel-buffering": "no"
|
|
@@ -1148,18 +1130,18 @@ async function Tr(e, t) {
|
|
|
1148
1130
|
}
|
|
1149
1131
|
);
|
|
1150
1132
|
case "text":
|
|
1151
|
-
return new Response(await
|
|
1133
|
+
return new Response(await w(e.value, t), {
|
|
1152
1134
|
...e.init,
|
|
1153
|
-
headers:
|
|
1135
|
+
headers: ce(
|
|
1154
1136
|
e.init?.headers,
|
|
1155
1137
|
"content-type",
|
|
1156
1138
|
"text/plain; charset=utf-8"
|
|
1157
1139
|
)
|
|
1158
1140
|
});
|
|
1159
1141
|
case "html":
|
|
1160
|
-
return new Response(await
|
|
1142
|
+
return new Response(await w(e.value, t), {
|
|
1161
1143
|
...e.init,
|
|
1162
|
-
headers:
|
|
1144
|
+
headers: ce(
|
|
1163
1145
|
e.init?.headers,
|
|
1164
1146
|
"content-type",
|
|
1165
1147
|
"text/html; charset=utf-8"
|
|
@@ -1167,7 +1149,7 @@ async function Tr(e, t) {
|
|
|
1167
1149
|
});
|
|
1168
1150
|
case "redirect": {
|
|
1169
1151
|
const r = new Headers(e.init?.headers);
|
|
1170
|
-
return r.set("location", String(await
|
|
1152
|
+
return r.set("location", String(await w(e.to, t))), new Response(null, {
|
|
1171
1153
|
...e.init,
|
|
1172
1154
|
headers: r,
|
|
1173
1155
|
status: e.init?.status ?? 302
|
|
@@ -1175,20 +1157,20 @@ async function Tr(e, t) {
|
|
|
1175
1157
|
}
|
|
1176
1158
|
case "not-found":
|
|
1177
1159
|
return new Response(
|
|
1178
|
-
e.body ? await
|
|
1160
|
+
e.body ? await w(e.body, t) : null,
|
|
1179
1161
|
{
|
|
1180
1162
|
...e.init,
|
|
1181
1163
|
status: e.init?.status ?? 404
|
|
1182
1164
|
}
|
|
1183
1165
|
);
|
|
1184
1166
|
case "response":
|
|
1185
|
-
return await
|
|
1167
|
+
return await w(e.response, t);
|
|
1186
1168
|
case "stream":
|
|
1187
1169
|
return new Response(
|
|
1188
|
-
|
|
1170
|
+
Nr(await w(e.body, t)),
|
|
1189
1171
|
{
|
|
1190
1172
|
...e.init,
|
|
1191
|
-
headers:
|
|
1173
|
+
headers: K(e.init?.headers, {
|
|
1192
1174
|
"content-type": "application/octet-stream",
|
|
1193
1175
|
"x-accel-buffering": "no"
|
|
1194
1176
|
})
|
|
@@ -1196,10 +1178,10 @@ async function Tr(e, t) {
|
|
|
1196
1178
|
);
|
|
1197
1179
|
case "sse":
|
|
1198
1180
|
return new Response(
|
|
1199
|
-
|
|
1181
|
+
$r(await w(e.events, t)),
|
|
1200
1182
|
{
|
|
1201
1183
|
...e.init,
|
|
1202
|
-
headers:
|
|
1184
|
+
headers: K(e.init?.headers, {
|
|
1203
1185
|
"cache-control": "no-cache",
|
|
1204
1186
|
"content-type": "text/event-stream; charset=utf-8",
|
|
1205
1187
|
"x-accel-buffering": "no"
|
|
@@ -1208,22 +1190,22 @@ async function Tr(e, t) {
|
|
|
1208
1190
|
);
|
|
1209
1191
|
}
|
|
1210
1192
|
}
|
|
1211
|
-
async function
|
|
1193
|
+
async function w(e, t) {
|
|
1212
1194
|
return typeof e != "function" ? e : await e(
|
|
1213
1195
|
t
|
|
1214
1196
|
);
|
|
1215
1197
|
}
|
|
1216
|
-
function
|
|
1217
|
-
return
|
|
1198
|
+
function ce(e, t, r) {
|
|
1199
|
+
return K(e, { [t]: r });
|
|
1218
1200
|
}
|
|
1219
|
-
function
|
|
1201
|
+
function K(e, t) {
|
|
1220
1202
|
const r = new Headers(e);
|
|
1221
1203
|
for (const [n, s] of Object.entries(t))
|
|
1222
1204
|
r.has(n) || r.set(n, s);
|
|
1223
1205
|
return r;
|
|
1224
1206
|
}
|
|
1225
|
-
function
|
|
1226
|
-
const t = new TextEncoder(), r =
|
|
1207
|
+
function $r(e) {
|
|
1208
|
+
const t = new TextEncoder(), r = xe(e);
|
|
1227
1209
|
return new ReadableStream({
|
|
1228
1210
|
async pull(n) {
|
|
1229
1211
|
const s = await r.next();
|
|
@@ -1231,15 +1213,15 @@ function xr(e) {
|
|
|
1231
1213
|
n.close();
|
|
1232
1214
|
return;
|
|
1233
1215
|
}
|
|
1234
|
-
n.enqueue(t.encode(
|
|
1216
|
+
n.enqueue(t.encode(Mr(s.value)));
|
|
1235
1217
|
},
|
|
1236
1218
|
async cancel() {
|
|
1237
1219
|
await r.return?.();
|
|
1238
1220
|
}
|
|
1239
1221
|
});
|
|
1240
1222
|
}
|
|
1241
|
-
function
|
|
1242
|
-
const t = new TextEncoder(), r =
|
|
1223
|
+
function kr(e) {
|
|
1224
|
+
const t = new TextEncoder(), r = xe(e);
|
|
1243
1225
|
return new ReadableStream({
|
|
1244
1226
|
async pull(n) {
|
|
1245
1227
|
const s = await r.next();
|
|
@@ -1255,8 +1237,8 @@ function Pr(e) {
|
|
|
1255
1237
|
}
|
|
1256
1238
|
});
|
|
1257
1239
|
}
|
|
1258
|
-
function
|
|
1259
|
-
const t = new TextEncoder(), r =
|
|
1240
|
+
function Nr(e) {
|
|
1241
|
+
const t = new TextEncoder(), r = xe(e);
|
|
1260
1242
|
return new ReadableStream({
|
|
1261
1243
|
async pull(n) {
|
|
1262
1244
|
const s = await r.next();
|
|
@@ -1264,17 +1246,17 @@ function kr(e) {
|
|
|
1264
1246
|
n.close();
|
|
1265
1247
|
return;
|
|
1266
1248
|
}
|
|
1267
|
-
n.enqueue(
|
|
1249
|
+
n.enqueue(Or(s.value, t));
|
|
1268
1250
|
},
|
|
1269
1251
|
async cancel() {
|
|
1270
1252
|
await r.return?.();
|
|
1271
1253
|
}
|
|
1272
1254
|
});
|
|
1273
1255
|
}
|
|
1274
|
-
function
|
|
1256
|
+
function Or(e, t) {
|
|
1275
1257
|
return typeof e == "string" ? t.encode(e) : e;
|
|
1276
1258
|
}
|
|
1277
|
-
function
|
|
1259
|
+
function xe(e) {
|
|
1278
1260
|
if (e instanceof ReadableStream) {
|
|
1279
1261
|
const t = e.getReader();
|
|
1280
1262
|
return {
|
|
@@ -1286,9 +1268,9 @@ function Re(e) {
|
|
|
1286
1268
|
}
|
|
1287
1269
|
};
|
|
1288
1270
|
}
|
|
1289
|
-
return Symbol.asyncIterator in e ? e[Symbol.asyncIterator]() :
|
|
1271
|
+
return Symbol.asyncIterator in e ? e[Symbol.asyncIterator]() : Lr(e[Symbol.iterator]());
|
|
1290
1272
|
}
|
|
1291
|
-
function
|
|
1273
|
+
function Lr(e) {
|
|
1292
1274
|
return {
|
|
1293
1275
|
async next() {
|
|
1294
1276
|
return e.next();
|
|
@@ -1298,35 +1280,35 @@ function Ar(e) {
|
|
|
1298
1280
|
}
|
|
1299
1281
|
};
|
|
1300
1282
|
}
|
|
1301
|
-
function
|
|
1283
|
+
function Mr(e) {
|
|
1302
1284
|
if (typeof e == "string")
|
|
1303
|
-
return
|
|
1285
|
+
return Ir(e);
|
|
1304
1286
|
const t = [];
|
|
1305
|
-
if (e.comment !== void 0 && t.push(...
|
|
1287
|
+
if (e.comment !== void 0 && t.push(...M("", e.comment)), e.id !== void 0 && t.push(...M("id", e.id)), e.event !== void 0 && t.push(...M("event", e.event)), e.retry !== void 0) {
|
|
1306
1288
|
if (!Number.isInteger(e.retry) || e.retry < 0)
|
|
1307
1289
|
throw new Error("SSE retry must be a non-negative integer.");
|
|
1308
1290
|
t.push(`retry: ${e.retry}`);
|
|
1309
1291
|
}
|
|
1310
|
-
return e.data !== void 0 && t.push(...
|
|
1292
|
+
return e.data !== void 0 && t.push(...M("data", Ur(e.data))), `${t.join(`
|
|
1311
1293
|
`)}
|
|
1312
1294
|
|
|
1313
1295
|
`;
|
|
1314
1296
|
}
|
|
1315
|
-
function
|
|
1316
|
-
return `${
|
|
1297
|
+
function Ir(e) {
|
|
1298
|
+
return `${M("data", e).join(`
|
|
1317
1299
|
`)}
|
|
1318
1300
|
|
|
1319
1301
|
`;
|
|
1320
1302
|
}
|
|
1321
|
-
function
|
|
1303
|
+
function M(e, t) {
|
|
1322
1304
|
return t.split(/\r\n|\r|\n/).map(
|
|
1323
1305
|
(r) => e ? `${e}: ${r}` : `: ${r}`
|
|
1324
1306
|
);
|
|
1325
1307
|
}
|
|
1326
|
-
function
|
|
1308
|
+
function Ur(e) {
|
|
1327
1309
|
return typeof e == "string" ? e : JSON.stringify(e);
|
|
1328
1310
|
}
|
|
1329
|
-
function
|
|
1311
|
+
function Fr(e) {
|
|
1330
1312
|
return typeof e == "object" && e !== null && !(e instanceof URL) && "to" in e;
|
|
1331
1313
|
}
|
|
1332
1314
|
function b(e) {
|
|
@@ -1340,10 +1322,10 @@ function b(e) {
|
|
|
1340
1322
|
} = e;
|
|
1341
1323
|
return s;
|
|
1342
1324
|
}
|
|
1343
|
-
function
|
|
1325
|
+
function Hr(e, t) {
|
|
1344
1326
|
if (!t?.length)
|
|
1345
1327
|
return e;
|
|
1346
|
-
const r = new Headers(e.headers), n =
|
|
1328
|
+
const r = new Headers(e.headers), n = jr(t), s = r.get("server-timing");
|
|
1347
1329
|
return r.set(
|
|
1348
1330
|
"server-timing",
|
|
1349
1331
|
s ? `${s}, ${n}` : n
|
|
@@ -1353,15 +1335,15 @@ function Lr(e, t) {
|
|
|
1353
1335
|
statusText: e.statusText
|
|
1354
1336
|
});
|
|
1355
1337
|
}
|
|
1356
|
-
function
|
|
1357
|
-
return e.map(
|
|
1338
|
+
function jr(e) {
|
|
1339
|
+
return e.map(Wr).join(", ");
|
|
1358
1340
|
}
|
|
1359
|
-
function
|
|
1341
|
+
function E(e) {
|
|
1360
1342
|
if (e)
|
|
1361
1343
|
return Array.isArray(e) ? e : [e];
|
|
1362
1344
|
}
|
|
1363
|
-
function
|
|
1364
|
-
if (!
|
|
1345
|
+
function Wr(e) {
|
|
1346
|
+
if (!zr(e.name))
|
|
1365
1347
|
throw new Error(
|
|
1366
1348
|
`Server-Timing metric name "${e.name}" is not a valid token.`
|
|
1367
1349
|
);
|
|
@@ -1369,20 +1351,20 @@ function Mr(e) {
|
|
|
1369
1351
|
if (e.duration !== void 0) {
|
|
1370
1352
|
if (!Number.isFinite(e.duration) || e.duration < 0)
|
|
1371
1353
|
throw new Error("Server-Timing metric duration must be a non-negative finite number.");
|
|
1372
|
-
t.push(`dur=${
|
|
1354
|
+
t.push(`dur=${Br(e.duration)}`);
|
|
1373
1355
|
}
|
|
1374
|
-
return e.description !== void 0 && t.push(`desc="${
|
|
1356
|
+
return e.description !== void 0 && t.push(`desc="${qr(e.description)}"`), t.join(";");
|
|
1375
1357
|
}
|
|
1376
|
-
function
|
|
1358
|
+
function zr(e) {
|
|
1377
1359
|
return /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/.test(e);
|
|
1378
1360
|
}
|
|
1379
|
-
function
|
|
1361
|
+
function Br(e) {
|
|
1380
1362
|
return Number.isInteger(e), String(e);
|
|
1381
1363
|
}
|
|
1382
|
-
function
|
|
1364
|
+
function qr(e) {
|
|
1383
1365
|
return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
1384
1366
|
}
|
|
1385
|
-
const
|
|
1367
|
+
const Gr = [
|
|
1386
1368
|
400,
|
|
1387
1369
|
401,
|
|
1388
1370
|
402,
|
|
@@ -1423,7 +1405,7 @@ const Fr = [
|
|
|
1423
1405
|
508,
|
|
1424
1406
|
510,
|
|
1425
1407
|
511
|
|
1426
|
-
],
|
|
1408
|
+
], _r = {
|
|
1427
1409
|
400: "Bad Request",
|
|
1428
1410
|
401: "Unauthorized",
|
|
1429
1411
|
402: "Payment Required",
|
|
@@ -1464,8 +1446,8 @@ const Fr = [
|
|
|
1464
1446
|
508: "Loop Detected",
|
|
1465
1447
|
510: "Not Extended",
|
|
1466
1448
|
511: "Network Authentication Required"
|
|
1467
|
-
},
|
|
1468
|
-
class
|
|
1449
|
+
}, Vr = new Set(Gr);
|
|
1450
|
+
class lt extends Error {
|
|
1469
1451
|
detail;
|
|
1470
1452
|
extensions;
|
|
1471
1453
|
headers;
|
|
@@ -1473,59 +1455,59 @@ class at extends Error {
|
|
|
1473
1455
|
title;
|
|
1474
1456
|
type;
|
|
1475
1457
|
constructor(t, r = {}, n = {}) {
|
|
1476
|
-
|
|
1458
|
+
Jr(t);
|
|
1477
1459
|
const s = typeof r == "string" ? { detail: r } : r, {
|
|
1478
|
-
detail:
|
|
1479
|
-
title:
|
|
1460
|
+
detail: o,
|
|
1461
|
+
title: i = _r[t],
|
|
1480
1462
|
type: a = "about:blank",
|
|
1481
1463
|
...c
|
|
1482
1464
|
} = s;
|
|
1483
|
-
super(
|
|
1465
|
+
super(o ?? i, { cause: n.cause }), this.name = "HttpError", this.detail = o, this.extensions = Object.freeze({ ...c }), this.headers = new Headers(n.headers), this.status = t, this.title = i, this.type = a;
|
|
1484
1466
|
}
|
|
1485
1467
|
}
|
|
1486
|
-
function
|
|
1487
|
-
return new
|
|
1468
|
+
function Go(e, t, r) {
|
|
1469
|
+
return new lt(e, t, r);
|
|
1488
1470
|
}
|
|
1489
|
-
function
|
|
1490
|
-
return e instanceof
|
|
1471
|
+
function Ae(e) {
|
|
1472
|
+
return e instanceof lt;
|
|
1491
1473
|
}
|
|
1492
|
-
function
|
|
1493
|
-
if (!
|
|
1474
|
+
function Jr(e) {
|
|
1475
|
+
if (!Vr.has(e))
|
|
1494
1476
|
throw new RangeError(
|
|
1495
1477
|
`HTTP error status must be a standard 4xx or 5xx status; received ${JSON.stringify(e)}.`
|
|
1496
1478
|
);
|
|
1497
1479
|
}
|
|
1498
|
-
function
|
|
1499
|
-
return /* @__PURE__ */
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
/* @__PURE__ */
|
|
1480
|
+
function He({ pathname: e }) {
|
|
1481
|
+
return /* @__PURE__ */ H("main", { children: [
|
|
1482
|
+
/* @__PURE__ */ j("h1", { children: "404" }),
|
|
1483
|
+
/* @__PURE__ */ H("p", { children: [
|
|
1502
1484
|
"No route matched ",
|
|
1503
1485
|
e,
|
|
1504
1486
|
"."
|
|
1505
1487
|
] })
|
|
1506
1488
|
] });
|
|
1507
1489
|
}
|
|
1508
|
-
function
|
|
1509
|
-
return /* @__PURE__ */
|
|
1510
|
-
/* @__PURE__ */
|
|
1511
|
-
/* @__PURE__ */
|
|
1490
|
+
function je({ status: e }) {
|
|
1491
|
+
return /* @__PURE__ */ H("main", { children: [
|
|
1492
|
+
/* @__PURE__ */ j("h1", { children: e }),
|
|
1493
|
+
/* @__PURE__ */ j("p", { children: "Something went wrong." })
|
|
1512
1494
|
] });
|
|
1513
1495
|
}
|
|
1514
|
-
function
|
|
1515
|
-
const { message: n, name: s, stack:
|
|
1516
|
-
return /* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1496
|
+
function Kr({ error: e, pathname: t, status: r }) {
|
|
1497
|
+
const { message: n, name: s, stack: o } = ft(e);
|
|
1498
|
+
return /* @__PURE__ */ H("main", { children: [
|
|
1499
|
+
/* @__PURE__ */ H("h1", { children: [
|
|
1518
1500
|
r,
|
|
1519
1501
|
" ",
|
|
1520
1502
|
s,
|
|
1521
1503
|
" at ",
|
|
1522
1504
|
t
|
|
1523
1505
|
] }),
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
|
|
1506
|
+
/* @__PURE__ */ j("p", { children: n }),
|
|
1507
|
+
o ? /* @__PURE__ */ j("pre", { children: o }) : null
|
|
1526
1508
|
] });
|
|
1527
1509
|
}
|
|
1528
|
-
function
|
|
1510
|
+
function ft(e) {
|
|
1529
1511
|
return e instanceof Error ? {
|
|
1530
1512
|
message: e.message,
|
|
1531
1513
|
name: e.name,
|
|
@@ -1536,27 +1518,27 @@ function ct(e) {
|
|
|
1536
1518
|
stack: void 0
|
|
1537
1519
|
};
|
|
1538
1520
|
}
|
|
1539
|
-
const
|
|
1540
|
-
function
|
|
1541
|
-
return
|
|
1521
|
+
const Yr = ["text/html", "application/xhtml+xml"];
|
|
1522
|
+
function dt(e) {
|
|
1523
|
+
return Zr(e.headers.get("accept"));
|
|
1542
1524
|
}
|
|
1543
|
-
function
|
|
1544
|
-
return e ?
|
|
1545
|
-
(t) => t.quality > 0 &&
|
|
1525
|
+
function Zr(e) {
|
|
1526
|
+
return e ? Qr(e).some(
|
|
1527
|
+
(t) => t.quality > 0 && Yr.includes(t.type)
|
|
1546
1528
|
) : !1;
|
|
1547
1529
|
}
|
|
1548
|
-
function
|
|
1530
|
+
function Qr(e) {
|
|
1549
1531
|
return e.split(",").flatMap((t) => {
|
|
1550
1532
|
const [r, ...n] = t.split(";"), s = r.trim().toLowerCase();
|
|
1551
1533
|
return s ? [
|
|
1552
1534
|
{
|
|
1553
|
-
quality:
|
|
1535
|
+
quality: Xr(n),
|
|
1554
1536
|
type: s
|
|
1555
1537
|
}
|
|
1556
1538
|
] : [];
|
|
1557
1539
|
});
|
|
1558
1540
|
}
|
|
1559
|
-
function
|
|
1541
|
+
function Xr(e) {
|
|
1560
1542
|
for (const t of e) {
|
|
1561
1543
|
const [r, n] = t.split("=");
|
|
1562
1544
|
if (r?.trim().toLowerCase() !== "q")
|
|
@@ -1566,14 +1548,14 @@ function Jr(e) {
|
|
|
1566
1548
|
}
|
|
1567
1549
|
return 1;
|
|
1568
1550
|
}
|
|
1569
|
-
const
|
|
1570
|
-
function
|
|
1551
|
+
const en = "application/problem+json";
|
|
1552
|
+
function tn({
|
|
1571
1553
|
detail: e,
|
|
1572
1554
|
instance: t,
|
|
1573
1555
|
status: r,
|
|
1574
1556
|
title: n,
|
|
1575
1557
|
type: s = "about:blank",
|
|
1576
|
-
...
|
|
1558
|
+
...o
|
|
1577
1559
|
}) {
|
|
1578
1560
|
return {
|
|
1579
1561
|
type: s,
|
|
@@ -1581,29 +1563,29 @@ function Yr({
|
|
|
1581
1563
|
status: r,
|
|
1582
1564
|
...e === void 0 ? {} : { detail: e },
|
|
1583
1565
|
...t === void 0 ? {} : { instance: t },
|
|
1584
|
-
...
|
|
1566
|
+
...o
|
|
1585
1567
|
};
|
|
1586
1568
|
}
|
|
1587
|
-
function
|
|
1569
|
+
function Z(e, t) {
|
|
1588
1570
|
const r = new Headers(t?.headers);
|
|
1589
|
-
return r.set("content-type", `${
|
|
1571
|
+
return r.set("content-type", `${en}; charset=utf-8`), new Response(JSON.stringify(tn(e)), {
|
|
1590
1572
|
...t,
|
|
1591
1573
|
headers: r,
|
|
1592
1574
|
status: e.status
|
|
1593
1575
|
});
|
|
1594
1576
|
}
|
|
1595
|
-
const
|
|
1596
|
-
function
|
|
1577
|
+
const rn = "Internal Server Error";
|
|
1578
|
+
function ht(e) {
|
|
1597
1579
|
return e === !0 && process.env.NODE_ENV !== "production";
|
|
1598
1580
|
}
|
|
1599
|
-
async function
|
|
1581
|
+
async function Y(e, t, r, n, s = {}) {
|
|
1600
1582
|
s.onError?.(r, n);
|
|
1601
|
-
const
|
|
1602
|
-
return n === "page" || n === "middleware" &&
|
|
1583
|
+
const o = new URL(t.url);
|
|
1584
|
+
return n === "page" || n === "middleware" && dt(t) ? await sn(e, o, r, s) : nn(o, r, s);
|
|
1603
1585
|
}
|
|
1604
|
-
function
|
|
1605
|
-
if (
|
|
1606
|
-
return
|
|
1586
|
+
function nn(e, t, r = {}) {
|
|
1587
|
+
if (Ae(t))
|
|
1588
|
+
return Z(
|
|
1607
1589
|
{
|
|
1608
1590
|
...t.extensions,
|
|
1609
1591
|
detail: t.detail,
|
|
@@ -1614,72 +1596,72 @@ function Qr(e, t, r = {}) {
|
|
|
1614
1596
|
},
|
|
1615
1597
|
{ headers: t.headers }
|
|
1616
1598
|
);
|
|
1617
|
-
const { message: n } =
|
|
1618
|
-
return
|
|
1599
|
+
const { message: n } = ft(t);
|
|
1600
|
+
return Z({
|
|
1619
1601
|
// `detail` carries the thrown message, so it is dev only for the same
|
|
1620
1602
|
// reason the stack is.
|
|
1621
|
-
...
|
|
1603
|
+
...ht(r.dev) ? { detail: n } : {},
|
|
1622
1604
|
instance: `${e.pathname}${e.search}`,
|
|
1623
1605
|
status: 500,
|
|
1624
1606
|
title: "Internal Server Error"
|
|
1625
1607
|
});
|
|
1626
1608
|
}
|
|
1627
|
-
async function
|
|
1628
|
-
const s =
|
|
1609
|
+
async function sn(e, t, r, n) {
|
|
1610
|
+
const s = mt(r);
|
|
1629
1611
|
try {
|
|
1630
|
-
const
|
|
1612
|
+
const o = await an(
|
|
1631
1613
|
e,
|
|
1632
1614
|
t.pathname,
|
|
1633
1615
|
r,
|
|
1634
1616
|
n
|
|
1635
|
-
),
|
|
1636
|
-
return
|
|
1637
|
-
headers:
|
|
1617
|
+
), i = Ae(r) ? new Headers(r.headers) : new Headers();
|
|
1618
|
+
return i.set("content-type", "text/html; charset=utf-8"), new Response(await n.transformDocument?.(o) ?? o, {
|
|
1619
|
+
headers: i,
|
|
1638
1620
|
status: s
|
|
1639
1621
|
});
|
|
1640
|
-
} catch (
|
|
1641
|
-
return n.onError?.(
|
|
1622
|
+
} catch (o) {
|
|
1623
|
+
return n.onError?.(o, "page"), on();
|
|
1642
1624
|
}
|
|
1643
1625
|
}
|
|
1644
|
-
function
|
|
1645
|
-
return new Response(
|
|
1626
|
+
function on() {
|
|
1627
|
+
return new Response(rn, {
|
|
1646
1628
|
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
1647
1629
|
status: 500
|
|
1648
1630
|
});
|
|
1649
1631
|
}
|
|
1650
|
-
async function
|
|
1651
|
-
const s = await
|
|
1632
|
+
async function an(e, t, r, n) {
|
|
1633
|
+
const s = await cn(e, t, n), o = Qe({
|
|
1652
1634
|
dev: n.dev,
|
|
1653
1635
|
nonce: n.nonce
|
|
1654
|
-
}),
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1636
|
+
}), i = tt(
|
|
1637
|
+
Xe(
|
|
1638
|
+
o,
|
|
1639
|
+
de(s, { error: r, pathname: t, status: mt(r) })
|
|
1658
1640
|
)
|
|
1659
1641
|
);
|
|
1660
|
-
return
|
|
1661
|
-
body: { data: void 0, html:
|
|
1642
|
+
return et({
|
|
1643
|
+
body: { data: void 0, html: i, navigation: n.navigation },
|
|
1662
1644
|
entrySrc: n.clientEntry,
|
|
1663
1645
|
lang: n.lang,
|
|
1664
1646
|
nonce: n.nonce,
|
|
1665
|
-
scripts:
|
|
1647
|
+
scripts: o.scripts(),
|
|
1666
1648
|
styles: n.styles,
|
|
1667
1649
|
title: n.title
|
|
1668
1650
|
});
|
|
1669
1651
|
}
|
|
1670
|
-
function
|
|
1671
|
-
return
|
|
1652
|
+
function mt(e) {
|
|
1653
|
+
return Ae(e) ? e.status : 500;
|
|
1672
1654
|
}
|
|
1673
|
-
async function
|
|
1674
|
-
if (
|
|
1675
|
-
return
|
|
1655
|
+
async function cn(e, t, r) {
|
|
1656
|
+
if (ht(r.dev))
|
|
1657
|
+
return Kr;
|
|
1676
1658
|
try {
|
|
1677
|
-
return await
|
|
1659
|
+
return await cr(e, t) ?? je;
|
|
1678
1660
|
} catch {
|
|
1679
|
-
return
|
|
1661
|
+
return je;
|
|
1680
1662
|
}
|
|
1681
1663
|
}
|
|
1682
|
-
const
|
|
1664
|
+
const Q = "{nonce}", We = `'nonce-${Q}'`, pt = {
|
|
1683
1665
|
baseUri: ["'self'"],
|
|
1684
1666
|
connectSrc: ["'self'"],
|
|
1685
1667
|
defaultSrc: ["'self'"],
|
|
@@ -1688,14 +1670,14 @@ const J = "{nonce}", He = `'nonce-${J}'`, dt = {
|
|
|
1688
1670
|
frameAncestors: ["'none'"],
|
|
1689
1671
|
imgSrc: ["'self'", "data:", "blob:"],
|
|
1690
1672
|
objectSrc: ["'none'"],
|
|
1691
|
-
scriptSrc: [
|
|
1692
|
-
styleSrc: ["'self'",
|
|
1673
|
+
scriptSrc: [We, "'strict-dynamic'"],
|
|
1674
|
+
styleSrc: ["'self'", We],
|
|
1693
1675
|
upgradeInsecureRequests: !0
|
|
1694
|
-
},
|
|
1695
|
-
...
|
|
1676
|
+
}, un = {
|
|
1677
|
+
...pt,
|
|
1696
1678
|
scriptSrc: ["'self'"],
|
|
1697
1679
|
styleSrc: ["'self'"]
|
|
1698
|
-
},
|
|
1680
|
+
}, ze = {
|
|
1699
1681
|
contentTypeOptions: "nosniff",
|
|
1700
1682
|
crossOriginOpenerPolicy: "same-origin",
|
|
1701
1683
|
crossOriginResourcePolicy: "same-origin",
|
|
@@ -1706,43 +1688,43 @@ const J = "{nonce}", He = `'nonce-${J}'`, dt = {
|
|
|
1706
1688
|
maxAge: 31536e3,
|
|
1707
1689
|
preload: !1
|
|
1708
1690
|
}
|
|
1709
|
-
},
|
|
1691
|
+
}, ln = {
|
|
1710
1692
|
contentTypeOptions: "nosniff",
|
|
1711
1693
|
crossOriginResourcePolicy: "same-origin",
|
|
1712
1694
|
referrerPolicy: "strict-origin-when-cross-origin"
|
|
1713
|
-
},
|
|
1695
|
+
}, L = {
|
|
1714
1696
|
api(e = {}) {
|
|
1715
|
-
return
|
|
1697
|
+
return I(
|
|
1716
1698
|
{
|
|
1717
|
-
headers:
|
|
1699
|
+
headers: ln
|
|
1718
1700
|
},
|
|
1719
1701
|
e
|
|
1720
1702
|
);
|
|
1721
1703
|
},
|
|
1722
1704
|
preset(e, t = {}) {
|
|
1723
|
-
return e === "api" ?
|
|
1705
|
+
return e === "api" ? L.api(t) : e === "cross-origin-isolated" ? L.crossOriginIsolated(t) : e === "static" ? L.static(t) : L.strict(t);
|
|
1724
1706
|
},
|
|
1725
1707
|
static(e = {}) {
|
|
1726
|
-
return
|
|
1708
|
+
return I(
|
|
1727
1709
|
{
|
|
1728
|
-
csp:
|
|
1729
|
-
headers:
|
|
1710
|
+
csp: un,
|
|
1711
|
+
headers: ze
|
|
1730
1712
|
},
|
|
1731
1713
|
e
|
|
1732
1714
|
);
|
|
1733
1715
|
},
|
|
1734
1716
|
strict(e = {}) {
|
|
1735
|
-
return
|
|
1717
|
+
return I(
|
|
1736
1718
|
{
|
|
1737
|
-
csp:
|
|
1738
|
-
headers:
|
|
1719
|
+
csp: pt,
|
|
1720
|
+
headers: ze
|
|
1739
1721
|
},
|
|
1740
1722
|
e
|
|
1741
1723
|
);
|
|
1742
1724
|
},
|
|
1743
1725
|
crossOriginIsolated(e = {}) {
|
|
1744
|
-
return
|
|
1745
|
-
|
|
1726
|
+
return I(
|
|
1727
|
+
L.strict({
|
|
1746
1728
|
headers: {
|
|
1747
1729
|
crossOriginEmbedderPolicy: "require-corp",
|
|
1748
1730
|
crossOriginOpenerPolicy: "same-origin"
|
|
@@ -1752,141 +1734,158 @@ const J = "{nonce}", He = `'nonce-${J}'`, dt = {
|
|
|
1752
1734
|
);
|
|
1753
1735
|
}
|
|
1754
1736
|
};
|
|
1755
|
-
function
|
|
1737
|
+
function _o(e) {
|
|
1756
1738
|
return e;
|
|
1757
1739
|
}
|
|
1758
|
-
function
|
|
1740
|
+
function Vo(e) {
|
|
1759
1741
|
return e;
|
|
1760
1742
|
}
|
|
1761
|
-
function
|
|
1762
|
-
return e.reduce((t, r) => r ?
|
|
1743
|
+
function fn(...e) {
|
|
1744
|
+
return e.reduce((t, r) => r ? I(t, r) : t, {});
|
|
1763
1745
|
}
|
|
1764
|
-
function
|
|
1746
|
+
function X(...e) {
|
|
1765
1747
|
const t = e.reduce((r, n) => n ? {
|
|
1766
|
-
document:
|
|
1767
|
-
security:
|
|
1748
|
+
document: fn(r.document, n.document),
|
|
1749
|
+
security: dn(r.security, n.security)
|
|
1768
1750
|
} : r, {});
|
|
1769
1751
|
return {
|
|
1770
1752
|
...t,
|
|
1771
|
-
document:
|
|
1753
|
+
document: mn(t.document, t.security?.needs)
|
|
1772
1754
|
};
|
|
1773
1755
|
}
|
|
1774
|
-
function
|
|
1756
|
+
function dn(...e) {
|
|
1775
1757
|
return e.reduce((t, r) => r ? {
|
|
1776
1758
|
csrf: r.csrf ?? t.csrf,
|
|
1777
|
-
|
|
1759
|
+
fetchMetadata: r.fetchMetadata ?? t.fetchMetadata,
|
|
1760
|
+
needs: hn(t.needs, r.needs),
|
|
1778
1761
|
rateLimit: r.rateLimit ?? t.rateLimit,
|
|
1779
|
-
request:
|
|
1762
|
+
request: wt(t.request, r.request)
|
|
1780
1763
|
} : t, {});
|
|
1781
1764
|
}
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1765
|
+
const gt = [
|
|
1766
|
+
{ directive: "connectSrc", need: "connect" },
|
|
1767
|
+
{ directive: "imgSrc", need: "img" },
|
|
1768
|
+
{ directive: "scriptSrc", need: "script" }
|
|
1769
|
+
];
|
|
1770
|
+
function hn(e, t) {
|
|
1771
|
+
const r = {};
|
|
1772
|
+
for (const { need: n } of gt) {
|
|
1773
|
+
const s = [.../* @__PURE__ */ new Set([
|
|
1774
|
+
...e?.[n] ?? [],
|
|
1775
|
+
...t?.[n] ?? []
|
|
1776
|
+
])];
|
|
1777
|
+
s.length > 0 && (r[n] = s);
|
|
1778
|
+
}
|
|
1779
|
+
return Object.keys(r).length > 0 ? r : void 0;
|
|
1780
|
+
}
|
|
1781
|
+
function mn(e, t) {
|
|
1782
|
+
if (!e?.csp || !t)
|
|
1783
|
+
return e;
|
|
1784
|
+
let r = e.csp;
|
|
1785
|
+
for (const { directive: n, need: s } of gt)
|
|
1786
|
+
r = pn(r, n, s, t[s]);
|
|
1787
|
+
return r === e.csp ? e : { ...e, csp: r };
|
|
1788
1788
|
}
|
|
1789
|
-
function
|
|
1790
|
-
if (!
|
|
1789
|
+
function pn(e, t, r, n) {
|
|
1790
|
+
if (!n || n.length === 0)
|
|
1791
1791
|
return e;
|
|
1792
|
-
if (e
|
|
1792
|
+
if (e[t] === !1)
|
|
1793
1793
|
throw new Error(
|
|
1794
|
-
`A route policy declares security.needs
|
|
1794
|
+
`A route policy declares security.needs.${r} and sets csp.${t} to false. Set an explicit csp.${t} that includes ${n.join(", ")}.`
|
|
1795
1795
|
);
|
|
1796
|
-
if (e
|
|
1796
|
+
if (e[t] === void 0 && e.defaultSrc === void 0)
|
|
1797
1797
|
return e;
|
|
1798
|
-
const
|
|
1799
|
-
|
|
1798
|
+
const s = x(
|
|
1799
|
+
e[t] ?? e.defaultSrc
|
|
1800
|
+
) ?? [];
|
|
1801
|
+
return Array.isArray(s) ? {
|
|
1800
1802
|
...e,
|
|
1801
|
-
|
|
1802
|
-
...e.csp,
|
|
1803
|
-
scriptSrc: [.../* @__PURE__ */ new Set([...n, ...t])]
|
|
1804
|
-
}
|
|
1803
|
+
[t]: [.../* @__PURE__ */ new Set([...s, ...n])]
|
|
1805
1804
|
} : e;
|
|
1806
1805
|
}
|
|
1807
|
-
async function
|
|
1806
|
+
async function Jo(e, t = "sha256") {
|
|
1808
1807
|
const r = await globalThis.crypto.subtle.digest(
|
|
1809
|
-
|
|
1808
|
+
$n(t),
|
|
1810
1809
|
new TextEncoder().encode(e)
|
|
1811
1810
|
);
|
|
1812
|
-
return `'${t}-${
|
|
1811
|
+
return `'${t}-${kn(new Uint8Array(r))}'`;
|
|
1813
1812
|
}
|
|
1814
|
-
function
|
|
1815
|
-
e.csp &&
|
|
1816
|
-
const r = new Headers(), n = e.csp !== !1 && e.csp ?
|
|
1817
|
-
return
|
|
1813
|
+
function q(e, t = {}) {
|
|
1814
|
+
e.csp && Pn(e.csp), An(e);
|
|
1815
|
+
const r = new Headers(), n = e.csp !== !1 && e.csp ? bn(e.csp, t) : void 0, s = En(e.trustedTypes), o = e.trustedTypes ? e.trustedTypes.mode === "report-only" : !1;
|
|
1816
|
+
return S(
|
|
1818
1817
|
r,
|
|
1819
1818
|
"content-security-policy",
|
|
1820
|
-
|
|
1821
|
-
),
|
|
1819
|
+
ee(n, o ? void 0 : s)
|
|
1820
|
+
), S(
|
|
1822
1821
|
r,
|
|
1823
1822
|
"content-security-policy-report-only",
|
|
1824
|
-
|
|
1825
|
-
),
|
|
1823
|
+
o ? ee(s, Et(e.csp)) : void 0
|
|
1824
|
+
), Sn(r, e.headers, t), r;
|
|
1826
1825
|
}
|
|
1827
|
-
function
|
|
1828
|
-
return !e || !e.csp ? !1 :
|
|
1826
|
+
function ne(e) {
|
|
1827
|
+
return !e || !e.csp ? !1 : G(e.csp).some(([, t]) => {
|
|
1829
1828
|
const r = x(t);
|
|
1830
|
-
return Array.isArray(r) && r.some((n) => n.includes(
|
|
1829
|
+
return Array.isArray(r) && r.some((n) => n.includes(Q));
|
|
1831
1830
|
});
|
|
1832
1831
|
}
|
|
1833
|
-
function
|
|
1832
|
+
function yt() {
|
|
1834
1833
|
const e = new Uint8Array(16);
|
|
1835
1834
|
return globalThis.crypto.getRandomValues(e), btoa(String.fromCharCode(...e));
|
|
1836
1835
|
}
|
|
1837
|
-
function
|
|
1836
|
+
function I(e, t) {
|
|
1838
1837
|
return {
|
|
1839
|
-
csp:
|
|
1840
|
-
headers:
|
|
1838
|
+
csp: yn(e.csp, t.csp),
|
|
1839
|
+
headers: gn(e.headers, t.headers),
|
|
1841
1840
|
trustedTypes: t.trustedTypes ?? e.trustedTypes
|
|
1842
1841
|
};
|
|
1843
1842
|
}
|
|
1844
|
-
function
|
|
1845
|
-
const r =
|
|
1843
|
+
function gn(e, t) {
|
|
1844
|
+
const r = wt(e, t);
|
|
1846
1845
|
return !r || t?.reportingEndpoints === !1 || e?.reportingEndpoints && t?.reportingEndpoints && (r.reportingEndpoints = {
|
|
1847
1846
|
...e.reportingEndpoints,
|
|
1848
1847
|
...t.reportingEndpoints
|
|
1849
1848
|
}), r;
|
|
1850
1849
|
}
|
|
1851
|
-
function
|
|
1850
|
+
function wt(e, t) {
|
|
1852
1851
|
return t ? {
|
|
1853
1852
|
...e ?? {},
|
|
1854
1853
|
...t
|
|
1855
1854
|
} : e;
|
|
1856
1855
|
}
|
|
1857
|
-
function
|
|
1856
|
+
function yn(e, t) {
|
|
1858
1857
|
if (t === !1)
|
|
1859
1858
|
return !1;
|
|
1860
1859
|
if (!t)
|
|
1861
1860
|
return e;
|
|
1862
1861
|
if (!e)
|
|
1863
|
-
return
|
|
1864
|
-
const r =
|
|
1862
|
+
return ue(t);
|
|
1863
|
+
const r = ue(e), n = ue(t), s = {
|
|
1865
1864
|
...r,
|
|
1866
1865
|
...n
|
|
1867
1866
|
};
|
|
1868
|
-
for (const [
|
|
1867
|
+
for (const [o, i] of G(t)) {
|
|
1869
1868
|
const a = x(
|
|
1870
|
-
r[
|
|
1869
|
+
r[o]
|
|
1871
1870
|
);
|
|
1872
|
-
!
|
|
1871
|
+
!Pe(i) && Array.isArray(a) && Array.isArray(i) && St(
|
|
1873
1872
|
s,
|
|
1874
|
-
|
|
1875
|
-
|
|
1873
|
+
o,
|
|
1874
|
+
wn([...a, ...i])
|
|
1876
1875
|
);
|
|
1877
1876
|
}
|
|
1878
1877
|
return s;
|
|
1879
1878
|
}
|
|
1880
|
-
function
|
|
1879
|
+
function ue(e) {
|
|
1881
1880
|
const t = { ...e };
|
|
1882
|
-
for (const [r, n] of
|
|
1883
|
-
|
|
1881
|
+
for (const [r, n] of G(e))
|
|
1882
|
+
Pe(n) && St(t, r, n.replace);
|
|
1884
1883
|
return t;
|
|
1885
1884
|
}
|
|
1886
|
-
function
|
|
1885
|
+
function wn(e) {
|
|
1887
1886
|
return [...new Set(e)];
|
|
1888
1887
|
}
|
|
1889
|
-
function
|
|
1888
|
+
function St(e, t, r) {
|
|
1890
1889
|
if (!(t === "reportTo" || t === "upgradeInsecureRequests")) {
|
|
1891
1890
|
if (t === "reportUri") {
|
|
1892
1891
|
e.reportUri = r;
|
|
@@ -1895,87 +1894,96 @@ function pt(e, t, r) {
|
|
|
1895
1894
|
e[t] = r;
|
|
1896
1895
|
}
|
|
1897
1896
|
}
|
|
1898
|
-
function
|
|
1899
|
-
t && (
|
|
1897
|
+
function Sn(e, t, r) {
|
|
1898
|
+
t && (S(e, "referrer-policy", t.referrerPolicy), S(e, "x-content-type-options", t.contentTypeOptions), S(e, "cross-origin-opener-policy", t.crossOriginOpenerPolicy), S(e, "cross-origin-embedder-policy", t.crossOriginEmbedderPolicy), S(e, "cross-origin-resource-policy", t.crossOriginResourcePolicy), S(e, "permissions-policy", t.permissionsPolicy), S(
|
|
1900
1899
|
e,
|
|
1901
1900
|
"reporting-endpoints",
|
|
1902
|
-
|
|
1901
|
+
Tn(t.reportingEndpoints)
|
|
1903
1902
|
), t.strictTransportSecurity && (!r.request || new URL(r.request.url).protocol === "https:") && e.set(
|
|
1904
1903
|
"strict-transport-security",
|
|
1905
|
-
|
|
1904
|
+
Rn(t.strictTransportSecurity)
|
|
1906
1905
|
));
|
|
1907
1906
|
}
|
|
1908
|
-
function
|
|
1907
|
+
function En(e) {
|
|
1909
1908
|
if (!e)
|
|
1910
1909
|
return;
|
|
1911
1910
|
const t = [];
|
|
1912
|
-
return e.requireFor?.includes("script") && t.push("require-trusted-types-for 'script'"),
|
|
1913
|
-
}
|
|
1914
|
-
function
|
|
1911
|
+
return e.requireFor?.includes("script") && t.push("require-trusted-types-for 'script'"), t.push(vn(e)), ee(...t);
|
|
1912
|
+
}
|
|
1913
|
+
function vn(e) {
|
|
1914
|
+
if (e.policies !== void 0 && e.policies.length === 0)
|
|
1915
|
+
return "trusted-types 'none'";
|
|
1916
|
+
const t = [Ft];
|
|
1917
|
+
e.allowDefaultPolicy && t.push("default");
|
|
1918
|
+
for (const r of e.policies ?? [])
|
|
1919
|
+
t.push(r);
|
|
1920
|
+
return `trusted-types ${[...new Set(t)].join(" ")}`;
|
|
1921
|
+
}
|
|
1922
|
+
function ee(...e) {
|
|
1915
1923
|
const t = e.filter((r) => r);
|
|
1916
1924
|
return t.length > 0 ? t.join("; ") : void 0;
|
|
1917
1925
|
}
|
|
1918
|
-
function
|
|
1926
|
+
function S(e, t, r) {
|
|
1919
1927
|
r && e.set(t, r);
|
|
1920
1928
|
}
|
|
1921
|
-
function
|
|
1929
|
+
function Rn(e) {
|
|
1922
1930
|
const t = [`max-age=${e.maxAge}`];
|
|
1923
1931
|
return e.includeSubDomains && t.push("includeSubDomains"), e.preload && t.push("preload"), t.join("; ");
|
|
1924
1932
|
}
|
|
1925
|
-
function
|
|
1933
|
+
function bn(e, t) {
|
|
1926
1934
|
const r = [];
|
|
1927
|
-
for (const [s,
|
|
1935
|
+
for (const [s, o] of G(e)) {
|
|
1928
1936
|
if (s === "reportTo" || s === "reportUri")
|
|
1929
1937
|
continue;
|
|
1930
|
-
const
|
|
1931
|
-
if (
|
|
1938
|
+
const i = x(o);
|
|
1939
|
+
if (i === !1 || i === void 0)
|
|
1932
1940
|
continue;
|
|
1933
|
-
const a =
|
|
1934
|
-
if (
|
|
1941
|
+
const a = vt(s);
|
|
1942
|
+
if (i === !0 || s === "sandbox" && Array.isArray(i) && i.length === 0) {
|
|
1935
1943
|
r.push(a);
|
|
1936
1944
|
continue;
|
|
1937
1945
|
}
|
|
1938
1946
|
r.push(
|
|
1939
|
-
`${a} ${
|
|
1947
|
+
`${a} ${Dn(i, t).join(" ")}`
|
|
1940
1948
|
);
|
|
1941
1949
|
}
|
|
1942
|
-
const n =
|
|
1950
|
+
const n = Et(e);
|
|
1943
1951
|
return n && r.push(n), r.join("; ");
|
|
1944
1952
|
}
|
|
1945
|
-
function
|
|
1953
|
+
function Et(e) {
|
|
1946
1954
|
if (!e)
|
|
1947
1955
|
return;
|
|
1948
1956
|
const t = [], r = x(e.reportUri);
|
|
1949
|
-
return Array.isArray(r) && r.length && t.push(`report-uri ${r.join(" ")}`), e.reportTo && t.push(`report-to ${e.reportTo}`),
|
|
1957
|
+
return Array.isArray(r) && r.length && t.push(`report-uri ${r.join(" ")}`), e.reportTo && t.push(`report-to ${e.reportTo}`), ee(...t);
|
|
1950
1958
|
}
|
|
1951
|
-
function
|
|
1959
|
+
function Tn(e) {
|
|
1952
1960
|
if (e)
|
|
1953
|
-
return Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => `${t}="${
|
|
1961
|
+
return Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => `${t}="${xn(r)}"`).join(", ");
|
|
1954
1962
|
}
|
|
1955
|
-
function
|
|
1963
|
+
function xn(e) {
|
|
1956
1964
|
return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
1957
1965
|
}
|
|
1958
|
-
function
|
|
1966
|
+
function An(e) {
|
|
1959
1967
|
const t = e.headers?.reportingEndpoints;
|
|
1960
1968
|
if (t) {
|
|
1961
1969
|
const s = Object.entries(t);
|
|
1962
1970
|
if (s.length === 0)
|
|
1963
1971
|
throw new Error("Demiurge Reporting-Endpoints requires at least one endpoint.");
|
|
1964
|
-
for (const [
|
|
1965
|
-
|
|
1972
|
+
for (const [o, i] of s)
|
|
1973
|
+
Be(o), qe(i, `Reporting-Endpoints member ${JSON.stringify(o)}`);
|
|
1966
1974
|
}
|
|
1967
1975
|
const r = e.csp || void 0;
|
|
1968
|
-
if (r?.reportTo && (
|
|
1976
|
+
if (r?.reportTo && (Be(r.reportTo), !t || !(r.reportTo in t)))
|
|
1969
1977
|
throw new Error(
|
|
1970
1978
|
`Demiurge CSP report-to group ${JSON.stringify(r.reportTo)} is not defined in headers.reportingEndpoints.`
|
|
1971
1979
|
);
|
|
1972
1980
|
const n = x(r?.reportUri);
|
|
1973
1981
|
for (const s of Array.isArray(n) ? n : [])
|
|
1974
|
-
|
|
1982
|
+
qe(s, "CSP report-uri target");
|
|
1975
1983
|
}
|
|
1976
|
-
function
|
|
1977
|
-
for (const [t, r] of
|
|
1978
|
-
const n =
|
|
1984
|
+
function Pn(e) {
|
|
1985
|
+
for (const [t, r] of G(e)) {
|
|
1986
|
+
const n = vt(t);
|
|
1979
1987
|
if (r === void 0)
|
|
1980
1988
|
continue;
|
|
1981
1989
|
if (t === "reportTo") {
|
|
@@ -1992,27 +2000,34 @@ function En(e) {
|
|
|
1992
2000
|
);
|
|
1993
2001
|
continue;
|
|
1994
2002
|
}
|
|
2003
|
+
if (t === "sandbox") {
|
|
2004
|
+
if (typeof r != "boolean" && (!Array.isArray(r) || !r.every((o) => typeof o == "string")))
|
|
2005
|
+
throw new Error(
|
|
2006
|
+
`Demiurge CSP directive ${JSON.stringify(n)} must be a boolean or a list of sandbox tokens.`
|
|
2007
|
+
);
|
|
2008
|
+
continue;
|
|
2009
|
+
}
|
|
1995
2010
|
const s = x(r);
|
|
1996
|
-
if (s !== !1 && (!Array.isArray(s) || !s.every((
|
|
2011
|
+
if (s !== !1 && (!Array.isArray(s) || !s.every((o) => typeof o == "string")))
|
|
1997
2012
|
throw new Error(
|
|
1998
2013
|
`Demiurge CSP directive ${JSON.stringify(n)} must be a source list, false, or a replacement object with a source list.`
|
|
1999
2014
|
);
|
|
2000
2015
|
}
|
|
2001
2016
|
}
|
|
2002
|
-
function
|
|
2017
|
+
function Pe(e) {
|
|
2003
2018
|
return !!(e && typeof e == "object" && !Array.isArray(e) && "replace" in e);
|
|
2004
2019
|
}
|
|
2005
2020
|
function x(e) {
|
|
2006
|
-
return
|
|
2021
|
+
return Pe(e) ? e.replace : e;
|
|
2007
2022
|
}
|
|
2008
|
-
function
|
|
2023
|
+
function Be(e) {
|
|
2009
2024
|
if (!/^(?:[a-z]|\*)[a-z0-9_.*-]*$/.test(e))
|
|
2010
2025
|
throw new Error(
|
|
2011
2026
|
`Invalid reporting endpoint name ${JSON.stringify(e)}. Use a lowercase Structured Field key.`
|
|
2012
2027
|
);
|
|
2013
2028
|
}
|
|
2014
|
-
function
|
|
2015
|
-
if (!
|
|
2029
|
+
function qe(e, t) {
|
|
2030
|
+
if (!Cn(e) || /[\s,;"\\]/.test(e) || !e.startsWith("/") && !e.startsWith("https://"))
|
|
2016
2031
|
throw new Error(`${t} must be a same-origin path or an HTTPS URL.`);
|
|
2017
2032
|
if (e.startsWith("//"))
|
|
2018
2033
|
throw new Error(`${t} must not be a scheme-relative URL.`);
|
|
@@ -2025,81 +2040,81 @@ function We(e, t) {
|
|
|
2025
2040
|
if (r.username || r.password || r.hash)
|
|
2026
2041
|
throw new Error(`${t} must not contain credentials or a fragment.`);
|
|
2027
2042
|
}
|
|
2028
|
-
function
|
|
2043
|
+
function Cn(e) {
|
|
2029
2044
|
return /^[\x20-\x7e]+$/.test(e);
|
|
2030
2045
|
}
|
|
2031
|
-
function
|
|
2046
|
+
function G(e) {
|
|
2032
2047
|
return Object.entries(e);
|
|
2033
2048
|
}
|
|
2034
|
-
function
|
|
2049
|
+
function Dn(e, t) {
|
|
2035
2050
|
return e.map((r) => {
|
|
2036
|
-
if (!r.includes(
|
|
2051
|
+
if (!r.includes(Q))
|
|
2037
2052
|
return r;
|
|
2038
2053
|
if (!t.nonce)
|
|
2039
2054
|
throw new Error("Demiurge security policy requires a CSP nonce.");
|
|
2040
|
-
return r.replaceAll(
|
|
2055
|
+
return r.replaceAll(Q, t.nonce);
|
|
2041
2056
|
});
|
|
2042
2057
|
}
|
|
2043
|
-
function
|
|
2058
|
+
function vt(e) {
|
|
2044
2059
|
return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
2045
2060
|
}
|
|
2046
|
-
function
|
|
2061
|
+
function $n(e) {
|
|
2047
2062
|
return e === "sha384" ? "SHA-384" : e === "sha512" ? "SHA-512" : "SHA-256";
|
|
2048
2063
|
}
|
|
2049
|
-
function
|
|
2064
|
+
function kn(e) {
|
|
2050
2065
|
let t = "";
|
|
2051
2066
|
for (const r of e)
|
|
2052
2067
|
t += String.fromCharCode(r);
|
|
2053
2068
|
return typeof btoa == "function" ? btoa(t) : Buffer.from(t, "binary").toString("base64");
|
|
2054
2069
|
}
|
|
2055
|
-
function
|
|
2056
|
-
|
|
2070
|
+
function Rt(e, t, r = {}) {
|
|
2071
|
+
Ce(e);
|
|
2057
2072
|
const n = t.request.headers.get("origin"), s = new Headers();
|
|
2058
|
-
if (e.origins !== "*" &&
|
|
2073
|
+
if (e.origins !== "*" && bt(s, "Origin"), !n)
|
|
2059
2074
|
return s;
|
|
2060
|
-
const
|
|
2061
|
-
if (!
|
|
2075
|
+
const o = Ln(e, n);
|
|
2076
|
+
if (!o)
|
|
2062
2077
|
return s;
|
|
2063
|
-
if (s.set("access-control-allow-origin",
|
|
2078
|
+
if (s.set("access-control-allow-origin", o), e.credentials && s.set("access-control-allow-credentials", "true"), e.exposeHeaders?.length && s.set("access-control-expose-headers", e.exposeHeaders.join(", ")), r.preflight) {
|
|
2064
2079
|
s.set("access-control-allow-methods", r.methods.join(", "));
|
|
2065
|
-
const
|
|
2080
|
+
const i = t.request.headers.get(
|
|
2066
2081
|
"access-control-request-headers"
|
|
2067
|
-
), a = e.headers?.join(", ") ??
|
|
2082
|
+
), a = e.headers?.join(", ") ?? i;
|
|
2068
2083
|
a && s.set("access-control-allow-headers", a), e.maxAge !== void 0 && s.set("access-control-max-age", String(e.maxAge));
|
|
2069
2084
|
}
|
|
2070
2085
|
return s;
|
|
2071
2086
|
}
|
|
2072
|
-
function
|
|
2087
|
+
function U(e, t, r) {
|
|
2073
2088
|
if (!t)
|
|
2074
2089
|
return e;
|
|
2075
2090
|
const n = new Headers(e.headers);
|
|
2076
|
-
return
|
|
2091
|
+
return Mn(n, Rt(t, { request: r })), new Response(e.body, {
|
|
2077
2092
|
headers: n,
|
|
2078
2093
|
status: e.status,
|
|
2079
2094
|
statusText: e.statusText
|
|
2080
2095
|
});
|
|
2081
2096
|
}
|
|
2082
|
-
function
|
|
2083
|
-
const r = t.headers.get("access-control-request-method"), n =
|
|
2097
|
+
function Nn(e, t) {
|
|
2098
|
+
const r = t.headers.get("access-control-request-method"), n = In(r);
|
|
2084
2099
|
if (!n)
|
|
2085
2100
|
return null;
|
|
2086
|
-
const s =
|
|
2101
|
+
const s = Tt(e, n);
|
|
2087
2102
|
if (!s?.cors)
|
|
2088
2103
|
return null;
|
|
2089
|
-
const
|
|
2090
|
-
return
|
|
2091
|
-
headers:
|
|
2104
|
+
const o = s.cors.methods ?? Un(e);
|
|
2105
|
+
return o.includes(n) ? new Response(null, {
|
|
2106
|
+
headers: Rt(
|
|
2092
2107
|
s.cors,
|
|
2093
2108
|
{ request: t },
|
|
2094
2109
|
{
|
|
2095
|
-
methods:
|
|
2110
|
+
methods: o,
|
|
2096
2111
|
preflight: !0
|
|
2097
2112
|
}
|
|
2098
2113
|
),
|
|
2099
2114
|
status: 204
|
|
2100
2115
|
}) : null;
|
|
2101
2116
|
}
|
|
2102
|
-
function
|
|
2117
|
+
function Ce(e) {
|
|
2103
2118
|
if (e.credentials && e.origins === "*")
|
|
2104
2119
|
throw new Error(
|
|
2105
2120
|
"Demiurge CORS policy cannot use wildcard origins with credentials."
|
|
@@ -2110,59 +2125,59 @@ function Te(e) {
|
|
|
2110
2125
|
);
|
|
2111
2126
|
if (e.origins !== "*")
|
|
2112
2127
|
for (const t of e.origins)
|
|
2113
|
-
|
|
2128
|
+
On(t);
|
|
2114
2129
|
if (e.maxAge !== void 0 && (!Number.isSafeInteger(e.maxAge) || e.maxAge < 0))
|
|
2115
2130
|
throw new Error(
|
|
2116
2131
|
"Demiurge CORS maxAge must be a non-negative integer number of seconds."
|
|
2117
2132
|
);
|
|
2118
2133
|
}
|
|
2119
|
-
function
|
|
2134
|
+
function On(e) {
|
|
2120
2135
|
let t;
|
|
2121
2136
|
try {
|
|
2122
2137
|
t = new URL(e);
|
|
2123
2138
|
} catch {
|
|
2124
|
-
throw
|
|
2139
|
+
throw Ge(e);
|
|
2125
2140
|
}
|
|
2126
2141
|
if (t.protocol !== "http:" && t.protocol !== "https:" || t.origin !== e)
|
|
2127
|
-
throw
|
|
2142
|
+
throw Ge(e);
|
|
2128
2143
|
}
|
|
2129
|
-
function
|
|
2144
|
+
function Ge(e) {
|
|
2130
2145
|
return new Error(
|
|
2131
2146
|
`Demiurge CORS origin ${JSON.stringify(e)} must be a canonical HTTP(S) origin without credentials, a path, query, or fragment.`
|
|
2132
2147
|
);
|
|
2133
2148
|
}
|
|
2134
|
-
function
|
|
2149
|
+
function Ln(e, t) {
|
|
2135
2150
|
return e.origins === "*" ? "*" : e.origins.includes(t) ? t : null;
|
|
2136
2151
|
}
|
|
2137
|
-
function
|
|
2152
|
+
function Mn(e, t) {
|
|
2138
2153
|
t.forEach((r, n) => {
|
|
2139
2154
|
if (n === "vary" && e.has("vary")) {
|
|
2140
2155
|
for (const s of r.split(","))
|
|
2141
|
-
|
|
2156
|
+
bt(e, s.trim());
|
|
2142
2157
|
return;
|
|
2143
2158
|
}
|
|
2144
2159
|
e.set(n, r);
|
|
2145
2160
|
});
|
|
2146
2161
|
}
|
|
2147
|
-
function
|
|
2162
|
+
function bt(e, t) {
|
|
2148
2163
|
if (!t)
|
|
2149
2164
|
return;
|
|
2150
2165
|
const r = e.get("vary")?.split(",").map((n) => n.trim()).filter(Boolean) ?? [];
|
|
2151
2166
|
r.some((n) => n.toLowerCase() === t.toLowerCase()) || e.set("vary", [...r, t].join(", "));
|
|
2152
2167
|
}
|
|
2153
|
-
function
|
|
2168
|
+
function In(e) {
|
|
2154
2169
|
if (!e)
|
|
2155
2170
|
return null;
|
|
2156
2171
|
const t = e.toUpperCase();
|
|
2157
|
-
return
|
|
2172
|
+
return Fn(t) ? t : null;
|
|
2158
2173
|
}
|
|
2159
|
-
function
|
|
2160
|
-
return t === "HEAD" ? e.HEAD ??
|
|
2174
|
+
function Tt(e, t) {
|
|
2175
|
+
return t === "HEAD" ? e.HEAD ?? _e(e.GET) : _e(e[t]);
|
|
2161
2176
|
}
|
|
2162
|
-
function
|
|
2177
|
+
function _e(e) {
|
|
2163
2178
|
return e?.kind === "page" ? void 0 : e;
|
|
2164
2179
|
}
|
|
2165
|
-
function
|
|
2180
|
+
function Un(e) {
|
|
2166
2181
|
return [
|
|
2167
2182
|
"GET",
|
|
2168
2183
|
"POST",
|
|
@@ -2171,25 +2186,25 @@ function Dn(e) {
|
|
|
2171
2186
|
"DELETE",
|
|
2172
2187
|
"OPTIONS",
|
|
2173
2188
|
"HEAD"
|
|
2174
|
-
].filter((t) =>
|
|
2189
|
+
].filter((t) => Tt(e, t));
|
|
2175
2190
|
}
|
|
2176
|
-
function
|
|
2191
|
+
function Fn(e) {
|
|
2177
2192
|
return e === "GET" || e === "POST" || e === "PUT" || e === "PATCH" || e === "DELETE" || e === "OPTIONS" || e === "HEAD";
|
|
2178
2193
|
}
|
|
2179
|
-
const
|
|
2180
|
-
function
|
|
2181
|
-
const t = [], r = e.document, n = r ?
|
|
2182
|
-
r &&
|
|
2183
|
-
const s = e.route ?
|
|
2184
|
-
return r?.scripts && (
|
|
2194
|
+
const Hn = /* @__PURE__ */ new Set(["DELETE", "PATCH", "POST", "PUT"]);
|
|
2195
|
+
function jn(e = {}) {
|
|
2196
|
+
const t = [], r = e.document, n = r ? Bn(r.policy, r.headers, t) : {};
|
|
2197
|
+
r && Wn(r.policy, t);
|
|
2198
|
+
const s = e.route ? Qn(e.route, t) : void 0;
|
|
2199
|
+
return r?.scripts && (qn(
|
|
2185
2200
|
r.policy.csp,
|
|
2186
2201
|
r.scripts,
|
|
2187
2202
|
r.headers,
|
|
2188
2203
|
t
|
|
2189
2204
|
), r.scriptDependencies && t.push(
|
|
2190
|
-
...
|
|
2205
|
+
...zn(
|
|
2191
2206
|
r.scripts,
|
|
2192
|
-
|
|
2207
|
+
Gn(r.scriptDependencies)
|
|
2193
2208
|
)
|
|
2194
2209
|
)), {
|
|
2195
2210
|
findings: t,
|
|
@@ -2197,21 +2212,21 @@ function On(e = {}) {
|
|
|
2197
2212
|
route: s
|
|
2198
2213
|
};
|
|
2199
2214
|
}
|
|
2200
|
-
function
|
|
2215
|
+
function Wn(e, t) {
|
|
2201
2216
|
if (!e.trustedTypes || e.trustedTypes.mode !== "report-only")
|
|
2202
2217
|
return;
|
|
2203
|
-
const r = e.csp || void 0, n = !!
|
|
2204
|
-
!n && !
|
|
2218
|
+
const r = e.csp || void 0, n = !!ge(r?.reportUri)?.length, s = e.headers?.reportingEndpoints, o = !!(r?.reportTo && s && s[r.reportTo]);
|
|
2219
|
+
!n && !o && t.push({
|
|
2205
2220
|
code: "report-only-target-missing",
|
|
2206
2221
|
message: "Trusted Types report-only mode has no deliverable target. Configure CSP reportTo with a matching Reporting-Endpoints member, reportUri for compatibility, or both.",
|
|
2207
2222
|
severity: "warning"
|
|
2208
2223
|
});
|
|
2209
2224
|
}
|
|
2210
|
-
function
|
|
2225
|
+
function zn(e, t = {}) {
|
|
2211
2226
|
const r = t.requirePurpose ?? !0, n = [];
|
|
2212
2227
|
for (const s of e) {
|
|
2213
|
-
const
|
|
2214
|
-
|
|
2228
|
+
const o = ts(s);
|
|
2229
|
+
o && (r && !s.purpose && n.push({
|
|
2215
2230
|
code: "script-purpose-missing",
|
|
2216
2231
|
message: `Third-party script ${s.src} should declare a purpose for audits and consent flows.`,
|
|
2217
2232
|
severity: "warning"
|
|
@@ -2223,7 +2238,7 @@ function In(e, t = {}) {
|
|
|
2223
2238
|
code: "script-third-party-before-interactive",
|
|
2224
2239
|
message: `Third-party script ${s.src} runs before the app is interactive and should be justified by policy.`,
|
|
2225
2240
|
severity: "warning"
|
|
2226
|
-
}),
|
|
2241
|
+
}), rs(o) && n.push({
|
|
2227
2242
|
code: "script-gtm-wide-trust-boundary",
|
|
2228
2243
|
message: "Google Tag Manager can load additional scripts at runtime and should be treated as a wide trust boundary.",
|
|
2229
2244
|
severity: "warning"
|
|
@@ -2231,9 +2246,9 @@ function In(e, t = {}) {
|
|
|
2231
2246
|
}
|
|
2232
2247
|
return n;
|
|
2233
2248
|
}
|
|
2234
|
-
function
|
|
2249
|
+
function Bn(e, t, r) {
|
|
2235
2250
|
try {
|
|
2236
|
-
return Object.fromEntries(
|
|
2251
|
+
return Object.fromEntries(q(e, t));
|
|
2237
2252
|
} catch (n) {
|
|
2238
2253
|
return r.push({
|
|
2239
2254
|
code: "security-header-render-failed",
|
|
@@ -2242,71 +2257,71 @@ function Mn(e, t, r) {
|
|
|
2242
2257
|
}), {};
|
|
2243
2258
|
}
|
|
2244
2259
|
}
|
|
2245
|
-
function
|
|
2260
|
+
function qn(e, t, r, n) {
|
|
2246
2261
|
if (!e)
|
|
2247
2262
|
return;
|
|
2248
|
-
const s =
|
|
2249
|
-
for (const
|
|
2250
|
-
if (
|
|
2263
|
+
const s = _n(e);
|
|
2264
|
+
for (const o of t) {
|
|
2265
|
+
if (Vn(s) && !o.nonce) {
|
|
2251
2266
|
n.push({
|
|
2252
2267
|
code: "csp-script-missing-nonce",
|
|
2253
|
-
message: `Document script ${
|
|
2268
|
+
message: `Document script ${o.src} needs a nonce for the effective script-src policy.`,
|
|
2254
2269
|
severity: "error"
|
|
2255
2270
|
});
|
|
2256
2271
|
continue;
|
|
2257
2272
|
}
|
|
2258
|
-
|
|
2273
|
+
o.nonce && r?.nonce && o.nonce === r.nonce || Jn(s, o.src) || n.push({
|
|
2259
2274
|
code: "csp-script-src-blocked",
|
|
2260
|
-
message: `Document script ${
|
|
2275
|
+
message: `Document script ${o.src} is not allowed by the effective script-src policy.`,
|
|
2261
2276
|
severity: "error"
|
|
2262
2277
|
});
|
|
2263
2278
|
}
|
|
2264
2279
|
}
|
|
2265
|
-
function
|
|
2280
|
+
function Gn(e) {
|
|
2266
2281
|
return typeof e == "boolean" ? {} : e;
|
|
2267
2282
|
}
|
|
2268
|
-
function
|
|
2269
|
-
return
|
|
2283
|
+
function _n(e) {
|
|
2284
|
+
return ge(e.scriptSrc) ?? ge(e.defaultSrc) ?? [];
|
|
2270
2285
|
}
|
|
2271
|
-
function
|
|
2286
|
+
function ge(e) {
|
|
2272
2287
|
if (e)
|
|
2273
2288
|
return "replace" in e ? e.replace : e;
|
|
2274
2289
|
}
|
|
2275
|
-
function
|
|
2290
|
+
function Vn(e) {
|
|
2276
2291
|
return e.some((t) => t.includes("'nonce-{nonce}'"));
|
|
2277
2292
|
}
|
|
2278
|
-
function
|
|
2279
|
-
return
|
|
2293
|
+
function Jn(e, t) {
|
|
2294
|
+
return Zn(e) ? !1 : e.includes("*") ? !0 : e.includes("'none'") || e.some((r) => r.startsWith("'nonce-")) ? !1 : e.includes("'self'") && Kn(t) || t.startsWith("https:") && e.includes("https:") || t.startsWith("http:") && e.includes("http:") ? !0 : e.some((r) => Yn(r, t));
|
|
2280
2295
|
}
|
|
2281
|
-
function
|
|
2296
|
+
function Kn(e) {
|
|
2282
2297
|
return e.startsWith("/") && !e.startsWith("//");
|
|
2283
2298
|
}
|
|
2284
|
-
function
|
|
2299
|
+
function Yn(e, t) {
|
|
2285
2300
|
if (e.startsWith("'"))
|
|
2286
2301
|
return !1;
|
|
2287
2302
|
try {
|
|
2288
|
-
const r = new URL(e), n = new URL(t), s = r.hostname.startsWith("*.") ? n.hostname.endsWith(r.hostname.slice(1)) && n.hostname !== r.hostname.slice(2) : n.hostname === r.hostname,
|
|
2289
|
-
return n.protocol === r.protocol && s && n.port === r.port &&
|
|
2303
|
+
const r = new URL(e), n = new URL(t), s = r.hostname.startsWith("*.") ? n.hostname.endsWith(r.hostname.slice(1)) && n.hostname !== r.hostname.slice(2) : n.hostname === r.hostname, o = r.pathname === "/" || r.pathname.endsWith("/") ? n.pathname.startsWith(r.pathname) : n.pathname === r.pathname;
|
|
2304
|
+
return n.protocol === r.protocol && s && n.port === r.port && o;
|
|
2290
2305
|
} catch {
|
|
2291
2306
|
return !1;
|
|
2292
2307
|
}
|
|
2293
2308
|
}
|
|
2294
|
-
function
|
|
2309
|
+
function Zn(e) {
|
|
2295
2310
|
return e.includes("'strict-dynamic'") && e.some(
|
|
2296
2311
|
(t) => t.startsWith("'nonce-") || /^'sha(?:256|384|512)-/.test(t)
|
|
2297
2312
|
);
|
|
2298
2313
|
}
|
|
2299
|
-
function
|
|
2300
|
-
return
|
|
2314
|
+
function Qn(e, t) {
|
|
2315
|
+
return Xn(e.cors, t), es(e.method, e.security, t), {
|
|
2301
2316
|
cors: e.cors,
|
|
2302
2317
|
method: e.method,
|
|
2303
2318
|
security: e.security
|
|
2304
2319
|
};
|
|
2305
2320
|
}
|
|
2306
|
-
function
|
|
2321
|
+
function Xn(e, t) {
|
|
2307
2322
|
if (e)
|
|
2308
2323
|
try {
|
|
2309
|
-
|
|
2324
|
+
Ce(e);
|
|
2310
2325
|
} catch (r) {
|
|
2311
2326
|
t.push({
|
|
2312
2327
|
code: "cors-invalid",
|
|
@@ -2315,8 +2330,8 @@ function _n(e, t) {
|
|
|
2315
2330
|
});
|
|
2316
2331
|
}
|
|
2317
2332
|
}
|
|
2318
|
-
function
|
|
2319
|
-
|
|
2333
|
+
function es(e, t, r) {
|
|
2334
|
+
Hn.has(e) && (t?.csrf === !1 && r.push({
|
|
2320
2335
|
code: "csrf-disabled",
|
|
2321
2336
|
message: "CSRF protection is explicitly disabled for this unsafe route.",
|
|
2322
2337
|
severity: "info"
|
|
@@ -2330,7 +2345,7 @@ function Vn(e, t, r) {
|
|
|
2330
2345
|
severity: "warning"
|
|
2331
2346
|
}));
|
|
2332
2347
|
}
|
|
2333
|
-
function
|
|
2348
|
+
function ts(e) {
|
|
2334
2349
|
try {
|
|
2335
2350
|
const t = new URL(e.src);
|
|
2336
2351
|
if (t.protocol === "http:" || t.protocol === "https:")
|
|
@@ -2340,17 +2355,17 @@ function Jn(e) {
|
|
|
2340
2355
|
}
|
|
2341
2356
|
return null;
|
|
2342
2357
|
}
|
|
2343
|
-
function
|
|
2358
|
+
function rs(e) {
|
|
2344
2359
|
return e.hostname === "www.googletagmanager.com" && (e.pathname === "/gtm.js" || e.pathname === "/ns.html");
|
|
2345
2360
|
}
|
|
2346
|
-
const
|
|
2347
|
-
function
|
|
2361
|
+
const ns = /* @__PURE__ */ new Set(["DELETE", "PATCH", "POST", "PUT"]), ss = /^[!#$%&'*+\-.^_`|~A-Za-z0-9]+$/;
|
|
2362
|
+
function os() {
|
|
2348
2363
|
const e = new Uint8Array(32);
|
|
2349
2364
|
return globalThis.crypto.getRandomValues(e), btoa(String.fromCharCode(...e)).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
2350
2365
|
}
|
|
2351
|
-
function
|
|
2366
|
+
function is(e, t = {}) {
|
|
2352
2367
|
const r = t.cookie ?? "csrf-token";
|
|
2353
|
-
if (!
|
|
2368
|
+
if (!ss.test(r))
|
|
2354
2369
|
throw new Error("Demiurge CSRF cookie name is invalid.");
|
|
2355
2370
|
if (!e)
|
|
2356
2371
|
throw new Error("Demiurge CSRF token must not be empty.");
|
|
@@ -2361,25 +2376,25 @@ function Xn(e, t = {}) {
|
|
|
2361
2376
|
];
|
|
2362
2377
|
return (t.secure ?? !0) && n.push("Secure"), n.join("; ");
|
|
2363
2378
|
}
|
|
2364
|
-
function
|
|
2365
|
-
const t =
|
|
2379
|
+
function Ko(e = {}) {
|
|
2380
|
+
const t = os();
|
|
2366
2381
|
return {
|
|
2367
|
-
cookie:
|
|
2382
|
+
cookie: is(t, e),
|
|
2368
2383
|
token: t
|
|
2369
2384
|
};
|
|
2370
2385
|
}
|
|
2371
|
-
function
|
|
2372
|
-
if (!
|
|
2386
|
+
function as(e, t) {
|
|
2387
|
+
if (!ns.has(t.method.toUpperCase()) || e === !1)
|
|
2373
2388
|
return null;
|
|
2374
2389
|
const r = t.headers.get("cookie");
|
|
2375
2390
|
if (e === void 0 && !r?.trim())
|
|
2376
2391
|
return null;
|
|
2377
|
-
const n =
|
|
2378
|
-
return !
|
|
2392
|
+
const n = us(e ?? !0), o = cs(r).get(n.cookie), i = t.headers.get(n.header);
|
|
2393
|
+
return !o || !i || !fs(o, i) ? new Response("Invalid CSRF token.", {
|
|
2379
2394
|
status: 403
|
|
2380
2395
|
}) : null;
|
|
2381
2396
|
}
|
|
2382
|
-
function
|
|
2397
|
+
function cs(e) {
|
|
2383
2398
|
const t = /* @__PURE__ */ new Map();
|
|
2384
2399
|
if (!e)
|
|
2385
2400
|
return t;
|
|
@@ -2387,12 +2402,12 @@ function ts(e) {
|
|
|
2387
2402
|
const n = r.indexOf("=");
|
|
2388
2403
|
if (n === -1)
|
|
2389
2404
|
continue;
|
|
2390
|
-
const s = r.slice(0, n).trim(),
|
|
2391
|
-
s && t.set(s,
|
|
2405
|
+
const s = r.slice(0, n).trim(), o = r.slice(n + 1).trim();
|
|
2406
|
+
s && t.set(s, ls(o));
|
|
2392
2407
|
}
|
|
2393
2408
|
return t;
|
|
2394
2409
|
}
|
|
2395
|
-
function
|
|
2410
|
+
function us(e) {
|
|
2396
2411
|
return e === !0 ? {
|
|
2397
2412
|
cookie: "csrf-token",
|
|
2398
2413
|
header: "x-csrf-token"
|
|
@@ -2401,27 +2416,88 @@ function rs(e) {
|
|
|
2401
2416
|
header: e.header ?? "x-csrf-token"
|
|
2402
2417
|
};
|
|
2403
2418
|
}
|
|
2404
|
-
function
|
|
2419
|
+
function ls(e) {
|
|
2405
2420
|
try {
|
|
2406
2421
|
return decodeURIComponent(e);
|
|
2407
2422
|
} catch {
|
|
2408
2423
|
return e;
|
|
2409
2424
|
}
|
|
2410
2425
|
}
|
|
2411
|
-
function
|
|
2426
|
+
function fs(e, t) {
|
|
2412
2427
|
let r = e.length ^ t.length;
|
|
2413
2428
|
const n = Math.max(e.length, t.length);
|
|
2414
2429
|
for (let s = 0; s < n; s += 1)
|
|
2415
2430
|
r |= e.charCodeAt(s) ^ t.charCodeAt(s);
|
|
2416
2431
|
return r === 0;
|
|
2417
2432
|
}
|
|
2418
|
-
const
|
|
2433
|
+
const le = "Sec-Fetch-Dest", ds = "Sec-Fetch-Mode", hs = "Sec-Fetch-Site", ms = /* @__PURE__ */ new Set(["embed", "object"]), ps = /* @__PURE__ */ new Set(["GET", "HEAD"]), Ve = {
|
|
2434
|
+
allowCrossSite: !1,
|
|
2435
|
+
allowNavigation: !0,
|
|
2436
|
+
allowSameSite: !1
|
|
2437
|
+
};
|
|
2438
|
+
function gs(e, t, r = t.method) {
|
|
2439
|
+
const n = e === !0 ? Ve : { ...Ve, ...e }, s = [];
|
|
2440
|
+
if (ws(t, r))
|
|
2441
|
+
return { allowed: !0, reason: "cors-preflight", vary: s };
|
|
2442
|
+
s.push(hs);
|
|
2443
|
+
const o = t.headers.get("sec-fetch-site");
|
|
2444
|
+
if (o === null)
|
|
2445
|
+
return { allowed: !0, reason: "metadata-absent", vary: s };
|
|
2446
|
+
if (o === "same-origin")
|
|
2447
|
+
return { allowed: !0, reason: "same-origin", vary: s };
|
|
2448
|
+
if (o === "none")
|
|
2449
|
+
return { allowed: !0, reason: "user-initiated", vary: s };
|
|
2450
|
+
if (o === "same-site" && n.allowSameSite)
|
|
2451
|
+
return { allowed: !0, reason: "same-site-trusted", vary: s };
|
|
2452
|
+
if (n.allowCrossSite)
|
|
2453
|
+
return { allowed: !0, reason: "cross-site-exempt", vary: s };
|
|
2454
|
+
const i = e === !0 ? void 0 : e.allowedDestinations;
|
|
2455
|
+
if (i?.length && (s.push(le), i.includes(t.headers.get("sec-fetch-dest") ?? "")))
|
|
2456
|
+
return { allowed: !0, reason: "destination-exempt", vary: s };
|
|
2457
|
+
if (n.allowNavigation && ps.has(r.toUpperCase()) && (s.push(ds), t.headers.get("sec-fetch-mode") === "navigate")) {
|
|
2458
|
+
const a = t.headers.get("sec-fetch-dest") ?? "";
|
|
2459
|
+
if (s.includes(le) || s.push(le), !ms.has(a))
|
|
2460
|
+
return { allowed: !0, reason: "top-level-navigation", vary: s };
|
|
2461
|
+
}
|
|
2462
|
+
return {
|
|
2463
|
+
allowed: !1,
|
|
2464
|
+
reason: o === "same-site" ? "same-site-denied" : "cross-site-denied",
|
|
2465
|
+
vary: s
|
|
2466
|
+
};
|
|
2467
|
+
}
|
|
2468
|
+
function ys(e, t, r = t.method) {
|
|
2469
|
+
if (!e)
|
|
2470
|
+
return { response: null, vary: [] };
|
|
2471
|
+
const n = gs(e, t, r);
|
|
2472
|
+
if (n.allowed)
|
|
2473
|
+
return { response: null, vary: n.vary };
|
|
2474
|
+
const s = new Response("Request blocked by the Fetch Metadata policy.", {
|
|
2475
|
+
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
2476
|
+
status: 403
|
|
2477
|
+
});
|
|
2478
|
+
return xt(s, n.vary), { response: s, vary: n.vary };
|
|
2479
|
+
}
|
|
2480
|
+
function xt(e, t) {
|
|
2481
|
+
if (t.length === 0)
|
|
2482
|
+
return e;
|
|
2483
|
+
const r = e.headers.get("vary")?.split(",").map((s) => s.trim()).filter(Boolean) ?? [];
|
|
2484
|
+
if (r.includes("*"))
|
|
2485
|
+
return e;
|
|
2486
|
+
const n = [...r];
|
|
2487
|
+
for (const s of t)
|
|
2488
|
+
n.some((o) => o.toLowerCase() === s.toLowerCase()) || n.push(s);
|
|
2489
|
+
return e.headers.set("vary", n.join(", ")), e;
|
|
2490
|
+
}
|
|
2491
|
+
function ws(e, t) {
|
|
2492
|
+
return t.toUpperCase() === "OPTIONS" && e.headers.has("access-control-request-method");
|
|
2493
|
+
}
|
|
2494
|
+
const Ss = {
|
|
2419
2495
|
h: 3600 * 1e3,
|
|
2420
2496
|
m: 60 * 1e3,
|
|
2421
2497
|
s: 1e3
|
|
2422
|
-
},
|
|
2423
|
-
function
|
|
2424
|
-
const t = e.maximumEntries ??
|
|
2498
|
+
}, Es = 1e4;
|
|
2499
|
+
function At(e = {}) {
|
|
2500
|
+
const t = e.maximumEntries ?? Es;
|
|
2425
2501
|
if (!Number.isSafeInteger(t) || t <= 0)
|
|
2426
2502
|
throw new Error(
|
|
2427
2503
|
"Demiurge rate limit maximumEntries must be a positive integer."
|
|
@@ -2429,50 +2505,50 @@ function Rt(e = {}) {
|
|
|
2429
2505
|
const r = /* @__PURE__ */ new Map();
|
|
2430
2506
|
let n = Number.POSITIVE_INFINITY;
|
|
2431
2507
|
return {
|
|
2432
|
-
increment(s,
|
|
2433
|
-
|
|
2508
|
+
increment(s, o, i) {
|
|
2509
|
+
i >= n && (vs(r, i), n = Rs(r));
|
|
2434
2510
|
const a = r.get(s);
|
|
2435
|
-
if (!a || a.resetAt <=
|
|
2511
|
+
if (!a || a.resetAt <= i) {
|
|
2436
2512
|
const c = {
|
|
2437
2513
|
count: 1,
|
|
2438
|
-
resetAt:
|
|
2514
|
+
resetAt: i + o
|
|
2439
2515
|
};
|
|
2440
|
-
return !a && r.size >= t &&
|
|
2516
|
+
return !a && r.size >= t && bs(r), r.set(s, c), n = Math.min(n, c.resetAt), { count: c.count, resetAt: c.resetAt };
|
|
2441
2517
|
}
|
|
2442
|
-
return a.count += 1, a;
|
|
2518
|
+
return a.count += 1, { count: a.count, resetAt: a.resetAt };
|
|
2443
2519
|
}
|
|
2444
2520
|
};
|
|
2445
2521
|
}
|
|
2446
|
-
function
|
|
2522
|
+
function vs(e, t) {
|
|
2447
2523
|
for (const [r, n] of e)
|
|
2448
2524
|
n.resetAt <= t && e.delete(r);
|
|
2449
2525
|
}
|
|
2450
|
-
function
|
|
2526
|
+
function Rs(e) {
|
|
2451
2527
|
let t = Number.POSITIVE_INFINITY;
|
|
2452
2528
|
for (const r of e.values())
|
|
2453
2529
|
t = Math.min(t, r.resetAt);
|
|
2454
2530
|
return t;
|
|
2455
2531
|
}
|
|
2456
|
-
function
|
|
2532
|
+
function bs(e) {
|
|
2457
2533
|
const t = e.keys().next().value;
|
|
2458
2534
|
t !== void 0 && e.delete(t);
|
|
2459
2535
|
}
|
|
2460
|
-
function
|
|
2536
|
+
async function Ts(e, t, r, n = Date.now()) {
|
|
2461
2537
|
if (!e)
|
|
2462
2538
|
return null;
|
|
2463
|
-
|
|
2464
|
-
const s =
|
|
2465
|
-
"retry-after": String(Math.ceil(Math.max(0,
|
|
2539
|
+
De(e);
|
|
2540
|
+
const s = Pt(e.window), o = xs(e, t), i = await r.increment(o, s, n), a = Math.max(0, e.limit - i.count), c = new Headers({
|
|
2541
|
+
"retry-after": String(Math.ceil(Math.max(0, i.resetAt - n) / 1e3)),
|
|
2466
2542
|
"x-ratelimit-limit": String(e.limit),
|
|
2467
2543
|
"x-ratelimit-remaining": String(a),
|
|
2468
|
-
"x-ratelimit-reset": String(Math.ceil(
|
|
2544
|
+
"x-ratelimit-reset": String(Math.ceil(i.resetAt / 1e3))
|
|
2469
2545
|
});
|
|
2470
|
-
return
|
|
2546
|
+
return i.count > e.limit ? new Response("Rate limit exceeded.", {
|
|
2471
2547
|
headers: c,
|
|
2472
2548
|
status: 429
|
|
2473
2549
|
}) : null;
|
|
2474
2550
|
}
|
|
2475
|
-
function
|
|
2551
|
+
function Pt(e) {
|
|
2476
2552
|
if (typeof e == "number") {
|
|
2477
2553
|
if (!Number.isSafeInteger(e) || e <= 0)
|
|
2478
2554
|
throw new Error("Demiurge rate limit window must be a positive integer.");
|
|
@@ -2481,36 +2557,36 @@ function vt(e) {
|
|
|
2481
2557
|
const t = /^(\d+)(s|m|h)$/i.exec(e.trim());
|
|
2482
2558
|
if (!t)
|
|
2483
2559
|
throw new Error("Demiurge rate limit window must use an s/m/h suffix.");
|
|
2484
|
-
const r = Number(t[1]), n = t[2].toLowerCase(), s = r *
|
|
2560
|
+
const r = Number(t[1]), n = t[2].toLowerCase(), s = r * Ss[n];
|
|
2485
2561
|
if (!Number.isSafeInteger(s))
|
|
2486
2562
|
throw new Error("Demiurge rate limit window is too large.");
|
|
2487
2563
|
return s;
|
|
2488
2564
|
}
|
|
2489
|
-
function
|
|
2565
|
+
function De(e) {
|
|
2490
2566
|
if (!Number.isSafeInteger(e.limit) || e.limit <= 0)
|
|
2491
2567
|
throw new Error("Demiurge rate limit limit must be a positive integer.");
|
|
2492
|
-
|
|
2568
|
+
Pt(e.window);
|
|
2493
2569
|
}
|
|
2494
|
-
function
|
|
2495
|
-
return `${
|
|
2570
|
+
function xs(e, t) {
|
|
2571
|
+
return `${As(e.key)}:${Ps(e.key, t)}`;
|
|
2496
2572
|
}
|
|
2497
|
-
function
|
|
2573
|
+
function As(e) {
|
|
2498
2574
|
return typeof e == "string" ? e : `header:${e.header.toLowerCase()}`;
|
|
2499
2575
|
}
|
|
2500
|
-
function
|
|
2501
|
-
return e === "ip" ?
|
|
2576
|
+
function Ps(e, t) {
|
|
2577
|
+
return e === "ip" ? Cs(t) : t.headers.get(e.header) ?? "missing";
|
|
2502
2578
|
}
|
|
2503
|
-
function
|
|
2504
|
-
return
|
|
2579
|
+
function Cs(e) {
|
|
2580
|
+
return Ht(e)?.clientIp ?? "unknown";
|
|
2505
2581
|
}
|
|
2506
|
-
const
|
|
2582
|
+
const Ds = {
|
|
2507
2583
|
b: 1,
|
|
2508
2584
|
gb: 1024 ** 3,
|
|
2509
2585
|
kb: 1024,
|
|
2510
2586
|
mb: 1024 ** 2
|
|
2511
2587
|
};
|
|
2512
|
-
function
|
|
2513
|
-
const n =
|
|
2588
|
+
function $s(e, t, r) {
|
|
2589
|
+
const n = Ns(e, r);
|
|
2514
2590
|
if (n)
|
|
2515
2591
|
return n;
|
|
2516
2592
|
if (e?.maxBodySize === void 0)
|
|
@@ -2518,27 +2594,27 @@ function gs(e, t, r) {
|
|
|
2518
2594
|
const s = t.headers.get("content-length");
|
|
2519
2595
|
if (!s)
|
|
2520
2596
|
return null;
|
|
2521
|
-
const
|
|
2522
|
-
if (
|
|
2597
|
+
const o = Os(s);
|
|
2598
|
+
if (o === null)
|
|
2523
2599
|
return new Response("Invalid Content-Length.", {
|
|
2524
2600
|
status: 400
|
|
2525
2601
|
});
|
|
2526
|
-
const
|
|
2527
|
-
return
|
|
2602
|
+
const i = Ct(e.maxBodySize);
|
|
2603
|
+
return o > i ? new Response("Request body too large.", {
|
|
2528
2604
|
status: 413
|
|
2529
2605
|
}) : null;
|
|
2530
2606
|
}
|
|
2531
|
-
class
|
|
2607
|
+
class F extends Error {
|
|
2532
2608
|
constructor() {
|
|
2533
2609
|
super("Demiurge request body exceeded maxBodySize while being read."), this.name = "RequestBodyTooLargeError";
|
|
2534
2610
|
}
|
|
2535
2611
|
}
|
|
2536
|
-
function
|
|
2612
|
+
function ks(e, t) {
|
|
2537
2613
|
if (e?.maxBodySize === void 0 || t.body === null)
|
|
2538
2614
|
return t;
|
|
2539
|
-
const r =
|
|
2615
|
+
const r = Ct(e.maxBodySize), n = t.body.getReader();
|
|
2540
2616
|
let s = 0;
|
|
2541
|
-
const
|
|
2617
|
+
const o = new ReadableStream({
|
|
2542
2618
|
async pull(a) {
|
|
2543
2619
|
const c = await n.read();
|
|
2544
2620
|
if (c.done) {
|
|
@@ -2546,7 +2622,7 @@ function ys(e, t) {
|
|
|
2546
2622
|
return;
|
|
2547
2623
|
}
|
|
2548
2624
|
if (s += c.value.byteLength, s > r) {
|
|
2549
|
-
const u = new
|
|
2625
|
+
const u = new F();
|
|
2550
2626
|
a.error(u);
|
|
2551
2627
|
try {
|
|
2552
2628
|
await n.cancel(u);
|
|
@@ -2562,24 +2638,24 @@ function ys(e, t) {
|
|
|
2562
2638
|
} catch {
|
|
2563
2639
|
}
|
|
2564
2640
|
}
|
|
2565
|
-
}),
|
|
2566
|
-
body:
|
|
2641
|
+
}), i = new Request(t, {
|
|
2642
|
+
body: o,
|
|
2567
2643
|
duplex: "half"
|
|
2568
2644
|
});
|
|
2569
|
-
return
|
|
2645
|
+
return jt(t, i), i;
|
|
2570
2646
|
}
|
|
2571
|
-
function
|
|
2647
|
+
function V() {
|
|
2572
2648
|
return new Response("Request body too large.", { status: 413 });
|
|
2573
2649
|
}
|
|
2574
|
-
function
|
|
2575
|
-
return !e?.allowedMethods ||
|
|
2650
|
+
function Ns(e, t) {
|
|
2651
|
+
return !e?.allowedMethods || Ls(e.allowedMethods, t) ? null : new Response(null, {
|
|
2576
2652
|
headers: {
|
|
2577
|
-
allow:
|
|
2653
|
+
allow: Ms(e.allowedMethods)
|
|
2578
2654
|
},
|
|
2579
2655
|
status: 405
|
|
2580
2656
|
});
|
|
2581
2657
|
}
|
|
2582
|
-
function
|
|
2658
|
+
function Ct(e) {
|
|
2583
2659
|
if (typeof e == "number") {
|
|
2584
2660
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
2585
2661
|
throw new Error("Demiurge request maxBodySize must be a non-negative integer.");
|
|
@@ -2590,25 +2666,25 @@ function bt(e) {
|
|
|
2590
2666
|
throw new Error(
|
|
2591
2667
|
"Demiurge request maxBodySize must use bytes or a b/kb/mb/gb suffix."
|
|
2592
2668
|
);
|
|
2593
|
-
const r = Number(t[1]), n = t[2].toLowerCase(), s = r *
|
|
2669
|
+
const r = Number(t[1]), n = t[2].toLowerCase(), s = r * Ds[n];
|
|
2594
2670
|
if (!Number.isSafeInteger(s))
|
|
2595
2671
|
throw new Error("Demiurge request maxBodySize is too large.");
|
|
2596
2672
|
return s;
|
|
2597
2673
|
}
|
|
2598
|
-
function
|
|
2674
|
+
function Os(e) {
|
|
2599
2675
|
if (!/^\d+$/.test(e))
|
|
2600
2676
|
return null;
|
|
2601
2677
|
const t = Number(e);
|
|
2602
2678
|
return Number.isSafeInteger(t) ? t : null;
|
|
2603
2679
|
}
|
|
2604
|
-
function
|
|
2680
|
+
function Ls(e, t) {
|
|
2605
2681
|
return e.includes(t) || t === "HEAD" && e.includes("GET");
|
|
2606
2682
|
}
|
|
2607
|
-
function
|
|
2683
|
+
function Ms(e) {
|
|
2608
2684
|
const t = [...e];
|
|
2609
2685
|
return t.includes("GET") && !t.includes("HEAD") && t.push("HEAD"), t.join(", ");
|
|
2610
2686
|
}
|
|
2611
|
-
const
|
|
2687
|
+
const Is = [
|
|
2612
2688
|
"GET",
|
|
2613
2689
|
"POST",
|
|
2614
2690
|
"PUT",
|
|
@@ -2617,15 +2693,15 @@ const vs = [
|
|
|
2617
2693
|
"OPTIONS",
|
|
2618
2694
|
"HEAD"
|
|
2619
2695
|
];
|
|
2620
|
-
function
|
|
2696
|
+
function Us(e, t = {}) {
|
|
2621
2697
|
for (const [n, s] of Object.entries(e)) {
|
|
2622
|
-
|
|
2623
|
-
for (const
|
|
2624
|
-
const
|
|
2625
|
-
!
|
|
2698
|
+
Fs(n, s);
|
|
2699
|
+
for (const o of Is) {
|
|
2700
|
+
const i = s[o];
|
|
2701
|
+
!i || i.kind === "page" || Hs(n, o, i, s);
|
|
2626
2702
|
}
|
|
2627
2703
|
}
|
|
2628
|
-
const r =
|
|
2704
|
+
const r = ot(
|
|
2629
2705
|
Object.fromEntries(
|
|
2630
2706
|
Object.entries(e).map(([n, s]) => [
|
|
2631
2707
|
n,
|
|
@@ -2633,53 +2709,53 @@ function bs(e, t = {}) {
|
|
|
2633
2709
|
])
|
|
2634
2710
|
)
|
|
2635
2711
|
);
|
|
2636
|
-
return
|
|
2712
|
+
return Bs(r, e, t.adapter), r;
|
|
2637
2713
|
}
|
|
2638
|
-
function
|
|
2714
|
+
function Fs(e, t) {
|
|
2639
2715
|
const r = t.policy?.security?.rateLimit;
|
|
2640
|
-
r &&
|
|
2641
|
-
|
|
2716
|
+
r && z(e, "policy", "rate limit", () => {
|
|
2717
|
+
De(r);
|
|
2642
2718
|
});
|
|
2643
2719
|
}
|
|
2644
|
-
function
|
|
2645
|
-
r.cors &&
|
|
2646
|
-
|
|
2647
|
-
}), r.security?.rateLimit &&
|
|
2648
|
-
|
|
2720
|
+
function Hs(e, t, r, n) {
|
|
2721
|
+
r.cors && z(e, t, "CORS", () => {
|
|
2722
|
+
Ce(r.cors), js(e, t, r.cors.methods, n);
|
|
2723
|
+
}), r.security?.rateLimit && z(e, t, "rate limit", () => {
|
|
2724
|
+
De(r.security.rateLimit);
|
|
2649
2725
|
});
|
|
2650
2726
|
}
|
|
2651
|
-
function
|
|
2727
|
+
function js(e, t, r, n) {
|
|
2652
2728
|
if (r) {
|
|
2653
2729
|
for (const s of r)
|
|
2654
|
-
if (s !== "OPTIONS" && !
|
|
2730
|
+
if (s !== "OPTIONS" && !Ws(n, s))
|
|
2655
2731
|
throw new Error(
|
|
2656
2732
|
`Route ${JSON.stringify(e)} export ${t} allows CORS method ${s}, but the route does not export that response capability.`
|
|
2657
2733
|
);
|
|
2658
2734
|
}
|
|
2659
2735
|
}
|
|
2660
|
-
function
|
|
2736
|
+
function Ws(e, t) {
|
|
2661
2737
|
const r = t === "HEAD" ? e.HEAD ?? e.GET : e[t];
|
|
2662
|
-
return
|
|
2738
|
+
return zs(r) ? r : void 0;
|
|
2663
2739
|
}
|
|
2664
|
-
function
|
|
2740
|
+
function zs(e) {
|
|
2665
2741
|
return !!(e && e.kind !== "page");
|
|
2666
2742
|
}
|
|
2667
|
-
function
|
|
2743
|
+
function Bs(e, t, r) {
|
|
2668
2744
|
for (const s of e.routes) {
|
|
2669
|
-
const
|
|
2670
|
-
if (!
|
|
2745
|
+
const o = t[s.file], i = o?.GET;
|
|
2746
|
+
if (!i || i.kind !== "page")
|
|
2671
2747
|
continue;
|
|
2672
|
-
const a =
|
|
2748
|
+
const a = X(
|
|
2673
2749
|
...e.policies.filter(
|
|
2674
2750
|
(c) => T(c.fileSegments, s.fileSegments)
|
|
2675
2751
|
).map((c) => t[c.file]?.policy),
|
|
2676
|
-
|
|
2752
|
+
o.policy
|
|
2677
2753
|
);
|
|
2678
|
-
|
|
2754
|
+
Je(s.file, "GET", a, r), Ks(
|
|
2679
2755
|
s.file,
|
|
2680
|
-
|
|
2756
|
+
i.render.mode,
|
|
2681
2757
|
a.document
|
|
2682
|
-
),
|
|
2758
|
+
), qs(
|
|
2683
2759
|
s.file,
|
|
2684
2760
|
"GET",
|
|
2685
2761
|
a,
|
|
@@ -2687,7 +2763,7 @@ function As(e, t, r) {
|
|
|
2687
2763
|
...e.layouts.filter(
|
|
2688
2764
|
(c) => T(c.fileSegments, s.fileSegments)
|
|
2689
2765
|
).map((c) => t[c.file]?.scripts),
|
|
2690
|
-
|
|
2766
|
+
o.scripts
|
|
2691
2767
|
]
|
|
2692
2768
|
);
|
|
2693
2769
|
}
|
|
@@ -2697,61 +2773,117 @@ function As(e, t, r) {
|
|
|
2697
2773
|
...e.fallbacks.notFound
|
|
2698
2774
|
];
|
|
2699
2775
|
for (const s of n) {
|
|
2700
|
-
const
|
|
2776
|
+
const o = X(
|
|
2701
2777
|
...e.policies.filter(
|
|
2702
|
-
(
|
|
2703
|
-
).map((
|
|
2778
|
+
(i) => T(i.fileSegments, s.fileSegments)
|
|
2779
|
+
).map((i) => t[i.file]?.policy),
|
|
2704
2780
|
t[s.file]?.policy
|
|
2705
2781
|
);
|
|
2706
|
-
|
|
2782
|
+
Je(
|
|
2707
2783
|
s.file,
|
|
2708
2784
|
"policy",
|
|
2709
|
-
|
|
2785
|
+
o,
|
|
2710
2786
|
r
|
|
2711
2787
|
);
|
|
2712
2788
|
}
|
|
2713
2789
|
}
|
|
2714
|
-
function
|
|
2790
|
+
function qs(e, t, r, n) {
|
|
2715
2791
|
const s = n.flatMap(
|
|
2716
|
-
(
|
|
2792
|
+
(f) => Array.isArray(f) ? f : []
|
|
2717
2793
|
);
|
|
2718
2794
|
if (s.length === 0 || !r.document)
|
|
2719
2795
|
return;
|
|
2720
|
-
const
|
|
2796
|
+
const o = "startup-verification-nonce", a = jn({
|
|
2721
2797
|
document: {
|
|
2722
|
-
headers: { nonce:
|
|
2798
|
+
headers: { nonce: o },
|
|
2723
2799
|
policy: r.document,
|
|
2724
|
-
scripts: s.map((
|
|
2725
|
-
...
|
|
2726
|
-
nonce:
|
|
2800
|
+
scripts: s.map((f) => ({
|
|
2801
|
+
...f,
|
|
2802
|
+
nonce: ne(r.document) ? o : f.nonce
|
|
2727
2803
|
}))
|
|
2728
2804
|
}
|
|
2729
2805
|
}).findings.find(
|
|
2730
|
-
(
|
|
2806
|
+
(f) => f.code === "csp-script-src-blocked"
|
|
2731
2807
|
);
|
|
2732
|
-
if (!a)
|
|
2808
|
+
if (!a) {
|
|
2809
|
+
_s(
|
|
2810
|
+
e,
|
|
2811
|
+
t,
|
|
2812
|
+
r.document.csp,
|
|
2813
|
+
s
|
|
2814
|
+
);
|
|
2733
2815
|
return;
|
|
2816
|
+
}
|
|
2734
2817
|
const c = s.find(
|
|
2735
|
-
(
|
|
2736
|
-
),
|
|
2737
|
-
(
|
|
2818
|
+
(f) => a.message.includes(f.src)
|
|
2819
|
+
), l = (q(r.document, { nonce: o }).get("content-security-policy") ?? "").split("; ").find(
|
|
2820
|
+
(f) => f.startsWith("script-src ")
|
|
2738
2821
|
) ?? "default-src (script-src fallback)";
|
|
2739
2822
|
throw new Error(
|
|
2740
|
-
`Route ${JSON.stringify(e)} export ${t} declares script ${JSON.stringify(c?.src)} that violates the effective ${
|
|
2823
|
+
`Route ${JSON.stringify(e)} export ${t} declares script ${JSON.stringify(c?.src)} that violates the effective ${l} policy.`
|
|
2741
2824
|
);
|
|
2742
2825
|
}
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2826
|
+
const Gs = [
|
|
2827
|
+
{ directive: "connectSrc", name: "connect-src", need: "connect" },
|
|
2828
|
+
{ directive: "imgSrc", name: "img-src", need: "img" }
|
|
2829
|
+
];
|
|
2830
|
+
function _s(e, t, r, n) {
|
|
2831
|
+
if (r)
|
|
2832
|
+
for (const s of n)
|
|
2833
|
+
for (const { directive: o, name: i, need: a } of Gs) {
|
|
2834
|
+
const c = s.needs?.[a] ?? [];
|
|
2835
|
+
if (c.length === 0)
|
|
2836
|
+
continue;
|
|
2837
|
+
const u = W(r[o]) ?? W(r.defaultSrc);
|
|
2838
|
+
if (u !== void 0) {
|
|
2839
|
+
for (const l of c)
|
|
2840
|
+
if (!(Array.isArray(u) && Vs(u, l)))
|
|
2841
|
+
throw new Error(
|
|
2842
|
+
`Route ${JSON.stringify(e)} export ${t} declares script ${JSON.stringify(s.src)} that needs ${i} ${l}, which the effective policy does not allow. Add ${l} to security.needs.${a} or to csp.${o} for this route.`
|
|
2843
|
+
);
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
function Vs(e, t) {
|
|
2848
|
+
return e.includes("'none'") ? !1 : e.includes("*") || e.includes(t) ? !0 : t.startsWith("'") ? !1 : e.some((r) => Js(r, t));
|
|
2849
|
+
}
|
|
2850
|
+
function Js(e, t) {
|
|
2851
|
+
if (e.startsWith("'"))
|
|
2852
|
+
return !1;
|
|
2853
|
+
let r;
|
|
2854
|
+
try {
|
|
2855
|
+
r = new URL(t);
|
|
2856
|
+
} catch {
|
|
2857
|
+
return !1;
|
|
2858
|
+
}
|
|
2859
|
+
if (e === `${r.protocol}`)
|
|
2860
|
+
return !0;
|
|
2861
|
+
let n;
|
|
2862
|
+
try {
|
|
2863
|
+
n = new URL(e);
|
|
2864
|
+
} catch {
|
|
2865
|
+
return !1;
|
|
2866
|
+
}
|
|
2867
|
+
if (n.protocol !== r.protocol || n.port !== r.port)
|
|
2868
|
+
return !1;
|
|
2869
|
+
if (n.hostname.startsWith("*.")) {
|
|
2870
|
+
const s = n.hostname.slice(1);
|
|
2871
|
+
return r.hostname.endsWith(s) && r.hostname !== n.hostname.slice(2);
|
|
2872
|
+
}
|
|
2873
|
+
return n.hostname === r.hostname;
|
|
2874
|
+
}
|
|
2875
|
+
function Je(e, t, r, n) {
|
|
2876
|
+
z(e, t, "effective document", () => {
|
|
2877
|
+
q(r.document ?? {}, {
|
|
2746
2878
|
nonce: "startup-verification-nonce"
|
|
2747
2879
|
});
|
|
2748
|
-
}), !(!n || !
|
|
2749
|
-
|
|
2880
|
+
}), !(!n || !ne(r.document)) && z(e, t, "effective CSP", () => {
|
|
2881
|
+
Wt(n, ["nonceInjection"]);
|
|
2750
2882
|
});
|
|
2751
2883
|
}
|
|
2752
|
-
function
|
|
2884
|
+
function Ks(e, t, r) {
|
|
2753
2885
|
if (t === "static") {
|
|
2754
|
-
const s =
|
|
2886
|
+
const s = Ys(r?.csp);
|
|
2755
2887
|
if (s)
|
|
2756
2888
|
throw new Error(
|
|
2757
2889
|
`Route ${JSON.stringify(e)} uses render mode "static" with an effective ${s} directive that depends on a CSP nonce. Use security.static() for static output or remove the nonce source from the document policy.`
|
|
@@ -2760,76 +2892,76 @@ function $s(e, t, r) {
|
|
|
2760
2892
|
}
|
|
2761
2893
|
if (t !== "streaming")
|
|
2762
2894
|
return;
|
|
2763
|
-
const n =
|
|
2764
|
-
if (!(!n ||
|
|
2895
|
+
const n = Zs(r?.csp);
|
|
2896
|
+
if (!(!n || Qs(n.sources)))
|
|
2765
2897
|
throw new Error(
|
|
2766
2898
|
`Route ${JSON.stringify(e)} uses render mode "streaming" with an effective ${n.name} directive that does not allow React runtime inline payload scripts. Add a nonce placeholder or allow 'unsafe-inline' without nonce or hash sources.`
|
|
2767
2899
|
);
|
|
2768
2900
|
}
|
|
2769
|
-
function
|
|
2901
|
+
function Ys(e) {
|
|
2770
2902
|
if (e)
|
|
2771
2903
|
for (const [t, r] of Object.entries(e)) {
|
|
2772
|
-
const n =
|
|
2773
|
-
if (Array.isArray(n) && n.some((s) =>
|
|
2774
|
-
return
|
|
2904
|
+
const n = W(r);
|
|
2905
|
+
if (Array.isArray(n) && n.some((s) => Xs(s)))
|
|
2906
|
+
return to(t);
|
|
2775
2907
|
}
|
|
2776
2908
|
}
|
|
2777
|
-
function
|
|
2909
|
+
function Zs(e) {
|
|
2778
2910
|
if (!e)
|
|
2779
2911
|
return;
|
|
2780
|
-
const t =
|
|
2912
|
+
const t = W(e.scriptSrc);
|
|
2781
2913
|
if (Array.isArray(t))
|
|
2782
2914
|
return { name: "script-src", sources: t };
|
|
2783
|
-
const r =
|
|
2915
|
+
const r = W(e.defaultSrc);
|
|
2784
2916
|
if (Array.isArray(r))
|
|
2785
2917
|
return { name: "default-src", sources: r };
|
|
2786
2918
|
}
|
|
2787
|
-
function
|
|
2788
|
-
return e.some((t) =>
|
|
2919
|
+
function Qs(e) {
|
|
2920
|
+
return e.some((t) => Dt(t)) ? !0 : e.includes("'unsafe-inline'") && !e.some((t) => eo(t));
|
|
2789
2921
|
}
|
|
2790
|
-
function
|
|
2791
|
-
return
|
|
2922
|
+
function Xs(e) {
|
|
2923
|
+
return Dt(e) || /^'nonce-[^']*'$/i.test(e);
|
|
2792
2924
|
}
|
|
2793
|
-
function
|
|
2925
|
+
function Dt(e) {
|
|
2794
2926
|
return e.includes("{nonce}");
|
|
2795
2927
|
}
|
|
2796
|
-
function
|
|
2928
|
+
function eo(e) {
|
|
2797
2929
|
return /^'(?:nonce-|sha256-|sha384-|sha512-)/i.test(e);
|
|
2798
2930
|
}
|
|
2799
|
-
function
|
|
2931
|
+
function W(e) {
|
|
2800
2932
|
return e && typeof e == "object" && !Array.isArray(e) && "replace" in e ? e.replace : e;
|
|
2801
2933
|
}
|
|
2802
|
-
function
|
|
2934
|
+
function to(e) {
|
|
2803
2935
|
return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
|
|
2804
2936
|
}
|
|
2805
|
-
function
|
|
2937
|
+
function z(e, t, r, n) {
|
|
2806
2938
|
try {
|
|
2807
2939
|
n();
|
|
2808
2940
|
} catch (s) {
|
|
2809
2941
|
if (s instanceof Error && s.message.startsWith(`Route ${JSON.stringify(e)} export `))
|
|
2810
2942
|
throw s;
|
|
2811
|
-
const
|
|
2943
|
+
const o = s instanceof Error ? s.message : `${r} validation failed.`;
|
|
2812
2944
|
throw new Error(
|
|
2813
|
-
`Route ${JSON.stringify(e)} export ${t} has an invalid ${r} policy. ${
|
|
2945
|
+
`Route ${JSON.stringify(e)} export ${t} has an invalid ${r} policy. ${o}`,
|
|
2814
2946
|
{ cause: s }
|
|
2815
2947
|
);
|
|
2816
2948
|
}
|
|
2817
2949
|
}
|
|
2818
|
-
function
|
|
2819
|
-
return
|
|
2950
|
+
function ro(e) {
|
|
2951
|
+
return Z({
|
|
2820
2952
|
instance: `${e.pathname}${e.search}`,
|
|
2821
2953
|
status: 404,
|
|
2822
2954
|
title: "Not Found"
|
|
2823
2955
|
});
|
|
2824
2956
|
}
|
|
2825
|
-
async function
|
|
2957
|
+
async function ye(e, t, r = {}) {
|
|
2826
2958
|
const n = new URL(t.url);
|
|
2827
|
-
if (!
|
|
2828
|
-
return
|
|
2829
|
-
const s = await
|
|
2959
|
+
if (!dt(t))
|
|
2960
|
+
return ro(n);
|
|
2961
|
+
const s = await pe(e, n.pathname, {
|
|
2830
2962
|
onLayoutError: (u) => r.onError?.(u, "page")
|
|
2831
|
-
}),
|
|
2832
|
-
nonce:
|
|
2963
|
+
}), o = await no(e, n.pathname), i = r.nonce ?? (ne(o) ? yt() : void 0), a = so(s, { ...r, nonce: i }), c = q(o ?? {}, {
|
|
2964
|
+
nonce: i,
|
|
2833
2965
|
request: t
|
|
2834
2966
|
});
|
|
2835
2967
|
return c.set("content-type", "text/html; charset=utf-8"), new Response(
|
|
@@ -2840,55 +2972,55 @@ async function pe(e, t, r = {}) {
|
|
|
2840
2972
|
}
|
|
2841
2973
|
);
|
|
2842
2974
|
}
|
|
2843
|
-
async function
|
|
2975
|
+
async function no(e, t) {
|
|
2844
2976
|
const r = await Promise.all(
|
|
2845
|
-
|
|
2977
|
+
fr(e, t).map((n) => n.load())
|
|
2846
2978
|
);
|
|
2847
|
-
return
|
|
2979
|
+
return X(...r.map((n) => n.policy)).document;
|
|
2848
2980
|
}
|
|
2849
|
-
function
|
|
2850
|
-
const r = e.notFound ??
|
|
2981
|
+
function so(e, t = {}) {
|
|
2982
|
+
const r = e.notFound ?? He;
|
|
2851
2983
|
try {
|
|
2852
|
-
return
|
|
2984
|
+
return fe(e, r, e.layouts, t);
|
|
2853
2985
|
} catch (n) {
|
|
2854
2986
|
t.onError?.(n, "page");
|
|
2855
2987
|
}
|
|
2856
2988
|
try {
|
|
2857
|
-
return
|
|
2989
|
+
return fe(e, r, [], t);
|
|
2858
2990
|
} catch (n) {
|
|
2859
2991
|
t.onError?.(n, "page");
|
|
2860
2992
|
}
|
|
2861
|
-
return
|
|
2993
|
+
return fe(e, He, [], t);
|
|
2862
2994
|
}
|
|
2863
|
-
function
|
|
2995
|
+
function fe(e, t, r, n) {
|
|
2864
2996
|
const s = r.reduceRight(
|
|
2865
|
-
(
|
|
2866
|
-
children:
|
|
2997
|
+
(i, a) => de(a, {
|
|
2998
|
+
children: i,
|
|
2867
2999
|
path: {},
|
|
2868
3000
|
pathname: e.pathname
|
|
2869
3001
|
}),
|
|
2870
|
-
|
|
2871
|
-
),
|
|
3002
|
+
de(t, { pathname: e.pathname })
|
|
3003
|
+
), o = Qe({
|
|
2872
3004
|
dev: n.dev,
|
|
2873
3005
|
nonce: n.nonce
|
|
2874
3006
|
});
|
|
2875
|
-
return
|
|
3007
|
+
return et({
|
|
2876
3008
|
body: {
|
|
2877
3009
|
data: void 0,
|
|
2878
3010
|
fallback: "not-found",
|
|
2879
|
-
html:
|
|
3011
|
+
html: tt(Xe(o, s)),
|
|
2880
3012
|
navigation: n.navigation
|
|
2881
3013
|
},
|
|
2882
3014
|
entrySrc: n.clientEntry,
|
|
2883
3015
|
lang: n.lang,
|
|
2884
3016
|
metadata: e.metadata,
|
|
2885
3017
|
nonce: n.nonce,
|
|
2886
|
-
scripts:
|
|
3018
|
+
scripts: o.scripts(),
|
|
2887
3019
|
styles: n.styles,
|
|
2888
3020
|
title: n.title
|
|
2889
3021
|
});
|
|
2890
3022
|
}
|
|
2891
|
-
const
|
|
3023
|
+
const $t = [
|
|
2892
3024
|
"GET",
|
|
2893
3025
|
"POST",
|
|
2894
3026
|
"PUT",
|
|
@@ -2896,12 +3028,12 @@ const xt = [
|
|
|
2896
3028
|
"DELETE",
|
|
2897
3029
|
"OPTIONS",
|
|
2898
3030
|
"HEAD"
|
|
2899
|
-
],
|
|
2900
|
-
function
|
|
2901
|
-
e.routeModules &&
|
|
2902
|
-
const t =
|
|
2903
|
-
return e.cacheStore &&
|
|
2904
|
-
return await
|
|
3031
|
+
], kt = At();
|
|
3032
|
+
function Yo(e) {
|
|
3033
|
+
e.routeModules && Us(e.routeModules, { adapter: e.adapter });
|
|
3034
|
+
const t = ot(e.routes), r = e.rateLimitStore ?? At();
|
|
3035
|
+
return e.cacheStore && nt(e.cacheStore.namespace), async function(s) {
|
|
3036
|
+
return await oo(t, s, {
|
|
2905
3037
|
cacheStore: e.cacheStore,
|
|
2906
3038
|
onError: e.onError,
|
|
2907
3039
|
rateLimitStore: r,
|
|
@@ -2910,31 +3042,31 @@ function Oi(e) {
|
|
|
2910
3042
|
});
|
|
2911
3043
|
};
|
|
2912
3044
|
}
|
|
2913
|
-
async function
|
|
2914
|
-
rateLimitStore:
|
|
3045
|
+
async function oo(e, t, r = {
|
|
3046
|
+
rateLimitStore: kt
|
|
2915
3047
|
}) {
|
|
2916
|
-
const n = new URL(t.url), s =
|
|
2917
|
-
let
|
|
3048
|
+
const n = new URL(t.url), s = co(n, r), o = ut(t);
|
|
3049
|
+
let i;
|
|
2918
3050
|
try {
|
|
2919
|
-
|
|
3051
|
+
i = B(e.routes, n.pathname);
|
|
2920
3052
|
} catch (a) {
|
|
2921
|
-
if (!(a instanceof
|
|
3053
|
+
if (!(a instanceof Te))
|
|
2922
3054
|
throw a;
|
|
2923
|
-
const c =
|
|
3055
|
+
const c = Z({
|
|
2924
3056
|
instance: `${n.pathname}${n.search}`,
|
|
2925
3057
|
status: 400,
|
|
2926
3058
|
title: "Bad Request"
|
|
2927
3059
|
});
|
|
2928
|
-
return
|
|
3060
|
+
return o ? _(c, ae) : c;
|
|
2929
3061
|
}
|
|
2930
|
-
if (!
|
|
3062
|
+
if (!i)
|
|
2931
3063
|
try {
|
|
2932
|
-
const a = await
|
|
3064
|
+
const a = await ye(
|
|
2933
3065
|
e,
|
|
2934
3066
|
t,
|
|
2935
3067
|
s
|
|
2936
3068
|
);
|
|
2937
|
-
return
|
|
3069
|
+
return o ? _(a, Fe) : a;
|
|
2938
3070
|
} catch (a) {
|
|
2939
3071
|
return s.onError(a, "page"), new Response("Not Found", {
|
|
2940
3072
|
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
@@ -2942,194 +3074,217 @@ async function Ws(e, t, r = {
|
|
|
2942
3074
|
});
|
|
2943
3075
|
}
|
|
2944
3076
|
try {
|
|
2945
|
-
const a = await
|
|
3077
|
+
const a = await io(
|
|
2946
3078
|
e,
|
|
2947
3079
|
t,
|
|
2948
3080
|
n,
|
|
2949
|
-
|
|
3081
|
+
i,
|
|
2950
3082
|
r,
|
|
2951
3083
|
s
|
|
2952
3084
|
);
|
|
2953
|
-
return
|
|
3085
|
+
return o && !a.headers.has(C) ? _(
|
|
2954
3086
|
a,
|
|
2955
|
-
a.status === 404 ?
|
|
3087
|
+
a.status === 404 ? Fe : ae
|
|
2956
3088
|
) : a;
|
|
2957
3089
|
} catch (a) {
|
|
2958
|
-
const c = await
|
|
3090
|
+
const c = await Y(
|
|
2959
3091
|
e,
|
|
2960
3092
|
t,
|
|
2961
3093
|
a,
|
|
2962
3094
|
"middleware",
|
|
2963
3095
|
s
|
|
2964
3096
|
);
|
|
2965
|
-
return
|
|
3097
|
+
return o ? _(c, ae) : c;
|
|
2966
3098
|
}
|
|
2967
3099
|
}
|
|
2968
|
-
async function
|
|
2969
|
-
const
|
|
3100
|
+
async function io(e, t, r, n, s, o) {
|
|
3101
|
+
const i = await n.route.load();
|
|
2970
3102
|
if (t.method.toUpperCase() === "OPTIONS") {
|
|
2971
|
-
const
|
|
2972
|
-
if (
|
|
2973
|
-
return
|
|
3103
|
+
const p = Nn(i, t);
|
|
3104
|
+
if (p)
|
|
3105
|
+
return p;
|
|
2974
3106
|
}
|
|
2975
|
-
const a =
|
|
3107
|
+
const a = ho(t.method);
|
|
2976
3108
|
if (!a)
|
|
2977
|
-
return
|
|
2978
|
-
const c =
|
|
3109
|
+
return Ze(i);
|
|
3110
|
+
const c = mo(i, a);
|
|
2979
3111
|
if (!c)
|
|
2980
|
-
return
|
|
2981
|
-
const u = await
|
|
3112
|
+
return Ze(i);
|
|
3113
|
+
const u = await lo(
|
|
2982
3114
|
e,
|
|
2983
3115
|
n.route,
|
|
2984
|
-
|
|
3116
|
+
i,
|
|
2985
3117
|
c
|
|
2986
|
-
),
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
3118
|
+
), l = u.security, f = ys(
|
|
3119
|
+
l?.fetchMetadata,
|
|
3120
|
+
t,
|
|
3121
|
+
a
|
|
3122
|
+
), h = (p) => xt(p, f.vary);
|
|
3123
|
+
if (f.response)
|
|
3124
|
+
return h(
|
|
3125
|
+
U(
|
|
3126
|
+
f.response,
|
|
3127
|
+
J(c),
|
|
3128
|
+
t
|
|
3129
|
+
)
|
|
3130
|
+
);
|
|
3131
|
+
const d = as(l?.csrf, t);
|
|
3132
|
+
if (d)
|
|
3133
|
+
return h(
|
|
3134
|
+
U(d, J(c), t)
|
|
3135
|
+
);
|
|
3136
|
+
const D = await Ts(
|
|
3137
|
+
l?.rateLimit,
|
|
2991
3138
|
t,
|
|
2992
|
-
s.rateLimitStore ??
|
|
3139
|
+
s.rateLimitStore ?? kt
|
|
2993
3140
|
);
|
|
2994
|
-
if (
|
|
2995
|
-
return
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3141
|
+
if (D)
|
|
3142
|
+
return h(
|
|
3143
|
+
U(
|
|
3144
|
+
D,
|
|
3145
|
+
J(c),
|
|
3146
|
+
t
|
|
3147
|
+
)
|
|
2999
3148
|
);
|
|
3000
|
-
const
|
|
3001
|
-
|
|
3149
|
+
const $ = $s(
|
|
3150
|
+
l?.request,
|
|
3002
3151
|
t,
|
|
3003
3152
|
a
|
|
3004
3153
|
);
|
|
3005
|
-
if (
|
|
3006
|
-
return
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3154
|
+
if ($)
|
|
3155
|
+
return h(
|
|
3156
|
+
U(
|
|
3157
|
+
$,
|
|
3158
|
+
J(c),
|
|
3159
|
+
t
|
|
3160
|
+
)
|
|
3010
3161
|
);
|
|
3011
|
-
t =
|
|
3012
|
-
const
|
|
3162
|
+
t = ks(l?.request, t);
|
|
3163
|
+
const m = {};
|
|
3013
3164
|
if (c.kind === "page") {
|
|
3014
|
-
const
|
|
3165
|
+
const p = {
|
|
3015
3166
|
path: n.path,
|
|
3016
3167
|
pathname: r.pathname,
|
|
3017
3168
|
request: t,
|
|
3018
|
-
context:
|
|
3169
|
+
context: m,
|
|
3019
3170
|
search: r.searchParams,
|
|
3020
3171
|
url: r
|
|
3021
|
-
},
|
|
3172
|
+
}, Nt = await Ke(
|
|
3022
3173
|
e,
|
|
3023
3174
|
n.route
|
|
3024
|
-
),
|
|
3025
|
-
let
|
|
3175
|
+
), O = ne(u.document) ? yt() : void 0, Ot = ao(s.cacheStore);
|
|
3176
|
+
let y;
|
|
3026
3177
|
try {
|
|
3027
|
-
|
|
3178
|
+
y = await Ye(Nt, p, async () => {
|
|
3028
3179
|
try {
|
|
3029
|
-
const
|
|
3180
|
+
const g = await it(
|
|
3030
3181
|
e,
|
|
3031
3182
|
r.pathname,
|
|
3032
3183
|
t,
|
|
3033
3184
|
void 0,
|
|
3034
|
-
|
|
3035
|
-
{ requestContext:
|
|
3185
|
+
Ot,
|
|
3186
|
+
{ requestContext: m }
|
|
3036
3187
|
);
|
|
3037
|
-
if (
|
|
3038
|
-
return await
|
|
3039
|
-
...
|
|
3040
|
-
nonce:
|
|
3188
|
+
if (g.status !== "ready")
|
|
3189
|
+
return await ye(e, t, {
|
|
3190
|
+
...o,
|
|
3191
|
+
nonce: O
|
|
3041
3192
|
});
|
|
3042
|
-
if (
|
|
3043
|
-
return
|
|
3044
|
-
if (
|
|
3193
|
+
if (ut(t))
|
|
3194
|
+
return br(g.match.data);
|
|
3195
|
+
if (g.match.render.mode === "streaming" && !s.renderPage)
|
|
3045
3196
|
throw new Error(
|
|
3046
3197
|
"Streaming page routes require an adapter renderer. Pass renderNodePageResponse from @demiurgejs/core/node as createRequestHandler({ renderPage })."
|
|
3047
3198
|
);
|
|
3048
|
-
return await (s.renderPage ??
|
|
3199
|
+
return await (s.renderPage ?? zt)(g.match, {
|
|
3049
3200
|
...s.ssr,
|
|
3050
3201
|
dev: s.dev,
|
|
3051
|
-
nonce:
|
|
3052
|
-
onStreamError: (
|
|
3053
|
-
s.onError?.(
|
|
3202
|
+
nonce: O,
|
|
3203
|
+
onStreamError: (Mt) => {
|
|
3204
|
+
s.onError?.(Mt, {
|
|
3054
3205
|
pathname: r.pathname,
|
|
3055
3206
|
site: "page"
|
|
3056
3207
|
});
|
|
3057
3208
|
},
|
|
3058
3209
|
signal: t.signal
|
|
3059
3210
|
});
|
|
3060
|
-
} catch (
|
|
3061
|
-
return
|
|
3062
|
-
...
|
|
3063
|
-
nonce:
|
|
3211
|
+
} catch (g) {
|
|
3212
|
+
return g instanceof F ? V() : await Y(e, t, g, "page", {
|
|
3213
|
+
...o,
|
|
3214
|
+
nonce: O
|
|
3064
3215
|
});
|
|
3065
3216
|
}
|
|
3066
3217
|
});
|
|
3067
|
-
} catch (
|
|
3068
|
-
if (!(
|
|
3069
|
-
throw
|
|
3070
|
-
|
|
3218
|
+
} catch (g) {
|
|
3219
|
+
if (!(g instanceof F))
|
|
3220
|
+
throw g;
|
|
3221
|
+
y = V();
|
|
3071
3222
|
}
|
|
3072
|
-
const
|
|
3073
|
-
nonce:
|
|
3223
|
+
const Lt = q(u.document ?? {}, {
|
|
3224
|
+
nonce: O,
|
|
3074
3225
|
request: t
|
|
3075
3226
|
});
|
|
3076
|
-
for (const [
|
|
3077
|
-
|
|
3078
|
-
return
|
|
3079
|
-
headers:
|
|
3080
|
-
status:
|
|
3081
|
-
})) :
|
|
3082
|
-
}
|
|
3083
|
-
const
|
|
3227
|
+
for (const [g, ke] of Lt)
|
|
3228
|
+
y.headers.set(g, ke);
|
|
3229
|
+
return O && y.headers.set("cache-control", "private, no-store"), h(y), a === "HEAD" ? (await y.body?.cancel(), new Response(null, {
|
|
3230
|
+
headers: y.headers,
|
|
3231
|
+
status: y.status
|
|
3232
|
+
})) : y;
|
|
3233
|
+
}
|
|
3234
|
+
const k = {
|
|
3084
3235
|
path: n.path,
|
|
3085
3236
|
pathname: r.pathname,
|
|
3086
3237
|
request: t,
|
|
3087
|
-
context:
|
|
3238
|
+
context: m,
|
|
3088
3239
|
search: r.searchParams,
|
|
3089
3240
|
url: r
|
|
3090
|
-
},
|
|
3241
|
+
}, $e = await Ke(
|
|
3091
3242
|
e,
|
|
3092
3243
|
n.route
|
|
3093
3244
|
);
|
|
3094
|
-
let
|
|
3245
|
+
let N;
|
|
3095
3246
|
try {
|
|
3096
|
-
|
|
3247
|
+
N = await Ye($e, k, async () => {
|
|
3097
3248
|
try {
|
|
3098
|
-
return c.kind === "not-found" && c.body === void 0 ?
|
|
3099
|
-
await
|
|
3249
|
+
return c.kind === "not-found" && c.body === void 0 ? uo(
|
|
3250
|
+
await ye(e, t, o),
|
|
3100
3251
|
c.init
|
|
3101
|
-
) : await
|
|
3102
|
-
} catch (
|
|
3103
|
-
return
|
|
3252
|
+
) : await Dr(c, k);
|
|
3253
|
+
} catch (p) {
|
|
3254
|
+
return p instanceof F ? V() : await Y(
|
|
3104
3255
|
e,
|
|
3105
3256
|
t,
|
|
3106
|
-
|
|
3257
|
+
p,
|
|
3107
3258
|
"route",
|
|
3108
|
-
|
|
3259
|
+
o
|
|
3109
3260
|
);
|
|
3110
3261
|
}
|
|
3111
3262
|
});
|
|
3112
|
-
} catch (
|
|
3113
|
-
if (!(
|
|
3114
|
-
throw
|
|
3115
|
-
|
|
3263
|
+
} catch (p) {
|
|
3264
|
+
if (!(p instanceof F))
|
|
3265
|
+
throw p;
|
|
3266
|
+
N = V();
|
|
3116
3267
|
}
|
|
3117
3268
|
try {
|
|
3118
|
-
return
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3269
|
+
return h(
|
|
3270
|
+
fo(N, c, t, a)
|
|
3271
|
+
);
|
|
3272
|
+
} catch (p) {
|
|
3273
|
+
return h(
|
|
3274
|
+
await Y(
|
|
3275
|
+
e,
|
|
3276
|
+
t,
|
|
3277
|
+
p,
|
|
3278
|
+
"route",
|
|
3279
|
+
o
|
|
3280
|
+
)
|
|
3126
3281
|
);
|
|
3127
3282
|
}
|
|
3128
3283
|
}
|
|
3129
|
-
function
|
|
3130
|
-
return e ?
|
|
3284
|
+
function ao(e) {
|
|
3285
|
+
return e ? rt(e) : we();
|
|
3131
3286
|
}
|
|
3132
|
-
function
|
|
3287
|
+
function co(e, t) {
|
|
3133
3288
|
return {
|
|
3134
3289
|
...t.ssr,
|
|
3135
3290
|
dev: t.dev,
|
|
@@ -3139,12 +3294,12 @@ function Bs(e, t) {
|
|
|
3139
3294
|
transformDocument: t.transformDocument
|
|
3140
3295
|
};
|
|
3141
3296
|
}
|
|
3142
|
-
function
|
|
3297
|
+
function uo(e, t) {
|
|
3143
3298
|
if (!t)
|
|
3144
3299
|
return e;
|
|
3145
3300
|
const r = new Headers(e.headers), n = new Headers(t.headers);
|
|
3146
|
-
for (const [s,
|
|
3147
|
-
s !== "set-cookie" && r.set(s,
|
|
3301
|
+
for (const [s, o] of n)
|
|
3302
|
+
s !== "set-cookie" && r.set(s, o);
|
|
3148
3303
|
for (const s of n.getSetCookie())
|
|
3149
3304
|
r.append("set-cookie", s);
|
|
3150
3305
|
return new Response(e.body, {
|
|
@@ -3153,21 +3308,21 @@ function Gs(e, t) {
|
|
|
3153
3308
|
statusText: t.statusText ?? e.statusText
|
|
3154
3309
|
});
|
|
3155
3310
|
}
|
|
3156
|
-
async function
|
|
3311
|
+
async function lo(e, t, r, n) {
|
|
3157
3312
|
const s = await Promise.all(
|
|
3158
3313
|
e.policies.filter(
|
|
3159
|
-
(
|
|
3160
|
-
).map((
|
|
3314
|
+
(o) => T(o.fileSegments, t.fileSegments)
|
|
3315
|
+
).map((o) => o.load())
|
|
3161
3316
|
);
|
|
3162
|
-
return
|
|
3163
|
-
...s.map((
|
|
3317
|
+
return X(
|
|
3318
|
+
...s.map((o) => o.policy),
|
|
3164
3319
|
r.policy,
|
|
3165
3320
|
{
|
|
3166
|
-
security: n.kind === "page" ? void 0 : n.security
|
|
3321
|
+
security: !n || n.kind === "page" ? void 0 : n.security
|
|
3167
3322
|
}
|
|
3168
3323
|
);
|
|
3169
3324
|
}
|
|
3170
|
-
async function
|
|
3325
|
+
async function Ke(e, t) {
|
|
3171
3326
|
return (await Promise.all(
|
|
3172
3327
|
e.middlewares.filter(
|
|
3173
3328
|
(n) => T(n.fileSegments, t.fileSegments)
|
|
@@ -3176,20 +3331,20 @@ async function Ge(e, t) {
|
|
|
3176
3331
|
(n) => n.middleware ? [n.middleware] : []
|
|
3177
3332
|
);
|
|
3178
3333
|
}
|
|
3179
|
-
async function
|
|
3334
|
+
async function Ye(e, t, r) {
|
|
3180
3335
|
let n = -1;
|
|
3181
|
-
async function s(
|
|
3182
|
-
if (
|
|
3336
|
+
async function s(o) {
|
|
3337
|
+
if (o <= n)
|
|
3183
3338
|
throw new Error("Demiurge route middleware next() called multiple times.");
|
|
3184
|
-
n =
|
|
3185
|
-
const
|
|
3186
|
-
return
|
|
3339
|
+
n = o;
|
|
3340
|
+
const i = e[o];
|
|
3341
|
+
return i ? await i(t, () => s(o + 1)) : await r();
|
|
3187
3342
|
}
|
|
3188
3343
|
return await s(0);
|
|
3189
3344
|
}
|
|
3190
|
-
function
|
|
3191
|
-
const s =
|
|
3192
|
-
|
|
3345
|
+
function fo(e, t, r, n) {
|
|
3346
|
+
const s = Hr(
|
|
3347
|
+
U(e, t.cors, r),
|
|
3193
3348
|
t.timing
|
|
3194
3349
|
);
|
|
3195
3350
|
return n === "HEAD" ? new Response(null, {
|
|
@@ -3198,117 +3353,123 @@ function Vs(e, t, r, n) {
|
|
|
3198
3353
|
statusText: s.statusText
|
|
3199
3354
|
}) : s;
|
|
3200
3355
|
}
|
|
3201
|
-
function
|
|
3356
|
+
function J(e) {
|
|
3202
3357
|
return e.kind === "page" ? void 0 : e.cors;
|
|
3203
3358
|
}
|
|
3204
|
-
function
|
|
3359
|
+
function ho(e) {
|
|
3205
3360
|
const t = e.toUpperCase();
|
|
3206
|
-
return
|
|
3361
|
+
return $t.includes(t) ? t : null;
|
|
3207
3362
|
}
|
|
3208
|
-
function
|
|
3363
|
+
function mo(e, t) {
|
|
3209
3364
|
return t === "HEAD" ? e.HEAD ?? e.GET : e[t];
|
|
3210
3365
|
}
|
|
3211
|
-
function
|
|
3366
|
+
function Ze(e) {
|
|
3212
3367
|
return new Response(null, {
|
|
3213
3368
|
headers: {
|
|
3214
|
-
allow:
|
|
3369
|
+
allow: po(e).join(", ")
|
|
3215
3370
|
},
|
|
3216
3371
|
status: 405
|
|
3217
3372
|
});
|
|
3218
3373
|
}
|
|
3219
|
-
function
|
|
3220
|
-
const t =
|
|
3374
|
+
function po(e) {
|
|
3375
|
+
const t = $t.filter((r) => e[r]);
|
|
3221
3376
|
return e.GET && !t.includes("HEAD") && t.push("HEAD"), t;
|
|
3222
3377
|
}
|
|
3223
3378
|
export {
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3379
|
+
is as $,
|
|
3380
|
+
Wo as A,
|
|
3381
|
+
Dr as B,
|
|
3382
|
+
cs as C,
|
|
3383
|
+
ks as D,
|
|
3384
|
+
Ct as E,
|
|
3385
|
+
Tr as F,
|
|
3386
|
+
ko as G,
|
|
3387
|
+
cr as H,
|
|
3388
|
+
vr as I,
|
|
3389
|
+
Rr as J,
|
|
3390
|
+
Fe as K,
|
|
3391
|
+
ae as L,
|
|
3392
|
+
Te as M,
|
|
3238
3393
|
C as N,
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3394
|
+
Gr as O,
|
|
3395
|
+
Go as P,
|
|
3396
|
+
He as Q,
|
|
3397
|
+
F as R,
|
|
3398
|
+
Ae as S,
|
|
3399
|
+
A as T,
|
|
3400
|
+
lt as U,
|
|
3401
|
+
xt as V,
|
|
3402
|
+
zn as W,
|
|
3403
|
+
vo as X,
|
|
3404
|
+
gs as Y,
|
|
3405
|
+
rt as Z,
|
|
3406
|
+
Rt as _,
|
|
3407
|
+
Us as a,
|
|
3408
|
+
os as a0,
|
|
3409
|
+
xo as a1,
|
|
3410
|
+
_t as a2,
|
|
3411
|
+
We as a3,
|
|
3412
|
+
Ao as a4,
|
|
3413
|
+
Vo as a5,
|
|
3414
|
+
_o as a6,
|
|
3415
|
+
To as a7,
|
|
3416
|
+
Ns as a8,
|
|
3417
|
+
as as a9,
|
|
3418
|
+
No as aA,
|
|
3419
|
+
hr as aB,
|
|
3420
|
+
Er as aC,
|
|
3421
|
+
re as aD,
|
|
3422
|
+
v as aE,
|
|
3423
|
+
ys as aa,
|
|
3424
|
+
Ts as ab,
|
|
3425
|
+
$s as ac,
|
|
3426
|
+
Fo as ad,
|
|
3427
|
+
Ro as ae,
|
|
3428
|
+
Ko as af,
|
|
3429
|
+
Mo as ag,
|
|
3430
|
+
Io as ah,
|
|
3431
|
+
Co as ai,
|
|
3432
|
+
X as aj,
|
|
3433
|
+
dn as ak,
|
|
3434
|
+
Po as al,
|
|
3435
|
+
jo as am,
|
|
3436
|
+
Pt as an,
|
|
3437
|
+
Eo as ao,
|
|
3438
|
+
Ho as ap,
|
|
3439
|
+
R as aq,
|
|
3440
|
+
nt as ar,
|
|
3441
|
+
qo as as,
|
|
3442
|
+
Bo as at,
|
|
3443
|
+
zo as au,
|
|
3444
|
+
Do as av,
|
|
3445
|
+
bo as aw,
|
|
3446
|
+
Uo as ax,
|
|
3447
|
+
Oo as ay,
|
|
3448
|
+
Lo as az,
|
|
3449
|
+
$o as b,
|
|
3450
|
+
Yo as c,
|
|
3451
|
+
At as d,
|
|
3452
|
+
Jo as e,
|
|
3453
|
+
q as f,
|
|
3454
|
+
De as g,
|
|
3455
|
+
oo as h,
|
|
3456
|
+
it as i,
|
|
3457
|
+
T as j,
|
|
3458
|
+
te as k,
|
|
3459
|
+
lo as l,
|
|
3460
|
+
fn as m,
|
|
3461
|
+
B as n,
|
|
3462
|
+
ne as o,
|
|
3463
|
+
yt as p,
|
|
3464
|
+
jn as q,
|
|
3465
|
+
ye as r,
|
|
3466
|
+
L as s,
|
|
3467
|
+
mr as t,
|
|
3468
|
+
we as u,
|
|
3469
|
+
Ce as v,
|
|
3470
|
+
he as w,
|
|
3471
|
+
Le as x,
|
|
3472
|
+
ot as y,
|
|
3473
|
+
P as z
|
|
3313
3474
|
};
|
|
3314
|
-
//# sourceMappingURL=testing-
|
|
3475
|
+
//# sourceMappingURL=testing-CRflAw4X.js.map
|