@aiquants/markdown-explorer 0.10.0 → 0.11.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 (38) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -1
  3. package/dist/{EditSurface-1Jf0CG-f.js → EditSurface-BK_Pz_LF.js} +1 -1
  4. package/dist/{EditSurface-B-l3Do_C.cjs → EditSurface-CfbYYXrc.cjs} +1 -1
  5. package/dist/ExplorerSplit-51frK8xf.cjs +1 -0
  6. package/dist/{ExplorerSplit-D0zf7Cr_.js → ExplorerSplit-DwlWWfRv.js} +216 -213
  7. package/dist/{MultiLayout-Bq10p3a3.cjs → MultiLayout-B4PtS45V.cjs} +1 -1
  8. package/dist/{MultiLayout-Jy9BKofx.js → MultiLayout-CeR_l6Rb.js} +4 -4
  9. package/dist/{NativeScrollBar-CyiyL47o.js → NativeScrollBar-CVWeTlHC.js} +1 -1
  10. package/dist/{NativeScrollBar-Dt6xH5Mb.cjs → NativeScrollBar-Dp4YWBp7.cjs} +1 -1
  11. package/dist/{TreeLayout-kVWFEKJD.cjs → TreeLayout-D-NyhuVM.cjs} +1 -1
  12. package/dist/{TreeLayout-8pRo1ANN.js → TreeLayout-min5AOhr.js} +3 -3
  13. package/dist/core/contracts.d.cts +1 -0
  14. package/dist/core/contracts.d.ts +1 -0
  15. package/dist/core/labels.d.cts +2 -0
  16. package/dist/core/labels.d.ts +2 -0
  17. package/dist/core/treeSettings.d.cts +2 -1
  18. package/dist/core/treeSettings.d.ts +2 -1
  19. package/dist/dataRoute-CIFFX5bd.cjs +1 -0
  20. package/dist/{dataRoute-Csl1WBDz.js → dataRoute-CU9CKP44.js} +54 -54
  21. package/dist/{index-CfcJEnrC.js → index-BPj19kIo.js} +10 -6
  22. package/dist/{index-sNJrKoGN.cjs → index-DJ_FUtYM.cjs} +4 -4
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +3 -3
  25. package/dist/{location-Dc1qNEGm.js → location-BT23fKeh.js} +123 -112
  26. package/dist/location-LNl0QOXI.cjs +1 -0
  27. package/dist/{merge-D0aGvFKC.cjs → merge-AnqxGn__.cjs} +1 -1
  28. package/dist/{merge-SRCxtHk2.js → merge-hyUGPGbJ.js} +1 -1
  29. package/dist/sanitizeWorker.cjs +1 -1
  30. package/dist/sanitizeWorker.js +1 -1
  31. package/dist/server.cjs +1 -1
  32. package/dist/server.js +548 -540
  33. package/docs/behavior/dom-hooks.md +1 -1
  34. package/docs/behavior/localization.md +1 -0
  35. package/package.json +1 -1
  36. package/dist/ExplorerSplit-WX8afxrQ.cjs +0 -1
  37. package/dist/dataRoute-8pyILcjL.cjs +0 -1
  38. package/dist/location-CRYkEWiC.cjs +0 -1
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-sNJrKoGN.cjs"),e=require("./storage-Dgi4JXaB.cjs"),E=require("./location-CRYkEWiC.cjs"),_=require("./dataRoute-8pyILcjL.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.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-DJ_FUtYM.cjs"),e=require("./storage-Dgi4JXaB.cjs"),E=require("./location-LNl0QOXI.cjs"),_=require("./dataRoute-CIFFX5bd.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.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 { z as a, B as L, M as s, G as e, H as r, J as R, K as A, N as T, O as o } from "./index-CfcJEnrC.js";
1
+ import { z as a, B as L, M as s, G as e, H as r, J as R, K as A, N as T, O as o } from "./index-BPj19kIo.js";
2
2
  import { c as O } from "./storage-BSthKLSG.js";
