@aiquants/markdown-explorer 0.33.0 → 0.34.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 (57) hide show
  1. package/CHANGELOG.md +280 -0
  2. package/README.md +31 -18
  3. package/dist/{EditSurface-BPqqykro.cjs → EditSurface-CF82jZQg.cjs} +5 -5
  4. package/dist/{EditSurface-CWq35IWQ.js → EditSurface-CqHk2R3k.js} +73 -63
  5. package/dist/ExplorerSplit-D325YGEf.cjs +1 -0
  6. package/dist/ExplorerSplit-DGH9bckm.js +1500 -0
  7. package/dist/MultiLayout-CzR7yJ0m.cjs +1 -0
  8. package/dist/{MultiLayout-DYNGlNy0.js → MultiLayout-kcZyVnvK.js} +176 -176
  9. package/dist/NativeScrollBar-UNed10Na.js +62 -0
  10. package/dist/NativeScrollBar-pUbA4Zq3.cjs +1 -0
  11. package/dist/TreeLayout-BnIU87HX.js +96 -0
  12. package/dist/TreeLayout-DtvIpuOe.cjs +1 -0
  13. package/dist/core/geometry.d.cts +1 -0
  14. package/dist/core/geometry.d.ts +1 -0
  15. package/dist/core/labels.d.cts +10 -0
  16. package/dist/core/labels.d.ts +10 -0
  17. package/dist/core/location.d.cts +2 -0
  18. package/dist/core/location.d.ts +2 -0
  19. package/dist/core/viewSettings.d.cts +2 -0
  20. package/dist/core/viewSettings.d.ts +2 -0
  21. package/dist/{dataRoute-DLhQfdoW.js → dataRoute-D6KiSHIc.js} +20 -20
  22. package/dist/index-BDCbvHDs.cjs +15 -0
  23. package/dist/{index-CO-RgTml.js → index-DR31S_-4.js} +2029 -1929
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.js +17 -17
  26. package/dist/{location-perTmwct.js → location-C44b9H1S.js} +291 -278
  27. package/dist/location-hGLhCCg4.cjs +1 -0
  28. package/dist/{merge-DZI4pkWI.cjs → merge-BziXxZkE.cjs} +1 -1
  29. package/dist/{merge-D7L_pINl.js → merge-C1MWvhCS.js} +1 -1
  30. package/dist/{sanitizePolicy-By0tKOpZ.js → sanitizePolicy-CwvyPpp5.js} +1 -1
  31. package/dist/sanitizeWorker.js +1 -1
  32. package/dist/server.cjs +1 -1
  33. package/dist/server.js +4 -4
  34. package/dist/styles/markdown-explorer.css +1 -1
  35. package/dist/tapScrollCircle-D_BpaLwY.js +14 -0
  36. package/dist/tapScrollCircle-DigcJCsu.cjs +1 -0
  37. package/dist/useSplitPersistence-DCeYbJMx.js +38 -0
  38. package/dist/useSplitPersistence-QGcvyMAa.cjs +1 -0
  39. package/docs/behavior/dom-hooks.md +12 -3
  40. package/docs/behavior/layout.md +64 -16
  41. package/docs/behavior/localization.md +4 -3
  42. package/docs/behavior/security.md +2 -1
  43. package/docs/behavior/url-contract.md +11 -5
  44. package/package.json +11 -11
  45. package/dist/ExplorerSplit-BRY4uy6x.js +0 -1493
  46. package/dist/ExplorerSplit-CQxr6b0v.cjs +0 -1
  47. package/dist/MultiLayout-TXbet9k3.cjs +0 -1
  48. package/dist/NativeScrollBar-BsWdvkHa.js +0 -64
  49. package/dist/NativeScrollBar-UpjxjLlB.cjs +0 -1
  50. package/dist/TreeLayout-BQEgZhz9.js +0 -72
  51. package/dist/TreeLayout-C0O1OGi4.cjs +0 -1
  52. package/dist/index-DSkK8iLE.cjs +0 -15
  53. package/dist/location-BxiJRTyw.cjs +0 -1
  54. package/dist/tapScrollCircle-CRKZremf.js +0 -12
  55. package/dist/tapScrollCircle-Cbf17x8g.cjs +0 -1
  56. package/dist/useSplitPersistence-Du01PHNg.js +0 -42
  57. package/dist/useSplitPersistence-pPmE4GTT.cjs +0 -1
