@aiquants/markdown-explorer 0.26.0 → 0.28.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 (61) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +45 -26
  3. package/dist/{EditSurface-Blymamic.js → EditSurface-BYKUL-a1.js} +32 -32
  4. package/dist/{EditSurface-Co4Rvfa1.cjs → EditSurface-wXPvuB2n.cjs} +2 -2
  5. package/dist/{ExplorerSplit-BZ0PA3z3.js → ExplorerSplit-Bz-1G42e.js} +94 -94
  6. package/dist/{ExplorerSplit-WApgYMPb.cjs → ExplorerSplit-CLxr4_0K.cjs} +1 -1
  7. package/dist/MultiLayout-Coc-HQUb.cjs +1 -0
  8. package/dist/{MultiLayout-B5-1N3JD.js → MultiLayout-DpxzsXKz.js} +167 -168
  9. package/dist/NativeScrollBar-CDgYgxXK.cjs +1 -0
  10. package/dist/{NativeScrollBar-BraWuZvN.js → NativeScrollBar-DLdveoaN.js} +6 -7
  11. package/dist/{TreeLayout-CChoxh9W.js → TreeLayout-C8TuS9ue.js} +9 -9
  12. package/dist/{TreeLayout-C60lb9hP.cjs → TreeLayout-CJrJNZHq.cjs} +1 -1
  13. package/dist/core/config.d.cts +7 -0
  14. package/dist/core/config.d.ts +7 -0
  15. package/dist/core/contracts.d.cts +8 -2
  16. package/dist/core/contracts.d.ts +8 -2
  17. package/dist/core/dataRoute.d.cts +40 -0
  18. package/dist/core/dataRoute.d.ts +40 -0
  19. package/dist/core/labels.d.cts +10 -1
  20. package/dist/core/labels.d.ts +10 -1
  21. package/dist/{dataRoute-BEvesOvN.js → dataRoute-DLhQfdoW.js} +111 -103
  22. package/dist/dataRoute-DwYtgyt6.cjs +1 -0
  23. package/dist/index-CdYr9OQ-.js +4805 -0
  24. package/dist/index-CjyRD7qg.cjs +15 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.cts +2 -2
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.js +29 -28
  29. package/dist/{location-DIxIjqs7.js → location-CKuabtKl.js} +152 -147
  30. package/dist/location-l_HysaZR.cjs +1 -0
  31. package/dist/{merge-CgSp-0Dd.js → merge-BQgbDcHR.js} +1 -1
  32. package/dist/{merge-DRWmjC24.cjs → merge-DRLuveD9.cjs} +1 -1
  33. package/dist/{sanitizePolicy-gVKBhabq.js → sanitizePolicy-By0tKOpZ.js} +1 -1
  34. package/dist/{sanitizePolicy-CZwOaJ92.cjs → sanitizePolicy-T5T-3vV5.cjs} +1 -1
  35. package/dist/sanitizeWorker.cjs +1 -1
  36. package/dist/sanitizeWorker.js +1 -1
  37. package/dist/server/ports.d.cts +4 -3
  38. package/dist/server/ports.d.ts +4 -3
  39. package/dist/server.cjs +1 -1
  40. package/dist/server.js +500 -493
  41. package/dist/styles/markdown-explorer.css +1 -1
  42. package/dist/tapScrollCircle-B2A6CmmI.js +13 -0
  43. package/dist/tapScrollCircle-qD8iSmfq.cjs +1 -0
  44. package/dist/{useSplitPersistence-D-T75Hlh.cjs → useSplitPersistence-9Nu6J1WF.cjs} +1 -1
  45. package/dist/{useSplitPersistence-Df63lnQZ.js → useSplitPersistence-Bf4M35Il.js} +1 -1
  46. package/docs/behavior/dom-hooks.md +10 -6
  47. package/docs/behavior/layout.md +12 -4
  48. package/docs/behavior/localization.md +5 -2
  49. package/docs/behavior/security.md +7 -2
  50. package/docs/behavior/url-contract.md +3 -3
  51. package/package.json +5 -5
  52. package/dist/MultiLayout-dAW_JCzg.cjs +0 -1
  53. package/dist/NativeScrollBar-ThVMbI0Y.cjs +0 -1
  54. package/dist/dataRoute-Cv7fgCW7.cjs +0 -1
  55. package/dist/index-B6FkGD-p.cjs +0 -13
  56. package/dist/index-Bd6hgisa.js +0 -4097
  57. package/dist/location-D3DgoELB.cjs +0 -1
  58. package/dist/scrollBarGeometry-C46jBtmM.cjs +0 -1
  59. package/dist/scrollBarGeometry-DOBdGNV-.js +0 -4
  60. package/dist/tapScrollCircle-C5DGI-0H.cjs +0 -1
  61. package/dist/tapScrollCircle-u4EXeLhx.js +0 -6
@@ -1,11 +1,11 @@
1
1
  import { NO_EMBEDS as ye, isEmbedProviderId as be, EMBED_PROVIDER_IDS as Oe, isLinkCardSize as ke, LINK_CARD_SIZES as Te } from "@aiquants/markdown/embeds";
2
2
  import { CONTENT_ALIGNS as N, DEFAULT_MARKDOWN_STYLES as Re } from "@aiquants/markdown/viewer-settings";
