@aiquants/markdown-explorer 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +65 -8
  3. package/dist/EditSurface-BCB-0vUK.js +371 -0
  4. package/dist/EditSurface-BZ98L7hy.cjs +2 -0
  5. package/dist/ExplorerSplit-BTRTah7R.cjs +1 -0
  6. package/dist/{ExplorerSplit-CWcK1E4I.js → ExplorerSplit-DpoMtzq3.js} +391 -417
  7. package/dist/MultiLayout-B7OiXgWH.cjs +1 -0
  8. package/dist/MultiLayout-BD2LiwOe.js +947 -0
  9. package/dist/{NativeScrollBar-DbzyQ85y.cjs → NativeScrollBar-B4j3Vigb.cjs} +1 -1
  10. package/dist/{NativeScrollBar-apXjIKRW.js → NativeScrollBar-EXOKhHP4.js} +1 -1
  11. package/dist/TreeLayout-B9dF2A3h.cjs +1 -0
  12. package/dist/TreeLayout-hn2bfU22.js +29 -0
  13. package/dist/client/MarkdownExplorer.d.cts +2 -1
  14. package/dist/client/MarkdownExplorer.d.ts +2 -1
  15. package/dist/client/storage.d.cts +1 -0
  16. package/dist/client/storage.d.ts +1 -0
  17. package/dist/core/contracts.d.cts +67 -6
  18. package/dist/core/contracts.d.ts +67 -6
  19. package/dist/core/labels.d.cts +53 -0
  20. package/dist/core/labels.d.ts +53 -0
  21. package/dist/core/location.d.cts +7 -0
  22. package/dist/core/location.d.ts +7 -0
  23. package/dist/dataRoute-CcZ8PK00.cjs +1 -0
  24. package/dist/dataRoute-D1vE1wFW.js +270 -0
  25. package/dist/index-C0gh_dRY.js +3188 -0
  26. package/dist/index-CCc6qUbM.cjs +5 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.d.cts +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +32 -31
  31. package/dist/location-DmzVAFvo.cjs +1 -0
  32. package/dist/{location-c1zdeySY.js → location-Q4sgRrUm.js} +202 -193
  33. package/dist/merge-0W6xtIxj.cjs +5 -0
  34. package/dist/merge-Bi41vtSe.js +20 -0
  35. package/dist/sanitizeWorker.cjs +1 -1
  36. package/dist/sanitizeWorker.js +173 -172
  37. package/dist/server/errors.d.cts +1 -1
  38. package/dist/server/errors.d.ts +1 -1
  39. package/dist/server/ports.d.cts +34 -1
  40. package/dist/server/ports.d.ts +34 -1
  41. package/dist/server.cjs +1 -1
  42. package/dist/server.d.cts +1 -1
  43. package/dist/server.d.ts +1 -1
  44. package/dist/server.js +889 -729
  45. package/dist/{storage-DA4ItHzl.js → storage-BSthKLSG.js} +14 -13
  46. package/dist/storage-Dgi4JXaB.cjs +1 -0
  47. package/dist/storage.cjs +1 -1
  48. package/dist/storage.js +1 -1
  49. package/dist/styles/markdown-explorer.css +1 -1
  50. package/docs/behavior/dom-hooks.md +20 -3
  51. package/docs/behavior/layout.md +11 -0
  52. package/docs/behavior/localization.md +4 -1
  53. package/docs/behavior/security.md +21 -4
  54. package/docs/behavior/url-contract.md +13 -4
  55. package/package.json +14 -5
  56. package/dist/ExplorerSplit-ajN3GSdA.cjs +0 -1
  57. package/dist/MultiLayout-BtWtCzJV.js +0 -922
  58. package/dist/MultiLayout-DvkcdO9c.cjs +0 -1
  59. package/dist/TreeLayout-BcHsv9G8.js +0 -23
  60. package/dist/TreeLayout-rwhJfLmU.cjs +0 -1
  61. package/dist/dataRoute-Btg4w3vO.js +0 -205
  62. package/dist/dataRoute-DHpu0fg2.cjs +0 -1
  63. package/dist/index-CIZw73j9.js +0 -2154
  64. package/dist/index-Cie6WPiM.cjs +0 -3
  65. package/dist/location-CSIhx-L4.cjs +0 -1
  66. package/dist/storage-Bkb2Axdi.cjs +0 -1
