@aiquants/markdown-explorer 0.19.0 → 0.21.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 (32) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/README.md +18 -9
  3. package/dist/EditSurface-Bwl4S1vQ.cjs +7 -0
  4. package/dist/EditSurface-rKoy_ndP.js +880 -0
  5. package/dist/{ExplorerSplit-LiI3IUZn.js → ExplorerSplit-3WMRDA7G.js} +1 -1
  6. package/dist/{ExplorerSplit-BDkBN8A0.cjs → ExplorerSplit-CdqEKz-I.cjs} +1 -1
  7. package/dist/{MultiLayout-BOaQK8fp.cjs → MultiLayout-BEg1X8Jx.cjs} +1 -1
  8. package/dist/{MultiLayout-KWacTPP8.js → MultiLayout-Gf1xT-Le.js} +2 -2
  9. package/dist/{NativeScrollBar-zzpty31a.js → NativeScrollBar-0cpp2OIu.js} +1 -1
  10. package/dist/{NativeScrollBar-BPgV3kp-.cjs → NativeScrollBar-idIQsvCv.cjs} +1 -1
  11. package/dist/{TreeLayout-S5TMf8_A.cjs → TreeLayout-DJY_WqzP.cjs} +1 -1
  12. package/dist/{TreeLayout-C8IP4cjY.js → TreeLayout-DzZCgMTt.js} +2 -2
  13. package/dist/core/labels.d.cts +26 -0
  14. package/dist/core/labels.d.ts +26 -0
  15. package/dist/{index-Dz01kBab.js → index-CJgHGeZs.js} +1323 -1238
  16. package/dist/index-bMaSoQTe.cjs +13 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/{merge-ClVgYrkS.js → merge-BOcofJN5.js} +1 -1
  20. package/dist/{merge-B7Lkcdz0.cjs → merge-BVk6pvO_.cjs} +1 -1
  21. package/dist/sanitizePolicy-BWQtWhsL.js +98 -0
  22. package/dist/sanitizePolicy-gEXeavb-.cjs +1 -0
  23. package/dist/sanitizeWorker.cjs +1 -1
  24. package/dist/sanitizeWorker.js +1 -1
  25. package/docs/behavior/localization.md +5 -1
  26. package/docs/behavior/security.md +18 -8
  27. package/package.json +9 -7
  28. package/dist/EditSurface-4VX20isB.cjs +0 -2
  29. package/dist/EditSurface-Ckg-3iTA.js +0 -786
  30. package/dist/index-DrKHJNY4.cjs +0 -13
  31. package/dist/sanitizePolicy-DlrakwA4.js +0 -96
  32. package/dist/sanitizePolicy-DrIMuYCb.cjs +0 -1
@@ -1,21 +1,27 @@
1
- import { jsxs as F, jsx as c, Fragment as Pe } from "react/jsx-runtime";
1
+ import { jsxs as $, jsx as d, 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 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";
3
+ import { createContext as pe, use as re, useMemo as U, useSyncExternalStore as ee, useRef as _, useLayoutEffect as j, useCallback as P, useId as xe, useEffect as te, Component as tn, Suspense as ke, lazy as it, useState as z, useEffectEvent as ae } from "react";
4
+ import { useParams as _n, useSearchParams as In, matchPath as Bn, useBlocker as zn, useNavigate as jn, Link as Hn, useHref as Fe, useLocation as nn, useRevalidator as Vn } from "react-router";
5
+ import { j as Zn, g as rn, z as Un, E as on, a as an, B as Gn, D as wt, G as Wn, H as be, e as Se, 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 Y, x as rr, H as Et, z as Ve, I as or, J as ir, K as ar, L as lr, N as sr, f as dr, O as St, v as cr, 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 yt } from "./dataRoute-CObbjNxG.js";
7
+ import { HostedScrollArea as xt, useMarkdownToolbarState as br, MarkdownViewer as ln } from "@aiquants/markdown";
8
8
  import { SOURCE_LINES_ATTRIBUTE as sn, parseSourceLines as Er } from "@aiquants/markdown/source-lines";
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 we, c as Sr } from "./storage-CmGHg7OA.js";
9
+ import { DEFAULT_CONTENT_ALIGN as Sr } from "@aiquants/markdown/viewer-settings";
10
+ import { w as Je, r as Qe, a as yr, b as kt, s as we, c as xr } from "./storage-CmGHg7OA.js";
11
11
  import { createShouldRevalidate as kr } from "@aiquants/route-revalidation";
12
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
- multiColumnRegion: Object.freeze(["column"])
18
- }), Mr = /\{(\w+)\}/gu, cn = {
17
+ multiColumnRegion: Object.freeze(["column"]),
18
+ viewerSpreadsheetSize: Object.freeze(["rows", "cols"]),
19
+ viewerSpreadsheetCopyFailed: Object.freeze(["reason"]),
20
+ viewerSpreadsheetCellAnnouncement: Object.freeze(["cell", "value"]),
21
+ viewerSpreadsheetSelectionAnnouncement: Object.freeze(["range"]),
22
+ viewerSpreadsheetOptionsError: Object.freeze(["message"]),
23
+ viewerSpreadsheetLoadFailed: Object.freeze(["message"])
24
+ }), Or = /\{(\w+)\}/gu, dn = {
19
25
  explorerRegion: "Explorer",
20
26
  sourceLabel: "Source",
21
27
  refreshTreeLabel: "Refresh tree",
@@ -244,6 +250,32 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
244
250
  viewerEmbeddedVideo: "embedded video",
245
251
  viewerEmbeddedPost: "embedded post",
246
252
  viewerEmbeddedFrame: "Embedded content",
253
+ viewerSpreadsheetTable: "Spreadsheet",
254
+ viewerSpreadsheetZoomIn: "Zoom in",
255
+ viewerSpreadsheetZoomOut: "Zoom out",
256
+ viewerSpreadsheetResetZoom: "Reset zoom",
257
+ viewerSpreadsheetHighlight: "Highlight the active row and column",
258
+ viewerSpreadsheetCopyAll: "Copy the whole table",
259
+ viewerSpreadsheetSaveTsv: "Save as TSV",
260
+ viewerSpreadsheetSaveMenu: "More ways to save",
261
+ viewerSpreadsheetSaveTsvWithBom: "Save with a BOM (for Excel)",
262
+ viewerSpreadsheetFullscreen: "View full screen",
263
+ viewerSpreadsheetExitFullscreen: "Exit full screen",
264
+ viewerSpreadsheetFullscreenDialog: "Spreadsheet (full screen)",
265
+ viewerSpreadsheetSize: "Rows {rows} × columns {cols}",
266
+ viewerSpreadsheetFileName: "spreadsheet.tsv",
267
+ viewerSpreadsheetCopied: "Copied the whole table.",
268
+ viewerSpreadsheetCopyFailed: "Could not copy the table: {reason}",
269
+ viewerSpreadsheetCellAnnouncement: "{cell}, {value}",
270
+ viewerSpreadsheetEmptyCell: "blank",
271
+ viewerSpreadsheetSelectionAnnouncement: "{range} selected",
272
+ viewerSpreadsheetReadOnly: "This table is read-only here.",
273
+ viewerSpreadsheetFormatRefused: "This table keeps text only, so formatting and links are not saved.",
274
+ viewerSpreadsheetFenceRefused: "A cell cannot begin a line with ``` or ~~~ in this table, so the change was not saved.",
275
+ viewerSpreadsheetEditConflict: "The table changed in the editor, so the change was not saved. Try again.",
276
+ viewerSpreadsheetOptionsError: "Invalid spreadsheet options: {message}",
277
+ viewerSpreadsheetLoadFailed: "Could not load the spreadsheet: {message}",
278
+ viewerSpreadsheetRetry: "Retry",
247
279
  multiRegion: "Panels",
248
280
  multiEmpty: "Select documents in the explorer to open them side by side.",
249
281
  panelLimit: (e) => `You can open up to ${String(e)} panels at once.`,
@@ -276,7 +308,7 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
276
308
  multiColumnEmpty: "This column is empty",
277
309
  multiColumnRegion: "Column {column}",
278
310
  panelDropHere: "Drop the panel here"
279
- }, Or = {
311
+ }, Cr = {
280
312
  explorerRegion: "エクスプローラー",
281
313
  sourceLabel: "ソース",
282
314
  refreshTreeLabel: "ツリーを更新",
@@ -505,6 +537,32 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
505
537
  viewerEmbeddedVideo: "埋め込みの動画",
506
538
  viewerEmbeddedPost: "埋め込みの投稿",
507
539
  viewerEmbeddedFrame: "埋め込みのコンテンツ",
540
+ viewerSpreadsheetTable: "表",
541
+ viewerSpreadsheetZoomIn: "拡大",
542
+ viewerSpreadsheetZoomOut: "縮小",
543
+ viewerSpreadsheetResetZoom: "拡大率を戻す",
544
+ viewerSpreadsheetHighlight: "選んだ行と列を強調",
545
+ viewerSpreadsheetCopyAll: "表全体をコピー",
546
+ viewerSpreadsheetSaveTsv: "TSV として保存",
547
+ viewerSpreadsheetSaveMenu: "ほかの保存の方法",
548
+ viewerSpreadsheetSaveTsvWithBom: "BOM を付けて保存 (Excel 向け)",
549
+ viewerSpreadsheetFullscreen: "全画面で見る",
550
+ viewerSpreadsheetExitFullscreen: "全画面を閉じる",
551
+ viewerSpreadsheetFullscreenDialog: "表 (全画面)",
552
+ viewerSpreadsheetSize: "{rows} 行 × {cols} 列",
553
+ viewerSpreadsheetFileName: "表.tsv",
554
+ viewerSpreadsheetCopied: "表全体をコピーしました。",
555
+ viewerSpreadsheetCopyFailed: "表をコピーできませんでした: {reason}",
556
+ viewerSpreadsheetCellAnnouncement: "{cell}、{value}",
557
+ viewerSpreadsheetEmptyCell: "空白",
558
+ viewerSpreadsheetSelectionAnnouncement: "{range} を選択",
559
+ viewerSpreadsheetReadOnly: "この表はここでは編集できません。",
560
+ viewerSpreadsheetFormatRefused: "この表は文字だけを保つため、書式とリンクは保存しません。",
561
+ viewerSpreadsheetFenceRefused: "セルの行頭に ``` や ~~~ を置くと表が壊れるため、この変更は保存しませんでした。",
562
+ viewerSpreadsheetEditConflict: "エディタで表が変わっていたため、この変更は保存しませんでした。もう一度お試しください。",
563
+ viewerSpreadsheetOptionsError: "表の指定の誤り: {message}",
564
+ viewerSpreadsheetLoadFailed: "表を読み込めませんでした: {message}",
565
+ viewerSpreadsheetRetry: "再試行",
508
566
  multiRegion: "パネル",
509
567
  multiEmpty: "エクスプローラーで文書を選ぶと、ここに並べて開きます。",
510
568
  panelLimit: (e) => `同時に開けるのは ${String(e)} パネルまでです。`,
@@ -537,59 +595,59 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
537
595
  multiColumnEmpty: "この列は空です",
538
596
  multiColumnRegion: "{column} 列目",
539
597
  panelDropHere: "ここへパネルをドロップ"
540
- }, Cr = Object.freeze({
541
- en: Object.freeze(cn),
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) => {
598
+ }, Mr = Object.freeze({
599
+ en: Object.freeze(dn),
600
+ ja: Object.freeze(Cr)
601
+ }), cn = Object.freeze(Object.keys(dn)), Ar = new Set(cn), Lr = (e) => Ar.has(e), Me = (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
602
  if (e === void 0) return Tr;
545
603
  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)}`);
604
+ throw new RangeError(`[markdown-explorer] locale is the UI language (${Tt.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${Me(e)}`);
547
605
  }, Rt = (e, t) => {
548
- const n = Cr[un(e)];
606
+ const n = Mr[un(e)];
549
607
  if (t === void 0) return n;
550
608
  if (t === null || typeof t != "object")
551
- throw new RangeError(`[markdown-explorer] labels must be an object; got ${Ce(t)}`);
552
- if (!Un(t))
553
- throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${Ce(t)}`);
609
+ throw new RangeError(`[markdown-explorer] labels must be an object; got ${Me(t)}`);
610
+ if (!Zn(t))
611
+ throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${Me(t)}`);
554
612
  const r = t, o = { ...n };
555
613
  for (const i of Object.keys(r)) {
556
- if (!Ar(i))
557
- throw new RangeError(`[markdown-explorer] labels.${i} is not a known label key; expected one of ${dn.join(", ")}`);
558
- const l = r[i];
559
- if (l === void 0) continue;
614
+ if (!Lr(i))
615
+ throw new RangeError(`[markdown-explorer] labels.${i} is not a known label key; expected one of ${cn.join(", ")}`);
616
+ const a = r[i];
617
+ if (a === void 0) continue;
560
618
  const u = typeof n[i];
561
- if (typeof l !== u)
562
- throw new TypeError(`[markdown-explorer] labels.${i} must be a ${u}; got ${Ce(l)}`);
563
- if (typeof l == "string" && l.trim() === "")
619
+ if (typeof a !== u)
620
+ throw new TypeError(`[markdown-explorer] labels.${i} must be a ${u}; got ${Me(a)}`);
621
+ if (typeof a == "string" && a.trim() === "")
564
622
  throw new RangeError(`[markdown-explorer] labels.${i} must be a non-blank string`);
565
623
  const m = Rr[i];
566
- if (typeof l == "string" && m !== void 0) {
567
- for (const [, f] of l.matchAll(Mr))
624
+ if (typeof a == "string" && m !== void 0) {
625
+ for (const [, f] of a.matchAll(Or))
568
626
  if (!m.includes(f ?? ""))
569
- throw new RangeError(`[markdown-explorer] labels.${i} uses the unknown placeholder {${String(f)}}; it accepts ${m.map((d) => `{${d}}`).join(", ")}`);
627
+ throw new RangeError(`[markdown-explorer] labels.${i} uses the unknown placeholder {${String(f)}}; it accepts ${m.map((c) => `{${c}}`).join(", ")}`);
570
628
  }
571
- o[i] = l;
629
+ o[i] = a;
572
630
  }
573
631
  return Object.freeze(o);
574
632
  }, Nr = (e, t) => {
575
633
  if (Object.is(e, t)) return !0;
576
634
  if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
577
635
  const n = e, r = t, o = Object.keys(n), i = Object.keys(r);
578
- return o.length === i.length && i.every((l) => Object.hasOwn(n, l) && Object.is(n[l], r[l]));
579
- }, Mt = Object.freeze(["light", "dark"]), Dr = (e) => {
636
+ return o.length === i.length && i.every((a) => Object.hasOwn(n, a) && Object.is(n[a], r[a]));
637
+ }, Ot = Object.freeze(["light", "dark"]), Dr = (e) => {
580
638
  if (e === void 0) return "light";
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}`);
639
+ if (Ot.includes(e)) return e;
640
+ 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}`);
583
641
  }, fn = pe(null), D = () => {
584
- const e = ne(fn);
642
+ const e = re(fn);
585
643
  if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
586
644
  return e;
587
- }, Ae = (e) => {
645
+ }, Le = (e) => {
588
646
  const { viewSettings: t } = D(), n = () => e(t.getSnapshot());
589
647
  return ee(t.subscribe, n, n);
590
- }, lt = () => {
648
+ }, at = () => {
591
649
  const { config: e } = D(), t = _n()["*"], [n] = In(), r = n.toString();
592
- return G(() => rn(e, t, new URLSearchParams(r)), [e, t, r]);
650
+ return U(() => rn(e, t, new URLSearchParams(r)), [e, t, r]);
593
651
  }, mn = {
594
652
  unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
595
653
  forbidden: ["failureForbiddenTitle", "failureForbiddenBody"],
@@ -599,12 +657,12 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
599
657
  "too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
600
658
  unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
601
659
  failed: ["failureFailedTitle", "failureFailedBody"]
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";
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: [
605
- /* @__PURE__ */ c("p", { className: "aqmx-callout-title", children: i }),
606
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: l }),
607
- e.reason === "unauthorized" ? /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", onClick: () => window.location.reload(), children: o.reloadPage }) : n !== void 0 && e.reason === "failed" ? /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", onClick: n, children: o.retry }) : null
660
+ }, le = (e, t) => e[mn[t][0]], me = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
661
+ const { labels: o } = D(), i = le(o, e.reason), a = o[mn[e.reason][1]], u = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
662
+ return /* @__PURE__ */ $("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: [
663
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-title", children: i }),
664
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: a }),
665
+ e.reason === "unauthorized" ? /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", onClick: () => window.location.reload(), children: o.reloadPage }) : n !== void 0 && e.reason === "failed" ? /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", onClick: n, children: o.retry }) : null
608
666
  ] });
609
667
  }, Pr = (e, t) => {
610
668
  const { phase: n, save: r, dirty: o } = t;
@@ -614,7 +672,7 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
614
672
  case "grant":
615
673
  return e.editGrantTitle;
616
674
  case "failed":
617
- return ae(e, n.failure.reason);
675
+ return le(e, n.failure.reason);
618
676
  }
619
677
  switch (r.kind) {
620
678
  case "draft":
@@ -626,13 +684,13 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
626
684
  case "grant":
627
685
  return e.editGrantTitle;
628
686
  case "failed":
629
- return e.draftSaveFailed(ae(e, r.failure.reason));
687
+ return e.draftSaveFailed(le(e, r.failure.reason));
630
688
  case "saved":
631
689
  if (!o) return r.merged ? e.draftSavedMerged : e.draftSaved;
632
690
  break;
633
691
  }
634
692
  return o ? e.draftUnsaved : "";
635
- }, $r = (e, t, n) => {
693
+ }, Fr = (e, t, n) => {
636
694
  switch (t.kind) {
637
695
  case "draft":
638
696
  return e.draftNotSaved;
@@ -643,12 +701,12 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
643
701
  case "grant":
644
702
  return e.editGrantTitle;
645
703
  case "failed":
646
- return e.draftSaveFailed(ae(e, t.failure.reason));
704
+ return e.draftSaveFailed(le(e, t.failure.reason));
647
705
  case "idle":
648
706
  case "saving":
649
707
  return null;
650
708
  }
651
- }, Me = () => {
709
+ }, Oe = () => {
652
710
  const e = /* @__PURE__ */ new Set();
653
711
  return {
654
712
  subscribe: (t) => (e.add(t), () => {
@@ -658,288 +716,288 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
658
716
  for (const t of [...e]) t();
659
717
  }
660
718
  };
661
- }, Fr = "<<<<<<<", qr = "=======", _r = ">>>>>>>", Ot = (e, t) => e === t || e.startsWith(`${t} `), Ct = (e) => Ir(e.split(`
719
+ }, $r = "<<<<<<<", qr = "=======", _r = ">>>>>>>", Ct = (e, t) => e === t || e.startsWith(`${t} `), Mt = (e) => Ir(e.split(`
662
720
  `)), Ir = (e) => {
663
721
  const t = [];
664
722
  let n = null, r = null, o = 0;
665
723
  for (const i of e) {
666
724
  o += 1;
667
- const l = i.charCodeAt(0);
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));
725
+ const a = i.charCodeAt(0);
726
+ a !== 60 && a !== 61 && a !== 62 || (Ct(i, $r) ? (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));
669
727
  }
670
728
  return t;
671
- }, Lt = (e) => e.includes(`\r
729
+ }, At = (e) => e.includes(`\r
672
730
  `) ? `\r
673
731
  ` : `
674
- `, Ue = (e) => e.replace(/\r\n?/gu, `
732
+ `, Ze = (e) => e.replace(/\r\n?/gu, `
675
733
  `), Br = (e, t) => t === `
676
734
  ` ? e : e.replaceAll(`
677
735
  `, `\r
678
736
  `), zr = 3, jr = /^\d+(?:\.\d+)?$/u, Hr = (e) => {
679
737
  if (e === null || !jr.test(e)) return null;
680
738
  const t = Number(e);
681
- return t >= ln && t <= on ? t : null;
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) => {
739
+ return t >= an && t <= on ? t : null;
740
+ }, Ue = Object.freeze({ kind: "idle" }), Lt = Object.freeze({ kind: "draft" }), Vr = ({ data: e, conflictLabels: t, onSaveSettled: n, sideBySideSetting: r, editorShareSetting: o }) => {
741
+ const i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), c = Oe();
742
+ let h = null, g = null, E = null;
743
+ const k = (l, s) => {
744
+ l.value = { ...l.value, ...s }, c.emit();
745
+ }, R = (l, s) => i.get(l) === s, T = async (l, s) => {
688
746
  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 } });
747
+ const { signal: v } = s.controller;
748
+ k(s, { phase: { kind: "opening" } });
749
+ const O = await e.edit(l, v);
750
+ if (!R(l, s) || v.aborted || !("kind" in O)) return;
751
+ if (O.kind === "grant") {
752
+ k(s, { phase: { kind: "grant", href: O.href } });
695
753
  return;
696
754
  }
697
- if (T.kind === "failure") {
698
- M(s, { phase: { kind: "failed", failure: T.failure } });
755
+ if (O.kind === "failure") {
756
+ k(s, { phase: { kind: "failed", failure: O.failure } });
699
757
  return;
700
758
  }
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);
759
+ const M = Ze(O.text), N = O.kind === "draft";
760
+ s.base = { text: M, version: N ? null : O.version }, s.draft = M, s.ending = At(O.text), k(s, { phase: { kind: "editing" }, history: N ? !1 : O.history, dirty: !1, save: N ? Lt : Ue, generation: s.value.generation + 1 });
761
+ }, A = (l) => {
762
+ const s = i.get(l);
763
+ s !== void 0 && (s.controller.abort(), i.delete(l), u.delete(l));
764
+ }, L = (l, s, v) => (l.set(s, v), () => {
765
+ l.get(s) === v && l.delete(s);
766
+ }), b = (l, s, v, O = {}) => {
767
+ k(s, { ...O, save: v }), n(l, v);
768
+ }, w = async (l) => {
769
+ m.get(l)?.flush();
770
+ const s = i.get(l);
713
771
  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);
772
+ const { version: v } = s.base;
773
+ if (v === null) {
774
+ n(l, Lt);
717
775
  return;
718
776
  }
719
- const T = Ct(s.draft).length;
720
- if (T > 0) {
721
- E(a, s, { kind: "conflicts", count: T });
777
+ const O = Mt(s.draft).length;
778
+ if (O > 0) {
779
+ b(l, s, { kind: "conflicts", count: O });
722
780
  return;
723
781
  }
724
782
  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" } });
728
- for (let z = 0; z < zr; z += 1) {
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;
731
- if (j.kind === "saved") {
732
- m.get(a)?.flush(), s.base = { text: q, version: j.version }, E(a, s, { kind: "saved", merged: W }, { dirty: s.draft !== q });
783
+ const { signal: M } = s.controller;
784
+ let N = { text: s.base.text, version: v }, q = s.draft, W = !1;
785
+ k(s, { save: { kind: "saving" } });
786
+ for (let G = 0; G < zr; G += 1) {
787
+ const I = await e.save(l, N.version, Br(q, s.ending), M);
788
+ if (!R(l, s) || M.aborted || !("kind" in I)) return;
789
+ if (I.kind === "saved") {
790
+ m.get(l)?.flush(), s.base = { text: q, version: I.version }, b(l, s, { kind: "saved", merged: W }, { dirty: s.draft !== q });
733
791
  return;
734
792
  }
735
- if (j.kind === "grant") {
736
- E(a, s, { kind: "grant", href: j.href });
793
+ if (I.kind === "grant") {
794
+ b(l, s, { kind: "grant", href: I.href });
737
795
  return;
738
796
  }
739
- if (j.kind === "failure") {
740
- E(a, s, { kind: "failed", failure: j.failure });
797
+ if (I.kind === "failure") {
798
+ b(l, s, { kind: "failed", failure: I.failure });
741
799
  return;
742
800
  }
743
- const { mergeDraft: Y } = await import("./merge-ClVgYrkS.js");
744
- if (!R(a, s) || C.aborted) return;
745
- const V = m.get(a);
746
- V?.flush();
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 });
801
+ const { mergeDraft: J } = await import("./merge-BOcofJN5.js");
802
+ if (!R(l, s) || M.aborted) return;
803
+ const H = m.get(l);
804
+ H?.flush();
805
+ const ne = Ze(I.text), p = J(N.text, s.draft, ne, t());
806
+ if (N = { text: ne, version: I.version }, s.base = N, s.ending = At(I.text), s.draft = p.text, H?.adopt(p.text), p.kind === "conflicts") {
807
+ b(l, s, { kind: "conflicts", count: p.conflicts }, { dirty: !0, generation: s.value.generation + 1 });
750
808
  return;
751
809
  }
752
810
  if (W = !0, q = p.text, q === N.text) {
753
- E(a, s, { kind: "saved", merged: W }, { dirty: !1, generation: s.value.generation + 1 });
811
+ b(l, s, { kind: "saved", merged: W }, { dirty: !1, generation: s.value.generation + 1 });
754
812
  return;
755
813
  }
756
- M(s, { dirty: !0, generation: s.value.generation + 1 });
814
+ k(s, { dirty: !0, generation: s.value.generation + 1 });
757
815
  }
758
- E(a, s, { kind: "failed", failure: { reason: "failed" } });
816
+ b(l, s, { kind: "failed", failure: { reason: "failed" } });
759
817
  };
760
818
  return {
761
- session: (a) => i.get(a)?.value,
762
- subscribe: d.subscribe,
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);
819
+ session: (l) => i.get(l)?.value,
820
+ subscribe: c.subscribe,
821
+ start: (l, s) => {
822
+ const v = i.get(l);
823
+ if (v !== void 0) {
824
+ k(v, { request: { anchor: s }, view: "editor" }), (v.value.phase.kind === "failed" || v.value.phase.kind === "grant") && T(l, v);
767
825
  return;
768
826
  }
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 } },
827
+ a.delete(l);
828
+ const O = {
829
+ value: { path: l, phase: { kind: "opening" }, view: "editor", previewPrepared: !1, history: !1, dirty: !1, save: Ue, generation: 0, request: { anchor: s } },
772
830
  base: null,
773
831
  draft: "",
774
832
  ending: `
775
833
  `,
776
834
  controller: new AbortController()
777
835
  };
778
- i.set(a, T), S(a, T);
836
+ i.set(l, O), T(l, O);
779
837
  },
780
- retry: (a) => {
781
- const s = i.get(a);
782
- s === void 0 || s.value.phase.kind === "editing" || S(a, s);
838
+ retry: (l) => {
839
+ const s = i.get(l);
840
+ s === void 0 || s.value.phase.kind === "editing" || T(l, s);
783
841
  },
784
- draft: (a) => {
785
- const s = i.get(a);
842
+ draft: (l) => {
843
+ const s = i.get(l);
786
844
  return s === void 0 || s.base === null ? null : s.draft;
787
845
  },
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;
846
+ setDraft: (l, s) => {
847
+ const v = i.get(l);
848
+ if (v === void 0 || v.base === null) return;
849
+ v.draft = s;
850
+ const O = {}, M = s !== v.base.text;
851
+ M !== v.value.dirty && (O.dirty = M);
852
+ const { save: N } = v.value;
795
853
  if (N.kind === "conflicts") {
796
- const q = Ct(s).length;
797
- q === 0 ? T.save = Ze : q !== N.count && (T.save = { kind: "conflicts", count: q });
854
+ const q = Mt(s).length;
855
+ q === 0 ? O.save = Ue : q !== N.count && (O.save = { kind: "conflicts", count: q });
798
856
  }
799
- (T.dirty !== void 0 || T.save !== void 0) && M(w, T);
857
+ (O.dirty !== void 0 || O.save !== void 0) && k(v, O);
800
858
  },
801
- consumeRequest: (a) => {
802
- const s = i.get(a);
803
- s !== void 0 && s.value.request !== null && M(s, { request: null });
859
+ consumeRequest: (l) => {
860
+ const s = i.get(l);
861
+ s !== void 0 && s.value.request !== null && k(s, { request: null });
804
862
  },
805
- save: v,
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 });
863
+ save: w,
864
+ replaceDraft: (l, s) => {
865
+ const v = m.get(l);
866
+ v?.flush();
867
+ const O = i.get(l);
868
+ if (O === void 0 || O.base === null) return;
869
+ const M = Ze(s);
870
+ O.draft = M, v?.adopt(M), k(O, { dirty: M !== O.base.text, generation: O.value.generation + 1 });
813
871
  },
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();
872
+ close: (l) => {
873
+ if (!i.has(l)) return;
874
+ const s = m.get(l), v = s === void 0 ? null : s.returnPoint();
875
+ A(l), v === null ? a.delete(l) : a.set(l, v), c.emit();
818
876
  },
819
- takeReturn: (a) => {
820
- const s = l.get(a) ?? null;
821
- return l.delete(a), s;
877
+ takeReturn: (l) => {
878
+ const s = a.get(l) ?? null;
879
+ return a.delete(l), s;
822
880
  },
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();
881
+ dirtyPaths: () => [...i.values()].filter((l) => l.value.dirty).map((l) => l.value.path),
882
+ discard: (l) => {
883
+ for (const s of l) A(s);
884
+ l.length > 0 && c.emit();
827
885
  },
828
886
  editorState: {
829
- get: (a) => u.get(a),
830
- set: (a, s) => {
831
- i.has(a) && u.set(a, s);
887
+ get: (l) => u.get(l),
888
+ set: (l, s) => {
889
+ i.has(l) && u.set(l, s);
832
890
  }
833
891
  },
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);
892
+ bindEditor: (l, s) => L(m, l, s),
893
+ bindView: (l, s) => L(f, l, s),
894
+ viewAnchor: (l) => {
895
+ const s = f.get(l);
838
896
  return s === void 0 ? null : s.anchor();
839
897
  },
840
- flush: (a) => m.get(a)?.flush(),
898
+ flush: (l) => m.get(l)?.flush(),
841
899
  flushDrafts: () => {
842
- for (const a of m.values()) a.flush();
900
+ for (const l of m.values()) l.flush();
843
901
  },
844
- nextConflict: (a) => m.get(a)?.nextConflict() === !0,
902
+ nextConflict: (l) => m.get(l)?.nextConflict() === !0,
845
903
  hasSessions: () => i.size > 0,
846
- unsavedAmong: (a) => {
904
+ unsavedAmong: (l) => {
847
905
  for (const s of m.values()) s.flush();
848
- return a.filter((s) => i.get(s)?.value.dirty === !0);
906
+ return l.filter((s) => i.get(s)?.value.dirty === !0);
849
907
  },
850
- askToDiscard: (a) => new Promise((s) => {
851
- b?.settle(!1);
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);
908
+ askToDiscard: (l) => new Promise((s) => {
909
+ E?.settle(!1);
910
+ const v = {
911
+ paths: l,
912
+ settle: (O) => {
913
+ if (E === v) {
914
+ if (E = null, O) for (const M of l) A(M);
915
+ c.emit(), s(O);
858
916
  }
859
917
  }
860
918
  };
861
- b = w, d.emit();
919
+ E = v, c.emit();
862
920
  }),
863
- discardRequest: () => b,
921
+ discardRequest: () => E,
864
922
  sideBySide: () => (h ??= r.read(), h),
865
- setSideBySide: (a) => {
866
- h !== a && (h = a, r.write(a), d.emit());
923
+ setSideBySide: (l) => {
924
+ h !== l && (h = l, r.write(l), c.emit());
867
925
  },
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));
926
+ editorShare: () => (g ??= o.read() ?? Un, g),
927
+ setEditorShare: (l) => {
928
+ if (!Number.isFinite(l)) throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(l)}`);
929
+ const s = Math.min(on, Math.max(an, l));
872
930
  g !== s && (g = s, o.write(s));
