@aiquants/markdown-explorer 0.35.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +31 -2
  3. package/dist/{EditSurface-CLG70Vnn.cjs → EditSurface-B70iRFkG.cjs} +1 -1
  4. package/dist/{EditSurface-D2j1kCEE.js → EditSurface-BCFJRyIM.js} +5 -5
  5. package/dist/{ExplorerSplit-D_0VohOv.cjs → ExplorerSplit-BNrHrIus.cjs} +1 -1
  6. package/dist/{ExplorerSplit-CfP1smbT.js → ExplorerSplit-Bgccz2nm.js} +77 -77
  7. package/dist/{MultiLayout-CxV5SI7f.cjs → MultiLayout-Bo9LAXiY.cjs} +1 -1
  8. package/dist/{MultiLayout-BeJ5Lubb.js → MultiLayout-Dy5TIC2t.js} +4 -4
  9. package/dist/{NativeScrollBar-RWXpVhbI.cjs → NativeScrollBar-Bj-LKej0.cjs} +1 -1
  10. package/dist/{NativeScrollBar-BM5NULzg.js → NativeScrollBar-DpZMYhmf.js} +2 -2
  11. package/dist/TreeLayout-DsSKW_Qj.js +103 -0
  12. package/dist/TreeLayout-T8sc_wg7.cjs +1 -0
  13. package/dist/core/config.d.cts +6 -0
  14. package/dist/core/config.d.ts +6 -0
  15. package/dist/core/contracts.d.cts +21 -0
  16. package/dist/core/contracts.d.ts +21 -0
  17. package/dist/core/dataRoute.d.cts +5 -1
  18. package/dist/core/dataRoute.d.ts +5 -1
  19. package/dist/core/documentId.d.cts +6 -0
  20. package/dist/core/documentId.d.ts +6 -0
  21. package/dist/core/labels.d.cts +10 -0
  22. package/dist/core/labels.d.ts +10 -0
  23. package/dist/core/location.d.cts +21 -0
  24. package/dist/core/location.d.ts +21 -0
  25. package/dist/explorerCore-B3RGmMG6.js +1083 -0
  26. package/dist/explorerCore-CUkyKtm8.cjs +1 -0
  27. package/dist/{index-C1YMH-yI.js → index-D0l_BJqb.js} +2536 -2372
  28. package/dist/index-lpL7GltU.cjs +18 -0
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.d.cts +2 -1
  31. package/dist/index.d.ts +2 -1
  32. package/dist/index.js +38 -33
  33. package/dist/location-Dh6K-y7w.js +761 -0
  34. package/dist/location-DrOP6t1F.cjs +1 -0
  35. package/dist/{merge-Bb_HpPhe.js → merge-BwcqBd4c.js} +1 -1
  36. package/dist/{merge-DQUYEGCx.cjs → merge-Dckw7r9T.cjs} +1 -1
  37. package/dist/ownUrls-BTPGNhBt.cjs +1 -0
  38. package/dist/ownUrls-DD0cSCsF.js +409 -0
  39. package/dist/{sanitizeJob-BYRk17nr.js → sanitizeJob-BYqzjFJC.js} +1 -1
  40. package/dist/{sanitizeJob-Cs9o3Vpl.cjs → sanitizeJob-CudE1RUP.cjs} +1 -1
  41. package/dist/{sanitizePolicy-CiQfnxyd.cjs → sanitizePolicy-C-ehd0J_.cjs} +1 -1
  42. package/dist/{sanitizePolicy-CEMdaLUB.js → sanitizePolicy-DAPnUUVm.js} +1 -1
  43. package/dist/sanitizeWorker.cjs +1 -1
  44. package/dist/sanitizeWorker.js +3 -3
  45. package/dist/{sanitizerService-KWXv7bPm.js → sanitizerService-B8v4ap9t.js} +1 -1
  46. package/dist/{sanitizerService-BY4CPCoA.cjs → sanitizerService-DomN7lwC.cjs} +1 -1
  47. package/dist/server/errors.d.cts +1 -1
  48. package/dist/server/errors.d.ts +1 -1
  49. package/dist/server/ports.d.cts +19 -0
  50. package/dist/server/ports.d.ts +19 -0
  51. package/dist/server.cjs +1 -1
  52. package/dist/server.d.cts +1 -1
  53. package/dist/server.d.ts +1 -1
  54. package/dist/server.js +6 -6
  55. package/dist/serverBrowser.cjs +1 -1
  56. package/dist/serverBrowser.js +3 -3
  57. package/dist/serverCore.cjs +1 -1
  58. package/dist/serverCore.d.cts +1 -1
  59. package/dist/serverCore.d.ts +1 -1
  60. package/dist/serverCore.js +4 -4
  61. package/dist/{tapScrollCircle-DdX0Wri0.cjs → tapScrollCircle-DyLInGck.cjs} +1 -1
  62. package/dist/{tapScrollCircle-BEydRn0y.js → tapScrollCircle-smKLgRa2.js} +1 -1
  63. package/dist/testing.cjs +1 -1
  64. package/dist/testing.d.cts +5 -0
  65. package/dist/testing.d.ts +5 -0
  66. package/dist/testing.js +80 -2
  67. package/dist/{useSplitPersistence-B2Fj508K.cjs → useSplitPersistence-BUa_KMsV.cjs} +1 -1
  68. package/dist/{useSplitPersistence-Fkqak8G8.js → useSplitPersistence-pnb21dsr.js} +1 -1
  69. package/docs/behavior/dom-hooks.md +3 -1
  70. package/docs/behavior/security.md +23 -2
  71. package/docs/behavior/url-contract.md +26 -0
  72. package/package.json +2 -2
  73. package/dist/TreeLayout-AxLw-36S.js +0 -103
  74. package/dist/TreeLayout-Bg2YH-EY.cjs +0 -1
  75. package/dist/explorerCore-DLpDuSev.js +0 -998
  76. package/dist/explorerCore-DYrxS9ez.cjs +0 -1
  77. package/dist/index-LQWQfpAf.cjs +0 -18
  78. package/dist/location--KvTA0Ri.js +0 -726
  79. package/dist/location-D8DyDkuA.cjs +0 -1
  80. package/dist/ownUrls-B259RGgd.cjs +0 -1
  81. package/dist/ownUrls-Dh5g6ZJi.js +0 -370
