@aiquants/markdown-explorer 0.10.0 → 0.12.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 (49) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/README.md +66 -6
  3. package/dist/EditSurface-BTAhzvHi.js +509 -0
  4. package/dist/EditSurface-Dfj6Sxxb.cjs +2 -0
  5. package/dist/ExplorerSplit-DekOjAUZ.cjs +1 -0
  6. package/dist/{ExplorerSplit-D0zf7Cr_.js → ExplorerSplit-MPHjw3nW.js} +251 -248
  7. package/dist/{MultiLayout-Jy9BKofx.js → MultiLayout-DtSW4rEQ.js} +4 -4
  8. package/dist/{MultiLayout-Bq10p3a3.cjs → MultiLayout-HMzVDYWq.cjs} +1 -1
  9. package/dist/{NativeScrollBar-Dt6xH5Mb.cjs → NativeScrollBar-B0AkVF3E.cjs} +1 -1
  10. package/dist/{NativeScrollBar-CyiyL47o.js → NativeScrollBar-CNQr7JY1.js} +1 -1
  11. package/dist/{TreeLayout-8pRo1ANN.js → TreeLayout-CJO9tOPq.js} +3 -3
  12. package/dist/{TreeLayout-kVWFEKJD.cjs → TreeLayout-_XQR-9tV.cjs} +1 -1
  13. package/dist/client/MarkdownExplorer.d.cts +3 -2
  14. package/dist/client/MarkdownExplorer.d.ts +3 -2
  15. package/dist/core/contracts.d.cts +17 -0
  16. package/dist/core/contracts.d.ts +17 -0
  17. package/dist/core/labels.d.cts +2 -0
  18. package/dist/core/labels.d.ts +2 -0
  19. package/dist/core/treeSettings.d.cts +2 -1
  20. package/dist/core/treeSettings.d.ts +2 -1
  21. package/dist/dataRoute-CH3yOKR0.cjs +1 -0
  22. package/dist/dataRoute-Pm_0ue_4.js +279 -0
  23. package/dist/index-DpIVKG8Y.cjs +13 -0
  24. package/dist/{index-CfcJEnrC.js → index-o6OpR4ND.js} +967 -907
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.cts +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +9 -9
  29. package/dist/location-BUNWJ4eB.cjs +1 -0
  30. package/dist/{location-Dc1qNEGm.js → location-DWd6SQhN.js} +123 -112
  31. package/dist/{merge-D0aGvFKC.cjs → merge-Bs7o3GyP.cjs} +1 -1
  32. package/dist/{merge-SRCxtHk2.js → merge-DDJaJmMU.js} +1 -1
  33. package/dist/sanitizePolicy-BfUlXI5E.cjs +1 -0
  34. package/dist/sanitizePolicy-djLC3fRN.js +96 -0
  35. package/dist/sanitizeWorker.cjs +1 -1
  36. package/dist/sanitizeWorker.js +143 -226
  37. package/dist/server.cjs +1 -1
  38. package/dist/server.js +548 -540
  39. package/docs/behavior/dom-hooks.md +2 -2
  40. package/docs/behavior/localization.md +1 -0
  41. package/docs/behavior/security.md +2 -0
  42. package/package.json +3 -3
  43. package/dist/EditSurface-1Jf0CG-f.js +0 -371
  44. package/dist/EditSurface-B-l3Do_C.cjs +0 -2
  45. package/dist/ExplorerSplit-WX8afxrQ.cjs +0 -1
  46. package/dist/dataRoute-8pyILcjL.cjs +0 -1
  47. package/dist/dataRoute-Csl1WBDz.js +0 -278
  48. package/dist/index-sNJrKoGN.cjs +0 -13
  49. package/dist/location-CRYkEWiC.cjs +0 -1
@@ -1,20 +1,20 @@
1
1
  import { jsxs as F, jsx as a, Fragment as Ne } from "react/jsx-runtime";
2
- import * as b from "react";
3
- import { createContext as me, use as re, useMemo as U, useSyncExternalStore as te, useRef as B, useId as Oe, useLayoutEffect as V, useCallback as P, useEffect as ne, Component as Vt, Suspense as ge, lazy as tt, useState as I, useEffectEvent as ie } from "react";
4
- import { useParams as Cn, useSearchParams as On, matchPath as An, useBlocker as Ln, useNavigate as Mn, Link as Nn, useHref as De, useLocation as Gt, useRevalidator as Dn } from "react-router";
5
- import { f as $n, a as Kt, u as Pn, G as ke, e as pe, x as Fn, y as qn, z as ft, B as _n, D as mt, H as Bn, w as In, I as jn } from "./location-Dc1qNEGm.js";
6
- import { C as Ee, i as Hn, F as zn, x as Y, w as Un, G as ht, y as He, H as Zn, I as Vn, J as Gn, K as Kn, L as Wn, f as Xn, N as pt, u as Yn, O as Jn, P as Qn, Q as er, A as tr, v as nr, R as rr, S as or, T as lr, t as gt } from "./dataRoute-Csl1WBDz.js";
7
- import { HostedScrollArea as vt, useMarkdownToolbarState as ir, MarkdownViewer as Wt } from "@aiquants/markdown";
8
- import { SOURCE_LINES_ATTRIBUTE as Xt, parseSourceLines as sr } from "@aiquants/markdown/source-lines";
9
- import { DEFAULT_CONTENT_ALIGN as ar } from "@aiquants/markdown/viewer-settings";
10
- import { w as Yt, r as Jt, a as cr, b as wt, s as ze, c as dr } from "./storage-BSthKLSG.js";
11
- const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
2
+ import * as E from "react";
3
+ import { createContext as me, use as ne, useMemo as z, useSyncExternalStore as ee, useRef as _, useId as Oe, useLayoutEffect as U, useCallback as P, useEffect as te, Component as Zt, Suspense as ge, lazy as tt, useState as I, useEffectEvent as ie } from "react";
4
+ import { useParams as Tn, useSearchParams as Cn, matchPath as On, useBlocker as An, useNavigate as Ln, Link as Mn, useHref as De, useLocation as Vt, useRevalidator as Nn } from "react-router";
5
+ import { f as Dn, a as Gt, u as $n, G as ke, e as pe, x as Pn, y as Fn, z as ft, B as qn, D as mt, H as _n, w as Bn, I as In } from "./location-DWd6SQhN.js";
6
+ import { F as Ee, i as jn, G as Hn, y as X, x as zn, H as ht, z as He, I as Un, J as Zn, K as Vn, L as Gn, N as Kn, f as Wn, O as pt, v as Xn, P as Yn, Q as Jn, R as Qn, B as er, w as tr, S as nr, T as rr, U as or, u as gt } from "./dataRoute-Pm_0ue_4.js";
7
+ import { HostedScrollArea as vt, useMarkdownToolbarState as lr, MarkdownViewer as Kt } from "@aiquants/markdown";
8
+ import { SOURCE_LINES_ATTRIBUTE as Wt, parseSourceLines as ir } from "@aiquants/markdown/source-lines";
9
+ import { DEFAULT_CONTENT_ALIGN as sr } from "@aiquants/markdown/viewer-settings";
10
+ import { w as Xt, r as Yt, a as ar, b as wt, s as ze, c as cr } from "./storage-BSthKLSG.js";
11
+ const bt = Object.freeze(["en", "ja"]), dr = "en", ur = Object.freeze({
12
12
  panelMoved: Object.freeze(["title", "column", "position"]),
13
13
  panelMoveUnavailable: Object.freeze(["title", "move"]),
14
14
  panelDragStarted: Object.freeze(["title"]),
15
15
  panelDragCancelled: Object.freeze(["title"]),
16
16
  multiColumnRegion: Object.freeze(["column"])
17
- }), mr = /\{(\w+)\}/gu, Qt = {
17
+ }), fr = /\{(\w+)\}/gu, Jt = {
18
18
  explorerRegion: "Explorer",
19
19
  sourceLabel: "Source",
20
20
  refreshTreeLabel: "Refresh tree",
@@ -116,6 +116,8 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
116
116
  sortNative: "Source order",
117
117
  sortAscending: "Name A→Z",
118
118
  sortDescending: "Name Z→A",
119
+ sortOldest: "Modified old→new",
120
+ sortNewest: "Modified new→old",
119
121
  settingFolderPlacement: "Folders",
120
122
  folderPlacementMixed: "Mixed",
121
123
  folderPlacementFirst: "First",
@@ -242,7 +244,7 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
242
244
  multiColumnEmpty: "This column is empty",
243
245
  multiColumnRegion: "Column {column}",
244
246
  panelDropHere: "Drop the panel here"
245
- }, hr = {
247
+ }, mr = {
246
248
  explorerRegion: "エクスプローラー",
247
249
  sourceLabel: "ソース",
248
250
  refreshTreeLabel: "ツリーを更新",
@@ -344,6 +346,8 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
344
346
  sortNative: "取得順",
345
347
  sortAscending: "名前の昇順",
346
348
  sortDescending: "名前の降順",
349
+ sortOldest: "更新日時の昇順 (古い順)",
350
+ sortNewest: "更新日時の降順 (新しい順)",
347
351
  settingFolderPlacement: "フォルダーの位置",
348
352
  folderPlacementMixed: "混ぜる",
349
353
  folderPlacementFirst: "先に",
@@ -470,24 +474,24 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
470
474
  multiColumnEmpty: "この列は空です",
471
475
  multiColumnRegion: "{column} 列目",
472
476
  panelDropHere: "ここへパネルをドロップ"
473
- }, pr = Object.freeze({
474
- en: Object.freeze(Qt),
475
- ja: Object.freeze(hr)
476
- }), en = Object.freeze(Object.keys(Qt)), gr = new Set(en), vr = (e) => gr.has(e), Te = (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, tn = (e) => {
477
- if (e === void 0) return ur;
477
+ }, hr = Object.freeze({
478
+ en: Object.freeze(Jt),
479
+ ja: Object.freeze(mr)
480
+ }), Qt = Object.freeze(Object.keys(Jt)), pr = new Set(Qt), gr = (e) => pr.has(e), Te = (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, en = (e) => {
481
+ if (e === void 0) return dr;
478
482
  if (bt.includes(e)) return e;
479
483
  throw new RangeError(`[markdown-explorer] locale is the UI language (${bt.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${Te(e)}`);
480
484
  }, Et = (e, t) => {
481
- const n = pr[tn(e)];
485
+ const n = hr[en(e)];
482
486
  if (t === void 0) return n;
483
487
  if (t === null || typeof t != "object")
484
488
  throw new RangeError(`[markdown-explorer] labels must be an object; got ${Te(t)}`);
485
- if (!$n(t))
489
+ if (!Dn(t))
486
490
  throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${Te(t)}`);
487
491
  const r = t, o = { ...n };
488
492
  for (const l of Object.keys(r)) {
489
- if (!vr(l))
490
- throw new RangeError(`[markdown-explorer] labels.${l} is not a known label key; expected one of ${en.join(", ")}`);
493
+ if (!gr(l))
494
+ throw new RangeError(`[markdown-explorer] labels.${l} is not a known label key; expected one of ${Qt.join(", ")}`);
491
495
  const i = r[l];
492
496
  if (i === void 0) continue;
493
497
  const d = typeof n[l];
@@ -495,35 +499,35 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
495
499
  throw new TypeError(`[markdown-explorer] labels.${l} must be a ${d}; got ${Te(i)}`);
496
500
  if (typeof i == "string" && i.trim() === "")
497
501
  throw new RangeError(`[markdown-explorer] labels.${l} must be a non-blank string`);
498
- const g = fr[l];
502
+ const g = ur[l];
499
503
  if (typeof i == "string" && g !== void 0) {
500
- for (const [, f] of i.matchAll(mr))
504
+ for (const [, f] of i.matchAll(fr))
501
505
  if (!g.includes(f ?? ""))
502
506
  throw new RangeError(`[markdown-explorer] labels.${l} uses the unknown placeholder {${String(f)}}; it accepts ${g.map((u) => `{${u}}`).join(", ")}`);
503
507
  }
504
508
  o[l] = i;
505
509
  }
506
510
  return Object.freeze(o);
507
- }, wr = (e, t) => {
511
+ }, vr = (e, t) => {
508
512
  if (Object.is(e, t)) return !0;
509
513
  if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
510
514
  const n = e, r = t, o = Object.keys(n), l = Object.keys(r);
511
515
  return o.length === l.length && l.every((i) => Object.hasOwn(n, i) && Object.is(n[i], r[i]));
512
- }, yt = Object.freeze(["light", "dark"]), br = (e) => {
516
+ }, yt = Object.freeze(["light", "dark"]), wr = (e) => {
513
517
  if (e === void 0) return "light";
514
518
  if (yt.includes(e)) return e;
515
519
  throw new RangeError(`[markdown-explorer] theme must be ${yt.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
516
- }, nn = me(null), D = () => {
517
- const e = re(nn);
520
+ }, tn = me(null), D = () => {
521
+ const e = ne(tn);
518
522
  if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
519
523
  return e;
520
524
  }, Ae = (e) => {
521
525
  const { viewSettings: t } = D(), n = () => e(t.getSnapshot());
522
- return te(t.subscribe, n, n);
526
+ return ee(t.subscribe, n, n);
523
527
  }, nt = () => {
524
- const { config: e } = D(), t = Cn()["*"], [n] = On(), r = n.toString();
525
- return U(() => Kt(e, t, new URLSearchParams(r)), [e, t, r]);
526
- }, rn = {
528
+ const { config: e } = D(), t = Tn()["*"], [n] = Cn(), r = n.toString();
529
+ return z(() => Gt(e, t, new URLSearchParams(r)), [e, t, r]);
530
+ }, nn = {
527
531
  unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
528
532
  forbidden: ["failureForbiddenTitle", "failureForbiddenBody"],
529
533
  "not-found": ["failureNotFoundTitle", "failureNotFoundBody"],
@@ -532,14 +536,14 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
532
536
  "too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
533
537
  unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
534
538
  failed: ["failureFailedTitle", "failureFailedBody"]
535
- }, ae = (e, t) => e[rn[t][0]], ve = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
536
- const { labels: o } = D(), l = ae(o, e.reason), i = o[rn[e.reason][1]], d = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
539
+ }, ae = (e, t) => e[nn[t][0]], ve = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
540
+ const { labels: o } = D(), l = ae(o, e.reason), i = o[nn[e.reason][1]], d = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
537
541
  return /* @__PURE__ */ F("div", { className: "aqmx-callout", role: t ? "alert" : void 0, "data-aqmx-tone": d, "data-testid": r === null ? void 0 : r, "data-aqmx-failure": r === null ? void 0 : e.reason, children: [
538
542
  /* @__PURE__ */ a("p", { className: "aqmx-callout-title", children: l }),
539
543
  /* @__PURE__ */ a("p", { className: "aqmx-callout-body", children: i }),
540
544
  e.reason === "unauthorized" ? /* @__PURE__ */ a("button", { type: "button", className: "aqmx-callout-action", onClick: () => window.location.reload(), children: o.reloadPage }) : n !== void 0 && e.reason === "failed" ? /* @__PURE__ */ a("button", { type: "button", className: "aqmx-callout-action", onClick: n, children: o.retry }) : null
541
545
  ] });
542
- }, Er = (e, t) => {
546
+ }, br = (e, t) => {
543
547
  const { phase: n, save: r, dirty: o } = t;
544
548
  switch (n.kind) {
545
549
  case "opening":
@@ -563,7 +567,7 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
563
567
  break;
564
568
  }
565
569
  return o ? e.draftUnsaved : "";
566
- }, yr = (e, t, n) => {
570
+ }, Er = (e, t, n) => {
567
571
  switch (t.kind) {
568
572
  case "saved":
569
573
  return t.merged ? e.documentSavedMerged(n) : e.documentSaved(n);
@@ -587,34 +591,34 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
587
591
  for (const t of [...e]) t();
588
592
  }
589
593
  };
590
- }, xr = "<<<<<<<", kr = "=======", Sr = ">>>>>>>", xt = (e, t) => e === t || e.startsWith(`${t} `), kt = (e) => Rr(e.split(`
591
- `)), Rr = (e) => {
594
+ }, yr = "<<<<<<<", xr = "=======", kr = ">>>>>>>", xt = (e, t) => e === t || e.startsWith(`${t} `), kt = (e) => Sr(e.split(`
595
+ `)), Sr = (e) => {
592
596
  const t = [];
593
597
  let n = null, r = null, o = 0;
594
598
  for (const l of e) {
595
599
  o += 1;
596
600
  const i = l.charCodeAt(0);
597
- i !== 60 && i !== 61 && i !== 62 || (xt(l, xr) ? (n = o, r = null) : l === kr ? n !== null && r === null ? r = o : n = null : xt(l, Sr) && (n !== null && r !== null && t.push({ start: n, separator: r, end: o }), n = null, r = null));
601
+ i !== 60 && i !== 61 && i !== 62 || (xt(l, yr) ? (n = o, r = null) : l === xr ? n !== null && r === null ? r = o : n = null : xt(l, kr) && (n !== null && r !== null && t.push({ start: n, separator: r, end: o }), n = null, r = null));
598
602
  }
599
603
  return t;
600
604
  }, St = (e) => e.includes(`\r
601
605
  `) ? `\r
602
606
  ` : `
603
607
  `, Ue = (e) => e.replace(/\r\n?/gu, `
604
- `), Tr = (e, t) => t === `
608
+ `), Rr = (e, t) => t === `
605
609
  ` ? e : e.replaceAll(`
606
610
  `, `\r
607
- `), Cr = 3, Ze = Object.freeze({ kind: "idle" }), Or = ({ data: e, conflictLabels: t, onSaveSettled: n, previewSetting: r }) => {
611
+ `), Tr = 3, Ze = Object.freeze({ kind: "idle" }), Cr = ({ data: e, conflictLabels: t, onSaveSettled: n, previewSetting: r }) => {
608
612
  const o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), f = ye();
609
- let u = null, p = null;
613
+ let u = null, h = null;
610
614
  const m = (s, c) => {
611
615
  s.value = { ...s.value, ...c }, f.emit();
612
- }, x = (s, c) => o.get(s) === c, O = async (s, c) => {
616
+ }, S = (s, c) => o.get(s) === c, A = async (s, c) => {
613
617
  c.controller.abort(), c.controller = new AbortController();
614
- const { signal: h } = c.controller;
618
+ const { signal: p } = c.controller;
615
619
  m(c, { phase: { kind: "opening" } });
616
- const w = await e.edit(s, h);
617
- if (!x(s, c) || h.aborted || !("kind" in w)) return;
620
+ const w = await e.edit(s, p);
621
+ if (!S(s, c) || p.aborted || !("kind" in w)) return;
618
622
  if (w.kind === "grant") {
619
623
  m(c, { phase: { kind: "grant", href: w.href } });
620
624
  return;
@@ -625,65 +629,65 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
625
629
  }
626
630
  const k = Ue(w.text);
627
631
  c.base = { text: k, version: w.version }, c.draft = k, c.ending = St(w.text), m(c, { phase: { kind: "editing" }, history: w.history, dirty: !1, save: Ze, generation: c.value.generation + 1 });
628
- }, y = (s) => {
632
+ }, x = (s) => {
629
633
  const c = o.get(s);
630
634
  c !== void 0 && (c.controller.abort(), o.delete(s), i.delete(s));
631
- }, T = (s, c, h) => (s.set(c, h), () => {
632
- s.get(c) === h && s.delete(c);
633
- }), S = (s, c, h, w = {}) => {
634
- m(c, { ...w, save: h }), n(s, h);
635
- }, M = async (s) => {
635
+ }, T = (s, c, p) => (s.set(c, p), () => {
636
+ s.get(c) === p && s.delete(c);
637
+ }), M = (s, c, p, w = {}) => {
638
+ m(c, { ...w, save: p }), n(s, p);
639
+ }, C = async (s) => {
636
640
  d.get(s)?.flush();
637
641
  const c = o.get(s);
638
642
  if (c === void 0 || c.value.phase.kind !== "editing" || c.base === null || c.value.save.kind === "saving") return;
639
- const h = kt(c.draft).length;
640
- if (h > 0) {
641
- S(s, c, { kind: "conflicts", count: h });
643
+ const p = kt(c.draft).length;
644
+ if (p > 0) {
645
+ M(s, c, { kind: "conflicts", count: p });
642
646
  return;
643
647
  }
644
648
  c.controller.abort(), c.controller = new AbortController();
645
649
  const { signal: w } = c.controller;
646
- let k = c.base, L = c.draft, R = !1;
650
+ let k = c.base, L = c.draft, O = !1;
647
651
  m(c, { save: { kind: "saving" } });
648
- for (let N = 0; N < Cr; N += 1) {
649
- const q = await e.save(s, k.version, Tr(L, c.ending), w);
650
- if (!x(s, c) || w.aborted || !("kind" in q)) return;
652
+ for (let N = 0; N < Tr; N += 1) {
653
+ const q = await e.save(s, k.version, Rr(L, c.ending), w);
654
+ if (!S(s, c) || w.aborted || !("kind" in q)) return;
651
655
  if (q.kind === "saved") {
652
- d.get(s)?.flush(), c.base = { text: L, version: q.version }, S(s, c, { kind: "saved", merged: R }, { dirty: c.draft !== L });
656
+ d.get(s)?.flush(), c.base = { text: L, version: q.version }, M(s, c, { kind: "saved", merged: O }, { dirty: c.draft !== L });
653
657
  return;
654
658
  }
655
659
  if (q.kind === "grant") {
656
- S(s, c, { kind: "grant", href: q.href });
660
+ M(s, c, { kind: "grant", href: q.href });
657
661
  return;
658
662
  }
659
663
  if (q.kind === "failure") {
660
- S(s, c, { kind: "failed", failure: q.failure });
664
+ M(s, c, { kind: "failed", failure: q.failure });
661
665
  return;
662
666
  }
663
- const { mergeDraft: W } = await import("./merge-SRCxtHk2.js");
664
- if (!x(s, c) || w.aborted) return;
665
- const J = d.get(s);
666
- J?.flush();
667
- const ee = Ue(q.text), X = W(k.text, c.draft, ee, t());
668
- if (k = { text: ee, version: q.version }, c.base = k, c.ending = St(q.text), c.draft = X.text, J?.adopt(X.text), X.kind === "conflicts") {
669
- S(s, c, { kind: "conflicts", count: X.conflicts }, { dirty: !0, generation: c.value.generation + 1 });
667
+ const { mergeDraft: G } = await import("./merge-DDJaJmMU.js");
668
+ if (!S(s, c) || w.aborted) return;
669
+ const W = d.get(s);
670
+ W?.flush();
671
+ const Q = Ue(q.text), K = G(k.text, c.draft, Q, t());
672
+ if (k = { text: Q, version: q.version }, c.base = k, c.ending = St(q.text), c.draft = K.text, W?.adopt(K.text), K.kind === "conflicts") {
673
+ M(s, c, { kind: "conflicts", count: K.conflicts }, { dirty: !0, generation: c.value.generation + 1 });
670
674
  return;
671
675
  }
672
- if (R = !0, L = X.text, L === k.text) {
673
- S(s, c, { kind: "saved", merged: R }, { dirty: !1, generation: c.value.generation + 1 });
676
+ if (O = !0, L = K.text, L === k.text) {
677
+ M(s, c, { kind: "saved", merged: O }, { dirty: !1, generation: c.value.generation + 1 });
674
678
  return;
675
679
  }
676
680
  m(c, { dirty: !0, generation: c.value.generation + 1 });
677
681
  }
678
- S(s, c, { kind: "failed", failure: { reason: "failed" } });
682
+ M(s, c, { kind: "failed", failure: { reason: "failed" } });
679
683
  };
680
684
  return {
681
685
  session: (s) => o.get(s)?.value,
682
686
  subscribe: f.subscribe,
683
687
  start: (s, c) => {
684
- const h = o.get(s);
685
- if (h !== void 0) {
686
- m(h, { request: { anchor: c } }), (h.value.phase.kind === "failed" || h.value.phase.kind === "grant") && O(s, h);
688
+ const p = o.get(s);
689
+ if (p !== void 0) {
690
+ m(p, { request: { anchor: c } }), (p.value.phase.kind === "failed" || p.value.phase.kind === "grant") && A(s, p);
687
691
  return;
688
692
  }
689
693
  l.delete(s);
@@ -695,46 +699,46 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
695
699
  `,
696
700
  controller: new AbortController()
697
701
  };
698
- o.set(s, w), O(s, w);
702
+ o.set(s, w), A(s, w);
699
703
  },
700
704
  retry: (s) => {
701
705
  const c = o.get(s);
702
- c === void 0 || c.value.phase.kind === "editing" || O(s, c);
706
+ c === void 0 || c.value.phase.kind === "editing" || A(s, c);
703
707
  },
704
708
  draft: (s) => {
705
709
  const c = o.get(s);
706
710
  return c === void 0 || c.base === null ? null : c.draft;
707
711
  },
708
712
  setDraft: (s, c) => {
709
- const h = o.get(s);
710
- if (h === void 0 || h.base === null) return;
711
- h.draft = c;
712
- const w = {}, k = c !== h.base.text;
713
- k !== h.value.dirty && (w.dirty = k);
714
- const { save: L } = h.value;
713
+ const p = o.get(s);
714
+ if (p === void 0 || p.base === null) return;
715
+ p.draft = c;
716
+ const w = {}, k = c !== p.base.text;
717
+ k !== p.value.dirty && (w.dirty = k);
718
+ const { save: L } = p.value;
715
719
  if (L.kind === "conflicts") {
716
- const R = kt(c).length;
717
- R === 0 ? w.save = Ze : R !== L.count && (w.save = { kind: "conflicts", count: R });
720
+ const O = kt(c).length;
721
+ O === 0 ? w.save = Ze : O !== L.count && (w.save = { kind: "conflicts", count: O });
718
722
  }
719
- (w.dirty !== void 0 || w.save !== void 0) && m(h, w);
723
+ (w.dirty !== void 0 || w.save !== void 0) && m(p, w);
720
724
  },
721
725
  consumeRequest: (s) => {
722
726
  const c = o.get(s);
723
727
  c !== void 0 && c.value.request !== null && m(c, { request: null });
724
728
  },
725
- save: M,
729
+ save: C,
726
730
  replaceDraft: (s, c) => {
727
- const h = d.get(s);
728
- h?.flush();
731
+ const p = d.get(s);
732
+ p?.flush();
729
733
  const w = o.get(s);
730
734
  if (w === void 0 || w.base === null) return;
731
735
  const k = Ue(c);
732
- w.draft = k, h?.adopt(k), m(w, { dirty: k !== w.base.text, generation: w.value.generation + 1 });
736
+ w.draft = k, p?.adopt(k), m(w, { dirty: k !== w.base.text, generation: w.value.generation + 1 });
733
737
  },
734
738
  close: (s) => {
735
739
  if (!o.has(s)) return;
736
- const c = d.get(s), h = c === void 0 ? null : c.returnPoint();
737
- y(s), h === null ? l.delete(s) : l.set(s, h), f.emit();
740
+ const c = d.get(s), p = c === void 0 ? null : c.returnPoint();
741
+ x(s), p === null ? l.delete(s) : l.set(s, p), f.emit();
738
742
  },
739
743
  takeReturn: (s) => {
740
744
  const c = l.get(s) ?? null;
@@ -742,7 +746,7 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
742
746
  },
743
747
  dirtyPaths: () => [...o.values()].filter((s) => s.value.dirty).map((s) => s.value.path),
744
748
  discard: (s) => {
745
- for (const c of s) y(c);
749
+ for (const c of s) x(c);
746
750
  s.length > 0 && f.emit();
747
751
  },
