@aiquants/markdown-explorer 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +58 -8
  3. package/dist/EditSurface-5nbW7NTP.cjs +2 -0
  4. package/dist/EditSurface-CaS1O6Nt.js +371 -0
  5. package/dist/{ExplorerSplit-CN5TvRj6.js → ExplorerSplit-C9Y02nvj.js} +391 -417
  6. package/dist/ExplorerSplit-D60N3_X7.cjs +1 -0
  7. package/dist/MultiLayout-CqTyFZ_i.cjs +1 -0
  8. package/dist/MultiLayout-DBpUTcCQ.js +947 -0
  9. package/dist/{NativeScrollBar-DYEv2GLV.js → NativeScrollBar-CiVlg2ob.js} +1 -1
  10. package/dist/{NativeScrollBar-CHEQgaVx.cjs → NativeScrollBar-QlOtnddZ.cjs} +1 -1
  11. package/dist/TreeLayout-bk-Ziybl.js +29 -0
  12. package/dist/TreeLayout-uwvAgr-t.cjs +1 -0
  13. package/dist/client/MarkdownExplorer.d.cts +2 -1
  14. package/dist/client/MarkdownExplorer.d.ts +2 -1
  15. package/dist/client/storage.d.cts +1 -0
  16. package/dist/client/storage.d.ts +1 -0
  17. package/dist/core/contracts.d.cts +58 -0
  18. package/dist/core/contracts.d.ts +58 -0
  19. package/dist/core/labels.d.cts +49 -0
  20. package/dist/core/labels.d.ts +49 -0
  21. package/dist/core/location.d.cts +7 -0
  22. package/dist/core/location.d.ts +7 -0
  23. package/dist/dataRoute-CcZ8PK00.cjs +1 -0
  24. package/dist/dataRoute-D1vE1wFW.js +270 -0
  25. package/dist/index-Dlkzr6Zn.cjs +13 -0
  26. package/dist/index-etFEpIE_.js +3199 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.d.cts +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +31 -30
  31. package/dist/location-DmzVAFvo.cjs +1 -0
  32. package/dist/{location-CtM94G0O.js → location-Q4sgRrUm.js} +202 -193
  33. package/dist/merge-BR4jKpIc.cjs +5 -0
  34. package/dist/merge-DfI0ro2L.js +20 -0
  35. package/dist/sanitizeWorker.cjs +1 -1
  36. package/dist/sanitizeWorker.js +173 -172
  37. package/dist/server/errors.d.cts +1 -1
  38. package/dist/server/errors.d.ts +1 -1
  39. package/dist/server/ports.d.cts +33 -1
  40. package/dist/server/ports.d.ts +33 -1
  41. package/dist/server.cjs +1 -1
  42. package/dist/server.d.cts +1 -1
  43. package/dist/server.d.ts +1 -1
  44. package/dist/server.js +882 -751
  45. package/dist/{storage-DA4ItHzl.js → storage-BSthKLSG.js} +14 -13
  46. package/dist/storage-Dgi4JXaB.cjs +1 -0
  47. package/dist/storage.cjs +1 -1
  48. package/dist/storage.js +1 -1
  49. package/dist/styles/markdown-explorer.css +1 -1
  50. package/docs/behavior/dom-hooks.md +17 -3
  51. package/docs/behavior/layout.md +6 -1
  52. package/docs/behavior/security.md +11 -1
  53. package/docs/behavior/url-contract.md +13 -4
  54. package/package.json +11 -3
  55. package/dist/ExplorerSplit-CUIbSLQm.cjs +0 -1
  56. package/dist/MultiLayout-BDcQSpa6.cjs +0 -1
  57. package/dist/MultiLayout-hPmV-bae.js +0 -922
  58. package/dist/TreeLayout-BDaIyoGT.cjs +0 -1
  59. package/dist/TreeLayout-CqzxLpoM.js +0 -23
  60. package/dist/dataRoute-CUXlMhUJ.cjs +0 -1
  61. package/dist/dataRoute-Ce6EIuu4.js +0 -206
  62. package/dist/index-B3nShkkt.cjs +0 -3
  63. package/dist/index-gJp1iXTc.js +0 -2238
  64. package/dist/location-FavgY_gB.cjs +0 -1
  65. package/dist/storage-Bkb2Axdi.cjs +0 -1
