@aiquants/markdown-explorer 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +12 -5
  3. package/dist/{EditSurface-B1yD7ywF.cjs → EditSurface-B9IpZlBX.cjs} +2 -2
  4. package/dist/{EditSurface-sUNqYw9o.js → EditSurface-BrdChI9n.js} +54 -54
  5. package/dist/{ExplorerSplit-pClUl3-e.js → ExplorerSplit-B-fr2nlU.js} +99 -99
  6. package/dist/{ExplorerSplit-Bn3ZnEMZ.cjs → ExplorerSplit-B99KbYXc.cjs} +1 -1
  7. package/dist/MultiLayout-BZ0zTAoi.cjs +1 -0
  8. package/dist/{MultiLayout-B-ft4_Vs.js → MultiLayout-Pf-6yPif.js} +167 -168
  9. package/dist/NativeScrollBar-Bj5_LmwY.cjs +1 -0
  10. package/dist/{NativeScrollBar-ByawerpG.js → NativeScrollBar-ybJw3OHE.js} +6 -7
  11. package/dist/{TreeLayout-DjIVKBG4.js → TreeLayout-C4l591Nc.js} +9 -9
  12. package/dist/{TreeLayout-CXHbKdxy.cjs → TreeLayout-CblPMzQi.cjs} +1 -1
  13. package/dist/index-CnX313Ss.cjs +15 -0
  14. package/dist/{index-BNAkC0g3.js → index-awodBw8r.js} +1054 -1021
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.js +10 -10
  17. package/dist/{location-BNFdxzhn.js → location-CKuabtKl.js} +83 -82
  18. package/dist/location-l_HysaZR.cjs +1 -0
  19. package/dist/{merge-BBU1pDoT.cjs → merge-DffWW96L.cjs} +1 -1
  20. package/dist/{merge-DhHzRcAI.js → merge-qfptirid.js} +1 -1
  21. package/dist/server.cjs +1 -1
  22. package/dist/server.js +2 -2
  23. package/dist/styles/markdown-explorer.css +1 -1
  24. package/dist/tapScrollCircle-CDBXEKvI.cjs +1 -0
  25. package/dist/tapScrollCircle-DYmzWI-8.js +12 -0
  26. package/dist/{useSplitPersistence-xGOSwpLM.cjs → useSplitPersistence-9Nu6J1WF.cjs} +1 -1
  27. package/dist/{useSplitPersistence-D5EjJwCg.js → useSplitPersistence-Bf4M35Il.js} +1 -1
  28. package/docs/behavior/layout.md +6 -2
  29. package/package.json +5 -5
  30. package/dist/MultiLayout-0Jh08fxo.cjs +0 -1
  31. package/dist/NativeScrollBar-D9QrjRJa.cjs +0 -1
  32. package/dist/index-DRMNpWDJ.cjs +0 -15
  33. package/dist/location-yvU5HUY1.cjs +0 -1
  34. package/dist/scrollBarGeometry-C46jBtmM.cjs +0 -1
  35. package/dist/scrollBarGeometry-DOBdGNV-.js +0 -4
  36. package/dist/tapScrollCircle-C5DGI-0H.cjs +0 -1
  37. package/dist/tapScrollCircle-u4EXeLhx.js +0 -6
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-DRMNpWDJ.cjs"),e=require("./storage-DM0EvkVf.cjs"),E=require("./location-yvU5HUY1.cjs"),_=require("./dataRoute-DwYtgyt6.cjs");exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=L.DEFAULT_MARKDOWN_EXPLORER_LOCALE;exports.EXPLORER_THEMES=L.EXPLORER_THEMES;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=L.MARKDOWN_EXPLORER_LABEL_CATALOGS;exports.MARKDOWN_EXPLORER_LABEL_KEYS=L.MARKDOWN_EXPLORER_LABEL_KEYS;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=L.MARKDOWN_EXPLORER_LABEL_TEMPLATES;exports.MARKDOWN_EXPLORER_LOCALES=L.MARKDOWN_EXPLORER_LOCALES;exports.MarkdownExplorer=L.MarkdownExplorer;exports.resolveMarkdownExplorerLabels=L.resolveMarkdownExplorerLabels;exports.shouldRevalidateExplorer=L.shouldRevalidateExplorer;exports.clearExplorerStorage=e.clearExplorerStorage;exports.COLUMN_MIN_MEASURE=E.COLUMN_MIN_MEASURE;exports.DEFAULT_TREE_SETTINGS=E.DEFAULT_TREE_SETTINGS;exports.DEFAULT_VIEW_SLUGS=E.DEFAULT_VIEW_SLUGS;exports.EXPAND_ALL_DEPTH_LIMITS=E.EXPAND_ALL_DEPTH_LIMITS;exports.EXPAND_ALL_FOLDER_LIMITS=E.EXPAND_ALL_FOLDER_LIMITS;exports.EXPLORER_DEFAULT_PERCENT=E.EXPLORER_DEFAULT_PERCENT;exports.EXPLORER_MAX_PERCENT=E.EXPLORER_MAX_PERCENT;exports.EXPLORER_MIN_REM=E.EXPLORER_MIN_REM;exports.EXPLORER_MULTI_DEFAULT_PERCENT=E.EXPLORER_MULTI_DEFAULT_PERCENT;exports.GOLDEN_RATIO=E.GOLDEN_RATIO;exports.MULTI_VIEW_COLUMN_LIMITS=E.MULTI_VIEW_COLUMN_LIMITS;exports.MULTI_VIEW_PANEL_LIMITS=E.MULTI_VIEW_PANEL_LIMITS;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=E.REVEAL_DOCUMENT_DEPTH_LIMITS;exports.SPREADSHEET_BYTE_LIMITS=E.SPREADSHEET_BYTE_LIMITS;exports.WORKBOOK_BYTE_LIMITS=E.WORKBOOK_BYTE_LIMITS;exports.defineExplorerConfig=E.defineExplorerConfig;exports.explorerHref=E.explorerHref;exports.isExplorerSourceId=E.isExplorerSourceId;exports.resolveExplorerLocation=E.resolveExplorerLocation;exports.withExplorerSources=E.withExplorerSources;exports.DEFAULT_DENIED_PATH_SEGMENTS=_.DEFAULT_DENIED_PATH_SEGMENTS;exports.EXPLORER_EDIT_TOKEN_MAX_LENGTH=_.EXPLORER_EDIT_TOKEN_MAX_LENGTH;exports.EXPLORER_FAILURE_REASONS=_.EXPLORER_FAILURE_REASONS;exports.EXPLORER_MAX_HEADINGS=_.EXPLORER_MAX_HEADINGS;exports.MAX_DOCUMENT_PATH_LENGTH=_.MAX_DOCUMENT_PATH_LENGTH;exports.failureDocument=_.failureDocument;exports.failureOf=_.failureOf;exports.isAcceptableDocumentPath=_.isAcceptableDocumentPath;exports.isDeniedPath=_.isDeniedPath;exports.isExplorerChildrenResult=_.isExplorerChildrenResult;exports.isExplorerFailureCode=_.isExplorerFailureCode;exports.isExplorerFailureReason=_.isExplorerFailureReason;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-CnX313Ss.cjs"),e=require("./storage-DM0EvkVf.cjs"),E=require("./location-l_HysaZR.cjs"),_=require("./dataRoute-DwYtgyt6.cjs");exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=L.DEFAULT_MARKDOWN_EXPLORER_LOCALE;exports.EXPLORER_THEMES=L.EXPLORER_THEMES;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=L.MARKDOWN_EXPLORER_LABEL_CATALOGS;exports.MARKDOWN_EXPLORER_LABEL_KEYS=L.MARKDOWN_EXPLORER_LABEL_KEYS;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=L.MARKDOWN_EXPLORER_LABEL_TEMPLATES;exports.MARKDOWN_EXPLORER_LOCALES=L.MARKDOWN_EXPLORER_LOCALES;exports.MarkdownExplorer=L.MarkdownExplorer;exports.resolveMarkdownExplorerLabels=L.resolveMarkdownExplorerLabels;exports.shouldRevalidateExplorer=L.shouldRevalidateExplorer;exports.clearExplorerStorage=e.clearExplorerStorage;exports.COLUMN_MIN_MEASURE=E.COLUMN_MIN_MEASURE;exports.DEFAULT_TREE_SETTINGS=E.DEFAULT_TREE_SETTINGS;exports.DEFAULT_VIEW_SLUGS=E.DEFAULT_VIEW_SLUGS;exports.EXPAND_ALL_DEPTH_LIMITS=E.EXPAND_ALL_DEPTH_LIMITS;exports.EXPAND_ALL_FOLDER_LIMITS=E.EXPAND_ALL_FOLDER_LIMITS;exports.EXPLORER_DEFAULT_PERCENT=E.EXPLORER_DEFAULT_PERCENT;exports.EXPLORER_MAX_PERCENT=E.EXPLORER_MAX_PERCENT;exports.EXPLORER_MIN_REM=E.EXPLORER_MIN_REM;exports.EXPLORER_MULTI_DEFAULT_PERCENT=E.EXPLORER_MULTI_DEFAULT_PERCENT;exports.GOLDEN_RATIO=E.GOLDEN_RATIO;exports.MULTI_VIEW_COLUMN_LIMITS=E.MULTI_VIEW_COLUMN_LIMITS;exports.MULTI_VIEW_PANEL_LIMITS=E.MULTI_VIEW_PANEL_LIMITS;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=E.REVEAL_DOCUMENT_DEPTH_LIMITS;exports.SPREADSHEET_BYTE_LIMITS=E.SPREADSHEET_BYTE_LIMITS;exports.WORKBOOK_BYTE_LIMITS=E.WORKBOOK_BYTE_LIMITS;exports.defineExplorerConfig=E.defineExplorerConfig;exports.explorerHref=E.explorerHref;exports.isExplorerSourceId=E.isExplorerSourceId;exports.resolveExplorerLocation=E.resolveExplorerLocation;exports.withExplorerSources=E.withExplorerSources;exports.DEFAULT_DENIED_PATH_SEGMENTS=_.DEFAULT_DENIED_PATH_SEGMENTS;exports.EXPLORER_EDIT_TOKEN_MAX_LENGTH=_.EXPLORER_EDIT_TOKEN_MAX_LENGTH;exports.EXPLORER_FAILURE_REASONS=_.EXPLORER_FAILURE_REASONS;exports.EXPLORER_MAX_HEADINGS=_.EXPLORER_MAX_HEADINGS;exports.MAX_DOCUMENT_PATH_LENGTH=_.MAX_DOCUMENT_PATH_LENGTH;exports.failureDocument=_.failureDocument;exports.failureOf=_.failureOf;exports.isAcceptableDocumentPath=_.isAcceptableDocumentPath;exports.isDeniedPath=_.isDeniedPath;exports.isExplorerChildrenResult=_.isExplorerChildrenResult;exports.isExplorerFailureCode=_.isExplorerFailureCode;exports.isExplorerFailureReason=_.isExplorerFailureReason;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { X as _, Y as L, Z as s, _ as R, $ as e, a0 as r, a1 as T, a2 as A, a3 as o } from "./index-BNAkC0g3.js";
2
- import { c as M } from "./storage-CmGHg7OA.js";
3
- import { X as D, Y as P, Z as S, _ as N, $ as l, B as X, A as i, a0 as p, D as x, L as U, a1 as t, a2 as C, a3 as f, a4 as F, a5 as c, a6 as n, e as u, i as H, h as d, w as G } from "./location-BNFdxzhn.js";
4
- import { F as W, Y as B, Z as h, E as m, M as Y, B as w, f as V, i as b, G as v, Q as Z, c as g, b as k } from "./dataRoute-DLhQfdoW.js";
1
+ import { a0 as _, a1 as L, a2 as s, a3 as R, a4 as e, a5 as r, a6 as T, a7 as A, a8 as o } from "./index-awodBw8r.js";
2
+ import { c as O } from "./storage-CmGHg7OA.js";
3
+ import { Y as D, Z as P, _ as S, $ as N, a0 as l, B as i, A as X, a1 as p, D as x, M as U, a2 as t, a3 as C, a4 as f, a5 as F, a6 as c, a7 as n, e as u, i as H, h as d, w as G } from "./location-CKuabtKl.js";
4
+ import { F as W, Y as B, Z as h, E as m, M as Y, B as w, f as V, i as b, G as v, Q as g, c as k, b as Z } from "./dataRoute-DLhQfdoW.js";
5
5
  export {
6
6
  D as COLUMN_MIN_MEASURE,
7
7
  W as DEFAULT_DENIED_PATH_SEGMENTS,
@@ -10,11 +10,11 @@ export {
10
10
  S as DEFAULT_VIEW_SLUGS,
11
11
  N as EXPAND_ALL_DEPTH_LIMITS,
12
12
  l as EXPAND_ALL_FOLDER_LIMITS,
13
- X as EXPLORER_DEFAULT_PERCENT,
13
+ i as EXPLORER_DEFAULT_PERCENT,
14
14
  B as EXPLORER_EDIT_TOKEN_MAX_LENGTH,
15
15
  h as EXPLORER_FAILURE_REASONS,
16
16
  m as EXPLORER_MAX_HEADINGS,
17
- i as EXPLORER_MAX_PERCENT,
17
+ X as EXPLORER_MAX_PERCENT,
18
18
  p as EXPLORER_MIN_REM,
19
19
  x as EXPLORER_MULTI_DEFAULT_PERCENT,
20
20
  L as EXPLORER_THEMES,
@@ -30,16 +30,16 @@ export {
30
30
  f as REVEAL_DOCUMENT_DEPTH_LIMITS,
31
31
  F as SPREADSHEET_BYTE_LIMITS,
32
32
  c as WORKBOOK_BYTE_LIMITS,
33
- M as clearExplorerStorage,
33
+ O as clearExplorerStorage,
34
34
  n as defineExplorerConfig,
35
35
  u as explorerHref,
36
36
  w as failureDocument,
37
37
  V as failureOf,
38
38
  b as isAcceptableDocumentPath,
39
39
  v as isDeniedPath,
40
- Z as isExplorerChildrenResult,
41
- g as isExplorerFailureCode,
42
- k as isExplorerFailureReason,
40
+ g as isExplorerChildrenResult,
41
+ k as isExplorerFailureCode,
42
+ Z as isExplorerFailureReason,
43
43
  H as isExplorerSourceId,
44
44
  d as resolveExplorerLocation,
45
45
  A as resolveMarkdownExplorerLabels,
@@ -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-DLhQfdoW.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,7 +74,7 @@ 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] };
77
+ return s !== void 0 ? { body: e.subarray(e.length), encodings: [s.encoding] } : { body: e, encodings: r === null ? [$] : [$, r] };
78
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 });
@@ -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, Wt = 100 / h ** 3, Gt = 100 / h ** 4, ue = 100 / h ** 2, Ue = 13, Xt = 16, Kt = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), Ve = Object.freeze([89, 144, 233, 377]), Be = 44, Ht = Be, qt = 24, Yt = 1 / h, Zt = 1 / h ** 3, Qt = "40ch", Je = (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
- }, We = (e) => (Je(e), Ue * e), en = (e) => We(e) * h ** 2, tn = 233, nn = 50, Ge = 100 / h ** 3, rn = 100 - Ge, on = 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
- }, sn = (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
- }, an = (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
- }, cn = (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
254
  }, B = (e, t, n) => Math.max(t, Math.min(e, n)), re = (e, t, n, r) => {
255
255
  const o = (B(e, 0, n) + B(t, 0, n)) / 2;
256
256
  return B(o - r / 2, 0, n - r);
257
- }, ln = (e, t, n) => {
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
- }, dn = (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
- }, mn = (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,7 +297,7 @@ const R = (e) => {
297
297
  ...e.align === void 0 ? {} : { align: e.align }
298
298
  })