873
931
  },
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" }));
932
+ setView: (l, s) => {
933
+ const v = i.get(l);
934
+ v === void 0 || v.value.view === s || (m.get(l)?.beforeView(s), k(v, { view: s, previewPrepared: v.value.previewPrepared || s === "preview" }));
877
935
  },
878
- preparePreview: (a) => {
879
- const s = i.get(a);
880
- s !== void 0 && !s.value.previewPrepared && M(s, { previewPrepared: !0 });
936
+ preparePreview: (l) => {
937
+ const s = i.get(l);
938
+ s !== void 0 && !s.value.previewPrepared && k(s, { previewPrepared: !0 });
881
939
  }
882
940
  };
883
941
  }, hn = (e) => {
884
942
  e.preventDefault(), e.stopPropagation();
885
- }, Ur = (e) => e.endsWith("px") ? Number.parseFloat(e) : Number.NaN, pn = "data-aqmx-content-pane", et = Object.freeze({ [pn]: "" }), Zr = "--aqmx-dialog-left", Gr = "--aqmx-dialog-top", Wr = '[data-testid="markdown-explorer"]', Kr = (e) => {
943
+ }, Zr = (e) => e.endsWith("px") ? Number.parseFloat(e) : Number.NaN, pn = "data-aqmx-content-pane", et = Object.freeze({ [pn]: "" }), Ur = "--aqmx-dialog-left", Gr = "--aqmx-dialog-top", Wr = '[data-testid="markdown-explorer"]', Kr = (e) => {
886
944
  const t = e.closest(Wr)?.querySelectorAll(`[${pn}]`), n = t?.item(t.length - 1);
887
945
  if (!(n instanceof HTMLElement)) throw new Error("[markdown-explorer] a dialog opened where the explorer marks no content pane");
888
946
  return n;
889
947
  }, Xr = (e) => {
890
- const t = Ur(getComputedStyle(e).marginTop);
948
+ const t = Zr(getComputedStyle(e).marginTop);
891
949
  if (Number.isNaN(t)) return null;
892
- const n = Kr(e), r = e.getBoundingClientRect(), o = e.ownerDocument.documentElement, { left: i, top: l } = Gn(n.getBoundingClientRect(), { width: r.width + 2 * t, height: r.height + 2 * t }, { width: o.clientWidth, height: o.clientHeight });
893
- return e.style.setProperty(Zr, `${String(i)}px`), e.style.setProperty(Gr, `${String(l)}px`), n;
950
+ const n = Kr(e), r = e.getBoundingClientRect(), o = e.ownerDocument.documentElement, { left: i, top: a } = Gn(n.getBoundingClientRect(), { width: r.width + 2 * t, height: r.height + 2 * t }, { width: o.clientWidth, height: o.clientHeight });
951
+ return e.style.setProperty(Ur, `${String(i)}px`), e.style.setProperty(Gr, `${String(a)}px`), n;
894
952
  }, Yr = (e) => e.preventDefault(), vn = ({ open: e, onOpen: t, onDismiss: n }) => {
895
- const r = _(null), o = _(null), i = _(!1), l = _(t);
896
- H(() => {
897
- l.current = t;
898
- }, [t]), H(() => {
953
+ const r = _(null), o = _(null), i = _(!1), a = _(t);
954
+ j(() => {
955
+ a.current = t;
956
+ }, [t]), j(() => {
899
957
  i.current = e;
900
- const d = r.current;
901
- if (d !== null)
902
- if (e && !d.open) {
903
- const h = d.ownerDocument.activeElement;
904
- o.current = h instanceof HTMLElement ? h : null, d.showModal(), l.current?.();
905
- } else !e && d.open && (d.close(), o.current?.isConnected === !0 && o.current.focus(), o.current = null);
906
- }, [e]), H(() => {
907
- const d = r.current;
908
- if (!e || d === null) return;
909
- const h = new ResizeObserver(() => b());
958
+ const c = r.current;
959
+ if (c !== null)
960
+ if (e && !c.open) {
961
+ const h = c.ownerDocument.activeElement;
962
+ o.current = h instanceof HTMLElement ? h : null, c.showModal(), a.current?.();
963
+ } else !e && c.open && (c.close(), o.current?.isConnected === !0 && o.current.focus(), o.current = null);
964
+ }, [e]), j(() => {
965
+ const c = r.current;
966
+ if (!e || c === null) return;
967
+ const h = new ResizeObserver(() => E());
910
968
  let g = null;
911
- const b = () => {
912
- const R = Xr(d);
969
+ const E = () => {
970
+ const R = Xr(c);
913
971
  R === null || R === g || (g !== null && h.unobserve(g), h.observe(R), g = R);
914
972
  };
915
- b(), h.observe(d);
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 });
973
+ E(), h.observe(c);
974
+ const k = c.ownerDocument.defaultView;
975
+ return k?.addEventListener("resize", E), c.ownerDocument.addEventListener("scroll", E, { capture: !0, passive: !0 }), () => {
976
+ h.disconnect(), k?.removeEventListener("resize", E), c.ownerDocument.removeEventListener("scroll", E, { capture: !0 });
919
977
  };
920
978
  }, [e]);
921
979
  const u = P(
922
- (d) => {
923
- d.key !== "Escape" || d.defaultPrevented || (hn(d), n());
980
+ (c) => {
981
+ c.key !== "Escape" || c.defaultPrevented || (hn(c), n());
924
982
  },
925
983
  [n]
926
984
  ), m = P(
927
- (d) => {
928
- d.target === d.currentTarget && n();
985
+ (c) => {
986
+ c.target === c.currentTarget && n();
929
987
  },
930
988
  [n]
931
989
  ), f = P(() => {
932
990
  i.current && n();
933
991
  }, [n]);
934
992
  return { ref: r, onKeyDown: u, onClick: m, onCancel: Yr, onClose: f };
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: [
938
- /* @__PURE__ */ c("p", { id: f, className: "aqmx-confirm-title", children: t }),
939
- /* @__PURE__ */ c("p", { id: d, className: "aqmx-confirm-body", children: n }),
940
- /* @__PURE__ */ F("div", { className: "aqmx-confirm-actions", children: [
941
- /* @__PURE__ */ c("button", { ref: m, type: "button", className: "aqmx-callout-action", "data-testid": `${u}-cancel`, onClick: l, children: o }),
942
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-aqmx-tone": "danger", "data-testid": `${u}-confirm`, onClick: i, children: r })
993
+ }, wn = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: i, onCancel: a, testId: u }) => {
994
+ const m = _(null), f = xe(), c = xe(), h = P(() => m.current?.focus(), []), g = vn({ open: e, onOpen: h, onDismiss: a });
995
+ return /* @__PURE__ */ d("dialog", { ...g, className: "aqmx-confirm", "aria-labelledby": f, "aria-describedby": c, "data-testid": u, children: /* @__PURE__ */ $("div", { className: "aqmx-confirm-panel", children: [
996
+ /* @__PURE__ */ d("p", { id: f, className: "aqmx-confirm-title", children: t }),
997
+ /* @__PURE__ */ d("p", { id: c, className: "aqmx-confirm-body", children: n }),
998
+ /* @__PURE__ */ $("div", { className: "aqmx-confirm-actions", children: [
999
+ /* @__PURE__ */ d("button", { ref: m, type: "button", className: "aqmx-callout-action", "data-testid": `${u}-cancel`, onClick: a, children: o }),
1000
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "data-aqmx-tone": "danger", "data-testid": `${u}-confirm`, onClick: i, children: r })
943
1001
  ] })
944
1002
  ] }) });
945
1003
  }, Te = (e) => {
@@ -957,7 +1015,7 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
957
1015
  for (let i = o.pop(); i !== void 0; i = o.pop()) {
958
1016
  if (i.type !== "directory" || r.has(i.path)) continue;
959
1017
  r.add(i.path);
960
- const l = i.lazy === !0 ? n(i.path) : void 0, u = i.lazy === !0 ? l?.status === "loaded" ? l.entries : null : i.children === void 0 ? [] : i.children;
1018
+ const a = i.lazy === !0 ? n(i.path) : void 0, u = i.lazy === !0 ? a?.status === "loaded" ? a.entries : null : i.children === void 0 ? [] : i.children;
961
1019
  if (i.path === t) return u;
962
1020
  if (u !== null) for (const m of [...u].reverse()) o.push(m);
963
1021
  }
@@ -966,7 +1024,7 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
966
1024
  const r = Ee(e.read(t));
967
1025
  if (r === void 0 || r.status === "deferred") return Jr;
968
1026
  if (r.status === "error") return { readme: { status: "failed", failure: r.failure, retry: () => e.retry(t) }, claim: !1 };
969
- const o = eo(r.entries, n, (l) => e.children(t, l));
1027
+ const o = eo(r.entries, n, (a) => e.children(t, a));
970
1028
  if (o !== null) return { readme: { status: "ok", readme: wt(o) }, claim: !1 };
971
1029
  const i = e.children(t, n);
972
1030
  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 };
@@ -994,26 +1052,26 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
994
1052
  }, io = () => {
995
1053
  const { edits: e } = D();
996
1054
  return ee(e.subscribe, e.hasSessions, En);
997
- }, lo = () => {
1055
+ }, ao = () => {
998
1056
  const { edits: e } = D();
999
1057
  return ee(e.subscribe, e.sideBySide, En);
1000
- }, ao = () => null, so = () => {
1058
+ }, lo = () => null, so = () => {
1001
1059
  const { edits: e, labels: t, config: n, trees: r } = D(), o = _([]), i = P(
1002
- ({ nextLocation: b }) => {
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;
1060
+ ({ nextLocation: E }) => {
1061
+ const k = ro(n, E, (R, T) => no(r, R, T));
1062
+ return e.flushDrafts(), o.current = e.dirtyPaths().filter((R) => !k.has(R)), o.current.length > 0;
1005
1063
  },
1006
1064
  [e, n, r]
1007
- ), l = zn(i), u = io();
1065
+ ), a = zn(i), u = io();
1008
1066
  te(() => {
1009
1067
  if (!u) return;
1010
- const b = (M) => {
1011
- e.flushDrafts(), e.dirtyPaths().length !== 0 && (M.preventDefault(), M.returnValue = !0);
1068
+ const E = (k) => {
1069
+ e.flushDrafts(), e.dirtyPaths().length !== 0 && (k.preventDefault(), k.returnValue = !0);
1012
1070
  };
1013
- return window.addEventListener("beforeunload", b), () => window.removeEventListener("beforeunload", b);
1071
+ return window.addEventListener("beforeunload", E), () => window.removeEventListener("beforeunload", E);
1014
1072
  }, [u, e]);
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");
1016
- return /* @__PURE__ */ c(
1073
+ const m = ee(e.subscribe, e.discardRequest, lo), f = a.state === "blocked", c = f ? o.current : m === null ? [] : m.paths, h = c.map((E) => se(E)).join(", "), g = c.length > 0 && c.every((E) => e.session(E)?.save.kind === "draft");
1074
+ return /* @__PURE__ */ d(
1017
1075
  wn,
1018
1076
  {
1019
1077
  open: f || m !== null,
@@ -1023,15 +1081,15 @@ const Tt = Object.freeze(["en", "ja"]), Tr = "en", Rr = Object.freeze({
1023
1081
  cancelLabel: t.unsavedStay,
1024
1082
  testId: "markdown-explorer-unsaved-guard",
1025
1083
  onConfirm: () => {
1026
- if (l.state === "blocked") {
1027
- e.discard(o.current), l.proceed();
1084
+ if (a.state === "blocked") {
1085
+ e.discard(o.current), a.proceed();
1028
1086
  return;
1029
1087
  }
1030
1088
  m?.settle(!0);
1031
1089
  },
1032
1090
  onCancel: () => {
1033
- if (l.state === "blocked") {
1034
- l.reset();
1091
+ if (a.state === "blocked") {
1092
+ a.reset();
1035
1093
  return;
1036
1094
  }
1037
1095
  m?.settle(!1);
@@ -1062,14 +1120,14 @@ function co({
1062
1120
  }
1063
1121
  const uo = /* @__PURE__ */ y.forwardRef(co);
1064
1122
  let Ge = null;
1065
- const yn = () => (Ge ??= import("./EditSurface-Ckg-3iTA.js").catch((e) => {
1123
+ const Sn = () => (Ge ??= import("./EditSurface-rKoy_ndP.js").catch((e) => {
1066
1124
  throw Ge = null, e;
1067
1125
  }), Ge), fo = () => {
1068
- yn().catch(() => {
1126
+ Sn().catch(() => {
1069
1127
  });
1070
1128
  }, mo = (e) => {
1071
- const { default: t } = ne(yn());
1072
- return /* @__PURE__ */ c(t, { ...e });
1129
+ const { default: t } = re(Sn());
1130
+ return /* @__PURE__ */ d(t, { ...e });
1073
1131
  };
1074
1132
  class ho extends tn {
1075
1133
  state = { failed: !1 };
@@ -1081,13 +1139,13 @@ class ho extends tn {
1081
1139
  return this.state.failed ? this.props.fallback(this.retry) : this.props.children;
1082
1140
  }
1083
1141
  }
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) => {
1142
+ const lt = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg, [data-aqmd-spreadsheet-editable], [data-aqmd-spreadsheet-fullscreen]', wo = 200, Re = (e) => Er(e.getAttribute(sn)), go = (e, t) => {
1085
1143
  for (let r = e; r !== null && t.contains(r); r = r.parentElement) {
1086
1144
  const o = Re(r);
1087
1145
  if (o !== null) return { block: r, lines: o, own: !0 };
1088
1146
  }
1089
1147
  let n = null;
1090
- for (const r of t.querySelectorAll(at)) {
1148
+ for (const r of t.querySelectorAll(lt)) {
1091
1149
  if (!(r.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING)) break;
1092
1150
  const o = Re(r);
1093
1151
  o !== null && (n = { block: r, lines: o });
@@ -1097,7 +1155,7 @@ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1097
1155
  let n = 0;
1098
1156
  for (let r = e.indexOf(t); r >= 0; r = e.indexOf(t, r + t.length)) n += 1;
1099
1157
  return n;
1100
- }, Eo = (e) => e.closest(po) !== null && e.closest(vo) === null, yo = (e, t, n) => {
1158
+ }, Eo = (e) => e.closest(po) !== null && e.closest(vo) === null, So = (e, t, n) => {
1101
1159
  const r = go(e, t);
1102
1160
  if (r === null) return null;
1103
1161
  const { block: o, own: i } = r;
@@ -1105,22 +1163,22 @@ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1105
1163
  const u = r.lines.last + 1;
1106
1164
  return { lines: { first: u, last: u }, word: null, occurrence: 0, clientTop: Ne(e) };
1107
1165
  }
1108
- const l = To(o, n);
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 };
1110
- }, xo = (e, t) => {
1166
+ const a = To(o, n);
1167
+ return a === null ? { lines: r.lines, word: null, occurrence: 0, clientTop: Ne(o) } : { lines: r.lines, word: a.text, occurrence: a.occurrence, clientTop: a.clientTop };
1168
+ }, yo = (e, t) => {
1111
1169
  let n = null, r = null, o = null;
1112
- for (const l of e.querySelectorAll(at)) {
1113
- const u = Re(l);
1170
+ for (const a of e.querySelectorAll(lt)) {
1171
+ const u = Re(a);
1114
1172
  if (u === null) continue;
1115
- n ??= ko(t, l);
1116
- const { top: m, bottom: f } = l.getBoundingClientRect();
1117
- m <= n && n < f ? r = { lines: u, block: l } : o === null && m >= n && (o = { lines: u, block: l });
1173
+ n ??= ko(t, a);
1174
+ const { top: m, bottom: f } = a.getBoundingClientRect();
1175
+ m <= n && n < f ? r = { lines: u, block: a } : o === null && m >= n && (o = { lines: u, block: a });
1118
1176
  }
1119
1177
  const i = r === null ? o : r;
1120
1178
  return i === null ? null : { lines: i.lines, word: null, occurrence: 0, clientTop: Ne(i.block) };
1121
- }, So = (e) => e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, ko = (e, t) => {
1179
+ }, xo = (e) => e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, ko = (e, t) => {
1122
1180
  const n = Number.parseFloat(getComputedStyle(t).scrollMarginTop);
1123
- return So(e) + (Number.isFinite(n) ? n : 0);
1181
+ return xo(e) + (Number.isFinite(n) ? n : 0);
1124
1182
  }, To = (e, t) => {
1125
1183
  if (t === null || t.rangeCount === 0) return null;
1126
1184
  const n = t.getRangeAt(0);
@@ -1129,33 +1187,33 @@ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1129
1187
  if (r === "" || r.length > wo || /[\r\n]/u.test(r)) return null;
1130
1188
  const o = e.ownerDocument.createRange();
1131
1189
  return o.setStart(e, 0), o.setEnd(n.startContainer, n.startOffset), { text: r, occurrence: bo(o.toString(), r), clientTop: n.getBoundingClientRect().top };
1132
- }, Xa = (e, t) => {
1190
+ }, Xl = (e, t) => {
1133
1191
  const n = e.split(`
1134
1192
  `), r = Math.min(t.lines.first, n.length), o = Math.min(t.lines.last, n.length), i = { line: r, column: 0 };
1135
1193
  if (t.word === null) return i;
1136
- let l = 0;
1194
+ let a = 0;
1137
1195
  for (let u = r; u <= o; u += 1) {
1138
1196
  const m = n[u - 1] ?? "";
1139
1197
  for (let f = m.indexOf(t.word); f >= 0; f = m.indexOf(t.word, f + t.word.length)) {
1140
- if (l === t.occurrence) return { line: u, column: f };
1141
- l += 1;
1198
+ if (a === t.occurrence) return { line: u, column: f };
1199
+ a += 1;
1142
1200
  }
1143
1201
  }
1144
- return l > 0 ? Ro(n, r, o, t.word) ?? i : i;
1202
+ return a > 0 ? Ro(n, r, o, t.word) ?? i : i;
1145
1203
  }, Ro = (e, t, n, r) => {
1146
1204
  for (let o = n; o >= t; o -= 1) {
1147
1205
  const i = (e[o - 1] ?? "").lastIndexOf(r);
1148
1206
  if (i >= 0) return { line: o, column: i };
1149
1207
  }
1150
1208
  return null;
1151
- }, Mo = (e, t) => {
1209
+ }, Oo = (e, t) => {
1152
1210
  let n = null, r = null;
1153
- for (const o of e.querySelectorAll(at)) {
1211
+ for (const o of e.querySelectorAll(lt)) {
1154
1212
  const i = Re(o);
1155
1213
  i === null || i.first > t || (i.last >= t ? n = o : (r === null || i.last >= r.last) && (r = { element: o, last: i.last }));
1156
1214
  }
1157
1215
  return n !== null ? n : r === null ? null : r.element;
1158
- }, Oo = (e, t) => {
1216
+ }, Co = (e, t) => {
1159
1217
  const { bottom: n } = e.getBoundingClientRect(), r = Ne(e), o = Re(e);
1160
1218
  if (o === null) return r;
1161
1219
  const i = Math.min(Math.max(t - o.first, 0) / (o.last - o.first + 1), 1);
@@ -1167,8 +1225,8 @@ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1167
1225
  if (o < 0) continue;
1168
1226
  const i = e.ownerDocument.createRange();
1169
1227
  i.setStart(n, o), i.setEnd(n, o + 1);
1170
- const { top: l, height: u } = i.getBoundingClientRect();
1171
- if (u > 0) return l;
1228
+ const { top: a, height: u } = i.getBoundingClientRect();
1229
+ if (u > 0) return a;
1172
1230
  }
1173
1231
  return e.getBoundingClientRect().top;
1174
1232
  }, st = Object.freeze({
@@ -1176,7 +1234,7 @@ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1176
1234
  "switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
1177
1235
  "switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
1178
1236
  "follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
1179
- }), Ya = (e) => st[e], Fe = () => {
1237
+ }), Yl = (e) => st[e], $e = () => {
1180
1238
  const e = jn();
1181
1239
  return P(
1182
1240
  (t, n) => {
@@ -1184,7 +1242,7 @@ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1184
1242
  },
1185
1243
  [e]
1186
1244
  );
1187
- }, Co = ({ navigation: e, ...t }) => /* @__PURE__ */ c(Hn, { ...t, ...st[e] }), xn = (e) => {
1245
+ }, Mo = ({ navigation: e, ...t }) => /* @__PURE__ */ d(Hn, { ...t, ...st[e] }), yn = (e) => {
1188
1246
  const t = e.ownerDocument;
1189
1247
  if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
1190
1248
  if (e.hasAttribute("tabindex")) return !1;
@@ -1194,17 +1252,17 @@ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1194
1252
  t.activeElement !== e && (e.removeAttribute("tabindex"), e.removeEventListener("blur", n));
1195
1253
  };
1196
1254
  return e.addEventListener("blur", n), !0;
1197
- }, Lo = (e, t) => {
1255
+ }, Ao = (e, t) => {
1198
1256
  const n = _(null), r = _(null), o = _(null), i = P(() => {
1199
1257
  n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
1200
1258
  }, []);
1201
1259
  te(() => i, [i]);
1202
- const l = P(
1260
+ const a = P(
1203
1261
  (f) => {
1204
1262
  if (r.current !== f) return;
1205
- const d = o.current;
1206
- if (d !== null) {
1207
- d.then(() => l(f));
1263
+ const c = o.current;
1264
+ if (c !== null) {
1265
+ c.then(() => a(f));
1208
1266
  return;
1209
1267
  }
1210
1268
  e.prefetch(f);
@@ -1218,19 +1276,19 @@ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1218
1276
  [e]
1219
1277
  ), u = P(
1220
1278
  (f) => {
1221
- const d = t(f);
1222
- d !== r.current && (i(), d !== null && (r.current = d, n.current = window.setTimeout(() => {
1223
- n.current = null, l(d);
1279
+ const c = t(f);
1280
+ c !== r.current && (i(), c !== null && (r.current = c, n.current = window.setTimeout(() => {
1281
+ n.current = null, a(c);
1224
1282
  }, Wn)));
1225
1283
  },
1226
- [i, t, l]
1284
+ [i, t, a]
1227
1285
  ), m = P(
1228
1286
  (f) => {
1229
1287
  t(f) !== r.current && i();
1230
1288
  },
1231
1289
  [i, t]
1232
1290
  );
1233
- return G(
1291
+ return U(
1234
1292
  () => ({
1235
1293
  onPointerOver: (f) => u(f.target),
1236
1294
  onPointerOut: (f) => m(f.relatedTarget),
@@ -1239,7 +1297,7 @@ const at = `[${sn}]`, po = "[data-aqmd-content]", vo = 'a[href], button, input,
1239
1297
  }),
1240
1298
  [u, m]
1241
1299
  );
1242
- }, Ao = it(() => import("./NativeScrollBar-zzpty31a.js").then((e) => ({ default: e.NativeScrollBar })));
1300
+ }, Lo = it(() => import("./NativeScrollBar-0cpp2OIu.js").then((e) => ({ default: e.NativeScrollBar })));
1243
1301
  class No extends tn {
1244
1302
  state = { failed: !1 };
1245
1303
  static getDerivedStateFromError() {
@@ -1252,7 +1310,7 @@ class No extends tn {
1252
1310
  return this.state.failed ? null : this.props.children;
1253
1311
  }
1254
1312
  }
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 = () => {
1313
+ const Do = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(No, { children: /* @__PURE__ */ d(ke, { fallback: null, children: /* @__PURE__ */ d(Lo, { scroller: e, withCircle: t }) }) }), xn = (e) => /* @__PURE__ */ d(Do, { scroller: e, withCircle: !0 }), kn = () => {
1256
1314
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
1257
1315
  let n = !1;
1258
1316
  const r = (o) => {
@@ -1267,9 +1325,9 @@ const Do = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(No, { children:
1267
1325
  return () => {
1268
1326
  if (i) return;
1269
1327
  i = !0;
1270
- const l = e.get(o);
1271
- if (l !== void 0 && l > 1) {
1272
- e.set(o, l - 1);
1328
+ const a = e.get(o);
1329
+ if (a !== void 0 && a > 1) {
1330
+ e.set(o, a - 1);
1273
1331
  return;
1274
1332
  }
1275
1333
  e.delete(o), r(o);
@@ -1283,129 +1341,129 @@ const Do = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(No, { children:
1283
1341
  if (Object.is(e, t)) return !0;
1284
1342
  if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
1285
1343
  if (Array.isArray(e) || Array.isArray(t))
1286
- return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((i, l) => De(i, t[l]));
1344
+ return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((i, a) => De(i, t[a]));
1287
1345
  const n = e, r = t, o = Object.keys(n);
1288
1346
  return o.length !== Object.keys(r).length ? !1 : o.every((i) => Object.hasOwn(r, i) && De(n[i], r[i]));
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 }) => {
1347
+ }, 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", Fo = ({ client: e, capacity: t }) => {
1290
1348
  if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
1291
- const n = /* @__PURE__ */ new Map(), r = kn(), o = Me(), i = /* @__PURE__ */ new WeakSet();
1292
- let l = 0;
1293
- const u = o.emit, m = () => (l += 1, l), f = () => {
1349
+ const n = /* @__PURE__ */ new Map(), r = kn(), o = Oe(), i = /* @__PURE__ */ new WeakSet();
1350
+ let a = 0;
1351
+ const u = o.emit, m = () => (a += 1, a), f = () => {
1294
1352
  if (!(n.size <= t))
1295
- for (const E of [...n.keys()]) {
1353
+ for (const b of [...n.keys()]) {
1296
1354
  if (n.size <= t) return;
1297
- r.isHeld(E) || n.delete(E);
1355
+ r.isHeld(b) || n.delete(b);
1298
1356
  }
1299
- }, d = (E, v) => {
1300
- n.delete(E), n.set(E, v);
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) => {
1304
- n.get(E) === N && (N.snapshot = q, N.stamp = m(), u());
1357
+ }, c = (b, w) => {
1358
+ n.delete(b), n.set(b, w);
1359
+ }, h = (b) => performance.now() - b.validatedAt >= Po, g = (b, w, l) => {
1360
+ const s = n.get(b), v = ue(s?.snapshot), O = l || s?.refreshPending === !0, M = Te(e.document(b, { refresh: O }).then((q) => ({ status: "loaded", document: q }))), N = { snapshot: { status: "pending", promise: M, previous: v }, validatedAt: performance.now(), opened: w, background: null, refreshPending: !1, seeded: void 0, stamp: m() };
1361
+ return c(b, N), f(), M.then((q) => {
1362
+ n.get(b) === N && (N.snapshot = q, N.stamp = m(), u());
1305
1363
  }), N;
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;
1364
+ }, E = (b, w, l, s, v, O) => {
1365
+ w.background === l && (w.background = null, !(n.get(b) !== w || w.snapshot !== s) && (v.kind === "failure" && s.document.kind !== "failure" || (w.validatedAt = O, w.stamp = m(), De(s.document, v) || (w.snapshot = { status: "loaded", document: v }), u())));
1366
+ }, k = async (b, w) => {
1367
+ const l = w.snapshot;
1368
+ if (l.status !== "loaded") return null;
1311
1369
  const s = {};
1312
- v.background = s;
1313
- const w = performance.now(), T = e.document(E, { refresh: v.refreshPending });
1314
- v.refreshPending = !1;
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);
1320
- }, S = (E) => {
1321
- const v = r.hold(E);
1322
- let a = !1;
1370
+ w.background = s;
1371
+ const v = performance.now(), O = e.document(b, { refresh: w.refreshPending });
1372
+ w.refreshPending = !1;
1373
+ const M = await O, N = w.background === s && n.get(b) === w && w.snapshot === l;
1374
+ return E(b, w, s, l, M, v), N ? M : null;
1375
+ }, R = (b, w) => {
1376
+ const { snapshot: l } = w;
1377
+ return l.status === "pending" ? !1 : l.status === "loaded" && l.document.kind !== "failure" ? (k(b, w), !1) : (l.status === "loaded" && i.add(l), g(b, !0, !1), !0);
1378
+ }, T = (b) => {
1379
+ const w = r.hold(b);
1380
+ let l = !1;
1323
1381
  return () => {
1324
- if (a) return;
1325
- a = !0, v();
1326
- const s = n.get(E);
1327
- s !== void 0 && d(E, s), f();
1382
+ if (l) return;
1383
+ l = !0, w();
1384
+ const s = n.get(b);
1385
+ s !== void 0 && c(b, s), f();
1328
1386
  };
1329
1387
  };
1330
1388
  return {
1331
- peek: (E) => n.get(E)?.snapshot,
1332
- peekSeeded: (E) => n.get(E)?.seeded,
1333
- answerStampOf: (E) => n.get(E)?.stamp,
1334
- prefetch: (E) => {
1335
- const v = n.get(E);
1336
- v !== void 0 && v.snapshot.status !== "deferred" || (g(E, !1, !1), u());
1389
+ peek: (b) => n.get(b)?.snapshot,
1390
+ peekSeeded: (b) => n.get(b)?.seeded,
1391
+ answerStampOf: (b) => n.get(b)?.stamp,
1392
+ prefetch: (b) => {
1393
+ const w = n.get(b);
1394
+ w !== void 0 && w.snapshot.status !== "deferred" || (g(b, !1, !1), u());
1337
1395
  },
1338
- open: (E) => {
1339
- const v = r.resumes(E), a = S(E), s = n.get(E);
1396
+ open: (b) => {
1397
+ const w = r.resumes(b), l = T(b), s = n.get(b);
1340
1398
  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);
1399
+ return g(b, !0, !1), u(), l;
1400
+ if (c(b, s), w) return l;
1401
+ const { snapshot: v } = s;
1402
+ return v.status === "pending" ? (s.opened = !0, l) : v.document.kind === "failure" ? (s.opened || h(s) ? (i.add(v), g(b, !0, !1), u()) : s.opened = !0, l) : (s.opened = !0, s.background === null && h(s) && k(b, s), l);
1345
1403
  },
1346
- retain: S,
1347
- retry: (E) => {
1348
- const v = n.get(E);
1349
- v === void 0 || v.snapshot.status !== "loaded" || v.snapshot.document.kind !== "failure" || (g(E, !0, !1), u());
1404
+ retain: T,
1405
+ retry: (b) => {
1406
+ const w = n.get(b);
1407
+ w === void 0 || w.snapshot.status !== "loaded" || w.snapshot.document.kind !== "failure" || (g(b, !0, !1), u());
1350
1408
  },
1351
- seed: (E, v) => {
1352
- const a = performance.now(), s = Te(
1353
- v.then(
1409
+ seed: (b, w) => {
1410
+ const l = performance.now(), s = Te(
1411
+ w.then(
1354
1412
  (q) => q === null ? Nt : { status: "loaded", document: q },
1355
1413
  () => Nt
1356
1414
  )
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) => {
1361
- if (z.status === "loaded") {
1362
- b(E, w, W, q, z.document, a);
1415
+ ), v = n.get(b);
1416
+ if (v !== void 0 && v.snapshot.status === "loaded") {
1417
+ const q = v.snapshot, W = {};
1418
+ v.background = W, s.then((G) => {
1419
+ if (G.status === "loaded") {
1420
+ E(b, v, W, q, G.document, l);
1363
1421
  return;
1364
1422
  }
1365
- w.background === W && (w.background = null);
1423
+ v.background === W && (v.background = null);
1366
1424
  });
1367
1425
  return;
1368
1426
  }
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());
1427
+ const O = v !== void 0 && v.snapshot.status === "pending" ? v.snapshot.previous : null, M = { status: "pending", promise: s, previous: O }, N = { snapshot: M, validatedAt: l, opened: v?.opened === !0, background: null, refreshPending: v?.refreshPending === !0, seeded: M, stamp: m() };
1428
+ c(b, N), f(), s.then((q) => {
1429
+ n.get(b) === N && (q.status === "deferred" && r.isHeld(b) ? g(b, N.opened, !1) : (N.snapshot = q, N.stamp = m()), u());
1372
1430
  });
1373
1431
  },
1374
1432
  invalidate: () => {
1375
- let E = !1;
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;
1433
+ let b = !1;
1434
+ for (const [w, l] of [...n]) {
1435
+ if (l.validatedAt = Number.NEGATIVE_INFINITY, l.opened = !0, l.refreshPending = !0, !r.isHeld(w)) continue;
1436
+ const { snapshot: s } = l;
1379
1437
  if (s.status !== "pending") {
1380
- R(v, a) && (E = !0);
1438
+ R(w, l) && (b = !0);
1381
1439
  continue;
1382
1440
  }
1383
1441
  s.promise.then(() => {
1384
- n.get(v) === a && a.refreshPending && r.isHeld(v) && R(v, a) && u();
1442
+ n.get(w) === l && l.refreshPending && r.isHeld(w) && R(w, l) && u();
1385
1443
  });
1386
1444
  }
1387
- E && u();
1445
+ b && u();
1388
1446
  },
1389
- refresh: async (E) => {
1390
- const v = n.get(E);
1391
- if (v !== void 0 && Tn(v.snapshot)) {
1392
- v.refreshPending = !0;
1393
- const s = await M(E, v);
1447
+ refresh: async (b) => {
1448
+ const w = n.get(b);
1449
+ if (w !== void 0 && Tn(w.snapshot)) {
1450
+ w.refreshPending = !0;
1451
+ const s = await k(b, w);
1394
1452
  return s === null ? We : s.kind === "failure" ? { status: "failed", failure: s.failure } : Dt;
1395
1453
  }
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);
1454
+ const l = g(b, !0, !0);
1455
+ return u(), l.snapshot.status !== "pending" ? We : (await l.snapshot.promise, n.get(b) === l ? Dt : We);
1398
1456
  },
1399
1457
  clear: () => {
1400
1458
  n.clear();
1401
- for (const E of r.heldKeys()) g(E, !0, !1);
1459
+ for (const b of r.heldKeys()) g(b, !0, !1);
1402
1460
  u();
1403
1461
  },
1404
1462
  subscribe: o.subscribe,
1405
- noteFailureShown: (E) => i.has(E) ? !1 : (i.add(E), !0)
1463
+ noteFailureShown: (b) => i.has(b) ? !1 : (i.add(b), !0)
1406
1464
  };
1407
1465
  };
1408
- function Fo({
1466
+ function $o({
1409
1467
  title: e,
1410
1468
  titleId: t,
1411
1469
  ...n
@@ -1430,7 +1488,7 @@ function Fo({
1430
1488
  clipRule: "evenodd"
1431
1489
  }));
1432
1490
  }
1433
- const qo = /* @__PURE__ */ y.forwardRef(Fo);
1491
+ const qo = /* @__PURE__ */ y.forwardRef($o);
1434
1492
  function _o({
1435
1493
  title: e,
1436
1494
  titleId: t,
@@ -1480,7 +1538,7 @@ const zo = /* @__PURE__ */ y.forwardRef(Bo), jo = 2e3, Pt = Object.freeze({ outc
1480
1538
  const t = navigator.clipboard;
1481
1539
  return t === void 0 ? Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")) : t.writeText(e);
1482
1540
  }, Vo = ({ text: e }) => {
1483
- const { announcer: t, labels: n } = D(), [r, o] = B(Pt);
1541
+ const { announcer: t, labels: n } = D(), [r, o] = z(Pt);
1484
1542
  te(() => {
1485
1543
  if (r.outcome === "idle") return;
1486
1544
  const m = setTimeout(() => o(Pt), jo);
@@ -1488,17 +1546,17 @@ const zo = /* @__PURE__ */ y.forwardRef(Bo), jo = 2e3, Pt = Object.freeze({ outc
1488
1546
  }, [r]);
1489
1547
  const i = (m) => {
1490
1548
  o({ outcome: m }), t.announce(m === "copied" ? n.copiedText : n.copyTextFailed);
1491
- }, l = () => {
1549
+ }, a = () => {
1492
1550
  Ho(e).then(
1493
1551
  () => i("copied"),
1494
1552
  () => i("failed")
1495
1553
  );
1496
1554
  }, u = r.outcome === "copied" ? n.copiedText : r.outcome === "failed" ? n.copyTextFailed : n.copyText;
1497
1555
  return (
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, {}) })
1556
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: u, onClick: a, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ d(qo, {}) : r.outcome === "failed" ? /* @__PURE__ */ d(zo, {}) : /* @__PURE__ */ d(Io, {}) })
1499
1557
  );
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 });
1501
- function Zo({
1558
+ }, he = pe("fill"), Zo = Object.freeze({ blockSize: "100%" }), ve = ({ scrollerProps: e, children: t }) => re(he) === "content" ? /* @__PURE__ */ d(xt, { scrollerProps: e, children: t }) : /* @__PURE__ */ d(xt, { scrollerProps: { ...e, style: Zo }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: xn, children: t });
1559
+ function Uo({
1502
1560
  title: e,
1503
1561
  titleId: t,
1504
1562
  ...n
@@ -1519,7 +1577,7 @@ function Zo({
1519
1577
  d: "M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"
1520
1578
  }));
1521
1579
  }
1522
- const Go = /* @__PURE__ */ y.forwardRef(Zo);
1580
+ const Go = /* @__PURE__ */ y.forwardRef(Uo);
1523
1581
  function Wo({
1524
1582
  title: e,
1525
1583
  titleId: t,
@@ -1547,12 +1605,12 @@ function Wo({
1547
1605
  }
1548
1606
  const Ko = /* @__PURE__ */ y.forwardRef(Wo), qe = ({ name: e, openUrl: t, downloadUrl: n, icon: r, children: o }) => {
1549
1607
  const { labels: i } = D();
1550
- return /* @__PURE__ */ F("div", { className: "aqmx-document-toolbar", children: [
1551
- /* @__PURE__ */ c("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: r }),
1552
- /* @__PURE__ */ c("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
1608
+ return /* @__PURE__ */ $("div", { className: "aqmx-document-toolbar", children: [
1609
+ /* @__PURE__ */ d("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: r }),
1610
+ /* @__PURE__ */ d("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
1553
1611
  o,
1554
- /* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": i.openInNewTab, title: i.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ c(Ko, {}) }),
1555
- /* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: n, download: e, "aria-label": i.download, title: i.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ c(Go, {}) })
1612
+ /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": i.openInNewTab, title: i.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ d(Ko, {}) }),
1613
+ /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: n, download: e, "aria-label": i.download, title: i.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ d(Go, {}) })
1556
1614
  ] });
1557
1615
  };
1558
1616
  function Xo({
@@ -1578,43 +1636,43 @@ function Xo({
1578
1636
  }
1579
1637
  const Yo = /* @__PURE__ */ y.forwardRef(Xo), Jo = Object.freeze({ className: "aqmx-document-stage" }), Qo = ({ document: e }) => {
1580
1638
  const { labels: t } = D();
1581
- return /* @__PURE__ */ F("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
1582
- /* @__PURE__ */ c(qe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ c(Yo, {}) }),
1583
- /* @__PURE__ */ c(ve, { scrollerProps: Jo, children: /* @__PURE__ */ F("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
1584
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
1585
- /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
1639
+ return /* @__PURE__ */ $("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
1640
+ /* @__PURE__ */ d(qe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ d(Yo, {}) }),
1641
+ /* @__PURE__ */ d(ve, { scrollerProps: Jo, children: /* @__PURE__ */ $("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
1642
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
1643
+ /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
1586
1644
  ] }) })
1587
1645
  ] });
1588
1646
  }, _e = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", ei = (e) => {
1589
1647
  const t = e.indexOf("#");
1590
1648
  return t === -1 ? "" : e.slice(t);
1591
- }, ti = /(%[0-9A-Fa-f]{2})/u, ct = (e) => {
1649
+ }, ti = /(%[0-9A-Fa-f]{2})/u, dt = (e) => {
1592
1650
  if (!e.startsWith("#") || e.length === 1) return null;
1593
1651
  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)]);
1594
1652
  return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
1595
1653
  }, Rn = (e) => `#${encodeURIComponent(e)}`, ni = (e) => {
1596
1654
  if (e === "#") return !0;
1597
- const t = ct(e);
1655
+ const t = dt(e);
1598
1656
  return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
1599
- }, Mn = (e, t) => {
1657
+ }, On = (e, t) => {
1600
1658
  if (t === "") return null;
1601
1659
  for (const n of e.querySelectorAll("[id]"))
1602
1660
  if (n.id === t) return n;
1603
1661
  return null;
1604
- }, ri = "http://www.w3.org/1999/xhtml", $t = (e, t) => {
1662
+ }, ri = "http://www.w3.org/1999/xhtml", Ft = (e, t) => {
1605
1663
  if (t === "") return null;
1606
- const n = Mn(e, t);
1664
+ const n = On(e, t);
1607
1665
  if (n !== null) return n;
1608
1666
  for (const r of e.querySelectorAll("a[name]"))
1609
1667
  if (r.localName === "a" && r.namespaceURI === ri && r.getAttribute("name") === t) return r;
1610
1668
  return null;
1611
- }, On = (e, t) => {
1669
+ }, Cn = (e, t) => {
1612
1670
  if (e === null || !t.startsWith("#")) return null;
1613
- const n = $t(e, t.slice(1));
1671
+ const n = Ft(e, t.slice(1));
1614
1672
  if (n !== null) return n;
1615
- const r = ct(t);
1616
- return r === null ? null : $t(e, r);
1617
- }, Ft = (e) => {
1673
+ const r = dt(t);
1674
+ return r === null ? null : Ft(e, r);
1675
+ }, $t = (e) => {
1618
1676
  const { body: t, documentElement: n } = e.ownerDocument;
1619
1677
  if (e === t) {
1620
1678
  const o = getComputedStyle(n);
@@ -1627,17 +1685,17 @@ const Yo = /* @__PURE__ */ y.forwardRef(Xo), Jo = Object.freeze({ className: "aq
1627
1685
  return o !== "hidden" && o !== "clip";
1628
1686
  }, ii = (e, t) => {
1629
1687
  const n = t.closest(_e), r = n !== null && e.contains(n) ? n : e;
1630
- if (r.scrollHeight > r.clientHeight && Ft(r)) return r;
1631
- const o = e.getBoundingClientRect().height, { documentElement: i, scrollingElement: l } = e.ownerDocument;
1688
+ if (r.scrollHeight > r.clientHeight && $t(r)) return r;
1689
+ const o = e.getBoundingClientRect().height, { documentElement: i, scrollingElement: a } = e.ownerDocument;
1632
1690
  for (let u = e.parentElement; u !== null && u !== i; u = u.parentElement)
1633
- if (Ft(u) && u.scrollHeight > u.clientHeight && u.clientHeight < o) return u;
1634
- return l instanceof Element && oi(e.ownerDocument) && l.scrollHeight > l.clientHeight && l.clientHeight < o ? l : r;
1635
- }, li = Object.freeze({
1691
+ if ($t(u) && u.scrollHeight > u.clientHeight && u.clientHeight < o) return u;
1692
+ return a instanceof Element && oi(e.ownerDocument) && a.scrollHeight > a.clientHeight && a.clientHeight < o ? a : r;
1693
+ }, ai = Object.freeze({
1636
1694
  scrollerOf: ii,
1637
1695
  reveal: (e) => {
1638
1696
  e.scrollIntoView(tt);
1639
1697
  }
1640
- }), tt = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), ai = (e, t) => {
1698
+ }), tt = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), li = (e, t) => {
1641
1699
  for (let n = t; n !== null && n !== e; n = n.parentElement) {
1642
1700
  const r = n.parentElement;
1643
1701
  if (r instanceof HTMLDetailsElement && n !== r.querySelector(":scope > summary") && (r.open = !0), n.getAttribute("hidden")?.toLowerCase() === "until-found") {
@@ -1647,21 +1705,21 @@ const Yo = /* @__PURE__ */ y.forwardRef(Xo), Jo = Object.freeze({ className: "aq
1647
1705
  }
1648
1706
  }, si = (e, t) => {
1649
1707
  if (t.getClientRects().length === 0) return;
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;
1651
- if (!u && Math.abs(l.top - i - n) < 1) {
1708
+ const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), i = Number.parseFloat(r), a = t.getBoundingClientRect(), u = a.height + i + Number.parseFloat(o) > e.clientHeight;
1709
+ if (!u && Math.abs(a.top - i - n) < 1) {
1652
1710
  t.scrollIntoView(tt);
1653
1711
  return;
1654
1712
  }
1655
- e.scrollBy({ top: u ? l.top - n - e.clientHeight : l.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(tt);
1656
- }, ci = (e, t) => {
1713
+ e.scrollBy({ top: u ? a.top - n - e.clientHeight : a.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(tt);
1714
+ }, di = (e, t) => {
1657
1715
  const n = t.scrollerOf(e, e.querySelector(_e) ?? e);
1658
1716
  n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
1659
1717
  }, qt = (e, t, n) => {
1660
1718
  if (e === null) return null;
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);
1719
+ const r = Cn(e, t);
1720
+ return r === null ? (ni(t) && di(e, n), null) : (li(e, r), si(n.scrollerOf(e, r), r), n.reveal(r), r);
1663
1721
  };
1664
- function di({
1722
+ function ci({
1665
1723
  title: e,
1666
1724
  titleId: t,
1667
1725
  ...n
@@ -1680,7 +1738,7 @@ function di({
1680
1738
  d: "M3.28 2.22a.75.75 0 0 0-1.06 1.06L5.44 6.5H2.75a.75.75 0 0 0 0 1.5h4.5A.75.75 0 0 0 8 7.25v-4.5a.75.75 0 0 0-1.5 0v2.69L3.28 2.22ZM13.5 2.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-2.69l3.22-3.22a.75.75 0 0 0-1.06-1.06L13.5 5.44V2.75ZM3.28 17.78l3.22-3.22v2.69a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.69l-3.22 3.22a.75.75 0 1 0 1.06 1.06ZM13.5 14.56l3.22 3.22a.75.75 0 1 0 1.06-1.06l-3.22-3.22h2.69a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75v4.5a.75.75 0 0 0 1.5 0v-2.69Z"
1681
1739
  }));
1682
1740
  }
1683
- const ui = /* @__PURE__ */ y.forwardRef(di);
1741
+ const ui = /* @__PURE__ */ y.forwardRef(ci);
1684
1742
  function fi({
1685
1743
  title: e,
1686
1744
  titleId: t,
@@ -1769,13 +1827,13 @@ const wi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1769
1827
  t.target === e && (e = null);
1770
1828
  }
1771
1829
  };
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) => {
1830
+ }, Ae = Object.freeze([1 / be ** 2, 1 / be, 1, be, be ** 2]), _t = Object.freeze({ mode: "fit" }), Ei = 1, Mn = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), It = `[data-testid="${Mn["data-testid"]}"]`, Si = pe(null), yi = (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) => {
1773
1831
  if (e.mode === "level") {
1774
1832
  const o = e.index + n;
1775
- return o >= 0 && o < Le.length ? o : null;
1833
+ return o >= 0 && o < Ae.length ? o : null;
1776
1834
  }
1777
1835
  if (t === null || !Number.isFinite(t) || t <= 0) return null;
1778
- const r = n === 1 ? Le.findIndex((o) => o > t) : Le.findLastIndex((o) => o < t);
1836
+ const r = n === 1 ? Ae.findIndex((o) => o > t) : Ae.findLastIndex((o) => o < t);
1779
1837
  return r === -1 ? null : r;
1780
1838
  }, zt = (e, t, n) => {
1781
1839
  if (e.mode === "level") {
@@ -1785,7 +1843,7 @@ const wi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1785
1843
  if (t === null) return null;
1786
1844
  const r = Bt(e, t.scale, n);
1787
1845
  return r === null ? null : { mode: "level", index: r, base: t.base };
1788
- }, Si = (e, t) => {
1846
+ }, xi = (e, t) => {
1789
1847
  if (e <= 0 || t <= 0) return 0;
1790
1848
  const n = Math.trunc(Math.log(t / e) / Math.log(be));
1791
1849
  return n === 0 ? 0 : n;
@@ -1793,17 +1851,17 @@ const wi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1793
1851
  const t = e[0], n = e[1];
1794
1852
  return e.length !== 2 || t === void 0 || n === void 0 ? null : { distance: Math.hypot(n.clientX - t.clientX, n.clientY - t.clientY), middle: { x: (t.clientX + n.clientX) / 2, y: (t.clientY + n.clientY) / 2 } };
1795
1853
  }, ki = (e) => {
1796
- const t = Le[e];
1854
+ const t = Ae[e];
1797
1855
  if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
1798
1856
  return t;
1799
1857
  }, 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));
1858
+ const { labels: t } = D(), n = re(Si), [r] = z(() => n === null ? null : n.read(e.url)), [o, i] = z(r === null ? _t : r.zoom), [a, u] = z(r === null ? null : r.reported), [m, f] = z(null), c = _(null), h = P((w) => {
1859
+ const { naturalWidth: l, naturalHeight: s } = w;
1860
+ u((v) => Ht(v, l, s));
1803
1861
  }, []), g = P(
1804
- (v) => {
1805
- d.current = v, !(v === null || !v.complete) && (v.naturalWidth > 0 || v.naturalHeight > 0 ? h(v) : v.decode().then(
1806
- () => h(v),
1862
+ (w) => {
1863
+ c.current = w, !(w === null || !w.complete) && (w.naturalWidth > 0 || w.naturalHeight > 0 ? h(w) : w.decode().then(
1864
+ () => h(w),
1807
1865
  () => {
1808
1866
  }
1809
1867
  ));
@@ -1811,68 +1869,68 @@ const wi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1811
1869
  [h]
1812
1870
  );
1813
1871
  te(() => {
1814
- n !== null && l !== null && n.save(e.url, { zoom: o, reported: l });
1815
- }, [n, e.url, o, l]), H(() => {
1816
- const v = d.current;
1817
- if (v === null || l === null || o.mode !== "fit") return;
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();
1822
- }, [l, o.mode]);
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 });
1824
- H(() => {
1825
- A.current = { zoomIn: R, zoomOut: M };
1872
+ n !== null && a !== null && n.save(e.url, { zoom: o, reported: a });
1873
+ }, [n, e.url, o, a]), j(() => {
1874
+ const w = c.current;
1875
+ if (w === null || a === null || o.mode !== "fit") return;
1876
+ const l = () => f((v) => Ht(v, w.clientWidth, w.clientHeight));
1877
+ if (l(), typeof ResizeObserver > "u") return;
1878
+ const s = new ResizeObserver(l);
1879
+ return s.observe(w), () => s.disconnect();
1880
+ }, [a, o.mode]);
1881
+ const E = a === null || m === null ? null : yi(a, m), k = zt(o, E, -1), R = zt(o, E, 1), T = o.mode === "level" ? ki(o.index) : null, A = _({ zoomIn: R, zoomOut: k });
1882
+ j(() => {
1883
+ A.current = { zoomIn: R, zoomOut: k };
1826
1884
  });
1827
1885
  const L = _(null);
1828
- H(() => {
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);
1886
+ j(() => {
1887
+ const w = L.current, l = c.current?.closest(It);
1888
+ L.current = null, !(w === null || l === null || l === void 0) && (l.scrollLeft = w.across * l.scrollWidth - w.x, l.scrollTop = w.down * l.scrollHeight - w.y);
1831
1889
  }, [o]), te(() => {
1832
- const v = d.current?.closest(It);
1833
- if (v == null) return;
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;
1845
- if (z === null) return;
1846
- a.steps += W;
1847
- const j = v.getBoundingClientRect(), Y = N.middle.x - j.left, V = N.middle.y - j.top;
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);
1849
- }, T = (C) => {
1850
- C.touches.length < 2 && (a = null);
1890
+ const w = c.current?.closest(It);
1891
+ if (w == null) return;
1892
+ let l = null;
1893
+ const s = (M) => {
1894
+ const N = jt(M.touches);
1895
+ l = N === null ? null : { distance: N.distance, steps: 0 };
1896
+ }, v = (M) => {
1897
+ const N = jt(M.touches);
1898
+ if (l === null || N === null) return;
1899
+ M.preventDefault();
1900
+ const q = xi(l.distance, N.distance);
1901
+ if (q === l.steps) return;
1902
+ const W = q > l.steps ? 1 : -1, G = W === 1 ? A.current.zoomIn : A.current.zoomOut;
1903
+ if (G === null) return;
1904
+ l.steps += W;
1905
+ const I = w.getBoundingClientRect(), J = N.middle.x - I.left, H = N.middle.y - I.top;
1906
+ L.current = w.scrollWidth > 0 && w.scrollHeight > 0 ? { x: J, y: H, across: (w.scrollLeft + J) / w.scrollWidth, down: (w.scrollTop + H) / w.scrollHeight } : null, i(G);
1907
+ }, O = (M) => {
1908
+ M.touches.length < 2 && (l = null);
1851
1909
  };
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);
1910
+ return w.addEventListener("touchstart", s, { passive: !0 }), w.addEventListener("touchmove", v, { passive: !1 }), w.addEventListener("touchend", O, { passive: !0 }), w.addEventListener("touchcancel", O, { passive: !0 }), () => {
1911
+ w.removeEventListener("touchstart", s), w.removeEventListener("touchmove", v), w.removeEventListener("touchend", O), w.removeEventListener("touchcancel", O);
1854
1912
  };
1855
1913
  }, []);
1856
- const E = o.mode === "level" && S !== null ? { width: `${o.base.width * S}px`, height: `${o.base.height * S}px` } : void 0;
1857
- return /* @__PURE__ */ F("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1858
- /* @__PURE__ */ F(qe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ c(wi, {}), children: [
1859
- /* @__PURE__ */ c(
1914
+ const b = o.mode === "level" && T !== null ? { width: `${o.base.width * T}px`, height: `${o.base.height * T}px` } : void 0;
1915
+ return /* @__PURE__ */ $("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1916
+ /* @__PURE__ */ $(qe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ d(wi, {}), children: [
1917
+ /* @__PURE__ */ d(
1860
1918
  "button",
1861
1919
  {
1862
1920
  type: "button",
1863
1921
  className: "aqmx-icon-button",
1864
1922
  "aria-label": t.imageZoomOut,
1865
1923
  title: t.imageZoomOut,
1866
- "aria-disabled": M === null,
1924
+ "aria-disabled": k === null,
1867
1925
  onClick: () => {
1868
- M !== null && i(M);
1926
+ k !== null && i(k);
1869
1927
  },
1870
1928
  ...rt,
1871
- children: /* @__PURE__ */ c(mi, {})
1929
+ children: /* @__PURE__ */ d(mi, {})
1872
1930
  }
1873
1931
  ),
1874
- /* @__PURE__ */ c("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: S === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(S * 100)) }),
1875
- /* @__PURE__ */ c(
1932
+ /* @__PURE__ */ d("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: T === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(T * 100)) }),
1933
+ /* @__PURE__ */ d(
1876
1934
  "button",
1877
1935
  {
1878
1936
  type: "button",
@@ -1884,47 +1942,47 @@ const wi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1884
1942
  R !== null && i(R);
1885
1943
  },
1886
1944
  ...rt,
1887
- children: /* @__PURE__ */ c(pi, {})
1945
+ children: /* @__PURE__ */ d(pi, {})
1888
1946
  }
1889
1947
  ),
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, {}) })
1948
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => i(_t), children: /* @__PURE__ */ d(ui, {}) })
1891
1949
  ] }),
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" }) })
1950
+ /* @__PURE__ */ d(ve, { scrollerProps: Mn, children: /* @__PURE__ */ d("img", { ref: g, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: b, onLoad: (w) => h(w.currentTarget), "data-testid": "markdown-explorer-image" }) })
1893
1951
  ] });
1894
- }, Ln = pe(null), Ie = pe(void 0), An = pe(null), Be = () => {
1895
- const e = ne(Ln);
1952
+ }, An = pe(null), Ie = pe(void 0), Ln = pe(null), Be = () => {
1953
+ const e = re(An);
1896
1954
  if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
1897
1955
  return e;
1898
1956
  }, Ri = () => {
1899
- const e = ne(An);
1957
+ const e = re(Ln);
1900
1958
  if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
1901
1959
  return e;
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;
1960
+ }, ze = (e, t, n, r) => t.kind === "panel" ? Se(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? Se(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : Se(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), Oi = ({ children: e }) => {
1961
+ const { config: t } = D(), n = Be(), r = at(), o = r.kind === "location" ? r.location.source : void 0, i = Fe(ze(t, n.navigation, o, n.currentPath));
1962
+ return /* @__PURE__ */ d(Ie, { value: o, children: /* @__PURE__ */ d(Ln, { value: i, children: e }) });
1963
+ }, Ci = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', Mi = (e) => {
1964
+ const t = e instanceof Element ? e.closest(Ci) : null;
1907
1965
  return t === null ? null : t.getAttribute("data-doc-path");
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 }) => {
1909
- const f = $e(e);
1910
- return /* @__PURE__ */ c("a", { ...i, href: f, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (h) => {
1966
+ }, je = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, Ai = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: i, onDocumentLink: a, scope: u, children: m }) => {
1967
+ const f = Fe(e);
1968
+ return /* @__PURE__ */ d("a", { ...i, href: f, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (h) => {
1911
1969
  if (je(h)) {
1912
1970
  if (h.preventDefault(), t === u.currentPath && n !== "") {
1913
1971
  u.scrollWithin(n);
1914
1972
  return;
1915
1973
  }
1916
- l(t, n);
1974
+ a(t, n);
1917
1975
  }
1918
1976
  }, children: m });
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 });
1977
+ }, Li = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: i }) => {
1978
+ const { config: a } = D(), u = Be(), m = re(Ie), f = ei(e), { navigation: c } = u, h = `${ze(a, c, m, t)}${f}`, g = n === !1 ? "false" : void 0;
1979
+ return c.kind === "page" ? /* @__PURE__ */ d(Mo, { ...o, to: h, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": g, children: i }) : /* @__PURE__ */ d(Ai, { to: h, docPath: t, fragment: f, exists: g, className: r, attributes: o, onDocumentLink: c.onDocumentLink, scope: u, children: i });
1922
1980
  }, Ni = ({ className: e, attributes: t, children: n }) => {
1923
1981
  const { labels: r } = D();
1924
1982
  return (
1925
- /* @__PURE__ */ F("a", { ...t, className: e === void 0 ? "aqmx-document-inert-link" : `${e} aqmx-document-inert-link`, title: r.inertLink, "data-link-kind": "doc", "data-doc-exists": "false", children: [
1983
+ /* @__PURE__ */ $("a", { ...t, className: e === void 0 ? "aqmx-document-inert-link" : `${e} aqmx-document-inert-link`, title: r.inertLink, "data-link-kind": "doc", "data-doc-exists": "false", children: [
1926
1984
  n,
1927
- /* @__PURE__ */ F("span", { className: "aqmx-sr-only", children: [
1985
+ /* @__PURE__ */ $("span", { className: "aqmx-sr-only", children: [
1928
1986
  " (",
1929
1987
  r.inertLink,
1930
1988
  ")"
@@ -1932,25 +1990,25 @@ const wi = /* @__PURE__ */ y.forwardRef(vi), nt = "data-aqmx-key-repeat", rt = O
1932
1990
  ] })
1933
1991
  );
1934
1992
  }, Di = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
1935
- const { config: i } = D(), l = ne(Ie), u = $e(`${ze(i, r.navigation, l, r.currentPath)}${e}`);
1936
- return /* @__PURE__ */ c("a", { ...n, href: u, className: t, onClick: (f) => {
1993
+ const { config: i } = D(), a = re(Ie), u = Fe(`${ze(i, r.navigation, a, r.currentPath)}${e}`);
1994
+ return /* @__PURE__ */ d("a", { ...n, href: u, className: t, onClick: (f) => {
1937
1995
  je(f) && (f.preventDefault(), r.scrollWithin(e));
1938
1996
  }, children: o });
1939
1997
  }, Pi = ({ href: e, className: t, attributes: n, children: r }) => {
1940
1998
  const o = Be();
1941
- return o.navigation.kind === "page" ? /* @__PURE__ */ c("a", { ...n, href: e, className: t, onClick: (l) => {
1942
- if (!je(l)) return;
1943
- const u = l.currentTarget;
1944
- e === "#" ? o.followEmptyFragment(l.nativeEvent) : u.href === u.ownerDocument.URL && o.followSameUrlJump(e, l.nativeEvent);
1945
- }, children: r }) : /* @__PURE__ */ c(Di, { href: e, className: t, attributes: n, scope: o, children: r });
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();
1999
+ return o.navigation.kind === "page" ? /* @__PURE__ */ d("a", { ...n, href: e, className: t, onClick: (a) => {
2000
+ if (!je(a)) return;
2001
+ const u = a.currentTarget;
2002
+ e === "#" ? o.followEmptyFragment(a.nativeEvent) : u.href === u.ownerDocument.URL && o.followSameUrlJump(e, a.nativeEvent);
2003
+ }, children: r }) : /* @__PURE__ */ d(Di, { href: e, className: t, attributes: n, scope: o, children: r });
2004
+ }, Fi = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: i, children: a }) => t === "doc" ? n === void 0 || !tr(n) ? /* @__PURE__ */ d(Ni, { className: o, attributes: i, children: a }) : /* @__PURE__ */ d(Li, { href: e, docPath: n, docExists: r, className: o, attributes: i, children: a }) : e.startsWith("#") ? /* @__PURE__ */ d(Pi, { href: e, className: o, attributes: i, children: a }) : /* @__PURE__ */ d("a", { ...i, href: e, className: o, children: a }), $i = () => {
2005
+ const { config: e } = D(), t = Be(), n = re(Ie), r = $e();
1948
2006
  return P(
1949
2007
  (o, i) => {
1950
2008
  if (!je(i)) return !0;
1951
2009
  i.preventDefault();
1952
- const l = Rn(o.id), { navigation: u } = t;
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);
2010
+ const a = Rn(o.id), { navigation: u } = t;
2011
+ return u.kind === "panel" || dt(i.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(a), !0) : (r(`${ze(e, u, n, t.currentPath)}${a}`, "follow-link"), !0);
1954
2012
  },
1955
2013
  [e, t, n, r]
1956
2014
  );
@@ -2021,24 +2079,24 @@ function ji({
2021
2079
  clipRule: "evenodd"
2022
2080
  }));
2023
2081
  }
2024
- const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aqmx-document-stage" }), Ui = () => () => {
2025
- }, Zi = () => navigator.pdfViewerEnabled !== !1, Gi = () => null, Wi = ({ document: e }) => {
2026
- const { labels: t } = D(), n = ee(Ui, Zi, Gi);
2027
- return n === null ? null : n ? /* @__PURE__ */ c("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" }) : /* @__PURE__ */ F("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-pdf-not-shown", children: [
2028
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: t.pdfNotShown }),
2029
- /* @__PURE__ */ F("div", { className: "aqmx-callout-actions", children: [
2030
- /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, target: "_blank", rel: "noopener noreferrer", "data-testid": "markdown-explorer-pdf-not-shown-open", children: t.openInNewTab }),
2031
- /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-pdf-not-shown-download", children: t.download })
2082
+ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aqmx-document-stage" }), Zi = () => () => {
2083
+ }, Ui = () => navigator.pdfViewerEnabled !== !1, Gi = () => null, Wi = ({ document: e }) => {
2084
+ const { labels: t } = D(), n = ee(Zi, Ui, Gi);
2085
+ return n === null ? null : n ? /* @__PURE__ */ d("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" }) : /* @__PURE__ */ $("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-pdf-not-shown", children: [
2086
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: t.pdfNotShown }),
2087
+ /* @__PURE__ */ $("div", { className: "aqmx-callout-actions", children: [
2088
+ /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e.url, target: "_blank", rel: "noopener noreferrer", "data-testid": "markdown-explorer-pdf-not-shown-open", children: t.openInNewTab }),
2089
+ /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-pdf-not-shown-download", children: t.download })
2032
2090
  ] })
2033
2091
  ] });
2034
2092
  }, Ki = (e) => {
2035
2093
  switch (e) {
2036
2094
  case "video":
2037
- return /* @__PURE__ */ c(zi, {});
2095
+ return /* @__PURE__ */ d(zi, {});
2038
2096
  case "audio":
2039
- return /* @__PURE__ */ c(Hi, {});
2097
+ return /* @__PURE__ */ d(Hi, {});
2040
2098
  case "pdf":
2041
- return /* @__PURE__ */ c(Ii, {});
2099
+ return /* @__PURE__ */ d(Ii, {});
2042
2100
  default: {
2043
2101
  const t = e;
2044
2102
  throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`);
@@ -2049,22 +2107,22 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2049
2107
  switch (e.mediaType) {
2050
2108
  case "video":
2051
2109
  return (
2052
- /* @__PURE__ */ c("video", { className: "aqmx-document-video", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
2110
+ /* @__PURE__ */ d("video", { className: "aqmx-document-video", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
2053
2111
  );
2054
2112
  case "audio":
2055
2113
  return (
2056
- /* @__PURE__ */ c("audio", { className: "aqmx-document-audio", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
2114
+ /* @__PURE__ */ d("audio", { className: "aqmx-document-audio", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
2057
2115
  );
2058
2116
  case "pdf":
2059
- return /* @__PURE__ */ c(Wi, { document: e });
2117
+ return /* @__PURE__ */ d(Wi, { document: e });
2060
2118
  default: {
2061
2119
  const n = e.mediaType;
2062
2120
  throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`);
2063
2121
  }
2064
2122
  }
2065
- }, Yi = ({ document: e }) => /* @__PURE__ */ F("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
2066
- /* @__PURE__ */ c(qe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: Ki(e.mediaType) }),
2067
- /* @__PURE__ */ c(ve, { scrollerProps: Vi, children: /* @__PURE__ */ c(Xi, { document: e }) })
2123
+ }, Yi = ({ document: e }) => /* @__PURE__ */ $("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
2124
+ /* @__PURE__ */ d(qe, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: Ki(e.mediaType) }),
2125
+ /* @__PURE__ */ d(ve, { scrollerProps: Vi, children: /* @__PURE__ */ d(Xi, { document: e }) })
2068
2126
  ] }), Ji = (e) => ({
2069
2127
  loading: e.viewerLoading,
2070
2128
  errorPrefix: e.viewerErrorPrefix,
@@ -2106,6 +2164,32 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2106
2164
  mermaidPanRight: e.viewerMermaidPanRight,
2107
2165
  mermaidDiagram: e.viewerMermaidDiagram,
2108
2166
  mermaidRetry: e.viewerMermaidRetry,
2167
+ spreadsheetTable: e.viewerSpreadsheetTable,
2168
+ spreadsheetZoomIn: e.viewerSpreadsheetZoomIn,
2169
+ spreadsheetZoomOut: e.viewerSpreadsheetZoomOut,
2170
+ spreadsheetResetZoom: e.viewerSpreadsheetResetZoom,
2171
+ spreadsheetHighlight: e.viewerSpreadsheetHighlight,
2172
+ spreadsheetCopyAll: e.viewerSpreadsheetCopyAll,
2173
+ spreadsheetSaveTsv: e.viewerSpreadsheetSaveTsv,
2174
+ spreadsheetSaveMenu: e.viewerSpreadsheetSaveMenu,
2175
+ spreadsheetSaveTsvWithBom: e.viewerSpreadsheetSaveTsvWithBom,
2176
+ spreadsheetFullscreen: e.viewerSpreadsheetFullscreen,
2177
+ spreadsheetExitFullscreen: e.viewerSpreadsheetExitFullscreen,
2178
+ spreadsheetFullscreenDialog: e.viewerSpreadsheetFullscreenDialog,
2179
+ spreadsheetSize: e.viewerSpreadsheetSize,
2180
+ spreadsheetFileName: e.viewerSpreadsheetFileName,
2181
+ spreadsheetCopied: e.viewerSpreadsheetCopied,
2182
+ spreadsheetCopyFailed: e.viewerSpreadsheetCopyFailed,
2183
+ spreadsheetCellAnnouncement: e.viewerSpreadsheetCellAnnouncement,
2184
+ spreadsheetEmptyCell: e.viewerSpreadsheetEmptyCell,
2185
+ spreadsheetSelectionAnnouncement: e.viewerSpreadsheetSelectionAnnouncement,
2186
+ spreadsheetReadOnly: e.viewerSpreadsheetReadOnly,
2187
+ spreadsheetFormatRefused: e.viewerSpreadsheetFormatRefused,
2188
+ spreadsheetFenceRefused: e.viewerSpreadsheetFenceRefused,
2189
+ spreadsheetEditConflict: e.viewerSpreadsheetEditConflict,
2190
+ spreadsheetOptionsError: e.viewerSpreadsheetOptionsError,
2191
+ spreadsheetLoadFailed: e.viewerSpreadsheetLoadFailed,
2192
+ spreadsheetRetry: e.viewerSpreadsheetRetry,
2109
2193
  embeddedVideo: e.viewerEmbeddedVideo,
2110
2194
  embeddedPost: e.viewerEmbeddedPost,
2111
2195
  embeddedFrame: e.viewerEmbeddedFrame
@@ -2115,273 +2199,274 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2115
2199
  const [r] = e.documentStyles;
2116
2200
  if (r === void 0) throw new Error("[markdown-explorer] the configuration has no document style");
2117
2201
  return r.name;
2118
- }, Dn = (e, t) => e !== void 0 ? e : t !== void 0 ? t : yr, Qi = Object.freeze({ kind: "empty" }), dt = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), el = (e, t, n) => {
2202
+ }, Dn = (e, t) => e !== void 0 ? e : t !== void 0 ? t : Sr, Qi = Object.freeze({ kind: "empty" }), ct = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), ea = (e, t, n) => {
2119
2203
  if (t.view === "multi" || t.overrides[n] === void 0) return null;
2120
2204
  const r = n === "style" ? { align: t.overrides.align } : { style: t.overrides.style };
2121
- return ye(e, { ...t, overrides: r });
2122
- }, xe = ({ kind: e, view: t, label: n, stale: r, busy: o, frameRef: i, intent: l, children: u }) => {
2123
- const m = ne(he);
2205
+ return Se(e, { ...t, overrides: r });
2206
+ }, ye = ({ kind: e, view: t, label: n, stale: r, busy: o, frameRef: i, intent: a, children: u }) => {
2207
+ const m = re(he);
2124
2208
  return (
2125
- /* @__PURE__ */ F("section", { ref: i, role: "region", "aria-label": n, "aria-busy": o, "data-testid": "markdown-explorer-document", "data-aqmx-document-kind": e, "data-aqmx-document-view": t, "data-aqmx-document-flow": m, className: "aqmx-document", ...l, children: [
2126
- r ? /* @__PURE__ */ c("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
2209
+ /* @__PURE__ */ $("section", { ref: i, role: "region", "aria-label": n, "aria-busy": o, "data-testid": "markdown-explorer-document", "data-aqmx-document-kind": e, "data-aqmx-document-view": t, "data-aqmx-document-flow": m, className: "aqmx-document", ...a, children: [
2210
+ r ? /* @__PURE__ */ d("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
2127
2211
  u
2128
2212
  ] })
2129
2213
  );
2130
- }, tl = ({ absence: e, announces: t, announceFailure: n }) => {
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;
2214
+ }, ta = ({ absence: e, announces: t, announceFailure: n }) => {
2215
+ const { labels: r, announcer: o } = D(), i = e.kind === "no-readme" ? e.folder : null, a = e.kind === "failure" ? e.folder : null, u = e.kind === "failure" ? e.failure : null;
2132
2216
  switch (te(() => {
2133
2217
  t && i !== null && o.announce(r.folderReadmeMissing(se(i)));
2134
2218
  }, [t, i, o, r]), te(() => {
2135
- l !== null && u !== null && n(r.documentFailed(se(l), ae(r, u.reason)));
2136
- }, [l, u, n, r]), e.kind) {
2219
+ a !== null && u !== null && n(r.documentFailed(se(a), le(r, u.reason)));
2220
+ }, [a, u, n, r]), e.kind) {
2137
2221
  case "empty":
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 }) }) });
2222
+ return /* @__PURE__ */ d(ye, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ d("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-document-empty", children: /* @__PURE__ */ d("p", { className: "aqmx-empty-title", children: r.documentEmpty }) }) });
2139
2223
  case "loading":
2140
- return /* @__PURE__ */ c(ut, { label: r.documentRegion });
2224
+ return /* @__PURE__ */ d(ut, { label: r.documentRegion });
2141
2225
  case "no-readme":
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)) }) }) });
2226
+ return /* @__PURE__ */ d(ye, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ d("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-folder-empty", children: /* @__PURE__ */ d("p", { className: "aqmx-empty-title", children: r.folderReadmeMissing(se(e.folder)) }) }) });
2143
2227
  case "failure":
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" }) }) });
2228
+ return /* @__PURE__ */ d(ye, { kind: "failure", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ d(ve, { scrollerProps: ft, children: /* @__PURE__ */ d(me, { failure: e.failure, alert: !1, onRetry: e.onRetry, testId: "markdown-explorer-folder-failure" }) }) });
2145
2229
  }
2146
2230
  }, ut = ({ label: e }) => {
2147
2231
  const { labels: t } = D();
2148
- return /* @__PURE__ */ F(xe, { kind: "loading", label: e, stale: !1, busy: !0, children: [
2149
- /* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-document-skeleton", children: dt.map((n) => /* @__PURE__ */ c("span", {}, n)) }),
2150
- /* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: t.documentLoading })
2232
+ return /* @__PURE__ */ $(ye, { kind: "loading", label: e, stale: !1, busy: !0, children: [
2233
+ /* @__PURE__ */ d("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-document-skeleton", children: ct.map((n) => /* @__PURE__ */ d("span", {}, n)) }),
2234
+ /* @__PURE__ */ d("p", { className: "aqmx-sr-only", children: t.documentLoading })
2151
2235
  ] });
2152
- }, Vt = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), nl = ({ path: e, document: t, viewer: n, editing: 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;
2154
- H(() => {
2236
+ }, Vt = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), na = ({ path: e, document: t, viewer: n, editing: r }) => {
2237
+ const { reportMathDiagnostics: o, edits: i } = D(), a = U(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), u = $i(), m = qi(), f = U(() => o === void 0 ? void 0 : (l) => o(e, l), [o, e]), c = _(null), { editable: h, doubleClick: g, region: E, paneScroll: k, stale: R } = r;
2238
+ j(() => {
2155
2239
  if (h)
2156
2240
  return i.bindView(e, {
2157
2241
  anchor: () => {
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));
2242
+ const l = c.current, s = E(), v = l === null ? null : l.querySelector(_e);
2243
+ return l === null || s === null || v === null ? null : yo(l, k.scrollerOf(s, v));
2160
2244
  }
2161
2245
  });
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())));
2246
+ }, [i, e, h, E, k]);
2247
+ const T = (l) => {
2248
+ const s = c.current, { target: v } = l;
2249
+ !g || s === null || !(v instanceof Element) || !Eo(v) || (l.stopPropagation(), i.start(e, So(v, s, s.ownerDocument.getSelection())));
2166
2250
  }, A = _(null), L = _(R);
2167
- H(() => {
2251
+ j(() => {
2168
2252
  L.current = R;
2169
2253
  });
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();
2254
+ const b = ae((l) => {
2255
+ const s = c.current, v = E(), O = s === null ? null : Oo(s, l.line);
2256
+ if (v === null || O === null) return !1;
2257
+ const M = k.scrollerOf(v, O);
2258
+ return M.scrollTop += Co(O, l.line) - l.clientTop, !0;
2259
+ }), w = ae((l) => {
2260
+ const s = E();
2177
2261
  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 };
2262
+ const v = () => {
2263
+ for (const M of Vt) s.removeEventListener(M, O, !0);
2264
+ A.current?.release === v && (A.current = null);
2265
+ }, O = () => v();
2266
+ for (const M of Vt) s.addEventListener(M, O, { capture: !0, passive: !0 });
2267
+ A.current = { point: l, release: v };
2184
2268
  });
2185
- return H(() => {
2186
- const a = i.takeReturn(e);
2187
- if (a !== null)
2269
+ return j(() => {
2270
+ const l = i.takeReturn(e);
2271
+ if (l !== null)
2188
2272
  return queueMicrotask(() => {
2189
- E(a) && L.current && v(a);
2273
+ b(l) && L.current && w(l);
2190
2274
  }), () => A.current?.release();
2191
- }, [i, e]), H(() => {
2192
- const a = A.current;
2193
- a === null || R || (a.release(), E(a.point));
2275
+ }, [i, e]), j(() => {
2276
+ const l = A.current;
2277
+ l === null || R || (l.release(), b(l.point));
2194
2278
  }, [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 }) });
2279
+ /* @__PURE__ */ d("div", { ref: c, className: "aqmx-document-viewer", onDoubleClick: T, children: /* @__PURE__ */ d(ln, { ...n, onHeadingSelect: u, headingHref: m, onMathDiagnostics: f, parseResult: a, content: null }) });
2196
2280
  }, Pn = ({ document: e, viewer: t }) => {
2197
2281
  const { labels: n } = D();
2198
- return /* @__PURE__ */ F(Pe, { children: [
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 }) }),
2200
- e.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
2201
- /* @__PURE__ */ c("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ c(an, { ...t, parseResult: null, content: e.text }) })
2282
+ return /* @__PURE__ */ $(Pe, { children: [
2283
+ /* @__PURE__ */ d(qe, { name: e.name, openUrl: nr(e.url), downloadUrl: e.url, icon: /* @__PURE__ */ d(uo, {}), children: e.truncated ? null : /* @__PURE__ */ d(Vo, { text: e.text }) }),
2284
+ e.truncated ? /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
2285
+ /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(ln, { ...t, parseResult: null, content: e.text }) })
2202
2286
  ] });
2203
- }, rl = ({ path: e, name: t, viewer: n }) => {
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)));
2287
+ }, ra = ({ path: e, name: t, viewer: n }) => {
2288
+ const { data: r, documents: o, announcer: i, labels: a } = D(), u = P(() => o.answerStampOf(e), [o, e]), m = ee(o.subscribe, u, u), [f, c] = z(0), h = U(() => ({ path: e, stamp: m, attempt: f }), [e, m, f]), [g, E] = z(null), k = ae((T) => {
2289
+ E(T), T.kind === "failure" && i.announce(a.documentFailed(t, le(a, T.failure.reason)));
2206
2290
  });
2207
2291
  te(() => {
2208
- const S = new AbortController();
2209
- return r.text(h.path, S.signal).then((A) => {
2210
- "kind" in A && M(A);
2211
- }), () => S.abort();
2292
+ const T = new AbortController();
2293
+ return r.text(h.path, T.signal).then((A) => {
2294
+ "kind" in A && k(A);
2295
+ }), () => T.abort();
2212
2296
  }, [r, h]);
2213
- const R = P(() => d((S) => S + 1), []);
2214
- return g === null ? /* @__PURE__ */ F(Pe, { children: [
2215
- /* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-markup-skeleton", children: dt.map((S) => /* @__PURE__ */ c("span", {}, S)) }),
2216
- /* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: l.markupLoading })
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 });
2218
- }, ft = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), ol = Object.freeze({ reason: "failed" }), il = (e) => /* @__PURE__ */ c(
2297
+ const R = P(() => c((T) => T + 1), []);
2298
+ return g === null ? /* @__PURE__ */ $(Pe, { children: [
2299
+ /* @__PURE__ */ d("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-markup-skeleton", children: ct.map((T) => /* @__PURE__ */ d("span", {}, T)) }),
2300
+ /* @__PURE__ */ d("p", { className: "aqmx-sr-only", children: a.markupLoading })
2301
+ ] }) : g.kind === "failure" ? /* @__PURE__ */ d(ve, { scrollerProps: ft, children: /* @__PURE__ */ d(me, { failure: g.failure, alert: !1, onRetry: R, testId: "markdown-explorer-markup-failure" }) }) : /* @__PURE__ */ d(Pn, { document: g, viewer: n });
2302
+ }, ft = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), oa = Object.freeze({ reason: "failed" }), ia = (e) => /* @__PURE__ */ d(
2219
2303
  ho,
2220
2304
  {
2221
- fallback: (t) => /* @__PURE__ */ c("div", { className: "aqmx-edit-message", children: /* @__PURE__ */ c(me, { failure: ol, alert: !1, onRetry: t, testId: "markdown-explorer-edit-load-failure" }) }),
2222
- children: /* @__PURE__ */ c(
2305
+ fallback: (t) => /* @__PURE__ */ d("div", { className: "aqmx-edit-message", children: /* @__PURE__ */ d(me, { failure: oa, alert: !1, onRetry: t, testId: "markdown-explorer-edit-load-failure" }) }),
2306
+ children: /* @__PURE__ */ d(
2223
2307
  ke,
2224
2308
  {
2225
- fallback: /* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-edit-skeleton", children: dt.map((t) => /* @__PURE__ */ c("span", {}, t)) }),
2226
- children: /* @__PURE__ */ c(mo, { ...e })
2309
+ fallback: /* @__PURE__ */ d("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-edit-skeleton", children: ct.map((t) => /* @__PURE__ */ d("span", {}, t)) }),
2310
+ children: /* @__PURE__ */ d(mo, { ...e })
2227
2311
  }
2228
2312
  )
2229
2313
  }
2230
- ), ll = ({ path: e, document: t, view: n, viewer: r, onRetry: o, editing: i }) => {
2314
+ ), aa = ({ path: e, document: t, view: n, viewer: r, onRetry: o, editing: i }) => {
2231
2315
  switch (t.kind) {
2232
2316
  case "markdown": {
2233
- const { session: l, layout: u, region: m, paneScroll: f, stale: d } = i;
2234
- if (n === "edit" && l !== void 0) return /* @__PURE__ */ c(il, { path: e, name: t.name, session: l, layout: u, viewer: r, region: m, paneScroll: f });
2235
- if (n === "markup") return /* @__PURE__ */ c(rl, { path: e, name: t.name, viewer: r });
2317
+ const { session: a, layout: u, region: m, paneScroll: f, stale: c } = i;
2318
+ if (n === "edit" && a !== void 0) return /* @__PURE__ */ d(ia, { path: e, name: t.name, session: a, layout: u, viewer: r, region: m, paneScroll: f });
2319
+ if (n === "markup") return /* @__PURE__ */ d(ra, { path: e, name: t.name, viewer: r });
2236
2320
  const h = t.edit !== null && (t.edit.kind === "inline" || t.edit.kind === "draft");
2237
- return /* @__PURE__ */ c(nl, { path: e, document: t, viewer: r, editing: { editable: h, doubleClick: h && u === "fill", region: m, paneScroll: f, stale: d } });
2321
+ return /* @__PURE__ */ d(na, { path: e, document: t, viewer: r, editing: { editable: h, doubleClick: h && u === "fill", region: m, paneScroll: f, stale: c } });
2238
2322
  }
2239
2323
  case "text":
2240
- return /* @__PURE__ */ c(Pn, { document: t, viewer: r });
2324
+ return /* @__PURE__ */ d(Pn, { document: t, viewer: r });
2241
2325
  case "image":
2242
- return /* @__PURE__ */ c(Ti, { document: t });
2326
+ return /* @__PURE__ */ d(Ti, { document: t });
2243
2327
  case "media":
2244
- return /* @__PURE__ */ c(Yi, { document: t });
2328
+ return /* @__PURE__ */ d(Yi, { document: t });
2245
2329
  case "file":
2246
- return /* @__PURE__ */ c(Qo, { document: t });
2330
+ return /* @__PURE__ */ d(Qo, { document: t });
2247
2331
  case "failure":
2248
- return /* @__PURE__ */ c(ve, { scrollerProps: ft, children: /* @__PURE__ */ c(me, { failure: t.failure, alert: !1, onRetry: o, testId: "markdown-explorer-document-failure" }) });
2332
+ return /* @__PURE__ */ d(ve, { scrollerProps: ft, children: /* @__PURE__ */ d(me, { failure: t.failure, alert: !1, onRetry: o, testId: "markdown-explorer-document-failure" }) });
2249
2333
  default: {
2250
- const l = t;
2251
- throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(l)}`);
2334
+ const a = t;
2335
+ throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(a)}`);
2252
2336
  }
2253
2337
  }
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)];
2338
+ }, la = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', sa = (e, t, n) => {
2339
+ 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(la)];
2256
2340
  for (const i of o)
2257
- if (i instanceof HTMLElement && xn(i)) return i;
2341
+ if (i instanceof HTMLElement && yn(i)) return i;
2258
2342
  return null;
2259
- }, Ut = (e, t, n) => {
2343
+ }, Zt = (e, t, n) => {
2260
2344
  const { activeElement: r, body: o } = e.ownerDocument, i = r === null || r === o;
2261
- t instanceof HTMLElement && n && (i || e.contains(r)) && xn(t);
2262
- }, cl = (e) => {
2345
+ t instanceof HTMLElement && n && (i || e.contains(r)) && yn(t);
2346
+ }, da = (e) => {
2263
2347
  const t = _(!1);
2264
- return H(() => {
2348
+ return j(() => {
2265
2349
  const n = e.current;
2266
2350
  if (n === null) throw new Error("[markdown-explorer] the document region is not mounted");
2267
2351
  const r = n.ownerDocument, o = r.defaultView;
2268
2352
  if (o === null) throw new Error("[markdown-explorer] the document region's document has no window");
2269
- let i = !1, l;
2353
+ let i = !1, a;
2270
2354
  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(() => {
2355
+ i = !(g.target instanceof Node && n.contains(g.target)), i && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(a), a = setTimeout(() => {
2272
2356
  i = !1;
2273
2357
  }, 0);
2274
2358
  }, m = (g) => {
2275
2359
  t.current = g.target instanceof Node && n.contains(g.target);
2276
2360
  }, f = (g) => {
2277
2361
  g.relatedTarget === null && i && (t.current = !1);
2278
- }, d = () => {
2279
- const { activeElement: g, body: b } = r;
2280
- g !== null && g !== b && (t.current = n.contains(g));
2362
+ }, c = () => {
2363
+ const { activeElement: g, body: E } = r;
2364
+ g !== null && g !== E && (t.current = n.contains(g));
2281
2365
  }, h = () => {
2282
2366
  i && !n.contains(r.activeElement) && (t.current = !1);
2283
2367
  };
2284
- return o.addEventListener("pointerdown", u, !0), o.addEventListener("mousedown", u, !0), o.addEventListener("focusin", m, !0), o.addEventListener("blur", d), o.addEventListener("focus", h), n.addEventListener("focusout", f), () => {
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);
2368
+ return o.addEventListener("pointerdown", u, !0), o.addEventListener("mousedown", u, !0), o.addEventListener("focusin", m, !0), o.addEventListener("blur", c), o.addEventListener("focus", h), n.addEventListener("focusout", f), () => {
2369
+ clearTimeout(a), o.removeEventListener("pointerdown", u, !0), o.removeEventListener("mousedown", u, !0), o.removeEventListener("focusin", m, !0), o.removeEventListener("blur", c), o.removeEventListener("focus", h), n.removeEventListener("focusout", f);
2286
2370
  };
2287
2371
  }, [e]), t;
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(
2372
+ }, ca = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: i, regionLabel: a, navigation: u, fragment: m, paneScroll: f, announces: c, announceFailure: h, onDocumentShown: g }) => {
2373
+ const { labels: E, announcer: k, documents: R } = D(), { document: T } = t, A = _(null), L = _(null), b = _(null), w = _(0), l = da(A), s = _({ path: e, document: T }), v = _(null), O = P(
2290
2374
  (Z) => {
2291
2375
  const X = A.current, Q = qt(X, Z, f);
2292
- X !== null && Q !== null && Ut(X, Q, a.current);
2376
+ X !== null && Q !== null && Zt(X, Q, l.current);
2293
2377
  },
2294
- [f, a]
2295
- ), C = P(
2378
+ [f, l]
2379
+ ), M = P(
2296
2380
  (Z, X) => {
2297
- const Q = v.current;
2381
+ const Q = w.current;
2298
2382
  setTimeout(() => {
2299
- !X.defaultPrevented && v.current === Q && T(Z);
2383
+ !X.defaultPrevented && w.current === Q && O(Z);
2300
2384
  }, 0);
2301
2385
  },
2302
- [T]
2386
+ [O]
2303
2387
  ), N = P(
2304
2388
  (Z) => {
2305
2389
  setTimeout(() => {
2306
- Z.defaultPrevented || T("#");
2390
+ Z.defaultPrevented || O("#");
2307
2391
  }, 0);
2308
2392
  },
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) => {
2393
+ [O]
2394
+ ), q = U(() => ({ navigation: u, currentPath: e, scrollWithin: O, followSameUrlJump: M, followEmptyFragment: N }), [u, e, O, M, N]), W = P(() => R.retry(e), [R, e]), G = Ao(R, Mi), I = bn(e), J = I !== void 0 ? "edit" : n ? "markup" : "rendered", H = T.kind === "markdown" ? J : void 0, ne = P(() => A.current, []), p = U(() => ({ session: I, layout: i, region: ne, paneScroll: f, stale: r }), [I, i, ne, f, r]), S = H === "edit" ? !1 : r, x = re(he), C = H === "edit" && i === "fill" ? "fill" : x, F = ae((Z, X) => {
2311
2395
  const Q = L.current;
2312
2396
  if (Q !== null && Q.path === Z && Q.snapshot === X) return;
2313
2397
  L.current = { path: Z, snapshot: X };
2314
2398
  const oe = X.document;
2315
2399
  if (oe.kind === "failure") {
2316
- R.noteFailureShown(X) && h(b.documentFailed(se(Z), ae(b, oe.failure.reason)));
2400
+ R.noteFailureShown(X) && h(E.documentFailed(se(Z), le(E, oe.failure.reason)));
2317
2401
  return;
2318
2402
  }
2319
- g?.(Z, oe), d && (Q === null || Q.path !== Z || Q.snapshot.document.kind === "failure") && M.announce(b.documentShown(oe.name));
2403
+ g?.(Z, oe), c && (Q === null || Q.path !== Z || Q.snapshot.document.kind === "failure") && k.announce(E.documentShown(oe.name));
2320
2404
  });
2321
2405
  te(() => {
2322
- $(e, t);
2406
+ F(e, t);
2323
2407
  }, [e, t]);
2324
- const I = le(() => {
2408
+ const B = ae(() => {
2325
2409
  m.kind === "panel" && m.consume();
2326
- }), K = le((Z) => {
2410
+ }), K = ae((Z) => {
2327
2411
  const X = A.current;
2328
- if (X === null || !a.current) return null;
2412
+ if (X === null || !l.current) return null;
2329
2413
  const { activeElement: Q, body: oe } = X.ownerDocument;
2330
- return Q !== null && Q !== oe ? null : sl(X, S, Z);
2331
- }), U = le((Z) => {
2414
+ return Q !== null && Q !== oe ? null : sa(X, T, Z);
2415
+ }), V = ae((Z) => {
2332
2416
  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));
2417
+ X !== null && Zt(X, Z, l.current);
2418
+ }), ie = ae((Z) => f.reveal(Z)), ht = ae((Z) => qt(A.current, Z, f));
2335
2419
  return te(() => {
2336
2420
  if (r) return;
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;
2421
+ const Z = s.current.path !== e, X = Z || s.current.document !== T;
2422
+ s.current = { path: e, document: T };
2423
+ const Q = v.current !== e;
2424
+ v.current = e;
2341
2425
  let oe = null;
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());
2426
+ m.kind === "page" ? b.current !== m.navigation && (b.current = m.navigation, w.current += 1, oe = m.fragment) : m.fragment !== null && (oe = m.fragment, B());
2343
2427
  const pt = () => {
2344
2428
  const He = oe === null ? null : ht(oe);
2345
2429
  if (!X) {
2346
- He !== null && U(He);
2430
+ He !== null && V(He);
2347
2431
  return;
2348
2432
  }
2349
2433
  const vt = K(m.fragment);
2350
2434
  Z && He === null && vt !== null && ie(vt);
2351
2435
  };
2352
2436
  Q ? queueMicrotask(pt) : pt();
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) }) }) }) });
2354
- }, mt = Object.freeze({ kind: "skeleton" }), ul = (e, t, n, r, o) => {
2437
+ }, [m, e, T, r]), /* @__PURE__ */ d(he, { value: C, children: /* @__PURE__ */ d(ye, { kind: T.kind, view: H, label: a(e, T), stale: S, busy: S, frameRef: A, intent: G, children: /* @__PURE__ */ d(An, { value: q, children: /* @__PURE__ */ d(Oi, { children: /* @__PURE__ */ d(aa, { path: e, document: T, view: J, viewer: o, onRetry: W, editing: p }, e) }) }) }) });
2438
+ }, mt = Object.freeze({ kind: "skeleton" }), ua = (e, t, n, r, o) => {
2355
2439
  if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
2356
2440
  const i = ue(t);
2357
2441
  if (i !== null) return { kind: "document", path: e, snapshot: i, stale: !0 };
2358
2442
  if (o && t?.status === "pending") return { kind: "streaming", path: e, promise: t.promise };
2359
- const l = n === null || n === e ? null : ue(r);
2360
- return n === null || l === null ? mt : { kind: "document", path: n, snapshot: l, stale: !0 };
2361
- }, fl = (e, t) => t.status === "deferred" ? mt : { kind: "document", path: e, snapshot: t, stale: !1 }, ml = ({ requestedPath: e, content: t, markup: n, ...r }) => {
2362
- const o = t.kind === "streaming" ? fl(t.path, ne(t.promise)) : t;
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 });
2364
- }, $n = ({ path: e, absence: t, markup: n, display: r, navigation: o, fragment: i, paneScroll: l, announces: u, announceFailure: m, onDocumentShown: f }) => {
2365
- const { config: d, labels: h, theme: g, documents: b } = D(), M = br(), R = _(!1);
2366
- H(() => {
2367
- R.current = !0;
2443
+ const a = n === null || n === e ? null : ue(r);
2444
+ return n === null || a === null ? mt : { kind: "document", path: n, snapshot: a, stale: !0 };
2445
+ }, fa = (e, t) => t.status === "deferred" ? mt : { kind: "document", path: e, snapshot: t, stale: !1 }, ma = ({ requestedPath: e, content: t, markup: n, ...r }) => {
2446
+ const o = t.kind === "streaming" ? fa(t.path, re(t.promise)) : t;
2447
+ return o.kind !== "document" ? /* @__PURE__ */ d(ut, { label: r.regionLabel(e, null) }) : /* @__PURE__ */ d(ca, { path: o.path, snapshot: o.snapshot, markup: n, stale: o.stale, ...r });
2448
+ }, Fn = ({ path: e, absence: t, markup: n, display: r, navigation: o, fragment: i, paneScroll: a, announces: u, announceFailure: m, onDocumentShown: f }) => {
2449
+ const { config: c, labels: h, locale: g, theme: E, documents: k } = D(), R = br(), T = _(!1);
2450
+ j(() => {
2451
+ T.current = !0;
2368
2452
  }, []);
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);
2370
- H(() => e === null ? void 0 : b.open(e), [b, e]), H(() => S === null ? void 0 : b.retain(S), [b, S]);
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;
2374
- N && n !== L && E(n);
2375
- const q = G(() => Ji(h), [h]), W = G(() => [...d.iframeHosts], [d]), z = o.kind === "panel", j = G(
2453
+ const [A, L] = z(null), [b, w] = z(n), l = P(() => e === null ? void 0 : k.peek(e), [k, e]), s = ee(k.subscribe, l, l), v = P(() => A === null ? void 0 : k.peek(A), [k, A]), O = ee(k.subscribe, v, v);
2454
+ j(() => e === null ? void 0 : k.open(e), [k, e]), j(() => A === null ? void 0 : k.retain(A), [k, A]);
2455
+ const M = e === null ? mt : ua(e, s, A, O, !T.current), N = e === null ? null : M.kind === "document" && !M.stale ? M.path : A;
2456
+ N !== A && L(N);
2457
+ const q = M.kind !== "document" || M.path === e;
2458
+ q && n !== b && w(n);
2459
+ const W = U(() => Ji(h), [h]), G = U(() => [...c.iframeHosts], [c]), I = o.kind === "panel", J = U(
2376
2460
  () => ({
2377
- labels: q,
2461
+ labels: W,
2462
+ spreadsheetLocale: g,
2378
2463
  emptyMessage: h.documentEmpty,
2379
- theme: g,
2380
- availableStyles: d.documentStyles,
2381
- iFrameAllowedDomains: W,
2382
- embeds: d.embeds,
2383
- linkComponent: $i,
2384
- toolbar: M,
2464
+ theme: E,
2465
+ availableStyles: c.documentStyles,
2466
+ iFrameAllowedDomains: G,
2467
+ embeds: c.embeds,
2468
+ linkComponent: Fi,
2469
+ toolbar: R,
2385
2470
  style: r.style,
2386
2471
  onStyleChange: r.onStyleChange,
2387
2472
  align: r.align,
@@ -2392,50 +2477,50 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2392
2477
  padding: r.padding,
2393
2478
  width: r.width === void 0 ? void 0 : `min(${r.width}, 100%)`,
2394
2479
  maxWidth: r.maxWidth === void 0 ? void 0 : `min(${r.maxWidth}, 100%)`,
2395
- renderScrollBar: z ? void 0 : Sn
2480
+ renderScrollBar: I ? void 0 : xn
2396
2481
  }),
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";
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(
2400
- ml,
2482
+ [W, g, h.documentEmpty, E, c.documentStyles, G, c.embeds, R, r, I]
2483
+ ), H = P((p, S) => I ? S === null || S.kind === "failure" ? se(p) : S.name : h.documentRegion, [I, h.documentRegion]), ne = I ? "content" : "fill";
2484
+ return e === null ? /* @__PURE__ */ d(he, { value: ne, children: /* @__PURE__ */ d(ta, { absence: t, announces: u, announceFailure: m }) }) : /* @__PURE__ */ d(he, { value: ne, children: /* @__PURE__ */ d(ke, { fallback: /* @__PURE__ */ d(ut, { label: H(e, null) }), children: /* @__PURE__ */ d(
2485
+ ma,
2401
2486
  {
2402
2487
  requestedPath: e,
2403
- content: T,
2404
- markup: N ? n : L,
2405
- viewer: j,
2488
+ content: M,
2489
+ markup: q ? n : b,
2490
+ viewer: J,
2406
2491
  editLayout: r.editLayout,
2407
- regionLabel: Y,
2492
+ regionLabel: H,
2408
2493
  navigation: o,
2409
2494
  fragment: i,
2410
- paneScroll: l,
2495
+ paneScroll: a,
2411
2496
  announces: u,
2412
2497
  announceFailure: m,
2413
2498
  onDocumentShown: f
2414
2499
  }
2415
2500
  ) }) });
2416
- }, hl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
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) => {
2501
+ }, ha = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
2502
+ const { config: i, viewSettings: a, announcer: u } = D(), m = Le((M) => M.style), f = Le((M) => M.align), c = $e(), h = nn(), g = at(), { view: E, overrides: k, embed: R } = r, T = P(
2503
+ (M) => {
2419
2504
  if (g.kind !== "location") return;
2420
- const N = el(i, g.location, C);
2421
- N !== null && d(N, "browse");
2505
+ const N = ea(i, g.location, M);
2506
+ N !== null && c(N, "browse");
2422
2507
  },
2423
- [i, d, g]
2508
+ [i, c, g]
2424
2509
  ), A = P(
2425
- (C) => {
2426
- l.update({ style: C }), S("style");
2510
+ (M) => {
2511
+ a.update({ style: M }), T("style");
2427
2512
  },
2428
- [l, S]
2513
+ [a, T]
2429
2514
  ), L = P(
2430
- (C) => {
2431
- l.update({ align: C }), S("align");
2515
+ (M) => {
2516
+ a.update({ align: M }), T("align");
2432
2517
  },
2433
- [l, S]
2434
- ), E = Nn(i, M.style, m), v = Dn(M.align, f), a = G(
2518
+ [a, T]
2519
+ ), b = Nn(i, k.style, m), w = Dn(k.align, f), l = U(
2435
2520
  () => ({
2436
- style: E,
2521
+ style: b,
2437
2522
  onStyleChange: A,
2438
- align: v,
2523
+ align: w,
2439
2524
  onAlignChange: L,
2440
2525
  showToc: R.showToc !== !1,
2441
2526
  showStyle: R.showStyle !== !1,
@@ -2445,29 +2530,29 @@ const Hi = /* @__PURE__ */ y.forwardRef(ji), Vi = Object.freeze({ className: "aq
2445
2530
  maxWidth: R.maxWidth,
2446
2531
  editLayout: "fill"
2447
2532
  }),
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 });
2451
- }, pl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
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(
2533
+ [b, A, w, L, R]
2534
+ ), s = U(() => ({ kind: "page", view: E, overrides: k, embed: R }), [E, k, R]), v = U(() => ({ kind: "page", fragment: h.hash, navigation: h }), [h]), O = P((M) => u.announce(M), [u]);
2535
+ return /* @__PURE__ */ d(Fn, { path: e, absence: t, markup: n, display: l, navigation: s, fragment: v, paneScroll: ai, announces: !0, announceFailure: O, onDocumentShown: o });
2536
+ }, pa = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
2537
+ const { config: i, viewSettings: a } = D(), u = Le((s) => s.style), m = Le((s) => s.align), [f, c] = z(() => Nn(i, void 0, u)), h = Dn(void 0, m), g = P((s) => a.update({ align: s }), [a]), { maximized: E, onDocumentLink: k, pendingHash: R, onHashConsumed: T, announceFailure: A, paneScroll: L } = r, b = U(
2453
2538
  () => ({
2454
2539
  style: f,
2455
- onStyleChange: d,
2540
+ onStyleChange: c,
2456
2541
  align: h,
2457
2542
  onAlignChange: g,
2458
- showToc: b,
2459
- showStyle: b,
2460
- showAlign: b,
2543
+ showToc: E,
2544
+ showStyle: E,
2545
+ showAlign: E,
2461
2546
  padding: void 0,
2462
2547
  width: void 0,
2463
2548
  maxWidth: void 0,
2464
- editLayout: b ? "fill" : "content"
2549
+ editLayout: E ? "fill" : "content"
2465
2550
  }),
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 });
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 });
2470
- function wl({
2551
+ [f, h, g, E]
2552
+ ), w = U(() => ({ kind: "panel", onDocumentLink: k }), [k]), l = U(() => ({ kind: "panel", fragment: R, consume: T }), [R, T]);
2553
+ return /* @__PURE__ */ d(Fn, { path: e, absence: t, markup: n, display: b, navigation: w, fragment: l, paneScroll: L, announces: !1, announceFailure: A, onDocumentShown: o });
2554
+ }, va = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => r.kind === "page" ? /* @__PURE__ */ d(ha, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) : /* @__PURE__ */ d(pa, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o });
2555
+ function wa({
2471
2556
  title: e,
2472
2557
  titleId: t,
2473
2558
  ...n
@@ -2488,8 +2573,8 @@ function wl({
2488
2573
  clipRule: "evenodd"
2489
2574
  }));
2490
2575
  }
