@tdacorp/hyle-sdk 0.2.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +105 -4
  2. package/bin/hyle-sdk-check-routes.mjs +3 -0
  3. package/dist/check-routes-bin.js +389 -0
  4. package/dist/chunk-4OB77ZOD.js +455 -0
  5. package/dist/chunk-BUJFMR3M.js +38 -0
  6. package/dist/{chunk-7VCMJUPC.js → chunk-OW6S7IZX.js} +1 -1
  7. package/dist/{chunk-MHVWHSKC.js → chunk-SO6H2UGL.js} +124 -6
  8. package/dist/diagram-viewer-DYX6R63Y.js +1132 -0
  9. package/dist/index.cjs +191 -20
  10. package/dist/index.d.cts +95 -3
  11. package/dist/index.d.ts +95 -3
  12. package/dist/index.js +13 -1
  13. package/dist/mermaid-diagram.cjs +1395 -0
  14. package/dist/mermaid-diagram.d.cts +55 -0
  15. package/dist/mermaid-diagram.d.ts +55 -0
  16. package/dist/mermaid-diagram.js +140 -0
  17. package/dist/next.cjs +286 -27
  18. package/dist/next.d.cts +51 -5
  19. package/dist/next.d.ts +51 -5
  20. package/dist/next.js +131 -5
  21. package/dist/react.cjs +124 -5
  22. package/dist/react.d.cts +60 -4
  23. package/dist/react.d.ts +60 -4
  24. package/dist/react.js +3 -1
  25. package/dist/{resolve-fMx2W8RR.d.ts → resolve-1rQntRBh.d.ts} +1 -1
  26. package/dist/{resolve-B_p0p4Zn.d.cts → resolve-36-Ng1H0.d.cts} +1 -1
  27. package/dist/styles.css +82 -1
  28. package/dist/{types-BNaGecO7.d.ts → types-BoyBWF2F.d.ts} +3 -1
  29. package/dist/{types-DjXf6iPo.d.cts → types-CwBCPh6K.d.cts} +20 -1
  30. package/dist/{types-DjXf6iPo.d.ts → types-CwBCPh6K.d.ts} +20 -1
  31. package/dist/{types-DLWvqanV.d.cts → types-DnPzhrFx.d.cts} +3 -1
  32. package/dist/use-cache.cjs +34 -20
  33. package/dist/use-cache.d.cts +2 -2
  34. package/dist/use-cache.d.ts +2 -2
  35. package/dist/use-cache.js +2 -2
  36. package/package.json +8 -3
  37. package/dist/chunk-HFUJRNFP.js +0 -290