@@ -1,18 +0,0 @@
1
- /*! Bundled third-party code: @heroicons/react 2.2.0 (MIT, ./licenses/@heroicons/react/LICENSE) */
2
- "use strict";const V=require("./describeValue-Ccvhbt36.cjs"),l=require("react/jsx-runtime"),c=require("react"),ae=require("react-router"),G=require("./location-D8DyDkuA.cjs"),Le=require("@aiquants/markdown/code-blocks"),P=require("./ownUrls-B259RGgd.cjs"),Oe=require("@aiquants/markdown"),Ht=require("@aiquants/markdown/source-lines"),Vt=require("@aiquants/spreadsheet/tsv"),xn=require("@aiquants/spreadsheet/view"),is=require("@aiquants/markdown/viewer-settings"),se=require("./storage-BpYsprog.cjs"),Ct=require("@aiquants/markdown/converter"),ls=require("@aiquants/route-revalidation");function cs(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 R=cs(c),ur=Object.freeze(["reload","notify"]),fr=Object.freeze(["signed-in","signed-out"]),ds=Object.freeze([`
3
- `,`\r
4
- `]),us=Object.freeze(["fetch","persistSettings","subscribeHostChanges","onReload","onSessionEnded","onDraftChange"]),fs=Object.freeze(["guardUnload","confirmUnversionedSaves"]),bn=(e,t,n)=>{if(!(t===void 0||typeof t=="string"&&n.includes(t)))throw new RangeError(`[markdown-explorer] ${e} must be ${n.map(V.describeValue).join(" or ")}; got ${V.describeValue(t)}`)},ms=e=>{for(const n of us){const r=e[n];if(r!==void 0&&typeof r!="function")throw new TypeError(`[markdown-explorer] ${n} must be a function; got ${V.describeValue(r)}`)}for(const n of fs){const r=e[n];if(r!==void 0&&typeof r!="boolean")throw new TypeError(`[markdown-explorer] ${n} must be a boolean; got ${V.describeValue(r)}`)}bn("hostChangePolicy",e.hostChangePolicy,ur),bn("accountState",e.accountState,fr);const{paletteKey:t}=e;if(t!==void 0){if(typeof t!="string")throw new TypeError(`[markdown-explorer] paletteKey must be a non-empty string; got ${V.describeValue(t)}`);if(t==="")throw new RangeError("[markdown-explorer] paletteKey must be a non-empty string; got an empty string")}},zt=(e,t)=>{if(!Array.isArray(t))throw new TypeError(`[markdown-explorer] ${e} must be an array of strings; got ${V.describeValue(t)}`);for(const n of t){if(typeof n!="string")throw new TypeError(`[markdown-explorer] ${e} must hold strings only; got ${V.describeValue(n)}`);if(n==="")throw new RangeError(`[markdown-explorer] ${e} must hold non-empty strings; got an empty string`)}},hs=(e,t)=>{zt(`${e}'s paths`,t)},ps=e=>{if(!V.isPlainObject(e))throw new TypeError(`[markdown-explorer] a host change must be a plain object; got ${V.describeValue(e)}`);zt("a host change's sourceIds",e.sourceIds),zt("a host change's paths",e.paths)},Sn=(e,t)=>{if(typeof t!="string")throw new TypeError(`[markdown-explorer] restoreDrafts takes ${e} as a string; got ${V.describeValue(t)}`);if(t.includes("\r"))throw new RangeError(`[markdown-explorer] restoreDrafts takes ${e} with its lines ending in "\\n" alone; got a text with "\\r"`)},ws=e=>{if(!Array.isArray(e))throw new TypeError(`[markdown-explorer] restoreDrafts takes an array of drafts; got ${V.describeValue(e)}`);const t=new Set;for(const n of e){if(!V.isPlainObject(n))throw new TypeError(`[markdown-explorer] restoreDrafts takes each draft as a plain object; got ${V.describeValue(n)}`);const{path:r,base:o,lineEnding:s}=n;if(typeof r!="string")throw new TypeError(`[markdown-explorer] restoreDrafts takes a draft's path as a string; got ${V.describeValue(r)}`);if(r==="")throw new RangeError("[markdown-explorer] restoreDrafts takes non-empty paths; got an empty string");if(t.has(r))throw new RangeError(`[markdown-explorer] restoreDrafts takes one draft per path; got ${V.describeValue(r)} twice`);if(t.add(r),!V.isPlainObject(o))throw new TypeError(`[markdown-explorer] restoreDrafts takes a draft's base as a plain object; got ${V.describeValue(o)}`);if(Sn("base.text",o.text),o.version!==null&&typeof o.version!="string")throw new TypeError(`[markdown-explorer] restoreDrafts takes base.version as a string or null; got ${V.describeValue(o.version)}`);if(Sn("draft",n.draft),!ds.includes(s))throw new RangeError(`[markdown-explorer] restoreDrafts takes lineEnding as "\\n" or "\\r\\n"; got ${V.describeValue(s)}`)}},gs=e=>{if(typeof e!="string")throw new TypeError(`[markdown-explorer] announce takes a string; got ${V.describeValue(e)}`);if(e==="")throw new RangeError("[markdown-explorer] announce takes a non-empty string; got an empty string")},vs=e=>{if(!V.isPlainObject(e))throw new TypeError(`[markdown-explorer] reportMediaFailure takes a plain object; got ${V.describeValue(e)}`);const{url:t,final:n}=e;if(typeof t!="string")throw new TypeError(`[markdown-explorer] reportMediaFailure takes url as a string; got ${V.describeValue(t)}`);if(t==="")throw new RangeError("[markdown-explorer] reportMediaFailure takes a non-empty url; got an empty string");if(typeof n!="boolean")throw new TypeError(`[markdown-explorer] reportMediaFailure takes final as a boolean; got ${V.describeValue(n)}`)},Gt=Object.freeze(["en","ja"]),mr="en",tn=e=>`viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`,hr=Object.freeze(Object.keys(Le.SPREADSHEET_BLOCK_LABEL_CATALOGS.en)),pr=e=>Object.fromEntries(hr.map(t=>[tn(t),Le.SPREADSHEET_BLOCK_LABEL_CATALOGS[e][t].text])),wr=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"]),panelGroupMinimumExceededDetail:Object.freeze(["required","available"]),panelGroupMaximumInsufficientDetail:Object.freeze(["total","needed"]),viewerSvgImageSourceRegion:Object.freeze(["name"]),viewerSvgImageFullscreenDialog:Object.freeze(["name"]),...Object.fromEntries(hr.filter(e=>Le.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e].length>0).map(e=>[tn(e),Le.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e]]))}),Es=/\{(\w+)\}|[{}]/gu,gr={...pr("en"),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}`,documentMaximize:"Maximize the document",documentRestore:"Restore the document to its size",documentMaximized:e=>`Maximized ${e}`,documentRestored:e=>`Restored ${e} to its size`,documentRefreshFailed:e=>`Could not reload the document: ${e}`,documentReloadedAfterChange:e=>`Reloaded ${e}, which changed elsewhere`,documentChangedElsewhere:e=>`${e} changed elsewhere`,reload:"Reload",mediaLoadFailed:e=>`Could not load ${e}`,mediaLoadFailedCount:e=>`Could not load ${e} media files`,mediaUnplayable:e=>`Cannot play ${e}`,mediaUnplayableCount:e=>`Cannot play ${e} media files`,showMarkupLabel:"Source",showMarkup:"Show the document's Markdown as written",showSvgMarkup:"Show the image's SVG as written",showSpreadsheetMarkup:e=>`Show the table's ${e} as written`,showMarkupNamed:e=>`Source of ${e}`,editDocumentLabel:"Edit",editDocument:"Edit the document's Markdown (or double-click the document)",editDocumentNamed:e=>`Edit ${e}`,editDraftDocument:"Edit the document's Markdown without saving, to try it in the preview (or double-click the document)",editDraftDocumentNamed:e=>`Edit ${e} without saving`,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",editView:"View",editViewNamed:e=>`View of ${e}`,editViewEditor:"Editor",editViewEditorTooltip:"Show the editor (Ctrl+E, or ⌘E on a Mac, switches with the preview)",editViewSplit:"Side by side",editViewSplitTooltip:"Show the editor and the preview side by side",editViewSplitResize:"Resize the editor and the preview",editViewPreview:"Preview",editViewPreviewTooltip:"Show the preview (Ctrl+E, or ⌘E on a Mac, switches with the editor)",historyOpen:"History",draftUnsaved:"Unsaved changes",draftStatus:"Draft, not saved",draftNotSaved:"This draft is not saved: the document cannot be saved here.",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",draftDiscardTitle:"Discard the draft?",draftDiscardBody:e=>`The changes to ${e} are not saved anywhere and will be lost.`,unsavedStay:"Keep editing",unversionedSaveTitle:"Save without keeping the previous version?",unversionedSaveBody:"This source does not keep previous versions. Once saved, the previous content cannot be restored.",unversionedSaveConfirm:"Save",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}`,previewTablePending:"This table can be edited once the preview shows the draft.",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",sortOldest:"Modified old→new",sortNewest:"Modified new→old",settingFolderPlacement:"Folders",folderPlacementMixed:"Mixed",folderPlacementFirst:"First",folderPlacementLast:"Last",settingReadmePlacement:"README",readmePlacementMixed:"Mixed",readmePlacementFirst:"First",readmePlacementLast:"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",settingShowFolderReadme:"Show folder READMEs",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.",folderReadmeMissing:e=>`${e} has no README.`,documentLoading:"Loading the document…",markupLoading:"Loading the source…",spreadsheetLoading:"Loading the table…",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.",failureUnauthorizedSignInBody:"Sign in again to continue.",failureUnauthorizedSignedOutBody:"Sign in to open it.",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",signInAgain:"Sign in again",signIn:"Sign in",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",copyText:"Copy the text",copiedText:"Copied the text",copyTextFailed:"Could not copy the text",mediaUnsupported:"Your browser cannot play this file.",fileNotShown:"This file cannot be shown here. Download it to open it.",pdfNotShown:"This browser does not show PDF files inside the page. Open it in a new tab or download it.",spreadsheetWorkbookFirstSheet:"The whole workbook could not be read, so only its first sheet is shown.",spreadsheetSheets:e=>`Sheets of ${e}`,spreadsheetSheetName:(e,t)=>`${e}, sheet ${t}`,spreadsheetUnshownSheets:e=>e===1?"1 sheet is not shown (a hidden sheet or a chart sheet).":`${e} sheets are not shown (hidden sheets or chart sheets).`,spreadsheetUnlistedSheets:e=>`Only the first ${e} sheets are listed.`,spreadsheetSheetLoading:"Loading the sheet…",spreadsheetSheetEmpty:"This sheet has no data.",spreadsheetWorkbookEncrypted:"This workbook is password-protected, so it cannot be shown. Download it to open it.",spreadsheetNotWorkbook:"This file cannot be read as an Excel (.xlsx) or OpenDocument (.ods) workbook. Download it to open it.",spreadsheetWorkbookTooLarge:"This workbook is too large to preview. Download it to open it.",spreadsheetTruncated:"The table shows only part of this file. Download it to open the whole file.",spreadsheetUnreadableEncoding:([e,t])=>t===void 0?`This file's text is not ${e}, so it cannot be shown as a table. Download it to open it.`:`This file's text is neither ${e} nor ${t}, so it cannot be shown as a table. Download it to open it.`,spreadsheetEmpty:"This file has no data.",spreadsheetNotText:"This file is not text, so it cannot be shown as a table. Download it to open it.",spreadsheetLongRow:"No row of this file ends within the part read for the preview, so it cannot be shown as a table. Download it to open it.",spreadsheetFullscreen:e=>`${e} (full screen)`,viewerLoading:"Loading data...",viewerErrorPrefix:"Error: ",viewerStyleTitle:"Display",viewerSelectStyle:"Display options",viewerPinStyle:"Pin display options",viewerUnpinStyle:"Unpin display options",viewerStyleSectionTitle:"Style",viewerMeasureTitle:"Width",viewerColorsTitle:"Colors",viewerMeasureFill:"Full width",viewerMeasureReading:"Reading width",viewerColorsDefault:"Document colors",viewerColorsSepia:"Sepia",viewerColorsDarkLowGlare:"Dark, low glare",viewerColorsHighContrast:"High contrast",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",viewerMermaidInteractionModeTouch:"Touch 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)",viewerMermaidModeNoneTouch:"No interaction (a finger scrolls the page)",viewerMermaidModeZoomTouch:"Zoom only (two fingers)",viewerMermaidModePanTouch:"Pan only (one-finger drag while the diagram overflows)",viewerMermaidModeBothTouch:"Zoom and pan (two fingers, one finger while the diagram overflows)",viewerMermaidZoomIn:"Zoom In",viewerMermaidZoomOut:"Zoom Out",viewerMermaidResetView:"Reset View",viewerMermaidPanUp:"Pan Up",viewerMermaidPanDown:"Pan Down",viewerMermaidPanLeft:"Pan Left",viewerMermaidPanRight:"Pan Right",viewerMermaidFullscreen:"View full screen",viewerMermaidExitFullscreen:"Exit full screen",viewerMermaidFullscreenDialog:"Diagram (full screen)",viewerMermaidDiagram:"Diagram (arrow keys pan, + and - zoom, 0 resets)",viewerMermaidRetry:"Try again",viewerMermaidLoading:"Loading diagram...",viewerMermaidInitializationFailed:"Mermaid failed to initialize globally.",viewerMermaidRenderFailed:"An unknown error occurred while rendering the diagram.",viewerMermaidEmptyDrawing:"Failed to render Mermaid diagram: SVG content is empty or invalid.",viewerMermaidSource:"Source",viewerMermaidSourceRegion:"Diagram source",viewerMermaidCopySource:"Copy the source",viewerMermaidCopiedSource:"Copied the source.",viewerMermaidCopySourceFailed:"Could not copy the source.",viewerMermaidTypeC4:"C4 diagram",viewerMermaidTypeFlowchart:"Flowchart",viewerMermaidTypeSwimlane:"Swimlane diagram",viewerMermaidTypeEntityRelationship:"Entity relationship diagram",viewerMermaidTypeGitGraph:"Git graph",viewerMermaidTypeGantt:"Gantt chart",viewerMermaidTypeInfo:"Mermaid information",viewerMermaidTypePie:"Pie chart",viewerMermaidTypeQuadrantChart:"Quadrant chart",viewerMermaidTypeXyChart:"XY chart",viewerMermaidTypeRequirement:"Requirement diagram",viewerMermaidTypeSequence:"Sequence diagram",viewerMermaidTypeClass:"Class diagram",viewerMermaidTypeState:"State diagram",viewerMermaidTypeJourney:"User journey",viewerMermaidTypeTimeline:"Timeline",viewerMermaidTypeMindmap:"Mind map",viewerMermaidTypeKanban:"Kanban board",viewerMermaidTypeSankey:"Sankey diagram",viewerMermaidTypePacket:"Packet diagram",viewerMermaidTypeRadar:"Radar chart",viewerMermaidTypeBlock:"Block diagram",viewerMermaidTypeTreeView:"Tree view",viewerMermaidTypeArchitecture:"Architecture diagram",viewerMermaidTypeEventModeling:"Event modeling diagram",viewerMermaidTypeIshikawa:"Ishikawa diagram",viewerMermaidTypeVenn:"Venn diagram",viewerMermaidTypeTreemap:"Treemap",viewerMermaidTypeWardley:"Wardley map",viewerMermaidTypeCynefin:"Cynefin diagram",viewerMermaidTypeRailroad:"Railroad diagram",viewerEmbeddedVideo:"embedded video",viewerEmbeddedPost:"embedded post",viewerEmbeddedFrame:"Embedded content",viewerBlockFailed:"This block could not be shown.",viewerSvgImageToolbar:"SVG image",viewerSvgImageSource:"Source",viewerSvgImageSourceRegion:"Source of {name}",viewerSvgImageLoading:"Loading the source…",viewerSvgImageFailed:"The source could not be read.",viewerSvgImageRetry:"Try again",viewerSvgImageTruncated:"Only the beginning of this file is shown.",viewerSvgImageCopy:"Copy the source",viewerSvgImageCopied:"Copied the source.",viewerSvgImageCopyFailed:"Could not copy the source.",viewerSvgImageCopyImage:"Copy the image",viewerSvgImageCopiedImage:"Copied the image.",viewerSvgImageCopyImageFailed:"Could not copy the image.",viewerSvgImageFullscreen:"View full screen",viewerSvgImageExitFullscreen:"Exit full screen",viewerSvgImageFullscreenDialog:"{name} (full screen)",viewerCodeBlockCopy:"Copy the code",viewerCodeBlockCopied:"Copied the code.",viewerCodeBlockCopyFailed:"Could not copy the code.",viewerDisplayMathCopy:"Copy the formula",viewerDisplayMathCopied:"Copied the formula.",viewerDisplayMathCopyFailed:"Could not copy the formula.",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",panelMove:"Move the panel",panelMovePreviousColumn:"Move to the previous column",panelMoveNextColumn:"Move to the next column",panelMoveUp:"Move up",panelMoveDown:"Move down",panelMoreActions:"More actions",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",panelGroupMinimumExceededSummary:"Layout unavailable: minimum panel sizes exceed the container.",panelGroupMinimumExceededDetail:"Min required: {required}px | Available: {available}px",panelGroupMaximumInsufficientSummary:"Layout unavailable: panels cannot fill the container with their maximum sizes.",panelGroupMaximumInsufficientDetail:"Max total: {total}px | Needed: {needed}px"},ys={...pr("ja"),explorerRegion:"エクスプローラー",sourceLabel:"ソース",refreshTreeLabel:"ツリーを更新",refreshTree:"ソースからツリーと開いている文書を読み込み直す",treeRefreshed:"ツリーをソースから読み込み直しました",treeRefreshFailed:e=>`ツリーを読み込み直せませんでした: ${e}`,refreshDocumentLabel:"文書を更新",refreshDocument:"ソースから文書を読み込み直す",refreshDocumentNamed:e=>`${e} を更新`,documentRefreshed:e=>`${e} を読み込み直しました`,documentMaximize:"文書を最大化",documentRestore:"文書を元のサイズに戻す",documentMaximized:e=>`${e} を最大化しました`,documentRestored:e=>`${e} を元のサイズに戻しました`,documentRefreshFailed:e=>`文書を読み込み直せませんでした: ${e}`,documentReloadedAfterChange:e=>`ほかで変更された ${e} を読み込み直しました`,documentChangedElsewhere:e=>`${e} はほかで変更されました`,reload:"読み込み直す",mediaLoadFailed:e=>`${e} を読み込めませんでした`,mediaLoadFailedCount:e=>`${e} 個の媒体を読み込めませんでした`,mediaUnplayable:e=>`${e} を再生できません`,mediaUnplayableCount:e=>`${e} 個の媒体を再生できません`,showMarkupLabel:"ソース",showMarkup:"文書の Markdown を書いたまま表示",showSvgMarkup:"画像の SVG を書いたまま表示",showSpreadsheetMarkup:e=>`表の ${e} を書いたまま表示`,showMarkupNamed:e=>`${e} のソース`,editDocumentLabel:"編集",editDocument:"文書の Markdown を編集 (文書のダブルクリックでも)",editDocumentNamed:e=>`${e} を編集`,editDraftDocument:"文書の Markdown を保存せずに編集し、プレビューで確かめる (文書のダブルクリックでも)",editDraftDocumentNamed:e=>`${e} を保存せずに編集`,editExternallyLabel:"元のエディタで開く",editExternally:"文書を元のエディタで、新しいタブに開く",editExternallyNamed:e=>`${e} を元のエディタで開く`,editorRegion:e=>`${e} を編集中`,editorLabel:e=>`${e} の Markdown`,editLoading:"編集のためにソースを読み込み中…",editToolbar:"エディタ",saveDraft:"保存",saveDraftTooltip:"下書きを保存 (Ctrl+S、Mac は ⌘S)",closeEditor:"編集を閉じる",editView:"表示",editViewNamed:e=>`${e} の表示`,editViewEditor:"エディタ",editViewEditorTooltip:"エディタを表示 (Ctrl+E、Mac は ⌘E でプレビューと切り替え)",editViewSplit:"並べて表示",editViewSplitTooltip:"エディタとプレビューを並べて表示",editViewSplitResize:"エディタとプレビューの割合を変更",editViewPreview:"プレビュー",editViewPreviewTooltip:"プレビューを表示 (Ctrl+E、Mac は ⌘E でエディタと切り替え)",historyOpen:"履歴",draftUnsaved:"保存していない変更があります",draftStatus:"保存しない下書き",draftNotSaved:"この下書きは保存しません。ここでは文書を保存できません。",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:"変更を破棄",draftDiscardTitle:"下書きを破棄しますか?",draftDiscardBody:e=>`${e} への変更はどこにも保存されず、失われます。`,unsavedStay:"編集を続ける",unversionedSaveTitle:"前の版を残さずに保存しますか?",unversionedSaveBody:"この保存先は前の版を残しません。保存すると前の内容へ戻せません。",unversionedSaveConfirm:"保存する",historyTitle:e=>`${e} の版`,historyLoading:"版の一覧を読み込み中…",historyEmpty:"この文書の版は残っていません。",historyCurrent:"現在の版",historyKept:"保持",historyEntry:(e,t)=>t===""?e:`${e} (${t})`,historyRestore:"下書きに戻す",historyClose:"閉じる",historyRestored:e=>`${e} の下書きに版を戻しました。残すには保存してください`,previewRegion:"プレビュー",previewUpdating:"プレビューを更新中…",previewFailed:e=>`プレビューできませんでした: ${e}`,previewTablePending:"プレビューが下書きを描くと、この表を編集できます。",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:"名前の降順",sortOldest:"更新日時の昇順 (古い順)",sortNewest:"更新日時の降順 (新しい順)",settingFolderPlacement:"フォルダーの位置",folderPlacementMixed:"混ぜる",folderPlacementFirst:"先に",folderPlacementLast:"後に",settingReadmePlacement:"README の位置",readmePlacementMixed:"混ぜる",readmePlacementFirst:"先に",readmePlacementLast:"後に",settingSelectionMode:"選択",selectionSingle:"1 件",selectionMultiple:"複数",selectionNone:"オフ",settingDoubleClick:"ダブルクリック",doubleClickRecursive:"下の階層まで展開",doubleClickToggle:"開閉",settingExpandIconSize:"展開アイコンの大きさ",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"常に展開",settingRevealDocument:"開いた文書をツリーで表示",settingShowFolderReadme:"フォルダーの README を表示",settingRemoveRootIndent:"最上位の字下げなし",settingTreeLines:"ツリーの線",settingExpandIcons:"展開アイコン",settingDirectoryIcons:"フォルダーのアイコン",settingFileIcons:"ファイルのアイコン",settingOn:"オン",settingOff:"オフ",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"文書",documentEmpty:"エクスプローラーで文書を選んでください。",folderReadmeMissing:e=>`${e} には README がありません。`,documentLoading:"文書を読み込み中…",markupLoading:"ソースを読み込み中…",spreadsheetLoading:"表を読み込み中…",documentShown:e=>`${e} を表示しています`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[。!?]$/u.test(t)?t:`${t}。`).join(""),textTruncated:"このファイルは先頭だけを表示しています。",inertLink:"リンク先がソースの外にあるため開けません。",failureUnauthorizedTitle:"セッションの有効期限が切れました",failureUnauthorizedBody:"ページを再読み込みして、もう一度サインインしてください。",failureUnauthorizedSignInBody:"もう一度サインインすると続けられます。",failureUnauthorizedSignedOutBody:"サインインすると開けます。",failureForbiddenTitle:"アクセスが許可されていません",failureForbiddenBody:"これを開く権限がありません。",failureNotFoundTitle:"見つかりません",failureNotFoundBody:"移動または削除された可能性があります。",failureNotConfiguredTitle:"このソースは設定されていません",failureNotConfiguredBody:"管理者に設定を依頼してください。",failureInvalidTitle:"アドレスが正しくありません",failureInvalidBody:"このアドレスに含まれる文書の経路は使えません。",failureTooLargeTitle:"大きすぎて表示できません",failureTooLargeBody:"このファイルは表示できる大きさを超えています。",failureUnsupportedTitle:"表示できない形式です",failureUnsupportedBody:"この種類のファイルはここでは表示できません。",failureFailedTitle:"読み込みに失敗しました",failureFailedBody:"しばらくしてからもう一度お試しください。",retry:"再試行",reloadPage:"ページを再読み込み",signInAgain:"もう一度サインイン",signIn:"サインイン",imageZoomIn:"拡大",imageZoomOut:"縮小",imageFit:"画面に合わせる",imageFitLevel:"全体",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"新しいタブで開く",download:"ダウンロード",copyText:"テキストをコピー",copiedText:"テキストをコピーしました",copyTextFailed:"テキストをコピーできませんでした",mediaUnsupported:"このブラウザではこのファイルを再生できません。",fileNotShown:"このファイルはここでは表示できません。ダウンロードして開いてください。",pdfNotShown:"このブラウザはページの中に PDF を表示しません。新しいタブで開くか、ダウンロードしてください。",spreadsheetWorkbookFirstSheet:"ブック全体を読めなかったため、最初のシートだけを表示しています。",spreadsheetSheets:e=>`${e} のシート`,spreadsheetSheetName:(e,t)=>`${e} のシート「${t}」`,spreadsheetUnshownSheets:e=>`非表示のシートかグラフのシートが ${e} 枚あり、表示していません。`,spreadsheetUnlistedSheets:e=>`最初の ${e} 枚のシートだけを並べています。`,spreadsheetSheetLoading:"シートを読み込み中…",spreadsheetSheetEmpty:"このシートにはデータがありません。",spreadsheetWorkbookEncrypted:"このブックはパスワードで保護されているため、表示できません。ダウンロードして開いてください。",spreadsheetNotWorkbook:"このファイルは Excel (.xlsx) や OpenDocument (.ods) のブックとして読めません。ダウンロードして開いてください。",spreadsheetWorkbookTooLarge:"このブックはプレビューするには大きすぎます。ダウンロードして開いてください。",spreadsheetTruncated:"表はこのファイルの一部だけを表示しています。全体はダウンロードして開いてください。",spreadsheetUnreadableEncoding:([e,t])=>t===void 0?`このファイルの文字は ${e} ではないため、表として表示できません。ダウンロードして開いてください。`:`このファイルの文字は ${e} でも ${t} でもないため、表として表示できません。ダウンロードして開いてください。`,spreadsheetEmpty:"このファイルにはデータがありません。",spreadsheetNotText:"このファイルは文字のファイルではないため、表として表示できません。ダウンロードして開いてください。",spreadsheetLongRow:"プレビューに読む範囲の中でこのファイルの行が 1 つも終わらないため、表として表示できません。ダウンロードして開いてください。",spreadsheetFullscreen:e=>`${e} (全画面)`,viewerLoading:"データを読み込み中...",viewerErrorPrefix:"エラー: ",viewerStyleTitle:"表示",viewerSelectStyle:"表示の設定",viewerPinStyle:"表示の設定をピン留め",viewerUnpinStyle:"表示の設定のピン留めを解除",viewerStyleSectionTitle:"スタイル",viewerMeasureTitle:"幅",viewerColorsTitle:"配色",viewerMeasureFill:"全幅",viewerMeasureReading:"読みやすい幅",viewerColorsDefault:"文書の配色",viewerColorsSepia:"セピア",viewerColorsDarkLowGlare:"ダーク (まぶしさ控えめ)",viewerColorsHighContrast:"高コントラスト",viewerErrorTitle:"エラーが発生しました",viewerMissingImage:"画像が見つかりません",viewerOpenToc:"目次を開く",viewerTocTitle:"目次",viewerPinToc:"目次をピン留め",viewerUnpinToc:"目次のピン留めを解除",viewerSelectAlign:"揃えを選択",viewerAlignTitle:"揃え",viewerPinAlign:"揃え選択をピン留め",viewerUnpinAlign:"揃え選択のピン留めを解除",viewerAlignLeft:"左揃え",viewerAlignCenter:"中央揃え",viewerAlignRight:"右揃え",viewerMermaidInteractionMode:"マウス操作モード",viewerMermaidInteractionModeTouch:"タッチ操作モード",viewerMermaidModeNone:"操作なし",viewerMermaidModeZoom:"拡大縮小のみ",viewerMermaidModePan:"移動のみ (左ドラッグ)",viewerMermaidModePanShift:"移動のみ (Shift+ドラッグ)",viewerMermaidModeBoth:"拡大縮小+移動 (左ドラッグ)",viewerMermaidModeBothShift:"拡大縮小+移動 (Shift+ドラッグ)",viewerMermaidModeNoneTouch:"操作なし (指はページをスクロール)",viewerMermaidModeZoomTouch:"拡大縮小のみ (2 本指)",viewerMermaidModePanTouch:"移動のみ (はみ出す図を 1 本指でドラッグ)",viewerMermaidModeBothTouch:"拡大縮小+移動 (2 本指・はみ出す図は 1 本指)",viewerMermaidZoomIn:"拡大",viewerMermaidZoomOut:"縮小",viewerMermaidResetView:"表示を元に戻す",viewerMermaidPanUp:"上へ移動",viewerMermaidPanDown:"下へ移動",viewerMermaidPanLeft:"左へ移動",viewerMermaidPanRight:"右へ移動",viewerMermaidFullscreen:"全画面で見る",viewerMermaidExitFullscreen:"全画面を閉じる",viewerMermaidFullscreenDialog:"図 (全画面)",viewerMermaidDiagram:"図 (矢印キーで移動、+ と - で拡大縮小、0 で元に戻す)",viewerMermaidRetry:"再試行",viewerMermaidLoading:"図を読み込み中...",viewerMermaidInitializationFailed:"Mermaid を初期化できませんでした。",viewerMermaidRenderFailed:"図の描画中に不明なエラーが発生しました。",viewerMermaidEmptyDrawing:"Mermaid の図を描画できませんでした: SVG の内容が空か不正です。",viewerMermaidSource:"ソース",viewerMermaidSourceRegion:"図のソース",viewerMermaidCopySource:"ソースをコピー",viewerMermaidCopiedSource:"ソースをコピーしました。",viewerMermaidCopySourceFailed:"ソースをコピーできませんでした。",viewerMermaidTypeC4:"C4 の図",viewerMermaidTypeFlowchart:"流れ図",viewerMermaidTypeSwimlane:"スイムレーンの図",viewerMermaidTypeEntityRelationship:"実体関連図",viewerMermaidTypeGitGraph:"Git のグラフ",viewerMermaidTypeGantt:"ガントチャート",viewerMermaidTypeInfo:"Mermaid の情報の図",viewerMermaidTypePie:"円グラフ",viewerMermaidTypeQuadrantChart:"四象限の図",viewerMermaidTypeXyChart:"XY のグラフ",viewerMermaidTypeRequirement:"要求図",viewerMermaidTypeSequence:"シーケンス図",viewerMermaidTypeClass:"クラス図",viewerMermaidTypeState:"状態図",viewerMermaidTypeJourney:"ユーザージャーニーの図",viewerMermaidTypeTimeline:"年表",viewerMermaidTypeMindmap:"マインドマップ",viewerMermaidTypeKanban:"カンバンのボード",viewerMermaidTypeSankey:"サンキー図",viewerMermaidTypePacket:"パケットの図",viewerMermaidTypeRadar:"レーダーチャート",viewerMermaidTypeBlock:"ブロック図",viewerMermaidTypeTreeView:"ツリーの表示",viewerMermaidTypeArchitecture:"アーキテクチャ図",viewerMermaidTypeEventModeling:"イベントモデリングの図",viewerMermaidTypeIshikawa:"特性要因図",viewerMermaidTypeVenn:"ベン図",viewerMermaidTypeTreemap:"ツリーマップ",viewerMermaidTypeWardley:"ワードリーマップ",viewerMermaidTypeCynefin:"クネビンの図",viewerMermaidTypeRailroad:"構文図",viewerEmbeddedVideo:"埋め込みの動画",viewerEmbeddedPost:"埋め込みの投稿",viewerEmbeddedFrame:"埋め込みのコンテンツ",viewerBlockFailed:"このブロックを表示できませんでした。",viewerSvgImageToolbar:"SVG の画像",viewerSvgImageSource:"ソース",viewerSvgImageSourceRegion:"{name} のソース",viewerSvgImageLoading:"ソースを読み込み中…",viewerSvgImageFailed:"ソースを読み込めませんでした。",viewerSvgImageRetry:"再試行",viewerSvgImageTruncated:"このファイルは先頭だけを表示しています。",viewerSvgImageCopy:"ソースをコピー",viewerSvgImageCopied:"ソースをコピーしました。",viewerSvgImageCopyFailed:"ソースをコピーできませんでした。",viewerSvgImageCopyImage:"画像をコピー",viewerSvgImageCopiedImage:"画像をコピーしました。",viewerSvgImageCopyImageFailed:"画像をコピーできませんでした。",viewerSvgImageFullscreen:"全画面で見る",viewerSvgImageExitFullscreen:"全画面を閉じる",viewerSvgImageFullscreenDialog:"{name} (全画面)",viewerCodeBlockCopy:"コードをコピー",viewerCodeBlockCopied:"コードをコピーしました。",viewerCodeBlockCopyFailed:"コードをコピーできませんでした。",viewerDisplayMathCopy:"数式をコピー",viewerDisplayMathCopied:"数式をコピーしました。",viewerDisplayMathCopyFailed:"数式をコピーできませんでした。",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:"カスタム",panelMove:"パネルを移動",panelMovePreviousColumn:"前の列へ移動",panelMoveNextColumn:"次の列へ移動",panelMoveUp:"上へ移動",panelMoveDown:"下へ移動",panelMoreActions:"その他の操作",panelMoved:"{title} を {column} 列目の {position} 番目へ移動しました",panelMoveUnavailable:"{title} は「{move}」できません",panelDragStarted:"{title} を持ち上げました",panelDragCancelled:"{title} の移動を取り消しました",hiddenPanelsTitle:"隠したパネル:",hiddenPanelBadge:"非表示",hiddenPanelNotice:"このパネルは隠しています",multiColumnEmpty:"この列は空です",multiColumnRegion:"{column} 列目",panelDropHere:"ここへパネルをドロップ",panelGroupMinimumExceededSummary:"レイアウトを表示できません: パネルの最小の大きさの合計が枠を超えています。",panelGroupMinimumExceededDetail:"必要な最小: {required}px | 使える長さ: {available}px",panelGroupMaximumInsufficientSummary:"レイアウトを表示できません: パネルを最大の大きさにしても枠を満たせません。",panelGroupMaximumInsufficientDetail:"最大の合計: {total}px | 必要な長さ: {needed}px"},vr=Object.freeze({en:Object.freeze(gr),ja:Object.freeze(ys)}),nn=Object.freeze(Object.keys(gr)),xs=new Set(nn),bs=e=>xs.has(e),Er=e=>{if(e===void 0)return mr;if(Gt.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${Gt.map(V.describeValue).join(" or ")}), not a BCP 47 tag; got ${V.describeValue(e)}`)},Zt=(e,t)=>{const n=vr[Er(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${V.describeValue(t)}`);if(!V.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${V.describeValue(t)}`);const r=t,o={...n};for(const s of Object.keys(r)){if(!bs(s))throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${nn.join(", ")}`);const a=r[s];if(a===void 0)continue;const i=typeof n[s];if(typeof a!==i)throw new TypeError(`[markdown-explorer] labels.${s} must be a ${i}; got ${V.describeValue(a)}`);if(typeof a=="string"&&a.trim()==="")throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);const h=wr[s];if(typeof a=="string"&&h!==void 0){const p=h.map(f=>`{${f}}`).join(", ");for(const f of a.matchAll(Es)){const d=f[1];if(d===void 0)throw new RangeError(`[markdown-explorer] labels.${s} holds a brace outside a placeholder at index ${String(f.index)}; it accepts ${p}, and no other braces`);if(!h.includes(d))throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${d}}; it accepts ${p}`)}}o[s]=a}return Object.freeze(o)},Ss=(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]))},Wt=Object.freeze(["light","dark"]),ks=e=>{if(e===void 0)return"light";if(Wt.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${Wt.map(V.describeValue).join(" or ")}; got ${V.describeValue(e)}`)},Ts=()=>{window.location.reload()},Fe=Object.freeze({guardUnload:!0,onReload:Ts,accountState:"signed-in",confirmUnversionedSaves:!1}),yr=c.createContext(null),$=()=>{const e=c.use(yr);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},ge=e=>{const{viewSettings:t}=$(),n=()=>e(t.getSnapshot());return c.useSyncExternalStore(t.subscribe,n,n)},Et=()=>{const{config:e}=$(),t=ae.useParams()["*"],[n]=ae.useSearchParams(),r=n.toString();return c.useMemo(()=>G.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])},Rs=()=>{const e=new Map,t=new Set,n=new Set,r=()=>{for(const s of[...n])s()},o=s=>{t.delete(s)&&r()};return{show:s=>{e.set(s,(e.get(s)??0)+1);let a=!1;return()=>{if(a)return;a=!0;const i=(e.get(s)??0)-1;if(i>0){e.set(s,i);return}e.delete(s),o(s)}},shown:s=>e.has(s),mark:s=>{const a=s.filter(i=>e.has(i)&&!t.has(i));for(const i of a)t.add(i);a.length>0&&r()},changed:s=>t.has(s),dismiss:o,subscribe:s=>(n.add(s),()=>{n.delete(s)})}},Cs=2,Ms=1,Ls=2,Os=3,As=4,kn=Object.freeze(["error","loadstart","progress","stalled"]),Kt=Object.freeze({marked:!1,final:!1,stalled:!1,progress:0,error:null}),lt=Object.freeze([]),Ds=e=>e.marked&&e.progress<=Cs&&(e.final||e.stalled),Ns=(e,t)=>e===Ms?null:t||e===Ls?"media-load":e===Os||e===As?"media-unplayable":null,_s=(e,t)=>{switch(t.kind){case"report":return{...e,marked:!0,final:t.final,progress:0,error:e.error===null?null:"media-load"};case"stalled":return{...e,stalled:!0};case"progress":return{...e,stalled:!1,progress:e.progress+1};case"loadstart":return Kt;case"error":{const n=Ns(t.code,e.marked);return n===null?e:{...e,error:n}}case"source-error":return{...e,error:e.marked?"media-load":"media-unplayable"}}},js=e=>e.error==="media-load"||Ds(e)?"media-load":e.error,Tn=(e,t,n)=>{if(e===""||t===""||!URL.canParse(e,n)||!URL.canParse(t,n))return!1;const r=new URL(e,n),o=new URL(t,n);return r.hash="",o.hash="",r.href===o.href},Ps=(e,t)=>{if(!URL.canParse(e,t))return e;const n=new URL(e,t),r=n.searchParams.get(P.EXPLORER_DATA_QUERY.path);return P.lastPathSegment(r===null?n.pathname:r)},Is=e=>{for(let t=e.nextElementSibling;t!==null;t=t.nextElementSibling)if(t instanceof HTMLSourceElement)return!1;return!0},Fs=e=>{const{target:t,type:n}=e;if(t instanceof HTMLSourceElement){const r=t.parentElement;return n==="error"&&r instanceof HTMLMediaElement&&Is(t)?{element:r,arrival:{kind:"source-error"},url:t.src}:null}return t instanceof HTMLMediaElement?n==="error"?{element:t,arrival:{kind:"error",code:t.error===null?null:t.error.code},url:t.currentSrc}:n==="stalled"||n==="progress"||n==="loadstart"?{element:t,arrival:{kind:n},url:t.currentSrc}:null:null},$s=()=>{const e=new WeakMap,t=new Map,n=new Map,r=new WeakMap,o=new Map,s=new Set;let a=lt,i=null;const h=(w,v,E)=>{if(v===null){o.delete(w);return}o.get(w)?.kind!==v&&o.set(w,{kind:v,target:w,url:E,name:Ps(E,document.baseURI)})},p=w=>{for(const k of[...o.keys()])k.isConnected||o.delete(k);const v=[...o.values()],E=v.length===a.length&&v.every((k,T)=>k===a[T]);if(E||(a=Object.freeze(v)),!(E&&!w))for(const k of[...s])k()},f=(w,v,E)=>{const k=_s(e.get(w)??Kt,v);e.set(w,k),h(w,js(k),E)},d=w=>{const v=Fs(w);v!==null&&(f(v.element,v.arrival,v.url),p(!1))},g=w=>{const v=w.ended?0:w.currentTime,E=!w.paused,k=r.get(w);k!==void 0&&w.removeEventListener("loadedmetadata",k);const T=()=>{r.delete(w),w.currentTime=v,E&&w.play().catch(()=>{})};r.set(w,T),w.addEventListener("loadedmetadata",T,{once:!0}),w.load()};return{observe:w=>{i=w;for(const v of kn)w.addEventListener(v,d,!0);return()=>{for(const v of kn)w.removeEventListener(v,d,!0);i===w&&(i=null)}},report:w=>{const v=document.baseURI;if(i!==null)for(const E of i.querySelectorAll("video, audio"))Tn(E.currentSrc,w.url,v)&&f(E,{kind:"report",final:w.final},E.currentSrc);for(const[E,k]of t)Tn(k,w.url,v)&&h(E,"media-load",k);p(!1)},registerPdfFrame:(w,v)=>(t.set(v,w),()=>{t.delete(v),o.delete(v),p(!1)}),pdfGeneration:w=>n.get(w)??0,subscribe:w=>(s.add(w),()=>{s.delete(w)}),notices:()=>a,reload:w=>{let v=!1;for(const E of[...o.values()])E.kind!=="media-load"||!w.contains(E.target)||(o.delete(E.target),E.target instanceof HTMLIFrameElement?(n.set(E.url,(n.get(E.url)??0)+1),v=!0):(e.set(E.target,Kt),g(E.target)));p(v)}}},xr={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"]},ce=(e,t)=>e[xr[t][0]],ve=({failure:e,alert:t,onRetry:n,testId:r})=>{const{labels:o,edits:s,guardUnload:a,onReload:i,onSessionEnded:h,accountState:p}=$(),f=ce(o,e.reason),d=e.reason==="unauthorized"?h:void 0,g=o[d===void 0?xr[e.reason][1]:p==="signed-out"?"failureUnauthorizedSignedOutBody":"failureUnauthorizedSignInBody"],w=e.reason==="unauthorized"||e.reason==="forbidden"||e.reason==="failed"?"danger":"warning",v=()=>{if(a){i();return}s.flushDrafts();const E=s.dirtyPaths();if(E.length===0){i();return}s.askToDiscard(E).then(k=>{k&&i()})};return l.jsxs("div",{className:"aqmx-callout",role:t?"alert":void 0,"data-aqmx-tone":w,"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:f}),l.jsx("p",{className:"aqmx-callout-body",children:g}),d!==void 0?l.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:()=>{d().then(E=>{E&&n?.()})},children:p==="signed-out"?o.signIn:o.signInAgain}):e.reason==="unauthorized"?l.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:v,children:o.reloadPage}):n!==void 0&&e.reason==="failed"?l.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:n,children:o.retry}):null]})},qs=(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 ce(e,n.failure.reason)}switch(r.kind){case"draft":return e.draftStatus;case"saving":return e.draftSaving;case"conflicts":return e.draftConflicts(r.count);case"grant":return e.editGrantTitle;case"failed":return e.draftSaveFailed(ce(e,r.failure.reason));case"saved":if(!o)return r.merged?e.draftSavedMerged:e.draftSaved;break}return o?e.draftUnsaved:""},Bs=(e,t,n)=>{switch(t.kind){case"draft":return e.draftNotSaved;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(ce(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()}}},br="<<<<<<<",Sr="=======",kr=">>>>>>>",Rn=(e,t)=>e===t||e.startsWith(`${t} `),Cn=e=>Tr(e.split(`
5
- `)),Tr=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||(Rn(s,br)?(n=o,r=null):s===Sr?n!==null&&r===null?r=o:n=null:Rn(s,kr)&&(n!==null&&r!==null&&t.push({start:n,separator:r,end:o}),n=null,r=null))}return t},Mt=e=>e.includes(`\r
6
- `)?`\r
7
- `:`
8
- `,rt=e=>e.replace(/\r\n?/gu,`
9
- `),Us=(e,t)=>t===`
10
- `?e:e.replaceAll(`
11
- `,`\r
12
- `),Hs=3,Vs=/^\d+(?:\.\d+)?$/u,zs=e=>{if(e===null||!Vs.test(e))return null;const t=Number(e);return t>=G.EDIT_SPLIT_MIN_PERCENT&&t<=G.EDIT_SPLIT_MAX_PERCENT?t:null},$e=Object.freeze({kind:"idle"}),Lt=Object.freeze({kind:"draft"}),Gs=({data:e,conflictLabels:t,onSaveSettled:n,sideBySideSetting:r,editorShareSetting:o})=>{const s=new Map,a=new Map,i=new Map,h=new Map,p=new Map,f=Ae();let d=null,g=null,w=null;const v=new Set,E=new Set;let k=!1;const T=(u,m)=>{u.value={...u.value,...m},f.emit()},O=u=>{const m=s.get(u);return m===void 0||m.base===null||!m.value.dirty?null:{path:u,base:{text:m.base.text,version:m.base.version},draft:m.draft,lineEnding:m.ending}},N=()=>{k=!1;const u=[...E];E.clear();for(const m of v){const b=m.first?new Set([...s.keys(),...u]):u;m.first=!1;const x=[],L=[];for(const F of b){const y=O(F);y!==null?(x.push(y),m.kept.add(F)):m.kept.delete(F)&&L.push(F)}(x.length>0||L.length>0)&&m.listener({kept:x,ended:L})}},M=()=>{k||(k=!0,queueMicrotask(N))},C=u=>{E.add(u),M()},B=(u,m)=>s.get(u)===m,I=async(u,m)=>{m.controller.abort(),m.controller=new AbortController;const{signal:b}=m.controller;T(m,{phase:{kind:"opening"}});const x=await e.edit(u,b);if(!B(u,m)||b.aborted||!("kind"in x))return;if(x.kind==="grant"){T(m,{phase:{kind:"grant",href:x.href}});return}if(x.kind==="failure"){T(m,{phase:{kind:"failed",failure:x.failure}});return}const L=rt(x.text),F=x.kind==="draft";m.base={text:L,version:F?null:x.version},m.draft=L,m.ending=Mt(x.text),C(u),T(m,{phase:{kind:"editing"},history:F?!1:x.history,dirty:!1,save:F?Lt:$e,generation:m.value.generation+1})},H=u=>{const m=s.get(u);m!==void 0&&(m.controller.abort(),s.delete(u),i.delete(u),C(u))},_=(u,m,b)=>(u.set(m,b),()=>{u.get(m)===b&&u.delete(m)}),U=(u,m,b,x={})=>{T(m,{...x,save:b}),n(u,b)},Z=async u=>{h.get(u)?.flush();const m=s.get(u);if(m===void 0||m.value.phase.kind!=="editing"||m.base===null||m.value.save.kind==="saving")return;const{version:b}=m.base;if(b===null){n(u,Lt);return}const x=Cn(m.draft).length;if(x>0){U(u,m,{kind:"conflicts",count:x});return}m.controller.abort(),m.controller=new AbortController;const{signal:L}=m.controller;let F={text:m.base.text,version:b},y=m.draft,S=!1;T(m,{save:{kind:"saving"}});for(let A=0;A<Hs;A+=1){const D=await e.save(u,F.version,Us(y,m.ending),L);if(!B(u,m)||L.aborted||!("kind"in D))return;if(D.kind==="saved"){h.get(u)?.flush(),m.base={text:y,version:D.version},C(u),U(u,m,{kind:"saved",merged:S},{dirty:m.draft!==y});return}if(D.kind==="grant"){U(u,m,{kind:"grant",href:D.href});return}if(D.kind==="failure"){U(u,m,{kind:"failed",failure:D.failure});return}const{mergeDraft:q}=await Promise.resolve().then(()=>require("./merge-DQUYEGCx.cjs"));if(!B(u,m)||L.aborted)return;const X=h.get(u);X?.flush();const K=rt(D.text),W=q(F.text,m.draft,K,t());if(F={text:K,version:D.version},m.base=F,m.ending=Mt(D.text),m.draft=W.text,C(u),X?.adopt(W.text),W.kind==="conflicts"){U(u,m,{kind:"conflicts",count:W.conflicts},{dirty:!0,generation:m.value.generation+1});return}if(S=!0,y=W.text,y===F.text){U(u,m,{kind:"saved",merged:S},{dirty:!1,generation:m.value.generation+1});return}T(m,{dirty:!0,generation:m.value.generation+1})}U(u,m,{kind:"failed",failure:{reason:"failed"}})},Q=async(u,m)=>{if(m.kind==="failure")return{restored:!1,reason:m.failure.reason};if(m.kind==="grant")return{restored:!1,reason:"forbidden"};const b=rt(m.text);let x,L,F;if(m.kind==="draft")x={text:b,version:null},L=u.draft,F=Lt;else if(u.base.version===m.version)x={text:b,version:m.version},L=u.draft,F=$e;else{const{mergeDraft:y}=await Promise.resolve().then(()=>require("./merge-DQUYEGCx.cjs")),S=y(u.base.text,u.draft,b,t());x={text:b,version:m.version},L=S.text,F=S.kind==="conflicts"?{kind:"conflicts",count:S.conflicts}:$e}if(s.has(u.path))return{restored:!1,reason:"failed"};if(L!==x.text){const y=m.kind==="edit"&&m.history;s.set(u.path,{value:{path:u.path,phase:{kind:"editing"},view:"editor",previewPrepared:!1,history:y,dirty:!0,save:F,generation:1,request:null},base:x,draft:L,ending:Mt(m.text),controller:new AbortController}),C(u.path),f.emit()}return{restored:!0}};return{session:u=>s.get(u)?.value,subscribe:f.subscribe,start:(u,m)=>{const b=s.get(u);if(b!==void 0){T(b,{request:{anchor:m},view:"editor"}),(b.value.phase.kind==="failed"||b.value.phase.kind==="grant")&&I(u,b);return}a.delete(u);const x={value:{path:u,phase:{kind:"opening"},view:"editor",previewPrepared:!1,history:!1,dirty:!1,save:$e,generation:0,request:{anchor:m}},base:null,draft:"",ending:`
13
- `,controller:new AbortController};s.set(u,x),I(u,x)},retry:u=>{const m=s.get(u);m===void 0||m.value.phase.kind==="editing"||I(u,m)},draft:u=>{const m=s.get(u);return m===void 0||m.base===null?null:m.draft},setDraft:(u,m)=>{const b=s.get(u);if(b===void 0||b.base===null)return;m!==b.draft&&C(u),b.draft=m;const x={},L=m!==b.base.text;L!==b.value.dirty&&(x.dirty=L);const{save:F}=b.value;if(F.kind==="conflicts"){const y=Cn(m).length;y===0?x.save=$e:y!==F.count&&(x.save={kind:"conflicts",count:y})}(x.dirty!==void 0||x.save!==void 0)&&T(b,x)},consumeRequest:u=>{const m=s.get(u);m!==void 0&&m.value.request!==null&&T(m,{request:null})},save:Z,replaceDraft:(u,m)=>{const b=h.get(u);b?.flush();const x=s.get(u);if(x===void 0||x.base===null)return;const L=rt(m);L!==x.draft&&C(u),x.draft=L,b?.adopt(L),T(x,{dirty:L!==x.base.text,generation:x.value.generation+1})},close:u=>{if(!s.has(u))return;const m=h.get(u),b=m===void 0?null:m.returnPoint();H(u),b===null?a.delete(u):a.set(u,b),f.emit()},takeReturn:u=>{const m=a.get(u)??null;return a.delete(u),m},dirtyPaths:()=>[...s.values()].filter(u=>u.value.dirty).map(u=>u.value.path),discard:u=>{for(const m of u)H(m);u.length>0&&f.emit()},editorState:{get:u=>i.get(u),set:(u,m)=>{s.has(u)&&i.set(u,m)}},bindEditor:(u,m)=>_(h,u,m),bindView:(u,m)=>_(p,u,m),viewAnchor:u=>{const m=p.get(u);return m===void 0?null:m.anchor()},flush:u=>h.get(u)?.flush(),flushDrafts:()=>{for(const u of h.values())u.flush()},nextConflict:u=>h.get(u)?.nextConflict()===!0,hasSessions:()=>s.size>0,unsavedAmong:u=>{for(const m of h.values())m.flush();return u.filter(m=>s.get(m)?.value.dirty===!0)},askToDiscard:u=>new Promise(m=>{w?.settle(!1);const b={paths:u,settle:x=>{if(w===b){if(w=null,x)for(const L of u)H(L);f.emit(),m(x)}}};w=b,f.emit()}),discardRequest:()=>w,subscribeDrafts:u=>{const m={listener:u,kept:new Set,first:!0};return v.add(m),M(),()=>{v.delete(m)}},restoreDrafts:async u=>{const{signal:m}=new AbortController,b=await Promise.all(u.map(async F=>{const y=await e.edit(F.path,m);if(!("kind"in y))throw new Error("[markdown-explorer] the transport answered a restore read as cancelled, though nothing aborted it");return{draft:F,answer:y}})),x=[],L=[];for(const{draft:F,answer:y}of b){const S=await Q(F,y);S.restored?x.push(F.path):L.push({path:F.path,reason:S.reason})}return{restored:x,failed:L}},sideBySide:()=>(d??=r.read(),d),setSideBySide:u=>{d!==u&&(d=u,r.write(u),f.emit())},editorShare:()=>(g??=o.read()??G.EDIT_SPLIT_DEFAULT_PERCENT,g),setEditorShare:u=>{if(!Number.isFinite(u))throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${V.describeValue(u)}`);const m=Math.min(G.EDIT_SPLIT_MAX_PERCENT,Math.max(G.EDIT_SPLIT_MIN_PERCENT,u));g!==m&&(g=m,o.write(m))},setView:(u,m)=>{const b=s.get(u);b===void 0||b.value.view===m||(h.get(u)?.beforeView(m),T(b,{view:m,previewPrepared:b.value.previewPrepared||m==="preview"}))},preparePreview:u=>{const m=s.get(u);m!==void 0&&!m.value.previewPrepared&&T(m,{previewPrepared:!0})}}},rn=e=>{e.preventDefault(),e.stopPropagation()},Rr=e=>e.endsWith("px")?Number.parseFloat(e):Number.NaN,Cr="data-aqmx-content-pane",ft=Object.freeze({[Cr]:""}),Zs="--aqmx-dialog-left",Ws="--aqmx-dialog-top",Ks='[data-testid="markdown-explorer"]',Xs=e=>{const t=e.closest(Ks)?.querySelectorAll(`[${Cr}]`),n=t?.item(t.length-1);if(!(n instanceof HTMLElement))throw new Error("[markdown-explorer] a dialog opened where the explorer marks no content pane");return n},Ys=e=>{const t=Rr(getComputedStyle(e).marginTop);if(Number.isNaN(t))return null;const n=Xs(e),r=e.getBoundingClientRect(),o=e.ownerDocument.documentElement,{left:s,top:a}=G.centeredDialogPosition(n.getBoundingClientRect(),{width:r.width+2*t,height:r.height+2*t},{width:o.clientWidth,height:o.clientHeight});return e.style.setProperty(Zs,`${String(s)}px`),e.style.setProperty(Ws,`${String(a)}px`),n},Qs=e=>e.preventDefault(),Mr=({open:e,onOpen:t,onDismiss:n})=>{const r=c.useRef(null),o=c.useRef(null),s=c.useRef(!1),a=c.useRef(t);c.useLayoutEffect(()=>{a.current=t},[t]),c.useLayoutEffect(()=>{s.current=e;const f=r.current;if(f!==null)if(e&&!f.open){const d=f.ownerDocument.activeElement;o.current=d instanceof HTMLElement?d:null,f.showModal(),a.current?.()}else!e&&f.open&&(f.close(),o.current?.isConnected===!0&&o.current.focus(),o.current=null)},[e]),c.useLayoutEffect(()=>{const f=r.current;if(!e||f===null)return;const d=new ResizeObserver(()=>w());let g=null;const w=()=>{const E=Ys(f);E===null||E===g||(g!==null&&d.unobserve(g),d.observe(E),g=E)};w(),d.observe(f);const v=f.ownerDocument.defaultView;return v?.addEventListener("resize",w),f.ownerDocument.addEventListener("scroll",w,{capture:!0,passive:!0}),()=>{d.disconnect(),v?.removeEventListener("resize",w),f.ownerDocument.removeEventListener("scroll",w,{capture:!0})}},[e]);const i=c.useCallback(f=>{f.key!=="Escape"||f.defaultPrevented||(rn(f),n())},[n]),h=c.useCallback(f=>{f.target===f.currentTarget&&n()},[n]),p=c.useCallback(()=>{s.current&&n()},[n]);return{ref:r,onKeyDown:i,onClick:h,onCancel:Qs,onClose:p}},on=({open:e,title:t,body:n,confirmLabel:r,cancelLabel:o,onConfirm:s,onCancel:a,testId:i})=>{const h=c.useRef(null),p=c.useId(),f=c.useId(),d=c.useCallback(()=>h.current?.focus(),[]),g=Mr({open:e,onOpen:d,onDismiss:a});return l.jsx("dialog",{...g,className:"aqmx-confirm","aria-labelledby":p,"aria-describedby":f,"data-testid":i,children:l.jsxs("div",{className:"aqmx-confirm-panel",children:[l.jsx("p",{id:p,className:"aqmx-confirm-title",children:t}),l.jsx("p",{id:f,className:"aqmx-confirm-body",children:n}),l.jsxs("div",{className:"aqmx-confirm-actions",children:[l.jsx("button",{ref:h,type:"button",className:"aqmx-callout-action","data-testid":`${i}-cancel`,onClick:a,children:o}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-aqmx-tone":"danger","data-testid":`${i}-confirm`,onClick:s,children:r})]})]})})},Ge=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},Lr=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),He=e=>e.status==="fulfilled"?e.value:void 0,Or=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!1}),Js=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!0}),ea=(e,t,n)=>{const r=new Set,o=[...e].reverse();for(let s=o.pop();s!==void 0;s=o.pop()){if(s.type!=="directory"||r.has(s.path))continue;r.add(s.path);const a=s.lazy===!0?n(s.path):void 0,i=s.lazy===!0?a?.status==="loaded"?a.entries:null:s.children===void 0?[]:s.children;if(s.path===t)return i;if(i!==null)for(const h of[...i].reverse())o.push(h)}return null},Ar=(e,t,n)=>{const r=He(e.read(t));if(r===void 0||r.status==="deferred")return Or;if(r.status==="error")return{readme:{status:"failed",failure:r.failure,retry:()=>e.retry(t)},claim:!1};const o=ea(r.entries,n,a=>e.children(t,a));if(o!==null)return{readme:{status:"ok",readme:G.folderReadmeOf(o)},claim:!1};const s=e.children(t,n);return s===void 0||s.status==="loading"?Js:s.status==="failed"?{readme:{status:"failed",failure:s.failure,retry:()=>e.retryChildren(t,n)},claim:!0}:{readme:{status:"ok",readme:G.folderReadmeOf(s.entries)},claim:!0}},ta=(e,t,n)=>{const{readme:r}=Ar(e,t,n);return r.status==="ok"?r.readme:null},na=(e,t,n)=>{const r=ae.matchPath({path:`${e.basePath}/*`,end:!0},t.pathname);if(r===null)return new Set;const{location:o}=G.resolveExplorerLocation(e,r.params["*"],new URLSearchParams(t.search));switch(o.view){case"tree":{const s=o.folder===null?o.doc:n(o.source,o.folder);return new Set(s===null?[]:[s])}case"single":return new Set([o.doc]);case"multi":return new Set(o.docs)}},Dr=e=>{const{edits:t}=$(),n=c.useCallback(()=>t.session(e),[t,e]);return c.useSyncExternalStore(t.subscribe,n,ra)},Nr=()=>!1,ra=()=>{},oa=()=>{const{edits:e}=$();return c.useSyncExternalStore(e.subscribe,e.hasSessions,Nr)},_r=()=>{const{edits:e}=$();return c.useSyncExternalStore(e.subscribe,e.sideBySide,Nr)},sa=()=>null,aa=()=>{const{edits:e,labels:t,config:n,trees:r,guardUnload:o}=$(),s=c.useRef([]),a=c.useCallback(({nextLocation:v})=>{const E=na(n,v,(k,T)=>ta(r,k,T));return e.flushDrafts(),s.current=e.dirtyPaths().filter(k=>!E.has(k)),s.current.length>0},[e,n,r]),i=ae.useBlocker(a),h=oa();c.useEffect(()=>{if(!(h&&o))return;const v=E=>{e.flushDrafts(),e.dirtyPaths().length!==0&&(E.preventDefault(),E.returnValue=!0)};return window.addEventListener("beforeunload",v),()=>window.removeEventListener("beforeunload",v)},[h,e,o]);const p=c.useSyncExternalStore(e.subscribe,e.discardRequest,sa),f=i.state==="blocked";c.useEffect(()=>{p!==null&&i.state==="blocked"&&i.reset()},[p,i]);const d=p!==null?p.paths:f?s.current:[],g=d.map(v=>P.lastPathSegment(v)).join(", "),w=d.length>0&&d.every(v=>e.session(v)?.save.kind==="draft");return l.jsx(on,{open:f||p!==null,title:w?t.draftDiscardTitle:t.unsavedTitle,body:w?t.draftDiscardBody(g):t.unsavedBody(g),confirmLabel:t.unsavedDiscard,cancelLabel:t.unsavedStay,testId:"markdown-explorer-unsaved-guard",onConfirm:()=>{if(p!==null){p.settle(!0);return}i.state==="blocked"&&(e.discard(s.current),i.proceed())},onCancel:()=>{if(p!==null){p.settle(!1);return}i.state==="blocked"&&i.reset()}})},ia=async(e,t)=>{const n=await t.documents.refresh(e);if(n.status==="refreshed"||n.status==="shown"&&!n.failed){t.announcer.announce(t.labels.documentReloadedAfterChange(t.nameOf(e)));return}n.status==="failed"&&t.documentChanges.mark([e])},la=(e,t)=>{ps(e);for(const r of e.sourceIds)t.trees.reloadSource(r);const n=[];for(const r of e.paths){if(t.documents.noteChanged(r),t.edits.session(r)!==void 0||!t.documentChanges.shown(r))continue;const o=t.documents.peek(r);o?.status!=="loaded"||o.document.kind==="failure"||(t.policy==="notify"?n.push(r):ia(r,t))}n.length>0&&t.documentChanges.mark(n)};function ca({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 da=R.forwardRef(ca);let Ot=null;const jr=()=>(Ot??=Promise.resolve().then(()=>require("./EditSurface-CLG70Vnn.cjs")).catch(e=>{throw Ot=null,e}),Ot),ua=()=>{jr().catch(()=>{})},fa=e=>{const{default:t}=c.use(jr());return l.jsx(t,{...e})};class ma extends c.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 Pr="[data-aqmd-fullscreen]",ha="[data-aqmd-fullscreen-dialog]:modal",pa=e=>e instanceof Element&&e.closest(Pr)!==null,wa=e=>e.querySelector(ha)!==null,sn=`[${Ht.SOURCE_LINES_ATTRIBUTE}]`,ga="[data-aqmd-content]",va=`a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg, [data-aqmd-spreadsheet-editable], ${Pr}, [data-aqmd-svg-image-source]`,Ea=200,Ze=e=>Ht.parseSourceLines(e.getAttribute(Ht.SOURCE_LINES_ATTRIBUTE)),ya=(e,t)=>{for(let r=e;r!==null&&t.contains(r);r=r.parentElement){const o=Ze(r);if(o!==null)return{block:r,lines:o,own:!0}}let n=null;for(const r of t.querySelectorAll(sn)){if(!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))break;const o=Ze(r);o!==null&&(n={block:r,lines:o})}return n===null?null:{...n,own:!1}},xa=(e,t)=>{let n=0;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+t.length))n+=1;return n},Ir=e=>e.closest(ga)!==null&&e.closest(va)===null,Fr=(e,t,n)=>{const r=ya(e,t);if(r===null)return null;const{block:o,own:s}=r;if(!s){const i=r.lines.last+1;return{lines:{first:i,last:i},word:null,occurrence:0,clientTop:mt(e)}}const a=ba(o,n);return a===null?{lines:r.lines,word:null,occurrence:0,clientTop:mt(o)}:{lines:r.lines,word:a.text,occurrence:a.occurrence,clientTop:a.clientTop}},$r=(e,t)=>{let n=null,r=null,o=null;for(const a of e.querySelectorAll(sn)){const i=Ze(a);if(i===null)continue;n??=Br(t,a);const{top:h,bottom:p}=a.getBoundingClientRect();h<=n&&n<p?r={lines:i,block:a}:o===null&&h>=n&&(o={lines:i,block:a})}const s=r===null?o:r;return s===null?null:{lines:s.lines,word:null,occurrence:0,clientTop:mt(s.block)}},qr=e=>e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,Br=(e,t)=>{const n=Number.parseFloat(getComputedStyle(t).scrollMarginTop);return qr(e)+(Number.isFinite(n)?n:0)},ba=(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>Ea||/[\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:xa(o.toString(),r),clientTop:n.getBoundingClientRect().top}},Sa=(e,t)=>{const n=e.split(`
14
- `),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 i=r;i<=o;i+=1){const h=n[i-1]??"";for(let p=h.indexOf(t.word);p>=0;p=h.indexOf(t.word,p+t.word.length)){if(a===t.occurrence)return{line:i,column:p};a+=1}}return a>0?ka(n,r,o,t.word)??s:s},ka=(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},Ur=(e,t)=>{let n=null,r=null;for(const o of e.querySelectorAll(sn)){const s=Ze(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},Hr=(e,t)=>{const{bottom:n}=e.getBoundingClientRect(),r=mt(e),o=Ze(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},mt=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:i}=s.getBoundingClientRect();if(i>0)return a}return e.getBoundingClientRect().top},qe=(e,t)=>Object.freeze({replace:t.replace,preventScrollReset:t.preventScrollReset,defaultShouldRevalidate:!1,state:Object.freeze({aqmxNavigation:e})}),yt=Object.freeze({browse:qe("browse",{replace:!0,preventScrollReset:!0}),"close-folder":qe("close-folder",{replace:!0,preventScrollReset:!0}),"switch-source":qe("switch-source",{replace:!1,preventScrollReset:!0}),"switch-view":qe("switch-view",{replace:!1,preventScrollReset:!1}),"follow-link":qe("follow-link",{replace:!1,preventScrollReset:!1})}),Ta=Object.freeze(Object.keys(yt)),Ra=e=>yt[e],Ca=(e,t)=>{if(e===ae.NavigationType.Pop||typeof t!="object"||t===null||!("aqmxNavigation"in t))return null;const{aqmxNavigation:n}=t;return Ta.find(r=>r===n)??null},De=()=>{const e=ae.useNavigate();return c.useCallback((t,n)=>{e(t,yt[n])},[e])},Vr=({navigation:e,...t})=>l.jsx(ae.Link,{...t,...yt[e]}),an=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},zr=(e,t)=>{const n=c.useRef(null),r=c.useRef(null),o=c.useRef(null),s=c.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);c.useEffect(()=>s,[s]);const a=c.useCallback(p=>{if(r.current!==p)return;const f=o.current;if(f!==null){f.then(()=>a(p));return}e.prefetch(p);const d=e.peek(p);if(d?.status!=="pending")return;const g=Promise.allSettled([d.promise]);o.current=g,g.then(()=>{o.current===g&&(o.current=null)})},[e]),i=c.useCallback(p=>{const f=t(p);f!==r.current&&(s(),f!==null&&(r.current=f,n.current=window.setTimeout(()=>{n.current=null,a(f)},G.PREFETCH_DWELL_MS)))},[s,t,a]),h=c.useCallback(p=>{t(p)!==r.current&&s()},[s,t]);return c.useMemo(()=>({onPointerOver:p=>i(p.target),onPointerOut:p=>h(p.relatedTarget),onFocus:p=>i(p.target),onBlur:p=>h(p.relatedTarget)}),[i,h])},Ma=c.lazy(()=>Promise.resolve().then(()=>require("./NativeScrollBar-RWXpVhbI.cjs")).then(e=>({default:e.NativeScrollBar})));class La extends c.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 Gr=({scroller:e,kind:t})=>l.jsx(La,{children:l.jsx(c.Suspense,{fallback:null,children:l.jsx(Ma,{scroller:e,kind:t})})}),Zr=e=>l.jsx(Gr,{scroller:e,kind:"content"}),Wr=Object.freeze({showArrowButtons:!0,enableThumbDrag:!0,enableTrackClick:!0}),Kr=Object.freeze({showArrowButtons:!1,enableThumbDrag:!1,enableTrackClick:!1}),ln=e=>e?Kr:Wr,Oa=8,Aa="--aqmx-scroll-bar-slot-size",cn=`var(${Aa})`,dn=G.CONTROL_BLOCK_PIXELS,Da=G.FIBONACCI_SPACING_PIXELS[3],Na="--aqmx-tap-circle-gutter-size",un=`var(${Na})`,_a=-(dn+Da),Xr=Object.freeze({minSpeedMultiplier:.25,maxSpeedMultiplier:18});let Yr=null,At=null;const Xt=new Set,ja=e=>(Xt.add(e),()=>{Xt.delete(e)}),Pa=()=>{At===null&&(At=Promise.resolve().then(()=>require("./tapScrollCircle-DdX0Wri0.cjs")).then(e=>{const t=e.TAP_SCROLL_CIRCLE.renderVisual;if(t===void 0)throw new TypeError("[markdown-explorer] the bars' tap-scroll circle has no look to share");Yr=t;for(const n of[...Xt])n()}).catch(e=>{At=null,console.error("[markdown-explorer] the look of a table's tap-scroll circle failed to load; the circle still scrolls without it.",e)}))},Ia=({look:e,state:t})=>e(t),Fa=e=>{const t=c.useSyncExternalStore(ja,()=>Yr,()=>null);return c.useEffect(()=>{t===null&&Pa()},[t]),t===null?null:l.jsx(Ia,{look:t,state:e})},Qr=Object.freeze({renderVisual:e=>l.jsx(Fa,{...e}),...Xr,size:dn}),$a=Object.freeze({...Qr,visibility:"scrolling"}),Jr=e=>e?$a:Qr,eo="(pointer: coarse)",qa=e=>{const t=window.matchMedia(eo);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},Ba=()=>window.matchMedia(eo).matches,Ua=()=>!1,fn=()=>c.useSyncExternalStore(qa,Ba,Ua),to=()=>{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()]}},ht=(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)=>ht(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)&&ht(n[s],r[s]))},Ha=55e3,Mn=Object.freeze({status:"deferred"}),Dt=Object.freeze({status:"refreshed"}),Nt=Object.freeze({status:"shown",failed:!1}),ot=Object.freeze({status:"shown",failed:!0}),st=Object.freeze({status:"superseded"}),pe=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,Va=e=>e!==void 0&&e.status==="loaded"&&e.document.kind!=="failure",za=({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 ${V.describeValue(t)}`);const n=new Map,r=to(),o=Ae(),s=new WeakSet,a=new Map,i=new Map,h=new Map;let p=0;const f=o.emit,d=()=>(p+=1,p),g=()=>{if(!(n.size<=t))for(const u of[...n.keys()]){if(n.size<=t)return;r.isHeld(u)||n.delete(u)}},w=(u,m)=>{n.delete(u),n.set(u,m)},v=u=>performance.now()-u.validatedAt>=Ha,E=(u,m,b)=>{const x=n.get(u),L=pe(x?.snapshot),F=b||x?.refreshPending===!0,y=Ge(e.document(u,{refresh:F}).then(A=>({status:"loaded",document:A}))),S={snapshot:{status:"pending",promise:y,previous:L},validatedAt:performance.now(),opened:m,background:null,refreshPending:!1,seeded:void 0,stamp:d()};return w(u,S),g(),y.then(A=>{n.get(u)===S&&(S.snapshot=A,S.stamp=d(),f())}),S},k=(u,m,b,x,L,F)=>{m.background===b&&(m.background=null,!(n.get(u)!==m||m.snapshot!==x)&&(L.kind==="failure"&&x.document.kind!=="failure"||(m.validatedAt=F,m.stamp=d(),ht(x.document,L)||(m.snapshot={status:"loaded",document:L}),f())))},T=async(u,m)=>{const b=m.snapshot;if(b.status!=="loaded")return null;const x={};m.background=x;const L=performance.now(),F=e.document(u,{refresh:m.refreshPending});m.refreshPending=!1;const y=await F,S=m.background===x&&n.get(u)===m&&m.snapshot===b;return k(u,m,x,b,y,L),S?y:null},O=u=>{u.validatedAt=Number.NEGATIVE_INFINITY,u.opened=!0,u.refreshPending=!0},N=u=>{u.background=null},M=(u,m)=>{const{snapshot:b}=m;return b.status==="pending"?!1:b.status==="loaded"&&b.document.kind!=="failure"?(T(u,m),!1):(b.status==="loaded"&&s.add(b),E(u,!0,!1),!0)},C=u=>{i.delete(u);const m=h.get(u);if(m!==void 0){h.delete(u);for(const b of m)b()}},B=(u,m)=>new Promise(b=>{if(i.get(u)===m||!r.isHeld(u)){b();return}const x=h.get(u);x===void 0?h.set(u,new Set([b])):x.add(b)}),I=(u,m)=>{const b=a.get(u);if(b===void 0){m.resolve(null);return}if(b.last!==null&&b.last.stamp>=m.stamp){m.resolve(b.last);return}b.waiters.add(m)},H=async(u,m,b)=>{const x=await new Promise(L=>I(u,{stamp:m.stamp,resolve:L}));if(n.get(u)!==m)return st;if(x===null)return b?Dt:Nt;if(!b)return x.failure===null?Nt:ot;switch(x.before){case"copy":return x.failure===null?Dt:{status:"failed",failure:x.failure};case"failure":return x.failure===null?Nt:ot;case"none":return x.failure===null?Dt:ot}},_=u=>{const m={showing:"none",last:null,waiters:new Set};a.set(u,m);let b=!1;return{settle:(x,L)=>{if(b||x===void 0)return;const F={stamp:x,failure:L,before:m.showing};m.last=F,L===null?m.showing="copy":m.showing==="none"&&(m.showing="failure");for(const y of[...m.waiters])x<y.stamp||(m.waiters.delete(y),y.resolve(F))},release:()=>{if(b)return;b=!0,a.get(u)===m&&a.delete(u);const x=[...m.waiters];m.waiters.clear(),x.length>0&&queueMicrotask(()=>{for(const L of x)I(u,L)})}}},U=u=>{const m=r.hold(u);let b=!1;return()=>{if(b)return;b=!0,m();const x=n.get(u);x!==void 0&&w(u,x),g(),r.isHeld(u)||queueMicrotask(()=>{r.isHeld(u)||C(u)})}};return{peek:u=>n.get(u)?.snapshot,peekSeeded:u=>n.get(u)?.seeded,answerStampOf:u=>n.get(u)?.stamp,prefetch:u=>{const m=n.get(u);m!==void 0&&m.snapshot.status!=="deferred"||(E(u,!1,!1),f())},open:u=>{const m=r.resumes(u),b=U(u),x=n.get(u);if(x===void 0||x.snapshot.status==="deferred")return E(u,!0,!1),f(),b;if(w(u,x),m)return b;const{snapshot:L}=x;return L.status==="pending"?(x.opened=!0,b):L.document.kind==="failure"?(x.opened||v(x)?(s.add(L),E(u,!0,!1),f()):x.opened=!0,b):(x.opened=!0,x.background===null&&v(x)&&T(u,x),b)},retain:U,retry:u=>{const m=n.get(u);m===void 0||m.snapshot.status!=="loaded"||m.snapshot.document.kind!=="failure"||(E(u,!0,!1),f())},seed:(u,m)=>{const b=performance.now(),x=Ge(m.then(A=>A===null?Mn:{status:"loaded",document:A},()=>Mn)),L=n.get(u);if(L!==void 0&&L.snapshot.status==="loaded"){const A=L.snapshot,D={};L.background=D,x.then(q=>{if(q.status==="loaded"){k(u,L,D,A,q.document,b);return}L.background===D&&(L.background=null)});return}const F=L!==void 0&&L.snapshot.status==="pending"?L.snapshot.previous:null,y={status:"pending",promise:x,previous:F},S={snapshot:y,validatedAt:b,opened:L?.opened===!0,background:null,refreshPending:L?.refreshPending===!0,seeded:y,stamp:d()};w(u,S),g(),x.then(A=>{n.get(u)===S&&(A.status==="deferred"&&r.isHeld(u)?E(u,S.opened,!1):(S.snapshot=A,S.stamp=d()),f())})},invalidate:()=>{let u=!1;for(const[m,b]of[...n]){if(O(b),!r.isHeld(m)){N(b);continue}const{snapshot:x}=b;if(x.status!=="pending"){M(m,b)&&(u=!0);continue}x.promise.then(()=>{n.get(m)===b&&b.refreshPending&&r.isHeld(m)&&M(m,b)&&f()})}u&&f()},noteChanged:u=>{const m=n.get(u);if(m===void 0)return;if(O(m),!r.isHeld(u)){N(m);return}const{snapshot:b}=m;if(b.status==="pending"){E(u,m.opened,!0),f();return}b.status==="loaded"&&b.document.kind==="failure"&&(s.add(b),E(u,!0,!1),f())},refresh:async u=>{const m=n.get(u);if(m!==void 0&&Va(m.snapshot)){m.refreshPending=!0;const L=await T(u,m);return L===null?st:L.kind==="failure"?{status:"failed",failure:L.failure}:H(u,m,!0)}const b=E(u,!0,!0);if(f(),b.snapshot.status!=="pending")return st;const x=await b.snapshot.promise;return n.get(u)!==b||x.status!=="loaded"?st:x.document.kind==="failure"?ot:(await B(u,x),H(u,b,!1))},clear:()=>{n.clear();for(const u of r.heldKeys())E(u,!0,!1);f()},subscribe:o.subscribe,readPart:_,noteShown:(u,m)=>{i.set(u,m);const b=h.get(u);if(b!==void 0){h.delete(u);for(const x of b)x()}},noteFailureShown:u=>s.has(u)?!1:(s.add(u),!0)}},Ee=c.createContext("fill"),Ga="--aqmx-tap-circle-gutter",Za=Object.freeze({blockSize:"100%",[Ga]:un}),Ke=({scrollerProps:e,children:t})=>c.use(Ee)==="content"?l.jsx(Oe.HostedScrollArea,{scrollerProps:e,children:t}):l.jsx(Oe.HostedScrollArea,{scrollerProps:{...e,style:Za},rowClassName:"aqmx-document-scroll-row",renderScrollBar:Zr,barInlineSize:cn,children:t}),Wa=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),Ka=Object.freeze({className:"aqmx-document-failure","data-aqmx-document-scroller":""}),ye=({label:e,testId:t})=>l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":t,children:Wa.map(n=>l.jsx("span",{},n))}),l.jsx("p",{className:"aqmx-sr-only",children:e})]}),mn=({failure:e,onRetry:t,testId:n})=>l.jsx(Ke,{scrollerProps:Ka,children:l.jsx(ve,{failure:e,alert:!1,onRetry:t,testId:n})});function Xa({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M18 5.25a2.25 2.25 0 0 0-2.012-2.238A2.25 2.25 0 0 0 13.75 1h-1.5a2.25 2.25 0 0 0-2.238 2.012c-.875.092-1.6.686-1.884 1.488H11A2.5 2.5 0 0 1 13.5 7v7h2.25A2.25 2.25 0 0 0 18 11.75v-6.5ZM12.25 2.5a.75.75 0 0 0-.75.75v.25h3v-.25a.75.75 0 0 0-.75-.75h-1.5Z",clipRule:"evenodd"}),R.createElement("path",{fillRule:"evenodd",d:"M3 6a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H3Zm6.874 4.166a.75.75 0 1 0-1.248-.832l-2.493 3.739-.853-.853a.75.75 0 0 0-1.06 1.06l1.5 1.5a.75.75 0 0 0 1.154-.114l3-4.5Z",clipRule:"evenodd"}))}const Ya=R.forwardRef(Xa);function Qa({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M15.988 3.012A2.25 2.25 0 0 1 18 5.25v6.5A2.25 2.25 0 0 1 15.75 14H13.5v-3.379a3 3 0 0 0-.879-2.121l-3.12-3.121a3 3 0 0 0-1.402-.791 2.252 2.252 0 0 1 1.913-1.576A2.25 2.25 0 0 1 12.25 1h1.5a2.25 2.25 0 0 1 2.238 2.012ZM11.5 3.25a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 .75.75v.25h-3v-.25Z",clipRule:"evenodd"}),R.createElement("path",{d:"M3.5 6A1.5 1.5 0 0 0 2 7.5v9A1.5 1.5 0 0 0 3.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L8.44 6.439A1.5 1.5 0 0 0 7.378 6H3.5Z"}))}const Ja=R.forwardRef(Qa);function ei({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"}))}const ti=R.forwardRef(ei),ni=2e3,Ln=Object.freeze({outcome:"idle"}),ri=(e,t)=>new Promise(n=>n(e.writeText(t))),oi=({text:e})=>{const{announcer:t,labels:n}=$(),[r,o]=c.useState(Ln),s=c.useRef(0);c.useEffect(()=>{if(r.outcome==="idle")return;const h=setTimeout(()=>o(Ln),ni);return()=>clearTimeout(h)},[r]);const a=()=>{s.current+=1;const h=s.current,p=d=>{s.current===h&&(o({outcome:d}),t.announce(d==="copied"?n.copiedText:n.copyTextFailed))},f=navigator.clipboard;if(f===void 0){p("failed");return}ri(f,e).then(()=>p("copied"),d=>{console.error("[markdown-explorer] could not copy the text",d),p("failed")})},i=r.outcome==="copied"?n.copiedText:r.outcome==="failed"?n.copyTextFailed:n.copyText;return l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":n.copyText,title:i,onClick:a,"data-aqmx-copy-outcome":r.outcome,"data-testid":"markdown-explorer-file-copy",children:r.outcome==="copied"?l.jsx(Ya,{}):r.outcome==="failed"?l.jsx(ti,{}):l.jsx(Ja,{})})},no=c.createContext(null),si=()=>{const e=c.use(no);if(e===null)throw new Error("[markdown-explorer] a document's content reads its own part only inside a document pane (DocumentContentChannelContext)");return e},ai=new Set,ro=(e,t,n)=>{const{documents:r,announcer:o,labels:s}=$(),a=c.useCallback(()=>r.peek(e),[r,e]),i=c.useCallback(()=>r.peekSeeded(e),[r,e]),h=c.useSyncExternalStore(r.subscribe,a,i),p=c.useCallback(()=>r.answerStampOf(e),[r,e]),f=c.useSyncExternalStore(r.subscribe,p,p),[d]=c.useState(()=>new Set),[g,w]=c.useState(ai),[v,E]=c.useState(null);v!==null&&(v.path!==e||v.markup!==n)&&E(null);const k=c.useRef(null);c.useLayoutEffect(()=>(k.current=e,()=>{k.current=null}),[e]);const T=c.useRef(n);c.useLayoutEffect(()=>{T.current=n},[n]);const O=c.useCallback(()=>{const C=e,B=r.peek(C);d.has(C)||B?.status==="pending"||(d.add(C),w(new Set(d)),E(null),(async()=>{try{const I=await r.refresh(C);if(k.current!==C||I.status==="superseded")return;if(I.status==="failed"){E({path:C,failure:I.failure,stamp:r.answerStampOf(C),markup:T.current}),o.announce(s.documentRefreshFailed(ce(s,I.failure.reason)));return}if(I.status==="shown"&&(t||I.failed))return;const H=pe(r.peek(C));if(H===null||H.document.kind==="failure")return;o.announce(s.documentRefreshed(H.document.name))}finally{d.delete(C),w(new Set(d))}})())},[e,t,d,r,o,s]),N=g.has(e),M=v!==null&&v.path===e&&v.stamp===f&&v.markup===n?v.failure:null;return{refreshing:N,unavailable:N||h?.status==="pending",failure:M,refresh:O}},ii=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]),li=(e,t)=>{const{mediaFailures:n}=$(),[r,o]=c.useState(()=>({path:t,notices:lt}));return c.useEffect(()=>{const s=()=>{const a=e.current,i=a===null?lt:n.notices().filter(h=>a.contains(h.target));o(h=>h.path===t&&ii(h.notices,i)?h:{path:t,notices:i})};return s(),n.subscribe(s)},[n,e,t]),r.path===t?r.notices:lt},On=(e,t,n)=>{const[r]=e;return r===void 0?null:e.length===1?t(r.name):n(e.length)},_t=({kind:e,tone:t,text:n,onReload:r})=>{const{labels:o}=$(),s=c.useId();return l.jsxs("div",{className:"aqmx-callout aqmx-document-notice","data-aqmx-tone":t,"data-testid":"markdown-explorer-document-notice","data-aqmx-notice":e,children:[l.jsx("p",{id:s,className:"aqmx-callout-body",children:n}),r===null?null:l.jsx("button",{type:"button",className:"aqmx-callout-action","aria-describedby":s,onClick:r,children:o.reload})]})},ci=({path:e,name:t,editing:n,announces:r,markup:o,region:s,focusDocument:a})=>{const{labels:i,documentChanges:h,mediaFailures:p}=$(),{refresh:f}=ro(e,r,o);c.useLayoutEffect(()=>h.show(e),[h,e]);const d=c.useCallback(()=>h.changed(e),[h,e]),g=c.useSyncExternalStore(h.subscribe,d,d);c.useEffect(()=>{n&&h.dismiss(e)},[n,h,e]);const w=li(s,e),v=N=>{N.currentTarget===N.currentTarget.ownerDocument.activeElement&&a()},E=N=>{v(N),h.dismiss(e),f()},k=N=>{const M=s.current;M!==null&&(v(N),p.reload(M))},T=On(w.filter(N=>N.kind==="media-load"),i.mediaLoadFailed,i.mediaLoadFailedCount),O=On(w.filter(N=>N.kind==="media-unplayable"),i.mediaUnplayable,i.mediaUnplayableCount);return l.jsxs("div",{className:"aqmx-document-notices",role:"status","aria-live":"polite","aria-atomic":"false","data-testid":"markdown-explorer-document-notices",children:[g&&!n?l.jsx(_t,{kind:"changed",tone:"info",text:i.documentChangedElsewhere(t),onReload:E}):null,T===null?null:l.jsx(_t,{kind:"media-load",tone:"warning",text:T,onReload:k}),O===null?null:l.jsx(_t,{kind:"media-unplayable",tone:"warning",text:O,onReload:null})]})};function di({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 ui=R.forwardRef(di);function fi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 mi=R.forwardRef(fi),Xe=({name:e,openUrl:t,downloadUrl:n,icon:r,children:o})=>{const{labels:s}=$();return l.jsxs("div",{className:"aqmx-document-toolbar",children:[l.jsx("span",{className:"aqmx-document-file-icon","aria-hidden":"true",children:r}),l.jsx("span",{className:"aqmx-document-title",title:e,"data-testid":"markdown-explorer-file-name",children:e}),o,l.jsx("a",{className:"aqmx-icon-button",href:t,target:"_blank",rel:"noopener noreferrer","aria-label":s.openInNewTab,title:s.openInNewTab,"data-testid":"markdown-explorer-file-open",children:l.jsx(mi,{})}),l.jsx("a",{className:"aqmx-icon-button",href:n,download:e,"aria-label":s.download,title:s.download,"data-testid":"markdown-explorer-file-download",children:l.jsx(ui,{})})]})};function hi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 pi=R.forwardRef(hi),wi=Object.freeze({className:"aqmx-document-stage"}),gi=({document:e})=>{const{labels:t}=$();return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[l.jsx(Xe,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(pi,{})}),l.jsx(Ke,{scrollerProps:wi,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})]})})]})},An=["keydown","pointerdown","wheel","touchstart"],ct=new WeakMap,pt=new WeakMap,vi=e=>{const t=pt.get(e);if(t!==void 0){t.count+=1;return}pt.set(e,{count:1,original:e.style.overflowAnchor}),e.style.overflowAnchor="none"},Ei=e=>{const t=pt.get(e);t!==void 0&&(t.count-=1,!(t.count>0)&&(pt.delete(e),e.style.overflowAnchor=t.original))},yi=(e,t,n)=>{for(let r=t;r!==null&&r!==n;r=r.parentElement){e.observe(r);for(let o=r.previousElementSibling;o!==null;o=o.previousElementSibling)e.observe(o)}},xi=e=>{const t=new Map;for(let n=e.parentElement;n!==null;n=n.parentElement)t.set(n,{top:n.scrollTop,left:n.scrollLeft});return t},oo=e=>{ct.get(e)?.()},so=(e,t,n)=>{oo(e);let r=new Map;const o=new Set,s=()=>{const d=t();return d===null?!1:(r=xi(d),!0)};if(!s()||typeof ResizeObserver>"u")return;const a=()=>{for(const d of r.keys())!(d instanceof HTMLElement)||o.has(d)||(o.add(d),vi(d))};a();const{ownerDocument:i}=e,h=new ResizeObserver(()=>{if(!s()){f();return}a()});for(const{element:d,boundary:g}of n)yi(h,d,g);const p=d=>{const g=d.target===i?i.scrollingElement:d.target;if(!(g instanceof Element))return;const w=r.get(g);w!==void 0&&(g.scrollTop!==w.top||g.scrollLeft!==w.left)&&f()},f=()=>{h.disconnect();for(const d of An)i.removeEventListener(d,f,!0);i.removeEventListener("scroll",p,!0);for(const d of o)Ei(d);o.clear(),ct.get(e)===f&&ct.delete(e)};for(const d of An)i.addEventListener(d,f,{capture:!0,passive:!0});i.addEventListener("scroll",p,{capture:!0,passive:!0}),ct.set(e,f)},xt="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",bi=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},Si=/(%[0-9A-Fa-f]{2})/u,hn=e=>{if(!e.startsWith("#")||e.length===1)return null;const t=new TextEncoder,n=e.slice(1).split(Si).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))},ao=e=>`#${encodeURIComponent(e)}`,ki=e=>{if(e==="#")return!0;const t=hn(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},io=(e,t)=>{if(t==="")return null;for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},Ti="http://www.w3.org/1999/xhtml",Dn=(e,t)=>{if(t==="")return null;const n=io(e,t);if(n!==null)return n;for(const r of e.querySelectorAll("a[name]"))if(r.localName==="a"&&r.namespaceURI===Ti&&r.getAttribute("name")===t)return r;return null},lo=(e,t)=>{if(e===null||!t.startsWith("#"))return null;const n=Dn(e,t.slice(1));if(n!==null)return n;const r=hn(t);return r===null?null:Dn(e,r)},Nn=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"},Ri=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"},Ci=(e,t)=>{const n=t.closest(xt),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&Nn(r))return r;const o=e.getBoundingClientRect().height,{documentElement:s,scrollingElement:a}=e.ownerDocument;for(let i=e.parentElement;i!==null&&i!==s;i=i.parentElement)if(Nn(i)&&i.scrollHeight>i.clientHeight&&i.clientHeight<o)return i;return a instanceof Element&&Ri(e.ownerDocument)&&a.scrollHeight>a.clientHeight&&a.clientHeight<o?a:r},Mi=Object.freeze({scrollerOf:Ci,reveal:e=>{e.scrollIntoView(wt)},keepAtStart:(e,t)=>{so(e,()=>t.isConnected?(co(e,t),t):null,[{element:t,boundary:e}])}}),wt=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),Li=(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")}}},co=(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(),i=a.height+s+Number.parseFloat(o)>e.clientHeight;if(!i&&Math.abs(a.top-s-n)<1){t.scrollIntoView(wt);return}e.scrollBy({top:i?a.top-n-e.clientHeight:a.bottom-n+e.clientHeight,behavior:"instant"}),t.scrollIntoView(wt)},Oi=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(xt)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},_n=(e,t,n)=>{if(e===null)return null;const r=lo(e,t);return r===null?(ki(t)&&Oi(e,n),null):(Li(e,r),n.keepAtStart(n.scrollerOf(e,r),r),r)};function Ai({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Di=R.forwardRef(Ai);function Ni({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 _i=R.forwardRef(Ni);function ji({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Pi=R.forwardRef(ji);function Ii({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Fi=R.forwardRef(Ii),Yt="data-aqmx-key-repeat",gt=Object.freeze({[Yt]:"allow"}),$i=`[${Yt}="${gt[Yt]}"]`,qi=()=>{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($i)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},dt=Object.freeze([1/G.GOLDEN_RATIO**2,1/G.GOLDEN_RATIO,1,G.GOLDEN_RATIO,G.GOLDEN_RATIO**2]),jn=Object.freeze({mode:"fit"}),Bi=1,uo=Object.freeze({className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas"}),Pn=`[data-testid="${uo["data-testid"]}"]`,fo=c.createContext(null),Ui=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=Bi?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,In=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<dt.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?dt.findIndex(o=>o>t):dt.findLastIndex(o=>o<t);return r===-1?null:r},Fn=(e,t,n)=>{if(e.mode==="level"){const o=In(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=In(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},Hi=(e,t)=>{if(e<=0||t<=0)return 0;const n=Math.trunc(Math.log(t/e)/Math.log(G.GOLDEN_RATIO));return n===0?0:n},$n=e=>{const t=e[0],n=e[1];return e.length!==2||t===void 0||n===void 0?null:{distance:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),middle:{x:(t.clientX+n.clientX)/2,y:(t.clientY+n.clientY)/2}}},Vi=e=>{const t=dt[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${V.describeValue(e)}`);return t},qn=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},zi=({document:e})=>{const{labels:t}=$(),n=c.use(fo),[r]=c.useState(()=>n===null?null:n.read(e.url)),[o,s]=c.useState(r===null?jn:r.zoom),[a,i]=c.useState(r===null?null:r.reported),[h,p]=c.useState(null),f=c.useRef(null),d=c.useCallback(M=>{const{naturalWidth:C,naturalHeight:B}=M;i(I=>qn(I,C,B))},[]),g=c.useCallback(M=>{f.current=M,!(M===null||!M.complete)&&(M.naturalWidth>0||M.naturalHeight>0?d(M):M.decode().then(()=>d(M),()=>{}))},[d]);c.useEffect(()=>{n!==null&&a!==null&&n.save(e.url,{zoom:o,reported:a})},[n,e.url,o,a]),c.useLayoutEffect(()=>{const M=f.current;if(M===null||a===null||o.mode!=="fit")return;const C=()=>p(I=>qn(I,M.clientWidth,M.clientHeight));if(C(),typeof ResizeObserver>"u")return;const B=new ResizeObserver(C);return B.observe(M),()=>B.disconnect()},[a,o.mode]);const w=a===null||h===null?null:Ui(a,h),v=Fn(o,w,-1),E=Fn(o,w,1),k=o.mode==="level"?Vi(o.index):null,T=c.useRef({zoomIn:E,zoomOut:v});c.useLayoutEffect(()=>{T.current={zoomIn:E,zoomOut:v}});const O=c.useRef(null);c.useLayoutEffect(()=>{const M=O.current,C=f.current?.closest(Pn);O.current=null,!(M===null||C===null||C===void 0)&&(C.scrollLeft=M.across*C.scrollWidth-M.x,C.scrollTop=M.down*C.scrollHeight-M.y)},[o]),c.useEffect(()=>{const M=f.current?.closest(Pn);if(M==null)return;let C=null;const B=_=>{const U=$n(_.touches);C=U===null?null:{distance:U.distance,steps:0}},I=_=>{const U=$n(_.touches);if(C===null||U===null)return;_.preventDefault();const Z=Hi(C.distance,U.distance);if(Z===C.steps)return;const Q=Z>C.steps?1:-1,u=Q===1?T.current.zoomIn:T.current.zoomOut;if(u===null)return;C.steps+=Q;const m=M.getBoundingClientRect(),b=U.middle.x-m.left,x=U.middle.y-m.top;O.current=M.scrollWidth>0&&M.scrollHeight>0?{x:b,y:x,across:(M.scrollLeft+b)/M.scrollWidth,down:(M.scrollTop+x)/M.scrollHeight}:null,s(u)},H=_=>{_.touches.length<2&&(C=null)};return M.addEventListener("touchstart",B,{passive:!0}),M.addEventListener("touchmove",I,{passive:!1}),M.addEventListener("touchend",H,{passive:!0}),M.addEventListener("touchcancel",H,{passive:!0}),()=>{M.removeEventListener("touchstart",B),M.removeEventListener("touchmove",I),M.removeEventListener("touchend",H),M.removeEventListener("touchcancel",H)}},[]);const N=o.mode==="level"&&k!==null?{width:`${o.base.width*k}px`,height:`${o.base.height*k}px`}:void 0;return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[l.jsxs(Xe,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(Fi,{}),children:[l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":v===null,onClick:()=>{v!==null&&s(v)},...gt,children:l.jsx(_i,{})}),l.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:k===null?t.imageFitLevel:t.imageZoomLevel(Math.round(k*100))}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":E===null,onClick:()=>{E!==null&&s(E)},...gt,children:l.jsx(Pi,{})}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>s(jn),children:l.jsx(Di,{})})]}),l.jsx(Ke,{scrollerProps:uo,children:l.jsx("img",{ref:g,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:N,onLoad:M=>d(M.currentTarget),"data-testid":"markdown-explorer-image"})})]})},Gi=async(e,t,n)=>{const r=await e.text(t,n);if(!("kind"in r))throw n.reason;return r.kind==="text"?{kind:"text",text:r.text,truncated:r.truncated}:{kind:"failure",retryable:r.failure.reason==="failed"}},mo=c.createContext(null),ho=c.createContext(void 0),bt=c.createContext(void 0),po=c.createContext(null),St=()=>{const e=c.use(mo);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},Zi=()=>{const e=c.use(po);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},kt=(e,t,n,r)=>t.kind==="panel"?G.explorerHref(e,{view:"tree",source:n,doc:r}):t.view==="single"?G.explorerHref(e,{view:"single",source:n,doc:r,overrides:t.overrides,embed:t.embed}):G.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides}),wo=(e,t,n,r)=>t.view==="tree"?G.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides,maximized:t.maximized()}):kt(e,t,n,r),Wi=({children:e})=>{const{config:t}=$(),n=St(),r=Et(),o=r.kind==="location"?r.location.source:void 0,s=ae.useHref(kt(t,n.navigation,o,n.currentPath));return l.jsx(bt,{value:o,children:l.jsx(po,{value:s,children:e})})},Ki='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',Xi=e=>{const t=e instanceof Element?e.closest(Ki):null;return t===null?null:t.getAttribute("data-doc-path")},Ye=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,Yi=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:s,onDocumentLink:a,scope:i,children:h})=>{const p=ae.useHref(e),f=d=>{if(Ye(d)){if(d.preventDefault(),t===i.currentPath&&n!==""){i.scrollWithin(n);return}a(t,n)}};return l.jsx("a",{...s,href:p,className:o,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":r,onClick:f,children:h})},Qi=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:s})=>{const{config:a}=$(),i=St(),h=c.use(bt),p=De(),f=bi(e),{navigation:d}=i,g=`${kt(a,d,h,t)}${f}`,w=n===!1?"false":void 0;if(d.kind==="page"){const v=E=>{if(!Ye(E))return;const k=`${wo(a,d,h,t)}${f}`;k!==g&&(E.preventDefault(),p(k,"follow-link"))};return l.jsx(Vr,{...o,to:g,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":w,onClick:v,children:s})}return l.jsx(Yi,{to:g,docPath:t,fragment:f,exists:w,className:r,attributes:o,onDocumentLink:d.onDocumentLink,scope:i,children:s})},Ji=({className:e,attributes:t,children:n})=>{const{labels:r,locale:o}=$(),s=c.use(ho),{lang:a,dir:i,...h}=t,p=a??s;return l.jsxs("a",{...h,className:e===void 0?"aqmx-document-inert-link":`${e} aqmx-document-inert-link`,title:r.inertLink,lang:p===void 0?void 0:o,"data-link-kind":"doc","data-doc-exists":"false",children:[l.jsx("span",{lang:p,dir:i,children:n}),l.jsxs("span",{className:"aqmx-sr-only",children:[" (",r.inertLink,")"]})]})},el=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:s}=$(),a=c.use(bt),i=ae.useHref(`${kt(s,r.navigation,a,r.currentPath)}${e}`),h=p=>{Ye(p)&&(p.preventDefault(),r.scrollWithin(e))};return l.jsx("a",{...n,href:i,className:t,onClick:h,children:o})},tl=({href:e,className:t,attributes:n,children:r})=>{const o=St();if(o.navigation.kind==="page"){const s=a=>{Ye(a)&&(e==="#"?o.followEmptyFragment(a.nativeEvent):o.followFragmentJump(e,a.nativeEvent))};return l.jsx("a",{...n,href:e,className:t,onClick:s,children:r})}return l.jsx(el,{href:e,className:t,attributes:n,scope:o,children:r})},nl=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:s,children:a})=>t==="doc"?n===void 0||!P.isAcceptableDocumentPath(n)?l.jsx(Ji,{className:o,attributes:s,children:a}):l.jsx(Qi,{href:e,docPath:n,docExists:r,className:o,attributes:s,children:a}):e.startsWith("#")?l.jsx(tl,{href:e,className:o,attributes:s,children:a}):l.jsx("a",{...s,href:e,className:o,children:a}),rl=()=>{const{config:e}=$(),t=St(),n=c.use(bt),r=De();return c.useCallback((o,s)=>{if(!Ye(s))return!0;s.preventDefault();const a=ao(o.id),{navigation:i}=t;return i.kind==="panel"||hn(s.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(a),!0):(r(`${wo(e,i,n,t.currentPath)}${a}`,"follow-link"),!0)},[e,t,n,r])},ol=()=>{const e=Zi();return c.useCallback(t=>`${e}${ao(t.id)}`,[e])};function sl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 al=R.forwardRef(sl);function il({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 ll=R.forwardRef(il);function cl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 dl=R.forwardRef(cl),ul=Object.freeze({className:"aqmx-document-stage"}),fl=()=>()=>{},ml=()=>navigator.pdfViewerEnabled!==!1,hl=()=>null,pl=({document:e})=>{const{labels:t,mediaFailures:n}=$(),r=c.useSyncExternalStore(fl,ml,hl),o=c.useCallback(()=>n.pdfGeneration(e.url),[n,e.url]),s=c.useSyncExternalStore(n.subscribe,o,o),a=c.useCallback(i=>n.registerPdfFrame(e.url,i),[n,e.url]);return r===null?null:r?l.jsx("iframe",{ref:a,className:"aqmx-document-frame",src:e.url,title:e.name,"data-testid":"markdown-explorer-media-player"},s):l.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-pdf-not-shown",children:[l.jsx("p",{className:"aqmx-callout-body",children:t.pdfNotShown}),l.jsxs("div",{className:"aqmx-callout-actions",children:[l.jsx("a",{className:"aqmx-callout-action",href:e.url,target:"_blank",rel:"noopener noreferrer","data-testid":"markdown-explorer-pdf-not-shown-open",children:t.openInNewTab}),l.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-pdf-not-shown-download",children:t.download})]})]})},wl=e=>{switch(e){case"video":return l.jsx(ll,{});case"audio":return l.jsx(dl,{});case"pdf":return l.jsx(al,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${V.describeValue(t)}`)}}},gl=({document:e})=>{const{labels:t}=$();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(pl,{document:e});default:{const n=e.mediaType;throw new RangeError(`[markdown-explorer] unknown media type ${V.describeValue(n)}`)}}},vl=({document:e})=>l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[l.jsx(Xe,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:wl(e.mediaType)}),l.jsx(Ke,{scrollerProps:ul,children:l.jsx(gl,{document:e})})]}),pn=e=>{switch(e.kind){case"markdown":return"markdown";case"image":return e.imageType==="svg"?"svg":null;case"spreadsheet":return e.format==="workbook"?null:e.format;default:return null}},El=e=>{const{documents:t}=$(),n=c.useCallback(()=>t.peek(e),[t,e]),r=c.useCallback(()=>t.peekSeeded(e),[t,e]),o=c.useSyncExternalStore(t.subscribe,n,r),s=pe(o);return s===null?null:pn(s.document)},go=e=>{const{config:t}=$(),n=De(),r=c.useCallback(()=>n(G.explorerHref(t,{...e,markup:!e.markup}),"browse"),[t,n,e]);return c.useMemo(()=>({shown:e.markup,toggle:r}),[e.markup,r])};function yl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M.99 5.24A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25l.01 9.5A2.25 2.25 0 0 1 16.76 17H3.26A2.267 2.267 0 0 1 1 14.74l-.01-9.5Zm8.26 9.52v-.625a.75.75 0 0 0-.75-.75H3.25a.75.75 0 0 0-.75.75v.615c0 .414.336.75.75.75h5.373a.75.75 0 0 0 .627-.74Zm1.5 0a.75.75 0 0 0 .627.74h5.373a.75.75 0 0 0 .75-.75v-.615a.75.75 0 0 0-.75-.75H11.5a.75.75 0 0 0-.75.75v.625Zm6.75-3.63v-.625a.75.75 0 0 0-.75-.75H11.5a.75.75 0 0 0-.75.75v.625c0 .414.336.75.75.75h5.25a.75.75 0 0 0 .75-.75Zm-8.25 0v-.625a.75.75 0 0 0-.75-.75H3.25a.75.75 0 0 0-.75.75v.625c0 .414.336.75.75.75H8.5a.75.75 0 0 0 .75-.75ZM17.5 7.5v-.625a.75.75 0 0 0-.75-.75H11.5a.75.75 0 0 0-.75.75V7.5c0 .414.336.75.75.75h5.25a.75.75 0 0 0 .75-.75Zm-8.25 0v-.625a.75.75 0 0 0-.75-.75H3.25a.75.75 0 0 0-.75.75V7.5c0 .414.336.75.75.75H8.5a.75.75 0 0 0 .75-.75Z",clipRule:"evenodd"}))}const xl=R.forwardRef(yl),bl=100,Sl=32767,ut=Object.freeze({maxCells:xn.SPREADSHEET_MAX_OPERATION_CELLS,maxColumns:xn.SPREADSHEET_MAX_OPERATION_CELLS/bl,maxCellLength:Sl}),vo=44,Eo=10,yo=13,at='"',Bn=(e,t)=>{let n=t;for(;n<e.length;){const r=e.charCodeAt(n);if(r===vo||r===Eo||r===yo)return n;n+=1}return n};function*kl(e,t){let n=[],r=0;for(;;){let o;if(e.startsWith(at,r)){o="";let a=r+1;for(;;){const h=e.indexOf(at,a);if(h<0){o+=e.slice(a),r=e.length;break}if(o+=e.slice(a,h),e.startsWith(at,h+1)){o+=at,a=h+2;continue}r=h+1;break}const i=Bn(e,r);o+=e.slice(r,i),r=i}else{const a=Bn(e,r);o=e.slice(r,a),r=a}if(n.push(o),r>=e.length){t==="whole"&&(yield n);return}const s=e.charCodeAt(r);if(r+=1,s!==vo&&(yield n,n=[],s===yo&&e.charCodeAt(r)===Eo&&(r+=1),r>=e.length))return}}const Tl=(e,t,n)=>t==="csv"?kl(e,n):n==="whole"?Vt.iterateTsvRows(e):Vt.iterateTsvPrefixRows(e),Rl=(e,t)=>{if(e.length<=t)return e;const n=e.charCodeAt(t-1);return e.slice(0,n>=55296&&n<=56319?t-1:t)},xo=(e,t)=>{const n=[];let r=0,o=!1,s=!1;for(const i of e){const h=i.length>t.maxColumns?i.slice(0,t.maxColumns):i,p=Math.max(r,h.length);if((n.length+1)*p>t.maxCells){s=!0;break}const f=h.some(d=>d.length>t.maxCellLength)?h.map(d=>Rl(d,t.maxCellLength)):h;f!==i&&(o=!0),n.push(f),r=p}return{rows:n.map(i=>i.length===r?i:[...i,...Array(r-i.length).fill("")]),truncated:s||o,full:s}},jt=(e,t,n,r,o)=>{const s=G.decodeText(e,t,r);if(s===null)return{kind:"unreadable",code:"encoding",encodings:G.textEncodingsOf(e,t,r)};if(s.includes("\0"))return{kind:"unreadable",code:"binary"};const a=xo(Tl(s,n,t?"whole":"prefix"),o);return t?a.truncated||a.rows.some(i=>i.some(h=>h!==""))?{kind:"table",table:a}:{kind:"empty"}:a.rows.length===0?{kind:"unreadable",code:"long-row"}:{kind:"table",table:{...a,truncated:!0}}},Cl=Object.freeze({maxPartBytes:64*1024*1024,maxSheets:256}),bo=e=>{const t=[];let n=0,r=!1;const o=s=>{if(r)return;const a=Math.max(n,Math.min(s.length,e.maxColumns));(t.length+1)*a>e.maxCells&&(r=!0),t.push(s),n=a};return{addRow:(s,a,i)=>{if(a.size===0||r)return;let h=-1;for(const d of a.keys())d>h&&(h=d);const p=Array(Math.min(h,e.maxColumns)+1).fill("");for(const[d,g]of a)d<=e.maxColumns&&(p[d]=g);const f=Math.min(p.length,e.maxColumns);if(n===0&&(s+1)*f>e.maxCells){const d=Math.floor(e.maxCells/f);for(;t.length<d;)t.push([]);o(p);return}for(;t.length<s&&!r;)o([]);for(let d=0;d<i&&!r;d+=1)o(d===0?p:[...p])},full:()=>r,table:()=>xo(t,e)}},Ml=e=>{const t=Array.from(e.currentTarget.querySelectorAll('[role="tab"]')),n=e.target instanceof HTMLButtonElement?t.indexOf(e.target):-1;if(n===-1)return;const r=getComputedStyle(e.currentTarget).direction==="rtl"?"ArrowRight":"ArrowLeft",o=r==="ArrowLeft"?"ArrowRight":"ArrowLeft",s=e.key===o?(n+1)%t.length:e.key===r?(n-1+t.length)%t.length:e.key==="Home"?0:e.key==="End"?t.length-1:null;s!==null&&(e.preventDefault(),t[s]?.focus())},Ll=({names:e,selected:t,onSelect:n,label:r,tabIdOf:o,panelId:s})=>l.jsx("div",{role:"tablist","aria-label":r,className:"aqmx-sheet-tabs","data-testid":"markdown-explorer-spreadsheet-sheets",onKeyDown:Ml,children:e.map((a,i)=>l.jsx("button",{type:"button",role:"tab",id:o(i),"aria-selected":i===t,"aria-controls":s,tabIndex:i===t?0:-1,className:"aqmx-sheet-tab","data-aqmx-sheet-tab":i,onClick:()=>n(i),children:a},i))}),So=64*1024,Ol=e=>{let t=new Uint8Array(Math.min(e,So)),n=0;return{append:r=>{if(n+r.byteLength>t.byteLength){const o=new Uint8Array(Math.min(e,Math.max(t.byteLength*2,n+r.byteLength)));o.set(t.subarray(0,n)),t=o}t.set(r,n),n+=r.byteLength},bytes:()=>t.subarray(0,n),length:()=>n}},Al=async e=>{for(;;){const{done:t,value:n}=await e.read();if(t)return!0;if(n.byteLength>0)return!1}},Dl=async(e,t)=>{const{format:n,legacyEncoding:r,maxBytes:o,budget:s}=t,a=e.getReader(),i=Ol(o);let h=So;try{for(;;){const{done:p,value:f}=await a.read();if(p)return jt(i.bytes(),!0,n,r,s);const d=o-i.length();if(i.append(f.byteLength>d?f.subarray(0,d):f),i.length()===o){const w=f.byteLength<=d&&await Al(a);return jt(i.bytes(),w,n,r,s)}if(i.length()<h)continue;h=i.length()*2;const g=jt(i.bytes(),!1,n,r,s);if(g.kind==="unreadable"&&g.code!=="long-row"||g.kind==="table"&&g.table.full)return g}}finally{a.cancel().catch(()=>{})}},ko=async(e,t,n,r)=>{const o=await e.asset(P.explorerPlainTextHref(t),r);if(o.status==="cancelled")return null;if(o.status==="error")return{kind:"failure",failure:o.failure};let s;try{s=await Dl(o.body,n)}catch{return r.aborted?null:{kind:"failure",failure:{reason:"failed"}}}return r.aborted?null:s.kind==="table"?{kind:"table",rows:s.table.rows,truncated:s.table.truncated}:s},wn=(e,t,n)=>{const{documents:r,labels:o}=$(),s=si(),a=c.useCallback(()=>r.answerStampOf(e),[r,e]),i=c.useSyncExternalStore(r.subscribe,a,a),[h,p]=c.useState(0),f=c.useMemo(()=>({read:n,stamp:i,attempt:h}),[n,i,h]),[d,g]=c.useState({settled:null,shown:null,failure:null}),w=c.useRef(null),v=c.useEffectEvent((T,O)=>{if(w.current?.settle(O.stamp,T.kind==="failure"?T.failure:null),T.kind==="read"){g({settled:O,shown:T.value,failure:null});return}if(d.shown!==null){g({settled:O,shown:d.shown,failure:null});return}g({settled:O,shown:null,failure:T.failure}),s.announceFailure(o.documentFailed(t,ce(o,T.failure.reason)))});c.useEffect(()=>{const T=s.readPart();return w.current=T,()=>{w.current=null,T.release()}},[s]),c.useEffect(()=>{const T=new AbortController;return f.read(T.signal).then(O=>{O!==null&&!T.signal.aborted&&v(O,f)}),()=>T.abort()},[f]);const E=d.settled!==f&&(d.shown!==null||d.failure!==null);c.useLayoutEffect(()=>E?s.holdBusy():void 0,[E,s]);const k=c.useCallback(()=>p(T=>T+1),[]);return{shown:d.shown,failure:d.failure,retry:k}},To=(e,t)=>{const n={};for(const r of Object.keys(Le.SPREADSHEET_BLOCK_LABEL_CATALOGS[t])){const o=e[tn(r)];o!==Le.SPREADSHEET_BLOCK_LABEL_CATALOGS[t][r].text&&(n[r]=o)}return n},Nl=(e,t)=>Object.fromEntries(Object.entries(To(e,t)).map(([n,r])=>[`spreadsheet${n.charAt(0).toUpperCase()}${n.slice(1)}`,r])),_l=(e,t)=>({...Nl(e,t),loading:e.viewerLoading,errorPrefix:e.viewerErrorPrefix,styleTitle:e.viewerStyleTitle,selectStyleAria:e.viewerSelectStyle,pinStyleAria:e.viewerPinStyle,unpinStyleAria:e.viewerUnpinStyle,styleSectionTitle:e.viewerStyleSectionTitle,measureTitle:e.viewerMeasureTitle,colorsTitle:e.viewerColorsTitle,measureFill:e.viewerMeasureFill,measureReading:e.viewerMeasureReading,colorsDefault:e.viewerColorsDefault,colorsSepia:e.viewerColorsSepia,colorsDarkLowGlare:e.viewerColorsDarkLowGlare,colorsHighContrast:e.viewerColorsHighContrast,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,mermaidInteractionModeTouch:e.viewerMermaidInteractionModeTouch,mermaidModeNone:e.viewerMermaidModeNone,mermaidModeZoom:e.viewerMermaidModeZoom,mermaidModePan:e.viewerMermaidModePan,mermaidModePanShift:e.viewerMermaidModePanShift,mermaidModeBoth:e.viewerMermaidModeBoth,mermaidModeBothShift:e.viewerMermaidModeBothShift,mermaidModeNoneTouch:e.viewerMermaidModeNoneTouch,mermaidModeZoomTouch:e.viewerMermaidModeZoomTouch,mermaidModePanTouch:e.viewerMermaidModePanTouch,mermaidModeBothTouch:e.viewerMermaidModeBothTouch,mermaidZoomIn:e.viewerMermaidZoomIn,mermaidZoomOut:e.viewerMermaidZoomOut,mermaidResetView:e.viewerMermaidResetView,mermaidPanUp:e.viewerMermaidPanUp,mermaidPanDown:e.viewerMermaidPanDown,mermaidPanLeft:e.viewerMermaidPanLeft,mermaidPanRight:e.viewerMermaidPanRight,mermaidFullscreen:e.viewerMermaidFullscreen,mermaidExitFullscreen:e.viewerMermaidExitFullscreen,mermaidFullscreenDialog:e.viewerMermaidFullscreenDialog,mermaidDiagram:e.viewerMermaidDiagram,mermaidRetry:e.viewerMermaidRetry,mermaidLoading:e.viewerMermaidLoading,mermaidInitializationFailed:e.viewerMermaidInitializationFailed,mermaidRenderFailed:e.viewerMermaidRenderFailed,mermaidEmptyDrawing:e.viewerMermaidEmptyDrawing,mermaidSource:e.viewerMermaidSource,mermaidSourceRegion:e.viewerMermaidSourceRegion,mermaidCopySource:e.viewerMermaidCopySource,mermaidCopiedSource:e.viewerMermaidCopiedSource,mermaidCopySourceFailed:e.viewerMermaidCopySourceFailed,mermaidTypeC4:e.viewerMermaidTypeC4,mermaidTypeFlowchart:e.viewerMermaidTypeFlowchart,mermaidTypeSwimlane:e.viewerMermaidTypeSwimlane,mermaidTypeEntityRelationship:e.viewerMermaidTypeEntityRelationship,mermaidTypeGitGraph:e.viewerMermaidTypeGitGraph,mermaidTypeGantt:e.viewerMermaidTypeGantt,mermaidTypeInfo:e.viewerMermaidTypeInfo,mermaidTypePie:e.viewerMermaidTypePie,mermaidTypeQuadrantChart:e.viewerMermaidTypeQuadrantChart,mermaidTypeXyChart:e.viewerMermaidTypeXyChart,mermaidTypeRequirement:e.viewerMermaidTypeRequirement,mermaidTypeSequence:e.viewerMermaidTypeSequence,mermaidTypeClass:e.viewerMermaidTypeClass,mermaidTypeState:e.viewerMermaidTypeState,mermaidTypeJourney:e.viewerMermaidTypeJourney,mermaidTypeTimeline:e.viewerMermaidTypeTimeline,mermaidTypeMindmap:e.viewerMermaidTypeMindmap,mermaidTypeKanban:e.viewerMermaidTypeKanban,mermaidTypeSankey:e.viewerMermaidTypeSankey,mermaidTypePacket:e.viewerMermaidTypePacket,mermaidTypeRadar:e.viewerMermaidTypeRadar,mermaidTypeBlock:e.viewerMermaidTypeBlock,mermaidTypeTreeView:e.viewerMermaidTypeTreeView,mermaidTypeArchitecture:e.viewerMermaidTypeArchitecture,mermaidTypeEventModeling:e.viewerMermaidTypeEventModeling,mermaidTypeIshikawa:e.viewerMermaidTypeIshikawa,mermaidTypeVenn:e.viewerMermaidTypeVenn,mermaidTypeTreemap:e.viewerMermaidTypeTreemap,mermaidTypeWardley:e.viewerMermaidTypeWardley,mermaidTypeCynefin:e.viewerMermaidTypeCynefin,mermaidTypeRailroad:e.viewerMermaidTypeRailroad,embeddedVideo:e.viewerEmbeddedVideo,embeddedPost:e.viewerEmbeddedPost,embeddedFrame:e.viewerEmbeddedFrame,blockFailed:e.viewerBlockFailed,svgImageToolbar:e.viewerSvgImageToolbar,svgImageSource:e.viewerSvgImageSource,svgImageSourceRegion:e.viewerSvgImageSourceRegion,svgImageLoading:e.viewerSvgImageLoading,svgImageFailed:e.viewerSvgImageFailed,svgImageRetry:e.viewerSvgImageRetry,svgImageTruncated:e.viewerSvgImageTruncated,svgImageCopy:e.viewerSvgImageCopy,svgImageCopied:e.viewerSvgImageCopied,svgImageCopyFailed:e.viewerSvgImageCopyFailed,svgImageCopyImage:e.viewerSvgImageCopyImage,svgImageCopiedImage:e.viewerSvgImageCopiedImage,svgImageCopyImageFailed:e.viewerSvgImageCopyImageFailed,svgImageFullscreen:e.viewerSvgImageFullscreen,svgImageExitFullscreen:e.viewerSvgImageExitFullscreen,svgImageFullscreenDialog:e.viewerSvgImageFullscreenDialog,codeBlockCopy:e.viewerCodeBlockCopy,codeBlockCopied:e.viewerCodeBlockCopied,codeBlockCopyFailed:e.viewerCodeBlockCopyFailed,displayMathCopy:e.viewerDisplayMathCopy,displayMathCopied:e.viewerDisplayMathCopied,displayMathCopyFailed:e.viewerDisplayMathCopyFailed}),Ro=(e,t,n)=>t!==void 0?t:n!==void 0?n:e.defaultDocumentStyle,Co=(e,t)=>e!==void 0?e:t!==void 0?t:is.DEFAULT_CONTENT_ALIGN;class ne extends Error{refusal;constructor(t,n){super(n),this.name="WorkbookError",this.refusal=t}}const jl=new Map([["lt","<"],["gt",">"],["amp","&"],["quot",'"'],["apos","'"]]),Pl=/&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z_][A-Za-z0-9._-]*);/gu,Il=/([^\s=/>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gu,Fl=/^[^\s/>]+/u,Ce=e=>{throw new ne("not-workbook",`the XML ${e}`)},Un=e=>Number.isInteger(e)&&e>=0&&e<=1114111?String.fromCodePoint(e):Ce(`refers to the code point ${e}`),Mo=e=>e.includes("&")?e.replace(Pl,(t,n)=>n.startsWith("#x")?Un(Number.parseInt(n.slice(2),16)):n.startsWith("#")?Un(Number.parseInt(n.slice(1),10)):jl.get(n)??Ce(`names the undeclared entity ${t}`)):e,Qt=e=>e.slice(e.indexOf(":")+1),$l=(e,t)=>{let n="";for(let r=t;r<e.length;r+=1){const o=e[r];if(n!=="")o===n&&(n="");else if(o==='"'||o==="'")n=o;else if(o===">")return r}return-1},ql=e=>{const t=new Map;for(const n of e.matchAll(Il))t.set(Qt(n[1]??""),Mo(n[2]??n[3]??""));return t},Lo=(e,t)=>{let n="";const r=()=>{let o=0;for(;!t();){const s=n.indexOf("<",o);if(s===-1)break;if(s>o&&(e.text?.(Mo(n.slice(o,s))),o=s),n.startsWith("<!--",s)){const p=n.indexOf("-->",s+4);if(p===-1)break;o=p+3;continue}if(n.startsWith("<![CDATA[",s)){const p=n.indexOf("]]>",s+9);if(p===-1)break;e.text?.(n.slice(s+9,p)),o=p+3;continue}const a=n.slice(s);if(a.length<9&&("<!--".startsWith(a)||"<![CDATA[".startsWith(a)))break;if(n.startsWith("<!",s)&&Ce("declares a document type or another declaration"),n.startsWith("<?",s)){const p=n.indexOf("?>",s+2);if(p===-1)break;o=p+2;continue}const i=$l(n,s+1);if(i===-1)break;const h=n.slice(s+1,i);if(h.startsWith("/"))e.end?.(Qt(h.slice(1).trim()));else{const p=h.endsWith("/"),f=p?h.slice(0,-1):h,d=Fl.exec(f)?.[0]??Ce("has a tag without a name"),g=Qt(d);e.start?.(g,ql(f.slice(d.length)),p),p&&e.end?.(g)}o=i+1}n=n.slice(o)};return{write:o=>{n+=o,r()},finish:()=>{r(),!t()&&n.includes("<")&&Ce("ends inside a tag, a comment or a section")}}},Qe=async(e,t,n)=>{const r=Lo(t,n),o=new TextDecoder("utf-8",{fatal:!0}),s=e.getReader();try{for(;!n();){const{done:a,value:i}=await s.read();if(a){r.write(o.decode()),r.finish();return}r.write(o.decode(i,{stream:!0}))}}catch(a){if(a instanceof ne)throw a;Ce("could not be read as UTF-8 text")}finally{s.cancel().catch(()=>{})}},Bl=101010256,Ul=33639248,Hl=67324752,Oo=22,Vl=65535,Hn=46,Vn=30,zl=1,zn=0,Gl=8,Zl=65535,Be=4294967295,Wl=new TextDecoder("utf-8"),ie=e=>{throw new ne("not-workbook",`the ZIP package ${e}`)},Kl=e=>{const t=e.byteLength-Oo,n=Math.max(0,t-Vl);for(let r=t;r>=n;r-=1)if(e.getUint32(r,!0)===Bl)return r;return ie("has no end of central directory record")},Xl=e=>{if(e.byteLength<Oo)return ie("is shorter than its end record");const t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=Kl(t),r=t.getUint16(n+4,!0),o=t.getUint16(n+6,!0),s=t.getUint16(n+10,!0),a=t.getUint32(n+12,!0),i=t.getUint32(n+16,!0);if(r!==0||o!==0)return ie("spans several disks");if(s===Zl||a===Be||i===Be)return ie("is a ZIP64 package");if(i+a>n)return ie("has a central directory past its end record");const h=new Map;let p=i;for(let f=0;f<s;f+=1){if(p+Hn>n||t.getUint32(p,!0)!==Ul)return ie("has a malformed central directory");const d=t.getUint16(p+8,!0),g=t.getUint16(p+10,!0),w=t.getUint32(p+20,!0),v=t.getUint32(p+24,!0),E=t.getUint16(p+28,!0),k=t.getUint16(p+30,!0),T=t.getUint16(p+32,!0),O=t.getUint32(p+42,!0),N=p+Hn;if(N+E>n)return ie("has a name past its central directory");const M=Wl.decode(e.subarray(N,N+E));if(w===Be||v===Be||O===Be)return ie("has a ZIP64 entry");if(!M.endsWith("/")){if(h.has(M))return ie(`names ${M} twice`);h.set(M,{name:M,encrypted:(d&zl)!==0,method:g,compressedSize:w,uncompressedSize:v,localHeaderOffset:O})}p=N+E+k+T}return{bytes:e,entries:h}},Yl=(e,t)=>{const{bytes:n}=e,r=new DataView(n.buffer,n.byteOffset,n.byteLength),o=t.localHeaderOffset;if(o+Vn>n.byteLength||r.getUint32(o,!0)!==Hl)return ie(`has no local header for ${t.name}`);const s=o+Vn+r.getUint16(o+26,!0)+r.getUint16(o+28,!0),a=s+t.compressedSize;return a>n.byteLength?ie(`has the data of ${t.name} past its end`):{start:s,end:a}},Ao=e=>new ReadableStream({start(t){e.byteLength>0&&t.enqueue(e),t.close()}}),Ql=e=>Ao(e).pipeThrough(new DecompressionStream("deflate-raw")),Jl=(e,t)=>{let n=0;return new TransformStream({transform(r,o){if(n+=r.byteLength,n>t){o.error(new ne("too-large",`${e} inflates past ${t} bytes`));return}o.enqueue(r)}})},We=(e,t,n)=>{const r=e.entries.get(t);if(r===void 0)return null;if(r.encrypted)throw new ne("encrypted",`${t} is encrypted`);if(r.method!==zn&&r.method!==Gl)return ie(`compresses ${t} with method ${r.method}`);if(r.uncompressedSize>n)throw new ne("too-large",`${t} declares ${r.uncompressedSize} bytes`);const{start:o,end:s}=Yl(e,r),a=e.bytes.subarray(o,s);return(r.method===zn?Ao(a):Ql(a)).pipeThrough(Jl(t,n))},vt=async(e,t,n)=>{const r=We(e,t,n);if(r===null)return null;const o=new TextDecoder("utf-8",{fatal:!0}),s=r.getReader();let a="";try{for(;;){const{done:i,value:h}=await s.read();if(i)break;a+=o.decode(h,{stream:!0})}return a+o.decode()}catch(i){if(i instanceof ne)throw i;return ie(`has ${t}, which does not inflate to UTF-8 text`)}finally{s.releaseLock()}},Gn="content.xml",ec="META-INF/manifest.xml",Do=e=>{throw new ne("not-workbook",`the spreadsheet ${e}`)},Zn=(e,t)=>We(e,Gn,t.maxPartBytes)??Do(`has no ${Gn}`),tc=async(e,t)=>{const n=We(e,ec,t.maxPartBytes);if(n===null)return!1;let r=!1;return await Qe(n,{start:o=>{o==="encryption-data"&&(r=!0)}},()=>r),r},nc=async e=>{const t=[],n=new Set;let r=null,o=0;return await Qe(e,{start:(s,a,i)=>{s==="style"?r=a.get("family")==="table"?a.get("name")??null:null:s==="table-properties"&&r!==null&&a.get("display")==="false"?n.add(r):s==="table"&&(o===0&&t.push({name:a.get("name")??"",style:a.get("style-name")??""}),i||(o+=1))},end:s=>{s==="style"?r=null:s==="table"&&(o=Math.max(0,o-1))}},()=>!1),{tables:t,hidingStyles:n}},Pt=e=>{const t=Number(e);return Number.isInteger(t)&&t>0?t:1},rc=async(e,t,n)=>{const r=bo(n);let o=0,s=0,a=!1,i=!1,h=0,p=1,f=new Map,d=0,g=null;return await Qe(e,{start:(w,v,E)=>{if(w==="table"){s===0&&(a=o===t,o+=1),E||(s+=1);return}!a||s!==1||(w==="table-row"?(p=Pt(v.get("number-rows-repeated")),f=new Map,d=0):w==="table-cell"||w==="covered-table-cell"?g={repeat:Pt(v.get("number-columns-repeated")),covered:w==="covered-table-cell",parts:[],paragraphs:0,paragraphDepth:0,annotationDepth:0}:g!==null&&g.annotationDepth===0&&(w==="annotation"&&!E?g.annotationDepth+=1:w==="p"||w==="h"?(g.paragraphs>0&&g.parts.push(`
15
- `),g.paragraphs+=1,E||(g.paragraphDepth+=1)):g.paragraphDepth>0&&(w==="s"?g.parts.push(" ".repeat(Pt(v.get("c")))):w==="tab"?g.parts.push(" "):w==="line-break"&&g.parts.push(`
16
- `))))},end:w=>{if(w==="table"){s=Math.max(0,s-1),s===0&&a&&(a=!1,i=!0);return}if(g!==null&&g.annotationDepth>0){w==="annotation"&&(g.annotationDepth-=1);return}if(!(!a||s!==1))if((w==="table-cell"||w==="covered-table-cell")&&g!==null){const v=g.covered?"":g.parts.join("");if(v!==""){const E=Math.min(d+g.repeat,n.maxColumns+1);for(let k=d;k<E;k+=1)f.set(k,v)}d+=g.repeat,g=null}else w==="table-row"?(r.addRow(h,f,p),h+=p):(w==="p"||w==="h")&&g!==null&&(g.paragraphDepth=Math.max(0,g.paragraphDepth-1))},text:w=>{g!==null&&g.annotationDepth===0&&g.paragraphDepth>0&&g.parts.push(w)}},()=>i||r.full()),r.table()},oc=async(e,t)=>{if(await tc(e,t))throw new ne("encrypted","the spreadsheet's manifest names encryption data");const{tables:n,hidingStyles:r}=await nc(Zn(e,t)),o=[];let s=0;return n.forEach((a,i)=>{if(r.has(a.style)){s+=1;return}o.push({name:a.name,read:async h=>rc(Zn(e,t),i,h)})}),o.length===0&&Do("shows no table"),{sheets:o.slice(0,t.maxSheets),unshownSheets:s,unlistedSheets:Math.max(0,o.length-t.maxSheets)}},Re=Object.freeze({kind:"general"}),sc=new Map([[0,"General"],[1,"0"],[2,"0.00"],[3,"#,##0"],[4,"#,##0.00"],[9,"0%"],[10,"0.00%"],[11,"0.00E+00"],[12,"# ?/?"],[13,"# ??/??"],[14,"mm-dd-yy"],[15,"d-mmm-yy"],[16,"d-mmm"],[17,"mmm-yy"],[18,"h:mm AM/PM"],[19,"h:mm:ss AM/PM"],[20,"h:mm"],[21,"h:mm:ss"],[22,"m/d/yy h:mm"],...[27,28,29,30,31,34,35,36,50,51,52,53,54,55,56,57,58].map(e=>[e,"yyyy-mm-dd"]),[32,"h:mm"],[33,"h:mm:ss"],[37,"#,##0 ;(#,##0)"],[38,"#,##0 ;[Red](#,##0)"],[39,"#,##0.00;(#,##0.00)"],[40,"#,##0.00;[Red](#,##0.00)"],[45,"mm:ss"],[46,"[h]:mm:ss"],[47,"mmss.0"],[48,"##0.0E+0"],[49,"@"]]),ac=/^\[(h+|m+|s+)\]$/iu,ic=e=>{let t="",n=!1;for(let r=0;r<e.length;r+=1){const o=e[r];if(o===";")break;if(o==='"'){const s=e.indexOf('"',r+1);r=s===-1?e.length:s}else if(o==="\\"||o==="_"||o==="*")r+=1;else if(o==="["){const s=e.indexOf("]",r+1),a=e.slice(r,s===-1?e.length:s+1);ac.test(a)&&(t+=a.slice(1,-1),n=!0),r=s===-1?e.length:s}else t+=o}return{text:t.toLowerCase(),elapsed:n}},lc=e=>{const{text:t,elapsed:n}=ic(e);if(t===""||t==="general"||t.includes("@")||/[0#?.]e[+-]/u.test(t))return Re;const r=n||/[hs]/u.test(t)||t.includes("am/pm")||t.includes("a/p"),o=/[ydge]/u.test(t.replace(/am\/pm|a\/p/gu,""))||t.includes("m")&&!r;if(o||r)return{kind:"date-time",date:o,time:r,seconds:t.includes("s"),elapsed:n};if(/[0#?]\s*\/\s*[0#?]/u.test(t))return Re;const s=/[0#?][0#?,]*(?:\.[0#?]*)?,*/u.exec(t)?.[0];if(s===void 0)return Re;const a=/,*$/u.exec(s)?.[0].length??0,[i="",h=""]=s.slice(0,s.length-a).split("."),p=(h.match(/[0#?]/gu)??[]).length;return t.includes("%")?{kind:"percent",decimals:p}:{kind:"fixed",decimals:p,grouping:i.includes(","),scale:1e3**a}},cc=(e,t)=>{const n=t.get(e)??sc.get(e);return n===void 0?Re:lc(n)},gn=e=>{if(Number.isInteger(e)&&Math.abs(e)<1e15)return String(e);const[t="",n]=e.toPrecision(15).split("e"),r=t.includes(".")?t.replace(/0+$/u,"").replace(/\.$/u,""):t;return n===void 0?r:`${r}E${n.startsWith("-")?n:`+${n.replace("+","")}`}`},Wn=(e,t,n)=>{const r=Math.abs(e).toFixed(t);if(r.includes("e"))return gn(e);const[o="",s]=r.split("."),a=n?o.replace(/\B(?=(\d{3})+(?!\d))/gu,","):o;return`${e<0&&/[1-9]/u.test(r)?"-":""}${a}${s===void 0?"":`.${s}`}`},dc=864e5,Kn=86400,uc=2958465,Me=(e,t)=>String(e).padStart(t,"0"),fc=(e,t)=>{if(!t&&e===0)return"1900-01-00";if(!t&&e===60)return"1900-02-29";const n=t?Date.UTC(1904,0,1):e<60?Date.UTC(1899,11,31):Date.UTC(1899,11,30),r=new Date(n+e*dc);return`${Me(r.getUTCFullYear(),4)}-${Me(r.getUTCMonth()+1,2)}-${Me(r.getUTCDate(),2)}`},mc=(e,t,n)=>{if(e<0||e>=uc+1)return gn(e);let r=Math.floor(e),o=Math.round((e-r)*Kn);o===Kn&&(r+=1,o=0);const s=Math.floor(o/3600),a=Math.floor(o%3600/60),i=`${Me(t.elapsed?r*24+s:s,2)}:${Me(a,2)}${t.seconds?`:${Me(o%60,2)}`:""}`;if(t.elapsed||!t.date)return i;const h=fc(r,n);return t.time?`${h} ${i}`:h},hc=(e,t,n)=>{switch(t.kind){case"general":return gn(e);case"date-time":return mc(e,t,n);case"percent":return`${Wn(e*100,t.decimals,!1)}%`;case"fixed":return Wn(e/t.scale,t.decimals,t.grouping)}},No="_rels/.rels",de=e=>{throw new ne("not-workbook",`the workbook ${e}`)},vn=(e,t)=>{const n=Lo(t,()=>!1);n.write(e),n.finish()},pc=(e,t)=>{try{return decodeURIComponent(e)}catch{return de(`points to a malformed part name (${t})`)}},wc=(e,t)=>{const r=[...t.startsWith("/")?[]:e.split("/").slice(0,-1)];for(const o of t.split("/"))o===""||o==="."||(o===".."?(r.length===0&&de(`points above its root (${t})`),r.pop()):r.push(pc(o,t)));return r.join("/")},gc=e=>{const t=e.lastIndexOf("/");return`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`},Xn=async(e,t,n)=>{const r=await vt(e,t===""?No:gc(t),n.maxPartBytes),o=new Map;return r===null||vn(r,{start:(s,a)=>{if(s!=="Relationship")return;const i=a.get("Id"),h=a.get("Type"),p=a.get("Target");i===void 0||h===void 0||p===void 0||a.get("TargetMode")==="External"||o.set(i,{type:h,target:wc(t,p)})}}),o},It=(e,t)=>{for(const n of e.values())if(n.type.endsWith(`/${t}`))return n.target;return null},vc=e=>{const t=[];let n=!1;return vn(e,{start:(r,o)=>{if(r==="workbookPr"){const s=o.get("date1904");n=s==="1"||s==="true"}else r==="sheet"&&t.push({name:o.get("name")??"",state:o.get("state")??"visible",relationship:o.get("id")??""})}}),{sheets:t,date1904:n}},Ec=async e=>{const t=[];let n=null,r=!1,o=0;return await Qe(e,{start:(s,a,i)=>{s==="si"?n=[]:s==="rPh"&&!i?o+=1:s==="t"&&o===0&&(r=!i)},end:s=>{s==="si"&&n!==null?(t.push(n.join("")),n=null):s==="rPh"?o=Math.max(0,o-1):s==="t"&&(r=!1)},text:s=>{r&&n!==null&&n.push(s)}},()=>!1),t},yc=e=>{const t=new Map,n=[];let r=!1;return vn(e,{start:(o,s)=>{if(o==="numFmt"){const a=Number(s.get("numFmtId")),i=s.get("formatCode");Number.isInteger(a)&&i!==void 0&&t.set(a,i)}else if(o==="cellXfs")r=!0;else if(o==="xf"&&r){const a=Number(s.get("numFmtId")??"0");n.push(Number.isInteger(a)?a:0)}},end:o=>{o==="cellXfs"&&(r=!1)}}),n.map(o=>cc(o,t))},xc=/^(\d{4}-\d{2}-\d{2})(?:T(\d{2}:\d{2}(?::\d{2})?)(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?$/u,bc=e=>{const t=xc.exec(e);if(t===null)return e;const[,n,r]=t;return r===void 0||/^00:00(?::00)?$/u.test(r)?n??e:`${n} ${r}`},Sc=/^([A-Za-z]{1,3})(\d+)$/u,kc=e=>{const t=Sc.exec(e)?.[1];if(t===void 0)return null;let n=0;for(const r of t.toUpperCase())n=n*26+(r.charCodeAt(0)-64);return n-1},Tc=(e,t,n,r)=>{const o=e.value.join("");switch(e.type){case"s":return o===""?"":t[Number(o)]??de(`refers to the shared string ${o}, past its ${t.length}`);case"inlineStr":return e.inline.join("");case"b":return o===""?"":o==="1"||o==="true"?"TRUE":"FALSE";case"str":case"e":return o;case"d":return bc(o.trim());default:{const s=o.trim();if(s==="")return"";const a=Number(s);return Number.isFinite(a)?hc(a,n[e.style]??Re,r):s}}},Rc=async(e,t,n,r,o)=>{const s=bo(t);let a=-1,i=new Map,h=0,p=null;return await Qe(e,{start:(f,d,g)=>{if(f==="row"){const w=Number(d.get("r"));a=Number.isInteger(w)&&w>a+1?w-1:a+1,i=new Map,h=0}else if(f==="c"){const w=kc(d.get("r")??"")??h,v=Number(d.get("s")??"0");p={column:w,type:d.get("t")??"n",style:Number.isInteger(v)?v:0,value:[],inline:[],inValue:!1,inInlineText:!1,phoneticDepth:0}}else p!==null&&(f==="v"?p.inValue=!g:f==="rPh"&&!g?p.phoneticDepth+=1:f==="t"&&p.type==="inlineStr"&&p.phoneticDepth===0&&(p.inInlineText=!g))},end:f=>{if(f==="c"&&p!==null){const d=Tc(p,n,r,o);d!==""&&i.set(p.column,d),h=p.column+1,p=null}else f==="row"?s.addRow(a,i,1):p!==null&&(f==="v"?p.inValue=!1:f==="rPh"?p.phoneticDepth=Math.max(0,p.phoneticDepth-1):f==="t"&&(p.inInlineText=!1))},text:f=>{p!==null&&(p.inValue?p.value.push(f):p.inInlineText&&p.inline.push(f))}},s.full),s.table()},Cc=async(e,t)=>{const n=It(await Xn(e,"",t),"officeDocument")??de("has no officeDocument relationship"),r=await vt(e,n,t.maxPartBytes)??de(`has no part ${n}`),{sheets:o,date1904:s}=vc(r),a=await Xn(e,n,t),i=It(a,"sharedStrings"),h=i===null?null:We(e,i,t.maxPartBytes),p=h===null?[]:await Ec(h),f=It(a,"styles"),d=f===null?null:await vt(e,f,t.maxPartBytes),g=d===null?[]:yc(d),w=[];let v=0;for(const E of o){const k=a.get(E.relationship)??de(`lists the sheet ${E.name} without its relationship`);if(E.state!=="visible"||!k.type.endsWith("/worksheet")){v+=1;continue}e.entries.has(k.target)||de(`has no part ${k.target} for the sheet ${E.name}`),w.push({name:E.name,read:async T=>{const O=We(e,k.target,t.maxPartBytes)??de(`has no part ${k.target}`);return Rc(O,T,p,g,s)}})}return w.length===0&&de("shows no sheet"),{sheets:w.slice(0,t.maxSheets),unshownSheets:v,unlistedSheets:Math.max(0,w.length-t.maxSheets)}},Mc=Object.freeze([80,75,3,4]),Lc=Object.freeze([208,207,17,224,161,177,26,225]),Ft=Uint8Array.from([..."EncryptedPackage"].flatMap(e=>[e.charCodeAt(0),0])),Oc=new Set(["application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.spreadsheet-template"]),Ac="mimetype",_o=(e,t)=>e.byteLength>=t.length&&t.every((n,r)=>e[r]===n),jo=e=>_o(e,Mc),Po=e=>_o(e,Lc),Dc=e=>{const t=e.byteLength-Ft.byteLength;for(let n=0;n<=t;n+=1)if(e[n]===Ft[0]&&Ft.every((r,o)=>e[n+o]===r))return!0;return!1},Nc=async(e,t)=>{if(Po(e))throw Dc(e)?new ne("encrypted","the bytes are a password-protected workbook"):new ne("not-workbook","the bytes are a compound file (a legacy .xls)");if(!jo(e))throw new ne("not-workbook","the bytes are no ZIP package");const n=Xl(e),r=await vt(n,Ac,t.maxPartBytes);if(r!==null&&Oc.has(r.trim()))return oc(n,t);if(n.entries.has(No))return Cc(n,t);throw new ne("not-workbook","the ZIP package is neither an OpenDocument spreadsheet nor an Office Open XML package")},_c=async(e,t)=>{const n=e.getReader(),r=[];let o=0;try{for(;;){const{done:i,value:h}=await n.read();if(i)break;if(o+=h.byteLength,o>t)return null;r.push(h)}}finally{n.cancel().catch(()=>{})}const s=new Uint8Array(o);let a=0;for(const i of r)s.set(i,a),a+=i.byteLength;return s},Io=async(e,t)=>{try{return{kind:"table",table:await e.read(t)}}catch(n){return{kind:"refused",refusal:n instanceof ne?n.refusal:"not-workbook"}}},jc=async(e,t,n,r,o)=>{const s=await e.asset(P.explorerWorkbookHref(t),o);if(s.status==="cancelled")return null;if(s.status==="error")return{kind:"failure",failure:s.failure};let a;try{a=await _c(s.body,n.maxBytes)}catch{return o.aborted?null:{kind:"failure",failure:{reason:"failed"}}}if(o.aborted)return null;if(a===null)return{kind:"refused",refusal:"too-large"};if(!(jo(a)||Po(a)))return{kind:"not-package"};try{const i=await Nc(a,n.limits),h=r===null?-1:i.sheets.findIndex(g=>g.name===r),p=Math.max(h,0),f=i.sheets[p];if(f===void 0)return{kind:"refused",refusal:"not-workbook"};const d=await Io(f,n.budget);return o.aborted?null:{kind:"workbook",workbook:i,selected:p,sheet:d}}catch(i){return i instanceof ne?{kind:"refused",refusal:i.refusal}:o.aborted?null:{kind:"failure",failure:{reason:"failed"}}}},Pc=Object.freeze({className:"aqmx-document-spreadsheet-body","data-aqmx-document-scroller":""}),Ic=(e,t)=>{switch(t.code){case"encoding":return e.spreadsheetUnreadableEncoding(t.encodings);case"binary":return e.spreadsheetNotText;case"long-row":return e.spreadsheetLongRow}},Yn=(e,t)=>{switch(t){case"encrypted":return e.spreadsheetWorkbookEncrypted;case"not-workbook":return e.spreadsheetNotWorkbook;case"too-large":return e.spreadsheetWorkbookTooLarge}},$t=e=>e.every(t=>t.every(n=>n==="")),Fo=({name:e,url:t,openUrl:n,state:r,children:o})=>l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-spreadsheet-view","data-aqmx-spreadsheet":r,children:[l.jsx(Xe,{name:e,openUrl:n,downloadUrl:t,icon:l.jsx(xl,{})}),l.jsx(Ke,{scrollerProps:Pc,children:l.jsx("div",{className:"aqmx-document-spreadsheet-column",children:o})})]}),$o=({rows:e,title:t})=>{const{labels:n,locale:r,theme:o}=$(),s=c.use(Ee),a=c.useMemo(()=>({...To(n,r),table:t,fullscreenDialog:n.spreadsheetFullscreen(t)}),[n,r,t]),i=c.useMemo(()=>Vt.serializeTsv(e),[e]),h=fn();return l.jsx("div",{className:"aqmx-document-spreadsheet","data-theme":o,children:l.jsx(Oe.SpreadsheetBlock,{tsv:i,layout:s==="fill"?"fill":"inline",locale:r,labels:a,tapScrollCircle:Jr(h),scrollBarControls:ln(h)})})},Ve=({note:e,testId:t,code:n,download:r})=>{const{labels:o}=$();return l.jsx("div",{className:"aqmx-document-spreadsheet-stage",children:r===void 0?l.jsx("p",{className:"aqmx-callout",role:"note","data-testid":t,children:e}):l.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":t,"data-aqmx-unreadable":n,children:[l.jsx("p",{className:"aqmx-callout-body",children:e}),l.jsx("a",{className:"aqmx-callout-action",href:r.url,download:r.name,"data-testid":"markdown-explorer-spreadsheet-unreadable-download",children:o.download})]})})},qo=({reading:e,name:t,url:n})=>{const{labels:r}=$();switch(e.kind){case"table":return l.jsxs(l.Fragment,{children:[e.truncated?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-truncated",children:r.spreadsheetTruncated}):null,l.jsx($o,{rows:e.rows,title:t})]});case"empty":return l.jsx(Ve,{note:r.spreadsheetEmpty,testId:"markdown-explorer-spreadsheet-empty"});case"unreadable":return l.jsx(Ve,{note:Ic(r,e),testId:"markdown-explorer-spreadsheet-unreadable",code:e.code,download:{url:n,name:t}})}},Fc=({path:e,document:t})=>t.format==="workbook"?l.jsx(qc,{path:e,document:t}):l.jsx($c,{path:e,document:t,format:t.format}),$c=({path:e,document:t,format:n})=>{const{config:r,data:o,labels:s}=$(),{name:a,url:i}=t,h=c.useCallback(async g=>{const w=await ko(o,i,{format:n,legacyEncoding:r.legacyTextEncoding,maxBytes:r.spreadsheets.maxBytes,budget:ut},g);return w===null||w.kind==="failure"?w:{kind:"read",value:w}},[o,i,n,r.legacyTextEncoding,r.spreadsheets.maxBytes]),{shown:p,failure:f,retry:d}=wn(e,a,h);return l.jsxs(Fo,{name:a,url:i,openUrl:P.explorerPlainTextHref(i),state:p===null?f===null?"loading":"failure":p.kind,children:[p===null&&f===null?l.jsx(ye,{label:s.spreadsheetLoading,testId:"markdown-explorer-spreadsheet-skeleton"}):null,p===null&&f!==null?l.jsx("div",{className:"aqmx-document-spreadsheet-failure",children:l.jsx(ve,{failure:f,alert:!1,onRetry:d,testId:"markdown-explorer-spreadsheet-failure"})}):null,p===null?null:l.jsx(qo,{reading:p,name:a,url:i})]})},qc=({path:e,document:t})=>{const{config:n,data:r,labels:o}=$(),{name:s,url:a,firstSheetText:i}=t,h=c.useId(),p=c.useRef(null),f=c.useCallback(async Z=>{const Q=await jc(r,a,{maxBytes:n.spreadsheets.maxWorkbookBytes,limits:Cl,budget:ut},p.current,Z);if(Q===null||Q.kind==="failure")return Q;if(Q.kind==="workbook")return{kind:"read",value:Q};if(i!==null){const u=await ko(r,a,{format:i,legacyEncoding:n.legacyTextEncoding,maxBytes:n.spreadsheets.maxBytes,budget:ut},Z);return u===null||u.kind==="failure"?u:{kind:"read",value:{kind:"first-sheet",reading:u}}}return{kind:"read",value:{kind:"refused",refusal:Q.kind==="not-package"?"not-workbook":Q.refusal}}},[r,a,i,n.legacyTextEncoding,n.spreadsheets.maxBytes,n.spreadsheets.maxWorkbookBytes]),{shown:d,failure:g,retry:w}=wn(e,s,f),[v,E]=c.useState(null),k=c.useRef(new WeakMap),T=d?.kind==="workbook"?d:null,O=T===null?null:v!==null&&v.workbook===T.workbook?v:{workbook:T.workbook,index:T.selected,reading:T.sheet},N=Z=>{if(T===null)return;const Q=T.workbook.sheets[Z];if(Q===void 0)return;p.current=Q.name;let u=k.current.get(T.workbook);u===void 0&&(u=new Map([[T.selected,T.sheet]]),k.current.set(T.workbook,u));const m=u.get(Z),b={workbook:T.workbook,index:Z,reading:m??null};if(E(b),m!==void 0)return;const x=u;Io(Q,ut).then(L=>{x.set(Z,L),E(F=>F===b?{...b,reading:L}:F)})},M=O===null?null:O.reading===null?"loading":O.reading.kind==="refused"?"unreadable":$t(O.reading.table.rows)?"empty":"table",C=d===null?g===null?"loading":"failure":d.kind==="first-sheet"?d.reading.kind:d.kind==="refused"?"unreadable":M??"loading",B=i===null?a:P.explorerPlainTextHref(a),I=Z=>`${h}-sheet-${Z}`,H=`${h}-panel`,_=O===null?null:T?.workbook.sheets[O.index]?.name??null,U=T!==null&&T.workbook.sheets.length>1;return l.jsxs(Fo,{name:s,url:a,openUrl:B,state:C,children:[d===null&&g===null?l.jsx(ye,{label:o.spreadsheetLoading,testId:"markdown-explorer-spreadsheet-skeleton"}):null,d===null&&g!==null?l.jsx("div",{className:"aqmx-document-spreadsheet-failure",children:l.jsx(ve,{failure:g,alert:!1,onRetry:w,testId:"markdown-explorer-spreadsheet-failure"})}):null,d?.kind==="refused"?l.jsx(Ve,{note:Yn(o,d.refusal),testId:"markdown-explorer-spreadsheet-unreadable",code:d.refusal,download:{url:a,name:s}}):null,d?.kind==="first-sheet"?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-first-sheet",children:o.spreadsheetWorkbookFirstSheet}),l.jsx(qo,{reading:d.reading,name:s,url:a})]}):null,T===null||O===null||_===null?null:l.jsxs(l.Fragment,{children:[T.workbook.unshownSheets>0?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-unshown-sheets",children:o.spreadsheetUnshownSheets(T.workbook.unshownSheets)}):null,T.workbook.unlistedSheets>0?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-unlisted-sheets",children:o.spreadsheetUnlistedSheets(T.workbook.sheets.length)}):null,U?l.jsx(Ll,{names:T.workbook.sheets.map(Z=>Z.name),selected:O.index,onSelect:N,label:o.spreadsheetSheets(s),tabIdOf:I,panelId:H}):null,l.jsxs("div",{className:"aqmx-document-spreadsheet-sheet","data-testid":"markdown-explorer-spreadsheet-sheet","data-aqmx-sheet":O.index,...U?{role:"tabpanel",id:H,"aria-labelledby":I(O.index)}:{},children:[O.reading===null?l.jsx(ye,{label:o.spreadsheetSheetLoading,testId:"markdown-explorer-spreadsheet-sheet-skeleton"}):null,O.reading?.kind==="table"&&O.reading.table.truncated?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-truncated",children:o.spreadsheetTruncated}):null,O.reading?.kind==="refused"?l.jsx(Ve,{note:Yn(o,O.reading.refusal),testId:"markdown-explorer-spreadsheet-unreadable",code:O.reading.refusal,download:{url:a,name:s}}):null,O.reading?.kind==="table"&&$t(O.reading.table.rows)?l.jsx(Ve,{note:o.spreadsheetSheetEmpty,testId:"markdown-explorer-spreadsheet-empty"}):null,O.reading?.kind==="table"&&!$t(O.reading.table.rows)?l.jsx($o,{rows:O.reading.table.rows,title:o.spreadsheetSheetName(s,_)},O.index):null]})]})]})},Bo=Object.freeze({kind:"empty"}),Bc=(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 G.explorerHref(e,{...t,overrides:r})},ze=({kind:e,view:t,label:n,stale:r,busy:o,frameRef:s,intent:a,children:i})=>{const h=c.use(Ee);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":h,className:"aqmx-document",...a,children:[r?l.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,i]})},Uc=({absence:e,announces:t,announceFailure:n})=>{const{labels:r,announcer:o}=$(),s=e.kind==="no-readme"?e.folder:null,a=e.kind==="failure"?e.folder:null,i=e.kind==="failure"?e.failure:null;switch(c.useEffect(()=>{t&&s!==null&&o.announce(r.folderReadmeMissing(P.lastPathSegment(s)))},[t,s,o,r]),c.useEffect(()=>{a!==null&&i!==null&&n(r.documentFailed(P.lastPathSegment(a),ce(r,i.reason)))},[a,i,n,r]),e.kind){case"empty":return l.jsx(ze,{kind:"empty",label:r.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:r.documentEmpty})})});case"loading":return l.jsx(En,{label:r.documentRegion});case"no-readme":return l.jsx(ze,{kind:"empty",label:r.documentRegion,stale:!1,busy:!1,children:l.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-folder-empty",children:l.jsx("p",{className:"aqmx-empty-title",children:r.folderReadmeMissing(P.lastPathSegment(e.folder))})})});case"failure":return l.jsx(ze,{kind:"failure",label:r.documentRegion,stale:!1,busy:!1,children:l.jsx(mn,{failure:e.failure,onRetry:e.onRetry,testId:"markdown-explorer-folder-failure"})})}},En=({label:e})=>{const{labels:t}=$();return l.jsx(ze,{kind:"loading",label:e,stale:!1,busy:!0,children:l.jsx(ye,{label:t.documentLoading,testId:"markdown-explorer-document-skeleton"})})},Qn=Object.freeze(["wheel","touchstart","pointerdown","keydown"]),Hc=({path:e,document:t,viewer:n,editing:r})=>{const{reportMathDiagnostics:o,edits:s}=$(),a=c.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),i=rl(),h=ol(),p=c.useMemo(()=>o===void 0?void 0:C=>o(e,C),[o,e]),f=c.useRef(null),{editable:d,doubleClick:g,region:w,paneScroll:v,stale:E}=r;c.useLayoutEffect(()=>{if(d)return s.bindView(e,{anchor:()=>{const C=f.current,B=w(),I=C===null?null:C.querySelector(xt);return C===null||B===null||I===null?null:$r(C,v.scrollerOf(B,I))}})},[s,e,d,w,v]);const k=C=>{const B=f.current,{target:I}=C;!g||B===null||!(I instanceof Element)||!Ir(I)||(C.stopPropagation(),s.start(e,Fr(I,B,B.ownerDocument.getSelection())))},T=c.useRef(null),O=c.useRef(E);c.useLayoutEffect(()=>{O.current=E});const N=c.useEffectEvent(C=>{const B=f.current,I=w(),H=B===null?null:Ur(B,C.line);if(I===null||H===null)return!1;const _=v.scrollerOf(I,H);return _.scrollTop+=Hr(H,C.line)-C.clientTop,!0}),M=c.useEffectEvent(C=>{const B=w();if(B===null)return;const I=()=>{for(const _ of Qn)B.removeEventListener(_,H,!0);T.current?.release===I&&(T.current=null)},H=()=>I();for(const _ of Qn)B.addEventListener(_,H,{capture:!0,passive:!0});T.current={point:C,release:I}});return c.useLayoutEffect(()=>{const C=s.takeReturn(e);if(C!==null)return queueMicrotask(()=>{N(C)&&O.current&&M(C)}),()=>T.current?.release()},[s,e]),c.useLayoutEffect(()=>{const C=T.current;C===null||E||(C.release(),N(C.point))},[t,E]),l.jsx("div",{ref:f,className:"aqmx-document-viewer",onDoubleClick:k,children:l.jsx(Oe.MarkdownViewer,{...n,onHeadingSelect:i,headingHref:h,onMathDiagnostics:p,parseResult:a,content:null})})},Uo=({document:e,viewer:t})=>{const{labels:n}=$();return l.jsxs(l.Fragment,{children:[l.jsx(Xe,{name:e.name,openUrl:P.explorerPlainTextHref(e.url),downloadUrl:e.url,icon:l.jsx(da,{}),children:e.truncated?null:l.jsx(oi,{text:e.text})}),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(Oe.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},qt=({path:e,name:t,viewer:n})=>{const{data:r,labels:o}=$(),s=c.useCallback(async p=>{const f=await r.text(e,p);return"kind"in f?f.kind==="failure"?{kind:"failure",failure:f.failure}:{kind:"read",value:f}:null},[r,e]),{shown:a,failure:i,retry:h}=wn(e,t,s);return a!==null?l.jsx(Uo,{document:a,viewer:n}):i!==null?l.jsx(mn,{failure:i,onRetry:h,testId:"markdown-explorer-markup-failure"}):l.jsx(ye,{label:o.markupLoading,testId:"markdown-explorer-markup-skeleton"})},Vc=Object.freeze({reason:"failed"}),zc=e=>{const{labels:t}=$();return l.jsx(ma,{fallback:n=>l.jsx("div",{className:"aqmx-edit-message",children:l.jsx(ve,{failure:Vc,alert:!1,onRetry:n,testId:"markdown-explorer-edit-load-failure"})}),children:l.jsx(c.Suspense,{fallback:l.jsx(ye,{label:t.editLoading,testId:"markdown-explorer-edit-skeleton"}),children:l.jsx(fa,{...e})})})},Gc=({path:e,document:t,view:n,viewer:r,contentViewer:o,onRetry:s,editing:a})=>{switch(t.kind){case"markdown":{const{session:i,layout:h,region:p,paneScroll:f,stale:d}=a;if(n==="edit"&&i!==void 0)return l.jsx(zc,{path:e,name:t.name,session:i,layout:h,viewer:o,region:p,paneScroll:f});if(n==="markup")return l.jsx(qt,{path:e,name:t.name,viewer:o});const g=t.edit!==null&&(t.edit.kind==="inline"||t.edit.kind==="draft");return l.jsx(Hc,{path:e,document:t,viewer:o,editing:{editable:g,doubleClick:g&&h==="fill",region:p,paneScroll:f,stale:d}})}case"text":return l.jsx(Uo,{document:t,viewer:o});case"image":return n==="markup"&&pn(t)==="svg"?l.jsx(qt,{path:e,name:t.name,viewer:r}):l.jsx(zi,{document:t});case"media":return l.jsx(vl,{document:t});case"spreadsheet":return n==="markup"?l.jsx(qt,{path:e,name:t.name,viewer:r}):l.jsx(Fc,{path:e,document:t});case"file":return l.jsx(gi,{document:t});case"failure":return l.jsx(mn,{failure:t.failure,onRetry:s,testId:"markdown-explorer-document-failure"});default:{const i=t;throw new RangeError(`[markdown-explorer] unknown document kind ${V.describeValue(i.kind)}`)}}},Zc=e=>{const{document:t,viewer:n}=e,r=t.kind==="markdown"||t.kind==="text"?t.lang:void 0,o=c.useMemo(()=>r===void 0?n:{...n,contentLang:r},[n,r]);return l.jsx(ho,{value:r,children:l.jsx(Gc,{...e,contentViewer:o})})},Wc='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',Jn=(e,t,n)=>{const[r]=t.kind==="markdown"?t.headings:[],o=[n===null?null:lo(e,n),r===void 0?null:io(e,r.id),e.querySelector(xt),e.querySelector(Wc)];for(const s of o)if(s instanceof HTMLElement&&an(s))return s;return null},er=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,s=r===null||r===o;t instanceof HTMLElement&&n&&(s||e.contains(r))&&an(t)},Kc=e=>{const t=c.useRef(!1);return c.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 i=g=>{s=!(g.target instanceof Node&&n.contains(g.target)),s&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(a),a=setTimeout(()=>{s=!1},0)},h=g=>{t.current=g.target instanceof Node&&n.contains(g.target)},p=g=>{g.relatedTarget===null&&s&&(t.current=!1)},f=()=>{const{activeElement:g,body:w}=r;g!==null&&g!==w&&(t.current=n.contains(g))},d=()=>{s&&!n.contains(r.activeElement)&&(t.current=!1)};return o.addEventListener("pointerdown",i,!0),o.addEventListener("mousedown",i,!0),o.addEventListener("focusin",h,!0),o.addEventListener("blur",f),o.addEventListener("focus",d),n.addEventListener("focusout",p),()=>{clearTimeout(a),o.removeEventListener("pointerdown",i,!0),o.removeEventListener("mousedown",i,!0),o.removeEventListener("focusin",h,!0),o.removeEventListener("blur",f),o.removeEventListener("focus",d),n.removeEventListener("focusout",p)}},[e]),t},Xc=Object.freeze({count:0,recovered:!1}),Yc=({path:e,snapshot:t,markup:n,stale:r,viewer:o,editLayout:s,regionLabel:a,navigation:i,fragment:h,paneScroll:p,announces:f,announceFailure:d,onDocumentShown:g})=>{const{labels:w,announcer:v,documents:E}=$(),{document:k}=t,T=c.useRef(null),O=c.useRef(null),N=c.useRef(null),M=c.useRef(null),[C,B]=c.useState(null),I=c.useRef(null),H=Kc(T),_=c.useRef({path:e,document:k}),U=c.useRef(null),Z=c.useCallback(z=>{const Y=T.current,ee=_n(Y,z,p);Y!==null&&ee!==null&&er(Y,ee,H.current)},[p,H]),Q=c.useCallback((z,Y)=>{const ee=M.current;setTimeout(()=>{Y.defaultPrevented||c.startTransition(()=>B({fragment:z,from:ee}))},0)},[]),u=c.useCallback(z=>{setTimeout(()=>{z.defaultPrevented||Z("#")},0)},[Z]),m=c.useMemo(()=>({navigation:i,currentPath:e,scrollWithin:Z,followFragmentJump:Q,followEmptyFragment:u}),[i,e,Z,Q,u]),b=c.useCallback(()=>E.retry(e),[E,e]),x=zr(E,Xi),L=Dr(e),F=L!==void 0?"edit":n?"markup":"rendered",y=pn(k)===null?void 0:F,S=c.useCallback(()=>T.current,[]),A=c.useCallback(()=>{const z=T.current;z!==null&&Jn(z,k,null)},[k]),D=c.useMemo(()=>({session:L,layout:s,region:S,paneScroll:p,stale:r}),[L,s,S,p,r]),q=y==="edit"?!1:r,X=c.use(Ee),K=y==="edit"&&s==="fill"?"fill":X,[W,re]=c.useState(0),fe=c.useRef(0),le=c.useRef(!1),[Ne,Je]=c.useState(Xc),[xe,Tt]=c.useState(0),_e=c.useRef(d),je=c.useRef(r);c.useLayoutEffect(()=>{_e.current=d,je.current=r},[d,r]);const me=c.useMemo(()=>({announceFailure:z=>{je.current||_e.current(z)},readPart:()=>{const z=E.readPart(e);fe.current+=1;let Y=!1,ee=!1,oe=!1;return{settle:(Se,ke)=>{if(z.settle(Se,ke),!(oe||Y)){if(ke!==null){ee=!0,le.current=!1;return}Y=!0,Je(nt=>({count:nt.count+1,recovered:ee}))}},release:()=>{oe||(oe=!0,z.release(),fe.current-=1,Y||Tt(Se=>Se+1))}}},holdBusy:()=>{re(Y=>Y+1);let z=!0;return()=>{z&&(z=!1,re(Y=>Y-1))}}}),[E,e]),Pe=q||W>0,et=c.useEffectEvent((z,Y)=>{const ee=O.current;if(ee!==null&&ee.path===z&&ee.snapshot===Y)return;O.current={path:z,snapshot:Y},E.noteShown(z,Y);const oe=Y.document;if(oe.kind==="failure"){le.current=!1,E.noteFailureShown(Y)&&d(w.documentFailed(P.lastPathSegment(z),ce(w,oe.failure.reason)));return}g?.(z,oe),!(!f||ee!==null&&ee.path===z&&ee.snapshot.document.kind!=="failure")&&(le.current=fe.current>0,le.current||v.announce(w.documentShown(oe.name)))});c.useEffect(()=>{et(e,t)},[e,t]);const tt=c.useEffectEvent(()=>{h.kind==="panel"&&h.consume()}),Ie=c.useEffectEvent(z=>{const Y=T.current;if(Y===null||!H.current)return null;const{activeElement:ee,body:oe}=Y.ownerDocument;return ee!==null&&ee!==oe?null:Jn(Y,k,z)}),Rt=c.useEffectEvent(z=>{const Y=le.current;le.current=!1,!r&&(z&&Ie(null),f&&(z||Y)&&k.kind!=="failure"&&v.announce(w.documentShown(k.name)))});c.useEffect(()=>{Ne.count>0&&Rt(Ne.recovered)},[Ne]);const j=c.useEffectEvent(()=>{fe.current>0||!le.current||(le.current=!1,f&&!r&&k.kind!=="failure"&&v.announce(w.documentShown(k.name)))});c.useEffect(()=>{xe>0&&j()},[xe]);const J=c.useEffectEvent(z=>{const Y=T.current;Y!==null&&er(Y,z,H.current)}),te=c.useEffectEvent(z=>p.reveal(z)),be=c.useEffectEvent(z=>_n(T.current,z,p));return c.useEffect(()=>{if(r)return;const z=_.current.path!==e,Y=z||_.current.document!==k;_.current={path:e,document:k};const ee=U.current!==e;U.current=e;let oe=null;h.kind==="page"?N.current!==h.navigation&&(N.current=h.navigation,oe=h.fragment):h.fragment!==null&&(oe=h.fragment,tt());const Se=()=>{const ke=oe===null?null:be(oe);if(!Y){ke!==null&&J(ke);return}const nt=Ie(h.fragment);z&&ke===null&&nt!==null&&te(nt)};ee?queueMicrotask(Se):Se()},[h,e,k,r]),c.useLayoutEffect(()=>{M.current=h.kind==="page"?h.navigation:null},[h]),c.useEffect(()=>{C===null||C===I.current||r||(I.current=C,!(h.kind==="page"&&h.navigation!==C.from)&&Z(C.fragment))},[C,h,r,Z]),l.jsxs(Ee,{value:K,children:[l.jsx(ci,{path:e,name:k.kind==="failure"?P.lastPathSegment(e):k.name,editing:L!==void 0,announces:f,markup:n,region:T,focusDocument:A}),l.jsx(ze,{kind:k.kind,view:y,label:a(e,k),stale:Pe,busy:Pe,frameRef:T,intent:x,children:l.jsx(mo,{value:m,children:l.jsx(Wi,{children:l.jsx(no,{value:me,children:l.jsx(Zc,{path:e,document:k,view:F,viewer:o,onRetry:b,editing:D},e)})})})})]})},yn=Object.freeze({kind:"skeleton"}),Qc=(e,t,n,r,o)=>{if(t?.status==="loaded")return{kind:"document",path:e,snapshot:t,stale:!1};const s=pe(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:pe(r);return n===null||a===null?yn:{kind:"document",path:n,snapshot:a,stale:!0}},Jc=(e,t)=>t.status==="deferred"?yn:{kind:"document",path:e,snapshot:t,stale:!1},ed=({requestedPath:e,content:t,markup:n,...r})=>{const o=t.kind==="streaming"?Jc(t.path,c.use(t.promise)):t;return o.kind!=="document"?l.jsx(En,{label:r.regionLabel(e,null)}):l.jsx(Yc,{path:o.path,snapshot:o.snapshot,markup:n,stale:o.stale,...r})},Ho=({path:e,absence:t,markup:n,display:r,navigation:o,fragment:s,paneScroll:a,announces:i,announceFailure:h,onDocumentShown:p})=>{const{config:f,labels:d,locale:g,theme:w,documents:v,data:E,fetch:k}=$(),T=Oe.useMarkdownToolbarState(),O=c.useRef(!1);c.useLayoutEffect(()=>{O.current=!0},[]);const[N,M]=c.useState(null),[C,B]=c.useState(n),I=c.useCallback(()=>e===null?void 0:v.peek(e),[v,e]),H=c.useSyncExternalStore(v.subscribe,I,I),_=c.useCallback(()=>N===null?void 0:v.peek(N),[v,N]),U=c.useSyncExternalStore(v.subscribe,_,_);c.useLayoutEffect(()=>e===null?void 0:v.open(e),[v,e]),c.useLayoutEffect(()=>N===null?void 0:v.retain(N),[v,N]);const Z=e===null?yn:Qc(e,H,N,U,!O.current),Q=e===null?null:Z.kind==="document"&&!Z.stale?Z.path:N;Q!==N&&M(Q);const u=Z.kind!=="document"||Z.path===e;u&&n!==C&&B(n);const m=c.useMemo(()=>_l(d,g),[d,g]),b=c.useMemo(()=>({read:(D,q)=>Gi(E,D,q)}),[E]),x=c.useMemo(()=>[...f.iframeHosts],[f]),L=o.kind==="panel",F=fn(),y=c.useMemo(()=>({labels:m,labelsLang:g,spreadsheetLocale:g,spreadsheetTapScrollCircle:Jr(F),spreadsheetScrollBarControls:ln(F),emptyMessage:d.documentEmpty,theme:w,availableStyles:f.documentStyles,iFrameAllowedDomains:x,embeds:f.embeds,fetch:k,linkComponent:nl,toolbar:T,style:r.style,onStyleChange:r.onStyleChange,align:r.align,onAlignChange:r.onAlignChange,measure:r.measure,onMeasureChange:r.onMeasureChange,contentColors:r.documentColors,onContentColorsChange:r.onDocumentColorsChange,showToc:r.showToc,showStyle:r.showStyle,showAlign:r.showAlign,showMeasure:r.showMeasure,showContentColors:r.showContentColors,padding:r.padding,width:r.width===void 0?void 0:`min(${r.width}, 100%)`,maxWidth:r.maxWidth===void 0?void 0:`min(${r.maxWidth}, 100%)`,renderScrollBar:L?void 0:Zr,scrollBarInlineSize:L?void 0:cn,scrollBarGutter:L?void 0:un,imageSource:b}),[m,g,F,d.documentEmpty,w,f.documentStyles,x,f.embeds,k,T,r,L,b]),S=c.useCallback((D,q)=>L?q===null||q.kind==="failure"?P.lastPathSegment(D):q.name:d.documentRegion,[L,d.documentRegion]),A=L?"content":"fill";return e===null?l.jsx(Ee,{value:A,children:l.jsx(Uc,{absence:t,announces:i,announceFailure:h})}):l.jsx(Ee,{value:A,children:l.jsx(c.Suspense,{fallback:l.jsx(En,{label:S(e,null)}),children:l.jsx(ed,{requestedPath:e,content:Z,markup:u?n:C,viewer:y,editLayout:r.editLayout,regionLabel:S,navigation:o,fragment:s,paneScroll:a,announces:i,announceFailure:h,onDocumentShown:p})})})},Vo=()=>{const{viewSettings:e}=$(),t=ge(s=>s.measure),n=ge(s=>s.documentColors),r=c.useCallback(s=>e.update({measure:s}),[e]),o=c.useCallback(s=>e.update({documentColors:s}),[e]);return c.useMemo(()=>({measure:t,onMeasureChange:r,documentColors:n,onDocumentColorsChange:o}),[t,r,n,o])},td=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:a,announcer:i}=$(),h=ge(_=>_.style),p=ge(_=>_.align),f=De(),d=ae.useLocation(),g=Et(),{overrides:w,embed:v}=r,E=c.useCallback(_=>{if(g.kind!=="location")return;const U=Bc(s,g.location,_);U!==null&&f(U,"browse")},[s,f,g]),k=c.useCallback(_=>{a.update({style:_}),E("style")},[a,E]),T=c.useCallback(_=>{a.update({align:_}),E("align")},[a,E]),O=Ro(s,w.style,h),N=Co(w.align,p),M=Vo(),C=c.useMemo(()=>({style:O,onStyleChange:k,align:N,onAlignChange:T,...M,showToc:v.showToc!==!1,showStyle:v.showStyle!==!1,showAlign:v.showAlign!==!1,showMeasure:v.showStyle!==!1,showContentColors:v.showStyle!==!1,padding:v.padding,width:v.width,maxWidth:v.maxWidth,editLayout:"fill"}),[O,k,N,T,M,v]),B=r,I=c.useMemo(()=>({kind:"page",fragment:d.hash,navigation:d}),[d]),H=c.useCallback(_=>i.announce(_),[i]);return l.jsx(Ho,{path:e,absence:t,markup:n,display:C,navigation:B,fragment:I,paneScroll:Mi,announces:!0,announceFailure:H,onDocumentShown:o})},nd=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:a}=$(),i=ge(I=>I.style),h=ge(I=>I.align),[p,f]=c.useState(()=>Ro(s,void 0,i)),d=Co(void 0,h),g=c.useCallback(I=>a.update({align:I}),[a]),w=Vo(),{maximized:v,onDocumentLink:E,pendingHash:k,onHashConsumed:T,announceFailure:O,paneScroll:N}=r,M=c.useMemo(()=>({style:p,onStyleChange:f,align:d,onAlignChange:g,...w,showToc:v,showStyle:v,showAlign:v,showMeasure:v,showContentColors:v,padding:void 0,width:void 0,maxWidth:void 0,editLayout:v?"fill":"content"}),[p,d,g,w,v]),C=c.useMemo(()=>({kind:"panel",onDocumentLink:E}),[E]),B=c.useMemo(()=>({kind:"panel",fragment:k,consume:T}),[k,T]);return l.jsx(Ho,{path:e,absence:t,markup:n,display:M,navigation:C,fragment:B,paneScroll:N,announces:!1,announceFailure:O,onDocumentShown:o})},zo=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>r.kind==="page"?l.jsx(td,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o}):l.jsx(nd,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o});function rd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Go=R.forwardRef(rd);function od({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M3.22 3.22a.75.75 0 0 1 1.06 0l3.97 3.97V4.5a.75.75 0 0 1 1.5 0V9a.75.75 0 0 1-.75.75H4.5a.75.75 0 0 1 0-1.5h2.69L3.22 4.28a.75.75 0 0 1 0-1.06Zm17.56 0a.75.75 0 0 1 0 1.06l-3.97 3.97h2.69a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75V4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0ZM3.75 15a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-2.69l-3.97 3.97a.75.75 0 0 1-1.06-1.06l3.97-3.97H4.5a.75.75 0 0 1-.75-.75Zm10.5 0a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-2.69l3.97 3.97a.75.75 0 1 1-1.06 1.06l-3.97-3.97v2.69a.75.75 0 0 1-1.5 0V15Z",clipRule:"evenodd"}))}const sd=R.forwardRef(od);function ad({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M15 3.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0V5.56l-3.97 3.97a.75.75 0 1 1-1.06-1.06l3.97-3.97h-2.69a.75.75 0 0 1-.75-.75Zm-12 0A.75.75 0 0 1 3.75 3h4.5a.75.75 0 0 1 0 1.5H5.56l3.97 3.97a.75.75 0 0 1-1.06 1.06L4.5 5.56v2.69a.75.75 0 0 1-1.5 0v-4.5Zm11.47 11.78a.75.75 0 1 1 1.06-1.06l3.97 3.97v-2.69a.75.75 0 0 1 1.5 0v4.5a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1 0-1.5h2.69l-3.97-3.97Zm-4.94-1.06a.75.75 0 0 1 0 1.06L5.56 19.5h2.69a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75v-4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Zo=R.forwardRef(ad);function id({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Wo=R.forwardRef(id);function ld({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 cd=R.forwardRef(ld);function dd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 ud=R.forwardRef(dd);function fd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 md=R.forwardRef(fd);function hd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 pd=R.forwardRef(hd);function wd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),R.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 Ko=R.forwardRef(wd);function gd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 vd=R.forwardRef(gd);function Ed({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M15 3.75H9v16.5h6V3.75ZM16.5 20.25h3.375c1.035 0 1.875-.84 1.875-1.875V5.625c0-1.036-.84-1.875-1.875-1.875H16.5v16.5ZM4.125 3.75H7.5v16.5H4.125a1.875 1.875 0 0 1-1.875-1.875V5.625c0-1.036.84-1.875 1.875-1.875Z"}))}const yd=R.forwardRef(Ed),Xo=({href:e,onRetry:t,testId:n})=>{const{labels:r,onEditGrant:o}=$(),[s,a]=c.useState(!1),i=()=>{o===void 0||s||(a(!0),o(e).then(h=>{h&&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:i,children:r.editGrantAction}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":`${n}-retry`,onClick:t,children:r.editGrantRetry})]})]})},xd="Control+E Meta+E",Yo=(e,t,n)=>n&&t?"split":e.view,Jt=(e,t,n,r)=>{if(n==="split"){e.setSideBySide(!0);return}e.setView(t,n),r&&e.sideBySide()&&e.setSideBySide(!1)},bd=e=>e==="split"?null:e,Qo=e=>e==="preview"?"editor":"preview",Jo=e=>/Mac|iPhone|iPad|iPod/u.test(e),es=(e,t)=>{if(e.isComposing||e.altKey||e.shiftKey||(t?!e.metaKey||e.ctrlKey:!e.ctrlKey||e.metaKey))return!1;const n=e.key.toLowerCase();return n==="e"||e.code==="KeyE"&&/^\p{L}$/u.test(n)&&!/^[a-z]$/u.test(n)},tr=(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)},Sd=({path:e,documentName:t,open:n,onClose:r})=>{const{data:o,edits:s,labels:a,locale:i,announcer:h}=$(),p=c.useId(),[f,d]=c.useState(null),[g,w]=c.useState(0),[v,E]=c.useState(null),[k,T]=c.useState(null),[O,N]=c.useState(0),M=c.useMemo(()=>new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"short"}),[i]),C=c.useCallback(()=>{E(null),T(null)},[]),B=Mr({open:n,onOpen:C,onDismiss:r});c.useEffect(()=>{if(!n)return;const _=new AbortController;return d(null),o.revisions(e,_.signal).then(U=>{"kind"in U&&d(U)}),()=>_.abort()},[n,o,e,g]),c.useEffect(()=>{if(!n||v===null)return;const _=new AbortController;return T(null),o.revision(e,v,_.signal).then(U=>{"kind"in U&&T(U)}),()=>_.abort()},[n,o,e,v,O]);const I=()=>{k===null||k.kind!=="revision"||(s.replaceDraft(e,k.text),h.announce(a.historyRestored(t)),r())},H=f!==null&&f.kind==="revisions"?f.revisions.find(_=>_.id===v):void 0;return l.jsx("dialog",{...B,className:"aqmx-confirm aqmx-history","aria-labelledby":p,"data-testid":"markdown-explorer-history",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)}),f===null?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-loading",children:a.historyLoading}):f.kind==="failure"?l.jsx(ve,{failure:f.failure,alert:!1,onRetry:()=>w(_=>_+1),testId:"markdown-explorer-history-failure"}):f.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:f.revisions.map(_=>l.jsx("li",{children:l.jsxs("button",{type:"button",className:"aqmx-history-entry","aria-pressed":_.id===v,"data-testid":"markdown-explorer-history-entry",onClick:()=>E(_.id),children:[l.jsx("span",{children:tr(_,M,a.historyEntry)}),_.current?l.jsx("span",{className:"aqmx-history-mark",children:a.historyCurrent}):null,_.kept?l.jsx("span",{className:"aqmx-history-mark",children:a.historyKept}):null]})},_.id))}),v===null?null:k===null?l.jsx("p",{className:"aqmx-history-note",children:a.historyLoading}):k.kind==="failure"?l.jsx(ve,{failure:k.failure,alert:!1,onRetry:()=>N(_=>_+1),testId:"markdown-explorer-history-revision-failure"}):l.jsx("section",{className:"aqmx-history-text",tabIndex:0,"aria-label":H===void 0?a.historyTitle(t):tr(H,M,a.historyEntry),"data-testid":"markdown-explorer-history-text",children:l.jsx("pre",{children:k.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":k===null||k.kind!=="revision","data-testid":"markdown-explorer-history-restore",onClick:I,children:a.historyRestore})]})]})})},kd=(e,t)=>{if(!t||e===void 0||e.history||!e.dirty||e.phase.kind!=="editing")return!1;const{kind:n}=e.save;return n!=="draft"&&n!=="saving"&&n!=="conflicts"},ts=e=>{const{edits:t,labels:n,confirmUnversionedSaves:r}=$(),[o,s]=c.useState(!1),a=c.useCallback(()=>{t.flush(e),kd(t.session(e),r)?s(!0):t.save(e)},[t,e,r]),i=l.jsx(on,{open:o,title:n.unversionedSaveTitle,body:n.unversionedSaveBody,confirmLabel:n.unversionedSaveConfirm,cancelLabel:n.unsavedStay,testId:"markdown-explorer-unversioned-save-confirm",onConfirm:()=>{s(!1),t.save(e)},onCancel:()=>s(!1)});return{requestSave:a,confirmation:i}},Td=e=>{const{documents:t}=$(),n=c.useCallback(()=>t.peek(e),[t,e]),r=c.useCallback(()=>t.peekSeeded(e),[t,e]),o=c.useSyncExternalStore(t.subscribe,n,r),s=pe(o)?.document;return s===void 0||s.kind==="failure"?{edit:null,name:P.lastPathSegment(e)}:{edit:s.kind==="markdown"||s.kind==="spreadsheet"?s.edit:null,name:s.name}},ue=e=>{e.stopPropagation()},Rd=({path:e,documentName:t,iconOnly:n,previewAvailable:r,draft:o})=>{const{draftConverter:s,edits:a,labels:i}=$(),h=c.useSyncExternalStore(a.subscribe,()=>a.session(e)!==void 0,()=>!1),[p,f]=c.useState(null),d=()=>{if(!h){a.start(e,a.viewAnchor(e));return}a.flush(e);const E=a.session(e);E?.dirty===!0?f(E.save.kind==="draft"?"draft":"unsaved"):a.close(e)},g=()=>{h||(ua(),r&&a.sideBySide()&&s?.prepare?.())},w=n?o?i.editDraftDocumentNamed(t):i.editDocumentNamed(t):null,v=o?i.editDraftDocument:i.editDocument;return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:w===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:h?i.closeEditor:w===null?v:w,"aria-label":w===null?void 0:w,"aria-pressed":h,"data-testid":"markdown-explorer-document-edit",onClick:d,onDoubleClick:ue,onPointerEnter:g,onFocus:g,children:[l.jsx(vd,{"aria-hidden":"true"}),w===null?l.jsx("span",{children:i.editDocumentLabel}):null]}),l.jsx(on,{open:p!==null,title:p==="draft"?i.draftDiscardTitle:i.unsavedTitle,body:p==="draft"?i.draftDiscardBody(t):i.unsavedBody(t),confirmLabel:i.unsavedDiscard,cancelLabel:i.unsavedStay,testId:"markdown-explorer-edit-close-confirm",onConfirm:()=>{f(null),a.close(e)},onCancel:()=>f(null)})]})},Cd=({href:e,documentName:t,iconOnly:n})=>{const{labels:r}=$(),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:ue,children:[l.jsx(cd,{"aria-hidden":"true"}),o===null?l.jsx("span",{children:r.editExternallyLabel}):null]})},Md=({session:e})=>{const{labels:t}=$(),n=qs(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})},Ld=Object.freeze(["editor","split","preview"]),Od=Object.freeze(["editor","preview"]),Ad=Object.freeze({editor:Wo,split:yd,preview:Ko}),Dd=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{draftConverter:s,edits:a,labels:i}=$(),h=_r(),p=Yo(r,h,o),f=o?Ld:Od,d=c.useId(),g=c.useRef(new Map),w={editor:{label:i.editViewEditor,tooltip:i.editViewEditorTooltip},split:{label:i.editViewSplit,tooltip:i.editViewSplitTooltip},preview:{label:i.editViewPreview,tooltip:i.editViewPreviewTooltip}},v=()=>{a.preparePreview(e),s?.prepare?.()},E=k=>{if(!es(k.nativeEvent,Jo(navigator.platform)))return;rn(k);const T=Qo(p);Jt(a,e,T,o),g.current.get(T)?.focus()};return l.jsx("div",{role:"radiogroup","aria-label":n?i.editViewNamed(t):i.editView,className:"aqmx-edit-view","data-testid":"markdown-explorer-edit-view",onKeyDown:E,children:f.map(k=>{const T=Ad[k],{label:O,tooltip:N}=w[k],M=k==="preview"?v:void 0;return l.jsxs("label",{className:n?"aqmx-icon-button":"aqmx-icon-button aqmx-labelled-button",children:[l.jsx("input",{ref:C=>{C===null?g.current.delete(k):g.current.set(k,C)},type:"radio",name:d,value:k,checked:k===p,"aria-label":O,"aria-keyshortcuts":k==="split"?void 0:xd,title:N,"data-testid":`markdown-explorer-edit-view-${k}`,onChange:()=>Jt(a,e,k,o),onDoubleClick:ue,onPointerEnter:M,onFocus:M}),l.jsx(T,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:O})]},k)})})},Nd=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{edits:s,labels:a}=$(),[i,h]=c.useState(!1),{requestSave:p,confirmation:f}=ts(e);if(r.phase.kind!=="editing")return null;const d=r.save.kind==="saving",g=d||!r.dirty,w=()=>{s.flush(e);const E=s.session(e);E===void 0||!E.dirty||E.save.kind==="saving"||p()},v=E=>n?{className:"aqmx-icon-button","aria-label":E}:{className:"aqmx-icon-button aqmx-labelled-button"};return l.jsxs(l.Fragment,{children:[r.save.kind==="conflicts"?l.jsxs("button",{type:"button",...v(a.conflictNext),title:a.conflictNext,"data-testid":"markdown-explorer-edit-next-conflict",onClick:()=>s.nextConflict(e),onDoubleClick:ue,children:[l.jsx(ud,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.conflictNext})]}):null,l.jsx(Dd,{path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o}),r.history?l.jsxs("button",{type:"button",...v(a.historyOpen),title:a.historyOpen,"aria-haspopup":"dialog","data-testid":"markdown-explorer-edit-history",onClick:()=>h(!0),onDoubleClick:ue,children:[l.jsx(md,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.historyOpen})]}):null,r.save.kind==="draft"?null:l.jsxs("button",{type:"button",...v(a.saveDraft),title:a.saveDraftTooltip,"aria-disabled":g,"aria-busy":d,"aria-keyshortcuts":"Control+S Meta+S","data-testid":"markdown-explorer-edit-save",onClick:w,onDoubleClick:ue,children:[l.jsx(pd,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.saveDraft})]}),r.history?l.jsx(Sd,{path:e,documentName:t,open:i,onClose:()=>h(!1)}):null,f]})},_d=({path:e,session:t})=>{const{edits:n}=$();return t.save.kind!=="grant"?null:l.jsx(Xo,{href:t.save.href,onRetry:()=>{n.save(e)},testId:"markdown-explorer-save-grant"})},ns=c.createContext(null),jd=(e,t)=>{switch(t){case"markdown":return e.showMarkup;case"svg":return e.showSvgMarkup;case"csv":case"tsv":return e.showSpreadsheetMarkup(t.toUpperCase())}},Pd=({maximize:e})=>{const{labels:t}=$(),n=e.maximized?t.documentRestore:t.documentMaximize;return l.jsx("button",{type:"button",className:"aqmx-icon-button",title:n,"aria-label":n,"data-testid":"markdown-explorer-document-maximize",onClick:e.toggle,onDoubleClick:ue,children:e.maximized?l.jsx(sd,{"aria-hidden":"true"}):l.jsx(Zo,{"aria-hidden":"true"})})},rs=Object.freeze({kind:"page"}),os=({path:e,placement:t,markup:n,maximize:r})=>{const{labels:o}=$(),{refreshing:s,unavailable:a,failure:i,refresh:h}=ro(e,t.kind==="page",n.shown),p=El(e),f=Td(e),d=Dr(e),g=t.kind==="panel"?o.refreshDocumentNamed(t.documentName):null,w=t.kind==="panel"?o.showMarkupNamed(t.documentName):null,v=t.kind==="panel",E=t.kind==="panel"?t.documentName:f.name,k=t.kind==="page"||t.maximized,T=c.use(ns),O=t.kind==="page"?T:null,N=O===null?null:O.onBar;c.useLayoutEffect(()=>{if(N!==null)return N(!0),()=>N(!1)},[N]);const M=O===null?void 0:O.lane?"merged":"covering";return l.jsxs("div",{className:"aqmx-document-refresh-bar","data-testid":"markdown-explorer-document-refresh-bar","data-aqmx-editing":d===void 0?void 0:"true","data-aqmx-sheet-bar":M,children:[l.jsxs("div",{className:"aqmx-document-refresh-row",children:[d===void 0?null:l.jsx(Md,{session:d}),d===void 0?null:l.jsx(Nd,{path:e,documentName:E,iconOnly:v,session:d,previewAvailable:k}),d===void 0&&p!==null?l.jsxs("button",{type:"button",className:w===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:w===null?jd(o,p):w,"aria-label":w===null?void 0:w,"aria-pressed":n.shown,"data-testid":"markdown-explorer-document-markup",onClick:n.toggle,onDoubleClick:ue,children:[l.jsx(Wo,{"aria-hidden":"true"}),w===null?l.jsx("span",{children:o.showMarkupLabel}):null]}):null,d!==void 0||f.edit?.kind==="inline"||f.edit?.kind==="draft"?l.jsx(Rd,{path:e,documentName:E,iconOnly:v,previewAvailable:k,draft:f.edit?.kind==="draft"}):f.edit?.kind==="external"?l.jsx(Cd,{href:f.edit.href,documentName:E,iconOnly:v}):null,d===void 0?l.jsxs("button",{type:"button",className:g===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:g===null?o.refreshDocument:g,"aria-label":g===null?void 0:g,"aria-disabled":a,"aria-busy":s,"data-aqmx-busy":s?"true":void 0,"data-testid":"markdown-explorer-document-refresh",onClick:h,onDoubleClick:ue,children:[l.jsx(Go,{"aria-hidden":"true"}),g===null?l.jsx("span",{children:o.refreshDocumentLabel}):null]}):null,r===null?null:l.jsx(Pd,{maximize:r})]}),d!==void 0||i===null?null:l.jsx("p",{className:"aqmx-document-refresh-failure","data-testid":"markdown-explorer-document-refresh-failure","data-aqmx-failure":i.reason,children:o.documentRefreshFailed(ce(o,i.reason))}),d===void 0?null:l.jsx(_d,{path:e,session:d})]})},Id=({location:e})=>{const t=e.doc,n=c.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]),r=go(e);return l.jsxs("div",{className:"aqmx-single aqmx-document-column","data-testid":"markdown-explorer-single",...ft,children:[l.jsx(os,{path:t,placement:rs,markup:r,maximize:null}),l.jsx(zo,{path:t,absence:Bo,markup:e.markup,variant:n})]})},ss=({holds:e,deferWhileFullscreenIn:t,testId:n})=>{const{labels:r,announcer:o}=$(),s=c.useId();c.useLayoutEffect(()=>{if(!e)return;const h=t===null?null:()=>t.current!==null&&wa(t.current);return o.claim(s,h)},[e,o,s,t]),c.useEffect(()=>{if(t===null)return;const h=t.current;if(h===null)return;const p=()=>o.publishDeferred();return h.addEventListener("close",p,!0),()=>h.removeEventListener("close",p,!0)},[o,t]);const a=c.useCallback(()=>o.shownIn(s),[o,s]),i=c.useSyncExternalStore(o.subscribe,a,a);return l.jsx("div",{className:"aqmx-sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":n,children:i.length>1?r.announcementSequence(i):i[0]})},Te=Object.freeze([]),Fd=e=>{const t=new Set;let n=Te,r=[],o=!1;const s=[];let a=[];const i=w=>{n=w;for(const v of[...t])v()},h=()=>s.at(-1)?.region,p=()=>s.at(-1)?.defers?.()===!0,f=w=>{const v=h();w(),h()!==v&&n!==Te&&i(Te)},d=()=>{o=!1;const w=r.map(E=>"sentence"in E?E.sentence:E.list(E.items));if(r=[],p()){for(const E of w)a.at(-1)!==E&&a.push(E);return}const v=[...a,...w];a=[],i(Object.freeze(v))},g=()=>{o||(o=!0,n!==Te&&i(Te),e.request(d))};return{announce:w=>{if(typeof w=="string")r.push({sentence:w});else{const v=r.find(E=>"list"in E&&E.list===w.list);v!==void 0&&"items"in v?v.items.push(w.item):r.push({list:w.list,items:[w.item]})}g()},subscribe:w=>(t.add(w),()=>{t.delete(w)}),claim:(w,v)=>{const E={region:w,defers:v};return f(()=>s.push(E)),()=>f(()=>{const k=s.indexOf(E);k!==-1&&s.splice(k,1)})},publishDeferred:()=>{a.length>0&&!p()&&g()},shownIn:w=>h()===w?n:Te}},he=Object.freeze({status:"cancelled"}),nr=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(P.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return P.failureOf(n,r)},$d=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((f,d)=>globalThis.fetch(f,d)),o=(f,d)=>`${e}/${f}?${new URLSearchParams(d).toString()}`,s=f=>{f.status===401&&t(null);const d=f.headers.get(P.EXPLORER_SCOPE_HEADER);d!==null&&t(d)},a=async(f,d,g,w)=>{let v;try{v=await r(f,{credentials:"same-origin",...d,headers:{Accept:"application/json",...d.headers}})}catch{return w({reason:"failed"})}s(v);let E;try{E=await v.json()}catch{return w({reason:P.failureReasonOfStatus(v.status)})}let k;try{k=g(E)}catch{k=!1}if(k)return E;const T=nr(E);return w(T!==null?T:{reason:v.status===200?"failed":P.failureReasonOfStatus(v.status)})},i={[P.EXPLORER_PROOF_HEADER]:P.EXPLORER_REFRESH_PROOF},h={[P.EXPLORER_PROOF_HEADER]:P.EXPLORER_EDIT_PROOF,"Content-Type":`${P.EXPLORER_DRAFT_MEDIA_TYPE}; charset=utf-8`},p=async(f,d,g)=>{const w=await a(f,d,g,v=>P.failureDocument(v.reason,v.code));return d.signal.aborted?he:w};return{tree:f=>a(o("tree",{[P.EXPLORER_DATA_QUERY.source]:f}),{method:"GET"},P.isExplorerTreeResult,d=>({status:"error",failure:d})),children:async(f,d,g)=>{const w=await a(o("children",{[P.EXPLORER_DATA_QUERY.source]:f,[P.EXPLORER_DATA_QUERY.path]:d}),{method:"GET",signal:g},P.isExplorerChildrenResult,v=>({status:"error",failure:v}));return g.aborted?he:w},ancestors:async(f,d,g)=>{const w=await a(o("ancestors",{[P.EXPLORER_DATA_QUERY.source]:f,[P.EXPLORER_DATA_QUERY.path]:d}),{method:"GET",signal:g},P.isExplorerAncestorsResult,v=>({status:"error",failure:v}));return g.aborted?he:w},reveal:async(f,d,g)=>{const w=await a(o("reveal",{[P.EXPLORER_DATA_QUERY.source]:f,[P.EXPLORER_DATA_QUERY.path]:d}),{method:"GET",signal:g},P.isExplorerRevealResult,v=>({status:"error",failure:v}));return g.aborted?he:w},document:(f,{refresh:d})=>a(o("document",{[P.EXPLORER_DATA_QUERY.path]:f}),d?{method:"GET",headers:i}:{method:"GET"},P.isExplorerDocument,g=>P.failureDocument(g.reason,g.code)),text:async(f,d)=>{const g=await a(o("text",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:d},P.isExplorerTextAnswer,w=>P.failureDocument(w.reason,w.code));return d.aborted?he:g},asset:async(f,d)=>{let g;try{g=await r(f,{method:"GET",credentials:"same-origin",signal:d})}catch{return d.aborted?he:{status:"error",failure:{reason:"failed"}}}if(s(g),g.ok)return d.aborted?he:{status:"ok",body:g.body===null?new ReadableStream({start:E=>E.close()}):g.body};let w=null;try{w=await g.json()}catch{}if(d.aborted)return he;const v=nr(w);return{status:"error",failure:v===null?{reason:P.failureReasonOfStatus(g.status)}:v}},edit:(f,d)=>p(o("edit",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:d},P.isExplorerEditAnswer),save:(f,d,g,w)=>p(o("save",{[P.EXPLORER_DATA_QUERY.path]:f,[P.EXPLORER_DATA_QUERY.base]:d}),{method:"POST",headers:h,body:g,signal:w},P.isExplorerSaveAnswer),preview:(f,d,g)=>p(o("preview",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"POST",headers:h,body:d,signal:g},P.isExplorerPreviewAnswer),revisions:(f,d)=>p(o("revisions",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:d},P.isExplorerRevisionsAnswer),revision:(f,d,g)=>p(o("revision",{[P.EXPLORER_DATA_QUERY.path]:f,[P.EXPLORER_DATA_QUERY.revision]:d}),{method:"GET",signal:g},P.isExplorerRevisionAnswer),refresh:f=>a(o("refresh",{[P.EXPLORER_DATA_QUERY.source]:f}),{method:"POST",headers:i},P.isExplorerTreeResult,d=>({status:"error",failure:d}))}},qd=()=>{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}}},Bd=e=>{const t=se.readStorage(e);if(t===null)return G.NO_TREE_SETTING_CHANGES;try{return G.readTreeSettingChanges(JSON.parse(t))}catch(n){return console.warn(`[markdown-explorer] localStorage key ${V.describeValue(e)} does not hold JSON; using the default tree settings.`,n),G.NO_TREE_SETTING_CHANGES}},rr=(e,t)=>{let n=null;const r=()=>{if(n===null){const s=Bd(e);n={changes:s,settings:G.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:i}=r(),h=G.recordTreeSettingChange(a,s,G.advanceTreeSetting(i,s)[s],t);return n={changes:h,settings:G.applyTreeSettingChanges(t,h)},o.emit(),se.writeStorage(e,G.serializeTreeSettingChanges(h)),n.settings}}},Ud=Object.freeze({status:"refreshed"}),Hd=Object.freeze({status:"superseded"}),Vd=Object.freeze({status:"unshown"}),en=Object.freeze({status:"deferred"}),zd=Lr(en),as=4,Gd=as-1,or=Object.freeze({status:"loading"}),Zd=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),Wd=e=>{const t=new Map,n=to(),r=new Map,o=new Map,s=new Map,a=new Map,i=Ae(),h=new Set;let p=0,f=0;const d={direct:null,bulk:null},g=new Set;let w=!1,v=0;const E=()=>{v+=1,i.emit()},k=y=>o.get(y)??0,T=y=>{let S=a.get(y);return S===void 0&&(S={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},a.set(y,S)),S},O=(y,S,A)=>{y.inFlight.delete(S),p-=1,A.lane==="bulk"&&(f-=1)},N=y=>{const S=a.get(y);if(S!==void 0){for(const[A,D]of[...S.inFlight])O(S,A,D),D.controller.abort();S.direct.clear(),S.bulk.clear(),S.unclaimed.clear()}},M=y=>{const S=k(y)+1;return o.set(y,S),N(y),S},C=(y,S)=>{const A=He(y),D={promise:y,opened:S,stale:!1,loadedAt:A?.status==="ok"?A.loadedAt:null};return y.status==="pending"&&y.then(q=>{q.status==="ok"&&(D.loadedAt=q.loadedAt)}),D},B=y=>{let S=r.get(y);return S===void 0&&(S=new Map,r.set(y,S)),S},I=y=>{const S=[...a.keys()],A=d[y],D=A===null?0:S.indexOf(A)+1;for(let q=0;q<S.length;q+=1){const X=S[(D+q)%S.length],K=X===void 0?void 0:a.get(X);if(!(X===void 0||K===void 0)){for(const W of K[y])if((K.claims.get(W)??0)!==0)return K[y].delete(W),d[y]=X,{sourceId:X,path:W}}}return null},H=(y,S,A,D)=>{const q=a.get(y);if(q===void 0||q.inFlight.get(S)!==A)return;O(q,S,A);const X=(q.claims.get(S)??0)>0,K=B(y);if(D.status==="ok"?K.set(S,{status:"loaded",entries:D.entries}):D.status==="error"&&X?K.set(S,{status:"failed",failure:D.failure}):K.delete(S),E(),D.status==="error"&&X){const W={sourceId:y,path:S,failure:D.failure};for(const re of[...h])re(W)}U()},_=(y,S,A)=>{const D={controller:new AbortController,lane:A};T(y).inFlight.set(S,D),p+=1,A==="bulk"&&(f+=1),e.children(y,S,D.controller.signal).then(q=>H(y,S,D,q),()=>H(y,S,D,Zd))},U=()=>{for(;p<as;){const y=I("direct");if(y!==null){_(y.sourceId,y.path,"direct");continue}const S=f<Gd?I("bulk"):null;if(S===null)return;_(S.sourceId,S.path,"bulk")}},Z=(y,S,A)=>{if(!(S.direct.delete(A)||S.bulk.delete(A))){const q=S.inFlight.get(A);if(q===void 0)return!1;O(S,A,q),q.controller.abort()}return r.get(y)?.delete(A),!0},Q=()=>{w=!1;let y=!1;for(const S of g){const A=T(S);for(const D of A.unclaimed)(A.claims.get(D)??0)===0&&Z(S,A,D)&&(y=!0);A.unclaimed.clear()}g.clear(),y&&(E(),U())},u=(y,S)=>{t.set(y,C(Ge(e.tree(y)),S))},m=(y,S,A)=>{M(y);const D=C(Lr(S),A);return t.set(y,D),r.delete(y),E(),U(),D},b=(y,S,A,D)=>{if(A!==k(y)||t.get(y)!==S)return;const q=He(S.promise);if(!(D.status!=="ok"||q?.status!=="ok"||S.loadedAt===null||D.loadedAt<=S.loadedAt)){if(ht(q.entries,D.entries)){S.loadedAt=D.loadedAt;return}m(y,D,S.opened)}},x=(y,S)=>{const A=t.get(y);return A!==void 0&&He(A.promise)?.status===S},L=(y,S)=>{S.stale=!1;const A=k(y);e.tree(y).then(D=>b(y,S,A,D))},F=async(y,S)=>{const A=(s.get(y)??0)+1;s.set(y,A);const D=await e.refresh(y);if(s.get(y)!==A)return Hd;if(D.status==="error")return{status:"failed",failure:D.failure};const q=t.get(y);if(!(q!==void 0&&q.loadedAt!==null&&x(y,"ok")&&q.loadedAt>D.loadedAt)){const K=m(y,D,!0);if(q!==void 0&&q.promise.status==="pending"){const W=k(y);q.promise.then(re=>b(y,K,W,re))}}if(S)for(const[K,W]of t)K!==y&&He(W.promise)?.status==="ok"&&(W.stale=!0);return Ud};return{read:y=>t.get(y)?.promise??zd,open:y=>{const S=n.resumes(y),A=n.hold(y),D=t.get(y);return D===void 0||x(y,"deferred")?(u(y,!0),E()):S||(D.opened&&x(y,"error")?(u(y,!0),E()):(D.opened=!0,D.stale&&x(y,"ok")&&L(y,D))),A},retry:y=>{x(y,"error")&&(u(y,!0),E())},seed:(y,S)=>{const A=S.then(X=>X===null?en:X,()=>en),D=t.get(y);if(D!==void 0&&x(y,"ok")){const X=k(y);A.then(K=>b(y,D,X,K));return}M(y);const q=C(Ge(A),D?.opened===!0);t.set(y,q),r.delete(y),U(),A.then(X=>{t.get(y)===q&&(X.status==="deferred"&&n.isHeld(y)&&u(y,q.opened),E())})},refresh:y=>F(y,!0),reloadSource:y=>{if(n.isHeld(y))return F(y,!1);const S=t.get(y);return S!==void 0&&(S.stale=!0),Promise.resolve(Vd)},children:(y,S)=>r.get(y)?.get(S),claimChildren:(y,S)=>{const A=T(y),D=B(y);let q=!1,X=!1;for(const[W,re]of S)A.claims.set(W,(A.claims.get(W)??0)+1),D.get(W)===void 0?(D.set(W,or),A[re].add(W),q=!0,X=!0):re==="direct"&&A.bulk.delete(W)&&(A.direct.add(W),X=!0);q&&E(),X&&U();let K=!1;return()=>{if(!K){K=!0;for(const W of S.keys()){const re=(A.claims.get(W)??0)-1;re>0?A.claims.set(W,re):(A.claims.delete(W),A.unclaimed.add(W))}g.add(y),!w&&(w=!0,queueMicrotask(Q))}}},retryChildren:(y,S)=>{const A=r.get(y);if(A===void 0||A.get(S)?.status!=="failed")return;const D=T(y);if((D.claims.get(S)??0)>0){A.set(S,or),D.direct.add(S),E(),U();return}A.delete(S),E()},pendingChildren:y=>{const S=a.get(y);return S===void 0?0:S.direct.size+S.bulk.size+S.inFlight.size},clear:()=>{for(const y of new Set([...t.keys(),...r.keys(),...o.keys(),...a.keys()]))M(y);for(const[y,S]of s)s.set(y,S+1);t.clear(),r.clear(),E()},subscribeChildrenFailures:y=>(h.add(y),()=>{h.delete(y)}),subscribe:i.subscribe,version:()=>v}},Kd=(e,t)=>{let n=e;const r=Ae();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},Xd=1;let it=0,we=null;const Yd=()=>{const{documentElement:e,body:t}=document;it===0&&(we={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"),it+=1;let n=!1;return()=>{n||(n=!0,it-=1,!(it>0||we===null)&&(e.style.overflow=we.htmlOverflow,t.style.overflow=we.bodyOverflow,e.style.scrollbarGutter=we.htmlGutter,t.style.scrollbarGutter=we.bodyGutter,we=null))}},Qd=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],sr=1,Jd=1e3,ar=e=>e.getClientRects().length>0,Bt="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.",eu=e=>{if(!ar(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+Xd)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. ${Bt}`;if(t.height<sr)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. ${Bt}`;for(const{selector:r,name:o}of Qd)for(const s of e.querySelectorAll(r)){if(!ar(s))continue;const a=s.getBoundingClientRect().height;if(a<sr)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. ${Bt}`}return null},tu=e=>{let t=!1,n;const r=()=>{n=void 0;const a=eu(e);a!==null&&(t=!0,console.error(a))},o=()=>{t||(clearTimeout(n),n=setTimeout(r,Jd))},s=typeof ResizeObserver>"u"?null:new ResizeObserver(o);return s?.observe(e),window.addEventListener("resize",o),o(),()=>{clearTimeout(n),s?.disconnect(),window.removeEventListener("resize",o)}},nu=e=>(c.useEffect(()=>e?Yd():void 0,[e]),c.useCallback(t=>e?tu(t):void 0,[e])),ir='[data-testid="markdown-explorer-view-switch"]',ru=[{control:ir,successors:[ir,'[data-testid="markdown-explorer-sheet-toggle"]','[data-testid="markdown-explorer-rail-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],ou=e=>{for(const t of ru){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},su=(e,t)=>{const n=c.useRef(null);c.useEffect(()=>{const o=i=>{const h=e.current;n.current=h!==null&&i instanceof Element&&h.contains(i)?ou(i):null},s=i=>o(i.target);o(document.activeElement);const a=i=>{const h=i.target;i.relatedTarget!==null||!(h instanceof Element)||queueMicrotask(()=>{n.current?.element===h&&h.isConnected&&document.activeElement!==h&&(n.current=null)})};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a)}},[e]);const r=c.useRef(t);c.useLayoutEffect(()=>{if(r.current===t)return;r.current=t;const o=n.current;if(o===null)return;const s=()=>{const h=document.activeElement;if(h!==null&&h!==document.body&&h!==o.element)return!0;const p=e.current;if(p===null)return!0;for(const f of o.control.successors)for(const d of p.querySelectorAll(f))if(d!==o.element&&(d.focus({preventScroll:!0}),document.activeElement===d))return!0;return!1};if(s())return;const a=e.current;if(a===null)return;const i=new MutationObserver(()=>{s()&&i.disconnect()});return i.observe(a,{childList:!0,subtree:!0}),()=>i.disconnect()},[t,e])},au=c.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-Bg2YH-EY.cjs")).then(e=>({default:e.TreeLayout}))),iu=c.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-CxV5SI7f.cjs")).then(e=>({default:e.MultiLayout}))),lu=64,cu={request:e=>{requestAnimationFrame(e)}},lr=e=>{e.documents.clear(),e.trees.clear()},Ut=(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)},du=(e,t)=>{const[n,r]=c.useState(()=>({overrides:t,locale:e,labels:Zt(e,t)}));if(n.locale===e&&Ss(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:Zt(e,t)};return r(o),o.labels},uu=(e,t,n)=>{const[r,o]=c.useState(()=>({scope:t,store:rr(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const s={scope:t,store:rr(e,n)};return o(s),s.store},Ue=(e,t)=>{const[n,r]=c.useState(()=>({scope:e,value:t()}));if(n.scope===e)return n.value;const o={scope:e,value:t()};return r(o),o.value},fu=()=>Fd(cu),cr="on",mu="off",hu=Object.freeze({kind:"unavailable"}),pu=e=>{if(e!==void 0&&(e===null||typeof e!="object"||typeof e.convert!="function"))throw new TypeError("[markdown-explorer] draftConverter must be an object with a convert function")},dr=(e,t)=>{const n=pe(e.peek(t));return n===null||n.document.kind==="failure"?P.lastPathSegment(t):n.document.name},wu=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:s,renderFrame:a,renderTreeFailure:i,lockDocumentScroll:h=!1,onMathDiagnostics:p,onEditGrant:f,draftConverter:d,fetch:g,persistSettings:w,subscribeHostChanges:v,hostChangePolicy:E="reload",ref:k,guardUnload:T=Fe.guardUnload,onReload:O,onSessionEnded:N,onDraftChange:M,accountState:C=Fe.accountState,confirmUnversionedSaves:B=Fe.confirmUnversionedSaves,paletteKey:I})=>{se.assertStorageNamespace(n),pu(d),ms({fetch:g,persistSettings:w,subscribeHostChanges:v,onReload:O,onSessionEnded:N,onDraftChange:M,guardUnload:T,confirmUnversionedSaves:B,hostChangePolicy:E,accountState:C,paletteKey:I});const H=Er(r),_=ks(s),U=du(H,o),{revalidate:Z}=ae.useRevalidator(),Q=c.useRef(()=>{}),u=ae.useHref(t.dataPath),m=c.useRef({fetch:g,persistSettings:w,onReload:O,onSessionEnded:N,onDraftChange:M,hostChangePolicy:E});c.useLayoutEffect(()=>{m.current={fetch:g,persistSettings:w,onReload:O,onSessionEnded:N,onDraftChange:M,hostChangePolicy:E}},[g,w,O,N,M,E]);const[b]=c.useState(()=>({fetch:(j,J)=>{const te=m.current.fetch;return te===void 0?globalThis.fetch(j,J):te(j,J)},reload:()=>{const j=m.current.onReload;j===void 0?Fe.onReload():j()},restoreSession:()=>{const j=m.current.onSessionEnded;return j===void 0?Promise.resolve(!1):j()}})),[x]=c.useState(()=>{const j=$d({dataPath:u,onScope:te=>Q.current(te),fetch:b.fetch}),J={documents:za({client:j,capacity:Math.max(lu,t.multiView.maxPanels*2)}),trees:Wd(j)};return Ut(J,e),se.syncStorageScope(n,e.scope),{data:j,...J,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(x.aligned.pageData!==e||x.aligned.storageNamespace!==n){const j=x.aligned.pageData;x.aligned.pageData=e,x.aligned.storageNamespace=n,j!==e&&(j.scope!==e.scope?x.aligned.pendingReader=e:Ut(x,e)),se.syncStorageScope(n,e.scope)}const L=uu(se.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);c.useLayoutEffect(()=>{const j=x.aligned.pendingReader;j!==null&&(x.aligned.pendingReader=null,lr(x),Ut(x,j))},[e,x]),c.useLayoutEffect(()=>{let j=!1;return Q.current=J=>{J===e.scope||j||(j=!0,J!==null&&(lr(x),se.clearExplorerStorage(n)),Z())},()=>{Q.current=()=>{}}},[e,Z,x,n]);const F=c.useRef(t.settingsCookie);c.useLayoutEffect(()=>{F.current=t.settingsCookie},[t.settingsCookie]);const[y]=c.useState(()=>Kd(e.settings,j=>{const J=m.current.persistSettings;if(J!==void 0){J(G.serializeViewSettings(j));return}document.cookie=G.viewSettingsCookieString(F.current,j,window.location.protocol==="https:")})),S=Ue(e.scope,fu),A=Ue(e.scope,qd),D=Ue(e.scope,$s),q=Ue(e.scope,Rs),X=c.useRef(U);c.useLayoutEffect(()=>{X.current=U},[U]);const K=Ue(e.scope,()=>Gs({data:x.data,conflictLabels:()=>({ours:X.current.conflictOurs,theirs:X.current.conflictTheirs}),onSaveSettled:(j,J)=>{J.kind==="saved"&&x.documents.refresh(j);const te=Bs(X.current,J,dr(x.documents,j));te!==null&&S.announce(te)},sideBySideSetting:{read:()=>se.readStorage(se.storageKeys(n).editPreview)===cr,write:j=>se.writeStorage(se.storageKeys(n).editPreview,j?cr:mu)},editorShareSetting:{read:()=>zs(se.readStorage(se.storageKeys(n).editSplit)),write:j=>se.writeStorage(se.storageKeys(n).editSplit,String(j))}})),W=c.useMemo(()=>Ge(e.notices.catch(()=>[])),[e.notices]),re=e.sources.map(j=>j.id).join(`
17
- `),fe=c.useMemo(()=>G.withExplorerSources(t,re.split(`
18
- `)),[t,re]),le=c.useRef(p);c.useLayoutEffect(()=>{le.current=p},[p]);const[Ne]=c.useState(()=>(j,J)=>{le.current?.(j,J)}),Je=p===void 0?void 0:Ne,xe=c.useRef(d);c.useLayoutEffect(()=>{xe.current=d},[d]);const[Tt]=c.useState(()=>{let j=!1;return{convert:(J,te)=>{const be=xe.current;return be===void 0?Promise.resolve(hu):be.convert(J,te)},prepare:()=>{try{xe.current?.prepare?.()}catch(J){if(j)return;j=!0,console.error("[markdown-explorer] the draft converter's prepare threw",J)}}}}),_e=d===void 0?void 0:Tt;c.useEffect(()=>{if(v===void 0)return;let j=!0;const J=v(te=>{j&&la(te,{trees:x.trees,documents:x.documents,edits:K,documentChanges:q,announcer:S,labels:X.current,nameOf:be=>dr(x.documents,be),policy:m.current.hostChangePolicy})});if(typeof J!="function")throw j=!1,new TypeError(`[markdown-explorer] subscribeHostChanges must return its unsubscribe function; got ${V.describeValue(J)}`);return()=>{j=!1,J()}},[v,x,K,q,S]);const je=M!==void 0;c.useEffect(()=>{if(je)return K.subscribeDrafts(j=>m.current.onDraftChange?.(j))},[K,je]);const me=c.useRef({edits:K,announcer:S,mediaFailures:D});c.useLayoutEffect(()=>{me.current={edits:K,announcer:S,mediaFailures:D}},[K,S,D]);const Pe=c.useRef(null);c.useImperativeHandle(k,()=>({flushUnsaved:()=>{const{edits:j}=me.current;return j.flushDrafts(),j.dirtyPaths()},confirmDiscard:async j=>{hs("confirmDiscard",j);const{edits:J}=me.current,te=J.unsavedAmong([...new Set(j)]);return te.length===0?!0:J.askToDiscard(te)},restoreDrafts:async j=>(ws(j),me.current.edits.restoreDrafts(j)),announce:j=>{gs(j),me.current.announcer.announce(j)},owns:j=>Pe.current?.contains(j)===!0,reportMediaFailure:j=>{vs(j),me.current.mediaFailures.report(j)}}),[]);const et=g===void 0?void 0:b.fetch,tt=O===void 0?Fe.onReload:b.reload,Ie=N===void 0?void 0:b.restoreSession,Rt=c.useMemo(()=>({config:fe,labels:U,locale:H,theme:_,storageNamespace:n,scope:e.scope,sources:e.sources,notices:W,documents:x.documents,trees:x.trees,data:x.data,viewSettings:y,treeSettings:L,announcer:S,reveals:A,edits:K,mediaFailures:D,documentChanges:q,onEditGrant:f,draftConverter:_e,renderTreeFailure:i,reportMathDiagnostics:Je,fetch:et,guardUnload:T,onReload:tt,onSessionEnded:Ie,accountState:C,confirmUnversionedSaves:B,paletteKey:I}),[fe,U,H,_,n,e.scope,e.sources,W,x,y,L,S,A,K,D,q,f,_e,i,Je,et,T,tt,Ie,C,B,I]);return l.jsx(yr,{value:Rt,children:l.jsx(vu,{renderFrame:a,lockDocumentScroll:h,rootRef:Pe},e.scope)})},gu=({ref:e,theme:t,view:n,children:r})=>{const[o]=c.useState(qi);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})},vu=({renderFrame:e,lockDocumentScroll:t,rootRef:n})=>{const{theme:r,labels:o,mediaFailures:s}=$(),a=Et(),{hash:i}=ae.useLocation(),h=De(),p=nu(t),f=c.useCallback(E=>{if(n.current=E,E===null)return;const k=s.observe(E),T=p(E);return()=>{T?.(),k(),n.current=null}},[s,n,p]);c.useLayoutEffect(()=>{a.kind==="redirect"&&h(`${a.href}${i}`,"browse")},[a,i,h]);const{location:d}=a,g=d.view;su(n,g);const w=d.view==="tree"?l.jsx(c.Suspense,{fallback:l.jsx("section",{className:"aqmx-split-fallback","aria-label":o.explorerRegion,"aria-busy":"true","data-testid":"markdown-explorer-split-loading",...ft}),children:l.jsx(au,{location:d})}):d.view==="multi"?l.jsx(c.Suspense,{fallback:l.jsx("section",{className:"aqmx-stage-fallback","aria-label":o.multiRegion,"aria-busy":"true","data-testid":"markdown-explorer-stage-loading",...ft}),children:l.jsx(iu,{location:d})}):l.jsx(Id,{location:d}),v=l.jsxs(gu,{ref:f,theme:r,view:g,children:[w,l.jsx(aa,{}),l.jsx(ss,{holds:!0,deferWhileFullscreenIn:n,testId:"markdown-explorer-announcer"})]});return e===void 0?v:e({view:g,children:v})},Eu=e=>{if(e instanceof Ct.MarkdownResourceExhaustedError||e instanceof Ct.MarkdownConversionTimeoutError)return P.failureDocument("too-large");if(!(e instanceof Ct.MarkdownConversionError))throw e;switch(e.code){case"unavailable":return{kind:"unavailable"};case"invalid_argument":return P.failureDocument("invalid");case"internal":return P.failureDocument("failed");default:throw e}},yu=e=>({timeoutMs:e.conversion.deadlineMs,options:{deniedPathSegments:[...e.deny],maxHtmlBytes:e.conversion.maxHtmlBytes,includeSourceLines:!0}}),xu=ls.createShouldRevalidate({submissions:"skip",otherPath:"skip",query:"skip",hashChange:"skip"});exports.ALLOW_KEY_REPEAT=gt;exports.CONFLICT_OURS_MARKER=br;exports.CONFLICT_SEPARATOR=Sr;exports.CONFLICT_THEIRS_MARKER=kr;exports.CONTENT_PANE=ft;exports.ContentSkeleton=ye;exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=mr;exports.DocumentPane=zo;exports.DocumentRefreshBar=os;exports.EXPLORER_ACCOUNT_STATES=fr;exports.EXPLORER_HOST_CHANGE_POLICIES=ur;exports.EXPLORER_THEMES=Wt;exports.EditGrantNotice=Xo;exports.ExplorerLink=Vr;exports.FOLDER_README_LOADING=Or;exports.FailureView=ve;exports.ForwardRef=Go;exports.ForwardRef$1=Ko;exports.ForwardRef$2=Zo;exports.ImageViewMemoryContext=fo;exports.LazyNativeScrollBar=Gr;exports.LiveRegion=ss;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=vr;exports.MARKDOWN_EXPLORER_LABEL_KEYS=nn;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=wr;exports.MARKDOWN_EXPLORER_LOCALES=Gt;exports.MarkdownExplorer=wu;exports.NATIVE_SCROLL_BAR_SLOT_LENGTH=cn;exports.NATIVE_SCROLL_BAR_WIDTH=Oa;exports.NEAREST=wt;exports.NO_DOCUMENT=Bo;exports.PAGE_DOCUMENT_REFRESH=rs;exports.SCROLL_BAR_CONTROLS=Wr;exports.SheetBarContext=ns;exports.TAP_SCROLL_CIRCLE_GUTTER_LENGTH=un;exports.TAP_SCROLL_CIRCLE_OFFSET_X=_a;exports.TAP_SCROLL_CIRCLE_SIZE=dn;exports.TAP_SCROLL_CIRCLE_SPEED_RANGE=Xr;exports.TOUCH_SCROLL_BAR_CONTROLS=Kr;exports.alignToStart=co;exports.anchorOfDoubleClick=Fr;exports.anchorOfView=$r;exports.blockAtLine=Ur;exports.chooseEditView=Jt;exports.consumeKey=rn;exports.createEmitter=Ae;exports.cssPixels=Rr;exports.draftAnswerOf=Eu;exports.draftConversionOf=yu;exports.editViewOf=Yo;exports.explorerNavigationOf=Ca;exports.explorerNavigationOptions=Ra;exports.failureTitleOf=ce;exports.findConflictsInLines=Tr;exports.focusWithoutScroll=an;exports.frameTopOf=qr;exports.isApplePlatform=Jo;exports.isEditViewShortcut=es;exports.isEditingDoubleClick=Ir;exports.isInFullscreenBlock=pa;exports.keepInView=so;exports.lineTopIn=Hr;exports.loadedOf=pe;exports.paneShownAlone=bd;exports.positionInSource=Sa;exports.readFolderReadme=Ar;exports.resolveMarkdownExplorerLabels=Zt;exports.scrollBarControlsFor=ln;exports.shouldRevalidateExplorer=xu;exports.stopKeepingInView=oo;exports.toggledEditView=Qo;exports.useCoarsePointer=fn;exports.useExplorer=$;exports.useExplorerLocation=Et;exports.useExplorerNavigate=De;exports.useIntentPrefetch=zr;exports.usePageMarkupToggle=go;exports.useSaveRequest=ts;exports.useSideBySide=_r;exports.useViewSetting=ge;exports.visibleTopOf=Br;