299
299
  );
300
- }, fn = (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) => {
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
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)}`);
@@ -345,7 +345,7 @@ 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)}`);
@@ -423,7 +423,7 @@ const R = (e) => {
423
423
  maxWorkbookBytes: S("spreadsheets.maxWorkbookBytes", i.maxWorkbookBytes, it)
424
424
  })
425
425
  });
426
- }, un = (e) => {
426
+ }, gn = (e) => {
427
427
  const t = e.embeds;
428
428
  if (!R(t)) throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${m(t)}`);
429
429
  if (Object.hasOwn(t, "linkCards"))
@@ -438,37 +438,37 @@ const R = (e) => {
438
438
  throw new RangeError(`[markdown-explorer] config.legacyTextEncoding must be ${m(s.legacyTextEncoding)} (the written name of the encoding it names); got ${m(n)}`);
439
439
  const i = e;
440
440
  for (const [a, l] of Object.entries(s)) {
441
- const c = W(i[a], l, a);
441
+ const c = G(i[a], l, a);
442
442
  if (c !== null)
443
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)}`);
444
444
  }
445
445
  return s;
446
- }, W = (e, t, n) => {
446
+ }, G = (e, t, n) => {
447
447
  if (Object.is(e, t)) return null;
448
448
  if (Array.isArray(t)) {
449
449
  if (!Array.isArray(e)) return { kind: "value", path: n, given: e, resolved: t };
450
450
  if (e.length !== t.length) return { kind: "value", path: `${n}.length`, given: e.length, resolved: t.length };
451
451
  for (const [o, s] of t.entries()) {
452
- const i = W(e[o], s, `${n}[${String(o)}]`);
452
+ const i = G(e[o], s, `${n}[${String(o)}]`);
453
453
  if (i !== null) return i;
454
454
  }
455
455
  return null;
456
456
  }
457
457
  if (!(R(t) && R(e))) return { kind: "value", path: n, given: e, resolved: t };
458
458
  for (const o of Object.keys(t)) {
459
- const s = W(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}`);
460
460
  if (s !== null) return s;
461
461
  }
462
462
  const r = Object.keys(e).find((o) => !Object.hasOwn(t, o));
463
463
  return r === void 0 ? null : { kind: "extra", path: `${n}.${r}`, given: e[r] };
464
- }, ht = (e) => typeof e == "string" && lt.test(e), gn = (e, t) => {
464
+ }, ht = (e) => typeof e == "string" && lt.test(e), wn = (e, t) => {
465
465
  if (e === null || typeof e != "object") throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${m(e)}`);
466
466
  if (!Array.isArray(t) || t.length === 0) throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${m(t)}`);
467
467
  for (const n of t)
468
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)}`);
469
469
  if (new Set(t).size !== t.length) throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);