3
- import { J as N, K as P, L as l, M as I, O as S, q as i, o as X, Q as U, s as p, G as x, R as t, T as C, U as f, V as c, e as n, i as u, a as F, w as G } from "./location-Dc1qNEGm.js";
4
- import { D as K, U as d, V as W, E as m, M as V, y as h, f as B, i as w, B as b, K as v, c as g, b as k } from "./dataRoute-Csl1WBDz.js";
3
+ import { J as N, K as P, L as l, M as I, O as S, q as i, o as X, Q as U, s as p, G as x, R as t, T as C, U as f, V as c, e as n, i as u, a as F, w as G } from "./location-BT23fKeh.js";
4
+ import { D as K, U as d, V as W, E as m, M as V, y as h, f as B, i as w, B as b, K as v, c as g, b as k } from "./dataRoute-CU9CKP44.js";
5
5
  export {
6
6
  N as COLUMN_MIN_MEASURE,
7
7
  K as DEFAULT_DENIED_PATH_SEGMENTS,
@@ -1,6 +1,6 @@
1
1
  import { NO_EMBEDS as oe, isEmbedProviderId as se, EMBED_PROVIDER_IDS as ie, isLinkCardSize as ae, LINK_CARD_SIZES as le } from "@aiquants/markdown/embeds";
2
2
  import { CONTENT_ALIGNS as R, DEFAULT_MARKDOWN_STYLES as ce } from "@aiquants/markdown/viewer-settings";
3
- import { a as de, i as z } from "./dataRoute-Csl1WBDz.js";
3
+ import { a as de, i as z } from "./dataRoute-CU9CKP44.js";
4
4
  const j = (e) => {
5
5
  if (e === null || typeof e != "object") return !1;
6
6
  const t = Object.getPrototypeOf(e);
@@ -18,12 +18,18 @@ const j = (e) => {
18
18
  expandIcons: !0,
19
19
  directoryIcons: !0,
20
20
  fileIcons: !0
21
- }), me = [!0, !1], fe = (e, t) => t ? e.settingOn : e.settingOff, g = (e, t) => ({ key: e, labelKey: t, values: me, formatValue: fe, requiresItemSelection: !1 }), E = Object.freeze([
21
+ }), me = [!0, !1], fe = (e, t) => t ? e.settingOn : e.settingOff, g = (e, t) => ({ key: e, labelKey: t, values: me, formatValue: fe, requiresItemSelection: !1 }), ue = Object.freeze({
22
+ native: (e) => e.sortNative,
23
+ asc: (e) => e.sortAscending,
24
+ desc: (e) => e.sortDescending,
25
+ oldest: (e) => e.sortOldest,
26
+ newest: (e) => e.sortNewest
27
+ }), E = Object.freeze([
22
28
  {
23
29
  key: "sortMode",
24
30
  labelKey: "settingSortMode",
25
- values: ["native", "asc", "desc"],
26
- formatValue: (e, t) => t === "native" ? e.sortNative : t === "asc" ? e.sortAscending : e.sortDescending,
31
+ values: ["native", "asc", "desc", "oldest", "newest"],
32
+ formatValue: (e, t) => ue[t](e),
27
33
  requiresItemSelection: !1
28
34
  },
29
35
  {
@@ -61,51 +67,56 @@ const j = (e) => {
61
67
  g("expandIcons", "settingExpandIcons"),
62
68
  g("directoryIcons", "settingDirectoryIcons"),
63
69
  g("fileIcons", "settingFileIcons")
64
- ]), et = (e) => e ? E : E.filter((t) => !t.requiresItemSelection), H = (e) => {
70
+ ]), rt = (e) => e ? E : E.filter((t) => !t.requiresItemSelection), H = (e) => {
65
71
  const t = E.find((r) => r.key === e);
66
72
  if (t === void 0) throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);
67
73
  return t;
68
- }, tt = (e, t) => {
74
+ }, nt = (e, t) => {
69
75
  const r = H(t).values, n = r[(r.indexOf(e[t]) + 1) % r.length];
70
76
  return { ...e, [t]: n };
71
- }, rt = (e, t, r) => H(r).formatValue(e, t[r]), q = 2, V = Object.freeze({}), L = (e, t) => Object.freeze(Object.fromEntries(E.filter((r) => t(r, e[r.key])).map((r) => [r.key, e[r.key]]))), F = "directoriesFirst", ue = (e) => {
77
+ }, ot = (e, t, r) => H(r).formatValue(e, t[r]), q = 2, V = Object.freeze({}), L = (e, t) => Object.freeze(Object.fromEntries(E.filter((r) => t(r, e[r.key])).map((r) => [r.key, e[r.key]]))), F = "directoriesFirst", ge = (e) => {
72
78
  if (!Object.hasOwn(e, F)) return e;
73
79
  const { [F]: t, ...r } = e;
74
80
  return Object.hasOwn(r, "folderPlacement") || typeof t != "boolean" ? r : { ...r, folderPlacement: t ? "first" : "mixed" };
75
- }, nt = (e) => {
81
+ }, st = (e) => {
76
82
  if (e === null || typeof e != "object" || Array.isArray(e)) return V;
77
83
  const t = e;
78
- return t.version !== q || t.settings === null || typeof t.settings != "object" || Array.isArray(t.settings) ? V : L(ue(t.settings), (r, n) => r.values.includes(n));
79
- }, ot = (e, t) => {
84
+ return t.version !== q || t.settings === null || typeof t.settings != "object" || Array.isArray(t.settings) ? V : L(ge(t.settings), (r, n) => r.values.includes(n));
85
+ }, it = (e, t) => {
80
86
  const r = L(t, (n, o) => o !== void 0 && o !== e[n.key]);
81
87
  return Object.keys(r).length === 0 ? e : Object.freeze({ ...e, ...r });
82
- }, st = (e, t, r, n) => L({ ...e, [t]: r }, (o, s) => s !== void 0 && !(o.key === t && s === n[t])), it = (e) => JSON.stringify({ version: q, settings: e }), at = (e) => {
88
+ }, at = (e, t, r, n) => L({ ...e, [t]: r }, (o, s) => s !== void 0 && !(o.key === t && s === n[t])), lt = (e) => JSON.stringify({ version: q, settings: e }), we = (e, t, r) => e === void 0 || t === void 0 ? e === t ? 0 : e === void 0 ? 1 : -1 : r * (e - t), ct = (e) => {
83
89
  const { sortMode: t, folderPlacement: r } = e;
84
90
  if (t === "native" && r === "mixed") return;
85
- const n = t === "desc" ? -1 : 1;
91
+ const n = (o, s) => {
92
+ const a = M.compare(o.name, s.name);
93
+ return a !== 0 ? a : M.compare(o.path, s.path);
94
+ };
86
95
  return (o, s) => {
87
96
  if (r !== "mixed" && o.type !== s.type) return o.type === "directory" == (r === "first") ? -1 : 1;
88
97
  if (t === "native") return 0;
89
- const a = M.compare(o.name, s.name);
90
- return n * (a !== 0 ? a : M.compare(o.path, s.path));
98
+ if (t === "asc") return n(o, s);
99
+ if (t === "desc") return -n(o, s);
100
+ const a = we(o.modifiedAt, s.modifiedAt, t === "oldest" ? 1 : -1);
101
+ return a !== 0 ? a : n(o, s);
91
102
  };
92
- }, w = (1 + Math.sqrt(5)) / 2, lt = 100 / w ** 3, ct = 100 / w ** 4, K = 100 / w ** 2, ge = 13, dt = 16, mt = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), we = Object.freeze([89, 144, 233, 377]), ft = 34, ut = 44, gt = 24, wt = 1 / w, pt = 1 / w ** 3, ht = "40ch", pe = (e) => {
103
+ }, w = (1 + Math.sqrt(5)) / 2, dt = 100 / w ** 3, mt = 100 / w ** 4, K = 100 / w ** 2, pe = 13, ft = 16, ut = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), he = Object.freeze([89, 144, 233, 377]), gt = 34, wt = 44, pt = 24, ht = 1 / w, Et = 1 / w ** 3, St = "40ch", Ee = (e) => {
93
104
  if (!Number.isFinite(e) || e <= 0)
94
105
  throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`);
95
- }, he = (e) => (pe(e), ge * e), Et = (e) => he(e) * w ** 2, St = 233, xt = we[0], U = (e, t) => {
106
+ }, Se = (e) => (Ee(e), pe * e), xt = (e) => Se(e) * w ** 2, yt = 233, bt = he[0], U = (e, t) => {
96
107
  if (!Number.isFinite(t) || t < 0)
97
108
  throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`);
98
- }, Ee = ({ trackInlineSize: e, gap: t, minColumnInlineSize: r, logicalColumns: n }) => {
109
+ }, xe = ({ trackInlineSize: e, gap: t, minColumnInlineSize: r, logicalColumns: n }) => {
99
110
  if (U("trackInlineSize", e), U("gap", t), !Number.isFinite(r) || r <= 0)
100
111
  throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(r)}`);
101
112
  if (!Number.isInteger(n) || n < 1)
102
113
  throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(n)}`);
103
114
  const o = Math.floor((e + t) / (r + t));
104
115
  return Math.min(n, Math.max(1, o));