3
- import { a as _e, i as $ } from "./dataRoute-BEvesOvN.js";
3
+ import { a as Ie, i as A } from "./dataRoute-DLhQfdoW.js";
4
4
  const R = (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
- }, Ie = Object.freeze([
8
+ }, _e = Object.freeze([
9
9
  "UTF-8",
10
10
  "IBM866",
11
11
  "ISO-8859-2",
@@ -46,12 +46,12 @@ const R = (e) => {
46
46
  "UTF-16BE",
47
47
  "UTF-16LE",
48
48
  "x-user-defined"
49
- ]), Ne = new Map(Ie.map((e) => [e.toLowerCase(), e])), A = "UTF-8", q = Object.freeze([
50
- Object.freeze({ bytes: Object.freeze([239, 187, 191]), encoding: A }),
49
+ ]), Ne = new Map(_e.map((e) => [e.toLowerCase(), e])), $ = "UTF-8", q = Object.freeze([
50
+ Object.freeze({ bytes: Object.freeze([239, 187, 191]), encoding: $ }),
51
51
  Object.freeze({ bytes: Object.freeze([255, 254]), encoding: "UTF-16LE" }),
52
52
  Object.freeze({ bytes: Object.freeze([254, 255]), encoding: "UTF-16BE" })
53
- ]), $e = /* @__PURE__ */ new Map([
54
- [A, "is read before any legacy encoding"],
53
+ ]), Ae = /* @__PURE__ */ new Map([
54
+ [$, "is read before any legacy encoding"],
55
55
  ["UTF-16LE", "is read only by its byte order mark"],
56
56
  ["UTF-16BE", "is read only by its byte order mark"],
57
57
  ["ISO-2022-JP", "writes only bytes below 0x80, which UTF-8 always reads first, so it would never be used"],
@@ -63,10 +63,10 @@ const R = (e) => {
63
63
  } catch (o) {
64
64
  throw o instanceof RangeError ? new RangeError(`[markdown-explorer] legacyTextEncoding ${JSON.stringify(e)} is no encoding label TextDecoder knows (for example "Shift_JIS" or "windows-1252")`) : o;
65
65
  }
66
- const n = Ae(t), r = $e.get(n);
66
+ const n = $e(t), r = Ae.get(n);
67
67
  if (r !== void 0) throw new RangeError(`[markdown-explorer] legacyTextEncoding ${JSON.stringify(e)} names ${n}, which cannot be the legacy encoding: it ${r}`);
68
68
  return n;
69
- }, Ae = (e) => {
69
+ }, $e = (e) => {
70
70
  const t = Ne.get(e);
71
71
  if (t === void 0) throw new RangeError(`[markdown-explorer] TextDecoder answered ${JSON.stringify(e)}, which is no encoding of the WHATWG Encoding Standard`);
72
72
  return t;
@@ -74,15 +74,15 @@ const R = (e) => {
74
74
  const r = n === null ? null : de(n), o = q.find(({ bytes: i }) => i.every((a, l) => e[l] === a));
75
75
  if (o !== void 0) return { body: e.subarray(o.bytes.length), encodings: [o.encoding] };
76
76
  const s = t || e.length === 0 ? void 0 : q.find(({ bytes: i }) => e.length < i.length && e.every((a, l) => i[l] === a));
77
- return s !== void 0 ? { body: e.subarray(e.length), encodings: [s.encoding] } : { body: e, encodings: r === null ? [A] : [A, r] };
78
- }, At = (e, t, n) => C(e, t, n).encodings, Pe = (e, t, n) => {
77
+ return s !== void 0 ? { body: e.subarray(e.length), encodings: [s.encoding] } : { body: e, encodings: r === null ? [$] : [$, r] };
78
+ }, Pt = (e, t, n) => C(e, t, n).encodings, Pe = (e, t, n) => {
79
79
  try {
80
80
  return new TextDecoder(e, { fatal: !0, ignoreBOM: !0 }).decode(t, { stream: !n });
81
81
  } catch (r) {
82
82
  if (r instanceof TypeError) return null;
83
83
  throw r;
84
84
  }
85
- }, Pt = (e, t, n) => {
85
+ }, vt = (e, t, n) => {
86
86
  const r = X(C(e, t, n), t);
87
87
  return r === null ? null : r.text;
88
88
  }, X = ({ body: e, encodings: t }, n) => {
@@ -91,13 +91,13 @@ const R = (e) => {
91
91
  if (o !== null) return { encoding: r, text: o };
92
92
  }
93
93
  return null;
94
- }, vt = (e, t, n) => {
94
+ }, jt = (e, t, n) => {
95
95
  const r = C(e, t, n), o = X(r, t);
96
96
  return o === null ? r.encodings[0] : o.encoding;
97
- }, jt = (e, t, n) => {
97
+ }, Ct = (e, t, n) => {
98
98
  const r = C(e, t, n), o = X(r, t);
99
99
  return o !== null ? o.text : new TextDecoder(r.encodings[0], { ignoreBOM: !0 }).decode(r.body, { stream: !t });
100
- }, P = new Intl.Collator("en", { numeric: !0, sensitivity: "variant" }), ve = /^readme(?:\.|$)/iu, Y = /^readme(?:\.[^.]*)?$/iu, Z = Object.freeze(["md", "markdown", "mdx", "txt", ""]), je = (e) => ve.test(e), G = (e) => e.type === "file" && je(e.name), Q = (e) => {
100
+ }, P = new Intl.Collator("en", { numeric: !0, sensitivity: "variant" }), ve = /^readme(?:\.|$)/iu, Y = /^readme(?:\.[^.]*)?$/iu, Z = Object.freeze(["md", "markdown", "mdx", "txt", ""]), je = (e) => ve.test(e), J = (e) => e.type === "file" && je(e.name), Q = (e) => {
101
101
  const t = e.lastIndexOf("."), n = Z.indexOf(t < 0 ? "" : e.slice(t + 1).toLowerCase());
102
102
  return n < 0 ? Z.length : n;
103
103
  }, Ce = (e, t) => {
@@ -107,10 +107,10 @@ const R = (e) => {
107
107
  if (r !== 0) return r;
108
108
  const o = P.compare(e.name, t.name);
109
109
  return o !== 0 ? o : P.compare(e.path, t.path);
110
- }, Ct = (e) => {
110
+ }, Mt = (e) => {
111
111
  let t = null;
112
112
  for (const n of e)
113
- G(n) && (t === null || Ce(n, t) < 0) && (t = n);
113
+ J(n) && (t === null || Ce(n, t) < 0) && (t = n);
114
114
  return t === null ? null : t.path;
115
115
  }, ee = Object.freeze({
116
116
  sortMode: "native",
@@ -126,7 +126,7 @@ const R = (e) => {
126
126
  expandIcons: !0,
127
127
  directoryIcons: !0,
128
128
  fileIcons: !0
129
- }), Me = [!0, !1], De = (e, t) => t ? e.settingOn : e.settingOff, p = (e, t) => ({ key: e, labelKey: t, values: Me, formatValue: De, requiresItemSelection: !1 }), Le = Object.freeze({
129
+ }), Me = [!0, !1], Le = (e, t) => t ? e.settingOn : e.settingOff, p = (e, t) => ({ key: e, labelKey: t, values: Me, formatValue: Le, requiresItemSelection: !1 }), De = Object.freeze({
130
130
  native: (e) => e.sortNative,
131
131
  asc: (e) => e.sortAscending,
132
132
  desc: (e) => e.sortDescending,
@@ -137,7 +137,7 @@ const R = (e) => {
137
137
  key: "sortMode",
138
138
  labelKey: "settingSortMode",
139
139
  values: ["native", "asc", "desc", "oldest", "newest"],
140
- formatValue: (e, t) => Le[t](e),
140
+ formatValue: (e, t) => De[t](e),
141
141
  requiresItemSelection: !1
142
142
  },
143
143
  {
@@ -182,25 +182,25 @@ const R = (e) => {
182
182
  p("expandIcons", "settingExpandIcons"),
183
183
  p("directoryIcons", "settingDirectoryIcons"),
184
184
  p("fileIcons", "settingFileIcons")
185
- ]), Mt = (e) => e ? b : b.filter((t) => !t.requiresItemSelection), me = (e) => {
185
+ ]), Lt = (e) => e ? b : b.filter((t) => !t.requiresItemSelection), me = (e) => {
186
186
  const t = b.find((n) => n.key === e);
187
187
  if (t === void 0) throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);
188
188
  return t;
189
189
  }, Dt = (e, t) => {
190
190
  const n = me(t).values, r = n[(n.indexOf(e[t]) + 1) % n.length];
191
191
  return { ...e, [t]: r };
192
- }, Lt = (e, t, n) => me(n).formatValue(e, t[n]), fe = 2, te = Object.freeze({}), K = (e, t) => Object.freeze(Object.fromEntries(b.filter((n) => t(n, e[n.key])).map((n) => [n.key, e[n.key]]))), ne = "directoriesFirst", ze = (e) => {
192
+ }, zt = (e, t, n) => me(n).formatValue(e, t[n]), fe = 2, te = Object.freeze({}), K = (e, t) => Object.freeze(Object.fromEntries(b.filter((n) => t(n, e[n.key])).map((n) => [n.key, e[n.key]]))), ne = "directoriesFirst", ze = (e) => {
193
193
  if (!Object.hasOwn(e, ne)) return e;
194
194
  const { [ne]: t, ...n } = e;
195
195
  return Object.hasOwn(n, "folderPlacement") || typeof t != "boolean" ? n : { ...n, folderPlacement: t ? "first" : "mixed" };
196
- }, zt = (e) => {
196
+ }, Ft = (e) => {
197
197
  if (e === null || typeof e != "object" || Array.isArray(e)) return te;
198
198
  const t = e;
199
199
  return t.version !== fe || t.settings === null || typeof t.settings != "object" || Array.isArray(t.settings) ? te : K(ze(t.settings), (n, r) => n.values.includes(r));
200
- }, Ft = (e, t) => {
200
+ }, Ut = (e, t) => {
201
201
  const n = K(t, (r, o) => o !== void 0 && o !== e[r.key]);
202
202
  return Object.keys(n).length === 0 ? e : Object.freeze({ ...e, ...n });
203
- }, Ut = (e, t, n, r) => K({ ...e, [t]: n }, (o, s) => s !== void 0 && !(o.key === t && s === r[t])), Vt = (e) => JSON.stringify({ version: fe, settings: e }), Fe = (e, t, n) => e === void 0 || t === void 0 ? e === t ? 0 : e === void 0 ? 1 : -1 : n * (e - t), Jt = (e) => {
203
+ }, Vt = (e, t, n, r) => K({ ...e, [t]: n }, (o, s) => s !== void 0 && !(o.key === t && s === r[t])), Bt = (e) => JSON.stringify({ version: fe, settings: e }), Fe = (e, t, n) => e === void 0 || t === void 0 ? e === t ? 0 : e === void 0 ? 1 : -1 : n * (e - t), Jt = (e) => {
204
204
  const { sortMode: t, folderPlacement: n, readmePlacement: r } = e;
205
205
  if (t === "native" && n === "mixed" && r === "mixed") return;
206
206
  const o = (s, i) => {
@@ -210,8 +210,8 @@ const R = (e) => {
210
210
  return (s, i) => {
211
211
  if (n !== "mixed" && s.type !== i.type) return s.type === "directory" == (n === "first") ? -1 : 1;
212
212
  if (r !== "mixed") {
213
- const l = G(s);
214
- if (l !== G(i)) return l === (r === "first") ? -1 : 1;
213
+ const l = J(s);
214
+ if (l !== J(i)) return l === (r === "first") ? -1 : 1;
215
215
  }
216
216
  if (t === "native") return 0;
217
217
  if (t === "asc") return o(s, i);
@@ -219,10 +219,10 @@ const R = (e) => {
219
219
  const a = Fe(s.modifiedAt, i.modifiedAt, t === "oldest" ? 1 : -1);
220
220
  return a !== 0 ? a : o(s, i);
221
221
  };
222
- }, h = (1 + Math.sqrt(5)) / 2, Gt = 100 / h ** 3, Bt = 100 / h ** 4, ue = 100 / h ** 2, Ue = 13, Wt = 16, Xt = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), Ve = Object.freeze([89, 144, 233, 377]), Je = 44, Kt = Je, Ht = 24, qt = 1 / h, Yt = 1 / h ** 3, Zt = "40ch", Ge = (e) => {
222
+ }, h = (1 + Math.sqrt(5)) / 2, Gt = 100 / h ** 3, Wt = 100 / h ** 4, ue = 100 / h ** 2, Ue = 13, Xt = 16, Kt = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), Ht = Object.freeze([1, 2, 3, 5, 8, 13, 21, 34, 55]), Ve = Object.freeze([89, 144, 233, 377]), Be = 44, qt = Be, Yt = 24, Zt = 1 / h, Qt = 1 / h ** 3, en = "40ch", Je = (e) => {
223
223
  if (!Number.isFinite(e) || e <= 0)
224
224
  throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`);
225
- }, Be = (e) => (Ge(e), Ue * e), Qt = (e) => Be(e) * h ** 2, en = 233, tn = 50, We = 100 / h ** 3, nn = 100 - We, rn = Ve[0], w = (e, t) => {
225
+ }, Ge = (e) => (Je(e), Ue * e), tn = (e) => Ge(e) * h ** 2, nn = 233, rn = 50, We = 100 / h ** 3, on = 100 - We, sn = Ve[0], w = (e, t) => {
226
226
  if (!Number.isFinite(t) || t < 0)
227
227
  throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`);
228
228
  }, Xe = ({ trackInlineSize: e, gap: t, minColumnInlineSize: n, logicalColumns: r }) => {
@@ -232,7 +232,7 @@ const R = (e) => {
232
232
  throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(r)}`);
233
233
  const o = Math.floor((e + t) / (n + t));
234
234
  return Math.min(r, Math.max(1, o));
235
- }, on = (e, t) => {
235
+ }, an = (e, t) => {
236
236
  const { trackInlineSize: n, gap: r, minColumnInlineSize: o, logicalColumns: s } = t;
237
237
  if (!([n, r, o].every(Number.isFinite) && n > 0 && r >= 0 && o > 0)) return e;
238
238
  const a = Xe(t);
@@ -243,18 +243,18 @@ const R = (e) => {
243
243
  return n >= M ? a : l;
244
244
  }
245
245
  return n >= l * o + (l - 1) * r ? l : a;
246
- }, sn = (e, t) => {
246
+ }, cn = (e, t) => {
247
247
  if (!(Number.isInteger(e) && Number.isInteger(t)) || t < 1 || t > e)
248
248
  throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);
249
249
  return Array.from({ length: t }, (n, r) => [Math.floor(r * e / t), Math.floor((r + 1) * e / t)]);
250
- }, an = (e, t, n) => {
250
+ }, ln = (e, t, n) => {
251
251
  if (w("surfaceInlineSize", e), w("handlePixels", n), !Number.isFinite(t) || t <= 0)
252
252
  throw new RangeError(`[markdown-explorer] measure must be a finite number > 0; got ${String(t)}`);
253
253
  return e >= 2 * t + n ? "beside" : "stacked";
254
- }, J = (e, t, n) => Math.max(t, Math.min(e, n)), re = (e, t, n, r) => {
255
- const o = (J(e, 0, n) + J(t, 0, n)) / 2;
256
- return J(o - r / 2, 0, n - r);
257
- }, cn = (e, t, n) => {
254
+ }, B = (e, t, n) => Math.max(t, Math.min(e, n)), re = (e, t, n, r) => {
255
+ const o = (B(e, 0, n) + B(t, 0, n)) / 2;
256
+ return B(o - r / 2, 0, n - r);
257
+ }, dn = (e, t, n) => {
258
258
  for (const [r, o] of Object.entries(e))
259
259
  if (!Number.isFinite(o)) throw new RangeError(`[markdown-explorer] anchor.${r} must be a finite number; got ${String(o)}`);
260
260
  return w("marginBox.width", t.width), w("marginBox.height", t.height), w("viewport.width", n.width), w("viewport.height", n.height), {
@@ -273,14 +273,14 @@ const R = (e) => {
273
273
  ...typeof s == "string" && t.includes(s) ? { style: s } : {},
274
274
  ...typeof i == "string" && N.includes(i) ? { align: i } : {}
275
275
  };
276
- }, ln = (e, t) => {
276
+ }, mn = (e, t) => {
277
277
  if (e !== null)
278
278
  for (const n of e.split(";")) {
279
279
  const r = n.indexOf("=");
280
280
  if (!(r < 0) && n.slice(0, r).trim() === t)
281
281
  return n.slice(r + 1).trim();
282
282
  }
283
- }, dn = (e, t) => {
283
+ }, fn = (e, t) => {
284
284
  if (e === void 0 || e === "") return {};
285
285
  try {
286
286
  return Ye(JSON.parse(decodeURIComponent(e)), t);
@@ -297,9 +297,9 @@ const R = (e) => {
297
297
  ...e.align === void 0 ? {} : { align: e.align }
298
298
  })
299
299
  );
300
- }, mn = (e, t, n) => `${e}=${Qe(t)}; Path=/; Max-Age=${String(Ke)}; SameSite=Lax${n ? "; Secure" : ""}`, se = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), et = Object.freeze({ default: 12, min: 1, max: 64 }), tt = Object.freeze({ default: 4, min: 1, max: 6 }), nt = Object.freeze({ default: 500, min: 1, max: 1e4 }), rt = Object.freeze({ default: 16, min: 1, max: 64 }), ot = Object.freeze({ default: 16, min: 1, max: 64 }), st = Object.freeze({ default: 2 * 1024 * 1024, min: 1, max: 256 * 1024 * 1024 }), it = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, at = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, ct = /^[a-z0-9][a-z0-9-]*$/u, lt = /^(?=.{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, ie = (e, t) => {
300
+ }, un = (e, t, n) => `${e}=${Qe(t)}; Path=/; Max-Age=${String(Ke)}; SameSite=Lax${n ? "; Secure" : ""}`, se = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), et = Object.freeze({ default: 12, min: 1, max: 64 }), tt = Object.freeze({ default: 4, min: 1, max: 6 }), nt = Object.freeze({ default: 500, min: 1, max: 1e4 }), rt = Object.freeze({ default: 16, min: 1, max: 64 }), ot = Object.freeze({ default: 16, min: 1, max: 64 }), st = Object.freeze({ default: 2 * 1024 * 1024, min: 1, max: 256 * 1024 * 1024 }), it = Object.freeze({ default: 8 * 1024 * 1024, min: 1, max: 256 * 1024 * 1024 }), at = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, ct = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, lt = /^[a-z0-9][a-z0-9-]*$/u, dt = /^(?=.{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, ie = (e, t) => {
301
301
  if (typeof t != "string") throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);
302
- if (!it.test(t) || t.split("/").some((n) => n === "." || n === ".."))
302
+ if (!at.test(t) || t.split("/").some((n) => n === "." || n === ".."))
303
303
  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)}`);
304
304
  }, m = (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" ? R(e) ? "a plain object" : `a non-plain object (${Object.prototype.toString.call(e)})` : String(e), ae = Object.freeze(
305
305
  Object.keys({
@@ -317,27 +317,27 @@ const R = (e) => {
317
317
  legacyTextEncoding: !0,
318
318
  spreadsheets: !0
319
319
  })
320
- ), S = (e, t, n) => {
320
+ ), x = (e, t, n) => {
321
321
  if (t === void 0) return [];
322
322
  if (!R(t)) throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${m(t)}`);
323
323
  const r = Object.entries(t);
324
324
  for (const [o] of r)
325
325
  if (!n.includes(o)) throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${n.join(", ")}`);
326
326
  return r.filter(([, o]) => o !== void 0);
327
- }, dt = (e) => {
327
+ }, mt = (e) => {
328
328
  const t = { ...se };
329
- for (const [n, r] of S("views", e, Object.keys(se))) t[n] = r;
329
+ for (const [n, r] of x("views", e, Object.keys(se))) t[n] = r;
330
330
  for (const [n, r] of Object.entries(t))
331
- if (typeof r != "string" || !at.test(r))
331
+ if (typeof r != "string" || !ct.test(r))
332
332
  throw new RangeError(`[markdown-explorer] views.${n} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(r)}`);
333
333
  return Object.freeze(t);
334
- }, y = (e, t, n) => {
334
+ }, S = (e, t, n) => {
335
335
  if (t === void 0) return n.default;
336
336
  if (typeof t != "number" || !Number.isInteger(t) || t < n.min || t > n.max)
337
337
  throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(n.min)}..${String(n.max)}; got ${m(t)}`);
338
338
  return t;
339
- }, mt = (e, t) => {
340
- const n = new Map(S("embeds", e, ["providers", "linkCards", "linkCardSize"]));
339
+ }, ft = (e, t) => {
340
+ const n = new Map(x("embeds", e, ["providers", "linkCards", "linkCardSize"]));
341
341
  if (n.size === 0) return ye;
342
342
  const r = n.has("providers") ? n.get("providers") : [];
343
343
  if (!Array.isArray(r)) throw new RangeError(`[markdown-explorer] embeds.providers must be an array of provider ids; got ${m(r)}`);
@@ -345,19 +345,19 @@ const R = (e) => {
345
345
  if (!be(a)) throw new RangeError(`[markdown-explorer] embeds.providers must hold only ${Oe.join(", ")}; got ${m(a)}`);
346
346
  const o = n.has("linkCards") ? n.get("linkCards") : !1;
347
347
  if (typeof o != "boolean") throw new RangeError(`[markdown-explorer] embeds.linkCards must be a boolean; got ${m(o)}`);
348
- const s = { providers: Object.freeze([...new Set(r)]), linkCardEndpoint: o ? _e(t) : null };
348
+ const s = { providers: Object.freeze([...new Set(r)]), linkCardEndpoint: o ? Ie(t) : null };
349
349
  if (!n.has("linkCardSize")) return Object.freeze(s);
350
350
  const i = n.get("linkCardSize");
351
351
  if (!ke(i)) throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${Te.join(", ")}; got ${m(i)}`);
352
352
  if (!o) throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${m(i)} with linkCards ${m(o)}`);
353
353
  return Object.freeze({ ...s, linkCardSize: i });
354
- }, ft = (e) => {
354
+ }, ut = (e) => {
355
355
  if (e === void 0) return null;
356
356
  if (typeof e != "string") throw new TypeError(`[markdown-explorer] legacyTextEncoding must be a string; got ${m(e)}`);
357
357
  return de(e);
358
- }, ut = (e) => {
358
+ }, gt = (e) => {
359
359
  const t = new Map(
360
- S(
360
+ x(
361
361
  "defaultTreeSettings",
362
362
  e,
363
363
  b.map((r) => r.key)
@@ -372,12 +372,12 @@ const R = (e) => {
372
372
  n[r.key] = o;
373
373
  }
374
374
  return Object.freeze(n);
375
- }, gt = (e) => {
375
+ }, wt = (e) => {
376
376
  if (e === null || typeof e != "object") throw new TypeError("[markdown-explorer] the explorer configuration must be an object");
377
377
  for (const c of Object.keys(e))
378
378
  if (!ae.includes(c)) throw new RangeError(`[markdown-explorer] ${c} is not an option of the explorer configuration; expected ${ae.join(", ")}`);
379
379
  ie("basePath", e.basePath), ie("dataPath", e.dataPath);
380
- const t = dt(e.views);
380
+ const t = mt(e.views);
381
381
  if ((/* @__PURE__ */ new Set([t.tree, t.multi, t.single])).size !== 3)
382
382
  throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);
383
383
  if (e.dataPath === e.basePath) throw new RangeError("[markdown-explorer] dataPath must differ from basePath");
@@ -388,9 +388,9 @@ const R = (e) => {
388
388
  }
389
389
  qe(e.settingsCookie);
390
390
  const n = e.iframeHosts ?? [];
391
- if (!Array.isArray(n) || n.some((c) => typeof c != "string" || !lt.test(c)))
391
+ if (!Array.isArray(n) || n.some((c) => typeof c != "string" || !dt.test(c)))
392
392
  throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(n)}`);
393
- const r = Object.fromEntries(S("multiView", e.multiView, ["maxPanels", "columns"])), o = Object.fromEntries(S("expandAll", e.expandAll, ["maxFolders", "maxDepth"])), s = Object.fromEntries(S("revealDocument", e.revealDocument, ["maxDepth"])), i = Object.fromEntries(S("spreadsheets", e.spreadsheets, ["maxBytes"])), a = e.documentStyles ?? Re;
393
+ const r = Object.fromEntries(x("multiView", e.multiView, ["maxPanels", "columns"])), o = Object.fromEntries(x("expandAll", e.expandAll, ["maxFolders", "maxDepth"])), s = Object.fromEntries(x("revealDocument", e.revealDocument, ["maxDepth"])), i = Object.fromEntries(x("spreadsheets", e.spreadsheets, ["maxBytes", "maxWorkbookBytes"])), a = e.documentStyles ?? Re;
394
394
  if (!Array.isArray(a) || a.length === 0) throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");
395
395
  const l = /* @__PURE__ */ new Set();
396
396
  for (const c of a) {
@@ -405,22 +405,25 @@ const R = (e) => {
405
405
  settingsCookie: e.settingsCookie,
406
406
  views: t,
407
407
  multiView: Object.freeze({
408
- maxPanels: y("multiView.maxPanels", r.maxPanels, et),
409
- columns: y("multiView.columns", r.columns, tt)
408
+ maxPanels: S("multiView.maxPanels", r.maxPanels, et),
409
+ columns: S("multiView.columns", r.columns, tt)
410
410
  }),
411
411
  expandAll: Object.freeze({
412
- maxFolders: y("expandAll.maxFolders", o.maxFolders, nt),
413
- maxDepth: y("expandAll.maxDepth", o.maxDepth, rt)
412
+ maxFolders: S("expandAll.maxFolders", o.maxFolders, nt),
413
+ maxDepth: S("expandAll.maxDepth", o.maxDepth, rt)
414
414
  }),
415
- revealDocument: Object.freeze({ maxDepth: y("revealDocument.maxDepth", s.maxDepth, ot) }),
415
+ revealDocument: Object.freeze({ maxDepth: S("revealDocument.maxDepth", s.maxDepth, ot) }),
416
416
  documentStyles: Object.freeze(a.map((c) => Object.freeze({ name: c.name, className: c.className }))),
417
417
  iframeHosts: Object.freeze([...new Set(n)]),
418
- embeds: mt(e.embeds, e.dataPath),
419
- defaultTreeSettings: ut(e.defaultTreeSettings),
420
- legacyTextEncoding: ft(e.legacyTextEncoding),
421
- spreadsheets: Object.freeze({ maxBytes: y("spreadsheets.maxBytes", i.maxBytes, st) })
418
+ embeds: ft(e.embeds, e.dataPath),
419
+ defaultTreeSettings: gt(e.defaultTreeSettings),
420
+ legacyTextEncoding: ut(e.legacyTextEncoding),
421
+ spreadsheets: Object.freeze({
422
+ maxBytes: S("spreadsheets.maxBytes", i.maxBytes, st),
423
+ maxWorkbookBytes: S("spreadsheets.maxWorkbookBytes", i.maxWorkbookBytes, it)
424
+ })
422
425
  });
423
- }, fn = (e) => {
426
+ }, gn = (e) => {
424
427
  const t = e.embeds;
425
428
  if (!R(t)) throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${m(t)}`);
426
429
  if (Object.hasOwn(t, "linkCards"))
@@ -428,44 +431,44 @@ const R = (e) => {
428
431
  const n = e.legacyTextEncoding;
429
432
  if (n !== null && typeof n != "string")
430
433
  throw new TypeError(`[markdown-explorer] config.legacyTextEncoding must be the encoding defineExplorerConfig resolved, or null; got ${m(n)}`);
431
- const { linkCardEndpoint: r, ...o } = t, s = gt({ ...e, embeds: { ...o, linkCards: r !== null }, legacyTextEncoding: n === null ? void 0 : n });
434
+ const { linkCardEndpoint: r, ...o } = t, s = wt({ ...e, embeds: { ...o, linkCards: r !== null }, legacyTextEncoding: n === null ? void 0 : n });
432
435
  if (s.embeds.linkCardEndpoint !== r)
433
436
  throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${m(s.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${m(r)}`);
434
437
  if (s.legacyTextEncoding !== n)
435
438
  throw new RangeError(`[markdown-explorer] config.legacyTextEncoding must be ${m(s.legacyTextEncoding)} (the written name of the encoding it names); got ${m(n)}`);
436
439
  const i = e;
437
440
  for (const [a, l] of Object.entries(s)) {
438
- const c = B(i[a], l, a);
441
+ const c = G(i[a], l, a);
439
442
  if (c !== null)
440
443
  throw c.kind === "extra" ? new RangeError(`[markdown-explorer] config.${c.path} is not a key of what defineExplorerConfig resolves; got ${m(c.given)} there`) : new RangeError(`[markdown-explorer] config.${c.path} must be what defineExplorerConfig resolves; got ${m(c.given)} where it resolves ${m(c.resolved)}`);
441
444
  }
442
445
  return s;
443
- }, B = (e, t, n) => {
446
+ }, G = (e, t, n) => {
444
447
  if (Object.is(e, t)) return null;
445
448
  if (Array.isArray(t)) {
446
449
  if (!Array.isArray(e)) return { kind: "value", path: n, given: e, resolved: t };
447
450
  if (e.length !== t.length) return { kind: "value", path: `${n}.length`, given: e.length, resolved: t.length };
448
451
  for (const [o, s] of t.entries()) {
449
- const i = B(e[o], s, `${n}[${String(o)}]`);
452
+ const i = G(e[o], s, `${n}[${String(o)}]`);
450
453
  if (i !== null) return i;
451
454
  }
452
455
  return null;
453
456
  }
454
457
  if (!(R(t) && R(e))) return { kind: "value", path: n, given: e, resolved: t };
455
458
  for (const o of Object.keys(t)) {
456
- const s = B(Object.hasOwn(e, o) ? e[o] : void 0, t[o], `${n}.${o}`);
459
+ const s = G(Object.hasOwn(e, o) ? e[o] : void 0, t[o], `${n}.${o}`);
457
460
  if (s !== null) return s;
458
461
  }
459
462
  const r = Object.keys(e).find((o) => !Object.hasOwn(t, o));
460
463
  return r === void 0 ? null : { kind: "extra", path: `${n}.${r}`, given: e[r] };
461
- }, wt = (e) => typeof e == "string" && ct.test(e), un = (e, t) => {
464
+ }, ht = (e) => typeof e == "string" && lt.test(e), wn = (e, t) => {
462
465
  if (e === null || typeof e != "object") throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${m(e)}`);
463
466
  if (!Array.isArray(t) || t.length === 0) throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${m(t)}`);
464
467
  for (const n of t)
465
- if (!wt(n)) throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${m(n)}`);
468
+ if (!ht(n)) throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${m(n)}`);
466
469
  if (new Set(t).size !== t.length) throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);