@@ -0,0 +1,1500 @@
1
+ import { jsx as m, jsxs as k, Fragment as rt } from "react/jsx-runtime";
2
+ import { u as D, x as _t, a1 as Me, c as at, V as lt, a2 as It, a3 as Dt, a4 as Ht, J as _e, a5 as Bt, a6 as $t, a7 as Zt, p as zt, a8 as Vt, a9 as jt, aa as ot, ab as Kt } from "./index-DR31S_-4.js";
3
+ import * as f from "react";
4
+ import { use as ve, createContext as Oe, useState as P, useCallback as g, useMemo as M, useRef as b, useLayoutEffect as H, useEffect as B, useSyncExternalStore as Ie, Suspense as st, useId as Ne } from "react";
5
+ import { s as Ut, u as Gt, v as ct, x as Wt, y as Xt, z as Yt, A as We, B as Qt, D as Jt, b as Te, C as en, F as tn, G as nn } from "./location-C44b9H1S.js";
6
+ import { useDirectoryTreeState as rn, DirectoryTree as an } from "@aiquants/directory-tree";
7
+ import { TOUCH_TAP_SCROLL_CIRCLE as ln, TAP_SCROLL_CIRCLE as on } from "./tapScrollCircle-D_BpaLwY.js";
8
+ import { s as sn } from "./storage-CmGHg7OA.js";
9
+ import { PanelGroup as cn, Panel as Xe, PanelResizeHandle as dn } from "@aiquants/resize-panels";
10
+ import { u as un } from "./useSplitPersistence-DCeYbJMx.js";
11
+ import { useLocation as mn } from "react-router";
12
+ function pn({
13
+ title: e,
14
+ titleId: t,
15
+ ...n
16
+ }, r) {
17
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
18
+ xmlns: "http://www.w3.org/2000/svg",
19
+ viewBox: "0 0 24 24",
20
+ fill: "currentColor",
21
+ "aria-hidden": "true",
22
+ "data-slot": "icon",
23
+ ref: r,
24
+ "aria-labelledby": t
25
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
26
+ id: t
27
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
28
+ fillRule: "evenodd",
29
+ d: "M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15ZM9 12.75a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5H9Z",
30
+ clipRule: "evenodd"
31
+ }));
32
+ }
33
+ const fn = /* @__PURE__ */ f.forwardRef(pn);
34
+ function hn({
35
+ title: e,
36
+ titleId: t,
37
+ ...n
38
+ }, r) {
39
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
40
+ xmlns: "http://www.w3.org/2000/svg",
41
+ viewBox: "0 0 24 24",
42
+ fill: "currentColor",
43
+ "aria-hidden": "true",
44
+ "data-slot": "icon",
45
+ ref: r,
46
+ "aria-labelledby": t
47
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
48
+ id: t
49
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
50
+ fillRule: "evenodd",
51
+ d: "M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15Zm-6.75-10.5a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25v2.25a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V10.5Z",
52
+ clipRule: "evenodd"
53
+ }));
54
+ }
55
+ const xn = /* @__PURE__ */ f.forwardRef(hn);
56
+ function wn({
57
+ title: e,
58
+ titleId: t,
59
+ ...n
60
+ }, r) {
61
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
62
+ xmlns: "http://www.w3.org/2000/svg",
63
+ viewBox: "0 0 24 24",
64
+ fill: "currentColor",
65
+ "aria-hidden": "true",
66
+ "data-slot": "icon",
67
+ ref: r,
68
+ "aria-labelledby": t
69
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
70
+ id: t
71
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
72
+ d: "M16.5 6a3 3 0 0 0-3-3H6a3 3 0 0 0-3 3v7.5a3 3 0 0 0 3 3v-6A4.5 4.5 0 0 1 10.5 6h6Z"
73
+ }), /* @__PURE__ */ f.createElement("path", {
74
+ d: "M18 7.5a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-7.5a3 3 0 0 1-3-3v-7.5a3 3 0 0 1 3-3H18Z"
75
+ }));
76
+ }
77
+ const gn = /* @__PURE__ */ f.forwardRef(wn);
78
+ function vn({
79
+ title: e,
80
+ titleId: t,
81
+ ...n
82
+ }, r) {
83
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
84
+ xmlns: "http://www.w3.org/2000/svg",
85
+ viewBox: "0 0 24 24",
86
+ fill: "currentColor",
87
+ "aria-hidden": "true",
88
+ "data-slot": "icon",
89
+ ref: r,
90
+ "aria-labelledby": t
91
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
92
+ id: t
93
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
94
+ fillRule: "evenodd",
95
+ d: "M3 6a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3V6ZM3 15.75a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2.25Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3v-2.25Z",
96
+ clipRule: "evenodd"
97
+ }));
98
+ }
99
+ const bn = /* @__PURE__ */ f.forwardRef(vn), En = () => {
100
+ const { notices: e } = D(), t = ve(e);
101
+ return t.length === 0 ? null : /* @__PURE__ */ m("div", { className: "aqmx-explorer-notices", children: t.map((n) => /* @__PURE__ */ k("div", { className: "aqmx-callout", "data-aqmx-tone": n.tone, "data-testid": "markdown-explorer-notice", "data-aqmx-notice": n.id, children: [
102
+ /* @__PURE__ */ m("p", { className: "aqmx-callout-title", children: n.title }),
103
+ n.body === void 0 ? null : /* @__PURE__ */ m("p", { className: "aqmx-callout-body", children: n.body }),
104
+ n.action === void 0 ? null : (
105
+ /* @__PURE__ */ m("a", { className: "aqmx-callout-action", href: n.action.href, children: n.action.label })
106
+ )
107
+ ] }, n.id)) });
108
+ };
109
+ function yn({
110
+ title: e,
111
+ titleId: t,
112
+ ...n
113
+ }, r) {
114
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
115
+ xmlns: "http://www.w3.org/2000/svg",
116
+ viewBox: "0 0 24 24",
117
+ fill: "currentColor",
118
+ "aria-hidden": "true",
119
+ "data-slot": "icon",
120
+ ref: r,
121
+ "aria-labelledby": t
122
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
123
+ id: t
124
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
125
+ fillRule: "evenodd",
126
+ d: "M6.912 3a3 3 0 0 0-2.868 2.118l-2.411 7.838a3 3 0 0 0-.133.882V18a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3v-4.162c0-.299-.045-.596-.133-.882l-2.412-7.838A3 3 0 0 0 17.088 3H6.912Zm13.823 9.75-2.213-7.191A1.5 1.5 0 0 0 17.088 4.5H6.912a1.5 1.5 0 0 0-1.434 1.059L3.265 12.75H6.11a3 3 0 0 1 2.684 1.658l.256.513a1.5 1.5 0 0 0 1.342.829h3.218a1.5 1.5 0 0 0 1.342-.83l.256-.512a3 3 0 0 1 2.684-1.658h2.844Z",
127
+ clipRule: "evenodd"
128
+ }));
129
+ }
130
+ const Rn = /* @__PURE__ */ f.forwardRef(yn), De = Oe(!0), it = Oe(null), dt = "\0loop\0", ut = "\0", Sn = () => {
131
+ const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = (a) => {
132
+ const l = e.get(a);
133
+ if (l !== void 0) return l;
134
+ const d = Object.freeze({ type: "loop", name: a.name, path: a.path });
135
+ return e.set(a, d), d;
136
+ }, o = (a, l, d) => {
137
+ let u = !1;
138
+ const c = a.map((p) => {
139
+ const h = s(p, l, d);
140
+ return h !== p && (u = !0), h;
141
+ });
142
+ if (!u) return a;
143
+ const i = n.get(a);
144
+ return i !== void 0 && i.length === c.length && i.every((p, h) => p === c[h]) ? i : (n.set(a, c), c);
145
+ }, s = (a, l, d) => {
146
+ if (a.type !== "directory") return a;
147
+ if (d.has(a.path)) return r(a);
148
+ const u = a.lazy === !0 ? l(a.path) : void 0, c = u?.status === "loaded", i = c ? u.entries : a.children;
149
+ if (i === void 0) return a;
150
+ d.add(a.path);
151
+ const p = o(i, l, d);
152
+ if (d.delete(a.path), !c && p === a.children) return a;
153
+ const h = t.get(a);
154
+ if (h !== void 0 && h.state === u && h.children === p) return h.grafted;
155
+ const w = { ...a, children: p, lazy: c ? !1 : a.lazy };
156
+ return t.set(a, { state: u, children: p, grafted: w }), w;
157
+ };
158
+ return (a, l) => o(a, l, /* @__PURE__ */ new Set());
159
+ }, Tn = (e, t) => `${dt}${e}${ut}${t}`, xe = (e) => e.startsWith(dt), On = (e) => e.slice(e.lastIndexOf(ut) + 1), ce = "data-aqmx-path", Nn = (e, t, n, r, o) => {
160
+ const s = { aqmxPath: e.path };
161
+ return e.modifiedAt !== void 0 && (s.aqmxModifiedAt = e.modifiedAt), n && (s.aqmxOpen = !0), (r === "loading" || r === "failed") && (s.aqmxChildren = r), {
162
+ name: e.name,
163
+ type: e.type,
164
+ absolutePath: e.path,
165
+ relativePath: e.path,
166
+ mimeType: e.mimeType,
167
+ children: t,
168
+ label: o,
169
+ data: s
170
+ };
171
+ }, An = (e, t, n, r) => {
172
+ const o = Tn(t, e.path);
173
+ return { name: n, type: "directory", absolutePath: o, relativePath: o, children: r, data: { aqmxLoop: e.path } };
174
+ }, Ln = () => {
175
+ const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = [], o = (l, d, u) => {
176
+ const c = l.map((p) => p.type === "loop" ? s(p, d, u) : a(p, d)), i = n.get(l);
177
+ return i !== void 0 && i.length === c.length && i.every((p, h) => p === c[h]) ? i : (n.set(l, c), c);
178
+ }, s = (l, d, u) => {
179
+ const c = t.get(l);
180
+ if (c !== void 0 && c.parentKey === u && c.loopFolderName === d.loopFolderName) return c.row;
181
+ const i = An(l, u, d.loopFolderName(l.name), r);
182
+ return t.set(l, { row: i, parentKey: u, loopFolderName: d.loopFolderName }), i;
183
+ }, a = (l, d) => {
184
+ const u = l.type === "directory" ? l.children === void 0 ? r : o(l.children, d, l.path) : void 0, c = d.openPaths.has(l.path), i = l.type === "directory" && l.lazy === !0 ? d.childrenOf(l.path)?.status : void 0, p = i === "failed" ? d.renderFailedFolder : void 0, h = e.get(l);
185
+ if (h !== void 0 && h.open === c && h.childrenStatus === i && h.children === u && h.renderFailedFolder === p)
186
+ return h.row;
187
+ const w = Nn(l, u, c, i, p === void 0 ? void 0 : p(l));
188
+ return e.set(l, { row: w, open: c, childrenStatus: i, children: u, renderFailedFolder: p }), w;
189
+ };
190
+ return (l, d) => o(l, d, "");
191
+ }, kn = (e) => {
192
+ if (e === void 0) return;
193
+ const t = (n) => {
194
+ const r = n.data?.aqmxModifiedAt;
195
+ return typeof r == "number" ? { name: n.name, path: n.absolutePath, type: n.type, modifiedAt: r } : { name: n.name, path: n.absolutePath, type: n.type };
196
+ };
197
+ return (n, r) => e(t(n), t(r));
198
+ }, Pe = (e, t) => {
199
+ const n = e.filter((r) => r.type === "directory");
200
+ return t === void 0 ? n : n.sort(t);
201
+ }, Cn = (e, t) => {
202
+ const n = /* @__PURE__ */ new Map();
203
+ let r = 0;
204
+ const o = (s) => {
205
+ for (const a of Pe(s, t.compare))
206
+ if (t.isShownExpanded(a.path)) {
207
+ if (a.lazy !== !0) {
208
+ a.children !== void 0 && o(a.children);
209
+ continue;
210
+ }
211
+ n.has(a.path) || (n.set(a.path, t.isDirect(a.path) ? "direct" : "bulk"), t.childrenOf(a.path)?.status !== "failed" && (r += 1));
212
+ }
213
+ };
214
+ return o(e), { folders: n, waiting: r };
215
+ }, qn = (e) => {
216
+ const t = /* @__PURE__ */ new Set(), n = (r) => {
217
+ for (const o of r)
218
+ o.type === "directory" && (o.lazy === !0 && t.add(o.path), o.children !== void 0 && n(o.children));
219
+ };
220
+ return n(e), t;
221
+ }, mt = (e, t) => {
222
+ for (const n of e) {
223
+ if (n.type !== "directory") continue;
224
+ if (n.path === t) return n;
225
+ const r = n.children === void 0 ? null : mt(n.children, t);
226
+ if (r !== null) return r;
227
+ }
228
+ return null;
229
+ }, Pn = (e, t, n, r) => {
230
+ let o = e;
231
+ for (const s of t) {
232
+ const a = o.find((l) => l.type === "directory" && l.path === s);
233
+ if (a === void 0) return "missing";
234
+ if (a.lazy === !0) return r.childrenOf(a.path)?.status === "failed" ? "failed" : "loading";
235
+ if (!r.isShownExpanded(a.path)) return "loading";
236
+ o = a.children ?? [];
237
+ }
238
+ return o.some((s) => s.type === "file" && s.path === n) ? "ready" : "missing";
239
+ }, Ye = /* @__PURE__ */ new Set(), Fn = (e, t) => e.has(t) ? e : new Set(e).add(t), Mn = (e, t) => {
240
+ if (!t.some((r) => e.has(r))) return e;
241
+ const n = new Set(t);
242
+ return new Set([...e].filter((r) => !n.has(r)));
243
+ }, _n = (e, t) => [...e].every((n) => t.has(n)) ? e : new Set([...e].filter((n) => t.has(n))), In = () => {
244
+ const [e, t] = P(Ye), n = g((a) => t((l) => Fn(l, a)), []), r = g((a) => t((l) => Mn(l, a)), []), o = g((a) => t((l) => _n(l, a)), []), s = g(() => t(Ye), []);
245
+ return M(() => ({ direct: e, markDirect: n, unmarkDirect: r, pruneDirect: o, clearDirect: s }), [e, n, r, o, s]);
246
+ }, Dn = (e) => ({
247
+ budget: e,
248
+ handled: /* @__PURE__ */ new Set(),
249
+ loads: /* @__PURE__ */ new Set(),
250
+ opened: 0,
251
+ folderLimited: !1,
252
+ depthLimited: !1,
253
+ announcedStart: !1,
254
+ issuedAgainst: null
255
+ }), Hn = (e, t) => {
256
+ const n = [];
257
+ let r = Pe(t.entries, t.compare);
258
+ for (let o = 1; r.length > 0; o += 1) {
259
+ const s = [];
260
+ for (const a of r) {
261
+ const { path: l } = a;
262
+ if (t.isShownExpanded(l))
263
+ e.handled.add(l);
264
+ else {
265
+ if (e.handled.has(l)) continue;
266
+ if (e.handled.add(l), a.lazy === !0 && t.childrenOf(l) === void 0) {
267
+ if (o > e.budget.maxDepth) {
268
+ e.depthLimited = !0;
269
+ continue;
270
+ }
271
+ if (e.loads.size >= e.budget.maxFolders) {
272
+ e.folderLimited = !0;
273
+ continue;
274
+ }
275
+ e.loads.add(l);
276
+ }
277
+ n.push(l), e.opened += 1;
278
+ }
279
+ a.lazy !== !0 && a.children !== void 0 && s.push(...Pe(a.children, t.compare));
280
+ }
281
+ r = s;
282
+ }
283
+ return n;
284
+ }, pt = (e, t) => e.every((n) => n.type !== "directory" || t(n.path) && (n.lazy === !0 || n.children === void 0 || pt(n.children, t))), Bn = (e, t) => {
285
+ if (e.folderLimited) return { kind: "folder-limit", opened: e.opened };
286
+ if (e.depthLimited) return { kind: "depth-limit", opened: e.opened };
287
+ let n = 0;
288
+ for (const r of e.loads) t.childrenOf(r)?.status === "failed" && (n += 1);
289
+ return { kind: "done", opened: e.opened, failed: n, complete: pt(t.entries, t.isShownExpanded) };
290
+ }, Ce = Object.freeze({ state: "idle" }), $n = (e) => {
291
+ const t = b(null), n = b(e), [r, o] = P(Ce);
292
+ H(() => {
293
+ n.current = e;
294
+ });
295
+ const s = g(() => {
296
+ t.current === null && (t.current = Dn(n.current.budget), o({ state: "running", opened: 0 }));
297
+ }, []), a = g(() => {
298
+ t.current = null, o(Ce);
299
+ }, []), l = g((d) => {
300
+ const u = t.current;
301
+ if (u === null) return;
302
+ const c = Hn(u, d);
303
+ if (c.length > 0 && (u.issuedAgainst = d.expanded, n.current.expandMultiple([...c])), !u.announcedStart && (u.loads.size > 0 || d.waiting > 0) && (u.announcedStart = !0, n.current.onStart()), c.length === 0 && !d.expansionPending && d.expanded !== u.issuedAgainst && d.waiting === 0) {
304
+ t.current = null;
305
+ const p = Bn(u, d);
306
+ o(p.kind === "done" ? Ce : { state: "stopped", stop: p.kind, opened: p.opened }), n.current.onFinish(p);
307
+ return;
308
+ }
309
+ const { opened: i } = u;
310
+ o((p) => p.state === "running" && p.opened === i ? p : { state: "running", opened: i });
311
+ }, []);
312
+ return M(() => ({ status: r, start: s, end: a, advance: l }), [r, s, a, l]);
313
+ }, Qe = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"], Zn = 8, Je = { least: Number.POSITIVE_INFINITY, stalled: 0 }, zn = ({ tree: e, container: t, path: n, chain: r, rows: o, cancel: s, displayed: a, placement: l }) => {
314
+ const d = b(null), u = b(!0), c = b(Je), i = b(null), p = b(null), h = b(r), w = b(l);
315
+ H(() => {
316
+ h.current = r, w.current = l;
317
+ }, [r, l]);
318
+ const v = g(() => {
319
+ const T = i.current;
320
+ T !== null && (i.current = null, T.phase === "asking" ? T.controller.abort() : h.current?.open(null));
321
+ }, []), R = g(() => {
322
+ d.current = null, v();
323
+ }, [v]), A = g(() => {
324
+ const T = t.current;
325
+ d.current === null || p.current !== null || T === null || T.getClientRects().length === 0 || (p.current = requestAnimationFrame(() => {
326
+ p.current = null;
327
+ const C = d.current;
328
+ if (C === null) return;
329
+ const L = w.current(C);
330
+ if (L === 0) {
331
+ u.current = !0, i.current?.phase === "opening" && v();
332
+ return;
333
+ }
334
+ if (e.current?.scrollToPath(C, { align: "nearest" }) === !0) {
335
+ i.current?.phase === "opening" && v();
336
+ const { least: y, stalled: _ } = c.current;
337
+ c.current = L < y ? { least: L, stalled: 0 } : { least: y, stalled: _ + 1 }, c.current.stalled < Zn && A();
338
+ return;
339
+ }
340
+ const E = i.current;
341
+ if (E === null) {
342
+ d.current = null;
343
+ return;
344
+ }
345
+ E.phase === "opening" && h.current?.progress(E.folders, C) !== "loading" && R();
346
+ }));
347
+ }, [e, t, v, R]), O = g(() => {
348
+ u.current = !1, c.current = Je, A();
349
+ }, [A]);
350
+ B(() => {
351
+ const T = t.current;
352
+ if (T === null) return;
353
+ const C = typeof ResizeObserver > "u" ? null : new ResizeObserver(O);
354
+ C?.observe(T);
355
+ for (const L of Qe) T.addEventListener(L, R, { passive: !0 });
356
+ return () => {
357
+ C?.disconnect();
358
+ for (const L of Qe) T.removeEventListener(L, R);
359
+ p.current !== null && cancelAnimationFrame(p.current), p.current = null, v();
360
+ };
361
+ }, [t, O, R, v]);
362
+ const S = r !== null;
363
+ B(() => {
364
+ const T = t.current;
365
+ if (R(), n === null || T === null || T.contains(T.ownerDocument.activeElement)) return;
366
+ d.current = n;
367
+ const C = h.current;
368
+ if (S && C !== null) {
369
+ const L = new AbortController(), E = { phase: "asking", controller: L };
370
+ i.current = E, C.ancestors(n, L.signal).then((y) => {
371
+ i.current === E && (y === null ? i.current = null : (i.current = { phase: "opening", folders: y }, h.current?.open(y)), O());
372
+ });
373
+ }
374
+ O();
375
+ }, [n, S, t, R, O]), B(() => {
376
+ (i.current?.phase === "opening" || d.current !== null && !u.current) && O();
377
+ }, [o, O]);
378
+ const $ = b(s);
379
+ B(() => {
380
+ $.current !== s && ($.current = s, R());
381
+ }, [s, R]);
382
+ const I = b(a);
383
+ B(() => {
384
+ I.current && !a && v(), I.current = a;
385
+ }, [a, v]);
386
+ }, Vn = "--aqmx-tree-line", jn = Object.freeze(["(forced-colors: active)", "(prefers-color-scheme: dark)"]), Kn = "data-aqmx-tree-probe", Un = Object.freeze({ rowHeight: Ut, lineColor: null }), Gn = /^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/u, Wn = (e) => {
387
+ const t = Gn.exec(e);
388
+ return t === null ? e : `#${t.slice(1).map((n) => Number(n).toString(16).padStart(2, "0")).join("")}`;
389
+ }, Xn = (e, t) => {
390
+ const [n, r] = P(Un);
391
+ return H(() => {
392
+ const o = e.current;
393
+ if (o === null) return;
394
+ const s = () => {
395
+ const d = Math.round(o.getBoundingClientRect().height), u = getComputedStyle(o), c = u.getPropertyValue(Vn).trim() === "" ? null : Wn(u.color);
396
+ r((i) => {
397
+ const p = Number.isFinite(d) && d > 0 ? d : i.rowHeight;
398
+ return i.rowHeight === p && i.lineColor === c ? i : { rowHeight: p, lineColor: c };
399
+ });
400
+ };
401
+ s();
402
+ const a = jn.map((d) => window.matchMedia(d));
403
+ for (const d of a) d.addEventListener("change", s);
404
+ const l = typeof ResizeObserver > "u" ? null : new ResizeObserver(s);
405
+ return l?.observe(o), () => {
406
+ for (const d of a) d.removeEventListener("change", s);
407
+ l?.disconnect();
408
+ };
409
+ }, [e, t]), n;
410
+ }, ft = "markdown-explorer-tree-scroll", Yn = 0.5, ht = (e, t) => [...e.querySelectorAll(`[role="treeitem"][${ce}]`)].find((n) => n.getAttribute(ce) === t), Qn = (e, t) => {
411
+ const n = ht(e, t), r = n?.closest(`[data-testid="${ft}"]`);
412
+ if (n === void 0 || r === null || r === void 0) return Number.POSITIVE_INFINITY;
413
+ const o = r.getBoundingClientRect(), s = n.getBoundingClientRect(), a = o.top - s.top, l = s.height > o.height ? Math.abs(a) : Math.max(0, a) + Math.max(0, s.bottom - o.bottom);
414
+ return l <= Yn ? 0 : l;
415
+ }, Fe = Object.freeze({
416
+ testId: ft,
417
+ overscanCount: 13,
418
+ callbackThrottleMs: 13,
419
+ scrollBarOptions: Object.freeze({
420
+ width: 8,
421
+ ...Ht,
422
+ enableArrowButtons: !0,
423
+ enableArrowButtonTabStops: !1,
424
+ enableScrollToTopBottomButtons: !0,
425
+ tapScrollCircleOptions: on
426
+ }),
427
+ behaviorOptions: Object.freeze({ enablePointerDrag: !0 })
428
+ }), Jn = Object.freeze({
429
+ ...Fe,
430
+ scrollBarOptions: Object.freeze({
431
+ ...Fe.scrollBarOptions,
432
+ ...Dt,
433
+ tapScrollCircleOptions: ln
434
+ })
435
+ }), er = (e) => e ? Jn : Fe, tr = { hoverClassName: "", directorySelectedClassName: "", itemSelectedClassName: "" }, nr = { color: "inherit", fontSize: "inherit" }, rr = { fontSize: "inherit" }, ar = /* @__PURE__ */ new Set(), lr = /* @__PURE__ */ new Map(), or = { color: "var(--aqmx-tree-line)" }, sr = (e) => {
436
+ const t = e instanceof Element ? e.closest(`[${ce}]`) : null;
437
+ return t === null || t.getAttribute("data-entry-type") !== "file" ? null : t.getAttribute(ce);
438
+ }, xt = (e, t, n, r) => n === "folder-limit" ? e.expandAllFolderLimit(r, t.maxFolders, e.expandAll) : e.expandAllDepthLimit(r, t.maxDepth), cr = (e, t, n) => n.kind === "done" ? e.expandAllDone(n.opened, n.failed, n.complete) : xt(e, t, n.kind, n.opened), wt = () => {
439
+ const { labels: e } = D();
440
+ return /* @__PURE__ */ k("div", { className: "aqmx-explorer-loading", "aria-busy": "true", "data-testid": "markdown-explorer-tree-loading", children: [
441
+ /* @__PURE__ */ m("p", { className: "aqmx-explorer-loading-text", children: e.treeLoading }),
442
+ /* @__PURE__ */ k("div", { className: "aqmx-skeleton", "aria-hidden": "true", children: [
443
+ /* @__PURE__ */ m("span", {}),
444
+ /* @__PURE__ */ m("span", {}),
445
+ /* @__PURE__ */ m("span", {}),
446
+ /* @__PURE__ */ m("span", {}),
447
+ /* @__PURE__ */ m("span", {})
448
+ ] })
449
+ ] });
450
+ }, ir = () => {
451
+ const { labels: e } = D();
452
+ return /* @__PURE__ */ k("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-tree-empty", children: [
453
+ /* @__PURE__ */ m(Rn, { className: "aqmx-explorer-empty-icon", "aria-hidden": "true" }),
454
+ /* @__PURE__ */ m("p", { className: "aqmx-empty-title", children: e.treeEmptyTitle }),
455
+ /* @__PURE__ */ m("p", { className: "aqmx-explorer-empty-body", children: e.treeEmptyBody })
456
+ ] });
457
+ }, dr = ({ name: e, onRetry: t }) => {
458
+ const { labels: n } = D(), r = Ne();
459
+ return /* @__PURE__ */ k("span", { className: "aqmx-explorer-folder-failed", children: [
460
+ /* @__PURE__ */ m("span", { className: "aqmx-explorer-folder-name", children: e }),
461
+ /* @__PURE__ */ m("span", { id: r, className: "aqmx-explorer-folder-error", children: n.folderLoadFailed }),
462
+ /* @__PURE__ */ k(
463
+ "button",
464
+ {
465
+ type: "button",
466
+ className: "aqmx-explorer-folder-retry",
467
+ "aria-describedby": r,
468
+ "data-testid": "markdown-explorer-folder-retry",
469
+ onClick: (o) => {
470
+ o.stopPropagation();
471
+ const s = o.currentTarget, a = s.ownerDocument.activeElement === s ? s.closest('[role="treeitem"]') : null;
472
+ a instanceof HTMLElement && lt(a), t();
473
+ },
474
+ onKeyDown: (o) => {
475
+ o.key !== "Escape" && o.stopPropagation();
476
+ },
477
+ children: [
478
+ /* @__PURE__ */ m(Me, { className: "aqmx-explorer-folder-retry-icon", "aria-hidden": "true" }),
479
+ /* @__PURE__ */ m("span", { className: "aqmx-explorer-folder-retry-text", children: n.retry })
480
+ ]
481
+ }
482
+ )
483
+ ] });
484
+ }, ur = ({
485
+ entries: e,
486
+ version: t,
487
+ mode: n,
488
+ sourceId: r,
489
+ settings: o,
490
+ reveal: s,
491
+ openPaths: a,
492
+ selection: l,
493
+ onOpenDocument: d,
494
+ folders: u,
495
+ onRevealSource: c,
496
+ expansion: i,
497
+ onShown: p,
498
+ marks: h,
499
+ claimsHeld: w,
500
+ expandAll: v,
501
+ revealCancel: R
502
+ }) => {
503
+ const { trees: A, documents: O, labels: S, locale: $, theme: I, data: T, config: C, sources: L, reveals: E } = D(), y = ve(De), _ = ve(it), [Z] = P(() => _?.get(r)), z = er(at()), U = M(() => Z === void 0 ? z : { ...z, initialScrollAnchor: Z }, [z, Z]), [ie] = P(Ln), re = b(null), { rowHeight: ae, lineColor: J } = Xn(re, I), { isExpanded: G, toggle: le, expandMultiple: F, collapseMultiple: oe, expanded: ee, isPending: de } = i, { alwaysExpanded: se, sortMode: we, folderPlacement: ue, readmePlacement: be } = o, { direct: ge, markDirect: K, unmarkDirect: me, pruneDirect: Ee } = h, { running: pe, advance: q } = v, V = b(null), W = b(null);
504
+ H(() => {
505
+ if (_ === null) return;
506
+ const x = V;
507
+ return () => {
508
+ const N = x.current === null ? null : x.current.getScrollAnchor();
509
+ N === null ? _.delete(r) : _.set(r, N);
510
+ };
511
+ }, [_, r]);
512
+ const fe = M(() => Gt({ sortMode: we, folderPlacement: ue, readmePlacement: be }), [we, ue, be]), Rt = M(() => kn(fe), [fe]), X = g((x) => A.children(r, x), [A, r]), te = M(() => qn(e), [e]), ne = g((x) => !xe(x) && (G(x) || se && !te.has(x)), [G, se, te]), Y = b({ shownExpanded: ne, isExpanded: G, unloadedFolders: te, entries: e, childrenOf: X });
513
+ H(() => {
514
+ Y.current = { shownExpanded: ne, isExpanded: G, unloadedFolders: te, entries: e, childrenOf: X };
515
+ }, [ne, G, te, e, X]);
516
+ const Ze = g((x) => {
517
+ V.current?.scrollToPath(x, { align: "nearest" }), requestAnimationFrame(() => {
518
+ const N = W.current, j = N === null ? void 0 : ht(N, x);
519
+ j !== void 0 && lt(j);
520
+ });
521
+ }, []), St = g(
522
+ (x) => {
523
+ if (xe(x)) {
524
+ Ze(On(x));
525
+ return;
526
+ }
527
+ Y.current.isExpanded(x) ? me([x]) : Y.current.unloadedFolders.has(x) && K(x), le(x);
528
+ },
529
+ [Ze, K, me, le]
530
+ ), Ae = g(
531
+ (x) => {
532
+ const N = x.filter((j) => !xe(j));
533
+ N.length !== 0 && (me(N), oe(N));
534
+ },
535
+ [me, oe]
536
+ ), Tt = g(
537
+ (x) => {
538
+ const N = x.filter((j) => !xe(j));
539
+ N.length !== 0 && (N.length < x.length && N.every((j) => Y.current.shownExpanded(j)) ? Ae(N) : F(N));
540
+ },
541
+ [F, Ae]
542
+ ), ze = g(
543
+ (x) => /* @__PURE__ */ m(
544
+ dr,
545
+ {
546
+ name: x.name,
547
+ onRetry: () => {
548
+ K(x.path), A.retryChildren(r, x.path), Y.current.shownExpanded(x.path) || F([x.path]);
549
+ }
550
+ }
551
+ ),
552
+ [A, r, K, F]
553
+ ), Ve = n === "multi" ? a : ar, { loopFolderName: je } = S, Ot = M(() => ie(e, { openPaths: Ve, childrenOf: X, renderFailedFolder: ze, loopFolderName: je }), [ie, e, Ve, X, ze, je, t]), Nt = It(O, sr), Ke = b([]), ye = g(() => {
554
+ for (const x of Ke.current) Y.current.unloadedFolders.has(x) && K(x);
555
+ }, [K]), { maxDepth: Le } = C.revealDocument, Ue = b(c);
556
+ H(() => {
557
+ Ue.current = c;
558
+ }, [c]);
559
+ const At = M(
560
+ () => ({
561
+ ancestors: async (x, N) => {
562
+ const j = E.take(r, x);
563
+ if (j !== null) return j;
564
+ if (!E.mayMove(x)) {
565
+ const he = await T.ancestors(r, x, N);
566
+ return he.status !== "ok" || he.ancestors === null || he.ancestors.length > Le ? null : he.ancestors;
567
+ }
568
+ const Q = await T.reveal(r, x, N);
569
+ return Q.status !== "ok" || Q.source === null || Q.ancestors.length > Le ? null : Q.source === r ? Q.ancestors : (N.aborted || !L.some((he) => he.id === Q.source) || (E.move(Q.source, x, Q.ancestors), Ue.current(Q.source)), null);
570
+ },
571
+ open: (x) => {
572
+ Ke.current = x ?? [], x !== null && (ye(), F([...x]));
573
+ },
574
+ progress: (x, N) => Pn(Y.current.entries, x, N, { isShownExpanded: Y.current.shownExpanded, childrenOf: Y.current.childrenOf })
575
+ }),
576
+ [T, r, L, E, Le, ye, F]
577
+ );
578
+ B(() => ye(), [ye, te]);
579
+ const Lt = M(() => [e, t, ee], [e, t, ee]), kt = g((x) => W.current === null ? Number.POSITIVE_INFINITY : Qn(W.current, x), []);
580
+ zn({ tree: V, container: W, path: s.path, chain: s.openFolders ? At : null, rows: Lt, cancel: R, displayed: y, placement: kt });
581
+ const Ge = g((x) => ge.has(x), [ge]), Re = M(() => Cn(e, { isShownExpanded: ne, childrenOf: X, compare: fe, isDirect: Ge }), [e, ne, X, fe, Ge, t]), Se = y && w;
582
+ H(() => {
583
+ p(e);
584
+ }, [e, p]), H(() => () => p(null), [p]), B(() => A.claimChildren(r, Se ? Re.folders : lr), [A, r, Se, Re]), B(() => Ee(te), [Ee, te]), B(() => {
585
+ Se && pe && q({ entries: e, isShownExpanded: ne, childrenOf: X, compare: fe, expanded: ee, waiting: Re.waiting, expansionPending: de });
586
+ }, [Se, pe, q, e, ne, X, fe, ee, Re, de]);
587
+ const Ct = g(
588
+ (x) => {
589
+ const N = x.entry.absolutePath;
590
+ if (x.isDirectory) {
591
+ if (u === null || xe(N) || N === u.current) return;
592
+ x.isExpanded && x.preventDefault(), E.settle(N), u.open(N);
593
+ return;
594
+ }
595
+ E.settle(N), d(N);
596
+ },
597
+ [E, d, u]
598
+ ), { onChange: ke } = l, qt = M(
599
+ () => ke === null ? void 0 : (x, N) => {
600
+ xe(x.absolutePath) || ke({ path: x.absolutePath, name: x.name, selected: N });
601
+ },
602
+ [ke]
603
+ ), Pt = M(() => new Set(l.items), [l.items]), Ft = M(
604
+ () => ({
605
+ entryKindDirectory: S.treeEntryKindDirectory,
606
+ entryKindFile: S.treeEntryKindFile,
607
+ scrollUp: S.treeScrollUp,
608
+ scrollDown: S.treeScrollDown,
609
+ scrollToTop: S.treeScrollToTop,
610
+ scrollToBottom: S.treeScrollToBottom
611
+ }),
612
+ [S]
613
+ ), Mt = J === null ? { showTreeLines: !1 } : { showTreeLines: o.lines, lineColor: J };
614
+ return /* @__PURE__ */ k("div", { ref: W, className: "aqmx-explorer-tree", "data-testid": "markdown-explorer-tree", ...Nt, children: [
615
+ /* @__PURE__ */ m("span", { ref: re, className: "aqmx-explorer-tree-probe", "aria-hidden": "true", [Kn]: "" }),
616
+ /* @__PURE__ */ m(
617
+ an,
618
+ {
619
+ ref: V,
620
+ entries: Ot,
621
+ expansion: {
622
+ toggle: St,
623
+ isExpanded: ne,
624
+ expandMultiple: Tt,
625
+ collapseMultiple: Ae,
626
+ isPending: de && !pe,
627
+ doubleClickAction: o.doubleClickAction
628
+ },
629
+ selection: { mode: l.mode, selectedPath: l.shownPath, currentPath: l.shownPath, selectedItems: Pt, onEntryClick: Ct, onSelectionChange: qt },
630
+ visual: {
631
+ className: "aqmx-explorer-tree-view",
632
+ ariaLabel: S.treeRegion,
633
+ ...Mt,
634
+ showExpandIcons: o.expandIcons,
635
+ expandIconStyle: or,
636
+ showDirectoryIcons: o.directoryIcons,
637
+ showFileIcons: o.fileIcons,
638
+ expandIconSize: o.expandIconSize,
639
+ itemHeight: ae,
640
+ removeRootIndent: o.removeRootIndent,
641
+ highlightStyles: tr,
642
+ entryStyle: rr,
643
+ nameStyle: nr
644
+ },
645
+ virtualScroll: U,
646
+ sort: Rt,
647
+ locale: $,
648
+ labels: Ft
649
+ }
650
+ )
651
+ ] });
652
+ }, mr = ({ pending: e, status: t }) => {
653
+ const { labels: n } = D(), r = t.state !== "running", [o, s] = P(0), a = b(!0);
654
+ H(() => {
655
+ const d = a.current;
656
+ if (a.current = r, !r || e > 0 && !d) {
657
+ s(0);
658
+ return;
659
+ }
660
+ if (e > 0) {
661
+ s(e);
662
+ return;
663
+ }
664
+ if (o === 0) return;
665
+ const u = setTimeout(() => s(0), 0);
666
+ return () => clearTimeout(u);
667
+ }, [r, e, o]);
668
+ const l = r && e === 0 ? o : e;
669
+ return l === 0 && r ? null : /* @__PURE__ */ k("p", { className: "aqmx-explorer-tree-progress", "data-testid": "markdown-explorer-tree-progress", "data-aqmx-loading": String(l), "data-aqmx-expand-all": t.state, children: [
670
+ l > 0 ? /* @__PURE__ */ m(Me, { className: "aqmx-explorer-tree-progress-icon", "aria-hidden": "true" }) : null,
671
+ /* @__PURE__ */ m("span", { children: t.state === "running" ? n.expandAllProgress(t.opened, l) : n.foldersLoading(l) })
672
+ ] });
673
+ }, pr = ({ stop: e, opened: t, budget: n }) => {
674
+ const { labels: r } = D();
675
+ return /* @__PURE__ */ m("p", { className: "aqmx-explorer-expand-all-stop", "data-testid": "markdown-explorer-expand-all-stop", "data-aqmx-stop": e, children: xt(r, n, e, t) });
676
+ }, fr = ({ entries: e, ...t }) => {
677
+ const { trees: n } = D(), r = Ie(n.subscribe, n.version, n.version), { sourceId: o } = t, [s] = P(Sn), a = M(() => s(e, (l) => n.children(o, l)), [s, e, n, o, r]);
678
+ return a.length === 0 ? /* @__PURE__ */ m(ir, {}) : /* @__PURE__ */ m(ur, { entries: a, version: r, ...t });
679
+ }, hr = ({ result: e, onRetry: t, ...n }) => {
680
+ const { renderTreeFailure: r } = D(), o = ve(e);
681
+ if (o.status === "deferred") return /* @__PURE__ */ m(wt, {});
682
+ if (o.status === "ok") return /* @__PURE__ */ m(fr, { entries: o.entries, ...n });
683
+ const s = r?.(o.failure);
684
+ return /* @__PURE__ */ m("div", { className: "aqmx-explorer-tree-message", "data-testid": "markdown-explorer-tree-failure", "data-aqmx-failure": o.failure.reason, children: s !== void 0 ? s : /* @__PURE__ */ m(_t, { failure: o.failure, alert: !0, onRetry: t, testId: null }) });
685
+ }, xr = ({ onControls: e, ...t }) => {
686
+ const { trees: n, storageNamespace: r, labels: o, announcer: s, config: a } = D(), { sourceId: l } = t, d = rn({ storageKey: sn(r).treeExpansion(l) });
687
+ Ie(n.subscribe, n.version, n.version);
688
+ const u = n.read(l), c = g(() => n.retry(l), [n, l]);
689
+ H(() => n.open(l), [n, l]);
690
+ const i = In(), { expanded: p, expandMultiple: h, collapseAll: w } = d, [v, R] = P(null), A = v !== p, O = b(p);
691
+ H(() => {
692
+ O.current = p;
693
+ }, [p]);
694
+ const S = a.expandAll, $ = g(() => s.announce(o.expandAllStarted), [s, o]), I = g((F) => s.announce(cr(o, S, F)), [s, o, S]), T = $n({ budget: S, expandMultiple: h, onStart: $, onFinish: I }), { status: C, start: L, end: E, advance: y } = T, _ = C.state === "running", Z = M(() => ({ running: _, advance: y }), [_, y]), z = b(null), [U, ie] = P(!1), re = g((F) => {
695
+ z.current = F, ie(F !== null);
696
+ }, []);
697
+ B(
698
+ () => n.subscribeChildrenFailures((F) => {
699
+ const oe = F.sourceId === l && z.current !== null ? mt(z.current, F.path) : null;
700
+ oe !== null && s.announce({ list: o.foldersLoadFailedNamed, item: oe.name });
701
+ }),
702
+ [n, l, s, o]
703
+ );
704
+ const { clearDirect: ae } = i, [J, G] = P(0), le = g(() => {
705
+ G((F) => F + 1), E(), ae(), R(O.current), w();
706
+ }, [E, ae, w]);
707
+ return B(() => {
708
+ e({ collapseAll: le, expandAll: U ? L : null, expanding: _ });
709
+ }, [e, le, L, U, _]), B(() => () => e(null), [e]), B(() => {
710
+ U || E();
711
+ }, [U, E]), /* @__PURE__ */ k(rt, { children: [
712
+ C.state === "stopped" ? /* @__PURE__ */ m(pr, { stop: C.stop, opened: C.opened, budget: S }) : null,
713
+ /* @__PURE__ */ k("div", { className: "aqmx-explorer-tree-area", children: [
714
+ /* @__PURE__ */ m(st, { fallback: /* @__PURE__ */ m(wt, {}), children: /* @__PURE__ */ m(hr, { result: u, onRetry: c, expansion: d, onShown: re, marks: i, claimsHeld: A, expandAll: Z, revealCancel: J, ...t }) }),
715
+ /* @__PURE__ */ m(mr, { pending: n.pendingChildren(l), status: C })
716
+ ] })
717
+ ] });
718
+ };
719
+ function wr({
720
+ title: e,
721
+ titleId: t,
722
+ ...n
723
+ }, r) {
724
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
725
+ xmlns: "http://www.w3.org/2000/svg",
726
+ viewBox: "0 0 24 24",
727
+ fill: "currentColor",
728
+ "aria-hidden": "true",
729
+ "data-slot": "icon",
730
+ ref: r,
731
+ "aria-labelledby": t
732
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
733
+ id: t
734
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
735
+ fillRule: "evenodd",
736
+ d: "M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",
737
+ clipRule: "evenodd"
738
+ }));
739
+ }
740
+ const He = /* @__PURE__ */ f.forwardRef(wr), et = "markdown-explorer-selection-remove", gr = ({ selection: e, onRemove: t, onClear: n, onOpenSelection: r, onLeave: o }) => {
741
+ const { labels: s } = D(), a = Ne(), l = b(null), d = [...e], u = (i, p) => {
742
+ if (p.ownerDocument.activeElement === p) {
743
+ const h = l.current === null ? [] : [...l.current.querySelectorAll(`[data-testid="${et}"]`)], w = h.indexOf(p), v = [h[w + 1], h[w - 1]].find((R) => R !== void 0);
744
+ v === void 0 ? o() : v.focus();
745
+ }
746
+ t(i);
747
+ }, c = () => {
748
+ const i = l.current;
749
+ i !== null && i.contains(i.ownerDocument.activeElement) && o(), n();
750
+ };
751
+ return /* @__PURE__ */ k("section", { ref: l, className: "aqmx-explorer-tray", "aria-labelledby": a, "data-testid": "markdown-explorer-selection-tray", children: [
752
+ /* @__PURE__ */ k("div", { className: "aqmx-explorer-tray-header", children: [
753
+ /* @__PURE__ */ m("p", { id: a, className: "aqmx-explorer-tray-title", children: s.selectionTitle(d.length) }),
754
+ /* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-button", "data-testid": "markdown-explorer-selection-clear", onClick: c, children: s.clearSelection })
755
+ ] }),
756
+ /* @__PURE__ */ m("ul", { className: "aqmx-explorer-tray-list", children: d.map(([i, p]) => /* @__PURE__ */ k("li", { className: "aqmx-explorer-tray-item", children: [
757
+ /* @__PURE__ */ m("span", { className: "aqmx-explorer-tray-name", title: i, children: p }),
758
+ /* @__PURE__ */ m(
759
+ "button",
760
+ {
761
+ type: "button",
762
+ className: "aqmx-icon-button aqmx-explorer-tray-remove",
763
+ "aria-label": s.removeFromSelection(p),
764
+ title: s.removeFromSelection(p),
765
+ "data-testid": et,
766
+ "data-aqmx-path": i,
767
+ onClick: (h) => u(i, h.currentTarget),
768
+ children: /* @__PURE__ */ m(He, { "aria-hidden": "true" })
769
+ }
770
+ )
771
+ ] }, i)) }),
772
+ r === void 0 ? null : /* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-open", "data-testid": "markdown-explorer-selection-open", onClick: () => r(d.map(([i]) => i)), children: s.openSelectionInMulti(d.length) })
773
+ ] });
774
+ }, qe = /* @__PURE__ */ new Map(), vr = (e, t) => {
775
+ if (t.selected === e.has(t.path)) return e;
776
+ const n = new Map(e);
777
+ return t.selected ? n.set(t.path, t.name) : n.delete(t.path), n;
778
+ }, br = (e, t) => {
779
+ if (!e.has(t)) return e;
780
+ const n = new Map(e);
781
+ return n.delete(t), n;
782
+ }, gt = Oe(null), Er = (e) => {
783
+ const t = ve(gt);
784
+ H(() => {
785
+ if (t !== null)
786
+ return t(e), () => t(!1);
787
+ }, [t, e]);
788
+ };
789
+ function yr({
790
+ title: e,
791
+ titleId: t,
792
+ ...n
793
+ }, r) {
794
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
795
+ xmlns: "http://www.w3.org/2000/svg",
796
+ viewBox: "0 0 24 24",
797
+ fill: "currentColor",
798
+ "aria-hidden": "true",
799
+ "data-slot": "icon",
800
+ ref: r,
801
+ "aria-labelledby": t
802
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
803
+ id: t
804
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
805
+ fillRule: "evenodd",
806
+ d: "M6.97 2.47a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.25 4.81V16.5a.75.75 0 0 1-1.5 0V4.81L3.53 8.03a.75.75 0 0 1-1.06-1.06l4.5-4.5Zm9.53 4.28a.75.75 0 0 1 .75.75v11.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 1 1 1.06-1.06l3.22 3.22V7.5a.75.75 0 0 1 .75-.75Z",
807
+ clipRule: "evenodd"
808
+ }));
809
+ }
810
+ const Rr = /* @__PURE__ */ f.forwardRef(yr);
811
+ function Sr({
812
+ title: e,
813
+ titleId: t,
814
+ ...n
815
+ }, r) {
816
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
817
+ xmlns: "http://www.w3.org/2000/svg",
818
+ viewBox: "0 0 24 24",
819
+ fill: "currentColor",
820
+ "aria-hidden": "true",
821
+ "data-slot": "icon",
822
+ ref: r,
823
+ "aria-labelledby": t
824
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
825
+ id: t
826
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
827
+ d: "M11.25 4.533A9.707 9.707 0 0 0 6 3a9.735 9.735 0 0 0-3.25.555.75.75 0 0 0-.5.707v14.25a.75.75 0 0 0 1 .707A8.237 8.237 0 0 1 6 18.75c1.995 0 3.823.707 5.25 1.886V4.533ZM12.75 20.636A8.214 8.214 0 0 1 18 18.75c.966 0 1.89.166 2.75.47a.75.75 0 0 0 1-.708V4.262a.75.75 0 0 0-.5-.707A9.735 9.735 0 0 0 18 3a9.707 9.707 0 0 0-5.25 1.533v16.103Z"
828
+ }));
829
+ }
830
+ const Tr = /* @__PURE__ */ f.forwardRef(Sr);
831
+ function Or({
832
+ title: e,
833
+ titleId: t,
834
+ ...n
835
+ }, r) {
836
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
837
+ xmlns: "http://www.w3.org/2000/svg",
838
+ viewBox: "0 0 24 24",
839
+ fill: "currentColor",
840
+ "aria-hidden": "true",
841
+ "data-slot": "icon",
842
+ ref: r,
843
+ "aria-labelledby": t
844
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
845
+ id: t
846
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
847
+ fillRule: "evenodd",
848
+ d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",
849
+ clipRule: "evenodd"
850
+ }));
851
+ }
852
+ const Nr = /* @__PURE__ */ f.forwardRef(Or);
853
+ function Ar({
854
+ title: e,
855
+ titleId: t,
856
+ ...n
857
+ }, r) {
858
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
859
+ xmlns: "http://www.w3.org/2000/svg",
860
+ viewBox: "0 0 24 24",
861
+ fill: "currentColor",
862
+ "aria-hidden": "true",
863
+ "data-slot": "icon",
864
+ ref: r,
865
+ "aria-labelledby": t
866
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
867
+ id: t
868
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
869
+ fillRule: "evenodd",
870
+ d: "M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",
871
+ clipRule: "evenodd"
872
+ }));
873
+ }
874
+ const Lr = /* @__PURE__ */ f.forwardRef(Ar);
875
+ function kr({
876
+ title: e,
877
+ titleId: t,
878
+ ...n
879
+ }, r) {
880
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
881
+ xmlns: "http://www.w3.org/2000/svg",
882
+ viewBox: "0 0 24 24",
883
+ fill: "currentColor",
884
+ "aria-hidden": "true",
885
+ "data-slot": "icon",
886
+ ref: r,
887
+ "aria-labelledby": t
888
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
889
+ id: t
890
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
891
+ fillRule: "evenodd",
892
+ d: "M11.47 4.72a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1-1.06 1.06L12 6.31 8.78 9.53a.75.75 0 0 1-1.06-1.06l3.75-3.75Zm-3.75 9.75a.75.75 0 0 1 1.06 0L12 17.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-3.75 3.75a.75.75 0 0 1-1.06 0l-3.75-3.75a.75.75 0 0 1 0-1.06Z",
893
+ clipRule: "evenodd"
894
+ }));
895
+ }
896
+ const Cr = /* @__PURE__ */ f.forwardRef(kr);
897
+ function qr({
898
+ title: e,
899
+ titleId: t,
900
+ ...n
901
+ }, r) {
902
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
903
+ xmlns: "http://www.w3.org/2000/svg",
904
+ viewBox: "0 0 24 24",
905
+ fill: "currentColor",
906
+ "aria-hidden": "true",
907
+ "data-slot": "icon",
908
+ ref: r,
909
+ "aria-labelledby": t
910
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
911
+ id: t
912
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
913
+ fillRule: "evenodd",
914
+ d: "M11.078 2.25c-.917 0-1.699.663-1.85 1.567L9.05 4.889c-.02.12-.115.26-.297.348a7.493 7.493 0 0 0-.986.57c-.166.115-.334.126-.45.083L6.3 5.508a1.875 1.875 0 0 0-2.282.819l-.922 1.597a1.875 1.875 0 0 0 .432 2.385l.84.692c.095.078.17.229.154.43a7.598 7.598 0 0 0 0 1.139c.015.2-.059.352-.153.43l-.841.692a1.875 1.875 0 0 0-.432 2.385l.922 1.597a1.875 1.875 0 0 0 2.282.818l1.019-.382c.115-.043.283-.031.45.082.312.214.641.405.985.57.182.088.277.228.297.35l.178 1.071c.151.904.933 1.567 1.85 1.567h1.844c.916 0 1.699-.663 1.85-1.567l.178-1.072c.02-.12.114-.26.297-.349.344-.165.673-.356.985-.57.167-.114.335-.125.45-.082l1.02.382a1.875 1.875 0 0 0 2.28-.819l.923-1.597a1.875 1.875 0 0 0-.432-2.385l-.84-.692c-.095-.078-.17-.229-.154-.43a7.614 7.614 0 0 0 0-1.139c-.016-.2.059-.352.153-.43l.84-.692c.708-.582.891-1.59.433-2.385l-.922-1.597a1.875 1.875 0 0 0-2.282-.818l-1.02.382c-.114.043-.282.031-.449-.083a7.49 7.49 0 0 0-.985-.57c-.183-.087-.277-.227-.297-.348l-.179-1.072a1.875 1.875 0 0 0-1.85-1.567h-1.843ZM12 15.75a3.75 3.75 0 1 0 0-7.5 3.75 3.75 0 0 0 0 7.5Z",
915
+ clipRule: "evenodd"
916
+ }));
917
+ }
918
+ const Pr = /* @__PURE__ */ f.forwardRef(qr);
919
+ function Fr({
920
+ title: e,
921
+ titleId: t,
922
+ ...n
923
+ }, r) {
924
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
925
+ xmlns: "http://www.w3.org/2000/svg",
926
+ viewBox: "0 0 24 24",
927
+ fill: "currentColor",
928
+ "aria-hidden": "true",
929
+ "data-slot": "icon",
930
+ ref: r,
931
+ "aria-labelledby": t
932
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
933
+ id: t
934
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
935
+ fillRule: "evenodd",
936
+ d: "M12 1.5a.75.75 0 0 1 .75.75V4.5a.75.75 0 0 1-1.5 0V2.25A.75.75 0 0 1 12 1.5ZM5.636 4.136a.75.75 0 0 1 1.06 0l1.592 1.591a.75.75 0 0 1-1.061 1.06l-1.591-1.59a.75.75 0 0 1 0-1.061Zm12.728 0a.75.75 0 0 1 0 1.06l-1.591 1.592a.75.75 0 0 1-1.06-1.061l1.59-1.591a.75.75 0 0 1 1.061 0Zm-6.816 4.496a.75.75 0 0 1 .82.311l5.228 7.917a.75.75 0 0 1-.777 1.148l-2.097-.43 1.045 3.9a.75.75 0 0 1-1.45.388l-1.044-3.899-1.601 1.42a.75.75 0 0 1-1.247-.606l.569-9.47a.75.75 0 0 1 .554-.68ZM3 10.5a.75.75 0 0 1 .75-.75H6a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 10.5Zm14.25 0a.75.75 0 0 1 .75-.75h2.25a.75.75 0 0 1 0 1.5H18a.75.75 0 0 1-.75-.75Zm-8.962 3.712a.75.75 0 0 1 0 1.061l-1.591 1.591a.75.75 0 1 1-1.061-1.06l1.591-1.592a.75.75 0 0 1 1.06 0Z",
937
+ clipRule: "evenodd"
938
+ }));
939
+ }
940
+ const Mr = /* @__PURE__ */ f.forwardRef(Fr);
941
+ function _r({
942
+ title: e,
943
+ titleId: t,
944
+ ...n
945
+ }, r) {
946
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
947
+ xmlns: "http://www.w3.org/2000/svg",
948
+ viewBox: "0 0 24 24",
949
+ fill: "currentColor",
950
+ "aria-hidden": "true",
951
+ "data-slot": "icon",
952
+ ref: r,
953
+ "aria-labelledby": t
954
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
955
+ id: t
956
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
957
+ fillRule: "evenodd",
958
+ d: "M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5H5.625ZM7.5 15a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 7.5 15Zm.75 2.25a.75.75 0 0 0 0 1.5H12a.75.75 0 0 0 0-1.5H8.25Z",
959
+ clipRule: "evenodd"
960
+ }), /* @__PURE__ */ f.createElement("path", {
961
+ d: "M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"
962
+ }));
963
+ }
964
+ const Ir = /* @__PURE__ */ f.forwardRef(_r);
965
+ function Dr({
966
+ title: e,
967
+ titleId: t,
968
+ ...n
969
+ }, r) {
970
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
971
+ xmlns: "http://www.w3.org/2000/svg",
972
+ viewBox: "0 0 24 24",
973
+ fill: "currentColor",
974
+ "aria-hidden": "true",
975
+ "data-slot": "icon",
976
+ ref: r,
977
+ "aria-labelledby": t
978
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
979
+ id: t
980
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
981
+ d: "M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"
982
+ }));
983
+ }
984
+ const Hr = /* @__PURE__ */ f.forwardRef(Dr);
985
+ function Br({
986
+ title: e,
987
+ titleId: t,
988
+ ...n
989
+ }, r) {
990
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
991
+ xmlns: "http://www.w3.org/2000/svg",
992
+ viewBox: "0 0 24 24",
993
+ fill: "currentColor",
994
+ "aria-hidden": "true",
995
+ "data-slot": "icon",
996
+ ref: r,
997
+ "aria-labelledby": t
998
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
999
+ id: t
1000
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
1001
+ d: "M19.906 9c.382 0 .749.057 1.094.162V9a3 3 0 0 0-3-3h-3.879a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H6a3 3 0 0 0-3 3v3.162A3.756 3.756 0 0 1 4.094 9h15.812ZM4.094 10.5a2.25 2.25 0 0 0-2.227 2.568l.857 6A2.25 2.25 0 0 0 4.951 21H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-2.227-2.568H4.094Z"
1002
+ }));
1003
+ }
1004
+ const $r = /* @__PURE__ */ f.forwardRef(Br);
1005
+ function Zr({
1006
+ title: e,
1007
+ titleId: t,
1008
+ ...n
1009
+ }, r) {
1010
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
1011
+ xmlns: "http://www.w3.org/2000/svg",
1012
+ viewBox: "0 0 24 24",
1013
+ fill: "currentColor",
1014
+ "aria-hidden": "true",
1015
+ "data-slot": "icon",
1016
+ ref: r,
1017
+ "aria-labelledby": t
1018
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
1019
+ id: t
1020
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
1021
+ fillRule: "evenodd",
1022
+ d: "M10.5 3.75a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM2.25 10.5a8.25 8.25 0 1 1 14.59 5.28l4.69 4.69a.75.75 0 1 1-1.06 1.06l-4.69-4.69A8.25 8.25 0 0 1 2.25 10.5Zm8.25-3.75a.75.75 0 0 1 .75.75v2.25h2.25a.75.75 0 0 1 0 1.5h-2.25v2.25a.75.75 0 0 1-1.5 0v-2.25H7.5a.75.75 0 0 1 0-1.5h2.25V7.5a.75.75 0 0 1 .75-.75Z",
1023
+ clipRule: "evenodd"
1024
+ }));
1025
+ }
1026
+ const zr = /* @__PURE__ */ f.forwardRef(Zr);
1027
+ function Vr({
1028
+ title: e,
1029
+ titleId: t,
1030
+ ...n
1031
+ }, r) {
1032
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
1033
+ xmlns: "http://www.w3.org/2000/svg",
1034
+ viewBox: "0 0 24 24",
1035
+ fill: "currentColor",
1036
+ "aria-hidden": "true",
1037
+ "data-slot": "icon",
1038
+ ref: r,
1039
+ "aria-labelledby": t
1040
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
1041
+ id: t
1042
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
1043
+ d: "M5.625 3.75a2.625 2.625 0 1 0 0 5.25h12.75a2.625 2.625 0 0 0 0-5.25H5.625ZM3.75 11.25a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75ZM3 15.75a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75ZM3.75 18.75a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75Z"
1044
+ }));
1045
+ }
1046
+ const jr = /* @__PURE__ */ f.forwardRef(Vr), Kr = Object.freeze({
1047
+ sortMode: Rr,
1048
+ folderPlacement: Hr,
1049
+ readmePlacement: Tr,
1050
+ selectionMode: Nr,
1051
+ doubleClickAction: Mr,
1052
+ expandIconSize: zr,
1053
+ alwaysExpanded: $t,
1054
+ revealDocument: Bt,
1055
+ removeRootIndent: Lr,
1056
+ lines: jr,
1057
+ expandIcons: Cr,
1058
+ directoryIcons: $r,
1059
+ fileIcons: Ir
1060
+ }), vt = (e, t) => {
1061
+ const n = e[t.labelKey];
1062
+ if (typeof n != "string") throw new TypeError(`[markdown-explorer] the tree setting ${t.key} must name a string label; labels.${t.labelKey} is a ${typeof n}`);
1063
+ return n;
1064
+ }, Ur = ({ id: e, settings: t, descriptors: n, onAdvance: r, onClose: o, ref: s }) => {
1065
+ const { labels: a } = D(), l = b([]);
1066
+ B(() => {
1067
+ l.current[0]?.focus();
1068
+ }, []);
1069
+ const d = g(
1070
+ (c) => {
1071
+ const i = n.length;
1072
+ l.current[(c % i + i) % i]?.focus();
1073
+ },
1074
+ [n.length]
1075
+ ), u = g(
1076
+ (c, i) => {
1077
+ switch (c.key) {
1078
+ case "ArrowDown":
1079
+ c.preventDefault(), d(i + 1);
1080
+ break;
1081
+ case "ArrowUp":
1082
+ c.preventDefault(), d(i - 1);
1083
+ break;
1084
+ case "Home":
1085
+ c.preventDefault(), d(0);
1086
+ break;
1087
+ case "End":
1088
+ c.preventDefault(), d(n.length - 1);
1089
+ break;
1090
+ case "Escape":
1091
+ _e(c), o();
1092
+ break;
1093
+ case "Tab":
1094
+ o();
1095
+ break;
1096
+ }
1097
+ },
1098
+ [n.length, d, o]
1099
+ );
1100
+ return /* @__PURE__ */ m("div", { ref: s, id: e, role: "menu", "aria-label": a.treeSettings, className: "aqmx-explorer-menu", "data-testid": "markdown-explorer-tree-settings-menu", children: n.map((c, i) => {
1101
+ const p = Kr[c.key], h = vt(a, c), w = ct(a, t, c.key), v = t[c.key], R = typeof v == "boolean" ? { role: "menuitemcheckbox", "aria-checked": v, "aria-label": h } : { role: "menuitem", "aria-label": `${h}: ${w}` };
1102
+ return /* @__PURE__ */ k(
1103
+ "button",
1104
+ {
1105
+ ref: (A) => {
1106
+ l.current[i] = A;
1107
+ },
1108
+ type: "button",
1109
+ tabIndex: -1,
1110
+ ...R,
1111
+ title: `${h}: ${w}`,
1112
+ className: "aqmx-explorer-menu-item",
1113
+ "data-testid": "markdown-explorer-tree-settings-item",
1114
+ "data-aqmx-setting": c.key,
1115
+ onClick: () => r(c),
1116
+ onKeyDown: (A) => u(A, i),
1117
+ children: [
1118
+ /* @__PURE__ */ m(p, { className: "aqmx-explorer-menu-icon", "aria-hidden": "true" }),
1119
+ /* @__PURE__ */ m("span", { className: "aqmx-explorer-menu-name", children: h }),
1120
+ /* @__PURE__ */ m("span", { className: "aqmx-explorer-menu-value", children: w })
1121
+ ]
1122
+ },
1123
+ c.key
1124
+ );
1125
+ }) });
1126
+ }, Gr = ({ settings: e, descriptors: t, onAdvance: n }) => {
1127
+ const { labels: r, announcer: o } = D(), [s, a] = P(!1), l = b(null), d = b(null), u = b(null), c = Ne(), i = g(() => {
1128
+ l.current?.focus(), a(!1);
1129
+ }, []);
1130
+ B(() => {
1131
+ if (!s) return;
1132
+ const w = (v) => {
1133
+ v.target instanceof Node && (l.current?.contains(v.target) === !0 || d.current?.contains(v.target) === !0) || (a(!1), u.current !== null && window.clearTimeout(u.current), u.current = window.setTimeout(() => {
1134
+ u.current = null, (document.activeElement === null || document.activeElement === document.body) && l.current?.focus();
1135
+ }, 0));
1136
+ };
1137
+ return document.addEventListener("pointerdown", w), () => document.removeEventListener("pointerdown", w);
1138
+ }, [s]), B(
1139
+ () => () => {
1140
+ u.current !== null && window.clearTimeout(u.current);
1141
+ },
1142
+ []
1143
+ );
1144
+ const p = g(
1145
+ (w) => {
1146
+ w.key !== "Escape" || !s || (_e(w), i());
1147
+ },
1148
+ [s, i]
1149
+ ), h = g(
1150
+ (w) => {
1151
+ const v = n(w.key);
1152
+ o.announce(r.settingAnnouncement(vt(r, w), ct(r, v, w.key)));
1153
+ },
1154
+ [o, r, n]
1155
+ );
1156
+ return {
1157
+ trigger: /* @__PURE__ */ m(
1158
+ "button",
1159
+ {
1160
+ ref: l,
1161
+ type: "button",
1162
+ className: "aqmx-icon-button",
1163
+ "aria-haspopup": "menu",
1164
+ "aria-expanded": s,
1165
+ "aria-controls": s ? c : void 0,
1166
+ "aria-label": r.treeSettings,
1167
+ title: r.treeSettings,
1168
+ "data-testid": "markdown-explorer-tree-settings",
1169
+ onClick: () => a((w) => !w),
1170
+ onKeyDown: p,
1171
+ children: /* @__PURE__ */ m(Pr, { "aria-hidden": "true" })
1172
+ }
1173
+ ),
1174
+ menu: s ? /* @__PURE__ */ m(Ur, { ref: d, id: c, settings: e, descriptors: t, onAdvance: h, onClose: i }) : null
1175
+ };
1176
+ }, Wr = () => {
1177
+ const { treeSettings: e } = D();
1178
+ return { settings: Ie(e.subscribe, e.getSnapshot, e.getServerSnapshot), advance: e.advance };
1179
+ }, tt = /* @__PURE__ */ new Set(), Xr = '[role="tree"] [role="treeitem"][tabindex="0"]', Yr = "[data-directory-tree-tab-stop]", va = (e) => {
1180
+ const { mode: t, sourceId: n, currentPath: r, openPaths: o, onOpenDocument: s, onSourceChange: a, onRevealSource: l, viewSwitch: d } = e, { labels: u, sources: c, trees: i, documents: p, announcer: h, reveals: w } = D(), { settings: v, advance: R } = Wr(), A = M(() => Wt(t === "tree"), [t]), O = t === "tree" && v.selectionMode === "multiple";
1181
+ Er(O);
1182
+ const S = e.mode === "tree" ? e.tray.onGatheredChange : null, $ = e.mode === "tree" ? e.onOpenSelection : void 0, I = e.mode === "tree" ? e.onOpenFolder : null, T = e.mode === "tree" && e.currentFolder, C = M(() => I === null ? null : { current: r, open: I }, [I, r]), L = e.mode === "tree" && O ? e.tray.gathered : qe, E = g(
1183
+ (q) => {
1184
+ const V = R(q);
1185
+ return V.selectionMode !== "multiple" && S?.(qe), V;
1186
+ },
1187
+ [R, S]
1188
+ ), y = Gr({ settings: v, descriptors: A, onAdvance: E }), _ = g((q) => S?.((V) => vr(V, q)), [S]), Z = g((q) => S?.((V) => br(V, q)), [S]), z = g(() => S?.(qe), [S]), U = b(null), ie = g(() => {
1189
+ const q = U.current;
1190
+ if (q === null) return;
1191
+ [Xr, Yr, '[data-testid="markdown-explorer-tree-settings"]'].map((W) => q.querySelector(W)).find((W) => W !== null)?.focus();
1192
+ }, []), re = M(() => new Set(L.keys()), [L]), ae = M(() => r === null ? tt : /* @__PURE__ */ new Set([r]), [r]), J = M(() => {
1193
+ if (t === "multi") return { mode: "multiple", items: o, shownPath: null, onChange: null };
1194
+ switch (v.selectionMode) {
1195
+ case "single":
1196
+ return { mode: "single", items: ae, shownPath: r, onChange: null };
1197
+ case "multiple":
1198
+ return { mode: "multiple", items: re, shownPath: r, onChange: _ };
1199
+ case "none":
1200
+ return { mode: "none", items: tt, shownPath: null, onChange: null };
1201
+ }
1202
+ }, [t, o, v.selectionMode, ae, r, re, _]), G = M(() => v.revealDocument ? { path: r, openFolders: !T } : { path: J.shownPath, openFolders: !1 }, [v.revealDocument, r, T, J.shownPath]), le = g(
1203
+ (q) => {
1204
+ r !== null && w.settle(r), a(q);
1205
+ },
1206
+ [r, w, a]
1207
+ ), [F, oe] = P(null), [ee, de] = P(!1), [se, we] = P(null), ue = b(!1), be = g(async () => {
1208
+ if (!ue.current) {
1209
+ ue.current = !0, de(!0), we(null);
1210
+ try {
1211
+ const q = await i.refresh(n);
1212
+ if (q.status === "superseded") return;
1213
+ p.invalidate(), q.status === "failed" ? we({ sourceId: n, failure: q.failure }) : h.announce(u.treeRefreshed);
1214
+ } finally {
1215
+ ue.current = !1, de(!1);
1216
+ }
1217
+ }
1218
+ }, [i, p, n, h, u]), ge = F === null ? null : F.expandAll, K = F?.expanding === !0, me = c.find((q) => q.id === n), Ee = d.target === "multi" ? bn : gn, pe = d.target === "multi" ? u.switchToMulti : u.switchToTree;
1219
+ return /* @__PURE__ */ k("nav", { ref: U, "aria-label": u.explorerRegion, className: "aqmx-explorer", "data-testid": "markdown-explorer-explorer", "data-aqmx-mode": t, children: [
1220
+ /* @__PURE__ */ k("div", { className: "aqmx-explorer-header", children: [
1221
+ c.length > 1 ? /* @__PURE__ */ m("select", { className: "aqmx-explorer-source", "aria-label": u.sourceLabel, title: me?.label, value: n, onChange: (q) => le(q.currentTarget.value), "data-testid": "markdown-explorer-source-select", children: c.map((q) => /* @__PURE__ */ m("option", { value: q.id, children: q.label }, q.id)) }) : null,
1222
+ /* @__PURE__ */ k("div", { className: "aqmx-explorer-actions", children: [
1223
+ /* @__PURE__ */ m(Zt, { to: d.href, navigation: "switch-view", className: "aqmx-icon-button", "aria-label": pe, title: pe, "data-testid": "markdown-explorer-view-switch", "data-aqmx-target": d.target, children: /* @__PURE__ */ m(Ee, { "aria-hidden": "true" }) }),
1224
+ /* @__PURE__ */ k(
1225
+ "button",
1226
+ {
1227
+ type: "button",
1228
+ className: "aqmx-icon-button aqmx-labelled-button",
1229
+ title: u.refreshTree,
1230
+ "aria-disabled": ee,
1231
+ "aria-busy": ee,
1232
+ "data-aqmx-busy": ee ? "true" : void 0,
1233
+ "data-testid": "markdown-explorer-refresh",
1234
+ onClick: () => {
1235
+ be();
1236
+ },
1237
+ children: [
1238
+ /* @__PURE__ */ m(Me, { "aria-hidden": "true" }),
1239
+ /* @__PURE__ */ m("span", { children: u.refreshTreeLabel })
1240
+ ]
1241
+ }
1242
+ ),
1243
+ /* @__PURE__ */ m(
1244
+ "button",
1245
+ {
1246
+ type: "button",
1247
+ className: "aqmx-icon-button",
1248
+ "aria-label": u.expandAll,
1249
+ title: u.expandAll,
1250
+ "aria-disabled": ge === null || K,
1251
+ "aria-busy": K,
1252
+ "data-aqmx-busy": K ? "true" : void 0,
1253
+ "data-testid": "markdown-explorer-expand-all",
1254
+ onClick: () => ge?.(),
1255
+ children: /* @__PURE__ */ m(xn, { "aria-hidden": "true" })
1256
+ }
1257
+ ),
1258
+ /* @__PURE__ */ m("button", { type: "button", className: "aqmx-icon-button", "aria-label": u.collapseAll, title: u.collapseAll, "aria-disabled": F === null, "data-testid": "markdown-explorer-collapse-all", onClick: () => F?.collapseAll(), children: /* @__PURE__ */ m(fn, { "aria-hidden": "true" }) }),
1259
+ y.trigger
1260
+ ] })
1261
+ ] }),
1262
+ /* @__PURE__ */ k("div", { className: "aqmx-explorer-body", "data-aqmx-explorer-body": "", children: [
1263
+ se !== null && se.sourceId === n ? /* @__PURE__ */ m("p", { role: "alert", className: "aqmx-explorer-refresh-failure", "data-testid": "markdown-explorer-refresh-failure", "data-aqmx-failure": se.failure.reason, children: u.treeRefreshFailed(zt(u, se.failure.reason)) }) : null,
1264
+ /* @__PURE__ */ m(st, { fallback: null, children: /* @__PURE__ */ m(En, {}) }),
1265
+ /* @__PURE__ */ m(xr, { mode: t, sourceId: n, settings: v, reveal: G, openPaths: o, selection: J, onOpenDocument: s, folders: C, onRevealSource: l, onControls: oe }, n),
1266
+ O && L.size > 0 ? /* @__PURE__ */ m(gr, { selection: L, onRemove: Z, onClear: z, onOpenSelection: $, onLeave: ie }) : null,
1267
+ y.menu
1268
+ ] })
1269
+ ] });
1270
+ };
1271
+ function Qr({
1272
+ title: e,
1273
+ titleId: t,
1274
+ ...n
1275
+ }, r) {
1276
+ return /* @__PURE__ */ f.createElement("svg", Object.assign({
1277
+ xmlns: "http://www.w3.org/2000/svg",
1278
+ viewBox: "0 0 24 24",
1279
+ fill: "currentColor",
1280
+ "aria-hidden": "true",
1281
+ "data-slot": "icon",
1282
+ ref: r,
1283
+ "aria-labelledby": t
1284
+ }, n), e ? /* @__PURE__ */ f.createElement("title", {
1285
+ id: t
1286
+ }, e) : null, /* @__PURE__ */ f.createElement("path", {
1287
+ fillRule: "evenodd",
1288
+ d: "M3 6.75A.75.75 0 0 1 3.75 6h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.75ZM3 12a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 12Zm0 5.25a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75Z",
1289
+ clipRule: "evenodd"
1290
+ }));
1291
+ }
1292
+ const bt = /* @__PURE__ */ f.forwardRef(Qr), Jr = ({ explorer: e, toggleRef: t, covered: n, merged: r, onNoticeSlotChange: o, dismissals: s }) => {
1293
+ const { labels: a } = D(), l = mn(), { location: d } = Vt(), [u, c] = P(!1), [i, p] = P({ navigated: l, source: d.source }), [h, w] = P(!1);
1294
+ i.navigated !== l && (p({ navigated: l, source: d.source }), i.source === d.source && !h && c(!1));
1295
+ const [v, R] = P(s);
1296
+ v !== s && (R(s), c(!1));
1297
+ const A = b(null), O = b(null), S = b(null), $ = b(!1), I = Ne();
1298
+ H(() => {
1299
+ const y = A.current;
1300
+ y !== null && (u && !y.open ? (y.showModal(), O.current?.focus()) : !u && y.open && (y.close(), t.current?.focus()), o(u ? S.current : null));
1301
+ }, [u, t, o]), H(() => () => o(null), [o]);
1302
+ const T = g((y) => {
1303
+ y.key !== "Escape" || y.defaultPrevented || (_e(y), c(!1));
1304
+ }, []), C = g((y) => {
1305
+ $.current = y.target === y.currentTarget;
1306
+ }, []), L = g((y) => {
1307
+ const _ = $.current;
1308
+ $.current = !1, _ && y.target === y.currentTarget && c(!1);
1309
+ }, []), E = g(() => {
1310
+ c(!1);
1311
+ }, []);
1312
+ return /* @__PURE__ */ k(rt, { children: [
1313
+ /* @__PURE__ */ m("div", { className: "aqmx-sheet-bar", inert: n, "data-testid": "markdown-explorer-sheet-bar", "data-aqmx-sheet-bar-merged": r ? "true" : "false", children: /* @__PURE__ */ k("button", { ref: t, type: "button", className: "aqmx-explorer-toggle", title: r ? a.showExplorer : void 0, "aria-haspopup": "dialog", "aria-expanded": u, "aria-controls": I, "data-testid": "markdown-explorer-sheet-toggle", onClick: () => c(!0), children: [
1314
+ /* @__PURE__ */ m(bt, { "aria-hidden": "true" }),
1315
+ /* @__PURE__ */ m("span", { className: r ? "aqmx-sr-only" : void 0, children: a.showExplorer })
1316
+ ] }) }),
1317
+ /* @__PURE__ */ m("dialog", { ref: A, id: I, className: "aqmx-sheet", "aria-label": a.explorerRegion, "data-testid": "markdown-explorer-sheet", onKeyDown: T, onPointerDown: C, onClick: L, onClose: E, children: /* @__PURE__ */ k("div", { className: "aqmx-sheet-panel", children: [
1318
+ /* @__PURE__ */ k("div", { className: "aqmx-explorer-chrome", children: [
1319
+ /* @__PURE__ */ m("div", { ref: S, className: "aqmx-sheet-notice-slot" }),
1320
+ /* @__PURE__ */ m("button", { ref: O, type: "button", className: "aqmx-explorer-close", "aria-label": a.hideExplorer, title: a.hideExplorer, "data-testid": "markdown-explorer-sheet-close", onClick: () => c(!1), children: /* @__PURE__ */ m(He, { "aria-hidden": "true" }) })
1321
+ ] }),
1322
+ /* @__PURE__ */ m("div", { className: "aqmx-sheet-body", children: /* @__PURE__ */ m(De, { value: u, children: /* @__PURE__ */ m(gt, { value: w, children: e }) }) }),
1323
+ /* @__PURE__ */ m(jt, { holds: u, testId: "markdown-explorer-sheet-announcer" })
1324
+ ] }) })
1325
+ ] });
1326
+ }, ea = Oe(null), Be = "aqmx-explorer", Et = "aqmx-content", $e = '[role="tree"] [role="treeitem"]', ta = `${$e}[tabindex="0"]`, na = "[data-directory-tree-tab-stop]", ra = (e, t) => {
1327
+ for (const n of e.querySelectorAll(`[data-panel-id="${Be}"] ${$e}`)) if (n.getAttribute(ce) === t) return n;
1328
+ return null;
1329
+ }, nt = (e, t) => ({
1330
+ inlineSize: e > 0 ? e : null,
1331
+ rootFontPixels: t > 0 ? t : nn
1332
+ }), aa = (e, t) => {
1333
+ const [n, r] = P(() => nt(0, 0));
1334
+ return H(() => {
1335
+ const o = e.current, s = t.current;
1336
+ if (o === null || s === null) throw new Error("[markdown-explorer] the split frame is not mounted");
1337
+ const a = { frame: o.getBoundingClientRect().width, rem: s.getBoundingClientRect().width }, l = () => {
1338
+ const u = nt(a.frame, a.rem);
1339
+ r((c) => c.inlineSize === u.inlineSize && c.rootFontPixels === u.rootFontPixels ? c : u);
1340
+ };
1341
+ l();
1342
+ const d = new ResizeObserver((u) => {
1343
+ for (const c of u) {
1344
+ const [i] = c.borderBoxSize;
1345
+ i !== void 0 && (c.target === o && (a.frame = i.inlineSize), c.target === s && (a.rem = i.inlineSize));
1346
+ }
1347
+ l();
1348
+ });
1349
+ return d.observe(o), d.observe(s), () => d.disconnect();
1350
+ }, [e, t]), n;
1351
+ }, yt = (e) => `aqmx-split-handle-${e}`, la = (e, { frameRef: t, sheetToggleRef: n, railToggleRef: r, closeButtonRef: o, handleId: s }) => {
1352
+ const a = b(!1), l = b(null), d = b(!1);
1353
+ H(() => {
1354
+ const c = t.current;
1355
+ if (c === null) throw new Error("[markdown-explorer] the split frame is not mounted");
1356
+ const i = (h) => {
1357
+ const w = h.target instanceof Element ? h.target : null;
1358
+ a.current = w !== null && w.closest(`[data-panel-id="${Et}"]`) === null, !d.current && (l.current = w?.closest(`${$e}[${ce}]`)?.getAttribute(ce) ?? null);
1359
+ }, p = (h) => {
1360
+ h.relatedTarget instanceof Node && !c.contains(h.relatedTarget) && (a.current = !1);
1361
+ };
1362
+ return c.addEventListener("focusin", i), c.addEventListener("focusout", p), () => {
1363
+ c.removeEventListener("focusin", i), c.removeEventListener("focusout", p);
1364
+ };
1365
+ }, [t]);
1366
+ const u = b(e);
1367
+ H(() => {
1368
+ const c = u.current;
1369
+ if (c === e) return;
1370
+ u.current = e;
1371
+ const i = t.current;
1372
+ if (i === null || !a.current) return;
1373
+ const p = (h) => {
1374
+ const { activeElement: w, body: v } = i.ownerDocument;
1375
+ if (w !== null && w !== v) return;
1376
+ const R = h.find((A) => A !== null);
1377
+ if (R != null) {
1378
+ d.current = !0;
1379
+ try {
1380
+ R.focus();
1381
+ } finally {
1382
+ d.current = !1;
1383
+ }
1384
+ }
1385
+ };
1386
+ if (e === "sheet") {
1387
+ p([n.current]);
1388
+ return;
1389
+ }
1390
+ if (e === "rail") {
1391
+ p([r.current]);
1392
+ return;
1393
+ }
1394
+ if (c === "rail") {
1395
+ p([o.current]);
1396
+ return;
1397
+ }
1398
+ queueMicrotask(() => {
1399
+ if (u.current !== e || !a.current) return;
1400
+ const h = l.current, w = `[data-panel-id="${Be}"]`;
1401
+ p([
1402
+ h === null ? null : ra(i, h),
1403
+ i.querySelector(`${w} ${ta}`),
1404
+ i.querySelector(`${w} ${na}`),
1405
+ i.querySelector(`[data-resize-handle-id="${s}"]`)
1406
+ ]);
1407
+ });
1408
+ }, [e, t, n, r, o, s]);
1409
+ }, oa = (e) => e === "tree" ? "treeExplorerHidden" : "multiExplorerHidden", ba = ({ view: e, explorer: t, content: n, contentCoversPage: r = !1, sheetDismissals: o = 0, onDraggingChange: s }) => {
1410
+ const { viewSettings: a } = D(), l = b(null), [d, u] = P(null), c = b(null), i = b(null), p = b(null), h = b(null), { inlineSize: w, rootFontPixels: v } = aa(l, c), R = oa(e), A = ot((y) => y[R] === !0), O = w !== null && w < Xt(v), S = O ? "sheet" : A ? "rail" : "split";
1411
+ la(S, { frameRef: l, sheetToggleRef: i, railToggleRef: p, closeButtonRef: h, handleId: yt(e) });
1412
+ const $ = g(() => a.update({ [R]: !0 }), [a, R]), I = g(() => a.update({ [R]: !1 }), [a, R]), [T, C] = P(!1), L = M(() => O ? { lane: !r, onBar: C } : null, [O, r]), [E] = P(() => /* @__PURE__ */ new Map());
1413
+ return /* @__PURE__ */ m(it, { value: E, children: /* @__PURE__ */ k("div", { ref: l, className: "aqmx-split-frame", "data-aqmx-explorer-mode": S, "data-aqmx-measured": w === null ? "false" : "true", "data-aqmx-content-covers-page": r ? "true" : "false", children: [
1414
+ /* @__PURE__ */ m("span", { ref: c, className: "aqmx-rem-probe", "aria-hidden": "true", "data-aqmx-rem-probe": "" }),
1415
+ O ? /* @__PURE__ */ m(Jr, { explorer: t, toggleRef: i, covered: r, merged: T, onNoticeSlotChange: u, dismissals: o }) : null,
1416
+ /* @__PURE__ */ k("div", { className: "aqmx-split-row", children: [
1417
+ S === "rail" ? /* @__PURE__ */ m(sa, { toggleRef: p, covered: r, onOpen: I }) : null,
1418
+ /* @__PURE__ */ m(ea, { value: O ? d : null, children: /* @__PURE__ */ m(Kt, { value: L, children: /* @__PURE__ */ m(ca, { view: e, mode: S, explorer: t, content: n, contentCoversPage: r, onDraggingChange: s, explorerMinPixels: Yt(v), closeButtonRef: h, onHide: $ }) }) })
1419
+ ] })
1420
+ ] }) });
1421
+ }, sa = ({ toggleRef: e, covered: t, onOpen: n }) => {
1422
+ const { labels: r } = D();
1423
+ return /* @__PURE__ */ m("div", { className: "aqmx-split-rail", inert: t, "data-testid": "markdown-explorer-rail", children: /* @__PURE__ */ m("button", { ref: e, type: "button", className: "aqmx-explorer-toggle", "aria-expanded": !1, "aria-label": r.showExplorer, title: r.showExplorer, "data-testid": "markdown-explorer-rail-toggle", onClick: n, children: /* @__PURE__ */ m(bt, { "aria-hidden": "true" }) }) });
1424
+ }, ca = ({ view: e, mode: t, explorer: n, content: r, contentCoversPage: o, onDraggingChange: s, explorerMinPixels: a, closeButtonRef: l, onHide: d }) => {
1425
+ const { viewSettings: u, labels: c } = D(), p = ot((E) => e === "tree" ? E.treeExplorer : E.multiExplorer) ?? (e === "tree" ? Qt : Jt), h = b(!1), [w, v] = P(!1), R = b(!1), A = b(s);
1426
+ H(() => {
1427
+ A.current = s;
1428
+ }, [s]);
1429
+ const O = un(
1430
+ g(
1431
+ (E) => {
1432
+ if (E.length !== 2) return;
1433
+ const [y = 0, _ = 0] = E, Z = y + _;
1434
+ if (Z <= 0 || y <= 0) return;
1435
+ const z = Math.min(We, y / Z * 100);
1436
+ u.update(e === "tree" ? { treeExplorer: z } : { multiExplorer: z });
1437
+ },
1438
+ [u, e]
1439
+ )
1440
+ );
1441
+ B(
1442
+ () => () => {
1443
+ h.current && A.current?.(!1);
1444
+ },
1445
+ []
1446
+ );
1447
+ const $ = at() ? en : tn, I = t === "split", T = g(() => {
1448
+ R.current = !1, v(!1), d();
1449
+ }, [d]), C = g(
1450
+ (E, y) => {
1451
+ const [_ = 0, Z = 0] = E;
1452
+ E.length === 2 && Z > 0 && (R.current = _ <= 0, v(R.current)), O.layoutChanged(E, y), R.current && y.source === "keyboard" && T();
1453
+ },
1454
+ [O, T]
1455
+ ), L = g(
1456
+ (E) => {
1457
+ h.current = E, s?.(E), O.draggingChanged(E), !E && R.current && T();
1458
+ },
1459
+ [s, O, T]
1460
+ );
1461
+ return /* @__PURE__ */ k(cn, { id: `aqmx-split-${e}`, direction: "horizontal", onLayout: C, className: "aqmx-split", "data-aqmx-split": e, children: [
1462
+ I ? /* @__PURE__ */ k(
1463
+ Xe,
1464
+ {
1465
+ id: Be,
1466
+ defaultSize: { value: p, unit: "percentage" },
1467
+ minSize: { value: a, unit: "pixels" },
1468
+ maxSize: { value: We, unit: "percentage" },
1469
+ collapsible: { from: "end" },
1470
+ pixelAdjustPriority: 1,
1471
+ inert: o,
1472
+ className: "aqmx-split-explorer",
1473
+ children: [
1474
+ /* @__PURE__ */ m("div", { className: "aqmx-explorer-chrome", children: /* @__PURE__ */ m("button", { ref: l, type: "button", className: "aqmx-explorer-close", "aria-label": c.hideExplorer, title: c.hideExplorer, "data-testid": "markdown-explorer-split-close", onClick: T, children: /* @__PURE__ */ m(He, { "aria-hidden": "true" }) }) }),
1475
+ /* @__PURE__ */ m(De, { value: !w, children: n })
1476
+ ]
1477
+ }
1478
+ ) : null,
1479
+ I ? /* @__PURE__ */ m(
1480
+ dn,
1481
+ {
1482
+ id: yt(e),
1483
+ thickness: $,
1484
+ indicator: { visible: !0, thickness: Te.gripThickness, length: Te.gripLength, barThickness: Te.barThickness, barLength: Te.barLength },
1485
+ title: c.resizeExplorer,
1486
+ "aria-label": c.resizeExplorer,
1487
+ onDragging: L,
1488
+ inert: o,
1489
+ className: "aqmx-split-handle"
1490
+ }
1491
+ ) : null,
1492
+ /* @__PURE__ */ m(Xe, { id: Et, defaultSize: { value: I ? 100 - p : 100, unit: "percentage" }, contentOverflow: "hidden", className: "aqmx-split-content", ...o ? { style: { isolation: "auto" } } : {}, children: r })
1493
+ ] });
1494
+ };
1495
+ export {
1496
+ qe as E,
1497
+ ea as S,
1498
+ ba as a,
1499
+ va as b
1500
+ };