okno 1.0.0-beta.30 → 1.0.0-beta.32

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,13 +1,13 @@
1
1
  import { join as g, relative as z, sep as I, dirname as P, resolve as ie } from "node:path";
2
2
  import { readdir as x, readFile as _e, writeFile as $e } from "node:fs/promises";
3
- import { existsSync as _, readFileSync as S, readdirSync as D, statSync as ke, realpathSync as we, writeFileSync as T, mkdirSync as M, unlinkSync as F, renameSync as be } from "node:fs";
3
+ import { existsSync as _, readFileSync as S, readdirSync as D, statSync as ke, realpathSync as we, writeFileSync as A, mkdirSync as M, unlinkSync as L, renameSync as be } from "node:fs";
4
4
  import { execSync as ee } from "node:child_process";
5
5
  import { fileURLToPath as Se } from "node:url";
6
6
  import { p as J } from "./parse-tlTHgSSs.js";
7
7
  import { o as Oe } from "./order-bAkdncZC.js";
8
8
  import { simpleGit as le } from "simple-git";
9
9
  import { b as q, a as ve, e as je } from "./encode-BfJY0Xy5.js";
10
- import { applyKeyChanges as ce, setStringsSchema as Te, saveFields as Ae, setLocales as xe, setName as Pe, setUrl as Re, renameSlug as Me, reorderKind as Ee, setLayout as Ne, setCollectionOrder as Ie, setDrafts as We, deleteSchemaEntry as Le, scaffoldEntry as Fe, fieldsToContent as Ce, EngineError as Ue } from "./engine/index.js";
10
+ import { applyKeyChanges as ce, setStringsSchema as Ae, saveFields as Te, setLocales as xe, setName as Pe, setUrl as Re, renameSlug as Me, reorderKind as Ee, setLayout as Ne, setCollectionOrder as Ie, setDrafts as We, deleteSchemaEntry as Fe, scaffoldEntry as Le, fieldsToContent as Ue, EngineError as Ce } from "./engine/index.js";
11
11
  const ze = /* @__PURE__ */ new Set([".astro", ".svelte", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".vue"]), Je = /* @__PURE__ */ new Set([
12
12
  "node_modules",
13
13
  ".astro",
@@ -79,24 +79,24 @@ async function $t(e, n) {
79
79
  " readonly exists: boolean",
80
80
  "}",
81
81
  "",
82
- "/** Array-membership boundary — only on array items (never on a scalar `{...field}` spread, so it can't collide with HTML attributes). BLOCK wrappers spread `.slot` explicitly (`<article {...item.slot}>`); a LEAF multiple (media/link/text) gets `data-okno-item` straight off `{...item}` (see OknoSlotItem), so one spread = edit + reorder. `slot` is a reserved field key so content can't shadow it. */",
83
- 'type OknoSlot = { readonly slot: { readonly "data-okno-item": string } }',
84
- "/** The reorder hook carried directly on an array item's spread (`{...item}`), so a leaf multiple needs no separate `{...item.slot}`. */",
85
- 'type OknoSlotItem = { readonly "data-okno-item": string }',
86
- "/** One array member. A LEAF (media/link/text) is spread bare — `{...item}` — so it carries `data-okno-item` but NOT the object-valued `.slot` (spreading that onto an element sets the HTML `slot` attr to an object → type error). A BLOCK/reference member has inner fields and is spread via its wrapper's `.slot`, so it keeps `OknoSlot`. */",
82
+ "/** The explicit reorder handle — spread `.drag` on a semantic wrapper (`<li {...item.drag}>`, `<tr {...item.drag}>`) when the item's own element can't be the direct child of the reorder container. Emits the same `data-okno-item` boundary as the bare `{...item}` spread; the editor resolves the OUTERMOST element carrying it as the drag unit, so both a wrapper's `.drag` and an inner `{...item}` can coexist. Present on every array item (leaf AND block). */",
83
+ 'type OknoDrag = { readonly drag: { readonly "data-okno-item": string } }',
84
+ "/** The reorder hook carried directly on a LEAF array item's bare spread (`{...item}`), so a leaf multiple needs no separate `{...item.drag}` in the common case. */",
85
+ 'type OknoDragItem = { readonly "data-okno-item": string }',
86
+ "/** One array member. A LEAF (media/link/text) is spread bare — `{...item}` — so it carries `data-okno-item` for reorder AND still exposes `.drag` as an escape hatch (for a semantic wrapper). A BLOCK/reference member has inner fields, so its bare `{...item}` would dump field keys; it spreads content fields on its wrapper plus `.drag` for reorder. */",
87
87
  "type OknoArrayItem<U> =",
88
88
  " U extends string | number | boolean",
89
- " ? OknoWrapped<U> & OknoSlotItem",
89
+ " ? OknoWrapped<U> & OknoDragItem & OknoDrag",
90
90
  " : U extends { src: string }",
91
- " ? OknoWrapped<U> & OknoSlotItem",
91
+ " ? OknoWrapped<U> & OknoDragItem & OknoDrag",
92
92
  " : U extends { url: string; text: string }",
93
- " ? OknoWrapped<U> & OknoSlotItem",
94
- " : OknoWrapped<U> & OknoSlot",
93
+ " ? OknoWrapped<U> & OknoDragItem & OknoDrag",
94
+ " : OknoWrapped<U> & OknoDrag",
95
95
  "",
96
96
  "/** A media value's `.image` handle — a spreadable bundle for a framework image component (Astro `<Image {...cover.image}>`): build-optimized `src` (from `okno/files`), plus alt/dimensions and the edit hook. Use `<img {...cover}>` for the raw/universal path. `src` is loose (framework's shape, e.g. Astro `ImageMetadata`) so okno stays framework-agnostic. */",
97
97
  'type OknoImage = { src: any; alt: string; width?: number; height?: number; readonly "data-okno": string }',
98
98
  "",
99
- "/** Recursively wraps content types so values are spreadable/renderable. Media (`{src}`) and link (`{url,text}`) objects keep RAW attribute values so `<img {...media}>` / `<a {...link}>` type-check; media also exposes `.image`; other objects expose wrapped fields + the data-okno hook. Array items also carry `.slot` (block wrappers) AND `data-okno-item` on the bare spread (leaf multiples). */",
99
+ "/** Recursively wraps content types so values are spreadable/renderable. Media (`{src}`) and link (`{url,text}`) objects keep RAW attribute values so `<img {...media}>` / `<a {...link}>` type-check; media also exposes `.image`; other objects expose wrapped fields + the data-okno hook. Array items carry `data-okno-item` on the bare spread (leaf multiples) AND expose `.drag` (the explicit reorder handle, for block wrappers or a leaf's semantic wrapper). */",
100
100
  "type OknoWrapped<T> =",
101
101
  " T extends string | number | boolean",
102
102
  " ? OknoValue<T>",
@@ -131,8 +131,8 @@ async function $t(e, n) {
131
131
  return `${w}: ${b.multiple ? `${R}[]` : R}`;
132
132
  }),
133
133
  ...$.map(([w, b]) => {
134
- const R = (Array.isArray(b.options) ? b.options : []).map((A) => typeof A == "string" ? A : A?.value).filter((A) => typeof A == "string"), L = `{ name: string; value: ${R.length ? R.map((A) => JSON.stringify(A)).join(" | ") : "string"} }`;
135
- return `${w}: ${b.multiple ? `${L}[]` : L}`;
134
+ const R = (Array.isArray(b.options) ? b.options : []).map((T) => typeof T == "string" ? T : T?.value).filter((T) => typeof T == "string"), F = `{ name: string; value: ${R.length ? R.map((T) => JSON.stringify(T)).join(" | ") : "string"} }`;
135
+ return `${w}: ${b.multiple ? `${F}[]` : F}`;
136
136
  })
137
137
  ].join("; ");
138
138
  return `OknoWrapped<Omit<${c}, ${O}> & { ${v} }> & OknoMeta`;
@@ -336,7 +336,7 @@ function V(e) {
336
336
  return null;
337
337
  }
338
338
  }