467
470
  return Object.freeze({ ...e, sourceIds: Object.freeze([...t]) });
468
- }, gn = (e) => e.documentStyles.map((t) => t.name), d = Object.freeze({
471
+ }, hn = (e) => e.documentStyles.map((t) => t.name), d = Object.freeze({
469
472
  source: "source",
470
473
  doc: "doc",
471
474
  maximized: "maximized",
@@ -481,22 +484,22 @@ const R = (e) => {
481
484
  }), ge = "true", j = "/", ce = ".data", we = 256, he = /^\d+(?:\.\d+)?$/u, W = /^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u, Ee = Object.freeze(["showToc", "showStyle", "showAlign"]), le = (e) => {
482
485
  const t = encodeURIComponent(e.replaceAll("%", "%25"));
483
486
  return t.endsWith(ce) ? `${t.slice(0, -ce.length)}%2Edata` : t;
484
- }, ht = (e) => e.replaceAll("%25", "%"), pe = (e) => {
487
+ }, Et = (e) => e.replaceAll("%25", "%"), pe = (e) => {
485
488
  const { sourceIds: t } = e;
486
489
  if (t === void 0) throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");
487
490
  return t;
488
- }, Et = (e, t, n) => {
491
+ }, pt = (e, t, n) => {
489
492
  const r = n.getAll(d.source);
490
493
  if (r.length === 0) return t;
491
494
  const [o] = r;
492
495
  return r.length > 1 || o === void 0 || o === t || !e.includes(o) ? null : o;
493
- }, pt = (e, t) => {
496
+ }, St = (e, t) => {
494
497
  const n = t.get(d.style), r = t.get(d.align);
495
498
  return {
496
499
  ...n !== null && e.documentStyles.some((o) => o.name === n) ? { style: n } : {},
497
500
  ...r !== null && N.includes(r) ? { align: r } : {}
498
501
  };
499
- }, Se = (e) => Number.isFinite(e) && e >= 0 && e <= we && he.test(String(e)), St = (e) => {
502
+ }, Se = (e) => Number.isFinite(e) && e >= 0 && e <= we && he.test(String(e)), xt = (e) => {
500
503
  const t = e.get(d.padding), n = t !== null && he.test(t) ? Number(t) : Number.NaN, r = e.get(d.width), o = e.get(d.maxWidth);
501
504
  return {
502
505
  ...e.get(d.showToc) === "false" ? { showToc: !1 } : {},
@@ -506,7 +509,7 @@ const R = (e) => {
506
509
  ...r !== null && W.test(r) ? { width: r } : {},
507
510
  ...o !== null && W.test(o) ? { maxWidth: o } : {}
508
511
  };
509
- }, xt = (e, t) => [...new Set(t.filter($))].slice(0, e.multiView.maxPanels), yt = (e, t, n, r) => {
512
+ }, yt = (e, t) => [...new Set(t.filter(A))].slice(0, e.multiView.maxPanels), bt = (e, t, n, r) => {
510
513
  for (const s of t) H(s);
511
514
  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`);
512
515
  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)}`);
@@ -515,17 +518,17 @@ const R = (e) => {
515
518
  const o = r.find((s) => !t.includes(s));
516
519
  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))}`);
517
520
  }, H = (e) => {
518
- if (!$(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0, 80))}`);
521
+ if (!A(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0, 80))}`);
519
522
  return e;
520
- }, bt = (e) => {
523
+ }, Ot = (e) => {
521
524
  if (H(e).endsWith(j)) throw new RangeError(`[markdown-explorer] a document path ending in a slash has no URL (its segment would name a folder): ${JSON.stringify(e.slice(0, 80))}`);
522
525
  return e;
523
- }, Ot = (e, t) => {
526
+ }, kt = (e, t) => {
524
527
  if (t.style !== void 0 && !e.documentStyles.some((n) => n.name === t.style))
525
528
  throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map((n) => JSON.stringify(n.name)).join(", ")}); got ${JSON.stringify(t.style)}`);
