@aiquants/markdown-explorer 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +3 -2
- package/dist/{EditSurface-5nbW7NTP.cjs → EditSurface-BQ5QAdDd.cjs} +1 -1
- package/dist/{EditSurface-CaS1O6Nt.js → EditSurface-DJ9pJlDd.js} +1 -1
- package/dist/{ExplorerSplit-D60N3_X7.cjs → ExplorerSplit-Brdh9fCW.cjs} +1 -1
- package/dist/{ExplorerSplit-C9Y02nvj.js → ExplorerSplit-BwUurHbM.js} +1 -1
- package/dist/{MultiLayout-DBpUTcCQ.js → MultiLayout-DPE2GP2T.js} +2 -2
- package/dist/{MultiLayout-CqTyFZ_i.cjs → MultiLayout-xWd9nYaD.cjs} +1 -1
- package/dist/{NativeScrollBar-CiVlg2ob.js → NativeScrollBar-CwgalDjg.js} +1 -1
- package/dist/{NativeScrollBar-QlOtnddZ.cjs → NativeScrollBar-PBnODPEM.cjs} +1 -1
- package/dist/{TreeLayout-bk-Ziybl.js → TreeLayout-B3i_63hs.js} +2 -2
- package/dist/{TreeLayout-uwvAgr-t.cjs → TreeLayout-DilrAILF.cjs} +1 -1
- package/dist/core/labels.d.cts +3 -0
- package/dist/core/labels.d.ts +3 -0
- package/dist/index-BBtIYTXJ.cjs +13 -0
- package/dist/{index-etFEpIE_.js → index-CPoNWk1T.js} +1131 -1032
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{merge-DfI0ro2L.js → merge-D_qmtwWR.js} +1 -1
- package/dist/{merge-BR4jKpIc.cjs → merge-DgAmnpnO.cjs} +1 -1
- package/docs/behavior/dom-hooks.md +1 -0
- package/docs/behavior/layout.md +3 -2
- package/docs/behavior/localization.md +1 -0
- package/package.json +1 -1
- package/dist/index-Dlkzr6Zn.cjs +0 -13
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-BBtIYTXJ.cjs"),e=require("./storage-Dgi4JXaB.cjs"),E=require("./location-DmzVAFvo.cjs"),_=require("./dataRoute-CcZ8PK00.cjs");exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=L.DEFAULT_MARKDOWN_EXPLORER_LOCALE;exports.EXPLORER_THEMES=L.EXPLORER_THEMES;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=L.MARKDOWN_EXPLORER_LABEL_CATALOGS;exports.MARKDOWN_EXPLORER_LABEL_KEYS=L.MARKDOWN_EXPLORER_LABEL_KEYS;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=L.MARKDOWN_EXPLORER_LABEL_TEMPLATES;exports.MARKDOWN_EXPLORER_LOCALES=L.MARKDOWN_EXPLORER_LOCALES;exports.MarkdownExplorer=L.MarkdownExplorer;exports.resolveMarkdownExplorerLabels=L.resolveMarkdownExplorerLabels;exports.shouldRevalidateExplorer=L.shouldRevalidateExplorer;exports.clearExplorerStorage=e.clearExplorerStorage;exports.COLUMN_MIN_MEASURE=E.COLUMN_MIN_MEASURE;exports.DEFAULT_TREE_SETTINGS=E.DEFAULT_TREE_SETTINGS;exports.DEFAULT_VIEW_SLUGS=E.DEFAULT_VIEW_SLUGS;exports.EXPAND_ALL_DEPTH_LIMITS=E.EXPAND_ALL_DEPTH_LIMITS;exports.EXPAND_ALL_FOLDER_LIMITS=E.EXPAND_ALL_FOLDER_LIMITS;exports.EXPLORER_DEFAULT_PERCENT=E.EXPLORER_DEFAULT_PERCENT;exports.EXPLORER_MAX_PERCENT=E.EXPLORER_MAX_PERCENT;exports.EXPLORER_MIN_REM=E.EXPLORER_MIN_REM;exports.EXPLORER_MULTI_DEFAULT_PERCENT=E.EXPLORER_MULTI_DEFAULT_PERCENT;exports.GOLDEN_RATIO=E.GOLDEN_RATIO;exports.MULTI_VIEW_COLUMN_LIMITS=E.MULTI_VIEW_COLUMN_LIMITS;exports.MULTI_VIEW_PANEL_LIMITS=E.MULTI_VIEW_PANEL_LIMITS;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=E.REVEAL_DOCUMENT_DEPTH_LIMITS;exports.defineExplorerConfig=E.defineExplorerConfig;exports.explorerHref=E.explorerHref;exports.isExplorerSourceId=E.isExplorerSourceId;exports.resolveExplorerLocation=E.resolveExplorerLocation;exports.withExplorerSources=E.withExplorerSources;exports.DEFAULT_DENIED_PATH_SEGMENTS=_.DEFAULT_DENIED_PATH_SEGMENTS;exports.EXPLORER_EDIT_TOKEN_MAX_LENGTH=_.EXPLORER_EDIT_TOKEN_MAX_LENGTH;exports.EXPLORER_FAILURE_REASONS=_.EXPLORER_FAILURE_REASONS;exports.EXPLORER_MAX_HEADINGS=_.EXPLORER_MAX_HEADINGS;exports.MAX_DOCUMENT_PATH_LENGTH=_.MAX_DOCUMENT_PATH_LENGTH;exports.failureDocument=_.failureDocument;exports.failureOf=_.failureOf;exports.isAcceptableDocumentPath=_.isAcceptableDocumentPath;exports.isDeniedPath=_.isDeniedPath;exports.isExplorerChildrenResult=_.isExplorerChildrenResult;exports.isExplorerFailureCode=_.isExplorerFailureCode;exports.isExplorerFailureReason=_.isExplorerFailureReason;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z as a, B as L, M as s, G as e, H as r, J as R, K as A, N as T, O as o } from "./index-
|
|
1
|
+
import { z as a, B as L, M as s, G as e, H as r, J as R, K as A, N as T, O as o } from "./index-CPoNWk1T.js";
|
|
2
2
|
import { c as O } from "./storage-BSthKLSG.js";
|
|
3
3
|
import { J as N, K as I, L as P, M as l, O as S, q as i, o as X, Q as p, s as U, G as x, R as t, T as C, U as f, V as c, e as n, i as u, a as F, w as G } from "./location-Q4sgRrUm.js";
|
|
4
4
|
import { D as d, S as K, T as W, E as m, M as h, y as V, f as w, i as B, A as b, I as v, c as g, b as k } from "./dataRoute-D1vE1wFW.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { diff3Merge as p } from "node-diff3";
|
|
2
|
-
import { C, d as R, e as u } from "./index-
|
|
2
|
+
import { C, d as R, e as u } from "./index-CPoNWk1T.js";
|
|
3
3
|
const g = (n, o, e, l) => {
|
|
4
4
|
if (o === n || o === e) return { kind: "clean", text: e };
|
|
5
5
|
if (e === n) return { kind: "clean", text: o };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-BBtIYTXJ.cjs"),R=(n,t,i,l)=>{if(t===n||t===i)return{kind:"clean",text:i};if(i===n)return{kind:"clean",text:t};const d=g.diff3Merge(t.split(`
|
|
2
2
|
`),n.split(`
|
|
3
3
|
`),i.split(`
|
|
4
4
|
`),{excludeFalseConflicts:!0}),o=[];let c=0;const u=s(l.ours),a=s(l.theirs);for(const e of d)e.ok!==void 0?o.push(...e.ok):e.conflict!==void 0&&(c+=1,o.push(`${r.CONFLICT_OURS_MARKER} ${u}`,...e.conflict.a,r.CONFLICT_SEPARATOR,...e.conflict.b,`${r.CONFLICT_THEIRS_MARKER} ${a}`));const f=o.join(`
|
|
@@ -86,6 +86,7 @@ The tree is named by `treeRegion`, apart from the explorer `nav` (`explorerRegio
|
|
|
86
86
|
| `data-testid="markdown-explorer-image-level"` | The zoom level (an `output`) | A polite status: assistive technology reads the new level when it changes |
|
|
87
87
|
| `data-testid="markdown-explorer-media-view"` / `-media-player` | Media viewer and its player | The view carries `data-aqmx-media-type` (`video` / `audio` / `pdf`) |
|
|
88
88
|
| `data-testid="markdown-explorer-file-name"` / `-file-open` / `-file-download` | Header of an image, media, text or file view | |
|
|
89
|
+
| `data-testid="markdown-explorer-file-copy"` | Copy the text, in the header of a text read whole (a text file, or a Markdown document shown as written) | Carries `data-aqmx-copy-outcome`: `idle`, then `copied` or `failed` for 2 seconds after a press. Absent when only the file's beginning was read. |
|
|
89
90
|
| `data-testid="markdown-explorer-file-view"` | The view of a file the explorer cannot show (a `file` document) | Holds the file header and the note below. |
|
|
90
91
|
| `data-testid="markdown-explorer-file-not-shown"` / `-file-not-shown-download` | The file view's note (`role="note"`, the label `fileNotShown`) and its download link | The link's `href` is the document's `url` and its `download` the file's name. |
|
|
91
92
|
|
package/docs/behavior/layout.md
CHANGED
|
@@ -128,7 +128,7 @@ Documents in the multi-panel view sit in `multiView.columns` logical columns (4
|
|
|
128
128
|
A Mermaid gantt chart is drawn at the width of its slot (and again, after a short debounce, when a split or the window changes that width), so it keeps its natural height.
|
|
129
129
|
Where the toolbar covers the inline extent of the document's content — in the tree view and a maximized panel at every width, where the content spans the pane, and in the single view unless its `width` or `maxWidth` leaves room beside the content — the viewer reserves the depth it covers as the top padding and the `scroll-padding-block-start` of its scroll container and publishes it as `--aqmd-toolbar-block-overlap` on `[data-aqmd-scroll-container]`: the first line and every fragment's element start below the buttons. Where the toolbar covers none of the content the band is `0px`.
|
|
130
130
|
An open, unpinned menu of the toolbar (the table of contents, the style or the alignment menu) closes on Escape while the focus is inside it and returns the focus to its button; the viewer marks that keydown handled (`preventDefault()`). In a panel every part of the document (failure callout, image, media) takes its content height, and an embedded PDF is 1 : √2.
|
|
131
|
-
- A file header (the toolbar of an image or a
|
|
131
|
+
- A file header (the toolbar of an image, a medium or a text: its name, the zoom controls or Copy the text, Open in a new tab and Download) wraps its controls onto more lines instead of letting any of them run out of the pane or the panel at a narrow width or a large text size; the name takes what the controls leave on the first line and is cut with an ellipsis.
|
|
132
132
|
- An image opens fitted to the pane (Fit pressed). Zoom in and Zoom out step through the levels 1/φ², 1/φ, 1, φ and φ² (≈ 38.2 %, 61.8 %, 100 %, 161.8 % and 261.8 %) of a base size — the image's natural size, or for an image without one the fitted size described below — and the level shown is a percentage of that base; from the fitted size they go to the nearest level above or below it. A zoom button that cannot act stays focusable: before the image is measured, at the ends of the levels, and — while an image with a natural size is fitted — Zoom out when the fitted size is already at or below the smallest level, it is `aria-disabled`, dims its icon and ignores activation. While such an image is fitted, Zoom out's availability follows the pane's size: a pane that grows or shrinks can make it available or unavailable.
|
|
133
133
|
An image without a natural size (an SVG whose root has no absolute `width` and `height`, such as one with only a `viewBox` or with `width="100%"`) is recognized when the browser reports a natural width or height of 0 for it, or when Fit enlarges it, which Fit never does to an image that has one. Its levels are relative to its fitted size instead: the size it was fitted to when the reader leaves Fit, kept until Fit is pressed again. From Fit, Zoom in goes to φ and Zoom out to 1/φ of that size, and the level shown is a percentage of it.
|
|
134
134
|
Chromium reports the default object size (300 × 150, fitted to the SVG's aspect ratio) as such an SVG's natural size, so in a pane narrower than that size Fit does not enlarge it, and its levels stay relative to that default size (see the README's known limitations).
|
|
@@ -141,7 +141,8 @@ Documents in the multi-panel view sit in `multiView.columns` logical columns (4
|
|
|
141
141
|
So does focus in a frame inside the region (a PDF document's frame, an embedded frame of `iframeHosts`), also when it entered the frame straight from outside the region (a click from the tree, Tab), and a press outside the region moves it away from there as well.
|
|
142
142
|
- **Source of a Markdown document.** While the bar's document is a loaded Markdown document, the bar's button row holds a Source toggle before Refresh document: a toggle button (`aria-pressed`) labelled like its neighbour — visible text beside a page view's pane (`showMarkupLabel`, «Source» / 「ソース」, its accessible name; its tooltip is `showMarkup`), icon-only in a panel and named after the panel's document (`showMarkupNamed`, «Source of a.md» / 「a.md のソース」).
|
|
143
143
|
An image, media, text or file document and a failure show no toggle, and neither does a document still loading, which gets it once it is there.
|
|
144
|
-
Pressing it shows the document as written instead of rendered, in place and without moving the focus from the toggle: the pane reads the document's file through the data route's `text` operation (only once the toggle is pressed) and shows the text the way it shows a text file — the file header with Open and Download, the note `textTruncated` when the server cut the file at its `textMaxBytes`, and the text, which wraps and is never interpreted.
|
|
144
|
+
Pressing it shows the document as written instead of rendered, in place and without moving the focus from the toggle: the pane reads the document's file through the data route's `text` operation (only once the toggle is pressed) and shows the text the way it shows a text file — the file header with Copy the text, Open and Download, the note `textTruncated` when the server cut the file at its `textMaxBytes`, and the text, which wraps and is never interpreted.
|
|
145
|
+
Copy the text (an icon button, `copyText`) puts the text on the clipboard exactly as read, line endings included, and is offered only for a text read whole, so a cut file is never copied in part (Download fetches it whole). The outcome is announced (`copiedText`, or `copyTextFailed` when the browser has no asynchronous clipboard — an insecure origin — or refuses the write) and shown for 2 seconds by the button's icon and tooltip, while its accessible name stays the same; a second press counts the 2 seconds again. The same button heads every text file.
|
|
145
146
|
Until the first answer the region shows a skeleton (`markupLoading` for screen readers); a failure shows the failure callout, with Try again for a `failed` read, and is announced once (`documentFailed`), like a document's.
|
|
146
147
|
Every new answer for the document — Refresh document, Refresh tree, a background revalidation — reads the text again, the previous text staying on screen meanwhile. The next press shows the document rendered again.
|
|
147
148
|
The choice is part of the URL (`markup`, see the [URL contract](url-contract.md#shape)), written by replacing the entry: a reload, a shared link and Back and Forward show the document the same way, and the switches between the tree and multi views carry it for the document they open. It belongs to that document only: another document opens rendered, and the document still shown while the next one loads keeps the way it showed. The region tells which way a Markdown document shows with `data-aqmx-document-view` (`rendered` / `markup`).
|
|
@@ -18,6 +18,7 @@ This page is part of the host-facing contract of `@aiquants/markdown-explorer`;
|
|
|
18
18
|
A multi-view panel's Refresh document is icon-only, and `refreshDocumentNamed(name)` (the panel title) is its accessible name and its tooltip. A successful reload is announced with `treeRefreshed` or `documentRefreshed(name)`. A failed one is shown with `treeRefreshFailed(reason)` (an alert in the explorer) or `documentRefreshFailed(reason)` (a notice, which the announcer also speaks), where `reason` is the failure's title (the matching `failure…Title` label).
|
|
19
19
|
- `showMarkupLabel` is the visible text of the page views' Source toggle beside Refresh document (shown for a Markdown document), also its accessible name, and `showMarkup` its tooltip; a multi-view panel's toggle is icon-only, and `showMarkupNamed(name)` (the panel title) is its accessible name and its tooltip.
|
|
20
20
|
The toggle's pressed state, not its name, tells whether the source shows. `markupLoading` is the screen-reader text while the source loads; a source that cannot be read is announced with `documentFailed(name, title)`, like a document, and a cut source shows `textTruncated`, like a cut text file.
|
|
21
|
+
- `copyText` is the accessible name and tooltip of the icon-only Copy the text button in the header of a text read whole (a text file, or a Markdown document shown as written). A copy is announced with `copiedText`, or with `copyTextFailed` when the browser has no asynchronous clipboard or refuses the write; for 2 seconds the outcome's label is also the button's tooltip, while its name stays `copyText`.
|
|
21
22
|
- `switchToTree` and `switchToMulti` name their destination with the README's view names ("Open in the tree view" / "ツリービューで開く", "Open in the multi-panel view" / "マルチビューで開く"); no label names the single view, which no control inside the explorer opens.
|
|
22
23
|
|
|
23
24
|
## Overrides
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiquants/markdown-explorer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Markdown document explorer for React Router 8 (framework mode): a source tree with a single-document view and a multi-panel reading view, storage-agnostic server ports, golden-ratio layout and an en / ja UI.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
package/dist/index-Dlkzr6Zn.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("react/jsx-runtime"),i=require("react"),Y=require("react-router"),I=require("./location-DmzVAFvo.cjs"),N=require("./dataRoute-CcZ8PK00.cjs"),de=require("@aiquants/markdown"),$e=require("@aiquants/markdown/source-lines"),bn=require("@aiquants/markdown/viewer-settings"),J=require("./storage-Dgi4JXaB.cjs");function Sn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const S=Sn(i),qe=Object.freeze(["en","ja"]),Tt="en",Lt=Object.freeze({panelMoved:Object.freeze(["title","column","position"]),panelMoveUnavailable:Object.freeze(["title","move"]),panelDragStarted:Object.freeze(["title"]),panelDragCancelled:Object.freeze(["title"]),multiColumnRegion:Object.freeze(["column"])}),yn=/\{(\w+)\}/gu,Ot={explorerRegion:"Explorer",sourceLabel:"Source",refreshTreeLabel:"Refresh tree",refreshTree:"Reload the tree and the open documents from the source",treeRefreshed:"Reloaded the tree from the source",treeRefreshFailed:e=>`Could not reload the tree: ${e}`,refreshDocumentLabel:"Refresh document",refreshDocument:"Reload the document from the source",refreshDocumentNamed:e=>`Refresh ${e}`,documentRefreshed:e=>`Reloaded ${e}`,documentRefreshFailed:e=>`Could not reload the document: ${e}`,showMarkupLabel:"Source",showMarkup:"Show the document's Markdown as written",showMarkupNamed:e=>`Source of ${e}`,editDocumentLabel:"Edit",editDocument:"Edit the document's Markdown (or double-click the document)",editDocumentNamed:e=>`Edit ${e}`,editExternallyLabel:"Open in its editor",editExternally:"Open the document in its own editor, in a new tab",editExternallyNamed:e=>`Open ${e} in its editor`,editorRegion:e=>`Editing ${e}`,editorLabel:e=>`Markdown of ${e}`,editLoading:"Loading the source for editing…",editToolbar:"Editor",saveDraft:"Save",saveDraftTooltip:"Save the draft (Ctrl+S, or ⌘S on a Mac)",closeEditor:"Close editor",previewToggle:"Preview",historyOpen:"History",draftUnsaved:"Unsaved changes",draftSaving:"Saving…",draftSaved:"Saved",draftSavedMerged:"Saved, merged with changes saved elsewhere",draftConflicts:e=>e===1?"1 conflict with changes saved elsewhere: choose what to keep, then save":`${e} conflicts with changes saved elsewhere: choose what to keep, then save`,draftSaveFailed:e=>`Could not save: ${e}`,documentSaved:e=>`Saved ${e}`,documentSavedMerged:e=>`Saved ${e}, merged with changes saved elsewhere`,conflictOurs:"your draft",conflictTheirs:"saved elsewhere",conflictUseOurs:"Use my lines",conflictUseTheirs:"Use the saved lines",conflictKeepBoth:"Keep both",conflictNext:"Next conflict",editGrantTitle:"Editing needs your permission",editGrantBody:"Allow this site to change documents on your behalf. You are asked once; signing out asks again.",editGrantAction:"Grant permission",editGrantRetry:"Try again",unsavedTitle:"Discard unsaved changes?",unsavedBody:e=>`${e} has changes that are not saved.`,unsavedDiscard:"Discard changes",unsavedStay:"Keep editing",historyTitle:e=>`Revisions of ${e}`,historyLoading:"Loading the revisions…",historyEmpty:"No revisions are kept for this document.",historyCurrent:"Current",historyKept:"Kept",historyEntry:(e,t)=>t===""?e:`${e} by ${t}`,historyRestore:"Put into the draft",historyClose:"Close",historyRestored:e=>`Put the revision into the draft of ${e}; save to keep it`,previewRegion:"Preview",previewUpdating:"Updating the preview…",previewFailed:e=>`Could not preview: ${e}`,expandAll:"Expand all folders",collapseAll:"Collapse all folders",treeSettings:"Tree settings",switchToMulti:"Open in the multi-panel view",switchToTree:"Open in the tree view",resizeExplorer:"Resize the explorer",showExplorer:"Show the explorer",hideExplorer:"Close the explorer",treeRegion:"Documents",treeLoading:"Loading the tree…",treeEmptyTitle:"Nothing to show",treeEmptyBody:"This source has no documents you can open.",folderLoadFailed:"This folder could not be loaded.",loopFolderName:e=>`${e} (already open above)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("en",{type:"conjunction"}).format(e)} could not be loaded`,foldersLoading:e=>e===1?"Loading 1 folder…":`Loading ${String(e)} folders…`,expandAllStarted:"Opening all folders…",expandAllProgress:(e,t)=>`Opening all folders (${String(e)} opened, ${String(t)} loading)…`,expandAllDone:(e,t,n)=>{const r=`Opened ${String(e)} ${e===1?"folder":"folders"}`;return t>0?`${r}; ${String(t)} could not be loaded`:n?e===0?"All folders are already open":`${r}; every folder is open`:r},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`,expandAllDepthLimit:(e,t)=>`Opened ${String(e)} ${e===1?"folder":"folders"}; folders more than ${String(t)} ${t===1?"level":"levels"} deep stay closed`,treeEntryKindDirectory:"directory",treeEntryKindFile:"file",treeScrollUp:"Scroll up",treeScrollDown:"Scroll down",treeScrollToTop:"Top",treeScrollToBottom:"Bottom",selectionTitle:e=>`Selected (${String(e)})`,clearSelection:"Clear the selection",openSelectionInMulti:e=>`Open ${String(e)} in panels`,removeFromSelection:e=>`Remove ${e} from the selection`,settingSortMode:"Sort order",sortNative:"Source order",sortAscending:"Name A→Z",sortDescending:"Name Z→A",settingFolderPlacement:"Folders",folderPlacementMixed:"Mixed",folderPlacementFirst:"First",folderPlacementLast:"Last",settingSelectionMode:"Selection",selectionSingle:"Single",selectionMultiple:"Multiple",selectionNone:"Off",settingDoubleClick:"Double-click",doubleClickRecursive:"Expand all levels",doubleClickToggle:"Toggle",settingExpandIconSize:"Expander size",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"Always expanded",settingRevealDocument:"Reveal the open document",settingRemoveRootIndent:"No root indent",settingTreeLines:"Tree lines",settingExpandIcons:"Expanders",settingDirectoryIcons:"Folder icons",settingFileIcons:"File icons",settingOn:"On",settingOff:"Off",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"Document",documentEmpty:"Select a document in the explorer.",documentLoading:"Loading the document…",markupLoading:"Loading the source…",documentShown:e=>`Showing ${e}`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[.!?]$/u.test(t)?t:`${t}.`).join(" "),textTruncated:"Only the beginning of this file is shown.",inertLink:"This link points outside the source and cannot be opened.",failureUnauthorizedTitle:"Your session has expired",failureUnauthorizedBody:"Reload the page to sign in again.",failureForbiddenTitle:"Access denied",failureForbiddenBody:"You do not have permission to open this.",failureNotFoundTitle:"Not found",failureNotFoundBody:"It may have been moved or deleted.",failureNotConfiguredTitle:"This source is not set up",failureNotConfiguredBody:"Ask your administrator to configure it.",failureInvalidTitle:"Invalid address",failureInvalidBody:"The document path in this address cannot be used.",failureTooLargeTitle:"Too large to display",failureTooLargeBody:"This file exceeds the size that can be displayed.",failureUnsupportedTitle:"Cannot be displayed",failureUnsupportedBody:"This type of file cannot be shown here.",failureFailedTitle:"Something went wrong",failureFailedBody:"Try again in a moment.",retry:"Try again",reloadPage:"Reload the page",imageZoomIn:"Zoom in",imageZoomOut:"Zoom out",imageFit:"Fit to the view",imageFitLevel:"Fit",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"Open in a new tab",download:"Download",mediaUnsupported:"Your browser cannot play this file.",fileNotShown:"This file cannot be shown here. Download it to open it.",viewerLoading:"Loading data...",viewerErrorPrefix:"Error: ",viewerStyleTitle:"Display Style",viewerSelectStyle:"Select display style",viewerPinStyle:"Pin style selector",viewerUnpinStyle:"Unpin style selector",viewerErrorTitle:"An error occurred",viewerMissingImage:"Image not found",viewerOpenToc:"Open table of contents",viewerTocTitle:"Table of contents",viewerPinToc:"Pin table of contents",viewerUnpinToc:"Unpin table of contents",viewerSelectAlign:"Select alignment",viewerAlignTitle:"Alignment",viewerPinAlign:"Pin alignment selector",viewerUnpinAlign:"Unpin alignment selector",viewerAlignLeft:"Align left",viewerAlignCenter:"Align center",viewerAlignRight:"Align right",viewerMermaidInteractionMode:"Mouse interaction mode",viewerMermaidModeNone:"No interaction",viewerMermaidModeZoom:"Zoom only",viewerMermaidModePan:"Pan only (drag)",viewerMermaidModePanShift:"Pan only (Shift+drag)",viewerMermaidModeBoth:"Zoom and pan (drag)",viewerMermaidModeBothShift:"Zoom and pan (Shift+drag)",viewerMermaidZoomIn:"Zoom In",viewerMermaidZoomOut:"Zoom Out",viewerMermaidResetView:"Reset View",viewerMermaidRetry:"Try again",viewerEmbeddedVideo:"embedded video",viewerEmbeddedPost:"embedded post",viewerEmbeddedFrame:"Embedded content",multiRegion:"Panels",multiEmpty:"Select documents in the explorer to open them side by side.",panelLimit:e=>`You can open up to ${String(e)} panels at once.`,panelOpened:e=>`Opened ${e}`,panelClosed:e=>`Closed ${e}`,panelAlreadyOpen:e=>`${e} is already open`,panelHidden:e=>`Hid ${e}`,panelShown:e=>`Showed ${e}`,panelMaximized:e=>`Maximized ${e}`,panelRestored:e=>`Restored ${e} to its size`,panelHide:"Hide the panel",panelMaximize:"Maximize the panel",panelRestore:"Restore the panel to its size",panelClose:"Close the panel",panelSwitchToCustomDrag:"Switch to the custom drag mode",panelSwitchToNormalDrag:"Back to the normal drag mode",panelCustomDragBadge:"Custom",panelMovePreviousColumn:"Move to the previous column",panelMoveNextColumn:"Move to the next column",panelMoveUp:"Move up",panelMoveDown:"Move down",panelMoved:"Moved {title} to column {column}, position {position}",panelMoveUnavailable:"{move} is not available for {title}",panelDragStarted:"Picked up {title}",panelDragCancelled:"Kept {title} where it was",hiddenPanelsTitle:"Hidden panels:",hiddenPanelBadge:"Hidden",hiddenPanelNotice:"This panel is hidden",multiColumnEmpty:"This column is empty",multiColumnRegion:"Column {column}",panelDropHere:"Drop the panel here"},kn={explorerRegion:"エクスプローラー",sourceLabel:"ソース",refreshTreeLabel:"ツリーを更新",refreshTree:"ソースからツリーと開いている文書を読み込み直す",treeRefreshed:"ツリーをソースから読み込み直しました",treeRefreshFailed:e=>`ツリーを読み込み直せませんでした: ${e}`,refreshDocumentLabel:"文書を更新",refreshDocument:"ソースから文書を読み込み直す",refreshDocumentNamed:e=>`${e} を更新`,documentRefreshed:e=>`${e} を読み込み直しました`,documentRefreshFailed:e=>`文書を読み込み直せませんでした: ${e}`,showMarkupLabel:"ソース",showMarkup:"文書の Markdown を書いたまま表示",showMarkupNamed:e=>`${e} のソース`,editDocumentLabel:"編集",editDocument:"文書の Markdown を編集 (文書のダブルクリックでも)",editDocumentNamed:e=>`${e} を編集`,editExternallyLabel:"元のエディタで開く",editExternally:"文書を元のエディタで、新しいタブに開く",editExternallyNamed:e=>`${e} を元のエディタで開く`,editorRegion:e=>`${e} を編集中`,editorLabel:e=>`${e} の Markdown`,editLoading:"編集のためにソースを読み込み中…",editToolbar:"エディタ",saveDraft:"保存",saveDraftTooltip:"下書きを保存 (Ctrl+S、Mac は ⌘S)",closeEditor:"編集を閉じる",previewToggle:"プレビュー",historyOpen:"履歴",draftUnsaved:"保存していない変更があります",draftSaving:"保存中…",draftSaved:"保存しました",draftSavedMerged:"ほかで保存された変更と統合して保存しました",draftConflicts:e=>`ほかで保存された変更と ${e} か所が重なりました。残す方を選んでから保存してください`,draftSaveFailed:e=>`保存できませんでした: ${e}`,documentSaved:e=>`${e} を保存しました`,documentSavedMerged:e=>`${e} を、ほかで保存された変更と統合して保存しました`,conflictOurs:"あなたの下書き",conflictTheirs:"ほかで保存された版",conflictUseOurs:"自分の行を使う",conflictUseTheirs:"保存された行を使う",conflictKeepBoth:"両方を残す",conflictNext:"次の衝突へ",editGrantTitle:"編集には許可が必要です",editGrantBody:"このサイトがあなたに代わって文書を変えることを許可してください。尋ねるのは 1 回だけで、サインアウトすると次にまた尋ねます。",editGrantAction:"許可する",editGrantRetry:"もう一度試す",unsavedTitle:"保存していない変更を破棄しますか?",unsavedBody:e=>`${e} に保存していない変更があります。`,unsavedDiscard:"変更を破棄",unsavedStay:"編集を続ける",historyTitle:e=>`${e} の版`,historyLoading:"版の一覧を読み込み中…",historyEmpty:"この文書の版は残っていません。",historyCurrent:"現在の版",historyKept:"保持",historyEntry:(e,t)=>t===""?e:`${e} (${t})`,historyRestore:"下書きに戻す",historyClose:"閉じる",historyRestored:e=>`${e} の下書きに版を戻しました。残すには保存してください`,previewRegion:"プレビュー",previewUpdating:"プレビューを更新中…",previewFailed:e=>`プレビューできませんでした: ${e}`,expandAll:"すべてのフォルダーを展開",collapseAll:"すべてのフォルダーを折りたたむ",treeSettings:"ツリーの設定",switchToMulti:"マルチビューで開く",switchToTree:"ツリービューで開く",resizeExplorer:"エクスプローラーの幅を変更",showExplorer:"エクスプローラーを開く",hideExplorer:"エクスプローラーを閉じる",treeRegion:"文書の一覧",treeLoading:"ツリーを読み込み中…",treeEmptyTitle:"表示できるファイルがありません",treeEmptyBody:"このソースには開ける文書がありません。",folderLoadFailed:"このフォルダーを読み込めませんでした。",loopFolderName:e=>`${e} (上の階層で開いています)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("ja",{type:"conjunction"}).format(e)} を読み込めませんでした`,foldersLoading:e=>`フォルダーを ${String(e)} 件読み込み中…`,expandAllStarted:"すべてのフォルダーを展開しています…",expandAllProgress:(e,t)=>`すべてのフォルダーを展開中 (展開 ${String(e)} 件、読み込み中 ${String(t)} 件)…`,expandAllDone:(e,t,n)=>{const r=`${String(e)} 件のフォルダーを展開しました`;return t>0?`${r}。うち ${String(t)} 件は読み込めませんでした`:n?e===0?"すべてのフォルダーが既に開いています":`${r}。すべてのフォルダーが開いています`:r},expandAllFolderLimit:(e,t,n)=>`${String(e)} 件のフォルダーを展開し、読み込みの上限 (${String(t)} 件) で止めました。続けるには「${n}」をもう一度押してください`,expandAllDepthLimit:(e,t)=>`${String(e)} 件のフォルダーを展開しました。深さ ${String(t)} 階層より下のフォルダーは閉じたままです`,treeEntryKindDirectory:"ディレクトリ",treeEntryKindFile:"ファイル",treeScrollUp:"上へスクロール",treeScrollDown:"下へスクロール",treeScrollToTop:"先頭へ",treeScrollToBottom:"末尾へ",selectionTitle:e=>`選択中 (${String(e)})`,clearSelection:"選択を解除",openSelectionInMulti:e=>`${String(e)} 件をパネルで開く`,removeFromSelection:e=>`${e} を選択から外す`,settingSortMode:"並び順",sortNative:"取得順",sortAscending:"名前の昇順",sortDescending:"名前の降順",settingFolderPlacement:"フォルダーの位置",folderPlacementMixed:"混ぜる",folderPlacementFirst:"先に",folderPlacementLast:"後に",settingSelectionMode:"選択",selectionSingle:"1 件",selectionMultiple:"複数",selectionNone:"オフ",settingDoubleClick:"ダブルクリック",doubleClickRecursive:"下の階層まで展開",doubleClickToggle:"開閉",settingExpandIconSize:"展開アイコンの大きさ",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"常に展開",settingRevealDocument:"開いた文書をツリーで表示",settingRemoveRootIndent:"最上位の字下げなし",settingTreeLines:"ツリーの線",settingExpandIcons:"展開アイコン",settingDirectoryIcons:"フォルダーのアイコン",settingFileIcons:"ファイルのアイコン",settingOn:"オン",settingOff:"オフ",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"文書",documentEmpty:"エクスプローラーで文書を選んでください。",documentLoading:"文書を読み込み中…",markupLoading:"ソースを読み込み中…",documentShown:e=>`${e} を表示しています`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[。!?]$/u.test(t)?t:`${t}。`).join(""),textTruncated:"このファイルは先頭だけを表示しています。",inertLink:"リンク先がソースの外にあるため開けません。",failureUnauthorizedTitle:"セッションの有効期限が切れました",failureUnauthorizedBody:"ページを再読み込みして、もう一度サインインしてください。",failureForbiddenTitle:"アクセスが許可されていません",failureForbiddenBody:"これを開く権限がありません。",failureNotFoundTitle:"見つかりません",failureNotFoundBody:"移動または削除された可能性があります。",failureNotConfiguredTitle:"このソースは設定されていません",failureNotConfiguredBody:"管理者に設定を依頼してください。",failureInvalidTitle:"アドレスが正しくありません",failureInvalidBody:"このアドレスに含まれる文書の経路は使えません。",failureTooLargeTitle:"大きすぎて表示できません",failureTooLargeBody:"このファイルは表示できる大きさを超えています。",failureUnsupportedTitle:"表示できない形式です",failureUnsupportedBody:"この種類のファイルはここでは表示できません。",failureFailedTitle:"読み込みに失敗しました",failureFailedBody:"しばらくしてからもう一度お試しください。",retry:"再試行",reloadPage:"ページを再読み込み",imageZoomIn:"拡大",imageZoomOut:"縮小",imageFit:"画面に合わせる",imageFitLevel:"全体",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"新しいタブで開く",download:"ダウンロード",mediaUnsupported:"このブラウザではこのファイルを再生できません。",fileNotShown:"このファイルはここでは表示できません。ダウンロードして開いてください。",viewerLoading:"データを読み込み中...",viewerErrorPrefix:"エラー: ",viewerStyleTitle:"表示スタイル",viewerSelectStyle:"表示スタイルを選択",viewerPinStyle:"スタイル選択をピン留め",viewerUnpinStyle:"スタイル選択のピン留めを解除",viewerErrorTitle:"エラーが発生しました",viewerMissingImage:"画像が見つかりません",viewerOpenToc:"目次を開く",viewerTocTitle:"目次",viewerPinToc:"目次をピン留め",viewerUnpinToc:"目次のピン留めを解除",viewerSelectAlign:"揃えを選択",viewerAlignTitle:"揃え",viewerPinAlign:"揃え選択をピン留め",viewerUnpinAlign:"揃え選択のピン留めを解除",viewerAlignLeft:"左揃え",viewerAlignCenter:"中央揃え",viewerAlignRight:"右揃え",viewerMermaidInteractionMode:"マウス操作モード",viewerMermaidModeNone:"操作なし",viewerMermaidModeZoom:"拡大縮小のみ",viewerMermaidModePan:"移動のみ (左ドラッグ)",viewerMermaidModePanShift:"移動のみ (Shift+ドラッグ)",viewerMermaidModeBoth:"拡大縮小+移動 (左ドラッグ)",viewerMermaidModeBothShift:"拡大縮小+移動 (Shift+ドラッグ)",viewerMermaidZoomIn:"拡大",viewerMermaidZoomOut:"縮小",viewerMermaidResetView:"表示を元に戻す",viewerMermaidRetry:"再試行",viewerEmbeddedVideo:"埋め込みの動画",viewerEmbeddedPost:"埋め込みの投稿",viewerEmbeddedFrame:"埋め込みのコンテンツ",multiRegion:"パネル",multiEmpty:"エクスプローラーで文書を選ぶと、ここに並べて開きます。",panelLimit:e=>`同時に開けるのは ${String(e)} パネルまでです。`,panelOpened:e=>`${e} を開きました`,panelClosed:e=>`${e} を閉じました`,panelAlreadyOpen:e=>`${e} は既に開いています`,panelHidden:e=>`${e} を隠しました`,panelShown:e=>`${e} を表示しました`,panelMaximized:e=>`${e} を最大化しました`,panelRestored:e=>`${e} を元のサイズに戻しました`,panelHide:"パネルを隠す",panelMaximize:"パネルを最大化",panelRestore:"パネルを元のサイズに戻す",panelClose:"パネルを閉じる",panelSwitchToCustomDrag:"カスタムのドラッグの方式に切り替え",panelSwitchToNormalDrag:"通常のドラッグの方式に戻す",panelCustomDragBadge:"カスタム",panelMovePreviousColumn:"前の列へ移動",panelMoveNextColumn:"次の列へ移動",panelMoveUp:"上へ移動",panelMoveDown:"下へ移動",panelMoved:"{title} を {column} 列目の {position} 番目へ移動しました",panelMoveUnavailable:"{title} は「{move}」できません",panelDragStarted:"{title} を持ち上げました",panelDragCancelled:"{title} の移動を取り消しました",hiddenPanelsTitle:"隠したパネル:",hiddenPanelBadge:"非表示",hiddenPanelNotice:"このパネルは隠しています",multiColumnEmpty:"この列は空です",multiColumnRegion:"{column} 列目",panelDropHere:"ここへパネルをドロップ"},Ct=Object.freeze({en:Object.freeze(Ot),ja:Object.freeze(kn)}),Ze=Object.freeze(Object.keys(Ot)),Rn=new Set(Ze),Tn=e=>Rn.has(e),we=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,At=e=>{if(e===void 0)return Tt;if(qe.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${qe.map(t=>JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${we(e)}`)},Ie=(e,t)=>{const n=Ct[At(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${we(t)}`);if(!I.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${we(t)}`);const r=t,o={...n};for(const s of Object.keys(r)){if(!Tn(s))throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${Ze.join(", ")}`);const a=r[s];if(a===void 0)continue;const u=typeof n[s];if(typeof a!==u)throw new TypeError(`[markdown-explorer] labels.${s} must be a ${u}; got ${we(a)}`);if(typeof a=="string"&&a.trim()==="")throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);const w=Lt[s];if(typeof a=="string"&&w!==void 0){for(const[,m]of a.matchAll(yn))if(!w.includes(m??""))throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${String(m)}}; it accepts ${w.map(f=>`{${f}}`).join(", ")}`)}o[s]=a}return Object.freeze(o)},Ln=(e,t)=>{if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;const n=e,r=t,o=Object.keys(n),s=Object.keys(r);return o.length===s.length&&s.every(a=>Object.hasOwn(n,a)&&Object.is(n[a],r[a]))},Be=Object.freeze(["light","dark"]),On=e=>{if(e===void 0)return"light";if(Be.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${Be.map(t=>JSON.stringify(t)).join(" or ")}; got ${typeof e=="string"?JSON.stringify(e):typeof e}`)},jt=i.createContext(null),P=()=>{const e=i.use(jt);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},ue=e=>{const{viewSettings:t}=P(),n=()=>e(t.getSnapshot());return i.useSyncExternalStore(t.subscribe,n,n)},ye=()=>{const{config:e}=P(),t=Y.useParams()["*"],[n]=Y.useSearchParams(),r=n.toString();return i.useMemo(()=>I.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])},Mt={unauthorized:["failureUnauthorizedTitle","failureUnauthorizedBody"],forbidden:["failureForbiddenTitle","failureForbiddenBody"],"not-found":["failureNotFoundTitle","failureNotFoundBody"],"not-configured":["failureNotConfiguredTitle","failureNotConfiguredBody"],invalid:["failureInvalidTitle","failureInvalidBody"],"too-large":["failureTooLargeTitle","failureTooLargeBody"],unsupported:["failureUnsupportedTitle","failureUnsupportedBody"],failed:["failureFailedTitle","failureFailedBody"]},te=(e,t)=>e[Mt[t][0]],le=({failure:e,alert:t,onRetry:n,testId:r})=>{const{labels:o}=P(),s=te(o,e.reason),a=o[Mt[e.reason][1]],u=e.reason==="unauthorized"||e.reason==="forbidden"||e.reason==="failed"?"danger":"warning";return l.jsxs("div",{className:"aqmx-callout",role:t?"alert":void 0,"data-aqmx-tone":u,"data-testid":r===null?void 0:r,"data-aqmx-failure":r===null?void 0:e.reason,children:[l.jsx("p",{className:"aqmx-callout-title",children:s}),l.jsx("p",{className:"aqmx-callout-body",children:a}),e.reason==="unauthorized"?l.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:()=>window.location.reload(),children:o.reloadPage}):n!==void 0&&e.reason==="failed"?l.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:n,children:o.retry}):null]})},Cn=(e,t)=>{const{phase:n,save:r,dirty:o}=t;switch(n.kind){case"opening":return e.editLoading;case"grant":return e.editGrantTitle;case"failed":return te(e,n.failure.reason)}switch(r.kind){case"saving":return e.draftSaving;case"conflicts":return e.draftConflicts(r.count);case"grant":return e.editGrantTitle;case"failed":return e.draftSaveFailed(te(e,r.failure.reason));case"saved":if(!o)return r.merged?e.draftSavedMerged:e.draftSaved;break}return o?e.draftUnsaved:""},An=(e,t,n)=>{switch(t.kind){case"saved":return t.merged?e.documentSavedMerged(n):e.documentSaved(n);case"conflicts":return e.draftConflicts(t.count);case"grant":return e.editGrantTitle;case"failed":return e.draftSaveFailed(te(e,t.failure.reason));case"idle":case"saving":return null}},ae=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),emit:()=>{for(const t of[...e])t()}}},Nt="<<<<<<<",Dt="=======",Pt=">>>>>>>",rt=(e,t)=>e===t||e.startsWith(`${t} `),ot=e=>_t(e.split(`
|
|
2
|
-
`)),_t=e=>{const t=[];let n=null,r=null,o=0;for(const s of e){o+=1;const a=s.charCodeAt(0);a!==60&&a!==61&&a!==62||(rt(s,Nt)?(n=o,r=null):s===Dt?n!==null&&r===null?r=o:n=null:rt(s,Pt)&&(n!==null&&r!==null&&t.push({start:n,separator:r,end:o}),n=null,r=null))}return t},st=e=>e.includes(`\r
|
|
3
|
-
`)?`\r
|
|
4
|
-
`:`
|
|
5
|
-
`,je=e=>e.replace(/\r\n?/gu,`
|
|
6
|
-
`),jn=(e,t)=>t===`
|
|
7
|
-
`?e:e.replaceAll(`
|
|
8
|
-
`,`\r
|
|
9
|
-
`),Mn=3,Me=Object.freeze({kind:"idle"}),Nn=({data:e,conflictLabels:t,onSaveSettled:n,previewSetting:r})=>{const o=new Map,s=new Map,a=new Map,u=new Map,w=new Map,m=ae();let f=null,p=null;const h=(c,d)=>{c.value={...c.value,...d},m.emit()},y=(c,d)=>o.get(c)===d,C=async(c,d)=>{d.controller.abort(),d.controller=new AbortController;const{signal:g}=d.controller;h(d,{phase:{kind:"opening"}});const x=await e.edit(c,g);if(!y(c,d)||g.aborted||!("kind"in x))return;if(x.kind==="grant"){h(d,{phase:{kind:"grant",href:x.href}});return}if(x.kind==="failure"){h(d,{phase:{kind:"failed",failure:x.failure}});return}const k=je(x.text);d.base={text:k,version:x.version},d.draft=k,d.ending=st(x.text),h(d,{phase:{kind:"editing"},history:x.history,dirty:!1,save:Me,generation:d.value.generation+1})},b=c=>{const d=o.get(c);d!==void 0&&(d.controller.abort(),o.delete(c),a.delete(c))},L=(c,d,g)=>(c.set(d,g),()=>{c.get(d)===g&&c.delete(d)}),R=(c,d,g,x={})=>{h(d,{...x,save:g}),n(c,g)},M=async c=>{u.get(c)?.flush();const d=o.get(c);if(d===void 0||d.value.phase.kind!=="editing"||d.base===null||d.value.save.kind==="saving")return;const g=ot(d.draft).length;if(g>0){R(c,d,{kind:"conflicts",count:g});return}d.controller.abort(),d.controller=new AbortController;const{signal:x}=d.controller;let k=d.base,j=d.draft,T=!1;h(d,{save:{kind:"saving"}});for(let D=0;D<Mn;D+=1){const F=await e.save(c,k.version,jn(j,d.ending),x);if(!y(c,d)||x.aborted||!("kind"in F))return;if(F.kind==="saved"){u.get(c)?.flush(),d.base={text:j,version:F.version},R(c,d,{kind:"saved",merged:T},{dirty:d.draft!==j});return}if(F.kind==="grant"){R(c,d,{kind:"grant",href:F.href});return}if(F.kind==="failure"){R(c,d,{kind:"failed",failure:F.failure});return}const{mergeDraft:V}=await Promise.resolve().then(()=>require("./merge-BR4jKpIc.cjs"));if(!y(c,d)||x.aborted)return;const K=u.get(c);K?.flush();const X=je(F.text),G=V(k.text,d.draft,X,t());if(k={text:X,version:F.version},d.base=k,d.ending=st(F.text),d.draft=G.text,K?.adopt(G.text),G.kind==="conflicts"){R(c,d,{kind:"conflicts",count:G.conflicts},{dirty:!0,generation:d.value.generation+1});return}if(T=!0,j=G.text,j===k.text){R(c,d,{kind:"saved",merged:T},{dirty:!1,generation:d.value.generation+1});return}h(d,{dirty:!0,generation:d.value.generation+1})}R(c,d,{kind:"failed",failure:{reason:"failed"}})};return{session:c=>o.get(c)?.value,subscribe:m.subscribe,start:(c,d)=>{const g=o.get(c);if(g!==void 0){h(g,{request:{anchor:d}}),(g.value.phase.kind==="failed"||g.value.phase.kind==="grant")&&C(c,g);return}s.delete(c);const x={value:{path:c,phase:{kind:"opening"},history:!1,dirty:!1,save:Me,generation:0,request:{anchor:d}},base:null,draft:"",ending:`
|
|
10
|
-
`,controller:new AbortController};o.set(c,x),C(c,x)},retry:c=>{const d=o.get(c);d===void 0||d.value.phase.kind==="editing"||C(c,d)},draft:c=>{const d=o.get(c);return d===void 0||d.base===null?null:d.draft},setDraft:(c,d)=>{const g=o.get(c);if(g===void 0||g.base===null)return;g.draft=d;const x={},k=d!==g.base.text;k!==g.value.dirty&&(x.dirty=k);const{save:j}=g.value;if(j.kind==="conflicts"){const T=ot(d).length;T===0?x.save=Me:T!==j.count&&(x.save={kind:"conflicts",count:T})}(x.dirty!==void 0||x.save!==void 0)&&h(g,x)},consumeRequest:c=>{const d=o.get(c);d!==void 0&&d.value.request!==null&&h(d,{request:null})},save:M,replaceDraft:(c,d)=>{const g=u.get(c);g?.flush();const x=o.get(c);if(x===void 0||x.base===null)return;const k=je(d);x.draft=k,g?.adopt(k),h(x,{dirty:k!==x.base.text,generation:x.value.generation+1})},close:c=>{if(!o.has(c))return;const d=u.get(c),g=d===void 0?null:d.returnPoint();b(c),g===null?s.delete(c):s.set(c,g),m.emit()},takeReturn:c=>{const d=s.get(c)??null;return s.delete(c),d},dirtyPaths:()=>[...o.values()].filter(c=>c.value.dirty).map(c=>c.value.path),discard:c=>{for(const d of c)b(d);c.length>0&&m.emit()},editorState:{get:c=>a.get(c),set:(c,d)=>{o.has(c)&&a.set(c,d)}},bindEditor:(c,d)=>L(u,c,d),bindView:(c,d)=>L(w,c,d),viewAnchor:c=>{const d=w.get(c);return d===void 0?null:d.anchor()},flush:c=>u.get(c)?.flush(),flushDrafts:()=>{for(const c of u.values())c.flush()},nextConflict:c=>u.get(c)?.nextConflict()===!0,hasSessions:()=>o.size>0,unsavedAmong:c=>{for(const d of u.values())d.flush();return c.filter(d=>o.get(d)?.value.dirty===!0)},askToDiscard:c=>new Promise(d=>{p?.settle(!1);const g={paths:c,settle:x=>{if(p===g){if(p=null,x)for(const k of c)b(k);m.emit(),d(x)}}};p=g,m.emit()}),discardRequest:()=>p,previewShown:()=>(f??=r.read(),f),setPreviewShown:c=>{f!==c&&(f=c,r.write(c),m.emit())}}},Ve=e=>{e.preventDefault(),e.stopPropagation()},Ft=({open:e,title:t,body:n,confirmLabel:r,cancelLabel:o,onConfirm:s,onCancel:a,testId:u})=>{const w=i.useRef(null),m=i.useRef(null),f=i.useRef(null),p=i.useId(),h=i.useId();i.useLayoutEffect(()=>{const b=w.current;if(b!==null)if(e&&!b.open){const L=b.ownerDocument.activeElement;f.current=L instanceof HTMLElement?L:null,b.showModal(),m.current?.focus()}else!e&&b.open&&(b.close(),f.current?.isConnected===!0&&f.current.focus(),f.current=null)},[e]);const y=b=>{b.key!=="Escape"||b.defaultPrevented||(Ve(b),a())},C=b=>{b.target===b.currentTarget&&a()};return l.jsx("dialog",{ref:w,className:"aqmx-confirm","aria-labelledby":p,"aria-describedby":h,"data-testid":u,onKeyDown:y,onClick:C,onCancel:b=>b.preventDefault(),children:l.jsxs("div",{className:"aqmx-confirm-panel",children:[l.jsx("p",{id:p,className:"aqmx-confirm-title",children:t}),l.jsx("p",{id:h,className:"aqmx-confirm-body",children:n}),l.jsxs("div",{className:"aqmx-confirm-actions",children:[l.jsx("button",{ref:m,type:"button",className:"aqmx-callout-action","data-testid":`${u}-cancel`,onClick:a,children:o}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-aqmx-tone":"danger","data-testid":`${u}-confirm`,onClick:s,children:r})]})]})})},Dn=(e,t)=>{const n=Y.matchPath({path:`${e.basePath}/*`,end:!0},t.pathname);if(n===null)return new Set;const{location:r}=I.resolveExplorerLocation(e,n.params["*"],new URLSearchParams(t.search));switch(r.view){case"tree":return new Set(r.doc===null?[]:[r.doc]);case"single":return new Set([r.doc]);case"multi":return new Set(r.docs)}},$t=e=>{const{edits:t}=P(),n=i.useCallback(()=>t.session(e),[t,e]);return i.useSyncExternalStore(t.subscribe,n,Pn)},qt=()=>!1,Pn=()=>{},_n=()=>{const{edits:e}=P();return i.useSyncExternalStore(e.subscribe,e.hasSessions,qt)},It=()=>{const{edits:e}=P();return i.useSyncExternalStore(e.subscribe,e.previewShown,qt)},Fn=()=>null,$n=()=>{const{edits:e,labels:t,config:n}=P(),r=i.useRef([]),o=i.useCallback(({nextLocation:p})=>{const h=Dn(n,p);return e.flushDrafts(),r.current=e.dirtyPaths().filter(y=>!h.has(y)),r.current.length>0},[e,n]),s=Y.useBlocker(o),a=_n();i.useEffect(()=>{if(!a)return;const p=h=>{e.flushDrafts(),e.dirtyPaths().length!==0&&(h.preventDefault(),h.returnValue=!0)};return window.addEventListener("beforeunload",p),()=>window.removeEventListener("beforeunload",p)},[a,e]);const u=i.useSyncExternalStore(e.subscribe,e.discardRequest,Fn),w=s.state==="blocked",f=(w?r.current:u===null?[]:u.paths).map(p=>N.lastPathSegment(p)).join(", ");return l.jsx(Ft,{open:w||u!==null,title:t.unsavedTitle,body:t.unsavedBody(f),confirmLabel:t.unsavedDiscard,cancelLabel:t.unsavedStay,testId:"markdown-explorer-unsaved-guard",onConfirm:()=>{if(s.state==="blocked"){e.discard(r.current),s.proceed();return}u?.settle(!0)},onCancel:()=>{if(s.state==="blocked"){s.reset();return}u?.settle(!1)}})};function qn({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const In=S.forwardRef(qn);let Ne=null;const Bt=()=>(Ne??=Promise.resolve().then(()=>require("./EditSurface-5nbW7NTP.cjs")).catch(e=>{throw Ne=null,e}),Ne),lt=()=>{Bt().catch(()=>{})},Bn=e=>{const{default:t}=i.use(Bt());return l.jsx(t,{...e})};class Hn extends i.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}retry=()=>this.setState({failed:!1});render(){return this.state.failed?this.props.fallback(this.retry):this.props.children}}const Ge=`[${$e.SOURCE_LINES_ATTRIBUTE}]`,Un="[data-aqmd-content]",zn='a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg',Zn=200,fe=e=>$e.parseSourceLines(e.getAttribute($e.SOURCE_LINES_ATTRIBUTE)),Vn=(e,t)=>{for(let r=e;r!==null&&t.contains(r);r=r.parentElement){const o=fe(r);if(o!==null)return{block:r,lines:o,own:!0}}let n=null;for(const r of t.querySelectorAll(Ge)){if(!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))break;const o=fe(r);o!==null&&(n={block:r,lines:o})}return n===null?null:{...n,own:!1}},Gn=(e,t)=>{let n=0;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+t.length))n+=1;return n},Kn=e=>e.closest(Un)!==null&&e.closest(zn)===null,Wn=(e,t,n)=>{const r=Vn(e,t);if(r===null)return null;const{block:o,own:s}=r;if(!s){const u=r.lines.last+1;return{lines:{first:u,last:u},word:null,occurrence:0,clientTop:Ee(e)}}const a=Yn(o,n);return a===null?{lines:r.lines,word:null,occurrence:0,clientTop:Ee(o)}:{lines:r.lines,word:a.text,occurrence:a.occurrence,clientTop:a.clientTop}},Xn=(e,t)=>{let n=null,r=null,o=null;for(const a of e.querySelectorAll(Ge)){const u=fe(a);if(u===null)continue;n??=Ut(t,a);const{top:w,bottom:m}=a.getBoundingClientRect();w<=n&&n<m?r={lines:u,block:a}:o===null&&w>=n&&(o={lines:u,block:a})}const s=r===null?o:r;return s===null?null:{lines:s.lines,word:null,occurrence:0,clientTop:Ee(s.block)}},Ht=e=>e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,Ut=(e,t)=>{const n=Number.parseFloat(getComputedStyle(t).scrollMarginTop);return Ht(e)+(Number.isFinite(n)?n:0)},Yn=(e,t)=>{if(t===null||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!(e.contains(n.startContainer)&&e.contains(n.endContainer)))return null;const r=n.toString().trim();if(r===""||r.length>Zn||/[\r\n]/u.test(r))return null;const o=e.ownerDocument.createRange();return o.setStart(e,0),o.setEnd(n.startContainer,n.startOffset),{text:r,occurrence:Gn(o.toString(),r),clientTop:n.getBoundingClientRect().top}},Qn=(e,t)=>{const n=e.split(`
|
|
11
|
-
`),r=Math.min(t.lines.first,n.length),o=Math.min(t.lines.last,n.length),s={line:r,column:0};if(t.word===null)return s;let a=0;for(let u=r;u<=o;u+=1){const w=n[u-1]??"";for(let m=w.indexOf(t.word);m>=0;m=w.indexOf(t.word,m+t.word.length)){if(a===t.occurrence)return{line:u,column:m};a+=1}}return a>0?Jn(n,r,o,t.word)??s:s},Jn=(e,t,n,r)=>{for(let o=n;o>=t;o-=1){const s=(e[o-1]??"").lastIndexOf(r);if(s>=0)return{line:o,column:s}}return null},zt=(e,t)=>{let n=null,r=null;for(const o of e.querySelectorAll(Ge)){const s=fe(o);s===null||s.first>t||(s.last>=t?n=o:(r===null||s.last>=r.last)&&(r={element:o,last:s.last}))}return n!==null?n:r===null?null:r.element},Zt=(e,t)=>{const{bottom:n}=e.getBoundingClientRect(),r=Ee(e),o=fe(e);if(o===null)return r;const s=Math.min(Math.max(t-o.first,0)/(o.last-o.first+1),1);return r+(n-r)*s},Ee=e=>{const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let n=t.nextNode();n!==null;n=t.nextNode()){const o=(n.textContent??"").search(/\S/u);if(o<0)continue;const s=e.ownerDocument.createRange();s.setStart(n,o),s.setEnd(n,o+1);const{top:a,height:u}=s.getBoundingClientRect();if(u>0)return a}return e.getBoundingClientRect().top},Ke=Object.freeze({browse:Object.freeze({replace:!0,preventScrollReset:!0,defaultShouldRevalidate:!1}),"switch-source":Object.freeze({replace:!1,preventScrollReset:!0,defaultShouldRevalidate:!1}),"switch-view":Object.freeze({replace:!1,preventScrollReset:!1,defaultShouldRevalidate:!1}),"follow-link":Object.freeze({replace:!1,preventScrollReset:!1,defaultShouldRevalidate:!1})}),er=e=>Ke[e],he=()=>{const e=Y.useNavigate();return i.useCallback((t,n)=>{e(t,Ke[n])},[e])},Vt=({navigation:e,...t})=>l.jsx(Y.Link,{...t,...Ke[e]}),We=e=>{const t=e.ownerDocument;if(e.focus({preventScroll:!0}),t.activeElement===e)return!0;if(e.hasAttribute("tabindex"))return!1;if(e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),t.activeElement!==e)return e.removeAttribute("tabindex"),!1;const n=()=>{t.activeElement!==e&&(e.removeAttribute("tabindex"),e.removeEventListener("blur",n))};return e.addEventListener("blur",n),!0},Gt=(e,t)=>{const n=i.useRef(null),r=i.useRef(null),o=i.useRef(null),s=i.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);i.useEffect(()=>s,[s]);const a=i.useCallback(m=>{if(r.current!==m)return;const f=o.current;if(f!==null){f.then(()=>a(m));return}e.prefetch(m);const p=e.peek(m);if(p?.status!=="pending")return;const h=Promise.allSettled([p.promise]);o.current=h,h.then(()=>{o.current===h&&(o.current=null)})},[e]),u=i.useCallback(m=>{const f=t(m);f!==r.current&&(s(),f!==null&&(r.current=f,n.current=window.setTimeout(()=>{n.current=null,a(f)},I.PREFETCH_DWELL_MS)))},[s,t,a]),w=i.useCallback(m=>{t(m)!==r.current&&s()},[s,t]);return i.useMemo(()=>({onPointerOver:m=>u(m.target),onPointerOut:m=>w(m.relatedTarget),onFocus:m=>u(m.target),onBlur:m=>w(m.relatedTarget)}),[u,w])},tr=i.lazy(()=>Promise.resolve().then(()=>require("./NativeScrollBar-QlOtnddZ.cjs")).then(e=>({default:e.NativeScrollBar})));class nr extends i.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t){console.error("[markdown-explorer] a scroll bar failed to load or render; its scroller keeps its native scrolling without it.",t)}render(){return this.state.failed?null:this.props.children}}const Kt=({scroller:e,withCircle:t})=>l.jsx(nr,{children:l.jsx(i.Suspense,{fallback:null,children:l.jsx(tr,{scroller:e,withCircle:t})})}),Wt=e=>l.jsx(Kt,{scroller:e,withCircle:!0}),Xt=()=>{const e=new Map,t=new Set;let n=!1;const r=o=>{t.add(o),!n&&(n=!0,queueMicrotask(()=>{n=!1,t.clear()}))};return{hold:o=>{e.set(o,(e.get(o)??0)+1);let s=!1;return()=>{if(s)return;s=!0;const a=e.get(o);if(a!==void 0&&a>1){e.set(o,a-1);return}e.delete(o),r(o)}},isHeld:o=>e.has(o),resumes:o=>t.delete(o),heldKeys:()=>[...e.keys()]}},be=(e,t)=>{if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;if(Array.isArray(e)||Array.isArray(t))return!(Array.isArray(e)&&Array.isArray(t))||e.length!==t.length?!1:e.every((s,a)=>be(s,t[a]));const n=e,r=t,o=Object.keys(n);return o.length!==Object.keys(r).length?!1:o.every(s=>Object.hasOwn(r,s)&&be(n[s],r[s]))},me=e=>{const t=e;return t.status===void 0&&(t.status="pending",e.then(n=>{t.status="fulfilled",t.value=n},n=>{t.status="rejected",t.reason=n})),t},Yt=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),pe=e=>e.status==="fulfilled"?e.value:void 0,rr=55e3,it=Object.freeze({status:"deferred"}),at=Object.freeze({status:"refreshed"}),De=Object.freeze({status:"superseded"}),oe=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,Qt=e=>e!==void 0&&e.status==="loaded"&&e.document.kind!=="failure",or=({client:e,capacity:t})=>{if(!Number.isInteger(t)||t<1)throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);const n=new Map,r=Xt(),o=ae(),s=new WeakSet;let a=0;const u=o.emit,w=()=>(a+=1,a),m=()=>{if(!(n.size<=t))for(const c of[...n.keys()]){if(n.size<=t)return;r.isHeld(c)||n.delete(c)}},f=(c,d)=>{n.delete(c),n.set(c,d)},p=c=>performance.now()-c.validatedAt>=rr,h=(c,d,g)=>{const x=n.get(c),k=oe(x?.snapshot),j=g||x?.refreshPending===!0,T=me(e.document(c,{refresh:j}).then(F=>({status:"loaded",document:F}))),D={snapshot:{status:"pending",promise:T,previous:k},validatedAt:performance.now(),opened:d,background:null,refreshPending:!1,seeded:void 0,stamp:w()};return f(c,D),m(),T.then(F=>{n.get(c)===D&&(D.snapshot=F,D.stamp=w(),u())}),D},y=(c,d,g,x,k,j)=>{d.background===g&&(d.background=null,!(n.get(c)!==d||d.snapshot!==x)&&(k.kind==="failure"&&x.document.kind!=="failure"||(d.validatedAt=j,d.stamp=w(),be(x.document,k)||(d.snapshot={status:"loaded",document:k}),u())))},C=async(c,d)=>{const g=d.snapshot;if(g.status!=="loaded")return null;const x={};d.background=x;const k=performance.now(),j=e.document(c,{refresh:d.refreshPending});d.refreshPending=!1;const T=await j,D=d.background===x&&n.get(c)===d&&d.snapshot===g;return y(c,d,x,g,T,k),D?T:null},b=(c,d)=>{const{snapshot:g}=d;return g.status==="pending"?!1:g.status==="loaded"&&g.document.kind!=="failure"?(C(c,d),!1):(g.status==="loaded"&&s.add(g),h(c,!0,!1),!0)},L=c=>{const d=r.hold(c);let g=!1;return()=>{if(g)return;g=!0,d();const x=n.get(c);x!==void 0&&f(c,x),m()}};return{peek:c=>n.get(c)?.snapshot,peekSeeded:c=>n.get(c)?.seeded,answerStampOf:c=>n.get(c)?.stamp,prefetch:c=>{const d=n.get(c);d!==void 0&&d.snapshot.status!=="deferred"||(h(c,!1,!1),u())},open:c=>{const d=r.resumes(c),g=L(c),x=n.get(c);if(x===void 0||x.snapshot.status==="deferred")return h(c,!0,!1),u(),g;if(f(c,x),d)return g;const{snapshot:k}=x;return k.status==="pending"?(x.opened=!0,g):k.document.kind==="failure"?(x.opened||p(x)?(s.add(k),h(c,!0,!1),u()):x.opened=!0,g):(x.opened=!0,x.background===null&&p(x)&&C(c,x),g)},retain:L,retry:c=>{const d=n.get(c);d===void 0||d.snapshot.status!=="loaded"||d.snapshot.document.kind!=="failure"||(h(c,!0,!1),u())},seed:(c,d)=>{const g=performance.now(),x=me(d.then(F=>F===null?it:{status:"loaded",document:F},()=>it)),k=n.get(c);if(k!==void 0&&k.snapshot.status==="loaded"){const F=k.snapshot,V={};k.background=V,x.then(K=>{if(K.status==="loaded"){y(c,k,V,F,K.document,g);return}k.background===V&&(k.background=null)});return}const j=k!==void 0&&k.snapshot.status==="pending"?k.snapshot.previous:null,T={status:"pending",promise:x,previous:j},D={snapshot:T,validatedAt:g,opened:k?.opened===!0,background:null,refreshPending:k?.refreshPending===!0,seeded:T,stamp:w()};f(c,D),m(),x.then(F=>{n.get(c)===D&&(F.status==="deferred"&&r.isHeld(c)?h(c,D.opened,!1):(D.snapshot=F,D.stamp=w()),u())})},invalidate:()=>{let c=!1;for(const[d,g]of[...n]){if(g.validatedAt=Number.NEGATIVE_INFINITY,g.opened=!0,g.refreshPending=!0,!r.isHeld(d))continue;const{snapshot:x}=g;if(x.status!=="pending"){b(d,g)&&(c=!0);continue}x.promise.then(()=>{n.get(d)===g&&g.refreshPending&&r.isHeld(d)&&b(d,g)&&u()})}c&&u()},refresh:async c=>{const d=n.get(c);if(d!==void 0&&Qt(d.snapshot)){d.refreshPending=!0;const x=await C(c,d);return x===null?De:x.kind==="failure"?{status:"failed",failure:x.failure}:at}const g=h(c,!0,!0);return u(),g.snapshot.status!=="pending"?De:(await g.snapshot.promise,n.get(c)===g?at:De)},clear:()=>{n.clear();for(const c of r.heldKeys())h(c,!0,!1);u()},subscribe:o.subscribe,noteFailureShown:c=>s.has(c)?!1:(s.add(c),!0)}},ie=i.createContext("fill"),sr=Object.freeze({blockSize:"100%"}),ge=({scrollerProps:e,children:t})=>i.use(ie)==="content"?l.jsx(de.HostedScrollArea,{scrollerProps:e,children:t}):l.jsx(de.HostedScrollArea,{scrollerProps:{...e,style:sr},rowClassName:"aqmx-document-scroll-row",renderScrollBar:Wt,children:t});function lr({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{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"}),S.createElement("path",{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"}))}const ir=S.forwardRef(lr);function ar({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}),S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const cr=S.forwardRef(ar),ke=({name:e,url:t,icon:n,children:r})=>{const{labels:o}=P();return l.jsxs("div",{className:"aqmx-document-toolbar",children:[l.jsx("span",{className:"aqmx-document-file-icon","aria-hidden":"true",children:n}),l.jsx("span",{className:"aqmx-document-title",title:e,"data-testid":"markdown-explorer-file-name",children:e}),r,l.jsx("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:l.jsx(cr,{})}),l.jsx("a",{className:"aqmx-icon-button",href:t,download:e,"aria-label":o.download,title:o.download,"data-testid":"markdown-explorer-file-download",children:l.jsx(ir,{})})]})};function dr({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const ur=S.forwardRef(dr),fr=Object.freeze({className:"aqmx-document-stage"}),mr=({document:e})=>{const{labels:t}=P();return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[l.jsx(ke,{name:e.name,url:e.url,icon:l.jsx(ur,{})}),l.jsx(ge,{scrollerProps:fr,children:l.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-file-not-shown",children:[l.jsx("p",{className:"aqmx-callout-body",children:t.fileNotShown}),l.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-file-not-shown-download",children:t.download})]})})]})},Re="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",hr=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},gr=/(%[0-9A-Fa-f]{2})/u,Xe=e=>{if(!e.startsWith("#")||e.length===1)return null;const t=new TextEncoder,n=e.slice(1).split(gr).flatMap((r,o)=>o%2===1?[Number.parseInt(r.slice(1),16)]:[...t.encode(r)]);return new TextDecoder("utf-8",{ignoreBOM:!0}).decode(Uint8Array.from(n))},Jt=e=>`#${encodeURIComponent(e)}`,pr=e=>{if(e==="#")return!0;const t=Xe(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},en=(e,t)=>{if(t==="")return null;for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},vr="http://www.w3.org/1999/xhtml",ct=(e,t)=>{if(t==="")return null;const n=en(e,t);if(n!==null)return n;for(const r of e.querySelectorAll("a[name]"))if(r.localName==="a"&&r.namespaceURI===vr&&r.getAttribute("name")===t)return r;return null},tn=(e,t)=>{if(e===null||!t.startsWith("#"))return null;const n=ct(e,t.slice(1));if(n!==null)return n;const r=Xe(t);return r===null?null:ct(e,r)},dt=e=>{const{body:t,documentElement:n}=e.ownerDocument;if(e===t){const o=getComputedStyle(n);if(o.overflowX==="visible"&&o.overflowY==="visible")return!1}const{overflowY:r}=getComputedStyle(e);return r==="auto"||r==="scroll"},wr=e=>{const{body:t,documentElement:n}=e,r=getComputedStyle(n),o=r.overflowX==="visible"&&r.overflowY==="visible"&&t!==null?getComputedStyle(t).overflowY:r.overflowY;return o!=="hidden"&&o!=="clip"},xr=(e,t)=>{const n=t.closest(Re),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&dt(r))return r;const o=e.getBoundingClientRect().height,{documentElement:s,scrollingElement:a}=e.ownerDocument;for(let u=e.parentElement;u!==null&&u!==s;u=u.parentElement)if(dt(u)&&u.scrollHeight>u.clientHeight&&u.clientHeight<o)return u;return a instanceof Element&&wr(e.ownerDocument)&&a.scrollHeight>a.clientHeight&&a.clientHeight<o?a:r},Er=Object.freeze({scrollerOf:xr,reveal:e=>{e.scrollIntoView(He)}}),He=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),br=(e,t)=>{for(let n=t;n!==null&&n!==e;n=n.parentElement){const r=n.parentElement;if(r instanceof HTMLDetailsElement&&n!==r.querySelector(":scope > summary")&&(r.open=!0),n.getAttribute("hidden")?.toLowerCase()==="until-found"){if(n.dispatchEvent(new Event("beforematch",{bubbles:!0})),!n.isConnected)return;n.removeAttribute("hidden")}}},Sr=(e,t)=>{if(t.getClientRects().length===0)return;const n=e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,{scrollMarginTop:r,scrollMarginBottom:o}=getComputedStyle(t),s=Number.parseFloat(r),a=t.getBoundingClientRect(),u=a.height+s+Number.parseFloat(o)>e.clientHeight;if(!u&&Math.abs(a.top-s-n)<1){t.scrollIntoView(He);return}e.scrollBy({top:u?a.top-n-e.clientHeight:a.bottom-n+e.clientHeight,behavior:"instant"}),t.scrollIntoView(He)},yr=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(Re)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},ut=(e,t,n)=>{if(e===null)return null;const r=tn(e,t);return r===null?(pr(t)&&yr(e,n),null):(br(e,r),Sr(n.scrollerOf(e,r),r),n.reveal(r),r)};function kr({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{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"}))}const Rr=S.forwardRef(kr);function Tr({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{d:"M6.75 8.25a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z"}),S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const Lr=S.forwardRef(Tr);function Or({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{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"}),S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const Cr=S.forwardRef(Or);function Ar({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const jr=S.forwardRef(Ar),Ue="data-aqmx-key-repeat",Se=Object.freeze({[Ue]:"allow"}),Mr=`[${Ue}="${Se[Ue]}"]`,Nr=()=>{let e=null;return{onKeyDownCapture:t=>{if(t.key==="Enter"){if(!t.repeat){e=t.target instanceof Element?t.target:null;return}e!==null&&t.target===e&&e.closest(Mr)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},xe=Object.freeze([1/I.GOLDEN_RATIO**2,1/I.GOLDEN_RATIO,1,I.GOLDEN_RATIO,I.GOLDEN_RATIO**2]),ft=Object.freeze({mode:"fit"}),Dr=1,Pr=Object.freeze({className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas"}),nn=i.createContext(null),_r=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=Dr?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,mt=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<xe.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?xe.findIndex(o=>o>t):xe.findLastIndex(o=>o<t);return r===-1?null:r},ht=(e,t,n)=>{if(e.mode==="level"){const o=mt(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=mt(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},Fr=e=>{const t=xe[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);return t},gt=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},$r=({document:e})=>{const{labels:t}=P(),n=i.use(nn),[r]=i.useState(()=>n===null?null:n.read(e.url)),[o,s]=i.useState(r===null?ft:r.zoom),[a,u]=i.useState(r===null?null:r.reported),[w,m]=i.useState(null),f=i.useRef(null),p=i.useCallback(M=>{const{naturalWidth:c,naturalHeight:d}=M;u(g=>gt(g,c,d))},[]),h=i.useCallback(M=>{f.current=M,!(M===null||!M.complete)&&(M.naturalWidth>0||M.naturalHeight>0?p(M):M.decode().then(()=>p(M),()=>{}))},[p]);i.useEffect(()=>{n!==null&&a!==null&&n.save(e.url,{zoom:o,reported:a})},[n,e.url,o,a]),i.useLayoutEffect(()=>{const M=f.current;if(M===null||a===null||o.mode!=="fit")return;const c=()=>m(g=>gt(g,M.clientWidth,M.clientHeight));if(c(),typeof ResizeObserver>"u")return;const d=new ResizeObserver(c);return d.observe(M),()=>d.disconnect()},[a,o.mode]);const y=a===null||w===null?null:_r(a,w),C=ht(o,y,-1),b=ht(o,y,1),L=o.mode==="level"?Fr(o.index):null,R=o.mode==="level"&&L!==null?{width:`${o.base.width*L}px`,height:`${o.base.height*L}px`}:void 0;return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[l.jsxs(ke,{name:e.name,url:e.url,icon:l.jsx(jr,{}),children:[l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":C===null,onClick:()=>{C!==null&&s(C)},...Se,children:l.jsx(Lr,{})}),l.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:L===null?t.imageFitLevel:t.imageZoomLevel(Math.round(L*100))}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":b===null,onClick:()=>{b!==null&&s(b)},...Se,children:l.jsx(Cr,{})}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>s(ft),children:l.jsx(Rr,{})})]}),l.jsx(ge,{scrollerProps:Pr,children:l.jsx("img",{ref:h,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:R,onLoad:M=>p(M.currentTarget),"data-testid":"markdown-explorer-image"})})]})},rn=i.createContext(null),Te=i.createContext(void 0),on=i.createContext(null),Le=()=>{const e=i.use(rn);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},qr=()=>{const e=i.use(on);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},Oe=(e,t,n,r)=>t.kind==="panel"?I.explorerHref(e,{view:"tree",source:n,doc:r}):t.view==="single"?I.explorerHref(e,{view:"single",source:n,doc:r,overrides:t.overrides,embed:t.embed}):I.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides}),Ir=({children:e})=>{const{config:t}=P(),n=Le(),r=ye(),o=r.kind==="location"?r.location.source:void 0,s=Y.useHref(Oe(t,n.navigation,o,n.currentPath));return l.jsx(Te,{value:o,children:l.jsx(on,{value:s,children:e})})},Br='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',Hr=e=>{const t=e instanceof Element?e.closest(Br):null;return t===null?null:t.getAttribute("data-doc-path")},Ce=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,Ur=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:s,onDocumentLink:a,scope:u,children:w})=>{const m=Y.useHref(e),f=p=>{if(Ce(p)){if(p.preventDefault(),t===u.currentPath&&n!==""){u.scrollWithin(n);return}a(t,n)}};return l.jsx("a",{...s,href:m,className:o,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":r,onClick:f,children:w})},zr=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:s})=>{const{config:a}=P(),u=Le(),w=i.use(Te),m=hr(e),{navigation:f}=u,p=`${Oe(a,f,w,t)}${m}`,h=n===!1?"false":void 0;return f.kind==="page"?l.jsx(Vt,{...o,to:p,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":h,children:s}):l.jsx(Ur,{to:p,docPath:t,fragment:m,exists:h,className:r,attributes:o,onDocumentLink:f.onDocumentLink,scope:u,children:s})},Zr=({className:e,attributes:t,children:n})=>{const{labels:r}=P();return l.jsxs("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:[n,l.jsxs("span",{className:"aqmx-sr-only",children:[" (",r.inertLink,")"]})]})},Vr=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:s}=P(),a=i.use(Te),u=Y.useHref(`${Oe(s,r.navigation,a,r.currentPath)}${e}`),w=m=>{Ce(m)&&(m.preventDefault(),r.scrollWithin(e))};return l.jsx("a",{...n,href:u,className:t,onClick:w,children:o})},Gr=({href:e,className:t,attributes:n,children:r})=>{const o=Le();if(o.navigation.kind==="page"){const s=a=>{if(!Ce(a))return;const u=a.currentTarget;e==="#"?o.followEmptyFragment(a.nativeEvent):u.href===u.ownerDocument.URL&&o.followSameUrlJump(e,a.nativeEvent)};return l.jsx("a",{...n,href:e,className:t,onClick:s,children:r})}return l.jsx(Vr,{href:e,className:t,attributes:n,scope:o,children:r})},Kr=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:s,children:a})=>t==="doc"?n===void 0||!N.isAcceptableDocumentPath(n)?l.jsx(Zr,{className:o,attributes:s,children:a}):l.jsx(zr,{href:e,docPath:n,docExists:r,className:o,attributes:s,children:a}):e.startsWith("#")?l.jsx(Gr,{href:e,className:o,attributes:s,children:a}):l.jsx("a",{...s,href:e,className:o,children:a}),Wr=()=>{const{config:e}=P(),t=Le(),n=i.use(Te),r=he();return i.useCallback((o,s)=>{if(!Ce(s))return!0;s.preventDefault();const a=Jt(o.id),{navigation:u}=t;return u.kind==="panel"||Xe(s.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(a),!0):(r(`${Oe(e,u,n,t.currentPath)}${a}`,"follow-link"),!0)},[e,t,n,r])},Xr=()=>{const e=qr();return i.useCallback(t=>`${e}${Jt(t.id)}`,[e])};function Yr({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{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"}))}const Qr=S.forwardRef(Yr);function Jr({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const eo=S.forwardRef(Jr);function to({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const no=S.forwardRef(to),ro=Object.freeze({className:"aqmx-document-stage"}),oo=e=>{switch(e){case"video":return l.jsx(eo,{});case"audio":return l.jsx(no,{});case"pdf":return l.jsx(Qr,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`)}}},so=({document:e})=>{const{labels:t}=P();switch(e.mediaType){case"video":return l.jsx("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});case"audio":return l.jsx("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});case"pdf":return l.jsx("iframe",{className:"aqmx-document-frame",src:e.url,title:e.name,"data-testid":"markdown-explorer-media-player"});default:{const n=e.mediaType;throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`)}}},lo=({document:e})=>l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[l.jsx(ke,{name:e.name,url:e.url,icon:oo(e.mediaType)}),l.jsx(ge,{scrollerProps:ro,children:l.jsx(so,{document:e})})]}),io=e=>({loading:e.viewerLoading,errorPrefix:e.viewerErrorPrefix,styleTitle:e.viewerStyleTitle,selectStyleAria:e.viewerSelectStyle,pinStyleAria:e.viewerPinStyle,unpinStyleAria:e.viewerUnpinStyle,defaultErrorTitle:e.viewerErrorTitle,missingImage:e.viewerMissingImage,openTocAria:e.viewerOpenToc,tocTitle:e.viewerTocTitle,pinTocAria:e.viewerPinToc,unpinTocAria:e.viewerUnpinToc,selectAlignAria:e.viewerSelectAlign,alignTitle:e.viewerAlignTitle,pinAlignAria:e.viewerPinAlign,unpinAlignAria:e.viewerUnpinAlign,alignLeft:e.viewerAlignLeft,alignCenter:e.viewerAlignCenter,alignRight:e.viewerAlignRight,mermaidInteractionMode:e.viewerMermaidInteractionMode,mermaidModeNone:e.viewerMermaidModeNone,mermaidModeZoom:e.viewerMermaidModeZoom,mermaidModePan:e.viewerMermaidModePan,mermaidModePanShift:e.viewerMermaidModePanShift,mermaidModeBoth:e.viewerMermaidModeBoth,mermaidModeBothShift:e.viewerMermaidModeBothShift,mermaidZoomIn:e.viewerMermaidZoomIn,mermaidZoomOut:e.viewerMermaidZoomOut,mermaidResetView:e.viewerMermaidResetView,mermaidRetry:e.viewerMermaidRetry,embeddedVideo:e.viewerEmbeddedVideo,embeddedPost:e.viewerEmbeddedPost,embeddedFrame:e.viewerEmbeddedFrame}),sn=(e,t,n)=>{if(t!==void 0)return t;if(n!==void 0)return n;const[r]=e.documentStyles;if(r===void 0)throw new Error("[markdown-explorer] the configuration has no document style");return r.name},ln=(e,t)=>e!==void 0?e:t!==void 0?t:bn.DEFAULT_CONTENT_ALIGN,Ye=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),ao=(e,t,n)=>{if(t.view==="multi"||t.overrides[n]===void 0)return null;const r=n==="style"?{align:t.overrides.align}:{style:t.overrides.style};return I.explorerHref(e,{...t,overrides:r})},Qe=({kind:e,view:t,label:n,stale:r,busy:o,frameRef:s,intent:a,children:u})=>{const w=i.use(ie);return l.jsxs("section",{ref:s,role:"region","aria-label":n,"aria-busy":o,"data-testid":"markdown-explorer-document","data-aqmx-document-kind":e,"data-aqmx-document-view":t,"data-aqmx-document-flow":w,className:"aqmx-document",...a,children:[r?l.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,u]})},co=()=>{const{labels:e}=P();return l.jsx(Qe,{kind:"empty",label:e.documentRegion,stale:!1,busy:!1,children:l.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-document-empty",children:l.jsx("p",{className:"aqmx-empty-title",children:e.documentEmpty})})})},an=({label:e})=>{const{labels:t}=P();return l.jsxs(Qe,{kind:"loading",label:e,stale:!1,busy:!0,children:[l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-document-skeleton",children:Ye.map(n=>l.jsx("span",{},n))}),l.jsx("p",{className:"aqmx-sr-only",children:t.documentLoading})]})},pt=Object.freeze(["wheel","touchstart","pointerdown","keydown"]),uo=({path:e,document:t,viewer:n,editing:r})=>{const{reportMathDiagnostics:o,edits:s}=P(),a=i.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),u=Wr(),w=Xr(),m=i.useMemo(()=>o===void 0?void 0:g=>o(e,g),[o,e]),f=i.useRef(null),{editable:p,doubleClick:h,region:y,paneScroll:C,stale:b}=r;i.useLayoutEffect(()=>{if(p)return s.bindView(e,{anchor:()=>{const g=f.current,x=y(),k=g===null?null:g.querySelector(Re);return g===null||x===null||k===null?null:Xn(g,C.scrollerOf(x,k))}})},[s,e,p,y,C]);const L=g=>{const x=f.current,{target:k}=g;!h||x===null||!(k instanceof Element)||!Kn(k)||(g.stopPropagation(),s.start(e,Wn(k,x,x.ownerDocument.getSelection())))},R=i.useRef(null),M=i.useRef(b);i.useLayoutEffect(()=>{M.current=b});const c=i.useEffectEvent(g=>{const x=f.current,k=y(),j=x===null?null:zt(x,g.line);if(k===null||j===null)return!1;const T=C.scrollerOf(k,j);return T.scrollTop+=Zt(j,g.line)-g.clientTop,!0}),d=i.useEffectEvent(g=>{const x=y();if(x===null)return;const k=()=>{for(const T of pt)x.removeEventListener(T,j,!0);R.current?.release===k&&(R.current=null)},j=()=>k();for(const T of pt)x.addEventListener(T,j,{capture:!0,passive:!0});R.current={point:g,release:k}});return i.useLayoutEffect(()=>{const g=s.takeReturn(e);if(g!==null)return queueMicrotask(()=>{c(g)&&M.current&&d(g)}),()=>R.current?.release()},[s,e]),i.useLayoutEffect(()=>{const g=R.current;g===null||b||(g.release(),c(g.point))},[t,b]),l.jsx("div",{ref:f,className:"aqmx-document-viewer",onDoubleClick:L,children:l.jsx(de.MarkdownViewer,{...n,onHeadingSelect:u,headingHref:w,onMathDiagnostics:m,parseResult:a,content:null})})},cn=({document:e,viewer:t})=>{const{labels:n}=P();return l.jsxs(l.Fragment,{children:[l.jsx(ke,{name:e.name,url:e.url,icon:l.jsx(In,{})}),e.truncated?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-text-truncated",children:n.textTruncated}):null,l.jsx("div",{className:"aqmx-document-viewer",children:l.jsx(de.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},fo=({path:e,name:t,viewer:n})=>{const{data:r,documents:o,announcer:s,labels:a}=P(),u=i.useCallback(()=>o.answerStampOf(e),[o,e]),w=i.useSyncExternalStore(o.subscribe,u,u),[m,f]=i.useState(0),p=i.useMemo(()=>({path:e,stamp:w,attempt:m}),[e,w,m]),[h,y]=i.useState(null),C=i.useEffectEvent(L=>{y(L),L.kind==="failure"&&s.announce(a.documentFailed(t,te(a,L.failure.reason)))});i.useEffect(()=>{const L=new AbortController;return r.text(p.path,L.signal).then(R=>{"kind"in R&&C(R)}),()=>L.abort()},[r,p]);const b=i.useCallback(()=>f(L=>L+1),[]);return h===null?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-markup-skeleton",children:Ye.map(L=>l.jsx("span",{},L))}),l.jsx("p",{className:"aqmx-sr-only",children:a.markupLoading})]}):h.kind==="failure"?l.jsx(ge,{scrollerProps:dn,children:l.jsx(le,{failure:h.failure,alert:!1,onRetry:b,testId:"markdown-explorer-markup-failure"})}):l.jsx(cn,{document:h,viewer:n})},dn=Object.freeze({className:"aqmx-document-failure","data-aqmx-document-scroller":""}),mo=Object.freeze({reason:"failed"}),ho=e=>l.jsx(Hn,{fallback:t=>l.jsx("div",{className:"aqmx-edit-message",children:l.jsx(le,{failure:mo,alert:!1,onRetry:t,testId:"markdown-explorer-edit-load-failure"})}),children:l.jsx(i.Suspense,{fallback:l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-edit-skeleton",children:Ye.map(t=>l.jsx("span",{},t))}),children:l.jsx(Bn,{...e})})}),go=({path:e,document:t,view:n,viewer:r,onRetry:o,editing:s})=>{switch(t.kind){case"markdown":{const{session:a,layout:u,region:w,paneScroll:m,stale:f}=s;if(n==="edit"&&a!==void 0)return l.jsx(ho,{path:e,name:t.name,session:a,layout:u,viewer:r,region:w,paneScroll:m});if(n==="markup")return l.jsx(fo,{path:e,name:t.name,viewer:r});const p=t.edit!==null&&t.edit.kind==="inline";return l.jsx(uo,{path:e,document:t,viewer:r,editing:{editable:p,doubleClick:p&&u==="fill",region:w,paneScroll:m,stale:f}})}case"text":return l.jsx(cn,{document:t,viewer:r});case"image":return l.jsx($r,{document:t});case"media":return l.jsx(lo,{document:t});case"file":return l.jsx(mr,{document:t});case"failure":return l.jsx(ge,{scrollerProps:dn,children:l.jsx(le,{failure:t.failure,alert:!1,onRetry:o,testId:"markdown-explorer-document-failure"})});default:{const a=t;throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(a)}`)}}},po='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',vo=(e,t,n)=>{const[r]=t.kind==="markdown"?t.headings:[],o=[n===null?null:tn(e,n),r===void 0?null:en(e,r.id),e.querySelector(Re),e.querySelector(po)];for(const s of o)if(s instanceof HTMLElement&&We(s))return s;return null},vt=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,s=r===null||r===o;t instanceof HTMLElement&&n&&(s||e.contains(r))&&We(t)},wo=e=>{const t=i.useRef(!1);return i.useLayoutEffect(()=>{const n=e.current;if(n===null)throw new Error("[markdown-explorer] the document region is not mounted");const r=n.ownerDocument,o=r.defaultView;if(o===null)throw new Error("[markdown-explorer] the document region's document has no window");let s=!1,a;const u=h=>{s=!(h.target instanceof Node&&n.contains(h.target)),s&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(a),a=setTimeout(()=>{s=!1},0)},w=h=>{t.current=h.target instanceof Node&&n.contains(h.target)},m=h=>{h.relatedTarget===null&&s&&(t.current=!1)},f=()=>{const{activeElement:h,body:y}=r;h!==null&&h!==y&&(t.current=n.contains(h))},p=()=>{s&&!n.contains(r.activeElement)&&(t.current=!1)};return o.addEventListener("pointerdown",u,!0),o.addEventListener("mousedown",u,!0),o.addEventListener("focusin",w,!0),o.addEventListener("blur",f),o.addEventListener("focus",p),n.addEventListener("focusout",m),()=>{clearTimeout(a),o.removeEventListener("pointerdown",u,!0),o.removeEventListener("mousedown",u,!0),o.removeEventListener("focusin",w,!0),o.removeEventListener("blur",f),o.removeEventListener("focus",p),n.removeEventListener("focusout",m)}},[e]),t},xo=({path:e,snapshot:t,markup:n,stale:r,viewer:o,editLayout:s,regionLabel:a,navigation:u,fragment:w,paneScroll:m,announces:f,announceFailure:p,onDocumentShown:h})=>{const{labels:y,announcer:C,documents:b}=P(),{document:L}=t,R=i.useRef(null),M=i.useRef(null),c=i.useRef(null),d=i.useRef(0),g=wo(R),x=i.useRef({path:e,document:L}),k=i.useRef(null),j=i.useCallback(H=>{const Z=R.current,W=ut(Z,H,m);Z!==null&&W!==null&&vt(Z,W,g.current)},[m,g]),T=i.useCallback((H,Z)=>{const W=d.current;setTimeout(()=>{!Z.defaultPrevented&&d.current===W&&j(H)},0)},[j]),D=i.useCallback(H=>{setTimeout(()=>{H.defaultPrevented||j("#")},0)},[j]),F=i.useMemo(()=>({navigation:u,currentPath:e,scrollWithin:j,followSameUrlJump:T,followEmptyFragment:D}),[u,e,j,T,D]),V=i.useCallback(()=>b.retry(e),[b,e]),K=Gt(b,Hr),X=$t(e),G=X!==void 0?"edit":n?"markup":"rendered",_=L.kind==="markdown"?G:void 0,z=i.useCallback(()=>R.current,[]),v=i.useMemo(()=>({session:X,layout:s,region:z,paneScroll:m,stale:r}),[X,s,z,m,r]),E=_==="edit"?!1:r,O=i.use(ie),A=_==="edit"&&s==="fill"?"fill":O,$=i.useEffectEvent((H,Z)=>{const W=M.current;if(W!==null&&W.path===H&&W.snapshot===Z)return;M.current={path:H,snapshot:Z};const Q=Z.document;if(Q.kind==="failure"){b.noteFailureShown(Z)&&p(y.documentFailed(N.lastPathSegment(H),te(y,Q.failure.reason)));return}h?.(H,Q),f&&(W===null||W.path!==H||W.snapshot.document.kind==="failure")&&C.announce(y.documentShown(Q.name))});i.useEffect(()=>{$(e,t)},[e,t]);const q=i.useEffectEvent(()=>{w.kind==="panel"&&w.consume()}),U=i.useEffectEvent(H=>{const Z=R.current;if(Z===null||!g.current)return null;const{activeElement:W,body:Q}=Z.ownerDocument;return W!==null&&W!==Q?null:vo(Z,L,H)}),B=i.useEffectEvent(H=>{const Z=R.current;Z!==null&&vt(Z,H,g.current)}),ee=i.useEffectEvent(H=>m.reveal(H)),et=i.useEffectEvent(H=>ut(R.current,H,m));return i.useEffect(()=>{if(r)return;const H=x.current.path!==e,Z=H||x.current.document!==L;x.current={path:e,document:L};const W=k.current!==e;k.current=e;let Q=null;w.kind==="page"?c.current!==w.navigation&&(c.current=w.navigation,d.current+=1,Q=w.fragment):w.fragment!==null&&(Q=w.fragment,q());const tt=()=>{const Ae=Q===null?null:et(Q);if(!Z){Ae!==null&&B(Ae);return}const nt=U(w.fragment);H&&Ae===null&&nt!==null&&ee(nt)};W?queueMicrotask(tt):tt()},[w,e,L,r]),l.jsx(ie,{value:A,children:l.jsx(Qe,{kind:L.kind,view:_,label:a(e,L),stale:E,busy:E,frameRef:R,intent:K,children:l.jsx(rn,{value:F,children:l.jsx(Ir,{children:l.jsx(go,{path:e,document:L,view:G,viewer:o,onRetry:V,editing:v},e)})})})})},Je=Object.freeze({kind:"skeleton"}),Eo=(e,t,n,r,o)=>{if(t?.status==="loaded")return{kind:"document",path:e,snapshot:t,stale:!1};const s=oe(t);if(s!==null)return{kind:"document",path:e,snapshot:s,stale:!0};if(o&&t?.status==="pending")return{kind:"streaming",path:e,promise:t.promise};const a=n===null||n===e?null:oe(r);return n===null||a===null?Je:{kind:"document",path:n,snapshot:a,stale:!0}},bo=(e,t)=>t.status==="deferred"?Je:{kind:"document",path:e,snapshot:t,stale:!1},So=({requestedPath:e,content:t,markup:n,...r})=>{const o=t.kind==="streaming"?bo(t.path,i.use(t.promise)):t;return o.kind!=="document"?l.jsx(an,{label:r.regionLabel(e,null)}):l.jsx(xo,{path:o.path,snapshot:o.snapshot,markup:n,stale:o.stale,...r})},un=({path:e,markup:t,display:n,navigation:r,fragment:o,paneScroll:s,announces:a,announceFailure:u,onDocumentShown:w})=>{const{config:m,labels:f,theme:p,documents:h}=P(),y=de.useMarkdownToolbarState(),C=i.useRef(!1);i.useLayoutEffect(()=>{C.current=!0},[]);const[b,L]=i.useState(null),[R,M]=i.useState(t),c=i.useCallback(()=>e===null?void 0:h.peek(e),[h,e]),d=i.useSyncExternalStore(h.subscribe,c,c),g=i.useCallback(()=>b===null?void 0:h.peek(b),[h,b]),x=i.useSyncExternalStore(h.subscribe,g,g);i.useLayoutEffect(()=>e===null?void 0:h.open(e),[h,e]),i.useLayoutEffect(()=>b===null?void 0:h.retain(b),[h,b]);const k=e===null?Je:Eo(e,d,b,x,!C.current),j=e===null?null:k.kind==="document"&&!k.stale?k.path:b;j!==b&&L(j);const T=k.kind!=="document"||k.path===e;T&&t!==R&&M(t);const D=i.useMemo(()=>io(f),[f]),F=i.useMemo(()=>[...m.iframeHosts],[m]),V=r.kind==="panel",K=i.useMemo(()=>({labels:D,emptyMessage:f.documentEmpty,theme:p,availableStyles:m.documentStyles,iFrameAllowedDomains:F,embeds:m.embeds,linkComponent:Kr,toolbar:y,style:n.style,onStyleChange:n.onStyleChange,align:n.align,onAlignChange:n.onAlignChange,showToc:n.showToc,showStyle:n.showStyle,showAlign:n.showAlign,padding:n.padding,width:n.width===void 0?void 0:`min(${n.width}, 100%)`,maxWidth:n.maxWidth===void 0?void 0:`min(${n.maxWidth}, 100%)`,renderScrollBar:V?void 0:Wt}),[D,f.documentEmpty,p,m.documentStyles,F,m.embeds,y,n,V]),X=i.useCallback((_,z)=>V?z===null||z.kind==="failure"?N.lastPathSegment(_):z.name:f.documentRegion,[V,f.documentRegion]),G=V?"content":"fill";return e===null?l.jsx(ie,{value:G,children:l.jsx(co,{})}):l.jsx(ie,{value:G,children:l.jsx(i.Suspense,{fallback:l.jsx(an,{label:X(e,null)}),children:l.jsx(So,{requestedPath:e,content:k,markup:T?t:R,viewer:K,editLayout:n.editLayout,regionLabel:X,navigation:r,fragment:o,paneScroll:s,announces:a,announceFailure:u,onDocumentShown:w})})})},yo=({path:e,markup:t,variant:n,onDocumentShown:r})=>{const{config:o,viewSettings:s,announcer:a}=P(),u=ue(j=>j.style),w=ue(j=>j.align),m=he(),f=Y.useLocation(),p=ye(),{view:h,overrides:y,embed:C}=n,b=i.useCallback(j=>{if(p.kind!=="location")return;const T=ao(o,p.location,j);T!==null&&m(T,"browse")},[o,m,p]),L=i.useCallback(j=>{s.update({style:j}),b("style")},[s,b]),R=i.useCallback(j=>{s.update({align:j}),b("align")},[s,b]),M=sn(o,y.style,u),c=ln(y.align,w),d=i.useMemo(()=>({style:M,onStyleChange:L,align:c,onAlignChange:R,showToc:C.showToc!==!1,showStyle:C.showStyle!==!1,showAlign:C.showAlign!==!1,padding:C.padding,width:C.width,maxWidth:C.maxWidth,editLayout:"fill"}),[M,L,c,R,C]),g=i.useMemo(()=>({kind:"page",view:h,overrides:y,embed:C}),[h,y,C]),x=i.useMemo(()=>({kind:"page",fragment:f.hash,navigation:f}),[f]),k=i.useCallback(j=>a.announce(j),[a]);return l.jsx(un,{path:e,markup:t,display:d,navigation:g,fragment:x,paneScroll:Er,announces:!0,announceFailure:k,onDocumentShown:r})},ko=({path:e,markup:t,variant:n,onDocumentShown:r})=>{const{config:o,viewSettings:s}=P(),a=ue(g=>g.style),u=ue(g=>g.align),[w,m]=i.useState(()=>sn(o,void 0,a)),f=ln(void 0,u),p=i.useCallback(g=>s.update({align:g}),[s]),{maximized:h,onDocumentLink:y,pendingHash:C,onHashConsumed:b,announceFailure:L,paneScroll:R}=n,M=i.useMemo(()=>({style:w,onStyleChange:m,align:f,onAlignChange:p,showToc:h,showStyle:h,showAlign:h,padding:void 0,width:void 0,maxWidth:void 0,editLayout:h?"fill":"content"}),[w,f,p,h]),c=i.useMemo(()=>({kind:"panel",onDocumentLink:y}),[y]),d=i.useMemo(()=>({kind:"panel",fragment:C,consume:b}),[C,b]);return l.jsx(un,{path:e,markup:t,display:M,navigation:c,fragment:d,paneScroll:R,announces:!1,announceFailure:L,onDocumentShown:r})},fn=({path:e,markup:t,variant:n,onDocumentShown:r})=>n.kind==="page"?l.jsx(yo,{path:e,markup:t,variant:n,onDocumentShown:r}):l.jsx(ko,{path:e,markup:t,variant:n,onDocumentShown:r});function Ro({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",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",clipRule:"evenodd"}))}const mn=S.forwardRef(Ro);function To({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",d:"M14.447 3.026a.75.75 0 0 1 .527.921l-4.5 16.5a.75.75 0 0 1-1.448-.394l4.5-16.5a.75.75 0 0 1 .921-.527ZM16.72 6.22a.75.75 0 0 1 1.06 0l5.25 5.25a.75.75 0 0 1 0 1.06l-5.25 5.25a.75.75 0 1 1-1.06-1.06L21.44 12l-4.72-4.72a.75.75 0 0 1 0-1.06Zm-9.44 0a.75.75 0 0 1 0 1.06L2.56 12l4.72 4.72a.75.75 0 0 1-1.06 1.06L.97 12.53a.75.75 0 0 1 0-1.06l5.25-5.25a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Lo=S.forwardRef(To);function Oo({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",d:"M15.75 2.25H21a.75.75 0 0 1 .75.75v5.25a.75.75 0 0 1-1.5 0V4.81L8.03 17.03a.75.75 0 0 1-1.06-1.06L19.19 3.75h-3.44a.75.75 0 0 1 0-1.5Zm-10.5 4.5a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h10.5a1.5 1.5 0 0 0 1.5-1.5V10.5a.75.75 0 0 1 1.5 0v8.25a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h8.25a.75.75 0 0 1 0 1.5H5.25Z",clipRule:"evenodd"}))}const Co=S.forwardRef(Oo);function Ao({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",d:"M11.47 13.28a.75.75 0 0 0 1.06 0l7.5-7.5a.75.75 0 0 0-1.06-1.06L12 11.69 5.03 4.72a.75.75 0 0 0-1.06 1.06l7.5 7.5Z",clipRule:"evenodd"}),S.createElement("path",{fillRule:"evenodd",d:"M11.47 19.28a.75.75 0 0 0 1.06 0l7.5-7.5a.75.75 0 1 0-1.06-1.06L12 17.69l-6.97-6.97a.75.75 0 0 0-1.06 1.06l7.5 7.5Z",clipRule:"evenodd"}))}const jo=S.forwardRef(Ao);function Mo({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-3.75V6Z",clipRule:"evenodd"}))}const No=S.forwardRef(Mo);function Do({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{fillRule:"evenodd",d:"M9 1.5H5.625c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5Zm6.61 10.936a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 14.47a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"}),S.createElement("path",{d:"M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"}))}const Po=S.forwardRef(Do);function _o({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),S.createElement("path",{fillRule:"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",clipRule:"evenodd"}))}const hn=S.forwardRef(_o);function Fo({title:e,titleId:t,...n},r){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?S.createElement("title",{id:t},e):null,S.createElement("path",{d:"M21.731 2.269a2.625 2.625 0 0 0-3.712 0l-1.157 1.157 3.712 3.712 1.157-1.157a2.625 2.625 0 0 0 0-3.712ZM19.513 8.199l-3.712-3.712-8.4 8.4a5.25 5.25 0 0 0-1.32 2.214l-.8 2.685a.75.75 0 0 0 .933.933l2.685-.8a5.25 5.25 0 0 0 2.214-1.32l8.4-8.4Z"}),S.createElement("path",{d:"M5.25 5.25a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h10.5a3 3 0 0 0 3-3V13.5a.75.75 0 0 0-1.5 0v5.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5V8.25a1.5 1.5 0 0 1 1.5-1.5h5.25a.75.75 0 0 0 0-1.5H5.25Z"}))}const $o=S.forwardRef(Fo),gn=({href:e,onRetry:t,testId:n})=>{const{labels:r,onEditGrant:o}=P(),[s,a]=i.useState(!1),u=()=>{o===void 0||s||(a(!0),o(e).then(w=>{w&&t()}).finally(()=>a(!1)))};return l.jsxs("div",{className:"aqmx-callout aqmx-edit-grant","data-testid":n,children:[l.jsx("p",{className:"aqmx-callout-title",children:r.editGrantTitle}),l.jsx("p",{className:"aqmx-callout-body",children:r.editGrantBody}),l.jsxs("div",{className:"aqmx-edit-grant-actions",children:[o===void 0?l.jsx("a",{className:"aqmx-callout-action",href:e,target:"_blank",rel:"noopener","data-testid":`${n}-open`,children:r.editGrantAction}):l.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":s,"data-testid":`${n}-open`,onClick:u,children:r.editGrantAction}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":`${n}-retry`,onClick:t,children:r.editGrantRetry})]})]})},wt=(e,t,n)=>{const r=e.modifiedAt===null?Number.NaN:Date.parse(e.modifiedAt);return n(Number.isNaN(r)?e.id:t.format(r),e.author===null?"":e.author)},qo=({path:e,documentName:t,open:n,onClose:r})=>{const{data:o,edits:s,labels:a,locale:u,announcer:w}=P(),m=i.useRef(null),f=i.useRef(null),p=i.useId(),[h,y]=i.useState(null),[C,b]=i.useState(0),[L,R]=i.useState(null),[M,c]=i.useState(null),d=i.useMemo(()=>new Intl.DateTimeFormat(u,{dateStyle:"medium",timeStyle:"short"}),[u]);i.useLayoutEffect(()=>{const T=m.current;if(T!==null)if(n&&!T.open){const D=T.ownerDocument.activeElement;f.current=D instanceof HTMLElement?D:null,R(null),c(null),T.showModal()}else!n&&T.open&&(T.close(),f.current?.isConnected===!0&&f.current.focus(),f.current=null)},[n]),i.useEffect(()=>{if(!n)return;const T=new AbortController;return y(null),o.revisions(e,T.signal).then(D=>{"kind"in D&&y(D)}),()=>T.abort()},[n,o,e,C]),i.useEffect(()=>{if(!n||L===null)return;const T=new AbortController;return c(null),o.revision(e,L,T.signal).then(D=>{"kind"in D&&c(D)}),()=>T.abort()},[n,o,e,L]);const g=()=>{M===null||M.kind!=="revision"||(s.replaceDraft(e,M.text),w.announce(a.historyRestored(t)),r())},x=T=>{T.key!=="Escape"||T.defaultPrevented||(Ve(T),r())},k=T=>{T.target===T.currentTarget&&r()},j=h!==null&&h.kind==="revisions"?h.revisions.find(T=>T.id===L):void 0;return l.jsx("dialog",{ref:m,className:"aqmx-confirm aqmx-history","aria-labelledby":p,"data-testid":"markdown-explorer-history",onKeyDown:x,onClick:k,onCancel:T=>T.preventDefault(),children:l.jsxs("div",{className:"aqmx-confirm-panel aqmx-history-panel",children:[l.jsx("p",{id:p,className:"aqmx-confirm-title",children:a.historyTitle(t)}),h===null?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-loading",children:a.historyLoading}):h.kind==="failure"?l.jsx(le,{failure:h.failure,alert:!1,onRetry:()=>b(T=>T+1),testId:"markdown-explorer-history-failure"}):h.revisions.length===0?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-empty",children:a.historyEmpty}):l.jsx("ul",{className:"aqmx-history-list","data-testid":"markdown-explorer-history-list",children:h.revisions.map(T=>l.jsx("li",{children:l.jsxs("button",{type:"button",className:"aqmx-history-entry","aria-pressed":T.id===L,"data-testid":"markdown-explorer-history-entry",onClick:()=>R(T.id),children:[l.jsx("span",{children:wt(T,d,a.historyEntry)}),T.current?l.jsx("span",{className:"aqmx-history-mark",children:a.historyCurrent}):null,T.kept?l.jsx("span",{className:"aqmx-history-mark",children:a.historyKept}):null]})},T.id))}),L===null?null:M===null?l.jsx("p",{className:"aqmx-history-note",children:a.historyLoading}):M.kind==="failure"?l.jsx(le,{failure:M.failure,alert:!1,testId:"markdown-explorer-history-revision-failure"}):l.jsx("section",{className:"aqmx-history-text",tabIndex:0,"aria-label":j===void 0?a.historyTitle(t):wt(j,d,a.historyEntry),"data-testid":"markdown-explorer-history-text",children:l.jsx("pre",{children:M.text})}),l.jsxs("div",{className:"aqmx-confirm-actions",children:[l.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":"markdown-explorer-history-close",onClick:r,children:a.historyClose}),l.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":M===null||M.kind!=="revision","data-testid":"markdown-explorer-history-restore",onClick:g,children:a.historyRestore})]})]})})},Io=e=>{const{documents:t}=P(),n=i.useCallback(()=>t.peek(e),[t,e]),r=i.useCallback(()=>t.peekSeeded(e),[t,e]),o=i.useSyncExternalStore(t.subscribe,n,r),s=oe(o)?.document;return s===void 0||s.kind==="failure"?{edit:null,name:N.lastPathSegment(e)}:{edit:s.kind==="markdown"?s.edit:null,name:s.name}},ne=e=>{e.stopPropagation()},Bo=({path:e,documentName:t,iconOnly:n})=>{const{edits:r,labels:o}=P(),s=i.useSyncExternalStore(r.subscribe,()=>r.session(e)!==void 0,()=>!1),[a,u]=i.useState(!1),w=()=>{if(!s){r.start(e,r.viewAnchor(e));return}r.flush(e),r.session(e)?.dirty===!0?u(!0):r.close(e)},m=n?o.editDocumentNamed(t):null;return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:m===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:s?o.closeEditor:m===null?o.editDocument:m,"aria-label":m===null?void 0:m,"aria-pressed":s,"data-testid":"markdown-explorer-document-edit",onClick:w,onDoubleClick:ne,onPointerEnter:lt,onFocus:lt,children:[l.jsx($o,{"aria-hidden":"true"}),m===null?l.jsx("span",{children:o.editDocumentLabel}):null]}),l.jsx(Ft,{open:a,title:o.unsavedTitle,body:o.unsavedBody(t),confirmLabel:o.unsavedDiscard,cancelLabel:o.unsavedStay,testId:"markdown-explorer-edit-close-confirm",onConfirm:()=>{u(!1),r.close(e)},onCancel:()=>u(!1)})]})},Ho=({href:e,documentName:t,iconOnly:n})=>{const{labels:r}=P(),o=n?r.editExternallyNamed(t):null;return l.jsxs("a",{className:o===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",href:e,target:"_blank",rel:"noopener noreferrer",title:o===null?r.editExternally:o,"aria-label":o===null?void 0:o,"data-testid":"markdown-explorer-document-edit-external",onDoubleClick:ne,children:[l.jsx(Co,{"aria-hidden":"true"}),o===null?l.jsx("span",{children:r.editExternallyLabel}):null]})},Uo=({session:e})=>{const{labels:t}=P(),n=Cn(t,e);return l.jsx("p",{className:"aqmx-edit-status",title:n===""?void 0:n,"data-testid":"markdown-explorer-edit-status","data-aqmx-save":e.save.kind,children:n})},zo=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{edits:s,labels:a}=P(),u=It(),[w,m]=i.useState(!1);if(r.phase.kind!=="editing")return null;const f=r.save.kind==="saving",p=f||!r.dirty,h=()=>{s.flush(e);const C=s.session(e);C===void 0||!C.dirty||C.save.kind==="saving"||s.save(e)},y=C=>n?{className:"aqmx-icon-button","aria-label":C}:{className:"aqmx-icon-button aqmx-labelled-button"};return l.jsxs(l.Fragment,{children:[r.save.kind==="conflicts"?l.jsxs("button",{type:"button",...y(a.conflictNext),title:a.conflictNext,"data-testid":"markdown-explorer-edit-next-conflict",onClick:()=>s.nextConflict(e),onDoubleClick:ne,children:[l.jsx(jo,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.conflictNext})]}):null,o?l.jsxs("button",{type:"button",...y(a.previewToggle),title:a.previewToggle,"aria-pressed":u,"data-testid":"markdown-explorer-edit-preview-toggle",onClick:()=>s.setPreviewShown(!u),onDoubleClick:ne,children:[l.jsx(hn,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.previewToggle})]}):null,r.history?l.jsxs("button",{type:"button",...y(a.historyOpen),title:a.historyOpen,"aria-haspopup":"dialog","data-testid":"markdown-explorer-edit-history",onClick:()=>m(!0),onDoubleClick:ne,children:[l.jsx(No,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.historyOpen})]}):null,l.jsxs("button",{type:"button",...y(a.saveDraft),title:a.saveDraftTooltip,"aria-disabled":p,"aria-busy":f,"aria-keyshortcuts":"Control+S Meta+S","data-testid":"markdown-explorer-edit-save",onClick:h,onDoubleClick:ne,children:[l.jsx(Po,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.saveDraft})]}),r.history?l.jsx(qo,{path:e,documentName:t,open:w,onClose:()=>m(!1)}):null]})},Zo=({path:e,session:t})=>{const{edits:n}=P();return t.save.kind!=="grant"?null:l.jsx(gn,{href:t.save.href,onRetry:()=>{n.save(e)},testId:"markdown-explorer-save-grant"})},Vo=e=>{const{documents:t}=P(),n=i.useCallback(()=>t.peek(e),[t,e]),r=i.useCallback(()=>t.peekSeeded(e),[t,e]),o=i.useSyncExternalStore(t.subscribe,n,r);return oe(o)?.document.kind==="markdown"},pn=e=>{const{config:t}=P(),n=he(),r=i.useCallback(()=>n(I.explorerHref(t,{...e,markup:!e.markup}),"browse"),[t,n,e]);return i.useMemo(()=>({shown:e.markup,toggle:r}),[e.markup,r])},Go=new Set,Ko=(e,t)=>{const{documents:n,announcer:r,labels:o}=P(),s=i.useCallback(()=>n.peek(e),[n,e]),a=i.useCallback(()=>n.peekSeeded(e),[n,e]),u=i.useSyncExternalStore(n.subscribe,s,a),w=i.useCallback(()=>n.answerStampOf(e),[n,e]),m=i.useSyncExternalStore(n.subscribe,w,w),[f]=i.useState(()=>new Set),[p,h]=i.useState(Go),[y,C]=i.useState(null);y!==null&&y.path!==e&&C(null);const b=i.useRef(null);i.useLayoutEffect(()=>(b.current=e,()=>{b.current=null}),[e]);const L=i.useCallback(()=>{const c=e,d=n.peek(c);if(f.has(c)||d?.status==="pending")return;const g=t&&!Qt(d);f.add(c),h(new Set(f)),C(null),(async()=>{try{const x=await n.refresh(c);if(b.current!==c||x.status==="superseded")return;if(x.status==="failed"){C({path:c,failure:x.failure,stamp:n.answerStampOf(c)}),r.announce(o.documentRefreshFailed(te(o,x.failure.reason)));return}const k=oe(n.peek(c));if(g||k===null||k.document.kind==="failure")return;r.announce(o.documentRefreshed(k.document.name))}finally{f.delete(c),h(new Set(f))}})()},[e,t,f,n,r,o]),R=p.has(e),M=y!==null&&y.path===e&&y.stamp===m?y.failure:null;return{refreshing:R,unavailable:R||u?.status==="pending",failure:M,refresh:L}},vn=Object.freeze({kind:"page"}),wn=({path:e,placement:t,markup:n})=>{const{labels:r}=P(),{refreshing:o,unavailable:s,failure:a,refresh:u}=Ko(e,t.kind==="page"),w=Vo(e),m=Io(e),f=$t(e),p=t.kind==="panel"?r.refreshDocumentNamed(t.documentName):null,h=t.kind==="panel"?r.showMarkupNamed(t.documentName):null,y=t.kind==="panel",C=t.kind==="panel"?t.documentName:m.name,b=t.kind==="page"||t.maximized;return l.jsxs("div",{className:"aqmx-document-refresh-bar","data-testid":"markdown-explorer-document-refresh-bar","data-aqmx-editing":f===void 0?void 0:"true",children:[l.jsxs("div",{className:"aqmx-document-refresh-row",children:[f===void 0?null:l.jsx(Uo,{session:f}),f===void 0?null:l.jsx(zo,{path:e,documentName:C,iconOnly:y,session:f,previewAvailable:b}),f===void 0&&w?l.jsxs("button",{type:"button",className:h===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:h===null?r.showMarkup:h,"aria-label":h===null?void 0:h,"aria-pressed":n.shown,"data-testid":"markdown-explorer-document-markup",onClick:n.toggle,onDoubleClick:ne,children:[l.jsx(Lo,{"aria-hidden":"true"}),h===null?l.jsx("span",{children:r.showMarkupLabel}):null]}):null,f!==void 0||m.edit?.kind==="inline"?l.jsx(Bo,{path:e,documentName:C,iconOnly:y}):m.edit?.kind==="external"?l.jsx(Ho,{href:m.edit.href,documentName:C,iconOnly:y}):null,f===void 0?l.jsxs("button",{type:"button",className:p===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:p===null?r.refreshDocument:p,"aria-label":p===null?void 0:p,"aria-disabled":s,"aria-busy":o,"data-aqmx-busy":o?"true":void 0,"data-testid":"markdown-explorer-document-refresh",onClick:u,onDoubleClick:ne,children:[l.jsx(mn,{"aria-hidden":"true"}),p===null?l.jsx("span",{children:r.refreshDocumentLabel}):null]}):null]}),f!==void 0||a===null?null:l.jsx("p",{className:"aqmx-document-refresh-failure","data-testid":"markdown-explorer-document-refresh-failure","data-aqmx-failure":a.reason,children:r.documentRefreshFailed(te(r,a.reason))}),f===void 0?null:l.jsx(Zo,{path:e,session:f})]})},Wo=({location:e})=>{const t=e.doc,n=i.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]),r=pn(e);return l.jsxs("div",{className:"aqmx-single aqmx-document-column","data-testid":"markdown-explorer-single",children:[l.jsx(wn,{path:t,placement:vn,markup:r}),l.jsx(fn,{path:t,markup:e.markup,variant:n})]})},xn=({holds:e,testId:t})=>{const{labels:n,announcer:r}=P(),o=i.useId();i.useLayoutEffect(()=>e?r.claim(o):void 0,[e,r,o]);const s=i.useCallback(()=>r.shownIn(o),[r,o]),a=i.useSyncExternalStore(r.subscribe,s,s);return l.jsx("div",{className:"aqmx-sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":t,children:a.length>1?n.announcementSequence(a):a[0]})},se=Object.freeze([]),Xo=e=>{const t=new Set;let n=se,r=[],o=!1;const s=[],a=f=>{n=f;for(const p of[...t])p()},u=()=>s.at(-1)?.region,w=f=>{const p=u();f(),u()!==p&&n!==se&&a(se)},m=()=>{o=!1;const f=r.map(p=>"sentence"in p?p.sentence:p.list(p.items));r=[],a(Object.freeze(f))};return{announce:f=>{if(typeof f=="string")r.push({sentence:f});else{const p=r.find(h=>"list"in h&&h.list===f.list);p!==void 0&&"items"in p?p.items.push(f.item):r.push({list:f.list,items:[f.item]})}o||(o=!0,n!==se&&a(se),e.request(m))},subscribe:f=>(t.add(f),()=>{t.delete(f)}),claim:f=>{const p={region:f};return w(()=>s.push(p)),()=>w(()=>{const h=s.indexOf(p);h!==-1&&s.splice(h,1)})},shownIn:f=>u()===f?n:se}},ce=Object.freeze({status:"cancelled"}),Yo=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(N.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return N.failureOf(n,r)},Qo=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((m,f)=>globalThis.fetch(m,f)),o=(m,f)=>`${e}/${m}?${new URLSearchParams(f).toString()}`,s=async(m,f,p,h)=>{let y;try{y=await r(m,{credentials:"same-origin",...f,headers:{Accept:"application/json",...f.headers}})}catch{return h({reason:"failed"})}y.status===401&&t(null);const C=y.headers.get(N.EXPLORER_SCOPE_HEADER);C!==null&&t(C);let b;try{b=await y.json()}catch{return h({reason:N.failureReasonOfStatus(y.status)})}let L;try{L=p(b)}catch{L=!1}if(L)return b;const R=Yo(b);return h(R!==null?R:{reason:y.status===200?"failed":N.failureReasonOfStatus(y.status)})},a={[N.EXPLORER_PROOF_HEADER]:N.EXPLORER_REFRESH_PROOF},u={[N.EXPLORER_PROOF_HEADER]:N.EXPLORER_EDIT_PROOF,"Content-Type":`${N.EXPLORER_DRAFT_MEDIA_TYPE}; charset=utf-8`},w=async(m,f,p)=>{const h=await s(m,f,p,y=>N.failureDocument(y.reason,y.code));return f.signal.aborted?ce:h};return{tree:m=>s(o("tree",{[N.EXPLORER_DATA_QUERY.source]:m}),{method:"GET"},N.isExplorerTreeResult,f=>({status:"error",failure:f})),children:async(m,f,p)=>{const h=await s(o("children",{[N.EXPLORER_DATA_QUERY.source]:m,[N.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:p},N.isExplorerChildrenResult,y=>({status:"error",failure:y}));return p.aborted?ce:h},ancestors:async(m,f,p)=>{const h=await s(o("ancestors",{[N.EXPLORER_DATA_QUERY.source]:m,[N.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:p},N.isExplorerAncestorsResult,y=>({status:"error",failure:y}));return p.aborted?ce:h},reveal:async(m,f,p)=>{const h=await s(o("reveal",{[N.EXPLORER_DATA_QUERY.source]:m,[N.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:p},N.isExplorerRevealResult,y=>({status:"error",failure:y}));return p.aborted?ce:h},document:(m,{refresh:f})=>s(o("document",{[N.EXPLORER_DATA_QUERY.path]:m}),f?{method:"GET",headers:a}:{method:"GET"},N.isExplorerDocument,p=>N.failureDocument(p.reason,p.code)),text:async(m,f)=>{const p=await s(o("text",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:f},N.isExplorerTextAnswer,h=>N.failureDocument(h.reason,h.code));return f.aborted?ce:p},edit:(m,f)=>w(o("edit",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:f},N.isExplorerEditAnswer),save:(m,f,p,h)=>w(o("save",{[N.EXPLORER_DATA_QUERY.path]:m,[N.EXPLORER_DATA_QUERY.base]:f}),{method:"POST",headers:u,body:p,signal:h},N.isExplorerSaveAnswer),preview:(m,f,p)=>w(o("preview",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"POST",headers:u,body:f,signal:p},N.isExplorerPreviewAnswer),revisions:(m,f)=>w(o("revisions",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:f},N.isExplorerRevisionsAnswer),revision:(m,f,p)=>w(o("revision",{[N.EXPLORER_DATA_QUERY.path]:m,[N.EXPLORER_DATA_QUERY.revision]:f}),{method:"GET",signal:p},N.isExplorerRevisionAnswer),refresh:m=>s(o("refresh",{[N.EXPLORER_DATA_QUERY.source]:m}),{method:"POST",headers:a},N.isExplorerTreeResult,f=>({status:"error",failure:f}))}},Jo=()=>{let e=null,t=null;return{settle:n=>{e=n},mayMove:n=>e!==n,move:(n,r,o)=>{e=r,t={sourceId:n,path:r,ancestors:o}},take:(n,r)=>{const o=t!==null&&t.sourceId===n&&t.path===r?t.ancestors:null;return t=null,o}}},es=e=>{const t=J.readStorage(e);if(t===null)return I.NO_TREE_SETTING_CHANGES;try{return I.readTreeSettingChanges(JSON.parse(t))}catch(n){return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`,n),I.NO_TREE_SETTING_CHANGES}},xt=(e,t)=>{let n=null;const r=()=>{if(n===null){const s=es(e);n={changes:s,settings:I.applyTreeSettingChanges(t,s)}}return n},o=ae();return{storageKey:e,defaults:t,getSnapshot:()=>r().settings,getServerSnapshot:()=>t,subscribe:o.subscribe,advance:s=>{const{changes:a,settings:u}=r(),w=I.recordTreeSettingChange(a,s,I.advanceTreeSetting(u,s)[s],t);return n={changes:w,settings:I.applyTreeSettingChanges(t,w)},o.emit(),J.writeStorage(e,I.serializeTreeSettingChanges(w)),n.settings}}},ts=Object.freeze({status:"refreshed"}),ns=Object.freeze({status:"superseded"}),ze=Object.freeze({status:"deferred"}),rs=Yt(ze),En=4,os=En-1,Et=Object.freeze({status:"loading"}),ss=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),ls=e=>{const t=new Map,n=Xt(),r=new Map,o=new Map,s=new Map,a=new Map,u=ae(),w=new Set;let m=0,f=0;const p={direct:null,bulk:null},h=new Set;let y=!1,C=0;const b=()=>{C+=1,u.emit()},L=v=>o.get(v)??0,R=v=>{let E=a.get(v);return E===void 0&&(E={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},a.set(v,E)),E},M=(v,E,O)=>{v.inFlight.delete(E),m-=1,O.lane==="bulk"&&(f-=1)},c=v=>{const E=a.get(v);if(E!==void 0){for(const[O,A]of[...E.inFlight])M(E,O,A),A.controller.abort();E.direct.clear(),E.bulk.clear(),E.unclaimed.clear()}},d=v=>{const E=L(v)+1;return o.set(v,E),c(v),E},g=(v,E)=>{const O=pe(v),A={promise:v,opened:E,stale:!1,loadedAt:O?.status==="ok"?O.loadedAt:null};return v.status==="pending"&&v.then($=>{$.status==="ok"&&(A.loadedAt=$.loadedAt)}),A},x=v=>{let E=r.get(v);return E===void 0&&(E=new Map,r.set(v,E)),E},k=v=>{const E=[...a.keys()],O=p[v],A=O===null?0:E.indexOf(O)+1;for(let $=0;$<E.length;$+=1){const q=E[(A+$)%E.length],U=q===void 0?void 0:a.get(q);if(!(q===void 0||U===void 0)){for(const B of U[v])if((U.claims.get(B)??0)!==0)return U[v].delete(B),p[v]=q,{sourceId:q,path:B}}}return null},j=(v,E,O,A)=>{const $=a.get(v);if($===void 0||$.inFlight.get(E)!==O)return;M($,E,O);const q=($.claims.get(E)??0)>0,U=x(v);if(A.status==="ok"?U.set(E,{status:"loaded",entries:A.entries}):A.status==="error"&&q?U.set(E,{status:"failed",failure:A.failure}):U.delete(E),b(),A.status==="error"&&q){const B={sourceId:v,path:E,failure:A.failure};for(const ee of[...w])ee(B)}D()},T=(v,E,O)=>{const A={controller:new AbortController,lane:O};R(v).inFlight.set(E,A),m+=1,O==="bulk"&&(f+=1),e.children(v,E,A.controller.signal).then($=>j(v,E,A,$),()=>j(v,E,A,ss))},D=()=>{for(;m<En;){const v=k("direct");if(v!==null){T(v.sourceId,v.path,"direct");continue}const E=f<os?k("bulk"):null;if(E===null)return;T(E.sourceId,E.path,"bulk")}},F=(v,E,O)=>{if(!(E.direct.delete(O)||E.bulk.delete(O))){const $=E.inFlight.get(O);if($===void 0)return!1;M(E,O,$),$.controller.abort()}return r.get(v)?.delete(O),!0},V=()=>{y=!1;let v=!1;for(const E of h){const O=R(E);for(const A of O.unclaimed)(O.claims.get(A)??0)===0&&F(E,O,A)&&(v=!0);O.unclaimed.clear()}h.clear(),v&&(b(),D())},K=(v,E)=>{t.set(v,g(me(e.tree(v)),E))},X=(v,E,O)=>{d(v);const A=g(Yt(E),O);return t.set(v,A),r.delete(v),b(),D(),A},G=(v,E,O,A)=>{if(O!==L(v)||t.get(v)!==E)return;const $=pe(E.promise);if(!(A.status!=="ok"||$?.status!=="ok"||E.loadedAt===null||A.loadedAt<=E.loadedAt)){if(be($.entries,A.entries)){E.loadedAt=A.loadedAt;return}X(v,A,E.opened)}},_=(v,E)=>{const O=t.get(v);return O!==void 0&&pe(O.promise)?.status===E},z=(v,E)=>{E.stale=!1;const O=L(v);e.tree(v).then(A=>G(v,E,O,A))};return{read:v=>t.get(v)?.promise??rs,open:v=>{const E=n.resumes(v),O=n.hold(v),A=t.get(v);return A===void 0||_(v,"deferred")?(K(v,!0),b()):E||(A.opened&&_(v,"error")?(K(v,!0),b()):(A.opened=!0,A.stale&&_(v,"ok")&&z(v,A))),O},retry:v=>{_(v,"error")&&(K(v,!0),b())},seed:(v,E)=>{const O=E.then(q=>q===null?ze:q,()=>ze),A=t.get(v);if(A!==void 0&&_(v,"ok")){const q=L(v);O.then(U=>G(v,A,q,U));return}d(v);const $=g(me(O),A?.opened===!0);t.set(v,$),r.delete(v),D(),O.then(q=>{t.get(v)===$&&(q.status==="deferred"&&n.isHeld(v)&&K(v,$.opened),b())})},refresh:async v=>{const E=(s.get(v)??0)+1;s.set(v,E);const O=await e.refresh(v);if(s.get(v)!==E)return ns;if(O.status==="error")return{status:"failed",failure:O.failure};const A=t.get(v);if(!(A!==void 0&&A.loadedAt!==null&&_(v,"ok")&&A.loadedAt>O.loadedAt)){const q=X(v,O,!0);if(A!==void 0&&A.promise.status==="pending"){const U=L(v);A.promise.then(B=>G(v,q,U,B))}}for(const[q,U]of t)q!==v&&pe(U.promise)?.status==="ok"&&(U.stale=!0);return ts},children:(v,E)=>r.get(v)?.get(E),claimChildren:(v,E)=>{const O=R(v),A=x(v);let $=!1,q=!1;for(const[B,ee]of E)O.claims.set(B,(O.claims.get(B)??0)+1),A.get(B)===void 0?(A.set(B,Et),O[ee].add(B),$=!0,q=!0):ee==="direct"&&O.bulk.delete(B)&&(O.direct.add(B),q=!0);$&&b(),q&&D();let U=!1;return()=>{if(!U){U=!0;for(const B of E.keys()){const ee=(O.claims.get(B)??0)-1;ee>0?O.claims.set(B,ee):(O.claims.delete(B),O.unclaimed.add(B))}h.add(v),!y&&(y=!0,queueMicrotask(V))}}},retryChildren:(v,E)=>{const O=r.get(v);if(O===void 0||O.get(E)?.status!=="failed")return;const A=R(v);if((A.claims.get(E)??0)>0){O.set(E,Et),A.direct.add(E),b(),D();return}O.delete(E),b()},pendingChildren:v=>{const E=a.get(v);return E===void 0?0:E.direct.size+E.bulk.size+E.inFlight.size},clear:()=>{for(const v of new Set([...t.keys(),...r.keys(),...o.keys(),...a.keys()]))d(v);for(const[v,E]of s)s.set(v,E+1);t.clear(),r.clear(),b()},subscribeChildrenFailures:v=>(w.add(v),()=>{w.delete(v)}),subscribe:u.subscribe,version:()=>C}},is=(e,t)=>{let n=e;const r=ae();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},as=1;let ve=0,re=null;const cs=()=>{const{documentElement:e,body:t}=document;ve===0&&(re={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"),ve+=1;let n=!1;return()=>{n||(n=!0,ve-=1,!(ve>0||re===null)&&(e.style.overflow=re.htmlOverflow,t.style.overflow=re.bodyOverflow,e.style.scrollbarGutter=re.htmlGutter,t.style.scrollbarGutter=re.bodyGutter,re=null))}},ds=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],bt=1,St=e=>e.getClientRects().length>0,Pe="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.",us=e=>{if(!St(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+as)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. ${Pe}`;if(t.height<bt)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. ${Pe}`;for(const{selector:r,name:o}of ds)for(const s of e.querySelectorAll(r)){if(!St(s))continue;const a=s.getBoundingClientRect().height;if(a<bt)return`[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(a))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Pe}`}return null},fs=e=>{let t=!1;const n=()=>{if(t)return;const o=us(e);o!==null&&(t=!0,console.error(o))},r=typeof ResizeObserver>"u"?null:new ResizeObserver(n);return r?.observe(e),window.addEventListener("resize",n),n(),()=>{r?.disconnect(),window.removeEventListener("resize",n)}},ms=(e,t)=>{i.useEffect(()=>e?cs():void 0,[e]),i.useEffect(()=>{const n=t.current;if(!(!e||n===null))return fs(n)},[e,t])},yt='[data-testid="markdown-explorer-view-switch"]',hs=[{control:yt,successors:[yt,'[data-testid="markdown-explorer-sheet-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],gs=e=>{for(const t of hs){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},ps=(e,t)=>{const n=i.useRef(null);i.useEffect(()=>{const o=u=>{const w=e.current;n.current=w!==null&&u instanceof Element&&w.contains(u)?gs(u):null},s=u=>o(u.target);o(document.activeElement);const a=u=>{const w=u.target;u.relatedTarget!==null||!(w instanceof Element)||queueMicrotask(()=>{n.current?.element===w&&w.isConnected&&document.activeElement!==w&&(n.current=null)})};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a)}},[e]);const r=i.useRef(t);i.useLayoutEffect(()=>{if(r.current===t)return;r.current=t;const o=n.current;if(o===null)return;const s=()=>{const w=document.activeElement;if(w!==null&&w!==document.body&&w!==o.element)return!0;const m=e.current;if(m===null)return!0;for(const f of o.control.successors)for(const p of m.querySelectorAll(f))if(p!==o.element&&(p.focus({preventScroll:!0}),document.activeElement===p))return!0;return!1};if(s())return;const a=e.current;if(a===null)return;const u=new MutationObserver(()=>{s()&&u.disconnect()});return u.observe(a,{childList:!0,subtree:!0}),()=>u.disconnect()},[t,e])},vs=i.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-uwvAgr-t.cjs")).then(e=>({default:e.TreeLayout}))),ws=i.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-CqTyFZ_i.cjs")).then(e=>({default:e.MultiLayout}))),xs=64,Es={request:e=>{requestAnimationFrame(e)}},kt=e=>{e.documents.clear(),e.trees.clear()},_e=(e,t)=>{t.tree!==null&&e.trees.seed(t.tree.sourceId,t.tree.result);for(const{path:n,document:r}of t.documents)e.documents.seed(n,r)},bs=(e,t)=>{const[n,r]=i.useState(()=>({overrides:t,locale:e,labels:Ie(e,t)}));if(n.locale===e&&Ln(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:Ie(e,t)};return r(o),o.labels},Ss=(e,t,n)=>{const[r,o]=i.useState(()=>({scope:t,store:xt(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const s={scope:t,store:xt(e,n)};return o(s),s.store},Fe=(e,t)=>{const[n,r]=i.useState(()=>({scope:e,value:t()}));if(n.scope===e)return n.value;const o={scope:e,value:t()};return r(o),o.value},ys=()=>Xo(Es),Rt="on",ks="off",Rs=(e,t)=>{const n=oe(e.peek(t));return n===null||n.document.kind==="failure"?N.lastPathSegment(t):n.document.name},Ts=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:s,renderFrame:a,renderTreeFailure:u,lockDocumentScroll:w=!1,onMathDiagnostics:m,onEditGrant:f})=>{J.assertStorageNamespace(n);const p=At(r),h=On(s),y=bs(p,o),{revalidate:C}=Y.useRevalidator(),b=i.useRef(()=>{}),L=Y.useHref(t.dataPath),[R]=i.useState(()=>{const _=Qo({dataPath:L,onScope:v=>b.current(v)}),z={documents:or({client:_,capacity:Math.max(xs,t.multiView.maxPanels*2)}),trees:ls(_)};return _e(z,e),J.syncStorageScope(n,e.scope),{data:_,...z,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(R.aligned.pageData!==e||R.aligned.storageNamespace!==n){const _=R.aligned.pageData;R.aligned.pageData=e,R.aligned.storageNamespace=n,_!==e&&(_.scope!==e.scope?R.aligned.pendingReader=e:_e(R,e)),J.syncStorageScope(n,e.scope)}const M=Ss(J.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);i.useLayoutEffect(()=>{const _=R.aligned.pendingReader;_!==null&&(R.aligned.pendingReader=null,kt(R),_e(R,_))},[e,R]),i.useLayoutEffect(()=>{let _=!1;return b.current=z=>{z===e.scope||_||(_=!0,z!==null&&(kt(R),J.clearExplorerStorage(n)),C())},()=>{b.current=()=>{}}},[e,C,R,n]);const c=i.useRef(t.settingsCookie);i.useLayoutEffect(()=>{c.current=t.settingsCookie},[t.settingsCookie]);const[d]=i.useState(()=>is(e.settings,_=>{document.cookie=I.viewSettingsCookieString(c.current,_,window.location.protocol==="https:")})),g=Fe(e.scope,ys),x=Fe(e.scope,Jo),k=i.useRef(y);i.useLayoutEffect(()=>{k.current=y},[y]);const j=Fe(e.scope,()=>Nn({data:R.data,conflictLabels:()=>({ours:k.current.conflictOurs,theirs:k.current.conflictTheirs}),onSaveSettled:(_,z)=>{z.kind==="saved"&&R.documents.refresh(_);const v=An(k.current,z,Rs(R.documents,_));v!==null&&g.announce(v)},previewSetting:{read:()=>J.readStorage(J.storageKeys(n).editPreview)===Rt,write:_=>J.writeStorage(J.storageKeys(n).editPreview,_?Rt:ks)}})),T=i.useMemo(()=>me(e.notices.catch(()=>[])),[e.notices]),D=e.sources.map(_=>_.id).join(`
|
|
12
|
-
`),F=i.useMemo(()=>I.withExplorerSources(t,D.split(`
|
|
13
|
-
`)),[t,D]),V=i.useRef(m);i.useLayoutEffect(()=>{V.current=m},[m]);const[K]=i.useState(()=>(_,z)=>{V.current?.(_,z)}),X=m===void 0?void 0:K,G=i.useMemo(()=>({config:F,labels:y,locale:p,theme:h,storageNamespace:n,scope:e.scope,sources:e.sources,notices:T,documents:R.documents,trees:R.trees,data:R.data,viewSettings:d,treeSettings:M,announcer:g,reveals:x,edits:j,onEditGrant:f,renderTreeFailure:u,reportMathDiagnostics:X}),[F,y,p,h,n,e.scope,e.sources,T,R,d,M,g,x,j,f,u,X]);return l.jsx(jt,{value:G,children:l.jsx(Os,{renderFrame:a,lockDocumentScroll:w},e.scope)})},Ls=({ref:e,theme:t,view:n,children:r})=>{const[o]=i.useState(Nr);return l.jsx("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})},Os=({renderFrame:e,lockDocumentScroll:t})=>{const{theme:n,labels:r}=P(),o=ye(),{hash:s}=Y.useLocation(),a=he(),u=i.useRef(null);ms(t,u),i.useLayoutEffect(()=>{o.kind==="redirect"&&a(`${o.href}${s}`,"browse")},[o,s,a]);const{location:w}=o,m=w.view;ps(u,m);const f=w.view==="tree"?l.jsx(i.Suspense,{fallback:l.jsx("section",{className:"aqmx-split-fallback","aria-label":r.explorerRegion,"aria-busy":"true","data-testid":"markdown-explorer-split-loading"}),children:l.jsx(vs,{location:w})}):w.view==="multi"?l.jsx(i.Suspense,{fallback:l.jsx("section",{className:"aqmx-stage-fallback","aria-label":r.multiRegion,"aria-busy":"true","data-testid":"markdown-explorer-stage-loading"}),children:l.jsx(ws,{location:w})}):l.jsx(Wo,{location:w}),p=l.jsxs(Ls,{ref:u,theme:n,view:m,children:[f,l.jsx($n,{}),l.jsx(xn,{holds:!0,testId:"markdown-explorer-announcer"})]});return e===void 0?p:e({view:m,children:p})},Cs=({currentUrl:e,nextUrl:t,formMethod:n,defaultShouldRevalidate:r})=>n===void 0&&e.href===t.href&&r;exports.ALLOW_KEY_REPEAT=Se;exports.CONFLICT_OURS_MARKER=Nt;exports.CONFLICT_SEPARATOR=Dt;exports.CONFLICT_THEIRS_MARKER=Pt;exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=Tt;exports.DocumentPane=fn;exports.DocumentRefreshBar=wn;exports.EXPLORER_THEMES=Be;exports.EditGrantNotice=gn;exports.ExplorerLink=Vt;exports.FailureView=le;exports.ForwardRef=mn;exports.ForwardRef$1=hn;exports.ImageViewMemoryContext=nn;exports.LazyNativeScrollBar=Kt;exports.LiveRegion=xn;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=Ct;exports.MARKDOWN_EXPLORER_LABEL_KEYS=Ze;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=Lt;exports.MARKDOWN_EXPLORER_LOCALES=qe;exports.MarkdownExplorer=Ts;exports.PAGE_DOCUMENT_REFRESH=vn;exports.blockAtLine=zt;exports.consumeKey=Ve;exports.createEmitter=ae;exports.explorerNavigationOptions=er;exports.failureTitleOf=te;exports.findConflictsInLines=_t;exports.focusWithoutScroll=We;exports.frameTopOf=Ht;exports.lineTopIn=Zt;exports.positionInSource=Qn;exports.resolveMarkdownExplorerLabels=Ie;exports.shouldRevalidateExplorer=Cs;exports.useExplorer=P;exports.useExplorerLocation=ye;exports.useExplorerNavigate=he;exports.useIntentPrefetch=Gt;exports.usePageMarkupToggle=pn;exports.usePreviewShown=It;exports.useViewSetting=ue;exports.visibleTopOf=Ut;
|