@@ -1,2238 +0,0 @@
1
- import { jsx as c, jsxs as z, Fragment as wt } from "react/jsx-runtime";
2
- import * as x from "react";
3
- import { createContext as oe, use as J, useMemo as H, useSyncExternalStore as Q, useCallback as C, useRef as j, useEffect as ee, Suspense as we, Component as Vt, lazy as De, useState as Z, useLayoutEffect as G, useEffectEvent as ne, useId as Gt } from "react";
4
- import { useParams as Wt, useSearchParams as Kt, useNavigate as Yt, Link as Xt, useHref as Se, useLocation as vt, useRevalidator as Jt } from "react-router";
5
- import { f as Qt, a as en, u as tn, G as ue, e as le, x as nn, y as rn, z as Ze, B as on, D as Ue, H as ln, w as sn, I as an } from "./location-CtM94G0O.js";
6
- import { HostedScrollArea as Ve, useMarkdownToolbarState as cn, MarkdownViewer as bt } from "@aiquants/markdown";
7
- import { i as dn, v as Et, s as X, q as un, w as Ge, t as We, x as mn, y as fn, z as pn, A as hn, B as gn, f as wn, C as Ke, p as vn, F as bn, o as En } from "./dataRoute-Ce6EIuu4.js";
8
- import { DEFAULT_CONTENT_ALIGN as Sn } from "@aiquants/markdown/viewer-settings";
9
- import { w as kn, r as xn, a as yn, b as Ye, s as Rn, c as Tn } from "./storage-DA4ItHzl.js";
10
- const Xe = Object.freeze(["en", "ja"]), An = "en", Ln = Object.freeze({
11
- panelMoved: Object.freeze(["title", "column", "position"]),
12
- panelMoveUnavailable: Object.freeze(["title", "move"]),
13
- panelDragStarted: Object.freeze(["title"]),
14
- panelDragCancelled: Object.freeze(["title"]),
15
- multiColumnRegion: Object.freeze(["column"])
16
- }), On = /\{(\w+)\}/gu, St = {
17
- explorerRegion: "Explorer",
18
- sourceLabel: "Source",
19
- refreshTreeLabel: "Refresh tree",
20
- refreshTree: "Reload the tree and the open documents from the source",
21
- treeRefreshed: "Reloaded the tree from the source",
22
- treeRefreshFailed: (e) => `Could not reload the tree: ${e}`,
23
- refreshDocumentLabel: "Refresh document",
24
- refreshDocument: "Reload the document from the source",
25
- refreshDocumentNamed: (e) => `Refresh ${e}`,
26
- documentRefreshed: (e) => `Reloaded ${e}`,
27
- documentRefreshFailed: (e) => `Could not reload the document: ${e}`,
28
- showMarkupLabel: "Source",
29
- showMarkup: "Show the document's Markdown as written",
30
- showMarkupNamed: (e) => `Source of ${e}`,
31
- expandAll: "Expand all folders",
32
- collapseAll: "Collapse all folders",
33
- treeSettings: "Tree settings",
34
- switchToMulti: "Open in the multi-panel view",
35
- switchToTree: "Open in the tree view",
36
- resizeExplorer: "Resize the explorer",
37
- showExplorer: "Show the explorer",
38
- hideExplorer: "Close the explorer",
39
- treeRegion: "Documents",
40
- treeLoading: "Loading the tree…",
41
- treeEmptyTitle: "Nothing to show",
42
- treeEmptyBody: "This source has no documents you can open.",
43
- folderLoadFailed: "This folder could not be loaded.",
44
- loopFolderName: (e) => `${e} (already open above)`,
45
- foldersLoadFailedNamed: (e) => `${new Intl.ListFormat("en", { type: "conjunction" }).format(e)} could not be loaded`,
46
- foldersLoading: (e) => e === 1 ? "Loading 1 folder…" : `Loading ${String(e)} folders…`,
47
- expandAllStarted: "Opening all folders…",
48
- expandAllProgress: (e, t) => `Opening all folders (${String(e)} opened, ${String(t)} loading)…`,
49
- expandAllDone: (e, t, n) => {
50
- const r = `Opened ${String(e)} ${e === 1 ? "folder" : "folders"}`;
51
- return t > 0 ? `${r}; ${String(t)} could not be loaded` : n ? e === 0 ? "All folders are already open" : `${r}; every folder is open` : r;
52
- },
53
- 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`,
54
- expandAllDepthLimit: (e, t) => `Opened ${String(e)} ${e === 1 ? "folder" : "folders"}; folders more than ${String(t)} ${t === 1 ? "level" : "levels"} deep stay closed`,
55
- treeEntryKindDirectory: "directory",
56
- treeEntryKindFile: "file",
57
- treeScrollUp: "Scroll up",
58
- treeScrollDown: "Scroll down",
59
- treeScrollToTop: "Top",
60
- treeScrollToBottom: "Bottom",
61
- selectionTitle: (e) => `Selected (${String(e)})`,
62
- clearSelection: "Clear the selection",
63
- openSelectionInMulti: (e) => `Open ${String(e)} in panels`,
64
- removeFromSelection: (e) => `Remove ${e} from the selection`,
65
- settingSortMode: "Sort order",
66
- sortNative: "Source order",
67
- sortAscending: "Name A→Z",
68
- sortDescending: "Name Z→A",
69
- settingFolderPlacement: "Folders",
70
- folderPlacementMixed: "Mixed",
71
- folderPlacementFirst: "First",
72
- folderPlacementLast: "Last",
73
- settingSelectionMode: "Selection",
74
- selectionSingle: "Single",
75
- selectionMultiple: "Multiple",
76
- selectionNone: "Off",
77
- settingDoubleClick: "Double-click",
78
- doubleClickRecursive: "Expand all levels",
79
- doubleClickToggle: "Toggle",
80
- settingExpandIconSize: "Expander size",
81
- expandIconSizeValue: (e) => `${String(e)} px`,
82
- settingAlwaysExpanded: "Always expanded",
83
- settingRevealDocument: "Reveal the open document",
84
- settingRemoveRootIndent: "No root indent",
85
- settingTreeLines: "Tree lines",
86
- settingExpandIcons: "Expanders",
87
- settingDirectoryIcons: "Folder icons",
88
- settingFileIcons: "File icons",
89
- settingOn: "On",
90
- settingOff: "Off",
91
- settingAnnouncement: (e, t) => `${e}: ${t}`,
92
- documentRegion: "Document",
93
- documentEmpty: "Select a document in the explorer.",
94
- documentLoading: "Loading the document…",
95
- markupLoading: "Loading the source…",
96
- documentShown: (e) => `Showing ${e}`,
97
- documentFailed: (e, t) => `${e}: ${t}`,
98
- announcementSequence: (e) => e.map((t) => /[.!?]$/u.test(t) ? t : `${t}.`).join(" "),
99
- textTruncated: "Only the beginning of this file is shown.",
100
- inertLink: "This link points outside the source and cannot be opened.",
101
- failureUnauthorizedTitle: "Your session has expired",
102
- failureUnauthorizedBody: "Reload the page to sign in again.",
103
- failureForbiddenTitle: "Access denied",
104
- failureForbiddenBody: "You do not have permission to open this.",
105
- failureNotFoundTitle: "Not found",
106
- failureNotFoundBody: "It may have been moved or deleted.",
107
- failureNotConfiguredTitle: "This source is not set up",
108
- failureNotConfiguredBody: "Ask your administrator to configure it.",
109
- failureInvalidTitle: "Invalid address",
110
- failureInvalidBody: "The document path in this address cannot be used.",
111
- failureTooLargeTitle: "Too large to display",
112
- failureTooLargeBody: "This file exceeds the size that can be displayed.",
113
- failureUnsupportedTitle: "Cannot be displayed",
114
- failureUnsupportedBody: "This type of file cannot be shown here.",
115
- failureFailedTitle: "Something went wrong",
116
- failureFailedBody: "Try again in a moment.",
117
- retry: "Try again",
118
- reloadPage: "Reload the page",
119
- imageZoomIn: "Zoom in",
120
- imageZoomOut: "Zoom out",
121
- imageFit: "Fit to the view",
122
- imageFitLevel: "Fit",
123
- imageZoomLevel: (e) => `${String(e)}%`,
124
- openInNewTab: "Open in a new tab",
125
- download: "Download",
126
- mediaUnsupported: "Your browser cannot play this file.",
127
- fileNotShown: "This file cannot be shown here. Download it to open it.",
128
- viewerLoading: "Loading data...",
129
- viewerErrorPrefix: "Error: ",
130
- viewerStyleTitle: "Display Style",
131
- viewerSelectStyle: "Select display style",
132
- viewerPinStyle: "Pin style selector",
133
- viewerUnpinStyle: "Unpin style selector",
134
- viewerErrorTitle: "An error occurred",
135
- viewerMissingImage: "Image not found",
136
- viewerOpenToc: "Open table of contents",
137
- viewerTocTitle: "Table of contents",
138
- viewerPinToc: "Pin table of contents",
139
- viewerUnpinToc: "Unpin table of contents",
140
- viewerSelectAlign: "Select alignment",
141
- viewerAlignTitle: "Alignment",
142
- viewerPinAlign: "Pin alignment selector",
143
- viewerUnpinAlign: "Unpin alignment selector",
144
- viewerAlignLeft: "Align left",
145
- viewerAlignCenter: "Align center",
146
- viewerAlignRight: "Align right",
147
- viewerMermaidInteractionMode: "Mouse interaction mode",
148
- viewerMermaidModeNone: "No interaction",
149
- viewerMermaidModeZoom: "Zoom only",
150
- viewerMermaidModePan: "Pan only (drag)",
151
- viewerMermaidModePanShift: "Pan only (Shift+drag)",
152
- viewerMermaidModeBoth: "Zoom and pan (drag)",
153
- viewerMermaidModeBothShift: "Zoom and pan (Shift+drag)",
154
- viewerMermaidZoomIn: "Zoom In",
155
- viewerMermaidZoomOut: "Zoom Out",
156
- viewerMermaidResetView: "Reset View",
157
- viewerMermaidRetry: "Try again",
158
- viewerEmbeddedVideo: "embedded video",
159
- viewerEmbeddedPost: "embedded post",
160
- viewerEmbeddedFrame: "Embedded content",
161
- multiRegion: "Panels",
162
- multiEmpty: "Select documents in the explorer to open them side by side.",
163
- panelLimit: (e) => `You can open up to ${String(e)} panels at once.`,
164
- panelOpened: (e) => `Opened ${e}`,
165
- panelClosed: (e) => `Closed ${e}`,
166
- panelAlreadyOpen: (e) => `${e} is already open`,
167
- panelHidden: (e) => `Hid ${e}`,
168
- panelShown: (e) => `Showed ${e}`,
169
- panelMaximized: (e) => `Maximized ${e}`,
170
- panelRestored: (e) => `Restored ${e} to its size`,
171
- panelHide: "Hide the panel",
172
- panelMaximize: "Maximize the panel",
173
- panelRestore: "Restore the panel to its size",
174
- panelClose: "Close the panel",
175
- panelSwitchToCustomDrag: "Switch to the custom drag mode",
176
- panelSwitchToNormalDrag: "Back to the normal drag mode",
177
- panelCustomDragBadge: "Custom",
178
- panelMovePreviousColumn: "Move to the previous column",
179
- panelMoveNextColumn: "Move to the next column",
180
- panelMoveUp: "Move up",
181
- panelMoveDown: "Move down",
182
- panelMoved: "Moved {title} to column {column}, position {position}",
183
- panelMoveUnavailable: "{move} is not available for {title}",
184
- panelDragStarted: "Picked up {title}",
185
- panelDragCancelled: "Kept {title} where it was",
186
- hiddenPanelsTitle: "Hidden panels:",
187
- hiddenPanelBadge: "Hidden",
188
- hiddenPanelNotice: "This panel is hidden",
189
- multiColumnEmpty: "This column is empty",
190
- multiColumnRegion: "Column {column}",
191
- panelDropHere: "Drop the panel here"
192
- }, Mn = {
193
- explorerRegion: "エクスプローラー",
194
- sourceLabel: "ソース",
195
- refreshTreeLabel: "ツリーを更新",
196
- refreshTree: "ソースからツリーと開いている文書を読み込み直す",
197
- treeRefreshed: "ツリーをソースから読み込み直しました",
198
- treeRefreshFailed: (e) => `ツリーを読み込み直せませんでした: ${e}`,
199
- refreshDocumentLabel: "文書を更新",
200
- refreshDocument: "ソースから文書を読み込み直す",
201
- refreshDocumentNamed: (e) => `${e} を更新`,
202
- documentRefreshed: (e) => `${e} を読み込み直しました`,
203
- documentRefreshFailed: (e) => `文書を読み込み直せませんでした: ${e}`,
204
- showMarkupLabel: "ソース",
205
- showMarkup: "文書の Markdown を書いたまま表示",
206
- showMarkupNamed: (e) => `${e} のソース`,
207
- expandAll: "すべてのフォルダーを展開",
208
- collapseAll: "すべてのフォルダーを折りたたむ",
209
- treeSettings: "ツリーの設定",
210
- switchToMulti: "マルチビューで開く",
211
- switchToTree: "ツリービューで開く",
212
- resizeExplorer: "エクスプローラーの幅を変更",
213
- showExplorer: "エクスプローラーを開く",
214
- hideExplorer: "エクスプローラーを閉じる",
215
- treeRegion: "文書の一覧",
216
- treeLoading: "ツリーを読み込み中…",
217
- treeEmptyTitle: "表示できるファイルがありません",
218
- treeEmptyBody: "このソースには開ける文書がありません。",
219
- folderLoadFailed: "このフォルダーを読み込めませんでした。",
220
- loopFolderName: (e) => `${e} (上の階層で開いています)`,
221
- foldersLoadFailedNamed: (e) => `${new Intl.ListFormat("ja", { type: "conjunction" }).format(e)} を読み込めませんでした`,
222
- foldersLoading: (e) => `フォルダーを ${String(e)} 件読み込み中…`,
223
- expandAllStarted: "すべてのフォルダーを展開しています…",
224
- expandAllProgress: (e, t) => `すべてのフォルダーを展開中 (展開 ${String(e)} 件、読み込み中 ${String(t)} 件)…`,
225
- expandAllDone: (e, t, n) => {
226
- const r = `${String(e)} 件のフォルダーを展開しました`;
227
- return t > 0 ? `${r}。うち ${String(t)} 件は読み込めませんでした` : n ? e === 0 ? "すべてのフォルダーが既に開いています" : `${r}。すべてのフォルダーが開いています` : r;
228
- },
229
- expandAllFolderLimit: (e, t, n) => `${String(e)} 件のフォルダーを展開し、読み込みの上限 (${String(t)} 件) で止めました。続けるには「${n}」をもう一度押してください`,
230
- expandAllDepthLimit: (e, t) => `${String(e)} 件のフォルダーを展開しました。深さ ${String(t)} 階層より下のフォルダーは閉じたままです`,
231
- treeEntryKindDirectory: "ディレクトリ",
232
- treeEntryKindFile: "ファイル",
233
- treeScrollUp: "上へスクロール",
234
- treeScrollDown: "下へスクロール",
235
- treeScrollToTop: "先頭へ",
236
- treeScrollToBottom: "末尾へ",
237
- selectionTitle: (e) => `選択中 (${String(e)})`,
238
- clearSelection: "選択を解除",
239
- openSelectionInMulti: (e) => `${String(e)} 件をパネルで開く`,
240
- removeFromSelection: (e) => `${e} を選択から外す`,
241
- settingSortMode: "並び順",
242
- sortNative: "取得順",
243
- sortAscending: "名前の昇順",
244
- sortDescending: "名前の降順",
245
- settingFolderPlacement: "フォルダーの位置",
246
- folderPlacementMixed: "混ぜる",
247
- folderPlacementFirst: "先に",
248
- folderPlacementLast: "後に",
249
- settingSelectionMode: "選択",
250
- selectionSingle: "1 件",
251
- selectionMultiple: "複数",
252
- selectionNone: "オフ",
253
- settingDoubleClick: "ダブルクリック",
254
- doubleClickRecursive: "下の階層まで展開",
255
- doubleClickToggle: "開閉",
256
- settingExpandIconSize: "展開アイコンの大きさ",
257
- expandIconSizeValue: (e) => `${String(e)} px`,
258
- settingAlwaysExpanded: "常に展開",
259
- settingRevealDocument: "開いた文書をツリーで表示",
260
- settingRemoveRootIndent: "最上位の字下げなし",
261
- settingTreeLines: "ツリーの線",
262
- settingExpandIcons: "展開アイコン",
263
- settingDirectoryIcons: "フォルダーのアイコン",
264
- settingFileIcons: "ファイルのアイコン",
265
- settingOn: "オン",
266
- settingOff: "オフ",
267
- settingAnnouncement: (e, t) => `${e}: ${t}`,
268
- documentRegion: "文書",
269
- documentEmpty: "エクスプローラーで文書を選んでください。",
270
- documentLoading: "文書を読み込み中…",
271
- markupLoading: "ソースを読み込み中…",
272
- documentShown: (e) => `${e} を表示しています`,
273
- documentFailed: (e, t) => `${e}: ${t}`,
274
- announcementSequence: (e) => e.map((t) => /[。!?]$/u.test(t) ? t : `${t}。`).join(""),
275
- textTruncated: "このファイルは先頭だけを表示しています。",
276
- inertLink: "リンク先がソースの外にあるため開けません。",
277
- failureUnauthorizedTitle: "セッションの有効期限が切れました",
278
- failureUnauthorizedBody: "ページを再読み込みして、もう一度サインインしてください。",
279
- failureForbiddenTitle: "アクセスが許可されていません",
280
- failureForbiddenBody: "これを開く権限がありません。",
281
- failureNotFoundTitle: "見つかりません",
282
- failureNotFoundBody: "移動または削除された可能性があります。",
283
- failureNotConfiguredTitle: "このソースは設定されていません",
284
- failureNotConfiguredBody: "管理者に設定を依頼してください。",
285
- failureInvalidTitle: "アドレスが正しくありません",
286
- failureInvalidBody: "このアドレスに含まれる文書の経路は使えません。",
287
- failureTooLargeTitle: "大きすぎて表示できません",
288
- failureTooLargeBody: "このファイルは表示できる大きさを超えています。",
289
- failureUnsupportedTitle: "表示できない形式です",
290
- failureUnsupportedBody: "この種類のファイルはここでは表示できません。",
291
- failureFailedTitle: "読み込みに失敗しました",
292
- failureFailedBody: "しばらくしてからもう一度お試しください。",
293
- retry: "再試行",
294
- reloadPage: "ページを再読み込み",
295
- imageZoomIn: "拡大",
296
- imageZoomOut: "縮小",
297
- imageFit: "画面に合わせる",
298
- imageFitLevel: "全体",
299
- imageZoomLevel: (e) => `${String(e)}%`,
300
- openInNewTab: "新しいタブで開く",
301
- download: "ダウンロード",
302
- mediaUnsupported: "このブラウザではこのファイルを再生できません。",
303
- fileNotShown: "このファイルはここでは表示できません。ダウンロードして開いてください。",
304
- viewerLoading: "データを読み込み中...",
305
- viewerErrorPrefix: "エラー: ",
306
- viewerStyleTitle: "表示スタイル",
307
- viewerSelectStyle: "表示スタイルを選択",
308
- viewerPinStyle: "スタイル選択をピン留め",
309
- viewerUnpinStyle: "スタイル選択のピン留めを解除",
310
- viewerErrorTitle: "エラーが発生しました",
311
- viewerMissingImage: "画像が見つかりません",
312
- viewerOpenToc: "目次を開く",
313
- viewerTocTitle: "目次",
314
- viewerPinToc: "目次をピン留め",
315
- viewerUnpinToc: "目次のピン留めを解除",
316
- viewerSelectAlign: "揃えを選択",
317
- viewerAlignTitle: "揃え",
318
- viewerPinAlign: "揃え選択をピン留め",
319
- viewerUnpinAlign: "揃え選択のピン留めを解除",
320
- viewerAlignLeft: "左揃え",
321
- viewerAlignCenter: "中央揃え",
322
- viewerAlignRight: "右揃え",
323
- viewerMermaidInteractionMode: "マウス操作モード",
324
- viewerMermaidModeNone: "操作なし",
325
- viewerMermaidModeZoom: "拡大縮小のみ",
326
- viewerMermaidModePan: "移動のみ (左ドラッグ)",
327
- viewerMermaidModePanShift: "移動のみ (Shift+ドラッグ)",
328
- viewerMermaidModeBoth: "拡大縮小+移動 (左ドラッグ)",
329
- viewerMermaidModeBothShift: "拡大縮小+移動 (Shift+ドラッグ)",
330
- viewerMermaidZoomIn: "拡大",
331
- viewerMermaidZoomOut: "縮小",
332
- viewerMermaidResetView: "表示を元に戻す",
333
- viewerMermaidRetry: "再試行",
334
- viewerEmbeddedVideo: "埋め込みの動画",
335
- viewerEmbeddedPost: "埋め込みの投稿",
336
- viewerEmbeddedFrame: "埋め込みのコンテンツ",
337
- multiRegion: "パネル",
338
- multiEmpty: "エクスプローラーで文書を選ぶと、ここに並べて開きます。",
339
- panelLimit: (e) => `同時に開けるのは ${String(e)} パネルまでです。`,
340
- panelOpened: (e) => `${e} を開きました`,
341
- panelClosed: (e) => `${e} を閉じました`,
342
- panelAlreadyOpen: (e) => `${e} は既に開いています`,
343
- panelHidden: (e) => `${e} を隠しました`,
344
- panelShown: (e) => `${e} を表示しました`,
345
- panelMaximized: (e) => `${e} を最大化しました`,
346
- panelRestored: (e) => `${e} を元のサイズに戻しました`,
347
- panelHide: "パネルを隠す",
348
- panelMaximize: "パネルを最大化",
349
- panelRestore: "パネルを元のサイズに戻す",
350
- panelClose: "パネルを閉じる",
351
- panelSwitchToCustomDrag: "カスタムのドラッグの方式に切り替え",
352
- panelSwitchToNormalDrag: "通常のドラッグの方式に戻す",
353
- panelCustomDragBadge: "カスタム",
354
- panelMovePreviousColumn: "前の列へ移動",
355
- panelMoveNextColumn: "次の列へ移動",
356
- panelMoveUp: "上へ移動",
357
- panelMoveDown: "下へ移動",
358
- panelMoved: "{title} を {column} 列目の {position} 番目へ移動しました",
359
- panelMoveUnavailable: "{title} は「{move}」できません",
360
- panelDragStarted: "{title} を持ち上げました",
361
- panelDragCancelled: "{title} の移動を取り消しました",
362
- hiddenPanelsTitle: "隠したパネル:",
363
- hiddenPanelBadge: "非表示",
364
- hiddenPanelNotice: "このパネルは隠しています",
365
- multiColumnEmpty: "この列は空です",
366
- multiColumnRegion: "{column} 列目",
367
- panelDropHere: "ここへパネルをドロップ"
368
- }, Cn = Object.freeze({
369
- en: Object.freeze(St),
370
- ja: Object.freeze(Mn)
371
- }), kt = Object.freeze(Object.keys(St)), Nn = new Set(kt), Pn = (e) => Nn.has(e), he = (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, xt = (e) => {
372
- if (e === void 0) return An;
373
- if (Xe.includes(e)) return e;
374
- throw new RangeError(`[markdown-explorer] locale is the UI language (${Xe.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${he(e)}`);
375
- }, Je = (e, t) => {
376
- const n = Cn[xt(e)];
377
- if (t === void 0) return n;
378
- if (t === null || typeof t != "object")
379
- throw new RangeError(`[markdown-explorer] labels must be an object; got ${he(t)}`);
380
- if (!Qt(t))
381
- throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${he(t)}`);
382
- const r = t, o = { ...n };
383
- for (const l of Object.keys(r)) {
384
- if (!Pn(l))
385
- throw new RangeError(`[markdown-explorer] labels.${l} is not a known label key; expected one of ${kt.join(", ")}`);
386
- const s = r[l];
387
- if (s === void 0) continue;
388
- const i = typeof n[l];
389
- if (typeof s !== i)
390
- throw new TypeError(`[markdown-explorer] labels.${l} must be a ${i}; got ${he(s)}`);
391
- if (typeof s == "string" && s.trim() === "")
392
- throw new RangeError(`[markdown-explorer] labels.${l} must be a non-blank string`);
393
- const d = Ln[l];
394
- if (typeof s == "string" && d !== void 0) {
395
- for (const [, u] of s.matchAll(On))
396
- if (!d.includes(u ?? ""))
397
- throw new RangeError(`[markdown-explorer] labels.${l} uses the unknown placeholder {${String(u)}}; it accepts ${d.map((p) => `{${p}}`).join(", ")}`);
398
- }
399
- o[l] = s;
400
- }
401
- return Object.freeze(o);
402
- }, $n = (e, t) => {
403
- if (Object.is(e, t)) return !0;
404
- if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
405
- const n = e, r = t, o = Object.keys(n), l = Object.keys(r);
406
- return o.length === l.length && l.every((s) => Object.hasOwn(n, s) && Object.is(n[s], r[s]));
407
- }, Qe = Object.freeze(["light", "dark"]), Fn = (e) => {
408
- if (e === void 0) return "light";
409
- if (Qe.includes(e)) return e;
410
- throw new RangeError(`[markdown-explorer] theme must be ${Qe.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
411
- }, yt = oe(null), P = () => {
412
- const e = J(yt);
413
- if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
414
- return e;
415
- }, ve = (e) => {
416
- const { viewSettings: t } = P(), n = () => e(t.getSnapshot());
417
- return Q(t.subscribe, n, n);
418
- }, qe = () => {
419
- const { config: e } = P(), t = Wt()["*"], [n] = Kt(), r = n.toString();
420
- return H(() => en(e, t, new URLSearchParams(r)), [e, t, r]);
421
- };
422
- function Dn({
423
- title: e,
424
- titleId: t,
425
- ...n
426
- }, r) {
427
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
428
- xmlns: "http://www.w3.org/2000/svg",
429
- viewBox: "0 0 20 20",
430
- fill: "currentColor",
431
- "aria-hidden": "true",
432
- "data-slot": "icon",
433
- ref: r,
434
- "aria-labelledby": t
435
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
436
- id: t
437
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
438
- fillRule: "evenodd",
439
- 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",
440
- clipRule: "evenodd"
441
- }));
442
- }
443
- const qn = /* @__PURE__ */ x.forwardRef(Dn), _e = Object.freeze({
444
- browse: Object.freeze({ replace: !0, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
445
- "switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
446
- "switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
447
- "follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
448
- }), al = (e) => _e[e], Be = () => {
449
- const e = Yt();
450
- return C(
451
- (t, n) => {
452
- e(t, _e[n]);
453
- },
454
- [e]
455
- );
456
- }, _n = ({ navigation: e, ...t }) => /* @__PURE__ */ c(Xt, { ...t, ..._e[e] }), Rt = {
457
- unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
458
- forbidden: ["failureForbiddenTitle", "failureForbiddenBody"],
459
- "not-found": ["failureNotFoundTitle", "failureNotFoundBody"],
460
- "not-configured": ["failureNotConfiguredTitle", "failureNotConfiguredBody"],
461
- invalid: ["failureInvalidTitle", "failureInvalidBody"],
462
- "too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
463
- unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
464
- failed: ["failureFailedTitle", "failureFailedBody"]
465
- }, ae = (e, t) => e[Rt[t][0]], Tt = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
466
- const { labels: o } = P(), l = ae(o, e.reason), s = o[Rt[e.reason][1]], i = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
467
- return /* @__PURE__ */ z("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: [
468
- /* @__PURE__ */ c("p", { className: "aqmx-callout-title", children: l }),
469
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: s }),
470
- 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
471
- ] });
472
- }, At = (e) => {
473
- const t = e.ownerDocument;
474
- if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
475
- if (e.hasAttribute("tabindex")) return !1;
476
- if (e.setAttribute("tabindex", "-1"), e.focus({ preventScroll: !0 }), t.activeElement !== e)
477
- return e.removeAttribute("tabindex"), !1;
478
- const n = () => {
479
- t.activeElement !== e && (e.removeAttribute("tabindex"), e.removeEventListener("blur", n));
480
- };
481
- return e.addEventListener("blur", n), !0;
482
- }, Bn = (e, t) => {
483
- const n = j(null), r = j(null), o = j(null), l = C(() => {
484
- n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
485
- }, []);
486
- ee(() => l, [l]);
487
- const s = C(
488
- (u) => {
489
- if (r.current !== u) return;
490
- const p = o.current;
491
- if (p !== null) {
492
- p.then(() => s(u));
493
- return;
494
- }
495
- e.prefetch(u);
496
- const h = e.peek(u);
497
- if (h?.status !== "pending") return;
498
- const b = Promise.allSettled([h.promise]);
499
- o.current = b, b.then(() => {
500
- o.current === b && (o.current = null);
501
- });
502
- },
503
- [e]
504
- ), i = C(
505
- (u) => {
506
- const p = t(u);
507
- p !== r.current && (l(), p !== null && (r.current = p, n.current = window.setTimeout(() => {
508
- n.current = null, s(p);
509
- }, tn)));
510
- },
511
- [l, t, s]
512
- ), d = C(
513
- (u) => {
514
- t(u) !== r.current && l();
515
- },
516
- [l, t]
517
- );
518
- return H(
519
- () => ({
520
- onPointerOver: (u) => i(u.target),
521
- onPointerOut: (u) => d(u.relatedTarget),
522
- onFocus: (u) => i(u.target),
523
- onBlur: (u) => d(u.relatedTarget)
524
- }),
525
- [i, d]
526
- );
527
- }, jn = De(() => import("./NativeScrollBar-DYEv2GLV.js").then((e) => ({ default: e.NativeScrollBar })));
528
- class zn extends Vt {
529
- state = { failed: !1 };
530
- static getDerivedStateFromError() {
531
- return { failed: !0 };
532
- }
533
- componentDidCatch(t) {
534
- console.error("[markdown-explorer] a scroll bar failed to load or render; its scroller keeps its native scrolling without it.", t);
535
- }
536
- render() {
537
- return this.state.failed ? null : this.props.children;
538
- }
539
- }
540
- const Hn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(zn, { children: /* @__PURE__ */ c(we, { fallback: null, children: /* @__PURE__ */ c(jn, { scroller: e, withCircle: t }) }) }), Lt = (e) => /* @__PURE__ */ c(Hn, { scroller: e, withCircle: !0 }), ce = () => {
541
- const e = /* @__PURE__ */ new Set();
542
- return {
543
- subscribe: (t) => (e.add(t), () => {
544
- e.delete(t);
545
- }),
546
- emit: () => {
547
- for (const t of [...e]) t();
548
- }
549
- };
550
- }, Ot = () => {
551
- const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
552
- let n = !1;
553
- const r = (o) => {
554
- t.add(o), !n && (n = !0, queueMicrotask(() => {
555
- n = !1, t.clear();
556
- }));
557
- };
558
- return {
559
- hold: (o) => {
560
- e.set(o, (e.get(o) ?? 0) + 1);
561
- let l = !1;
562
- return () => {
563
- if (l) return;
564
- l = !0;
565
- const s = e.get(o);
566
- if (s !== void 0 && s > 1) {
567
- e.set(o, s - 1);
568
- return;
569
- }
570
- e.delete(o), r(o);
571
- };
572
- },
573
- isHeld: (o) => e.has(o),
574
- resumes: (o) => t.delete(o),
575
- heldKeys: () => [...e.keys()]
576
- };
577
- }, be = (e, t) => {
578
- if (Object.is(e, t)) return !0;
579
- if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
580
- if (Array.isArray(e) || Array.isArray(t))
581
- return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((l, s) => be(l, t[s]));
582
- const n = e, r = t, o = Object.keys(n);
583
- return o.length !== Object.keys(r).length ? !1 : o.every((l) => Object.hasOwn(r, l) && be(n[l], r[l]));
584
- }, se = (e) => {
585
- const t = e;
586
- return t.status === void 0 && (t.status = "pending", e.then(
587
- (n) => {
588
- t.status = "fulfilled", t.value = n;
589
- },
590
- (n) => {
591
- t.status = "rejected", t.reason = n;
592
- }
593
- )), t;
594
- }, Mt = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), me = (e) => e.status === "fulfilled" ? e.value : void 0, In = 55e3, et = Object.freeze({ status: "deferred" }), tt = Object.freeze({ status: "refreshed" }), Le = Object.freeze({ status: "superseded" }), ie = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, Ct = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", Zn = ({ client: e, capacity: t }) => {
595
- if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
596
- const n = /* @__PURE__ */ new Map(), r = Ot(), o = ce(), l = /* @__PURE__ */ new WeakSet();
597
- let s = 0;
598
- const i = o.emit, d = () => (s += 1, s), u = () => {
599
- if (!(n.size <= t))
600
- for (const m of [...n.keys()]) {
601
- if (n.size <= t) return;
602
- r.isHeld(m) || n.delete(m);
603
- }
604
- }, p = (m, w) => {
605
- n.delete(m), n.set(m, w);
606
- }, h = (m) => performance.now() - m.validatedAt >= In, b = (m, w, S) => {
607
- const E = n.get(m), R = ie(E?.snapshot), F = S || E?.refreshPending === !0, I = se(e.document(m, { refresh: F }).then((B) => ({ status: "loaded", document: B }))), N = { snapshot: { status: "pending", promise: I, previous: R }, validatedAt: performance.now(), opened: w, background: null, refreshPending: !1, seeded: void 0, stamp: d() };
608
- return p(m, N), u(), I.then((B) => {
609
- n.get(m) === N && (N.snapshot = B, N.stamp = d(), i());
610
- }), N;
611
- }, T = (m, w, S, E, R, F) => {
612
- w.background === S && (w.background = null, !(n.get(m) !== w || w.snapshot !== E) && (R.kind === "failure" && E.document.kind !== "failure" || (w.validatedAt = F, w.stamp = d(), be(E.document, R) || (w.snapshot = { status: "loaded", document: R }), i())));
613
- }, y = async (m, w) => {
614
- const S = w.snapshot;
615
- if (S.status !== "loaded") return null;
616
- const E = {};
617
- w.background = E;
618
- const R = performance.now(), F = e.document(m, { refresh: w.refreshPending });
619
- w.refreshPending = !1;
620
- const I = await F, N = w.background === E && n.get(m) === w && w.snapshot === S;
621
- return T(m, w, E, S, I, R), N ? I : null;
622
- }, L = (m, w) => {
623
- const { snapshot: S } = w;
624
- return S.status === "pending" ? !1 : S.status === "loaded" && S.document.kind !== "failure" ? (y(m, w), !1) : (S.status === "loaded" && l.add(S), b(m, !0, !1), !0);
625
- }, k = (m) => {
626
- const w = r.hold(m);
627
- let S = !1;
628
- return () => {
629
- if (S) return;
630
- S = !0, w();
631
- const E = n.get(m);
632
- E !== void 0 && p(m, E), u();
633
- };
634
- };
635
- return {
636
- peek: (m) => n.get(m)?.snapshot,
637
- peekSeeded: (m) => n.get(m)?.seeded,
638
- answerStampOf: (m) => n.get(m)?.stamp,
639
- prefetch: (m) => {
640
- const w = n.get(m);
641
- w !== void 0 && w.snapshot.status !== "deferred" || (b(m, !1, !1), i());
642
- },
643
- open: (m) => {
644
- const w = r.resumes(m), S = k(m), E = n.get(m);
645
- if (E === void 0 || E.snapshot.status === "deferred")
646
- return b(m, !0, !1), i(), S;
647
- if (p(m, E), w) return S;
648
- const { snapshot: R } = E;
649
- return R.status === "pending" ? (E.opened = !0, S) : R.document.kind === "failure" ? (E.opened || h(E) ? (l.add(R), b(m, !0, !1), i()) : E.opened = !0, S) : (E.opened = !0, E.background === null && h(E) && y(m, E), S);
650
- },
651
- retain: k,
652
- retry: (m) => {
653
- const w = n.get(m);
654
- w === void 0 || w.snapshot.status !== "loaded" || w.snapshot.document.kind !== "failure" || (b(m, !0, !1), i());
655
- },
656
- seed: (m, w) => {
657
- const S = performance.now(), E = se(
658
- w.then(
659
- (B) => B === null ? et : { status: "loaded", document: B },
660
- () => et
661
- )
662
- ), R = n.get(m);
663
- if (R !== void 0 && R.snapshot.status === "loaded") {
664
- const B = R.snapshot, W = {};
665
- R.background = W, E.then((U) => {
666
- if (U.status === "loaded") {
667
- T(m, R, W, B, U.document, S);
668
- return;
669
- }
670
- R.background === W && (R.background = null);
671
- });
672
- return;
673
- }
674
- const F = R !== void 0 && R.snapshot.status === "pending" ? R.snapshot.previous : null, I = { status: "pending", promise: E, previous: F }, N = { snapshot: I, validatedAt: S, opened: R?.opened === !0, background: null, refreshPending: R?.refreshPending === !0, seeded: I, stamp: d() };
675
- p(m, N), u(), E.then((B) => {
676
- n.get(m) === N && (B.status === "deferred" && r.isHeld(m) ? b(m, N.opened, !1) : (N.snapshot = B, N.stamp = d()), i());
677
- });
678
- },
679
- invalidate: () => {
680
- let m = !1;
681
- for (const [w, S] of [...n]) {
682
- if (S.validatedAt = Number.NEGATIVE_INFINITY, S.opened = !0, S.refreshPending = !0, !r.isHeld(w)) continue;
683
- const { snapshot: E } = S;
684
- if (E.status !== "pending") {
685
- L(w, S) && (m = !0);
686
- continue;
687
- }
688
- E.promise.then(() => {
689
- n.get(w) === S && S.refreshPending && r.isHeld(w) && L(w, S) && i();
690
- });
691
- }
692
- m && i();
693
- },
694
- refresh: async (m) => {
695
- const w = n.get(m);
696
- if (w !== void 0 && Ct(w.snapshot)) {
697
- w.refreshPending = !0;
698
- const E = await y(m, w);
699
- return E === null ? Le : E.kind === "failure" ? { status: "failed", failure: E.failure } : tt;
700
- }
701
- const S = b(m, !0, !0);
702
- return i(), S.snapshot.status !== "pending" ? Le : (await S.snapshot.promise, n.get(m) === S ? tt : Le);
703
- },
704
- clear: () => {
705
- n.clear();
706
- for (const m of r.heldKeys()) b(m, !0, !1);
707
- i();
708
- },
709
- subscribe: o.subscribe,
710
- noteFailureShown: (m) => l.has(m) ? !1 : (l.add(m), !0)
711
- };
712
- }, Ee = oe("fill"), Un = Object.freeze({ blockSize: "100%" }), de = ({ scrollerProps: e, children: t }) => J(Ee) === "content" ? /* @__PURE__ */ c(Ve, { scrollerProps: e, children: t }) : /* @__PURE__ */ c(Ve, { scrollerProps: { ...e, style: Un }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: Lt, children: t });
713
- function Vn({
714
- title: e,
715
- titleId: t,
716
- ...n
717
- }, r) {
718
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
719
- xmlns: "http://www.w3.org/2000/svg",
720
- viewBox: "0 0 20 20",
721
- fill: "currentColor",
722
- "aria-hidden": "true",
723
- "data-slot": "icon",
724
- ref: r,
725
- "aria-labelledby": t
726
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
727
- id: t
728
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
729
- 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"
730
- }), /* @__PURE__ */ x.createElement("path", {
731
- 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"
732
- }));
733
- }
734
- const Gn = /* @__PURE__ */ x.forwardRef(Vn);
735
- function Wn({
736
- title: e,
737
- titleId: t,
738
- ...n
739
- }, r) {
740
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
741
- xmlns: "http://www.w3.org/2000/svg",
742
- viewBox: "0 0 20 20",
743
- fill: "currentColor",
744
- "aria-hidden": "true",
745
- "data-slot": "icon",
746
- ref: r,
747
- "aria-labelledby": t
748
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
749
- id: t
750
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
751
- fillRule: "evenodd",
752
- 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",
753
- clipRule: "evenodd"
754
- }), /* @__PURE__ */ x.createElement("path", {
755
- fillRule: "evenodd",
756
- 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",
757
- clipRule: "evenodd"
758
- }));
759
- }
760
- const Kn = /* @__PURE__ */ x.forwardRef(Wn), ke = ({ name: e, url: t, icon: n, children: r }) => {
761
- const { labels: o } = P();
762
- return /* @__PURE__ */ z("div", { className: "aqmx-document-toolbar", children: [
763
- /* @__PURE__ */ c("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: n }),
764
- /* @__PURE__ */ c("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
765
- r,
766
- /* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": o.openInNewTab, title: o.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ c(Kn, {}) }),
767
- /* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: t, download: e, "aria-label": o.download, title: o.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ c(Gn, {}) })
768
- ] });
769
- };
770
- function Yn({
771
- title: e,
772
- titleId: t,
773
- ...n
774
- }, r) {
775
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
776
- xmlns: "http://www.w3.org/2000/svg",
777
- viewBox: "0 0 20 20",
778
- fill: "currentColor",
779
- "aria-hidden": "true",
780
- "data-slot": "icon",
781
- ref: r,
782
- "aria-labelledby": t
783
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
784
- id: t
785
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
786
- fillRule: "evenodd",
787
- 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",
788
- clipRule: "evenodd"
789
- }));
790
- }
791
- const Xn = /* @__PURE__ */ x.forwardRef(Yn), Jn = Object.freeze({ className: "aqmx-document-stage" }), Qn = ({ document: e }) => {
792
- const { labels: t } = P();
793
- return /* @__PURE__ */ z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
794
- /* @__PURE__ */ c(ke, { name: e.name, url: e.url, icon: /* @__PURE__ */ c(Xn, {}) }),
795
- /* @__PURE__ */ c(de, { scrollerProps: Jn, children: /* @__PURE__ */ z("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
796
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
797
- /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
798
- ] }) })
799
- ] });
800
- }, je = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", er = (e) => {
801
- const t = e.indexOf("#");
802
- return t === -1 ? "" : e.slice(t);
803
- }, tr = /(%[0-9A-Fa-f]{2})/u, ze = (e) => {
804
- if (!e.startsWith("#") || e.length === 1) return null;
805
- const t = new TextEncoder(), n = e.slice(1).split(tr).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
806
- return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
807
- }, Nt = (e) => `#${encodeURIComponent(e)}`, nr = (e) => {
808
- if (e === "#") return !0;
809
- const t = ze(e);
810
- return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
811
- }, Pt = (e, t) => {
812
- if (t === "") return null;
813
- for (const n of e.querySelectorAll("[id]"))
814
- if (n.id === t) return n;
815
- return null;
816
- }, rr = "http://www.w3.org/1999/xhtml", nt = (e, t) => {
817
- if (t === "") return null;
818
- const n = Pt(e, t);
819
- if (n !== null) return n;
820
- for (const r of e.querySelectorAll("a[name]"))
821
- if (r.localName === "a" && r.namespaceURI === rr && r.getAttribute("name") === t) return r;
822
- return null;
823
- }, $t = (e, t) => {
824
- if (e === null || !t.startsWith("#")) return null;
825
- const n = nt(e, t.slice(1));
826
- if (n !== null) return n;
827
- const r = ze(t);
828
- return r === null ? null : nt(e, r);
829
- }, rt = (e) => {
830
- const { body: t, documentElement: n } = e.ownerDocument;
831
- if (e === t) {
832
- const o = getComputedStyle(n);
833
- if (o.overflowX === "visible" && o.overflowY === "visible") return !1;
834
- }
835
- const { overflowY: r } = getComputedStyle(e);
836
- return r === "auto" || r === "scroll";
837
- }, or = (e) => {
838
- const { body: t, documentElement: n } = e, r = getComputedStyle(n), o = r.overflowX === "visible" && r.overflowY === "visible" && t !== null ? getComputedStyle(t).overflowY : r.overflowY;
839
- return o !== "hidden" && o !== "clip";
840
- }, lr = (e, t) => {
841
- const n = t.closest(je), r = n !== null && e.contains(n) ? n : e;
842
- if (r.scrollHeight > r.clientHeight && rt(r)) return r;
843
- const o = e.getBoundingClientRect().height, { documentElement: l, scrollingElement: s } = e.ownerDocument;
844
- for (let i = e.parentElement; i !== null && i !== l; i = i.parentElement)
845
- if (rt(i) && i.scrollHeight > i.clientHeight && i.clientHeight < o) return i;
846
- return s instanceof Element && or(e.ownerDocument) && s.scrollHeight > s.clientHeight && s.clientHeight < o ? s : r;
847
- }, sr = Object.freeze({
848
- scrollerOf: lr,
849
- reveal: (e) => {
850
- e.scrollIntoView(Ne);
851
- }
852
- }), Ne = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), ir = (e, t) => {
853
- for (let n = t; n !== null && n !== e; n = n.parentElement) {
854
- const r = n.parentElement;
855
- if (r instanceof HTMLDetailsElement && n !== r.querySelector(":scope > summary") && (r.open = !0), n.getAttribute("hidden")?.toLowerCase() === "until-found") {
856
- if (n.dispatchEvent(new Event("beforematch", { bubbles: !0 })), !n.isConnected) return;
857
- n.removeAttribute("hidden");
858
- }
859
- }
860
- }, ar = (e, t) => {
861
- if (t.getClientRects().length === 0) return;
862
- const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), l = Number.parseFloat(r), s = t.getBoundingClientRect(), i = s.height + l + Number.parseFloat(o) > e.clientHeight;
863
- if (!i && Math.abs(s.top - l - n) < 1) {
864
- t.scrollIntoView(Ne);
865
- return;
866
- }
867
- e.scrollBy({ top: i ? s.top - n - e.clientHeight : s.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(Ne);
868
- }, cr = (e, t) => {
869
- const n = t.scrollerOf(e, e.querySelector(je) ?? e);
870
- n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
871
- }, ot = (e, t, n) => {
872
- if (e === null) return null;
873
- const r = $t(e, t);
874
- return r === null ? (nr(t) && cr(e, n), null) : (ir(e, r), ar(n.scrollerOf(e, r), r), n.reveal(r), r);
875
- };
876
- function dr({
877
- title: e,
878
- titleId: t,
879
- ...n
880
- }, r) {
881
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
882
- xmlns: "http://www.w3.org/2000/svg",
883
- viewBox: "0 0 20 20",
884
- fill: "currentColor",
885
- "aria-hidden": "true",
886
- "data-slot": "icon",
887
- ref: r,
888
- "aria-labelledby": t
889
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
890
- id: t
891
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
892
- 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"
893
- }));
894
- }
895
- const ur = /* @__PURE__ */ x.forwardRef(dr);
896
- function mr({
897
- title: e,
898
- titleId: t,
899
- ...n
900
- }, r) {
901
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
902
- xmlns: "http://www.w3.org/2000/svg",
903
- viewBox: "0 0 20 20",
904
- fill: "currentColor",
905
- "aria-hidden": "true",
906
- "data-slot": "icon",
907
- ref: r,
908
- "aria-labelledby": t
909
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
910
- id: t
911
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
912
- d: "M6.75 8.25a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z"
913
- }), /* @__PURE__ */ x.createElement("path", {
914
- fillRule: "evenodd",
915
- 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",
916
- clipRule: "evenodd"
917
- }));
918
- }
919
- const fr = /* @__PURE__ */ x.forwardRef(mr);
920
- function pr({
921
- title: e,
922
- titleId: t,
923
- ...n
924
- }, r) {
925
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
926
- xmlns: "http://www.w3.org/2000/svg",
927
- viewBox: "0 0 20 20",
928
- fill: "currentColor",
929
- "aria-hidden": "true",
930
- "data-slot": "icon",
931
- ref: r,
932
- "aria-labelledby": t
933
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
934
- id: t
935
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
936
- 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"
937
- }), /* @__PURE__ */ x.createElement("path", {
938
- fillRule: "evenodd",
939
- 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",
940
- clipRule: "evenodd"
941
- }));
942
- }
943
- const hr = /* @__PURE__ */ x.forwardRef(pr);
944
- function gr({
945
- title: e,
946
- titleId: t,
947
- ...n
948
- }, r) {
949
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
950
- xmlns: "http://www.w3.org/2000/svg",
951
- viewBox: "0 0 20 20",
952
- fill: "currentColor",
953
- "aria-hidden": "true",
954
- "data-slot": "icon",
955
- ref: r,
956
- "aria-labelledby": t
957
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
958
- id: t
959
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
960
- fillRule: "evenodd",
961
- 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",
962
- clipRule: "evenodd"
963
- }));
964
- }
965
- const wr = /* @__PURE__ */ x.forwardRef(gr), Pe = "data-aqmx-key-repeat", $e = Object.freeze({ [Pe]: "allow" }), vr = `[${Pe}="${$e[Pe]}"]`, br = () => {
966
- let e = null;
967
- return {
968
- onKeyDownCapture: (t) => {
969
- if (t.key === "Enter") {
970
- if (!t.repeat) {
971
- e = t.target instanceof Element ? t.target : null;
972
- return;
973
- }
974
- e !== null && t.target === e && e.closest(vr) !== null || (t.preventDefault(), t.stopPropagation());
975
- }
976
- },
977
- onKeyUpCapture: (t) => {
978
- t.key === "Enter" && (e = null);
979
- },
980
- onBlurCapture: (t) => {
981
- t.target === e && (e = null);
982
- }
983
- };
984
- }, ge = Object.freeze([1 / ue ** 2, 1 / ue, 1, ue, ue ** 2]), lt = Object.freeze({ mode: "fit" }), Er = 1, Sr = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), kr = oe(null), xr = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= Er ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, st = (e, t, n) => {
985
- if (e.mode === "level") {
986
- const o = e.index + n;
987
- return o >= 0 && o < ge.length ? o : null;
988
- }
989
- if (t === null || !Number.isFinite(t) || t <= 0) return null;
990
- const r = n === 1 ? ge.findIndex((o) => o > t) : ge.findLastIndex((o) => o < t);
991
- return r === -1 ? null : r;
992
- }, it = (e, t, n) => {
993
- if (e.mode === "level") {
994
- const o = st(e, null, n);
995
- return o === null ? null : { mode: "level", index: o, base: e.base };
996
- }
997
- if (t === null) return null;
998
- const r = st(e, t.scale, n);
999
- return r === null ? null : { mode: "level", index: r, base: t.base };
1000
- }, yr = (e) => {
1001
- const t = ge[e];
1002
- if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
1003
- return t;
1004
- }, at = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, Rr = ({ document: e }) => {
1005
- const { labels: t } = P(), n = J(kr), [r] = Z(() => n === null ? null : n.read(e.url)), [o, l] = Z(r === null ? lt : r.zoom), [s, i] = Z(r === null ? null : r.reported), [d, u] = Z(null), p = j(null), h = C((O) => {
1006
- const { naturalWidth: m, naturalHeight: w } = O;
1007
- i((S) => at(S, m, w));
1008
- }, []), b = C(
1009
- (O) => {
1010
- p.current = O, !(O === null || !O.complete) && (O.naturalWidth > 0 || O.naturalHeight > 0 ? h(O) : O.decode().then(
1011
- () => h(O),
1012
- () => {
1013
- }
1014
- ));
1015
- },
1016
- [h]
1017
- );
1018
- ee(() => {
1019
- n !== null && s !== null && n.save(e.url, { zoom: o, reported: s });
1020
- }, [n, e.url, o, s]), G(() => {
1021
- const O = p.current;
1022
- if (O === null || s === null || o.mode !== "fit") return;
1023
- const m = () => u((S) => at(S, O.clientWidth, O.clientHeight));
1024
- if (m(), typeof ResizeObserver > "u") return;
1025
- const w = new ResizeObserver(m);
1026
- return w.observe(O), () => w.disconnect();
1027
- }, [s, o.mode]);
1028
- const T = s === null || d === null ? null : xr(s, d), y = it(o, T, -1), L = it(o, T, 1), k = o.mode === "level" ? yr(o.index) : null, $ = o.mode === "level" && k !== null ? { width: `${o.base.width * k}px`, height: `${o.base.height * k}px` } : void 0;
1029
- return /* @__PURE__ */ z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1030
- /* @__PURE__ */ z(ke, { name: e.name, url: e.url, icon: /* @__PURE__ */ c(wr, {}), children: [
1031
- /* @__PURE__ */ c(
1032
- "button",
1033
- {
1034
- type: "button",
1035
- className: "aqmx-icon-button",
1036
- "aria-label": t.imageZoomOut,
1037
- title: t.imageZoomOut,
1038
- "aria-disabled": y === null,
1039
- onClick: () => {
1040
- y !== null && l(y);
1041
- },
1042
- ...$e,
1043
- children: /* @__PURE__ */ c(fr, {})
1044
- }
1045
- ),
1046
- /* @__PURE__ */ c("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: k === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(k * 100)) }),
1047
- /* @__PURE__ */ c(
1048
- "button",
1049
- {
1050
- type: "button",
1051
- className: "aqmx-icon-button",
1052
- "aria-label": t.imageZoomIn,
1053
- title: t.imageZoomIn,
1054
- "aria-disabled": L === null,
1055
- onClick: () => {
1056
- L !== null && l(L);
1057
- },
1058
- ...$e,
1059
- children: /* @__PURE__ */ c(hr, {})
1060
- }
1061
- ),
1062
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => l(lt), children: /* @__PURE__ */ c(ur, {}) })
1063
- ] }),
1064
- /* @__PURE__ */ c(de, { scrollerProps: Sr, children: /* @__PURE__ */ c("img", { ref: b, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: $, onLoad: (O) => h(O.currentTarget), "data-testid": "markdown-explorer-image" }) })
1065
- ] });
1066
- }, Ft = oe(null), xe = oe(void 0), Dt = oe(null), ye = () => {
1067
- const e = J(Ft);
1068
- if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
1069
- return e;
1070
- }, Tr = () => {
1071
- const e = J(Dt);
1072
- if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
1073
- return e;
1074
- }, Re = (e, t, n, r) => t.kind === "panel" ? le(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? le(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : le(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), Ar = ({ children: e }) => {
1075
- const { config: t } = P(), n = ye(), r = qe(), o = r.kind === "location" ? r.location.source : void 0, l = Se(Re(t, n.navigation, o, n.currentPath));
1076
- return /* @__PURE__ */ c(xe, { value: o, children: /* @__PURE__ */ c(Dt, { value: l, children: e }) });
1077
- }, Lr = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', Or = (e) => {
1078
- const t = e instanceof Element ? e.closest(Lr) : null;
1079
- return t === null ? null : t.getAttribute("data-doc-path");
1080
- }, Te = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, Mr = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: l, onDocumentLink: s, scope: i, children: d }) => {
1081
- const u = Se(e);
1082
- return /* @__PURE__ */ c("a", { ...l, href: u, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (h) => {
1083
- if (Te(h)) {
1084
- if (h.preventDefault(), t === i.currentPath && n !== "") {
1085
- i.scrollWithin(n);
1086
- return;
1087
- }
1088
- s(t, n);
1089
- }
1090
- }, children: d });
1091
- }, Cr = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: l }) => {
1092
- const { config: s } = P(), i = ye(), d = J(xe), u = er(e), { navigation: p } = i, h = `${Re(s, p, d, t)}${u}`, b = n === !1 ? "false" : void 0;
1093
- return p.kind === "page" ? /* @__PURE__ */ c(_n, { ...o, to: h, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": b, children: l }) : /* @__PURE__ */ c(Mr, { to: h, docPath: t, fragment: u, exists: b, className: r, attributes: o, onDocumentLink: p.onDocumentLink, scope: i, children: l });
1094
- }, Nr = ({ className: e, attributes: t, children: n }) => {
1095
- const { labels: r } = P();
1096
- return (
1097
- /* @__PURE__ */ z("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: [
1098
- n,
1099
- /* @__PURE__ */ z("span", { className: "aqmx-sr-only", children: [
1100
- " (",
1101
- r.inertLink,
1102
- ")"
1103
- ] })
1104
- ] })
1105
- );
1106
- }, Pr = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
1107
- const { config: l } = P(), s = J(xe), i = Se(`${Re(l, r.navigation, s, r.currentPath)}${e}`);
1108
- return /* @__PURE__ */ c("a", { ...n, href: i, className: t, onClick: (u) => {
1109
- Te(u) && (u.preventDefault(), r.scrollWithin(e));
1110
- }, children: o });
1111
- }, $r = ({ href: e, className: t, attributes: n, children: r }) => {
1112
- const o = ye();
1113
- return o.navigation.kind === "page" ? /* @__PURE__ */ c("a", { ...n, href: e, className: t, onClick: (s) => {
1114
- if (!Te(s)) return;
1115
- const i = s.currentTarget;
1116
- e === "#" ? o.followEmptyFragment(s.nativeEvent) : i.href === i.ownerDocument.URL && o.followSameUrlJump(e, s.nativeEvent);
1117
- }, children: r }) : /* @__PURE__ */ c(Pr, { href: e, className: t, attributes: n, scope: o, children: r });
1118
- }, Fr = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: l, children: s }) => t === "doc" ? n === void 0 || !dn(n) ? /* @__PURE__ */ c(Nr, { className: o, attributes: l, children: s }) : /* @__PURE__ */ c(Cr, { href: e, docPath: n, docExists: r, className: o, attributes: l, children: s }) : e.startsWith("#") ? /* @__PURE__ */ c($r, { href: e, className: o, attributes: l, children: s }) : /* @__PURE__ */ c("a", { ...l, href: e, className: o, children: s }), Dr = () => {
1119
- const { config: e } = P(), t = ye(), n = J(xe), r = Be();
1120
- return C(
1121
- (o, l) => {
1122
- if (!Te(l)) return !0;
1123
- l.preventDefault();
1124
- const s = Nt(o.id), { navigation: i } = t;
1125
- return i.kind === "panel" || ze(l.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(s), !0) : (r(`${Re(e, i, n, t.currentPath)}${s}`, "follow-link"), !0);
1126
- },
1127
- [e, t, n, r]
1128
- );
1129
- }, qr = () => {
1130
- const e = Tr();
1131
- return C((t) => `${e}${Nt(t.id)}`, [e]);
1132
- };
1133
- function _r({
1134
- title: e,
1135
- titleId: t,
1136
- ...n
1137
- }, r) {
1138
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
1139
- xmlns: "http://www.w3.org/2000/svg",
1140
- viewBox: "0 0 20 20",
1141
- fill: "currentColor",
1142
- "aria-hidden": "true",
1143
- "data-slot": "icon",
1144
- ref: r,
1145
- "aria-labelledby": t
1146
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
1147
- id: t
1148
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
1149
- 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"
1150
- }));
1151
- }
1152
- const Br = /* @__PURE__ */ x.forwardRef(_r);
1153
- function jr({
1154
- title: e,
1155
- titleId: t,
1156
- ...n
1157
- }, r) {
1158
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
1159
- xmlns: "http://www.w3.org/2000/svg",
1160
- viewBox: "0 0 20 20",
1161
- fill: "currentColor",
1162
- "aria-hidden": "true",
1163
- "data-slot": "icon",
1164
- ref: r,
1165
- "aria-labelledby": t
1166
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
1167
- id: t
1168
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
1169
- fillRule: "evenodd",
1170
- 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",
1171
- clipRule: "evenodd"
1172
- }));
1173
- }
1174
- const zr = /* @__PURE__ */ x.forwardRef(jr);
1175
- function Hr({
1176
- title: e,
1177
- titleId: t,
1178
- ...n
1179
- }, r) {
1180
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
1181
- xmlns: "http://www.w3.org/2000/svg",
1182
- viewBox: "0 0 20 20",
1183
- fill: "currentColor",
1184
- "aria-hidden": "true",
1185
- "data-slot": "icon",
1186
- ref: r,
1187
- "aria-labelledby": t
1188
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
1189
- id: t
1190
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
1191
- fillRule: "evenodd",
1192
- 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",
1193
- clipRule: "evenodd"
1194
- }));
1195
- }
1196
- const Ir = /* @__PURE__ */ x.forwardRef(Hr), Zr = Object.freeze({ className: "aqmx-document-stage" }), Ur = (e) => {
1197
- switch (e) {
1198
- case "video":
1199
- return /* @__PURE__ */ c(zr, {});
1200
- case "audio":
1201
- return /* @__PURE__ */ c(Ir, {});
1202
- case "pdf":
1203
- return /* @__PURE__ */ c(Br, {});
1204
- default: {
1205
- const t = e;
1206
- throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`);
1207
- }
1208
- }
1209
- }, Vr = ({ document: e }) => {
1210
- const { labels: t } = P();
1211
- switch (e.mediaType) {
1212
- case "video":
1213
- return (
1214
- /* @__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 })
1215
- );
1216
- case "audio":
1217
- return (
1218
- /* @__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 })
1219
- );
1220
- case "pdf":
1221
- return /* @__PURE__ */ c("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" });
1222
- default: {
1223
- const n = e.mediaType;
1224
- throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`);
1225
- }
1226
- }
1227
- }, Gr = ({ document: e }) => /* @__PURE__ */ z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
1228
- /* @__PURE__ */ c(ke, { name: e.name, url: e.url, icon: Ur(e.mediaType) }),
1229
- /* @__PURE__ */ c(de, { scrollerProps: Zr, children: /* @__PURE__ */ c(Vr, { document: e }) })
1230
- ] }), qt = (e) => {
1231
- const { markupViews: t } = P(), n = C(() => t.isShown(e), [t, e]);
1232
- return Q(t.subscribe, n, n);
1233
- }, Wr = (e) => {
1234
- const { documents: t, markupViews: n } = P(), r = C(() => t.peek(e), [t, e]), o = C(() => t.peekSeeded(e), [t, e]), l = Q(t.subscribe, r, o), s = qt(e), i = C(() => n.toggle(e), [n, e]);
1235
- return { available: ie(l)?.document.kind === "markdown", shown: s, toggle: i };
1236
- }, Kr = (e) => ({
1237
- loading: e.viewerLoading,
1238
- errorPrefix: e.viewerErrorPrefix,
1239
- styleTitle: e.viewerStyleTitle,
1240
- selectStyleAria: e.viewerSelectStyle,
1241
- pinStyleAria: e.viewerPinStyle,
1242
- unpinStyleAria: e.viewerUnpinStyle,
1243
- defaultErrorTitle: e.viewerErrorTitle,
1244
- missingImage: e.viewerMissingImage,
1245
- openTocAria: e.viewerOpenToc,
1246
- tocTitle: e.viewerTocTitle,
1247
- pinTocAria: e.viewerPinToc,
1248
- unpinTocAria: e.viewerUnpinToc,
1249
- selectAlignAria: e.viewerSelectAlign,
1250
- alignTitle: e.viewerAlignTitle,
1251
- pinAlignAria: e.viewerPinAlign,
1252
- unpinAlignAria: e.viewerUnpinAlign,
1253
- alignLeft: e.viewerAlignLeft,
1254
- alignCenter: e.viewerAlignCenter,
1255
- alignRight: e.viewerAlignRight,
1256
- mermaidInteractionMode: e.viewerMermaidInteractionMode,
1257
- mermaidModeNone: e.viewerMermaidModeNone,
1258
- mermaidModeZoom: e.viewerMermaidModeZoom,
1259
- mermaidModePan: e.viewerMermaidModePan,
1260
- mermaidModePanShift: e.viewerMermaidModePanShift,
1261
- mermaidModeBoth: e.viewerMermaidModeBoth,
1262
- mermaidModeBothShift: e.viewerMermaidModeBothShift,
1263
- mermaidZoomIn: e.viewerMermaidZoomIn,
1264
- mermaidZoomOut: e.viewerMermaidZoomOut,
1265
- mermaidResetView: e.viewerMermaidResetView,
1266
- mermaidRetry: e.viewerMermaidRetry,
1267
- embeddedVideo: e.viewerEmbeddedVideo,
1268
- embeddedPost: e.viewerEmbeddedPost,
1269
- embeddedFrame: e.viewerEmbeddedFrame
1270
- }), _t = (e, t, n) => {
1271
- if (t !== void 0) return t;
1272
- if (n !== void 0) return n;
1273
- const [r] = e.documentStyles;
1274
- if (r === void 0) throw new Error("[markdown-explorer] the configuration has no document style");
1275
- return r.name;
1276
- }, Bt = (e, t) => e !== void 0 ? e : t !== void 0 ? t : Sn, jt = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Yr = (e, t, n) => {
1277
- if (t.view === "multi" || t.overrides[n] === void 0) return null;
1278
- const r = n === "style" ? { align: t.overrides.align } : { style: t.overrides.style };
1279
- return t.view === "single" ? le(e, { view: "single", source: t.source, doc: t.doc, overrides: r, embed: t.embed }) : le(e, { view: "tree", source: t.source, doc: t.doc, overrides: r });
1280
- }, He = ({ kind: e, view: t, label: n, stale: r, busy: o, frameRef: l, intent: s, children: i }) => {
1281
- const d = J(Ee);
1282
- return (
1283
- /* @__PURE__ */ z("section", { ref: l, role: "region", "aria-label": n, "aria-busy": o, "data-testid": "markdown-explorer-document", "data-aqmx-document-kind": e, "data-aqmx-document-view": t, "data-aqmx-document-flow": d, className: "aqmx-document", ...s, children: [
1284
- r ? /* @__PURE__ */ c("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
1285
- i
1286
- ] })
1287
- );
1288
- }, Xr = () => {
1289
- const { labels: e } = P();
1290
- return /* @__PURE__ */ c(He, { kind: "empty", label: e.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: e.documentEmpty }) }) });
1291
- }, zt = ({ label: e }) => {
1292
- const { labels: t } = P();
1293
- return /* @__PURE__ */ z(He, { kind: "loading", label: e, stale: !1, busy: !0, children: [
1294
- /* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-document-skeleton", children: jt.map((n) => /* @__PURE__ */ c("span", {}, n)) }),
1295
- /* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: t.documentLoading })
1296
- ] });
1297
- }, Jr = ({ path: e, document: t, viewer: n }) => {
1298
- const { reportMathDiagnostics: r } = P(), o = H(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), l = Dr(), s = qr(), i = H(() => r === void 0 ? void 0 : (d) => r(e, d), [r, e]);
1299
- return /* @__PURE__ */ c("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ c(bt, { ...n, onHeadingSelect: l, headingHref: s, onMathDiagnostics: i, parseResult: o, content: null }) });
1300
- }, Ht = ({ document: e, viewer: t }) => {
1301
- const { labels: n } = P();
1302
- return /* @__PURE__ */ z(wt, { children: [
1303
- /* @__PURE__ */ c(ke, { name: e.name, url: e.url, icon: /* @__PURE__ */ c(qn, {}) }),
1304
- e.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
1305
- /* @__PURE__ */ c("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ c(bt, { ...t, parseResult: null, content: e.text }) })
1306
- ] });
1307
- }, Qr = ({ path: e, name: t, viewer: n }) => {
1308
- const { data: r, documents: o, announcer: l, labels: s } = P(), i = C(() => o.answerStampOf(e), [o, e]), d = Q(o.subscribe, i, i), [u, p] = Z(0), h = H(() => ({ path: e, stamp: d, attempt: u }), [e, d, u]), [b, T] = Z(null), y = ne((k) => {
1309
- T(k), k.kind === "failure" && l.announce(s.documentFailed(t, ae(s, k.failure.reason)));
1310
- });
1311
- ee(() => {
1312
- const k = new AbortController();
1313
- return r.text(h.path, k.signal).then(($) => {
1314
- "kind" in $ && y($);
1315
- }), () => k.abort();
1316
- }, [r, h]);
1317
- const L = C(() => p((k) => k + 1), []);
1318
- return b === null ? /* @__PURE__ */ z(wt, { children: [
1319
- /* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-markup-skeleton", children: jt.map((k) => /* @__PURE__ */ c("span", {}, k)) }),
1320
- /* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: s.markupLoading })
1321
- ] }) : b.kind === "failure" ? /* @__PURE__ */ c(de, { scrollerProps: It, children: /* @__PURE__ */ c(Tt, { failure: b.failure, alert: !1, onRetry: L, testId: "markdown-explorer-markup-failure" }) }) : /* @__PURE__ */ c(Ht, { document: b, viewer: n });
1322
- }, It = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), eo = ({ path: e, document: t, markup: n, viewer: r, onRetry: o }) => {
1323
- switch (t.kind) {
1324
- case "markdown":
1325
- return n ? /* @__PURE__ */ c(Qr, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ c(Jr, { path: e, document: t, viewer: r });
1326
- case "text":
1327
- return /* @__PURE__ */ c(Ht, { document: t, viewer: r });
1328
- case "image":
1329
- return /* @__PURE__ */ c(Rr, { document: t });
1330
- case "media":
1331
- return /* @__PURE__ */ c(Gr, { document: t });
1332
- case "file":
1333
- return /* @__PURE__ */ c(Qn, { document: t });
1334
- case "failure":
1335
- return /* @__PURE__ */ c(de, { scrollerProps: It, children: /* @__PURE__ */ c(Tt, { failure: t.failure, alert: !1, onRetry: o, testId: "markdown-explorer-document-failure" }) });
1336
- default: {
1337
- const l = t;
1338
- throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(l)}`);
1339
- }
1340
- }
1341
- }, to = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', no = (e, t, n) => {
1342
- const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : $t(e, n), r === void 0 ? null : Pt(e, r.id), e.querySelector(je), e.querySelector(to)];
1343
- for (const l of o)
1344
- if (l instanceof HTMLElement && At(l)) return l;
1345
- return null;
1346
- }, ct = (e, t, n) => {
1347
- const { activeElement: r, body: o } = e.ownerDocument, l = r === null || r === o;
1348
- t instanceof HTMLElement && n && (l || e.contains(r)) && At(t);
1349
- }, ro = (e) => {
1350
- const t = j(!1);
1351
- return G(() => {
1352
- const n = e.current;
1353
- if (n === null) throw new Error("[markdown-explorer] the document region is not mounted");
1354
- const r = n.ownerDocument, o = r.defaultView;
1355
- if (o === null) throw new Error("[markdown-explorer] the document region's document has no window");
1356
- let l = !1, s;
1357
- const i = (b) => {
1358
- l = !(b.target instanceof Node && n.contains(b.target)), l && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(s), s = setTimeout(() => {
1359
- l = !1;
1360
- }, 0);
1361
- }, d = (b) => {
1362
- t.current = b.target instanceof Node && n.contains(b.target);
1363
- }, u = (b) => {
1364
- b.relatedTarget === null && l && (t.current = !1);
1365
- }, p = () => {
1366
- const { activeElement: b, body: T } = r;
1367
- b !== null && b !== T && (t.current = n.contains(b));
1368
- }, h = () => {
1369
- l && !n.contains(r.activeElement) && (t.current = !1);
1370
- };
1371
- return o.addEventListener("pointerdown", i, !0), o.addEventListener("mousedown", i, !0), o.addEventListener("focusin", d, !0), o.addEventListener("blur", p), o.addEventListener("focus", h), n.addEventListener("focusout", u), () => {
1372
- clearTimeout(s), o.removeEventListener("pointerdown", i, !0), o.removeEventListener("mousedown", i, !0), o.removeEventListener("focusin", d, !0), o.removeEventListener("blur", p), o.removeEventListener("focus", h), n.removeEventListener("focusout", u);
1373
- };
1374
- }, [e]), t;
1375
- }, oo = ({ path: e, snapshot: t, stale: n, viewer: r, regionLabel: o, navigation: l, fragment: s, paneScroll: i, announces: d, announceFailure: u, onDocumentShown: p }) => {
1376
- const { labels: h, announcer: b, documents: T } = P(), { document: y } = t, L = j(null), k = j(null), $ = j(null), O = j(0), m = ro(L), w = j({ path: e, document: y }), S = j(null), E = C(
1377
- (g) => {
1378
- const v = L.current, A = ot(v, g, i);
1379
- v !== null && A !== null && ct(v, A, m.current);
1380
- },
1381
- [i, m]
1382
- ), R = C(
1383
- (g, v) => {
1384
- const A = O.current;
1385
- setTimeout(() => {
1386
- !v.defaultPrevented && O.current === A && E(g);
1387
- }, 0);
1388
- },
1389
- [E]
1390
- ), F = C(
1391
- (g) => {
1392
- setTimeout(() => {
1393
- g.defaultPrevented || E("#");
1394
- }, 0);
1395
- },
1396
- [E]
1397
- ), I = H(() => ({ navigation: l, currentPath: e, scrollWithin: E, followSameUrlJump: R, followEmptyFragment: F }), [l, e, E, R, F]), N = C(() => T.retry(e), [T, e]), B = Bn(T, Or), W = qt(e) ? "markup" : "rendered", U = y.kind === "markdown" ? W : void 0, q = ne((g, v) => {
1398
- const A = k.current;
1399
- if (A !== null && A.path === g && A.snapshot === v) return;
1400
- k.current = { path: g, snapshot: v };
1401
- const M = v.document;
1402
- if (M.kind === "failure") {
1403
- T.noteFailureShown(v) && u(h.documentFailed(Et(g), ae(h, M.failure.reason)));
1404
- return;
1405
- }
1406
- p?.(g, M), d && (A === null || A.path !== g || A.snapshot.document.kind === "failure") && b.announce(h.documentShown(M.name));
1407
- });
1408
- ee(() => {
1409
- q(e, t);
1410
- }, [e, t]);
1411
- const V = ne(() => {
1412
- s.kind === "panel" && s.consume();
1413
- }), K = ne((g) => {
1414
- const v = L.current;
1415
- if (v === null || !m.current) return null;
1416
- const { activeElement: A, body: M } = v.ownerDocument;
1417
- return A !== null && A !== M ? null : no(v, y, g);
1418
- }), Ae = ne((g) => {
1419
- const v = L.current;
1420
- v !== null && ct(v, g, m.current);
1421
- }), a = ne((g) => i.reveal(g)), f = ne((g) => ot(L.current, g, i));
1422
- return ee(() => {
1423
- if (n) return;
1424
- const g = w.current.path !== e, v = g || w.current.document !== y;
1425
- w.current = { path: e, document: y };
1426
- const A = S.current !== e;
1427
- S.current = e;
1428
- let M = null;
1429
- s.kind === "page" ? $.current !== s.navigation && ($.current = s.navigation, O.current += 1, M = s.fragment) : s.fragment !== null && (M = s.fragment, V());
1430
- const _ = () => {
1431
- const D = M === null ? null : f(M);
1432
- if (!v) {
1433
- D !== null && Ae(D);
1434
- return;
1435
- }
1436
- const Y = K(s.fragment);
1437
- g && D === null && Y !== null && a(Y);
1438
- };
1439
- A ? queueMicrotask(_) : _();
1440
- }, [s, e, y, n]), /* @__PURE__ */ c(He, { kind: y.kind, view: U, label: o(e, y), stale: n, busy: n, frameRef: L, intent: B, children: /* @__PURE__ */ c(Ft, { value: I, children: /* @__PURE__ */ c(Ar, { children: /* @__PURE__ */ c(eo, { path: e, document: y, markup: U === "markup", viewer: r, onRetry: N }, e) }) }) });
1441
- }, Ie = Object.freeze({ kind: "skeleton" }), lo = (e, t, n, r, o) => {
1442
- if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
1443
- const l = ie(t);
1444
- if (l !== null) return { kind: "document", path: e, snapshot: l, stale: !0 };
1445
- if (o && t?.status === "pending") return { kind: "streaming", path: e, promise: t.promise };
1446
- const s = n === null || n === e ? null : ie(r);
1447
- return n === null || s === null ? Ie : { kind: "document", path: n, snapshot: s, stale: !0 };
1448
- }, so = (e, t) => t.status === "deferred" ? Ie : { kind: "document", path: e, snapshot: t, stale: !1 }, io = ({ requestedPath: e, content: t, ...n }) => {
1449
- const r = t.kind === "streaming" ? so(t.path, J(t.promise)) : t;
1450
- return r.kind !== "document" ? /* @__PURE__ */ c(zt, { label: n.regionLabel(e, null) }) : /* @__PURE__ */ c(oo, { path: r.path, snapshot: r.snapshot, stale: r.stale, ...n });
1451
- }, Zt = ({ path: e, display: t, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: i }) => {
1452
- const { config: d, labels: u, theme: p, documents: h } = P(), b = cn(), T = j(!1);
1453
- G(() => {
1454
- T.current = !0;
1455
- }, []);
1456
- const [y, L] = Z(null), k = C(() => e === null ? void 0 : h.peek(e), [h, e]), $ = Q(h.subscribe, k, k), O = C(() => y === null ? void 0 : h.peek(y), [h, y]), m = Q(h.subscribe, O, O);
1457
- G(() => e === null ? void 0 : h.open(e), [h, e]), G(() => y === null ? void 0 : h.retain(y), [h, y]);
1458
- const w = e === null ? Ie : lo(e, $, y, m, !T.current), S = e === null ? null : w.kind === "document" && !w.stale ? w.path : y;
1459
- S !== y && L(S);
1460
- const E = H(() => Kr(u), [u]), R = H(() => [...d.iframeHosts], [d]), F = n.kind === "panel", I = H(
1461
- () => ({
1462
- labels: E,
1463
- emptyMessage: u.documentEmpty,
1464
- theme: p,
1465
- availableStyles: d.documentStyles,
1466
- iFrameAllowedDomains: R,
1467
- embeds: d.embeds,
1468
- linkComponent: Fr,
1469
- toolbar: b,
1470
- style: t.style,
1471
- onStyleChange: t.onStyleChange,
1472
- align: t.align,
1473
- onAlignChange: t.onAlignChange,
1474
- showToc: t.showToc,
1475
- showStyle: t.showStyle,
1476
- showAlign: t.showAlign,
1477
- padding: t.padding,
1478
- width: t.width === void 0 ? void 0 : `min(${t.width}, 100%)`,
1479
- maxWidth: t.maxWidth === void 0 ? void 0 : `min(${t.maxWidth}, 100%)`,
1480
- renderScrollBar: F ? void 0 : Lt
1481
- }),
1482
- [E, u.documentEmpty, p, d.documentStyles, R, d.embeds, b, t, F]
1483
- ), N = C((W, U) => F ? U === null || U.kind === "failure" ? Et(W) : U.name : u.documentRegion, [F, u.documentRegion]), B = F ? "content" : "fill";
1484
- return e === null ? /* @__PURE__ */ c(Ee, { value: B, children: /* @__PURE__ */ c(Xr, {}) }) : /* @__PURE__ */ c(Ee, { value: B, children: /* @__PURE__ */ c(we, { fallback: /* @__PURE__ */ c(zt, { label: N(e, null) }), children: /* @__PURE__ */ c(io, { requestedPath: e, content: w, viewer: I, regionLabel: N, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: i }) }) });
1485
- }, ao = ({ path: e, variant: t, onDocumentShown: n }) => {
1486
- const { config: r, viewSettings: o, announcer: l } = P(), s = ve((R) => R.style), i = ve((R) => R.align), d = Be(), u = vt(), p = qe(), { view: h, overrides: b, embed: T } = t, y = C(
1487
- (R) => {
1488
- if (p.kind !== "location") return;
1489
- const F = Yr(r, p.location, R);
1490
- F !== null && d(F, "browse");
1491
- },
1492
- [r, d, p]
1493
- ), L = C(
1494
- (R) => {
1495
- o.update({ style: R }), y("style");
1496
- },
1497
- [o, y]
1498
- ), k = C(
1499
- (R) => {
1500
- o.update({ align: R }), y("align");
1501
- },
1502
- [o, y]
1503
- ), $ = _t(r, b.style, s), O = Bt(b.align, i), m = H(
1504
- () => ({
1505
- style: $,
1506
- onStyleChange: L,
1507
- align: O,
1508
- onAlignChange: k,
1509
- showToc: T.showToc !== !1,
1510
- showStyle: T.showStyle !== !1,
1511
- showAlign: T.showAlign !== !1,
1512
- padding: T.padding,
1513
- width: T.width,
1514
- maxWidth: T.maxWidth
1515
- }),
1516
- [$, L, O, k, T]
1517
- ), w = H(() => ({ kind: "page", view: h, overrides: b, embed: T }), [h, b, T]), S = H(() => ({ kind: "page", fragment: u.hash, navigation: u }), [u]), E = C((R) => l.announce(R), [l]);
1518
- return /* @__PURE__ */ c(Zt, { path: e, display: m, navigation: w, fragment: S, paneScroll: sr, announces: !0, announceFailure: E, onDocumentShown: n });
1519
- }, co = ({ path: e, variant: t, onDocumentShown: n }) => {
1520
- const { config: r, viewSettings: o } = P(), l = ve((w) => w.style), s = ve((w) => w.align), [i, d] = Z(() => _t(r, void 0, l)), u = Bt(void 0, s), p = C((w) => o.update({ align: w }), [o]), { maximized: h, onDocumentLink: b, pendingHash: T, onHashConsumed: y, announceFailure: L, paneScroll: k } = t, $ = H(
1521
- () => ({
1522
- style: i,
1523
- onStyleChange: d,
1524
- align: u,
1525
- onAlignChange: p,
1526
- showToc: h,
1527
- showStyle: h,
1528
- showAlign: h,
1529
- padding: void 0,
1530
- width: void 0,
1531
- maxWidth: void 0
1532
- }),
1533
- [i, u, p, h]
1534
- ), O = H(() => ({ kind: "panel", onDocumentLink: b }), [b]), m = H(() => ({ kind: "panel", fragment: T, consume: y }), [T, y]);
1535
- return /* @__PURE__ */ c(Zt, { path: e, display: $, navigation: O, fragment: m, paneScroll: k, announces: !1, announceFailure: L, onDocumentShown: n });
1536
- }, uo = ({ path: e, variant: t, onDocumentShown: n }) => t.kind === "page" ? /* @__PURE__ */ c(ao, { path: e, variant: t, onDocumentShown: n }) : /* @__PURE__ */ c(co, { path: e, variant: t, onDocumentShown: n });
1537
- function mo({
1538
- title: e,
1539
- titleId: t,
1540
- ...n
1541
- }, r) {
1542
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
1543
- xmlns: "http://www.w3.org/2000/svg",
1544
- viewBox: "0 0 24 24",
1545
- fill: "currentColor",
1546
- "aria-hidden": "true",
1547
- "data-slot": "icon",
1548
- ref: r,
1549
- "aria-labelledby": t
1550
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
1551
- id: t
1552
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
1553
- fillRule: "evenodd",
1554
- 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",
1555
- clipRule: "evenodd"
1556
- }));
1557
- }
1558
- const fo = /* @__PURE__ */ x.forwardRef(mo);
1559
- function po({
1560
- title: e,
1561
- titleId: t,
1562
- ...n
1563
- }, r) {
1564
- return /* @__PURE__ */ x.createElement("svg", Object.assign({
1565
- xmlns: "http://www.w3.org/2000/svg",
1566
- viewBox: "0 0 24 24",
1567
- fill: "currentColor",
1568
- "aria-hidden": "true",
1569
- "data-slot": "icon",
1570
- ref: r,
1571
- "aria-labelledby": t
1572
- }, n), e ? /* @__PURE__ */ x.createElement("title", {
1573
- id: t
1574
- }, e) : null, /* @__PURE__ */ x.createElement("path", {
1575
- fillRule: "evenodd",
1576
- 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",
1577
- clipRule: "evenodd"
1578
- }));
1579
- }
1580
- const ho = /* @__PURE__ */ x.forwardRef(po), go = /* @__PURE__ */ new Set(), wo = (e, t) => {
1581
- const { documents: n, announcer: r, labels: o } = P(), l = C(() => n.peek(e), [n, e]), s = C(() => n.peekSeeded(e), [n, e]), i = Q(n.subscribe, l, s), d = C(() => n.answerStampOf(e), [n, e]), u = Q(n.subscribe, d, d), [p] = Z(() => /* @__PURE__ */ new Set()), [h, b] = Z(go), [T, y] = Z(null);
1582
- T !== null && T.path !== e && y(null);
1583
- const L = j(null);
1584
- G(() => (L.current = e, () => {
1585
- L.current = null;
1586
- }), [e]);
1587
- const k = C(() => {
1588
- const m = e, w = n.peek(m);
1589
- if (p.has(m) || w?.status === "pending") return;
1590
- const S = t && !Ct(w);
1591
- p.add(m), b(new Set(p)), y(null), (async () => {
1592
- try {
1593
- const E = await n.refresh(m);
1594
- if (L.current !== m || E.status === "superseded") return;
1595
- if (E.status === "failed") {
1596
- y({ path: m, failure: E.failure, stamp: n.answerStampOf(m) }), r.announce(o.documentRefreshFailed(ae(o, E.failure.reason)));
1597
- return;
1598
- }
1599
- const R = ie(n.peek(m));
1600
- if (S || R === null || R.document.kind === "failure") return;
1601
- r.announce(o.documentRefreshed(R.document.name));
1602
- } finally {
1603
- p.delete(m), b(new Set(p));
1604
- }
1605
- })();
1606
- }, [e, t, p, n, r, o]), $ = h.has(e), O = T !== null && T.path === e && T.stamp === u ? T.failure : null;
1607
- return { refreshing: $, unavailable: $ || i?.status === "pending", failure: O, refresh: k };
1608
- }, vo = Object.freeze({ kind: "page" }), dt = (e) => {
1609
- e.stopPropagation();
1610
- }, bo = ({ path: e, placement: t }) => {
1611
- const { labels: n } = P(), { refreshing: r, unavailable: o, failure: l, refresh: s } = wo(e, t.kind === "page"), i = Wr(e), d = t.kind === "panel" ? n.refreshDocumentNamed(t.documentName) : null, u = t.kind === "panel" ? n.showMarkupNamed(t.documentName) : null;
1612
- return /* @__PURE__ */ z("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", children: [
1613
- /* @__PURE__ */ z("div", { className: "aqmx-document-refresh-row", children: [
1614
- i.available ? /* @__PURE__ */ z(
1615
- "button",
1616
- {
1617
- type: "button",
1618
- className: u === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
1619
- title: u === null ? n.showMarkup : u,
1620
- "aria-label": u === null ? void 0 : u,
1621
- "aria-pressed": i.shown,
1622
- "data-testid": "markdown-explorer-document-markup",
1623
- onClick: i.toggle,
1624
- onDoubleClick: dt,
1625
- children: [
1626
- /* @__PURE__ */ c(ho, { "aria-hidden": "true" }),
1627
- u === null ? /* @__PURE__ */ c("span", { children: n.showMarkupLabel }) : null
1628
- ]
1629
- }
1630
- ) : null,
1631
- /* @__PURE__ */ z(
1632
- "button",
1633
- {
1634
- type: "button",
1635
- className: d === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
1636
- title: d === null ? n.refreshDocument : d,
1637
- "aria-label": d === null ? void 0 : d,
1638
- "aria-disabled": o,
1639
- "aria-busy": r,
1640
- "data-aqmx-busy": r ? "true" : void 0,
1641
- "data-testid": "markdown-explorer-document-refresh",
1642
- onClick: s,
1643
- onDoubleClick: dt,
1644
- children: [
1645
- /* @__PURE__ */ c(fo, { "aria-hidden": "true" }),
1646
- d === null ? /* @__PURE__ */ c("span", { children: n.refreshDocumentLabel }) : null
1647
- ]
1648
- }
1649
- )
1650
- ] }),
1651
- l === null ? null : /* @__PURE__ */ c("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": l.reason, children: n.documentRefreshFailed(ae(n, l.reason)) })
1652
- ] });
1653
- }, Eo = ({ location: e }) => {
1654
- const t = e.doc, n = H(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]);
1655
- return /* @__PURE__ */ z("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", children: [
1656
- /* @__PURE__ */ c(bo, { path: t, placement: vo }),
1657
- /* @__PURE__ */ c(uo, { path: t, variant: n })
1658
- ] });
1659
- }, So = ({ holds: e, testId: t }) => {
1660
- const { labels: n, announcer: r } = P(), o = Gt();
1661
- G(() => e ? r.claim(o) : void 0, [e, r, o]);
1662
- const l = C(() => r.shownIn(o), [r, o]), s = Q(r.subscribe, l, l);
1663
- return /* @__PURE__ */ c("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: s.length > 1 ? n.announcementSequence(s) : s[0] });
1664
- }, re = Object.freeze([]), ko = (e) => {
1665
- const t = /* @__PURE__ */ new Set();
1666
- let n = re, r = [], o = !1;
1667
- const l = [], s = (p) => {
1668
- n = p;
1669
- for (const h of [...t]) h();
1670
- }, i = () => l.at(-1)?.region, d = (p) => {
1671
- const h = i();
1672
- p(), i() !== h && n !== re && s(re);
1673
- }, u = () => {
1674
- o = !1;
1675
- const p = r.map((h) => "sentence" in h ? h.sentence : h.list(h.items));
1676
- r = [], s(Object.freeze(p));
1677
- };
1678
- return {
1679
- announce: (p) => {
1680
- if (typeof p == "string") r.push({ sentence: p });
1681
- else {
1682
- const h = r.find((b) => "list" in b && b.list === p.list);
1683
- h !== void 0 && "items" in h ? h.items.push(p.item) : r.push({ list: p.list, items: [p.item] });
1684
- }
1685
- o || (o = !0, n !== re && s(re), e.request(u));
1686
- },
1687
- subscribe: (p) => (t.add(p), () => {
1688
- t.delete(p);
1689
- }),
1690
- claim: (p) => {
1691
- const h = { region: p };
1692
- return d(() => l.push(h)), () => d(() => {
1693
- const b = l.indexOf(h);
1694
- b !== -1 && l.splice(b, 1);
1695
- });
1696
- },
1697
- shownIn: (p) => i() === p ? n : re
1698
- };
1699
- }, fe = Object.freeze({ status: "cancelled" }), xo = (e) => {
1700
- if (e === null || typeof e != "object") return null;
1701
- const { failure: t } = e;
1702
- if (gn(t) !== null) return null;
1703
- const { reason: n, code: r } = t;
1704
- return wn(n, r);
1705
- }, yo = ({ dataPath: e, onScope: t, fetch: n }) => {
1706
- const r = n ?? ((i, d) => globalThis.fetch(i, d)), o = (i, d) => `${e}/${i}?${new URLSearchParams(d).toString()}`, l = async (i, d, u, p) => {
1707
- let h;
1708
- try {
1709
- h = await r(i, { credentials: "same-origin", ...d, headers: { Accept: "application/json", ...d.headers } });
1710
- } catch {
1711
- return p({ reason: "failed" });
1712
- }
1713
- h.status === 401 && t(null);
1714
- const b = h.headers.get(un);
1715
- b !== null && t(b);
1716
- let T;
1717
- try {
1718
- T = await h.json();
1719
- } catch {
1720
- return p({ reason: Ge(h.status) });
1721
- }
1722
- let y;
1723
- try {
1724
- y = u(T);
1725
- } catch {
1726
- y = !1;
1727
- }
1728
- if (y) return T;
1729
- const L = xo(T);
1730
- return p(L !== null ? L : { reason: h.status === 200 ? "failed" : Ge(h.status) });
1731
- }, s = { [En]: vn };
1732
- return {
1733
- tree: (i) => l(o("tree", { [X.source]: i }), { method: "GET" }, Ke, (d) => ({ status: "error", failure: d })),
1734
- children: async (i, d, u) => {
1735
- const p = await l(o("children", { [X.source]: i, [X.path]: d }), { method: "GET", signal: u }, hn, (h) => ({ status: "error", failure: h }));
1736
- return u.aborted ? fe : p;
1737
- },
1738
- ancestors: async (i, d, u) => {
1739
- const p = await l(o("ancestors", { [X.source]: i, [X.path]: d }), { method: "GET", signal: u }, pn, (h) => ({ status: "error", failure: h }));
1740
- return u.aborted ? fe : p;
1741
- },
1742
- reveal: async (i, d, u) => {
1743
- const p = await l(o("reveal", { [X.source]: i, [X.path]: d }), { method: "GET", signal: u }, fn, (h) => ({ status: "error", failure: h }));
1744
- return u.aborted ? fe : p;
1745
- },
1746
- document: (i, { refresh: d }) => l(o("document", { [X.path]: i }), d ? { method: "GET", headers: s } : { method: "GET" }, bn, (u) => We(u.reason, u.code)),
1747
- text: async (i, d) => {
1748
- const u = await l(o("text", { [X.path]: i }), { method: "GET", signal: d }, mn, (p) => We(p.reason, p.code));
1749
- return d.aborted ? fe : u;
1750
- },
1751
- refresh: (i) => l(o("refresh", { [X.source]: i }), { method: "POST", headers: s }, Ke, (d) => ({ status: "error", failure: d }))
1752
- };
1753
- }, Ro = () => {
1754
- const e = /* @__PURE__ */ new Set(), t = ce();
1755
- return {
1756
- isShown: (n) => e.has(n),
1757
- toggle: (n) => {
1758
- e.delete(n) || e.add(n), t.emit();
1759
- },
1760
- subscribe: t.subscribe
1761
- };
1762
- }, To = () => {
1763
- let e = null, t = null;
1764
- return {
1765
- settle: (n) => {
1766
- e = n;
1767
- },
1768
- mayMove: (n) => e !== n,
1769
- move: (n, r, o) => {
1770
- e = r, t = { sourceId: n, path: r, ancestors: o };
1771
- },
1772
- take: (n, r) => {
1773
- const o = t !== null && t.sourceId === n && t.path === r ? t.ancestors : null;
1774
- return t = null, o;
1775
- }
1776
- };
1777
- }, Ao = (e) => {
1778
- const t = xn(e);
1779
- if (t === null) return Ue;
1780
- try {
1781
- return ln(JSON.parse(t));
1782
- } catch (n) {
1783
- return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), Ue;
1784
- }
1785
- }, ut = (e, t) => {
1786
- let n = null;
1787
- const r = () => {
1788
- if (n === null) {
1789
- const l = Ao(e);
1790
- n = { changes: l, settings: Ze(t, l) };
1791
- }
1792
- return n;
1793
- }, o = ce();
1794
- return {
1795
- storageKey: e,
1796
- defaults: t,
1797
- getSnapshot: () => r().settings,
1798
- getServerSnapshot: () => t,
1799
- subscribe: o.subscribe,
1800
- advance: (l) => {
1801
- const { changes: s, settings: i } = r(), d = nn(s, l, rn(i, l)[l], t);
1802
- return n = { changes: d, settings: Ze(t, d) }, o.emit(), kn(e, on(d)), n.settings;
1803
- }
1804
- };
1805
- }, Lo = Object.freeze({ status: "refreshed" }), Oo = Object.freeze({ status: "superseded" }), Fe = Object.freeze({ status: "deferred" }), Mo = Mt(Fe), Ut = 4, Co = Ut - 1, mt = Object.freeze({ status: "loading" }), No = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), Po = (e) => {
1806
- const t = /* @__PURE__ */ new Map(), n = Ot(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = ce(), d = /* @__PURE__ */ new Set();
1807
- let u = 0, p = 0;
1808
- const h = { direct: null, bulk: null }, b = /* @__PURE__ */ new Set();
1809
- let T = !1, y = 0;
1810
- const L = () => {
1811
- y += 1, i.emit();
1812
- }, k = (a) => o.get(a) ?? 0, $ = (a) => {
1813
- let f = s.get(a);
1814
- return f === void 0 && (f = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, s.set(a, f)), f;
1815
- }, O = (a, f, g) => {
1816
- a.inFlight.delete(f), u -= 1, g.lane === "bulk" && (p -= 1);
1817
- }, m = (a) => {
1818
- const f = s.get(a);
1819
- if (f !== void 0) {
1820
- for (const [g, v] of [...f.inFlight])
1821
- O(f, g, v), v.controller.abort();
1822
- f.direct.clear(), f.bulk.clear(), f.unclaimed.clear();
1823
- }
1824
- }, w = (a) => {
1825
- const f = k(a) + 1;
1826
- return o.set(a, f), m(a), f;
1827
- }, S = (a, f) => {
1828
- const g = me(a), v = { promise: a, opened: f, stale: !1, loadedAt: g?.status === "ok" ? g.loadedAt : null };
1829
- return a.status === "pending" && a.then((A) => {
1830
- A.status === "ok" && (v.loadedAt = A.loadedAt);
1831
- }), v;
1832
- }, E = (a) => {
1833
- let f = r.get(a);
1834
- return f === void 0 && (f = /* @__PURE__ */ new Map(), r.set(a, f)), f;
1835
- }, R = (a) => {
1836
- const f = [...s.keys()], g = h[a], v = g === null ? 0 : f.indexOf(g) + 1;
1837
- for (let A = 0; A < f.length; A += 1) {
1838
- const M = f[(v + A) % f.length], _ = M === void 0 ? void 0 : s.get(M);
1839
- if (!(M === void 0 || _ === void 0)) {
1840
- for (const D of _[a])
1841
- if ((_.claims.get(D) ?? 0) !== 0)
1842
- return _[a].delete(D), h[a] = M, { sourceId: M, path: D };
1843
- }
1844
- }
1845
- return null;
1846
- }, F = (a, f, g, v) => {
1847
- const A = s.get(a);
1848
- if (A === void 0 || A.inFlight.get(f) !== g) return;
1849
- O(A, f, g);
1850
- const M = (A.claims.get(f) ?? 0) > 0, _ = E(a);
1851
- if (v.status === "ok" ? _.set(f, { status: "loaded", entries: v.entries }) : v.status === "error" && M ? _.set(f, { status: "failed", failure: v.failure }) : _.delete(f), L(), v.status === "error" && M) {
1852
- const D = { sourceId: a, path: f, failure: v.failure };
1853
- for (const Y of [...d]) Y(D);
1854
- }
1855
- N();
1856
- }, I = (a, f, g) => {
1857
- const v = { controller: new AbortController(), lane: g };
1858
- $(a).inFlight.set(f, v), u += 1, g === "bulk" && (p += 1), e.children(a, f, v.controller.signal).then(
1859
- (A) => F(a, f, v, A),
1860
- () => F(a, f, v, No)
1861
- );
1862
- }, N = () => {
1863
- for (; u < Ut; ) {
1864
- const a = R("direct");
1865
- if (a !== null) {
1866
- I(a.sourceId, a.path, "direct");
1867
- continue;
1868
- }
1869
- const f = p < Co ? R("bulk") : null;
1870
- if (f === null) return;
1871
- I(f.sourceId, f.path, "bulk");
1872
- }
1873
- }, B = (a, f, g) => {
1874
- if (!(f.direct.delete(g) || f.bulk.delete(g))) {
1875
- const A = f.inFlight.get(g);
1876
- if (A === void 0) return !1;
1877
- O(f, g, A), A.controller.abort();
1878
- }
1879
- return r.get(a)?.delete(g), !0;
1880
- }, W = () => {
1881
- T = !1;
1882
- let a = !1;
1883
- for (const f of b) {
1884
- const g = $(f);
1885
- for (const v of g.unclaimed)
1886
- (g.claims.get(v) ?? 0) === 0 && B(f, g, v) && (a = !0);
1887
- g.unclaimed.clear();
1888
- }
1889
- b.clear(), a && (L(), N());
1890
- }, U = (a, f) => {
1891
- t.set(a, S(se(e.tree(a)), f));
1892
- }, q = (a, f, g) => {
1893
- w(a);
1894
- const v = S(Mt(f), g);
1895
- return t.set(a, v), r.delete(a), L(), N(), v;
1896
- }, V = (a, f, g, v) => {
1897
- if (g !== k(a) || t.get(a) !== f) return;
1898
- const A = me(f.promise);
1899
- if (!(v.status !== "ok" || A?.status !== "ok" || f.loadedAt === null || v.loadedAt <= f.loadedAt)) {
1900
- if (be(A.entries, v.entries)) {
1901
- f.loadedAt = v.loadedAt;
1902
- return;
1903
- }
1904
- q(a, v, f.opened);
1905
- }
1906
- }, K = (a, f) => {
1907
- const g = t.get(a);
1908
- return g !== void 0 && me(g.promise)?.status === f;
1909
- }, Ae = (a, f) => {
1910
- f.stale = !1;
1911
- const g = k(a);
1912
- e.tree(a).then((v) => V(a, f, g, v));
1913
- };
1914
- return {
1915
- read: (a) => t.get(a)?.promise ?? Mo,
1916
- open: (a) => {
1917
- const f = n.resumes(a), g = n.hold(a), v = t.get(a);
1918
- return v === void 0 || K(a, "deferred") ? (U(a, !0), L()) : f || (v.opened && K(a, "error") ? (U(a, !0), L()) : (v.opened = !0, v.stale && K(a, "ok") && Ae(a, v))), g;
1919
- },
1920
- retry: (a) => {
1921
- K(a, "error") && (U(a, !0), L());
1922
- },
1923
- seed: (a, f) => {
1924
- const g = f.then(
1925
- (M) => M === null ? Fe : M,
1926
- () => Fe
1927
- ), v = t.get(a);
1928
- if (v !== void 0 && K(a, "ok")) {
1929
- const M = k(a);
1930
- g.then((_) => V(a, v, M, _));
1931
- return;
1932
- }
1933
- w(a);
1934
- const A = S(se(g), v?.opened === !0);
1935
- t.set(a, A), r.delete(a), N(), g.then((M) => {
1936
- t.get(a) === A && (M.status === "deferred" && n.isHeld(a) && U(a, A.opened), L());
1937
- });
1938
- },
1939
- refresh: async (a) => {
1940
- const f = (l.get(a) ?? 0) + 1;
1941
- l.set(a, f);
1942
- const g = await e.refresh(a);
1943
- if (l.get(a) !== f) return Oo;
1944
- if (g.status === "error") return { status: "failed", failure: g.failure };
1945
- const v = t.get(a);
1946
- if (!(v !== void 0 && v.loadedAt !== null && K(a, "ok") && v.loadedAt > g.loadedAt)) {
1947
- const M = q(a, g, !0);
1948
- if (v !== void 0 && v.promise.status === "pending") {
1949
- const _ = k(a);
1950
- v.promise.then((D) => V(a, M, _, D));
1951
- }
1952
- }
1953
- for (const [M, _] of t)
1954
- M !== a && me(_.promise)?.status === "ok" && (_.stale = !0);
1955
- return Lo;
1956
- },
1957
- children: (a, f) => r.get(a)?.get(f),
1958
- claimChildren: (a, f) => {
1959
- const g = $(a), v = E(a);
1960
- let A = !1, M = !1;
1961
- for (const [D, Y] of f)
1962
- g.claims.set(D, (g.claims.get(D) ?? 0) + 1), v.get(D) === void 0 ? (v.set(D, mt), g[Y].add(D), A = !0, M = !0) : Y === "direct" && g.bulk.delete(D) && (g.direct.add(D), M = !0);
1963
- A && L(), M && N();
1964
- let _ = !1;
1965
- return () => {
1966
- if (!_) {
1967
- _ = !0;
1968
- for (const D of f.keys()) {
1969
- const Y = (g.claims.get(D) ?? 0) - 1;
1970
- Y > 0 ? g.claims.set(D, Y) : (g.claims.delete(D), g.unclaimed.add(D));
1971
- }
1972
- b.add(a), !T && (T = !0, queueMicrotask(W));
1973
- }
1974
- };
1975
- },
1976
- retryChildren: (a, f) => {
1977
- const g = r.get(a);
1978
- if (g === void 0 || g.get(f)?.status !== "failed") return;
1979
- const v = $(a);
1980
- if ((v.claims.get(f) ?? 0) > 0) {
1981
- g.set(f, mt), v.direct.add(f), L(), N();
1982
- return;
1983
- }
1984
- g.delete(f), L();
1985
- },
1986
- pendingChildren: (a) => {
1987
- const f = s.get(a);
1988
- return f === void 0 ? 0 : f.direct.size + f.bulk.size + f.inFlight.size;
1989
- },
1990
- clear: () => {
1991
- for (const a of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...s.keys()])) w(a);
1992
- for (const [a, f] of l) l.set(a, f + 1);
1993
- t.clear(), r.clear(), L();
1994
- },
1995
- subscribeChildrenFailures: (a) => (d.add(a), () => {
1996
- d.delete(a);
1997
- }),
1998
- subscribe: i.subscribe,
1999
- version: () => y
2000
- };
2001
- }, $o = (e, t) => {
2002
- let n = e;
2003
- const r = ce();
2004
- return {
2005
- getSnapshot: () => n,
2006
- subscribe: r.subscribe,
2007
- update: (o) => {
2008
- n = { ...n, ...o }, t(n), r.emit();
2009
- }
2010
- };
2011
- }, Fo = 1;
2012
- let pe = 0, te = null;
2013
- const Do = () => {
2014
- const { documentElement: e, body: t } = document;
2015
- pe === 0 && (te = { 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"), pe += 1;
2016
- let n = !1;
2017
- return () => {
2018
- n || (n = !0, pe -= 1, !(pe > 0 || te === null) && (e.style.overflow = te.htmlOverflow, t.style.overflow = te.bodyOverflow, e.style.scrollbarGutter = te.htmlGutter, t.style.scrollbarGutter = te.bodyGutter, te = null));
2019
- };
2020
- }, qo = [
2021
- { selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
2022
- { selector: "[data-aqmx-explorer-body]", name: "tree area" }
2023
- ], ft = 1, pt = (e) => e.getClientRects().length > 0, Oe = "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.", _o = (e) => {
2024
- if (!pt(e)) return null;
2025
- const t = e.getBoundingClientRect(), n = window.innerHeight;
2026
- if (t.bottom > n + Fo)
2027
- 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. ${Oe}`;
2028
- if (t.height < ft)
2029
- 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. ${Oe}`;
2030
- for (const { selector: r, name: o } of qo)
2031
- for (const l of e.querySelectorAll(r)) {
2032
- if (!pt(l)) continue;
2033
- const s = l.getBoundingClientRect().height;
2034
- if (s < ft)
2035
- return `[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(s))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Oe}`;
2036
- }
2037
- return null;
2038
- }, Bo = (e) => {
2039
- let t = !1;
2040
- const n = () => {
2041
- if (t) return;
2042
- const o = _o(e);
2043
- o !== null && (t = !0, console.error(o));
2044
- }, r = typeof ResizeObserver > "u" ? null : new ResizeObserver(n);
2045
- return r?.observe(e), window.addEventListener("resize", n), n(), () => {
2046
- r?.disconnect(), window.removeEventListener("resize", n);
2047
- };
2048
- }, jo = (e, t) => {
2049
- ee(() => e ? Do() : void 0, [e]), ee(() => {
2050
- const n = t.current;
2051
- if (!(!e || n === null))
2052
- return Bo(n);
2053
- }, [e, t]);
2054
- }, ht = '[data-testid="markdown-explorer-view-switch"]', zo = [
2055
- { control: ht, successors: [ht, '[data-testid="markdown-explorer-sheet-toggle"]'] },
2056
- { control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
2057
- ], Ho = (e) => {
2058
- for (const t of zo) {
2059
- const n = e.closest(t.control);
2060
- if (n !== null) return { element: n, control: t };
2061
- }
2062
- return null;
2063
- }, Io = (e, t) => {
2064
- const n = j(null);
2065
- ee(() => {
2066
- const o = (i) => {
2067
- const d = e.current;
2068
- n.current = d !== null && i instanceof Element && d.contains(i) ? Ho(i) : null;
2069
- }, l = (i) => o(i.target);
2070
- o(document.activeElement);
2071
- const s = (i) => {
2072
- const d = i.target;
2073
- i.relatedTarget !== null || !(d instanceof Element) || queueMicrotask(() => {
2074
- n.current?.element === d && d.isConnected && document.activeElement !== d && (n.current = null);
2075
- });
2076
- };
2077
- return document.addEventListener("focusin", l), document.addEventListener("focusout", s), () => {
2078
- document.removeEventListener("focusin", l), document.removeEventListener("focusout", s);
2079
- };
2080
- }, [e]);
2081
- const r = j(t);
2082
- G(() => {
2083
- if (r.current === t) return;
2084
- r.current = t;
2085
- const o = n.current;
2086
- if (o === null) return;
2087
- const l = () => {
2088
- const d = document.activeElement;
2089
- if (d !== null && d !== document.body && d !== o.element) return !0;
2090
- const u = e.current;
2091
- if (u === null) return !0;
2092
- for (const p of o.control.successors)
2093
- for (const h of u.querySelectorAll(p))
2094
- if (h !== o.element && (h.focus({ preventScroll: !0 }), document.activeElement === h))
2095
- return !0;
2096
- return !1;
2097
- };
2098
- if (l()) return;
2099
- const s = e.current;
2100
- if (s === null) return;
2101
- const i = new MutationObserver(() => {
2102
- l() && i.disconnect();
2103
- });
2104
- return i.observe(s, { childList: !0, subtree: !0 }), () => i.disconnect();
2105
- }, [t, e]);
2106
- }, Zo = De(() => import("./TreeLayout-CqzxLpoM.js").then((e) => ({ default: e.TreeLayout }))), Uo = De(() => import("./MultiLayout-hPmV-bae.js").then((e) => ({ default: e.MultiLayout }))), Vo = 64, Go = {
2107
- request: (e) => {
2108
- requestAnimationFrame(e);
2109
- }
2110
- }, gt = (e) => {
2111
- e.documents.clear(), e.trees.clear();
2112
- }, Me = (e, t) => {
2113
- t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
2114
- for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
2115
- }, Wo = (e, t) => {
2116
- const [n, r] = Z(() => ({ overrides: t, locale: e, labels: Je(e, t) }));
2117
- if (n.locale === e && $n(n.overrides, t)) return n.labels;
2118
- const o = { overrides: t, locale: e, labels: Je(e, t) };
2119
- return r(o), o.labels;
2120
- }, Ko = (e, t, n) => {
2121
- const [r, o] = Z(() => ({ scope: t, store: ut(e, n) }));
2122
- if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
2123
- const l = { scope: t, store: ut(e, n) };
2124
- return o(l), l.store;
2125
- }, Ce = (e, t) => {
2126
- const [n, r] = Z(() => ({ scope: e, value: t() }));
2127
- if (n.scope === e) return n.value;
2128
- const o = { scope: e, value: t() };
2129
- return r(o), o.value;
2130
- }, Yo = () => ko(Go), cl = ({ data: e, config: t, storageNamespace: n, locale: r, labels: o, theme: l, renderFrame: s, renderTreeFailure: i, lockDocumentScroll: d = !1, onMathDiagnostics: u }) => {
2131
- yn(n);
2132
- const p = xt(r), h = Fn(l), b = Wo(p, o), { revalidate: T } = Jt(), y = j(() => {
2133
- }), L = Se(t.dataPath), [k] = Z(() => {
2134
- const q = yo({ dataPath: L, onScope: (K) => y.current(K) }), V = { documents: Zn({ client: q, capacity: Math.max(Vo, t.multiView.maxPanels * 2) }), trees: Po(q) };
2135
- return Me(V, e), Ye(n, e.scope), { data: q, ...V, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
2136
- });
2137
- if (k.aligned.pageData !== e || k.aligned.storageNamespace !== n) {
2138
- const q = k.aligned.pageData;
2139
- k.aligned.pageData = e, k.aligned.storageNamespace = n, q !== e && (q.scope !== e.scope ? k.aligned.pendingReader = e : Me(k, e)), Ye(n, e.scope);
2140
- }
2141
- const $ = Ko(Rn(n).treeSettings, e.scope, t.defaultTreeSettings);
2142
- G(() => {
2143
- const q = k.aligned.pendingReader;
2144
- q !== null && (k.aligned.pendingReader = null, gt(k), Me(k, q));
2145
- }, [e, k]), G(() => {
2146
- let q = !1;
2147
- return y.current = (V) => {
2148
- V === e.scope || q || (q = !0, V !== null && (gt(k), Tn(n)), T());
2149
- }, () => {
2150
- y.current = () => {
2151
- };
2152
- };
2153
- }, [e, T, k, n]);
2154
- const O = j(t.settingsCookie);
2155
- G(() => {
2156
- O.current = t.settingsCookie;
2157
- }, [t.settingsCookie]);
2158
- const [m] = Z(
2159
- () => $o(e.settings, (q) => {
2160
- document.cookie = an(O.current, q, window.location.protocol === "https:");
2161
- })
2162
- ), w = Ce(e.scope, Yo), S = Ce(e.scope, To), E = Ce(e.scope, Ro), R = H(() => se(e.notices.catch(() => [])), [e.notices]), F = e.sources.map((q) => q.id).join(`
2163
- `), I = H(() => sn(t, F.split(`
2164
- `)), [t, F]), N = j(u);
2165
- G(() => {
2166
- N.current = u;
2167
- }, [u]);
2168
- const [B] = Z(() => (q, V) => {
2169
- N.current?.(q, V);
2170
- }), W = u === void 0 ? void 0 : B, U = H(
2171
- () => ({
2172
- config: I,
2173
- labels: b,
2174
- locale: p,
2175
- theme: h,
2176
- storageNamespace: n,
2177
- scope: e.scope,
2178
- sources: e.sources,
2179
- notices: R,
2180
- documents: k.documents,
2181
- trees: k.trees,
2182
- data: k.data,
2183
- viewSettings: m,
2184
- treeSettings: $,
2185
- announcer: w,
2186
- reveals: S,
2187
- markupViews: E,
2188
- renderTreeFailure: i,
2189
- reportMathDiagnostics: W
2190
- }),
2191
- [I, b, p, h, n, e.scope, e.sources, R, k, m, $, w, S, E, i, W]
2192
- );
2193
- return /* @__PURE__ */ c(yt, { value: U, children: /* @__PURE__ */ c(Jo, { renderFrame: s, lockDocumentScroll: d }, e.scope) });
2194
- }, Xo = ({ ref: e, theme: t, view: n, children: r }) => {
2195
- const [o] = Z(br);
2196
- 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 });
2197
- }, Jo = ({ renderFrame: e, lockDocumentScroll: t }) => {
2198
- const { theme: n, labels: r } = P(), o = qe(), { hash: l } = vt(), s = Be(), i = j(null);
2199
- jo(t, i), G(() => {
2200
- o.kind === "redirect" && s(`${o.href}${l}`, "browse");
2201
- }, [o, l, s]);
2202
- const { location: d } = o, u = d.view;
2203
- Io(i, u);
2204
- const p = d.view === "tree" ? /* @__PURE__ */ c(we, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading" }), children: /* @__PURE__ */ c(Zo, { location: d }) }) : d.view === "multi" ? /* @__PURE__ */ c(we, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading" }), children: /* @__PURE__ */ c(Uo, { location: d }) }) : /* @__PURE__ */ c(Eo, { location: d }), h = /* @__PURE__ */ z(Xo, { ref: i, theme: n, view: u, children: [
2205
- p,
2206
- /* @__PURE__ */ c(So, { holds: !0, testId: "markdown-explorer-announcer" })
2207
- ] });
2208
- return e === void 0 ? h : e({ view: u, children: h });
2209
- }, dl = ({ currentUrl: e, nextUrl: t, formMethod: n, defaultShouldRevalidate: r }) => n === void 0 && e.href === t.href && r;
2210
- export {
2211
- bo as D,
2212
- _n as E,
2213
- Tt as F,
2214
- kr as I,
2215
- Hn as L,
2216
- Cn as M,
2217
- vo as P,
2218
- Be as a,
2219
- uo as b,
2220
- ce as c,
2221
- fo as d,
2222
- al as e,
2223
- At as f,
2224
- Bn as g,
2225
- ae as h,
2226
- qe as i,
2227
- So as j,
2228
- ve as k,
2229
- An as l,
2230
- Qe as m,
2231
- kt as n,
2232
- Ln as o,
2233
- Xe as p,
2234
- cl as q,
2235
- Je as r,
2236
- dl as s,
2237
- P as u
2238
- };