@aiquants/markdown-explorer 0.1.0 → 0.2.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 (35) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/README.md +31 -13
  3. package/dist/{ExplorerSplit-BESGFcu6.cjs → ExplorerSplit-D2plJRRe.cjs} +1 -1
  4. package/dist/{ExplorerSplit-DwEFmvQM.js → ExplorerSplit-DB37U7Kh.js} +3 -3
  5. package/dist/MultiLayout-DCPDu1-l.js +909 -0
  6. package/dist/MultiLayout-UyWxs6Xy.cjs +1 -0
  7. package/dist/TreeLayout-BoyFelK2.js +22 -0
  8. package/dist/TreeLayout-CLWbWjOc.cjs +1 -0
  9. package/dist/core/config.d.cts +6 -0
  10. package/dist/core/config.d.ts +6 -0
  11. package/dist/core/labels.d.cts +6 -1
  12. package/dist/core/labels.d.ts +6 -1
  13. package/dist/{index-BgkZ9ATV.js → index-BfuAu2GV.js} +947 -901
  14. package/dist/index-Cx3-jSna.cjs +3 -0
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.js +2 -2
  17. package/dist/location-Oo21lTyV.cjs +1 -0
  18. package/dist/{location-Cb2Ak55B.js → location-fVl2R1ee.js} +154 -141
  19. package/dist/sanitizeWorker.cjs +1 -1
  20. package/dist/sanitizeWorker.js +196 -206
  21. package/dist/server.cjs +1 -1
  22. package/dist/server.js +1 -1
  23. package/dist/styles/markdown-explorer.css +1 -1
  24. package/docs/behavior/dom-hooks.md +4 -4
  25. package/docs/behavior/layout.md +21 -9
  26. package/docs/behavior/localization.md +4 -3
  27. package/docs/behavior/security.md +7 -3
  28. package/docs/behavior/url-contract.md +8 -2
  29. package/package.json +5 -5
  30. package/dist/MultiLayout-DxPiARsv.js +0 -896
  31. package/dist/MultiLayout-r_qx1Mfz.cjs +0 -1
  32. package/dist/TreeLayout-9-20bbSM.cjs +0 -1
  33. package/dist/TreeLayout-CW7lgV_e.js +0 -19
  34. package/dist/index-y9tVvDW7.cjs +0 -3
  35. package/dist/location-DWHQYntR.cjs +0 -1