526
529
  if (t.align !== void 0 && !N.includes(t.align))
527
530
  throw new RangeError(`[markdown-explorer] overrides.align must be one of ${N.join(", ")}; got ${JSON.stringify(t.align)}`);
528
- }, kt = (e) => {
531
+ }, Tt = (e) => {
529
532
  for (const t of Ee)
530
533
  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])}`);
531
534
  if (e.padding !== void 0 && !Se(e.padding)) throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(we)} px in plain decimal digits; got ${String(e.padding)}`);
@@ -533,118 +536,120 @@ const R = (e) => {
533
536
  const n = e[t];
534
537
  if (n !== void 0 && !W.test(n)) throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(n)}`);
535
538
  }
536
- }, Tt = (e, t) => {
539
+ }, Rt = (e, t) => {
537
540
  const n = new URLSearchParams();
538
541
  let r = `${e.basePath}/${e.views[t.view]}`;
539
542
  if (t.view === "multi") {
540
543
  const s = t.docs ?? [], i = t.maximized ?? null, a = t.markup ?? [];
541
- yt(e, s, i, a);
544
+ bt(e, s, i, a);
542
545
  for (const l of s) n.append(d.doc, l);
543
546
  i !== null && n.set(d.maximized, i);
544
547
  for (const l of s) a.includes(l) && n.append(d.markup, l);
545
548
  } else {
546
549
  const s = t.doc ?? null, i = t.view === "tree" ? t.folder ?? null : null;
547
550
  if (s !== null && i !== null) throw new RangeError("[markdown-explorer] a tree view shows a document or a folder, not both");
548
- s !== null && (r += `/${le(bt(s))}`), i !== null && (r += `/${le(`${H(i)}${j}`)}`);
551
+ s !== null && (r += `/${le(Ot(s))}`), i !== null && (r += `/${le(`${H(i)}${j}`)}`);
549
552
  }
550
553
  if (t.source !== void 0) {
551
554
  const s = pe(e);
552
555
  if (!s.includes(t.source)) throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${s.join(", ")}`);