@@ -0,0 +1,455 @@
1
+ // src/errors.ts
2
+ var Cp1ClientError = class extends Error {
3
+ code;
4
+ status;
5
+ requestId;
6
+ details;
7
+ constructor(code, message, status, requestId, details) {
8
+ super(message);
9
+ this.name = "Cp1ClientError";
10
+ this.code = code;
11
+ this.status = status;
12
+ this.requestId = requestId;
13
+ this.details = details;
14
+ }
15
+ };
16
+
17
+ // src/client.ts
18
+ var DEFAULT_TIMEOUT_MS = 1e4;
19
+ var DEFAULT_MAX_RESPONSE_BYTES = 5 * 1024 * 1024;
20
+ var LOOPBACK = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
21
+ async function readCapped(res, max) {
22
+ const tooLarge = () => new Cp1ClientError("RESPONSE_TOO_LARGE", `hyle response exceeds ${max} bytes`, res.status, "");
23
+ if (Number(res.headers.get("content-length")) > max) throw tooLarge();
24
+ if (!res.body) return "";
25
+ const reader = res.body.getReader();
26
+ const chunks = [];
27
+ let total = 0;
28
+ for (; ; ) {
29
+ const { done, value } = await reader.read();
30
+ if (done) break;
31
+ total += value.byteLength;
32
+ if (total > max) {
33
+ await reader.cancel();
34
+ throw tooLarge();
35
+ }
36
+ chunks.push(value);
37
+ }
38
+ return Buffer.concat(chunks).toString("utf8");
39
+ }
40
+ var KINDS = /* @__PURE__ */ new Set(["article", "list", "redirect", "notfound", "disabled"]);
41
+ var isStrings = (value) => Array.isArray(value) && value.every((v) => typeof v === "string");
42
+ function isMounts(data) {
43
+ const mounts = data.mounts;
44
+ return typeof data.workspace_id === "string" && isStrings(data.reserved) && isStrings(data.supported_locales) && Array.isArray(mounts) && mounts.every((m) => typeof m?.prefix === "string" && typeof m.default_section === "string");
45
+ }
46
+ function createHyleClient(options) {
47
+ let origin;
48
+ try {
49
+ origin = new URL(options.baseUrl);
50
+ } catch {
51
+ throw new TypeError("baseUrl must be an https origin");
52
+ }
53
+ if (origin.protocol !== "https:" && !(origin.protocol === "http:" && (options.allowInsecureHttp || LOOPBACK.has(origin.hostname)))) {
54
+ throw new TypeError("baseUrl must be https (http is allowed only for localhost, or with allowInsecureHttp)");
55
+ }
56
+ if (!options.token) throw new TypeError("token is required");
57
+ const base = options.baseUrl.replace(/\/+$/, "");
58
+ const fetchImpl = options.fetch ?? fetch;
59
+ async function get(pathname, query, init) {
60
+ const url = new URL(`${base}${pathname}`);
61
+ url.search = query.toString();
62
+ const headers = new Headers(init?.headers);
63
+ headers.set("authorization", `Bearer ${options.token}`);
64
+ const timeout = AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
65
+ const signal = init?.signal ? AbortSignal.any([init.signal, timeout]) : timeout;
66
+ const res = await fetchImpl(url.toString(), { ...init, method: "GET", headers, redirect: "error", signal });
67
+ const text = await readCapped(res, options.maxResponseBytes ?? DEFAULT_MAX_RESPONSE_BYTES);
68
+ let parsed;
69
+ try {
70
+ parsed = JSON.parse(text);
71
+ } catch {
72
+ parsed = void 0;
73
+ }
74
+ return { parsed, status: res.status };
75
+ }
76
+ const failure = ({ parsed, status }) => {
77
+ const err = parsed?.error;
78
+ return new Cp1ClientError(err?.code ?? "INVALID_RESPONSE", err?.message ?? `Unexpected response from hyle (HTTP ${status})`, status, err?.request_id ?? "", err?.details);
79
+ };
80
+ async function resolve(opts) {
81
+ const query = new URLSearchParams({ path: opts.path });
82
+ if (opts.locale !== void 0) query.set("locale", opts.locale);
83
+ if (opts.format !== void 0) query.set("format", opts.format);
84
+ if (opts.cursor !== void 0) query.set("cursor", opts.cursor);
85
+ if (opts.limit !== void 0) query.set("limit", String(opts.limit));
86
+ const reply = await get("/cp1/read/resolve", query, opts.init);
87
+ const data = reply.parsed?.data;
88
+ if (data && data.cp === 1 && typeof data.kind === "string" && KINDS.has(data.kind)) return data;
89
+ throw failure(reply);
90
+ }
91
+ async function mounts(opts = {}) {
92
+ const reply = await get("/cp1/read/mounts", new URLSearchParams(), opts.init);
93
+ const data = reply.parsed?.data;
94
+ if (data?.cp === 1 && data.kind === "disabled") return data;
95
+ if (data?.cp === 1 && data.kind === "mounts" && isMounts(data)) return data;
96
+ throw failure(reply);
97
+ }
98
+ return { resolve, mounts };
99
+ }
100
+
101
+ // src/delivery-dedupe.ts
102
+ var DeliveryDedupe = class {
103
+ constructor(capacity = 1e3) {
104
+ this.capacity = capacity;
105
+ }
106
+ capacity;
107
+ seen = /* @__PURE__ */ new Map();
108
+ /** True if this id was already recorded (a duplicate delivery). */
109
+ has(deliveryId) {
110
+ return this.seen.has(deliveryId);
111
+ }
112
+ add(deliveryId) {
113
+ this.seen.delete(deliveryId);
114
+ this.seen.set(deliveryId, true);
115
+ if (this.seen.size > this.capacity) {
116
+ const oldest = this.seen.keys().next().value;
117
+ if (oldest !== void 0) this.seen.delete(oldest);
118
+ }
119
+ }
120
+ };
121
+
122
+ // src/signature.ts
123
+ import { createHmac, timingSafeEqual } from "crypto";
124
+ var SIGNATURE_HEX = /^[0-9a-f]{64}$/;
125
+ function parseSignatureHeader(header) {
126
+ let timestamp;
127
+ const signatures = [];
128
+ for (const part of header.split(",")) {
129
+ const [key, value] = part.split("=", 2);
130
+ if (key === "t" && value) {
131
+ const parsed = Number(value);
132
+ if (Number.isFinite(parsed)) timestamp = parsed;
133
+ } else if (key === "v1" && value && SIGNATURE_HEX.test(value)) {
134
+ signatures.push(value);
135
+ }
136
+ }
137
+ if (timestamp === void 0 || signatures.length === 0) return void 0;
138
+ return { timestamp, signatures };
139
+ }
140
+ function computeSignature(secret, timestamp, rawBody) {
141
+ return createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest("hex");
142
+ }
143
+ function signaturesEqual(a, b) {
144
+ const bufA = Buffer.from(a, "hex");
145
+ const bufB = Buffer.from(b, "hex");
146
+ if (bufA.length !== bufB.length) return false;
147
+ return timingSafeEqual(bufA, bufB);
148
+ }
149
+ function verifyHyleSignature(params) {
150
+ const secrets = params.secrets.filter((s) => s !== "");
151
+ if (!params.header || secrets.length === 0) return false;
152
+ const parsed = parseSignatureHeader(params.header);
153
+ if (!parsed) return false;
154
+ const tolerance = params.toleranceSeconds ?? 300;
155
+ const now = (params.now ?? Date.now)() / 1e3;
156
+ if (Math.abs(now - parsed.timestamp) > tolerance) return false;
157
+ for (const secret of secrets) {
158
+ const expected = computeSignature(secret, parsed.timestamp, params.rawBody);
159
+ for (const candidate of parsed.signatures) {
160
+ if (signaturesEqual(candidate, expected)) return true;
161
+ }
162
+ }
163
+ return false;
164
+ }
165
+
166
+ // src/tag-validation.ts
167
+ var CACHE_TAG_PATTERN = /^hyle:1:(pub|doc|sec|link|ws):[0-9a-f-]{36}(:[\x21-\x7e]{1,200})?$/;
168
+ function isValidCacheTag(tag) {
169
+ return CACHE_TAG_PATTERN.test(tag);
170
+ }
171
+
172
+ // src/revalidation-callback.ts
173
+ var MAX_BODY_BYTES = 65536;
174
+ var MAX_TAGS = 1e3;
175
+ function createRevalidationCallbackRoute(options) {
176
+ const dedupe = new DeliveryDedupe(options.dedupeCapacity);
177
+ return {
178
+ async POST(req) {
179
+ const rawBody = await readCapped2(req);
180
+ if (rawBody === void 0) return new Response(null, { status: 413 });
181
+ const verified = verifyHyleSignature({
182
+ header: req.headers.get("hyle-signature"),
183
+ rawBody,
184
+ secrets: options.secrets,
185
+ ...options.toleranceSeconds !== void 0 ? { toleranceSeconds: options.toleranceSeconds } : {},
186
+ ...options.now !== void 0 ? { now: options.now } : {}
187
+ });
188
+ if (!verified) {
189
+ return new Response(null, { status: 401 });
190
+ }
191
+ let payload;
192
+ try {
193
+ payload = JSON.parse(rawBody);
194
+ } catch {
195
+ return new Response(null, { status: 400 });
196
+ }
197
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload)) return new Response(null, { status: 400 });
198
+ const body = payload;
199
+ if (body.cp !== 1) {
200
+ return okResponse(0);
201
+ }
202
+ const tags = body.tags ?? [];
203
+ if (typeof body.workspace_id !== "string" || !Array.isArray(tags) || tags.length > MAX_TAGS || !tags.every((t) => typeof t === "string")) {
204
+ return new Response(null, { status: 400 });
205
+ }
206
+ if (body.workspace_id !== options.workspaceId) {
207
+ return okResponse(0);
208
+ }
209
+ const deliveryId = req.headers.get("hyle-delivery-id");
210
+ if (deliveryId && dedupe.has(deliveryId)) {
211
+ return okResponse(0);
212
+ }
213
+ let purged = 0;
214
+ try {
215
+ for (const tag of tags) {
216
+ if (!isValidCacheTag(tag)) continue;
217
+ options.revalidateTag(tag);
218
+ purged += 1;
219
+ }
220
+ } catch {
221
+ return new Response(null, { status: 500 });
222
+ }
223
+ if (deliveryId) dedupe.add(deliveryId);
224
+ return okResponse(purged);
225
+ }
226
+ };
227
+ }
228
+ async function readCapped2(req) {
229
+ const declared = Number(req.headers.get("content-length"));
230
+ if (Number.isFinite(declared) && declared > MAX_BODY_BYTES) return void 0;
231
+ if (!req.body) return "";
232
+ const reader = req.body.getReader();
233
+ const chunks = [];
234
+ let total = 0;
235
+ for (; ; ) {
236
+ const { done, value } = await reader.read();
237
+ if (done) break;
238
+ total += value.byteLength;
239
+ if (total > MAX_BODY_BYTES) {
240
+ await reader.cancel();
241
+ return void 0;
242
+ }
243
+ chunks.push(value);
244
+ }
245
+ return Buffer.concat(chunks).toString("utf8");
246
+ }
247
+ function okResponse(purged) {
248
+ return new Response(JSON.stringify({ ok: true, purged }), {
249
+ status: 200,
250
+ headers: { "Content-Type": "application/json; charset=utf-8", "Cache-Control": "no-store" }
251
+ });
252
+ }
253
+
254
+ // src/sitemap.ts
255
+ var PAGE_LIMIT = 100;
256
+ var DEFAULT_MAX_PAGES = 20;
257
+ var SECTION_SLUG = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
258
+ var UNSAFE_PATH = /[\\?#<>&"'\u0000- \u007f]/;
259
+ async function listPublicationPaths(options) {
260
+ const maxPages = options.maxPages ?? DEFAULT_MAX_PAGES;
261
+ const prefix = `${options.basePath}/`;
262
+ const indexes = [options.basePath || "/"];
263
+ for (const slug of options.sections ?? []) if (slug !== "posts" && SECTION_SLUG.test(slug)) indexes.push(`${options.basePath}/${slug}`);
264
+ const found = /* @__PURE__ */ new Map();
265
+ let complete = true;
266
+ try {
267
+ for (const index of new Set(indexes)) {
268
+ let cursor;
269
+ for (let page = 0; page < maxPages; page++) {
270
+ const result = await options.client.resolve({
271
+ path: index,
272
+ limit: PAGE_LIMIT,
273
+ ...options.locale !== void 0 ? { locale: options.locale } : {},
274
+ ...cursor !== void 0 ? { cursor } : {}
275
+ });
276
+ if (result.kind !== "list") {
277
+ complete = false;
278
+ break;
279
+ }
280
+ for (const item of result.items) {
281
+ if (item.canonical_path.startsWith(prefix) && !UNSAFE_PATH.test(item.canonical_path)) found.set(item.canonical_path, item.published_at);
282
+ }
283
+ if (!result.next_cursor) break;
284
+ if (page === maxPages - 1) complete = false;
285
+ cursor = result.next_cursor;
286
+ }
287
+ }
288
+ } catch {
289
+ complete = false;
290
+ }
291
+ return { paths: [...found].map(([path, publishedAt]) => ({ path, publishedAt })), complete };
292
+ }
293
+
294
+ // src/route-check.ts
295
+ var NOT_ROUTES = /* @__PURE__ */ new Set(["/_not-found", "/_global-error", "/_app", "/_error", "/_document", "/404", "/500"]);
296
+ var LOCALE_PARAM = "locale";
297
+ function normalizeRoute(key) {
298
+ const segments = key.replace(/\/(page|route)$/, "").split("/").filter((s) => s !== "");
299
+ if (segments.some((s) => s.startsWith("@") || /^\(\.{1,3}\)/.test(s))) return void 0;
300
+ const route = `/${segments.filter((s) => !/^\(.*\)$/.test(s)).join("/")}`;
301
+ return NOT_ROUTES.has(route) ? void 0 : route;
302
+ }
303
+ function hostRoutesFromManifests({ routesManifest, appPaths }) {
304
+ const keys = [...(routesManifest?.staticRoutes ?? []).map((r) => r.page), ...(routesManifest?.dynamicRoutes ?? []).map((r) => r.page), ...Object.keys(appPaths ?? {})];
305
+ return [...new Set(keys.map(normalizeRoute).filter((r) => r !== void 0))].sort();
306
+ }
307
+ var segmentsOf = (path) => path.split("/").filter((s) => s !== "");
308
+ function parse(route) {
309
+ return segmentsOf(route).map((value) => {
310
+ const optional = /^\[\[\.\.\.([^\]]+)\]\]$/.exec(value);
311
+ if (optional) return { kind: "optional-catch-all", name: optional[1] };
312
+ const rest = /^\[\.\.\.([^\]]+)\]$/.exec(value);
313
+ if (rest) return { kind: "catch-all", name: rest[1] };
314
+ const one = /^\[([^\]]+)\]$/.exec(value);
315
+ return one ? { kind: "dynamic", name: one[1] } : { kind: "static", value };
316
+ });
317
+ }
318
+ var isDynamic = (route) => parse(route).some((s) => s.kind !== "static");
319
+ function routeMatches(route, path) {
320
+ const pattern = parse(route);
321
+ const parts = segmentsOf(path);
322
+ for (const [i, seg] of pattern.entries()) {
323
+ if (seg.kind === "optional-catch-all") return i === pattern.length - 1;
324
+ if (seg.kind === "catch-all") return i === pattern.length - 1 && parts.length > i;
325
+ if (i >= parts.length || seg.kind === "static" && seg.value !== parts[i]) return false;
326
+ }
327
+ return parts.length === pattern.length;
328
+ }
329
+ var RANK = { static: 0, dynamic: 1, "catch-all": 2, "optional-catch-all": 3 };
330
+ function compareSpecificity(a, b) {
331
+ const [pa, pb] = [parse(a), parse(b)];
332
+ for (let i = 0; i < Math.min(pa.length, pb.length); i++) {
333
+ const d = RANK[pa[i].kind] - RANK[pb[i].kind];
334
+ if (d !== 0) return d;
335
+ }
336
+ return pa.length - pb.length;
337
+ }
338
+ function withLocale(path, locale) {
339
+ if (!locale) return [path];
340
+ const prefixed = (l) => path === "/" ? `/${l}` : `/${l}${path}`;
341
+ if (locale.prefix === "never") return [path];
342
+ return locale.locales.map((l) => locale.prefix === "as-needed" && l === locale.defaultLocale ? path : prefixed(l));
343
+ }
344
+ function expandLocale(route, locale) {
345
+ const [first, ...rest] = segmentsOf(route);
346
+ if (!locale || first !== `[${LOCALE_PARAM}]`) return [route];
347
+ return [...new Set(withLocale(`/${rest.join("/")}`, locale))];
348
+ }
349
+ var MAX_EXAMPLES = 5;
350
+ function checkRoutes(input) {
351
+ const { locale } = input;
352
+ const hyleParam = input.hyleParam ?? "hyle";
353
+ const routes = [...new Set(input.hostRoutes.flatMap((r) => expandLocale(r, locale)))];
354
+ const staticRoutes = new Set(routes.filter((r) => !isDynamic(r)));
355
+ const dynamicRoutes = routes.filter(isDynamic);
356
+ const catchAlls = dynamicRoutes.filter((r) => {
357
+ const last = parse(r).at(-1);
358
+ return (last?.kind === "catch-all" || last?.kind === "optional-catch-all") && last.name === hyleParam;
359
+ });
360
+ const notes = [];
361
+ const shadowedHylePaths = input.hylePaths.flatMap(
362
+ (path) => withLocale(path, locale).filter((url) => staticRoutes.has(url)).map((url) => ({ path, url, route: url }))
363
+ );
364
+ const mountCollisions = [];
365
+ for (const prefix of input.mounts) {
366
+ if (prefix === "/") {
367
+ if (staticRoutes.has("/")) notes.push(`root mount: the host's own home page owns "/", so hyle's index page is not served there (pages below it are)`);
368
+ continue;
369
+ }
370
+ for (const url of withLocale(prefix, locale)) if (staticRoutes.has(url)) mountCollisions.push({ prefix, url, route: url });
371
+ }
372
+ const urls = [...new Set([...input.hylePaths, ...input.mounts.filter((m) => m !== "/")].flatMap((p) => withLocale(p, locale)))];
373
+ const dynamicOverlaps = [];
374
+ for (const route of dynamicRoutes) {
375
+ const matched = urls.filter((u) => routeMatches(route, u));
376
+ if (catchAlls.includes(route)) {
377
+ dynamicOverlaps.push({ route, verdict: "hyle-catch-all", matches: matched.length, examples: matched.slice(0, MAX_EXAMPLES) });
378
+ continue;
379
+ }
380
+ const hostWins = matched.filter((u) => {
381
+ const best = catchAlls.filter((c) => routeMatches(c, u)).sort(compareSpecificity)[0];
382
+ return best === void 0 || compareSpecificity(route, best) <= 0;
383
+ });
384
+ if (matched.length === 0) continue;
385
+ const shown = hostWins.length > 0 ? hostWins : matched;
386
+ dynamicOverlaps.push({ route, verdict: hostWins.length > 0 ? "host-wins" : "hyle-wins", matches: shown.length, examples: shown.slice(0, MAX_EXAMPLES) });
387
+ }
388
+ if (catchAlls.length === 0) notes.push(`no hyle catch-all route (a "[...${hyleParam}]" or "[[...${hyleParam}]]" page) was found in the host routes`);
389
+ return { shadowedHylePaths, mountCollisions, dynamicOverlaps, notes, ok: shadowedHylePaths.length === 0 && mountCollisions.length === 0 };
390
+ }
391
+ function reservedFor(hostRoutes, options = {}) {
392
+ const dropLocale = (route) => {
393
+ const [first, ...rest] = segmentsOf(route);
394
+ return options.locale && first === `[${LOCALE_PARAM}]` ? `/${rest.join("/")}` : route;
395
+ };
396
+ const exact = new Set(hostRoutes.map(dropLocale).filter((r) => !isDynamic(r)));
397
+ const mounts = options.mounts?.filter((m) => m !== "/");
398
+ const groups = /* @__PURE__ */ new Map();
399
+ for (const route of exact) {
400
+ const [first, ...rest] = segmentsOf(route);
401
+ if (first !== void 0 && rest.length > 0) groups.set(first, [...groups.get(first) ?? [], route]);
402
+ }
403
+ for (const [first, members] of groups) {
404
+ const onMount = mounts?.some((m) => m === `/${first}` || m.startsWith(`/${first}/`)) ?? true;
405
+ if (members.length < 2 || onMount) continue;
406
+ for (const m of members) exact.delete(m);
407
+ exact.delete(`/${first}`);
408
+ exact.add(`/${first}/*`);
409
+ }
410
+ return [...exact].sort();
411
+ }
412
+ function formatReport(report) {
413
+ const lines = [];
414
+ const section = (title, rows, empty) => lines.push(`${title}`, ...rows.length ? rows.map((r) => ` ${printable(r)}`) : [` ${empty}`], "");
415
+ section(
416
+ "(a) hyle paths shadowed by host static routes (the hyle page is never served):",
417
+ report.shadowedHylePaths.map((s) => `${s.url} (hyle path ${s.path})`),
418
+ "none"
419
+ );
420
+ section("(c) mounts whose prefix is a host static route (the mount's index page is never served):", report.mountCollisions.map((m) => `${m.url} (mount ${m.prefix})`), "none");
421
+ section(
422
+ "(b) host dynamic routes matching hyle URLs:",
423
+ report.dynamicOverlaps.map((d) => {
424
+ const label = { "hyle-catch-all": "OK: this is hyle's catch-all", "hyle-wins": "OK: hyle's catch-all is more specific", "host-wins": "WARN: the host route is served, hyle content is hidden" }[d.verdict];
425
+ return `${d.route} ${label} (${d.matches} URLs, e.g. ${d.examples.join(", ") || "-"})`;
426
+ }),
427
+ "none"
428
+ );
429
+ if (report.notes.length) section("notes:", report.notes, "");
430
+ lines.push(report.ok ? "RESULT: no collisions" : "RESULT: collisions found");
431
+ return lines.join("\n");
432
+ }
433
+ var MAX_PRINTED = 200;
434
+ var printable = (text) => {
435
+ const clean = text.replace(/\u001b(?:\[[0-?]*[ -/]*[@-~]|\][^\u0007\u001b]*(?:\u0007|\u001b\\)?|.)?/g, "").replace(/[\u0000-\u001f\u007f-\u009f]/g, "");
436
+ return clean.length > MAX_PRINTED ? `${clean.slice(0, MAX_PRINTED)}...` : clean;
437
+ };
438
+
439
+ export {
440
+ Cp1ClientError,
441
+ createHyleClient,
442
+ DeliveryDedupe,
443
+ parseSignatureHeader,
444
+ verifyHyleSignature,
445
+ CACHE_TAG_PATTERN,
446
+ isValidCacheTag,
447
+ createRevalidationCallbackRoute,
448
+ listPublicationPaths,
449
+ normalizeRoute,
450
+ hostRoutesFromManifests,
451
+ routeMatches,
452
+ checkRoutes,
453
+ reservedFor,
454
+ formatReport
455
+ };
@@ -0,0 +1,38 @@
1
+ // src/react/viewer/labels.ts
2
+ var VIEWER_LABELS_EN = {
3
+ expand: "Expand diagram",
4
+ expandHint: "Expand",
5
+ viewer: "Diagram viewer",
6
+ close: "Close",
7
+ zoomIn: "Zoom in",
8
+ zoomOut: "Zoom out",
9
+ fit: "Fit to window",
10
+ actual: "Actual size",
11
+ search: "Find in diagram",
12
+ searchPlaceholder: "Find",
13
+ noMatch: "No match",
14
+ matchOf: "{n} of {total}",
15
+ copySource: "Copy diagram source",
16
+ downloadSvg: "Download SVG",
17
+ downloadPng: "Download PNG",
18
+ copyImage: "Copy as image",
19
+ pngScale: "PNG scale",
20
+ fullscreen: "Fullscreen",
21
+ exitFullscreen: "Exit fullscreen",
22
+ copied: "Copied",
23
+ saved: "Saved",
24
+ unavailable: "Not available here",
25
+ hint: "Scroll to zoom, drag to pan, click a node to trace its paths, press / to search",
26
+ legendSelected: "Selected",
27
+ legendUpstream: "Upstream",
28
+ legendDownstream: "Downstream",
29
+ outgoing: "outgoing",
30
+ tracing: "{label}: {up} upstream, {down} downstream",
31
+ map: "Overview map"
32
+ };
33
+ var fill = (template, values) => template.replace(/\{(\w+)\}/g, (m, k) => k in values ? String(values[k]) : m);
34
+
35
+ export {
36
+ VIEWER_LABELS_EN,
37
+ fill
38
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createHyleClient,
3
3
  isValidCacheTag
4
- } from "./chunk-HFUJRNFP.js";
4
+ } from "./chunk-4OB77ZOD.js";
5
5
 
6
6
  // src/next/resolve.ts
7
7
  var DEFAULT_REVALIDATE = 300;