105
- }, yt = (e, t) => {
116
+ }, Ot = (e, t) => {
106
117
  const { trackInlineSize: r, gap: n, minColumnInlineSize: o, logicalColumns: s } = t;
107
118
  if (!([r, n, o].every(Number.isFinite) && r > 0 && n >= 0 && o > 0)) return e;
108
- const c = Ee(t);
119
+ const c = xe(t);
109
120
  if (e === null || c === e) return c;
110
121
  const i = Math.min(s, Math.max(1, e));
111
122
  if (c > i) {
@@ -113,14 +124,14 @@ const j = (e) => {
113
124
  return r >= T ? c : i;
114
125
  }
115
126
  return r >= i * o + (i - 1) * n ? i : c;
116
- }, bt = (e, t) => {
127
+ }, kt = (e, t) => {
117
128
  if (!(Number.isInteger(e) && Number.isInteger(t)) || t < 1 || t > e)
118
129
  throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);
119
130
  return Array.from({ length: t }, (r, n) => [Math.floor(n * e / t), Math.floor((n + 1) * e / t)]);
120
- }, Se = 31536e3, xe = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u, ye = (e) => {
121
- if (typeof e != "string" || !xe.test(e))
131
+ }, ye = 31536e3, be = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u, Oe = (e) => {
132
+ if (typeof e != "string" || !be.test(e))
122
133
  throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`);
123
- }, J = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= K, be = (e, t) => {
134
+ }, J = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= K, ke = (e, t) => {
124
135
  if (e === null || typeof e != "object" || Array.isArray(e)) return {};
125
136
  const r = e, { treeExplorer: n, multiExplorer: o, style: s, align: a } = r;
126
137
  return {
@@ -129,22 +140,22 @@ const j = (e) => {
129
140
  ...typeof s == "string" && t.includes(s) ? { style: s } : {},
130
141
  ...typeof a == "string" && R.includes(a) ? { align: a } : {}
131
142
  };
132
- }, Ot = (e, t) => {
143
+ }, Rt = (e, t) => {
133
144
  if (e !== null)
134
145
  for (const r of e.split(";")) {
135
146
  const n = r.indexOf("=");
136
147
  if (!(n < 0) && r.slice(0, n).trim() === t)
137
148
  return r.slice(n + 1).trim();
138
149
  }
139
- }, kt = (e, t) => {
150
+ }, _t = (e, t) => {
140
151
  if (e === void 0 || e === "") return {};
141
152
  try {
142
- return be(JSON.parse(decodeURIComponent(e)), t);
153
+ return ke(JSON.parse(decodeURIComponent(e)), t);
143
154
  } catch {
144
155
  return {};
145
156
  }
146
- }, _ = 100, Oe = Math.floor(K * _) / _, ke = (e) => {
147
- const t = (r) => Math.min(Oe, Math.max(1, Math.round(r * _)) / _);
157
+ }, _ = 100, Re = Math.floor(K * _) / _, _e = (e) => {
158
+ const t = (r) => Math.min(Re, Math.max(1, Math.round(r * _)) / _);
148
159
  return encodeURIComponent(
149
160
  JSON.stringify({
150
161
  ...e.treeExplorer === void 0 ? {} : { treeExplorer: t(e.treeExplorer) },
@@ -153,9 +164,9 @@ const j = (e) => {
153
164
  ...e.align === void 0 ? {} : { align: e.align }
154
165
  })
155
166
  );
156
- }, Rt = (e, t, r) => `${e}=${ke(t)}; Path=/; Max-Age=${String(Se)}; SameSite=Lax${r ? "; Secure" : ""}`, G = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), Re = Object.freeze({ default: 12, min: 1, max: 64 }), _e = Object.freeze({ default: 4, min: 1, max: 6 }), Te = Object.freeze({ default: 500, min: 1, max: 1e4 }), Ne = Object.freeze({ default: 16, min: 1, max: 64 }), Ae = Object.freeze({ default: 16, min: 1, max: 64 }), Ie = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, ve = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, $e = /^[a-z0-9][a-z0-9-]*$/u, Pe = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u, X = (e, t) => {
167
+ }, Tt = (e, t, r) => `${e}=${_e(t)}; Path=/; Max-Age=${String(ye)}; SameSite=Lax${r ? "; Secure" : ""}`, G = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), Te = Object.freeze({ default: 12, min: 1, max: 64 }), Ae = Object.freeze({ default: 4, min: 1, max: 6 }), Ne = Object.freeze({ default: 500, min: 1, max: 1e4 }), ve = Object.freeze({ default: 16, min: 1, max: 64 }), Ie = Object.freeze({ default: 16, min: 1, max: 64 }), $e = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, Pe = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, Ce = /^[a-z0-9][a-z0-9-]*$/u, ze = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u, X = (e, t) => {
157
168
  if (typeof t != "string") throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);
158
- if (!Ie.test(t) || t.split("/").some((r) => r === "." || r === ".."))
169
+ if (!$e.test(t) || t.split("/").some((r) => r === "." || r === ".."))
159
170
  throw new RangeError(`[markdown-explorer] ${e} must start with "/", have no trailing "/", and use only letters, digits and "._~-" in each segment; got ${JSON.stringify(t)}`);
160
171
  }, d = (e) => typeof e == "string" ? JSON.stringify(e) : typeof e == "bigint" ? `${String(e)}n` : Object.is(e, -0) ? "-0" : typeof e == "function" ? "a function" : Array.isArray(e) ? "an array" : e !== null && typeof e == "object" ? j(e) ? "a plain object" : `a non-plain object (${Object.prototype.toString.call(e)})` : String(e), h = (e, t, r) => {
161
172
  if (t === void 0) return [];
@@ -164,11 +175,11 @@ const j = (e) => {
164
175
  for (const [o] of n)
165
176
  if (!r.includes(o)) throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${r.join(", ")}`);
166
177
  return n.filter(([, o]) => o !== void 0);
167
- }, Ce = (e) => {
178
+ }, je = (e) => {
168
179
  const t = { ...G };
169
180
  for (const [r, n] of h("views", e, Object.keys(G))) t[r] = n;
170
181
  for (const [r, n] of Object.entries(t))
171
- if (typeof n != "string" || !ve.test(n))
182
+ if (typeof n != "string" || !Pe.test(n))
172
183
  throw new RangeError(`[markdown-explorer] views.${r} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(n)}`);
173
184
  return Object.freeze(t);
174
185
  }, y = (e, t, r) => {
@@ -176,7 +187,7 @@ const j = (e) => {
176
187
  if (typeof t != "number" || !Number.isInteger(t) || t < r.min || t > r.max)
177
188
  throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(r.min)}..${String(r.max)}; got ${d(t)}`);
178
189
  return t;
179
- }, ze = (e, t) => {
190
+ }, Le = (e, t) => {
180
191
  const r = new Map(h("embeds", e, ["providers", "linkCards", "linkCardSize"]));
181
192
  if (r.size === 0) return oe;
182
193
  const n = r.has("providers") ? r.get("providers") : [];
@@ -191,7 +202,7 @@ const j = (e) => {
191
202
  if (!ae(a)) throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${le.join(", ")}; got ${d(a)}`);
192
203
  if (!o) throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${d(a)} with linkCards ${d(o)}`);
193
204
  return Object.freeze({ ...s, linkCardSize: a });
194
- }, je = (e) => {
205
+ }, Me = (e) => {
195
206
  const t = new Map(
196
207
  h(
197
208
  "defaultTreeSettings",
@@ -208,10 +219,10 @@ const j = (e) => {
208
219
  r[n.key] = o;
209
220
  }
210
221
  return Object.freeze(r);
211
- }, Le = (e) => {
222
+ }, De = (e) => {
212
223
  if (e === null || typeof e != "object") throw new TypeError("[markdown-explorer] the explorer configuration must be an object");
213
224
  X("basePath", e.basePath), X("dataPath", e.dataPath);
214
- const t = Ce(e.views);
225
+ const t = je(e.views);
215
226
  if ((/* @__PURE__ */ new Set([t.tree, t.multi, t.single])).size !== 3)
216
227
  throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);
217
228
  if (e.dataPath === e.basePath) throw new RangeError("[markdown-explorer] dataPath must differ from basePath");
@@ -220,9 +231,9 @@ const j = (e) => {
220
231
  if (i === t.tree || i === t.multi || i === t.single)
221
232
  throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`);
222
233
  }
223
- ye(e.settingsCookie);
234
+ Oe(e.settingsCookie);
224
235
  const r = e.iframeHosts ?? [];