470
470
  return Object.freeze({ ...e, sourceIds: Object.freeze([...t]) });
471
- }, wn = (e) => e.documentStyles.map((t) => t.name), d = Object.freeze({
471
+ }, hn = (e) => e.documentStyles.map((t) => t.name), d = Object.freeze({
472
472
  source: "source",
473
473
  doc: "doc",
474
474
  maximized: "maximized",
@@ -481,7 +481,7 @@ const R = (e) => {
481
481
  width: "width",
482
482
  maxWidth: "maxWidth",
483
483
  markup: "markup"
484
- }), ge = "true", j = "/", ce = ".data", we = 256, he = /^\d+(?:\.\d+)?$/u, G = /^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u, Ee = Object.freeze(["showToc", "showStyle", "showAlign"]), le = (e) => {
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) => {
485
485
  const t = encodeURIComponent(e.replaceAll("%", "%25"));
486
486
  return t.endsWith(ce) ? `${t.slice(0, -ce.length)}%2Edata` : t;
487
487
  }, Et = (e) => e.replaceAll("%25", "%"), pe = (e) => {
@@ -506,10 +506,10 @@ const R = (e) => {
506
506
  ...e.get(d.showStyle) === "false" ? { showStyle: !1 } : {},
507
507
  ...e.get(d.showAlign) === "false" ? { showAlign: !1 } : {},
508
508
  ...Se(n) ? { padding: n } : {},
509
- ...r !== null && G.test(r) ? { width: r } : {},
510
- ...o !== null && G.test(o) ? { maxWidth: o } : {}
509
+ ...r !== null && W.test(r) ? { width: r } : {},
510
+ ...o !== null && W.test(o) ? { maxWidth: o } : {}
511
511
  };
512
- }, yt = (e, t) => [...new Set(t.filter($))].slice(0, e.multiView.maxPanels), bt = (e, t, n, r) => {
512
+ }, yt = (e, t) => [...new Set(t.filter(A))].slice(0, e.multiView.maxPanels), bt = (e, t, n, r) => {
513
513
  for (const s of t) H(s);
514
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`);
515
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)}`);
@@ -518,7 +518,7 @@ const R = (e) => {
518
518
  const o = r.find((s) => !t.includes(s));
519
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))}`);
520
520
  }, H = (e) => {
521
- 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))}`);
522
522
  return e;
523
523
  }, Ot = (e) => {
524
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))}`);
@@ -534,7 +534,7 @@ const R = (e) => {
534
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)}`);
535
535
  for (const t of ["width", "maxWidth"]) {
536
536
  const n = e[t];
537
- if (n !== void 0 && !G.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)}`);
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)}`);
538
538
  }
539
539
  }, Rt = (e, t) => {
540
540
  const n = new URLSearchParams();
@@ -567,19 +567,19 @@ const R = (e) => {
567
567
  }
568
568
  const o = n.toString();
569
569
  return o === "" ? r : `${r}?${o}`;
570
- }, _t = (e, t) => Object.keys(e.views).find((n) => e.views[n] === t), hn = (e, t, n) => {
570
+ }, It = (e, t) => Object.keys(e.views).find((n) => e.views[n] === t), En = (e, t, n) => {
571
571
  const r = pe(e), [o] = r;
572
572
  if (o === void 0) throw new RangeError("[markdown-explorer] the configuration has no source");
573
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 });
574
574
  if (t === void 0 || t === "") return l();
