@aiquants/markdown-explorer 0.36.0 → 0.37.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 (54) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +74 -11
  3. package/dist/{EditSurface-BCFJRyIM.js → EditSurface-BQgwRUrR.js} +250 -245
  4. package/dist/EditSurface-Xvk5wZu7.cjs +6 -0
  5. package/dist/ExplorerSplit-C_3FChSt.cjs +2 -0
  6. package/dist/ExplorerSplit-C_kaEnyM.js +1619 -0
  7. package/dist/{MultiLayout-Bo9LAXiY.cjs → MultiLayout-BZNj1GYo.cjs} +1 -1
  8. package/dist/{MultiLayout-Dy5TIC2t.js → MultiLayout-DROxkTdD.js} +22 -22
  9. package/dist/{NativeScrollBar-Bj-LKej0.cjs → NativeScrollBar-BDF9A1sc.cjs} +1 -1
  10. package/dist/{NativeScrollBar-DpZMYhmf.js → NativeScrollBar-DvdOpwIW.js} +2 -2
  11. package/dist/{TreeLayout-DsSKW_Qj.js → TreeLayout-Cc-ykewY.js} +2 -2
  12. package/dist/{TreeLayout-T8sc_wg7.cjs → TreeLayout-D_DYV64_.cjs} +1 -1
  13. package/dist/client/MarkdownExplorer.d.cts +4 -5
  14. package/dist/client/MarkdownExplorer.d.ts +4 -5
  15. package/dist/client/hostContract.d.cts +1 -8
  16. package/dist/client/hostContract.d.ts +1 -8
  17. package/dist/core/labels.d.cts +0 -9
  18. package/dist/core/labels.d.ts +0 -9
  19. package/dist/explorerCore-DivWkFQF.cjs +1 -0
  20. package/dist/{explorerCore-B3RGmMG6.js → explorerCore-EkU0mwdW.js} +310 -308
  21. package/dist/index-BmOU3xcK.cjs +18 -0
  22. package/dist/{index-D0l_BJqb.js → index-dtjghDWY.js} +2451 -2434
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.d.cts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +54 -55
  27. package/dist/{merge-Dckw7r9T.cjs → merge-BCFCL1cF.cjs} +1 -1
  28. package/dist/{merge-BwcqBd4c.js → merge-DC_h-t31.js} +1 -1
  29. package/dist/server/anonymous.d.cts +2 -2
  30. package/dist/server/anonymous.d.ts +2 -2
  31. package/dist/server/ports.d.cts +5 -2
  32. package/dist/server/ports.d.ts +5 -2
  33. package/dist/server.cjs +1 -1
  34. package/dist/server.d.cts +1 -1
  35. package/dist/server.d.ts +1 -1
  36. package/dist/server.js +12 -12
  37. package/dist/serverCore.cjs +1 -1
  38. package/dist/serverCore.d.cts +1 -1
  39. package/dist/serverCore.d.ts +1 -1
  40. package/dist/serverCore.js +1 -1
  41. package/dist/styles/markdown-explorer.css +1 -1
  42. package/dist/{tapScrollCircle-smKLgRa2.js → tapScrollCircle-CqMZzWjo.js} +1 -1
  43. package/dist/{tapScrollCircle-DyLInGck.cjs → tapScrollCircle-DVNlszeF.cjs} +1 -1
  44. package/docs/behavior/dom-hooks.md +8 -1
  45. package/docs/behavior/hosting.md +1 -1
  46. package/docs/behavior/localization.md +2 -2
  47. package/docs/behavior/security.md +1 -1
  48. package/docs/behavior/url-contract.md +2 -2
  49. package/package.json +6 -4
  50. package/dist/EditSurface-B70iRFkG.cjs +0 -6
  51. package/dist/ExplorerSplit-BNrHrIus.cjs +0 -2
  52. package/dist/ExplorerSplit-Bgccz2nm.js +0 -1589
  53. package/dist/explorerCore-CUkyKtm8.cjs +0 -1
  54. package/dist/index-lpL7GltU.cjs +0 -18