@@ -1,11 +1,11 @@
1
- import { NO_EMBEDS as Q, isEmbedProviderId as ee, EMBED_PROVIDER_IDS as te, isLinkCardSize as re, LINK_CARD_SIZES as ne } from "@aiquants/markdown/embeds";
2
- import { CONTENT_ALIGNS as b, DEFAULT_MARKDOWN_STYLES as oe } from "@aiquants/markdown/viewer-settings";
3
- import { a as se, i as A } from "./dataRoute-Btg4w3vO.js";
4
- const $ = (e) => {
1
+ import { NO_EMBEDS as oe, isEmbedProviderId as se, EMBED_PROVIDER_IDS as ie, isLinkCardSize as ae, LINK_CARD_SIZES as le } from "@aiquants/markdown/embeds";
2
+ import { CONTENT_ALIGNS as R, DEFAULT_MARKDOWN_STYLES as ce } from "@aiquants/markdown/viewer-settings";
3
+ import { a as de, i as z } from "./dataRoute-D1vE1wFW.js";
4
+ const j = (e) => {
5
5
  if (e === null || typeof e != "object") return !1;
6
6
  const t = Object.getPrototypeOf(e);
7
7
  return t === Object.prototype || t === null;
8
- }, P = new Intl.Collator("en", { numeric: !0, sensitivity: "variant" }), C = Object.freeze({
8
+ }, M = new Intl.Collator("en", { numeric: !0, sensitivity: "variant" }), D = Object.freeze({
9
9
  sortMode: "native",
10
10
  folderPlacement: "mixed",
11
11
  selectionMode: "single",
@@ -18,7 +18,7 @@ const $ = (e) => {
18
18
  expandIcons: !0,
19
19
  directoryIcons: !0,
20
20
  fileIcons: !0
21
- }), ie = [!0, !1], ae = (e, t) => t ? e.settingOn : e.settingOff, g = (e, t) => ({ key: e, labelKey: t, values: ie, formatValue: ae, requiresItemSelection: !1 }), h = Object.freeze([
21
+ }), me = [!0, !1], fe = (e, t) => t ? e.settingOn : e.settingOff, g = (e, t) => ({ key: e, labelKey: t, values: me, formatValue: fe, requiresItemSelection: !1 }), E = Object.freeze([
22
22
  {
23
23
  key: "sortMode",
24
24
  labelKey: "settingSortMode",
@@ -61,90 +61,90 @@ const $ = (e) => {
61
61
  g("expandIcons", "settingExpandIcons"),
62
62
  g("directoryIcons", "settingDirectoryIcons"),
63
63
  g("fileIcons", "settingFileIcons")
64
- ]), Ke = (e) => e ? h : h.filter((t) => !t.requiresItemSelection), U = (e) => {
65
- const t = h.find((r) => r.key === e);
64
+ ]), et = (e) => e ? E : E.filter((t) => !t.requiresItemSelection), H = (e) => {
65
+ const t = E.find((r) => r.key === e);
66
66
  if (t === void 0) throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);
67
67
  return t;
68
- }, Be = (e, t) => {
69
- const r = U(t).values, n = r[(r.indexOf(e[t]) + 1) % r.length];
68
+ }, tt = (e, t) => {
69
+ const r = H(t).values, n = r[(r.indexOf(e[t]) + 1) % r.length];
70
70
  return { ...e, [t]: n };
71
- }, Ze = (e, t, r) => U(r).formatValue(e, t[r]), G = 2, z = Object.freeze({}), v = (e, t) => Object.freeze(Object.fromEntries(h.filter((r) => t(r, e[r.key])).map((r) => [r.key, e[r.key]]))), j = "directoriesFirst", le = (e) => {
72
- if (!Object.hasOwn(e, j)) return e;
73
- const { [j]: t, ...r } = e;
71
+ }, rt = (e, t, r) => H(r).formatValue(e, t[r]), q = 2, V = Object.freeze({}), L = (e, t) => Object.freeze(Object.fromEntries(E.filter((r) => t(r, e[r.key])).map((r) => [r.key, e[r.key]]))), F = "directoriesFirst", ue = (e) => {
72
+ if (!Object.hasOwn(e, F)) return e;
73
+ const { [F]: t, ...r } = e;
74
74
  return Object.hasOwn(r, "folderPlacement") || typeof t != "boolean" ? r : { ...r, folderPlacement: t ? "first" : "mixed" };
75
- }, Ye = (e) => {
76
- if (e === null || typeof e != "object" || Array.isArray(e)) return z;
75
+ }, nt = (e) => {
76
+ if (e === null || typeof e != "object" || Array.isArray(e)) return V;
77
77
  const t = e;
78
- return t.version !== G || t.settings === null || typeof t.settings != "object" || Array.isArray(t.settings) ? z : v(le(t.settings), (r, n) => r.values.includes(n));
79
- }, Qe = (e, t) => {
80
- const r = v(t, (n, o) => o !== void 0 && o !== e[n.key]);
78
+ return t.version !== q || t.settings === null || typeof t.settings != "object" || Array.isArray(t.settings) ? V : L(ue(t.settings), (r, n) => r.values.includes(n));
79
+ }, ot = (e, t) => {
80
+ const r = L(t, (n, o) => o !== void 0 && o !== e[n.key]);
81
81
  return Object.keys(r).length === 0 ? e : Object.freeze({ ...e, ...r });
82
- }, et = (e, t, r, n) => v({ ...e, [t]: r }, (o, s) => s !== void 0 && !(o.key === t && s === n[t])), tt = (e) => JSON.stringify({ version: G, settings: e }), rt = (e) => {
82
+ }, st = (e, t, r, n) => L({ ...e, [t]: r }, (o, s) => s !== void 0 && !(o.key === t && s === n[t])), it = (e) => JSON.stringify({ version: q, settings: e }), at = (e) => {
83
83
  const { sortMode: t, folderPlacement: r } = e;
84
84
  if (t === "native" && r === "mixed") return;
85
85
  const n = t === "desc" ? -1 : 1;
86
86
  return (o, s) => {
87
87
  if (r !== "mixed" && o.type !== s.type) return o.type === "directory" == (r === "first") ? -1 : 1;
88
88
  if (t === "native") return 0;
89
- const i = P.compare(o.name, s.name);
90
- return n * (i !== 0 ? i : P.compare(o.path, s.path));
89
+ const a = M.compare(o.name, s.name);
90
+ return n * (a !== 0 ? a : M.compare(o.path, s.path));
91
91
  };
92
- }, w = (1 + Math.sqrt(5)) / 2, nt = 100 / w ** 3, ot = 100 / w ** 4, J = 100 / w ** 2, ce = 13, st = 16, it = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), de = Object.freeze([89, 144, 233, 377]), at = 34, lt = 44, ct = 24, dt = 1 / w, mt = 1 / w ** 3, ft = "40ch", me = (e) => {
92
+ }, w = (1 + Math.sqrt(5)) / 2, lt = 100 / w ** 3, ct = 100 / w ** 4, K = 100 / w ** 2, ge = 13, dt = 16, mt = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), we = Object.freeze([89, 144, 233, 377]), ft = 34, ut = 44, gt = 24, wt = 1 / w, pt = 1 / w ** 3, ht = "40ch", pe = (e) => {
93
93
  if (!Number.isFinite(e) || e <= 0)
94
94
  throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`);
95
- }, fe = (e) => (me(e), ce * e), ut = (e) => fe(e) * w ** 2, gt = 233, wt = de[0], L = (e, t) => {
95
+ }, he = (e) => (pe(e), ge * e), Et = (e) => he(e) * w ** 2, St = 233, xt = we[0], U = (e, t) => {
96
96
  if (!Number.isFinite(t) || t < 0)
97
97
  throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`);
98
- }, ue = ({ trackInlineSize: e, gap: t, minColumnInlineSize: r, logicalColumns: n }) => {
99
- if (L("trackInlineSize", e), L("gap", t), !Number.isFinite(r) || r <= 0)
98
+ }, Ee = ({ trackInlineSize: e, gap: t, minColumnInlineSize: r, logicalColumns: n }) => {
99
+ if (U("trackInlineSize", e), U("gap", t), !Number.isFinite(r) || r <= 0)
100
100
  throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(r)}`);
101
101
  if (!Number.isInteger(n) || n < 1)
102
102
  throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(n)}`);
