@aiquants/markdown-explorer 0.24.0 → 0.24.1
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.
- package/CHANGELOG.md +15 -0
- package/README.md +11 -6
- package/dist/{EditSurface-CcWEczj3.js → EditSurface-CFXG8Qok.js} +1 -1
- package/dist/{EditSurface-CRc4g0Qa.cjs → EditSurface-CiKQiYSD.cjs} +1 -1
- package/dist/{ExplorerSplit-ByxxXlgs.cjs → ExplorerSplit-BWMVatnB.cjs} +1 -1
- package/dist/{ExplorerSplit-97SeIAOS.js → ExplorerSplit-DIkC3R7O.js} +1 -1
- package/dist/{MultiLayout-CnbuAlxd.js → MultiLayout-DXnuRzb4.js} +2 -2
- package/dist/{MultiLayout-B_yMVDt_.cjs → MultiLayout-q_Pvwykp.cjs} +1 -1
- package/dist/{NativeScrollBar-D4a7fBOS.cjs → NativeScrollBar-UYBG64v1.cjs} +1 -1
- package/dist/{NativeScrollBar-BXdaM3EA.js → NativeScrollBar-s_uSPPEd.js} +1 -1
- package/dist/{TreeLayout-BIQBKAkV.js → TreeLayout-BQ1lWVf3.js} +2 -2
- package/dist/{TreeLayout-C6QDpEBS.cjs → TreeLayout-Di0yv1E-.cjs} +1 -1
- package/dist/core/labels.d.cts +3 -0
- package/dist/core/labels.d.ts +3 -0
- package/dist/{index-CeZDCyEl.js → index-BhxsL0Sm.js} +546 -537
- package/dist/index-ZdsIXJap.cjs +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{merge-DqjUgcV_.js → merge-CQAXBfvi.js} +1 -1
- package/dist/{merge-QLktbpZY.cjs → merge-DkmrVEIc.cjs} +1 -1
- package/docs/behavior/layout.md +7 -4
- package/docs/behavior/localization.md +6 -3
- package/docs/behavior/security.md +2 -1
- package/package.json +3 -3
- package/dist/index-BwTVYkTR.cjs +0 -13
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as H, jsx as s, Fragment as je } from "react/jsx-runtime";
|
|
2
2
|
import * as y from "react";
|
|
3
|
-
import { createContext as he, use as oe, useMemo as Y, useSyncExternalStore as re, useRef as B, useLayoutEffect as K, useCallback as
|
|
3
|
+
import { createContext as he, use as oe, useMemo as Y, useSyncExternalStore as re, useRef as B, useLayoutEffect as K, useCallback as q, useId as ke, useEffect as ee, Component as En, Suspense as xe, lazy as gt, useState as U, useEffectEvent as ae } from "react";
|
|
4
4
|
import { useParams as br, useSearchParams as Er, matchPath as yr, useBlocker as Sr, useNavigate as kr, Link as xr, useHref as ze, useLocation as yn, useRevalidator as Tr } from "react-router";
|
|
5
|
-
import { k as Rr, h as Sn, G as
|
|
6
|
-
import { SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS as
|
|
7
|
-
import { H as ce, i as
|
|
5
|
+
import { k as Rr, h as Sn, G as Cr, E as kn, a as xn, H as Or, I as Dt, J as Mr, K as be, e as ye, m as Lr, L as Ar, M as Nr, O as Dr, Q as Pt, R as Pr, T as It, U as Ir, w as $r, V as Fr } from "./location-gXXmC7CQ.js";
|
|
6
|
+
import { SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS as $t, SPREADSHEET_BLOCK_LABEL_CATALOGS as qe } from "@aiquants/markdown/code-blocks";
|
|
7
|
+
import { H as ce, i as qr, I as wt, A as te, J as Xe, B as Je, z as _r, K as Br, f as Hr, L as jr, N as zr, O as Vr, P as Ur, Q as Ft, x as Zr, R as Gr, S as Wr, T as Kr, D as Yr, y as Xr, U as Jr, V as Qr, W as eo, w as qt } from "./dataRoute-BEvesOvN.js";
|
|
8
8
|
import { HostedScrollArea as _t, SpreadsheetBlock as to, useMarkdownToolbarState as no, MarkdownViewer as Tn } from "@aiquants/markdown";
|
|
9
9
|
import { SOURCE_LINES_ATTRIBUTE as Rn, parseSourceLines as ro } from "@aiquants/markdown/source-lines";
|
|
10
10
|
import { iterateTsvRows as oo, iterateTsvPrefixRows as io, serializeTsv as ao } from "@aiquants/spreadsheet/tsv";
|
|
@@ -12,16 +12,16 @@ import { SPREADSHEET_MAX_OPERATION_CELLS as Bt } from "@aiquants/spreadsheet/vie
|
|
|
12
12
|
import { DEFAULT_CONTENT_ALIGN as lo } from "@aiquants/markdown/viewer-settings";
|
|
13
13
|
import { w as ct, r as dt, a as so, b as Ht, s as ve, c as co } from "./storage-CmGHg7OA.js";
|
|
14
14
|
import { createShouldRevalidate as uo } from "@aiquants/route-revalidation";
|
|
15
|
-
const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`,
|
|
15
|
+
const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`, Cn = Object.freeze(Object.keys(qe.en)), On = (e) => Object.fromEntries(Cn.map((t) => [vt(t), qe[e][t].text])), mo = Object.freeze({
|
|
16
16
|
panelMoved: Object.freeze(["title", "column", "position"]),
|
|
17
17
|
panelMoveUnavailable: Object.freeze(["title", "move"]),
|
|
18
18
|
panelDragStarted: Object.freeze(["title"]),
|
|
19
19
|
panelDragCancelled: Object.freeze(["title"]),
|
|
20
20
|
multiColumnRegion: Object.freeze(["column"]),
|
|
21
21
|
viewerSvgImageSourceRegion: Object.freeze(["name"]),
|
|
22
|
-
...Object.fromEntries(
|
|
22
|
+
...Object.fromEntries(Cn.filter((e) => $t[e].length > 0).map((e) => [vt(e), $t[e]]))
|
|
23
23
|
}), ho = /\{(\w+)\}/gu, Mn = {
|
|
24
|
-
...
|
|
24
|
+
...On("en"),
|
|
25
25
|
explorerRegion: "Explorer",
|
|
26
26
|
sourceLabel: "Source",
|
|
27
27
|
refreshTreeLabel: "Refresh tree",
|
|
@@ -272,6 +272,9 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
272
272
|
viewerSvgImageCopy: "Copy the source",
|
|
273
273
|
viewerSvgImageCopied: "Copied the source.",
|
|
274
274
|
viewerSvgImageCopyFailed: "Could not copy the source.",
|
|
275
|
+
viewerSvgImageCopyImage: "Copy the image",
|
|
276
|
+
viewerSvgImageCopiedImage: "Copied the image.",
|
|
277
|
+
viewerSvgImageCopyImageFailed: "Could not copy the image.",
|
|
275
278
|
multiRegion: "Panels",
|
|
276
279
|
multiEmpty: "Select documents in the explorer to open them side by side.",
|
|
277
280
|
panelLimit: (e) => `You can open up to ${String(e)} panels at once.`,
|
|
@@ -305,7 +308,7 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
305
308
|
multiColumnRegion: "Column {column}",
|
|
306
309
|
panelDropHere: "Drop the panel here"
|
|
307
310
|
}, po = {
|
|
308
|
-
...
|
|
311
|
+
...On("ja"),
|
|
309
312
|
explorerRegion: "エクスプローラー",
|
|
310
313
|
sourceLabel: "ソース",
|
|
311
314
|
refreshTreeLabel: "ツリーを更新",
|
|
@@ -556,6 +559,9 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
556
559
|
viewerSvgImageCopy: "ソースをコピー",
|
|
557
560
|
viewerSvgImageCopied: "ソースをコピーしました。",
|
|
558
561
|
viewerSvgImageCopyFailed: "ソースをコピーできませんでした。",
|
|
562
|
+
viewerSvgImageCopyImage: "画像をコピー",
|
|
563
|
+
viewerSvgImageCopiedImage: "画像をコピーしました。",
|
|
564
|
+
viewerSvgImageCopyImageFailed: "画像をコピーできませんでした。",
|
|
559
565
|
multiRegion: "パネル",
|
|
560
566
|
multiEmpty: "エクスプローラーで文書を選ぶと、ここに並べて開きます。",
|
|
561
567
|
panelLimit: (e) => `同時に開けるのは ${String(e)} パネルまでです。`,
|
|
@@ -588,20 +594,20 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
588
594
|
multiColumnEmpty: "この列は空です",
|
|
589
595
|
multiColumnRegion: "{column} 列目",
|
|
590
596
|
panelDropHere: "ここへパネルをドロップ"
|
|
591
|
-
},
|
|
597
|
+
}, go = Object.freeze({
|
|
592
598
|
en: Object.freeze(Mn),
|
|
593
599
|
ja: Object.freeze(po)
|
|
594
|
-
}), Ln = Object.freeze(Object.keys(Mn)),
|
|
600
|
+
}), Ln = Object.freeze(Object.keys(Mn)), wo = new Set(Ln), vo = (e) => wo.has(e), $e = (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, An = (e) => {
|
|
595
601
|
if (e === void 0) return fo;
|
|
596
602
|
if (jt.includes(e)) return e;
|
|
597
|
-
throw new RangeError(`[markdown-explorer] locale is the UI language (${jt.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${
|
|
603
|
+
throw new RangeError(`[markdown-explorer] locale is the UI language (${jt.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${$e(e)}`);
|
|
598
604
|
}, zt = (e, t) => {
|
|
599
|
-
const n =
|
|
605
|
+
const n = go[An(e)];
|
|
600
606
|
if (t === void 0) return n;
|
|
601
607
|
if (t === null || typeof t != "object")
|
|
602
|
-
throw new RangeError(`[markdown-explorer] labels must be an object; got ${
|
|
608
|
+
throw new RangeError(`[markdown-explorer] labels must be an object; got ${$e(t)}`);
|
|
603
609
|
if (!Rr(t))
|
|
604
|
-
throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${
|
|
610
|
+
throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${$e(t)}`);
|
|
605
611
|
const r = t, o = { ...n };
|
|
606
612
|
for (const i of Object.keys(r)) {
|
|
607
613
|
if (!vo(i))
|
|
@@ -610,14 +616,14 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
610
616
|
if (a === void 0) continue;
|
|
611
617
|
const c = typeof n[i];
|
|
612
618
|
if (typeof a !== c)
|
|
613
|
-
throw new TypeError(`[markdown-explorer] labels.${i} must be a ${c}; got ${
|
|
619
|
+
throw new TypeError(`[markdown-explorer] labels.${i} must be a ${c}; got ${$e(a)}`);
|
|
614
620
|
if (typeof a == "string" && a.trim() === "")
|
|
615
621
|
throw new RangeError(`[markdown-explorer] labels.${i} must be a non-blank string`);
|
|
616
622
|
const f = mo[i];
|
|
617
623
|
if (typeof a == "string" && f !== void 0) {
|
|
618
|
-
for (const [,
|
|
619
|
-
if (!f.includes(
|
|
620
|
-
throw new RangeError(`[markdown-explorer] labels.${i} uses the unknown placeholder {${String(
|
|
624
|
+
for (const [, g] of a.matchAll(ho))
|
|
625
|
+
if (!f.includes(g ?? ""))
|
|
626
|
+
throw new RangeError(`[markdown-explorer] labels.${i} uses the unknown placeholder {${String(g)}}; it accepts ${f.map((l) => `{${l}}`).join(", ")}`);
|
|
621
627
|
}
|
|
622
628
|
o[i] = a;
|
|
623
629
|
}
|
|
@@ -631,15 +637,15 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
631
637
|
if (e === void 0) return "light";
|
|
632
638
|
if (Vt.includes(e)) return e;
|
|
633
639
|
throw new RangeError(`[markdown-explorer] theme must be ${Vt.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
|
|
634
|
-
}, Nn = he(null),
|
|
640
|
+
}, Nn = he(null), $ = () => {
|
|
635
641
|
const e = oe(Nn);
|
|
636
642
|
if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
|
|
637
643
|
return e;
|
|
638
644
|
}, _e = (e) => {
|
|
639
|
-
const { viewSettings: t } =
|
|
645
|
+
const { viewSettings: t } = $(), n = () => e(t.getSnapshot());
|
|
640
646
|
return re(t.subscribe, n, n);
|
|
641
647
|
}, bt = () => {
|
|
642
|
-
const { config: e } =
|
|
648
|
+
const { config: e } = $(), t = br()["*"], [n] = Er(), r = n.toString();
|
|
643
649
|
return Y(() => Sn(e, t, new URLSearchParams(r)), [e, t, r]);
|
|
644
650
|
}, Dn = {
|
|
645
651
|
unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
|
|
@@ -651,7 +657,7 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
651
657
|
unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
|
|
652
658
|
failed: ["failureFailedTitle", "failureFailedBody"]
|
|
653
659
|
}, le = (e, t) => e[Dn[t][0]], Te = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
|
|
654
|
-
const { labels: o } =
|
|
660
|
+
const { labels: o } = $(), i = le(o, e.reason), a = o[Dn[e.reason][1]], c = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
|
|
655
661
|
return /* @__PURE__ */ H("div", { className: "aqmx-callout", role: t ? "alert" : void 0, "data-aqmx-tone": c, "data-testid": r === null ? void 0 : r, "data-aqmx-failure": r === null ? void 0 : e.reason, children: [
|
|
656
662
|
/* @__PURE__ */ s("p", { className: "aqmx-callout-title", children: i }),
|
|
657
663
|
/* @__PURE__ */ s("p", { className: "aqmx-callout-body", children: a }),
|
|
@@ -699,7 +705,7 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
699
705
|
case "saving":
|
|
700
706
|
return null;
|
|
701
707
|
}
|
|
702
|
-
},
|
|
708
|
+
}, Oe = () => {
|
|
703
709
|
const e = /* @__PURE__ */ new Set();
|
|
704
710
|
return {
|
|
705
711
|
subscribe: (t) => (e.add(t), () => {
|
|
@@ -723,16 +729,16 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
723
729
|
`) ? `\r
|
|
724
730
|
` : `
|
|
725
731
|
`, Qe = (e) => e.replace(/\r\n?/gu, `
|
|
726
|
-
`),
|
|
732
|
+
`), Co = (e, t) => t === `
|
|
727
733
|
` ? e : e.replaceAll(`
|
|
728
734
|
`, `\r
|
|
729
|
-
`),
|
|
735
|
+
`), Oo = 3, Mo = /^\d+(?:\.\d+)?$/u, Lo = (e) => {
|
|
730
736
|
if (e === null || !Mo.test(e)) return null;
|
|
731
737
|
const t = Number(e);
|
|
732
738
|
return t >= xn && t <= kn ? t : null;
|
|
733
739
|
}, et = Object.freeze({ kind: "idle" }), Wt = Object.freeze({ kind: "draft" }), Ao = ({ data: e, conflictLabels: t, onSaveSettled: n, sideBySideSetting: r, editorShareSetting: o }) => {
|
|
734
|
-
const i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(),
|
|
735
|
-
let u = null, p = null,
|
|
740
|
+
const i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), l = Oe();
|
|
741
|
+
let u = null, p = null, w = null;
|
|
736
742
|
const b = (d, m) => {
|
|
737
743
|
d.value = { ...d.value, ...m }, l.emit();
|
|
738
744
|
}, x = (d, m) => i.get(d) === m, R = async (d, m) => {
|
|
@@ -749,8 +755,8 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
749
755
|
b(m, { phase: { kind: "failed", failure: M.failure } });
|
|
750
756
|
return;
|
|
751
757
|
}
|
|
752
|
-
const
|
|
753
|
-
m.base = { text:
|
|
758
|
+
const I = Qe(M.text), F = M.kind === "draft";
|
|
759
|
+
m.base = { text: I, version: F ? null : M.version }, m.draft = I, m.ending = Gt(M.text), b(m, { phase: { kind: "editing" }, history: F ? !1 : M.history, dirty: !1, save: F ? Wt : et, generation: m.value.generation + 1 });
|
|
754
760
|
}, A = (d) => {
|
|
755
761
|
const m = i.get(d);
|
|
756
762
|
m !== void 0 && (m.controller.abort(), i.delete(d), c.delete(d));
|
|
@@ -773,34 +779,34 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
773
779
|
return;
|
|
774
780
|
}
|
|
775
781
|
m.controller.abort(), m.controller = new AbortController();
|
|
776
|
-
const { signal:
|
|
777
|
-
let
|
|
782
|
+
const { signal: I } = m.controller;
|
|
783
|
+
let F = { text: m.base.text, version: k }, v = m.draft, T = !1;
|
|
778
784
|
b(m, { save: { kind: "saving" } });
|
|
779
|
-
for (let L = 0; L <
|
|
780
|
-
const
|
|
781
|
-
if (!x(d, m) ||
|
|
782
|
-
if (
|
|
783
|
-
f.get(d)?.flush(), m.base = { text: v, version:
|
|
785
|
+
for (let L = 0; L < Oo; L += 1) {
|
|
786
|
+
const C = await e.save(d, F.version, Co(v, m.ending), I);
|
|
787
|
+
if (!x(d, m) || I.aborted || !("kind" in C)) return;
|
|
788
|
+
if (C.kind === "saved") {
|
|
789
|
+
f.get(d)?.flush(), m.base = { text: v, version: C.version }, _(d, m, { kind: "saved", merged: T }, { dirty: m.draft !== v });
|
|
784
790
|
return;
|
|
785
791
|
}
|
|
786
|
-
if (
|
|
787
|
-
_(d, m, { kind: "grant", href:
|
|
792
|
+
if (C.kind === "grant") {
|
|
793
|
+
_(d, m, { kind: "grant", href: C.href });
|
|
788
794
|
return;
|
|
789
795
|
}
|
|
790
|
-
if (
|
|
791
|
-
_(d, m, { kind: "failed", failure:
|
|
796
|
+
if (C.kind === "failure") {
|
|
797
|
+
_(d, m, { kind: "failed", failure: C.failure });
|
|
792
798
|
return;
|
|
793
799
|
}
|
|
794
|
-
const { mergeDraft: P } = await import("./merge-
|
|
795
|
-
if (!x(d, m) ||
|
|
800
|
+
const { mergeDraft: P } = await import("./merge-CQAXBfvi.js");
|
|
801
|
+
if (!x(d, m) || I.aborted) return;
|
|
796
802
|
const j = f.get(d);
|
|
797
803
|
j?.flush();
|
|
798
|
-
const X = Qe(
|
|
799
|
-
if (
|
|
804
|
+
const X = Qe(C.text), h = P(F.text, m.draft, X, t());
|
|
805
|
+
if (F = { text: X, version: C.version }, m.base = F, m.ending = Gt(C.text), m.draft = h.text, j?.adopt(h.text), h.kind === "conflicts") {
|
|
800
806
|
_(d, m, { kind: "conflicts", count: h.conflicts }, { dirty: !0, generation: m.value.generation + 1 });
|
|
801
807
|
return;
|
|
802
808
|
}
|
|
803
|
-
if (T = !0, v = h.text, v ===
|
|
809
|
+
if (T = !0, v = h.text, v === F.text) {
|
|
804
810
|
_(d, m, { kind: "saved", merged: T }, { dirty: !1, generation: m.value.generation + 1 });
|
|
805
811
|
return;
|
|
806
812
|
}
|
|
@@ -840,12 +846,12 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
840
846
|
const k = i.get(d);
|
|
841
847
|
if (k === void 0 || k.base === null) return;
|
|
842
848
|
k.draft = m;
|
|
843
|
-
const M = {},
|
|
844
|
-
|
|
845
|
-
const { save:
|
|
846
|
-
if (
|
|
849
|
+
const M = {}, I = m !== k.base.text;
|
|
850
|
+
I !== k.value.dirty && (M.dirty = I);
|
|
851
|
+
const { save: F } = k.value;
|
|
852
|
+
if (F.kind === "conflicts") {
|
|
847
853
|
const v = Zt(m).length;
|
|
848
|
-
v === 0 ? M.save = et : v !==
|
|
854
|
+
v === 0 ? M.save = et : v !== F.count && (M.save = { kind: "conflicts", count: v });
|
|
849
855
|
}
|
|
850
856
|
(M.dirty !== void 0 || M.save !== void 0) && b(k, M);
|
|
851
857
|
},
|
|
@@ -859,8 +865,8 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
859
865
|
k?.flush();
|
|
860
866
|
const M = i.get(d);
|
|
861
867
|
if (M === void 0 || M.base === null) return;
|
|
862
|
-
const
|
|
863
|
-
M.draft =
|
|
868
|
+
const I = Qe(m);
|
|
869
|
+
M.draft = I, k?.adopt(I), b(M, { dirty: I !== M.base.text, generation: M.value.generation + 1 });
|
|
864
870
|
},
|
|
865
871
|
close: (d) => {
|
|
866
872
|
if (!i.has(d)) return;
|
|
@@ -883,9 +889,9 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
883
889
|
}
|
|
884
890
|
},
|
|
885
891
|
bindEditor: (d, m) => N(f, d, m),
|
|
886
|
-
bindView: (d, m) => N(
|
|
892
|
+
bindView: (d, m) => N(g, d, m),
|
|
887
893
|
viewAnchor: (d) => {
|
|
888
|
-
const m =
|
|
894
|
+
const m = g.get(d);
|
|
889
895
|
return m === void 0 ? null : m.anchor();
|
|
890
896
|
},
|
|
891
897
|
flush: (d) => f.get(d)?.flush(),
|
|
@@ -899,24 +905,24 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
899
905
|
return d.filter((m) => i.get(m)?.value.dirty === !0);
|
|
900
906
|
},
|
|
901
907
|
askToDiscard: (d) => new Promise((m) => {
|
|
902
|
-
|
|
908
|
+
w?.settle(!1);
|
|
903
909
|
const k = {
|
|
904
910
|
paths: d,
|
|
905
911
|
settle: (M) => {
|
|
906
|
-
if (
|
|
907
|
-
if (
|
|
912
|
+
if (w === k) {
|
|
913
|
+
if (w = null, M) for (const I of d) A(I);
|
|
908
914
|
l.emit(), m(M);
|
|
909
915
|
}
|
|
910
916
|
}
|
|
911
917
|
};
|
|
912
|
-
|
|
918
|
+
w = k, l.emit();
|
|
913
919
|
}),
|
|
914
|
-
discardRequest: () =>
|
|
920
|
+
discardRequest: () => w,
|
|
915
921
|
sideBySide: () => (u ??= r.read(), u),
|
|
916
922
|
setSideBySide: (d) => {
|
|
917
923
|
u !== d && (u = d, r.write(d), l.emit());
|
|
918
924
|
},
|
|
919
|
-
editorShare: () => (p ??= o.read() ??
|
|
925
|
+
editorShare: () => (p ??= o.read() ?? Cr, p),
|
|
920
926
|
setEditorShare: (d) => {
|
|
921
927
|
if (!Number.isFinite(d)) throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(d)}`);
|
|
922
928
|
const m = Math.min(kn, Math.max(xn, d));
|
|
@@ -933,16 +939,16 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
933
939
|
};
|
|
934
940
|
}, Pn = (e) => {
|
|
935
941
|
e.preventDefault(), e.stopPropagation();
|
|
936
|
-
}, No = (e) => e.endsWith("px") ? Number.parseFloat(e) : Number.NaN,
|
|
937
|
-
const t = e.closest(
|
|
942
|
+
}, No = (e) => e.endsWith("px") ? Number.parseFloat(e) : Number.NaN, In = "data-aqmx-content-pane", ut = Object.freeze({ [In]: "" }), Do = "--aqmx-dialog-left", Po = "--aqmx-dialog-top", Io = '[data-testid="markdown-explorer"]', $o = (e) => {
|
|
943
|
+
const t = e.closest(Io)?.querySelectorAll(`[${In}]`), n = t?.item(t.length - 1);
|
|
938
944
|
if (!(n instanceof HTMLElement)) throw new Error("[markdown-explorer] a dialog opened where the explorer marks no content pane");
|
|
939
945
|
return n;
|
|
940
|
-
},
|
|
946
|
+
}, Fo = (e) => {
|
|
941
947
|
const t = No(getComputedStyle(e).marginTop);
|
|
942
948
|
if (Number.isNaN(t)) return null;
|
|
943
|
-
const n =
|
|
949
|
+
const n = $o(e), r = e.getBoundingClientRect(), o = e.ownerDocument.documentElement, { left: i, top: a } = Or(n.getBoundingClientRect(), { width: r.width + 2 * t, height: r.height + 2 * t }, { width: o.clientWidth, height: o.clientHeight });
|
|
944
950
|
return e.style.setProperty(Do, `${String(i)}px`), e.style.setProperty(Po, `${String(a)}px`), n;
|
|
945
|
-
},
|
|
951
|
+
}, qo = (e) => e.preventDefault(), $n = ({ open: e, onOpen: t, onDismiss: n }) => {
|
|
946
952
|
const r = B(null), o = B(null), i = B(!1), a = B(t);
|
|
947
953
|
K(() => {
|
|
948
954
|
a.current = t;
|
|
@@ -957,36 +963,36 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
957
963
|
}, [e]), K(() => {
|
|
958
964
|
const l = r.current;
|
|
959
965
|
if (!e || l === null) return;
|
|
960
|
-
const u = new ResizeObserver(() =>
|
|
966
|
+
const u = new ResizeObserver(() => w());
|
|
961
967
|
let p = null;
|
|
962
|
-
const
|
|
963
|
-
const x =
|
|
968
|
+
const w = () => {
|
|
969
|
+
const x = Fo(l);
|
|
964
970
|
x === null || x === p || (p !== null && u.unobserve(p), u.observe(x), p = x);
|
|
965
971
|
};
|
|
966
|
-
|
|
972
|
+
w(), u.observe(l);
|
|
967
973
|
const b = l.ownerDocument.defaultView;
|
|
968
|
-
return b?.addEventListener("resize",
|
|
969
|
-
u.disconnect(), b?.removeEventListener("resize",
|
|
974
|
+
return b?.addEventListener("resize", w), l.ownerDocument.addEventListener("scroll", w, { capture: !0, passive: !0 }), () => {
|
|
975
|
+
u.disconnect(), b?.removeEventListener("resize", w), l.ownerDocument.removeEventListener("scroll", w, { capture: !0 });
|
|
970
976
|
};
|
|
971
977
|
}, [e]);
|
|
972
|
-
const c =
|
|
978
|
+
const c = q(
|
|
973
979
|
(l) => {
|
|
974
980
|
l.key !== "Escape" || l.defaultPrevented || (Pn(l), n());
|
|
975
981
|
},
|
|
976
982
|
[n]
|
|
977
|
-
), f =
|
|
983
|
+
), f = q(
|
|
978
984
|
(l) => {
|
|
979
985
|
l.target === l.currentTarget && n();
|
|
980
986
|
},
|
|
981
987
|
[n]
|
|
982
|
-
),
|
|
988
|
+
), g = q(() => {
|
|
983
989
|
i.current && n();
|
|
984
990
|
}, [n]);
|
|
985
|
-
return { ref: r, onKeyDown: c, onClick: f, onCancel:
|
|
986
|
-
},
|
|
987
|
-
const f = B(null),
|
|
988
|
-
return /* @__PURE__ */ s("dialog", { ...p, className: "aqmx-confirm", "aria-labelledby":
|
|
989
|
-
/* @__PURE__ */ s("p", { id:
|
|
991
|
+
return { ref: r, onKeyDown: c, onClick: f, onCancel: qo, onClose: g };
|
|
992
|
+
}, Fn = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: i, onCancel: a, testId: c }) => {
|
|
993
|
+
const f = B(null), g = ke(), l = ke(), u = q(() => f.current?.focus(), []), p = $n({ open: e, onOpen: u, onDismiss: a });
|
|
994
|
+
return /* @__PURE__ */ s("dialog", { ...p, className: "aqmx-confirm", "aria-labelledby": g, "aria-describedby": l, "data-testid": c, children: /* @__PURE__ */ H("div", { className: "aqmx-confirm-panel", children: [
|
|
995
|
+
/* @__PURE__ */ s("p", { id: g, className: "aqmx-confirm-title", children: t }),
|
|
990
996
|
/* @__PURE__ */ s("p", { id: l, className: "aqmx-confirm-body", children: n }),
|
|
991
997
|
/* @__PURE__ */ H("div", { className: "aqmx-confirm-actions", children: [
|
|
992
998
|
/* @__PURE__ */ s("button", { ref: f, type: "button", className: "aqmx-callout-action", "data-testid": `${c}-cancel`, onClick: a, children: o }),
|
|
@@ -1003,7 +1009,7 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
1003
1009
|
t.status = "rejected", t.reason = n;
|
|
1004
1010
|
}
|
|
1005
1011
|
)), t;
|
|
1006
|
-
},
|
|
1012
|
+
}, qn = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), Ee = (e) => e.status === "fulfilled" ? e.value : void 0, _o = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !1 }), Bo = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !0 }), Ho = (e, t, n) => {
|
|
1007
1013
|
const r = /* @__PURE__ */ new Set(), o = [...e].reverse();
|
|
1008
1014
|
for (let i = o.pop(); i !== void 0; i = o.pop()) {
|
|
1009
1015
|
if (i.type !== "directory" || r.has(i.path)) continue;
|
|
@@ -1039,35 +1045,35 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
|
|
|
1039
1045
|
return new Set(o.docs);
|
|
1040
1046
|
}
|
|
1041
1047
|
}, _n = (e) => {
|
|
1042
|
-
const { edits: t } =
|
|
1048
|
+
const { edits: t } = $(), n = q(() => t.session(e), [t, e]);
|
|
1043
1049
|
return re(t.subscribe, n, Uo);
|
|
1044
1050
|
}, Bn = () => !1, Uo = () => {
|
|
1045
1051
|
}, Zo = () => {
|
|
1046
|
-
const { edits: e } =
|
|
1052
|
+
const { edits: e } = $();
|
|
1047
1053
|
return re(e.subscribe, e.hasSessions, Bn);
|
|
1048
1054
|
}, Go = () => {
|
|
1049
|
-
const { edits: e } =
|
|
1055
|
+
const { edits: e } = $();
|
|
1050
1056
|
return re(e.subscribe, e.sideBySide, Bn);
|
|
1051
1057
|
}, Wo = () => null, Ko = () => {
|
|
1052
|
-
const { edits: e, labels: t, config: n, trees: r } =
|
|
1053
|
-
({ nextLocation:
|
|
1054
|
-
const b = Vo(n,
|
|
1058
|
+
const { edits: e, labels: t, config: n, trees: r } = $(), o = B([]), i = q(
|
|
1059
|
+
({ nextLocation: w }) => {
|
|
1060
|
+
const b = Vo(n, w, (x, R) => zo(r, x, R));
|
|
1055
1061
|
return e.flushDrafts(), o.current = e.dirtyPaths().filter((x) => !b.has(x)), o.current.length > 0;
|
|
1056
1062
|
},
|
|
1057
1063
|
[e, n, r]
|
|
1058
1064
|
), a = Sr(i), c = Zo();
|
|
1059
1065
|
ee(() => {
|
|
1060
1066
|
if (!c) return;
|
|
1061
|
-
const
|
|
1067
|
+
const w = (b) => {
|
|
1062
1068
|
e.flushDrafts(), e.dirtyPaths().length !== 0 && (b.preventDefault(), b.returnValue = !0);
|
|
1063
1069
|
};
|
|
1064
|
-
return window.addEventListener("beforeunload",
|
|
1070
|
+
return window.addEventListener("beforeunload", w), () => window.removeEventListener("beforeunload", w);
|
|
1065
1071
|
}, [c, e]);
|
|
1066
|
-
const f = re(e.subscribe, e.discardRequest, Wo),
|
|
1072
|
+
const f = re(e.subscribe, e.discardRequest, Wo), g = a.state === "blocked", l = g ? o.current : f === null ? [] : f.paths, u = l.map((w) => ce(w)).join(", "), p = l.length > 0 && l.every((w) => e.session(w)?.save.kind === "draft");
|
|
1067
1073
|
return /* @__PURE__ */ s(
|
|
1068
|
-
|
|
1074
|
+
Fn,
|
|
1069
1075
|
{
|
|
1070
|
-
open:
|
|
1076
|
+
open: g || f !== null,
|
|
1071
1077
|
title: p ? t.draftDiscardTitle : t.unsavedTitle,
|
|
1072
1078
|
body: p ? t.draftDiscardBody(u) : t.unsavedBody(u),
|
|
1073
1079
|
confirmLabel: t.unsavedDiscard,
|
|
@@ -1113,7 +1119,7 @@ function Yo({
|
|
|
1113
1119
|
}
|
|
1114
1120
|
const Xo = /* @__PURE__ */ y.forwardRef(Yo);
|
|
1115
1121
|
let tt = null;
|
|
1116
|
-
const Hn = () => (tt ??= import("./EditSurface-
|
|
1122
|
+
const Hn = () => (tt ??= import("./EditSurface-CFXG8Qok.js").catch((e) => {
|
|
1117
1123
|
throw tt = null, e;
|
|
1118
1124
|
}), tt), Jo = () => {
|
|
1119
1125
|
Hn().catch(() => {
|
|
@@ -1132,15 +1138,15 @@ class ei extends En {
|
|
|
1132
1138
|
return this.state.failed ? this.props.fallback(this.retry) : this.props.children;
|
|
1133
1139
|
}
|
|
1134
1140
|
}
|
|
1135
|
-
const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = '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], [data-aqmd-svg-image-source]', ri = 200,
|
|
1141
|
+
const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = '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], [data-aqmd-svg-image-source]', ri = 200, Ce = (e) => ro(e.getAttribute(Rn)), oi = (e, t) => {
|
|
1136
1142
|
for (let r = e; r !== null && t.contains(r); r = r.parentElement) {
|
|
1137
|
-
const o =
|
|
1143
|
+
const o = Ce(r);
|
|
1138
1144
|
if (o !== null) return { block: r, lines: o, own: !0 };
|
|
1139
1145
|
}
|
|
1140
1146
|
let n = null;
|
|
1141
1147
|
for (const r of t.querySelectorAll(Et)) {
|
|
1142
1148
|
if (!(r.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING)) break;
|
|
1143
|
-
const o =
|
|
1149
|
+
const o = Ce(r);
|
|
1144
1150
|
o !== null && (n = { block: r, lines: o });
|
|
1145
1151
|
}
|
|
1146
1152
|
return n === null ? null : { ...n, own: !1 };
|
|
@@ -1161,11 +1167,11 @@ const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = 'a[href], button, input,
|
|
|
1161
1167
|
}, si = (e, t) => {
|
|
1162
1168
|
let n = null, r = null, o = null;
|
|
1163
1169
|
for (const a of e.querySelectorAll(Et)) {
|
|
1164
|
-
const c =
|
|
1170
|
+
const c = Ce(a);
|
|
1165
1171
|
if (c === null) continue;
|
|
1166
1172
|
n ??= di(t, a);
|
|
1167
|
-
const { top: f, bottom:
|
|
1168
|
-
f <= n && n <
|
|
1173
|
+
const { top: f, bottom: g } = a.getBoundingClientRect();
|
|
1174
|
+
f <= n && n < g ? r = { lines: c, block: a } : o === null && f >= n && (o = { lines: c, block: a });
|
|
1169
1175
|
}
|
|
1170
1176
|
const i = r === null ? o : r;
|
|
1171
1177
|
return i === null ? null : { lines: i.lines, word: null, occurrence: 0, clientTop: Be(i.block) };
|
|
@@ -1187,8 +1193,8 @@ const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = 'a[href], button, input,
|
|
|
1187
1193
|
let a = 0;
|
|
1188
1194
|
for (let c = r; c <= o; c += 1) {
|
|
1189
1195
|
const f = n[c - 1] ?? "";
|
|
1190
|
-
for (let
|
|
1191
|
-
if (a === t.occurrence) return { line: c, column:
|
|
1196
|
+
for (let g = f.indexOf(t.word); g >= 0; g = f.indexOf(t.word, g + t.word.length)) {
|
|
1197
|
+
if (a === t.occurrence) return { line: c, column: g };
|
|
1192
1198
|
a += 1;
|
|
1193
1199
|
}
|
|
1194
1200
|
}
|
|
@@ -1202,12 +1208,12 @@ const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = 'a[href], button, input,
|
|
|
1202
1208
|
}, mi = (e, t) => {
|
|
1203
1209
|
let n = null, r = null;
|
|
1204
1210
|
for (const o of e.querySelectorAll(Et)) {
|
|
1205
|
-
const i =
|
|
1211
|
+
const i = Ce(o);
|
|
1206
1212
|
i === null || i.first > t || (i.last >= t ? n = o : (r === null || i.last >= r.last) && (r = { element: o, last: i.last }));
|
|
1207
1213
|
}
|
|
1208
1214
|
return n !== null ? n : r === null ? null : r.element;
|
|
1209
1215
|
}, hi = (e, t) => {
|
|
1210
|
-
const { bottom: n } = e.getBoundingClientRect(), r = Be(e), o =
|
|
1216
|
+
const { bottom: n } = e.getBoundingClientRect(), r = Be(e), o = Ce(e);
|
|
1211
1217
|
if (o === null) return r;
|
|
1212
1218
|
const i = Math.min(Math.max(t - o.first, 0) / (o.last - o.first + 1), 1);
|
|
1213
1219
|
return r + (n - r) * i;
|
|
@@ -1229,7 +1235,7 @@ const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = 'a[href], button, input,
|
|
|
1229
1235
|
"follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
|
|
1230
1236
|
}), sc = (e) => yt[e], Ve = () => {
|
|
1231
1237
|
const e = kr();
|
|
1232
|
-
return
|
|
1238
|
+
return q(
|
|
1233
1239
|
(t, n) => {
|
|
1234
1240
|
e(t, yt[n]);
|
|
1235
1241
|
},
|
|
@@ -1245,21 +1251,21 @@ const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = 'a[href], button, input,
|
|
|
1245
1251
|
t.activeElement !== e && (e.removeAttribute("tabindex"), e.removeEventListener("blur", n));
|
|
1246
1252
|
};
|
|
1247
1253
|
return e.addEventListener("blur", n), !0;
|
|
1248
|
-
},
|
|
1249
|
-
const n = B(null), r = B(null), o = B(null), i =
|
|
1254
|
+
}, gi = (e, t) => {
|
|
1255
|
+
const n = B(null), r = B(null), o = B(null), i = q(() => {
|
|
1250
1256
|
n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
|
|
1251
1257
|
}, []);
|
|
1252
1258
|
ee(() => i, [i]);
|
|
1253
|
-
const a =
|
|
1254
|
-
(
|
|
1255
|
-
if (r.current !==
|
|
1259
|
+
const a = q(
|
|
1260
|
+
(g) => {
|
|
1261
|
+
if (r.current !== g) return;
|
|
1256
1262
|
const l = o.current;
|
|
1257
1263
|
if (l !== null) {
|
|
1258
|
-
l.then(() => a(
|
|
1264
|
+
l.then(() => a(g));
|
|
1259
1265
|
return;
|
|
1260
1266
|
}
|
|
1261
|
-
e.prefetch(
|
|
1262
|
-
const u = e.peek(
|
|
1267
|
+
e.prefetch(g);
|
|
1268
|
+
const u = e.peek(g);
|
|
1263
1269
|
if (u?.status !== "pending") return;
|
|
1264
1270
|
const p = Promise.allSettled([u.promise]);
|
|
1265
1271
|
o.current = p, p.then(() => {
|
|
@@ -1267,30 +1273,30 @@ const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = 'a[href], button, input,
|
|
|
1267
1273
|
});
|
|
1268
1274
|
},
|
|
1269
1275
|
[e]
|
|
1270
|
-
), c =
|
|
1271
|
-
(
|
|
1272
|
-
const l = t(
|
|
1276
|
+
), c = q(
|
|
1277
|
+
(g) => {
|
|
1278
|
+
const l = t(g);
|
|
1273
1279
|
l !== r.current && (i(), l !== null && (r.current = l, n.current = window.setTimeout(() => {
|
|
1274
1280
|
n.current = null, a(l);
|
|
1275
1281
|
}, Mr)));
|
|
1276
1282
|
},
|
|
1277
1283
|
[i, t, a]
|
|
1278
|
-
), f =
|
|
1279
|
-
(
|
|
1280
|
-
t(
|
|
1284
|
+
), f = q(
|
|
1285
|
+
(g) => {
|
|
1286
|
+
t(g) !== r.current && i();
|
|
1281
1287
|
},
|
|
1282
1288
|
[i, t]
|
|
1283
1289
|
);
|
|
1284
1290
|
return Y(
|
|
1285
1291
|
() => ({
|
|
1286
|
-
onPointerOver: (
|
|
1287
|
-
onPointerOut: (
|
|
1288
|
-
onFocus: (
|
|
1289
|
-
onBlur: (
|
|
1292
|
+
onPointerOver: (g) => c(g.target),
|
|
1293
|
+
onPointerOut: (g) => f(g.relatedTarget),
|
|
1294
|
+
onFocus: (g) => c(g.target),
|
|
1295
|
+
onBlur: (g) => f(g.relatedTarget)
|
|
1290
1296
|
}),
|
|
1291
1297
|
[c, f]
|
|
1292
1298
|
);
|
|
1293
|
-
},
|
|
1299
|
+
}, wi = gt(() => import("./NativeScrollBar-s_uSPPEd.js").then((e) => ({ default: e.NativeScrollBar })));
|
|
1294
1300
|
class vi extends En {
|
|
1295
1301
|
state = { failed: !1 };
|
|
1296
1302
|
static getDerivedStateFromError() {
|
|
@@ -1303,7 +1309,7 @@ class vi extends En {
|
|
|
1303
1309
|
return this.state.failed ? null : this.props.children;
|
|
1304
1310
|
}
|
|
1305
1311
|
}
|
|
1306
|
-
const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children: /* @__PURE__ */ s(xe, { fallback: null, children: /* @__PURE__ */ s(
|
|
1312
|
+
const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children: /* @__PURE__ */ s(xe, { fallback: null, children: /* @__PURE__ */ s(wi, { scroller: e, withCircle: t }) }) }), zn = (e) => /* @__PURE__ */ s(bi, { scroller: e, withCircle: !0 }), Vn = () => {
|
|
1307
1313
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
1308
1314
|
let n = !1;
|
|
1309
1315
|
const r = (o) => {
|
|
@@ -1339,32 +1345,32 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1339
1345
|
return o.length !== Object.keys(r).length ? !1 : o.every((i) => Object.hasOwn(r, i) && He(n[i], r[i]));
|
|
1340
1346
|
}, Ei = 55e3, Kt = Object.freeze({ status: "deferred" }), nt = Object.freeze({ status: "refreshed" }), rt = Object.freeze({ status: "shown", failed: !1 }), Ne = Object.freeze({ status: "shown", failed: !0 }), De = Object.freeze({ status: "superseded" }), fe = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, yi = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", Si = ({ client: e, capacity: t }) => {
|
|
1341
1347
|
if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
|
|
1342
|
-
const n = /* @__PURE__ */ new Map(), r = Vn(), o =
|
|
1343
|
-
let
|
|
1344
|
-
const l = o.emit, u = () => (
|
|
1348
|
+
const n = /* @__PURE__ */ new Map(), r = Vn(), o = Oe(), i = /* @__PURE__ */ new WeakSet(), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
1349
|
+
let g = 0;
|
|
1350
|
+
const l = o.emit, u = () => (g += 1, g), p = () => {
|
|
1345
1351
|
if (!(n.size <= t))
|
|
1346
1352
|
for (const v of [...n.keys()]) {
|
|
1347
1353
|
if (n.size <= t) return;
|
|
1348
1354
|
r.isHeld(v) || n.delete(v);
|
|
1349
1355
|
}
|
|
1350
|
-
},
|
|
1356
|
+
}, w = (v, T) => {
|
|
1351
1357
|
n.delete(v), n.set(v, T);
|
|
1352
1358
|
}, b = (v) => performance.now() - v.validatedAt >= Ei, x = (v, T, L) => {
|
|
1353
|
-
const
|
|
1354
|
-
return
|
|
1359
|
+
const C = n.get(v), P = fe(C?.snapshot), j = L || C?.refreshPending === !0, X = Re(e.document(v, { refresh: j }).then((E) => ({ status: "loaded", document: E }))), h = { snapshot: { status: "pending", promise: X, previous: P }, validatedAt: performance.now(), opened: T, background: null, refreshPending: !1, seeded: void 0, stamp: u() };
|
|
1360
|
+
return w(v, h), p(), X.then((E) => {
|
|
1355
1361
|
n.get(v) === h && (h.snapshot = E, h.stamp = u(), l());
|
|
1356
1362
|
}), h;
|
|
1357
|
-
}, R = (v, T, L,
|
|
1358
|
-
T.background === L && (T.background = null, !(n.get(v) !== T || T.snapshot !==
|
|
1363
|
+
}, R = (v, T, L, C, P, j) => {
|
|
1364
|
+
T.background === L && (T.background = null, !(n.get(v) !== T || T.snapshot !== C) && (P.kind === "failure" && C.document.kind !== "failure" || (T.validatedAt = j, T.stamp = u(), He(C.document, P) || (T.snapshot = { status: "loaded", document: P }), l())));
|
|
1359
1365
|
}, A = async (v, T) => {
|
|
1360
1366
|
const L = T.snapshot;
|
|
1361
1367
|
if (L.status !== "loaded") return null;
|
|
1362
|
-
const
|
|
1363
|
-
T.background =
|
|
1368
|
+
const C = {};
|
|
1369
|
+
T.background = C;
|
|
1364
1370
|
const P = performance.now(), j = e.document(v, { refresh: T.refreshPending });
|
|
1365
1371
|
T.refreshPending = !1;
|
|
1366
|
-
const X = await j, h = T.background ===
|
|
1367
|
-
return R(v, T,
|
|
1372
|
+
const X = await j, h = T.background === C && n.get(v) === T && T.snapshot === L;
|
|
1373
|
+
return R(v, T, C, L, X, P), h ? X : null;
|
|
1368
1374
|
}, N = (v, T) => {
|
|
1369
1375
|
const { snapshot: L } = T;
|
|
1370
1376
|
return L.status === "pending" ? !1 : L.status === "loaded" && L.document.kind !== "failure" ? (A(v, T), !1) : (L.status === "loaded" && i.add(L), x(v, !0, !1), !0);
|
|
@@ -1380,8 +1386,8 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1380
1386
|
L();
|
|
1381
1387
|
return;
|
|
1382
1388
|
}
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1389
|
+
const C = f.get(v);
|
|
1390
|
+
C === void 0 ? f.set(v, /* @__PURE__ */ new Set([L])) : C.add(L);
|
|
1385
1391
|
}), d = (v, T) => {
|
|
1386
1392
|
const L = a.get(v);
|
|
1387
1393
|
if (L === void 0) {
|
|
@@ -1394,36 +1400,36 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1394
1400
|
}
|
|
1395
1401
|
L.waiters.add(T);
|
|
1396
1402
|
}, m = async (v, T, L) => {
|
|
1397
|
-
const
|
|
1403
|
+
const C = await new Promise((P) => d(v, { stamp: T.stamp, resolve: P }));
|
|
1398
1404
|
if (n.get(v) !== T) return De;
|
|
1399
|
-
if (
|
|
1400
|
-
if (!L) return
|
|
1401
|
-
switch (
|
|
1405
|
+
if (C === null) return L ? nt : rt;
|
|
1406
|
+
if (!L) return C.failure === null ? rt : Ne;
|
|
1407
|
+
switch (C.before) {
|
|
1402
1408
|
case "copy":
|
|
1403
|
-
return
|
|
1409
|
+
return C.failure === null ? nt : { status: "failed", failure: C.failure };
|
|
1404
1410
|
case "failure":
|
|
1405
|
-
return
|
|
1411
|
+
return C.failure === null ? rt : Ne;
|
|
1406
1412
|
case "none":
|
|
1407
|
-
return
|
|
1413
|
+
return C.failure === null ? nt : Ne;
|
|
1408
1414
|
}
|
|
1409
1415
|
}, k = (v) => {
|
|
1410
1416
|
const T = { showing: "none", last: null, waiters: /* @__PURE__ */ new Set() };
|
|
1411
1417
|
a.set(v, T);
|
|
1412
1418
|
let L = !1;
|
|
1413
1419
|
return {
|
|
1414
|
-
settle: (
|
|
1415
|
-
if (L ||
|
|
1416
|
-
const j = { stamp:
|
|
1420
|
+
settle: (C, P) => {
|
|
1421
|
+
if (L || C === void 0) return;
|
|
1422
|
+
const j = { stamp: C, failure: P, before: T.showing };
|
|
1417
1423
|
T.last = j, P === null ? T.showing = "copy" : T.showing === "none" && (T.showing = "failure");
|
|
1418
1424
|
for (const X of [...T.waiters])
|
|
1419
|
-
|
|
1425
|
+
C < X.stamp || (T.waiters.delete(X), X.resolve(j));
|
|
1420
1426
|
},
|
|
1421
1427
|
release: () => {
|
|
1422
1428
|
if (L) return;
|
|
1423
1429
|
L = !0, a.get(v) === T && a.delete(v);
|
|
1424
|
-
const
|
|
1425
|
-
T.waiters.clear(),
|
|
1426
|
-
for (const P of
|
|
1430
|
+
const C = [...T.waiters];
|
|
1431
|
+
T.waiters.clear(), C.length > 0 && queueMicrotask(() => {
|
|
1432
|
+
for (const P of C) d(v, P);
|
|
1427
1433
|
});
|
|
1428
1434
|
}
|
|
1429
1435
|
};
|
|
@@ -1433,8 +1439,8 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1433
1439
|
return () => {
|
|
1434
1440
|
if (L) return;
|
|
1435
1441
|
L = !0, T();
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1442
|
+
const C = n.get(v);
|
|
1443
|
+
C !== void 0 && w(v, C), p(), r.isHeld(v) || queueMicrotask(() => {
|
|
1438
1444
|
r.isHeld(v) || _(v);
|
|
1439
1445
|
});
|
|
1440
1446
|
};
|
|
@@ -1448,12 +1454,12 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1448
1454
|
T !== void 0 && T.snapshot.status !== "deferred" || (x(v, !1, !1), l());
|
|
1449
1455
|
},
|
|
1450
1456
|
open: (v) => {
|
|
1451
|
-
const T = r.resumes(v), L = M(v),
|
|
1452
|
-
if (
|
|
1457
|
+
const T = r.resumes(v), L = M(v), C = n.get(v);
|
|
1458
|
+
if (C === void 0 || C.snapshot.status === "deferred")
|
|
1453
1459
|
return x(v, !0, !1), l(), L;
|
|
1454
|
-
if (
|
|
1455
|
-
const { snapshot: P } =
|
|
1456
|
-
return P.status === "pending" ? (
|
|
1460
|
+
if (w(v, C), T) return L;
|
|
1461
|
+
const { snapshot: P } = C;
|
|
1462
|
+
return P.status === "pending" ? (C.opened = !0, L) : P.document.kind === "failure" ? (C.opened || b(C) ? (i.add(P), x(v, !0, !1), l()) : C.opened = !0, L) : (C.opened = !0, C.background === null && b(C) && A(v, C), L);
|
|
1457
1463
|
},
|
|
1458
1464
|
retain: M,
|
|
1459
1465
|
retry: (v) => {
|
|
@@ -1461,7 +1467,7 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1461
1467
|
T === void 0 || T.snapshot.status !== "loaded" || T.snapshot.document.kind !== "failure" || (x(v, !0, !1), l());
|
|
1462
1468
|
},
|
|
1463
1469
|
seed: (v, T) => {
|
|
1464
|
-
const L = performance.now(),
|
|
1470
|
+
const L = performance.now(), C = Re(
|
|
1465
1471
|
T.then(
|
|
1466
1472
|
(E) => E === null ? Kt : { status: "loaded", document: E },
|
|
1467
1473
|
() => Kt
|
|
@@ -1469,17 +1475,17 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1469
1475
|
), P = n.get(v);
|
|
1470
1476
|
if (P !== void 0 && P.snapshot.status === "loaded") {
|
|
1471
1477
|
const E = P.snapshot, S = {};
|
|
1472
|
-
P.background = S,
|
|
1473
|
-
if (
|
|
1474
|
-
R(v, P, S, E,
|
|
1478
|
+
P.background = S, C.then((O) => {
|
|
1479
|
+
if (O.status === "loaded") {
|
|
1480
|
+
R(v, P, S, E, O.document, L);
|
|
1475
1481
|
return;
|
|
1476
1482
|
}
|
|
1477
1483
|
P.background === S && (P.background = null);
|
|
1478
1484
|
});
|
|
1479
1485
|
return;
|
|
1480
1486
|
}
|
|
1481
|
-
const j = P !== void 0 && P.snapshot.status === "pending" ? P.snapshot.previous : null, X = { status: "pending", promise:
|
|
1482
|
-
|
|
1487
|
+
const j = P !== void 0 && P.snapshot.status === "pending" ? P.snapshot.previous : null, X = { status: "pending", promise: C, previous: j }, h = { snapshot: X, validatedAt: L, opened: P?.opened === !0, background: null, refreshPending: P?.refreshPending === !0, seeded: X, stamp: u() };
|
|
1488
|
+
w(v, h), p(), C.then((E) => {
|
|
1483
1489
|
n.get(v) === h && (E.status === "deferred" && r.isHeld(v) ? x(v, h.opened, !1) : (h.snapshot = E, h.stamp = u()), l());
|
|
1484
1490
|
});
|
|
1485
1491
|
},
|
|
@@ -1487,12 +1493,12 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1487
1493
|
let v = !1;
|
|
1488
1494
|
for (const [T, L] of [...n]) {
|
|
1489
1495
|
if (L.validatedAt = Number.NEGATIVE_INFINITY, L.opened = !0, L.refreshPending = !0, !r.isHeld(T)) continue;
|
|
1490
|
-
const { snapshot:
|
|
1491
|
-
if (
|
|
1496
|
+
const { snapshot: C } = L;
|
|
1497
|
+
if (C.status !== "pending") {
|
|
1492
1498
|
N(T, L) && (v = !0);
|
|
1493
1499
|
continue;
|
|
1494
1500
|
}
|
|
1495
|
-
|
|
1501
|
+
C.promise.then(() => {
|
|
1496
1502
|
n.get(T) === L && L.refreshPending && r.isHeld(T) && N(T, L) && l();
|
|
1497
1503
|
});
|
|
1498
1504
|
}
|
|
@@ -1507,8 +1513,8 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1507
1513
|
}
|
|
1508
1514
|
const L = x(v, !0, !0);
|
|
1509
1515
|
if (l(), L.snapshot.status !== "pending") return De;
|
|
1510
|
-
const
|
|
1511
|
-
return n.get(v) !== L ||
|
|
1516
|
+
const C = await L.snapshot.promise;
|
|
1517
|
+
return n.get(v) !== L || C.status !== "loaded" ? De : C.document.kind === "failure" ? Ne : (await D(v, C), m(v, L, !1));
|
|
1512
1518
|
},
|
|
1513
1519
|
clear: () => {
|
|
1514
1520
|
n.clear();
|
|
@@ -1522,7 +1528,7 @@ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children:
|
|
|
1522
1528
|
const L = f.get(v);
|
|
1523
1529
|
if (L !== void 0) {
|
|
1524
1530
|
f.delete(v);
|
|
1525
|
-
for (const
|
|
1531
|
+
for (const C of L) C();
|
|
1526
1532
|
}
|
|
1527
1533
|
},
|
|
1528
1534
|
noteFailureShown: (v) => i.has(v) ? !1 : (i.add(v), !0)
|
|
@@ -1556,8 +1562,8 @@ function Ri({
|
|
|
1556
1562
|
clipRule: "evenodd"
|
|
1557
1563
|
}));
|
|
1558
1564
|
}
|
|
1559
|
-
const
|
|
1560
|
-
function
|
|
1565
|
+
const Ci = /* @__PURE__ */ y.forwardRef(Ri);
|
|
1566
|
+
function Oi({
|
|
1561
1567
|
title: e,
|
|
1562
1568
|
titleId: t,
|
|
1563
1569
|
...n
|
|
@@ -1580,7 +1586,7 @@ function Ci({
|
|
|
1580
1586
|
d: "M3.5 6A1.5 1.5 0 0 0 2 7.5v9A1.5 1.5 0 0 0 3.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L8.44 6.439A1.5 1.5 0 0 0 7.378 6H3.5Z"
|
|
1581
1587
|
}));
|
|
1582
1588
|
}
|
|
1583
|
-
const Mi = /* @__PURE__ */ y.forwardRef(
|
|
1589
|
+
const Mi = /* @__PURE__ */ y.forwardRef(Oi);
|
|
1584
1590
|
function Li({
|
|
1585
1591
|
title: e,
|
|
1586
1592
|
titleId: t,
|
|
@@ -1606,7 +1612,7 @@ const Ai = /* @__PURE__ */ y.forwardRef(Li), Ni = 2e3, Yt = Object.freeze({ outc
|
|
|
1606
1612
|
const t = navigator.clipboard;
|
|
1607
1613
|
return t === void 0 ? Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")) : t.writeText(e);
|
|
1608
1614
|
}, Pi = ({ text: e }) => {
|
|
1609
|
-
const { announcer: t, labels: n } =
|
|
1615
|
+
const { announcer: t, labels: n } = $(), [r, o] = U(Yt);
|
|
1610
1616
|
ee(() => {
|
|
1611
1617
|
if (r.outcome === "idle") return;
|
|
1612
1618
|
const f = setTimeout(() => o(Yt), Ni);
|
|
@@ -1621,14 +1627,14 @@ const Ai = /* @__PURE__ */ y.forwardRef(Li), Ni = 2e3, Yt = Object.freeze({ outc
|
|
|
1621
1627
|
);
|
|
1622
1628
|
}, c = r.outcome === "copied" ? n.copiedText : r.outcome === "failed" ? n.copyTextFailed : n.copyText;
|
|
1623
1629
|
return (
|
|
1624
|
-
/* @__PURE__ */ s("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: c, onClick: a, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ s(
|
|
1630
|
+
/* @__PURE__ */ s("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: c, onClick: a, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ s(Ci, {}) : r.outcome === "failed" ? /* @__PURE__ */ s(Ai, {}) : /* @__PURE__ */ s(Mi, {}) })
|
|
1625
1631
|
);
|
|
1626
|
-
}, Un = he(null),
|
|
1632
|
+
}, Un = he(null), Ii = () => {
|
|
1627
1633
|
const e = oe(Un);
|
|
1628
1634
|
if (e === null) throw new Error("[markdown-explorer] a document's content reads its own part only inside a document pane (DocumentContentChannelContext)");
|
|
1629
1635
|
return e;
|
|
1630
1636
|
};
|
|
1631
|
-
function
|
|
1637
|
+
function $i({
|
|
1632
1638
|
title: e,
|
|
1633
1639
|
titleId: t,
|
|
1634
1640
|
...n
|
|
@@ -1649,8 +1655,8 @@ function Fi({
|
|
|
1649
1655
|
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"
|
|
1650
1656
|
}));
|
|
1651
1657
|
}
|
|
1652
|
-
const
|
|
1653
|
-
function
|
|
1658
|
+
const Fi = /* @__PURE__ */ y.forwardRef($i);
|
|
1659
|
+
function qi({
|
|
1654
1660
|
title: e,
|
|
1655
1661
|
titleId: t,
|
|
1656
1662
|
...n
|
|
@@ -1675,14 +1681,14 @@ function Ii({
|
|
|
1675
1681
|
clipRule: "evenodd"
|
|
1676
1682
|
}));
|
|
1677
1683
|
}
|
|
1678
|
-
const _i = /* @__PURE__ */ y.forwardRef(
|
|
1679
|
-
const { labels: i } =
|
|
1684
|
+
const _i = /* @__PURE__ */ y.forwardRef(qi), Le = ({ name: e, openUrl: t, downloadUrl: n, icon: r, children: o }) => {
|
|
1685
|
+
const { labels: i } = $();
|
|
1680
1686
|
return /* @__PURE__ */ H("div", { className: "aqmx-document-toolbar", children: [
|
|
1681
1687
|
/* @__PURE__ */ s("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: r }),
|
|
1682
1688
|
/* @__PURE__ */ s("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
|
|
1683
1689
|
o,
|
|
1684
1690
|
/* @__PURE__ */ s("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__ */ s(_i, {}) }),
|
|
1685
|
-
/* @__PURE__ */ s("a", { className: "aqmx-icon-button", href: n, download: e, "aria-label": i.download, title: i.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ s(
|
|
1691
|
+
/* @__PURE__ */ s("a", { className: "aqmx-icon-button", href: n, download: e, "aria-label": i.download, title: i.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ s(Fi, {}) })
|
|
1686
1692
|
] });
|
|
1687
1693
|
};
|
|
1688
1694
|
function Bi({
|
|
@@ -1707,7 +1713,7 @@ function Bi({
|
|
|
1707
1713
|
}));
|
|
1708
1714
|
}
|
|
1709
1715
|
const Hi = /* @__PURE__ */ y.forwardRef(Bi), ji = Object.freeze({ className: "aqmx-document-stage" }), zi = ({ document: e }) => {
|
|
1710
|
-
const { labels: t } =
|
|
1716
|
+
const { labels: t } = $();
|
|
1711
1717
|
return /* @__PURE__ */ H("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
|
|
1712
1718
|
/* @__PURE__ */ s(Le, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ s(Hi, {}) }),
|
|
1713
1719
|
/* @__PURE__ */ s(Me, { scrollerProps: ji, children: /* @__PURE__ */ H("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
|
|
@@ -1899,13 +1905,13 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
1899
1905
|
t.target === e && (e = null);
|
|
1900
1906
|
}
|
|
1901
1907
|
};
|
|
1902
|
-
},
|
|
1908
|
+
}, Fe = Object.freeze([1 / be ** 2, 1 / be, 1, be, be ** 2]), en = Object.freeze({ mode: "fit" }), da = 1, Kn = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), tn = `[data-testid="${Kn["data-testid"]}"]`, ua = he(null), fa = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= da ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, nn = (e, t, n) => {
|
|
1903
1909
|
if (e.mode === "level") {
|
|
1904
1910
|
const o = e.index + n;
|
|
1905
|
-
return o >= 0 && o <
|
|
1911
|
+
return o >= 0 && o < Fe.length ? o : null;
|
|
1906
1912
|
}
|
|
1907
1913
|
if (t === null || !Number.isFinite(t) || t <= 0) return null;
|
|
1908
|
-
const r = n === 1 ?
|
|
1914
|
+
const r = n === 1 ? Fe.findIndex((o) => o > t) : Fe.findLastIndex((o) => o < t);
|
|
1909
1915
|
return r === -1 ? null : r;
|
|
1910
1916
|
}, rn = (e, t, n) => {
|
|
1911
1917
|
if (e.mode === "level") {
|
|
@@ -1923,14 +1929,14 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
1923
1929
|
const t = e[0], n = e[1];
|
|
1924
1930
|
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 } };
|
|
1925
1931
|
}, ha = (e) => {
|
|
1926
|
-
const t =
|
|
1932
|
+
const t = Fe[e];
|
|
1927
1933
|
if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
|
|
1928
1934
|
return t;
|
|
1929
1935
|
}, an = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, pa = ({ document: e }) => {
|
|
1930
|
-
const { labels: t } =
|
|
1936
|
+
const { labels: t } = $(), n = oe(ua), [r] = U(() => n === null ? null : n.read(e.url)), [o, i] = U(r === null ? en : r.zoom), [a, c] = U(r === null ? null : r.reported), [f, g] = U(null), l = B(null), u = q((D) => {
|
|
1931
1937
|
const { naturalWidth: d, naturalHeight: m } = D;
|
|
1932
1938
|
c((k) => an(k, d, m));
|
|
1933
|
-
}, []), p =
|
|
1939
|
+
}, []), p = q(
|
|
1934
1940
|
(D) => {
|
|
1935
1941
|
l.current = D, !(D === null || !D.complete) && (D.naturalWidth > 0 || D.naturalHeight > 0 ? u(D) : D.decode().then(
|
|
1936
1942
|
() => u(D),
|
|
@@ -1945,12 +1951,12 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
1945
1951
|
}, [n, e.url, o, a]), K(() => {
|
|
1946
1952
|
const D = l.current;
|
|
1947
1953
|
if (D === null || a === null || o.mode !== "fit") return;
|
|
1948
|
-
const d = () =>
|
|
1954
|
+
const d = () => g((k) => an(k, D.clientWidth, D.clientHeight));
|
|
1949
1955
|
if (d(), typeof ResizeObserver > "u") return;
|
|
1950
1956
|
const m = new ResizeObserver(d);
|
|
1951
1957
|
return m.observe(D), () => m.disconnect();
|
|
1952
1958
|
}, [a, o.mode]);
|
|
1953
|
-
const
|
|
1959
|
+
const w = a === null || f === null ? null : fa(a, f), b = rn(o, w, -1), x = rn(o, w, 1), R = o.mode === "level" ? ha(o.index) : null, A = B({ zoomIn: x, zoomOut: b });
|
|
1954
1960
|
K(() => {
|
|
1955
1961
|
A.current = { zoomIn: x, zoomOut: b };
|
|
1956
1962
|
});
|
|
@@ -1962,22 +1968,22 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
1962
1968
|
const D = l.current?.closest(tn);
|
|
1963
1969
|
if (D == null) return;
|
|
1964
1970
|
let d = null;
|
|
1965
|
-
const m = (
|
|
1966
|
-
const
|
|
1967
|
-
d =
|
|
1968
|
-
}, k = (
|
|
1969
|
-
const
|
|
1970
|
-
if (d === null ||
|
|
1971
|
-
|
|
1972
|
-
const v = ma(d.distance,
|
|
1971
|
+
const m = (I) => {
|
|
1972
|
+
const F = on(I.touches);
|
|
1973
|
+
d = F === null ? null : { distance: F.distance, steps: 0 };
|
|
1974
|
+
}, k = (I) => {
|
|
1975
|
+
const F = on(I.touches);
|
|
1976
|
+
if (d === null || F === null) return;
|
|
1977
|
+
I.preventDefault();
|
|
1978
|
+
const v = ma(d.distance, F.distance);
|
|
1973
1979
|
if (v === d.steps) return;
|
|
1974
1980
|
const T = v > d.steps ? 1 : -1, L = T === 1 ? A.current.zoomIn : A.current.zoomOut;
|
|
1975
1981
|
if (L === null) return;
|
|
1976
1982
|
d.steps += T;
|
|
1977
|
-
const
|
|
1983
|
+
const C = D.getBoundingClientRect(), P = F.middle.x - C.left, j = F.middle.y - C.top;
|
|
1978
1984
|
N.current = D.scrollWidth > 0 && D.scrollHeight > 0 ? { x: P, y: j, across: (D.scrollLeft + P) / D.scrollWidth, down: (D.scrollTop + j) / D.scrollHeight } : null, i(L);
|
|
1979
|
-
}, M = (
|
|
1980
|
-
|
|
1985
|
+
}, M = (I) => {
|
|
1986
|
+
I.touches.length < 2 && (d = null);
|
|
1981
1987
|
};
|
|
1982
1988
|
return D.addEventListener("touchstart", m, { passive: !0 }), D.addEventListener("touchmove", k, { passive: !1 }), D.addEventListener("touchend", M, { passive: !0 }), D.addEventListener("touchcancel", M, { passive: !0 }), () => {
|
|
1983
1989
|
D.removeEventListener("touchstart", m), D.removeEventListener("touchmove", k), D.removeEventListener("touchend", M), D.removeEventListener("touchcancel", M);
|
|
@@ -2021,7 +2027,7 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
2021
2027
|
] }),
|
|
2022
2028
|
/* @__PURE__ */ s(Me, { scrollerProps: Kn, children: /* @__PURE__ */ s("img", { ref: p, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: _, onLoad: (D) => u(D.currentTarget), "data-testid": "markdown-explorer-image" }) })
|
|
2023
2029
|
] });
|
|
2024
|
-
},
|
|
2030
|
+
}, ga = async (e, t, n) => {
|
|
2025
2031
|
const r = await e.text(t, n);
|
|
2026
2032
|
if (!("kind" in r)) throw n.reason;
|
|
2027
2033
|
return r.kind === "text" ? { kind: "text", text: r.text, truncated: r.truncated } : { kind: "failure", retryable: r.failure.reason === "failed" };
|
|
@@ -2029,19 +2035,19 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
2029
2035
|
const e = oe(Yn);
|
|
2030
2036
|
if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
|
|
2031
2037
|
return e;
|
|
2032
|
-
},
|
|
2038
|
+
}, wa = () => {
|
|
2033
2039
|
const e = oe(Xn);
|
|
2034
2040
|
if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
|
|
2035
2041
|
return e;
|
|
2036
2042
|
}, Ke = (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 }), va = ({ children: e }) => {
|
|
2037
|
-
const { config: t } =
|
|
2043
|
+
const { config: t } = $(), n = We(), r = bt(), o = r.kind === "location" ? r.location.source : void 0, i = ze(Ke(t, n.navigation, o, n.currentPath));
|
|
2038
2044
|
return /* @__PURE__ */ s(Ge, { value: o, children: /* @__PURE__ */ s(Xn, { value: i, children: e }) });
|
|
2039
2045
|
}, ba = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', Ea = (e) => {
|
|
2040
2046
|
const t = e instanceof Element ? e.closest(ba) : null;
|
|
2041
2047
|
return t === null ? null : t.getAttribute("data-doc-path");
|
|
2042
2048
|
}, Ye = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, ya = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: i, onDocumentLink: a, scope: c, children: f }) => {
|
|
2043
|
-
const
|
|
2044
|
-
return /* @__PURE__ */ s("a", { ...i, href:
|
|
2049
|
+
const g = ze(e);
|
|
2050
|
+
return /* @__PURE__ */ s("a", { ...i, href: g, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (u) => {
|
|
2045
2051
|
if (Ye(u)) {
|
|
2046
2052
|
if (u.preventDefault(), t === c.currentPath && n !== "") {
|
|
2047
2053
|
c.scrollWithin(n);
|
|
@@ -2051,10 +2057,10 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
2051
2057
|
}
|
|
2052
2058
|
}, children: f });
|
|
2053
2059
|
}, Sa = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: i }) => {
|
|
2054
|
-
const { config: a } =
|
|
2055
|
-
return l.kind === "page" ? /* @__PURE__ */ s(pi, { ...o, to: u, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": p, children: i }) : /* @__PURE__ */ s(ya, { to: u, docPath: t, fragment:
|
|
2060
|
+
const { config: a } = $(), c = We(), f = oe(Ge), g = Vi(e), { navigation: l } = c, u = `${Ke(a, l, f, t)}${g}`, p = n === !1 ? "false" : void 0;
|
|
2061
|
+
return l.kind === "page" ? /* @__PURE__ */ s(pi, { ...o, to: u, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": p, children: i }) : /* @__PURE__ */ s(ya, { to: u, docPath: t, fragment: g, exists: p, className: r, attributes: o, onDocumentLink: l.onDocumentLink, scope: c, children: i });
|
|
2056
2062
|
}, ka = ({ className: e, attributes: t, children: n }) => {
|
|
2057
|
-
const { labels: r } =
|
|
2063
|
+
const { labels: r } = $();
|
|
2058
2064
|
return (
|
|
2059
2065
|
/* @__PURE__ */ H("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: [
|
|
2060
2066
|
n,
|
|
@@ -2066,9 +2072,9 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
2066
2072
|
] })
|
|
2067
2073
|
);
|
|
2068
2074
|
}, xa = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
|
|
2069
|
-
const { config: i } =
|
|
2070
|
-
return /* @__PURE__ */ s("a", { ...n, href: c, className: t, onClick: (
|
|
2071
|
-
Ye(
|
|
2075
|
+
const { config: i } = $(), a = oe(Ge), c = ze(`${Ke(i, r.navigation, a, r.currentPath)}${e}`);
|
|
2076
|
+
return /* @__PURE__ */ s("a", { ...n, href: c, className: t, onClick: (g) => {
|
|
2077
|
+
Ye(g) && (g.preventDefault(), r.scrollWithin(e));
|
|
2072
2078
|
}, children: o });
|
|
2073
2079
|
}, Ta = ({ href: e, className: t, attributes: n, children: r }) => {
|
|
2074
2080
|
const o = We();
|
|
@@ -2077,9 +2083,9 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
2077
2083
|
const c = a.currentTarget;
|
|
2078
2084
|
e === "#" ? o.followEmptyFragment(a.nativeEvent) : c.href === c.ownerDocument.URL && o.followSameUrlJump(e, a.nativeEvent);
|
|
2079
2085
|
}, children: r }) : /* @__PURE__ */ s(xa, { href: e, className: t, attributes: n, scope: o, children: r });
|
|
2080
|
-
}, Ra = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: i, children: a }) => t === "doc" ? n === void 0 || !
|
|
2081
|
-
const { config: e } =
|
|
2082
|
-
return
|
|
2086
|
+
}, Ra = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: i, children: a }) => t === "doc" ? n === void 0 || !qr(n) ? /* @__PURE__ */ s(ka, { className: o, attributes: i, children: a }) : /* @__PURE__ */ s(Sa, { href: e, docPath: n, docExists: r, className: o, attributes: i, children: a }) : e.startsWith("#") ? /* @__PURE__ */ s(Ta, { href: e, className: o, attributes: i, children: a }) : /* @__PURE__ */ s("a", { ...i, href: e, className: o, children: a }), Ca = () => {
|
|
2087
|
+
const { config: e } = $(), t = We(), n = oe(Ge), r = Ve();
|
|
2088
|
+
return q(
|
|
2083
2089
|
(o, i) => {
|
|
2084
2090
|
if (!Ye(i)) return !0;
|
|
2085
2091
|
i.preventDefault();
|
|
@@ -2088,9 +2094,9 @@ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = O
|
|
|
2088
2094
|
},
|
|
2089
2095
|
[e, t, n, r]
|
|
2090
2096
|
);
|
|
2091
|
-
},
|
|
2092
|
-
const e =
|
|
2093
|
-
return
|
|
2097
|
+
}, Oa = () => {
|
|
2098
|
+
const e = wa();
|
|
2099
|
+
return q((t) => `${e}${Zn(t.id)}`, [e]);
|
|
2094
2100
|
};
|
|
2095
2101
|
function Ma({
|
|
2096
2102
|
title: e,
|
|
@@ -2155,9 +2161,9 @@ function Da({
|
|
|
2155
2161
|
clipRule: "evenodd"
|
|
2156
2162
|
}));
|
|
2157
2163
|
}
|
|
2158
|
-
const Pa = /* @__PURE__ */ y.forwardRef(Da),
|
|
2159
|
-
},
|
|
2160
|
-
const { labels: t } =
|
|
2164
|
+
const Pa = /* @__PURE__ */ y.forwardRef(Da), Ia = Object.freeze({ className: "aqmx-document-stage" }), $a = () => () => {
|
|
2165
|
+
}, Fa = () => navigator.pdfViewerEnabled !== !1, qa = () => null, _a = ({ document: e }) => {
|
|
2166
|
+
const { labels: t } = $(), n = re($a, Fa, qa);
|
|
2161
2167
|
return n === null ? null : n ? /* @__PURE__ */ s("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" }) : /* @__PURE__ */ H("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-pdf-not-shown", children: [
|
|
2162
2168
|
/* @__PURE__ */ s("p", { className: "aqmx-callout-body", children: t.pdfNotShown }),
|
|
2163
2169
|
/* @__PURE__ */ H("div", { className: "aqmx-callout-actions", children: [
|
|
@@ -2179,7 +2185,7 @@ const Pa = /* @__PURE__ */ y.forwardRef(Da), $a = Object.freeze({ className: "aq
|
|
|
2179
2185
|
}
|
|
2180
2186
|
}
|
|
2181
2187
|
}, Ha = ({ document: e }) => {
|
|
2182
|
-
const { labels: t } =
|
|
2188
|
+
const { labels: t } = $();
|
|
2183
2189
|
switch (e.mediaType) {
|
|
2184
2190
|
case "video":
|
|
2185
2191
|
return (
|
|
@@ -2198,7 +2204,7 @@ const Pa = /* @__PURE__ */ y.forwardRef(Da), $a = Object.freeze({ className: "aq
|
|
|
2198
2204
|
}
|
|
2199
2205
|
}, ja = ({ document: e }) => /* @__PURE__ */ H("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
|
|
2200
2206
|
/* @__PURE__ */ s(Le, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: Ba(e.mediaType) }),
|
|
2201
|
-
/* @__PURE__ */ s(Me, { scrollerProps:
|
|
2207
|
+
/* @__PURE__ */ s(Me, { scrollerProps: Ia, children: /* @__PURE__ */ s(Ha, { document: e }) })
|
|
2202
2208
|
] }), xt = (e) => {
|
|
2203
2209
|
switch (e.kind) {
|
|
2204
2210
|
case "markdown":
|
|
@@ -2211,10 +2217,10 @@ const Pa = /* @__PURE__ */ y.forwardRef(Da), $a = Object.freeze({ className: "aq
|
|
|
2211
2217
|
return null;
|
|
2212
2218
|
}
|
|
2213
2219
|
}, za = (e) => {
|
|
2214
|
-
const { documents: t } =
|
|
2220
|
+
const { documents: t } = $(), n = q(() => t.peek(e), [t, e]), r = q(() => t.peekSeeded(e), [t, e]), o = re(t.subscribe, n, r), i = fe(o);
|
|
2215
2221
|
return i === null ? null : xt(i.document);
|
|
2216
2222
|
}, Va = (e) => {
|
|
2217
|
-
const { config: t } =
|
|
2223
|
+
const { config: t } = $(), n = Ve(), r = q(() => n(ye(t, { ...e, markup: !e.markup }), "browse"), [t, n, e]);
|
|
2218
2224
|
return Y(() => ({ shown: e.markup, toggle: r }), [e.markup, r]);
|
|
2219
2225
|
};
|
|
2220
2226
|
function Ua({
|
|
@@ -2290,13 +2296,13 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2290
2296
|
const n = [];
|
|
2291
2297
|
let r = 0, o = !1, i = !1;
|
|
2292
2298
|
for (const c of e) {
|
|
2293
|
-
const f = c.length > t.maxColumns ? c.slice(0, t.maxColumns) : c,
|
|
2294
|
-
if ((n.length + 1) *
|
|
2299
|
+
const f = c.length > t.maxColumns ? c.slice(0, t.maxColumns) : c, g = Math.max(r, f.length);
|
|
2300
|
+
if ((n.length + 1) * g > t.maxCells) {
|
|
2295
2301
|
i = !0;
|
|
2296
2302
|
break;
|
|
2297
2303
|
}
|
|
2298
2304
|
const l = f.some((u) => u.length > t.maxCellLength) ? f.map((u) => Ja(u, t.maxCellLength)) : f;
|
|
2299
|
-
l !== c && (o = !0), n.push(l), r =
|
|
2305
|
+
l !== c && (o = !0), n.push(l), r = g;
|
|
2300
2306
|
}
|
|
2301
2307
|
return { rows: n.map((c) => c.length === r ? c : [...c, ...Array(r - c.length).fill("")]), truncated: i || o, full: i };
|
|
2302
2308
|
}, ot = (e, t, n, r, o) => {
|
|
@@ -2329,12 +2335,12 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2329
2335
|
let f = tr;
|
|
2330
2336
|
try {
|
|
2331
2337
|
for (; ; ) {
|
|
2332
|
-
const { done:
|
|
2333
|
-
if (
|
|
2338
|
+
const { done: g, value: l } = await a.read();
|
|
2339
|
+
if (g) return ot(c.bytes(), !0, n, r, i);
|
|
2334
2340
|
const u = o - c.length();
|
|
2335
2341
|
if (c.append(l.byteLength > u ? l.subarray(0, u) : l), c.length() === o) {
|
|
2336
|
-
const
|
|
2337
|
-
return ot(c.bytes(),
|
|
2342
|
+
const w = l.byteLength <= u && await tl(a);
|
|
2343
|
+
return ot(c.bytes(), w, n, r, i);
|
|
2338
2344
|
}
|
|
2339
2345
|
if (c.length() < f) continue;
|
|
2340
2346
|
f = c.length() * 2;
|
|
@@ -2346,7 +2352,7 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2346
2352
|
});
|
|
2347
2353
|
}
|
|
2348
2354
|
}, rl = async (e, t, n, r) => {
|
|
2349
|
-
const o = await e.asset(
|
|
2355
|
+
const o = await e.asset(wt(t), r);
|
|
2350
2356
|
if (o.status === "cancelled") return null;
|
|
2351
2357
|
if (o.status === "error") return { kind: "failure", failure: o.failure };
|
|
2352
2358
|
let i;
|
|
@@ -2357,8 +2363,8 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2357
2363
|
}
|
|
2358
2364
|
return r.aborted ? null : i.kind === "table" ? { kind: "table", rows: i.table.rows, truncated: i.table.truncated } : i;
|
|
2359
2365
|
}, nr = (e, t, n) => {
|
|
2360
|
-
const { documents: r, labels: o } =
|
|
2361
|
-
if (
|
|
2366
|
+
const { documents: r, labels: o } = $(), i = Ii(), a = q(() => r.answerStampOf(e), [r, e]), c = re(r.subscribe, a, a), [f, g] = U(0), l = Y(() => ({ read: n, stamp: c, attempt: f }), [n, c, f]), [u, p] = U({ settled: null, shown: null, failure: null }), w = B(null), b = ae((A, N) => {
|
|
2367
|
+
if (w.current?.settle(N.stamp, A.kind === "failure" ? A.failure : null), A.kind === "read") {
|
|
2362
2368
|
p({ settled: N, shown: A.value, failure: null });
|
|
2363
2369
|
return;
|
|
2364
2370
|
}
|
|
@@ -2370,8 +2376,8 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2370
2376
|
});
|
|
2371
2377
|
ee(() => {
|
|
2372
2378
|
const A = i.readPart();
|
|
2373
|
-
return
|
|
2374
|
-
|
|
2379
|
+
return w.current = A, () => {
|
|
2380
|
+
w.current = null, A.release();
|
|
2375
2381
|
};
|
|
2376
2382
|
}, [i]), ee(() => {
|
|
2377
2383
|
const A = new AbortController();
|
|
@@ -2381,13 +2387,13 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2381
2387
|
}, [l]);
|
|
2382
2388
|
const x = u.settled !== l && (u.shown !== null || u.failure !== null);
|
|
2383
2389
|
K(() => x ? i.holdBusy() : void 0, [x, i]);
|
|
2384
|
-
const R =
|
|
2390
|
+
const R = q(() => g((A) => A + 1), []);
|
|
2385
2391
|
return { shown: u.shown, failure: u.failure, retry: R };
|
|
2386
2392
|
}, rr = (e, t) => {
|
|
2387
2393
|
const n = {};
|
|
2388
|
-
for (const r of Object.keys(
|
|
2394
|
+
for (const r of Object.keys(qe[t])) {
|
|
2389
2395
|
const o = e[vt(r)];
|
|
2390
|
-
o !==
|
|
2396
|
+
o !== qe[t][r].text && (n[r] = o);
|
|
2391
2397
|
}
|
|
2392
2398
|
return n;
|
|
2393
2399
|
}, ol = (e, t) => Object.fromEntries(Object.entries(rr(e, t)).map(([n, r]) => [`spreadsheet${n.charAt(0).toUpperCase()}${n.slice(1)}`, r])), il = (e, t) => ({
|
|
@@ -2445,7 +2451,10 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2445
2451
|
svgImageTruncated: e.viewerSvgImageTruncated,
|
|
2446
2452
|
svgImageCopy: e.viewerSvgImageCopy,
|
|
2447
2453
|
svgImageCopied: e.viewerSvgImageCopied,
|
|
2448
|
-
svgImageCopyFailed: e.viewerSvgImageCopyFailed
|
|
2454
|
+
svgImageCopyFailed: e.viewerSvgImageCopyFailed,
|
|
2455
|
+
svgImageCopyImage: e.viewerSvgImageCopyImage,
|
|
2456
|
+
svgImageCopiedImage: e.viewerSvgImageCopiedImage,
|
|
2457
|
+
svgImageCopyImageFailed: e.viewerSvgImageCopyImageFailed
|
|
2449
2458
|
}), or = (e, t, n) => {
|
|
2450
2459
|
if (t !== void 0) return t;
|
|
2451
2460
|
if (n !== void 0) return n;
|
|
@@ -2462,24 +2471,24 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2462
2471
|
return e.spreadsheetLongRow;
|
|
2463
2472
|
}
|
|
2464
2473
|
}, sl = ({ path: e, document: t }) => {
|
|
2465
|
-
const { config: n, data: r, labels: o, locale: i, theme: a } =
|
|
2474
|
+
const { config: n, data: r, labels: o, locale: i, theme: a } = $(), c = oe(me), { name: f, url: g, format: l } = t, u = Y(() => ({ format: l, legacyEncoding: n.legacyTextEncoding, maxBytes: n.spreadsheets.maxBytes, budget: Ka }), [l, n.legacyTextEncoding, n.spreadsheets.maxBytes]), p = q(
|
|
2466
2475
|
async (N) => {
|
|
2467
|
-
const _ = await rl(r,
|
|
2476
|
+
const _ = await rl(r, g, u, N);
|
|
2468
2477
|
return _ === null || _.kind === "failure" ? _ : { kind: "read", value: _ };
|
|
2469
2478
|
},
|
|
2470
|
-
[r,
|
|
2471
|
-
), { shown:
|
|
2472
|
-
return /* @__PURE__ */ H("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-spreadsheet-view", "data-aqmx-spreadsheet":
|
|
2473
|
-
/* @__PURE__ */ s(Le, { name: f, openUrl:
|
|
2479
|
+
[r, g, u]
|
|
2480
|
+
), { shown: w, failure: b, retry: x } = nr(e, f, p), R = Y(() => ({ ...rr(o, i), table: f, fullscreenDialog: o.spreadsheetFullscreen(f) }), [o, i, f]), A = Y(() => w?.kind === "table" ? ao(w.rows) : null, [w]);
|
|
2481
|
+
return /* @__PURE__ */ H("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-spreadsheet-view", "data-aqmx-spreadsheet": w === null ? b === null ? "loading" : "failure" : w.kind, children: [
|
|
2482
|
+
/* @__PURE__ */ s(Le, { name: f, openUrl: wt(g), downloadUrl: g, icon: /* @__PURE__ */ s(Za, {}) }),
|
|
2474
2483
|
/* @__PURE__ */ s(Me, { scrollerProps: al, children: /* @__PURE__ */ H("div", { className: "aqmx-document-spreadsheet-column", children: [
|
|
2475
2484
|
t.firstSheetOnly ? /* @__PURE__ */ s("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-first-sheet", children: o.spreadsheetFirstSheetOnly }) : null,
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
/* @__PURE__ */ s("p", { className: "aqmx-callout-body", children: ll(o,
|
|
2482
|
-
/* @__PURE__ */ s("a", { className: "aqmx-callout-action", href:
|
|
2485
|
+
w?.kind === "table" && w.truncated ? /* @__PURE__ */ s("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-truncated", children: o.spreadsheetTruncated }) : null,
|
|
2486
|
+
w === null && b === null ? /* @__PURE__ */ s(Ue, { label: o.spreadsheetLoading, testId: "markdown-explorer-spreadsheet-skeleton" }) : null,
|
|
2487
|
+
w === null && b !== null ? /* @__PURE__ */ s("div", { className: "aqmx-document-spreadsheet-failure", children: /* @__PURE__ */ s(Te, { failure: b, alert: !1, onRetry: x, testId: "markdown-explorer-spreadsheet-failure" }) }) : null,
|
|
2488
|
+
w?.kind === "empty" ? /* @__PURE__ */ s("div", { className: "aqmx-document-spreadsheet-stage", children: /* @__PURE__ */ s("p", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-spreadsheet-empty", children: o.spreadsheetEmpty }) }) : null,
|
|
2489
|
+
w?.kind === "unreadable" ? /* @__PURE__ */ s("div", { className: "aqmx-document-spreadsheet-stage", children: /* @__PURE__ */ H("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-spreadsheet-unreadable", "data-aqmx-unreadable": w.code, children: [
|
|
2490
|
+
/* @__PURE__ */ s("p", { className: "aqmx-callout-body", children: ll(o, w) }),
|
|
2491
|
+
/* @__PURE__ */ s("a", { className: "aqmx-callout-action", href: g, download: f, "data-testid": "markdown-explorer-spreadsheet-unreadable-download", children: o.download })
|
|
2483
2492
|
] }) }) : null,
|
|
2484
2493
|
A === null ? null : (
|
|
2485
2494
|
/* @__PURE__ */ s("div", { className: "aqmx-document-spreadsheet", "data-theme": a, children: /* @__PURE__ */ s(to, { tsv: A, layout: c === "fill" ? "fill" : "inline", locale: i, labels: R }) })
|
|
@@ -2499,7 +2508,7 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2499
2508
|
] })
|
|
2500
2509
|
);
|
|
2501
2510
|
}, ul = ({ absence: e, announces: t, announceFailure: n }) => {
|
|
2502
|
-
const { labels: r, announcer: o } =
|
|
2511
|
+
const { labels: r, announcer: o } = $(), i = e.kind === "no-readme" ? e.folder : null, a = e.kind === "failure" ? e.folder : null, c = e.kind === "failure" ? e.failure : null;
|
|
2503
2512
|
switch (ee(() => {
|
|
2504
2513
|
t && i !== null && o.announce(r.folderReadmeMissing(ce(i)));
|
|
2505
2514
|
}, [t, i, o, r]), ee(() => {
|
|
@@ -2515,19 +2524,19 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2515
2524
|
return /* @__PURE__ */ s(Se, { kind: "failure", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ s(St, { failure: e.failure, onRetry: e.onRetry, testId: "markdown-explorer-folder-failure" }) });
|
|
2516
2525
|
}
|
|
2517
2526
|
}, Tt = ({ label: e }) => {
|
|
2518
|
-
const { labels: t } =
|
|
2527
|
+
const { labels: t } = $();
|
|
2519
2528
|
return /* @__PURE__ */ s(Se, { kind: "loading", label: e, stale: !1, busy: !0, children: /* @__PURE__ */ s(Ue, { label: t.documentLoading, testId: "markdown-explorer-document-skeleton" }) });
|
|
2520
2529
|
}, sn = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), fl = ({ path: e, document: t, viewer: n, editing: r }) => {
|
|
2521
|
-
const { reportMathDiagnostics: o, edits: i } =
|
|
2530
|
+
const { reportMathDiagnostics: o, edits: i } = $(), a = Y(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), c = Ca(), f = Oa(), g = Y(() => o === void 0 ? void 0 : (d) => o(e, d), [o, e]), l = B(null), { editable: u, doubleClick: p, region: w, paneScroll: b, stale: x } = r;
|
|
2522
2531
|
K(() => {
|
|
2523
2532
|
if (u)
|
|
2524
2533
|
return i.bindView(e, {
|
|
2525
2534
|
anchor: () => {
|
|
2526
|
-
const d = l.current, m =
|
|
2535
|
+
const d = l.current, m = w(), k = d === null ? null : d.querySelector(Ze);
|
|
2527
2536
|
return d === null || m === null || k === null ? null : si(d, b.scrollerOf(m, k));
|
|
2528
2537
|
}
|
|
2529
2538
|
});
|
|
2530
|
-
}, [i, e, u,
|
|
2539
|
+
}, [i, e, u, w, b]);
|
|
2531
2540
|
const R = (d) => {
|
|
2532
2541
|
const m = l.current, { target: k } = d;
|
|
2533
2542
|
!p || m === null || !(k instanceof Element) || !ai(k) || (d.stopPropagation(), i.start(e, li(k, m, m.ownerDocument.getSelection())));
|
|
@@ -2536,18 +2545,18 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2536
2545
|
N.current = x;
|
|
2537
2546
|
});
|
|
2538
2547
|
const _ = ae((d) => {
|
|
2539
|
-
const m = l.current, k =
|
|
2548
|
+
const m = l.current, k = w(), M = m === null ? null : mi(m, d.line);
|
|
2540
2549
|
if (k === null || M === null) return !1;
|
|
2541
|
-
const
|
|
2542
|
-
return
|
|
2550
|
+
const I = b.scrollerOf(k, M);
|
|
2551
|
+
return I.scrollTop += hi(M, d.line) - d.clientTop, !0;
|
|
2543
2552
|
}), D = ae((d) => {
|
|
2544
|
-
const m =
|
|
2553
|
+
const m = w();
|
|
2545
2554
|
if (m === null) return;
|
|
2546
2555
|
const k = () => {
|
|
2547
|
-
for (const
|
|
2556
|
+
for (const I of sn) m.removeEventListener(I, M, !0);
|
|
2548
2557
|
A.current?.release === k && (A.current = null);
|
|
2549
2558
|
}, M = () => k();
|
|
2550
|
-
for (const
|
|
2559
|
+
for (const I of sn) m.addEventListener(I, M, { capture: !0, passive: !0 });
|
|
2551
2560
|
A.current = { point: d, release: k };
|
|
2552
2561
|
});
|
|
2553
2562
|
return K(() => {
|
|
@@ -2560,25 +2569,25 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2560
2569
|
const d = A.current;
|
|
2561
2570
|
d === null || x || (d.release(), _(d.point));
|
|
2562
2571
|
}, [t, x]),
|
|
2563
|
-
/* @__PURE__ */ s("div", { ref: l, className: "aqmx-document-viewer", onDoubleClick: R, children: /* @__PURE__ */ s(Tn, { ...n, onHeadingSelect: c, headingHref: f, onMathDiagnostics:
|
|
2572
|
+
/* @__PURE__ */ s("div", { ref: l, className: "aqmx-document-viewer", onDoubleClick: R, children: /* @__PURE__ */ s(Tn, { ...n, onHeadingSelect: c, headingHref: f, onMathDiagnostics: g, parseResult: a, content: null }) });
|
|
2564
2573
|
}, ar = ({ document: e, viewer: t }) => {
|
|
2565
|
-
const { labels: n } =
|
|
2574
|
+
const { labels: n } = $();
|
|
2566
2575
|
return /* @__PURE__ */ H(je, { children: [
|
|
2567
|
-
/* @__PURE__ */ s(Le, { name: e.name, openUrl:
|
|
2576
|
+
/* @__PURE__ */ s(Le, { name: e.name, openUrl: wt(e.url), downloadUrl: e.url, icon: /* @__PURE__ */ s(Xo, {}), children: e.truncated ? null : /* @__PURE__ */ s(Pi, { text: e.text }) }),
|
|
2568
2577
|
e.truncated ? /* @__PURE__ */ s("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
|
|
2569
2578
|
/* @__PURE__ */ s("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ s(Tn, { ...t, parseResult: null, content: e.text }) })
|
|
2570
2579
|
] });
|
|
2571
2580
|
}, it = ({ path: e, name: t, viewer: n }) => {
|
|
2572
|
-
const { data: r, labels: o } =
|
|
2573
|
-
async (
|
|
2574
|
-
const l = await r.text(e,
|
|
2581
|
+
const { data: r, labels: o } = $(), i = q(
|
|
2582
|
+
async (g) => {
|
|
2583
|
+
const l = await r.text(e, g);
|
|
2575
2584
|
return "kind" in l ? l.kind === "failure" ? { kind: "failure", failure: l.failure } : { kind: "read", value: l } : null;
|
|
2576
2585
|
},
|
|
2577
2586
|
[r, e]
|
|
2578
2587
|
), { shown: a, failure: c, retry: f } = nr(e, t, i);
|
|
2579
2588
|
return a !== null ? /* @__PURE__ */ s(ar, { document: a, viewer: n }) : c !== null ? /* @__PURE__ */ s(St, { failure: c, onRetry: f, testId: "markdown-explorer-markup-failure" }) : /* @__PURE__ */ s(Ue, { label: o.markupLoading, testId: "markdown-explorer-markup-skeleton" });
|
|
2580
2589
|
}, ml = Object.freeze({ reason: "failed" }), hl = (e) => {
|
|
2581
|
-
const { labels: t } =
|
|
2590
|
+
const { labels: t } = $();
|
|
2582
2591
|
return /* @__PURE__ */ s(
|
|
2583
2592
|
ei,
|
|
2584
2593
|
{
|
|
@@ -2589,11 +2598,11 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2589
2598
|
}, pl = ({ path: e, document: t, view: n, viewer: r, onRetry: o, editing: i }) => {
|
|
2590
2599
|
switch (t.kind) {
|
|
2591
2600
|
case "markdown": {
|
|
2592
|
-
const { session: a, layout: c, region: f, paneScroll:
|
|
2593
|
-
if (n === "edit" && a !== void 0) return /* @__PURE__ */ s(hl, { path: e, name: t.name, session: a, layout: c, viewer: r, region: f, paneScroll:
|
|
2601
|
+
const { session: a, layout: c, region: f, paneScroll: g, stale: l } = i;
|
|
2602
|
+
if (n === "edit" && a !== void 0) return /* @__PURE__ */ s(hl, { path: e, name: t.name, session: a, layout: c, viewer: r, region: f, paneScroll: g });
|
|
2594
2603
|
if (n === "markup") return /* @__PURE__ */ s(it, { path: e, name: t.name, viewer: r });
|
|
2595
2604
|
const u = t.edit !== null && (t.edit.kind === "inline" || t.edit.kind === "draft");
|
|
2596
|
-
return /* @__PURE__ */ s(fl, { path: e, document: t, viewer: r, editing: { editable: u, doubleClick: u && c === "fill", region: f, paneScroll:
|
|
2605
|
+
return /* @__PURE__ */ s(fl, { path: e, document: t, viewer: r, editing: { editable: u, doubleClick: u && c === "fill", region: f, paneScroll: g, stale: l } });
|
|
2597
2606
|
}
|
|
2598
2607
|
case "text":
|
|
2599
2608
|
return /* @__PURE__ */ s(ar, { document: t, viewer: r });
|
|
@@ -2612,8 +2621,8 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2612
2621
|
throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(a)}`);
|
|
2613
2622
|
}
|
|
2614
2623
|
}
|
|
2615
|
-
},
|
|
2616
|
-
const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : Wn(e, n), r === void 0 ? null : Gn(e, r.id), e.querySelector(Ze), e.querySelector(
|
|
2624
|
+
}, gl = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', wl = (e, t, n) => {
|
|
2625
|
+
const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : Wn(e, n), r === void 0 ? null : Gn(e, r.id), e.querySelector(Ze), e.querySelector(gl)];
|
|
2617
2626
|
for (const i of o)
|
|
2618
2627
|
if (i instanceof HTMLElement && jn(i)) return i;
|
|
2619
2628
|
return null;
|
|
@@ -2634,26 +2643,26 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2634
2643
|
}, 0);
|
|
2635
2644
|
}, f = (p) => {
|
|
2636
2645
|
t.current = p.target instanceof Node && n.contains(p.target);
|
|
2637
|
-
},
|
|
2646
|
+
}, g = (p) => {
|
|
2638
2647
|
p.relatedTarget === null && i && (t.current = !1);
|
|
2639
2648
|
}, l = () => {
|
|
2640
|
-
const { activeElement: p, body:
|
|
2641
|
-
p !== null && p !==
|
|
2649
|
+
const { activeElement: p, body: w } = r;
|
|
2650
|
+
p !== null && p !== w && (t.current = n.contains(p));
|
|
2642
2651
|
}, u = () => {
|
|
2643
2652
|
i && !n.contains(r.activeElement) && (t.current = !1);
|
|
2644
2653
|
};
|
|
2645
|
-
return o.addEventListener("pointerdown", c, !0), o.addEventListener("mousedown", c, !0), o.addEventListener("focusin", f, !0), o.addEventListener("blur", l), o.addEventListener("focus", u), n.addEventListener("focusout",
|
|
2646
|
-
clearTimeout(a), o.removeEventListener("pointerdown", c, !0), o.removeEventListener("mousedown", c, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("blur", l), o.removeEventListener("focus", u), n.removeEventListener("focusout",
|
|
2654
|
+
return o.addEventListener("pointerdown", c, !0), o.addEventListener("mousedown", c, !0), o.addEventListener("focusin", f, !0), o.addEventListener("blur", l), o.addEventListener("focus", u), n.addEventListener("focusout", g), () => {
|
|
2655
|
+
clearTimeout(a), o.removeEventListener("pointerdown", c, !0), o.removeEventListener("mousedown", c, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("blur", l), o.removeEventListener("focus", u), n.removeEventListener("focusout", g);
|
|
2647
2656
|
};
|
|
2648
2657
|
}, [e]), t;
|
|
2649
|
-
}, bl = Object.freeze({ count: 0, recovered: !1 }), El = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: i, regionLabel: a, navigation: c, fragment: f, paneScroll:
|
|
2650
|
-
const { labels:
|
|
2658
|
+
}, bl = Object.freeze({ count: 0, recovered: !1 }), El = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: i, regionLabel: a, navigation: c, fragment: f, paneScroll: g, announces: l, announceFailure: u, onDocumentShown: p }) => {
|
|
2659
|
+
const { labels: w, announcer: b, documents: x } = $(), { document: R } = t, A = B(null), N = B(null), _ = B(null), D = B(0), d = vl(A), m = B({ path: e, document: R }), k = B(null), M = q(
|
|
2651
2660
|
(V) => {
|
|
2652
|
-
const Z = A.current, Q = Qt(Z, V,
|
|
2661
|
+
const Z = A.current, Q = Qt(Z, V, g);
|
|
2653
2662
|
Z !== null && Q !== null && cn(Z, Q, d.current);
|
|
2654
2663
|
},
|
|
2655
|
-
[
|
|
2656
|
-
),
|
|
2664
|
+
[g, d]
|
|
2665
|
+
), I = q(
|
|
2657
2666
|
(V, Z) => {
|
|
2658
2667
|
const Q = D.current;
|
|
2659
2668
|
setTimeout(() => {
|
|
@@ -2661,14 +2670,14 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2661
2670
|
}, 0);
|
|
2662
2671
|
},
|
|
2663
2672
|
[M]
|
|
2664
|
-
),
|
|
2673
|
+
), F = q(
|
|
2665
2674
|
(V) => {
|
|
2666
2675
|
setTimeout(() => {
|
|
2667
2676
|
V.defaultPrevented || M("#");
|
|
2668
2677
|
}, 0);
|
|
2669
2678
|
},
|
|
2670
2679
|
[M]
|
|
2671
|
-
), v = Y(() => ({ navigation: c, currentPath: e, scrollWithin: M, followSameUrlJump:
|
|
2680
|
+
), v = Y(() => ({ navigation: c, currentPath: e, scrollWithin: M, followSameUrlJump: I, followEmptyFragment: F }), [c, e, M, I, F]), T = q(() => x.retry(e), [x, e]), L = gi(x, Ea), C = _n(e), P = C !== void 0 ? "edit" : n ? "markup" : "rendered", j = xt(R) === null ? void 0 : P, X = q(() => A.current, []), h = Y(() => ({ session: C, layout: i, region: X, paneScroll: g, stale: r }), [C, i, X, g, r]), E = j === "edit" ? !1 : r, S = oe(me), O = j === "edit" && i === "fill" ? "fill" : S, [z, G] = U(0), J = B(0), W = B(!1), [ie, Ct] = U(bl), [Ot, dr] = U(0), Mt = B(u), Lt = B(r);
|
|
2672
2681
|
K(() => {
|
|
2673
2682
|
Mt.current = u, Lt.current = r;
|
|
2674
2683
|
}, [u, r]);
|
|
@@ -2682,13 +2691,13 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2682
2691
|
J.current += 1;
|
|
2683
2692
|
let Z = !1, Q = !1, ne = !1;
|
|
2684
2693
|
return {
|
|
2685
|
-
settle: (pe,
|
|
2686
|
-
if (V.settle(pe,
|
|
2687
|
-
if (
|
|
2694
|
+
settle: (pe, ge) => {
|
|
2695
|
+
if (V.settle(pe, ge), !(ne || Z)) {
|
|
2696
|
+
if (ge !== null) {
|
|
2688
2697
|
Q = !0, W.current = !1;
|
|
2689
2698
|
return;
|
|
2690
2699
|
}
|
|
2691
|
-
Z = !0,
|
|
2700
|
+
Z = !0, Ct((Ae) => ({ count: Ae.count + 1, recovered: Q }));
|
|
2692
2701
|
}
|
|
2693
2702
|
},
|
|
2694
2703
|
release: () => {
|
|
@@ -2711,10 +2720,10 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2711
2720
|
N.current = { path: V, snapshot: Z }, x.noteShown(V, Z);
|
|
2712
2721
|
const ne = Z.document;
|
|
2713
2722
|
if (ne.kind === "failure") {
|
|
2714
|
-
W.current = !1, x.noteFailureShown(Z) && u(
|
|
2723
|
+
W.current = !1, x.noteFailureShown(Z) && u(w.documentFailed(ce(V), le(w, ne.failure.reason)));
|
|
2715
2724
|
return;
|
|
2716
2725
|
}
|
|
2717
|
-
p?.(V, ne), !(!l || Q !== null && Q.path === V && Q.snapshot.document.kind !== "failure") && (W.current = J.current > 0, W.current || b.announce(
|
|
2726
|
+
p?.(V, ne), !(!l || Q !== null && Q.path === V && Q.snapshot.document.kind !== "failure") && (W.current = J.current > 0, W.current || b.announce(w.documentShown(ne.name)));
|
|
2718
2727
|
});
|
|
2719
2728
|
ee(() => {
|
|
2720
2729
|
fr(e, t);
|
|
@@ -2725,24 +2734,24 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2725
2734
|
const Z = A.current;
|
|
2726
2735
|
if (Z === null || !d.current) return null;
|
|
2727
2736
|
const { activeElement: Q, body: ne } = Z.ownerDocument;
|
|
2728
|
-
return Q !== null && Q !== ne ? null :
|
|
2737
|
+
return Q !== null && Q !== ne ? null : wl(Z, R, V);
|
|
2729
2738
|
}), hr = ae((V) => {
|
|
2730
2739
|
const Z = W.current;
|
|
2731
|
-
W.current = !1, !r && (V && Nt(null), l && (V || Z) && R.kind !== "failure" && b.announce(
|
|
2740
|
+
W.current = !1, !r && (V && Nt(null), l && (V || Z) && R.kind !== "failure" && b.announce(w.documentShown(R.name)));
|
|
2732
2741
|
});
|
|
2733
2742
|
ee(() => {
|
|
2734
2743
|
ie.count > 0 && hr(ie.recovered);
|
|
2735
2744
|
}, [ie]);
|
|
2736
2745
|
const pr = ae(() => {
|
|
2737
|
-
J.current > 0 || !W.current || (W.current = !1, l && !r && R.kind !== "failure" && b.announce(
|
|
2746
|
+
J.current > 0 || !W.current || (W.current = !1, l && !r && R.kind !== "failure" && b.announce(w.documentShown(R.name)));
|
|
2738
2747
|
});
|
|
2739
2748
|
ee(() => {
|
|
2740
|
-
|
|
2741
|
-
}, [
|
|
2742
|
-
const
|
|
2749
|
+
Ot > 0 && pr();
|
|
2750
|
+
}, [Ot]);
|
|
2751
|
+
const gr = ae((V) => {
|
|
2743
2752
|
const Z = A.current;
|
|
2744
2753
|
Z !== null && cn(Z, V, d.current);
|
|
2745
|
-
}),
|
|
2754
|
+
}), wr = ae((V) => g.reveal(V)), vr = ae((V) => Qt(A.current, V, g));
|
|
2746
2755
|
return ee(() => {
|
|
2747
2756
|
if (r) return;
|
|
2748
2757
|
const V = m.current.path !== e, Z = V || m.current.document !== R;
|
|
@@ -2752,16 +2761,16 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2752
2761
|
let ne = null;
|
|
2753
2762
|
f.kind === "page" ? _.current !== f.navigation && (_.current = f.navigation, D.current += 1, ne = f.fragment) : f.fragment !== null && (ne = f.fragment, mr());
|
|
2754
2763
|
const pe = () => {
|
|
2755
|
-
const
|
|
2764
|
+
const ge = ne === null ? null : vr(ne);
|
|
2756
2765
|
if (!Z) {
|
|
2757
|
-
|
|
2766
|
+
ge !== null && gr(ge);
|
|
2758
2767
|
return;
|
|
2759
2768
|
}
|
|
2760
2769
|
const Ae = Nt(f.fragment);
|
|
2761
|
-
V &&
|
|
2770
|
+
V && ge === null && Ae !== null && wr(Ae);
|
|
2762
2771
|
};
|
|
2763
2772
|
Q ? queueMicrotask(pe) : pe();
|
|
2764
|
-
}, [f, e, R, r]), /* @__PURE__ */ s(me, { value:
|
|
2773
|
+
}, [f, e, R, r]), /* @__PURE__ */ s(me, { value: O, children: /* @__PURE__ */ s(Se, { kind: R.kind, view: j, label: a(e, R), stale: At, busy: At, frameRef: A, intent: L, children: /* @__PURE__ */ s(Yn, { value: v, children: /* @__PURE__ */ s(va, { children: /* @__PURE__ */ s(Un, { value: ur, children: /* @__PURE__ */ s(pl, { path: e, document: R, view: P, viewer: o, onRetry: T, editing: h }, e) }) }) }) }) });
|
|
2765
2774
|
}, Rt = Object.freeze({ kind: "skeleton" }), yl = (e, t, n, r, o) => {
|
|
2766
2775
|
if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
|
|
2767
2776
|
const i = fe(t);
|
|
@@ -2772,23 +2781,23 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2772
2781
|
}, Sl = (e, t) => t.status === "deferred" ? Rt : { kind: "document", path: e, snapshot: t, stale: !1 }, kl = ({ requestedPath: e, content: t, markup: n, ...r }) => {
|
|
2773
2782
|
const o = t.kind === "streaming" ? Sl(t.path, oe(t.promise)) : t;
|
|
2774
2783
|
return o.kind !== "document" ? /* @__PURE__ */ s(Tt, { label: r.regionLabel(e, null) }) : /* @__PURE__ */ s(El, { path: o.path, snapshot: o.snapshot, markup: n, stale: o.stale, ...r });
|
|
2775
|
-
}, lr = ({ path: e, absence: t, markup: n, display: r, navigation: o, fragment: i, paneScroll: a, announces: c, announceFailure: f, onDocumentShown:
|
|
2776
|
-
const { config: l, labels: u, locale: p, theme:
|
|
2784
|
+
}, lr = ({ path: e, absence: t, markup: n, display: r, navigation: o, fragment: i, paneScroll: a, announces: c, announceFailure: f, onDocumentShown: g }) => {
|
|
2785
|
+
const { config: l, labels: u, locale: p, theme: w, documents: b, data: x } = $(), R = no(), A = B(!1);
|
|
2777
2786
|
K(() => {
|
|
2778
2787
|
A.current = !0;
|
|
2779
2788
|
}, []);
|
|
2780
|
-
const [N, _] = U(null), [D, d] = U(n), m =
|
|
2789
|
+
const [N, _] = U(null), [D, d] = U(n), m = q(() => e === null ? void 0 : b.peek(e), [b, e]), k = re(b.subscribe, m, m), M = q(() => N === null ? void 0 : b.peek(N), [b, N]), I = re(b.subscribe, M, M);
|
|
2781
2790
|
K(() => e === null ? void 0 : b.open(e), [b, e]), K(() => N === null ? void 0 : b.retain(N), [b, N]);
|
|
2782
|
-
const
|
|
2791
|
+
const F = e === null ? Rt : yl(e, k, N, I, !A.current), v = e === null ? null : F.kind === "document" && !F.stale ? F.path : N;
|
|
2783
2792
|
v !== N && _(v);
|
|
2784
|
-
const T =
|
|
2793
|
+
const T = F.kind !== "document" || F.path === e;
|
|
2785
2794
|
T && n !== D && d(n);
|
|
2786
|
-
const L = Y(() => il(u, p), [u, p]),
|
|
2795
|
+
const L = Y(() => il(u, p), [u, p]), C = Y(() => ({ read: (S, O) => ga(x, S, O) }), [x]), P = Y(() => [...l.iframeHosts], [l]), j = o.kind === "panel", X = Y(
|
|
2787
2796
|
() => ({
|
|
2788
2797
|
labels: L,
|
|
2789
2798
|
spreadsheetLocale: p,
|
|
2790
2799
|
emptyMessage: u.documentEmpty,
|
|
2791
|
-
theme:
|
|
2800
|
+
theme: w,
|
|
2792
2801
|
availableStyles: l.documentStyles,
|
|
2793
2802
|
iFrameAllowedDomains: P,
|
|
2794
2803
|
embeds: l.embeds,
|
|
@@ -2805,15 +2814,15 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2805
2814
|
width: r.width === void 0 ? void 0 : `min(${r.width}, 100%)`,
|
|
2806
2815
|
maxWidth: r.maxWidth === void 0 ? void 0 : `min(${r.maxWidth}, 100%)`,
|
|
2807
2816
|
renderScrollBar: j ? void 0 : zn,
|
|
2808
|
-
imageSource:
|
|
2817
|
+
imageSource: C
|
|
2809
2818
|
}),
|
|
2810
|
-
[L, p, u.documentEmpty,
|
|
2811
|
-
), h =
|
|
2819
|
+
[L, p, u.documentEmpty, w, l.documentStyles, P, l.embeds, R, r, j, C]
|
|
2820
|
+
), h = q((S, O) => j ? O === null || O.kind === "failure" ? ce(S) : O.name : u.documentRegion, [j, u.documentRegion]), E = j ? "content" : "fill";
|
|
2812
2821
|
return e === null ? /* @__PURE__ */ s(me, { value: E, children: /* @__PURE__ */ s(ul, { absence: t, announces: c, announceFailure: f }) }) : /* @__PURE__ */ s(me, { value: E, children: /* @__PURE__ */ s(xe, { fallback: /* @__PURE__ */ s(Tt, { label: h(e, null) }), children: /* @__PURE__ */ s(
|
|
2813
2822
|
kl,
|
|
2814
2823
|
{
|
|
2815
2824
|
requestedPath: e,
|
|
2816
|
-
content:
|
|
2825
|
+
content: F,
|
|
2817
2826
|
markup: T ? n : D,
|
|
2818
2827
|
viewer: X,
|
|
2819
2828
|
editLayout: r.editLayout,
|
|
@@ -2823,28 +2832,28 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2823
2832
|
paneScroll: a,
|
|
2824
2833
|
announces: c,
|
|
2825
2834
|
announceFailure: f,
|
|
2826
|
-
onDocumentShown:
|
|
2835
|
+
onDocumentShown: g
|
|
2827
2836
|
}
|
|
2828
2837
|
) }) });
|
|
2829
2838
|
}, xl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
|
|
2830
|
-
const { config: i, viewSettings: a, announcer: c } =
|
|
2831
|
-
(
|
|
2839
|
+
const { config: i, viewSettings: a, announcer: c } = $(), f = _e((I) => I.style), g = _e((I) => I.align), l = Ve(), u = yn(), p = bt(), { view: w, overrides: b, embed: x } = r, R = q(
|
|
2840
|
+
(I) => {
|
|
2832
2841
|
if (p.kind !== "location") return;
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2842
|
+
const F = dl(i, p.location, I);
|
|
2843
|
+
F !== null && l(F, "browse");
|
|
2835
2844
|
},
|
|
2836
2845
|
[i, l, p]
|
|
2837
|
-
), A =
|
|
2838
|
-
(
|
|
2839
|
-
a.update({ style:
|
|
2846
|
+
), A = q(
|
|
2847
|
+
(I) => {
|
|
2848
|
+
a.update({ style: I }), R("style");
|
|
2840
2849
|
},
|
|
2841
2850
|
[a, R]
|
|
2842
|
-
), N =
|
|
2843
|
-
(
|
|
2844
|
-
a.update({ align:
|
|
2851
|
+
), N = q(
|
|
2852
|
+
(I) => {
|
|
2853
|
+
a.update({ align: I }), R("align");
|
|
2845
2854
|
},
|
|
2846
2855
|
[a, R]
|
|
2847
|
-
), _ = or(i, b.style, f), D = ir(b.align,
|
|
2856
|
+
), _ = or(i, b.style, f), D = ir(b.align, g), d = Y(
|
|
2848
2857
|
() => ({
|
|
2849
2858
|
style: _,
|
|
2850
2859
|
onStyleChange: A,
|
|
@@ -2859,28 +2868,28 @@ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e),
|
|
|
2859
2868
|
editLayout: "fill"
|
|
2860
2869
|
}),
|
|
2861
2870
|
[_, A, D, N, x]
|
|
2862
|
-
), m = Y(() => ({ kind: "page", view:
|
|
2871
|
+
), m = Y(() => ({ kind: "page", view: w, overrides: b, embed: x }), [w, b, x]), k = Y(() => ({ kind: "page", fragment: u.hash, navigation: u }), [u]), M = q((I) => c.announce(I), [c]);
|
|
2863
2872
|
return /* @__PURE__ */ s(lr, { path: e, absence: t, markup: n, display: d, navigation: m, fragment: k, paneScroll: Yi, announces: !0, announceFailure: M, onDocumentShown: o });
|
|
2864
2873
|
}, Tl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
|
|
2865
|
-
const { config: i, viewSettings: a } =
|
|
2874
|
+
const { config: i, viewSettings: a } = $(), c = _e((m) => m.style), f = _e((m) => m.align), [g, l] = U(() => or(i, void 0, c)), u = ir(void 0, f), p = q((m) => a.update({ align: m }), [a]), { maximized: w, onDocumentLink: b, pendingHash: x, onHashConsumed: R, announceFailure: A, paneScroll: N } = r, _ = Y(
|
|
2866
2875
|
() => ({
|
|
2867
|
-
style:
|
|
2876
|
+
style: g,
|
|
2868
2877
|
onStyleChange: l,
|
|
2869
2878
|
align: u,
|
|
2870
2879
|
onAlignChange: p,
|
|
2871
|
-
showToc:
|
|
2872
|
-
showStyle:
|
|
2873
|
-
showAlign:
|
|
2880
|
+
showToc: w,
|
|
2881
|
+
showStyle: w,
|
|
2882
|
+
showAlign: w,
|
|
2874
2883
|
padding: void 0,
|
|
2875
2884
|
width: void 0,
|
|
2876
2885
|
maxWidth: void 0,
|
|
2877
|
-
editLayout:
|
|
2886
|
+
editLayout: w ? "fill" : "content"
|
|
2878
2887
|
}),
|
|
2879
|
-
[
|
|
2888
|
+
[g, u, p, w]
|
|
2880
2889
|
), D = Y(() => ({ kind: "panel", onDocumentLink: b }), [b]), d = Y(() => ({ kind: "panel", fragment: x, consume: R }), [x, R]);
|
|
2881
2890
|
return /* @__PURE__ */ s(lr, { path: e, absence: t, markup: n, display: _, navigation: D, fragment: d, paneScroll: N, announces: !1, announceFailure: A, onDocumentShown: o });
|
|
2882
2891
|
}, Rl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => r.kind === "page" ? /* @__PURE__ */ s(xl, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) : /* @__PURE__ */ s(Tl, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o });
|
|
2883
|
-
function
|
|
2892
|
+
function Cl({
|
|
2884
2893
|
title: e,
|
|
2885
2894
|
titleId: t,
|
|
2886
2895
|
...n
|
|
@@ -2901,7 +2910,7 @@ function Ol({
|
|
|
2901
2910
|
clipRule: "evenodd"
|
|
2902
2911
|
}));
|
|
2903
2912
|
}
|
|
2904
|
-
const
|
|
2913
|
+
const Ol = /* @__PURE__ */ y.forwardRef(Cl);
|
|
2905
2914
|
function Ml({
|
|
2906
2915
|
title: e,
|
|
2907
2916
|
titleId: t,
|
|
@@ -2993,8 +3002,8 @@ function Pl({
|
|
|
2993
3002
|
clipRule: "evenodd"
|
|
2994
3003
|
}));
|
|
2995
3004
|
}
|
|
2996
|
-
const
|
|
2997
|
-
function
|
|
3005
|
+
const Il = /* @__PURE__ */ y.forwardRef(Pl);
|
|
3006
|
+
function $l({
|
|
2998
3007
|
title: e,
|
|
2999
3008
|
titleId: t,
|
|
3000
3009
|
...n
|
|
@@ -3017,8 +3026,8 @@ function Fl({
|
|
|
3017
3026
|
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"
|
|
3018
3027
|
}));
|
|
3019
3028
|
}
|
|
3020
|
-
const
|
|
3021
|
-
function
|
|
3029
|
+
const Fl = /* @__PURE__ */ y.forwardRef($l);
|
|
3030
|
+
function ql({
|
|
3022
3031
|
title: e,
|
|
3023
3032
|
titleId: t,
|
|
3024
3033
|
...n
|
|
@@ -3041,7 +3050,7 @@ function Il({
|
|
|
3041
3050
|
clipRule: "evenodd"
|
|
3042
3051
|
}));
|
|
3043
3052
|
}
|
|
3044
|
-
const _l = /* @__PURE__ */ y.forwardRef(
|
|
3053
|
+
const _l = /* @__PURE__ */ y.forwardRef(ql);
|
|
3045
3054
|
function Bl({
|
|
3046
3055
|
title: e,
|
|
3047
3056
|
titleId: t,
|
|
@@ -3084,7 +3093,7 @@ function jl({
|
|
|
3084
3093
|
}));
|
|
3085
3094
|
}
|
|
3086
3095
|
const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId: n }) => {
|
|
3087
|
-
const { labels: r, onEditGrant: o } =
|
|
3096
|
+
const { labels: r, onEditGrant: o } = $(), [i, a] = U(!1), c = () => {
|
|
3088
3097
|
o === void 0 || i || (a(!0), o(e).then((f) => {
|
|
3089
3098
|
f && t();
|
|
3090
3099
|
}).finally(() => a(!1)));
|
|
@@ -3113,9 +3122,9 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3113
3122
|
const r = e.modifiedAt === null ? Number.NaN : Date.parse(e.modifiedAt);
|
|
3114
3123
|
return n(Number.isNaN(r) ? e.id : t.format(r), e.author === null ? "" : e.author);
|
|
3115
3124
|
}, Yl = ({ path: e, documentName: t, open: n, onClose: r }) => {
|
|
3116
|
-
const { data: o, edits: i, labels: a, locale: c, announcer: f } =
|
|
3125
|
+
const { data: o, edits: i, labels: a, locale: c, announcer: f } = $(), g = ke(), [l, u] = U(null), [p, w] = U(0), [b, x] = U(null), [R, A] = U(null), N = Y(() => new Intl.DateTimeFormat(c, { dateStyle: "medium", timeStyle: "short" }), [c]), _ = q(() => {
|
|
3117
3126
|
x(null), A(null);
|
|
3118
|
-
}, []), D =
|
|
3127
|
+
}, []), D = $n({ open: n, onOpen: _, onDismiss: r });
|
|
3119
3128
|
ee(() => {
|
|
3120
3129
|
if (!n) return;
|
|
3121
3130
|
const k = new AbortController();
|
|
@@ -3132,9 +3141,9 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3132
3141
|
const d = () => {
|
|
3133
3142
|
R === null || R.kind !== "revision" || (i.replaceDraft(e, R.text), f.announce(a.historyRestored(t)), r());
|
|
3134
3143
|
}, m = l !== null && l.kind === "revisions" ? l.revisions.find((k) => k.id === b) : void 0;
|
|
3135
|
-
return /* @__PURE__ */ s("dialog", { ...D, className: "aqmx-confirm aqmx-history", "aria-labelledby":
|
|
3136
|
-
/* @__PURE__ */ s("p", { id:
|
|
3137
|
-
l === null ? /* @__PURE__ */ s("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: a.historyLoading }) : l.kind === "failure" ? /* @__PURE__ */ s(Te, { failure: l.failure, alert: !1, onRetry: () =>
|
|
3144
|
+
return /* @__PURE__ */ s("dialog", { ...D, className: "aqmx-confirm aqmx-history", "aria-labelledby": g, "data-testid": "markdown-explorer-history", children: /* @__PURE__ */ H("div", { className: "aqmx-confirm-panel aqmx-history-panel", children: [
|
|
3145
|
+
/* @__PURE__ */ s("p", { id: g, className: "aqmx-confirm-title", children: a.historyTitle(t) }),
|
|
3146
|
+
l === null ? /* @__PURE__ */ s("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: a.historyLoading }) : l.kind === "failure" ? /* @__PURE__ */ s(Te, { failure: l.failure, alert: !1, onRetry: () => w((k) => k + 1), testId: "markdown-explorer-history-failure" }) : l.revisions.length === 0 ? /* @__PURE__ */ s("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: a.historyEmpty }) : /* @__PURE__ */ s("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: l.revisions.map((k) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ H("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": k.id === b, "data-testid": "markdown-explorer-history-entry", onClick: () => x(k.id), children: [
|
|
3138
3147
|
/* @__PURE__ */ s("span", { children: un(k, N, a.historyEntry) }),
|
|
3139
3148
|
k.current ? /* @__PURE__ */ s("span", { className: "aqmx-history-mark", children: a.historyCurrent }) : null,
|
|
3140
3149
|
k.kept ? /* @__PURE__ */ s("span", { className: "aqmx-history-mark", children: a.historyKept }) : null
|
|
@@ -3148,16 +3157,16 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3148
3157
|
] })
|
|
3149
3158
|
] }) });
|
|
3150
3159
|
}, Xl = (e) => {
|
|
3151
|
-
const { documents: t } =
|
|
3160
|
+
const { documents: t } = $(), n = q(() => t.peek(e), [t, e]), r = q(() => t.peekSeeded(e), [t, e]), o = re(t.subscribe, n, r), i = fe(o)?.document;
|
|
3152
3161
|
return i === void 0 || i.kind === "failure" ? { edit: null, name: ce(e) } : { edit: i.kind === "markdown" || i.kind === "spreadsheet" ? i.edit : null, name: i.name };
|
|
3153
3162
|
}, de = (e) => {
|
|
3154
3163
|
e.stopPropagation();
|
|
3155
3164
|
}, Jl = ({ path: e, documentName: t, iconOnly: n, previewAvailable: r, draft: o }) => {
|
|
3156
|
-
const { draftConverter: i, edits: a, labels: c } =
|
|
3165
|
+
const { draftConverter: i, edits: a, labels: c } = $(), f = re(
|
|
3157
3166
|
a.subscribe,
|
|
3158
3167
|
() => a.session(e) !== void 0,
|
|
3159
3168
|
() => !1
|
|
3160
|
-
), [
|
|
3169
|
+
), [g, l] = U(null), u = () => {
|
|
3161
3170
|
if (!f) {
|
|
3162
3171
|
a.start(e, a.viewAnchor(e));
|
|
3163
3172
|
return;
|
|
@@ -3167,15 +3176,15 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3167
3176
|
x?.dirty === !0 ? l(x.save.kind === "draft" ? "draft" : "unsaved") : a.close(e);
|
|
3168
3177
|
}, p = () => {
|
|
3169
3178
|
f || (Jo(), r && a.sideBySide() && i?.prepare?.());
|
|
3170
|
-
},
|
|
3179
|
+
}, w = n ? o ? c.editDraftDocumentNamed(t) : c.editDocumentNamed(t) : null, b = o ? c.editDraftDocument : c.editDocument;
|
|
3171
3180
|
return /* @__PURE__ */ H(je, { children: [
|
|
3172
3181
|
/* @__PURE__ */ H(
|
|
3173
3182
|
"button",
|
|
3174
3183
|
{
|
|
3175
3184
|
type: "button",
|
|
3176
|
-
className:
|
|
3177
|
-
title: f ? c.closeEditor :
|
|
3178
|
-
"aria-label":
|
|
3185
|
+
className: w === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
|
|
3186
|
+
title: f ? c.closeEditor : w === null ? b : w,
|
|
3187
|
+
"aria-label": w === null ? void 0 : w,
|
|
3179
3188
|
"aria-pressed": f,
|
|
3180
3189
|
"data-testid": "markdown-explorer-document-edit",
|
|
3181
3190
|
onClick: u,
|
|
@@ -3184,16 +3193,16 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3184
3193
|
onFocus: p,
|
|
3185
3194
|
children: [
|
|
3186
3195
|
/* @__PURE__ */ s(Hl, { "aria-hidden": "true" }),
|
|
3187
|
-
|
|
3196
|
+
w === null ? /* @__PURE__ */ s("span", { children: c.editDocumentLabel }) : null
|
|
3188
3197
|
]
|
|
3189
3198
|
}
|
|
3190
3199
|
),
|
|
3191
3200
|
/* @__PURE__ */ s(
|
|
3192
|
-
|
|
3201
|
+
Fn,
|
|
3193
3202
|
{
|
|
3194
|
-
open:
|
|
3195
|
-
title:
|
|
3196
|
-
body:
|
|
3203
|
+
open: g !== null,
|
|
3204
|
+
title: g === "draft" ? c.draftDiscardTitle : c.unsavedTitle,
|
|
3205
|
+
body: g === "draft" ? c.draftDiscardBody(t) : c.unsavedBody(t),
|
|
3197
3206
|
confirmLabel: c.unsavedDiscard,
|
|
3198
3207
|
cancelLabel: c.unsavedStay,
|
|
3199
3208
|
testId: "markdown-explorer-edit-close-confirm",
|
|
@@ -3205,7 +3214,7 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3205
3214
|
)
|
|
3206
3215
|
] });
|
|
3207
3216
|
}, Ql = ({ href: e, documentName: t, iconOnly: n }) => {
|
|
3208
|
-
const { labels: r } =
|
|
3217
|
+
const { labels: r } = $(), o = n ? r.editExternallyNamed(t) : null;
|
|
3209
3218
|
return /* @__PURE__ */ H(
|
|
3210
3219
|
"a",
|
|
3211
3220
|
{
|
|
@@ -3224,10 +3233,10 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3224
3233
|
}
|
|
3225
3234
|
);
|
|
3226
3235
|
}, es = ({ session: e }) => {
|
|
3227
|
-
const { labels: t } =
|
|
3236
|
+
const { labels: t } = $(), n = yo(t, e);
|
|
3228
3237
|
return /* @__PURE__ */ s("p", { className: "aqmx-edit-status", title: n === "" ? void 0 : n, "data-testid": "markdown-explorer-edit-status", "data-aqmx-save": e.save.kind, children: n });
|
|
3229
3238
|
}, ts = Object.freeze(["editor", "split", "preview"]), ns = Object.freeze(["editor", "preview"]), rs = Object.freeze({ editor: sr, split: zl, preview: _l }), os = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
|
|
3230
|
-
const { draftConverter: i, edits: a, labels: c } =
|
|
3239
|
+
const { draftConverter: i, edits: a, labels: c } = $(), f = Go(), g = Zl(r, f, o), l = o ? ts : ns, u = ke(), p = B(/* @__PURE__ */ new Map()), w = {
|
|
3231
3240
|
editor: { label: c.editViewEditor, tooltip: c.editViewEditorTooltip },
|
|
3232
3241
|
split: { label: c.editViewSplit, tooltip: c.editViewSplitTooltip },
|
|
3233
3242
|
preview: { label: c.editViewPreview, tooltip: c.editViewPreviewTooltip }
|
|
@@ -3236,11 +3245,11 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3236
3245
|
}, x = (R) => {
|
|
3237
3246
|
if (!Kl(R.nativeEvent, Wl(navigator.platform))) return;
|
|
3238
3247
|
Pn(R);
|
|
3239
|
-
const A = Gl(
|
|
3248
|
+
const A = Gl(g);
|
|
3240
3249
|
dn(a, e, A, o), p.current.get(A)?.focus();
|
|
3241
3250
|
};
|
|
3242
3251
|
return /* @__PURE__ */ s("div", { role: "radiogroup", "aria-label": n ? c.editViewNamed(t) : c.editView, className: "aqmx-edit-view", "data-testid": "markdown-explorer-edit-view", onKeyDown: x, children: l.map((R) => {
|
|
3243
|
-
const A = rs[R], { label: N, tooltip: _ } =
|
|
3252
|
+
const A = rs[R], { label: N, tooltip: _ } = w[R], D = R === "preview" ? b : void 0;
|
|
3244
3253
|
return /* @__PURE__ */ H("label", { className: n ? "aqmx-icon-button" : "aqmx-icon-button aqmx-labelled-button", children: [
|
|
3245
3254
|
/* @__PURE__ */ s(
|
|
3246
3255
|
"input",
|
|
@@ -3251,7 +3260,7 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3251
3260
|
type: "radio",
|
|
3252
3261
|
name: u,
|
|
3253
3262
|
value: R,
|
|
3254
|
-
checked: R ===
|
|
3263
|
+
checked: R === g,
|
|
3255
3264
|
"aria-label": N,
|
|
3256
3265
|
"aria-keyshortcuts": R === "split" ? void 0 : Ul,
|
|
3257
3266
|
title: _,
|
|
@@ -3267,13 +3276,13 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3267
3276
|
] }, R);
|
|
3268
3277
|
}) });
|
|
3269
3278
|
}, is = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
|
|
3270
|
-
const { edits: i, labels: a } =
|
|
3279
|
+
const { edits: i, labels: a } = $(), [c, f] = U(!1);
|
|
3271
3280
|
if (r.phase.kind !== "editing") return null;
|
|
3272
|
-
const
|
|
3281
|
+
const g = r.save.kind === "saving", l = g || !r.dirty, u = () => {
|
|
3273
3282
|
i.flush(e);
|
|
3274
|
-
const
|
|
3275
|
-
|
|
3276
|
-
}, p = (
|
|
3283
|
+
const w = i.session(e);
|
|
3284
|
+
w === void 0 || !w.dirty || w.save.kind === "saving" || i.save(e);
|
|
3285
|
+
}, p = (w) => n ? { className: "aqmx-icon-button", "aria-label": w } : { className: "aqmx-icon-button aqmx-labelled-button" };
|
|
3277
3286
|
return /* @__PURE__ */ H(je, { children: [
|
|
3278
3287
|
r.save.kind === "conflicts" ? /* @__PURE__ */ H("button", { type: "button", ...p(a.conflictNext), title: a.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => i.nextConflict(e), onDoubleClick: de, children: [
|
|
3279
3288
|
/* @__PURE__ */ s(Dl, { "aria-hidden": "true" }),
|
|
@@ -3281,22 +3290,22 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3281
3290
|
] }) : null,
|
|
3282
3291
|
/* @__PURE__ */ s(os, { path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }),
|
|
3283
3292
|
r.history ? /* @__PURE__ */ H("button", { type: "button", ...p(a.historyOpen), title: a.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => f(!0), onDoubleClick: de, children: [
|
|
3284
|
-
/* @__PURE__ */ s(
|
|
3293
|
+
/* @__PURE__ */ s(Il, { "aria-hidden": "true" }),
|
|
3285
3294
|
n ? null : /* @__PURE__ */ s("span", { children: a.historyOpen })
|
|
3286
3295
|
] }) : null,
|
|
3287
|
-
r.save.kind === "draft" ? null : /* @__PURE__ */ H("button", { type: "button", ...p(a.saveDraft), title: a.saveDraftTooltip, "aria-disabled": l, "aria-busy":
|
|
3288
|
-
/* @__PURE__ */ s(
|
|
3296
|
+
r.save.kind === "draft" ? null : /* @__PURE__ */ H("button", { type: "button", ...p(a.saveDraft), title: a.saveDraftTooltip, "aria-disabled": l, "aria-busy": g, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: u, onDoubleClick: de, children: [
|
|
3297
|
+
/* @__PURE__ */ s(Fl, { "aria-hidden": "true" }),
|
|
3289
3298
|
n ? null : /* @__PURE__ */ s("span", { children: a.saveDraft })
|
|
3290
3299
|
] }),
|
|
3291
3300
|
r.history ? /* @__PURE__ */ s(Yl, { path: e, documentName: t, open: c, onClose: () => f(!1) }) : null
|
|
3292
3301
|
] });
|
|
3293
3302
|
}, as = ({ path: e, session: t }) => {
|
|
3294
|
-
const { edits: n } =
|
|
3303
|
+
const { edits: n } = $();
|
|
3295
3304
|
return t.save.kind !== "grant" ? null : /* @__PURE__ */ s(Vl, { href: t.save.href, onRetry: () => {
|
|
3296
3305
|
n.save(e);
|
|
3297
3306
|
}, testId: "markdown-explorer-save-grant" });
|
|
3298
3307
|
}, ls = /* @__PURE__ */ new Set(), ss = (e, t, n) => {
|
|
3299
|
-
const { documents: r, announcer: o, labels: i } =
|
|
3308
|
+
const { documents: r, announcer: o, labels: i } = $(), a = q(() => r.peek(e), [r, e]), c = q(() => r.peekSeeded(e), [r, e]), f = re(r.subscribe, a, c), g = q(() => r.answerStampOf(e), [r, e]), l = re(r.subscribe, g, g), [u] = U(() => /* @__PURE__ */ new Set()), [p, w] = U(ls), [b, x] = U(null);
|
|
3300
3309
|
b !== null && (b.path !== e || b.markup !== n) && x(null);
|
|
3301
3310
|
const R = B(null);
|
|
3302
3311
|
K(() => (R.current = e, () => {
|
|
@@ -3306,9 +3315,9 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3306
3315
|
K(() => {
|
|
3307
3316
|
A.current = n;
|
|
3308
3317
|
}, [n]);
|
|
3309
|
-
const N =
|
|
3318
|
+
const N = q(() => {
|
|
3310
3319
|
const d = e, m = r.peek(d);
|
|
3311
|
-
u.has(d) || m?.status === "pending" || (u.add(d),
|
|
3320
|
+
u.has(d) || m?.status === "pending" || (u.add(d), w(new Set(u)), x(null), (async () => {
|
|
3312
3321
|
try {
|
|
3313
3322
|
const k = await r.refresh(d);
|
|
3314
3323
|
if (R.current !== d || k.status === "superseded") return;
|
|
@@ -3321,7 +3330,7 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3321
3330
|
if (M === null || M.document.kind === "failure") return;
|
|
3322
3331
|
o.announce(i.documentRefreshed(M.document.name));
|
|
3323
3332
|
} finally {
|
|
3324
|
-
u.delete(d),
|
|
3333
|
+
u.delete(d), w(new Set(u));
|
|
3325
3334
|
}
|
|
3326
3335
|
})());
|
|
3327
3336
|
}, [e, t, u, r, o, i]), _ = p.has(e), D = b !== null && b.path === e && b.stamp === l && b.markup === n ? b.failure : null;
|
|
@@ -3337,11 +3346,11 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3337
3346
|
return e.showSpreadsheetMarkup(t.toUpperCase());
|
|
3338
3347
|
}
|
|
3339
3348
|
}, ds = Object.freeze({ kind: "page" }), us = ({ path: e, placement: t, markup: n }) => {
|
|
3340
|
-
const { labels: r } =
|
|
3349
|
+
const { labels: r } = $(), { refreshing: o, unavailable: i, failure: a, refresh: c } = ss(e, t.kind === "page", n.shown), f = za(e), g = Xl(e), l = _n(e), u = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, p = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, w = t.kind === "panel", b = t.kind === "panel" ? t.documentName : g.name, x = t.kind === "page" || t.maximized;
|
|
3341
3350
|
return /* @__PURE__ */ H("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", "data-aqmx-editing": l === void 0 ? void 0 : "true", children: [
|
|
3342
3351
|
/* @__PURE__ */ H("div", { className: "aqmx-document-refresh-row", children: [
|
|
3343
3352
|
l === void 0 ? null : /* @__PURE__ */ s(es, { session: l }),
|
|
3344
|
-
l === void 0 ? null : /* @__PURE__ */ s(is, { path: e, documentName: b, iconOnly:
|
|
3353
|
+
l === void 0 ? null : /* @__PURE__ */ s(is, { path: e, documentName: b, iconOnly: w, session: l, previewAvailable: x }),
|
|
3345
3354
|
l === void 0 && f !== null ? /* @__PURE__ */ H(
|
|
3346
3355
|
"button",
|
|
3347
3356
|
{
|
|
@@ -3359,7 +3368,7 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3359
3368
|
]
|
|
3360
3369
|
}
|
|
3361
3370
|
) : null,
|
|
3362
|
-
l !== void 0 ||
|
|
3371
|
+
l !== void 0 || g.edit?.kind === "inline" || g.edit?.kind === "draft" ? /* @__PURE__ */ s(Jl, { path: e, documentName: b, iconOnly: w, previewAvailable: x, draft: g.edit?.kind === "draft" }) : g.edit?.kind === "external" ? /* @__PURE__ */ s(Ql, { href: g.edit.href, documentName: b, iconOnly: w }) : null,
|
|
3363
3372
|
l === void 0 ? /* @__PURE__ */ H(
|
|
3364
3373
|
"button",
|
|
3365
3374
|
{
|
|
@@ -3374,7 +3383,7 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3374
3383
|
onClick: c,
|
|
3375
3384
|
onDoubleClick: de,
|
|
3376
3385
|
children: [
|
|
3377
|
-
/* @__PURE__ */ s(
|
|
3386
|
+
/* @__PURE__ */ s(Ol, { "aria-hidden": "true" }),
|
|
3378
3387
|
u === null ? /* @__PURE__ */ s("span", { children: r.refreshDocumentLabel }) : null
|
|
3379
3388
|
]
|
|
3380
3389
|
}
|
|
@@ -3390,20 +3399,20 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3390
3399
|
/* @__PURE__ */ s(Rl, { path: t, absence: cl, markup: e.markup, variant: n })
|
|
3391
3400
|
] });
|
|
3392
3401
|
}, ms = ({ holds: e, testId: t }) => {
|
|
3393
|
-
const { labels: n, announcer: r } =
|
|
3402
|
+
const { labels: n, announcer: r } = $(), o = ke();
|
|
3394
3403
|
K(() => e ? r.claim(o) : void 0, [e, r, o]);
|
|
3395
|
-
const i =
|
|
3404
|
+
const i = q(() => r.shownIn(o), [r, o]), a = re(r.subscribe, i, i);
|
|
3396
3405
|
return /* @__PURE__ */ s("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] });
|
|
3397
|
-
},
|
|
3406
|
+
}, we = Object.freeze([]), hs = (e) => {
|
|
3398
3407
|
const t = /* @__PURE__ */ new Set();
|
|
3399
|
-
let n =
|
|
3408
|
+
let n = we, r = [], o = !1;
|
|
3400
3409
|
const i = [], a = (l) => {
|
|
3401
3410
|
n = l;
|
|
3402
3411
|
for (const u of [...t]) u();
|
|
3403
3412
|
}, c = () => i.at(-1)?.region, f = (l) => {
|
|
3404
3413
|
const u = c();
|
|
3405
|
-
l(), c() !== u && n !==
|
|
3406
|
-
},
|
|
3414
|
+
l(), c() !== u && n !== we && a(we);
|
|
3415
|
+
}, g = () => {
|
|
3407
3416
|
o = !1;
|
|
3408
3417
|
const l = r.map((u) => "sentence" in u ? u.sentence : u.list(u.items));
|
|
3409
3418
|
r = [], a(Object.freeze(l));
|
|
@@ -3415,7 +3424,7 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3415
3424
|
const u = r.find((p) => "list" in p && p.list === l.list);
|
|
3416
3425
|
u !== void 0 && "items" in u ? u.items.push(l.item) : r.push({ list: l.list, items: [l.item] });
|
|
3417
3426
|
}
|
|
3418
|
-
o || (o = !0, n !==
|
|
3427
|
+
o || (o = !0, n !== we && a(we), e.request(g));
|
|
3419
3428
|
},
|
|
3420
3429
|
subscribe: (l) => (t.add(l), () => {
|
|
3421
3430
|
t.delete(l);
|
|
@@ -3427,7 +3436,7 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3427
3436
|
p !== -1 && i.splice(p, 1);
|
|
3428
3437
|
});
|
|
3429
3438
|
},
|
|
3430
|
-
shownIn: (l) => c() === l ? n :
|
|
3439
|
+
shownIn: (l) => c() === l ? n : we
|
|
3431
3440
|
};
|
|
3432
3441
|
}, se = Object.freeze({ status: "cancelled" }), fn = (e) => {
|
|
3433
3442
|
if (e === null || typeof e != "object") return null;
|
|
@@ -3440,19 +3449,19 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3440
3449
|
l.status === 401 && t(null);
|
|
3441
3450
|
const u = l.headers.get(_r);
|
|
3442
3451
|
u !== null && t(u);
|
|
3443
|
-
}, a = async (l, u, p,
|
|
3452
|
+
}, a = async (l, u, p, w) => {
|
|
3444
3453
|
let b;
|
|
3445
3454
|
try {
|
|
3446
3455
|
b = await r(l, { credentials: "same-origin", ...u, headers: { Accept: "application/json", ...u.headers } });
|
|
3447
3456
|
} catch {
|
|
3448
|
-
return
|
|
3457
|
+
return w({ reason: "failed" });
|
|
3449
3458
|
}
|
|
3450
3459
|
i(b);
|
|
3451
3460
|
let x;
|
|
3452
3461
|
try {
|
|
3453
3462
|
x = await b.json();
|
|
3454
3463
|
} catch {
|
|
3455
|
-
return
|
|
3464
|
+
return w({ reason: Xe(b.status) });
|
|
3456
3465
|
}
|
|
3457
3466
|
let R;
|
|
3458
3467
|
try {
|
|
@@ -3462,28 +3471,28 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3462
3471
|
}
|
|
3463
3472
|
if (R) return x;
|
|
3464
3473
|
const A = fn(x);
|
|
3465
|
-
return
|
|
3466
|
-
}, c = { [
|
|
3467
|
-
const
|
|
3468
|
-
return u.signal.aborted ? se :
|
|
3474
|
+
return w(A !== null ? A : { reason: b.status === 200 ? "failed" : Xe(b.status) });
|
|
3475
|
+
}, c = { [qt]: Zr }, f = { [qt]: Xr, "Content-Type": `${Yr}; charset=utf-8` }, g = async (l, u, p) => {
|
|
3476
|
+
const w = await a(l, u, p, (b) => Je(b.reason, b.code));
|
|
3477
|
+
return u.signal.aborted ? se : w;
|
|
3469
3478
|
};
|
|
3470
3479
|
return {
|
|
3471
|
-
tree: (l) => a(o("tree", { [te.source]: l }), { method: "GET" },
|
|
3480
|
+
tree: (l) => a(o("tree", { [te.source]: l }), { method: "GET" }, Ft, (u) => ({ status: "error", failure: u })),
|
|
3472
3481
|
children: async (l, u, p) => {
|
|
3473
|
-
const
|
|
3474
|
-
return p.aborted ? se :
|
|
3482
|
+
const w = await a(o("children", { [te.source]: l, [te.path]: u }), { method: "GET", signal: p }, Ur, (b) => ({ status: "error", failure: b }));
|
|
3483
|
+
return p.aborted ? se : w;
|
|
3475
3484
|
},
|
|
3476
3485
|
ancestors: async (l, u, p) => {
|
|
3477
|
-
const
|
|
3478
|
-
return p.aborted ? se :
|
|
3486
|
+
const w = await a(o("ancestors", { [te.source]: l, [te.path]: u }), { method: "GET", signal: p }, Vr, (b) => ({ status: "error", failure: b }));
|
|
3487
|
+
return p.aborted ? se : w;
|
|
3479
3488
|
},
|
|
3480
3489
|
reveal: async (l, u, p) => {
|
|
3481
|
-
const
|
|
3482
|
-
return p.aborted ? se :
|
|
3490
|
+
const w = await a(o("reveal", { [te.source]: l, [te.path]: u }), { method: "GET", signal: p }, zr, (b) => ({ status: "error", failure: b }));
|
|
3491
|
+
return p.aborted ? se : w;
|
|
3483
3492
|
},
|
|
3484
3493
|
document: (l, { refresh: u }) => a(o("document", { [te.path]: l }), u ? { method: "GET", headers: c } : { method: "GET" }, eo, (p) => Je(p.reason, p.code)),
|
|
3485
3494
|
text: async (l, u) => {
|
|
3486
|
-
const p = await a(o("text", { [te.path]: l }), { method: "GET", signal: u }, jr, (
|
|
3495
|
+
const p = await a(o("text", { [te.path]: l }), { method: "GET", signal: u }, jr, (w) => Je(w.reason, w.code));
|
|
3487
3496
|
return u.aborted ? se : p;
|
|
3488
3497
|
},
|
|
3489
3498
|
asset: async (l, u) => {
|
|
@@ -3495,23 +3504,23 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3495
3504
|
}
|
|
3496
3505
|
if (i(p), p.ok)
|
|
3497
3506
|
return u.aborted ? se : { status: "ok", body: p.body === null ? new ReadableStream({ start: (x) => x.close() }) : p.body };
|
|
3498
|
-
let
|
|
3507
|
+
let w = null;
|
|
3499
3508
|
try {
|
|
3500
|
-
|
|
3509
|
+
w = await p.json();
|
|
3501
3510
|
} catch {
|
|
3502
3511
|
}
|
|
3503
3512
|
if (u.aborted) return se;
|
|
3504
|
-
const b = fn(
|
|
3513
|
+
const b = fn(w);
|
|
3505
3514
|
return { status: "error", failure: b === null ? { reason: Xe(p.status) } : b };
|
|
3506
3515
|
},
|
|
3507
|
-
edit: (l, u) =>
|
|
3508
|
-
save: (l, u, p,
|
|
3509
|
-
preview: (l, u, p) =>
|
|
3510
|
-
revisions: (l, u) =>
|
|
3511
|
-
revision: (l, u, p) =>
|
|
3512
|
-
refresh: (l) => a(o("refresh", { [te.source]: l }), { method: "POST", headers: c },
|
|
3516
|
+
edit: (l, u) => g(o("edit", { [te.path]: l }), { method: "GET", signal: u }, Qr),
|
|
3517
|
+
save: (l, u, p, w) => g(o("save", { [te.path]: l, [te.base]: u }), { method: "POST", headers: f, body: p, signal: w }, Jr),
|
|
3518
|
+
preview: (l, u, p) => g(o("preview", { [te.path]: l }), { method: "POST", headers: f, body: u, signal: p }, Kr),
|
|
3519
|
+
revisions: (l, u) => g(o("revisions", { [te.path]: l }), { method: "GET", signal: u }, Wr),
|
|
3520
|
+
revision: (l, u, p) => g(o("revision", { [te.path]: l, [te.revision]: u }), { method: "GET", signal: p }, Gr),
|
|
3521
|
+
refresh: (l) => a(o("refresh", { [te.source]: l }), { method: "POST", headers: c }, Ft, (u) => ({ status: "error", failure: u }))
|
|
3513
3522
|
};
|
|
3514
|
-
},
|
|
3523
|
+
}, gs = () => {
|
|
3515
3524
|
let e = null, t = null;
|
|
3516
3525
|
return {
|
|
3517
3526
|
settle: (n) => {
|
|
@@ -3526,23 +3535,23 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3526
3535
|
return t = null, o;
|
|
3527
3536
|
}
|
|
3528
3537
|
};
|
|
3529
|
-
},
|
|
3538
|
+
}, ws = (e) => {
|
|
3530
3539
|
const t = dt(e);
|
|
3531
|
-
if (t === null) return
|
|
3540
|
+
if (t === null) return It;
|
|
3532
3541
|
try {
|
|
3533
|
-
return
|
|
3542
|
+
return Ir(JSON.parse(t));
|
|
3534
3543
|
} catch (n) {
|
|
3535
|
-
return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n),
|
|
3544
|
+
return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), It;
|
|
3536
3545
|
}
|
|
3537
3546
|
}, mn = (e, t) => {
|
|
3538
3547
|
let n = null;
|
|
3539
3548
|
const r = () => {
|
|
3540
3549
|
if (n === null) {
|
|
3541
|
-
const i =
|
|
3550
|
+
const i = ws(e);
|
|
3542
3551
|
n = { changes: i, settings: Pt(t, i) };
|
|
3543
3552
|
}
|
|
3544
3553
|
return n;
|
|
3545
|
-
}, o =
|
|
3554
|
+
}, o = Oe();
|
|
3546
3555
|
return {
|
|
3547
3556
|
storageKey: e,
|
|
3548
3557
|
defaults: t,
|
|
@@ -3554,40 +3563,40 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3554
3563
|
return n = { changes: f, settings: Pt(t, f) }, o.emit(), ct(e, Pr(f)), n.settings;
|
|
3555
3564
|
}
|
|
3556
3565
|
};
|
|
3557
|
-
}, vs = Object.freeze({ status: "refreshed" }), bs = Object.freeze({ status: "superseded" }), pt = Object.freeze({ status: "deferred" }), Es =
|
|
3558
|
-
const t = /* @__PURE__ */ new Map(), n = Vn(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c =
|
|
3559
|
-
let
|
|
3566
|
+
}, vs = Object.freeze({ status: "refreshed" }), bs = Object.freeze({ status: "superseded" }), pt = Object.freeze({ status: "deferred" }), Es = qn(pt), cr = 4, ys = cr - 1, hn = Object.freeze({ status: "loading" }), Ss = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), ks = (e) => {
|
|
3567
|
+
const t = /* @__PURE__ */ new Map(), n = Vn(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = Oe(), f = /* @__PURE__ */ new Set();
|
|
3568
|
+
let g = 0, l = 0;
|
|
3560
3569
|
const u = { direct: null, bulk: null }, p = /* @__PURE__ */ new Set();
|
|
3561
|
-
let
|
|
3570
|
+
let w = !1, b = 0;
|
|
3562
3571
|
const x = () => {
|
|
3563
3572
|
b += 1, c.emit();
|
|
3564
3573
|
}, R = (h) => o.get(h) ?? 0, A = (h) => {
|
|
3565
3574
|
let E = a.get(h);
|
|
3566
3575
|
return E === void 0 && (E = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, a.set(h, E)), E;
|
|
3567
3576
|
}, N = (h, E, S) => {
|
|
3568
|
-
h.inFlight.delete(E),
|
|
3577
|
+
h.inFlight.delete(E), g -= 1, S.lane === "bulk" && (l -= 1);
|
|
3569
3578
|
}, _ = (h) => {
|
|
3570
3579
|
const E = a.get(h);
|
|
3571
3580
|
if (E !== void 0) {
|
|
3572
|
-
for (const [S,
|
|
3573
|
-
N(E, S,
|
|
3581
|
+
for (const [S, O] of [...E.inFlight])
|
|
3582
|
+
N(E, S, O), O.controller.abort();
|
|
3574
3583
|
E.direct.clear(), E.bulk.clear(), E.unclaimed.clear();
|
|
3575
3584
|
}
|
|
3576
3585
|
}, D = (h) => {
|
|
3577
3586
|
const E = R(h) + 1;
|
|
3578
3587
|
return o.set(h, E), _(h), E;
|
|
3579
3588
|
}, d = (h, E) => {
|
|
3580
|
-
const S = Ee(h),
|
|
3589
|
+
const S = Ee(h), O = { promise: h, opened: E, stale: !1, loadedAt: S?.status === "ok" ? S.loadedAt : null };
|
|
3581
3590
|
return h.status === "pending" && h.then((z) => {
|
|
3582
|
-
z.status === "ok" && (
|
|
3583
|
-
}),
|
|
3591
|
+
z.status === "ok" && (O.loadedAt = z.loadedAt);
|
|
3592
|
+
}), O;
|
|
3584
3593
|
}, m = (h) => {
|
|
3585
3594
|
let E = r.get(h);
|
|
3586
3595
|
return E === void 0 && (E = /* @__PURE__ */ new Map(), r.set(h, E)), E;
|
|
3587
3596
|
}, k = (h) => {
|
|
3588
|
-
const E = [...a.keys()], S = u[h],
|
|
3597
|
+
const E = [...a.keys()], S = u[h], O = S === null ? 0 : E.indexOf(S) + 1;
|
|
3589
3598
|
for (let z = 0; z < E.length; z += 1) {
|
|
3590
|
-
const G = E[(
|
|
3599
|
+
const G = E[(O + z) % E.length], J = G === void 0 ? void 0 : a.get(G);
|
|
3591
3600
|
if (!(G === void 0 || J === void 0)) {
|
|
3592
3601
|
for (const W of J[h])
|
|
3593
3602
|
if ((J.claims.get(W) ?? 0) !== 0)
|
|
@@ -3595,32 +3604,32 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3595
3604
|
}
|
|
3596
3605
|
}
|
|
3597
3606
|
return null;
|
|
3598
|
-
}, M = (h, E, S,
|
|
3607
|
+
}, M = (h, E, S, O) => {
|
|
3599
3608
|
const z = a.get(h);
|
|
3600
3609
|
if (z === void 0 || z.inFlight.get(E) !== S) return;
|
|
3601
3610
|
N(z, E, S);
|
|
3602
3611
|
const G = (z.claims.get(E) ?? 0) > 0, J = m(h);
|
|
3603
|
-
if (
|
|
3604
|
-
const W = { sourceId: h, path: E, failure:
|
|
3612
|
+
if (O.status === "ok" ? J.set(E, { status: "loaded", entries: O.entries }) : O.status === "error" && G ? J.set(E, { status: "failed", failure: O.failure }) : J.delete(E), x(), O.status === "error" && G) {
|
|
3613
|
+
const W = { sourceId: h, path: E, failure: O.failure };
|
|
3605
3614
|
for (const ie of [...f]) ie(W);
|
|
3606
3615
|
}
|
|
3607
|
-
|
|
3608
|
-
},
|
|
3609
|
-
const
|
|
3610
|
-
A(h).inFlight.set(E,
|
|
3611
|
-
(z) => M(h, E,
|
|
3612
|
-
() => M(h, E,
|
|
3616
|
+
F();
|
|
3617
|
+
}, I = (h, E, S) => {
|
|
3618
|
+
const O = { controller: new AbortController(), lane: S };
|
|
3619
|
+
A(h).inFlight.set(E, O), g += 1, S === "bulk" && (l += 1), e.children(h, E, O.controller.signal).then(
|
|
3620
|
+
(z) => M(h, E, O, z),
|
|
3621
|
+
() => M(h, E, O, Ss)
|
|
3613
3622
|
);
|
|
3614
|
-
},
|
|
3615
|
-
for (;
|
|
3623
|
+
}, F = () => {
|
|
3624
|
+
for (; g < cr; ) {
|
|
3616
3625
|
const h = k("direct");
|
|
3617
3626
|
if (h !== null) {
|
|
3618
|
-
|
|
3627
|
+
I(h.sourceId, h.path, "direct");
|
|
3619
3628
|
continue;
|
|
3620
3629
|
}
|
|
3621
3630
|
const E = l < ys ? k("bulk") : null;
|
|
3622
3631
|
if (E === null) return;
|
|
3623
|
-
|
|
3632
|
+
I(E.sourceId, E.path, "bulk");
|
|
3624
3633
|
}
|
|
3625
3634
|
}, v = (h, E, S) => {
|
|
3626
3635
|
if (!(E.direct.delete(S) || E.bulk.delete(S))) {
|
|
@@ -3630,30 +3639,30 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3630
3639
|
}
|
|
3631
3640
|
return r.get(h)?.delete(S), !0;
|
|
3632
3641
|
}, T = () => {
|
|
3633
|
-
|
|
3642
|
+
w = !1;
|
|
3634
3643
|
let h = !1;
|
|
3635
3644
|
for (const E of p) {
|
|
3636
3645
|
const S = A(E);
|
|
3637
|
-
for (const
|
|
3638
|
-
(S.claims.get(
|
|
3646
|
+
for (const O of S.unclaimed)
|
|
3647
|
+
(S.claims.get(O) ?? 0) === 0 && v(E, S, O) && (h = !0);
|
|
3639
3648
|
S.unclaimed.clear();
|
|
3640
3649
|
}
|
|
3641
|
-
p.clear(), h && (x(),
|
|
3650
|
+
p.clear(), h && (x(), F());
|
|
3642
3651
|
}, L = (h, E) => {
|
|
3643
3652
|
t.set(h, d(Re(e.tree(h)), E));
|
|
3644
|
-
},
|
|
3653
|
+
}, C = (h, E, S) => {
|
|
3645
3654
|
D(h);
|
|
3646
|
-
const
|
|
3647
|
-
return t.set(h,
|
|
3648
|
-
}, P = (h, E, S,
|
|
3655
|
+
const O = d(qn(E), S);
|
|
3656
|
+
return t.set(h, O), r.delete(h), x(), F(), O;
|
|
3657
|
+
}, P = (h, E, S, O) => {
|
|
3649
3658
|
if (S !== R(h) || t.get(h) !== E) return;
|
|
3650
3659
|
const z = Ee(E.promise);
|
|
3651
|
-
if (!(
|
|
3652
|
-
if (He(z.entries,
|
|
3653
|
-
E.loadedAt =
|
|
3660
|
+
if (!(O.status !== "ok" || z?.status !== "ok" || E.loadedAt === null || O.loadedAt <= E.loadedAt)) {
|
|
3661
|
+
if (He(z.entries, O.entries)) {
|
|
3662
|
+
E.loadedAt = O.loadedAt;
|
|
3654
3663
|
return;
|
|
3655
3664
|
}
|
|
3656
|
-
|
|
3665
|
+
C(h, O, E.opened);
|
|
3657
3666
|
}
|
|
3658
3667
|
}, j = (h, E) => {
|
|
3659
3668
|
const S = t.get(h);
|
|
@@ -3661,13 +3670,13 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3661
3670
|
}, X = (h, E) => {
|
|
3662
3671
|
E.stale = !1;
|
|
3663
3672
|
const S = R(h);
|
|
3664
|
-
e.tree(h).then((
|
|
3673
|
+
e.tree(h).then((O) => P(h, E, S, O));
|
|
3665
3674
|
};
|
|
3666
3675
|
return {
|
|
3667
3676
|
read: (h) => t.get(h)?.promise ?? Es,
|
|
3668
3677
|
open: (h) => {
|
|
3669
|
-
const E = n.resumes(h), S = n.hold(h),
|
|
3670
|
-
return
|
|
3678
|
+
const E = n.resumes(h), S = n.hold(h), O = t.get(h);
|
|
3679
|
+
return O === void 0 || j(h, "deferred") ? (L(h, !0), x()) : E || (O.opened && j(h, "error") ? (L(h, !0), x()) : (O.opened = !0, O.stale && j(h, "ok") && X(h, O))), S;
|
|
3671
3680
|
},
|
|
3672
3681
|
retry: (h) => {
|
|
3673
3682
|
j(h, "error") && (L(h, !0), x());
|
|
@@ -3676,15 +3685,15 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3676
3685
|
const S = E.then(
|
|
3677
3686
|
(G) => G === null ? pt : G,
|
|
3678
3687
|
() => pt
|
|
3679
|
-
),
|
|
3680
|
-
if (
|
|
3688
|
+
), O = t.get(h);
|
|
3689
|
+
if (O !== void 0 && j(h, "ok")) {
|
|
3681
3690
|
const G = R(h);
|
|
3682
|
-
S.then((J) => P(h,
|
|
3691
|
+
S.then((J) => P(h, O, G, J));
|
|
3683
3692
|
return;
|
|
3684
3693
|
}
|
|
3685
3694
|
D(h);
|
|
3686
|
-
const z = d(Re(S),
|
|
3687
|
-
t.set(h, z), r.delete(h),
|
|
3695
|
+
const z = d(Re(S), O?.opened === !0);
|
|
3696
|
+
t.set(h, z), r.delete(h), F(), S.then((G) => {
|
|
3688
3697
|
t.get(h) === z && (G.status === "deferred" && n.isHeld(h) && L(h, z.opened), x());
|
|
3689
3698
|
});
|
|
3690
3699
|
},
|
|
@@ -3694,12 +3703,12 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3694
3703
|
const S = await e.refresh(h);
|
|
3695
3704
|
if (i.get(h) !== E) return bs;
|
|
3696
3705
|
if (S.status === "error") return { status: "failed", failure: S.failure };
|
|
3697
|
-
const
|
|
3698
|
-
if (!(
|
|
3699
|
-
const G =
|
|
3700
|
-
if (
|
|
3706
|
+
const O = t.get(h);
|
|
3707
|
+
if (!(O !== void 0 && O.loadedAt !== null && j(h, "ok") && O.loadedAt > S.loadedAt)) {
|
|
3708
|
+
const G = C(h, S, !0);
|
|
3709
|
+
if (O !== void 0 && O.promise.status === "pending") {
|
|
3701
3710
|
const J = R(h);
|
|
3702
|
-
|
|
3711
|
+
O.promise.then((W) => P(h, G, J, W));
|
|
3703
3712
|
}
|
|
3704
3713
|
}
|
|
3705
3714
|
for (const [G, J] of t)
|
|
@@ -3708,11 +3717,11 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3708
3717
|
},
|
|
3709
3718
|
children: (h, E) => r.get(h)?.get(E),
|
|
3710
3719
|
claimChildren: (h, E) => {
|
|
3711
|
-
const S = A(h),
|
|
3720
|
+
const S = A(h), O = m(h);
|
|
3712
3721
|
let z = !1, G = !1;
|
|
3713
3722
|
for (const [W, ie] of E)
|
|
3714
|
-
S.claims.set(W, (S.claims.get(W) ?? 0) + 1),
|
|
3715
|
-
z && x(), G &&
|
|
3723
|
+
S.claims.set(W, (S.claims.get(W) ?? 0) + 1), O.get(W) === void 0 ? (O.set(W, hn), S[ie].add(W), z = !0, G = !0) : ie === "direct" && S.bulk.delete(W) && (S.direct.add(W), G = !0);
|
|
3724
|
+
z && x(), G && F();
|
|
3716
3725
|
let J = !1;
|
|
3717
3726
|
return () => {
|
|
3718
3727
|
if (!J) {
|
|
@@ -3721,16 +3730,16 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3721
3730
|
const ie = (S.claims.get(W) ?? 0) - 1;
|
|
3722
3731
|
ie > 0 ? S.claims.set(W, ie) : (S.claims.delete(W), S.unclaimed.add(W));
|
|
3723
3732
|
}
|
|
3724
|
-
p.add(h), !
|
|
3733
|
+
p.add(h), !w && (w = !0, queueMicrotask(T));
|
|
3725
3734
|
}
|
|
3726
3735
|
};
|
|
3727
3736
|
},
|
|
3728
3737
|
retryChildren: (h, E) => {
|
|
3729
3738
|
const S = r.get(h);
|
|
3730
3739
|
if (S === void 0 || S.get(E)?.status !== "failed") return;
|
|
3731
|
-
const
|
|
3732
|
-
if ((
|
|
3733
|
-
S.set(E, hn),
|
|
3740
|
+
const O = A(h);
|
|
3741
|
+
if ((O.claims.get(E) ?? 0) > 0) {
|
|
3742
|
+
S.set(E, hn), O.direct.add(E), x(), F();
|
|
3734
3743
|
return;
|
|
3735
3744
|
}
|
|
3736
3745
|
S.delete(E), x();
|
|
@@ -3752,7 +3761,7 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3752
3761
|
};
|
|
3753
3762
|
}, xs = (e, t) => {
|
|
3754
3763
|
let n = e;
|
|
3755
|
-
const r =
|
|
3764
|
+
const r = Oe();
|
|
3756
3765
|
return {
|
|
3757
3766
|
getSnapshot: () => n,
|
|
3758
3767
|
subscribe: r.subscribe,
|
|
@@ -3761,27 +3770,27 @@ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId
|
|
|
3761
3770
|
}
|
|
3762
3771
|
};
|
|
3763
3772
|
}, Ts = 1;
|
|
3764
|
-
let
|
|
3773
|
+
let Ie = 0, ue = null;
|
|
3765
3774
|
const Rs = () => {
|
|
3766
3775
|
const { documentElement: e, body: t } = document;
|
|
3767
|
-
|
|
3776
|
+
Ie === 0 && (ue = { 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"), Ie += 1;
|
|
3768
3777
|
let n = !1;
|
|
3769
3778
|
return () => {
|
|
3770
|
-
n || (n = !0,
|
|
3779
|
+
n || (n = !0, Ie -= 1, !(Ie > 0 || ue === null) && (e.style.overflow = ue.htmlOverflow, t.style.overflow = ue.bodyOverflow, e.style.scrollbarGutter = ue.htmlGutter, t.style.scrollbarGutter = ue.bodyGutter, ue = null));
|
|
3771
3780
|
};
|
|
3772
|
-
},
|
|
3781
|
+
}, Cs = [
|
|
3773
3782
|
{ selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
|
|
3774
3783
|
{ selector: "[data-aqmx-explorer-body]", name: "tree area" }
|
|
3775
|
-
], pn = 1,
|
|
3776
|
-
if (!
|
|
3784
|
+
], pn = 1, Os = 1e3, gn = (e) => e.getClientRects().length > 0, at = "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.", Ms = (e) => {
|
|
3785
|
+
if (!gn(e)) return null;
|
|
3777
3786
|
const t = e.getBoundingClientRect(), n = window.innerHeight;
|
|
3778
3787
|
if (t.bottom > n + Ts)
|
|
3779
3788
|
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. ${at}`;
|
|
3780
3789
|
if (t.height < pn)
|
|
3781
3790
|
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. ${at}`;
|
|
3782
|
-
for (const { selector: r, name: o } of
|
|
3791
|
+
for (const { selector: r, name: o } of Cs)
|
|
3783
3792
|
for (const i of e.querySelectorAll(r)) {
|
|
3784
|
-
if (!
|
|
3793
|
+
if (!gn(i)) continue;
|
|
3785
3794
|
const a = i.getBoundingClientRect().height;
|
|
3786
3795
|
if (a < pn)
|
|
3787
3796
|
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. ${at}`;
|
|
@@ -3794,7 +3803,7 @@ const Rs = () => {
|
|
|
3794
3803
|
const a = Ms(e);
|
|
3795
3804
|
a !== null && (t = !0, console.error(a));
|
|
3796
3805
|
}, o = () => {
|
|
3797
|
-
t || (clearTimeout(n), n = setTimeout(r,
|
|
3806
|
+
t || (clearTimeout(n), n = setTimeout(r, Os));
|
|
3798
3807
|
}, i = typeof ResizeObserver > "u" ? null : new ResizeObserver(o);
|
|
3799
3808
|
return i?.observe(e), window.addEventListener("resize", o), o(), () => {
|
|
3800
3809
|
clearTimeout(n), i?.disconnect(), window.removeEventListener("resize", o);
|
|
@@ -3805,8 +3814,8 @@ const Rs = () => {
|
|
|
3805
3814
|
if (!(!e || n === null))
|
|
3806
3815
|
return Ls(n);
|
|
3807
3816
|
}, [e, t]);
|
|
3808
|
-
},
|
|
3809
|
-
{ control:
|
|
3817
|
+
}, wn = '[data-testid="markdown-explorer-view-switch"]', Ns = [
|
|
3818
|
+
{ control: wn, successors: [wn, '[data-testid="markdown-explorer-sheet-toggle"]'] },
|
|
3810
3819
|
{ control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
|
|
3811
3820
|
], Ds = (e) => {
|
|
3812
3821
|
for (const t of Ns) {
|
|
@@ -3841,10 +3850,10 @@ const Rs = () => {
|
|
|
3841
3850
|
const i = () => {
|
|
3842
3851
|
const f = document.activeElement;
|
|
3843
3852
|
if (f !== null && f !== document.body && f !== o.element) return !0;
|
|
3844
|
-
const
|
|
3845
|
-
if (
|
|
3853
|
+
const g = e.current;
|
|
3854
|
+
if (g === null) return !0;
|
|
3846
3855
|
for (const l of o.control.successors)
|
|
3847
|
-
for (const u of
|
|
3856
|
+
for (const u of g.querySelectorAll(l))
|
|
3848
3857
|
if (u !== o.element && (u.focus({ preventScroll: !0 }), document.activeElement === u))
|
|
3849
3858
|
return !0;
|
|
3850
3859
|
return !1;
|
|
@@ -3857,7 +3866,7 @@ const Rs = () => {
|
|
|
3857
3866
|
});
|
|
3858
3867
|
return c.observe(a, { childList: !0, subtree: !0 }), () => c.disconnect();
|
|
3859
3868
|
}, [t, e]);
|
|
3860
|
-
},
|
|
3869
|
+
}, Is = gt(() => import("./TreeLayout-BQ1lWVf3.js").then((e) => ({ default: e.TreeLayout }))), $s = gt(() => import("./MultiLayout-DXnuRzb4.js").then((e) => ({ default: e.MultiLayout }))), Fs = 64, qs = {
|
|
3861
3870
|
request: (e) => {
|
|
3862
3871
|
requestAnimationFrame(e);
|
|
3863
3872
|
}
|
|
@@ -3881,7 +3890,7 @@ const Rs = () => {
|
|
|
3881
3890
|
if (n.scope === e) return n.value;
|
|
3882
3891
|
const o = { scope: e, value: t() };
|
|
3883
3892
|
return r(o), o.value;
|
|
3884
|
-
}, Hs = () => hs(
|
|
3893
|
+
}, Hs = () => hs(qs), bn = "on", js = "off", zs = Object.freeze({ kind: "unavailable" }), Vs = (e) => {
|
|
3885
3894
|
if (e !== void 0 && (e === null || typeof e != "object" || typeof e.convert != "function"))
|
|
3886
3895
|
throw new TypeError("[markdown-explorer] draftConverter must be an object with a convert function");
|
|
3887
3896
|
}, Us = (e, t) => {
|
|
@@ -3897,15 +3906,15 @@ const Rs = () => {
|
|
|
3897
3906
|
renderFrame: a,
|
|
3898
3907
|
renderTreeFailure: c,
|
|
3899
3908
|
lockDocumentScroll: f = !1,
|
|
3900
|
-
onMathDiagnostics:
|
|
3909
|
+
onMathDiagnostics: g,
|
|
3901
3910
|
onEditGrant: l,
|
|
3902
3911
|
draftConverter: u
|
|
3903
3912
|
}) => {
|
|
3904
3913
|
so(n), Vs(u);
|
|
3905
|
-
const p = An(r),
|
|
3914
|
+
const p = An(r), w = Eo(i), b = _s(p, o), { revalidate: x } = Tr(), R = B(() => {
|
|
3906
3915
|
}), A = ze(t.dataPath), [N] = U(() => {
|
|
3907
|
-
const S = ps({ dataPath: A, onScope: (z) => R.current(z) }),
|
|
3908
|
-
return lt(
|
|
3916
|
+
const S = ps({ dataPath: A, onScope: (z) => R.current(z) }), O = { documents: Si({ client: S, capacity: Math.max(Fs, t.multiView.maxPanels * 2) }), trees: ks(S) };
|
|
3917
|
+
return lt(O, e), Ht(n, e.scope), { data: S, ...O, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
|
|
3909
3918
|
});
|
|
3910
3919
|
if (N.aligned.pageData !== e || N.aligned.storageNamespace !== n) {
|
|
3911
3920
|
const S = N.aligned.pageData;
|
|
@@ -3917,8 +3926,8 @@ const Rs = () => {
|
|
|
3917
3926
|
S !== null && (N.aligned.pendingReader = null, vn(N), lt(N, S));
|
|
3918
3927
|
}, [e, N]), K(() => {
|
|
3919
3928
|
let S = !1;
|
|
3920
|
-
return R.current = (
|
|
3921
|
-
|
|
3929
|
+
return R.current = (O) => {
|
|
3930
|
+
O === e.scope || S || (S = !0, O !== null && (vn(N), co(n)), x());
|
|
3922
3931
|
}, () => {
|
|
3923
3932
|
R.current = () => {
|
|
3924
3933
|
};
|
|
@@ -3930,20 +3939,20 @@ const Rs = () => {
|
|
|
3930
3939
|
}, [t.settingsCookie]);
|
|
3931
3940
|
const [d] = U(
|
|
3932
3941
|
() => xs(e.settings, (S) => {
|
|
3933
|
-
document.cookie =
|
|
3942
|
+
document.cookie = Fr(D.current, S, window.location.protocol === "https:");
|
|
3934
3943
|
})
|
|
3935
|
-
), m = st(e.scope, Hs), k = st(e.scope,
|
|
3944
|
+
), m = st(e.scope, Hs), k = st(e.scope, gs), M = B(b);
|
|
3936
3945
|
K(() => {
|
|
3937
3946
|
M.current = b;
|
|
3938
3947
|
}, [b]);
|
|
3939
|
-
const
|
|
3948
|
+
const I = st(
|
|
3940
3949
|
e.scope,
|
|
3941
3950
|
() => Ao({
|
|
3942
3951
|
data: N.data,
|
|
3943
3952
|
conflictLabels: () => ({ ours: M.current.conflictOurs, theirs: M.current.conflictTheirs }),
|
|
3944
|
-
onSaveSettled: (S,
|
|
3945
|
-
|
|
3946
|
-
const z = So(M.current,
|
|
3953
|
+
onSaveSettled: (S, O) => {
|
|
3954
|
+
O.kind === "saved" && N.documents.refresh(S);
|
|
3955
|
+
const z = So(M.current, O, Us(N.documents, S));
|
|
3947
3956
|
z !== null && m.announce(z);
|
|
3948
3957
|
},
|
|
3949
3958
|
sideBySideSetting: {
|
|
@@ -3955,31 +3964,31 @@ const Rs = () => {
|
|
|
3955
3964
|
write: (S) => ct(ve(n).editSplit, String(S))
|
|
3956
3965
|
}
|
|
3957
3966
|
})
|
|
3958
|
-
),
|
|
3959
|
-
`), T = Y(() =>
|
|
3960
|
-
`)), [t, v]), L = B(
|
|
3967
|
+
), F = Y(() => Re(e.notices.catch(() => [])), [e.notices]), v = e.sources.map((S) => S.id).join(`
|
|
3968
|
+
`), T = Y(() => $r(t, v.split(`
|
|
3969
|
+
`)), [t, v]), L = B(g);
|
|
3961
3970
|
K(() => {
|
|
3962
|
-
L.current =
|
|
3963
|
-
}, [
|
|
3964
|
-
const [
|
|
3965
|
-
L.current?.(S,
|
|
3966
|
-
}), P =
|
|
3971
|
+
L.current = g;
|
|
3972
|
+
}, [g]);
|
|
3973
|
+
const [C] = U(() => (S, O) => {
|
|
3974
|
+
L.current?.(S, O);
|
|
3975
|
+
}), P = g === void 0 ? void 0 : C, j = B(u);
|
|
3967
3976
|
K(() => {
|
|
3968
3977
|
j.current = u;
|
|
3969
3978
|
}, [u]);
|
|
3970
3979
|
const [X] = U(() => {
|
|
3971
3980
|
let S = !1;
|
|
3972
3981
|
return {
|
|
3973
|
-
convert: (
|
|
3982
|
+
convert: (O, z) => {
|
|
3974
3983
|
const G = j.current;
|
|
3975
|
-
return G === void 0 ? Promise.resolve(zs) : G.convert(
|
|
3984
|
+
return G === void 0 ? Promise.resolve(zs) : G.convert(O, z);
|
|
3976
3985
|
},
|
|
3977
3986
|
prepare: () => {
|
|
3978
3987
|
try {
|
|
3979
3988
|
j.current?.prepare?.();
|
|
3980
|
-
} catch (
|
|
3989
|
+
} catch (O) {
|
|
3981
3990
|
if (S) return;
|
|
3982
|
-
S = !0, console.error("[markdown-explorer] the draft converter's prepare threw",
|
|
3991
|
+
S = !0, console.error("[markdown-explorer] the draft converter's prepare threw", O);
|
|
3983
3992
|
}
|
|
3984
3993
|
}
|
|
3985
3994
|
};
|
|
@@ -3988,11 +3997,11 @@ const Rs = () => {
|
|
|
3988
3997
|
config: T,
|
|
3989
3998
|
labels: b,
|
|
3990
3999
|
locale: p,
|
|
3991
|
-
theme:
|
|
4000
|
+
theme: w,
|
|
3992
4001
|
storageNamespace: n,
|
|
3993
4002
|
scope: e.scope,
|
|
3994
4003
|
sources: e.sources,
|
|
3995
|
-
notices:
|
|
4004
|
+
notices: F,
|
|
3996
4005
|
documents: N.documents,
|
|
3997
4006
|
trees: N.trees,
|
|
3998
4007
|
data: N.data,
|
|
@@ -4000,31 +4009,31 @@ const Rs = () => {
|
|
|
4000
4009
|
treeSettings: _,
|
|
4001
4010
|
announcer: m,
|
|
4002
4011
|
reveals: k,
|
|
4003
|
-
edits:
|
|
4012
|
+
edits: I,
|
|
4004
4013
|
onEditGrant: l,
|
|
4005
4014
|
draftConverter: h,
|
|
4006
4015
|
renderTreeFailure: c,
|
|
4007
4016
|
reportMathDiagnostics: P
|
|
4008
4017
|
}),
|
|
4009
|
-
[T, b, p,
|
|
4018
|
+
[T, b, p, w, n, e.scope, e.sources, F, N, d, _, m, k, I, l, h, c, P]
|
|
4010
4019
|
);
|
|
4011
4020
|
return /* @__PURE__ */ s(Nn, { value: E, children: /* @__PURE__ */ s(Gs, { renderFrame: a, lockDocumentScroll: f }, e.scope) });
|
|
4012
4021
|
}, Zs = ({ ref: e, theme: t, view: n, children: r }) => {
|
|
4013
4022
|
const [o] = U(ca);
|
|
4014
4023
|
return /* @__PURE__ */ s("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 });
|
|
4015
4024
|
}, Gs = ({ renderFrame: e, lockDocumentScroll: t }) => {
|
|
4016
|
-
const { theme: n, labels: r } =
|
|
4025
|
+
const { theme: n, labels: r } = $(), o = bt(), { hash: i } = yn(), a = Ve(), c = B(null);
|
|
4017
4026
|
As(t, c), K(() => {
|
|
4018
4027
|
o.kind === "redirect" && a(`${o.href}${i}`, "browse");
|
|
4019
4028
|
}, [o, i, a]);
|
|
4020
|
-
const { location: f } = o,
|
|
4021
|
-
Ps(c,
|
|
4022
|
-
const l = f.view === "tree" ? /* @__PURE__ */ s(xe, { fallback: /* @__PURE__ */ s("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading", ...ut }), children: /* @__PURE__ */ s(
|
|
4029
|
+
const { location: f } = o, g = f.view;
|
|
4030
|
+
Ps(c, g);
|
|
4031
|
+
const l = f.view === "tree" ? /* @__PURE__ */ s(xe, { fallback: /* @__PURE__ */ s("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading", ...ut }), children: /* @__PURE__ */ s(Is, { location: f }) }) : f.view === "multi" ? /* @__PURE__ */ s(xe, { fallback: /* @__PURE__ */ s("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading", ...ut }), children: /* @__PURE__ */ s($s, { location: f }) }) : /* @__PURE__ */ s(fs, { location: f }), u = /* @__PURE__ */ H(Zs, { ref: c, theme: n, view: g, children: [
|
|
4023
4032
|
l,
|
|
4024
4033
|
/* @__PURE__ */ s(Ko, {}),
|
|
4025
4034
|
/* @__PURE__ */ s(ms, { holds: !0, testId: "markdown-explorer-announcer" })
|
|
4026
4035
|
] });
|
|
4027
|
-
return e === void 0 ? u : e({ view:
|
|
4036
|
+
return e === void 0 ? u : e({ view: g, children: u });
|
|
4028
4037
|
}, uc = uo({ submissions: "skip", otherPath: "skip", query: "skip", hashChange: "skip" });
|
|
4029
4038
|
export {
|
|
4030
4039
|
mo as $,
|
|
@@ -4036,7 +4045,7 @@ export {
|
|
|
4036
4045
|
_o as F,
|
|
4037
4046
|
dn as G,
|
|
4038
4047
|
Gl as H,
|
|
4039
|
-
|
|
4048
|
+
Oe as I,
|
|
4040
4049
|
sc as J,
|
|
4041
4050
|
ua as K,
|
|
4042
4051
|
No as L,
|
|
@@ -4044,8 +4053,8 @@ export {
|
|
|
4044
4053
|
cl as N,
|
|
4045
4054
|
bi as O,
|
|
4046
4055
|
ds as P,
|
|
4047
|
-
|
|
4048
|
-
|
|
4056
|
+
Ol as Q,
|
|
4057
|
+
gi as R,
|
|
4049
4058
|
_l as S,
|
|
4050
4059
|
pi as T,
|
|
4051
4060
|
bt as U,
|
|
@@ -4053,7 +4062,7 @@ export {
|
|
|
4053
4062
|
_e as W,
|
|
4054
4063
|
fo as X,
|
|
4055
4064
|
Vt as Y,
|
|
4056
|
-
|
|
4065
|
+
go as Z,
|
|
4057
4066
|
Ln as _,
|
|
4058
4067
|
xo as a,
|
|
4059
4068
|
jt as a0,
|
|
@@ -4079,7 +4088,7 @@ export {
|
|
|
4079
4088
|
jo as r,
|
|
4080
4089
|
Go as s,
|
|
4081
4090
|
Zl as t,
|
|
4082
|
-
|
|
4091
|
+
$ as u,
|
|
4083
4092
|
di as v,
|
|
4084
4093
|
lc as w,
|
|
4085
4094
|
cc as x,
|