@@ -1,26 +1,28 @@
1
- import { jsx as d, jsxs as Z, Fragment as Ct } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import { createContext as te, use as W, useMemo as H, useSyncExternalStore as le, useCallback as $, useRef as z, useEffect as Y, useState as I, useLayoutEffect as U, Suspense as Ae, useEffectEvent as Q, useId as Nt, lazy as ft } from "react";
4
- import { useParams as $t, useSearchParams as Ft, useNavigate as Dt, Link as Pt, useHref as he, useLocation as qt, useRevalidator as jt } from "react-router";
5
- import { f as zt, r as Bt, u as _t, G as se, e as oe, x as Ht, y as It, z as _e, B as Zt, D as He, H as Ut, w as Vt, I as Wt } from "./location-Cb2Ak55B.js";
6
- import { useMarkdownToolbarState as Kt, MarkdownViewer as mt } from "@aiquants/markdown";
7
- import { i as Gt, u as gt, q as re, p as Xt, v as Ie, w as Yt, x as Jt, f as Qt, y as Ze, o as en, s as tn, z as nn, n as rn } from "./dataRoute-Bkfwfp1R.js";
8
- import { DEFAULT_CONTENT_ALIGN as on } from "@aiquants/markdown/viewer-settings";
9
- import { w as ln, r as sn, a as an, b as Ue, s as cn, c as dn } from "./storage-DA4ItHzl.js";
10
- const Ve = Object.freeze(["en", "ja"]), un = "en", fn = Object.freeze({
1
+ import { jsx as d, jsxs as U, Fragment as Ft } from "react/jsx-runtime";
2
+ import * as x from "react";
3
+ import { createContext as ne, use as W, useMemo as I, useSyncExternalStore as te, useCallback as $, useRef as H, useEffect as Y, useState as Z, useLayoutEffect as V, Suspense as Ae, useEffectEvent as Q, useId as Pt, lazy as ft } from "react";
4
+ import { useParams as qt, useSearchParams as _t, useNavigate as jt, Link as Bt, useHref as he, useLocation as mt, useRevalidator as zt } from "react-router";
5
+ import { f as Ht, r as It, u as Zt, G as se, e as le, x as Ut, y as Vt, z as Be, B as Wt, D as ze, H as Kt, w as Gt, I as Xt } from "./location-fVl2R1ee.js";
6
+ import { useMarkdownToolbarState as Yt, MarkdownViewer as gt } from "@aiquants/markdown";
7
+ import { i as Jt, u as ht, q as oe, p as Qt, v as He, w as en, x as tn, f as nn, y as Ie, o as rn, s as on, z as ln, n as sn } from "./dataRoute-Bkfwfp1R.js";
8
+ import { DEFAULT_CONTENT_ALIGN as an } from "@aiquants/markdown/viewer-settings";
9
+ import { w as cn, r as dn, a as un, b as Ze, s as fn, c as mn } from "./storage-DA4ItHzl.js";
10
+ const Ue = Object.freeze(["en", "ja"]), gn = "en", hn = Object.freeze({
11
11
  panelMoved: Object.freeze(["title", "column", "position"]),
12
12
  panelMoveUnavailable: Object.freeze(["title", "move"]),
13
13
  panelDragStarted: Object.freeze(["title"]),
14
14
  panelDragCancelled: Object.freeze(["title"]),
15
15
  multiColumnRegion: Object.freeze(["column"])
16
- }), mn = /\{(\w+)\}/gu, ht = {
16
+ }), pn = /\{(\w+)\}/gu, pt = {
17
17
  explorerRegion: "Explorer",
18
18
  sourceLabel: "Source",
19
- refresh: "Refresh",
19
+ refreshTreeLabel: "Refresh tree",
20
20
  refreshTree: "Reload the tree and the open documents from the source",
21
21
  treeRefreshed: "Reloaded the tree from the source",
22
22
  treeRefreshFailed: (e) => `Could not reload the tree: ${e}`,
23
+ refreshDocumentLabel: "Refresh document",
23
24
  refreshDocument: "Reload the document from the source",
25
+ refreshDocumentNamed: (e) => `Refresh ${e}`,
24
26
  documentRefreshed: (e) => `Reloaded ${e}`,
25
27
  documentRefreshFailed: (e) => `Could not reload the document: ${e}`,
26
28
  expandAll: "Expand all folders",
@@ -145,6 +147,9 @@ const Ve = Object.freeze(["en", "ja"]), un = "en", fn = Object.freeze({
145
147
  viewerMermaidZoomOut: "Zoom Out",
146
148
  viewerMermaidResetView: "Reset View",
147
149
  viewerMermaidRetry: "Try again",
150
+ viewerEmbeddedVideo: "embedded video",
151
+ viewerEmbeddedPost: "embedded post",
152
+ viewerEmbeddedFrame: "Embedded content",
148
153
  multiRegion: "Panels",
149
154
  multiEmpty: "Select documents in the explorer to open them side by side.",
150
155
  panelLimit: (e) => `You can open up to ${String(e)} panels at once.`,
@@ -176,14 +181,16 @@ const Ve = Object.freeze(["en", "ja"]), un = "en", fn = Object.freeze({
176
181
  multiColumnEmpty: "This column is empty",
177
182
  multiColumnRegion: "Column {column}",
178
183
  panelDropHere: "Drop the panel here"
179
- }, gn = {
184
+ }, wn = {
180
185
  explorerRegion: "エクスプローラー",
181
186
  sourceLabel: "ソース",
182
- refresh: "更新",
187
+ refreshTreeLabel: "ツリーを更新",
183
188
  refreshTree: "ソースからツリーと開いている文書を読み込み直す",
184
189
  treeRefreshed: "ツリーをソースから読み込み直しました",
185
190
  treeRefreshFailed: (e) => `ツリーを読み込み直せませんでした: ${e}`,
191
+ refreshDocumentLabel: "文書を更新",
186
192
  refreshDocument: "ソースから文書を読み込み直す",
193
+ refreshDocumentNamed: (e) => `${e} を更新`,
187
194
  documentRefreshed: (e) => `${e} を読み込み直しました`,
188
195
  documentRefreshFailed: (e) => `文書を読み込み直せませんでした: ${e}`,
189
196
  expandAll: "すべてのフォルダーを展開",
@@ -308,6 +315,9 @@ const Ve = Object.freeze(["en", "ja"]), un = "en", fn = Object.freeze({
308
315
  viewerMermaidZoomOut: "縮小",
309
316
  viewerMermaidResetView: "表示を元に戻す",
310
317
  viewerMermaidRetry: "再試行",
318
+ viewerEmbeddedVideo: "埋め込みの動画",
319
+ viewerEmbeddedPost: "埋め込みの投稿",
320
+ viewerEmbeddedFrame: "埋め込みのコンテンツ",
311
321
  multiRegion: "パネル",
312
322
  multiEmpty: "エクスプローラーで文書を選ぶと、ここに並べて開きます。",
313
323
  panelLimit: (e) => `同時に開けるのは ${String(e)} パネルまでです。`,
@@ -339,88 +349,66 @@ const Ve = Object.freeze(["en", "ja"]), un = "en", fn = Object.freeze({
339
349
  multiColumnEmpty: "この列は空です",
340
350
  multiColumnRegion: "{column} 列目",
341
351
  panelDropHere: "ここへパネルをドロップ"
342
- }, hn = Object.freeze({
343
- en: Object.freeze(ht),
344
- ja: Object.freeze(gn)
345
- }), pt = Object.freeze(Object.keys(ht)), pn = new Set(pt), wn = (e) => pn.has(e), de = (e) => e === null ? "null" : typeof e == "string" ? JSON.stringify(e.length > 40 ? `${e.slice(0, 40)}…` : e) : typeof e == "function" ? "a function" : Array.isArray(e) ? "an array" : typeof e, wt = (e) => {
346
- if (e === void 0) return un;
347
- if (Ve.includes(e)) return e;
348
- throw new RangeError(`[markdown-explorer] locale is the UI language (${Ve.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${de(e)}`);
349
- }, We = (e, t) => {
350
- const n = hn[wt(e)];
352
+ }, vn = Object.freeze({
353
+ en: Object.freeze(pt),
354
+ ja: Object.freeze(wn)
355
+ }), wt = Object.freeze(Object.keys(pt)), bn = new Set(wt), En = (e) => bn.has(e), de = (e) => e === null ? "null" : typeof e == "string" ? JSON.stringify(e.length > 40 ? `${e.slice(0, 40)}…` : e) : typeof e == "function" ? "a function" : Array.isArray(e) ? "an array" : typeof e, vt = (e) => {
356
+ if (e === void 0) return gn;
357
+ if (Ue.includes(e)) return e;
358
+ throw new RangeError(`[markdown-explorer] locale is the UI language (${Ue.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${de(e)}`);
359
+ }, Ve = (e, t) => {
360
+ const n = vn[vt(e)];
351
361
  if (t === void 0) return n;
352
362
  if (t === null || typeof t != "object")
353
363
  throw new RangeError(`[markdown-explorer] labels must be an object; got ${de(t)}`);
354
- if (!zt(t))
364
+ if (!Ht(t))
355
365
  throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${de(t)}`);
356
366
  const r = t, o = { ...n };
357
- for (const s of Object.keys(r)) {
358
- if (!wn(s))
359
- throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${pt.join(", ")}`);
360
- const l = r[s];
361
- if (l === void 0) continue;
362
- const c = typeof n[s];
363
- if (typeof l !== c)
364
- throw new TypeError(`[markdown-explorer] labels.${s} must be a ${c}; got ${de(l)}`);
365
- if (typeof l == "string" && l.trim() === "")
366
- throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);
367
- const g = fn[s];
368
- if (typeof l == "string" && g !== void 0) {
369
- for (const [, p] of l.matchAll(mn))
370
- if (!g.includes(p ?? ""))
371
- throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${String(p)}}; it accepts ${g.map((f) => `{${f}}`).join(", ")}`);
367
+ for (const l of Object.keys(r)) {
368
+ if (!En(l))
369
+ throw new RangeError(`[markdown-explorer] labels.${l} is not a known label key; expected one of ${wt.join(", ")}`);
370
+ const s = r[l];
371
+ if (s === void 0) continue;
372
+ const a = typeof n[l];
373
+ if (typeof s !== a)
374
+ throw new TypeError(`[markdown-explorer] labels.${l} must be a ${a}; got ${de(s)}`);
375
+ if (typeof s == "string" && s.trim() === "")
376
+ throw new RangeError(`[markdown-explorer] labels.${l} must be a non-blank string`);
377
+ const f = hn[l];
378
+ if (typeof s == "string" && f !== void 0) {
379
+ for (const [, h] of s.matchAll(pn))
380
+ if (!f.includes(h ?? ""))
381
+ throw new RangeError(`[markdown-explorer] labels.${l} uses the unknown placeholder {${String(h)}}; it accepts ${f.map((m) => `{${m}}`).join(", ")}`);
372
382
  }
373
- o[s] = l;
383
+ o[l] = s;
374
384
  }
375
385
  return Object.freeze(o);
376
- }, vn = (e, t) => {
386
+ }, Sn = (e, t) => {
377
387
  if (Object.is(e, t)) return !0;
378
388
  if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
379
- const n = e, r = t, o = Object.keys(n), s = Object.keys(r);
380
- return o.length === s.length && s.every((l) => Object.hasOwn(n, l) && Object.is(n[l], r[l]));
381
- }, Ke = Object.freeze(["light", "dark"]), bn = (e) => {
389
+ const n = e, r = t, o = Object.keys(n), l = Object.keys(r);
390
+ return o.length === l.length && l.every((s) => Object.hasOwn(n, s) && Object.is(n[s], r[s]));
391
+ }, We = Object.freeze(["light", "dark"]), yn = (e) => {
382
392
  if (e === void 0) return "light";
383
- if (Ke.includes(e)) return e;
384
- throw new RangeError(`[markdown-explorer] theme must be ${Ke.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
385
- }, vt = te(null), D = () => {
386
- const e = W(vt);
393
+ if (We.includes(e)) return e;
394
+ throw new RangeError(`[markdown-explorer] theme must be ${We.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
395
+ }, bt = ne(null), D = () => {
396
+ const e = W(bt);
387
397
  if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
388
398
  return e;
389
399
  }, fe = (e) => {
390
400
  const { viewSettings: t } = D(), n = () => e(t.getSnapshot());
391
- return le(t.subscribe, n, n);
392
- }, Fe = () => {
393
- const { config: e } = D(), t = $t()["*"], [n] = Ft(), r = n.toString();
394
- return H(() => Bt(e, t, new URLSearchParams(r)), [e, t, r]);
401
+ return te(t.subscribe, n, n);
402
+ }, $e = () => {
403
+ const { config: e } = D(), t = qt()["*"], [n] = _t(), r = n.toString();
404
+ return I(() => It(e, t, new URLSearchParams(r)), [e, t, r]);
395
405
  };
396
- function En({
406
+ function xn({
397
407
  title: e,
398
408
  titleId: t,
399
409
  ...n
400
410
  }, r) {
401
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
402
- xmlns: "http://www.w3.org/2000/svg",
403
- viewBox: "0 0 24 24",
404
- fill: "currentColor",
405
- "aria-hidden": "true",
406
- "data-slot": "icon",
407
- ref: r,
408
- "aria-labelledby": t
409
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
410
- id: t
411
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
412
- fillRule: "evenodd",
413
- d: "M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z",
414
- clipRule: "evenodd"
415
- }));
416
- }
417
- const Sn = /* @__PURE__ */ y.forwardRef(En);
418
- function yn({
419
- title: e,
420
- titleId: t,
421
- ...n
422
- }, r) {
423
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
411
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
424
412
  xmlns: "http://www.w3.org/2000/svg",
425
413
  viewBox: "0 0 20 20",
426
414
  fill: "currentColor",
@@ -428,28 +416,28 @@ function yn({
428
416
  "data-slot": "icon",
429
417
  ref: r,
430
418
  "aria-labelledby": t
431
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
419
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
432
420
  id: t
433
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
421
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
434
422
  fillRule: "evenodd",
435
423
  d: "M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm2.25 8.5a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 3a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",
436
424
  clipRule: "evenodd"
437
425
  }));
438
426
  }
439
- const xn = /* @__PURE__ */ y.forwardRef(yn), De = Object.freeze({
427
+ const kn = /* @__PURE__ */ x.forwardRef(xn), De = Object.freeze({
440
428
  browse: Object.freeze({ replace: !0, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
441
429
  "switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
442
430
  "switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
443
431
  "follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
444
- }), Mo = (e) => De[e], Pe = () => {
445
- const e = Dt();
432
+ }), jo = (e) => De[e], Fe = () => {
433
+ const e = jt();
446
434
  return $(
447
435
  (t, n) => {
448
436
  e(t, De[n]);
449
437
  },
450
438
  [e]
451
439
  );
452
- }, kn = ({ navigation: e, ...t }) => /* @__PURE__ */ d(Pt, { ...t, ...De[e] }), bt = {
440
+ }, Rn = ({ navigation: e, ...t }) => /* @__PURE__ */ d(Bt, { ...t, ...De[e] }), Et = {
453
441
  unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
454
442
  forbidden: ["failureForbiddenTitle", "failureForbiddenBody"],
455
443
  "not-found": ["failureNotFoundTitle", "failureNotFoundBody"],
@@ -458,14 +446,14 @@ const xn = /* @__PURE__ */ y.forwardRef(yn), De = Object.freeze({
458
446
  "too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
459
447
  unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
460
448
  failed: ["failureFailedTitle", "failureFailedBody"]
461
- }, qe = (e, t) => e[bt[t][0]], Rn = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
462
- const { labels: o } = D(), s = qe(o, e.reason), l = o[bt[e.reason][1]], c = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
463
- return /* @__PURE__ */ Z("div", { className: "aqmx-callout", role: t ? "alert" : void 0, "data-aqmx-tone": c, "data-testid": r === null ? void 0 : r, "data-aqmx-failure": r === null ? void 0 : e.reason, children: [
464
- /* @__PURE__ */ d("p", { className: "aqmx-callout-title", children: s }),
465
- /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: l }),
449
+ }, pe = (e, t) => e[Et[t][0]], Tn = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
450
+ const { labels: o } = D(), l = pe(o, e.reason), s = o[Et[e.reason][1]], a = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
451
+ return /* @__PURE__ */ U("div", { className: "aqmx-callout", role: t ? "alert" : void 0, "data-aqmx-tone": a, "data-testid": r === null ? void 0 : r, "data-aqmx-failure": r === null ? void 0 : e.reason, children: [
452
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-title", children: l }),
453
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: s }),
466
454
  e.reason === "unauthorized" ? /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", onClick: () => window.location.reload(), children: o.reloadPage }) : n !== void 0 && e.reason === "failed" ? /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", onClick: n, children: o.retry }) : null
467
455
  ] });
468
- }, Et = (e) => {
456
+ }, St = (e) => {
469
457
  const t = e.ownerDocument;
470
458
  if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
471
459
  if (e.hasAttribute("tabindex")) return !1;
@@ -475,52 +463,52 @@ const xn = /* @__PURE__ */ y.forwardRef(yn), De = Object.freeze({
475
463
  t.activeElement !== e && (e.removeAttribute("tabindex"), e.removeEventListener("blur", n));
476
464
  };
477
465
  return e.addEventListener("blur", n), !0;
478
- }, Tn = (e, t) => {
479
- const n = z(null), r = z(null), o = z(null), s = $(() => {
466
+ }, An = (e, t) => {
467
+ const n = H(null), r = H(null), o = H(null), l = $(() => {
480
468
  n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
481
469
  }, []);
482
- Y(() => s, [s]);
483
- const l = $(
484
- (p) => {
485
- if (r.current !== p) return;
486
- const f = o.current;
487
- if (f !== null) {
488
- f.then(() => l(p));
470
+ Y(() => l, [l]);
471
+ const s = $(
472
+ (h) => {
473
+ if (r.current !== h) return;
474
+ const m = o.current;
475
+ if (m !== null) {
476
+ m.then(() => s(h));
489
477
  return;
490
478
  }
491
- e.prefetch(p);
492
- const h = e.peek(p);
493
- if (h?.status !== "pending") return;
494
- const S = Promise.allSettled([h.promise]);
495
- o.current = S, S.then(() => {
496
- o.current === S && (o.current = null);
479
+ e.prefetch(h);
480
+ const g = e.peek(h);
481
+ if (g?.status !== "pending") return;
482
+ const b = Promise.allSettled([g.promise]);
483
+ o.current = b, b.then(() => {
484
+ o.current === b && (o.current = null);
497
485
  });
498
486
  },
499
487
  [e]
500
- ), c = $(
501
- (p) => {
502
- const f = t(p);
503
- f !== r.current && (s(), f !== null && (r.current = f, n.current = window.setTimeout(() => {
504
- n.current = null, l(f);
505
- }, _t)));
488
+ ), a = $(
489
+ (h) => {
490
+ const m = t(h);
491
+ m !== r.current && (l(), m !== null && (r.current = m, n.current = window.setTimeout(() => {
492
+ n.current = null, s(m);
493
+ }, Zt)));
506
494
  },
507
- [s, t, l]
508
- ), g = $(
509
- (p) => {
510
- t(p) !== r.current && s();
495
+ [l, t, s]
496
+ ), f = $(
497
+ (h) => {
498
+ t(h) !== r.current && l();
511
499
  },
512
- [s, t]
500
+ [l, t]
513
501
  );
514
- return H(
502
+ return I(
515
503
  () => ({
516
- onPointerOver: (p) => c(p.target),
517
- onPointerOut: (p) => g(p.relatedTarget),
518
- onFocus: (p) => c(p.target),
519
- onBlur: (p) => g(p.relatedTarget)
504
+ onPointerOver: (h) => a(h.target),
505
+ onPointerOut: (h) => f(h.relatedTarget),
506
+ onFocus: (h) => a(h.target),
507
+ onBlur: (h) => f(h.relatedTarget)
520
508
  }),
521
- [c, g]
509
+ [a, f]
522
510
  );
523
- }, pe = () => {
511
+ }, we = () => {
524
512
  const e = /* @__PURE__ */ new Set();
525
513
  return {
526
514
  subscribe: (t) => (e.add(t), () => {
@@ -530,7 +518,7 @@ const xn = /* @__PURE__ */ y.forwardRef(yn), De = Object.freeze({
530
518
  for (const t of [...e]) t();
531
519
  }
532
520
  };
533
- }, St = () => {
521
+ }, yt = () => {
534
522
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
535
523
  let n = !1;
536
524
  const r = (o) => {
@@ -541,13 +529,13 @@ const xn = /* @__PURE__ */ y.forwardRef(yn), De = Object.freeze({
541
529
  return {
542
530
  hold: (o) => {
543
531
  e.set(o, (e.get(o) ?? 0) + 1);
544
- let s = !1;
532
+ let l = !1;
545
533
  return () => {
546
- if (s) return;
547
- s = !0;
548
- const l = e.get(o);
549
- if (l !== void 0 && l > 1) {
550
- e.set(o, l - 1);
534
+ if (l) return;
535
+ l = !0;
536
+ const s = e.get(o);
537
+ if (s !== void 0 && s > 1) {
538
+ e.set(o, s - 1);
551
539
  return;
552
540
  }
553
541
  e.delete(o), r(o);
@@ -561,9 +549,9 @@ const xn = /* @__PURE__ */ y.forwardRef(yn), De = Object.freeze({
561
549
  if (Object.is(e, t)) return !0;
562
550
  if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
563
551
  if (Array.isArray(e) || Array.isArray(t))
564
- return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((s, l) => me(s, t[l]));
552
+ return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((l, s) => me(l, t[s]));
565
553
  const n = e, r = t, o = Object.keys(n);
566
- return o.length !== Object.keys(r).length ? !1 : o.every((s) => Object.hasOwn(r, s) && me(n[s], r[s]));
554
+ return o.length !== Object.keys(r).length ? !1 : o.every((l) => Object.hasOwn(r, l) && me(n[l], r[l]));
567
555
  }, ie = (e) => {
568
556
  const t = e;
569
557
  return t.status === void 0 && (t.status = "pending", e.then(
@@ -574,128 +562,131 @@ const xn = /* @__PURE__ */ y.forwardRef(yn), De = Object.freeze({
574
562
  t.status = "rejected", t.reason = n;
575
563
  }
576
564
  )), t;
577
- }, yt = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), ae = (e) => e.status === "fulfilled" ? e.value : void 0, An = 55e3, Ge = Object.freeze({ status: "deferred" }), Xe = Object.freeze({ status: "refreshed" }), ke = Object.freeze({ status: "superseded" }), ge = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, On = ({ client: e, capacity: t }) => {
565
+ }, xt = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), ae = (e) => e.status === "fulfilled" ? e.value : void 0, On = 55e3, Ke = Object.freeze({ status: "deferred" }), Ge = Object.freeze({ status: "refreshed" }), ke = Object.freeze({ status: "superseded" }), ge = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, kt = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", Ln = ({ client: e, capacity: t }) => {
578
566
  if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
579
- const n = /* @__PURE__ */ new Map(), r = St(), o = pe(), s = /* @__PURE__ */ new WeakSet(), l = o.emit, c = () => {
567
+ const n = /* @__PURE__ */ new Map(), r = yt(), o = we(), l = /* @__PURE__ */ new WeakSet();
568
+ let s = 0;
569
+ const a = o.emit, f = () => (s += 1, s), h = () => {
580
570
  if (!(n.size <= t))
581
571
  for (const u of [...n.keys()]) {
582
572
  if (n.size <= t) return;
583
573
  r.isHeld(u) || n.delete(u);
584
574
  }
585
- }, g = (u, m) => {
586
- n.delete(u), n.set(u, m);
587
- }, p = (u) => performance.now() - u.validatedAt >= An, f = (u, m, E) => {
588
- const b = n.get(u), T = ge(b?.snapshot), C = E || b?.refreshPending === !0, O = ie(e.document(u, { refresh: C }).then((P) => ({ status: "loaded", document: P }))), N = { snapshot: { status: "pending", promise: O, previous: T }, validatedAt: performance.now(), opened: m, background: null, refreshPending: !1, seeded: void 0 };
589
- return g(u, N), c(), O.then((P) => {
590
- n.get(u) === N && (N.snapshot = P, l());
591
- }), N;
592
- }, h = (u, m, E, b, T, C) => {
593
- m.background === E && (m.background = null, !(n.get(u) !== m || m.snapshot !== b) && (T.kind === "failure" && b.document.kind !== "failure" || (m.validatedAt = C, !me(b.document, T) && (m.snapshot = { status: "loaded", document: T }, l()))));
594
- }, S = async (u, m) => {
595
- const E = m.snapshot;
596
- if (E.status !== "loaded") return null;
597
- const b = {};
598
- m.background = b;
599
- const T = performance.now(), C = e.document(u, { refresh: m.refreshPending });
600
- m.refreshPending = !1;
601
- const O = await C, N = m.background === b && n.get(u) === m && m.snapshot === E;
602
- return h(u, m, b, E, O, T), N ? O : null;
603
- }, R = (u, m) => {
604
- const { snapshot: E } = m;
605
- return E.status === "pending" ? !1 : E.status === "loaded" && E.document.kind !== "failure" ? (S(u, m), !1) : (E.status === "loaded" && s.add(E), f(u, !0, !1), !0);
606
- }, x = (u) => {
607
- const m = r.hold(u);
608
- let E = !1;
575
+ }, m = (u, p) => {
576
+ n.delete(u), n.set(u, p);
577
+ }, g = (u) => performance.now() - u.validatedAt >= On, b = (u, p, S) => {
578
+ const E = n.get(u), y = ge(E?.snapshot), P = S || E?.refreshPending === !0, z = ie(e.document(u, { refresh: P }).then((j) => ({ status: "loaded", document: j }))), M = { snapshot: { status: "pending", promise: z, previous: y }, validatedAt: performance.now(), opened: p, background: null, refreshPending: !1, seeded: void 0, stamp: f() };
579
+ return m(u, M), h(), z.then((j) => {
580
+ n.get(u) === M && (M.snapshot = j, M.stamp = f(), a());
581
+ }), M;
582
+ }, R = (u, p, S, E, y, P) => {
583
+ p.background === S && (p.background = null, !(n.get(u) !== p || p.snapshot !== E) && (y.kind === "failure" && E.document.kind !== "failure" || (p.validatedAt = P, p.stamp = f(), me(E.document, y) || (p.snapshot = { status: "loaded", document: y }), a())));
584
+ }, k = async (u, p) => {
585
+ const S = p.snapshot;
586
+ if (S.status !== "loaded") return null;
587
+ const E = {};
588
+ p.background = E;
589
+ const y = performance.now(), P = e.document(u, { refresh: p.refreshPending });
590
+ p.refreshPending = !1;
591
+ const z = await P, M = p.background === E && n.get(u) === p && p.snapshot === S;
592
+ return R(u, p, E, S, z, y), M ? z : null;
593
+ }, A = (u, p) => {
594
+ const { snapshot: S } = p;
595
+ return S.status === "pending" ? !1 : S.status === "loaded" && S.document.kind !== "failure" ? (k(u, p), !1) : (S.status === "loaded" && l.add(S), b(u, !0, !1), !0);
596
+ }, T = (u) => {
597
+ const p = r.hold(u);
598
+ let S = !1;
609
599
  return () => {
610
- if (E) return;
611
- E = !0, m();
612
- const b = n.get(u);
613
- b !== void 0 && g(u, b), c();
600
+ if (S) return;
601
+ S = !0, p();
602
+ const E = n.get(u);
603
+ E !== void 0 && m(u, E), h();
614
604
  };
615
605
  };
616
606
  return {
617
607
  peek: (u) => n.get(u)?.snapshot,
618
608
  peekSeeded: (u) => n.get(u)?.seeded,
609
+ answerStampOf: (u) => n.get(u)?.stamp,
619
610
  prefetch: (u) => {
620
- const m = n.get(u);
621
- m !== void 0 && m.snapshot.status !== "deferred" || (f(u, !1, !1), l());
611
+ const p = n.get(u);
612
+ p !== void 0 && p.snapshot.status !== "deferred" || (b(u, !1, !1), a());
622
613
  },
623
614
  open: (u) => {
624
- const m = r.resumes(u), E = x(u), b = n.get(u);
625
- if (b === void 0 || b.snapshot.status === "deferred")
626
- return f(u, !0, !1), l(), E;
627
- if (g(u, b), m) return E;
628
- const { snapshot: T } = b;
629
- return T.status === "pending" ? (b.opened = !0, E) : T.document.kind === "failure" ? (b.opened || p(b) ? (s.add(T), f(u, !0, !1), l()) : b.opened = !0, E) : (b.opened = !0, b.background === null && p(b) && S(u, b), E);
615
+ const p = r.resumes(u), S = T(u), E = n.get(u);
616
+ if (E === void 0 || E.snapshot.status === "deferred")
617
+ return b(u, !0, !1), a(), S;
618
+ if (m(u, E), p) return S;
619
+ const { snapshot: y } = E;
620
+ return y.status === "pending" ? (E.opened = !0, S) : y.document.kind === "failure" ? (E.opened || g(E) ? (l.add(y), b(u, !0, !1), a()) : E.opened = !0, S) : (E.opened = !0, E.background === null && g(E) && k(u, E), S);
630
621
  },
631
- retain: x,
622
+ retain: T,
632
623
  retry: (u) => {
633
- const m = n.get(u);
634
- m === void 0 || m.snapshot.status !== "loaded" || m.snapshot.document.kind !== "failure" || (f(u, !0, !1), l());
624
+ const p = n.get(u);
625
+ p === void 0 || p.snapshot.status !== "loaded" || p.snapshot.document.kind !== "failure" || (b(u, !0, !1), a());
635
626
  },
636
- seed: (u, m) => {
637
- const E = performance.now(), b = ie(
638
- m.then(
639
- (P) => P === null ? Ge : { status: "loaded", document: P },
640
- () => Ge
627
+ seed: (u, p) => {
628
+ const S = performance.now(), E = ie(
629
+ p.then(
630
+ (j) => j === null ? Ke : { status: "loaded", document: j },
631
+ () => Ke
641
632
  )
642
- ), T = n.get(u);
643
- if (T !== void 0 && T.snapshot.status === "loaded") {
644
- const P = T.snapshot, B = {};
645
- T.background = B, b.then((V) => {
646
- if (V.status === "loaded") {
647
- h(u, T, B, P, V.document, E);
633
+ ), y = n.get(u);
634
+ if (y !== void 0 && y.snapshot.status === "loaded") {
635
+ const j = y.snapshot, C = {};
636
+ y.background = C, E.then((q) => {
637
+ if (q.status === "loaded") {
638
+ R(u, y, C, j, q.document, S);
648
639
  return;
649
640
  }
650
- T.background === B && (T.background = null);
641
+ y.background === C && (y.background = null);
651
642
  });
652
643
  return;
653
644
  }
654
- const C = T !== void 0 && T.snapshot.status === "pending" ? T.snapshot.previous : null, O = { status: "pending", promise: b, previous: C }, N = { snapshot: O, validatedAt: E, opened: T?.opened === !0, background: null, refreshPending: T?.refreshPending === !0, seeded: O };
655
- g(u, N), c(), b.then((P) => {
656
- n.get(u) === N && (P.status === "deferred" && r.isHeld(u) ? f(u, N.opened, !1) : N.snapshot = P, l());
645
+ const P = y !== void 0 && y.snapshot.status === "pending" ? y.snapshot.previous : null, z = { status: "pending", promise: E, previous: P }, M = { snapshot: z, validatedAt: S, opened: y?.opened === !0, background: null, refreshPending: y?.refreshPending === !0, seeded: z, stamp: f() };
646
+ m(u, M), h(), E.then((j) => {
647
+ n.get(u) === M && (j.status === "deferred" && r.isHeld(u) ? b(u, M.opened, !1) : (M.snapshot = j, M.stamp = f()), a());
657
648
  });
658
649
  },
659
650
  invalidate: () => {
660
651
  let u = !1;
661
- for (const [m, E] of [...n]) {
662
- if (E.validatedAt = Number.NEGATIVE_INFINITY, E.opened = !0, E.refreshPending = !0, !r.isHeld(m)) continue;
663
- const { snapshot: b } = E;
664
- if (b.status !== "pending") {
665
- R(m, E) && (u = !0);
652
+ for (const [p, S] of [...n]) {
653
+ if (S.validatedAt = Number.NEGATIVE_INFINITY, S.opened = !0, S.refreshPending = !0, !r.isHeld(p)) continue;
654
+ const { snapshot: E } = S;
655
+ if (E.status !== "pending") {
656
+ A(p, S) && (u = !0);
666
657
  continue;
667
658
  }
668
- b.promise.then(() => {
669
- n.get(m) === E && E.refreshPending && r.isHeld(m) && R(m, E) && l();
659
+ E.promise.then(() => {
660
+ n.get(p) === S && S.refreshPending && r.isHeld(p) && A(p, S) && a();
670
661
  });
671
662
  }
672
- u && l();
663
+ u && a();
673
664
  },
674
665
  refresh: async (u) => {
675
- const m = n.get(u);
676
- if (m !== void 0 && m.snapshot.status === "loaded" && m.snapshot.document.kind !== "failure") {
677
- m.refreshPending = !0;
678
- const b = await S(u, m);
679
- return b === null ? ke : b.kind === "failure" ? { status: "failed", failure: b.failure } : Xe;
666
+ const p = n.get(u);
667
+ if (p !== void 0 && kt(p.snapshot)) {
668
+ p.refreshPending = !0;
669
+ const E = await k(u, p);
670
+ return E === null ? ke : E.kind === "failure" ? { status: "failed", failure: E.failure } : Ge;
680
671
  }
681
- const E = f(u, !0, !0);
682
- return l(), E.snapshot.status !== "pending" ? ke : (await E.snapshot.promise, n.get(u) === E ? Xe : ke);
672
+ const S = b(u, !0, !0);
673
+ return a(), S.snapshot.status !== "pending" ? ke : (await S.snapshot.promise, n.get(u) === S ? Ge : ke);
683
674
  },
684
675
  clear: () => {
685
676
  n.clear();
686
- for (const u of r.heldKeys()) f(u, !0, !1);
687
- l();
677
+ for (const u of r.heldKeys()) b(u, !0, !1);
678
+ a();
688
679
  },
689
680
  subscribe: o.subscribe,
690
- noteFailureShown: (u) => s.has(u) ? !1 : (s.add(u), !0)
681
+ noteFailureShown: (u) => l.has(u) ? !1 : (l.add(u), !0)
691
682
  };
692
683
  };
693
- function Ln({
684
+ function Mn({
694
685
  title: e,
695
686
  titleId: t,
696
687
  ...n
697
688
  }, r) {
698
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
689
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
699
690
  xmlns: "http://www.w3.org/2000/svg",
700
691
  viewBox: "0 0 20 20",
701
692
  fill: "currentColor",
@@ -703,21 +694,21 @@ function Ln({
703
694
  "data-slot": "icon",
704
695
  ref: r,
705
696
  "aria-labelledby": t
706
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
697
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
707
698
  id: t
708
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
699
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
709
700
  d: "M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z"
710
- }), /* @__PURE__ */ y.createElement("path", {
701
+ }), /* @__PURE__ */ x.createElement("path", {
711
702
  d: "M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"
712
703
  }));
713
704
  }
714
- const Mn = /* @__PURE__ */ y.forwardRef(Ln);
715
- function Cn({
705
+ const Cn = /* @__PURE__ */ x.forwardRef(Mn);
706
+ function Nn({
716
707
  title: e,
717
708
  titleId: t,
718
709
  ...n
719
710
  }, r) {
720
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
711
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
721
712
  xmlns: "http://www.w3.org/2000/svg",
722
713
  viewBox: "0 0 20 20",
723
714
  fill: "currentColor",
@@ -725,34 +716,34 @@ function Cn({
725
716
  "data-slot": "icon",
726
717
  ref: r,
727
718
  "aria-labelledby": t
728
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
719
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
729
720
  id: t
730
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
721
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
731
722
  fillRule: "evenodd",
732
723
  d: "M4.25 5.5a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75v-4a.75.75 0 0 1 1.5 0v4A2.25 2.25 0 0 1 12.75 17h-8.5A2.25 2.25 0 0 1 2 14.75v-8.5A2.25 2.25 0 0 1 4.25 4h5a.75.75 0 0 1 0 1.5h-5Z",
733
724
  clipRule: "evenodd"
734
- }), /* @__PURE__ */ y.createElement("path", {
725
+ }), /* @__PURE__ */ x.createElement("path", {
735
726
  fillRule: "evenodd",
736
727
  d: "M6.194 12.753a.75.75 0 0 0 1.06.053L16.5 4.44v2.81a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.553l-9.056 8.194a.75.75 0 0 0-.053 1.06Z",
737
728
  clipRule: "evenodd"
738
729
  }));
739
730
  }
740
- const Nn = /* @__PURE__ */ y.forwardRef(Cn), we = ({ name: e, url: t, icon: n, children: r }) => {
731
+ const $n = /* @__PURE__ */ x.forwardRef(Nn), ve = ({ name: e, url: t, icon: n, children: r }) => {
741
732
  const { labels: o } = D();
742
- return /* @__PURE__ */ Z("div", { className: "aqmx-document-toolbar", children: [
733
+ return /* @__PURE__ */ U("div", { className: "aqmx-document-toolbar", children: [
743
734
  /* @__PURE__ */ d("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: n }),
744
735
  /* @__PURE__ */ d("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
745
736
  r,
746
- /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": o.openInNewTab, title: o.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ d(Nn, {}) }),
747
- /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: t, download: e, "aria-label": o.download, title: o.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ d(Mn, {}) })
737
+ /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": o.openInNewTab, title: o.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ d($n, {}) }),
738
+ /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: t, download: e, "aria-label": o.download, title: o.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ d(Cn, {}) })
748
739
  ] });
749
740
  };
750
- function $n({
741
+ function Dn({
751
742
  title: e,
752
743
  titleId: t,
753
744
  ...n
754
745
  }, r) {
755
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
746
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
756
747
  xmlns: "http://www.w3.org/2000/svg",
757
748
  viewBox: "0 0 20 20",
758
749
  fill: "currentColor",
@@ -760,44 +751,52 @@ function $n({
760
751
  "data-slot": "icon",
761
752
  ref: r,
762
753
  "aria-labelledby": t
763
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
754
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
764
755
  id: t
765
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
756
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
766
757
  fillRule: "evenodd",
767
758
  d: "M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm4.75 6.75a.75.75 0 0 1 1.5 0v2.546l.943-1.048a.75.75 0 0 1 1.114 1.004l-2.25 2.5a.75.75 0 0 1-1.114 0l-2.25-2.5a.75.75 0 1 1 1.114-1.004l.943 1.048V8.75Z",
768
759
  clipRule: "evenodd"
769
760
  }));
770
761
  }
771
- const Fn = /* @__PURE__ */ y.forwardRef($n), Dn = ({ document: e }) => {
762
+ const Fn = /* @__PURE__ */ x.forwardRef(Dn), Pn = ({ document: e }) => {
772
763
  const { labels: t } = D();
773
- return /* @__PURE__ */ Z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
774
- /* @__PURE__ */ d(we, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(Fn, {}) }),
775
- /* @__PURE__ */ d("div", { className: "aqmx-document-stage", children: /* @__PURE__ */ Z("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
764
+ return /* @__PURE__ */ U("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
765
+ /* @__PURE__ */ d(ve, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(Fn, {}) }),
766
+ /* @__PURE__ */ d("div", { className: "aqmx-document-stage", children: /* @__PURE__ */ U("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
776
767
  /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
777
768
  /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
778
769
  ] }) })
779
770
  ] });
780
- }, je = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", Pn = (e) => {
771
+ }, Pe = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", qn = (e) => {
781
772
  const t = e.indexOf("#");
782
773
  return t === -1 ? "" : e.slice(t);
783
- }, ve = (e) => {
774
+ }, _n = /(%[0-9A-Fa-f]{2})/u, qe = (e) => {
784
775
  if (!e.startsWith("#") || e.length === 1) return null;
785
- try {
786
- return decodeURIComponent(e.slice(1));
787
- } catch {
788
- return null;
789
- }
790
- }, xt = (e) => `#${encodeURIComponent(e)}`, qn = (e) => {
776
+ const t = new TextEncoder(), n = e.slice(1).split(_n).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
777
+ return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
778
+ }, Rt = (e) => `#${encodeURIComponent(e)}`, jn = (e) => {
791
779
  if (e === "#") return !0;
792
- const t = ve(e);
780
+ const t = qe(e);
793
781
  return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
794
- }, Oe = (e, t) => {
782
+ }, Tt = (e, t) => {
783
+ if (t === "") return null;
795
784
  for (const n of e.querySelectorAll("[id]"))
796
785
  if (n.id === t) return n;
797
786
  return null;
798
- }, jn = (e, t) => {
799
- const n = e === null ? null : ve(t);
800
- return e === null || n === null ? null : Oe(e, n);
787
+ }, Bn = "http://www.w3.org/1999/xhtml", Xe = (e, t) => {
788
+ if (t === "") return null;
789
+ const n = Tt(e, t);
790
+ if (n !== null) return n;
791
+ for (const r of e.querySelectorAll("a[name]"))
792
+ if (r.localName === "a" && r.namespaceURI === Bn && r.getAttribute("name") === t) return r;
793
+ return null;
794
+ }, At = (e, t) => {
795
+ if (e === null || !t.startsWith("#")) return null;
796
+ const n = Xe(e, t.slice(1));
797
+ if (n !== null) return n;
798
+ const r = qe(t);
799
+ return r === null ? null : Xe(e, r);
801
800
  }, Ye = (e) => {
802
801
  const { body: t, documentElement: n } = e.ownerDocument;
803
802
  if (e === t) {
@@ -809,19 +808,19 @@ const Fn = /* @__PURE__ */ y.forwardRef($n), Dn = ({ document: e }) => {
809
808
  }, zn = (e) => {
810
809
  const { body: t, documentElement: n } = e, r = getComputedStyle(n), o = r.overflowX === "visible" && r.overflowY === "visible" && t !== null ? getComputedStyle(t).overflowY : r.overflowY;
811
810
  return o !== "hidden" && o !== "clip";
812
- }, Bn = (e, t) => {
813
- const n = t.closest(je), r = n !== null && e.contains(n) ? n : e;
811
+ }, Hn = (e, t) => {
812
+ const n = t.closest(Pe), r = n !== null && e.contains(n) ? n : e;
814
813
  if (r.scrollHeight > r.clientHeight && Ye(r)) return r;
815
- const o = e.getBoundingClientRect().height, { documentElement: s, scrollingElement: l } = e.ownerDocument;
816
- for (let c = e.parentElement; c !== null && c !== s; c = c.parentElement)
817
- if (Ye(c) && c.scrollHeight > c.clientHeight && c.clientHeight < o) return c;
818
- return l instanceof Element && zn(e.ownerDocument) && l.scrollHeight > l.clientHeight && l.clientHeight < o ? l : r;
819
- }, _n = Object.freeze({
820
- scrollerOf: Bn,
814
+ const o = e.getBoundingClientRect().height, { documentElement: l, scrollingElement: s } = e.ownerDocument;
815
+ for (let a = e.parentElement; a !== null && a !== l; a = a.parentElement)
816
+ if (Ye(a) && a.scrollHeight > a.clientHeight && a.clientHeight < o) return a;
817
+ return s instanceof Element && zn(e.ownerDocument) && s.scrollHeight > s.clientHeight && s.clientHeight < o ? s : r;
818
+ }, In = Object.freeze({
819
+ scrollerOf: Hn,
821
820
  reveal: (e) => {
822
- e.scrollIntoView(Le);
821
+ e.scrollIntoView(Oe);
823
822
  }
824
- }), Le = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), Hn = (e, t) => {
823
+ }), Oe = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), Zn = (e, t) => {
825
824
  for (let n = t; n !== null && n !== e; n = n.parentElement) {
826
825
  const r = n.parentElement;
827
826
  if (r instanceof HTMLDetailsElement && n !== r.querySelector(":scope > summary") && (r.open = !0), n.getAttribute("hidden")?.toLowerCase() === "until-found") {
@@ -829,28 +828,28 @@ const Fn = /* @__PURE__ */ y.forwardRef($n), Dn = ({ document: e }) => {
829
828
  n.removeAttribute("hidden");
830
829
  }
831
830
  }
832
- }, In = (e, t) => {
831
+ }, Un = (e, t) => {
833
832
  if (t.getClientRects().length === 0) return;
834
- const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), s = Number.parseFloat(r), l = t.getBoundingClientRect(), c = l.height + s + Number.parseFloat(o) > e.clientHeight;
835
- if (!c && Math.abs(l.top - s - n) < 1) {
836
- t.scrollIntoView(Le);
833
+ const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), l = Number.parseFloat(r), s = t.getBoundingClientRect(), a = s.height + l + Number.parseFloat(o) > e.clientHeight;
834
+ if (!a && Math.abs(s.top - l - n) < 1) {
835
+ t.scrollIntoView(Oe);
837
836
  return;
838
837
  }
839
- e.scrollBy({ top: c ? l.top - n - e.clientHeight : l.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(Le);
840
- }, Zn = (e, t) => {
841
- const n = t.scrollerOf(e, e.querySelector(je) ?? e);
838
+ e.scrollBy({ top: a ? s.top - n - e.clientHeight : s.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(Oe);
839
+ }, Vn = (e, t) => {
840
+ const n = t.scrollerOf(e, e.querySelector(Pe) ?? e);
842
841
  n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
843
842
  }, Je = (e, t, n) => {
844
843
  if (e === null) return null;
845
- const r = jn(e, t);
846
- return r === null ? (qn(t) && Zn(e, n), null) : (Hn(e, r), In(n.scrollerOf(e, r), r), n.reveal(r), r);
844
+ const r = At(e, t);
845
+ return r === null ? (jn(t) && Vn(e, n), null) : (Zn(e, r), Un(n.scrollerOf(e, r), r), n.reveal(r), r);
847
846
  };
848
- function Un({
847
+ function Wn({
849
848
  title: e,
850
849
  titleId: t,
851
850
  ...n
852
851
  }, r) {
853
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
852
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
854
853
  xmlns: "http://www.w3.org/2000/svg",
855
854
  viewBox: "0 0 20 20",
856
855
  fill: "currentColor",
@@ -858,19 +857,19 @@ function Un({
858
857
  "data-slot": "icon",
859
858
  ref: r,
860
859
  "aria-labelledby": t
861
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
860
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
862
861
  id: t
863
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
862
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
864
863
  d: "M3.28 2.22a.75.75 0 0 0-1.06 1.06L5.44 6.5H2.75a.75.75 0 0 0 0 1.5h4.5A.75.75 0 0 0 8 7.25v-4.5a.75.75 0 0 0-1.5 0v2.69L3.28 2.22ZM13.5 2.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-2.69l3.22-3.22a.75.75 0 0 0-1.06-1.06L13.5 5.44V2.75ZM3.28 17.78l3.22-3.22v2.69a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.69l-3.22 3.22a.75.75 0 1 0 1.06 1.06ZM13.5 14.56l3.22 3.22a.75.75 0 1 0 1.06-1.06l-3.22-3.22h2.69a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75v4.5a.75.75 0 0 0 1.5 0v-2.69Z"
865
864
  }));
866
865
  }
867
- const Vn = /* @__PURE__ */ y.forwardRef(Un);
868
- function Wn({
866
+ const Kn = /* @__PURE__ */ x.forwardRef(Wn);
867
+ function Gn({
869
868
  title: e,
870
869
  titleId: t,
871
870
  ...n
872
871
  }, r) {
873
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
872
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
874
873
  xmlns: "http://www.w3.org/2000/svg",
875
874
  viewBox: "0 0 20 20",
876
875
  fill: "currentColor",
@@ -878,23 +877,23 @@ function Wn({
878
877
  "data-slot": "icon",
879
878
  ref: r,
880
879
  "aria-labelledby": t
881
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
880
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
882
881
  id: t
883
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
882
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
884
883
  d: "M6.75 8.25a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z"
885
- }), /* @__PURE__ */ y.createElement("path", {
884
+ }), /* @__PURE__ */ x.createElement("path", {
886
885
  fillRule: "evenodd",
887
886
  d: "M9 2a7 7 0 1 0 4.391 12.452l3.329 3.328a.75.75 0 1 0 1.06-1.06l-3.328-3.329A7 7 0 0 0 9 2ZM3.5 9a5.5 5.5 0 1 1 11 0 5.5 5.5 0 0 1-11 0Z",
888
887
  clipRule: "evenodd"
889
888
  }));
890
889
  }
891
- const Kn = /* @__PURE__ */ y.forwardRef(Wn);
892
- function Gn({
890
+ const Xn = /* @__PURE__ */ x.forwardRef(Gn);
891
+ function Yn({
893
892
  title: e,
894
893
  titleId: t,
895
894
  ...n
896
895
  }, r) {
897
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
896
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
898
897
  xmlns: "http://www.w3.org/2000/svg",
899
898
  viewBox: "0 0 20 20",
900
899
  fill: "currentColor",
@@ -902,23 +901,23 @@ function Gn({
902
901
  "data-slot": "icon",
903
902
  ref: r,
904
903
  "aria-labelledby": t
905
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
904
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
906
905
  id: t
907
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
906
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
908
907
  d: "M9 6a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0v-1.5h-1.5a.75.75 0 0 1 0-1.5h1.5v-1.5A.75.75 0 0 1 9 6Z"
909
- }), /* @__PURE__ */ y.createElement("path", {
908
+ }), /* @__PURE__ */ x.createElement("path", {
910
909
  fillRule: "evenodd",
911
910
  d: "M2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Zm7-5.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11Z",
912
911
  clipRule: "evenodd"
913
912
  }));
914
913
  }
915
- const Xn = /* @__PURE__ */ y.forwardRef(Gn);
916
- function Yn({
914
+ const Jn = /* @__PURE__ */ x.forwardRef(Yn);
915
+ function Qn({
917
916
  title: e,
918
917
  titleId: t,
919
918
  ...n
920
919
  }, r) {
921
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
920
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
922
921
  xmlns: "http://www.w3.org/2000/svg",
923
922
  viewBox: "0 0 20 20",
924
923
  fill: "currentColor",
@@ -926,15 +925,15 @@ function Yn({
926
925
  "data-slot": "icon",
927
926
  ref: r,
928
927
  "aria-labelledby": t
929
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
928
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
930
929
  id: t
931
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
930
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
932
931
  fillRule: "evenodd",
933
932
  d: "M1 5.25A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25v9.5A2.25 2.25 0 0 1 16.75 17H3.25A2.25 2.25 0 0 1 1 14.75v-9.5Zm1.5 5.81v3.69c0 .414.336.75.75.75h13.5a.75.75 0 0 0 .75-.75v-2.69l-2.22-2.219a.75.75 0 0 0-1.06 0l-1.91 1.909.47.47a.75.75 0 1 1-1.06 1.06L6.53 8.091a.75.75 0 0 0-1.06 0l-2.97 2.97ZM12 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",
934
933
  clipRule: "evenodd"
935
934
  }));
936
935
  }
937
- const Jn = /* @__PURE__ */ y.forwardRef(Yn), Me = "data-aqmx-key-repeat", Ce = Object.freeze({ [Me]: "allow" }), Qn = `[${Me}="${Ce[Me]}"]`, er = () => {
936
+ const er = /* @__PURE__ */ x.forwardRef(Qn), Le = "data-aqmx-key-repeat", Me = Object.freeze({ [Le]: "allow" }), tr = `[${Le}="${Me[Le]}"]`, nr = () => {
938
937
  let e = null;
939
938
  return {
940
939
  onKeyDownCapture: (t) => {
@@ -943,7 +942,7 @@ const Jn = /* @__PURE__ */ y.forwardRef(Yn), Me = "data-aqmx-key-repeat", Ce = O
943
942
  e = t.target instanceof Element ? t.target : null;
944
943
  return;
945
944
  }
946
- e !== null && t.target === e && e.closest(Qn) !== null || (t.preventDefault(), t.stopPropagation());
945
+ e !== null && t.target === e && e.closest(tr) !== null || (t.preventDefault(), t.stopPropagation());
947
946
  }
948
947
  },
949
948
  onKeyUpCapture: (t) => {
@@ -953,7 +952,7 @@ const Jn = /* @__PURE__ */ y.forwardRef(Yn), Me = "data-aqmx-key-repeat", Ce = O
953
952
  t.target === e && (e = null);
954
953
  }
955
954
  };
956
- }, ue = Object.freeze([1 / se ** 2, 1 / se, 1, se, se ** 2]), Qe = Object.freeze({ mode: "fit" }), tr = 1, nr = te(null), rr = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= tr ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, et = (e, t, n) => {
955
+ }, ue = Object.freeze([1 / se ** 2, 1 / se, 1, se, se ** 2]), Qe = Object.freeze({ mode: "fit" }), rr = 1, or = ne(null), lr = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= rr ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, et = (e, t, n) => {
957
956
  if (e.mode === "level") {
958
957
  const o = e.index + n;
959
958
  return o >= 0 && o < ue.length ? o : null;
@@ -969,37 +968,37 @@ const Jn = /* @__PURE__ */ y.forwardRef(Yn), Me = "data-aqmx-key-repeat", Ce = O
969
968
  if (t === null) return null;
970
969
  const r = et(e, t.scale, n);
971
970
  return r === null ? null : { mode: "level", index: r, base: t.base };
972
- }, or = (e) => {
971
+ }, ir = (e) => {
973
972
  const t = ue[e];
974
973
  if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
975
974
  return t;
976
- }, nt = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, lr = ({ document: e }) => {
977
- const { labels: t } = D(), n = W(nr), [r] = I(() => n === null ? null : n.read(e.url)), [o, s] = I(r === null ? Qe : r.zoom), [l, c] = I(r === null ? null : r.reported), [g, p] = I(null), f = z(null), h = $((m) => {
978
- const { naturalWidth: E, naturalHeight: b } = m;
979
- c((T) => nt(T, E, b));
980
- }, []), S = $(
981
- (m) => {
982
- f.current = m, !(m === null || !m.complete) && (m.naturalWidth > 0 || m.naturalHeight > 0 ? h(m) : m.decode().then(
983
- () => h(m),
975
+ }, nt = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, sr = ({ document: e }) => {
976
+ const { labels: t } = D(), n = W(or), [r] = Z(() => n === null ? null : n.read(e.url)), [o, l] = Z(r === null ? Qe : r.zoom), [s, a] = Z(r === null ? null : r.reported), [f, h] = Z(null), m = H(null), g = $((O) => {
977
+ const { naturalWidth: u, naturalHeight: p } = O;
978
+ a((S) => nt(S, u, p));
979
+ }, []), b = $(
980
+ (O) => {
981
+ m.current = O, !(O === null || !O.complete) && (O.naturalWidth > 0 || O.naturalHeight > 0 ? g(O) : O.decode().then(
982
+ () => g(O),
984
983
  () => {
985
984
  }
986
985
  ));
987
986
  },
988
- [h]
987
+ [g]
989
988
  );
990
989
  Y(() => {
991
- n !== null && l !== null && n.save(e.url, { zoom: o, reported: l });
992
- }, [n, e.url, o, l]), U(() => {
993
- const m = f.current;
994
- if (m === null || l === null || o.mode !== "fit") return;
995
- const E = () => p((T) => nt(T, m.clientWidth, m.clientHeight));
996
- if (E(), typeof ResizeObserver > "u") return;
997
- const b = new ResizeObserver(E);
998
- return b.observe(m), () => b.disconnect();
999
- }, [l, o.mode]);
1000
- const R = l === null || g === null ? null : rr(l, g), x = tt(o, R, -1), A = tt(o, R, 1), k = o.mode === "level" ? or(o.index) : null, u = o.mode === "level" && k !== null ? { width: `${o.base.width * k}px`, height: `${o.base.height * k}px` } : void 0;
1001
- return /* @__PURE__ */ Z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1002
- /* @__PURE__ */ Z(we, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(Jn, {}), children: [
990
+ n !== null && s !== null && n.save(e.url, { zoom: o, reported: s });
991
+ }, [n, e.url, o, s]), V(() => {
992
+ const O = m.current;
993
+ if (O === null || s === null || o.mode !== "fit") return;
994
+ const u = () => h((S) => nt(S, O.clientWidth, O.clientHeight));
995
+ if (u(), typeof ResizeObserver > "u") return;
996
+ const p = new ResizeObserver(u);
997
+ return p.observe(O), () => p.disconnect();
998
+ }, [s, o.mode]);
999
+ const R = s === null || f === null ? null : lr(s, f), k = tt(o, R, -1), A = tt(o, R, 1), T = o.mode === "level" ? ir(o.index) : null, F = o.mode === "level" && T !== null ? { width: `${o.base.width * T}px`, height: `${o.base.height * T}px` } : void 0;
1000
+ return /* @__PURE__ */ U("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1001
+ /* @__PURE__ */ U(ve, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(er, {}), children: [
1003
1002
  /* @__PURE__ */ d(
1004
1003
  "button",
1005
1004
  {
@@ -1007,15 +1006,15 @@ const Jn = /* @__PURE__ */ y.forwardRef(Yn), Me = "data-aqmx-key-repeat", Ce = O
1007
1006
  className: "aqmx-icon-button",
1008
1007
  "aria-label": t.imageZoomOut,
1009
1008
  title: t.imageZoomOut,
1010
- "aria-disabled": x === null,
1009
+ "aria-disabled": k === null,
1011
1010
  onClick: () => {
1012
- x !== null && s(x);
1011
+ k !== null && l(k);
1013
1012
  },
1014
- ...Ce,
1015
- children: /* @__PURE__ */ d(Kn, {})
1013
+ ...Me,
1014
+ children: /* @__PURE__ */ d(Xn, {})
1016
1015
  }
1017
1016
  ),
1018
- /* @__PURE__ */ d("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: k === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(k * 100)) }),
1017
+ /* @__PURE__ */ d("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: T === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(T * 100)) }),
1019
1018
  /* @__PURE__ */ d(
1020
1019
  "button",
1021
1020
  {
@@ -1025,88 +1024,89 @@ const Jn = /* @__PURE__ */ y.forwardRef(Yn), Me = "data-aqmx-key-repeat", Ce = O
1025
1024
  title: t.imageZoomIn,
1026
1025
  "aria-disabled": A === null,
1027
1026
  onClick: () => {
1028
- A !== null && s(A);
1027
+ A !== null && l(A);
1029
1028
  },
1030
- ...Ce,
1031
- children: /* @__PURE__ */ d(Xn, {})
1029
+ ...Me,
1030
+ children: /* @__PURE__ */ d(Jn, {})
1032
1031
  }
1033
1032
  ),
1034
- /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => s(Qe), children: /* @__PURE__ */ d(Vn, {}) })
1033
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => l(Qe), children: /* @__PURE__ */ d(Kn, {}) })
1035
1034
  ] }),
1036
- /* @__PURE__ */ d("div", { className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas", children: /* @__PURE__ */ d("img", { ref: S, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: u, onLoad: (m) => h(m.currentTarget), "data-testid": "markdown-explorer-image" }) })
1035
+ /* @__PURE__ */ d("div", { className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas", children: /* @__PURE__ */ d("img", { ref: b, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: F, onLoad: (O) => g(O.currentTarget), "data-testid": "markdown-explorer-image" }) })
1037
1036
  ] });
1038
- }, kt = te(null), be = te(void 0), Rt = te(null), Ee = () => {
1039
- const e = W(kt);
1037
+ }, Ot = ne(null), be = ne(void 0), Lt = ne(null), Ee = () => {
1038
+ const e = W(Ot);
1040
1039
  if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
1041
1040
  return e;
1042
- }, ir = () => {
1043
- const e = W(Rt);
1041
+ }, ar = () => {
1042
+ const e = W(Lt);
1044
1043
  if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
1045
1044
  return e;
1046
- }, Se = (e, t, n, r) => t.kind === "panel" ? oe(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? oe(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : oe(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), sr = ({ children: e }) => {
1047
- const { config: t } = D(), n = Ee(), r = Fe(), o = r.kind === "location" ? r.location.source : void 0, s = he(Se(t, n.navigation, o, n.currentPath));
1048
- return /* @__PURE__ */ d(be, { value: o, children: /* @__PURE__ */ d(Rt, { value: s, children: e }) });
1049
- }, ar = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', cr = (e) => {
1050
- const t = e instanceof Element ? e.closest(ar) : null;
1045
+ }, Se = (e, t, n, r) => t.kind === "panel" ? le(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? le(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : le(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), cr = ({ children: e }) => {
1046
+ const { config: t } = D(), n = Ee(), r = $e(), o = r.kind === "location" ? r.location.source : void 0, l = he(Se(t, n.navigation, o, n.currentPath));
1047
+ return /* @__PURE__ */ d(be, { value: o, children: /* @__PURE__ */ d(Lt, { value: l, children: e }) });
1048
+ }, dr = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', ur = (e) => {
1049
+ const t = e instanceof Element ? e.closest(dr) : null;
1051
1050
  return t === null ? null : t.getAttribute("data-doc-path");
1052
- }, ye = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, dr = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: s, onDocumentLink: l, scope: c, children: g }) => {
1053
- const p = he(e);
1054
- return /* @__PURE__ */ d("a", { ...s, href: p, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (h) => {
1055
- if (ye(h)) {
1056
- if (h.preventDefault(), t === c.currentPath && n !== "") {
1057
- c.scrollWithin(n);
1051
+ }, ye = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, fr = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: l, onDocumentLink: s, scope: a, children: f }) => {
1052
+ const h = he(e);
1053
+ return /* @__PURE__ */ d("a", { ...l, href: h, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (g) => {
1054
+ if (ye(g)) {
1055
+ if (g.preventDefault(), t === a.currentPath && n !== "") {
1056
+ a.scrollWithin(n);
1058
1057
  return;
1059
1058
  }
1060
- l(t, n);
1059
+ s(t, n);
1061
1060
  }
1062
- }, children: g });
1063
- }, ur = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: s }) => {
1064
- const { config: l } = D(), c = Ee(), g = W(be), p = Pn(e), { navigation: f } = c, h = `${Se(l, f, g, t)}${p}`, S = n === !1 ? "false" : void 0;
1065
- return f.kind === "page" ? /* @__PURE__ */ d(kn, { ...o, to: h, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": S, children: s }) : /* @__PURE__ */ d(dr, { to: h, docPath: t, fragment: p, exists: S, className: r, attributes: o, onDocumentLink: f.onDocumentLink, scope: c, children: s });
1066
- }, fr = ({ className: e, attributes: t, children: n }) => {
1061
+ }, children: f });
1062
+ }, mr = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: l }) => {
1063
+ const { config: s } = D(), a = Ee(), f = W(be), h = qn(e), { navigation: m } = a, g = `${Se(s, m, f, t)}${h}`, b = n === !1 ? "false" : void 0;
1064
+ return m.kind === "page" ? /* @__PURE__ */ d(Rn, { ...o, to: g, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": b, children: l }) : /* @__PURE__ */ d(fr, { to: g, docPath: t, fragment: h, exists: b, className: r, attributes: o, onDocumentLink: m.onDocumentLink, scope: a, children: l });
1065
+ }, gr = ({ className: e, attributes: t, children: n }) => {
1067
1066
  const { labels: r } = D();
1068
1067
  return (
1069
- /* @__PURE__ */ Z("a", { ...t, className: e === void 0 ? "aqmx-document-inert-link" : `${e} aqmx-document-inert-link`, title: r.inertLink, "data-link-kind": "doc", "data-doc-exists": "false", children: [
1068
+ /* @__PURE__ */ U("a", { ...t, className: e === void 0 ? "aqmx-document-inert-link" : `${e} aqmx-document-inert-link`, title: r.inertLink, "data-link-kind": "doc", "data-doc-exists": "false", children: [
1070
1069
  n,
1071
- /* @__PURE__ */ Z("span", { className: "aqmx-sr-only", children: [
1070
+ /* @__PURE__ */ U("span", { className: "aqmx-sr-only", children: [
1072
1071
  " (",
1073
1072
  r.inertLink,
1074
1073
  ")"
1075
1074
  ] })
1076
1075
  ] })
1077
1076
  );
1078
- }, mr = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
1079
- const { config: s } = D(), l = W(be), c = he(`${Se(s, r.navigation, l, r.currentPath)}${e}`);
1080
- return /* @__PURE__ */ d("a", { ...n, href: c, className: t, onClick: (p) => {
1081
- ye(p) && (p.preventDefault(), r.scrollWithin(e));
1077
+ }, hr = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
1078
+ const { config: l } = D(), s = W(be), a = he(`${Se(l, r.navigation, s, r.currentPath)}${e}`);
1079
+ return /* @__PURE__ */ d("a", { ...n, href: a, className: t, onClick: (h) => {
1080
+ ye(h) && (h.preventDefault(), r.scrollWithin(e));
1082
1081
  }, children: o });
1083
- }, gr = ({ href: e, className: t, attributes: n, children: r }) => {
1082
+ }, pr = ({ href: e, className: t, attributes: n, children: r }) => {
1084
1083
  const o = Ee();
1085
- return o.navigation.kind === "page" ? /* @__PURE__ */ d("a", { ...n, href: e, className: t, onClick: (l) => {
1086
- if (!ye(l)) return;
1087
- const c = l.currentTarget;
1088
- e === "#" ? o.followEmptyFragment(l.nativeEvent) : c.href === c.ownerDocument.URL && o.followSameUrlJump(e, l.nativeEvent);
1089
- }, children: r }) : /* @__PURE__ */ d(mr, { href: e, className: t, attributes: n, scope: o, children: r });
1090
- }, hr = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: s, children: l }) => t === "doc" ? n === void 0 || !Gt(n) ? /* @__PURE__ */ d(fr, { className: o, attributes: s, children: l }) : /* @__PURE__ */ d(ur, { href: e, docPath: n, docExists: r, className: o, attributes: s, children: l }) : e.startsWith("#") ? /* @__PURE__ */ d(gr, { href: e, className: o, attributes: s, children: l }) : /* @__PURE__ */ d("a", { ...s, href: e, className: o, children: l }), pr = () => {
1091
- const { config: e } = D(), t = Ee(), n = W(be), r = Pe();
1084
+ return o.navigation.kind === "page" ? /* @__PURE__ */ d("a", { ...n, href: e, className: t, onClick: (s) => {
1085
+ if (!ye(s)) return;
1086
+ const a = s.currentTarget;
1087
+ e === "#" ? o.followEmptyFragment(s.nativeEvent) : a.href === a.ownerDocument.URL && o.followSameUrlJump(e, s.nativeEvent);
1088
+ }, children: r }) : /* @__PURE__ */ d(hr, { href: e, className: t, attributes: n, scope: o, children: r });
1089
+ }, wr = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: l, children: s }) => t === "doc" ? n === void 0 || !Jt(n) ? /* @__PURE__ */ d(gr, { className: o, attributes: l, children: s }) : /* @__PURE__ */ d(mr, { href: e, docPath: n, docExists: r, className: o, attributes: l, children: s }) : e.startsWith("#") ? /* @__PURE__ */ d(pr, { href: e, className: o, attributes: l, children: s }) : /* @__PURE__ */ d("a", { ...l, href: e, className: o, children: s }), vr = () => {
1090
+ const { config: e } = D(), t = Ee(), n = W(be), r = Fe();
1092
1091
  return $(
1093
- (o, s) => {
1094
- if (!ye(s) || (s.preventDefault(), o.id === "")) return !0;
1095
- const l = xt(o.id), { navigation: c } = t;
1096
- return c.kind === "panel" || ve(s.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(l), !0) : (r(`${Se(e, c, n, t.currentPath)}${l}`, "follow-link"), !0);
1092
+ (o, l) => {
1093
+ if (!ye(l)) return !0;
1094
+ l.preventDefault();
1095
+ const s = Rt(o.id), { navigation: a } = t;
1096
+ return a.kind === "panel" || qe(l.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(s), !0) : (r(`${Se(e, a, n, t.currentPath)}${s}`, "follow-link"), !0);
1097
1097
  },
1098
1098
  [e, t, n, r]
1099
1099
  );
1100
- }, wr = () => {
1101
- const e = ir();
1102
- return $((t) => t.id === "" ? e : `${e}${xt(t.id)}`, [e]);
1100
+ }, br = () => {
1101
+ const e = ar();
1102
+ return $((t) => `${e}${Rt(t.id)}`, [e]);
1103
1103
  };
1104
- function vr({
1104
+ function Er({
1105
1105
  title: e,
1106
1106
  titleId: t,
1107
1107
  ...n
1108
1108
  }, r) {
1109
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
1109
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
1110
1110
  xmlns: "http://www.w3.org/2000/svg",
1111
1111
  viewBox: "0 0 20 20",
1112
1112
  fill: "currentColor",
@@ -1114,19 +1114,19 @@ function vr({
1114
1114
  "data-slot": "icon",
1115
1115
  ref: r,
1116
1116
  "aria-labelledby": t
1117
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
1117
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
1118
1118
  id: t
1119
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
1119
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
1120
1120
  d: "M3 3.5A1.5 1.5 0 0 1 4.5 2h6.879a1.5 1.5 0 0 1 1.06.44l4.122 4.12A1.5 1.5 0 0 1 17 7.622V16.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 16.5v-13Z"
1121
1121
  }));
1122
1122
  }
1123
- const br = /* @__PURE__ */ y.forwardRef(vr);
1124
- function Er({
1123
+ const Sr = /* @__PURE__ */ x.forwardRef(Er);
1124
+ function yr({
1125
1125
  title: e,
1126
1126
  titleId: t,
1127
1127
  ...n
1128
1128
  }, r) {
1129
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
1129
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
1130
1130
  xmlns: "http://www.w3.org/2000/svg",
1131
1131
  viewBox: "0 0 20 20",
1132
1132
  fill: "currentColor",
@@ -1134,21 +1134,21 @@ function Er({
1134
1134
  "data-slot": "icon",
1135
1135
  ref: r,
1136
1136
  "aria-labelledby": t
1137
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
1137
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
1138
1138
  id: t
1139
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
1139
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
1140
1140
  fillRule: "evenodd",
1141
1141
  d: "M1 4.75C1 3.784 1.784 3 2.75 3h14.5c.966 0 1.75.784 1.75 1.75v10.515a1.75 1.75 0 0 1-1.75 1.75h-1.5c-.078 0-.155-.005-.23-.015H4.48c-.075.01-.152.015-.23.015h-1.5A1.75 1.75 0 0 1 1 15.265V4.75Zm16.5 7.385V11.01a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25Zm0 2.005a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .108.069.2.165.235h1.585a.25.25 0 0 0 .25-.25v-1.11Zm-15 1.11v-1.11a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.164.235H2.75a.25.25 0 0 1-.25-.25Zm2-4.24v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V11.01a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25Zm13-2.005V7.88a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25ZM4.25 7.63a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V7.88a.25.25 0 0 1 .25-.25h1.5Zm0-3.13a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5Zm11.5 1.625a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5Zm-9 3.125a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",
1142
1142
  clipRule: "evenodd"
1143
1143
  }));
1144
1144
  }
1145
- const Sr = /* @__PURE__ */ y.forwardRef(Er);
1146
- function yr({
1145
+ const xr = /* @__PURE__ */ x.forwardRef(yr);
1146
+ function kr({
1147
1147
  title: e,
1148
1148
  titleId: t,
1149
1149
  ...n
1150
1150
  }, r) {
1151
- return /* @__PURE__ */ y.createElement("svg", Object.assign({
1151
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
1152
1152
  xmlns: "http://www.w3.org/2000/svg",
1153
1153
  viewBox: "0 0 20 20",
1154
1154
  fill: "currentColor",
@@ -1156,28 +1156,28 @@ function yr({
1156
1156
  "data-slot": "icon",
1157
1157
  ref: r,
1158
1158
  "aria-labelledby": t
1159
- }, n), e ? /* @__PURE__ */ y.createElement("title", {
1159
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
1160
1160
  id: t
1161
- }, e) : null, /* @__PURE__ */ y.createElement("path", {
1161
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
1162
1162
  fillRule: "evenodd",
1163
1163
  d: "M17.721 1.599a.75.75 0 0 1 .279.583v11.29a2.25 2.25 0 0 1-1.774 2.2l-2.041.44a2.216 2.216 0 0 1-.938-4.332l2.662-.577a.75.75 0 0 0 .591-.733V6.112l-8 1.73v7.684a2.25 2.25 0 0 1-1.774 2.2l-2.042.44a2.216 2.216 0 1 1-.935-4.331l2.659-.573A.75.75 0 0 0 7 12.529V4.236a.75.75 0 0 1 .591-.733l9.5-2.054a.75.75 0 0 1 .63.15Z",
1164
1164
  clipRule: "evenodd"
1165
1165
  }));
1166
1166
  }
1167
- const xr = /* @__PURE__ */ y.forwardRef(yr), kr = (e) => {
1167
+ const Rr = /* @__PURE__ */ x.forwardRef(kr), Tr = (e) => {
1168
1168
  switch (e) {
1169
1169
  case "video":
1170
- return /* @__PURE__ */ d(Sr, {});
1171
- case "audio":
1172
1170
  return /* @__PURE__ */ d(xr, {});
1171
+ case "audio":
1172
+ return /* @__PURE__ */ d(Rr, {});
1173
1173
  case "pdf":
1174
- return /* @__PURE__ */ d(br, {});
1174
+ return /* @__PURE__ */ d(Sr, {});
1175
1175
  default: {
1176
1176
  const t = e;
1177
1177
  throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`);
1178
1178
  }
1179
1179
  }
1180
- }, Rr = ({ document: e }) => {
1180
+ }, Ar = ({ document: e }) => {
1181
1181
  const { labels: t } = D();
1182
1182
  switch (e.mediaType) {
1183
1183
  case "video":
@@ -1195,10 +1195,10 @@ const xr = /* @__PURE__ */ y.forwardRef(yr), kr = (e) => {
1195
1195
  throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`);
1196
1196
  }
1197
1197
  }
1198
- }, Tr = ({ document: e }) => /* @__PURE__ */ Z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
1199
- /* @__PURE__ */ d(we, { name: e.name, url: e.url, icon: kr(e.mediaType) }),
1200
- /* @__PURE__ */ d("div", { className: "aqmx-document-stage", children: /* @__PURE__ */ d(Rr, { document: e }) })
1201
- ] }), Ar = (e) => ({
1198
+ }, Or = ({ document: e }) => /* @__PURE__ */ U("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
1199
+ /* @__PURE__ */ d(ve, { name: e.name, url: e.url, icon: Tr(e.mediaType) }),
1200
+ /* @__PURE__ */ d("div", { className: "aqmx-document-stage", children: /* @__PURE__ */ d(Ar, { document: e }) })
1201
+ ] }), Lr = (e) => ({
1202
1202
  loading: e.viewerLoading,
1203
1203
  errorPrefix: e.viewerErrorPrefix,
1204
1204
  styleTitle: e.viewerStyleTitle,
@@ -1228,191 +1228,195 @@ const xr = /* @__PURE__ */ y.forwardRef(yr), kr = (e) => {
1228
1228
  mermaidZoomIn: e.viewerMermaidZoomIn,
1229
1229
  mermaidZoomOut: e.viewerMermaidZoomOut,
1230
1230
  mermaidResetView: e.viewerMermaidResetView,
1231
- mermaidRetry: e.viewerMermaidRetry
1232
- }), Tt = (e, t, n) => {
1231
+ mermaidRetry: e.viewerMermaidRetry,
1232
+ embeddedVideo: e.viewerEmbeddedVideo,
1233
+ embeddedPost: e.viewerEmbeddedPost,
1234
+ embeddedFrame: e.viewerEmbeddedFrame
1235
+ }), Mt = (e, t, n) => {
1233
1236
  if (t !== void 0) return t;
1234
1237
  if (n !== void 0) return n;
1235
1238
  const [r] = e.documentStyles;
1236
1239
  if (r === void 0) throw new Error("[markdown-explorer] the configuration has no document style");
1237
1240
  return r.name;
1238
- }, At = (e, t) => e !== void 0 ? e : t !== void 0 ? t : on, Or = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Lr = (e, t, n) => {
1241
+ }, Ct = (e, t) => e !== void 0 ? e : t !== void 0 ? t : an, Mr = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Cr = (e, t, n) => {
1239
1242
  if (t.view === "multi" || t.overrides[n] === void 0) return null;
1240
1243
  const r = n === "style" ? { align: t.overrides.align } : { style: t.overrides.style };
1241
- return t.view === "single" ? oe(e, { view: "single", source: t.source, doc: t.doc, overrides: r, embed: t.embed }) : oe(e, { view: "tree", source: t.source, doc: t.doc, overrides: r });
1242
- }, Ne = te("fill"), ze = ({ kind: e, label: t, stale: n, busy: r, frameRef: o, intent: s, children: l }) => {
1243
- const c = W(Ne);
1244
+ return t.view === "single" ? le(e, { view: "single", source: t.source, doc: t.doc, overrides: r, embed: t.embed }) : le(e, { view: "tree", source: t.source, doc: t.doc, overrides: r });
1245
+ }, Ce = ne("fill"), _e = ({ kind: e, label: t, stale: n, busy: r, frameRef: o, intent: l, children: s }) => {
1246
+ const a = W(Ce);
1244
1247
  return (
1245
- /* @__PURE__ */ Z("section", { ref: o, role: "region", "aria-label": t, "aria-busy": r, "data-testid": "markdown-explorer-document", "data-aqmx-document-kind": e, "data-aqmx-document-flow": c, className: "aqmx-document", ...s, children: [
1248
+ /* @__PURE__ */ U("section", { ref: o, role: "region", "aria-label": t, "aria-busy": r, "data-testid": "markdown-explorer-document", "data-aqmx-document-kind": e, "data-aqmx-document-flow": a, className: "aqmx-document", ...l, children: [
1246
1249
  n ? /* @__PURE__ */ d("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
1247
- l
1250
+ s
1248
1251
  ] })
1249
1252
  );
1250
- }, Mr = () => {
1253
+ }, Nr = () => {
1251
1254
  const { labels: e } = D();
1252
- return /* @__PURE__ */ d(ze, { kind: "empty", label: e.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ d("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-document-empty", children: /* @__PURE__ */ d("p", { className: "aqmx-empty-title", children: e.documentEmpty }) }) });
1253
- }, Ot = ({ label: e }) => {
1255
+ return /* @__PURE__ */ d(_e, { kind: "empty", label: e.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ d("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-document-empty", children: /* @__PURE__ */ d("p", { className: "aqmx-empty-title", children: e.documentEmpty }) }) });
1256
+ }, Nt = ({ label: e }) => {
1254
1257
  const { labels: t } = D();
1255
- return /* @__PURE__ */ Z(ze, { kind: "loading", label: e, stale: !1, busy: !0, children: [
1256
- /* @__PURE__ */ d("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-document-skeleton", children: Or.map((n) => /* @__PURE__ */ d("span", {}, n)) }),
1258
+ return /* @__PURE__ */ U(_e, { kind: "loading", label: e, stale: !1, busy: !0, children: [
1259
+ /* @__PURE__ */ d("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-document-skeleton", children: Mr.map((n) => /* @__PURE__ */ d("span", {}, n)) }),
1257
1260
  /* @__PURE__ */ d("p", { className: "aqmx-sr-only", children: t.documentLoading })
1258
1261
  ] });
1259
- }, Cr = ({ path: e, document: t, viewer: n }) => {
1260
- const { reportMathDiagnostics: r } = D(), o = H(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), s = pr(), l = wr(), c = H(() => r === void 0 ? void 0 : (g) => r(e, g), [r, e]);
1261
- return /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(mt, { ...n, onHeadingSelect: s, headingHref: l, onMathDiagnostics: c, parseResult: o, content: null }) });
1262
- }, Nr = ({ document: e, viewer: t }) => {
1262
+ }, $r = ({ path: e, document: t, viewer: n }) => {
1263
+ const { reportMathDiagnostics: r } = D(), o = I(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), l = vr(), s = br(), a = I(() => r === void 0 ? void 0 : (f) => r(e, f), [r, e]);
1264
+ return /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(gt, { ...n, onHeadingSelect: l, headingHref: s, onMathDiagnostics: a, parseResult: o, content: null }) });
1265
+ }, Dr = ({ document: e, viewer: t }) => {
1263
1266
  const { labels: n } = D();
1264
- return /* @__PURE__ */ Z(Ct, { children: [
1265
- /* @__PURE__ */ d(we, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(xn, {}) }),
1267
+ return /* @__PURE__ */ U(Ft, { children: [
1268
+ /* @__PURE__ */ d(ve, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(kn, {}) }),
1266
1269
  e.truncated ? /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
1267
- /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(mt, { ...t, parseResult: null, content: e.text }) })
1270
+ /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(gt, { ...t, parseResult: null, content: e.text }) })
1268
1271
  ] });
1269
- }, $r = ({ path: e, document: t, viewer: n, onRetry: r }) => {
1272
+ }, Fr = ({ path: e, document: t, viewer: n, onRetry: r }) => {
1270
1273
  switch (t.kind) {
1271
1274
  case "markdown":
1272
- return /* @__PURE__ */ d(Cr, { path: e, document: t, viewer: n });
1275
+ return /* @__PURE__ */ d($r, { path: e, document: t, viewer: n });
1273
1276
  case "text":
1274
- return /* @__PURE__ */ d(Nr, { document: t, viewer: n });
1277
+ return /* @__PURE__ */ d(Dr, { document: t, viewer: n });
1275
1278
  case "image":
1276
- return /* @__PURE__ */ d(lr, { document: t });
1279
+ return /* @__PURE__ */ d(sr, { document: t });
1277
1280
  case "media":
1278
- return /* @__PURE__ */ d(Tr, { document: t });
1281
+ return /* @__PURE__ */ d(Or, { document: t });
1279
1282
  case "file":
1280
- return /* @__PURE__ */ d(Dn, { document: t });
1283
+ return /* @__PURE__ */ d(Pn, { document: t });
1281
1284
  case "failure":
1282
- return /* @__PURE__ */ d("div", { className: "aqmx-document-failure", "data-aqmx-document-scroller": "", children: /* @__PURE__ */ d(Rn, { failure: t.failure, alert: !1, onRetry: r, testId: "markdown-explorer-document-failure" }) });
1285
+ return /* @__PURE__ */ d("div", { className: "aqmx-document-failure", "data-aqmx-document-scroller": "", children: /* @__PURE__ */ d(Tn, { failure: t.failure, alert: !1, onRetry: r, testId: "markdown-explorer-document-failure" }) });
1283
1286
  default: {
1284
1287
  const o = t;
1285
1288
  throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(o)}`);
1286
1289
  }
1287
1290
  }
1288
- }, Fr = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', Dr = (e, t, n) => {
1289
- const r = n === null ? null : ve(n), [o] = t.kind === "markdown" ? t.headings : [], s = [r === null ? null : Oe(e, r), o === void 0 ? null : Oe(e, o.id), e.querySelector(je), e.querySelector(Fr)];
1290
- for (const l of s)
1291
- if (l instanceof HTMLElement && Et(l)) return l;
1291
+ }, Pr = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', qr = (e, t, n) => {
1292
+ const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : At(e, n), r === void 0 ? null : Tt(e, r.id), e.querySelector(Pe), e.querySelector(Pr)];
1293
+ for (const l of o)
1294
+ if (l instanceof HTMLElement && St(l)) return l;
1292
1295
  return null;
1293
1296
  }, rt = (e, t, n) => {
1294
- const { activeElement: r, body: o } = e.ownerDocument, s = r === null || r === o;
1295
- t instanceof HTMLElement && n && (s || e.contains(r)) && Et(t);
1296
- }, Pr = (e) => {
1297
- const t = z(!1);
1298
- return U(() => {
1297
+ const { activeElement: r, body: o } = e.ownerDocument, l = r === null || r === o;
1298
+ t instanceof HTMLElement && n && (l || e.contains(r)) && St(t);
1299
+ }, _r = (e) => {
1300
+ const t = H(!1);
1301
+ return V(() => {
1299
1302
  const n = e.current;
1300
1303
  if (n === null) throw new Error("[markdown-explorer] the document region is not mounted");
1301
1304
  const r = n.ownerDocument, o = r.defaultView;
1302
1305
  if (o === null) throw new Error("[markdown-explorer] the document region's document has no window");
1303
- let s = !1, l;
1304
- const c = (S) => {
1305
- s = !(S.target instanceof Node && n.contains(S.target)), s && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(l), l = setTimeout(() => {
1306
- s = !1;
1306
+ let l = !1, s;
1307
+ const a = (b) => {
1308
+ l = !(b.target instanceof Node && n.contains(b.target)), l && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(s), s = setTimeout(() => {
1309
+ l = !1;
1307
1310
  }, 0);
1308
- }, g = (S) => {
1309
- t.current = S.target instanceof Node && n.contains(S.target);
1310
- }, p = (S) => {
1311
- S.relatedTarget === null && s && (t.current = !1);
1312
- }, f = () => {
1313
- const { activeElement: S, body: R } = r;
1314
- S !== null && S !== R && (t.current = n.contains(S));
1315
- }, h = () => {
1316
- s && !n.contains(r.activeElement) && (t.current = !1);
1311
+ }, f = (b) => {
1312
+ t.current = b.target instanceof Node && n.contains(b.target);
1313
+ }, h = (b) => {
1314
+ b.relatedTarget === null && l && (t.current = !1);
1315
+ }, m = () => {
1316
+ const { activeElement: b, body: R } = r;
1317
+ b !== null && b !== R && (t.current = n.contains(b));
1318
+ }, g = () => {
1319
+ l && !n.contains(r.activeElement) && (t.current = !1);
1317
1320
  };
1318
- return o.addEventListener("pointerdown", c, !0), o.addEventListener("mousedown", c, !0), o.addEventListener("focusin", g, !0), o.addEventListener("blur", f), o.addEventListener("focus", h), n.addEventListener("focusout", p), () => {
1319
- clearTimeout(l), o.removeEventListener("pointerdown", c, !0), o.removeEventListener("mousedown", c, !0), o.removeEventListener("focusin", g, !0), o.removeEventListener("blur", f), o.removeEventListener("focus", h), n.removeEventListener("focusout", p);
1321
+ return o.addEventListener("pointerdown", a, !0), o.addEventListener("mousedown", a, !0), o.addEventListener("focusin", f, !0), o.addEventListener("blur", m), o.addEventListener("focus", g), n.addEventListener("focusout", h), () => {
1322
+ clearTimeout(s), o.removeEventListener("pointerdown", a, !0), o.removeEventListener("mousedown", a, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("blur", m), o.removeEventListener("focus", g), n.removeEventListener("focusout", h);
1320
1323
  };
1321
1324
  }, [e]), t;
1322
- }, qr = ({ path: e, snapshot: t, stale: n, viewer: r, regionLabel: o, navigation: s, fragment: l, paneScroll: c, announces: g, announceFailure: p, onDocumentShown: f }) => {
1323
- const { labels: h, announcer: S, documents: R } = D(), { document: x } = t, A = z(null), k = z(null), u = z(null), m = z(0), E = Pr(A), b = z({ path: e, document: x }), T = z(null), C = $(
1325
+ }, jr = ({ path: e, snapshot: t, stale: n, viewer: r, regionLabel: o, navigation: l, fragment: s, paneScroll: a, announces: f, announceFailure: h, onDocumentShown: m }) => {
1326
+ const { labels: g, announcer: b, documents: R } = D(), { document: k } = t, A = H(null), T = H(null), F = H(null), O = H(0), u = _r(A), p = H({ path: e, document: k }), S = H(null), E = $(
1324
1327
  (i) => {
1325
- const a = A.current, w = Je(a, i, c);
1326
- a !== null && w !== null && rt(a, w, E.current);
1328
+ const c = A.current, w = Je(c, i, a);
1329
+ c !== null && w !== null && rt(c, w, u.current);
1327
1330
  },
1328
- [c, E]
1329
- ), O = $(
1330
- (i, a) => {
1331
- const w = m.current;
1331
+ [a, u]
1332
+ ), y = $(
1333
+ (i, c) => {
1334
+ const w = O.current;
1332
1335
  setTimeout(() => {
1333
- !a.defaultPrevented && m.current === w && C(i);
1336
+ !c.defaultPrevented && O.current === w && E(i);
1334
1337
  }, 0);
1335
1338
  },
1336
- [C]
1337
- ), N = $(
1339
+ [E]
1340
+ ), P = $(
1338
1341
  (i) => {
1339
1342
  setTimeout(() => {
1340
- i.defaultPrevented || C("#");
1343
+ i.defaultPrevented || E("#");
1341
1344
  }, 0);
1342
1345
  },
1343
- [C]
1344
- ), P = H(() => ({ navigation: s, currentPath: e, scrollWithin: C, followSameUrlJump: O, followEmptyFragment: N }), [s, e, C, O, N]), B = $(() => R.retry(e), [R, e]), V = Tn(R, cr), F = Q((i, a) => {
1345
- const w = k.current;
1346
- if (w !== null && w.path === i && w.snapshot === a) return;
1347
- k.current = { path: i, snapshot: a };
1348
- const v = a.document;
1346
+ [E]
1347
+ ), z = I(() => ({ navigation: l, currentPath: e, scrollWithin: E, followSameUrlJump: y, followEmptyFragment: P }), [l, e, E, y, P]), M = $(() => R.retry(e), [R, e]), j = An(R, ur), C = Q((i, c) => {
1348
+ const w = T.current;
1349
+ if (w !== null && w.path === i && w.snapshot === c) return;
1350
+ T.current = { path: i, snapshot: c };
1351
+ const v = c.document;
1349
1352
  if (v.kind === "failure") {
1350
- R.noteFailureShown(a) && p(h.documentFailed(gt(i), qe(h, v.failure.reason)));
1353
+ R.noteFailureShown(c) && h(g.documentFailed(ht(i), pe(g, v.failure.reason)));
1351
1354
  return;
1352
1355
  }
1353
- f?.(i, v), g && (w === null || w.path !== i || w.snapshot.document.kind === "failure") && S.announce(h.documentShown(v.name));
1356
+ m?.(i, v), f && (w === null || w.path !== i || w.snapshot.document.kind === "failure") && b.announce(g.documentShown(v.name));
1354
1357
  });
1355
1358
  Y(() => {
1356
- F(e, t);
1359
+ C(e, t);
1357
1360
  }, [e, t]);
1358
- const _ = Q(() => {
1359
- l.kind === "panel" && l.consume();
1361
+ const q = Q(() => {
1362
+ s.kind === "panel" && s.consume();
1360
1363
  }), J = Q((i) => {
1361
- const a = A.current;
1362
- if (a === null || !E.current) return null;
1363
- const { activeElement: w, body: v } = a.ownerDocument;
1364
- return w !== null && w !== v ? null : Dr(a, x, i);
1365
- }), ne = Q((i) => {
1366
- const a = A.current;
1367
- a !== null && rt(a, i, E.current);
1368
- }), K = Q((i) => c.reveal(i)), xe = Q((i) => Je(A.current, i, c));
1364
+ const c = A.current;
1365
+ if (c === null || !u.current) return null;
1366
+ const { activeElement: w, body: v } = c.ownerDocument;
1367
+ return w !== null && w !== v ? null : qr(c, k, i);
1368
+ }), re = Q((i) => {
1369
+ const c = A.current;
1370
+ c !== null && rt(c, i, u.current);
1371
+ }), K = Q((i) => a.reveal(i)), xe = Q((i) => Je(A.current, i, a));
1369
1372
  return Y(() => {
1370
1373
  if (n) return;
1371
- const i = b.current.path !== e, a = i || b.current.document !== x;
1372
- b.current = { path: e, document: x };
1373
- const w = T.current !== e;
1374
- T.current = e;
1374
+ const i = p.current.path !== e, c = i || p.current.document !== k;
1375
+ p.current = { path: e, document: k };
1376
+ const w = S.current !== e;
1377
+ S.current = e;
1375
1378
  let v = null;
1376
- l.kind === "page" ? u.current !== l.navigation && (u.current = l.navigation, m.current += 1, v = l.fragment) : l.fragment !== null && (v = l.fragment, _());
1379
+ s.kind === "page" ? F.current !== s.navigation && (F.current = s.navigation, O.current += 1, v = s.fragment) : s.fragment !== null && (v = s.fragment, q());
1377
1380
  const L = () => {
1378
- const M = v === null ? null : xe(v);
1379
- if (!a) {
1380
- M !== null && ne(M);
1381
+ const N = v === null ? null : xe(v);
1382
+ if (!c) {
1383
+ N !== null && re(N);
1381
1384
  return;
1382
1385
  }
1383
- const q = J(l.fragment);
1384
- i && M === null && q !== null && K(q);
1386
+ const _ = J(s.fragment);
1387
+ i && N === null && _ !== null && K(_);
1385
1388
  };
1386
1389
  w ? queueMicrotask(L) : L();
1387
- }, [l, e, x, n]), /* @__PURE__ */ d(ze, { kind: x.kind, label: o(e, x), stale: n, busy: n, frameRef: A, intent: V, children: /* @__PURE__ */ d(kt, { value: P, children: /* @__PURE__ */ d(sr, { children: /* @__PURE__ */ d($r, { path: e, document: x, viewer: r, onRetry: B }, e) }) }) });
1388
- }, Be = Object.freeze({ kind: "skeleton" }), jr = (e, t, n, r, o) => {
1390
+ }, [s, e, k, n]), /* @__PURE__ */ d(_e, { kind: k.kind, label: o(e, k), stale: n, busy: n, frameRef: A, intent: j, children: /* @__PURE__ */ d(Ot, { value: z, children: /* @__PURE__ */ d(cr, { children: /* @__PURE__ */ d(Fr, { path: e, document: k, viewer: r, onRetry: M }, e) }) }) });
1391
+ }, je = Object.freeze({ kind: "skeleton" }), Br = (e, t, n, r, o) => {
1389
1392
  if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
1390
- const s = ge(t);
1391
- if (s !== null) return { kind: "document", path: e, snapshot: s, stale: !0 };
1393
+ const l = ge(t);
1394
+ if (l !== null) return { kind: "document", path: e, snapshot: l, stale: !0 };
1392
1395
  if (o && t?.status === "pending") return { kind: "streaming", path: e, promise: t.promise };
1393
- const l = n === null || n === e ? null : ge(r);
1394
- return n === null || l === null ? Be : { kind: "document", path: n, snapshot: l, stale: !0 };
1395
- }, zr = (e, t) => t.status === "deferred" ? Be : { kind: "document", path: e, snapshot: t, stale: !1 }, Br = ({ requestedPath: e, content: t, ...n }) => {
1396
+ const s = n === null || n === e ? null : ge(r);
1397
+ return n === null || s === null ? je : { kind: "document", path: n, snapshot: s, stale: !0 };
1398
+ }, zr = (e, t) => t.status === "deferred" ? je : { kind: "document", path: e, snapshot: t, stale: !1 }, Hr = ({ requestedPath: e, content: t, ...n }) => {
1396
1399
  const r = t.kind === "streaming" ? zr(t.path, W(t.promise)) : t;
1397
- return r.kind !== "document" ? /* @__PURE__ */ d(Ot, { label: n.regionLabel(e, null) }) : /* @__PURE__ */ d(qr, { path: r.path, snapshot: r.snapshot, stale: r.stale, ...n });
1398
- }, Lt = ({ path: e, display: t, navigation: n, fragment: r, paneScroll: o, announces: s, announceFailure: l, onDocumentShown: c }) => {
1399
- const { config: g, labels: p, theme: f, documents: h } = D(), S = Kt(), R = z(!1);
1400
- U(() => {
1400
+ return r.kind !== "document" ? /* @__PURE__ */ d(Nt, { label: n.regionLabel(e, null) }) : /* @__PURE__ */ d(jr, { path: r.path, snapshot: r.snapshot, stale: r.stale, ...n });
1401
+ }, $t = ({ path: e, display: t, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: a }) => {
1402
+ const { config: f, labels: h, theme: m, documents: g } = D(), b = Yt(), R = H(!1);
1403
+ V(() => {
1401
1404
  R.current = !0;
1402
1405
  }, []);
1403
- const [x, A] = I(null), k = $(() => e === null ? void 0 : h.peek(e), [h, e]), u = le(h.subscribe, k, k), m = $(() => x === null ? void 0 : h.peek(x), [h, x]), E = le(h.subscribe, m, m);
1404
- U(() => e === null ? void 0 : h.open(e), [h, e]), U(() => x === null ? void 0 : h.retain(x), [h, x]);
1405
- const b = e === null ? Be : jr(e, u, x, E, !R.current), T = e === null ? null : b.kind === "document" && !b.stale ? b.path : x;
1406
- T !== x && A(T);
1407
- const C = H(() => Ar(p), [p]), O = H(() => [...g.iframeHosts], [g]), N = H(
1406
+ const [k, A] = Z(null), T = $(() => e === null ? void 0 : g.peek(e), [g, e]), F = te(g.subscribe, T, T), O = $(() => k === null ? void 0 : g.peek(k), [g, k]), u = te(g.subscribe, O, O);
1407
+ V(() => e === null ? void 0 : g.open(e), [g, e]), V(() => k === null ? void 0 : g.retain(k), [g, k]);
1408
+ const p = e === null ? je : Br(e, F, k, u, !R.current), S = e === null ? null : p.kind === "document" && !p.stale ? p.path : k;
1409
+ S !== k && A(S);
1410
+ const E = I(() => Lr(h), [h]), y = I(() => [...f.iframeHosts], [f]), P = I(
1408
1411
  () => ({
1409
- labels: C,
1410
- emptyMessage: p.documentEmpty,
1411
- theme: f,
1412
- availableStyles: g.documentStyles,
1413
- iFrameAllowedDomains: O,
1414
- linkComponent: hr,
1415
- toolbar: S,
1412
+ labels: E,
1413
+ emptyMessage: h.documentEmpty,
1414
+ theme: m,
1415
+ availableStyles: f.documentStyles,
1416
+ iFrameAllowedDomains: y,
1417
+ embeds: f.embeds,
1418
+ linkComponent: wr,
1419
+ toolbar: b,
1416
1420
  style: t.style,
1417
1421
  onStyleChange: t.onStyleChange,
1418
1422
  align: t.align,
@@ -1424,33 +1428,33 @@ const xr = /* @__PURE__ */ y.forwardRef(yr), kr = (e) => {
1424
1428
  width: t.width === void 0 ? void 0 : `min(${t.width}, 100%)`,
1425
1429
  maxWidth: t.maxWidth === void 0 ? void 0 : `min(${t.maxWidth}, 100%)`
1426
1430
  }),
1427
- [C, p.documentEmpty, f, g.documentStyles, O, S, t]
1428
- ), P = n.kind === "panel", B = $((F, _) => P ? _ === null || _.kind === "failure" ? gt(F) : _.name : p.documentRegion, [P, p.documentRegion]), V = P ? "content" : "fill";
1429
- return e === null ? /* @__PURE__ */ d(Ne, { value: V, children: /* @__PURE__ */ d(Mr, {}) }) : /* @__PURE__ */ d(Ne, { value: V, children: /* @__PURE__ */ d(Ae, { fallback: /* @__PURE__ */ d(Ot, { label: B(e, null) }), children: /* @__PURE__ */ d(Br, { requestedPath: e, content: b, viewer: N, regionLabel: B, navigation: n, fragment: r, paneScroll: o, announces: s, announceFailure: l, onDocumentShown: c }) }) });
1430
- }, _r = ({ path: e, variant: t, onDocumentShown: n }) => {
1431
- const { config: r, viewSettings: o, announcer: s } = D(), l = fe((O) => O.style), c = fe((O) => O.align), g = Pe(), p = qt(), f = Fe(), { view: h, overrides: S, embed: R } = t, x = $(
1432
- (O) => {
1433
- if (f.kind !== "location") return;
1434
- const N = Lr(r, f.location, O);
1435
- N !== null && g(N, "browse");
1431
+ [E, h.documentEmpty, m, f.documentStyles, y, f.embeds, b, t]
1432
+ ), z = n.kind === "panel", M = $((C, q) => z ? q === null || q.kind === "failure" ? ht(C) : q.name : h.documentRegion, [z, h.documentRegion]), j = z ? "content" : "fill";
1433
+ return e === null ? /* @__PURE__ */ d(Ce, { value: j, children: /* @__PURE__ */ d(Nr, {}) }) : /* @__PURE__ */ d(Ce, { value: j, children: /* @__PURE__ */ d(Ae, { fallback: /* @__PURE__ */ d(Nt, { label: M(e, null) }), children: /* @__PURE__ */ d(Hr, { requestedPath: e, content: p, viewer: P, regionLabel: M, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: a }) }) });
1434
+ }, Ir = ({ path: e, variant: t, onDocumentShown: n }) => {
1435
+ const { config: r, viewSettings: o, announcer: l } = D(), s = fe((y) => y.style), a = fe((y) => y.align), f = Fe(), h = mt(), m = $e(), { view: g, overrides: b, embed: R } = t, k = $(
1436
+ (y) => {
1437
+ if (m.kind !== "location") return;
1438
+ const P = Cr(r, m.location, y);
1439
+ P !== null && f(P, "browse");
1436
1440
  },
1437
- [r, g, f]
1441
+ [r, f, m]
1438
1442
  ), A = $(
1439
- (O) => {
1440
- o.update({ style: O }), x("style");
1443
+ (y) => {
1444
+ o.update({ style: y }), k("style");
1441
1445
  },
1442
- [o, x]
1443
- ), k = $(
1444
- (O) => {
1445
- o.update({ align: O }), x("align");
1446
+ [o, k]
1447
+ ), T = $(
1448
+ (y) => {
1449
+ o.update({ align: y }), k("align");
1446
1450
  },
1447
- [o, x]
1448
- ), u = Tt(r, S.style, l), m = At(S.align, c), E = H(
1451
+ [o, k]
1452
+ ), F = Mt(r, b.style, s), O = Ct(b.align, a), u = I(
1449
1453
  () => ({
1450
- style: u,
1454
+ style: F,
1451
1455
  onStyleChange: A,
1452
- align: m,
1453
- onAlignChange: k,
1456
+ align: O,
1457
+ onAlignChange: T,
1454
1458
  showToc: R.showToc !== !1,
1455
1459
  showStyle: R.showStyle !== !1,
1456
1460
  showAlign: R.showAlign !== !1,
@@ -1458,377 +1462,417 @@ const xr = /* @__PURE__ */ y.forwardRef(yr), kr = (e) => {
1458
1462
  width: R.width,
1459
1463
  maxWidth: R.maxWidth
1460
1464
  }),
1461
- [u, A, m, k, R]
1462
- ), b = H(() => ({ kind: "page", view: h, overrides: S, embed: R }), [h, S, R]), T = H(() => ({ kind: "page", fragment: p.hash, navigation: p }), [p]), C = $((O) => s.announce(O), [s]);
1463
- return /* @__PURE__ */ d(Lt, { path: e, display: E, navigation: b, fragment: T, paneScroll: _n, announces: !0, announceFailure: C, onDocumentShown: n });
1464
- }, Hr = ({ path: e, variant: t, onDocumentShown: n }) => {
1465
- const { config: r, viewSettings: o } = D(), s = fe((b) => b.style), l = fe((b) => b.align), [c, g] = I(() => Tt(r, void 0, s)), p = At(void 0, l), f = $((b) => o.update({ align: b }), [o]), { maximized: h, onDocumentLink: S, pendingHash: R, onHashConsumed: x, announceFailure: A, paneScroll: k } = t, u = H(
1465
+ [F, A, O, T, R]
1466
+ ), p = I(() => ({ kind: "page", view: g, overrides: b, embed: R }), [g, b, R]), S = I(() => ({ kind: "page", fragment: h.hash, navigation: h }), [h]), E = $((y) => l.announce(y), [l]);
1467
+ return /* @__PURE__ */ d($t, { path: e, display: u, navigation: p, fragment: S, paneScroll: In, announces: !0, announceFailure: E, onDocumentShown: n });
1468
+ }, Zr = ({ path: e, variant: t, onDocumentShown: n }) => {
1469
+ const { config: r, viewSettings: o } = D(), l = fe((p) => p.style), s = fe((p) => p.align), [a, f] = Z(() => Mt(r, void 0, l)), h = Ct(void 0, s), m = $((p) => o.update({ align: p }), [o]), { maximized: g, onDocumentLink: b, pendingHash: R, onHashConsumed: k, announceFailure: A, paneScroll: T } = t, F = I(
1466
1470
  () => ({
1467
- style: c,
1468
- onStyleChange: g,
1469
- align: p,
1470
- onAlignChange: f,
1471
- showToc: h,
1472
- showStyle: h,
1473
- showAlign: h,
1471
+ style: a,
1472
+ onStyleChange: f,
1473
+ align: h,
1474
+ onAlignChange: m,
1475
+ showToc: g,
1476
+ showStyle: g,
1477
+ showAlign: g,
1474
1478
  padding: void 0,
1475
1479
  width: void 0,
1476
1480
  maxWidth: void 0
1477
1481
  }),
1478
- [c, p, f, h]
1479
- ), m = H(() => ({ kind: "panel", onDocumentLink: S }), [S]), E = H(() => ({ kind: "panel", fragment: R, consume: x }), [R, x]);
1480
- return /* @__PURE__ */ d(Lt, { path: e, display: u, navigation: m, fragment: E, paneScroll: k, announces: !1, announceFailure: A, onDocumentShown: n });
1481
- }, Ir = ({ path: e, variant: t, onDocumentShown: n }) => t.kind === "page" ? /* @__PURE__ */ d(_r, { path: e, variant: t, onDocumentShown: n }) : /* @__PURE__ */ d(Hr, { path: e, variant: t, onDocumentShown: n }), Zr = ({ location: e }) => {
1482
- const { labels: t, documents: n, announcer: r } = D(), o = e.doc, s = H(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), l = $(() => n.peek(o), [n, o]), c = $(() => n.peekSeeded(o), [n, o]), g = le(n.subscribe, l, c), [p, f] = I(!1), [h, S] = I(null), R = z(!1), x = p || g?.status === "pending", A = $(async () => {
1483
- if (!(R.current || x)) {
1484
- R.current = !0, f(!0), S(null);
1482
+ [a, h, m, g]
1483
+ ), O = I(() => ({ kind: "panel", onDocumentLink: b }), [b]), u = I(() => ({ kind: "panel", fragment: R, consume: k }), [R, k]);
1484
+ return /* @__PURE__ */ d($t, { path: e, display: F, navigation: O, fragment: u, paneScroll: T, announces: !1, announceFailure: A, onDocumentShown: n });
1485
+ }, Ur = ({ path: e, variant: t, onDocumentShown: n }) => t.kind === "page" ? /* @__PURE__ */ d(Ir, { path: e, variant: t, onDocumentShown: n }) : /* @__PURE__ */ d(Zr, { path: e, variant: t, onDocumentShown: n });
1486
+ function Vr({
1487
+ title: e,
1488
+ titleId: t,
1489
+ ...n
1490
+ }, r) {
1491
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
1492
+ xmlns: "http://www.w3.org/2000/svg",
1493
+ viewBox: "0 0 24 24",
1494
+ fill: "currentColor",
1495
+ "aria-hidden": "true",
1496
+ "data-slot": "icon",
1497
+ ref: r,
1498
+ "aria-labelledby": t
1499
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
1500
+ id: t
1501
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
1502
+ fillRule: "evenodd",
1503
+ d: "M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z",
1504
+ clipRule: "evenodd"
1505
+ }));
1506
+ }
1507
+ const Wr = /* @__PURE__ */ x.forwardRef(Vr), Kr = /* @__PURE__ */ new Set(), Gr = (e, t) => {
1508
+ const { documents: n, announcer: r, labels: o } = D(), l = $(() => n.peek(e), [n, e]), s = $(() => n.peekSeeded(e), [n, e]), a = te(n.subscribe, l, s), f = $(() => n.answerStampOf(e), [n, e]), h = te(n.subscribe, f, f), [m] = Z(() => /* @__PURE__ */ new Set()), [g, b] = Z(Kr), [R, k] = Z(null);
1509
+ R !== null && R.path !== e && k(null);
1510
+ const A = H(null);
1511
+ V(() => (A.current = e, () => {
1512
+ A.current = null;
1513
+ }), [e]);
1514
+ const T = $(() => {
1515
+ const u = e, p = n.peek(u);
1516
+ if (m.has(u) || p?.status === "pending") return;
1517
+ const S = t && !kt(p);
1518
+ m.add(u), b(new Set(m)), k(null), (async () => {
1485
1519
  try {
1486
- const k = await n.refresh(o);
1487
- if (k.status === "failed") {
1488
- S({ path: o, failure: k.failure });
1520
+ const E = await n.refresh(u);
1521
+ if (A.current !== u || E.status === "superseded") return;
1522
+ if (E.status === "failed") {
1523
+ k({ path: u, failure: E.failure, stamp: n.answerStampOf(u) }), r.announce(o.documentRefreshFailed(pe(o, E.failure.reason)));
1489
1524
  return;
1490
1525
  }
1491
- if (k.status === "superseded") return;
1492
- const u = ge(n.peek(o));
1493
- if (u === null || u.document.kind === "failure") return;
1494
- r.announce(t.documentRefreshed(u.document.name));
1526
+ const y = ge(n.peek(u));
1527
+ if (S || y === null || y.document.kind === "failure") return;
1528
+ r.announce(o.documentRefreshed(y.document.name));
1495
1529
  } finally {
1496
- R.current = !1, f(!1);
1530
+ m.delete(u), b(new Set(m));
1497
1531
  }
1498
- }
1499
- }, [x, n, o, r, t]);
1500
- return /* @__PURE__ */ Z("div", { className: "aqmx-single", "data-testid": "markdown-explorer-single", children: [
1501
- /* @__PURE__ */ d("div", { className: "aqmx-single-toolbar", "data-testid": "markdown-explorer-single-toolbar", children: /* @__PURE__ */ Z(
1532
+ })();
1533
+ }, [e, t, m, n, r, o]), F = g.has(e), O = R !== null && R.path === e && R.stamp === h ? R.failure : null;
1534
+ return { refreshing: F, unavailable: F || a?.status === "pending", failure: O, refresh: T };
1535
+ }, Xr = Object.freeze({ kind: "page" }), Yr = (e) => {
1536
+ e.stopPropagation();
1537
+ }, Jr = ({ path: e, placement: t }) => {
1538
+ const { labels: n } = D(), { refreshing: r, unavailable: o, failure: l, refresh: s } = Gr(e, t.kind === "page"), a = t.kind === "panel" ? n.refreshDocumentNamed(t.documentName) : null;
1539
+ return /* @__PURE__ */ U("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", children: [
1540
+ /* @__PURE__ */ d("div", { className: "aqmx-document-refresh-row", children: /* @__PURE__ */ U(
1502
1541
  "button",
1503
1542
  {
1504
1543
  type: "button",
1505
- className: "aqmx-icon-button aqmx-labelled-button",
1506
- title: t.refreshDocument,
1507
- "aria-disabled": x,
1508
- "aria-busy": p,
1509
- "data-aqmx-busy": p ? "true" : void 0,
1510
- "data-testid": "markdown-explorer-single-refresh",
1511
- onClick: () => {
1512
- A();
1513
- },
1544
+ className: a === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
1545
+ title: a === null ? n.refreshDocument : a,
1546
+ "aria-label": a === null ? void 0 : a,
1547
+ "aria-disabled": o,
1548
+ "aria-busy": r,
1549
+ "data-aqmx-busy": r ? "true" : void 0,
1550
+ "data-testid": "markdown-explorer-document-refresh",
1551
+ onClick: s,
1552
+ onDoubleClick: Yr,
1514
1553
  children: [
1515
- /* @__PURE__ */ d(Sn, { "aria-hidden": "true" }),
1516
- /* @__PURE__ */ d("span", { children: t.refresh })
1554
+ /* @__PURE__ */ d(Wr, { "aria-hidden": "true" }),
1555
+ a === null ? /* @__PURE__ */ d("span", { children: n.refreshDocumentLabel }) : null
1517
1556
  ]
1518
1557
  }
1519
1558
  ) }),
1520
- h !== null && h.path === o ? /* @__PURE__ */ d("p", { role: "alert", className: "aqmx-single-refresh-failure", "data-testid": "markdown-explorer-single-refresh-failure", "data-aqmx-failure": h.failure.reason, children: t.documentRefreshFailed(qe(t, h.failure.reason)) }) : null,
1521
- /* @__PURE__ */ d(Ir, { path: o, variant: s })
1559
+ l === null ? null : /* @__PURE__ */ d("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": l.reason, children: n.documentRefreshFailed(pe(n, l.reason)) })
1560
+ ] });
1561
+ }, Qr = ({ location: e }) => {
1562
+ const t = e.doc, n = I(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]);
1563
+ return /* @__PURE__ */ U("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", children: [
1564
+ /* @__PURE__ */ d(Jr, { path: t, placement: Xr }),
1565
+ /* @__PURE__ */ d(Ur, { path: t, variant: n })
1522
1566
  ] });
1523
- }, Ur = ({ holds: e, testId: t }) => {
1524
- const { labels: n, announcer: r } = D(), o = Nt();
1525
- U(() => e ? r.claim(o) : void 0, [e, r, o]);
1526
- const s = $(() => r.shownIn(o), [r, o]), l = le(r.subscribe, s, s);
1527
- return /* @__PURE__ */ d("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: l.length > 1 ? n.announcementSequence(l) : l[0] });
1567
+ }, eo = ({ holds: e, testId: t }) => {
1568
+ const { labels: n, announcer: r } = D(), o = Pt();
1569
+ V(() => e ? r.claim(o) : void 0, [e, r, o]);
1570
+ const l = $(() => r.shownIn(o), [r, o]), s = te(r.subscribe, l, l);
1571
+ return /* @__PURE__ */ d("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: s.length > 1 ? n.announcementSequence(s) : s[0] });
1528
1572
  }, ee = Object.freeze([]), ot = (e) => {
1529
1573
  const t = /* @__PURE__ */ new Set();
1530
1574
  let n = ee, r = [], o = !1;
1531
- const s = [], l = (f) => {
1532
- n = f;
1533
- for (const h of [...t]) h();
1534
- }, c = () => s.at(-1)?.region, g = (f) => {
1535
- const h = c();
1536
- f(), c() !== h && n !== ee && l(ee);
1537
- }, p = () => {
1575
+ const l = [], s = (m) => {
1576
+ n = m;
1577
+ for (const g of [...t]) g();
1578
+ }, a = () => l.at(-1)?.region, f = (m) => {
1579
+ const g = a();
1580
+ m(), a() !== g && n !== ee && s(ee);
1581
+ }, h = () => {
1538
1582
  o = !1;
1539
- const f = r.map((h) => "sentence" in h ? h.sentence : h.list(h.items));
1540
- r = [], l(Object.freeze(f));
1583
+ const m = r.map((g) => "sentence" in g ? g.sentence : g.list(g.items));
1584
+ r = [], s(Object.freeze(m));
1541
1585
  };
1542
1586
  return {
1543
- announce: (f) => {
1544
- if (typeof f == "string") r.push({ sentence: f });
1587
+ announce: (m) => {
1588
+ if (typeof m == "string") r.push({ sentence: m });
1545
1589
  else {
1546
- const h = r.find((S) => "list" in S && S.list === f.list);
1547
- h !== void 0 && "items" in h ? h.items.push(f.item) : r.push({ list: f.list, items: [f.item] });
1590
+ const g = r.find((b) => "list" in b && b.list === m.list);
1591
+ g !== void 0 && "items" in g ? g.items.push(m.item) : r.push({ list: m.list, items: [m.item] });
1548
1592
  }
1549
- o || (o = !0, n !== ee && l(ee), e.request(p));
1593
+ o || (o = !0, n !== ee && s(ee), e.request(h));
1550
1594
  },
1551
- subscribe: (f) => (t.add(f), () => {
1552
- t.delete(f);
1595
+ subscribe: (m) => (t.add(m), () => {
1596
+ t.delete(m);
1553
1597
  }),
1554
- claim: (f) => {
1555
- const h = { region: f };
1556
- return g(() => s.push(h)), () => g(() => {
1557
- const S = s.indexOf(h);
1558
- S !== -1 && s.splice(S, 1);
1598
+ claim: (m) => {
1599
+ const g = { region: m };
1600
+ return f(() => l.push(g)), () => f(() => {
1601
+ const b = l.indexOf(g);
1602
+ b !== -1 && l.splice(b, 1);
1559
1603
  });
1560
1604
  },
1561
- shownIn: (f) => c() === f ? n : ee
1605
+ shownIn: (m) => a() === m ? n : ee
1562
1606
  };
1563
- }, Vr = Object.freeze({ status: "cancelled" }), Wr = (e) => {
1607
+ }, to = Object.freeze({ status: "cancelled" }), no = (e) => {
1564
1608
  if (e === null || typeof e != "object") return null;
1565
1609
  const { failure: t } = e;
1566
- if (Jt(t) !== null) return null;
1610
+ if (tn(t) !== null) return null;
1567
1611
  const { reason: n, code: r } = t;
1568
- return Qt(n, r);
1569
- }, Kr = ({ dataPath: e, onScope: t, fetch: n }) => {
1570
- const r = n ?? ((c, g) => globalThis.fetch(c, g)), o = (c, g) => `${e}/${c}?${new URLSearchParams(g).toString()}`, s = async (c, g, p, f) => {
1571
- let h;
1612
+ return nn(n, r);
1613
+ }, ro = ({ dataPath: e, onScope: t, fetch: n }) => {
1614
+ const r = n ?? ((a, f) => globalThis.fetch(a, f)), o = (a, f) => `${e}/${a}?${new URLSearchParams(f).toString()}`, l = async (a, f, h, m) => {
1615
+ let g;
1572
1616
  try {
1573
- h = await r(c, { credentials: "same-origin", ...g, headers: { Accept: "application/json", ...g.headers } });
1617
+ g = await r(a, { credentials: "same-origin", ...f, headers: { Accept: "application/json", ...f.headers } });
1574
1618
  } catch {
1575
- return f({ reason: "failed" });
1619
+ return m({ reason: "failed" });
1576
1620
  }
1577
- h.status === 401 && t(null);
1578
- const S = h.headers.get(Xt);
1579
- S !== null && t(S);
1621
+ g.status === 401 && t(null);
1622
+ const b = g.headers.get(Qt);
1623
+ b !== null && t(b);
1580
1624
  let R;
1581
1625
  try {
1582
- R = await h.json();
1626
+ R = await g.json();
1583
1627
  } catch {
1584
- return f({ reason: Ie(h.status) });
1628
+ return m({ reason: He(g.status) });
1585
1629
  }
1586
- let x;
1630
+ let k;
1587
1631
  try {
1588
- x = p(R);
1632
+ k = h(R);
1589
1633
  } catch {
1590
- x = !1;
1634
+ k = !1;
1591
1635
  }
1592
- if (x) return R;
1593
- const A = Wr(R);
1594
- return f(A !== null ? A : { reason: h.status === 200 ? "failed" : Ie(h.status) });
1595
- }, l = { [rn]: en };
1636
+ if (k) return R;
1637
+ const A = no(R);
1638
+ return m(A !== null ? A : { reason: g.status === 200 ? "failed" : He(g.status) });
1639
+ }, s = { [sn]: rn };
1596
1640
  return {
1597
- tree: (c) => s(o("tree", { [re.source]: c }), { method: "GET" }, Ze, (g) => ({ status: "error", failure: g })),
1598
- children: async (c, g, p) => {
1599
- const f = await s(o("children", { [re.source]: c, [re.path]: g }), { method: "GET", signal: p }, Yt, (h) => ({ status: "error", failure: h }));
1600
- return p.aborted ? Vr : f;
1641
+ tree: (a) => l(o("tree", { [oe.source]: a }), { method: "GET" }, Ie, (f) => ({ status: "error", failure: f })),
1642
+ children: async (a, f, h) => {
1643
+ const m = await l(o("children", { [oe.source]: a, [oe.path]: f }), { method: "GET", signal: h }, en, (g) => ({ status: "error", failure: g }));
1644
+ return h.aborted ? to : m;
1601
1645
  },
1602
- document: (c, { refresh: g }) => s(o("document", { [re.path]: c }), g ? { method: "GET", headers: l } : { method: "GET" }, nn, (p) => tn(p.reason, p.code)),
1603
- refresh: (c) => s(o("refresh", { [re.source]: c }), { method: "POST", headers: l }, Ze, (g) => ({ status: "error", failure: g }))
1646
+ document: (a, { refresh: f }) => l(o("document", { [oe.path]: a }), f ? { method: "GET", headers: s } : { method: "GET" }, ln, (h) => on(h.reason, h.code)),
1647
+ refresh: (a) => l(o("refresh", { [oe.source]: a }), { method: "POST", headers: s }, Ie, (f) => ({ status: "error", failure: f }))
1604
1648
  };
1605
- }, Gr = (e) => {
1606
- const t = sn(e);
1607
- if (t === null) return He;
1649
+ }, oo = (e) => {
1650
+ const t = dn(e);
1651
+ if (t === null) return ze;
1608
1652
  try {
1609
- return Ut(JSON.parse(t));
1653
+ return Kt(JSON.parse(t));
1610
1654
  } catch (n) {
1611
- return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), He;
1655
+ return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), ze;
1612
1656
  }
1613
1657
  }, lt = (e, t) => {
1614
1658
  let n = null;
1615
1659
  const r = () => {
1616
1660
  if (n === null) {
1617
- const s = Gr(e);
1618
- n = { changes: s, settings: _e(t, s) };
1661
+ const l = oo(e);
1662
+ n = { changes: l, settings: Be(t, l) };
1619
1663
  }
1620
1664
  return n;
1621
- }, o = pe();
1665
+ }, o = we();
1622
1666
  return {
1623
1667
  storageKey: e,
1624
1668
  defaults: t,
1625
1669
  getSnapshot: () => r().settings,
1626
1670
  getServerSnapshot: () => t,
1627
1671
  subscribe: o.subscribe,
1628
- advance: (s) => {
1629
- const { changes: l, settings: c } = r(), g = Ht(l, s, It(c, s)[s], t);
1630
- return n = { changes: g, settings: _e(t, g) }, o.emit(), ln(e, Zt(g)), n.settings;
1672
+ advance: (l) => {
1673
+ const { changes: s, settings: a } = r(), f = Ut(s, l, Vt(a, l)[l], t);
1674
+ return n = { changes: f, settings: Be(t, f) }, o.emit(), cn(e, Wt(f)), n.settings;
1631
1675
  }
1632
1676
  };
1633
- }, Xr = Object.freeze({ status: "refreshed" }), Yr = Object.freeze({ status: "superseded" }), $e = Object.freeze({ status: "deferred" }), Jr = yt($e), Mt = 4, Qr = Mt - 1, it = Object.freeze({ status: "loading" }), eo = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), to = (e) => {
1634
- const t = /* @__PURE__ */ new Map(), n = St(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), c = pe(), g = /* @__PURE__ */ new Set();
1635
- let p = 0, f = 0;
1636
- const h = { direct: null, bulk: null }, S = /* @__PURE__ */ new Set();
1637
- let R = !1, x = 0;
1677
+ }, lo = Object.freeze({ status: "refreshed" }), io = Object.freeze({ status: "superseded" }), Ne = Object.freeze({ status: "deferred" }), so = xt(Ne), Dt = 4, ao = Dt - 1, it = Object.freeze({ status: "loading" }), co = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), uo = (e) => {
1678
+ const t = /* @__PURE__ */ new Map(), n = yt(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = we(), f = /* @__PURE__ */ new Set();
1679
+ let h = 0, m = 0;
1680
+ const g = { direct: null, bulk: null }, b = /* @__PURE__ */ new Set();
1681
+ let R = !1, k = 0;
1638
1682
  const A = () => {
1639
- x += 1, c.emit();
1640
- }, k = (i) => o.get(i) ?? 0, u = (i) => {
1641
- let a = l.get(i);
1642
- return a === void 0 && (a = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, l.set(i, a)), a;
1643
- }, m = (i, a, w) => {
1644
- i.inFlight.delete(a), p -= 1, w.lane === "bulk" && (f -= 1);
1645
- }, E = (i) => {
1646
- const a = l.get(i);
1647
- if (a !== void 0) {
1648
- for (const [w, v] of [...a.inFlight])
1649
- m(a, w, v), v.controller.abort();
1650
- a.direct.clear(), a.bulk.clear(), a.unclaimed.clear();
1683
+ k += 1, a.emit();
1684
+ }, T = (i) => o.get(i) ?? 0, F = (i) => {
1685
+ let c = s.get(i);
1686
+ return c === void 0 && (c = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, s.set(i, c)), c;
1687
+ }, O = (i, c, w) => {
1688
+ i.inFlight.delete(c), h -= 1, w.lane === "bulk" && (m -= 1);
1689
+ }, u = (i) => {
1690
+ const c = s.get(i);
1691
+ if (c !== void 0) {
1692
+ for (const [w, v] of [...c.inFlight])
1693
+ O(c, w, v), v.controller.abort();
1694
+ c.direct.clear(), c.bulk.clear(), c.unclaimed.clear();
1651
1695
  }
1652
- }, b = (i) => {
1653
- const a = k(i) + 1;
1654
- return o.set(i, a), E(i), a;
1655
- }, T = (i, a) => {
1656
- const w = ae(i), v = { promise: i, opened: a, stale: !1, loadedAt: w?.status === "ok" ? w.loadedAt : null };
1696
+ }, p = (i) => {
1697
+ const c = T(i) + 1;
1698
+ return o.set(i, c), u(i), c;
1699
+ }, S = (i, c) => {
1700
+ const w = ae(i), v = { promise: i, opened: c, stale: !1, loadedAt: w?.status === "ok" ? w.loadedAt : null };
1657
1701
  return i.status === "pending" && i.then((L) => {
1658
1702
  L.status === "ok" && (v.loadedAt = L.loadedAt);
1659
1703
  }), v;
1660
- }, C = (i) => {
1661
- let a = r.get(i);
1662
- return a === void 0 && (a = /* @__PURE__ */ new Map(), r.set(i, a)), a;
1663
- }, O = (i) => {
1664
- const a = [...l.keys()], w = h[i], v = w === null ? 0 : a.indexOf(w) + 1;
1665
- for (let L = 0; L < a.length; L += 1) {
1666
- const M = a[(v + L) % a.length], q = M === void 0 ? void 0 : l.get(M);
1667
- if (!(M === void 0 || q === void 0)) {
1668
- for (const j of q[i])
1669
- if ((q.claims.get(j) ?? 0) !== 0)
1670
- return q[i].delete(j), h[i] = M, { sourceId: M, path: j };
1704
+ }, E = (i) => {
1705
+ let c = r.get(i);
1706
+ return c === void 0 && (c = /* @__PURE__ */ new Map(), r.set(i, c)), c;
1707
+ }, y = (i) => {
1708
+ const c = [...s.keys()], w = g[i], v = w === null ? 0 : c.indexOf(w) + 1;
1709
+ for (let L = 0; L < c.length; L += 1) {
1710
+ const N = c[(v + L) % c.length], _ = N === void 0 ? void 0 : s.get(N);
1711
+ if (!(N === void 0 || _ === void 0)) {
1712
+ for (const B of _[i])
1713
+ if ((_.claims.get(B) ?? 0) !== 0)
1714
+ return _[i].delete(B), g[i] = N, { sourceId: N, path: B };
1671
1715
  }
1672
1716
  }
1673
1717
  return null;
1674
- }, N = (i, a, w, v) => {
1675
- const L = l.get(i);
1676
- if (L === void 0 || L.inFlight.get(a) !== w) return;
1677
- m(L, a, w);
1678
- const M = (L.claims.get(a) ?? 0) > 0, q = C(i);
1679
- if (v.status === "ok" ? q.set(a, { status: "loaded", entries: v.entries }) : v.status === "error" && M ? q.set(a, { status: "failed", failure: v.failure }) : q.delete(a), A(), v.status === "error" && M) {
1680
- const j = { sourceId: i, path: a, failure: v.failure };
1681
- for (const G of [...g]) G(j);
1718
+ }, P = (i, c, w, v) => {
1719
+ const L = s.get(i);
1720
+ if (L === void 0 || L.inFlight.get(c) !== w) return;
1721
+ O(L, c, w);
1722
+ const N = (L.claims.get(c) ?? 0) > 0, _ = E(i);
1723
+ if (v.status === "ok" ? _.set(c, { status: "loaded", entries: v.entries }) : v.status === "error" && N ? _.set(c, { status: "failed", failure: v.failure }) : _.delete(c), A(), v.status === "error" && N) {
1724
+ const B = { sourceId: i, path: c, failure: v.failure };
1725
+ for (const G of [...f]) G(B);
1682
1726
  }
1683
- B();
1684
- }, P = (i, a, w) => {
1727
+ M();
1728
+ }, z = (i, c, w) => {
1685
1729
  const v = { controller: new AbortController(), lane: w };
1686
- u(i).inFlight.set(a, v), p += 1, w === "bulk" && (f += 1), e.children(i, a, v.controller.signal).then(
1687
- (L) => N(i, a, v, L),
1688
- () => N(i, a, v, eo)
1730
+ F(i).inFlight.set(c, v), h += 1, w === "bulk" && (m += 1), e.children(i, c, v.controller.signal).then(
1731
+ (L) => P(i, c, v, L),
1732
+ () => P(i, c, v, co)
1689
1733
  );
1690
- }, B = () => {
1691
- for (; p < Mt; ) {
1692
- const i = O("direct");
1734
+ }, M = () => {
1735
+ for (; h < Dt; ) {
1736
+ const i = y("direct");
1693
1737
  if (i !== null) {
1694
- P(i.sourceId, i.path, "direct");
1738
+ z(i.sourceId, i.path, "direct");
1695
1739
  continue;
1696
1740
  }
1697
- const a = f < Qr ? O("bulk") : null;
1698
- if (a === null) return;
1699
- P(a.sourceId, a.path, "bulk");
1741
+ const c = m < ao ? y("bulk") : null;
1742
+ if (c === null) return;
1743
+ z(c.sourceId, c.path, "bulk");
1700
1744
  }
1701
- }, V = (i, a, w) => {
1702
- if (!(a.direct.delete(w) || a.bulk.delete(w))) {
1703
- const L = a.inFlight.get(w);
1745
+ }, j = (i, c, w) => {
1746
+ if (!(c.direct.delete(w) || c.bulk.delete(w))) {
1747
+ const L = c.inFlight.get(w);
1704
1748
  if (L === void 0) return !1;
1705
- m(a, w, L), L.controller.abort();
1749
+ O(c, w, L), L.controller.abort();
1706
1750
  }
1707
1751
  return r.get(i)?.delete(w), !0;
1708
- }, F = () => {
1752
+ }, C = () => {
1709
1753
  R = !1;
1710
1754
  let i = !1;
1711
- for (const a of S) {
1712
- const w = u(a);
1755
+ for (const c of b) {
1756
+ const w = F(c);
1713
1757
  for (const v of w.unclaimed)
1714
- (w.claims.get(v) ?? 0) === 0 && V(a, w, v) && (i = !0);
1758
+ (w.claims.get(v) ?? 0) === 0 && j(c, w, v) && (i = !0);
1715
1759
  w.unclaimed.clear();
1716
1760
  }
1717
- S.clear(), i && (A(), B());
1718
- }, _ = (i, a) => {
1719
- t.set(i, T(ie(e.tree(i)), a));
1720
- }, J = (i, a, w) => {
1721
- b(i);
1722
- const v = T(yt(a), w);
1723
- return t.set(i, v), r.delete(i), A(), B(), v;
1724
- }, ne = (i, a, w, v) => {
1725
- if (w !== k(i) || t.get(i) !== a) return;
1726
- const L = ae(a.promise);
1727
- if (!(v.status !== "ok" || L?.status !== "ok" || a.loadedAt === null || v.loadedAt <= a.loadedAt)) {
1761
+ b.clear(), i && (A(), M());
1762
+ }, q = (i, c) => {
1763
+ t.set(i, S(ie(e.tree(i)), c));
1764
+ }, J = (i, c, w) => {
1765
+ p(i);
1766
+ const v = S(xt(c), w);
1767
+ return t.set(i, v), r.delete(i), A(), M(), v;
1768
+ }, re = (i, c, w, v) => {
1769
+ if (w !== T(i) || t.get(i) !== c) return;
1770
+ const L = ae(c.promise);
1771
+ if (!(v.status !== "ok" || L?.status !== "ok" || c.loadedAt === null || v.loadedAt <= c.loadedAt)) {
1728
1772
  if (me(L.entries, v.entries)) {
1729
- a.loadedAt = v.loadedAt;
1773
+ c.loadedAt = v.loadedAt;
1730
1774
  return;
1731
1775
  }
1732
- J(i, v, a.opened);
1776
+ J(i, v, c.opened);
1733
1777
  }
1734
- }, K = (i, a) => {
1778
+ }, K = (i, c) => {
1735
1779
  const w = t.get(i);
1736
- return w !== void 0 && ae(w.promise)?.status === a;
1737
- }, xe = (i, a) => {
1738
- a.stale = !1;
1739
- const w = k(i);
1740
- e.tree(i).then((v) => ne(i, a, w, v));
1780
+ return w !== void 0 && ae(w.promise)?.status === c;
1781
+ }, xe = (i, c) => {
1782
+ c.stale = !1;
1783
+ const w = T(i);
1784
+ e.tree(i).then((v) => re(i, c, w, v));
1741
1785
  };
1742
1786
  return {
1743
- read: (i) => t.get(i)?.promise ?? Jr,
1787
+ read: (i) => t.get(i)?.promise ?? so,
1744
1788
  open: (i) => {
1745
- const a = n.resumes(i), w = n.hold(i), v = t.get(i);
1746
- return v === void 0 || K(i, "deferred") ? (_(i, !0), A()) : a || (v.opened && K(i, "error") ? (_(i, !0), A()) : (v.opened = !0, v.stale && K(i, "ok") && xe(i, v))), w;
1789
+ const c = n.resumes(i), w = n.hold(i), v = t.get(i);
1790
+ return v === void 0 || K(i, "deferred") ? (q(i, !0), A()) : c || (v.opened && K(i, "error") ? (q(i, !0), A()) : (v.opened = !0, v.stale && K(i, "ok") && xe(i, v))), w;
1747
1791
  },
1748
1792
  retry: (i) => {
1749
- K(i, "error") && (_(i, !0), A());
1793
+ K(i, "error") && (q(i, !0), A());
1750
1794
  },
1751
- seed: (i, a) => {
1752
- const w = a.then(
1753
- (M) => M === null ? $e : M,
1754
- () => $e
1795
+ seed: (i, c) => {
1796
+ const w = c.then(
1797
+ (N) => N === null ? Ne : N,
1798
+ () => Ne
1755
1799
  ), v = t.get(i);
1756
1800
  if (v !== void 0 && K(i, "ok")) {
1757
- const M = k(i);
1758
- w.then((q) => ne(i, v, M, q));
1801
+ const N = T(i);
1802
+ w.then((_) => re(i, v, N, _));
1759
1803
  return;
1760
1804
  }
1761
- b(i);
1762
- const L = T(ie(w), v?.opened === !0);
1763
- t.set(i, L), r.delete(i), B(), w.then((M) => {
1764
- t.get(i) === L && (M.status === "deferred" && n.isHeld(i) && _(i, L.opened), A());
1805
+ p(i);
1806
+ const L = S(ie(w), v?.opened === !0);
1807
+ t.set(i, L), r.delete(i), M(), w.then((N) => {
1808
+ t.get(i) === L && (N.status === "deferred" && n.isHeld(i) && q(i, L.opened), A());
1765
1809
  });
1766
1810
  },
1767
1811
  refresh: async (i) => {
1768
- const a = (s.get(i) ?? 0) + 1;
1769
- s.set(i, a);
1812
+ const c = (l.get(i) ?? 0) + 1;
1813
+ l.set(i, c);
1770
1814
  const w = await e.refresh(i);
1771
- if (s.get(i) !== a) return Yr;
1815
+ if (l.get(i) !== c) return io;
1772
1816
  if (w.status === "error") return { status: "failed", failure: w.failure };
1773
1817
  const v = t.get(i);
1774
1818
  if (!(v !== void 0 && v.loadedAt !== null && K(i, "ok") && v.loadedAt > w.loadedAt)) {
1775
- const M = J(i, w, !0);
1819
+ const N = J(i, w, !0);
1776
1820
  if (v !== void 0 && v.promise.status === "pending") {
1777
- const q = k(i);
1778
- v.promise.then((j) => ne(i, M, q, j));
1821
+ const _ = T(i);
1822
+ v.promise.then((B) => re(i, N, _, B));
1779
1823
  }
1780
1824
  }
1781
- for (const [M, q] of t)
1782
- M !== i && ae(q.promise)?.status === "ok" && (q.stale = !0);
1783
- return Xr;
1825
+ for (const [N, _] of t)
1826
+ N !== i && ae(_.promise)?.status === "ok" && (_.stale = !0);
1827
+ return lo;
1784
1828
  },
1785
- children: (i, a) => r.get(i)?.get(a),
1786
- claimChildren: (i, a) => {
1787
- const w = u(i), v = C(i);
1788
- let L = !1, M = !1;
1789
- for (const [j, G] of a)
1790
- w.claims.set(j, (w.claims.get(j) ?? 0) + 1), v.get(j) === void 0 ? (v.set(j, it), w[G].add(j), L = !0, M = !0) : G === "direct" && w.bulk.delete(j) && (w.direct.add(j), M = !0);
1791
- L && A(), M && B();
1792
- let q = !1;
1829
+ children: (i, c) => r.get(i)?.get(c),
1830
+ claimChildren: (i, c) => {
1831
+ const w = F(i), v = E(i);
1832
+ let L = !1, N = !1;
1833
+ for (const [B, G] of c)
1834
+ w.claims.set(B, (w.claims.get(B) ?? 0) + 1), v.get(B) === void 0 ? (v.set(B, it), w[G].add(B), L = !0, N = !0) : G === "direct" && w.bulk.delete(B) && (w.direct.add(B), N = !0);
1835
+ L && A(), N && M();
1836
+ let _ = !1;
1793
1837
  return () => {
1794
- if (!q) {
1795
- q = !0;
1796
- for (const j of a.keys()) {
1797
- const G = (w.claims.get(j) ?? 0) - 1;
1798
- G > 0 ? w.claims.set(j, G) : (w.claims.delete(j), w.unclaimed.add(j));
1838
+ if (!_) {
1839
+ _ = !0;
1840
+ for (const B of c.keys()) {
1841
+ const G = (w.claims.get(B) ?? 0) - 1;
1842
+ G > 0 ? w.claims.set(B, G) : (w.claims.delete(B), w.unclaimed.add(B));
1799
1843
  }
1800
- S.add(i), !R && (R = !0, queueMicrotask(F));
1844
+ b.add(i), !R && (R = !0, queueMicrotask(C));
1801
1845
  }
1802
1846
  };
1803
1847
  },
1804
- retryChildren: (i, a) => {
1848
+ retryChildren: (i, c) => {
1805
1849
  const w = r.get(i);
1806
- if (w === void 0 || w.get(a)?.status !== "failed") return;
1807
- const v = u(i);
1808
- if ((v.claims.get(a) ?? 0) > 0) {
1809
- w.set(a, it), v.direct.add(a), A(), B();
1850
+ if (w === void 0 || w.get(c)?.status !== "failed") return;
1851
+ const v = F(i);
1852
+ if ((v.claims.get(c) ?? 0) > 0) {
1853
+ w.set(c, it), v.direct.add(c), A(), M();
1810
1854
  return;
1811
1855
  }
1812
- w.delete(a), A();
1856
+ w.delete(c), A();
1813
1857
  },
1814
1858
  pendingChildren: (i) => {
1815
- const a = l.get(i);
1816
- return a === void 0 ? 0 : a.direct.size + a.bulk.size + a.inFlight.size;
1859
+ const c = s.get(i);
1860
+ return c === void 0 ? 0 : c.direct.size + c.bulk.size + c.inFlight.size;
1817
1861
  },
1818
1862
  clear: () => {
1819
- for (const i of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...l.keys()])) b(i);
1820
- for (const [i, a] of s) s.set(i, a + 1);
1863
+ for (const i of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...s.keys()])) p(i);
1864
+ for (const [i, c] of l) l.set(i, c + 1);
1821
1865
  t.clear(), r.clear(), A();
1822
1866
  },
1823
- subscribeChildrenFailures: (i) => (g.add(i), () => {
1824
- g.delete(i);
1867
+ subscribeChildrenFailures: (i) => (f.add(i), () => {
1868
+ f.delete(i);
1825
1869
  }),
1826
- subscribe: c.subscribe,
1827
- version: () => x
1870
+ subscribe: a.subscribe,
1871
+ version: () => k
1828
1872
  };
1829
- }, no = (e, t) => {
1873
+ }, fo = (e, t) => {
1830
1874
  let n = e;
1831
- const r = pe();
1875
+ const r = we();
1832
1876
  return {
1833
1877
  getSnapshot: () => n,
1834
1878
  subscribe: r.subscribe,
@@ -1836,102 +1880,102 @@ const xr = /* @__PURE__ */ y.forwardRef(yr), kr = (e) => {
1836
1880
  n = { ...n, ...o }, t(n), r.emit();
1837
1881
  }
1838
1882
  };
1839
- }, ro = 1;
1883
+ }, mo = 1;
1840
1884
  let ce = 0, X = null;
1841
- const oo = () => {
1885
+ const go = () => {
1842
1886
  const { documentElement: e, body: t } = document;
1843
1887
  ce === 0 && (X = { htmlOverflow: e.style.overflow, bodyOverflow: t.style.overflow, htmlGutter: e.style.scrollbarGutter, bodyGutter: t.style.scrollbarGutter }, e.style.overflow = "hidden", t.style.overflow = "hidden", e.style.scrollbarGutter = "auto", t.style.scrollbarGutter = "auto"), ce += 1;
1844
1888
  let n = !1;
1845
1889
  return () => {
1846
1890
  n || (n = !0, ce -= 1, !(ce > 0 || X === null) && (e.style.overflow = X.htmlOverflow, t.style.overflow = X.bodyOverflow, e.style.scrollbarGutter = X.htmlGutter, t.style.scrollbarGutter = X.bodyGutter, X = null));
1847
1891
  };
1848
- }, lo = [
1892
+ }, ho = [
1849
1893
  { selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
1850
1894
  { selector: "[data-aqmx-explorer-body]", name: "tree area" }
1851
- ], st = 1, at = (e) => e.getClientRects().length > 0, Re = "Give the explorer's container a definite block size (for example height: 100dvh, or a flex column of definite height whose item has flex: 1 and min-height: 0; in a fresh React Router app also html and body at height: 100%) instead of an auto or only a minimum height.", io = (e) => {
1895
+ ], st = 1, at = (e) => e.getClientRects().length > 0, Re = "Give the explorer's container a definite block size (for example height: 100dvh, or a flex column of definite height whose item has flex: 1 and min-height: 0; in a fresh React Router app also html and body at height: 100%) instead of an auto or only a minimum height.", po = (e) => {
1852
1896
  if (!at(e)) return null;
1853
1897
  const t = e.getBoundingClientRect(), n = window.innerHeight;
1854
- if (t.bottom > n + ro)
1898
+ if (t.bottom > n + mo)
1855
1899
  return `[markdown-explorer] the explorer ends ${String(Math.round(t.bottom))}px down a ${String(n)}px viewport while lockDocumentScroll stops the page from scrolling, so the rest cannot be reached. ${Re}`;
1856
1900
  if (t.height < st)
1857
1901
  return `[markdown-explorer] the explorer collapsed to ${String(Math.round(t.height))}px while lockDocumentScroll stops the page from scrolling, so nothing can be read. ${Re}`;
1858
- for (const { selector: r, name: o } of lo)
1859
- for (const s of e.querySelectorAll(r)) {
1860
- if (!at(s)) continue;
1861
- const l = s.getBoundingClientRect().height;
1862
- if (l < st)
1863
- return `[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(l))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Re}`;
1902
+ for (const { selector: r, name: o } of ho)
1903
+ for (const l of e.querySelectorAll(r)) {
1904
+ if (!at(l)) continue;
1905
+ const s = l.getBoundingClientRect().height;
1906
+ if (s < st)
1907
+ return `[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(s))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Re}`;
1864
1908
  }
1865
1909
  return null;
1866
- }, so = (e) => {
1910
+ }, wo = (e) => {
1867
1911
  let t = !1;
1868
1912
  const n = () => {
1869
1913
  if (t) return;
1870
- const o = io(e);
1914
+ const o = po(e);
1871
1915
  o !== null && (t = !0, console.error(o));
1872
1916
  }, r = typeof ResizeObserver > "u" ? null : new ResizeObserver(n);
1873
1917
  return r?.observe(e), window.addEventListener("resize", n), n(), () => {
1874
1918
  r?.disconnect(), window.removeEventListener("resize", n);
1875
1919
  };
1876
- }, ao = (e, t) => {
1877
- Y(() => e ? oo() : void 0, [e]), Y(() => {
1920
+ }, vo = (e, t) => {
1921
+ Y(() => e ? go() : void 0, [e]), Y(() => {
1878
1922
  const n = t.current;
1879
1923
  if (!(!e || n === null))
1880
- return so(n);
1924
+ return wo(n);
1881
1925
  }, [e, t]);
1882
- }, ct = '[data-testid="markdown-explorer-view-switch"]', co = [
1926
+ }, ct = '[data-testid="markdown-explorer-view-switch"]', bo = [
1883
1927
  { control: ct, successors: [ct, '[data-testid="markdown-explorer-sheet-toggle"]'] },
1884
1928
  { control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
1885
- ], uo = (e) => {
1886
- for (const t of co) {
1929
+ ], Eo = (e) => {
1930
+ for (const t of bo) {
1887
1931
  const n = e.closest(t.control);
1888
1932
  if (n !== null) return { element: n, control: t };
1889
1933
  }
1890
1934
  return null;
1891
- }, fo = (e, t) => {
1892
- const n = z(null);
1935
+ }, So = (e, t) => {
1936
+ const n = H(null);
1893
1937
  Y(() => {
1894
- const o = (c) => {
1895
- const g = e.current;
1896
- n.current = g !== null && c instanceof Element && g.contains(c) ? uo(c) : null;
1897
- }, s = (c) => o(c.target);
1938
+ const o = (a) => {
1939
+ const f = e.current;
1940
+ n.current = f !== null && a instanceof Element && f.contains(a) ? Eo(a) : null;
1941
+ }, l = (a) => o(a.target);
1898
1942
  o(document.activeElement);
1899
- const l = (c) => {
1900
- const g = c.target;
1901
- c.relatedTarget !== null || !(g instanceof Element) || queueMicrotask(() => {
1902
- n.current?.element === g && g.isConnected && document.activeElement !== g && (n.current = null);
1943
+ const s = (a) => {
1944
+ const f = a.target;
1945
+ a.relatedTarget !== null || !(f instanceof Element) || queueMicrotask(() => {
1946
+ n.current?.element === f && f.isConnected && document.activeElement !== f && (n.current = null);
1903
1947
  });
1904
1948
  };
1905
- return document.addEventListener("focusin", s), document.addEventListener("focusout", l), () => {
1906
- document.removeEventListener("focusin", s), document.removeEventListener("focusout", l);
1949
+ return document.addEventListener("focusin", l), document.addEventListener("focusout", s), () => {
1950
+ document.removeEventListener("focusin", l), document.removeEventListener("focusout", s);
1907
1951
  };
1908
1952
  }, [e]);
1909
- const r = z(t);
1910
- U(() => {
1953
+ const r = H(t);
1954
+ V(() => {
1911
1955
  if (r.current === t) return;
1912
1956
  r.current = t;
1913
1957
  const o = n.current;
1914
1958
  if (o === null) return;
1915
- const s = () => {
1916
- const g = document.activeElement;
1917
- if (g !== null && g !== document.body && g !== o.element) return !0;
1918
- const p = e.current;
1919
- if (p === null) return !0;
1920
- for (const f of o.control.successors)
1921
- for (const h of p.querySelectorAll(f))
1922
- if (h !== o.element && (h.focus({ preventScroll: !0 }), document.activeElement === h))
1959
+ const l = () => {
1960
+ const f = document.activeElement;
1961
+ if (f !== null && f !== document.body && f !== o.element) return !0;
1962
+ const h = e.current;
1963
+ if (h === null) return !0;
1964
+ for (const m of o.control.successors)
1965
+ for (const g of h.querySelectorAll(m))
1966
+ if (g !== o.element && (g.focus({ preventScroll: !0 }), document.activeElement === g))
1923
1967
  return !0;
1924
1968
  return !1;
1925
1969
  };
1926
- if (s()) return;
1927
- const l = e.current;
1928
- if (l === null) return;
1929
- const c = new MutationObserver(() => {
1930
- s() && c.disconnect();
1970
+ if (l()) return;
1971
+ const s = e.current;
1972
+ if (s === null) return;
1973
+ const a = new MutationObserver(() => {
1974
+ l() && a.disconnect();
1931
1975
  });
1932
- return c.observe(l, { childList: !0, subtree: !0 }), () => c.disconnect();
1976
+ return a.observe(s, { childList: !0, subtree: !0 }), () => a.disconnect();
1933
1977
  }, [t, e]);
1934
- }, mo = ft(() => import("./TreeLayout-CW7lgV_e.js").then((e) => ({ default: e.TreeLayout }))), go = ft(() => import("./MultiLayout-DxPiARsv.js").then((e) => ({ default: e.MultiLayout }))), ho = 64, dt = {
1978
+ }, yo = ft(() => import("./TreeLayout-BoyFelK2.js").then((e) => ({ default: e.TreeLayout }))), xo = ft(() => import("./MultiLayout-DCPDu1-l.js").then((e) => ({ default: e.MultiLayout }))), ko = 64, dt = {
1935
1979
  request: (e) => {
1936
1980
  requestAnimationFrame(e);
1937
1981
  }
@@ -1940,122 +1984,124 @@ const oo = () => {
1940
1984
  }, Te = (e, t) => {
1941
1985
  t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
1942
1986
  for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
1943
- }, po = (e, t) => {
1944
- const [n, r] = I(() => ({ overrides: t, locale: e, labels: We(e, t) }));
1945
- if (n.locale === e && vn(n.overrides, t)) return n.labels;
1946
- const o = { overrides: t, locale: e, labels: We(e, t) };
1987
+ }, Ro = (e, t) => {
1988
+ const [n, r] = Z(() => ({ overrides: t, locale: e, labels: Ve(e, t) }));
1989
+ if (n.locale === e && Sn(n.overrides, t)) return n.labels;
1990
+ const o = { overrides: t, locale: e, labels: Ve(e, t) };
1947
1991
  return r(o), o.labels;
1948
- }, wo = (e, t, n) => {
1949
- const [r, o] = I(() => ({ scope: t, store: lt(e, n) }));
1992
+ }, To = (e, t, n) => {
1993
+ const [r, o] = Z(() => ({ scope: t, store: lt(e, n) }));
1950
1994
  if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
1951
- const s = { scope: t, store: lt(e, n) };
1952
- return o(s), s.store;
1953
- }, vo = (e) => {
1954
- const [t, n] = I(() => ({ scope: e, announcer: ot(dt) }));
1995
+ const l = { scope: t, store: lt(e, n) };
1996
+ return o(l), l.store;
1997
+ }, Ao = (e) => {
1998
+ const [t, n] = Z(() => ({ scope: e, announcer: ot(dt) }));
1955
1999
  if (t.scope === e) return t.announcer;
1956
2000
  const r = { scope: e, announcer: ot(dt) };
1957
2001
  return n(r), r.announcer;
1958
- }, Co = ({ data: e, config: t, storageNamespace: n, locale: r, labels: o, theme: s, renderFrame: l, renderTreeFailure: c, lockDocumentScroll: g = !1, onMathDiagnostics: p }) => {
1959
- an(n);
1960
- const f = wt(r), h = bn(s), S = po(f, o), { revalidate: R } = jt(), x = z(() => {
1961
- }), A = he(t.dataPath), [k] = I(() => {
1962
- const F = Kr({ dataPath: A, onScope: (J) => x.current(J) }), _ = { documents: On({ client: F, capacity: Math.max(ho, t.multiView.maxPanels * 2) }), trees: to(F) };
1963
- return Te(_, e), Ue(n, e.scope), { data: F, ..._, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
2002
+ }, Bo = ({ data: e, config: t, storageNamespace: n, locale: r, labels: o, theme: l, renderFrame: s, renderTreeFailure: a, lockDocumentScroll: f = !1, onMathDiagnostics: h }) => {
2003
+ un(n);
2004
+ const m = vt(r), g = yn(l), b = Ro(m, o), { revalidate: R } = zt(), k = H(() => {
2005
+ }), A = he(t.dataPath), [T] = Z(() => {
2006
+ const C = ro({ dataPath: A, onScope: (J) => k.current(J) }), q = { documents: Ln({ client: C, capacity: Math.max(ko, t.multiView.maxPanels * 2) }), trees: uo(C) };
2007
+ return Te(q, e), Ze(n, e.scope), { data: C, ...q, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
1964
2008
  });
1965
- if (k.aligned.pageData !== e || k.aligned.storageNamespace !== n) {
1966
- const F = k.aligned.pageData;
1967
- k.aligned.pageData = e, k.aligned.storageNamespace = n, F !== e && (F.scope !== e.scope ? k.aligned.pendingReader = e : Te(k, e)), Ue(n, e.scope);
2009
+ if (T.aligned.pageData !== e || T.aligned.storageNamespace !== n) {
2010
+ const C = T.aligned.pageData;
2011
+ T.aligned.pageData = e, T.aligned.storageNamespace = n, C !== e && (C.scope !== e.scope ? T.aligned.pendingReader = e : Te(T, e)), Ze(n, e.scope);
1968
2012
  }
1969
- const u = wo(cn(n).treeSettings, e.scope, t.defaultTreeSettings);
1970
- U(() => {
1971
- const F = k.aligned.pendingReader;
1972
- F !== null && (k.aligned.pendingReader = null, ut(k), Te(k, F));
1973
- }, [e, k]), U(() => {
1974
- let F = !1;
1975
- return x.current = (_) => {
1976
- _ === e.scope || F || (F = !0, _ !== null && (ut(k), dn(n)), R());
2013
+ const F = To(fn(n).treeSettings, e.scope, t.defaultTreeSettings);
2014
+ V(() => {
2015
+ const C = T.aligned.pendingReader;
2016
+ C !== null && (T.aligned.pendingReader = null, ut(T), Te(T, C));
2017
+ }, [e, T]), V(() => {
2018
+ let C = !1;
2019
+ return k.current = (q) => {
2020
+ q === e.scope || C || (C = !0, q !== null && (ut(T), mn(n)), R());
1977
2021
  }, () => {
1978
- x.current = () => {
2022
+ k.current = () => {
1979
2023
  };
1980
2024
  };
1981
- }, [e, R, k, n]);
1982
- const m = z(t.settingsCookie);
1983
- U(() => {
1984
- m.current = t.settingsCookie;
2025
+ }, [e, R, T, n]);
2026
+ const O = H(t.settingsCookie);
2027
+ V(() => {
2028
+ O.current = t.settingsCookie;
1985
2029
  }, [t.settingsCookie]);
1986
- const [E] = I(
1987
- () => no(e.settings, (F) => {
1988
- document.cookie = Wt(m.current, F, window.location.protocol === "https:");
2030
+ const [u] = Z(
2031
+ () => fo(e.settings, (C) => {
2032
+ document.cookie = Xt(O.current, C, window.location.protocol === "https:");
1989
2033
  })
1990
- ), b = vo(e.scope), T = H(() => ie(e.notices.catch(() => [])), [e.notices]), C = e.sources.map((F) => F.id).join(`
1991
- `), O = H(() => Vt(t, C.split(`
1992
- `)), [t, C]), N = z(p);
1993
- U(() => {
1994
- N.current = p;
1995
- }, [p]);
1996
- const [P] = I(() => (F, _) => {
1997
- N.current?.(F, _);
1998
- }), B = p === void 0 ? void 0 : P, V = H(
2034
+ ), p = Ao(e.scope), S = I(() => ie(e.notices.catch(() => [])), [e.notices]), E = e.sources.map((C) => C.id).join(`
2035
+ `), y = I(() => Gt(t, E.split(`
2036
+ `)), [t, E]), P = H(h);
2037
+ V(() => {
2038
+ P.current = h;
2039
+ }, [h]);
2040
+ const [z] = Z(() => (C, q) => {
2041
+ P.current?.(C, q);
2042
+ }), M = h === void 0 ? void 0 : z, j = I(
1999
2043
  () => ({
2000
- config: O,
2001
- labels: S,
2002
- locale: f,
2003
- theme: h,
2044
+ config: y,
2045
+ labels: b,
2046
+ locale: m,
2047
+ theme: g,
2004
2048
  storageNamespace: n,
2005
2049
  scope: e.scope,
2006
2050
  sources: e.sources,
2007
- notices: T,
2008
- documents: k.documents,
2009
- trees: k.trees,
2010
- data: k.data,
2011
- viewSettings: E,
2012
- treeSettings: u,
2013
- announcer: b,
2014
- renderTreeFailure: c,
2015
- reportMathDiagnostics: B
2051
+ notices: S,
2052
+ documents: T.documents,
2053
+ trees: T.trees,
2054
+ data: T.data,
2055
+ viewSettings: u,
2056
+ treeSettings: F,
2057
+ announcer: p,
2058
+ renderTreeFailure: a,
2059
+ reportMathDiagnostics: M
2016
2060
  }),
2017
- [O, S, f, h, n, e.scope, e.sources, T, k, E, u, b, c, B]
2061
+ [y, b, m, g, n, e.scope, e.sources, S, T, u, F, p, a, M]
2018
2062
  );
2019
- return /* @__PURE__ */ d(vt, { value: V, children: /* @__PURE__ */ d(Eo, { renderFrame: l, lockDocumentScroll: g }, e.scope) });
2020
- }, bo = ({ ref: e, theme: t, view: n, children: r }) => {
2021
- const [o] = I(er);
2063
+ return /* @__PURE__ */ d(bt, { value: j, children: /* @__PURE__ */ d(Lo, { renderFrame: s, lockDocumentScroll: f }, e.scope) });
2064
+ }, Oo = ({ ref: e, theme: t, view: n, children: r }) => {
2065
+ const [o] = Z(nr);
2022
2066
  return /* @__PURE__ */ d("div", { ref: e, className: "aqmx-root", "data-aqmx-theme": t, "data-aqmx-view": n, "data-testid": "markdown-explorer", onKeyDownCapture: o.onKeyDownCapture, onKeyUpCapture: o.onKeyUpCapture, onBlurCapture: o.onBlurCapture, children: r });
2023
- }, Eo = ({ renderFrame: e, lockDocumentScroll: t }) => {
2024
- const { theme: n, labels: r } = D(), o = Fe(), s = Pe(), l = z(null);
2025
- ao(t, l), U(() => {
2026
- o.kind === "redirect" && s(o.href, "browse");
2027
- }, [o, s]);
2028
- const { location: c } = o, g = c.view;
2029
- fo(l, g);
2030
- const p = c.view === "tree" ? /* @__PURE__ */ d(Ae, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading" }), children: /* @__PURE__ */ d(mo, { location: c }) }) : c.view === "multi" ? /* @__PURE__ */ d(Ae, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading" }), children: /* @__PURE__ */ d(go, { location: c }) }) : /* @__PURE__ */ d(Zr, { location: c }), f = /* @__PURE__ */ Z(bo, { ref: l, theme: n, view: g, children: [
2031
- p,
2032
- /* @__PURE__ */ d(Ur, { holds: !0, testId: "markdown-explorer-announcer" })
2067
+ }, Lo = ({ renderFrame: e, lockDocumentScroll: t }) => {
2068
+ const { theme: n, labels: r } = D(), o = $e(), { hash: l } = mt(), s = Fe(), a = H(null);
2069
+ vo(t, a), V(() => {
2070
+ o.kind === "redirect" && s(`${o.href}${l}`, "browse");
2071
+ }, [o, l, s]);
2072
+ const { location: f } = o, h = f.view;
2073
+ So(a, h);
2074
+ const m = f.view === "tree" ? /* @__PURE__ */ d(Ae, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading" }), children: /* @__PURE__ */ d(yo, { location: f }) }) : f.view === "multi" ? /* @__PURE__ */ d(Ae, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading" }), children: /* @__PURE__ */ d(xo, { location: f }) }) : /* @__PURE__ */ d(Qr, { location: f }), g = /* @__PURE__ */ U(Oo, { ref: a, theme: n, view: h, children: [
2075
+ m,
2076
+ /* @__PURE__ */ d(eo, { holds: !0, testId: "markdown-explorer-announcer" })
2033
2077
  ] });
2034
- return e === void 0 ? f : e({ view: g, children: f });
2035
- }, No = ({ currentUrl: e, nextUrl: t, formMethod: n, defaultShouldRevalidate: r }) => n === void 0 && e.href === t.href && r;
2078
+ return e === void 0 ? g : e({ view: h, children: g });
2079
+ }, zo = ({ currentUrl: e, nextUrl: t, formMethod: n, defaultShouldRevalidate: r }) => n === void 0 && e.href === t.href && r;
2036
2080
  export {
2037
- Ir as D,
2038
- kn as E,
2039
- Rn as F,
2040
- nr as I,
2041
- Ur as L,
2042
- hn as M,
2043
- Pe as a,
2044
- Sn as b,
2045
- pe as c,
2046
- Tn as d,
2047
- Mo as e,
2048
- Et as f,
2049
- qe as g,
2050
- Fe as h,
2051
- fe as i,
2052
- un as j,
2053
- Ke as k,
2054
- pt as l,
2055
- fn as m,
2056
- Ve as n,
2057
- Co as o,
2058
- We as r,
2059
- No as s,
2081
+ Jr as D,
2082
+ Rn as E,
2083
+ Tn as F,
2084
+ or as I,
2085
+ eo as L,
2086
+ vn as M,
2087
+ Xr as P,
2088
+ Fe as a,
2089
+ Ur as b,
2090
+ we as c,
2091
+ Wr as d,
2092
+ jo as e,
2093
+ St as f,
2094
+ An as g,
2095
+ pe as h,
2096
+ $e as i,
2097
+ fe as j,
2098
+ gn as k,
2099
+ We as l,
2100
+ wt as m,
2101
+ hn as n,
2102
+ Ue as o,
2103
+ Bo as p,
2104
+ Ve as r,
2105
+ zo as s,
2060
2106
  D as u
2061
2107
  };