@aiquants/markdown-explorer 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/README.md +39 -24
- package/dist/{EditSurface-Co4Rvfa1.cjs → EditSurface-B1yD7ywF.cjs} +1 -1
- package/dist/{EditSurface-Blymamic.js → EditSurface-sUNqYw9o.js} +5 -5
- package/dist/{ExplorerSplit-WApgYMPb.cjs → ExplorerSplit-Bn3ZnEMZ.cjs} +1 -1
- package/dist/{ExplorerSplit-BZ0PA3z3.js → ExplorerSplit-pClUl3-e.js} +3 -3
- package/dist/{MultiLayout-dAW_JCzg.cjs → MultiLayout-0Jh08fxo.cjs} +1 -1
- package/dist/{MultiLayout-B5-1N3JD.js → MultiLayout-B-ft4_Vs.js} +4 -4
- package/dist/{NativeScrollBar-BraWuZvN.js → NativeScrollBar-ByawerpG.js} +1 -1
- package/dist/{NativeScrollBar-ThVMbI0Y.cjs → NativeScrollBar-D9QrjRJa.cjs} +1 -1
- package/dist/{TreeLayout-C60lb9hP.cjs → TreeLayout-CXHbKdxy.cjs} +1 -1
- package/dist/{TreeLayout-CChoxh9W.js → TreeLayout-DjIVKBG4.js} +3 -3
- package/dist/core/config.d.cts +7 -0
- package/dist/core/config.d.ts +7 -0
- package/dist/core/contracts.d.cts +8 -2
- package/dist/core/contracts.d.ts +8 -2
- package/dist/core/dataRoute.d.cts +40 -0
- package/dist/core/dataRoute.d.ts +40 -0
- package/dist/core/labels.d.cts +10 -1
- package/dist/core/labels.d.ts +10 -1
- package/dist/{dataRoute-BEvesOvN.js → dataRoute-DLhQfdoW.js} +111 -103
- package/dist/dataRoute-DwYtgyt6.cjs +1 -0
- package/dist/index-BNAkC0g3.js +4800 -0
- package/dist/index-DRMNpWDJ.cjs +15 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -26
- package/dist/{location-DIxIjqs7.js → location-BNFdxzhn.js} +134 -130
- package/dist/location-yvU5HUY1.cjs +1 -0
- package/dist/{merge-DRWmjC24.cjs → merge-BBU1pDoT.cjs} +1 -1
- package/dist/{merge-CgSp-0Dd.js → merge-DhHzRcAI.js} +1 -1
- package/dist/{sanitizePolicy-gVKBhabq.js → sanitizePolicy-By0tKOpZ.js} +1 -1
- package/dist/{sanitizePolicy-CZwOaJ92.cjs → sanitizePolicy-T5T-3vV5.cjs} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/ports.d.cts +4 -3
- package/dist/server/ports.d.ts +4 -3
- package/dist/server.cjs +1 -1
- package/dist/server.js +500 -493
- package/dist/styles/markdown-explorer.css +1 -1
- package/dist/{useSplitPersistence-Df63lnQZ.js → useSplitPersistence-D5EjJwCg.js} +1 -1
- package/dist/{useSplitPersistence-D-T75Hlh.cjs → useSplitPersistence-xGOSwpLM.cjs} +1 -1
- package/docs/behavior/dom-hooks.md +10 -6
- package/docs/behavior/layout.md +8 -3
- package/docs/behavior/localization.md +5 -2
- package/docs/behavior/security.md +7 -2
- package/docs/behavior/url-contract.md +3 -3
- package/package.json +5 -5
- package/dist/dataRoute-Cv7fgCW7.cjs +0 -1
- package/dist/index-B6FkGD-p.cjs +0 -13
- package/dist/index-Bd6hgisa.js +0 -4097
- package/dist/location-D3DgoELB.cjs +0 -1
|
@@ -0,0 +1,4800 @@
|
|
|
1
|
+
import { jsxs as B, jsx as c, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
+
import * as E from "react";
|
|
3
|
+
import { createContext as ve, use as se, useMemo as X, useSyncExternalStore as oe, useRef as U, useLayoutEffect as Y, useCallback as F, useId as Te, useEffect as ee, Component as Yn, Suspense as Ie, lazy as Pt, useState as V, useEffectEvent as le } from "react";
|
|
4
|
+
import { useParams as uo, useSearchParams as fo, matchPath as mo, useBlocker as ho, useNavigate as po, Link as go, useHref as nt, useLocation as Xn, useRevalidator as wo } from "react-router";
|
|
5
|
+
import { k as vo, h as Jn, H as bo, E as Qn, a as er, I as yo, J as Qt, K as ko, L as Le, e as Ne, m as Eo, M as So, O as xo, Q as To, R as en, T as Ro, U as tn, V as Oo, w as Co, W as Mo } from "./location-BNFdxzhn.js";
|
|
6
|
+
import { SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS as nn, SPREADSHEET_BLOCK_LABEL_CATALOGS as Xe } from "@aiquants/markdown/code-blocks";
|
|
7
|
+
import { H as fe, i as Lo, I as rt, J as Ao, A as te, K as dt, B as ut, z as No, L as Do, f as Po, N as Io, O as $o, P as _o, Q as Fo, R as rn, x as qo, S as Bo, T as Uo, U as Ho, D as zo, y as jo, V as Vo, W as Zo, X as Wo, w as on } from "./dataRoute-DLhQfdoW.js";
|
|
8
|
+
import { HostedScrollArea as sn, SpreadsheetBlock as Go, useMarkdownToolbarState as Ko, MarkdownViewer as tr } from "@aiquants/markdown";
|
|
9
|
+
import { SOURCE_LINES_ATTRIBUTE as nr, parseSourceLines as Yo } from "@aiquants/markdown/source-lines";
|
|
10
|
+
import { iterateTsvRows as Xo, iterateTsvPrefixRows as Jo, serializeTsv as Qo } from "@aiquants/spreadsheet/tsv";
|
|
11
|
+
import { SPREADSHEET_MAX_OPERATION_CELLS as an } from "@aiquants/spreadsheet/view";
|
|
12
|
+
import { DEFAULT_CONTENT_ALIGN as es } from "@aiquants/markdown/viewer-settings";
|
|
13
|
+
import { w as Rt, r as Ot, a as ts, b as ln, s as Ce, c as ns } from "./storage-CmGHg7OA.js";
|
|
14
|
+
import { createShouldRevalidate as rs } from "@aiquants/route-revalidation";
|
|
15
|
+
const cn = Object.freeze(["en", "ja"]), os = "en", It = (e) => `viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`, rr = Object.freeze(Object.keys(Xe.en)), or = (e) => Object.fromEntries(rr.map((t) => [It(t), Xe[e][t].text])), ss = Object.freeze({
|
|
16
|
+
panelMoved: Object.freeze(["title", "column", "position"]),
|
|
17
|
+
panelMoveUnavailable: Object.freeze(["title", "move"]),
|
|
18
|
+
panelDragStarted: Object.freeze(["title"]),
|
|
19
|
+
panelDragCancelled: Object.freeze(["title"]),
|
|
20
|
+
multiColumnRegion: Object.freeze(["column"]),
|
|
21
|
+
viewerSvgImageSourceRegion: Object.freeze(["name"]),
|
|
22
|
+
...Object.fromEntries(rr.filter((e) => nn[e].length > 0).map((e) => [It(e), nn[e]]))
|
|
23
|
+
}), as = /\{(\w+)\}/gu, sr = {
|
|
24
|
+
...or("en"),
|
|
25
|
+
explorerRegion: "Explorer",
|
|
26
|
+
sourceLabel: "Source",
|
|
27
|
+
refreshTreeLabel: "Refresh tree",
|
|
28
|
+
refreshTree: "Reload the tree and the open documents from the source",
|
|
29
|
+
treeRefreshed: "Reloaded the tree from the source",
|
|
30
|
+
treeRefreshFailed: (e) => `Could not reload the tree: ${e}`,
|
|
31
|
+
refreshDocumentLabel: "Refresh document",
|
|
32
|
+
refreshDocument: "Reload the document from the source",
|
|
33
|
+
refreshDocumentNamed: (e) => `Refresh ${e}`,
|
|
34
|
+
documentRefreshed: (e) => `Reloaded ${e}`,
|
|
35
|
+
documentRefreshFailed: (e) => `Could not reload the document: ${e}`,
|
|
36
|
+
showMarkupLabel: "Source",
|
|
37
|
+
showMarkup: "Show the document's Markdown as written",
|
|
38
|
+
showSvgMarkup: "Show the image's SVG as written",
|
|
39
|
+
showSpreadsheetMarkup: (e) => `Show the table's ${e} as written`,
|
|
40
|
+
showMarkupNamed: (e) => `Source of ${e}`,
|
|
41
|
+
editDocumentLabel: "Edit",
|
|
42
|
+
editDocument: "Edit the document's Markdown (or double-click the document)",
|
|
43
|
+
editDocumentNamed: (e) => `Edit ${e}`,
|
|
44
|
+
editDraftDocument: "Edit the document's Markdown without saving, to try it in the preview (or double-click the document)",
|
|
45
|
+
editDraftDocumentNamed: (e) => `Edit ${e} without saving`,
|
|
46
|
+
editExternallyLabel: "Open in its editor",
|
|
47
|
+
editExternally: "Open the document in its own editor, in a new tab",
|
|
48
|
+
editExternallyNamed: (e) => `Open ${e} in its editor`,
|
|
49
|
+
editorRegion: (e) => `Editing ${e}`,
|
|
50
|
+
editorLabel: (e) => `Markdown of ${e}`,
|
|
51
|
+
editLoading: "Loading the source for editing…",
|
|
52
|
+
editToolbar: "Editor",
|
|
53
|
+
saveDraft: "Save",
|
|
54
|
+
saveDraftTooltip: "Save the draft (Ctrl+S, or ⌘S on a Mac)",
|
|
55
|
+
closeEditor: "Close editor",
|
|
56
|
+
editView: "View",
|
|
57
|
+
editViewNamed: (e) => `View of ${e}`,
|
|
58
|
+
editViewEditor: "Editor",
|
|
59
|
+
editViewEditorTooltip: "Show the editor (Ctrl+E, or ⌘E on a Mac, switches with the preview)",
|
|
60
|
+
editViewSplit: "Side by side",
|
|
61
|
+
editViewSplitTooltip: "Show the editor and the preview side by side",
|
|
62
|
+
editViewSplitResize: "Resize the editor and the preview",
|
|
63
|
+
editViewPreview: "Preview",
|
|
64
|
+
editViewPreviewTooltip: "Show the preview (Ctrl+E, or ⌘E on a Mac, switches with the editor)",
|
|
65
|
+
historyOpen: "History",
|
|
66
|
+
draftUnsaved: "Unsaved changes",
|
|
67
|
+
draftStatus: "Draft, not saved",
|
|
68
|
+
draftNotSaved: "This draft is not saved: the document cannot be saved here.",
|
|
69
|
+
draftSaving: "Saving…",
|
|
70
|
+
draftSaved: "Saved",
|
|
71
|
+
draftSavedMerged: "Saved, merged with changes saved elsewhere",
|
|
72
|
+
draftConflicts: (e) => e === 1 ? "1 conflict with changes saved elsewhere: choose what to keep, then save" : `${e} conflicts with changes saved elsewhere: choose what to keep, then save`,
|
|
73
|
+
draftSaveFailed: (e) => `Could not save: ${e}`,
|
|
74
|
+
documentSaved: (e) => `Saved ${e}`,
|
|
75
|
+
documentSavedMerged: (e) => `Saved ${e}, merged with changes saved elsewhere`,
|
|
76
|
+
conflictOurs: "your draft",
|
|
77
|
+
conflictTheirs: "saved elsewhere",
|
|
78
|
+
conflictUseOurs: "Use my lines",
|
|
79
|
+
conflictUseTheirs: "Use the saved lines",
|
|
80
|
+
conflictKeepBoth: "Keep both",
|
|
81
|
+
conflictNext: "Next conflict",
|
|
82
|
+
editGrantTitle: "Editing needs your permission",
|
|
83
|
+
editGrantBody: "Allow this site to change documents on your behalf. You are asked once; signing out asks again.",
|
|
84
|
+
editGrantAction: "Grant permission",
|
|
85
|
+
editGrantRetry: "Try again",
|
|
86
|
+
unsavedTitle: "Discard unsaved changes?",
|
|
87
|
+
unsavedBody: (e) => `${e} has changes that are not saved.`,
|
|
88
|
+
unsavedDiscard: "Discard changes",
|
|
89
|
+
draftDiscardTitle: "Discard the draft?",
|
|
90
|
+
draftDiscardBody: (e) => `The changes to ${e} are not saved anywhere and will be lost.`,
|
|
91
|
+
unsavedStay: "Keep editing",
|
|
92
|
+
historyTitle: (e) => `Revisions of ${e}`,
|
|
93
|
+
historyLoading: "Loading the revisions…",
|
|
94
|
+
historyEmpty: "No revisions are kept for this document.",
|
|
95
|
+
historyCurrent: "Current",
|
|
96
|
+
historyKept: "Kept",
|
|
97
|
+
historyEntry: (e, t) => t === "" ? e : `${e} by ${t}`,
|
|
98
|
+
historyRestore: "Put into the draft",
|
|
99
|
+
historyClose: "Close",
|
|
100
|
+
historyRestored: (e) => `Put the revision into the draft of ${e}; save to keep it`,
|
|
101
|
+
previewRegion: "Preview",
|
|
102
|
+
previewUpdating: "Updating the preview…",
|
|
103
|
+
previewFailed: (e) => `Could not preview: ${e}`,
|
|
104
|
+
previewTablePending: "This table can be edited once the preview shows the draft.",
|
|
105
|
+
expandAll: "Expand all folders",
|
|
106
|
+
collapseAll: "Collapse all folders",
|
|
107
|
+
treeSettings: "Tree settings",
|
|
108
|
+
switchToMulti: "Open in the multi-panel view",
|
|
109
|
+
switchToTree: "Open in the tree view",
|
|
110
|
+
resizeExplorer: "Resize the explorer",
|
|
111
|
+
showExplorer: "Show the explorer",
|
|
112
|
+
hideExplorer: "Close the explorer",
|
|
113
|
+
treeRegion: "Documents",
|
|
114
|
+
treeLoading: "Loading the tree…",
|
|
115
|
+
treeEmptyTitle: "Nothing to show",
|
|
116
|
+
treeEmptyBody: "This source has no documents you can open.",
|
|
117
|
+
folderLoadFailed: "This folder could not be loaded.",
|
|
118
|
+
loopFolderName: (e) => `${e} (already open above)`,
|
|
119
|
+
foldersLoadFailedNamed: (e) => `${new Intl.ListFormat("en", { type: "conjunction" }).format(e)} could not be loaded`,
|
|
120
|
+
foldersLoading: (e) => e === 1 ? "Loading 1 folder…" : `Loading ${String(e)} folders…`,
|
|
121
|
+
expandAllStarted: "Opening all folders…",
|
|
122
|
+
expandAllProgress: (e, t) => `Opening all folders (${String(e)} opened, ${String(t)} loading)…`,
|
|
123
|
+
expandAllDone: (e, t, n) => {
|
|
124
|
+
const r = `Opened ${String(e)} ${e === 1 ? "folder" : "folders"}`;
|
|
125
|
+
return t > 0 ? `${r}; ${String(t)} could not be loaded` : n ? e === 0 ? "All folders are already open" : `${r}; every folder is open` : r;
|
|
126
|
+
},
|
|
127
|
+
expandAllFolderLimit: (e, t, n) => `Opened ${String(e)} ${e === 1 ? "folder" : "folders"} and stopped at the limit of ${String(t)} ${t === 1 ? "folder" : "folders"} to load. Choose "${n}" again to continue`,
|
|
128
|
+
expandAllDepthLimit: (e, t) => `Opened ${String(e)} ${e === 1 ? "folder" : "folders"}; folders more than ${String(t)} ${t === 1 ? "level" : "levels"} deep stay closed`,
|
|
129
|
+
treeEntryKindDirectory: "directory",
|
|
130
|
+
treeEntryKindFile: "file",
|
|
131
|
+
treeScrollUp: "Scroll up",
|
|
132
|
+
treeScrollDown: "Scroll down",
|
|
133
|
+
treeScrollToTop: "Top",
|
|
134
|
+
treeScrollToBottom: "Bottom",
|
|
135
|
+
selectionTitle: (e) => `Selected (${String(e)})`,
|
|
136
|
+
clearSelection: "Clear the selection",
|
|
137
|
+
openSelectionInMulti: (e) => `Open ${String(e)} in panels`,
|
|
138
|
+
removeFromSelection: (e) => `Remove ${e} from the selection`,
|
|
139
|
+
settingSortMode: "Sort order",
|
|
140
|
+
sortNative: "Source order",
|
|
141
|
+
sortAscending: "Name A→Z",
|
|
142
|
+
sortDescending: "Name Z→A",
|
|
143
|
+
sortOldest: "Modified old→new",
|
|
144
|
+
sortNewest: "Modified new→old",
|
|
145
|
+
settingFolderPlacement: "Folders",
|
|
146
|
+
folderPlacementMixed: "Mixed",
|
|
147
|
+
folderPlacementFirst: "First",
|
|
148
|
+
folderPlacementLast: "Last",
|
|
149
|
+
settingReadmePlacement: "README",
|
|
150
|
+
readmePlacementMixed: "Mixed",
|
|
151
|
+
readmePlacementFirst: "First",
|
|
152
|
+
readmePlacementLast: "Last",
|
|
153
|
+
settingSelectionMode: "Selection",
|
|
154
|
+
selectionSingle: "Single",
|
|
155
|
+
selectionMultiple: "Multiple",
|
|
156
|
+
selectionNone: "Off",
|
|
157
|
+
settingDoubleClick: "Double-click",
|
|
158
|
+
doubleClickRecursive: "Expand all levels",
|
|
159
|
+
doubleClickToggle: "Toggle",
|
|
160
|
+
settingExpandIconSize: "Expander size",
|
|
161
|
+
expandIconSizeValue: (e) => `${String(e)} px`,
|
|
162
|
+
settingAlwaysExpanded: "Always expanded",
|
|
163
|
+
settingRevealDocument: "Reveal the open document",
|
|
164
|
+
settingRemoveRootIndent: "No root indent",
|
|
165
|
+
settingTreeLines: "Tree lines",
|
|
166
|
+
settingExpandIcons: "Expanders",
|
|
167
|
+
settingDirectoryIcons: "Folder icons",
|
|
168
|
+
settingFileIcons: "File icons",
|
|
169
|
+
settingOn: "On",
|
|
170
|
+
settingOff: "Off",
|
|
171
|
+
settingAnnouncement: (e, t) => `${e}: ${t}`,
|
|
172
|
+
documentRegion: "Document",
|
|
173
|
+
documentEmpty: "Select a document in the explorer.",
|
|
174
|
+
folderReadmeMissing: (e) => `${e} has no README.`,
|
|
175
|
+
documentLoading: "Loading the document…",
|
|
176
|
+
markupLoading: "Loading the source…",
|
|
177
|
+
spreadsheetLoading: "Loading the table…",
|
|
178
|
+
documentShown: (e) => `Showing ${e}`,
|
|
179
|
+
documentFailed: (e, t) => `${e}: ${t}`,
|
|
180
|
+
announcementSequence: (e) => e.map((t) => /[.!?]$/u.test(t) ? t : `${t}.`).join(" "),
|
|
181
|
+
textTruncated: "Only the beginning of this file is shown.",
|
|
182
|
+
inertLink: "This link points outside the source and cannot be opened.",
|
|
183
|
+
failureUnauthorizedTitle: "Your session has expired",
|
|
184
|
+
failureUnauthorizedBody: "Reload the page to sign in again.",
|
|
185
|
+
failureForbiddenTitle: "Access denied",
|
|
186
|
+
failureForbiddenBody: "You do not have permission to open this.",
|
|
187
|
+
failureNotFoundTitle: "Not found",
|
|
188
|
+
failureNotFoundBody: "It may have been moved or deleted.",
|
|
189
|
+
failureNotConfiguredTitle: "This source is not set up",
|
|
190
|
+
failureNotConfiguredBody: "Ask your administrator to configure it.",
|
|
191
|
+
failureInvalidTitle: "Invalid address",
|
|
192
|
+
failureInvalidBody: "The document path in this address cannot be used.",
|
|
193
|
+
failureTooLargeTitle: "Too large to display",
|
|
194
|
+
failureTooLargeBody: "This file exceeds the size that can be displayed.",
|
|
195
|
+
failureUnsupportedTitle: "Cannot be displayed",
|
|
196
|
+
failureUnsupportedBody: "This type of file cannot be shown here.",
|
|
197
|
+
failureFailedTitle: "Something went wrong",
|
|
198
|
+
failureFailedBody: "Try again in a moment.",
|
|
199
|
+
retry: "Try again",
|
|
200
|
+
reloadPage: "Reload the page",
|
|
201
|
+
imageZoomIn: "Zoom in",
|
|
202
|
+
imageZoomOut: "Zoom out",
|
|
203
|
+
imageFit: "Fit to the view",
|
|
204
|
+
imageFitLevel: "Fit",
|
|
205
|
+
imageZoomLevel: (e) => `${String(e)}%`,
|
|
206
|
+
openInNewTab: "Open in a new tab",
|
|
207
|
+
download: "Download",
|
|
208
|
+
copyText: "Copy the text",
|
|
209
|
+
copiedText: "Copied the text",
|
|
210
|
+
copyTextFailed: "Could not copy the text",
|
|
211
|
+
mediaUnsupported: "Your browser cannot play this file.",
|
|
212
|
+
fileNotShown: "This file cannot be shown here. Download it to open it.",
|
|
213
|
+
pdfNotShown: "This browser does not show PDF files inside the page. Open it in a new tab or download it.",
|
|
214
|
+
spreadsheetWorkbookFirstSheet: "The whole workbook could not be read, so only its first sheet is shown.",
|
|
215
|
+
spreadsheetSheets: (e) => `Sheets of ${e}`,
|
|
216
|
+
spreadsheetSheetName: (e, t) => `${e}, sheet ${t}`,
|
|
217
|
+
spreadsheetUnshownSheets: (e) => e === 1 ? "1 sheet is not shown (a hidden sheet or a chart sheet)." : `${e} sheets are not shown (hidden sheets or chart sheets).`,
|
|
218
|
+
spreadsheetUnlistedSheets: (e) => `Only the first ${e} sheets are listed.`,
|
|
219
|
+
spreadsheetSheetLoading: "Loading the sheet…",
|
|
220
|
+
spreadsheetSheetEmpty: "This sheet has no data.",
|
|
221
|
+
spreadsheetWorkbookEncrypted: "This workbook is password-protected, so it cannot be shown. Download it to open it.",
|
|
222
|
+
spreadsheetNotWorkbook: "This file cannot be read as an Excel (.xlsx) or OpenDocument (.ods) workbook. Download it to open it.",
|
|
223
|
+
spreadsheetWorkbookTooLarge: "This workbook is too large to preview. Download it to open it.",
|
|
224
|
+
spreadsheetTruncated: "The table shows only part of this file. Download it to open the whole file.",
|
|
225
|
+
spreadsheetUnreadableEncoding: ([e, t]) => t === void 0 ? `This file's text is not ${e}, so it cannot be shown as a table. Download it to open it.` : `This file's text is neither ${e} nor ${t}, so it cannot be shown as a table. Download it to open it.`,
|
|
226
|
+
spreadsheetEmpty: "This file has no data.",
|
|
227
|
+
spreadsheetNotText: "This file is not text, so it cannot be shown as a table. Download it to open it.",
|
|
228
|
+
spreadsheetLongRow: "No row of this file ends within the part read for the preview, so it cannot be shown as a table. Download it to open it.",
|
|
229
|
+
spreadsheetFullscreen: (e) => `${e} (full screen)`,
|
|
230
|
+
viewerLoading: "Loading data...",
|
|
231
|
+
viewerErrorPrefix: "Error: ",
|
|
232
|
+
viewerStyleTitle: "Display Style",
|
|
233
|
+
viewerSelectStyle: "Select display style",
|
|
234
|
+
viewerPinStyle: "Pin style selector",
|
|
235
|
+
viewerUnpinStyle: "Unpin style selector",
|
|
236
|
+
viewerErrorTitle: "An error occurred",
|
|
237
|
+
viewerMissingImage: "Image not found",
|
|
238
|
+
viewerOpenToc: "Open table of contents",
|
|
239
|
+
viewerTocTitle: "Table of contents",
|
|
240
|
+
viewerPinToc: "Pin table of contents",
|
|
241
|
+
viewerUnpinToc: "Unpin table of contents",
|
|
242
|
+
viewerSelectAlign: "Select alignment",
|
|
243
|
+
viewerAlignTitle: "Alignment",
|
|
244
|
+
viewerPinAlign: "Pin alignment selector",
|
|
245
|
+
viewerUnpinAlign: "Unpin alignment selector",
|
|
246
|
+
viewerAlignLeft: "Align left",
|
|
247
|
+
viewerAlignCenter: "Align center",
|
|
248
|
+
viewerAlignRight: "Align right",
|
|
249
|
+
viewerMermaidInteractionMode: "Mouse interaction mode",
|
|
250
|
+
viewerMermaidInteractionModeTouch: "Touch interaction mode",
|
|
251
|
+
viewerMermaidModeNone: "No interaction",
|
|
252
|
+
viewerMermaidModeZoom: "Zoom only",
|
|
253
|
+
viewerMermaidModePan: "Pan only (drag)",
|
|
254
|
+
viewerMermaidModePanShift: "Pan only (Shift+drag)",
|
|
255
|
+
viewerMermaidModeBoth: "Zoom and pan (drag)",
|
|
256
|
+
viewerMermaidModeBothShift: "Zoom and pan (Shift+drag)",
|
|
257
|
+
viewerMermaidModeNoneTouch: "No interaction (a finger scrolls the page)",
|
|
258
|
+
viewerMermaidModeZoomTouch: "Zoom only (two fingers)",
|
|
259
|
+
viewerMermaidModePanTouch: "Pan only (one-finger drag while the diagram overflows)",
|
|
260
|
+
viewerMermaidModeBothTouch: "Zoom and pan (two fingers, one finger while the diagram overflows)",
|
|
261
|
+
viewerMermaidZoomIn: "Zoom In",
|
|
262
|
+
viewerMermaidZoomOut: "Zoom Out",
|
|
263
|
+
viewerMermaidResetView: "Reset View",
|
|
264
|
+
viewerMermaidPanUp: "Pan Up",
|
|
265
|
+
viewerMermaidPanDown: "Pan Down",
|
|
266
|
+
viewerMermaidPanLeft: "Pan Left",
|
|
267
|
+
viewerMermaidPanRight: "Pan Right",
|
|
268
|
+
viewerMermaidDiagram: "Diagram (arrow keys pan, + and - zoom, 0 resets)",
|
|
269
|
+
viewerMermaidRetry: "Try again",
|
|
270
|
+
viewerEmbeddedVideo: "embedded video",
|
|
271
|
+
viewerEmbeddedPost: "embedded post",
|
|
272
|
+
viewerEmbeddedFrame: "Embedded content",
|
|
273
|
+
viewerBlockFailed: "This block could not be shown.",
|
|
274
|
+
viewerSvgImageToolbar: "SVG image",
|
|
275
|
+
viewerSvgImageSource: "Source",
|
|
276
|
+
viewerSvgImageSourceRegion: "Source of {name}",
|
|
277
|
+
viewerSvgImageLoading: "Loading the source…",
|
|
278
|
+
viewerSvgImageFailed: "The source could not be read.",
|
|
279
|
+
viewerSvgImageRetry: "Try again",
|
|
280
|
+
viewerSvgImageTruncated: "Only the beginning of this file is shown.",
|
|
281
|
+
viewerSvgImageCopy: "Copy the source",
|
|
282
|
+
viewerSvgImageCopied: "Copied the source.",
|
|
283
|
+
viewerSvgImageCopyFailed: "Could not copy the source.",
|
|
284
|
+
viewerSvgImageCopyImage: "Copy the image",
|
|
285
|
+
viewerSvgImageCopiedImage: "Copied the image.",
|
|
286
|
+
viewerSvgImageCopyImageFailed: "Could not copy the image.",
|
|
287
|
+
multiRegion: "Panels",
|
|
288
|
+
multiEmpty: "Select documents in the explorer to open them side by side.",
|
|
289
|
+
panelLimit: (e) => `You can open up to ${String(e)} panels at once.`,
|
|
290
|
+
panelOpened: (e) => `Opened ${e}`,
|
|
291
|
+
panelClosed: (e) => `Closed ${e}`,
|
|
292
|
+
panelAlreadyOpen: (e) => `${e} is already open`,
|
|
293
|
+
panelHidden: (e) => `Hid ${e}`,
|
|
294
|
+
panelShown: (e) => `Showed ${e}`,
|
|
295
|
+
panelMaximized: (e) => `Maximized ${e}`,
|
|
296
|
+
panelRestored: (e) => `Restored ${e} to its size`,
|
|
297
|
+
panelHide: "Hide the panel",
|
|
298
|
+
panelMaximize: "Maximize the panel",
|
|
299
|
+
panelRestore: "Restore the panel to its size",
|
|
300
|
+
panelClose: "Close the panel",
|
|
301
|
+
panelSwitchToCustomDrag: "Switch to the custom drag mode",
|
|
302
|
+
panelSwitchToNormalDrag: "Back to the normal drag mode",
|
|
303
|
+
panelCustomDragBadge: "Custom",
|
|
304
|
+
panelMove: "Move the panel",
|
|
305
|
+
panelMovePreviousColumn: "Move to the previous column",
|
|
306
|
+
panelMoveNextColumn: "Move to the next column",
|
|
307
|
+
panelMoveUp: "Move up",
|
|
308
|
+
panelMoveDown: "Move down",
|
|
309
|
+
panelMoved: "Moved {title} to column {column}, position {position}",
|
|
310
|
+
panelMoveUnavailable: "{move} is not available for {title}",
|
|
311
|
+
panelDragStarted: "Picked up {title}",
|
|
312
|
+
panelDragCancelled: "Kept {title} where it was",
|
|
313
|
+
hiddenPanelsTitle: "Hidden panels:",
|
|
314
|
+
hiddenPanelBadge: "Hidden",
|
|
315
|
+
hiddenPanelNotice: "This panel is hidden",
|
|
316
|
+
multiColumnEmpty: "This column is empty",
|
|
317
|
+
multiColumnRegion: "Column {column}",
|
|
318
|
+
panelDropHere: "Drop the panel here"
|
|
319
|
+
}, is = {
|
|
320
|
+
...or("ja"),
|
|
321
|
+
explorerRegion: "エクスプローラー",
|
|
322
|
+
sourceLabel: "ソース",
|
|
323
|
+
refreshTreeLabel: "ツリーを更新",
|
|
324
|
+
refreshTree: "ソースからツリーと開いている文書を読み込み直す",
|
|
325
|
+
treeRefreshed: "ツリーをソースから読み込み直しました",
|
|
326
|
+
treeRefreshFailed: (e) => `ツリーを読み込み直せませんでした: ${e}`,
|
|
327
|
+
refreshDocumentLabel: "文書を更新",
|
|
328
|
+
refreshDocument: "ソースから文書を読み込み直す",
|
|
329
|
+
refreshDocumentNamed: (e) => `${e} を更新`,
|
|
330
|
+
documentRefreshed: (e) => `${e} を読み込み直しました`,
|
|
331
|
+
documentRefreshFailed: (e) => `文書を読み込み直せませんでした: ${e}`,
|
|
332
|
+
showMarkupLabel: "ソース",
|
|
333
|
+
showMarkup: "文書の Markdown を書いたまま表示",
|
|
334
|
+
showSvgMarkup: "画像の SVG を書いたまま表示",
|
|
335
|
+
showSpreadsheetMarkup: (e) => `表の ${e} を書いたまま表示`,
|
|
336
|
+
showMarkupNamed: (e) => `${e} のソース`,
|
|
337
|
+
editDocumentLabel: "編集",
|
|
338
|
+
editDocument: "文書の Markdown を編集 (文書のダブルクリックでも)",
|
|
339
|
+
editDocumentNamed: (e) => `${e} を編集`,
|
|
340
|
+
editDraftDocument: "文書の Markdown を保存せずに編集し、プレビューで確かめる (文書のダブルクリックでも)",
|
|
341
|
+
editDraftDocumentNamed: (e) => `${e} を保存せずに編集`,
|
|
342
|
+
editExternallyLabel: "元のエディタで開く",
|
|
343
|
+
editExternally: "文書を元のエディタで、新しいタブに開く",
|
|
344
|
+
editExternallyNamed: (e) => `${e} を元のエディタで開く`,
|
|
345
|
+
editorRegion: (e) => `${e} を編集中`,
|
|
346
|
+
editorLabel: (e) => `${e} の Markdown`,
|
|
347
|
+
editLoading: "編集のためにソースを読み込み中…",
|
|
348
|
+
editToolbar: "エディタ",
|
|
349
|
+
saveDraft: "保存",
|
|
350
|
+
saveDraftTooltip: "下書きを保存 (Ctrl+S、Mac は ⌘S)",
|
|
351
|
+
closeEditor: "編集を閉じる",
|
|
352
|
+
editView: "表示",
|
|
353
|
+
editViewNamed: (e) => `${e} の表示`,
|
|
354
|
+
editViewEditor: "エディタ",
|
|
355
|
+
editViewEditorTooltip: "エディタを表示 (Ctrl+E、Mac は ⌘E でプレビューと切り替え)",
|
|
356
|
+
editViewSplit: "並べて表示",
|
|
357
|
+
editViewSplitTooltip: "エディタとプレビューを並べて表示",
|
|
358
|
+
editViewSplitResize: "エディタとプレビューの割合を変更",
|
|
359
|
+
editViewPreview: "プレビュー",
|
|
360
|
+
editViewPreviewTooltip: "プレビューを表示 (Ctrl+E、Mac は ⌘E でエディタと切り替え)",
|
|
361
|
+
historyOpen: "履歴",
|
|
362
|
+
draftUnsaved: "保存していない変更があります",
|
|
363
|
+
draftStatus: "保存しない下書き",
|
|
364
|
+
draftNotSaved: "この下書きは保存しません。ここでは文書を保存できません。",
|
|
365
|
+
draftSaving: "保存中…",
|
|
366
|
+
draftSaved: "保存しました",
|
|
367
|
+
draftSavedMerged: "ほかで保存された変更と統合して保存しました",
|
|
368
|
+
draftConflicts: (e) => `ほかで保存された変更と ${e} か所が重なりました。残す方を選んでから保存してください`,
|
|
369
|
+
draftSaveFailed: (e) => `保存できませんでした: ${e}`,
|
|
370
|
+
documentSaved: (e) => `${e} を保存しました`,
|
|
371
|
+
documentSavedMerged: (e) => `${e} を、ほかで保存された変更と統合して保存しました`,
|
|
372
|
+
conflictOurs: "あなたの下書き",
|
|
373
|
+
conflictTheirs: "ほかで保存された版",
|
|
374
|
+
conflictUseOurs: "自分の行を使う",
|
|
375
|
+
conflictUseTheirs: "保存された行を使う",
|
|
376
|
+
conflictKeepBoth: "両方を残す",
|
|
377
|
+
conflictNext: "次の衝突へ",
|
|
378
|
+
editGrantTitle: "編集には許可が必要です",
|
|
379
|
+
editGrantBody: "このサイトがあなたに代わって文書を変えることを許可してください。尋ねるのは 1 回だけで、サインアウトすると次にまた尋ねます。",
|
|
380
|
+
editGrantAction: "許可する",
|
|
381
|
+
editGrantRetry: "もう一度試す",
|
|
382
|
+
unsavedTitle: "保存していない変更を破棄しますか?",
|
|
383
|
+
unsavedBody: (e) => `${e} に保存していない変更があります。`,
|
|
384
|
+
unsavedDiscard: "変更を破棄",
|
|
385
|
+
draftDiscardTitle: "下書きを破棄しますか?",
|
|
386
|
+
draftDiscardBody: (e) => `${e} への変更はどこにも保存されず、失われます。`,
|
|
387
|
+
unsavedStay: "編集を続ける",
|
|
388
|
+
historyTitle: (e) => `${e} の版`,
|
|
389
|
+
historyLoading: "版の一覧を読み込み中…",
|
|
390
|
+
historyEmpty: "この文書の版は残っていません。",
|
|
391
|
+
historyCurrent: "現在の版",
|
|
392
|
+
historyKept: "保持",
|
|
393
|
+
historyEntry: (e, t) => t === "" ? e : `${e} (${t})`,
|
|
394
|
+
historyRestore: "下書きに戻す",
|
|
395
|
+
historyClose: "閉じる",
|
|
396
|
+
historyRestored: (e) => `${e} の下書きに版を戻しました。残すには保存してください`,
|
|
397
|
+
previewRegion: "プレビュー",
|
|
398
|
+
previewUpdating: "プレビューを更新中…",
|
|
399
|
+
previewFailed: (e) => `プレビューできませんでした: ${e}`,
|
|
400
|
+
previewTablePending: "プレビューが下書きを描くと、この表を編集できます。",
|
|
401
|
+
expandAll: "すべてのフォルダーを展開",
|
|
402
|
+
collapseAll: "すべてのフォルダーを折りたたむ",
|
|
403
|
+
treeSettings: "ツリーの設定",
|
|
404
|
+
switchToMulti: "マルチビューで開く",
|
|
405
|
+
switchToTree: "ツリービューで開く",
|
|
406
|
+
resizeExplorer: "エクスプローラーの幅を変更",
|
|
407
|
+
showExplorer: "エクスプローラーを開く",
|
|
408
|
+
hideExplorer: "エクスプローラーを閉じる",
|
|
409
|
+
treeRegion: "文書の一覧",
|
|
410
|
+
treeLoading: "ツリーを読み込み中…",
|
|
411
|
+
treeEmptyTitle: "表示できるファイルがありません",
|
|
412
|
+
treeEmptyBody: "このソースには開ける文書がありません。",
|
|
413
|
+
folderLoadFailed: "このフォルダーを読み込めませんでした。",
|
|
414
|
+
loopFolderName: (e) => `${e} (上の階層で開いています)`,
|
|
415
|
+
foldersLoadFailedNamed: (e) => `${new Intl.ListFormat("ja", { type: "conjunction" }).format(e)} を読み込めませんでした`,
|
|
416
|
+
foldersLoading: (e) => `フォルダーを ${String(e)} 件読み込み中…`,
|
|
417
|
+
expandAllStarted: "すべてのフォルダーを展開しています…",
|
|
418
|
+
expandAllProgress: (e, t) => `すべてのフォルダーを展開中 (展開 ${String(e)} 件、読み込み中 ${String(t)} 件)…`,
|
|
419
|
+
expandAllDone: (e, t, n) => {
|
|
420
|
+
const r = `${String(e)} 件のフォルダーを展開しました`;
|
|
421
|
+
return t > 0 ? `${r}。うち ${String(t)} 件は読み込めませんでした` : n ? e === 0 ? "すべてのフォルダーが既に開いています" : `${r}。すべてのフォルダーが開いています` : r;
|
|
422
|
+
},
|
|
423
|
+
expandAllFolderLimit: (e, t, n) => `${String(e)} 件のフォルダーを展開し、読み込みの上限 (${String(t)} 件) で止めました。続けるには「${n}」をもう一度押してください`,
|
|
424
|
+
expandAllDepthLimit: (e, t) => `${String(e)} 件のフォルダーを展開しました。深さ ${String(t)} 階層より下のフォルダーは閉じたままです`,
|
|
425
|
+
treeEntryKindDirectory: "ディレクトリ",
|
|
426
|
+
treeEntryKindFile: "ファイル",
|
|
427
|
+
treeScrollUp: "上へスクロール",
|
|
428
|
+
treeScrollDown: "下へスクロール",
|
|
429
|
+
treeScrollToTop: "先頭へ",
|
|
430
|
+
treeScrollToBottom: "末尾へ",
|
|
431
|
+
selectionTitle: (e) => `選択中 (${String(e)})`,
|
|
432
|
+
clearSelection: "選択を解除",
|
|
433
|
+
openSelectionInMulti: (e) => `${String(e)} 件をパネルで開く`,
|
|
434
|
+
removeFromSelection: (e) => `${e} を選択から外す`,
|
|
435
|
+
settingSortMode: "並び順",
|
|
436
|
+
sortNative: "取得順",
|
|
437
|
+
sortAscending: "名前の昇順",
|
|
438
|
+
sortDescending: "名前の降順",
|
|
439
|
+
sortOldest: "更新日時の昇順 (古い順)",
|
|
440
|
+
sortNewest: "更新日時の降順 (新しい順)",
|
|
441
|
+
settingFolderPlacement: "フォルダーの位置",
|
|
442
|
+
folderPlacementMixed: "混ぜる",
|
|
443
|
+
folderPlacementFirst: "先に",
|
|
444
|
+
folderPlacementLast: "後に",
|
|
445
|
+
settingReadmePlacement: "README の位置",
|
|
446
|
+
readmePlacementMixed: "混ぜる",
|
|
447
|
+
readmePlacementFirst: "先に",
|
|
448
|
+
readmePlacementLast: "後に",
|
|
449
|
+
settingSelectionMode: "選択",
|
|
450
|
+
selectionSingle: "1 件",
|
|
451
|
+
selectionMultiple: "複数",
|
|
452
|
+
selectionNone: "オフ",
|
|
453
|
+
settingDoubleClick: "ダブルクリック",
|
|
454
|
+
doubleClickRecursive: "下の階層まで展開",
|
|
455
|
+
doubleClickToggle: "開閉",
|
|
456
|
+
settingExpandIconSize: "展開アイコンの大きさ",
|
|
457
|
+
expandIconSizeValue: (e) => `${String(e)} px`,
|
|
458
|
+
settingAlwaysExpanded: "常に展開",
|
|
459
|
+
settingRevealDocument: "開いた文書をツリーで表示",
|
|
460
|
+
settingRemoveRootIndent: "最上位の字下げなし",
|
|
461
|
+
settingTreeLines: "ツリーの線",
|
|
462
|
+
settingExpandIcons: "展開アイコン",
|
|
463
|
+
settingDirectoryIcons: "フォルダーのアイコン",
|
|
464
|
+
settingFileIcons: "ファイルのアイコン",
|
|
465
|
+
settingOn: "オン",
|
|
466
|
+
settingOff: "オフ",
|
|
467
|
+
settingAnnouncement: (e, t) => `${e}: ${t}`,
|
|
468
|
+
documentRegion: "文書",
|
|
469
|
+
documentEmpty: "エクスプローラーで文書を選んでください。",
|
|
470
|
+
folderReadmeMissing: (e) => `${e} には README がありません。`,
|
|
471
|
+
documentLoading: "文書を読み込み中…",
|
|
472
|
+
markupLoading: "ソースを読み込み中…",
|
|
473
|
+
spreadsheetLoading: "表を読み込み中…",
|
|
474
|
+
documentShown: (e) => `${e} を表示しています`,
|
|
475
|
+
documentFailed: (e, t) => `${e}: ${t}`,
|
|
476
|
+
announcementSequence: (e) => e.map((t) => /[。!?]$/u.test(t) ? t : `${t}。`).join(""),
|
|
477
|
+
textTruncated: "このファイルは先頭だけを表示しています。",
|
|
478
|
+
inertLink: "リンク先がソースの外にあるため開けません。",
|
|
479
|
+
failureUnauthorizedTitle: "セッションの有効期限が切れました",
|
|
480
|
+
failureUnauthorizedBody: "ページを再読み込みして、もう一度サインインしてください。",
|
|
481
|
+
failureForbiddenTitle: "アクセスが許可されていません",
|
|
482
|
+
failureForbiddenBody: "これを開く権限がありません。",
|
|
483
|
+
failureNotFoundTitle: "見つかりません",
|
|
484
|
+
failureNotFoundBody: "移動または削除された可能性があります。",
|
|
485
|
+
failureNotConfiguredTitle: "このソースは設定されていません",
|
|
486
|
+
failureNotConfiguredBody: "管理者に設定を依頼してください。",
|
|
487
|
+
failureInvalidTitle: "アドレスが正しくありません",
|
|
488
|
+
failureInvalidBody: "このアドレスに含まれる文書の経路は使えません。",
|
|
489
|
+
failureTooLargeTitle: "大きすぎて表示できません",
|
|
490
|
+
failureTooLargeBody: "このファイルは表示できる大きさを超えています。",
|
|
491
|
+
failureUnsupportedTitle: "表示できない形式です",
|
|
492
|
+
failureUnsupportedBody: "この種類のファイルはここでは表示できません。",
|
|
493
|
+
failureFailedTitle: "読み込みに失敗しました",
|
|
494
|
+
failureFailedBody: "しばらくしてからもう一度お試しください。",
|
|
495
|
+
retry: "再試行",
|
|
496
|
+
reloadPage: "ページを再読み込み",
|
|
497
|
+
imageZoomIn: "拡大",
|
|
498
|
+
imageZoomOut: "縮小",
|
|
499
|
+
imageFit: "画面に合わせる",
|
|
500
|
+
imageFitLevel: "全体",
|
|
501
|
+
imageZoomLevel: (e) => `${String(e)}%`,
|
|
502
|
+
openInNewTab: "新しいタブで開く",
|
|
503
|
+
download: "ダウンロード",
|
|
504
|
+
copyText: "テキストをコピー",
|
|
505
|
+
copiedText: "テキストをコピーしました",
|
|
506
|
+
copyTextFailed: "テキストをコピーできませんでした",
|
|
507
|
+
mediaUnsupported: "このブラウザではこのファイルを再生できません。",
|
|
508
|
+
fileNotShown: "このファイルはここでは表示できません。ダウンロードして開いてください。",
|
|
509
|
+
pdfNotShown: "このブラウザはページの中に PDF を表示しません。新しいタブで開くか、ダウンロードしてください。",
|
|
510
|
+
spreadsheetWorkbookFirstSheet: "ブック全体を読めなかったため、最初のシートだけを表示しています。",
|
|
511
|
+
spreadsheetSheets: (e) => `${e} のシート`,
|
|
512
|
+
spreadsheetSheetName: (e, t) => `${e} のシート「${t}」`,
|
|
513
|
+
spreadsheetUnshownSheets: (e) => `非表示のシートかグラフのシートが ${e} 枚あり、表示していません。`,
|
|
514
|
+
spreadsheetUnlistedSheets: (e) => `最初の ${e} 枚のシートだけを並べています。`,
|
|
515
|
+
spreadsheetSheetLoading: "シートを読み込み中…",
|
|
516
|
+
spreadsheetSheetEmpty: "このシートにはデータがありません。",
|
|
517
|
+
spreadsheetWorkbookEncrypted: "このブックはパスワードで保護されているため、表示できません。ダウンロードして開いてください。",
|
|
518
|
+
spreadsheetNotWorkbook: "このファイルは Excel (.xlsx) や OpenDocument (.ods) のブックとして読めません。ダウンロードして開いてください。",
|
|
519
|
+
spreadsheetWorkbookTooLarge: "このブックはプレビューするには大きすぎます。ダウンロードして開いてください。",
|
|
520
|
+
spreadsheetTruncated: "表はこのファイルの一部だけを表示しています。全体はダウンロードして開いてください。",
|
|
521
|
+
spreadsheetUnreadableEncoding: ([e, t]) => t === void 0 ? `このファイルの文字は ${e} ではないため、表として表示できません。ダウンロードして開いてください。` : `このファイルの文字は ${e} でも ${t} でもないため、表として表示できません。ダウンロードして開いてください。`,
|
|
522
|
+
spreadsheetEmpty: "このファイルにはデータがありません。",
|
|
523
|
+
spreadsheetNotText: "このファイルは文字のファイルではないため、表として表示できません。ダウンロードして開いてください。",
|
|
524
|
+
spreadsheetLongRow: "プレビューに読む範囲の中でこのファイルの行が 1 つも終わらないため、表として表示できません。ダウンロードして開いてください。",
|
|
525
|
+
spreadsheetFullscreen: (e) => `${e} (全画面)`,
|
|
526
|
+
viewerLoading: "データを読み込み中...",
|
|
527
|
+
viewerErrorPrefix: "エラー: ",
|
|
528
|
+
viewerStyleTitle: "表示スタイル",
|
|
529
|
+
viewerSelectStyle: "表示スタイルを選択",
|
|
530
|
+
viewerPinStyle: "スタイル選択をピン留め",
|
|
531
|
+
viewerUnpinStyle: "スタイル選択のピン留めを解除",
|
|
532
|
+
viewerErrorTitle: "エラーが発生しました",
|
|
533
|
+
viewerMissingImage: "画像が見つかりません",
|
|
534
|
+
viewerOpenToc: "目次を開く",
|
|
535
|
+
viewerTocTitle: "目次",
|
|
536
|
+
viewerPinToc: "目次をピン留め",
|
|
537
|
+
viewerUnpinToc: "目次のピン留めを解除",
|
|
538
|
+
viewerSelectAlign: "揃えを選択",
|
|
539
|
+
viewerAlignTitle: "揃え",
|
|
540
|
+
viewerPinAlign: "揃え選択をピン留め",
|
|
541
|
+
viewerUnpinAlign: "揃え選択のピン留めを解除",
|
|
542
|
+
viewerAlignLeft: "左揃え",
|
|
543
|
+
viewerAlignCenter: "中央揃え",
|
|
544
|
+
viewerAlignRight: "右揃え",
|
|
545
|
+
viewerMermaidInteractionMode: "マウス操作モード",
|
|
546
|
+
viewerMermaidInteractionModeTouch: "タッチ操作モード",
|
|
547
|
+
viewerMermaidModeNone: "操作なし",
|
|
548
|
+
viewerMermaidModeZoom: "拡大縮小のみ",
|
|
549
|
+
viewerMermaidModePan: "移動のみ (左ドラッグ)",
|
|
550
|
+
viewerMermaidModePanShift: "移動のみ (Shift+ドラッグ)",
|
|
551
|
+
viewerMermaidModeBoth: "拡大縮小+移動 (左ドラッグ)",
|
|
552
|
+
viewerMermaidModeBothShift: "拡大縮小+移動 (Shift+ドラッグ)",
|
|
553
|
+
viewerMermaidModeNoneTouch: "操作なし (指はページをスクロール)",
|
|
554
|
+
viewerMermaidModeZoomTouch: "拡大縮小のみ (2 本指)",
|
|
555
|
+
viewerMermaidModePanTouch: "移動のみ (はみ出す図を 1 本指でドラッグ)",
|
|
556
|
+
viewerMermaidModeBothTouch: "拡大縮小+移動 (2 本指・はみ出す図は 1 本指)",
|
|
557
|
+
viewerMermaidZoomIn: "拡大",
|
|
558
|
+
viewerMermaidZoomOut: "縮小",
|
|
559
|
+
viewerMermaidResetView: "表示を元に戻す",
|
|
560
|
+
viewerMermaidPanUp: "上へ移動",
|
|
561
|
+
viewerMermaidPanDown: "下へ移動",
|
|
562
|
+
viewerMermaidPanLeft: "左へ移動",
|
|
563
|
+
viewerMermaidPanRight: "右へ移動",
|
|
564
|
+
viewerMermaidDiagram: "図 (矢印キーで移動、+ と - で拡大縮小、0 で元に戻す)",
|
|
565
|
+
viewerMermaidRetry: "再試行",
|
|
566
|
+
viewerEmbeddedVideo: "埋め込みの動画",
|
|
567
|
+
viewerEmbeddedPost: "埋め込みの投稿",
|
|
568
|
+
viewerEmbeddedFrame: "埋め込みのコンテンツ",
|
|
569
|
+
viewerBlockFailed: "このブロックを表示できませんでした。",
|
|
570
|
+
viewerSvgImageToolbar: "SVG の画像",
|
|
571
|
+
viewerSvgImageSource: "ソース",
|
|
572
|
+
viewerSvgImageSourceRegion: "{name} のソース",
|
|
573
|
+
viewerSvgImageLoading: "ソースを読み込み中…",
|
|
574
|
+
viewerSvgImageFailed: "ソースを読み込めませんでした。",
|
|
575
|
+
viewerSvgImageRetry: "再試行",
|
|
576
|
+
viewerSvgImageTruncated: "このファイルは先頭だけを表示しています。",
|
|
577
|
+
viewerSvgImageCopy: "ソースをコピー",
|
|
578
|
+
viewerSvgImageCopied: "ソースをコピーしました。",
|
|
579
|
+
viewerSvgImageCopyFailed: "ソースをコピーできませんでした。",
|
|
580
|
+
viewerSvgImageCopyImage: "画像をコピー",
|
|
581
|
+
viewerSvgImageCopiedImage: "画像をコピーしました。",
|
|
582
|
+
viewerSvgImageCopyImageFailed: "画像をコピーできませんでした。",
|
|
583
|
+
multiRegion: "パネル",
|
|
584
|
+
multiEmpty: "エクスプローラーで文書を選ぶと、ここに並べて開きます。",
|
|
585
|
+
panelLimit: (e) => `同時に開けるのは ${String(e)} パネルまでです。`,
|
|
586
|
+
panelOpened: (e) => `${e} を開きました`,
|
|
587
|
+
panelClosed: (e) => `${e} を閉じました`,
|
|
588
|
+
panelAlreadyOpen: (e) => `${e} は既に開いています`,
|
|
589
|
+
panelHidden: (e) => `${e} を隠しました`,
|
|
590
|
+
panelShown: (e) => `${e} を表示しました`,
|
|
591
|
+
panelMaximized: (e) => `${e} を最大化しました`,
|
|
592
|
+
panelRestored: (e) => `${e} を元のサイズに戻しました`,
|
|
593
|
+
panelHide: "パネルを隠す",
|
|
594
|
+
panelMaximize: "パネルを最大化",
|
|
595
|
+
panelRestore: "パネルを元のサイズに戻す",
|
|
596
|
+
panelClose: "パネルを閉じる",
|
|
597
|
+
panelSwitchToCustomDrag: "カスタムのドラッグの方式に切り替え",
|
|
598
|
+
panelSwitchToNormalDrag: "通常のドラッグの方式に戻す",
|
|
599
|
+
panelCustomDragBadge: "カスタム",
|
|
600
|
+
panelMove: "パネルを移動",
|
|
601
|
+
panelMovePreviousColumn: "前の列へ移動",
|
|
602
|
+
panelMoveNextColumn: "次の列へ移動",
|
|
603
|
+
panelMoveUp: "上へ移動",
|
|
604
|
+
panelMoveDown: "下へ移動",
|
|
605
|
+
panelMoved: "{title} を {column} 列目の {position} 番目へ移動しました",
|
|
606
|
+
panelMoveUnavailable: "{title} は「{move}」できません",
|
|
607
|
+
panelDragStarted: "{title} を持ち上げました",
|
|
608
|
+
panelDragCancelled: "{title} の移動を取り消しました",
|
|
609
|
+
hiddenPanelsTitle: "隠したパネル:",
|
|
610
|
+
hiddenPanelBadge: "非表示",
|
|
611
|
+
hiddenPanelNotice: "このパネルは隠しています",
|
|
612
|
+
multiColumnEmpty: "この列は空です",
|
|
613
|
+
multiColumnRegion: "{column} 列目",
|
|
614
|
+
panelDropHere: "ここへパネルをドロップ"
|
|
615
|
+
}, ls = Object.freeze({
|
|
616
|
+
en: Object.freeze(sr),
|
|
617
|
+
ja: Object.freeze(is)
|
|
618
|
+
}), ar = Object.freeze(Object.keys(sr)), cs = new Set(ar), ds = (e) => cs.has(e), Ge = (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, ir = (e) => {
|
|
619
|
+
if (e === void 0) return os;
|
|
620
|
+
if (cn.includes(e)) return e;
|
|
621
|
+
throw new RangeError(`[markdown-explorer] locale is the UI language (${cn.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${Ge(e)}`);
|
|
622
|
+
}, dn = (e, t) => {
|
|
623
|
+
const n = ls[ir(e)];
|
|
624
|
+
if (t === void 0) return n;
|
|
625
|
+
if (t === null || typeof t != "object")
|
|
626
|
+
throw new RangeError(`[markdown-explorer] labels must be an object; got ${Ge(t)}`);
|
|
627
|
+
if (!vo(t))
|
|
628
|
+
throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${Ge(t)}`);
|
|
629
|
+
const r = t, o = { ...n };
|
|
630
|
+
for (const s of Object.keys(r)) {
|
|
631
|
+
if (!ds(s))
|
|
632
|
+
throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${ar.join(", ")}`);
|
|
633
|
+
const a = r[s];
|
|
634
|
+
if (a === void 0) continue;
|
|
635
|
+
const i = typeof n[s];
|
|
636
|
+
if (typeof a !== i)
|
|
637
|
+
throw new TypeError(`[markdown-explorer] labels.${s} must be a ${i}; got ${Ge(a)}`);
|
|
638
|
+
if (typeof a == "string" && a.trim() === "")
|
|
639
|
+
throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);
|
|
640
|
+
const f = ss[s];
|
|
641
|
+
if (typeof a == "string" && f !== void 0) {
|
|
642
|
+
for (const [, u] of a.matchAll(as))
|
|
643
|
+
if (!f.includes(u ?? ""))
|
|
644
|
+
throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${String(u)}}; it accepts ${f.map((l) => `{${l}}`).join(", ")}`);
|
|
645
|
+
}
|
|
646
|
+
o[s] = a;
|
|
647
|
+
}
|
|
648
|
+
return Object.freeze(o);
|
|
649
|
+
}, us = (e, t) => {
|
|
650
|
+
if (Object.is(e, t)) return !0;
|
|
651
|
+
if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
|
|
652
|
+
const n = e, r = t, o = Object.keys(n), s = Object.keys(r);
|
|
653
|
+
return o.length === s.length && s.every((a) => Object.hasOwn(n, a) && Object.is(n[a], r[a]));
|
|
654
|
+
}, un = Object.freeze(["light", "dark"]), fs = (e) => {
|
|
655
|
+
if (e === void 0) return "light";
|
|
656
|
+
if (un.includes(e)) return e;
|
|
657
|
+
throw new RangeError(`[markdown-explorer] theme must be ${un.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
|
|
658
|
+
}, lr = ve(null), $ = () => {
|
|
659
|
+
const e = se(lr);
|
|
660
|
+
if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
|
|
661
|
+
return e;
|
|
662
|
+
}, Je = (e) => {
|
|
663
|
+
const { viewSettings: t } = $(), n = () => e(t.getSnapshot());
|
|
664
|
+
return oe(t.subscribe, n, n);
|
|
665
|
+
}, $t = () => {
|
|
666
|
+
const { config: e } = $(), t = uo()["*"], [n] = fo(), r = n.toString();
|
|
667
|
+
return X(() => Jn(e, t, new URLSearchParams(r)), [e, t, r]);
|
|
668
|
+
}, cr = {
|
|
669
|
+
unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
|
|
670
|
+
forbidden: ["failureForbiddenTitle", "failureForbiddenBody"],
|
|
671
|
+
"not-found": ["failureNotFoundTitle", "failureNotFoundBody"],
|
|
672
|
+
"not-configured": ["failureNotConfiguredTitle", "failureNotConfiguredBody"],
|
|
673
|
+
invalid: ["failureInvalidTitle", "failureInvalidBody"],
|
|
674
|
+
"too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
|
|
675
|
+
unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
|
|
676
|
+
failed: ["failureFailedTitle", "failureFailedBody"]
|
|
677
|
+
}, de = (e, t) => e[cr[t][0]], Re = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
|
|
678
|
+
const { labels: o } = $(), s = de(o, e.reason), a = o[cr[e.reason][1]], i = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
|
|
679
|
+
return /* @__PURE__ */ B("div", { className: "aqmx-callout", role: t ? "alert" : void 0, "data-aqmx-tone": i, "data-testid": r === null ? void 0 : r, "data-aqmx-failure": r === null ? void 0 : e.reason, children: [
|
|
680
|
+
/* @__PURE__ */ c("p", { className: "aqmx-callout-title", children: s }),
|
|
681
|
+
/* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: a }),
|
|
682
|
+
e.reason === "unauthorized" ? /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", onClick: () => window.location.reload(), children: o.reloadPage }) : n !== void 0 && e.reason === "failed" ? /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", onClick: n, children: o.retry }) : null
|
|
683
|
+
] });
|
|
684
|
+
}, ms = (e, t) => {
|
|
685
|
+
const { phase: n, save: r, dirty: o } = t;
|
|
686
|
+
switch (n.kind) {
|
|
687
|
+
case "opening":
|
|
688
|
+
return e.editLoading;
|
|
689
|
+
case "grant":
|
|
690
|
+
return e.editGrantTitle;
|
|
691
|
+
case "failed":
|
|
692
|
+
return de(e, n.failure.reason);
|
|
693
|
+
}
|
|
694
|
+
switch (r.kind) {
|
|
695
|
+
case "draft":
|
|
696
|
+
return e.draftStatus;
|
|
697
|
+
case "saving":
|
|
698
|
+
return e.draftSaving;
|
|
699
|
+
case "conflicts":
|
|
700
|
+
return e.draftConflicts(r.count);
|
|
701
|
+
case "grant":
|
|
702
|
+
return e.editGrantTitle;
|
|
703
|
+
case "failed":
|
|
704
|
+
return e.draftSaveFailed(de(e, r.failure.reason));
|
|
705
|
+
case "saved":
|
|
706
|
+
if (!o) return r.merged ? e.draftSavedMerged : e.draftSaved;
|
|
707
|
+
break;
|
|
708
|
+
}
|
|
709
|
+
return o ? e.draftUnsaved : "";
|
|
710
|
+
}, hs = (e, t, n) => {
|
|
711
|
+
switch (t.kind) {
|
|
712
|
+
case "draft":
|
|
713
|
+
return e.draftNotSaved;
|
|
714
|
+
case "saved":
|
|
715
|
+
return t.merged ? e.documentSavedMerged(n) : e.documentSaved(n);
|
|
716
|
+
case "conflicts":
|
|
717
|
+
return e.draftConflicts(t.count);
|
|
718
|
+
case "grant":
|
|
719
|
+
return e.editGrantTitle;
|
|
720
|
+
case "failed":
|
|
721
|
+
return e.draftSaveFailed(de(e, t.failure.reason));
|
|
722
|
+
case "idle":
|
|
723
|
+
case "saving":
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
}, qe = () => {
|
|
727
|
+
const e = /* @__PURE__ */ new Set();
|
|
728
|
+
return {
|
|
729
|
+
subscribe: (t) => (e.add(t), () => {
|
|
730
|
+
e.delete(t);
|
|
731
|
+
}),
|
|
732
|
+
emit: () => {
|
|
733
|
+
for (const t of [...e]) t();
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
}, ps = "<<<<<<<", gs = "=======", ws = ">>>>>>>", fn = (e, t) => e === t || e.startsWith(`${t} `), mn = (e) => vs(e.split(`
|
|
737
|
+
`)), vs = (e) => {
|
|
738
|
+
const t = [];
|
|
739
|
+
let n = null, r = null, o = 0;
|
|
740
|
+
for (const s of e) {
|
|
741
|
+
o += 1;
|
|
742
|
+
const a = s.charCodeAt(0);
|
|
743
|
+
a !== 60 && a !== 61 && a !== 62 || (fn(s, ps) ? (n = o, r = null) : s === gs ? n !== null && r === null ? r = o : n = null : fn(s, ws) && (n !== null && r !== null && t.push({ start: n, separator: r, end: o }), n = null, r = null));
|
|
744
|
+
}
|
|
745
|
+
return t;
|
|
746
|
+
}, hn = (e) => e.includes(`\r
|
|
747
|
+
`) ? `\r
|
|
748
|
+
` : `
|
|
749
|
+
`, ft = (e) => e.replace(/\r\n?/gu, `
|
|
750
|
+
`), bs = (e, t) => t === `
|
|
751
|
+
` ? e : e.replaceAll(`
|
|
752
|
+
`, `\r
|
|
753
|
+
`), ys = 3, ks = /^\d+(?:\.\d+)?$/u, Es = (e) => {
|
|
754
|
+
if (e === null || !ks.test(e)) return null;
|
|
755
|
+
const t = Number(e);
|
|
756
|
+
return t >= er && t <= Qn ? t : null;
|
|
757
|
+
}, mt = Object.freeze({ kind: "idle" }), pn = Object.freeze({ kind: "draft" }), Ss = ({ data: e, conflictLabels: t, onSaveSettled: n, sideBySideSetting: r, editorShareSetting: o }) => {
|
|
758
|
+
const s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), l = qe();
|
|
759
|
+
let d = null, h = null, g = null;
|
|
760
|
+
const v = (m, p) => {
|
|
761
|
+
m.value = { ...m.value, ...p }, l.emit();
|
|
762
|
+
}, y = (m, p) => s.get(m) === p, T = async (m, p) => {
|
|
763
|
+
p.controller.abort(), p.controller = new AbortController();
|
|
764
|
+
const { signal: x } = p.controller;
|
|
765
|
+
v(p, { phase: { kind: "opening" } });
|
|
766
|
+
const A = await e.edit(m, x);
|
|
767
|
+
if (!y(m, p) || x.aborted || !("kind" in A)) return;
|
|
768
|
+
if (A.kind === "grant") {
|
|
769
|
+
v(p, { phase: { kind: "grant", href: A.href } });
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
if (A.kind === "failure") {
|
|
773
|
+
v(p, { phase: { kind: "failed", failure: A.failure } });
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
const I = ft(A.text), _ = A.kind === "draft";
|
|
777
|
+
p.base = { text: I, version: _ ? null : A.version }, p.draft = I, p.ending = hn(A.text), v(p, { phase: { kind: "editing" }, history: _ ? !1 : A.history, dirty: !1, save: _ ? pn : mt, generation: p.value.generation + 1 });
|
|
778
|
+
}, C = (m) => {
|
|
779
|
+
const p = s.get(m);
|
|
780
|
+
p !== void 0 && (p.controller.abort(), s.delete(m), i.delete(m));
|
|
781
|
+
}, R = (m, p, x) => (m.set(p, x), () => {
|
|
782
|
+
m.get(p) === x && m.delete(p);
|
|
783
|
+
}), q = (m, p, x, A = {}) => {
|
|
784
|
+
v(p, { ...A, save: x }), n(m, x);
|
|
785
|
+
}, D = async (m) => {
|
|
786
|
+
f.get(m)?.flush();
|
|
787
|
+
const p = s.get(m);
|
|
788
|
+
if (p === void 0 || p.value.phase.kind !== "editing" || p.base === null || p.value.save.kind === "saving") return;
|
|
789
|
+
const { version: x } = p.base;
|
|
790
|
+
if (x === null) {
|
|
791
|
+
n(m, pn);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
const A = mn(p.draft).length;
|
|
795
|
+
if (A > 0) {
|
|
796
|
+
q(m, p, { kind: "conflicts", count: A });
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
p.controller.abort(), p.controller = new AbortController();
|
|
800
|
+
const { signal: I } = p.controller;
|
|
801
|
+
let _ = { text: p.base.text, version: x }, b = p.draft, S = !1;
|
|
802
|
+
v(p, { save: { kind: "saving" } });
|
|
803
|
+
for (let M = 0; M < ys; M += 1) {
|
|
804
|
+
const L = await e.save(m, _.version, bs(b, p.ending), I);
|
|
805
|
+
if (!y(m, p) || I.aborted || !("kind" in L)) return;
|
|
806
|
+
if (L.kind === "saved") {
|
|
807
|
+
f.get(m)?.flush(), p.base = { text: b, version: L.version }, q(m, p, { kind: "saved", merged: S }, { dirty: p.draft !== b });
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
if (L.kind === "grant") {
|
|
811
|
+
q(m, p, { kind: "grant", href: L.href });
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
if (L.kind === "failure") {
|
|
815
|
+
q(m, p, { kind: "failed", failure: L.failure });
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
const { mergeDraft: P } = await import("./merge-DhHzRcAI.js");
|
|
819
|
+
if (!y(m, p) || I.aborted) return;
|
|
820
|
+
const H = f.get(m);
|
|
821
|
+
H?.flush();
|
|
822
|
+
const K = ft(L.text), w = P(_.text, p.draft, K, t());
|
|
823
|
+
if (_ = { text: K, version: L.version }, p.base = _, p.ending = hn(L.text), p.draft = w.text, H?.adopt(w.text), w.kind === "conflicts") {
|
|
824
|
+
q(m, p, { kind: "conflicts", count: w.conflicts }, { dirty: !0, generation: p.value.generation + 1 });
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
if (S = !0, b = w.text, b === _.text) {
|
|
828
|
+
q(m, p, { kind: "saved", merged: S }, { dirty: !1, generation: p.value.generation + 1 });
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
v(p, { dirty: !0, generation: p.value.generation + 1 });
|
|
832
|
+
}
|
|
833
|
+
q(m, p, { kind: "failed", failure: { reason: "failed" } });
|
|
834
|
+
};
|
|
835
|
+
return {
|
|
836
|
+
session: (m) => s.get(m)?.value,
|
|
837
|
+
subscribe: l.subscribe,
|
|
838
|
+
start: (m, p) => {
|
|
839
|
+
const x = s.get(m);
|
|
840
|
+
if (x !== void 0) {
|
|
841
|
+
v(x, { request: { anchor: p }, view: "editor" }), (x.value.phase.kind === "failed" || x.value.phase.kind === "grant") && T(m, x);
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
a.delete(m);
|
|
845
|
+
const A = {
|
|
846
|
+
value: { path: m, phase: { kind: "opening" }, view: "editor", previewPrepared: !1, history: !1, dirty: !1, save: mt, generation: 0, request: { anchor: p } },
|
|
847
|
+
base: null,
|
|
848
|
+
draft: "",
|
|
849
|
+
ending: `
|
|
850
|
+
`,
|
|
851
|
+
controller: new AbortController()
|
|
852
|
+
};
|
|
853
|
+
s.set(m, A), T(m, A);
|
|
854
|
+
},
|
|
855
|
+
retry: (m) => {
|
|
856
|
+
const p = s.get(m);
|
|
857
|
+
p === void 0 || p.value.phase.kind === "editing" || T(m, p);
|
|
858
|
+
},
|
|
859
|
+
draft: (m) => {
|
|
860
|
+
const p = s.get(m);
|
|
861
|
+
return p === void 0 || p.base === null ? null : p.draft;
|
|
862
|
+
},
|
|
863
|
+
setDraft: (m, p) => {
|
|
864
|
+
const x = s.get(m);
|
|
865
|
+
if (x === void 0 || x.base === null) return;
|
|
866
|
+
x.draft = p;
|
|
867
|
+
const A = {}, I = p !== x.base.text;
|
|
868
|
+
I !== x.value.dirty && (A.dirty = I);
|
|
869
|
+
const { save: _ } = x.value;
|
|
870
|
+
if (_.kind === "conflicts") {
|
|
871
|
+
const b = mn(p).length;
|
|
872
|
+
b === 0 ? A.save = mt : b !== _.count && (A.save = { kind: "conflicts", count: b });
|
|
873
|
+
}
|
|
874
|
+
(A.dirty !== void 0 || A.save !== void 0) && v(x, A);
|
|
875
|
+
},
|
|
876
|
+
consumeRequest: (m) => {
|
|
877
|
+
const p = s.get(m);
|
|
878
|
+
p !== void 0 && p.value.request !== null && v(p, { request: null });
|
|
879
|
+
},
|
|
880
|
+
save: D,
|
|
881
|
+
replaceDraft: (m, p) => {
|
|
882
|
+
const x = f.get(m);
|
|
883
|
+
x?.flush();
|
|
884
|
+
const A = s.get(m);
|
|
885
|
+
if (A === void 0 || A.base === null) return;
|
|
886
|
+
const I = ft(p);
|
|
887
|
+
A.draft = I, x?.adopt(I), v(A, { dirty: I !== A.base.text, generation: A.value.generation + 1 });
|
|
888
|
+
},
|
|
889
|
+
close: (m) => {
|
|
890
|
+
if (!s.has(m)) return;
|
|
891
|
+
const p = f.get(m), x = p === void 0 ? null : p.returnPoint();
|
|
892
|
+
C(m), x === null ? a.delete(m) : a.set(m, x), l.emit();
|
|
893
|
+
},
|
|
894
|
+
takeReturn: (m) => {
|
|
895
|
+
const p = a.get(m) ?? null;
|
|
896
|
+
return a.delete(m), p;
|
|
897
|
+
},
|
|
898
|
+
dirtyPaths: () => [...s.values()].filter((m) => m.value.dirty).map((m) => m.value.path),
|
|
899
|
+
discard: (m) => {
|
|
900
|
+
for (const p of m) C(p);
|
|
901
|
+
m.length > 0 && l.emit();
|
|
902
|
+
},
|
|
903
|
+
editorState: {
|
|
904
|
+
get: (m) => i.get(m),
|
|
905
|
+
set: (m, p) => {
|
|
906
|
+
s.has(m) && i.set(m, p);
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
bindEditor: (m, p) => R(f, m, p),
|
|
910
|
+
bindView: (m, p) => R(u, m, p),
|
|
911
|
+
viewAnchor: (m) => {
|
|
912
|
+
const p = u.get(m);
|
|
913
|
+
return p === void 0 ? null : p.anchor();
|
|
914
|
+
},
|
|
915
|
+
flush: (m) => f.get(m)?.flush(),
|
|
916
|
+
flushDrafts: () => {
|
|
917
|
+
for (const m of f.values()) m.flush();
|
|
918
|
+
},
|
|
919
|
+
nextConflict: (m) => f.get(m)?.nextConflict() === !0,
|
|
920
|
+
hasSessions: () => s.size > 0,
|
|
921
|
+
unsavedAmong: (m) => {
|
|
922
|
+
for (const p of f.values()) p.flush();
|
|
923
|
+
return m.filter((p) => s.get(p)?.value.dirty === !0);
|
|
924
|
+
},
|
|
925
|
+
askToDiscard: (m) => new Promise((p) => {
|
|
926
|
+
g?.settle(!1);
|
|
927
|
+
const x = {
|
|
928
|
+
paths: m,
|
|
929
|
+
settle: (A) => {
|
|
930
|
+
if (g === x) {
|
|
931
|
+
if (g = null, A) for (const I of m) C(I);
|
|
932
|
+
l.emit(), p(A);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
g = x, l.emit();
|
|
937
|
+
}),
|
|
938
|
+
discardRequest: () => g,
|
|
939
|
+
sideBySide: () => (d ??= r.read(), d),
|
|
940
|
+
setSideBySide: (m) => {
|
|
941
|
+
d !== m && (d = m, r.write(m), l.emit());
|
|
942
|
+
},
|
|
943
|
+
editorShare: () => (h ??= o.read() ?? bo, h),
|
|
944
|
+
setEditorShare: (m) => {
|
|
945
|
+
if (!Number.isFinite(m)) throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(m)}`);
|
|
946
|
+
const p = Math.min(Qn, Math.max(er, m));
|
|
947
|
+
h !== p && (h = p, o.write(p));
|
|
948
|
+
},
|
|
949
|
+
setView: (m, p) => {
|
|
950
|
+
const x = s.get(m);
|
|
951
|
+
x === void 0 || x.value.view === p || (f.get(m)?.beforeView(p), v(x, { view: p, previewPrepared: x.value.previewPrepared || p === "preview" }));
|
|
952
|
+
},
|
|
953
|
+
preparePreview: (m) => {
|
|
954
|
+
const p = s.get(m);
|
|
955
|
+
p !== void 0 && !p.value.previewPrepared && v(p, { previewPrepared: !0 });
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
}, dr = (e) => {
|
|
959
|
+
e.preventDefault(), e.stopPropagation();
|
|
960
|
+
}, xs = (e) => e.endsWith("px") ? Number.parseFloat(e) : Number.NaN, ur = "data-aqmx-content-pane", Ct = Object.freeze({ [ur]: "" }), Ts = "--aqmx-dialog-left", Rs = "--aqmx-dialog-top", Os = '[data-testid="markdown-explorer"]', Cs = (e) => {
|
|
961
|
+
const t = e.closest(Os)?.querySelectorAll(`[${ur}]`), n = t?.item(t.length - 1);
|
|
962
|
+
if (!(n instanceof HTMLElement)) throw new Error("[markdown-explorer] a dialog opened where the explorer marks no content pane");
|
|
963
|
+
return n;
|
|
964
|
+
}, Ms = (e) => {
|
|
965
|
+
const t = xs(getComputedStyle(e).marginTop);
|
|
966
|
+
if (Number.isNaN(t)) return null;
|
|
967
|
+
const n = Cs(e), r = e.getBoundingClientRect(), o = e.ownerDocument.documentElement, { left: s, top: a } = yo(n.getBoundingClientRect(), { width: r.width + 2 * t, height: r.height + 2 * t }, { width: o.clientWidth, height: o.clientHeight });
|
|
968
|
+
return e.style.setProperty(Ts, `${String(s)}px`), e.style.setProperty(Rs, `${String(a)}px`), n;
|
|
969
|
+
}, Ls = (e) => e.preventDefault(), fr = ({ open: e, onOpen: t, onDismiss: n }) => {
|
|
970
|
+
const r = U(null), o = U(null), s = U(!1), a = U(t);
|
|
971
|
+
Y(() => {
|
|
972
|
+
a.current = t;
|
|
973
|
+
}, [t]), Y(() => {
|
|
974
|
+
s.current = e;
|
|
975
|
+
const l = r.current;
|
|
976
|
+
if (l !== null)
|
|
977
|
+
if (e && !l.open) {
|
|
978
|
+
const d = l.ownerDocument.activeElement;
|
|
979
|
+
o.current = d instanceof HTMLElement ? d : null, l.showModal(), a.current?.();
|
|
980
|
+
} else !e && l.open && (l.close(), o.current?.isConnected === !0 && o.current.focus(), o.current = null);
|
|
981
|
+
}, [e]), Y(() => {
|
|
982
|
+
const l = r.current;
|
|
983
|
+
if (!e || l === null) return;
|
|
984
|
+
const d = new ResizeObserver(() => g());
|
|
985
|
+
let h = null;
|
|
986
|
+
const g = () => {
|
|
987
|
+
const y = Ms(l);
|
|
988
|
+
y === null || y === h || (h !== null && d.unobserve(h), d.observe(y), h = y);
|
|
989
|
+
};
|
|
990
|
+
g(), d.observe(l);
|
|
991
|
+
const v = l.ownerDocument.defaultView;
|
|
992
|
+
return v?.addEventListener("resize", g), l.ownerDocument.addEventListener("scroll", g, { capture: !0, passive: !0 }), () => {
|
|
993
|
+
d.disconnect(), v?.removeEventListener("resize", g), l.ownerDocument.removeEventListener("scroll", g, { capture: !0 });
|
|
994
|
+
};
|
|
995
|
+
}, [e]);
|
|
996
|
+
const i = F(
|
|
997
|
+
(l) => {
|
|
998
|
+
l.key !== "Escape" || l.defaultPrevented || (dr(l), n());
|
|
999
|
+
},
|
|
1000
|
+
[n]
|
|
1001
|
+
), f = F(
|
|
1002
|
+
(l) => {
|
|
1003
|
+
l.target === l.currentTarget && n();
|
|
1004
|
+
},
|
|
1005
|
+
[n]
|
|
1006
|
+
), u = F(() => {
|
|
1007
|
+
s.current && n();
|
|
1008
|
+
}, [n]);
|
|
1009
|
+
return { ref: r, onKeyDown: i, onClick: f, onCancel: Ls, onClose: u };
|
|
1010
|
+
}, mr = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: s, onCancel: a, testId: i }) => {
|
|
1011
|
+
const f = U(null), u = Te(), l = Te(), d = F(() => f.current?.focus(), []), h = fr({ open: e, onOpen: d, onDismiss: a });
|
|
1012
|
+
return /* @__PURE__ */ c("dialog", { ...h, className: "aqmx-confirm", "aria-labelledby": u, "aria-describedby": l, "data-testid": i, children: /* @__PURE__ */ B("div", { className: "aqmx-confirm-panel", children: [
|
|
1013
|
+
/* @__PURE__ */ c("p", { id: u, className: "aqmx-confirm-title", children: t }),
|
|
1014
|
+
/* @__PURE__ */ c("p", { id: l, className: "aqmx-confirm-body", children: n }),
|
|
1015
|
+
/* @__PURE__ */ B("div", { className: "aqmx-confirm-actions", children: [
|
|
1016
|
+
/* @__PURE__ */ c("button", { ref: f, type: "button", className: "aqmx-callout-action", "data-testid": `${i}-cancel`, onClick: a, children: o }),
|
|
1017
|
+
/* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-aqmx-tone": "danger", "data-testid": `${i}-confirm`, onClick: s, children: r })
|
|
1018
|
+
] })
|
|
1019
|
+
] }) });
|
|
1020
|
+
}, $e = (e) => {
|
|
1021
|
+
const t = e;
|
|
1022
|
+
return t.status === void 0 && (t.status = "pending", e.then(
|
|
1023
|
+
(n) => {
|
|
1024
|
+
t.status = "fulfilled", t.value = n;
|
|
1025
|
+
},
|
|
1026
|
+
(n) => {
|
|
1027
|
+
t.status = "rejected", t.reason = n;
|
|
1028
|
+
}
|
|
1029
|
+
)), t;
|
|
1030
|
+
}, hr = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), Ae = (e) => e.status === "fulfilled" ? e.value : void 0, As = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !1 }), Ns = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !0 }), Ds = (e, t, n) => {
|
|
1031
|
+
const r = /* @__PURE__ */ new Set(), o = [...e].reverse();
|
|
1032
|
+
for (let s = o.pop(); s !== void 0; s = o.pop()) {
|
|
1033
|
+
if (s.type !== "directory" || r.has(s.path)) continue;
|
|
1034
|
+
r.add(s.path);
|
|
1035
|
+
const a = s.lazy === !0 ? n(s.path) : void 0, i = s.lazy === !0 ? a?.status === "loaded" ? a.entries : null : s.children === void 0 ? [] : s.children;
|
|
1036
|
+
if (s.path === t) return i;
|
|
1037
|
+
if (i !== null) for (const f of [...i].reverse()) o.push(f);
|
|
1038
|
+
}
|
|
1039
|
+
return null;
|
|
1040
|
+
}, Ps = (e, t, n) => {
|
|
1041
|
+
const r = Ae(e.read(t));
|
|
1042
|
+
if (r === void 0 || r.status === "deferred") return As;
|
|
1043
|
+
if (r.status === "error") return { readme: { status: "failed", failure: r.failure, retry: () => e.retry(t) }, claim: !1 };
|
|
1044
|
+
const o = Ds(r.entries, n, (a) => e.children(t, a));
|
|
1045
|
+
if (o !== null) return { readme: { status: "ok", readme: Qt(o) }, claim: !1 };
|
|
1046
|
+
const s = e.children(t, n);
|
|
1047
|
+
return s === void 0 || s.status === "loading" ? Ns : s.status === "failed" ? { readme: { status: "failed", failure: s.failure, retry: () => e.retryChildren(t, n) }, claim: !0 } : { readme: { status: "ok", readme: Qt(s.entries) }, claim: !0 };
|
|
1048
|
+
}, Is = (e, t, n) => {
|
|
1049
|
+
const { readme: r } = Ps(e, t, n);
|
|
1050
|
+
return r.status === "ok" ? r.readme : null;
|
|
1051
|
+
}, $s = (e, t, n) => {
|
|
1052
|
+
const r = mo({ path: `${e.basePath}/*`, end: !0 }, t.pathname);
|
|
1053
|
+
if (r === null) return /* @__PURE__ */ new Set();
|
|
1054
|
+
const { location: o } = Jn(e, r.params["*"], new URLSearchParams(t.search));
|
|
1055
|
+
switch (o.view) {
|
|
1056
|
+
case "tree": {
|
|
1057
|
+
const s = o.folder === null ? o.doc : n(o.source, o.folder);
|
|
1058
|
+
return new Set(s === null ? [] : [s]);
|
|
1059
|
+
}
|
|
1060
|
+
case "single":
|
|
1061
|
+
return /* @__PURE__ */ new Set([o.doc]);
|
|
1062
|
+
case "multi":
|
|
1063
|
+
return new Set(o.docs);
|
|
1064
|
+
}
|
|
1065
|
+
}, pr = (e) => {
|
|
1066
|
+
const { edits: t } = $(), n = F(() => t.session(e), [t, e]);
|
|
1067
|
+
return oe(t.subscribe, n, _s);
|
|
1068
|
+
}, gr = () => !1, _s = () => {
|
|
1069
|
+
}, Fs = () => {
|
|
1070
|
+
const { edits: e } = $();
|
|
1071
|
+
return oe(e.subscribe, e.hasSessions, gr);
|
|
1072
|
+
}, qs = () => {
|
|
1073
|
+
const { edits: e } = $();
|
|
1074
|
+
return oe(e.subscribe, e.sideBySide, gr);
|
|
1075
|
+
}, Bs = () => null, Us = () => {
|
|
1076
|
+
const { edits: e, labels: t, config: n, trees: r } = $(), o = U([]), s = F(
|
|
1077
|
+
({ nextLocation: g }) => {
|
|
1078
|
+
const v = $s(n, g, (y, T) => Is(r, y, T));
|
|
1079
|
+
return e.flushDrafts(), o.current = e.dirtyPaths().filter((y) => !v.has(y)), o.current.length > 0;
|
|
1080
|
+
},
|
|
1081
|
+
[e, n, r]
|
|
1082
|
+
), a = ho(s), i = Fs();
|
|
1083
|
+
ee(() => {
|
|
1084
|
+
if (!i) return;
|
|
1085
|
+
const g = (v) => {
|
|
1086
|
+
e.flushDrafts(), e.dirtyPaths().length !== 0 && (v.preventDefault(), v.returnValue = !0);
|
|
1087
|
+
};
|
|
1088
|
+
return window.addEventListener("beforeunload", g), () => window.removeEventListener("beforeunload", g);
|
|
1089
|
+
}, [i, e]);
|
|
1090
|
+
const f = oe(e.subscribe, e.discardRequest, Bs), u = a.state === "blocked", l = u ? o.current : f === null ? [] : f.paths, d = l.map((g) => fe(g)).join(", "), h = l.length > 0 && l.every((g) => e.session(g)?.save.kind === "draft");
|
|
1091
|
+
return /* @__PURE__ */ c(
|
|
1092
|
+
mr,
|
|
1093
|
+
{
|
|
1094
|
+
open: u || f !== null,
|
|
1095
|
+
title: h ? t.draftDiscardTitle : t.unsavedTitle,
|
|
1096
|
+
body: h ? t.draftDiscardBody(d) : t.unsavedBody(d),
|
|
1097
|
+
confirmLabel: t.unsavedDiscard,
|
|
1098
|
+
cancelLabel: t.unsavedStay,
|
|
1099
|
+
testId: "markdown-explorer-unsaved-guard",
|
|
1100
|
+
onConfirm: () => {
|
|
1101
|
+
if (a.state === "blocked") {
|
|
1102
|
+
e.discard(o.current), a.proceed();
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
f?.settle(!0);
|
|
1106
|
+
},
|
|
1107
|
+
onCancel: () => {
|
|
1108
|
+
if (a.state === "blocked") {
|
|
1109
|
+
a.reset();
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
f?.settle(!1);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
);
|
|
1116
|
+
};
|
|
1117
|
+
function Hs({
|
|
1118
|
+
title: e,
|
|
1119
|
+
titleId: t,
|
|
1120
|
+
...n
|
|
1121
|
+
}, r) {
|
|
1122
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1123
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1124
|
+
viewBox: "0 0 20 20",
|
|
1125
|
+
fill: "currentColor",
|
|
1126
|
+
"aria-hidden": "true",
|
|
1127
|
+
"data-slot": "icon",
|
|
1128
|
+
ref: r,
|
|
1129
|
+
"aria-labelledby": t
|
|
1130
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1131
|
+
id: t
|
|
1132
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1133
|
+
fillRule: "evenodd",
|
|
1134
|
+
d: "M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm2.25 8.5a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 3a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",
|
|
1135
|
+
clipRule: "evenodd"
|
|
1136
|
+
}));
|
|
1137
|
+
}
|
|
1138
|
+
const zs = /* @__PURE__ */ E.forwardRef(Hs);
|
|
1139
|
+
let ht = null;
|
|
1140
|
+
const wr = () => (ht ??= import("./EditSurface-sUNqYw9o.js").catch((e) => {
|
|
1141
|
+
throw ht = null, e;
|
|
1142
|
+
}), ht), js = () => {
|
|
1143
|
+
wr().catch(() => {
|
|
1144
|
+
});
|
|
1145
|
+
}, Vs = (e) => {
|
|
1146
|
+
const { default: t } = se(wr());
|
|
1147
|
+
return /* @__PURE__ */ c(t, { ...e });
|
|
1148
|
+
};
|
|
1149
|
+
class Zs extends Yn {
|
|
1150
|
+
state = { failed: !1 };
|
|
1151
|
+
static getDerivedStateFromError() {
|
|
1152
|
+
return { failed: !0 };
|
|
1153
|
+
}
|
|
1154
|
+
retry = () => this.setState({ failed: !1 });
|
|
1155
|
+
render() {
|
|
1156
|
+
return this.state.failed ? this.props.fallback(this.retry) : this.props.children;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
const _t = `[${nr}]`, Ws = "[data-aqmd-content]", Gs = '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]', Ks = 200, _e = (e) => Yo(e.getAttribute(nr)), Ys = (e, t) => {
|
|
1160
|
+
for (let r = e; r !== null && t.contains(r); r = r.parentElement) {
|
|
1161
|
+
const o = _e(r);
|
|
1162
|
+
if (o !== null) return { block: r, lines: o, own: !0 };
|
|
1163
|
+
}
|
|
1164
|
+
let n = null;
|
|
1165
|
+
for (const r of t.querySelectorAll(_t)) {
|
|
1166
|
+
if (!(r.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING)) break;
|
|
1167
|
+
const o = _e(r);
|
|
1168
|
+
o !== null && (n = { block: r, lines: o });
|
|
1169
|
+
}
|
|
1170
|
+
return n === null ? null : { ...n, own: !1 };
|
|
1171
|
+
}, Xs = (e, t) => {
|
|
1172
|
+
let n = 0;
|
|
1173
|
+
for (let r = e.indexOf(t); r >= 0; r = e.indexOf(t, r + t.length)) n += 1;
|
|
1174
|
+
return n;
|
|
1175
|
+
}, Js = (e) => e.closest(Ws) !== null && e.closest(Gs) === null, Qs = (e, t, n) => {
|
|
1176
|
+
const r = Ys(e, t);
|
|
1177
|
+
if (r === null) return null;
|
|
1178
|
+
const { block: o, own: s } = r;
|
|
1179
|
+
if (!s) {
|
|
1180
|
+
const i = r.lines.last + 1;
|
|
1181
|
+
return { lines: { first: i, last: i }, word: null, occurrence: 0, clientTop: Qe(e) };
|
|
1182
|
+
}
|
|
1183
|
+
const a = ra(o, n);
|
|
1184
|
+
return a === null ? { lines: r.lines, word: null, occurrence: 0, clientTop: Qe(o) } : { lines: r.lines, word: a.text, occurrence: a.occurrence, clientTop: a.clientTop };
|
|
1185
|
+
}, ea = (e, t) => {
|
|
1186
|
+
let n = null, r = null, o = null;
|
|
1187
|
+
for (const a of e.querySelectorAll(_t)) {
|
|
1188
|
+
const i = _e(a);
|
|
1189
|
+
if (i === null) continue;
|
|
1190
|
+
n ??= na(t, a);
|
|
1191
|
+
const { top: f, bottom: u } = a.getBoundingClientRect();
|
|
1192
|
+
f <= n && n < u ? r = { lines: i, block: a } : o === null && f >= n && (o = { lines: i, block: a });
|
|
1193
|
+
}
|
|
1194
|
+
const s = r === null ? o : r;
|
|
1195
|
+
return s === null ? null : { lines: s.lines, word: null, occurrence: 0, clientTop: Qe(s.block) };
|
|
1196
|
+
}, ta = (e) => e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, na = (e, t) => {
|
|
1197
|
+
const n = Number.parseFloat(getComputedStyle(t).scrollMarginTop);
|
|
1198
|
+
return ta(e) + (Number.isFinite(n) ? n : 0);
|
|
1199
|
+
}, ra = (e, t) => {
|
|
1200
|
+
if (t === null || t.rangeCount === 0) return null;
|
|
1201
|
+
const n = t.getRangeAt(0);
|
|
1202
|
+
if (!(e.contains(n.startContainer) && e.contains(n.endContainer))) return null;
|
|
1203
|
+
const r = n.toString().trim();
|
|
1204
|
+
if (r === "" || r.length > Ks || /[\r\n]/u.test(r)) return null;
|
|
1205
|
+
const o = e.ownerDocument.createRange();
|
|
1206
|
+
return o.setStart(e, 0), o.setEnd(n.startContainer, n.startOffset), { text: r, occurrence: Xs(o.toString(), r), clientTop: n.getBoundingClientRect().top };
|
|
1207
|
+
}, nu = (e, t) => {
|
|
1208
|
+
const n = e.split(`
|
|
1209
|
+
`), r = Math.min(t.lines.first, n.length), o = Math.min(t.lines.last, n.length), s = { line: r, column: 0 };
|
|
1210
|
+
if (t.word === null) return s;
|
|
1211
|
+
let a = 0;
|
|
1212
|
+
for (let i = r; i <= o; i += 1) {
|
|
1213
|
+
const f = n[i - 1] ?? "";
|
|
1214
|
+
for (let u = f.indexOf(t.word); u >= 0; u = f.indexOf(t.word, u + t.word.length)) {
|
|
1215
|
+
if (a === t.occurrence) return { line: i, column: u };
|
|
1216
|
+
a += 1;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
return a > 0 ? oa(n, r, o, t.word) ?? s : s;
|
|
1220
|
+
}, oa = (e, t, n, r) => {
|
|
1221
|
+
for (let o = n; o >= t; o -= 1) {
|
|
1222
|
+
const s = (e[o - 1] ?? "").lastIndexOf(r);
|
|
1223
|
+
if (s >= 0) return { line: o, column: s };
|
|
1224
|
+
}
|
|
1225
|
+
return null;
|
|
1226
|
+
}, sa = (e, t) => {
|
|
1227
|
+
let n = null, r = null;
|
|
1228
|
+
for (const o of e.querySelectorAll(_t)) {
|
|
1229
|
+
const s = _e(o);
|
|
1230
|
+
s === null || s.first > t || (s.last >= t ? n = o : (r === null || s.last >= r.last) && (r = { element: o, last: s.last }));
|
|
1231
|
+
}
|
|
1232
|
+
return n !== null ? n : r === null ? null : r.element;
|
|
1233
|
+
}, aa = (e, t) => {
|
|
1234
|
+
const { bottom: n } = e.getBoundingClientRect(), r = Qe(e), o = _e(e);
|
|
1235
|
+
if (o === null) return r;
|
|
1236
|
+
const s = Math.min(Math.max(t - o.first, 0) / (o.last - o.first + 1), 1);
|
|
1237
|
+
return r + (n - r) * s;
|
|
1238
|
+
}, Qe = (e) => {
|
|
1239
|
+
const t = e.ownerDocument.createTreeWalker(e, NodeFilter.SHOW_TEXT);
|
|
1240
|
+
for (let n = t.nextNode(); n !== null; n = t.nextNode()) {
|
|
1241
|
+
const o = (n.textContent ?? "").search(/\S/u);
|
|
1242
|
+
if (o < 0) continue;
|
|
1243
|
+
const s = e.ownerDocument.createRange();
|
|
1244
|
+
s.setStart(n, o), s.setEnd(n, o + 1);
|
|
1245
|
+
const { top: a, height: i } = s.getBoundingClientRect();
|
|
1246
|
+
if (i > 0) return a;
|
|
1247
|
+
}
|
|
1248
|
+
return e.getBoundingClientRect().top;
|
|
1249
|
+
}, Ft = Object.freeze({
|
|
1250
|
+
browse: Object.freeze({ replace: !0, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
|
|
1251
|
+
"switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
|
|
1252
|
+
"switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
|
|
1253
|
+
"follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
|
|
1254
|
+
}), ru = (e) => Ft[e], ot = () => {
|
|
1255
|
+
const e = po();
|
|
1256
|
+
return F(
|
|
1257
|
+
(t, n) => {
|
|
1258
|
+
e(t, Ft[n]);
|
|
1259
|
+
},
|
|
1260
|
+
[e]
|
|
1261
|
+
);
|
|
1262
|
+
}, ia = ({ navigation: e, ...t }) => /* @__PURE__ */ c(go, { ...t, ...Ft[e] }), vr = (e) => {
|
|
1263
|
+
const t = e.ownerDocument;
|
|
1264
|
+
if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
|
|
1265
|
+
if (e.hasAttribute("tabindex")) return !1;
|
|
1266
|
+
if (e.setAttribute("tabindex", "-1"), e.focus({ preventScroll: !0 }), t.activeElement !== e)
|
|
1267
|
+
return e.removeAttribute("tabindex"), !1;
|
|
1268
|
+
const n = () => {
|
|
1269
|
+
t.activeElement !== e && (e.removeAttribute("tabindex"), e.removeEventListener("blur", n));
|
|
1270
|
+
};
|
|
1271
|
+
return e.addEventListener("blur", n), !0;
|
|
1272
|
+
}, la = (e, t) => {
|
|
1273
|
+
const n = U(null), r = U(null), o = U(null), s = F(() => {
|
|
1274
|
+
n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
|
|
1275
|
+
}, []);
|
|
1276
|
+
ee(() => s, [s]);
|
|
1277
|
+
const a = F(
|
|
1278
|
+
(u) => {
|
|
1279
|
+
if (r.current !== u) return;
|
|
1280
|
+
const l = o.current;
|
|
1281
|
+
if (l !== null) {
|
|
1282
|
+
l.then(() => a(u));
|
|
1283
|
+
return;
|
|
1284
|
+
}
|
|
1285
|
+
e.prefetch(u);
|
|
1286
|
+
const d = e.peek(u);
|
|
1287
|
+
if (d?.status !== "pending") return;
|
|
1288
|
+
const h = Promise.allSettled([d.promise]);
|
|
1289
|
+
o.current = h, h.then(() => {
|
|
1290
|
+
o.current === h && (o.current = null);
|
|
1291
|
+
});
|
|
1292
|
+
},
|
|
1293
|
+
[e]
|
|
1294
|
+
), i = F(
|
|
1295
|
+
(u) => {
|
|
1296
|
+
const l = t(u);
|
|
1297
|
+
l !== r.current && (s(), l !== null && (r.current = l, n.current = window.setTimeout(() => {
|
|
1298
|
+
n.current = null, a(l);
|
|
1299
|
+
}, ko)));
|
|
1300
|
+
},
|
|
1301
|
+
[s, t, a]
|
|
1302
|
+
), f = F(
|
|
1303
|
+
(u) => {
|
|
1304
|
+
t(u) !== r.current && s();
|
|
1305
|
+
},
|
|
1306
|
+
[s, t]
|
|
1307
|
+
);
|
|
1308
|
+
return X(
|
|
1309
|
+
() => ({
|
|
1310
|
+
onPointerOver: (u) => i(u.target),
|
|
1311
|
+
onPointerOut: (u) => f(u.relatedTarget),
|
|
1312
|
+
onFocus: (u) => i(u.target),
|
|
1313
|
+
onBlur: (u) => f(u.relatedTarget)
|
|
1314
|
+
}),
|
|
1315
|
+
[i, f]
|
|
1316
|
+
);
|
|
1317
|
+
}, ca = Pt(() => import("./NativeScrollBar-ByawerpG.js").then((e) => ({ default: e.NativeScrollBar })));
|
|
1318
|
+
class da extends Yn {
|
|
1319
|
+
state = { failed: !1 };
|
|
1320
|
+
static getDerivedStateFromError() {
|
|
1321
|
+
return { failed: !0 };
|
|
1322
|
+
}
|
|
1323
|
+
componentDidCatch(t) {
|
|
1324
|
+
console.error("[markdown-explorer] a scroll bar failed to load or render; its scroller keeps its native scrolling without it.", t);
|
|
1325
|
+
}
|
|
1326
|
+
render() {
|
|
1327
|
+
return this.state.failed ? null : this.props.children;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
const ua = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(da, { children: /* @__PURE__ */ c(Ie, { fallback: null, children: /* @__PURE__ */ c(ca, { scroller: e, withCircle: t }) }) }), br = (e) => /* @__PURE__ */ c(ua, { scroller: e, withCircle: !0 }), yr = () => {
|
|
1331
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
1332
|
+
let n = !1;
|
|
1333
|
+
const r = (o) => {
|
|
1334
|
+
t.add(o), !n && (n = !0, queueMicrotask(() => {
|
|
1335
|
+
n = !1, t.clear();
|
|
1336
|
+
}));
|
|
1337
|
+
};
|
|
1338
|
+
return {
|
|
1339
|
+
hold: (o) => {
|
|
1340
|
+
e.set(o, (e.get(o) ?? 0) + 1);
|
|
1341
|
+
let s = !1;
|
|
1342
|
+
return () => {
|
|
1343
|
+
if (s) return;
|
|
1344
|
+
s = !0;
|
|
1345
|
+
const a = e.get(o);
|
|
1346
|
+
if (a !== void 0 && a > 1) {
|
|
1347
|
+
e.set(o, a - 1);
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1350
|
+
e.delete(o), r(o);
|
|
1351
|
+
};
|
|
1352
|
+
},
|
|
1353
|
+
isHeld: (o) => e.has(o),
|
|
1354
|
+
resumes: (o) => t.delete(o),
|
|
1355
|
+
heldKeys: () => [...e.keys()]
|
|
1356
|
+
};
|
|
1357
|
+
}, et = (e, t) => {
|
|
1358
|
+
if (Object.is(e, t)) return !0;
|
|
1359
|
+
if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
|
|
1360
|
+
if (Array.isArray(e) || Array.isArray(t))
|
|
1361
|
+
return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((s, a) => et(s, t[a]));
|
|
1362
|
+
const n = e, r = t, o = Object.keys(n);
|
|
1363
|
+
return o.length !== Object.keys(r).length ? !1 : o.every((s) => Object.hasOwn(r, s) && et(n[s], r[s]));
|
|
1364
|
+
}, fa = 55e3, gn = Object.freeze({ status: "deferred" }), pt = Object.freeze({ status: "refreshed" }), gt = Object.freeze({ status: "shown", failed: !1 }), je = Object.freeze({ status: "shown", failed: !0 }), Ve = Object.freeze({ status: "superseded" }), ge = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, ma = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", ha = ({ client: e, capacity: t }) => {
|
|
1365
|
+
if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
|
|
1366
|
+
const n = /* @__PURE__ */ new Map(), r = yr(), o = qe(), s = /* @__PURE__ */ new WeakSet(), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
1367
|
+
let u = 0;
|
|
1368
|
+
const l = o.emit, d = () => (u += 1, u), h = () => {
|
|
1369
|
+
if (!(n.size <= t))
|
|
1370
|
+
for (const b of [...n.keys()]) {
|
|
1371
|
+
if (n.size <= t) return;
|
|
1372
|
+
r.isHeld(b) || n.delete(b);
|
|
1373
|
+
}
|
|
1374
|
+
}, g = (b, S) => {
|
|
1375
|
+
n.delete(b), n.set(b, S);
|
|
1376
|
+
}, v = (b) => performance.now() - b.validatedAt >= fa, y = (b, S, M) => {
|
|
1377
|
+
const L = n.get(b), P = ge(L?.snapshot), H = M || L?.refreshPending === !0, K = $e(e.document(b, { refresh: H }).then((k) => ({ status: "loaded", document: k }))), w = { snapshot: { status: "pending", promise: K, previous: P }, validatedAt: performance.now(), opened: S, background: null, refreshPending: !1, seeded: void 0, stamp: d() };
|
|
1378
|
+
return g(b, w), h(), K.then((k) => {
|
|
1379
|
+
n.get(b) === w && (w.snapshot = k, w.stamp = d(), l());
|
|
1380
|
+
}), w;
|
|
1381
|
+
}, T = (b, S, M, L, P, H) => {
|
|
1382
|
+
S.background === M && (S.background = null, !(n.get(b) !== S || S.snapshot !== L) && (P.kind === "failure" && L.document.kind !== "failure" || (S.validatedAt = H, S.stamp = d(), et(L.document, P) || (S.snapshot = { status: "loaded", document: P }), l())));
|
|
1383
|
+
}, C = async (b, S) => {
|
|
1384
|
+
const M = S.snapshot;
|
|
1385
|
+
if (M.status !== "loaded") return null;
|
|
1386
|
+
const L = {};
|
|
1387
|
+
S.background = L;
|
|
1388
|
+
const P = performance.now(), H = e.document(b, { refresh: S.refreshPending });
|
|
1389
|
+
S.refreshPending = !1;
|
|
1390
|
+
const K = await H, w = S.background === L && n.get(b) === S && S.snapshot === M;
|
|
1391
|
+
return T(b, S, L, M, K, P), w ? K : null;
|
|
1392
|
+
}, R = (b, S) => {
|
|
1393
|
+
const { snapshot: M } = S;
|
|
1394
|
+
return M.status === "pending" ? !1 : M.status === "loaded" && M.document.kind !== "failure" ? (C(b, S), !1) : (M.status === "loaded" && s.add(M), y(b, !0, !1), !0);
|
|
1395
|
+
}, q = (b) => {
|
|
1396
|
+
i.delete(b);
|
|
1397
|
+
const S = f.get(b);
|
|
1398
|
+
if (S !== void 0) {
|
|
1399
|
+
f.delete(b);
|
|
1400
|
+
for (const M of S) M();
|
|
1401
|
+
}
|
|
1402
|
+
}, D = (b, S) => new Promise((M) => {
|
|
1403
|
+
if (i.get(b) === S || !r.isHeld(b)) {
|
|
1404
|
+
M();
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1407
|
+
const L = f.get(b);
|
|
1408
|
+
L === void 0 ? f.set(b, /* @__PURE__ */ new Set([M])) : L.add(M);
|
|
1409
|
+
}), m = (b, S) => {
|
|
1410
|
+
const M = a.get(b);
|
|
1411
|
+
if (M === void 0) {
|
|
1412
|
+
S.resolve(null);
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
if (M.last !== null && M.last.stamp >= S.stamp) {
|
|
1416
|
+
S.resolve(M.last);
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
M.waiters.add(S);
|
|
1420
|
+
}, p = async (b, S, M) => {
|
|
1421
|
+
const L = await new Promise((P) => m(b, { stamp: S.stamp, resolve: P }));
|
|
1422
|
+
if (n.get(b) !== S) return Ve;
|
|
1423
|
+
if (L === null) return M ? pt : gt;
|
|
1424
|
+
if (!M) return L.failure === null ? gt : je;
|
|
1425
|
+
switch (L.before) {
|
|
1426
|
+
case "copy":
|
|
1427
|
+
return L.failure === null ? pt : { status: "failed", failure: L.failure };
|
|
1428
|
+
case "failure":
|
|
1429
|
+
return L.failure === null ? gt : je;
|
|
1430
|
+
case "none":
|
|
1431
|
+
return L.failure === null ? pt : je;
|
|
1432
|
+
}
|
|
1433
|
+
}, x = (b) => {
|
|
1434
|
+
const S = { showing: "none", last: null, waiters: /* @__PURE__ */ new Set() };
|
|
1435
|
+
a.set(b, S);
|
|
1436
|
+
let M = !1;
|
|
1437
|
+
return {
|
|
1438
|
+
settle: (L, P) => {
|
|
1439
|
+
if (M || L === void 0) return;
|
|
1440
|
+
const H = { stamp: L, failure: P, before: S.showing };
|
|
1441
|
+
S.last = H, P === null ? S.showing = "copy" : S.showing === "none" && (S.showing = "failure");
|
|
1442
|
+
for (const K of [...S.waiters])
|
|
1443
|
+
L < K.stamp || (S.waiters.delete(K), K.resolve(H));
|
|
1444
|
+
},
|
|
1445
|
+
release: () => {
|
|
1446
|
+
if (M) return;
|
|
1447
|
+
M = !0, a.get(b) === S && a.delete(b);
|
|
1448
|
+
const L = [...S.waiters];
|
|
1449
|
+
S.waiters.clear(), L.length > 0 && queueMicrotask(() => {
|
|
1450
|
+
for (const P of L) m(b, P);
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
}, A = (b) => {
|
|
1455
|
+
const S = r.hold(b);
|
|
1456
|
+
let M = !1;
|
|
1457
|
+
return () => {
|
|
1458
|
+
if (M) return;
|
|
1459
|
+
M = !0, S();
|
|
1460
|
+
const L = n.get(b);
|
|
1461
|
+
L !== void 0 && g(b, L), h(), r.isHeld(b) || queueMicrotask(() => {
|
|
1462
|
+
r.isHeld(b) || q(b);
|
|
1463
|
+
});
|
|
1464
|
+
};
|
|
1465
|
+
};
|
|
1466
|
+
return {
|
|
1467
|
+
peek: (b) => n.get(b)?.snapshot,
|
|
1468
|
+
peekSeeded: (b) => n.get(b)?.seeded,
|
|
1469
|
+
answerStampOf: (b) => n.get(b)?.stamp,
|
|
1470
|
+
prefetch: (b) => {
|
|
1471
|
+
const S = n.get(b);
|
|
1472
|
+
S !== void 0 && S.snapshot.status !== "deferred" || (y(b, !1, !1), l());
|
|
1473
|
+
},
|
|
1474
|
+
open: (b) => {
|
|
1475
|
+
const S = r.resumes(b), M = A(b), L = n.get(b);
|
|
1476
|
+
if (L === void 0 || L.snapshot.status === "deferred")
|
|
1477
|
+
return y(b, !0, !1), l(), M;
|
|
1478
|
+
if (g(b, L), S) return M;
|
|
1479
|
+
const { snapshot: P } = L;
|
|
1480
|
+
return P.status === "pending" ? (L.opened = !0, M) : P.document.kind === "failure" ? (L.opened || v(L) ? (s.add(P), y(b, !0, !1), l()) : L.opened = !0, M) : (L.opened = !0, L.background === null && v(L) && C(b, L), M);
|
|
1481
|
+
},
|
|
1482
|
+
retain: A,
|
|
1483
|
+
retry: (b) => {
|
|
1484
|
+
const S = n.get(b);
|
|
1485
|
+
S === void 0 || S.snapshot.status !== "loaded" || S.snapshot.document.kind !== "failure" || (y(b, !0, !1), l());
|
|
1486
|
+
},
|
|
1487
|
+
seed: (b, S) => {
|
|
1488
|
+
const M = performance.now(), L = $e(
|
|
1489
|
+
S.then(
|
|
1490
|
+
(k) => k === null ? gn : { status: "loaded", document: k },
|
|
1491
|
+
() => gn
|
|
1492
|
+
)
|
|
1493
|
+
), P = n.get(b);
|
|
1494
|
+
if (P !== void 0 && P.snapshot.status === "loaded") {
|
|
1495
|
+
const k = P.snapshot, O = {};
|
|
1496
|
+
P.background = O, L.then((N) => {
|
|
1497
|
+
if (N.status === "loaded") {
|
|
1498
|
+
T(b, P, O, k, N.document, M);
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
P.background === O && (P.background = null);
|
|
1502
|
+
});
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
const H = P !== void 0 && P.snapshot.status === "pending" ? P.snapshot.previous : null, K = { status: "pending", promise: L, previous: H }, w = { snapshot: K, validatedAt: M, opened: P?.opened === !0, background: null, refreshPending: P?.refreshPending === !0, seeded: K, stamp: d() };
|
|
1506
|
+
g(b, w), h(), L.then((k) => {
|
|
1507
|
+
n.get(b) === w && (k.status === "deferred" && r.isHeld(b) ? y(b, w.opened, !1) : (w.snapshot = k, w.stamp = d()), l());
|
|
1508
|
+
});
|
|
1509
|
+
},
|
|
1510
|
+
invalidate: () => {
|
|
1511
|
+
let b = !1;
|
|
1512
|
+
for (const [S, M] of [...n]) {
|
|
1513
|
+
if (M.validatedAt = Number.NEGATIVE_INFINITY, M.opened = !0, M.refreshPending = !0, !r.isHeld(S)) continue;
|
|
1514
|
+
const { snapshot: L } = M;
|
|
1515
|
+
if (L.status !== "pending") {
|
|
1516
|
+
R(S, M) && (b = !0);
|
|
1517
|
+
continue;
|
|
1518
|
+
}
|
|
1519
|
+
L.promise.then(() => {
|
|
1520
|
+
n.get(S) === M && M.refreshPending && r.isHeld(S) && R(S, M) && l();
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
b && l();
|
|
1524
|
+
},
|
|
1525
|
+
refresh: async (b) => {
|
|
1526
|
+
const S = n.get(b);
|
|
1527
|
+
if (S !== void 0 && ma(S.snapshot)) {
|
|
1528
|
+
S.refreshPending = !0;
|
|
1529
|
+
const P = await C(b, S);
|
|
1530
|
+
return P === null ? Ve : P.kind === "failure" ? { status: "failed", failure: P.failure } : p(b, S, !0);
|
|
1531
|
+
}
|
|
1532
|
+
const M = y(b, !0, !0);
|
|
1533
|
+
if (l(), M.snapshot.status !== "pending") return Ve;
|
|
1534
|
+
const L = await M.snapshot.promise;
|
|
1535
|
+
return n.get(b) !== M || L.status !== "loaded" ? Ve : L.document.kind === "failure" ? je : (await D(b, L), p(b, M, !1));
|
|
1536
|
+
},
|
|
1537
|
+
clear: () => {
|
|
1538
|
+
n.clear();
|
|
1539
|
+
for (const b of r.heldKeys()) y(b, !0, !1);
|
|
1540
|
+
l();
|
|
1541
|
+
},
|
|
1542
|
+
subscribe: o.subscribe,
|
|
1543
|
+
readPart: x,
|
|
1544
|
+
noteShown: (b, S) => {
|
|
1545
|
+
i.set(b, S);
|
|
1546
|
+
const M = f.get(b);
|
|
1547
|
+
if (M !== void 0) {
|
|
1548
|
+
f.delete(b);
|
|
1549
|
+
for (const L of M) L();
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
noteFailureShown: (b) => s.has(b) ? !1 : (s.add(b), !0)
|
|
1553
|
+
};
|
|
1554
|
+
}, we = ve("fill"), pa = Object.freeze({ blockSize: "100%" }), Be = ({ scrollerProps: e, children: t }) => se(we) === "content" ? /* @__PURE__ */ c(sn, { scrollerProps: e, children: t }) : /* @__PURE__ */ c(sn, { scrollerProps: { ...e, style: pa }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: br, children: t }), ga = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), wa = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), Oe = ({ label: e, testId: t }) => /* @__PURE__ */ B(pe, { children: [
|
|
1555
|
+
/* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": t, children: ga.map((n) => /* @__PURE__ */ c("span", {}, n)) }),
|
|
1556
|
+
/* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: e })
|
|
1557
|
+
] }), qt = ({ failure: e, onRetry: t, testId: n }) => /* @__PURE__ */ c(Be, { scrollerProps: wa, children: /* @__PURE__ */ c(Re, { failure: e, alert: !1, onRetry: t, testId: n }) });
|
|
1558
|
+
function va({
|
|
1559
|
+
title: e,
|
|
1560
|
+
titleId: t,
|
|
1561
|
+
...n
|
|
1562
|
+
}, r) {
|
|
1563
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1564
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1565
|
+
viewBox: "0 0 20 20",
|
|
1566
|
+
fill: "currentColor",
|
|
1567
|
+
"aria-hidden": "true",
|
|
1568
|
+
"data-slot": "icon",
|
|
1569
|
+
ref: r,
|
|
1570
|
+
"aria-labelledby": t
|
|
1571
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1572
|
+
id: t
|
|
1573
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1574
|
+
fillRule: "evenodd",
|
|
1575
|
+
d: "M18 5.25a2.25 2.25 0 0 0-2.012-2.238A2.25 2.25 0 0 0 13.75 1h-1.5a2.25 2.25 0 0 0-2.238 2.012c-.875.092-1.6.686-1.884 1.488H11A2.5 2.5 0 0 1 13.5 7v7h2.25A2.25 2.25 0 0 0 18 11.75v-6.5ZM12.25 2.5a.75.75 0 0 0-.75.75v.25h3v-.25a.75.75 0 0 0-.75-.75h-1.5Z",
|
|
1576
|
+
clipRule: "evenodd"
|
|
1577
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
1578
|
+
fillRule: "evenodd",
|
|
1579
|
+
d: "M3 6a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H3Zm6.874 4.166a.75.75 0 1 0-1.248-.832l-2.493 3.739-.853-.853a.75.75 0 0 0-1.06 1.06l1.5 1.5a.75.75 0 0 0 1.154-.114l3-4.5Z",
|
|
1580
|
+
clipRule: "evenodd"
|
|
1581
|
+
}));
|
|
1582
|
+
}
|
|
1583
|
+
const ba = /* @__PURE__ */ E.forwardRef(va);
|
|
1584
|
+
function ya({
|
|
1585
|
+
title: e,
|
|
1586
|
+
titleId: t,
|
|
1587
|
+
...n
|
|
1588
|
+
}, r) {
|
|
1589
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1590
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1591
|
+
viewBox: "0 0 20 20",
|
|
1592
|
+
fill: "currentColor",
|
|
1593
|
+
"aria-hidden": "true",
|
|
1594
|
+
"data-slot": "icon",
|
|
1595
|
+
ref: r,
|
|
1596
|
+
"aria-labelledby": t
|
|
1597
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1598
|
+
id: t
|
|
1599
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1600
|
+
fillRule: "evenodd",
|
|
1601
|
+
d: "M15.988 3.012A2.25 2.25 0 0 1 18 5.25v6.5A2.25 2.25 0 0 1 15.75 14H13.5v-3.379a3 3 0 0 0-.879-2.121l-3.12-3.121a3 3 0 0 0-1.402-.791 2.252 2.252 0 0 1 1.913-1.576A2.25 2.25 0 0 1 12.25 1h1.5a2.25 2.25 0 0 1 2.238 2.012ZM11.5 3.25a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 .75.75v.25h-3v-.25Z",
|
|
1602
|
+
clipRule: "evenodd"
|
|
1603
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
1604
|
+
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"
|
|
1605
|
+
}));
|
|
1606
|
+
}
|
|
1607
|
+
const ka = /* @__PURE__ */ E.forwardRef(ya);
|
|
1608
|
+
function Ea({
|
|
1609
|
+
title: e,
|
|
1610
|
+
titleId: t,
|
|
1611
|
+
...n
|
|
1612
|
+
}, r) {
|
|
1613
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1614
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1615
|
+
viewBox: "0 0 20 20",
|
|
1616
|
+
fill: "currentColor",
|
|
1617
|
+
"aria-hidden": "true",
|
|
1618
|
+
"data-slot": "icon",
|
|
1619
|
+
ref: r,
|
|
1620
|
+
"aria-labelledby": t
|
|
1621
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1622
|
+
id: t
|
|
1623
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1624
|
+
fillRule: "evenodd",
|
|
1625
|
+
d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
|
|
1626
|
+
clipRule: "evenodd"
|
|
1627
|
+
}));
|
|
1628
|
+
}
|
|
1629
|
+
const Sa = /* @__PURE__ */ E.forwardRef(Ea), xa = 2e3, wn = Object.freeze({ outcome: "idle" }), Ta = (e) => {
|
|
1630
|
+
const t = navigator.clipboard;
|
|
1631
|
+
return t === void 0 ? Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")) : t.writeText(e);
|
|
1632
|
+
}, Ra = ({ text: e }) => {
|
|
1633
|
+
const { announcer: t, labels: n } = $(), [r, o] = V(wn);
|
|
1634
|
+
ee(() => {
|
|
1635
|
+
if (r.outcome === "idle") return;
|
|
1636
|
+
const f = setTimeout(() => o(wn), xa);
|
|
1637
|
+
return () => clearTimeout(f);
|
|
1638
|
+
}, [r]);
|
|
1639
|
+
const s = (f) => {
|
|
1640
|
+
o({ outcome: f }), t.announce(f === "copied" ? n.copiedText : n.copyTextFailed);
|
|
1641
|
+
}, a = () => {
|
|
1642
|
+
Ta(e).then(
|
|
1643
|
+
() => s("copied"),
|
|
1644
|
+
() => s("failed")
|
|
1645
|
+
);
|
|
1646
|
+
}, i = r.outcome === "copied" ? n.copiedText : r.outcome === "failed" ? n.copyTextFailed : n.copyText;
|
|
1647
|
+
return (
|
|
1648
|
+
/* @__PURE__ */ c("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: i, onClick: a, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ c(ba, {}) : r.outcome === "failed" ? /* @__PURE__ */ c(Sa, {}) : /* @__PURE__ */ c(ka, {}) })
|
|
1649
|
+
);
|
|
1650
|
+
}, kr = ve(null), Oa = () => {
|
|
1651
|
+
const e = se(kr);
|
|
1652
|
+
if (e === null) throw new Error("[markdown-explorer] a document's content reads its own part only inside a document pane (DocumentContentChannelContext)");
|
|
1653
|
+
return e;
|
|
1654
|
+
};
|
|
1655
|
+
function Ca({
|
|
1656
|
+
title: e,
|
|
1657
|
+
titleId: t,
|
|
1658
|
+
...n
|
|
1659
|
+
}, r) {
|
|
1660
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1661
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1662
|
+
viewBox: "0 0 20 20",
|
|
1663
|
+
fill: "currentColor",
|
|
1664
|
+
"aria-hidden": "true",
|
|
1665
|
+
"data-slot": "icon",
|
|
1666
|
+
ref: r,
|
|
1667
|
+
"aria-labelledby": t
|
|
1668
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1669
|
+
id: t
|
|
1670
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1671
|
+
d: "M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z"
|
|
1672
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
1673
|
+
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"
|
|
1674
|
+
}));
|
|
1675
|
+
}
|
|
1676
|
+
const Ma = /* @__PURE__ */ E.forwardRef(Ca);
|
|
1677
|
+
function La({
|
|
1678
|
+
title: e,
|
|
1679
|
+
titleId: t,
|
|
1680
|
+
...n
|
|
1681
|
+
}, r) {
|
|
1682
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1683
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1684
|
+
viewBox: "0 0 20 20",
|
|
1685
|
+
fill: "currentColor",
|
|
1686
|
+
"aria-hidden": "true",
|
|
1687
|
+
"data-slot": "icon",
|
|
1688
|
+
ref: r,
|
|
1689
|
+
"aria-labelledby": t
|
|
1690
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1691
|
+
id: t
|
|
1692
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1693
|
+
fillRule: "evenodd",
|
|
1694
|
+
d: "M4.25 5.5a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75v-4a.75.75 0 0 1 1.5 0v4A2.25 2.25 0 0 1 12.75 17h-8.5A2.25 2.25 0 0 1 2 14.75v-8.5A2.25 2.25 0 0 1 4.25 4h5a.75.75 0 0 1 0 1.5h-5Z",
|
|
1695
|
+
clipRule: "evenodd"
|
|
1696
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
1697
|
+
fillRule: "evenodd",
|
|
1698
|
+
d: "M6.194 12.753a.75.75 0 0 0 1.06.053L16.5 4.44v2.81a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.553l-9.056 8.194a.75.75 0 0 0-.053 1.06Z",
|
|
1699
|
+
clipRule: "evenodd"
|
|
1700
|
+
}));
|
|
1701
|
+
}
|
|
1702
|
+
const Aa = /* @__PURE__ */ E.forwardRef(La), Ue = ({ name: e, openUrl: t, downloadUrl: n, icon: r, children: o }) => {
|
|
1703
|
+
const { labels: s } = $();
|
|
1704
|
+
return /* @__PURE__ */ B("div", { className: "aqmx-document-toolbar", children: [
|
|
1705
|
+
/* @__PURE__ */ c("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: r }),
|
|
1706
|
+
/* @__PURE__ */ c("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
|
|
1707
|
+
o,
|
|
1708
|
+
/* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": s.openInNewTab, title: s.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ c(Aa, {}) }),
|
|
1709
|
+
/* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: n, download: e, "aria-label": s.download, title: s.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ c(Ma, {}) })
|
|
1710
|
+
] });
|
|
1711
|
+
};
|
|
1712
|
+
function Na({
|
|
1713
|
+
title: e,
|
|
1714
|
+
titleId: t,
|
|
1715
|
+
...n
|
|
1716
|
+
}, r) {
|
|
1717
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1718
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1719
|
+
viewBox: "0 0 20 20",
|
|
1720
|
+
fill: "currentColor",
|
|
1721
|
+
"aria-hidden": "true",
|
|
1722
|
+
"data-slot": "icon",
|
|
1723
|
+
ref: r,
|
|
1724
|
+
"aria-labelledby": t
|
|
1725
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1726
|
+
id: t
|
|
1727
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1728
|
+
fillRule: "evenodd",
|
|
1729
|
+
d: "M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm4.75 6.75a.75.75 0 0 1 1.5 0v2.546l.943-1.048a.75.75 0 0 1 1.114 1.004l-2.25 2.5a.75.75 0 0 1-1.114 0l-2.25-2.5a.75.75 0 1 1 1.114-1.004l.943 1.048V8.75Z",
|
|
1730
|
+
clipRule: "evenodd"
|
|
1731
|
+
}));
|
|
1732
|
+
}
|
|
1733
|
+
const Da = /* @__PURE__ */ E.forwardRef(Na), Pa = Object.freeze({ className: "aqmx-document-stage" }), Ia = ({ document: e }) => {
|
|
1734
|
+
const { labels: t } = $();
|
|
1735
|
+
return /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
|
|
1736
|
+
/* @__PURE__ */ c(Ue, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ c(Da, {}) }),
|
|
1737
|
+
/* @__PURE__ */ c(Be, { scrollerProps: Pa, children: /* @__PURE__ */ B("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
|
|
1738
|
+
/* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
|
|
1739
|
+
/* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
|
|
1740
|
+
] }) })
|
|
1741
|
+
] });
|
|
1742
|
+
}, st = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", $a = (e) => {
|
|
1743
|
+
const t = e.indexOf("#");
|
|
1744
|
+
return t === -1 ? "" : e.slice(t);
|
|
1745
|
+
}, _a = /(%[0-9A-Fa-f]{2})/u, Bt = (e) => {
|
|
1746
|
+
if (!e.startsWith("#") || e.length === 1) return null;
|
|
1747
|
+
const t = new TextEncoder(), n = e.slice(1).split(_a).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
|
|
1748
|
+
return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
|
|
1749
|
+
}, Er = (e) => `#${encodeURIComponent(e)}`, Fa = (e) => {
|
|
1750
|
+
if (e === "#") return !0;
|
|
1751
|
+
const t = Bt(e);
|
|
1752
|
+
return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
|
|
1753
|
+
}, Sr = (e, t) => {
|
|
1754
|
+
if (t === "") return null;
|
|
1755
|
+
for (const n of e.querySelectorAll("[id]"))
|
|
1756
|
+
if (n.id === t) return n;
|
|
1757
|
+
return null;
|
|
1758
|
+
}, qa = "http://www.w3.org/1999/xhtml", vn = (e, t) => {
|
|
1759
|
+
if (t === "") return null;
|
|
1760
|
+
const n = Sr(e, t);
|
|
1761
|
+
if (n !== null) return n;
|
|
1762
|
+
for (const r of e.querySelectorAll("a[name]"))
|
|
1763
|
+
if (r.localName === "a" && r.namespaceURI === qa && r.getAttribute("name") === t) return r;
|
|
1764
|
+
return null;
|
|
1765
|
+
}, xr = (e, t) => {
|
|
1766
|
+
if (e === null || !t.startsWith("#")) return null;
|
|
1767
|
+
const n = vn(e, t.slice(1));
|
|
1768
|
+
if (n !== null) return n;
|
|
1769
|
+
const r = Bt(t);
|
|
1770
|
+
return r === null ? null : vn(e, r);
|
|
1771
|
+
}, bn = (e) => {
|
|
1772
|
+
const { body: t, documentElement: n } = e.ownerDocument;
|
|
1773
|
+
if (e === t) {
|
|
1774
|
+
const o = getComputedStyle(n);
|
|
1775
|
+
if (o.overflowX === "visible" && o.overflowY === "visible") return !1;
|
|
1776
|
+
}
|
|
1777
|
+
const { overflowY: r } = getComputedStyle(e);
|
|
1778
|
+
return r === "auto" || r === "scroll";
|
|
1779
|
+
}, Ba = (e) => {
|
|
1780
|
+
const { body: t, documentElement: n } = e, r = getComputedStyle(n), o = r.overflowX === "visible" && r.overflowY === "visible" && t !== null ? getComputedStyle(t).overflowY : r.overflowY;
|
|
1781
|
+
return o !== "hidden" && o !== "clip";
|
|
1782
|
+
}, Ua = (e, t) => {
|
|
1783
|
+
const n = t.closest(st), r = n !== null && e.contains(n) ? n : e;
|
|
1784
|
+
if (r.scrollHeight > r.clientHeight && bn(r)) return r;
|
|
1785
|
+
const o = e.getBoundingClientRect().height, { documentElement: s, scrollingElement: a } = e.ownerDocument;
|
|
1786
|
+
for (let i = e.parentElement; i !== null && i !== s; i = i.parentElement)
|
|
1787
|
+
if (bn(i) && i.scrollHeight > i.clientHeight && i.clientHeight < o) return i;
|
|
1788
|
+
return a instanceof Element && Ba(e.ownerDocument) && a.scrollHeight > a.clientHeight && a.clientHeight < o ? a : r;
|
|
1789
|
+
}, Ha = Object.freeze({
|
|
1790
|
+
scrollerOf: Ua,
|
|
1791
|
+
reveal: (e) => {
|
|
1792
|
+
e.scrollIntoView(Mt);
|
|
1793
|
+
}
|
|
1794
|
+
}), Mt = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), za = (e, t) => {
|
|
1795
|
+
for (let n = t; n !== null && n !== e; n = n.parentElement) {
|
|
1796
|
+
const r = n.parentElement;
|
|
1797
|
+
if (r instanceof HTMLDetailsElement && n !== r.querySelector(":scope > summary") && (r.open = !0), n.getAttribute("hidden")?.toLowerCase() === "until-found") {
|
|
1798
|
+
if (n.dispatchEvent(new Event("beforematch", { bubbles: !0 })), !n.isConnected) return;
|
|
1799
|
+
n.removeAttribute("hidden");
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}, ja = (e, t) => {
|
|
1803
|
+
if (t.getClientRects().length === 0) return;
|
|
1804
|
+
const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), s = Number.parseFloat(r), a = t.getBoundingClientRect(), i = a.height + s + Number.parseFloat(o) > e.clientHeight;
|
|
1805
|
+
if (!i && Math.abs(a.top - s - n) < 1) {
|
|
1806
|
+
t.scrollIntoView(Mt);
|
|
1807
|
+
return;
|
|
1808
|
+
}
|
|
1809
|
+
e.scrollBy({ top: i ? a.top - n - e.clientHeight : a.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(Mt);
|
|
1810
|
+
}, Va = (e, t) => {
|
|
1811
|
+
const n = t.scrollerOf(e, e.querySelector(st) ?? e);
|
|
1812
|
+
n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
|
|
1813
|
+
}, yn = (e, t, n) => {
|
|
1814
|
+
if (e === null) return null;
|
|
1815
|
+
const r = xr(e, t);
|
|
1816
|
+
return r === null ? (Fa(t) && Va(e, n), null) : (za(e, r), ja(n.scrollerOf(e, r), r), n.reveal(r), r);
|
|
1817
|
+
};
|
|
1818
|
+
function Za({
|
|
1819
|
+
title: e,
|
|
1820
|
+
titleId: t,
|
|
1821
|
+
...n
|
|
1822
|
+
}, r) {
|
|
1823
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1824
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1825
|
+
viewBox: "0 0 20 20",
|
|
1826
|
+
fill: "currentColor",
|
|
1827
|
+
"aria-hidden": "true",
|
|
1828
|
+
"data-slot": "icon",
|
|
1829
|
+
ref: r,
|
|
1830
|
+
"aria-labelledby": t
|
|
1831
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1832
|
+
id: t
|
|
1833
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1834
|
+
d: "M3.28 2.22a.75.75 0 0 0-1.06 1.06L5.44 6.5H2.75a.75.75 0 0 0 0 1.5h4.5A.75.75 0 0 0 8 7.25v-4.5a.75.75 0 0 0-1.5 0v2.69L3.28 2.22ZM13.5 2.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-2.69l3.22-3.22a.75.75 0 0 0-1.06-1.06L13.5 5.44V2.75ZM3.28 17.78l3.22-3.22v2.69a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.69l-3.22 3.22a.75.75 0 1 0 1.06 1.06ZM13.5 14.56l3.22 3.22a.75.75 0 1 0 1.06-1.06l-3.22-3.22h2.69a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75v4.5a.75.75 0 0 0 1.5 0v-2.69Z"
|
|
1835
|
+
}));
|
|
1836
|
+
}
|
|
1837
|
+
const Wa = /* @__PURE__ */ E.forwardRef(Za);
|
|
1838
|
+
function Ga({
|
|
1839
|
+
title: e,
|
|
1840
|
+
titleId: t,
|
|
1841
|
+
...n
|
|
1842
|
+
}, r) {
|
|
1843
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1844
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1845
|
+
viewBox: "0 0 20 20",
|
|
1846
|
+
fill: "currentColor",
|
|
1847
|
+
"aria-hidden": "true",
|
|
1848
|
+
"data-slot": "icon",
|
|
1849
|
+
ref: r,
|
|
1850
|
+
"aria-labelledby": t
|
|
1851
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1852
|
+
id: t
|
|
1853
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1854
|
+
d: "M6.75 8.25a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z"
|
|
1855
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
1856
|
+
fillRule: "evenodd",
|
|
1857
|
+
d: "M9 2a7 7 0 1 0 4.391 12.452l3.329 3.328a.75.75 0 1 0 1.06-1.06l-3.328-3.329A7 7 0 0 0 9 2ZM3.5 9a5.5 5.5 0 1 1 11 0 5.5 5.5 0 0 1-11 0Z",
|
|
1858
|
+
clipRule: "evenodd"
|
|
1859
|
+
}));
|
|
1860
|
+
}
|
|
1861
|
+
const Ka = /* @__PURE__ */ E.forwardRef(Ga);
|
|
1862
|
+
function Ya({
|
|
1863
|
+
title: e,
|
|
1864
|
+
titleId: t,
|
|
1865
|
+
...n
|
|
1866
|
+
}, r) {
|
|
1867
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1868
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1869
|
+
viewBox: "0 0 20 20",
|
|
1870
|
+
fill: "currentColor",
|
|
1871
|
+
"aria-hidden": "true",
|
|
1872
|
+
"data-slot": "icon",
|
|
1873
|
+
ref: r,
|
|
1874
|
+
"aria-labelledby": t
|
|
1875
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1876
|
+
id: t
|
|
1877
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1878
|
+
d: "M9 6a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0v-1.5h-1.5a.75.75 0 0 1 0-1.5h1.5v-1.5A.75.75 0 0 1 9 6Z"
|
|
1879
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
1880
|
+
fillRule: "evenodd",
|
|
1881
|
+
d: "M2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Zm7-5.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11Z",
|
|
1882
|
+
clipRule: "evenodd"
|
|
1883
|
+
}));
|
|
1884
|
+
}
|
|
1885
|
+
const Xa = /* @__PURE__ */ E.forwardRef(Ya);
|
|
1886
|
+
function Ja({
|
|
1887
|
+
title: e,
|
|
1888
|
+
titleId: t,
|
|
1889
|
+
...n
|
|
1890
|
+
}, r) {
|
|
1891
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
1892
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1893
|
+
viewBox: "0 0 20 20",
|
|
1894
|
+
fill: "currentColor",
|
|
1895
|
+
"aria-hidden": "true",
|
|
1896
|
+
"data-slot": "icon",
|
|
1897
|
+
ref: r,
|
|
1898
|
+
"aria-labelledby": t
|
|
1899
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
1900
|
+
id: t
|
|
1901
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
1902
|
+
fillRule: "evenodd",
|
|
1903
|
+
d: "M1 5.25A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25v9.5A2.25 2.25 0 0 1 16.75 17H3.25A2.25 2.25 0 0 1 1 14.75v-9.5Zm1.5 5.81v3.69c0 .414.336.75.75.75h13.5a.75.75 0 0 0 .75-.75v-2.69l-2.22-2.219a.75.75 0 0 0-1.06 0l-1.91 1.909.47.47a.75.75 0 1 1-1.06 1.06L6.53 8.091a.75.75 0 0 0-1.06 0l-2.97 2.97ZM12 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",
|
|
1904
|
+
clipRule: "evenodd"
|
|
1905
|
+
}));
|
|
1906
|
+
}
|
|
1907
|
+
const Qa = /* @__PURE__ */ E.forwardRef(Ja), Lt = "data-aqmx-key-repeat", At = Object.freeze({ [Lt]: "allow" }), ei = `[${Lt}="${At[Lt]}"]`, ti = () => {
|
|
1908
|
+
let e = null;
|
|
1909
|
+
return {
|
|
1910
|
+
onKeyDownCapture: (t) => {
|
|
1911
|
+
if (t.key === "Enter") {
|
|
1912
|
+
if (!t.repeat) {
|
|
1913
|
+
e = t.target instanceof Element ? t.target : null;
|
|
1914
|
+
return;
|
|
1915
|
+
}
|
|
1916
|
+
e !== null && t.target === e && e.closest(ei) !== null || (t.preventDefault(), t.stopPropagation());
|
|
1917
|
+
}
|
|
1918
|
+
},
|
|
1919
|
+
onKeyUpCapture: (t) => {
|
|
1920
|
+
t.key === "Enter" && (e = null);
|
|
1921
|
+
},
|
|
1922
|
+
onBlurCapture: (t) => {
|
|
1923
|
+
t.target === e && (e = null);
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
}, Ke = Object.freeze([1 / Le ** 2, 1 / Le, 1, Le, Le ** 2]), kn = Object.freeze({ mode: "fit" }), ni = 1, Tr = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), En = `[data-testid="${Tr["data-testid"]}"]`, ri = ve(null), oi = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= ni ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, Sn = (e, t, n) => {
|
|
1927
|
+
if (e.mode === "level") {
|
|
1928
|
+
const o = e.index + n;
|
|
1929
|
+
return o >= 0 && o < Ke.length ? o : null;
|
|
1930
|
+
}
|
|
1931
|
+
if (t === null || !Number.isFinite(t) || t <= 0) return null;
|
|
1932
|
+
const r = n === 1 ? Ke.findIndex((o) => o > t) : Ke.findLastIndex((o) => o < t);
|
|
1933
|
+
return r === -1 ? null : r;
|
|
1934
|
+
}, xn = (e, t, n) => {
|
|
1935
|
+
if (e.mode === "level") {
|
|
1936
|
+
const o = Sn(e, null, n);
|
|
1937
|
+
return o === null ? null : { mode: "level", index: o, base: e.base };
|
|
1938
|
+
}
|
|
1939
|
+
if (t === null) return null;
|
|
1940
|
+
const r = Sn(e, t.scale, n);
|
|
1941
|
+
return r === null ? null : { mode: "level", index: r, base: t.base };
|
|
1942
|
+
}, si = (e, t) => {
|
|
1943
|
+
if (e <= 0 || t <= 0) return 0;
|
|
1944
|
+
const n = Math.trunc(Math.log(t / e) / Math.log(Le));
|
|
1945
|
+
return n === 0 ? 0 : n;
|
|
1946
|
+
}, Tn = (e) => {
|
|
1947
|
+
const t = e[0], n = e[1];
|
|
1948
|
+
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 } };
|
|
1949
|
+
}, ai = (e) => {
|
|
1950
|
+
const t = Ke[e];
|
|
1951
|
+
if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
|
|
1952
|
+
return t;
|
|
1953
|
+
}, Rn = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, ii = ({ document: e }) => {
|
|
1954
|
+
const { labels: t } = $(), n = se(ri), [r] = V(() => n === null ? null : n.read(e.url)), [o, s] = V(r === null ? kn : r.zoom), [a, i] = V(r === null ? null : r.reported), [f, u] = V(null), l = U(null), d = F((D) => {
|
|
1955
|
+
const { naturalWidth: m, naturalHeight: p } = D;
|
|
1956
|
+
i((x) => Rn(x, m, p));
|
|
1957
|
+
}, []), h = F(
|
|
1958
|
+
(D) => {
|
|
1959
|
+
l.current = D, !(D === null || !D.complete) && (D.naturalWidth > 0 || D.naturalHeight > 0 ? d(D) : D.decode().then(
|
|
1960
|
+
() => d(D),
|
|
1961
|
+
() => {
|
|
1962
|
+
}
|
|
1963
|
+
));
|
|
1964
|
+
},
|
|
1965
|
+
[d]
|
|
1966
|
+
);
|
|
1967
|
+
ee(() => {
|
|
1968
|
+
n !== null && a !== null && n.save(e.url, { zoom: o, reported: a });
|
|
1969
|
+
}, [n, e.url, o, a]), Y(() => {
|
|
1970
|
+
const D = l.current;
|
|
1971
|
+
if (D === null || a === null || o.mode !== "fit") return;
|
|
1972
|
+
const m = () => u((x) => Rn(x, D.clientWidth, D.clientHeight));
|
|
1973
|
+
if (m(), typeof ResizeObserver > "u") return;
|
|
1974
|
+
const p = new ResizeObserver(m);
|
|
1975
|
+
return p.observe(D), () => p.disconnect();
|
|
1976
|
+
}, [a, o.mode]);
|
|
1977
|
+
const g = a === null || f === null ? null : oi(a, f), v = xn(o, g, -1), y = xn(o, g, 1), T = o.mode === "level" ? ai(o.index) : null, C = U({ zoomIn: y, zoomOut: v });
|
|
1978
|
+
Y(() => {
|
|
1979
|
+
C.current = { zoomIn: y, zoomOut: v };
|
|
1980
|
+
});
|
|
1981
|
+
const R = U(null);
|
|
1982
|
+
Y(() => {
|
|
1983
|
+
const D = R.current, m = l.current?.closest(En);
|
|
1984
|
+
R.current = null, !(D === null || m === null || m === void 0) && (m.scrollLeft = D.across * m.scrollWidth - D.x, m.scrollTop = D.down * m.scrollHeight - D.y);
|
|
1985
|
+
}, [o]), ee(() => {
|
|
1986
|
+
const D = l.current?.closest(En);
|
|
1987
|
+
if (D == null) return;
|
|
1988
|
+
let m = null;
|
|
1989
|
+
const p = (I) => {
|
|
1990
|
+
const _ = Tn(I.touches);
|
|
1991
|
+
m = _ === null ? null : { distance: _.distance, steps: 0 };
|
|
1992
|
+
}, x = (I) => {
|
|
1993
|
+
const _ = Tn(I.touches);
|
|
1994
|
+
if (m === null || _ === null) return;
|
|
1995
|
+
I.preventDefault();
|
|
1996
|
+
const b = si(m.distance, _.distance);
|
|
1997
|
+
if (b === m.steps) return;
|
|
1998
|
+
const S = b > m.steps ? 1 : -1, M = S === 1 ? C.current.zoomIn : C.current.zoomOut;
|
|
1999
|
+
if (M === null) return;
|
|
2000
|
+
m.steps += S;
|
|
2001
|
+
const L = D.getBoundingClientRect(), P = _.middle.x - L.left, H = _.middle.y - L.top;
|
|
2002
|
+
R.current = D.scrollWidth > 0 && D.scrollHeight > 0 ? { x: P, y: H, across: (D.scrollLeft + P) / D.scrollWidth, down: (D.scrollTop + H) / D.scrollHeight } : null, s(M);
|
|
2003
|
+
}, A = (I) => {
|
|
2004
|
+
I.touches.length < 2 && (m = null);
|
|
2005
|
+
};
|
|
2006
|
+
return D.addEventListener("touchstart", p, { passive: !0 }), D.addEventListener("touchmove", x, { passive: !1 }), D.addEventListener("touchend", A, { passive: !0 }), D.addEventListener("touchcancel", A, { passive: !0 }), () => {
|
|
2007
|
+
D.removeEventListener("touchstart", p), D.removeEventListener("touchmove", x), D.removeEventListener("touchend", A), D.removeEventListener("touchcancel", A);
|
|
2008
|
+
};
|
|
2009
|
+
}, []);
|
|
2010
|
+
const q = o.mode === "level" && T !== null ? { width: `${o.base.width * T}px`, height: `${o.base.height * T}px` } : void 0;
|
|
2011
|
+
return /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
|
|
2012
|
+
/* @__PURE__ */ B(Ue, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ c(Qa, {}), children: [
|
|
2013
|
+
/* @__PURE__ */ c(
|
|
2014
|
+
"button",
|
|
2015
|
+
{
|
|
2016
|
+
type: "button",
|
|
2017
|
+
className: "aqmx-icon-button",
|
|
2018
|
+
"aria-label": t.imageZoomOut,
|
|
2019
|
+
title: t.imageZoomOut,
|
|
2020
|
+
"aria-disabled": v === null,
|
|
2021
|
+
onClick: () => {
|
|
2022
|
+
v !== null && s(v);
|
|
2023
|
+
},
|
|
2024
|
+
...At,
|
|
2025
|
+
children: /* @__PURE__ */ c(Ka, {})
|
|
2026
|
+
}
|
|
2027
|
+
),
|
|
2028
|
+
/* @__PURE__ */ c("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: T === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(T * 100)) }),
|
|
2029
|
+
/* @__PURE__ */ c(
|
|
2030
|
+
"button",
|
|
2031
|
+
{
|
|
2032
|
+
type: "button",
|
|
2033
|
+
className: "aqmx-icon-button",
|
|
2034
|
+
"aria-label": t.imageZoomIn,
|
|
2035
|
+
title: t.imageZoomIn,
|
|
2036
|
+
"aria-disabled": y === null,
|
|
2037
|
+
onClick: () => {
|
|
2038
|
+
y !== null && s(y);
|
|
2039
|
+
},
|
|
2040
|
+
...At,
|
|
2041
|
+
children: /* @__PURE__ */ c(Xa, {})
|
|
2042
|
+
}
|
|
2043
|
+
),
|
|
2044
|
+
/* @__PURE__ */ c("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => s(kn), children: /* @__PURE__ */ c(Wa, {}) })
|
|
2045
|
+
] }),
|
|
2046
|
+
/* @__PURE__ */ c(Be, { scrollerProps: Tr, children: /* @__PURE__ */ c("img", { ref: h, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: q, onLoad: (D) => d(D.currentTarget), "data-testid": "markdown-explorer-image" }) })
|
|
2047
|
+
] });
|
|
2048
|
+
}, li = async (e, t, n) => {
|
|
2049
|
+
const r = await e.text(t, n);
|
|
2050
|
+
if (!("kind" in r)) throw n.reason;
|
|
2051
|
+
return r.kind === "text" ? { kind: "text", text: r.text, truncated: r.truncated } : { kind: "failure", retryable: r.failure.reason === "failed" };
|
|
2052
|
+
}, Rr = ve(null), at = ve(void 0), Or = ve(null), it = () => {
|
|
2053
|
+
const e = se(Rr);
|
|
2054
|
+
if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
|
|
2055
|
+
return e;
|
|
2056
|
+
}, ci = () => {
|
|
2057
|
+
const e = se(Or);
|
|
2058
|
+
if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
|
|
2059
|
+
return e;
|
|
2060
|
+
}, lt = (e, t, n, r) => t.kind === "panel" ? Ne(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? Ne(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : Ne(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), di = ({ children: e }) => {
|
|
2061
|
+
const { config: t } = $(), n = it(), r = $t(), o = r.kind === "location" ? r.location.source : void 0, s = nt(lt(t, n.navigation, o, n.currentPath));
|
|
2062
|
+
return /* @__PURE__ */ c(at, { value: o, children: /* @__PURE__ */ c(Or, { value: s, children: e }) });
|
|
2063
|
+
}, ui = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', fi = (e) => {
|
|
2064
|
+
const t = e instanceof Element ? e.closest(ui) : null;
|
|
2065
|
+
return t === null ? null : t.getAttribute("data-doc-path");
|
|
2066
|
+
}, ct = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, mi = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: s, onDocumentLink: a, scope: i, children: f }) => {
|
|
2067
|
+
const u = nt(e);
|
|
2068
|
+
return /* @__PURE__ */ c("a", { ...s, href: u, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (d) => {
|
|
2069
|
+
if (ct(d)) {
|
|
2070
|
+
if (d.preventDefault(), t === i.currentPath && n !== "") {
|
|
2071
|
+
i.scrollWithin(n);
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
a(t, n);
|
|
2075
|
+
}
|
|
2076
|
+
}, children: f });
|
|
2077
|
+
}, hi = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: s }) => {
|
|
2078
|
+
const { config: a } = $(), i = it(), f = se(at), u = $a(e), { navigation: l } = i, d = `${lt(a, l, f, t)}${u}`, h = n === !1 ? "false" : void 0;
|
|
2079
|
+
return l.kind === "page" ? /* @__PURE__ */ c(ia, { ...o, to: d, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": h, children: s }) : /* @__PURE__ */ c(mi, { to: d, docPath: t, fragment: u, exists: h, className: r, attributes: o, onDocumentLink: l.onDocumentLink, scope: i, children: s });
|
|
2080
|
+
}, pi = ({ className: e, attributes: t, children: n }) => {
|
|
2081
|
+
const { labels: r } = $();
|
|
2082
|
+
return (
|
|
2083
|
+
/* @__PURE__ */ B("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: [
|
|
2084
|
+
n,
|
|
2085
|
+
/* @__PURE__ */ B("span", { className: "aqmx-sr-only", children: [
|
|
2086
|
+
" (",
|
|
2087
|
+
r.inertLink,
|
|
2088
|
+
")"
|
|
2089
|
+
] })
|
|
2090
|
+
] })
|
|
2091
|
+
);
|
|
2092
|
+
}, gi = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
|
|
2093
|
+
const { config: s } = $(), a = se(at), i = nt(`${lt(s, r.navigation, a, r.currentPath)}${e}`);
|
|
2094
|
+
return /* @__PURE__ */ c("a", { ...n, href: i, className: t, onClick: (u) => {
|
|
2095
|
+
ct(u) && (u.preventDefault(), r.scrollWithin(e));
|
|
2096
|
+
}, children: o });
|
|
2097
|
+
}, wi = ({ href: e, className: t, attributes: n, children: r }) => {
|
|
2098
|
+
const o = it();
|
|
2099
|
+
return o.navigation.kind === "page" ? /* @__PURE__ */ c("a", { ...n, href: e, className: t, onClick: (a) => {
|
|
2100
|
+
if (!ct(a)) return;
|
|
2101
|
+
const i = a.currentTarget;
|
|
2102
|
+
e === "#" ? o.followEmptyFragment(a.nativeEvent) : i.href === i.ownerDocument.URL && o.followSameUrlJump(e, a.nativeEvent);
|
|
2103
|
+
}, children: r }) : /* @__PURE__ */ c(gi, { href: e, className: t, attributes: n, scope: o, children: r });
|
|
2104
|
+
}, vi = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: s, children: a }) => t === "doc" ? n === void 0 || !Lo(n) ? /* @__PURE__ */ c(pi, { className: o, attributes: s, children: a }) : /* @__PURE__ */ c(hi, { href: e, docPath: n, docExists: r, className: o, attributes: s, children: a }) : e.startsWith("#") ? /* @__PURE__ */ c(wi, { href: e, className: o, attributes: s, children: a }) : /* @__PURE__ */ c("a", { ...s, href: e, className: o, children: a }), bi = () => {
|
|
2105
|
+
const { config: e } = $(), t = it(), n = se(at), r = ot();
|
|
2106
|
+
return F(
|
|
2107
|
+
(o, s) => {
|
|
2108
|
+
if (!ct(s)) return !0;
|
|
2109
|
+
s.preventDefault();
|
|
2110
|
+
const a = Er(o.id), { navigation: i } = t;
|
|
2111
|
+
return i.kind === "panel" || Bt(s.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(a), !0) : (r(`${lt(e, i, n, t.currentPath)}${a}`, "follow-link"), !0);
|
|
2112
|
+
},
|
|
2113
|
+
[e, t, n, r]
|
|
2114
|
+
);
|
|
2115
|
+
}, yi = () => {
|
|
2116
|
+
const e = ci();
|
|
2117
|
+
return F((t) => `${e}${Er(t.id)}`, [e]);
|
|
2118
|
+
};
|
|
2119
|
+
function ki({
|
|
2120
|
+
title: e,
|
|
2121
|
+
titleId: t,
|
|
2122
|
+
...n
|
|
2123
|
+
}, r) {
|
|
2124
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
2125
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2126
|
+
viewBox: "0 0 20 20",
|
|
2127
|
+
fill: "currentColor",
|
|
2128
|
+
"aria-hidden": "true",
|
|
2129
|
+
"data-slot": "icon",
|
|
2130
|
+
ref: r,
|
|
2131
|
+
"aria-labelledby": t
|
|
2132
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
2133
|
+
id: t
|
|
2134
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
2135
|
+
d: "M3 3.5A1.5 1.5 0 0 1 4.5 2h6.879a1.5 1.5 0 0 1 1.06.44l4.122 4.12A1.5 1.5 0 0 1 17 7.622V16.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 16.5v-13Z"
|
|
2136
|
+
}));
|
|
2137
|
+
}
|
|
2138
|
+
const Ei = /* @__PURE__ */ E.forwardRef(ki);
|
|
2139
|
+
function Si({
|
|
2140
|
+
title: e,
|
|
2141
|
+
titleId: t,
|
|
2142
|
+
...n
|
|
2143
|
+
}, r) {
|
|
2144
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
2145
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2146
|
+
viewBox: "0 0 20 20",
|
|
2147
|
+
fill: "currentColor",
|
|
2148
|
+
"aria-hidden": "true",
|
|
2149
|
+
"data-slot": "icon",
|
|
2150
|
+
ref: r,
|
|
2151
|
+
"aria-labelledby": t
|
|
2152
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
2153
|
+
id: t
|
|
2154
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
2155
|
+
fillRule: "evenodd",
|
|
2156
|
+
d: "M1 4.75C1 3.784 1.784 3 2.75 3h14.5c.966 0 1.75.784 1.75 1.75v10.515a1.75 1.75 0 0 1-1.75 1.75h-1.5c-.078 0-.155-.005-.23-.015H4.48c-.075.01-.152.015-.23.015h-1.5A1.75 1.75 0 0 1 1 15.265V4.75Zm16.5 7.385V11.01a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25Zm0 2.005a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .108.069.2.165.235h1.585a.25.25 0 0 0 .25-.25v-1.11Zm-15 1.11v-1.11a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.164.235H2.75a.25.25 0 0 1-.25-.25Zm2-4.24v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V11.01a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25Zm13-2.005V7.88a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25ZM4.25 7.63a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V7.88a.25.25 0 0 1 .25-.25h1.5Zm0-3.13a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5Zm11.5 1.625a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5Zm-9 3.125a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",
|
|
2157
|
+
clipRule: "evenodd"
|
|
2158
|
+
}));
|
|
2159
|
+
}
|
|
2160
|
+
const xi = /* @__PURE__ */ E.forwardRef(Si);
|
|
2161
|
+
function Ti({
|
|
2162
|
+
title: e,
|
|
2163
|
+
titleId: t,
|
|
2164
|
+
...n
|
|
2165
|
+
}, r) {
|
|
2166
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
2167
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2168
|
+
viewBox: "0 0 20 20",
|
|
2169
|
+
fill: "currentColor",
|
|
2170
|
+
"aria-hidden": "true",
|
|
2171
|
+
"data-slot": "icon",
|
|
2172
|
+
ref: r,
|
|
2173
|
+
"aria-labelledby": t
|
|
2174
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
2175
|
+
id: t
|
|
2176
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
2177
|
+
fillRule: "evenodd",
|
|
2178
|
+
d: "M17.721 1.599a.75.75 0 0 1 .279.583v11.29a2.25 2.25 0 0 1-1.774 2.2l-2.041.44a2.216 2.216 0 0 1-.938-4.332l2.662-.577a.75.75 0 0 0 .591-.733V6.112l-8 1.73v7.684a2.25 2.25 0 0 1-1.774 2.2l-2.042.44a2.216 2.216 0 1 1-.935-4.331l2.659-.573A.75.75 0 0 0 7 12.529V4.236a.75.75 0 0 1 .591-.733l9.5-2.054a.75.75 0 0 1 .63.15Z",
|
|
2179
|
+
clipRule: "evenodd"
|
|
2180
|
+
}));
|
|
2181
|
+
}
|
|
2182
|
+
const Ri = /* @__PURE__ */ E.forwardRef(Ti), Oi = Object.freeze({ className: "aqmx-document-stage" }), Ci = () => () => {
|
|
2183
|
+
}, Mi = () => navigator.pdfViewerEnabled !== !1, Li = () => null, Ai = ({ document: e }) => {
|
|
2184
|
+
const { labels: t } = $(), n = oe(Ci, Mi, Li);
|
|
2185
|
+
return n === null ? null : n ? /* @__PURE__ */ c("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" }) : /* @__PURE__ */ B("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-pdf-not-shown", children: [
|
|
2186
|
+
/* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: t.pdfNotShown }),
|
|
2187
|
+
/* @__PURE__ */ B("div", { className: "aqmx-callout-actions", children: [
|
|
2188
|
+
/* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, target: "_blank", rel: "noopener noreferrer", "data-testid": "markdown-explorer-pdf-not-shown-open", children: t.openInNewTab }),
|
|
2189
|
+
/* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-pdf-not-shown-download", children: t.download })
|
|
2190
|
+
] })
|
|
2191
|
+
] });
|
|
2192
|
+
}, Ni = (e) => {
|
|
2193
|
+
switch (e) {
|
|
2194
|
+
case "video":
|
|
2195
|
+
return /* @__PURE__ */ c(xi, {});
|
|
2196
|
+
case "audio":
|
|
2197
|
+
return /* @__PURE__ */ c(Ri, {});
|
|
2198
|
+
case "pdf":
|
|
2199
|
+
return /* @__PURE__ */ c(Ei, {});
|
|
2200
|
+
default: {
|
|
2201
|
+
const t = e;
|
|
2202
|
+
throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`);
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
}, Di = ({ document: e }) => {
|
|
2206
|
+
const { labels: t } = $();
|
|
2207
|
+
switch (e.mediaType) {
|
|
2208
|
+
case "video":
|
|
2209
|
+
return (
|
|
2210
|
+
/* @__PURE__ */ c("video", { className: "aqmx-document-video", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
|
|
2211
|
+
);
|
|
2212
|
+
case "audio":
|
|
2213
|
+
return (
|
|
2214
|
+
/* @__PURE__ */ c("audio", { className: "aqmx-document-audio", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
|
|
2215
|
+
);
|
|
2216
|
+
case "pdf":
|
|
2217
|
+
return /* @__PURE__ */ c(Ai, { document: e });
|
|
2218
|
+
default: {
|
|
2219
|
+
const n = e.mediaType;
|
|
2220
|
+
throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}, Pi = ({ document: e }) => /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
|
|
2224
|
+
/* @__PURE__ */ c(Ue, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: Ni(e.mediaType) }),
|
|
2225
|
+
/* @__PURE__ */ c(Be, { scrollerProps: Oi, children: /* @__PURE__ */ c(Di, { document: e }) })
|
|
2226
|
+
] }), Ut = (e) => {
|
|
2227
|
+
switch (e.kind) {
|
|
2228
|
+
case "markdown":
|
|
2229
|
+
return "markdown";
|
|
2230
|
+
case "image":
|
|
2231
|
+
return e.imageType === "svg" ? "svg" : null;
|
|
2232
|
+
case "spreadsheet":
|
|
2233
|
+
return e.format === "workbook" ? null : e.format;
|
|
2234
|
+
default:
|
|
2235
|
+
return null;
|
|
2236
|
+
}
|
|
2237
|
+
}, Ii = (e) => {
|
|
2238
|
+
const { documents: t } = $(), n = F(() => t.peek(e), [t, e]), r = F(() => t.peekSeeded(e), [t, e]), o = oe(t.subscribe, n, r), s = ge(o);
|
|
2239
|
+
return s === null ? null : Ut(s.document);
|
|
2240
|
+
}, $i = (e) => {
|
|
2241
|
+
const { config: t } = $(), n = ot(), r = F(() => n(Ne(t, { ...e, markup: !e.markup }), "browse"), [t, n, e]);
|
|
2242
|
+
return X(() => ({ shown: e.markup, toggle: r }), [e.markup, r]);
|
|
2243
|
+
};
|
|
2244
|
+
function _i({
|
|
2245
|
+
title: e,
|
|
2246
|
+
titleId: t,
|
|
2247
|
+
...n
|
|
2248
|
+
}, r) {
|
|
2249
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
2250
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2251
|
+
viewBox: "0 0 20 20",
|
|
2252
|
+
fill: "currentColor",
|
|
2253
|
+
"aria-hidden": "true",
|
|
2254
|
+
"data-slot": "icon",
|
|
2255
|
+
ref: r,
|
|
2256
|
+
"aria-labelledby": t
|
|
2257
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
2258
|
+
id: t
|
|
2259
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
2260
|
+
fillRule: "evenodd",
|
|
2261
|
+
d: "M.99 5.24A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25l.01 9.5A2.25 2.25 0 0 1 16.76 17H3.26A2.267 2.267 0 0 1 1 14.74l-.01-9.5Zm8.26 9.52v-.625a.75.75 0 0 0-.75-.75H3.25a.75.75 0 0 0-.75.75v.615c0 .414.336.75.75.75h5.373a.75.75 0 0 0 .627-.74Zm1.5 0a.75.75 0 0 0 .627.74h5.373a.75.75 0 0 0 .75-.75v-.615a.75.75 0 0 0-.75-.75H11.5a.75.75 0 0 0-.75.75v.625Zm6.75-3.63v-.625a.75.75 0 0 0-.75-.75H11.5a.75.75 0 0 0-.75.75v.625c0 .414.336.75.75.75h5.25a.75.75 0 0 0 .75-.75Zm-8.25 0v-.625a.75.75 0 0 0-.75-.75H3.25a.75.75 0 0 0-.75.75v.625c0 .414.336.75.75.75H8.5a.75.75 0 0 0 .75-.75ZM17.5 7.5v-.625a.75.75 0 0 0-.75-.75H11.5a.75.75 0 0 0-.75.75V7.5c0 .414.336.75.75.75h5.25a.75.75 0 0 0 .75-.75Zm-8.25 0v-.625a.75.75 0 0 0-.75-.75H3.25a.75.75 0 0 0-.75.75V7.5c0 .414.336.75.75.75H8.5a.75.75 0 0 0 .75-.75Z",
|
|
2262
|
+
clipRule: "evenodd"
|
|
2263
|
+
}));
|
|
2264
|
+
}
|
|
2265
|
+
const Fi = /* @__PURE__ */ E.forwardRef(_i), qi = 100, Bi = 32767, Ye = Object.freeze({ maxCells: an, maxColumns: an / qi, maxCellLength: Bi }), Cr = 44, Mr = 10, Lr = 13, Ze = '"', On = (e, t) => {
|
|
2266
|
+
let n = t;
|
|
2267
|
+
for (; n < e.length; ) {
|
|
2268
|
+
const r = e.charCodeAt(n);
|
|
2269
|
+
if (r === Cr || r === Mr || r === Lr) return n;
|
|
2270
|
+
n += 1;
|
|
2271
|
+
}
|
|
2272
|
+
return n;
|
|
2273
|
+
};
|
|
2274
|
+
function* Ui(e, t) {
|
|
2275
|
+
let n = [], r = 0;
|
|
2276
|
+
for (; ; ) {
|
|
2277
|
+
let o;
|
|
2278
|
+
if (e.startsWith(Ze, r)) {
|
|
2279
|
+
o = "";
|
|
2280
|
+
let a = r + 1;
|
|
2281
|
+
for (; ; ) {
|
|
2282
|
+
const f = e.indexOf(Ze, a);
|
|
2283
|
+
if (f < 0) {
|
|
2284
|
+
o += e.slice(a), r = e.length;
|
|
2285
|
+
break;
|
|
2286
|
+
}
|
|
2287
|
+
if (o += e.slice(a, f), e.startsWith(Ze, f + 1)) {
|
|
2288
|
+
o += Ze, a = f + 2;
|
|
2289
|
+
continue;
|
|
2290
|
+
}
|
|
2291
|
+
r = f + 1;
|
|
2292
|
+
break;
|
|
2293
|
+
}
|
|
2294
|
+
const i = On(e, r);
|
|
2295
|
+
o += e.slice(r, i), r = i;
|
|
2296
|
+
} else {
|
|
2297
|
+
const a = On(e, r);
|
|
2298
|
+
o = e.slice(r, a), r = a;
|
|
2299
|
+
}
|
|
2300
|
+
if (n.push(o), r >= e.length) {
|
|
2301
|
+
t === "whole" && (yield n);
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
const s = e.charCodeAt(r);
|
|
2305
|
+
if (r += 1, s !== Cr && (yield n, n = [], s === Lr && e.charCodeAt(r) === Mr && (r += 1), r >= e.length))
|
|
2306
|
+
return;
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
const Hi = (e, t, n) => t === "csv" ? Ui(e, n) : n === "whole" ? Xo(e) : Jo(e), zi = (e, t) => {
|
|
2310
|
+
if (e.length <= t) return e;
|
|
2311
|
+
const n = e.charCodeAt(t - 1);
|
|
2312
|
+
return e.slice(0, n >= 55296 && n <= 56319 ? t - 1 : t);
|
|
2313
|
+
}, Ar = (e, t) => {
|
|
2314
|
+
const n = [];
|
|
2315
|
+
let r = 0, o = !1, s = !1;
|
|
2316
|
+
for (const i of e) {
|
|
2317
|
+
const f = i.length > t.maxColumns ? i.slice(0, t.maxColumns) : i, u = Math.max(r, f.length);
|
|
2318
|
+
if ((n.length + 1) * u > t.maxCells) {
|
|
2319
|
+
s = !0;
|
|
2320
|
+
break;
|
|
2321
|
+
}
|
|
2322
|
+
const l = f.some((d) => d.length > t.maxCellLength) ? f.map((d) => zi(d, t.maxCellLength)) : f;
|
|
2323
|
+
l !== i && (o = !0), n.push(l), r = u;
|
|
2324
|
+
}
|
|
2325
|
+
return { rows: n.map((i) => i.length === r ? i : [...i, ...Array(r - i.length).fill("")]), truncated: s || o, full: s };
|
|
2326
|
+
}, wt = (e, t, n, r, o) => {
|
|
2327
|
+
const s = Eo(e, t, r);
|
|
2328
|
+
if (s === null) return { kind: "unreadable", code: "encoding", encodings: So(e, t, r) };
|
|
2329
|
+
if (s.includes("\0")) return { kind: "unreadable", code: "binary" };
|
|
2330
|
+
const a = Ar(Hi(s, n, t ? "whole" : "prefix"), o);
|
|
2331
|
+
return t ? a.truncated || a.rows.some((i) => i.some((f) => f !== "")) ? { kind: "table", table: a } : { kind: "empty" } : a.rows.length === 0 ? { kind: "unreadable", code: "long-row" } : { kind: "table", table: { ...a, truncated: !0 } };
|
|
2332
|
+
}, ji = Object.freeze({ maxPartBytes: 64 * 1024 * 1024, maxSheets: 256 }), Nr = (e) => {
|
|
2333
|
+
const t = [];
|
|
2334
|
+
let n = 0, r = !1;
|
|
2335
|
+
const o = (s) => {
|
|
2336
|
+
if (r) return;
|
|
2337
|
+
const a = Math.max(n, Math.min(s.length, e.maxColumns));
|
|
2338
|
+
(t.length + 1) * a > e.maxCells && (r = !0), t.push(s), n = a;
|
|
2339
|
+
};
|
|
2340
|
+
return {
|
|
2341
|
+
addRow: (s, a, i) => {
|
|
2342
|
+
if (a.size === 0 || r) return;
|
|
2343
|
+
let f = -1;
|
|
2344
|
+
for (const d of a.keys()) d > f && (f = d);
|
|
2345
|
+
const u = Array(Math.min(f, e.maxColumns) + 1).fill("");
|
|
2346
|
+
for (const [d, h] of a) d <= e.maxColumns && (u[d] = h);
|
|
2347
|
+
const l = Math.min(u.length, e.maxColumns);
|
|
2348
|
+
if (n === 0 && (s + 1) * l > e.maxCells) {
|
|
2349
|
+
const d = Math.floor(e.maxCells / l);
|
|
2350
|
+
for (; t.length < d; ) t.push([]);
|
|
2351
|
+
o(u);
|
|
2352
|
+
return;
|
|
2353
|
+
}
|
|
2354
|
+
for (; t.length < s && !r; ) o([]);
|
|
2355
|
+
for (let d = 0; d < i && !r; d += 1) o(d === 0 ? u : [...u]);
|
|
2356
|
+
},
|
|
2357
|
+
full: () => r,
|
|
2358
|
+
table: () => Ar(t, e)
|
|
2359
|
+
};
|
|
2360
|
+
}, Vi = (e) => {
|
|
2361
|
+
const t = Array.from(e.currentTarget.querySelectorAll('[role="tab"]')), n = e.target instanceof HTMLButtonElement ? t.indexOf(e.target) : -1;
|
|
2362
|
+
if (n === -1) return;
|
|
2363
|
+
const r = getComputedStyle(e.currentTarget).direction === "rtl" ? "ArrowRight" : "ArrowLeft", o = r === "ArrowLeft" ? "ArrowRight" : "ArrowLeft", s = e.key === o ? (n + 1) % t.length : e.key === r ? (n - 1 + t.length) % t.length : e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : null;
|
|
2364
|
+
s !== null && (e.preventDefault(), t[s]?.focus());
|
|
2365
|
+
}, Zi = ({ names: e, selected: t, onSelect: n, label: r, tabIdOf: o, panelId: s }) => /* @__PURE__ */ c("div", { role: "tablist", "aria-label": r, className: "aqmx-sheet-tabs", "data-testid": "markdown-explorer-spreadsheet-sheets", onKeyDown: Vi, children: e.map((a, i) => /* @__PURE__ */ c(
|
|
2366
|
+
"button",
|
|
2367
|
+
{
|
|
2368
|
+
type: "button",
|
|
2369
|
+
role: "tab",
|
|
2370
|
+
id: o(i),
|
|
2371
|
+
"aria-selected": i === t,
|
|
2372
|
+
"aria-controls": s,
|
|
2373
|
+
tabIndex: i === t ? 0 : -1,
|
|
2374
|
+
className: "aqmx-sheet-tab",
|
|
2375
|
+
"data-aqmx-sheet-tab": i,
|
|
2376
|
+
onClick: () => n(i),
|
|
2377
|
+
children: a
|
|
2378
|
+
},
|
|
2379
|
+
i
|
|
2380
|
+
)) }), Dr = 64 * 1024, Wi = (e) => {
|
|
2381
|
+
let t = new Uint8Array(Math.min(e, Dr)), n = 0;
|
|
2382
|
+
return {
|
|
2383
|
+
append: (r) => {
|
|
2384
|
+
if (n + r.byteLength > t.byteLength) {
|
|
2385
|
+
const o = new Uint8Array(Math.min(e, Math.max(t.byteLength * 2, n + r.byteLength)));
|
|
2386
|
+
o.set(t.subarray(0, n)), t = o;
|
|
2387
|
+
}
|
|
2388
|
+
t.set(r, n), n += r.byteLength;
|
|
2389
|
+
},
|
|
2390
|
+
bytes: () => t.subarray(0, n),
|
|
2391
|
+
length: () => n
|
|
2392
|
+
};
|
|
2393
|
+
}, Gi = async (e) => {
|
|
2394
|
+
for (; ; ) {
|
|
2395
|
+
const { done: t, value: n } = await e.read();
|
|
2396
|
+
if (t) return !0;
|
|
2397
|
+
if (n.byteLength > 0) return !1;
|
|
2398
|
+
}
|
|
2399
|
+
}, Ki = async (e, t) => {
|
|
2400
|
+
const { format: n, legacyEncoding: r, maxBytes: o, budget: s } = t, a = e.getReader(), i = Wi(o);
|
|
2401
|
+
let f = Dr;
|
|
2402
|
+
try {
|
|
2403
|
+
for (; ; ) {
|
|
2404
|
+
const { done: u, value: l } = await a.read();
|
|
2405
|
+
if (u) return wt(i.bytes(), !0, n, r, s);
|
|
2406
|
+
const d = o - i.length();
|
|
2407
|
+
if (i.append(l.byteLength > d ? l.subarray(0, d) : l), i.length() === o) {
|
|
2408
|
+
const g = l.byteLength <= d && await Gi(a);
|
|
2409
|
+
return wt(i.bytes(), g, n, r, s);
|
|
2410
|
+
}
|
|
2411
|
+
if (i.length() < f) continue;
|
|
2412
|
+
f = i.length() * 2;
|
|
2413
|
+
const h = wt(i.bytes(), !1, n, r, s);
|
|
2414
|
+
if (h.kind === "unreadable" && h.code !== "long-row" || h.kind === "table" && h.table.full) return h;
|
|
2415
|
+
}
|
|
2416
|
+
} finally {
|
|
2417
|
+
a.cancel().catch(() => {
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
}, Pr = async (e, t, n, r) => {
|
|
2421
|
+
const o = await e.asset(rt(t), r);
|
|
2422
|
+
if (o.status === "cancelled") return null;
|
|
2423
|
+
if (o.status === "error") return { kind: "failure", failure: o.failure };
|
|
2424
|
+
let s;
|
|
2425
|
+
try {
|
|
2426
|
+
s = await Ki(o.body, n);
|
|
2427
|
+
} catch {
|
|
2428
|
+
return r.aborted ? null : { kind: "failure", failure: { reason: "failed" } };
|
|
2429
|
+
}
|
|
2430
|
+
return r.aborted ? null : s.kind === "table" ? { kind: "table", rows: s.table.rows, truncated: s.table.truncated } : s;
|
|
2431
|
+
}, Ht = (e, t, n) => {
|
|
2432
|
+
const { documents: r, labels: o } = $(), s = Oa(), a = F(() => r.answerStampOf(e), [r, e]), i = oe(r.subscribe, a, a), [f, u] = V(0), l = X(() => ({ read: n, stamp: i, attempt: f }), [n, i, f]), [d, h] = V({ settled: null, shown: null, failure: null }), g = U(null), v = le((C, R) => {
|
|
2433
|
+
if (g.current?.settle(R.stamp, C.kind === "failure" ? C.failure : null), C.kind === "read") {
|
|
2434
|
+
h({ settled: R, shown: C.value, failure: null });
|
|
2435
|
+
return;
|
|
2436
|
+
}
|
|
2437
|
+
if (d.shown !== null) {
|
|
2438
|
+
h({ settled: R, shown: d.shown, failure: null });
|
|
2439
|
+
return;
|
|
2440
|
+
}
|
|
2441
|
+
h({ settled: R, shown: null, failure: C.failure }), s.announceFailure(o.documentFailed(t, de(o, C.failure.reason)));
|
|
2442
|
+
});
|
|
2443
|
+
ee(() => {
|
|
2444
|
+
const C = s.readPart();
|
|
2445
|
+
return g.current = C, () => {
|
|
2446
|
+
g.current = null, C.release();
|
|
2447
|
+
};
|
|
2448
|
+
}, [s]), ee(() => {
|
|
2449
|
+
const C = new AbortController();
|
|
2450
|
+
return l.read(C.signal).then((R) => {
|
|
2451
|
+
R !== null && !C.signal.aborted && v(R, l);
|
|
2452
|
+
}), () => C.abort();
|
|
2453
|
+
}, [l]);
|
|
2454
|
+
const y = d.settled !== l && (d.shown !== null || d.failure !== null);
|
|
2455
|
+
Y(() => y ? s.holdBusy() : void 0, [y, s]);
|
|
2456
|
+
const T = F(() => u((C) => C + 1), []);
|
|
2457
|
+
return { shown: d.shown, failure: d.failure, retry: T };
|
|
2458
|
+
}, Ir = (e, t) => {
|
|
2459
|
+
const n = {};
|
|
2460
|
+
for (const r of Object.keys(Xe[t])) {
|
|
2461
|
+
const o = e[It(r)];
|
|
2462
|
+
o !== Xe[t][r].text && (n[r] = o);
|
|
2463
|
+
}
|
|
2464
|
+
return n;
|
|
2465
|
+
}, Yi = (e, t) => Object.fromEntries(Object.entries(Ir(e, t)).map(([n, r]) => [`spreadsheet${n.charAt(0).toUpperCase()}${n.slice(1)}`, r])), Xi = (e, t) => ({
|
|
2466
|
+
...Yi(e, t),
|
|
2467
|
+
loading: e.viewerLoading,
|
|
2468
|
+
errorPrefix: e.viewerErrorPrefix,
|
|
2469
|
+
styleTitle: e.viewerStyleTitle,
|
|
2470
|
+
selectStyleAria: e.viewerSelectStyle,
|
|
2471
|
+
pinStyleAria: e.viewerPinStyle,
|
|
2472
|
+
unpinStyleAria: e.viewerUnpinStyle,
|
|
2473
|
+
defaultErrorTitle: e.viewerErrorTitle,
|
|
2474
|
+
missingImage: e.viewerMissingImage,
|
|
2475
|
+
openTocAria: e.viewerOpenToc,
|
|
2476
|
+
tocTitle: e.viewerTocTitle,
|
|
2477
|
+
pinTocAria: e.viewerPinToc,
|
|
2478
|
+
unpinTocAria: e.viewerUnpinToc,
|
|
2479
|
+
selectAlignAria: e.viewerSelectAlign,
|
|
2480
|
+
alignTitle: e.viewerAlignTitle,
|
|
2481
|
+
pinAlignAria: e.viewerPinAlign,
|
|
2482
|
+
unpinAlignAria: e.viewerUnpinAlign,
|
|
2483
|
+
alignLeft: e.viewerAlignLeft,
|
|
2484
|
+
alignCenter: e.viewerAlignCenter,
|
|
2485
|
+
alignRight: e.viewerAlignRight,
|
|
2486
|
+
mermaidInteractionMode: e.viewerMermaidInteractionMode,
|
|
2487
|
+
mermaidInteractionModeTouch: e.viewerMermaidInteractionModeTouch,
|
|
2488
|
+
mermaidModeNone: e.viewerMermaidModeNone,
|
|
2489
|
+
mermaidModeZoom: e.viewerMermaidModeZoom,
|
|
2490
|
+
mermaidModePan: e.viewerMermaidModePan,
|
|
2491
|
+
mermaidModePanShift: e.viewerMermaidModePanShift,
|
|
2492
|
+
mermaidModeBoth: e.viewerMermaidModeBoth,
|
|
2493
|
+
mermaidModeBothShift: e.viewerMermaidModeBothShift,
|
|
2494
|
+
mermaidModeNoneTouch: e.viewerMermaidModeNoneTouch,
|
|
2495
|
+
mermaidModeZoomTouch: e.viewerMermaidModeZoomTouch,
|
|
2496
|
+
mermaidModePanTouch: e.viewerMermaidModePanTouch,
|
|
2497
|
+
mermaidModeBothTouch: e.viewerMermaidModeBothTouch,
|
|
2498
|
+
mermaidZoomIn: e.viewerMermaidZoomIn,
|
|
2499
|
+
mermaidZoomOut: e.viewerMermaidZoomOut,
|
|
2500
|
+
mermaidResetView: e.viewerMermaidResetView,
|
|
2501
|
+
mermaidPanUp: e.viewerMermaidPanUp,
|
|
2502
|
+
mermaidPanDown: e.viewerMermaidPanDown,
|
|
2503
|
+
mermaidPanLeft: e.viewerMermaidPanLeft,
|
|
2504
|
+
mermaidPanRight: e.viewerMermaidPanRight,
|
|
2505
|
+
mermaidDiagram: e.viewerMermaidDiagram,
|
|
2506
|
+
mermaidRetry: e.viewerMermaidRetry,
|
|
2507
|
+
embeddedVideo: e.viewerEmbeddedVideo,
|
|
2508
|
+
embeddedPost: e.viewerEmbeddedPost,
|
|
2509
|
+
embeddedFrame: e.viewerEmbeddedFrame,
|
|
2510
|
+
blockFailed: e.viewerBlockFailed,
|
|
2511
|
+
svgImageToolbar: e.viewerSvgImageToolbar,
|
|
2512
|
+
svgImageSource: e.viewerSvgImageSource,
|
|
2513
|
+
svgImageSourceRegion: e.viewerSvgImageSourceRegion,
|
|
2514
|
+
svgImageLoading: e.viewerSvgImageLoading,
|
|
2515
|
+
svgImageFailed: e.viewerSvgImageFailed,
|
|
2516
|
+
svgImageRetry: e.viewerSvgImageRetry,
|
|
2517
|
+
svgImageTruncated: e.viewerSvgImageTruncated,
|
|
2518
|
+
svgImageCopy: e.viewerSvgImageCopy,
|
|
2519
|
+
svgImageCopied: e.viewerSvgImageCopied,
|
|
2520
|
+
svgImageCopyFailed: e.viewerSvgImageCopyFailed,
|
|
2521
|
+
svgImageCopyImage: e.viewerSvgImageCopyImage,
|
|
2522
|
+
svgImageCopiedImage: e.viewerSvgImageCopiedImage,
|
|
2523
|
+
svgImageCopyImageFailed: e.viewerSvgImageCopyImageFailed
|
|
2524
|
+
}), $r = (e, t, n) => {
|
|
2525
|
+
if (t !== void 0) return t;
|
|
2526
|
+
if (n !== void 0) return n;
|
|
2527
|
+
const [r] = e.documentStyles;
|
|
2528
|
+
if (r === void 0) throw new Error("[markdown-explorer] the configuration has no document style");
|
|
2529
|
+
return r.name;
|
|
2530
|
+
}, _r = (e, t) => e !== void 0 ? e : t !== void 0 ? t : es;
|
|
2531
|
+
class ne extends Error {
|
|
2532
|
+
refusal;
|
|
2533
|
+
constructor(t, n) {
|
|
2534
|
+
super(n), this.name = "WorkbookError", this.refusal = t;
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
const Ji = /* @__PURE__ */ new Map([
|
|
2538
|
+
["lt", "<"],
|
|
2539
|
+
["gt", ">"],
|
|
2540
|
+
["amp", "&"],
|
|
2541
|
+
["quot", '"'],
|
|
2542
|
+
["apos", "'"]
|
|
2543
|
+
]), Qi = /&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z_][A-Za-z0-9._-]*);/gu, el = /([^\s=/>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gu, tl = /^[^\s/>]+/u, Se = (e) => {
|
|
2544
|
+
throw new ne("not-workbook", `the XML ${e}`);
|
|
2545
|
+
}, Cn = (e) => Number.isInteger(e) && e >= 0 && e <= 1114111 ? String.fromCodePoint(e) : Se(`refers to the code point ${e}`), Fr = (e) => e.includes("&") ? e.replace(Qi, (t, n) => n.startsWith("#x") ? Cn(Number.parseInt(n.slice(2), 16)) : n.startsWith("#") ? Cn(Number.parseInt(n.slice(1), 10)) : Ji.get(n) ?? Se(`names the undeclared entity ${t}`)) : e, Nt = (e) => e.slice(e.indexOf(":") + 1), nl = (e, t) => {
|
|
2546
|
+
let n = "";
|
|
2547
|
+
for (let r = t; r < e.length; r += 1) {
|
|
2548
|
+
const o = e[r];
|
|
2549
|
+
if (n !== "")
|
|
2550
|
+
o === n && (n = "");
|
|
2551
|
+
else if (o === '"' || o === "'")
|
|
2552
|
+
n = o;
|
|
2553
|
+
else if (o === ">")
|
|
2554
|
+
return r;
|
|
2555
|
+
}
|
|
2556
|
+
return -1;
|
|
2557
|
+
}, rl = (e) => {
|
|
2558
|
+
const t = /* @__PURE__ */ new Map();
|
|
2559
|
+
for (const n of e.matchAll(el)) t.set(Nt(n[1] ?? ""), Fr(n[2] ?? n[3] ?? ""));
|
|
2560
|
+
return t;
|
|
2561
|
+
}, qr = (e, t) => {
|
|
2562
|
+
let n = "";
|
|
2563
|
+
const r = () => {
|
|
2564
|
+
let o = 0;
|
|
2565
|
+
for (; !t(); ) {
|
|
2566
|
+
const s = n.indexOf("<", o);
|
|
2567
|
+
if (s === -1) break;
|
|
2568
|
+
if (s > o && (e.text?.(Fr(n.slice(o, s))), o = s), n.startsWith("<!--", s)) {
|
|
2569
|
+
const u = n.indexOf("-->", s + 4);
|
|
2570
|
+
if (u === -1) break;
|
|
2571
|
+
o = u + 3;
|
|
2572
|
+
continue;
|
|
2573
|
+
}
|
|
2574
|
+
if (n.startsWith("<![CDATA[", s)) {
|
|
2575
|
+
const u = n.indexOf("]]>", s + 9);
|
|
2576
|
+
if (u === -1) break;
|
|
2577
|
+
e.text?.(n.slice(s + 9, u)), o = u + 3;
|
|
2578
|
+
continue;
|
|
2579
|
+
}
|
|
2580
|
+
const a = n.slice(s);
|
|
2581
|
+
if (a.length < 9 && ("<!--".startsWith(a) || "<![CDATA[".startsWith(a))) break;
|
|
2582
|
+
if (n.startsWith("<!", s) && Se("declares a document type or another declaration"), n.startsWith("<?", s)) {
|
|
2583
|
+
const u = n.indexOf("?>", s + 2);
|
|
2584
|
+
if (u === -1) break;
|
|
2585
|
+
o = u + 2;
|
|
2586
|
+
continue;
|
|
2587
|
+
}
|
|
2588
|
+
const i = nl(n, s + 1);
|
|
2589
|
+
if (i === -1) break;
|
|
2590
|
+
const f = n.slice(s + 1, i);
|
|
2591
|
+
if (f.startsWith("/"))
|
|
2592
|
+
e.end?.(Nt(f.slice(1).trim()));
|
|
2593
|
+
else {
|
|
2594
|
+
const u = f.endsWith("/"), l = u ? f.slice(0, -1) : f, d = tl.exec(l)?.[0] ?? Se("has a tag without a name"), h = Nt(d);
|
|
2595
|
+
e.start?.(h, rl(l.slice(d.length)), u), u && e.end?.(h);
|
|
2596
|
+
}
|
|
2597
|
+
o = i + 1;
|
|
2598
|
+
}
|
|
2599
|
+
n = n.slice(o);
|
|
2600
|
+
};
|
|
2601
|
+
return {
|
|
2602
|
+
write: (o) => {
|
|
2603
|
+
n += o, r();
|
|
2604
|
+
},
|
|
2605
|
+
finish: () => {
|
|
2606
|
+
r(), !t() && n.includes("<") && Se("ends inside a tag, a comment or a section");
|
|
2607
|
+
}
|
|
2608
|
+
};
|
|
2609
|
+
}, He = async (e, t, n) => {
|
|
2610
|
+
const r = qr(t, n), o = new TextDecoder("utf-8", { fatal: !0 }), s = e.getReader();
|
|
2611
|
+
try {
|
|
2612
|
+
for (; !n(); ) {
|
|
2613
|
+
const { done: a, value: i } = await s.read();
|
|
2614
|
+
if (a) {
|
|
2615
|
+
r.write(o.decode()), r.finish();
|
|
2616
|
+
return;
|
|
2617
|
+
}
|
|
2618
|
+
r.write(o.decode(i, { stream: !0 }));
|
|
2619
|
+
}
|
|
2620
|
+
} catch (a) {
|
|
2621
|
+
if (a instanceof ne) throw a;
|
|
2622
|
+
Se("could not be read as UTF-8 text");
|
|
2623
|
+
} finally {
|
|
2624
|
+
s.cancel().catch(() => {
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
}, ol = 101010256, sl = 33639248, al = 67324752, Br = 22, il = 65535, Mn = 46, Ln = 30, ll = 1, An = 0, cl = 8, dl = 65535, Me = 4294967295, ul = new TextDecoder("utf-8"), ae = (e) => {
|
|
2628
|
+
throw new ne("not-workbook", `the ZIP package ${e}`);
|
|
2629
|
+
}, fl = (e) => {
|
|
2630
|
+
const t = e.byteLength - Br, n = Math.max(0, t - il);
|
|
2631
|
+
for (let r = t; r >= n; r -= 1)
|
|
2632
|
+
if (e.getUint32(r, !0) === ol) return r;
|
|
2633
|
+
return ae("has no end of central directory record");
|
|
2634
|
+
}, ml = (e) => {
|
|
2635
|
+
if (e.byteLength < Br) return ae("is shorter than its end record");
|
|
2636
|
+
const t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = fl(t), r = t.getUint16(n + 4, !0), o = t.getUint16(n + 6, !0), s = t.getUint16(n + 10, !0), a = t.getUint32(n + 12, !0), i = t.getUint32(n + 16, !0);
|
|
2637
|
+
if (r !== 0 || o !== 0) return ae("spans several disks");
|
|
2638
|
+
if (s === dl || a === Me || i === Me) return ae("is a ZIP64 package");
|
|
2639
|
+
if (i + a > n) return ae("has a central directory past its end record");
|
|
2640
|
+
const f = /* @__PURE__ */ new Map();
|
|
2641
|
+
let u = i;
|
|
2642
|
+
for (let l = 0; l < s; l += 1) {
|
|
2643
|
+
if (u + Mn > n || t.getUint32(u, !0) !== sl) return ae("has a malformed central directory");
|
|
2644
|
+
const d = t.getUint16(u + 8, !0), h = t.getUint16(u + 10, !0), g = t.getUint32(u + 20, !0), v = t.getUint32(u + 24, !0), y = t.getUint16(u + 28, !0), T = t.getUint16(u + 30, !0), C = t.getUint16(u + 32, !0), R = t.getUint32(u + 42, !0), q = u + Mn;
|
|
2645
|
+
if (q + y > n) return ae("has a name past its central directory");
|
|
2646
|
+
const D = ul.decode(e.subarray(q, q + y));
|
|
2647
|
+
if (g === Me || v === Me || R === Me) return ae("has a ZIP64 entry");
|
|
2648
|
+
if (!D.endsWith("/")) {
|
|
2649
|
+
if (f.has(D)) return ae(`names ${D} twice`);
|
|
2650
|
+
f.set(D, { name: D, encrypted: (d & ll) !== 0, method: h, compressedSize: g, uncompressedSize: v, localHeaderOffset: R });
|
|
2651
|
+
}
|
|
2652
|
+
u = q + y + T + C;
|
|
2653
|
+
}
|
|
2654
|
+
return { bytes: e, entries: f };
|
|
2655
|
+
}, hl = (e, t) => {
|
|
2656
|
+
const { bytes: n } = e, r = new DataView(n.buffer, n.byteOffset, n.byteLength), o = t.localHeaderOffset;
|
|
2657
|
+
if (o + Ln > n.byteLength || r.getUint32(o, !0) !== al) return ae(`has no local header for ${t.name}`);
|
|
2658
|
+
const s = o + Ln + r.getUint16(o + 26, !0) + r.getUint16(o + 28, !0), a = s + t.compressedSize;
|
|
2659
|
+
return a > n.byteLength ? ae(`has the data of ${t.name} past its end`) : { start: s, end: a };
|
|
2660
|
+
}, Ur = (e) => new ReadableStream({
|
|
2661
|
+
start(t) {
|
|
2662
|
+
e.byteLength > 0 && t.enqueue(e), t.close();
|
|
2663
|
+
}
|
|
2664
|
+
}), pl = (e) => Ur(e).pipeThrough(new DecompressionStream("deflate-raw")), gl = (e, t) => {
|
|
2665
|
+
let n = 0;
|
|
2666
|
+
return new TransformStream({
|
|
2667
|
+
transform(r, o) {
|
|
2668
|
+
if (n += r.byteLength, n > t) {
|
|
2669
|
+
o.error(new ne("too-large", `${e} inflates past ${t} bytes`));
|
|
2670
|
+
return;
|
|
2671
|
+
}
|
|
2672
|
+
o.enqueue(r);
|
|
2673
|
+
}
|
|
2674
|
+
});
|
|
2675
|
+
}, Fe = (e, t, n) => {
|
|
2676
|
+
const r = e.entries.get(t);
|
|
2677
|
+
if (r === void 0) return null;
|
|
2678
|
+
if (r.encrypted) throw new ne("encrypted", `${t} is encrypted`);
|
|
2679
|
+
if (r.method !== An && r.method !== cl) return ae(`compresses ${t} with method ${r.method}`);
|
|
2680
|
+
if (r.uncompressedSize > n) throw new ne("too-large", `${t} declares ${r.uncompressedSize} bytes`);
|
|
2681
|
+
const { start: o, end: s } = hl(e, r), a = e.bytes.subarray(o, s);
|
|
2682
|
+
return (r.method === An ? Ur(a) : pl(a)).pipeThrough(gl(t, n));
|
|
2683
|
+
}, tt = async (e, t, n) => {
|
|
2684
|
+
const r = Fe(e, t, n);
|
|
2685
|
+
if (r === null) return null;
|
|
2686
|
+
const o = new TextDecoder("utf-8", { fatal: !0 }), s = r.getReader();
|
|
2687
|
+
let a = "";
|
|
2688
|
+
try {
|
|
2689
|
+
for (; ; ) {
|
|
2690
|
+
const { done: i, value: f } = await s.read();
|
|
2691
|
+
if (i) break;
|
|
2692
|
+
a += o.decode(f, { stream: !0 });
|
|
2693
|
+
}
|
|
2694
|
+
return a + o.decode();
|
|
2695
|
+
} catch (i) {
|
|
2696
|
+
if (i instanceof ne) throw i;
|
|
2697
|
+
return ae(`has ${t}, which does not inflate to UTF-8 text`);
|
|
2698
|
+
} finally {
|
|
2699
|
+
s.releaseLock();
|
|
2700
|
+
}
|
|
2701
|
+
}, Nn = "content.xml", wl = "META-INF/manifest.xml", Hr = (e) => {
|
|
2702
|
+
throw new ne("not-workbook", `the spreadsheet ${e}`);
|
|
2703
|
+
}, Dn = (e, t) => Fe(e, Nn, t.maxPartBytes) ?? Hr(`has no ${Nn}`), vl = async (e, t) => {
|
|
2704
|
+
const n = Fe(e, wl, t.maxPartBytes);
|
|
2705
|
+
if (n === null) return !1;
|
|
2706
|
+
let r = !1;
|
|
2707
|
+
return await He(
|
|
2708
|
+
n,
|
|
2709
|
+
{
|
|
2710
|
+
start: (o) => {
|
|
2711
|
+
o === "encryption-data" && (r = !0);
|
|
2712
|
+
}
|
|
2713
|
+
},
|
|
2714
|
+
() => r
|
|
2715
|
+
), r;
|
|
2716
|
+
}, bl = async (e) => {
|
|
2717
|
+
const t = [], n = /* @__PURE__ */ new Set();
|
|
2718
|
+
let r = null, o = 0;
|
|
2719
|
+
return await He(
|
|
2720
|
+
e,
|
|
2721
|
+
{
|
|
2722
|
+
start: (s, a, i) => {
|
|
2723
|
+
s === "style" ? r = a.get("family") === "table" ? a.get("name") ?? null : null : s === "table-properties" && r !== null && a.get("display") === "false" ? n.add(r) : s === "table" && (o === 0 && t.push({ name: a.get("name") ?? "", style: a.get("style-name") ?? "" }), i || (o += 1));
|
|
2724
|
+
},
|
|
2725
|
+
end: (s) => {
|
|
2726
|
+
s === "style" ? r = null : s === "table" && (o = Math.max(0, o - 1));
|
|
2727
|
+
}
|
|
2728
|
+
},
|
|
2729
|
+
() => !1
|
|
2730
|
+
), { tables: t, hidingStyles: n };
|
|
2731
|
+
}, vt = (e) => {
|
|
2732
|
+
const t = Number(e);
|
|
2733
|
+
return Number.isInteger(t) && t > 0 ? t : 1;
|
|
2734
|
+
}, yl = async (e, t, n) => {
|
|
2735
|
+
const r = Nr(n);
|
|
2736
|
+
let o = 0, s = 0, a = !1, i = !1, f = 0, u = 1, l = /* @__PURE__ */ new Map(), d = 0, h = null;
|
|
2737
|
+
return await He(
|
|
2738
|
+
e,
|
|
2739
|
+
{
|
|
2740
|
+
start: (g, v, y) => {
|
|
2741
|
+
if (g === "table") {
|
|
2742
|
+
s === 0 && (a = o === t, o += 1), y || (s += 1);
|
|
2743
|
+
return;
|
|
2744
|
+
}
|
|
2745
|
+
!a || s !== 1 || (g === "table-row" ? (u = vt(v.get("number-rows-repeated")), l = /* @__PURE__ */ new Map(), d = 0) : g === "table-cell" || g === "covered-table-cell" ? h = { repeat: vt(v.get("number-columns-repeated")), covered: g === "covered-table-cell", parts: [], paragraphs: 0, paragraphDepth: 0, annotationDepth: 0 } : h !== null && h.annotationDepth === 0 && (g === "annotation" && !y ? h.annotationDepth += 1 : g === "p" || g === "h" ? (h.paragraphs > 0 && h.parts.push(`
|
|
2746
|
+
`), h.paragraphs += 1, y || (h.paragraphDepth += 1)) : h.paragraphDepth > 0 && (g === "s" ? h.parts.push(" ".repeat(vt(v.get("c")))) : g === "tab" ? h.parts.push(" ") : g === "line-break" && h.parts.push(`
|
|
2747
|
+
`))));
|
|
2748
|
+
},
|
|
2749
|
+
end: (g) => {
|
|
2750
|
+
if (g === "table") {
|
|
2751
|
+
s = Math.max(0, s - 1), s === 0 && a && (a = !1, i = !0);
|
|
2752
|
+
return;
|
|
2753
|
+
}
|
|
2754
|
+
if (h !== null && h.annotationDepth > 0) {
|
|
2755
|
+
g === "annotation" && (h.annotationDepth -= 1);
|
|
2756
|
+
return;
|
|
2757
|
+
}
|
|
2758
|
+
if (!(!a || s !== 1))
|
|
2759
|
+
if ((g === "table-cell" || g === "covered-table-cell") && h !== null) {
|
|
2760
|
+
const v = h.covered ? "" : h.parts.join("");
|
|
2761
|
+
if (v !== "") {
|
|
2762
|
+
const y = Math.min(d + h.repeat, n.maxColumns + 1);
|
|
2763
|
+
for (let T = d; T < y; T += 1) l.set(T, v);
|
|
2764
|
+
}
|
|
2765
|
+
d += h.repeat, h = null;
|
|
2766
|
+
} else g === "table-row" ? (r.addRow(f, l, u), f += u) : (g === "p" || g === "h") && h !== null && (h.paragraphDepth = Math.max(0, h.paragraphDepth - 1));
|
|
2767
|
+
},
|
|
2768
|
+
text: (g) => {
|
|
2769
|
+
h !== null && h.annotationDepth === 0 && h.paragraphDepth > 0 && h.parts.push(g);
|
|
2770
|
+
}
|
|
2771
|
+
},
|
|
2772
|
+
() => i || r.full()
|
|
2773
|
+
), r.table();
|
|
2774
|
+
}, kl = async (e, t) => {
|
|
2775
|
+
if (await vl(e, t)) throw new ne("encrypted", "the spreadsheet's manifest names encryption data");
|
|
2776
|
+
const { tables: n, hidingStyles: r } = await bl(Dn(e, t)), o = [];
|
|
2777
|
+
let s = 0;
|
|
2778
|
+
return n.forEach((a, i) => {
|
|
2779
|
+
if (r.has(a.style)) {
|
|
2780
|
+
s += 1;
|
|
2781
|
+
return;
|
|
2782
|
+
}
|
|
2783
|
+
o.push({ name: a.name, read: async (f) => yl(Dn(e, t), i, f) });
|
|
2784
|
+
}), o.length === 0 && Hr("shows no table"), { sheets: o.slice(0, t.maxSheets), unshownSheets: s, unlistedSheets: Math.max(0, o.length - t.maxSheets) };
|
|
2785
|
+
}, Ee = Object.freeze({ kind: "general" }), El = new Map([
|
|
2786
|
+
[0, "General"],
|
|
2787
|
+
[1, "0"],
|
|
2788
|
+
[2, "0.00"],
|
|
2789
|
+
[3, "#,##0"],
|
|
2790
|
+
[4, "#,##0.00"],
|
|
2791
|
+
[9, "0%"],
|
|
2792
|
+
[10, "0.00%"],
|
|
2793
|
+
[11, "0.00E+00"],
|
|
2794
|
+
[12, "# ?/?"],
|
|
2795
|
+
[13, "# ??/??"],
|
|
2796
|
+
[14, "mm-dd-yy"],
|
|
2797
|
+
[15, "d-mmm-yy"],
|
|
2798
|
+
[16, "d-mmm"],
|
|
2799
|
+
[17, "mmm-yy"],
|
|
2800
|
+
[18, "h:mm AM/PM"],
|
|
2801
|
+
[19, "h:mm:ss AM/PM"],
|
|
2802
|
+
[20, "h:mm"],
|
|
2803
|
+
[21, "h:mm:ss"],
|
|
2804
|
+
[22, "m/d/yy h:mm"],
|
|
2805
|
+
...[27, 28, 29, 30, 31, 34, 35, 36, 50, 51, 52, 53, 54, 55, 56, 57, 58].map((e) => [e, "yyyy-mm-dd"]),
|
|
2806
|
+
[32, "h:mm"],
|
|
2807
|
+
[33, "h:mm:ss"],
|
|
2808
|
+
[37, "#,##0 ;(#,##0)"],
|
|
2809
|
+
[38, "#,##0 ;[Red](#,##0)"],
|
|
2810
|
+
[39, "#,##0.00;(#,##0.00)"],
|
|
2811
|
+
[40, "#,##0.00;[Red](#,##0.00)"],
|
|
2812
|
+
[45, "mm:ss"],
|
|
2813
|
+
[46, "[h]:mm:ss"],
|
|
2814
|
+
[47, "mmss.0"],
|
|
2815
|
+
[48, "##0.0E+0"],
|
|
2816
|
+
[49, "@"]
|
|
2817
|
+
]), Sl = /^\[(h+|m+|s+)\]$/iu, xl = (e) => {
|
|
2818
|
+
let t = "", n = !1;
|
|
2819
|
+
for (let r = 0; r < e.length; r += 1) {
|
|
2820
|
+
const o = e[r];
|
|
2821
|
+
if (o === ";") break;
|
|
2822
|
+
if (o === '"') {
|
|
2823
|
+
const s = e.indexOf('"', r + 1);
|
|
2824
|
+
r = s === -1 ? e.length : s;
|
|
2825
|
+
} else if (o === "\\" || o === "_" || o === "*")
|
|
2826
|
+
r += 1;
|
|
2827
|
+
else if (o === "[") {
|
|
2828
|
+
const s = e.indexOf("]", r + 1), a = e.slice(r, s === -1 ? e.length : s + 1);
|
|
2829
|
+
Sl.test(a) && (t += a.slice(1, -1), n = !0), r = s === -1 ? e.length : s;
|
|
2830
|
+
} else
|
|
2831
|
+
t += o;
|
|
2832
|
+
}
|
|
2833
|
+
return { text: t.toLowerCase(), elapsed: n };
|
|
2834
|
+
}, Tl = (e) => {
|
|
2835
|
+
const { text: t, elapsed: n } = xl(e);
|
|
2836
|
+
if (t === "" || t === "general" || t.includes("@") || /[0#?.]e[+-]/u.test(t)) return Ee;
|
|
2837
|
+
const r = n || /[hs]/u.test(t) || t.includes("am/pm") || t.includes("a/p"), o = /[ydge]/u.test(t.replace(/am\/pm|a\/p/gu, "")) || t.includes("m") && !r;
|
|
2838
|
+
if (o || r) return { kind: "date-time", date: o, time: r, seconds: t.includes("s"), elapsed: n };
|
|
2839
|
+
if (/[0#?]\s*\/\s*[0#?]/u.test(t)) return Ee;
|
|
2840
|
+
const s = /[0#?][0#?,]*(?:\.[0#?]*)?,*/u.exec(t)?.[0];
|
|
2841
|
+
if (s === void 0) return Ee;
|
|
2842
|
+
const a = /,*$/u.exec(s)?.[0].length ?? 0, [i = "", f = ""] = s.slice(0, s.length - a).split("."), u = (f.match(/[0#?]/gu) ?? []).length;
|
|
2843
|
+
return t.includes("%") ? { kind: "percent", decimals: u } : { kind: "fixed", decimals: u, grouping: i.includes(","), scale: 1e3 ** a };
|
|
2844
|
+
}, Rl = (e, t) => {
|
|
2845
|
+
const n = t.get(e) ?? El.get(e);
|
|
2846
|
+
return n === void 0 ? Ee : Tl(n);
|
|
2847
|
+
}, zt = (e) => {
|
|
2848
|
+
if (Number.isInteger(e) && Math.abs(e) < 1e15) return String(e);
|
|
2849
|
+
const [t = "", n] = e.toPrecision(15).split("e"), r = t.includes(".") ? t.replace(/0+$/u, "").replace(/\.$/u, "") : t;
|
|
2850
|
+
return n === void 0 ? r : `${r}E${n.startsWith("-") ? n : `+${n.replace("+", "")}`}`;
|
|
2851
|
+
}, Pn = (e, t, n) => {
|
|
2852
|
+
const r = Math.abs(e).toFixed(t);
|
|
2853
|
+
if (r.includes("e")) return zt(e);
|
|
2854
|
+
const [o = "", s] = r.split("."), a = n ? o.replace(/\B(?=(\d{3})+(?!\d))/gu, ",") : o;
|
|
2855
|
+
return `${e < 0 && /[1-9]/u.test(r) ? "-" : ""}${a}${s === void 0 ? "" : `.${s}`}`;
|
|
2856
|
+
}, Ol = 864e5, In = 86400, Cl = 2958465, xe = (e, t) => String(e).padStart(t, "0"), Ml = (e, t) => {
|
|
2857
|
+
if (!t && e === 0) return "1900-01-00";
|
|
2858
|
+
if (!t && e === 60) return "1900-02-29";
|
|
2859
|
+
const n = t ? Date.UTC(1904, 0, 1) : e < 60 ? Date.UTC(1899, 11, 31) : Date.UTC(1899, 11, 30), r = new Date(n + e * Ol);
|
|
2860
|
+
return `${xe(r.getUTCFullYear(), 4)}-${xe(r.getUTCMonth() + 1, 2)}-${xe(r.getUTCDate(), 2)}`;
|
|
2861
|
+
}, Ll = (e, t, n) => {
|
|
2862
|
+
if (e < 0 || e >= Cl + 1) return zt(e);
|
|
2863
|
+
let r = Math.floor(e), o = Math.round((e - r) * In);
|
|
2864
|
+
o === In && (r += 1, o = 0);
|
|
2865
|
+
const s = Math.floor(o / 3600), a = Math.floor(o % 3600 / 60), i = `${xe(t.elapsed ? r * 24 + s : s, 2)}:${xe(a, 2)}${t.seconds ? `:${xe(o % 60, 2)}` : ""}`;
|
|
2866
|
+
if (t.elapsed || !t.date) return i;
|
|
2867
|
+
const f = Ml(r, n);
|
|
2868
|
+
return t.time ? `${f} ${i}` : f;
|
|
2869
|
+
}, Al = (e, t, n) => {
|
|
2870
|
+
switch (t.kind) {
|
|
2871
|
+
case "general":
|
|
2872
|
+
return zt(e);
|
|
2873
|
+
case "date-time":
|
|
2874
|
+
return Ll(e, t, n);
|
|
2875
|
+
case "percent":
|
|
2876
|
+
return `${Pn(e * 100, t.decimals, !1)}%`;
|
|
2877
|
+
case "fixed":
|
|
2878
|
+
return Pn(e / t.scale, t.decimals, t.grouping);
|
|
2879
|
+
}
|
|
2880
|
+
}, zr = "_rels/.rels", ce = (e) => {
|
|
2881
|
+
throw new ne("not-workbook", `the workbook ${e}`);
|
|
2882
|
+
}, jt = (e, t) => {
|
|
2883
|
+
const n = qr(t, () => !1);
|
|
2884
|
+
n.write(e), n.finish();
|
|
2885
|
+
}, Nl = (e, t) => {
|
|
2886
|
+
try {
|
|
2887
|
+
return decodeURIComponent(e);
|
|
2888
|
+
} catch {
|
|
2889
|
+
return ce(`points to a malformed part name (${t})`);
|
|
2890
|
+
}
|
|
2891
|
+
}, Dl = (e, t) => {
|
|
2892
|
+
const r = [...t.startsWith("/") ? [] : e.split("/").slice(0, -1)];
|
|
2893
|
+
for (const o of t.split("/"))
|
|
2894
|
+
o === "" || o === "." || (o === ".." ? (r.length === 0 && ce(`points above its root (${t})`), r.pop()) : r.push(Nl(o, t)));
|
|
2895
|
+
return r.join("/");
|
|
2896
|
+
}, Pl = (e) => {
|
|
2897
|
+
const t = e.lastIndexOf("/");
|
|
2898
|
+
return `${e.slice(0, t + 1)}_rels/${e.slice(t + 1)}.rels`;
|
|
2899
|
+
}, $n = async (e, t, n) => {
|
|
2900
|
+
const r = await tt(e, t === "" ? zr : Pl(t), n.maxPartBytes), o = /* @__PURE__ */ new Map();
|
|
2901
|
+
return r === null || jt(r, {
|
|
2902
|
+
start: (s, a) => {
|
|
2903
|
+
if (s !== "Relationship") return;
|
|
2904
|
+
const i = a.get("Id"), f = a.get("Type"), u = a.get("Target");
|
|
2905
|
+
i === void 0 || f === void 0 || u === void 0 || a.get("TargetMode") === "External" || o.set(i, { type: f, target: Dl(t, u) });
|
|
2906
|
+
}
|
|
2907
|
+
}), o;
|
|
2908
|
+
}, bt = (e, t) => {
|
|
2909
|
+
for (const n of e.values()) if (n.type.endsWith(`/${t}`)) return n.target;
|
|
2910
|
+
return null;
|
|
2911
|
+
}, Il = (e) => {
|
|
2912
|
+
const t = [];
|
|
2913
|
+
let n = !1;
|
|
2914
|
+
return jt(e, {
|
|
2915
|
+
start: (r, o) => {
|
|
2916
|
+
if (r === "workbookPr") {
|
|
2917
|
+
const s = o.get("date1904");
|
|
2918
|
+
n = s === "1" || s === "true";
|
|
2919
|
+
} else r === "sheet" && t.push({ name: o.get("name") ?? "", state: o.get("state") ?? "visible", relationship: o.get("id") ?? "" });
|
|
2920
|
+
}
|
|
2921
|
+
}), { sheets: t, date1904: n };
|
|
2922
|
+
}, $l = async (e) => {
|
|
2923
|
+
const t = [];
|
|
2924
|
+
let n = null, r = !1, o = 0;
|
|
2925
|
+
return await He(
|
|
2926
|
+
e,
|
|
2927
|
+
{
|
|
2928
|
+
start: (s, a, i) => {
|
|
2929
|
+
s === "si" ? n = [] : s === "rPh" && !i ? o += 1 : s === "t" && o === 0 && (r = !i);
|
|
2930
|
+
},
|
|
2931
|
+
end: (s) => {
|
|
2932
|
+
s === "si" && n !== null ? (t.push(n.join("")), n = null) : s === "rPh" ? o = Math.max(0, o - 1) : s === "t" && (r = !1);
|
|
2933
|
+
},
|
|
2934
|
+
text: (s) => {
|
|
2935
|
+
r && n !== null && n.push(s);
|
|
2936
|
+
}
|
|
2937
|
+
},
|
|
2938
|
+
() => !1
|
|
2939
|
+
), t;
|
|
2940
|
+
}, _l = (e) => {
|
|
2941
|
+
const t = /* @__PURE__ */ new Map(), n = [];
|
|
2942
|
+
let r = !1;
|
|
2943
|
+
return jt(e, {
|
|
2944
|
+
start: (o, s) => {
|
|
2945
|
+
if (o === "numFmt") {
|
|
2946
|
+
const a = Number(s.get("numFmtId")), i = s.get("formatCode");
|
|
2947
|
+
Number.isInteger(a) && i !== void 0 && t.set(a, i);
|
|
2948
|
+
} else if (o === "cellXfs")
|
|
2949
|
+
r = !0;
|
|
2950
|
+
else if (o === "xf" && r) {
|
|
2951
|
+
const a = Number(s.get("numFmtId") ?? "0");
|
|
2952
|
+
n.push(Number.isInteger(a) ? a : 0);
|
|
2953
|
+
}
|
|
2954
|
+
},
|
|
2955
|
+
end: (o) => {
|
|
2956
|
+
o === "cellXfs" && (r = !1);
|
|
2957
|
+
}
|
|
2958
|
+
}), n.map((o) => Rl(o, t));
|
|
2959
|
+
}, Fl = /^(\d{4}-\d{2}-\d{2})(?:T(\d{2}:\d{2}(?::\d{2})?)(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?$/u, ql = (e) => {
|
|
2960
|
+
const t = Fl.exec(e);
|
|
2961
|
+
if (t === null) return e;
|
|
2962
|
+
const [, n, r] = t;
|
|
2963
|
+
return r === void 0 || /^00:00(?::00)?$/u.test(r) ? n ?? e : `${n} ${r}`;
|
|
2964
|
+
}, Bl = /^([A-Za-z]{1,3})(\d+)$/u, Ul = (e) => {
|
|
2965
|
+
const t = Bl.exec(e)?.[1];
|
|
2966
|
+
if (t === void 0) return null;
|
|
2967
|
+
let n = 0;
|
|
2968
|
+
for (const r of t.toUpperCase()) n = n * 26 + (r.charCodeAt(0) - 64);
|
|
2969
|
+
return n - 1;
|
|
2970
|
+
}, Hl = (e, t, n, r) => {
|
|
2971
|
+
const o = e.value.join("");
|
|
2972
|
+
switch (e.type) {
|
|
2973
|
+
case "s":
|
|
2974
|
+
return o === "" ? "" : t[Number(o)] ?? ce(`refers to the shared string ${o}, past its ${t.length}`);
|
|
2975
|
+
case "inlineStr":
|
|
2976
|
+
return e.inline.join("");
|
|
2977
|
+
case "b":
|
|
2978
|
+
return o === "" ? "" : o === "1" || o === "true" ? "TRUE" : "FALSE";
|
|
2979
|
+
case "str":
|
|
2980
|
+
case "e":
|
|
2981
|
+
return o;
|
|
2982
|
+
case "d":
|
|
2983
|
+
return ql(o.trim());
|
|
2984
|
+
default: {
|
|
2985
|
+
const s = o.trim();
|
|
2986
|
+
if (s === "") return "";
|
|
2987
|
+
const a = Number(s);
|
|
2988
|
+
return Number.isFinite(a) ? Al(a, n[e.style] ?? Ee, r) : s;
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
}, zl = async (e, t, n, r, o) => {
|
|
2992
|
+
const s = Nr(t);
|
|
2993
|
+
let a = -1, i = /* @__PURE__ */ new Map(), f = 0, u = null;
|
|
2994
|
+
return await He(
|
|
2995
|
+
e,
|
|
2996
|
+
{
|
|
2997
|
+
start: (l, d, h) => {
|
|
2998
|
+
if (l === "row") {
|
|
2999
|
+
const g = Number(d.get("r"));
|
|
3000
|
+
a = Number.isInteger(g) && g > a + 1 ? g - 1 : a + 1, i = /* @__PURE__ */ new Map(), f = 0;
|
|
3001
|
+
} else if (l === "c") {
|
|
3002
|
+
const g = Ul(d.get("r") ?? "") ?? f, v = Number(d.get("s") ?? "0");
|
|
3003
|
+
u = { column: g, type: d.get("t") ?? "n", style: Number.isInteger(v) ? v : 0, value: [], inline: [], inValue: !1, inInlineText: !1, phoneticDepth: 0 };
|
|
3004
|
+
} else u !== null && (l === "v" ? u.inValue = !h : l === "rPh" && !h ? u.phoneticDepth += 1 : l === "t" && u.type === "inlineStr" && u.phoneticDepth === 0 && (u.inInlineText = !h));
|
|
3005
|
+
},
|
|
3006
|
+
end: (l) => {
|
|
3007
|
+
if (l === "c" && u !== null) {
|
|
3008
|
+
const d = Hl(u, n, r, o);
|
|
3009
|
+
d !== "" && i.set(u.column, d), f = u.column + 1, u = null;
|
|
3010
|
+
} else l === "row" ? s.addRow(a, i, 1) : u !== null && (l === "v" ? u.inValue = !1 : l === "rPh" ? u.phoneticDepth = Math.max(0, u.phoneticDepth - 1) : l === "t" && (u.inInlineText = !1));
|
|
3011
|
+
},
|
|
3012
|
+
text: (l) => {
|
|
3013
|
+
u !== null && (u.inValue ? u.value.push(l) : u.inInlineText && u.inline.push(l));
|
|
3014
|
+
}
|
|
3015
|
+
},
|
|
3016
|
+
s.full
|
|
3017
|
+
), s.table();
|
|
3018
|
+
}, jl = async (e, t) => {
|
|
3019
|
+
const n = bt(await $n(e, "", t), "officeDocument") ?? ce("has no officeDocument relationship"), r = await tt(e, n, t.maxPartBytes) ?? ce(`has no part ${n}`), { sheets: o, date1904: s } = Il(r), a = await $n(e, n, t), i = bt(a, "sharedStrings"), f = i === null ? null : Fe(e, i, t.maxPartBytes), u = f === null ? [] : await $l(f), l = bt(a, "styles"), d = l === null ? null : await tt(e, l, t.maxPartBytes), h = d === null ? [] : _l(d), g = [];
|
|
3020
|
+
let v = 0;
|
|
3021
|
+
for (const y of o) {
|
|
3022
|
+
const T = a.get(y.relationship) ?? ce(`lists the sheet ${y.name} without its relationship`);
|
|
3023
|
+
if (y.state !== "visible" || !T.type.endsWith("/worksheet")) {
|
|
3024
|
+
v += 1;
|
|
3025
|
+
continue;
|
|
3026
|
+
}
|
|
3027
|
+
e.entries.has(T.target) || ce(`has no part ${T.target} for the sheet ${y.name}`), g.push({
|
|
3028
|
+
name: y.name,
|
|
3029
|
+
read: async (C) => {
|
|
3030
|
+
const R = Fe(e, T.target, t.maxPartBytes) ?? ce(`has no part ${T.target}`);
|
|
3031
|
+
return zl(R, C, u, h, s);
|
|
3032
|
+
}
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
return g.length === 0 && ce("shows no sheet"), { sheets: g.slice(0, t.maxSheets), unshownSheets: v, unlistedSheets: Math.max(0, g.length - t.maxSheets) };
|
|
3036
|
+
}, Vl = Object.freeze([80, 75, 3, 4]), Zl = Object.freeze([208, 207, 17, 224, 161, 177, 26, 225]), yt = Uint8Array.from([..."EncryptedPackage"].flatMap((e) => [e.charCodeAt(0), 0])), Wl = /* @__PURE__ */ new Set(["application/vnd.oasis.opendocument.spreadsheet", "application/vnd.oasis.opendocument.spreadsheet-template"]), Gl = "mimetype", jr = (e, t) => e.byteLength >= t.length && t.every((n, r) => e[r] === n), Vr = (e) => jr(e, Vl), Zr = (e) => jr(e, Zl), Kl = (e) => {
|
|
3037
|
+
const t = e.byteLength - yt.byteLength;
|
|
3038
|
+
for (let n = 0; n <= t; n += 1)
|
|
3039
|
+
if (e[n] === yt[0] && yt.every((r, o) => e[n + o] === r)) return !0;
|
|
3040
|
+
return !1;
|
|
3041
|
+
}, Yl = async (e, t) => {
|
|
3042
|
+
if (Zr(e))
|
|
3043
|
+
throw Kl(e) ? new ne("encrypted", "the bytes are a password-protected workbook") : new ne("not-workbook", "the bytes are a compound file (a legacy .xls)");
|
|
3044
|
+
if (!Vr(e)) throw new ne("not-workbook", "the bytes are no ZIP package");
|
|
3045
|
+
const n = ml(e), r = await tt(n, Gl, t.maxPartBytes);
|
|
3046
|
+
if (r !== null && Wl.has(r.trim())) return kl(n, t);
|
|
3047
|
+
if (n.entries.has(zr)) return jl(n, t);
|
|
3048
|
+
throw new ne("not-workbook", "the ZIP package is neither an OpenDocument spreadsheet nor an Office Open XML package");
|
|
3049
|
+
}, Xl = async (e, t) => {
|
|
3050
|
+
const n = e.getReader(), r = [];
|
|
3051
|
+
let o = 0;
|
|
3052
|
+
try {
|
|
3053
|
+
for (; ; ) {
|
|
3054
|
+
const { done: i, value: f } = await n.read();
|
|
3055
|
+
if (i) break;
|
|
3056
|
+
if (o += f.byteLength, o > t) return null;
|
|
3057
|
+
r.push(f);
|
|
3058
|
+
}
|
|
3059
|
+
} finally {
|
|
3060
|
+
n.cancel().catch(() => {
|
|
3061
|
+
});
|
|
3062
|
+
}
|
|
3063
|
+
const s = new Uint8Array(o);
|
|
3064
|
+
let a = 0;
|
|
3065
|
+
for (const i of r)
|
|
3066
|
+
s.set(i, a), a += i.byteLength;
|
|
3067
|
+
return s;
|
|
3068
|
+
}, Wr = async (e, t) => {
|
|
3069
|
+
try {
|
|
3070
|
+
return { kind: "table", table: await e.read(t) };
|
|
3071
|
+
} catch (n) {
|
|
3072
|
+
return { kind: "refused", refusal: n instanceof ne ? n.refusal : "not-workbook" };
|
|
3073
|
+
}
|
|
3074
|
+
}, Jl = async (e, t, n, r, o) => {
|
|
3075
|
+
const s = await e.asset(Ao(t), o);
|
|
3076
|
+
if (s.status === "cancelled") return null;
|
|
3077
|
+
if (s.status === "error") return { kind: "failure", failure: s.failure };
|
|
3078
|
+
let a;
|
|
3079
|
+
try {
|
|
3080
|
+
a = await Xl(s.body, n.maxBytes);
|
|
3081
|
+
} catch {
|
|
3082
|
+
return o.aborted ? null : { kind: "failure", failure: { reason: "failed" } };
|
|
3083
|
+
}
|
|
3084
|
+
if (o.aborted) return null;
|
|
3085
|
+
if (a === null) return { kind: "refused", refusal: "too-large" };
|
|
3086
|
+
if (!(Vr(a) || Zr(a))) return { kind: "not-package" };
|
|
3087
|
+
try {
|
|
3088
|
+
const i = await Yl(a, n.limits), f = r === null ? -1 : i.sheets.findIndex((h) => h.name === r), u = Math.max(f, 0), l = i.sheets[u];
|
|
3089
|
+
if (l === void 0) return { kind: "refused", refusal: "not-workbook" };
|
|
3090
|
+
const d = await Wr(l, n.budget);
|
|
3091
|
+
return o.aborted ? null : { kind: "workbook", workbook: i, selected: u, sheet: d };
|
|
3092
|
+
} catch (i) {
|
|
3093
|
+
return i instanceof ne ? { kind: "refused", refusal: i.refusal } : o.aborted ? null : { kind: "failure", failure: { reason: "failed" } };
|
|
3094
|
+
}
|
|
3095
|
+
}, Ql = Object.freeze({ className: "aqmx-document-spreadsheet-body", "data-aqmx-document-scroller": "" }), ec = (e, t) => {
|
|
3096
|
+
switch (t.code) {
|
|
3097
|
+
case "encoding":
|
|
3098
|
+
return e.spreadsheetUnreadableEncoding(t.encodings);
|
|
3099
|
+
case "binary":
|
|
3100
|
+
return e.spreadsheetNotText;
|
|
3101
|
+
case "long-row":
|
|
3102
|
+
return e.spreadsheetLongRow;
|
|
3103
|
+
}
|
|
3104
|
+
}, _n = (e, t) => {
|
|
3105
|
+
switch (t) {
|
|
3106
|
+
case "encrypted":
|
|
3107
|
+
return e.spreadsheetWorkbookEncrypted;
|
|
3108
|
+
case "not-workbook":
|
|
3109
|
+
return e.spreadsheetNotWorkbook;
|
|
3110
|
+
case "too-large":
|
|
3111
|
+
return e.spreadsheetWorkbookTooLarge;
|
|
3112
|
+
}
|
|
3113
|
+
}, kt = (e) => e.every((t) => t.every((n) => n === "")), Gr = ({ name: e, url: t, openUrl: n, state: r, children: o }) => /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-spreadsheet-view", "data-aqmx-spreadsheet": r, children: [
|
|
3114
|
+
/* @__PURE__ */ c(Ue, { name: e, openUrl: n, downloadUrl: t, icon: /* @__PURE__ */ c(Fi, {}) }),
|
|
3115
|
+
/* @__PURE__ */ c(Be, { scrollerProps: Ql, children: /* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet-column", children: o }) })
|
|
3116
|
+
] }), Kr = ({ rows: e, title: t }) => {
|
|
3117
|
+
const { labels: n, locale: r, theme: o } = $(), s = se(we), a = X(() => ({ ...Ir(n, r), table: t, fullscreenDialog: n.spreadsheetFullscreen(t) }), [n, r, t]), i = X(() => Qo(e), [e]);
|
|
3118
|
+
return (
|
|
3119
|
+
/* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet", "data-theme": o, children: /* @__PURE__ */ c(Go, { tsv: i, layout: s === "fill" ? "fill" : "inline", locale: r, labels: a }) })
|
|
3120
|
+
);
|
|
3121
|
+
}, De = ({ note: e, testId: t, code: n, download: r }) => {
|
|
3122
|
+
const { labels: o } = $();
|
|
3123
|
+
return /* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet-stage", children: r === void 0 ? /* @__PURE__ */ c("p", { className: "aqmx-callout", role: "note", "data-testid": t, children: e }) : /* @__PURE__ */ B("div", { className: "aqmx-callout", role: "note", "data-testid": t, "data-aqmx-unreadable": n, children: [
|
|
3124
|
+
/* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: e }),
|
|
3125
|
+
/* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: r.url, download: r.name, "data-testid": "markdown-explorer-spreadsheet-unreadable-download", children: o.download })
|
|
3126
|
+
] }) });
|
|
3127
|
+
}, Yr = ({ reading: e, name: t, url: n }) => {
|
|
3128
|
+
const { labels: r } = $();
|
|
3129
|
+
switch (e.kind) {
|
|
3130
|
+
case "table":
|
|
3131
|
+
return /* @__PURE__ */ B(pe, { children: [
|
|
3132
|
+
e.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-truncated", children: r.spreadsheetTruncated }) : null,
|
|
3133
|
+
/* @__PURE__ */ c(Kr, { rows: e.rows, title: t })
|
|
3134
|
+
] });
|
|
3135
|
+
case "empty":
|
|
3136
|
+
return /* @__PURE__ */ c(De, { note: r.spreadsheetEmpty, testId: "markdown-explorer-spreadsheet-empty" });
|
|
3137
|
+
case "unreadable":
|
|
3138
|
+
return /* @__PURE__ */ c(De, { note: ec(r, e), testId: "markdown-explorer-spreadsheet-unreadable", code: e.code, download: { url: n, name: t } });
|
|
3139
|
+
}
|
|
3140
|
+
}, tc = ({ path: e, document: t }) => t.format === "workbook" ? /* @__PURE__ */ c(rc, { path: e, document: t }) : /* @__PURE__ */ c(nc, { path: e, document: t, format: t.format }), nc = ({ path: e, document: t, format: n }) => {
|
|
3141
|
+
const { config: r, data: o, labels: s } = $(), { name: a, url: i } = t, f = F(
|
|
3142
|
+
async (h) => {
|
|
3143
|
+
const g = await Pr(o, i, { format: n, legacyEncoding: r.legacyTextEncoding, maxBytes: r.spreadsheets.maxBytes, budget: Ye }, h);
|
|
3144
|
+
return g === null || g.kind === "failure" ? g : { kind: "read", value: g };
|
|
3145
|
+
},
|
|
3146
|
+
[o, i, n, r.legacyTextEncoding, r.spreadsheets.maxBytes]
|
|
3147
|
+
), { shown: u, failure: l, retry: d } = Ht(e, a, f);
|
|
3148
|
+
return /* @__PURE__ */ B(Gr, { name: a, url: i, openUrl: rt(i), state: u === null ? l === null ? "loading" : "failure" : u.kind, children: [
|
|
3149
|
+
u === null && l === null ? /* @__PURE__ */ c(Oe, { label: s.spreadsheetLoading, testId: "markdown-explorer-spreadsheet-skeleton" }) : null,
|
|
3150
|
+
u === null && l !== null ? /* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet-failure", children: /* @__PURE__ */ c(Re, { failure: l, alert: !1, onRetry: d, testId: "markdown-explorer-spreadsheet-failure" }) }) : null,
|
|
3151
|
+
u === null ? null : /* @__PURE__ */ c(Yr, { reading: u, name: a, url: i })
|
|
3152
|
+
] });
|
|
3153
|
+
}, rc = ({ path: e, document: t }) => {
|
|
3154
|
+
const { config: n, data: r, labels: o } = $(), { name: s, url: a, firstSheetText: i } = t, f = Te(), u = U(null), l = F(
|
|
3155
|
+
async (b) => {
|
|
3156
|
+
const S = await Jl(r, a, { maxBytes: n.spreadsheets.maxWorkbookBytes, limits: ji, budget: Ye }, u.current, b);
|
|
3157
|
+
if (S === null || S.kind === "failure") return S;
|
|
3158
|
+
if (S.kind === "workbook") return { kind: "read", value: S };
|
|
3159
|
+
if (i !== null) {
|
|
3160
|
+
const M = await Pr(r, a, { format: i, legacyEncoding: n.legacyTextEncoding, maxBytes: n.spreadsheets.maxBytes, budget: Ye }, b);
|
|
3161
|
+
return M === null || M.kind === "failure" ? M : { kind: "read", value: { kind: "first-sheet", reading: M } };
|
|
3162
|
+
}
|
|
3163
|
+
return { kind: "read", value: { kind: "refused", refusal: S.kind === "not-package" ? "not-workbook" : S.refusal } };
|
|
3164
|
+
},
|
|
3165
|
+
[r, a, i, n.legacyTextEncoding, n.spreadsheets.maxBytes, n.spreadsheets.maxWorkbookBytes]
|
|
3166
|
+
), { shown: d, failure: h, retry: g } = Ht(e, s, l), [v, y] = V(null), T = U(/* @__PURE__ */ new WeakMap()), C = d?.kind === "workbook" ? d : null, R = C === null ? null : v !== null && v.workbook === C.workbook ? v : { workbook: C.workbook, index: C.selected, reading: C.sheet }, q = (b) => {
|
|
3167
|
+
if (C === null) return;
|
|
3168
|
+
const S = C.workbook.sheets[b];
|
|
3169
|
+
if (S === void 0) return;
|
|
3170
|
+
u.current = S.name;
|
|
3171
|
+
let M = T.current.get(C.workbook);
|
|
3172
|
+
M === void 0 && (M = /* @__PURE__ */ new Map([[C.selected, C.sheet]]), T.current.set(C.workbook, M));
|
|
3173
|
+
const L = M.get(b), P = { workbook: C.workbook, index: b, reading: L ?? null };
|
|
3174
|
+
if (y(P), L !== void 0) return;
|
|
3175
|
+
const H = M;
|
|
3176
|
+
Wr(S, Ye).then((K) => {
|
|
3177
|
+
H.set(b, K), y((w) => w === P ? { ...P, reading: K } : w);
|
|
3178
|
+
});
|
|
3179
|
+
}, D = R === null ? null : R.reading === null ? "loading" : R.reading.kind === "refused" ? "unreadable" : kt(R.reading.table.rows) ? "empty" : "table", m = d === null ? h === null ? "loading" : "failure" : d.kind === "first-sheet" ? d.reading.kind : d.kind === "refused" ? "unreadable" : D ?? "loading", p = i === null ? a : rt(a), x = (b) => `${f}-sheet-${b}`, A = `${f}-panel`, I = R === null ? null : C?.workbook.sheets[R.index]?.name ?? null, _ = C !== null && C.workbook.sheets.length > 1;
|
|
3180
|
+
return /* @__PURE__ */ B(Gr, { name: s, url: a, openUrl: p, state: m, children: [
|
|
3181
|
+
d === null && h === null ? /* @__PURE__ */ c(Oe, { label: o.spreadsheetLoading, testId: "markdown-explorer-spreadsheet-skeleton" }) : null,
|
|
3182
|
+
d === null && h !== null ? /* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet-failure", children: /* @__PURE__ */ c(Re, { failure: h, alert: !1, onRetry: g, testId: "markdown-explorer-spreadsheet-failure" }) }) : null,
|
|
3183
|
+
d?.kind === "refused" ? /* @__PURE__ */ c(De, { note: _n(o, d.refusal), testId: "markdown-explorer-spreadsheet-unreadable", code: d.refusal, download: { url: a, name: s } }) : null,
|
|
3184
|
+
d?.kind === "first-sheet" ? /* @__PURE__ */ B(pe, { children: [
|
|
3185
|
+
/* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-first-sheet", children: o.spreadsheetWorkbookFirstSheet }),
|
|
3186
|
+
/* @__PURE__ */ c(Yr, { reading: d.reading, name: s, url: a })
|
|
3187
|
+
] }) : null,
|
|
3188
|
+
C === null || R === null || I === null ? null : /* @__PURE__ */ B(pe, { children: [
|
|
3189
|
+
C.workbook.unshownSheets > 0 ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-unshown-sheets", children: o.spreadsheetUnshownSheets(C.workbook.unshownSheets) }) : null,
|
|
3190
|
+
C.workbook.unlistedSheets > 0 ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-unlisted-sheets", children: o.spreadsheetUnlistedSheets(C.workbook.sheets.length) }) : null,
|
|
3191
|
+
_ ? /* @__PURE__ */ c(Zi, { names: C.workbook.sheets.map((b) => b.name), selected: R.index, onSelect: q, label: o.spreadsheetSheets(s), tabIdOf: x, panelId: A }) : null,
|
|
3192
|
+
/* @__PURE__ */ B("div", { className: "aqmx-document-spreadsheet-sheet", "data-testid": "markdown-explorer-spreadsheet-sheet", "data-aqmx-sheet": R.index, ..._ ? { role: "tabpanel", id: A, "aria-labelledby": x(R.index) } : {}, children: [
|
|
3193
|
+
R.reading === null ? /* @__PURE__ */ c(Oe, { label: o.spreadsheetSheetLoading, testId: "markdown-explorer-spreadsheet-sheet-skeleton" }) : null,
|
|
3194
|
+
R.reading?.kind === "table" && R.reading.table.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-truncated", children: o.spreadsheetTruncated }) : null,
|
|
3195
|
+
R.reading?.kind === "refused" ? /* @__PURE__ */ c(De, { note: _n(o, R.reading.refusal), testId: "markdown-explorer-spreadsheet-unreadable", code: R.reading.refusal, download: { url: a, name: s } }) : null,
|
|
3196
|
+
R.reading?.kind === "table" && kt(R.reading.table.rows) ? /* @__PURE__ */ c(De, { note: o.spreadsheetSheetEmpty, testId: "markdown-explorer-spreadsheet-empty" }) : null,
|
|
3197
|
+
R.reading?.kind === "table" && !kt(R.reading.table.rows) ? /* @__PURE__ */ c(Kr, { rows: R.reading.table.rows, title: o.spreadsheetSheetName(s, I) }, R.index) : null
|
|
3198
|
+
] })
|
|
3199
|
+
] })
|
|
3200
|
+
] });
|
|
3201
|
+
}, oc = Object.freeze({ kind: "empty" }), sc = (e, t, n) => {
|
|
3202
|
+
if (t.view === "multi" || t.overrides[n] === void 0) return null;
|
|
3203
|
+
const r = n === "style" ? { align: t.overrides.align } : { style: t.overrides.style };
|
|
3204
|
+
return Ne(e, { ...t, overrides: r });
|
|
3205
|
+
}, Pe = ({ kind: e, view: t, label: n, stale: r, busy: o, frameRef: s, intent: a, children: i }) => {
|
|
3206
|
+
const f = se(we);
|
|
3207
|
+
return (
|
|
3208
|
+
/* @__PURE__ */ B("section", { ref: s, role: "region", "aria-label": n, "aria-busy": o, "data-testid": "markdown-explorer-document", "data-aqmx-document-kind": e, "data-aqmx-document-view": t, "data-aqmx-document-flow": f, className: "aqmx-document", ...a, children: [
|
|
3209
|
+
r ? /* @__PURE__ */ c("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
|
|
3210
|
+
i
|
|
3211
|
+
] })
|
|
3212
|
+
);
|
|
3213
|
+
}, ac = ({ absence: e, announces: t, announceFailure: n }) => {
|
|
3214
|
+
const { labels: r, announcer: o } = $(), s = e.kind === "no-readme" ? e.folder : null, a = e.kind === "failure" ? e.folder : null, i = e.kind === "failure" ? e.failure : null;
|
|
3215
|
+
switch (ee(() => {
|
|
3216
|
+
t && s !== null && o.announce(r.folderReadmeMissing(fe(s)));
|
|
3217
|
+
}, [t, s, o, r]), ee(() => {
|
|
3218
|
+
a !== null && i !== null && n(r.documentFailed(fe(a), de(r, i.reason)));
|
|
3219
|
+
}, [a, i, n, r]), e.kind) {
|
|
3220
|
+
case "empty":
|
|
3221
|
+
return /* @__PURE__ */ c(Pe, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-document-empty", children: /* @__PURE__ */ c("p", { className: "aqmx-empty-title", children: r.documentEmpty }) }) });
|
|
3222
|
+
case "loading":
|
|
3223
|
+
return /* @__PURE__ */ c(Vt, { label: r.documentRegion });
|
|
3224
|
+
case "no-readme":
|
|
3225
|
+
return /* @__PURE__ */ c(Pe, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-folder-empty", children: /* @__PURE__ */ c("p", { className: "aqmx-empty-title", children: r.folderReadmeMissing(fe(e.folder)) }) }) });
|
|
3226
|
+
case "failure":
|
|
3227
|
+
return /* @__PURE__ */ c(Pe, { kind: "failure", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c(qt, { failure: e.failure, onRetry: e.onRetry, testId: "markdown-explorer-folder-failure" }) });
|
|
3228
|
+
}
|
|
3229
|
+
}, Vt = ({ label: e }) => {
|
|
3230
|
+
const { labels: t } = $();
|
|
3231
|
+
return /* @__PURE__ */ c(Pe, { kind: "loading", label: e, stale: !1, busy: !0, children: /* @__PURE__ */ c(Oe, { label: t.documentLoading, testId: "markdown-explorer-document-skeleton" }) });
|
|
3232
|
+
}, Fn = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), ic = ({ path: e, document: t, viewer: n, editing: r }) => {
|
|
3233
|
+
const { reportMathDiagnostics: o, edits: s } = $(), a = X(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), i = bi(), f = yi(), u = X(() => o === void 0 ? void 0 : (m) => o(e, m), [o, e]), l = U(null), { editable: d, doubleClick: h, region: g, paneScroll: v, stale: y } = r;
|
|
3234
|
+
Y(() => {
|
|
3235
|
+
if (d)
|
|
3236
|
+
return s.bindView(e, {
|
|
3237
|
+
anchor: () => {
|
|
3238
|
+
const m = l.current, p = g(), x = m === null ? null : m.querySelector(st);
|
|
3239
|
+
return m === null || p === null || x === null ? null : ea(m, v.scrollerOf(p, x));
|
|
3240
|
+
}
|
|
3241
|
+
});
|
|
3242
|
+
}, [s, e, d, g, v]);
|
|
3243
|
+
const T = (m) => {
|
|
3244
|
+
const p = l.current, { target: x } = m;
|
|
3245
|
+
!h || p === null || !(x instanceof Element) || !Js(x) || (m.stopPropagation(), s.start(e, Qs(x, p, p.ownerDocument.getSelection())));
|
|
3246
|
+
}, C = U(null), R = U(y);
|
|
3247
|
+
Y(() => {
|
|
3248
|
+
R.current = y;
|
|
3249
|
+
});
|
|
3250
|
+
const q = le((m) => {
|
|
3251
|
+
const p = l.current, x = g(), A = p === null ? null : sa(p, m.line);
|
|
3252
|
+
if (x === null || A === null) return !1;
|
|
3253
|
+
const I = v.scrollerOf(x, A);
|
|
3254
|
+
return I.scrollTop += aa(A, m.line) - m.clientTop, !0;
|
|
3255
|
+
}), D = le((m) => {
|
|
3256
|
+
const p = g();
|
|
3257
|
+
if (p === null) return;
|
|
3258
|
+
const x = () => {
|
|
3259
|
+
for (const I of Fn) p.removeEventListener(I, A, !0);
|
|
3260
|
+
C.current?.release === x && (C.current = null);
|
|
3261
|
+
}, A = () => x();
|
|
3262
|
+
for (const I of Fn) p.addEventListener(I, A, { capture: !0, passive: !0 });
|
|
3263
|
+
C.current = { point: m, release: x };
|
|
3264
|
+
});
|
|
3265
|
+
return Y(() => {
|
|
3266
|
+
const m = s.takeReturn(e);
|
|
3267
|
+
if (m !== null)
|
|
3268
|
+
return queueMicrotask(() => {
|
|
3269
|
+
q(m) && R.current && D(m);
|
|
3270
|
+
}), () => C.current?.release();
|
|
3271
|
+
}, [s, e]), Y(() => {
|
|
3272
|
+
const m = C.current;
|
|
3273
|
+
m === null || y || (m.release(), q(m.point));
|
|
3274
|
+
}, [t, y]),
|
|
3275
|
+
/* @__PURE__ */ c("div", { ref: l, className: "aqmx-document-viewer", onDoubleClick: T, children: /* @__PURE__ */ c(tr, { ...n, onHeadingSelect: i, headingHref: f, onMathDiagnostics: u, parseResult: a, content: null }) });
|
|
3276
|
+
}, Xr = ({ document: e, viewer: t }) => {
|
|
3277
|
+
const { labels: n } = $();
|
|
3278
|
+
return /* @__PURE__ */ B(pe, { children: [
|
|
3279
|
+
/* @__PURE__ */ c(Ue, { name: e.name, openUrl: rt(e.url), downloadUrl: e.url, icon: /* @__PURE__ */ c(zs, {}), children: e.truncated ? null : /* @__PURE__ */ c(Ra, { text: e.text }) }),
|
|
3280
|
+
e.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
|
|
3281
|
+
/* @__PURE__ */ c("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ c(tr, { ...t, parseResult: null, content: e.text }) })
|
|
3282
|
+
] });
|
|
3283
|
+
}, Et = ({ path: e, name: t, viewer: n }) => {
|
|
3284
|
+
const { data: r, labels: o } = $(), s = F(
|
|
3285
|
+
async (u) => {
|
|
3286
|
+
const l = await r.text(e, u);
|
|
3287
|
+
return "kind" in l ? l.kind === "failure" ? { kind: "failure", failure: l.failure } : { kind: "read", value: l } : null;
|
|
3288
|
+
},
|
|
3289
|
+
[r, e]
|
|
3290
|
+
), { shown: a, failure: i, retry: f } = Ht(e, t, s);
|
|
3291
|
+
return a !== null ? /* @__PURE__ */ c(Xr, { document: a, viewer: n }) : i !== null ? /* @__PURE__ */ c(qt, { failure: i, onRetry: f, testId: "markdown-explorer-markup-failure" }) : /* @__PURE__ */ c(Oe, { label: o.markupLoading, testId: "markdown-explorer-markup-skeleton" });
|
|
3292
|
+
}, lc = Object.freeze({ reason: "failed" }), cc = (e) => {
|
|
3293
|
+
const { labels: t } = $();
|
|
3294
|
+
return /* @__PURE__ */ c(
|
|
3295
|
+
Zs,
|
|
3296
|
+
{
|
|
3297
|
+
fallback: (n) => /* @__PURE__ */ c("div", { className: "aqmx-edit-message", children: /* @__PURE__ */ c(Re, { failure: lc, alert: !1, onRetry: n, testId: "markdown-explorer-edit-load-failure" }) }),
|
|
3298
|
+
children: /* @__PURE__ */ c(Ie, { fallback: /* @__PURE__ */ c(Oe, { label: t.editLoading, testId: "markdown-explorer-edit-skeleton" }), children: /* @__PURE__ */ c(Vs, { ...e }) })
|
|
3299
|
+
}
|
|
3300
|
+
);
|
|
3301
|
+
}, dc = ({ path: e, document: t, view: n, viewer: r, onRetry: o, editing: s }) => {
|
|
3302
|
+
switch (t.kind) {
|
|
3303
|
+
case "markdown": {
|
|
3304
|
+
const { session: a, layout: i, region: f, paneScroll: u, stale: l } = s;
|
|
3305
|
+
if (n === "edit" && a !== void 0) return /* @__PURE__ */ c(cc, { path: e, name: t.name, session: a, layout: i, viewer: r, region: f, paneScroll: u });
|
|
3306
|
+
if (n === "markup") return /* @__PURE__ */ c(Et, { path: e, name: t.name, viewer: r });
|
|
3307
|
+
const d = t.edit !== null && (t.edit.kind === "inline" || t.edit.kind === "draft");
|
|
3308
|
+
return /* @__PURE__ */ c(ic, { path: e, document: t, viewer: r, editing: { editable: d, doubleClick: d && i === "fill", region: f, paneScroll: u, stale: l } });
|
|
3309
|
+
}
|
|
3310
|
+
case "text":
|
|
3311
|
+
return /* @__PURE__ */ c(Xr, { document: t, viewer: r });
|
|
3312
|
+
case "image":
|
|
3313
|
+
return n === "markup" && Ut(t) === "svg" ? /* @__PURE__ */ c(Et, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ c(ii, { document: t });
|
|
3314
|
+
case "media":
|
|
3315
|
+
return /* @__PURE__ */ c(Pi, { document: t });
|
|
3316
|
+
case "spreadsheet":
|
|
3317
|
+
return n === "markup" ? /* @__PURE__ */ c(Et, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ c(tc, { path: e, document: t });
|
|
3318
|
+
case "file":
|
|
3319
|
+
return /* @__PURE__ */ c(Ia, { document: t });
|
|
3320
|
+
case "failure":
|
|
3321
|
+
return /* @__PURE__ */ c(qt, { failure: t.failure, onRetry: o, testId: "markdown-explorer-document-failure" });
|
|
3322
|
+
default: {
|
|
3323
|
+
const a = t;
|
|
3324
|
+
throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(a)}`);
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3327
|
+
}, uc = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', fc = (e, t, n) => {
|
|
3328
|
+
const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : xr(e, n), r === void 0 ? null : Sr(e, r.id), e.querySelector(st), e.querySelector(uc)];
|
|
3329
|
+
for (const s of o)
|
|
3330
|
+
if (s instanceof HTMLElement && vr(s)) return s;
|
|
3331
|
+
return null;
|
|
3332
|
+
}, qn = (e, t, n) => {
|
|
3333
|
+
const { activeElement: r, body: o } = e.ownerDocument, s = r === null || r === o;
|
|
3334
|
+
t instanceof HTMLElement && n && (s || e.contains(r)) && vr(t);
|
|
3335
|
+
}, mc = (e) => {
|
|
3336
|
+
const t = U(!1);
|
|
3337
|
+
return Y(() => {
|
|
3338
|
+
const n = e.current;
|
|
3339
|
+
if (n === null) throw new Error("[markdown-explorer] the document region is not mounted");
|
|
3340
|
+
const r = n.ownerDocument, o = r.defaultView;
|
|
3341
|
+
if (o === null) throw new Error("[markdown-explorer] the document region's document has no window");
|
|
3342
|
+
let s = !1, a;
|
|
3343
|
+
const i = (h) => {
|
|
3344
|
+
s = !(h.target instanceof Node && n.contains(h.target)), s && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(a), a = setTimeout(() => {
|
|
3345
|
+
s = !1;
|
|
3346
|
+
}, 0);
|
|
3347
|
+
}, f = (h) => {
|
|
3348
|
+
t.current = h.target instanceof Node && n.contains(h.target);
|
|
3349
|
+
}, u = (h) => {
|
|
3350
|
+
h.relatedTarget === null && s && (t.current = !1);
|
|
3351
|
+
}, l = () => {
|
|
3352
|
+
const { activeElement: h, body: g } = r;
|
|
3353
|
+
h !== null && h !== g && (t.current = n.contains(h));
|
|
3354
|
+
}, d = () => {
|
|
3355
|
+
s && !n.contains(r.activeElement) && (t.current = !1);
|
|
3356
|
+
};
|
|
3357
|
+
return o.addEventListener("pointerdown", i, !0), o.addEventListener("mousedown", i, !0), o.addEventListener("focusin", f, !0), o.addEventListener("blur", l), o.addEventListener("focus", d), n.addEventListener("focusout", u), () => {
|
|
3358
|
+
clearTimeout(a), o.removeEventListener("pointerdown", i, !0), o.removeEventListener("mousedown", i, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("blur", l), o.removeEventListener("focus", d), n.removeEventListener("focusout", u);
|
|
3359
|
+
};
|
|
3360
|
+
}, [e]), t;
|
|
3361
|
+
}, hc = Object.freeze({ count: 0, recovered: !1 }), pc = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: s, regionLabel: a, navigation: i, fragment: f, paneScroll: u, announces: l, announceFailure: d, onDocumentShown: h }) => {
|
|
3362
|
+
const { labels: g, announcer: v, documents: y } = $(), { document: T } = t, C = U(null), R = U(null), q = U(null), D = U(0), m = mc(C), p = U({ path: e, document: T }), x = U(null), A = F(
|
|
3363
|
+
(j) => {
|
|
3364
|
+
const Z = C.current, Q = yn(Z, j, u);
|
|
3365
|
+
Z !== null && Q !== null && qn(Z, Q, m.current);
|
|
3366
|
+
},
|
|
3367
|
+
[u, m]
|
|
3368
|
+
), I = F(
|
|
3369
|
+
(j, Z) => {
|
|
3370
|
+
const Q = D.current;
|
|
3371
|
+
setTimeout(() => {
|
|
3372
|
+
!Z.defaultPrevented && D.current === Q && A(j);
|
|
3373
|
+
}, 0);
|
|
3374
|
+
},
|
|
3375
|
+
[A]
|
|
3376
|
+
), _ = F(
|
|
3377
|
+
(j) => {
|
|
3378
|
+
setTimeout(() => {
|
|
3379
|
+
j.defaultPrevented || A("#");
|
|
3380
|
+
}, 0);
|
|
3381
|
+
},
|
|
3382
|
+
[A]
|
|
3383
|
+
), b = X(() => ({ navigation: i, currentPath: e, scrollWithin: A, followSameUrlJump: I, followEmptyFragment: _ }), [i, e, A, I, _]), S = F(() => y.retry(e), [y, e]), M = la(y, fi), L = pr(e), P = L !== void 0 ? "edit" : n ? "markup" : "rendered", H = Ut(T) === null ? void 0 : P, K = F(() => C.current, []), w = X(() => ({ session: L, layout: s, region: K, paneScroll: u, stale: r }), [L, s, K, u, r]), k = H === "edit" ? !1 : r, O = se(we), N = H === "edit" && s === "fill" ? "fill" : O, [z, W] = V(0), J = U(0), G = U(!1), [ie, Wt] = V(hc), [Gt, to] = V(0), Kt = U(d), Yt = U(r);
|
|
3384
|
+
Y(() => {
|
|
3385
|
+
Kt.current = d, Yt.current = r;
|
|
3386
|
+
}, [d, r]);
|
|
3387
|
+
const no = X(
|
|
3388
|
+
() => ({
|
|
3389
|
+
announceFailure: (j) => {
|
|
3390
|
+
Yt.current || Kt.current(j);
|
|
3391
|
+
},
|
|
3392
|
+
readPart: () => {
|
|
3393
|
+
const j = y.readPart(e);
|
|
3394
|
+
J.current += 1;
|
|
3395
|
+
let Z = !1, Q = !1, re = !1;
|
|
3396
|
+
return {
|
|
3397
|
+
settle: (be, ye) => {
|
|
3398
|
+
if (j.settle(be, ye), !(re || Z)) {
|
|
3399
|
+
if (ye !== null) {
|
|
3400
|
+
Q = !0, G.current = !1;
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
Z = !0, Wt((ze) => ({ count: ze.count + 1, recovered: Q }));
|
|
3404
|
+
}
|
|
3405
|
+
},
|
|
3406
|
+
release: () => {
|
|
3407
|
+
re || (re = !0, j.release(), J.current -= 1, Z || to((be) => be + 1));
|
|
3408
|
+
}
|
|
3409
|
+
};
|
|
3410
|
+
},
|
|
3411
|
+
holdBusy: () => {
|
|
3412
|
+
W((Z) => Z + 1);
|
|
3413
|
+
let j = !0;
|
|
3414
|
+
return () => {
|
|
3415
|
+
j && (j = !1, W((Z) => Z - 1));
|
|
3416
|
+
};
|
|
3417
|
+
}
|
|
3418
|
+
}),
|
|
3419
|
+
[y, e]
|
|
3420
|
+
), Xt = k || z > 0, ro = le((j, Z) => {
|
|
3421
|
+
const Q = R.current;
|
|
3422
|
+
if (Q !== null && Q.path === j && Q.snapshot === Z) return;
|
|
3423
|
+
R.current = { path: j, snapshot: Z }, y.noteShown(j, Z);
|
|
3424
|
+
const re = Z.document;
|
|
3425
|
+
if (re.kind === "failure") {
|
|
3426
|
+
G.current = !1, y.noteFailureShown(Z) && d(g.documentFailed(fe(j), de(g, re.failure.reason)));
|
|
3427
|
+
return;
|
|
3428
|
+
}
|
|
3429
|
+
h?.(j, re), !(!l || Q !== null && Q.path === j && Q.snapshot.document.kind !== "failure") && (G.current = J.current > 0, G.current || v.announce(g.documentShown(re.name)));
|
|
3430
|
+
});
|
|
3431
|
+
ee(() => {
|
|
3432
|
+
ro(e, t);
|
|
3433
|
+
}, [e, t]);
|
|
3434
|
+
const oo = le(() => {
|
|
3435
|
+
f.kind === "panel" && f.consume();
|
|
3436
|
+
}), Jt = le((j) => {
|
|
3437
|
+
const Z = C.current;
|
|
3438
|
+
if (Z === null || !m.current) return null;
|
|
3439
|
+
const { activeElement: Q, body: re } = Z.ownerDocument;
|
|
3440
|
+
return Q !== null && Q !== re ? null : fc(Z, T, j);
|
|
3441
|
+
}), so = le((j) => {
|
|
3442
|
+
const Z = G.current;
|
|
3443
|
+
G.current = !1, !r && (j && Jt(null), l && (j || Z) && T.kind !== "failure" && v.announce(g.documentShown(T.name)));
|
|
3444
|
+
});
|
|
3445
|
+
ee(() => {
|
|
3446
|
+
ie.count > 0 && so(ie.recovered);
|
|
3447
|
+
}, [ie]);
|
|
3448
|
+
const ao = le(() => {
|
|
3449
|
+
J.current > 0 || !G.current || (G.current = !1, l && !r && T.kind !== "failure" && v.announce(g.documentShown(T.name)));
|
|
3450
|
+
});
|
|
3451
|
+
ee(() => {
|
|
3452
|
+
Gt > 0 && ao();
|
|
3453
|
+
}, [Gt]);
|
|
3454
|
+
const io = le((j) => {
|
|
3455
|
+
const Z = C.current;
|
|
3456
|
+
Z !== null && qn(Z, j, m.current);
|
|
3457
|
+
}), lo = le((j) => u.reveal(j)), co = le((j) => yn(C.current, j, u));
|
|
3458
|
+
return ee(() => {
|
|
3459
|
+
if (r) return;
|
|
3460
|
+
const j = p.current.path !== e, Z = j || p.current.document !== T;
|
|
3461
|
+
p.current = { path: e, document: T };
|
|
3462
|
+
const Q = x.current !== e;
|
|
3463
|
+
x.current = e;
|
|
3464
|
+
let re = null;
|
|
3465
|
+
f.kind === "page" ? q.current !== f.navigation && (q.current = f.navigation, D.current += 1, re = f.fragment) : f.fragment !== null && (re = f.fragment, oo());
|
|
3466
|
+
const be = () => {
|
|
3467
|
+
const ye = re === null ? null : co(re);
|
|
3468
|
+
if (!Z) {
|
|
3469
|
+
ye !== null && io(ye);
|
|
3470
|
+
return;
|
|
3471
|
+
}
|
|
3472
|
+
const ze = Jt(f.fragment);
|
|
3473
|
+
j && ye === null && ze !== null && lo(ze);
|
|
3474
|
+
};
|
|
3475
|
+
Q ? queueMicrotask(be) : be();
|
|
3476
|
+
}, [f, e, T, r]), /* @__PURE__ */ c(we, { value: N, children: /* @__PURE__ */ c(Pe, { kind: T.kind, view: H, label: a(e, T), stale: Xt, busy: Xt, frameRef: C, intent: M, children: /* @__PURE__ */ c(Rr, { value: b, children: /* @__PURE__ */ c(di, { children: /* @__PURE__ */ c(kr, { value: no, children: /* @__PURE__ */ c(dc, { path: e, document: T, view: P, viewer: o, onRetry: S, editing: w }, e) }) }) }) }) });
|
|
3477
|
+
}, Zt = Object.freeze({ kind: "skeleton" }), gc = (e, t, n, r, o) => {
|
|
3478
|
+
if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
|
|
3479
|
+
const s = ge(t);
|
|
3480
|
+
if (s !== null) return { kind: "document", path: e, snapshot: s, stale: !0 };
|
|
3481
|
+
if (o && t?.status === "pending") return { kind: "streaming", path: e, promise: t.promise };
|
|
3482
|
+
const a = n === null || n === e ? null : ge(r);
|
|
3483
|
+
return n === null || a === null ? Zt : { kind: "document", path: n, snapshot: a, stale: !0 };
|
|
3484
|
+
}, wc = (e, t) => t.status === "deferred" ? Zt : { kind: "document", path: e, snapshot: t, stale: !1 }, vc = ({ requestedPath: e, content: t, markup: n, ...r }) => {
|
|
3485
|
+
const o = t.kind === "streaming" ? wc(t.path, se(t.promise)) : t;
|
|
3486
|
+
return o.kind !== "document" ? /* @__PURE__ */ c(Vt, { label: r.regionLabel(e, null) }) : /* @__PURE__ */ c(pc, { path: o.path, snapshot: o.snapshot, markup: n, stale: o.stale, ...r });
|
|
3487
|
+
}, Jr = ({ path: e, absence: t, markup: n, display: r, navigation: o, fragment: s, paneScroll: a, announces: i, announceFailure: f, onDocumentShown: u }) => {
|
|
3488
|
+
const { config: l, labels: d, locale: h, theme: g, documents: v, data: y } = $(), T = Ko(), C = U(!1);
|
|
3489
|
+
Y(() => {
|
|
3490
|
+
C.current = !0;
|
|
3491
|
+
}, []);
|
|
3492
|
+
const [R, q] = V(null), [D, m] = V(n), p = F(() => e === null ? void 0 : v.peek(e), [v, e]), x = oe(v.subscribe, p, p), A = F(() => R === null ? void 0 : v.peek(R), [v, R]), I = oe(v.subscribe, A, A);
|
|
3493
|
+
Y(() => e === null ? void 0 : v.open(e), [v, e]), Y(() => R === null ? void 0 : v.retain(R), [v, R]);
|
|
3494
|
+
const _ = e === null ? Zt : gc(e, x, R, I, !C.current), b = e === null ? null : _.kind === "document" && !_.stale ? _.path : R;
|
|
3495
|
+
b !== R && q(b);
|
|
3496
|
+
const S = _.kind !== "document" || _.path === e;
|
|
3497
|
+
S && n !== D && m(n);
|
|
3498
|
+
const M = X(() => Xi(d, h), [d, h]), L = X(() => ({ read: (O, N) => li(y, O, N) }), [y]), P = X(() => [...l.iframeHosts], [l]), H = o.kind === "panel", K = X(
|
|
3499
|
+
() => ({
|
|
3500
|
+
labels: M,
|
|
3501
|
+
spreadsheetLocale: h,
|
|
3502
|
+
emptyMessage: d.documentEmpty,
|
|
3503
|
+
theme: g,
|
|
3504
|
+
availableStyles: l.documentStyles,
|
|
3505
|
+
iFrameAllowedDomains: P,
|
|
3506
|
+
embeds: l.embeds,
|
|
3507
|
+
linkComponent: vi,
|
|
3508
|
+
toolbar: T,
|
|
3509
|
+
style: r.style,
|
|
3510
|
+
onStyleChange: r.onStyleChange,
|
|
3511
|
+
align: r.align,
|
|
3512
|
+
onAlignChange: r.onAlignChange,
|
|
3513
|
+
showToc: r.showToc,
|
|
3514
|
+
showStyle: r.showStyle,
|
|
3515
|
+
showAlign: r.showAlign,
|
|
3516
|
+
padding: r.padding,
|
|
3517
|
+
width: r.width === void 0 ? void 0 : `min(${r.width}, 100%)`,
|
|
3518
|
+
maxWidth: r.maxWidth === void 0 ? void 0 : `min(${r.maxWidth}, 100%)`,
|
|
3519
|
+
renderScrollBar: H ? void 0 : br,
|
|
3520
|
+
imageSource: L
|
|
3521
|
+
}),
|
|
3522
|
+
[M, h, d.documentEmpty, g, l.documentStyles, P, l.embeds, T, r, H, L]
|
|
3523
|
+
), w = F((O, N) => H ? N === null || N.kind === "failure" ? fe(O) : N.name : d.documentRegion, [H, d.documentRegion]), k = H ? "content" : "fill";
|
|
3524
|
+
return e === null ? /* @__PURE__ */ c(we, { value: k, children: /* @__PURE__ */ c(ac, { absence: t, announces: i, announceFailure: f }) }) : /* @__PURE__ */ c(we, { value: k, children: /* @__PURE__ */ c(Ie, { fallback: /* @__PURE__ */ c(Vt, { label: w(e, null) }), children: /* @__PURE__ */ c(
|
|
3525
|
+
vc,
|
|
3526
|
+
{
|
|
3527
|
+
requestedPath: e,
|
|
3528
|
+
content: _,
|
|
3529
|
+
markup: S ? n : D,
|
|
3530
|
+
viewer: K,
|
|
3531
|
+
editLayout: r.editLayout,
|
|
3532
|
+
regionLabel: w,
|
|
3533
|
+
navigation: o,
|
|
3534
|
+
fragment: s,
|
|
3535
|
+
paneScroll: a,
|
|
3536
|
+
announces: i,
|
|
3537
|
+
announceFailure: f,
|
|
3538
|
+
onDocumentShown: u
|
|
3539
|
+
}
|
|
3540
|
+
) }) });
|
|
3541
|
+
}, bc = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
|
|
3542
|
+
const { config: s, viewSettings: a, announcer: i } = $(), f = Je((I) => I.style), u = Je((I) => I.align), l = ot(), d = Xn(), h = $t(), { view: g, overrides: v, embed: y } = r, T = F(
|
|
3543
|
+
(I) => {
|
|
3544
|
+
if (h.kind !== "location") return;
|
|
3545
|
+
const _ = sc(s, h.location, I);
|
|
3546
|
+
_ !== null && l(_, "browse");
|
|
3547
|
+
},
|
|
3548
|
+
[s, l, h]
|
|
3549
|
+
), C = F(
|
|
3550
|
+
(I) => {
|
|
3551
|
+
a.update({ style: I }), T("style");
|
|
3552
|
+
},
|
|
3553
|
+
[a, T]
|
|
3554
|
+
), R = F(
|
|
3555
|
+
(I) => {
|
|
3556
|
+
a.update({ align: I }), T("align");
|
|
3557
|
+
},
|
|
3558
|
+
[a, T]
|
|
3559
|
+
), q = $r(s, v.style, f), D = _r(v.align, u), m = X(
|
|
3560
|
+
() => ({
|
|
3561
|
+
style: q,
|
|
3562
|
+
onStyleChange: C,
|
|
3563
|
+
align: D,
|
|
3564
|
+
onAlignChange: R,
|
|
3565
|
+
showToc: y.showToc !== !1,
|
|
3566
|
+
showStyle: y.showStyle !== !1,
|
|
3567
|
+
showAlign: y.showAlign !== !1,
|
|
3568
|
+
padding: y.padding,
|
|
3569
|
+
width: y.width,
|
|
3570
|
+
maxWidth: y.maxWidth,
|
|
3571
|
+
editLayout: "fill"
|
|
3572
|
+
}),
|
|
3573
|
+
[q, C, D, R, y]
|
|
3574
|
+
), p = X(() => ({ kind: "page", view: g, overrides: v, embed: y }), [g, v, y]), x = X(() => ({ kind: "page", fragment: d.hash, navigation: d }), [d]), A = F((I) => i.announce(I), [i]);
|
|
3575
|
+
return /* @__PURE__ */ c(Jr, { path: e, absence: t, markup: n, display: m, navigation: p, fragment: x, paneScroll: Ha, announces: !0, announceFailure: A, onDocumentShown: o });
|
|
3576
|
+
}, yc = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
|
|
3577
|
+
const { config: s, viewSettings: a } = $(), i = Je((p) => p.style), f = Je((p) => p.align), [u, l] = V(() => $r(s, void 0, i)), d = _r(void 0, f), h = F((p) => a.update({ align: p }), [a]), { maximized: g, onDocumentLink: v, pendingHash: y, onHashConsumed: T, announceFailure: C, paneScroll: R } = r, q = X(
|
|
3578
|
+
() => ({
|
|
3579
|
+
style: u,
|
|
3580
|
+
onStyleChange: l,
|
|
3581
|
+
align: d,
|
|
3582
|
+
onAlignChange: h,
|
|
3583
|
+
showToc: g,
|
|
3584
|
+
showStyle: g,
|
|
3585
|
+
showAlign: g,
|
|
3586
|
+
padding: void 0,
|
|
3587
|
+
width: void 0,
|
|
3588
|
+
maxWidth: void 0,
|
|
3589
|
+
editLayout: g ? "fill" : "content"
|
|
3590
|
+
}),
|
|
3591
|
+
[u, d, h, g]
|
|
3592
|
+
), D = X(() => ({ kind: "panel", onDocumentLink: v }), [v]), m = X(() => ({ kind: "panel", fragment: y, consume: T }), [y, T]);
|
|
3593
|
+
return /* @__PURE__ */ c(Jr, { path: e, absence: t, markup: n, display: q, navigation: D, fragment: m, paneScroll: R, announces: !1, announceFailure: C, onDocumentShown: o });
|
|
3594
|
+
}, kc = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => r.kind === "page" ? /* @__PURE__ */ c(bc, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) : /* @__PURE__ */ c(yc, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o });
|
|
3595
|
+
function Ec({
|
|
3596
|
+
title: e,
|
|
3597
|
+
titleId: t,
|
|
3598
|
+
...n
|
|
3599
|
+
}, r) {
|
|
3600
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
3601
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3602
|
+
viewBox: "0 0 24 24",
|
|
3603
|
+
fill: "currentColor",
|
|
3604
|
+
"aria-hidden": "true",
|
|
3605
|
+
"data-slot": "icon",
|
|
3606
|
+
ref: r,
|
|
3607
|
+
"aria-labelledby": t
|
|
3608
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
3609
|
+
id: t
|
|
3610
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
3611
|
+
fillRule: "evenodd",
|
|
3612
|
+
d: "M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z",
|
|
3613
|
+
clipRule: "evenodd"
|
|
3614
|
+
}));
|
|
3615
|
+
}
|
|
3616
|
+
const Sc = /* @__PURE__ */ E.forwardRef(Ec);
|
|
3617
|
+
function xc({
|
|
3618
|
+
title: e,
|
|
3619
|
+
titleId: t,
|
|
3620
|
+
...n
|
|
3621
|
+
}, r) {
|
|
3622
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
3623
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3624
|
+
viewBox: "0 0 24 24",
|
|
3625
|
+
fill: "currentColor",
|
|
3626
|
+
"aria-hidden": "true",
|
|
3627
|
+
"data-slot": "icon",
|
|
3628
|
+
ref: r,
|
|
3629
|
+
"aria-labelledby": t
|
|
3630
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
3631
|
+
id: t
|
|
3632
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
3633
|
+
fillRule: "evenodd",
|
|
3634
|
+
d: "M14.447 3.026a.75.75 0 0 1 .527.921l-4.5 16.5a.75.75 0 0 1-1.448-.394l4.5-16.5a.75.75 0 0 1 .921-.527ZM16.72 6.22a.75.75 0 0 1 1.06 0l5.25 5.25a.75.75 0 0 1 0 1.06l-5.25 5.25a.75.75 0 1 1-1.06-1.06L21.44 12l-4.72-4.72a.75.75 0 0 1 0-1.06Zm-9.44 0a.75.75 0 0 1 0 1.06L2.56 12l4.72 4.72a.75.75 0 0 1-1.06 1.06L.97 12.53a.75.75 0 0 1 0-1.06l5.25-5.25a.75.75 0 0 1 1.06 0Z",
|
|
3635
|
+
clipRule: "evenodd"
|
|
3636
|
+
}));
|
|
3637
|
+
}
|
|
3638
|
+
const Qr = /* @__PURE__ */ E.forwardRef(xc);
|
|
3639
|
+
function Tc({
|
|
3640
|
+
title: e,
|
|
3641
|
+
titleId: t,
|
|
3642
|
+
...n
|
|
3643
|
+
}, r) {
|
|
3644
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
3645
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3646
|
+
viewBox: "0 0 24 24",
|
|
3647
|
+
fill: "currentColor",
|
|
3648
|
+
"aria-hidden": "true",
|
|
3649
|
+
"data-slot": "icon",
|
|
3650
|
+
ref: r,
|
|
3651
|
+
"aria-labelledby": t
|
|
3652
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
3653
|
+
id: t
|
|
3654
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
3655
|
+
fillRule: "evenodd",
|
|
3656
|
+
d: "M15.75 2.25H21a.75.75 0 0 1 .75.75v5.25a.75.75 0 0 1-1.5 0V4.81L8.03 17.03a.75.75 0 0 1-1.06-1.06L19.19 3.75h-3.44a.75.75 0 0 1 0-1.5Zm-10.5 4.5a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h10.5a1.5 1.5 0 0 0 1.5-1.5V10.5a.75.75 0 0 1 1.5 0v8.25a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h8.25a.75.75 0 0 1 0 1.5H5.25Z",
|
|
3657
|
+
clipRule: "evenodd"
|
|
3658
|
+
}));
|
|
3659
|
+
}
|
|
3660
|
+
const Rc = /* @__PURE__ */ E.forwardRef(Tc);
|
|
3661
|
+
function Oc({
|
|
3662
|
+
title: e,
|
|
3663
|
+
titleId: t,
|
|
3664
|
+
...n
|
|
3665
|
+
}, r) {
|
|
3666
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
3667
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3668
|
+
viewBox: "0 0 24 24",
|
|
3669
|
+
fill: "currentColor",
|
|
3670
|
+
"aria-hidden": "true",
|
|
3671
|
+
"data-slot": "icon",
|
|
3672
|
+
ref: r,
|
|
3673
|
+
"aria-labelledby": t
|
|
3674
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
3675
|
+
id: t
|
|
3676
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
3677
|
+
fillRule: "evenodd",
|
|
3678
|
+
d: "M11.47 13.28a.75.75 0 0 0 1.06 0l7.5-7.5a.75.75 0 0 0-1.06-1.06L12 11.69 5.03 4.72a.75.75 0 0 0-1.06 1.06l7.5 7.5Z",
|
|
3679
|
+
clipRule: "evenodd"
|
|
3680
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
3681
|
+
fillRule: "evenodd",
|
|
3682
|
+
d: "M11.47 19.28a.75.75 0 0 0 1.06 0l7.5-7.5a.75.75 0 1 0-1.06-1.06L12 17.69l-6.97-6.97a.75.75 0 0 0-1.06 1.06l7.5 7.5Z",
|
|
3683
|
+
clipRule: "evenodd"
|
|
3684
|
+
}));
|
|
3685
|
+
}
|
|
3686
|
+
const Cc = /* @__PURE__ */ E.forwardRef(Oc);
|
|
3687
|
+
function Mc({
|
|
3688
|
+
title: e,
|
|
3689
|
+
titleId: t,
|
|
3690
|
+
...n
|
|
3691
|
+
}, r) {
|
|
3692
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
3693
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3694
|
+
viewBox: "0 0 24 24",
|
|
3695
|
+
fill: "currentColor",
|
|
3696
|
+
"aria-hidden": "true",
|
|
3697
|
+
"data-slot": "icon",
|
|
3698
|
+
ref: r,
|
|
3699
|
+
"aria-labelledby": t
|
|
3700
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
3701
|
+
id: t
|
|
3702
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
3703
|
+
fillRule: "evenodd",
|
|
3704
|
+
d: "M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-3.75V6Z",
|
|
3705
|
+
clipRule: "evenodd"
|
|
3706
|
+
}));
|
|
3707
|
+
}
|
|
3708
|
+
const Lc = /* @__PURE__ */ E.forwardRef(Mc);
|
|
3709
|
+
function Ac({
|
|
3710
|
+
title: e,
|
|
3711
|
+
titleId: t,
|
|
3712
|
+
...n
|
|
3713
|
+
}, r) {
|
|
3714
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
3715
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3716
|
+
viewBox: "0 0 24 24",
|
|
3717
|
+
fill: "currentColor",
|
|
3718
|
+
"aria-hidden": "true",
|
|
3719
|
+
"data-slot": "icon",
|
|
3720
|
+
ref: r,
|
|
3721
|
+
"aria-labelledby": t
|
|
3722
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
3723
|
+
id: t
|
|
3724
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
3725
|
+
fillRule: "evenodd",
|
|
3726
|
+
d: "M9 1.5H5.625c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5Zm6.61 10.936a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 14.47a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",
|
|
3727
|
+
clipRule: "evenodd"
|
|
3728
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
3729
|
+
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"
|
|
3730
|
+
}));
|
|
3731
|
+
}
|
|
3732
|
+
const Nc = /* @__PURE__ */ E.forwardRef(Ac);
|
|
3733
|
+
function Dc({
|
|
3734
|
+
title: e,
|
|
3735
|
+
titleId: t,
|
|
3736
|
+
...n
|
|
3737
|
+
}, r) {
|
|
3738
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
3739
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3740
|
+
viewBox: "0 0 24 24",
|
|
3741
|
+
fill: "currentColor",
|
|
3742
|
+
"aria-hidden": "true",
|
|
3743
|
+
"data-slot": "icon",
|
|
3744
|
+
ref: r,
|
|
3745
|
+
"aria-labelledby": t
|
|
3746
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
3747
|
+
id: t
|
|
3748
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
3749
|
+
d: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"
|
|
3750
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
3751
|
+
fillRule: "evenodd",
|
|
3752
|
+
d: "M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",
|
|
3753
|
+
clipRule: "evenodd"
|
|
3754
|
+
}));
|
|
3755
|
+
}
|
|
3756
|
+
const Pc = /* @__PURE__ */ E.forwardRef(Dc);
|
|
3757
|
+
function Ic({
|
|
3758
|
+
title: e,
|
|
3759
|
+
titleId: t,
|
|
3760
|
+
...n
|
|
3761
|
+
}, r) {
|
|
3762
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
3763
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3764
|
+
viewBox: "0 0 24 24",
|
|
3765
|
+
fill: "currentColor",
|
|
3766
|
+
"aria-hidden": "true",
|
|
3767
|
+
"data-slot": "icon",
|
|
3768
|
+
ref: r,
|
|
3769
|
+
"aria-labelledby": t
|
|
3770
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
3771
|
+
id: t
|
|
3772
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
3773
|
+
d: "M21.731 2.269a2.625 2.625 0 0 0-3.712 0l-1.157 1.157 3.712 3.712 1.157-1.157a2.625 2.625 0 0 0 0-3.712ZM19.513 8.199l-3.712-3.712-8.4 8.4a5.25 5.25 0 0 0-1.32 2.214l-.8 2.685a.75.75 0 0 0 .933.933l2.685-.8a5.25 5.25 0 0 0 2.214-1.32l8.4-8.4Z"
|
|
3774
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
3775
|
+
d: "M5.25 5.25a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h10.5a3 3 0 0 0 3-3V13.5a.75.75 0 0 0-1.5 0v5.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5V8.25a1.5 1.5 0 0 1 1.5-1.5h5.25a.75.75 0 0 0 0-1.5H5.25Z"
|
|
3776
|
+
}));
|
|
3777
|
+
}
|
|
3778
|
+
const $c = /* @__PURE__ */ E.forwardRef(Ic);
|
|
3779
|
+
function _c({
|
|
3780
|
+
title: e,
|
|
3781
|
+
titleId: t,
|
|
3782
|
+
...n
|
|
3783
|
+
}, r) {
|
|
3784
|
+
return /* @__PURE__ */ E.createElement("svg", Object.assign({
|
|
3785
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3786
|
+
viewBox: "0 0 24 24",
|
|
3787
|
+
fill: "currentColor",
|
|
3788
|
+
"aria-hidden": "true",
|
|
3789
|
+
"data-slot": "icon",
|
|
3790
|
+
ref: r,
|
|
3791
|
+
"aria-labelledby": t
|
|
3792
|
+
}, n), e ? /* @__PURE__ */ E.createElement("title", {
|
|
3793
|
+
id: t
|
|
3794
|
+
}, e) : null, /* @__PURE__ */ E.createElement("path", {
|
|
3795
|
+
d: "M15 3.75H9v16.5h6V3.75ZM16.5 20.25h3.375c1.035 0 1.875-.84 1.875-1.875V5.625c0-1.036-.84-1.875-1.875-1.875H16.5v16.5ZM4.125 3.75H7.5v16.5H4.125a1.875 1.875 0 0 1-1.875-1.875V5.625c0-1.036.84-1.875 1.875-1.875Z"
|
|
3796
|
+
}));
|
|
3797
|
+
}
|
|
3798
|
+
const Fc = /* @__PURE__ */ E.forwardRef(_c), qc = ({ href: e, onRetry: t, testId: n }) => {
|
|
3799
|
+
const { labels: r, onEditGrant: o } = $(), [s, a] = V(!1), i = () => {
|
|
3800
|
+
o === void 0 || s || (a(!0), o(e).then((f) => {
|
|
3801
|
+
f && t();
|
|
3802
|
+
}).finally(() => a(!1)));
|
|
3803
|
+
};
|
|
3804
|
+
return /* @__PURE__ */ B("div", { className: "aqmx-callout aqmx-edit-grant", "data-testid": n, children: [
|
|
3805
|
+
/* @__PURE__ */ c("p", { className: "aqmx-callout-title", children: r.editGrantTitle }),
|
|
3806
|
+
/* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: r.editGrantBody }),
|
|
3807
|
+
/* @__PURE__ */ B("div", { className: "aqmx-edit-grant-actions", children: [
|
|
3808
|
+
o === void 0 ? /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e, target: "_blank", rel: "noopener", "data-testid": `${n}-open`, children: r.editGrantAction }) : (
|
|
3809
|
+
/* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": s, "data-testid": `${n}-open`, onClick: i, children: r.editGrantAction })
|
|
3810
|
+
),
|
|
3811
|
+
/* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-testid": `${n}-retry`, onClick: t, children: r.editGrantRetry })
|
|
3812
|
+
] })
|
|
3813
|
+
] });
|
|
3814
|
+
}, Bc = "Control+E Meta+E", Uc = (e, t, n) => n && t ? "split" : e.view, Bn = (e, t, n, r) => {
|
|
3815
|
+
if (n === "split") {
|
|
3816
|
+
e.setSideBySide(!0);
|
|
3817
|
+
return;
|
|
3818
|
+
}
|
|
3819
|
+
e.setView(t, n), r && e.sideBySide() && e.setSideBySide(!1);
|
|
3820
|
+
}, ou = (e) => e === "split" ? null : e, Hc = (e) => e === "preview" ? "editor" : "preview", zc = (e) => /Mac|iPhone|iPad|iPod/u.test(e), jc = (e, t) => {
|
|
3821
|
+
if (e.isComposing || e.altKey || e.shiftKey || (t ? !e.metaKey || e.ctrlKey : !e.ctrlKey || e.metaKey)) return !1;
|
|
3822
|
+
const n = e.key.toLowerCase();
|
|
3823
|
+
return n === "e" || e.code === "KeyE" && /^\p{L}$/u.test(n) && !/^[a-z]$/u.test(n);
|
|
3824
|
+
}, Un = (e, t, n) => {
|
|
3825
|
+
const r = e.modifiedAt === null ? Number.NaN : Date.parse(e.modifiedAt);
|
|
3826
|
+
return n(Number.isNaN(r) ? e.id : t.format(r), e.author === null ? "" : e.author);
|
|
3827
|
+
}, Vc = ({ path: e, documentName: t, open: n, onClose: r }) => {
|
|
3828
|
+
const { data: o, edits: s, labels: a, locale: i, announcer: f } = $(), u = Te(), [l, d] = V(null), [h, g] = V(0), [v, y] = V(null), [T, C] = V(null), R = X(() => new Intl.DateTimeFormat(i, { dateStyle: "medium", timeStyle: "short" }), [i]), q = F(() => {
|
|
3829
|
+
y(null), C(null);
|
|
3830
|
+
}, []), D = fr({ open: n, onOpen: q, onDismiss: r });
|
|
3831
|
+
ee(() => {
|
|
3832
|
+
if (!n) return;
|
|
3833
|
+
const x = new AbortController();
|
|
3834
|
+
return d(null), o.revisions(e, x.signal).then((A) => {
|
|
3835
|
+
"kind" in A && d(A);
|
|
3836
|
+
}), () => x.abort();
|
|
3837
|
+
}, [n, o, e, h]), ee(() => {
|
|
3838
|
+
if (!n || v === null) return;
|
|
3839
|
+
const x = new AbortController();
|
|
3840
|
+
return C(null), o.revision(e, v, x.signal).then((A) => {
|
|
3841
|
+
"kind" in A && C(A);
|
|
3842
|
+
}), () => x.abort();
|
|
3843
|
+
}, [n, o, e, v]);
|
|
3844
|
+
const m = () => {
|
|
3845
|
+
T === null || T.kind !== "revision" || (s.replaceDraft(e, T.text), f.announce(a.historyRestored(t)), r());
|
|
3846
|
+
}, p = l !== null && l.kind === "revisions" ? l.revisions.find((x) => x.id === v) : void 0;
|
|
3847
|
+
return /* @__PURE__ */ c("dialog", { ...D, className: "aqmx-confirm aqmx-history", "aria-labelledby": u, "data-testid": "markdown-explorer-history", children: /* @__PURE__ */ B("div", { className: "aqmx-confirm-panel aqmx-history-panel", children: [
|
|
3848
|
+
/* @__PURE__ */ c("p", { id: u, className: "aqmx-confirm-title", children: a.historyTitle(t) }),
|
|
3849
|
+
l === null ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: a.historyLoading }) : l.kind === "failure" ? /* @__PURE__ */ c(Re, { failure: l.failure, alert: !1, onRetry: () => g((x) => x + 1), testId: "markdown-explorer-history-failure" }) : l.revisions.length === 0 ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: a.historyEmpty }) : /* @__PURE__ */ c("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: l.revisions.map((x) => /* @__PURE__ */ c("li", { children: /* @__PURE__ */ B("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": x.id === v, "data-testid": "markdown-explorer-history-entry", onClick: () => y(x.id), children: [
|
|
3850
|
+
/* @__PURE__ */ c("span", { children: Un(x, R, a.historyEntry) }),
|
|
3851
|
+
x.current ? /* @__PURE__ */ c("span", { className: "aqmx-history-mark", children: a.historyCurrent }) : null,
|
|
3852
|
+
x.kept ? /* @__PURE__ */ c("span", { className: "aqmx-history-mark", children: a.historyKept }) : null
|
|
3853
|
+
] }) }, x.id)) }),
|
|
3854
|
+
v === null ? null : T === null ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", children: a.historyLoading }) : T.kind === "failure" ? /* @__PURE__ */ c(Re, { failure: T.failure, alert: !1, testId: "markdown-explorer-history-revision-failure" }) : (
|
|
3855
|
+
/* @__PURE__ */ c("section", { className: "aqmx-history-text", tabIndex: 0, "aria-label": p === void 0 ? a.historyTitle(t) : Un(p, R, a.historyEntry), "data-testid": "markdown-explorer-history-text", children: /* @__PURE__ */ c("pre", { children: T.text }) })
|
|
3856
|
+
),
|
|
3857
|
+
/* @__PURE__ */ B("div", { className: "aqmx-confirm-actions", children: [
|
|
3858
|
+
/* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-testid": "markdown-explorer-history-close", onClick: r, children: a.historyClose }),
|
|
3859
|
+
/* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": T === null || T.kind !== "revision", "data-testid": "markdown-explorer-history-restore", onClick: m, children: a.historyRestore })
|
|
3860
|
+
] })
|
|
3861
|
+
] }) });
|
|
3862
|
+
}, Zc = (e) => {
|
|
3863
|
+
const { documents: t } = $(), n = F(() => t.peek(e), [t, e]), r = F(() => t.peekSeeded(e), [t, e]), o = oe(t.subscribe, n, r), s = ge(o)?.document;
|
|
3864
|
+
return s === void 0 || s.kind === "failure" ? { edit: null, name: fe(e) } : { edit: s.kind === "markdown" || s.kind === "spreadsheet" ? s.edit : null, name: s.name };
|
|
3865
|
+
}, me = (e) => {
|
|
3866
|
+
e.stopPropagation();
|
|
3867
|
+
}, Wc = ({ path: e, documentName: t, iconOnly: n, previewAvailable: r, draft: o }) => {
|
|
3868
|
+
const { draftConverter: s, edits: a, labels: i } = $(), f = oe(
|
|
3869
|
+
a.subscribe,
|
|
3870
|
+
() => a.session(e) !== void 0,
|
|
3871
|
+
() => !1
|
|
3872
|
+
), [u, l] = V(null), d = () => {
|
|
3873
|
+
if (!f) {
|
|
3874
|
+
a.start(e, a.viewAnchor(e));
|
|
3875
|
+
return;
|
|
3876
|
+
}
|
|
3877
|
+
a.flush(e);
|
|
3878
|
+
const y = a.session(e);
|
|
3879
|
+
y?.dirty === !0 ? l(y.save.kind === "draft" ? "draft" : "unsaved") : a.close(e);
|
|
3880
|
+
}, h = () => {
|
|
3881
|
+
f || (js(), r && a.sideBySide() && s?.prepare?.());
|
|
3882
|
+
}, g = n ? o ? i.editDraftDocumentNamed(t) : i.editDocumentNamed(t) : null, v = o ? i.editDraftDocument : i.editDocument;
|
|
3883
|
+
return /* @__PURE__ */ B(pe, { children: [
|
|
3884
|
+
/* @__PURE__ */ B(
|
|
3885
|
+
"button",
|
|
3886
|
+
{
|
|
3887
|
+
type: "button",
|
|
3888
|
+
className: g === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
|
|
3889
|
+
title: f ? i.closeEditor : g === null ? v : g,
|
|
3890
|
+
"aria-label": g === null ? void 0 : g,
|
|
3891
|
+
"aria-pressed": f,
|
|
3892
|
+
"data-testid": "markdown-explorer-document-edit",
|
|
3893
|
+
onClick: d,
|
|
3894
|
+
onDoubleClick: me,
|
|
3895
|
+
onPointerEnter: h,
|
|
3896
|
+
onFocus: h,
|
|
3897
|
+
children: [
|
|
3898
|
+
/* @__PURE__ */ c($c, { "aria-hidden": "true" }),
|
|
3899
|
+
g === null ? /* @__PURE__ */ c("span", { children: i.editDocumentLabel }) : null
|
|
3900
|
+
]
|
|
3901
|
+
}
|
|
3902
|
+
),
|
|
3903
|
+
/* @__PURE__ */ c(
|
|
3904
|
+
mr,
|
|
3905
|
+
{
|
|
3906
|
+
open: u !== null,
|
|
3907
|
+
title: u === "draft" ? i.draftDiscardTitle : i.unsavedTitle,
|
|
3908
|
+
body: u === "draft" ? i.draftDiscardBody(t) : i.unsavedBody(t),
|
|
3909
|
+
confirmLabel: i.unsavedDiscard,
|
|
3910
|
+
cancelLabel: i.unsavedStay,
|
|
3911
|
+
testId: "markdown-explorer-edit-close-confirm",
|
|
3912
|
+
onConfirm: () => {
|
|
3913
|
+
l(null), a.close(e);
|
|
3914
|
+
},
|
|
3915
|
+
onCancel: () => l(null)
|
|
3916
|
+
}
|
|
3917
|
+
)
|
|
3918
|
+
] });
|
|
3919
|
+
}, Gc = ({ href: e, documentName: t, iconOnly: n }) => {
|
|
3920
|
+
const { labels: r } = $(), o = n ? r.editExternallyNamed(t) : null;
|
|
3921
|
+
return /* @__PURE__ */ B(
|
|
3922
|
+
"a",
|
|
3923
|
+
{
|
|
3924
|
+
className: o === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
|
|
3925
|
+
href: e,
|
|
3926
|
+
target: "_blank",
|
|
3927
|
+
rel: "noopener noreferrer",
|
|
3928
|
+
title: o === null ? r.editExternally : o,
|
|
3929
|
+
"aria-label": o === null ? void 0 : o,
|
|
3930
|
+
"data-testid": "markdown-explorer-document-edit-external",
|
|
3931
|
+
onDoubleClick: me,
|
|
3932
|
+
children: [
|
|
3933
|
+
/* @__PURE__ */ c(Rc, { "aria-hidden": "true" }),
|
|
3934
|
+
o === null ? /* @__PURE__ */ c("span", { children: r.editExternallyLabel }) : null
|
|
3935
|
+
]
|
|
3936
|
+
}
|
|
3937
|
+
);
|
|
3938
|
+
}, Kc = ({ session: e }) => {
|
|
3939
|
+
const { labels: t } = $(), n = ms(t, e);
|
|
3940
|
+
return /* @__PURE__ */ c("p", { className: "aqmx-edit-status", title: n === "" ? void 0 : n, "data-testid": "markdown-explorer-edit-status", "data-aqmx-save": e.save.kind, children: n });
|
|
3941
|
+
}, Yc = Object.freeze(["editor", "split", "preview"]), Xc = Object.freeze(["editor", "preview"]), Jc = Object.freeze({ editor: Qr, split: Fc, preview: Pc }), Qc = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
|
|
3942
|
+
const { draftConverter: s, edits: a, labels: i } = $(), f = qs(), u = Uc(r, f, o), l = o ? Yc : Xc, d = Te(), h = U(/* @__PURE__ */ new Map()), g = {
|
|
3943
|
+
editor: { label: i.editViewEditor, tooltip: i.editViewEditorTooltip },
|
|
3944
|
+
split: { label: i.editViewSplit, tooltip: i.editViewSplitTooltip },
|
|
3945
|
+
preview: { label: i.editViewPreview, tooltip: i.editViewPreviewTooltip }
|
|
3946
|
+
}, v = () => {
|
|
3947
|
+
a.preparePreview(e), s?.prepare?.();
|
|
3948
|
+
}, y = (T) => {
|
|
3949
|
+
if (!jc(T.nativeEvent, zc(navigator.platform))) return;
|
|
3950
|
+
dr(T);
|
|
3951
|
+
const C = Hc(u);
|
|
3952
|
+
Bn(a, e, C, o), h.current.get(C)?.focus();
|
|
3953
|
+
};
|
|
3954
|
+
return /* @__PURE__ */ c("div", { role: "radiogroup", "aria-label": n ? i.editViewNamed(t) : i.editView, className: "aqmx-edit-view", "data-testid": "markdown-explorer-edit-view", onKeyDown: y, children: l.map((T) => {
|
|
3955
|
+
const C = Jc[T], { label: R, tooltip: q } = g[T], D = T === "preview" ? v : void 0;
|
|
3956
|
+
return /* @__PURE__ */ B("label", { className: n ? "aqmx-icon-button" : "aqmx-icon-button aqmx-labelled-button", children: [
|
|
3957
|
+
/* @__PURE__ */ c(
|
|
3958
|
+
"input",
|
|
3959
|
+
{
|
|
3960
|
+
ref: (m) => {
|
|
3961
|
+
m === null ? h.current.delete(T) : h.current.set(T, m);
|
|
3962
|
+
},
|
|
3963
|
+
type: "radio",
|
|
3964
|
+
name: d,
|
|
3965
|
+
value: T,
|
|
3966
|
+
checked: T === u,
|
|
3967
|
+
"aria-label": R,
|
|
3968
|
+
"aria-keyshortcuts": T === "split" ? void 0 : Bc,
|
|
3969
|
+
title: q,
|
|
3970
|
+
"data-testid": `markdown-explorer-edit-view-${T}`,
|
|
3971
|
+
onChange: () => Bn(a, e, T, o),
|
|
3972
|
+
onDoubleClick: me,
|
|
3973
|
+
onPointerEnter: D,
|
|
3974
|
+
onFocus: D
|
|
3975
|
+
}
|
|
3976
|
+
),
|
|
3977
|
+
/* @__PURE__ */ c(C, { "aria-hidden": "true" }),
|
|
3978
|
+
n ? null : /* @__PURE__ */ c("span", { children: R })
|
|
3979
|
+
] }, T);
|
|
3980
|
+
}) });
|
|
3981
|
+
}, ed = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
|
|
3982
|
+
const { edits: s, labels: a } = $(), [i, f] = V(!1);
|
|
3983
|
+
if (r.phase.kind !== "editing") return null;
|
|
3984
|
+
const u = r.save.kind === "saving", l = u || !r.dirty, d = () => {
|
|
3985
|
+
s.flush(e);
|
|
3986
|
+
const g = s.session(e);
|
|
3987
|
+
g === void 0 || !g.dirty || g.save.kind === "saving" || s.save(e);
|
|
3988
|
+
}, h = (g) => n ? { className: "aqmx-icon-button", "aria-label": g } : { className: "aqmx-icon-button aqmx-labelled-button" };
|
|
3989
|
+
return /* @__PURE__ */ B(pe, { children: [
|
|
3990
|
+
r.save.kind === "conflicts" ? /* @__PURE__ */ B("button", { type: "button", ...h(a.conflictNext), title: a.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => s.nextConflict(e), onDoubleClick: me, children: [
|
|
3991
|
+
/* @__PURE__ */ c(Cc, { "aria-hidden": "true" }),
|
|
3992
|
+
n ? null : /* @__PURE__ */ c("span", { children: a.conflictNext })
|
|
3993
|
+
] }) : null,
|
|
3994
|
+
/* @__PURE__ */ c(Qc, { path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }),
|
|
3995
|
+
r.history ? /* @__PURE__ */ B("button", { type: "button", ...h(a.historyOpen), title: a.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => f(!0), onDoubleClick: me, children: [
|
|
3996
|
+
/* @__PURE__ */ c(Lc, { "aria-hidden": "true" }),
|
|
3997
|
+
n ? null : /* @__PURE__ */ c("span", { children: a.historyOpen })
|
|
3998
|
+
] }) : null,
|
|
3999
|
+
r.save.kind === "draft" ? null : /* @__PURE__ */ B("button", { type: "button", ...h(a.saveDraft), title: a.saveDraftTooltip, "aria-disabled": l, "aria-busy": u, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: d, onDoubleClick: me, children: [
|
|
4000
|
+
/* @__PURE__ */ c(Nc, { "aria-hidden": "true" }),
|
|
4001
|
+
n ? null : /* @__PURE__ */ c("span", { children: a.saveDraft })
|
|
4002
|
+
] }),
|
|
4003
|
+
r.history ? /* @__PURE__ */ c(Vc, { path: e, documentName: t, open: i, onClose: () => f(!1) }) : null
|
|
4004
|
+
] });
|
|
4005
|
+
}, td = ({ path: e, session: t }) => {
|
|
4006
|
+
const { edits: n } = $();
|
|
4007
|
+
return t.save.kind !== "grant" ? null : /* @__PURE__ */ c(qc, { href: t.save.href, onRetry: () => {
|
|
4008
|
+
n.save(e);
|
|
4009
|
+
}, testId: "markdown-explorer-save-grant" });
|
|
4010
|
+
}, nd = /* @__PURE__ */ new Set(), rd = (e, t, n) => {
|
|
4011
|
+
const { documents: r, announcer: o, labels: s } = $(), a = F(() => r.peek(e), [r, e]), i = F(() => r.peekSeeded(e), [r, e]), f = oe(r.subscribe, a, i), u = F(() => r.answerStampOf(e), [r, e]), l = oe(r.subscribe, u, u), [d] = V(() => /* @__PURE__ */ new Set()), [h, g] = V(nd), [v, y] = V(null);
|
|
4012
|
+
v !== null && (v.path !== e || v.markup !== n) && y(null);
|
|
4013
|
+
const T = U(null);
|
|
4014
|
+
Y(() => (T.current = e, () => {
|
|
4015
|
+
T.current = null;
|
|
4016
|
+
}), [e]);
|
|
4017
|
+
const C = U(n);
|
|
4018
|
+
Y(() => {
|
|
4019
|
+
C.current = n;
|
|
4020
|
+
}, [n]);
|
|
4021
|
+
const R = F(() => {
|
|
4022
|
+
const m = e, p = r.peek(m);
|
|
4023
|
+
d.has(m) || p?.status === "pending" || (d.add(m), g(new Set(d)), y(null), (async () => {
|
|
4024
|
+
try {
|
|
4025
|
+
const x = await r.refresh(m);
|
|
4026
|
+
if (T.current !== m || x.status === "superseded") return;
|
|
4027
|
+
if (x.status === "failed") {
|
|
4028
|
+
y({ path: m, failure: x.failure, stamp: r.answerStampOf(m), markup: C.current }), o.announce(s.documentRefreshFailed(de(s, x.failure.reason)));
|
|
4029
|
+
return;
|
|
4030
|
+
}
|
|
4031
|
+
if (x.status === "shown" && (t || x.failed)) return;
|
|
4032
|
+
const A = ge(r.peek(m));
|
|
4033
|
+
if (A === null || A.document.kind === "failure") return;
|
|
4034
|
+
o.announce(s.documentRefreshed(A.document.name));
|
|
4035
|
+
} finally {
|
|
4036
|
+
d.delete(m), g(new Set(d));
|
|
4037
|
+
}
|
|
4038
|
+
})());
|
|
4039
|
+
}, [e, t, d, r, o, s]), q = h.has(e), D = v !== null && v.path === e && v.stamp === l && v.markup === n ? v.failure : null;
|
|
4040
|
+
return { refreshing: q, unavailable: q || f?.status === "pending", failure: D, refresh: R };
|
|
4041
|
+
}, od = (e, t) => {
|
|
4042
|
+
switch (t) {
|
|
4043
|
+
case "markdown":
|
|
4044
|
+
return e.showMarkup;
|
|
4045
|
+
case "svg":
|
|
4046
|
+
return e.showSvgMarkup;
|
|
4047
|
+
case "csv":
|
|
4048
|
+
case "tsv":
|
|
4049
|
+
return e.showSpreadsheetMarkup(t.toUpperCase());
|
|
4050
|
+
}
|
|
4051
|
+
}, sd = Object.freeze({ kind: "page" }), ad = ({ path: e, placement: t, markup: n }) => {
|
|
4052
|
+
const { labels: r } = $(), { refreshing: o, unavailable: s, failure: a, refresh: i } = rd(e, t.kind === "page", n.shown), f = Ii(e), u = Zc(e), l = pr(e), d = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, h = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, g = t.kind === "panel", v = t.kind === "panel" ? t.documentName : u.name, y = t.kind === "page" || t.maximized;
|
|
4053
|
+
return /* @__PURE__ */ B("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", "data-aqmx-editing": l === void 0 ? void 0 : "true", children: [
|
|
4054
|
+
/* @__PURE__ */ B("div", { className: "aqmx-document-refresh-row", children: [
|
|
4055
|
+
l === void 0 ? null : /* @__PURE__ */ c(Kc, { session: l }),
|
|
4056
|
+
l === void 0 ? null : /* @__PURE__ */ c(ed, { path: e, documentName: v, iconOnly: g, session: l, previewAvailable: y }),
|
|
4057
|
+
l === void 0 && f !== null ? /* @__PURE__ */ B(
|
|
4058
|
+
"button",
|
|
4059
|
+
{
|
|
4060
|
+
type: "button",
|
|
4061
|
+
className: h === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
|
|
4062
|
+
title: h === null ? od(r, f) : h,
|
|
4063
|
+
"aria-label": h === null ? void 0 : h,
|
|
4064
|
+
"aria-pressed": n.shown,
|
|
4065
|
+
"data-testid": "markdown-explorer-document-markup",
|
|
4066
|
+
onClick: n.toggle,
|
|
4067
|
+
onDoubleClick: me,
|
|
4068
|
+
children: [
|
|
4069
|
+
/* @__PURE__ */ c(Qr, { "aria-hidden": "true" }),
|
|
4070
|
+
h === null ? /* @__PURE__ */ c("span", { children: r.showMarkupLabel }) : null
|
|
4071
|
+
]
|
|
4072
|
+
}
|
|
4073
|
+
) : null,
|
|
4074
|
+
l !== void 0 || u.edit?.kind === "inline" || u.edit?.kind === "draft" ? /* @__PURE__ */ c(Wc, { path: e, documentName: v, iconOnly: g, previewAvailable: y, draft: u.edit?.kind === "draft" }) : u.edit?.kind === "external" ? /* @__PURE__ */ c(Gc, { href: u.edit.href, documentName: v, iconOnly: g }) : null,
|
|
4075
|
+
l === void 0 ? /* @__PURE__ */ B(
|
|
4076
|
+
"button",
|
|
4077
|
+
{
|
|
4078
|
+
type: "button",
|
|
4079
|
+
className: d === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
|
|
4080
|
+
title: d === null ? r.refreshDocument : d,
|
|
4081
|
+
"aria-label": d === null ? void 0 : d,
|
|
4082
|
+
"aria-disabled": s,
|
|
4083
|
+
"aria-busy": o,
|
|
4084
|
+
"data-aqmx-busy": o ? "true" : void 0,
|
|
4085
|
+
"data-testid": "markdown-explorer-document-refresh",
|
|
4086
|
+
onClick: i,
|
|
4087
|
+
onDoubleClick: me,
|
|
4088
|
+
children: [
|
|
4089
|
+
/* @__PURE__ */ c(Sc, { "aria-hidden": "true" }),
|
|
4090
|
+
d === null ? /* @__PURE__ */ c("span", { children: r.refreshDocumentLabel }) : null
|
|
4091
|
+
]
|
|
4092
|
+
}
|
|
4093
|
+
) : null
|
|
4094
|
+
] }),
|
|
4095
|
+
l !== void 0 || a === null ? null : /* @__PURE__ */ c("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": a.reason, children: r.documentRefreshFailed(de(r, a.reason)) }),
|
|
4096
|
+
l === void 0 ? null : /* @__PURE__ */ c(td, { path: e, session: l })
|
|
4097
|
+
] });
|
|
4098
|
+
}, id = ({ location: e }) => {
|
|
4099
|
+
const t = e.doc, n = X(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), r = $i(e);
|
|
4100
|
+
return /* @__PURE__ */ B("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", ...Ct, children: [
|
|
4101
|
+
/* @__PURE__ */ c(ad, { path: t, placement: sd, markup: r }),
|
|
4102
|
+
/* @__PURE__ */ c(kc, { path: t, absence: oc, markup: e.markup, variant: n })
|
|
4103
|
+
] });
|
|
4104
|
+
}, ld = ({ holds: e, testId: t }) => {
|
|
4105
|
+
const { labels: n, announcer: r } = $(), o = Te();
|
|
4106
|
+
Y(() => e ? r.claim(o) : void 0, [e, r, o]);
|
|
4107
|
+
const s = F(() => r.shownIn(o), [r, o]), a = oe(r.subscribe, s, s);
|
|
4108
|
+
return /* @__PURE__ */ c("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] });
|
|
4109
|
+
}, ke = Object.freeze([]), cd = (e) => {
|
|
4110
|
+
const t = /* @__PURE__ */ new Set();
|
|
4111
|
+
let n = ke, r = [], o = !1;
|
|
4112
|
+
const s = [], a = (l) => {
|
|
4113
|
+
n = l;
|
|
4114
|
+
for (const d of [...t]) d();
|
|
4115
|
+
}, i = () => s.at(-1)?.region, f = (l) => {
|
|
4116
|
+
const d = i();
|
|
4117
|
+
l(), i() !== d && n !== ke && a(ke);
|
|
4118
|
+
}, u = () => {
|
|
4119
|
+
o = !1;
|
|
4120
|
+
const l = r.map((d) => "sentence" in d ? d.sentence : d.list(d.items));
|
|
4121
|
+
r = [], a(Object.freeze(l));
|
|
4122
|
+
};
|
|
4123
|
+
return {
|
|
4124
|
+
announce: (l) => {
|
|
4125
|
+
if (typeof l == "string") r.push({ sentence: l });
|
|
4126
|
+
else {
|
|
4127
|
+
const d = r.find((h) => "list" in h && h.list === l.list);
|
|
4128
|
+
d !== void 0 && "items" in d ? d.items.push(l.item) : r.push({ list: l.list, items: [l.item] });
|
|
4129
|
+
}
|
|
4130
|
+
o || (o = !0, n !== ke && a(ke), e.request(u));
|
|
4131
|
+
},
|
|
4132
|
+
subscribe: (l) => (t.add(l), () => {
|
|
4133
|
+
t.delete(l);
|
|
4134
|
+
}),
|
|
4135
|
+
claim: (l) => {
|
|
4136
|
+
const d = { region: l };
|
|
4137
|
+
return f(() => s.push(d)), () => f(() => {
|
|
4138
|
+
const h = s.indexOf(d);
|
|
4139
|
+
h !== -1 && s.splice(h, 1);
|
|
4140
|
+
});
|
|
4141
|
+
},
|
|
4142
|
+
shownIn: (l) => i() === l ? n : ke
|
|
4143
|
+
};
|
|
4144
|
+
}, ue = Object.freeze({ status: "cancelled" }), Hn = (e) => {
|
|
4145
|
+
if (e === null || typeof e != "object") return null;
|
|
4146
|
+
const { failure: t } = e;
|
|
4147
|
+
if (Do(t) !== null) return null;
|
|
4148
|
+
const { reason: n, code: r } = t;
|
|
4149
|
+
return Po(n, r);
|
|
4150
|
+
}, dd = ({ dataPath: e, onScope: t, fetch: n }) => {
|
|
4151
|
+
const r = n ?? ((l, d) => globalThis.fetch(l, d)), o = (l, d) => `${e}/${l}?${new URLSearchParams(d).toString()}`, s = (l) => {
|
|
4152
|
+
l.status === 401 && t(null);
|
|
4153
|
+
const d = l.headers.get(No);
|
|
4154
|
+
d !== null && t(d);
|
|
4155
|
+
}, a = async (l, d, h, g) => {
|
|
4156
|
+
let v;
|
|
4157
|
+
try {
|
|
4158
|
+
v = await r(l, { credentials: "same-origin", ...d, headers: { Accept: "application/json", ...d.headers } });
|
|
4159
|
+
} catch {
|
|
4160
|
+
return g({ reason: "failed" });
|
|
4161
|
+
}
|
|
4162
|
+
s(v);
|
|
4163
|
+
let y;
|
|
4164
|
+
try {
|
|
4165
|
+
y = await v.json();
|
|
4166
|
+
} catch {
|
|
4167
|
+
return g({ reason: dt(v.status) });
|
|
4168
|
+
}
|
|
4169
|
+
let T;
|
|
4170
|
+
try {
|
|
4171
|
+
T = h(y);
|
|
4172
|
+
} catch {
|
|
4173
|
+
T = !1;
|
|
4174
|
+
}
|
|
4175
|
+
if (T) return y;
|
|
4176
|
+
const C = Hn(y);
|
|
4177
|
+
return g(C !== null ? C : { reason: v.status === 200 ? "failed" : dt(v.status) });
|
|
4178
|
+
}, i = { [on]: qo }, f = { [on]: jo, "Content-Type": `${zo}; charset=utf-8` }, u = async (l, d, h) => {
|
|
4179
|
+
const g = await a(l, d, h, (v) => ut(v.reason, v.code));
|
|
4180
|
+
return d.signal.aborted ? ue : g;
|
|
4181
|
+
};
|
|
4182
|
+
return {
|
|
4183
|
+
tree: (l) => a(o("tree", { [te.source]: l }), { method: "GET" }, rn, (d) => ({ status: "error", failure: d })),
|
|
4184
|
+
children: async (l, d, h) => {
|
|
4185
|
+
const g = await a(o("children", { [te.source]: l, [te.path]: d }), { method: "GET", signal: h }, Fo, (v) => ({ status: "error", failure: v }));
|
|
4186
|
+
return h.aborted ? ue : g;
|
|
4187
|
+
},
|
|
4188
|
+
ancestors: async (l, d, h) => {
|
|
4189
|
+
const g = await a(o("ancestors", { [te.source]: l, [te.path]: d }), { method: "GET", signal: h }, _o, (v) => ({ status: "error", failure: v }));
|
|
4190
|
+
return h.aborted ? ue : g;
|
|
4191
|
+
},
|
|
4192
|
+
reveal: async (l, d, h) => {
|
|
4193
|
+
const g = await a(o("reveal", { [te.source]: l, [te.path]: d }), { method: "GET", signal: h }, $o, (v) => ({ status: "error", failure: v }));
|
|
4194
|
+
return h.aborted ? ue : g;
|
|
4195
|
+
},
|
|
4196
|
+
document: (l, { refresh: d }) => a(o("document", { [te.path]: l }), d ? { method: "GET", headers: i } : { method: "GET" }, Wo, (h) => ut(h.reason, h.code)),
|
|
4197
|
+
text: async (l, d) => {
|
|
4198
|
+
const h = await a(o("text", { [te.path]: l }), { method: "GET", signal: d }, Io, (g) => ut(g.reason, g.code));
|
|
4199
|
+
return d.aborted ? ue : h;
|
|
4200
|
+
},
|
|
4201
|
+
asset: async (l, d) => {
|
|
4202
|
+
let h;
|
|
4203
|
+
try {
|
|
4204
|
+
h = await r(l, { method: "GET", credentials: "same-origin", signal: d });
|
|
4205
|
+
} catch {
|
|
4206
|
+
return d.aborted ? ue : { status: "error", failure: { reason: "failed" } };
|
|
4207
|
+
}
|
|
4208
|
+
if (s(h), h.ok)
|
|
4209
|
+
return d.aborted ? ue : { status: "ok", body: h.body === null ? new ReadableStream({ start: (y) => y.close() }) : h.body };
|
|
4210
|
+
let g = null;
|
|
4211
|
+
try {
|
|
4212
|
+
g = await h.json();
|
|
4213
|
+
} catch {
|
|
4214
|
+
}
|
|
4215
|
+
if (d.aborted) return ue;
|
|
4216
|
+
const v = Hn(g);
|
|
4217
|
+
return { status: "error", failure: v === null ? { reason: dt(h.status) } : v };
|
|
4218
|
+
},
|
|
4219
|
+
edit: (l, d) => u(o("edit", { [te.path]: l }), { method: "GET", signal: d }, Zo),
|
|
4220
|
+
save: (l, d, h, g) => u(o("save", { [te.path]: l, [te.base]: d }), { method: "POST", headers: f, body: h, signal: g }, Vo),
|
|
4221
|
+
preview: (l, d, h) => u(o("preview", { [te.path]: l }), { method: "POST", headers: f, body: d, signal: h }, Ho),
|
|
4222
|
+
revisions: (l, d) => u(o("revisions", { [te.path]: l }), { method: "GET", signal: d }, Uo),
|
|
4223
|
+
revision: (l, d, h) => u(o("revision", { [te.path]: l, [te.revision]: d }), { method: "GET", signal: h }, Bo),
|
|
4224
|
+
refresh: (l) => a(o("refresh", { [te.source]: l }), { method: "POST", headers: i }, rn, (d) => ({ status: "error", failure: d }))
|
|
4225
|
+
};
|
|
4226
|
+
}, ud = () => {
|
|
4227
|
+
let e = null, t = null;
|
|
4228
|
+
return {
|
|
4229
|
+
settle: (n) => {
|
|
4230
|
+
e = n;
|
|
4231
|
+
},
|
|
4232
|
+
mayMove: (n) => e !== n,
|
|
4233
|
+
move: (n, r, o) => {
|
|
4234
|
+
e = r, t = { sourceId: n, path: r, ancestors: o };
|
|
4235
|
+
},
|
|
4236
|
+
take: (n, r) => {
|
|
4237
|
+
const o = t !== null && t.sourceId === n && t.path === r ? t.ancestors : null;
|
|
4238
|
+
return t = null, o;
|
|
4239
|
+
}
|
|
4240
|
+
};
|
|
4241
|
+
}, fd = (e) => {
|
|
4242
|
+
const t = Ot(e);
|
|
4243
|
+
if (t === null) return tn;
|
|
4244
|
+
try {
|
|
4245
|
+
return Oo(JSON.parse(t));
|
|
4246
|
+
} catch (n) {
|
|
4247
|
+
return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), tn;
|
|
4248
|
+
}
|
|
4249
|
+
}, zn = (e, t) => {
|
|
4250
|
+
let n = null;
|
|
4251
|
+
const r = () => {
|
|
4252
|
+
if (n === null) {
|
|
4253
|
+
const s = fd(e);
|
|
4254
|
+
n = { changes: s, settings: en(t, s) };
|
|
4255
|
+
}
|
|
4256
|
+
return n;
|
|
4257
|
+
}, o = qe();
|
|
4258
|
+
return {
|
|
4259
|
+
storageKey: e,
|
|
4260
|
+
defaults: t,
|
|
4261
|
+
getSnapshot: () => r().settings,
|
|
4262
|
+
getServerSnapshot: () => t,
|
|
4263
|
+
subscribe: o.subscribe,
|
|
4264
|
+
advance: (s) => {
|
|
4265
|
+
const { changes: a, settings: i } = r(), f = xo(a, s, To(i, s)[s], t);
|
|
4266
|
+
return n = { changes: f, settings: en(t, f) }, o.emit(), Rt(e, Ro(f)), n.settings;
|
|
4267
|
+
}
|
|
4268
|
+
};
|
|
4269
|
+
}, md = Object.freeze({ status: "refreshed" }), hd = Object.freeze({ status: "superseded" }), Dt = Object.freeze({ status: "deferred" }), pd = hr(Dt), eo = 4, gd = eo - 1, jn = Object.freeze({ status: "loading" }), wd = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), vd = (e) => {
|
|
4270
|
+
const t = /* @__PURE__ */ new Map(), n = yr(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), i = qe(), f = /* @__PURE__ */ new Set();
|
|
4271
|
+
let u = 0, l = 0;
|
|
4272
|
+
const d = { direct: null, bulk: null }, h = /* @__PURE__ */ new Set();
|
|
4273
|
+
let g = !1, v = 0;
|
|
4274
|
+
const y = () => {
|
|
4275
|
+
v += 1, i.emit();
|
|
4276
|
+
}, T = (w) => o.get(w) ?? 0, C = (w) => {
|
|
4277
|
+
let k = a.get(w);
|
|
4278
|
+
return k === void 0 && (k = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, a.set(w, k)), k;
|
|
4279
|
+
}, R = (w, k, O) => {
|
|
4280
|
+
w.inFlight.delete(k), u -= 1, O.lane === "bulk" && (l -= 1);
|
|
4281
|
+
}, q = (w) => {
|
|
4282
|
+
const k = a.get(w);
|
|
4283
|
+
if (k !== void 0) {
|
|
4284
|
+
for (const [O, N] of [...k.inFlight])
|
|
4285
|
+
R(k, O, N), N.controller.abort();
|
|
4286
|
+
k.direct.clear(), k.bulk.clear(), k.unclaimed.clear();
|
|
4287
|
+
}
|
|
4288
|
+
}, D = (w) => {
|
|
4289
|
+
const k = T(w) + 1;
|
|
4290
|
+
return o.set(w, k), q(w), k;
|
|
4291
|
+
}, m = (w, k) => {
|
|
4292
|
+
const O = Ae(w), N = { promise: w, opened: k, stale: !1, loadedAt: O?.status === "ok" ? O.loadedAt : null };
|
|
4293
|
+
return w.status === "pending" && w.then((z) => {
|
|
4294
|
+
z.status === "ok" && (N.loadedAt = z.loadedAt);
|
|
4295
|
+
}), N;
|
|
4296
|
+
}, p = (w) => {
|
|
4297
|
+
let k = r.get(w);
|
|
4298
|
+
return k === void 0 && (k = /* @__PURE__ */ new Map(), r.set(w, k)), k;
|
|
4299
|
+
}, x = (w) => {
|
|
4300
|
+
const k = [...a.keys()], O = d[w], N = O === null ? 0 : k.indexOf(O) + 1;
|
|
4301
|
+
for (let z = 0; z < k.length; z += 1) {
|
|
4302
|
+
const W = k[(N + z) % k.length], J = W === void 0 ? void 0 : a.get(W);
|
|
4303
|
+
if (!(W === void 0 || J === void 0)) {
|
|
4304
|
+
for (const G of J[w])
|
|
4305
|
+
if ((J.claims.get(G) ?? 0) !== 0)
|
|
4306
|
+
return J[w].delete(G), d[w] = W, { sourceId: W, path: G };
|
|
4307
|
+
}
|
|
4308
|
+
}
|
|
4309
|
+
return null;
|
|
4310
|
+
}, A = (w, k, O, N) => {
|
|
4311
|
+
const z = a.get(w);
|
|
4312
|
+
if (z === void 0 || z.inFlight.get(k) !== O) return;
|
|
4313
|
+
R(z, k, O);
|
|
4314
|
+
const W = (z.claims.get(k) ?? 0) > 0, J = p(w);
|
|
4315
|
+
if (N.status === "ok" ? J.set(k, { status: "loaded", entries: N.entries }) : N.status === "error" && W ? J.set(k, { status: "failed", failure: N.failure }) : J.delete(k), y(), N.status === "error" && W) {
|
|
4316
|
+
const G = { sourceId: w, path: k, failure: N.failure };
|
|
4317
|
+
for (const ie of [...f]) ie(G);
|
|
4318
|
+
}
|
|
4319
|
+
_();
|
|
4320
|
+
}, I = (w, k, O) => {
|
|
4321
|
+
const N = { controller: new AbortController(), lane: O };
|
|
4322
|
+
C(w).inFlight.set(k, N), u += 1, O === "bulk" && (l += 1), e.children(w, k, N.controller.signal).then(
|
|
4323
|
+
(z) => A(w, k, N, z),
|
|
4324
|
+
() => A(w, k, N, wd)
|
|
4325
|
+
);
|
|
4326
|
+
}, _ = () => {
|
|
4327
|
+
for (; u < eo; ) {
|
|
4328
|
+
const w = x("direct");
|
|
4329
|
+
if (w !== null) {
|
|
4330
|
+
I(w.sourceId, w.path, "direct");
|
|
4331
|
+
continue;
|
|
4332
|
+
}
|
|
4333
|
+
const k = l < gd ? x("bulk") : null;
|
|
4334
|
+
if (k === null) return;
|
|
4335
|
+
I(k.sourceId, k.path, "bulk");
|
|
4336
|
+
}
|
|
4337
|
+
}, b = (w, k, O) => {
|
|
4338
|
+
if (!(k.direct.delete(O) || k.bulk.delete(O))) {
|
|
4339
|
+
const z = k.inFlight.get(O);
|
|
4340
|
+
if (z === void 0) return !1;
|
|
4341
|
+
R(k, O, z), z.controller.abort();
|
|
4342
|
+
}
|
|
4343
|
+
return r.get(w)?.delete(O), !0;
|
|
4344
|
+
}, S = () => {
|
|
4345
|
+
g = !1;
|
|
4346
|
+
let w = !1;
|
|
4347
|
+
for (const k of h) {
|
|
4348
|
+
const O = C(k);
|
|
4349
|
+
for (const N of O.unclaimed)
|
|
4350
|
+
(O.claims.get(N) ?? 0) === 0 && b(k, O, N) && (w = !0);
|
|
4351
|
+
O.unclaimed.clear();
|
|
4352
|
+
}
|
|
4353
|
+
h.clear(), w && (y(), _());
|
|
4354
|
+
}, M = (w, k) => {
|
|
4355
|
+
t.set(w, m($e(e.tree(w)), k));
|
|
4356
|
+
}, L = (w, k, O) => {
|
|
4357
|
+
D(w);
|
|
4358
|
+
const N = m(hr(k), O);
|
|
4359
|
+
return t.set(w, N), r.delete(w), y(), _(), N;
|
|
4360
|
+
}, P = (w, k, O, N) => {
|
|
4361
|
+
if (O !== T(w) || t.get(w) !== k) return;
|
|
4362
|
+
const z = Ae(k.promise);
|
|
4363
|
+
if (!(N.status !== "ok" || z?.status !== "ok" || k.loadedAt === null || N.loadedAt <= k.loadedAt)) {
|
|
4364
|
+
if (et(z.entries, N.entries)) {
|
|
4365
|
+
k.loadedAt = N.loadedAt;
|
|
4366
|
+
return;
|
|
4367
|
+
}
|
|
4368
|
+
L(w, N, k.opened);
|
|
4369
|
+
}
|
|
4370
|
+
}, H = (w, k) => {
|
|
4371
|
+
const O = t.get(w);
|
|
4372
|
+
return O !== void 0 && Ae(O.promise)?.status === k;
|
|
4373
|
+
}, K = (w, k) => {
|
|
4374
|
+
k.stale = !1;
|
|
4375
|
+
const O = T(w);
|
|
4376
|
+
e.tree(w).then((N) => P(w, k, O, N));
|
|
4377
|
+
};
|
|
4378
|
+
return {
|
|
4379
|
+
read: (w) => t.get(w)?.promise ?? pd,
|
|
4380
|
+
open: (w) => {
|
|
4381
|
+
const k = n.resumes(w), O = n.hold(w), N = t.get(w);
|
|
4382
|
+
return N === void 0 || H(w, "deferred") ? (M(w, !0), y()) : k || (N.opened && H(w, "error") ? (M(w, !0), y()) : (N.opened = !0, N.stale && H(w, "ok") && K(w, N))), O;
|
|
4383
|
+
},
|
|
4384
|
+
retry: (w) => {
|
|
4385
|
+
H(w, "error") && (M(w, !0), y());
|
|
4386
|
+
},
|
|
4387
|
+
seed: (w, k) => {
|
|
4388
|
+
const O = k.then(
|
|
4389
|
+
(W) => W === null ? Dt : W,
|
|
4390
|
+
() => Dt
|
|
4391
|
+
), N = t.get(w);
|
|
4392
|
+
if (N !== void 0 && H(w, "ok")) {
|
|
4393
|
+
const W = T(w);
|
|
4394
|
+
O.then((J) => P(w, N, W, J));
|
|
4395
|
+
return;
|
|
4396
|
+
}
|
|
4397
|
+
D(w);
|
|
4398
|
+
const z = m($e(O), N?.opened === !0);
|
|
4399
|
+
t.set(w, z), r.delete(w), _(), O.then((W) => {
|
|
4400
|
+
t.get(w) === z && (W.status === "deferred" && n.isHeld(w) && M(w, z.opened), y());
|
|
4401
|
+
});
|
|
4402
|
+
},
|
|
4403
|
+
refresh: async (w) => {
|
|
4404
|
+
const k = (s.get(w) ?? 0) + 1;
|
|
4405
|
+
s.set(w, k);
|
|
4406
|
+
const O = await e.refresh(w);
|
|
4407
|
+
if (s.get(w) !== k) return hd;
|
|
4408
|
+
if (O.status === "error") return { status: "failed", failure: O.failure };
|
|
4409
|
+
const N = t.get(w);
|
|
4410
|
+
if (!(N !== void 0 && N.loadedAt !== null && H(w, "ok") && N.loadedAt > O.loadedAt)) {
|
|
4411
|
+
const W = L(w, O, !0);
|
|
4412
|
+
if (N !== void 0 && N.promise.status === "pending") {
|
|
4413
|
+
const J = T(w);
|
|
4414
|
+
N.promise.then((G) => P(w, W, J, G));
|
|
4415
|
+
}
|
|
4416
|
+
}
|
|
4417
|
+
for (const [W, J] of t)
|
|
4418
|
+
W !== w && Ae(J.promise)?.status === "ok" && (J.stale = !0);
|
|
4419
|
+
return md;
|
|
4420
|
+
},
|
|
4421
|
+
children: (w, k) => r.get(w)?.get(k),
|
|
4422
|
+
claimChildren: (w, k) => {
|
|
4423
|
+
const O = C(w), N = p(w);
|
|
4424
|
+
let z = !1, W = !1;
|
|
4425
|
+
for (const [G, ie] of k)
|
|
4426
|
+
O.claims.set(G, (O.claims.get(G) ?? 0) + 1), N.get(G) === void 0 ? (N.set(G, jn), O[ie].add(G), z = !0, W = !0) : ie === "direct" && O.bulk.delete(G) && (O.direct.add(G), W = !0);
|
|
4427
|
+
z && y(), W && _();
|
|
4428
|
+
let J = !1;
|
|
4429
|
+
return () => {
|
|
4430
|
+
if (!J) {
|
|
4431
|
+
J = !0;
|
|
4432
|
+
for (const G of k.keys()) {
|
|
4433
|
+
const ie = (O.claims.get(G) ?? 0) - 1;
|
|
4434
|
+
ie > 0 ? O.claims.set(G, ie) : (O.claims.delete(G), O.unclaimed.add(G));
|
|
4435
|
+
}
|
|
4436
|
+
h.add(w), !g && (g = !0, queueMicrotask(S));
|
|
4437
|
+
}
|
|
4438
|
+
};
|
|
4439
|
+
},
|
|
4440
|
+
retryChildren: (w, k) => {
|
|
4441
|
+
const O = r.get(w);
|
|
4442
|
+
if (O === void 0 || O.get(k)?.status !== "failed") return;
|
|
4443
|
+
const N = C(w);
|
|
4444
|
+
if ((N.claims.get(k) ?? 0) > 0) {
|
|
4445
|
+
O.set(k, jn), N.direct.add(k), y(), _();
|
|
4446
|
+
return;
|
|
4447
|
+
}
|
|
4448
|
+
O.delete(k), y();
|
|
4449
|
+
},
|
|
4450
|
+
pendingChildren: (w) => {
|
|
4451
|
+
const k = a.get(w);
|
|
4452
|
+
return k === void 0 ? 0 : k.direct.size + k.bulk.size + k.inFlight.size;
|
|
4453
|
+
},
|
|
4454
|
+
clear: () => {
|
|
4455
|
+
for (const w of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...a.keys()])) D(w);
|
|
4456
|
+
for (const [w, k] of s) s.set(w, k + 1);
|
|
4457
|
+
t.clear(), r.clear(), y();
|
|
4458
|
+
},
|
|
4459
|
+
subscribeChildrenFailures: (w) => (f.add(w), () => {
|
|
4460
|
+
f.delete(w);
|
|
4461
|
+
}),
|
|
4462
|
+
subscribe: i.subscribe,
|
|
4463
|
+
version: () => v
|
|
4464
|
+
};
|
|
4465
|
+
}, bd = (e, t) => {
|
|
4466
|
+
let n = e;
|
|
4467
|
+
const r = qe();
|
|
4468
|
+
return {
|
|
4469
|
+
getSnapshot: () => n,
|
|
4470
|
+
subscribe: r.subscribe,
|
|
4471
|
+
update: (o) => {
|
|
4472
|
+
n = { ...n, ...o }, t(n), r.emit();
|
|
4473
|
+
}
|
|
4474
|
+
};
|
|
4475
|
+
}, yd = 1;
|
|
4476
|
+
let We = 0, he = null;
|
|
4477
|
+
const kd = () => {
|
|
4478
|
+
const { documentElement: e, body: t } = document;
|
|
4479
|
+
We === 0 && (he = { 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"), We += 1;
|
|
4480
|
+
let n = !1;
|
|
4481
|
+
return () => {
|
|
4482
|
+
n || (n = !0, We -= 1, !(We > 0 || he === null) && (e.style.overflow = he.htmlOverflow, t.style.overflow = he.bodyOverflow, e.style.scrollbarGutter = he.htmlGutter, t.style.scrollbarGutter = he.bodyGutter, he = null));
|
|
4483
|
+
};
|
|
4484
|
+
}, Ed = [
|
|
4485
|
+
{ selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
|
|
4486
|
+
{ selector: "[data-aqmx-explorer-body]", name: "tree area" }
|
|
4487
|
+
], Vn = 1, Sd = 1e3, Zn = (e) => e.getClientRects().length > 0, St = "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.", xd = (e) => {
|
|
4488
|
+
if (!Zn(e)) return null;
|
|
4489
|
+
const t = e.getBoundingClientRect(), n = window.innerHeight;
|
|
4490
|
+
if (t.bottom > n + yd)
|
|
4491
|
+
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. ${St}`;
|
|
4492
|
+
if (t.height < Vn)
|
|
4493
|
+
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. ${St}`;
|
|
4494
|
+
for (const { selector: r, name: o } of Ed)
|
|
4495
|
+
for (const s of e.querySelectorAll(r)) {
|
|
4496
|
+
if (!Zn(s)) continue;
|
|
4497
|
+
const a = s.getBoundingClientRect().height;
|
|
4498
|
+
if (a < Vn)
|
|
4499
|
+
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. ${St}`;
|
|
4500
|
+
}
|
|
4501
|
+
return null;
|
|
4502
|
+
}, Td = (e) => {
|
|
4503
|
+
let t = !1, n;
|
|
4504
|
+
const r = () => {
|
|
4505
|
+
n = void 0;
|
|
4506
|
+
const a = xd(e);
|
|
4507
|
+
a !== null && (t = !0, console.error(a));
|
|
4508
|
+
}, o = () => {
|
|
4509
|
+
t || (clearTimeout(n), n = setTimeout(r, Sd));
|
|
4510
|
+
}, s = typeof ResizeObserver > "u" ? null : new ResizeObserver(o);
|
|
4511
|
+
return s?.observe(e), window.addEventListener("resize", o), o(), () => {
|
|
4512
|
+
clearTimeout(n), s?.disconnect(), window.removeEventListener("resize", o);
|
|
4513
|
+
};
|
|
4514
|
+
}, Rd = (e, t) => {
|
|
4515
|
+
ee(() => e ? kd() : void 0, [e]), ee(() => {
|
|
4516
|
+
const n = t.current;
|
|
4517
|
+
if (!(!e || n === null))
|
|
4518
|
+
return Td(n);
|
|
4519
|
+
}, [e, t]);
|
|
4520
|
+
}, Wn = '[data-testid="markdown-explorer-view-switch"]', Od = [
|
|
4521
|
+
{ control: Wn, successors: [Wn, '[data-testid="markdown-explorer-sheet-toggle"]'] },
|
|
4522
|
+
{ control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
|
|
4523
|
+
], Cd = (e) => {
|
|
4524
|
+
for (const t of Od) {
|
|
4525
|
+
const n = e.closest(t.control);
|
|
4526
|
+
if (n !== null) return { element: n, control: t };
|
|
4527
|
+
}
|
|
4528
|
+
return null;
|
|
4529
|
+
}, Md = (e, t) => {
|
|
4530
|
+
const n = U(null);
|
|
4531
|
+
ee(() => {
|
|
4532
|
+
const o = (i) => {
|
|
4533
|
+
const f = e.current;
|
|
4534
|
+
n.current = f !== null && i instanceof Element && f.contains(i) ? Cd(i) : null;
|
|
4535
|
+
}, s = (i) => o(i.target);
|
|
4536
|
+
o(document.activeElement);
|
|
4537
|
+
const a = (i) => {
|
|
4538
|
+
const f = i.target;
|
|
4539
|
+
i.relatedTarget !== null || !(f instanceof Element) || queueMicrotask(() => {
|
|
4540
|
+
n.current?.element === f && f.isConnected && document.activeElement !== f && (n.current = null);
|
|
4541
|
+
});
|
|
4542
|
+
};
|
|
4543
|
+
return document.addEventListener("focusin", s), document.addEventListener("focusout", a), () => {
|
|
4544
|
+
document.removeEventListener("focusin", s), document.removeEventListener("focusout", a);
|
|
4545
|
+
};
|
|
4546
|
+
}, [e]);
|
|
4547
|
+
const r = U(t);
|
|
4548
|
+
Y(() => {
|
|
4549
|
+
if (r.current === t) return;
|
|
4550
|
+
r.current = t;
|
|
4551
|
+
const o = n.current;
|
|
4552
|
+
if (o === null) return;
|
|
4553
|
+
const s = () => {
|
|
4554
|
+
const f = document.activeElement;
|
|
4555
|
+
if (f !== null && f !== document.body && f !== o.element) return !0;
|
|
4556
|
+
const u = e.current;
|
|
4557
|
+
if (u === null) return !0;
|
|
4558
|
+
for (const l of o.control.successors)
|
|
4559
|
+
for (const d of u.querySelectorAll(l))
|
|
4560
|
+
if (d !== o.element && (d.focus({ preventScroll: !0 }), document.activeElement === d))
|
|
4561
|
+
return !0;
|
|
4562
|
+
return !1;
|
|
4563
|
+
};
|
|
4564
|
+
if (s()) return;
|
|
4565
|
+
const a = e.current;
|
|
4566
|
+
if (a === null) return;
|
|
4567
|
+
const i = new MutationObserver(() => {
|
|
4568
|
+
s() && i.disconnect();
|
|
4569
|
+
});
|
|
4570
|
+
return i.observe(a, { childList: !0, subtree: !0 }), () => i.disconnect();
|
|
4571
|
+
}, [t, e]);
|
|
4572
|
+
}, Ld = Pt(() => import("./TreeLayout-DjIVKBG4.js").then((e) => ({ default: e.TreeLayout }))), Ad = Pt(() => import("./MultiLayout-B-ft4_Vs.js").then((e) => ({ default: e.MultiLayout }))), Nd = 64, Dd = {
|
|
4573
|
+
request: (e) => {
|
|
4574
|
+
requestAnimationFrame(e);
|
|
4575
|
+
}
|
|
4576
|
+
}, Gn = (e) => {
|
|
4577
|
+
e.documents.clear(), e.trees.clear();
|
|
4578
|
+
}, xt = (e, t) => {
|
|
4579
|
+
t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
|
|
4580
|
+
for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
|
|
4581
|
+
}, Pd = (e, t) => {
|
|
4582
|
+
const [n, r] = V(() => ({ overrides: t, locale: e, labels: dn(e, t) }));
|
|
4583
|
+
if (n.locale === e && us(n.overrides, t)) return n.labels;
|
|
4584
|
+
const o = { overrides: t, locale: e, labels: dn(e, t) };
|
|
4585
|
+
return r(o), o.labels;
|
|
4586
|
+
}, Id = (e, t, n) => {
|
|
4587
|
+
const [r, o] = V(() => ({ scope: t, store: zn(e, n) }));
|
|
4588
|
+
if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
|
|
4589
|
+
const s = { scope: t, store: zn(e, n) };
|
|
4590
|
+
return o(s), s.store;
|
|
4591
|
+
}, Tt = (e, t) => {
|
|
4592
|
+
const [n, r] = V(() => ({ scope: e, value: t() }));
|
|
4593
|
+
if (n.scope === e) return n.value;
|
|
4594
|
+
const o = { scope: e, value: t() };
|
|
4595
|
+
return r(o), o.value;
|
|
4596
|
+
}, $d = () => cd(Dd), Kn = "on", _d = "off", Fd = Object.freeze({ kind: "unavailable" }), qd = (e) => {
|
|
4597
|
+
if (e !== void 0 && (e === null || typeof e != "object" || typeof e.convert != "function"))
|
|
4598
|
+
throw new TypeError("[markdown-explorer] draftConverter must be an object with a convert function");
|
|
4599
|
+
}, Bd = (e, t) => {
|
|
4600
|
+
const n = ge(e.peek(t));
|
|
4601
|
+
return n === null || n.document.kind === "failure" ? fe(t) : n.document.name;
|
|
4602
|
+
}, su = ({
|
|
4603
|
+
data: e,
|
|
4604
|
+
config: t,
|
|
4605
|
+
storageNamespace: n,
|
|
4606
|
+
locale: r,
|
|
4607
|
+
labels: o,
|
|
4608
|
+
theme: s,
|
|
4609
|
+
renderFrame: a,
|
|
4610
|
+
renderTreeFailure: i,
|
|
4611
|
+
lockDocumentScroll: f = !1,
|
|
4612
|
+
onMathDiagnostics: u,
|
|
4613
|
+
onEditGrant: l,
|
|
4614
|
+
draftConverter: d
|
|
4615
|
+
}) => {
|
|
4616
|
+
ts(n), qd(d);
|
|
4617
|
+
const h = ir(r), g = fs(s), v = Pd(h, o), { revalidate: y } = wo(), T = U(() => {
|
|
4618
|
+
}), C = nt(t.dataPath), [R] = V(() => {
|
|
4619
|
+
const O = dd({ dataPath: C, onScope: (z) => T.current(z) }), N = { documents: ha({ client: O, capacity: Math.max(Nd, t.multiView.maxPanels * 2) }), trees: vd(O) };
|
|
4620
|
+
return xt(N, e), ln(n, e.scope), { data: O, ...N, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
|
|
4621
|
+
});
|
|
4622
|
+
if (R.aligned.pageData !== e || R.aligned.storageNamespace !== n) {
|
|
4623
|
+
const O = R.aligned.pageData;
|
|
4624
|
+
R.aligned.pageData = e, R.aligned.storageNamespace = n, O !== e && (O.scope !== e.scope ? R.aligned.pendingReader = e : xt(R, e)), ln(n, e.scope);
|
|
4625
|
+
}
|
|
4626
|
+
const q = Id(Ce(n).treeSettings, e.scope, t.defaultTreeSettings);
|
|
4627
|
+
Y(() => {
|
|
4628
|
+
const O = R.aligned.pendingReader;
|
|
4629
|
+
O !== null && (R.aligned.pendingReader = null, Gn(R), xt(R, O));
|
|
4630
|
+
}, [e, R]), Y(() => {
|
|
4631
|
+
let O = !1;
|
|
4632
|
+
return T.current = (N) => {
|
|
4633
|
+
N === e.scope || O || (O = !0, N !== null && (Gn(R), ns(n)), y());
|
|
4634
|
+
}, () => {
|
|
4635
|
+
T.current = () => {
|
|
4636
|
+
};
|
|
4637
|
+
};
|
|
4638
|
+
}, [e, y, R, n]);
|
|
4639
|
+
const D = U(t.settingsCookie);
|
|
4640
|
+
Y(() => {
|
|
4641
|
+
D.current = t.settingsCookie;
|
|
4642
|
+
}, [t.settingsCookie]);
|
|
4643
|
+
const [m] = V(
|
|
4644
|
+
() => bd(e.settings, (O) => {
|
|
4645
|
+
document.cookie = Mo(D.current, O, window.location.protocol === "https:");
|
|
4646
|
+
})
|
|
4647
|
+
), p = Tt(e.scope, $d), x = Tt(e.scope, ud), A = U(v);
|
|
4648
|
+
Y(() => {
|
|
4649
|
+
A.current = v;
|
|
4650
|
+
}, [v]);
|
|
4651
|
+
const I = Tt(
|
|
4652
|
+
e.scope,
|
|
4653
|
+
() => Ss({
|
|
4654
|
+
data: R.data,
|
|
4655
|
+
conflictLabels: () => ({ ours: A.current.conflictOurs, theirs: A.current.conflictTheirs }),
|
|
4656
|
+
onSaveSettled: (O, N) => {
|
|
4657
|
+
N.kind === "saved" && R.documents.refresh(O);
|
|
4658
|
+
const z = hs(A.current, N, Bd(R.documents, O));
|
|
4659
|
+
z !== null && p.announce(z);
|
|
4660
|
+
},
|
|
4661
|
+
sideBySideSetting: {
|
|
4662
|
+
read: () => Ot(Ce(n).editPreview) === Kn,
|
|
4663
|
+
write: (O) => Rt(Ce(n).editPreview, O ? Kn : _d)
|
|
4664
|
+
},
|
|
4665
|
+
editorShareSetting: {
|
|
4666
|
+
read: () => Es(Ot(Ce(n).editSplit)),
|
|
4667
|
+
write: (O) => Rt(Ce(n).editSplit, String(O))
|
|
4668
|
+
}
|
|
4669
|
+
})
|
|
4670
|
+
), _ = X(() => $e(e.notices.catch(() => [])), [e.notices]), b = e.sources.map((O) => O.id).join(`
|
|
4671
|
+
`), S = X(() => Co(t, b.split(`
|
|
4672
|
+
`)), [t, b]), M = U(u);
|
|
4673
|
+
Y(() => {
|
|
4674
|
+
M.current = u;
|
|
4675
|
+
}, [u]);
|
|
4676
|
+
const [L] = V(() => (O, N) => {
|
|
4677
|
+
M.current?.(O, N);
|
|
4678
|
+
}), P = u === void 0 ? void 0 : L, H = U(d);
|
|
4679
|
+
Y(() => {
|
|
4680
|
+
H.current = d;
|
|
4681
|
+
}, [d]);
|
|
4682
|
+
const [K] = V(() => {
|
|
4683
|
+
let O = !1;
|
|
4684
|
+
return {
|
|
4685
|
+
convert: (N, z) => {
|
|
4686
|
+
const W = H.current;
|
|
4687
|
+
return W === void 0 ? Promise.resolve(Fd) : W.convert(N, z);
|
|
4688
|
+
},
|
|
4689
|
+
prepare: () => {
|
|
4690
|
+
try {
|
|
4691
|
+
H.current?.prepare?.();
|
|
4692
|
+
} catch (N) {
|
|
4693
|
+
if (O) return;
|
|
4694
|
+
O = !0, console.error("[markdown-explorer] the draft converter's prepare threw", N);
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
};
|
|
4698
|
+
}), w = d === void 0 ? void 0 : K, k = X(
|
|
4699
|
+
() => ({
|
|
4700
|
+
config: S,
|
|
4701
|
+
labels: v,
|
|
4702
|
+
locale: h,
|
|
4703
|
+
theme: g,
|
|
4704
|
+
storageNamespace: n,
|
|
4705
|
+
scope: e.scope,
|
|
4706
|
+
sources: e.sources,
|
|
4707
|
+
notices: _,
|
|
4708
|
+
documents: R.documents,
|
|
4709
|
+
trees: R.trees,
|
|
4710
|
+
data: R.data,
|
|
4711
|
+
viewSettings: m,
|
|
4712
|
+
treeSettings: q,
|
|
4713
|
+
announcer: p,
|
|
4714
|
+
reveals: x,
|
|
4715
|
+
edits: I,
|
|
4716
|
+
onEditGrant: l,
|
|
4717
|
+
draftConverter: w,
|
|
4718
|
+
renderTreeFailure: i,
|
|
4719
|
+
reportMathDiagnostics: P
|
|
4720
|
+
}),
|
|
4721
|
+
[S, v, h, g, n, e.scope, e.sources, _, R, m, q, p, x, I, l, w, i, P]
|
|
4722
|
+
);
|
|
4723
|
+
return /* @__PURE__ */ c(lr, { value: k, children: /* @__PURE__ */ c(Hd, { renderFrame: a, lockDocumentScroll: f }, e.scope) });
|
|
4724
|
+
}, Ud = ({ ref: e, theme: t, view: n, children: r }) => {
|
|
4725
|
+
const [o] = V(ti);
|
|
4726
|
+
return /* @__PURE__ */ c("div", { ref: e, className: "aqmx-root", "data-aqmx-theme": t, "data-aqmx-view": n, "data-testid": "markdown-explorer", onKeyDownCapture: o.onKeyDownCapture, onKeyUpCapture: o.onKeyUpCapture, onBlurCapture: o.onBlurCapture, children: r });
|
|
4727
|
+
}, Hd = ({ renderFrame: e, lockDocumentScroll: t }) => {
|
|
4728
|
+
const { theme: n, labels: r } = $(), o = $t(), { hash: s } = Xn(), a = ot(), i = U(null);
|
|
4729
|
+
Rd(t, i), Y(() => {
|
|
4730
|
+
o.kind === "redirect" && a(`${o.href}${s}`, "browse");
|
|
4731
|
+
}, [o, s, a]);
|
|
4732
|
+
const { location: f } = o, u = f.view;
|
|
4733
|
+
Md(i, u);
|
|
4734
|
+
const l = f.view === "tree" ? /* @__PURE__ */ c(Ie, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading", ...Ct }), children: /* @__PURE__ */ c(Ld, { location: f }) }) : f.view === "multi" ? /* @__PURE__ */ c(Ie, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading", ...Ct }), children: /* @__PURE__ */ c(Ad, { location: f }) }) : /* @__PURE__ */ c(id, { location: f }), d = /* @__PURE__ */ B(Ud, { ref: i, theme: n, view: u, children: [
|
|
4735
|
+
l,
|
|
4736
|
+
/* @__PURE__ */ c(Us, {}),
|
|
4737
|
+
/* @__PURE__ */ c(ld, { holds: !0, testId: "markdown-explorer-announcer" })
|
|
4738
|
+
] });
|
|
4739
|
+
return e === void 0 ? d : e({ view: u, children: d });
|
|
4740
|
+
}, au = rs({ submissions: "skip", otherPath: "skip", query: "skip", hashChange: "skip" });
|
|
4741
|
+
export {
|
|
4742
|
+
ss as $,
|
|
4743
|
+
At as A,
|
|
4744
|
+
zc as B,
|
|
4745
|
+
ps as C,
|
|
4746
|
+
ad as D,
|
|
4747
|
+
qc as E,
|
|
4748
|
+
As as F,
|
|
4749
|
+
Bn as G,
|
|
4750
|
+
Hc as H,
|
|
4751
|
+
qe as I,
|
|
4752
|
+
ru as J,
|
|
4753
|
+
ri as K,
|
|
4754
|
+
xs as L,
|
|
4755
|
+
vr as M,
|
|
4756
|
+
oc as N,
|
|
4757
|
+
ua as O,
|
|
4758
|
+
sd as P,
|
|
4759
|
+
Sc as Q,
|
|
4760
|
+
la as R,
|
|
4761
|
+
Pc as S,
|
|
4762
|
+
ia as T,
|
|
4763
|
+
$t as U,
|
|
4764
|
+
ld as V,
|
|
4765
|
+
Je as W,
|
|
4766
|
+
os as X,
|
|
4767
|
+
un as Y,
|
|
4768
|
+
ls as Z,
|
|
4769
|
+
ar as _,
|
|
4770
|
+
gs as a,
|
|
4771
|
+
cn as a0,
|
|
4772
|
+
su as a1,
|
|
4773
|
+
dn as a2,
|
|
4774
|
+
au as a3,
|
|
4775
|
+
ws as b,
|
|
4776
|
+
ot as c,
|
|
4777
|
+
$i as d,
|
|
4778
|
+
Ct as e,
|
|
4779
|
+
kc as f,
|
|
4780
|
+
ta as g,
|
|
4781
|
+
vs as h,
|
|
4782
|
+
sa as i,
|
|
4783
|
+
ea as j,
|
|
4784
|
+
de as k,
|
|
4785
|
+
aa as l,
|
|
4786
|
+
ge as m,
|
|
4787
|
+
Js as n,
|
|
4788
|
+
Qs as o,
|
|
4789
|
+
Re as p,
|
|
4790
|
+
Oe as q,
|
|
4791
|
+
Ps as r,
|
|
4792
|
+
qs as s,
|
|
4793
|
+
Uc as t,
|
|
4794
|
+
$ as u,
|
|
4795
|
+
na as v,
|
|
4796
|
+
nu as w,
|
|
4797
|
+
ou as x,
|
|
4798
|
+
dr as y,
|
|
4799
|
+
jc as z
|
|
4800
|
+
};
|