@aiquants/markdown-explorer 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +8 -4
  3. package/dist/{EditSurface-sUNqYw9o.js → EditSurface-BYKUL-a1.js} +30 -30
  4. package/dist/{EditSurface-B1yD7ywF.cjs → EditSurface-wXPvuB2n.cjs} +2 -2
  5. package/dist/{ExplorerSplit-pClUl3-e.js → ExplorerSplit-Bz-1G42e.js} +94 -94
  6. package/dist/{ExplorerSplit-Bn3ZnEMZ.cjs → ExplorerSplit-CLxr4_0K.cjs} +1 -1
  7. package/dist/MultiLayout-Coc-HQUb.cjs +1 -0
  8. package/dist/{MultiLayout-B-ft4_Vs.js → MultiLayout-DpxzsXKz.js} +167 -168
  9. package/dist/NativeScrollBar-CDgYgxXK.cjs +1 -0
  10. package/dist/{NativeScrollBar-ByawerpG.js → NativeScrollBar-DLdveoaN.js} +6 -7
  11. package/dist/{TreeLayout-DjIVKBG4.js → TreeLayout-C8TuS9ue.js} +9 -9
  12. package/dist/{TreeLayout-CXHbKdxy.cjs → TreeLayout-CJrJNZHq.cjs} +1 -1
  13. package/dist/{index-BNAkC0g3.js → index-CdYr9OQ-.js} +850 -845
  14. package/dist/index-CjyRD7qg.cjs +15 -0
  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-DhHzRcAI.js → merge-BQgbDcHR.js} +1 -1
  20. package/dist/{merge-BBU1pDoT.cjs → merge-DRLuveD9.cjs} +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-B2A6CmmI.js +13 -0
  25. package/dist/tapScrollCircle-qD8iSmfq.cjs +1 -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 +4 -1
  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