103
103
  const o = Math.floor((e + t) / (r + t));
104
104
  return Math.min(n, Math.max(1, o));
105
- }, pt = (e, t) => {
105
+ }, yt = (e, t) => {
106
106
  const { trackInlineSize: r, gap: n, minColumnInlineSize: o, logicalColumns: s } = t;
107
107
  if (!([r, n, o].every(Number.isFinite) && r > 0 && n >= 0 && o > 0)) return e;
108
- const c = ue(t);
108
+ const c = Ee(t);
109
109
  if (e === null || c === e) return c;
110
- const a = Math.min(s, Math.max(1, e));
111
- if (c > a) {
112
- const k = (a + 1) * o + a * n + n / w;
113
- return r >= k ? c : a;
110
+ const i = Math.min(s, Math.max(1, e));
111
+ if (c > i) {
112
+ const T = (i + 1) * o + i * n + n / w;
113
+ return r >= T ? c : i;
114
114
  }
115
- return r >= a * o + (a - 1) * n ? a : c;
116
- }, ht = (e, t) => {
115
+ return r >= i * o + (i - 1) * n ? i : c;
116
+ }, bt = (e, t) => {
117
117
  if (!(Number.isInteger(e) && Number.isInteger(t)) || t < 1 || t > e)
118
118
  throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);
119
119
  return Array.from({ length: t }, (r, n) => [Math.floor(n * e / t), Math.floor((n + 1) * e / t)]);
120
- }, ge = 31536e3, we = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u, pe = (e) => {
121
- if (typeof e != "string" || !we.test(e))
120
+ }, Se = 31536e3, xe = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u, ye = (e) => {
121
+ if (typeof e != "string" || !xe.test(e))
122
122
  throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`);
123
- }, D = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= J, he = (e, t) => {
123
+ }, J = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= K, be = (e, t) => {
124
124
  if (e === null || typeof e != "object" || Array.isArray(e)) return {};
125
- const r = e, { treeExplorer: n, multiExplorer: o, style: s, align: i } = r;
125
+ const r = e, { treeExplorer: n, multiExplorer: o, style: s, align: a } = r;
126
126
  return {
127
- ...D(n) ? { treeExplorer: n } : {},
128
- ...D(o) ? { multiExplorer: o } : {},
127
+ ...J(n) ? { treeExplorer: n } : {},
128
+ ...J(o) ? { multiExplorer: o } : {},
129
129
  ...typeof s == "string" && t.includes(s) ? { style: s } : {},
130
- ...typeof i == "string" && b.includes(i) ? { align: i } : {}
130
+ ...typeof a == "string" && R.includes(a) ? { align: a } : {}
131
131
  };
132
- }, Et = (e, t) => {
132
+ }, Ot = (e, t) => {
133
133
  if (e !== null)
134
134
  for (const r of e.split(";")) {
135
135
  const n = r.indexOf("=");
136
136
  if (!(n < 0) && r.slice(0, n).trim() === t)
137
137
  return r.slice(n + 1).trim();
138
138
  }
139
- }, St = (e, t) => {
139
+ }, kt = (e, t) => {
140
140
  if (e === void 0 || e === "") return {};
141
141
  try {
142
- return he(JSON.parse(decodeURIComponent(e)), t);
142
+ return be(JSON.parse(decodeURIComponent(e)), t);
143
143
  } catch {
144
144
  return {};
145
145
  }
146
- }, O = 100, Ee = Math.floor(J * O) / O, Se = (e) => {
147
- const t = (r) => Math.min(Ee, Math.max(1, Math.round(r * O)) / O);
146
+ }, _ = 100, Oe = Math.floor(K * _) / _, ke = (e) => {
147
+ const t = (r) => Math.min(Oe, Math.max(1, Math.round(r * _)) / _);
148
148
  return encodeURIComponent(
149
149
  JSON.stringify({
150
150
  ...e.treeExplorer === void 0 ? {} : { treeExplorer: t(e.treeExplorer) },
@@ -153,85 +153,85 @@ const $ = (e) => {
153
153
  ...e.align === void 0 ? {} : { align: e.align }
154
154
  })
155
155
  );
156
- }, xt = (e, t, r) => `${e}=${Se(t)}; Path=/; Max-Age=${String(ge)}; SameSite=Lax${r ? "; Secure" : ""}`, M = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), xe = Object.freeze({ default: 12, min: 1, max: 64 }), ye = Object.freeze({ default: 4, min: 1, max: 6 }), be = Object.freeze({ default: 500, min: 1, max: 1e4 }), Oe = Object.freeze({ default: 16, min: 1, max: 64 }), ke = Object.freeze({ default: 16, min: 1, max: 64 }), Re = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, _e = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, Te = /^[a-z0-9][a-z0-9-]*$/u, Ie = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u, V = (e, t) => {
156
+ }, Rt = (e, t, r) => `${e}=${ke(t)}; Path=/; Max-Age=${String(Se)}; SameSite=Lax${r ? "; Secure" : ""}`, G = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), Re = Object.freeze({ default: 12, min: 1, max: 64 }), _e = Object.freeze({ default: 4, min: 1, max: 6 }), Te = Object.freeze({ default: 500, min: 1, max: 1e4 }), Ne = Object.freeze({ default: 16, min: 1, max: 64 }), Ae = Object.freeze({ default: 16, min: 1, max: 64 }), Ie = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, ve = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, $e = /^[a-z0-9][a-z0-9-]*$/u, Pe = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u, X = (e, t) => {
157
157
  if (typeof t != "string") throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);
158
- if (!Re.test(t) || t.split("/").some((r) => r === "." || r === ".."))
158
+ if (!Ie.test(t) || t.split("/").some((r) => r === "." || r === ".."))
159
159
  throw new RangeError(`[markdown-explorer] ${e} must start with "/", have no trailing "/", and use only letters, digits and "._~-" in each segment; got ${JSON.stringify(t)}`);
160
- }, d = (e) => typeof e == "string" ? JSON.stringify(e) : typeof e == "bigint" ? `${String(e)}n` : Object.is(e, -0) ? "-0" : typeof e == "function" ? "a function" : Array.isArray(e) ? "an array" : e !== null && typeof e == "object" ? $(e) ? "a plain object" : `a non-plain object (${Object.prototype.toString.call(e)})` : String(e), p = (e, t, r) => {
160
+ }, d = (e) => typeof e == "string" ? JSON.stringify(e) : typeof e == "bigint" ? `${String(e)}n` : Object.is(e, -0) ? "-0" : typeof e == "function" ? "a function" : Array.isArray(e) ? "an array" : e !== null && typeof e == "object" ? j(e) ? "a plain object" : `a non-plain object (${Object.prototype.toString.call(e)})` : String(e), h = (e, t, r) => {
161
161
  if (t === void 0) return [];
162
- if (!$(t)) throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${d(t)}`);
162
+ if (!j(t)) throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${d(t)}`);
163
163
  const n = Object.entries(t);
164
164
  for (const [o] of n)
165
165
  if (!r.includes(o)) throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${r.join(", ")}`);