575
- const c = t.indexOf("/"), M = c < 0 ? t : t.slice(0, c), L = c < 0 ? null : t.slice(c + 1), E = _t(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);
576
576
  if (E === void 0) return l();
577
577
  if (E === "multi") {
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), I = y.filter((T) => U.includes(T)), xe = I.length === U.length && I.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: I } } : a({ view: "multi", source: i, docs: y, 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: _ });
580
580
  }
581
- const _ = L === null ? null : Et(L), u = _?.endsWith(j) === !0 ? _.slice(0, -j.length) : null, g = _ !== null && u === null ? _ : null;
582
- if (g !== null && !$(g) || u !== null && !$(u)) return l();
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
583
  const O = St(e, n), k = (g !== null || u !== null) && n.get(d.markup) === ge;
584
584
  if (E === "single") {
585
585
  if (u !== null) return a({ view: "tree", source: i, doc: null, folder: u, overrides: O, markup: k });
@@ -590,65 +590,66 @@ const R = (e) => {
590
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 } };
591
591
  };
592
592
  export {
593
- nt as $,
593
+ rt as $,
594
594
  ue as A,
595
- Wt as B,
596
- Ht as C,
597
- Gt as D,
598
- rn as E,
599
- qt as F,
595
+ Gt as B,
596
+ qt as C,
597
+ Wt as D,
598
+ on as E,
599
+ Yt as F,
600
600
  Xt as G,
601
- nn as H,
602
- ln as I,
601
+ rn as H,
602
+ dn as I,
603
603
  Mt as J,
604
- on as K,
605
- h as L,
606
- Pt as M,
604
+ sn as K,
605
+ Ht as L,
606
+ h as M,
607
607
  P as N,
608
- Vt as O,
609
- Yt as P,
610
- Dt as Q,
611
- Ut as R,
612
- tn as S,
613
- Bt as T,
614
- te as U,
615
- Ft as V,
616
- fn as W,
617
- Qt as X,
618
- ee as Y,
619
- se as Z,
620
- rt as _,
621
- Ge as a,
622
- Ue as a0,
623
- tt as a1,
624
- et as a2,
625
- ot as a3,
626
- st as a4,
627
- it as a5,
628
- wt as a6,
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 _,
621
+ We as a,
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,
629
630
  Kt as b,
630
631
  yt as c,
631
- cn as d,
632
+ ln as d,
632
633
  Rt as e,
633
634
  Ct as f,
634
- wn as g,
635
- hn as h,
635
+ hn as g,
636
+ En as h,
636
637
  ht as i,
637
- dn as j,
638
+ mn as j,
638
639
  R as k,
639
640
  de as l,
640
641
  vt as m,
641
- an as n,
642
- sn as o,
643
- mn as p,
644
- Zt as q,
645
- un as r,
642
+ cn as n,
643
+ an as o,
644
+ fn as p,
645
+ Qt as q,
646
+ gn as r,
646
647
  Be as s,
647
648
  jt as t,
648
649
  Jt as u,
649
650
  zt as v,
650
- gn as w,
651
+ wn as w,
651
652
  Lt as x,
652
- en as y,
653
- We as z
653
+ tn as y,
654
+ Ge as z
654
655
  };