225
- if (!Array.isArray(r) || r.some((i) => typeof i != "string" || !Pe.test(i)))
236
+ if (!Array.isArray(r) || r.some((i) => typeof i != "string" || !ze.test(i)))
226
237
  throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(r)}`);
227
238
  const n = Object.fromEntries(h("multiView", e.multiView, ["maxPanels", "columns"])), o = Object.fromEntries(h("expandAll", e.expandAll, ["maxFolders", "maxDepth"])), s = Object.fromEntries(h("revealDocument", e.revealDocument, ["maxDepth"])), a = e.documentStyles ?? ce;
228
239
  if (!Array.isArray(a) || a.length === 0) throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");
@@ -239,36 +250,36 @@ const j = (e) => {
239
250
  settingsCookie: e.settingsCookie,
240
251
  views: t,
241
252
  multiView: Object.freeze({
242
- maxPanels: y("multiView.maxPanels", n.maxPanels, Re),
243
- columns: y("multiView.columns", n.columns, _e)
253
+ maxPanels: y("multiView.maxPanels", n.maxPanels, Te),
254
+ columns: y("multiView.columns", n.columns, Ae)
244
255
  }),
245
256
  expandAll: Object.freeze({
246
- maxFolders: y("expandAll.maxFolders", o.maxFolders, Te),
247
- maxDepth: y("expandAll.maxDepth", o.maxDepth, Ne)
257
+ maxFolders: y("expandAll.maxFolders", o.maxFolders, Ne),
258
+ maxDepth: y("expandAll.maxDepth", o.maxDepth, ve)
248
259
  }),
249
- revealDocument: Object.freeze({ maxDepth: y("revealDocument.maxDepth", s.maxDepth, Ae) }),
260
+ revealDocument: Object.freeze({ maxDepth: y("revealDocument.maxDepth", s.maxDepth, Ie) }),
250
261
  documentStyles: Object.freeze(a.map((i) => Object.freeze({ name: i.name, className: i.className }))),
251
262
  iframeHosts: Object.freeze([...new Set(r)]),
252
- embeds: ze(e.embeds, e.dataPath),
253
- defaultTreeSettings: je(e.defaultTreeSettings)
263
+ embeds: Le(e.embeds, e.dataPath),
264
+ defaultTreeSettings: Me(e.defaultTreeSettings)
254
265
  });
255
- }, _t = (e) => {
266
+ }, At = (e) => {
256
267
  const t = e.embeds;
257
268
  if (!j(t)) throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${d(t)}`);
258
269
  if (Object.hasOwn(t, "linkCards"))
259
270
  throw new RangeError(`[markdown-explorer] config.embeds.linkCards is an option of defineExplorerConfig, not a key of the embeds it resolves; pass the option to defineExplorerConfig (got linkCards ${d(t.linkCards)})`);
260
- const { linkCardEndpoint: r, ...n } = t, o = Le({ ...e, embeds: { ...n, linkCards: r !== null } });
271
+ const { linkCardEndpoint: r, ...n } = t, o = De({ ...e, embeds: { ...n, linkCards: r !== null } });
261
272
  if (o.embeds.linkCardEndpoint !== r)
262
273
  throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${d(o.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${d(r)}`);
263
274
  return o;
264
- }, Me = (e) => typeof e == "string" && $e.test(e), Tt = (e, t) => {
275
+ }, Ve = (e) => typeof e == "string" && Ce.test(e), Nt = (e, t) => {
265
276
  if (e === null || typeof e != "object") throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${d(e)}`);
266
277
  if (!Array.isArray(t) || t.length === 0) throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${d(t)}`);
267
278
  for (const r of t)
268
- if (!Me(r)) throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${d(r)}`);
279
+ if (!Ve(r)) throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${d(r)}`);
269
280
  if (new Set(t).size !== t.length) throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);
270
281
  return Object.freeze({ ...e, sourceIds: Object.freeze([...t]) });
271
- }, Nt = (e) => e.documentStyles.map((t) => t.name), l = Object.freeze({
282
+ }, vt = (e) => e.documentStyles.map((t) => t.name), l = Object.freeze({
272
283
  source: "source",
273
284
  doc: "doc",
274
285
  maximized: "maximized",
@@ -281,25 +292,25 @@ const j = (e) => {
281
292
  width: "width",
282
293
  maxWidth: "maxWidth",
283
294
  markup: "markup"
284
- }), B = "true", W = ".data", Z = 256, Y = /^\d+(?:\.\d+)?$/u, C = /^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u, Q = Object.freeze(["showToc", "showStyle", "showAlign"]), De = (e) => {
295
+ }), B = "true", W = ".data", Z = 256, Y = /^\d+(?:\.\d+)?$/u, C = /^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u, Q = Object.freeze(["showToc", "showStyle", "showAlign"]), Fe = (e) => {
285
296
  const t = encodeURIComponent(e.replaceAll("%", "%25"));
286
297
  return t.endsWith(W) ? `${t.slice(0, -W.length)}%2Edata` : t;
287
- }, Ve = (e) => e.replaceAll("%25", "%"), ee = (e) => {
298
+ }, Ue = (e) => e.replaceAll("%25", "%"), ee = (e) => {
288
299
  const { sourceIds: t } = e;
289
300
  if (t === void 0) throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");
290
301
  return t;
291
- }, Fe = (e, t, r) => {
302
+ }, Je = (e, t, r) => {
292
303
  const n = r.getAll(l.source);
293
304
  if (n.length === 0) return t;
294
305
  const [o] = n;
295
306
  return n.length > 1 || o === void 0 || o === t || !e.includes(o) ? null : o;
296
- }, Ue = (e, t) => {
307
+ }, Ge = (e, t) => {
297
308
  const r = t.get(l.style), n = t.get(l.align);
298
309
  return {
299
310
  ...r !== null && e.documentStyles.some((o) => o.name === r) ? { style: r } : {},
300
311
  ...n !== null && R.includes(n) ? { align: n } : {}
301
312
  };
302
- }, te = (e) => Number.isFinite(e) && e >= 0 && e <= Z && Y.test(String(e)), Je = (e) => {
313
+ }, te = (e) => Number.isFinite(e) && e >= 0 && e <= Z && Y.test(String(e)), Xe = (e) => {
303
314
  const t = e.get(l.padding), r = t !== null && Y.test(t) ? Number(t) : Number.NaN, n = e.get(l.width), o = e.get(l.maxWidth);
304
315
  return {
305
316
  ...e.get(l.showToc) === "false" ? { showToc: !1 } : {},
@@ -309,7 +320,7 @@ const j = (e) => {
309
320
  ...n !== null && C.test(n) ? { width: n } : {},
310
321
  ...o !== null && C.test(o) ? { maxWidth: o } : {}
311
322
  };
312
- }, Ge = (e, t) => [...new Set(t.filter(z))].slice(0, e.multiView.maxPanels), Xe = (e, t, r, n) => {
323
+ }, We = (e, t) => [...new Set(t.filter(z))].slice(0, e.multiView.maxPanels), He = (e, t, r, n) => {
313
324
  for (const s of t) re(s);
314
325
  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`);
315
326
  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)}`);
@@ -320,12 +331,12 @@ const j = (e) => {
320
331
  }, re = (e) => {
321
332
  if (!z(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0, 80))}`);
322
333
  return e;
323
- }, We = (e, t) => {
334
+ }, qe = (e, t) => {
324
335
  if (t.style !== void 0 && !e.documentStyles.some((r) => r.name === t.style))
325
336
  throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map((r) => JSON.stringify(r.name)).join(", ")}); got ${JSON.stringify(t.style)}`);
326
337
  if (t.align !== void 0 && !R.includes(t.align))
327
338
  throw new RangeError(`[markdown-explorer] overrides.align must be one of ${R.join(", ")}; got ${JSON.stringify(t.align)}`);
328
- }, He = (e) => {
339
+ }, Ke = (e) => {
329
340
  for (const t of Q)
330
341
  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])}`);
331
342
  if (e.padding !== void 0 && !te(e.padding)) throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(Z)} px in plain decimal digits; got ${String(e.padding)}`);
@@ -333,101 +344,101 @@ const j = (e) => {
333
344
  const r = e[t];
334
345
  if (r !== void 0 && !C.test(r)) throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(r)}`);