166
166
  return n.filter(([, o]) => o !== void 0);
167
- }, Ne = (e) => {
168
- const t = { ...M };
169
- for (const [r, n] of p("views", e, Object.keys(M))) t[r] = n;
167
+ }, Ce = (e) => {
168
+ const t = { ...G };
169
+ for (const [r, n] of h("views", e, Object.keys(G))) t[r] = n;
170
170
  for (const [r, n] of Object.entries(t))
171
- if (typeof n != "string" || !_e.test(n))
171
+ if (typeof n != "string" || !ve.test(n))
172
172
  throw new RangeError(`[markdown-explorer] views.${r} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(n)}`);
173
173
  return Object.freeze(t);
174
- }, x = (e, t, r) => {
174
+ }, y = (e, t, r) => {
175
175
  if (t === void 0) return r.default;
176
176
  if (typeof t != "number" || !Number.isInteger(t) || t < r.min || t > r.max)
177
177
  throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(r.min)}..${String(r.max)}; got ${d(t)}`);
178
178
  return t;
179
- }, Ae = (e, t) => {
180
- const r = new Map(p("embeds", e, ["providers", "linkCards", "linkCardSize"]));
181
- if (r.size === 0) return Q;
179
+ }, ze = (e, t) => {
180
+ const r = new Map(h("embeds", e, ["providers", "linkCards", "linkCardSize"]));
181
+ if (r.size === 0) return oe;
182
182
  const n = r.has("providers") ? r.get("providers") : [];
183
183
  if (!Array.isArray(n)) throw new RangeError(`[markdown-explorer] embeds.providers must be an array of provider ids; got ${d(n)}`);
184
184
  for (const c of n)
185
- if (!ee(c)) throw new RangeError(`[markdown-explorer] embeds.providers must hold only ${te.join(", ")}; got ${d(c)}`);
185
+ if (!se(c)) throw new RangeError(`[markdown-explorer] embeds.providers must hold only ${ie.join(", ")}; got ${d(c)}`);
186
186
  const o = r.has("linkCards") ? r.get("linkCards") : !1;
187
187
  if (typeof o != "boolean") throw new RangeError(`[markdown-explorer] embeds.linkCards must be a boolean; got ${d(o)}`);
188
- const s = { providers: Object.freeze([...new Set(n)]), linkCardEndpoint: o ? se(t) : null };
188
+ const s = { providers: Object.freeze([...new Set(n)]), linkCardEndpoint: o ? de(t) : null };
189
189
  if (!r.has("linkCardSize")) return Object.freeze(s);
190
- const i = r.get("linkCardSize");
191
- if (!re(i)) throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${ne.join(", ")}; got ${d(i)}`);
192
- if (!o) throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${d(i)} with linkCards ${d(o)}`);
193
- return Object.freeze({ ...s, linkCardSize: i });
194
- }, $e = (e) => {
190
+ const a = r.get("linkCardSize");
191
+ if (!ae(a)) throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${le.join(", ")}; got ${d(a)}`);
192
+ if (!o) throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${d(a)} with linkCards ${d(o)}`);
193
+ return Object.freeze({ ...s, linkCardSize: a });
194
+ }, je = (e) => {
195
195
  const t = new Map(
196
- p(
196
+ h(
197
197
  "defaultTreeSettings",
198
198
  e,
199
- h.map((n) => n.key)
199
+ E.map((n) => n.key)
200
200
  )
201
201
  );
202
- if (t.size === 0) return C;
203
- const r = { ...C };
204
- for (const n of h) {
202
+ if (t.size === 0) return D;
203
+ const r = { ...D };
204
+ for (const n of E) {
205
205
  if (!t.has(n.key)) continue;
206
206
  const o = t.get(n.key), s = n.values;
207
207
  if (!s.includes(o)) throw new RangeError(`[markdown-explorer] defaultTreeSettings.${n.key} must be one of ${s.map(d).join(", ")}; got ${d(o)}`);
208
208
  r[n.key] = o;
209
209
  }
210
210
  return Object.freeze(r);
211
- }, ve = (e) => {
211
+ }, Le = (e) => {
212
212
  if (e === null || typeof e != "object") throw new TypeError("[markdown-explorer] the explorer configuration must be an object");
213
- V("basePath", e.basePath), V("dataPath", e.dataPath);
214
- const t = Ne(e.views);
213
+ X("basePath", e.basePath), X("dataPath", e.dataPath);
214
+ const t = Ce(e.views);
215
215
  if ((/* @__PURE__ */ new Set([t.tree, t.multi, t.single])).size !== 3)
216
216
  throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);
217
217
  if (e.dataPath === e.basePath) throw new RangeError("[markdown-explorer] dataPath must differ from basePath");
218
218
  if (e.dataPath.startsWith(`${e.basePath}/`)) {
219
- const a = e.dataPath.slice(e.basePath.length + 1).split("/")[0];
220
- if (a === t.tree || a === t.multi || a === t.single)
219
+ const i = e.dataPath.slice(e.basePath.length + 1).split("/")[0];
220
+ if (i === t.tree || i === t.multi || i === t.single)
221
221
  throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`);
