@aiquants/markdown-explorer 0.0.0-stage → 0.2.0

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