@aiquants/markdown-explorer 0.4.0 → 0.5.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 (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +20 -2
  3. package/dist/ExplorerSplit-CWcK1E4I.js +1495 -0
  4. package/dist/ExplorerSplit-ajN3GSdA.cjs +1 -0
  5. package/dist/{MultiLayout-8s7q3-Hm.js → MultiLayout-BtWtCzJV.js} +69 -66
  6. package/dist/MultiLayout-DvkcdO9c.cjs +1 -0
  7. package/dist/{NativeScrollBar-DqkutcGb.cjs → NativeScrollBar-DbzyQ85y.cjs} +1 -1
  8. package/dist/{NativeScrollBar-D3VDRQqf.js → NativeScrollBar-apXjIKRW.js} +1 -1
  9. package/dist/TreeLayout-BcHsv9G8.js +23 -0
  10. package/dist/TreeLayout-rwhJfLmU.cjs +1 -0
  11. package/dist/core/contracts.d.cts +13 -0
  12. package/dist/core/contracts.d.ts +13 -0
  13. package/dist/{dataRoute-Dl6xmEFs.js → dataRoute-Btg4w3vO.js} +70 -65
  14. package/dist/dataRoute-DHpu0fg2.cjs +1 -0
  15. package/dist/{index-Dv9lUZqD.js → index-CIZw73j9.js} +539 -519
  16. package/dist/index-Cie6WPiM.cjs +3 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.js +5 -5
  19. package/dist/{location-2QZADLiv.cjs → location-CSIhx-L4.cjs} +1 -1
  20. package/dist/{location-CaNtUswk.js → location-c1zdeySY.js} +1 -1
  21. package/dist/sanitizeWorker.cjs +1 -1
  22. package/dist/sanitizeWorker.js +1 -1
  23. package/dist/server/errors.d.cts +1 -1
  24. package/dist/server/errors.d.ts +1 -1
  25. package/dist/server.cjs +1 -1
  26. package/dist/server.js +597 -589
  27. package/docs/behavior/security.md +1 -1
  28. package/docs/behavior/url-contract.md +1 -0
  29. package/package.json +1 -1
  30. package/dist/ExplorerSplit-rUVsf5i-.cjs +0 -1
  31. package/dist/ExplorerSplit-uX2ojZe8.js +0 -1479
  32. package/dist/MultiLayout-ZK2V9nms.cjs +0 -1
  33. package/dist/TreeLayout-C7ZNnaOr.js +0 -22
  34. package/dist/TreeLayout-DkTVgxxb.cjs +0 -1
  35. package/dist/dataRoute-DYjYBiXF.cjs +0 -1
  36. package/dist/index-CLe6vRXs.cjs +0 -3
@@ -1,19 +1,19 @@
1
- import { jsx as d, jsxs as U, Fragment as Bt } from "react/jsx-runtime";
1
+ import { jsx as d, jsxs as Z, Fragment as qt } from "react/jsx-runtime";
2
2
  import * as x from "react";
3
- import { createContext as re, use as G, useMemo as H, useSyncExternalStore as ne, useCallback as P, useRef as j, useEffect as J, Suspense as fe, Component as zt, lazy as $e, useState as Z, useLayoutEffect as V, useEffectEvent as ee, useId as jt } from "react";
4
- import { useParams as Ht, useSearchParams as It, useNavigate as Zt, Link as Ut, useHref as we, useLocation as pt, useRevalidator as Vt } from "react-router";
5
- import { f as Gt, a as Wt, u as Kt, G as se, e as le, x as Yt, y as Xt, z as He, B as Jt, D as Ie, H as Qt, w as en, I as tn } from "./location-CaNtUswk.js";
6
- import { HostedScrollArea as Ze, useMarkdownToolbarState as nn, MarkdownViewer as wt } from "@aiquants/markdown";
7
- import { i as rn, v as vt, s as Y, q as on, w as Ue, x as ln, y as sn, z as an, f as cn, A as Ve, p as dn, t as un, B as fn, o as mn } from "./dataRoute-Dl6xmEFs.js";
8
- import { DEFAULT_CONTENT_ALIGN as gn } from "@aiquants/markdown/viewer-settings";
9
- import { w as hn, r as pn, a as wn, b as Ge, s as vn, c as bn } from "./storage-DA4ItHzl.js";
10
- const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
3
+ import { createContext as oe, use as W, useMemo as H, useSyncExternalStore as re, useCallback as P, useRef as z, useEffect as ee, Suspense as fe, Component as Bt, lazy as De, useState as I, useLayoutEffect as U, useEffectEvent as te, useId as zt } from "react";
4
+ import { useParams as jt, useSearchParams as Ht, useNavigate as It, Link as Zt, useHref as we, useLocation as pt, useRevalidator as Ut } from "react-router";
5
+ import { f as Vt, a as Gt, u as Wt, G as se, e as le, x as Kt, y as Yt, z as Ie, B as Xt, D as Ze, H as Jt, w as Qt, I as en } from "./location-c1zdeySY.js";
6
+ import { HostedScrollArea as Ue, useMarkdownToolbarState as tn, MarkdownViewer as gt } from "@aiquants/markdown";
7
+ import { i as nn, v as wt, s as K, q as rn, w as Ve, x as on, y as ln, z as sn, A as an, f as cn, B as Ge, p as dn, t as un, C as fn, o as mn } from "./dataRoute-Btg4w3vO.js";
8
+ import { DEFAULT_CONTENT_ALIGN as hn } from "@aiquants/markdown/viewer-settings";
9
+ import { w as pn, r as gn, a as wn, b as We, s as vn, c as bn } from "./storage-DA4ItHzl.js";
10
+ const Ke = Object.freeze(["en", "ja"]), En = "en", Sn = 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
- }), yn = /\{(\w+)\}/gu, bt = {
16
+ }), yn = /\{(\w+)\}/gu, vt = {
17
17
  explorerRegion: "Explorer",
18
18
  sourceLabel: "Source",
19
19
  refreshTreeLabel: "Refresh tree",
@@ -358,23 +358,23 @@ const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
358
358
  multiColumnRegion: "{column} 列目",
359
359
  panelDropHere: "ここへパネルをドロップ"
360
360
  }, kn = Object.freeze({
361
- en: Object.freeze(bt),
361
+ en: Object.freeze(vt),
362
362
  ja: Object.freeze(xn)
363
- }), Et = Object.freeze(Object.keys(bt)), Rn = new Set(Et), Tn = (e) => Rn.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, St = (e) => {
363
+ }), bt = Object.freeze(Object.keys(vt)), Rn = new Set(bt), Tn = (e) => Rn.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, Et = (e) => {
364
364
  if (e === void 0) return En;
365
- if (We.includes(e)) return e;
366
- throw new RangeError(`[markdown-explorer] locale is the UI language (${We.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${de(e)}`);
367
- }, Ke = (e, t) => {
368
- const n = kn[St(e)];
365
+ if (Ke.includes(e)) return e;
366
+ throw new RangeError(`[markdown-explorer] locale is the UI language (${Ke.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${de(e)}`);
367
+ }, Ye = (e, t) => {
368
+ const n = kn[Et(e)];
369
369
  if (t === void 0) return n;
370
370
  if (t === null || typeof t != "object")
371
371
  throw new RangeError(`[markdown-explorer] labels must be an object; got ${de(t)}`);
372
- if (!Gt(t))
372
+ if (!Vt(t))
373
373
  throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${de(t)}`);
374
374
  const r = t, o = { ...n };
375
375
  for (const l of Object.keys(r)) {
376
376
  if (!Tn(l))
377
- throw new RangeError(`[markdown-explorer] labels.${l} is not a known label key; expected one of ${Et.join(", ")}`);
377
+ throw new RangeError(`[markdown-explorer] labels.${l} is not a known label key; expected one of ${bt.join(", ")}`);
378
378
  const s = r[l];
379
379
  if (s === void 0) continue;
380
380
  const a = typeof n[l];
@@ -384,9 +384,9 @@ const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
384
384
  throw new RangeError(`[markdown-explorer] labels.${l} must be a non-blank string`);
385
385
  const f = Sn[l];
386
386
  if (typeof s == "string" && f !== void 0) {
387
- for (const [, h] of s.matchAll(yn))
388
- if (!f.includes(h ?? ""))
389
- throw new RangeError(`[markdown-explorer] labels.${l} uses the unknown placeholder {${String(h)}}; it accepts ${f.map((m) => `{${m}}`).join(", ")}`);
387
+ for (const [, p] of s.matchAll(yn))
388
+ if (!f.includes(p ?? ""))
389
+ throw new RangeError(`[markdown-explorer] labels.${l} uses the unknown placeholder {${String(p)}}; it accepts ${f.map((m) => `{${m}}`).join(", ")}`);
390
390
  }
391
391
  o[l] = s;
392
392
  }
@@ -396,22 +396,22 @@ const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
396
396
  if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
397
397
  const n = e, r = t, o = Object.keys(n), l = Object.keys(r);
398
398
  return o.length === l.length && l.every((s) => Object.hasOwn(n, s) && Object.is(n[s], r[s]));
399
- }, Ye = Object.freeze(["light", "dark"]), On = (e) => {
399
+ }, Xe = Object.freeze(["light", "dark"]), Ln = (e) => {
400
400
  if (e === void 0) return "light";
401
- if (Ye.includes(e)) return e;
402
- throw new RangeError(`[markdown-explorer] theme must be ${Ye.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
403
- }, yt = re(null), D = () => {
404
- const e = G(yt);
401
+ if (Xe.includes(e)) return e;
402
+ throw new RangeError(`[markdown-explorer] theme must be ${Xe.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
403
+ }, St = oe(null), D = () => {
404
+ const e = W(St);
405
405
  if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
406
406
  return e;
407
407
  }, me = (e) => {
408
408
  const { viewSettings: t } = D(), n = () => e(t.getSnapshot());
409
- return ne(t.subscribe, n, n);
410
- }, De = () => {
411
- const { config: e } = D(), t = Ht()["*"], [n] = It(), r = n.toString();
412
- return H(() => Wt(e, t, new URLSearchParams(r)), [e, t, r]);
409
+ return re(t.subscribe, n, n);
410
+ }, Fe = () => {
411
+ const { config: e } = D(), t = jt()["*"], [n] = Ht(), r = n.toString();
412
+ return H(() => Gt(e, t, new URLSearchParams(r)), [e, t, r]);
413
413
  };
414
- function Ln({
414
+ function On({
415
415
  title: e,
416
416
  titleId: t,
417
417
  ...n
@@ -432,20 +432,20 @@ function Ln({
432
432
  clipRule: "evenodd"
433
433
  }));
434
434
  }
435
- const Cn = /* @__PURE__ */ x.forwardRef(Ln), Fe = Object.freeze({
435
+ const Cn = /* @__PURE__ */ x.forwardRef(On), _e = Object.freeze({
436
436
  browse: Object.freeze({ replace: !0, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
437
437
  "switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
438
438
  "switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
439
439
  "follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
440
- }), Jo = (e) => Fe[e], _e = () => {
441
- const e = Zt();
440
+ }), tl = (e) => _e[e], qe = () => {
441
+ const e = It();
442
442
  return P(
443
443
  (t, n) => {
444
- e(t, Fe[n]);
444
+ e(t, _e[n]);
445
445
  },
446
446
  [e]
447
447
  );
448
- }, Mn = ({ navigation: e, ...t }) => /* @__PURE__ */ d(Ut, { ...t, ...Fe[e] }), xt = {
448
+ }, Mn = ({ navigation: e, ...t }) => /* @__PURE__ */ d(Zt, { ...t, ..._e[e] }), yt = {
449
449
  unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
450
450
  forbidden: ["failureForbiddenTitle", "failureForbiddenBody"],
451
451
  "not-found": ["failureNotFoundTitle", "failureNotFoundBody"],
@@ -454,14 +454,14 @@ const Cn = /* @__PURE__ */ x.forwardRef(Ln), Fe = Object.freeze({
454
454
  "too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
455
455
  unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
456
456
  failed: ["failureFailedTitle", "failureFailedBody"]
457
- }, ve = (e, t) => e[xt[t][0]], Nn = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
458
- const { labels: o } = D(), l = ve(o, e.reason), s = o[xt[e.reason][1]], a = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
459
- 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: [
457
+ }, ve = (e, t) => e[yt[t][0]], Nn = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
458
+ const { labels: o } = D(), l = ve(o, e.reason), s = o[yt[e.reason][1]], a = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
459
+ return /* @__PURE__ */ Z("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: [
460
460
  /* @__PURE__ */ d("p", { className: "aqmx-callout-title", children: l }),
461
461
  /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: s }),
462
462
  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
463
463
  ] });
464
- }, kt = (e) => {
464
+ }, xt = (e) => {
465
465
  const t = e.ownerDocument;
466
466
  if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
467
467
  if (e.hasAttribute("tabindex")) return !1;
@@ -472,52 +472,52 @@ const Cn = /* @__PURE__ */ x.forwardRef(Ln), Fe = Object.freeze({
472
472
  };
473
473
  return e.addEventListener("blur", n), !0;
474
474
  }, Pn = (e, t) => {
475
- const n = j(null), r = j(null), o = j(null), l = P(() => {
475
+ const n = z(null), r = z(null), o = z(null), l = P(() => {
476
476
  n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
477
477
  }, []);
478
- J(() => l, [l]);
478
+ ee(() => l, [l]);
479
479
  const s = P(
480
- (h) => {
481
- if (r.current !== h) return;
480
+ (p) => {
481
+ if (r.current !== p) return;
482
482
  const m = o.current;
483
483
  if (m !== null) {
484
- m.then(() => s(h));
484
+ m.then(() => s(p));
485
485
  return;
486
486
  }
487
- e.prefetch(h);
488
- const g = e.peek(h);
489
- if (g?.status !== "pending") return;
490
- const b = Promise.allSettled([g.promise]);
487
+ e.prefetch(p);
488
+ const h = e.peek(p);
489
+ if (h?.status !== "pending") return;
490
+ const b = Promise.allSettled([h.promise]);
491
491
  o.current = b, b.then(() => {
492
492
  o.current === b && (o.current = null);
493
493
  });
494
494
  },
495
495
  [e]
496
496
  ), a = P(
497
- (h) => {
498
- const m = t(h);
497
+ (p) => {
498
+ const m = t(p);
499
499
  m !== r.current && (l(), m !== null && (r.current = m, n.current = window.setTimeout(() => {
500
500
  n.current = null, s(m);
501
- }, Kt)));
501
+ }, Wt)));
502
502
  },
503
503
  [l, t, s]
504
504
  ), f = P(
505
- (h) => {
506
- t(h) !== r.current && l();
505
+ (p) => {
506
+ t(p) !== r.current && l();
507
507
  },
508
508
  [l, t]
509
509
  );
510
510
  return H(
511
511
  () => ({
512
- onPointerOver: (h) => a(h.target),
513
- onPointerOut: (h) => f(h.relatedTarget),
514
- onFocus: (h) => a(h.target),
515
- onBlur: (h) => f(h.relatedTarget)
512
+ onPointerOver: (p) => a(p.target),
513
+ onPointerOut: (p) => f(p.relatedTarget),
514
+ onFocus: (p) => a(p.target),
515
+ onBlur: (p) => f(p.relatedTarget)
516
516
  }),
517
517
  [a, f]
518
518
  );
519
- }, $n = $e(() => import("./NativeScrollBar-D3VDRQqf.js").then((e) => ({ default: e.NativeScrollBar })));
520
- class Dn extends zt {
519
+ }, $n = De(() => import("./NativeScrollBar-apXjIKRW.js").then((e) => ({ default: e.NativeScrollBar })));
520
+ class Dn extends Bt {
521
521
  state = { failed: !1 };
522
522
  static getDerivedStateFromError() {
523
523
  return { failed: !0 };
@@ -529,7 +529,7 @@ class Dn extends zt {
529
529
  return this.state.failed ? null : this.props.children;
530
530
  }
531
531
  }
532
- const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children: /* @__PURE__ */ d(fe, { fallback: null, children: /* @__PURE__ */ d($n, { scroller: e, withCircle: t }) }) }), Rt = (e) => /* @__PURE__ */ d(Fn, { scroller: e, withCircle: !0 }), be = () => {
532
+ const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children: /* @__PURE__ */ d(fe, { fallback: null, children: /* @__PURE__ */ d($n, { scroller: e, withCircle: t }) }) }), kt = (e) => /* @__PURE__ */ d(Fn, { scroller: e, withCircle: !0 }), be = () => {
533
533
  const e = /* @__PURE__ */ new Set();
534
534
  return {
535
535
  subscribe: (t) => (e.add(t), () => {
@@ -539,7 +539,7 @@ const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children:
539
539
  for (const t of [...e]) t();
540
540
  }
541
541
  };
542
- }, Tt = () => {
542
+ }, Rt = () => {
543
543
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
544
544
  let n = !1;
545
545
  const r = (o) => {
@@ -566,13 +566,13 @@ const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children:
566
566
  resumes: (o) => t.delete(o),
567
567
  heldKeys: () => [...e.keys()]
568
568
  };
569
- }, ge = (e, t) => {
569
+ }, he = (e, t) => {
570
570
  if (Object.is(e, t)) return !0;
571
571
  if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
572
572
  if (Array.isArray(e) || Array.isArray(t))
573
- return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((l, s) => ge(l, t[s]));
573
+ return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((l, s) => he(l, t[s]));
574
574
  const n = e, r = t, o = Object.keys(n);
575
- return o.length !== Object.keys(r).length ? !1 : o.every((l) => Object.hasOwn(r, l) && ge(n[l], r[l]));
575
+ return o.length !== Object.keys(r).length ? !1 : o.every((l) => Object.hasOwn(r, l) && he(n[l], r[l]));
576
576
  }, ie = (e) => {
577
577
  const t = e;
578
578
  return t.status === void 0 && (t.status = "pending", e.then(
@@ -583,45 +583,45 @@ const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children:
583
583
  t.status = "rejected", t.reason = n;
584
584
  }
585
585
  )), t;
586
- }, At = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), ae = (e) => e.status === "fulfilled" ? e.value : void 0, _n = 55e3, Xe = Object.freeze({ status: "deferred" }), Je = Object.freeze({ status: "refreshed" }), Ae = Object.freeze({ status: "superseded" }), he = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, Ot = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", qn = ({ client: e, capacity: t }) => {
586
+ }, Tt = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), ae = (e) => e.status === "fulfilled" ? e.value : void 0, _n = 55e3, Je = Object.freeze({ status: "deferred" }), Qe = Object.freeze({ status: "refreshed" }), Ae = Object.freeze({ status: "superseded" }), pe = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, At = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", qn = ({ client: e, capacity: t }) => {
587
587
  if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
588
- const n = /* @__PURE__ */ new Map(), r = Tt(), o = be(), l = /* @__PURE__ */ new WeakSet();
588
+ const n = /* @__PURE__ */ new Map(), r = Rt(), o = be(), l = /* @__PURE__ */ new WeakSet();
589
589
  let s = 0;
590
- const a = o.emit, f = () => (s += 1, s), h = () => {
590
+ const a = o.emit, f = () => (s += 1, s), p = () => {
591
591
  if (!(n.size <= t))
592
592
  for (const u of [...n.keys()]) {
593
593
  if (n.size <= t) return;
594
594
  r.isHeld(u) || n.delete(u);
595
595
  }
596
- }, m = (u, p) => {
597
- n.delete(u), n.set(u, p);
598
- }, g = (u) => performance.now() - u.validatedAt >= _n, b = (u, p, S) => {
599
- const E = n.get(u), y = he(E?.snapshot), $ = S || E?.refreshPending === !0, I = ie(e.document(u, { refresh: $ }).then((B) => ({ status: "loaded", document: B }))), C = { snapshot: { status: "pending", promise: I, previous: y }, validatedAt: performance.now(), opened: p, background: null, refreshPending: !1, seeded: void 0, stamp: f() };
600
- return m(u, C), h(), I.then((B) => {
601
- n.get(u) === C && (C.snapshot = B, C.stamp = f(), a());
602
- }), C;
603
- }, R = (u, p, S, E, y, $) => {
604
- p.background === S && (p.background = null, !(n.get(u) !== p || p.snapshot !== E) && (y.kind === "failure" && E.document.kind !== "failure" || (p.validatedAt = $, p.stamp = f(), ge(E.document, y) || (p.snapshot = { status: "loaded", document: y }), a())));
605
- }, k = async (u, p) => {
606
- const S = p.snapshot;
596
+ }, m = (u, g) => {
597
+ n.delete(u), n.set(u, g);
598
+ }, h = (u) => performance.now() - u.validatedAt >= _n, b = (u, g, S) => {
599
+ const E = n.get(u), y = pe(E?.snapshot), $ = S || E?.refreshPending === !0, j = ie(e.document(u, { refresh: $ }).then((_) => ({ status: "loaded", document: _ }))), M = { snapshot: { status: "pending", promise: j, previous: y }, validatedAt: performance.now(), opened: g, background: null, refreshPending: !1, seeded: void 0, stamp: f() };
600
+ return m(u, M), p(), j.then((_) => {
601
+ n.get(u) === M && (M.snapshot = _, M.stamp = f(), a());
602
+ }), M;
603
+ }, R = (u, g, S, E, y, $) => {
604
+ g.background === S && (g.background = null, !(n.get(u) !== g || g.snapshot !== E) && (y.kind === "failure" && E.document.kind !== "failure" || (g.validatedAt = $, g.stamp = f(), he(E.document, y) || (g.snapshot = { status: "loaded", document: y }), a())));
605
+ }, k = async (u, g) => {
606
+ const S = g.snapshot;
607
607
  if (S.status !== "loaded") return null;
608
608
  const E = {};
609
- p.background = E;
610
- const y = performance.now(), $ = e.document(u, { refresh: p.refreshPending });
611
- p.refreshPending = !1;
612
- const I = await $, C = p.background === E && n.get(u) === p && p.snapshot === S;
613
- return R(u, p, E, S, I, y), C ? I : null;
614
- }, A = (u, p) => {
615
- const { snapshot: S } = p;
616
- 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);
609
+ g.background = E;
610
+ const y = performance.now(), $ = e.document(u, { refresh: g.refreshPending });
611
+ g.refreshPending = !1;
612
+ const j = await $, M = g.background === E && n.get(u) === g && g.snapshot === S;
613
+ return R(u, g, E, S, j, y), M ? j : null;
614
+ }, A = (u, g) => {
615
+ const { snapshot: S } = g;
616
+ return S.status === "pending" ? !1 : S.status === "loaded" && S.document.kind !== "failure" ? (k(u, g), !1) : (S.status === "loaded" && l.add(S), b(u, !0, !1), !0);
617
617
  }, T = (u) => {
618
- const p = r.hold(u);
618
+ const g = r.hold(u);
619
619
  let S = !1;
620
620
  return () => {
621
621
  if (S) return;
622
- S = !0, p();
622
+ S = !0, g();
623
623
  const E = n.get(u);
624
- E !== void 0 && m(u, E), h();
624
+ E !== void 0 && m(u, E), p();
625
625
  };
626
626
  };
627
627
  return {
@@ -629,69 +629,69 @@ const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children:
629
629
  peekSeeded: (u) => n.get(u)?.seeded,
630
630
  answerStampOf: (u) => n.get(u)?.stamp,
631
631
  prefetch: (u) => {
632
- const p = n.get(u);
633
- p !== void 0 && p.snapshot.status !== "deferred" || (b(u, !1, !1), a());
632
+ const g = n.get(u);
633
+ g !== void 0 && g.snapshot.status !== "deferred" || (b(u, !1, !1), a());
634
634
  },
635
635
  open: (u) => {
636
- const p = r.resumes(u), S = T(u), E = n.get(u);
636
+ const g = r.resumes(u), S = T(u), E = n.get(u);
637
637
  if (E === void 0 || E.snapshot.status === "deferred")
638
638
  return b(u, !0, !1), a(), S;
639
- if (m(u, E), p) return S;
639
+ if (m(u, E), g) return S;
640
640
  const { snapshot: y } = E;
641
- 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);
641
+ return y.status === "pending" ? (E.opened = !0, S) : y.document.kind === "failure" ? (E.opened || h(E) ? (l.add(y), b(u, !0, !1), a()) : E.opened = !0, S) : (E.opened = !0, E.background === null && h(E) && k(u, E), S);
642
642
  },
643
643
  retain: T,
644
644
  retry: (u) => {
645
- const p = n.get(u);
646
- p === void 0 || p.snapshot.status !== "loaded" || p.snapshot.document.kind !== "failure" || (b(u, !0, !1), a());
645
+ const g = n.get(u);
646
+ g === void 0 || g.snapshot.status !== "loaded" || g.snapshot.document.kind !== "failure" || (b(u, !0, !1), a());
647
647
  },
648
- seed: (u, p) => {
648
+ seed: (u, g) => {
649
649
  const S = performance.now(), E = ie(
650
- p.then(
651
- (B) => B === null ? Xe : { status: "loaded", document: B },
652
- () => Xe
650
+ g.then(
651
+ (_) => _ === null ? Je : { status: "loaded", document: _ },
652
+ () => Je
653
653
  )
654
654
  ), y = n.get(u);
655
655
  if (y !== void 0 && y.snapshot.status === "loaded") {
656
- const B = y.snapshot, M = {};
657
- y.background = M, E.then((_) => {
658
- if (_.status === "loaded") {
659
- R(u, y, M, B, _.document, S);
656
+ const _ = y.snapshot, G = {};
657
+ y.background = G, E.then((O) => {
658
+ if (O.status === "loaded") {
659
+ R(u, y, G, _, O.document, S);
660
660
  return;
661
661
  }
662
- y.background === M && (y.background = null);
662
+ y.background === G && (y.background = null);
663
663
  });
664
664
  return;
665
665
  }
666
- const $ = y !== void 0 && y.snapshot.status === "pending" ? y.snapshot.previous : null, I = { status: "pending", promise: E, previous: $ }, C = { snapshot: I, validatedAt: S, opened: y?.opened === !0, background: null, refreshPending: y?.refreshPending === !0, seeded: I, stamp: f() };
667
- m(u, C), h(), E.then((B) => {
668
- n.get(u) === C && (B.status === "deferred" && r.isHeld(u) ? b(u, C.opened, !1) : (C.snapshot = B, C.stamp = f()), a());
666
+ const $ = y !== void 0 && y.snapshot.status === "pending" ? y.snapshot.previous : null, j = { status: "pending", promise: E, previous: $ }, M = { snapshot: j, validatedAt: S, opened: y?.opened === !0, background: null, refreshPending: y?.refreshPending === !0, seeded: j, stamp: f() };
667
+ m(u, M), p(), E.then((_) => {
668
+ n.get(u) === M && (_.status === "deferred" && r.isHeld(u) ? b(u, M.opened, !1) : (M.snapshot = _, M.stamp = f()), a());
669
669
  });
670
670
  },
671
671
  invalidate: () => {
672
672
  let u = !1;
673
- for (const [p, S] of [...n]) {
674
- if (S.validatedAt = Number.NEGATIVE_INFINITY, S.opened = !0, S.refreshPending = !0, !r.isHeld(p)) continue;
673
+ for (const [g, S] of [...n]) {
674
+ if (S.validatedAt = Number.NEGATIVE_INFINITY, S.opened = !0, S.refreshPending = !0, !r.isHeld(g)) continue;
675
675
  const { snapshot: E } = S;
676
676
  if (E.status !== "pending") {
677
- A(p, S) && (u = !0);
677
+ A(g, S) && (u = !0);
678
678
  continue;
679
679
  }
680
680
  E.promise.then(() => {
681
- n.get(p) === S && S.refreshPending && r.isHeld(p) && A(p, S) && a();
681
+ n.get(g) === S && S.refreshPending && r.isHeld(g) && A(g, S) && a();
682
682
  });
683
683
  }
684
684
  u && a();
685
685
  },
686
686
  refresh: async (u) => {
687
- const p = n.get(u);
688
- if (p !== void 0 && Ot(p.snapshot)) {
689
- p.refreshPending = !0;
690
- const E = await k(u, p);
691
- return E === null ? Ae : E.kind === "failure" ? { status: "failed", failure: E.failure } : Je;
687
+ const g = n.get(u);
688
+ if (g !== void 0 && At(g.snapshot)) {
689
+ g.refreshPending = !0;
690
+ const E = await k(u, g);
691
+ return E === null ? Ae : E.kind === "failure" ? { status: "failed", failure: E.failure } : Qe;
692
692
  }
693
693
  const S = b(u, !0, !0);
694
- return a(), S.snapshot.status !== "pending" ? Ae : (await S.snapshot.promise, n.get(u) === S ? Je : Ae);
694
+ return a(), S.snapshot.status !== "pending" ? Ae : (await S.snapshot.promise, n.get(u) === S ? Qe : Ae);
695
695
  },
696
696
  clear: () => {
697
697
  n.clear();
@@ -701,7 +701,7 @@ const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children:
701
701
  subscribe: o.subscribe,
702
702
  noteFailureShown: (u) => l.has(u) ? !1 : (l.add(u), !0)
703
703
  };
704
- }, pe = re("fill"), Bn = Object.freeze({ blockSize: "100%" }), Ee = ({ scrollerProps: e, children: t }) => G(pe) === "content" ? /* @__PURE__ */ d(Ze, { scrollerProps: e, children: t }) : /* @__PURE__ */ d(Ze, { scrollerProps: { ...e, style: Bn }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: Rt, children: t });
704
+ }, ge = oe("fill"), Bn = Object.freeze({ blockSize: "100%" }), Ee = ({ scrollerProps: e, children: t }) => W(ge) === "content" ? /* @__PURE__ */ d(Ue, { scrollerProps: e, children: t }) : /* @__PURE__ */ d(Ue, { scrollerProps: { ...e, style: Bn }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: kt, children: t });
705
705
  function zn({
706
706
  title: e,
707
707
  titleId: t,
@@ -751,7 +751,7 @@ function Hn({
751
751
  }
752
752
  const In = /* @__PURE__ */ x.forwardRef(Hn), Se = ({ name: e, url: t, icon: n, children: r }) => {
753
753
  const { labels: o } = D();
754
- return /* @__PURE__ */ U("div", { className: "aqmx-document-toolbar", children: [
754
+ return /* @__PURE__ */ Z("div", { className: "aqmx-document-toolbar", children: [
755
755
  /* @__PURE__ */ d("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: n }),
756
756
  /* @__PURE__ */ d("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
757
757
  r,
@@ -782,43 +782,43 @@ function Zn({
782
782
  }
783
783
  const Un = /* @__PURE__ */ x.forwardRef(Zn), Vn = Object.freeze({ className: "aqmx-document-stage" }), Gn = ({ document: e }) => {
784
784
  const { labels: t } = D();
785
- return /* @__PURE__ */ U("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
785
+ return /* @__PURE__ */ Z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
786
786
  /* @__PURE__ */ d(Se, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(Un, {}) }),
787
- /* @__PURE__ */ d(Ee, { scrollerProps: Vn, children: /* @__PURE__ */ U("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
787
+ /* @__PURE__ */ d(Ee, { scrollerProps: Vn, children: /* @__PURE__ */ Z("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
788
788
  /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
789
789
  /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
790
790
  ] }) })
791
791
  ] });
792
- }, qe = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", Wn = (e) => {
792
+ }, Be = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", Wn = (e) => {
793
793
  const t = e.indexOf("#");
794
794
  return t === -1 ? "" : e.slice(t);
795
- }, Kn = /(%[0-9A-Fa-f]{2})/u, Be = (e) => {
795
+ }, Kn = /(%[0-9A-Fa-f]{2})/u, ze = (e) => {
796
796
  if (!e.startsWith("#") || e.length === 1) return null;
797
797
  const t = new TextEncoder(), n = e.slice(1).split(Kn).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
798
798
  return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
799
799
  }, Lt = (e) => `#${encodeURIComponent(e)}`, Yn = (e) => {
800
800
  if (e === "#") return !0;
801
- const t = Be(e);
801
+ const t = ze(e);
802
802
  return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
803
- }, Ct = (e, t) => {
803
+ }, Ot = (e, t) => {
804
804
  if (t === "") return null;
805
805
  for (const n of e.querySelectorAll("[id]"))
806
806
  if (n.id === t) return n;
807
807
  return null;
808
- }, Xn = "http://www.w3.org/1999/xhtml", Qe = (e, t) => {
808
+ }, Xn = "http://www.w3.org/1999/xhtml", et = (e, t) => {
809
809
  if (t === "") return null;
810
- const n = Ct(e, t);
810
+ const n = Ot(e, t);
811
811
  if (n !== null) return n;
812
812
  for (const r of e.querySelectorAll("a[name]"))
813
813
  if (r.localName === "a" && r.namespaceURI === Xn && r.getAttribute("name") === t) return r;
814
814
  return null;
815
- }, Mt = (e, t) => {
815
+ }, Ct = (e, t) => {
816
816
  if (e === null || !t.startsWith("#")) return null;
817
- const n = Qe(e, t.slice(1));
817
+ const n = et(e, t.slice(1));
818
818
  if (n !== null) return n;
819
- const r = Be(t);
820
- return r === null ? null : Qe(e, r);
821
- }, et = (e) => {
819
+ const r = ze(t);
820
+ return r === null ? null : et(e, r);
821
+ }, tt = (e) => {
822
822
  const { body: t, documentElement: n } = e.ownerDocument;
823
823
  if (e === t) {
824
824
  const o = getComputedStyle(n);
@@ -830,18 +830,18 @@ const Un = /* @__PURE__ */ x.forwardRef(Zn), Vn = Object.freeze({ className: "aq
830
830
  const { body: t, documentElement: n } = e, r = getComputedStyle(n), o = r.overflowX === "visible" && r.overflowY === "visible" && t !== null ? getComputedStyle(t).overflowY : r.overflowY;
831
831
  return o !== "hidden" && o !== "clip";
832
832
  }, Qn = (e, t) => {
833
- const n = t.closest(qe), r = n !== null && e.contains(n) ? n : e;
834
- if (r.scrollHeight > r.clientHeight && et(r)) return r;
833
+ const n = t.closest(Be), r = n !== null && e.contains(n) ? n : e;
834
+ if (r.scrollHeight > r.clientHeight && tt(r)) return r;
835
835
  const o = e.getBoundingClientRect().height, { documentElement: l, scrollingElement: s } = e.ownerDocument;
836
836
  for (let a = e.parentElement; a !== null && a !== l; a = a.parentElement)
837
- if (et(a) && a.scrollHeight > a.clientHeight && a.clientHeight < o) return a;
837
+ if (tt(a) && a.scrollHeight > a.clientHeight && a.clientHeight < o) return a;
838
838
  return s instanceof Element && Jn(e.ownerDocument) && s.scrollHeight > s.clientHeight && s.clientHeight < o ? s : r;
839
839
  }, er = Object.freeze({
840
840
  scrollerOf: Qn,
841
841
  reveal: (e) => {
842
- e.scrollIntoView(Ce);
842
+ e.scrollIntoView(Me);
843
843
  }
844
- }), Ce = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), tr = (e, t) => {
844
+ }), Me = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), tr = (e, t) => {
845
845
  for (let n = t; n !== null && n !== e; n = n.parentElement) {
846
846
  const r = n.parentElement;
847
847
  if (r instanceof HTMLDetailsElement && n !== r.querySelector(":scope > summary") && (r.open = !0), n.getAttribute("hidden")?.toLowerCase() === "until-found") {
@@ -853,16 +853,16 @@ const Un = /* @__PURE__ */ x.forwardRef(Zn), Vn = Object.freeze({ className: "aq
853
853
  if (t.getClientRects().length === 0) return;
854
854
  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;
855
855
  if (!a && Math.abs(s.top - l - n) < 1) {
856
- t.scrollIntoView(Ce);
856
+ t.scrollIntoView(Me);
857
857
  return;
858
858
  }
859
- e.scrollBy({ top: a ? s.top - n - e.clientHeight : s.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(Ce);
859
+ e.scrollBy({ top: a ? s.top - n - e.clientHeight : s.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(Me);
860
860
  }, rr = (e, t) => {
861
- const n = t.scrollerOf(e, e.querySelector(qe) ?? e);
861
+ const n = t.scrollerOf(e, e.querySelector(Be) ?? e);
862
862
  n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
863
- }, tt = (e, t, n) => {
863
+ }, nt = (e, t, n) => {
864
864
  if (e === null) return null;
865
- const r = Mt(e, t);
865
+ const r = Ct(e, t);
866
866
  return r === null ? (Yn(t) && rr(e, n), null) : (tr(e, r), nr(n.scrollerOf(e, r), r), n.reveal(r), r);
867
867
  };
868
868
  function or({
@@ -954,7 +954,7 @@ function dr({
954
954
  clipRule: "evenodd"
955
955
  }));
956
956
  }
957
- const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = Object.freeze({ [Me]: "allow" }), fr = `[${Me}="${Ne[Me]}"]`, mr = () => {
957
+ const ur = /* @__PURE__ */ x.forwardRef(dr), Ne = "data-aqmx-key-repeat", Pe = Object.freeze({ [Ne]: "allow" }), fr = `[${Ne}="${Pe[Ne]}"]`, mr = () => {
958
958
  let e = null;
959
959
  return {
960
960
  onKeyDownCapture: (t) => {
@@ -973,7 +973,7 @@ const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = O
973
973
  t.target === e && (e = null);
974
974
  }
975
975
  };
976
- }, ue = Object.freeze([1 / se ** 2, 1 / se, 1, se, se ** 2]), nt = Object.freeze({ mode: "fit" }), gr = 1, hr = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), pr = re(null), wr = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= gr ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, rt = (e, t, n) => {
976
+ }, ue = Object.freeze([1 / se ** 2, 1 / se, 1, se, se ** 2]), rt = Object.freeze({ mode: "fit" }), hr = 1, pr = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), gr = oe(null), wr = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= hr ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, ot = (e, t, n) => {
977
977
  if (e.mode === "level") {
978
978
  const o = e.index + n;
979
979
  return o >= 0 && o < ue.length ? o : null;
@@ -981,45 +981,45 @@ const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = O
981
981
  if (t === null || !Number.isFinite(t) || t <= 0) return null;
982
982
  const r = n === 1 ? ue.findIndex((o) => o > t) : ue.findLastIndex((o) => o < t);
983
983
  return r === -1 ? null : r;
984
- }, ot = (e, t, n) => {
984
+ }, lt = (e, t, n) => {
985
985
  if (e.mode === "level") {
986
- const o = rt(e, null, n);
986
+ const o = ot(e, null, n);
987
987
  return o === null ? null : { mode: "level", index: o, base: e.base };
988
988
  }
989
989
  if (t === null) return null;
990
- const r = rt(e, t.scale, n);
990
+ const r = ot(e, t.scale, n);
991
991
  return r === null ? null : { mode: "level", index: r, base: t.base };
992
992
  }, vr = (e) => {
993
993
  const t = ue[e];
994
994
  if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
995
995
  return t;
996
- }, lt = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, br = ({ document: e }) => {
997
- const { labels: t } = D(), n = G(pr), [r] = Z(() => n === null ? null : n.read(e.url)), [o, l] = Z(r === null ? nt : r.zoom), [s, a] = Z(r === null ? null : r.reported), [f, h] = Z(null), m = j(null), g = P((O) => {
998
- const { naturalWidth: u, naturalHeight: p } = O;
999
- a((S) => lt(S, u, p));
996
+ }, it = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, br = ({ document: e }) => {
997
+ const { labels: t } = D(), n = W(gr), [r] = I(() => n === null ? null : n.read(e.url)), [o, l] = I(r === null ? rt : r.zoom), [s, a] = I(r === null ? null : r.reported), [f, p] = I(null), m = z(null), h = P((L) => {
998
+ const { naturalWidth: u, naturalHeight: g } = L;
999
+ a((S) => it(S, u, g));
1000
1000
  }, []), b = P(
1001
- (O) => {
1002
- m.current = O, !(O === null || !O.complete) && (O.naturalWidth > 0 || O.naturalHeight > 0 ? g(O) : O.decode().then(
1003
- () => g(O),
1001
+ (L) => {
1002
+ m.current = L, !(L === null || !L.complete) && (L.naturalWidth > 0 || L.naturalHeight > 0 ? h(L) : L.decode().then(
1003
+ () => h(L),
1004
1004
  () => {
1005
1005
  }
1006
1006
  ));
1007
1007
  },
1008
- [g]
1008
+ [h]
1009
1009
  );
1010
- J(() => {
1010
+ ee(() => {
1011
1011
  n !== null && s !== null && n.save(e.url, { zoom: o, reported: s });
1012
- }, [n, e.url, o, s]), V(() => {
1013
- const O = m.current;
1014
- if (O === null || s === null || o.mode !== "fit") return;
1015
- const u = () => h((S) => lt(S, O.clientWidth, O.clientHeight));
1012
+ }, [n, e.url, o, s]), U(() => {
1013
+ const L = m.current;
1014
+ if (L === null || s === null || o.mode !== "fit") return;
1015
+ const u = () => p((S) => it(S, L.clientWidth, L.clientHeight));
1016
1016
  if (u(), typeof ResizeObserver > "u") return;
1017
- const p = new ResizeObserver(u);
1018
- return p.observe(O), () => p.disconnect();
1017
+ const g = new ResizeObserver(u);
1018
+ return g.observe(L), () => g.disconnect();
1019
1019
  }, [s, o.mode]);
1020
- const R = s === null || f === null ? null : wr(s, f), k = ot(o, R, -1), A = ot(o, R, 1), T = o.mode === "level" ? vr(o.index) : null, F = o.mode === "level" && T !== null ? { width: `${o.base.width * T}px`, height: `${o.base.height * T}px` } : void 0;
1021
- return /* @__PURE__ */ U("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1022
- /* @__PURE__ */ U(Se, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(ur, {}), children: [
1020
+ const R = s === null || f === null ? null : wr(s, f), k = lt(o, R, -1), A = lt(o, R, 1), T = o.mode === "level" ? vr(o.index) : null, F = o.mode === "level" && T !== null ? { width: `${o.base.width * T}px`, height: `${o.base.height * T}px` } : void 0;
1021
+ return /* @__PURE__ */ Z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1022
+ /* @__PURE__ */ Z(Se, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(ur, {}), children: [
1023
1023
  /* @__PURE__ */ d(
1024
1024
  "button",
1025
1025
  {
@@ -1031,7 +1031,7 @@ const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = O
1031
1031
  onClick: () => {
1032
1032
  k !== null && l(k);
1033
1033
  },
1034
- ...Ne,
1034
+ ...Pe,
1035
1035
  children: /* @__PURE__ */ d(sr, {})
1036
1036
  }
1037
1037
  ),
@@ -1047,33 +1047,33 @@ const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = O
1047
1047
  onClick: () => {
1048
1048
  A !== null && l(A);
1049
1049
  },
1050
- ...Ne,
1050
+ ...Pe,
1051
1051
  children: /* @__PURE__ */ d(cr, {})
1052
1052
  }
1053
1053
  ),
1054
- /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => l(nt), children: /* @__PURE__ */ d(lr, {}) })
1054
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => l(rt), children: /* @__PURE__ */ d(lr, {}) })
1055
1055
  ] }),
1056
- /* @__PURE__ */ d(Ee, { scrollerProps: hr, 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" }) })
1056
+ /* @__PURE__ */ d(Ee, { scrollerProps: pr, 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: (L) => h(L.currentTarget), "data-testid": "markdown-explorer-image" }) })
1057
1057
  ] });
1058
- }, Nt = re(null), ye = re(void 0), Pt = re(null), xe = () => {
1059
- const e = G(Nt);
1058
+ }, Mt = oe(null), ye = oe(void 0), Nt = oe(null), xe = () => {
1059
+ const e = W(Mt);
1060
1060
  if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
1061
1061
  return e;
1062
1062
  }, Er = () => {
1063
- const e = G(Pt);
1063
+ const e = W(Nt);
1064
1064
  if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
1065
1065
  return e;
1066
1066
  }, ke = (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 }), Sr = ({ children: e }) => {
1067
- const { config: t } = D(), n = xe(), r = De(), o = r.kind === "location" ? r.location.source : void 0, l = we(ke(t, n.navigation, o, n.currentPath));
1068
- return /* @__PURE__ */ d(ye, { value: o, children: /* @__PURE__ */ d(Pt, { value: l, children: e }) });
1067
+ const { config: t } = D(), n = xe(), r = Fe(), o = r.kind === "location" ? r.location.source : void 0, l = we(ke(t, n.navigation, o, n.currentPath));
1068
+ return /* @__PURE__ */ d(ye, { value: o, children: /* @__PURE__ */ d(Nt, { value: l, children: e }) });
1069
1069
  }, yr = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', xr = (e) => {
1070
1070
  const t = e instanceof Element ? e.closest(yr) : null;
1071
1071
  return t === null ? null : t.getAttribute("data-doc-path");
1072
1072
  }, Re = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, kr = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: l, onDocumentLink: s, scope: a, children: f }) => {
1073
- const h = we(e);
1074
- return /* @__PURE__ */ d("a", { ...l, href: h, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (g) => {
1075
- if (Re(g)) {
1076
- if (g.preventDefault(), t === a.currentPath && n !== "") {
1073
+ const p = we(e);
1074
+ return /* @__PURE__ */ d("a", { ...l, href: p, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (h) => {
1075
+ if (Re(h)) {
1076
+ if (h.preventDefault(), t === a.currentPath && n !== "") {
1077
1077
  a.scrollWithin(n);
1078
1078
  return;
1079
1079
  }
@@ -1081,14 +1081,14 @@ const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = O
1081
1081
  }
1082
1082
  }, children: f });
1083
1083
  }, Rr = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: l }) => {
1084
- const { config: s } = D(), a = xe(), f = G(ye), h = Wn(e), { navigation: m } = a, g = `${ke(s, m, f, t)}${h}`, b = n === !1 ? "false" : void 0;
1085
- return m.kind === "page" ? /* @__PURE__ */ d(Mn, { ...o, to: g, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": b, children: l }) : /* @__PURE__ */ d(kr, { to: g, docPath: t, fragment: h, exists: b, className: r, attributes: o, onDocumentLink: m.onDocumentLink, scope: a, children: l });
1084
+ const { config: s } = D(), a = xe(), f = W(ye), p = Wn(e), { navigation: m } = a, h = `${ke(s, m, f, t)}${p}`, b = n === !1 ? "false" : void 0;
1085
+ return m.kind === "page" ? /* @__PURE__ */ d(Mn, { ...o, to: h, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": b, children: l }) : /* @__PURE__ */ d(kr, { to: h, docPath: t, fragment: p, exists: b, className: r, attributes: o, onDocumentLink: m.onDocumentLink, scope: a, children: l });
1086
1086
  }, Tr = ({ className: e, attributes: t, children: n }) => {
1087
1087
  const { labels: r } = D();
1088
1088
  return (
1089
- /* @__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: [
1089
+ /* @__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: [
1090
1090
  n,
1091
- /* @__PURE__ */ U("span", { className: "aqmx-sr-only", children: [
1091
+ /* @__PURE__ */ Z("span", { className: "aqmx-sr-only", children: [
1092
1092
  " (",
1093
1093
  r.inertLink,
1094
1094
  ")"
@@ -1096,25 +1096,25 @@ const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = O
1096
1096
  ] })
1097
1097
  );
1098
1098
  }, Ar = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
1099
- const { config: l } = D(), s = G(ye), a = we(`${ke(l, r.navigation, s, r.currentPath)}${e}`);
1100
- return /* @__PURE__ */ d("a", { ...n, href: a, className: t, onClick: (h) => {
1101
- Re(h) && (h.preventDefault(), r.scrollWithin(e));
1099
+ const { config: l } = D(), s = W(ye), a = we(`${ke(l, r.navigation, s, r.currentPath)}${e}`);
1100
+ return /* @__PURE__ */ d("a", { ...n, href: a, className: t, onClick: (p) => {
1101
+ Re(p) && (p.preventDefault(), r.scrollWithin(e));
1102
1102
  }, children: o });
1103
- }, Or = ({ href: e, className: t, attributes: n, children: r }) => {
1103
+ }, Lr = ({ href: e, className: t, attributes: n, children: r }) => {
1104
1104
  const o = xe();
1105
1105
  return o.navigation.kind === "page" ? /* @__PURE__ */ d("a", { ...n, href: e, className: t, onClick: (s) => {
1106
1106
  if (!Re(s)) return;
1107
1107
  const a = s.currentTarget;
1108
1108
  e === "#" ? o.followEmptyFragment(s.nativeEvent) : a.href === a.ownerDocument.URL && o.followSameUrlJump(e, s.nativeEvent);
1109
1109
  }, children: r }) : /* @__PURE__ */ d(Ar, { href: e, className: t, attributes: n, scope: o, children: r });
1110
- }, Lr = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: l, children: s }) => t === "doc" ? n === void 0 || !rn(n) ? /* @__PURE__ */ d(Tr, { className: o, attributes: l, children: s }) : /* @__PURE__ */ d(Rr, { href: e, docPath: n, docExists: r, className: o, attributes: l, children: s }) : e.startsWith("#") ? /* @__PURE__ */ d(Or, { href: e, className: o, attributes: l, children: s }) : /* @__PURE__ */ d("a", { ...l, href: e, className: o, children: s }), Cr = () => {
1111
- const { config: e } = D(), t = xe(), n = G(ye), r = _e();
1110
+ }, Or = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: l, children: s }) => t === "doc" ? n === void 0 || !nn(n) ? /* @__PURE__ */ d(Tr, { className: o, attributes: l, children: s }) : /* @__PURE__ */ d(Rr, { href: e, docPath: n, docExists: r, className: o, attributes: l, children: s }) : e.startsWith("#") ? /* @__PURE__ */ d(Lr, { href: e, className: o, attributes: l, children: s }) : /* @__PURE__ */ d("a", { ...l, href: e, className: o, children: s }), Cr = () => {
1111
+ const { config: e } = D(), t = xe(), n = W(ye), r = qe();
1112
1112
  return P(
1113
1113
  (o, l) => {
1114
1114
  if (!Re(l)) return !0;
1115
1115
  l.preventDefault();
1116
1116
  const s = Lt(o.id), { navigation: a } = t;
1117
- return a.kind === "panel" || Be(l.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(s), !0) : (r(`${ke(e, a, n, t.currentPath)}${s}`, "follow-link"), !0);
1117
+ return a.kind === "panel" || ze(l.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(s), !0) : (r(`${ke(e, a, n, t.currentPath)}${s}`, "follow-link"), !0);
1118
1118
  },
1119
1119
  [e, t, n, r]
1120
1120
  );
@@ -1216,7 +1216,7 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1216
1216
  throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`);
1217
1217
  }
1218
1218
  }
1219
- }, jr = ({ document: e }) => /* @__PURE__ */ U("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
1219
+ }, jr = ({ document: e }) => /* @__PURE__ */ Z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
1220
1220
  /* @__PURE__ */ d(Se, { name: e.name, url: e.url, icon: Br(e.mediaType) }),
1221
1221
  /* @__PURE__ */ d(Ee, { scrollerProps: qr, children: /* @__PURE__ */ d(zr, { document: e }) })
1222
1222
  ] }), Hr = (e) => ({
@@ -1253,42 +1253,42 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1253
1253
  embeddedVideo: e.viewerEmbeddedVideo,
1254
1254
  embeddedPost: e.viewerEmbeddedPost,
1255
1255
  embeddedFrame: e.viewerEmbeddedFrame
1256
- }), $t = (e, t, n) => {
1256
+ }), Pt = (e, t, n) => {
1257
1257
  if (t !== void 0) return t;
1258
1258
  if (n !== void 0) return n;
1259
1259
  const [r] = e.documentStyles;
1260
1260
  if (r === void 0) throw new Error("[markdown-explorer] the configuration has no document style");
1261
1261
  return r.name;
1262
- }, Dt = (e, t) => e !== void 0 ? e : t !== void 0 ? t : gn, Ir = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Zr = (e, t, n) => {
1262
+ }, $t = (e, t) => e !== void 0 ? e : t !== void 0 ? t : hn, Ir = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Zr = (e, t, n) => {
1263
1263
  if (t.view === "multi" || t.overrides[n] === void 0) return null;
1264
1264
  const r = n === "style" ? { align: t.overrides.align } : { style: t.overrides.style };
1265
1265
  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 });
1266
- }, ze = ({ kind: e, label: t, stale: n, busy: r, frameRef: o, intent: l, children: s }) => {
1267
- const a = G(pe);
1266
+ }, je = ({ kind: e, label: t, stale: n, busy: r, frameRef: o, intent: l, children: s }) => {
1267
+ const a = W(ge);
1268
1268
  return (
1269
- /* @__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: [
1269
+ /* @__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": a, className: "aqmx-document", ...l, children: [
1270
1270
  n ? /* @__PURE__ */ d("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
1271
1271
  s
1272
1272
  ] })
1273
1273
  );
1274
1274
  }, Ur = () => {
1275
1275
  const { labels: e } = D();
1276
- 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 }) }) });
1277
- }, Ft = ({ label: e }) => {
1276
+ return /* @__PURE__ */ d(je, { 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 }) }) });
1277
+ }, Dt = ({ label: e }) => {
1278
1278
  const { labels: t } = D();
1279
- return /* @__PURE__ */ U(ze, { kind: "loading", label: e, stale: !1, busy: !0, children: [
1279
+ return /* @__PURE__ */ Z(je, { kind: "loading", label: e, stale: !1, busy: !0, children: [
1280
1280
  /* @__PURE__ */ d("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-document-skeleton", children: Ir.map((n) => /* @__PURE__ */ d("span", {}, n)) }),
1281
1281
  /* @__PURE__ */ d("p", { className: "aqmx-sr-only", children: t.documentLoading })
1282
1282
  ] });
1283
1283
  }, Vr = ({ path: e, document: t, viewer: n }) => {
1284
1284
  const { reportMathDiagnostics: r } = D(), o = H(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), l = Cr(), s = Mr(), a = H(() => r === void 0 ? void 0 : (f) => r(e, f), [r, e]);
1285
- return /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(wt, { ...n, onHeadingSelect: l, headingHref: s, onMathDiagnostics: a, parseResult: o, content: null }) });
1285
+ return /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(gt, { ...n, onHeadingSelect: l, headingHref: s, onMathDiagnostics: a, parseResult: o, content: null }) });
1286
1286
  }, Gr = ({ document: e, viewer: t }) => {
1287
1287
  const { labels: n } = D();
1288
- return /* @__PURE__ */ U(Bt, { children: [
1288
+ return /* @__PURE__ */ Z(qt, { children: [
1289
1289
  /* @__PURE__ */ d(Se, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(Cn, {}) }),
1290
1290
  e.truncated ? /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
1291
- /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(wt, { ...t, parseResult: null, content: e.text }) })
1291
+ /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(gt, { ...t, parseResult: null, content: e.text }) })
1292
1292
  ] });
1293
1293
  }, Wr = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), Kr = ({ path: e, document: t, viewer: n, onRetry: r }) => {
1294
1294
  switch (t.kind) {
@@ -1310,16 +1310,16 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1310
1310
  }
1311
1311
  }
1312
1312
  }, Yr = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', Xr = (e, t, n) => {
1313
- const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : Mt(e, n), r === void 0 ? null : Ct(e, r.id), e.querySelector(qe), e.querySelector(Yr)];
1313
+ const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : Ct(e, n), r === void 0 ? null : Ot(e, r.id), e.querySelector(Be), e.querySelector(Yr)];
1314
1314
  for (const l of o)
1315
- if (l instanceof HTMLElement && kt(l)) return l;
1315
+ if (l instanceof HTMLElement && xt(l)) return l;
1316
1316
  return null;
1317
- }, it = (e, t, n) => {
1317
+ }, st = (e, t, n) => {
1318
1318
  const { activeElement: r, body: o } = e.ownerDocument, l = r === null || r === o;
1319
- t instanceof HTMLElement && n && (l || e.contains(r)) && kt(t);
1319
+ t instanceof HTMLElement && n && (l || e.contains(r)) && xt(t);
1320
1320
  }, Jr = (e) => {
1321
- const t = j(!1);
1322
- return V(() => {
1321
+ const t = z(!1);
1322
+ return U(() => {
1323
1323
  const n = e.current;
1324
1324
  if (n === null) throw new Error("[markdown-explorer] the document region is not mounted");
1325
1325
  const r = n.ownerDocument, o = r.defaultView;
@@ -1331,30 +1331,30 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1331
1331
  }, 0);
1332
1332
  }, f = (b) => {
1333
1333
  t.current = b.target instanceof Node && n.contains(b.target);
1334
- }, h = (b) => {
1334
+ }, p = (b) => {
1335
1335
  b.relatedTarget === null && l && (t.current = !1);
1336
1336
  }, m = () => {
1337
1337
  const { activeElement: b, body: R } = r;
1338
1338
  b !== null && b !== R && (t.current = n.contains(b));
1339
- }, g = () => {
1339
+ }, h = () => {
1340
1340
  l && !n.contains(r.activeElement) && (t.current = !1);
1341
1341
  };
1342
- 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), () => {
1343
- 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);
1342
+ return o.addEventListener("pointerdown", a, !0), o.addEventListener("mousedown", a, !0), o.addEventListener("focusin", f, !0), o.addEventListener("blur", m), o.addEventListener("focus", h), n.addEventListener("focusout", p), () => {
1343
+ clearTimeout(s), o.removeEventListener("pointerdown", a, !0), o.removeEventListener("mousedown", a, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("blur", m), o.removeEventListener("focus", h), n.removeEventListener("focusout", p);
1344
1344
  };
1345
1345
  }, [e]), t;
1346
- }, Qr = ({ path: e, snapshot: t, stale: n, viewer: r, regionLabel: o, navigation: l, fragment: s, paneScroll: a, announces: f, announceFailure: h, onDocumentShown: m }) => {
1347
- const { labels: g, announcer: b, documents: R } = D(), { document: k } = t, A = j(null), T = j(null), F = j(null), O = j(0), u = Jr(A), p = j({ path: e, document: k }), S = j(null), E = P(
1346
+ }, Qr = ({ path: e, snapshot: t, stale: n, viewer: r, regionLabel: o, navigation: l, fragment: s, paneScroll: a, announces: f, announceFailure: p, onDocumentShown: m }) => {
1347
+ const { labels: h, announcer: b, documents: R } = D(), { document: k } = t, A = z(null), T = z(null), F = z(null), L = z(0), u = Jr(A), g = z({ path: e, document: k }), S = z(null), E = P(
1348
1348
  (i) => {
1349
- const c = A.current, w = tt(c, i, a);
1350
- c !== null && w !== null && it(c, w, u.current);
1349
+ const c = A.current, w = nt(c, i, a);
1350
+ c !== null && w !== null && st(c, w, u.current);
1351
1351
  },
1352
1352
  [a, u]
1353
1353
  ), y = P(
1354
1354
  (i, c) => {
1355
- const w = O.current;
1355
+ const w = L.current;
1356
1356
  setTimeout(() => {
1357
- !c.defaultPrevented && O.current === w && E(i);
1357
+ !c.defaultPrevented && L.current === w && E(i);
1358
1358
  }, 0);
1359
1359
  },
1360
1360
  [E]
@@ -1365,78 +1365,78 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1365
1365
  }, 0);
1366
1366
  },
1367
1367
  [E]
1368
- ), I = H(() => ({ navigation: l, currentPath: e, scrollWithin: E, followSameUrlJump: y, followEmptyFragment: $ }), [l, e, E, y, $]), C = P(() => R.retry(e), [R, e]), B = Pn(R, xr), M = ee((i, c) => {
1368
+ ), j = H(() => ({ navigation: l, currentPath: e, scrollWithin: E, followSameUrlJump: y, followEmptyFragment: $ }), [l, e, E, y, $]), M = P(() => R.retry(e), [R, e]), _ = Pn(R, xr), G = te((i, c) => {
1369
1369
  const w = T.current;
1370
1370
  if (w !== null && w.path === i && w.snapshot === c) return;
1371
1371
  T.current = { path: i, snapshot: c };
1372
1372
  const v = c.document;
1373
1373
  if (v.kind === "failure") {
1374
- R.noteFailureShown(c) && h(g.documentFailed(vt(i), ve(g, v.failure.reason)));
1374
+ R.noteFailureShown(c) && p(h.documentFailed(wt(i), ve(h, v.failure.reason)));
1375
1375
  return;
1376
1376
  }
1377
- m?.(i, v), f && (w === null || w.path !== i || w.snapshot.document.kind === "failure") && b.announce(g.documentShown(v.name));
1377
+ m?.(i, v), f && (w === null || w.path !== i || w.snapshot.document.kind === "failure") && b.announce(h.documentShown(v.name));
1378
1378
  });
1379
- J(() => {
1380
- M(e, t);
1379
+ ee(() => {
1380
+ G(e, t);
1381
1381
  }, [e, t]);
1382
- const _ = ee(() => {
1382
+ const O = te(() => {
1383
1383
  s.kind === "panel" && s.consume();
1384
- }), Q = ee((i) => {
1384
+ }), V = te((i) => {
1385
1385
  const c = A.current;
1386
1386
  if (c === null || !u.current) return null;
1387
1387
  const { activeElement: w, body: v } = c.ownerDocument;
1388
1388
  return w !== null && w !== v ? null : Xr(c, k, i);
1389
- }), oe = ee((i) => {
1389
+ }), X = te((i) => {
1390
1390
  const c = A.current;
1391
- c !== null && it(c, i, u.current);
1392
- }), W = ee((i) => a.reveal(i)), Te = ee((i) => tt(A.current, i, a));
1393
- return J(() => {
1391
+ c !== null && st(c, i, u.current);
1392
+ }), Y = te((i) => a.reveal(i)), Te = te((i) => nt(A.current, i, a));
1393
+ return ee(() => {
1394
1394
  if (n) return;
1395
- const i = p.current.path !== e, c = i || p.current.document !== k;
1396
- p.current = { path: e, document: k };
1395
+ const i = g.current.path !== e, c = i || g.current.document !== k;
1396
+ g.current = { path: e, document: k };
1397
1397
  const w = S.current !== e;
1398
1398
  S.current = e;
1399
1399
  let v = null;
1400
- s.kind === "page" ? F.current !== s.navigation && (F.current = s.navigation, O.current += 1, v = s.fragment) : s.fragment !== null && (v = s.fragment, _());
1401
- const L = () => {
1400
+ s.kind === "page" ? F.current !== s.navigation && (F.current = s.navigation, L.current += 1, v = s.fragment) : s.fragment !== null && (v = s.fragment, O());
1401
+ const C = () => {
1402
1402
  const N = v === null ? null : Te(v);
1403
1403
  if (!c) {
1404
- N !== null && oe(N);
1404
+ N !== null && X(N);
1405
1405
  return;
1406
1406
  }
1407
- const q = Q(s.fragment);
1408
- i && N === null && q !== null && W(q);
1407
+ const q = V(s.fragment);
1408
+ i && N === null && q !== null && Y(q);
1409
1409
  };
1410
- w ? queueMicrotask(L) : L();
1411
- }, [s, e, k, n]), /* @__PURE__ */ d(ze, { kind: k.kind, label: o(e, k), stale: n, busy: n, frameRef: A, intent: B, children: /* @__PURE__ */ d(Nt, { value: I, children: /* @__PURE__ */ d(Sr, { children: /* @__PURE__ */ d(Kr, { path: e, document: k, viewer: r, onRetry: C }, e) }) }) });
1412
- }, je = Object.freeze({ kind: "skeleton" }), eo = (e, t, n, r, o) => {
1410
+ w ? queueMicrotask(C) : C();
1411
+ }, [s, e, k, n]), /* @__PURE__ */ d(je, { kind: k.kind, label: o(e, k), stale: n, busy: n, frameRef: A, intent: _, children: /* @__PURE__ */ d(Mt, { value: j, children: /* @__PURE__ */ d(Sr, { children: /* @__PURE__ */ d(Kr, { path: e, document: k, viewer: r, onRetry: M }, e) }) }) });
1412
+ }, He = Object.freeze({ kind: "skeleton" }), eo = (e, t, n, r, o) => {
1413
1413
  if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
1414
- const l = he(t);
1414
+ const l = pe(t);
1415
1415
  if (l !== null) return { kind: "document", path: e, snapshot: l, stale: !0 };
1416
1416
  if (o && t?.status === "pending") return { kind: "streaming", path: e, promise: t.promise };
1417
- const s = n === null || n === e ? null : he(r);
1418
- return n === null || s === null ? je : { kind: "document", path: n, snapshot: s, stale: !0 };
1419
- }, to = (e, t) => t.status === "deferred" ? je : { kind: "document", path: e, snapshot: t, stale: !1 }, no = ({ requestedPath: e, content: t, ...n }) => {
1420
- const r = t.kind === "streaming" ? to(t.path, G(t.promise)) : t;
1421
- return r.kind !== "document" ? /* @__PURE__ */ d(Ft, { label: n.regionLabel(e, null) }) : /* @__PURE__ */ d(Qr, { path: r.path, snapshot: r.snapshot, stale: r.stale, ...n });
1422
- }, _t = ({ path: e, display: t, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: a }) => {
1423
- const { config: f, labels: h, theme: m, documents: g } = D(), b = nn(), R = j(!1);
1424
- V(() => {
1417
+ const s = n === null || n === e ? null : pe(r);
1418
+ return n === null || s === null ? He : { kind: "document", path: n, snapshot: s, stale: !0 };
1419
+ }, to = (e, t) => t.status === "deferred" ? He : { kind: "document", path: e, snapshot: t, stale: !1 }, no = ({ requestedPath: e, content: t, ...n }) => {
1420
+ const r = t.kind === "streaming" ? to(t.path, W(t.promise)) : t;
1421
+ return r.kind !== "document" ? /* @__PURE__ */ d(Dt, { label: n.regionLabel(e, null) }) : /* @__PURE__ */ d(Qr, { path: r.path, snapshot: r.snapshot, stale: r.stale, ...n });
1422
+ }, Ft = ({ path: e, display: t, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: a }) => {
1423
+ const { config: f, labels: p, theme: m, documents: h } = D(), b = tn(), R = z(!1);
1424
+ U(() => {
1425
1425
  R.current = !0;
1426
1426
  }, []);
1427
- const [k, A] = Z(null), T = P(() => e === null ? void 0 : g.peek(e), [g, e]), F = ne(g.subscribe, T, T), O = P(() => k === null ? void 0 : g.peek(k), [g, k]), u = ne(g.subscribe, O, O);
1428
- V(() => e === null ? void 0 : g.open(e), [g, e]), V(() => k === null ? void 0 : g.retain(k), [g, k]);
1429
- const p = e === null ? je : eo(e, F, k, u, !R.current), S = e === null ? null : p.kind === "document" && !p.stale ? p.path : k;
1427
+ const [k, A] = I(null), T = P(() => e === null ? void 0 : h.peek(e), [h, e]), F = re(h.subscribe, T, T), L = P(() => k === null ? void 0 : h.peek(k), [h, k]), u = re(h.subscribe, L, L);
1428
+ U(() => e === null ? void 0 : h.open(e), [h, e]), U(() => k === null ? void 0 : h.retain(k), [h, k]);
1429
+ const g = e === null ? He : eo(e, F, k, u, !R.current), S = e === null ? null : g.kind === "document" && !g.stale ? g.path : k;
1430
1430
  S !== k && A(S);
1431
- const E = H(() => Hr(h), [h]), y = H(() => [...f.iframeHosts], [f]), $ = n.kind === "panel", I = H(
1431
+ const E = H(() => Hr(p), [p]), y = H(() => [...f.iframeHosts], [f]), $ = n.kind === "panel", j = H(
1432
1432
  () => ({
1433
1433
  labels: E,
1434
- emptyMessage: h.documentEmpty,
1434
+ emptyMessage: p.documentEmpty,
1435
1435
  theme: m,
1436
1436
  availableStyles: f.documentStyles,
1437
1437
  iFrameAllowedDomains: y,
1438
1438
  embeds: f.embeds,
1439
- linkComponent: Lr,
1439
+ linkComponent: Or,
1440
1440
  toolbar: b,
1441
1441
  style: t.style,
1442
1442
  onStyleChange: t.onStyleChange,
@@ -1448,13 +1448,13 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1448
1448
  padding: t.padding,
1449
1449
  width: t.width === void 0 ? void 0 : `min(${t.width}, 100%)`,
1450
1450
  maxWidth: t.maxWidth === void 0 ? void 0 : `min(${t.maxWidth}, 100%)`,
1451
- renderScrollBar: $ ? void 0 : Rt
1451
+ renderScrollBar: $ ? void 0 : kt
1452
1452
  }),
1453
- [E, h.documentEmpty, m, f.documentStyles, y, f.embeds, b, t, $]
1454
- ), C = P((M, _) => $ ? _ === null || _.kind === "failure" ? vt(M) : _.name : h.documentRegion, [$, h.documentRegion]), B = $ ? "content" : "fill";
1455
- return e === null ? /* @__PURE__ */ d(pe, { value: B, children: /* @__PURE__ */ d(Ur, {}) }) : /* @__PURE__ */ d(pe, { value: B, children: /* @__PURE__ */ d(fe, { fallback: /* @__PURE__ */ d(Ft, { label: C(e, null) }), children: /* @__PURE__ */ d(no, { requestedPath: e, content: p, viewer: I, regionLabel: C, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: a }) }) });
1453
+ [E, p.documentEmpty, m, f.documentStyles, y, f.embeds, b, t, $]
1454
+ ), M = P((G, O) => $ ? O === null || O.kind === "failure" ? wt(G) : O.name : p.documentRegion, [$, p.documentRegion]), _ = $ ? "content" : "fill";
1455
+ return e === null ? /* @__PURE__ */ d(ge, { value: _, children: /* @__PURE__ */ d(Ur, {}) }) : /* @__PURE__ */ d(ge, { value: _, children: /* @__PURE__ */ d(fe, { fallback: /* @__PURE__ */ d(Dt, { label: M(e, null) }), children: /* @__PURE__ */ d(no, { requestedPath: e, content: g, viewer: j, regionLabel: M, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: a }) }) });
1456
1456
  }, ro = ({ path: e, variant: t, onDocumentShown: n }) => {
1457
- const { config: r, viewSettings: o, announcer: l } = D(), s = me((y) => y.style), a = me((y) => y.align), f = _e(), h = pt(), m = De(), { view: g, overrides: b, embed: R } = t, k = P(
1457
+ const { config: r, viewSettings: o, announcer: l } = D(), s = me((y) => y.style), a = me((y) => y.align), f = qe(), p = pt(), m = Fe(), { view: h, overrides: b, embed: R } = t, k = P(
1458
1458
  (y) => {
1459
1459
  if (m.kind !== "location") return;
1460
1460
  const $ = Zr(r, m.location, y);
@@ -1471,11 +1471,11 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1471
1471
  o.update({ align: y }), k("align");
1472
1472
  },
1473
1473
  [o, k]
1474
- ), F = $t(r, b.style, s), O = Dt(b.align, a), u = H(
1474
+ ), F = Pt(r, b.style, s), L = $t(b.align, a), u = H(
1475
1475
  () => ({
1476
1476
  style: F,
1477
1477
  onStyleChange: A,
1478
- align: O,
1478
+ align: L,
1479
1479
  onAlignChange: T,
1480
1480
  showToc: R.showToc !== !1,
1481
1481
  showStyle: R.showStyle !== !1,
@@ -1484,26 +1484,26 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1484
1484
  width: R.width,
1485
1485
  maxWidth: R.maxWidth
1486
1486
  }),
1487
- [F, A, O, T, R]
1488
- ), p = H(() => ({ kind: "page", view: g, overrides: b, embed: R }), [g, b, R]), S = H(() => ({ kind: "page", fragment: h.hash, navigation: h }), [h]), E = P((y) => l.announce(y), [l]);
1489
- return /* @__PURE__ */ d(_t, { path: e, display: u, navigation: p, fragment: S, paneScroll: er, announces: !0, announceFailure: E, onDocumentShown: n });
1487
+ [F, A, L, T, R]
1488
+ ), g = H(() => ({ kind: "page", view: h, overrides: b, embed: R }), [h, b, R]), S = H(() => ({ kind: "page", fragment: p.hash, navigation: p }), [p]), E = P((y) => l.announce(y), [l]);
1489
+ return /* @__PURE__ */ d(Ft, { path: e, display: u, navigation: g, fragment: S, paneScroll: er, announces: !0, announceFailure: E, onDocumentShown: n });
1490
1490
  }, oo = ({ path: e, variant: t, onDocumentShown: n }) => {
1491
- const { config: r, viewSettings: o } = D(), l = me((p) => p.style), s = me((p) => p.align), [a, f] = Z(() => $t(r, void 0, l)), h = Dt(void 0, s), m = P((p) => o.update({ align: p }), [o]), { maximized: g, onDocumentLink: b, pendingHash: R, onHashConsumed: k, announceFailure: A, paneScroll: T } = t, F = H(
1491
+ const { config: r, viewSettings: o } = D(), l = me((g) => g.style), s = me((g) => g.align), [a, f] = I(() => Pt(r, void 0, l)), p = $t(void 0, s), m = P((g) => o.update({ align: g }), [o]), { maximized: h, onDocumentLink: b, pendingHash: R, onHashConsumed: k, announceFailure: A, paneScroll: T } = t, F = H(
1492
1492
  () => ({
1493
1493
  style: a,
1494
1494
  onStyleChange: f,
1495
- align: h,
1495
+ align: p,
1496
1496
  onAlignChange: m,
1497
- showToc: g,
1498
- showStyle: g,
1499
- showAlign: g,
1497
+ showToc: h,
1498
+ showStyle: h,
1499
+ showAlign: h,
1500
1500
  padding: void 0,
1501
1501
  width: void 0,
1502
1502
  maxWidth: void 0
1503
1503
  }),
1504
- [a, h, m, g]
1505
- ), O = H(() => ({ kind: "panel", onDocumentLink: b }), [b]), u = H(() => ({ kind: "panel", fragment: R, consume: k }), [R, k]);
1506
- return /* @__PURE__ */ d(_t, { path: e, display: F, navigation: O, fragment: u, paneScroll: T, announces: !1, announceFailure: A, onDocumentShown: n });
1504
+ [a, p, m, h]
1505
+ ), L = H(() => ({ kind: "panel", onDocumentLink: b }), [b]), u = H(() => ({ kind: "panel", fragment: R, consume: k }), [R, k]);
1506
+ return /* @__PURE__ */ d(Ft, { path: e, display: F, navigation: L, fragment: u, paneScroll: T, announces: !1, announceFailure: A, onDocumentShown: n });
1507
1507
  }, lo = ({ path: e, variant: t, onDocumentShown: n }) => t.kind === "page" ? /* @__PURE__ */ d(ro, { path: e, variant: t, onDocumentShown: n }) : /* @__PURE__ */ d(oo, { path: e, variant: t, onDocumentShown: n });
1508
1508
  function io({
1509
1509
  title: e,
@@ -1527,16 +1527,16 @@ function io({
1527
1527
  }));
1528
1528
  }
1529
1529
  const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co = (e, t) => {
1530
- const { documents: n, announcer: r, labels: o } = D(), l = P(() => n.peek(e), [n, e]), s = P(() => n.peekSeeded(e), [n, e]), a = ne(n.subscribe, l, s), f = P(() => n.answerStampOf(e), [n, e]), h = ne(n.subscribe, f, f), [m] = Z(() => /* @__PURE__ */ new Set()), [g, b] = Z(ao), [R, k] = Z(null);
1530
+ const { documents: n, announcer: r, labels: o } = D(), l = P(() => n.peek(e), [n, e]), s = P(() => n.peekSeeded(e), [n, e]), a = re(n.subscribe, l, s), f = P(() => n.answerStampOf(e), [n, e]), p = re(n.subscribe, f, f), [m] = I(() => /* @__PURE__ */ new Set()), [h, b] = I(ao), [R, k] = I(null);
1531
1531
  R !== null && R.path !== e && k(null);
1532
- const A = j(null);
1533
- V(() => (A.current = e, () => {
1532
+ const A = z(null);
1533
+ U(() => (A.current = e, () => {
1534
1534
  A.current = null;
1535
1535
  }), [e]);
1536
1536
  const T = P(() => {
1537
- const u = e, p = n.peek(u);
1538
- if (m.has(u) || p?.status === "pending") return;
1539
- const S = t && !Ot(p);
1537
+ const u = e, g = n.peek(u);
1538
+ if (m.has(u) || g?.status === "pending") return;
1539
+ const S = t && !At(g);
1540
1540
  m.add(u), b(new Set(m)), k(null), (async () => {
1541
1541
  try {
1542
1542
  const E = await n.refresh(u);
@@ -1545,21 +1545,21 @@ const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co
1545
1545
  k({ path: u, failure: E.failure, stamp: n.answerStampOf(u) }), r.announce(o.documentRefreshFailed(ve(o, E.failure.reason)));
1546
1546
  return;
1547
1547
  }
1548
- const y = he(n.peek(u));
1548
+ const y = pe(n.peek(u));
1549
1549
  if (S || y === null || y.document.kind === "failure") return;
1550
1550
  r.announce(o.documentRefreshed(y.document.name));
1551
1551
  } finally {
1552
1552
  m.delete(u), b(new Set(m));
1553
1553
  }
1554
1554
  })();
1555
- }, [e, t, m, n, r, o]), F = g.has(e), O = R !== null && R.path === e && R.stamp === h ? R.failure : null;
1556
- return { refreshing: F, unavailable: F || a?.status === "pending", failure: O, refresh: T };
1555
+ }, [e, t, m, n, r, o]), F = h.has(e), L = R !== null && R.path === e && R.stamp === p ? R.failure : null;
1556
+ return { refreshing: F, unavailable: F || a?.status === "pending", failure: L, refresh: T };
1557
1557
  }, uo = Object.freeze({ kind: "page" }), fo = (e) => {
1558
1558
  e.stopPropagation();
1559
1559
  }, mo = ({ path: e, placement: t }) => {
1560
1560
  const { labels: n } = D(), { refreshing: r, unavailable: o, failure: l, refresh: s } = co(e, t.kind === "page"), a = t.kind === "panel" ? n.refreshDocumentNamed(t.documentName) : null;
1561
- return /* @__PURE__ */ U("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", children: [
1562
- /* @__PURE__ */ d("div", { className: "aqmx-document-refresh-row", children: /* @__PURE__ */ U(
1561
+ return /* @__PURE__ */ Z("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", children: [
1562
+ /* @__PURE__ */ d("div", { className: "aqmx-document-refresh-row", children: /* @__PURE__ */ Z(
1563
1563
  "button",
1564
1564
  {
1565
1565
  type: "button",
@@ -1580,112 +1580,131 @@ const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co
1580
1580
  ) }),
1581
1581
  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(ve(n, l.reason)) })
1582
1582
  ] });
1583
- }, go = ({ location: e }) => {
1583
+ }, ho = ({ location: e }) => {
1584
1584
  const t = e.doc, n = H(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]);
1585
- return /* @__PURE__ */ U("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", children: [
1585
+ return /* @__PURE__ */ Z("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", children: [
1586
1586
  /* @__PURE__ */ d(mo, { path: t, placement: uo }),
1587
1587
  /* @__PURE__ */ d(lo, { path: t, variant: n })
1588
1588
  ] });
1589
- }, ho = ({ holds: e, testId: t }) => {
1590
- const { labels: n, announcer: r } = D(), o = jt();
1591
- V(() => e ? r.claim(o) : void 0, [e, r, o]);
1592
- const l = P(() => r.shownIn(o), [r, o]), s = ne(r.subscribe, l, l);
1589
+ }, po = ({ holds: e, testId: t }) => {
1590
+ const { labels: n, announcer: r } = D(), o = zt();
1591
+ U(() => e ? r.claim(o) : void 0, [e, r, o]);
1592
+ const l = P(() => r.shownIn(o), [r, o]), s = re(r.subscribe, l, l);
1593
1593
  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] });
1594
- }, te = Object.freeze([]), st = (e) => {
1594
+ }, ne = Object.freeze([]), go = (e) => {
1595
1595
  const t = /* @__PURE__ */ new Set();
1596
- let n = te, r = [], o = !1;
1596
+ let n = ne, r = [], o = !1;
1597
1597
  const l = [], s = (m) => {
1598
1598
  n = m;
1599
- for (const g of [...t]) g();
1599
+ for (const h of [...t]) h();
1600
1600
  }, a = () => l.at(-1)?.region, f = (m) => {
1601
- const g = a();
1602
- m(), a() !== g && n !== te && s(te);
1603
- }, h = () => {
1601
+ const h = a();
1602
+ m(), a() !== h && n !== ne && s(ne);
1603
+ }, p = () => {
1604
1604
  o = !1;
1605
- const m = r.map((g) => "sentence" in g ? g.sentence : g.list(g.items));
1605
+ const m = r.map((h) => "sentence" in h ? h.sentence : h.list(h.items));
1606
1606
  r = [], s(Object.freeze(m));
1607
1607
  };
1608
1608
  return {
1609
1609
  announce: (m) => {
1610
1610
  if (typeof m == "string") r.push({ sentence: m });
1611
1611
  else {
1612
- const g = r.find((b) => "list" in b && b.list === m.list);
1613
- g !== void 0 && "items" in g ? g.items.push(m.item) : r.push({ list: m.list, items: [m.item] });
1612
+ const h = r.find((b) => "list" in b && b.list === m.list);
1613
+ h !== void 0 && "items" in h ? h.items.push(m.item) : r.push({ list: m.list, items: [m.item] });
1614
1614
  }
1615
- o || (o = !0, n !== te && s(te), e.request(h));
1615
+ o || (o = !0, n !== ne && s(ne), e.request(p));
1616
1616
  },
1617
1617
  subscribe: (m) => (t.add(m), () => {
1618
1618
  t.delete(m);
1619
1619
  }),
1620
1620
  claim: (m) => {
1621
- const g = { region: m };
1622
- return f(() => l.push(g)), () => f(() => {
1623
- const b = l.indexOf(g);
1621
+ const h = { region: m };
1622
+ return f(() => l.push(h)), () => f(() => {
1623
+ const b = l.indexOf(h);
1624
1624
  b !== -1 && l.splice(b, 1);
1625
1625
  });
1626
1626
  },
1627
- shownIn: (m) => a() === m ? n : te
1627
+ shownIn: (m) => a() === m ? n : ne
1628
1628
  };
1629
- }, at = Object.freeze({ status: "cancelled" }), po = (e) => {
1629
+ }, Le = Object.freeze({ status: "cancelled" }), wo = (e) => {
1630
1630
  if (e === null || typeof e != "object") return null;
1631
1631
  const { failure: t } = e;
1632
1632
  if (an(t) !== null) return null;
1633
1633
  const { reason: n, code: r } = t;
1634
1634
  return cn(n, r);
1635
- }, wo = ({ dataPath: e, onScope: t, fetch: n }) => {
1636
- const r = n ?? ((a, f) => globalThis.fetch(a, f)), o = (a, f) => `${e}/${a}?${new URLSearchParams(f).toString()}`, l = async (a, f, h, m) => {
1637
- let g;
1635
+ }, vo = ({ dataPath: e, onScope: t, fetch: n }) => {
1636
+ const r = n ?? ((a, f) => globalThis.fetch(a, f)), o = (a, f) => `${e}/${a}?${new URLSearchParams(f).toString()}`, l = async (a, f, p, m) => {
1637
+ let h;
1638
1638
  try {
1639
- g = await r(a, { credentials: "same-origin", ...f, headers: { Accept: "application/json", ...f.headers } });
1639
+ h = await r(a, { credentials: "same-origin", ...f, headers: { Accept: "application/json", ...f.headers } });
1640
1640
  } catch {
1641
1641
  return m({ reason: "failed" });
1642
1642
  }
1643
- g.status === 401 && t(null);
1644
- const b = g.headers.get(on);
1643
+ h.status === 401 && t(null);
1644
+ const b = h.headers.get(rn);
1645
1645
  b !== null && t(b);
1646
1646
  let R;
1647
1647
  try {
1648
- R = await g.json();
1648
+ R = await h.json();
1649
1649
  } catch {
1650
- return m({ reason: Ue(g.status) });
1650
+ return m({ reason: Ve(h.status) });
1651
1651
  }
1652
1652
  let k;
1653
1653
  try {
1654
- k = h(R);
1654
+ k = p(R);
1655
1655
  } catch {
1656
1656
  k = !1;
1657
1657
  }
1658
1658
  if (k) return R;
1659
- const A = po(R);
1660
- return m(A !== null ? A : { reason: g.status === 200 ? "failed" : Ue(g.status) });
1659
+ const A = wo(R);
1660
+ return m(A !== null ? A : { reason: h.status === 200 ? "failed" : Ve(h.status) });
1661
1661
  }, s = { [mn]: dn };
1662
1662
  return {
1663
- tree: (a) => l(o("tree", { [Y.source]: a }), { method: "GET" }, Ve, (f) => ({ status: "error", failure: f })),
1664
- children: async (a, f, h) => {
1665
- const m = await l(o("children", { [Y.source]: a, [Y.path]: f }), { method: "GET", signal: h }, sn, (g) => ({ status: "error", failure: g }));
1666
- return h.aborted ? at : m;
1663
+ tree: (a) => l(o("tree", { [K.source]: a }), { method: "GET" }, Ge, (f) => ({ status: "error", failure: f })),
1664
+ children: async (a, f, p) => {
1665
+ const m = await l(o("children", { [K.source]: a, [K.path]: f }), { method: "GET", signal: p }, sn, (h) => ({ status: "error", failure: h }));
1666
+ return p.aborted ? Le : m;
1667
+ },
1668
+ ancestors: async (a, f, p) => {
1669
+ const m = await l(o("ancestors", { [K.source]: a, [K.path]: f }), { method: "GET", signal: p }, ln, (h) => ({ status: "error", failure: h }));
1670
+ return p.aborted ? Le : m;
1671
+ },
1672
+ reveal: async (a, f, p) => {
1673
+ const m = await l(o("reveal", { [K.source]: a, [K.path]: f }), { method: "GET", signal: p }, on, (h) => ({ status: "error", failure: h }));
1674
+ return p.aborted ? Le : m;
1675
+ },
1676
+ document: (a, { refresh: f }) => l(o("document", { [K.path]: a }), f ? { method: "GET", headers: s } : { method: "GET" }, fn, (p) => un(p.reason, p.code)),
1677
+ refresh: (a) => l(o("refresh", { [K.source]: a }), { method: "POST", headers: s }, Ge, (f) => ({ status: "error", failure: f }))
1678
+ };
1679
+ }, bo = () => {
1680
+ let e = null, t = null;
1681
+ return {
1682
+ settle: (n) => {
1683
+ e = n;
1667
1684
  },
1668
- ancestors: async (a, f, h) => {
1669
- const m = await l(o("ancestors", { [Y.source]: a, [Y.path]: f }), { method: "GET", signal: h }, ln, (g) => ({ status: "error", failure: g }));
1670
- return h.aborted ? at : m;
1685
+ mayMove: (n) => e !== n,
1686
+ move: (n, r, o) => {
1687
+ e = r, t = { sourceId: n, path: r, ancestors: o };
1671
1688
  },
1672
- document: (a, { refresh: f }) => l(o("document", { [Y.path]: a }), f ? { method: "GET", headers: s } : { method: "GET" }, fn, (h) => un(h.reason, h.code)),
1673
- refresh: (a) => l(o("refresh", { [Y.source]: a }), { method: "POST", headers: s }, Ve, (f) => ({ status: "error", failure: f }))
1689
+ take: (n, r) => {
1690
+ const o = t !== null && t.sourceId === n && t.path === r ? t.ancestors : null;
1691
+ return t = null, o;
1692
+ }
1674
1693
  };
1675
- }, vo = (e) => {
1676
- const t = pn(e);
1677
- if (t === null) return Ie;
1694
+ }, Eo = (e) => {
1695
+ const t = gn(e);
1696
+ if (t === null) return Ze;
1678
1697
  try {
1679
- return Qt(JSON.parse(t));
1698
+ return Jt(JSON.parse(t));
1680
1699
  } catch (n) {
1681
- return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), Ie;
1700
+ return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), Ze;
1682
1701
  }
1683
- }, ct = (e, t) => {
1702
+ }, at = (e, t) => {
1684
1703
  let n = null;
1685
1704
  const r = () => {
1686
1705
  if (n === null) {
1687
- const l = vo(e);
1688
- n = { changes: l, settings: He(t, l) };
1706
+ const l = Eo(e);
1707
+ n = { changes: l, settings: Ie(t, l) };
1689
1708
  }
1690
1709
  return n;
1691
1710
  }, o = be();
@@ -1696,178 +1715,178 @@ const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co
1696
1715
  getServerSnapshot: () => t,
1697
1716
  subscribe: o.subscribe,
1698
1717
  advance: (l) => {
1699
- const { changes: s, settings: a } = r(), f = Yt(s, l, Xt(a, l)[l], t);
1700
- return n = { changes: f, settings: He(t, f) }, o.emit(), hn(e, Jt(f)), n.settings;
1718
+ const { changes: s, settings: a } = r(), f = Kt(s, l, Yt(a, l)[l], t);
1719
+ return n = { changes: f, settings: Ie(t, f) }, o.emit(), pn(e, Xt(f)), n.settings;
1701
1720
  }
1702
1721
  };
1703
- }, bo = Object.freeze({ status: "refreshed" }), Eo = Object.freeze({ status: "superseded" }), Pe = Object.freeze({ status: "deferred" }), So = At(Pe), qt = 4, yo = qt - 1, dt = Object.freeze({ status: "loading" }), xo = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), ko = (e) => {
1704
- const t = /* @__PURE__ */ new Map(), n = Tt(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = be(), f = /* @__PURE__ */ new Set();
1705
- let h = 0, m = 0;
1706
- const g = { direct: null, bulk: null }, b = /* @__PURE__ */ new Set();
1722
+ }, So = Object.freeze({ status: "refreshed" }), yo = Object.freeze({ status: "superseded" }), $e = Object.freeze({ status: "deferred" }), xo = Tt($e), _t = 4, ko = _t - 1, ct = Object.freeze({ status: "loading" }), Ro = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), To = (e) => {
1723
+ const t = /* @__PURE__ */ new Map(), n = Rt(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = be(), f = /* @__PURE__ */ new Set();
1724
+ let p = 0, m = 0;
1725
+ const h = { direct: null, bulk: null }, b = /* @__PURE__ */ new Set();
1707
1726
  let R = !1, k = 0;
1708
1727
  const A = () => {
1709
1728
  k += 1, a.emit();
1710
1729
  }, T = (i) => o.get(i) ?? 0, F = (i) => {
1711
1730
  let c = s.get(i);
1712
1731
  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;
1713
- }, O = (i, c, w) => {
1714
- i.inFlight.delete(c), h -= 1, w.lane === "bulk" && (m -= 1);
1732
+ }, L = (i, c, w) => {
1733
+ i.inFlight.delete(c), p -= 1, w.lane === "bulk" && (m -= 1);
1715
1734
  }, u = (i) => {
1716
1735
  const c = s.get(i);
1717
1736
  if (c !== void 0) {
1718
1737
  for (const [w, v] of [...c.inFlight])
1719
- O(c, w, v), v.controller.abort();
1738
+ L(c, w, v), v.controller.abort();
1720
1739
  c.direct.clear(), c.bulk.clear(), c.unclaimed.clear();
1721
1740
  }
1722
- }, p = (i) => {
1741
+ }, g = (i) => {
1723
1742
  const c = T(i) + 1;
1724
1743
  return o.set(i, c), u(i), c;
1725
1744
  }, S = (i, c) => {
1726
1745
  const w = ae(i), v = { promise: i, opened: c, stale: !1, loadedAt: w?.status === "ok" ? w.loadedAt : null };
1727
- return i.status === "pending" && i.then((L) => {
1728
- L.status === "ok" && (v.loadedAt = L.loadedAt);
1746
+ return i.status === "pending" && i.then((C) => {
1747
+ C.status === "ok" && (v.loadedAt = C.loadedAt);
1729
1748
  }), v;
1730
1749
  }, E = (i) => {
1731
1750
  let c = r.get(i);
1732
1751
  return c === void 0 && (c = /* @__PURE__ */ new Map(), r.set(i, c)), c;
1733
1752
  }, y = (i) => {
1734
- const c = [...s.keys()], w = g[i], v = w === null ? 0 : c.indexOf(w) + 1;
1735
- for (let L = 0; L < c.length; L += 1) {
1736
- const N = c[(v + L) % c.length], q = N === void 0 ? void 0 : s.get(N);
1753
+ const c = [...s.keys()], w = h[i], v = w === null ? 0 : c.indexOf(w) + 1;
1754
+ for (let C = 0; C < c.length; C += 1) {
1755
+ const N = c[(v + C) % c.length], q = N === void 0 ? void 0 : s.get(N);
1737
1756
  if (!(N === void 0 || q === void 0)) {
1738
- for (const z of q[i])
1739
- if ((q.claims.get(z) ?? 0) !== 0)
1740
- return q[i].delete(z), g[i] = N, { sourceId: N, path: z };
1757
+ for (const B of q[i])
1758
+ if ((q.claims.get(B) ?? 0) !== 0)
1759
+ return q[i].delete(B), h[i] = N, { sourceId: N, path: B };
1741
1760
  }
1742
1761
  }
1743
1762
  return null;
1744
1763
  }, $ = (i, c, w, v) => {
1745
- const L = s.get(i);
1746
- if (L === void 0 || L.inFlight.get(c) !== w) return;
1747
- O(L, c, w);
1748
- const N = (L.claims.get(c) ?? 0) > 0, q = E(i);
1764
+ const C = s.get(i);
1765
+ if (C === void 0 || C.inFlight.get(c) !== w) return;
1766
+ L(C, c, w);
1767
+ const N = (C.claims.get(c) ?? 0) > 0, q = E(i);
1749
1768
  if (v.status === "ok" ? q.set(c, { status: "loaded", entries: v.entries }) : v.status === "error" && N ? q.set(c, { status: "failed", failure: v.failure }) : q.delete(c), A(), v.status === "error" && N) {
1750
- const z = { sourceId: i, path: c, failure: v.failure };
1751
- for (const K of [...f]) K(z);
1769
+ const B = { sourceId: i, path: c, failure: v.failure };
1770
+ for (const J of [...f]) J(B);
1752
1771
  }
1753
- C();
1754
- }, I = (i, c, w) => {
1772
+ M();
1773
+ }, j = (i, c, w) => {
1755
1774
  const v = { controller: new AbortController(), lane: w };
1756
- F(i).inFlight.set(c, v), h += 1, w === "bulk" && (m += 1), e.children(i, c, v.controller.signal).then(
1757
- (L) => $(i, c, v, L),
1758
- () => $(i, c, v, xo)
1775
+ F(i).inFlight.set(c, v), p += 1, w === "bulk" && (m += 1), e.children(i, c, v.controller.signal).then(
1776
+ (C) => $(i, c, v, C),
1777
+ () => $(i, c, v, Ro)
1759
1778
  );
1760
- }, C = () => {
1761
- for (; h < qt; ) {
1779
+ }, M = () => {
1780
+ for (; p < _t; ) {
1762
1781
  const i = y("direct");
1763
1782
  if (i !== null) {
1764
- I(i.sourceId, i.path, "direct");
1783
+ j(i.sourceId, i.path, "direct");
1765
1784
  continue;
1766
1785
  }
1767
- const c = m < yo ? y("bulk") : null;
1786
+ const c = m < ko ? y("bulk") : null;
1768
1787
  if (c === null) return;
1769
- I(c.sourceId, c.path, "bulk");
1788
+ j(c.sourceId, c.path, "bulk");
1770
1789
  }
1771
- }, B = (i, c, w) => {
1790
+ }, _ = (i, c, w) => {
1772
1791
  if (!(c.direct.delete(w) || c.bulk.delete(w))) {
1773
- const L = c.inFlight.get(w);
1774
- if (L === void 0) return !1;
1775
- O(c, w, L), L.controller.abort();
1792
+ const C = c.inFlight.get(w);
1793
+ if (C === void 0) return !1;
1794
+ L(c, w, C), C.controller.abort();
1776
1795
  }
1777
1796
  return r.get(i)?.delete(w), !0;
1778
- }, M = () => {
1797
+ }, G = () => {
1779
1798
  R = !1;
1780
1799
  let i = !1;
1781
1800
  for (const c of b) {
1782
1801
  const w = F(c);
1783
1802
  for (const v of w.unclaimed)
1784
- (w.claims.get(v) ?? 0) === 0 && B(c, w, v) && (i = !0);
1803
+ (w.claims.get(v) ?? 0) === 0 && _(c, w, v) && (i = !0);
1785
1804
  w.unclaimed.clear();
1786
1805
  }
1787
- b.clear(), i && (A(), C());
1788
- }, _ = (i, c) => {
1806
+ b.clear(), i && (A(), M());
1807
+ }, O = (i, c) => {
1789
1808
  t.set(i, S(ie(e.tree(i)), c));
1790
- }, Q = (i, c, w) => {
1791
- p(i);
1792
- const v = S(At(c), w);
1793
- return t.set(i, v), r.delete(i), A(), C(), v;
1794
- }, oe = (i, c, w, v) => {
1809
+ }, V = (i, c, w) => {
1810
+ g(i);
1811
+ const v = S(Tt(c), w);
1812
+ return t.set(i, v), r.delete(i), A(), M(), v;
1813
+ }, X = (i, c, w, v) => {
1795
1814
  if (w !== T(i) || t.get(i) !== c) return;
1796
- const L = ae(c.promise);
1797
- if (!(v.status !== "ok" || L?.status !== "ok" || c.loadedAt === null || v.loadedAt <= c.loadedAt)) {
1798
- if (ge(L.entries, v.entries)) {
1815
+ const C = ae(c.promise);
1816
+ if (!(v.status !== "ok" || C?.status !== "ok" || c.loadedAt === null || v.loadedAt <= c.loadedAt)) {
1817
+ if (he(C.entries, v.entries)) {
1799
1818
  c.loadedAt = v.loadedAt;
1800
1819
  return;
1801
1820
  }
1802
- Q(i, v, c.opened);
1821
+ V(i, v, c.opened);
1803
1822
  }
1804
- }, W = (i, c) => {
1823
+ }, Y = (i, c) => {
1805
1824
  const w = t.get(i);
1806
1825
  return w !== void 0 && ae(w.promise)?.status === c;
1807
1826
  }, Te = (i, c) => {
1808
1827
  c.stale = !1;
1809
1828
  const w = T(i);
1810
- e.tree(i).then((v) => oe(i, c, w, v));
1829
+ e.tree(i).then((v) => X(i, c, w, v));
1811
1830
  };
1812
1831
  return {
1813
- read: (i) => t.get(i)?.promise ?? So,
1832
+ read: (i) => t.get(i)?.promise ?? xo,
1814
1833
  open: (i) => {
1815
1834
  const c = n.resumes(i), w = n.hold(i), v = t.get(i);
1816
- return v === void 0 || W(i, "deferred") ? (_(i, !0), A()) : c || (v.opened && W(i, "error") ? (_(i, !0), A()) : (v.opened = !0, v.stale && W(i, "ok") && Te(i, v))), w;
1835
+ return v === void 0 || Y(i, "deferred") ? (O(i, !0), A()) : c || (v.opened && Y(i, "error") ? (O(i, !0), A()) : (v.opened = !0, v.stale && Y(i, "ok") && Te(i, v))), w;
1817
1836
  },
1818
1837
  retry: (i) => {
1819
- W(i, "error") && (_(i, !0), A());
1838
+ Y(i, "error") && (O(i, !0), A());
1820
1839
  },
1821
1840
  seed: (i, c) => {
1822
1841
  const w = c.then(
1823
- (N) => N === null ? Pe : N,
1824
- () => Pe
1842
+ (N) => N === null ? $e : N,
1843
+ () => $e
1825
1844
  ), v = t.get(i);
1826
- if (v !== void 0 && W(i, "ok")) {
1845
+ if (v !== void 0 && Y(i, "ok")) {
1827
1846
  const N = T(i);
1828
- w.then((q) => oe(i, v, N, q));
1847
+ w.then((q) => X(i, v, N, q));
1829
1848
  return;
1830
1849
  }
1831
- p(i);
1832
- const L = S(ie(w), v?.opened === !0);
1833
- t.set(i, L), r.delete(i), C(), w.then((N) => {
1834
- t.get(i) === L && (N.status === "deferred" && n.isHeld(i) && _(i, L.opened), A());
1850
+ g(i);
1851
+ const C = S(ie(w), v?.opened === !0);
1852
+ t.set(i, C), r.delete(i), M(), w.then((N) => {
1853
+ t.get(i) === C && (N.status === "deferred" && n.isHeld(i) && O(i, C.opened), A());
1835
1854
  });
1836
1855
  },
1837
1856
  refresh: async (i) => {
1838
1857
  const c = (l.get(i) ?? 0) + 1;
1839
1858
  l.set(i, c);
1840
1859
  const w = await e.refresh(i);
1841
- if (l.get(i) !== c) return Eo;
1860
+ if (l.get(i) !== c) return yo;
1842
1861
  if (w.status === "error") return { status: "failed", failure: w.failure };
1843
1862
  const v = t.get(i);
1844
- if (!(v !== void 0 && v.loadedAt !== null && W(i, "ok") && v.loadedAt > w.loadedAt)) {
1845
- const N = Q(i, w, !0);
1863
+ if (!(v !== void 0 && v.loadedAt !== null && Y(i, "ok") && v.loadedAt > w.loadedAt)) {
1864
+ const N = V(i, w, !0);
1846
1865
  if (v !== void 0 && v.promise.status === "pending") {
1847
1866
  const q = T(i);
1848
- v.promise.then((z) => oe(i, N, q, z));
1867
+ v.promise.then((B) => X(i, N, q, B));
1849
1868
  }
1850
1869
  }
1851
1870
  for (const [N, q] of t)
1852
1871
  N !== i && ae(q.promise)?.status === "ok" && (q.stale = !0);
1853
- return bo;
1872
+ return So;
1854
1873
  },
1855
1874
  children: (i, c) => r.get(i)?.get(c),
1856
1875
  claimChildren: (i, c) => {
1857
1876
  const w = F(i), v = E(i);
1858
- let L = !1, N = !1;
1859
- for (const [z, K] of c)
1860
- w.claims.set(z, (w.claims.get(z) ?? 0) + 1), v.get(z) === void 0 ? (v.set(z, dt), w[K].add(z), L = !0, N = !0) : K === "direct" && w.bulk.delete(z) && (w.direct.add(z), N = !0);
1861
- L && A(), N && C();
1877
+ let C = !1, N = !1;
1878
+ for (const [B, J] of c)
1879
+ w.claims.set(B, (w.claims.get(B) ?? 0) + 1), v.get(B) === void 0 ? (v.set(B, ct), w[J].add(B), C = !0, N = !0) : J === "direct" && w.bulk.delete(B) && (w.direct.add(B), N = !0);
1880
+ C && A(), N && M();
1862
1881
  let q = !1;
1863
1882
  return () => {
1864
1883
  if (!q) {
1865
1884
  q = !0;
1866
- for (const z of c.keys()) {
1867
- const K = (w.claims.get(z) ?? 0) - 1;
1868
- K > 0 ? w.claims.set(z, K) : (w.claims.delete(z), w.unclaimed.add(z));
1885
+ for (const B of c.keys()) {
1886
+ const J = (w.claims.get(B) ?? 0) - 1;
1887
+ J > 0 ? w.claims.set(B, J) : (w.claims.delete(B), w.unclaimed.add(B));
1869
1888
  }
1870
- b.add(i), !R && (R = !0, queueMicrotask(M));
1889
+ b.add(i), !R && (R = !0, queueMicrotask(G));
1871
1890
  }
1872
1891
  };
1873
1892
  },
@@ -1876,7 +1895,7 @@ const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co
1876
1895
  if (w === void 0 || w.get(c)?.status !== "failed") return;
1877
1896
  const v = F(i);
1878
1897
  if ((v.claims.get(c) ?? 0) > 0) {
1879
- w.set(c, dt), v.direct.add(c), A(), C();
1898
+ w.set(c, ct), v.direct.add(c), A(), M();
1880
1899
  return;
1881
1900
  }
1882
1901
  w.delete(c), A();
@@ -1886,7 +1905,7 @@ const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co
1886
1905
  return c === void 0 ? 0 : c.direct.size + c.bulk.size + c.inFlight.size;
1887
1906
  },
1888
1907
  clear: () => {
1889
- for (const i of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...s.keys()])) p(i);
1908
+ for (const i of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...s.keys()])) g(i);
1890
1909
  for (const [i, c] of l) l.set(i, c + 1);
1891
1910
  t.clear(), r.clear(), A();
1892
1911
  },
@@ -1896,7 +1915,7 @@ const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co
1896
1915
  subscribe: a.subscribe,
1897
1916
  version: () => k
1898
1917
  };
1899
- }, Ro = (e, t) => {
1918
+ }, Ao = (e, t) => {
1900
1919
  let n = e;
1901
1920
  const r = be();
1902
1921
  return {
@@ -1906,64 +1925,64 @@ const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co
1906
1925
  n = { ...n, ...o }, t(n), r.emit();
1907
1926
  }
1908
1927
  };
1909
- }, To = 1;
1910
- let ce = 0, X = null;
1911
- const Ao = () => {
1928
+ }, Lo = 1;
1929
+ let ce = 0, Q = null;
1930
+ const Oo = () => {
1912
1931
  const { documentElement: e, body: t } = document;
1913
- 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;
1932
+ ce === 0 && (Q = { 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;
1914
1933
  let n = !1;
1915
1934
  return () => {
1916
- 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));
1935
+ n || (n = !0, ce -= 1, !(ce > 0 || Q === null) && (e.style.overflow = Q.htmlOverflow, t.style.overflow = Q.bodyOverflow, e.style.scrollbarGutter = Q.htmlGutter, t.style.scrollbarGutter = Q.bodyGutter, Q = null));
1917
1936
  };
1918
- }, Oo = [
1937
+ }, Co = [
1919
1938
  { selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
1920
1939
  { selector: "[data-aqmx-explorer-body]", name: "tree area" }
1921
- ], ut = 1, ft = (e) => e.getClientRects().length > 0, Oe = "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.", Lo = (e) => {
1922
- if (!ft(e)) return null;
1940
+ ], dt = 1, ut = (e) => e.getClientRects().length > 0, Oe = "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.", Mo = (e) => {
1941
+ if (!ut(e)) return null;
1923
1942
  const t = e.getBoundingClientRect(), n = window.innerHeight;
1924
- if (t.bottom > n + To)
1943
+ if (t.bottom > n + Lo)
1925
1944
  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. ${Oe}`;
1926
- if (t.height < ut)
1945
+ if (t.height < dt)
1927
1946
  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. ${Oe}`;
1928
- for (const { selector: r, name: o } of Oo)
1947
+ for (const { selector: r, name: o } of Co)
1929
1948
  for (const l of e.querySelectorAll(r)) {
1930
- if (!ft(l)) continue;
1949
+ if (!ut(l)) continue;
1931
1950
  const s = l.getBoundingClientRect().height;
1932
- if (s < ut)
1951
+ if (s < dt)
1933
1952
  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. ${Oe}`;
1934
1953
  }
1935
1954
  return null;
1936
- }, Co = (e) => {
1955
+ }, No = (e) => {
1937
1956
  let t = !1;
1938
1957
  const n = () => {
1939
1958
  if (t) return;
1940
- const o = Lo(e);
1959
+ const o = Mo(e);
1941
1960
  o !== null && (t = !0, console.error(o));
1942
1961
  }, r = typeof ResizeObserver > "u" ? null : new ResizeObserver(n);
1943
1962
  return r?.observe(e), window.addEventListener("resize", n), n(), () => {
1944
1963
  r?.disconnect(), window.removeEventListener("resize", n);
1945
1964
  };
1946
- }, Mo = (e, t) => {
1947
- J(() => e ? Ao() : void 0, [e]), J(() => {
1965
+ }, Po = (e, t) => {
1966
+ ee(() => e ? Oo() : void 0, [e]), ee(() => {
1948
1967
  const n = t.current;
1949
1968
  if (!(!e || n === null))
1950
- return Co(n);
1969
+ return No(n);
1951
1970
  }, [e, t]);
1952
- }, mt = '[data-testid="markdown-explorer-view-switch"]', No = [
1953
- { control: mt, successors: [mt, '[data-testid="markdown-explorer-sheet-toggle"]'] },
1971
+ }, ft = '[data-testid="markdown-explorer-view-switch"]', $o = [
1972
+ { control: ft, successors: [ft, '[data-testid="markdown-explorer-sheet-toggle"]'] },
1954
1973
  { control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
1955
- ], Po = (e) => {
1956
- for (const t of No) {
1974
+ ], Do = (e) => {
1975
+ for (const t of $o) {
1957
1976
  const n = e.closest(t.control);
1958
1977
  if (n !== null) return { element: n, control: t };
1959
1978
  }
1960
1979
  return null;
1961
- }, $o = (e, t) => {
1962
- const n = j(null);
1963
- J(() => {
1980
+ }, Fo = (e, t) => {
1981
+ const n = z(null);
1982
+ ee(() => {
1964
1983
  const o = (a) => {
1965
1984
  const f = e.current;
1966
- n.current = f !== null && a instanceof Element && f.contains(a) ? Po(a) : null;
1985
+ n.current = f !== null && a instanceof Element && f.contains(a) ? Do(a) : null;
1967
1986
  }, l = (a) => o(a.target);
1968
1987
  o(document.activeElement);
1969
1988
  const s = (a) => {
@@ -1976,8 +1995,8 @@ const Ao = () => {
1976
1995
  document.removeEventListener("focusin", l), document.removeEventListener("focusout", s);
1977
1996
  };
1978
1997
  }, [e]);
1979
- const r = j(t);
1980
- V(() => {
1998
+ const r = z(t);
1999
+ U(() => {
1981
2000
  if (r.current === t) return;
1982
2001
  r.current = t;
1983
2002
  const o = n.current;
@@ -1985,11 +2004,11 @@ const Ao = () => {
1985
2004
  const l = () => {
1986
2005
  const f = document.activeElement;
1987
2006
  if (f !== null && f !== document.body && f !== o.element) return !0;
1988
- const h = e.current;
1989
- if (h === null) return !0;
2007
+ const p = e.current;
2008
+ if (p === null) return !0;
1990
2009
  for (const m of o.control.successors)
1991
- for (const g of h.querySelectorAll(m))
1992
- if (g !== o.element && (g.focus({ preventScroll: !0 }), document.activeElement === g))
2010
+ for (const h of p.querySelectorAll(m))
2011
+ if (h !== o.element && (h.focus({ preventScroll: !0 }), document.activeElement === h))
1993
2012
  return !0;
1994
2013
  return !1;
1995
2014
  };
@@ -2001,134 +2020,135 @@ const Ao = () => {
2001
2020
  });
2002
2021
  return a.observe(s, { childList: !0, subtree: !0 }), () => a.disconnect();
2003
2022
  }, [t, e]);
2004
- }, Do = $e(() => import("./TreeLayout-C7ZNnaOr.js").then((e) => ({ default: e.TreeLayout }))), Fo = $e(() => import("./MultiLayout-8s7q3-Hm.js").then((e) => ({ default: e.MultiLayout }))), _o = 64, gt = {
2023
+ }, _o = De(() => import("./TreeLayout-BcHsv9G8.js").then((e) => ({ default: e.TreeLayout }))), qo = De(() => import("./MultiLayout-BtWtCzJV.js").then((e) => ({ default: e.MultiLayout }))), Bo = 64, zo = {
2005
2024
  request: (e) => {
2006
2025
  requestAnimationFrame(e);
2007
2026
  }
2008
- }, ht = (e) => {
2027
+ }, mt = (e) => {
2009
2028
  e.documents.clear(), e.trees.clear();
2010
- }, Le = (e, t) => {
2029
+ }, Ce = (e, t) => {
2011
2030
  t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
2012
2031
  for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
2013
- }, qo = (e, t) => {
2014
- const [n, r] = Z(() => ({ overrides: t, locale: e, labels: Ke(e, t) }));
2032
+ }, jo = (e, t) => {
2033
+ const [n, r] = I(() => ({ overrides: t, locale: e, labels: Ye(e, t) }));
2015
2034
  if (n.locale === e && An(n.overrides, t)) return n.labels;
2016
- const o = { overrides: t, locale: e, labels: Ke(e, t) };
2035
+ const o = { overrides: t, locale: e, labels: Ye(e, t) };
2017
2036
  return r(o), o.labels;
2018
- }, Bo = (e, t, n) => {
2019
- const [r, o] = Z(() => ({ scope: t, store: ct(e, n) }));
2037
+ }, Ho = (e, t, n) => {
2038
+ const [r, o] = I(() => ({ scope: t, store: at(e, n) }));
2020
2039
  if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
2021
- const l = { scope: t, store: ct(e, n) };
2040
+ const l = { scope: t, store: at(e, n) };
2022
2041
  return o(l), l.store;
2023
- }, zo = (e) => {
2024
- const [t, n] = Z(() => ({ scope: e, announcer: st(gt) }));
2025
- if (t.scope === e) return t.announcer;
2026
- const r = { scope: e, announcer: st(gt) };
2027
- return n(r), r.announcer;
2028
- }, Qo = ({ data: e, config: t, storageNamespace: n, locale: r, labels: o, theme: l, renderFrame: s, renderTreeFailure: a, lockDocumentScroll: f = !1, onMathDiagnostics: h }) => {
2042
+ }, ht = (e, t) => {
2043
+ const [n, r] = I(() => ({ scope: e, value: t() }));
2044
+ if (n.scope === e) return n.value;
2045
+ const o = { scope: e, value: t() };
2046
+ return r(o), o.value;
2047
+ }, Io = () => go(zo), nl = ({ data: e, config: t, storageNamespace: n, locale: r, labels: o, theme: l, renderFrame: s, renderTreeFailure: a, lockDocumentScroll: f = !1, onMathDiagnostics: p }) => {
2029
2048
  wn(n);
2030
- const m = St(r), g = On(l), b = qo(m, o), { revalidate: R } = Vt(), k = j(() => {
2031
- }), A = we(t.dataPath), [T] = Z(() => {
2032
- const M = wo({ dataPath: A, onScope: (Q) => k.current(Q) }), _ = { documents: qn({ client: M, capacity: Math.max(_o, t.multiView.maxPanels * 2) }), trees: ko(M) };
2033
- return Le(_, e), Ge(n, e.scope), { data: M, ..._, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
2049
+ const m = Et(r), h = Ln(l), b = jo(m, o), { revalidate: R } = Ut(), k = z(() => {
2050
+ }), A = we(t.dataPath), [T] = I(() => {
2051
+ const O = vo({ dataPath: A, onScope: (X) => k.current(X) }), V = { documents: qn({ client: O, capacity: Math.max(Bo, t.multiView.maxPanels * 2) }), trees: To(O) };
2052
+ return Ce(V, e), We(n, e.scope), { data: O, ...V, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
2034
2053
  });
2035
2054
  if (T.aligned.pageData !== e || T.aligned.storageNamespace !== n) {
2036
- const M = T.aligned.pageData;
2037
- T.aligned.pageData = e, T.aligned.storageNamespace = n, M !== e && (M.scope !== e.scope ? T.aligned.pendingReader = e : Le(T, e)), Ge(n, e.scope);
2055
+ const O = T.aligned.pageData;
2056
+ T.aligned.pageData = e, T.aligned.storageNamespace = n, O !== e && (O.scope !== e.scope ? T.aligned.pendingReader = e : Ce(T, e)), We(n, e.scope);
2038
2057
  }
2039
- const F = Bo(vn(n).treeSettings, e.scope, t.defaultTreeSettings);
2040
- V(() => {
2041
- const M = T.aligned.pendingReader;
2042
- M !== null && (T.aligned.pendingReader = null, ht(T), Le(T, M));
2043
- }, [e, T]), V(() => {
2044
- let M = !1;
2045
- return k.current = (_) => {
2046
- _ === e.scope || M || (M = !0, _ !== null && (ht(T), bn(n)), R());
2058
+ const F = Ho(vn(n).treeSettings, e.scope, t.defaultTreeSettings);
2059
+ U(() => {
2060
+ const O = T.aligned.pendingReader;
2061
+ O !== null && (T.aligned.pendingReader = null, mt(T), Ce(T, O));
2062
+ }, [e, T]), U(() => {
2063
+ let O = !1;
2064
+ return k.current = (V) => {
2065
+ V === e.scope || O || (O = !0, V !== null && (mt(T), bn(n)), R());
2047
2066
  }, () => {
2048
2067
  k.current = () => {
2049
2068
  };
2050
2069
  };
2051
2070
  }, [e, R, T, n]);
2052
- const O = j(t.settingsCookie);
2053
- V(() => {
2054
- O.current = t.settingsCookie;
2071
+ const L = z(t.settingsCookie);
2072
+ U(() => {
2073
+ L.current = t.settingsCookie;
2055
2074
  }, [t.settingsCookie]);
2056
- const [u] = Z(
2057
- () => Ro(e.settings, (M) => {
2058
- document.cookie = tn(O.current, M, window.location.protocol === "https:");
2075
+ const [u] = I(
2076
+ () => Ao(e.settings, (O) => {
2077
+ document.cookie = en(L.current, O, window.location.protocol === "https:");
2059
2078
  })
2060
- ), p = zo(e.scope), S = H(() => ie(e.notices.catch(() => [])), [e.notices]), E = e.sources.map((M) => M.id).join(`
2061
- `), y = H(() => en(t, E.split(`
2062
- `)), [t, E]), $ = j(h);
2063
- V(() => {
2064
- $.current = h;
2065
- }, [h]);
2066
- const [I] = Z(() => (M, _) => {
2067
- $.current?.(M, _);
2068
- }), C = h === void 0 ? void 0 : I, B = H(
2079
+ ), g = ht(e.scope, Io), S = ht(e.scope, bo), E = H(() => ie(e.notices.catch(() => [])), [e.notices]), y = e.sources.map((O) => O.id).join(`
2080
+ `), $ = H(() => Qt(t, y.split(`
2081
+ `)), [t, y]), j = z(p);
2082
+ U(() => {
2083
+ j.current = p;
2084
+ }, [p]);
2085
+ const [M] = I(() => (O, V) => {
2086
+ j.current?.(O, V);
2087
+ }), _ = p === void 0 ? void 0 : M, G = H(
2069
2088
  () => ({
2070
- config: y,
2089
+ config: $,
2071
2090
  labels: b,
2072
2091
  locale: m,
2073
- theme: g,
2092
+ theme: h,
2074
2093
  storageNamespace: n,
2075
2094
  scope: e.scope,
2076
2095
  sources: e.sources,
2077
- notices: S,
2096
+ notices: E,
2078
2097
  documents: T.documents,
2079
2098
  trees: T.trees,
2080
2099
  data: T.data,
2081
2100
  viewSettings: u,
2082
2101
  treeSettings: F,
2083
- announcer: p,
2102
+ announcer: g,
2103
+ reveals: S,
2084
2104
  renderTreeFailure: a,
2085
- reportMathDiagnostics: C
2105
+ reportMathDiagnostics: _
2086
2106
  }),
2087
- [y, b, m, g, n, e.scope, e.sources, S, T, u, F, p, a, C]
2107
+ [$, b, m, h, n, e.scope, e.sources, E, T, u, F, g, S, a, _]
2088
2108
  );
2089
- return /* @__PURE__ */ d(yt, { value: B, children: /* @__PURE__ */ d(Ho, { renderFrame: s, lockDocumentScroll: f }, e.scope) });
2090
- }, jo = ({ ref: e, theme: t, view: n, children: r }) => {
2091
- const [o] = Z(mr);
2109
+ return /* @__PURE__ */ d(St, { value: G, children: /* @__PURE__ */ d(Uo, { renderFrame: s, lockDocumentScroll: f }, e.scope) });
2110
+ }, Zo = ({ ref: e, theme: t, view: n, children: r }) => {
2111
+ const [o] = I(mr);
2092
2112
  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 });
2093
- }, Ho = ({ renderFrame: e, lockDocumentScroll: t }) => {
2094
- const { theme: n, labels: r } = D(), o = De(), { hash: l } = pt(), s = _e(), a = j(null);
2095
- Mo(t, a), V(() => {
2113
+ }, Uo = ({ renderFrame: e, lockDocumentScroll: t }) => {
2114
+ const { theme: n, labels: r } = D(), o = Fe(), { hash: l } = pt(), s = qe(), a = z(null);
2115
+ Po(t, a), U(() => {
2096
2116
  o.kind === "redirect" && s(`${o.href}${l}`, "browse");
2097
2117
  }, [o, l, s]);
2098
- const { location: f } = o, h = f.view;
2099
- $o(a, h);
2100
- const m = f.view === "tree" ? /* @__PURE__ */ d(fe, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading" }), children: /* @__PURE__ */ d(Do, { location: f }) }) : f.view === "multi" ? /* @__PURE__ */ d(fe, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading" }), children: /* @__PURE__ */ d(Fo, { location: f }) }) : /* @__PURE__ */ d(go, { location: f }), g = /* @__PURE__ */ U(jo, { ref: a, theme: n, view: h, children: [
2118
+ const { location: f } = o, p = f.view;
2119
+ Fo(a, p);
2120
+ const m = f.view === "tree" ? /* @__PURE__ */ d(fe, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading" }), children: /* @__PURE__ */ d(_o, { location: f }) }) : f.view === "multi" ? /* @__PURE__ */ d(fe, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading" }), children: /* @__PURE__ */ d(qo, { location: f }) }) : /* @__PURE__ */ d(ho, { location: f }), h = /* @__PURE__ */ Z(Zo, { ref: a, theme: n, view: p, children: [
2101
2121
  m,
2102
- /* @__PURE__ */ d(ho, { holds: !0, testId: "markdown-explorer-announcer" })
2122
+ /* @__PURE__ */ d(po, { holds: !0, testId: "markdown-explorer-announcer" })
2103
2123
  ] });
2104
- return e === void 0 ? g : e({ view: h, children: g });
2105
- }, el = ({ currentUrl: e, nextUrl: t, formMethod: n, defaultShouldRevalidate: r }) => n === void 0 && e.href === t.href && r;
2124
+ return e === void 0 ? h : e({ view: p, children: h });
2125
+ }, rl = ({ currentUrl: e, nextUrl: t, formMethod: n, defaultShouldRevalidate: r }) => n === void 0 && e.href === t.href && r;
2106
2126
  export {
2107
2127
  mo as D,
2108
2128
  Mn as E,
2109
2129
  Nn as F,
2110
- pr as I,
2130
+ gr as I,
2111
2131
  Fn as L,
2112
2132
  kn as M,
2113
2133
  uo as P,
2114
- _e as a,
2134
+ qe as a,
2115
2135
  lo as b,
2116
2136
  be as c,
2117
2137
  so as d,
2118
- Jo as e,
2119
- kt as f,
2138
+ tl as e,
2139
+ xt as f,
2120
2140
  Pn as g,
2121
2141
  ve as h,
2122
- De as i,
2123
- ho as j,
2142
+ Fe as i,
2143
+ po as j,
2124
2144
  me as k,
2125
2145
  En as l,
2126
- Ye as m,
2127
- Et as n,
2146
+ Xe as m,
2147
+ bt as n,
2128
2148
  Sn as o,
2129
- We as p,
2130
- Qo as q,
2131
- Ke as r,
2132
- el as s,
2149
+ Ke as p,
2150
+ nl as q,
2151
+ Ye as r,
2152
+ rl as s,
2133
2153
  D as u
2134
2154
  };