222
222
  }
223
- pe(e.settingsCookie);
223
+ ye(e.settingsCookie);
224
224
  const r = e.iframeHosts ?? [];
225
- if (!Array.isArray(r) || r.some((a) => typeof a != "string" || !Ie.test(a)))
225
+ if (!Array.isArray(r) || r.some((i) => typeof i != "string" || !Pe.test(i)))
226
226
  throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(r)}`);
227
- const n = Object.fromEntries(p("multiView", e.multiView, ["maxPanels", "columns"])), o = Object.fromEntries(p("expandAll", e.expandAll, ["maxFolders", "maxDepth"])), s = Object.fromEntries(p("revealDocument", e.revealDocument, ["maxDepth"])), i = e.documentStyles ?? oe;
228
- if (!Array.isArray(i) || i.length === 0) throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");
227
+ const n = Object.fromEntries(h("multiView", e.multiView, ["maxPanels", "columns"])), o = Object.fromEntries(h("expandAll", e.expandAll, ["maxFolders", "maxDepth"])), s = Object.fromEntries(h("revealDocument", e.revealDocument, ["maxDepth"])), a = e.documentStyles ?? ce;
228
+ if (!Array.isArray(a) || a.length === 0) throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");
229
229
  const c = /* @__PURE__ */ new Set();
230
- for (const a of i) {
231
- if (a === null || typeof a != "object" || typeof a.name != "string" || a.name.trim() === "" || typeof a.className != "string")
230
+ for (const i of a) {
231
+ if (i === null || typeof i != "object" || typeof i.name != "string" || i.name.trim() === "" || typeof i.className != "string")
232
232
  throw new RangeError("[markdown-explorer] each document style needs a non-blank name and a className string");
233
- if (c.has(a.name)) throw new RangeError(`[markdown-explorer] document style names must be unique; ${JSON.stringify(a.name)} repeats`);
234
- c.add(a.name);
233
+ if (c.has(i.name)) throw new RangeError(`[markdown-explorer] document style names must be unique; ${JSON.stringify(i.name)} repeats`);
234
+ c.add(i.name);
235
235
  }
236
236
  return Object.freeze({
237
237
  basePath: e.basePath,
@@ -239,36 +239,36 @@ const $ = (e) => {
239
239
  settingsCookie: e.settingsCookie,
240
240
  views: t,
241
241
  multiView: Object.freeze({
242
- maxPanels: x("multiView.maxPanels", n.maxPanels, xe),
243
- columns: x("multiView.columns", n.columns, ye)
242
+ maxPanels: y("multiView.maxPanels", n.maxPanels, Re),
243
+ columns: y("multiView.columns", n.columns, _e)
244
244
  }),
245
245
  expandAll: Object.freeze({
246
- maxFolders: x("expandAll.maxFolders", o.maxFolders, be),
247
- maxDepth: x("expandAll.maxDepth", o.maxDepth, Oe)
246
+ maxFolders: y("expandAll.maxFolders", o.maxFolders, Te),
247
+ maxDepth: y("expandAll.maxDepth", o.maxDepth, Ne)
248
248
  }),
249
- revealDocument: Object.freeze({ maxDepth: x("revealDocument.maxDepth", s.maxDepth, ke) }),
250
- documentStyles: Object.freeze(i.map((a) => Object.freeze({ name: a.name, className: a.className }))),
249
+ revealDocument: Object.freeze({ maxDepth: y("revealDocument.maxDepth", s.maxDepth, Ae) }),
250
+ documentStyles: Object.freeze(a.map((i) => Object.freeze({ name: i.name, className: i.className }))),
251
251
  iframeHosts: Object.freeze([...new Set(r)]),
252
- embeds: Ae(e.embeds, e.dataPath),
253
- defaultTreeSettings: $e(e.defaultTreeSettings)
252
+ embeds: ze(e.embeds, e.dataPath),
253
+ defaultTreeSettings: je(e.defaultTreeSettings)
254
254
  });
255
- }, yt = (e) => {
255
+ }, _t = (e) => {
256
256
  const t = e.embeds;
257
- if (!$(t)) throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${d(t)}`);
257
+ if (!j(t)) throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${d(t)}`);
258
258
  if (Object.hasOwn(t, "linkCards"))
259
259
  throw new RangeError(`[markdown-explorer] config.embeds.linkCards is an option of defineExplorerConfig, not a key of the embeds it resolves; pass the option to defineExplorerConfig (got linkCards ${d(t.linkCards)})`);
260
- const { linkCardEndpoint: r, ...n } = t, o = ve({ ...e, embeds: { ...n, linkCards: r !== null } });
260
+ const { linkCardEndpoint: r, ...n } = t, o = Le({ ...e, embeds: { ...n, linkCards: r !== null } });
261
261
  if (o.embeds.linkCardEndpoint !== r)
262
262
  throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${d(o.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${d(r)}`);
263
263
  return o;
264
- }, Pe = (e) => typeof e == "string" && Te.test(e), bt = (e, t) => {
264
+ }, Me = (e) => typeof e == "string" && $e.test(e), Tt = (e, t) => {
265
265
  if (e === null || typeof e != "object") throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${d(e)}`);
266
266
  if (!Array.isArray(t) || t.length === 0) throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${d(t)}`);
267
267
  for (const r of t)