748
752
  editorState: {
@@ -768,51 +772,51 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
768
772
  return s.filter((c) => o.get(c)?.value.dirty === !0);
769
773
  },
770
774
  askToDiscard: (s) => new Promise((c) => {
771
- p?.settle(!1);
772
- const h = {
775
+ h?.settle(!1);
776
+ const p = {
773
777
  paths: s,
774
778
  settle: (w) => {
775
- if (p === h) {
776
- if (p = null, w) for (const k of s) y(k);
779
+ if (h === p) {
780
+ if (h = null, w) for (const k of s) x(k);
777
781
  f.emit(), c(w);
778
782
  }
779
783
  }
780
784
  };
781
- p = h, f.emit();
785
+ h = p, f.emit();
782
786
  }),
783
- discardRequest: () => p,
787
+ discardRequest: () => h,
784
788
  previewShown: () => (u ??= r.read(), u),
785
789
  setPreviewShown: (s) => {
786
790
  u !== s && (u = s, r.write(s), f.emit());
787
791
  }
788
792
  };
789
- }, on = (e) => {
793
+ }, rn = (e) => {
790
794
  e.preventDefault(), e.stopPropagation();
791
- }, ln = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: l, onCancel: i, testId: d }) => {
792
- const g = B(null), f = B(null), u = B(null), p = Oe(), m = Oe();
793
- return V(() => {
794
- const y = g.current;
795
- if (y !== null)
796
- if (e && !y.open) {
797
- const T = y.ownerDocument.activeElement;
798
- u.current = T instanceof HTMLElement ? T : null, y.showModal(), f.current?.focus();
799
- } else !e && y.open && (y.close(), u.current?.isConnected === !0 && u.current.focus(), u.current = null);
800
- }, [e]), /* @__PURE__ */ a("dialog", { ref: g, className: "aqmx-confirm", "aria-labelledby": p, "aria-describedby": m, "data-testid": d, onKeyDown: (y) => {
801
- y.key !== "Escape" || y.defaultPrevented || (on(y), i());
802
- }, onClick: (y) => {
803
- y.target === y.currentTarget && i();
804
- }, onCancel: (y) => y.preventDefault(), children: /* @__PURE__ */ F("div", { className: "aqmx-confirm-panel", children: [
805
- /* @__PURE__ */ a("p", { id: p, className: "aqmx-confirm-title", children: t }),
795
+ }, on = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: l, onCancel: i, testId: d }) => {
796
+ const g = _(null), f = _(null), u = _(null), h = Oe(), m = Oe();
797
+ return U(() => {
798
+ const x = g.current;
799
+ if (x !== null)
800
+ if (e && !x.open) {
801
+ const T = x.ownerDocument.activeElement;
802
+ u.current = T instanceof HTMLElement ? T : null, x.showModal(), f.current?.focus();
803
+ } else !e && x.open && (x.close(), u.current?.isConnected === !0 && u.current.focus(), u.current = null);
804
+ }, [e]), /* @__PURE__ */ a("dialog", { ref: g, className: "aqmx-confirm", "aria-labelledby": h, "aria-describedby": m, "data-testid": d, onKeyDown: (x) => {
805
+ x.key !== "Escape" || x.defaultPrevented || (rn(x), i());
806
+ }, onClick: (x) => {
807
+ x.target === x.currentTarget && i();
808
+ }, onCancel: (x) => x.preventDefault(), children: /* @__PURE__ */ F("div", { className: "aqmx-confirm-panel", children: [
809
+ /* @__PURE__ */ a("p", { id: h, className: "aqmx-confirm-title", children: t }),
806
810
  /* @__PURE__ */ a("p", { id: m, className: "aqmx-confirm-body", children: n }),
807
811
  /* @__PURE__ */ F("div", { className: "aqmx-confirm-actions", children: [
808
812
  /* @__PURE__ */ a("button", { ref: f, type: "button", className: "aqmx-callout-action", "data-testid": `${d}-cancel`, onClick: i, children: o }),
809
813
  /* @__PURE__ */ a("button", { type: "button", className: "aqmx-callout-action", "data-aqmx-tone": "danger", "data-testid": `${d}-confirm`, onClick: l, children: r })
810
814
  ] })
811
815
  ] }) });
812
- }, Ar = (e, t) => {
813
- const n = An({ path: `${e.basePath}/*`, end: !0 }, t.pathname);
816
+ }, Or = (e, t) => {
817
+ const n = On({ path: `${e.basePath}/*`, end: !0 }, t.pathname);
814
818
  if (n === null) return /* @__PURE__ */ new Set();
815
- const { location: r } = Kt(e, n.params["*"], new URLSearchParams(t.search));
819
+ const { location: r } = Gt(e, n.params["*"], new URLSearchParams(t.search));
816
820
  switch (r.view) {
817
821
  case "tree":
818
822
  return new Set(r.doc === null ? [] : [r.doc]);
@@ -821,34 +825,34 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
821
825
  case "multi":
822
826
  return new Set(r.docs);
823
827
  }
824
- }, sn = (e) => {
828
+ }, ln = (e) => {
825
829
  const { edits: t } = D(), n = P(() => t.session(e), [t, e]);
826
- return te(t.subscribe, n, Lr);
827
- }, an = () => !1, Lr = () => {
828
- }, Mr = () => {
830
+ return ee(t.subscribe, n, Ar);
831
+ }, sn = () => !1, Ar = () => {
832
+ }, Lr = () => {
829
833
  const { edits: e } = D();
830
- return te(e.subscribe, e.hasSessions, an);
831
- }, Nr = () => {
834
+ return ee(e.subscribe, e.hasSessions, sn);
835
+ }, Mr = () => {
832
836
  const { edits: e } = D();
833
- return te(e.subscribe, e.previewShown, an);
834
- }, Dr = () => null, $r = () => {
835
- const { edits: e, labels: t, config: n } = D(), r = B([]), o = P(
836
- ({ nextLocation: p }) => {
837
- const m = Ar(n, p);
838
- return e.flushDrafts(), r.current = e.dirtyPaths().filter((x) => !m.has(x)), r.current.length > 0;
837
+ return ee(e.subscribe, e.previewShown, sn);
838
+ }, Nr = () => null, Dr = () => {
839
+ const { edits: e, labels: t, config: n } = D(), r = _([]), o = P(
840
+ ({ nextLocation: h }) => {
841
+ const m = Or(n, h);
842
+ return e.flushDrafts(), r.current = e.dirtyPaths().filter((S) => !m.has(S)), r.current.length > 0;
839
843
  },
840
844
  [e, n]
841
- ), l = Ln(o), i = Mr();
842
- ne(() => {
845
+ ), l = An(o), i = Lr();
846
+ te(() => {
843
847
  if (!i) return;
844
- const p = (m) => {
848
+ const h = (m) => {
845
849
  e.flushDrafts(), e.dirtyPaths().length !== 0 && (m.preventDefault(), m.returnValue = !0);
846
850
  };
847
- return window.addEventListener("beforeunload", p), () => window.removeEventListener("beforeunload", p);
851
+ return window.addEventListener("beforeunload", h), () => window.removeEventListener("beforeunload", h);
848
852
  }, [i, e]);
849
- const d = te(e.subscribe, e.discardRequest, Dr), g = l.state === "blocked", u = (g ? r.current : d === null ? [] : d.paths).map((p) => Ee(p)).join(", ");
853
+ const d = ee(e.subscribe, e.discardRequest, Nr), g = l.state === "blocked", u = (g ? r.current : d === null ? [] : d.paths).map((h) => Ee(h)).join(", ");
850
854
  return /* @__PURE__ */ a(
851
- ln,
855
+ on,
852
856
  {
853
857
  open: g || d !== null,
854
858
  title: t.unsavedTitle,
@@ -873,12 +877,12 @@ const bt = Object.freeze(["en", "ja"]), ur = "en", fr = Object.freeze({
873
877
  }
874
878
  );
875
879
  };
876
- function Pr({
880
+ function $r({
877
881
  title: e,
878
882
  titleId: t,
879
883
  ...n
880
884
  }, r) {
881
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
885
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
882
886
  xmlns: "http://www.w3.org/2000/svg",
883
887
  viewBox: "0 0 20 20",
884
888
  fill: "currentColor",
@@ -886,26 +890,26 @@ function Pr({
886
890
  "data-slot": "icon",
887
891
  ref: r,
888
892
  "aria-labelledby": t
889
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
893
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
890
894
  id: t
891
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
895
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
892
896
  fillRule: "evenodd",
893
897
  d: "M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm2.25 8.5a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 3a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",
894
898
  clipRule: "evenodd"
895
899
  }));
896
900
  }
897
- const Fr = /* @__PURE__ */ b.forwardRef(Pr);
901
+ const Pr = /* @__PURE__ */ E.forwardRef($r);
898
902
  let Ve = null;
899
- const cn = () => (Ve ??= import("./EditSurface-1Jf0CG-f.js").catch((e) => {
903
+ const an = () => (Ve ??= import("./EditSurface-BTAhzvHi.js").catch((e) => {
900
904
  throw Ve = null, e;
901
- }), Ve), Rt = () => {
902
- cn().catch(() => {
905
+ }), Ve), Fr = () => {
906
+ an().catch(() => {
903
907
  });
904
908
  }, qr = (e) => {
905
- const { default: t } = re(cn());
909
+ const { default: t } = ne(an());
906
910
  return /* @__PURE__ */ a(t, { ...e });
907
911
  };
908
- class _r extends Vt {
912
+ class _r extends Zt {
909
913
  state = { failed: !1 };
910
914
  static getDerivedStateFromError() {
911
915
  return { failed: !0 };
@@ -915,7 +919,7 @@ class _r extends Vt {
915
919
  return this.state.failed ? this.props.fallback(this.retry) : this.props.children;
916
920
  }
917
921
  }
918
- const rt = `[${Xt}]`, Br = "[data-aqmd-content]", Ir = 'a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg', jr = 200, we = (e) => sr(e.getAttribute(Xt)), Hr = (e, t) => {
922
+ const rt = `[${Wt}]`, Br = "[data-aqmd-content]", Ir = 'a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg', jr = 200, we = (e) => ir(e.getAttribute(Wt)), Hr = (e, t) => {
919
923
  for (let r = e; r !== null && t.contains(r); r = r.parentElement) {
920
924
  const o = we(r);
921
925
  if (o !== null) return { block: r, lines: o, own: !0 };
@@ -963,7 +967,7 @@ const rt = `[${Xt}]`, Br = "[data-aqmd-content]", Ir = 'a[href], button, input,
963
967
  if (r === "" || r.length > jr || /[\r\n]/u.test(r)) return null;
964
968
  const o = e.ownerDocument.createRange();
965
969
  return o.setStart(e, 0), o.setEnd(n.startContainer, n.startOffset), { text: r, occurrence: zr(o.toString(), r), clientTop: n.getBoundingClientRect().top };
966
- }, ns = (e, t) => {
970
+ }, os = (e, t) => {
967
971
  const n = e.split(`
968
972
  `), r = Math.min(t.lines.first, n.length), o = Math.min(t.lines.last, n.length), l = { line: r, column: 0 };
969
973
  if (t.word === null) return l;
@@ -1010,15 +1014,15 @@ const rt = `[${Xt}]`, Br = "[data-aqmd-content]", Ir = 'a[href], button, input,
1010
1014
  "switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
1011
1015
  "switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
1012
1016
  "follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
1013
- }), rs = (e) => ot[e], $e = () => {
1014
- const e = Mn();
1017
+ }), ls = (e) => ot[e], $e = () => {
1018
+ const e = Ln();
1015
1019
  return P(
1016
1020
  (t, n) => {
1017
1021
  e(t, ot[n]);
1018
1022
  },
1019
1023
  [e]
1020
1024
  );
1021
- }, Qr = ({ navigation: e, ...t }) => /* @__PURE__ */ a(Nn, { ...t, ...ot[e] }), dn = (e) => {
1025
+ }, Qr = ({ navigation: e, ...t }) => /* @__PURE__ */ a(Mn, { ...t, ...ot[e] }), cn = (e) => {
1022
1026
  const t = e.ownerDocument;
1023
1027
  if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
1024
1028
  if (e.hasAttribute("tabindex")) return !1;
@@ -1029,10 +1033,10 @@ const rt = `[${Xt}]`, Br = "[data-aqmd-content]", Ir = 'a[href], button, input,
1029
1033
  };
1030
1034
  return e.addEventListener("blur", n), !0;
1031
1035
  }, eo = (e, t) => {
1032
- const n = B(null), r = B(null), o = B(null), l = P(() => {
1036
+ const n = _(null), r = _(null), o = _(null), l = P(() => {
1033
1037
  n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
1034
1038
  }, []);
1035
- ne(() => l, [l]);
1039
+ te(() => l, [l]);
1036
1040
  const i = P(
1037
1041
  (f) => {
1038
1042
  if (r.current !== f) return;
@@ -1042,9 +1046,9 @@ const rt = `[${Xt}]`, Br = "[data-aqmd-content]", Ir = 'a[href], button, input,
1042
1046
  return;
1043
1047
  }
1044
1048
  e.prefetch(f);
1045
- const p = e.peek(f);
1046
- if (p?.status !== "pending") return;
1047
- const m = Promise.allSettled([p.promise]);
1049
+ const h = e.peek(f);
1050
+ if (h?.status !== "pending") return;
1051
+ const m = Promise.allSettled([h.promise]);
1048
1052
  o.current = m, m.then(() => {
1049
1053
  o.current === m && (o.current = null);
1050
1054
  });
@@ -1055,7 +1059,7 @@ const rt = `[${Xt}]`, Br = "[data-aqmd-content]", Ir = 'a[href], button, input,
1055
1059
  const u = t(f);
1056
1060
  u !== r.current && (l(), u !== null && (r.current = u, n.current = window.setTimeout(() => {
1057
1061
  n.current = null, i(u);
1058
- }, Pn)));
1062
+ }, $n)));
1059
1063
  },
1060
1064
  [l, t, i]
1061
1065
  ), g = P(
@@ -1064,7 +1068,7 @@ const rt = `[${Xt}]`, Br = "[data-aqmd-content]", Ir = 'a[href], button, input,
1064
1068
  },
1065
1069
  [l, t]
1066
1070
  );
1067
- return U(
1071
+ return z(
1068
1072
  () => ({
1069
1073
  onPointerOver: (f) => d(f.target),
1070
1074
  onPointerOut: (f) => g(f.relatedTarget),
@@ -1073,8 +1077,8 @@ const rt = `[${Xt}]`, Br = "[data-aqmd-content]", Ir = 'a[href], button, input,
1073
1077
  }),
1074
1078
  [d, g]
1075
1079
  );
1076
- }, to = tt(() => import("./NativeScrollBar-CyiyL47o.js").then((e) => ({ default: e.NativeScrollBar })));
1077
- class no extends Vt {
1080
+ }, to = tt(() => import("./NativeScrollBar-CNQr7JY1.js").then((e) => ({ default: e.NativeScrollBar })));
1081
+ class no extends Zt {
1078
1082
  state = { failed: !1 };
1079
1083
  static getDerivedStateFromError() {
1080
1084
  return { failed: !0 };
@@ -1086,7 +1090,7 @@ class no extends Vt {
1086
1090
  return this.state.failed ? null : this.props.children;
1087
1091
  }
1088
1092
  }
1089
- const ro = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ a(no, { children: /* @__PURE__ */ a(ge, { fallback: null, children: /* @__PURE__ */ a(to, { scroller: e, withCircle: t }) }) }), un = (e) => /* @__PURE__ */ a(ro, { scroller: e, withCircle: !0 }), fn = () => {
1093
+ const ro = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ a(no, { children: /* @__PURE__ */ a(ge, { fallback: null, children: /* @__PURE__ */ a(to, { scroller: e, withCircle: t }) }) }), dn = (e) => /* @__PURE__ */ a(ro, { scroller: e, withCircle: !0 }), un = () => {
1090
1094
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
1091
1095
  let n = !1;
1092
1096
  const r = (o) => {
@@ -1130,9 +1134,9 @@ const ro = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ a(no, { children:
1130
1134
  t.status = "rejected", t.reason = n;
1131
1135
  }
1132
1136
  )), t;
1133
- }, mn = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), Se = (e) => e.status === "fulfilled" ? e.value : void 0, oo = 55e3, Tt = Object.freeze({ status: "deferred" }), Ct = Object.freeze({ status: "refreshed" }), Ge = Object.freeze({ status: "superseded" }), de = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, hn = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", lo = ({ client: e, capacity: t }) => {
1137
+ }, fn = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), Se = (e) => e.status === "fulfilled" ? e.value : void 0, oo = 55e3, Rt = Object.freeze({ status: "deferred" }), Tt = Object.freeze({ status: "refreshed" }), Ge = Object.freeze({ status: "superseded" }), de = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, mn = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", lo = ({ client: e, capacity: t }) => {
1134
1138
  if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
1135
- const n = /* @__PURE__ */ new Map(), r = fn(), o = ye(), l = /* @__PURE__ */ new WeakSet();
1139
+ const n = /* @__PURE__ */ new Map(), r = un(), o = ye(), l = /* @__PURE__ */ new WeakSet();
1136
1140
  let i = 0;
1137
1141
  const d = o.emit, g = () => (i += 1, i), f = () => {
1138
1142
  if (!(n.size <= t))
@@ -1142,31 +1146,31 @@ const ro = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ a(no, { children:
1142
1146
  }
1143
1147
  }, u = (s, c) => {
1144
1148
  n.delete(s), n.set(s, c);
1145
- }, p = (s) => performance.now() - s.validatedAt >= oo, m = (s, c, h) => {
1146
- const w = n.get(s), k = de(w?.snapshot), L = h || w?.refreshPending === !0, R = be(e.document(s, { refresh: L }).then((q) => ({ status: "loaded", document: q }))), N = { snapshot: { status: "pending", promise: R, previous: k }, validatedAt: performance.now(), opened: c, background: null, refreshPending: !1, seeded: void 0, stamp: g() };
1147
- return u(s, N), f(), R.then((q) => {
1149
+ }, h = (s) => performance.now() - s.validatedAt >= oo, m = (s, c, p) => {
1150
+ const w = n.get(s), k = de(w?.snapshot), L = p || w?.refreshPending === !0, O = be(e.document(s, { refresh: L }).then((q) => ({ status: "loaded", document: q }))), N = { snapshot: { status: "pending", promise: O, previous: k }, validatedAt: performance.now(), opened: c, background: null, refreshPending: !1, seeded: void 0, stamp: g() };
1151
+ return u(s, N), f(), O.then((q) => {
1148
1152
  n.get(s) === N && (N.snapshot = q, N.stamp = g(), d());
1149
1153
  }), N;
1150
- }, x = (s, c, h, w, k, L) => {
1151
- c.background === h && (c.background = null, !(n.get(s) !== c || c.snapshot !== w) && (k.kind === "failure" && w.document.kind !== "failure" || (c.validatedAt = L, c.stamp = g(), Me(w.document, k) || (c.snapshot = { status: "loaded", document: k }), d())));
1152
- }, O = async (s, c) => {
1153
- const h = c.snapshot;
1154
- if (h.status !== "loaded") return null;
1154
+ }, S = (s, c, p, w, k, L) => {
1155
+ c.background === p && (c.background = null, !(n.get(s) !== c || c.snapshot !== w) && (k.kind === "failure" && w.document.kind !== "failure" || (c.validatedAt = L, c.stamp = g(), Me(w.document, k) || (c.snapshot = { status: "loaded", document: k }), d())));
1156
+ }, A = async (s, c) => {
1157
+ const p = c.snapshot;
1158
+ if (p.status !== "loaded") return null;
1155
1159
  const w = {};
1156
1160
  c.background = w;
1157
1161
  const k = performance.now(), L = e.document(s, { refresh: c.refreshPending });
1158
1162
  c.refreshPending = !1;
1159
- const R = await L, N = c.background === w && n.get(s) === c && c.snapshot === h;
1160
- return x(s, c, w, h, R, k), N ? R : null;
1161
- }, y = (s, c) => {
1162
- const { snapshot: h } = c;
1163
- return h.status === "pending" ? !1 : h.status === "loaded" && h.document.kind !== "failure" ? (O(s, c), !1) : (h.status === "loaded" && l.add(h), m(s, !0, !1), !0);
1163
+ const O = await L, N = c.background === w && n.get(s) === c && c.snapshot === p;
1164
+ return S(s, c, w, p, O, k), N ? O : null;
1165
+ }, x = (s, c) => {
1166
+ const { snapshot: p } = c;
1167
+ return p.status === "pending" ? !1 : p.status === "loaded" && p.document.kind !== "failure" ? (A(s, c), !1) : (p.status === "loaded" && l.add(p), m(s, !0, !1), !0);
1164
1168
  }, T = (s) => {
1165
1169
  const c = r.hold(s);
1166
- let h = !1;
1170
+ let p = !1;
1167
1171
  return () => {
1168
- if (h) return;
1169
- h = !0, c();
1172
+ if (p) return;
1173
+ p = !0, c();
1170
1174
  const w = n.get(s);
1171
1175
  w !== void 0 && u(s, w), f();
1172
1176
  };
@@ -1180,12 +1184,12 @@ const ro = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ a(no, { children:
1180
1184
  c !== void 0 && c.snapshot.status !== "deferred" || (m(s, !1, !1), d());
1181
1185
  },
1182
1186
  open: (s) => {
1183
- const c = r.resumes(s), h = T(s), w = n.get(s);
1187
+ const c = r.resumes(s), p = T(s), w = n.get(s);
1184
1188
  if (w === void 0 || w.snapshot.status === "deferred")
1185
- return m(s, !0, !1), d(), h;
1186
- if (u(s, w), c) return h;
1189
+ return m(s, !0, !1), d(), p;
1190
+ if (u(s, w), c) return p;
1187
1191
  const { snapshot: k } = w;
1188
- return k.status === "pending" ? (w.opened = !0, h) : k.document.kind === "failure" ? (w.opened || p(w) ? (l.add(k), m(s, !0, !1), d()) : w.opened = !0, h) : (w.opened = !0, w.background === null && p(w) && O(s, w), h);
1192
+ return k.status === "pending" ? (w.opened = !0, p) : k.document.kind === "failure" ? (w.opened || h(w) ? (l.add(k), m(s, !0, !1), d()) : w.opened = !0, p) : (w.opened = !0, w.background === null && h(w) && A(s, w), p);
1189
1193
  },
1190
1194
  retain: T,
1191
1195
  retry: (s) => {
@@ -1193,52 +1197,52 @@ const ro = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ a(no, { children:
1193
1197
  c === void 0 || c.snapshot.status !== "loaded" || c.snapshot.document.kind !== "failure" || (m(s, !0, !1), d());
1194
1198
  },
1195
1199
  seed: (s, c) => {
1196
- const h = performance.now(), w = be(
1200
+ const p = performance.now(), w = be(
1197
1201
  c.then(
1198
- (q) => q === null ? Tt : { status: "loaded", document: q },
1199
- () => Tt
1202
+ (q) => q === null ? Rt : { status: "loaded", document: q },
1203
+ () => Rt
1200
1204
  )
1201
1205
  ), k = n.get(s);
1202
1206
  if (k !== void 0 && k.snapshot.status === "loaded") {
1203
- const q = k.snapshot, W = {};
1204
- k.background = W, w.then((J) => {
1205
- if (J.status === "loaded") {
1206
- x(s, k, W, q, J.document, h);
1207
+ const q = k.snapshot, G = {};
1208
+ k.background = G, w.then((W) => {
1209
+ if (W.status === "loaded") {
1210
+ S(s, k, G, q, W.document, p);
1207
1211
  return;
1208
1212
  }
1209
- k.background === W && (k.background = null);
1213
+ k.background === G && (k.background = null);
1210
1214
  });
1211
1215
  return;
1212
1216
  }
1213
- const L = k !== void 0 && k.snapshot.status === "pending" ? k.snapshot.previous : null, R = { status: "pending", promise: w, previous: L }, N = { snapshot: R, validatedAt: h, opened: k?.opened === !0, background: null, refreshPending: k?.refreshPending === !0, seeded: R, stamp: g() };
1217
+ const L = k !== void 0 && k.snapshot.status === "pending" ? k.snapshot.previous : null, O = { status: "pending", promise: w, previous: L }, N = { snapshot: O, validatedAt: p, opened: k?.opened === !0, background: null, refreshPending: k?.refreshPending === !0, seeded: O, stamp: g() };
1214
1218
  u(s, N), f(), w.then((q) => {
1215
1219
  n.get(s) === N && (q.status === "deferred" && r.isHeld(s) ? m(s, N.opened, !1) : (N.snapshot = q, N.stamp = g()), d());
1216
1220
  });
1217
1221
  },
1218
1222
  invalidate: () => {
1219
1223
  let s = !1;
1220
- for (const [c, h] of [...n]) {
1221
- if (h.validatedAt = Number.NEGATIVE_INFINITY, h.opened = !0, h.refreshPending = !0, !r.isHeld(c)) continue;
1222
- const { snapshot: w } = h;
1224
+ for (const [c, p] of [...n]) {
1225
+ if (p.validatedAt = Number.NEGATIVE_INFINITY, p.opened = !0, p.refreshPending = !0, !r.isHeld(c)) continue;
1226
+ const { snapshot: w } = p;
1223
1227
  if (w.status !== "pending") {
1224
- y(c, h) && (s = !0);
1228
+ x(c, p) && (s = !0);
1225
1229
  continue;
1226
1230
  }
1227
1231
  w.promise.then(() => {
1228
- n.get(c) === h && h.refreshPending && r.isHeld(c) && y(c, h) && d();
1232
+ n.get(c) === p && p.refreshPending && r.isHeld(c) && x(c, p) && d();
1229
1233
  });
1230
1234
  }
1231
1235
  s && d();
1232
1236
  },
1233
1237
  refresh: async (s) => {
1234
1238
  const c = n.get(s);
1235
- if (c !== void 0 && hn(c.snapshot)) {
1239
+ if (c !== void 0 && mn(c.snapshot)) {
1236
1240
  c.refreshPending = !0;
1237
- const w = await O(s, c);
1238
- return w === null ? Ge : w.kind === "failure" ? { status: "failed", failure: w.failure } : Ct;
1241
+ const w = await A(s, c);
1242
+ return w === null ? Ge : w.kind === "failure" ? { status: "failed", failure: w.failure } : Tt;
1239
1243
  }
1240
- const h = m(s, !0, !0);
1241
- return d(), h.snapshot.status !== "pending" ? Ge : (await h.snapshot.promise, n.get(s) === h ? Ct : Ge);
1244
+ const p = m(s, !0, !0);
1245
+ return d(), p.snapshot.status !== "pending" ? Ge : (await p.snapshot.promise, n.get(s) === p ? Tt : Ge);
1242
1246
  },
1243
1247
  clear: () => {
1244
1248
  n.clear();
@@ -1254,7 +1258,7 @@ function io({
1254
1258
  titleId: t,
1255
1259
  ...n
1256
1260
  }, r) {
1257
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1261
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1258
1262
  xmlns: "http://www.w3.org/2000/svg",
1259
1263
  viewBox: "0 0 20 20",
1260
1264
  fill: "currentColor",
@@ -1262,25 +1266,25 @@ function io({
1262
1266
  "data-slot": "icon",
1263
1267
  ref: r,
1264
1268
  "aria-labelledby": t
1265
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1269
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1266
1270
  id: t
1267
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1271
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1268
1272
  fillRule: "evenodd",
1269
1273
  d: "M18 5.25a2.25 2.25 0 0 0-2.012-2.238A2.25 2.25 0 0 0 13.75 1h-1.5a2.25 2.25 0 0 0-2.238 2.012c-.875.092-1.6.686-1.884 1.488H11A2.5 2.5 0 0 1 13.5 7v7h2.25A2.25 2.25 0 0 0 18 11.75v-6.5ZM12.25 2.5a.75.75 0 0 0-.75.75v.25h3v-.25a.75.75 0 0 0-.75-.75h-1.5Z",
1270
1274
  clipRule: "evenodd"
1271
- }), /* @__PURE__ */ b.createElement("path", {
1275
+ }), /* @__PURE__ */ E.createElement("path", {
1272
1276
  fillRule: "evenodd",
1273
1277
  d: "M3 6a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H3Zm6.874 4.166a.75.75 0 1 0-1.248-.832l-2.493 3.739-.853-.853a.75.75 0 0 0-1.06 1.06l1.5 1.5a.75.75 0 0 0 1.154-.114l3-4.5Z",
1274
1278
  clipRule: "evenodd"
1275
1279
  }));
1276
1280
  }
1277
- const so = /* @__PURE__ */ b.forwardRef(io);
1281
+ const so = /* @__PURE__ */ E.forwardRef(io);
1278
1282
  function ao({
1279
1283
  title: e,
1280
1284
  titleId: t,
1281
1285
  ...n
1282
1286
  }, r) {
1283
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1287
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1284
1288
  xmlns: "http://www.w3.org/2000/svg",
1285
1289
  viewBox: "0 0 20 20",
1286
1290
  fill: "currentColor",
@@ -1288,23 +1292,23 @@ function ao({
1288
1292
  "data-slot": "icon",
1289
1293
  ref: r,
1290
1294
  "aria-labelledby": t
1291
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1295
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1292
1296
  id: t
1293
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1297
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1294
1298
  fillRule: "evenodd",
1295
1299
  d: "M15.988 3.012A2.25 2.25 0 0 1 18 5.25v6.5A2.25 2.25 0 0 1 15.75 14H13.5v-3.379a3 3 0 0 0-.879-2.121l-3.12-3.121a3 3 0 0 0-1.402-.791 2.252 2.252 0 0 1 1.913-1.576A2.25 2.25 0 0 1 12.25 1h1.5a2.25 2.25 0 0 1 2.238 2.012ZM11.5 3.25a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 .75.75v.25h-3v-.25Z",
1296
1300
  clipRule: "evenodd"
1297
- }), /* @__PURE__ */ b.createElement("path", {
1301
+ }), /* @__PURE__ */ E.createElement("path", {
1298
1302
  d: "M3.5 6A1.5 1.5 0 0 0 2 7.5v9A1.5 1.5 0 0 0 3.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L8.44 6.439A1.5 1.5 0 0 0 7.378 6H3.5Z"
1299
1303
  }));
1300
1304
  }
1301
- const co = /* @__PURE__ */ b.forwardRef(ao);
1305
+ const co = /* @__PURE__ */ E.forwardRef(ao);
1302
1306
  function uo({
1303
1307
  title: e,
1304
1308
  titleId: t,
1305
1309
  ...n
1306
1310
  }, r) {
1307
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1311
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1308
1312
  xmlns: "http://www.w3.org/2000/svg",
1309
1313
  viewBox: "0 0 20 20",
1310
1314
  fill: "currentColor",
@@ -1312,22 +1316,22 @@ function uo({
1312
1316
  "data-slot": "icon",
1313
1317
  ref: r,
1314
1318
  "aria-labelledby": t
1315
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1319
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1316
1320
  id: t
1317
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1321
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1318
1322
  fillRule: "evenodd",
1319
1323
  d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
1320
1324
  clipRule: "evenodd"
1321
1325
  }));
1322
1326
  }
1323
- const fo = /* @__PURE__ */ b.forwardRef(uo), mo = 2e3, Ot = Object.freeze({ outcome: "idle" }), ho = (e) => {
1327
+ const fo = /* @__PURE__ */ E.forwardRef(uo), mo = 2e3, Ct = Object.freeze({ outcome: "idle" }), ho = (e) => {
1324
1328
  const t = navigator.clipboard;
1325
1329
  return t === void 0 ? Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")) : t.writeText(e);
1326
1330
  }, po = ({ text: e }) => {
1327
- const { announcer: t, labels: n } = D(), [r, o] = I(Ot);
1328
- ne(() => {
1331
+ const { announcer: t, labels: n } = D(), [r, o] = I(Ct);
1332
+ te(() => {
1329
1333
  if (r.outcome === "idle") return;
1330
- const g = setTimeout(() => o(Ot), mo);
1334
+ const g = setTimeout(() => o(Ct), mo);
1331
1335
  return () => clearTimeout(g);
1332
1336
  }, [r]);
1333
1337
  const l = (g) => {
@@ -1341,13 +1345,13 @@ const fo = /* @__PURE__ */ b.forwardRef(uo), mo = 2e3, Ot = Object.freeze({ outc
1341
1345
  return (
1342
1346
  /* @__PURE__ */ a("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: d, onClick: i, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ a(so, {}) : r.outcome === "failed" ? /* @__PURE__ */ a(fo, {}) : /* @__PURE__ */ a(co, {}) })
1343
1347
  );
1344
- }, fe = me("fill"), go = Object.freeze({ blockSize: "100%" }), xe = ({ scrollerProps: e, children: t }) => re(fe) === "content" ? /* @__PURE__ */ a(vt, { scrollerProps: e, children: t }) : /* @__PURE__ */ a(vt, { scrollerProps: { ...e, style: go }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: un, children: t });
1348
+ }, fe = me("fill"), go = Object.freeze({ blockSize: "100%" }), xe = ({ scrollerProps: e, children: t }) => ne(fe) === "content" ? /* @__PURE__ */ a(vt, { scrollerProps: e, children: t }) : /* @__PURE__ */ a(vt, { scrollerProps: { ...e, style: go }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: dn, children: t });
1345
1349
  function vo({
1346
1350
  title: e,
1347
1351
  titleId: t,
1348
1352
  ...n
1349
1353
  }, r) {
1350
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1354
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1351
1355
  xmlns: "http://www.w3.org/2000/svg",
1352
1356
  viewBox: "0 0 20 20",
1353
1357
  fill: "currentColor",
@@ -1355,21 +1359,21 @@ function vo({
1355
1359
  "data-slot": "icon",
1356
1360
  ref: r,
1357
1361
  "aria-labelledby": t
1358
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1362
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1359
1363
  id: t
1360
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1364
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1361
1365
  d: "M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z"
1362
- }), /* @__PURE__ */ b.createElement("path", {
1366
+ }), /* @__PURE__ */ E.createElement("path", {
1363
1367
  d: "M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"
1364
1368
  }));
1365
1369
  }
1366
- const wo = /* @__PURE__ */ b.forwardRef(vo);
1370
+ const wo = /* @__PURE__ */ E.forwardRef(vo);
1367
1371
  function bo({
1368
1372
  title: e,
1369
1373
  titleId: t,
1370
1374
  ...n
1371
1375
  }, r) {
1372
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1376
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1373
1377
  xmlns: "http://www.w3.org/2000/svg",
1374
1378
  viewBox: "0 0 20 20",
1375
1379
  fill: "currentColor",
@@ -1377,19 +1381,19 @@ function bo({
1377
1381
  "data-slot": "icon",
1378
1382
  ref: r,
1379
1383
  "aria-labelledby": t
1380
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1384
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1381
1385
  id: t
1382
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1386
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1383
1387
  fillRule: "evenodd",
1384
1388
  d: "M4.25 5.5a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75v-4a.75.75 0 0 1 1.5 0v4A2.25 2.25 0 0 1 12.75 17h-8.5A2.25 2.25 0 0 1 2 14.75v-8.5A2.25 2.25 0 0 1 4.25 4h5a.75.75 0 0 1 0 1.5h-5Z",
1385
1389
  clipRule: "evenodd"
1386
- }), /* @__PURE__ */ b.createElement("path", {
1390
+ }), /* @__PURE__ */ E.createElement("path", {
1387
1391
  fillRule: "evenodd",
1388
1392
  d: "M6.194 12.753a.75.75 0 0 0 1.06.053L16.5 4.44v2.81a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.553l-9.056 8.194a.75.75 0 0 0-.053 1.06Z",
1389
1393
  clipRule: "evenodd"
1390
1394
  }));
1391
1395
  }
1392
- const Eo = /* @__PURE__ */ b.forwardRef(bo), Pe = ({ name: e, openUrl: t, downloadUrl: n, icon: r, children: o }) => {
1396
+ const Eo = /* @__PURE__ */ E.forwardRef(bo), Pe = ({ name: e, openUrl: t, downloadUrl: n, icon: r, children: o }) => {
1393
1397
  const { labels: l } = D();
1394
1398
  return /* @__PURE__ */ F("div", { className: "aqmx-document-toolbar", children: [
1395
1399
  /* @__PURE__ */ a("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: r }),
@@ -1404,7 +1408,7 @@ function yo({
1404
1408
  titleId: t,
1405
1409
  ...n
1406
1410
  }, r) {
1407
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1411
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1408
1412
  xmlns: "http://www.w3.org/2000/svg",
1409
1413
  viewBox: "0 0 20 20",
1410
1414
  fill: "currentColor",
@@ -1412,15 +1416,15 @@ function yo({
1412
1416
  "data-slot": "icon",
1413
1417
  ref: r,
1414
1418
  "aria-labelledby": t
1415
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1419
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1416
1420
  id: t
1417
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1421
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1418
1422
  fillRule: "evenodd",
1419
1423
  d: "M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm4.75 6.75a.75.75 0 0 1 1.5 0v2.546l.943-1.048a.75.75 0 0 1 1.114 1.004l-2.25 2.5a.75.75 0 0 1-1.114 0l-2.25-2.5a.75.75 0 1 1 1.114-1.004l.943 1.048V8.75Z",
1420
1424
  clipRule: "evenodd"
1421
1425
  }));
1422
1426
  }
1423
- const xo = /* @__PURE__ */ b.forwardRef(yo), ko = Object.freeze({ className: "aqmx-document-stage" }), So = ({ document: e }) => {
1427
+ const xo = /* @__PURE__ */ E.forwardRef(yo), ko = Object.freeze({ className: "aqmx-document-stage" }), So = ({ document: e }) => {
1424
1428
  const { labels: t } = D();
1425
1429
  return /* @__PURE__ */ F("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
1426
1430
  /* @__PURE__ */ a(Pe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ a(xo, {}) }),
@@ -1436,29 +1440,29 @@ const xo = /* @__PURE__ */ b.forwardRef(yo), ko = Object.freeze({ className: "aq
1436
1440
  if (!e.startsWith("#") || e.length === 1) return null;
1437
1441
  const t = new TextEncoder(), n = e.slice(1).split(To).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
1438
1442
  return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
1439
- }, pn = (e) => `#${encodeURIComponent(e)}`, Co = (e) => {
1443
+ }, hn = (e) => `#${encodeURIComponent(e)}`, Co = (e) => {
1440
1444
  if (e === "#") return !0;
1441
1445
  const t = lt(e);
1442
1446
  return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
1443
- }, gn = (e, t) => {
1447
+ }, pn = (e, t) => {
1444
1448
  if (t === "") return null;
1445
1449
  for (const n of e.querySelectorAll("[id]"))
1446
1450
  if (n.id === t) return n;
1447
1451
  return null;
1448
- }, Oo = "http://www.w3.org/1999/xhtml", At = (e, t) => {
1452
+ }, Oo = "http://www.w3.org/1999/xhtml", Ot = (e, t) => {
1449
1453
  if (t === "") return null;
1450
- const n = gn(e, t);
1454
+ const n = pn(e, t);
1451
1455
  if (n !== null) return n;
1452
1456
  for (const r of e.querySelectorAll("a[name]"))
1453
1457
  if (r.localName === "a" && r.namespaceURI === Oo && r.getAttribute("name") === t) return r;
1454
1458
  return null;
1455
- }, vn = (e, t) => {
1459
+ }, gn = (e, t) => {
1456
1460
  if (e === null || !t.startsWith("#")) return null;
1457
- const n = At(e, t.slice(1));
1461
+ const n = Ot(e, t.slice(1));
1458
1462
  if (n !== null) return n;
1459
1463
  const r = lt(t);
1460
- return r === null ? null : At(e, r);
1461
- }, Lt = (e) => {
1464
+ return r === null ? null : Ot(e, r);
1465
+ }, At = (e) => {
1462
1466
  const { body: t, documentElement: n } = e.ownerDocument;
1463
1467
  if (e === t) {
1464
1468
  const o = getComputedStyle(n);
@@ -1471,10 +1475,10 @@ const xo = /* @__PURE__ */ b.forwardRef(yo), ko = Object.freeze({ className: "aq
1471
1475
  return o !== "hidden" && o !== "clip";
1472
1476
  }, Lo = (e, t) => {
1473
1477
  const n = t.closest(Fe), r = n !== null && e.contains(n) ? n : e;
1474
- if (r.scrollHeight > r.clientHeight && Lt(r)) return r;
1478
+ if (r.scrollHeight > r.clientHeight && At(r)) return r;
1475
1479
  const o = e.getBoundingClientRect().height, { documentElement: l, scrollingElement: i } = e.ownerDocument;
1476
1480
  for (let d = e.parentElement; d !== null && d !== l; d = d.parentElement)
1477
- if (Lt(d) && d.scrollHeight > d.clientHeight && d.clientHeight < o) return d;
1481
+ if (At(d) && d.scrollHeight > d.clientHeight && d.clientHeight < o) return d;
1478
1482
  return i instanceof Element && Ao(e.ownerDocument) && i.scrollHeight > i.clientHeight && i.clientHeight < o ? i : r;
1479
1483
  }, Mo = Object.freeze({
1480
1484
  scrollerOf: Lo,
@@ -1500,9 +1504,9 @@ const xo = /* @__PURE__ */ b.forwardRef(yo), ko = Object.freeze({ className: "aq
1500
1504
  }, $o = (e, t) => {
1501
1505
  const n = t.scrollerOf(e, e.querySelector(Fe) ?? e);
1502
1506
  n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
1503
- }, Mt = (e, t, n) => {
1507
+ }, Lt = (e, t, n) => {
1504
1508
  if (e === null) return null;
1505
- const r = vn(e, t);
1509
+ const r = gn(e, t);
1506
1510
  return r === null ? (Co(t) && $o(e, n), null) : (No(e, r), Do(n.scrollerOf(e, r), r), n.reveal(r), r);
1507
1511
  };
1508
1512
  function Po({
@@ -1510,7 +1514,7 @@ function Po({
1510
1514
  titleId: t,
1511
1515
  ...n
1512
1516
  }, r) {
1513
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1517
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1514
1518
  xmlns: "http://www.w3.org/2000/svg",
1515
1519
  viewBox: "0 0 20 20",
1516
1520
  fill: "currentColor",
@@ -1518,19 +1522,19 @@ function Po({
1518
1522
  "data-slot": "icon",
1519
1523
  ref: r,
1520
1524
  "aria-labelledby": t
1521
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1525
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1522
1526
  id: t
1523
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1527
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1524
1528
  d: "M3.28 2.22a.75.75 0 0 0-1.06 1.06L5.44 6.5H2.75a.75.75 0 0 0 0 1.5h4.5A.75.75 0 0 0 8 7.25v-4.5a.75.75 0 0 0-1.5 0v2.69L3.28 2.22ZM13.5 2.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-2.69l3.22-3.22a.75.75 0 0 0-1.06-1.06L13.5 5.44V2.75ZM3.28 17.78l3.22-3.22v2.69a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.69l-3.22 3.22a.75.75 0 1 0 1.06 1.06ZM13.5 14.56l3.22 3.22a.75.75 0 1 0 1.06-1.06l-3.22-3.22h2.69a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75v4.5a.75.75 0 0 0 1.5 0v-2.69Z"
1525
1529
  }));
1526
1530
  }
1527
- const Fo = /* @__PURE__ */ b.forwardRef(Po);
1531
+ const Fo = /* @__PURE__ */ E.forwardRef(Po);
1528
1532
  function qo({
1529
1533
  title: e,
1530
1534
  titleId: t,
1531
1535
  ...n
1532
1536
  }, r) {
1533
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1537
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1534
1538
  xmlns: "http://www.w3.org/2000/svg",
1535
1539
  viewBox: "0 0 20 20",
1536
1540
  fill: "currentColor",
@@ -1538,23 +1542,23 @@ function qo({
1538
1542
  "data-slot": "icon",
1539
1543
  ref: r,
1540
1544
  "aria-labelledby": t
1541
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1545
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1542
1546
  id: t
1543
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1547
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1544
1548
  d: "M6.75 8.25a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z"
1545
- }), /* @__PURE__ */ b.createElement("path", {
1549
+ }), /* @__PURE__ */ E.createElement("path", {
1546
1550
  fillRule: "evenodd",
1547
1551
  d: "M9 2a7 7 0 1 0 4.391 12.452l3.329 3.328a.75.75 0 1 0 1.06-1.06l-3.328-3.329A7 7 0 0 0 9 2ZM3.5 9a5.5 5.5 0 1 1 11 0 5.5 5.5 0 0 1-11 0Z",
1548
1552
  clipRule: "evenodd"
1549
1553
  }));
1550
1554
  }
1551
- const _o = /* @__PURE__ */ b.forwardRef(qo);
1555
+ const _o = /* @__PURE__ */ E.forwardRef(qo);
1552
1556
  function Bo({
1553
1557
  title: e,
1554
1558
  titleId: t,
1555
1559
  ...n
1556
1560
  }, r) {
1557
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1561
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1558
1562
  xmlns: "http://www.w3.org/2000/svg",
1559
1563
  viewBox: "0 0 20 20",
1560
1564
  fill: "currentColor",
@@ -1562,23 +1566,23 @@ function Bo({
1562
1566
  "data-slot": "icon",
1563
1567
  ref: r,
1564
1568
  "aria-labelledby": t
1565
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1569
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1566
1570
  id: t
1567
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1571
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1568
1572
  d: "M9 6a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0v-1.5h-1.5a.75.75 0 0 1 0-1.5h1.5v-1.5A.75.75 0 0 1 9 6Z"
1569
- }), /* @__PURE__ */ b.createElement("path", {
1573
+ }), /* @__PURE__ */ E.createElement("path", {
1570
1574
  fillRule: "evenodd",
1571
1575
  d: "M2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Zm7-5.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11Z",
1572
1576
  clipRule: "evenodd"
1573
1577
  }));
1574
1578
  }
1575
- const Io = /* @__PURE__ */ b.forwardRef(Bo);
1579
+ const Io = /* @__PURE__ */ E.forwardRef(Bo);
1576
1580
  function jo({
1577
1581
  title: e,
1578
1582
  titleId: t,
1579
1583
  ...n
1580
1584
  }, r) {
1581
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1585
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1582
1586
  xmlns: "http://www.w3.org/2000/svg",
1583
1587
  viewBox: "0 0 20 20",
1584
1588
  fill: "currentColor",
@@ -1586,15 +1590,15 @@ function jo({
1586
1590
  "data-slot": "icon",
1587
1591
  ref: r,
1588
1592
  "aria-labelledby": t
1589
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1593
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1590
1594
  id: t
1591
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1595
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1592
1596
  fillRule: "evenodd",
1593
1597
  d: "M1 5.25A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25v9.5A2.25 2.25 0 0 1 16.75 17H3.25A2.25 2.25 0 0 1 1 14.75v-9.5Zm1.5 5.81v3.69c0 .414.336.75.75.75h13.5a.75.75 0 0 0 .75-.75v-2.69l-2.22-2.219a.75.75 0 0 0-1.06 0l-1.91 1.909.47.47a.75.75 0 1 1-1.06 1.06L6.53 8.091a.75.75 0 0 0-1.06 0l-2.97 2.97ZM12 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",
1594
1598
  clipRule: "evenodd"
1595
1599
  }));
1596
1600
  }
1597
- const Ho = /* @__PURE__ */ b.forwardRef(jo), Je = "data-aqmx-key-repeat", Qe = Object.freeze({ [Je]: "allow" }), zo = `[${Je}="${Qe[Je]}"]`, Uo = () => {
1601
+ const Ho = /* @__PURE__ */ E.forwardRef(jo), Je = "data-aqmx-key-repeat", Qe = Object.freeze({ [Je]: "allow" }), zo = `[${Je}="${Qe[Je]}"]`, Uo = () => {
1598
1602
  let e = null;
1599
1603
  return {
1600
1604
  onKeyDownCapture: (t) => {
@@ -1613,7 +1617,7 @@ const Ho = /* @__PURE__ */ b.forwardRef(jo), Je = "data-aqmx-key-repeat", Qe = O
1613
1617
  t.target === e && (e = null);
1614
1618
  }
1615
1619
  };
1616
- }, Ce = Object.freeze([1 / ke ** 2, 1 / ke, 1, ke, ke ** 2]), Nt = Object.freeze({ mode: "fit" }), Zo = 1, Vo = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), Go = me(null), Ko = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= Zo ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, Dt = (e, t, n) => {
1620
+ }, Ce = Object.freeze([1 / ke ** 2, 1 / ke, 1, ke, ke ** 2]), Mt = Object.freeze({ mode: "fit" }), Zo = 1, Vo = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), Go = me(null), Ko = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= Zo ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, Nt = (e, t, n) => {
1617
1621
  if (e.mode === "level") {
1618
1622
  const o = e.index + n;
1619
1623
  return o >= 0 && o < Ce.length ? o : null;
@@ -1621,43 +1625,43 @@ const Ho = /* @__PURE__ */ b.forwardRef(jo), Je = "data-aqmx-key-repeat", Qe = O
1621
1625
  if (t === null || !Number.isFinite(t) || t <= 0) return null;
1622
1626
  const r = n === 1 ? Ce.findIndex((o) => o > t) : Ce.findLastIndex((o) => o < t);
1623
1627
  return r === -1 ? null : r;
1624
- }, $t = (e, t, n) => {
1628
+ }, Dt = (e, t, n) => {
1625
1629
  if (e.mode === "level") {
1626
- const o = Dt(e, null, n);
1630
+ const o = Nt(e, null, n);
1627
1631
  return o === null ? null : { mode: "level", index: o, base: e.base };
1628
1632
  }
1629
1633
  if (t === null) return null;
1630
- const r = Dt(e, t.scale, n);
1634
+ const r = Nt(e, t.scale, n);
1631
1635
  return r === null ? null : { mode: "level", index: r, base: t.base };
1632
1636
  }, Wo = (e) => {
1633
1637
  const t = Ce[e];
1634
1638
  if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
1635
1639
  return t;
1636
- }, Pt = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, Xo = ({ document: e }) => {
1637
- const { labels: t } = D(), n = re(Go), [r] = I(() => n === null ? null : n.read(e.url)), [o, l] = I(r === null ? Nt : r.zoom), [i, d] = I(r === null ? null : r.reported), [g, f] = I(null), u = B(null), p = P((M) => {
1638
- const { naturalWidth: s, naturalHeight: c } = M;
1639
- d((h) => Pt(h, s, c));
1640
+ }, $t = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, Xo = ({ document: e }) => {
1641
+ const { labels: t } = D(), n = ne(Go), [r] = I(() => n === null ? null : n.read(e.url)), [o, l] = I(r === null ? Mt : r.zoom), [i, d] = I(r === null ? null : r.reported), [g, f] = I(null), u = _(null), h = P((C) => {
1642
+ const { naturalWidth: s, naturalHeight: c } = C;
1643
+ d((p) => $t(p, s, c));
1640
1644
  }, []), m = P(
1641
- (M) => {
1642
- u.current = M, !(M === null || !M.complete) && (M.naturalWidth > 0 || M.naturalHeight > 0 ? p(M) : M.decode().then(
1643
- () => p(M),
1645
+ (C) => {
1646
+ u.current = C, !(C === null || !C.complete) && (C.naturalWidth > 0 || C.naturalHeight > 0 ? h(C) : C.decode().then(
1647
+ () => h(C),
1644
1648
  () => {
1645
1649
  }
1646
1650
  ));
1647
1651
  },
1648
- [p]
1652
+ [h]
1649
1653
  );
1650
- ne(() => {
1654
+ te(() => {
1651
1655
  n !== null && i !== null && n.save(e.url, { zoom: o, reported: i });
1652
- }, [n, e.url, o, i]), V(() => {
1653
- const M = u.current;
1654
- if (M === null || i === null || o.mode !== "fit") return;
1655
- const s = () => f((h) => Pt(h, M.clientWidth, M.clientHeight));
1656
+ }, [n, e.url, o, i]), U(() => {
1657
+ const C = u.current;
1658
+ if (C === null || i === null || o.mode !== "fit") return;
1659
+ const s = () => f((p) => $t(p, C.clientWidth, C.clientHeight));
1656
1660
  if (s(), typeof ResizeObserver > "u") return;
1657
1661
  const c = new ResizeObserver(s);
1658
- return c.observe(M), () => c.disconnect();
1662
+ return c.observe(C), () => c.disconnect();
1659
1663
  }, [i, o.mode]);
1660
- const x = i === null || g === null ? null : Ko(i, g), O = $t(o, x, -1), y = $t(o, x, 1), T = o.mode === "level" ? Wo(o.index) : null, S = o.mode === "level" && T !== null ? { width: `${o.base.width * T}px`, height: `${o.base.height * T}px` } : void 0;
1664
+ const S = i === null || g === null ? null : Ko(i, g), A = Dt(o, S, -1), x = Dt(o, S, 1), T = o.mode === "level" ? Wo(o.index) : null, M = o.mode === "level" && T !== null ? { width: `${o.base.width * T}px`, height: `${o.base.height * T}px` } : void 0;
1661
1665
  return /* @__PURE__ */ F("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1662
1666
  /* @__PURE__ */ F(Pe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ a(Ho, {}), children: [
1663
1667
  /* @__PURE__ */ a(
@@ -1667,9 +1671,9 @@ const Ho = /* @__PURE__ */ b.forwardRef(jo), Je = "data-aqmx-key-repeat", Qe = O
1667
1671
  className: "aqmx-icon-button",
1668
1672
  "aria-label": t.imageZoomOut,
1669
1673
  title: t.imageZoomOut,
1670
- "aria-disabled": O === null,
1674
+ "aria-disabled": A === null,
1671
1675
  onClick: () => {
1672
- O !== null && l(O);
1676
+ A !== null && l(A);
1673
1677
  },
1674
1678
  ...Qe,
1675
1679
  children: /* @__PURE__ */ a(_o, {})
@@ -1683,37 +1687,37 @@ const Ho = /* @__PURE__ */ b.forwardRef(jo), Je = "data-aqmx-key-repeat", Qe = O
1683
1687
  className: "aqmx-icon-button",
1684
1688
  "aria-label": t.imageZoomIn,
1685
1689
  title: t.imageZoomIn,
1686
- "aria-disabled": y === null,
1690
+ "aria-disabled": x === null,
1687
1691
  onClick: () => {
1688
- y !== null && l(y);
1692
+ x !== null && l(x);
1689
1693
  },
1690
1694
  ...Qe,
1691
1695
  children: /* @__PURE__ */ a(Io, {})
1692
1696
  }
1693
1697
  ),
1694
- /* @__PURE__ */ a("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => l(Nt), children: /* @__PURE__ */ a(Fo, {}) })
1698
+ /* @__PURE__ */ a("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => l(Mt), children: /* @__PURE__ */ a(Fo, {}) })
1695
1699
  ] }),
1696
- /* @__PURE__ */ a(xe, { scrollerProps: Vo, children: /* @__PURE__ */ a("img", { ref: m, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: S, onLoad: (M) => p(M.currentTarget), "data-testid": "markdown-explorer-image" }) })
1700
+ /* @__PURE__ */ a(xe, { scrollerProps: Vo, children: /* @__PURE__ */ a("img", { ref: m, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: M, onLoad: (C) => h(C.currentTarget), "data-testid": "markdown-explorer-image" }) })
1697
1701
  ] });
1698
- }, wn = me(null), qe = me(void 0), bn = me(null), _e = () => {
1699
- const e = re(wn);
1702
+ }, vn = me(null), qe = me(void 0), wn = me(null), _e = () => {
1703
+ const e = ne(vn);
1700
1704
  if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
1701
1705
  return e;
1702
1706
  }, Yo = () => {
1703
- const e = re(bn);
1707
+ const e = ne(wn);
1704
1708
  if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
1705
1709
  return e;
1706
1710
  }, Be = (e, t, n, r) => t.kind === "panel" ? pe(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? pe(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : pe(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), Jo = ({ children: e }) => {
1707
1711
  const { config: t } = D(), n = _e(), r = nt(), o = r.kind === "location" ? r.location.source : void 0, l = De(Be(t, n.navigation, o, n.currentPath));
1708
- return /* @__PURE__ */ a(qe, { value: o, children: /* @__PURE__ */ a(bn, { value: l, children: e }) });
1712
+ return /* @__PURE__ */ a(qe, { value: o, children: /* @__PURE__ */ a(wn, { value: l, children: e }) });
1709
1713
  }, Qo = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', el = (e) => {
1710
1714
  const t = e instanceof Element ? e.closest(Qo) : null;
1711
1715
  return t === null ? null : t.getAttribute("data-doc-path");
1712
1716
  }, Ie = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, tl = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: l, onDocumentLink: i, scope: d, children: g }) => {
1713
1717
  const f = De(e);
1714
- return /* @__PURE__ */ a("a", { ...l, href: f, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (p) => {
1715
- if (Ie(p)) {
1716
- if (p.preventDefault(), t === d.currentPath && n !== "") {
1718
+ return /* @__PURE__ */ a("a", { ...l, href: f, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (h) => {
1719
+ if (Ie(h)) {
1720
+ if (h.preventDefault(), t === d.currentPath && n !== "") {
1717
1721
  d.scrollWithin(n);
1718
1722
  return;
1719
1723
  }
@@ -1721,8 +1725,8 @@ const Ho = /* @__PURE__ */ b.forwardRef(jo), Je = "data-aqmx-key-repeat", Qe = O
1721
1725
  }
1722
1726
  }, children: g });
1723
1727
  }, nl = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: l }) => {
1724
- const { config: i } = D(), d = _e(), g = re(qe), f = Ro(e), { navigation: u } = d, p = `${Be(i, u, g, t)}${f}`, m = n === !1 ? "false" : void 0;
1725
- return u.kind === "page" ? /* @__PURE__ */ a(Qr, { ...o, to: p, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": m, children: l }) : /* @__PURE__ */ a(tl, { to: p, docPath: t, fragment: f, exists: m, className: r, attributes: o, onDocumentLink: u.onDocumentLink, scope: d, children: l });
1728
+ const { config: i } = D(), d = _e(), g = ne(qe), f = Ro(e), { navigation: u } = d, h = `${Be(i, u, g, t)}${f}`, m = n === !1 ? "false" : void 0;
1729
+ return u.kind === "page" ? /* @__PURE__ */ a(Qr, { ...o, to: h, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": m, children: l }) : /* @__PURE__ */ a(tl, { to: h, docPath: t, fragment: f, exists: m, className: r, attributes: o, onDocumentLink: u.onDocumentLink, scope: d, children: l });
1726
1730
  }, rl = ({ className: e, attributes: t, children: n }) => {
1727
1731
  const { labels: r } = D();
1728
1732
  return (
@@ -1736,7 +1740,7 @@ const Ho = /* @__PURE__ */ b.forwardRef(jo), Je = "data-aqmx-key-repeat", Qe = O
1736
1740
  ] })
1737
1741
  );
1738
1742
  }, ol = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
1739
- const { config: l } = D(), i = re(qe), d = De(`${Be(l, r.navigation, i, r.currentPath)}${e}`);
1743
+ const { config: l } = D(), i = ne(qe), d = De(`${Be(l, r.navigation, i, r.currentPath)}${e}`);
1740
1744
  return /* @__PURE__ */ a("a", { ...n, href: d, className: t, onClick: (f) => {
1741
1745
  Ie(f) && (f.preventDefault(), r.scrollWithin(e));
1742
1746
  }, children: o });
@@ -1747,27 +1751,27 @@ const Ho = /* @__PURE__ */ b.forwardRef(jo), Je = "data-aqmx-key-repeat", Qe = O
1747
1751
  const d = i.currentTarget;
1748
1752
  e === "#" ? o.followEmptyFragment(i.nativeEvent) : d.href === d.ownerDocument.URL && o.followSameUrlJump(e, i.nativeEvent);
1749
1753
  }, children: r }) : /* @__PURE__ */ a(ol, { href: e, className: t, attributes: n, scope: o, children: r });
1750
- }, il = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: l, children: i }) => t === "doc" ? n === void 0 || !Hn(n) ? /* @__PURE__ */ a(rl, { className: o, attributes: l, children: i }) : /* @__PURE__ */ a(nl, { href: e, docPath: n, docExists: r, className: o, attributes: l, children: i }) : e.startsWith("#") ? /* @__PURE__ */ a(ll, { href: e, className: o, attributes: l, children: i }) : /* @__PURE__ */ a("a", { ...l, href: e, className: o, children: i }), sl = () => {
1751
- const { config: e } = D(), t = _e(), n = re(qe), r = $e();
1754
+ }, il = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: l, children: i }) => t === "doc" ? n === void 0 || !jn(n) ? /* @__PURE__ */ a(rl, { className: o, attributes: l, children: i }) : /* @__PURE__ */ a(nl, { href: e, docPath: n, docExists: r, className: o, attributes: l, children: i }) : e.startsWith("#") ? /* @__PURE__ */ a(ll, { href: e, className: o, attributes: l, children: i }) : /* @__PURE__ */ a("a", { ...l, href: e, className: o, children: i }), sl = () => {
1755
+ const { config: e } = D(), t = _e(), n = ne(qe), r = $e();
1752
1756
  return P(
1753
1757
  (o, l) => {
1754
1758
  if (!Ie(l)) return !0;
1755
1759
  l.preventDefault();
1756
- const i = pn(o.id), { navigation: d } = t;
1760
+ const i = hn(o.id), { navigation: d } = t;
1757
1761
  return d.kind === "panel" || lt(l.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(i), !0) : (r(`${Be(e, d, n, t.currentPath)}${i}`, "follow-link"), !0);
1758
1762
  },
1759
1763
  [e, t, n, r]
1760
1764
  );
1761
1765
  }, al = () => {
1762
1766
  const e = Yo();
1763
- return P((t) => `${e}${pn(t.id)}`, [e]);
1767
+ return P((t) => `${e}${hn(t.id)}`, [e]);
1764
1768
  };
1765
1769
  function cl({
1766
1770
  title: e,
1767
1771
  titleId: t,
1768
1772
  ...n
1769
1773
  }, r) {
1770
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1774
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1771
1775
  xmlns: "http://www.w3.org/2000/svg",
1772
1776
  viewBox: "0 0 20 20",
1773
1777
  fill: "currentColor",
@@ -1775,19 +1779,19 @@ function cl({
1775
1779
  "data-slot": "icon",
1776
1780
  ref: r,
1777
1781
  "aria-labelledby": t
1778
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1782
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1779
1783
  id: t
1780
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1784
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1781
1785
  d: "M3 3.5A1.5 1.5 0 0 1 4.5 2h6.879a1.5 1.5 0 0 1 1.06.44l4.122 4.12A1.5 1.5 0 0 1 17 7.622V16.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 16.5v-13Z"
1782
1786
  }));
1783
1787
  }
1784
- const dl = /* @__PURE__ */ b.forwardRef(cl);
1788
+ const dl = /* @__PURE__ */ E.forwardRef(cl);
1785
1789
  function ul({
1786
1790
  title: e,
1787
1791
  titleId: t,
1788
1792
  ...n
1789
1793
  }, r) {
1790
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1794
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1791
1795
  xmlns: "http://www.w3.org/2000/svg",
1792
1796
  viewBox: "0 0 20 20",
1793
1797
  fill: "currentColor",
@@ -1795,21 +1799,21 @@ function ul({
1795
1799
  "data-slot": "icon",
1796
1800
  ref: r,
1797
1801
  "aria-labelledby": t
1798
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1802
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1799
1803
  id: t
1800
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1804
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1801
1805
  fillRule: "evenodd",
1802
1806
  d: "M1 4.75C1 3.784 1.784 3 2.75 3h14.5c.966 0 1.75.784 1.75 1.75v10.515a1.75 1.75 0 0 1-1.75 1.75h-1.5c-.078 0-.155-.005-.23-.015H4.48c-.075.01-.152.015-.23.015h-1.5A1.75 1.75 0 0 1 1 15.265V4.75Zm16.5 7.385V11.01a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25Zm0 2.005a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .108.069.2.165.235h1.585a.25.25 0 0 0 .25-.25v-1.11Zm-15 1.11v-1.11a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.164.235H2.75a.25.25 0 0 1-.25-.25Zm2-4.24v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V11.01a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25Zm13-2.005V7.88a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25ZM4.25 7.63a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V7.88a.25.25 0 0 1 .25-.25h1.5Zm0-3.13a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5Zm11.5 1.625a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5Zm-9 3.125a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",
1803
1807
  clipRule: "evenodd"
1804
1808
  }));
1805
1809
  }
1806
- const fl = /* @__PURE__ */ b.forwardRef(ul);
1810
+ const fl = /* @__PURE__ */ E.forwardRef(ul);
1807
1811
  function ml({
1808
1812
  title: e,
1809
1813
  titleId: t,
1810
1814
  ...n
1811
1815
  }, r) {
1812
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
1816
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
1813
1817
  xmlns: "http://www.w3.org/2000/svg",
1814
1818
  viewBox: "0 0 20 20",
1815
1819
  fill: "currentColor",
@@ -1817,15 +1821,15 @@ function ml({
1817
1821
  "data-slot": "icon",
1818
1822
  ref: r,
1819
1823
  "aria-labelledby": t
1820
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
1824
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
1821
1825
  id: t
1822
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
1826
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
1823
1827
  fillRule: "evenodd",
1824
1828
  d: "M17.721 1.599a.75.75 0 0 1 .279.583v11.29a2.25 2.25 0 0 1-1.774 2.2l-2.041.44a2.216 2.216 0 0 1-.938-4.332l2.662-.577a.75.75 0 0 0 .591-.733V6.112l-8 1.73v7.684a2.25 2.25 0 0 1-1.774 2.2l-2.042.44a2.216 2.216 0 1 1-.935-4.331l2.659-.573A.75.75 0 0 0 7 12.529V4.236a.75.75 0 0 1 .591-.733l9.5-2.054a.75.75 0 0 1 .63.15Z",
1825
1829
  clipRule: "evenodd"
1826
1830
  }));
1827
1831
  }
1828
- const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aqmx-document-stage" }), gl = (e) => {
1832
+ const hl = /* @__PURE__ */ E.forwardRef(ml), pl = Object.freeze({ className: "aqmx-document-stage" }), gl = (e) => {
1829
1833
  switch (e) {
1830
1834
  case "video":
1831
1835
  return /* @__PURE__ */ a(fl, {});
@@ -1893,18 +1897,18 @@ const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aq
1893
1897
  embeddedVideo: e.viewerEmbeddedVideo,
1894
1898
  embeddedPost: e.viewerEmbeddedPost,
1895
1899
  embeddedFrame: e.viewerEmbeddedFrame
1896
- }), En = (e, t, n) => {
1900
+ }), bn = (e, t, n) => {
1897
1901
  if (t !== void 0) return t;
1898
1902
  if (n !== void 0) return n;
1899
1903
  const [r] = e.documentStyles;
1900
1904
  if (r === void 0) throw new Error("[markdown-explorer] the configuration has no document style");
1901
1905
  return r.name;
1902
- }, yn = (e, t) => e !== void 0 ? e : t !== void 0 ? t : ar, it = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), El = (e, t, n) => {
1906
+ }, En = (e, t) => e !== void 0 ? e : t !== void 0 ? t : sr, it = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), El = (e, t, n) => {
1903
1907
  if (t.view === "multi" || t.overrides[n] === void 0) return null;
1904
1908
  const r = n === "style" ? { align: t.overrides.align } : { style: t.overrides.style };
1905
1909
  return pe(e, { ...t, overrides: r });
1906
1910
  }, st = ({ kind: e, view: t, label: n, stale: r, busy: o, frameRef: l, intent: i, children: d }) => {
1907
- const g = re(fe);
1911
+ const g = ne(fe);
1908
1912
  return (
1909
1913
  /* @__PURE__ */ F("section", { ref: l, role: "region", "aria-label": n, "aria-busy": o, "data-testid": "markdown-explorer-document", "data-aqmx-document-kind": e, "data-aqmx-document-view": t, "data-aqmx-document-flow": g, className: "aqmx-document", ...i, children: [
1910
1914
  r ? /* @__PURE__ */ a("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
@@ -1914,79 +1918,79 @@ const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aq
1914
1918
  }, yl = () => {
1915
1919
  const { labels: e } = D();
1916
1920
  return /* @__PURE__ */ a(st, { kind: "empty", label: e.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ a("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-document-empty", children: /* @__PURE__ */ a("p", { className: "aqmx-empty-title", children: e.documentEmpty }) }) });
1917
- }, xn = ({ label: e }) => {
1921
+ }, yn = ({ label: e }) => {
1918
1922
  const { labels: t } = D();
1919
1923
  return /* @__PURE__ */ F(st, { kind: "loading", label: e, stale: !1, busy: !0, children: [
1920
1924
  /* @__PURE__ */ a("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-document-skeleton", children: it.map((n) => /* @__PURE__ */ a("span", {}, n)) }),
1921
1925
  /* @__PURE__ */ a("p", { className: "aqmx-sr-only", children: t.documentLoading })
1922
1926
  ] });
1923
- }, Ft = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), xl = ({ path: e, document: t, viewer: n, editing: r }) => {
1924
- const { reportMathDiagnostics: o, edits: l } = D(), i = U(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), d = sl(), g = al(), f = U(() => o === void 0 ? void 0 : (h) => o(e, h), [o, e]), u = B(null), { editable: p, doubleClick: m, region: x, paneScroll: O, stale: y } = r;
1925
- V(() => {
1926
- if (p)
1927
+ }, Pt = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), xl = ({ path: e, document: t, viewer: n, editing: r }) => {
1928
+ const { reportMathDiagnostics: o, edits: l } = D(), i = z(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), d = sl(), g = al(), f = z(() => o === void 0 ? void 0 : (p) => o(e, p), [o, e]), u = _(null), { editable: h, doubleClick: m, region: S, paneScroll: A, stale: x } = r;
1929
+ U(() => {
1930
+ if (h)
1927
1931
  return l.bindView(e, {
1928
1932
  anchor: () => {
1929
- const h = u.current, w = x(), k = h === null ? null : h.querySelector(Fe);
1930
- return h === null || w === null || k === null ? null : Vr(h, O.scrollerOf(w, k));
1933
+ const p = u.current, w = S(), k = p === null ? null : p.querySelector(Fe);
1934
+ return p === null || w === null || k === null ? null : Vr(p, A.scrollerOf(w, k));
1931
1935
  }
1932
1936
  });
1933
- }, [l, e, p, x, O]);
1934
- const T = (h) => {
1935
- const w = u.current, { target: k } = h;
1936
- !m || w === null || !(k instanceof Element) || !Ur(k) || (h.stopPropagation(), l.start(e, Zr(k, w, w.ownerDocument.getSelection())));
1937
- }, S = B(null), M = B(y);
1938
- V(() => {
1939
- M.current = y;
1937
+ }, [l, e, h, S, A]);
1938
+ const T = (p) => {
1939
+ const w = u.current, { target: k } = p;
1940
+ !m || w === null || !(k instanceof Element) || !Ur(k) || (p.stopPropagation(), l.start(e, Zr(k, w, w.ownerDocument.getSelection())));
1941
+ }, M = _(null), C = _(x);
1942
+ U(() => {
1943
+ C.current = x;
1940
1944
  });
1941
- const s = ie((h) => {
1942
- const w = u.current, k = x(), L = w === null ? null : Yr(w, h.line);
1945
+ const s = ie((p) => {
1946
+ const w = u.current, k = S(), L = w === null ? null : Yr(w, p.line);
1943
1947
  if (k === null || L === null) return !1;
1944
- const R = O.scrollerOf(k, L);
1945
- return R.scrollTop += Jr(L, h.line) - h.clientTop, !0;
1946
- }), c = ie((h) => {
1947
- const w = x();
1948
+ const O = A.scrollerOf(k, L);
1949
+ return O.scrollTop += Jr(L, p.line) - p.clientTop, !0;
1950
+ }), c = ie((p) => {
1951
+ const w = S();
1948
1952
  if (w === null) return;
1949
1953
  const k = () => {
1950
- for (const R of Ft) w.removeEventListener(R, L, !0);
1951
- S.current?.release === k && (S.current = null);
1954
+ for (const O of Pt) w.removeEventListener(O, L, !0);
1955
+ M.current?.release === k && (M.current = null);
1952
1956
  }, L = () => k();
1953
- for (const R of Ft) w.addEventListener(R, L, { capture: !0, passive: !0 });
1954
- S.current = { point: h, release: k };
1957
+ for (const O of Pt) w.addEventListener(O, L, { capture: !0, passive: !0 });
1958
+ M.current = { point: p, release: k };
1955
1959
  });
1956
- return V(() => {
1957
- const h = l.takeReturn(e);
1958
- if (h !== null)
1960
+ return U(() => {
1961
+ const p = l.takeReturn(e);
1962
+ if (p !== null)
1959
1963
  return queueMicrotask(() => {
1960
- s(h) && M.current && c(h);
1961
- }), () => S.current?.release();
1962
- }, [l, e]), V(() => {
1963
- const h = S.current;
1964
- h === null || y || (h.release(), s(h.point));
1965
- }, [t, y]),
1966
- /* @__PURE__ */ a("div", { ref: u, className: "aqmx-document-viewer", onDoubleClick: T, children: /* @__PURE__ */ a(Wt, { ...n, onHeadingSelect: d, headingHref: g, onMathDiagnostics: f, parseResult: i, content: null }) });
1967
- }, kn = ({ document: e, viewer: t }) => {
1964
+ s(p) && C.current && c(p);
1965
+ }), () => M.current?.release();
1966
+ }, [l, e]), U(() => {
1967
+ const p = M.current;
1968
+ p === null || x || (p.release(), s(p.point));
1969
+ }, [t, x]),
1970
+ /* @__PURE__ */ a("div", { ref: u, className: "aqmx-document-viewer", onDoubleClick: T, children: /* @__PURE__ */ a(Kt, { ...n, onHeadingSelect: d, headingHref: g, onMathDiagnostics: f, parseResult: i, content: null }) });
1971
+ }, xn = ({ document: e, viewer: t }) => {
1968
1972
  const { labels: n } = D();
1969
1973
  return /* @__PURE__ */ F(Ne, { children: [
1970
- /* @__PURE__ */ a(Pe, { name: e.name, openUrl: zn(e.url), downloadUrl: e.url, icon: /* @__PURE__ */ a(Fr, {}), children: e.truncated ? null : /* @__PURE__ */ a(po, { text: e.text }) }),
1974
+ /* @__PURE__ */ a(Pe, { name: e.name, openUrl: Hn(e.url), downloadUrl: e.url, icon: /* @__PURE__ */ a(Pr, {}), children: e.truncated ? null : /* @__PURE__ */ a(po, { text: e.text }) }),
1971
1975
  e.truncated ? /* @__PURE__ */ a("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
1972
- /* @__PURE__ */ a("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ a(Wt, { ...t, parseResult: null, content: e.text }) })
1976
+ /* @__PURE__ */ a("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ a(Kt, { ...t, parseResult: null, content: e.text }) })
1973
1977
  ] });
1974
1978
  }, kl = ({ path: e, name: t, viewer: n }) => {
1975
- const { data: r, documents: o, announcer: l, labels: i } = D(), d = P(() => o.answerStampOf(e), [o, e]), g = te(o.subscribe, d, d), [f, u] = I(0), p = U(() => ({ path: e, stamp: g, attempt: f }), [e, g, f]), [m, x] = I(null), O = ie((T) => {
1976
- x(T), T.kind === "failure" && l.announce(i.documentFailed(t, ae(i, T.failure.reason)));
1979
+ const { data: r, documents: o, announcer: l, labels: i } = D(), d = P(() => o.answerStampOf(e), [o, e]), g = ee(o.subscribe, d, d), [f, u] = I(0), h = z(() => ({ path: e, stamp: g, attempt: f }), [e, g, f]), [m, S] = I(null), A = ie((T) => {
1980
+ S(T), T.kind === "failure" && l.announce(i.documentFailed(t, ae(i, T.failure.reason)));
1977
1981
  });
1978
- ne(() => {
1982
+ te(() => {
1979
1983
  const T = new AbortController();
1980
- return r.text(p.path, T.signal).then((S) => {
1981
- "kind" in S && O(S);
1984
+ return r.text(h.path, T.signal).then((M) => {
1985
+ "kind" in M && A(M);
1982
1986
  }), () => T.abort();
1983
- }, [r, p]);
1984
- const y = P(() => u((T) => T + 1), []);
1987
+ }, [r, h]);
1988
+ const x = P(() => u((T) => T + 1), []);
1985
1989
  return m === null ? /* @__PURE__ */ F(Ne, { children: [
1986
1990
  /* @__PURE__ */ a("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-markup-skeleton", children: it.map((T) => /* @__PURE__ */ a("span", {}, T)) }),
1987
1991
  /* @__PURE__ */ a("p", { className: "aqmx-sr-only", children: i.markupLoading })
1988
- ] }) : m.kind === "failure" ? /* @__PURE__ */ a(xe, { scrollerProps: Sn, children: /* @__PURE__ */ a(ve, { failure: m.failure, alert: !1, onRetry: y, testId: "markdown-explorer-markup-failure" }) }) : /* @__PURE__ */ a(kn, { document: m, viewer: n });
1989
- }, Sn = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), Sl = Object.freeze({ reason: "failed" }), Rl = (e) => /* @__PURE__ */ a(
1992
+ ] }) : m.kind === "failure" ? /* @__PURE__ */ a(xe, { scrollerProps: kn, children: /* @__PURE__ */ a(ve, { failure: m.failure, alert: !1, onRetry: x, testId: "markdown-explorer-markup-failure" }) }) : /* @__PURE__ */ a(xn, { document: m, viewer: n });
1993
+ }, kn = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), Sl = Object.freeze({ reason: "failed" }), Rl = (e) => /* @__PURE__ */ a(
1990
1994
  _r,
1991
1995
  {
1992
1996
  fallback: (t) => /* @__PURE__ */ a("div", { className: "aqmx-edit-message", children: /* @__PURE__ */ a(ve, { failure: Sl, alert: !1, onRetry: t, testId: "markdown-explorer-edit-load-failure" }) }),
@@ -2004,11 +2008,11 @@ const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aq
2004
2008
  const { session: i, layout: d, region: g, paneScroll: f, stale: u } = l;
2005
2009
  if (n === "edit" && i !== void 0) return /* @__PURE__ */ a(Rl, { path: e, name: t.name, session: i, layout: d, viewer: r, region: g, paneScroll: f });
2006
2010
  if (n === "markup") return /* @__PURE__ */ a(kl, { path: e, name: t.name, viewer: r });
2007
- const p = t.edit !== null && t.edit.kind === "inline";
2008
- return /* @__PURE__ */ a(xl, { path: e, document: t, viewer: r, editing: { editable: p, doubleClick: p && d === "fill", region: g, paneScroll: f, stale: u } });
2011
+ const h = t.edit !== null && t.edit.kind === "inline";
2012
+ return /* @__PURE__ */ a(xl, { path: e, document: t, viewer: r, editing: { editable: h, doubleClick: h && d === "fill", region: g, paneScroll: f, stale: u } });
2009
2013
  }
2010
2014
  case "text":
2011
- return /* @__PURE__ */ a(kn, { document: t, viewer: r });
2015
+ return /* @__PURE__ */ a(xn, { document: t, viewer: r });
2012
2016
  case "image":
2013
2017
  return /* @__PURE__ */ a(Xo, { document: t });
2014
2018
  case "media":
@@ -2016,23 +2020,23 @@ const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aq
2016
2020
  case "file":
2017
2021
  return /* @__PURE__ */ a(So, { document: t });
2018
2022
  case "failure":
2019
- return /* @__PURE__ */ a(xe, { scrollerProps: Sn, children: /* @__PURE__ */ a(ve, { failure: t.failure, alert: !1, onRetry: o, testId: "markdown-explorer-document-failure" }) });
2023
+ return /* @__PURE__ */ a(xe, { scrollerProps: kn, children: /* @__PURE__ */ a(ve, { failure: t.failure, alert: !1, onRetry: o, testId: "markdown-explorer-document-failure" }) });
2020
2024
  default: {
2021
2025
  const i = t;
2022
2026
  throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(i)}`);
2023
2027
  }
2024
2028
  }
2025
2029
  }, Cl = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', Ol = (e, t, n) => {
2026
- const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : vn(e, n), r === void 0 ? null : gn(e, r.id), e.querySelector(Fe), e.querySelector(Cl)];
2030
+ const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : gn(e, n), r === void 0 ? null : pn(e, r.id), e.querySelector(Fe), e.querySelector(Cl)];
2027
2031
  for (const l of o)
2028
- if (l instanceof HTMLElement && dn(l)) return l;
2032
+ if (l instanceof HTMLElement && cn(l)) return l;
2029
2033
  return null;
2030
- }, qt = (e, t, n) => {
2034
+ }, Ft = (e, t, n) => {
2031
2035
  const { activeElement: r, body: o } = e.ownerDocument, l = r === null || r === o;
2032
- t instanceof HTMLElement && n && (l || e.contains(r)) && dn(t);
2036
+ t instanceof HTMLElement && n && (l || e.contains(r)) && cn(t);
2033
2037
  }, Al = (e) => {
2034
- const t = B(!1);
2035
- return V(() => {
2038
+ const t = _(!1);
2039
+ return U(() => {
2036
2040
  const n = e.current;
2037
2041
  if (n === null) throw new Error("[markdown-explorer] the document region is not mounted");
2038
2042
  const r = n.ownerDocument, o = r.defaultView;
@@ -2047,81 +2051,81 @@ const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aq
2047
2051
  }, f = (m) => {
2048
2052
  m.relatedTarget === null && l && (t.current = !1);
2049
2053
  }, u = () => {
2050
- const { activeElement: m, body: x } = r;
2051
- m !== null && m !== x && (t.current = n.contains(m));
2052
- }, p = () => {
2054
+ const { activeElement: m, body: S } = r;
2055
+ m !== null && m !== S && (t.current = n.contains(m));
2056
+ }, h = () => {
2053
2057
  l && !n.contains(r.activeElement) && (t.current = !1);
2054
2058
  };
2055
- return o.addEventListener("pointerdown", d, !0), o.addEventListener("mousedown", d, !0), o.addEventListener("focusin", g, !0), o.addEventListener("blur", u), o.addEventListener("focus", p), n.addEventListener("focusout", f), () => {
2056
- clearTimeout(i), o.removeEventListener("pointerdown", d, !0), o.removeEventListener("mousedown", d, !0), o.removeEventListener("focusin", g, !0), o.removeEventListener("blur", u), o.removeEventListener("focus", p), n.removeEventListener("focusout", f);
2059
+ return o.addEventListener("pointerdown", d, !0), o.addEventListener("mousedown", d, !0), o.addEventListener("focusin", g, !0), o.addEventListener("blur", u), o.addEventListener("focus", h), n.addEventListener("focusout", f), () => {
2060
+ clearTimeout(i), o.removeEventListener("pointerdown", d, !0), o.removeEventListener("mousedown", d, !0), o.removeEventListener("focusin", g, !0), o.removeEventListener("blur", u), o.removeEventListener("focus", h), n.removeEventListener("focusout", f);
2057
2061
  };
2058
2062
  }, [e]), t;
2059
- }, Ll = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: l, regionLabel: i, navigation: d, fragment: g, paneScroll: f, announces: u, announceFailure: p, onDocumentShown: m }) => {
2060
- const { labels: x, announcer: O, documents: y } = D(), { document: T } = t, S = B(null), M = B(null), s = B(null), c = B(0), h = Al(S), w = B({ path: e, document: T }), k = B(null), L = P(
2061
- (z) => {
2062
- const K = S.current, Q = Mt(K, z, f);
2063
- K !== null && Q !== null && qt(K, Q, h.current);
2063
+ }, Ll = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: l, regionLabel: i, navigation: d, fragment: g, paneScroll: f, announces: u, announceFailure: h, onDocumentShown: m }) => {
2064
+ const { labels: S, announcer: A, documents: x } = D(), { document: T } = t, M = _(null), C = _(null), s = _(null), c = _(0), p = Al(M), w = _({ path: e, document: T }), k = _(null), L = P(
2065
+ (H) => {
2066
+ const V = M.current, J = Lt(V, H, f);
2067
+ V !== null && J !== null && Ft(V, J, p.current);
2064
2068
  },
2065
- [f, h]
2066
- ), R = P(
2067
- (z, K) => {
2068
- const Q = c.current;
2069
+ [f, p]
2070
+ ), O = P(
2071
+ (H, V) => {
2072
+ const J = c.current;
2069
2073
  setTimeout(() => {
2070
- !K.defaultPrevented && c.current === Q && L(z);
2074
+ !V.defaultPrevented && c.current === J && L(H);
2071
2075
  }, 0);
2072
2076
  },
2073
2077
  [L]
2074
2078
  ), N = P(
2075
- (z) => {
2079
+ (H) => {
2076
2080
  setTimeout(() => {
2077
- z.defaultPrevented || L("#");
2081
+ H.defaultPrevented || L("#");
2078
2082
  }, 0);
2079
2083
  },
2080
2084
  [L]
2081
- ), q = U(() => ({ navigation: d, currentPath: e, scrollWithin: L, followSameUrlJump: R, followEmptyFragment: N }), [d, e, L, R, N]), W = P(() => y.retry(e), [y, e]), J = eo(y, el), ee = sn(e), X = ee !== void 0 ? "edit" : n ? "markup" : "rendered", $ = T.kind === "markdown" ? X : void 0, G = P(() => S.current, []), v = U(() => ({ session: ee, layout: l, region: G, paneScroll: f, stale: r }), [ee, l, G, f, r]), E = $ === "edit" ? !1 : r, C = re(fe), A = $ === "edit" && l === "fill" ? "fill" : C, _ = ie((z, K) => {
2082
- const Q = M.current;
2083
- if (Q !== null && Q.path === z && Q.snapshot === K) return;
2084
- M.current = { path: z, snapshot: K };
2085
- const oe = K.document;
2086
- if (oe.kind === "failure") {
2087
- y.noteFailureShown(K) && p(x.documentFailed(Ee(z), ae(x, oe.failure.reason)));
2085
+ ), q = z(() => ({ navigation: d, currentPath: e, scrollWithin: L, followSameUrlJump: O, followEmptyFragment: N }), [d, e, L, O, N]), G = P(() => x.retry(e), [x, e]), W = eo(x, el), Q = ln(e), K = Q !== void 0 ? "edit" : n ? "markup" : "rendered", Y = T.kind === "markdown" ? K : void 0, oe = P(() => M.current, []), v = z(() => ({ session: Q, layout: l, region: oe, paneScroll: f, stale: r }), [Q, l, oe, f, r]), b = Y === "edit" ? !1 : r, y = ne(fe), R = Y === "edit" && l === "fill" ? "fill" : y, $ = ie((H, V) => {
2086
+ const J = C.current;
2087
+ if (J !== null && J.path === H && J.snapshot === V) return;
2088
+ C.current = { path: H, snapshot: V };
2089
+ const re = V.document;
2090
+ if (re.kind === "failure") {
2091
+ x.noteFailureShown(V) && h(S.documentFailed(Ee(H), ae(S, re.failure.reason)));
2088
2092
  return;
2089
2093
  }
2090
- m?.(z, oe), u && (Q === null || Q.path !== z || Q.snapshot.document.kind === "failure") && O.announce(x.documentShown(oe.name));
2094
+ m?.(H, re), u && (J === null || J.path !== H || J.snapshot.document.kind === "failure") && A.announce(S.documentShown(re.name));
2091
2095
  });
2092
- ne(() => {
2093
- _(e, t);
2096
+ te(() => {
2097
+ $(e, t);
2094
2098
  }, [e, t]);
2095
- const j = ie(() => {
2099
+ const B = ie(() => {
2096
2100
  g.kind === "panel" && g.consume();
2097
- }), Z = ie((z) => {
2098
- const K = S.current;
2099
- if (K === null || !h.current) return null;
2100
- const { activeElement: Q, body: oe } = K.ownerDocument;
2101
- return Q !== null && Q !== oe ? null : Ol(K, T, z);
2102
- }), H = ie((z) => {
2103
- const K = S.current;
2104
- K !== null && qt(K, z, h.current);
2105
- }), le = ie((z) => f.reveal(z)), ct = ie((z) => Mt(S.current, z, f));
2106
- return ne(() => {
2101
+ }), Z = ie((H) => {
2102
+ const V = M.current;
2103
+ if (V === null || !p.current) return null;
2104
+ const { activeElement: J, body: re } = V.ownerDocument;
2105
+ return J !== null && J !== re ? null : Ol(V, T, H);
2106
+ }), j = ie((H) => {
2107
+ const V = M.current;
2108
+ V !== null && Ft(V, H, p.current);
2109
+ }), le = ie((H) => f.reveal(H)), ct = ie((H) => Lt(M.current, H, f));
2110
+ return te(() => {
2107
2111
  if (r) return;
2108
- const z = w.current.path !== e, K = z || w.current.document !== T;
2112
+ const H = w.current.path !== e, V = H || w.current.document !== T;
2109
2113
  w.current = { path: e, document: T };
2110
- const Q = k.current !== e;
2114
+ const J = k.current !== e;
2111
2115
  k.current = e;
2112
- let oe = null;
2113
- g.kind === "page" ? s.current !== g.navigation && (s.current = g.navigation, c.current += 1, oe = g.fragment) : g.fragment !== null && (oe = g.fragment, j());
2116
+ let re = null;
2117
+ g.kind === "page" ? s.current !== g.navigation && (s.current = g.navigation, c.current += 1, re = g.fragment) : g.fragment !== null && (re = g.fragment, B());
2114
2118
  const dt = () => {
2115
- const je = oe === null ? null : ct(oe);
2116
- if (!K) {
2117
- je !== null && H(je);
2119
+ const je = re === null ? null : ct(re);
2120
+ if (!V) {
2121
+ je !== null && j(je);
2118
2122
  return;
2119
2123
  }
2120
2124
  const ut = Z(g.fragment);
2121
- z && je === null && ut !== null && le(ut);
2125
+ H && je === null && ut !== null && le(ut);
2122
2126
  };
2123
- Q ? queueMicrotask(dt) : dt();
2124
- }, [g, e, T, r]), /* @__PURE__ */ a(fe, { value: A, children: /* @__PURE__ */ a(st, { kind: T.kind, view: $, label: i(e, T), stale: E, busy: E, frameRef: S, intent: J, children: /* @__PURE__ */ a(wn, { value: q, children: /* @__PURE__ */ a(Jo, { children: /* @__PURE__ */ a(Tl, { path: e, document: T, view: X, viewer: o, onRetry: W, editing: v }, e) }) }) }) });
2127
+ J ? queueMicrotask(dt) : dt();
2128
+ }, [g, e, T, r]), /* @__PURE__ */ a(fe, { value: R, children: /* @__PURE__ */ a(st, { kind: T.kind, view: Y, label: i(e, T), stale: b, busy: b, frameRef: M, intent: W, children: /* @__PURE__ */ a(vn, { value: q, children: /* @__PURE__ */ a(Jo, { children: /* @__PURE__ */ a(Tl, { path: e, document: T, view: K, viewer: o, onRetry: G, editing: v }, e) }) }) }) });
2125
2129
  }, at = Object.freeze({ kind: "skeleton" }), Ml = (e, t, n, r, o) => {
2126
2130
  if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
2127
2131
  const l = de(t);
@@ -2130,29 +2134,29 @@ const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aq
2130
2134
  const i = n === null || n === e ? null : de(r);
2131
2135
  return n === null || i === null ? at : { kind: "document", path: n, snapshot: i, stale: !0 };
2132
2136
  }, Nl = (e, t) => t.status === "deferred" ? at : { kind: "document", path: e, snapshot: t, stale: !1 }, Dl = ({ requestedPath: e, content: t, markup: n, ...r }) => {
2133
- const o = t.kind === "streaming" ? Nl(t.path, re(t.promise)) : t;
2134
- return o.kind !== "document" ? /* @__PURE__ */ a(xn, { label: r.regionLabel(e, null) }) : /* @__PURE__ */ a(Ll, { path: o.path, snapshot: o.snapshot, markup: n, stale: o.stale, ...r });
2135
- }, Rn = ({ path: e, markup: t, display: n, navigation: r, fragment: o, paneScroll: l, announces: i, announceFailure: d, onDocumentShown: g }) => {
2136
- const { config: f, labels: u, theme: p, documents: m } = D(), x = ir(), O = B(!1);
2137
- V(() => {
2138
- O.current = !0;
2137
+ const o = t.kind === "streaming" ? Nl(t.path, ne(t.promise)) : t;
2138
+ return o.kind !== "document" ? /* @__PURE__ */ a(yn, { label: r.regionLabel(e, null) }) : /* @__PURE__ */ a(Ll, { path: o.path, snapshot: o.snapshot, markup: n, stale: o.stale, ...r });
2139
+ }, Sn = ({ path: e, markup: t, display: n, navigation: r, fragment: o, paneScroll: l, announces: i, announceFailure: d, onDocumentShown: g }) => {
2140
+ const { config: f, labels: u, theme: h, documents: m } = D(), S = lr(), A = _(!1);
2141
+ U(() => {
2142
+ A.current = !0;
2139
2143
  }, []);
2140
- const [y, T] = I(null), [S, M] = I(t), s = P(() => e === null ? void 0 : m.peek(e), [m, e]), c = te(m.subscribe, s, s), h = P(() => y === null ? void 0 : m.peek(y), [m, y]), w = te(m.subscribe, h, h);
2141
- V(() => e === null ? void 0 : m.open(e), [m, e]), V(() => y === null ? void 0 : m.retain(y), [m, y]);
2142
- const k = e === null ? at : Ml(e, c, y, w, !O.current), L = e === null ? null : k.kind === "document" && !k.stale ? k.path : y;
2143
- L !== y && T(L);
2144
- const R = k.kind !== "document" || k.path === e;
2145
- R && t !== S && M(t);
2146
- const N = U(() => bl(u), [u]), q = U(() => [...f.iframeHosts], [f]), W = r.kind === "panel", J = U(
2144
+ const [x, T] = I(null), [M, C] = I(t), s = P(() => e === null ? void 0 : m.peek(e), [m, e]), c = ee(m.subscribe, s, s), p = P(() => x === null ? void 0 : m.peek(x), [m, x]), w = ee(m.subscribe, p, p);
2145
+ U(() => e === null ? void 0 : m.open(e), [m, e]), U(() => x === null ? void 0 : m.retain(x), [m, x]);
2146
+ const k = e === null ? at : Ml(e, c, x, w, !A.current), L = e === null ? null : k.kind === "document" && !k.stale ? k.path : x;
2147
+ L !== x && T(L);
2148
+ const O = k.kind !== "document" || k.path === e;
2149
+ O && t !== M && C(t);
2150
+ const N = z(() => bl(u), [u]), q = z(() => [...f.iframeHosts], [f]), G = r.kind === "panel", W = z(
2147
2151
  () => ({
2148
2152
  labels: N,
2149
2153
  emptyMessage: u.documentEmpty,
2150
- theme: p,
2154
+ theme: h,
2151
2155
  availableStyles: f.documentStyles,
2152
2156
  iFrameAllowedDomains: q,
2153
2157
  embeds: f.embeds,
2154
2158
  linkComponent: il,
2155
- toolbar: x,
2159
+ toolbar: S,
2156
2160
  style: n.style,
2157
2161
  onStyleChange: n.onStyleChange,
2158
2162
  align: n.align,
@@ -2163,19 +2167,19 @@ const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aq
2163
2167
  padding: n.padding,
2164
2168
  width: n.width === void 0 ? void 0 : `min(${n.width}, 100%)`,
2165
2169
  maxWidth: n.maxWidth === void 0 ? void 0 : `min(${n.maxWidth}, 100%)`,
2166
- renderScrollBar: W ? void 0 : un
2170
+ renderScrollBar: G ? void 0 : dn
2167
2171
  }),
2168
- [N, u.documentEmpty, p, f.documentStyles, q, f.embeds, x, n, W]
2169
- ), ee = P(($, G) => W ? G === null || G.kind === "failure" ? Ee($) : G.name : u.documentRegion, [W, u.documentRegion]), X = W ? "content" : "fill";
2170
- return e === null ? /* @__PURE__ */ a(fe, { value: X, children: /* @__PURE__ */ a(yl, {}) }) : /* @__PURE__ */ a(fe, { value: X, children: /* @__PURE__ */ a(ge, { fallback: /* @__PURE__ */ a(xn, { label: ee(e, null) }), children: /* @__PURE__ */ a(
2172
+ [N, u.documentEmpty, h, f.documentStyles, q, f.embeds, S, n, G]
2173
+ ), Q = P((Y, oe) => G ? oe === null || oe.kind === "failure" ? Ee(Y) : oe.name : u.documentRegion, [G, u.documentRegion]), K = G ? "content" : "fill";
2174
+ return e === null ? /* @__PURE__ */ a(fe, { value: K, children: /* @__PURE__ */ a(yl, {}) }) : /* @__PURE__ */ a(fe, { value: K, children: /* @__PURE__ */ a(ge, { fallback: /* @__PURE__ */ a(yn, { label: Q(e, null) }), children: /* @__PURE__ */ a(
2171
2175
  Dl,
2172
2176
  {
2173
2177
  requestedPath: e,
2174
2178
  content: k,
2175
- markup: R ? t : S,
2176
- viewer: J,
2179
+ markup: O ? t : M,
2180
+ viewer: W,
2177
2181
  editLayout: n.editLayout,
2178
- regionLabel: ee,
2182
+ regionLabel: Q,
2179
2183
  navigation: r,
2180
2184
  fragment: o,
2181
2185
  paneScroll: l,
@@ -2185,47 +2189,47 @@ const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aq
2185
2189
  }
2186
2190
  ) }) });
2187
2191
  }, $l = ({ path: e, markup: t, variant: n, onDocumentShown: r }) => {
2188
- const { config: o, viewSettings: l, announcer: i } = D(), d = Ae((L) => L.style), g = Ae((L) => L.align), f = $e(), u = Gt(), p = nt(), { view: m, overrides: x, embed: O } = n, y = P(
2192
+ const { config: o, viewSettings: l, announcer: i } = D(), d = Ae((L) => L.style), g = Ae((L) => L.align), f = $e(), u = Vt(), h = nt(), { view: m, overrides: S, embed: A } = n, x = P(
2189
2193
  (L) => {
2190
- if (p.kind !== "location") return;
2191
- const R = El(o, p.location, L);
2192
- R !== null && f(R, "browse");
2194
+ if (h.kind !== "location") return;
2195
+ const O = El(o, h.location, L);
2196
+ O !== null && f(O, "browse");
2193
2197
  },
2194
- [o, f, p]
2198
+ [o, f, h]
2195
2199
  ), T = P(
2196
2200
  (L) => {
2197
- l.update({ style: L }), y("style");
2201
+ l.update({ style: L }), x("style");
2198
2202
  },
2199
- [l, y]
2200
- ), S = P(
2203
+ [l, x]
2204
+ ), M = P(
2201
2205
  (L) => {
2202
- l.update({ align: L }), y("align");
2206
+ l.update({ align: L }), x("align");
2203
2207
  },
2204
- [l, y]
2205
- ), M = En(o, x.style, d), s = yn(x.align, g), c = U(
2208
+ [l, x]
2209
+ ), C = bn(o, S.style, d), s = En(S.align, g), c = z(
2206
2210
  () => ({
2207
- style: M,
2211
+ style: C,
2208
2212
  onStyleChange: T,
2209
2213
  align: s,
2210
- onAlignChange: S,
2211
- showToc: O.showToc !== !1,
2212
- showStyle: O.showStyle !== !1,
2213
- showAlign: O.showAlign !== !1,
2214
- padding: O.padding,
2215
- width: O.width,
2216
- maxWidth: O.maxWidth,
2214
+ onAlignChange: M,
2215
+ showToc: A.showToc !== !1,
2216
+ showStyle: A.showStyle !== !1,
2217
+ showAlign: A.showAlign !== !1,
2218
+ padding: A.padding,
2219
+ width: A.width,
2220
+ maxWidth: A.maxWidth,
2217
2221
  editLayout: "fill"
2218
2222
  }),
2219
- [M, T, s, S, O]
2220
- ), h = U(() => ({ kind: "page", view: m, overrides: x, embed: O }), [m, x, O]), w = U(() => ({ kind: "page", fragment: u.hash, navigation: u }), [u]), k = P((L) => i.announce(L), [i]);
2221
- return /* @__PURE__ */ a(Rn, { path: e, markup: t, display: c, navigation: h, fragment: w, paneScroll: Mo, announces: !0, announceFailure: k, onDocumentShown: r });
2223
+ [C, T, s, M, A]
2224
+ ), p = z(() => ({ kind: "page", view: m, overrides: S, embed: A }), [m, S, A]), w = z(() => ({ kind: "page", fragment: u.hash, navigation: u }), [u]), k = P((L) => i.announce(L), [i]);
2225
+ return /* @__PURE__ */ a(Sn, { path: e, markup: t, display: c, navigation: p, fragment: w, paneScroll: Mo, announces: !0, announceFailure: k, onDocumentShown: r });
2222
2226
  }, Pl = ({ path: e, markup: t, variant: n, onDocumentShown: r }) => {
2223
- const { config: o, viewSettings: l } = D(), i = Ae((h) => h.style), d = Ae((h) => h.align), [g, f] = I(() => En(o, void 0, i)), u = yn(void 0, d), p = P((h) => l.update({ align: h }), [l]), { maximized: m, onDocumentLink: x, pendingHash: O, onHashConsumed: y, announceFailure: T, paneScroll: S } = n, M = U(
2227
+ const { config: o, viewSettings: l } = D(), i = Ae((p) => p.style), d = Ae((p) => p.align), [g, f] = I(() => bn(o, void 0, i)), u = En(void 0, d), h = P((p) => l.update({ align: p }), [l]), { maximized: m, onDocumentLink: S, pendingHash: A, onHashConsumed: x, announceFailure: T, paneScroll: M } = n, C = z(
2224
2228
  () => ({
2225
2229
  style: g,
2226
2230
  onStyleChange: f,
2227
2231
  align: u,
2228
- onAlignChange: p,
2232
+ onAlignChange: h,
2229
2233
  showToc: m,
2230
2234
  showStyle: m,
2231
2235
  showAlign: m,
@@ -2234,16 +2238,16 @@ const hl = /* @__PURE__ */ b.forwardRef(ml), pl = Object.freeze({ className: "aq
2234
2238
  maxWidth: void 0,
2235
2239
  editLayout: m ? "fill" : "content"
2236
2240
  }),
2237
- [g, u, p, m]
2238
- ), s = U(() => ({ kind: "panel", onDocumentLink: x }), [x]), c = U(() => ({ kind: "panel", fragment: O, consume: y }), [O, y]);
2239
- return /* @__PURE__ */ a(Rn, { path: e, markup: t, display: M, navigation: s, fragment: c, paneScroll: S, announces: !1, announceFailure: T, onDocumentShown: r });
2241
+ [g, u, h, m]
2242
+ ), s = z(() => ({ kind: "panel", onDocumentLink: S }), [S]), c = z(() => ({ kind: "panel", fragment: A, consume: x }), [A, x]);
2243
+ return /* @__PURE__ */ a(Sn, { path: e, markup: t, display: C, navigation: s, fragment: c, paneScroll: M, announces: !1, announceFailure: T, onDocumentShown: r });
2240
2244
  }, Fl = ({ path: e, markup: t, variant: n, onDocumentShown: r }) => n.kind === "page" ? /* @__PURE__ */ a($l, { path: e, markup: t, variant: n, onDocumentShown: r }) : /* @__PURE__ */ a(Pl, { path: e, markup: t, variant: n, onDocumentShown: r });
2241
2245
  function ql({
2242
2246
  title: e,
2243
2247
  titleId: t,
2244
2248
  ...n
2245
2249
  }, r) {
2246
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
2250
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
2247
2251
  xmlns: "http://www.w3.org/2000/svg",
2248
2252
  viewBox: "0 0 24 24",
2249
2253
  fill: "currentColor",
@@ -2251,21 +2255,21 @@ function ql({
2251
2255
  "data-slot": "icon",
2252
2256
  ref: r,
2253
2257
  "aria-labelledby": t
2254
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
2258
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
2255
2259
  id: t
2256
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
2260
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
2257
2261
  fillRule: "evenodd",
2258
2262
  d: "M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z",
2259
2263
  clipRule: "evenodd"
2260
2264
  }));
2261
2265
  }
2262
- const _l = /* @__PURE__ */ b.forwardRef(ql);
2266
+ const _l = /* @__PURE__ */ E.forwardRef(ql);
2263
2267
  function Bl({
2264
2268
  title: e,
2265
2269
  titleId: t,
2266
2270
  ...n
2267
2271
  }, r) {
2268
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
2272
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
2269
2273
  xmlns: "http://www.w3.org/2000/svg",
2270
2274
  viewBox: "0 0 24 24",
2271
2275
  fill: "currentColor",
@@ -2273,21 +2277,21 @@ function Bl({
2273
2277
  "data-slot": "icon",
2274
2278
  ref: r,
2275
2279
  "aria-labelledby": t
2276
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
2280
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
2277
2281
  id: t
2278
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
2282
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
2279
2283
  fillRule: "evenodd",
2280
2284
  d: "M14.447 3.026a.75.75 0 0 1 .527.921l-4.5 16.5a.75.75 0 0 1-1.448-.394l4.5-16.5a.75.75 0 0 1 .921-.527ZM16.72 6.22a.75.75 0 0 1 1.06 0l5.25 5.25a.75.75 0 0 1 0 1.06l-5.25 5.25a.75.75 0 1 1-1.06-1.06L21.44 12l-4.72-4.72a.75.75 0 0 1 0-1.06Zm-9.44 0a.75.75 0 0 1 0 1.06L2.56 12l4.72 4.72a.75.75 0 0 1-1.06 1.06L.97 12.53a.75.75 0 0 1 0-1.06l5.25-5.25a.75.75 0 0 1 1.06 0Z",
2281
2285
  clipRule: "evenodd"
2282
2286
  }));
2283
2287
  }
2284
- const Il = /* @__PURE__ */ b.forwardRef(Bl);
2288
+ const Il = /* @__PURE__ */ E.forwardRef(Bl);
2285
2289
  function jl({
2286
2290
  title: e,
2287
2291
  titleId: t,
2288
2292
  ...n
2289
2293
  }, r) {
2290
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
2294
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
2291
2295
  xmlns: "http://www.w3.org/2000/svg",
2292
2296
  viewBox: "0 0 24 24",
2293
2297
  fill: "currentColor",
@@ -2295,21 +2299,21 @@ function jl({
2295
2299
  "data-slot": "icon",
2296
2300
  ref: r,
2297
2301
  "aria-labelledby": t
2298
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
2302
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
2299
2303
  id: t
2300
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
2304
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
2301
2305
  fillRule: "evenodd",
2302
2306
  d: "M15.75 2.25H21a.75.75 0 0 1 .75.75v5.25a.75.75 0 0 1-1.5 0V4.81L8.03 17.03a.75.75 0 0 1-1.06-1.06L19.19 3.75h-3.44a.75.75 0 0 1 0-1.5Zm-10.5 4.5a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h10.5a1.5 1.5 0 0 0 1.5-1.5V10.5a.75.75 0 0 1 1.5 0v8.25a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h8.25a.75.75 0 0 1 0 1.5H5.25Z",
2303
2307
  clipRule: "evenodd"
2304
2308
  }));
2305
2309
  }
2306
- const Hl = /* @__PURE__ */ b.forwardRef(jl);
2310
+ const Hl = /* @__PURE__ */ E.forwardRef(jl);
2307
2311
  function zl({
2308
2312
  title: e,
2309
2313
  titleId: t,
2310
2314
  ...n
2311
2315
  }, r) {
2312
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
2316
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
2313
2317
  xmlns: "http://www.w3.org/2000/svg",
2314
2318
  viewBox: "0 0 24 24",
2315
2319
  fill: "currentColor",
@@ -2317,25 +2321,25 @@ function zl({
2317
2321
  "data-slot": "icon",
2318
2322
  ref: r,
2319
2323
  "aria-labelledby": t
2320
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
2324
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
2321
2325
  id: t
2322
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
2326
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
2323
2327
  fillRule: "evenodd",
2324
2328
  d: "M11.47 13.28a.75.75 0 0 0 1.06 0l7.5-7.5a.75.75 0 0 0-1.06-1.06L12 11.69 5.03 4.72a.75.75 0 0 0-1.06 1.06l7.5 7.5Z",
2325
2329
  clipRule: "evenodd"
2326
- }), /* @__PURE__ */ b.createElement("path", {
2330
+ }), /* @__PURE__ */ E.createElement("path", {
2327
2331
  fillRule: "evenodd",
2328
2332
  d: "M11.47 19.28a.75.75 0 0 0 1.06 0l7.5-7.5a.75.75 0 1 0-1.06-1.06L12 17.69l-6.97-6.97a.75.75 0 0 0-1.06 1.06l7.5 7.5Z",
2329
2333
  clipRule: "evenodd"
2330
2334
  }));
2331
2335
  }
2332
- const Ul = /* @__PURE__ */ b.forwardRef(zl);
2336
+ const Ul = /* @__PURE__ */ E.forwardRef(zl);
2333
2337
  function Zl({
2334
2338
  title: e,
2335
2339
  titleId: t,
2336
2340
  ...n
2337
2341
  }, r) {
2338
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
2342
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
2339
2343
  xmlns: "http://www.w3.org/2000/svg",
2340
2344
  viewBox: "0 0 24 24",
2341
2345
  fill: "currentColor",
@@ -2343,21 +2347,21 @@ function Zl({
2343
2347
  "data-slot": "icon",
2344
2348
  ref: r,
2345
2349
  "aria-labelledby": t
2346
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
2350
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
2347
2351
  id: t
2348
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
2352
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
2349
2353
  fillRule: "evenodd",
2350
2354
  d: "M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-3.75V6Z",
2351
2355
  clipRule: "evenodd"
2352
2356
  }));
2353
2357
  }
2354
- const Vl = /* @__PURE__ */ b.forwardRef(Zl);
2358
+ const Vl = /* @__PURE__ */ E.forwardRef(Zl);
2355
2359
  function Gl({
2356
2360
  title: e,
2357
2361
  titleId: t,
2358
2362
  ...n
2359
2363
  }, r) {
2360
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
2364
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
2361
2365
  xmlns: "http://www.w3.org/2000/svg",
2362
2366
  viewBox: "0 0 24 24",
2363
2367
  fill: "currentColor",
@@ -2365,23 +2369,23 @@ function Gl({
2365
2369
  "data-slot": "icon",
2366
2370
  ref: r,
2367
2371
  "aria-labelledby": t
2368
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
2372
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
2369
2373
  id: t
2370
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
2374
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
2371
2375
  fillRule: "evenodd",
2372
2376
  d: "M9 1.5H5.625c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5Zm6.61 10.936a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 14.47a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",
2373
2377
  clipRule: "evenodd"
2374
- }), /* @__PURE__ */ b.createElement("path", {
2378
+ }), /* @__PURE__ */ E.createElement("path", {
2375
2379
  d: "M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"
2376
2380
  }));
2377
2381
  }
2378
- const Kl = /* @__PURE__ */ b.forwardRef(Gl);
2382
+ const Kl = /* @__PURE__ */ E.forwardRef(Gl);
2379
2383
  function Wl({
2380
2384
  title: e,
2381
2385
  titleId: t,
2382
2386
  ...n
2383
2387
  }, r) {
2384
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
2388
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
2385
2389
  xmlns: "http://www.w3.org/2000/svg",
2386
2390
  viewBox: "0 0 24 24",
2387
2391
  fill: "currentColor",
@@ -2389,23 +2393,23 @@ function Wl({
2389
2393
  "data-slot": "icon",
2390
2394
  ref: r,
2391
2395
  "aria-labelledby": t
2392
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
2396
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
2393
2397
  id: t
2394
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
2398
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
2395
2399
  d: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"
2396
- }), /* @__PURE__ */ b.createElement("path", {
2400
+ }), /* @__PURE__ */ E.createElement("path", {
2397
2401
  fillRule: "evenodd",
2398
2402
  d: "M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",
2399
2403
  clipRule: "evenodd"
2400
2404
  }));
2401
2405
  }
2402
- const Xl = /* @__PURE__ */ b.forwardRef(Wl);
2406
+ const Xl = /* @__PURE__ */ E.forwardRef(Wl);
2403
2407
  function Yl({
2404
2408
  title: e,
2405
2409
  titleId: t,
2406
2410
  ...n
2407
2411
  }, r) {
2408
- return /* @__PURE__ */ b.createElement("svg", Object.assign({
2412
+ return /* @__PURE__ */ E.createElement("svg", Object.assign({
2409
2413
  xmlns: "http://www.w3.org/2000/svg",
2410
2414
  viewBox: "0 0 24 24",
2411
2415
  fill: "currentColor",
@@ -2413,15 +2417,15 @@ function Yl({
2413
2417
  "data-slot": "icon",
2414
2418
  ref: r,
2415
2419
  "aria-labelledby": t
2416
- }, n), e ? /* @__PURE__ */ b.createElement("title", {
2420
+ }, n), e ? /* @__PURE__ */ E.createElement("title", {
2417
2421
  id: t
2418
- }, e) : null, /* @__PURE__ */ b.createElement("path", {
2422
+ }, e) : null, /* @__PURE__ */ E.createElement("path", {
2419
2423
  d: "M21.731 2.269a2.625 2.625 0 0 0-3.712 0l-1.157 1.157 3.712 3.712 1.157-1.157a2.625 2.625 0 0 0 0-3.712ZM19.513 8.199l-3.712-3.712-8.4 8.4a5.25 5.25 0 0 0-1.32 2.214l-.8 2.685a.75.75 0 0 0 .933.933l2.685-.8a5.25 5.25 0 0 0 2.214-1.32l8.4-8.4Z"
2420
- }), /* @__PURE__ */ b.createElement("path", {
2424
+ }), /* @__PURE__ */ E.createElement("path", {
2421
2425
  d: "M5.25 5.25a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h10.5a3 3 0 0 0 3-3V13.5a.75.75 0 0 0-1.5 0v5.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5V8.25a1.5 1.5 0 0 1 1.5-1.5h5.25a.75.75 0 0 0 0-1.5H5.25Z"
2422
2426
  }));
2423
2427
  }
2424
- const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId: n }) => {
2428
+ const Jl = /* @__PURE__ */ E.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId: n }) => {
2425
2429
  const { labels: r, onEditGrant: o } = D(), [l, i] = I(!1), d = () => {
2426
2430
  o === void 0 || l || (i(!0), o(e).then((g) => {
2427
2431
  g && t();
@@ -2437,103 +2441,105 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2437
2441
  /* @__PURE__ */ a("button", { type: "button", className: "aqmx-callout-action", "data-testid": `${n}-retry`, onClick: t, children: r.editGrantRetry })
2438
2442
  ] })
2439
2443
  ] });
2440
- }, _t = (e, t, n) => {
2444
+ }, qt = (e, t, n) => {
2441
2445
  const r = e.modifiedAt === null ? Number.NaN : Date.parse(e.modifiedAt);
2442
2446
  return n(Number.isNaN(r) ? e.id : t.format(r), e.author === null ? "" : e.author);
2443
2447
  }, ei = ({ path: e, documentName: t, open: n, onClose: r }) => {
2444
- const { data: o, edits: l, labels: i, locale: d, announcer: g } = D(), f = B(null), u = B(null), p = Oe(), [m, x] = I(null), [O, y] = I(0), [T, S] = I(null), [M, s] = I(null), c = U(() => new Intl.DateTimeFormat(d, { dateStyle: "medium", timeStyle: "short" }), [d]);
2445
- V(() => {
2446
- const R = f.current;
2447
- if (R !== null)
2448
- if (n && !R.open) {
2449
- const N = R.ownerDocument.activeElement;
2450
- u.current = N instanceof HTMLElement ? N : null, S(null), s(null), R.showModal();
2451
- } else !n && R.open && (R.close(), u.current?.isConnected === !0 && u.current.focus(), u.current = null);
2452
- }, [n]), ne(() => {
2448
+ const { data: o, edits: l, labels: i, locale: d, announcer: g } = D(), f = _(null), u = _(null), h = Oe(), [m, S] = I(null), [A, x] = I(0), [T, M] = I(null), [C, s] = I(null), c = z(() => new Intl.DateTimeFormat(d, { dateStyle: "medium", timeStyle: "short" }), [d]);
2449
+ U(() => {
2450
+ const O = f.current;
2451
+ if (O !== null)
2452
+ if (n && !O.open) {
2453
+ const N = O.ownerDocument.activeElement;
2454
+ u.current = N instanceof HTMLElement ? N : null, M(null), s(null), O.showModal();
2455
+ } else !n && O.open && (O.close(), u.current?.isConnected === !0 && u.current.focus(), u.current = null);
2456
+ }, [n]), te(() => {
2453
2457
  if (!n) return;
2454
- const R = new AbortController();
2455
- return x(null), o.revisions(e, R.signal).then((N) => {
2456
- "kind" in N && x(N);
2457
- }), () => R.abort();
2458
- }, [n, o, e, O]), ne(() => {
2458
+ const O = new AbortController();
2459
+ return S(null), o.revisions(e, O.signal).then((N) => {
2460
+ "kind" in N && S(N);
2461
+ }), () => O.abort();
2462
+ }, [n, o, e, A]), te(() => {
2459
2463
  if (!n || T === null) return;
2460
- const R = new AbortController();
2461
- return s(null), o.revision(e, T, R.signal).then((N) => {
2464
+ const O = new AbortController();
2465
+ return s(null), o.revision(e, T, O.signal).then((N) => {
2462
2466
  "kind" in N && s(N);
2463
- }), () => R.abort();
2467
+ }), () => O.abort();
2464
2468
  }, [n, o, e, T]);
2465
- const h = () => {
2466
- M === null || M.kind !== "revision" || (l.replaceDraft(e, M.text), g.announce(i.historyRestored(t)), r());
2467
- }, w = (R) => {
2468
- R.key !== "Escape" || R.defaultPrevented || (on(R), r());
2469
- }, k = (R) => {
2470
- R.target === R.currentTarget && r();
2471
- }, L = m !== null && m.kind === "revisions" ? m.revisions.find((R) => R.id === T) : void 0;
2472
- return /* @__PURE__ */ a("dialog", { ref: f, className: "aqmx-confirm aqmx-history", "aria-labelledby": p, "data-testid": "markdown-explorer-history", onKeyDown: w, onClick: k, onCancel: (R) => R.preventDefault(), children: /* @__PURE__ */ F("div", { className: "aqmx-confirm-panel aqmx-history-panel", children: [
2473
- /* @__PURE__ */ a("p", { id: p, className: "aqmx-confirm-title", children: i.historyTitle(t) }),
2474
- m === null ? /* @__PURE__ */ a("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: i.historyLoading }) : m.kind === "failure" ? /* @__PURE__ */ a(ve, { failure: m.failure, alert: !1, onRetry: () => y((R) => R + 1), testId: "markdown-explorer-history-failure" }) : m.revisions.length === 0 ? /* @__PURE__ */ a("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: i.historyEmpty }) : /* @__PURE__ */ a("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: m.revisions.map((R) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ F("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": R.id === T, "data-testid": "markdown-explorer-history-entry", onClick: () => S(R.id), children: [
2475
- /* @__PURE__ */ a("span", { children: _t(R, c, i.historyEntry) }),
2476
- R.current ? /* @__PURE__ */ a("span", { className: "aqmx-history-mark", children: i.historyCurrent }) : null,
2477
- R.kept ? /* @__PURE__ */ a("span", { className: "aqmx-history-mark", children: i.historyKept }) : null
2478
- ] }) }, R.id)) }),
2479
- T === null ? null : M === null ? /* @__PURE__ */ a("p", { className: "aqmx-history-note", children: i.historyLoading }) : M.kind === "failure" ? /* @__PURE__ */ a(ve, { failure: M.failure, alert: !1, testId: "markdown-explorer-history-revision-failure" }) : (
2480
- /* @__PURE__ */ a("section", { className: "aqmx-history-text", tabIndex: 0, "aria-label": L === void 0 ? i.historyTitle(t) : _t(L, c, i.historyEntry), "data-testid": "markdown-explorer-history-text", children: /* @__PURE__ */ a("pre", { children: M.text }) })
2469
+ const p = () => {
2470
+ C === null || C.kind !== "revision" || (l.replaceDraft(e, C.text), g.announce(i.historyRestored(t)), r());
2471
+ }, w = (O) => {
2472
+ O.key !== "Escape" || O.defaultPrevented || (rn(O), r());
2473
+ }, k = (O) => {
2474
+ O.target === O.currentTarget && r();
2475
+ }, L = m !== null && m.kind === "revisions" ? m.revisions.find((O) => O.id === T) : void 0;
2476
+ return /* @__PURE__ */ a("dialog", { ref: f, className: "aqmx-confirm aqmx-history", "aria-labelledby": h, "data-testid": "markdown-explorer-history", onKeyDown: w, onClick: k, onCancel: (O) => O.preventDefault(), children: /* @__PURE__ */ F("div", { className: "aqmx-confirm-panel aqmx-history-panel", children: [
2477
+ /* @__PURE__ */ a("p", { id: h, className: "aqmx-confirm-title", children: i.historyTitle(t) }),
2478
+ m === null ? /* @__PURE__ */ a("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: i.historyLoading }) : m.kind === "failure" ? /* @__PURE__ */ a(ve, { failure: m.failure, alert: !1, onRetry: () => x((O) => O + 1), testId: "markdown-explorer-history-failure" }) : m.revisions.length === 0 ? /* @__PURE__ */ a("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: i.historyEmpty }) : /* @__PURE__ */ a("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: m.revisions.map((O) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ F("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": O.id === T, "data-testid": "markdown-explorer-history-entry", onClick: () => M(O.id), children: [
2479
+ /* @__PURE__ */ a("span", { children: qt(O, c, i.historyEntry) }),
2480
+ O.current ? /* @__PURE__ */ a("span", { className: "aqmx-history-mark", children: i.historyCurrent }) : null,
2481
+ O.kept ? /* @__PURE__ */ a("span", { className: "aqmx-history-mark", children: i.historyKept }) : null
2482
+ ] }) }, O.id)) }),
2483
+ T === null ? null : C === null ? /* @__PURE__ */ a("p", { className: "aqmx-history-note", children: i.historyLoading }) : C.kind === "failure" ? /* @__PURE__ */ a(ve, { failure: C.failure, alert: !1, testId: "markdown-explorer-history-revision-failure" }) : (
2484
+ /* @__PURE__ */ a("section", { className: "aqmx-history-text", tabIndex: 0, "aria-label": L === void 0 ? i.historyTitle(t) : qt(L, c, i.historyEntry), "data-testid": "markdown-explorer-history-text", children: /* @__PURE__ */ a("pre", { children: C.text }) })
2481
2485
  ),
2482
2486
  /* @__PURE__ */ F("div", { className: "aqmx-confirm-actions", children: [
2483
2487
  /* @__PURE__ */ a("button", { type: "button", className: "aqmx-callout-action", "data-testid": "markdown-explorer-history-close", onClick: r, children: i.historyClose }),
2484
- /* @__PURE__ */ a("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": M === null || M.kind !== "revision", "data-testid": "markdown-explorer-history-restore", onClick: h, children: i.historyRestore })
2488
+ /* @__PURE__ */ a("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": C === null || C.kind !== "revision", "data-testid": "markdown-explorer-history-restore", onClick: p, children: i.historyRestore })
2485
2489
  ] })
2486
2490
  ] }) });
2487
2491
  }, ti = (e) => {
2488
- const { documents: t } = D(), n = P(() => t.peek(e), [t, e]), r = P(() => t.peekSeeded(e), [t, e]), o = te(t.subscribe, n, r), l = de(o)?.document;
2492
+ const { documents: t } = D(), n = P(() => t.peek(e), [t, e]), r = P(() => t.peekSeeded(e), [t, e]), o = ee(t.subscribe, n, r), l = de(o)?.document;
2489
2493
  return l === void 0 || l.kind === "failure" ? { edit: null, name: Ee(e) } : { edit: l.kind === "markdown" ? l.edit : null, name: l.name };
2490
2494
  }, se = (e) => {
2491
2495
  e.stopPropagation();
2492
- }, ni = ({ path: e, documentName: t, iconOnly: n }) => {
2493
- const { edits: r, labels: o } = D(), l = te(
2494
- r.subscribe,
2495
- () => r.session(e) !== void 0,
2496
+ }, ni = ({ path: e, documentName: t, iconOnly: n, previewAvailable: r }) => {
2497
+ const { draftConverter: o, edits: l, labels: i } = D(), d = ee(
2498
+ l.subscribe,
2499
+ () => l.session(e) !== void 0,
2496
2500
  () => !1
2497
- ), [i, d] = I(!1), g = () => {
2498
- if (!l) {
2499
- r.start(e, r.viewAnchor(e));
2501
+ ), [g, f] = I(!1), u = () => {
2502
+ if (!d) {
2503
+ l.start(e, l.viewAnchor(e));
2500
2504
  return;
2501
2505
  }
2502
- r.flush(e), r.session(e)?.dirty === !0 ? d(!0) : r.close(e);
2503
- }, f = n ? o.editDocumentNamed(t) : null;
2506
+ l.flush(e), l.session(e)?.dirty === !0 ? f(!0) : l.close(e);
2507
+ }, h = () => {
2508
+ d || (Fr(), r && l.previewShown() && o?.prepare?.());
2509
+ }, m = n ? i.editDocumentNamed(t) : null;
2504
2510
  return /* @__PURE__ */ F(Ne, { children: [
2505
2511
  /* @__PURE__ */ F(
2506
2512
  "button",
2507
2513
  {
2508
2514
  type: "button",
2509
- className: f === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
2510
- title: l ? o.closeEditor : f === null ? o.editDocument : f,
2511
- "aria-label": f === null ? void 0 : f,
2512
- "aria-pressed": l,
2515
+ className: m === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
2516
+ title: d ? i.closeEditor : m === null ? i.editDocument : m,
2517
+ "aria-label": m === null ? void 0 : m,
2518
+ "aria-pressed": d,
2513
2519
  "data-testid": "markdown-explorer-document-edit",
2514
- onClick: g,
2520
+ onClick: u,
2515
2521
  onDoubleClick: se,
2516
- onPointerEnter: Rt,
2517
- onFocus: Rt,
2522
+ onPointerEnter: h,
2523
+ onFocus: h,
2518
2524
  children: [
2519
2525
  /* @__PURE__ */ a(Jl, { "aria-hidden": "true" }),
2520
- f === null ? /* @__PURE__ */ a("span", { children: o.editDocumentLabel }) : null
2526
+ m === null ? /* @__PURE__ */ a("span", { children: i.editDocumentLabel }) : null
2521
2527
  ]
2522
2528
  }
2523
2529
  ),
2524
2530
  /* @__PURE__ */ a(
2525
- ln,
2531
+ on,
2526
2532
  {
2527
- open: i,
2528
- title: o.unsavedTitle,
2529
- body: o.unsavedBody(t),
2530
- confirmLabel: o.unsavedDiscard,
2531
- cancelLabel: o.unsavedStay,
2533
+ open: g,
2534
+ title: i.unsavedTitle,
2535
+ body: i.unsavedBody(t),
2536
+ confirmLabel: i.unsavedDiscard,
2537
+ cancelLabel: i.unsavedStay,
2532
2538
  testId: "markdown-explorer-edit-close-confirm",
2533
2539
  onConfirm: () => {
2534
- d(!1), r.close(e);
2540
+ f(!1), l.close(e);
2535
2541
  },
2536
- onCancel: () => d(!1)
2542
+ onCancel: () => f(!1)
2537
2543
  }
2538
2544
  )
2539
2545
  ] });
@@ -2557,34 +2563,50 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2557
2563
  }
2558
2564
  );
2559
2565
  }, oi = ({ session: e }) => {
2560
- const { labels: t } = D(), n = Er(t, e);
2566
+ const { labels: t } = D(), n = br(t, e);
2561
2567
  return /* @__PURE__ */ a("p", { className: "aqmx-edit-status", title: n === "" ? void 0 : n, "data-testid": "markdown-explorer-edit-status", "data-aqmx-save": e.save.kind, children: n });
2562
2568
  }, li = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
2563
- const { edits: l, labels: i } = D(), d = Nr(), [g, f] = I(!1);
2569
+ const { draftConverter: l, edits: i, labels: d } = D(), g = Mr(), [f, u] = I(!1);
2564
2570
  if (r.phase.kind !== "editing") return null;
2565
- const u = r.save.kind === "saving", p = u || !r.dirty, m = () => {
2566
- l.flush(e);
2567
- const O = l.session(e);
2568
- O === void 0 || !O.dirty || O.save.kind === "saving" || l.save(e);
2569
- }, x = (O) => n ? { className: "aqmx-icon-button", "aria-label": O } : { className: "aqmx-icon-button aqmx-labelled-button" };
2571
+ const h = r.save.kind === "saving", m = h || !r.dirty, S = () => {
2572
+ i.flush(e);
2573
+ const T = i.session(e);
2574
+ T === void 0 || !T.dirty || T.save.kind === "saving" || i.save(e);
2575
+ }, A = (T) => n ? { className: "aqmx-icon-button", "aria-label": T } : { className: "aqmx-icon-button aqmx-labelled-button" }, x = () => {
2576
+ g || l?.prepare?.();
2577
+ };
2570
2578
  return /* @__PURE__ */ F(Ne, { children: [
2571
- r.save.kind === "conflicts" ? /* @__PURE__ */ F("button", { type: "button", ...x(i.conflictNext), title: i.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => l.nextConflict(e), onDoubleClick: se, children: [
2579
+ r.save.kind === "conflicts" ? /* @__PURE__ */ F("button", { type: "button", ...A(d.conflictNext), title: d.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => i.nextConflict(e), onDoubleClick: se, children: [
2572
2580
  /* @__PURE__ */ a(Ul, { "aria-hidden": "true" }),
2573
- n ? null : /* @__PURE__ */ a("span", { children: i.conflictNext })
2574
- ] }) : null,
2575
- o ? /* @__PURE__ */ F("button", { type: "button", ...x(i.previewToggle), title: i.previewToggle, "aria-pressed": d, "data-testid": "markdown-explorer-edit-preview-toggle", onClick: () => l.setPreviewShown(!d), onDoubleClick: se, children: [
2576
- /* @__PURE__ */ a(Xl, { "aria-hidden": "true" }),
2577
- n ? null : /* @__PURE__ */ a("span", { children: i.previewToggle })
2581
+ n ? null : /* @__PURE__ */ a("span", { children: d.conflictNext })
2578
2582
  ] }) : null,
2579
- r.history ? /* @__PURE__ */ F("button", { type: "button", ...x(i.historyOpen), title: i.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => f(!0), onDoubleClick: se, children: [
2583
+ o ? /* @__PURE__ */ F(
2584
+ "button",
2585
+ {
2586
+ type: "button",
2587
+ ...A(d.previewToggle),
2588
+ title: d.previewToggle,
2589
+ "aria-pressed": g,
2590
+ "data-testid": "markdown-explorer-edit-preview-toggle",
2591
+ onClick: () => i.setPreviewShown(!g),
2592
+ onDoubleClick: se,
2593
+ onPointerEnter: x,
2594
+ onFocus: x,
2595
+ children: [
2596
+ /* @__PURE__ */ a(Xl, { "aria-hidden": "true" }),
2597
+ n ? null : /* @__PURE__ */ a("span", { children: d.previewToggle })
2598
+ ]
2599
+ }
2600
+ ) : null,
2601
+ r.history ? /* @__PURE__ */ F("button", { type: "button", ...A(d.historyOpen), title: d.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => u(!0), onDoubleClick: se, children: [
2580
2602
  /* @__PURE__ */ a(Vl, { "aria-hidden": "true" }),
2581
- n ? null : /* @__PURE__ */ a("span", { children: i.historyOpen })
2603
+ n ? null : /* @__PURE__ */ a("span", { children: d.historyOpen })
2582
2604
  ] }) : null,
2583
- /* @__PURE__ */ F("button", { type: "button", ...x(i.saveDraft), title: i.saveDraftTooltip, "aria-disabled": p, "aria-busy": u, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: m, onDoubleClick: se, children: [
2605
+ /* @__PURE__ */ F("button", { type: "button", ...A(d.saveDraft), title: d.saveDraftTooltip, "aria-disabled": m, "aria-busy": h, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: S, onDoubleClick: se, children: [
2584
2606
  /* @__PURE__ */ a(Kl, { "aria-hidden": "true" }),
2585
- n ? null : /* @__PURE__ */ a("span", { children: i.saveDraft })
2607
+ n ? null : /* @__PURE__ */ a("span", { children: d.saveDraft })
2586
2608
  ] }),
2587
- r.history ? /* @__PURE__ */ a(ei, { path: e, documentName: t, open: g, onClose: () => f(!1) }) : null
2609
+ r.history ? /* @__PURE__ */ a(ei, { path: e, documentName: t, open: f, onClose: () => u(!1) }) : null
2588
2610
  ] });
2589
2611
  }, ii = ({ path: e, session: t }) => {
2590
2612
  const { edits: n } = D();
@@ -2592,45 +2614,45 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2592
2614
  n.save(e);
2593
2615
  }, testId: "markdown-explorer-save-grant" });
2594
2616
  }, si = (e) => {
2595
- const { documents: t } = D(), n = P(() => t.peek(e), [t, e]), r = P(() => t.peekSeeded(e), [t, e]), o = te(t.subscribe, n, r);
2617
+ const { documents: t } = D(), n = P(() => t.peek(e), [t, e]), r = P(() => t.peekSeeded(e), [t, e]), o = ee(t.subscribe, n, r);
2596
2618
  return de(o)?.document.kind === "markdown";
2597
2619
  }, ai = (e) => {
2598
2620
  const { config: t } = D(), n = $e(), r = P(() => n(pe(t, { ...e, markup: !e.markup }), "browse"), [t, n, e]);
2599
- return U(() => ({ shown: e.markup, toggle: r }), [e.markup, r]);
2621
+ return z(() => ({ shown: e.markup, toggle: r }), [e.markup, r]);
2600
2622
  }, ci = /* @__PURE__ */ new Set(), di = (e, t) => {
2601
- const { documents: n, announcer: r, labels: o } = D(), l = P(() => n.peek(e), [n, e]), i = P(() => n.peekSeeded(e), [n, e]), d = te(n.subscribe, l, i), g = P(() => n.answerStampOf(e), [n, e]), f = te(n.subscribe, g, g), [u] = I(() => /* @__PURE__ */ new Set()), [p, m] = I(ci), [x, O] = I(null);
2602
- x !== null && x.path !== e && O(null);
2603
- const y = B(null);
2604
- V(() => (y.current = e, () => {
2605
- y.current = null;
2623
+ const { documents: n, announcer: r, labels: o } = D(), l = P(() => n.peek(e), [n, e]), i = P(() => n.peekSeeded(e), [n, e]), d = ee(n.subscribe, l, i), g = P(() => n.answerStampOf(e), [n, e]), f = ee(n.subscribe, g, g), [u] = I(() => /* @__PURE__ */ new Set()), [h, m] = I(ci), [S, A] = I(null);
2624
+ S !== null && S.path !== e && A(null);
2625
+ const x = _(null);
2626
+ U(() => (x.current = e, () => {
2627
+ x.current = null;
2606
2628
  }), [e]);
2607
2629
  const T = P(() => {
2608
2630
  const s = e, c = n.peek(s);
2609
2631
  if (u.has(s) || c?.status === "pending") return;
2610
- const h = t && !hn(c);
2611
- u.add(s), m(new Set(u)), O(null), (async () => {
2632
+ const p = t && !mn(c);
2633
+ u.add(s), m(new Set(u)), A(null), (async () => {
2612
2634
  try {
2613
2635
  const w = await n.refresh(s);
2614
- if (y.current !== s || w.status === "superseded") return;
2636
+ if (x.current !== s || w.status === "superseded") return;
2615
2637
  if (w.status === "failed") {
2616
- O({ path: s, failure: w.failure, stamp: n.answerStampOf(s) }), r.announce(o.documentRefreshFailed(ae(o, w.failure.reason)));
2638
+ A({ path: s, failure: w.failure, stamp: n.answerStampOf(s) }), r.announce(o.documentRefreshFailed(ae(o, w.failure.reason)));
2617
2639
  return;
2618
2640
  }
2619
2641
  const k = de(n.peek(s));
2620
- if (h || k === null || k.document.kind === "failure") return;
2642
+ if (p || k === null || k.document.kind === "failure") return;
2621
2643
  r.announce(o.documentRefreshed(k.document.name));
2622
2644
  } finally {
2623
2645
  u.delete(s), m(new Set(u));
2624
2646
  }
2625
2647
  })();
2626
- }, [e, t, u, n, r, o]), S = p.has(e), M = x !== null && x.path === e && x.stamp === f ? x.failure : null;
2627
- return { refreshing: S, unavailable: S || d?.status === "pending", failure: M, refresh: T };
2648
+ }, [e, t, u, n, r, o]), M = h.has(e), C = S !== null && S.path === e && S.stamp === f ? S.failure : null;
2649
+ return { refreshing: M, unavailable: M || d?.status === "pending", failure: C, refresh: T };
2628
2650
  }, ui = Object.freeze({ kind: "page" }), fi = ({ path: e, placement: t, markup: n }) => {
2629
- const { labels: r } = D(), { refreshing: o, unavailable: l, failure: i, refresh: d } = di(e, t.kind === "page"), g = si(e), f = ti(e), u = sn(e), p = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, m = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, x = t.kind === "panel", O = t.kind === "panel" ? t.documentName : f.name, y = t.kind === "page" || t.maximized;
2651
+ const { labels: r } = D(), { refreshing: o, unavailable: l, failure: i, refresh: d } = di(e, t.kind === "page"), g = si(e), f = ti(e), u = ln(e), h = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, m = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, S = t.kind === "panel", A = t.kind === "panel" ? t.documentName : f.name, x = t.kind === "page" || t.maximized;
2630
2652
  return /* @__PURE__ */ F("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", "data-aqmx-editing": u === void 0 ? void 0 : "true", children: [
2631
2653
  /* @__PURE__ */ F("div", { className: "aqmx-document-refresh-row", children: [
2632
2654
  u === void 0 ? null : /* @__PURE__ */ a(oi, { session: u }),
2633
- u === void 0 ? null : /* @__PURE__ */ a(li, { path: e, documentName: O, iconOnly: x, session: u, previewAvailable: y }),
2655
+ u === void 0 ? null : /* @__PURE__ */ a(li, { path: e, documentName: A, iconOnly: S, session: u, previewAvailable: x }),
2634
2656
  u === void 0 && g ? /* @__PURE__ */ F(
2635
2657
  "button",
2636
2658
  {
@@ -2648,14 +2670,14 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2648
2670
  ]
2649
2671
  }
2650
2672
  ) : null,
2651
- u !== void 0 || f.edit?.kind === "inline" ? /* @__PURE__ */ a(ni, { path: e, documentName: O, iconOnly: x }) : f.edit?.kind === "external" ? /* @__PURE__ */ a(ri, { href: f.edit.href, documentName: O, iconOnly: x }) : null,
2673
+ u !== void 0 || f.edit?.kind === "inline" ? /* @__PURE__ */ a(ni, { path: e, documentName: A, iconOnly: S, previewAvailable: x }) : f.edit?.kind === "external" ? /* @__PURE__ */ a(ri, { href: f.edit.href, documentName: A, iconOnly: S }) : null,
2652
2674
  u === void 0 ? /* @__PURE__ */ F(
2653
2675
  "button",
2654
2676
  {
2655
2677
  type: "button",
2656
- className: p === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
2657
- title: p === null ? r.refreshDocument : p,
2658
- "aria-label": p === null ? void 0 : p,
2678
+ className: h === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
2679
+ title: h === null ? r.refreshDocument : h,
2680
+ "aria-label": h === null ? void 0 : h,
2659
2681
  "aria-disabled": l,
2660
2682
  "aria-busy": o,
2661
2683
  "data-aqmx-busy": o ? "true" : void 0,
@@ -2664,7 +2686,7 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2664
2686
  onDoubleClick: se,
2665
2687
  children: [
2666
2688
  /* @__PURE__ */ a(_l, { "aria-hidden": "true" }),
2667
- p === null ? /* @__PURE__ */ a("span", { children: r.refreshDocumentLabel }) : null
2689
+ h === null ? /* @__PURE__ */ a("span", { children: r.refreshDocumentLabel }) : null
2668
2690
  ]
2669
2691
  }
2670
2692
  ) : null
@@ -2673,36 +2695,36 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2673
2695
  u === void 0 ? null : /* @__PURE__ */ a(ii, { path: e, session: u })
2674
2696
  ] });
2675
2697
  }, mi = ({ location: e }) => {
2676
- const t = e.doc, n = U(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), r = ai(e);
2698
+ const t = e.doc, n = z(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), r = ai(e);
2677
2699
  return /* @__PURE__ */ F("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", children: [
2678
2700
  /* @__PURE__ */ a(fi, { path: t, placement: ui, markup: r }),
2679
2701
  /* @__PURE__ */ a(Fl, { path: t, markup: e.markup, variant: n })
2680
2702
  ] });
2681
2703
  }, hi = ({ holds: e, testId: t }) => {
2682
2704
  const { labels: n, announcer: r } = D(), o = Oe();
2683
- V(() => e ? r.claim(o) : void 0, [e, r, o]);
2684
- const l = P(() => r.shownIn(o), [r, o]), i = te(r.subscribe, l, l);
2705
+ U(() => e ? r.claim(o) : void 0, [e, r, o]);
2706
+ const l = P(() => r.shownIn(o), [r, o]), i = ee(r.subscribe, l, l);
2685
2707
  return /* @__PURE__ */ a("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: i.length > 1 ? n.announcementSequence(i) : i[0] });
2686
2708
  }, ue = Object.freeze([]), pi = (e) => {
2687
2709
  const t = /* @__PURE__ */ new Set();
2688
2710
  let n = ue, r = [], o = !1;
2689
2711
  const l = [], i = (u) => {
2690
2712
  n = u;
2691
- for (const p of [...t]) p();
2713
+ for (const h of [...t]) h();
2692
2714
  }, d = () => l.at(-1)?.region, g = (u) => {
2693
- const p = d();
2694
- u(), d() !== p && n !== ue && i(ue);
2715
+ const h = d();
2716
+ u(), d() !== h && n !== ue && i(ue);
2695
2717
  }, f = () => {
2696
2718
  o = !1;
2697
- const u = r.map((p) => "sentence" in p ? p.sentence : p.list(p.items));
2719
+ const u = r.map((h) => "sentence" in h ? h.sentence : h.list(h.items));
2698
2720
  r = [], i(Object.freeze(u));
2699
2721
  };
2700
2722
  return {
2701
2723
  announce: (u) => {
2702
2724
  if (typeof u == "string") r.push({ sentence: u });
2703
2725
  else {
2704
- const p = r.find((m) => "list" in m && m.list === u.list);
2705
- p !== void 0 && "items" in p ? p.items.push(u.item) : r.push({ list: u.list, items: [u.item] });
2726
+ const h = r.find((m) => "list" in m && m.list === u.list);
2727
+ h !== void 0 && "items" in h ? h.items.push(u.item) : r.push({ list: u.list, items: [u.item] });
2706
2728
  }
2707
2729
  o || (o = !0, n !== ue && i(ue), e.request(f));
2708
2730
  },
@@ -2710,9 +2732,9 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2710
2732
  t.delete(u);
2711
2733
  }),
2712
2734
  claim: (u) => {
2713
- const p = { region: u };
2714
- return g(() => l.push(p)), () => g(() => {
2715
- const m = l.indexOf(p);
2735
+ const h = { region: u };
2736
+ return g(() => l.push(h)), () => g(() => {
2737
+ const m = l.indexOf(h);
2716
2738
  m !== -1 && l.splice(m, 1);
2717
2739
  });
2718
2740
  },
@@ -2721,64 +2743,64 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2721
2743
  }, he = Object.freeze({ status: "cancelled" }), gi = (e) => {
2722
2744
  if (e === null || typeof e != "object") return null;
2723
2745
  const { failure: t } = e;
2724
- if (Wn(t) !== null) return null;
2746
+ if (Kn(t) !== null) return null;
2725
2747
  const { reason: n, code: r } = t;
2726
- return Xn(n, r);
2748
+ return Wn(n, r);
2727
2749
  }, vi = ({ dataPath: e, onScope: t, fetch: n }) => {
2728
- const r = n ?? ((f, u) => globalThis.fetch(f, u)), o = (f, u) => `${e}/${f}?${new URLSearchParams(u).toString()}`, l = async (f, u, p, m) => {
2729
- let x;
2750
+ const r = n ?? ((f, u) => globalThis.fetch(f, u)), o = (f, u) => `${e}/${f}?${new URLSearchParams(u).toString()}`, l = async (f, u, h, m) => {
2751
+ let S;
2730
2752
  try {
2731
- x = await r(f, { credentials: "same-origin", ...u, headers: { Accept: "application/json", ...u.headers } });
2753
+ S = await r(f, { credentials: "same-origin", ...u, headers: { Accept: "application/json", ...u.headers } });
2732
2754
  } catch {
2733
2755
  return m({ reason: "failed" });
2734
2756
  }
2735
- x.status === 401 && t(null);
2736
- const O = x.headers.get(Un);
2737
- O !== null && t(O);
2738
- let y;
2757
+ S.status === 401 && t(null);
2758
+ const A = S.headers.get(zn);
2759
+ A !== null && t(A);
2760
+ let x;
2739
2761
  try {
2740
- y = await x.json();
2762
+ x = await S.json();
2741
2763
  } catch {
2742
- return m({ reason: ht(x.status) });
2764
+ return m({ reason: ht(S.status) });
2743
2765
  }
2744
2766
  let T;
2745
2767
  try {
2746
- T = p(y);
2768
+ T = h(x);
2747
2769
  } catch {
2748
2770
  T = !1;
2749
2771
  }
2750
- if (T) return y;
2751
- const S = gi(y);
2752
- return m(S !== null ? S : { reason: x.status === 200 ? "failed" : ht(x.status) });
2753
- }, i = { [gt]: Yn }, d = { [gt]: nr, "Content-Type": `${tr}; charset=utf-8` }, g = async (f, u, p) => {
2754
- const m = await l(f, u, p, (x) => He(x.reason, x.code));
2772
+ if (T) return x;
2773
+ const M = gi(x);
2774
+ return m(M !== null ? M : { reason: S.status === 200 ? "failed" : ht(S.status) });
2775
+ }, i = { [gt]: Xn }, d = { [gt]: tr, "Content-Type": `${er}; charset=utf-8` }, g = async (f, u, h) => {
2776
+ const m = await l(f, u, h, (S) => He(S.reason, S.code));
2755
2777
  return u.signal.aborted ? he : m;
2756
2778
  };
2757
2779
  return {
2758
- tree: (f) => l(o("tree", { [Y.source]: f }), { method: "GET" }, pt, (u) => ({ status: "error", failure: u })),
2759
- children: async (f, u, p) => {
2760
- const m = await l(o("children", { [Y.source]: f, [Y.path]: u }), { method: "GET", signal: p }, Kn, (x) => ({ status: "error", failure: x }));
2761
- return p.aborted ? he : m;
2780
+ tree: (f) => l(o("tree", { [X.source]: f }), { method: "GET" }, pt, (u) => ({ status: "error", failure: u })),
2781
+ children: async (f, u, h) => {
2782
+ const m = await l(o("children", { [X.source]: f, [X.path]: u }), { method: "GET", signal: h }, Gn, (S) => ({ status: "error", failure: S }));
2783
+ return h.aborted ? he : m;
2762
2784
  },
2763
- ancestors: async (f, u, p) => {
2764
- const m = await l(o("ancestors", { [Y.source]: f, [Y.path]: u }), { method: "GET", signal: p }, Gn, (x) => ({ status: "error", failure: x }));
2765
- return p.aborted ? he : m;
2785
+ ancestors: async (f, u, h) => {
2786
+ const m = await l(o("ancestors", { [X.source]: f, [X.path]: u }), { method: "GET", signal: h }, Vn, (S) => ({ status: "error", failure: S }));
2787
+ return h.aborted ? he : m;
2766
2788
  },
2767
- reveal: async (f, u, p) => {
2768
- const m = await l(o("reveal", { [Y.source]: f, [Y.path]: u }), { method: "GET", signal: p }, Vn, (x) => ({ status: "error", failure: x }));
2769
- return p.aborted ? he : m;
2789
+ reveal: async (f, u, h) => {
2790
+ const m = await l(o("reveal", { [X.source]: f, [X.path]: u }), { method: "GET", signal: h }, Zn, (S) => ({ status: "error", failure: S }));
2791
+ return h.aborted ? he : m;
2770
2792
  },
2771
- document: (f, { refresh: u }) => l(o("document", { [Y.path]: f }), u ? { method: "GET", headers: i } : { method: "GET" }, lr, (p) => He(p.reason, p.code)),
2793
+ document: (f, { refresh: u }) => l(o("document", { [X.path]: f }), u ? { method: "GET", headers: i } : { method: "GET" }, or, (h) => He(h.reason, h.code)),
2772
2794
  text: async (f, u) => {
2773
- const p = await l(o("text", { [Y.path]: f }), { method: "GET", signal: u }, Zn, (m) => He(m.reason, m.code));
2774
- return u.aborted ? he : p;
2795
+ const h = await l(o("text", { [X.path]: f }), { method: "GET", signal: u }, Un, (m) => He(m.reason, m.code));
2796
+ return u.aborted ? he : h;
2775
2797
  },
2776
- edit: (f, u) => g(o("edit", { [Y.path]: f }), { method: "GET", signal: u }, or),
2777
- save: (f, u, p, m) => g(o("save", { [Y.path]: f, [Y.base]: u }), { method: "POST", headers: d, body: p, signal: m }, rr),
2778
- preview: (f, u, p) => g(o("preview", { [Y.path]: f }), { method: "POST", headers: d, body: u, signal: p }, er),
2779
- revisions: (f, u) => g(o("revisions", { [Y.path]: f }), { method: "GET", signal: u }, Qn),
2780
- revision: (f, u, p) => g(o("revision", { [Y.path]: f, [Y.revision]: u }), { method: "GET", signal: p }, Jn),
2781
- refresh: (f) => l(o("refresh", { [Y.source]: f }), { method: "POST", headers: i }, pt, (u) => ({ status: "error", failure: u }))
2798
+ edit: (f, u) => g(o("edit", { [X.path]: f }), { method: "GET", signal: u }, rr),
2799
+ save: (f, u, h, m) => g(o("save", { [X.path]: f, [X.base]: u }), { method: "POST", headers: d, body: h, signal: m }, nr),
2800
+ preview: (f, u, h) => g(o("preview", { [X.path]: f }), { method: "POST", headers: d, body: u, signal: h }, Qn),
2801
+ revisions: (f, u) => g(o("revisions", { [X.path]: f }), { method: "GET", signal: u }, Jn),
2802
+ revision: (f, u, h) => g(o("revision", { [X.path]: f, [X.revision]: u }), { method: "GET", signal: h }, Yn),
2803
+ refresh: (f) => l(o("refresh", { [X.source]: f }), { method: "POST", headers: i }, pt, (u) => ({ status: "error", failure: u }))
2782
2804
  };
2783
2805
  }, wi = () => {
2784
2806
  let e = null, t = null;
@@ -2796,14 +2818,14 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2796
2818
  }
2797
2819
  };
2798
2820
  }, bi = (e) => {
2799
- const t = Jt(e);
2821
+ const t = Yt(e);
2800
2822
  if (t === null) return mt;
2801
2823
  try {
2802
- return Bn(JSON.parse(t));
2824
+ return _n(JSON.parse(t));
2803
2825
  } catch (n) {
2804
2826
  return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), mt;
2805
2827
  }
2806
- }, Bt = (e, t) => {
2828
+ }, _t = (e, t) => {
2807
2829
  let n = null;
2808
2830
  const r = () => {
2809
2831
  if (n === null) {
@@ -2819,205 +2841,205 @@ const Jl = /* @__PURE__ */ b.forwardRef(Yl), Ql = ({ href: e, onRetry: t, testId
2819
2841
  getServerSnapshot: () => t,
2820
2842
  subscribe: o.subscribe,
2821
2843
  advance: (l) => {
2822
- const { changes: i, settings: d } = r(), g = Fn(i, l, qn(d, l)[l], t);
2823
- return n = { changes: g, settings: ft(t, g) }, o.emit(), Yt(e, _n(g)), n.settings;
2844
+ const { changes: i, settings: d } = r(), g = Pn(i, l, Fn(d, l)[l], t);
2845
+ return n = { changes: g, settings: ft(t, g) }, o.emit(), Xt(e, qn(g)), n.settings;
2824
2846
  }
2825
2847
  };
2826
- }, Ei = Object.freeze({ status: "refreshed" }), yi = Object.freeze({ status: "superseded" }), et = Object.freeze({ status: "deferred" }), xi = mn(et), Tn = 4, ki = Tn - 1, It = Object.freeze({ status: "loading" }), Si = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), Ri = (e) => {
2827
- const t = /* @__PURE__ */ new Map(), n = fn(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), d = ye(), g = /* @__PURE__ */ new Set();
2848
+ }, Ei = Object.freeze({ status: "refreshed" }), yi = Object.freeze({ status: "superseded" }), et = Object.freeze({ status: "deferred" }), xi = fn(et), Rn = 4, ki = Rn - 1, Bt = Object.freeze({ status: "loading" }), Si = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), Ri = (e) => {
2849
+ const t = /* @__PURE__ */ new Map(), n = un(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), d = ye(), g = /* @__PURE__ */ new Set();
2828
2850
  let f = 0, u = 0;
2829
- const p = { direct: null, bulk: null }, m = /* @__PURE__ */ new Set();
2830
- let x = !1, O = 0;
2831
- const y = () => {
2832
- O += 1, d.emit();
2833
- }, T = (v) => o.get(v) ?? 0, S = (v) => {
2834
- let E = i.get(v);
2835
- return E === void 0 && (E = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, i.set(v, E)), E;
2836
- }, M = (v, E, C) => {
2837
- v.inFlight.delete(E), f -= 1, C.lane === "bulk" && (u -= 1);
2851
+ const h = { direct: null, bulk: null }, m = /* @__PURE__ */ new Set();
2852
+ let S = !1, A = 0;
2853
+ const x = () => {
2854
+ A += 1, d.emit();
2855
+ }, T = (v) => o.get(v) ?? 0, M = (v) => {
2856
+ let b = i.get(v);
2857
+ return b === void 0 && (b = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, i.set(v, b)), b;
2858
+ }, C = (v, b, y) => {
2859
+ v.inFlight.delete(b), f -= 1, y.lane === "bulk" && (u -= 1);
2838
2860
  }, s = (v) => {
2839
- const E = i.get(v);
2840
- if (E !== void 0) {
2841
- for (const [C, A] of [...E.inFlight])
2842
- M(E, C, A), A.controller.abort();
2843
- E.direct.clear(), E.bulk.clear(), E.unclaimed.clear();
2861
+ const b = i.get(v);
2862
+ if (b !== void 0) {
2863
+ for (const [y, R] of [...b.inFlight])
2864
+ C(b, y, R), R.controller.abort();
2865
+ b.direct.clear(), b.bulk.clear(), b.unclaimed.clear();
2844
2866
  }
2845
2867
  }, c = (v) => {
2846
- const E = T(v) + 1;
2847
- return o.set(v, E), s(v), E;
2848
- }, h = (v, E) => {
2849
- const C = Se(v), A = { promise: v, opened: E, stale: !1, loadedAt: C?.status === "ok" ? C.loadedAt : null };
2850
- return v.status === "pending" && v.then((_) => {
2851
- _.status === "ok" && (A.loadedAt = _.loadedAt);
2852
- }), A;
2868
+ const b = T(v) + 1;
2869
+ return o.set(v, b), s(v), b;
2870
+ }, p = (v, b) => {
2871
+ const y = Se(v), R = { promise: v, opened: b, stale: !1, loadedAt: y?.status === "ok" ? y.loadedAt : null };
2872
+ return v.status === "pending" && v.then(($) => {
2873
+ $.status === "ok" && (R.loadedAt = $.loadedAt);
2874
+ }), R;
2853
2875
  }, w = (v) => {
2854
- let E = r.get(v);
2855
- return E === void 0 && (E = /* @__PURE__ */ new Map(), r.set(v, E)), E;
2876
+ let b = r.get(v);
2877
+ return b === void 0 && (b = /* @__PURE__ */ new Map(), r.set(v, b)), b;
2856
2878
  }, k = (v) => {
2857
- const E = [...i.keys()], C = p[v], A = C === null ? 0 : E.indexOf(C) + 1;
2858
- for (let _ = 0; _ < E.length; _ += 1) {
2859
- const j = E[(A + _) % E.length], Z = j === void 0 ? void 0 : i.get(j);
2860
- if (!(j === void 0 || Z === void 0)) {
2861
- for (const H of Z[v])
2862
- if ((Z.claims.get(H) ?? 0) !== 0)
2863
- return Z[v].delete(H), p[v] = j, { sourceId: j, path: H };
2879
+ const b = [...i.keys()], y = h[v], R = y === null ? 0 : b.indexOf(y) + 1;
2880
+ for (let $ = 0; $ < b.length; $ += 1) {
2881
+ const B = b[(R + $) % b.length], Z = B === void 0 ? void 0 : i.get(B);
2882
+ if (!(B === void 0 || Z === void 0)) {
2883
+ for (const j of Z[v])
2884
+ if ((Z.claims.get(j) ?? 0) !== 0)
2885
+ return Z[v].delete(j), h[v] = B, { sourceId: B, path: j };
2864
2886
  }
2865
2887
  }
2866
2888
  return null;
2867
- }, L = (v, E, C, A) => {
2868
- const _ = i.get(v);
2869
- if (_ === void 0 || _.inFlight.get(E) !== C) return;
2870
- M(_, E, C);
2871
- const j = (_.claims.get(E) ?? 0) > 0, Z = w(v);
2872
- if (A.status === "ok" ? Z.set(E, { status: "loaded", entries: A.entries }) : A.status === "error" && j ? Z.set(E, { status: "failed", failure: A.failure }) : Z.delete(E), y(), A.status === "error" && j) {
2873
- const H = { sourceId: v, path: E, failure: A.failure };
2874
- for (const le of [...g]) le(H);
2889
+ }, L = (v, b, y, R) => {
2890
+ const $ = i.get(v);
2891
+ if ($ === void 0 || $.inFlight.get(b) !== y) return;
2892
+ C($, b, y);
2893
+ const B = ($.claims.get(b) ?? 0) > 0, Z = w(v);
2894
+ if (R.status === "ok" ? Z.set(b, { status: "loaded", entries: R.entries }) : R.status === "error" && B ? Z.set(b, { status: "failed", failure: R.failure }) : Z.delete(b), x(), R.status === "error" && B) {
2895
+ const j = { sourceId: v, path: b, failure: R.failure };
2896
+ for (const le of [...g]) le(j);
2875
2897
  }
2876
2898
  N();
2877
- }, R = (v, E, C) => {
2878
- const A = { controller: new AbortController(), lane: C };
2879
- S(v).inFlight.set(E, A), f += 1, C === "bulk" && (u += 1), e.children(v, E, A.controller.signal).then(
2880
- (_) => L(v, E, A, _),
2881
- () => L(v, E, A, Si)
2899
+ }, O = (v, b, y) => {
2900
+ const R = { controller: new AbortController(), lane: y };
2901
+ M(v).inFlight.set(b, R), f += 1, y === "bulk" && (u += 1), e.children(v, b, R.controller.signal).then(
2902
+ ($) => L(v, b, R, $),
2903
+ () => L(v, b, R, Si)
2882
2904
  );
2883
2905
  }, N = () => {
2884
- for (; f < Tn; ) {
2906
+ for (; f < Rn; ) {
2885
2907
  const v = k("direct");
2886
2908
  if (v !== null) {
2887
- R(v.sourceId, v.path, "direct");
2909
+ O(v.sourceId, v.path, "direct");
2888
2910
  continue;
2889
2911
  }
2890
- const E = u < ki ? k("bulk") : null;
2891
- if (E === null) return;
2892
- R(E.sourceId, E.path, "bulk");
2912
+ const b = u < ki ? k("bulk") : null;
2913
+ if (b === null) return;
2914
+ O(b.sourceId, b.path, "bulk");
2893
2915
  }
2894
- }, q = (v, E, C) => {
2895
- if (!(E.direct.delete(C) || E.bulk.delete(C))) {
2896
- const _ = E.inFlight.get(C);
2897
- if (_ === void 0) return !1;
2898
- M(E, C, _), _.controller.abort();
2916
+ }, q = (v, b, y) => {
2917
+ if (!(b.direct.delete(y) || b.bulk.delete(y))) {
2918
+ const $ = b.inFlight.get(y);
2919
+ if ($ === void 0) return !1;
2920
+ C(b, y, $), $.controller.abort();
2899
2921
  }
2900
- return r.get(v)?.delete(C), !0;
2901
- }, W = () => {
2902
- x = !1;
2922
+ return r.get(v)?.delete(y), !0;
2923
+ }, G = () => {
2924
+ S = !1;
2903
2925
  let v = !1;
2904
- for (const E of m) {
2905
- const C = S(E);
2906
- for (const A of C.unclaimed)
2907
- (C.claims.get(A) ?? 0) === 0 && q(E, C, A) && (v = !0);
2908
- C.unclaimed.clear();
2926
+ for (const b of m) {
2927
+ const y = M(b);
2928
+ for (const R of y.unclaimed)
2929
+ (y.claims.get(R) ?? 0) === 0 && q(b, y, R) && (v = !0);
2930
+ y.unclaimed.clear();
2909
2931
  }
2910
- m.clear(), v && (y(), N());
2911
- }, J = (v, E) => {
2912
- t.set(v, h(be(e.tree(v)), E));
2913
- }, ee = (v, E, C) => {
2932
+ m.clear(), v && (x(), N());
2933
+ }, W = (v, b) => {
2934
+ t.set(v, p(be(e.tree(v)), b));
2935
+ }, Q = (v, b, y) => {
2914
2936
  c(v);
2915
- const A = h(mn(E), C);
2916
- return t.set(v, A), r.delete(v), y(), N(), A;
2917
- }, X = (v, E, C, A) => {
2918
- if (C !== T(v) || t.get(v) !== E) return;
2919
- const _ = Se(E.promise);
2920
- if (!(A.status !== "ok" || _?.status !== "ok" || E.loadedAt === null || A.loadedAt <= E.loadedAt)) {
2921
- if (Me(_.entries, A.entries)) {
2922
- E.loadedAt = A.loadedAt;
2937
+ const R = p(fn(b), y);
2938
+ return t.set(v, R), r.delete(v), x(), N(), R;
2939
+ }, K = (v, b, y, R) => {
2940
+ if (y !== T(v) || t.get(v) !== b) return;
2941
+ const $ = Se(b.promise);
2942
+ if (!(R.status !== "ok" || $?.status !== "ok" || b.loadedAt === null || R.loadedAt <= b.loadedAt)) {
2943
+ if (Me($.entries, R.entries)) {
2944
+ b.loadedAt = R.loadedAt;
2923
2945
  return;
2924
2946
  }
2925
- ee(v, A, E.opened);
2947
+ Q(v, R, b.opened);
2926
2948
  }
2927
- }, $ = (v, E) => {
2928
- const C = t.get(v);
2929
- return C !== void 0 && Se(C.promise)?.status === E;
2930
- }, G = (v, E) => {
2931
- E.stale = !1;
2932
- const C = T(v);
2933
- e.tree(v).then((A) => X(v, E, C, A));
2949
+ }, Y = (v, b) => {
2950
+ const y = t.get(v);
2951
+ return y !== void 0 && Se(y.promise)?.status === b;
2952
+ }, oe = (v, b) => {
2953
+ b.stale = !1;
2954
+ const y = T(v);
2955
+ e.tree(v).then((R) => K(v, b, y, R));
2934
2956
  };
2935
2957
  return {
2936
2958
  read: (v) => t.get(v)?.promise ?? xi,
2937
2959
  open: (v) => {
2938
- const E = n.resumes(v), C = n.hold(v), A = t.get(v);
2939
- return A === void 0 || $(v, "deferred") ? (J(v, !0), y()) : E || (A.opened && $(v, "error") ? (J(v, !0), y()) : (A.opened = !0, A.stale && $(v, "ok") && G(v, A))), C;
2960
+ const b = n.resumes(v), y = n.hold(v), R = t.get(v);
2961
+ return R === void 0 || Y(v, "deferred") ? (W(v, !0), x()) : b || (R.opened && Y(v, "error") ? (W(v, !0), x()) : (R.opened = !0, R.stale && Y(v, "ok") && oe(v, R))), y;
2940
2962
  },
2941
2963
  retry: (v) => {
2942
- $(v, "error") && (J(v, !0), y());
2964
+ Y(v, "error") && (W(v, !0), x());
2943
2965
  },
2944
- seed: (v, E) => {
2945
- const C = E.then(
2946
- (j) => j === null ? et : j,
2966
+ seed: (v, b) => {
2967
+ const y = b.then(
2968
+ (B) => B === null ? et : B,
2947
2969
  () => et
2948
- ), A = t.get(v);
2949
- if (A !== void 0 && $(v, "ok")) {
2950
- const j = T(v);
2951
- C.then((Z) => X(v, A, j, Z));
2970
+ ), R = t.get(v);
2971
+ if (R !== void 0 && Y(v, "ok")) {
2972
+ const B = T(v);
2973
+ y.then((Z) => K(v, R, B, Z));
2952
2974
  return;
2953
2975
  }
2954
2976
  c(v);
2955
- const _ = h(be(C), A?.opened === !0);
2956
- t.set(v, _), r.delete(v), N(), C.then((j) => {
2957
- t.get(v) === _ && (j.status === "deferred" && n.isHeld(v) && J(v, _.opened), y());
2977
+ const $ = p(be(y), R?.opened === !0);
2978
+ t.set(v, $), r.delete(v), N(), y.then((B) => {
2979
+ t.get(v) === $ && (B.status === "deferred" && n.isHeld(v) && W(v, $.opened), x());
2958
2980
  });
2959
2981
  },
2960
2982
  refresh: async (v) => {
2961
- const E = (l.get(v) ?? 0) + 1;
2962
- l.set(v, E);
2963
- const C = await e.refresh(v);
2964
- if (l.get(v) !== E) return yi;
2965
- if (C.status === "error") return { status: "failed", failure: C.failure };
2966
- const A = t.get(v);
2967
- if (!(A !== void 0 && A.loadedAt !== null && $(v, "ok") && A.loadedAt > C.loadedAt)) {
2968
- const j = ee(v, C, !0);
2969
- if (A !== void 0 && A.promise.status === "pending") {
2983
+ const b = (l.get(v) ?? 0) + 1;
2984
+ l.set(v, b);
2985
+ const y = await e.refresh(v);
2986
+ if (l.get(v) !== b) return yi;
2987
+ if (y.status === "error") return { status: "failed", failure: y.failure };
2988
+ const R = t.get(v);
2989
+ if (!(R !== void 0 && R.loadedAt !== null && Y(v, "ok") && R.loadedAt > y.loadedAt)) {
2990
+ const B = Q(v, y, !0);
2991
+ if (R !== void 0 && R.promise.status === "pending") {
2970
2992
  const Z = T(v);
2971
- A.promise.then((H) => X(v, j, Z, H));
2993
+ R.promise.then((j) => K(v, B, Z, j));
2972
2994
  }
2973
2995
  }
2974
- for (const [j, Z] of t)
2975
- j !== v && Se(Z.promise)?.status === "ok" && (Z.stale = !0);
2996
+ for (const [B, Z] of t)
2997
+ B !== v && Se(Z.promise)?.status === "ok" && (Z.stale = !0);
2976
2998
  return Ei;
2977
2999
  },
2978
- children: (v, E) => r.get(v)?.get(E),
2979
- claimChildren: (v, E) => {
2980
- const C = S(v), A = w(v);
2981
- let _ = !1, j = !1;
2982
- for (const [H, le] of E)
2983
- C.claims.set(H, (C.claims.get(H) ?? 0) + 1), A.get(H) === void 0 ? (A.set(H, It), C[le].add(H), _ = !0, j = !0) : le === "direct" && C.bulk.delete(H) && (C.direct.add(H), j = !0);
2984
- _ && y(), j && N();
3000
+ children: (v, b) => r.get(v)?.get(b),
3001
+ claimChildren: (v, b) => {
3002
+ const y = M(v), R = w(v);
3003
+ let $ = !1, B = !1;
3004
+ for (const [j, le] of b)
3005
+ y.claims.set(j, (y.claims.get(j) ?? 0) + 1), R.get(j) === void 0 ? (R.set(j, Bt), y[le].add(j), $ = !0, B = !0) : le === "direct" && y.bulk.delete(j) && (y.direct.add(j), B = !0);
3006
+ $ && x(), B && N();
2985
3007
  let Z = !1;
2986
3008
  return () => {
2987
3009
  if (!Z) {
2988
3010
  Z = !0;
2989
- for (const H of E.keys()) {
2990
- const le = (C.claims.get(H) ?? 0) - 1;
2991
- le > 0 ? C.claims.set(H, le) : (C.claims.delete(H), C.unclaimed.add(H));
3011
+ for (const j of b.keys()) {
3012
+ const le = (y.claims.get(j) ?? 0) - 1;
3013
+ le > 0 ? y.claims.set(j, le) : (y.claims.delete(j), y.unclaimed.add(j));
2992
3014
  }
2993
- m.add(v), !x && (x = !0, queueMicrotask(W));
3015
+ m.add(v), !S && (S = !0, queueMicrotask(G));
2994
3016
  }
2995
3017
  };
2996
3018
  },
2997
- retryChildren: (v, E) => {
2998
- const C = r.get(v);
2999
- if (C === void 0 || C.get(E)?.status !== "failed") return;
3000
- const A = S(v);
3001
- if ((A.claims.get(E) ?? 0) > 0) {
3002
- C.set(E, It), A.direct.add(E), y(), N();
3019
+ retryChildren: (v, b) => {
3020
+ const y = r.get(v);
3021
+ if (y === void 0 || y.get(b)?.status !== "failed") return;
3022
+ const R = M(v);
3023
+ if ((R.claims.get(b) ?? 0) > 0) {
3024
+ y.set(b, Bt), R.direct.add(b), x(), N();
3003
3025
  return;
3004
3026
  }
3005
- C.delete(E), y();
3027
+ y.delete(b), x();
3006
3028
  },
3007
3029
  pendingChildren: (v) => {
3008
- const E = i.get(v);
3009
- return E === void 0 ? 0 : E.direct.size + E.bulk.size + E.inFlight.size;
3030
+ const b = i.get(v);
3031
+ return b === void 0 ? 0 : b.direct.size + b.bulk.size + b.inFlight.size;
3010
3032
  },
3011
3033
  clear: () => {
3012
3034
  for (const v of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...i.keys()])) c(v);
3013
- for (const [v, E] of l) l.set(v, E + 1);
3014
- t.clear(), r.clear(), y();
3035
+ for (const [v, b] of l) l.set(v, b + 1);
3036
+ t.clear(), r.clear(), x();
3015
3037
  },
3016
3038
  subscribeChildrenFailures: (v) => (g.add(v), () => {
3017
3039
  g.delete(v);
3018
3040
  }),
3019
3041
  subscribe: d.subscribe,
3020
- version: () => O
3042
+ version: () => A
3021
3043
  };
3022
3044
  }, Ti = (e, t) => {
3023
3045
  let n = e;
@@ -3041,18 +3063,18 @@ const Oi = () => {
3041
3063
  }, Ai = [
3042
3064
  { selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
3043
3065
  { selector: "[data-aqmx-explorer-body]", name: "tree area" }
3044
- ], jt = 1, Ht = (e) => e.getClientRects().length > 0, Ke = "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.", Li = (e) => {
3045
- if (!Ht(e)) return null;
3066
+ ], It = 1, jt = (e) => e.getClientRects().length > 0, Ke = "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.", Li = (e) => {
3067
+ if (!jt(e)) return null;
3046
3068
  const t = e.getBoundingClientRect(), n = window.innerHeight;
3047
3069
  if (t.bottom > n + Ci)
3048
3070
  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. ${Ke}`;
3049
- if (t.height < jt)
3071
+ if (t.height < It)
3050
3072
  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. ${Ke}`;
3051
3073
  for (const { selector: r, name: o } of Ai)
3052
3074
  for (const l of e.querySelectorAll(r)) {
3053
- if (!Ht(l)) continue;
3075
+ if (!jt(l)) continue;
3054
3076
  const i = l.getBoundingClientRect().height;
3055
- if (i < jt)
3077
+ if (i < It)
3056
3078
  return `[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(i))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Ke}`;
3057
3079
  }
3058
3080
  return null;
@@ -3067,13 +3089,13 @@ const Oi = () => {
3067
3089
  r?.disconnect(), window.removeEventListener("resize", n);
3068
3090
  };
3069
3091
  }, Ni = (e, t) => {
3070
- ne(() => e ? Oi() : void 0, [e]), ne(() => {
3092
+ te(() => e ? Oi() : void 0, [e]), te(() => {
3071
3093
  const n = t.current;
3072
3094
  if (!(!e || n === null))
3073
3095
  return Mi(n);
3074
3096
  }, [e, t]);
3075
- }, zt = '[data-testid="markdown-explorer-view-switch"]', Di = [
3076
- { control: zt, successors: [zt, '[data-testid="markdown-explorer-sheet-toggle"]'] },
3097
+ }, Ht = '[data-testid="markdown-explorer-view-switch"]', Di = [
3098
+ { control: Ht, successors: [Ht, '[data-testid="markdown-explorer-sheet-toggle"]'] },
3077
3099
  { control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
3078
3100
  ], $i = (e) => {
3079
3101
  for (const t of Di) {
@@ -3082,8 +3104,8 @@ const Oi = () => {
3082
3104
  }
3083
3105
  return null;
3084
3106
  }, Pi = (e, t) => {
3085
- const n = B(null);
3086
- ne(() => {
3107
+ const n = _(null);
3108
+ te(() => {
3087
3109
  const o = (d) => {
3088
3110
  const g = e.current;
3089
3111
  n.current = g !== null && d instanceof Element && g.contains(d) ? $i(d) : null;
@@ -3099,8 +3121,8 @@ const Oi = () => {
3099
3121
  document.removeEventListener("focusin", l), document.removeEventListener("focusout", i);
3100
3122
  };
3101
3123
  }, [e]);
3102
- const r = B(t);
3103
- V(() => {
3124
+ const r = _(t);
3125
+ U(() => {
3104
3126
  if (r.current === t) return;
3105
3127
  r.current = t;
3106
3128
  const o = n.current;
@@ -3111,8 +3133,8 @@ const Oi = () => {
3111
3133
  const f = e.current;
3112
3134
  if (f === null) return !0;
3113
3135
  for (const u of o.control.successors)
3114
- for (const p of f.querySelectorAll(u))
3115
- if (p !== o.element && (p.focus({ preventScroll: !0 }), document.activeElement === p))
3136
+ for (const h of f.querySelectorAll(u))
3137
+ if (h !== o.element && (h.focus({ preventScroll: !0 }), document.activeElement === h))
3116
3138
  return !0;
3117
3139
  return !1;
3118
3140
  };
@@ -3124,175 +3146,213 @@ const Oi = () => {
3124
3146
  });
3125
3147
  return d.observe(i, { childList: !0, subtree: !0 }), () => d.disconnect();
3126
3148
  }, [t, e]);
3127
- }, Fi = tt(() => import("./TreeLayout-8pRo1ANN.js").then((e) => ({ default: e.TreeLayout }))), qi = tt(() => import("./MultiLayout-Jy9BKofx.js").then((e) => ({ default: e.MultiLayout }))), _i = 64, Bi = {
3149
+ }, Fi = tt(() => import("./TreeLayout-CJO9tOPq.js").then((e) => ({ default: e.TreeLayout }))), qi = tt(() => import("./MultiLayout-DtSW4rEQ.js").then((e) => ({ default: e.MultiLayout }))), _i = 64, Bi = {
3128
3150
  request: (e) => {
3129
3151
  requestAnimationFrame(e);
3130
3152
  }
3131
- }, Ut = (e) => {
3153
+ }, zt = (e) => {
3132
3154
  e.documents.clear(), e.trees.clear();
3133
3155
  }, We = (e, t) => {
3134
3156
  t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
3135
3157
  for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
3136
3158
  }, Ii = (e, t) => {
3137
3159
  const [n, r] = I(() => ({ overrides: t, locale: e, labels: Et(e, t) }));
3138
- if (n.locale === e && wr(n.overrides, t)) return n.labels;
3160
+ if (n.locale === e && vr(n.overrides, t)) return n.labels;
3139
3161
  const o = { overrides: t, locale: e, labels: Et(e, t) };
3140
3162
  return r(o), o.labels;
3141
3163
  }, ji = (e, t, n) => {
3142
- const [r, o] = I(() => ({ scope: t, store: Bt(e, n) }));
3164
+ const [r, o] = I(() => ({ scope: t, store: _t(e, n) }));
3143
3165
  if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
3144
- const l = { scope: t, store: Bt(e, n) };
3166
+ const l = { scope: t, store: _t(e, n) };
3145
3167
  return o(l), l.store;
3146
3168
  }, Xe = (e, t) => {
3147
3169
  const [n, r] = I(() => ({ scope: e, value: t() }));
3148
3170
  if (n.scope === e) return n.value;
3149
3171
  const o = { scope: e, value: t() };
3150
3172
  return r(o), o.value;
3151
- }, Hi = () => pi(Bi), Zt = "on", zi = "off", Ui = (e, t) => {
3173
+ }, Hi = () => pi(Bi), Ut = "on", zi = "off", Ui = Object.freeze({ kind: "unavailable" }), Zi = (e) => {
3174
+ if (e !== void 0 && (e === null || typeof e != "object" || typeof e.convert != "function"))
3175
+ throw new TypeError("[markdown-explorer] draftConverter must be an object with a convert function");
3176
+ }, Vi = (e, t) => {
3152
3177
  const n = de(e.peek(t));
3153
3178
  return n === null || n.document.kind === "failure" ? Ee(t) : n.document.name;
3154
- }, os = ({ data: e, config: t, storageNamespace: n, locale: r, labels: o, theme: l, renderFrame: i, renderTreeFailure: d, lockDocumentScroll: g = !1, onMathDiagnostics: f, onEditGrant: u }) => {
3155
- cr(n);
3156
- const p = tn(r), m = br(l), x = Ii(p, o), { revalidate: O } = Dn(), y = B(() => {
3157
- }), T = De(t.dataPath), [S] = I(() => {
3158
- const $ = vi({ dataPath: T, onScope: (v) => y.current(v) }), G = { documents: lo({ client: $, capacity: Math.max(_i, t.multiView.maxPanels * 2) }), trees: Ri($) };
3159
- return We(G, e), wt(n, e.scope), { data: $, ...G, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
3179
+ }, is = ({
3180
+ data: e,
3181
+ config: t,
3182
+ storageNamespace: n,
3183
+ locale: r,
3184
+ labels: o,
3185
+ theme: l,
3186
+ renderFrame: i,
3187
+ renderTreeFailure: d,
3188
+ lockDocumentScroll: g = !1,
3189
+ onMathDiagnostics: f,
3190
+ onEditGrant: u,
3191
+ draftConverter: h
3192
+ }) => {
3193
+ ar(n), Zi(h);
3194
+ const m = en(r), S = wr(l), A = Ii(m, o), { revalidate: x } = Nn(), T = _(() => {
3195
+ }), M = De(t.dataPath), [C] = I(() => {
3196
+ const y = vi({ dataPath: M, onScope: ($) => T.current($) }), R = { documents: lo({ client: y, capacity: Math.max(_i, t.multiView.maxPanels * 2) }), trees: Ri(y) };
3197
+ return We(R, e), wt(n, e.scope), { data: y, ...R, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
3160
3198
  });
3161
- if (S.aligned.pageData !== e || S.aligned.storageNamespace !== n) {
3162
- const $ = S.aligned.pageData;
3163
- S.aligned.pageData = e, S.aligned.storageNamespace = n, $ !== e && ($.scope !== e.scope ? S.aligned.pendingReader = e : We(S, e)), wt(n, e.scope);
3199
+ if (C.aligned.pageData !== e || C.aligned.storageNamespace !== n) {
3200
+ const y = C.aligned.pageData;
3201
+ C.aligned.pageData = e, C.aligned.storageNamespace = n, y !== e && (y.scope !== e.scope ? C.aligned.pendingReader = e : We(C, e)), wt(n, e.scope);
3164
3202
  }
3165
- const M = ji(ze(n).treeSettings, e.scope, t.defaultTreeSettings);
3166
- V(() => {
3167
- const $ = S.aligned.pendingReader;
3168
- $ !== null && (S.aligned.pendingReader = null, Ut(S), We(S, $));
3169
- }, [e, S]), V(() => {
3170
- let $ = !1;
3171
- return y.current = (G) => {
3172
- G === e.scope || $ || ($ = !0, G !== null && (Ut(S), dr(n)), O());
3203
+ const s = ji(ze(n).treeSettings, e.scope, t.defaultTreeSettings);
3204
+ U(() => {
3205
+ const y = C.aligned.pendingReader;
3206
+ y !== null && (C.aligned.pendingReader = null, zt(C), We(C, y));
3207
+ }, [e, C]), U(() => {
3208
+ let y = !1;
3209
+ return T.current = (R) => {
3210
+ R === e.scope || y || (y = !0, R !== null && (zt(C), cr(n)), x());
3173
3211
  }, () => {
3174
- y.current = () => {
3212
+ T.current = () => {
3175
3213
  };
3176
3214
  };
3177
- }, [e, O, S, n]);
3178
- const s = B(t.settingsCookie);
3179
- V(() => {
3180
- s.current = t.settingsCookie;
3215
+ }, [e, x, C, n]);
3216
+ const c = _(t.settingsCookie);
3217
+ U(() => {
3218
+ c.current = t.settingsCookie;
3181
3219
  }, [t.settingsCookie]);
3182
- const [c] = I(
3183
- () => Ti(e.settings, ($) => {
3184
- document.cookie = jn(s.current, $, window.location.protocol === "https:");
3220
+ const [p] = I(
3221
+ () => Ti(e.settings, (y) => {
3222
+ document.cookie = In(c.current, y, window.location.protocol === "https:");
3185
3223
  })
3186
- ), h = Xe(e.scope, Hi), w = Xe(e.scope, wi), k = B(x);
3187
- V(() => {
3188
- k.current = x;
3189
- }, [x]);
3190
- const L = Xe(
3224
+ ), w = Xe(e.scope, Hi), k = Xe(e.scope, wi), L = _(A);
3225
+ U(() => {
3226
+ L.current = A;
3227
+ }, [A]);
3228
+ const O = Xe(
3191
3229
  e.scope,
3192
- () => Or({
3193
- data: S.data,
3194
- conflictLabels: () => ({ ours: k.current.conflictOurs, theirs: k.current.conflictTheirs }),
3195
- onSaveSettled: ($, G) => {
3196
- G.kind === "saved" && S.documents.refresh($);
3197
- const v = yr(k.current, G, Ui(S.documents, $));
3198
- v !== null && h.announce(v);
3230
+ () => Cr({
3231
+ data: C.data,
3232
+ conflictLabels: () => ({ ours: L.current.conflictOurs, theirs: L.current.conflictTheirs }),
3233
+ onSaveSettled: (y, R) => {
3234
+ R.kind === "saved" && C.documents.refresh(y);
3235
+ const $ = Er(L.current, R, Vi(C.documents, y));
3236
+ $ !== null && w.announce($);
3199
3237
  },
3200
3238
  previewSetting: {
3201
- read: () => Jt(ze(n).editPreview) === Zt,
3202
- write: ($) => Yt(ze(n).editPreview, $ ? Zt : zi)
3239
+ read: () => Yt(ze(n).editPreview) === Ut,
3240
+ write: (y) => Xt(ze(n).editPreview, y ? Ut : zi)
3203
3241
  }
3204
3242
  })
3205
- ), R = U(() => be(e.notices.catch(() => [])), [e.notices]), N = e.sources.map(($) => $.id).join(`
3206
- `), q = U(() => In(t, N.split(`
3207
- `)), [t, N]), W = B(f);
3208
- V(() => {
3243
+ ), N = z(() => be(e.notices.catch(() => [])), [e.notices]), q = e.sources.map((y) => y.id).join(`
3244
+ `), G = z(() => Bn(t, q.split(`
3245
+ `)), [t, q]), W = _(f);
3246
+ U(() => {
3209
3247
  W.current = f;
3210
3248
  }, [f]);
3211
- const [J] = I(() => ($, G) => {
3212
- W.current?.($, G);
3213
- }), ee = f === void 0 ? void 0 : J, X = U(
3249
+ const [Q] = I(() => (y, R) => {
3250
+ W.current?.(y, R);
3251
+ }), K = f === void 0 ? void 0 : Q, Y = _(h);
3252
+ U(() => {
3253
+ Y.current = h;
3254
+ }, [h]);
3255
+ const [oe] = I(() => {
3256
+ let y = !1;
3257
+ return {
3258
+ convert: (R, $) => {
3259
+ const B = Y.current;
3260
+ return B === void 0 ? Promise.resolve(Ui) : B.convert(R, $);
3261
+ },
3262
+ prepare: () => {
3263
+ try {
3264
+ Y.current?.prepare?.();
3265
+ } catch (R) {
3266
+ if (y) return;
3267
+ y = !0, console.error("[markdown-explorer] the draft converter's prepare threw", R);
3268
+ }
3269
+ }
3270
+ };
3271
+ }), v = h === void 0 ? void 0 : oe, b = z(
3214
3272
  () => ({
3215
- config: q,
3216
- labels: x,
3217
- locale: p,
3218
- theme: m,
3273
+ config: G,
3274
+ labels: A,
3275
+ locale: m,
3276
+ theme: S,
3219
3277
  storageNamespace: n,
3220
3278
  scope: e.scope,
3221
3279
  sources: e.sources,
3222
- notices: R,
3223
- documents: S.documents,
3224
- trees: S.trees,
3225
- data: S.data,
3226
- viewSettings: c,
3227
- treeSettings: M,
3228
- announcer: h,
3229
- reveals: w,
3230
- edits: L,
3280
+ notices: N,
3281
+ documents: C.documents,
3282
+ trees: C.trees,
3283
+ data: C.data,
3284
+ viewSettings: p,
3285
+ treeSettings: s,
3286
+ announcer: w,
3287
+ reveals: k,
3288
+ edits: O,
3231
3289
  onEditGrant: u,
3290
+ draftConverter: v,
3232
3291
  renderTreeFailure: d,
3233
- reportMathDiagnostics: ee
3292
+ reportMathDiagnostics: K
3234
3293
  }),
3235
- [q, x, p, m, n, e.scope, e.sources, R, S, c, M, h, w, L, u, d, ee]
3294
+ [G, A, m, S, n, e.scope, e.sources, N, C, p, s, w, k, O, u, v, d, K]
3236
3295
  );
3237
- return /* @__PURE__ */ a(nn, { value: X, children: /* @__PURE__ */ a(Vi, { renderFrame: i, lockDocumentScroll: g }, e.scope) });
3238
- }, Zi = ({ ref: e, theme: t, view: n, children: r }) => {
3296
+ return /* @__PURE__ */ a(tn, { value: b, children: /* @__PURE__ */ a(Ki, { renderFrame: i, lockDocumentScroll: g }, e.scope) });
3297
+ }, Gi = ({ ref: e, theme: t, view: n, children: r }) => {
3239
3298
  const [o] = I(Uo);
3240
3299
  return /* @__PURE__ */ a("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 });
3241
- }, Vi = ({ renderFrame: e, lockDocumentScroll: t }) => {
3242
- const { theme: n, labels: r } = D(), o = nt(), { hash: l } = Gt(), i = $e(), d = B(null);
3243
- Ni(t, d), V(() => {
3300
+ }, Ki = ({ renderFrame: e, lockDocumentScroll: t }) => {
3301
+ const { theme: n, labels: r } = D(), o = nt(), { hash: l } = Vt(), i = $e(), d = _(null);
3302
+ Ni(t, d), U(() => {
3244
3303
  o.kind === "redirect" && i(`${o.href}${l}`, "browse");
3245
3304
  }, [o, l, i]);
3246
3305
  const { location: g } = o, f = g.view;
3247
3306
  Pi(d, f);
3248
- const u = g.view === "tree" ? /* @__PURE__ */ a(ge, { fallback: /* @__PURE__ */ a("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading" }), children: /* @__PURE__ */ a(Fi, { location: g }) }) : g.view === "multi" ? /* @__PURE__ */ a(ge, { fallback: /* @__PURE__ */ a("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading" }), children: /* @__PURE__ */ a(qi, { location: g }) }) : /* @__PURE__ */ a(mi, { location: g }), p = /* @__PURE__ */ F(Zi, { ref: d, theme: n, view: f, children: [
3307
+ const u = g.view === "tree" ? /* @__PURE__ */ a(ge, { fallback: /* @__PURE__ */ a("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading" }), children: /* @__PURE__ */ a(Fi, { location: g }) }) : g.view === "multi" ? /* @__PURE__ */ a(ge, { fallback: /* @__PURE__ */ a("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading" }), children: /* @__PURE__ */ a(qi, { location: g }) }) : /* @__PURE__ */ a(mi, { location: g }), h = /* @__PURE__ */ F(Gi, { ref: d, theme: n, view: f, children: [
3249
3308
  u,
3250
- /* @__PURE__ */ a($r, {}),
3309
+ /* @__PURE__ */ a(Dr, {}),
3251
3310
  /* @__PURE__ */ a(hi, { holds: !0, testId: "markdown-explorer-announcer" })
3252
3311
  ] });
3253
- return e === void 0 ? p : e({ view: f, children: p });
3254
- }, ls = ({ currentUrl: e, nextUrl: t, formMethod: n, defaultShouldRevalidate: r }) => n === void 0 && e.href === t.href && r;
3312
+ return e === void 0 ? h : e({ view: f, children: h });
3313
+ }, ss = ({ currentUrl: e, nextUrl: t, formMethod: n, defaultShouldRevalidate: r }) => n === void 0 && e.href === t.href && r;
3255
3314
  export {
3256
3315
  Qe as A,
3257
- yt as B,
3258
- xr as C,
3316
+ dr as B,
3317
+ yr as C,
3259
3318
  fi as D,
3260
3319
  Ql as E,
3261
3320
  ve as F,
3262
- en as G,
3263
- fr as H,
3321
+ yt as G,
3322
+ Qt as H,
3264
3323
  Go as I,
3265
- bt as J,
3266
- os as K,
3324
+ ur as J,
3325
+ bt as K,
3267
3326
  ro as L,
3268
- pr as M,
3269
- Et as N,
3270
- ls as O,
3327
+ hr as M,
3328
+ is as N,
3329
+ Et as O,
3271
3330
  ui as P,
3331
+ ss as Q,
3272
3332
  $e as a,
3273
3333
  ai as b,
3274
3334
  Fl as c,
3275
- kr as d,
3276
- Sr as e,
3335
+ xr as d,
3336
+ kr as e,
3277
3337
  Gr as f,
3278
- Rr as g,
3338
+ Sr as g,
3279
3339
  ae as h,
3280
3340
  Yr as i,
3281
- Nr as j,
3282
- on as k,
3283
- Jr as l,
3284
- ye as m,
3285
- rs as n,
3286
- dn as o,
3287
- ns as p,
3288
- _l as q,
3289
- eo as r,
3290
- Xl as s,
3291
- Qr as t,
3341
+ Jr as j,
3342
+ Mr as k,
3343
+ de as l,
3344
+ rn as m,
3345
+ ye as n,
3346
+ ls as o,
3347
+ os as p,
3348
+ cn as q,
3349
+ _l as r,
3350
+ eo as s,
3351
+ Xl as t,
3292
3352
  D as u,
3293
3353
  Kr as v,
3294
- nt as w,
3295
- hi as x,
3296
- Ae as y,
3297
- ur as z
3354
+ Qr as w,
3355
+ nt as x,
3356
+ hi as y,
3357
+ Ae as z
3298
3358
  };