553
556
  t.source !== s[0] && n.set(d.source, t.source);
554
557
  }
555
- if (t.view !== "multi" && t.overrides !== void 0 && (Ot(e, t.overrides), t.overrides.style !== void 0 && n.set(d.style, t.overrides.style), t.overrides.align !== void 0 && n.set(d.align, t.overrides.align)), t.view !== "multi" && t.markup === !0) {
558
+ if (t.view !== "multi" && t.overrides !== void 0 && (kt(e, t.overrides), t.overrides.style !== void 0 && n.set(d.style, t.overrides.style), t.overrides.align !== void 0 && n.set(d.align, t.overrides.align)), t.view !== "multi" && t.markup === !0) {
556
559
  if (!(t.doc !== void 0 && t.doc !== null || t.view === "tree" && t.folder !== void 0 && t.folder !== null)) throw new RangeError("[markdown-explorer] a tree view without a document or a folder has nothing to show as written");
557
560
  n.set(d.markup, ge);
558
561
  }
559
562
  if (t.view === "single" && t.embed !== void 0) {
560
563
  const { embed: s } = t;
561
- kt(s);
564
+ Tt(s);
562
565
  for (const i of Ee) s[i] === !1 && n.set(d[i], "false");
563
566
  s.padding !== void 0 && n.set(d.padding, String(s.padding)), s.width !== void 0 && n.set(d.width, s.width), s.maxWidth !== void 0 && n.set(d.maxWidth, s.maxWidth);
564
567
  }
565
568
  const o = n.toString();
566
569
  return o === "" ? r : `${r}?${o}`;
567
- }, Rt = (e, t) => Object.keys(e.views).find((n) => e.views[n] === t), wn = (e, t, n) => {
570
+ }, It = (e, t) => Object.keys(e.views).find((n) => e.views[n] === t), En = (e, t, n) => {
568
571
  const r = pe(e), [o] = r;
569
572
  if (o === void 0) throw new RangeError("[markdown-explorer] the configuration has no source");
570
- const s = Et(r, o, n), i = s === null ? o : s, a = (f) => ({ kind: "redirect", href: Tt(e, f), location: f }), l = () => a({ view: "tree", source: i, doc: null, folder: null, overrides: {}, markup: !1 });
573
+ const s = pt(r, o, n), i = s === null ? o : s, a = (f) => ({ kind: "redirect", href: Rt(e, f), location: f }), l = () => a({ view: "tree", source: i, doc: null, folder: null, overrides: {}, markup: !1 });
571
574
  if (t === void 0 || t === "") return l();
572
- const c = t.indexOf("/"), M = c < 0 ? t : t.slice(0, c), D = c < 0 ? null : t.slice(c + 1), E = Rt(e, M);
575
+ const c = t.indexOf("/"), M = c < 0 ? t : t.slice(0, c), L = c < 0 ? null : t.slice(c + 1), E = It(e, M);
573
576
  if (E === void 0) return l();
574
577
  if (E === "multi") {
575
- const f = n.getAll(d.doc), x = xt(e, f), L = n.getAll(d.maximized), [z] = L, F = L.length === 1 && z !== void 0 && x.includes(z) ? z : null, U = n.getAll(d.markup), I = x.filter((T) => U.includes(T)), xe = I.length === U.length && I.every((T, V) => T === U[V]);
576
- return D === null && s !== null && x.length === f.length && x.every((T, V) => T === f[V]) && (L.length === 0 || F !== null) && xe ? { kind: "location", location: { view: "multi", source: i, docs: x, maximized: F, markup: I } } : a({ view: "multi", source: i, docs: x, maximized: F, markup: I });
578
+ const f = n.getAll(d.doc), y = yt(e, f), D = n.getAll(d.maximized), [z] = D, F = D.length === 1 && z !== void 0 && y.includes(z) ? z : null, U = n.getAll(d.markup), _ = y.filter((T) => U.includes(T)), xe = _.length === U.length && _.every((T, V) => T === U[V]);
579
+ return L === null && s !== null && y.length === f.length && y.every((T, V) => T === f[V]) && (D.length === 0 || F !== null) && xe ? { kind: "location", location: { view: "multi", source: i, docs: y, maximized: F, markup: _ } } : a({ view: "multi", source: i, docs: y, maximized: F, markup: _ });
577
580
  }
578
- const _ = D === null ? null : ht(D), u = _?.endsWith(j) === !0 ? _.slice(0, -j.length) : null, g = _ !== null && u === null ? _ : null;
579
- if (g !== null && !$(g) || u !== null && !$(u)) return l();
580
- const O = pt(e, n), k = (g !== null || u !== null) && n.get(d.markup) === ge;
581
+ const I = L === null ? null : Et(L), u = I?.endsWith(j) === !0 ? I.slice(0, -j.length) : null, g = I !== null && u === null ? I : null;
582
+ if (g !== null && !A(g) || u !== null && !A(u)) return l();
583
+ const O = St(e, n), k = (g !== null || u !== null) && n.get(d.markup) === ge;
581
584
  if (E === "single") {
582
585
  if (u !== null) return a({ view: "tree", source: i, doc: null, folder: u, overrides: O, markup: k });
583
586
  if (g === null) return l();
584
- const f = St(n);
587
+ const f = xt(n);
585
588
  return s === null ? a({ view: E, source: i, doc: g, overrides: O, embed: f, markup: k }) : { kind: "location", location: { view: E, source: i, doc: g, overrides: O, embed: f, markup: k } };
586
589
  }
587
590
  return s === null ? a({ view: E, source: i, doc: g, folder: u, overrides: O, markup: k }) : { kind: "location", location: { view: E, source: i, doc: g, folder: u, overrides: O, markup: k } };
588
591
  };