268
- if (!Pe(r)) throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${d(r)}`);
268
+ if (!Me(r)) throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${d(r)}`);
269
269
  if (new Set(t).size !== t.length) throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);
270
270
  return Object.freeze({ ...e, sourceIds: Object.freeze([...t]) });
271
- }, Ot = (e) => e.documentStyles.map((t) => t.name), l = Object.freeze({
271
+ }, Nt = (e) => e.documentStyles.map((t) => t.name), l = Object.freeze({
272
272
  source: "source",
273
273
  doc: "doc",
274
274
  maximized: "maximized",
@@ -279,146 +279,155 @@ const $ = (e) => {
279
279
  showAlign: "showAlign",
280
280
  padding: "padding",
281
281
  width: "width",
282
- maxWidth: "maxWidth"
283
- }), F = ".data", X = 256, W = /^\d+(?:\.\d+)?$/u, N = /^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u, H = Object.freeze(["showToc", "showStyle", "showAlign"]), Ce = (e) => {
282
+ maxWidth: "maxWidth",
283
+ markup: "markup"
284
+ }), B = "true", W = ".data", Z = 256, Y = /^\d+(?:\.\d+)?$/u, C = /^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u, Q = Object.freeze(["showToc", "showStyle", "showAlign"]), De = (e) => {
284
285
  const t = encodeURIComponent(e.replaceAll("%", "%25"));
285
- return t.endsWith(F) ? `${t.slice(0, -F.length)}%2Edata` : t;
286
- }, ze = (e) => e.replaceAll("%25", "%"), q = (e) => {
286
+ return t.endsWith(W) ? `${t.slice(0, -W.length)}%2Edata` : t;
287
+ }, Ve = (e) => e.replaceAll("%25", "%"), ee = (e) => {
287
288
  const { sourceIds: t } = e;
288
289
  if (t === void 0) throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");
289
290
  return t;
290
- }, je = (e, t, r) => {
291
+ }, Fe = (e, t, r) => {
291
292
  const n = r.getAll(l.source);
292
293
  if (n.length === 0) return t;
293
294
  const [o] = n;
294
295
  return n.length > 1 || o === void 0 || o === t || !e.includes(o) ? null : o;
295
- }, Le = (e, t) => {
296
+ }, Ue = (e, t) => {
296
297
  const r = t.get(l.style), n = t.get(l.align);
297
298
  return {
298
299
  ...r !== null && e.documentStyles.some((o) => o.name === r) ? { style: r } : {},
299
- ...n !== null && b.includes(n) ? { align: n } : {}
300
+ ...n !== null && R.includes(n) ? { align: n } : {}
300
301
  };
301
- }, K = (e) => Number.isFinite(e) && e >= 0 && e <= X && W.test(String(e)), De = (e) => {
302
- const t = e.get(l.padding), r = t !== null && W.test(t) ? Number(t) : Number.NaN, n = e.get(l.width), o = e.get(l.maxWidth);
302
+ }, te = (e) => Number.isFinite(e) && e >= 0 && e <= Z && Y.test(String(e)), Je = (e) => {
303
+ const t = e.get(l.padding), r = t !== null && Y.test(t) ? Number(t) : Number.NaN, n = e.get(l.width), o = e.get(l.maxWidth);
303
304
  return {
304
305
  ...e.get(l.showToc) === "false" ? { showToc: !1 } : {},
305
306
  ...e.get(l.showStyle) === "false" ? { showStyle: !1 } : {},
306
307
  ...e.get(l.showAlign) === "false" ? { showAlign: !1 } : {},
307
- ...K(r) ? { padding: r } : {},
308
- ...n !== null && N.test(n) ? { width: n } : {},
309
- ...o !== null && N.test(o) ? { maxWidth: o } : {}
308
+ ...te(r) ? { padding: r } : {},
309
+ ...n !== null && C.test(n) ? { width: n } : {},
310
+ ...o !== null && C.test(o) ? { maxWidth: o } : {}
310
311
  };
311
- }, Me = (e, t) => [...new Set(t.filter(A))].slice(0, e.multiView.maxPanels), Ve = (e, t, r) => {
312
- for (const n of t) B(n);
312
+ }, Ge = (e, t) => [...new Set(t.filter(z))].slice(0, e.multiView.maxPanels), Xe = (e, t, r, n) => {
313
+ for (const s of t) re(s);
313
314
  if (new Set(t).size !== t.length) throw new RangeError(`[markdown-explorer] multi-view documents must each appear once; got ${String(t.length)} with repeats`);
314
315
  if (t.length > e.multiView.maxPanels) throw new RangeError(`[markdown-explorer] the multi view opens at most ${String(e.multiView.maxPanels)} documents; got ${String(t.length)}`);
315
316
  if (r !== null && !t.includes(r)) throw new RangeError(`[markdown-explorer] the maximized document must be one of the open documents; got ${JSON.stringify(r.slice(0, 80))}`);
316
- }, B = (e) => {
317
- if (!A(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0, 80))}`);
317
+ if (new Set(n).size !== n.length) throw new RangeError(`[markdown-explorer] the documents shown as written must each appear once; got ${String(n.length)} with repeats`);
318
+ const o = n.find((s) => !t.includes(s));
319
+ if (o !== void 0) throw new RangeError(`[markdown-explorer] a document shown as written must be one of the open documents; got ${JSON.stringify(o.slice(0, 80))}`);
320
+ }, re = (e) => {
321
+ if (!z(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0, 80))}`);
318
322
  return e;