2491
- const gl = /* @__PURE__ */ y.forwardRef(wl);
2492
- function bl({
2576
+ const ga = /* @__PURE__ */ y.forwardRef(wa);
2577
+ function ba({
2493
2578
  title: e,
2494
2579
  titleId: t,
2495
2580
  ...n
@@ -2510,8 +2595,8 @@ function bl({
2510
2595
  clipRule: "evenodd"
2511
2596
  }));
2512
2597
  }
2513
- const Fn = /* @__PURE__ */ y.forwardRef(bl);
2514
- function El({
2598
+ const $n = /* @__PURE__ */ y.forwardRef(ba);
2599
+ function Ea({
2515
2600
  title: e,
2516
2601
  titleId: t,
2517
2602
  ...n
@@ -2532,8 +2617,8 @@ function El({
2532
2617
  clipRule: "evenodd"
2533
2618
  }));
2534
2619
  }
2535
- const yl = /* @__PURE__ */ y.forwardRef(El);
2536
- function xl({
2620
+ const Sa = /* @__PURE__ */ y.forwardRef(Ea);
2621
+ function ya({
2537
2622
  title: e,
2538
2623
  titleId: t,
2539
2624
  ...n
@@ -2558,8 +2643,8 @@ function xl({
2558
2643
  clipRule: "evenodd"
2559
2644
  }));
2560
2645
  }
2561
- const Sl = /* @__PURE__ */ y.forwardRef(xl);
2562
- function kl({
2646
+ const xa = /* @__PURE__ */ y.forwardRef(ya);
2647
+ function ka({
2563
2648
  title: e,
2564
2649
  titleId: t,
2565
2650
  ...n
@@ -2580,8 +2665,8 @@ function kl({
2580
2665
  clipRule: "evenodd"
2581
2666
  }));
2582
2667
  }
2583
- const Tl = /* @__PURE__ */ y.forwardRef(kl);
2584
- function Rl({
2668
+ const Ta = /* @__PURE__ */ y.forwardRef(ka);
2669
+ function Ra({
2585
2670
  title: e,
2586
2671
  titleId: t,
2587
2672
  ...n
@@ -2604,8 +2689,8 @@ function Rl({
2604
2689
  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"
2605
2690
  }));
2606
2691
  }
2607
- const Ml = /* @__PURE__ */ y.forwardRef(Rl);
2608
- function Ol({
2692
+ const Oa = /* @__PURE__ */ y.forwardRef(Ra);
2693
+ function Ca({
2609
2694
  title: e,
2610
2695
  titleId: t,
2611
2696
  ...n
@@ -2628,8 +2713,8 @@ function Ol({
2628
2713
  clipRule: "evenodd"
2629
2714
  }));
2630
2715
  }
2631
- const Cl = /* @__PURE__ */ y.forwardRef(Ol);
2632
- function Ll({
2716
+ const Ma = /* @__PURE__ */ y.forwardRef(Ca);
2717
+ function Aa({
2633
2718
  title: e,
2634
2719
  titleId: t,
2635
2720
  ...n
@@ -2650,8 +2735,8 @@ function Ll({
2650
2735
  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"
2651
2736
  }));
2652
2737
  }
2653
- const Al = /* @__PURE__ */ y.forwardRef(Ll);
2654
- function Nl({
2738
+ const La = /* @__PURE__ */ y.forwardRef(Aa);
2739
+ function Na({
2655
2740
  title: e,
2656
2741
  titleId: t,
2657
2742
  ...n
@@ -2670,112 +2755,112 @@ function Nl({
2670
2755
  d: "M15 3.75H9v16.5h6V3.75ZM16.5 20.25h3.375c1.035 0 1.875-.84 1.875-1.875V5.625c0-1.036-.84-1.875-1.875-1.875H16.5v16.5ZM4.125 3.75H7.5v16.5H4.125a1.875 1.875 0 0 1-1.875-1.875V5.625c0-1.036.84-1.875 1.875-1.875Z"
2671
2756
  }));
2672
2757
  }
2673
- const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId: n }) => {
2674
- const { labels: r, onEditGrant: o } = D(), [i, l] = B(!1), u = () => {
2675
- o === void 0 || i || (l(!0), o(e).then((m) => {
2758
+ const Da = /* @__PURE__ */ y.forwardRef(Na), Pa = ({ href: e, onRetry: t, testId: n }) => {
2759
+ const { labels: r, onEditGrant: o } = D(), [i, a] = z(!1), u = () => {
2760
+ o === void 0 || i || (a(!0), o(e).then((m) => {
2676
2761
  m && t();
2677
- }).finally(() => l(!1)));
2762
+ }).finally(() => a(!1)));
2678
2763
  };
2679
- return /* @__PURE__ */ F("div", { className: "aqmx-callout aqmx-edit-grant", "data-testid": n, children: [
2680
- /* @__PURE__ */ c("p", { className: "aqmx-callout-title", children: r.editGrantTitle }),
2681
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: r.editGrantBody }),
2682
- /* @__PURE__ */ F("div", { className: "aqmx-edit-grant-actions", children: [
2683
- o === void 0 ? /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e, target: "_blank", rel: "noopener", "data-testid": `${n}-open`, children: r.editGrantAction }) : (
2684
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": i, "data-testid": `${n}-open`, onClick: u, children: r.editGrantAction })
2764
+ return /* @__PURE__ */ $("div", { className: "aqmx-callout aqmx-edit-grant", "data-testid": n, children: [
2765
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-title", children: r.editGrantTitle }),
2766
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: r.editGrantBody }),
2767
+ /* @__PURE__ */ $("div", { className: "aqmx-edit-grant-actions", children: [
2768
+ o === void 0 ? /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e, target: "_blank", rel: "noopener", "data-testid": `${n}-open`, children: r.editGrantAction }) : (
2769
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": i, "data-testid": `${n}-open`, onClick: u, children: r.editGrantAction })
2685
2770
  ),
2686
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-testid": `${n}-retry`, onClick: t, children: r.editGrantRetry })
2771
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "data-testid": `${n}-retry`, onClick: t, children: r.editGrantRetry })
2687
2772
  ] })
2688
2773
  ] });
2689
- }, $l = "Control+E Meta+E", Fl = (e, t, n) => n && t ? "split" : e.view, Zt = (e, t, n, r) => {
2774
+ }, Fa = "Control+E Meta+E", $a = (e, t, n) => n && t ? "split" : e.view, Ut = (e, t, n, r) => {
2690
2775
  if (n === "split") {
2691
2776
  e.setSideBySide(!0);
2692
2777
  return;
2693
2778
  }
2694
2779
  e.setView(t, n), r && e.sideBySide() && e.setSideBySide(!1);
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) => {
2780
+ }, Jl = (e) => e === "split" ? null : e, qa = (e) => e === "preview" ? "editor" : "preview", _a = (e) => /Mac|iPhone|iPad|iPod/u.test(e), Ia = (e, t) => {
2696
2781
  if (e.isComposing || e.altKey || e.shiftKey || (t ? !e.metaKey || e.ctrlKey : !e.ctrlKey || e.metaKey)) return !1;
2697
2782
  const n = e.key.toLowerCase();
2698
2783
  return n === "e" || e.code === "KeyE" && /^\p{L}$/u.test(n) && !/^[a-z]$/u.test(n);
2699
2784
  }, Gt = (e, t, n) => {
2700
2785
  const r = e.modifiedAt === null ? Number.NaN : Date.parse(e.modifiedAt);
2701
2786
  return n(Number.isNaN(r) ? e.id : t.format(r), e.author === null ? "" : e.author);
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(() => {
2787
+ }, Ba = ({ path: e, documentName: t, open: n, onClose: r }) => {
2788
+ const { data: o, edits: i, labels: a, locale: u, announcer: m } = D(), f = xe(), [c, h] = z(null), [g, E] = z(0), [k, R] = z(null), [T, A] = z(null), L = U(() => new Intl.DateTimeFormat(u, { dateStyle: "medium", timeStyle: "short" }), [u]), b = P(() => {
2704
2789
  R(null), A(null);
2705
- }, []), v = vn({ open: n, onOpen: E, onDismiss: r });
2790
+ }, []), w = vn({ open: n, onOpen: b, onDismiss: r });
2706
2791
  te(() => {
2707
2792
  if (!n) return;
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();
2793
+ const v = new AbortController();
2794
+ return h(null), o.revisions(e, v.signal).then((O) => {
2795
+ "kind" in O && h(O);
2796
+ }), () => v.abort();
2712
2797
  }, [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 = () => {
2720
- S === null || S.kind !== "revision" || (i.replaceDraft(e, S.text), m.announce(l.historyRestored(t)), r());
2721
- }, s = d !== null && d.kind === "revisions" ? d.revisions.find((w) => w.id === M) : void 0;
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: [
2723
- /* @__PURE__ */ c("p", { id: f, className: "aqmx-confirm-title", children: l.historyTitle(t) }),
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 }) })
2798
+ if (!n || k === null) return;
2799
+ const v = new AbortController();
2800
+ return A(null), o.revision(e, k, v.signal).then((O) => {
2801
+ "kind" in O && A(O);
2802
+ }), () => v.abort();
2803
+ }, [n, o, e, k]);
2804
+ const l = () => {
2805
+ T === null || T.kind !== "revision" || (i.replaceDraft(e, T.text), m.announce(a.historyRestored(t)), r());
2806
+ }, s = c !== null && c.kind === "revisions" ? c.revisions.find((v) => v.id === k) : void 0;
2807
+ return /* @__PURE__ */ d("dialog", { ...w, className: "aqmx-confirm aqmx-history", "aria-labelledby": f, "data-testid": "markdown-explorer-history", children: /* @__PURE__ */ $("div", { className: "aqmx-confirm-panel aqmx-history-panel", children: [
2808
+ /* @__PURE__ */ d("p", { id: f, className: "aqmx-confirm-title", children: a.historyTitle(t) }),
2809
+ c === null ? /* @__PURE__ */ d("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: a.historyLoading }) : c.kind === "failure" ? /* @__PURE__ */ d(me, { failure: c.failure, alert: !1, onRetry: () => E((v) => v + 1), testId: "markdown-explorer-history-failure" }) : c.revisions.length === 0 ? /* @__PURE__ */ d("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: a.historyEmpty }) : /* @__PURE__ */ d("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: c.revisions.map((v) => /* @__PURE__ */ d("li", { children: /* @__PURE__ */ $("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": v.id === k, "data-testid": "markdown-explorer-history-entry", onClick: () => R(v.id), children: [
2810
+ /* @__PURE__ */ d("span", { children: Gt(v, L, a.historyEntry) }),
2811
+ v.current ? /* @__PURE__ */ d("span", { className: "aqmx-history-mark", children: a.historyCurrent }) : null,
2812
+ v.kept ? /* @__PURE__ */ d("span", { className: "aqmx-history-mark", children: a.historyKept }) : null
2813
+ ] }) }, v.id)) }),
2814
+ k === null ? null : T === null ? /* @__PURE__ */ d("p", { className: "aqmx-history-note", children: a.historyLoading }) : T.kind === "failure" ? /* @__PURE__ */ d(me, { failure: T.failure, alert: !1, testId: "markdown-explorer-history-revision-failure" }) : (
2815
+ /* @__PURE__ */ d("section", { className: "aqmx-history-text", tabIndex: 0, "aria-label": s === void 0 ? a.historyTitle(t) : Gt(s, L, a.historyEntry), "data-testid": "markdown-explorer-history-text", children: /* @__PURE__ */ d("pre", { children: T.text }) })
2731
2816
  ),
2732
- /* @__PURE__ */ F("div", { className: "aqmx-confirm-actions", children: [
2733
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-testid": "markdown-explorer-history-close", onClick: r, children: l.historyClose }),
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 })
2817
+ /* @__PURE__ */ $("div", { className: "aqmx-confirm-actions", children: [
2818
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "data-testid": "markdown-explorer-history-close", onClick: r, children: a.historyClose }),
2819
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": T === null || T.kind !== "revision", "data-testid": "markdown-explorer-history-restore", onClick: l, children: a.historyRestore })
2735
2820
  ] })
2736
2821
  ] }) });
2737
- }, zl = (e) => {
2822
+ }, za = (e) => {
2738
2823
  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;
2739
2824
  return i === void 0 || i.kind === "failure" ? { edit: null, name: se(e) } : { edit: i.kind === "markdown" ? i.edit : null, name: i.name };
2740
- }, ce = (e) => {
2825
+ }, de = (e) => {
2741
2826
  e.stopPropagation();
2742
- }, jl = ({ path: e, documentName: t, iconOnly: n, previewAvailable: r, draft: o }) => {
2743
- const { draftConverter: i, edits: l, labels: u } = D(), m = ee(
2744
- l.subscribe,
2745
- () => l.session(e) !== void 0,
2827
+ }, ja = ({ path: e, documentName: t, iconOnly: n, previewAvailable: r, draft: o }) => {
2828
+ const { draftConverter: i, edits: a, labels: u } = D(), m = ee(
2829
+ a.subscribe,
2830
+ () => a.session(e) !== void 0,
2746
2831
  () => !1
2747
- ), [f, d] = B(null), h = () => {
2832
+ ), [f, c] = z(null), h = () => {
2748
2833
  if (!m) {
2749
- l.start(e, l.viewAnchor(e));
2834
+ a.start(e, a.viewAnchor(e));
2750
2835
  return;
2751
2836
  }
2752
- l.flush(e);
2753
- const R = l.session(e);
2754
- R?.dirty === !0 ? d(R.save.kind === "draft" ? "draft" : "unsaved") : l.close(e);
2837
+ a.flush(e);
2838
+ const R = a.session(e);
2839
+ R?.dirty === !0 ? c(R.save.kind === "draft" ? "draft" : "unsaved") : a.close(e);
2755
2840
  }, g = () => {
2756
- m || (fo(), r && l.sideBySide() && i?.prepare?.());
2757
- }, b = n ? o ? u.editDraftDocumentNamed(t) : u.editDocumentNamed(t) : null, M = o ? u.editDraftDocument : u.editDocument;
2758
- return /* @__PURE__ */ F(Pe, { children: [
2759
- /* @__PURE__ */ F(
2841
+ m || (fo(), r && a.sideBySide() && i?.prepare?.());
2842
+ }, E = n ? o ? u.editDraftDocumentNamed(t) : u.editDocumentNamed(t) : null, k = o ? u.editDraftDocument : u.editDocument;
2843
+ return /* @__PURE__ */ $(Pe, { children: [
2844
+ /* @__PURE__ */ $(
2760
2845
  "button",
2761
2846
  {
2762
2847
  type: "button",
2763
- className: b === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
2764
- title: m ? u.closeEditor : b === null ? M : b,
2765
- "aria-label": b === null ? void 0 : b,
2848
+ className: E === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
2849
+ title: m ? u.closeEditor : E === null ? k : E,
2850
+ "aria-label": E === null ? void 0 : E,
2766
2851
  "aria-pressed": m,
2767
2852
  "data-testid": "markdown-explorer-document-edit",
2768
2853
  onClick: h,
2769
- onDoubleClick: ce,
2854
+ onDoubleClick: de,
2770
2855
  onPointerEnter: g,
2771
2856
  onFocus: g,
2772
2857
  children: [
2773
- /* @__PURE__ */ c(Al, { "aria-hidden": "true" }),
2774
- b === null ? /* @__PURE__ */ c("span", { children: u.editDocumentLabel }) : null
2858
+ /* @__PURE__ */ d(La, { "aria-hidden": "true" }),
2859
+ E === null ? /* @__PURE__ */ d("span", { children: u.editDocumentLabel }) : null
2775
2860
  ]
2776
2861
  }
2777
2862
  ),
2778
- /* @__PURE__ */ c(
2863
+ /* @__PURE__ */ d(
2779
2864
  wn,
2780
2865
  {
2781
2866
  open: f !== null,
@@ -2785,15 +2870,15 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2785
2870
  cancelLabel: u.unsavedStay,
2786
2871
  testId: "markdown-explorer-edit-close-confirm",
2787
2872
  onConfirm: () => {
2788
- d(null), l.close(e);
2873
+ c(null), a.close(e);
2789
2874
  },
2790
- onCancel: () => d(null)
2875
+ onCancel: () => c(null)
2791
2876
  }
2792
2877
  )
2793
2878
  ] });
2794
- }, Hl = ({ href: e, documentName: t, iconOnly: n }) => {
2879
+ }, Ha = ({ href: e, documentName: t, iconOnly: n }) => {
2795
2880
  const { labels: r } = D(), o = n ? r.editExternallyNamed(t) : null;
2796
- return /* @__PURE__ */ F(
2881
+ return /* @__PURE__ */ $(
2797
2882
  "a",
2798
2883
  {
2799
2884
  className: o === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
@@ -2803,126 +2888,126 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2803
2888
  title: o === null ? r.editExternally : o,
2804
2889
  "aria-label": o === null ? void 0 : o,
2805
2890
  "data-testid": "markdown-explorer-document-edit-external",
2806
- onDoubleClick: ce,
2891
+ onDoubleClick: de,
2807
2892
  children: [
2808
- /* @__PURE__ */ c(yl, { "aria-hidden": "true" }),
2809
- o === null ? /* @__PURE__ */ c("span", { children: r.editExternallyLabel }) : null
2893
+ /* @__PURE__ */ d(Sa, { "aria-hidden": "true" }),
2894
+ o === null ? /* @__PURE__ */ d("span", { children: r.editExternallyLabel }) : null
2810
2895
  ]
2811
2896
  }
2812
2897
  );
2813
- }, Vl = ({ session: e }) => {
2898
+ }, Va = ({ session: e }) => {
2814
2899
  const { labels: t } = D(), n = Pr(t, e);
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 });
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 = {
2900
+ return /* @__PURE__ */ d("p", { className: "aqmx-edit-status", title: n === "" ? void 0 : n, "data-testid": "markdown-explorer-edit-status", "data-aqmx-save": e.save.kind, children: n });
2901
+ }, Za = Object.freeze(["editor", "split", "preview"]), Ua = Object.freeze(["editor", "preview"]), Ga = Object.freeze({ editor: $n, split: Da, preview: Ma }), Wa = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
2902
+ const { draftConverter: i, edits: a, labels: u } = D(), m = ao(), f = $a(r, m, o), c = o ? Za : Ua, h = xe(), g = _(/* @__PURE__ */ new Map()), E = {
2818
2903
  editor: { label: u.editViewEditor, tooltip: u.editViewEditorTooltip },
2819
2904
  split: { label: u.editViewSplit, tooltip: u.editViewSplitTooltip },
2820
2905
  preview: { label: u.editViewPreview, tooltip: u.editViewPreviewTooltip }
2821
- }, M = () => {
2822
- l.preparePreview(e), i?.prepare?.();
2823
- }, R = (S) => {
2824
- if (!Il(S.nativeEvent, _l(navigator.platform))) return;
2825
- hn(S);
2826
- const A = ql(f);
2827
- Zt(l, e, A, o), g.current.get(A)?.focus();
2906
+ }, k = () => {
2907
+ a.preparePreview(e), i?.prepare?.();
2908
+ }, R = (T) => {
2909
+ if (!Ia(T.nativeEvent, _a(navigator.platform))) return;
2910
+ hn(T);
2911
+ const A = qa(f);
2912
+ Ut(a, e, A, o), g.current.get(A)?.focus();
2828
2913
  };
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;
2831
- return /* @__PURE__ */ F("label", { className: n ? "aqmx-icon-button" : "aqmx-icon-button aqmx-labelled-button", children: [
2832
- /* @__PURE__ */ c(
2914
+ return /* @__PURE__ */ d("div", { role: "radiogroup", "aria-label": n ? u.editViewNamed(t) : u.editView, className: "aqmx-edit-view", "data-testid": "markdown-explorer-edit-view", onKeyDown: R, children: c.map((T) => {
2915
+ const A = Ga[T], { label: L, tooltip: b } = E[T], w = T === "preview" ? k : void 0;
2916
+ return /* @__PURE__ */ $("label", { className: n ? "aqmx-icon-button" : "aqmx-icon-button aqmx-labelled-button", children: [
2917
+ /* @__PURE__ */ d(
2833
2918
  "input",
2834
2919
  {
2835
- ref: (a) => {
2836
- a === null ? g.current.delete(S) : g.current.set(S, a);
2920
+ ref: (l) => {
2921
+ l === null ? g.current.delete(T) : g.current.set(T, l);
2837
2922
  },
2838
2923
  type: "radio",
2839
2924
  name: h,
2840
- value: S,
2841
- checked: S === f,
2925
+ value: T,
2926
+ checked: T === f,
2842
2927
  "aria-label": L,
2843
- "aria-keyshortcuts": S === "split" ? void 0 : $l,
2844
- title: E,
2845
- "data-testid": `markdown-explorer-edit-view-${S}`,
2846
- onChange: () => Zt(l, e, S, o),
2847
- onDoubleClick: ce,
2848
- onPointerEnter: v,
2849
- onFocus: v
2928
+ "aria-keyshortcuts": T === "split" ? void 0 : Fa,
2929
+ title: b,
2930
+ "data-testid": `markdown-explorer-edit-view-${T}`,
2931
+ onChange: () => Ut(a, e, T, o),
2932
+ onDoubleClick: de,
2933
+ onPointerEnter: w,
2934
+ onFocus: w
2850
2935
  }
2851
2936
  ),
2852
- /* @__PURE__ */ c(A, { "aria-hidden": "true" }),
2853
- n ? null : /* @__PURE__ */ c("span", { children: L })
2854
- ] }, S);
2937
+ /* @__PURE__ */ d(A, { "aria-hidden": "true" }),
2938
+ n ? null : /* @__PURE__ */ d("span", { children: L })
2939
+ ] }, T);
2855
2940
  }) });
2856
- }, Kl = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
2857
- const { edits: i, labels: l } = D(), [u, m] = B(!1);
2941
+ }, Ka = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
2942
+ const { edits: i, labels: a } = D(), [u, m] = z(!1);
2858
2943
  if (r.phase.kind !== "editing") return null;
2859
- const f = r.save.kind === "saving", d = f || !r.dirty, h = () => {
2944
+ const f = r.save.kind === "saving", c = f || !r.dirty, h = () => {
2860
2945
  i.flush(e);
2861
- const b = i.session(e);
2862
- b === void 0 || !b.dirty || b.save.kind === "saving" || i.save(e);
2863
- }, g = (b) => n ? { className: "aqmx-icon-button", "aria-label": b } : { className: "aqmx-icon-button aqmx-labelled-button" };
2864
- return /* @__PURE__ */ F(Pe, { 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: [
2866
- /* @__PURE__ */ c(Sl, { "aria-hidden": "true" }),
2867
- n ? null : /* @__PURE__ */ c("span", { children: l.conflictNext })
2946
+ const E = i.session(e);
2947
+ E === void 0 || !E.dirty || E.save.kind === "saving" || i.save(e);
2948
+ }, g = (E) => n ? { className: "aqmx-icon-button", "aria-label": E } : { className: "aqmx-icon-button aqmx-labelled-button" };
2949
+ return /* @__PURE__ */ $(Pe, { children: [
2950
+ r.save.kind === "conflicts" ? /* @__PURE__ */ $("button", { type: "button", ...g(a.conflictNext), title: a.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => i.nextConflict(e), onDoubleClick: de, children: [
2951
+ /* @__PURE__ */ d(xa, { "aria-hidden": "true" }),
2952
+ n ? null : /* @__PURE__ */ d("span", { children: a.conflictNext })
2868
2953
  ] }) : null,
2869
- /* @__PURE__ */ c(Wl, { path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }),
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" }),
2872
- n ? null : /* @__PURE__ */ c("span", { children: l.historyOpen })
2954
+ /* @__PURE__ */ d(Wa, { path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }),
2955
+ r.history ? /* @__PURE__ */ $("button", { type: "button", ...g(a.historyOpen), title: a.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => m(!0), onDoubleClick: de, children: [
2956
+ /* @__PURE__ */ d(Ta, { "aria-hidden": "true" }),
2957
+ n ? null : /* @__PURE__ */ d("span", { children: a.historyOpen })
2873
2958
  ] }) : null,
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" }),
2876
- n ? null : /* @__PURE__ */ c("span", { children: l.saveDraft })
2959
+ r.save.kind === "draft" ? null : /* @__PURE__ */ $("button", { type: "button", ...g(a.saveDraft), title: a.saveDraftTooltip, "aria-disabled": c, "aria-busy": f, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: h, onDoubleClick: de, children: [
2960
+ /* @__PURE__ */ d(Oa, { "aria-hidden": "true" }),
2961
+ n ? null : /* @__PURE__ */ d("span", { children: a.saveDraft })
2877
2962
  ] }),
2878
- r.history ? /* @__PURE__ */ c(Bl, { path: e, documentName: t, open: u, onClose: () => m(!1) }) : null
2963
+ r.history ? /* @__PURE__ */ d(Ba, { path: e, documentName: t, open: u, onClose: () => m(!1) }) : null
2879
2964
  ] });
2880
- }, Xl = ({ path: e, session: t }) => {
2965
+ }, Xa = ({ path: e, session: t }) => {
2881
2966
  const { edits: n } = D();
2882
- return t.save.kind !== "grant" ? null : /* @__PURE__ */ c(Pl, { href: t.save.href, onRetry: () => {
2967
+ return t.save.kind !== "grant" ? null : /* @__PURE__ */ d(Pa, { href: t.save.href, onRetry: () => {
2883
2968
  n.save(e);
2884
2969
  }, testId: "markdown-explorer-save-grant" });
2885
- }, Yl = (e) => {
2970
+ }, Ya = (e) => {
2886
2971
  const { documents: t } = D(), n = P(() => t.peek(e), [t, e]), r = P(() => t.peekSeeded(e), [t, e]), o = ee(t.subscribe, n, r);
2887
2972
  return ue(o)?.document.kind === "markdown";
2888
- }, Jl = (e) => {
2889
- const { config: t } = D(), n = Fe(), r = P(() => n(ye(t, { ...e, markup: !e.markup }), "browse"), [t, n, e]);
2890
- return G(() => ({ shown: e.markup, toggle: r }), [e.markup, r]);
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);
2973
+ }, Ja = (e) => {
2974
+ const { config: t } = D(), n = $e(), r = P(() => n(Se(t, { ...e, markup: !e.markup }), "browse"), [t, n, e]);
2975
+ return U(() => ({ shown: e.markup, toggle: r }), [e.markup, r]);
2976
+ }, Qa = /* @__PURE__ */ new Set(), el = (e, t) => {
2977
+ const { documents: n, announcer: r, labels: o } = D(), i = P(() => n.peek(e), [n, e]), a = P(() => n.peekSeeded(e), [n, e]), u = ee(n.subscribe, i, a), m = P(() => n.answerStampOf(e), [n, e]), f = ee(n.subscribe, m, m), [c] = z(() => /* @__PURE__ */ new Set()), [h, g] = z(Qa), [E, k] = z(null);
2978
+ E !== null && E.path !== e && k(null);
2894
2979
  const R = _(null);
2895
- H(() => (R.current = e, () => {
2980
+ j(() => (R.current = e, () => {
2896
2981
  R.current = null;
2897
2982
  }), [e]);
2898
- const S = P(() => {
2899
- const E = e, v = n.peek(E);
2900
- if (d.has(E) || v?.status === "pending") return;
2901
- const a = t && !Tn(v);
2902
- d.add(E), g(new Set(d)), M(null), (async () => {
2983
+ const T = P(() => {
2984
+ const b = e, w = n.peek(b);
2985
+ if (c.has(b) || w?.status === "pending") return;
2986
+ const l = t && !Tn(w);
2987
+ c.add(b), g(new Set(c)), k(null), (async () => {
2903
2988
  try {
2904
- const s = await n.refresh(E);
2905
- if (R.current !== E || s.status === "superseded") return;
2989
+ const s = await n.refresh(b);
2990
+ if (R.current !== b || s.status === "superseded") return;
2906
2991
  if (s.status === "failed") {
2907
- M({ path: E, failure: s.failure, stamp: n.answerStampOf(E) }), r.announce(o.documentRefreshFailed(ae(o, s.failure.reason)));
2992
+ k({ path: b, failure: s.failure, stamp: n.answerStampOf(b) }), r.announce(o.documentRefreshFailed(le(o, s.failure.reason)));
2908
2993
  return;
2909
2994
  }
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));
2995
+ const v = ue(n.peek(b));
2996
+ if (l || v === null || v.document.kind === "failure") return;
2997
+ r.announce(o.documentRefreshed(v.document.name));
2913
2998
  } finally {
2914
- d.delete(E), g(new Set(d));
2999
+ c.delete(b), g(new Set(c));
2915
3000
  }
2916
3001
  })();
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;
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: [
2922
- /* @__PURE__ */ F("div", { className: "aqmx-document-refresh-row", children: [
2923
- d === void 0 ? null : /* @__PURE__ */ c(Vl, { session: d }),
2924
- d === void 0 ? null : /* @__PURE__ */ c(Kl, { path: e, documentName: M, iconOnly: b, session: d, previewAvailable: R }),
2925
- d === void 0 && m ? /* @__PURE__ */ F(
3002
+ }, [e, t, c, n, r, o]), A = h.has(e), L = E !== null && E.path === e && E.stamp === f ? E.failure : null;
3003
+ return { refreshing: A, unavailable: A || u?.status === "pending", failure: L, refresh: T };
3004
+ }, tl = Object.freeze({ kind: "page" }), nl = ({ path: e, placement: t, markup: n }) => {
3005
+ const { labels: r } = D(), { refreshing: o, unavailable: i, failure: a, refresh: u } = el(e, t.kind === "page"), m = Ya(e), f = za(e), c = bn(e), h = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, g = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, E = t.kind === "panel", k = t.kind === "panel" ? t.documentName : f.name, R = t.kind === "page" || t.maximized;
3006
+ return /* @__PURE__ */ $("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", "data-aqmx-editing": c === void 0 ? void 0 : "true", children: [
3007
+ /* @__PURE__ */ $("div", { className: "aqmx-document-refresh-row", children: [
3008
+ c === void 0 ? null : /* @__PURE__ */ d(Va, { session: c }),
3009
+ c === void 0 ? null : /* @__PURE__ */ d(Ka, { path: e, documentName: k, iconOnly: E, session: c, previewAvailable: R }),
3010
+ c === void 0 && m ? /* @__PURE__ */ $(
2926
3011
  "button",
2927
3012
  {
2928
3013
  type: "button",
@@ -2932,15 +3017,15 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2932
3017
  "aria-pressed": n.shown,
2933
3018
  "data-testid": "markdown-explorer-document-markup",
2934
3019
  onClick: n.toggle,
2935
- onDoubleClick: ce,
3020
+ onDoubleClick: de,
2936
3021
  children: [
2937
- /* @__PURE__ */ c(Fn, { "aria-hidden": "true" }),
2938
- g === null ? /* @__PURE__ */ c("span", { children: r.showMarkupLabel }) : null
3022
+ /* @__PURE__ */ d($n, { "aria-hidden": "true" }),
3023
+ g === null ? /* @__PURE__ */ d("span", { children: r.showMarkupLabel }) : null
2939
3024
  ]
2940
3025
  }
2941
3026
  ) : 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,
2943
- d === void 0 ? /* @__PURE__ */ F(
3027
+ c !== void 0 || f.edit?.kind === "inline" || f.edit?.kind === "draft" ? /* @__PURE__ */ d(ja, { path: e, documentName: k, iconOnly: E, previewAvailable: R, draft: f.edit?.kind === "draft" }) : f.edit?.kind === "external" ? /* @__PURE__ */ d(Ha, { href: f.edit.href, documentName: k, iconOnly: E }) : null,
3028
+ c === void 0 ? /* @__PURE__ */ $(
2944
3029
  "button",
2945
3030
  {
2946
3031
  type: "button",
@@ -2952,126 +3037,126 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
2952
3037
  "data-aqmx-busy": o ? "true" : void 0,
2953
3038
  "data-testid": "markdown-explorer-document-refresh",
2954
3039
  onClick: u,
2955
- onDoubleClick: ce,
3040
+ onDoubleClick: de,
2956
3041
  children: [
2957
- /* @__PURE__ */ c(gl, { "aria-hidden": "true" }),
2958
- h === null ? /* @__PURE__ */ c("span", { children: r.refreshDocumentLabel }) : null
3042
+ /* @__PURE__ */ d(ga, { "aria-hidden": "true" }),
3043
+ h === null ? /* @__PURE__ */ d("span", { children: r.refreshDocumentLabel }) : null
2959
3044
  ]
2960
3045
  }
2961
3046
  ) : null
2962
3047
  ] }),
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)) }),
2964
- d === void 0 ? null : /* @__PURE__ */ c(Xl, { path: e, session: d })
3048
+ c !== void 0 || a === null ? null : /* @__PURE__ */ d("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": a.reason, children: r.documentRefreshFailed(le(r, a.reason)) }),
3049
+ c === void 0 ? null : /* @__PURE__ */ d(Xa, { path: e, session: c })
2965
3050
  ] });
2966
- }, ra = ({ location: e }) => {
2967
- const t = e.doc, n = G(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), r = Jl(e);
2968
- return /* @__PURE__ */ F("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", ...et, children: [
2969
- /* @__PURE__ */ c(na, { path: t, placement: ta, markup: r }),
2970
- /* @__PURE__ */ c(vl, { path: t, absence: Qi, markup: e.markup, variant: n })
3051
+ }, rl = ({ location: e }) => {
3052
+ const t = e.doc, n = U(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), r = Ja(e);
3053
+ return /* @__PURE__ */ $("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", ...et, children: [
3054
+ /* @__PURE__ */ d(nl, { path: t, placement: tl, markup: r }),
3055
+ /* @__PURE__ */ d(va, { path: t, absence: Qi, markup: e.markup, variant: n })
2971
3056
  ] });
2972
- }, oa = ({ holds: e, testId: t }) => {
2973
- const { labels: n, announcer: r } = D(), o = Se();
2974
- H(() => e ? r.claim(o) : void 0, [e, r, o]);
2975
- const i = P(() => r.shownIn(o), [r, o]), l = ee(r.subscribe, i, i);
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] });
2977
- }, fe = Object.freeze([]), ia = (e) => {
3057
+ }, ol = ({ holds: e, testId: t }) => {
3058
+ const { labels: n, announcer: r } = D(), o = xe();
3059
+ j(() => e ? r.claim(o) : void 0, [e, r, o]);
3060
+ const i = P(() => r.shownIn(o), [r, o]), a = ee(r.subscribe, i, i);
3061
+ return /* @__PURE__ */ d("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: a.length > 1 ? n.announcementSequence(a) : a[0] });
3062
+ }, fe = Object.freeze([]), il = (e) => {
2978
3063
  const t = /* @__PURE__ */ new Set();
2979
3064
  let n = fe, r = [], o = !1;
2980
- const i = [], l = (d) => {
2981
- n = d;
3065
+ const i = [], a = (c) => {
3066
+ n = c;
2982
3067
  for (const h of [...t]) h();
2983
- }, u = () => i.at(-1)?.region, m = (d) => {
3068
+ }, u = () => i.at(-1)?.region, m = (c) => {
2984
3069
  const h = u();
2985
- d(), u() !== h && n !== fe && l(fe);
3070
+ c(), u() !== h && n !== fe && a(fe);
2986
3071
  }, f = () => {
2987
3072
  o = !1;
2988
- const d = r.map((h) => "sentence" in h ? h.sentence : h.list(h.items));
2989
- r = [], l(Object.freeze(d));
3073
+ const c = r.map((h) => "sentence" in h ? h.sentence : h.list(h.items));
3074
+ r = [], a(Object.freeze(c));
2990
3075
  };
2991
3076
  return {
2992
- announce: (d) => {
2993
- if (typeof d == "string") r.push({ sentence: d });
3077
+ announce: (c) => {
3078
+ if (typeof c == "string") r.push({ sentence: c });
2994
3079
  else {
2995
- const h = r.find((g) => "list" in g && g.list === d.list);
2996
- h !== void 0 && "items" in h ? h.items.push(d.item) : r.push({ list: d.list, items: [d.item] });
3080
+ const h = r.find((g) => "list" in g && g.list === c.list);
3081
+ h !== void 0 && "items" in h ? h.items.push(c.item) : r.push({ list: c.list, items: [c.item] });
2997
3082
  }
2998
- o || (o = !0, n !== fe && l(fe), e.request(f));
3083
+ o || (o = !0, n !== fe && a(fe), e.request(f));
2999
3084
  },
3000
- subscribe: (d) => (t.add(d), () => {
3001
- t.delete(d);
3085
+ subscribe: (c) => (t.add(c), () => {
3086
+ t.delete(c);
3002
3087
  }),
3003
- claim: (d) => {
3004
- const h = { region: d };
3088
+ claim: (c) => {
3089
+ const h = { region: c };
3005
3090
  return m(() => i.push(h)), () => m(() => {
3006
3091
  const g = i.indexOf(h);
3007
3092
  g !== -1 && i.splice(g, 1);
3008
3093
  });
3009
3094
  },
3010
- shownIn: (d) => u() === d ? n : fe
3095
+ shownIn: (c) => u() === c ? n : fe
3011
3096
  };
3012
- }, ge = Object.freeze({ status: "cancelled" }), la = (e) => {
3097
+ }, ge = Object.freeze({ status: "cancelled" }), al = (e) => {
3013
3098
  if (e === null || typeof e != "object") return null;
3014
3099
  const { failure: t } = e;
3015
3100
  if (sr(t) !== null) return null;
3016
3101
  const { reason: n, code: r } = t;
3017
- return cr(n, r);
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) => {
3020
- let b;
3102
+ return dr(n, r);
3103
+ }, ll = ({ dataPath: e, onScope: t, fetch: n }) => {
3104
+ const r = n ?? ((f, c) => globalThis.fetch(f, c)), o = (f, c) => `${e}/${f}?${new URLSearchParams(c).toString()}`, i = async (f, c, h, g) => {
3105
+ let E;
3021
3106
  try {
3022
- b = await r(f, { credentials: "same-origin", ...d, headers: { Accept: "application/json", ...d.headers } });
3107
+ E = await r(f, { credentials: "same-origin", ...c, headers: { Accept: "application/json", ...c.headers } });
3023
3108
  } catch {
3024
3109
  return g({ reason: "failed" });
3025
3110
  }
3026
- b.status === 401 && t(null);
3027
- const M = b.headers.get(rr);
3028
- M !== null && t(M);
3111
+ E.status === 401 && t(null);
3112
+ const k = E.headers.get(rr);
3113
+ k !== null && t(k);
3029
3114
  let R;
3030
3115
  try {
3031
- R = await b.json();
3116
+ R = await E.json();
3032
3117
  } catch {
3033
- return g({ reason: Et(b.status) });
3118
+ return g({ reason: Et(E.status) });
3034
3119
  }
3035
- let S;
3120
+ let T;
3036
3121
  try {
3037
- S = h(R);
3122
+ T = h(R);
3038
3123
  } catch {
3039
- S = !1;
3124
+ T = !1;
3040
3125
  }
3041
- if (S) return R;
3042
- const A = la(R);
3043
- return g(A !== null ? A : { reason: b.status === 200 ? "failed" : Et(b.status) });
3044
- }, l = { [xt]: dr }, u = { [xt]: pr, "Content-Type": `${hr}; charset=utf-8` }, m = async (f, d, h) => {
3045
- const g = await i(f, d, h, (b) => Ve(b.reason, b.code));
3046
- return d.signal.aborted ? ge : g;
3126
+ if (T) return R;
3127
+ const A = al(R);
3128
+ return g(A !== null ? A : { reason: E.status === 200 ? "failed" : Et(E.status) });
3129
+ }, a = { [yt]: cr }, u = { [yt]: pr, "Content-Type": `${hr}; charset=utf-8` }, m = async (f, c, h) => {
3130
+ const g = await i(f, c, h, (E) => Ve(E.reason, E.code));
3131
+ return c.signal.aborted ? ge : g;
3047
3132
  };
3048
3133
  return {
3049
- tree: (f) => i(o("tree", { [J.source]: f }), { method: "GET" }, yt, (d) => ({ status: "error", failure: d })),
3050
- children: async (f, d, h) => {
3051
- const g = await i(o("children", { [J.source]: f, [J.path]: d }), { method: "GET", signal: h }, ar, (b) => ({ status: "error", failure: b }));
3134
+ tree: (f) => i(o("tree", { [Y.source]: f }), { method: "GET" }, St, (c) => ({ status: "error", failure: c })),
3135
+ children: async (f, c, h) => {
3136
+ const g = await i(o("children", { [Y.source]: f, [Y.path]: c }), { method: "GET", signal: h }, lr, (E) => ({ status: "error", failure: E }));
3052
3137
  return h.aborted ? ge : g;
3053
3138
  },
3054
- ancestors: async (f, d, h) => {
3055
- const g = await i(o("ancestors", { [J.source]: f, [J.path]: d }), { method: "GET", signal: h }, lr, (b) => ({ status: "error", failure: b }));
3139
+ ancestors: async (f, c, h) => {
3140
+ const g = await i(o("ancestors", { [Y.source]: f, [Y.path]: c }), { method: "GET", signal: h }, ar, (E) => ({ status: "error", failure: E }));
3056
3141
  return h.aborted ? ge : g;
3057
3142
  },
3058
- reveal: async (f, d, h) => {
3059
- const g = await i(o("reveal", { [J.source]: f, [J.path]: d }), { method: "GET", signal: h }, ir, (b) => ({ status: "error", failure: b }));
3143
+ reveal: async (f, c, h) => {
3144
+ const g = await i(o("reveal", { [Y.source]: f, [Y.path]: c }), { method: "GET", signal: h }, ir, (E) => ({ status: "error", failure: E }));
3060
3145
  return h.aborted ? ge : g;
3061
3146
  },
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)),
3063
- text: async (f, d) => {
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;
3147
+ document: (f, { refresh: c }) => i(o("document", { [Y.path]: f }), c ? { method: "GET", headers: a } : { method: "GET" }, gr, (h) => Ve(h.reason, h.code)),
3148
+ text: async (f, c) => {
3149
+ const h = await i(o("text", { [Y.path]: f }), { method: "GET", signal: c }, or, (g) => Ve(g.reason, g.code));
3150
+ return c.aborted ? ge : h;
3066
3151
  },
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),
3069
- preview: (f, d, h) => m(o("preview", { [J.path]: f }), { method: "POST", headers: u, body: d, signal: h }, mr),
3070
- revisions: (f, d) => m(o("revisions", { [J.path]: f }), { method: "GET", signal: d }, fr),
3071
- revision: (f, d, h) => m(o("revision", { [J.path]: f, [J.revision]: d }), { method: "GET", signal: h }, ur),
3072
- refresh: (f) => i(o("refresh", { [J.source]: f }), { method: "POST", headers: l }, yt, (d) => ({ status: "error", failure: d }))
3152
+ edit: (f, c) => m(o("edit", { [Y.path]: f }), { method: "GET", signal: c }, wr),
3153
+ save: (f, c, h, g) => m(o("save", { [Y.path]: f, [Y.base]: c }), { method: "POST", headers: u, body: h, signal: g }, vr),
3154
+ preview: (f, c, h) => m(o("preview", { [Y.path]: f }), { method: "POST", headers: u, body: c, signal: h }, mr),
3155
+ revisions: (f, c) => m(o("revisions", { [Y.path]: f }), { method: "GET", signal: c }, fr),
3156
+ revision: (f, c, h) => m(o("revision", { [Y.path]: f, [Y.revision]: c }), { method: "GET", signal: h }, ur),
3157
+ refresh: (f) => i(o("refresh", { [Y.source]: f }), { method: "POST", headers: a }, St, (c) => ({ status: "error", failure: c }))
3073
3158
  };
3074
- }, sa = () => {
3159
+ }, sl = () => {
3075
3160
  let e = null, t = null;
3076
3161
  return {
3077
3162
  settle: (n) => {
@@ -3086,7 +3171,7 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3086
3171
  return t = null, o;
3087
3172
  }
3088
3173
  };
3089
- }, ca = (e) => {
3174
+ }, dl = (e) => {
3090
3175
  const t = Qe(e);
3091
3176
  if (t === null) return bt;
3092
3177
  try {
@@ -3098,11 +3183,11 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3098
3183
  let n = null;
3099
3184
  const r = () => {
3100
3185
  if (n === null) {
3101
- const i = ca(e);
3186
+ const i = dl(e);
3102
3187
  n = { changes: i, settings: gt(t, i) };
3103
3188
  }
3104
3189
  return n;
3105
- }, o = Me();
3190
+ }, o = Oe();
3106
3191
  return {
3107
3192
  storageKey: e,
3108
3193
  defaults: t,
@@ -3110,209 +3195,209 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3110
3195
  getServerSnapshot: () => t,
3111
3196
  subscribe: o.subscribe,
3112
3197
  advance: (i) => {
3113
- const { changes: l, settings: u } = r(), m = Kn(l, i, Xn(u, i)[i], t);
3198
+ const { changes: a, settings: u } = r(), m = Kn(a, i, Xn(u, i)[i], t);
3114
3199
  return n = { changes: m, settings: gt(t, m) }, o.emit(), Je(e, Yn(m)), n.settings;
3115
3200
  }
3116
3201
  };
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();
3119
- let f = 0, d = 0;
3202
+ }, cl = Object.freeze({ status: "refreshed" }), ul = Object.freeze({ status: "superseded" }), ot = Object.freeze({ status: "deferred" }), fl = gn(ot), qn = 4, ml = qn - 1, Kt = Object.freeze({ status: "loading" }), hl = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), pl = (e) => {
3203
+ const t = /* @__PURE__ */ new Map(), n = kn(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), u = Oe(), m = /* @__PURE__ */ new Set();
3204
+ let f = 0, c = 0;
3120
3205
  const h = { direct: null, bulk: null }, g = /* @__PURE__ */ new Set();
3121
- let b = !1, M = 0;
3206
+ let E = !1, k = 0;
3122
3207
  const R = () => {
3123
- M += 1, u.emit();
3124
- }, S = (p) => o.get(p) ?? 0, A = (p) => {
3125
- let x = l.get(p);
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;
3127
- }, L = (p, x, k) => {
3128
- p.inFlight.delete(x), f -= 1, k.lane === "bulk" && (d -= 1);
3129
- }, E = (p) => {
3130
- const x = l.get(p);
3131
- if (x !== void 0) {
3132
- for (const [k, O] of [...x.inFlight])
3133
- L(x, k, O), O.controller.abort();
3134
- x.direct.clear(), x.bulk.clear(), x.unclaimed.clear();
3208
+ k += 1, u.emit();
3209
+ }, T = (p) => o.get(p) ?? 0, A = (p) => {
3210
+ let S = a.get(p);
3211
+ return S === void 0 && (S = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, a.set(p, S)), S;
3212
+ }, L = (p, S, x) => {
3213
+ p.inFlight.delete(S), f -= 1, x.lane === "bulk" && (c -= 1);
3214
+ }, b = (p) => {
3215
+ const S = a.get(p);
3216
+ if (S !== void 0) {
3217
+ for (const [x, C] of [...S.inFlight])
3218
+ L(S, x, C), C.controller.abort();
3219
+ S.direct.clear(), S.bulk.clear(), S.unclaimed.clear();
3135
3220
  }
3136
- }, v = (p) => {
3137
- const x = S(p) + 1;
3138
- return o.set(p, x), E(p), x;
3139
- }, a = (p, x) => {
3140
- const k = Ee(p), O = { promise: p, opened: x, stale: !1, loadedAt: k?.status === "ok" ? k.loadedAt : null };
3141
- return p.status === "pending" && p.then(($) => {
3142
- $.status === "ok" && (O.loadedAt = $.loadedAt);
3143
- }), O;
3144
- }, s = (p) => {
3145
- let x = r.get(p);
3146
- return x === void 0 && (x = /* @__PURE__ */ new Map(), r.set(p, x)), x;
3147
3221
  }, w = (p) => {
3148
- const x = [...l.keys()], k = h[p], O = k === null ? 0 : x.indexOf(k) + 1;
3149
- for (let $ = 0; $ < x.length; $ += 1) {
3150
- const I = x[(O + $) % x.length], K = I === void 0 ? void 0 : l.get(I);
3151
- if (!(I === void 0 || K === void 0)) {
3152
- for (const U of K[p])
3153
- if ((K.claims.get(U) ?? 0) !== 0)
3154
- return K[p].delete(U), h[p] = I, { sourceId: I, path: U };
3222
+ const S = T(p) + 1;
3223
+ return o.set(p, S), b(p), S;
3224
+ }, l = (p, S) => {
3225
+ const x = Ee(p), C = { promise: p, opened: S, stale: !1, loadedAt: x?.status === "ok" ? x.loadedAt : null };
3226
+ return p.status === "pending" && p.then((F) => {
3227
+ F.status === "ok" && (C.loadedAt = F.loadedAt);
3228
+ }), C;
3229
+ }, s = (p) => {
3230
+ let S = r.get(p);
3231
+ return S === void 0 && (S = /* @__PURE__ */ new Map(), r.set(p, S)), S;
3232
+ }, v = (p) => {
3233
+ const S = [...a.keys()], x = h[p], C = x === null ? 0 : S.indexOf(x) + 1;
3234
+ for (let F = 0; F < S.length; F += 1) {
3235
+ const B = S[(C + F) % S.length], K = B === void 0 ? void 0 : a.get(B);
3236
+ if (!(B === void 0 || K === void 0)) {
3237
+ for (const V of K[p])
3238
+ if ((K.claims.get(V) ?? 0) !== 0)
3239
+ return K[p].delete(V), h[p] = B, { sourceId: B, path: V };
3155
3240
  }
3156
3241
  }
3157
3242
  return null;
3158
- }, T = (p, x, k, O) => {
3159
- const $ = l.get(p);
3160
- if ($ === void 0 || $.inFlight.get(x) !== k) return;
3161
- L($, x, k);
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 };
3165
- for (const ie of [...m]) ie(U);
3243
+ }, O = (p, S, x, C) => {
3244
+ const F = a.get(p);
3245
+ if (F === void 0 || F.inFlight.get(S) !== x) return;
3246
+ L(F, S, x);
3247
+ const B = (F.claims.get(S) ?? 0) > 0, K = s(p);
3248
+ if (C.status === "ok" ? K.set(S, { status: "loaded", entries: C.entries }) : C.status === "error" && B ? K.set(S, { status: "failed", failure: C.failure }) : K.delete(S), R(), C.status === "error" && B) {
3249
+ const V = { sourceId: p, path: S, failure: C.failure };
3250
+ for (const ie of [...m]) ie(V);
3166
3251
  }
3167
3252
  N();
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)
3253
+ }, M = (p, S, x) => {
3254
+ const C = { controller: new AbortController(), lane: x };
3255
+ A(p).inFlight.set(S, C), f += 1, x === "bulk" && (c += 1), e.children(p, S, C.controller.signal).then(
3256
+ (F) => O(p, S, C, F),
3257
+ () => O(p, S, C, hl)
3173
3258
  );
3174
3259
  }, N = () => {
3175
3260
  for (; f < qn; ) {
3176
- const p = w("direct");
3261
+ const p = v("direct");
3177
3262
  if (p !== null) {
3178
- C(p.sourceId, p.path, "direct");
3263
+ M(p.sourceId, p.path, "direct");
3179
3264
  continue;
3180
3265
  }
3181
- const x = d < ma ? w("bulk") : null;
3182
- if (x === null) return;
3183
- C(x.sourceId, x.path, "bulk");
3266
+ const S = c < ml ? v("bulk") : null;
3267
+ if (S === null) return;
3268
+ M(S.sourceId, S.path, "bulk");
3184
3269
  }
3185
- }, q = (p, x, k) => {
3186
- if (!(x.direct.delete(k) || x.bulk.delete(k))) {
3187
- const $ = x.inFlight.get(k);
3188
- if ($ === void 0) return !1;
3189
- L(x, k, $), $.controller.abort();
3270
+ }, q = (p, S, x) => {
3271
+ if (!(S.direct.delete(x) || S.bulk.delete(x))) {
3272
+ const F = S.inFlight.get(x);
3273
+ if (F === void 0) return !1;
3274
+ L(S, x, F), F.controller.abort();
3190
3275
  }
3191
- return r.get(p)?.delete(k), !0;
3276
+ return r.get(p)?.delete(x), !0;
3192
3277
  }, W = () => {
3193
- b = !1;
3278
+ E = !1;
3194
3279
  let p = !1;
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);
3199
- k.unclaimed.clear();
3280
+ for (const S of g) {
3281
+ const x = A(S);
3282
+ for (const C of x.unclaimed)
3283
+ (x.claims.get(C) ?? 0) === 0 && q(S, x, C) && (p = !0);
3284
+ x.unclaimed.clear();
3200
3285
  }
3201
3286
  g.clear(), p && (R(), N());
3202
- }, z = (p, x) => {
3203
- t.set(p, a(Te(e.tree(p)), x));
3204
- }, j = (p, x, k) => {
3205
- v(p);
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) => {
3209
- if (k !== S(p) || t.get(p) !== x) return;
3210
- const $ = Ee(x.promise);
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;
3287
+ }, G = (p, S) => {
3288
+ t.set(p, l(Te(e.tree(p)), S));
3289
+ }, I = (p, S, x) => {
3290
+ w(p);
3291
+ const C = l(gn(S), x);
3292
+ return t.set(p, C), r.delete(p), R(), N(), C;
3293
+ }, J = (p, S, x, C) => {
3294
+ if (x !== T(p) || t.get(p) !== S) return;
3295
+ const F = Ee(S.promise);
3296
+ if (!(C.status !== "ok" || F?.status !== "ok" || S.loadedAt === null || C.loadedAt <= S.loadedAt)) {
3297
+ if (De(F.entries, C.entries)) {
3298
+ S.loadedAt = C.loadedAt;
3214
3299
  return;
3215
3300
  }
3216
- j(p, O, x.opened);
3301
+ I(p, C, S.opened);
3217
3302
  }
3218
- }, V = (p, x) => {
3219
- const k = t.get(p);
3220
- return k !== void 0 && Ee(k.promise)?.status === x;
3221
- }, re = (p, x) => {
3222
- x.stale = !1;
3223
- const k = S(p);
3224
- e.tree(p).then((O) => Y(p, x, k, O));
3303
+ }, H = (p, S) => {
3304
+ const x = t.get(p);
3305
+ return x !== void 0 && Ee(x.promise)?.status === S;
3306
+ }, ne = (p, S) => {
3307
+ S.stale = !1;
3308
+ const x = T(p);
3309
+ e.tree(p).then((C) => J(p, S, x, C));
3225
3310
  };
3226
3311
  return {
3227
- read: (p) => t.get(p)?.promise ?? fa,
3312
+ read: (p) => t.get(p)?.promise ?? fl,
3228
3313
  open: (p) => {
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;
3314
+ const S = n.resumes(p), x = n.hold(p), C = t.get(p);
3315
+ return C === void 0 || H(p, "deferred") ? (G(p, !0), R()) : S || (C.opened && H(p, "error") ? (G(p, !0), R()) : (C.opened = !0, C.stale && H(p, "ok") && ne(p, C))), x;
3231
3316
  },
3232
3317
  retry: (p) => {
3233
- V(p, "error") && (z(p, !0), R());
3318
+ H(p, "error") && (G(p, !0), R());
3234
3319
  },
3235
- seed: (p, x) => {
3236
- const k = x.then(
3237
- (I) => I === null ? ot : I,
3320
+ seed: (p, S) => {
3321
+ const x = S.then(
3322
+ (B) => B === null ? ot : B,
3238
3323
  () => ot
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));
3324
+ ), C = t.get(p);
3325
+ if (C !== void 0 && H(p, "ok")) {
3326
+ const B = T(p);
3327
+ x.then((K) => J(p, C, B, K));
3243
3328
  return;
3244
3329
  }
3245
- v(p);
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());
3330
+ w(p);
3331
+ const F = l(Te(x), C?.opened === !0);
3332
+ t.set(p, F), r.delete(p), N(), x.then((B) => {
3333
+ t.get(p) === F && (B.status === "deferred" && n.isHeld(p) && G(p, F.opened), R());
3249
3334
  });
3250
3335
  },
3251
3336
  refresh: async (p) => {
3252
- const x = (i.get(p) ?? 0) + 1;
3253
- i.set(p, x);
3254
- const k = await e.refresh(p);
3255
- if (i.get(p) !== x) return ua;
3256
- if (k.status === "error") return { status: "failed", failure: k.failure };
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") {
3261
- const K = S(p);
3262
- O.promise.then((U) => Y(p, I, K, U));
3337
+ const S = (i.get(p) ?? 0) + 1;
3338
+ i.set(p, S);
3339
+ const x = await e.refresh(p);
3340
+ if (i.get(p) !== S) return ul;
3341
+ if (x.status === "error") return { status: "failed", failure: x.failure };
3342
+ const C = t.get(p);
3343
+ if (!(C !== void 0 && C.loadedAt !== null && H(p, "ok") && C.loadedAt > x.loadedAt)) {
3344
+ const B = I(p, x, !0);
3345
+ if (C !== void 0 && C.promise.status === "pending") {
3346
+ const K = T(p);
3347
+ C.promise.then((V) => J(p, B, K, V));
3263
3348
  }
3264
3349
  }
3265
- for (const [I, K] of t)
3266
- I !== p && Ee(K.promise)?.status === "ok" && (K.stale = !0);
3267
- return da;
3350
+ for (const [B, K] of t)
3351
+ B !== p && Ee(K.promise)?.status === "ok" && (K.stale = !0);
3352
+ return cl;
3268
3353
  },
3269
- children: (p, x) => r.get(p)?.get(x),
3270
- claimChildren: (p, x) => {
3271
- const k = A(p), O = s(p);
3272
- let $ = !1, I = !1;
3273
- for (const [U, ie] of x)
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();
3354
+ children: (p, S) => r.get(p)?.get(S),
3355
+ claimChildren: (p, S) => {
3356
+ const x = A(p), C = s(p);
3357
+ let F = !1, B = !1;
3358
+ for (const [V, ie] of S)
3359
+ x.claims.set(V, (x.claims.get(V) ?? 0) + 1), C.get(V) === void 0 ? (C.set(V, Kt), x[ie].add(V), F = !0, B = !0) : ie === "direct" && x.bulk.delete(V) && (x.direct.add(V), B = !0);
3360
+ F && R(), B && N();
3276
3361
  let K = !1;
3277
3362
  return () => {
3278
3363
  if (!K) {
3279
3364
  K = !0;
3280
- for (const U of x.keys()) {
3281
- const ie = (k.claims.get(U) ?? 0) - 1;
3282
- ie > 0 ? k.claims.set(U, ie) : (k.claims.delete(U), k.unclaimed.add(U));
3365
+ for (const V of S.keys()) {
3366
+ const ie = (x.claims.get(V) ?? 0) - 1;
3367
+ ie > 0 ? x.claims.set(V, ie) : (x.claims.delete(V), x.unclaimed.add(V));
3283
3368
  }
3284
- g.add(p), !b && (b = !0, queueMicrotask(W));
3369
+ g.add(p), !E && (E = !0, queueMicrotask(W));
3285
3370
  }
3286
3371
  };
3287
3372
  },
3288
- retryChildren: (p, x) => {
3289
- const k = r.get(p);
3290
- if (k === void 0 || k.get(x)?.status !== "failed") return;
3291
- const O = A(p);
3292
- if ((O.claims.get(x) ?? 0) > 0) {
3293
- k.set(x, Kt), O.direct.add(x), R(), N();
3373
+ retryChildren: (p, S) => {
3374
+ const x = r.get(p);
3375
+ if (x === void 0 || x.get(S)?.status !== "failed") return;
3376
+ const C = A(p);
3377
+ if ((C.claims.get(S) ?? 0) > 0) {
3378
+ x.set(S, Kt), C.direct.add(S), R(), N();
3294
3379
  return;
3295
3380
  }
3296
- k.delete(x), R();
3381
+ x.delete(S), R();
3297
3382
  },
3298
3383
  pendingChildren: (p) => {
3299
- const x = l.get(p);
3300
- return x === void 0 ? 0 : x.direct.size + x.bulk.size + x.inFlight.size;
3384
+ const S = a.get(p);
3385
+ return S === void 0 ? 0 : S.direct.size + S.bulk.size + S.inFlight.size;
3301
3386
  },
3302
3387
  clear: () => {
3303
- for (const p of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...l.keys()])) v(p);
3304
- for (const [p, x] of i) i.set(p, x + 1);
3388
+ for (const p of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...a.keys()])) w(p);
3389
+ for (const [p, S] of i) i.set(p, S + 1);
3305
3390
  t.clear(), r.clear(), R();
3306
3391
  },
3307
3392
  subscribeChildrenFailures: (p) => (m.add(p), () => {
3308
3393
  m.delete(p);
3309
3394
  }),
3310
3395
  subscribe: u.subscribe,
3311
- version: () => M
3396
+ version: () => k
3312
3397
  };
3313
- }, va = (e, t) => {
3398
+ }, vl = (e, t) => {
3314
3399
  let n = e;
3315
- const r = Me();
3400
+ const r = Oe();
3316
3401
  return {
3317
3402
  getSnapshot: () => n,
3318
3403
  subscribe: r.subscribe,
@@ -3320,80 +3405,80 @@ const Dl = /* @__PURE__ */ y.forwardRef(Nl), Pl = ({ href: e, onRetry: t, testId
3320
3405
  n = { ...n, ...o }, t(n), r.emit();
3321
3406
  }
3322
3407
  };
3323
- }, wa = 1;
3324
- let Oe = 0, de = null;
3325
- const ga = () => {
3408
+ }, wl = 1;
3409
+ let Ce = 0, ce = null;
3410
+ const gl = () => {
3326
3411
  const { documentElement: e, body: t } = document;
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;
3412
+ Ce === 0 && (ce = { 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;
3328
3413
  let n = !1;
3329
3414
  return () => {
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));
3415
+ n || (n = !0, Ce -= 1, !(Ce > 0 || ce === null) && (e.style.overflow = ce.htmlOverflow, t.style.overflow = ce.bodyOverflow, e.style.scrollbarGutter = ce.htmlGutter, t.style.scrollbarGutter = ce.bodyGutter, ce = null));
3331
3416
  };
3332
- }, ba = [
3417
+ }, bl = [
3333
3418
  { selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
3334
3419
  { selector: "[data-aqmx-explorer-body]", name: "tree area" }
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) => {
3420
+ ], Xt = 1, El = 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.", Sl = (e) => {
3336
3421
  if (!Yt(e)) return null;
3337
3422
  const t = e.getBoundingClientRect(), n = window.innerHeight;
3338
- if (t.bottom > n + wa)
3423
+ if (t.bottom > n + wl)
3339
3424
  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}`;
3340
3425
  if (t.height < Xt)
3341
3426
  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}`;
3342
- for (const { selector: r, name: o } of ba)
3427
+ for (const { selector: r, name: o } of bl)
3343
3428
  for (const i of e.querySelectorAll(r)) {
3344
3429
  if (!Yt(i)) continue;
3345
- const l = i.getBoundingClientRect().height;
3346
- if (l < Xt)
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}`;
3430
+ const a = i.getBoundingClientRect().height;
3431
+ if (a < Xt)
3432
+ return `[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(a))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Ke}`;
3348
3433
  }
3349
3434
  return null;
3350
- }, xa = (e) => {
3435
+ }, yl = (e) => {
3351
3436
  let t = !1, n;
3352
3437
  const r = () => {
3353
3438
  n = void 0;
3354
- const l = ya(e);
3355
- l !== null && (t = !0, console.error(l));
3439
+ const a = Sl(e);
3440
+ a !== null && (t = !0, console.error(a));
3356
3441
  }, o = () => {
3357
- t || (clearTimeout(n), n = setTimeout(r, Ea));
3442
+ t || (clearTimeout(n), n = setTimeout(r, El));
3358
3443
  }, i = typeof ResizeObserver > "u" ? null : new ResizeObserver(o);
3359
3444
  return i?.observe(e), window.addEventListener("resize", o), o(), () => {
3360
3445
  clearTimeout(n), i?.disconnect(), window.removeEventListener("resize", o);
3361
3446
  };
3362
- }, Sa = (e, t) => {
3363
- te(() => e ? ga() : void 0, [e]), te(() => {
3447
+ }, xl = (e, t) => {
3448
+ te(() => e ? gl() : void 0, [e]), te(() => {
3364
3449
  const n = t.current;
3365
3450
  if (!(!e || n === null))
3366
- return xa(n);
3451
+ return yl(n);
3367
3452
  }, [e, t]);
3368
- }, Jt = '[data-testid="markdown-explorer-view-switch"]', ka = [
3453
+ }, Jt = '[data-testid="markdown-explorer-view-switch"]', kl = [
3369
3454
  { control: Jt, successors: [Jt, '[data-testid="markdown-explorer-sheet-toggle"]'] },
3370
3455
  { control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
3371
- ], Ta = (e) => {
3372
- for (const t of ka) {
3456
+ ], Tl = (e) => {
3457
+ for (const t of kl) {
3373
3458
  const n = e.closest(t.control);
3374
3459
  if (n !== null) return { element: n, control: t };
3375
3460
  }
3376
3461
  return null;
3377
- }, Ra = (e, t) => {
3462
+ }, Rl = (e, t) => {
3378
3463
  const n = _(null);
3379
3464
  te(() => {
3380
3465
  const o = (u) => {
3381
3466
  const m = e.current;
3382
- n.current = m !== null && u instanceof Element && m.contains(u) ? Ta(u) : null;
3467
+ n.current = m !== null && u instanceof Element && m.contains(u) ? Tl(u) : null;
3383
3468
  }, i = (u) => o(u.target);
3384
3469
  o(document.activeElement);
3385
- const l = (u) => {
3470
+ const a = (u) => {
3386
3471
  const m = u.target;
3387
3472
  u.relatedTarget !== null || !(m instanceof Element) || queueMicrotask(() => {
3388
3473
  n.current?.element === m && m.isConnected && document.activeElement !== m && (n.current = null);
3389
3474
  });
3390
3475
  };
3391
- return document.addEventListener("focusin", i), document.addEventListener("focusout", l), () => {
3392
- document.removeEventListener("focusin", i), document.removeEventListener("focusout", l);
3476
+ return document.addEventListener("focusin", i), document.addEventListener("focusout", a), () => {
3477
+ document.removeEventListener("focusin", i), document.removeEventListener("focusout", a);
3393
3478
  };
3394
3479
  }, [e]);
3395
3480
  const r = _(t);
3396
- H(() => {
3481
+ j(() => {
3397
3482
  if (r.current === t) return;
3398
3483
  r.current = t;
3399
3484
  const o = n.current;
@@ -3403,21 +3488,21 @@ const ga = () => {
3403
3488
  if (m !== null && m !== document.body && m !== o.element) return !0;
3404
3489
  const f = e.current;
3405
3490
  if (f === null) return !0;
3406
- for (const d of o.control.successors)
3407
- for (const h of f.querySelectorAll(d))
3491
+ for (const c of o.control.successors)
3492
+ for (const h of f.querySelectorAll(c))
3408
3493
  if (h !== o.element && (h.focus({ preventScroll: !0 }), document.activeElement === h))
3409
3494
  return !0;
3410
3495
  return !1;
3411
3496
  };
3412
3497
  if (i()) return;
3413
- const l = e.current;
3414
- if (l === null) return;
3498
+ const a = e.current;
3499
+ if (a === null) return;
3415
3500
  const u = new MutationObserver(() => {
3416
3501
  i() && u.disconnect();
3417
3502
  });
3418
- return u.observe(l, { childList: !0, subtree: !0 }), () => u.disconnect();
3503
+ return u.observe(a, { childList: !0, subtree: !0 }), () => u.disconnect();
3419
3504
  }, [t, e]);
3420
- }, Ma = it(() => import("./TreeLayout-C8IP4cjY.js").then((e) => ({ default: e.TreeLayout }))), Oa = it(() => import("./MultiLayout-KWacTPP8.js").then((e) => ({ default: e.MultiLayout }))), Ca = 64, La = {
3505
+ }, Ol = it(() => import("./TreeLayout-DzZCgMTt.js").then((e) => ({ default: e.TreeLayout }))), Cl = it(() => import("./MultiLayout-Gf1xT-Le.js").then((e) => ({ default: e.MultiLayout }))), Ml = 64, Al = {
3421
3506
  request: (e) => {
3422
3507
  requestAnimationFrame(e);
3423
3508
  }
@@ -3426,129 +3511,129 @@ const ga = () => {
3426
3511
  }, Xe = (e, t) => {
3427
3512
  t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
3428
3513
  for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
3429
- }, Aa = (e, t) => {
3430
- const [n, r] = B(() => ({ overrides: t, locale: e, labels: Rt(e, t) }));
3514
+ }, Ll = (e, t) => {
3515
+ const [n, r] = z(() => ({ overrides: t, locale: e, labels: Rt(e, t) }));
3431
3516
  if (n.locale === e && Nr(n.overrides, t)) return n.labels;
3432
3517
  const o = { overrides: t, locale: e, labels: Rt(e, t) };
3433
3518
  return r(o), o.labels;
3434
- }, Na = (e, t, n) => {
3435
- const [r, o] = B(() => ({ scope: t, store: Wt(e, n) }));
3519
+ }, Nl = (e, t, n) => {
3520
+ const [r, o] = z(() => ({ scope: t, store: Wt(e, n) }));
3436
3521
  if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
3437
3522
  const i = { scope: t, store: Wt(e, n) };
3438
3523
  return o(i), i.store;
3439
3524
  }, Ye = (e, t) => {
3440
- const [n, r] = B(() => ({ scope: e, value: t() }));
3525
+ const [n, r] = z(() => ({ scope: e, value: t() }));
3441
3526
  if (n.scope === e) return n.value;
3442
3527
  const o = { scope: e, value: t() };
3443
3528
  return r(o), o.value;
3444
- }, Da = () => ia(La), en = "on", Pa = "off", $a = Object.freeze({ kind: "unavailable" }), Fa = (e) => {
3529
+ }, Dl = () => il(Al), en = "on", Pl = "off", Fl = Object.freeze({ kind: "unavailable" }), $l = (e) => {
3445
3530
  if (e !== void 0 && (e === null || typeof e != "object" || typeof e.convert != "function"))
3446
3531
  throw new TypeError("[markdown-explorer] draftConverter must be an object with a convert function");
3447
- }, qa = (e, t) => {
3532
+ }, ql = (e, t) => {
3448
3533
  const n = ue(e.peek(t));
3449
3534
  return n === null || n.document.kind === "failure" ? se(t) : n.document.name;
3450
- }, Qa = ({
3535
+ }, Ql = ({
3451
3536
  data: e,
3452
3537
  config: t,
3453
3538
  storageNamespace: n,
3454
3539
  locale: r,
3455
3540
  labels: o,
3456
3541
  theme: i,
3457
- renderFrame: l,
3542
+ renderFrame: a,
3458
3543
  renderTreeFailure: u,
3459
3544
  lockDocumentScroll: m = !1,
3460
3545
  onMathDiagnostics: f,
3461
- onEditGrant: d,
3546
+ onEditGrant: c,
3462
3547
  draftConverter: h
3463
3548
  }) => {
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 } };
3549
+ yr(n), $l(h);
3550
+ const g = un(r), E = Dr(i), k = Ll(g, o), { revalidate: R } = Vn(), T = _(() => {
3551
+ }), A = Fe(t.dataPath), [L] = z(() => {
3552
+ const x = ll({ dataPath: A, onScope: (F) => T.current(F) }), C = { documents: Fo({ client: x, capacity: Math.max(Ml, t.multiView.maxPanels * 2) }), trees: pl(x) };
3553
+ return Xe(C, e), kt(n, e.scope), { data: x, ...C, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
3469
3554
  });
3470
3555
  if (L.aligned.pageData !== e || L.aligned.storageNamespace !== n) {
3471
- const k = L.aligned.pageData;
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);
3556
+ const x = L.aligned.pageData;
3557
+ L.aligned.pageData = e, L.aligned.storageNamespace = n, x !== e && (x.scope !== e.scope ? L.aligned.pendingReader = e : Xe(L, e)), kt(n, e.scope);
3473
3558
  }
3474
- const E = Na(we(n).treeSettings, e.scope, t.defaultTreeSettings);
3475
- H(() => {
3476
- const k = L.aligned.pendingReader;
3477
- k !== null && (L.aligned.pendingReader = null, Qt(L), Xe(L, k));
3478
- }, [e, L]), H(() => {
3479
- let k = !1;
3480
- return S.current = (O) => {
3481
- O === e.scope || k || (k = !0, O !== null && (Qt(L), Sr(n)), R());
3559
+ const b = Nl(we(n).treeSettings, e.scope, t.defaultTreeSettings);
3560
+ j(() => {
3561
+ const x = L.aligned.pendingReader;
3562
+ x !== null && (L.aligned.pendingReader = null, Qt(L), Xe(L, x));
3563
+ }, [e, L]), j(() => {
3564
+ let x = !1;
3565
+ return T.current = (C) => {
3566
+ C === e.scope || x || (x = !0, C !== null && (Qt(L), xr(n)), R());
3482
3567
  }, () => {
3483
- S.current = () => {
3568
+ T.current = () => {
3484
3569
  };
3485
3570
  };
3486
3571
  }, [e, R, L, n]);
3487
- const v = _(t.settingsCookie);
3488
- H(() => {
3489
- v.current = t.settingsCookie;
3572
+ const w = _(t.settingsCookie);
3573
+ j(() => {
3574
+ w.current = t.settingsCookie;
3490
3575
  }, [t.settingsCookie]);
3491
- const [a] = B(
3492
- () => va(e.settings, (k) => {
3493
- document.cookie = er(v.current, k, window.location.protocol === "https:");
3576
+ const [l] = z(
3577
+ () => vl(e.settings, (x) => {
3578
+ document.cookie = er(w.current, x, window.location.protocol === "https:");
3494
3579
  })
3495
- ), s = Ye(e.scope, Da), w = Ye(e.scope, sa), T = _(M);
3496
- H(() => {
3497
- T.current = M;
3498
- }, [M]);
3499
- const C = Ye(
3580
+ ), s = Ye(e.scope, Dl), v = Ye(e.scope, sl), O = _(k);
3581
+ j(() => {
3582
+ O.current = k;
3583
+ }, [k]);
3584
+ const M = Ye(
3500
3585
  e.scope,
3501
3586
  () => Vr({
3502
3587
  data: L.data,
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($);
3588
+ conflictLabels: () => ({ ours: O.current.conflictOurs, theirs: O.current.conflictTheirs }),
3589
+ onSaveSettled: (x, C) => {
3590
+ C.kind === "saved" && L.documents.refresh(x);
3591
+ const F = Fr(O.current, C, ql(L.documents, x));
3592
+ F !== null && s.announce(F);
3508
3593
  },
3509
3594
  sideBySideSetting: {
3510
3595
  read: () => Qe(we(n).editPreview) === en,
3511
- write: (k) => Je(we(n).editPreview, k ? en : Pa)
3596
+ write: (x) => Je(we(n).editPreview, x ? en : Pl)
3512
3597
  },
3513
3598
  editorShareSetting: {
3514
3599
  read: () => Hr(Qe(we(n).editSplit)),
3515
- write: (k) => Je(we(n).editSplit, String(k))
3600
+ write: (x) => Je(we(n).editSplit, String(x))
3516
3601
  }
3517
3602
  })
3518
- ), N = G(() => Te(e.notices.catch(() => [])), [e.notices]), q = e.sources.map((k) => k.id).join(`
3519
- `), W = G(() => Qn(t, q.split(`
3520
- `)), [t, q]), z = _(f);
3521
- H(() => {
3522
- z.current = f;
3603
+ ), N = U(() => Te(e.notices.catch(() => [])), [e.notices]), q = e.sources.map((x) => x.id).join(`
3604
+ `), W = U(() => Qn(t, q.split(`
3605
+ `)), [t, q]), G = _(f);
3606
+ j(() => {
3607
+ G.current = f;
3523
3608
  }, [f]);
3524
- const [j] = B(() => (k, O) => {
3525
- z.current?.(k, O);
3526
- }), Y = f === void 0 ? void 0 : j, V = _(h);
3527
- H(() => {
3528
- V.current = h;
3609
+ const [I] = z(() => (x, C) => {
3610
+ G.current?.(x, C);
3611
+ }), J = f === void 0 ? void 0 : I, H = _(h);
3612
+ j(() => {
3613
+ H.current = h;
3529
3614
  }, [h]);
3530
- const [re] = B(() => {
3531
- let k = !1;
3615
+ const [ne] = z(() => {
3616
+ let x = !1;
3532
3617
  return {
3533
- convert: (O, $) => {
3534
- const I = V.current;
3535
- return I === void 0 ? Promise.resolve($a) : I.convert(O, $);
3618
+ convert: (C, F) => {
3619
+ const B = H.current;
3620
+ return B === void 0 ? Promise.resolve(Fl) : B.convert(C, F);
3536
3621
  },
3537
3622
  prepare: () => {
3538
3623
  try {
3539
- V.current?.prepare?.();
3540
- } catch (O) {
3541
- if (k) return;
3542
- k = !0, console.error("[markdown-explorer] the draft converter's prepare threw", O);
3624
+ H.current?.prepare?.();
3625
+ } catch (C) {
3626
+ if (x) return;
3627
+ x = !0, console.error("[markdown-explorer] the draft converter's prepare threw", C);
3543
3628
  }
3544
3629
  }
3545
3630
  };
3546
- }), p = h === void 0 ? void 0 : re, x = G(
3631
+ }), p = h === void 0 ? void 0 : ne, S = U(
3547
3632
  () => ({
3548
3633
  config: W,
3549
- labels: M,
3634
+ labels: k,
3550
3635
  locale: g,
3551
- theme: b,
3636
+ theme: E,
3552
3637
  storageNamespace: n,
3553
3638
  scope: e.scope,
3554
3639
  sources: e.sources,
@@ -3556,92 +3641,92 @@ const ga = () => {
3556
3641
  documents: L.documents,
3557
3642
  trees: L.trees,
3558
3643
  data: L.data,
3559
- viewSettings: a,
3560
- treeSettings: E,
3644
+ viewSettings: l,
3645
+ treeSettings: b,
3561
3646
  announcer: s,
3562
- reveals: w,
3563
- edits: C,
3564
- onEditGrant: d,
3647
+ reveals: v,
3648
+ edits: M,
3649
+ onEditGrant: c,
3565
3650
  draftConverter: p,
3566
3651
  renderTreeFailure: u,
3567
- reportMathDiagnostics: Y
3652
+ reportMathDiagnostics: J
3568
3653
  }),
3569
- [W, M, g, b, n, e.scope, e.sources, N, L, a, E, s, w, C, d, p, u, Y]
3654
+ [W, k, g, E, n, e.scope, e.sources, N, L, l, b, s, v, M, c, p, u, J]
3570
3655
  );
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);
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 });
3575
- }, Ia = ({ renderFrame: e, lockDocumentScroll: t }) => {
3576
- const { theme: n, labels: r } = D(), o = lt(), { hash: i } = nn(), l = Fe(), u = _(null);
3577
- Sa(t, u), H(() => {
3578
- o.kind === "redirect" && l(`${o.href}${i}`, "browse");
3579
- }, [o, i, l]);
3656
+ return /* @__PURE__ */ d(fn, { value: S, children: /* @__PURE__ */ d(Il, { renderFrame: a, lockDocumentScroll: m }, e.scope) });
3657
+ }, _l = ({ ref: e, theme: t, view: n, children: r }) => {
3658
+ const [o] = z(bi);
3659
+ return /* @__PURE__ */ d("div", { ref: e, className: "aqmx-root", "data-aqmx-theme": t, "data-aqmx-view": n, "data-testid": "markdown-explorer", onKeyDownCapture: o.onKeyDownCapture, onKeyUpCapture: o.onKeyUpCapture, onBlurCapture: o.onBlurCapture, children: r });
3660
+ }, Il = ({ renderFrame: e, lockDocumentScroll: t }) => {
3661
+ const { theme: n, labels: r } = D(), o = at(), { hash: i } = nn(), a = $e(), u = _(null);
3662
+ xl(t, u), j(() => {
3663
+ o.kind === "redirect" && a(`${o.href}${i}`, "browse");
3664
+ }, [o, i, a]);
3580
3665
  const { location: m } = o, f = m.view;
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: [
3583
- d,
3584
- /* @__PURE__ */ c(so, {}),
3585
- /* @__PURE__ */ c(oa, { holds: !0, testId: "markdown-explorer-announcer" })
3666
+ Rl(u, f);
3667
+ const c = m.view === "tree" ? /* @__PURE__ */ d(ke, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading", ...et }), children: /* @__PURE__ */ d(Ol, { location: m }) }) : m.view === "multi" ? /* @__PURE__ */ d(ke, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading", ...et }), children: /* @__PURE__ */ d(Cl, { location: m }) }) : /* @__PURE__ */ d(rl, { location: m }), h = /* @__PURE__ */ $(_l, { ref: u, theme: n, view: f, children: [
3668
+ c,
3669
+ /* @__PURE__ */ d(so, {}),
3670
+ /* @__PURE__ */ d(ol, { holds: !0, testId: "markdown-explorer-announcer" })
3586
3671
  ] });
3587
3672
  return e === void 0 ? h : e({ view: f, children: h });
3588
3673
  }, es = kr({ submissions: "skip", otherPath: "skip", query: "skip", hashChange: "skip" });
3589
3674
  export {
3590
3675
  Tt as $,
3591
3676
  rt as A,
3592
- Zt as B,
3593
- Fr as C,
3594
- na as D,
3595
- Pl as E,
3677
+ Ut as B,
3678
+ $r as C,
3679
+ nl as D,
3680
+ Pa as E,
3596
3681
  Jr as F,
3597
- ql as G,
3598
- Me as H,
3599
- Ya as I,
3600
- yi as J,
3601
- Ur as K,
3602
- xn as L,
3682
+ qa as G,
3683
+ Oe as H,
3684
+ Yl as I,
3685
+ Si as J,
3686
+ Zr as K,
3687
+ yn as L,
3603
3688
  Do as M,
3604
3689
  Qi as N,
3605
- gl as O,
3606
- ta as P,
3607
- Lo as Q,
3608
- Cl as R,
3609
- Co as S,
3610
- lt as T,
3611
- oa as U,
3612
- Ae as V,
3690
+ ga as O,
3691
+ tl as P,
3692
+ Ao as Q,
3693
+ Ma as R,
3694
+ Mo as S,
3695
+ at as T,
3696
+ ol as U,
3697
+ Le as V,
3613
3698
  Tr as W,
3614
- Mt as X,
3615
- Cr as Y,
3616
- dn as Z,
3699
+ Ot as X,
3700
+ Mr as Y,
3701
+ cn as Z,
3617
3702
  Rr as _,
3618
3703
  qr as a,
3619
- Qa as a0,
3704
+ Ql as a0,
3620
3705
  Rt as a1,
3621
3706
  es as a2,
3622
3707
  _r as b,
3623
- Fe as c,
3624
- Jl as d,
3708
+ $e as c,
3709
+ Ja as d,
3625
3710
  et as e,
3626
- vl as f,
3627
- So as g,
3711
+ va as f,
3712
+ xo as g,
3628
3713
  Ir as h,
3629
- Mo as i,
3630
- xo as j,
3631
- ae as k,
3632
- Oo as l,
3714
+ Oo as i,
3715
+ yo as j,
3716
+ le as k,
3717
+ Co as l,
3633
3718
  ue as m,
3634
3719
  Eo as n,
3635
- yo as o,
3720
+ So as o,
3636
3721
  me as p,
3637
- lo as q,
3722
+ ao as q,
3638
3723
  to as r,
3639
- Fl as s,
3640
- Xa as t,
3724
+ $a as s,
3725
+ Xl as t,
3641
3726
  D as u,
3642
3727
  ko as v,
3643
- Ja as w,
3728
+ Jl as w,
3644
3729
  hn as x,
3645
- Il as y,
3646
- _l as z
3730
+ Ia as y,
3731
+ _a as z
3647
3732
  };