339
- function U(e, n) {
339
+ function C(e, n) {
340
340
  return n ? n.has(e) : nt.test(e);
341
341
  }
342
342
  function et(e) {
@@ -428,7 +428,7 @@ async function vt(e) {
428
428
  for (const p of r) {
429
429
  if (!p.isFile() || !p.name.endsWith(".ts") || p.name === "index.ts") continue;
430
430
  const c = p.name.replace(/\.ts$/, "");
431
- U(c, f) && m.push(c);
431
+ C(c, f) && m.push(c);
432
432
  }
433
433
  }
434
434
  const u = [
@@ -461,7 +461,7 @@ async function jt(e, n = /* @__PURE__ */ new Set()) {
461
461
  return `__oknoResolveEnums(__oknoResolveRefs(_${t}, ${r}, __collections, ${m}), ${r}, ${m})`;
462
462
  }, i = /* @__PURE__ */ new Set();
463
463
  if (_(s)) {
464
- const t = V(e), r = (await x(s, { withFileTypes: !0 })).filter((c) => c.isDirectory() && U(c.name, t)).map((c) => c.name);
464
+ const t = V(e), r = (await x(s, { withFileTypes: !0 })).filter((c) => c.isDirectory() && C(c.name, t)).map((c) => c.name);
465
465
  m = JSON.stringify(r);
466
466
  const p = await se(s);
467
467
  for (const c of p) {
@@ -486,7 +486,7 @@ async function jt(e, n = /* @__PURE__ */ new Set()) {
486
486
  return l.join(`
487
487
  `);
488
488
  }
489
- async function Tt(e, n = /* @__PURE__ */ new Set(), s = !1) {
489
+ async function At(e, n = /* @__PURE__ */ new Set(), s = !1) {
490
490
  const a = g(e, "collections");
491
491
  if (!_(a)) {
492
492
  const d = [];
@@ -497,11 +497,11 @@ async function Tt(e, n = /* @__PURE__ */ new Set(), s = !1) {
497
497
  return d.join(`
498
498
  `) || "export {}";
499
499
  }
500
- const f = V(e), l = await x(a, { withFileTypes: !0 }), m = l.filter((d) => d.isDirectory() && U(d.name, f)).map((d) => d.name), u = l.filter((d) => d.isDirectory() && !m.includes(d.name)).map((d) => d.name), i = JSON.stringify(m);
500
+ const f = V(e), l = await x(a, { withFileTypes: !0 }), m = l.filter((d) => d.isDirectory() && C(d.name, f)).map((d) => d.name), u = l.filter((d) => d.isDirectory() && !m.includes(d.name)).map((d) => d.name), i = JSON.stringify(m);
501
501
  for (const d of u) {
502
502
  const y = await x(g(a, d), { withFileTypes: !0 }).catch(() => []);
503
503
  for (const $ of y)
504
- $.isDirectory() && U($.name, f) && console.warn(
504
+ $.isDirectory() && C($.name, f) && console.warn(
505
505
  `[okno] "collections/${d}/${$.name}/" looks like a misplaced locale folder. Collection locale overrides go at "collections/${$.name}/${d}/<slug>.ts" (locale right after "collections/"). This folder will NOT be localized.`
506
506
  );
507
507
  }
@@ -518,15 +518,15 @@ async function Tt(e, n = /* @__PURE__ */ new Set(), s = !1) {
518
518
  if (m.length === 0)
519
519
  c.push(`import ${b} from "${K}"`);
520
520
  else {
521
- const L = [`import ${b}_default from "${K}"`], A = [];
521
+ const F = [`import ${b}_default from "${K}"`], T = [];
522
522
  for (const H of m) {
523
523
  const re = g(a, H, d, w);
524
524
  if (_(re)) {
525
525
  const ae = G(H);
526
- L.push(`import ${b}_${ae} from "${re}"`), A.push(`"${H}": ${b}_${ae}`);
526
+ F.push(`import ${b}_${ae} from "${re}"`), T.push(`"${H}": ${b}_${ae}`);
527
527
  }
528
528
  }
529
- c.push(...L), c.push(`const ${b} = __oknoLocalize(${b}_default, { ${A.join(", ")} })`);
529
+ c.push(...F), c.push(`const ${b} = __oknoLocalize(${b}_default, { ${T.join(", ")} })`);
530
530
  }
531
531
  v.push({ varName: b, itemName: R });
532
532
  }
@@ -543,7 +543,7 @@ async function Tt(e, n = /* @__PURE__ */ new Set(), s = !1) {
543
543
  return c.join(`
544
544
  `);
545
545
  }
546
- async function At(e, n = /* @__PURE__ */ new Set()) {
546
+ async function Tt(e, n = /* @__PURE__ */ new Set()) {
547
547
  const s = g(e, "globals"), a = g(e, "schema.ts"), f = _(a), l = [
548
548
  'import { __oknoWrap, __oknoLocalize, __oknoResolveRefs, __oknoResolveEnums, __oknoSetImages } from "okno:runtime"',
549
549
  ne
@@ -556,7 +556,7 @@ async function At(e, n = /* @__PURE__ */ new Set()) {
556
556
  return `__oknoResolveEnums(__oknoResolveRefs(_${t}, ${r}, __collections, ${m}), ${r}, ${m})`;
557
557
  }, i = /* @__PURE__ */ new Set();
558
558
  if (_(s)) {
559
- const t = V(e), r = (await x(s, { withFileTypes: !0 })).filter((c) => c.isDirectory() && U(c.name, t)).map((c) => c.name);
559
+ const t = V(e), r = (await x(s, { withFileTypes: !0 })).filter((c) => c.isDirectory() && C(c.name, t)).map((c) => c.name);
560
560
  m = JSON.stringify(r);
561
561
  const p = await se(s);
562
562
  for (const c of p) {
@@ -659,7 +659,7 @@ function j(e) {
659
659
  return { schema: a, header: s };
660
660
  }
661
661
  function at(e, n, s) {
662
- T(g(e, "schema.ts"), ve(n, s));
662
+ A(g(e, "schema.ts"), ve(n, s));
663
663
  }
664
664
  function it(e, n, s, a, f) {
665
665
  const l = g(e, n), m = new Set(f), u = [];
@@ -693,7 +693,7 @@ function it(e, n, s, a, f) {
693
693
  } else
694
694
  continue;
695
695
  if (!c) continue;
696
- N(o), T(o, q(p));
696
+ N(o), A(o, q(p));
697
697
  const h = z(e, o).split(I).join("/");
698
698
  u.push({ rel: h, abs: o }), console.log(`[okno] field-change migrated content: ${h}`, { renames: a, deletes: f });
699
699
  }
@@ -706,15 +706,15 @@ function Y(e) {
706
706
  function pe(e) {
707
707
  return z(Y(e), we(e)).split(I).join("/");
708
708
  }
709
- let C;
709
+ let U;
710
710
  function lt(e) {
711
- if (C !== void 0) return C;
711
+ if (U !== void 0) return U;
712
712
  try {
713
- C = ee("git config user.name", { cwd: e, encoding: "utf-8" }).trim() || "local";
713
+ U = ee("git config user.name", { cwd: e, encoding: "utf-8" }).trim() || "local";
714
714
  } catch {
715
- C = "local";
715
+ U = "local";
716
716
  }
717
- return C;
717
+ return U;
718
718
  }
719
719
  async function Pt(e, n) {
720
720
  const { method: s, route: a } = n, f = { files: [], modules: [] }, l = (t, o) => {
@@ -731,26 +731,26 @@ async function Pt(e, n) {
731
731
  const c = E(e, t);
732
732
  if (!c) return i(400, { error: "Invalid path" });
733
733
  const h = je(o, { now: (/* @__PURE__ */ new Date()).toISOString(), author: p || lt(e), created: r });
734
- return M(P(c), { recursive: !0 }), N(c), T(c, h), l(t, c), i(200, { ok: !0, commit: { fileSha: "" } });
734
+ return M(P(c), { recursive: !0 }), N(c), A(c, h), l(t, c), i(200, { ok: !0, commit: { fileSha: "" } });
735
735
  }
736
736
  if (s === "POST" && a === "content/delete") {
737
737
  const t = (await n.json())?.path;
738
738
  if (!t) return i(400, { error: "Missing path" });
739
739
  const o = E(e, t);
740
- return o ? (_(o) && (F(o), l(t, o)), i(200, { ok: !0 })) : i(400, { error: "Invalid path" });
740
+ return o ? (_(o) && (L(o), l(t, o)), i(200, { ok: !0 })) : i(400, { error: "Invalid path" });
741
741
  }
742
742
  if (s === "POST" && a === "strings/save") {
743
743
  const { path: t, content: o } = await n.json();
744
744
  if (!t || !o || typeof o != "object") return i(400, { error: "Missing path or content" });
745
745
  if (t !== "strings.ts" && !/^strings\/[^/]+\.ts$/.test(t)) return i(400, { error: "Invalid strings path" });
746
746
  const r = E(e, t);
747
- return r ? (M(P(r), { recursive: !0 }), N(r), T(r, q(o)), f.modules.push("strings", "content"), f.files.push(r), i(200, { ok: !0, commit: { fileSha: "" } })) : i(400, { error: "Invalid path" });
747
+ return r ? (M(P(r), { recursive: !0 }), N(r), A(r, q(o)), f.modules.push("strings", "content"), f.files.push(r), i(200, { ok: !0, commit: { fileSha: "" } })) : i(400, { error: "Invalid path" });
748
748
  }
749
749
  if (s === "POST" && a === "strings/set-schema") {
750
750
  const { strings: t } = await n.json();
751
751
  if (t != null && (typeof t != "object" || Array.isArray(t))) return i(400, { error: "Invalid strings" });
752
752
  const { schema: o, header: r } = j(e);
753
- return Te(o, t), u(o, r), f.modules.push("strings", "content"), i(200, { ok: !0, commit: { fileSha: "" }, schema: o });
753
+ return Ae(o, t), u(o, r), f.modules.push("strings", "content"), i(200, { ok: !0, commit: { fileSha: "" }, schema: o });
754
754
  }
755
755
  if (s === "GET" && a === "publish-state")
756
756
  try {
@@ -778,7 +778,7 @@ async function Pt(e, n) {
778
778
  const { kind: t, name: o, fields: r, renames: p, deletes: c } = await n.json();
779
779
  if (!t || !o || !r) return i(400, { error: "Missing kind, name or fields" });
780
780
  const { schema: h, header: d } = j(e);
781
- Ae(h, t, o, r), u(h, d);
781
+ Te(h, t, o, r), u(h, d);
782
782
  const y = p && typeof p == "object" ? p : {}, $ = Array.isArray(c) ? c : [];
783
783
  if (Object.keys(y).length > 0 || $.length > 0)
784
784
  for (const { rel: k, abs: O } of it(e, t, o, y, $)) l(k, O);
@@ -807,7 +807,7 @@ async function Pt(e, n) {
807
807
  if (h) return i(200, { ok: !0, unchanged: !0 });
808
808
  u(p, c);
809
809
  const d = `${t}/${o}.ts`, y = `${t}/${r}.ts`, $ = E(e, d), k = E(e, y);
810
- return $ && k && _($) && (M(P(k), { recursive: !0 }), N($), N(k), T(k, S($)), F($), l(d, $), l(y, k)), i(200, { ok: !0, commit: { fileSha: "" }, schema: p, from: o, to: r, kind: t });
810
+ return $ && k && _($) && (M(P(k), { recursive: !0 }), N($), N(k), A(k, S($)), L($), l(d, $), l(y, k)), i(200, { ok: !0, commit: { fileSha: "" }, schema: p, from: o, to: r, kind: t });
811
811
  }
812
812
  if (s === "POST" && a === "schema/reorder") {
813
813
  const { kind: t, order: o } = await n.json();
@@ -837,20 +837,20 @@ async function Pt(e, n) {
837
837
  const { kind: t, name: o } = await n.json();
838
838
  if (!t || !o) return i(400, { error: "Missing kind or name" });
839
839
  const { schema: r, header: p } = j(e);
840
- Le(r, t, o), u(r, p);
840
+ Fe(r, t, o), u(r, p);
841
841
  const c = `${t}/${o}.ts`, h = E(e, c);
842
- return h && _(h) && (N(h), F(h), l(c, h)), i(200, { ok: !0, commit: { fileSha: "" }, schema: r });
842
+ return h && _(h) && (N(h), L(h), l(c, h)), i(200, { ok: !0, commit: { fileSha: "" }, schema: r });
843
843
  }
844
844
  if (s === "POST" && a === "setup/scaffold-page") {
845
845
  const { name: t, kind: o, fields: r, label: p } = await n.json();
846
846
  if (!t || !o) return i(400, { error: "Missing name or kind" });
847
847
  const c = r ?? [], { schema: h, header: d } = j(e);
848
- if (Fe(h, t, o, c, p), u(h, d), o !== "blocks") {
848
+ if (Le(h, t, o, c, p), u(h, d), o !== "blocks") {
849
849
  const y = `${o}/${t}.ts`, $ = E(e, y);
850
850
  if ($) {
851
851
  const k = o === "collections" ? `export default []
852
- ` : q(Ce(c));
853
- M(P($), { recursive: !0 }), N($), T($, k), l(y, $);
852
+ ` : q(Ue(c));
853
+ M(P($), { recursive: !0 }), N($), A($, k), l(y, $);
854
854
  }
855
855
  }
856
856
  return i(200, { ok: !0 });
@@ -868,7 +868,7 @@ async function Pt(e, n) {
868
868
  const r = de(o), p = r ? `${r}/${t}` : t, c = W(e, `files/${p}`);
869
869
  if (!c) return i(400, { error: "Invalid path" });
870
870
  const h = await n.binary();
871
- return h.length === 0 ? i(400, { error: "Empty body" }) : (M(P(c), { recursive: !0 }), T(c, h), i(200, { ok: !0, blobSha: "", path: `files/${p}`, filename: t }));
871
+ return h.length === 0 ? i(400, { error: "Empty body" }) : (M(P(c), { recursive: !0 }), A(c, h), i(200, { ok: !0, blobSha: "", path: `files/${p}`, filename: t }));
872
872
  }
873
873
  if (s === "POST" && a === "files/commit") return i(200, { ok: !0 });
874
874
  if (s === "POST" && a === "files/upload") {
@@ -877,20 +877,20 @@ async function Pt(e, n) {
877
877
  const p = me(t);
878
878
  if (!p || p === "-") return i(400, { error: "Invalid filename" });
879
879
  const c = de(r ?? ""), h = c ? `${c}/${p}` : p, d = W(e, `files/${h}`);
880
- return d ? (M(P(d), { recursive: !0 }), T(d, Buffer.from(o, "base64")), i(200, { ok: !0, path: `files/${h}`, filename: p, commit: { fileSha: "" } })) : i(400, { error: "Invalid path" });
880
+ return d ? (M(P(d), { recursive: !0 }), A(d, Buffer.from(o, "base64")), i(200, { ok: !0, path: `files/${h}`, filename: p, commit: { fileSha: "" } })) : i(400, { error: "Invalid path" });
881
881
  }
882
882
  if (s === "POST" && a === "files/delete") {
883
883
  const t = (await n.json())?.path;
884
884
  if (!t) return i(400, { error: "Missing path" });
885
885
  const o = W(e, t);
886
- return o ? (_(o) && F(o), i(200, { ok: !0 })) : i(400, { error: "Invalid path" });
886
+ return o ? (_(o) && L(o), i(200, { ok: !0 })) : i(400, { error: "Invalid path" });
887
887
  }
888
888
  if (s === "POST" && a === "files/delete-many") {
889
889
  const t = (await n.json())?.paths;
890
890
  if (!Array.isArray(t)) return i(400, { error: "Missing paths" });
891
891
  for (const o of t) {
892
892
  const r = W(e, String(o));
893
- r && _(r) && F(r);
893
+ r && _(r) && L(r);
894
894
  }
895
895
  return i(200, { ok: !0 });
896
896
  }
@@ -902,31 +902,31 @@ async function Pt(e, n) {
902
902
  }
903
903
  if (s === "POST" && a === "users/save") {
904
904
  const t = (await n.json())?.users;
905
- return Array.isArray(t) ? (T(g(e, "users.json"), JSON.stringify(t, null, " ") + `
905
+ return Array.isArray(t) ? (A(g(e, "users.json"), JSON.stringify(t, null, " ") + `
906
906
  `), i(200, { ok: !0, commit: { fileSha: "" } })) : i(400, { error: "Missing users" });
907
907
  }
908
908
  if (s === "POST" && a === "settings/save") {
909
909
  const t = (await n.json())?.settings;
910
- return !t || typeof t != "object" ? i(400, { error: "Missing settings" }) : (T(g(e, "settings.json"), JSON.stringify(t, null, " ") + `
910
+ return !t || typeof t != "object" ? i(400, { error: "Missing settings" }) : (A(g(e, "settings.json"), JSON.stringify(t, null, " ") + `
911
911
  `), i(200, { ok: !0, commit: { fileSha: "" } }));
912
912
  }
913
913
  if (s === "POST" && a === "origins/save") {
914
914
  const t = (await n.json())?.origins;
915
915
  if (!Array.isArray(t) || t.some((r) => typeof r != "string")) return i(400, { error: "Missing origins" });
916
916
  const o = [...new Set(t.map((r) => r.trim()).filter(Boolean))];
917
- return T(g(e, "origins.json"), JSON.stringify(o, null, " ") + `
917
+ return A(g(e, "origins.json"), JSON.stringify(o, null, " ") + `
918
918
  `), i(200, { ok: !0, origins: o, commit: { fileSha: "" } });
919
919
  }
920
920
  return null;
921
921
  } catch (t) {
922
- return t instanceof Ue ? { status: t.status, body: { error: t.message } } : { status: 500, body: { error: t instanceof Error ? t.message : String(t) } };
922
+ return t instanceof Ce ? { status: t.status, body: { error: t.message } } : { status: 500, body: { error: t instanceof Error ? t.message : String(t) } };
923
923
  }
924
924
  }
925
925
  export {
926
926
  ne as I,
927
- Tt as a,
927
+ At as a,
928
928
  jt as b,
929
- At as c,
929
+ Tt as c,
930
930
  vt as d,
931
931
  Ot as e,
932
932
  St as f,