319
- }, Fe = (e, t) => {
323
+ }, We = (e, t) => {
320
324
  if (t.style !== void 0 && !e.documentStyles.some((r) => r.name === t.style))
321
325
  throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map((r) => JSON.stringify(r.name)).join(", ")}); got ${JSON.stringify(t.style)}`);
322
- if (t.align !== void 0 && !b.includes(t.align))
323
- throw new RangeError(`[markdown-explorer] overrides.align must be one of ${b.join(", ")}; got ${JSON.stringify(t.align)}`);
324
- }, Ue = (e) => {
325
- for (const t of H)
326
+ if (t.align !== void 0 && !R.includes(t.align))
327
+ throw new RangeError(`[markdown-explorer] overrides.align must be one of ${R.join(", ")}; got ${JSON.stringify(t.align)}`);
328
+ }, He = (e) => {
329
+ for (const t of Q)
326
330
  if (e[t] !== void 0 && typeof e[t] != "boolean") throw new RangeError(`[markdown-explorer] embed.${t} must be a boolean; got ${JSON.stringify(e[t])}`);
327
- if (e.padding !== void 0 && !K(e.padding)) throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(X)} px in plain decimal digits; got ${String(e.padding)}`);
331
+ if (e.padding !== void 0 && !te(e.padding)) throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(Z)} px in plain decimal digits; got ${String(e.padding)}`);
328
332
  for (const t of ["width", "maxWidth"]) {
329
333
  const r = e[t];
330
- if (r !== void 0 && !N.test(r)) throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(r)}`);
334
+ if (r !== void 0 && !C.test(r)) throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(r)}`);
331
335
  }
332
- }, Ge = (e, t) => {
336
+ }, qe = (e, t) => {
333
337
  const r = new URLSearchParams();
334
338
  let n = `${e.basePath}/${e.views[t.view]}`;
335
339
  if (t.view === "multi") {
336
- const s = t.docs ?? [], i = t.maximized ?? null;
337
- Ve(e, s, i);
338
- for (const c of s) r.append(l.doc, c);
339
- i !== null && r.set(l.maximized, i);
340
- } else t.doc !== void 0 && t.doc !== null && (n += `/${Ce(B(t.doc))}`);
340
+ const s = t.docs ?? [], a = t.maximized ?? null, c = t.markup ?? [];
341
+ Xe(e, s, a, c);
342
+ for (const i of s) r.append(l.doc, i);
343
+ a !== null && r.set(l.maximized, a);
344
+ for (const i of s) c.includes(i) && r.append(l.markup, i);
345
+ } else t.doc !== void 0 && t.doc !== null && (n += `/${De(re(t.doc))}`);
341
346
  if (t.source !== void 0) {
342
- const s = q(e);
347
+ const s = ee(e);
343
348
  if (!s.includes(t.source)) throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${s.join(", ")}`);
344
349
  t.source !== s[0] && r.set(l.source, t.source);
345
350
  }
