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