335
346
  }
336
- }, qe = (e, t) => {
347
+ }, Be = (e, t) => {
337
348
  const r = new URLSearchParams();
338
349
  let n = `${e.basePath}/${e.views[t.view]}`;
339
350
  if (t.view === "multi") {
340
351
  const s = t.docs ?? [], a = t.maximized ?? null, c = t.markup ?? [];
341
- Xe(e, s, a, c);
352
+ He(e, s, a, c);
342
353
  for (const i of s) r.append(l.doc, i);
343
354
  a !== null && r.set(l.maximized, a);
344
355
  for (const i of s) c.includes(i) && r.append(l.markup, i);
345
- } else t.doc !== void 0 && t.doc !== null && (n += `/${De(re(t.doc))}`);
356
+ } else t.doc !== void 0 && t.doc !== null && (n += `/${Fe(re(t.doc))}`);
346
357
  if (t.source !== void 0) {
347
358
  const s = ee(e);
348
359
  if (!s.includes(t.source)) throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${s.join(", ")}`);
349
360
  t.source !== s[0] && r.set(l.source, t.source);
350
361
  }
351
- if (t.view !== "multi" && t.overrides !== void 0 && (We(e, t.overrides), t.overrides.style !== void 0 && r.set(l.style, t.overrides.style), t.overrides.align !== void 0 && r.set(l.align, t.overrides.align)), t.view !== "multi" && t.markup === !0) {
362
+ if (t.view !== "multi" && t.overrides !== void 0 && (qe(e, t.overrides), t.overrides.style !== void 0 && r.set(l.style, t.overrides.style), t.overrides.align !== void 0 && r.set(l.align, t.overrides.align)), t.view !== "multi" && t.markup === !0) {
352
363
  if (t.doc === void 0 || t.doc === null) throw new RangeError("[markdown-explorer] a tree view without a document has nothing to show as written");
353
364
  r.set(l.markup, B);
354
365
  }
355
366
  if (t.view === "single" && t.embed !== void 0) {
356
367
  const { embed: s } = t;
357
- He(s);
368
+ Ke(s);
358
369
  for (const a of Q) s[a] === !1 && r.set(l[a], "false");
359
370
  s.padding !== void 0 && r.set(l.padding, String(s.padding)), s.width !== void 0 && r.set(l.width, s.width), s.maxWidth !== void 0 && r.set(l.maxWidth, s.maxWidth);
360
371
  }
361
372
  const o = r.toString();
362
373
  return o === "" ? n : `${n}?${o}`;
363
- }, Ke = (e, t) => Object.keys(e.views).find((r) => e.views[r] === t), At = (e, t, r) => {
374
+ }, Ze = (e, t) => Object.keys(e.views).find((r) => e.views[r] === t), It = (e, t, r) => {
364
375
  const n = ee(e), [o] = n;
365
376
  if (o === void 0) throw new RangeError("[markdown-explorer] the configuration has no source");
366
- const s = Fe(n, o, r), a = s === null ? o : s, c = (m) => ({ kind: "redirect", href: qe(e, m), location: m }), i = () => c({ view: "tree", source: a, doc: null, overrides: {}, markup: !1 });
377
+ const s = Je(n, o, r), a = s === null ? o : s, c = (m) => ({ kind: "redirect", href: Be(e, m), location: m }), i = () => c({ view: "tree", source: a, doc: null, overrides: {}, markup: !1 });
367
378
  if (t === void 0 || t === "") return i();
368
- const S = t.indexOf("/"), T = S < 0 ? t : t.slice(0, S), N = S < 0 ? null : t.slice(S + 1), u = Ke(e, T);
379
+ const S = t.indexOf("/"), T = S < 0 ? t : t.slice(0, S), A = S < 0 ? null : t.slice(S + 1), u = Ze(e, T);
369
380
  if (u === void 0) return i();
370
381
  if (u === "multi") {
371
- const m = r.getAll(l.doc), p = Ge(e, m), A = r.getAll(l.maximized), [I] = A, v = A.length === 1 && I !== void 0 && p.includes(I) ? I : null, $ = r.getAll(l.markup), k = p.filter((x) => $.includes(x)), ne = k.length === $.length && k.every((x, P) => x === $[P]);
372
- return N === null && s !== null && p.length === m.length && p.every((x, P) => x === m[P]) && (A.length === 0 || v !== null) && ne ? { kind: "location", location: { view: "multi", source: a, docs: p, maximized: v, markup: k } } : c({ view: "multi", source: a, docs: p, maximized: v, markup: k });
382
+ const m = r.getAll(l.doc), p = We(e, m), N = r.getAll(l.maximized), [v] = N, I = N.length === 1 && v !== void 0 && p.includes(v) ? v : null, $ = r.getAll(l.markup), k = p.filter((x) => $.includes(x)), ne = k.length === $.length && k.every((x, P) => x === $[P]);
383
+ return A === null && s !== null && p.length === m.length && p.every((x, P) => x === m[P]) && (N.length === 0 || I !== null) && ne ? { kind: "location", location: { view: "multi", source: a, docs: p, maximized: I, markup: k } } : c({ view: "multi", source: a, docs: p, maximized: I, markup: k });
373
384
  }
374
- const f = N === null ? null : Ve(N);
385
+ const f = A === null ? null : Ue(A);
375
386
  if (f !== null && !z(f)) return i();
376
- const b = Ue(e, r), O = f !== null && r.get(l.markup) === B;
387
+ const b = Ge(e, r), O = f !== null && r.get(l.markup) === B;
377
388
  if (u === "single") {
378
389
  if (f === null) return i();
379
- const m = Je(r);
390
+ const m = Xe(r);
380
391
  return s === null ? c({ view: u, source: a, doc: f, overrides: b, embed: m, markup: O }) : { kind: "location", location: { view: u, source: a, doc: f, overrides: b, embed: m, markup: O } };
381
392
  }
382
393
  return s === null ? c({ view: u, source: a, doc: f, overrides: b, markup: O }) : { kind: "location", location: { view: u, source: a, doc: f, overrides: b, markup: O } };
383
394
  };
384
395
  export {
385
- dt as A,
386
- it as B,
387
- ft as C,
396
+ ft as A,
397
+ lt as B,
398
+ gt as C,
388
399
  V as D,
389
- St as E,
390
- gt as F,
400
+ yt as E,
401
+ pt as F,
391
402
  w as G,
392
- nt as H,
393
- Rt as I,
394
- ht as J,
403
+ st as H,
404
+ Tt as I,
405
+ St as J,
395
406
  D as K,
396
407
  G as L,
397
- Ne as M,
408
+ ve as M,
398
409
  M as N,
399
- Te as O,
400
- wt as P,
401
- ge as Q,
402
- _e as R,
403
- mt as S,
404
- Re as T,
405
- Ae as U,
406
- Le as V,
407
- At as a,
408
- Ot as b,
409
- Ge as c,
410
- Nt as d,
411
- qe as e,
410
+ Ne as O,
411
+ ht as P,
412
+ pe as Q,
413
+ Ae as R,
414
+ ut as S,
415
+ Te as T,
416
+ Ie as U,
417
+ De as V,
418
+ It as a,
419
+ Rt as b,
420
+ We as c,
421
+ vt as d,
422
+ Be as e,
412
423
  j as f,
413
- bt as g,
414
- yt as h,
415
- Me as i,
416
- pt as j,
417
- at as k,
418
- rt as l,
419
- Et as m,
420
- he as n,
424
+ kt as g,
425
+ Ot as h,
426
+ Ve as i,
427
+ Et as j,
428
+ ct as k,
429
+ ot as l,
430
+ xt as m,
431
+ Se as n,
421
432
  K as o,
422
- kt as p,
423
- lt as q,
424
- _t as r,
425
- ct as s,
426
- ut as t,
427
- xt as u,
428
- et as v,
429
- Tt as w,
430
- st as x,
431
- tt as y,
432
- ot as z
433
+ _t as p,
434
+ dt as q,
435
+ At as r,
436
+ mt as s,
437
+ wt as t,
438
+ bt as u,
439
+ rt as v,
440
+ Nt as w,
441
+ at as x,
442
+ nt as y,
443
+ it as z
433
444
  };
@@ -0,0 +1 @@
1
+ "use strict";const O=require("@aiquants/markdown/embeds"),b=require("@aiquants/markdown/viewer-settings"),N=require("./dataRoute-CIFFX5bd.cjs"),k=e=>{if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},D=new Intl.Collator("en",{numeric:!0,sensitivity:"variant"}),z=Object.freeze({sortMode:"native",folderPlacement:"mixed",selectionMode:"single",doubleClickAction:"recursive",expandIconSize:8,alwaysExpanded:!1,revealDocument:!1,removeRootIndent:!1,lines:!0,expandIcons:!0,directoryIcons:!0,fileIcons:!0}),we=[!0,!1],pe=(e,t)=>t?e.settingOn:e.settingOff,E=(e,t)=>({key:e,labelKey:t,values:we,formatValue:pe,requiresItemSelection:!1}),Se=Object.freeze({native:e=>e.sortNative,asc:e=>e.sortAscending,desc:e=>e.sortDescending,oldest:e=>e.sortOldest,newest:e=>e.sortNewest}),S=Object.freeze([{key:"sortMode",labelKey:"settingSortMode",values:["native","asc","desc","oldest","newest"],formatValue:(e,t)=>Se[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:"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},E("alwaysExpanded","settingAlwaysExpanded"),E("revealDocument","settingRevealDocument"),E("removeRootIndent","settingRemoveRootIndent"),E("lines","settingTreeLines"),E("expandIcons","settingExpandIcons"),E("directoryIcons","settingDirectoryIcons"),E("fileIcons","settingFileIcons")]),he=e=>e?S:S.filter(t=>!t.requiresItemSelection),B=e=>{const t=S.find(r=>r.key===e);if(t===void 0)throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);return t},_e=(e,t)=>{const r=B(t).values,n=r[(r.indexOf(e[t])+1)%r.length];return{...e,[t]:n}},Oe=(e,t,r)=>B(r).formatValue(e,t[r]),K=2,j=Object.freeze({}),U=(e,t)=>Object.freeze(Object.fromEntries(S.filter(r=>t(r,e[r.key])).map(r=>[r.key,e[r.key]]))),G="directoriesFirst",xe=e=>{if(!Object.hasOwn(e,G))return e;const{[G]:t,...r}=e;return Object.hasOwn(r,"folderPlacement")||typeof t!="boolean"?r:{...r,folderPlacement:t?"first":"mixed"}},be=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return j;const t=e;return t.version!==K||t.settings===null||typeof t.settings!="object"||Array.isArray(t.settings)?j:U(xe(t.settings),(r,n)=>r.values.includes(n))},ye=(e,t)=>{const r=U(t,(n,o)=>o!==void 0&&o!==e[n.key]);return Object.keys(r).length===0?e:Object.freeze({...e,...r})},Te=(e,t,r,n)=>U({...e,[t]:r},(o,i)=>i!==void 0&&!(o.key===t&&i===n[t])),Re=e=>JSON.stringify({version:K,settings:e}),Ie=(e,t,r)=>e===void 0||t===void 0?e===t?0:e===void 0?1:-1:r*(e-t),Ne=e=>{const{sortMode:t,folderPlacement:r}=e;if(t==="native"&&r==="mixed")return;const n=(o,i)=>{const a=D.compare(o.name,i.name);return a!==0?a:D.compare(o.path,i.path)};return(o,i)=>{if(r!=="mixed"&&o.type!==i.type)return o.type==="directory"==(r==="first")?-1:1;if(t==="native")return 0;if(t==="asc")return n(o,i);if(t==="desc")return-n(o,i);const a=Ie(o.modifiedAt,i.modifiedAt,t==="oldest"?1:-1);return a!==0?a:n(o,i)}},f=(1+Math.sqrt(5))/2,ke=100/f**3,Ae=100/f**4,X=100/f**2,Z=13,Le=16,Pe=Object.freeze({gripThickness:5,gripLength:34,barThickness:2,barLength:21}),Ce=Object.freeze([89,144,233,377]),ve=34,Me=44,$e=24,De=1/f,ze=1/f**3,je="40ch",Ve=e=>{if(!Number.isFinite(e)||e<=0)throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`)},Y=e=>(Ve(e),Z*e),Fe=e=>Y(e)*f**2,Ue=233,Xe=Ce[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)}`)},Ge=({trackInlineSize:e,gap:t,minColumnInlineSize:r,logicalColumns:n})=>{if(W("trackInlineSize",e),W("gap",t),!Number.isFinite(r)||r<=0)throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(r)}`);if(!Number.isInteger(n)||n<1)throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(n)}`);const o=Math.floor((e+t)/(r+t));return Math.min(n,Math.max(1,o))},We=(e,t)=>{const{trackInlineSize:r,gap:n,minColumnInlineSize:o,logicalColumns:i}=t;if(!([r,n,o].every(Number.isFinite)&&r>0&&n>=0&&o>0))return e;const c=Ge(t);if(e===null||c===e)return c;const s=Math.min(i,Math.max(1,e));if(c>s){const A=(s+1)*o+s*n+n/f;return r>=A?c:s}return r>=s*o+(s-1)*n?s:c},He=(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},(r,n)=>[Math.floor(n*e/t),Math.floor((n+1)*e/t)])},Je=31536e3,qe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u,Be=e=>{if(typeof e!="string"||!qe.test(e))throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`)},H=e=>typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=X,Ke=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))return{};const r=e,{treeExplorer:n,multiExplorer:o,style:i,align:a}=r;return{...H(n)?{treeExplorer:n}:{},...H(o)?{multiExplorer:o}:{},...typeof i=="string"&&t.includes(i)?{style:i}:{},...typeof a=="string"&&b.CONTENT_ALIGNS.includes(a)?{align:a}:{}}},Ze=(e,t)=>{if(e!==null)for(const r of e.split(";")){const n=r.indexOf("=");if(!(n<0)&&r.slice(0,n).trim()===t)return r.slice(n+1).trim()}},Ye=(e,t)=>{if(e===void 0||e==="")return{};try{return Ke(JSON.parse(decodeURIComponent(e)),t)}catch{return{}}},I=100,Qe=Math.floor(X*I)/I,et=e=>{const t=r=>Math.min(Qe,Math.max(1,Math.round(r*I))/I);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}}))},tt=(e,t,r)=>`${e}=${et(t)}; Path=/; Max-Age=${String(Je)}; SameSite=Lax${r?"; Secure":""}`,V=Object.freeze({tree:"tree",multi:"multi",single:"single"}),Q=Object.freeze({default:12,min:1,max:64}),ee=Object.freeze({default:4,min:1,max:6}),te=Object.freeze({default:500,min:1,max:1e4}),re=Object.freeze({default:16,min:1,max:64}),ne=Object.freeze({default:16,min:1,max:64}),rt=/^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u,nt=/^[A-Za-z0-9][A-Za-z0-9_-]*$/u,ot=/^[a-z0-9][a-z0-9-]*$/u,it=/^(?=.{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,J=(e,t)=>{if(typeof t!="string")throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);if(!rt.test(t)||t.split("/").some(r=>r==="."||r===".."))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)}`)},d=e=>typeof e=="string"?JSON.stringify(e):typeof e=="bigint"?`${String(e)}n`:Object.is(e,-0)?"-0":typeof e=="function"?"a function":Array.isArray(e)?"an array":e!==null&&typeof e=="object"?k(e)?"a plain object":`a non-plain object (${Object.prototype.toString.call(e)})`:String(e),p=(e,t,r)=>{if(t===void 0)return[];if(!k(t))throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${d(t)}`);const n=Object.entries(t);for(const[o]of n)if(!r.includes(o))throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${r.join(", ")}`);return n.filter(([,o])=>o!==void 0)},st=e=>{const t={...V};for(const[r,n]of p("views",e,Object.keys(V)))t[r]=n;for(const[r,n]of Object.entries(t))if(typeof n!="string"||!nt.test(n))throw new RangeError(`[markdown-explorer] views.${r} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(n)}`);return Object.freeze(t)},x=(e,t,r)=>{if(t===void 0)return r.default;if(typeof t!="number"||!Number.isInteger(t)||t<r.min||t>r.max)throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(r.min)}..${String(r.max)}; got ${d(t)}`);return t},at=(e,t)=>{const r=new Map(p("embeds",e,["providers","linkCards","linkCardSize"]));if(r.size===0)return O.NO_EMBEDS;const n=r.has("providers")?r.get("providers"):[];if(!Array.isArray(n))throw new RangeError(`[markdown-explorer] embeds.providers must be an array of provider ids; got ${d(n)}`);for(const c of n)if(!O.isEmbedProviderId(c))throw new RangeError(`[markdown-explorer] embeds.providers must hold only ${O.EMBED_PROVIDER_IDS.join(", ")}; got ${d(c)}`);const o=r.has("linkCards")?r.get("linkCards"):!1;if(typeof o!="boolean")throw new RangeError(`[markdown-explorer] embeds.linkCards must be a boolean; got ${d(o)}`);const i={providers:Object.freeze([...new Set(n)]),linkCardEndpoint:o?N.explorerLinkCardEndpoint(t):null};if(!r.has("linkCardSize"))return Object.freeze(i);const a=r.get("linkCardSize");if(!O.isLinkCardSize(a))throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${O.LINK_CARD_SIZES.join(", ")}; got ${d(a)}`);if(!o)throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${d(a)} with linkCards ${d(o)}`);return Object.freeze({...i,linkCardSize:a})},lt=e=>{const t=new Map(p("defaultTreeSettings",e,S.map(n=>n.key)));if(t.size===0)return z;const r={...z};for(const n of S){if(!t.has(n.key))continue;const o=t.get(n.key),i=n.values;if(!i.includes(o))throw new RangeError(`[markdown-explorer] defaultTreeSettings.${n.key} must be one of ${i.map(d).join(", ")}; got ${d(o)}`);r[n.key]=o}return Object.freeze(r)},oe=e=>{if(e===null||typeof e!="object")throw new TypeError("[markdown-explorer] the explorer configuration must be an object");J("basePath",e.basePath),J("dataPath",e.dataPath);const t=st(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 s=e.dataPath.slice(e.basePath.length+1).split("/")[0];if(s===t.tree||s===t.multi||s===t.single)throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`)}Be(e.settingsCookie);const r=e.iframeHosts??[];if(!Array.isArray(r)||r.some(s=>typeof s!="string"||!it.test(s)))throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(r)}`);const n=Object.fromEntries(p("multiView",e.multiView,["maxPanels","columns"])),o=Object.fromEntries(p("expandAll",e.expandAll,["maxFolders","maxDepth"])),i=Object.fromEntries(p("revealDocument",e.revealDocument,["maxDepth"])),a=e.documentStyles??b.DEFAULT_MARKDOWN_STYLES;if(!Array.isArray(a)||a.length===0)throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");const c=new Set;for(const s of a){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name.trim()===""||typeof s.className!="string")throw new RangeError("[markdown-explorer] each document style needs a non-blank name and a className string");if(c.has(s.name))throw new RangeError(`[markdown-explorer] document style names must be unique; ${JSON.stringify(s.name)} repeats`);c.add(s.name)}return Object.freeze({basePath:e.basePath,dataPath:e.dataPath,settingsCookie:e.settingsCookie,views:t,multiView:Object.freeze({maxPanels:x("multiView.maxPanels",n.maxPanels,Q),columns:x("multiView.columns",n.columns,ee)}),expandAll:Object.freeze({maxFolders:x("expandAll.maxFolders",o.maxFolders,te),maxDepth:x("expandAll.maxDepth",o.maxDepth,re)}),revealDocument:Object.freeze({maxDepth:x("revealDocument.maxDepth",i.maxDepth,ne)}),documentStyles:Object.freeze(a.map(s=>Object.freeze({name:s.name,className:s.className}))),iframeHosts:Object.freeze([...new Set(r)]),embeds:at(e.embeds,e.dataPath),defaultTreeSettings:lt(e.defaultTreeSettings)})},ct=e=>{const t=e.embeds;if(!k(t))throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${d(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 ${d(t.linkCards)})`);const{linkCardEndpoint:r,...n}=t,o=oe({...e,embeds:{...n,linkCards:r!==null}});if(o.embeds.linkCardEndpoint!==r)throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${d(o.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${d(r)}`);return o},ie=e=>typeof e=="string"&&ot.test(e),dt=(e,t)=>{if(e===null||typeof e!="object")throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${d(e)}`);if(!Array.isArray(t)||t.length===0)throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${d(t)}`);for(const r of t)if(!ie(r))throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${d(r)}`);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])})},mt=e=>e.documentStyles.map(t=>t.name),l=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"}),se="true",q=".data",ae=256,le=/^\d+(?:\.\d+)?$/u,F=/^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u,ce=Object.freeze(["showToc","showStyle","showAlign"]),ut=e=>{const t=encodeURIComponent(e.replaceAll("%","%25"));return t.endsWith(q)?`${t.slice(0,-q.length)}%2Edata`:t},ft=e=>e.replaceAll("%25","%"),de=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},gt=(e,t,r)=>{const n=r.getAll(l.source);if(n.length===0)return t;const[o]=n;return n.length>1||o===void 0||o===t||!e.includes(o)?null:o},Et=(e,t)=>{const r=t.get(l.style),n=t.get(l.align);return{...r!==null&&e.documentStyles.some(o=>o.name===r)?{style:r}:{},...n!==null&&b.CONTENT_ALIGNS.includes(n)?{align:n}:{}}},me=e=>Number.isFinite(e)&&e>=0&&e<=ae&&le.test(String(e)),wt=e=>{const t=e.get(l.padding),r=t!==null&&le.test(t)?Number(t):Number.NaN,n=e.get(l.width),o=e.get(l.maxWidth);return{...e.get(l.showToc)==="false"?{showToc:!1}:{},...e.get(l.showStyle)==="false"?{showStyle:!1}:{},...e.get(l.showAlign)==="false"?{showAlign:!1}:{},...me(r)?{padding:r}:{},...n!==null&&F.test(n)?{width:n}:{},...o!==null&&F.test(o)?{maxWidth:o}:{}}},ue=(e,t)=>[...new Set(t.filter(N.isAcceptableDocumentPath))].slice(0,e.multiView.maxPanels),pt=(e,t,r,n)=>{for(const i of t)fe(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(r!==null&&!t.includes(r))throw new RangeError(`[markdown-explorer] the maximized document must be one of the open documents; got ${JSON.stringify(r.slice(0,80))}`);if(new Set(n).size!==n.length)throw new RangeError(`[markdown-explorer] the documents shown as written must each appear once; got ${String(n.length)} with repeats`);const o=n.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))}`)},fe=e=>{if(!N.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0,80))}`);return e},St=(e,t)=>{if(t.style!==void 0&&!e.documentStyles.some(r=>r.name===t.style))throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map(r=>JSON.stringify(r.name)).join(", ")}); got ${JSON.stringify(t.style)}`);if(t.align!==void 0&&!b.CONTENT_ALIGNS.includes(t.align))throw new RangeError(`[markdown-explorer] overrides.align must be one of ${b.CONTENT_ALIGNS.join(", ")}; got ${JSON.stringify(t.align)}`)},ht=e=>{for(const t of ce)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&&!me(e.padding))throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(ae)} px in plain decimal digits; got ${String(e.padding)}`);for(const t of["width","maxWidth"]){const r=e[t];if(r!==void 0&&!F.test(r))throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(r)}`)}},ge=(e,t)=>{const r=new URLSearchParams;let n=`${e.basePath}/${e.views[t.view]}`;if(t.view==="multi"){const i=t.docs??[],a=t.maximized??null,c=t.markup??[];pt(e,i,a,c);for(const s of i)r.append(l.doc,s);a!==null&&r.set(l.maximized,a);for(const s of i)c.includes(s)&&r.append(l.markup,s)}else t.doc!==void 0&&t.doc!==null&&(n+=`/${ut(fe(t.doc))}`);if(t.source!==void 0){const i=de(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]&&r.set(l.source,t.source)}if(t.view!=="multi"&&t.overrides!==void 0&&(St(e,t.overrides),t.overrides.style!==void 0&&r.set(l.style,t.overrides.style),t.overrides.align!==void 0&&r.set(l.align,t.overrides.align)),t.view!=="multi"&&t.markup===!0){if(t.doc===void 0||t.doc===null)throw new RangeError("[markdown-explorer] a tree view without a document has nothing to show as written");r.set(l.markup,se)}if(t.view==="single"&&t.embed!==void 0){const{embed:i}=t;ht(i);for(const a of ce)i[a]===!1&&r.set(l[a],"false");i.padding!==void 0&&r.set(l.padding,String(i.padding)),i.width!==void 0&&r.set(l.width,i.width),i.maxWidth!==void 0&&r.set(l.maxWidth,i.maxWidth)}const o=r.toString();return o===""?n:`${n}?${o}`},_t=(e,t)=>Object.keys(e.views).find(r=>e.views[r]===t),Ot=(e,t,r)=>{const n=de(e),[o]=n;if(o===void 0)throw new RangeError("[markdown-explorer] the configuration has no source");const i=gt(n,o,r),a=i===null?o:i,c=m=>({kind:"redirect",href:ge(e,m),location:m}),s=()=>c({view:"tree",source:a,doc:null,overrides:{},markup:!1});if(t===void 0||t==="")return s();const h=t.indexOf("/"),A=h<0?t:t.slice(0,h),L=h<0?null:t.slice(h+1),g=_t(e,A);if(g===void 0)return s();if(g==="multi"){const m=r.getAll(l.doc),w=ue(e,m),P=r.getAll(l.maximized),[C]=P,v=P.length===1&&C!==void 0&&w.includes(C)?C:null,M=r.getAll(l.markup),R=w.filter(_=>M.includes(_)),Ee=R.length===M.length&&R.every((_,$)=>_===M[$]);return L===null&&i!==null&&w.length===m.length&&w.every((_,$)=>_===m[$])&&(P.length===0||v!==null)&&Ee?{kind:"location",location:{view:"multi",source:a,docs:w,maximized:v,markup:R}}:c({view:"multi",source:a,docs:w,maximized:v,markup:R})}const u=L===null?null:ft(L);if(u!==null&&!N.isAcceptableDocumentPath(u))return s();const y=Et(e,r),T=u!==null&&r.get(l.markup)===se;if(g==="single"){if(u===null)return s();const m=wt(r);return i===null?c({view:g,source:a,doc:u,overrides:y,embed:m,markup:T}):{kind:"location",location:{view:g,source:a,doc:u,overrides:y,embed:m,markup:T}}}return i===null?c({view:g,source:a,doc:u,overrides:y,markup:T}):{kind:"location",location:{view:g,source:a,doc:u,overrides:y,markup:T}}};exports.ASSUMED_ROOT_FONT_PIXELS=Le;exports.COARSE_TARGET_PIXELS=Me;exports.COLUMN_MIN_MEASURE=je;exports.CONTROL_BLOCK_PIXELS=ve;exports.DEFAULT_TREE_SETTINGS=z;exports.DEFAULT_VIEW_SLUGS=V;exports.EXPAND_ALL_DEPTH_LIMITS=re;exports.EXPAND_ALL_FOLDER_LIMITS=te;exports.EXPLORER_DEFAULT_PERCENT=ke;exports.EXPLORER_MAX_PERCENT=X;exports.EXPLORER_MIN_REM=Z;exports.EXPLORER_MULTI_DEFAULT_PERCENT=Ae;exports.EXPLORER_WIDTH_PERSIST_DELAY_MS=Ue;exports.FINE_TARGET_PIXELS=$e;exports.GOLDEN_RATIO=f;exports.MULTI_VIEW_COLUMN_LIMITS=ee;exports.MULTI_VIEW_PANEL_LIMITS=Q;exports.NAME_COLLATOR=D;exports.NO_TREE_SETTING_CHANGES=j;exports.PANEL_MAX_BLOCK_RATIO=De;exports.PANEL_MIN_BLOCK_RATIO=ze;exports.PREFETCH_DWELL_MS=Xe;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=ne;exports.SPLIT_HANDLE_PIXELS=Pe;exports.advanceTreeSetting=_e;exports.applyTreeSettingChanges=ye;exports.canonicalMultiDocuments=ue;exports.columnGroups=He;exports.createEntryComparator=Ne;exports.defineExplorerConfig=oe;exports.documentStyleNames=mt;exports.explorerHref=ge;exports.explorerMinPixels=Y;exports.explorerSheetBelowPixels=Fe;exports.formatTreeSettingValue=Oe;exports.isExplorerSourceId=ie;exports.isPlainObject=k;exports.parseViewSettings=Ye;exports.readCookieValue=Ze;exports.readTreeSettingChanges=be;exports.recordTreeSettingChange=Te;exports.replanVisibleColumns=We;exports.resolveExplorerLocation=Ot;exports.revalidateExplorerConfig=ct;exports.serializeTreeSettingChanges=Re;exports.viewSettingsCookieString=tt;exports.visibleTreeSettingDescriptors=he;exports.withExplorerSources=dt;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-sNJrKoGN.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-DJ_FUtYM.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 p } from "node-diff3";
2
- import { C, d as R, e as u } from "./index-CfcJEnrC.js";
2
+ import { C, d as R, e as u } from "./index-BPj19kIo.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 };