346
- if (t.view !== "multi" && t.overrides !== void 0 && (Fe(e, t.overrides), t.overrides.style !== void 0 && r.set(l.style, t.overrides.style), t.overrides.align !== void 0 && r.set(l.align, t.overrides.align)), t.view === "single" && t.embed !== void 0) {
351
+ if (t.view !== "multi" && t.overrides !== void 0 && (We(e, t.overrides), t.overrides.style !== void 0 && r.set(l.style, t.overrides.style), t.overrides.align !== void 0 && r.set(l.align, t.overrides.align)), t.view !== "multi" && t.markup === !0) {
352
+ if (t.doc === void 0 || t.doc === null) throw new RangeError("[markdown-explorer] a tree view without a document has nothing to show as written");
353
+ r.set(l.markup, B);
354
+ }
355
+ if (t.view === "single" && t.embed !== void 0) {
347
356
  const { embed: s } = t;
348
- Ue(s);
349
- for (const i of H) s[i] === !1 && r.set(l[i], "false");
357
+ He(s);
358
+ for (const a of Q) s[a] === !1 && r.set(l[a], "false");
350
359
  s.padding !== void 0 && r.set(l.padding, String(s.padding)), s.width !== void 0 && r.set(l.width, s.width), s.maxWidth !== void 0 && r.set(l.maxWidth, s.maxWidth);
351
360
  }
352
361
  const o = r.toString();
353
362
  return o === "" ? n : `${n}?${o}`;
354
- }, Je = (e, t) => Object.keys(e.views).find((r) => e.views[r] === t), kt = (e, t, r) => {
355
- const n = q(e), [o] = n;
363
+ }, Ke = (e, t) => Object.keys(e.views).find((r) => e.views[r] === t), At = (e, t, r) => {
364
+ const n = ee(e), [o] = n;
356
365
  if (o === void 0) throw new RangeError("[markdown-explorer] the configuration has no source");
357
- const s = je(n, o, r), i = s === null ? o : s, c = (m) => ({ kind: "redirect", href: Ge(e, m), location: m }), a = () => c({ view: "tree", source: i, doc: null, overrides: {} });
358
- if (t === void 0 || t === "") return a();
359
- const E = t.indexOf("/"), k = E < 0 ? t : t.slice(0, E), R = E < 0 ? null : t.slice(E + 1), f = Je(e, k);
360
- if (f === void 0) return a();
361
- if (f === "multi") {
362
- const m = r.getAll(l.doc), S = Me(e, m), _ = r.getAll(l.maximized), [T] = _, I = _.length === 1 && T !== void 0 && S.includes(T) ? T : null;
363
- return R === null && s !== null && S.length === m.length && S.every((Z, Y) => Z === m[Y]) && (_.length === 0 || I !== null) ? { kind: "location", location: { view: "multi", source: i, docs: S, maximized: I } } : c({ view: "multi", source: i, docs: S, maximized: I });
366
+ const s = Fe(n, o, r), a = s === null ? o : s, c = (m) => ({ kind: "redirect", href: qe(e, m), location: m }), i = () => c({ view: "tree", source: a, doc: null, overrides: {}, markup: !1 });
367
+ if (t === void 0 || t === "") return i();
368
+ const S = t.indexOf("/"), T = S < 0 ? t : t.slice(0, S), N = S < 0 ? null : t.slice(S + 1), u = Ke(e, T);
369
+ if (u === void 0) return i();
370
+ if (u === "multi") {
371
+ const m = r.getAll(l.doc), p = Ge(e, m), A = r.getAll(l.maximized), [I] = A, v = A.length === 1 && I !== void 0 && p.includes(I) ? I : null, $ = r.getAll(l.markup), k = p.filter((x) => $.includes(x)), ne = k.length === $.length && k.every((x, P) => x === $[P]);
372
+ return N === null && s !== null && p.length === m.length && p.every((x, P) => x === m[P]) && (A.length === 0 || v !== null) && ne ? { kind: "location", location: { view: "multi", source: a, docs: p, maximized: v, markup: k } } : c({ view: "multi", source: a, docs: p, maximized: v, markup: k });
364
373
  }
365
- const u = R === null ? null : ze(R);
366
- if (u !== null && !A(u)) return a();
367
- const y = Le(e, r);
368
- if (f === "single") {
369
- if (u === null) return a();
370
- const m = De(r);
371
- return s === null ? c({ view: f, source: i, doc: u, overrides: y, embed: m }) : { kind: "location", location: { view: f, source: i, doc: u, overrides: y, embed: m } };
374
+ const f = N === null ? null : Ve(N);
375
+ if (f !== null && !z(f)) return i();
376
+ const b = Ue(e, r), O = f !== null && r.get(l.markup) === B;
377
+ if (u === "single") {
378
+ if (f === null) return i();
379
+ const m = Je(r);
380
+ return s === null ? c({ view: u, source: a, doc: f, overrides: b, embed: m, markup: O }) : { kind: "location", location: { view: u, source: a, doc: f, overrides: b, embed: m, markup: O } };
372
381
  }
373
- return s === null ? c({ view: f, source: i, doc: u, overrides: y }) : { kind: "location", location: { view: f, source: i, doc: u, overrides: y } };
382
+ return s === null ? c({ view: u, source: a, doc: f, overrides: b, markup: O }) : { kind: "location", location: { view: u, source: a, doc: f, overrides: b, markup: O } };
374
383
  };
375
384
  export {
376
- st as A,
377
- tt as B,
378
- at as C,
379
- z as D,
380
- gt as E,
381
- ct as F,
385
+ dt as A,
386
+ it as B,
387
+ ft as C,
388
+ V as D,
389
+ St as E,
390
+ gt as F,
382
391
  w as G,
383
- Ye as H,
384
- xt as I,
385
- ft as J,
386
- C as K,
387
- M as L,
388
- Oe as M,
389
- P as N,
390
- be as O,
391
- dt as P,
392
- ce as Q,
393
- ye as R,
394
- it as S,
395
- xe as T,
396
- ke as U,
397
- ve as V,
398
- kt as a,
399
- Et as b,
400
- Me as c,
401
- Ot as d,
402
- Ge as e,
403
- $ as f,
404
- ht as g,
405
- pt as h,
406
- Pe as i,
407
- mt as j,
408
- rt as k,
409
- Ze as l,
410
- ut as m,
411
- fe as n,
412
- J as o,
413
- St as p,
414
- nt as q,
415
- yt as r,
416
- ot as s,
417
- lt as t,
418
- wt as u,
419
- Ke as v,
420
- bt as w,
421
- et as x,
422
- Be as y,
423
- Qe as z
392
+ nt as H,
393
+ Rt as I,
394
+ ht as J,
395
+ D as K,
396
+ G as L,
397
+ Ne as M,
398
+ M as N,
399
+ Te as O,
400
+ wt as P,
401
+ ge as Q,
402
+ _e as R,
403
+ mt as S,
404
+ Re as T,
405
+ Ae as U,
406
+ Le as V,
407
+ At as a,
408
+ Ot as b,
409
+ Ge as c,
410
+ Nt as d,
411
+ qe as e,
412
+ j as f,
413
+ bt as g,
414
+ yt as h,
415
+ Me as i,
416
+ pt as j,
417
+ at as k,
418
+ rt as l,
419
+ Et as m,
420
+ he as n,
421
+ K as o,
422
+ kt as p,
423
+ lt as q,
424
+ _t as r,
425
+ ct as s,
426
+ ut as t,
427
+ xt as u,
428
+ et as v,
429
+ Tt as w,
430
+ st as x,
431
+ tt as y,
432
+ ot as z
424
433
  };
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-CCc6qUbM.cjs"),R=(n,t,i,l)=>{if(t===n||t===i)return{kind:"clean",text:i};if(i===n)return{kind:"clean",text:t};const d=g.diff3Merge(t.split(`
2
+ `),n.split(`
3
+ `),i.split(`
4
+ `),{excludeFalseConflicts:!0}),o=[];let c=0;const u=s(l.ours),a=s(l.theirs);for(const e of d)e.ok!==void 0?o.push(...e.ok):e.conflict!==void 0&&(c+=1,o.push(`${r.CONFLICT_OURS_MARKER} ${u}`,...e.conflict.a,r.CONFLICT_SEPARATOR,...e.conflict.b,`${r.CONFLICT_THEIRS_MARKER} ${a}`));const f=o.join(`
5
+ `);return c===0?{kind:"clean",text:f}:{kind:"conflicts",text:f,conflicts:c}},s=n=>n.replace(/[\r\n]+/gu," ");exports.mergeDraft=R;
@@ -0,0 +1,20 @@
1
+ import { diff3Merge as p } from "node-diff3";
2
+ import { C, d as R, e as u } from "./index-C0gh_dRY.js";
3
+ const g = (n, o, e, l) => {
4
+ if (o === n || o === e) return { kind: "clean", text: e };
5
+ if (e === n) return { kind: "clean", text: o };
6
+ const f = p(o.split(`
7
+ `), n.split(`
8
+ `), e.split(`
9
+ `), { excludeFalseConflicts: !0 }), i = [];
10
+ let c = 0;
11
+ const a = s(l.ours), d = s(l.theirs);
12
+ for (const t of f)
13
+ t.ok !== void 0 ? i.push(...t.ok) : t.conflict !== void 0 && (c += 1, i.push(`${C} ${a}`, ...t.conflict.a, R, ...t.conflict.b, `${u} ${d}`));
14
+ const r = i.join(`
15
+ `);
16
+ return c === 0 ? { kind: "clean", text: r } : { kind: "conflicts", text: r, conflicts: c };
17
+ }, s = (n) => n.replace(/[\r\n]+/gu, " ");
18
+ export {
19
+ g as mergeDraft
20
+ };