@nimtech/nimpress 2.3.5 → 2.3.7

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.
@@ -1,10 +1,10 @@
1
- import { readdir as Oe, readFile as rt, writeFile as nt, copyFile as rs, cp as Ze, mkdir as _t } from "node:fs/promises";
2
- import { existsSync as mt, readFileSync as qt, statSync as re, readdirSync as le, createReadStream as is } from "node:fs";
1
+ import { readdir as Me, readFile as it, writeFile as nt, copyFile as rs, cp as Ze, mkdir as Tt } from "node:fs/promises";
2
+ import { existsSync as dt, readFileSync as zt, statSync as ie, readdirSync as pe, createReadStream as is } from "node:fs";
3
3
  import { request as as } from "node:http";
4
4
  import { execFileSync as cs } from "node:child_process";
5
- import { resolve as q, dirname as V, join as W, basename as Ot, relative as jt, extname as Me, isAbsolute as vt, sep as kt } from "node:path";
6
- import { createHash as vn } from "node:crypto";
7
- import _e from "gray-matter";
5
+ import { resolve as q, dirname as G, join as W, basename as Mt, relative as jt, extname as _e, isAbsolute as vt, sep as kt } from "node:path";
6
+ import { createHash as bn } from "node:crypto";
7
+ import Te from "gray-matter";
8
8
  import ls from "markdown-it";
9
9
  import Qe from "markdown-it-anchor";
10
10
  import ps from "markdown-it-attrs";
@@ -13,11 +13,11 @@ import fs from "markdown-it-deflist";
13
13
  import ms from "markdown-it-footnote";
14
14
  import ds from "markdown-it-task-lists";
15
15
  import { z as f } from "zod";
16
- import { parse as bn, stringify as hs } from "yaml";
16
+ import { parse as vn, stringify as hs } from "yaml";
17
17
  import { createHighlighter as gs } from "shiki";
18
18
  import { fileURLToPath as ys, pathToFileURL as tn } from "node:url";
19
- import { exporter as vs } from "@dbml/core";
20
- import { n as bs, r as Ht, e as ie, b as Pe, p as wn, c as Te, d as Ne, g as ae, h as ws, k as Fe, o as $s, s as Ss, l as xs, q as ks, t as Ps, j as dt, m as js, a as Es } from "./typeMembers-CNvE92EX.js";
19
+ import { exporter as bs } from "@dbml/core";
20
+ import { n as vs, r as Ut, e as ae, b as je, p as wn, c as Ne, d as Fe, g as ce, h as ws, k as Ie, o as $s, s as Ss, l as xs, q as ks, t as Ps, j as gt, m as js, a as Es } from "./typeMembers-CNvE92EX.js";
21
21
  import { createRequire as Ds } from "node:module";
22
22
  import { svelte as As } from "@sveltejs/vite-plugin-svelte";
23
23
  import Cs from "@tailwindcss/vite";