@@ -0,0 +1 @@
1
+ "use strict";const R=require("@aiquants/markdown/embeds"),k=require("@aiquants/markdown/viewer-settings"),N=require("./dataRoute-DwYtgyt6.cjs"),y=e=>{if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},ve=Object.freeze(["UTF-8","IBM866","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-8-I","ISO-8859-10","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","KOI8-R","KOI8-U","macintosh","windows-874","windows-1250","windows-1251","windows-1252","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-1258","x-mac-cyrillic","GBK","gb18030","Big5","EUC-JP","ISO-2022-JP","Shift_JIS","EUC-KR","replacement","UTF-16BE","UTF-16LE","x-user-defined"]),je=new Map(ve.map(e=>[e.toLowerCase(),e])),C="UTF-8",ne=Object.freeze([Object.freeze({bytes:Object.freeze([239,187,191]),encoding:C}),Object.freeze({bytes:Object.freeze([255,254]),encoding:"UTF-16LE"}),Object.freeze({bytes:Object.freeze([254,255]),encoding:"UTF-16BE"})]),ze=new Map([[C,"is read before any legacy encoding"],["UTF-16LE","is read only by its byte order mark"],["UTF-16BE","is read only by its byte order mark"],["ISO-2022-JP","writes only bytes below 0x80, which UTF-8 always reads first, so it would never be used"],["x-user-defined","is no text encoding (it maps bytes to private-use characters)"]]),Y=e=>{let t;try{t=new TextDecoder(e).encoding}catch(o){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}const n=Fe(t),r=ze.get(n);if(r!==void 0)throw new RangeError(`[markdown-explorer] legacyTextEncoding ${JSON.stringify(e)} names ${n}, which cannot be the legacy encoding: it ${r}`);return n},Fe=e=>{const t=je.get(e);if(t===void 0)throw new RangeError(`[markdown-explorer] TextDecoder answered ${JSON.stringify(e)}, which is no encoding of the WHATWG Encoding Standard`);return t},D=(e,t,n)=>{const r=n===null?null:Y(n),o=ne.find(({bytes:s})=>s.every((a,l)=>e[l]===a));if(o!==void 0)return{body:e.subarray(o.bytes.length),encodings:[o.encoding]};const i=t||e.length===0?void 0:ne.find(({bytes:s})=>e.length<s.length&&e.every((a,l)=>s[l]===a));return i!==void 0?{body:e.subarray(e.length),encodings:[i.encoding]}:{body:e,encodings:r===null?[C]:[C,r]}},Ue=(e,t,n)=>D(e,t,n).encodings,Ve=(e,t,n)=>{try{return new TextDecoder(e,{fatal:!0,ignoreBOM:!0}).decode(t,{stream:!n})}catch(r){if(r instanceof TypeError)return null;throw r}},Ge=(e,t,n)=>{const r=Z(D(e,t,n),t);return r===null?null:r.text},Z=({body:e,encodings:t},n)=>{for(const r of t){const o=Ve(r,e,n);if(o!==null)return{encoding:r,text:o}}return null},Be=(e,t,n)=>{const r=D(e,t,n),o=Z(r,t);return o===null?r.encodings[0]:o.encoding},Xe=(e,t,n)=>{const r=D(e,t,n),o=Z(r,t);return o!==null?o.text:new TextDecoder(r.encodings[0],{ignoreBOM:!0}).decode(r.body,{stream:!t})},A=new Intl.Collator("en",{numeric:!0,sensitivity:"variant"}),We=/^readme(?:\.|$)/iu,re=/^readme(?:\.[^.]*)?$/iu,oe=Object.freeze(["md","markdown","mdx","txt",""]),Je=e=>We.test(e),X=e=>e.type==="file"&&Je(e.name),ie=e=>{const t=e.lastIndexOf("."),n=oe.indexOf(t<0?"":e.slice(t+1).toLowerCase());return n<0?oe.length:n},Ke=(e,t)=>{const n=+!re.test(e.name)-+!re.test(t.name);if(n!==0)return n;const r=ie(e.name)-ie(t.name);if(r!==0)return r;const o=A.compare(e.name,t.name);return o!==0?o:A.compare(e.path,t.path)},He=e=>{let t=null;for(const n of e)X(n)&&(t===null||Ke(n,t)<0)&&(t=n);return t===null?null:t.path},W=Object.freeze({sortMode:"native",folderPlacement:"mixed",readmePlacement:"mixed",selectionMode:"single",doubleClickAction:"recursive",expandIconSize:8,alwaysExpanded:!1,revealDocument:!1,removeRootIndent:!1,lines:!0,expandIcons:!0,directoryIcons:!0,fileIcons:!0}),qe=[!0,!1],Ye=(e,t)=>t?e.settingOn:e.settingOff,S=(e,t)=>({key:e,labelKey:t,values:qe,formatValue:Ye,requiresItemSelection:!1}),Ze=Object.freeze({native:e=>e.sortNative,asc:e=>e.sortAscending,desc:e=>e.sortDescending,oldest:e=>e.sortOldest,newest:e=>e.sortNewest}),T=Object.freeze([{key:"sortMode",labelKey:"settingSortMode",values:["native","asc","desc","oldest","newest"],formatValue:(e,t)=>Ze[t](e),requiresItemSelection:!1},{key:"folderPlacement",labelKey:"settingFolderPlacement",values:["mixed","first","last"],formatValue:(e,t)=>t==="mixed"?e.folderPlacementMixed:t==="first"?e.folderPlacementFirst:e.folderPlacementLast,requiresItemSelection:!1},{key:"readmePlacement",labelKey:"settingReadmePlacement",values:["mixed","first","last"],formatValue:(e,t)=>t==="mixed"?e.readmePlacementMixed:t==="first"?e.readmePlacementFirst:e.readmePlacementLast,requiresItemSelection:!1},{key:"selectionMode",labelKey:"settingSelectionMode",values:["single","multiple","none"],formatValue:(e,t)=>t==="single"?e.selectionSingle:t==="multiple"?e.selectionMultiple:e.selectionNone,requiresItemSelection:!0},{key:"doubleClickAction",labelKey:"settingDoubleClick",values:["recursive","toggle"],formatValue:(e,t)=>t==="recursive"?e.doubleClickRecursive:e.doubleClickToggle,requiresItemSelection:!1},{key:"expandIconSize",labelKey:"settingExpandIconSize",values:[8,13,5],formatValue:(e,t)=>e.expandIconSizeValue(t),requiresItemSelection:!1},S("alwaysExpanded","settingAlwaysExpanded"),S("revealDocument","settingRevealDocument"),S("removeRootIndent","settingRemoveRootIndent"),S("lines","settingTreeLines"),S("expandIcons","settingExpandIcons"),S("directoryIcons","settingDirectoryIcons"),S("fileIcons","settingFileIcons")]),Qe=e=>e?T:T.filter(t=>!t.requiresItemSelection),ue=e=>{const t=T.find(n=>n.key===e);if(t===void 0)throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);return t},et=(e,t)=>{const n=ue(t).values,r=n[(n.indexOf(e[t])+1)%n.length];return{...e,[t]:r}},tt=(e,t,n)=>ue(n).formatValue(e,t[n]),ge=2,J=Object.freeze({}),Q=(e,t)=>Object.freeze(Object.fromEntries(T.filter(n=>t(n,e[n.key])).map(n=>[n.key,e[n.key]]))),se="directoriesFirst",nt=e=>{if(!Object.hasOwn(e,se))return e;const{[se]:t,...n}=e;return Object.hasOwn(n,"folderPlacement")||typeof t!="boolean"?n:{...n,folderPlacement:t?"first":"mixed"}},rt=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return J;const t=e;return t.version!==ge||t.settings===null||typeof t.settings!="object"||Array.isArray(t.settings)?J:Q(nt(t.settings),(n,r)=>n.values.includes(r))},ot=(e,t)=>{const n=Q(t,(r,o)=>o!==void 0&&o!==e[r.key]);return Object.keys(n).length===0?e:Object.freeze({...e,...n})},it=(e,t,n,r)=>Q({...e,[t]:n},(o,i)=>i!==void 0&&!(o.key===t&&i===r[t])),st=e=>JSON.stringify({version:ge,settings:e}),at=(e,t,n)=>e===void 0||t===void 0?e===t?0:e===void 0?1:-1:n*(e-t),ct=e=>{const{sortMode:t,folderPlacement:n,readmePlacement:r}=e;if(t==="native"&&n==="mixed"&&r==="mixed")return;const o=(i,s)=>{const a=A.compare(i.name,s.name);return a!==0?a:A.compare(i.path,s.path)};return(i,s)=>{if(n!=="mixed"&&i.type!==s.type)return i.type==="directory"==(n==="first")?-1:1;if(r!=="mixed"){const l=X(i);if(l!==X(s))return l===(r==="first")?-1:1}if(t==="native")return 0;if(t==="asc")return o(i,s);if(t==="desc")return-o(i,s);const a=at(i.modifiedAt,s.modifiedAt,t==="oldest"?1:-1);return a!==0?a:o(i,s)}},u=(1+Math.sqrt(5))/2,lt=100/u**3,dt=100/u**4,ee=100/u**2,Ee=13,mt=16,ft=Object.freeze({gripThickness:5,gripLength:34,barThickness:2,barLength:21}),ut=Object.freeze([1,2,3,5,8,13,21,34,55]),gt=Object.freeze([89,144,233,377]),we=44,Et=we,wt=24,ht=1/u,St=1/u**3,pt="40ch",Ot=e=>{if(!Number.isFinite(e)||e<=0)throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`)},he=e=>(Ot(e),Ee*e),xt=e=>he(e)*u**2,yt=233,Tt=50,Se=100/u**3,bt=100-Se,_t=gt[0],w=(e,t)=>{if(!Number.isFinite(t)||t<0)throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`)},It=({trackInlineSize:e,gap:t,minColumnInlineSize:n,logicalColumns:r})=>{if(w("trackInlineSize",e),w("gap",t),!Number.isFinite(n)||n<=0)throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(n)}`);if(!Number.isInteger(r)||r<1)throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(r)}`);const o=Math.floor((e+t)/(n+t));return Math.min(r,Math.max(1,o))},Rt=(e,t)=>{const{trackInlineSize:n,gap:r,minColumnInlineSize:o,logicalColumns:i}=t;if(!([n,r,o].every(Number.isFinite)&&n>0&&r>=0&&o>0))return e;const a=It(t);if(e===null||a===e)return a;const l=Math.min(i,Math.max(1,e));if(a>l){const v=(l+1)*o+l*r+r/u;return n>=v?a:l}return n>=l*o+(l-1)*r?l:a},kt=(e,t)=>{if(!(Number.isInteger(e)&&Number.isInteger(t))||t<1||t>e)throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);return Array.from({length:t},(n,r)=>[Math.floor(r*e/t),Math.floor((r+1)*e/t)])},Nt=(e,t,n)=>{if(w("surfaceInlineSize",e),w("handlePixels",n),!Number.isFinite(t)||t<=0)throw new RangeError(`[markdown-explorer] measure must be a finite number > 0; got ${String(t)}`);return e>=2*t+n?"beside":"stacked"},B=(e,t,n)=>Math.max(t,Math.min(e,n)),ae=(e,t,n,r)=>{const o=(B(e,0,n)+B(t,0,n))/2;return B(o-r/2,0,n-r)},At=(e,t,n)=>{for(const[r,o]of Object.entries(e))if(!Number.isFinite(o))throw new RangeError(`[markdown-explorer] anchor.${r} must be a finite number; got ${String(o)}`);return w("marginBox.width",t.width),w("marginBox.height",t.height),w("viewport.width",n.width),w("viewport.height",n.height),{left:ae(e.left,e.right,n.width,t.width),top:ae(e.top,e.bottom,n.height,t.height)}},Pt=31536e3,Lt=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u,Ct=e=>{if(typeof e!="string"||!Lt.test(e))throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`)},ce=e=>typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=ee,$t=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))return{};const n=e,{treeExplorer:r,multiExplorer:o,style:i,align:s}=n;return{...ce(r)?{treeExplorer:r}:{},...ce(o)?{multiExplorer:o}:{},...typeof i=="string"&&t.includes(i)?{style:i}:{},...typeof s=="string"&&k.CONTENT_ALIGNS.includes(s)?{align:s}:{}}},Mt=(e,t)=>{if(e!==null)for(const n of e.split(";")){const r=n.indexOf("=");if(!(r<0)&&n.slice(0,r).trim()===t)return n.slice(r+1).trim()}},Dt=(e,t)=>{if(e===void 0||e==="")return{};try{return $t(JSON.parse(decodeURIComponent(e)),t)}catch{return{}}},$=100,vt=Math.floor(ee*$)/$,jt=e=>{const t=n=>Math.min(vt,Math.max(1,Math.round(n*$))/$);return encodeURIComponent(JSON.stringify({...e.treeExplorer===void 0?{}:{treeExplorer:t(e.treeExplorer)},...e.multiExplorer===void 0?{}:{multiExplorer:t(e.multiExplorer)},...e.style===void 0?{}:{style:e.style},...e.align===void 0?{}:{align:e.align}}))},zt=(e,t,n)=>`${e}=${jt(t)}; Path=/; Max-Age=${String(Pt)}; SameSite=Lax${n?"; Secure":""}`,K=Object.freeze({tree:"tree",multi:"multi",single:"single"}),pe=Object.freeze({default:12,min:1,max:64}),Oe=Object.freeze({default:4,min:1,max:6}),xe=Object.freeze({default:500,min:1,max:1e4}),ye=Object.freeze({default:16,min:1,max:64}),Te=Object.freeze({default:16,min:1,max:64}),be=Object.freeze({default:2*1024*1024,min:1,max:256*1024*1024}),_e=Object.freeze({default:8*1024*1024,min:1,max:256*1024*1024}),Ft=/^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u,Ut=/^[A-Za-z0-9][A-Za-z0-9_-]*$/u,Vt=/^[a-z0-9][a-z0-9-]*$/u,Gt=/^(?=.{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,le=(e,t)=>{if(typeof t!="string")throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);if(!Ft.test(t)||t.split("/").some(n=>n==="."||n===".."))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)}`)},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"?y(e)?"a plain object":`a non-plain object (${Object.prototype.toString.call(e)})`:String(e),de=Object.freeze(Object.keys({basePath:!0,dataPath:!0,settingsCookie:!0,views:!0,multiView:!0,expandAll:!0,revealDocument:!0,documentStyles:!0,iframeHosts:!0,embeds:!0,defaultTreeSettings:!0,legacyTextEncoding:!0,spreadsheets:!0})),O=(e,t,n)=>{if(t===void 0)return[];if(!y(t))throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${m(t)}`);const r=Object.entries(t);for(const[o]of r)if(!n.includes(o))throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${n.join(", ")}`);return r.filter(([,o])=>o!==void 0)},Bt=e=>{const t={...K};for(const[n,r]of O("views",e,Object.keys(K)))t[n]=r;for(const[n,r]of Object.entries(t))if(typeof r!="string"||!Ut.test(r))throw new RangeError(`[markdown-explorer] views.${n} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(r)}`);return Object.freeze(t)},p=(e,t,n)=>{if(t===void 0)return n.default;if(typeof t!="number"||!Number.isInteger(t)||t<n.min||t>n.max)throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(n.min)}..${String(n.max)}; got ${m(t)}`);return t},Xt=(e,t)=>{const n=new Map(O("embeds",e,["providers","linkCards","linkCardSize"]));if(n.size===0)return R.NO_EMBEDS;const r=n.has("providers")?n.get("providers"):[];if(!Array.isArray(r))throw new RangeError(`[markdown-explorer] embeds.providers must be an array of provider ids; got ${m(r)}`);for(const a of r)if(!R.isEmbedProviderId(a))throw new RangeError(`[markdown-explorer] embeds.providers must hold only ${R.EMBED_PROVIDER_IDS.join(", ")}; got ${m(a)}`);const o=n.has("linkCards")?n.get("linkCards"):!1;if(typeof o!="boolean")throw new RangeError(`[markdown-explorer] embeds.linkCards must be a boolean; got ${m(o)}`);const i={providers:Object.freeze([...new Set(r)]),linkCardEndpoint:o?N.explorerLinkCardEndpoint(t):null};if(!n.has("linkCardSize"))return Object.freeze(i);const s=n.get("linkCardSize");if(!R.isLinkCardSize(s))throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${R.LINK_CARD_SIZES.join(", ")}; got ${m(s)}`);if(!o)throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${m(s)} with linkCards ${m(o)}`);return Object.freeze({...i,linkCardSize:s})},Wt=e=>{if(e===void 0)return null;if(typeof e!="string")throw new TypeError(`[markdown-explorer] legacyTextEncoding must be a string; got ${m(e)}`);return Y(e)},Jt=e=>{const t=new Map(O("defaultTreeSettings",e,T.map(r=>r.key)));if(t.size===0)return W;const n={...W};for(const r of T){if(!t.has(r.key))continue;const o=t.get(r.key),i=r.values;if(!i.includes(o))throw new RangeError(`[markdown-explorer] defaultTreeSettings.${r.key} must be one of ${i.map(m).join(", ")}; got ${m(o)}`);n[r.key]=o}return Object.freeze(n)},Ie=e=>{if(e===null||typeof e!="object")throw new TypeError("[markdown-explorer] the explorer configuration must be an object");for(const c of Object.keys(e))if(!de.includes(c))throw new RangeError(`[markdown-explorer] ${c} is not an option of the explorer configuration; expected ${de.join(", ")}`);le("basePath",e.basePath),le("dataPath",e.dataPath);const t=Bt(e.views);if(new Set([t.tree,t.multi,t.single]).size!==3)throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);if(e.dataPath===e.basePath)throw new RangeError("[markdown-explorer] dataPath must differ from basePath");if(e.dataPath.startsWith(`${e.basePath}/`)){const c=e.dataPath.slice(e.basePath.length+1).split("/")[0];if(c===t.tree||c===t.multi||c===t.single)throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`)}Ct(e.settingsCookie);const n=e.iframeHosts??[];if(!Array.isArray(n)||n.some(c=>typeof c!="string"||!Gt.test(c)))throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(n)}`);const r=Object.fromEntries(O("multiView",e.multiView,["maxPanels","columns"])),o=Object.fromEntries(O("expandAll",e.expandAll,["maxFolders","maxDepth"])),i=Object.fromEntries(O("revealDocument",e.revealDocument,["maxDepth"])),s=Object.fromEntries(O("spreadsheets",e.spreadsheets,["maxBytes","maxWorkbookBytes"])),a=e.documentStyles??k.DEFAULT_MARKDOWN_STYLES;if(!Array.isArray(a)||a.length===0)throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");const l=new Set;for(const c of a){if(c===null||typeof c!="object"||typeof c.name!="string"||c.name.trim()===""||typeof c.className!="string")throw new RangeError("[markdown-explorer] each document style needs a non-blank name and a className string");if(l.has(c.name))throw new RangeError(`[markdown-explorer] document style names must be unique; ${JSON.stringify(c.name)} repeats`);l.add(c.name)}return Object.freeze({basePath:e.basePath,dataPath:e.dataPath,settingsCookie:e.settingsCookie,views:t,multiView:Object.freeze({maxPanels:p("multiView.maxPanels",r.maxPanels,pe),columns:p("multiView.columns",r.columns,Oe)}),expandAll:Object.freeze({maxFolders:p("expandAll.maxFolders",o.maxFolders,xe),maxDepth:p("expandAll.maxDepth",o.maxDepth,ye)}),revealDocument:Object.freeze({maxDepth:p("revealDocument.maxDepth",i.maxDepth,Te)}),documentStyles:Object.freeze(a.map(c=>Object.freeze({name:c.name,className:c.className}))),iframeHosts:Object.freeze([...new Set(n)]),embeds:Xt(e.embeds,e.dataPath),defaultTreeSettings:Jt(e.defaultTreeSettings),legacyTextEncoding:Wt(e.legacyTextEncoding),spreadsheets:Object.freeze({maxBytes:p("spreadsheets.maxBytes",s.maxBytes,be),maxWorkbookBytes:p("spreadsheets.maxWorkbookBytes",s.maxWorkbookBytes,_e)})})},Kt=e=>{const t=e.embeds;if(!y(t))throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${m(t)}`);if(Object.hasOwn(t,"linkCards"))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 ${m(t.linkCards)})`);const n=e.legacyTextEncoding;if(n!==null&&typeof n!="string")throw new TypeError(`[markdown-explorer] config.legacyTextEncoding must be the encoding defineExplorerConfig resolved, or null; got ${m(n)}`);const{linkCardEndpoint:r,...o}=t,i=Ie({...e,embeds:{...o,linkCards:r!==null},legacyTextEncoding:n===null?void 0:n});if(i.embeds.linkCardEndpoint!==r)throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${m(i.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${m(r)}`);if(i.legacyTextEncoding!==n)throw new RangeError(`[markdown-explorer] config.legacyTextEncoding must be ${m(i.legacyTextEncoding)} (the written name of the encoding it names); got ${m(n)}`);const s=e;for(const[a,l]of Object.entries(i)){const c=H(s[a],l,a);if(c!==null)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)}`)}return i},H=(e,t,n)=>{if(Object.is(e,t))return null;if(Array.isArray(t)){if(!Array.isArray(e))return{kind:"value",path:n,given:e,resolved:t};if(e.length!==t.length)return{kind:"value",path:`${n}.length`,given:e.length,resolved:t.length};for(const[o,i]of t.entries()){const s=H(e[o],i,`${n}[${String(o)}]`);if(s!==null)return s}return null}if(!(y(t)&&y(e)))return{kind:"value",path:n,given:e,resolved:t};for(const o of Object.keys(t)){const i=H(Object.hasOwn(e,o)?e[o]:void 0,t[o],`${n}.${o}`);if(i!==null)return i}const r=Object.keys(e).find(o=>!Object.hasOwn(t,o));return r===void 0?null:{kind:"extra",path:`${n}.${r}`,given:e[r]}},Re=e=>typeof e=="string"&&Vt.test(e),Ht=(e,t)=>{if(e===null||typeof e!="object")throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${m(e)}`);if(!Array.isArray(t)||t.length===0)throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${m(t)}`);for(const n of t)if(!Re(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)}`);if(new Set(t).size!==t.length)throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);return Object.freeze({...e,sourceIds:Object.freeze([...t])})},qt=e=>e.documentStyles.map(t=>t.name),d=Object.freeze({source:"source",doc:"doc",maximized:"maximized",style:"style",align:"align",showToc:"showToc",showStyle:"showStyle",showAlign:"showAlign",padding:"padding",width:"width",maxWidth:"maxWidth",markup:"markup"}),ke="true",M="/",me=".data",Ne=256,Ae=/^\d+(?:\.\d+)?$/u,q=/^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u,Pe=Object.freeze(["showToc","showStyle","showAlign"]),fe=e=>{const t=encodeURIComponent(e.replaceAll("%","%25"));return t.endsWith(me)?`${t.slice(0,-me.length)}%2Edata`:t},Yt=e=>e.replaceAll("%25","%"),Le=e=>{const{sourceIds:t}=e;if(t===void 0)throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");return t},Zt=(e,t,n)=>{const r=n.getAll(d.source);if(r.length===0)return t;const[o]=r;return r.length>1||o===void 0||o===t||!e.includes(o)?null:o},Qt=(e,t)=>{const n=t.get(d.style),r=t.get(d.align);return{...n!==null&&e.documentStyles.some(o=>o.name===n)?{style:n}:{},...r!==null&&k.CONTENT_ALIGNS.includes(r)?{align:r}:{}}},Ce=e=>Number.isFinite(e)&&e>=0&&e<=Ne&&Ae.test(String(e)),en=e=>{const t=e.get(d.padding),n=t!==null&&Ae.test(t)?Number(t):Number.NaN,r=e.get(d.width),o=e.get(d.maxWidth);return{...e.get(d.showToc)==="false"?{showToc:!1}:{},...e.get(d.showStyle)==="false"?{showStyle:!1}:{},...e.get(d.showAlign)==="false"?{showAlign:!1}:{},...Ce(n)?{padding:n}:{},...r!==null&&q.test(r)?{width:r}:{},...o!==null&&q.test(o)?{maxWidth:o}:{}}},$e=(e,t)=>[...new Set(t.filter(N.isAcceptableDocumentPath))].slice(0,e.multiView.maxPanels),tn=(e,t,n,r)=>{for(const i of t)te(i);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`);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)}`);if(n!==null&&!t.includes(n))throw new RangeError(`[markdown-explorer] the maximized document must be one of the open documents; got ${JSON.stringify(n.slice(0,80))}`);if(new Set(r).size!==r.length)throw new RangeError(`[markdown-explorer] the documents shown as written must each appear once; got ${String(r.length)} with repeats`);const o=r.find(i=>!t.includes(i));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))}`)},te=e=>{if(!N.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0,80))}`);return e},nn=e=>{if(te(e).endsWith(M))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))}`);return e},rn=(e,t)=>{if(t.style!==void 0&&!e.documentStyles.some(n=>n.name===t.style))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)}`);if(t.align!==void 0&&!k.CONTENT_ALIGNS.includes(t.align))throw new RangeError(`[markdown-explorer] overrides.align must be one of ${k.CONTENT_ALIGNS.join(", ")}; got ${JSON.stringify(t.align)}`)},on=e=>{for(const t of Pe)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])}`);if(e.padding!==void 0&&!Ce(e.padding))throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(Ne)} px in plain decimal digits; got ${String(e.padding)}`);for(const t of["width","maxWidth"]){const n=e[t];if(n!==void 0&&!q.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)}`)}},Me=(e,t)=>{const n=new URLSearchParams;let r=`${e.basePath}/${e.views[t.view]}`;if(t.view==="multi"){const i=t.docs??[],s=t.maximized??null,a=t.markup??[];tn(e,i,s,a);for(const l of i)n.append(d.doc,l);s!==null&&n.set(d.maximized,s);for(const l of i)a.includes(l)&&n.append(d.markup,l)}else{const i=t.doc??null,s=t.view==="tree"?t.folder??null:null;if(i!==null&&s!==null)throw new RangeError("[markdown-explorer] a tree view shows a document or a folder, not both");i!==null&&(r+=`/${fe(nn(i))}`),s!==null&&(r+=`/${fe(`${te(s)}${M}`)}`)}if(t.source!==void 0){const i=Le(e);if(!i.includes(t.source))throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${i.join(", ")}`);t.source!==i[0]&&n.set(d.source,t.source)}if(t.view!=="multi"&&t.overrides!==void 0&&(rn(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){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");n.set(d.markup,ke)}if(t.view==="single"&&t.embed!==void 0){const{embed:i}=t;on(i);for(const s of Pe)i[s]===!1&&n.set(d[s],"false");i.padding!==void 0&&n.set(d.padding,String(i.padding)),i.width!==void 0&&n.set(d.width,i.width),i.maxWidth!==void 0&&n.set(d.maxWidth,i.maxWidth)}const o=n.toString();return o===""?r:`${r}?${o}`},sn=(e,t)=>Object.keys(e.views).find(n=>e.views[n]===t),an=(e,t,n)=>{const r=Le(e),[o]=r;if(o===void 0)throw new RangeError("[markdown-explorer] the configuration has no source");const i=Zt(r,o,n),s=i===null?o:i,a=f=>({kind:"redirect",href:Me(e,f),location:f}),l=()=>a({view:"tree",source:s,doc:null,folder:null,overrides:{},markup:!1});if(t===void 0||t==="")return l();const c=t.indexOf("/"),v=c<0?t:t.slice(0,c),j=c<0?null:t.slice(c+1),h=sn(e,v);if(h===void 0)return l();if(h==="multi"){const f=n.getAll(d.doc),x=$e(e,f),z=n.getAll(d.maximized),[F]=z,U=z.length===1&&F!==void 0&&x.includes(F)?F:null,V=n.getAll(d.markup),L=x.filter(I=>V.includes(I)),De=L.length===V.length&&L.every((I,G)=>I===V[G]);return j===null&&i!==null&&x.length===f.length&&x.every((I,G)=>I===f[G])&&(z.length===0||U!==null)&&De?{kind:"location",location:{view:"multi",source:s,docs:x,maximized:U,markup:L}}:a({view:"multi",source:s,docs:x,maximized:U,markup:L})}const P=j===null?null:Yt(j),g=P?.endsWith(M)===!0?P.slice(0,-M.length):null,E=P!==null&&g===null?P:null;if(E!==null&&!N.isAcceptableDocumentPath(E)||g!==null&&!N.isAcceptableDocumentPath(g))return l();const b=Qt(e,n),_=(E!==null||g!==null)&&n.get(d.markup)===ke;if(h==="single"){if(g!==null)return a({view:"tree",source:s,doc:null,folder:g,overrides:b,markup:_});if(E===null)return l();const f=en(n);return i===null?a({view:h,source:s,doc:E,overrides:b,embed:f,markup:_}):{kind:"location",location:{view:h,source:s,doc:E,overrides:b,embed:f,markup:_}}}return i===null?a({view:h,source:s,doc:E,folder:g,overrides:b,markup:_}):{kind:"location",location:{view:h,source:s,doc:E,folder:g,overrides:b,markup:_}}};exports.ASSUMED_ROOT_FONT_PIXELS=mt;exports.COARSE_TARGET_PIXELS=Et;exports.COLUMN_MIN_MEASURE=pt;exports.CONTROL_BLOCK_PIXELS=we;exports.DEFAULT_TREE_SETTINGS=W;exports.DEFAULT_VIEW_SLUGS=K;exports.EDIT_SPLIT_DEFAULT_PERCENT=Tt;exports.EDIT_SPLIT_MAX_PERCENT=bt;exports.EDIT_SPLIT_MIN_PERCENT=Se;exports.EXPAND_ALL_DEPTH_LIMITS=ye;exports.EXPAND_ALL_FOLDER_LIMITS=xe;exports.EXPLORER_DEFAULT_PERCENT=lt;exports.EXPLORER_MAX_PERCENT=ee;exports.EXPLORER_MIN_REM=Ee;exports.EXPLORER_MULTI_DEFAULT_PERCENT=dt;exports.FIBONACCI_SPACING_PIXELS=ut;exports.FINE_TARGET_PIXELS=wt;exports.GOLDEN_RATIO=u;exports.MULTI_VIEW_COLUMN_LIMITS=Oe;exports.MULTI_VIEW_PANEL_LIMITS=pe;exports.NAME_COLLATOR=A;exports.NO_TREE_SETTING_CHANGES=J;exports.PANEL_MAX_BLOCK_RATIO=ht;exports.PANEL_MIN_BLOCK_RATIO=St;exports.PREFETCH_DWELL_MS=_t;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=Te;exports.SPLIT_HANDLE_PIXELS=ft;exports.SPLIT_PERSIST_DELAY_MS=yt;exports.SPREADSHEET_BYTE_LIMITS=be;exports.WORKBOOK_BYTE_LIMITS=_e;exports.advanceTreeSetting=et;exports.applyTreeSettingChanges=ot;exports.canonicalMultiDocuments=$e;exports.centeredDialogPosition=At;exports.columnGroups=kt;exports.createEntryComparator=ct;exports.decodeText=Ge;exports.decodeTextLeniently=Xe;exports.defineExplorerConfig=Ie;exports.documentStyleNames=qt;exports.editSplitOrientation=Nt;exports.explorerHref=Me;exports.explorerMinPixels=he;exports.explorerSheetBelowPixels=xt;exports.folderReadmeOf=He;exports.formatTreeSettingValue=tt;exports.isExplorerSourceId=Re;exports.isPlainObject=y;exports.legacyTextEncodingOf=Y;exports.parseViewSettings=Dt;exports.readCookieValue=Mt;exports.readTreeSettingChanges=rt;exports.recordTreeSettingChange=it;exports.replanVisibleColumns=Rt;exports.resolveExplorerLocation=an;exports.revalidateExplorerConfig=Kt;exports.serializeTreeSettingChanges=st;exports.textEncodingOf=Be;exports.textEncodingsOf=Ue;exports.viewSettingsCookieString=zt;exports.visibleTreeSettingDescriptors=Qe;exports.withExplorerSources=Ht;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-DRMNpWDJ.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(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-CnX313Ss.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
2
  `),n.split(`
3
3
  `),i.split(`
4
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(`
@@ -1,5 +1,5 @@
1
1
  import { diff3Merge as d } from "node-diff3";
2
- import { C, a as R, b as u } from "./index-BNAkC0g3.js";
2
+ import { C, a as R, b as u } from "./index-awodBw8r.js";
3
3
  const g = (n, o, e, l) => {
4
4
  if (o === n || o === e) return { kind: "clean", text: e };
5
5
  if (e === n) return { kind: "clean", text: o };