@aiquants/markdown-explorer 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +121 -15
  2. package/README.md +47 -21
  3. package/dist/{EditSurface-DGMLY7Gh.js → EditSurface-B2bzY1b_.js} +3 -3
  4. package/dist/{EditSurface-CwKsTS11.cjs → EditSurface-BRuIjA9L.cjs} +1 -1
  5. package/dist/{ExplorerSplit-BLOaU5fE.cjs → ExplorerSplit-BE1VJuok.cjs} +1 -1
  6. package/dist/{ExplorerSplit-tUCp0XdJ.js → ExplorerSplit-qAKZsLZa.js} +3 -3
  7. package/dist/{MultiLayout-BBP2ajz8.cjs → MultiLayout-Bc6RYc3U.cjs} +1 -1
  8. package/dist/{MultiLayout-DYy66vcO.js → MultiLayout-rsmtFma5.js} +251 -247
  9. package/dist/NativeScrollBar-Dq3YeUVY.js +65 -0
  10. package/dist/NativeScrollBar-DqTkrnPZ.cjs +1 -0
  11. package/dist/{TreeLayout-CXX-rFO6.js → TreeLayout-BPa7NdeT.js} +3 -3
  12. package/dist/{TreeLayout-C8s5lBH_.cjs → TreeLayout-DXoEAcpD.cjs} +1 -1
  13. package/dist/core/geometry.d.cts +1 -1
  14. package/dist/core/geometry.d.ts +1 -1
  15. package/dist/core/labels.d.cts +11 -0
  16. package/dist/core/labels.d.ts +11 -0
  17. package/dist/{index-DTKGgaok.js → index-25s_q0vD.js} +829 -795
  18. package/dist/index-W3iAjkLb.cjs +13 -0
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/{location-G7psbmv_.js → location-B-m9scLf.js} +82 -82
  22. package/dist/{location-D85EXiPt.cjs → location-BVEN_Ihk.cjs} +1 -1
  23. package/dist/{merge-BkFru0eg.js → merge-B9jrWxMa.js} +1 -1
  24. package/dist/{merge-SRws1-Zj.cjs → merge-DuTAponF.cjs} +1 -1
  25. package/dist/server.cjs +1 -1
  26. package/dist/server.js +1 -1
  27. package/dist/styles/markdown-explorer.css +1 -1
  28. package/dist/{useSplitPersistence-DRjsPZdH.cjs → useSplitPersistence-Ba-v64n-.cjs} +1 -1
  29. package/dist/{useSplitPersistence-B1b5Lg5E.js → useSplitPersistence-Cc4tDxB4.js} +1 -1
  30. package/docs/behavior/dom-hooks.md +5 -2
  31. package/docs/behavior/layout.md +78 -33
  32. package/docs/behavior/localization.md +11 -5
  33. package/package.json +5 -5
  34. package/dist/NativeScrollBar-BkFg1EcW.cjs +0 -1
  35. package/dist/NativeScrollBar-Dazd542j.js +0 -59
  36. package/dist/index-DffJZ8-y.cjs +0 -13
@@ -1,21 +1,21 @@
1
1
  import { jsxs as F, jsx as c, Fragment as Pe } from "react/jsx-runtime";
2
2
  import * as y from "react";
3
- import { createContext as pe, use as ne, useMemo as G, useSyncExternalStore as ee, useRef as _, useLayoutEffect as H, useCallback as P, useId as Se, useEffect as te, Component as tn, Suspense as ke, lazy as it, useState as I, useEffectEvent as le } from "react";
4
- import { useParams as _n, useSearchParams as Bn, matchPath as In, useBlocker as zn, useNavigate as jn, Link as Hn, useHref as $e, useLocation as nn, useRevalidator as Vn } from "react-router";
5
- import { j as Un, g as rn, z as Zn, E as on, a as ln, B as Gn, D as gt, G as Wn, H as be, e as ye, I as Kn, J as Xn, K as wt, L as Yn, M as bt, O as Jn, w as Qn, Q as er } from "./location-G7psbmv_.js";
6
- import { F as ae, i as tr, G as nr, y as J, x as rr, H as Et, z as Ve, I as or, J as ir, K as lr, L as sr, N as ar, f as cr, O as yt, v as dr, P as ur, Q as fr, R as mr, B as hr, w as pr, S as vr, T as gr, U as wr, u as xt } from "./dataRoute-CObbjNxG.js";
7
- import { HostedScrollArea as St, useMarkdownToolbarState as br, MarkdownViewer as sn } from "@aiquants/markdown";
8
- import { SOURCE_LINES_ATTRIBUTE as an, parseSourceLines as Er } from "@aiquants/markdown/source-lines";
3
+ import { createContext as pe, use as ne, useMemo as G, useSyncExternalStore as ee, useRef as _, useLayoutEffect as H, useCallback as P, useId as Se, useEffect as te, Component as tn, Suspense as ke, lazy as it, useState as B, useEffectEvent as le } from "react";
4
+ import { useParams as _n, useSearchParams as In, matchPath as Bn, useBlocker as zn, useNavigate as jn, Link as Hn, useHref as $e, useLocation as nn, useRevalidator as Vn } from "react-router";
5
+ import { j as Un, g as rn, z as Zn, E as on, a as ln, B as Gn, D as wt, G as Wn, H as be, e as ye, I as Kn, J as Xn, K as gt, L as Yn, M as bt, O as Jn, w as Qn, Q as er } from "./location-B-m9scLf.js";
6
+ import { F as se, i as tr, G as nr, y as J, x as rr, H as Et, z as Ve, I as or, J as ir, K as lr, L as ar, N as sr, f as cr, O as yt, v as dr, P as ur, Q as fr, R as mr, B as hr, w as pr, S as vr, T as wr, U as gr, u as xt } from "./dataRoute-CObbjNxG.js";
7
+ import { HostedScrollArea as St, useMarkdownToolbarState as br, MarkdownViewer as an } from "@aiquants/markdown";
8
+ import { SOURCE_LINES_ATTRIBUTE as sn, parseSourceLines as Er } from "@aiquants/markdown/source-lines";
9
9
  import { DEFAULT_CONTENT_ALIGN as yr } from "@aiquants/markdown/viewer-settings";
10
- import { w as Je, r as Qe, a as xr, b as kt, s as ge, c as Sr } from "./storage-CmGHg7OA.js";
10
+ import { w as Je, r as Qe, a as xr, b as kt, s as we, c as Sr } from "./storage-CmGHg7OA.js";
11
11
  import { createShouldRevalidate as kr } from "@aiquants/route-revalidation";
12
- const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
12
+ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
13
13
  panelMoved: Object.freeze(["title", "column", "position"]),
14
14
  panelMoveUnavailable: Object.freeze(["title", "move"]),
15
15
  panelDragStarted: Object.freeze(["title"]),
16
16
  panelDragCancelled: Object.freeze(["title"]),
17
17
  multiColumnRegion: Object.freeze(["column"])