@@ -28,7 +28,7 @@ const en = {
28
28
  export: ".nimpress",
29
29
  modules: "_components",
30
30
  guarded: "_guarded"
31
- }, Rt = {
31
+ }, Wt = {
32
32
  title: "Nimpress",
33
33
  base: "/",
34
34
  contentDir: "docs",
@@ -160,22 +160,22 @@ const Bs = ["nimpress.config.ts", "nimpress.config.js", "nimpress.config.mjs", "
160
160
  function sn(e) {
161
161
  return typeof e == "object" && e !== null && !Array.isArray(e);
162
162
  }
163
- function je(e, t) {
163
+ function Ee(e, t) {
164
164
  if (!t) return e;
165
165
  const n = { ...e };
166
166
  for (const [s, r] of Object.entries(t)) {
167
167
  if (r === void 0) continue;
168
168
  const i = n[s];
169
- sn(i) && sn(r) ? n[s] = je(i, r) : n[s] = r;
169
+ sn(i) && sn(r) ? n[s] = Ee(i, r) : n[s] = r;
170
170
  }
171
171
  return n;
172
172
  }
173
173
  async function Rs(e) {
174
174
  for (const t of Bs) {
175
175
  const n = q(e, t);
176
- if (!mt(n)) continue;
176
+ if (!dt(n)) continue;
177
177
  if (t.endsWith(".json")) {
178
- const i = JSON.parse(qt(n, "utf-8"));
178
+ const i = JSON.parse(zt(n, "utf-8"));
179
179
  return { config: nn(i, n), file: n };
180
180
  }
181
181
  const r = (await Os({ command: "serve", mode: "development" }, n, e))?.config ?? {};
@@ -185,13 +185,13 @@ async function Rs(e) {
185
185
  }
186
186
  async function Ws(e, t) {
187
187
  const n = await Rs(e), s = n?.config ? { ...n.config, modules: void 0 } : void 0, r = t ? { ...t, modules: void 0 } : void 0;
188
- let i = je(Rt, s);
189
- i = je(i, r), i.css = typeof i.css == "string" ? [i.css] : i.css ?? [], i.base = bs(i.base);
188
+ let i = Ee(Wt, s);
189
+ i = Ee(i, r), i.css = typeof i.css == "string" ? [i.css] : i.css ?? [], i.base = vs(i.base);
190
190
  const c = t?.modules ?? n?.config?.modules;
191
191
  return i.modules = {
192
- dir: Rt.modules.dir,
192
+ dir: Wt.modules.dir,
193
193
  route: `/${i.paths.modules}`,
194
- systems: c ? Object.fromEntries(c.map((p) => [p.name, p])) : {}
194
+ systems: c ? Object.fromEntries(c.map((u) => [u.name, u])) : {}
195
195
  }, { resolved: i, configFile: n?.file ?? null };
196
196
  }
197
197
  function Ls(e) {
@@ -210,34 +210,34 @@ function Ls(e) {
210
210
  guardedBase: `/${e.paths.guarded}`
211
211
  };
212
212
  }
213
- const et = "\x1B[0m", ce = "\x1B[1m", se = "\x1B[2m", $n = "\x1B[38;2;204;120;92m", Pt = "\x1B[38;2;229;174;156m", Ct = "\x1B[38;2;160;160;170m", Yt = [
213
+ const et = "\x1B[0m", le = "\x1B[1m", oe = "\x1B[2m", $n = "\x1B[38;2;204;120;92m", Pt = "\x1B[38;2;229;174;156m", Ot = "\x1B[38;2;160;160;170m", Kt = [
214
214
  " ███╗ ██╗ ██╗ ███╗ ███╗ ██████╗ ██████╗ ███████╗ ███████╗ ███████╗",
215
215
  " ████╗ ██║ ██║ ████╗ ████║ ██╔══██╗ ██╔══██╗ ██╔════╝ ██╔════╝ ██╔════╝",
216
216
  " ██╔██╗ ██║ ██║ ██╔████╔██║ ██████╔╝ ██████╔╝ █████╗ ███████╗ ███████╗",
217
217
  " ██║╚██╗██║ ██║ ██║╚██╔╝██║ ██╔═══╝ ██╔══██╗ ██╔══╝ ╚════██║ ╚════██║",
218
218
  " ██║ ╚████║ ██║ ██║ ╚═╝ ██║ ██║ ██║ ██║ ███████╗ ███████║ ███████║",
219
219
  " ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝ ╚══════╝"
220
- ], Ft = 60;
220
+ ], It = 60;
221
221
  function Hs(e, t) {
222
222
  const n = e.replace(/\x1b\[[0-9;]*m/g, ""), s = Math.max(0, t - n.length);
223
223
  return e + " ".repeat(s);
224
224
  }
225
225
  function Us(e) {
226
- const t = "╔" + "═".repeat(Ft + 2) + "╗", n = "╠" + "═".repeat(Ft + 2) + "╣", s = "╚" + "═".repeat(Ft + 2) + "╝", r = [t];
226
+ const t = "╔" + "═".repeat(It + 2) + "╗", n = "╠" + "═".repeat(It + 2) + "╣", s = "╚" + "═".repeat(It + 2) + "╝", r = [t];
227
227
  for (let i = 0; i < e.length; i++)
228
- r.push("║ " + Hs(e[i], Ft) + " ║"), i < e.length - 1 && r.push(n);
228
+ r.push("║ " + Hs(e[i], It) + " ║"), i < e.length - 1 && r.push(n);
229
229
  return r.push(s), r;
230
230
  }
231
231
  function Js() {
232
232
  try {
233
- const e = V(ys(import.meta.url)), t = [
233
+ const e = G(ys(import.meta.url)), t = [
234
234
  q(e, "package.json"),
235
235
  q(e, "..", "package.json"),
236
236
  q(e, "..", "..", "package.json")
237
237
  ];
238
238
  for (const n of t)
239
239
  try {
240
- const s = qt(n, "utf-8"), r = JSON.parse(s);
240
+ const s = zt(n, "utf-8"), r = JSON.parse(s);
241
241
  if (r?.name === "@nimtech/nimpress" && typeof r.version == "string") return r.version;
242
242
  } catch {
243
243
  }
@@ -246,31 +246,31 @@ function Js() {
246
246
  return "";
247
247
  }
248
248
  function qs(e = {}) {
249
- const t = e.title ?? "Nimpress", n = e.tagline ?? "Docs framework on Svelte", s = e.company ?? `Samna® ${(/* @__PURE__ */ new Date()).getFullYear()}`, r = e.version ?? "dev", i = e.localUrl ?? "http://localhost:5173/", c = e.networkUrl ?? "use --host to expose", p = typeof e.duration == "number" ? `ready in ${e.duration} ms` : "ready", v = e.nimpressVersion ?? Js(), d = [];
249
+ const t = e.title ?? "Nimpress", n = e.tagline ?? "Docs framework on Svelte", s = e.company ?? `Samna® ${(/* @__PURE__ */ new Date()).getFullYear()}`, r = e.version ?? "dev", i = e.localUrl ?? "http://localhost:5173/", c = e.networkUrl ?? "use --host to expose", u = typeof e.duration == "number" ? `ready in ${e.duration} ms` : "ready", b = e.nimpressVersion ?? Js(), d = [];
250
250
  d.push("");
251
- for (const H of Yt) d.push($n + H + et);
251
+ for (const H of Kt) d.push($n + H + et);
252
252
  d.push("");
253
253
  const m = [
254
- `${ce}${t}${et}${Ct} · ${s}${et}`,
255
- `${Ct}${n}${et}`,
256
- `${Pt}Version${et} ${r} ${Pt}${p}${et}`
254
+ `${le}${t}${et}${Ot} · ${s}${et}`,
255
+ `${Ot}${n}${et}`,
256
+ `${Pt}Version${et} ${r} ${Pt}${u}${et}`
257
257
  ];
258
- v && m.push(`${Pt}Nimpress${et} ${v}`), m.push(`${Pt}➜${et} Local ${ce}${i}${et}`), m.push(`${Pt}➜${et} Network ${se}${c}${et}`);
259
- const S = Us(m), k = Yt[0].length, j = Yt[0].length - Yt[0].trimStart().length, T = Ft + 4, D = " ".repeat(Math.max(0, Math.floor((k + j - T) / 2)));
258
+ b && m.push(`${Pt}Nimpress${et} ${b}`), m.push(`${Pt}➜${et} Local ${le}${i}${et}`), m.push(`${Pt}➜${et} Network ${oe}${c}${et}`);
259
+ const S = Us(m), k = Kt[0].length, j = Kt[0].length - Kt[0].trimStart().length, T = It + 4, D = " ".repeat(Math.max(0, Math.floor((k + j - T) / 2)));
260
260
  for (const H of S) d.push(D + H);
261
261
  return d.push(""), d.join(`
262
262
  `);
263
263
  }
264
264
  function zs() {
265
265
  try {
266
- const e = qt(q(process.cwd(), "package.json"), "utf-8"), t = JSON.parse(e);
266
+ const e = zt(q(process.cwd(), "package.json"), "utf-8"), t = JSON.parse(e);
267
267
  return { name: t.name, version: t.version };
268
268
  } catch {
269
269
  return {};
270
270
  }
271
271
  }
272
- const Gs = 27, Vs = 14, Xs = 16, Ys = 20, Ks = 17, Zs = 14, Sn = 110, Qs = 60, to = 120, Wt = 40, eo = 200, no = 420, so = 24, oo = 7.6, ro = 6.6, xn = 7.4, io = 5.4, ao = 5.8, co = 6.2, lo = 34, po = 48, on = 8, uo = 260, fo = 18, mo = 6.2, ho = 30, rn = 24, an = 24;
273
- class Ie extends Error {
272
+ const Gs = 27, Vs = 14, Xs = 16, Ys = 20, Ks = 17, Zs = 14, Sn = 110, Qs = 60, to = 120, Lt = 40, eo = 200, no = 420, so = 24, oo = 7.6, ro = 6.6, xn = 7.4, io = 5.4, ao = 5.8, co = 6.2, lo = 34, po = 48, on = 8, uo = 260, fo = 18, mo = 6.2, ho = 30, rn = 24, an = 24;
273
+ class Be extends Error {
274
274
  }
275
275
  function go(e) {
276
276
  const t = e?.diags;
@@ -282,15 +282,15 @@ function go(e) {
282
282
  }
283
283
  function yo(e) {
284
284
  try {
285
- return JSON.parse(vs.export(e, "json"));
285
+ return JSON.parse(bs.export(e, "json"));
286
286
  } catch (t) {
287
- throw new Ie(go(t));
287
+ throw new Be(go(t));
288
288
  }
289
289
  }
290
- function vo(e) {
290
+ function bo(e) {
291
291
  return (e.type?.type_name ?? "").trim();
292
292
  }
293
- function bo(e) {
293
+ function vo(e) {
294
294
  const t = e.dbdefault;
295
295
  return !t || t.value === void 0 || t.value === null ? "" : String(t.value);
296
296
  }
@@ -303,28 +303,28 @@ function $o(e) {
303
303
  href: n[2].trim()
304
304
  } : { note: t, label: "", href: "" };
305
305
  }
306
- function oe(e, t, n) {
306
+ function re(e, t, n) {
307
307
  if (!e) return 0;
308
308
  const s = Math.max(1, Math.floor(n / t));
309
309
  return e.split(`
310
310
  `).reduce((r, i) => r + Math.max(1, Math.ceil(i.trim().length / s)), 0);
311
311
  }
312
- function ye(e) {
312
+ function be(e) {
313
313
  return e.reduce((t, n) => Math.max(t, n.length), 0);
314
314
  }
315
315
  function So(e, t) {
316
- const n = ye(t.map((v) => v.name)) * oo, s = ye(t.map((v) => v.type)) * ro, r = ye(t.map((v) => v.linkLabel)) * co, i = t.some((v) => v.pk || v.fk) ? lo : 0, c = Math.round(n + s + r + i + po), p = Math.round(e.length * xn + 32);
317
- return Math.min(no, Math.max(eo, c, p));
316
+ const n = be(t.map((b) => b.name)) * oo, s = be(t.map((b) => b.type)) * ro, r = be(t.map((b) => b.linkLabel)) * co, i = t.some((b) => b.pk || b.fk) ? lo : 0, c = Math.round(n + s + r + i + po), u = Math.round(e.length * xn + 32);
317
+ return Math.min(no, Math.max(eo, c, u));
318
318
  }
319
319
  function xo(e) {
320
- const t = e.width - so, n = Math.max(1, oe(e.name, xn, t)), s = oe(e.note, io, t), r = Ys + n * Ks + s * Zs, i = Math.max(e.columns.length, 1) * Gs, c = e.indexes.reduce(
321
- (v, d) => v + oe(`${d.unique ? "unique" : "index"} ${d.columns.join(", ")}`, ao, t),
320
+ const t = e.width - so, n = Math.max(1, re(e.name, xn, t)), s = re(e.note, io, t), r = Ys + n * Ks + s * Zs, i = Math.max(e.columns.length, 1) * Gs, c = e.indexes.reduce(
321
+ (b, d) => b + re(`${d.unique ? "unique" : "index"} ${d.columns.join(", ")}`, ao, t),
322
322
  0
323
- ), p = e.indexes.length ? Xs + c * Vs : 0;
324
- return Math.round(r + i + p + 2);
323
+ ), u = e.indexes.length ? Xs + c * Vs : 0;
324
+ return Math.round(r + i + u + 2);
325
325
  }
326
326
  function ko(e) {
327
- const t = e.width - rn, n = oe(e.body, mo, t), s = e.title ? ho : 0;
327
+ const t = e.width - rn, n = re(e.body, mo, t), s = e.title ? ho : 0;
328
328
  return Math.round(rn + s + Math.max(1, n) * fo);
329
329
  }
330
330
  function Po(e, t, n) {
@@ -343,25 +343,25 @@ function jo(e, t) {
343
343
  }
344
344
  function Eo(e, t) {
345
345
  const n = /* @__PURE__ */ new Map();
346
- for (const p of e) n.set(p.id, /* @__PURE__ */ new Set());
347
- for (const [p, v] of t)
348
- p !== v && (n.get(p)?.add(v), n.get(v)?.add(p));
349
- const s = new Map(e.map((p) => [p.id, p])), r = /* @__PURE__ */ new Set(), i = [], c = [...e].sort(
350
- (p, v) => (n.get(v.id)?.size ?? 0) - (n.get(p.id)?.size ?? 0)
346
+ for (const u of e) n.set(u.id, /* @__PURE__ */ new Set());
347
+ for (const [u, b] of t)
348
+ u !== b && (n.get(u)?.add(b), n.get(b)?.add(u));
349
+ const s = new Map(e.map((u) => [u.id, u])), r = /* @__PURE__ */ new Set(), i = [], c = [...e].sort(
350
+ (u, b) => (n.get(b.id)?.size ?? 0) - (n.get(u.id)?.size ?? 0)
351
351
  );
352
- for (const p of c) {
353
- if (r.has(p.id)) continue;
354
- const v = [], d = [p.id];
355
- for (r.add(p.id); d.length; ) {
352
+ for (const u of c) {
353
+ if (r.has(u.id)) continue;
354
+ const b = [], d = [u.id];
355
+ for (r.add(u.id); d.length; ) {
356
356
  const m = d.shift(), S = s.get(m);
357
- S && v.push(S);
357
+ S && b.push(S);
358
358
  const k = [...n.get(m) ?? []].sort(
359
359
  (j, T) => (n.get(T)?.size ?? 0) - (n.get(j)?.size ?? 0)
360
360
  );
361
361
  for (const j of k)
362
362
  r.has(j) || (r.add(j), d.push(j));
363
363
  }
364
- i.push(v);
364
+ i.push(b);
365
365
  }
366
366
  return i;
367
367
  }
@@ -378,30 +378,30 @@ function Do(e, t) {
378
378
  for (const m of s.get(d) ?? [])
379
379
  r.has(m) || (r.set(m, (r.get(d) ?? 0) + 1), c.push(m));
380
380
  }
381
- const p = /* @__PURE__ */ new Map();
381
+ const u = /* @__PURE__ */ new Map();
382
382
  for (const d of e) {
383
- const m = r.get(d.id) ?? 0, S = p.get(m) ?? [];
384
- S.push(d), p.set(m, S);
383
+ const m = r.get(d.id) ?? 0, S = u.get(m) ?? [];
384
+ S.push(d), u.set(m, S);
385
385
  }
386
- const v = [];
387
- for (const d of [...p.keys()].sort((m, S) => m - S)) {
388
- const m = p.get(d) ?? [];
386
+ const b = [];
387
+ for (const d of [...u.keys()].sort((m, S) => m - S)) {
388
+ const m = u.get(d) ?? [];
389
389
  for (let S = 0; S < m.length; S += on)
390
- v.push(m.slice(S, S + on));
390
+ b.push(m.slice(S, S + on));
391
391
  }
392
- return v;
392
+ return b;
393
393
  }
394
394
  function Ao(e, t) {
395
395
  const n = [];
396
- let s = Wt;
396
+ let s = Lt;
397
397
  for (const r of Eo(e, t)) {
398
- let i = Wt, c = s;
399
- for (const p of Do(r, t)) {
400
- const v = Math.max(...p.map((m) => m.width));
398
+ let i = Lt, c = s;
399
+ for (const u of Do(r, t)) {
400
+ const b = Math.max(...u.map((m) => m.width));
401
401
  let d = s;
402
- for (const m of p)
403
- m.x = i + Math.round((v - m.width) / 2), m.y = d, d += m.height + Qs, c = Math.max(c, m.y + m.height), n.push(m);
404
- i += v + Sn;
402
+ for (const m of u)
403
+ m.x = i + Math.round((b - m.width) / 2), m.y = d, d += m.height + Qs, c = Math.max(c, m.y + m.height), n.push(m);
404
+ i += b + Sn;
405
405
  }
406
406
  s = c + to;
407
407
  }
@@ -409,42 +409,42 @@ function Ao(e, t) {
409
409
  }
410
410
  function Co(e) {
411
411
  const t = yo(e), n = Object.values(t.database)[0], s = /* @__PURE__ */ new Map(), r = [];
412
- for (const _ of Object.values(t.schemas).sort((A, L) => A.id - L.id))
413
- for (const A of _.tableIds)
414
- r.push(A), s.set(A, _.name);
412
+ for (const M of Object.values(t.schemas).sort((A, L) => A.id - L.id))
413
+ for (const A of M.tableIds)
414
+ r.push(A), s.set(A, M.name);
415
415
  const i = /* @__PURE__ */ new Set();
416
- for (const _ of Object.values(t.indexes)) {
417
- if (!_.pk) continue;
418
- const A = t.tables[String(_.tableId)];
416
+ for (const M of Object.values(t.indexes)) {
417
+ if (!M.pk) continue;
418
+ const A = t.tables[String(M.tableId)];
419
419
  if (A)
420
- for (const L of _.columnIds) {
420
+ for (const L of M.columnIds) {
421
421
  const ot = t.indexColumns[String(L)];
422
422
  if (!ot || ot.type !== "column") continue;
423
- const lt = A.fieldIds.map((ft) => t.fields[String(ft)]).find((ft) => ft && ft.name === ot.value);
423
+ const lt = A.fieldIds.map((mt) => t.fields[String(mt)]).find((mt) => mt && mt.name === ot.value);
424
424
  lt && i.add(lt.id);
425
425
  }
426
426
  }
427
- const c = [], p = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
428
- for (const _ of r) {
429
- const A = t.tables[String(_)];
427
+ const c = [], u = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
428
+ for (const M of r) {
429
+ const A = t.tables[String(M)];
430
430
  if (!A) continue;
431
- const L = s.get(_) ?? "public", ot = L === "public" ? A.name : `${L}.${A.name}`, lt = `table-${_}`, ft = [];
431
+ const L = s.get(M) ?? "public", ot = L === "public" ? A.name : `${L}.${A.name}`, lt = `table-${M}`, mt = [];
432
432
  A.fieldIds.forEach((pt) => {
433
433
  const Q = t.fields[String(pt)];
434
434
  if (!Q) return;
435
- const wt = !!Q.pk || i.has(Q.id), it = $o(Q.note ?? "");
436
- d.set(Q.id, ft.length), m.set(Q.id, lt), ft.push({
435
+ const $t = !!Q.pk || i.has(Q.id), at = $o(Q.note ?? "");
436
+ d.set(Q.id, mt.length), m.set(Q.id, lt), mt.push({
437
437
  name: Q.name,
438
- type: vo(Q),
439
- note: it.note,
440
- default: bo(Q),
441
- pk: wt,
438
+ type: bo(Q),
439
+ note: at.note,
440
+ default: vo(Q),
441
+ pk: $t,
442
442
  fk: !1,
443
443
  unique: !!Q.unique,
444
- notNull: wt || !!Q.not_null,
444
+ notNull: $t || !!Q.not_null,
445
445
  increment: !!Q.increment,
446
- link: it.href,
447
- linkLabel: it.label,
446
+ link: at.href,
447
+ linkLabel: at.label,
448
448
  target: ""
449
449
  });
450
450
  });
@@ -452,51 +452,51 @@ function Co(e) {
452
452
  for (const pt of A.indexIds) {
453
453
  const Q = t.indexes[String(pt)];
454
454
  if (!Q || Q.pk) continue;
455
- const wt = Q.columnIds.map((it) => t.indexColumns[String(it)]).filter((it) => it && it.type === "column").map((it) => it.value);
456
- wt.length && Et.push({
455
+ const $t = Q.columnIds.map((at) => t.indexColumns[String(at)]).filter((at) => at && at.type === "column").map((at) => at.value);
456
+ $t.length && Et.push({
457
457
  name: Q.name ?? `${A.name}_index_${Q.id}`,
458
- columns: wt,
458
+ columns: $t,
459
459
  unique: !!Q.unique
460
460
  });
461
461
  }
462
- const bt = {
462
+ const wt = {
463
463
  id: lt,
464
464
  name: ot,
465
465
  note: A.note ?? "",
466
466
  color: A.headerColor ?? "",
467
- columns: ft,
467
+ columns: mt,
468
468
  indexes: Et,
469
469
  x: 0,
470
470
  y: 0,
471
- width: So(ot, ft),
471
+ width: So(ot, mt),
472
472
  height: 0
473
473
  };
474
- bt.height = xo(bt), c.push(bt), p.set(lt, bt), v.set(A.name, lt), v.set(ot, lt);
474
+ wt.height = xo(wt), c.push(wt), u.set(lt, wt), b.set(A.name, lt), b.set(ot, lt);
475
475
  }
476
- for (const _ of c)
477
- for (const A of _.columns) {
476
+ for (const M of c)
477
+ for (const A of M.columns) {
478
478
  if (!A.link) continue;
479
- const L = A.link.replace(/^#/, ""), ot = v.get(L) ?? v.get(A.link);
480
- !ot || ot === _.id || (A.target = ot, A.link = "");
479
+ const L = A.link.replace(/^#/, ""), ot = b.get(L) ?? b.get(A.link);
480
+ !ot || ot === M.id || (A.target = ot, A.link = "");
481
481
  }
482
482
  const S = [];
483
- for (const _ of Object.values(t.refs).sort((A, L) => A.id - L.id)) {
484
- const A = _.endpointIds.map((Q) => t.endpoints[String(Q)]).filter(Boolean);
483
+ for (const M of Object.values(t.refs).sort((A, L) => A.id - L.id)) {
484
+ const A = M.endpointIds.map((Q) => t.endpoints[String(Q)]).filter(Boolean);
485
485
  if (A.length !== 2) continue;
486
- const L = A[1].relation === "1" ? 1 : A[0].relation === "1" ? 0 : 1, ot = A[L], lt = A[L === 0 ? 1 : 0], ft = ot.fieldIds[0], Et = lt.fieldIds[0];
487
- if (ft === void 0 || Et === void 0) continue;
488
- const bt = m.get(ft) ?? v.get(ot.tableName), pt = m.get(Et) ?? v.get(lt.tableName);
489
- if (!(!bt || !pt)) {
486
+ const L = A[1].relation === "1" ? 1 : A[0].relation === "1" ? 0 : 1, ot = A[L], lt = A[L === 0 ? 1 : 0], mt = ot.fieldIds[0], Et = lt.fieldIds[0];
487
+ if (mt === void 0 || Et === void 0) continue;
488
+ const wt = m.get(mt) ?? b.get(ot.tableName), pt = m.get(Et) ?? b.get(lt.tableName);
489
+ if (!(!wt || !pt)) {
490
490
  for (const Q of lt.fieldIds) {
491
- const wt = p.get(m.get(Q) ?? ""), it = d.get(Q);
492
- if (!wt || it === void 0) continue;
493
- const $t = wt.columns[it];
494
- $t.fk = !0, !$t.target && !$t.link && ($t.target = bt);
491
+ const $t = u.get(m.get(Q) ?? ""), at = d.get(Q);
492
+ if (!$t || at === void 0) continue;
493
+ const St = $t.columns[at];
494
+ St.fk = !0, !St.target && !St.link && (St.target = wt);
495
495
  }
496
496
  S.push({
497
- id: `edge-${_.id}`,
498
- parent: bt,
499
- parentColumn: d.get(ft) ?? 0,
497
+ id: `edge-${M.id}`,
498
+ parent: wt,
499
+ parentColumn: d.get(mt) ?? 0,
500
500
  child: pt,
501
501
  childColumn: d.get(Et) ?? 0,
502
502
  many: lt.relation !== "1"
@@ -505,16 +505,16 @@ function Co(e) {
505
505
  }
506
506
  const k = Ao(
507
507
  c,
508
- S.map((_) => [_.parent, _.child])
509
- ), j = k.length ? k : c, T = [], D = j.reduce((_, A) => Math.max(_, A.x + A.width), Wt);
510
- let H = Wt;
511
- const K = D + Wt + Sn;
512
- for (const _ of Object.values(t.notes).sort((A, L) => A.id - L.id)) {
513
- const A = String(_.content ?? "").trim();
508
+ S.map((M) => [M.parent, M.child])
509
+ ), j = k.length ? k : c, T = [], D = j.reduce((M, A) => Math.max(M, A.x + A.width), Lt);
510
+ let H = Lt;
511
+ const K = D + Lt + Sn;
512
+ for (const M of Object.values(t.notes).sort((A, L) => A.id - L.id)) {
513
+ const A = String(M.content ?? "").trim();
514
514
  if (!A) continue;
515
515
  const L = {
516
- id: `note-${_.id}`,
517
- title: _.name ?? "",
516
+ id: `note-${M.id}`,
517
+ title: M.name ?? "",
518
518
  body: A,
519
519
  x: K,
520
520
  y: H,
@@ -525,17 +525,17 @@ function Co(e) {
525
525
  }
526
526
  jo([...j, ...T], an);
527
527
  const st = [];
528
- for (const _ of S) {
529
- const A = p.get(_.parent), L = p.get(_.child);
528
+ for (const M of S) {
529
+ const A = u.get(M.parent), L = u.get(M.child);
530
530
  if (!A || !L) continue;
531
531
  const ot = A.x + A.width / 2 <= L.x + L.width / 2 ? "r" : "l", lt = ot === "r" ? "l" : "r";
532
532
  st.push({
533
- id: _.id,
533
+ id: M.id,
534
534
  source: A.id,
535
- sourceHandle: `${ot}-${_.parentColumn}`,
535
+ sourceHandle: `${ot}-${M.parentColumn}`,
536
536
  target: L.id,
537
- targetHandle: `${lt}-${_.childColumn}`,
538
- many: _.many
537
+ targetHandle: `${lt}-${M.childColumn}`,
538
+ many: M.many
539
539
  });
540
540
  }
541
541
  return {
@@ -552,37 +552,37 @@ function Oo(e, t, n = "") {
552
552
  const s = e.match(/<script[^>]*\bsetup\b[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "", r = e.match(/<template>([\s\S]*)<\/template>/)?.[1] ?? "", i = `${s}
553
553
  ${n}`;
554
554
  let c = null;
555
- const p = /defineProps<\s*\{/.exec(s);
556
- if (p)
557
- c = Ht(s, p.index + p[0].length);
555
+ const u = /defineProps<\s*\{/.exec(s);
556
+ if (u)
557
+ c = Ut(s, u.index + u[0].length);
558
558
  else {
559
559
  const D = s.match(/defineProps<\s*([A-Za-z_$][\w$]*)\s*>/);
560
- D && (c = ie(i, D[1]));
560
+ D && (c = ae(i, D[1]));
561
561
  }
562
- const v = /* @__PURE__ */ new Map(), d = s.match(/(?:const|let)\s*\{([\s\S]*?)\}\s*=\s*(?:withDefaults\s*\(\s*)?defineProps/);
562
+ const b = /* @__PURE__ */ new Map(), d = s.match(/(?:const|let)\s*\{([\s\S]*?)\}\s*=\s*(?:withDefaults\s*\(\s*)?defineProps/);
563
563
  if (d)
564
- for (const D of Pe(d[1])) {
564
+ for (const D of je(d[1])) {
565
565
  const H = D.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
566
- H && v.set(H[1], wn(H[2]));
566
+ H && b.set(H[1], wn(H[2]));
567
567
  }
568
568
  const m = [];
569
569
  if (c)
570
- for (const D of Te(c)) {
571
- const H = Ne(
572
- ae(D.name, D.type, D.optional, i, D.description),
570
+ for (const D of Ne(c)) {
571
+ const H = Fe(
572
+ ce(D.name, D.type, D.optional, i, D.description),
573
573
  D
574
574
  );
575
- v.has(D.name) && (H.default = v.get(D.name)), m.push(H);
575
+ b.has(D.name) && (H.default = b.get(D.name)), m.push(H);
576
576
  }
577
577
  for (const D of s.matchAll(/\bdefineModel(?:<([^>]*)>)?\(\s*(?:['"]([\w-]+)['"])?/g)) {
578
578
  const H = D[2] ?? "modelValue";
579
- if (m.some((_) => _.name === H)) continue;
580
- const K = ae(H, D[1]?.trim() || "string", !0, i);
579
+ if (m.some((M) => M.name === H)) continue;
580
+ const K = ce(H, D[1]?.trim() || "string", !0, i);
581
581
  K.bindable = !0;
582
582
  const st = s.slice(0, D.index).match(/\/\*\*((?:[^*]|\*(?!\/))*)\*\/\s*(?:const|let)\s+[\w$]+\s*=\s*$/);
583
583
  if (st) {
584
- const _ = ws(st[1].replace(/^\s*\*\s?/gm, "").trim());
585
- _.description && (K.description = _.description), _.mock && !K.mock && (K.mock = _.mock);
584
+ const M = ws(st[1].replace(/^\s*\*\s?/gm, "").trim());
585
+ M.description && (K.description = M.description), M.mock && !K.mock && (K.mock = M.mock);
586
586
  }
587
587
  m.push(K);
588
588
  }
@@ -597,11 +597,11 @@ ${n}`;
597
597
  if (T >= 0) {
598
598
  const D = s.slice(T), H = D.search(/[<(]/);
599
599
  if (H >= 0) {
600
- const K = D[H], st = K === "<" ? ">" : ")", _ = Ht(D, H + 1, K, st), A = /* @__PURE__ */ new Set();
601
- for (const L of _.matchAll(/['"]([\w:.-]+)['"]\s*:\s*\[/g)) A.add(L[1]);
602
- for (const L of _.matchAll(/\(\s*\w+\s*:\s*['"]([\w:.-]+)['"]/g)) A.add(L[1]);
603
- for (const L of _.matchAll(/[,\[]\s*['"]([\w:.-]+)['"]\s*[,\]]/g)) A.add(L[1]);
604
- for (const L of _.matchAll(/(?:^|[\n;{,])\s*([A-Za-z_$][\w$]*)\s*:\s*\[/g)) A.add(L[1]);
600
+ const K = D[H], st = K === "<" ? ">" : ")", M = Ut(D, H + 1, K, st), A = /* @__PURE__ */ new Set();
601
+ for (const L of M.matchAll(/['"]([\w:.-]+)['"]\s*:\s*\[/g)) A.add(L[1]);
602
+ for (const L of M.matchAll(/\(\s*\w+\s*:\s*['"]([\w:.-]+)['"]/g)) A.add(L[1]);
603
+ for (const L of M.matchAll(/[,\[]\s*['"]([\w:.-]+)['"]\s*[,\]]/g)) A.add(L[1]);
604
+ for (const L of M.matchAll(/(?:^|[\n;{,])\s*([A-Za-z_$][\w$]*)\s*:\s*\[/g)) A.add(L[1]);
605
605
  j.push(...A);
606
606
  }
607
607
  }
@@ -611,26 +611,26 @@ ${n}`;
611
611
  }
612
612
  function Mo(e, t, n = "") {
613
613
  const s = e.match(/<script[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "", r = `${s}
614
- ${n}`, i = s.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$props\(\)/), c = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set();
614
+ ${n}`, i = s.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$props\(\)/), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set();
615
615
  if (i)
616
- for (const j of Pe(i[1])) {
616
+ for (const j of je(i[1])) {
617
617
  const T = j.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
618
618
  if (!T) continue;
619
619
  const D = T[2].trim().match(/^\$bindable\(([\s\S]*)\)$/);
620
- D && p.add(T[1]), c.set(T[1], wn(D ? D[1] : T[2]));
620
+ D && u.add(T[1]), c.set(T[1], wn(D ? D[1] : T[2]));
621
621
  }
622
- let v = null;
622
+ let b = null;
623
623
  const d = i?.[2]?.trim();
624
624
  if (d)
625
625
  if (d.startsWith("{"))
626
- v = Ht(d, 1);
626
+ b = Ut(d, 1);
627
627
  else {
628
628
  const j = d.match(/^([A-Za-z_$][\w$]*)/);
629
- j && (v = ie(r, j[1]));
629
+ j && (b = ae(r, j[1]));
630
630
  }
631
631
  const m = [], S = [], k = [];
632
- if (v)
633
- for (const j of Te(v)) {
632
+ if (b)
633
+ for (const j of Ne(b)) {
634
634
  if (/\bSnippet\b/.test(j.type)) {
635
635
  S.push({ name: j.name, kind: "slot", type: j.type, required: !j.optional });
636
636
  continue;
@@ -639,18 +639,18 @@ ${n}`, i = s.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$pr
639
639
  k.push(j.name);
640
640
  continue;
641
641
  }
642
- const T = Ne(
643
- ae(j.name, j.type, j.optional, r, j.description),
642
+ const T = Fe(
643
+ ce(j.name, j.type, j.optional, r, j.description),
644
644
  j
645
645
  );
646
- c.has(j.name) && (T.default = c.get(j.name)), p.has(j.name) && (T.bindable = !0), m.push(T);
646
+ c.has(j.name) && (T.default = c.get(j.name)), u.has(j.name) && (T.bindable = !0), m.push(T);
647
647
  }
648
648
  else if (i) {
649
- for (const j of Pe(i[1])) {
649
+ for (const j of je(i[1])) {
650
650
  const T = j.match(/^([A-Za-z_$][\w$]*)/)?.[1];
651
651
  if (!T || T === "children") continue;
652
652
  const D = { name: T, kind: "json", type: "unknown" };
653
- c.has(T) && (D.default = c.get(T)), p.has(T) && (D.bindable = !0), m.push(D);
653
+ c.has(T) && (D.default = c.get(T)), u.has(T) && (D.bindable = !0), m.push(D);
654
654
  }
655
655
  /\bchildren\b/.test(i[1]) && S.push({ name: "children", kind: "slot", type: "Snippet" });
656
656
  }
@@ -659,7 +659,7 @@ ${n}`, i = s.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$pr
659
659
  function Pn(e, t = []) {
660
660
  let n;
661
661
  try {
662
- n = le(e, { withFileTypes: !0 });
662
+ n = pe(e, { withFileTypes: !0 });
663
663
  } catch {
664
664
  return t;
665
665
  }
@@ -674,7 +674,7 @@ function Pn(e, t = []) {
674
674
  }
675
675
  function _o(e, t, n) {
676
676
  const s = W(e, "node_modules", t);
677
- if (!mt(s) || !re(s).isDirectory()) return null;
677
+ if (!dt(s) || !ie(s).isDirectory()) return null;
678
678
  const r = [
679
679
  `${n}.vue.d.ts`,
680
680
  `${n}.svelte.d.ts`,
@@ -682,16 +682,16 @@ function _o(e, t, n) {
682
682
  `${n.toLowerCase()}/index.d.ts`
683
683
  ], i = Pn(s);
684
684
  for (const c of r) {
685
- const p = i.find((v) => v.endsWith(`/${c}`));
686
- if (p) return p;
685
+ const u = i.find((b) => b.endsWith(`/${c}`));
686
+ if (u) return u;
687
687
  }
688
688
  return null;
689
689
  }
690
690
  function ti(e, t) {
691
- const n = ie(e, `${t}Props`) ?? ie(e, "Props");
691
+ const n = ae(e, `${t}Props`) ?? ae(e, "Props");
692
692
  if (!n) return;
693
693
  const s = [], r = [], i = [];
694
- for (const c of Te(n)) {
694
+ for (const c of Ne(n)) {
695
695
  if (/\bSnippet\b/.test(c.type)) {
696
696
  r.push({ name: c.name, kind: "slot", type: c.type, required: !c.optional });
697
697
  continue;
@@ -700,7 +700,7 @@ function ti(e, t) {
700
700
  i.push(c.name);
701
701
  continue;
702
702
  }
703
- s.push(Ne(ae(c.name, c.type, c.optional, e, c.description), c));
703
+ s.push(Fe(ce(c.name, c.type, c.optional, e, c.description), c));
704
704
  }
705
705
  return { component: t, props: s, slots: r, emits: i };
706
706
  }
@@ -709,28 +709,28 @@ function ve(e, t) {
709
709
  if (n < 0) return;
710
710
  const s = e.indexOf("{", n);
711
711
  if (s < 0) return;
712
- const r = Ht(e, s + 1);
712
+ const r = Ut(e, s + 1);
713
713
  try {
714
714
  return new Function(`return {${r}}`)();
715
715
  } catch {
716
716
  return;
717
717
  }
718
718
  }
719
- function be(e, t) {
719
+ function we(e, t) {
720
720
  const n = e.search(new RegExp(`\\b${t}\\s*:`));
721
721
  if (n < 0) return e;
722
722
  const s = e.indexOf("{", n);
723
723
  if (s < 0) return e;
724
- const r = Ht(e, s + 1);
724
+ const r = Ut(e, s + 1);
725
725
  return e.slice(0, n) + e.slice(s + 1 + r.length + 1);
726
726
  }
727
727
  function To(e, t) {
728
- const n = e.match(/^\s*\/\/\s*story:\s*(.+)$/m)?.[1]?.trim(), s = be(be(e, "props"), "slots"), r = ve(s, "sidebar"), i = be(s, "sidebar"), c = i.match(/\bname\s*:\s*['"]([^'"]+)['"]/)?.[1], p = i.match(/\bdescription\s*:\s*['"]([^'"]+)['"]/)?.[1], v = ve(e, "props"), d = ve(e, "slots");
728
+ const n = e.match(/^\s*\/\/\s*story:\s*(.+)$/m)?.[1]?.trim(), s = we(we(e, "props"), "slots"), r = ve(s, "sidebar"), i = we(s, "sidebar"), c = i.match(/\bname\s*:\s*['"]([^'"]+)['"]/)?.[1], u = i.match(/\bdescription\s*:\s*['"]([^'"]+)['"]/)?.[1], b = ve(e, "props"), d = ve(e, "slots");
729
729
  return {
730
- name: n ?? c ?? Ot(t).replace(/\.story\.tsx?$/, "").replace(/_/g, " "),
730
+ name: n ?? c ?? Mt(t).replace(/\.story\.tsx?$/, "").replace(/_/g, " "),
731
731
  file: t,
732
- description: p,
733
- props: v,
732
+ description: u,
733
+ props: b,
734
734
  slots: d,
735
735
  sidebar: r
736
736
  };
@@ -738,7 +738,7 @@ function To(e, t) {
738
738
  async function No(e) {
739
739
  let t;
740
740
  try {
741
- t = await Oe(e, { withFileTypes: !0 });
741
+ t = await Me(e, { withFileTypes: !0 });
742
742
  } catch {
743
743
  return [];
744
744
  }
@@ -747,7 +747,7 @@ async function No(e) {
747
747
  if (!s.isFile() || !s.name.match(/\.story\.tsx?$/)) continue;
748
748
  let r;
749
749
  try {
750
- r = await rt(W(e, s.name), "utf-8");
750
+ r = await it(W(e, s.name), "utf-8");
751
751
  } catch {
752
752
  continue;
753
753
  }
@@ -755,13 +755,13 @@ async function No(e) {
755
755
  }
756
756
  return n.sort((s, r) => s.name.localeCompare(r.name)), n;
757
757
  }
758
- function pe(e, t, n, s, r) {
758
+ function ue(e, t, n, s, r) {
759
759
  const i = t.systems[n];
760
760
  if (!i?.source) return null;
761
- const c = q(e, i.source), p = i.framework === "vue" ? ".vue" : ".svelte", v = r ? [q(c, r)] : [W(c, s, s + p), W(c, s + p)];
762
- for (const d of v) {
763
- if (!r && !d.startsWith(c) || !mt(d)) continue;
764
- const m = V(d);
761
+ const c = q(e, i.source), u = i.framework === "vue" ? ".vue" : ".svelte", b = r ? [q(c, r)] : [W(c, s, s + u), W(c, s + u)];
762
+ for (const d of b) {
763
+ if (!r && !d.startsWith(c) || !dt(d)) continue;
764
+ const m = G(d);
765
765
  return {
766
766
  systemConfig: i,
767
767
  componentFile: d,
@@ -774,7 +774,7 @@ function pe(e, t, n, s, r) {
774
774
  async function jn(e, t = []) {
775
775
  let n;
776
776
  try {
777
- n = await Oe(e, { withFileTypes: !0 });
777
+ n = await Me(e, { withFileTypes: !0 });
778
778
  } catch {
779
779
  return t;
780
780
  }
@@ -787,52 +787,52 @@ async function jn(e, t = []) {
787
787
  }
788
788
  return t;
789
789
  }
790
- async function Be(e, t) {
790
+ async function Re(e, t) {
791
791
  const n = q(e, t), s = await jn(n), r = [];
792
792
  for (const i of s) {
793
793
  let c;
794
794
  try {
795
- c = await rt(i, "utf-8");
795
+ c = await it(i, "utf-8");
796
796
  } catch {
797
797
  continue;
798
798
  }
799
- const { data: p } = _e(c);
800
- if (p?.type !== "component") continue;
801
- const v = p.data ?? {}, d = String(v.system ?? ""), m = String(v.component ?? "");
799
+ const { data: u } = Te(c);
800
+ if (u?.type !== "component") continue;
801
+ const b = u.data ?? {}, d = String(b.system ?? ""), m = String(b.component ?? "");
802
802
  !d || !m || r.push({
803
803
  pageFile: i,
804
804
  system: d,
805
805
  component: m,
806
- file: typeof v.file == "string" ? v.file : void 0,
807
- package: typeof v.package == "string" ? v.package : void 0,
808
- version: typeof v.version == "string" ? v.version : void 0
806
+ file: typeof b.file == "string" ? b.file : void 0,
807
+ package: typeof b.package == "string" ? b.package : void 0,
808
+ version: typeof b.version == "string" ? b.version : void 0
809
809
  });
810
810
  }
811
811
  return r;
812
812
  }
813
- function zt(e) {
813
+ function Gt(e) {
814
814
  const t = W(e, "schema.yml");
815
- if (mt(t)) return { path: t, form: "yml" };
815
+ if (dt(t)) return { path: t, form: "yml" };
816
816
  const n = W(e, "schema.json");
817
- return mt(n) ? { path: n, form: "json" } : null;
817
+ return dt(n) ? { path: n, form: "json" } : null;
818
818
  }
819
- function Gt(e, t) {
820
- return t === "yml" ? bn(e) : JSON.parse(e);
819
+ function Vt(e, t) {
820
+ return t === "yml" ? vn(e) : JSON.parse(e);
821
821
  }
822
- function Ut(e, t) {
822
+ function Jt(e, t) {
823
823
  return t === "yml" ? hs(e) : JSON.stringify(e, null, 2) + `
824
824
  `;
825
825
  }
826
- async function Re(e, t, n) {
826
+ async function We(e, t, n) {
827
827
  try {
828
- return await Xo(V(e), e, t, n);
828
+ return await Xo(G(e), e, t, n);
829
829
  } catch (s) {
830
830
  console.warn(`nimpress modules: schema parse failed for ${n}: ${String(s)}`);
831
831
  return;
832
832
  }
833
833
  }
834
834
  const Fo = ["description", "default", "enum", "mock", "format", "minimum", "maximum", "title"], Io = ["type", "tsType", "bindable"];
835
- function Lt(e, t) {
835
+ function Ht(e, t) {
836
836
  const n = { ...e }, s = n, r = t;
837
837
  for (const i of Io)
838
838
  r[i] !== void 0 && (s[i] = r[i]);
@@ -841,44 +841,44 @@ function Lt(e, t) {
841
841
  s[i] === void 0 && r[i] !== void 0 && (s[i] = r[i]);
842
842
  if (t.properties) {
843
843
  const i = {};
844
- for (const [c, p] of Object.entries(t.properties)) {
845
- const v = e.properties?.[c];
846
- i[c] = v ? Lt(v, p) : p;
844
+ for (const [c, u] of Object.entries(t.properties)) {
845
+ const b = e.properties?.[c];
846
+ i[c] = b ? Ht(b, u) : u;
847
847
  }
848
- for (const [c, p] of Object.entries(e.properties ?? {}))
849
- c in i || (i[c] = p);
848
+ for (const [c, u] of Object.entries(e.properties ?? {}))
849
+ c in i || (i[c] = u);
850
850
  n.properties = i;
851
851
  }
852
- return t.items && (n.items = e.items ? Lt(e.items, t.items) : t.items), t.additionalProperties && (n.additionalProperties = e.additionalProperties ? Lt(e.additionalProperties, t.additionalProperties) : t.additionalProperties), n;
852
+ return t.items && (n.items = e.items ? Ht(e.items, t.items) : t.items), t.additionalProperties && (n.additionalProperties = e.additionalProperties ? Ht(e.additionalProperties, t.additionalProperties) : t.additionalProperties), n;
853
853
  }
854
- function We(e, t) {
854
+ function Le(e, t) {
855
855
  const n = t, s = { added: [], missing: [] }, r = {};
856
- for (const [v, d] of Object.entries(n.properties ?? {})) {
857
- const m = e.properties?.[v];
858
- m ? r[v] = Lt(m, d) : (r[v] = d, s.added.push(v));
856
+ for (const [b, d] of Object.entries(n.properties ?? {})) {
857
+ const m = e.properties?.[b];
858
+ m ? r[b] = Ht(m, d) : (r[b] = d, s.added.push(b));
859
859
  }
860
- for (const [v, d] of Object.entries(e.properties ?? {}))
861
- v in r || (r[v] = d, s.missing.push(`prop ${v}`));
860
+ for (const [b, d] of Object.entries(e.properties ?? {}))
861
+ b in r || (r[b] = d, s.missing.push(`prop ${b}`));
862
862
  const i = {};
863
- for (const [v, d] of Object.entries(n.slots ?? {})) {
864
- const m = e.slots?.[v];
865
- i[v] = m ? Lt(m, d) : d;
863
+ for (const [b, d] of Object.entries(n.slots ?? {})) {
864
+ const m = e.slots?.[b];
865
+ i[b] = m ? Ht(m, d) : d;
866
866
  }
867
- for (const [v, d] of Object.entries(e.slots ?? {}))
868
- v in i || (i[v] = d, s.missing.push(`slot ${v}`));
867
+ for (const [b, d] of Object.entries(e.slots ?? {}))
868
+ b in i || (i[b] = d, s.missing.push(`slot ${b}`));
869
869
  const c = [...n.emits ?? []];
870
- for (const v of e.emits ?? [])
871
- c.includes(v) || (c.push(v), s.missing.push(`emit ${v}`));
870
+ for (const b of e.emits ?? [])
871
+ c.includes(b) || (c.push(b), s.missing.push(`emit ${b}`));
872
872
  return { merged: { ...e, ...t, properties: r, slots: i, emits: c }, report: s };
873
873
  }
874
- const It = [], cn = /* @__PURE__ */ new Set();
874
+ const Bt = [], cn = /* @__PURE__ */ new Set();
875
875
  function Bo(e) {
876
876
  return `${e.component}|${e.kind}|${e.path}`;
877
877
  }
878
878
  function ln(e) {
879
879
  for (const t of e) {
880
880
  const n = Bo(t);
881
- cn.has(n) || (cn.add(n), It.push(t));
881
+ cn.has(n) || (cn.add(n), Bt.push(t));
882
882
  }
883
883
  }
884
884
  const Ro = {
@@ -888,30 +888,30 @@ const Ro = {
888
888
  };
889
889
  function Wo(e) {
890
890
  const t = e.match(/^type (.+) is opaque$/);
891
- return t ? `${Ct}type${et} ${t[1]} ${Ct}is opaque${et}` : `${Ct}${e}${et}`;
891
+ return t ? `${Ot}type${et} ${t[1]} ${Ot}is opaque${et}` : `${Ot}${e}${et}`;
892
892
  }
893
- function Tt(e = process.cwd()) {
894
- if (!It.length) return;
893
+ function Nt(e = process.cwd()) {
894
+ if (!Bt.length) return;
895
895
  const t = /* @__PURE__ */ new Map();
896
- for (const c of It) {
897
- const p = t.get(c.component) ?? [];
898
- p.push(c), t.set(c.component, p);
896
+ for (const c of Bt) {
897
+ const u = t.get(c.component) ?? [];
898
+ u.push(c), t.set(c.component, u);
899
899
  }
900
- const n = It.length;
901
- It.length = 0;
900
+ const n = Bt.length;
901
+ Bt.length = 0;
902
902
  const s = n === 1 ? "schema warning" : "schema warnings", r = t.size === 1 ? "component" : "components", i = [""];
903
- i.push(` ${Pt}${ce}nimpress modules${et} ${Ct}${n} ${s} in ${t.size} ${r}${et}`), i.push("");
904
- for (const [c, p] of t) {
905
- const v = p.find((S) => S.sourceFile)?.sourceFile;
906
- i.push(` ${$n}${ce}${c}${et}${v ? ` ${se}${jt(e, v)}${et}` : ""}`);
907
- const d = Math.max(...p.map((S) => (S.line ? `L${S.line}` : "·").length)), m = Math.max(...p.map((S) => (S.path || "(component)").length));
908
- for (const S of p) {
903
+ i.push(` ${Pt}${le}nimpress modules${et} ${Ot}${n} ${s} in ${t.size} ${r}${et}`), i.push("");
904
+ for (const [c, u] of t) {
905
+ const b = u.find((S) => S.sourceFile)?.sourceFile;
906
+ i.push(` ${$n}${le}${c}${et}${b ? ` ${oe}${jt(e, b)}${et}` : ""}`);
907
+ const d = Math.max(...u.map((S) => (S.line ? `L${S.line}` : "·").length)), m = Math.max(...u.map((S) => (S.path || "(component)").length));
908
+ for (const S of u) {
909
909
  const k = (S.line ? `L${S.line}` : "·").padStart(d), j = (S.path || "(component)").padEnd(m);
910
- i.push(` ${Ct}${k}${et} ${Pt}${j}${et} ${Wo(S.detail)}`);
910
+ i.push(` ${Ot}${k}${et} ${Pt}${j}${et} ${Wo(S.detail)}`);
911
911
  }
912
- for (const S of new Set(p.map((k) => k.kind)))
913
- i.push(` ${Pt}→${et} ${se}${Ro[S]}${et}`);
914
- i.push(` ${Pt}→${et} ${se}then run${et} nimpress modules update ${c}`), i.push("");
912
+ for (const S of new Set(u.map((k) => k.kind)))
913
+ i.push(` ${Pt}→${et} ${oe}${Ro[S]}${et}`);
914
+ i.push(` ${Pt}→${et} ${oe}then run${et} nimpress modules update ${c}`), i.push("");
915
915
  }
916
916
  console.warn(i.join(`
917
917
  `));
@@ -929,7 +929,7 @@ function pn(e, t) {
929
929
  if (i.test(s[c])) return c + 1;
930
930
  }
931
931
  function un(e, t, n = {}) {
932
- const s = [], r = Fe(e, t);
932
+ const s = [], r = Ie(e, t);
933
933
  for (const i of r.props.filter((c) => !c.description))
934
934
  s.push({ component: e, sourceFile: n.sourceFile, line: pn(n.sourceText, i.name), path: i.name, detail: "has no description", kind: "undocumented" });
935
935
  for (const i of $s(r.props))
@@ -938,25 +938,25 @@ function un(e, t, n = {}) {
938
938
  s.push({ component: e, sourceFile: n.sourceFile, path: i, detail: "has no counterpart in the component source", kind: "orphan" });
939
939
  return s;
940
940
  }
941
- async function Le(e, t, n, s) {
941
+ async function He(e, t, n, s) {
942
942
  if (!n) return;
943
- const r = Ss(t, n.props, n.slots, n.emits), i = s ? await rt(s, "utf-8").catch(() => {
944
- }) : void 0, c = zt(e);
943
+ const r = Ss(t, n.props, n.slots, n.emits), i = s ? await it(s, "utf-8").catch(() => {
944
+ }) : void 0, c = Gt(e);
945
945
  if (!c) {
946
946
  const k = W(e, "schema.json");
947
- await nt(k, Ut(r, "json")), console.log(`nimpress modules: ${t} schema seeded at ${k} — the file is yours to author from here`), ln(un(t, r, { sourceFile: s, sourceText: i }));
947
+ await nt(k, Jt(r, "json")), console.log(`nimpress modules: ${t} schema seeded at ${k} — the file is yours to author from here`), ln(un(t, r, { sourceFile: s, sourceText: i }));
948
948
  return;
949
949
  }
950
- const p = await rt(c.path, "utf-8");
951
- let v;
950
+ const u = await it(c.path, "utf-8");
951
+ let b;
952
952
  try {
953
- v = Gt(p, c.form);
953
+ b = Vt(u, c.form);
954
954
  } catch (k) {
955
- console.warn(`nimpress modules: ${t} ${Ot(c.path)} failed to parse, left untouched: ${String(k)}`);
955
+ console.warn(`nimpress modules: ${t} ${Mt(c.path)} failed to parse, left untouched: ${String(k)}`);
956
956
  return;
957
957
  }
958
- const { merged: d, report: m } = We(v, r), S = Ut(d, c.form);
959
- if (S !== p) {
958
+ const { merged: d, report: m } = Le(b, r), S = Jt(d, c.form);
959
+ if (S !== u) {
960
960
  await nt(c.path, S);
961
961
  const k = m.added.length ? `, added ${m.added.join(", ")}` : "";
962
962
  console.log(`nimpress modules: ${t} schema upserted at ${c.path}${k}`);
@@ -967,27 +967,27 @@ const fn = /* @__PURE__ */ new Map();
967
967
  async function Lo(e, t, n, s) {
968
968
  let r;
969
969
  try {
970
- r = await rt(n, "utf-8");
970
+ r = await it(n, "utf-8");
971
971
  } catch {
972
972
  return;
973
973
  }
974
- const i = vn("sha1").update(r).digest("hex");
974
+ const i = bn("sha1").update(r).digest("hex");
975
975
  if (fn.get(n) === i) return;
976
976
  fn.set(n, i);
977
- const c = await Re(n, s, t);
978
- c && await Le(e, t, c, n);
977
+ const c = await We(n, s, t);
978
+ c && await He(e, t, c, n);
979
979
  }
980
980
  async function ei(e, t) {
981
- const n = zt(e);
981
+ const n = Gt(e);
982
982
  if (!n) {
983
- await nt(W(e, "schema.json"), Ut(t, "json"));
983
+ await nt(W(e, "schema.json"), Jt(t, "json"));
984
984
  return;
985
985
  }
986
- const s = await rt(n.path, "utf-8"), r = Gt(s, n.form), { merged: i } = We(t, r);
987
- await nt(n.path, Ut(i, n.form));
986
+ const s = await it(n.path, "utf-8"), r = Vt(s, n.form), { merged: i } = Le(t, r);
987
+ await nt(n.path, Jt(i, n.form));
988
988
  }
989
- function Ee(e) {
990
- const t = Me(e);
989
+ function De(e) {
990
+ const t = _e(e);
991
991
  return t === ".vue" ? "vue" : t === ".svelte" ? "svelte" : null;
992
992
  }
993
993
  function Ho(e, t, n) {
@@ -1002,12 +1002,12 @@ function Uo(e, t, n) {
1002
1002
  return e.find((s) => s.system === t && s.component === n);
1003
1003
  }
1004
1004
  async function Jo(e, t, n) {
1005
- const s = await Be(e, t.contentDir), r = q(e, n);
1006
- if ((n.includes("/") || n.includes("\\")) && mt(r)) {
1007
- const d = Ee(r);
1005
+ const s = await Re(e, t.contentDir), r = q(e, n);
1006
+ if ((n.includes("/") || n.includes("\\")) && dt(r)) {
1007
+ const d = De(r);
1008
1008
  if (!d)
1009
1009
  throw new Error(`[nimpress] modules: ${n} is not a .vue or .svelte component file`);
1010
- const m = Ot(r, Me(r)), S = Ho(e, t, r);
1010
+ const m = Mt(r, _e(r)), S = Ho(e, t, r);
1011
1011
  if (!S)
1012
1012
  throw new Error(`[nimpress] modules: ${n} sits under no configured system source`);
1013
1013
  const k = Uo(s, S, m);
@@ -1015,7 +1015,7 @@ async function Jo(e, t, n) {
1015
1015
  throw new Error(
1016
1016
  `[nimpress] modules: no component page found for ${S}/${m}, run nimpress modules create ${S} ${m} first`
1017
1017
  );
1018
- return { system: S, component: m, framework: d, componentFile: r, pageDir: V(k.pageFile) };
1018
+ return { system: S, component: m, framework: d, componentFile: r, pageDir: G(k.pageFile) };
1019
1019
  }
1020
1020
  const i = s.filter((d) => d.component === n);
1021
1021
  if (!i.length)
@@ -1024,42 +1024,42 @@ async function Jo(e, t, n) {
1024
1024
  const d = i.map((m) => `${m.system}/${m.component}`).join(", ");
1025
1025
  throw new Error(`[nimpress] modules: ${n} is ambiguous across ${d}, pass the component file path`);
1026
1026
  }
1027
- const c = i[0], p = pe(e, t.modules, c.system, c.component, c.file);
1028
- if (!p)
1027
+ const c = i[0], u = ue(e, t.modules, c.system, c.component, c.file);
1028
+ if (!u)
1029
1029
  throw new Error(
1030
1030
  `[nimpress] modules: no source file found for ${c.system}/${c.component}, the schema upsert needs the component source`
1031
1031
  );
1032
- const v = Ee(p.componentFile) ?? p.systemConfig.framework;
1032
+ const b = De(u.componentFile) ?? u.systemConfig.framework;
1033
1033
  return {
1034
1034
  system: c.system,
1035
1035
  component: c.component,
1036
- framework: v,
1037
- componentFile: p.componentFile,
1038
- pageDir: V(c.pageFile)
1036
+ framework: b,
1037
+ componentFile: u.componentFile,
1038
+ pageDir: G(c.pageFile)
1039
1039
  };
1040
1040
  }
1041
1041
  async function qo(e, t, n) {
1042
- const s = await Jo(e, t, n), r = await Re(s.componentFile, s.framework, s.component);
1042
+ const s = await Jo(e, t, n), r = await We(s.componentFile, s.framework, s.component);
1043
1043
  if (!r)
1044
1044
  throw new Error(`[nimpress] modules: schema parse produced nothing for ${s.component}`);
1045
- await Le(s.pageDir, s.component, r);
1046
- const i = zt(s.pageDir);
1045
+ await He(s.pageDir, s.component, r);
1046
+ const i = Gt(s.pageDir);
1047
1047
  return jt(e, i?.path ?? W(s.pageDir, "schema.json"));
1048
1048
  }
1049
1049
  async function ni(e, t, n = {}) {
1050
1050
  if (n.ref)
1051
1051
  return await qo(e, t, n.ref), 1;
1052
- const s = await Be(e, t.contentDir);
1052
+ const s = await Re(e, t.contentDir);
1053
1053
  let r = 0;
1054
1054
  for (const i of s) {
1055
1055
  if (n.system && i.system !== n.system) continue;
1056
- const c = pe(e, t.modules, i.system, i.component, i.file);
1056
+ const c = ue(e, t.modules, i.system, i.component, i.file);
1057
1057
  if (!c) {
1058
1058
  console.warn(`nimpress modules: no source for ${i.system}/${i.component}, skipped`);
1059
1059
  continue;
1060
1060
  }
1061
- const p = Ee(c.componentFile) ?? c.systemConfig.framework, v = await Re(c.componentFile, p, i.component);
1062
- v && (await Le(V(i.pageFile), i.component, v), r++);
1061
+ const u = De(c.componentFile) ?? c.systemConfig.framework, b = await We(c.componentFile, u, i.component);
1062
+ b && (await He(G(i.pageFile), i.component, b), r++);
1063
1063
  }
1064
1064
  return r;
1065
1065
  }
@@ -1067,7 +1067,7 @@ function zo(e) {
1067
1067
  let t = e;
1068
1068
  for (let n = 0; n < 8; n++) {
1069
1069
  if (t.endsWith("/src")) return t;
1070
- const s = V(t);
1070
+ const s = G(t);
1071
1071
  if (s === t) return null;
1072
1072
  t = s;
1073
1073
  }
@@ -1081,98 +1081,98 @@ async function Go(e, t, n) {
1081
1081
  const s = zo(e), r = /* @__PURE__ */ new Set([q(t)]), i = [{ file: t, text: n, depth: 0 }];
1082
1082
  let c = "";
1083
1083
  for (; i.length; ) {
1084
- const p = i.shift();
1085
- if (!p || p.depth >= 3) continue;
1086
- const v = mn(p.file, p.text);
1087
- for (const d of v.matchAll(/from\s+['"]([^'"]+)['"]/g)) {
1084
+ const u = i.shift();
1085
+ if (!u || u.depth >= 3) continue;
1086
+ const b = mn(u.file, u.text);
1087
+ for (const d of b.matchAll(/from\s+['"]([^'"]+)['"]/g)) {
1088
1088
  const m = d[1];
1089
1089
  let S = null;
1090
- if (m.startsWith(".") ? S = q(V(p.file), m) : m.startsWith("@/") && s && (S = q(s, m.slice(2))), !S || !vt(S)) continue;
1090
+ if (m.startsWith(".") ? S = q(G(u.file), m) : m.startsWith("@/") && s && (S = q(s, m.slice(2))), !S || !vt(S)) continue;
1091
1091
  const j = [S, `${S}.ts`, `${S}.vue`, W(S, "index.ts")].find((H) => Vo(H));
1092
1092
  if (!j) continue;
1093
1093
  const T = q(j);
1094
1094
  if (r.has(T) || r.size > 50) continue;
1095
1095
  r.add(T);
1096
- const D = await rt(j, "utf-8");
1096
+ const D = await it(j, "utf-8");
1097
1097
  c += mn(j, D) + `
1098
- `, i.push({ file: j, text: D, depth: p.depth + 1 });
1098
+ `, i.push({ file: j, text: D, depth: u.depth + 1 });
1099
1099
  }
1100
1100
  }
1101
1101
  return c;
1102
1102
  }
1103
1103
  function Vo(e) {
1104
1104
  try {
1105
- return re(e).isFile();
1105
+ return ie(e).isFile();
1106
1106
  } catch {
1107
1107
  return !1;
1108
1108
  }
1109
1109
  }
1110
1110
  async function Xo(e, t, n, s) {
1111
- const r = await rt(t, "utf-8");
1111
+ const r = await it(t, "utf-8");
1112
1112
  let i = "";
1113
- for (const p of le(e))
1114
- p.endsWith(".ts") && (p.endsWith(".stories.ts") || p.endsWith(".story.ts") || (i += await rt(W(e, p), "utf-8"), i += `
1113
+ for (const u of pe(e))
1114
+ u.endsWith(".ts") && (u.endsWith(".stories.ts") || u.endsWith(".story.ts") || (i += await it(W(e, u), "utf-8"), i += `
1115
1115
  `));
1116
1116
  i += await Go(e, t, r);
1117
1117
  const c = n === "vue" ? Oo(r, s, i) : Mo(r, s, i);
1118
- for (const p of c.props) {
1119
- if (!p.format) {
1120
- const v = xs(p);
1121
- v && (p.format = v);
1118
+ for (const u of c.props) {
1119
+ if (!u.format) {
1120
+ const b = xs(u);
1121
+ b && (u.format = b);
1122
1122
  }
1123
- p.mock || (p.mock = ks(p.name, Ps(p)));
1123
+ u.mock || (u.mock = ks(u.name, Ps(u)));
1124
1124
  }
1125
1125
  return c;
1126
1126
  }
1127
1127
  async function Yo(e) {
1128
- const { cwd: t, modules: n, pageFile: s, data: r, editable: i } = e, c = String(r.system ?? ""), p = String(r.component ?? ""), v = typeof r.file == "string" ? r.file : void 0, d = await No(V(s)), m = pe(t, n, c, p, v), S = [];
1128
+ const { cwd: t, modules: n, pageFile: s, data: r, editable: i } = e, c = String(r.system ?? ""), u = String(r.component ?? ""), b = typeof r.file == "string" ? r.file : void 0, d = await No(G(s)), m = ue(t, n, c, u, b), S = [];
1129
1129
  if (i && m) {
1130
- const _ = m.componentFile.endsWith(".svelte") ? "svelte" : "vue";
1130
+ const M = m.componentFile.endsWith(".svelte") ? "svelte" : "vue";
1131
1131
  try {
1132
- await Lo(V(s), p, m.componentFile, _);
1132
+ await Lo(G(s), u, m.componentFile, M);
1133
1133
  } catch (A) {
1134
- console.warn(`nimpress modules: ${c}/${p} schema upsert failed: ${String(A)}`);
1134
+ console.warn(`nimpress modules: ${c}/${u} schema upsert failed: ${String(A)}`);
1135
1135
  }
1136
1136
  }
1137
1137
  let k;
1138
- const j = zt(V(s));
1138
+ const j = Gt(G(s));
1139
1139
  if (j) {
1140
1140
  S.push(j.path);
1141
1141
  try {
1142
- k = Gt(await rt(j.path, "utf-8"), j.form);
1143
- } catch (_) {
1144
- console.warn(`nimpress modules: ${c}/${p} ${j.form} schema failed to parse: ${String(_)}`);
1142
+ k = Vt(await it(j.path, "utf-8"), j.form);
1143
+ } catch (M) {
1144
+ console.warn(`nimpress modules: ${c}/${u} ${j.form} schema failed to parse: ${String(M)}`);
1145
1145
  }
1146
1146
  } else
1147
1147
  console.warn(
1148
- `nimpress modules: ${c}/${p} has no schema file, controls stay empty, run nimpress modules update ${p}`
1148
+ `nimpress modules: ${c}/${u} has no schema file, controls stay empty, run nimpress modules update ${u}`
1149
1149
  );
1150
1150
  let T, D;
1151
1151
  if (m)
1152
- S.push(m.componentFile), D = jt(t, m.claudeMdPath), mt(m.claudeMdPath) && (T = await rt(m.claudeMdPath, "utf-8"), S.push(m.claudeMdPath));
1152
+ S.push(m.componentFile), D = jt(t, m.claudeMdPath), dt(m.claudeMdPath) && (T = await it(m.claudeMdPath, "utf-8"), S.push(m.claudeMdPath));
1153
1153
  else {
1154
- const _ = typeof r.package == "string" ? r.package : n.systems[c]?.package;
1155
- if (_) {
1156
- const A = _o(t, _, p);
1154
+ const M = typeof r.package == "string" ? r.package : n.systems[c]?.package;
1155
+ if (M) {
1156
+ const A = _o(t, M, u);
1157
1157
  if (A) {
1158
1158
  const L = A.replace(/[^/]+$/, "CLAUDE.md");
1159
- mt(L) && (T = await rt(L, "utf-8"));
1159
+ dt(L) && (T = await it(L, "utf-8"));
1160
1160
  }
1161
1161
  }
1162
1162
  }
1163
1163
  const H = r.schema && typeof r.schema == "object" && !Array.isArray(r.schema) ? r.schema : void 0;
1164
- H && (k = k ? We(H, k).merged : H);
1165
- const K = k ? Fe(p, k) : void 0, st = n.route.replace(/\/$/, "");
1164
+ H && (k = k ? Le(H, k).merged : H);
1165
+ const K = k ? Ie(u, k) : void 0, st = n.route.replace(/\/$/, "");
1166
1166
  return {
1167
1167
  data: {
1168
1168
  system: c,
1169
- component: p,
1169
+ component: u,
1170
1170
  package: typeof r.package == "string" ? r.package : void 0,
1171
1171
  version: typeof r.version == "string" ? r.version : void 0,
1172
1172
  claudeMd: T,
1173
1173
  claudeMdPath: D,
1174
1174
  editable: i && !!m,
1175
- harnessPath: `${st}/${encodeURIComponent(c)}/${encodeURIComponent(p)}/`,
1175
+ harnessPath: `${st}/${encodeURIComponent(c)}/${encodeURIComponent(u)}/`,
1176
1176
  schema: K,
1177
1177
  schemaPath: j ? jt(t, j.path) : void 0,
1178
1178
  stories: d
@@ -1191,25 +1191,25 @@ function si(e, t) {
1191
1191
  }
1192
1192
  function Ko(e) {
1193
1193
  const t = /* @__PURE__ */ new Map();
1194
- for (const p of Object.values(e))
1195
- p.type === "chunk" && t.set(p.fileName, p);
1196
- const n = /* @__PURE__ */ new Map(), s = [], r = [], i = (p) => {
1197
- const v = t.get(p);
1198
- return v ? v.facadeModuleId ?? Object.keys(v.modules)[0] ?? p : p;
1199
- }, c = (p) => {
1200
- n.set(p, 1), s.push(p);
1201
- for (const v of t.get(p)?.imports ?? []) {
1202
- if (!t.has(v)) continue;
1203
- const d = n.get(v);
1194
+ for (const u of Object.values(e))
1195
+ u.type === "chunk" && t.set(u.fileName, u);
1196
+ const n = /* @__PURE__ */ new Map(), s = [], r = [], i = (u) => {
1197
+ const b = t.get(u);
1198
+ return b ? b.facadeModuleId ?? Object.keys(b.modules)[0] ?? u : u;
1199
+ }, c = (u) => {
1200
+ n.set(u, 1), s.push(u);
1201
+ for (const b of t.get(u)?.imports ?? []) {
1202
+ if (!t.has(b)) continue;
1203
+ const d = n.get(b);
1204
1204
  if (d === 1) {
1205
- const m = s.slice(s.indexOf(v)).concat(v);
1205
+ const m = s.slice(s.indexOf(b)).concat(b);
1206
1206
  r.push({ chunks: m, modules: m.map(i) });
1207
- } else d || c(v);
1207
+ } else d || c(b);
1208
1208
  }
1209
- s.pop(), n.set(p, 2);
1209
+ s.pop(), n.set(u, 2);
1210
1210
  };
1211
- for (const p of t.keys())
1212
- n.get(p) || c(p);
1211
+ for (const u of t.keys())
1212
+ n.get(u) || c(u);
1213
1213
  return r;
1214
1214
  }
1215
1215
  function An() {
@@ -1220,7 +1220,7 @@ function An() {
1220
1220
  const n = Ko(t);
1221
1221
  if (!n.length) return;
1222
1222
  const s = n.map((r) => {
1223
- const i = r.chunks.join(" -> "), c = r.modules.map((p) => ` ${p}`).join(`
1223
+ const i = r.chunks.join(" -> "), c = r.modules.map((u) => ` ${u}`).join(`
1224
1224
  `);
1225
1225
  return ` ${i}
1226
1226
  ${c}`;
@@ -1234,13 +1234,13 @@ A module shared across chunks statically imports a component that got its own ch
1234
1234
  }
1235
1235
  };
1236
1236
  }
1237
- function He(e, t) {
1237
+ function Ue(e, t) {
1238
1238
  if (!t) return e;
1239
1239
  const n = { ...e };
1240
1240
  for (const [s, r] of Object.entries(t)) {
1241
1241
  if (r === void 0) continue;
1242
- const i = n[s], c = (p) => typeof p == "object" && p !== null && !Array.isArray(p);
1243
- c(i) && c(r) ? n[s] = He(i, r) : n[s] = r;
1242
+ const i = n[s], c = (u) => typeof u == "object" && u !== null && !Array.isArray(u);
1243
+ c(i) && c(r) ? n[s] = Ue(i, r) : n[s] = r;
1244
1244
  }
1245
1245
  return n;
1246
1246
  }
@@ -1265,17 +1265,17 @@ function oi(e) {
1265
1265
  ...r ? { rollupOptions: { input: r } } : {}
1266
1266
  }
1267
1267
  };
1268
- return He(i, s.vite);
1268
+ return Ue(i, s.vite);
1269
1269
  }
1270
- const Zo = 6161, De = "virtual:nimpress-harness/";
1271
- function Ae(e, t) {
1270
+ const Zo = 6161, Ae = "virtual:nimpress-harness/";
1271
+ function Ce(e, t) {
1272
1272
  const n = e.systems[t]?.port;
1273
1273
  if (n) return n;
1274
1274
  const s = Object.keys(e.systems).sort();
1275
1275
  return Zo + Math.max(0, s.indexOf(t));
1276
1276
  }
1277
1277
  function Cn(e, t) {
1278
- return `${De}${e}/${t}/entry`;
1278
+ return `${Ae}${e}/${t}/entry`;
1279
1279
  }
1280
1280
  function On() {
1281
1281
  return `const params = new URLSearchParams(location.search)
@@ -1472,7 +1472,7 @@ function Tn(e) {
1472
1472
  return e ? `import harnessSetup from ${JSON.stringify(e)}` : "const harnessSetup = null";
1473
1473
  }
1474
1474
  function Qo(e, t, n, s, r) {
1475
- const i = t.map((p) => `import ${JSON.stringify(p)}`).join(`
1475
+ const i = t.map((u) => `import ${JSON.stringify(u)}`).join(`
1476
1476
  `), c = s ? `import HarnessOverride from ${JSON.stringify(s)}` : "const HarnessOverride = null";
1477
1477
  return `import { createApp, h } from 'vue'
1478
1478
  import { DefaultHarness, ComponentStory, createHarnessContext, HARNESS_KEY } from '@nimtech/nimpress/harness/vue'
@@ -1566,7 +1566,7 @@ parent.postMessage({ type: 'nimpress:ready' }, '*')
1566
1566
  `;
1567
1567
  }
1568
1568
  function tr(e, t, n, s, r) {
1569
- const i = t.map((p) => `import ${JSON.stringify(p)}`).join(`
1569
+ const i = t.map((u) => `import ${JSON.stringify(u)}`).join(`
1570
1570
  `), c = s ? `import HarnessOverride from ${JSON.stringify(s)}` : "const HarnessOverride = null";
1571
1571
  return `import { mount, createRawSnippet } from 'svelte'
1572
1572
  import { DefaultHarness, HarnessRoot, createHarnessContext } from '@nimtech/nimpress/harness/svelte'
@@ -1633,14 +1633,14 @@ parent.postMessage({ type: 'nimpress:ready' }, '*')
1633
1633
  `;
1634
1634
  }
1635
1635
  function er(e) {
1636
- if (!e.schemaFile || !mt(e.schemaFile)) return {};
1636
+ if (!e.schemaFile || !dt(e.schemaFile)) return {};
1637
1637
  let t;
1638
1638
  try {
1639
- t = Gt(qt(e.schemaFile, "utf-8"), e.schemaFile.endsWith(".yml") ? "yml" : "json");
1639
+ t = Vt(zt(e.schemaFile, "utf-8"), e.schemaFile.endsWith(".yml") ? "yml" : "json");
1640
1640
  } catch {
1641
1641
  return {};
1642
1642
  }
1643
- const n = Fe(e.component, t), s = {};
1643
+ const n = Ie(e.component, t), s = {};
1644
1644
  for (const r of n.props) {
1645
1645
  if (!r.required) continue;
1646
1646
  const i = r.default !== void 0 ? r.default : js(r, 0);
@@ -1682,8 +1682,8 @@ ${s ? s + `
1682
1682
  }
1683
1683
  async function sr(e, t) {
1684
1684
  if (t === "svelte") {
1685
- const { svelte: p } = await import("@sveltejs/vite-plugin-svelte");
1686
- return p();
1685
+ const { svelte: u } = await import("@sveltejs/vite-plugin-svelte");
1686
+ return u();
1687
1687
  }
1688
1688
  const n = Ds(W(e, "package.json"));
1689
1689
  let s;
@@ -1694,7 +1694,7 @@ async function sr(e, t) {
1694
1694
  }
1695
1695
  const r = await import(tn(s).href), c = [(r.default ?? r)()];
1696
1696
  try {
1697
- const p = n.resolve("@vitejs/plugin-vue-jsx"), v = await import(tn(p).href), d = v.default ?? v;
1697
+ const u = n.resolve("@vitejs/plugin-vue-jsx"), b = await import(tn(u).href), d = b.default ?? b;
1698
1698
  c.push(d());
1699
1699
  } catch {
1700
1700
  }
@@ -1706,14 +1706,14 @@ function or(e, t, n, s) {
1706
1706
  const i = [];
1707
1707
  for (const c of s) {
1708
1708
  if (c.system !== n) continue;
1709
- const p = rr(c.pageFile), v = zt(V(c.pageFile))?.path ?? W(V(c.pageFile), "schema.json"), d = r.source ? pe(e, t, n, c.component, c.file) : null;
1709
+ const u = rr(c.pageFile), b = Gt(G(c.pageFile))?.path ?? W(G(c.pageFile), "schema.json"), d = r.source ? ue(e, t, n, c.component, c.file) : null;
1710
1710
  if (d) {
1711
- i.push({ component: c.component, importSpec: d.componentFile, storyFiles: p, schemaFile: v });
1711
+ i.push({ component: c.component, importSpec: d.componentFile, storyFiles: u, schemaFile: b });
1712
1712
  continue;
1713
1713
  }
1714
1714
  const m = c.package ?? r.package;
1715
1715
  if (m) {
1716
- i.push({ component: c.component, importSpec: m, named: !0, storyFiles: p, schemaFile: v });
1716
+ i.push({ component: c.component, importSpec: m, named: !0, storyFiles: u, schemaFile: b });
1717
1717
  continue;
1718
1718
  }
1719
1719
  console.warn(`[nimpress] modules: no source found for ${n}/${c.component}`);
@@ -1721,15 +1721,15 @@ function or(e, t, n, s) {
1721
1721
  return i;
1722
1722
  }
1723
1723
  function rr(e) {
1724
- const t = V(e);
1724
+ const t = G(e);
1725
1725
  let n;
1726
1726
  try {
1727
- n = le(t);
1727
+ n = pe(t);
1728
1728
  } catch {
1729
1729
  return [];
1730
1730
  }
1731
1731
  return n.filter((s) => s.endsWith(".story.ts") || s.endsWith(".story.tsx")).sort().map((s) => ({
1732
- base: s.endsWith(".story.tsx") ? Ot(s, ".story.tsx") : Ot(s, ".story.ts"),
1732
+ base: s.endsWith(".story.tsx") ? Mt(s, ".story.tsx") : Mt(s, ".story.ts"),
1733
1733
  path: W(t, s)
1734
1734
  }));
1735
1735
  }
@@ -1744,20 +1744,20 @@ function ar(e, t) {
1744
1744
  function cr(e, t, n, s, r) {
1745
1745
  const i = (t.css ?? []).map(
1746
1746
  (k) => k.startsWith(".") || vt(k) ? q(e, k) : k
1747
- ), c = ir(e, t), p = ar(e, t), v = new Map(s.map((k) => [k.component, k])), d = "\0" + De, m = (k) => {
1747
+ ), c = ir(e, t), u = ar(e, t), b = new Map(s.map((k) => [k.component, k])), d = "\0" + Ae, m = (k) => {
1748
1748
  if (!k.startsWith(d)) return null;
1749
1749
  const j = k.slice(d.length).split("/");
1750
1750
  return j[0] === n && j[1] ? j[1] : null;
1751
- }, S = (k) => nr(t.framework, k, i, c, p);
1751
+ }, S = (k) => nr(t.framework, k, i, c, u);
1752
1752
  return {
1753
1753
  name: "nimpress:harness",
1754
1754
  resolveId(k) {
1755
- return k.startsWith(d) ? k : k.startsWith(De) ? "\0" + k : null;
1755
+ return k.startsWith(d) ? k : k.startsWith(Ae) ? "\0" + k : null;
1756
1756
  },
1757
1757
  load(k) {
1758
1758
  const j = m(k);
1759
1759
  if (!j) return null;
1760
- const T = v.get(j);
1760
+ const T = b.get(j);
1761
1761
  return T ? S(T) : null;
1762
1762
  },
1763
1763
  configureServer(k) {
@@ -1766,17 +1766,17 @@ function cr(e, t, n, s, r) {
1766
1766
  if (!H) return D();
1767
1767
  const K = H.split("?")[0];
1768
1768
  if (!K.startsWith(r)) return D();
1769
- const st = K.slice(r.length).split("/").filter(Boolean), _ = st[0];
1770
- if (!_ || !v.has(_)) return D();
1769
+ const st = K.slice(r.length).split("/").filter(Boolean), M = st[0];
1770
+ if (!M || !b.has(M)) return D();
1771
1771
  const A = st.slice(1).join("/");
1772
1772
  if (A === "" || A === "index.html") {
1773
1773
  const L = ` <script type="module" src="${r}@vite/client"><\/script>
1774
- </head>`, ot = dn(_, "./entry.js", []).replace(" </head>", L);
1774
+ </head>`, ot = dn(M, "./entry.js", []).replace(" </head>", L);
1775
1775
  T.statusCode = 200, T.setHeader("Content-Type", "text/html"), T.end(ot);
1776
1776
  return;
1777
1777
  }
1778
1778
  if (A === "entry.js") {
1779
- const L = await k.transformRequest(Cn(n, _));
1779
+ const L = await k.transformRequest(Cn(n, M));
1780
1780
  if (!L) return D();
1781
1781
  T.statusCode = 200, T.setHeader("Content-Type", "application/javascript"), T.end(L.code);
1782
1782
  return;
@@ -1790,17 +1790,17 @@ function cr(e, t, n, s, r) {
1790
1790
  H.add(D);
1791
1791
  const st = j[D];
1792
1792
  if (!st || st.type !== "chunk") return;
1793
- const _ = st.viteMetadata;
1794
- for (const A of _?.importedCss ?? []) K.add(A);
1793
+ const M = st.viteMetadata;
1794
+ for (const A of M?.importedCss ?? []) K.add(A);
1795
1795
  for (const A of st.imports) T(A, H, K);
1796
1796
  };
1797
1797
  for (const D of Object.values(j)) {
1798
1798
  if (D.type !== "chunk" || !D.isEntry) continue;
1799
- const H = v.get(D.name);
1799
+ const H = b.get(D.name);
1800
1800
  if (!H) continue;
1801
1801
  const K = /* @__PURE__ */ new Set();
1802
1802
  T(D.fileName, /* @__PURE__ */ new Set(), K);
1803
- const st = [...K].map((_) => r + _);
1803
+ const st = [...K].map((M) => r + M);
1804
1804
  this.emitFile({
1805
1805
  type: "asset",
1806
1806
  fileName: `${H.component}/index.html`,
@@ -1813,15 +1813,15 @@ function cr(e, t, n, s, r) {
1813
1813
  async function ri(e, t, n, s) {
1814
1814
  const r = t.modules, i = r.systems[n];
1815
1815
  if (!i) throw new Error(`[nimpress] unknown module system: ${n}`);
1816
- const c = await Be(e, t.contentDir), p = or(e, r, n, c);
1817
- p.length || console.warn(`[nimpress] modules: no component pages found for system ${n}`);
1818
- const v = await sr(e, i.framework), d = i.source ? q(e, i.source) : e, m = r.route.replace(/\/$/, ""), S = `${m}/${n}/`, k = s === "build" ? dt(t.base, S) : S, j = p.filter((D) => vt(D.importSpec)).map((D) => D.importSpec).concat(p.flatMap((D) => (D.storyFiles ?? []).map((H) => H.path))), T = {
1816
+ const c = await Re(e, t.contentDir), u = or(e, r, n, c);
1817
+ u.length || console.warn(`[nimpress] modules: no component pages found for system ${n}`);
1818
+ const b = await sr(e, i.framework), d = i.source ? q(e, i.source) : e, m = r.route.replace(/\/$/, ""), S = `${m}/${n}/`, k = s === "build" ? gt(t.base, S) : S, j = u.filter((D) => vt(D.importSpec)).map((D) => D.importSpec).concat(u.flatMap((D) => (D.storyFiles ?? []).map((H) => H.path))), T = {
1819
1819
  root: e,
1820
1820
  configFile: !1,
1821
1821
  publicDir: !1,
1822
1822
  appType: "mpa",
1823
1823
  cacheDir: Dn(e, t, "modules", n),
1824
- plugins: [cr(e, i, n, p, k), v, An()],
1824
+ plugins: [cr(e, i, n, u, k), b, An()],
1825
1825
  resolve: i.framework === "vue" ? { alias: { vue: "vue/dist/vue.esm-bundler.js" } } : void 0,
1826
1826
  optimizeDeps: {
1827
1827
  entries: j,
@@ -1830,12 +1830,12 @@ async function ri(e, t, n, s) {
1830
1830
  },
1831
1831
  server: {
1832
1832
  host: "127.0.0.1",
1833
- port: Ae(r, n),
1833
+ port: Ce(r, n),
1834
1834
  strictPort: !0,
1835
1835
  fs: { allow: [e, d] },
1836
1836
  hmr: {
1837
1837
  host: "127.0.0.1",
1838
- clientPort: Ae(r, n)
1838
+ clientPort: Ce(r, n)
1839
1839
  }
1840
1840
  },
1841
1841
  build: {
@@ -1843,12 +1843,12 @@ async function ri(e, t, n, s) {
1843
1843
  emptyOutDir: !0,
1844
1844
  target: "es2022",
1845
1845
  rollupOptions: {
1846
- input: Object.fromEntries(p.map((D) => [D.component, Cn(n, D.component)]))
1846
+ input: Object.fromEntries(u.map((D) => [D.component, Cn(n, D.component)]))
1847
1847
  }
1848
1848
  },
1849
1849
  base: k
1850
1850
  };
1851
- return He(T, t.vite);
1851
+ return Ue(T, t.vite);
1852
1852
  }
1853
1853
  function lr(e, t = "virtual:nimpress/main") {
1854
1854
  return `<!doctype html>
@@ -1876,8 +1876,8 @@ function lr(e, t = "virtual:nimpress/main") {
1876
1876
  </html>
1877
1877
  `;
1878
1878
  }
1879
- const Kt = "virtual:nimpress/manifest", Zt = "virtual:nimpress/search", Qt = "virtual:nimpress/pages", te = "virtual:nimpress/bodies", we = "virtual:nimpress/config", $e = "virtual:nimpress/main", Nt = "virtual:nimpress/page-component/", Mt = "virtual:nimpress/page-body/", Se = 20, pr = "https://github.com/nimling/nimpress";
1880
- function ut(e) {
1879
+ const Zt = "virtual:nimpress/manifest", Qt = "virtual:nimpress/search", te = "virtual:nimpress/pages", ee = "virtual:nimpress/bodies", $e = "virtual:nimpress/config", Se = "virtual:nimpress/main", Ft = "virtual:nimpress/page-component/", _t = "virtual:nimpress/page-body/", xe = 20, pr = "https://github.com/nimling/nimpress";
1880
+ function ft(e) {
1881
1881
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1882
1882
  }
1883
1883
  function ur(e) {
@@ -1927,7 +1927,7 @@ const gn = [
1927
1927
  function fr(e) {
1928
1928
  return `<script type="application/ld+json">${(typeof e == "string" ? e : JSON.stringify(e)).replace(/</g, "\\u003c")}<\/script>`;
1929
1929
  }
1930
- const xe = (e) => e.visibility === "hidden", Dt = (e) => e.visibility === "hidden" || e.visibility === "dev-only", ee = (e) => e.visibility === "dev-only", mr = {
1930
+ const ke = (e) => e.visibility === "hidden", Dt = (e) => e.visibility === "hidden" || e.visibility === "dev-only", ne = (e) => e.visibility === "dev-only", mr = {
1931
1931
  milestone: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" x2="4" y1="22" y2="15"/></svg>',
1932
1932
  epic: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>',
1933
1933
  feature: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/><path d="M4 17v2"/><path d="M5 18H3"/></svg>',
@@ -1978,6 +1978,7 @@ const xe = (e) => e.visibility === "hidden", Dt = (e) => e.visibility === "hidde
1978
1978
  path: f.string().optional(),
1979
1979
  spec: f.string().optional(),
1980
1980
  gate: f.string().optional(),
1981
+ link: f.string().optional(),
1981
1982
  description: f.string().optional(),
1982
1983
  order: f.number().optional(),
1983
1984
  icon: f.string().optional(),
@@ -2003,34 +2004,36 @@ const xe = (e) => e.visibility === "hidden", Dt = (e) => e.visibility === "hidde
2003
2004
  function Fn(e, t = "x") {
2004
2005
  const n = [], s = Nn.safeParse(e);
2005
2006
  if (!s.success) {
2006
- for (const p of s.error.errors)
2007
- n.push(`${p.path.join(".") || "frontmatter"}: ${p.message}`);
2007
+ for (const u of s.error.errors)
2008
+ n.push(`${u.path.join(".") || "frontmatter"}: ${u.message}`);
2008
2009
  return n;
2009
2010
  }
2010
2011
  const r = s.data, i = r.data ?? {};
2012
+ if (r.link)
2013
+ return !r.title && !r.sidebar?.name && n.push("a link page needs a title or a sidebar.name for its label"), /^[a-z][a-z0-9+.-]*:\/\/|^mailto:|^tel:/i.test(r.link) || n.push("link: must be an absolute url"), t.trim() !== "" && n.push("a link page carries no body, the entry opens link instead of a page"), n;
2011
2014
  if (e.type === void 0 && t.trim() === "")
2012
2015
  return r.sidebar?.name || n.push("a page without a type and without a body needs a sidebar.name to decorate its group"), n;
2013
2016
  if (r.title || n.push("title: Required"), r.type === "openapi" && !r.spec && n.push("type openapi requires a spec field"), r.type === "dbml" && !r.spec && n.push("type dbml requires a spec field"), r.type === "changelog") {
2014
2017
  (i.version === void 0 || String(i.version).trim() === "") && n.push("changelog requires data.version"), (i.release_date === void 0 || Number.isNaN(new Date(String(i.release_date)).getTime())) && n.push("changelog requires a valid data.release_date");
2015
- const p = i.title === void 0 ? "" : String(i.title);
2016
- p.trim() || n.push("changelog requires data.title"), p.length > 48 && n.push("changelog data.title exceeds 48 characters"), p.includes(",") && n.push("changelog data.title must not contain a comma"), i.description !== void 0 && String(i.description).length > 160 && n.push("changelog data.description exceeds 160 characters");
2018
+ const u = i.title === void 0 ? "" : String(i.title);
2019
+ u.trim() || n.push("changelog requires data.title"), u.length > 48 && n.push("changelog data.title exceeds 48 characters"), u.includes(",") && n.push("changelog data.title must not contain a comma"), i.description !== void 0 && String(i.description).length > 160 && n.push("changelog data.description exceeds 160 characters");
2017
2020
  }
2018
2021
  return (r.type === "milestone" || r.type === "epic" || r.type === "feature" || r.type === "bug") && (r.description || n.push(`type ${r.type} requires a description`), (i.date === void 0 || Number.isNaN(new Date(String(i.date)).getTime())) && n.push(`type ${r.type} requires a valid data.date`)), r.type === "component" && ((i.system === void 0 || String(i.system).trim() === "") && n.push("type component requires data.system"), (i.component === void 0 || String(i.component).trim() === "") && n.push("type component requires data.component")), n;
2019
2022
  }
2020
2023
  function yr(e, t) {
2021
2024
  const n = String(e ?? "").replace(/^v/i, "").split(/[.\-+]/), s = String(t ?? "").replace(/^v/i, "").split(/[.\-+]/), r = Math.max(n.length, s.length);
2022
2025
  for (let i = 0; i < r; i++) {
2023
- const c = parseInt(n[i] ?? "0", 10) || 0, p = parseInt(s[i] ?? "0", 10) || 0;
2024
- if (c !== p) return c - p;
2026
+ const c = parseInt(n[i] ?? "0", 10) || 0, u = parseInt(s[i] ?? "0", 10) || 0;
2027
+ if (c !== u) return c - u;
2025
2028
  }
2026
2029
  return 0;
2027
2030
  }
2028
- function vr(e, t) {
2031
+ function br(e, t) {
2029
2032
  const n = jt(e, t).split(kt).join("/");
2030
2033
  if (!(!n || n.startsWith("..") || vt(n)))
2031
2034
  return `/${n}`;
2032
2035
  }
2033
- function br(e, t) {
2036
+ function vr(e, t) {
2034
2037
  const n = jt(e, t).split(kt).join("/");
2035
2038
  if (n.startsWith("..") || vt(n))
2036
2039
  throw new Error(
@@ -2053,10 +2056,10 @@ function yn(e) {
2053
2056
  let t = e.startsWith("/") ? e : "/" + e;
2054
2057
  return t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t;
2055
2058
  }
2056
- async function Ue(e, t = []) {
2059
+ async function Je(e, t = []) {
2057
2060
  let n;
2058
2061
  try {
2059
- n = await Oe(e, { withFileTypes: !0 });
2062
+ n = await Me(e, { withFileTypes: !0 });
2060
2063
  } catch {
2061
2064
  return t;
2062
2065
  }
@@ -2064,7 +2067,7 @@ async function Ue(e, t = []) {
2064
2067
  const r = W(e, s.name);
2065
2068
  if (s.isDirectory()) {
2066
2069
  if (s.name.startsWith(".") || s.name === "node_modules") continue;
2067
- await Ue(r, t);
2070
+ await Je(r, t);
2068
2071
  } else s.isFile() && s.name.endsWith(".md") && t.push(r);
2069
2072
  }
2070
2073
  return t;
@@ -2072,7 +2075,7 @@ async function Ue(e, t = []) {
2072
2075
  function In(e) {
2073
2076
  return e.toLowerCase().replace(/[^a-z0-9\s-]/g, "").trim().replace(/\s+/g, "-");
2074
2077
  }
2075
- function ke(e) {
2078
+ function Pe(e) {
2076
2079
  return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
2077
2080
  }
2078
2081
  function Sr(e, t = { route: "/_components" }, n = "/") {
@@ -2097,21 +2100,21 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
2097
2100
  }), r = (d, m, S, k, j) => j.renderToken(d, m, S), i = s.renderer.rules.link_open ?? r;
2098
2101
  s.renderer.rules.link_open = (d, m, S, k, j) => {
2099
2102
  const T = d[m].attrGet("href");
2100
- return T && d[m].attrSet("href", dt(n, T)), i(d, m, S, k, j);
2103
+ return T && d[m].attrSet("href", gt(n, T)), i(d, m, S, k, j);
2101
2104
  };
2102
2105
  const c = s.renderer.rules.image ?? r;
2103
2106
  s.renderer.rules.image = (d, m, S, k, j) => {
2104
2107
  const T = d[m].attrGet("src");
2105
- return T && d[m].attrSet("src", dt(n, T)), c(d, m, S, k, j);
2108
+ return T && d[m].attrSet("src", gt(n, T)), c(d, m, S, k, j);
2106
2109
  }, s.use(Qe, {
2107
2110
  slugify: In,
2108
2111
  permalink: Qe.permalink.headerLink({ safariReaderFix: !0 })
2109
2112
  }), s.use(ps), s.use(fs), s.use(ms), s.use(ds, { enabled: !0 });
2110
- const p = (d, m) => {
2113
+ const u = (d, m) => {
2111
2114
  s.use(us, d, m);
2112
- }, v = ["tip", "note", "warning", "info", "check"];
2113
- for (const d of v)
2114
- p(d, {
2115
+ }, b = ["tip", "note", "warning", "info", "check"];
2116
+ for (const d of b)
2117
+ u(d, {
2115
2118
  render(m, S) {
2116
2119
  if (m[S].nesting === 1) {
2117
2120
  const k = m[S].info.trim().slice(d.length).trim() || d;
@@ -2120,11 +2123,11 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
2120
2123
  return "</div></div>";
2121
2124
  }
2122
2125
  });
2123
- return p("cards", {
2126
+ return u("cards", {
2124
2127
  render(d, m) {
2125
2128
  return d[m].nesting === 1 ? '<div class="np-cards-grid">' : "</div>";
2126
2129
  }
2127
- }), p("details", {
2130
+ }), u("details", {
2128
2131
  validate(d) {
2129
2132
  return /^details\b/.test(d.trim());
2130
2133
  },
@@ -2137,45 +2140,45 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
2137
2140
  return `</div></details>
2138
2141
  `;
2139
2142
  }
2140
- }), p("code-group", {
2143
+ }), u("code-group", {
2141
2144
  render(d, m) {
2142
2145
  return d[m].nesting === 1 ? '<div class="np-code-group">' : "</div>";
2143
2146
  }
2144
- }), p("actions", {
2147
+ }), u("actions", {
2145
2148
  render(d, m) {
2146
2149
  if (d[m].nesting === 1) {
2147
- const S = d[m].info.trim().slice(7).trim(), k = S ? Bt(S, d[m].info) : {}, j = typeof k?.align == "string" ? k.align : "start";
2150
+ const S = d[m].info.trim().slice(7).trim(), k = S ? Rt(S, d[m].info) : {}, j = typeof k?.align == "string" ? k.align : "start";
2148
2151
  return `<div class="np-actions" data-align="${s.utils.escapeHtml(j)}">`;
2149
2152
  }
2150
2153
  return "</div>";
2151
2154
  }
2152
- }), p("features", {
2155
+ }), u("features", {
2153
2156
  render(d, m) {
2154
2157
  if (d[m].nesting === 1) {
2155
- const S = d[m].info.trim().slice(8).trim(), k = S ? Bt(S, d[m].info) : {}, j = typeof k?.columns == "number" ? k.columns : 0;
2158
+ const S = d[m].info.trim().slice(8).trim(), k = S ? Rt(S, d[m].info) : {}, j = typeof k?.columns == "number" ? k.columns : 0;
2156
2159
  return `<div class="np-features"${j > 0 ? ` data-columns="${j}"` : ""}>`;
2157
2160
  }
2158
2161
  return "</div>";
2159
2162
  }
2160
- }), p("feature", {
2163
+ }), u("feature", {
2161
2164
  render(d, m) {
2162
2165
  if (d[m].nesting === 1) {
2163
- const S = d[m].info.trim().slice(7).trim(), k = S ? Bt(S, d[m].info) : {};
2164
- return `<div class="np-feature" data-config="${Jt(JSON.stringify(k))}"><div class="np-feature-body">`;
2166
+ const S = d[m].info.trim().slice(7).trim(), k = S ? Rt(S, d[m].info) : {};
2167
+ return `<div class="np-feature" data-config="${qt(JSON.stringify(k))}"><div class="np-feature-body">`;
2165
2168
  }
2166
2169
  return "</div></div>";
2167
2170
  }
2168
- }), p("component", {
2171
+ }), u("component", {
2169
2172
  render(d, m) {
2170
2173
  if (d[m].nesting === 1) {
2171
- const S = d[m].info.trim().slice(9).trim(), k = S.startsWith("{") ? Bt(S, d[m].info) : S ? { component: S } : {};
2172
- return `<div class="np-component-embed" data-embed="${Jt(JSON.stringify({ ...t, ...k }))}"><div class="np-component-embed-body">`;
2174
+ const S = d[m].info.trim().slice(9).trim(), k = S.startsWith("{") ? Rt(S, d[m].info) : S ? { component: S } : {};
2175
+ return `<div class="np-component-embed" data-embed="${qt(JSON.stringify({ ...t, ...k }))}"><div class="np-component-embed-body">`;
2173
2176
  }
2174
2177
  return "</div></div>";
2175
2178
  }
2176
2179
  }), s;
2177
2180
  }
2178
- function Bt(e, t) {
2181
+ function Rt(e, t) {
2179
2182
  try {
2180
2183
  const n = JSON.parse(e);
2181
2184
  return n && typeof n == "object" && !Array.isArray(n) ? n : {};
@@ -2183,26 +2186,26 @@ function Bt(e, t) {
2183
2186
  return console.warn(`[nimpress] invalid JSON in directive: ${t}`), {};
2184
2187
  }
2185
2188
  }
2186
- function Jt(e) {
2189
+ function qt(e) {
2187
2190
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2188
2191
  }
2189
2192
  function xr(e) {
2190
2193
  return `<div class="np-mermaid" data-graph="${Buffer.from(e, "utf-8").toString("base64")}"></div>`;
2191
2194
  }
2192
2195
  function kr(e, t, n) {
2193
- const s = t.startsWith("{") ? Bt(t, t) : {};
2196
+ const s = t.startsWith("{") ? Rt(t, t) : {};
2194
2197
  let r = "", i = "";
2195
2198
  try {
2196
2199
  r = kn(e);
2197
2200
  } catch (d) {
2198
- i = d instanceof Ie ? d.message : String(d), console.warn(`[nimpress] invalid dbml in ${n}:
2201
+ i = d instanceof Be ? d.message : String(d), console.warn(`[nimpress] invalid dbml in ${n}:
2199
2202
  ${i}`);
2200
2203
  }
2201
- const c = Buffer.from(r, "utf-8").toString("base64"), p = typeof s.height == "string" ? s.height : "";
2204
+ const c = Buffer.from(r, "utf-8").toString("base64"), u = typeof s.height == "string" ? s.height : "";
2202
2205
  return `<div class="np-dbml" ${[
2203
2206
  `data-schema="${c}"`,
2204
- i ? `data-error="${Jt(i)}"` : "",
2205
- p ? `data-height="${Jt(p)}"` : ""
2207
+ i ? `data-error="${qt(i)}"` : "",
2208
+ u ? `data-height="${qt(u)}"` : ""
2206
2209
  ].filter(Boolean).join(" ")}></div>`;
2207
2210
  }
2208
2211
  function Pr(e, t) {
@@ -2215,10 +2218,10 @@ function Pr(e, t) {
2215
2218
  s.push(n[r]), r += 1;
2216
2219
  continue;
2217
2220
  }
2218
- const [, c, p, v] = i, d = new RegExp(`^\\s*\\${p[0]}{${p.length},}\\s*$`);
2221
+ const [, c, u, b] = i, d = new RegExp(`^\\s*\\${u[0]}{${u.length},}\\s*$`);
2219
2222
  let m = r + 1;
2220
2223
  for (; m < n.length && !d.test(n[m]); ) m += 1;
2221
- const S = v.trim(), k = S.split(/\s+/)[0].toLowerCase(), j = n.slice(r + 1, m).join(`
2224
+ const S = b.trim(), k = S.split(/\s+/)[0].toLowerCase(), j = n.slice(r + 1, m).join(`
2222
2225
  `);
2223
2226
  k === "mermaid" ? s.push(`${c}${xr(j && `${j}
2224
2227
  `)}`) : k === "dbml" ? s.push(`${c}${kr(j, S.slice(k.length).trim(), t)}`) : s.push(...n.slice(r, Math.min(m + 1, n.length))), r = m + 1;
@@ -2242,9 +2245,9 @@ function Er(e, t) {
2242
2245
  let r = 0;
2243
2246
  const i = /* @__PURE__ */ new Map();
2244
2247
  for (let c = 0; c < n.length; c++) {
2245
- const p = n[c];
2246
- if (p.type === "heading_open") {
2247
- const v = parseInt(p.tag.slice(1)), d = n[c + 1], m = jr(d) || `heading-${r++}`;
2248
+ const u = n[c];
2249
+ if (u.type === "heading_open") {
2250
+ const b = parseInt(u.tag.slice(1)), d = n[c + 1], m = jr(d) || `heading-${r++}`;
2248
2251
  let S = In(m);
2249
2252
  S || (S = `heading-${r++}`);
2250
2253
  const k = i.get(S);
@@ -2253,7 +2256,7 @@ function Er(e, t) {
2253
2256
  i.set(S, j), S = `${S}-${j}`;
2254
2257
  } else
2255
2258
  i.set(S, 0);
2256
- s.push({ level: v, text: m, slug: S });
2259
+ s.push({ level: b, text: m, slug: S });
2257
2260
  }
2258
2261
  }
2259
2262
  return s;
@@ -2261,22 +2264,22 @@ function Er(e, t) {
2261
2264
  function Dr(e) {
2262
2265
  return e.frontmatter.slug ?? e.frontmatter.title;
2263
2266
  }
2264
- function ne(e) {
2267
+ function se(e) {
2265
2268
  return e ? e.replace(/[-_]/g, " ").replace(/\b\w/g, (t) => t.toUpperCase()) : "";
2266
2269
  }
2267
- function Ce(e) {
2270
+ function Oe(e) {
2268
2271
  e.sort((t, n) => {
2269
2272
  const s = t.order ?? Number.MAX_SAFE_INTEGER, r = n.order ?? Number.MAX_SAFE_INTEGER;
2270
2273
  return s !== r ? s - r : t.text.localeCompare(n.text);
2271
2274
  });
2272
2275
  for (const t of e)
2273
- t.items && Ce(t.items);
2276
+ t.items && Oe(t.items);
2274
2277
  }
2275
2278
  function Ar(e) {
2276
- let t = Rt, n = q(process.cwd(), Rt.contentDir), s = q(process.cwd(), Rt.assetsDir), r = /* @__PURE__ */ new Map(), i = null, c = q(process.cwd(), "dist"), p = !1, v = null;
2279
+ let t = Wt, n = q(process.cwd(), Wt.contentDir), s = q(process.cwd(), Wt.assetsDir), r = /* @__PURE__ */ new Map(), i = null, c = q(process.cwd(), "dist"), u = !1, b = null;
2277
2280
  const d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Set();
2278
2281
  function T(o) {
2279
- return vn("sha1").update(o).digest("hex");
2282
+ return bn("sha1").update(o).digest("hex");
2280
2283
  }
2281
2284
  async function D() {
2282
2285
  return i || (i = await gs({
@@ -2306,12 +2309,12 @@ function Ar(e) {
2306
2309
  }), i);
2307
2310
  }
2308
2311
  function H(o, l) {
2309
- return /\.ya?ml$/i.test(l) ? bn(o) : JSON.parse(o);
2312
+ return /\.ya?ml$/i.test(l) ? vn(o) : JSON.parse(o);
2310
2313
  }
2311
2314
  async function K(o, l) {
2312
2315
  try {
2313
- const a = vt(l) ? l : q(V(o), l), h = await rt(a, "utf-8"), w = H(h, a);
2314
- return await st(w, V(a)), w;
2316
+ const a = vt(l) ? l : q(G(o), l), g = await it(a, "utf-8"), w = H(g, a);
2317
+ return await st(w, G(a)), w;
2315
2318
  } catch (a) {
2316
2319
  return console.warn(`[nimpress] failed to load spec ${l} for ${o}:`, a), null;
2317
2320
  }
@@ -2319,66 +2322,66 @@ function Ar(e) {
2319
2322
  async function st(o, l) {
2320
2323
  if (!o || typeof o != "object") return;
2321
2324
  o.components || (o.components = {}), o.components.schemas || (o.components.schemas = {});
2322
- const a = o.components.schemas, h = /* @__PURE__ */ new Map(), w = async (g) => {
2323
- const x = await rt(g, "utf-8");
2324
- return H(x, g);
2325
- }, y = async (g) => {
2326
- if (h.has(g)) return h.get(g);
2327
- const b = (g.split("/").pop() ?? "").replace(/\.json$/, "");
2328
- h.set(g, b);
2329
- const P = await w(g);
2330
- return await u(P, V(g)), a[b] = P, b;
2331
- }, u = async (g, x) => {
2332
- if (!g || typeof g != "object") return;
2333
- if (Array.isArray(g)) {
2334
- for (const P of g) await u(P, x);
2325
+ const a = o.components.schemas, g = /* @__PURE__ */ new Map(), w = async (y) => {
2326
+ const x = await it(y, "utf-8");
2327
+ return H(x, y);
2328
+ }, h = async (y) => {
2329
+ if (g.has(y)) return g.get(y);
2330
+ const v = (y.split("/").pop() ?? "").replace(/\.json$/, "");
2331
+ g.set(y, v);
2332
+ const P = await w(y);
2333
+ return await p(P, G(y)), a[v] = P, v;
2334
+ }, p = async (y, x) => {
2335
+ if (!y || typeof y != "object") return;
2336
+ if (Array.isArray(y)) {
2337
+ for (const P of y) await p(P, x);
2335
2338
  return;
2336
2339
  }
2337
- const b = g.$ref;
2338
- if (typeof b == "string" && !b.startsWith("#")) {
2339
- const P = vt(b) ? b : q(x, b), M = V(P).split("/").pop() ?? "";
2340
- if (M === "schemas") {
2341
- const $ = await y(P);
2342
- g.$ref = `#/components/schemas/${$}`;
2340
+ const v = y.$ref;
2341
+ if (typeof v == "string" && !v.startsWith("#")) {
2342
+ const P = vt(v) ? v : q(x, v), O = G(P).split("/").pop() ?? "";
2343
+ if (O === "schemas") {
2344
+ const $ = await h(P);
2345
+ y.$ref = `#/components/schemas/${$}`;
2343
2346
  return;
2344
2347
  }
2345
- if (M === "operations") {
2348
+ if (O === "operations") {
2346
2349
  const $ = await w(P);
2347
- await u($, V(P)), delete g.$ref;
2348
- for (const N of Object.keys($)) g[N] = $[N];
2350
+ await p($, G(P)), delete y.$ref;
2351
+ for (const N of Object.keys($)) y[N] = $[N];
2349
2352
  return;
2350
2353
  }
2351
2354
  return;
2352
2355
  }
2353
- for (const P of Object.keys(g))
2354
- await u(g[P], x);
2356
+ for (const P of Object.keys(y))
2357
+ await p(y[P], x);
2355
2358
  };
2356
- for (const g of Object.keys(a)) {
2357
- const x = a[g];
2359
+ for (const y of Object.keys(a)) {
2360
+ const x = a[y];
2358
2361
  if (x && typeof x == "object" && typeof x.$ref == "string" && !x.$ref.startsWith("#")) {
2359
- const b = vt(x.$ref) ? x.$ref : q(l, x.$ref);
2360
- h.set(b, g);
2361
- const P = await w(b);
2362
- await u(P, V(b)), a[g] = P;
2362
+ const v = vt(x.$ref) ? x.$ref : q(l, x.$ref);
2363
+ g.set(v, y);
2364
+ const P = await w(v);
2365
+ await p(P, G(v)), a[y] = P;
2363
2366
  }
2364
2367
  }
2365
- for (const g of Object.keys(o))
2366
- g !== "components" && await u(o[g], l);
2368
+ for (const y of Object.keys(o))
2369
+ y !== "components" && await p(o[y], l);
2367
2370
  }
2368
- function _(o, l) {
2371
+ function M(o, l) {
2369
2372
  if (typeof l != "string" || !l.startsWith("#/")) return null;
2370
2373
  const a = l.slice(2).split("/").map((w) => w.replace(/~1/g, "/").replace(/~0/g, "~"));
2371
- let h = o;
2374
+ let g = o;
2372
2375
  for (const w of a) {
2373
- if (h == null) return null;
2374
- h = h[w];
2376
+ if (g == null) return null;
2377
+ g = g[w];
2375
2378
  }
2376
- return h;
2379
+ return g;
2377
2380
  }
2378
2381
  function A(o, l, a = 0) {
2379
2382
  if (a > 4 || !o || typeof o != "object" || typeof o.$ref != "string") return o;
2380
- const h = _(l, o.$ref);
2381
- return h == null ? o : A(h, l, a + 1);
2383
+ const g = M(l, o.$ref);
2384
+ return g == null ? o : A(g, l, a + 1);
2382
2385
  }
2383
2386
  function L(o, l) {
2384
2387
  if (!(typeof l != "string" || l === ""))
@@ -2390,173 +2393,174 @@ function Ar(e) {
2390
2393
  }
2391
2394
  function ot(o, l) {
2392
2395
  if (!o) return null;
2393
- const a = o, h = a.info ?? {}, w = a.components?.securitySchemes ?? {}, y = ["get", "post", "put", "patch", "delete", "head", "options"], u = ($) => A($, a)?.example, g = /* @__PURE__ */ new Map(), x = a.paths ?? {};
2396
+ const a = o, g = a.info ?? {}, w = a.components?.securitySchemes ?? {}, h = ["get", "post", "put", "patch", "delete", "head", "options"], p = ($) => A($, a)?.example, y = /* @__PURE__ */ new Map(), x = a.paths ?? {};
2394
2397
  for (const [$, N] of Object.entries(x)) {
2395
- const F = A(N, a);
2396
- if (!F || typeof F != "object") continue;
2397
- const U = (F.parameters ?? []).map((C) => A(C, a));
2398
- for (const C of y) {
2399
- const I = F[C];
2400
- if (!I) continue;
2401
- const E = I.operationId ?? `${C}-${$.replace(/[^a-z0-9]+/gi, "-")}`, B = I.tags?.[0] ?? "default", z = (I.parameters ?? []).map((ht) => A(ht, a)), X = [...U, ...z], O = /* @__PURE__ */ new Set(), R = [];
2402
- for (const ht of X) {
2403
- const G = ht;
2404
- if (!G || typeof G != "object" || !G.name || !G.in) continue;
2405
- const gt = `${G.name}@${G.in}`;
2406
- O.has(gt) || (O.add(gt), R.push({
2407
- name: G.name,
2408
- in: G.in,
2409
- required: G.required,
2410
- schema: G.schema,
2411
- description: G.description,
2412
- description_html: L(l, G.description),
2413
- example: G.example ?? u(G.schema)
2398
+ const I = A(N, a);
2399
+ if (!I || typeof I != "object") continue;
2400
+ const U = (I.parameters ?? []).map((C) => A(C, a));
2401
+ for (const C of h) {
2402
+ const F = I[C];
2403
+ if (!F) continue;
2404
+ const E = F.operationId ?? `${C}-${$.replace(/[^a-z0-9]+/gi, "-")}`, R = F.tags?.[0] ?? "default", z = (F.parameters ?? []).map((ht) => A(ht, a)), V = [...U, ...z], _ = /* @__PURE__ */ new Set(), B = [];
2405
+ for (const ht of V) {
2406
+ const rt = ht;
2407
+ if (!rt || typeof rt != "object" || !rt.name || !rt.in) continue;
2408
+ const tt = `${rt.name}@${rt.in}`;
2409
+ _.has(tt) || (_.add(tt), B.push({
2410
+ name: rt.name,
2411
+ in: rt.in,
2412
+ required: rt.required,
2413
+ schema: rt.schema,
2414
+ description: rt.description,
2415
+ description_html: L(l, rt.description),
2416
+ example: rt.example ?? p(rt.schema)
2414
2417
  }));
2415
2418
  }
2416
- const J = I.requestBody ? A(I.requestBody, a) : void 0, tt = J?.content?.["application/json"], Y = tt?.example ?? (tt?.examples ? Object.values(tt.examples)[0]?.value : void 0) ?? u(tt?.schema), Z = {}, at = {};
2417
- for (const [ht, G] of Object.entries(I.responses ?? {})) {
2418
- const gt = A(G, a);
2419
- at[ht] = gt;
2420
- const xt = gt?.content?.["application/json"], Ke = xt?.example ?? (xt?.examples ? Object.values(xt.examples)[0]?.value : void 0) ?? u(xt?.schema);
2421
- Ke !== void 0 && (Z[ht] = Ke);
2419
+ const J = F.requestBody ? A(F.requestBody, a) : void 0, Z = J?.content?.["application/json"], X = Z?.example ?? (Z?.examples ? Object.values(Z.examples)[0]?.value : void 0) ?? p(Z?.schema), Y = {}, ct = {};
2420
+ for (const [ht, rt] of Object.entries(F.responses ?? {})) {
2421
+ const tt = A(rt, a);
2422
+ ct[ht] = tt;
2423
+ const bt = tt?.content?.["application/json"], Ct = bt?.example ?? (bt?.examples ? Object.values(bt.examples)[0]?.value : void 0) ?? p(bt?.schema);
2424
+ Ct !== void 0 && (Y[ht] = Ct);
2422
2425
  }
2423
- const ct = {
2426
+ const ut = {
2424
2427
  id: E,
2425
2428
  method: C.toUpperCase(),
2426
2429
  path: $,
2427
- tag: B,
2428
- summary: I.summary ?? E,
2429
- summary_html: L(l, I.summary),
2430
- description: I.description,
2431
- description_html: L(l, I.description),
2432
- parameters: R,
2430
+ tag: R,
2431
+ summary: F.summary ?? E,
2432
+ summary_html: L(l, F.summary),
2433
+ description: F.description,
2434
+ description_html: L(l, F.description),
2435
+ parameters: B,
2433
2436
  requestBody: J,
2434
2437
  requestBodyHtml: L(l, J?.description),
2435
- requestExample: Y,
2436
- responses: at,
2437
- responseExamples: Z,
2438
- security: I.security ?? a.security,
2439
- operationName: I.operationId
2438
+ requestExample: X,
2439
+ responses: ct,
2440
+ responseExamples: Y,
2441
+ security: F.security ?? a.security,
2442
+ operationName: F.operationId
2440
2443
  };
2441
- g.has(B) || g.set(B, []), g.get(B).push(ct);
2444
+ y.has(R) || y.set(R, []), y.get(R).push(ut);
2442
2445
  }
2443
2446
  }
2444
- const b = [...g.entries()].map(([$, N]) => ({ name: $, operations: N })).sort(($, N) => $.name.localeCompare(N.name)), P = a.components?.schemas ?? {}, M = {};
2447
+ const v = [...y.entries()].map(([$, N]) => ({ name: $, operations: N })).sort(($, N) => $.name.localeCompare(N.name)), P = a.components?.schemas ?? {}, O = {};
2445
2448
  for (const [$, N] of Object.entries(P)) {
2446
- const F = L(l, N?.description);
2447
- M[$] = F ? { ...N, description_html: F } : N;
2449
+ const I = L(l, N?.description);
2450
+ O[$] = I ? { ...N, description_html: I } : N;
2448
2451
  }
2449
2452
  return {
2450
- title: h.title ?? "API",
2451
- version: h.version ?? "",
2452
- description: h.description,
2453
- description_html: L(l, h.description),
2453
+ title: g.title ?? "API",
2454
+ version: g.version ?? "",
2455
+ description: g.description,
2456
+ description_html: L(l, g.description),
2454
2457
  servers: a.servers,
2455
2458
  securitySchemes: w,
2456
- tags: b,
2457
- schemas: M
2459
+ tags: v,
2460
+ schemas: O
2458
2461
  };
2459
2462
  }
2460
2463
  async function lt(o) {
2461
- const l = await rt(o, "utf-8"), { data: a, content: h } = _e(l), w = Fn(a, h);
2464
+ const l = await it(o, "utf-8"), { data: a, content: g } = Te(l), w = Fn(a, g);
2462
2465
  if (w.length) {
2463
- const G = `${o}
2466
+ const tt = `${o}
2464
2467
  ${w.join(`
2465
2468
  `)}`;
2466
- if (p) throw new Error(`[nimpress] invalid frontmatter in ${G}`);
2467
- console.warn(`[nimpress] invalid frontmatter in ${G}`);
2469
+ if (u) throw new Error(`[nimpress] invalid frontmatter in ${tt}`);
2470
+ console.warn(`[nimpress] invalid frontmatter in ${tt}`);
2468
2471
  }
2469
- const y = Nn.safeParse(a), u = y.success ? y.data : { title: o }, g = br(n, o), x = u.type ?? "doc", b = yn(u.path ?? $r(g)), P = a.type === void 0 && h.trim() === "", M = t.defaultFrontmatter ?? {};
2470
- if (!(t.defaultFrontmatterExclude ?? []).some((G) => {
2471
- const gt = G.startsWith("/") ? G : "/" + G;
2472
- return b === gt || b.startsWith(gt + "/");
2472
+ const h = Nn.safeParse(a), p = h.success ? h.data : { title: o }, y = vr(n, o), x = p.type ?? "doc", v = yn(p.path ?? $r(y)), P = typeof p.link == "string" && p.link.trim() !== "" ? p.link.trim() : void 0, O = !!P || a.type === void 0 && g.trim() === "", $ = t.defaultFrontmatter ?? {};
2473
+ if (!(t.defaultFrontmatterExclude ?? []).some((tt) => {
2474
+ const bt = tt.startsWith("/") ? tt : "/" + tt;
2475
+ return v === bt || v.startsWith(bt + "/");
2473
2476
  }))
2474
- for (const [G, gt] of Object.entries(M)) {
2475
- const xt = G;
2476
- (u[xt] === void 0 || u[xt] === null || u[xt] === "") && (u[xt] = gt);
2477
+ for (const [tt, bt] of Object.entries($)) {
2478
+ const Ct = tt;
2479
+ (p[Ct] === void 0 || p[Ct] === null || p[Ct] === "") && (p[Ct] = bt);
2477
2480
  }
2478
- const F = await D(), U = Sr(F, Q(), t.base), C = Pr(h, o), I = Er(U, C), E = U.render(C);
2479
- let B, z, X, O;
2481
+ const U = await D(), C = Sr(U, Q(), t.base), F = Pr(g, o), E = Er(C, F), R = C.render(F);
2482
+ let z, V, _, B;
2480
2483
  if (x === "openapi")
2481
- if (!u.spec)
2484
+ if (!p.spec)
2482
2485
  console.warn(`[nimpress] page ${o} has type openapi but no spec field`);
2483
2486
  else {
2484
- O = vt(u.spec) ? u.spec : q(V(o), u.spec), z = Ot(O), X = vr(n, O);
2485
- const G = await K(o, u.spec);
2486
- B = G ? ot(G, U) ?? void 0 : void 0;
2487
+ B = vt(p.spec) ? p.spec : q(G(o), p.spec), V = Mt(B), _ = br(n, B);
2488
+ const tt = await K(o, p.spec);
2489
+ z = tt ? ot(tt, C) ?? void 0 : void 0;
2487
2490
  }
2488
- let R, J, tt, Y;
2491
+ let J, Z, X, Y;
2489
2492
  if (x === "dbml")
2490
- if (!u.spec)
2493
+ if (!p.spec)
2491
2494
  console.warn(`[nimpress] page ${o} has type dbml but no spec field`);
2492
2495
  else {
2493
- O = vt(u.spec) ? u.spec : q(V(o), u.spec), tt = Ot(O);
2496
+ B = vt(p.spec) ? p.spec : q(G(o), p.spec), X = Mt(B);
2494
2497
  try {
2495
- J = await rt(O, "utf-8"), R = kn(J);
2496
- } catch (G) {
2497
- Y = G instanceof Ie ? G.message : String(G);
2498
- const gt = `${o} -> ${u.spec}
2498
+ Z = await it(B, "utf-8"), J = kn(Z);
2499
+ } catch (tt) {
2500
+ Y = tt instanceof Be ? tt.message : String(tt);
2501
+ const bt = `${o} -> ${p.spec}
2499
2502
  ${Y}`;
2500
- if (p) throw new Error(`[nimpress] invalid dbml in ${gt}`);
2501
- console.warn(`[nimpress] invalid dbml in ${gt}`);
2503
+ if (u) throw new Error(`[nimpress] invalid dbml in ${bt}`);
2504
+ console.warn(`[nimpress] invalid dbml in ${bt}`);
2502
2505
  }
2503
2506
  }
2504
- ft(o, O);
2505
- let Z, at = [];
2507
+ mt(o, B);
2508
+ let ct, ut = [];
2506
2509
  if (x === "component") {
2507
- const G = await Yo({
2510
+ const tt = await Yo({
2508
2511
  cwd: process.cwd(),
2509
2512
  modules: t.modules,
2510
2513
  pageFile: o,
2511
- data: u.data ?? {},
2512
- editable: !p
2514
+ data: p.data ?? {},
2515
+ editable: !u
2513
2516
  });
2514
- Z = G.data, at = G.watchFiles;
2517
+ ct = tt.data, ut = tt.watchFiles;
2515
2518
  }
2516
- Et(o, at);
2517
- const ct = o.replace(/\.md$/, ".css");
2518
- let ht;
2519
- return ct !== o && mt(ct) && (ht = await rt(ct, "utf-8")), {
2520
- slug: g,
2519
+ Et(o, ut);
2520
+ const ht = o.replace(/\.md$/, ".css");
2521
+ let rt;
2522
+ return ht !== o && dt(ht) && (rt = await it(ht, "utf-8")), {
2523
+ slug: y,
2521
2524
  filePath: o,
2522
- effectivePath: b,
2525
+ effectivePath: v,
2523
2526
  type: x,
2524
- sidebarOnly: P,
2525
- frontmatter: u,
2526
- html: E,
2527
- headings: I,
2528
- rawText: h,
2529
- pageCss: ht,
2530
- openApiSpec: B,
2531
- openApiFile: z,
2532
- openApiUrl: X,
2533
- componentData: Z,
2534
- dbmlSchema: R,
2535
- dbmlSource: J,
2536
- dbmlFile: tt,
2527
+ sidebarOnly: O,
2528
+ linkTo: P,
2529
+ frontmatter: p,
2530
+ html: R,
2531
+ headings: E,
2532
+ rawText: g,
2533
+ pageCss: rt,
2534
+ openApiSpec: z,
2535
+ openApiFile: V,
2536
+ openApiUrl: _,
2537
+ componentData: ct,
2538
+ dbmlSchema: J,
2539
+ dbmlSource: Z,
2540
+ dbmlFile: X,
2537
2541
  dbmlError: Y
2538
2542
  };
2539
2543
  }
2540
- function ft(o, l) {
2541
- for (const [a, h] of m)
2542
- h === o && m.delete(a);
2543
- l && (m.set(l, o), v && !S.has(l) && (v.watcher.add(l), S.add(l)));
2544
+ function mt(o, l) {
2545
+ for (const [a, g] of m)
2546
+ g === o && m.delete(a);
2547
+ l && (m.set(l, o), b && !S.has(l) && (b.watcher.add(l), S.add(l)));
2544
2548
  }
2545
2549
  function Et(o, l) {
2546
- for (const [a, h] of k)
2547
- h === o && k.delete(a);
2550
+ for (const [a, g] of k)
2551
+ g === o && k.delete(a);
2548
2552
  for (const a of l)
2549
- k.set(a, o), v && !j.has(a) && (v.watcher.add(a), j.add(a));
2553
+ k.set(a, o), b && !j.has(a) && (b.watcher.add(a), j.add(a));
2550
2554
  }
2551
- async function bt(o) {
2555
+ async function wt(o) {
2552
2556
  let l;
2553
2557
  try {
2554
- l = await rt(o, "utf-8");
2558
+ l = await it(o, "utf-8");
2555
2559
  } catch {
2556
2560
  return null;
2557
2561
  }
2558
- const a = T(l), h = d.get(o);
2559
- if (h && h.hash === a) return h.processed;
2562
+ const a = T(l), g = d.get(o);
2563
+ if (g && g.hash === a) return g.processed;
2560
2564
  const w = await lt(o);
2561
2565
  return w ? (d.set(o, { hash: a, processed: w }), w) : (d.delete(o), null);
2562
2566
  }
@@ -2570,83 +2574,83 @@ function Ar(e) {
2570
2574
  system: o.length === 1 ? o[0] : void 0
2571
2575
  };
2572
2576
  }
2573
- function wt(o) {
2577
+ function $t(o) {
2574
2578
  const l = t.exclude ?? [];
2575
2579
  for (const a of l) {
2576
- const h = a.replace(/\/$/, "");
2577
- if (o === h || o.startsWith(h + "/")) return !0;
2580
+ const g = a.replace(/\/$/, "");
2581
+ if (o === g || o.startsWith(g + "/")) return !0;
2578
2582
  }
2579
2583
  return !1;
2580
2584
  }
2581
- async function it() {
2582
- const o = await Ue(n), l = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), u = [], g = new Set(o);
2585
+ async function at() {
2586
+ const o = await Je(n), l = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), p = [], y = new Set(o);
2583
2587
  for (const x of [...d.keys()])
2584
- g.has(x) || d.delete(x);
2588
+ y.has(x) || d.delete(x);
2585
2589
  for (const x of o) {
2586
- let b = null;
2590
+ let v = null;
2587
2591
  try {
2588
- b = await bt(x);
2589
- } catch (M) {
2590
- console.warn(`[nimpress] failed to process ${x}:`, M);
2592
+ v = await wt(x);
2593
+ } catch (O) {
2594
+ console.warn(`[nimpress] failed to process ${x}:`, O);
2591
2595
  continue;
2592
2596
  }
2593
- if (!b || wt(b.slug)) continue;
2594
- if (u.push(b), b.type === "changelog") {
2595
- const $ = `${wr(b.slug)}\0${b.frontmatter.title}`, N = h.get($) ?? [];
2596
- N.push(b), h.set($, N);
2597
+ if (!v || $t(v.slug)) continue;
2598
+ if (p.push(v), v.type === "changelog") {
2599
+ const $ = `${wr(v.slug)}\0${v.frontmatter.title}`, N = g.get($) ?? [];
2600
+ N.push(v), g.set($, N);
2597
2601
  continue;
2598
2602
  }
2599
- if (b.type === "roadmap") {
2600
- const M = String(b.filePath);
2601
- w.set(M, [b]);
2603
+ if (v.type === "roadmap") {
2604
+ const O = String(v.filePath);
2605
+ w.set(O, [v]);
2602
2606
  }
2603
- if (b.type === "component") {
2604
- const M = V(b.filePath), $ = y.get(M);
2607
+ if (v.type === "component") {
2608
+ const O = G(v.filePath), $ = h.get(O);
2605
2609
  if ($)
2606
2610
  throw new Error(
2607
- `[nimpress] one type component page per folder: ${M} holds ${$} and ${b.filePath}`
2611
+ `[nimpress] one type component page per folder: ${O} holds ${$} and ${v.filePath}`
2608
2612
  );
2609
- y.set(M, b.filePath);
2613
+ h.set(O, v.filePath);
2610
2614
  }
2611
- const P = a.get(b.effectivePath);
2615
+ const P = a.get(v.effectivePath);
2612
2616
  if (P)
2613
2617
  throw new Error(
2614
- `[nimpress] duplicate path ${b.effectivePath}: ${P} and ${b.filePath}`
2618
+ `[nimpress] duplicate path ${v.effectivePath}: ${P} and ${v.filePath}`
2615
2619
  );
2616
- a.set(b.effectivePath, b.filePath), l.set(b.slug, b);
2620
+ a.set(v.effectivePath, v.filePath), l.set(v.slug, v);
2617
2621
  }
2618
- ue.clear();
2619
- for (const [x, b] of h) {
2620
- const P = x.split("\0", 1)[0], M = yn(P ? "/" + P : "/");
2621
- if (a.has(M))
2622
+ fe.clear();
2623
+ for (const [x, v] of g) {
2624
+ const P = x.split("\0", 1)[0], O = yn(P ? "/" + P : "/");
2625
+ if (a.has(O))
2622
2626
  throw new Error(
2623
- `[nimpress] path ${M} is occupied by both a changelog collection and a regular page`
2627
+ `[nimpress] path ${O} is occupied by both a changelog collection and a regular page`
2624
2628
  );
2625
- const $ = b.filter((E) => !(p && Dt(E.frontmatter)));
2629
+ const $ = v.filter((E) => !(u && Dt(E.frontmatter)));
2626
2630
  if ($.length === 0) continue;
2627
- $.sort((E, B) => {
2628
- const z = String(E.frontmatter.data?.version ?? ""), X = String(B.frontmatter.data?.version ?? "");
2629
- return yr(X, z);
2631
+ $.sort((E, R) => {
2632
+ const z = String(E.frontmatter.data?.version ?? ""), V = String(R.frontmatter.data?.version ?? "");
2633
+ return yr(V, z);
2630
2634
  });
2631
- const N = $[0], F = `__changelog__${(P || "root").replace(/\//g, "__")}`, U = $.map((E) => {
2632
- const B = E.frontmatter.data, z = String(B?.version ?? ""), X = String(B?.title ?? ""), O = B?.description !== void 0 ? String(B.description) : void 0, R = B?.release_date;
2635
+ const N = $[0], I = `__changelog__${(P || "root").replace(/\//g, "__")}`, U = $.map((E) => {
2636
+ const R = E.frontmatter.data, z = String(R?.version ?? ""), V = String(R?.title ?? ""), _ = R?.description !== void 0 ? String(R.description) : void 0, B = R?.release_date;
2633
2637
  let J;
2634
- if (R != null && String(R).trim() !== "") {
2635
- const Y = R instanceof Date ? R.toISOString() : String(R), Z = new Date(Y);
2636
- if (Number.isNaN(Z.getTime()))
2638
+ if (B != null && String(B).trim() !== "") {
2639
+ const X = B instanceof Date ? B.toISOString() : String(B), Y = new Date(X);
2640
+ if (Number.isNaN(Y.getTime()))
2637
2641
  throw new Error(
2638
- `[nimpress] changelog entry ${E.filePath} has an invalid data.release_date (${Y}). Use an RFC 3339 timestamp like 2026-06-10 or 2026-06-10T09:00:00Z.`
2642
+ `[nimpress] changelog entry ${E.filePath} has an invalid data.release_date (${X}). Use an RFC 3339 timestamp like 2026-06-10 or 2026-06-10T09:00:00Z.`
2639
2643
  );
2640
- J = Z.toISOString();
2644
+ J = Y.toISOString();
2641
2645
  }
2642
- const tt = z ? `v${z}` : "unreleased";
2643
- return ue.set(`${F}#${tt}`, E.rawText), {
2646
+ const Z = z ? `v${z}` : "unreleased";
2647
+ return fe.set(`${I}#${Z}`, E.rawText), {
2644
2648
  version: z,
2645
- slug: tt,
2646
- title: X,
2647
- description: O,
2649
+ slug: Z,
2650
+ title: V,
2651
+ description: _,
2648
2652
  releaseDate: J,
2649
- hidden: ee(E.frontmatter),
2653
+ hidden: ne(E.frontmatter),
2650
2654
  html: E.html,
2651
2655
  headings: E.headings,
2652
2656
  data: E.frontmatter.data
@@ -2655,14 +2659,14 @@ function Ar(e) {
2655
2659
  level: 2,
2656
2660
  text: E.version ? `v${E.version}` : E.title || "unreleased",
2657
2661
  slug: E.slug
2658
- })), I = {
2659
- slug: F,
2662
+ })), F = {
2663
+ slug: I,
2660
2664
  filePath: N.filePath,
2661
- effectivePath: M,
2665
+ effectivePath: O,
2662
2666
  type: "changelog",
2663
2667
  frontmatter: {
2664
2668
  ...N.frontmatter,
2665
- path: M,
2669
+ path: O,
2666
2670
  type: "changelog",
2667
2671
  rss: $.some((E) => E.frontmatter.rss === !0) ? !0 : void 0,
2668
2672
  subscribe: $.some((E) => E.frontmatter.subscribe === !0) ? !0 : void 0
@@ -2674,39 +2678,39 @@ function Ar(e) {
2674
2678
  `),
2675
2679
  changelogEntries: U
2676
2680
  };
2677
- a.set(M, I.filePath), l.set(I.slug, I);
2681
+ a.set(O, F.filePath), l.set(F.slug, F);
2678
2682
  }
2679
- Yn(w, u), Rn(l), Bn(l), r = l;
2683
+ Yn(w, p), Rn(l), Bn(l), r = l;
2680
2684
  }
2681
- const $t = /* @__PURE__ */ new Map(), ue = /* @__PURE__ */ new Map();
2682
- let fe = JSON.stringify({ pages: [] }, null, 2) + `
2685
+ const St = /* @__PURE__ */ new Map(), fe = /* @__PURE__ */ new Map();
2686
+ let me = JSON.stringify({ pages: [] }, null, 2) + `
2683
2687
  `;
2684
2688
  function Bn(o) {
2685
2689
  const l = [];
2686
2690
  for (const a of o.values()) {
2687
- if (a.frontmatter.subscribe !== !0 || xe(a.frontmatter)) continue;
2688
- const h = a.effectivePath === "/" ? "" : a.effectivePath, y = `${yt(a) ? `/${t.paths.guarded}/${Vt(a)}` : ""}${h}/${hn(0)}`;
2689
- if (!$t.has(y)) continue;
2690
- const u = {
2691
+ if (a.frontmatter.subscribe !== !0 || ke(a.frontmatter)) continue;
2692
+ const g = a.effectivePath === "/" ? "" : a.effectivePath, h = `${yt(a) ? `/${t.paths.guarded}/${Xt(a)}` : ""}${g}/${hn(0)}`;
2693
+ if (!St.has(h)) continue;
2694
+ const p = {
2691
2695
  path: a.effectivePath,
2692
2696
  title: a.frontmatter.title,
2693
2697
  name: a.effectivePath === "/" ? "index" : a.effectivePath.replace(/\//g, "-").replace(/^-/, ""),
2694
- feed: y
2698
+ feed: h
2695
2699
  };
2696
- a.type === "changelog" && (u.entries = (a.changelogEntries ?? []).filter((g) => !g.hidden).map((g) => ({
2697
- slug: g.slug,
2698
- version: g.version,
2699
- date: g.releaseDate,
2700
- title: g.title,
2701
- description: g.description,
2702
- body: ue.get(`${a.slug}#${g.slug}`) ?? ""
2703
- }))), l.push(u);
2704
- }
2705
- l.sort((a, h) => a.path.localeCompare(h.path)), fe = JSON.stringify({ pages: l }, null, 2) + `
2700
+ a.type === "changelog" && (p.entries = (a.changelogEntries ?? []).filter((y) => !y.hidden).map((y) => ({
2701
+ slug: y.slug,
2702
+ version: y.version,
2703
+ date: y.releaseDate,
2704
+ title: y.title,
2705
+ description: y.description,
2706
+ body: fe.get(`${a.slug}#${y.slug}`) ?? ""
2707
+ }))), l.push(p);
2708
+ }
2709
+ l.sort((a, g) => a.path.localeCompare(g.path)), me = JSON.stringify({ pages: l }, null, 2) + `
2706
2710
  `;
2707
2711
  }
2708
2712
  function Rn(o) {
2709
- $t.clear();
2713
+ St.clear();
2710
2714
  const l = t.site?.url?.replace(/\/$/, "");
2711
2715
  for (const a of o.values()) {
2712
2716
  if (a.type !== "changelog" || !(a.frontmatter.rss === !0 || a.frontmatter.subscribe === !0)) continue;
@@ -2714,88 +2718,88 @@ function Ar(e) {
2714
2718
  console.warn(`[nimpress] changelog feed for ${a.effectivePath} needs site.url in the config, skipping`);
2715
2719
  continue;
2716
2720
  }
2717
- const h = (a.changelogEntries ?? []).filter((E) => !E.hidden);
2718
- if (h.length === 0) continue;
2719
- const w = a.effectivePath === "/" ? "" : a.effectivePath, y = `${l}${dt(t.base, w || "/")}`, u = yt(a) ? `/${t.paths.guarded}/${Vt(a)}` : "", g = (E) => `${u}${w}/${hn(E)}`, x = h.map((E) => E.releaseDate ? new Date(E.releaseDate).getTime() : Number.NaN).filter((E) => !Number.isNaN(E)).sort((E, B) => B - E), b = [];
2720
- for (let E = 0; E + 1 < x.length; E++) b.push(x[E] - x[E + 1]);
2721
- const P = b.length ? Math.round(b.reduce((E, B) => E + B, 0) / b.length / 1e3) : void 0, M = P ? Math.min(43200, Math.max(60, Math.round(P / 60))) : 1440, $ = P ? P <= 172800 ? "daily" : P <= 1209600 ? "weekly" : P <= 5184e3 ? "monthly" : "yearly" : "weekly", N = x.length ? new Date(x[0]).toUTCString() : void 0, F = ut(a.frontmatter.title), U = ut(
2721
+ const g = (a.changelogEntries ?? []).filter((E) => !E.hidden);
2722
+ if (g.length === 0) continue;
2723
+ const w = a.effectivePath === "/" ? "" : a.effectivePath, h = `${l}${gt(t.base, w || "/")}`, p = yt(a) ? `/${t.paths.guarded}/${Xt(a)}` : "", y = (E) => `${p}${w}/${hn(E)}`, x = g.map((E) => E.releaseDate ? new Date(E.releaseDate).getTime() : Number.NaN).filter((E) => !Number.isNaN(E)).sort((E, R) => R - E), v = [];
2724
+ for (let E = 0; E + 1 < x.length; E++) v.push(x[E] - x[E + 1]);
2725
+ const P = v.length ? Math.round(v.reduce((E, R) => E + R, 0) / v.length / 1e3) : void 0, O = P ? Math.min(43200, Math.max(60, Math.round(P / 60))) : 1440, $ = P ? P <= 172800 ? "daily" : P <= 1209600 ? "weekly" : P <= 5184e3 ? "monthly" : "yearly" : "weekly", N = x.length ? new Date(x[0]).toUTCString() : void 0, I = ft(a.frontmatter.title), U = ft(
2722
2726
  a.frontmatter.description ?? t.site?.description ?? a.frontmatter.title
2723
- ), C = t.site?.locale?.replace("_", "-").toLowerCase(), I = Math.max(1, Math.ceil(h.length / Se));
2724
- for (let E = 0; E < I; E++) {
2725
- const B = h.slice(E * Se, (E + 1) * Se), z = [
2726
- `<atom:link href="${ut(`${l}${dt(t.base, g(E))}`)}" rel="self" type="application/rss+xml"/>`
2727
+ ), C = t.site?.locale?.replace("_", "-").toLowerCase(), F = Math.max(1, Math.ceil(g.length / xe));
2728
+ for (let E = 0; E < F; E++) {
2729
+ const R = g.slice(E * xe, (E + 1) * xe), z = [
2730
+ `<atom:link href="${ft(`${l}${gt(t.base, y(E))}`)}" rel="self" type="application/rss+xml"/>`
2727
2731
  ];
2728
2732
  E > 0 && z.push(
2729
- `<atom:link href="${ut(`${l}${dt(t.base, g(0))}`)}" rel="current" type="application/rss+xml"/>`
2730
- ), E + 1 < I && z.push(
2731
- `<atom:link href="${ut(`${l}${dt(t.base, g(E + 1))}`)}" rel="prev-archive" type="application/rss+xml"/>`
2733
+ `<atom:link href="${ft(`${l}${gt(t.base, y(0))}`)}" rel="current" type="application/rss+xml"/>`
2734
+ ), E + 1 < F && z.push(
2735
+ `<atom:link href="${ft(`${l}${gt(t.base, y(E + 1))}`)}" rel="prev-archive" type="application/rss+xml"/>`
2732
2736
  ), E > 1 && z.push(
2733
- `<atom:link href="${ut(`${l}${dt(t.base, g(E - 1))}`)}" rel="next-archive" type="application/rss+xml"/>`
2737
+ `<atom:link href="${ft(`${l}${gt(t.base, y(E - 1))}`)}" rel="next-archive" type="application/rss+xml"/>`
2734
2738
  );
2735
- const X = B.map((J) => {
2736
- const tt = `${y}#${J.slug}`, Y = [
2737
- `<title>${ut(J.version ? `v${J.version} ${J.title}` : J.title)}</title>`,
2738
- `<link>${ut(tt)}</link>`,
2739
- `<guid isPermaLink="true">${ut(tt)}</guid>`
2739
+ const V = R.map((J) => {
2740
+ const Z = `${h}#${J.slug}`, X = [
2741
+ `<title>${ft(J.version ? `v${J.version} ${J.title}` : J.title)}</title>`,
2742
+ `<link>${ft(Z)}</link>`,
2743
+ `<guid isPermaLink="true">${ft(Z)}</guid>`
2740
2744
  ];
2741
- return J.releaseDate && Y.push(`<pubDate>${new Date(J.releaseDate).toUTCString()}</pubDate>`), J.description && Y.push(`<description>${ut(J.description)}</description>`), J.html && Y.push(`<content:encoded>${ur(J.html)}</content:encoded>`), ` <item>
2742
- ${Y.join(`
2745
+ return J.releaseDate && X.push(`<pubDate>${new Date(J.releaseDate).toUTCString()}</pubDate>`), J.description && X.push(`<description>${ft(J.description)}</description>`), J.html && X.push(`<content:encoded>${ur(J.html)}</content:encoded>`), ` <item>
2746
+ ${X.join(`
2743
2747
  `)}
2744
2748
  </item>`;
2745
- }), O = [
2746
- `<title>${F}</title>`,
2747
- `<link>${ut(y)}</link>`,
2749
+ }), _ = [
2750
+ `<title>${I}</title>`,
2751
+ `<link>${ft(h)}</link>`,
2748
2752
  `<description>${U}</description>`,
2749
2753
  ...z
2750
2754
  ];
2751
- C && O.push(`<language>${ut(C)}</language>`), N && O.push(`<lastBuildDate>${N}</lastBuildDate>`), O.push(`<ttl>${M}</ttl>`), O.push(`<sy:updatePeriod>${$}</sy:updatePeriod>`), O.push("<sy:updateFrequency>1</sy:updateFrequency>"), P !== void 0 && O.push(`<nimpress:releaseCadence>${P}</nimpress:releaseCadence>`), O.push(`<nimpress:latestVersion>${ut(h[0].version)}</nimpress:latestVersion>`), O.push(`<nimpress:releaseCount>${h.length}</nimpress:releaseCount>`), E > 0 && O.push("<fh:archive/>");
2752
- const R = [
2755
+ C && _.push(`<language>${ft(C)}</language>`), N && _.push(`<lastBuildDate>${N}</lastBuildDate>`), _.push(`<ttl>${O}</ttl>`), _.push(`<sy:updatePeriod>${$}</sy:updatePeriod>`), _.push("<sy:updateFrequency>1</sy:updateFrequency>"), P !== void 0 && _.push(`<nimpress:releaseCadence>${P}</nimpress:releaseCadence>`), _.push(`<nimpress:latestVersion>${ft(g[0].version)}</nimpress:latestVersion>`), _.push(`<nimpress:releaseCount>${g.length}</nimpress:releaseCount>`), E > 0 && _.push("<fh:archive/>");
2756
+ const B = [
2753
2757
  '<?xml version="1.0" encoding="UTF-8"?>',
2754
2758
  `<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:fh="http://purl.org/syndication/history/1.0" xmlns:nimpress="${pr}">`,
2755
2759
  " <channel>",
2756
- ` ${O.join(`
2760
+ ` ${_.join(`
2757
2761
  `)}`,
2758
- X.join(`
2762
+ V.join(`
2759
2763
  `),
2760
2764
  " </channel>",
2761
2765
  "</rss>"
2762
2766
  ].join(`
2763
2767
  `);
2764
- $t.set(g(E), R);
2768
+ St.set(y(E), B);
2765
2769
  }
2766
2770
  }
2767
2771
  }
2768
- const me = /* @__PURE__ */ new Map();
2772
+ const de = /* @__PURE__ */ new Map();
2769
2773
  function yt(o) {
2770
2774
  return o.frontmatter.gate !== void 0;
2771
2775
  }
2772
2776
  function Wn(o) {
2773
- const l = V(o.filePath);
2777
+ const l = G(o.filePath);
2774
2778
  let a = [];
2775
2779
  try {
2776
- a = le(l);
2780
+ a = pe(l);
2777
2781
  } catch {
2778
2782
  return [];
2779
2783
  }
2780
- return a.filter((h) => W(l, h) !== o.filePath).map((h) => jt(process.cwd(), W(l, h)));
2784
+ return a.filter((g) => W(l, g) !== o.filePath).map((g) => jt(process.cwd(), W(l, g)));
2781
2785
  }
2782
- function Vt(o) {
2786
+ function Xt(o) {
2783
2787
  const l = t.auth?.guard;
2784
2788
  return typeof l == "function" ? l(o.frontmatter, jt(process.cwd(), o.filePath), Wn(o)) : o.frontmatter.gate ?? "default";
2785
2789
  }
2786
2790
  function Ln() {
2787
2791
  const o = [];
2788
2792
  for (const l of r.values())
2789
- l.sidebarOnly || xe(l.frontmatter) || yt(l) || o.push(l);
2793
+ l.sidebarOnly || ke(l.frontmatter) || yt(l) || o.push(l);
2790
2794
  return o;
2791
2795
  }
2792
- function St(o) {
2796
+ function xt(o) {
2793
2797
  const l = t.site?.url?.replace(/\/$/, "");
2794
2798
  if (l)
2795
- return l + dt(t.base, o.startsWith("/") ? o : "/" + o);
2799
+ return l + gt(t.base, o.startsWith("/") ? o : "/" + o);
2796
2800
  }
2797
- function Je(o) {
2798
- if (me.has(o)) return me.get(o);
2801
+ function qe(o) {
2802
+ if (de.has(o)) return de.get(o);
2799
2803
  let l;
2800
2804
  try {
2801
2805
  l = cs("git", ["log", "-1", "--format=%cI", "--", o], {
@@ -2806,70 +2810,70 @@ function Ar(e) {
2806
2810
  } catch {
2807
2811
  l = void 0;
2808
2812
  }
2809
- return me.set(o, l), l;
2813
+ return de.set(o, l), l;
2810
2814
  }
2811
2815
  function Hn(o) {
2812
2816
  return o === "changelog" || o === "roadmap" ? "CollectionPage" : o === "openapi" ? "APIReference" : o === "hero" ? "WebPage" : "TechArticle";
2813
2817
  }
2814
2818
  function Un(o) {
2815
- const l = t.meta ?? {}, a = t.site, h = o.frontmatter, w = h.meta ?? {}, y = w.og ?? {}, u = w.twitter ?? {}, g = h.title, x = a?.title && a.title !== g ? `${g} · ${a.title}` : g, b = w.description ?? h.description ?? a?.description, P = w.canonical ?? St(o.effectivePath), M = (() => {
2819
+ const l = t.meta ?? {}, a = t.site, g = o.frontmatter, w = g.meta ?? {}, h = w.og ?? {}, p = w.twitter ?? {}, y = g.title, x = a?.title && a.title !== y ? `${y} · ${a.title}` : y, v = w.description ?? g.description ?? a?.description, P = w.canonical ?? xt(o.effectivePath), O = (() => {
2816
2820
  if (w.keywords) return Array.isArray(w.keywords) ? w.keywords : [w.keywords];
2817
- const Y = he(h.tags);
2818
- return Y.length ? Y : l.keywords ?? [];
2819
- })(), $ = w.robots ?? "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1", N = y.title ?? g, F = y.description ?? b, U = y.image ?? a?.ogImage, C = U ? St(U) ?? U : void 0, I = y.type ?? (h.type === "hero" || o.effectivePath === "/" ? "website" : "article"), E = l.og?.width ?? 1200, B = l.og?.height ?? 600, z = u.card ?? (C ? "summary_large_image" : "summary"), X = u.site ?? a?.twitterSite, O = Jt, R = [];
2820
- if (R.push(`<title>${O(x)}</title>`), b && R.push(`<meta name="description" content="${O(b)}">`), M.length && R.push(`<meta name="keywords" content="${O(M.join(", "))}">`), R.push(`<meta name="robots" content="${O($)}">`), R.push(`<meta name="googlebot" content="${O($)}">`), P) {
2821
- R.push(`<link rel="canonical" href="${O(P)}">`);
2822
- const Y = l.localeAlternates ?? [];
2823
- for (const Z of Y)
2824
- R.push(`<link rel="alternate" hreflang="${O(Z)}" href="${O(P)}">`);
2825
- Y.length && R.push(`<link rel="alternate" hreflang="x-default" href="${O(P)}">`);
2826
- }
2827
- if (R.push(`<meta property="og:title" content="${O(N)}">`), F && R.push(`<meta property="og:description" content="${O(F)}">`), R.push(`<meta property="og:type" content="${O(I)}">`), P && R.push(`<meta property="og:url" content="${O(P)}">`), C && (R.push(`<meta property="og:image" content="${O(C)}">`), R.push(`<meta property="og:image:width" content="${E}">`), R.push(`<meta property="og:image:height" content="${B}">`), y.imageAlt && R.push(`<meta property="og:image:alt" content="${O(y.imageAlt)}">`)), a?.title && R.push(`<meta property="og:site_name" content="${O(a.title)}">`), a?.locale && R.push(`<meta property="og:locale" content="${O(a.locale)}">`), R.push(`<meta name="twitter:card" content="${O(z)}">`), X && R.push(`<meta name="twitter:site" content="${O(X)}">`), R.push(`<meta name="twitter:title" content="${O(u.title ?? N)}">`), (u.description ?? F) && R.push(`<meta name="twitter:description" content="${O(u.description ?? F ?? "")}">`), (u.image ?? C) && R.push(`<meta name="twitter:image" content="${O(u.image ?? C ?? "")}">`), b && R.push(`<meta name="dc.description" content="${O(b)}">`), R.push(`<meta name="dc.title" content="${O(x)}">`), a?.locale && R.push(`<meta name="dc.language" content="${O(a.locale)}">`), h.type === "changelog" && (h.rss === !0 || h.subscribe === !0)) {
2828
- const Y = o.effectivePath === "/" ? "/rss.xml" : `${o.effectivePath}/rss.xml`, Z = St(Y) ?? Y;
2829
- R.push(`<link rel="alternate" type="application/rss+xml" title="${O(g)}" href="${O(Z)}">`);
2830
- }
2831
- const J = t.site?.url?.replace(/\/$/, ""), tt = [];
2832
- if (l.organization && tt.push({ "@context": "https://schema.org", ...l.organization }), J && a?.title && tt.push({
2821
+ const X = ge(g.tags);
2822
+ return X.length ? X : l.keywords ?? [];
2823
+ })(), $ = w.robots ?? "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1", N = h.title ?? y, I = h.description ?? v, U = h.image ?? a?.ogImage, C = U ? xt(U) ?? U : void 0, F = h.type ?? (g.type === "hero" || o.effectivePath === "/" ? "website" : "article"), E = l.og?.width ?? 1200, R = l.og?.height ?? 600, z = p.card ?? (C ? "summary_large_image" : "summary"), V = p.site ?? a?.twitterSite, _ = qt, B = [];
2824
+ if (B.push(`<title>${_(x)}</title>`), v && B.push(`<meta name="description" content="${_(v)}">`), O.length && B.push(`<meta name="keywords" content="${_(O.join(", "))}">`), B.push(`<meta name="robots" content="${_($)}">`), B.push(`<meta name="googlebot" content="${_($)}">`), P) {
2825
+ B.push(`<link rel="canonical" href="${_(P)}">`);
2826
+ const X = l.localeAlternates ?? [];
2827
+ for (const Y of X)
2828
+ B.push(`<link rel="alternate" hreflang="${_(Y)}" href="${_(P)}">`);
2829
+ X.length && B.push(`<link rel="alternate" hreflang="x-default" href="${_(P)}">`);
2830
+ }
2831
+ if (B.push(`<meta property="og:title" content="${_(N)}">`), I && B.push(`<meta property="og:description" content="${_(I)}">`), B.push(`<meta property="og:type" content="${_(F)}">`), P && B.push(`<meta property="og:url" content="${_(P)}">`), C && (B.push(`<meta property="og:image" content="${_(C)}">`), B.push(`<meta property="og:image:width" content="${E}">`), B.push(`<meta property="og:image:height" content="${R}">`), h.imageAlt && B.push(`<meta property="og:image:alt" content="${_(h.imageAlt)}">`)), a?.title && B.push(`<meta property="og:site_name" content="${_(a.title)}">`), a?.locale && B.push(`<meta property="og:locale" content="${_(a.locale)}">`), B.push(`<meta name="twitter:card" content="${_(z)}">`), V && B.push(`<meta name="twitter:site" content="${_(V)}">`), B.push(`<meta name="twitter:title" content="${_(p.title ?? N)}">`), (p.description ?? I) && B.push(`<meta name="twitter:description" content="${_(p.description ?? I ?? "")}">`), (p.image ?? C) && B.push(`<meta name="twitter:image" content="${_(p.image ?? C ?? "")}">`), v && B.push(`<meta name="dc.description" content="${_(v)}">`), B.push(`<meta name="dc.title" content="${_(x)}">`), a?.locale && B.push(`<meta name="dc.language" content="${_(a.locale)}">`), g.type === "changelog" && (g.rss === !0 || g.subscribe === !0)) {
2832
+ const X = o.effectivePath === "/" ? "/rss.xml" : `${o.effectivePath}/rss.xml`, Y = xt(X) ?? X;
2833
+ B.push(`<link rel="alternate" type="application/rss+xml" title="${_(y)}" href="${_(Y)}">`);
2834
+ }
2835
+ const J = t.site?.url?.replace(/\/$/, ""), Z = [];
2836
+ if (l.organization && Z.push({ "@context": "https://schema.org", ...l.organization }), J && a?.title && Z.push({
2833
2837
  "@context": "https://schema.org",
2834
2838
  "@type": "WebSite",
2835
- "@id": `${J}${dt(t.base, "/")}#website`,
2839
+ "@id": `${J}${gt(t.base, "/")}#website`,
2836
2840
  name: a.title,
2837
- url: `${J}${dt(t.base, "/")}`,
2841
+ url: `${J}${gt(t.base, "/")}`,
2838
2842
  description: a.description
2839
2843
  }), P && o.effectivePath !== "/") {
2840
- const Y = [
2841
- { name: a?.title ?? "Home", item: J ? `${J}${dt(t.base, "/")}` : void 0 }
2842
- ], Z = o.effectivePath.split("/").filter(Boolean);
2843
- let at = "";
2844
- for (const ct of Z) {
2845
- at += "/" + ct;
2846
- const ht = [...r.values()].find((G) => G.effectivePath === at);
2847
- Y.push({ name: ht?.frontmatter.title ?? ne(ct), item: St(at) });
2844
+ const X = [
2845
+ { name: a?.title ?? "Home", item: J ? `${J}${gt(t.base, "/")}` : void 0 }
2846
+ ], Y = o.effectivePath.split("/").filter(Boolean);
2847
+ let ct = "";
2848
+ for (const ut of Y) {
2849
+ ct += "/" + ut;
2850
+ const ht = [...r.values()].find((rt) => rt.effectivePath === ct);
2851
+ X.push({ name: ht?.frontmatter.title ?? se(ut), item: xt(ct) });
2848
2852
  }
2849
- tt.push({
2853
+ Z.push({
2850
2854
  "@context": "https://schema.org",
2851
2855
  "@type": "BreadcrumbList",
2852
- itemListElement: Y.map((ct, ht) => ({
2856
+ itemListElement: X.map((ut, ht) => ({
2853
2857
  "@type": "ListItem",
2854
2858
  position: ht + 1,
2855
- name: ct.name,
2856
- item: ct.item
2859
+ name: ut.name,
2860
+ item: ut.item
2857
2861
  }))
2858
2862
  });
2859
2863
  }
2860
- tt.push({
2864
+ Z.push({
2861
2865
  "@context": "https://schema.org",
2862
2866
  "@type": Hn(o.type),
2863
2867
  name: x,
2864
- headline: g,
2865
- description: b,
2868
+ headline: y,
2869
+ description: v,
2866
2870
  url: P,
2867
- isPartOf: J ? `${J}${dt(t.base, "/")}#website` : void 0,
2868
- dateModified: Je(o.filePath)
2869
- }), w.jsonLd && tt.push(w.jsonLd);
2870
- for (const Y of tt) R.push(fr(Y));
2871
+ isPartOf: J ? `${J}${gt(t.base, "/")}#website` : void 0,
2872
+ dateModified: qe(o.filePath)
2873
+ }), w.jsonLd && Z.push(w.jsonLd);
2874
+ for (const X of Z) B.push(fr(X));
2871
2875
  return `
2872
- ${R.join(`
2876
+ ${B.join(`
2873
2877
  `)}
2874
2878
  `;
2875
2879
  }
@@ -2882,8 +2886,8 @@ function Ar(e) {
2882
2886
  for (const w of l)
2883
2887
  gn.includes(w) || (a.push(`User-agent: ${w}`), a.push("Disallow: /"), a.push(""));
2884
2888
  o.robots?.append && a.push(o.robots.append, "");
2885
- const h = St("/sitemap.xml");
2886
- return h && a.push(`Sitemap: ${h}`), a.join(`
2889
+ const g = xt("/sitemap.xml");
2890
+ return g && a.push(`Sitemap: ${g}`), a.join(`
2887
2891
  `).replace(/\n{3,}/g, `
2888
2892
 
2889
2893
  `).trim() + `
@@ -2897,10 +2901,10 @@ function Ar(e) {
2897
2901
  '<?xml version="1.0" encoding="UTF-8"?>',
2898
2902
  '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">',
2899
2903
  o.map((w) => {
2900
- const y = `${l}${dt(t.base, w.effectivePath === "/" ? "/" : w.effectivePath)}`, u = w.effectivePath.split("/").filter(Boolean).length, g = u === 0 ? "1.0" : u === 1 ? "0.8" : "0.6", x = u === 0 ? "weekly" : "monthly", b = Je(w.filePath), P = [` <loc>${ut(y)}</loc>`];
2901
- b && P.push(` <lastmod>${ut(b)}</lastmod>`), P.push(` <changefreq>${x}</changefreq>`), P.push(` <priority>${g}</priority>`);
2902
- for (const M of a)
2903
- P.push(` <xhtml:link rel="alternate" hreflang="${ut(M)}" href="${ut(y)}"/>`);
2904
+ const h = `${l}${gt(t.base, w.effectivePath === "/" ? "/" : w.effectivePath)}`, p = w.effectivePath.split("/").filter(Boolean).length, y = p === 0 ? "1.0" : p === 1 ? "0.8" : "0.6", x = p === 0 ? "weekly" : "monthly", v = qe(w.filePath), P = [` <loc>${ft(h)}</loc>`];
2905
+ v && P.push(` <lastmod>${ft(v)}</lastmod>`), P.push(` <changefreq>${x}</changefreq>`), P.push(` <priority>${y}</priority>`);
2906
+ for (const O of a)
2907
+ P.push(` <xhtml:link rel="alternate" hreflang="${ft(O)}" href="${ft(h)}"/>`);
2904
2908
  return ` <url>
2905
2909
  ${P.join(`
2906
2910
  `)}
@@ -2913,45 +2917,45 @@ ${P.join(`
2913
2917
  `);
2914
2918
  }
2915
2919
  function zn(o) {
2916
- const l = t.meta ?? {}, a = t.site, h = [`# ${a?.title ?? t.title}`, ""], w = l.llms?.summary ?? a?.description;
2917
- w && h.push(`> ${w}`, "");
2918
- const y = /* @__PURE__ */ new Map(), u = [];
2919
- for (const M of o) {
2920
- const $ = M.effectivePath.split("/").filter(Boolean);
2920
+ const l = t.meta ?? {}, a = t.site, g = [`# ${a?.title ?? t.title}`, ""], w = l.llms?.summary ?? a?.description;
2921
+ w && g.push(`> ${w}`, "");
2922
+ const h = /* @__PURE__ */ new Map(), p = [];
2923
+ for (const O of o) {
2924
+ const $ = O.effectivePath.split("/").filter(Boolean);
2921
2925
  if ($.length === 0) {
2922
- u.push(M);
2926
+ p.push(O);
2923
2927
  continue;
2924
2928
  }
2925
- const N = $[0], F = y.get(N) ?? [];
2926
- F.push(M), y.set(N, F);
2929
+ const N = $[0], I = h.get(N) ?? [];
2930
+ I.push(O), h.set(N, I);
2927
2931
  }
2928
- const g = (M) => {
2929
- const $ = St(M.effectivePath) ?? M.effectivePath;
2930
- return M.frontmatter.description ? `- [${M.frontmatter.title}](${$}): ${M.frontmatter.description}` : `- [${M.frontmatter.title}](${$})`;
2932
+ const y = (O) => {
2933
+ const $ = xt(O.effectivePath) ?? O.effectivePath;
2934
+ return O.frontmatter.description ? `- [${O.frontmatter.title}](${$}): ${O.frontmatter.description}` : `- [${O.frontmatter.title}](${$})`;
2931
2935
  };
2932
- for (const M of u) h.push(g(M));
2933
- u.length && h.push("");
2934
- for (const [M, $] of [...y.entries()].sort((N, F) => N[0].localeCompare(F[0]))) {
2935
- const N = $.find((F) => F.effectivePath === `/${M}`);
2936
- h.push(`## ${N?.frontmatter.title ?? ne(M)}`, ""), $.sort((F, U) => F.effectivePath.localeCompare(U.effectivePath));
2937
- for (const F of $) h.push(g(F));
2938
- h.push("");
2936
+ for (const O of p) g.push(y(O));
2937
+ p.length && g.push("");
2938
+ for (const [O, $] of [...h.entries()].sort((N, I) => N[0].localeCompare(I[0]))) {
2939
+ const N = $.find((I) => I.effectivePath === `/${O}`);
2940
+ g.push(`## ${N?.frontmatter.title ?? se(O)}`, ""), $.sort((I, U) => I.effectivePath.localeCompare(U.effectivePath));
2941
+ for (const I of $) g.push(y(I));
2942
+ g.push("");
2939
2943
  }
2940
2944
  const x = new Set(t.meta?.keywords ?? []);
2941
- for (const M of o) for (const $ of he(M.frontmatter.tags)) x.add($);
2942
- x.size && h.push("## Keywords", "", [...x].join(", "), "");
2943
- const b = St("/sitemap.xml"), P = St("/robots.txt");
2944
- return (b || P) && (h.push("## Optional", ""), b && h.push(`- [Sitemap](${b})`), P && h.push(`- [Robots](${P})`), h.push("")), l.llms?.append && h.push(l.llms.append, ""), h.join(`
2945
+ for (const O of o) for (const $ of ge(O.frontmatter.tags)) x.add($);
2946
+ x.size && g.push("## Keywords", "", [...x].join(", "), "");
2947
+ const v = xt("/sitemap.xml"), P = xt("/robots.txt");
2948
+ return (v || P) && (g.push("## Optional", ""), v && g.push(`- [Sitemap](${v})`), P && g.push(`- [Robots](${P})`), g.push("")), l.llms?.append && g.push(l.llms.append, ""), g.join(`
2945
2949
  `).replace(/\n{3,}/g, `
2946
2950
 
2947
2951
  `);
2948
2952
  }
2949
2953
  function Gn(o) {
2950
2954
  const a = [`# ${t.site?.title ?? t.title}`, ""];
2951
- for (const h of o) {
2952
- a.push(`## ${h.frontmatter.title}`, "");
2953
- const w = St(h.effectivePath);
2954
- w && a.push(`URL: ${w}`, ""), a.push(h.rawText.trim(), "");
2955
+ for (const g of o) {
2956
+ a.push(`## ${g.frontmatter.title}`, "");
2957
+ const w = xt(g.effectivePath);
2958
+ w && a.push(`URL: ${w}`, ""), a.push(g.rawText.trim(), "");
2955
2959
  }
2956
2960
  return a.join(`
2957
2961
  `).replace(/\n{3,}/g, `
@@ -2959,49 +2963,49 @@ ${P.join(`
2959
2963
  `);
2960
2964
  }
2961
2965
  async function Vn() {
2962
- const o = t.meta ?? {}, l = Ln().sort((y, u) => y.effectivePath.localeCompare(u.effectivePath)), a = W(c, "index.html"), h = await rt(a, "utf-8");
2963
- for (const y of l) {
2964
- const u = Un(y), g = h.replace("</head>", `${u}</head>`), x = y.effectivePath === "/" ? a : W(c, y.effectivePath.replace(/^\//, ""), "index.html");
2965
- await _t(V(x), { recursive: !0 }), await nt(x, g);
2966
+ const o = t.meta ?? {}, l = Ln().sort((h, p) => h.effectivePath.localeCompare(p.effectivePath)), a = W(c, "index.html"), g = await it(a, "utf-8");
2967
+ for (const h of l) {
2968
+ const p = Un(h), y = g.replace("</head>", `${p}</head>`), x = h.effectivePath === "/" ? a : W(c, h.effectivePath.replace(/^\//, ""), "index.html");
2969
+ await Tt(G(x), { recursive: !0 }), await nt(x, y);
2966
2970
  }
2967
2971
  await nt(W(c, "robots.txt"), Jn());
2968
2972
  const w = qn(l);
2969
2973
  if (w && await nt(W(c, "sitemap.xml"), w), await nt(W(c, "llms.txt"), zn(l)), o.llms?.full && await nt(W(c, "llms-full.txt"), Gn(l)), o.webmanifest && await nt(W(c, "site.webmanifest"), JSON.stringify(o.webmanifest, null, 2) + `
2970
2974
  `), o.humans && await nt(W(c, "humans.txt"), o.humans.trim() + `
2971
2975
  `), o.security) {
2972
- const y = o.security, u = [];
2973
- y.contact && u.push(`Contact: ${y.contact}`), y.policy && u.push(`Policy: ${y.policy}`), y.languages && u.push(`Preferred-Languages: ${y.languages}`), y.canonical && u.push(`Canonical: ${y.canonical}`), y.expires && u.push(`Expires: ${y.expires}`), u.length && (await _t(W(c, ".well-known"), { recursive: !0 }), await nt(W(c, ".well-known", "security.txt"), u.join(`
2976
+ const h = o.security, p = [];
2977
+ h.contact && p.push(`Contact: ${h.contact}`), h.policy && p.push(`Policy: ${h.policy}`), h.languages && p.push(`Preferred-Languages: ${h.languages}`), h.canonical && p.push(`Canonical: ${h.canonical}`), h.expires && p.push(`Expires: ${h.expires}`), p.length && (await Tt(W(c, ".well-known"), { recursive: !0 }), await nt(W(c, ".well-known", "security.txt"), p.join(`
2974
2978
  `) + `
2975
2979
  `));
2976
2980
  }
2977
2981
  }
2978
2982
  async function Xn() {
2979
- const o = [...r.values()].filter((u) => !xe(u.frontmatter) && yt(u)), l = {}, a = /* @__PURE__ */ new Map();
2980
- for (const u of o) {
2981
- const g = Vt(u);
2982
- l[u.effectivePath] = { gate: u.frontmatter.gate, bundle: g };
2983
- const x = a.get(g) ?? [];
2984
- x.push(u), a.set(g, x);
2985
- }
2986
- const h = `/${t.paths.guarded}/`;
2983
+ const o = [...r.values()].filter((p) => !ke(p.frontmatter) && yt(p)), l = {}, a = /* @__PURE__ */ new Map();
2984
+ for (const p of o) {
2985
+ const y = Xt(p);
2986
+ l[p.effectivePath] = { gate: p.frontmatter.gate, bundle: y };
2987
+ const x = a.get(y) ?? [];
2988
+ x.push(p), a.set(y, x);
2989
+ }
2990
+ const g = `/${t.paths.guarded}/`;
2987
2991
  if (await nt(
2988
2992
  W(c, "access.json"),
2989
- JSON.stringify({ prefix: h, routes: l }, null, 2) + `
2993
+ JSON.stringify({ prefix: g, routes: l }, null, 2) + `
2990
2994
  `
2991
2995
  ), o.length === 0) return;
2992
- const w = W(c, t.paths.guarded), y = {};
2993
- for (const [u, g] of a) {
2994
- const x = W(w, u);
2995
- await _t(W(x, "body"), { recursive: !0 });
2996
- const b = {}, P = g.map(($) => ({
2996
+ const w = W(c, t.paths.guarded), h = {};
2997
+ for (const [p, y] of a) {
2998
+ const x = W(w, p);
2999
+ await Tt(W(x, "body"), { recursive: !0 });
3000
+ const v = {}, P = y.map(($) => ({
2997
3001
  slug: $.slug,
2998
3002
  path: $.effectivePath,
2999
3003
  type: $.type,
3000
3004
  frontmatter: $.frontmatter,
3001
- bundle: u
3002
- })), M = [`${u}/manifest.json`, `${u}/search.json`];
3003
- for (const $ of g) {
3004
- $.pageCss && (b[$.effectivePath] = $.pageCss);
3005
+ bundle: p
3006
+ })), O = [`${p}/manifest.json`, `${p}/search.json`];
3007
+ for (const $ of y) {
3008
+ $.pageCss && (v[$.effectivePath] = $.pageCss);
3005
3009
  const N = {
3006
3010
  html: $.html,
3007
3011
  headings: $.headings,
@@ -3015,91 +3019,91 @@ ${P.join(`
3015
3019
  dbmlSource: $.dbmlSource,
3016
3020
  dbmlFile: $.dbmlFile,
3017
3021
  dbmlError: $.dbmlError
3018
- }, F = W(x, "body", `${At($.slug)}.json`);
3019
- await _t(V(F), { recursive: !0 }), await nt(F, JSON.stringify(N)), M.push(`${u}/body/${At($.slug)}.json`);
3022
+ }, I = W(x, "body", `${At($.slug)}.json`);
3023
+ await Tt(G(I), { recursive: !0 }), await nt(I, JSON.stringify(N)), O.push(`${p}/body/${At($.slug)}.json`);
3020
3024
  }
3021
3025
  await nt(
3022
3026
  W(x, "manifest.json"),
3023
- JSON.stringify({ shells: P, styles: b, sidebar: Ge(!0) })
3024
- ), await nt(W(x, "search.json"), JSON.stringify(Ve(!0, g))), y[u] = {
3025
- pages: Object.fromEntries(g.map(($) => [$.effectivePath, $.frontmatter.gate ?? ""])),
3026
- files: M
3027
+ JSON.stringify({ shells: P, styles: v, sidebar: Ve(!0) })
3028
+ ), await nt(W(x, "search.json"), JSON.stringify(Xe(!0, y))), h[p] = {
3029
+ pages: Object.fromEntries(y.map(($) => [$.effectivePath, $.frontmatter.gate ?? ""])),
3030
+ files: O
3027
3031
  };
3028
3032
  }
3029
3033
  await nt(
3030
3034
  W(c, "guard.map.json"),
3031
- JSON.stringify({ prefix: h, routes: l, bundles: y }, null, 2) + `
3035
+ JSON.stringify({ prefix: g, routes: l, bundles: h }, null, 2) + `
3032
3036
  `
3033
3037
  );
3034
3038
  }
3035
3039
  function Yn(o, l) {
3036
3040
  if (o.size === 0) return;
3037
- const a = l.filter((w) => Kn(w.type)), h = /* @__PURE__ */ new Map();
3038
- for (const w of a) h.set(w.filePath, w);
3041
+ const a = l.filter((w) => Kn(w.type)), g = /* @__PURE__ */ new Map();
3042
+ for (const w of a) g.set(w.filePath, w);
3039
3043
  for (const [, w] of o) {
3040
- const y = w[0], u = V(y.filePath), g = y.frontmatter.data, x = g?.issues ?? g?.entries, b = [];
3041
- if (typeof x == "string") b.push(x);
3044
+ const h = w[0], p = G(h.filePath), y = h.frontmatter.data, x = y?.issues ?? y?.entries, v = [];
3045
+ if (typeof x == "string") v.push(x);
3042
3046
  else if (Array.isArray(x))
3043
- for (const C of x) typeof C == "string" && b.push(C);
3044
- const P = b.length ? b.map((C) => q(u, C)) : [u], M = a.filter((C) => {
3045
- for (const I of P)
3046
- if (C.filePath !== I && (C.filePath.startsWith(I + "/") || C.filePath.startsWith(I + "\\")))
3047
+ for (const C of x) typeof C == "string" && v.push(C);
3048
+ const P = v.length ? v.map((C) => q(p, C)) : [p], O = a.filter((C) => {
3049
+ for (const F of P)
3050
+ if (C.filePath !== F && (C.filePath.startsWith(F + "/") || C.filePath.startsWith(F + "\\")))
3047
3051
  return !0;
3048
3052
  return !1;
3049
- }), $ = g?.changelog, N = [];
3053
+ }), $ = y?.changelog, N = [];
3050
3054
  if (typeof $ == "string")
3051
- N.push(q(u, $));
3055
+ N.push(q(p, $));
3052
3056
  else if (Array.isArray($))
3053
- for (const C of $) typeof C == "string" && N.push(q(u, C));
3054
- const F = /* @__PURE__ */ new Map();
3057
+ for (const C of $) typeof C == "string" && N.push(q(p, C));
3058
+ const I = /* @__PURE__ */ new Map();
3055
3059
  for (const C of l) {
3056
3060
  if (C.type !== "changelog" || N.length && !N.some(
3057
- (ct) => C.filePath === ct || C.filePath.startsWith(ct + "/") || C.filePath.startsWith(ct + "\\")
3061
+ (ut) => C.filePath === ut || C.filePath.startsWith(ut + "/") || C.filePath.startsWith(ut + "\\")
3058
3062
  ))
3059
3063
  continue;
3060
- const I = C.frontmatter.data, E = I?.issue;
3064
+ const F = C.frontmatter.data, E = F?.issue;
3061
3065
  if (!E) continue;
3062
- const B = String(E).trim();
3063
- if (!B) continue;
3064
- const z = qe(C.filePath, B);
3066
+ const R = String(E).trim();
3067
+ if (!R) continue;
3068
+ const z = ze(C.filePath, R);
3065
3069
  if (!z) continue;
3066
- const X = h.get(z);
3067
- if (!X) continue;
3068
- const O = String(I?.version ?? ""), R = ze(I?.release_date), J = I?.status;
3069
- let tt, Y = !1;
3070
+ const V = g.get(z);
3071
+ if (!V) continue;
3072
+ const _ = String(F?.version ?? ""), B = Ge(F?.release_date), J = F?.status;
3073
+ let Z, X = !1;
3070
3074
  if (typeof J == "string") {
3071
- const at = J.trim().toLowerCase();
3072
- if (["completes", "completed", "complete", "fixes", "closes", "resolves"].includes(at))
3073
- Y = !0;
3075
+ const ct = J.trim().toLowerCase();
3076
+ if (["completes", "completed", "complete", "fixes", "closes", "resolves"].includes(ct))
3077
+ X = !0;
3074
3078
  else {
3075
- const ct = Number(at.replace(/%$/, ""));
3076
- Number.isFinite(ct) && (tt = ct);
3079
+ const ut = Number(ct.replace(/%$/, ""));
3080
+ Number.isFinite(ut) && (Z = ut);
3077
3081
  }
3078
- } else typeof J == "number" && (tt = J);
3079
- const Z = F.get(X.filePath) ?? [];
3080
- Z.push({
3081
- version: O,
3082
- title: String(I?.title ?? C.frontmatter.title),
3083
- description: I?.description !== void 0 ? String(I.description) : void 0,
3084
- releaseDate: R,
3085
- progress: tt,
3086
- completes: Y,
3082
+ } else typeof J == "number" && (Z = J);
3083
+ const Y = I.get(V.filePath) ?? [];
3084
+ Y.push({
3085
+ version: _,
3086
+ title: String(F?.title ?? C.frontmatter.title),
3087
+ description: F?.description !== void 0 ? String(F.description) : void 0,
3088
+ releaseDate: B,
3089
+ progress: Z,
3090
+ completes: X,
3087
3091
  path: C.effectivePath,
3088
- slug: O ? `v${O}` : "unreleased",
3089
- entrySlug: `${C.effectivePath}#${O ? `v${O}` : "unreleased"}`
3090
- }), F.set(X.filePath, Z);
3092
+ slug: _ ? `v${_}` : "unreleased",
3093
+ entrySlug: `${C.effectivePath}#${_ ? `v${_}` : "unreleased"}`
3094
+ }), I.set(V.filePath, Y);
3091
3095
  }
3092
- const U = M.map((C) => {
3093
- const I = C.frontmatter.data, E = C.type, B = ze(I?.date ?? I?.target_date);
3096
+ const U = O.map((C) => {
3097
+ const F = C.frontmatter.data, E = C.type, R = Ge(F?.date ?? F?.target_date);
3094
3098
  let z;
3095
- const X = I?.parent;
3096
- if (typeof X == "string" && X.trim()) {
3097
- const Z = qe(C.filePath, X.trim());
3098
- Z && h.has(Z) && (z = h.get(Z).effectivePath);
3099
+ const V = F?.parent;
3100
+ if (typeof V == "string" && V.trim()) {
3101
+ const Y = ze(C.filePath, V.trim());
3102
+ Y && g.has(Y) && (z = g.get(Y).effectivePath);
3099
3103
  }
3100
- const O = (F.get(C.filePath) ?? []).slice().sort(
3101
- (Z, at) => (Z.releaseDate ?? "").localeCompare(at.releaseDate ?? "")
3102
- ), R = O.some((Z) => Z.completes), J = String(I?.status ?? "").toLowerCase(), tt = J === "shipped" || J === "in_progress" || J === "planned" ? J : R ? "shipped" : O.length ? "in_progress" : "planned", Y = O.reduce((Z, at) => typeof at.progress == "number" ? Math.max(Z ?? 0, at.progress) : Z, void 0);
3104
+ const _ = (I.get(C.filePath) ?? []).slice().sort(
3105
+ (Y, ct) => (Y.releaseDate ?? "").localeCompare(ct.releaseDate ?? "")
3106
+ ), B = _.some((Y) => Y.completes), J = String(F?.status ?? "").toLowerCase(), Z = J === "shipped" || J === "in_progress" || J === "planned" ? J : B ? "shipped" : _.length ? "in_progress" : "planned", X = _.reduce((Y, ct) => typeof ct.progress == "number" ? Math.max(Y ?? 0, ct.progress) : Y, void 0);
3103
3107
  return {
3104
3108
  kind: E,
3105
3109
  slug: C.slug,
@@ -3107,18 +3111,18 @@ ${P.join(`
3107
3111
  href: C.effectivePath,
3108
3112
  title: C.frontmatter.title,
3109
3113
  description: C.frontmatter.description,
3110
- targetDate: B,
3114
+ targetDate: R,
3111
3115
  parent: z,
3112
- progress: Y,
3113
- status: tt,
3114
- hidden: ee(C.frontmatter),
3116
+ progress: X,
3117
+ status: Z,
3118
+ hidden: ne(C.frontmatter),
3115
3119
  html: C.html,
3116
3120
  headings: C.headings,
3117
3121
  data: C.frontmatter.data,
3118
- changelog: O
3122
+ changelog: _
3119
3123
  };
3120
3124
  });
3121
- U.sort((C, I) => (C.targetDate ?? "").localeCompare(I.targetDate ?? "")), y.roadmapEntries = U, y.headings = U.map((C) => ({
3125
+ U.sort((C, F) => (C.targetDate ?? "").localeCompare(F.targetDate ?? "")), h.roadmapEntries = U, h.headings = U.map((C) => ({
3122
3126
  level: 2,
3123
3127
  text: C.title,
3124
3128
  slug: C.slug
@@ -3128,11 +3132,11 @@ ${P.join(`
3128
3132
  function Kn(o) {
3129
3133
  return o === "milestone" || o === "epic" || o === "feature" || o === "bug";
3130
3134
  }
3131
- function qe(o, l) {
3132
- const a = V(o), h = l.replace(/\\/g, "/").trim(), w = h.endsWith(".md") ? h : `${h}.md`;
3135
+ function ze(o, l) {
3136
+ const a = G(o), g = l.replace(/\\/g, "/").trim(), w = g.endsWith(".md") ? g : `${g}.md`;
3133
3137
  return q(a, w);
3134
3138
  }
3135
- function ze(o) {
3139
+ function Ge(o) {
3136
3140
  if (o == null) return;
3137
3141
  if (o instanceof Date) return o.toISOString();
3138
3142
  const l = String(o).trim();
@@ -3141,255 +3145,256 @@ ${P.join(`
3141
3145
  if (!Number.isNaN(a.getTime()))
3142
3146
  return a.toISOString();
3143
3147
  }
3144
- function de(o, l) {
3148
+ function he(o, l) {
3145
3149
  if (!o || !/\.svg$/i.test(o.trim())) return o;
3146
- const a = o.trim(), h = a.startsWith("/") ? W(n, a) : q(V(l), a);
3150
+ const a = o.trim(), g = a.startsWith("/") ? W(n, a) : q(G(l), a);
3147
3151
  try {
3148
- return qt(h, "utf8").trim();
3152
+ return zt(g, "utf8").trim();
3149
3153
  } catch {
3150
3154
  console.warn(`[nimpress] sidebar icon ${a} referenced from ${l} is not readable`);
3151
3155
  return;
3152
3156
  }
3153
3157
  }
3154
- function Ge(o = !1) {
3158
+ function Ve(o = !1) {
3155
3159
  const l = { children: /* @__PURE__ */ new Map() }, a = /* @__PURE__ */ new Map();
3156
- for (const y of r.values()) {
3157
- if (p && (Dt(y.frontmatter) || !o && yt(y))) continue;
3158
- const u = y.frontmatter.sidebar;
3159
- if (y.effectivePath === "/" && !u?.name) continue;
3160
- const g = y.effectivePath === "/" ? [u.path ?? u.name] : y.effectivePath.split("/").filter(Boolean), x = y.filePath.endsWith(`${kt}index.md`);
3161
- if (u?.name && x) {
3162
- const $ = "/" + g.join("/");
3160
+ for (const h of r.values()) {
3161
+ if (u && (Dt(h.frontmatter) || !o && yt(h))) continue;
3162
+ const p = h.frontmatter.sidebar;
3163
+ if (h.effectivePath === "/" && !p?.name) continue;
3164
+ const y = h.effectivePath === "/" ? [p.path ?? p.name] : h.effectivePath.split("/").filter(Boolean), x = h.filePath.endsWith(`${kt}index.md`);
3165
+ if (p?.name && x) {
3166
+ const $ = "/" + y.join("/");
3163
3167
  a.set($, {
3164
- label: u.name,
3165
- icon: de(u.icon, y.filePath) ?? a.get($)?.icon,
3166
- style: u.style ?? a.get($)?.style
3168
+ label: p.name,
3169
+ icon: he(p.icon, h.filePath) ?? a.get($)?.icon,
3170
+ style: p.style ?? a.get($)?.style
3167
3171
  });
3168
3172
  }
3169
- if (y.sidebarOnly) continue;
3170
- const b = x ? void 0 : u?.path ?? u?.name;
3171
- b && g[g.length - 2] !== b && (g.length >= 3 ? g.splice(g.length - 2, 1, b) : g.splice(g.length - 1, 0, b));
3172
- let P = l, M = "";
3173
- for (const $ of g) {
3174
- M = M + "/" + $;
3173
+ if (h.sidebarOnly && !h.linkTo) continue;
3174
+ const v = x ? void 0 : p?.path ?? p?.name;
3175
+ v && y[y.length - 2] !== v && (y.length >= 3 ? y.splice(y.length - 2, 1, v) : y.splice(y.length - 1, 0, v));
3176
+ let P = l, O = "";
3177
+ for (const $ of y) {
3178
+ O = O + "/" + $;
3175
3179
  let N = P.children.get($);
3176
- N || (N = { segment: $, fullPath: M, children: /* @__PURE__ */ new Map() }, P.children.set($, N)), P = N;
3180
+ N || (N = { segment: $, fullPath: O, children: /* @__PURE__ */ new Map() }, P.children.set($, N)), P = N;
3177
3181
  }
3178
- if (P.page = y, !x && u?.name) {
3179
- const $ = "/" + g.slice(0, -1).join("/");
3182
+ if (P.page = h, !x && p?.name) {
3183
+ const $ = "/" + y.slice(0, -1).join("/");
3180
3184
  a.set($, {
3181
- label: u.name,
3182
- icon: de(u.icon, y.filePath) ?? a.get($)?.icon,
3183
- style: u.style ?? a.get($)?.style
3185
+ label: p.name,
3186
+ icon: he(p.icon, h.filePath) ?? a.get($)?.icon,
3187
+ style: p.style ?? a.get($)?.style
3184
3188
  });
3185
3189
  }
3186
3190
  }
3187
- function h(y) {
3188
- const u = [];
3189
- for (const b of y.children.values()) u.push(h(b));
3190
- if (Ce(u), y.page) {
3191
- const b = {
3192
- text: Dr(y.page),
3193
- link: y.page.effectivePath,
3194
- slug: y.page.slug,
3195
- gate: y.page.frontmatter.gate,
3196
- order: y.page.frontmatter.order,
3197
- collapsed: y.page.frontmatter.collapsed,
3198
- hidden: ee(y.page.frontmatter)
3199
- }, P = a.get(y.fullPath);
3200
- P?.label && (b.text = P.label), P?.icon && !b.icon && (b.icon = P.icon), P?.style && (b.style = P.style);
3201
- const M = y.page.openApiSpec;
3202
- if (y.page.type === "openapi" && M?.tags?.length) {
3203
- const $ = M.tags.map((N) => ({
3191
+ function g(h) {
3192
+ const p = [];
3193
+ for (const v of h.children.values()) p.push(g(v));
3194
+ if (Oe(p), h.page) {
3195
+ const v = {
3196
+ text: Dr(h.page),
3197
+ link: h.page.linkTo ?? h.page.effectivePath,
3198
+ external: h.page.linkTo ? !0 : void 0,
3199
+ slug: h.page.slug,
3200
+ gate: h.page.frontmatter.gate,
3201
+ order: h.page.frontmatter.order,
3202
+ collapsed: h.page.frontmatter.collapsed,
3203
+ hidden: ne(h.page.frontmatter)
3204
+ }, P = a.get(h.fullPath);
3205
+ P?.label && (v.text = P.label), P?.icon && !v.icon && (v.icon = P.icon), P?.style && (v.style = P.style);
3206
+ const O = h.page.openApiSpec;
3207
+ if (h.page.type === "openapi" && O?.tags?.length) {
3208
+ const $ = O.tags.map((N) => ({
3204
3209
  text: N.name,
3205
- link: `${y.page.effectivePath}#tag/${N.name}`,
3206
- slug: `${y.page.slug}__tag__${N.name}`
3210
+ link: `${h.page.effectivePath}#tag/${N.name}`,
3211
+ slug: `${h.page.slug}__tag__${N.name}`
3207
3212
  }));
3208
- b.items = [...$, ...u];
3209
- } else if (y.page.type === "changelog" && y.page.changelogEntries?.length) {
3210
- const $ = y.page.changelogEntries.map((N, F) => ({
3213
+ v.items = [...$, ...p];
3214
+ } else if (h.page.type === "changelog" && h.page.changelogEntries?.length) {
3215
+ const $ = h.page.changelogEntries.map((N, I) => ({
3211
3216
  text: N.version ? `v${N.version}` : N.title || "unreleased",
3212
- link: `${y.page.effectivePath}#${N.slug}`,
3213
- slug: `${y.page.slug}__${N.slug}`,
3217
+ link: `${h.page.effectivePath}#${N.slug}`,
3218
+ slug: `${h.page.slug}__${N.slug}`,
3214
3219
  hidden: N.hidden,
3215
- order: F
3220
+ order: I
3216
3221
  }));
3217
- b.items = u.length ? [...$, ...u] : $;
3218
- } else if (y.page.type === "roadmap" && y.page.roadmapEntries?.length) {
3219
- const $ = y.page.roadmapEntries.slice().sort(
3220
- (B, z) => (B.targetDate ?? "").localeCompare(z.targetDate ?? "")
3221
- ), N = new Map($.map((B) => [B.href, B])), F = /* @__PURE__ */ new Map(), U = [];
3222
- for (const B of $)
3223
- if (B.parent && N.has(B.parent)) {
3224
- const z = F.get(B.parent) ?? [];
3225
- z.push(B), F.set(B.parent, z);
3222
+ v.items = p.length ? [...$, ...p] : $;
3223
+ } else if (h.page.type === "roadmap" && h.page.roadmapEntries?.length) {
3224
+ const $ = h.page.roadmapEntries.slice().sort(
3225
+ (R, z) => (R.targetDate ?? "").localeCompare(z.targetDate ?? "")
3226
+ ), N = new Map($.map((R) => [R.href, R])), I = /* @__PURE__ */ new Map(), U = [];
3227
+ for (const R of $)
3228
+ if (R.parent && N.has(R.parent)) {
3229
+ const z = I.get(R.parent) ?? [];
3230
+ z.push(R), I.set(R.parent, z);
3226
3231
  } else
3227
- U.push(B);
3228
- const C = (B, z) => {
3229
- const X = F.get(B.href) ?? [], O = {
3230
- text: B.title,
3231
- link: B.href,
3232
- slug: B.slug,
3233
- icon: mr[B.kind],
3234
- hidden: B.hidden,
3232
+ U.push(R);
3233
+ const C = (R, z) => {
3234
+ const V = I.get(R.href) ?? [], _ = {
3235
+ text: R.title,
3236
+ link: R.href,
3237
+ slug: R.slug,
3238
+ icon: mr[R.kind],
3239
+ hidden: R.hidden,
3235
3240
  order: z
3236
3241
  };
3237
- return X.length && (O.items = X.map((R, J) => C(R, J))), O;
3238
- }, I = U.map((B, z) => C(B, z)), E = u.filter((B) => !B.slug || !$.some((z) => z.slug === B.slug));
3239
- b.items = E.length ? [...I, ...E] : I;
3240
- } else if (y.page.type === "component") {
3242
+ return V.length && (_.items = V.map((B, J) => C(B, J))), _;
3243
+ }, F = U.map((R, z) => C(R, z)), E = p.filter((R) => !R.slug || !$.some((z) => z.slug === R.slug));
3244
+ v.items = E.length ? [...F, ...E] : F;
3245
+ } else if (h.page.type === "component") {
3241
3246
  const $ = {
3242
3247
  text: "Overview",
3243
- link: y.page.effectivePath,
3244
- slug: `${y.page.slug}__doc`,
3248
+ link: h.page.effectivePath,
3249
+ slug: `${h.page.slug}__doc`,
3245
3250
  order: -1
3246
- }, N = (y.page.componentData?.stories ?? []).map((F, U) => ({
3247
- text: F.sidebar?.name ?? F.name,
3248
- link: `${y.page.effectivePath}/${ke(F.name)}`,
3249
- slug: `${y.page.slug}__story__${ke(F.name)}`,
3250
- icon: de(F.sidebar?.icon, y.page.filePath),
3251
- style: F.sidebar?.style,
3251
+ }, N = (h.page.componentData?.stories ?? []).map((I, U) => ({
3252
+ text: I.sidebar?.name ?? I.name,
3253
+ link: `${h.page.effectivePath}/${Pe(I.name)}`,
3254
+ slug: `${h.page.slug}__story__${Pe(I.name)}`,
3255
+ icon: he(I.sidebar?.icon, h.page.filePath),
3256
+ style: I.sidebar?.style,
3252
3257
  order: U
3253
3258
  }));
3254
- b.text = ne(y.segment), b.items = [$, ...N, ...u], b.collapsed = !0;
3255
- } else u.length && (b.items = u);
3256
- return b.collapsed !== !1 && b.items?.some(($) => $.collapsed === !1) && (b.collapsed = !1), b;
3259
+ v.text = se(h.segment), v.items = [$, ...N, ...p], v.collapsed = !0;
3260
+ } else p.length && (v.items = p);
3261
+ return v.collapsed !== !1 && v.items?.some(($) => $.collapsed === !1) && (v.collapsed = !1), v;
3257
3262
  }
3258
- const g = a.get(y.fullPath), x = {
3259
- text: g?.label ?? ne(y.segment),
3260
- slug: y.fullPath.replace(/^\//, "")
3263
+ const y = a.get(h.fullPath), x = {
3264
+ text: y?.label ?? se(h.segment),
3265
+ slug: h.fullPath.replace(/^\//, "")
3261
3266
  };
3262
- if (g?.icon && (x.icon = g.icon), g?.style && (x.style = g.style), u.length) {
3263
- x.items = u;
3264
- let b = Number.MAX_SAFE_INTEGER;
3265
- for (const P of u)
3266
- P.order !== void 0 && P.order < b && (b = P.order);
3267
- b !== Number.MAX_SAFE_INTEGER && (x.order = b);
3267
+ if (y?.icon && (x.icon = y.icon), y?.style && (x.style = y.style), p.length) {
3268
+ x.items = p;
3269
+ let v = Number.MAX_SAFE_INTEGER;
3270
+ for (const P of p)
3271
+ P.order !== void 0 && P.order < v && (v = P.order);
3272
+ v !== Number.MAX_SAFE_INTEGER && (x.order = v);
3268
3273
  }
3269
- return x.items?.some((b) => b.collapsed === !1) && (x.collapsed = !1), x;
3274
+ return x.items?.some((v) => v.collapsed === !1) && (x.collapsed = !1), x;
3270
3275
  }
3271
3276
  const w = [];
3272
- for (const y of l.children.values()) w.push(h(y));
3273
- return Ce(w), w;
3277
+ for (const h of l.children.values()) w.push(g(h));
3278
+ return Oe(w), w;
3274
3279
  }
3275
3280
  function Zn() {
3276
3281
  const o = {}, l = {};
3277
- for (const [h, w] of r) {
3278
- if (p && (Dt(w.frontmatter) || yt(w)) || w.sidebarOnly) continue;
3279
- const y = {
3280
- slug: h,
3282
+ for (const [g, w] of r) {
3283
+ if (u && (Dt(w.frontmatter) || yt(w)) || w.sidebarOnly) continue;
3284
+ const h = {
3285
+ slug: g,
3281
3286
  path: w.effectivePath,
3282
3287
  type: w.type,
3283
3288
  title: w.frontmatter.title,
3284
3289
  gate: w.frontmatter.gate,
3285
- bundle: yt(w) ? Vt(w) : void 0,
3290
+ bundle: yt(w) ? Xt(w) : void 0,
3286
3291
  description: w.frontmatter.description,
3287
3292
  order: w.frontmatter.order,
3288
- hidden: ee(w.frontmatter),
3293
+ hidden: ne(w.frontmatter),
3289
3294
  redirect: w.frontmatter.redirect,
3290
3295
  meta: w.frontmatter.meta
3291
3296
  };
3292
- if (o[h] = y, l[w.effectivePath] = h, w.type === "component")
3293
- for (const u of w.componentData?.stories ?? [])
3294
- l[`${w.effectivePath}/${ke(u.name)}`] = h;
3297
+ if (o[g] = h, l[w.effectivePath] = g, w.type === "component")
3298
+ for (const p of w.componentData?.stories ?? [])
3299
+ l[`${w.effectivePath}/${Pe(p.name)}`] = g;
3295
3300
  }
3296
3301
  const a = {};
3297
- for (const h of r.values())
3298
- h.sidebarOnly || p && (Dt(h.frontmatter) || yt(h)) || h.pageCss && (a[h.effectivePath] = h.pageCss);
3299
- return { pages: o, byPath: l, sidebar: Ge(), styles: a };
3300
- }
3301
- function Ve(o = !1, l) {
3302
- const a = [], h = l ? l.map((w) => [w.slug, w]) : r;
3303
- for (const [w, y] of h) {
3304
- if (y.sidebarOnly) continue;
3302
+ for (const g of r.values())
3303
+ g.sidebarOnly || u && (Dt(g.frontmatter) || yt(g)) || g.pageCss && (a[g.effectivePath] = g.pageCss);
3304
+ return { pages: o, byPath: l, sidebar: Ve(), styles: a };
3305
+ }
3306
+ function Xe(o = !1, l) {
3307
+ const a = [], g = l ? l.map((w) => [w.slug, w]) : r;
3308
+ for (const [w, h] of g) {
3309
+ if (h.sidebarOnly) continue;
3305
3310
  if (o) {
3306
- if (Dt(y.frontmatter) || !yt(y)) continue;
3307
- } else if (p && (Dt(y.frontmatter) || yt(y))) continue;
3308
- const u = y.rawText.replace(/```[\s\S]*?```/g, "").replace(/[#*`>_\[\]\(\)]/g, " "), g = y.type === "openapi" ? Qn(y.openApiSpec) : "", x = y.type === "roadmap" ? ts(y.roadmapEntries ?? []) : "", b = y.componentData ? [
3309
- y.componentData.component,
3310
- y.componentData.system,
3311
- ...(y.componentData.stories ?? []).flatMap(($) => [$.name, $.file])
3312
- ].filter(Boolean).join(" ") : "", P = y.dbmlSource ? y.dbmlSource.replace(/[{}\[\]'"`,]/g, " ") : "", M = [u, g, x, b, P].filter(Boolean).join(`
3311
+ if (Dt(h.frontmatter) || !yt(h)) continue;
3312
+ } else if (u && (Dt(h.frontmatter) || yt(h))) continue;
3313
+ const p = h.rawText.replace(/```[\s\S]*?```/g, "").replace(/[#*`>_\[\]\(\)]/g, " "), y = h.type === "openapi" ? Qn(h.openApiSpec) : "", x = h.type === "roadmap" ? ts(h.roadmapEntries ?? []) : "", v = h.componentData ? [
3314
+ h.componentData.component,
3315
+ h.componentData.system,
3316
+ ...(h.componentData.stories ?? []).flatMap(($) => [$.name, $.file])
3317
+ ].filter(Boolean).join(" ") : "", P = h.dbmlSource ? h.dbmlSource.replace(/[{}\[\]'"`,]/g, " ") : "", O = [p, y, x, v, P].filter(Boolean).join(`
3313
3318
  `);
3314
3319
  a.push({
3315
3320
  slug: w,
3316
- path: y.effectivePath,
3317
- title: y.frontmatter.title,
3318
- description: y.frontmatter.description,
3319
- body: M,
3320
- gate: y.frontmatter.gate,
3321
- headings: y.headings.map(($) => $.text),
3321
+ path: h.effectivePath,
3322
+ title: h.frontmatter.title,
3323
+ description: h.frontmatter.description,
3324
+ body: O,
3325
+ gate: h.frontmatter.gate,
3326
+ headings: h.headings.map(($) => $.text),
3322
3327
  tags: [
3323
- ...he(y.frontmatter.tags),
3324
- ...y.componentData ? [y.componentData.component] : []
3328
+ ...ge(h.frontmatter.tags),
3329
+ ...h.componentData ? [h.componentData.component] : []
3325
3330
  ]
3326
3331
  });
3327
3332
  }
3328
3333
  return a;
3329
3334
  }
3330
- function Xe(o) {
3335
+ function Ye(o) {
3331
3336
  return o ? o.replace(/<[^>]+>/g, " ").replace(/&[a-z]+;/gi, " ") : "";
3332
3337
  }
3333
3338
  function Qn(o) {
3334
3339
  if (!o || typeof o != "object") return "";
3335
- const l = o, a = [], h = /* @__PURE__ */ new WeakSet(), w = 12, y = (u, g) => {
3336
- if (u == null || g > w) return;
3337
- const x = typeof u;
3340
+ const l = o, a = [], g = /* @__PURE__ */ new WeakSet(), w = 12, h = (p, y) => {
3341
+ if (p == null || y > w) return;
3342
+ const x = typeof p;
3338
3343
  if (x === "string") {
3339
- const b = u.trim();
3340
- b && a.push(b);
3344
+ const v = p.trim();
3345
+ v && a.push(v);
3341
3346
  return;
3342
3347
  }
3343
3348
  if (x === "number" || x === "boolean") {
3344
- a.push(String(u));
3349
+ a.push(String(p));
3345
3350
  return;
3346
3351
  }
3347
- if (x === "object" && !h.has(u)) {
3348
- if (h.add(u), Array.isArray(u)) {
3349
- for (const b of u) y(b, g + 1);
3352
+ if (x === "object" && !g.has(p)) {
3353
+ if (g.add(p), Array.isArray(p)) {
3354
+ for (const v of p) h(v, y + 1);
3350
3355
  return;
3351
3356
  }
3352
- for (const [b, P] of Object.entries(u)) {
3353
- if (b === "description_html" || b === "summary_html" || b === "requestBodyHtml") {
3354
- typeof P == "string" && a.push(Xe(P));
3357
+ for (const [v, P] of Object.entries(p)) {
3358
+ if (v === "description_html" || v === "summary_html" || v === "requestBodyHtml") {
3359
+ typeof P == "string" && a.push(Ye(P));
3355
3360
  continue;
3356
3361
  }
3357
- a.push(b), y(P, g + 1);
3362
+ a.push(v), h(P, y + 1);
3358
3363
  }
3359
3364
  }
3360
3365
  };
3361
3366
  l.title && a.push(l.title), l.description && a.push(l.description);
3362
- for (const u of l.servers ?? [])
3363
- u.url && a.push(u.url), u.description && a.push(u.description);
3364
- for (const [u, g] of Object.entries(l.securitySchemes ?? {}))
3365
- a.push(u), y(g, 0);
3366
- for (const u of l.tags ?? []) {
3367
- u.name && a.push(u.name), u.description && a.push(u.description);
3368
- for (const g of u.operations ?? []) {
3369
- const x = g;
3370
- x.method && a.push(x.method.toLowerCase(), x.method.toUpperCase()), y(g, 0);
3367
+ for (const p of l.servers ?? [])
3368
+ p.url && a.push(p.url), p.description && a.push(p.description);
3369
+ for (const [p, y] of Object.entries(l.securitySchemes ?? {}))
3370
+ a.push(p), h(y, 0);
3371
+ for (const p of l.tags ?? []) {
3372
+ p.name && a.push(p.name), p.description && a.push(p.description);
3373
+ for (const y of p.operations ?? []) {
3374
+ const x = y;
3375
+ x.method && a.push(x.method.toLowerCase(), x.method.toUpperCase()), h(y, 0);
3371
3376
  }
3372
3377
  }
3373
- for (const [u, g] of Object.entries(l.schemas ?? {}))
3374
- a.push(u), y(g, 0);
3378
+ for (const [p, y] of Object.entries(l.schemas ?? {}))
3379
+ a.push(p), h(y, 0);
3375
3380
  return a.join(`
3376
3381
  `);
3377
3382
  }
3378
3383
  function ts(o) {
3379
3384
  const l = [];
3380
3385
  for (const a of o) {
3381
- l.push(a.slug, a.kind, a.title), a.description && l.push(a.description), a.targetDate && l.push(a.targetDate), a.html && l.push(Xe(a.html));
3382
- for (const h of a.changelog)
3383
- l.push(h.version, h.title), h.description && l.push(h.description), h.releaseDate && l.push(h.releaseDate);
3386
+ l.push(a.slug, a.kind, a.title), a.description && l.push(a.description), a.targetDate && l.push(a.targetDate), a.html && l.push(Ye(a.html));
3387
+ for (const g of a.changelog)
3388
+ l.push(g.version, g.title), g.description && l.push(g.description), g.releaseDate && l.push(g.releaseDate);
3384
3389
  }
3385
3390
  return l.join(`
3386
3391
  `);
3387
3392
  }
3388
- function he(o) {
3393
+ function ge(o) {
3389
3394
  if (!o) return [];
3390
3395
  const l = Array.isArray(o) ? o : String(o).split(","), a = [];
3391
- for (const h of l) {
3392
- const w = String(h).trim();
3396
+ for (const g of l) {
3397
+ const w = String(g).trim();
3393
3398
  w && a.push(w);
3394
3399
  }
3395
3400
  return a;
@@ -3397,27 +3402,27 @@ ${P.join(`
3397
3402
  function At(o) {
3398
3403
  return o === "" ? "__root__" : o;
3399
3404
  }
3400
- function Ye(o) {
3405
+ function Ke(o) {
3401
3406
  return o === "__root__" ? "" : o;
3402
3407
  }
3403
- function Xt(o) {
3404
- for (const l of [Kt, Zt, Qt, te]) {
3408
+ function Yt(o) {
3409
+ for (const l of [Zt, Qt, te, ee]) {
3405
3410
  const a = o.moduleGraph.getModuleById("\0" + l);
3406
3411
  a && o.moduleGraph.invalidateModule(a);
3407
3412
  }
3408
3413
  }
3409
- function ge(o) {
3414
+ function ye(o) {
3410
3415
  for (const l of r.keys()) {
3411
- const a = Mt + At(l) + ".js", h = Nt + At(l) + ".svelte", w = o.moduleGraph.getModuleById(a), y = o.moduleGraph.getModuleById(h);
3412
- w && o.moduleGraph.invalidateModule(w), y && o.moduleGraph.invalidateModule(y);
3416
+ const a = _t + At(l) + ".js", g = Ft + At(l) + ".svelte", w = o.moduleGraph.getModuleById(a), h = o.moduleGraph.getModuleById(g);
3417
+ w && o.moduleGraph.invalidateModule(w), h && o.moduleGraph.invalidateModule(h);
3413
3418
  }
3414
3419
  }
3415
3420
  function es() {
3416
3421
  const o = [];
3417
3422
  for (const [l, a] of r) {
3418
- if (a.sidebarOnly || p && (Dt(a.frontmatter) || yt(a))) continue;
3419
- const h = `${Nt}${At(l)}.svelte`;
3420
- o.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(h)})`);
3423
+ if (a.sidebarOnly || u && (Dt(a.frontmatter) || yt(a))) continue;
3424
+ const g = `${Ft}${At(l)}.svelte`;
3425
+ o.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(g)})`);
3421
3426
  }
3422
3427
  return `export const pages = {
3423
3428
  ${o.join(`,
@@ -3429,9 +3434,9 @@ export default pages
3429
3434
  function ns() {
3430
3435
  const o = [];
3431
3436
  for (const [l, a] of r) {
3432
- if (a.sidebarOnly || p && (Dt(a.frontmatter) || yt(a))) continue;
3433
- const h = `${Mt}${At(l)}.js`;
3434
- o.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(h)})`);
3437
+ if (a.sidebarOnly || u && (Dt(a.frontmatter) || yt(a))) continue;
3438
+ const g = `${_t}${At(l)}.js`;
3439
+ o.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(g)})`);
3435
3440
  }
3436
3441
  return `export const bodies = {
3437
3442
  ${o.join(`,
@@ -3468,14 +3473,14 @@ export default bodies
3468
3473
  path: l.effectivePath,
3469
3474
  type: l.type,
3470
3475
  frontmatter: l.frontmatter
3471
- }, h = `${Mt}${At(o)}.js`;
3476
+ }, g = `${_t}${At(o)}.js`;
3472
3477
  return `<script lang="ts">
3473
3478
  import { Page, OpenApiRoot, ChangelogPage, HeroPage, RoadmapPage, ComponentPage, DbmlPage, setPageMeta, applyPageStyles } from '@nimtech/nimpress'
3474
3479
  import type { PageBody } from '@nimtech/nimpress'
3475
3480
  const shell = ${JSON.stringify(a).replace(/<\/script>/g, "<\\/script>")}
3476
3481
  setPageMeta(shell)
3477
3482
  applyPageStyles(shell.path)
3478
- const bodyPromise: Promise<{ default: PageBody }> = import(${JSON.stringify(h)})
3483
+ const bodyPromise: Promise<{ default: PageBody }> = import(${JSON.stringify(g)})
3479
3484
  <\/script>
3480
3485
 
3481
3486
  {#if shell.type === 'hero'}
@@ -3509,83 +3514,83 @@ export default bodies
3509
3514
  return t = (await Ws(process.cwd(), e)).resolved, n = q(process.cwd(), t.contentDir), s = q(process.cwd(), t.assetsDir), {};
3510
3515
  },
3511
3516
  configResolved(o) {
3512
- p = o.command === "build", c = q(o.root, o.build.outDir);
3517
+ u = o.command === "build", c = q(o.root, o.build.outDir);
3513
3518
  },
3514
3519
  async buildStart() {
3515
- await it(), p && Tt();
3520
+ await at(), u && Nt();
3516
3521
  },
3517
3522
  async closeBundle(o) {
3518
- if (!p || o) return;
3523
+ if (!u || o) return;
3519
3524
  const l = W(c, "index.html"), a = W(c, "404.html");
3520
- if (await rs(l, a), await nt(W(c, ".nojekyll"), ""), mt(n) && await Ze(n, c, {
3525
+ if (await rs(l, a), await nt(W(c, ".nojekyll"), ""), dt(n) && await Ze(n, c, {
3521
3526
  recursive: !0,
3522
- filter: (h) => {
3527
+ filter: (g) => {
3523
3528
  try {
3524
- return re(h).isDirectory() || !(h.endsWith(".md") || h.endsWith(".css"));
3529
+ return ie(g).isDirectory() || !(g.endsWith(".md") || g.endsWith(".css"));
3525
3530
  } catch {
3526
3531
  return !1;
3527
3532
  }
3528
3533
  }
3529
- }), mt(s)) {
3530
- const h = W(c, t.assetUrlBase.replace(/^\//, ""));
3531
- await Ze(s, h, { recursive: !0 });
3534
+ }), dt(s)) {
3535
+ const g = W(c, t.assetUrlBase.replace(/^\//, ""));
3536
+ await Ze(s, g, { recursive: !0 });
3532
3537
  }
3533
- for (const [h, w] of $t) {
3534
- const y = W(c, h.replace(/^\//, ""));
3535
- await _t(V(y), { recursive: !0 }), await nt(y, w);
3538
+ for (const [g, w] of St) {
3539
+ const h = W(c, g.replace(/^\//, ""));
3540
+ await Tt(G(h), { recursive: !0 }), await nt(h, w);
3536
3541
  }
3537
- await nt(W(c, "subscribe.map.json"), fe), await Vn(), await Xn();
3542
+ await nt(W(c, "subscribe.map.json"), me), await Vn(), await Xn();
3538
3543
  },
3539
3544
  configureServer(o) {
3540
- v = o, o.watcher.add(n), o.watcher.add(s);
3541
- for (const u of S) o.watcher.add(u);
3542
- for (const u of j) o.watcher.add(u);
3543
- const l = async (u) => {
3544
- if (!(!u.startsWith(n) || !(u.endsWith(".md") || u.endsWith(".css") || u.match(/\.story\.tsx?$/)))) {
3545
- u.endsWith(".css") && pt(u.replace(/\.css$/, ".md")), u.match(/\.story\.tsx?$/) && pt(W(V(u), "index.md"));
3545
+ b = o, o.watcher.add(n), o.watcher.add(s);
3546
+ for (const p of S) o.watcher.add(p);
3547
+ for (const p of j) o.watcher.add(p);
3548
+ const l = async (p) => {
3549
+ if (!(!p.startsWith(n) || !(p.endsWith(".md") || p.endsWith(".css") || p.match(/\.story\.tsx?$/)))) {
3550
+ p.endsWith(".css") && pt(p.replace(/\.css$/, ".md")), p.match(/\.story\.tsx?$/) && pt(W(G(p), "index.md"));
3546
3551
  try {
3547
- await it();
3552
+ await at();
3548
3553
  } catch (x) {
3549
3554
  o.config.logger.error(String(x));
3550
3555
  return;
3551
3556
  }
3552
- Xt(o), ge(o), Tt(), o.ws.send({ type: "full-reload" });
3557
+ Yt(o), ye(o), Nt(), o.ws.send({ type: "full-reload" });
3553
3558
  }
3554
- }, a = async (u) => {
3555
- if (u.startsWith(n) && (u.endsWith(".md") || u.endsWith(".css") || u.match(/\.story\.tsx?$/))) {
3556
- u.match(/\.story\.tsx?$/) ? pt(W(V(u), "index.md")) : pt(u.endsWith(".css") ? u.replace(/\.css$/, ".md") : u);
3559
+ }, a = async (p) => {
3560
+ if (p.startsWith(n) && (p.endsWith(".md") || p.endsWith(".css") || p.match(/\.story\.tsx?$/))) {
3561
+ p.match(/\.story\.tsx?$/) ? pt(W(G(p), "index.md")) : pt(p.endsWith(".css") ? p.replace(/\.css$/, ".md") : p);
3557
3562
  try {
3558
- await it();
3563
+ await at();
3559
3564
  } catch (x) {
3560
3565
  o.config.logger.error(String(x));
3561
3566
  return;
3562
3567
  }
3563
- Xt(o), ge(o), Tt(), o.ws.send({ type: "full-reload" });
3568
+ Yt(o), ye(o), Nt(), o.ws.send({ type: "full-reload" });
3564
3569
  return;
3565
3570
  }
3566
- if (m.has(u)) {
3567
- const x = m.get(u);
3571
+ if (m.has(p)) {
3572
+ const x = m.get(p);
3568
3573
  pt(x);
3569
3574
  }
3570
- k.has(u) && pt(k.get(u));
3575
+ k.has(p) && pt(k.get(p));
3571
3576
  };
3572
3577
  if (o.watcher.on("add", l), o.watcher.on("unlink", a), t.banner !== !1) {
3573
- const u = zs(), g = t.banner, x = Date.now();
3578
+ const p = zs(), y = t.banner, x = Date.now();
3574
3579
  o.printUrls = function() {
3575
- const b = o.resolvedUrls, P = b?.local?.[0] ?? `http://localhost:${o.config.server.port ?? 5173}/`, M = b?.network?.[0] ?? "use --host to expose", $ = qs({
3576
- title: g.title ?? t.title ?? u.name ?? "Nimpress",
3577
- tagline: g.tagline,
3578
- company: g.company,
3579
- version: g.version ?? u.version,
3580
+ const v = o.resolvedUrls, P = v?.local?.[0] ?? `http://localhost:${o.config.server.port ?? 5173}/`, O = v?.network?.[0] ?? "use --host to expose", $ = qs({
3581
+ title: y.title ?? t.title ?? p.name ?? "Nimpress",
3582
+ tagline: y.tagline,
3583
+ company: y.company,
3584
+ version: y.version ?? p.version,
3580
3585
  localUrl: P,
3581
- networkUrl: M,
3586
+ networkUrl: O,
3582
3587
  duration: Date.now() - x
3583
3588
  });
3584
3589
  process.stdout.write("\x1Bc"), process.stdout.write($ + `
3585
- `), Tt();
3590
+ `), Nt();
3586
3591
  };
3587
3592
  }
3588
- const h = {
3593
+ const g = {
3589
3594
  ".png": "image/png",
3590
3595
  ".jpg": "image/jpeg",
3591
3596
  ".jpeg": "image/jpeg",
@@ -3601,140 +3606,140 @@ export default bodies
3601
3606
  ".woff": "font/woff",
3602
3607
  ".woff2": "font/woff2",
3603
3608
  ".mp4": "video/mp4"
3604
- }, w = t.assetUrlBase, y = (u, g, x) => {
3605
- if (!g || g.endsWith(".md")) return !1;
3606
- const b = W(u, decodeURIComponent(g));
3607
- return !b.startsWith(u) || !mt(b) || !re(b).isFile() ? !1 : (x.setHeader("Content-Type", h[Me(b).toLowerCase()] ?? "application/octet-stream"), is(b).pipe(x), !0);
3609
+ }, w = t.assetUrlBase, h = (p, y, x) => {
3610
+ if (!y || y.endsWith(".md")) return !1;
3611
+ const v = W(p, decodeURIComponent(y));
3612
+ return !v.startsWith(p) || !dt(v) || !ie(v).isFile() ? !1 : (x.setHeader("Content-Type", g[_e(v).toLowerCase()] ?? "application/octet-stream"), is(v).pipe(x), !0);
3608
3613
  };
3609
- return o.middlewares.use((u, g, x) => {
3610
- const b = (u.url ?? "").split("?")[0], P = Es(t.base, b);
3614
+ return o.middlewares.use((p, y, x) => {
3615
+ const v = (p.url ?? "").split("?")[0], P = Es(t.base, v);
3611
3616
  if (P.startsWith("/@") || P.startsWith("/node_modules/")) return x();
3612
- if (P === "/__nimpress/claude-md" && u.method === "PUT") {
3613
- const F = [];
3614
- u.on("data", (U) => F.push(U)), u.on("end", async () => {
3617
+ if (P === "/__nimpress/claude-md" && p.method === "PUT") {
3618
+ const I = [];
3619
+ p.on("data", (U) => I.push(U)), p.on("end", async () => {
3615
3620
  try {
3616
- const U = JSON.parse(Buffer.concat(F).toString("utf-8")), C = String(U.path ?? ""), I = String(U.content ?? ""), E = q(process.cwd(), C);
3617
- if (!Object.values(t.modules.systems).filter((X) => X.source).map((X) => q(process.cwd(), X.source)).some((X) => E.startsWith(X + kt)) || !E.endsWith(`${kt}CLAUDE.md`) || !mt(V(E))) {
3618
- g.statusCode = 403, g.end("invalid claude-md target");
3621
+ const U = JSON.parse(Buffer.concat(I).toString("utf-8")), C = String(U.path ?? ""), F = String(U.content ?? ""), E = q(process.cwd(), C);
3622
+ if (!Object.values(t.modules.systems).filter((V) => V.source).map((V) => q(process.cwd(), V.source)).some((V) => E.startsWith(V + kt)) || !E.endsWith(`${kt}CLAUDE.md`) || !dt(G(E))) {
3623
+ y.statusCode = 403, y.end("invalid claude-md target");
3619
3624
  return;
3620
3625
  }
3621
- await nt(E, I), pt(k.get(E) ?? ""), g.statusCode = 204, g.end();
3626
+ await nt(E, F), pt(k.get(E) ?? ""), y.statusCode = 204, y.end();
3622
3627
  } catch (U) {
3623
- g.statusCode = 400, g.end(String(U));
3628
+ y.statusCode = 400, y.end(String(U));
3624
3629
  }
3625
3630
  });
3626
3631
  return;
3627
3632
  }
3628
- if (P === "/__nimpress/schema-defaults" && u.method === "PUT") {
3629
- const F = [];
3630
- u.on("data", (U) => F.push(U)), u.on("end", async () => {
3633
+ if (P === "/__nimpress/schema-defaults" && p.method === "PUT") {
3634
+ const I = [];
3635
+ p.on("data", (U) => I.push(U)), p.on("end", async () => {
3631
3636
  try {
3632
- const U = JSON.parse(Buffer.concat(F).toString("utf-8")), C = String(U.path ?? ""), I = q(process.cwd(), C), E = I.endsWith(`${kt}schema.json`) || I.endsWith(`${kt}schema.yml`);
3633
- if (!I.startsWith(n + kt) || !E || !mt(I)) {
3634
- g.statusCode = 403, g.end("invalid schema target");
3637
+ const U = JSON.parse(Buffer.concat(I).toString("utf-8")), C = String(U.path ?? ""), F = q(process.cwd(), C), E = F.endsWith(`${kt}schema.json`) || F.endsWith(`${kt}schema.yml`);
3638
+ if (!F.startsWith(n + kt) || !E || !dt(F)) {
3639
+ y.statusCode = 403, y.end("invalid schema target");
3635
3640
  return;
3636
3641
  }
3637
- const B = I.endsWith(".yml") ? "yml" : "json", z = Gt(await rt(I, "utf-8"), B);
3638
- for (const [X, O] of Object.entries(U.defaults ?? {})) {
3639
- const R = z.properties?.[X];
3640
- R && (R.default = O);
3642
+ const R = F.endsWith(".yml") ? "yml" : "json", z = Vt(await it(F, "utf-8"), R);
3643
+ for (const [V, _] of Object.entries(U.defaults ?? {})) {
3644
+ const B = z.properties?.[V];
3645
+ B && (B.default = _);
3641
3646
  }
3642
- await nt(I, Ut(z, B)), pt(k.get(I) ?? ""), g.statusCode = 204, g.end();
3647
+ await nt(F, Jt(z, R)), pt(k.get(F) ?? ""), y.statusCode = 204, y.end();
3643
3648
  } catch (U) {
3644
- g.statusCode = 400, g.end(String(U));
3649
+ y.statusCode = 400, y.end(String(U));
3645
3650
  }
3646
3651
  });
3647
3652
  return;
3648
3653
  }
3649
- const M = $t.get(P);
3650
- if (M !== void 0) {
3651
- g.setHeader("Content-Type", "application/rss+xml; charset=utf-8"), g.end(M);
3654
+ const O = St.get(P);
3655
+ if (O !== void 0) {
3656
+ y.setHeader("Content-Type", "application/rss+xml; charset=utf-8"), y.end(O);
3652
3657
  return;
3653
3658
  }
3654
3659
  if (P === "/subscribe.map.json") {
3655
- g.setHeader("Content-Type", "application/json; charset=utf-8"), g.end(fe);
3660
+ y.setHeader("Content-Type", "application/json; charset=utf-8"), y.end(me);
3656
3661
  return;
3657
3662
  }
3658
3663
  const $ = t.modules.route.replace(/\/$/, "");
3659
3664
  if (P === $ || P.startsWith($ + "/")) {
3660
- const F = P.slice($.length).replace(/^\/+/, ""), U = decodeURIComponent(F.split("/")[0] ?? "");
3665
+ const I = P.slice($.length).replace(/^\/+/, ""), U = decodeURIComponent(I.split("/")[0] ?? "");
3661
3666
  if (!t.modules.systems[U]) {
3662
- g.statusCode = 404, g.end(`unknown module system: ${U}`);
3667
+ y.statusCode = 404, y.end(`unknown module system: ${U}`);
3663
3668
  return;
3664
3669
  }
3665
- const I = as(
3670
+ const F = as(
3666
3671
  {
3667
3672
  host: "127.0.0.1",
3668
- port: Ae(t.modules, U),
3669
- path: `${P}${(u.url ?? "").includes("?") ? `?${(u.url ?? "").split("?").slice(1).join("?")}` : ""}`,
3670
- method: u.method,
3671
- headers: u.headers
3673
+ port: Ce(t.modules, U),
3674
+ path: `${P}${(p.url ?? "").includes("?") ? `?${(p.url ?? "").split("?").slice(1).join("?")}` : ""}`,
3675
+ method: p.method,
3676
+ headers: p.headers
3672
3677
  },
3673
3678
  (E) => {
3674
- g.writeHead(E.statusCode ?? 502, E.headers), E.pipe(g);
3679
+ y.writeHead(E.statusCode ?? 502, E.headers), E.pipe(y);
3675
3680
  }
3676
3681
  );
3677
- I.on("error", () => {
3678
- g.statusCode = 503, g.setHeader("Content-Type", "text/html"), g.end(
3682
+ F.on("error", () => {
3683
+ y.statusCode = 503, y.setHeader("Content-Type", "text/html"), y.end(
3679
3684
  `<!doctype html><html><body style="font-family:monospace;padding:2rem"><p>module harness for <b>${U}</b> is not running.</p><p>start it with: <code>nimpress modules dev ${U}</code></p></body></html>`
3680
3685
  );
3681
- }), u.pipe(I);
3686
+ }), p.pipe(F);
3682
3687
  return;
3683
3688
  }
3684
3689
  if (w === "/" || P === w || P.startsWith(w + "/")) {
3685
- const F = w === "/" ? P : P.slice(w.length);
3686
- if (y(s, F.replace(/^\/+/, ""), g)) return;
3690
+ const I = w === "/" ? P : P.slice(w.length);
3691
+ if (h(s, I.replace(/^\/+/, ""), y)) return;
3687
3692
  }
3688
- y(n, P.replace(/^\/+/, ""), g) || x();
3693
+ h(n, P.replace(/^\/+/, ""), y) || x();
3689
3694
  }), () => {
3690
- o.middlewares.use(async (u, g, x) => {
3691
- if (u.method !== "GET" && u.method !== "HEAD" || !(u.headers.accept ?? "").includes("text/html")) return x();
3695
+ o.middlewares.use(async (p, y, x) => {
3696
+ if (p.method !== "GET" && p.method !== "HEAD" || !(p.headers.accept ?? "").includes("text/html")) return x();
3692
3697
  try {
3693
- const b = await o.transformIndexHtml(
3694
- u.url ?? "/",
3698
+ const v = await o.transformIndexHtml(
3699
+ p.url ?? "/",
3695
3700
  lr(t, "/@id/__x00__virtual:nimpress/main")
3696
3701
  );
3697
- g.statusCode = 200, g.setHeader("Content-Type", "text/html"), g.end(b);
3698
- } catch (b) {
3699
- x(b);
3702
+ y.statusCode = 200, y.setHeader("Content-Type", "text/html"), y.end(v);
3703
+ } catch (v) {
3704
+ x(v);
3700
3705
  }
3701
3706
  });
3702
3707
  };
3703
3708
  },
3704
3709
  async handleHotUpdate(o) {
3705
- const l = o.file, a = l.endsWith(".md") && l.startsWith(n), h = l.endsWith(".css") && l.startsWith(n), w = l.match(/\.story\.tsx?$/) && l.startsWith(n), y = m.get(l), u = k.get(l);
3706
- if (h) {
3710
+ const l = o.file, a = l.endsWith(".md") && l.startsWith(n), g = l.endsWith(".css") && l.startsWith(n), w = l.match(/\.story\.tsx?$/) && l.startsWith(n), h = m.get(l), p = k.get(l);
3711
+ if (g) {
3707
3712
  pt(l.replace(/\.css$/, ".md"));
3708
3713
  try {
3709
- await it();
3714
+ await at();
3710
3715
  } catch (x) {
3711
3716
  o.server.config.logger.error(String(x));
3712
3717
  return;
3713
3718
  }
3714
- return Xt(o.server), o.server.ws.send({ type: "full-reload" }), [];
3719
+ return Yt(o.server), o.server.ws.send({ type: "full-reload" }), [];
3715
3720
  }
3716
- if (!a && !w && !y && !u) return;
3717
- const g = a ? l : w ? W(V(l), "index.md") : y ?? u;
3718
- pt(g);
3721
+ if (!a && !w && !h && !p) return;
3722
+ const y = a ? l : w ? W(G(l), "index.md") : h ?? p;
3723
+ pt(y);
3719
3724
  try {
3720
- await it();
3725
+ await at();
3721
3726
  } catch (x) {
3722
3727
  o.server.config.logger.error(String(x));
3723
3728
  return;
3724
3729
  }
3725
- return Xt(o.server), ge(o.server), Tt(), o.server.ws.send({ type: "full-reload" }), [];
3730
+ return Yt(o.server), ye(o.server), Nt(), o.server.ws.send({ type: "full-reload" }), [];
3726
3731
  },
3727
3732
  resolveId(o) {
3728
- return o === Kt ? "\0" + Kt : o === Zt ? "\0" + Zt : o === Qt ? "\0" + Qt : o === te ? "\0" + te : o === we ? "\0" + we : o === $e ? "\0" + $e : o.startsWith(Nt) && o.endsWith(".svelte") || o.startsWith(Mt) && o.endsWith(".js") ? o : null;
3733
+ return o === Zt ? "\0" + Zt : o === Qt ? "\0" + Qt : o === te ? "\0" + te : o === ee ? "\0" + ee : o === $e ? "\0" + $e : o === Se ? "\0" + Se : o.startsWith(Ft) && o.endsWith(".svelte") || o.startsWith(_t) && o.endsWith(".js") ? o : null;
3729
3734
  },
3730
3735
  async load(o) {
3731
- if (o === "\0" + Kt)
3736
+ if (o === "\0" + Zt)
3732
3737
  return `export default ${JSON.stringify(Zn())}`;
3733
- if (o === "\0" + we)
3738
+ if (o === "\0" + $e)
3734
3739
  return `export default ${JSON.stringify(Ls(t))}`;
3735
- if (o === "\0" + $e) {
3736
- const l = t.css.map((y) => `import ${JSON.stringify(y.startsWith("/") ? y : "/" + y)}`).join(`
3737
- `), a = t.client ? t.client.startsWith("/") ? t.client : "/" + t.client.replace(/^\.\//, "") : null, h = a ? `import { authFunctions, subscribeFunctions } from ${JSON.stringify(a)}` : "";
3740
+ if (o === "\0" + Se) {
3741
+ const l = t.css.map((h) => `import ${JSON.stringify(h.startsWith("/") ? h : "/" + h)}`).join(`
3742
+ `), a = t.client ? t.client.startsWith("/") ? t.client : "/" + t.client.replace(/^\.\//, "") : null, g = a ? `import { authFunctions, subscribeFunctions } from ${JSON.stringify(a)}` : "";
3738
3743
  return `import '@nimtech/nimpress/app.css'
3739
3744
  ${l}
3740
3745
  import { createNimpressApp } from '@nimtech/nimpress'
@@ -3742,26 +3747,26 @@ import config from 'virtual:nimpress/config'
3742
3747
  import manifest from 'virtual:nimpress/manifest'
3743
3748
  import searchIndex from 'virtual:nimpress/search'
3744
3749
  import pages from 'virtual:nimpress/pages'
3745
- ${h}
3750
+ ${g}
3746
3751
  const app = createNimpressApp({ ...config, manifest, searchIndex, pageLoader: pages${a ? ", authFunctions, subscribeFunctions" : ""} })
3747
3752
  const target = document.getElementById('app')
3748
3753
  if (!target) throw new Error('Mount target #app missing')
3749
3754
  app.mount(target)
3750
3755
  `;
3751
3756
  }
3752
- if (o === "\0" + Zt)
3753
- return `export default ${JSON.stringify(Ve())}`;
3754
3757
  if (o === "\0" + Qt)
3755
- return es();
3758
+ return `export default ${JSON.stringify(Xe())}`;
3756
3759
  if (o === "\0" + te)
3760
+ return es();
3761
+ if (o === "\0" + ee)
3757
3762
  return ns();
3758
- if (o.startsWith(Nt) && o.endsWith(".svelte")) {
3759
- const l = o.slice(Nt.length, -7);
3760
- return os(Ye(l));
3763
+ if (o.startsWith(Ft) && o.endsWith(".svelte")) {
3764
+ const l = o.slice(Ft.length, -7);
3765
+ return os(Ke(l));
3761
3766
  }
3762
- if (o.startsWith(Mt) && o.endsWith(".js")) {
3763
- const l = o.slice(Mt.length, -3);
3764
- return ss(Ye(l));
3767
+ if (o.startsWith(_t) && o.endsWith(".js")) {
3768
+ const l = o.slice(_t.length, -3);
3769
+ return ss(Ke(l));
3765
3770
  }
3766
3771
  return null;
3767
3772
  }
@@ -3771,44 +3776,44 @@ function ii(e) {
3771
3776
  return e;
3772
3777
  }
3773
3778
  async function ai(e, t) {
3774
- const n = q(e, t), s = await Ue(n), r = [];
3779
+ const n = q(e, t), s = await Je(n), r = [];
3775
3780
  for (const i of s) {
3776
3781
  let c;
3777
3782
  try {
3778
- c = await rt(i, "utf-8");
3783
+ c = await it(i, "utf-8");
3779
3784
  } catch {
3780
3785
  continue;
3781
3786
  }
3782
- const { data: p, content: v } = _e(c);
3783
- for (const d of Fn(p, v))
3787
+ const { data: u, content: b } = Te(c);
3788
+ for (const d of Fn(u, b))
3784
3789
  r.push(`${jt(n, i).split(kt).join("/")}: ${d}`);
3785
3790
  }
3786
3791
  return r;
3787
3792
  }
3788
3793
  export {
3789
3794
  No as a,
3790
- Re as b,
3791
- Be as c,
3792
- Rt as d,
3795
+ We as b,
3796
+ Re as c,
3797
+ Wt as d,
3793
3798
  ln as e,
3794
3799
  un as f,
3795
- Tt as g,
3800
+ Nt as g,
3796
3801
  oi as h,
3797
3802
  lr as i,
3798
3803
  ri as j,
3799
- Ae as k,
3804
+ Ce as k,
3800
3805
  ai as l,
3801
3806
  Dn as m,
3802
3807
  si as n,
3803
3808
  ei as o,
3804
- Gt as p,
3809
+ Vt as p,
3805
3810
  _o as q,
3806
- pe as r,
3807
- zt as s,
3811
+ ue as r,
3812
+ Gt as s,
3808
3813
  ti as t,
3809
3814
  ni as u,
3810
3815
  qo as v,
3811
- Le as w,
3816
+ He as w,
3812
3817
  Ws as x,
3813
3818
  Ar as y,
3814
3819
  ii as z