@@ -1,15 +1,14 @@
1
- import { jsxs as ie, jsx as N } from "react/jsx-runtime";
2
- import { createContext as Je, use as ke, useRef as q, useState as $, useLayoutEffect as F, useMemo as D, useSyncExternalStore as Xe, useCallback as R, memo as Ze, useEffect as U, useImperativeHandle as Qe } from "react";
3
- import { n as ce, e as Ae, o as en, P as nn, q as tn } from "./location-BNFdxzhn.js";
4
- import { I as on, u as J, J as rn, K as ln, D as sn, f as an, N as cn, L as V, e as Le, M as un, O as Ie } from "./index-BNAkC0g3.js";
5
- import { S as dn, a as mn, b as fn } from "./ExplorerSplit-pClUl3-e.js";
6
- import { SCROLL_AREA_SELECTOR as Re, SCROLL_ROOT_SELECTOR as te, PANEL_ACTION_ATTRIBUTE as he, generateColumnIds as pn, sortColumnIds as De, generateColumnId as _e, NO_PANEL_DRAG_ATTRIBUTE as gn, useDragDropColumns as hn, DEFAULT_DEBUG_CONFIG as ve, DragDropLayout as vn } from "@aiquants/drag-drop-panels";
7
- import { useNavigate as wn, useLocation as yn } from "react-router";
8
- import { s as Sn, r as xn, w as En } from "./storage-CmGHg7OA.js";
9
- import { H as On, i as bn } from "./dataRoute-DLhQfdoW.js";
10
- import { createPortal as Pn } from "react-dom";
11
- import { HostedScrollArea as Cn } from "@aiquants/markdown";
12
- import { N as Tn } from "./scrollBarGeometry-DOBdGNV-.js";
1
+ import { jsxs as ie, jsx as M } from "react/jsx-runtime";
2
+ import { createContext as Je, use as ke, useRef as q, useState as $, useLayoutEffect as F, useMemo as D, useSyncExternalStore as Xe, useCallback as R, memo as Qe, useEffect as U, useImperativeHandle as Ze } from "react";
3
+ import { n as ce, e as Ae, o as en, P as nn, q as tn } from "./location-CKuabtKl.js";
4
+ import { K as on, u as J, L as rn, M as ln, D as sn, h as an, e as cn, O as V, g as Le, Q as un, N as dn, R as Ie, S as mn } from "./index-CdYr9OQ-.js";
5
+ import { S as fn, a as pn, b as gn } from "./ExplorerSplit-Bz-1G42e.js";
6
+ import { SCROLL_AREA_SELECTOR as Re, SCROLL_ROOT_SELECTOR as te, PANEL_ACTION_ATTRIBUTE as he, generateColumnIds as hn, sortColumnIds as De, generateColumnId as _e, NO_PANEL_DRAG_ATTRIBUTE as vn, useDragDropColumns as wn, DEFAULT_DEBUG_CONFIG as ve, DragDropLayout as yn } from "@aiquants/drag-drop-panels";
7
+ import { useNavigate as Sn, useLocation as xn } from "react-router";
8
+ import { s as En, r as On, w as bn } from "./storage-CmGHg7OA.js";
9
+ import { H as Pn, i as Cn } from "./dataRoute-DLhQfdoW.js";
10
+ import { createPortal as Tn } from "react-dom";
11
+ import { HostedScrollArea as Mn } from "@aiquants/markdown";
13
12
  const Nn = () => {
14
13
  const e = /* @__PURE__ */ new Map();
15
14
  return {
@@ -27,20 +26,20 @@ const Nn = () => {
27
26
  const e = ke(ze);
28
27
  if (e === null) throw new Error("[markdown-explorer] multi-view panels must be rendered inside the multi-view stage");
29
28
  return e;
30
- }, Mn = (e, n) => {
29
+ }, kn = (e, n) => {
31
30
  const t = e.pendingHashes.get(n);
32
31
  return t === void 0 ? null : t;
33
- }, kn = 0xcbf29ce484222325n, An = 0x100000001b3n, Ln = (1n << 64n) - 1n, In = (1n << 53n) - 1n, Rn = new TextEncoder(), Dn = (e) => {
34
- let n = kn;
35
- for (const t of Rn.encode(e))
36
- n = (n ^ BigInt(t)) * An & Ln;
37
- return Number(n & In);
38
- }, oe = 256, _n = (e) => `aqmx-p-${Dn(e).toString(36)}`, He = (e, n) => {
39
- const t = _n(e);
32
+ }, An = 0xcbf29ce484222325n, Ln = 0x100000001b3n, In = (1n << 64n) - 1n, Rn = (1n << 53n) - 1n, Dn = new TextEncoder(), _n = (e) => {
33
+ let n = An;
34
+ for (const t of Dn.encode(e))
35
+ n = (n ^ BigInt(t)) * Ln & In;
36
+ return Number(n & Rn);
37
+ }, oe = 256, zn = (e) => `aqmx-p-${_n(e).toString(36)}`, He = (e, n) => {
38
+ const t = zn(e);
40
39
  let o = t;
41
40
  for (let r = 2; n.has(o); r += 1) o = `${t}-${String(r)}`;
42
41
  return o;
43
- }, zn = /* @__PURE__ */ new Map(), Hn = (e, n = zn) => {
42
+ }, Hn = /* @__PURE__ */ new Map(), Bn = (e, n = Hn) => {
44
43
  const t = new Set(e.flatMap((r) => n.get(r) ?? [])), o = /* @__PURE__ */ new Map();
45
44
  for (const r of e) {
46
45
  const l = n.get(r) ?? He(r, t);
@@ -67,7 +66,7 @@ const Nn = () => {
67
66
  }
68
67
  for (const r of o) t[qe(t, n)]?.push(r);
69
68
  return t;
70
- }, Bn = (e, n) => ce(e.length, n).map(([t, o]) => e.slice(t, o).flat()), qn = (e, n, t) => {
69
+ }, qn = (e, n) => ce(e.length, n).map(([t, o]) => e.slice(t, o).flat()), Fn = (e, n, t) => {
71
70
  const [o, r] = n, l = r - o, a = e.length, c = Array.from({ length: l }, (x, d) => {
72
71
  const h = [0];
73
72
  for (const f of e) h.push((h.at(-1) ?? 0) + (t(f) === o + d ? 1 : 0));
@@ -81,10 +80,10 @@ const Nn = () => {
81
80
  P && T && f > (P[d] ?? Number.NEGATIVE_INFINITY) && (P[d] = f, T[d] = h);
82
81
  }
83
82
  const O = Array.from({ length: l }, () => []);
84
- let M = a;
83
+ let N = a;
85
84
  for (let x = l; x > 0; x -= 1) {
86
- const d = v[x]?.[M] ?? 0;
87
- O[x - 1] = e.slice(d, M), M = d;
85
+ const d = v[x]?.[N] ?? 0;
86
+ O[x - 1] = e.slice(d, N), N = d;
88
87
  }
89
88
  return O;
90
89
  }, Fe = (e, n) => {
@@ -97,7 +96,7 @@ const Nn = () => {
97
96
  o.delete(r);
98
97
  }
99
98
  return { docs: t, columnOf: o };
100
- }, Fn = (e, n, t, o) => {
99
+ }, Vn = (e, n, t, o) => {
101
100
  if (e.docs.includes(n)) return { state: e, outcome: "existing" };
102
101
  if (e.docs.length >= o) return { state: e, outcome: "rejected" };
103
102
  const r = re(e, t), l = Be(e, n, t.logical) ?? qe(r, t);
@@ -112,12 +111,12 @@ const Nn = () => {
112
111
  o.delete(n);
113
112
  const r = new Map(e.panelIds);
114
113
  return r.delete(n), { ...e, docs: e.docs.filter((l) => l !== n), hidden: t, markup: o, panelIds: r, maximized: e.maximized === n ? null : e.maximized };
115
- }, Vn = (e, n, t, o) => {
114
+ }, $n = (e, n, t, o) => {
116
115
  if (e.hidden.has(n)) return { state: $e(e, n, !1), outcome: "shown" };
117
116
  if (e.docs.includes(n)) return { state: Ve(e, n), outcome: "closed" };
118
- const r = Fn(e, n, t, o);
117
+ const r = Vn(e, n, t, o);
119
118
  return { state: r.state, outcome: r.outcome === "rejected" ? "rejected" : "opened" };
120
- }, $n = (e, n, t) => {
119
+ }, Un = (e, n, t) => {
121
120
  if (n === t || !e.docs.includes(n)) return { state: e, outcome: "ignored" };
122
121
  if (e.docs.includes(t)) return { state: e, outcome: "existing" };
123
122
  const o = new Map(e.columnOf), r = o.get(n);
@@ -136,11 +135,11 @@ const Nn = () => {
136
135
  if (!e.docs.includes(n) || e.hidden.has(n) === t) return e;
137
136
  const o = new Set(e.hidden);
138
137
  return t ? o.add(n) : o.delete(n), { ...e, hidden: o, maximized: t && e.maximized === n ? null : e.maximized };
139
- }, Un = (e, n, t) => {
138
+ }, jn = (e, n, t) => {
140
139
  if (!e.docs.includes(n) || e.markup.has(n) === t) return e;
141
140
  const o = new Set(e.markup);
142
141
  return t ? o.add(n) : o.delete(n), { ...e, markup: o };
143
- }, jn = (e, n) => {
142
+ }, Gn = (e, n) => {
144
143
  if (e.maximized === n || n !== null && !e.docs.includes(n)) return e;
145
144
  if (n === null || !e.hidden.has(n)) return { ...e, maximized: n };
146
145
  const t = new Set(e.hidden);
@@ -153,8 +152,8 @@ const Nn = () => {
153
152
  for (const [s, v] of c.entries()) {
154
153
  const S = (n[s] ?? []).filter((O) => l.has(O) && !a.has(O));
155
154
  for (const O of S) a.add(O);
156
- for (const [O, M] of qn(S, v, (x) => r.get(x)).entries())
157
- m[v[0] + O]?.push(...M);
155
+ for (const [O, N] of Fn(S, v, (x) => r.get(x)).entries())
156
+ m[v[0] + O]?.push(...N);
158
157
  }
159
158
  for (const s of e.docs)
160
159
  a.has(s) || m[r.get(s) ?? 0]?.push(s);
@@ -167,7 +166,7 @@ const Nn = () => {
167
166
  columnOf: e.stored.columnOf,
168
167
  hidden: new Set([...e.stored.hidden].filter((l) => o.has(l) && l !== r)),
169
168
  markup: new Set(e.markup.filter((l) => o.has(l))),
170
- panelIds: Hn(t, e.panelIds)
169
+ panelIds: Bn(t, e.panelIds)
171
170
  };
172
171
  }, we = (e, n) => {
173
172
  if (e.docs.every((o) => e.columnOf.has(o))) return e;
@@ -180,40 +179,40 @@ const Nn = () => {
180
179
  t.delete(o);
181
180
  }
182
181
  return { ...e, columnOf: t };
183
- }, Ue = 1, G = Object.freeze({ columnOf: /* @__PURE__ */ new Map(), hidden: /* @__PURE__ */ new Set() }), Gn = (e, n) => {
184
- if (e === null || e === "") return G;
182
+ }, Ue = 1, Y = Object.freeze({ columnOf: /* @__PURE__ */ new Map(), hidden: /* @__PURE__ */ new Set() }), Wn = (e, n) => {
183
+ if (e === null || e === "") return Y;
185
184
  let t;
186
185
  try {
187
186
  t = JSON.parse(e);
188
187
  } catch {
189
- return G;
188
+ return Y;
190
189
  }
191
- if (t === null || typeof t != "object" || Array.isArray(t)) return G;
190
+ if (t === null || typeof t != "object" || Array.isArray(t)) return Y;
192
191
  const o = t;
193
- if (o.v !== Ue) return G;
192
+ if (o.v !== Ue) return Y;
194
193
  const r = /* @__PURE__ */ new Map();
195
194
  if (Array.isArray(o.columnOf))
196
195
  for (const a of o.columnOf.slice(-oe))
197
196
  Array.isArray(a) && a.length === 2 && typeof a[0] == "string" && a[0] !== "" && Number.isInteger(a[1]) && a[1] >= 0 && a[1] < n && (r.delete(a[0]), r.set(a[0], a[1]));
198
197
  const l = new Set(Array.isArray(o.hidden) ? o.hidden.filter((a) => typeof a == "string" && a !== "") : []);
199
198
  return { columnOf: r, hidden: l };
200
- }, Wn = (e) => JSON.stringify({
199
+ }, Kn = (e) => JSON.stringify({
201
200
  v: Ue,
202
201
  columnOf: [...e.columnOf.entries()].slice(-oe),
203
202
  hidden: e.docs.filter((n) => e.hidden.has(n))
204
203
  }), de = (e, n) => {
205
204
  const t = e.get(n);
206
- return t === void 0 ? On(n) : t;
205
+ return t === void 0 ? Pn(n) : t;
207
206
  }, X = (e) => {
208
207
  const n = /* @__PURE__ */ new Map();
209
208
  for (const [t, o] of e.panelIds) n.set(o, t);
210
209
  return n;
211
210
  }, ye = (e) => {
212
- if (!bn(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(e.slice(0, 80))}`);
213
- }, Kn = ({ config: e, location: n, writeUrl: t, persist: o }) => {
211
+ if (!Cn(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(e.slice(0, 80))}`);
212
+ }, Jn = ({ config: e, location: n, writeUrl: t, persist: o }) => {
214
213
  const { maxPanels: r, columns: l } = e.multiView, a = on(), c = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
215
214
  let s = {
216
- layout: le({ docs: n.docs, maximized: n.maximized, markup: n.markup, stored: G }, r),
215
+ layout: le({ docs: n.docs, maximized: n.maximized, markup: n.markup, stored: Y }, r),
217
216
  source: n.source,
218
217
  visibleColumns: l,
219
218
  ready: !1,
@@ -221,7 +220,7 @@ const Nn = () => {
221
220
  titles: /* @__PURE__ */ new Map(),
222
221
  pendingHashes: /* @__PURE__ */ new Map()
223
222
  }, v = !1;
224
- const S = (i) => v ? we(i, { logical: l, visible: s.visibleColumns }) : i, O = (i, p) => Ae(e, { view: "multi", source: i, docs: p.docs, maximized: p.maximized, markup: p.markup }), M = (i) => ({ docs: i.docs, maximized: i.maximized, markup: [...i.markup] });
223
+ const S = (i) => v ? we(i, { logical: l, visible: s.visibleColumns }) : i, O = (i, p) => Ae(e, { view: "multi", source: i, docs: p.docs, maximized: p.maximized, markup: p.markup }), N = (i) => ({ docs: i.docs, maximized: i.maximized, markup: [...i.markup] });
225
224
  let x = O(n.source, n), d = n.source, h = x;
226
225
  const f = [], P = [];
227
226
  let T = null;
@@ -232,10 +231,10 @@ const Nn = () => {
232
231
  s = { ...s, ...i }, a.emit();
233
232
  }, w = () => {
234
233
  if (!s.ready) return;
235
- const i = Wn(s.layout);
234
+ const i = Kn(s.layout);
236
235
  i !== T && (T = i, o(i));
237
236
  }, g = (i, p, C) => {
238
- const I = O(i, M(p));
237
+ const I = O(i, N(p));
239
238
  I !== x && (x = I, d = i, f.push(I), t(I, C));
240
239
  }, y = (i) => {
241
240
  const p = new Set(i.panelIds.values());
@@ -249,20 +248,20 @@ const Nn = () => {
249
248
  subscribe: a.subscribe,
250
249
  toggle: (i) => {
251
250
  ye(i);
252
- const { state: p, outcome: C } = Vn(s.layout, i, L(), r);
251
+ const { state: p, outcome: C } = $n(s.layout, i, L(), r);
253
252
  return k(p), C;
254
253
  },
255
254
  close: (i) => k(Ve(s.layout, i)),
256
255
  navigate: (i, p) => {
257
256
  ye(p);
258
- const { state: C, outcome: I } = $n(s.layout, i, p);
257
+ const { state: C, outcome: I } = Un(s.layout, i, p);
259
258
  if (I !== "navigated") return I;
260
259
  const E = C.panelIds.get(p);
261
260
  return E !== void 0 && (c.delete(E), m.delete(E)), k(C), I;
262
261
  },
263
262
  setHidden: (i, p) => k($e(s.layout, i, p)),
264
- maximize: (i) => k(jn(s.layout, i)),
265
- setMarkup: (i, p) => k(Un(s.layout, i, p)),
263
+ maximize: (i) => k(Gn(s.layout, i)),
264
+ setMarkup: (i, p) => k(jn(s.layout, i, p)),
266
265
  arrange: (i) => k(Yn(s.layout, i, { logical: l, visible: i.length })),
267
266
  changeSource: (i) => {
268
267
  g(i, s.layout, "push");
@@ -330,32 +329,32 @@ const Nn = () => {
330
329
  }, _ = (e, n) => {
331
330
  const t = () => n(e.getSnapshot());
332
331
  return Xe(e.subscribe, t, t);
333
- }, Jn = (e) => {
334
- const { config: n, storageNamespace: t } = J(), o = wn(), r = q(o), l = Sn(t).multiLayout, [a] = $(
335
- () => Kn({
332
+ }, Xn = (e) => {
333
+ const { config: n, storageNamespace: t } = J(), o = Sn(), r = q(o), l = En(t).multiLayout, [a] = $(
334
+ () => Jn({
336
335
  config: n,
337
336
  location: e,
338
337
  writeUrl: (s, v) => {
339
338
  r.current(s, rn(v === "replace" ? "browse" : "switch-source"));
340
339
  },
341
- persist: (s) => En(l, s)
340
+ persist: (s) => bn(l, s)
342
341
  })
343
342
  );
344
343
  F(() => {
345
344
  r.current = o;
346
345
  }, [o]);
347
- const c = yn(), m = D(() => ({ location: e, navigated: c }), [e, c]);
346
+ const c = xn(), m = D(() => ({ location: e, navigated: c }), [e, c]);
348
347
  return F(() => {
349
348
  a.observeLocation(m.location);
350
349
  }, [a, m]), F(() => {
351
- a.loadStored(Gn(xn(l), n.multiView.columns));
350
+ a.loadStored(Wn(On(l), n.multiView.columns));
352
351
  }, [a, l, n]), a;
353
- }, Xn = (e) => {
352
+ }, Qn = (e) => {
354
353
  const n = e.closest(Re);
355
354
  if (n === null) throw new Error("[markdown-explorer] a panel's document region is not inside the panel's scroll area");
356
355
  return n;
357
356
  }, Zn = ({ docPath: e, panelId: n, maximized: t, title: o, onContentShown: r }) => {
358
- const { store: l, followLink: a, revealInPanel: c } = ue(), { announcer: m } = J(), s = _(l, (u) => Mn(u, n)), v = _(l, (u) => u.layout.markup.has(e)), S = R((u, w) => a(n, e, u, w), [a, n, e]), O = R(() => l.setPendingHash(n, null), [l, n]), M = D(() => ({ read: (u) => l.imageViewOf(n, u), save: (u, w) => l.saveImageView(n, u, w) }), [l, n]), x = R(
357
+ const { store: l, followLink: a, revealInPanel: c } = ue(), { announcer: m } = J(), s = _(l, (u) => kn(u, n)), v = _(l, (u) => u.layout.markup.has(e)), S = R((u, w) => a(n, e, u, w), [a, n, e]), O = R(() => l.setPendingHash(n, null), [l, n]), N = D(() => ({ read: (u) => l.imageViewOf(n, u), save: (u, w) => l.saveImageView(n, u, w) }), [l, n]), x = R(
359
358
  (u, w) => {
360
359
  w.kind !== "failure" && l.setTitle(u, w.name), r(u);
361
360
  },
@@ -365,38 +364,38 @@ const Nn = () => {
365
364
  l.whenUrlRendered(() => m.announce(u));
366
365
  },
367
366
  [l, m]
368
- ), h = D(() => ({ scrollerOf: Xn, reveal: (u) => c(n, u) }), [c, n]), f = D(
367
+ ), h = D(() => ({ scrollerOf: Qn, reveal: (u) => c(n, u) }), [c, n]), f = D(
369
368
  () => ({ kind: "panel", maximized: t, onDocumentLink: S, pendingHash: s, onHashConsumed: O, announceFailure: d, paneScroll: h }),
370
369
  [t, S, s, O, d, h]
371
370
  ), P = D(() => ({ kind: "panel", documentName: o, maximized: t }), [o, t]), T = R(() => l.setMarkup(e, !l.getSnapshot().layout.markup.has(e)), [l, e]), A = D(() => ({ shown: v, toggle: T }), [v, T]);
372
- return /* @__PURE__ */ ie(ln, { value: M, children: [
373
- /* @__PURE__ */ N(sn, { path: e, placement: P, markup: A }),
374
- /* @__PURE__ */ N(an, { path: e, absence: cn, markup: v, variant: f, onDocumentShown: x })
371
+ return /* @__PURE__ */ ie(ln, { value: N, children: [
372
+ /* @__PURE__ */ M(sn, { path: e, placement: P, markup: A }),
373
+ /* @__PURE__ */ M(an, { path: e, absence: cn, markup: v, variant: f, onDocumentShown: x })
375
374
  ] });
376
- }, Se = () => typeof HTMLElement < "u" && typeof HTMLElement.prototype.showPopover == "function" && typeof HTMLElement.prototype.hidePopover == "function", me = "data-aqmx-column-probe", Q = "data-panel-id", ae = "--aqmx-multi-panel-chrome", Qn = (e) => e === "normal" ? 0 : V(e), et = (e, n) => {
375
+ }, Se = () => typeof HTMLElement < "u" && typeof HTMLElement.prototype.showPopover == "function" && typeof HTMLElement.prototype.hidePopover == "function", me = "data-aqmx-column-probe", Z = "data-panel-id", ae = "--aqmx-multi-panel-chrome", et = (e) => e === "normal" ? 0 : V(e), nt = (e, n) => {
377
376
  const t = e.querySelector(te)?.firstElementChild, o = e.querySelector(`[${me}]`), r = o instanceof HTMLElement ? o.getBoundingClientRect().width : Number.NaN;
378
377
  if (!(t instanceof HTMLElement))
379
378
  return { plan: { trackInlineSize: Number.NaN, gap: Number.NaN, minColumnInlineSize: r, logicalColumns: n }, stageBlockSize: Number.NaN };
380
379
  const l = getComputedStyle(t), a = t.clientWidth - V(l.paddingLeft) - V(l.paddingRight), c = t.clientHeight - V(l.paddingTop) - V(l.paddingBottom);
381
- return { plan: { trackInlineSize: a, gap: Qn(l.columnGap), minColumnInlineSize: r, logicalColumns: n }, stageBlockSize: c };
382
- }, nt = (e, n) => {
380
+ return { plan: { trackInlineSize: a, gap: et(l.columnGap), minColumnInlineSize: r, logicalColumns: n }, stageBlockSize: c };
381
+ }, tt = (e, n) => {
383
382
  if (e.getClientRects().length === 0) return Number.NaN;
384
383
  const t = getComputedStyle(e);
385
384
  return n.getBoundingClientRect().top - e.getBoundingClientRect().top + V(t.paddingBottom) + V(t.borderBottomWidth);
386
- }, ee = "data-aqmx-panel-frame", xe = "--aqmx-multi-panel-pinned-block-size", tt = (e) => {
385
+ }, ee = "data-aqmx-panel-frame", xe = "--aqmx-multi-panel-pinned-block-size", ot = (e) => {
387
386
  const { docPath: n, panelId: t } = e;
388
387
  if (typeof n != "string" || typeof t != "string") throw new TypeError("[markdown-explorer] a multi-view panel needs string docPath and panelId props");
389
388
  return { docPath: n, panelId: t };
390
- }, ot = (e) => {
389
+ }, rt = (e) => {
391
390
  const n = getComputedStyle(e), t = Number.parseFloat(n.lineHeight);
392
391
  return Number.isFinite(t) ? t : Number.parseFloat(n.fontSize);
393
- }, rt = (e, n, t) => e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? e.deltaY * n.clientHeight : e.deltaMode !== WheelEvent.DOM_DELTA_LINE ? e.deltaY : e.deltaY * t(n), W = (e) => {
392
+ }, lt = (e, n, t) => e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? e.deltaY * n.clientHeight : e.deltaMode !== WheelEvent.DOM_DELTA_LINE ? e.deltaY : e.deltaY * t(n), W = (e) => {
394
393
  const n = e.closest(Re);
395
394
  return n instanceof HTMLElement ? n : null;
396
395
  }, je = (e) => {
397
396
  const n = e.firstElementChild;
398
397
  return n instanceof HTMLElement && getComputedStyle(n).position === "sticky" ? n : null;
399
- }, Ye = (e, n) => {
398
+ }, Ge = (e, n) => {
400
399
  const t = n.getBoundingClientRect().top, o = je(e);
401
400
  return o === null ? t : Math.max(t, o.getBoundingClientRect().bottom);
402
401
  }, Ee = (e, n) => {
@@ -406,8 +405,8 @@ const Nn = () => {
406
405
  (e[r]?.getBoundingClientRect().bottom ?? Number.NEGATIVE_INFINITY) > n ? o = r : t = r + 1;
407
406
  }
408
407
  return t < e.length ? t : -1;
409
- }, lt = (e, n) => {
410
- const t = Ye(e, n), o = [];
408
+ }, st = (e, n) => {
409
+ const t = Ge(e, n), o = [];
411
410
  let r = e;
412
411
  for (let a = Ee([...r.children], t); a >= 0; a = Ee([...r.children], t)) {
413
412
  const c = r.children[a];
@@ -422,11 +421,11 @@ const Nn = () => {
422
421
  for (const m of t.anchor.path) o = o?.children[m];
423
422
  if (o === void 0) return;
424
423
  const r = o.getBoundingClientRect(), { offset: l, height: a } = t.anchor, c = l < 0 && a > 0 ? l / a * r.height : l;
425
- n.scrollTop += r.top - Ye(e, n) - c;
426
- }, st = Object.freeze(["data-testid", "aria-label", "title", "href", "id", "name"]), Ge = (e) => {
424
+ n.scrollTop += r.top - Ge(e, n) - c;
425
+ }, it = Object.freeze(["data-testid", "aria-label", "title", "href", "id", "name"]), Ye = (e) => {
427
426
  const n = e.getAttribute(he);
428
- return JSON.stringify(n === null ? [e.tagName, ...st.map((t) => e.getAttribute(t))] : [e.tagName, he, n]);
429
- }, it = (e, n) => {
427
+ return JSON.stringify(n === null ? [e.tagName, ...it.map((t) => e.getAttribute(t))] : [e.tagName, he, n]);
428
+ }, at = (e, n) => {
430
429
  if (n === null || !e.contains(n)) return null;
431
430
  const t = [];
432
431
  for (let o = n; o !== e; ) {
@@ -434,21 +433,21 @@ const Nn = () => {
434
433
  if (r === null) return null;
435
434
  t.unshift([...r.children].indexOf(o)), o = r;
436
435
  }
437
- return { path: t, signature: Ge(n) };
438
- }, at = (e, n, t) => {
436
+ return { path: t, signature: Ye(n) };
437
+ }, ct = (e, n, t) => {
439
438
  let o = e;
440
439
  for (const r of t.path) o = o?.children[r];
441
- o instanceof HTMLElement && Ge(o) === t.signature && un(o) || n.focus({ preventScroll: !0 });
442
- }, ct = (e, n, t) => {
440
+ o instanceof HTMLElement && Ye(o) === t.signature && un(o) || n.focus({ preventScroll: !0 });
441
+ }, ut = (e, n, t) => {
443
442
  if (e.shiftKey || Math.abs(e.deltaX) > Math.abs(e.deltaY)) return;
444
443
  const o = e.ctrlKey || e.metaKey, r = o ? W(n) : n.closest(te);
445
444
  if (!(r instanceof HTMLElement)) return;
446
- const l = rt(e, r, t);
447
- (o || ut(r, l)) && (e.preventDefault(), r.scrollTop += l);
448
- }, ut = (e, n) => n < 0 ? e.scrollTop > 0 : n > 0 ? Math.ceil(e.scrollTop + e.clientHeight) < e.scrollHeight : !1, dt = (e) => e.scrollHeight > e.clientHeight, mt = (e, n, t) => {
445
+ const l = lt(e, r, t);
446
+ (o || dt(r, l)) && (e.preventDefault(), r.scrollTop += l);
447
+ }, dt = (e, n) => n < 0 ? e.scrollTop > 0 : n > 0 ? Math.ceil(e.scrollTop + e.clientHeight) < e.scrollHeight : !1, mt = (e) => e.scrollHeight > e.clientHeight, ft = (e, n, t) => {
449
448
  let o = Number.NaN, r = Number.NaN;
450
449
  const l = je(t), a = () => {
451
- const s = nt(e, n);
450
+ const s = tt(e, n);
452
451
  if (!Number.isFinite(s)) return;
453
452
  const v = l === null ? 0 : l.getBoundingClientRect().height;
454
453
  v !== r && (r = v, t.style.setProperty(xe, `${String(v)}px`));
@@ -465,20 +464,20 @@ const Nn = () => {
465
464
  return m?.observe(e), m?.observe(n), l !== null && m?.observe(l), () => {
466
465
  m?.disconnect(), c !== null && cancelAnimationFrame(c), e.style.removeProperty(ae), t.style.removeProperty(xe);
467
466
  };
468
- }, ft = (e) => {
469
- const { docPath: n, panelId: t } = tt(e), { store: o, Body: r, maximize: l, focusCarry: a } = ue(), c = _(o, (d) => d.layout.maximized === n), m = _(o, (d) => de(d.titles, n)), s = q(null), v = q(null), S = q(null), O = q(null);
467
+ }, pt = (e) => {
468
+ const { docPath: n, panelId: t } = ot(e), { store: o, Body: r, maximize: l, focusCarry: a } = ue(), c = _(o, (d) => d.layout.maximized === n), m = _(o, (d) => de(d.titles, n)), s = q(null), v = q(null), S = q(null), O = q(null);
470
469
  U(() => {
471
470
  const d = s.current, h = d === null ? null : W(d);
472
471
  if (d === null || h === null || c) return;
473
472
  const f = /* @__PURE__ */ new Map(), P = (g) => {
474
473
  const y = f.get(g);
475
474
  if (y !== void 0) return y;
476
- const k = ot(g);
475
+ const k = rt(g);
477
476
  return f.set(g, k), k;
478
- }, T = (g) => ct(g, d, P);
477
+ }, T = (g) => ut(g, d, P);
479
478
  let A = !1;
480
479
  const u = () => {
481
- const g = dt(h);
480
+ const g = mt(h);
482
481
  g !== A && (A = g, g ? d.addEventListener("wheel", T, { capture: !0, passive: !1 }) : d.removeEventListener("wheel", T, { capture: !0 }));
483
482
  };
484
483
  u();
@@ -487,9 +486,9 @@ const Nn = () => {
487
486
  w?.disconnect(), d.removeEventListener("wheel", T, { capture: !0 });
488
487
  };
489
488
  }, [c]), F(() => {
490
- const d = s.current, h = d === null ? null : W(d), f = d === null ? null : d.closest(`[${Q}]`);
489
+ const d = s.current, h = d === null ? null : W(d), f = d === null ? null : d.closest(`[${Z}]`);
491
490
  if (!(d === null || h === null || !(f instanceof HTMLElement)))
492
- return mt(f, h, d);
491
+ return ft(f, h, d);
493
492
  }, []), F(() => {
494
493
  const d = s.current, h = d === null ? null : W(d);
495
494
  if (d === null || h === null) return;
@@ -504,7 +503,7 @@ const Nn = () => {
504
503
  const g = O.current;
505
504
  if (O.current = null, g !== null && h.scrollTop === g || d.getBoundingClientRect().width !== A) return;
506
505
  const y = S.current;
507
- y !== null && o.saveReadingPosition(t, y, lt(d, h));
506
+ y !== null && o.saveReadingPosition(t, y, st(d, h));
508
507
  }));
509
508
  };
510
509
  h.addEventListener("scroll", u, { passive: !0 });
@@ -519,15 +518,15 @@ const Nn = () => {
519
518
  h.removeEventListener("scroll", u), w?.disconnect(), T !== null && cancelAnimationFrame(T);
520
519
  };
521
520
  }, [o, t, n]), F(() => {
522
- const d = s.current, h = d === null ? null : d.closest(`[${Q}]`);
521
+ const d = s.current, h = d === null ? null : d.closest(`[${Z}]`);
523
522
  if (d === null || h === null) return;
524
523
  const f = a.take(t);
525
- return f !== null && at(h, d, f), () => {
526
- const P = it(h, h.ownerDocument.activeElement);
524
+ return f !== null && ct(h, d, f), () => {
525
+ const P = at(h, h.ownerDocument.activeElement);
527
526
  P !== null && a.hold(t, P);
528
527
  };
529
528
  }, [a, t]);
530
- const M = R((d) => {
529
+ const N = R((d) => {
531
530
  const h = s.current, f = h === null ? null : W(h);
532
531
  if (h === null || f === null) return;
533
532
  const P = S.current;
@@ -536,7 +535,7 @@ const Nn = () => {
536
535
  v.current = null, T !== null && T.doc === d ? (Oe(h, f, T.position), O.current = f.scrollTop) : P !== null && P !== d && (f.scrollTop = 0);
537
536
  }, []), x = R(() => l(n), [l, n]);
538
537
  return (
539
- /* @__PURE__ */ N(
538
+ /* @__PURE__ */ M(
540
539
  "div",
541
540
  {
542
541
  ref: s,
@@ -549,18 +548,18 @@ const Nn = () => {
549
548
  "data-testid": "markdown-explorer-panel-frame",
550
549
  ...c ? Le : {},
551
550
  onDoubleClick: c ? void 0 : x,
552
- children: /* @__PURE__ */ N(r, { docPath: n, panelId: t, maximized: c, title: m, onContentShown: M })
551
+ children: /* @__PURE__ */ M(r, { docPath: n, panelId: t, maximized: c, title: m, onContentShown: N })
553
552
  }
554
553
  )
555
554
  );
556
- }, pt = Ze(ft), Z = (e, n) => {
555
+ }, gt = Qe(pt), Q = (e, n) => {
557
556
  const t = e.panelIds.get(n);
558
557
  if (t === void 0) throw new Error(`[markdown-explorer] the open document ${JSON.stringify(n)} has no panel id`);
559
558
  return t;
560
- }, be = (e) => Object.fromEntries(pn(e).map((n) => [n, []])), gt = (e, n) => {
561
- const t = Bn(re(e, n), n.visible);
562
- return Object.fromEntries(t.map((o, r) => [_e(r), o.map((l) => Z(e, l))]));
563
- }, ht = (e, n) => {
559
+ }, be = (e) => Object.fromEntries(hn(e).map((n) => [n, []])), ht = (e, n) => {
560
+ const t = qn(re(e, n), n.visible);
561
+ return Object.fromEntries(t.map((o, r) => [_e(r), o.map((l) => Q(e, l))]));
562
+ }, vt = (e, n) => {
564
563
  const t = X(e);
565
564
  return De(Object.keys(n)).map(
566
565
  (o) => (n[o] ?? []).flatMap((r) => {
@@ -568,7 +567,7 @@ const Nn = () => {
568
567
  return l === void 0 ? [] : [l];
569
568
  })
570
569
  );
571
- }, vt = (e) => ({
570
+ }, wt = (e) => ({
572
571
  switchToCustomDragMode: e.panelSwitchToCustomDrag,
573
572
  switchToNormalDragMode: e.panelSwitchToNormalDrag,
574
573
  hidePanel: e.panelHide,
@@ -591,7 +590,7 @@ const Nn = () => {
591
590
  emptyColumn: e.multiColumnEmpty,
592
591
  dropZone: e.multiColumnRegion,
593
592
  dropHere: e.panelDropHere
594
- }), wt = "--aqmx-multi-stage-bar-gutter", yt = Object.freeze({ [wt]: `${String(Tn)}px` }), St = Object.freeze({ blockSize: "100%" }), xt = Object.freeze({ [gn]: "", style: Object.freeze({ display: "flex" }) }), Et = (e) => /* @__PURE__ */ N("div", { ...xt, children: /* @__PURE__ */ N(Ie, { scroller: e, withCircle: !0 }) }), Ot = ({ props: e, children: n }) => /* @__PURE__ */ N(Cn, { scrollerProps: { ...e, style: St }, renderScrollBar: Et, children: n }), bt = (e) => /* @__PURE__ */ N(Ie, { scroller: e, withCircle: !1 }), fe = "--aqmx-stage-block", Pt = "--aqmx-multi-panel-body-floor", Ct = `calc(var(${fe}) * ${String(tn)})`, Tt = `max(calc(var(${fe}) * ${String(nn)}), calc(var(${ae}) + var(${Pt})))`, Nt = (e, n) => {
593
+ }), yt = "--aqmx-multi-stage-bar-gutter", St = Object.freeze({ [yt]: `${String(dn)}px` }), xt = Object.freeze({ blockSize: "100%", paddingInlineEnd: `${String(mn)}px` }), Et = Object.freeze({ [vn]: "", style: Object.freeze({ display: "flex" }) }), Ot = (e) => /* @__PURE__ */ M("div", { ...Et, children: /* @__PURE__ */ M(Ie, { scroller: e, withCircle: !0 }) }), bt = ({ props: e, children: n }) => /* @__PURE__ */ M(Mn, { scrollerProps: { ...e, style: xt }, renderScrollBar: Ot, children: n }), Pt = (e) => /* @__PURE__ */ M(Ie, { scroller: e, withCircle: !1 }), fe = "--aqmx-stage-block", Ct = "--aqmx-multi-panel-body-floor", Tt = `calc(var(${fe}) * ${String(tn)})`, Mt = `max(calc(var(${fe}) * ${String(nn)}), calc(var(${ae}) + var(${Ct})))`, Nt = (e, n) => {
595
594
  const t = Object.entries(e);
596
595
  return t.length !== Object.keys(n).length ? !1 : t.every(([o, r]) => {
597
596
  const l = n[o];
@@ -602,13 +601,13 @@ const Nn = () => {
602
601
  e.observe(o);
603
602
  for (let r = o.previousElementSibling; r !== null; r = r.previousElementSibling) e.observe(r);
604
603
  }
605
- }, Mt = (e) => {
604
+ }, kt = (e) => {
606
605
  const n = /* @__PURE__ */ new Map();
607
606
  for (let t = e.parentElement; t !== null; t = t.parentElement) n.set(t, { top: t.scrollTop, left: t.scrollLeft });
608
607
  return n;
609
608
  }, ne = (e, n, t) => {
610
609
  K.get(e)?.();
611
- const o = e.querySelector(`[${Q}="${n}"]`);
610
+ const o = e.querySelector(`[${Z}="${n}"]`);
612
611
  if (!(o instanceof HTMLElement)) return;
613
612
  const r = t !== null && o.contains(t) ? t : null;
614
613
  let l = /* @__PURE__ */ new Map();
@@ -616,7 +615,7 @@ const Nn = () => {
616
615
  if (!o.isConnected) return;
617
616
  o.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "instant" });
618
617
  const S = r?.isConnected === !0 ? r : o;
619
- S !== o && S.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "instant" }), l = Mt(S);
618
+ S !== o && S.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "instant" }), l = kt(S);
620
619
  };
621
620
  if (a(), typeof ResizeObserver > "u") return;
622
621
  const c = new ResizeObserver(a);
@@ -624,8 +623,8 @@ const Nn = () => {
624
623
  const { ownerDocument: m } = e, s = (S) => {
625
624
  const O = S.target === m ? m.scrollingElement : S.target;
626
625
  if (!(O instanceof Element)) return;
627
- const M = l.get(O);
628
- M !== void 0 && (O.scrollTop !== M.top || O.scrollLeft !== M.left) && v();
626
+ const N = l.get(O);
627
+ N !== void 0 && (O.scrollTop !== N.top || O.scrollLeft !== N.left) && v();
629
628
  }, v = () => {
630
629
  c.disconnect();
631
630
  for (const S of Pe) m.removeEventListener(S, v, !0);
@@ -637,7 +636,7 @@ const Nn = () => {
637
636
  const t = e.querySelector(`[${ee}="${n}"]`);
638
637
  return t instanceof HTMLElement ? (ne(e, n, null), t.focus({ preventScroll: !0 }), !0) : !1;
639
638
  }, pe = (e, n) => {
640
- const t = e.querySelector(`[${Q}="${n}"]`);
639
+ const t = e.querySelector(`[${Z}="${n}"]`);
641
640
  return t instanceof HTMLElement && t.contains(e.ownerDocument.activeElement);
642
641
  }, Te = (e, n) => {
643
642
  if (!pe(e, n)) return null;
@@ -645,7 +644,7 @@ const Nn = () => {
645
644
  if (o >= 0 && typeof r == "string") return { kind: "panel", panelId: r };
646
645
  const l = t[o - 1];
647
646
  return o > 0 && typeof l == "string" ? { kind: "panel", panelId: l } : { kind: "stage" };
648
- }, Ne = (e, n) => {
647
+ }, Me = (e, n) => {
649
648
  requestAnimationFrame(() => {
650
649
  const t = e.current;
651
650
  t !== null && (n.kind === "panel" && We(t, n.panelId) || t.focus({ preventScroll: !0 }));
@@ -655,7 +654,7 @@ const Nn = () => {
655
654
  const t = e.current;
656
655
  t !== null && We(t, n);
657
656
  });
658
- }, kt = (e, n, t) => {
657
+ }, At = (e, n, t) => {
659
658
  requestAnimationFrame(() => {
660
659
  const o = e.current;
661
660
  if (o === null) return;
@@ -664,13 +663,13 @@ const Nn = () => {
664
663
  const a = o.querySelector(`[${ee}="${n}"]`);
665
664
  a instanceof HTMLElement && a.focus({ preventScroll: !0 });
666
665
  });
667
- }, At = ({ store: e, stageRef: n }) => {
668
- const { config: t, labels: o, announcer: r, edits: l } = J(), { maximize: a } = ue(), c = t.multiView.columns, m = _(e, (E) => E.layout), s = _(e, (E) => E.visibleColumns), v = _(e, (E) => E.titles), S = _(e, (E) => E.layout.maximized !== null || E.splitDragging), [O, M] = $(!1), [x] = $(() => be(s)), d = D(() => vt(o), [o]), h = R(
666
+ }, Lt = ({ store: e, stageRef: n }) => {
667
+ const { config: t, labels: o, announcer: r, edits: l } = J(), { maximize: a } = ue(), c = t.multiView.columns, m = _(e, (E) => E.layout), s = _(e, (E) => E.visibleColumns), v = _(e, (E) => E.titles), S = _(e, (E) => E.layout.maximized !== null || E.splitDragging), [O, N] = $(!1), [x] = $(() => be(s)), d = D(() => wt(o), [o]), h = R(
669
668
  (E) => {
670
- e.arrange(ht(e.getSnapshot().layout, E));
669
+ e.arrange(vt(e.getSnapshot().layout, E));
671
670
  },
672
671
  [e]
673
- ), f = hn({ initialColumnPanels: x, initialPanelVisibility: {}, debugConfig: ve, onColumnPanelsChange: h }), { columnPanels: P, setColumnPanels: T } = f, A = q(S), u = q(P);
672
+ ), f = wn({ initialColumnPanels: x, initialPanelVisibility: {}, debugConfig: ve, onColumnPanelsChange: h }), { columnPanels: P, setColumnPanels: T } = f, A = q(S), u = q(P);
674
673
  F(() => {
675
674
  A.current = S, u.current = P;
676
675
  }, [S, P]);
@@ -678,7 +677,7 @@ const Nn = () => {
678
677
  (E) => {
679
678
  const b = n.current;
680
679
  if (b === null) return;
681
- const { plan: B, stageBlockSize: z } = et(b, c);
680
+ const { plan: B, stageBlockSize: z } = nt(b, c);
682
681
  if (Number.isFinite(z) && z > 0 && b.style.setProperty(fe, `${String(z)}px`), A.current && !E) return;
683
682
  const H = en(e.getSnapshot().visibleColumns, B);
684
683
  H !== null && e.setVisibleColumns(H);
@@ -686,7 +685,7 @@ const Nn = () => {
686
685
  [e, n, c]
687
686
  );
688
687
  F(() => {
689
- w(!0), M(!0);
688
+ w(!0), N(!0);
690
689
  }, [w]), U(() => {
691
690
  const E = n.current;
692
691
  if (E === null || typeof ResizeObserver > "u") return;
@@ -702,17 +701,17 @@ const Nn = () => {
702
701
  }, [n, w]), U(() => {
703
702
  S || w(!1);
704
703
  }, [S, w]);
705
- const g = D(() => O ? gt(m, { logical: c, visible: s }) : be(s), [O, m, c, s]);
704
+ const g = D(() => O ? ht(m, { logical: c, visible: s }) : be(s), [O, m, c, s]);
706
705
  F(() => {
707
706
  Nt(u.current, g) || T(g);
708
707
  }, [g, T]);
709
708
  const y = D(() => De(Object.keys(P)).map((E) => ({ id: E, key: E, className: "aqmx-multi-column" })), [P]), k = D(
710
709
  () => m.docs.map((E) => {
711
- const b = Z(m, E);
712
- return { id: b, component: pt, title: de(v, E), props: { docPath: E, panelId: b }, minHeight: Ct, maxHeight: Tt };
710
+ const b = Q(m, E);
711
+ return { id: b, component: gt, title: de(v, E), props: { docPath: E, panelId: b }, minHeight: Tt, maxHeight: Mt };
713
712
  }),
714
713
  [m, v]
715
- ), L = D(() => Object.fromEntries(m.docs.map((E) => [Z(m, E), !m.hidden.has(E)])), [m]), i = m.maximized === null ? null : Z(m, m.maximized), p = R(
714
+ ), L = D(() => Object.fromEntries(m.docs.map((E) => [Q(m, E), !m.hidden.has(E)])), [m]), i = m.maximized === null ? null : Q(m, m.maximized), p = R(
716
715
  (E) => {
717
716
  const { layout: b } = e.getSnapshot();
718
717
  for (const [B, z] of X(b)) {
@@ -724,8 +723,8 @@ const Nn = () => {
724
723
  r.announce(o.panelShown(j)), Ke(n, B);
725
724
  continue;
726
725
  }
727
- const Y = n.current, ge = Y === null ? null : Te(Y, B);
728
- e.setHidden(z, !0) && (r.announce(o.panelHidden(j)), ge !== null && Ne(n, ge));
726
+ const G = n.current, ge = G === null ? null : Te(G, B);
727
+ e.setHidden(z, !0) && (r.announce(o.panelHidden(j)), ge !== null && Me(n, ge));
729
728
  }
730
729
  },
731
730
  [e, n, r, o]
@@ -734,8 +733,8 @@ const Nn = () => {
734
733
  const b = X(e.getSnapshot().layout).get(E);
735
734
  if (b === void 0) return;
736
735
  const B = () => {
737
- const H = e.titleOf(b), j = n.current, Y = j === null ? null : Te(j, E);
738
- e.close(b) && (r.announce(o.panelClosed(H)), Y !== null && Ne(n, Y));
736
+ const H = e.titleOf(b), j = n.current, G = j === null ? null : Te(j, E);
737
+ e.close(b) && (r.announce(o.panelClosed(H)), G !== null && Me(n, G));
739
738
  }, z = l.unsavedAmong([b]);
740
739
  z.length === 0 ? B() : l.askToDiscard(z).then((H) => {
741
740
  H && B();
@@ -753,8 +752,8 @@ const Nn = () => {
753
752
  },
754
753
  [e, a]
755
754
  );
756
- return /* @__PURE__ */ N("div", { className: "aqmx-multi-layout", "aria-busy": !O, children: /* @__PURE__ */ N(
757
- vn,
755
+ return /* @__PURE__ */ M("div", { className: "aqmx-multi-layout", "aria-busy": !O, children: /* @__PURE__ */ M(
756
+ yn,
758
757
  {
759
758
  columns: y,
760
759
  panels: k,
@@ -786,11 +785,11 @@ const Nn = () => {
786
785
  dragHandle: "header",
787
786
  labels: d,
788
787
  panelClassName: "aqmx-multi-panel",
789
- renderPanelScrollArea: Ot,
790
- renderStageScrollBar: bt
788
+ renderPanelScrollArea: bt,
789
+ renderStageScrollBar: Pt
791
790
  }
792
791
  ) });
793
- }, se = { blockStart: "--aqmx-multi-toast-block-start", inlineEnd: "--aqmx-multi-toast-inline-end", room: "--aqmx-multi-toast-room" }, Lt = (e, n) => {
792
+ }, se = { blockStart: "--aqmx-multi-toast-block-start", inlineEnd: "--aqmx-multi-toast-inline-end", room: "--aqmx-multi-toast-room" }, It = (e, n) => {
794
793
  const t = n.getBoundingClientRect(), o = [t.left + 1, t.left + t.width / 2, t.right - 1], r = [t.top + 1, t.top + t.height / 2, t.bottom - 1];
795
794
  return o.some(
796
795
  (l) => r.some((a) => {
@@ -798,16 +797,16 @@ const Nn = () => {
798
797
  return m !== -1 && s !== -1 && s < m;
799
798
  })
800
799
  );
801
- }, It = (e, n) => {
800
+ }, Rt = (e, n) => {
802
801
  const t = n.getBoundingClientRect(), o = n.ownerDocument.documentElement.clientWidth, r = getComputedStyle(n).direction === "rtl";
803
802
  return e.style.setProperty(se.blockStart, `${String(t.top)}px`), e.style.setProperty(se.inlineEnd, `${String(r ? t.left : o - t.right)}px`), e.style.setProperty(se.room, `${String(t.width)}px`), e.showPopover(), () => {
804
803
  e.isConnected && e.hidePopover();
805
804
  };
806
- }, Rt = ({ store: e, body: n, limitNotice: t, onLimitNoticeCovered: o, ref: r }) => {
807
- const { config: l, labels: a, announcer: c, edits: m } = J(), s = q(null), v = q(null), S = _(e, (u) => u.ready), O = _(e, (u) => u.layout.docs.length > 0), M = _(e, (u) => u.visibleColumns), x = ke(dn), d = R(
805
+ }, Dt = ({ store: e, body: n, limitNotice: t, onLimitNoticeCovered: o, ref: r }) => {
806
+ const { config: l, labels: a, announcer: c, edits: m } = J(), s = q(null), v = q(null), S = _(e, (u) => u.ready), O = _(e, (u) => u.layout.docs.length > 0), N = _(e, (u) => u.visibleColumns), x = ke(fn), d = R(
808
807
  (u) => {
809
808
  const { layout: w } = e.getSnapshot(), g = w.maximized, y = u === null && g !== null ? w.panelIds.get(g) : void 0, k = s.current, L = y !== void 0 && k !== null && pe(k, y);
810
- e.maximize(u) && (u !== null ? c.announce(a.panelMaximized(e.titleOf(u))) : g !== null && c.announce(a.panelRestored(e.titleOf(g))), y !== void 0 && kt(s, y, L));
809
+ e.maximize(u) && (u !== null ? c.announce(a.panelMaximized(e.titleOf(u))) : g !== null && c.announce(a.panelRestored(e.titleOf(g))), y !== void 0 && At(s, y, L));
811
810
  },
812
811
  [e, c, a]
813
812
  ), h = R(
@@ -838,7 +837,7 @@ const Nn = () => {
838
837
  if (t === null || x !== null || !Se()) return;
839
838
  const u = v.current, w = s.current;
840
839
  if (u === null || w === null) throw new Error("[markdown-explorer] the panel-limit notice and the stage must be mounted together");
841
- return It(u, w);
840
+ return Rt(u, w);
842
841
  }, [t, x]), U(() => {
843
842
  const u = v.current;
844
843
  if (t === null || u === null) return;
@@ -847,13 +846,13 @@ const Nn = () => {
847
846
  const y = (k) => {
848
847
  const L = k.target;
849
848
  L instanceof Element && (g !== null && cancelAnimationFrame(g), g = requestAnimationFrame(() => {
850
- g = null, w.activeElement === L && u.isConnected && Lt(u, L) && o();
849
+ g = null, w.activeElement === L && u.isConnected && It(u, L) && o();
851
850
  }));
852
851
  };
853
852
  return w.addEventListener("focusin", y, !0), () => {
854
853
  w.removeEventListener("focusin", y, !0), g !== null && cancelAnimationFrame(g);
855
854
  };
856
- }, [t, x, o]), Qe(
855
+ }, [t, x, o]), Ze(
857
856
  r,
858
857
  () => ({
859
858
  bringIntoView: (u) => {
@@ -875,29 +874,29 @@ const Nn = () => {
875
874
  g !== null && ne(g, u, w);
876
875
  }, []), [P] = $(Nn), T = D(() => ({ store: e, Body: n, followLink: h, maximize: d, revealInPanel: f, focusCarry: P }), [e, n, h, d, f, P]), A = D(() => Array.from({ length: l.multiView.columns }, (u, w) => _e(w)), [l]);
877
876
  return (
878
- /* @__PURE__ */ ie("section", { ref: s, className: "aqmx-multi-stage", style: yt, tabIndex: -1, "aria-label": a.multiRegion, "aria-busy": O && !S, "data-testid": "markdown-explorer-stage", "data-aqmx-visible-columns": M, ...Le, children: [
879
- /* @__PURE__ */ N("span", { className: "aqmx-multi-probe", "aria-hidden": "true", [me]: "" }),
880
- O ? S ? /* @__PURE__ */ N(ze, { value: T, children: /* @__PURE__ */ N(At, { store: e, stageRef: s }) }) : /* @__PURE__ */ N("div", { className: "aqmx-multi-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-stage-skeleton", children: A.map((u) => /* @__PURE__ */ ie("div", { className: "aqmx-skeleton aqmx-multi-skeleton-column", children: [
881
- /* @__PURE__ */ N("span", {}),
882
- /* @__PURE__ */ N("span", {}),
883
- /* @__PURE__ */ N("span", {})
884
- ] }, u)) }) : /* @__PURE__ */ N("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-multi-empty", children: /* @__PURE__ */ N("p", { className: "aqmx-empty-title", children: a.multiEmpty }) }),
885
- t === null ? null : x !== null ? Pn(
886
- /* @__PURE__ */ N("div", { ref: v, className: "aqmx-toast aqmx-multi-toast", "data-testid": "markdown-explorer-panel-limit", children: t }),
877
+ /* @__PURE__ */ ie("section", { ref: s, className: "aqmx-multi-stage", style: St, tabIndex: -1, "aria-label": a.multiRegion, "aria-busy": O && !S, "data-testid": "markdown-explorer-stage", "data-aqmx-visible-columns": N, ...Le, children: [
878
+ /* @__PURE__ */ M("span", { className: "aqmx-multi-probe", "aria-hidden": "true", [me]: "" }),
879
+ O ? S ? /* @__PURE__ */ M(ze, { value: T, children: /* @__PURE__ */ M(Lt, { store: e, stageRef: s }) }) : /* @__PURE__ */ M("div", { className: "aqmx-multi-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-stage-skeleton", children: A.map((u) => /* @__PURE__ */ ie("div", { className: "aqmx-skeleton aqmx-multi-skeleton-column", children: [
880
+ /* @__PURE__ */ M("span", {}),
881
+ /* @__PURE__ */ M("span", {}),
882
+ /* @__PURE__ */ M("span", {})
883
+ ] }, u)) }) : /* @__PURE__ */ M("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-multi-empty", children: /* @__PURE__ */ M("p", { className: "aqmx-empty-title", children: a.multiEmpty }) }),
884
+ t === null ? null : x !== null ? Tn(
885
+ /* @__PURE__ */ M("div", { ref: v, className: "aqmx-toast aqmx-multi-toast", "data-testid": "markdown-explorer-panel-limit", children: t }),
887
886
  x
888
887
  ) : (
889
- /* @__PURE__ */ N("div", { ref: v, popover: Se() ? "manual" : void 0, className: "aqmx-toast aqmx-multi-toast", "data-testid": "markdown-explorer-panel-limit", children: t })
888
+ /* @__PURE__ */ M("div", { ref: v, popover: Se() ? "manual" : void 0, className: "aqmx-toast aqmx-multi-toast", "data-testid": "markdown-explorer-panel-limit", children: t })
890
889
  )
891
890
  ] })
892
891
  );
893
- }, Dt = 3e3, _t = (e, n) => {
892
+ }, _t = 3e3, zt = (e, n) => {
894
893
  if (n !== null) return n;
895
894
  const [t] = e;
896
895
  return t === void 0 ? null : t;
897
- }, Me = (e, n, t) => {
896
+ }, Ne = (e, n, t) => {
898
897
  const o = new Set(e), r = n.filter((a) => !o.has(a)), l = r.length > 0 ? r.at(-1) : t !== null && n.includes(t) ? t : n.at(-1);
899
898
  return l === void 0 ? null : l;
900
- }, zt = (e, n, t) => {
899
+ }, Ht = (e, n, t) => {
901
900
  switch (n) {
902
901
  case "opened":
903
902
  return e.panelOpened(t);
@@ -911,9 +910,9 @@ const Nn = () => {
911
910
  }
912
911
  }
913
912
  }, Jt = ({ location: e }) => {
914
- const { config: n, labels: t, announcer: o } = J(), r = Jn(e), l = _(r, (y) => y.layout.docs), a = _(r, (y) => y.layout.maximized), c = _(r, (y) => y.layout.markup), m = _(r, (y) => y.source), [s, v] = $(() => ({ docs: l, latest: Me([], l, null) }));
915
- s.docs !== l && v({ docs: l, latest: Me(s.docs, l, s.latest) });
916
- const S = a !== null ? a : s.latest, [O, M] = $(!1), x = q(null), [d, h] = $(0), f = q(null), P = q(null);
913
+ const { config: n, labels: t, announcer: o } = J(), r = Xn(e), l = _(r, (y) => y.layout.docs), a = _(r, (y) => y.layout.maximized), c = _(r, (y) => y.layout.markup), m = _(r, (y) => y.source), [s, v] = $(() => ({ docs: l, latest: Ne([], l, null) }));
914
+ s.docs !== l && v({ docs: l, latest: Ne(s.docs, l, s.latest) });
915
+ const S = a !== null ? a : s.latest, [O, N] = $(!1), x = q(null), [d, h] = $(0), f = q(null), P = q(null);
917
916
  F(() => {
918
917
  const y = f.current;
919
918
  f.current = null, y !== null && (r.whenUrlRendered(() => o.announce(y.announcement)), P.current?.bringIntoView(y.doc));
@@ -924,16 +923,16 @@ const Nn = () => {
924
923
  []
925
924
  );
926
925
  const T = R(() => {
927
- x.current !== null && clearTimeout(x.current), M(!0), x.current = setTimeout(() => {
928
- x.current = null, M(!1);
929
- }, Dt);
926
+ x.current !== null && clearTimeout(x.current), N(!0), x.current = setTimeout(() => {
927
+ x.current = null, N(!1);
928
+ }, _t);
930
929
  }, []), A = R(() => {
931
- x.current !== null && clearTimeout(x.current), x.current = null, M(!1);
930
+ x.current !== null && clearTimeout(x.current), x.current = null, N(!1);
932
931
  }, []), u = R(
933
932
  (y) => {
934
933
  const k = r.titleOf(y), L = r.toggle(y);
935
934
  L === "rejected" && T();
936
- const i = L === "rejected" ? t.panelLimit(n.multiView.maxPanels) : zt(t, L, k);
935
+ const i = L === "rejected" ? t.panelLimit(n.multiView.maxPanels) : Ht(t, L, k);
937
936
  if (L === "shown") {
938
937
  f.current = { doc: y, announcement: i }, h((p) => p + 1);
939
938
  return;
@@ -944,15 +943,15 @@ const Nn = () => {
944
943
  },
945
944
  [r, T, o, t, n]
946
945
  ), w = D(() => new Set(l), [l]), g = D(() => {
947
- const y = _t(l, a);
946
+ const y = zt(l, a);
948
947
  return { href: Ae(n, { view: "tree", source: m, doc: y, markup: y !== null && c.has(y) }), target: "tree" };
949
948
  }, [n, m, l, a, c]);
950
- return /* @__PURE__ */ N(
951
- mn,
949
+ return /* @__PURE__ */ M(
950
+ pn,
952
951
  {
953
952
  view: "multi",
954
- explorer: /* @__PURE__ */ N(fn, { mode: "multi", sourceId: m, currentPath: S, openPaths: w, onOpenDocument: u, onSourceChange: r.changeSource, onRevealSource: r.revealSource, viewSwitch: g }),
955
- content: /* @__PURE__ */ N(Rt, { ref: P, store: r, body: Zn, limitNotice: O ? t.panelLimit(n.multiView.maxPanels) : null, onLimitNoticeCovered: A }),
953
+ explorer: /* @__PURE__ */ M(gn, { mode: "multi", sourceId: m, currentPath: S, openPaths: w, onOpenDocument: u, onSourceChange: r.changeSource, onRevealSource: r.revealSource, viewSwitch: g }),
954
+ content: /* @__PURE__ */ M(Dt, { ref: P, store: r, body: Zn, limitNotice: O ? t.panelLimit(n.multiView.maxPanels) : null, onLimitNoticeCovered: A }),
956
955
  contentCoversPage: a !== null,
957
956
  sheetDismissals: d,
958
957
  onDraggingChange: r.setSplitDragging
@@ -961,7 +960,7 @@ const Nn = () => {
961
960
  };
962
961
  export {
963
962
  Jt as MultiLayout,
964
- Dt as PANEL_LIMIT_NOTICE_MS,
965
- Me as latestOpenedDocument,
966
- _t as treeSwitchDocument
963
+ _t as PANEL_LIMIT_NOTICE_MS,
964
+ Ne as latestOpenedDocument,
965
+ zt as treeSwitchDocument
967
966
  };