589
592
  export {
590
- nt as $,
593
+ rt as $,
591
594
  ue as A,
592
595
  Gt as B,
593
- Kt as C,
594
- Bt as D,
595
- nn as E,
596
- Ht as F,
597
- Wt as G,
598
- tn as H,
599
- cn as I,
600
- Ct as J,
601
- rn as K,
602
- h as L,
603
- At as M,
596
+ qt as C,
597
+ Wt as D,
598
+ on as E,
599
+ Yt as F,
600
+ Xt as G,
601
+ rn as H,
602
+ dn as I,
603
+ Mt as J,
604
+ sn as K,
605
+ Ht as L,
606
+ h as M,
604
607
  P as N,
605
- Ut as O,
606
- qt as P,
607
- Dt as Q,
608
- Ft as R,
609
- en as S,
610
- Vt as T,
611
- te as U,
612
- zt as V,
613
- mn as W,
614
- Zt as X,
615
- ee as Y,
616
- se as Z,
617
- rt as _,
608
+ Pt as O,
609
+ Zt as P,
610
+ Vt as Q,
611
+ Dt as R,
612
+ nn as S,
613
+ Ut as T,
614
+ Bt as U,
615
+ te as V,
616
+ Ft as W,
617
+ un as X,
618
+ en as Y,
619
+ ee as Z,
620
+ se as _,
618
621
  We as a,
619
- Ue as a0,
620
- tt as a1,
621
- et as a2,
622
- ot as a3,
623
- st as a4,
624
- gt as a5,
625
- Xt as b,
626
- xt as c,
627
- an as d,
628
- Tt as e,
629
- jt as f,
630
- gn as g,
631
- wn as h,
632
- wt as i,
633
- ln as j,
622
+ nt as a0,
623
+ Ue as a1,
624
+ tt as a2,
625
+ et as a3,
626
+ ot as a4,
627
+ st as a5,
628
+ it as a6,
629
+ wt as a7,
630
+ Kt as b,
631
+ yt as c,
632
+ ln as d,
633
+ Rt as e,
634
+ Ct as f,
635
+ hn as g,
636
+ En as h,
637
+ ht as i,
638
+ mn as j,
634
639
  R as k,
635
640
  de as l,
636
- Pt as m,
637
- sn as n,
638
- on as o,
639
- dn as p,
640
- Yt as q,
641
- fn as r,
642
- Je as s,
643
- vt as t,
641
+ vt as m,
642
+ cn as n,
643
+ an as o,
644
+ fn as p,
645
+ Qt as q,
646
+ gn as r,
647
+ Be as s,
648
+ jt as t,
644
649
  Jt as u,
645
- Lt as v,
646
- un as w,
647
- Mt as x,
648
- Qt as y,
649
- Be as z
650
+ zt as v,
651
+ wn as w,
652
+ Lt as x,
653
+ tn as y,
654
+ Ge as z
650
655
  };