18
- }), Or = /\{(\w+)\}/gu, cn = {
18
+ }), Mr = /\{(\w+)\}/gu, cn = {
19
19
  explorerRegion: "Explorer",
20
20
  sourceLabel: "Source",
21
21
  refreshTreeLabel: "Refresh tree",
@@ -221,15 +221,25 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
221
221
  viewerAlignCenter: "Align center",
222
222
  viewerAlignRight: "Align right",
223
223
  viewerMermaidInteractionMode: "Mouse interaction mode",
224
+ viewerMermaidInteractionModeTouch: "Touch interaction mode",
224
225
  viewerMermaidModeNone: "No interaction",
225
226
  viewerMermaidModeZoom: "Zoom only",
226
227
  viewerMermaidModePan: "Pan only (drag)",
227
228
  viewerMermaidModePanShift: "Pan only (Shift+drag)",
228
229
  viewerMermaidModeBoth: "Zoom and pan (drag)",
229
230
  viewerMermaidModeBothShift: "Zoom and pan (Shift+drag)",
231
+ viewerMermaidModeNoneTouch: "No interaction (a finger scrolls the page)",
232
+ viewerMermaidModeZoomTouch: "Zoom only (two fingers)",
233
+ viewerMermaidModePanTouch: "Pan only (one-finger drag while the diagram overflows)",
234
+ viewerMermaidModeBothTouch: "Zoom and pan (two fingers, one finger while the diagram overflows)",
230
235
  viewerMermaidZoomIn: "Zoom In",
231
236
  viewerMermaidZoomOut: "Zoom Out",
232
237
  viewerMermaidResetView: "Reset View",
238
+ viewerMermaidPanUp: "Pan Up",
239
+ viewerMermaidPanDown: "Pan Down",
240
+ viewerMermaidPanLeft: "Pan Left",
241
+ viewerMermaidPanRight: "Pan Right",
242
+ viewerMermaidDiagram: "Diagram (arrow keys pan, + and - zoom, 0 resets)",
233
243
  viewerMermaidRetry: "Try again",
234
244
  viewerEmbeddedVideo: "embedded video",
235
245
  viewerEmbeddedPost: "embedded post",
@@ -251,6 +261,7 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
251
261
  panelSwitchToCustomDrag: "Switch to the custom drag mode",
252
262
  panelSwitchToNormalDrag: "Back to the normal drag mode",
253
263
  panelCustomDragBadge: "Custom",
264
+ panelMove: "Move the panel",
254
265
  panelMovePreviousColumn: "Move to the previous column",
255
266
  panelMoveNextColumn: "Move to the next column",
256
267
  panelMoveUp: "Move up",
@@ -265,7 +276,7 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
265
276
  multiColumnEmpty: "This column is empty",
266
277
  multiColumnRegion: "Column {column}",
267
278
  panelDropHere: "Drop the panel here"
268
- }, Cr = {
279
+ }, Or = {
269
280
  explorerRegion: "エクスプローラー",
270
281
  sourceLabel: "ソース",
271
282
  refreshTreeLabel: "ツリーを更新",
@@ -471,15 +482,25 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
471
482
  viewerAlignCenter: "中央揃え",
472
483
  viewerAlignRight: "右揃え",
473
484
  viewerMermaidInteractionMode: "マウス操作モード",
485
+ viewerMermaidInteractionModeTouch: "タッチ操作モード",
474
486
  viewerMermaidModeNone: "操作なし",
475
487
  viewerMermaidModeZoom: "拡大縮小のみ",
476
488
  viewerMermaidModePan: "移動のみ (左ドラッグ)",
477
489
  viewerMermaidModePanShift: "移動のみ (Shift+ドラッグ)",
478
- viewerMermaidModeBoth: "拡大縮小+移動 (左ドラッグ)",
479
- viewerMermaidModeBothShift: "拡大縮小+移動 (Shift+ドラッグ)",
490
+ viewerMermaidModeBoth: "拡大縮小+移動 (左ドラッグ)",
491
+ viewerMermaidModeBothShift: "拡大縮小+移動 (Shift+ドラッグ)",
492
+ viewerMermaidModeNoneTouch: "操作なし (指はページをスクロール)",
493
+ viewerMermaidModeZoomTouch: "拡大縮小のみ (2 本指)",
494
+ viewerMermaidModePanTouch: "移動のみ (はみ出す図を 1 本指でドラッグ)",
495
+ viewerMermaidModeBothTouch: "拡大縮小+移動 (2 本指・はみ出す図は 1 本指)",
480
496
  viewerMermaidZoomIn: "拡大",
481
497
  viewerMermaidZoomOut: "縮小",
482
498
  viewerMermaidResetView: "表示を元に戻す",
499
+ viewerMermaidPanUp: "上へ移動",
500
+ viewerMermaidPanDown: "下へ移動",
501
+ viewerMermaidPanLeft: "左へ移動",
502
+ viewerMermaidPanRight: "右へ移動",
503
+ viewerMermaidDiagram: "図 (矢印キーで移動、+ と - で拡大縮小、0 で元に戻す)",
483
504
  viewerMermaidRetry: "再試行",
484
505
  viewerEmbeddedVideo: "埋め込みの動画",
485
506
  viewerEmbeddedPost: "埋め込みの投稿",
@@ -501,6 +522,7 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
501
522
  panelSwitchToCustomDrag: "カスタムのドラッグの方式に切り替え",
502
523
  panelSwitchToNormalDrag: "通常のドラッグの方式に戻す",
503
524
  panelCustomDragBadge: "カスタム",
525
+ panelMove: "パネルを移動",
504
526
  panelMovePreviousColumn: "前の列へ移動",
505
527
  panelMoveNextColumn: "次の列へ移動",
506
528
  panelMoveUp: "上へ移動",
@@ -515,34 +537,34 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
515
537
  multiColumnEmpty: "この列は空です",
516
538
  multiColumnRegion: "{column} 列目",
517
539
  panelDropHere: "ここへパネルをドロップ"
518
- }, Ar = Object.freeze({
540
+ }, Cr = Object.freeze({
519
541
  en: Object.freeze(cn),
520
- ja: Object.freeze(Cr)
521
- }), dn = Object.freeze(Object.keys(cn)), Lr = new Set(dn), Mr = (e) => Lr.has(e), Ae = (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, un = (e) => {
522
- if (e === void 0) return Rr;
523
- if (Rt.includes(e)) return e;
524
- throw new RangeError(`[markdown-explorer] locale is the UI language (${Rt.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${Ae(e)}`);
525
- }, Tt = (e, t) => {
526
- const n = Ar[un(e)];
542
+ ja: Object.freeze(Or)
543
+ }), dn = Object.freeze(Object.keys(cn)), Lr = new Set(dn), Ar = (e) => Lr.has(e), Ce = (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, un = (e) => {
544
+ if (e === void 0) return Tr;
545
+ if (Tt.includes(e)) return e;
546
+ throw new RangeError(`[markdown-explorer] locale is the UI language (${Tt.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${Ce(e)}`);
547
+ }, Rt = (e, t) => {
548
+ const n = Cr[un(e)];
527
549
  if (t === void 0) return n;
528
550
  if (t === null || typeof t != "object")
529
- throw new RangeError(`[markdown-explorer] labels must be an object; got ${Ae(t)}`);
551
+ throw new RangeError(`[markdown-explorer] labels must be an object; got ${Ce(t)}`);
530
552
  if (!Un(t))
531
- throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${Ae(t)}`);
553
+ throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${Ce(t)}`);
532
554
  const r = t, o = { ...n };
533
555
  for (const i of Object.keys(r)) {
534
- if (!Mr(i))
556
+ if (!Ar(i))
535
557
  throw new RangeError(`[markdown-explorer] labels.${i} is not a known label key; expected one of ${dn.join(", ")}`);
536
558
  const l = r[i];
537
559
  if (l === void 0) continue;
538
560
  const u = typeof n[i];
539
561
  if (typeof l !== u)
540
- throw new TypeError(`[markdown-explorer] labels.${i} must be a ${u}; got ${Ae(l)}`);
562
+ throw new TypeError(`[markdown-explorer] labels.${i} must be a ${u}; got ${Ce(l)}`);
541
563
  if (typeof l == "string" && l.trim() === "")
542
564
  throw new RangeError(`[markdown-explorer] labels.${i} must be a non-blank string`);
543
- const m = Tr[i];
565
+ const m = Rr[i];
544
566
  if (typeof l == "string" && m !== void 0) {
545
- for (const [, f] of l.matchAll(Or))
567
+ for (const [, f] of l.matchAll(Mr))
546
568
  if (!m.includes(f ?? ""))
547
569
  throw new RangeError(`[markdown-explorer] labels.${i} uses the unknown placeholder {${String(f)}}; it accepts ${m.map((d) => `{${d}}`).join(", ")}`);
548
570
  }
@@ -554,19 +576,19 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
554
576
  if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
555
577
  const n = e, r = t, o = Object.keys(n), i = Object.keys(r);
556
578
  return o.length === i.length && i.every((l) => Object.hasOwn(n, l) && Object.is(n[l], r[l]));
557
- }, Ot = Object.freeze(["light", "dark"]), Dr = (e) => {
579
+ }, Mt = Object.freeze(["light", "dark"]), Dr = (e) => {
558
580
  if (e === void 0) return "light";
559
- if (Ot.includes(e)) return e;
560
- throw new RangeError(`[markdown-explorer] theme must be ${Ot.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
581
+ if (Mt.includes(e)) return e;
582
+ throw new RangeError(`[markdown-explorer] theme must be ${Mt.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
561
583
  }, fn = pe(null), D = () => {
562
584
  const e = ne(fn);
563
585
  if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
564
586
  return e;
565
- }, Me = (e) => {
587
+ }, Ae = (e) => {
566
588
  const { viewSettings: t } = D(), n = () => e(t.getSnapshot());
567
589
  return ee(t.subscribe, n, n);
568
590
  }, lt = () => {
569
- const { config: e } = D(), t = _n()["*"], [n] = Bn(), r = n.toString();
591
+ const { config: e } = D(), t = _n()["*"], [n] = In(), r = n.toString();
570
592
  return G(() => rn(e, t, new URLSearchParams(r)), [e, t, r]);
571
593
  }, mn = {
572
594
  unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
@@ -577,8 +599,8 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
577
599
  "too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
578
600
  unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
579
601
  failed: ["failureFailedTitle", "failureFailedBody"]
580
- }, se = (e, t) => e[mn[t][0]], me = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
581
- const { labels: o } = D(), i = se(o, e.reason), l = o[mn[e.reason][1]], u = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
602
+ }, ae = (e, t) => e[mn[t][0]], me = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
603
+ const { labels: o } = D(), i = ae(o, e.reason), l = o[mn[e.reason][1]], u = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
582
604
  return /* @__PURE__ */ F("div", { className: "aqmx-callout", role: t ? "alert" : void 0, "data-aqmx-tone": u, "data-testid": r === null ? void 0 : r, "data-aqmx-failure": r === null ? void 0 : e.reason, children: [
583
605
  /* @__PURE__ */ c("p", { className: "aqmx-callout-title", children: i }),
584
606
  /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: l }),
@@ -592,7 +614,7 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
592
614
  case "grant":
593
615
  return e.editGrantTitle;
594
616
  case "failed":
595
- return se(e, n.failure.reason);
617
+ return ae(e, n.failure.reason);
596
618
  }
597
619
  switch (r.kind) {
598
620
  case "draft":
@@ -604,7 +626,7 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
604
626
  case "grant":
605
627
  return e.editGrantTitle;
606
628
  case "failed":
607
- return e.draftSaveFailed(se(e, r.failure.reason));
629
+ return e.draftSaveFailed(ae(e, r.failure.reason));
608
630
  case "saved":
609
631
  if (!o) return r.merged ? e.draftSavedMerged : e.draftSaved;
610
632
  break;
@@ -621,12 +643,12 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
621
643
  case "grant":
622
644
  return e.editGrantTitle;
623
645
  case "failed":
624
- return e.draftSaveFailed(se(e, t.failure.reason));
646
+ return e.draftSaveFailed(ae(e, t.failure.reason));
625
647
  case "idle":
626
648
  case "saving":
627
649
  return null;
628
650
  }
629
- }, Oe = () => {
651
+ }, Me = () => {
630
652
  const e = /* @__PURE__ */ new Set();
631
653
  return {
632
654
  subscribe: (t) => (e.add(t), () => {
@@ -636,226 +658,226 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
636
658
  for (const t of [...e]) t();
637
659
  }
638
660
  };
639
- }, Fr = "<<<<<<<", qr = "=======", _r = ">>>>>>>", Ct = (e, t) => e === t || e.startsWith(`${t} `), At = (e) => Br(e.split(`
640
- `)), Br = (e) => {
661
+ }, Fr = "<<<<<<<", qr = "=======", _r = ">>>>>>>", Ot = (e, t) => e === t || e.startsWith(`${t} `), Ct = (e) => Ir(e.split(`
662
+ `)), Ir = (e) => {
641
663
  const t = [];
642
664
  let n = null, r = null, o = 0;
643
665
  for (const i of e) {
644
666
  o += 1;
645
667
  const l = i.charCodeAt(0);
646
- l !== 60 && l !== 61 && l !== 62 || (Ct(i, Fr) ? (n = o, r = null) : i === qr ? n !== null && r === null ? r = o : n = null : Ct(i, _r) && (n !== null && r !== null && t.push({ start: n, separator: r, end: o }), n = null, r = null));
668
+ l !== 60 && l !== 61 && l !== 62 || (Ot(i, Fr) ? (n = o, r = null) : i === qr ? n !== null && r === null ? r = o : n = null : Ot(i, _r) && (n !== null && r !== null && t.push({ start: n, separator: r, end: o }), n = null, r = null));
647
669
  }
648
670
  return t;
649
671
  }, Lt = (e) => e.includes(`\r
650
672
  `) ? `\r
651
673
  ` : `
652
674
  `, Ue = (e) => e.replace(/\r\n?/gu, `
653
- `), Ir = (e, t) => t === `
675
+ `), Br = (e, t) => t === `
654
676
  ` ? e : e.replaceAll(`
655
677
  `, `\r
656
678
  `), zr = 3, jr = /^\d+(?:\.\d+)?$/u, Hr = (e) => {
657
679
  if (e === null || !jr.test(e)) return null;
658
680
  const t = Number(e);
659
681
  return t >= ln && t <= on ? t : null;
660
- }, Ze = Object.freeze({ kind: "idle" }), Mt = Object.freeze({ kind: "draft" }), Vr = ({ data: e, conflictLabels: t, onSaveSettled: n, sideBySideSetting: r, editorShareSetting: o }) => {
661
- const i = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), d = Oe();
662
- let h = null, w = null, b = null;
663
- const O = (s, a) => {
664
- s.value = { ...s.value, ...a }, d.emit();
665
- }, T = (s, a) => i.get(s) === a, S = async (s, a) => {
666
- a.controller.abort(), a.controller = new AbortController();
667
- const { signal: g } = a.controller;
668
- O(a, { phase: { kind: "opening" } });
669
- const R = await e.edit(s, g);
670
- if (!T(s, a) || g.aborted || !("kind" in R)) return;
671
- if (R.kind === "grant") {
672
- O(a, { phase: { kind: "grant", href: R.href } });
682
+ }, Ze = Object.freeze({ kind: "idle" }), At = Object.freeze({ kind: "draft" }), Vr = ({ data: e, conflictLabels: t, onSaveSettled: n, sideBySideSetting: r, editorShareSetting: o }) => {
683
+ const i = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), d = Me();
684
+ let h = null, g = null, b = null;
685
+ const M = (a, s) => {
686
+ a.value = { ...a.value, ...s }, d.emit();
687
+ }, R = (a, s) => i.get(a) === s, S = async (a, s) => {
688
+ s.controller.abort(), s.controller = new AbortController();
689
+ const { signal: w } = s.controller;
690
+ M(s, { phase: { kind: "opening" } });
691
+ const T = await e.edit(a, w);
692
+ if (!R(a, s) || w.aborted || !("kind" in T)) return;
693
+ if (T.kind === "grant") {
694
+ M(s, { phase: { kind: "grant", href: T.href } });
673
695
  return;
674
696
  }
675
- if (R.kind === "failure") {
676
- O(a, { phase: { kind: "failed", failure: R.failure } });
697
+ if (T.kind === "failure") {
698
+ M(s, { phase: { kind: "failed", failure: T.failure } });
677
699
  return;
678
700
  }
679
- const A = Ue(R.text), N = R.kind === "draft";
680
- a.base = { text: A, version: N ? null : R.version }, a.draft = A, a.ending = Lt(R.text), O(a, { phase: { kind: "editing" }, history: N ? !1 : R.history, dirty: !1, save: N ? Mt : Ze, generation: a.value.generation + 1 });
681
- }, M = (s) => {
682
- const a = i.get(s);
683
- a !== void 0 && (a.controller.abort(), i.delete(s), u.delete(s));
684
- }, L = (s, a, g) => (s.set(a, g), () => {
685
- s.get(a) === g && s.delete(a);
686
- }), E = (s, a, g, R = {}) => {
687
- O(a, { ...R, save: g }), n(s, g);
688
- }, v = async (s) => {
689
- m.get(s)?.flush();
690
- const a = i.get(s);
691
- if (a === void 0 || a.value.phase.kind !== "editing" || a.base === null || a.value.save.kind === "saving") return;
692
- const { version: g } = a.base;
693
- if (g === null) {
694
- n(s, Mt);
701
+ const C = Ue(T.text), N = T.kind === "draft";
702
+ s.base = { text: C, version: N ? null : T.version }, s.draft = C, s.ending = Lt(T.text), M(s, { phase: { kind: "editing" }, history: N ? !1 : T.history, dirty: !1, save: N ? At : Ze, generation: s.value.generation + 1 });
703
+ }, A = (a) => {
704
+ const s = i.get(a);
705
+ s !== void 0 && (s.controller.abort(), i.delete(a), u.delete(a));
706
+ }, L = (a, s, w) => (a.set(s, w), () => {
707
+ a.get(s) === w && a.delete(s);
708
+ }), E = (a, s, w, T = {}) => {
709
+ M(s, { ...T, save: w }), n(a, w);
710
+ }, v = async (a) => {
711
+ m.get(a)?.flush();
712
+ const s = i.get(a);
713
+ if (s === void 0 || s.value.phase.kind !== "editing" || s.base === null || s.value.save.kind === "saving") return;
714
+ const { version: w } = s.base;
715
+ if (w === null) {
716
+ n(a, At);
695
717
  return;
696
718
  }
697
- const R = At(a.draft).length;
698
- if (R > 0) {
699
- E(s, a, { kind: "conflicts", count: R });
719
+ const T = Ct(s.draft).length;
720
+ if (T > 0) {
721
+ E(a, s, { kind: "conflicts", count: T });
700
722
  return;
701
723
  }
702
- a.controller.abort(), a.controller = new AbortController();
703
- const { signal: A } = a.controller;
704
- let N = { text: a.base.text, version: g }, q = a.draft, W = !1;
705
- O(a, { save: { kind: "saving" } });
724
+ s.controller.abort(), s.controller = new AbortController();
725
+ const { signal: C } = s.controller;
726
+ let N = { text: s.base.text, version: w }, q = s.draft, W = !1;
727
+ M(s, { save: { kind: "saving" } });
706
728
  for (let z = 0; z < zr; z += 1) {
707
- const j = await e.save(s, N.version, Ir(q, a.ending), A);
708
- if (!T(s, a) || A.aborted || !("kind" in j)) return;
729
+ const j = await e.save(a, N.version, Br(q, s.ending), C);
730
+ if (!R(a, s) || C.aborted || !("kind" in j)) return;
709
731
  if (j.kind === "saved") {
710
- m.get(s)?.flush(), a.base = { text: q, version: j.version }, E(s, a, { kind: "saved", merged: W }, { dirty: a.draft !== q });
732
+ m.get(a)?.flush(), s.base = { text: q, version: j.version }, E(a, s, { kind: "saved", merged: W }, { dirty: s.draft !== q });
711
733
  return;
712
734
  }
713
735
  if (j.kind === "grant") {
714
- E(s, a, { kind: "grant", href: j.href });
736
+ E(a, s, { kind: "grant", href: j.href });
715
737
  return;
716
738
  }
717
739
  if (j.kind === "failure") {
718
- E(s, a, { kind: "failed", failure: j.failure });
740
+ E(a, s, { kind: "failed", failure: j.failure });
719
741
  return;
720
742
  }
721
- const { mergeDraft: Y } = await import("./merge-BkFru0eg.js");
722
- if (!T(s, a) || A.aborted) return;
723
- const V = m.get(s);
743
+ const { mergeDraft: Y } = await import("./merge-B9jrWxMa.js");
744
+ if (!R(a, s) || C.aborted) return;
745
+ const V = m.get(a);
724
746
  V?.flush();
725
- const re = Ue(j.text), p = Y(N.text, a.draft, re, t());
726
- if (N = { text: re, version: j.version }, a.base = N, a.ending = Lt(j.text), a.draft = p.text, V?.adopt(p.text), p.kind === "conflicts") {
727
- E(s, a, { kind: "conflicts", count: p.conflicts }, { dirty: !0, generation: a.value.generation + 1 });
747
+ const re = Ue(j.text), p = Y(N.text, s.draft, re, t());
748
+ if (N = { text: re, version: j.version }, s.base = N, s.ending = Lt(j.text), s.draft = p.text, V?.adopt(p.text), p.kind === "conflicts") {
749
+ E(a, s, { kind: "conflicts", count: p.conflicts }, { dirty: !0, generation: s.value.generation + 1 });
728
750
  return;
729
751
  }
730
752
  if (W = !0, q = p.text, q === N.text) {
731
- E(s, a, { kind: "saved", merged: W }, { dirty: !1, generation: a.value.generation + 1 });
753
+ E(a, s, { kind: "saved", merged: W }, { dirty: !1, generation: s.value.generation + 1 });
732
754
  return;
733
755
  }
734
- O(a, { dirty: !0, generation: a.value.generation + 1 });
756
+ M(s, { dirty: !0, generation: s.value.generation + 1 });
735
757
  }
736
- E(s, a, { kind: "failed", failure: { reason: "failed" } });
758
+ E(a, s, { kind: "failed", failure: { reason: "failed" } });
737
759
  };
738
760
  return {
739
- session: (s) => i.get(s)?.value,
761
+ session: (a) => i.get(a)?.value,
740
762
  subscribe: d.subscribe,
741
- start: (s, a) => {
742
- const g = i.get(s);
743
- if (g !== void 0) {
744
- O(g, { request: { anchor: a }, view: "editor" }), (g.value.phase.kind === "failed" || g.value.phase.kind === "grant") && S(s, g);
763
+ start: (a, s) => {
764
+ const w = i.get(a);
765
+ if (w !== void 0) {
766
+ M(w, { request: { anchor: s }, view: "editor" }), (w.value.phase.kind === "failed" || w.value.phase.kind === "grant") && S(a, w);
745
767
  return;
746
768
  }
747
- l.delete(s);
748
- const R = {
749
- value: { path: s, phase: { kind: "opening" }, view: "editor", previewPrepared: !1, history: !1, dirty: !1, save: Ze, generation: 0, request: { anchor: a } },
769
+ l.delete(a);
770
+ const T = {
771
+ value: { path: a, phase: { kind: "opening" }, view: "editor", previewPrepared: !1, history: !1, dirty: !1, save: Ze, generation: 0, request: { anchor: s } },
750
772
  base: null,
751
773
  draft: "",
752
774
  ending: `
753
775
  `,
754
776
  controller: new AbortController()
755
777
  };
756
- i.set(s, R), S(s, R);
778
+ i.set(a, T), S(a, T);
757
779
  },
758
- retry: (s) => {
759
- const a = i.get(s);
760
- a === void 0 || a.value.phase.kind === "editing" || S(s, a);
780
+ retry: (a) => {
781
+ const s = i.get(a);
782
+ s === void 0 || s.value.phase.kind === "editing" || S(a, s);
761
783
  },
762
- draft: (s) => {
763
- const a = i.get(s);
764
- return a === void 0 || a.base === null ? null : a.draft;
784
+ draft: (a) => {
785
+ const s = i.get(a);
786
+ return s === void 0 || s.base === null ? null : s.draft;
765
787
  },
766
- setDraft: (s, a) => {
767
- const g = i.get(s);
768
- if (g === void 0 || g.base === null) return;
769
- g.draft = a;
770
- const R = {}, A = a !== g.base.text;
771
- A !== g.value.dirty && (R.dirty = A);
772
- const { save: N } = g.value;
788
+ setDraft: (a, s) => {
789
+ const w = i.get(a);
790
+ if (w === void 0 || w.base === null) return;
791
+ w.draft = s;
792
+ const T = {}, C = s !== w.base.text;
793
+ C !== w.value.dirty && (T.dirty = C);
794
+ const { save: N } = w.value;
773
795
  if (N.kind === "conflicts") {
774
- const q = At(a).length;
775
- q === 0 ? R.save = Ze : q !== N.count && (R.save = { kind: "conflicts", count: q });
796
+ const q = Ct(s).length;
797
+ q === 0 ? T.save = Ze : q !== N.count && (T.save = { kind: "conflicts", count: q });
776
798
  }
777
- (R.dirty !== void 0 || R.save !== void 0) && O(g, R);
799
+ (T.dirty !== void 0 || T.save !== void 0) && M(w, T);
778
800
  },
779
- consumeRequest: (s) => {
780
- const a = i.get(s);
781
- a !== void 0 && a.value.request !== null && O(a, { request: null });
801
+ consumeRequest: (a) => {
802
+ const s = i.get(a);
803
+ s !== void 0 && s.value.request !== null && M(s, { request: null });
782
804
  },
783
805
  save: v,
784
- replaceDraft: (s, a) => {
785
- const g = m.get(s);
786
- g?.flush();
787
- const R = i.get(s);
788
- if (R === void 0 || R.base === null) return;
789
- const A = Ue(a);
790
- R.draft = A, g?.adopt(A), O(R, { dirty: A !== R.base.text, generation: R.value.generation + 1 });
806
+ replaceDraft: (a, s) => {
807
+ const w = m.get(a);
808
+ w?.flush();
809
+ const T = i.get(a);
810
+ if (T === void 0 || T.base === null) return;
811
+ const C = Ue(s);
812
+ T.draft = C, w?.adopt(C), M(T, { dirty: C !== T.base.text, generation: T.value.generation + 1 });
791
813
  },
792
- close: (s) => {
793
- if (!i.has(s)) return;
794
- const a = m.get(s), g = a === void 0 ? null : a.returnPoint();
795
- M(s), g === null ? l.delete(s) : l.set(s, g), d.emit();
814
+ close: (a) => {
815
+ if (!i.has(a)) return;
816
+ const s = m.get(a), w = s === void 0 ? null : s.returnPoint();
817
+ A(a), w === null ? l.delete(a) : l.set(a, w), d.emit();
796
818
  },
797
- takeReturn: (s) => {
798
- const a = l.get(s) ?? null;
799
- return l.delete(s), a;
819
+ takeReturn: (a) => {
820
+ const s = l.get(a) ?? null;
821
+ return l.delete(a), s;
800
822
  },
801
- dirtyPaths: () => [...i.values()].filter((s) => s.value.dirty).map((s) => s.value.path),
802
- discard: (s) => {
803
- for (const a of s) M(a);
804
- s.length > 0 && d.emit();
823
+ dirtyPaths: () => [...i.values()].filter((a) => a.value.dirty).map((a) => a.value.path),
824
+ discard: (a) => {
825
+ for (const s of a) A(s);
826
+ a.length > 0 && d.emit();
805
827
  },
806
828
  editorState: {
807
- get: (s) => u.get(s),
808
- set: (s, a) => {
809
- i.has(s) && u.set(s, a);
829
+ get: (a) => u.get(a),
830
+ set: (a, s) => {
831
+ i.has(a) && u.set(a, s);
810
832
  }
811
833
  },
812
- bindEditor: (s, a) => L(m, s, a),
813
- bindView: (s, a) => L(f, s, a),
814
- viewAnchor: (s) => {
815
- const a = f.get(s);
816
- return a === void 0 ? null : a.anchor();
834
+ bindEditor: (a, s) => L(m, a, s),
835
+ bindView: (a, s) => L(f, a, s),
836
+ viewAnchor: (a) => {
837
+ const s = f.get(a);
838
+ return s === void 0 ? null : s.anchor();
817
839
  },
818
- flush: (s) => m.get(s)?.flush(),
840
+ flush: (a) => m.get(a)?.flush(),
819
841
  flushDrafts: () => {
820
- for (const s of m.values()) s.flush();
842
+ for (const a of m.values()) a.flush();
821
843
  },
822
- nextConflict: (s) => m.get(s)?.nextConflict() === !0,
844
+ nextConflict: (a) => m.get(a)?.nextConflict() === !0,
823
845
  hasSessions: () => i.size > 0,
824
- unsavedAmong: (s) => {
825
- for (const a of m.values()) a.flush();
826
- return s.filter((a) => i.get(a)?.value.dirty === !0);
846
+ unsavedAmong: (a) => {
847
+ for (const s of m.values()) s.flush();
848
+ return a.filter((s) => i.get(s)?.value.dirty === !0);
827
849
  },
828
- askToDiscard: (s) => new Promise((a) => {
850
+ askToDiscard: (a) => new Promise((s) => {
829
851
  b?.settle(!1);
830
- const g = {
831
- paths: s,
832
- settle: (R) => {
833
- if (b === g) {
834
- if (b = null, R) for (const A of s) M(A);
835
- d.emit(), a(R);
852
+ const w = {
853
+ paths: a,
854
+ settle: (T) => {
855
+ if (b === w) {
856
+ if (b = null, T) for (const C of a) A(C);
857
+ d.emit(), s(T);
836
858
  }
837
859
  }
838
860
  };
839
- b = g, d.emit();
861
+ b = w, d.emit();
840
862
  }),
841
863
  discardRequest: () => b,
842
864
  sideBySide: () => (h ??= r.read(), h),
843
- setSideBySide: (s) => {
844
- h !== s && (h = s, r.write(s), d.emit());
865
+ setSideBySide: (a) => {
866
+ h !== a && (h = a, r.write(a), d.emit());
845
867
  },
846
- editorShare: () => (w ??= o.read() ?? Zn, w),
847
- setEditorShare: (s) => {
848
- if (!Number.isFinite(s)) throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(s)}`);
849
- const a = Math.min(on, Math.max(ln, s));
850
- w !== a && (w = a, o.write(a));
868
+ editorShare: () => (g ??= o.read() ?? Zn, g),
869
+ setEditorShare: (a) => {
870
+ if (!Number.isFinite(a)) throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(a)}`);
871
+ const s = Math.min(on, Math.max(ln, a));
872
+ g !== s && (g = s, o.write(s));
851
873
  },
852
- setView: (s, a) => {
853
- const g = i.get(s);
854
- g === void 0 || g.value.view === a || (m.get(s)?.beforeView(a), O(g, { view: a, previewPrepared: g.value.previewPrepared || a === "preview" }));
874
+ setView: (a, s) => {
875
+ const w = i.get(a);
876
+ w === void 0 || w.value.view === s || (m.get(a)?.beforeView(s), M(w, { view: s, previewPrepared: w.value.previewPrepared || s === "preview" }));
855
877
  },
856
- preparePreview: (s) => {
857
- const a = i.get(s);
858
- a !== void 0 && !a.value.previewPrepared && O(a, { previewPrepared: !0 });
878
+ preparePreview: (a) => {
879
+ const s = i.get(a);
880
+ s !== void 0 && !s.value.previewPrepared && M(s, { previewPrepared: !0 });
859
881
  }
860
882
  };
861
883
  }, hn = (e) => {
@@ -885,15 +907,15 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
885
907
  const d = r.current;
886
908
  if (!e || d === null) return;
887
909
  const h = new ResizeObserver(() => b());
888
- let w = null;
910
+ let g = null;
889
911
  const b = () => {
890
- const T = Xr(d);
891
- T === null || T === w || (w !== null && h.unobserve(w), h.observe(T), w = T);
912
+ const R = Xr(d);
913
+ R === null || R === g || (g !== null && h.unobserve(g), h.observe(R), g = R);
892
914
  };
893
915
  b(), h.observe(d);
894
- const O = d.ownerDocument.defaultView;
895
- return O?.addEventListener("resize", b), d.ownerDocument.addEventListener("scroll", b, { capture: !0, passive: !0 }), () => {
896
- h.disconnect(), O?.removeEventListener("resize", b), d.ownerDocument.removeEventListener("scroll", b, { capture: !0 });
916
+ const M = d.ownerDocument.defaultView;
917
+ return M?.addEventListener("resize", b), d.ownerDocument.addEventListener("scroll", b, { capture: !0, passive: !0 }), () => {
918
+ h.disconnect(), M?.removeEventListener("resize", b), d.ownerDocument.removeEventListener("scroll", b, { capture: !0 });
897
919
  };
898
920
  }, [e]);
899
921
  const u = P(
@@ -910,9 +932,9 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
910
932
  i.current && n();
911
933
  }, [n]);
912
934
  return { ref: r, onKeyDown: u, onClick: m, onCancel: Yr, onClose: f };
913
- }, gn = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: i, onCancel: l, testId: u }) => {
914
- const m = _(null), f = Se(), d = Se(), h = P(() => m.current?.focus(), []), w = vn({ open: e, onOpen: h, onDismiss: l });
915
- return /* @__PURE__ */ c("dialog", { ...w, className: "aqmx-confirm", "aria-labelledby": f, "aria-describedby": d, "data-testid": u, children: /* @__PURE__ */ F("div", { className: "aqmx-confirm-panel", children: [
935
+ }, wn = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: i, onCancel: l, testId: u }) => {
936
+ const m = _(null), f = Se(), d = Se(), h = P(() => m.current?.focus(), []), g = vn({ open: e, onOpen: h, onDismiss: l });
937
+ return /* @__PURE__ */ c("dialog", { ...g, className: "aqmx-confirm", "aria-labelledby": f, "aria-describedby": d, "data-testid": u, children: /* @__PURE__ */ F("div", { className: "aqmx-confirm-panel", children: [
916
938
  /* @__PURE__ */ c("p", { id: f, className: "aqmx-confirm-title", children: t }),
917
939
  /* @__PURE__ */ c("p", { id: d, className: "aqmx-confirm-body", children: n }),
918
940
  /* @__PURE__ */ F("div", { className: "aqmx-confirm-actions", children: [
@@ -920,7 +942,7 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
920
942
  /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-aqmx-tone": "danger", "data-testid": `${u}-confirm`, onClick: i, children: r })
921
943
  ] })
922
944
  ] }) });
923
- }, Re = (e) => {
945
+ }, Te = (e) => {
924
946
  const t = e;
925
947
  return t.status === void 0 && (t.status = "pending", e.then(
926
948
  (n) => {
@@ -930,7 +952,7 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
930
952
  t.status = "rejected", t.reason = n;
931
953
  }
932
954
  )), t;
933
- }, wn = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), Ee = (e) => e.status === "fulfilled" ? e.value : void 0, Jr = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !1 }), Qr = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !0 }), eo = (e, t, n) => {
955
+ }, gn = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), Ee = (e) => e.status === "fulfilled" ? e.value : void 0, Jr = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !1 }), Qr = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !0 }), eo = (e, t, n) => {
934
956
  const r = /* @__PURE__ */ new Set(), o = [...e].reverse();
935
957
  for (let i = o.pop(); i !== void 0; i = o.pop()) {
936
958
  if (i.type !== "directory" || r.has(i.path)) continue;
@@ -945,14 +967,14 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
945
967
  if (r === void 0 || r.status === "deferred") return Jr;
946
968
  if (r.status === "error") return { readme: { status: "failed", failure: r.failure, retry: () => e.retry(t) }, claim: !1 };
947
969
  const o = eo(r.entries, n, (l) => e.children(t, l));
948
- if (o !== null) return { readme: { status: "ok", readme: gt(o) }, claim: !1 };
970
+ if (o !== null) return { readme: { status: "ok", readme: wt(o) }, claim: !1 };
949
971
  const i = e.children(t, n);
950
- return i === void 0 || i.status === "loading" ? Qr : i.status === "failed" ? { readme: { status: "failed", failure: i.failure, retry: () => e.retryChildren(t, n) }, claim: !0 } : { readme: { status: "ok", readme: gt(i.entries) }, claim: !0 };
972
+ return i === void 0 || i.status === "loading" ? Qr : i.status === "failed" ? { readme: { status: "failed", failure: i.failure, retry: () => e.retryChildren(t, n) }, claim: !0 } : { readme: { status: "ok", readme: wt(i.entries) }, claim: !0 };
951
973
  }, no = (e, t, n) => {
952
974
  const { readme: r } = to(e, t, n);
953
975
  return r.status === "ok" ? r.readme : null;
954
976
  }, ro = (e, t, n) => {
955
- const r = In({ path: `${e.basePath}/*`, end: !0 }, t.pathname);
977
+ const r = Bn({ path: `${e.basePath}/*`, end: !0 }, t.pathname);
956
978
  if (r === null) return /* @__PURE__ */ new Set();
957
979
  const { location: o } = rn(e, r.params["*"], new URLSearchParams(t.search));
958
980
  switch (o.view) {
@@ -975,28 +997,28 @@ const Rt = Object.freeze(["en", "ja"]), Rr = "en", Tr = Object.freeze({
975
997
  }, lo = () => {
976
998
  const { edits: e } = D();
977
999
  return ee(e.subscribe, e.sideBySide, En);
978
- }, so = () => null, ao = () => {
1000
+ }, ao = () => null, so = () => {
979
1001
  const { edits: e, labels: t, config: n, trees: r } = D(), o = _([]), i = P(
980
1002
  ({ nextLocation: b }) => {
981
- const O = ro(n, b, (T, S) => no(r, T, S));
982
- return e.flushDrafts(), o.current = e.dirtyPaths().filter((T) => !O.has(T)), o.current.length > 0;
1003
+ const M = ro(n, b, (R, S) => no(r, R, S));
1004
+ return e.flushDrafts(), o.current = e.dirtyPaths().filter((R) => !M.has(R)), o.current.length > 0;
983
1005
  },
984
1006
  [e, n, r]
985
1007
  ), l = zn(i), u = io();
986
1008
  te(() => {
987
1009
  if (!u) return;
988
- const b = (O) => {
989
- e.flushDrafts(), e.dirtyPaths().length !== 0 && (O.preventDefault(), O.returnValue = !0);
1010
+ const b = (M) => {
1011
+ e.flushDrafts(), e.dirtyPaths().length !== 0 && (M.preventDefault(), M.returnValue = !0);
990
1012
  };
991
1013
  return window.addEventListener("beforeunload", b), () => window.removeEventListener("beforeunload", b);
992
1014
  }, [u, e]);
993
- const m = ee(e.subscribe, e.discardRequest, so), f = l.state === "blocked", d = f ? o.current : m === null ? [] : m.paths, h = d.map((b) => ae(b)).join(", "), w = d.length > 0 && d.every((b) => e.session(b)?.save.kind === "draft");
1015
+ const m = ee(e.subscribe, e.discardRequest, ao), f = l.state === "blocked", d = f ? o.current : m === null ? [] : m.paths, h = d.map((b) => se(b)).join(", "), g = d.length > 0 && d.every((b) => e.session(b)?.save.kind === "draft");
994
1016
  return /* @__PURE__ */ c(
995
- gn,
1017
+ wn,
996
1018
  {
997
1019
  open: f || m !== null,
998
- title: w ? t.draftDiscardTitle : t.unsavedTitle,
999
- body: w ? t.draftDiscardBody(h) : t.unsavedBody(h),
1020
+ title: g ? t.draftDiscardTitle : t.unsavedTitle,
1021
+ body: g ? t.draftDiscardBody(h) : t.unsavedBody(h),
1000
1022
  confirmLabel: t.unsavedDiscard,
1001
1023
  cancelLabel: t.unsavedStay,
1002
1024
  testId: "markdown-explorer-unsaved-guard",
@@ -1040,7 +1062,7 @@ function co({
1040
1062
  }
1041
1063
  const uo = /* @__PURE__ */ y.forwardRef(co);
1042
1064
  let Ge = null;
1043
- const yn = () => (Ge ??= import("./EditSurface-DGMLY7Gh.js").catch((e) => {
1065
+ const yn = () => (Ge ??= import("./EditSurface-B2bzY1b_.js").catch((e) => {
1044
1066
  throw Ge = null, e;
1045
1067
  }), Ge), fo = () => {
1046
1068
  yn().catch(() => {
@@ -1059,15 +1081,15 @@ class ho extends tn {
1059
1081
  return this.state.failed ? this.props.fallback(this.retry) : this.props.children;
1060
1082
  }
1061
1083
  }
1062
- const st = `[${an}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg', go = 200, Te = (e) => Er(e.getAttribute(an)), wo = (e, t) => {
1084
+ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg', wo = 200, Re = (e) => Er(e.getAttribute(sn)), go = (e, t) => {
1063
1085
  for (let r = e; r !== null && t.contains(r); r = r.parentElement) {
1064
- const o = Te(r);
1086
+ const o = Re(r);
1065
1087
  if (o !== null) return { block: r, lines: o, own: !0 };
1066
1088
  }
1067
1089
  let n = null;
1068
- for (const r of t.querySelectorAll(st)) {
1090
+ for (const r of t.querySelectorAll(at)) {
1069
1091
  if (!(r.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING)) break;
1070
- const o = Te(r);
1092
+ const o = Re(r);
1071
1093
  o !== null && (n = { block: r, lines: o });
1072
1094
  }
1073
1095
  return n === null ? null : { ...n, own: !1 };
@@ -1076,19 +1098,19 @@ const st = `[${an}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1076
1098
  for (let r = e.indexOf(t); r >= 0; r = e.indexOf(t, r + t.length)) n += 1;
1077
1099
  return n;
1078
1100
  }, Eo = (e) => e.closest(po) !== null && e.closest(vo) === null, yo = (e, t, n) => {
1079
- const r = wo(e, t);
1101
+ const r = go(e, t);
1080
1102
  if (r === null) return null;
1081
1103
  const { block: o, own: i } = r;
1082
1104
  if (!i) {
1083
1105
  const u = r.lines.last + 1;
1084
1106
  return { lines: { first: u, last: u }, word: null, occurrence: 0, clientTop: Ne(e) };
1085
1107
  }
1086
- const l = Ro(o, n);
1108
+ const l = To(o, n);
1087
1109
  return l === null ? { lines: r.lines, word: null, occurrence: 0, clientTop: Ne(o) } : { lines: r.lines, word: l.text, occurrence: l.occurrence, clientTop: l.clientTop };
1088
1110
  }, xo = (e, t) => {
1089
1111
  let n = null, r = null, o = null;
1090
- for (const l of e.querySelectorAll(st)) {
1091
- const u = Te(l);
1112
+ for (const l of e.querySelectorAll(at)) {
1113
+ const u = Re(l);
1092
1114
  if (u === null) continue;
1093
1115
  n ??= ko(t, l);
1094
1116
  const { top: m, bottom: f } = l.getBoundingClientRect();
@@ -1099,15 +1121,15 @@ const st = `[${an}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1099
1121
  }, So = (e) => e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, ko = (e, t) => {
1100
1122
  const n = Number.parseFloat(getComputedStyle(t).scrollMarginTop);
1101
1123
  return So(e) + (Number.isFinite(n) ? n : 0);
1102
- }, Ro = (e, t) => {
1124
+ }, To = (e, t) => {
1103
1125
  if (t === null || t.rangeCount === 0) return null;
1104
1126
  const n = t.getRangeAt(0);
1105
1127
  if (!(e.contains(n.startContainer) && e.contains(n.endContainer))) return null;
1106
1128
  const r = n.toString().trim();
1107
- if (r === "" || r.length > go || /[\r\n]/u.test(r)) return null;
1129
+ if (r === "" || r.length > wo || /[\r\n]/u.test(r)) return null;
1108
1130
  const o = e.ownerDocument.createRange();
1109
1131
  return o.setStart(e, 0), o.setEnd(n.startContainer, n.startOffset), { text: r, occurrence: bo(o.toString(), r), clientTop: n.getBoundingClientRect().top };
1110
- }, Ks = (e, t) => {
1132
+ }, Xa = (e, t) => {
1111
1133
  const n = e.split(`
1112
1134
  `), r = Math.min(t.lines.first, n.length), o = Math.min(t.lines.last, n.length), i = { line: r, column: 0 };
1113
1135
  if (t.word === null) return i;
@@ -1119,22 +1141,22 @@ const st = `[${an}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1119
1141
  l += 1;
1120
1142
  }
1121
1143
  }
1122
- return l > 0 ? To(n, r, o, t.word) ?? i : i;
1123
- }, To = (e, t, n, r) => {
1144
+ return l > 0 ? Ro(n, r, o, t.word) ?? i : i;
1145
+ }, Ro = (e, t, n, r) => {
1124
1146
  for (let o = n; o >= t; o -= 1) {
1125
1147
  const i = (e[o - 1] ?? "").lastIndexOf(r);
1126
1148
  if (i >= 0) return { line: o, column: i };
1127
1149
  }
1128
1150
  return null;
1129
- }, Oo = (e, t) => {
1151
+ }, Mo = (e, t) => {
1130
1152
  let n = null, r = null;
1131
- for (const o of e.querySelectorAll(st)) {
1132
- const i = Te(o);
1153
+ for (const o of e.querySelectorAll(at)) {
1154
+ const i = Re(o);
1133
1155
  i === null || i.first > t || (i.last >= t ? n = o : (r === null || i.last >= r.last) && (r = { element: o, last: i.last }));
1134
1156
  }
1135
1157
  return n !== null ? n : r === null ? null : r.element;
1136
- }, Co = (e, t) => {
1137
- const { bottom: n } = e.getBoundingClientRect(), r = Ne(e), o = Te(e);
1158
+ }, Oo = (e, t) => {
1159
+ const { bottom: n } = e.getBoundingClientRect(), r = Ne(e), o = Re(e);
1138
1160
  if (o === null) return r;
1139
1161
  const i = Math.min(Math.max(t - o.first, 0) / (o.last - o.first + 1), 1);
1140
1162
  return r + (n - r) * i;
@@ -1149,20 +1171,20 @@ const st = `[${an}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1149
1171
  if (u > 0) return l;
1150
1172
  }
1151
1173
  return e.getBoundingClientRect().top;
1152
- }, at = Object.freeze({
1174
+ }, st = Object.freeze({
1153
1175
  browse: Object.freeze({ replace: !0, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
1154
1176
  "switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
1155
1177
  "switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
1156
1178
  "follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
1157
- }), Xs = (e) => at[e], Fe = () => {
1179
+ }), Ya = (e) => st[e], Fe = () => {
1158
1180
  const e = jn();
1159
1181
  return P(
1160
1182
  (t, n) => {
1161
- e(t, at[n]);
1183
+ e(t, st[n]);
1162
1184
  },
1163
1185
  [e]
1164
1186
  );
1165
- }, Ao = ({ navigation: e, ...t }) => /* @__PURE__ */ c(Hn, { ...t, ...at[e] }), xn = (e) => {
1187
+ }, Co = ({ navigation: e, ...t }) => /* @__PURE__ */ c(Hn, { ...t, ...st[e] }), xn = (e) => {
1166
1188
  const t = e.ownerDocument;
1167
1189
  if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
1168
1190
  if (e.hasAttribute("tabindex")) return !1;
@@ -1188,9 +1210,9 @@ const st = `[${an}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1188
1210
  e.prefetch(f);
1189
1211
  const h = e.peek(f);
1190
1212
  if (h?.status !== "pending") return;
1191
- const w = Promise.allSettled([h.promise]);
1192
- o.current = w, w.then(() => {
1193
- o.current === w && (o.current = null);
1213
+ const g = Promise.allSettled([h.promise]);
1214
+ o.current = g, g.then(() => {
1215
+ o.current === g && (o.current = null);
1194
1216
  });
1195
1217
  },
1196
1218
  [e]
@@ -1217,7 +1239,7 @@ const st = `[${an}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1217
1239
  }),
1218
1240
  [u, m]
1219
1241
  );
1220
- }, Mo = it(() => import("./NativeScrollBar-Dazd542j.js").then((e) => ({ default: e.NativeScrollBar })));
1242
+ }, Ao = it(() => import("./NativeScrollBar-Dq3YeUVY.js").then((e) => ({ default: e.NativeScrollBar })));
1221
1243
  class No extends tn {
1222
1244
  state = { failed: !1 };
1223
1245
  static getDerivedStateFromError() {
@@ -1230,7 +1252,7 @@ class No extends tn {
1230
1252
  return this.state.failed ? null : this.props.children;
1231
1253
  }
1232
1254
  }
1233
- const Do = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(No, { children: /* @__PURE__ */ c(ke, { fallback: null, children: /* @__PURE__ */ c(Mo, { scroller: e, withCircle: t }) }) }), Sn = (e) => /* @__PURE__ */ c(Do, { scroller: e, withCircle: !0 }), kn = () => {
1255
+ const Do = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(No, { children: /* @__PURE__ */ c(ke, { fallback: null, children: /* @__PURE__ */ c(Ao, { scroller: e, withCircle: t }) }) }), Sn = (e) => /* @__PURE__ */ c(Do, { scroller: e, withCircle: !0 }), kn = () => {
1234
1256
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
1235
1257
  let n = !1;
1236
1258
  const r = (o) => {
@@ -1264,9 +1286,9 @@ const Do = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(No, { children:
1264
1286
  return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((i, l) => De(i, t[l]));
1265
1287
  const n = e, r = t, o = Object.keys(n);
1266
1288
  return o.length !== Object.keys(r).length ? !1 : o.every((i) => Object.hasOwn(r, i) && De(n[i], r[i]));
1267
- }, Po = 55e3, Nt = Object.freeze({ status: "deferred" }), Dt = Object.freeze({ status: "refreshed" }), We = Object.freeze({ status: "superseded" }), ue = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, Rn = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", $o = ({ client: e, capacity: t }) => {
1289
+ }, Po = 55e3, Nt = Object.freeze({ status: "deferred" }), Dt = Object.freeze({ status: "refreshed" }), We = Object.freeze({ status: "superseded" }), ue = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, Tn = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", $o = ({ client: e, capacity: t }) => {
1268
1290
  if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
1269
- const n = /* @__PURE__ */ new Map(), r = kn(), o = Oe(), i = /* @__PURE__ */ new WeakSet();
1291
+ const n = /* @__PURE__ */ new Map(), r = kn(), o = Me(), i = /* @__PURE__ */ new WeakSet();
1270
1292
  let l = 0;
1271
1293
  const u = o.emit, m = () => (l += 1, l), f = () => {
1272
1294
  if (!(n.size <= t))
@@ -1276,33 +1298,33 @@ const Do = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(No, { children:
1276
1298
  }
1277
1299
  }, d = (E, v) => {
1278
1300
  n.delete(E), n.set(E, v);
1279
- }, h = (E) => performance.now() - E.validatedAt >= Po, w = (E, v, s) => {
1280
- const a = n.get(E), g = ue(a?.snapshot), R = s || a?.refreshPending === !0, A = Re(e.document(E, { refresh: R }).then((q) => ({ status: "loaded", document: q }))), N = { snapshot: { status: "pending", promise: A, previous: g }, validatedAt: performance.now(), opened: v, background: null, refreshPending: !1, seeded: void 0, stamp: m() };
1281
- return d(E, N), f(), A.then((q) => {
1301
+ }, h = (E) => performance.now() - E.validatedAt >= Po, g = (E, v, a) => {
1302
+ const s = n.get(E), w = ue(s?.snapshot), T = a || s?.refreshPending === !0, C = Te(e.document(E, { refresh: T }).then((q) => ({ status: "loaded", document: q }))), N = { snapshot: { status: "pending", promise: C, previous: w }, validatedAt: performance.now(), opened: v, background: null, refreshPending: !1, seeded: void 0, stamp: m() };
1303
+ return d(E, N), f(), C.then((q) => {
1282
1304
  n.get(E) === N && (N.snapshot = q, N.stamp = m(), u());
1283
1305
  }), N;
1284
- }, b = (E, v, s, a, g, R) => {
1285
- v.background === s && (v.background = null, !(n.get(E) !== v || v.snapshot !== a) && (g.kind === "failure" && a.document.kind !== "failure" || (v.validatedAt = R, v.stamp = m(), De(a.document, g) || (v.snapshot = { status: "loaded", document: g }), u())));
1286
- }, O = async (E, v) => {
1287
- const s = v.snapshot;
1288
- if (s.status !== "loaded") return null;
1289
- const a = {};
1290
- v.background = a;
1291
- const g = performance.now(), R = e.document(E, { refresh: v.refreshPending });
1306
+ }, b = (E, v, a, s, w, T) => {
1307
+ v.background === a && (v.background = null, !(n.get(E) !== v || v.snapshot !== s) && (w.kind === "failure" && s.document.kind !== "failure" || (v.validatedAt = T, v.stamp = m(), De(s.document, w) || (v.snapshot = { status: "loaded", document: w }), u())));
1308
+ }, M = async (E, v) => {
1309
+ const a = v.snapshot;
1310
+ if (a.status !== "loaded") return null;
1311
+ const s = {};
1312
+ v.background = s;
1313
+ const w = performance.now(), T = e.document(E, { refresh: v.refreshPending });
1292
1314
  v.refreshPending = !1;
1293
- const A = await R, N = v.background === a && n.get(E) === v && v.snapshot === s;
1294
- return b(E, v, a, s, A, g), N ? A : null;
1295
- }, T = (E, v) => {
1296
- const { snapshot: s } = v;
1297
- return s.status === "pending" ? !1 : s.status === "loaded" && s.document.kind !== "failure" ? (O(E, v), !1) : (s.status === "loaded" && i.add(s), w(E, !0, !1), !0);
1315
+ const C = await T, N = v.background === s && n.get(E) === v && v.snapshot === a;
1316
+ return b(E, v, s, a, C, w), N ? C : null;
1317
+ }, R = (E, v) => {
1318
+ const { snapshot: a } = v;
1319
+ return a.status === "pending" ? !1 : a.status === "loaded" && a.document.kind !== "failure" ? (M(E, v), !1) : (a.status === "loaded" && i.add(a), g(E, !0, !1), !0);
1298
1320
  }, S = (E) => {
1299
1321
  const v = r.hold(E);
1300
- let s = !1;
1322
+ let a = !1;
1301
1323
  return () => {
1302
- if (s) return;
1303
- s = !0, v();
1304
- const a = n.get(E);
1305
- a !== void 0 && d(E, a), f();
1324
+ if (a) return;
1325
+ a = !0, v();
1326
+ const s = n.get(E);
1327
+ s !== void 0 && d(E, s), f();
1306
1328
  };
1307
1329
  };
1308
1330
  return {
@@ -1311,72 +1333,72 @@ const Do = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(No, { children:
1311
1333
  answerStampOf: (E) => n.get(E)?.stamp,
1312
1334
  prefetch: (E) => {
1313
1335
  const v = n.get(E);
1314
- v !== void 0 && v.snapshot.status !== "deferred" || (w(E, !1, !1), u());
1336
+ v !== void 0 && v.snapshot.status !== "deferred" || (g(E, !1, !1), u());
1315
1337
  },
1316
1338
  open: (E) => {
1317
- const v = r.resumes(E), s = S(E), a = n.get(E);
1318
- if (a === void 0 || a.snapshot.status === "deferred")
1319
- return w(E, !0, !1), u(), s;
1320
- if (d(E, a), v) return s;
1321
- const { snapshot: g } = a;
1322
- return g.status === "pending" ? (a.opened = !0, s) : g.document.kind === "failure" ? (a.opened || h(a) ? (i.add(g), w(E, !0, !1), u()) : a.opened = !0, s) : (a.opened = !0, a.background === null && h(a) && O(E, a), s);
1339
+ const v = r.resumes(E), a = S(E), s = n.get(E);
1340
+ if (s === void 0 || s.snapshot.status === "deferred")
1341
+ return g(E, !0, !1), u(), a;
1342
+ if (d(E, s), v) return a;
1343
+ const { snapshot: w } = s;
1344
+ return w.status === "pending" ? (s.opened = !0, a) : w.document.kind === "failure" ? (s.opened || h(s) ? (i.add(w), g(E, !0, !1), u()) : s.opened = !0, a) : (s.opened = !0, s.background === null && h(s) && M(E, s), a);
1323
1345
  },
1324
1346
  retain: S,
1325
1347
  retry: (E) => {
1326
1348
  const v = n.get(E);
1327
- v === void 0 || v.snapshot.status !== "loaded" || v.snapshot.document.kind !== "failure" || (w(E, !0, !1), u());
1349
+ v === void 0 || v.snapshot.status !== "loaded" || v.snapshot.document.kind !== "failure" || (g(E, !0, !1), u());
1328
1350
  },
1329
1351
  seed: (E, v) => {
1330
- const s = performance.now(), a = Re(
1352
+ const a = performance.now(), s = Te(
1331
1353
  v.then(
1332
1354
  (q) => q === null ? Nt : { status: "loaded", document: q },
1333
1355
  () => Nt
1334
1356
  )
1335
- ), g = n.get(E);
1336
- if (g !== void 0 && g.snapshot.status === "loaded") {
1337
- const q = g.snapshot, W = {};
1338
- g.background = W, a.then((z) => {
1357
+ ), w = n.get(E);
1358
+ if (w !== void 0 && w.snapshot.status === "loaded") {
1359
+ const q = w.snapshot, W = {};
1360
+ w.background = W, s.then((z) => {
1339
1361
  if (z.status === "loaded") {
1340
- b(E, g, W, q, z.document, s);
1362
+ b(E, w, W, q, z.document, a);
1341
1363
  return;
1342
1364
  }
1343
- g.background === W && (g.background = null);
1365
+ w.background === W && (w.background = null);
1344
1366
  });
1345
1367
  return;
1346
1368
  }
1347
- const R = g !== void 0 && g.snapshot.status === "pending" ? g.snapshot.previous : null, A = { status: "pending", promise: a, previous: R }, N = { snapshot: A, validatedAt: s, opened: g?.opened === !0, background: null, refreshPending: g?.refreshPending === !0, seeded: A, stamp: m() };
1348
- d(E, N), f(), a.then((q) => {
1349
- n.get(E) === N && (q.status === "deferred" && r.isHeld(E) ? w(E, N.opened, !1) : (N.snapshot = q, N.stamp = m()), u());
1369
+ const T = w !== void 0 && w.snapshot.status === "pending" ? w.snapshot.previous : null, C = { status: "pending", promise: s, previous: T }, N = { snapshot: C, validatedAt: a, opened: w?.opened === !0, background: null, refreshPending: w?.refreshPending === !0, seeded: C, stamp: m() };
1370
+ d(E, N), f(), s.then((q) => {
1371
+ n.get(E) === N && (q.status === "deferred" && r.isHeld(E) ? g(E, N.opened, !1) : (N.snapshot = q, N.stamp = m()), u());
1350
1372
  });
1351
1373
  },
1352
1374
  invalidate: () => {
1353
1375
  let E = !1;
1354
- for (const [v, s] of [...n]) {
1355
- if (s.validatedAt = Number.NEGATIVE_INFINITY, s.opened = !0, s.refreshPending = !0, !r.isHeld(v)) continue;
1356
- const { snapshot: a } = s;
1357
- if (a.status !== "pending") {
1358
- T(v, s) && (E = !0);
1376
+ for (const [v, a] of [...n]) {
1377
+ if (a.validatedAt = Number.NEGATIVE_INFINITY, a.opened = !0, a.refreshPending = !0, !r.isHeld(v)) continue;
1378
+ const { snapshot: s } = a;
1379
+ if (s.status !== "pending") {
1380
+ R(v, a) && (E = !0);
1359
1381
  continue;
1360
1382
  }
1361
- a.promise.then(() => {
1362
- n.get(v) === s && s.refreshPending && r.isHeld(v) && T(v, s) && u();
1383
+ s.promise.then(() => {
1384
+ n.get(v) === a && a.refreshPending && r.isHeld(v) && R(v, a) && u();
1363
1385
  });
1364
1386
  }
1365
1387
  E && u();
1366
1388
  },
1367
1389
  refresh: async (E) => {
1368
1390
  const v = n.get(E);
1369
- if (v !== void 0 && Rn(v.snapshot)) {
1391
+ if (v !== void 0 && Tn(v.snapshot)) {
1370
1392
  v.refreshPending = !0;
1371
- const a = await O(E, v);
1372
- return a === null ? We : a.kind === "failure" ? { status: "failed", failure: a.failure } : Dt;
1393
+ const s = await M(E, v);
1394
+ return s === null ? We : s.kind === "failure" ? { status: "failed", failure: s.failure } : Dt;
1373
1395
  }
1374
- const s = w(E, !0, !0);
1375
- return u(), s.snapshot.status !== "pending" ? We : (await s.snapshot.promise, n.get(E) === s ? Dt : We);
1396
+ const a = g(E, !0, !0);
1397
+ return u(), a.snapshot.status !== "pending" ? We : (await a.snapshot.promise, n.get(E) === a ? Dt : We);
1376
1398
  },
1377
1399
  clear: () => {
1378
1400
  n.clear();
1379
- for (const E of r.heldKeys()) w(E, !0, !1);
1401
+ for (const E of r.heldKeys()) g(E, !0, !1);
1380
1402
  u();
1381
1403
  },
1382
1404
  subscribe: o.subscribe,
@@ -1432,8 +1454,8 @@ function _o({
1432
1454
  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"
1433
1455
  }));
1434
1456
  }
1435
- const Bo = /* @__PURE__ */ y.forwardRef(_o);
1436
- function Io({
1457
+ const Io = /* @__PURE__ */ y.forwardRef(_o);
1458
+ function Bo({
1437
1459
  title: e,
1438
1460
  titleId: t,
1439
1461
  ...n
@@ -1454,11 +1476,11 @@ function Io({
1454
1476
  clipRule: "evenodd"
1455
1477
  }));
1456
1478
  }
1457
- const zo = /* @__PURE__ */ y.forwardRef(Io), jo = 2e3, Pt = Object.freeze({ outcome: "idle" }), Ho = (e) => {
1479
+ const zo = /* @__PURE__ */ y.forwardRef(Bo), jo = 2e3, Pt = Object.freeze({ outcome: "idle" }), Ho = (e) => {
1458
1480
  const t = navigator.clipboard;
1459
1481
  return t === void 0 ? Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")) : t.writeText(e);
1460
1482
  }, Vo = ({ text: e }) => {
1461
- const { announcer: t, labels: n } = D(), [r, o] = I(Pt);
1483
+ const { announcer: t, labels: n } = D(), [r, o] = B(Pt);
1462
1484
  te(() => {
1463
1485
  if (r.outcome === "idle") return;
1464
1486
  const m = setTimeout(() => o(Pt), jo);
@@ -1473,7 +1495,7 @@ const zo = /* @__PURE__ */ y.forwardRef(Io), jo = 2e3, Pt = Object.freeze({ outc
1473
1495
  );
1474
1496
  }, u = r.outcome === "copied" ? n.copiedText : r.outcome === "failed" ? n.copyTextFailed : n.copyText;
1475
1497
  return (
1476
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: u, onClick: l, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ c(qo, {}) : r.outcome === "failed" ? /* @__PURE__ */ c(zo, {}) : /* @__PURE__ */ c(Bo, {}) })
1498
+ /* @__PURE__ */ c("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: u, onClick: l, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ c(qo, {}) : r.outcome === "failed" ? /* @__PURE__ */ c(zo, {}) : /* @__PURE__ */ c(Io, {}) })
1477
1499
  );
1478
1500
  }, he = pe("fill"), Uo = Object.freeze({ blockSize: "100%" }), ve = ({ scrollerProps: e, children: t }) => ne(he) === "content" ? /* @__PURE__ */ c(St, { scrollerProps: e, children: t }) : /* @__PURE__ */ c(St, { scrollerProps: { ...e, style: Uo }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: Sn, children: t });
1479
1501
  function Zo({
@@ -1570,23 +1592,23 @@ const Yo = /* @__PURE__ */ y.forwardRef(Xo), Jo = Object.freeze({ className: "aq
1570
1592
  if (!e.startsWith("#") || e.length === 1) return null;
1571
1593
  const t = new TextEncoder(), n = e.slice(1).split(ti).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
1572
1594
  return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
1573
- }, Tn = (e) => `#${encodeURIComponent(e)}`, ni = (e) => {
1595
+ }, Rn = (e) => `#${encodeURIComponent(e)}`, ni = (e) => {
1574
1596
  if (e === "#") return !0;
1575
1597
  const t = ct(e);
1576
1598
  return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
1577
- }, On = (e, t) => {
1599
+ }, Mn = (e, t) => {
1578
1600
  if (t === "") return null;
1579
1601
  for (const n of e.querySelectorAll("[id]"))
1580
1602
  if (n.id === t) return n;
1581
1603
  return null;
1582
1604
  }, ri = "http://www.w3.org/1999/xhtml", $t = (e, t) => {
1583
1605
  if (t === "") return null;
1584
- const n = On(e, t);
1606
+ const n = Mn(e, t);
1585
1607
  if (n !== null) return n;
1586
1608
  for (const r of e.querySelectorAll("a[name]"))
1587
1609
  if (r.localName === "a" && r.namespaceURI === ri && r.getAttribute("name") === t) return r;
1588
1610
  return null;
1589
- }, Cn = (e, t) => {
1611
+ }, On = (e, t) => {
1590
1612
  if (e === null || !t.startsWith("#")) return null;
1591
1613
  const n = $t(e, t.slice(1));
1592
1614
  if (n !== null) return n;
@@ -1615,7 +1637,7 @@ const Yo = /* @__PURE__ */ y.forwardRef(Xo), Jo = Object.freeze({ className: "aq
1615
1637
  reveal: (e) => {
1616
1638
  e.scrollIntoView(tt);
1617
1639
  }
1618
- }), tt = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), si = (e, t) => {
1640
+ }), tt = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), ai = (e, t) => {
1619
1641
  for (let n = t; n !== null && n !== e; n = n.parentElement) {
1620
1642
  const r = n.parentElement;
1621
1643
  if (r instanceof HTMLDetailsElement && n !== r.querySelector(":scope > summary") && (r.open = !0), n.getAttribute("hidden")?.toLowerCase() === "until-found") {
@@ -1623,7 +1645,7 @@ const Yo = /* @__PURE__ */ y.forwardRef(Xo), Jo = Object.freeze({ className: "aq
1623
1645
  n.removeAttribute("hidden");
1624
1646
  }
1625
1647
  }
1626
- }, ai = (e, t) => {
1648
+ }, si = (e, t) => {
1627
1649
  if (t.getClientRects().length === 0) return;
1628
1650
  const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), i = Number.parseFloat(r), l = t.getBoundingClientRect(), u = l.height + i + Number.parseFloat(o) > e.clientHeight;
1629
1651
  if (!u && Math.abs(l.top - i - n) < 1) {
@@ -1636,8 +1658,8 @@ const Yo = /* @__PURE__ */ y.forwardRef(Xo), Jo = Object.freeze({ className: "aq
1636
1658
  n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
1637
1659
  }, qt = (e, t, n) => {
1638
1660
  if (e === null) return null;
1639
- const r = Cn(e, t);
1640
- return r === null ? (ni(t) && ci(e, n), null) : (si(e, r), ai(n.scrollerOf(e, r), r), n.reveal(r), r);
1661
+ const r = On(e, t);
1662
+ return r === null ? (ni(t) && ci(e, n), null) : (ai(e, r), si(n.scrollerOf(e, r), r), n.reveal(r), r);
1641
1663
  };
1642
1664
  function di({
1643
1665
  title: e,
@@ -1728,7 +1750,7 @@ function vi({
1728
1750
  clipRule: "evenodd"
1729
1751
  }));
1730
1752
  }
1731
- const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = Object.freeze({ [nt]: "allow" }), wi = `[${nt}="${rt[nt]}"]`, bi = () => {
1753
+ const wi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = Object.freeze({ [nt]: "allow" }), gi = `[${nt}="${rt[nt]}"]`, bi = () => {
1732
1754
  let e = null;
1733
1755
  return {
1734
1756
  onKeyDownCapture: (t) => {
@@ -1737,7 +1759,7 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1737
1759
  e = t.target instanceof Element ? t.target : null;
1738
1760
  return;
1739
1761
  }
1740
- e !== null && t.target === e && e.closest(wi) !== null || (t.preventDefault(), t.stopPropagation());
1762
+ e !== null && t.target === e && e.closest(gi) !== null || (t.preventDefault(), t.stopPropagation());
1741
1763
  }
1742
1764
  },
1743
1765
  onKeyUpCapture: (t) => {
@@ -1747,7 +1769,7 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1747
1769
  t.target === e && (e = null);
1748
1770
  }
1749
1771
  };
1750
- }, Le = Object.freeze([1 / be ** 2, 1 / be, 1, be, be ** 2]), _t = Object.freeze({ mode: "fit" }), Ei = 1, An = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), Bt = `[data-testid="${An["data-testid"]}"]`, yi = pe(null), xi = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= Ei ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, It = (e, t, n) => {
1772
+ }, Le = Object.freeze([1 / be ** 2, 1 / be, 1, be, be ** 2]), _t = Object.freeze({ mode: "fit" }), Ei = 1, Cn = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), It = `[data-testid="${Cn["data-testid"]}"]`, yi = pe(null), xi = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= Ei ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, Bt = (e, t, n) => {
1751
1773
  if (e.mode === "level") {
1752
1774
  const o = e.index + n;
1753
1775
  return o >= 0 && o < Le.length ? o : null;
@@ -1757,11 +1779,11 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1757
1779
  return r === -1 ? null : r;
1758
1780
  }, zt = (e, t, n) => {
1759
1781
  if (e.mode === "level") {
1760
- const o = It(e, null, n);
1782
+ const o = Bt(e, null, n);
1761
1783
  return o === null ? null : { mode: "level", index: o, base: e.base };
1762
1784
  }
1763
1785
  if (t === null) return null;
1764
- const r = It(e, t.scale, n);
1786
+ const r = Bt(e, t.scale, n);
1765
1787
  return r === null ? null : { mode: "level", index: r, base: t.base };
1766
1788
  }, Si = (e, t) => {
1767
1789
  if (e <= 0 || t <= 0) return 0;
@@ -1774,11 +1796,11 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1774
1796
  const t = Le[e];
1775
1797
  if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
1776
1798
  return t;
1777
- }, Ht = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, Ri = ({ document: e }) => {
1778
- const { labels: t } = D(), n = ne(yi), [r] = I(() => n === null ? null : n.read(e.url)), [o, i] = I(r === null ? _t : r.zoom), [l, u] = I(r === null ? null : r.reported), [m, f] = I(null), d = _(null), h = P((v) => {
1779
- const { naturalWidth: s, naturalHeight: a } = v;
1780
- u((g) => Ht(g, s, a));
1781
- }, []), w = P(
1799
+ }, Ht = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, Ti = ({ document: e }) => {
1800
+ const { labels: t } = D(), n = ne(yi), [r] = B(() => n === null ? null : n.read(e.url)), [o, i] = B(r === null ? _t : r.zoom), [l, u] = B(r === null ? null : r.reported), [m, f] = B(null), d = _(null), h = P((v) => {
1801
+ const { naturalWidth: a, naturalHeight: s } = v;
1802
+ u((w) => Ht(w, a, s));
1803
+ }, []), g = P(
1782
1804
  (v) => {
1783
1805
  d.current = v, !(v === null || !v.complete) && (v.naturalWidth > 0 || v.naturalHeight > 0 ? h(v) : v.decode().then(
1784
1806
  () => h(v),
@@ -1793,47 +1815,47 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1793
1815
  }, [n, e.url, o, l]), H(() => {
1794
1816
  const v = d.current;
1795
1817
  if (v === null || l === null || o.mode !== "fit") return;
1796
- const s = () => f((g) => Ht(g, v.clientWidth, v.clientHeight));
1797
- if (s(), typeof ResizeObserver > "u") return;
1798
- const a = new ResizeObserver(s);
1799
- return a.observe(v), () => a.disconnect();
1818
+ const a = () => f((w) => Ht(w, v.clientWidth, v.clientHeight));
1819
+ if (a(), typeof ResizeObserver > "u") return;
1820
+ const s = new ResizeObserver(a);
1821
+ return s.observe(v), () => s.disconnect();
1800
1822
  }, [l, o.mode]);
1801
- const b = l === null || m === null ? null : xi(l, m), O = zt(o, b, -1), T = zt(o, b, 1), S = o.mode === "level" ? ki(o.index) : null, M = _({ zoomIn: T, zoomOut: O });
1823
+ const b = l === null || m === null ? null : xi(l, m), M = zt(o, b, -1), R = zt(o, b, 1), S = o.mode === "level" ? ki(o.index) : null, A = _({ zoomIn: R, zoomOut: M });
1802
1824
  H(() => {
1803
- M.current = { zoomIn: T, zoomOut: O };
1825
+ A.current = { zoomIn: R, zoomOut: M };
1804
1826
  });
1805
1827
  const L = _(null);
1806
1828
  H(() => {
1807
- const v = L.current, s = d.current?.closest(Bt);
1808
- L.current = null, !(v === null || s === null || s === void 0) && (s.scrollLeft = v.across * s.scrollWidth - v.x, s.scrollTop = v.down * s.scrollHeight - v.y);
1829
+ const v = L.current, a = d.current?.closest(It);
1830
+ L.current = null, !(v === null || a === null || a === void 0) && (a.scrollLeft = v.across * a.scrollWidth - v.x, a.scrollTop = v.down * a.scrollHeight - v.y);
1809
1831
  }, [o]), te(() => {
1810
- const v = d.current?.closest(Bt);
1832
+ const v = d.current?.closest(It);
1811
1833
  if (v == null) return;
1812
- let s = null;
1813
- const a = (A) => {
1814
- const N = jt(A.touches);
1815
- s = N === null ? null : { distance: N.distance, steps: 0 };
1816
- }, g = (A) => {
1817
- const N = jt(A.touches);
1818
- if (s === null || N === null) return;
1819
- A.preventDefault();
1820
- const q = Si(s.distance, N.distance);
1821
- if (q === s.steps) return;
1822
- const W = q > s.steps ? 1 : -1, z = W === 1 ? M.current.zoomIn : M.current.zoomOut;
1834
+ let a = null;
1835
+ const s = (C) => {
1836
+ const N = jt(C.touches);
1837
+ a = N === null ? null : { distance: N.distance, steps: 0 };
1838
+ }, w = (C) => {
1839
+ const N = jt(C.touches);
1840
+ if (a === null || N === null) return;
1841
+ C.preventDefault();
1842
+ const q = Si(a.distance, N.distance);
1843
+ if (q === a.steps) return;
1844
+ const W = q > a.steps ? 1 : -1, z = W === 1 ? A.current.zoomIn : A.current.zoomOut;
1823
1845
  if (z === null) return;
1824
- s.steps += W;
1846
+ a.steps += W;
1825
1847
  const j = v.getBoundingClientRect(), Y = N.middle.x - j.left, V = N.middle.y - j.top;
1826
1848
  L.current = v.scrollWidth > 0 && v.scrollHeight > 0 ? { x: Y, y: V, across: (v.scrollLeft + Y) / v.scrollWidth, down: (v.scrollTop + V) / v.scrollHeight } : null, i(z);
1827
- }, R = (A) => {
1828
- A.touches.length < 2 && (s = null);
1849
+ }, T = (C) => {
1850
+ C.touches.length < 2 && (a = null);
1829
1851
  };
1830
- return v.addEventListener("touchstart", a, { passive: !0 }), v.addEventListener("touchmove", g, { passive: !1 }), v.addEventListener("touchend", R, { passive: !0 }), v.addEventListener("touchcancel", R, { passive: !0 }), () => {
1831
- v.removeEventListener("touchstart", a), v.removeEventListener("touchmove", g), v.removeEventListener("touchend", R), v.removeEventListener("touchcancel", R);
1852
+ return v.addEventListener("touchstart", s, { passive: !0 }), v.addEventListener("touchmove", w, { passive: !1 }), v.addEventListener("touchend", T, { passive: !0 }), v.addEventListener("touchcancel", T, { passive: !0 }), () => {
1853
+ v.removeEventListener("touchstart", s), v.removeEventListener("touchmove", w), v.removeEventListener("touchend", T), v.removeEventListener("touchcancel", T);
1832
1854
  };
1833
1855
  }, []);
1834
1856
  const E = o.mode === "level" && S !== null ? { width: `${o.base.width * S}px`, height: `${o.base.height * S}px` } : void 0;
1835
1857
  return /* @__PURE__ */ F("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1836
- /* @__PURE__ */ F(qe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ c(gi, {}), children: [
1858
+ /* @__PURE__ */ F(qe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ c(wi, {}), children: [
1837
1859
  /* @__PURE__ */ c(
1838
1860
  "button",
1839
1861
  {
@@ -1841,9 +1863,9 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1841
1863
  className: "aqmx-icon-button",
1842
1864
  "aria-label": t.imageZoomOut,
1843
1865
  title: t.imageZoomOut,
1844
- "aria-disabled": O === null,
1866
+ "aria-disabled": M === null,
1845
1867
  onClick: () => {
1846
- O !== null && i(O);
1868
+ M !== null && i(M);
1847
1869
  },
1848
1870
  ...rt,
1849
1871
  children: /* @__PURE__ */ c(mi, {})
@@ -1857,9 +1879,9 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1857
1879
  className: "aqmx-icon-button",
1858
1880
  "aria-label": t.imageZoomIn,
1859
1881
  title: t.imageZoomIn,
1860
- "aria-disabled": T === null,
1882
+ "aria-disabled": R === null,
1861
1883
  onClick: () => {
1862
- T !== null && i(T);
1884
+ R !== null && i(R);
1863
1885
  },
1864
1886
  ...rt,
1865
1887
  children: /* @__PURE__ */ c(pi, {})
@@ -1867,21 +1889,21 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1867
1889
  ),
1868
1890
  /* @__PURE__ */ c("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => i(_t), children: /* @__PURE__ */ c(ui, {}) })
1869
1891
  ] }),
1870
- /* @__PURE__ */ c(ve, { scrollerProps: An, children: /* @__PURE__ */ c("img", { ref: w, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: E, onLoad: (v) => h(v.currentTarget), "data-testid": "markdown-explorer-image" }) })
1892
+ /* @__PURE__ */ c(ve, { scrollerProps: Cn, children: /* @__PURE__ */ c("img", { ref: g, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: E, onLoad: (v) => h(v.currentTarget), "data-testid": "markdown-explorer-image" }) })
1871
1893
  ] });
1872
- }, Ln = pe(null), Be = pe(void 0), Mn = pe(null), Ie = () => {
1894
+ }, Ln = pe(null), Ie = pe(void 0), An = pe(null), Be = () => {
1873
1895
  const e = ne(Ln);
1874
1896
  if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
1875
1897
  return e;
1876
- }, Ti = () => {
1877
- const e = ne(Mn);
1898
+ }, Ri = () => {
1899
+ const e = ne(An);
1878
1900
  if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
1879
1901
  return e;
1880
- }, ze = (e, t, n, r) => t.kind === "panel" ? ye(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? ye(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : ye(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), Oi = ({ children: e }) => {
1881
- const { config: t } = D(), n = Ie(), r = lt(), o = r.kind === "location" ? r.location.source : void 0, i = $e(ze(t, n.navigation, o, n.currentPath));
1882
- return /* @__PURE__ */ c(Be, { value: o, children: /* @__PURE__ */ c(Mn, { value: i, children: e }) });
1883
- }, Ci = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', Ai = (e) => {
1884
- const t = e instanceof Element ? e.closest(Ci) : null;
1902
+ }, ze = (e, t, n, r) => t.kind === "panel" ? ye(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? ye(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : ye(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), Mi = ({ children: e }) => {
1903
+ const { config: t } = D(), n = Be(), r = lt(), o = r.kind === "location" ? r.location.source : void 0, i = $e(ze(t, n.navigation, o, n.currentPath));
1904
+ return /* @__PURE__ */ c(Ie, { value: o, children: /* @__PURE__ */ c(An, { value: i, children: e }) });
1905
+ }, Oi = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', Ci = (e) => {
1906
+ const t = e instanceof Element ? e.closest(Oi) : null;
1885
1907
  return t === null ? null : t.getAttribute("data-doc-path");
1886
1908
  }, je = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, Li = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: i, onDocumentLink: l, scope: u, children: m }) => {
1887
1909
  const f = $e(e);
@@ -1894,9 +1916,9 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1894
1916
  l(t, n);
1895
1917
  }
1896
1918
  }, children: m });
1897
- }, Mi = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: i }) => {
1898
- const { config: l } = D(), u = Ie(), m = ne(Be), f = ei(e), { navigation: d } = u, h = `${ze(l, d, m, t)}${f}`, w = n === !1 ? "false" : void 0;
1899
- return d.kind === "page" ? /* @__PURE__ */ c(Ao, { ...o, to: h, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": w, children: i }) : /* @__PURE__ */ c(Li, { to: h, docPath: t, fragment: f, exists: w, className: r, attributes: o, onDocumentLink: d.onDocumentLink, scope: u, children: i });
1919
+ }, Ai = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: i }) => {
1920
+ const { config: l } = D(), u = Be(), m = ne(Ie), f = ei(e), { navigation: d } = u, h = `${ze(l, d, m, t)}${f}`, g = n === !1 ? "false" : void 0;
1921
+ return d.kind === "page" ? /* @__PURE__ */ c(Co, { ...o, to: h, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": g, children: i }) : /* @__PURE__ */ c(Li, { to: h, docPath: t, fragment: f, exists: g, className: r, attributes: o, onDocumentLink: d.onDocumentLink, scope: u, children: i });
1900
1922
  }, Ni = ({ className: e, attributes: t, children: n }) => {
1901
1923
  const { labels: r } = D();
1902
1924
  return (
@@ -1910,31 +1932,31 @@ const gi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1910
1932
  ] })
1911
1933
  );
1912
1934
  }, Di = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
1913
- const { config: i } = D(), l = ne(Be), u = $e(`${ze(i, r.navigation, l, r.currentPath)}${e}`);
1935
+ const { config: i } = D(), l = ne(Ie), u = $e(`${ze(i, r.navigation, l, r.currentPath)}${e}`);
1914
1936
  return /* @__PURE__ */ c("a", { ...n, href: u, className: t, onClick: (f) => {
1915
1937
  je(f) && (f.preventDefault(), r.scrollWithin(e));
1916
1938
  }, children: o });
1917
1939
  }, Pi = ({ href: e, className: t, attributes: n, children: r }) => {
1918
- const o = Ie();
1940
+ const o = Be();
1919
1941
  return o.navigation.kind === "page" ? /* @__PURE__ */ c("a", { ...n, href: e, className: t, onClick: (l) => {
1920
1942
  if (!je(l)) return;
1921
1943
  const u = l.currentTarget;
1922
1944
  e === "#" ? o.followEmptyFragment(l.nativeEvent) : u.href === u.ownerDocument.URL && o.followSameUrlJump(e, l.nativeEvent);
1923
1945
  }, children: r }) : /* @__PURE__ */ c(Di, { href: e, className: t, attributes: n, scope: o, children: r });
1924
- }, $i = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: i, children: l }) => t === "doc" ? n === void 0 || !tr(n) ? /* @__PURE__ */ c(Ni, { className: o, attributes: i, children: l }) : /* @__PURE__ */ c(Mi, { href: e, docPath: n, docExists: r, className: o, attributes: i, children: l }) : e.startsWith("#") ? /* @__PURE__ */ c(Pi, { href: e, className: o, attributes: i, children: l }) : /* @__PURE__ */ c("a", { ...i, href: e, className: o, children: l }), Fi = () => {
1925
- const { config: e } = D(), t = Ie(), n = ne(Be), r = Fe();
1946
+ }, $i = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: i, children: l }) => t === "doc" ? n === void 0 || !tr(n) ? /* @__PURE__ */ c(Ni, { className: o, attributes: i, children: l }) : /* @__PURE__ */ c(Ai, { href: e, docPath: n, docExists: r, className: o, attributes: i, children: l }) : e.startsWith("#") ? /* @__PURE__ */ c(Pi, { href: e, className: o, attributes: i, children: l }) : /* @__PURE__ */ c("a", { ...i, href: e, className: o, children: l }), Fi = () => {
1947
+ const { config: e } = D(), t = Be(), n = ne(Ie), r = Fe();
1926
1948
  return P(
1927
1949
  (o, i) => {
1928
1950
  if (!je(i)) return !0;
1929
1951
  i.preventDefault();
1930
- const l = Tn(o.id), { navigation: u } = t;
1952
+ const l = Rn(o.id), { navigation: u } = t;
1931
1953
  return u.kind === "panel" || ct(i.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(l), !0) : (r(`${ze(e, u, n, t.currentPath)}${l}`, "follow-link"), !0);
1932
1954
  },
1933
1955
  [e, t, n, r]
1934
1956
  );
1935
1957
  }, qi = () => {
1936
- const e = Ti();
1937
- return P((t) => `${e}${Tn(t.id)}`, [e]);
1958
+ const e = Ri();
1959
+ return P((t) => `${e}${Rn(t.id)}`, [e]);
1938
1960
  };
1939
1961
  function _i({
1940
1962
  title: e,
@@ -1955,8 +1977,8 @@ function _i({
1955
1977
  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"
1956
1978
  }));
1957
1979
  }
1958
- const Bi = /* @__PURE__ */ y.forwardRef(_i);
1959
- function Ii({
1980
+ const Ii = /* @__PURE__ */ y.forwardRef(_i);
1981
+ function Bi({
1960
1982
  title: e,
1961
1983
  titleId: t,
1962
1984
  ...n
@@ -1977,7 +1999,7 @@ function Ii({
1977
1999
  clipRule: "evenodd"
1978
2000
  }));
1979
2001
  }
1980
- const zi = /* @__PURE__ */ y.forwardRef(Ii);
2002
+ const zi = /* @__PURE__ */ y.forwardRef(Bi);
1981
2003
  function ji({
1982
2004
  title: e,
1983
2005
  titleId: t,
@@ -2016,7 +2038,7 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2016
2038
  case "audio":
2017
2039
  return /* @__PURE__ */ c(Hi, {});
2018
2040
  case "pdf":
2019
- return /* @__PURE__ */ c(Bi, {});
2041
+ return /* @__PURE__ */ c(Ii, {});
2020
2042
  default: {
2021
2043
  const t = e;
2022
2044
  throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`);
@@ -2064,15 +2086,25 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2064
2086
  alignCenter: e.viewerAlignCenter,
2065
2087
  alignRight: e.viewerAlignRight,
2066
2088
  mermaidInteractionMode: e.viewerMermaidInteractionMode,
2089
+ mermaidInteractionModeTouch: e.viewerMermaidInteractionModeTouch,
2067
2090
  mermaidModeNone: e.viewerMermaidModeNone,
2068
2091
  mermaidModeZoom: e.viewerMermaidModeZoom,
2069
2092
  mermaidModePan: e.viewerMermaidModePan,
2070
2093
  mermaidModePanShift: e.viewerMermaidModePanShift,
2071
2094
  mermaidModeBoth: e.viewerMermaidModeBoth,
2072
2095
  mermaidModeBothShift: e.viewerMermaidModeBothShift,
2096
+ mermaidModeNoneTouch: e.viewerMermaidModeNoneTouch,
2097
+ mermaidModeZoomTouch: e.viewerMermaidModeZoomTouch,
2098
+ mermaidModePanTouch: e.viewerMermaidModePanTouch,
2099
+ mermaidModeBothTouch: e.viewerMermaidModeBothTouch,
2073
2100
  mermaidZoomIn: e.viewerMermaidZoomIn,
2074
2101
  mermaidZoomOut: e.viewerMermaidZoomOut,
2075
2102
  mermaidResetView: e.viewerMermaidResetView,
2103
+ mermaidPanUp: e.viewerMermaidPanUp,
2104
+ mermaidPanDown: e.viewerMermaidPanDown,
2105
+ mermaidPanLeft: e.viewerMermaidPanLeft,
2106
+ mermaidPanRight: e.viewerMermaidPanRight,
2107
+ mermaidDiagram: e.viewerMermaidDiagram,
2076
2108
  mermaidRetry: e.viewerMermaidRetry,
2077
2109
  embeddedVideo: e.viewerEmbeddedVideo,
2078
2110
  embeddedPost: e.viewerEmbeddedPost,
@@ -2098,16 +2130,16 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2098
2130
  }, tl = ({ absence: e, announces: t, announceFailure: n }) => {
2099
2131
  const { labels: r, announcer: o } = D(), i = e.kind === "no-readme" ? e.folder : null, l = e.kind === "failure" ? e.folder : null, u = e.kind === "failure" ? e.failure : null;
2100
2132
  switch (te(() => {
2101
- t && i !== null && o.announce(r.folderReadmeMissing(ae(i)));
2133
+ t && i !== null && o.announce(r.folderReadmeMissing(se(i)));
2102
2134
  }, [t, i, o, r]), te(() => {
2103
- l !== null && u !== null && n(r.documentFailed(ae(l), se(r, u.reason)));
2135
+ l !== null && u !== null && n(r.documentFailed(se(l), ae(r, u.reason)));
2104
2136
  }, [l, u, n, r]), e.kind) {
2105
2137
  case "empty":
2106
2138
  return /* @__PURE__ */ c(xe, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-document-empty", children: /* @__PURE__ */ c("p", { className: "aqmx-empty-title", children: r.documentEmpty }) }) });
2107
2139
  case "loading":
2108
2140
  return /* @__PURE__ */ c(ut, { label: r.documentRegion });
2109
2141
  case "no-readme":
2110
- return /* @__PURE__ */ c(xe, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-folder-empty", children: /* @__PURE__ */ c("p", { className: "aqmx-empty-title", children: r.folderReadmeMissing(ae(e.folder)) }) }) });
2142
+ return /* @__PURE__ */ c(xe, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-folder-empty", children: /* @__PURE__ */ c("p", { className: "aqmx-empty-title", children: r.folderReadmeMissing(se(e.folder)) }) }) });
2111
2143
  case "failure":
2112
2144
  return /* @__PURE__ */ c(xe, { kind: "failure", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c(ve, { scrollerProps: ft, children: /* @__PURE__ */ c(me, { failure: e.failure, alert: !1, onRetry: e.onRetry, testId: "markdown-explorer-folder-failure" }) }) });
2113
2145
  }
@@ -2118,71 +2150,71 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2118
2150
  /* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: t.documentLoading })
2119
2151
  ] });
2120
2152
  }, Vt = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), nl = ({ path: e, document: t, viewer: n, editing: r }) => {
2121
- const { reportMathDiagnostics: o, edits: i } = D(), l = G(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), u = Fi(), m = qi(), f = G(() => o === void 0 ? void 0 : (s) => o(e, s), [o, e]), d = _(null), { editable: h, doubleClick: w, region: b, paneScroll: O, stale: T } = r;
2153
+ const { reportMathDiagnostics: o, edits: i } = D(), l = G(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), u = Fi(), m = qi(), f = G(() => o === void 0 ? void 0 : (a) => o(e, a), [o, e]), d = _(null), { editable: h, doubleClick: g, region: b, paneScroll: M, stale: R } = r;
2122
2154
  H(() => {
2123
2155
  if (h)
2124
2156
  return i.bindView(e, {
2125
2157
  anchor: () => {
2126
- const s = d.current, a = b(), g = s === null ? null : s.querySelector(_e);
2127
- return s === null || a === null || g === null ? null : xo(s, O.scrollerOf(a, g));
2158
+ const a = d.current, s = b(), w = a === null ? null : a.querySelector(_e);
2159
+ return a === null || s === null || w === null ? null : xo(a, M.scrollerOf(s, w));
2128
2160
  }
2129
2161
  });
2130
- }, [i, e, h, b, O]);
2131
- const S = (s) => {
2132
- const a = d.current, { target: g } = s;
2133
- !w || a === null || !(g instanceof Element) || !Eo(g) || (s.stopPropagation(), i.start(e, yo(g, a, a.ownerDocument.getSelection())));
2134
- }, M = _(null), L = _(T);
2162
+ }, [i, e, h, b, M]);
2163
+ const S = (a) => {
2164
+ const s = d.current, { target: w } = a;
2165
+ !g || s === null || !(w instanceof Element) || !Eo(w) || (a.stopPropagation(), i.start(e, yo(w, s, s.ownerDocument.getSelection())));
2166
+ }, A = _(null), L = _(R);
2135
2167
  H(() => {
2136
- L.current = T;
2168
+ L.current = R;
2137
2169
  });
2138
- const E = le((s) => {
2139
- const a = d.current, g = b(), R = a === null ? null : Oo(a, s.line);
2140
- if (g === null || R === null) return !1;
2141
- const A = O.scrollerOf(g, R);
2142
- return A.scrollTop += Co(R, s.line) - s.clientTop, !0;
2143
- }), v = le((s) => {
2144
- const a = b();
2145
- if (a === null) return;
2146
- const g = () => {
2147
- for (const A of Vt) a.removeEventListener(A, R, !0);
2148
- M.current?.release === g && (M.current = null);
2149
- }, R = () => g();
2150
- for (const A of Vt) a.addEventListener(A, R, { capture: !0, passive: !0 });
2151
- M.current = { point: s, release: g };
2170
+ const E = le((a) => {
2171
+ const s = d.current, w = b(), T = s === null ? null : Mo(s, a.line);
2172
+ if (w === null || T === null) return !1;
2173
+ const C = M.scrollerOf(w, T);
2174
+ return C.scrollTop += Oo(T, a.line) - a.clientTop, !0;
2175
+ }), v = le((a) => {
2176
+ const s = b();
2177
+ if (s === null) return;
2178
+ const w = () => {
2179
+ for (const C of Vt) s.removeEventListener(C, T, !0);
2180
+ A.current?.release === w && (A.current = null);
2181
+ }, T = () => w();
2182
+ for (const C of Vt) s.addEventListener(C, T, { capture: !0, passive: !0 });
2183
+ A.current = { point: a, release: w };
2152
2184
  });
2153
2185
  return H(() => {
2154
- const s = i.takeReturn(e);
2155
- if (s !== null)
2186
+ const a = i.takeReturn(e);
2187
+ if (a !== null)
2156
2188
  return queueMicrotask(() => {
2157
- E(s) && L.current && v(s);
2158
- }), () => M.current?.release();
2189
+ E(a) && L.current && v(a);
2190
+ }), () => A.current?.release();
2159
2191
  }, [i, e]), H(() => {
2160
- const s = M.current;
2161
- s === null || T || (s.release(), E(s.point));
2162
- }, [t, T]),
2163
- /* @__PURE__ */ c("div", { ref: d, className: "aqmx-document-viewer", onDoubleClick: S, children: /* @__PURE__ */ c(sn, { ...n, onHeadingSelect: u, headingHref: m, onMathDiagnostics: f, parseResult: l, content: null }) });
2192
+ const a = A.current;
2193
+ a === null || R || (a.release(), E(a.point));
2194
+ }, [t, R]),
2195
+ /* @__PURE__ */ c("div", { ref: d, className: "aqmx-document-viewer", onDoubleClick: S, children: /* @__PURE__ */ c(an, { ...n, onHeadingSelect: u, headingHref: m, onMathDiagnostics: f, parseResult: l, content: null }) });
2164
2196
  }, Pn = ({ document: e, viewer: t }) => {
2165
2197
  const { labels: n } = D();
2166
2198
  return /* @__PURE__ */ F(Pe, { children: [
2167
2199
  /* @__PURE__ */ c(qe, { name: e.name, openUrl: nr(e.url), downloadUrl: e.url, icon: /* @__PURE__ */ c(uo, {}), children: e.truncated ? null : /* @__PURE__ */ c(Vo, { text: e.text }) }),
2168
2200
  e.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
2169
- /* @__PURE__ */ c("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ c(sn, { ...t, parseResult: null, content: e.text }) })
2201
+ /* @__PURE__ */ c("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ c(an, { ...t, parseResult: null, content: e.text }) })
2170
2202
  ] });
2171
2203
  }, rl = ({ path: e, name: t, viewer: n }) => {
2172
- const { data: r, documents: o, announcer: i, labels: l } = D(), u = P(() => o.answerStampOf(e), [o, e]), m = ee(o.subscribe, u, u), [f, d] = I(0), h = G(() => ({ path: e, stamp: m, attempt: f }), [e, m, f]), [w, b] = I(null), O = le((S) => {
2173
- b(S), S.kind === "failure" && i.announce(l.documentFailed(t, se(l, S.failure.reason)));
2204
+ const { data: r, documents: o, announcer: i, labels: l } = D(), u = P(() => o.answerStampOf(e), [o, e]), m = ee(o.subscribe, u, u), [f, d] = B(0), h = G(() => ({ path: e, stamp: m, attempt: f }), [e, m, f]), [g, b] = B(null), M = le((S) => {
2205
+ b(S), S.kind === "failure" && i.announce(l.documentFailed(t, ae(l, S.failure.reason)));
2174
2206
  });
2175
2207
  te(() => {
2176
2208
  const S = new AbortController();
2177
- return r.text(h.path, S.signal).then((M) => {
2178
- "kind" in M && O(M);
2209
+ return r.text(h.path, S.signal).then((A) => {
2210
+ "kind" in A && M(A);
2179
2211
  }), () => S.abort();
2180
2212
  }, [r, h]);
2181
- const T = P(() => d((S) => S + 1), []);
2182
- return w === null ? /* @__PURE__ */ F(Pe, { children: [
2213
+ const R = P(() => d((S) => S + 1), []);
2214
+ return g === null ? /* @__PURE__ */ F(Pe, { children: [
2183
2215
  /* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-markup-skeleton", children: dt.map((S) => /* @__PURE__ */ c("span", {}, S)) }),
2184
2216
  /* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: l.markupLoading })
2185
- ] }) : w.kind === "failure" ? /* @__PURE__ */ c(ve, { scrollerProps: ft, children: /* @__PURE__ */ c(me, { failure: w.failure, alert: !1, onRetry: T, testId: "markdown-explorer-markup-failure" }) }) : /* @__PURE__ */ c(Pn, { document: w, viewer: n });
2217
+ ] }) : g.kind === "failure" ? /* @__PURE__ */ c(ve, { scrollerProps: ft, children: /* @__PURE__ */ c(me, { failure: g.failure, alert: !1, onRetry: R, testId: "markdown-explorer-markup-failure" }) }) : /* @__PURE__ */ c(Pn, { document: g, viewer: n });
2186
2218
  }, ft = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), ol = Object.freeze({ reason: "failed" }), il = (e) => /* @__PURE__ */ c(
2187
2219
  ho,
2188
2220
  {
@@ -2207,7 +2239,7 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2207
2239
  case "text":
2208
2240
  return /* @__PURE__ */ c(Pn, { document: t, viewer: r });
2209
2241
  case "image":
2210
- return /* @__PURE__ */ c(Ri, { document: t });
2242
+ return /* @__PURE__ */ c(Ti, { document: t });
2211
2243
  case "media":
2212
2244
  return /* @__PURE__ */ c(Yi, { document: t });
2213
2245
  case "file":
@@ -2219,8 +2251,8 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2219
2251
  throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(l)}`);
2220
2252
  }
2221
2253
  }
2222
- }, sl = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', al = (e, t, n) => {
2223
- const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : Cn(e, n), r === void 0 ? null : On(e, r.id), e.querySelector(_e), e.querySelector(sl)];
2254
+ }, al = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', sl = (e, t, n) => {
2255
+ const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : On(e, n), r === void 0 ? null : Mn(e, r.id), e.querySelector(_e), e.querySelector(al)];
2224
2256
  for (const i of o)
2225
2257
  if (i instanceof HTMLElement && xn(i)) return i;
2226
2258
  return null;
@@ -2235,17 +2267,17 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2235
2267
  const r = n.ownerDocument, o = r.defaultView;
2236
2268
  if (o === null) throw new Error("[markdown-explorer] the document region's document has no window");
2237
2269
  let i = !1, l;
2238
- const u = (w) => {
2239
- i = !(w.target instanceof Node && n.contains(w.target)), i && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(l), l = setTimeout(() => {
2270
+ const u = (g) => {
2271
+ i = !(g.target instanceof Node && n.contains(g.target)), i && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(l), l = setTimeout(() => {
2240
2272
  i = !1;
2241
2273
  }, 0);
2242
- }, m = (w) => {
2243
- t.current = w.target instanceof Node && n.contains(w.target);
2244
- }, f = (w) => {
2245
- w.relatedTarget === null && i && (t.current = !1);
2274
+ }, m = (g) => {
2275
+ t.current = g.target instanceof Node && n.contains(g.target);
2276
+ }, f = (g) => {
2277
+ g.relatedTarget === null && i && (t.current = !1);
2246
2278
  }, d = () => {
2247
- const { activeElement: w, body: b } = r;
2248
- w !== null && w !== b && (t.current = n.contains(w));
2279
+ const { activeElement: g, body: b } = r;
2280
+ g !== null && g !== b && (t.current = n.contains(g));
2249
2281
  }, h = () => {
2250
2282
  i && !n.contains(r.activeElement) && (t.current = !1);
2251
2283
  };
@@ -2253,61 +2285,61 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2253
2285
  clearTimeout(l), o.removeEventListener("pointerdown", u, !0), o.removeEventListener("mousedown", u, !0), o.removeEventListener("focusin", m, !0), o.removeEventListener("blur", d), o.removeEventListener("focus", h), n.removeEventListener("focusout", f);
2254
2286
  };
2255
2287
  }, [e]), t;
2256
- }, dl = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: i, regionLabel: l, navigation: u, fragment: m, paneScroll: f, announces: d, announceFailure: h, onDocumentShown: w }) => {
2257
- const { labels: b, announcer: O, documents: T } = D(), { document: S } = t, M = _(null), L = _(null), E = _(null), v = _(0), s = cl(M), a = _({ path: e, document: S }), g = _(null), R = P(
2288
+ }, dl = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: i, regionLabel: l, navigation: u, fragment: m, paneScroll: f, announces: d, announceFailure: h, onDocumentShown: g }) => {
2289
+ const { labels: b, announcer: M, documents: R } = D(), { document: S } = t, A = _(null), L = _(null), E = _(null), v = _(0), a = cl(A), s = _({ path: e, document: S }), w = _(null), T = P(
2258
2290
  (Z) => {
2259
- const X = M.current, Q = qt(X, Z, f);
2260
- X !== null && Q !== null && Ut(X, Q, s.current);
2291
+ const X = A.current, Q = qt(X, Z, f);
2292
+ X !== null && Q !== null && Ut(X, Q, a.current);
2261
2293
  },
2262
- [f, s]
2263
- ), A = P(
2294
+ [f, a]
2295
+ ), C = P(
2264
2296
  (Z, X) => {
2265
2297
  const Q = v.current;
2266
2298
  setTimeout(() => {
2267
- !X.defaultPrevented && v.current === Q && R(Z);
2299
+ !X.defaultPrevented && v.current === Q && T(Z);
2268
2300
  }, 0);
2269
2301
  },
2270
- [R]
2302
+ [T]
2271
2303
  ), N = P(
2272
2304
  (Z) => {
2273
2305
  setTimeout(() => {
2274
- Z.defaultPrevented || R("#");
2306
+ Z.defaultPrevented || T("#");
2275
2307
  }, 0);
2276
2308
  },
2277
- [R]
2278
- ), q = G(() => ({ navigation: u, currentPath: e, scrollWithin: R, followSameUrlJump: A, followEmptyFragment: N }), [u, e, R, A, N]), W = P(() => T.retry(e), [T, e]), z = Lo(T, Ai), j = bn(e), Y = j !== void 0 ? "edit" : n ? "markup" : "rendered", V = S.kind === "markdown" ? Y : void 0, re = P(() => M.current, []), p = G(() => ({ session: j, layout: i, region: re, paneScroll: f, stale: r }), [j, i, re, f, r]), x = V === "edit" ? !1 : r, k = ne(he), C = V === "edit" && i === "fill" ? "fill" : k, $ = le((Z, X) => {
2309
+ [T]
2310
+ ), q = G(() => ({ navigation: u, currentPath: e, scrollWithin: T, followSameUrlJump: C, followEmptyFragment: N }), [u, e, T, C, N]), W = P(() => R.retry(e), [R, e]), z = Lo(R, Ci), j = bn(e), Y = j !== void 0 ? "edit" : n ? "markup" : "rendered", V = S.kind === "markdown" ? Y : void 0, re = P(() => A.current, []), p = G(() => ({ session: j, layout: i, region: re, paneScroll: f, stale: r }), [j, i, re, f, r]), x = V === "edit" ? !1 : r, k = ne(he), O = V === "edit" && i === "fill" ? "fill" : k, $ = le((Z, X) => {
2279
2311
  const Q = L.current;
2280
2312
  if (Q !== null && Q.path === Z && Q.snapshot === X) return;
2281
2313
  L.current = { path: Z, snapshot: X };
2282
2314
  const oe = X.document;
2283
2315
  if (oe.kind === "failure") {
2284
- T.noteFailureShown(X) && h(b.documentFailed(ae(Z), se(b, oe.failure.reason)));
2316
+ R.noteFailureShown(X) && h(b.documentFailed(se(Z), ae(b, oe.failure.reason)));
2285
2317
  return;
2286
2318
  }
2287
- w?.(Z, oe), d && (Q === null || Q.path !== Z || Q.snapshot.document.kind === "failure") && O.announce(b.documentShown(oe.name));
2319
+ g?.(Z, oe), d && (Q === null || Q.path !== Z || Q.snapshot.document.kind === "failure") && M.announce(b.documentShown(oe.name));
2288
2320
  });
2289
2321
  te(() => {
2290
2322
  $(e, t);
2291
2323
  }, [e, t]);
2292
- const B = le(() => {
2324
+ const I = le(() => {
2293
2325
  m.kind === "panel" && m.consume();
2294
2326
  }), K = le((Z) => {
2295
- const X = M.current;
2296
- if (X === null || !s.current) return null;
2327
+ const X = A.current;
2328
+ if (X === null || !a.current) return null;
2297
2329
  const { activeElement: Q, body: oe } = X.ownerDocument;
2298
- return Q !== null && Q !== oe ? null : al(X, S, Z);
2330
+ return Q !== null && Q !== oe ? null : sl(X, S, Z);
2299
2331
  }), U = le((Z) => {
2300
- const X = M.current;
2301
- X !== null && Ut(X, Z, s.current);
2302
- }), ie = le((Z) => f.reveal(Z)), ht = le((Z) => qt(M.current, Z, f));
2332
+ const X = A.current;
2333
+ X !== null && Ut(X, Z, a.current);
2334
+ }), ie = le((Z) => f.reveal(Z)), ht = le((Z) => qt(A.current, Z, f));
2303
2335
  return te(() => {
2304
2336
  if (r) return;
2305
- const Z = a.current.path !== e, X = Z || a.current.document !== S;
2306
- a.current = { path: e, document: S };
2307
- const Q = g.current !== e;
2308
- g.current = e;
2337
+ const Z = s.current.path !== e, X = Z || s.current.document !== S;
2338
+ s.current = { path: e, document: S };
2339
+ const Q = w.current !== e;
2340
+ w.current = e;
2309
2341
  let oe = null;
2310
- m.kind === "page" ? E.current !== m.navigation && (E.current = m.navigation, v.current += 1, oe = m.fragment) : m.fragment !== null && (oe = m.fragment, B());
2342
+ m.kind === "page" ? E.current !== m.navigation && (E.current = m.navigation, v.current += 1, oe = m.fragment) : m.fragment !== null && (oe = m.fragment, I());
2311
2343
  const pt = () => {
2312
2344
  const He = oe === null ? null : ht(oe);
2313
2345
  if (!X) {
@@ -2318,7 +2350,7 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2318
2350
  Z && He === null && vt !== null && ie(vt);
2319
2351
  };
2320
2352
  Q ? queueMicrotask(pt) : pt();
2321
- }, [m, e, S, r]), /* @__PURE__ */ c(he, { value: C, children: /* @__PURE__ */ c(xe, { kind: S.kind, view: V, label: l(e, S), stale: x, busy: x, frameRef: M, intent: z, children: /* @__PURE__ */ c(Ln, { value: q, children: /* @__PURE__ */ c(Oi, { children: /* @__PURE__ */ c(ll, { path: e, document: S, view: Y, viewer: o, onRetry: W, editing: p }, e) }) }) }) });
2353
+ }, [m, e, S, r]), /* @__PURE__ */ c(he, { value: O, children: /* @__PURE__ */ c(xe, { kind: S.kind, view: V, label: l(e, S), stale: x, busy: x, frameRef: A, intent: z, children: /* @__PURE__ */ c(Ln, { value: q, children: /* @__PURE__ */ c(Mi, { children: /* @__PURE__ */ c(ll, { path: e, document: S, view: Y, viewer: o, onRetry: W, editing: p }, e) }) }) }) });
2322
2354
  }, mt = Object.freeze({ kind: "skeleton" }), ul = (e, t, n, r, o) => {
2323
2355
  if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
2324
2356
  const i = ue(t);
@@ -2330,26 +2362,26 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2330
2362
  const o = t.kind === "streaming" ? fl(t.path, ne(t.promise)) : t;
2331
2363
  return o.kind !== "document" ? /* @__PURE__ */ c(ut, { label: r.regionLabel(e, null) }) : /* @__PURE__ */ c(dl, { path: o.path, snapshot: o.snapshot, markup: n, stale: o.stale, ...r });
2332
2364
  }, $n = ({ path: e, absence: t, markup: n, display: r, navigation: o, fragment: i, paneScroll: l, announces: u, announceFailure: m, onDocumentShown: f }) => {
2333
- const { config: d, labels: h, theme: w, documents: b } = D(), O = br(), T = _(!1);
2365
+ const { config: d, labels: h, theme: g, documents: b } = D(), M = br(), R = _(!1);
2334
2366
  H(() => {
2335
- T.current = !0;
2367
+ R.current = !0;
2336
2368
  }, []);
2337
- const [S, M] = I(null), [L, E] = I(n), v = P(() => e === null ? void 0 : b.peek(e), [b, e]), s = ee(b.subscribe, v, v), a = P(() => S === null ? void 0 : b.peek(S), [b, S]), g = ee(b.subscribe, a, a);
2369
+ const [S, A] = B(null), [L, E] = B(n), v = P(() => e === null ? void 0 : b.peek(e), [b, e]), a = ee(b.subscribe, v, v), s = P(() => S === null ? void 0 : b.peek(S), [b, S]), w = ee(b.subscribe, s, s);
2338
2370
  H(() => e === null ? void 0 : b.open(e), [b, e]), H(() => S === null ? void 0 : b.retain(S), [b, S]);
2339
- const R = e === null ? mt : ul(e, s, S, g, !T.current), A = e === null ? null : R.kind === "document" && !R.stale ? R.path : S;
2340
- A !== S && M(A);
2341
- const N = R.kind !== "document" || R.path === e;
2371
+ const T = e === null ? mt : ul(e, a, S, w, !R.current), C = e === null ? null : T.kind === "document" && !T.stale ? T.path : S;
2372
+ C !== S && A(C);
2373
+ const N = T.kind !== "document" || T.path === e;
2342
2374
  N && n !== L && E(n);
2343
2375
  const q = G(() => Ji(h), [h]), W = G(() => [...d.iframeHosts], [d]), z = o.kind === "panel", j = G(
2344
2376
  () => ({
2345
2377
  labels: q,
2346
2378
  emptyMessage: h.documentEmpty,
2347
- theme: w,
2379
+ theme: g,
2348
2380
  availableStyles: d.documentStyles,
2349
2381
  iFrameAllowedDomains: W,
2350
2382
  embeds: d.embeds,
2351
2383
  linkComponent: $i,
2352
- toolbar: O,
2384
+ toolbar: M,
2353
2385
  style: r.style,
2354
2386
  onStyleChange: r.onStyleChange,
2355
2387
  align: r.align,
@@ -2362,13 +2394,13 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2362
2394
  maxWidth: r.maxWidth === void 0 ? void 0 : `min(${r.maxWidth}, 100%)`,
2363
2395
  renderScrollBar: z ? void 0 : Sn
2364
2396
  }),
2365
- [q, h.documentEmpty, w, d.documentStyles, W, d.embeds, O, r, z]
2366
- ), Y = P((re, p) => z ? p === null || p.kind === "failure" ? ae(re) : p.name : h.documentRegion, [z, h.documentRegion]), V = z ? "content" : "fill";
2397
+ [q, h.documentEmpty, g, d.documentStyles, W, d.embeds, M, r, z]
2398
+ ), Y = P((re, p) => z ? p === null || p.kind === "failure" ? se(re) : p.name : h.documentRegion, [z, h.documentRegion]), V = z ? "content" : "fill";
2367
2399
  return e === null ? /* @__PURE__ */ c(he, { value: V, children: /* @__PURE__ */ c(tl, { absence: t, announces: u, announceFailure: m }) }) : /* @__PURE__ */ c(he, { value: V, children: /* @__PURE__ */ c(ke, { fallback: /* @__PURE__ */ c(ut, { label: Y(e, null) }), children: /* @__PURE__ */ c(
2368
2400
  ml,
2369
2401
  {
2370
2402
  requestedPath: e,
2371
- content: R,
2403
+ content: T,
2372
2404
  markup: N ? n : L,
2373
2405
  viewer: j,
2374
2406
  editLayout: r.editLayout,
@@ -2382,47 +2414,47 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2382
2414
  }
2383
2415
  ) }) });
2384
2416
  }, hl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
2385
- const { config: i, viewSettings: l, announcer: u } = D(), m = Me((A) => A.style), f = Me((A) => A.align), d = Fe(), h = nn(), w = lt(), { view: b, overrides: O, embed: T } = r, S = P(
2386
- (A) => {
2387
- if (w.kind !== "location") return;
2388
- const N = el(i, w.location, A);
2417
+ const { config: i, viewSettings: l, announcer: u } = D(), m = Ae((C) => C.style), f = Ae((C) => C.align), d = Fe(), h = nn(), g = lt(), { view: b, overrides: M, embed: R } = r, S = P(
2418
+ (C) => {
2419
+ if (g.kind !== "location") return;
2420
+ const N = el(i, g.location, C);
2389
2421
  N !== null && d(N, "browse");
2390
2422
  },
2391
- [i, d, w]
2392
- ), M = P(
2393
- (A) => {
2394
- l.update({ style: A }), S("style");
2423
+ [i, d, g]
2424
+ ), A = P(
2425
+ (C) => {
2426
+ l.update({ style: C }), S("style");
2395
2427
  },
2396
2428
  [l, S]
2397
2429
  ), L = P(
2398
- (A) => {
2399
- l.update({ align: A }), S("align");
2430
+ (C) => {
2431
+ l.update({ align: C }), S("align");
2400
2432
  },
2401
2433
  [l, S]
2402
- ), E = Nn(i, O.style, m), v = Dn(O.align, f), s = G(
2434
+ ), E = Nn(i, M.style, m), v = Dn(M.align, f), a = G(
2403
2435
  () => ({
2404
2436
  style: E,
2405
- onStyleChange: M,
2437
+ onStyleChange: A,
2406
2438
  align: v,
2407
2439
  onAlignChange: L,
2408
- showToc: T.showToc !== !1,
2409
- showStyle: T.showStyle !== !1,
2410
- showAlign: T.showAlign !== !1,
2411
- padding: T.padding,
2412
- width: T.width,
2413
- maxWidth: T.maxWidth,
2440
+ showToc: R.showToc !== !1,
2441
+ showStyle: R.showStyle !== !1,
2442
+ showAlign: R.showAlign !== !1,
2443
+ padding: R.padding,
2444
+ width: R.width,
2445
+ maxWidth: R.maxWidth,
2414
2446
  editLayout: "fill"
2415
2447
  }),
2416
- [E, M, v, L, T]
2417
- ), a = G(() => ({ kind: "page", view: b, overrides: O, embed: T }), [b, O, T]), g = G(() => ({ kind: "page", fragment: h.hash, navigation: h }), [h]), R = P((A) => u.announce(A), [u]);
2418
- return /* @__PURE__ */ c($n, { path: e, absence: t, markup: n, display: s, navigation: a, fragment: g, paneScroll: li, announces: !0, announceFailure: R, onDocumentShown: o });
2448
+ [E, A, v, L, R]
2449
+ ), s = G(() => ({ kind: "page", view: b, overrides: M, embed: R }), [b, M, R]), w = G(() => ({ kind: "page", fragment: h.hash, navigation: h }), [h]), T = P((C) => u.announce(C), [u]);
2450
+ return /* @__PURE__ */ c($n, { path: e, absence: t, markup: n, display: a, navigation: s, fragment: w, paneScroll: li, announces: !0, announceFailure: T, onDocumentShown: o });
2419
2451
  }, pl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
2420
- const { config: i, viewSettings: l } = D(), u = Me((a) => a.style), m = Me((a) => a.align), [f, d] = I(() => Nn(i, void 0, u)), h = Dn(void 0, m), w = P((a) => l.update({ align: a }), [l]), { maximized: b, onDocumentLink: O, pendingHash: T, onHashConsumed: S, announceFailure: M, paneScroll: L } = r, E = G(
2452
+ const { config: i, viewSettings: l } = D(), u = Ae((s) => s.style), m = Ae((s) => s.align), [f, d] = B(() => Nn(i, void 0, u)), h = Dn(void 0, m), g = P((s) => l.update({ align: s }), [l]), { maximized: b, onDocumentLink: M, pendingHash: R, onHashConsumed: S, announceFailure: A, paneScroll: L } = r, E = G(
2421
2453
  () => ({
2422
2454
  style: f,
2423
2455
  onStyleChange: d,
2424
2456
  align: h,
2425
- onAlignChange: w,
2457
+ onAlignChange: g,
2426
2458
  showToc: b,
2427
2459
  showStyle: b,
2428
2460
  showAlign: b,
@@ -2431,11 +2463,11 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2431
2463
  maxWidth: void 0,
2432
2464
  editLayout: b ? "fill" : "content"
2433
2465
  }),
2434
- [f, h, w, b]
2435
- ), v = G(() => ({ kind: "panel", onDocumentLink: O }), [O]), s = G(() => ({ kind: "panel", fragment: T, consume: S }), [T, S]);
2436
- return /* @__PURE__ */ c($n, { path: e, absence: t, markup: n, display: E, navigation: v, fragment: s, paneScroll: L, announces: !1, announceFailure: M, onDocumentShown: o });
2466
+ [f, h, g, b]
2467
+ ), v = G(() => ({ kind: "panel", onDocumentLink: M }), [M]), a = G(() => ({ kind: "panel", fragment: R, consume: S }), [R, S]);
2468
+ return /* @__PURE__ */ c($n, { path: e, absence: t, markup: n, display: E, navigation: v, fragment: a, paneScroll: L, announces: !1, announceFailure: A, onDocumentShown: o });
2437
2469
  }, vl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => r.kind === "page" ? /* @__PURE__ */ c(hl, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) : /* @__PURE__ */ c(pl, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o });
2438
- function gl({
2470
+ function wl({
2439
2471
  title: e,
2440
2472
  titleId: t,
2441
2473
  ...n
@@ -2456,7 +2488,7 @@ function gl({
2456
2488
  clipRule: "evenodd"
2457
2489
  }));
2458
2490
  }
2459
- const wl = /* @__PURE__ */ y.forwardRef(gl);
2491
+ const gl = /* @__PURE__ */ y.forwardRef(wl);
2460
2492
  function bl({
2461
2493
  title: e,
2462
2494
  titleId: t,
@@ -2548,8 +2580,8 @@ function kl({
2548
2580
  clipRule: "evenodd"
2549
2581
  }));
2550
2582
  }
2551
- const Rl = /* @__PURE__ */ y.forwardRef(kl);
2552
- function Tl({
2583
+ const Tl = /* @__PURE__ */ y.forwardRef(kl);
2584
+ function Rl({
2553
2585
  title: e,
2554
2586
  titleId: t,
2555
2587
  ...n
@@ -2572,8 +2604,8 @@ function Tl({
2572
2604
  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"
2573
2605
  }));
2574
2606
  }
2575
- const Ol = /* @__PURE__ */ y.forwardRef(Tl);
2576
- function Cl({
2607
+ const Ml = /* @__PURE__ */ y.forwardRef(Rl);
2608
+ function Ol({
2577
2609
  title: e,
2578
2610
  titleId: t,
2579
2611
  ...n
@@ -2596,7 +2628,7 @@ function Cl({
2596
2628
  clipRule: "evenodd"
2597
2629
  }));
2598
2630
  }
2599
- const Al = /* @__PURE__ */ y.forwardRef(Cl);
2631
+ const Cl = /* @__PURE__ */ y.forwardRef(Ol);
2600
2632
  function Ll({
2601
2633
  title: e,
2602
2634
  titleId: t,
@@ -2618,7 +2650,7 @@ function Ll({
2618
2650
  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"
2619
2651
  }));
2620
2652
  }
2621
- const Ml = /* @__PURE__ */ y.forwardRef(Ll);
2653
+ const Al = /* @__PURE__ */ y.forwardRef(Ll);
2622
2654
  function Nl({
2623
2655
  title: e,
2624
2656
  titleId: t,
@@ -2639,7 +2671,7 @@ function Nl({
2639
2671
  }));
2640
2672
  }
2641
2673
  const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId: n }) => {
2642
- const { labels: r, onEditGrant: o } = D(), [i, l] = I(!1), u = () => {
2674
+ const { labels: r, onEditGrant: o } = D(), [i, l] = B(!1), u = () => {
2643
2675
  o === void 0 || i || (l(!0), o(e).then((m) => {
2644
2676
  m && t();
2645
2677
  }).finally(() => l(!1)));
@@ -2660,51 +2692,51 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2660
2692
  return;
2661
2693
  }
2662
2694
  e.setView(t, n), r && e.sideBySide() && e.setSideBySide(!1);
2663
- }, Ys = (e) => e === "split" ? null : e, ql = (e) => e === "preview" ? "editor" : "preview", _l = (e) => /Mac|iPhone|iPad|iPod/u.test(e), Bl = (e, t) => {
2695
+ }, Ja = (e) => e === "split" ? null : e, ql = (e) => e === "preview" ? "editor" : "preview", _l = (e) => /Mac|iPhone|iPad|iPod/u.test(e), Il = (e, t) => {
2664
2696
  if (e.isComposing || e.altKey || e.shiftKey || (t ? !e.metaKey || e.ctrlKey : !e.ctrlKey || e.metaKey)) return !1;
2665
2697
  const n = e.key.toLowerCase();
2666
2698
  return n === "e" || e.code === "KeyE" && /^\p{L}$/u.test(n) && !/^[a-z]$/u.test(n);
2667
2699
  }, Gt = (e, t, n) => {
2668
2700
  const r = e.modifiedAt === null ? Number.NaN : Date.parse(e.modifiedAt);
2669
2701
  return n(Number.isNaN(r) ? e.id : t.format(r), e.author === null ? "" : e.author);
2670
- }, Il = ({ path: e, documentName: t, open: n, onClose: r }) => {
2671
- const { data: o, edits: i, labels: l, locale: u, announcer: m } = D(), f = Se(), [d, h] = I(null), [w, b] = I(0), [O, T] = I(null), [S, M] = I(null), L = G(() => new Intl.DateTimeFormat(u, { dateStyle: "medium", timeStyle: "short" }), [u]), E = P(() => {
2672
- T(null), M(null);
2702
+ }, Bl = ({ path: e, documentName: t, open: n, onClose: r }) => {
2703
+ const { data: o, edits: i, labels: l, locale: u, announcer: m } = D(), f = Se(), [d, h] = B(null), [g, b] = B(0), [M, R] = B(null), [S, A] = B(null), L = G(() => new Intl.DateTimeFormat(u, { dateStyle: "medium", timeStyle: "short" }), [u]), E = P(() => {
2704
+ R(null), A(null);
2673
2705
  }, []), v = vn({ open: n, onOpen: E, onDismiss: r });
2674
2706
  te(() => {
2675
2707
  if (!n) return;
2676
- const g = new AbortController();
2677
- return h(null), o.revisions(e, g.signal).then((R) => {
2678
- "kind" in R && h(R);
2679
- }), () => g.abort();
2680
- }, [n, o, e, w]), te(() => {
2681
- if (!n || O === null) return;
2682
- const g = new AbortController();
2683
- return M(null), o.revision(e, O, g.signal).then((R) => {
2684
- "kind" in R && M(R);
2685
- }), () => g.abort();
2686
- }, [n, o, e, O]);
2687
- const s = () => {
2708
+ const w = new AbortController();
2709
+ return h(null), o.revisions(e, w.signal).then((T) => {
2710
+ "kind" in T && h(T);
2711
+ }), () => w.abort();
2712
+ }, [n, o, e, g]), te(() => {
2713
+ if (!n || M === null) return;
2714
+ const w = new AbortController();
2715
+ return A(null), o.revision(e, M, w.signal).then((T) => {
2716
+ "kind" in T && A(T);
2717
+ }), () => w.abort();
2718
+ }, [n, o, e, M]);
2719
+ const a = () => {
2688
2720
  S === null || S.kind !== "revision" || (i.replaceDraft(e, S.text), m.announce(l.historyRestored(t)), r());
2689
- }, a = d !== null && d.kind === "revisions" ? d.revisions.find((g) => g.id === O) : void 0;
2721
+ }, s = d !== null && d.kind === "revisions" ? d.revisions.find((w) => w.id === M) : void 0;
2690
2722
  return /* @__PURE__ */ c("dialog", { ...v, className: "aqmx-confirm aqmx-history", "aria-labelledby": f, "data-testid": "markdown-explorer-history", children: /* @__PURE__ */ F("div", { className: "aqmx-confirm-panel aqmx-history-panel", children: [
2691
2723
  /* @__PURE__ */ c("p", { id: f, className: "aqmx-confirm-title", children: l.historyTitle(t) }),
2692
- d === null ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: l.historyLoading }) : d.kind === "failure" ? /* @__PURE__ */ c(me, { failure: d.failure, alert: !1, onRetry: () => b((g) => g + 1), testId: "markdown-explorer-history-failure" }) : d.revisions.length === 0 ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: l.historyEmpty }) : /* @__PURE__ */ c("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: d.revisions.map((g) => /* @__PURE__ */ c("li", { children: /* @__PURE__ */ F("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": g.id === O, "data-testid": "markdown-explorer-history-entry", onClick: () => T(g.id), children: [
2693
- /* @__PURE__ */ c("span", { children: Gt(g, L, l.historyEntry) }),
2694
- g.current ? /* @__PURE__ */ c("span", { className: "aqmx-history-mark", children: l.historyCurrent }) : null,
2695
- g.kept ? /* @__PURE__ */ c("span", { className: "aqmx-history-mark", children: l.historyKept }) : null
2696
- ] }) }, g.id)) }),
2697
- O === null ? null : S === null ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", children: l.historyLoading }) : S.kind === "failure" ? /* @__PURE__ */ c(me, { failure: S.failure, alert: !1, testId: "markdown-explorer-history-revision-failure" }) : (
2698
- /* @__PURE__ */ c("section", { className: "aqmx-history-text", tabIndex: 0, "aria-label": a === void 0 ? l.historyTitle(t) : Gt(a, L, l.historyEntry), "data-testid": "markdown-explorer-history-text", children: /* @__PURE__ */ c("pre", { children: S.text }) })
2724
+ d === null ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: l.historyLoading }) : d.kind === "failure" ? /* @__PURE__ */ c(me, { failure: d.failure, alert: !1, onRetry: () => b((w) => w + 1), testId: "markdown-explorer-history-failure" }) : d.revisions.length === 0 ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: l.historyEmpty }) : /* @__PURE__ */ c("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: d.revisions.map((w) => /* @__PURE__ */ c("li", { children: /* @__PURE__ */ F("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": w.id === M, "data-testid": "markdown-explorer-history-entry", onClick: () => R(w.id), children: [
2725
+ /* @__PURE__ */ c("span", { children: Gt(w, L, l.historyEntry) }),
2726
+ w.current ? /* @__PURE__ */ c("span", { className: "aqmx-history-mark", children: l.historyCurrent }) : null,
2727
+ w.kept ? /* @__PURE__ */ c("span", { className: "aqmx-history-mark", children: l.historyKept }) : null
2728
+ ] }) }, w.id)) }),
2729
+ M === null ? null : S === null ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", children: l.historyLoading }) : S.kind === "failure" ? /* @__PURE__ */ c(me, { failure: S.failure, alert: !1, testId: "markdown-explorer-history-revision-failure" }) : (
2730
+ /* @__PURE__ */ c("section", { className: "aqmx-history-text", tabIndex: 0, "aria-label": s === void 0 ? l.historyTitle(t) : Gt(s, L, l.historyEntry), "data-testid": "markdown-explorer-history-text", children: /* @__PURE__ */ c("pre", { children: S.text }) })
2699
2731
  ),
2700
2732
  /* @__PURE__ */ F("div", { className: "aqmx-confirm-actions", children: [
2701
2733
  /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-testid": "markdown-explorer-history-close", onClick: r, children: l.historyClose }),
2702
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": S === null || S.kind !== "revision", "data-testid": "markdown-explorer-history-restore", onClick: s, children: l.historyRestore })
2734
+ /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": S === null || S.kind !== "revision", "data-testid": "markdown-explorer-history-restore", onClick: a, children: l.historyRestore })
2703
2735
  ] })
2704
2736
  ] }) });
2705
2737
  }, zl = (e) => {
2706
2738
  const { documents: t } = D(), n = P(() => t.peek(e), [t, e]), r = P(() => t.peekSeeded(e), [t, e]), o = ee(t.subscribe, n, r), i = ue(o)?.document;
2707
- return i === void 0 || i.kind === "failure" ? { edit: null, name: ae(e) } : { edit: i.kind === "markdown" ? i.edit : null, name: i.name };
2739
+ return i === void 0 || i.kind === "failure" ? { edit: null, name: se(e) } : { edit: i.kind === "markdown" ? i.edit : null, name: i.name };
2708
2740
  }, ce = (e) => {
2709
2741
  e.stopPropagation();
2710
2742
  }, jl = ({ path: e, documentName: t, iconOnly: n, previewAvailable: r, draft: o }) => {
@@ -2712,39 +2744,39 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2712
2744
  l.subscribe,
2713
2745
  () => l.session(e) !== void 0,
2714
2746
  () => !1
2715
- ), [f, d] = I(null), h = () => {
2747
+ ), [f, d] = B(null), h = () => {
2716
2748
  if (!m) {
2717
2749
  l.start(e, l.viewAnchor(e));
2718
2750
  return;
2719
2751
  }
2720
2752
  l.flush(e);
2721
- const T = l.session(e);
2722
- T?.dirty === !0 ? d(T.save.kind === "draft" ? "draft" : "unsaved") : l.close(e);
2723
- }, w = () => {
2753
+ const R = l.session(e);
2754
+ R?.dirty === !0 ? d(R.save.kind === "draft" ? "draft" : "unsaved") : l.close(e);
2755
+ }, g = () => {
2724
2756
  m || (fo(), r && l.sideBySide() && i?.prepare?.());
2725
- }, b = n ? o ? u.editDraftDocumentNamed(t) : u.editDocumentNamed(t) : null, O = o ? u.editDraftDocument : u.editDocument;
2757
+ }, b = n ? o ? u.editDraftDocumentNamed(t) : u.editDocumentNamed(t) : null, M = o ? u.editDraftDocument : u.editDocument;
2726
2758
  return /* @__PURE__ */ F(Pe, { children: [
2727
2759
  /* @__PURE__ */ F(
2728
2760
  "button",
2729
2761
  {
2730
2762
  type: "button",
2731
2763
  className: b === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
2732
- title: m ? u.closeEditor : b === null ? O : b,
2764
+ title: m ? u.closeEditor : b === null ? M : b,
2733
2765
  "aria-label": b === null ? void 0 : b,
2734
2766
  "aria-pressed": m,
2735
2767
  "data-testid": "markdown-explorer-document-edit",
2736
2768
  onClick: h,
2737
2769
  onDoubleClick: ce,
2738
- onPointerEnter: w,
2739
- onFocus: w,
2770
+ onPointerEnter: g,
2771
+ onFocus: g,
2740
2772
  children: [
2741
- /* @__PURE__ */ c(Ml, { "aria-hidden": "true" }),
2773
+ /* @__PURE__ */ c(Al, { "aria-hidden": "true" }),
2742
2774
  b === null ? /* @__PURE__ */ c("span", { children: u.editDocumentLabel }) : null
2743
2775
  ]
2744
2776
  }
2745
2777
  ),
2746
2778
  /* @__PURE__ */ c(
2747
- gn,
2779
+ wn,
2748
2780
  {
2749
2781
  open: f !== null,
2750
2782
  title: f === "draft" ? u.draftDiscardTitle : u.unsavedTitle,
@@ -2781,27 +2813,27 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2781
2813
  }, Vl = ({ session: e }) => {
2782
2814
  const { labels: t } = D(), n = Pr(t, e);
2783
2815
  return /* @__PURE__ */ c("p", { className: "aqmx-edit-status", title: n === "" ? void 0 : n, "data-testid": "markdown-explorer-edit-status", "data-aqmx-save": e.save.kind, children: n });
2784
- }, Ul = Object.freeze(["editor", "split", "preview"]), Zl = Object.freeze(["editor", "preview"]), Gl = Object.freeze({ editor: Fn, split: Dl, preview: Al }), Wl = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
2785
- const { draftConverter: i, edits: l, labels: u } = D(), m = lo(), f = Fl(r, m, o), d = o ? Ul : Zl, h = Se(), w = _(/* @__PURE__ */ new Map()), b = {
2816
+ }, Ul = Object.freeze(["editor", "split", "preview"]), Zl = Object.freeze(["editor", "preview"]), Gl = Object.freeze({ editor: Fn, split: Dl, preview: Cl }), Wl = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
2817
+ const { draftConverter: i, edits: l, labels: u } = D(), m = lo(), f = Fl(r, m, o), d = o ? Ul : Zl, h = Se(), g = _(/* @__PURE__ */ new Map()), b = {
2786
2818
  editor: { label: u.editViewEditor, tooltip: u.editViewEditorTooltip },
2787
2819
  split: { label: u.editViewSplit, tooltip: u.editViewSplitTooltip },
2788
2820
  preview: { label: u.editViewPreview, tooltip: u.editViewPreviewTooltip }
2789
- }, O = () => {
2821
+ }, M = () => {
2790
2822
  l.preparePreview(e), i?.prepare?.();
2791
- }, T = (S) => {
2792
- if (!Bl(S.nativeEvent, _l(navigator.platform))) return;
2823
+ }, R = (S) => {
2824
+ if (!Il(S.nativeEvent, _l(navigator.platform))) return;
2793
2825
  hn(S);
2794
- const M = ql(f);
2795
- Zt(l, e, M, o), w.current.get(M)?.focus();
2826
+ const A = ql(f);
2827
+ Zt(l, e, A, o), g.current.get(A)?.focus();
2796
2828
  };
2797
- return /* @__PURE__ */ c("div", { role: "radiogroup", "aria-label": n ? u.editViewNamed(t) : u.editView, className: "aqmx-edit-view", "data-testid": "markdown-explorer-edit-view", onKeyDown: T, children: d.map((S) => {
2798
- const M = Gl[S], { label: L, tooltip: E } = b[S], v = S === "preview" ? O : void 0;
2829
+ return /* @__PURE__ */ c("div", { role: "radiogroup", "aria-label": n ? u.editViewNamed(t) : u.editView, className: "aqmx-edit-view", "data-testid": "markdown-explorer-edit-view", onKeyDown: R, children: d.map((S) => {
2830
+ const A = Gl[S], { label: L, tooltip: E } = b[S], v = S === "preview" ? M : void 0;
2799
2831
  return /* @__PURE__ */ F("label", { className: n ? "aqmx-icon-button" : "aqmx-icon-button aqmx-labelled-button", children: [
2800
2832
  /* @__PURE__ */ c(
2801
2833
  "input",
2802
2834
  {
2803
- ref: (s) => {
2804
- s === null ? w.current.delete(S) : w.current.set(S, s);
2835
+ ref: (a) => {
2836
+ a === null ? g.current.delete(S) : g.current.set(S, a);
2805
2837
  },
2806
2838
  type: "radio",
2807
2839
  name: h,
@@ -2817,33 +2849,33 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2817
2849
  onFocus: v
2818
2850
  }
2819
2851
  ),
2820
- /* @__PURE__ */ c(M, { "aria-hidden": "true" }),
2852
+ /* @__PURE__ */ c(A, { "aria-hidden": "true" }),
2821
2853
  n ? null : /* @__PURE__ */ c("span", { children: L })
2822
2854
  ] }, S);
2823
2855
  }) });
2824
2856
  }, Kl = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
2825
- const { edits: i, labels: l } = D(), [u, m] = I(!1);
2857
+ const { edits: i, labels: l } = D(), [u, m] = B(!1);
2826
2858
  if (r.phase.kind !== "editing") return null;
2827
2859
  const f = r.save.kind === "saving", d = f || !r.dirty, h = () => {
2828
2860
  i.flush(e);
2829
2861
  const b = i.session(e);
2830
2862
  b === void 0 || !b.dirty || b.save.kind === "saving" || i.save(e);
2831
- }, w = (b) => n ? { className: "aqmx-icon-button", "aria-label": b } : { className: "aqmx-icon-button aqmx-labelled-button" };
2863
+ }, g = (b) => n ? { className: "aqmx-icon-button", "aria-label": b } : { className: "aqmx-icon-button aqmx-labelled-button" };
2832
2864
  return /* @__PURE__ */ F(Pe, { children: [
2833
- r.save.kind === "conflicts" ? /* @__PURE__ */ F("button", { type: "button", ...w(l.conflictNext), title: l.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => i.nextConflict(e), onDoubleClick: ce, children: [
2865
+ r.save.kind === "conflicts" ? /* @__PURE__ */ F("button", { type: "button", ...g(l.conflictNext), title: l.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => i.nextConflict(e), onDoubleClick: ce, children: [
2834
2866
  /* @__PURE__ */ c(Sl, { "aria-hidden": "true" }),
2835
2867
  n ? null : /* @__PURE__ */ c("span", { children: l.conflictNext })
2836
2868
  ] }) : null,
2837
2869
  /* @__PURE__ */ c(Wl, { path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }),
2838
- r.history ? /* @__PURE__ */ F("button", { type: "button", ...w(l.historyOpen), title: l.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => m(!0), onDoubleClick: ce, children: [
2839
- /* @__PURE__ */ c(Rl, { "aria-hidden": "true" }),
2870
+ r.history ? /* @__PURE__ */ F("button", { type: "button", ...g(l.historyOpen), title: l.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => m(!0), onDoubleClick: ce, children: [
2871
+ /* @__PURE__ */ c(Tl, { "aria-hidden": "true" }),
2840
2872
  n ? null : /* @__PURE__ */ c("span", { children: l.historyOpen })
2841
2873
  ] }) : null,
2842
- r.save.kind === "draft" ? null : /* @__PURE__ */ F("button", { type: "button", ...w(l.saveDraft), title: l.saveDraftTooltip, "aria-disabled": d, "aria-busy": f, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: h, onDoubleClick: ce, children: [
2843
- /* @__PURE__ */ c(Ol, { "aria-hidden": "true" }),
2874
+ r.save.kind === "draft" ? null : /* @__PURE__ */ F("button", { type: "button", ...g(l.saveDraft), title: l.saveDraftTooltip, "aria-disabled": d, "aria-busy": f, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: h, onDoubleClick: ce, children: [
2875
+ /* @__PURE__ */ c(Ml, { "aria-hidden": "true" }),
2844
2876
  n ? null : /* @__PURE__ */ c("span", { children: l.saveDraft })
2845
2877
  ] }),
2846
- r.history ? /* @__PURE__ */ c(Il, { path: e, documentName: t, open: u, onClose: () => m(!1) }) : null
2878
+ r.history ? /* @__PURE__ */ c(Bl, { path: e, documentName: t, open: u, onClose: () => m(!1) }) : null
2847
2879
  ] });
2848
2880
  }, Xl = ({ path: e, session: t }) => {
2849
2881
  const { edits: n } = D();
@@ -2856,58 +2888,58 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2856
2888
  }, Jl = (e) => {
2857
2889
  const { config: t } = D(), n = Fe(), r = P(() => n(ye(t, { ...e, markup: !e.markup }), "browse"), [t, n, e]);
2858
2890
  return G(() => ({ shown: e.markup, toggle: r }), [e.markup, r]);
2859
- }, Ql = /* @__PURE__ */ new Set(), es = (e, t) => {
2860
- const { documents: n, announcer: r, labels: o } = D(), i = P(() => n.peek(e), [n, e]), l = P(() => n.peekSeeded(e), [n, e]), u = ee(n.subscribe, i, l), m = P(() => n.answerStampOf(e), [n, e]), f = ee(n.subscribe, m, m), [d] = I(() => /* @__PURE__ */ new Set()), [h, w] = I(Ql), [b, O] = I(null);
2861
- b !== null && b.path !== e && O(null);
2862
- const T = _(null);
2863
- H(() => (T.current = e, () => {
2864
- T.current = null;
2891
+ }, Ql = /* @__PURE__ */ new Set(), ea = (e, t) => {
2892
+ const { documents: n, announcer: r, labels: o } = D(), i = P(() => n.peek(e), [n, e]), l = P(() => n.peekSeeded(e), [n, e]), u = ee(n.subscribe, i, l), m = P(() => n.answerStampOf(e), [n, e]), f = ee(n.subscribe, m, m), [d] = B(() => /* @__PURE__ */ new Set()), [h, g] = B(Ql), [b, M] = B(null);
2893
+ b !== null && b.path !== e && M(null);
2894
+ const R = _(null);
2895
+ H(() => (R.current = e, () => {
2896
+ R.current = null;
2865
2897
  }), [e]);
2866
2898
  const S = P(() => {
2867
2899
  const E = e, v = n.peek(E);
2868
2900
  if (d.has(E) || v?.status === "pending") return;
2869
- const s = t && !Rn(v);
2870
- d.add(E), w(new Set(d)), O(null), (async () => {
2901
+ const a = t && !Tn(v);
2902
+ d.add(E), g(new Set(d)), M(null), (async () => {
2871
2903
  try {
2872
- const a = await n.refresh(E);
2873
- if (T.current !== E || a.status === "superseded") return;
2874
- if (a.status === "failed") {
2875
- O({ path: E, failure: a.failure, stamp: n.answerStampOf(E) }), r.announce(o.documentRefreshFailed(se(o, a.failure.reason)));
2904
+ const s = await n.refresh(E);
2905
+ if (R.current !== E || s.status === "superseded") return;
2906
+ if (s.status === "failed") {
2907
+ M({ path: E, failure: s.failure, stamp: n.answerStampOf(E) }), r.announce(o.documentRefreshFailed(ae(o, s.failure.reason)));
2876
2908
  return;
2877
2909
  }
2878
- const g = ue(n.peek(E));
2879
- if (s || g === null || g.document.kind === "failure") return;
2880
- r.announce(o.documentRefreshed(g.document.name));
2910
+ const w = ue(n.peek(E));
2911
+ if (a || w === null || w.document.kind === "failure") return;
2912
+ r.announce(o.documentRefreshed(w.document.name));
2881
2913
  } finally {
2882
- d.delete(E), w(new Set(d));
2914
+ d.delete(E), g(new Set(d));
2883
2915
  }
2884
2916
  })();
2885
- }, [e, t, d, n, r, o]), M = h.has(e), L = b !== null && b.path === e && b.stamp === f ? b.failure : null;
2886
- return { refreshing: M, unavailable: M || u?.status === "pending", failure: L, refresh: S };
2887
- }, ts = Object.freeze({ kind: "page" }), ns = ({ path: e, placement: t, markup: n }) => {
2888
- const { labels: r } = D(), { refreshing: o, unavailable: i, failure: l, refresh: u } = es(e, t.kind === "page"), m = Yl(e), f = zl(e), d = bn(e), h = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, w = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, b = t.kind === "panel", O = t.kind === "panel" ? t.documentName : f.name, T = t.kind === "page" || t.maximized;
2917
+ }, [e, t, d, n, r, o]), A = h.has(e), L = b !== null && b.path === e && b.stamp === f ? b.failure : null;
2918
+ return { refreshing: A, unavailable: A || u?.status === "pending", failure: L, refresh: S };
2919
+ }, ta = Object.freeze({ kind: "page" }), na = ({ path: e, placement: t, markup: n }) => {
2920
+ const { labels: r } = D(), { refreshing: o, unavailable: i, failure: l, refresh: u } = ea(e, t.kind === "page"), m = Yl(e), f = zl(e), d = bn(e), h = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, g = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, b = t.kind === "panel", M = t.kind === "panel" ? t.documentName : f.name, R = t.kind === "page" || t.maximized;
2889
2921
  return /* @__PURE__ */ F("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", "data-aqmx-editing": d === void 0 ? void 0 : "true", children: [
2890
2922
  /* @__PURE__ */ F("div", { className: "aqmx-document-refresh-row", children: [
2891
2923
  d === void 0 ? null : /* @__PURE__ */ c(Vl, { session: d }),
2892
- d === void 0 ? null : /* @__PURE__ */ c(Kl, { path: e, documentName: O, iconOnly: b, session: d, previewAvailable: T }),
2924
+ d === void 0 ? null : /* @__PURE__ */ c(Kl, { path: e, documentName: M, iconOnly: b, session: d, previewAvailable: R }),
2893
2925
  d === void 0 && m ? /* @__PURE__ */ F(
2894
2926
  "button",
2895
2927
  {
2896
2928
  type: "button",
2897
- className: w === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
2898
- title: w === null ? r.showMarkup : w,
2899
- "aria-label": w === null ? void 0 : w,
2929
+ className: g === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
2930
+ title: g === null ? r.showMarkup : g,
2931
+ "aria-label": g === null ? void 0 : g,
2900
2932
  "aria-pressed": n.shown,
2901
2933
  "data-testid": "markdown-explorer-document-markup",
2902
2934
  onClick: n.toggle,
2903
2935
  onDoubleClick: ce,
2904
2936
  children: [
2905
2937
  /* @__PURE__ */ c(Fn, { "aria-hidden": "true" }),
2906
- w === null ? /* @__PURE__ */ c("span", { children: r.showMarkupLabel }) : null
2938
+ g === null ? /* @__PURE__ */ c("span", { children: r.showMarkupLabel }) : null
2907
2939
  ]
2908
2940
  }
2909
2941
  ) : null,
2910
- d !== void 0 || f.edit?.kind === "inline" || f.edit?.kind === "draft" ? /* @__PURE__ */ c(jl, { path: e, documentName: O, iconOnly: b, previewAvailable: T, draft: f.edit?.kind === "draft" }) : f.edit?.kind === "external" ? /* @__PURE__ */ c(Hl, { href: f.edit.href, documentName: O, iconOnly: b }) : null,
2942
+ d !== void 0 || f.edit?.kind === "inline" || f.edit?.kind === "draft" ? /* @__PURE__ */ c(jl, { path: e, documentName: M, iconOnly: b, previewAvailable: R, draft: f.edit?.kind === "draft" }) : f.edit?.kind === "external" ? /* @__PURE__ */ c(Hl, { href: f.edit.href, documentName: M, iconOnly: b }) : null,
2911
2943
  d === void 0 ? /* @__PURE__ */ F(
2912
2944
  "button",
2913
2945
  {
@@ -2922,27 +2954,27 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2922
2954
  onClick: u,
2923
2955
  onDoubleClick: ce,
2924
2956
  children: [
2925
- /* @__PURE__ */ c(wl, { "aria-hidden": "true" }),
2957
+ /* @__PURE__ */ c(gl, { "aria-hidden": "true" }),
2926
2958
  h === null ? /* @__PURE__ */ c("span", { children: r.refreshDocumentLabel }) : null
2927
2959
  ]
2928
2960
  }
2929
2961
  ) : null
2930
2962
  ] }),
2931
- d !== void 0 || l === null ? null : /* @__PURE__ */ c("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": l.reason, children: r.documentRefreshFailed(se(r, l.reason)) }),
2963
+ d !== void 0 || l === null ? null : /* @__PURE__ */ c("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": l.reason, children: r.documentRefreshFailed(ae(r, l.reason)) }),
2932
2964
  d === void 0 ? null : /* @__PURE__ */ c(Xl, { path: e, session: d })
2933
2965
  ] });
2934
- }, rs = ({ location: e }) => {
2966
+ }, ra = ({ location: e }) => {
2935
2967
  const t = e.doc, n = G(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), r = Jl(e);
2936
2968
  return /* @__PURE__ */ F("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", ...et, children: [
2937
- /* @__PURE__ */ c(ns, { path: t, placement: ts, markup: r }),
2969
+ /* @__PURE__ */ c(na, { path: t, placement: ta, markup: r }),
2938
2970
  /* @__PURE__ */ c(vl, { path: t, absence: Qi, markup: e.markup, variant: n })
2939
2971
  ] });
2940
- }, os = ({ holds: e, testId: t }) => {
2972
+ }, oa = ({ holds: e, testId: t }) => {
2941
2973
  const { labels: n, announcer: r } = D(), o = Se();
2942
2974
  H(() => e ? r.claim(o) : void 0, [e, r, o]);
2943
2975
  const i = P(() => r.shownIn(o), [r, o]), l = ee(r.subscribe, i, i);
2944
2976
  return /* @__PURE__ */ c("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: l.length > 1 ? n.announcementSequence(l) : l[0] });
2945
- }, fe = Object.freeze([]), is = (e) => {
2977
+ }, fe = Object.freeze([]), ia = (e) => {
2946
2978
  const t = /* @__PURE__ */ new Set();
2947
2979
  let n = fe, r = [], o = !1;
2948
2980
  const i = [], l = (d) => {
@@ -2960,7 +2992,7 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2960
2992
  announce: (d) => {
2961
2993
  if (typeof d == "string") r.push({ sentence: d });
2962
2994
  else {
2963
- const h = r.find((w) => "list" in w && w.list === d.list);
2995
+ const h = r.find((g) => "list" in g && g.list === d.list);
2964
2996
  h !== void 0 && "items" in h ? h.items.push(d.item) : r.push({ list: d.list, items: [d.item] });
2965
2997
  }
2966
2998
  o || (o = !0, n !== fe && l(fe), e.request(f));
@@ -2971,75 +3003,75 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2971
3003
  claim: (d) => {
2972
3004
  const h = { region: d };
2973
3005
  return m(() => i.push(h)), () => m(() => {
2974
- const w = i.indexOf(h);
2975
- w !== -1 && i.splice(w, 1);
3006
+ const g = i.indexOf(h);
3007
+ g !== -1 && i.splice(g, 1);
2976
3008
  });
2977
3009
  },
2978
3010
  shownIn: (d) => u() === d ? n : fe
2979
3011
  };
2980
- }, we = Object.freeze({ status: "cancelled" }), ls = (e) => {
3012
+ }, ge = Object.freeze({ status: "cancelled" }), la = (e) => {
2981
3013
  if (e === null || typeof e != "object") return null;
2982
3014
  const { failure: t } = e;
2983
- if (ar(t) !== null) return null;
3015
+ if (sr(t) !== null) return null;
2984
3016
  const { reason: n, code: r } = t;
2985
3017
  return cr(n, r);
2986
- }, ss = ({ dataPath: e, onScope: t, fetch: n }) => {
2987
- const r = n ?? ((f, d) => globalThis.fetch(f, d)), o = (f, d) => `${e}/${f}?${new URLSearchParams(d).toString()}`, i = async (f, d, h, w) => {
3018
+ }, aa = ({ dataPath: e, onScope: t, fetch: n }) => {
3019
+ const r = n ?? ((f, d) => globalThis.fetch(f, d)), o = (f, d) => `${e}/${f}?${new URLSearchParams(d).toString()}`, i = async (f, d, h, g) => {
2988
3020
  let b;
2989
3021
  try {
2990
3022
  b = await r(f, { credentials: "same-origin", ...d, headers: { Accept: "application/json", ...d.headers } });
2991
3023
  } catch {
2992
- return w({ reason: "failed" });
3024
+ return g({ reason: "failed" });
2993
3025
  }
2994
3026
  b.status === 401 && t(null);
2995
- const O = b.headers.get(rr);
2996
- O !== null && t(O);
2997
- let T;
3027
+ const M = b.headers.get(rr);
3028
+ M !== null && t(M);
3029
+ let R;
2998
3030
  try {
2999
- T = await b.json();
3031
+ R = await b.json();
3000
3032
  } catch {
3001
- return w({ reason: Et(b.status) });
3033
+ return g({ reason: Et(b.status) });
3002
3034
  }
3003
3035
  let S;
3004
3036
  try {
3005
- S = h(T);
3037
+ S = h(R);
3006
3038
  } catch {
3007
3039
  S = !1;
3008
3040
  }
3009
- if (S) return T;
3010
- const M = ls(T);
3011
- return w(M !== null ? M : { reason: b.status === 200 ? "failed" : Et(b.status) });
3041
+ if (S) return R;
3042
+ const A = la(R);
3043
+ return g(A !== null ? A : { reason: b.status === 200 ? "failed" : Et(b.status) });
3012
3044
  }, l = { [xt]: dr }, u = { [xt]: pr, "Content-Type": `${hr}; charset=utf-8` }, m = async (f, d, h) => {
3013
- const w = await i(f, d, h, (b) => Ve(b.reason, b.code));
3014
- return d.signal.aborted ? we : w;
3045
+ const g = await i(f, d, h, (b) => Ve(b.reason, b.code));
3046
+ return d.signal.aborted ? ge : g;
3015
3047
  };
3016
3048
  return {
3017
3049
  tree: (f) => i(o("tree", { [J.source]: f }), { method: "GET" }, yt, (d) => ({ status: "error", failure: d })),
3018
3050
  children: async (f, d, h) => {
3019
- const w = await i(o("children", { [J.source]: f, [J.path]: d }), { method: "GET", signal: h }, sr, (b) => ({ status: "error", failure: b }));
3020
- return h.aborted ? we : w;
3051
+ const g = await i(o("children", { [J.source]: f, [J.path]: d }), { method: "GET", signal: h }, ar, (b) => ({ status: "error", failure: b }));
3052
+ return h.aborted ? ge : g;
3021
3053
  },
3022
3054
  ancestors: async (f, d, h) => {
3023
- const w = await i(o("ancestors", { [J.source]: f, [J.path]: d }), { method: "GET", signal: h }, lr, (b) => ({ status: "error", failure: b }));
3024
- return h.aborted ? we : w;
3055
+ const g = await i(o("ancestors", { [J.source]: f, [J.path]: d }), { method: "GET", signal: h }, lr, (b) => ({ status: "error", failure: b }));
3056
+ return h.aborted ? ge : g;
3025
3057
  },
3026
3058
  reveal: async (f, d, h) => {
3027
- const w = await i(o("reveal", { [J.source]: f, [J.path]: d }), { method: "GET", signal: h }, ir, (b) => ({ status: "error", failure: b }));
3028
- return h.aborted ? we : w;
3059
+ const g = await i(o("reveal", { [J.source]: f, [J.path]: d }), { method: "GET", signal: h }, ir, (b) => ({ status: "error", failure: b }));
3060
+ return h.aborted ? ge : g;
3029
3061
  },
3030
- document: (f, { refresh: d }) => i(o("document", { [J.path]: f }), d ? { method: "GET", headers: l } : { method: "GET" }, wr, (h) => Ve(h.reason, h.code)),
3062
+ document: (f, { refresh: d }) => i(o("document", { [J.path]: f }), d ? { method: "GET", headers: l } : { method: "GET" }, gr, (h) => Ve(h.reason, h.code)),
3031
3063
  text: async (f, d) => {
3032
- const h = await i(o("text", { [J.path]: f }), { method: "GET", signal: d }, or, (w) => Ve(w.reason, w.code));
3033
- return d.aborted ? we : h;
3064
+ const h = await i(o("text", { [J.path]: f }), { method: "GET", signal: d }, or, (g) => Ve(g.reason, g.code));
3065
+ return d.aborted ? ge : h;
3034
3066
  },
3035
- edit: (f, d) => m(o("edit", { [J.path]: f }), { method: "GET", signal: d }, gr),
3036
- save: (f, d, h, w) => m(o("save", { [J.path]: f, [J.base]: d }), { method: "POST", headers: u, body: h, signal: w }, vr),
3067
+ edit: (f, d) => m(o("edit", { [J.path]: f }), { method: "GET", signal: d }, wr),
3068
+ save: (f, d, h, g) => m(o("save", { [J.path]: f, [J.base]: d }), { method: "POST", headers: u, body: h, signal: g }, vr),
3037
3069
  preview: (f, d, h) => m(o("preview", { [J.path]: f }), { method: "POST", headers: u, body: d, signal: h }, mr),
3038
3070
  revisions: (f, d) => m(o("revisions", { [J.path]: f }), { method: "GET", signal: d }, fr),
3039
3071
  revision: (f, d, h) => m(o("revision", { [J.path]: f, [J.revision]: d }), { method: "GET", signal: h }, ur),
3040
3072
  refresh: (f) => i(o("refresh", { [J.source]: f }), { method: "POST", headers: l }, yt, (d) => ({ status: "error", failure: d }))
3041
3073
  };
3042
- }, as = () => {
3074
+ }, sa = () => {
3043
3075
  let e = null, t = null;
3044
3076
  return {
3045
3077
  settle: (n) => {
@@ -3054,7 +3086,7 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3054
3086
  return t = null, o;
3055
3087
  }
3056
3088
  };
3057
- }, cs = (e) => {
3089
+ }, ca = (e) => {
3058
3090
  const t = Qe(e);
3059
3091
  if (t === null) return bt;
3060
3092
  try {
@@ -3066,11 +3098,11 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3066
3098
  let n = null;
3067
3099
  const r = () => {
3068
3100
  if (n === null) {
3069
- const i = cs(e);
3070
- n = { changes: i, settings: wt(t, i) };
3101
+ const i = ca(e);
3102
+ n = { changes: i, settings: gt(t, i) };
3071
3103
  }
3072
3104
  return n;
3073
- }, o = Oe();
3105
+ }, o = Me();
3074
3106
  return {
3075
3107
  storageKey: e,
3076
3108
  defaults: t,
@@ -3079,17 +3111,17 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3079
3111
  subscribe: o.subscribe,
3080
3112
  advance: (i) => {
3081
3113
  const { changes: l, settings: u } = r(), m = Kn(l, i, Xn(u, i)[i], t);
3082
- return n = { changes: m, settings: wt(t, m) }, o.emit(), Je(e, Yn(m)), n.settings;
3114
+ return n = { changes: m, settings: gt(t, m) }, o.emit(), Je(e, Yn(m)), n.settings;
3083
3115
  }
3084
3116
  };
3085
- }, ds = Object.freeze({ status: "refreshed" }), us = Object.freeze({ status: "superseded" }), ot = Object.freeze({ status: "deferred" }), fs = wn(ot), qn = 4, ms = qn - 1, Kt = Object.freeze({ status: "loading" }), hs = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), ps = (e) => {
3086
- const t = /* @__PURE__ */ new Map(), n = kn(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = Oe(), m = /* @__PURE__ */ new Set();
3117
+ }, da = Object.freeze({ status: "refreshed" }), ua = Object.freeze({ status: "superseded" }), ot = Object.freeze({ status: "deferred" }), fa = gn(ot), qn = 4, ma = qn - 1, Kt = Object.freeze({ status: "loading" }), ha = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), pa = (e) => {
3118
+ const t = /* @__PURE__ */ new Map(), n = kn(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = Me(), m = /* @__PURE__ */ new Set();
3087
3119
  let f = 0, d = 0;
3088
- const h = { direct: null, bulk: null }, w = /* @__PURE__ */ new Set();
3089
- let b = !1, O = 0;
3090
- const T = () => {
3091
- O += 1, u.emit();
3092
- }, S = (p) => o.get(p) ?? 0, M = (p) => {
3120
+ const h = { direct: null, bulk: null }, g = /* @__PURE__ */ new Set();
3121
+ let b = !1, M = 0;
3122
+ const R = () => {
3123
+ M += 1, u.emit();
3124
+ }, S = (p) => o.get(p) ?? 0, A = (p) => {
3093
3125
  let x = l.get(p);
3094
3126
  return x === void 0 && (x = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, l.set(p, x)), x;
3095
3127
  }, L = (p, x, k) => {
@@ -3097,58 +3129,58 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3097
3129
  }, E = (p) => {
3098
3130
  const x = l.get(p);
3099
3131
  if (x !== void 0) {
3100
- for (const [k, C] of [...x.inFlight])
3101
- L(x, k, C), C.controller.abort();
3132
+ for (const [k, O] of [...x.inFlight])
3133
+ L(x, k, O), O.controller.abort();
3102
3134
  x.direct.clear(), x.bulk.clear(), x.unclaimed.clear();
3103
3135
  }
3104
3136
  }, v = (p) => {
3105
3137
  const x = S(p) + 1;
3106
3138
  return o.set(p, x), E(p), x;
3107
- }, s = (p, x) => {
3108
- const k = Ee(p), C = { promise: p, opened: x, stale: !1, loadedAt: k?.status === "ok" ? k.loadedAt : null };
3139
+ }, a = (p, x) => {
3140
+ const k = Ee(p), O = { promise: p, opened: x, stale: !1, loadedAt: k?.status === "ok" ? k.loadedAt : null };
3109
3141
  return p.status === "pending" && p.then(($) => {
3110
- $.status === "ok" && (C.loadedAt = $.loadedAt);
3111
- }), C;
3112
- }, a = (p) => {
3142
+ $.status === "ok" && (O.loadedAt = $.loadedAt);
3143
+ }), O;
3144
+ }, s = (p) => {
3113
3145
  let x = r.get(p);
3114
3146
  return x === void 0 && (x = /* @__PURE__ */ new Map(), r.set(p, x)), x;
3115
- }, g = (p) => {
3116
- const x = [...l.keys()], k = h[p], C = k === null ? 0 : x.indexOf(k) + 1;
3147
+ }, w = (p) => {
3148
+ const x = [...l.keys()], k = h[p], O = k === null ? 0 : x.indexOf(k) + 1;
3117
3149
  for (let $ = 0; $ < x.length; $ += 1) {
3118
- const B = x[(C + $) % x.length], K = B === void 0 ? void 0 : l.get(B);
3119
- if (!(B === void 0 || K === void 0)) {
3150
+ const I = x[(O + $) % x.length], K = I === void 0 ? void 0 : l.get(I);
3151
+ if (!(I === void 0 || K === void 0)) {
3120
3152
  for (const U of K[p])
3121
3153
  if ((K.claims.get(U) ?? 0) !== 0)
3122
- return K[p].delete(U), h[p] = B, { sourceId: B, path: U };
3154
+ return K[p].delete(U), h[p] = I, { sourceId: I, path: U };
3123
3155
  }
3124
3156
  }
3125
3157
  return null;
3126
- }, R = (p, x, k, C) => {
3158
+ }, T = (p, x, k, O) => {
3127
3159
  const $ = l.get(p);
3128
3160
  if ($ === void 0 || $.inFlight.get(x) !== k) return;
3129
3161
  L($, x, k);
3130
- const B = ($.claims.get(x) ?? 0) > 0, K = a(p);
3131
- if (C.status === "ok" ? K.set(x, { status: "loaded", entries: C.entries }) : C.status === "error" && B ? K.set(x, { status: "failed", failure: C.failure }) : K.delete(x), T(), C.status === "error" && B) {
3132
- const U = { sourceId: p, path: x, failure: C.failure };
3162
+ const I = ($.claims.get(x) ?? 0) > 0, K = s(p);
3163
+ if (O.status === "ok" ? K.set(x, { status: "loaded", entries: O.entries }) : O.status === "error" && I ? K.set(x, { status: "failed", failure: O.failure }) : K.delete(x), R(), O.status === "error" && I) {
3164
+ const U = { sourceId: p, path: x, failure: O.failure };
3133
3165
  for (const ie of [...m]) ie(U);
3134
3166
  }
3135
3167
  N();
3136
- }, A = (p, x, k) => {
3137
- const C = { controller: new AbortController(), lane: k };
3138
- M(p).inFlight.set(x, C), f += 1, k === "bulk" && (d += 1), e.children(p, x, C.controller.signal).then(
3139
- ($) => R(p, x, C, $),
3140
- () => R(p, x, C, hs)
3168
+ }, C = (p, x, k) => {
3169
+ const O = { controller: new AbortController(), lane: k };
3170
+ A(p).inFlight.set(x, O), f += 1, k === "bulk" && (d += 1), e.children(p, x, O.controller.signal).then(
3171
+ ($) => T(p, x, O, $),
3172
+ () => T(p, x, O, ha)
3141
3173
  );
3142
3174
  }, N = () => {
3143
3175
  for (; f < qn; ) {
3144
- const p = g("direct");
3176
+ const p = w("direct");
3145
3177
  if (p !== null) {
3146
- A(p.sourceId, p.path, "direct");
3178
+ C(p.sourceId, p.path, "direct");
3147
3179
  continue;
3148
3180
  }
3149
- const x = d < ms ? g("bulk") : null;
3181
+ const x = d < ma ? w("bulk") : null;
3150
3182
  if (x === null) return;
3151
- A(x.sourceId, x.path, "bulk");
3183
+ C(x.sourceId, x.path, "bulk");
3152
3184
  }
3153
3185
  }, q = (p, x, k) => {
3154
3186
  if (!(x.direct.delete(k) || x.bulk.delete(k))) {
@@ -3160,28 +3192,28 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3160
3192
  }, W = () => {
3161
3193
  b = !1;
3162
3194
  let p = !1;
3163
- for (const x of w) {
3164
- const k = M(x);
3165
- for (const C of k.unclaimed)
3166
- (k.claims.get(C) ?? 0) === 0 && q(x, k, C) && (p = !0);
3195
+ for (const x of g) {
3196
+ const k = A(x);
3197
+ for (const O of k.unclaimed)
3198
+ (k.claims.get(O) ?? 0) === 0 && q(x, k, O) && (p = !0);
3167
3199
  k.unclaimed.clear();
3168
3200
  }
3169
- w.clear(), p && (T(), N());
3201
+ g.clear(), p && (R(), N());
3170
3202
  }, z = (p, x) => {
3171
- t.set(p, s(Re(e.tree(p)), x));
3203
+ t.set(p, a(Te(e.tree(p)), x));
3172
3204
  }, j = (p, x, k) => {
3173
3205
  v(p);
3174
- const C = s(wn(x), k);
3175
- return t.set(p, C), r.delete(p), T(), N(), C;
3176
- }, Y = (p, x, k, C) => {
3206
+ const O = a(gn(x), k);
3207
+ return t.set(p, O), r.delete(p), R(), N(), O;
3208
+ }, Y = (p, x, k, O) => {
3177
3209
  if (k !== S(p) || t.get(p) !== x) return;
3178
3210
  const $ = Ee(x.promise);
3179
- if (!(C.status !== "ok" || $?.status !== "ok" || x.loadedAt === null || C.loadedAt <= x.loadedAt)) {
3180
- if (De($.entries, C.entries)) {
3181
- x.loadedAt = C.loadedAt;
3211
+ if (!(O.status !== "ok" || $?.status !== "ok" || x.loadedAt === null || O.loadedAt <= x.loadedAt)) {
3212
+ if (De($.entries, O.entries)) {
3213
+ x.loadedAt = O.loadedAt;
3182
3214
  return;
3183
3215
  }
3184
- j(p, C, x.opened);
3216
+ j(p, O, x.opened);
3185
3217
  }
3186
3218
  }, V = (p, x) => {
3187
3219
  const k = t.get(p);
@@ -3189,58 +3221,58 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3189
3221
  }, re = (p, x) => {
3190
3222
  x.stale = !1;
3191
3223
  const k = S(p);
3192
- e.tree(p).then((C) => Y(p, x, k, C));
3224
+ e.tree(p).then((O) => Y(p, x, k, O));
3193
3225
  };
3194
3226
  return {
3195
- read: (p) => t.get(p)?.promise ?? fs,
3227
+ read: (p) => t.get(p)?.promise ?? fa,
3196
3228
  open: (p) => {
3197
- const x = n.resumes(p), k = n.hold(p), C = t.get(p);
3198
- return C === void 0 || V(p, "deferred") ? (z(p, !0), T()) : x || (C.opened && V(p, "error") ? (z(p, !0), T()) : (C.opened = !0, C.stale && V(p, "ok") && re(p, C))), k;
3229
+ const x = n.resumes(p), k = n.hold(p), O = t.get(p);
3230
+ return O === void 0 || V(p, "deferred") ? (z(p, !0), R()) : x || (O.opened && V(p, "error") ? (z(p, !0), R()) : (O.opened = !0, O.stale && V(p, "ok") && re(p, O))), k;
3199
3231
  },
3200
3232
  retry: (p) => {
3201
- V(p, "error") && (z(p, !0), T());
3233
+ V(p, "error") && (z(p, !0), R());
3202
3234
  },
3203
3235
  seed: (p, x) => {
3204
3236
  const k = x.then(
3205
- (B) => B === null ? ot : B,
3237
+ (I) => I === null ? ot : I,
3206
3238
  () => ot
3207
- ), C = t.get(p);
3208
- if (C !== void 0 && V(p, "ok")) {
3209
- const B = S(p);
3210
- k.then((K) => Y(p, C, B, K));
3239
+ ), O = t.get(p);
3240
+ if (O !== void 0 && V(p, "ok")) {
3241
+ const I = S(p);
3242
+ k.then((K) => Y(p, O, I, K));
3211
3243
  return;
3212
3244
  }
3213
3245
  v(p);
3214
- const $ = s(Re(k), C?.opened === !0);
3215
- t.set(p, $), r.delete(p), N(), k.then((B) => {
3216
- t.get(p) === $ && (B.status === "deferred" && n.isHeld(p) && z(p, $.opened), T());
3246
+ const $ = a(Te(k), O?.opened === !0);
3247
+ t.set(p, $), r.delete(p), N(), k.then((I) => {
3248
+ t.get(p) === $ && (I.status === "deferred" && n.isHeld(p) && z(p, $.opened), R());
3217
3249
  });
3218
3250
  },
3219
3251
  refresh: async (p) => {
3220
3252
  const x = (i.get(p) ?? 0) + 1;
3221
3253
  i.set(p, x);
3222
3254
  const k = await e.refresh(p);
3223
- if (i.get(p) !== x) return us;
3255
+ if (i.get(p) !== x) return ua;
3224
3256
  if (k.status === "error") return { status: "failed", failure: k.failure };
3225
- const C = t.get(p);
3226
- if (!(C !== void 0 && C.loadedAt !== null && V(p, "ok") && C.loadedAt > k.loadedAt)) {
3227
- const B = j(p, k, !0);
3228
- if (C !== void 0 && C.promise.status === "pending") {
3257
+ const O = t.get(p);
3258
+ if (!(O !== void 0 && O.loadedAt !== null && V(p, "ok") && O.loadedAt > k.loadedAt)) {
3259
+ const I = j(p, k, !0);
3260
+ if (O !== void 0 && O.promise.status === "pending") {
3229
3261
  const K = S(p);
3230
- C.promise.then((U) => Y(p, B, K, U));
3262
+ O.promise.then((U) => Y(p, I, K, U));
3231
3263
  }
3232
3264
  }
3233
- for (const [B, K] of t)
3234
- B !== p && Ee(K.promise)?.status === "ok" && (K.stale = !0);
3235
- return ds;
3265
+ for (const [I, K] of t)
3266
+ I !== p && Ee(K.promise)?.status === "ok" && (K.stale = !0);
3267
+ return da;
3236
3268
  },
3237
3269
  children: (p, x) => r.get(p)?.get(x),
3238
3270
  claimChildren: (p, x) => {
3239
- const k = M(p), C = a(p);
3240
- let $ = !1, B = !1;
3271
+ const k = A(p), O = s(p);
3272
+ let $ = !1, I = !1;
3241
3273
  for (const [U, ie] of x)
3242
- k.claims.set(U, (k.claims.get(U) ?? 0) + 1), C.get(U) === void 0 ? (C.set(U, Kt), k[ie].add(U), $ = !0, B = !0) : ie === "direct" && k.bulk.delete(U) && (k.direct.add(U), B = !0);
3243
- $ && T(), B && N();
3274
+ k.claims.set(U, (k.claims.get(U) ?? 0) + 1), O.get(U) === void 0 ? (O.set(U, Kt), k[ie].add(U), $ = !0, I = !0) : ie === "direct" && k.bulk.delete(U) && (k.direct.add(U), I = !0);
3275
+ $ && R(), I && N();
3244
3276
  let K = !1;
3245
3277
  return () => {
3246
3278
  if (!K) {
@@ -3249,19 +3281,19 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3249
3281
  const ie = (k.claims.get(U) ?? 0) - 1;
3250
3282
  ie > 0 ? k.claims.set(U, ie) : (k.claims.delete(U), k.unclaimed.add(U));
3251
3283
  }
3252
- w.add(p), !b && (b = !0, queueMicrotask(W));
3284
+ g.add(p), !b && (b = !0, queueMicrotask(W));
3253
3285
  }
3254
3286
  };
3255
3287
  },
3256
3288
  retryChildren: (p, x) => {
3257
3289
  const k = r.get(p);
3258
3290
  if (k === void 0 || k.get(x)?.status !== "failed") return;
3259
- const C = M(p);
3260
- if ((C.claims.get(x) ?? 0) > 0) {
3261
- k.set(x, Kt), C.direct.add(x), T(), N();
3291
+ const O = A(p);
3292
+ if ((O.claims.get(x) ?? 0) > 0) {
3293
+ k.set(x, Kt), O.direct.add(x), R(), N();
3262
3294
  return;
3263
3295
  }
3264
- k.delete(x), T();
3296
+ k.delete(x), R();
3265
3297
  },
3266
3298
  pendingChildren: (p) => {
3267
3299
  const x = l.get(p);
@@ -3270,17 +3302,17 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3270
3302
  clear: () => {
3271
3303
  for (const p of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...l.keys()])) v(p);
3272
3304
  for (const [p, x] of i) i.set(p, x + 1);
3273
- t.clear(), r.clear(), T();
3305
+ t.clear(), r.clear(), R();
3274
3306
  },
3275
3307
  subscribeChildrenFailures: (p) => (m.add(p), () => {
3276
3308
  m.delete(p);
3277
3309
  }),
3278
3310
  subscribe: u.subscribe,
3279
- version: () => O
3311
+ version: () => M
3280
3312
  };
3281
- }, vs = (e, t) => {
3313
+ }, va = (e, t) => {
3282
3314
  let n = e;
3283
- const r = Oe();
3315
+ const r = Me();
3284
3316
  return {
3285
3317
  getSnapshot: () => n,
3286
3318
  subscribe: r.subscribe,
@@ -3288,26 +3320,26 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3288
3320
  n = { ...n, ...o }, t(n), r.emit();
3289
3321
  }
3290
3322
  };
3291
- }, gs = 1;
3292
- let Ce = 0, de = null;
3293
- const ws = () => {
3323
+ }, wa = 1;
3324
+ let Oe = 0, de = null;
3325
+ const ga = () => {
3294
3326
  const { documentElement: e, body: t } = document;
3295
- Ce === 0 && (de = { htmlOverflow: e.style.overflow, bodyOverflow: t.style.overflow, htmlGutter: e.style.scrollbarGutter, bodyGutter: t.style.scrollbarGutter }, e.style.overflow = "hidden", t.style.overflow = "hidden", e.style.scrollbarGutter = "auto", t.style.scrollbarGutter = "auto"), Ce += 1;
3327
+ Oe === 0 && (de = { htmlOverflow: e.style.overflow, bodyOverflow: t.style.overflow, htmlGutter: e.style.scrollbarGutter, bodyGutter: t.style.scrollbarGutter }, e.style.overflow = "hidden", t.style.overflow = "hidden", e.style.scrollbarGutter = "auto", t.style.scrollbarGutter = "auto"), Oe += 1;
3296
3328
  let n = !1;
3297
3329
  return () => {
3298
- n || (n = !0, Ce -= 1, !(Ce > 0 || de === null) && (e.style.overflow = de.htmlOverflow, t.style.overflow = de.bodyOverflow, e.style.scrollbarGutter = de.htmlGutter, t.style.scrollbarGutter = de.bodyGutter, de = null));
3330
+ n || (n = !0, Oe -= 1, !(Oe > 0 || de === null) && (e.style.overflow = de.htmlOverflow, t.style.overflow = de.bodyOverflow, e.style.scrollbarGutter = de.htmlGutter, t.style.scrollbarGutter = de.bodyGutter, de = null));
3299
3331
  };
3300
- }, bs = [
3332
+ }, ba = [
3301
3333
  { selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
3302
3334
  { selector: "[data-aqmx-explorer-body]", name: "tree area" }
3303
- ], Xt = 1, Yt = (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.", Es = (e) => {
3335
+ ], Xt = 1, Ea = 1e3, Yt = (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.", ya = (e) => {
3304
3336
  if (!Yt(e)) return null;
3305
3337
  const t = e.getBoundingClientRect(), n = window.innerHeight;
3306
- if (t.bottom > n + gs)
3338
+ if (t.bottom > n + wa)
3307
3339
  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}`;
3308
3340
  if (t.height < Xt)
3309
3341
  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}`;
3310
- for (const { selector: r, name: o } of bs)
3342
+ for (const { selector: r, name: o } of ba)
3311
3343
  for (const i of e.querySelectorAll(r)) {
3312
3344
  if (!Yt(i)) continue;
3313
3345
  const l = i.getBoundingClientRect().height;
@@ -3315,37 +3347,39 @@ const ws = () => {
3315
3347
  return `[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(l))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Ke}`;
3316
3348
  }
3317
3349
  return null;
3318
- }, ys = (e) => {
3319
- let t = !1;
3320
- const n = () => {
3321
- if (t) return;
3322
- const o = Es(e);
3323
- o !== null && (t = !0, console.error(o));
3324
- }, r = typeof ResizeObserver > "u" ? null : new ResizeObserver(n);
3325
- return r?.observe(e), window.addEventListener("resize", n), n(), () => {
3326
- r?.disconnect(), window.removeEventListener("resize", n);
3350
+ }, xa = (e) => {
3351
+ let t = !1, n;
3352
+ const r = () => {
3353
+ n = void 0;
3354
+ const l = ya(e);
3355
+ l !== null && (t = !0, console.error(l));
3356
+ }, o = () => {
3357
+ t || (clearTimeout(n), n = setTimeout(r, Ea));
3358
+ }, i = typeof ResizeObserver > "u" ? null : new ResizeObserver(o);
3359
+ return i?.observe(e), window.addEventListener("resize", o), o(), () => {
3360
+ clearTimeout(n), i?.disconnect(), window.removeEventListener("resize", o);
3327
3361
  };
3328
- }, xs = (e, t) => {
3329
- te(() => e ? ws() : void 0, [e]), te(() => {
3362
+ }, Sa = (e, t) => {
3363
+ te(() => e ? ga() : void 0, [e]), te(() => {
3330
3364
  const n = t.current;
3331
3365
  if (!(!e || n === null))
3332
- return ys(n);
3366
+ return xa(n);
3333
3367
  }, [e, t]);
3334
- }, Jt = '[data-testid="markdown-explorer-view-switch"]', Ss = [
3368
+ }, Jt = '[data-testid="markdown-explorer-view-switch"]', ka = [
3335
3369
  { control: Jt, successors: [Jt, '[data-testid="markdown-explorer-sheet-toggle"]'] },
3336
3370
  { control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
3337
- ], ks = (e) => {
3338
- for (const t of Ss) {
3371
+ ], Ta = (e) => {
3372
+ for (const t of ka) {
3339
3373
  const n = e.closest(t.control);
3340
3374
  if (n !== null) return { element: n, control: t };
3341
3375
  }
3342
3376
  return null;
3343
- }, Rs = (e, t) => {
3377
+ }, Ra = (e, t) => {
3344
3378
  const n = _(null);
3345
3379
  te(() => {
3346
3380
  const o = (u) => {
3347
3381
  const m = e.current;
3348
- n.current = m !== null && u instanceof Element && m.contains(u) ? ks(u) : null;
3382
+ n.current = m !== null && u instanceof Element && m.contains(u) ? Ta(u) : null;
3349
3383
  }, i = (u) => o(u.target);
3350
3384
  o(document.activeElement);
3351
3385
  const l = (u) => {
@@ -3383,7 +3417,7 @@ const ws = () => {
3383
3417
  });
3384
3418
  return u.observe(l, { childList: !0, subtree: !0 }), () => u.disconnect();
3385
3419
  }, [t, e]);
3386
- }, Ts = it(() => import("./TreeLayout-CXX-rFO6.js").then((e) => ({ default: e.TreeLayout }))), Os = it(() => import("./MultiLayout-DYy66vcO.js").then((e) => ({ default: e.MultiLayout }))), Cs = 64, As = {
3420
+ }, Ma = it(() => import("./TreeLayout-BPa7NdeT.js").then((e) => ({ default: e.TreeLayout }))), Oa = it(() => import("./MultiLayout-rsmtFma5.js").then((e) => ({ default: e.MultiLayout }))), Ca = 64, La = {
3387
3421
  request: (e) => {
3388
3422
  requestAnimationFrame(e);
3389
3423
  }
@@ -3392,28 +3426,28 @@ const ws = () => {
3392
3426
  }, Xe = (e, t) => {
3393
3427
  t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
3394
3428
  for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
3395
- }, Ls = (e, t) => {
3396
- const [n, r] = I(() => ({ overrides: t, locale: e, labels: Tt(e, t) }));
3429
+ }, Aa = (e, t) => {
3430
+ const [n, r] = B(() => ({ overrides: t, locale: e, labels: Rt(e, t) }));
3397
3431
  if (n.locale === e && Nr(n.overrides, t)) return n.labels;
3398
- const o = { overrides: t, locale: e, labels: Tt(e, t) };
3432
+ const o = { overrides: t, locale: e, labels: Rt(e, t) };
3399
3433
  return r(o), o.labels;
3400
- }, Ms = (e, t, n) => {
3401
- const [r, o] = I(() => ({ scope: t, store: Wt(e, n) }));
3434
+ }, Na = (e, t, n) => {
3435
+ const [r, o] = B(() => ({ scope: t, store: Wt(e, n) }));
3402
3436
  if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
3403
3437
  const i = { scope: t, store: Wt(e, n) };
3404
3438
  return o(i), i.store;
3405
3439
  }, Ye = (e, t) => {
3406
- const [n, r] = I(() => ({ scope: e, value: t() }));
3440
+ const [n, r] = B(() => ({ scope: e, value: t() }));
3407
3441
  if (n.scope === e) return n.value;
3408
3442
  const o = { scope: e, value: t() };
3409
3443
  return r(o), o.value;
3410
- }, Ns = () => is(As), en = "on", Ds = "off", Ps = Object.freeze({ kind: "unavailable" }), $s = (e) => {
3444
+ }, Da = () => ia(La), en = "on", Pa = "off", $a = Object.freeze({ kind: "unavailable" }), Fa = (e) => {
3411
3445
  if (e !== void 0 && (e === null || typeof e != "object" || typeof e.convert != "function"))
3412
3446
  throw new TypeError("[markdown-explorer] draftConverter must be an object with a convert function");
3413
- }, Fs = (e, t) => {
3447
+ }, qa = (e, t) => {
3414
3448
  const n = ue(e.peek(t));
3415
- return n === null || n.document.kind === "failure" ? ae(t) : n.document.name;
3416
- }, Js = ({
3449
+ return n === null || n.document.kind === "failure" ? se(t) : n.document.name;
3450
+ }, Qa = ({
3417
3451
  data: e,
3418
3452
  config: t,
3419
3453
  storageNamespace: n,
@@ -3427,93 +3461,93 @@ const ws = () => {
3427
3461
  onEditGrant: d,
3428
3462
  draftConverter: h
3429
3463
  }) => {
3430
- xr(n), $s(h);
3431
- const w = un(r), b = Dr(i), O = Ls(w, o), { revalidate: T } = Vn(), S = _(() => {
3432
- }), M = $e(t.dataPath), [L] = I(() => {
3433
- const k = ss({ dataPath: M, onScope: ($) => S.current($) }), C = { documents: $o({ client: k, capacity: Math.max(Cs, t.multiView.maxPanels * 2) }), trees: ps(k) };
3434
- return Xe(C, e), kt(n, e.scope), { data: k, ...C, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
3464
+ xr(n), Fa(h);
3465
+ const g = un(r), b = Dr(i), M = Aa(g, o), { revalidate: R } = Vn(), S = _(() => {
3466
+ }), A = $e(t.dataPath), [L] = B(() => {
3467
+ const k = aa({ dataPath: A, onScope: ($) => S.current($) }), O = { documents: $o({ client: k, capacity: Math.max(Ca, t.multiView.maxPanels * 2) }), trees: pa(k) };
3468
+ return Xe(O, e), kt(n, e.scope), { data: k, ...O, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
3435
3469
  });
3436
3470
  if (L.aligned.pageData !== e || L.aligned.storageNamespace !== n) {
3437
3471
  const k = L.aligned.pageData;
3438
3472
  L.aligned.pageData = e, L.aligned.storageNamespace = n, k !== e && (k.scope !== e.scope ? L.aligned.pendingReader = e : Xe(L, e)), kt(n, e.scope);
3439
3473
  }
3440
- const E = Ms(ge(n).treeSettings, e.scope, t.defaultTreeSettings);
3474
+ const E = Na(we(n).treeSettings, e.scope, t.defaultTreeSettings);
3441
3475
  H(() => {
3442
3476
  const k = L.aligned.pendingReader;
3443
3477
  k !== null && (L.aligned.pendingReader = null, Qt(L), Xe(L, k));
3444
3478
  }, [e, L]), H(() => {
3445
3479
  let k = !1;
3446
- return S.current = (C) => {
3447
- C === e.scope || k || (k = !0, C !== null && (Qt(L), Sr(n)), T());
3480
+ return S.current = (O) => {
3481
+ O === e.scope || k || (k = !0, O !== null && (Qt(L), Sr(n)), R());
3448
3482
  }, () => {
3449
3483
  S.current = () => {
3450
3484
  };
3451
3485
  };
3452
- }, [e, T, L, n]);
3486
+ }, [e, R, L, n]);
3453
3487
  const v = _(t.settingsCookie);
3454
3488
  H(() => {
3455
3489
  v.current = t.settingsCookie;
3456
3490
  }, [t.settingsCookie]);
3457
- const [s] = I(
3458
- () => vs(e.settings, (k) => {
3491
+ const [a] = B(
3492
+ () => va(e.settings, (k) => {
3459
3493
  document.cookie = er(v.current, k, window.location.protocol === "https:");
3460
3494
  })
3461
- ), a = Ye(e.scope, Ns), g = Ye(e.scope, as), R = _(O);
3495
+ ), s = Ye(e.scope, Da), w = Ye(e.scope, sa), T = _(M);
3462
3496
  H(() => {
3463
- R.current = O;
3464
- }, [O]);
3465
- const A = Ye(
3497
+ T.current = M;
3498
+ }, [M]);
3499
+ const C = Ye(
3466
3500
  e.scope,
3467
3501
  () => Vr({
3468
3502
  data: L.data,
3469
- conflictLabels: () => ({ ours: R.current.conflictOurs, theirs: R.current.conflictTheirs }),
3470
- onSaveSettled: (k, C) => {
3471
- C.kind === "saved" && L.documents.refresh(k);
3472
- const $ = $r(R.current, C, Fs(L.documents, k));
3473
- $ !== null && a.announce($);
3503
+ conflictLabels: () => ({ ours: T.current.conflictOurs, theirs: T.current.conflictTheirs }),
3504
+ onSaveSettled: (k, O) => {
3505
+ O.kind === "saved" && L.documents.refresh(k);
3506
+ const $ = $r(T.current, O, qa(L.documents, k));
3507
+ $ !== null && s.announce($);
3474
3508
  },
3475
3509
  sideBySideSetting: {
3476
- read: () => Qe(ge(n).editPreview) === en,
3477
- write: (k) => Je(ge(n).editPreview, k ? en : Ds)
3510
+ read: () => Qe(we(n).editPreview) === en,
3511
+ write: (k) => Je(we(n).editPreview, k ? en : Pa)
3478
3512
  },
3479
3513
  editorShareSetting: {
3480
- read: () => Hr(Qe(ge(n).editSplit)),
3481
- write: (k) => Je(ge(n).editSplit, String(k))
3514
+ read: () => Hr(Qe(we(n).editSplit)),
3515
+ write: (k) => Je(we(n).editSplit, String(k))
3482
3516
  }
3483
3517
  })
3484
- ), N = G(() => Re(e.notices.catch(() => [])), [e.notices]), q = e.sources.map((k) => k.id).join(`
3518
+ ), N = G(() => Te(e.notices.catch(() => [])), [e.notices]), q = e.sources.map((k) => k.id).join(`
3485
3519
  `), W = G(() => Qn(t, q.split(`
3486
3520
  `)), [t, q]), z = _(f);
3487
3521
  H(() => {
3488
3522
  z.current = f;
3489
3523
  }, [f]);
3490
- const [j] = I(() => (k, C) => {
3491
- z.current?.(k, C);
3524
+ const [j] = B(() => (k, O) => {
3525
+ z.current?.(k, O);
3492
3526
  }), Y = f === void 0 ? void 0 : j, V = _(h);
3493
3527
  H(() => {
3494
3528
  V.current = h;
3495
3529
  }, [h]);
3496
- const [re] = I(() => {
3530
+ const [re] = B(() => {
3497
3531
  let k = !1;
3498
3532
  return {
3499
- convert: (C, $) => {
3500
- const B = V.current;
3501
- return B === void 0 ? Promise.resolve(Ps) : B.convert(C, $);
3533
+ convert: (O, $) => {
3534
+ const I = V.current;
3535
+ return I === void 0 ? Promise.resolve($a) : I.convert(O, $);
3502
3536
  },
3503
3537
  prepare: () => {
3504
3538
  try {
3505
3539
  V.current?.prepare?.();
3506
- } catch (C) {
3540
+ } catch (O) {
3507
3541
  if (k) return;
3508
- k = !0, console.error("[markdown-explorer] the draft converter's prepare threw", C);
3542
+ k = !0, console.error("[markdown-explorer] the draft converter's prepare threw", O);
3509
3543
  }
3510
3544
  }
3511
3545
  };
3512
3546
  }), p = h === void 0 ? void 0 : re, x = G(
3513
3547
  () => ({
3514
3548
  config: W,
3515
- labels: O,
3516
- locale: w,
3549
+ labels: M,
3550
+ locale: g,
3517
3551
  theme: b,
3518
3552
  storageNamespace: n,
3519
3553
  scope: e.scope,
@@ -3522,80 +3556,80 @@ const ws = () => {
3522
3556
  documents: L.documents,
3523
3557
  trees: L.trees,
3524
3558
  data: L.data,
3525
- viewSettings: s,
3559
+ viewSettings: a,
3526
3560
  treeSettings: E,
3527
- announcer: a,
3528
- reveals: g,
3529
- edits: A,
3561
+ announcer: s,
3562
+ reveals: w,
3563
+ edits: C,
3530
3564
  onEditGrant: d,
3531
3565
  draftConverter: p,
3532
3566
  renderTreeFailure: u,
3533
3567
  reportMathDiagnostics: Y
3534
3568
  }),
3535
- [W, O, w, b, n, e.scope, e.sources, N, L, s, E, a, g, A, d, p, u, Y]
3569
+ [W, M, g, b, n, e.scope, e.sources, N, L, a, E, s, w, C, d, p, u, Y]
3536
3570
  );
3537
- return /* @__PURE__ */ c(fn, { value: x, children: /* @__PURE__ */ c(_s, { renderFrame: l, lockDocumentScroll: m }, e.scope) });
3538
- }, qs = ({ ref: e, theme: t, view: n, children: r }) => {
3539
- const [o] = I(bi);
3571
+ return /* @__PURE__ */ c(fn, { value: x, children: /* @__PURE__ */ c(Ia, { renderFrame: l, lockDocumentScroll: m }, e.scope) });
3572
+ }, _a = ({ ref: e, theme: t, view: n, children: r }) => {
3573
+ const [o] = B(bi);
3540
3574
  return /* @__PURE__ */ c("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 });
3541
- }, _s = ({ renderFrame: e, lockDocumentScroll: t }) => {
3575
+ }, Ia = ({ renderFrame: e, lockDocumentScroll: t }) => {
3542
3576
  const { theme: n, labels: r } = D(), o = lt(), { hash: i } = nn(), l = Fe(), u = _(null);
3543
- xs(t, u), H(() => {
3577
+ Sa(t, u), H(() => {
3544
3578
  o.kind === "redirect" && l(`${o.href}${i}`, "browse");
3545
3579
  }, [o, i, l]);
3546
3580
  const { location: m } = o, f = m.view;
3547
- Rs(u, f);
3548
- const d = m.view === "tree" ? /* @__PURE__ */ c(ke, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading", ...et }), children: /* @__PURE__ */ c(Ts, { location: m }) }) : m.view === "multi" ? /* @__PURE__ */ c(ke, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading", ...et }), children: /* @__PURE__ */ c(Os, { location: m }) }) : /* @__PURE__ */ c(rs, { location: m }), h = /* @__PURE__ */ F(qs, { ref: u, theme: n, view: f, children: [
3581
+ Ra(u, f);
3582
+ const d = m.view === "tree" ? /* @__PURE__ */ c(ke, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading", ...et }), children: /* @__PURE__ */ c(Ma, { location: m }) }) : m.view === "multi" ? /* @__PURE__ */ c(ke, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading", ...et }), children: /* @__PURE__ */ c(Oa, { location: m }) }) : /* @__PURE__ */ c(ra, { location: m }), h = /* @__PURE__ */ F(_a, { ref: u, theme: n, view: f, children: [
3549
3583
  d,
3550
- /* @__PURE__ */ c(ao, {}),
3551
- /* @__PURE__ */ c(os, { holds: !0, testId: "markdown-explorer-announcer" })
3584
+ /* @__PURE__ */ c(so, {}),
3585
+ /* @__PURE__ */ c(oa, { holds: !0, testId: "markdown-explorer-announcer" })
3552
3586
  ] });
3553
3587
  return e === void 0 ? h : e({ view: f, children: h });
3554
- }, Qs = kr({ submissions: "skip", otherPath: "skip", query: "skip", hashChange: "skip" });
3588
+ }, es = kr({ submissions: "skip", otherPath: "skip", query: "skip", hashChange: "skip" });
3555
3589
  export {
3556
- Rt as $,
3590
+ Tt as $,
3557
3591
  rt as A,
3558
3592
  Zt as B,
3559
3593
  Fr as C,
3560
- ns as D,
3594
+ na as D,
3561
3595
  Pl as E,
3562
3596
  Jr as F,
3563
3597
  ql as G,
3564
- Oe as H,
3565
- Xs as I,
3598
+ Me as H,
3599
+ Ya as I,
3566
3600
  yi as J,
3567
3601
  Ur as K,
3568
3602
  xn as L,
3569
3603
  Do as M,
3570
3604
  Qi as N,
3571
- wl as O,
3572
- ts as P,
3605
+ gl as O,
3606
+ ta as P,
3573
3607
  Lo as Q,
3574
- Al as R,
3575
- Ao as S,
3608
+ Cl as R,
3609
+ Co as S,
3576
3610
  lt as T,
3577
- os as U,
3578
- Me as V,
3579
- Rr as W,
3580
- Ot as X,
3581
- Ar as Y,
3611
+ oa as U,
3612
+ Ae as V,
3613
+ Tr as W,
3614
+ Mt as X,
3615
+ Cr as Y,
3582
3616
  dn as Z,
3583
- Tr as _,
3617
+ Rr as _,
3584
3618
  qr as a,
3585
- Js as a0,
3586
- Tt as a1,
3587
- Qs as a2,
3619
+ Qa as a0,
3620
+ Rt as a1,
3621
+ es as a2,
3588
3622
  _r as b,
3589
3623
  Fe as c,
3590
3624
  Jl as d,
3591
3625
  et as e,
3592
3626
  vl as f,
3593
3627
  So as g,
3594
- Br as h,
3595
- Oo as i,
3628
+ Ir as h,
3629
+ Mo as i,
3596
3630
  xo as j,
3597
- se as k,
3598
- Co as l,
3631
+ ae as k,
3632
+ Oo as l,
3599
3633
  ue as m,
3600
3634
  Eo as n,
3601
3635
  yo as o,
@@ -3603,11 +3637,11 @@ export {
3603
3637
  lo as q,
3604
3638
  to as r,
3605
3639
  Fl as s,
3606
- Ks as t,
3640
+ Xa as t,
3607
3641
  D as u,
3608
3642
  ko as v,
3609
- Ys as w,
3643
+ Ja as w,
3610
3644
  hn as x,
3611
- Bl as y,
3645
+ Il as y,
3612
3646
  _l as z
3613
3647
  };