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