@@ -0,0 +1,1619 @@
1
+ /*! Bundled third-party code: @heroicons/react 2.2.0 (MIT, ./licenses/@heroicons/react/LICENSE) */
2
+ import { jsx as d, jsxs as F, Fragment as mt } from "react/jsx-runtime";
3
+ import { u as H, a4 as xt, w as Ze, A as wt, y as Jt, a5 as ze, c as gt, Y as vt, a6 as en, a7 as tn, a8 as nn, M as Ve, a9 as rn, aa as ln, ab as an, x as on, ac as sn, ad as cn, ae as dn, af as un, ag as bt, ah as fn, ai as pn, aj as hn } from "./index-dtjghDWY.js";
4
+ import * as h from "react";
5
+ import { use as ye, createContext as Ce, useState as C, useCallback as w, useMemo as I, useRef as E, useLayoutEffect as B, useEffect as Z, useSyncExternalStore as je, Suspense as Et, useId as Pe } from "react";
6
+ import { x as mn, y as xn, z as wn, A as Rt, B as gn, D as vn, G as bn, H as at, I as En, J as Rn, n as Fe, C as yn, F as Sn, K as Tn } from "./location-Dh6K-y7w.js";
7
+ import { useHref as ot, useLocation as An, useNavigationType as On } from "react-router";
8
+ import { V as st } from "./ownUrls-DD0cSCsF.js";
9
+ import { useDirectoryTreeState as Nn, DirectoryTree as Ln } from "@aiquants/directory-tree";
10
+ import { TOUCH_TAP_SCROLL_CIRCLE as kn, TAP_SCROLL_CIRCLE as Fn } from "./tapScrollCircle-CqMZzWjo.js";
11
+ import { s as Cn } from "./storage-D1uSw-xj.js";
12
+ import { d as yt } from "./describeValue-CLlVRO8d.js";
13
+ import { PanelGroup as Pn, Panel as ct, PanelResizeHandle as qn } from "@aiquants/resize-panels";
14
+ import { t as Mn, u as _n } from "./useSplitPersistence-pnb21dsr.js";
15
+ function In({
16
+ title: e,
17
+ titleId: t,
18
+ ...n
19
+ }, r) {
20
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
21
+ xmlns: "http://www.w3.org/2000/svg",
22
+ viewBox: "0 0 24 24",
23
+ fill: "currentColor",
24
+ "aria-hidden": "true",
25
+ "data-slot": "icon",
26
+ ref: r,
27
+ "aria-labelledby": t
28
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
29
+ id: t
30
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
31
+ fillRule: "evenodd",
32
+ 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",
33
+ clipRule: "evenodd"
34
+ }));
35
+ }
36
+ const Dn = /* @__PURE__ */ h.forwardRef(In);
37
+ function Hn({
38
+ title: e,
39
+ titleId: t,
40
+ ...n
41
+ }, r) {
42
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
43
+ xmlns: "http://www.w3.org/2000/svg",
44
+ viewBox: "0 0 24 24",
45
+ fill: "currentColor",
46
+ "aria-hidden": "true",
47
+ "data-slot": "icon",
48
+ ref: r,
49
+ "aria-labelledby": t
50
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
51
+ id: t
52
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
53
+ fillRule: "evenodd",
54
+ 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",
55
+ clipRule: "evenodd"
56
+ }));
57
+ }
58
+ const Bn = /* @__PURE__ */ h.forwardRef(Hn);
59
+ function $n({
60
+ title: e,
61
+ titleId: t,
62
+ ...n
63
+ }, r) {
64
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
65
+ xmlns: "http://www.w3.org/2000/svg",
66
+ viewBox: "0 0 24 24",
67
+ fill: "currentColor",
68
+ "aria-hidden": "true",
69
+ "data-slot": "icon",
70
+ ref: r,
71
+ "aria-labelledby": t
72
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
73
+ id: t
74
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
75
+ 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"
76
+ }), /* @__PURE__ */ h.createElement("path", {
77
+ 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"
78
+ }));
79
+ }
80
+ const Zn = /* @__PURE__ */ h.forwardRef($n);
81
+ function zn({
82
+ title: e,
83
+ titleId: t,
84
+ ...n
85
+ }, r) {
86
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
87
+ xmlns: "http://www.w3.org/2000/svg",
88
+ viewBox: "0 0 24 24",
89
+ fill: "currentColor",
90
+ "aria-hidden": "true",
91
+ "data-slot": "icon",
92
+ ref: r,
93
+ "aria-labelledby": t
94
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
95
+ id: t
96
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
97
+ fillRule: "evenodd",
98
+ 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",
99
+ clipRule: "evenodd"
100
+ }));
101
+ }
102
+ const Vn = /* @__PURE__ */ h.forwardRef(zn), jn = "http://path.invalid", Kn = /[\t\n\r]/gu, Un = (e, t, n, r) => {
103
+ const o = e.replace(Kn, "");
104
+ if (!o.startsWith("/") || o.startsWith("//") || o.includes("\\")) return null;
105
+ const { pathname: s, search: l, hash: a } = new URL(o, jn);
106
+ return !st(s, [t]) || st(s, [n]) ? null : `${r}${s.slice(t.length)}${l}${a}`;
107
+ }, Wn = () => {
108
+ const { notices: e, config: t } = H(), n = ye(e), r = ot(t.basePath), o = ot(t.dataPath);
109
+ return n.length === 0 ? null : /* @__PURE__ */ d("div", { className: "aqmx-explorer-notices", children: n.map((s) => {
110
+ const l = s.action === void 0 ? null : Un(s.action.href, r, o, t.basePath);
111
+ return /* @__PURE__ */ F("div", { className: "aqmx-callout", "data-aqmx-tone": s.tone, "data-testid": "markdown-explorer-notice", "data-aqmx-notice": s.id, children: [
112
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-title", children: s.title }),
113
+ s.body === void 0 ? null : /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: s.body }),
114
+ s.action === void 0 ? null : l === null ? (
115
+ /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: s.action.href, children: s.action.label })
116
+ ) : /* @__PURE__ */ d(xt, { className: "aqmx-callout-action", to: l, navigation: "follow-link", children: s.action.label })
117
+ ] }, s.id);
118
+ }) });
119
+ };
120
+ function Gn({
121
+ title: e,
122
+ titleId: t,
123
+ ...n
124
+ }, r) {
125
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
126
+ xmlns: "http://www.w3.org/2000/svg",
127
+ viewBox: "0 0 24 24",
128
+ fill: "currentColor",
129
+ "aria-hidden": "true",
130
+ "data-slot": "icon",
131
+ ref: r,
132
+ "aria-labelledby": t
133
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
134
+ id: t
135
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
136
+ fillRule: "evenodd",
137
+ 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",
138
+ clipRule: "evenodd"
139
+ }));
140
+ }
141
+ const Xn = /* @__PURE__ */ h.forwardRef(Gn), Ke = Ce(!0), St = Ce(null), Tt = "\0loop\0", At = "\0", Yn = () => {
142
+ const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = (l) => {
143
+ const a = e.get(l);
144
+ if (a !== void 0) return a;
145
+ const f = Object.freeze({ type: "loop", name: l.name, path: l.path });
146
+ return e.set(l, f), f;
147
+ }, o = (l, a, f) => {
148
+ let u = !1;
149
+ const i = l.map((p) => {
150
+ const x = s(p, a, f);
151
+ return x !== p && (u = !0), x;
152
+ });
153
+ if (!u) return l;
154
+ const c = n.get(l);
155
+ return c !== void 0 && c.length === i.length && c.every((p, x) => p === i[x]) ? c : (n.set(l, i), i);
156
+ }, s = (l, a, f) => {
157
+ if (l.type !== "directory") return l;
158
+ if (f.has(l.path)) return r(l);
159
+ const u = l.lazy === !0 ? a(l.path) : void 0, i = u?.status === "loaded", c = i ? u.entries : l.children;
160
+ if (c === void 0) return l;
161
+ f.add(l.path);
162
+ const p = o(c, a, f);
163
+ if (f.delete(l.path), !i && p === l.children) return l;
164
+ const x = t.get(l);
165
+ if (x !== void 0 && x.state === u && x.children === p) return x.grafted;
166
+ const g = { ...l, children: p, lazy: i ? !1 : l.lazy };
167
+ return t.set(l, { state: u, children: p, grafted: g }), g;
168
+ };
169
+ return (l, a) => o(l, a, /* @__PURE__ */ new Set());
170
+ }, Qn = (e, t) => `${Tt}${e}${At}${t}`, ve = (e) => e.startsWith(Tt), Jn = (e) => e.slice(e.lastIndexOf(At) + 1), de = "data-aqmx-path", er = (e, t, n, r, o) => {
171
+ const s = { aqmxPath: e.path };
172
+ return e.modifiedAt !== void 0 && (s.aqmxModifiedAt = e.modifiedAt), n && (s.aqmxOpen = !0), (r === "loading" || r === "failed") && (s.aqmxChildren = r), {
173
+ name: e.name,
174
+ type: e.type,
175
+ absolutePath: e.path,
176
+ relativePath: e.path,
177
+ mimeType: e.mimeType,
178
+ children: t,
179
+ label: o,
180
+ data: s
181
+ };
182
+ }, tr = (e, t, n, r) => {
183
+ const o = Qn(t, e.path);
184
+ return { name: n, type: "directory", absolutePath: o, relativePath: o, children: r, data: { aqmxLoop: e.path } };
185
+ }, nr = () => {
186
+ const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = [], o = (a, f, u) => {
187
+ const i = a.map((p) => p.type === "loop" ? s(p, f, u) : l(p, f)), c = n.get(a);
188
+ return c !== void 0 && c.length === i.length && c.every((p, x) => p === i[x]) ? c : (n.set(a, i), i);
189
+ }, s = (a, f, u) => {
190
+ const i = t.get(a);
191
+ if (i !== void 0 && i.parentKey === u && i.loopFolderName === f.loopFolderName) return i.row;
192
+ const c = tr(a, u, f.loopFolderName(a.name), r);
193
+ return t.set(a, { row: c, parentKey: u, loopFolderName: f.loopFolderName }), c;
194
+ }, l = (a, f) => {
195
+ const u = a.type === "directory" ? a.children === void 0 ? r : o(a.children, f, a.path) : void 0, i = f.openPaths.has(a.path), c = a.type === "directory" && a.lazy === !0 ? f.childrenOf(a.path)?.status : void 0, p = c === "failed" ? f.renderFailedFolder : void 0, x = e.get(a);
196
+ if (x !== void 0 && x.open === i && x.childrenStatus === c && x.children === u && x.renderFailedFolder === p)
197
+ return x.row;
198
+ const g = er(a, u, i, c, p === void 0 ? void 0 : p(a));
199
+ return e.set(a, { row: g, open: i, childrenStatus: c, children: u, renderFailedFolder: p }), g;
200
+ };
201
+ return (a, f) => o(a, f, "");
202
+ }, rr = (e) => {
203
+ if (e === void 0) return;
204
+ const t = (n) => {
205
+ const r = n.data?.aqmxModifiedAt;
206
+ return typeof r == "number" ? { name: n.name, path: n.absolutePath, type: n.type, modifiedAt: r } : { name: n.name, path: n.absolutePath, type: n.type };
207
+ };
208
+ return (n, r) => e(t(n), t(r));
209
+ }, Be = (e, t) => {
210
+ const n = e.filter((r) => r.type === "directory");
211
+ return t === void 0 ? n : n.sort(t);
212
+ }, lr = (e, t) => {
213
+ const n = /* @__PURE__ */ new Map();
214
+ let r = 0;
215
+ const o = (s) => {
216
+ for (const l of Be(s, t.compare))
217
+ if (t.isShownExpanded(l.path)) {
218
+ if (l.lazy !== !0) {
219
+ l.children !== void 0 && o(l.children);
220
+ continue;
221
+ }
222
+ n.has(l.path) || (n.set(l.path, t.isDirect(l.path) ? "direct" : "bulk"), t.childrenOf(l.path)?.status !== "failed" && (r += 1));
223
+ }
224
+ };
225
+ return o(e), { folders: n, waiting: r };
226
+ }, ar = (e) => {
227
+ const t = /* @__PURE__ */ new Set(), n = (r) => {
228
+ for (const o of r)
229
+ o.type === "directory" && (o.lazy === !0 && t.add(o.path), o.children !== void 0 && n(o.children));
230
+ };
231
+ return n(e), t;
232
+ }, Ot = (e, t) => {
233
+ for (const n of e) {
234
+ if (n.type !== "directory") continue;
235
+ if (n.path === t) return n;
236
+ const r = n.children === void 0 ? null : Ot(n.children, t);
237
+ if (r !== null) return r;
238
+ }
239
+ return null;
240
+ }, Nt = (e, t, n) => {
241
+ for (const r of e) {
242
+ if (r === t) return { parent: n };
243
+ const o = r.children === void 0 ? null : Nt(r.children, t, r);
244
+ if (o !== null) return o;
245
+ }
246
+ return null;
247
+ }, or = (e, t, n) => {
248
+ const r = Nt(e, n, null);
249
+ if (r === null) throw new Error(`[markdown-explorer] the pressed folder's row is not among the tree's rows: ${yt(n.absolutePath)}`);
250
+ if (r.parent !== null) return { kind: "folder", path: r.parent.absolutePath };
251
+ const o = mn(t.filter((s) => s.type !== "loop"));
252
+ return o === null ? { kind: "nothing" } : { kind: "document", path: o };
253
+ }, sr = (e, t, n, r) => {
254
+ let o = e;
255
+ for (const s of t) {
256
+ const l = o.find((a) => a.type === "directory" && a.path === s);
257
+ if (l === void 0) return "missing";
258
+ if (l.lazy === !0) return r.childrenOf(l.path)?.status === "failed" ? "failed" : "loading";
259
+ if (!r.isShownExpanded(l.path)) return "loading";
260
+ o = l.children ?? [];
261
+ }
262
+ return o.some((s) => s.type === "file" && s.path === n) ? "ready" : "missing";
263
+ }, it = /* @__PURE__ */ new Set(), cr = (e, t) => e.has(t) ? e : new Set(e).add(t), ir = (e, t) => {
264
+ if (!t.some((r) => e.has(r))) return e;
265
+ const n = new Set(t);
266
+ return new Set([...e].filter((r) => !n.has(r)));
267
+ }, dr = (e, t) => [...e].every((n) => t.has(n)) ? e : new Set([...e].filter((n) => t.has(n))), ur = () => {
268
+ const [e, t] = C(it), n = w((l) => t((a) => cr(a, l)), []), r = w((l) => t((a) => ir(a, l)), []), o = w((l) => t((a) => dr(a, l)), []), s = w(() => t(it), []);
269
+ return I(() => ({ direct: e, markDirect: n, unmarkDirect: r, pruneDirect: o, clearDirect: s }), [e, n, r, o, s]);
270
+ }, fr = (e) => ({
271
+ budget: e,
272
+ handled: /* @__PURE__ */ new Set(),
273
+ loads: /* @__PURE__ */ new Set(),
274
+ opened: 0,
275
+ folderLimited: !1,
276
+ depthLimited: !1,
277
+ announcedStart: !1,
278
+ issuedAgainst: null
279
+ }), pr = (e, t) => {
280
+ const n = [];
281
+ let r = Be(t.entries, t.compare);
282
+ for (let o = 1; r.length > 0; o += 1) {
283
+ const s = [];
284
+ for (const l of r) {
285
+ const { path: a } = l;
286
+ if (t.isShownExpanded(a))
287
+ e.handled.add(a);
288
+ else {
289
+ if (e.handled.has(a)) continue;
290
+ if (e.handled.add(a), l.lazy === !0 && t.childrenOf(a) === void 0) {
291
+ if (o > e.budget.maxDepth) {
292
+ e.depthLimited = !0;
293
+ continue;
294
+ }
295
+ if (e.loads.size >= e.budget.maxFolders) {
296
+ e.folderLimited = !0;
297
+ continue;
298
+ }
299
+ e.loads.add(a);
300
+ }
301
+ n.push(a), e.opened += 1;
302
+ }
303
+ l.lazy !== !0 && l.children !== void 0 && s.push(...Be(l.children, t.compare));
304
+ }
305
+ r = s;
306
+ }
307
+ return n;
308
+ }, Lt = (e, t) => e.every((n) => n.type !== "directory" || t(n.path) && (n.lazy === !0 || n.children === void 0 || Lt(n.children, t))), hr = (e, t) => {
309
+ if (e.folderLimited) return { kind: "folder-limit", opened: e.opened };
310
+ if (e.depthLimited) return { kind: "depth-limit", opened: e.opened };
311
+ let n = 0;
312
+ for (const r of e.loads) t.childrenOf(r)?.status === "failed" && (n += 1);
313
+ return { kind: "done", opened: e.opened, failed: n, complete: Lt(t.entries, t.isShownExpanded) };
314
+ }, De = Object.freeze({ state: "idle" }), mr = (e) => {
315
+ const t = E(null), n = E(e), [r, o] = C(De);
316
+ B(() => {
317
+ n.current = e;
318
+ });
319
+ const s = w(() => {
320
+ t.current === null && (t.current = fr(n.current.budget), o({ state: "running", opened: 0 }));
321
+ }, []), l = w(() => {
322
+ t.current = null, o(De);
323
+ }, []), a = w((f) => {
324
+ const u = t.current;
325
+ if (u === null) return;
326
+ const i = pr(u, f);
327
+ if (i.length > 0 && (u.issuedAgainst = f.expanded, n.current.expandMultiple([...i])), !u.announcedStart && (u.loads.size > 0 || f.waiting > 0) && (u.announcedStart = !0, n.current.onStart()), i.length === 0 && !f.expansionPending && f.expanded !== u.issuedAgainst && f.waiting === 0) {
328
+ t.current = null;
329
+ const p = hr(u, f);
330
+ o(p.kind === "done" ? De : { state: "stopped", stop: p.kind, opened: p.opened }), n.current.onFinish(p);
331
+ return;
332
+ }
333
+ const { opened: c } = u;
334
+ o((p) => p.state === "running" && p.opened === c ? p : { state: "running", opened: c });
335
+ }, []);
336
+ return I(() => ({ status: r, start: s, end: l, advance: a }), [r, s, l, a]);
337
+ }, dt = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"], xr = 8, ut = { least: Number.POSITIVE_INFINITY, stalled: 0 }, wr = ({ tree: e, container: t, path: n, chain: r, rows: o, cancel: s, displayed: l, placement: a }) => {
338
+ const f = E(null), u = E(!0), i = E(ut), c = E(null), p = E(null), x = E(r), g = E(a);
339
+ B(() => {
340
+ x.current = r, g.current = a;
341
+ }, [r, a]);
342
+ const b = w(() => {
343
+ const A = c.current;
344
+ A !== null && (c.current = null, A.phase === "asking" ? A.controller.abort() : x.current?.open(null));
345
+ }, []), S = w(() => {
346
+ f.current = null, b();
347
+ }, [b]), N = w(() => {
348
+ const A = t.current;
349
+ f.current === null || p.current !== null || A === null || A.getClientRects().length === 0 || (p.current = requestAnimationFrame(() => {
350
+ p.current = null;
351
+ const T = f.current;
352
+ if (T === null) return;
353
+ const _ = g.current(T);
354
+ if (_ === 0) {
355
+ u.current = !0, c.current?.phase === "opening" && b();
356
+ return;
357
+ }
358
+ if (e.current?.scrollToPath(T, { align: "nearest" }) === !0) {
359
+ c.current?.phase === "opening" && b();
360
+ const { least: R, stalled: D } = i.current;
361
+ i.current = _ < R ? { least: _, stalled: 0 } : { least: R, stalled: D + 1 }, i.current.stalled < xr && N();
362
+ return;
363
+ }
364
+ const P = c.current;
365
+ if (P === null) {
366
+ f.current = null;
367
+ return;
368
+ }
369
+ P.phase === "opening" && x.current?.progress(P.folders, T) !== "loading" && S();
370
+ }));
371
+ }, [e, t, b, S]), L = w(() => {
372
+ u.current = !1, i.current = ut, N();
373
+ }, [N]);
374
+ Z(() => {
375
+ const A = t.current;
376
+ if (A === null) return;
377
+ const T = typeof ResizeObserver > "u" ? null : new ResizeObserver(L);
378
+ T?.observe(A);
379
+ for (const _ of dt) A.addEventListener(_, S, { passive: !0 });
380
+ return () => {
381
+ T?.disconnect();
382
+ for (const _ of dt) A.removeEventListener(_, S);
383
+ p.current !== null && cancelAnimationFrame(p.current), p.current = null, b();
384
+ };
385
+ }, [t, L, S, b]);
386
+ const y = r !== null;
387
+ Z(() => {
388
+ const A = t.current;
389
+ if (S(), n === null || A === null || A.contains(A.ownerDocument.activeElement)) return;
390
+ f.current = n;
391
+ const T = x.current;
392
+ if (y && T !== null) {
393
+ const _ = new AbortController(), P = { phase: "asking", controller: _ };
394
+ c.current = P, T.ancestors(n, _.signal).then((R) => {
395
+ c.current === P && (R === null ? c.current = null : (c.current = { phase: "opening", folders: R }, x.current?.open(R)), L());
396
+ });
397
+ }
398
+ L();
399
+ }, [n, y, t, S, L]), Z(() => {
400
+ (c.current?.phase === "opening" || f.current !== null && !u.current) && L();
401
+ }, [o, L]);
402
+ const V = E(s);
403
+ Z(() => {
404
+ V.current !== s && (V.current = s, S());
405
+ }, [s, S]);
406
+ const $ = E(l);
407
+ Z(() => {
408
+ $.current && !l && b(), $.current = l;
409
+ }, [l, b]);
410
+ }, gr = "--aqmx-tree-line", vr = Object.freeze(["(forced-colors: active)", "(prefers-color-scheme: dark)"]), br = "data-aqmx-tree-probe", Er = Object.freeze({ rowHeight: xn, lineColor: null }), Rr = (e, t, n) => {
411
+ const [r, o] = C(Er);
412
+ return B(() => {
413
+ const s = e.current;
414
+ if (s === null) return;
415
+ const l = () => {
416
+ const u = Math.round(s.getBoundingClientRect().height), i = getComputedStyle(s), c = i.getPropertyValue(gr).trim() === "" ? null : i.color;
417
+ o((p) => {
418
+ const x = Number.isFinite(u) && u > 0 ? u : p.rowHeight;
419
+ return p.rowHeight === x && p.lineColor === c ? p : { rowHeight: x, lineColor: c };
420
+ });
421
+ };
422
+ l();
423
+ const a = vr.map((u) => window.matchMedia(u));
424
+ for (const u of a) u.addEventListener("change", l);
425
+ const f = typeof ResizeObserver > "u" ? null : new ResizeObserver(l);
426
+ return f?.observe(s), () => {
427
+ for (const u of a) u.removeEventListener("change", l);
428
+ f?.disconnect();
429
+ };
430
+ }, [e, t, n]), r;
431
+ }, kt = "markdown-explorer-tree-scroll", yr = 0.5, Ft = (e, t) => [...e.querySelectorAll(`[role="treeitem"][${de}]`)].find((n) => n.getAttribute(de) === t), Sr = (e, t) => {
432
+ const n = Ft(e, t), r = n?.closest(`[data-testid="${kt}"]`);
433
+ if (n === void 0 || r === null || r === void 0) return Number.POSITIVE_INFINITY;
434
+ const o = r.getBoundingClientRect(), s = n.getBoundingClientRect(), l = o.top - s.top, a = s.height > o.height ? Math.abs(l) : Math.max(0, l) + Math.max(0, s.bottom - o.bottom);
435
+ return a <= yr ? 0 : a;
436
+ }, $e = Object.freeze({
437
+ testId: kt,
438
+ overscanCount: 13,
439
+ callbackThrottleMs: 13,
440
+ scrollBarOptions: Object.freeze({
441
+ width: 8,
442
+ ...nn,
443
+ enableArrowButtons: !0,
444
+ enableArrowButtonTabStops: !1,
445
+ enableScrollToTopBottomButtons: !0,
446
+ tapScrollCircleOptions: Fn
447
+ }),
448
+ behaviorOptions: Object.freeze({ enablePointerDrag: !0 })
449
+ }), Tr = Object.freeze({
450
+ ...$e,
451
+ scrollBarOptions: Object.freeze({
452
+ ...$e.scrollBarOptions,
453
+ ...tn,
454
+ tapScrollCircleOptions: kn
455
+ })
456
+ }), Ar = (e) => e ? Tr : $e, Or = { hoverClassName: "", directorySelectedClassName: "", itemSelectedClassName: "" }, Nr = { color: "inherit", fontSize: "inherit" }, Lr = { fontSize: "inherit" }, kr = /* @__PURE__ */ new Set(), Fr = /* @__PURE__ */ new Map(), Cr = { color: "var(--aqmx-tree-line)" }, Ct = (e) => e instanceof Element ? e.closest(`[${de}]`) : null, Pr = (e) => {
457
+ const t = Ct(e);
458
+ return t === null || t.getAttribute("data-entry-type") !== "file" ? null : t.getAttribute(de);
459
+ }, Pt = (e, t, n, r) => n === "folder-limit" ? e.expandAllFolderLimit(r, t.maxFolders, e.expandAll) : e.expandAllDepthLimit(r, t.maxDepth), qr = (e, t, n) => n.kind === "done" ? e.expandAllDone(n.opened, n.failed, n.complete) : Pt(e, t, n.kind, n.opened), qt = () => {
460
+ const { labels: e } = H();
461
+ return /* @__PURE__ */ F("div", { className: "aqmx-explorer-loading", "aria-busy": "true", "data-testid": "markdown-explorer-tree-loading", children: [
462
+ /* @__PURE__ */ d("p", { className: "aqmx-explorer-loading-text", children: e.treeLoading }),
463
+ /* @__PURE__ */ F("div", { className: "aqmx-skeleton", "aria-hidden": "true", children: [
464
+ /* @__PURE__ */ d("span", {}),
465
+ /* @__PURE__ */ d("span", {}),
466
+ /* @__PURE__ */ d("span", {}),
467
+ /* @__PURE__ */ d("span", {}),
468
+ /* @__PURE__ */ d("span", {})
469
+ ] })
470
+ ] });
471
+ }, Mr = () => {
472
+ const { labels: e } = H();
473
+ return /* @__PURE__ */ F("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-tree-empty", children: [
474
+ /* @__PURE__ */ d(Xn, { className: "aqmx-explorer-empty-icon", "aria-hidden": "true" }),
475
+ /* @__PURE__ */ d("p", { className: "aqmx-empty-title", children: e.treeEmptyTitle }),
476
+ /* @__PURE__ */ d("p", { className: "aqmx-explorer-empty-body", children: e.treeEmptyBody })
477
+ ] });
478
+ }, _r = ({ name: e, onRetry: t }) => {
479
+ const { labels: n } = H(), r = Pe();
480
+ return /* @__PURE__ */ F("span", { className: "aqmx-explorer-folder-failed", children: [
481
+ /* @__PURE__ */ d("span", { className: "aqmx-explorer-folder-name", children: e }),
482
+ /* @__PURE__ */ d("span", { id: r, className: "aqmx-explorer-folder-error", children: n.folderLoadFailed }),
483
+ /* @__PURE__ */ F(
484
+ "button",
485
+ {
486
+ type: "button",
487
+ className: "aqmx-explorer-folder-retry",
488
+ "aria-describedby": r,
489
+ "data-testid": "markdown-explorer-folder-retry",
490
+ onClick: (o) => {
491
+ o.stopPropagation();
492
+ const s = o.currentTarget, l = s.ownerDocument.activeElement === s ? s.closest('[role="treeitem"]') : null;
493
+ l instanceof HTMLElement && vt(l), t();
494
+ },
495
+ onKeyDown: (o) => {
496
+ o.key !== "Escape" && o.stopPropagation();
497
+ },
498
+ children: [
499
+ /* @__PURE__ */ d(ze, { className: "aqmx-explorer-folder-retry-icon", "aria-hidden": "true" }),
500
+ /* @__PURE__ */ d("span", { className: "aqmx-explorer-folder-retry-text", children: n.retry })
501
+ ]
502
+ }
503
+ )
504
+ ] });
505
+ }, Ir = ({
506
+ entries: e,
507
+ version: t,
508
+ mode: n,
509
+ sourceId: r,
510
+ settings: o,
511
+ reveal: s,
512
+ openPaths: l,
513
+ selection: a,
514
+ onOpenDocument: f,
515
+ folders: u,
516
+ onRevealSource: i,
517
+ expansion: c,
518
+ onShown: p,
519
+ marks: x,
520
+ claimsHeld: g,
521
+ expandAll: b,
522
+ revealCancel: S
523
+ }) => {
524
+ const { trees: N, documents: L, labels: y, locale: V, theme: $, paletteKey: A, data: T, config: _, sources: P, reveals: R } = H(), D = ye(Ke), O = ye(St), [z] = C(() => O?.get(r)), W = Ar(gt()), pe = I(() => z === void 0 ? W : { ...W, initialScrollAnchor: z }, [W, z]), [he] = C(nr), Y = E(null), { rowHeight: ue, lineColor: ee } = Rr(Y, $, A), { isExpanded: ne, toggle: fe, expandMultiple: j, collapseMultiple: me, expanded: Q, isPending: q } = c, { alwaysExpanded: re, sortMode: J, folderPlacement: xe, readmePlacement: we } = o, { direct: Se, markDirect: le, unmarkDirect: oe, pruneDirect: Te } = x, { running: be, advance: Ee } = b, k = E(null), G = E(null);
525
+ B(() => {
526
+ if (O === null) return;
527
+ const m = k;
528
+ return () => {
529
+ const v = m.current === null ? null : m.current.getScrollAnchor();
530
+ v === null ? O.delete(r) : O.set(r, v);
531
+ };
532
+ }, [O, r]);
533
+ const te = I(() => wn({ sortMode: J, folderPlacement: xe, readmePlacement: we }), [J, xe, we]), Bt = I(() => rr(te), [te]), ae = w((m) => N.children(r, m), [N, r]), se = I(() => ar(e), [e]), Re = w((m) => re && !se.has(m), [re, se]), ce = w((m) => !ve(m) && (ne(m) || Re(m)), [ne, Re]), K = E({ shownExpanded: ce, isExpanded: ne, isHeld: Re, unloadedFolders: se, entries: e, childrenOf: ae, folderSelection: u, openDocument: f });
534
+ B(() => {
535
+ K.current = { shownExpanded: ce, isExpanded: ne, isHeld: Re, unloadedFolders: se, entries: e, childrenOf: ae, folderSelection: u, openDocument: f };
536
+ }, [ce, ne, Re, se, e, ae, u, f]);
537
+ const [ie] = C(() => /* @__PURE__ */ new Map()), qe = w(
538
+ (m, v) => {
539
+ R.settle(v), m.open(v);
540
+ },
541
+ [R]
542
+ ), Ae = w(
543
+ (m, v) => {
544
+ v.kind !== "nothing" && R.settle(v.path), m.close(v);
545
+ },
546
+ [R]
547
+ ), ge = w(
548
+ (m, v) => {
549
+ for (const M of m) {
550
+ const U = ie.get(M);
551
+ if (U === void 0) continue;
552
+ ie.delete(M);
553
+ const X = K.current.folderSelection;
554
+ !v && X !== null && X.current === M && Ae(X, U);
555
+ }
556
+ },
557
+ [ie, Ae]
558
+ ), Xe = w((m) => {
559
+ k.current?.scrollToPath(m, { align: "nearest" }), requestAnimationFrame(() => {
560
+ const v = G.current, M = v === null ? void 0 : Ft(v, m);
561
+ M !== void 0 && vt(M);
562
+ });
563
+ }, []), $t = w(
564
+ (m) => {
565
+ if (ve(m)) {
566
+ Xe(Jn(m));
567
+ return;
568
+ }
569
+ ge([m], !K.current.shownExpanded(m)), K.current.isExpanded(m) ? oe([m]) : K.current.unloadedFolders.has(m) && le(m), fe(m);
570
+ },
571
+ [Xe, ge, le, oe, fe]
572
+ ), Me = w(
573
+ (m) => {
574
+ const v = m.filter((M) => !ve(M));
575
+ v.length !== 0 && (ge(v, !1), oe(v), me(v));
576
+ },
577
+ [ge, oe, me]
578
+ ), Zt = w(
579
+ (m) => {
580
+ const v = m.filter((M) => !ve(M));
581
+ if (v.length !== 0) {
582
+ if (v.length < m.length && v.every((M) => K.current.shownExpanded(M))) {
583
+ Me(v);
584
+ return;
585
+ }
586
+ ge(v, !0), j(v);
587
+ }
588
+ },
589
+ [ge, j, Me]
590
+ ), Ye = w(
591
+ (m) => /* @__PURE__ */ d(
592
+ _r,
593
+ {
594
+ name: m.name,
595
+ onRetry: () => {
596
+ le(m.path), N.retryChildren(r, m.path), K.current.shownExpanded(m.path) || j([m.path]);
597
+ }
598
+ }
599
+ ),
600
+ [N, r, le, j]
601
+ ), Qe = n === "multi" ? l : kr, { loopFolderName: Je } = y, Oe = I(() => he(e, { openPaths: Qe, childrenOf: ae, renderFailedFolder: Ye, loopFolderName: Je }), [he, e, Qe, ae, Ye, Je, t]), et = E(Oe);
602
+ B(() => {
603
+ et.current = Oe;
604
+ }, [Oe]);
605
+ const zt = en(L, Pr), tt = E([]), Ne = w(() => {
606
+ for (const m of tt.current) K.current.unloadedFolders.has(m) && le(m);
607
+ }, [le]), { maxDepth: _e } = _.revealDocument, nt = E(i);
608
+ B(() => {
609
+ nt.current = i;
610
+ }, [i]);
611
+ const Vt = I(
612
+ () => ({
613
+ ancestors: async (m, v) => {
614
+ const M = R.take(r, m);
615
+ if (M !== null) return M;
616
+ if (!R.mayMove(m)) {
617
+ const X = await T.ancestors(r, m, v);
618
+ return X.status !== "ok" || X.ancestors === null || X.ancestors.length > _e ? null : X.ancestors;
619
+ }
620
+ const U = await T.reveal(r, m, v);
621
+ return U.status !== "ok" || U.source === null || U.ancestors.length > _e ? null : U.source === r ? U.ancestors : (v.aborted || !P.some((X) => X.id === U.source) || (R.move(U.source, m, U.ancestors), nt.current(U.source)), null);
622
+ },
623
+ open: (m) => {
624
+ tt.current = m ?? [], m !== null && (Ne(), j([...m]));
625
+ },
626
+ progress: (m, v) => sr(K.current.entries, m, v, { isShownExpanded: K.current.shownExpanded, childrenOf: K.current.childrenOf })
627
+ }),
628
+ [T, r, P, R, _e, Ne, j]
629
+ );
630
+ Z(() => Ne(), [Ne, se]);
631
+ const jt = I(() => [e, t, Q], [e, t, Q]), Kt = w((m) => G.current === null ? Number.POSITIVE_INFINITY : Sr(G.current, m), []);
632
+ wr({ tree: k, container: G, path: s.path, chain: s.openFolders ? Vt : null, rows: jt, cancel: S, displayed: D, placement: Kt });
633
+ const rt = w((m) => Se.has(m), [Se]), Le = I(() => lr(e, { isShownExpanded: ce, childrenOf: ae, compare: te, isDirect: rt }), [e, ce, ae, te, rt, t]), ke = D && g;
634
+ B(() => {
635
+ p(e);
636
+ }, [e, p]), B(() => () => p(null), [p]), Z(() => N.claimChildren(r, ke ? Le.folders : Fr), [N, r, ke, Le]), Z(() => Te(se), [Te, se]), Z(() => {
637
+ ke && be && Ee({ entries: e, isShownExpanded: ce, childrenOf: ae, compare: te, expanded: Q, waiting: Le.waiting, expansionPending: q });
638
+ }, [ke, be, Ee, e, ce, ae, te, Q, Le, q]);
639
+ const Ut = w(
640
+ (m) => {
641
+ const v = m.entry.absolutePath, { folderSelection: M, openDocument: U } = K.current;
642
+ if (m.isDirectory) {
643
+ if (M === null || ve(v)) return;
644
+ const X = v === M.current, lt = or(et.current, K.current.entries, m.entry);
645
+ if (K.current.isHeld(v)) {
646
+ m.preventDefault(), ie.delete(v), X ? Ae(M, lt) : qe(M, v);
647
+ return;
648
+ }
649
+ ie.set(v, lt), m.isExpanded || X || qe(M, v);
650
+ return;
651
+ }
652
+ R.settle(v), U(v);
653
+ },
654
+ [R, ie, Ae, qe]
655
+ ), Wt = w(
656
+ (m) => {
657
+ if (m.key !== "ArrowLeft" && m.key !== "ArrowRight") return;
658
+ const v = Ct(m.target), M = v === null ? null : v.getAttribute(de);
659
+ M !== null && ie.delete(M);
660
+ },
661
+ [ie]
662
+ ), { onChange: Ie } = a, Gt = I(
663
+ () => Ie === null ? void 0 : (m, v) => {
664
+ ve(m.absolutePath) || Ie({ path: m.absolutePath, name: m.name, selected: v });
665
+ },
666
+ [Ie]
667
+ ), Xt = I(() => new Set(a.items), [a.items]), Yt = I(
668
+ () => ({
669
+ entryKindDirectory: y.treeEntryKindDirectory,
670
+ entryKindFile: y.treeEntryKindFile,
671
+ scrollUp: y.treeScrollUp,
672
+ scrollDown: y.treeScrollDown,
673
+ scrollToTop: y.treeScrollToTop,
674
+ scrollToBottom: y.treeScrollToBottom
675
+ }),
676
+ [y]
677
+ ), Qt = ee === null ? { showTreeLines: !1 } : { showTreeLines: o.lines, lineColor: ee };
678
+ return /* @__PURE__ */ F("div", { ref: G, className: "aqmx-explorer-tree", "data-testid": "markdown-explorer-tree", onKeyDownCapture: Wt, ...zt, children: [
679
+ /* @__PURE__ */ d("span", { ref: Y, className: "aqmx-explorer-tree-probe", "aria-hidden": "true", [br]: "" }),
680
+ /* @__PURE__ */ d(
681
+ Ln,
682
+ {
683
+ ref: k,
684
+ entries: Oe,
685
+ expansion: {
686
+ toggle: $t,
687
+ isExpanded: ce,
688
+ expandMultiple: Zt,
689
+ collapseMultiple: Me,
690
+ isPending: q && !be,
691
+ doubleClickAction: o.doubleClickAction
692
+ },
693
+ selection: { mode: a.mode, selectedPath: a.shownPath, currentPath: a.shownPath, selectedItems: Xt, onEntryClick: Ut, onSelectionChange: Gt },
694
+ visual: {
695
+ className: "aqmx-explorer-tree-view",
696
+ ariaLabel: y.treeRegion,
697
+ ...Qt,
698
+ showExpandIcons: o.expandIcons,
699
+ expandIconStyle: Cr,
700
+ showDirectoryIcons: o.directoryIcons,
701
+ showFileIcons: o.fileIcons,
702
+ expandIconSize: o.expandIconSize,
703
+ itemHeight: ue,
704
+ removeRootIndent: o.removeRootIndent,
705
+ highlightStyles: Or,
706
+ entryStyle: Lr,
707
+ nameStyle: Nr
708
+ },
709
+ virtualScroll: pe,
710
+ sort: Bt,
711
+ locale: V,
712
+ labels: Yt
713
+ }
714
+ )
715
+ ] });
716
+ }, Dr = ({ pending: e, status: t }) => {
717
+ const { labels: n } = H(), r = t.state !== "running", [o, s] = C(0), l = E(!0);
718
+ B(() => {
719
+ const f = l.current;
720
+ if (l.current = r, !r || e > 0 && !f) {
721
+ s(0);
722
+ return;
723
+ }
724
+ if (e > 0) {
725
+ s(e);
726
+ return;
727
+ }
728
+ if (o === 0) return;
729
+ const u = setTimeout(() => s(0), 0);
730
+ return () => clearTimeout(u);
731
+ }, [r, e, o]);
732
+ const a = r && e === 0 ? o : e;
733
+ return a === 0 && r ? null : /* @__PURE__ */ F("p", { className: "aqmx-explorer-tree-progress", "data-testid": "markdown-explorer-tree-progress", "data-aqmx-loading": String(a), "data-aqmx-expand-all": t.state, children: [
734
+ a > 0 ? /* @__PURE__ */ d(ze, { className: "aqmx-explorer-tree-progress-icon", "aria-hidden": "true" }) : null,
735
+ /* @__PURE__ */ d("span", { children: t.state === "running" ? n.expandAllProgress(t.opened, a) : n.foldersLoading(a) })
736
+ ] });
737
+ }, Hr = ({ stop: e, opened: t, budget: n }) => {
738
+ const { labels: r } = H();
739
+ return /* @__PURE__ */ d("p", { className: "aqmx-explorer-expand-all-stop", "data-testid": "markdown-explorer-expand-all-stop", "data-aqmx-stop": e, children: Pt(r, n, e, t) });
740
+ }, Br = ({ entries: e, ...t }) => {
741
+ const { trees: n } = H(), r = je(n.subscribe, n.version, n.version), { sourceId: o } = t, [s] = C(Yn), l = I(() => s(e, (a) => n.children(o, a)), [s, e, n, o, r]);
742
+ return l.length === 0 ? /* @__PURE__ */ d(Mr, {}) : /* @__PURE__ */ d(Ir, { entries: l, version: r, ...t });
743
+ }, $r = ({ result: e, onRetry: t, ...n }) => {
744
+ const { renderTreeFailure: r } = H(), o = ye(e);
745
+ if (o.status === "deferred") return /* @__PURE__ */ d(qt, {});
746
+ if (o.status === "ok") return /* @__PURE__ */ d(Br, { entries: o.entries, ...n });
747
+ const s = r?.(o.failure);
748
+ return /* @__PURE__ */ d("div", { className: "aqmx-explorer-tree-message", "data-testid": "markdown-explorer-tree-failure", "data-aqmx-failure": o.failure.reason, children: s !== void 0 ? s : /* @__PURE__ */ d(Jt, { failure: o.failure, alert: !0, onRetry: t, testId: null }) });
749
+ }, Zr = Object.freeze([]), zr = (e) => e !== void 0 && e.status === "failed" && Ze(e.failure.reason), Vr = ({ failure: e, onRetry: t }) => /* @__PURE__ */ d(wt, { failure: e, place: "read", deniedSentence: null, retry: t, testId: "markdown-explorer-folder-access-failure" }), jr = ({ onControls: e, ...t }) => {
750
+ const { trees: n, storageNamespace: r, labels: o, announcer: s, config: l } = H(), { sourceId: a } = t, f = Nn({ storageKey: Cn(r).treeExpansion(a) });
751
+ je(n.subscribe, n.version, n.version);
752
+ const u = n.read(a), i = w(() => n.retry(a), [n, a]);
753
+ B(() => n.open(a), [n, a]);
754
+ const c = ur(), { expanded: p, expandMultiple: x, collapseAll: g } = f, [b, S] = C(null), N = b !== p, L = E(p);
755
+ B(() => {
756
+ L.current = p;
757
+ }, [p]);
758
+ const y = l.expandAll, V = w(() => s.announce(o.expandAllStarted), [s, o]), $ = w((q) => s.announce(qr(o, y, q)), [s, o, y]), A = mr({ budget: y, expandMultiple: x, onStart: V, onFinish: $ }), { status: T, start: _, end: P, advance: R } = A, D = T.state === "running", O = I(() => ({ running: D, advance: R }), [D, R]), z = E(null), [W, pe] = C(!1), he = w((q) => {
759
+ z.current = q, pe(q !== null);
760
+ }, []), [Y, ue] = C(null);
761
+ Z(
762
+ () => n.subscribeChildrenFailures((q) => {
763
+ const re = q.sourceId === a && z.current !== null ? Ot(z.current, q.path) : null;
764
+ if (re !== null) {
765
+ if (Ze(q.failure.reason)) {
766
+ ue((J) => J === null ? { failure: q.failure, paths: [q.path] } : J.paths.includes(q.path) ? J : { failure: J.failure, paths: [...J.paths, q.path] });
767
+ return;
768
+ }
769
+ s.announce({ list: o.foldersLoadFailedNamed, item: re.name });
770
+ }
771
+ }),
772
+ [n, a, s, o]
773
+ );
774
+ const ee = Y === null ? Zr : Y.paths.filter((q) => zr(n.children(a, q)));
775
+ Y !== null && ee.length === 0 && ue(null);
776
+ const ne = () => {
777
+ for (const q of ee) n.retryChildren(a, q);
778
+ }, { clearDirect: fe } = c, [j, me] = C(0), Q = w(() => {
779
+ me((q) => q + 1), P(), fe(), S(L.current), g();
780
+ }, [P, fe, g]);
781
+ return Z(() => {
782
+ e({ collapseAll: Q, expandAll: W ? _ : null, expanding: D });
783
+ }, [e, Q, _, W, D]), Z(() => () => e(null), [e]), Z(() => {
784
+ W || P();
785
+ }, [W, P]), /* @__PURE__ */ F(mt, { children: [
786
+ Y === null || ee.length === 0 ? null : /* @__PURE__ */ d(Vr, { failure: Y.failure, onRetry: ne }),
787
+ T.state === "stopped" ? /* @__PURE__ */ d(Hr, { stop: T.stop, opened: T.opened, budget: y }) : null,
788
+ /* @__PURE__ */ F("div", { className: "aqmx-explorer-tree-area", children: [
789
+ /* @__PURE__ */ d(Et, { fallback: /* @__PURE__ */ d(qt, {}), children: /* @__PURE__ */ d($r, { result: u, onRetry: i, expansion: f, onShown: he, marks: c, claimsHeld: N, expandAll: O, revealCancel: j, ...t }) }),
790
+ /* @__PURE__ */ d(Dr, { pending: n.pendingChildren(a), status: T })
791
+ ] })
792
+ ] });
793
+ };
794
+ function Kr({
795
+ title: e,
796
+ titleId: t,
797
+ ...n
798
+ }, r) {
799
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
800
+ xmlns: "http://www.w3.org/2000/svg",
801
+ viewBox: "0 0 24 24",
802
+ fill: "currentColor",
803
+ "aria-hidden": "true",
804
+ "data-slot": "icon",
805
+ ref: r,
806
+ "aria-labelledby": t
807
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
808
+ id: t
809
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
810
+ fillRule: "evenodd",
811
+ 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",
812
+ clipRule: "evenodd"
813
+ }));
814
+ }
815
+ const Ue = /* @__PURE__ */ h.forwardRef(Kr), ft = "markdown-explorer-selection-remove", Ur = ({ selection: e, onRemove: t, onClear: n, onOpenSelection: r, onLeave: o }) => {
816
+ const { labels: s } = H(), l = Pe(), a = E(null), f = [...e], u = (c, p) => {
817
+ if (p.ownerDocument.activeElement === p) {
818
+ const x = a.current === null ? [] : [...a.current.querySelectorAll(`[data-testid="${ft}"]`)], g = x.indexOf(p), b = [x[g + 1], x[g - 1]].find((S) => S !== void 0);
819
+ b === void 0 ? o() : b.focus();
820
+ }
821
+ t(c);
822
+ }, i = () => {
823
+ const c = a.current;
824
+ c !== null && c.contains(c.ownerDocument.activeElement) && o(), n();
825
+ };
826
+ return /* @__PURE__ */ F("section", { ref: a, className: "aqmx-explorer-tray", "aria-labelledby": l, "data-testid": "markdown-explorer-selection-tray", children: [
827
+ /* @__PURE__ */ F("div", { className: "aqmx-explorer-tray-header", children: [
828
+ /* @__PURE__ */ d("p", { id: l, className: "aqmx-explorer-tray-title", children: s.selectionTitle(f.length) }),
829
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-explorer-tray-button", "data-testid": "markdown-explorer-selection-clear", onClick: i, children: s.clearSelection })
830
+ ] }),
831
+ /* @__PURE__ */ d("ul", { className: "aqmx-explorer-tray-list", children: f.map(([c, p]) => /* @__PURE__ */ F("li", { className: "aqmx-explorer-tray-item", children: [
832
+ /* @__PURE__ */ d("span", { className: "aqmx-explorer-tray-name", title: c, children: p }),
833
+ /* @__PURE__ */ d(
834
+ "button",
835
+ {
836
+ type: "button",
837
+ className: "aqmx-icon-button aqmx-explorer-tray-remove",
838
+ "aria-label": s.removeFromSelection(p),
839
+ title: s.removeFromSelection(p),
840
+ "data-testid": ft,
841
+ "data-aqmx-path": c,
842
+ onClick: (x) => u(c, x.currentTarget),
843
+ children: /* @__PURE__ */ d(Ue, { "aria-hidden": "true" })
844
+ }
845
+ )
846
+ ] }, c)) }),
847
+ r === void 0 ? null : /* @__PURE__ */ d("button", { type: "button", className: "aqmx-explorer-tray-open", "data-testid": "markdown-explorer-selection-open", onClick: () => r(f.map(([c]) => c)), children: s.openSelectionInMulti(f.length) })
848
+ ] });
849
+ }, He = /* @__PURE__ */ new Map(), Wr = (e, t) => {
850
+ if (t.selected === e.has(t.path)) return e;
851
+ const n = new Map(e);
852
+ return t.selected ? n.set(t.path, t.name) : n.delete(t.path), n;
853
+ }, Gr = (e, t) => {
854
+ if (!e.has(t)) return e;
855
+ const n = new Map(e);
856
+ return n.delete(t), n;
857
+ }, Mt = Ce(null), Xr = (e) => {
858
+ const t = ye(Mt);
859
+ B(() => {
860
+ if (t !== null)
861
+ return t(e), () => t(!1);
862
+ }, [t, e]);
863
+ };
864
+ function Yr({
865
+ title: e,
866
+ titleId: t,
867
+ ...n
868
+ }, r) {
869
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
870
+ xmlns: "http://www.w3.org/2000/svg",
871
+ viewBox: "0 0 24 24",
872
+ fill: "currentColor",
873
+ "aria-hidden": "true",
874
+ "data-slot": "icon",
875
+ ref: r,
876
+ "aria-labelledby": t
877
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
878
+ id: t
879
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
880
+ fillRule: "evenodd",
881
+ 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",
882
+ clipRule: "evenodd"
883
+ }));
884
+ }
885
+ const Qr = /* @__PURE__ */ h.forwardRef(Yr);
886
+ function Jr({
887
+ title: e,
888
+ titleId: t,
889
+ ...n
890
+ }, r) {
891
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
892
+ xmlns: "http://www.w3.org/2000/svg",
893
+ viewBox: "0 0 24 24",
894
+ fill: "currentColor",
895
+ "aria-hidden": "true",
896
+ "data-slot": "icon",
897
+ ref: r,
898
+ "aria-labelledby": t
899
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
900
+ id: t
901
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
902
+ 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"
903
+ }));
904
+ }
905
+ const el = /* @__PURE__ */ h.forwardRef(Jr);
906
+ function tl({
907
+ title: e,
908
+ titleId: t,
909
+ ...n
910
+ }, r) {
911
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
912
+ xmlns: "http://www.w3.org/2000/svg",
913
+ viewBox: "0 0 24 24",
914
+ fill: "currentColor",
915
+ "aria-hidden": "true",
916
+ "data-slot": "icon",
917
+ ref: r,
918
+ "aria-labelledby": t
919
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
920
+ id: t
921
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
922
+ fillRule: "evenodd",
923
+ 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",
924
+ clipRule: "evenodd"
925
+ }));
926
+ }
927
+ const nl = /* @__PURE__ */ h.forwardRef(tl);
928
+ function rl({
929
+ title: e,
930
+ titleId: t,
931
+ ...n
932
+ }, r) {
933
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
934
+ xmlns: "http://www.w3.org/2000/svg",
935
+ viewBox: "0 0 24 24",
936
+ fill: "currentColor",
937
+ "aria-hidden": "true",
938
+ "data-slot": "icon",
939
+ ref: r,
940
+ "aria-labelledby": t
941
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
942
+ id: t
943
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
944
+ fillRule: "evenodd",
945
+ 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",
946
+ clipRule: "evenodd"
947
+ }));
948
+ }
949
+ const ll = /* @__PURE__ */ h.forwardRef(rl);
950
+ function al({
951
+ title: e,
952
+ titleId: t,
953
+ ...n
954
+ }, r) {
955
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
956
+ xmlns: "http://www.w3.org/2000/svg",
957
+ viewBox: "0 0 24 24",
958
+ fill: "currentColor",
959
+ "aria-hidden": "true",
960
+ "data-slot": "icon",
961
+ ref: r,
962
+ "aria-labelledby": t
963
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
964
+ id: t
965
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
966
+ fillRule: "evenodd",
967
+ 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",
968
+ clipRule: "evenodd"
969
+ }));
970
+ }
971
+ const ol = /* @__PURE__ */ h.forwardRef(al);
972
+ function sl({
973
+ title: e,
974
+ titleId: t,
975
+ ...n
976
+ }, r) {
977
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
978
+ xmlns: "http://www.w3.org/2000/svg",
979
+ viewBox: "0 0 24 24",
980
+ fill: "currentColor",
981
+ "aria-hidden": "true",
982
+ "data-slot": "icon",
983
+ ref: r,
984
+ "aria-labelledby": t
985
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
986
+ id: t
987
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
988
+ fillRule: "evenodd",
989
+ 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",
990
+ clipRule: "evenodd"
991
+ }));
992
+ }
993
+ const cl = /* @__PURE__ */ h.forwardRef(sl);
994
+ function il({
995
+ title: e,
996
+ titleId: t,
997
+ ...n
998
+ }, r) {
999
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
1000
+ xmlns: "http://www.w3.org/2000/svg",
1001
+ viewBox: "0 0 24 24",
1002
+ fill: "currentColor",
1003
+ "aria-hidden": "true",
1004
+ "data-slot": "icon",
1005
+ ref: r,
1006
+ "aria-labelledby": t
1007
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
1008
+ id: t
1009
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
1010
+ fillRule: "evenodd",
1011
+ 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",
1012
+ clipRule: "evenodd"
1013
+ }));
1014
+ }
1015
+ const dl = /* @__PURE__ */ h.forwardRef(il);
1016
+ function ul({
1017
+ title: e,
1018
+ titleId: t,
1019
+ ...n
1020
+ }, r) {
1021
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
1022
+ xmlns: "http://www.w3.org/2000/svg",
1023
+ viewBox: "0 0 24 24",
1024
+ fill: "currentColor",
1025
+ "aria-hidden": "true",
1026
+ "data-slot": "icon",
1027
+ ref: r,
1028
+ "aria-labelledby": t
1029
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
1030
+ id: t
1031
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
1032
+ fillRule: "evenodd",
1033
+ 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",
1034
+ clipRule: "evenodd"
1035
+ }), /* @__PURE__ */ h.createElement("path", {
1036
+ 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"
1037
+ }));
1038
+ }
1039
+ const fl = /* @__PURE__ */ h.forwardRef(ul);
1040
+ function pl({
1041
+ title: e,
1042
+ titleId: t,
1043
+ ...n
1044
+ }, r) {
1045
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
1046
+ xmlns: "http://www.w3.org/2000/svg",
1047
+ viewBox: "0 0 24 24",
1048
+ fill: "currentColor",
1049
+ "aria-hidden": "true",
1050
+ "data-slot": "icon",
1051
+ ref: r,
1052
+ "aria-labelledby": t
1053
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
1054
+ id: t
1055
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
1056
+ 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"
1057
+ }));
1058
+ }
1059
+ const hl = /* @__PURE__ */ h.forwardRef(pl);
1060
+ function ml({
1061
+ title: e,
1062
+ titleId: t,
1063
+ ...n
1064
+ }, r) {
1065
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
1066
+ xmlns: "http://www.w3.org/2000/svg",
1067
+ viewBox: "0 0 24 24",
1068
+ fill: "currentColor",
1069
+ "aria-hidden": "true",
1070
+ "data-slot": "icon",
1071
+ ref: r,
1072
+ "aria-labelledby": t
1073
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
1074
+ id: t
1075
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
1076
+ 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"
1077
+ }));
1078
+ }
1079
+ const xl = /* @__PURE__ */ h.forwardRef(ml);
1080
+ function wl({
1081
+ title: e,
1082
+ titleId: t,
1083
+ ...n
1084
+ }, r) {
1085
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
1086
+ xmlns: "http://www.w3.org/2000/svg",
1087
+ viewBox: "0 0 24 24",
1088
+ fill: "currentColor",
1089
+ "aria-hidden": "true",
1090
+ "data-slot": "icon",
1091
+ ref: r,
1092
+ "aria-labelledby": t
1093
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
1094
+ id: t
1095
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
1096
+ fillRule: "evenodd",
1097
+ 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",
1098
+ clipRule: "evenodd"
1099
+ }));
1100
+ }
1101
+ const gl = /* @__PURE__ */ h.forwardRef(wl);
1102
+ function vl({
1103
+ title: e,
1104
+ titleId: t,
1105
+ ...n
1106
+ }, r) {
1107
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
1108
+ xmlns: "http://www.w3.org/2000/svg",
1109
+ viewBox: "0 0 24 24",
1110
+ fill: "currentColor",
1111
+ "aria-hidden": "true",
1112
+ "data-slot": "icon",
1113
+ ref: r,
1114
+ "aria-labelledby": t
1115
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
1116
+ id: t
1117
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
1118
+ fillRule: "evenodd",
1119
+ d: "M4.125 3C3.089 3 2.25 3.84 2.25 4.875V18a3 3 0 0 0 3 3h15a3 3 0 0 1-3-3V4.875C17.25 3.839 16.41 3 15.375 3H4.125ZM12 9.75a.75.75 0 0 0 0 1.5h1.5a.75.75 0 0 0 0-1.5H12Zm-.75-2.25a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 0 1.5H12a.75.75 0 0 1-.75-.75ZM6 12.75a.75.75 0 0 0 0 1.5h7.5a.75.75 0 0 0 0-1.5H6Zm-.75 3.75a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5H6a.75.75 0 0 1-.75-.75ZM6 6.75a.75.75 0 0 0-.75.75v3c0 .414.336.75.75.75h3a.75.75 0 0 0 .75-.75v-3A.75.75 0 0 0 9 6.75H6Z",
1120
+ clipRule: "evenodd"
1121
+ }), /* @__PURE__ */ h.createElement("path", {
1122
+ d: "M18.75 6.75h1.875c.621 0 1.125.504 1.125 1.125V18a1.5 1.5 0 0 1-3 0V6.75Z"
1123
+ }));
1124
+ }
1125
+ const bl = /* @__PURE__ */ h.forwardRef(vl);
1126
+ function El({
1127
+ title: e,
1128
+ titleId: t,
1129
+ ...n
1130
+ }, r) {
1131
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
1132
+ xmlns: "http://www.w3.org/2000/svg",
1133
+ viewBox: "0 0 24 24",
1134
+ fill: "currentColor",
1135
+ "aria-hidden": "true",
1136
+ "data-slot": "icon",
1137
+ ref: r,
1138
+ "aria-labelledby": t
1139
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
1140
+ id: t
1141
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
1142
+ 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"
1143
+ }));
1144
+ }
1145
+ const Rl = /* @__PURE__ */ h.forwardRef(El), yl = Object.freeze({
1146
+ sortMode: Qr,
1147
+ folderPlacement: hl,
1148
+ readmePlacement: el,
1149
+ selectionMode: nl,
1150
+ doubleClickAction: dl,
1151
+ expandIconSize: gl,
1152
+ alwaysExpanded: ln,
1153
+ revealDocument: rn,
1154
+ showFolderReadme: bl,
1155
+ removeRootIndent: ll,
1156
+ lines: Rl,
1157
+ expandIcons: ol,
1158
+ directoryIcons: xl,
1159
+ fileIcons: fl
1160
+ }), _t = (e, t) => {
1161
+ const n = e[t.labelKey];
1162
+ if (typeof n != "string") throw new TypeError(`[markdown-explorer] the tree setting ${t.key} must name a string label; labels.${t.labelKey} is ${yt(n)}`);
1163
+ return n;
1164
+ }, Sl = ({ id: e, settings: t, descriptors: n, onAdvance: r, onClose: o, ref: s }) => {
1165
+ const { labels: l } = H(), a = E([]);
1166
+ Z(() => {
1167
+ a.current[0]?.focus();
1168
+ }, []);
1169
+ const f = w(
1170
+ (i) => {
1171
+ const c = n.length;
1172
+ a.current[(i % c + c) % c]?.focus();
1173
+ },
1174
+ [n.length]
1175
+ ), u = w(
1176
+ (i, c) => {
1177
+ switch (i.key) {
1178
+ case "ArrowDown":
1179
+ i.preventDefault(), f(c + 1);
1180
+ break;
1181
+ case "ArrowUp":
1182
+ i.preventDefault(), f(c - 1);
1183
+ break;
1184
+ case "Home":
1185
+ i.preventDefault(), f(0);
1186
+ break;
1187
+ case "End":
1188
+ i.preventDefault(), f(n.length - 1);
1189
+ break;
1190
+ case "Escape":
1191
+ Ve(i), o();
1192
+ break;
1193
+ case "Tab":
1194
+ o();
1195
+ break;
1196
+ }
1197
+ },
1198
+ [n.length, f, o]
1199
+ );
1200
+ return /* @__PURE__ */ d("div", { ref: s, id: e, role: "menu", "aria-label": l.treeSettings, className: "aqmx-explorer-menu", "data-testid": "markdown-explorer-tree-settings-menu", children: n.map((i, c) => {
1201
+ const p = yl[i.key], x = _t(l, i), g = Rt(l, t, i.key), b = t[i.key], S = typeof b == "boolean" ? { role: "menuitemcheckbox", "aria-checked": b, "aria-label": x } : { role: "menuitem", "aria-label": `${x}: ${g}` };
1202
+ return /* @__PURE__ */ F(
1203
+ "button",
1204
+ {
1205
+ ref: (N) => {
1206
+ a.current[c] = N;
1207
+ },
1208
+ type: "button",
1209
+ tabIndex: -1,
1210
+ ...S,
1211
+ title: `${x}: ${g}`,
1212
+ className: "aqmx-explorer-menu-item",
1213
+ "data-testid": "markdown-explorer-tree-settings-item",
1214
+ "data-aqmx-setting": i.key,
1215
+ onClick: () => r(i),
1216
+ onKeyDown: (N) => u(N, c),
1217
+ children: [
1218
+ /* @__PURE__ */ d(p, { className: "aqmx-explorer-menu-icon", "aria-hidden": "true" }),
1219
+ /* @__PURE__ */ d("span", { className: "aqmx-explorer-menu-name", children: x }),
1220
+ /* @__PURE__ */ d("span", { className: "aqmx-explorer-menu-value", children: g })
1221
+ ]
1222
+ },
1223
+ i.key
1224
+ );
1225
+ }) });
1226
+ }, Tl = ({ settings: e, descriptors: t, onAdvance: n }) => {
1227
+ const { labels: r, announcer: o } = H(), [s, l] = C(!1), a = E(null), f = E(null), u = E(null), i = Pe(), c = w(() => {
1228
+ a.current?.focus(), l(!1);
1229
+ }, []);
1230
+ Z(() => {
1231
+ if (!s) return;
1232
+ const g = (b) => {
1233
+ b.target instanceof Node && (a.current?.contains(b.target) === !0 || f.current?.contains(b.target) === !0) || (l(!1), u.current !== null && window.clearTimeout(u.current), u.current = window.setTimeout(() => {
1234
+ u.current = null, (document.activeElement === null || document.activeElement === document.body) && a.current?.focus();
1235
+ }, 0));
1236
+ };
1237
+ return document.addEventListener("pointerdown", g), () => document.removeEventListener("pointerdown", g);
1238
+ }, [s]), Z(
1239
+ () => () => {
1240
+ u.current !== null && window.clearTimeout(u.current);
1241
+ },
1242
+ []
1243
+ );
1244
+ const p = w(
1245
+ (g) => {
1246
+ g.key !== "Escape" || !s || (Ve(g), c());
1247
+ },
1248
+ [s, c]
1249
+ ), x = w(
1250
+ (g) => {
1251
+ const b = n(g.key);
1252
+ o.announce(r.settingAnnouncement(_t(r, g), Rt(r, b, g.key)));
1253
+ },
1254
+ [o, r, n]
1255
+ );
1256
+ return {
1257
+ trigger: /* @__PURE__ */ d(
1258
+ "button",
1259
+ {
1260
+ ref: a,
1261
+ type: "button",
1262
+ className: "aqmx-icon-button",
1263
+ "aria-haspopup": "menu",
1264
+ "aria-expanded": s,
1265
+ "aria-controls": s ? i : void 0,
1266
+ "aria-label": r.treeSettings,
1267
+ title: r.treeSettings,
1268
+ "data-testid": "markdown-explorer-tree-settings",
1269
+ onClick: () => l((g) => !g),
1270
+ onKeyDown: p,
1271
+ children: /* @__PURE__ */ d(cl, { "aria-hidden": "true" })
1272
+ }
1273
+ ),
1274
+ menu: s ? /* @__PURE__ */ d(Sl, { ref: f, id: i, settings: e, descriptors: t, onAdvance: x, onClose: c }) : null
1275
+ };
1276
+ }, Al = () => {
1277
+ const { treeSettings: e } = H();
1278
+ return { settings: je(e.subscribe, e.getSnapshot, e.getServerSnapshot), advance: e.advance };
1279
+ }, pt = /* @__PURE__ */ new Set(), Ol = '[role="tree"] [role="treeitem"][tabindex="0"]', Nl = "[data-directory-tree-tab-stop]", Jl = (e) => {
1280
+ const { mode: t, sourceId: n, currentPath: r, openPaths: o, onOpenDocument: s, onSourceChange: l, onRevealSource: a, viewSwitch: f } = e, { labels: u, sources: i, trees: c, documents: p, announcer: x, reveals: g } = H(), { settings: b, advance: S } = Al(), N = I(() => gn(t), [t]), L = t === "tree" && b.selectionMode === "multiple";
1281
+ Xr(L);
1282
+ const y = e.mode === "tree" ? e.tray.onGatheredChange : null, V = e.mode === "tree" ? e.onOpenSelection : void 0, $ = e.mode === "tree" ? e.onOpenFolder : null, A = e.mode === "tree" ? e.onCloseFolder : null, T = e.mode === "tree" && e.currentFolder, _ = I(() => $ === null || A === null || !b.showFolderReadme ? null : { current: r, open: $, close: A }, [$, A, r, b.showFolderReadme]), P = e.mode === "tree" && L ? e.tray.gathered : He, R = w(
1283
+ (k) => {
1284
+ const G = S(k);
1285
+ return G.selectionMode !== "multiple" && y?.(He), G;
1286
+ },
1287
+ [S, y]
1288
+ ), D = Tl({ settings: b, descriptors: N, onAdvance: R }), O = w((k) => y?.((G) => Wr(G, k)), [y]), z = w((k) => y?.((G) => Gr(G, k)), [y]), W = w(() => y?.(He), [y]), pe = E(null), he = w(() => {
1289
+ const k = pe.current;
1290
+ if (k === null) return;
1291
+ [Ol, Nl, '[data-testid="markdown-explorer-tree-settings"]'].map((te) => k.querySelector(te)).find((te) => te !== null)?.focus();
1292
+ }, []), Y = I(() => new Set(P.keys()), [P]), ue = I(() => r === null ? pt : /* @__PURE__ */ new Set([r]), [r]), ee = I(() => {
1293
+ if (t === "multi") return { mode: "multiple", items: o, shownPath: null, onChange: null };
1294
+ switch (b.selectionMode) {
1295
+ case "single":
1296
+ return { mode: "single", items: ue, shownPath: r, onChange: null };
1297
+ case "multiple":
1298
+ return { mode: "multiple", items: Y, shownPath: r, onChange: O };
1299
+ case "none":
1300
+ return { mode: "none", items: pt, shownPath: null, onChange: null };
1301
+ }
1302
+ }, [t, o, b.selectionMode, ue, r, Y, O]), ne = I(() => b.revealDocument ? { path: r, openFolders: !T } : { path: ee.shownPath, openFolders: !1 }, [b.revealDocument, r, T, ee.shownPath]), fe = w(
1303
+ (k) => {
1304
+ r !== null && g.settle(r), l(k);
1305
+ },
1306
+ [r, g, l]
1307
+ ), [j, me] = C(null), [Q, q] = C(!1), [re, J] = C(null), xe = E(!1), we = w(async () => {
1308
+ if (!xe.current) {
1309
+ xe.current = !0, q(!0), J(null);
1310
+ try {
1311
+ const k = await c.refresh(n);
1312
+ if (k.status === "superseded") return;
1313
+ p.invalidate(), k.status === "failed" ? J({ sourceId: n, failure: k.failure }) : x.announce(u.treeRefreshed);
1314
+ } finally {
1315
+ xe.current = !1, q(!1);
1316
+ }
1317
+ }
1318
+ }, [c, p, n, x, u]), Se = w(() => {
1319
+ we();
1320
+ }, [we]), le = j === null ? null : j.expandAll, oe = j?.expanding === !0, Te = i.find((k) => k.id === n), be = f.target === "multi" ? Vn : Zn, Ee = f.target === "multi" ? u.switchToMulti : u.switchToTree;
1321
+ return /* @__PURE__ */ F("nav", { ref: pe, "aria-label": u.explorerRegion, className: "aqmx-explorer", "data-testid": "markdown-explorer-explorer", "data-aqmx-mode": t, children: [
1322
+ /* @__PURE__ */ F("div", { className: "aqmx-explorer-header", children: [
1323
+ i.length > 1 ? /* @__PURE__ */ d("select", { className: "aqmx-explorer-source", "aria-label": u.sourceLabel, title: Te?.label, value: n, onChange: (k) => fe(k.currentTarget.value), "data-testid": "markdown-explorer-source-select", children: i.map((k) => /* @__PURE__ */ d("option", { value: k.id, children: k.label }, k.id)) }) : null,
1324
+ /* @__PURE__ */ F("div", { className: "aqmx-explorer-actions", children: [
1325
+ /* @__PURE__ */ d(xt, { to: f.href, navigation: "switch-view", className: "aqmx-icon-button", "aria-label": Ee, title: Ee, "data-testid": "markdown-explorer-view-switch", "data-aqmx-target": f.target, children: /* @__PURE__ */ d(be, { "aria-hidden": "true" }) }),
1326
+ /* @__PURE__ */ F(
1327
+ "button",
1328
+ {
1329
+ type: "button",
1330
+ className: "aqmx-icon-button aqmx-labelled-button",
1331
+ title: u.refreshTree,
1332
+ "aria-disabled": Q,
1333
+ "aria-busy": Q,
1334
+ "data-aqmx-busy": Q ? "true" : void 0,
1335
+ "data-testid": "markdown-explorer-refresh",
1336
+ onClick: () => {
1337
+ we();
1338
+ },
1339
+ children: [
1340
+ /* @__PURE__ */ d(ze, { "aria-hidden": "true" }),
1341
+ /* @__PURE__ */ d("span", { children: u.refreshTreeLabel })
1342
+ ]
1343
+ }
1344
+ ),
1345
+ /* @__PURE__ */ d(
1346
+ "button",
1347
+ {
1348
+ type: "button",
1349
+ className: "aqmx-icon-button",
1350
+ "aria-label": u.expandAll,
1351
+ title: u.expandAll,
1352
+ "aria-disabled": le === null || oe,
1353
+ "aria-busy": oe,
1354
+ "data-aqmx-busy": oe ? "true" : void 0,
1355
+ "data-testid": "markdown-explorer-expand-all",
1356
+ onClick: () => le?.(),
1357
+ children: /* @__PURE__ */ d(Bn, { "aria-hidden": "true" })
1358
+ }
1359
+ ),
1360
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": u.collapseAll, title: u.collapseAll, "aria-disabled": j === null, "data-testid": "markdown-explorer-collapse-all", onClick: () => j?.collapseAll(), children: /* @__PURE__ */ d(Dn, { "aria-hidden": "true" }) }),
1361
+ D.trigger
1362
+ ] })
1363
+ ] }),
1364
+ /* @__PURE__ */ F("div", { className: "aqmx-explorer-body", "data-aqmx-explorer-body": "", children: [
1365
+ /* @__PURE__ */ d(an, {}),
1366
+ re !== null && re.sourceId === n ? /* @__PURE__ */ d(Ll, { failure: re.failure, onRetry: Se }) : null,
1367
+ /* @__PURE__ */ d(Et, { fallback: null, children: /* @__PURE__ */ d(Wn, {}) }),
1368
+ /* @__PURE__ */ d(jr, { mode: t, sourceId: n, settings: b, reveal: ne, openPaths: o, selection: ee, onOpenDocument: s, folders: _, onRevealSource: a, onControls: me }, n),
1369
+ L && P.size > 0 ? /* @__PURE__ */ d(Ur, { selection: P, onRemove: z, onClear: W, onOpenSelection: V, onLeave: he }) : null,
1370
+ D.menu
1371
+ ] })
1372
+ ] });
1373
+ }, Ll = ({ failure: e, onRetry: t }) => {
1374
+ const { labels: n } = H(), { reason: r } = e;
1375
+ return Ze(r) ? /* @__PURE__ */ d(wt, { failure: e, place: "read", deniedSentence: null, retry: t, testId: "markdown-explorer-refresh-failure" }) : /* @__PURE__ */ d("p", { role: "alert", className: "aqmx-explorer-refresh-failure", "data-testid": "markdown-explorer-refresh-failure", "data-aqmx-failure": r, children: n.treeRefreshFailed(on(n, r)) });
1376
+ };
1377
+ function kl({
1378
+ title: e,
1379
+ titleId: t,
1380
+ ...n
1381
+ }, r) {
1382
+ return /* @__PURE__ */ h.createElement("svg", Object.assign({
1383
+ xmlns: "http://www.w3.org/2000/svg",
1384
+ viewBox: "0 0 24 24",
1385
+ fill: "currentColor",
1386
+ "aria-hidden": "true",
1387
+ "data-slot": "icon",
1388
+ ref: r,
1389
+ "aria-labelledby": t
1390
+ }, n), e ? /* @__PURE__ */ h.createElement("title", {
1391
+ id: t
1392
+ }, e) : null, /* @__PURE__ */ h.createElement("path", {
1393
+ fillRule: "evenodd",
1394
+ 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",
1395
+ clipRule: "evenodd"
1396
+ }));
1397
+ }
1398
+ const It = /* @__PURE__ */ h.forwardRef(kl), Fl = ({ explorer: e, toggleRef: t, covered: n, merged: r, onNoticeSlotChange: o, accessFailures: s, dismissals: l }) => {
1399
+ const { labels: a } = H(), f = An(), u = On(), { location: i } = sn(), [c, p] = C(!1), [x, g] = C({ navigated: f, source: i.source }), [b, S] = C(!1);
1400
+ x.navigated !== f && (g({ navigated: f, source: i.source }), x.source === i.source && !b && cn(u, f.state) !== "close-folder" && p(!1));
1401
+ const [N, L] = C(l);
1402
+ N !== l && (L(l), p(!1));
1403
+ const y = E(null), V = E(null), $ = E(null), A = E(!1), T = Pe();
1404
+ B(() => {
1405
+ const O = y.current;
1406
+ O !== null && (c && !O.open ? (O.showModal(), V.current?.focus()) : !c && O.open && (O.close(), t.current?.focus()), o(c ? $.current : null));
1407
+ }, [c, t, o]), B(() => () => o(null), [o]);
1408
+ const _ = w((O) => {
1409
+ O.key !== "Escape" || O.defaultPrevented || (Ve(O), p(!1));
1410
+ }, []), P = w((O) => {
1411
+ A.current = O.target === O.currentTarget;
1412
+ }, []), R = w((O) => {
1413
+ const z = A.current;
1414
+ A.current = !1, z && O.target === O.currentTarget && p(!1);
1415
+ }, []), D = w(() => {
1416
+ p(!1);
1417
+ }, []);
1418
+ return /* @__PURE__ */ F(mt, { children: [
1419
+ /* @__PURE__ */ d("div", { className: "aqmx-sheet-bar", inert: n, "data-testid": "markdown-explorer-sheet-bar", "data-aqmx-sheet-bar-merged": r ? "true" : "false", children: /* @__PURE__ */ F("button", { ref: t, type: "button", className: "aqmx-explorer-toggle", title: r ? a.showExplorer : void 0, "aria-haspopup": "dialog", "aria-expanded": c, "aria-controls": T, "data-testid": "markdown-explorer-sheet-toggle", onClick: () => p(!0), children: [
1420
+ /* @__PURE__ */ d(It, { "aria-hidden": "true" }),
1421
+ /* @__PURE__ */ d("span", { className: r ? "aqmx-sr-only" : void 0, children: a.showExplorer })
1422
+ ] }) }),
1423
+ /* @__PURE__ */ d("dialog", { ref: y, id: T, className: "aqmx-sheet", "aria-label": a.explorerRegion, "data-testid": "markdown-explorer-sheet", onKeyDown: _, onPointerDown: P, onClick: R, onClose: D, children: /* @__PURE__ */ F("div", { className: "aqmx-sheet-panel", children: [
1424
+ /* @__PURE__ */ F("div", { className: "aqmx-explorer-chrome", children: [
1425
+ /* @__PURE__ */ d("div", { ref: $, className: "aqmx-sheet-notice-slot" }),
1426
+ /* @__PURE__ */ d("button", { ref: V, type: "button", className: "aqmx-explorer-close", "aria-label": a.hideExplorer, title: a.hideExplorer, "data-testid": "markdown-explorer-sheet-close", onClick: () => p(!1), children: /* @__PURE__ */ d(Ue, { "aria-hidden": "true" }) })
1427
+ ] }),
1428
+ /* @__PURE__ */ d("div", { className: "aqmx-sheet-body", children: /* @__PURE__ */ d(Ke, { value: c, children: /* @__PURE__ */ d(dn, { value: s, children: /* @__PURE__ */ d(Mt, { value: S, children: e }) }) }) }),
1429
+ /* @__PURE__ */ d(un, { holds: c, deferWhileFullscreenIn: null, testId: "markdown-explorer-sheet-announcer" })
1430
+ ] }) })
1431
+ ] });
1432
+ }, Cl = Ce(null), We = "aqmx-explorer", Dt = "aqmx-content", Ge = '[role="tree"] [role="treeitem"]', Pl = `${Ge}[tabindex="0"]`, ql = "[data-directory-tree-tab-stop]", Ml = (e, t) => {
1433
+ for (const n of e.querySelectorAll(`[data-panel-id="${We}"] ${Ge}`)) if (n.getAttribute(de) === t) return n;
1434
+ return null;
1435
+ }, ht = (e, t) => ({
1436
+ inlineSize: e > 0 ? e : null,
1437
+ rootFontPixels: t > 0 ? t : Tn
1438
+ }), _l = (e, t) => {
1439
+ const [n, r] = C(() => ht(0, 0));
1440
+ return B(() => {
1441
+ const o = e.current, s = t.current;
1442
+ if (o === null || s === null) throw new Error("[markdown-explorer] the split frame is not mounted");
1443
+ const l = { frame: o.getBoundingClientRect().width, rem: s.getBoundingClientRect().width }, a = () => {
1444
+ const u = ht(l.frame, l.rem);
1445
+ r((i) => i.inlineSize === u.inlineSize && i.rootFontPixels === u.rootFontPixels ? i : u);
1446
+ };
1447
+ a();
1448
+ const f = new ResizeObserver((u) => {
1449
+ for (const i of u) {
1450
+ const [c] = i.borderBoxSize;
1451
+ c !== void 0 && (i.target === o && (l.frame = c.inlineSize), i.target === s && (l.rem = c.inlineSize));
1452
+ }
1453
+ a();
1454
+ });
1455
+ return f.observe(o), f.observe(s), () => f.disconnect();
1456
+ }, [e, t]), n;
1457
+ }, Ht = (e) => `aqmx-split-handle-${e}`, Il = (e, { frameRef: t, sheetToggleRef: n, railToggleRef: r, closeButtonRef: o, handleId: s }) => {
1458
+ const l = E(!1), a = E(null), f = E(!1);
1459
+ B(() => {
1460
+ const i = t.current;
1461
+ if (i === null) throw new Error("[markdown-explorer] the split frame is not mounted");
1462
+ const c = (x) => {
1463
+ const g = x.target instanceof Element ? x.target : null;
1464
+ l.current = g !== null && g.closest(`[data-panel-id="${Dt}"]`) === null, !f.current && (a.current = g?.closest(`${Ge}[${de}]`)?.getAttribute(de) ?? null);
1465
+ }, p = (x) => {
1466
+ x.relatedTarget instanceof Node && !i.contains(x.relatedTarget) && (l.current = !1);
1467
+ };
1468
+ return i.addEventListener("focusin", c), i.addEventListener("focusout", p), () => {
1469
+ i.removeEventListener("focusin", c), i.removeEventListener("focusout", p);
1470
+ };
1471
+ }, [t]);
1472
+ const u = E(e);
1473
+ B(() => {
1474
+ const i = u.current;
1475
+ if (i === e) return;
1476
+ u.current = e;
1477
+ const c = t.current;
1478
+ if (c === null || !l.current) return;
1479
+ const p = (x) => {
1480
+ const { activeElement: g, body: b } = c.ownerDocument;
1481
+ if (g !== null && g !== b) return;
1482
+ const S = x.find((N) => N !== null);
1483
+ if (S != null) {
1484
+ f.current = !0;
1485
+ try {
1486
+ S.focus();
1487
+ } finally {
1488
+ f.current = !1;
1489
+ }
1490
+ }
1491
+ };
1492
+ if (e === "sheet") {
1493
+ p([n.current]);
1494
+ return;
1495
+ }
1496
+ if (e === "rail") {
1497
+ p([r.current]);
1498
+ return;
1499
+ }
1500
+ if (i === "rail") {
1501
+ p([o.current]);
1502
+ return;
1503
+ }
1504
+ queueMicrotask(() => {
1505
+ if (u.current !== e || !l.current) return;
1506
+ const x = a.current, g = `[data-panel-id="${We}"]`;
1507
+ p([
1508
+ x === null ? null : Ml(c, x),
1509
+ c.querySelector(`${g} ${Pl}`),
1510
+ c.querySelector(`${g} ${ql}`),
1511
+ c.querySelector(`[data-resize-handle-id="${s}"]`)
1512
+ ]);
1513
+ });
1514
+ }, [e, t, n, r, o, s]);
1515
+ }, Dl = (e) => e === "tree" ? "treeExplorerHidden" : "multiExplorerHidden", ea = ({ view: e, explorer: t, content: n, contentCoversPage: r = !1, sheetDismissals: o = 0, onDraggingChange: s }) => {
1516
+ const { viewSettings: l } = H(), a = E(null), [f, u] = C(null), i = E(null), c = E(null), p = E(null), x = E(null), { inlineSize: g, rootFontPixels: b } = _l(a, i), S = Dl(e), N = bt((O) => O[S] === !0), L = g !== null && g < vn(b), y = L ? "sheet" : N ? "rail" : "split";
1517
+ Il(y, { frameRef: a, sheetToggleRef: c, railToggleRef: p, closeButtonRef: x, handleId: Ht(e) });
1518
+ const V = w(() => l.update({ [S]: !0 }), [l, S]), $ = w(() => l.update({ [S]: !1 }), [l, S]), [A, T] = C(!1), _ = I(() => L ? { lane: !r, onBar: T } : null, [L, r]), [P] = C(() => /* @__PURE__ */ new Map()), [R] = C(fn);
1519
+ return /* @__PURE__ */ d(St, { value: P, children: /* @__PURE__ */ F("div", { ref: a, className: "aqmx-split-frame", "data-aqmx-explorer-mode": y, "data-aqmx-measured": g === null ? "false" : "true", "data-aqmx-content-covers-page": r ? "true" : "false", children: [
1520
+ /* @__PURE__ */ d("span", { ref: i, className: "aqmx-rem-probe", "aria-hidden": "true", "data-aqmx-rem-probe": "" }),
1521
+ L ? /* @__PURE__ */ d(Fl, { explorer: t, toggleRef: c, covered: r, merged: A, onNoticeSlotChange: u, accessFailures: R, dismissals: o }) : null,
1522
+ /* @__PURE__ */ F("div", { className: "aqmx-split-row", children: [
1523
+ y === "rail" ? /* @__PURE__ */ d(Hl, { toggleRef: p, covered: r, onOpen: $ }) : null,
1524
+ /* @__PURE__ */ d(Cl, { value: L ? f : null, children: /* @__PURE__ */ d(pn, { value: L && f !== null ? R : null, children: /* @__PURE__ */ d(hn, { value: _, children: /* @__PURE__ */ d(
1525
+ Bl,
1526
+ {
1527
+ view: e,
1528
+ mode: y,
1529
+ explorer: t,
1530
+ content: n,
1531
+ contentCoversPage: r,
1532
+ onDraggingChange: s,
1533
+ explorerMinPixels: bn(b),
1534
+ closeButtonRef: x,
1535
+ onHide: V
1536
+ }
1537
+ ) }) }) })
1538
+ ] })
1539
+ ] }) });
1540
+ }, Hl = ({ toggleRef: e, covered: t, onOpen: n }) => {
1541
+ const { labels: r } = H();
1542
+ return /* @__PURE__ */ d("div", { className: "aqmx-split-rail", inert: t, "data-testid": "markdown-explorer-rail", children: /* @__PURE__ */ d("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__ */ d(It, { "aria-hidden": "true" }) }) });
1543
+ }, Bl = ({ view: e, mode: t, explorer: n, content: r, contentCoversPage: o, onDraggingChange: s, explorerMinPixels: l, closeButtonRef: a, onHide: f }) => {
1544
+ const { viewSettings: u, labels: i } = H(), c = I(() => Mn(i), [i]), x = bt((R) => e === "tree" ? R.treeExplorer : R.multiExplorer) ?? (e === "tree" ? En : Rn), g = E(!1), [b, S] = C(!1), N = E(!1), L = E(s);
1545
+ B(() => {
1546
+ L.current = s;
1547
+ }, [s]);
1548
+ const y = _n(
1549
+ w(
1550
+ (R) => {
1551
+ if (R.length !== 2) return;
1552
+ const [D = 0, O = 0] = R, z = D + O;
1553
+ if (z <= 0 || D <= 0) return;
1554
+ const W = Math.min(at, D / z * 100);
1555
+ u.update(e === "tree" ? { treeExplorer: W } : { multiExplorer: W });
1556
+ },
1557
+ [u, e]
1558
+ )
1559
+ );
1560
+ Z(
1561
+ () => () => {
1562
+ g.current && L.current?.(!1);
1563
+ },
1564
+ []
1565
+ );
1566
+ const $ = gt() ? yn : Sn, A = t === "split", T = w(() => {
1567
+ N.current = !1, S(!1), f();
1568
+ }, [f]), _ = w(
1569
+ (R, D) => {
1570
+ const [O = 0, z = 0] = R;
1571
+ R.length === 2 && z > 0 && (N.current = O <= 0, S(N.current)), y.layoutChanged(R, D), N.current && D.source === "keyboard" && T();
1572
+ },
1573
+ [y, T]
1574
+ ), P = w(
1575
+ (R) => {
1576
+ g.current = R, s?.(R), y.draggingChanged(R), !R && N.current && T();
1577
+ },
1578
+ [s, y, T]
1579
+ );
1580
+ return /* @__PURE__ */ F(Pn, { id: `aqmx-split-${e}`, direction: "horizontal", onLayout: _, labels: c, className: "aqmx-split", "data-aqmx-split": e, children: [
1581
+ A ? /* @__PURE__ */ F(
1582
+ ct,
1583
+ {
1584
+ id: We,
1585
+ defaultSize: { value: x, unit: "percentage" },
1586
+ minSize: { value: l, unit: "pixels" },
1587
+ maxSize: { value: at, unit: "percentage" },
1588
+ collapsible: { from: "end" },
1589
+ pixelAdjustPriority: 1,
1590
+ inert: o,
1591
+ className: "aqmx-split-explorer",
1592
+ children: [
1593
+ /* @__PURE__ */ d("div", { className: "aqmx-explorer-chrome", children: /* @__PURE__ */ d("button", { ref: a, type: "button", className: "aqmx-explorer-close", "aria-label": i.hideExplorer, title: i.hideExplorer, "data-testid": "markdown-explorer-split-close", onClick: T, children: /* @__PURE__ */ d(Ue, { "aria-hidden": "true" }) }) }),
1594
+ /* @__PURE__ */ d(Ke, { value: !b, children: n })
1595
+ ]
1596
+ }
1597
+ ) : null,
1598
+ A ? /* @__PURE__ */ d(
1599
+ qn,
1600
+ {
1601
+ id: Ht(e),
1602
+ thickness: $,
1603
+ indicator: { visible: !0, thickness: Fe.gripThickness, length: Fe.gripLength, barThickness: Fe.barThickness, barLength: Fe.barLength },
1604
+ title: i.resizeExplorer,
1605
+ "aria-label": i.resizeExplorer,
1606
+ onDragging: P,
1607
+ inert: o,
1608
+ className: "aqmx-split-handle"
1609
+ }
1610
+ ) : null,
1611
+ /* @__PURE__ */ d(ct, { id: Dt, defaultSize: { value: A ? 100 - x : 100, unit: "percentage" }, contentOverflow: "hidden", className: "aqmx-split-content", ...o ? { style: { isolation: "auto" } } : {}, children: r })
1612
+ ] });
1613
+ };
1614
+ export {
1615
+ He as E,
1616
+ Cl as S,
1617
+ ea as a,
1618
+ Jl as b
1619
+ };